From ac7e01cd7b887b247554854bf9bd768116412b86 Mon Sep 17 00:00:00 2001 From: support Date: Thu, 20 Oct 2022 06:39:41 +0000 Subject: [PATCH] Built motion from commit 5c69fa63.|2.6.19 --- 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/contacts/index.js | 2 +- server/components/contacts/sql-utils.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/interaction/sql-utils.js | 2 +- .../components/interaction/update-interaction.js | 2 +- server/components/interaction/utils.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.js | 2 +- server/components/realtime/agents.js | 2 +- server/components/realtime/queues.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/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/index.js | 2 +- server/services/ami/dialer/models/action.js | 2 +- server/services/ami/dialer/models/agentComplete.js | 2 +- server/services/ami/dialer/models/final.js | 2 +- server/services/ami/dialer/models/hangup.js | 2 +- server/services/ami/dialer/models/history.js | 2 +- .../ami/dialer/models/queueCallerAbandon.js | 2 +- server/services/ami/dialer/utils/hopper.js | 2 +- server/services/ami/dialer/utils/index.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/voiceQueueSummary.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/realtime/utils.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/interval.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/iftime.js | 2 +- server/utils/loggers.js | 2 +- server/utils/mask-sensitive-data.js | 2 +- server/utils/safe-template.js | 2 +- server/utils/update-app-config.js | 2 +- snippet/3.5.0/index.html | 139 +- snippet/3.5.0/scripts/app.js | 44 +- snippet/3.5.0/scripts/app.js.LICENSE.txt | 19 + snippet/3.5.0/scripts/app.js.map | 1 - snippet/3.5.0/scripts/chat.js |149332 +------------------- snippet/3.5.0/scripts/chat.js.LICENSE.txt | 7 + snippet/3.5.0/scripts/chat.js.map | 2 +- snippet/3.5.0/scripts/mobile.js | 29 +- snippet/3.5.0/scripts/mobile.js.map | 1 - snippet/3.5.0/scripts/runtime.js | 207 +- snippet/3.5.0/scripts/runtime.js.map | 2 +- snippet/3.5.0/scripts/vendor-angular-58d021f3.js | 2 + .../3.5.0/scripts/vendor-angular-58d021f3.js.map | 1 + snippet/3.5.0/scripts/vendor-angular-76f2ed34.js | 3 + .../scripts/vendor-angular-76f2ed34.js.LICENSE.txt | 5 + .../3.5.0/scripts/vendor-angular-76f2ed34.js.map | 1 + snippet/3.5.0/scripts/vendor-angular-animate.js | 3 + .../scripts/vendor-angular-animate.js.LICENSE.txt | 5 + .../3.5.0/scripts/vendor-angular-animate.js.map | 1 + .../3.5.0/scripts/vendor-angular-local-storage.js | 3 + .../vendor-angular-local-storage.js.LICENSE.txt | 7 + .../scripts/vendor-angular-local-storage.js.map | 1 + snippet/3.5.0/scripts/vendor-angular-material.js | 3 + .../scripts/vendor-angular-material.js.LICENSE.txt | 6 + .../3.5.0/scripts/vendor-angular-material.js.map | 1 + snippet/3.5.0/scripts/vendor-angular-messages.js | 3 + .../scripts/vendor-angular-messages.js.LICENSE.txt | 5 + .../3.5.0/scripts/vendor-angular-messages.js.map | 1 + snippet/3.5.0/scripts/vendor-angular-resource.js | 3 + .../scripts/vendor-angular-resource.js.LICENSE.txt | 5 + .../3.5.0/scripts/vendor-angular-resource.js.map | 1 + snippet/3.5.0/scripts/vendor-angular-sanitize.js | 3 + .../scripts/vendor-angular-sanitize.js.LICENSE.txt | 5 + .../3.5.0/scripts/vendor-angular-sanitize.js.map | 1 + snippet/3.5.0/scripts/vendor-emojione.js | 2 + snippet/3.5.0/scripts/vendor-emojione.js.map | 1 + snippet/3.5.0/scripts/vendor-emojionearea.js | 3 + .../scripts/vendor-emojionearea.js.LICENSE.txt | 7 + snippet/3.5.0/scripts/vendor-emojionearea.js.map | 1 + snippet/3.5.0/scripts/vendor-flow.js | 3 + snippet/3.5.0/scripts/vendor-flow.js.LICENSE.txt | 3 + snippet/3.5.0/scripts/vendor-flow.js.map | 1 + snippet/3.5.0/scripts/vendor-index.js | 2 + snippet/3.5.0/scripts/vendor-index.js.map | 1 + snippet/3.5.0/scripts/vendor-jquery.js | 3 + snippet/3.5.0/scripts/vendor-jquery.js.LICENSE.txt | 24 + snippet/3.5.0/scripts/vendor-jquery.js.map | 1 + .../3.5.0/scripts/vendor-jquery.textcomplete.js | 3 + .../vendor-jquery.textcomplete.js.LICENSE.txt | 7 + .../scripts/vendor-jquery.textcomplete.js.map | 1 + snippet/3.5.0/scripts/vendor-moment.js | 3 + snippet/3.5.0/scripts/vendor-moment.js.LICENSE.txt | 1 + snippet/3.5.0/scripts/vendor-moment.js.map | 1 + snippet/3.5.0/scripts/vendor-ng-embed.js | 2 + snippet/3.5.0/scripts/vendor-ng-embed.js.map | 1 + snippet/3.5.0/scripts/vendor-stateDirectives.js | 2 + .../3.5.0/scripts/vendor-stateDirectives.js.map | 1 + snippet/3.5.0/scripts/vendor-stateService.js | 2 + snippet/3.5.0/scripts/vendor-stateService.js.map | 1 + snippet/3.5.0/scripts/vendor-transition.js | 2 + snippet/3.5.0/scripts/vendor-transition.js.map | 1 + snippet/3.5.0/scripts/vendor-urlMatcher.js | 2 + snippet/3.5.0/scripts/vendor-urlMatcher.js.map | 1 + snippet/3.5.0/styles/app.css |33279 +----- snippet/3.5.0/styles/app.css.map | 2 +- snippet/3.5.0/styles/mobile.css | 142 +- snippet/3.5.0/styles/mobile.css.map | 2 +- snippet/3.5.0/styles/vendor.css | 4463 + snippet/3.5.0/styles/vendor.css.map | 1 + snippet/3.5.0/templates/00860aee362cdeeb1080.html | 161 + snippet/3.5.0/templates/2444367602029f7ce07b.html | 161 - snippet/3.5.0/templates/3f18dac5f545add792db.html | 82 + snippet/3.5.0/templates/6043a16afdb829ba5934.html | 33 + snippet/3.5.0/templates/66a0b4b6e8658e97c814.html | 33 - snippet/3.5.0/templates/9962474df74f9405ac72.html | 262 + snippet/3.5.0/templates/c1e929900f2af303341f.html | 262 - snippet/3.5.0/templates/c6696015a1b93372d614.html | 82 - snippet/3.5.0/templates/caf0e553108b226443aa.html | 202 + snippet/3.5.0/templates/cd310ba2c496545551ae.html | 202 - snippet/3.5.0/templates/dc49a9ba939f8c099868.html | 145 + snippet/3.5.0/templates/f4b04fc57c34408c2d9e.html | 145 - 1284 files changed, 6749 insertions(+), 185251 deletions(-) create mode 100644 snippet/3.5.0/scripts/app.js.LICENSE.txt delete mode 100644 snippet/3.5.0/scripts/app.js.map create mode 100644 snippet/3.5.0/scripts/chat.js.LICENSE.txt delete mode 100644 snippet/3.5.0/scripts/mobile.js.map create mode 100644 snippet/3.5.0/scripts/vendor-angular-58d021f3.js create mode 100644 snippet/3.5.0/scripts/vendor-angular-58d021f3.js.map create mode 100644 snippet/3.5.0/scripts/vendor-angular-76f2ed34.js create mode 100644 snippet/3.5.0/scripts/vendor-angular-76f2ed34.js.LICENSE.txt create mode 100644 snippet/3.5.0/scripts/vendor-angular-76f2ed34.js.map create mode 100644 snippet/3.5.0/scripts/vendor-angular-animate.js create mode 100644 snippet/3.5.0/scripts/vendor-angular-animate.js.LICENSE.txt create mode 100644 snippet/3.5.0/scripts/vendor-angular-animate.js.map create mode 100644 snippet/3.5.0/scripts/vendor-angular-local-storage.js create mode 100644 snippet/3.5.0/scripts/vendor-angular-local-storage.js.LICENSE.txt create mode 100644 snippet/3.5.0/scripts/vendor-angular-local-storage.js.map create mode 100644 snippet/3.5.0/scripts/vendor-angular-material.js create mode 100644 snippet/3.5.0/scripts/vendor-angular-material.js.LICENSE.txt create mode 100644 snippet/3.5.0/scripts/vendor-angular-material.js.map create mode 100644 snippet/3.5.0/scripts/vendor-angular-messages.js create mode 100644 snippet/3.5.0/scripts/vendor-angular-messages.js.LICENSE.txt create mode 100644 snippet/3.5.0/scripts/vendor-angular-messages.js.map create mode 100644 snippet/3.5.0/scripts/vendor-angular-resource.js create mode 100644 snippet/3.5.0/scripts/vendor-angular-resource.js.LICENSE.txt create mode 100644 snippet/3.5.0/scripts/vendor-angular-resource.js.map create mode 100644 snippet/3.5.0/scripts/vendor-angular-sanitize.js create mode 100644 snippet/3.5.0/scripts/vendor-angular-sanitize.js.LICENSE.txt create mode 100644 snippet/3.5.0/scripts/vendor-angular-sanitize.js.map create mode 100644 snippet/3.5.0/scripts/vendor-emojione.js create mode 100644 snippet/3.5.0/scripts/vendor-emojione.js.map create mode 100644 snippet/3.5.0/scripts/vendor-emojionearea.js create mode 100644 snippet/3.5.0/scripts/vendor-emojionearea.js.LICENSE.txt create mode 100644 snippet/3.5.0/scripts/vendor-emojionearea.js.map create mode 100644 snippet/3.5.0/scripts/vendor-flow.js create mode 100644 snippet/3.5.0/scripts/vendor-flow.js.LICENSE.txt create mode 100644 snippet/3.5.0/scripts/vendor-flow.js.map create mode 100644 snippet/3.5.0/scripts/vendor-index.js create mode 100644 snippet/3.5.0/scripts/vendor-index.js.map create mode 100644 snippet/3.5.0/scripts/vendor-jquery.js create mode 100644 snippet/3.5.0/scripts/vendor-jquery.js.LICENSE.txt create mode 100644 snippet/3.5.0/scripts/vendor-jquery.js.map create mode 100644 snippet/3.5.0/scripts/vendor-jquery.textcomplete.js create mode 100644 snippet/3.5.0/scripts/vendor-jquery.textcomplete.js.LICENSE.txt create mode 100644 snippet/3.5.0/scripts/vendor-jquery.textcomplete.js.map create mode 100644 snippet/3.5.0/scripts/vendor-moment.js create mode 100644 snippet/3.5.0/scripts/vendor-moment.js.LICENSE.txt create mode 100644 snippet/3.5.0/scripts/vendor-moment.js.map create mode 100644 snippet/3.5.0/scripts/vendor-ng-embed.js create mode 100644 snippet/3.5.0/scripts/vendor-ng-embed.js.map create mode 100644 snippet/3.5.0/scripts/vendor-stateDirectives.js create mode 100644 snippet/3.5.0/scripts/vendor-stateDirectives.js.map create mode 100644 snippet/3.5.0/scripts/vendor-stateService.js create mode 100644 snippet/3.5.0/scripts/vendor-stateService.js.map create mode 100644 snippet/3.5.0/scripts/vendor-transition.js create mode 100644 snippet/3.5.0/scripts/vendor-transition.js.map create mode 100644 snippet/3.5.0/scripts/vendor-urlMatcher.js create mode 100644 snippet/3.5.0/scripts/vendor-urlMatcher.js.map create mode 100644 snippet/3.5.0/styles/vendor.css create mode 100644 snippet/3.5.0/styles/vendor.css.map create mode 100644 snippet/3.5.0/templates/00860aee362cdeeb1080.html delete mode 100644 snippet/3.5.0/templates/2444367602029f7ce07b.html create mode 100644 snippet/3.5.0/templates/3f18dac5f545add792db.html create mode 100644 snippet/3.5.0/templates/6043a16afdb829ba5934.html delete mode 100644 snippet/3.5.0/templates/66a0b4b6e8658e97c814.html create mode 100644 snippet/3.5.0/templates/9962474df74f9405ac72.html delete mode 100644 snippet/3.5.0/templates/c1e929900f2af303341f.html delete mode 100644 snippet/3.5.0/templates/c6696015a1b93372d614.html create mode 100644 snippet/3.5.0/templates/caf0e553108b226443aa.html delete mode 100644 snippet/3.5.0/templates/cd310ba2c496545551ae.html create mode 100644 snippet/3.5.0/templates/dc49a9ba939f8c099868.html delete mode 100644 snippet/3.5.0/templates/f4b04fc57c34408c2d9e.html diff --git a/apidoc/api_project.js b/apidoc/api_project.js index ed01f3a..be06e5c 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-10-18T12:15:45.303Z", + "time": "2022-10-20T06:31:00.055Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 4fdb429..89e4214 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-18T12:15:45.303Z", + "time": "2022-10-20T06:31:00.055Z", "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 5baf726..c1bbbdd 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 _0xde73=['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]','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','browser','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x349066,_0xf982a0){var _0x5a5242=function(_0xe794f9){while(--_0xe794f9){_0x349066['push'](_0x349066['shift']());}};_0x5a5242(++_0xf982a0);}(_0xde73,0x137));var _0x3de7=function(_0x5ca5b0,_0x8a4bee){_0x5ca5b0=_0x5ca5b0-0x0;var _0x3abdc0=_0xde73[_0x5ca5b0];return _0x3abdc0;};'use strict';var Sequelize=require(_0x3de7('0x0'));module[_0x3de7('0x1')]={'name':{'type':Sequelize[_0x3de7('0x2')],'get':function(_0x49d1b4){return this[_0x3de7('0x3')](_0x3de7('0x4'));}},'action':{'type':Sequelize[_0x3de7('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x3de7('0x6'),_0x3de7('0x7'),_0x3de7('0x8'),_0x3de7('0x9'),'urlForward',_0x3de7('0xa'),'bot','script']],'msg':_0x3de7('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x3de7('0x5')](0x1000),'comment':_0x3de7('0xc')},'data2':{'type':Sequelize[_0x3de7('0x5')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x3de7('0x5')](0x1000),'comment':_0x3de7('0xd')},'data4':{'type':Sequelize[_0x3de7('0x5')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x3de7('0x5')](0x1000),'comments':_0x3de7('0xe')},'data6':{'type':Sequelize[_0x3de7('0x5')],'comments':_0x3de7('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':_0x3de7('0x10')}}; \ No newline at end of file +var _0xe6be=['exports','getDataValue','action','STRING','integration','motionbar','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize'];(function(_0x45b100,_0x29a4b1){var _0x1b41f8=function(_0x5a48b4){while(--_0x5a48b4){_0x45b100['push'](_0x45b100['shift']());}};_0x1b41f8(++_0x29a4b1);}(_0xe6be,0x153));var _0xee6b=function(_0xf4a50c,_0x887ae0){_0xf4a50c=_0xf4a50c-0x0;var _0x301d21=_0xe6be[_0xf4a50c];return _0x301d21;};'use strict';var Sequelize=require(_0xee6b('0x0'));module[_0xee6b('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3a851f){return this[_0xee6b('0x2')](_0xee6b('0x3'));}},'action':{'type':Sequelize[_0xee6b('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xee6b('0x5'),_0xee6b('0x6'),'jscripty',_0xee6b('0x7'),_0xee6b('0x8'),'bot',_0xee6b('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xee6b('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'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)]'},'data2':{'type':Sequelize[_0xee6b('0x4')](0x1000),'comment':_0xee6b('0xb')},'data3':{'type':Sequelize[_0xee6b('0x4')](0x1000),'comment':_0xee6b('0xc')},'data4':{'type':Sequelize[_0xee6b('0x4')](0x1000),'comments':_0xee6b('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xee6b('0xe')},'data6':{'type':Sequelize[_0xee6b('0x4')],'comments':_0xee6b('0xf')},'data7':{'type':Sequelize[_0xee6b('0x10')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 9bf3554..df6daf9 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 _0xeb0e=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','body','Action','params','destroy','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xeb0e,0x114));var _0xeeb0=function(_0x386f12,_0x4a313d){_0x386f12=_0x386f12-0x0;var _0x129b1c=_0xeb0e[_0x386f12];return _0x129b1c;};'use strict';var emlformat=require(_0xeeb0('0x0'));var rimraf=require(_0xeeb0('0x1'));var zipdir=require(_0xeeb0('0x2'));var jsonpatch=require(_0xeeb0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeeb0('0x4'));var Mustache=require(_0xeeb0('0x5'));var util=require(_0xeeb0('0x6'));var path=require(_0xeeb0('0x7'));var sox=require('sox');var csv=require(_0xeeb0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeeb0('0x9'));var _=require(_0xeeb0('0xa'));var squel=require(_0xeeb0('0xb'));var crypto=require(_0xeeb0('0xc'));var jsforce=require(_0xeeb0('0xd'));var deskjs=require(_0xeeb0('0xe'));var toCsv=require(_0xeeb0('0x8'));var querystring=require(_0xeeb0('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xeeb0('0x10'));var qs=require(_0xeeb0('0x11'));var as=require(_0xeeb0('0x12'));var hardwareService=require(_0xeeb0('0x13'));var logger=require(_0xeeb0('0x14'))(_0xeeb0('0x15'));var utils=require(_0xeeb0('0x16'));var config=require(_0xeeb0('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e8072,_0x41b97a){_0x41b97a=_0x41b97a||0xcc;return function(_0x20afdd){if(_0x20afdd){return _0x1e8072[_0xeeb0('0x18')](_0x41b97a);}return _0x1e8072[_0xeeb0('0x19')](_0x41b97a)[_0xeeb0('0x1a')]();};}function respondWithResult(_0x5cfc3e,_0x1610d3){_0x1610d3=_0x1610d3||0xc8;return function(_0x322f68){if(_0x322f68){return _0x5cfc3e['status'](_0x1610d3)[_0xeeb0('0x1b')](_0x322f68);}};}function respondWithFilteredResult(_0x19bfd9,_0x4c5cb9){return function(_0x4e1ea2){if(_0x4e1ea2){var _0x11f795=typeof _0x4c5cb9[_0xeeb0('0x1c')]==='undefined'&&typeof _0x4c5cb9[_0xeeb0('0x1d')]===_0xeeb0('0x1e');var _0x1eed72=_0x4e1ea2['count'];var _0x597a0c=_0x11f795?0x0:_0x4c5cb9['offset'];var _0x330a74=_0x11f795?_0x4e1ea2[_0xeeb0('0x1f')]:_0x4c5cb9['offset']+_0x4c5cb9[_0xeeb0('0x1d')];var _0x5d3acf;if(_0x330a74>=_0x1eed72){_0x330a74=_0x1eed72;_0x5d3acf=0xc8;}else{_0x5d3acf=0xce;}_0x19bfd9[_0xeeb0('0x19')](_0x5d3acf);return _0x19bfd9[_0xeeb0('0x20')](_0xeeb0('0x21'),_0x597a0c+'-'+_0x330a74+'/'+_0x1eed72)[_0xeeb0('0x1b')](_0x4e1ea2);}return null;};}function patchUpdates(_0x3acb05){return function(_0x596e0e){try{jsonpatch[_0xeeb0('0x22')](_0x596e0e,_0x3acb05,!![]);}catch(_0x7b2bc3){return BPromise[_0xeeb0('0x23')](_0x7b2bc3);}return _0x596e0e['save']();};}function saveUpdates(_0x47ac79,_0x3d19a7){return function(_0x11ede0){if(_0x11ede0){return _0x11ede0[_0xeeb0('0x24')](_0x47ac79)[_0xeeb0('0x25')](function(_0x56464d){return _0x56464d;});}return null;};}function removeEntity(_0x311190,_0x335cb3){return function(_0xf96b53){if(_0xf96b53){return _0xf96b53['destroy']()['then'](function(){_0x311190[_0xeeb0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c7afc,_0x5dfd37){return function(_0x4b2485){if(!_0x4b2485){_0x4c7afc[_0xeeb0('0x18')](0x194);}return _0x4b2485;};}function handleError(_0x4d9a44,_0x79672c){_0x79672c=_0x79672c||0x1f4;return function(_0x2fd26d){logger[_0xeeb0('0x26')](_0x2fd26d[_0xeeb0('0x27')]);if(_0x2fd26d[_0xeeb0('0x28')]){delete _0x2fd26d[_0xeeb0('0x28')];}_0x4d9a44[_0xeeb0('0x19')](_0x79672c)[_0xeeb0('0x29')](_0x2fd26d);};}exports[_0xeeb0('0x24')]=function(_0x31fe36,_0x42912d){if(_0x31fe36['body']['id']){delete _0x31fe36[_0xeeb0('0x2a')]['id'];}return db[_0xeeb0('0x2b')]['find']({'where':{'id':_0x31fe36[_0xeeb0('0x2c')]['id']}})[_0xeeb0('0x25')](handleEntityNotFound(_0x42912d,null))[_0xeeb0('0x25')](saveUpdates(_0x31fe36[_0xeeb0('0x2a')],null))[_0xeeb0('0x25')](respondWithResult(_0x42912d,null))['catch'](handleError(_0x42912d,null));};exports[_0xeeb0('0x2d')]=function(_0x55220d,_0x192f58){return db[_0xeeb0('0x2b')]['find']({'where':{'id':_0x55220d['params']['id']}})['then'](handleEntityNotFound(_0x192f58,null))[_0xeeb0('0x25')](removeEntity(_0x192f58,null))[_0xeeb0('0x2e')](handleError(_0x192f58,null));}; \ No newline at end of file +var _0xc2dc=['path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','update','body','Action','find','params','catch','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x2575cb,_0x33a71f){var _0x54107a=function(_0x1da8c8){while(--_0x1da8c8){_0x2575cb['push'](_0x2575cb['shift']());}};_0x54107a(++_0x33a71f);}(_0xc2dc,0x1ed));var _0xcc2d=function(_0x249f8c,_0xfb3946){_0x249f8c=_0x249f8c-0x0;var _0x5e224a=_0xc2dc[_0x249f8c];return _0x5e224a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc2d('0x0'));var zipdir=require(_0xcc2d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc2d('0x2'));var moment=require(_0xcc2d('0x3'));var BPromise=require(_0xcc2d('0x4'));var Mustache=require(_0xcc2d('0x5'));var util=require(_0xcc2d('0x6'));var path=require(_0xcc2d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcc2d('0x8'));var fs=require('fs');var fs_extra=require(_0xcc2d('0x9'));var _=require(_0xcc2d('0xa'));var squel=require(_0xcc2d('0xb'));var crypto=require('crypto');var jsforce=require(_0xcc2d('0xc'));var deskjs=require(_0xcc2d('0xd'));var toCsv=require(_0xcc2d('0xe'));var querystring=require(_0xcc2d('0xf'));var Papa=require(_0xcc2d('0x10'));var Redis=require(_0xcc2d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcc2d('0x12'));var as=require(_0xcc2d('0x13'));var hardwareService=require(_0xcc2d('0x14'));var logger=require(_0xcc2d('0x15'))(_0xcc2d('0x16'));var utils=require(_0xcc2d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcc2d('0x18'));var db=require(_0xcc2d('0x19'))['db'];function respondWithStatusCode(_0x38d44e,_0x471d72){_0x471d72=_0x471d72||0xcc;return function(_0x2acd27){if(_0x2acd27){return _0x38d44e[_0xcc2d('0x1a')](_0x471d72);}return _0x38d44e[_0xcc2d('0x1b')](_0x471d72)[_0xcc2d('0x1c')]();};}function respondWithResult(_0x2c08fc,_0x51ee71){_0x51ee71=_0x51ee71||0xc8;return function(_0x5e7253){if(_0x5e7253){return _0x2c08fc[_0xcc2d('0x1b')](_0x51ee71)[_0xcc2d('0x1d')](_0x5e7253);}};}function respondWithFilteredResult(_0x2bc118,_0x699589){return function(_0x317bca){if(_0x317bca){var _0x24ecc8=typeof _0x699589[_0xcc2d('0x1e')]===_0xcc2d('0x1f')&&typeof _0x699589[_0xcc2d('0x20')]===_0xcc2d('0x1f');var _0x3a0071=_0x317bca[_0xcc2d('0x21')];var _0x28386d=_0x24ecc8?0x0:_0x699589[_0xcc2d('0x1e')];var _0xdfc9fb=_0x24ecc8?_0x317bca['count']:_0x699589[_0xcc2d('0x1e')]+_0x699589[_0xcc2d('0x20')];var _0x559077;if(_0xdfc9fb>=_0x3a0071){_0xdfc9fb=_0x3a0071;_0x559077=0xc8;}else{_0x559077=0xce;}_0x2bc118[_0xcc2d('0x1b')](_0x559077);return _0x2bc118[_0xcc2d('0x22')](_0xcc2d('0x23'),_0x28386d+'-'+_0xdfc9fb+'/'+_0x3a0071)['json'](_0x317bca);}return null;};}function patchUpdates(_0x1121d4){return function(_0x3a394a){try{jsonpatch[_0xcc2d('0x24')](_0x3a394a,_0x1121d4,!![]);}catch(_0xc3a269){return BPromise['reject'](_0xc3a269);}return _0x3a394a[_0xcc2d('0x25')]();};}function saveUpdates(_0x4fc52f,_0x4d14ef){return function(_0x4c4690){if(_0x4c4690){return _0x4c4690['update'](_0x4fc52f)[_0xcc2d('0x26')](function(_0x4db0ad){return _0x4db0ad;});}return null;};}function removeEntity(_0x40b7ef,_0xf14946){return function(_0x3a94f8){if(_0x3a94f8){return _0x3a94f8[_0xcc2d('0x27')]()[_0xcc2d('0x26')](function(){_0x40b7ef[_0xcc2d('0x1b')](0xcc)[_0xcc2d('0x1c')]();});}};}function handleEntityNotFound(_0x4483e5,_0x49567f){return function(_0xa456d4){if(!_0xa456d4){_0x4483e5[_0xcc2d('0x1a')](0x194);}return _0xa456d4;};}function handleError(_0x3de478,_0x337cf7){_0x337cf7=_0x337cf7||0x1f4;return function(_0x1f6660){logger[_0xcc2d('0x28')](_0x1f6660[_0xcc2d('0x29')]);if(_0x1f6660[_0xcc2d('0x2a')]){delete _0x1f6660[_0xcc2d('0x2a')];}_0x3de478['status'](_0x337cf7)[_0xcc2d('0x2b')](_0x1f6660);};}exports[_0xcc2d('0x2c')]=function(_0x2463d1,_0x43ea8f){if(_0x2463d1[_0xcc2d('0x2d')]['id']){delete _0x2463d1[_0xcc2d('0x2d')]['id'];}return db[_0xcc2d('0x2e')][_0xcc2d('0x2f')]({'where':{'id':_0x2463d1[_0xcc2d('0x30')]['id']}})[_0xcc2d('0x26')](handleEntityNotFound(_0x43ea8f,null))['then'](saveUpdates(_0x2463d1[_0xcc2d('0x2d')],null))['then'](respondWithResult(_0x43ea8f,null))[_0xcc2d('0x31')](handleError(_0x43ea8f,null));};exports[_0xcc2d('0x27')]=function(_0x16b347,_0x568032){return db[_0xcc2d('0x2e')][_0xcc2d('0x2f')]({'where':{'id':_0x16b347[_0xcc2d('0x30')]['id']}})['then'](handleEntityNotFound(_0x568032,null))['then'](removeEntity(_0x568032,null))[_0xcc2d('0x31')](handleError(_0x568032,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 1f42a8a..58b7d82 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 _0x4be8=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4be8,0x12a));var _0x84be=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x4be8[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0x84be('0x0'));var util=require(_0x84be('0x1'));var logger=require(_0x84be('0x2'))(_0x84be('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x84be('0x4'));var fs=require('fs');var path=require(_0x84be('0x5'));var rimraf=require(_0x84be('0x6'));var config=require(_0x84be('0x7'));var attributes=require(_0x84be('0x8'));module[_0x84be('0x9')]=function(_0x38d233,_0x59ac51){return _0x38d233[_0x84be('0xa')](_0x84be('0xb'),attributes,{'tableName':_0x84be('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e54=['rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2e54,0xc1));var _0x42e5=function(_0x1a3c64,_0x18f1fa){_0x1a3c64=_0x1a3c64-0x0;var _0x4da2c2=_0x2e54[_0x1a3c64];return _0x4da2c2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x42e5('0x0'))(_0x42e5('0x1'));var moment=require(_0x42e5('0x2'));var BPromise=require(_0x42e5('0x3'));var rp=require(_0x42e5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42e5('0x5'));var config=require(_0x42e5('0x6'));var attributes=require(_0x42e5('0x7'));module[_0x42e5('0x8')]=function(_0x2b9dcb,_0x5f1ccb){return _0x2b9dcb['define'](_0x42e5('0x9'),attributes,{'tableName':_0x42e5('0xa'),'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 7f18cbf..820ea6c 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x5ebc37,_0x5b608d){var _0x12c58c=function(_0x327d7b){while(--_0x327d7b){_0x5ebc37['push'](_0x5ebc37['shift']());}};_0x12c58c(++_0x5b608d);}(_0xabce,0x103));var _0xeabc=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xabce[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\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(_0xe3a075,_0x31ecfb){var _0x18d717=function(_0x4c4dec){while(--_0x4c4dec){_0xe3a075['push'](_0xe3a075['shift']());}};_0x18d717(++_0x31ecfb);}(_0x1261,0x144));var _0x1126=function(_0x391507,_0x564142){_0x391507=_0x391507-0x0;var _0x47fdc4=_0x1261[_0x391507];return _0x47fdc4;};'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')]('Action,\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/action/index.js b/server/api/action/index.js index 1729510..4cf7f32 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 _0x001a=['util','path','express','Router','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','exports'];(function(_0x1f9841,_0x21c33f){var _0x4b096b=function(_0x828013){while(--_0x828013){_0x1f9841['push'](_0x1f9841['shift']());}};_0x4b096b(++_0x21c33f);}(_0x001a,0xa8));var _0xa001=function(_0x3ff685,_0x304b9e){_0x3ff685=_0x3ff685-0x0;var _0x2046c9=_0x001a[_0x3ff685];return _0x2046c9;};'use strict';var multer=require('multer');var util=require(_0xa001('0x0'));var path=require(_0xa001('0x1'));var timeout=require('connect-timeout');var express=require(_0xa001('0x2'));var router=express[_0xa001('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa001('0x4'));var config=require(_0xa001('0x5'));var controller=require(_0xa001('0x6'));router['put'](_0xa001('0x7'),auth[_0xa001('0x8')](),controller[_0xa001('0x9')]);router[_0xa001('0xa')](_0xa001('0x7'),auth[_0xa001('0x8')](),controller['destroy']);module[_0xa001('0xb')]=router; \ No newline at end of file +var _0xb2de=['../../config/environment','./action.controller','put','isAuthenticated','delete','/:id','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x438cd3,_0x1342ff){var _0x35033f=function(_0x3672b4){while(--_0x3672b4){_0x438cd3['push'](_0x438cd3['shift']());}};_0x35033f(++_0x1342ff);}(_0xb2de,0x187));var _0xeb2d=function(_0x3fc3fa,_0x18ad3f){_0x3fc3fa=_0x3fc3fa-0x0;var _0x1ac459=_0xb2de[_0x3fc3fa];return _0x1ac459;};'use strict';var multer=require('multer');var util=require(_0xeb2d('0x0'));var path=require('path');var timeout=require(_0xeb2d('0x1'));var express=require('express');var router=express[_0xeb2d('0x2')]();var fs_extra=require(_0xeb2d('0x3'));var auth=require(_0xeb2d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xeb2d('0x5'));var controller=require(_0xeb2d('0x6'));router[_0xeb2d('0x7')]('/:id',auth[_0xeb2d('0x8')](),controller['update']);router[_0xeb2d('0x9')](_0xeb2d('0xa'),auth[_0xeb2d('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index c65b427..123d549 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 _0x9c5a=['exports','STRING','TEXT','sequelize'];(function(_0x1265e8,_0x12d08d){var _0x39a982=function(_0x1e63fb){while(--_0x1e63fb){_0x1265e8['push'](_0x1265e8['shift']());}};_0x39a982(++_0x12d08d);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x5ee97d,_0x3d5b82){_0x5ee97d=_0x5ee97d-0x0;var _0xc91773=_0x9c5a[_0x5ee97d];return _0xc91773;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa9c5('0x2')]},'parent':{'type':Sequelize[_0xa9c5('0x2')]},'table':{'type':Sequelize[_0xa9c5('0x2')]},'conditions':{'type':Sequelize[_0xa9c5('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xd8fb=['TEXT','sequelize','exports','STRING'];(function(_0x5f532d,_0x191edf){var _0x43ad50=function(_0x386fa9){while(--_0x386fa9){_0x5f532d['push'](_0x5f532d['shift']());}};_0x43ad50(++_0x191edf);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1448be,_0x1e85dd){_0x1448be=_0x1448be-0x0;var _0x41abbe=_0xd8fb[_0x1448be];return _0x41abbe;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f86c30a..7967437 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 _0xc429=['include','findAll','rows','catch','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','metric','function','format','replace','groupBy','DESC','joins','parse','includes','parentKey','foreignKey','foreignTable','conditions','debug','sequelize','toString','QueryTypes','left_join','MIN(%s)','SEC_TO_TIME(%s)','IS\x20EMPTY','operator','getFields','MetricId','orderBy','alias','%s.%s\x20=\x20%s.%s','clone','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../files/reports','countTable','COUNT(*)','SELECT','options','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc429,0xfa));var _0x9c42=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0xc429[_0x533528];return _0x3189f1;};'use strict';var emlformat=require(_0x9c42('0x0'));var rimraf=require(_0x9c42('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c42('0x2'));var rp=require(_0x9c42('0x3'));var moment=require('moment');var BPromise=require(_0x9c42('0x4'));var Mustache=require(_0x9c42('0x5'));var util=require('util');var path=require(_0x9c42('0x6'));var sox=require(_0x9c42('0x7'));var csv=require(_0x9c42('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c42('0x9'));var _=require(_0x9c42('0xa'));var squel=require(_0x9c42('0xb'));var crypto=require(_0x9c42('0xc'));var jsforce=require(_0x9c42('0xd'));var deskjs=require(_0x9c42('0xe'));var toCsv=require(_0x9c42('0x8'));var querystring=require(_0x9c42('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9c42('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9c42('0x11'));var hardwareService=require(_0x9c42('0x12'));var logger=require('../../config/logger')(_0x9c42('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9c42('0x14'));var db=require(_0x9c42('0x15'))['db'];var dbH=require(_0x9c42('0x15'))[_0x9c42('0x16')];function respondWithStatusCode(_0x19aaeb,_0x4ea36f){_0x4ea36f=_0x4ea36f||0xcc;return function(_0x27f5a2){if(_0x27f5a2){return _0x19aaeb[_0x9c42('0x17')](_0x4ea36f);}return _0x19aaeb[_0x9c42('0x18')](_0x4ea36f)[_0x9c42('0x19')]();};}function respondWithResult(_0x25dc3d,_0x10ab0b){_0x10ab0b=_0x10ab0b||0xc8;return function(_0x555b82){if(_0x555b82){return _0x25dc3d[_0x9c42('0x18')](_0x10ab0b)['json'](_0x555b82);}};}function respondWithFilteredResult(_0x45fce8,_0x48031d){return function(_0x35d8c5){if(_0x35d8c5){var _0x217082=typeof _0x48031d['offset']==='undefined'&&typeof _0x48031d[_0x9c42('0x1a')]===_0x9c42('0x1b');var _0x1829f4=_0x35d8c5['count'];var _0x369f5a=_0x217082?0x0:_0x48031d[_0x9c42('0x1c')];var _0x22b31c=_0x217082?_0x35d8c5[_0x9c42('0x1d')]:_0x48031d['offset']+_0x48031d[_0x9c42('0x1a')];var _0xe19796;if(_0x22b31c>=_0x1829f4){_0x22b31c=_0x1829f4;_0xe19796=0xc8;}else{_0xe19796=0xce;}_0x45fce8[_0x9c42('0x18')](_0xe19796);return _0x45fce8[_0x9c42('0x1e')](_0x9c42('0x1f'),_0x369f5a+'-'+_0x22b31c+'/'+_0x1829f4)['json'](_0x35d8c5);}return null;};}function patchUpdates(_0x487e9e){return function(_0x52fdfc){try{jsonpatch[_0x9c42('0x20')](_0x52fdfc,_0x487e9e,!![]);}catch(_0x334309){return BPromise[_0x9c42('0x21')](_0x334309);}return _0x52fdfc[_0x9c42('0x22')]();};}function saveUpdates(_0x47ac54,_0x4aa3ac){return function(_0x467105){if(_0x467105){return _0x467105[_0x9c42('0x23')](_0x47ac54)[_0x9c42('0x24')](function(_0x283eb3){return _0x283eb3;});}return null;};}function removeEntity(_0x5b4ad5,_0x47bf11){return function(_0x2bd1a2){if(_0x2bd1a2){return _0x2bd1a2[_0x9c42('0x25')]()[_0x9c42('0x24')](function(){var _0x1a1613=_0x2bd1a2['get']({'plain':!![]});var _0xd5c714=_0x9c42('0x26');return db[_0x9c42('0x27')]['destroy']({'where':{'type':_0xd5c714,'resourceId':_0x1a1613['id']}})[_0x9c42('0x24')](function(){return _0x2bd1a2;});})[_0x9c42('0x24')](function(){_0x5b4ad5[_0x9c42('0x18')](0xcc)[_0x9c42('0x19')]();});}};}function handleEntityNotFound(_0x70838,_0xbf776f){return function(_0x34c93b){if(!_0x34c93b){_0x70838['sendStatus'](0x194);}return _0x34c93b;};}function handleError(_0x1b34bd,_0xa2eda5){_0xa2eda5=_0xa2eda5||0x1f4;return function(_0x4afd10){logger[_0x9c42('0x28')](_0x4afd10[_0x9c42('0x29')]);if(_0x4afd10[_0x9c42('0x2a')]){delete _0x4afd10['name'];}_0x1b34bd[_0x9c42('0x18')](_0xa2eda5)[_0x9c42('0x2b')](_0x4afd10);};}exports[_0x9c42('0x2c')]=function(_0x56c9cd,_0x1cfbc5){var _0x407875={},_0x3e788a={},_0x4ced00={'count':0x0,'rows':[]};var _0x301d88=_['map'](db[_0x9c42('0x2d')][_0x9c42('0x2e')],function(_0x57f1cd){return{'name':_0x57f1cd[_0x9c42('0x2f')],'type':_0x57f1cd[_0x9c42('0x30')][_0x9c42('0x31')]};});_0x3e788a['model']=_[_0x9c42('0x32')](_0x301d88,'name');_0x3e788a[_0x9c42('0x33')]=_[_0x9c42('0x34')](_0x56c9cd[_0x9c42('0x33')]);_0x3e788a[_0x9c42('0x35')]=_[_0x9c42('0x36')](_0x3e788a[_0x9c42('0x37')],_0x3e788a['query']);_0x407875[_0x9c42('0x38')]=_[_0x9c42('0x36')](_0x3e788a['model'],qs[_0x9c42('0x39')](_0x56c9cd[_0x9c42('0x33')]['fields']));_0x407875['attributes']=_0x407875['attributes'][_0x9c42('0x3a')]?_0x407875[_0x9c42('0x38')]:_0x3e788a[_0x9c42('0x37')];if(!_0x56c9cd[_0x9c42('0x33')]['hasOwnProperty'](_0x9c42('0x3b'))){_0x407875[_0x9c42('0x1a')]=qs[_0x9c42('0x1a')](_0x56c9cd[_0x9c42('0x33')][_0x9c42('0x1a')]);_0x407875['offset']=qs[_0x9c42('0x1c')](_0x56c9cd['query']['offset']);}_0x407875[_0x9c42('0x3c')]=qs[_0x9c42('0x3d')](_0x56c9cd[_0x9c42('0x33')][_0x9c42('0x3d')]);_0x407875['where']=qs[_0x9c42('0x35')](_['pick'](_0x56c9cd[_0x9c42('0x33')],_0x3e788a['filters']),_0x301d88);if(_0x56c9cd['query'][_0x9c42('0x3e')]){_0x407875[_0x9c42('0x3f')]=_[_0x9c42('0x40')](_0x407875[_0x9c42('0x3f')],{'$or':_[_0x9c42('0x32')](_0x301d88,function(_0x109350){if(_0x109350[_0x9c42('0x30')]!==_0x9c42('0x41')){var _0xfefd76={};_0xfefd76[_0x109350['name']]={'$like':'%'+_0x56c9cd['query'][_0x9c42('0x3e')]+'%'};return _0xfefd76;}})});}_0x407875=_[_0x9c42('0x40')]({},_0x407875,_0x56c9cd['options']);var _0x2b1f60={'where':_0x407875['where']};return db[_0x9c42('0x2d')][_0x9c42('0x1d')](_0x2b1f60)[_0x9c42('0x24')](function(_0x16b967){_0x4ced00[_0x9c42('0x1d')]=_0x16b967;if(_0x56c9cd[_0x9c42('0x33')]['includeAll']){_0x407875[_0x9c42('0x42')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x9c42('0x43')](_0x407875);})['then'](function(_0x523984){_0x4ced00[_0x9c42('0x44')]=_0x523984;return _0x4ced00;})[_0x9c42('0x24')](respondWithFilteredResult(_0x1cfbc5,_0x407875))[_0x9c42('0x45')](handleError(_0x1cfbc5,null));};exports['show']=function(_0x54ca63,_0x4e77cc){var _0x5d07cc={'raw':![],'where':{'id':_0x54ca63['params']['id']}},_0x4c07fd={};_0x4c07fd[_0x9c42('0x37')]=_[_0x9c42('0x34')](db[_0x9c42('0x2d')]['rawAttributes']);_0x4c07fd['query']=_[_0x9c42('0x34')](_0x54ca63[_0x9c42('0x33')]);_0x4c07fd[_0x9c42('0x35')]=_['intersection'](_0x4c07fd[_0x9c42('0x37')],_0x4c07fd['query']);_0x5d07cc[_0x9c42('0x38')]=_[_0x9c42('0x36')](_0x4c07fd[_0x9c42('0x37')],qs[_0x9c42('0x39')](_0x54ca63[_0x9c42('0x33')][_0x9c42('0x39')]));_0x5d07cc[_0x9c42('0x38')]=_0x5d07cc['attributes'][_0x9c42('0x3a')]?_0x5d07cc['attributes']:_0x4c07fd[_0x9c42('0x37')];if(_0x54ca63[_0x9c42('0x33')]['includeAll']){_0x5d07cc[_0x9c42('0x42')]=[{'all':!![]}];}_0x5d07cc=_[_0x9c42('0x40')]({},_0x5d07cc,_0x54ca63['options']);return db[_0x9c42('0x2d')][_0x9c42('0x46')](_0x5d07cc)[_0x9c42('0x24')](handleEntityNotFound(_0x4e77cc,null))[_0x9c42('0x24')](respondWithResult(_0x4e77cc,null))[_0x9c42('0x45')](handleError(_0x4e77cc,null));};exports[_0x9c42('0x47')]=function(_0x481c91,_0x5431d8){return db[_0x9c42('0x2d')][_0x9c42('0x47')](_0x481c91['body'],{})[_0x9c42('0x24')](function(_0x1be0f9){var _0x8e31b4=_0x481c91['user']['get']({'plain':!![]});if(!_0x8e31b4)throw new Error(_0x9c42('0x48'));if(_0x8e31b4['role']===_0x9c42('0x49')){var _0x584265=_0x1be0f9[_0x9c42('0x4a')]({'plain':!![]});var _0x714440='Reports';return db[_0x9c42('0x4b')]['find']({'where':{'name':_0x714440,'userProfileId':_0x8e31b4['userProfileId']},'raw':!![]})['then'](function(_0x42e81c){if(_0x42e81c&&_0x42e81c[_0x9c42('0x4c')]===0x0){return db['UserProfileResource'][_0x9c42('0x47')]({'name':_0x584265[_0x9c42('0x2a')],'resourceId':_0x584265['id'],'type':'CustomReports','sectionId':_0x42e81c['id']},{})[_0x9c42('0x24')](function(){return _0x1be0f9;});}else{return _0x1be0f9;}})['catch'](function(_0x24b97b){logger['error'](_0x9c42('0x4d'),_0x24b97b);throw _0x24b97b;});}return _0x1be0f9;})[_0x9c42('0x24')](respondWithResult(_0x5431d8,0xc9))[_0x9c42('0x45')](handleError(_0x5431d8,null));};exports[_0x9c42('0x23')]=function(_0x451514,_0x272c10){if(_0x451514[_0x9c42('0x4e')]['id']){delete _0x451514[_0x9c42('0x4e')]['id'];}return db['AnalyticCustomReport'][_0x9c42('0x46')]({'where':{'id':_0x451514[_0x9c42('0x4f')]['id']}})[_0x9c42('0x24')](handleEntityNotFound(_0x272c10,null))[_0x9c42('0x24')](saveUpdates(_0x451514['body'],null))[_0x9c42('0x24')](respondWithResult(_0x272c10,null))[_0x9c42('0x45')](handleError(_0x272c10,null));};exports[_0x9c42('0x25')]=function(_0x421222,_0x1fdc5d){return db[_0x9c42('0x2d')][_0x9c42('0x46')]({'where':{'id':_0x421222['params']['id']}})[_0x9c42('0x24')](handleEntityNotFound(_0x1fdc5d,null))[_0x9c42('0x24')](removeEntity(_0x1fdc5d,null))[_0x9c42('0x45')](handleError(_0x1fdc5d,null));};exports[_0x9c42('0x50')]=function(_0x5f51b5,_0x22aa64){var _0x50e6bd=0xa;var _0x2b0c80=[_0x9c42('0x51'),'left_join',_0x9c42('0x52'),_0x9c42('0x53')];var _0x4d7f42={'SUM':_0x9c42('0x54'),'COUNT':_0x9c42('0x55'),'COUNT DISTINCT':_0x9c42('0x56'),'MAX':_0x9c42('0x57'),'MIN':'MIN(%s)','AVG':_0x9c42('0x58'),'GROUP_CONCAT':_0x9c42('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9c42('0x5a')};var _0x37eeb2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9c42('0x5b'),'HOUR':_0x9c42('0x5c'),'ROUND':_0x9c42('0x5d'),'UNIX_TIMESTAMP':_0x9c42('0x5e')};var _0x2bf35b=function(_0x3ee1c2){return!_['includes']([_0x9c42('0x5f'),_0x9c42('0x60'),'IS\x20EMPTY',_0x9c42('0x61')],_0x3ee1c2);};var _0x382ed8=function(_0x1bd4a9){if(!_0x1bd4a9||!_0x1bd4a9[_0x9c42('0x62')][_0x9c42('0x3a')]){return'';}for(var _0x483781='(',_0x26f065=0x0;_0x26f065<_0x1bd4a9[_0x9c42('0x62')][_0x9c42('0x3a')];_0x26f065+=0x1){_0x26f065>0x0&&(_0x483781+='\x20'+_0x1bd4a9['operator']+'\x20');_0x483781+=_0x1bd4a9[_0x9c42('0x62')][_0x26f065]['group']?_0x382ed8(_0x1bd4a9[_0x9c42('0x62')][_0x26f065][_0x9c42('0x63')]):_0x1bd4a9['rules'][_0x26f065][_0x9c42('0x64')]+'\x20'+_0x1bd4a9[_0x9c42('0x62')][_0x26f065][_0x9c42('0x65')]+(_0x2bf35b(_0x1bd4a9[_0x9c42('0x62')][_0x26f065]['condition'])?'\x20'+_0x1bd4a9['rules'][_0x26f065][_0x9c42('0x66')]:'');}return _0x483781+')';};var _0x3a6dc1={'where':{'id':_0x5f51b5['params']['id']}},_0x22036d,_0x454447,_0x78ef0f,_0x2dbb0b,_0x3cbd0b;_0x3a6dc1=_[_0x9c42('0x40')]({},_0x3a6dc1,_0x5f51b5['options']);return db[_0x9c42('0x2d')][_0x9c42('0x46')](_0x3a6dc1)['then'](function(_0x1d9f30){if(_0x1d9f30){_0x22036d=_0x1d9f30;return _0x1d9f30['getFields']();}return null;})[_0x9c42('0x24')](function(_0x29815f){if(_0x29815f){if(!_0x29815f['length']){throw new db[(_0x9c42('0x67'))][(_0x9c42('0x68'))](_0x9c42('0x69'),0x193);}_0x454447=_0x29815f;return db['AnalyticMetric'][_0x9c42('0x43')]({'raw':!![]});}return null;})['then'](function(_0x57fca6){if(_0x57fca6){_0x78ef0f=_[_0x9c42('0x6a')](_0x57fca6,'id');var _0x435521;var _0x1d09c6=squel[_0x9c42('0x6b')]();_0x1d09c6[_0x9c42('0x6c')](_0x22036d[_0x9c42('0x6d')]);for(var _0x3e5e9f=0x0;_0x3e5e9f<_0x454447['length'];_0x3e5e9f+=0x1){_0x435521=_0x454447[_0x3e5e9f]['MetricId']?_0x78ef0f[_0x454447[_0x3e5e9f]['MetricId']][_0x9c42('0x6e')]:_0x454447[_0x3e5e9f][_0x9c42('0x64')];_0x435521=_0x454447[_0x3e5e9f][_0x9c42('0x6f')]?_['replace'](_0x4d7f42[_0x454447[_0x3e5e9f][_0x9c42('0x6f')]],'%s',_0x435521):_0x435521;_0x435521=_0x454447[_0x3e5e9f][_0x9c42('0x70')]?_[_0x9c42('0x71')](_0x37eeb2[_0x454447[_0x3e5e9f]['format']],'%s',_0x435521):_0x435521;if(_0x454447[_0x3e5e9f][_0x9c42('0x72')]){_0x1d09c6['group'](_0x435521);}_0x454447[_0x3e5e9f]['orderBy']&&_0x1d09c6[_0x9c42('0x3c')](_0x435521,_0x454447[_0x3e5e9f]['orderBy']===_0x9c42('0x73')?![]:!![]);_0x1d09c6[_0x9c42('0x64')](_0x435521,_0x454447[_0x3e5e9f]['alias']||_0x435521);}if(_0x22036d[_0x9c42('0x74')]){_0x22036d['joins']=JSON[_0x9c42('0x75')](_0x22036d['joins']);for(var _0x15186f=0x0;_0x15186f<_0x22036d[_0x9c42('0x74')][_0x9c42('0x3a')];_0x15186f+=0x1){if(_0x22036d[_0x9c42('0x74')][_0x15186f][_0x9c42('0x30')]&&_[_0x9c42('0x76')](_0x2b0c80,_0x22036d[_0x9c42('0x74')][_0x15186f]['type'])&&_0x22036d[_0x9c42('0x74')][_0x15186f][_0x9c42('0x77')]&&_0x22036d['joins'][_0x15186f]['foreignTable']&&_0x22036d[_0x9c42('0x74')][_0x15186f][_0x9c42('0x78')]){_0x1d09c6[_0x22036d[_0x9c42('0x74')][_0x15186f][_0x9c42('0x30')]](_0x22036d[_0x9c42('0x74')][_0x15186f]['foreignTable'],null,util[_0x9c42('0x70')]('%s.%s\x20=\x20%s.%s',_0x22036d[_0x9c42('0x6d')],_0x22036d[_0x9c42('0x74')][_0x15186f][_0x9c42('0x77')],_0x22036d[_0x9c42('0x74')][_0x15186f][_0x9c42('0x79')],_0x22036d['joins'][_0x15186f][_0x9c42('0x78')]));}}}if(_0x22036d[_0x9c42('0x7a')]){_0x22036d[_0x9c42('0x7a')]=JSON['parse'](_0x22036d[_0x9c42('0x7a')]);_0x1d09c6[_0x9c42('0x3f')](_0x382ed8(_0x22036d[_0x9c42('0x7a')][_0x9c42('0x63')]));}_0x3cbd0b=_0x1d09c6['clone']();_0x1d09c6[_0x9c42('0x1a')](_0x50e6bd);_0x1d09c6[_0x9c42('0x1c')](0x0);logger[_0x9c42('0x7b')]('Limited\x20Query:',_0x1d09c6['toString']());return dbH[_0x9c42('0x7c')]['query'](_0x1d09c6[_0x9c42('0x7d')](),{'type':dbH['sequelize'][_0x9c42('0x7e')]['SELECT']});}})['then'](respondWithResult(_0x22aa64,null))[_0x9c42('0x45')](handleError(_0x22aa64,null));};function runReport(_0x1dd677,_0x1a6b0e,_0x54cee0){var _0x559e98=_0x1a6b0e[_0x9c42('0x2a')];var _0x562bc8=0xa;var _0x5e354e=[_0x9c42('0x51'),_0x9c42('0x7f'),_0x9c42('0x52'),_0x9c42('0x53')];var _0x10ad9b={'SUM':_0x9c42('0x54'),'COUNT':_0x9c42('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9c42('0x57'),'MIN':_0x9c42('0x80'),'AVG':_0x9c42('0x58'),'GROUP_CONCAT':_0x9c42('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9c42('0x5a')};var _0x5886fd={'SEC_TO_TIME':_0x9c42('0x81'),'DATE':_0x9c42('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9c42('0x5e')};var _0xacd486=function(_0x3fc240){return!_['includes']([_0x9c42('0x5f'),_0x9c42('0x60'),_0x9c42('0x82'),_0x9c42('0x61')],_0x3fc240);};var _0x565ea6=function(_0x5015fd){if(!_0x5015fd||!_0x5015fd[_0x9c42('0x62')][_0x9c42('0x3a')]){return'';}for(var _0x3f60b2='(',_0x4a7149=0x0;_0x4a7149<_0x5015fd[_0x9c42('0x62')]['length'];_0x4a7149+=0x1){_0x4a7149>0x0&&(_0x3f60b2+='\x20'+_0x5015fd[_0x9c42('0x83')]+'\x20');_0x3f60b2+=_0x5015fd[_0x9c42('0x62')][_0x4a7149][_0x9c42('0x63')]?_0x565ea6(_0x5015fd['rules'][_0x4a7149][_0x9c42('0x63')]):_0x5015fd['rules'][_0x4a7149][_0x9c42('0x64')]+'\x20'+_0x5015fd[_0x9c42('0x62')][_0x4a7149][_0x9c42('0x65')]+(_0xacd486(_0x5015fd[_0x9c42('0x62')][_0x4a7149][_0x9c42('0x65')])?'\x20'+_0x5015fd[_0x9c42('0x62')][_0x4a7149]['value']:'');}return _0x3f60b2+')';};var _0x47892c={'where':{'id':_0x1dd677['id']}},_0x2054dc,_0x3e896,_0x2a705e,_0x4768de,_0x375034;_0x47892c=_[_0x9c42('0x40')]({},_0x47892c,_0x54cee0);return db[_0x9c42('0x2d')][_0x9c42('0x46')](_0x47892c)['then'](function(_0x14aafa){if(_0x14aafa){_0x2054dc=_0x14aafa;return _0x14aafa[_0x9c42('0x84')]();}return null;})[_0x9c42('0x24')](function(_0x392833){if(_0x392833){if(!_0x392833[_0x9c42('0x3a')]){throw new db['Sequelize'][(_0x9c42('0x68'))](_0x9c42('0x69'),0x193);}_0x3e896=_0x392833;return db['AnalyticMetric'][_0x9c42('0x43')]({'raw':!![]});}return null;})[_0x9c42('0x24')](function(_0x9ae3a9){if(_0x9ae3a9){_0x2a705e=_[_0x9c42('0x6a')](_0x9ae3a9,'id');var _0x58b4e7;var _0x392f29=squel[_0x9c42('0x6b')]();_0x392f29[_0x9c42('0x6c')](_0x2054dc[_0x9c42('0x6d')]);for(var _0x478b68=0x0;_0x478b68<_0x3e896[_0x9c42('0x3a')];_0x478b68+=0x1){_0x58b4e7=_0x3e896[_0x478b68][_0x9c42('0x85')]?_0x2a705e[_0x3e896[_0x478b68]['MetricId']][_0x9c42('0x6e')]:_0x3e896[_0x478b68][_0x9c42('0x64')];_0x58b4e7=_0x3e896[_0x478b68][_0x9c42('0x6f')]?_['replace'](_0x10ad9b[_0x3e896[_0x478b68]['function']],'%s',_0x58b4e7):_0x58b4e7;_0x58b4e7=_0x3e896[_0x478b68][_0x9c42('0x70')]?_[_0x9c42('0x71')](_0x5886fd[_0x3e896[_0x478b68]['format']],'%s',_0x58b4e7):_0x58b4e7;if(_0x3e896[_0x478b68][_0x9c42('0x72')]){_0x392f29[_0x9c42('0x63')](_0x58b4e7);}_0x3e896[_0x478b68][_0x9c42('0x86')]&&_0x392f29[_0x9c42('0x3c')](_0x58b4e7,_0x3e896[_0x478b68][_0x9c42('0x86')]==='DESC'?![]:!![]);_0x392f29[_0x9c42('0x64')](_0x58b4e7,_0x3e896[_0x478b68][_0x9c42('0x87')]||_0x58b4e7);}if(_0x2054dc['joins']){_0x2054dc[_0x9c42('0x74')]=JSON['parse'](_0x2054dc[_0x9c42('0x74')]);for(var _0x4c9ae6=0x0;_0x4c9ae6<_0x2054dc['joins']['length'];_0x4c9ae6+=0x1){if(_0x2054dc['joins'][_0x4c9ae6]['type']&&_[_0x9c42('0x76')](_0x5e354e,_0x2054dc[_0x9c42('0x74')][_0x4c9ae6][_0x9c42('0x30')])&&_0x2054dc['joins'][_0x4c9ae6][_0x9c42('0x77')]&&_0x2054dc[_0x9c42('0x74')][_0x4c9ae6][_0x9c42('0x79')]&&_0x2054dc[_0x9c42('0x74')][_0x4c9ae6][_0x9c42('0x78')]){_0x392f29[_0x2054dc['joins'][_0x4c9ae6][_0x9c42('0x30')]](_0x2054dc[_0x9c42('0x74')][_0x4c9ae6][_0x9c42('0x79')],null,util['format'](_0x9c42('0x88'),_0x2054dc[_0x9c42('0x6d')],_0x2054dc[_0x9c42('0x74')][_0x4c9ae6][_0x9c42('0x77')],_0x2054dc[_0x9c42('0x74')][_0x4c9ae6][_0x9c42('0x79')],_0x2054dc['joins'][_0x4c9ae6][_0x9c42('0x78')]));}}}if(_0x2054dc[_0x9c42('0x7a')]){_0x2054dc[_0x9c42('0x7a')]=JSON['parse'](_0x2054dc['conditions']);_0x392f29[_0x9c42('0x3f')](_0x565ea6(_0x2054dc[_0x9c42('0x7a')][_0x9c42('0x63')]));}_0x375034=_0x392f29[_0x9c42('0x89')]();_0x392f29[_0x9c42('0x1a')](_0x562bc8);_0x392f29[_0x9c42('0x1c')](0x0);return;}})[_0x9c42('0x24')](function(){if(_0x1a6b0e[_0x9c42('0x8a')]==='web'){return null;}var _0xfe0b25=_[_0x9c42('0x40')](_0x1a6b0e,{'name':_0x1a6b0e[_0x9c42('0x8b')]||_0x1a6b0e[_0x9c42('0x2a')]||_0x2054dc[_0x9c42('0x2a')],'basename':_0x559e98,'savename':util[_0x9c42('0x70')](_0x9c42('0x8c'),_0x1a6b0e['name']||_0x2054dc[_0x9c42('0x2a')],require(_0x9c42('0x8d'))[_0x9c42('0x8e')](0x4),_0x1a6b0e[_0x9c42('0x8a')]||_0x9c42('0x8f')),'reportId':_0x2054dc['id'],'reportType':_0x9c42('0x90')});return db['AnalyticExtractedReport'][_0x9c42('0x47')](_0xfe0b25,{'raw':!![]});})['then'](function(_0x18b52d){if(_0x2054dc[_0x9c42('0x6d')]==='cdr'){_0x375034['where'](_0x2054dc[_0x9c42('0x6d')]+_0x9c42('0x91'),_0x1a6b0e['startDate'],_0x1a6b0e[_0x9c42('0x92')]);}else{_0x375034['where'](_0x2054dc['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1a6b0e['startDate'],_0x1a6b0e[_0x9c42('0x92')]);}if(_0x18b52d){logger['info'](_0x9c42('0x93'),_0x375034[_0x9c42('0x7d')]());require(_0x9c42('0x94'))[_0x9c42('0x95')](path[_0x9c42('0x51')](__dirname,'../../components/export/',_0x18b52d['output']),[_0x18b52d['id'],_0x375034[_0x9c42('0x7d')](),path['join'](__dirname,_0x9c42('0x96'),_0x18b52d['savename']),_0x559e98]);return _0x18b52d;}else{var _0x2814b0=squel['select']();_0x2814b0[_0x9c42('0x6c')]('('+_0x375034[_0x9c42('0x7d')]()+')',_0x9c42('0x97'));_0x2814b0['field'](_0x9c42('0x98'),'count');_0x375034[_0x9c42('0x1a')](_0x1a6b0e[_0x9c42('0x1a')]||_0x562bc8);_0x375034[_0x9c42('0x1c')](_0x1a6b0e[_0x9c42('0x1c')]||0x0);return dbH[_0x9c42('0x7c')][_0x9c42('0x33')](_0x2814b0['toString'](),{'type':dbH['sequelize'][_0x9c42('0x7e')][_0x9c42('0x99')]})[_0x9c42('0x24')](function(_0x41791d){if(!_0x41791d[_0x9c42('0x3a')]){_0x4768de=0x0;}else{_0x4768de=_0x41791d[0x0][_0x9c42('0x1d')]||0x0;}return dbH[_0x9c42('0x7c')][_0x9c42('0x33')](_0x375034[_0x9c42('0x7d')](),{'type':dbH[_0x9c42('0x7c')][_0x9c42('0x7e')]['SELECT']});})[_0x9c42('0x24')](function(_0x3224da){return{'rows':_0x3224da||[],'count':_0x4768de};});}});}exports['run']=function(_0x3c723c,_0x5018fb){return runReport(_0x3c723c[_0x9c42('0x4f')],_0x3c723c[_0x9c42('0x33')],_0x3c723c[_0x9c42('0x9a')])[_0x9c42('0x24')](respondWithResult(_0x5018fb,null))['catch'](handleError(_0x5018fb,null));};exports[_0x9c42('0x9b')]=runReport;exports[_0x9c42('0x33')]=function(_0x46d507,_0x3f79a3){var _0x533ddf=0xa;var _0x59a1d1=['join','left_join',_0x9c42('0x52'),_0x9c42('0x53')];var _0x398f03={'SUM':_0x9c42('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9c42('0x56'),'MAX':'MAX(%s)','MIN':_0x9c42('0x80'),'AVG':_0x9c42('0x58'),'GROUP_CONCAT':_0x9c42('0x59'),'GROUP_CONCAT ASC':_0x9c42('0x9c'),'GROUP_CONCAT DESC':_0x9c42('0x5a')};var _0x4d0d0a={'SEC_TO_TIME':_0x9c42('0x81'),'DATE':_0x9c42('0x5b'),'HOUR':_0x9c42('0x5c'),'ROUND':_0x9c42('0x5d'),'UNIX_TIMESTAMP':_0x9c42('0x5e')};var _0x2724c3=function(_0x3e2ce6){return!_[_0x9c42('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x9c42('0x82'),_0x9c42('0x61')],_0x3e2ce6);};var _0x28cf37=function(_0x8baacc){if(!_0x8baacc||!_0x8baacc[_0x9c42('0x62')][_0x9c42('0x3a')]){return'';}for(var _0x1c6bf5='(',_0x3b71e8=0x0;_0x3b71e8<_0x8baacc[_0x9c42('0x62')]['length'];_0x3b71e8+=0x1){_0x3b71e8>0x0&&(_0x1c6bf5+='\x20'+_0x8baacc[_0x9c42('0x83')]+'\x20');_0x1c6bf5+=_0x8baacc['rules'][_0x3b71e8][_0x9c42('0x63')]?_0x28cf37(_0x8baacc[_0x9c42('0x62')][_0x3b71e8]['group']):_0x8baacc[_0x9c42('0x62')][_0x3b71e8]['field']+'\x20'+_0x8baacc['rules'][_0x3b71e8][_0x9c42('0x65')]+(_0x2724c3(_0x8baacc[_0x9c42('0x62')][_0x3b71e8]['condition'])?'\x20'+_0x8baacc[_0x9c42('0x62')][_0x3b71e8][_0x9c42('0x66')]:'');}return _0x1c6bf5+')';};var _0x5f9210={'where':{'id':_0x46d507[_0x9c42('0x4f')]['id']}},_0x5f584d,_0x536350,_0x2aac49,_0x30d329,_0x28c16a;_0x5f9210=_['merge']({},_0x5f9210,_0x46d507[_0x9c42('0x9a')]);return db[_0x9c42('0x2d')][_0x9c42('0x46')](_0x5f9210)[_0x9c42('0x24')](function(_0x292c87){if(_0x292c87){_0x5f584d=_0x292c87;return _0x292c87[_0x9c42('0x84')]();}return null;})[_0x9c42('0x24')](function(_0x2d510a){if(_0x2d510a){if(!_0x2d510a['length']){throw new db['Sequelize'][(_0x9c42('0x68'))](_0x9c42('0x69'),0x193);}_0x536350=_0x2d510a;return db['AnalyticMetric'][_0x9c42('0x43')]({'raw':!![]});}return null;})['then'](function(_0x1c25f2){if(_0x1c25f2){_0x2aac49=_['keyBy'](_0x1c25f2,'id');var _0x1d42ad;var _0x2c0f28=squel[_0x9c42('0x6b')]();_0x2c0f28[_0x9c42('0x6c')](_0x5f584d[_0x9c42('0x6d')]);for(var _0x5a53be=0x0;_0x5a53be<_0x536350[_0x9c42('0x3a')];_0x5a53be+=0x1){_0x1d42ad=_0x536350[_0x5a53be][_0x9c42('0x85')]?_0x2aac49[_0x536350[_0x5a53be]['MetricId']][_0x9c42('0x6e')]:_0x536350[_0x5a53be][_0x9c42('0x64')];_0x1d42ad=_0x536350[_0x5a53be]['function']?_[_0x9c42('0x71')](_0x398f03[_0x536350[_0x5a53be][_0x9c42('0x6f')]],'%s',_0x1d42ad):_0x1d42ad;_0x1d42ad=_0x536350[_0x5a53be][_0x9c42('0x70')]?_[_0x9c42('0x71')](_0x4d0d0a[_0x536350[_0x5a53be]['format']],'%s',_0x1d42ad):_0x1d42ad;if(_0x536350[_0x5a53be][_0x9c42('0x72')]){_0x2c0f28[_0x9c42('0x63')](_0x1d42ad);}_0x536350[_0x5a53be][_0x9c42('0x86')]&&_0x2c0f28[_0x9c42('0x3c')](_0x1d42ad,_0x536350[_0x5a53be][_0x9c42('0x86')]===_0x9c42('0x73')?![]:!![]);_0x2c0f28[_0x9c42('0x64')](_0x1d42ad,_0x536350[_0x5a53be]['alias']||_0x1d42ad);}if(_0x5f584d['joins']){_0x5f584d[_0x9c42('0x74')]=JSON[_0x9c42('0x75')](_0x5f584d[_0x9c42('0x74')]);for(var _0x4f7621=0x0;_0x4f7621<_0x5f584d[_0x9c42('0x74')][_0x9c42('0x3a')];_0x4f7621+=0x1){if(_0x5f584d[_0x9c42('0x74')][_0x4f7621][_0x9c42('0x30')]&&_[_0x9c42('0x76')](_0x59a1d1,_0x5f584d['joins'][_0x4f7621]['type'])&&_0x5f584d[_0x9c42('0x74')][_0x4f7621][_0x9c42('0x77')]&&_0x5f584d[_0x9c42('0x74')][_0x4f7621][_0x9c42('0x79')]&&_0x5f584d[_0x9c42('0x74')][_0x4f7621][_0x9c42('0x78')]){_0x2c0f28[_0x5f584d[_0x9c42('0x74')][_0x4f7621][_0x9c42('0x30')]](_0x5f584d[_0x9c42('0x74')][_0x4f7621][_0x9c42('0x79')],null,util[_0x9c42('0x70')](_0x9c42('0x88'),_0x5f584d[_0x9c42('0x6d')],_0x5f584d[_0x9c42('0x74')][_0x4f7621][_0x9c42('0x77')],_0x5f584d['joins'][_0x4f7621]['foreignTable'],_0x5f584d[_0x9c42('0x74')][_0x4f7621]['foreignKey']));}}}if(_0x5f584d[_0x9c42('0x7a')]){_0x5f584d[_0x9c42('0x7a')]=JSON[_0x9c42('0x75')](_0x5f584d[_0x9c42('0x7a')]);_0x2c0f28[_0x9c42('0x3f')](_0x28cf37(_0x5f584d['conditions'][_0x9c42('0x63')]));}_0x28c16a=_0x2c0f28[_0x9c42('0x89')]();_0x2c0f28['limit'](_0x533ddf);_0x2c0f28[_0x9c42('0x1c')](0x0);logger[_0x9c42('0x7b')](_0x9c42('0x9d'),_0x2c0f28[_0x9c42('0x7d')]());return dbH[_0x9c42('0x7c')][_0x9c42('0x33')](_0x2c0f28[_0x9c42('0x7d')](),{'type':dbH['sequelize'][_0x9c42('0x7e')]['SELECT']});}})[_0x9c42('0x24')](function(){return{'sql':_0x28c16a['toString']()};})[_0x9c42('0x24')](respondWithResult(_0x3f79a3,null))['catch'](handleError(_0x3f79a3,null));}; \ No newline at end of file +var _0xffe1=['sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','operator','condition','value','keyBy','foreignKey','clone','output','web','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','COUNT(%s)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','findAll','show','params','includeAll','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','field','function','format','replace','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','debug','Limited\x20Query:','toString'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0xffe1,0xcc));var _0x1ffe=function(_0xa4c391,_0x5b0eaa){_0xa4c391=_0xa4c391-0x0;var _0x5f0f3f=_0xffe1[_0xa4c391];return _0x5f0f3f;};'use strict';var emlformat=require(_0x1ffe('0x0'));var rimraf=require(_0x1ffe('0x1'));var zipdir=require(_0x1ffe('0x2'));var jsonpatch=require(_0x1ffe('0x3'));var rp=require(_0x1ffe('0x4'));var moment=require(_0x1ffe('0x5'));var BPromise=require(_0x1ffe('0x6'));var Mustache=require(_0x1ffe('0x7'));var util=require('util');var path=require(_0x1ffe('0x8'));var sox=require(_0x1ffe('0x9'));var csv=require(_0x1ffe('0xa'));var ejs=require(_0x1ffe('0xb'));var fs=require('fs');var fs_extra=require(_0x1ffe('0xc'));var _=require('lodash');var squel=require(_0x1ffe('0xd'));var crypto=require(_0x1ffe('0xe'));var jsforce=require(_0x1ffe('0xf'));var deskjs=require(_0x1ffe('0x10'));var toCsv=require(_0x1ffe('0xa'));var querystring=require(_0x1ffe('0x11'));var Papa=require(_0x1ffe('0x12'));var Redis=require(_0x1ffe('0x13'));var authService=require(_0x1ffe('0x14'));var qs=require(_0x1ffe('0x15'));var as=require(_0x1ffe('0x16'));var hardwareService=require(_0x1ffe('0x17'));var logger=require(_0x1ffe('0x18'))('api');var utils=require(_0x1ffe('0x19'));var config=require(_0x1ffe('0x1a'));var licenseUtil=require(_0x1ffe('0x1b'));var db=require(_0x1ffe('0x1c'))['db'];var dbH=require(_0x1ffe('0x1c'))[_0x1ffe('0x1d')];function respondWithStatusCode(_0x4ac7fc,_0x1c2a86){_0x1c2a86=_0x1c2a86||0xcc;return function(_0x286c26){if(_0x286c26){return _0x4ac7fc[_0x1ffe('0x1e')](_0x1c2a86);}return _0x4ac7fc[_0x1ffe('0x1f')](_0x1c2a86)[_0x1ffe('0x20')]();};}function respondWithResult(_0x7b3221,_0x11128d){_0x11128d=_0x11128d||0xc8;return function(_0x53da5d){if(_0x53da5d){return _0x7b3221[_0x1ffe('0x1f')](_0x11128d)[_0x1ffe('0x21')](_0x53da5d);}};}function respondWithFilteredResult(_0x28f61e,_0xffa0cb){return function(_0x522dbd){if(_0x522dbd){var _0x2b25e7=typeof _0xffa0cb['offset']===_0x1ffe('0x22')&&typeof _0xffa0cb[_0x1ffe('0x23')]===_0x1ffe('0x22');var _0x954cb4=_0x522dbd[_0x1ffe('0x24')];var _0x230939=_0x2b25e7?0x0:_0xffa0cb[_0x1ffe('0x25')];var _0x5ef533=_0x2b25e7?_0x522dbd[_0x1ffe('0x24')]:_0xffa0cb[_0x1ffe('0x25')]+_0xffa0cb[_0x1ffe('0x23')];var _0x191154;if(_0x5ef533>=_0x954cb4){_0x5ef533=_0x954cb4;_0x191154=0xc8;}else{_0x191154=0xce;}_0x28f61e[_0x1ffe('0x1f')](_0x191154);return _0x28f61e[_0x1ffe('0x26')](_0x1ffe('0x27'),_0x230939+'-'+_0x5ef533+'/'+_0x954cb4)[_0x1ffe('0x21')](_0x522dbd);}return null;};}function patchUpdates(_0x264e23){return function(_0x569ad1){try{jsonpatch[_0x1ffe('0x28')](_0x569ad1,_0x264e23,!![]);}catch(_0x59a20a){return BPromise['reject'](_0x59a20a);}return _0x569ad1[_0x1ffe('0x29')]();};}function saveUpdates(_0x4f329e,_0x2bf2da){return function(_0x8b553b){if(_0x8b553b){return _0x8b553b[_0x1ffe('0x2a')](_0x4f329e)['then'](function(_0x31f9d2){return _0x31f9d2;});}return null;};}function removeEntity(_0x4ed09e,_0x53cfa0){return function(_0x33ac17){if(_0x33ac17){return _0x33ac17[_0x1ffe('0x2b')]()[_0x1ffe('0x2c')](function(){var _0x24bec0=_0x33ac17[_0x1ffe('0x2d')]({'plain':!![]});var _0x25ed69='CustomReports';return db[_0x1ffe('0x2e')][_0x1ffe('0x2b')]({'where':{'type':_0x25ed69,'resourceId':_0x24bec0['id']}})['then'](function(){return _0x33ac17;});})['then'](function(){_0x4ed09e[_0x1ffe('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4be600,_0x4a213f){return function(_0x2273a2){if(!_0x2273a2){_0x4be600[_0x1ffe('0x1e')](0x194);}return _0x2273a2;};}function handleError(_0x51a90e,_0x30252a){_0x30252a=_0x30252a||0x1f4;return function(_0x53f419){logger[_0x1ffe('0x2f')](_0x53f419[_0x1ffe('0x30')]);if(_0x53f419[_0x1ffe('0x31')]){delete _0x53f419[_0x1ffe('0x31')];}_0x51a90e[_0x1ffe('0x1f')](_0x30252a)[_0x1ffe('0x32')](_0x53f419);};}exports[_0x1ffe('0x33')]=function(_0x3c124d,_0x4037b7){var _0x3d128b={},_0x2b92c2={},_0x42972c={'count':0x0,'rows':[]};var _0x552bba=_[_0x1ffe('0x34')](db[_0x1ffe('0x35')][_0x1ffe('0x36')],function(_0xbbbfa4){return{'name':_0xbbbfa4[_0x1ffe('0x37')],'type':_0xbbbfa4[_0x1ffe('0x38')][_0x1ffe('0x39')]};});_0x2b92c2[_0x1ffe('0x3a')]=_['map'](_0x552bba,_0x1ffe('0x31'));_0x2b92c2[_0x1ffe('0x3b')]=_['keys'](_0x3c124d[_0x1ffe('0x3b')]);_0x2b92c2[_0x1ffe('0x3c')]=_[_0x1ffe('0x3d')](_0x2b92c2[_0x1ffe('0x3a')],_0x2b92c2[_0x1ffe('0x3b')]);_0x3d128b[_0x1ffe('0x3e')]=_['intersection'](_0x2b92c2[_0x1ffe('0x3a')],qs[_0x1ffe('0x3f')](_0x3c124d[_0x1ffe('0x3b')][_0x1ffe('0x3f')]));_0x3d128b[_0x1ffe('0x3e')]=_0x3d128b[_0x1ffe('0x3e')][_0x1ffe('0x40')]?_0x3d128b['attributes']:_0x2b92c2['model'];if(!_0x3c124d[_0x1ffe('0x3b')][_0x1ffe('0x41')](_0x1ffe('0x42'))){_0x3d128b[_0x1ffe('0x23')]=qs[_0x1ffe('0x23')](_0x3c124d[_0x1ffe('0x3b')][_0x1ffe('0x23')]);_0x3d128b['offset']=qs[_0x1ffe('0x25')](_0x3c124d['query'][_0x1ffe('0x25')]);}_0x3d128b[_0x1ffe('0x43')]=qs[_0x1ffe('0x44')](_0x3c124d[_0x1ffe('0x3b')][_0x1ffe('0x44')]);_0x3d128b[_0x1ffe('0x45')]=qs['filters'](_[_0x1ffe('0x46')](_0x3c124d[_0x1ffe('0x3b')],_0x2b92c2[_0x1ffe('0x3c')]),_0x552bba);if(_0x3c124d[_0x1ffe('0x3b')]['filter']){_0x3d128b[_0x1ffe('0x45')]=_[_0x1ffe('0x47')](_0x3d128b[_0x1ffe('0x45')],{'$or':_[_0x1ffe('0x34')](_0x552bba,function(_0x4bec10){if(_0x4bec10['type']!==_0x1ffe('0x48')){var _0x339c00={};_0x339c00[_0x4bec10[_0x1ffe('0x31')]]={'$like':'%'+_0x3c124d[_0x1ffe('0x3b')]['filter']+'%'};return _0x339c00;}})});}_0x3d128b=_[_0x1ffe('0x47')]({},_0x3d128b,_0x3c124d[_0x1ffe('0x49')]);var _0x23fe4a={'where':_0x3d128b['where']};return db[_0x1ffe('0x35')]['count'](_0x23fe4a)['then'](function(_0x46c6bd){_0x42972c[_0x1ffe('0x24')]=_0x46c6bd;if(_0x3c124d[_0x1ffe('0x3b')]['includeAll']){_0x3d128b['include']=[{'all':!![]}];}return db[_0x1ffe('0x35')][_0x1ffe('0x4a')](_0x3d128b);})[_0x1ffe('0x2c')](function(_0x3fdf04){_0x42972c['rows']=_0x3fdf04;return _0x42972c;})['then'](respondWithFilteredResult(_0x4037b7,_0x3d128b))['catch'](handleError(_0x4037b7,null));};exports[_0x1ffe('0x4b')]=function(_0x45ab63,_0x438997){var _0x175d87={'raw':![],'where':{'id':_0x45ab63[_0x1ffe('0x4c')]['id']}},_0x1802a7={};_0x1802a7[_0x1ffe('0x3a')]=_['keys'](db[_0x1ffe('0x35')][_0x1ffe('0x36')]);_0x1802a7[_0x1ffe('0x3b')]=_['keys'](_0x45ab63[_0x1ffe('0x3b')]);_0x1802a7[_0x1ffe('0x3c')]=_[_0x1ffe('0x3d')](_0x1802a7[_0x1ffe('0x3a')],_0x1802a7[_0x1ffe('0x3b')]);_0x175d87[_0x1ffe('0x3e')]=_[_0x1ffe('0x3d')](_0x1802a7[_0x1ffe('0x3a')],qs[_0x1ffe('0x3f')](_0x45ab63[_0x1ffe('0x3b')][_0x1ffe('0x3f')]));_0x175d87['attributes']=_0x175d87[_0x1ffe('0x3e')][_0x1ffe('0x40')]?_0x175d87[_0x1ffe('0x3e')]:_0x1802a7[_0x1ffe('0x3a')];if(_0x45ab63[_0x1ffe('0x3b')][_0x1ffe('0x4d')]){_0x175d87[_0x1ffe('0x4e')]=[{'all':!![]}];}_0x175d87=_[_0x1ffe('0x47')]({},_0x175d87,_0x45ab63['options']);return db[_0x1ffe('0x35')]['find'](_0x175d87)[_0x1ffe('0x2c')](handleEntityNotFound(_0x438997,null))['then'](respondWithResult(_0x438997,null))[_0x1ffe('0x4f')](handleError(_0x438997,null));};exports[_0x1ffe('0x50')]=function(_0x3eee37,_0x18684f){return db[_0x1ffe('0x35')][_0x1ffe('0x50')](_0x3eee37[_0x1ffe('0x51')],{})[_0x1ffe('0x2c')](function(_0x50b9d9){var _0x4c9317=_0x3eee37[_0x1ffe('0x52')][_0x1ffe('0x2d')]({'plain':!![]});if(!_0x4c9317)throw new Error(_0x1ffe('0x53'));if(_0x4c9317[_0x1ffe('0x54')]===_0x1ffe('0x52')){var _0x2cc1ca=_0x50b9d9[_0x1ffe('0x2d')]({'plain':!![]});var _0x53acb1=_0x1ffe('0x55');return db[_0x1ffe('0x56')][_0x1ffe('0x57')]({'where':{'name':_0x53acb1,'userProfileId':_0x4c9317['userProfileId']},'raw':!![]})[_0x1ffe('0x2c')](function(_0x26f6a9){if(_0x26f6a9&&_0x26f6a9[_0x1ffe('0x58')]===0x0){return db[_0x1ffe('0x2e')]['create']({'name':_0x2cc1ca[_0x1ffe('0x31')],'resourceId':_0x2cc1ca['id'],'type':_0x1ffe('0x59'),'sectionId':_0x26f6a9['id']},{})['then'](function(){return _0x50b9d9;});}else{return _0x50b9d9;}})[_0x1ffe('0x4f')](function(_0x4e568c){logger[_0x1ffe('0x2f')](_0x1ffe('0x5a'),_0x4e568c);throw _0x4e568c;});}return _0x50b9d9;})['then'](respondWithResult(_0x18684f,0xc9))[_0x1ffe('0x4f')](handleError(_0x18684f,null));};exports['update']=function(_0x33e8e9,_0x46514d){if(_0x33e8e9[_0x1ffe('0x51')]['id']){delete _0x33e8e9['body']['id'];}return db[_0x1ffe('0x35')][_0x1ffe('0x57')]({'where':{'id':_0x33e8e9[_0x1ffe('0x4c')]['id']}})[_0x1ffe('0x2c')](handleEntityNotFound(_0x46514d,null))[_0x1ffe('0x2c')](saveUpdates(_0x33e8e9[_0x1ffe('0x51')],null))[_0x1ffe('0x2c')](respondWithResult(_0x46514d,null))[_0x1ffe('0x4f')](handleError(_0x46514d,null));};exports[_0x1ffe('0x2b')]=function(_0x3d03e8,_0x4b5832){return db[_0x1ffe('0x35')][_0x1ffe('0x57')]({'where':{'id':_0x3d03e8[_0x1ffe('0x4c')]['id']}})[_0x1ffe('0x2c')](handleEntityNotFound(_0x4b5832,null))['then'](removeEntity(_0x4b5832,null))[_0x1ffe('0x4f')](handleError(_0x4b5832,null));};exports[_0x1ffe('0x5b')]=function(_0xd94d8e,_0x199186){var _0x1cc86b=0xa;var _0x37ac85=[_0x1ffe('0x5c'),_0x1ffe('0x5d'),_0x1ffe('0x5e'),_0x1ffe('0x5f')];var _0xe592d5={'SUM':_0x1ffe('0x60'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1ffe('0x61'),'MAX':_0x1ffe('0x62'),'MIN':_0x1ffe('0x63'),'AVG':_0x1ffe('0x64'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1ffe('0x65'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2493e1={'SEC_TO_TIME':_0x1ffe('0x66'),'DATE':_0x1ffe('0x67'),'HOUR':_0x1ffe('0x68'),'ROUND':_0x1ffe('0x69'),'UNIX_TIMESTAMP':_0x1ffe('0x6a')};var _0x5d2c65=function(_0xfd160d){return!_[_0x1ffe('0x6b')]([_0x1ffe('0x6c'),_0x1ffe('0x6d'),'IS\x20EMPTY',_0x1ffe('0x6e')],_0xfd160d);};var _0x364438=function(_0x5ed7fa){if(!_0x5ed7fa||!_0x5ed7fa[_0x1ffe('0x6f')]['length']){return'';}for(var _0x1eb099='(',_0x2519f9=0x0;_0x2519f9<_0x5ed7fa['rules'][_0x1ffe('0x40')];_0x2519f9+=0x1){_0x2519f9>0x0&&(_0x1eb099+='\x20'+_0x5ed7fa['operator']+'\x20');_0x1eb099+=_0x5ed7fa[_0x1ffe('0x6f')][_0x2519f9]['group']?_0x364438(_0x5ed7fa[_0x1ffe('0x6f')][_0x2519f9][_0x1ffe('0x70')]):_0x5ed7fa[_0x1ffe('0x6f')][_0x2519f9]['field']+'\x20'+_0x5ed7fa[_0x1ffe('0x6f')][_0x2519f9]['condition']+(_0x5d2c65(_0x5ed7fa[_0x1ffe('0x6f')][_0x2519f9]['condition'])?'\x20'+_0x5ed7fa[_0x1ffe('0x6f')][_0x2519f9]['value']:'');}return _0x1eb099+')';};var _0x3fbc67={'where':{'id':_0xd94d8e[_0x1ffe('0x4c')]['id']}},_0x1c1f96,_0x17bb5f,_0x31e5ac,_0x29b371,_0x135074;_0x3fbc67=_[_0x1ffe('0x47')]({},_0x3fbc67,_0xd94d8e[_0x1ffe('0x49')]);return db[_0x1ffe('0x35')]['find'](_0x3fbc67)[_0x1ffe('0x2c')](function(_0x415096){if(_0x415096){_0x1c1f96=_0x415096;return _0x415096[_0x1ffe('0x71')]();}return null;})['then'](function(_0xe76c2b){if(_0xe76c2b){if(!_0xe76c2b[_0x1ffe('0x40')]){throw new db[(_0x1ffe('0x72'))][(_0x1ffe('0x73'))](_0x1ffe('0x74'),0x193);}_0x17bb5f=_0xe76c2b;return db[_0x1ffe('0x75')][_0x1ffe('0x4a')]({'raw':!![]});}return null;})[_0x1ffe('0x2c')](function(_0x197e51){if(_0x197e51){_0x31e5ac=_['keyBy'](_0x197e51,'id');var _0x221ea9;var _0x26b9f7=squel[_0x1ffe('0x76')]();_0x26b9f7[_0x1ffe('0x77')](_0x1c1f96[_0x1ffe('0x78')]);for(var _0x44e4f3=0x0;_0x44e4f3<_0x17bb5f['length'];_0x44e4f3+=0x1){_0x221ea9=_0x17bb5f[_0x44e4f3]['MetricId']?_0x31e5ac[_0x17bb5f[_0x44e4f3][_0x1ffe('0x79')]][_0x1ffe('0x7a')]:_0x17bb5f[_0x44e4f3][_0x1ffe('0x7b')];_0x221ea9=_0x17bb5f[_0x44e4f3][_0x1ffe('0x7c')]?_['replace'](_0xe592d5[_0x17bb5f[_0x44e4f3]['function']],'%s',_0x221ea9):_0x221ea9;_0x221ea9=_0x17bb5f[_0x44e4f3][_0x1ffe('0x7d')]?_[_0x1ffe('0x7e')](_0x2493e1[_0x17bb5f[_0x44e4f3]['format']],'%s',_0x221ea9):_0x221ea9;if(_0x17bb5f[_0x44e4f3][_0x1ffe('0x7f')]){_0x26b9f7[_0x1ffe('0x70')](_0x221ea9);}_0x17bb5f[_0x44e4f3][_0x1ffe('0x80')]&&_0x26b9f7[_0x1ffe('0x43')](_0x221ea9,_0x17bb5f[_0x44e4f3]['orderBy']===_0x1ffe('0x81')?![]:!![]);_0x26b9f7[_0x1ffe('0x7b')](_0x221ea9,_0x17bb5f[_0x44e4f3][_0x1ffe('0x82')]||_0x221ea9);}if(_0x1c1f96[_0x1ffe('0x83')]){_0x1c1f96[_0x1ffe('0x83')]=JSON['parse'](_0x1c1f96[_0x1ffe('0x83')]);for(var _0x168b32=0x0;_0x168b32<_0x1c1f96[_0x1ffe('0x83')][_0x1ffe('0x40')];_0x168b32+=0x1){if(_0x1c1f96[_0x1ffe('0x83')][_0x168b32][_0x1ffe('0x38')]&&_[_0x1ffe('0x6b')](_0x37ac85,_0x1c1f96[_0x1ffe('0x83')][_0x168b32][_0x1ffe('0x38')])&&_0x1c1f96[_0x1ffe('0x83')][_0x168b32][_0x1ffe('0x84')]&&_0x1c1f96['joins'][_0x168b32][_0x1ffe('0x85')]&&_0x1c1f96[_0x1ffe('0x83')][_0x168b32]['foreignKey']){_0x26b9f7[_0x1c1f96[_0x1ffe('0x83')][_0x168b32][_0x1ffe('0x38')]](_0x1c1f96[_0x1ffe('0x83')][_0x168b32][_0x1ffe('0x85')],null,util[_0x1ffe('0x7d')](_0x1ffe('0x86'),_0x1c1f96[_0x1ffe('0x78')],_0x1c1f96['joins'][_0x168b32][_0x1ffe('0x84')],_0x1c1f96[_0x1ffe('0x83')][_0x168b32][_0x1ffe('0x85')],_0x1c1f96[_0x1ffe('0x83')][_0x168b32]['foreignKey']));}}}if(_0x1c1f96[_0x1ffe('0x87')]){_0x1c1f96[_0x1ffe('0x87')]=JSON[_0x1ffe('0x88')](_0x1c1f96[_0x1ffe('0x87')]);_0x26b9f7[_0x1ffe('0x45')](_0x364438(_0x1c1f96[_0x1ffe('0x87')]['group']));}_0x135074=_0x26b9f7['clone']();_0x26b9f7['limit'](_0x1cc86b);_0x26b9f7['offset'](0x0);logger[_0x1ffe('0x89')](_0x1ffe('0x8a'),_0x26b9f7[_0x1ffe('0x8b')]());return dbH[_0x1ffe('0x8c')][_0x1ffe('0x3b')](_0x26b9f7['toString'](),{'type':dbH[_0x1ffe('0x8c')][_0x1ffe('0x8d')][_0x1ffe('0x8e')]});}})['then'](respondWithResult(_0x199186,null))[_0x1ffe('0x4f')](handleError(_0x199186,null));};function runReport(_0x13e085,_0x4554f8,_0x3770bd){var _0x37bed9=_0x4554f8[_0x1ffe('0x31')];var _0x562d04=0xa;var _0x5e38f9=[_0x1ffe('0x5c'),_0x1ffe('0x5d'),_0x1ffe('0x5e'),_0x1ffe('0x5f')];var _0x2298ac={'SUM':_0x1ffe('0x60'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1ffe('0x61'),'MAX':_0x1ffe('0x62'),'MIN':_0x1ffe('0x63'),'AVG':_0x1ffe('0x64'),'GROUP_CONCAT':_0x1ffe('0x8f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x1ffe('0x90')};var _0x5c4f45={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x1ffe('0x67'),'HOUR':_0x1ffe('0x68'),'ROUND':_0x1ffe('0x69'),'UNIX_TIMESTAMP':_0x1ffe('0x6a')};var _0x4cc230=function(_0x5688d0){return!_[_0x1ffe('0x6b')]([_0x1ffe('0x6c'),_0x1ffe('0x6d'),_0x1ffe('0x91'),_0x1ffe('0x6e')],_0x5688d0);};var _0x1ef888=function(_0xbef0a0){if(!_0xbef0a0||!_0xbef0a0[_0x1ffe('0x6f')][_0x1ffe('0x40')]){return'';}for(var _0x7cf74d='(',_0x186184=0x0;_0x186184<_0xbef0a0['rules'][_0x1ffe('0x40')];_0x186184+=0x1){_0x186184>0x0&&(_0x7cf74d+='\x20'+_0xbef0a0[_0x1ffe('0x92')]+'\x20');_0x7cf74d+=_0xbef0a0[_0x1ffe('0x6f')][_0x186184]['group']?_0x1ef888(_0xbef0a0['rules'][_0x186184][_0x1ffe('0x70')]):_0xbef0a0[_0x1ffe('0x6f')][_0x186184][_0x1ffe('0x7b')]+'\x20'+_0xbef0a0['rules'][_0x186184][_0x1ffe('0x93')]+(_0x4cc230(_0xbef0a0[_0x1ffe('0x6f')][_0x186184][_0x1ffe('0x93')])?'\x20'+_0xbef0a0[_0x1ffe('0x6f')][_0x186184][_0x1ffe('0x94')]:'');}return _0x7cf74d+')';};var _0x3abe0a={'where':{'id':_0x13e085['id']}},_0x36e12c,_0xbc9a44,_0x52b5d0,_0x3cdcc1,_0x4f10f5;_0x3abe0a=_[_0x1ffe('0x47')]({},_0x3abe0a,_0x3770bd);return db['AnalyticCustomReport'][_0x1ffe('0x57')](_0x3abe0a)[_0x1ffe('0x2c')](function(_0x2bdcd1){if(_0x2bdcd1){_0x36e12c=_0x2bdcd1;return _0x2bdcd1['getFields']();}return null;})[_0x1ffe('0x2c')](function(_0x6691e4){if(_0x6691e4){if(!_0x6691e4['length']){throw new db[(_0x1ffe('0x72'))][(_0x1ffe('0x73'))](_0x1ffe('0x74'),0x193);}_0xbc9a44=_0x6691e4;return db[_0x1ffe('0x75')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x3bf606){if(_0x3bf606){_0x52b5d0=_[_0x1ffe('0x95')](_0x3bf606,'id');var _0xcbca35;var _0x1538a0=squel['select']();_0x1538a0[_0x1ffe('0x77')](_0x36e12c[_0x1ffe('0x78')]);for(var _0x1522e6=0x0;_0x1522e6<_0xbc9a44[_0x1ffe('0x40')];_0x1522e6+=0x1){_0xcbca35=_0xbc9a44[_0x1522e6][_0x1ffe('0x79')]?_0x52b5d0[_0xbc9a44[_0x1522e6][_0x1ffe('0x79')]][_0x1ffe('0x7a')]:_0xbc9a44[_0x1522e6][_0x1ffe('0x7b')];_0xcbca35=_0xbc9a44[_0x1522e6][_0x1ffe('0x7c')]?_[_0x1ffe('0x7e')](_0x2298ac[_0xbc9a44[_0x1522e6]['function']],'%s',_0xcbca35):_0xcbca35;_0xcbca35=_0xbc9a44[_0x1522e6][_0x1ffe('0x7d')]?_['replace'](_0x5c4f45[_0xbc9a44[_0x1522e6][_0x1ffe('0x7d')]],'%s',_0xcbca35):_0xcbca35;if(_0xbc9a44[_0x1522e6][_0x1ffe('0x7f')]){_0x1538a0['group'](_0xcbca35);}_0xbc9a44[_0x1522e6][_0x1ffe('0x80')]&&_0x1538a0[_0x1ffe('0x43')](_0xcbca35,_0xbc9a44[_0x1522e6][_0x1ffe('0x80')]===_0x1ffe('0x81')?![]:!![]);_0x1538a0[_0x1ffe('0x7b')](_0xcbca35,_0xbc9a44[_0x1522e6][_0x1ffe('0x82')]||_0xcbca35);}if(_0x36e12c[_0x1ffe('0x83')]){_0x36e12c[_0x1ffe('0x83')]=JSON[_0x1ffe('0x88')](_0x36e12c[_0x1ffe('0x83')]);for(var _0x344aa9=0x0;_0x344aa9<_0x36e12c[_0x1ffe('0x83')]['length'];_0x344aa9+=0x1){if(_0x36e12c[_0x1ffe('0x83')][_0x344aa9]['type']&&_['includes'](_0x5e38f9,_0x36e12c[_0x1ffe('0x83')][_0x344aa9][_0x1ffe('0x38')])&&_0x36e12c[_0x1ffe('0x83')][_0x344aa9]['parentKey']&&_0x36e12c[_0x1ffe('0x83')][_0x344aa9][_0x1ffe('0x85')]&&_0x36e12c[_0x1ffe('0x83')][_0x344aa9][_0x1ffe('0x96')]){_0x1538a0[_0x36e12c[_0x1ffe('0x83')][_0x344aa9][_0x1ffe('0x38')]](_0x36e12c['joins'][_0x344aa9][_0x1ffe('0x85')],null,util[_0x1ffe('0x7d')](_0x1ffe('0x86'),_0x36e12c[_0x1ffe('0x78')],_0x36e12c['joins'][_0x344aa9][_0x1ffe('0x84')],_0x36e12c[_0x1ffe('0x83')][_0x344aa9][_0x1ffe('0x85')],_0x36e12c[_0x1ffe('0x83')][_0x344aa9]['foreignKey']));}}}if(_0x36e12c[_0x1ffe('0x87')]){_0x36e12c['conditions']=JSON[_0x1ffe('0x88')](_0x36e12c[_0x1ffe('0x87')]);_0x1538a0[_0x1ffe('0x45')](_0x1ef888(_0x36e12c[_0x1ffe('0x87')]['group']));}_0x4f10f5=_0x1538a0[_0x1ffe('0x97')]();_0x1538a0[_0x1ffe('0x23')](_0x562d04);_0x1538a0[_0x1ffe('0x25')](0x0);return;}})['then'](function(){if(_0x4554f8[_0x1ffe('0x98')]===_0x1ffe('0x99')){return null;}var _0x1adeca=_[_0x1ffe('0x47')](_0x4554f8,{'name':_0x4554f8['fullPath']||_0x4554f8[_0x1ffe('0x31')]||_0x36e12c['name'],'basename':_0x37bed9,'savename':util[_0x1ffe('0x7d')](_0x1ffe('0x9a'),_0x4554f8[_0x1ffe('0x31')]||_0x36e12c[_0x1ffe('0x31')],require(_0x1ffe('0x9b'))[_0x1ffe('0x9c')](0x4),_0x4554f8['output']||_0x1ffe('0x9d')),'reportId':_0x36e12c['id'],'reportType':_0x1ffe('0x9e')});return db['AnalyticExtractedReport']['create'](_0x1adeca,{'raw':!![]});})[_0x1ffe('0x2c')](function(_0x3c4395){if(_0x36e12c[_0x1ffe('0x78')]===_0x1ffe('0x9f')){_0x4f10f5[_0x1ffe('0x45')](_0x36e12c['table']+_0x1ffe('0xa0'),_0x4554f8[_0x1ffe('0xa1')],_0x4554f8[_0x1ffe('0xa2')]);}else{_0x4f10f5['where'](_0x36e12c[_0x1ffe('0x78')]+_0x1ffe('0xa3'),_0x4554f8[_0x1ffe('0xa1')],_0x4554f8['endDate']);}if(_0x3c4395){logger['info'](_0x1ffe('0xa4'),_0x4f10f5[_0x1ffe('0x8b')]());require('child_process')['fork'](path[_0x1ffe('0x5c')](__dirname,_0x1ffe('0xa5'),_0x3c4395['output']),[_0x3c4395['id'],_0x4f10f5[_0x1ffe('0x8b')](),path[_0x1ffe('0x5c')](__dirname,_0x1ffe('0xa6'),_0x3c4395[_0x1ffe('0xa7')]),_0x37bed9]);return _0x3c4395;}else{var _0x3feed6=squel[_0x1ffe('0x76')]();_0x3feed6[_0x1ffe('0x77')]('('+_0x4f10f5[_0x1ffe('0x8b')]()+')','countTable');_0x3feed6[_0x1ffe('0x7b')](_0x1ffe('0xa8'),_0x1ffe('0x24'));_0x4f10f5[_0x1ffe('0x23')](_0x4554f8[_0x1ffe('0x23')]||_0x562d04);_0x4f10f5[_0x1ffe('0x25')](_0x4554f8[_0x1ffe('0x25')]||0x0);return dbH[_0x1ffe('0x8c')][_0x1ffe('0x3b')](_0x3feed6[_0x1ffe('0x8b')](),{'type':dbH['sequelize'][_0x1ffe('0x8d')][_0x1ffe('0x8e')]})[_0x1ffe('0x2c')](function(_0x3d593c){if(!_0x3d593c[_0x1ffe('0x40')]){_0x3cdcc1=0x0;}else{_0x3cdcc1=_0x3d593c[0x0][_0x1ffe('0x24')]||0x0;}return dbH['sequelize']['query'](_0x4f10f5[_0x1ffe('0x8b')](),{'type':dbH['sequelize'][_0x1ffe('0x8d')][_0x1ffe('0x8e')]});})[_0x1ffe('0x2c')](function(_0x44a798){return{'rows':_0x44a798||[],'count':_0x3cdcc1};});}});}exports[_0x1ffe('0xa9')]=function(_0x595058,_0x25b36d){return runReport(_0x595058['params'],_0x595058[_0x1ffe('0x3b')],_0x595058[_0x1ffe('0x49')])[_0x1ffe('0x2c')](respondWithResult(_0x25b36d,null))['catch'](handleError(_0x25b36d,null));};exports[_0x1ffe('0xaa')]=runReport;exports[_0x1ffe('0x3b')]=function(_0x416f40,_0x1d1c11){var _0x2a2607=0xa;var _0x2b7ad7=[_0x1ffe('0x5c'),_0x1ffe('0x5d'),'right_join',_0x1ffe('0x5f')];var _0x237181={'SUM':_0x1ffe('0x60'),'COUNT':_0x1ffe('0xab'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1ffe('0x62'),'MIN':'MIN(%s)','AVG':_0x1ffe('0x64'),'GROUP_CONCAT':_0x1ffe('0x8f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x1ffe('0x90')};var _0x5c1b02={'SEC_TO_TIME':_0x1ffe('0x66'),'DATE':_0x1ffe('0x67'),'HOUR':_0x1ffe('0x68'),'ROUND':_0x1ffe('0x69'),'UNIX_TIMESTAMP':_0x1ffe('0x6a')};var _0x36a561=function(_0x3ece75){return!_[_0x1ffe('0x6b')]([_0x1ffe('0x6c'),_0x1ffe('0x6d'),_0x1ffe('0x91'),_0x1ffe('0x6e')],_0x3ece75);};var _0x455cea=function(_0x40fe59){if(!_0x40fe59||!_0x40fe59[_0x1ffe('0x6f')]['length']){return'';}for(var _0x37719e='(',_0x2b813=0x0;_0x2b813<_0x40fe59['rules'][_0x1ffe('0x40')];_0x2b813+=0x1){_0x2b813>0x0&&(_0x37719e+='\x20'+_0x40fe59[_0x1ffe('0x92')]+'\x20');_0x37719e+=_0x40fe59[_0x1ffe('0x6f')][_0x2b813][_0x1ffe('0x70')]?_0x455cea(_0x40fe59['rules'][_0x2b813][_0x1ffe('0x70')]):_0x40fe59[_0x1ffe('0x6f')][_0x2b813][_0x1ffe('0x7b')]+'\x20'+_0x40fe59[_0x1ffe('0x6f')][_0x2b813][_0x1ffe('0x93')]+(_0x36a561(_0x40fe59[_0x1ffe('0x6f')][_0x2b813]['condition'])?'\x20'+_0x40fe59[_0x1ffe('0x6f')][_0x2b813][_0x1ffe('0x94')]:'');}return _0x37719e+')';};var _0x1401bd={'where':{'id':_0x416f40[_0x1ffe('0x4c')]['id']}},_0x4dda24,_0x44e4e7,_0x50ef12,_0xbf840e,_0x15b662;_0x1401bd=_[_0x1ffe('0x47')]({},_0x1401bd,_0x416f40[_0x1ffe('0x49')]);return db[_0x1ffe('0x35')][_0x1ffe('0x57')](_0x1401bd)['then'](function(_0x25a9ca){if(_0x25a9ca){_0x4dda24=_0x25a9ca;return _0x25a9ca[_0x1ffe('0x71')]();}return null;})[_0x1ffe('0x2c')](function(_0x54c035){if(_0x54c035){if(!_0x54c035[_0x1ffe('0x40')]){throw new db[(_0x1ffe('0x72'))][(_0x1ffe('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x44e4e7=_0x54c035;return db[_0x1ffe('0x75')][_0x1ffe('0x4a')]({'raw':!![]});}return null;})['then'](function(_0x1b02e9){if(_0x1b02e9){_0x50ef12=_[_0x1ffe('0x95')](_0x1b02e9,'id');var _0x54fe72;var _0x459237=squel[_0x1ffe('0x76')]();_0x459237['from'](_0x4dda24[_0x1ffe('0x78')]);for(var _0x1d6ffb=0x0;_0x1d6ffb<_0x44e4e7['length'];_0x1d6ffb+=0x1){_0x54fe72=_0x44e4e7[_0x1d6ffb][_0x1ffe('0x79')]?_0x50ef12[_0x44e4e7[_0x1d6ffb][_0x1ffe('0x79')]][_0x1ffe('0x7a')]:_0x44e4e7[_0x1d6ffb][_0x1ffe('0x7b')];_0x54fe72=_0x44e4e7[_0x1d6ffb][_0x1ffe('0x7c')]?_[_0x1ffe('0x7e')](_0x237181[_0x44e4e7[_0x1d6ffb]['function']],'%s',_0x54fe72):_0x54fe72;_0x54fe72=_0x44e4e7[_0x1d6ffb][_0x1ffe('0x7d')]?_['replace'](_0x5c1b02[_0x44e4e7[_0x1d6ffb][_0x1ffe('0x7d')]],'%s',_0x54fe72):_0x54fe72;if(_0x44e4e7[_0x1d6ffb][_0x1ffe('0x7f')]){_0x459237['group'](_0x54fe72);}_0x44e4e7[_0x1d6ffb][_0x1ffe('0x80')]&&_0x459237['order'](_0x54fe72,_0x44e4e7[_0x1d6ffb][_0x1ffe('0x80')]===_0x1ffe('0x81')?![]:!![]);_0x459237[_0x1ffe('0x7b')](_0x54fe72,_0x44e4e7[_0x1d6ffb][_0x1ffe('0x82')]||_0x54fe72);}if(_0x4dda24[_0x1ffe('0x83')]){_0x4dda24[_0x1ffe('0x83')]=JSON[_0x1ffe('0x88')](_0x4dda24[_0x1ffe('0x83')]);for(var _0x1fd3a8=0x0;_0x1fd3a8<_0x4dda24[_0x1ffe('0x83')][_0x1ffe('0x40')];_0x1fd3a8+=0x1){if(_0x4dda24[_0x1ffe('0x83')][_0x1fd3a8][_0x1ffe('0x38')]&&_[_0x1ffe('0x6b')](_0x2b7ad7,_0x4dda24[_0x1ffe('0x83')][_0x1fd3a8][_0x1ffe('0x38')])&&_0x4dda24[_0x1ffe('0x83')][_0x1fd3a8][_0x1ffe('0x84')]&&_0x4dda24[_0x1ffe('0x83')][_0x1fd3a8]['foreignTable']&&_0x4dda24[_0x1ffe('0x83')][_0x1fd3a8][_0x1ffe('0x96')]){_0x459237[_0x4dda24['joins'][_0x1fd3a8][_0x1ffe('0x38')]](_0x4dda24['joins'][_0x1fd3a8][_0x1ffe('0x85')],null,util[_0x1ffe('0x7d')](_0x1ffe('0x86'),_0x4dda24[_0x1ffe('0x78')],_0x4dda24[_0x1ffe('0x83')][_0x1fd3a8][_0x1ffe('0x84')],_0x4dda24[_0x1ffe('0x83')][_0x1fd3a8]['foreignTable'],_0x4dda24['joins'][_0x1fd3a8][_0x1ffe('0x96')]));}}}if(_0x4dda24[_0x1ffe('0x87')]){_0x4dda24['conditions']=JSON[_0x1ffe('0x88')](_0x4dda24['conditions']);_0x459237[_0x1ffe('0x45')](_0x455cea(_0x4dda24[_0x1ffe('0x87')][_0x1ffe('0x70')]));}_0x15b662=_0x459237[_0x1ffe('0x97')]();_0x459237[_0x1ffe('0x23')](_0x2a2607);_0x459237[_0x1ffe('0x25')](0x0);logger[_0x1ffe('0x89')](_0x1ffe('0x8a'),_0x459237[_0x1ffe('0x8b')]());return dbH[_0x1ffe('0x8c')][_0x1ffe('0x3b')](_0x459237[_0x1ffe('0x8b')](),{'type':dbH[_0x1ffe('0x8c')][_0x1ffe('0x8d')][_0x1ffe('0x8e')]});}})[_0x1ffe('0x2c')](function(){return{'sql':_0x15b662[_0x1ffe('0x8b')]()};})[_0x1ffe('0x2c')](respondWithResult(_0x1d1c11,null))[_0x1ffe('0x4f')](handleError(_0x1d1c11,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 133e18f..9c393d2 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 _0x4a85=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x1caa3a,_0x5f316f){var _0x12d593=function(_0x2919b4){while(--_0x2919b4){_0x1caa3a['push'](_0x1caa3a['shift']());}};_0x12d593(++_0x5f316f);}(_0x4a85,0x9c));var _0x54a8=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x4a85[_0xefd519];return _0x4bb882;};'use strict';var _=require('lodash');var util=require(_0x54a8('0x0'));var logger=require(_0x54a8('0x1'))(_0x54a8('0x2'));var moment=require('moment');var BPromise=require(_0x54a8('0x3'));var rp=require(_0x54a8('0x4'));var fs=require('fs');var path=require(_0x54a8('0x5'));var rimraf=require(_0x54a8('0x6'));var config=require(_0x54a8('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x54a8('0x8')]=function(_0x2fec2f,_0x27b348){return _0x2fec2f[_0x54a8('0x9')](_0x54a8('0xa'),attributes,{'tableName':_0x54a8('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0094=['bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment'];(function(_0x4b1b2b,_0x320924){var _0x14bb0d=function(_0x1470f0){while(--_0x1470f0){_0x4b1b2b['push'](_0x4b1b2b['shift']());}};_0x14bb0d(++_0x320924);}(_0x0094,0x121));var _0x4009=function(_0x37208f,_0x1f291a){_0x37208f=_0x37208f-0x0;var _0x5d0179=_0x0094[_0x37208f];return _0x5d0179;};'use strict';var _=require(_0x4009('0x0'));var util=require(_0x4009('0x1'));var logger=require(_0x4009('0x2'))(_0x4009('0x3'));var moment=require(_0x4009('0x4'));var BPromise=require(_0x4009('0x5'));var rp=require(_0x4009('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4009('0x7'));var config=require(_0x4009('0x8'));var attributes=require(_0x4009('0x9'));module[_0x4009('0xa')]=function(_0x778840,_0x2049e9){return _0x778840[_0x4009('0xb')](_0x4009('0xc'),attributes,{'tableName':_0x4009('0xd'),'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 e24872e..91cc9c4 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 _0xb226=['ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x155045,_0x5de8a4){var _0x1b995c=function(_0x5aee99){while(--_0x5aee99){_0x155045['push'](_0x155045['shift']());}};_0x1b995c(++_0x5de8a4);}(_0xb226,0xca));var _0x6b22=function(_0x40eadc,_0x37af8d){_0x40eadc=_0x40eadc-0x0;var _0x6963b4=_0xb226[_0x40eadc];return _0x6963b4;};'use strict';var _=require(_0x6b22('0x0'));var util=require(_0x6b22('0x1'));var moment=require(_0x6b22('0x2'));var BPromise=require(_0x6b22('0x3'));var rs=require(_0x6b22('0x4'));var fs=require('fs');var Redis=require(_0x6b22('0x5'));var db=require(_0x6b22('0x6'))['db'];var utils=require(_0x6b22('0x7'));var logger=require('../../config/logger')(_0x6b22('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6b22('0x9')][_0x6b22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x111f4b,_0x6981ec,_0x3e0922){return new BPromise(function(_0xe279d,_0x3ef9f9){return client[_0x6b22('0xb')](_0x111f4b,_0x3e0922)[_0x6b22('0xc')](function(_0x1d0725){logger[_0x6b22('0xd')](_0x6b22('0xe'),_0x6981ec,_0x6b22('0xf'));logger[_0x6b22('0x10')](_0x6b22('0x11'),_0x6981ec,_0x6b22('0xf'),JSON[_0x6b22('0x12')](_0x1d0725));if(_0x1d0725[_0x6b22('0x13')]){if(_0x1d0725[_0x6b22('0x13')][_0x6b22('0x14')]===0x1f4){logger[_0x6b22('0x13')](_0x6b22('0xe'),_0x6981ec,_0x1d0725[_0x6b22('0x13')][_0x6b22('0x15')]);return _0x3ef9f9(_0x1d0725[_0x6b22('0x13')][_0x6b22('0x15')]);}logger[_0x6b22('0x13')](_0x6b22('0xe'),_0x6981ec,_0x1d0725[_0x6b22('0x13')][_0x6b22('0x15')]);return _0xe279d(_0x1d0725[_0x6b22('0x13')]['message']);}else{logger[_0x6b22('0xd')](_0x6b22('0xe'),_0x6981ec,_0x6b22('0xf'));_0xe279d(_0x1d0725[_0x6b22('0x16')][_0x6b22('0x15')]);}})['catch'](function(_0x2c39c5){logger['error'](_0x6b22('0xe'),_0x6981ec,_0x2c39c5);_0x3ef9f9(_0x2c39c5);});});} \ No newline at end of file +var _0x024b=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x21f6eb,_0x59beb0){var _0xb6c0ce=function(_0x1ff87a){while(--_0x1ff87a){_0x21f6eb['push'](_0x21f6eb['shift']());}};_0xb6c0ce(++_0x59beb0);}(_0x024b,0x1e5));var _0xb024=function(_0x13fd86,_0x43259f){_0x13fd86=_0x13fd86-0x0;var _0x7be38a=_0x024b[_0x13fd86];return _0x7be38a;};'use strict';var _=require(_0xb024('0x0'));var util=require(_0xb024('0x1'));var moment=require(_0xb024('0x2'));var BPromise=require(_0xb024('0x3'));var rs=require(_0xb024('0x4'));var fs=require('fs');var Redis=require(_0xb024('0x5'));var db=require(_0xb024('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb024('0x7'));var config=require(_0xb024('0x8'));var jayson=require(_0xb024('0x9'));var client=jayson[_0xb024('0xa')][_0xb024('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a32ca,_0x240f48,_0x5a06f3){return new BPromise(function(_0x14fad0,_0x1e94ad){return client[_0xb024('0xc')](_0x3a32ca,_0x5a06f3)[_0xb024('0xd')](function(_0x1c84b3){logger['info'](_0xb024('0xe'),_0x240f48,_0xb024('0xf'));logger[_0xb024('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x240f48,_0xb024('0xf'),JSON[_0xb024('0x11')](_0x1c84b3));if(_0x1c84b3[_0xb024('0x12')]){if(_0x1c84b3['error'][_0xb024('0x13')]===0x1f4){logger['error'](_0xb024('0xe'),_0x240f48,_0x1c84b3[_0xb024('0x12')][_0xb024('0x14')]);return _0x1e94ad(_0x1c84b3[_0xb024('0x12')][_0xb024('0x14')]);}logger[_0xb024('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x240f48,_0x1c84b3[_0xb024('0x12')]['message']);return _0x14fad0(_0x1c84b3[_0xb024('0x12')]['message']);}else{logger[_0xb024('0x15')](_0xb024('0xe'),_0x240f48,_0xb024('0xf'));_0x14fad0(_0x1c84b3[_0xb024('0x16')][_0xb024('0x14')]);}})[_0xb024('0x17')](function(_0x570980){logger[_0xb024('0x12')](_0xb024('0xe'),_0x240f48,_0x570980);_0x1e94ad(_0x570980);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 48d673d..3bc3eb0 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 _0x34b6=['multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/query','query','post','create','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34b6,0x93));var _0x634b=function(_0x37eb8f,_0x59e606){_0x37eb8f=_0x37eb8f-0x0;var _0x2b221d=_0x34b6[_0x37eb8f];return _0x2b221d;};'use strict';var multer=require(_0x634b('0x0'));var util=require('util');var path=require(_0x634b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x634b('0x2')]();var fs_extra=require(_0x634b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x634b('0x4'));var config=require(_0x634b('0x5'));var controller=require(_0x634b('0x6'));router[_0x634b('0x7')]('/',auth[_0x634b('0x8')](),controller[_0x634b('0x9')]);router[_0x634b('0x7')](_0x634b('0xa'),auth[_0x634b('0x8')](),controller[_0x634b('0xb')]);router['get'](_0x634b('0xc'),auth[_0x634b('0x8')](),controller[_0x634b('0xd')]);router[_0x634b('0x7')]('/:id/run',auth[_0x634b('0x8')](),controller['run']);router[_0x634b('0x7')](_0x634b('0xe'),auth[_0x634b('0x8')](),controller[_0x634b('0xf')]);router[_0x634b('0x10')]('/',auth[_0x634b('0x8')](),controller[_0x634b('0x11')]);router['put']('/:id',auth[_0x634b('0x8')](),controller['update']);router[_0x634b('0x12')](_0x634b('0xa'),auth['isAuthenticated'](),controller[_0x634b('0x13')]);module[_0x634b('0x14')]=router; \ No newline at end of file +var _0x9db0=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','post','put','destroy'];(function(_0x4a0abb,_0x5185ea){var _0xd1b4b0=function(_0x360365){while(--_0x360365){_0x4a0abb['push'](_0x4a0abb['shift']());}};_0xd1b4b0(++_0x5185ea);}(_0x9db0,0x1e3));var _0x09db=function(_0x1e22f8,_0x44e3c4){_0x1e22f8=_0x1e22f8-0x0;var _0x55d812=_0x9db0[_0x1e22f8];return _0x55d812;};'use strict';var multer=require('multer');var util=require(_0x09db('0x0'));var path=require(_0x09db('0x1'));var timeout=require(_0x09db('0x2'));var express=require(_0x09db('0x3'));var router=express[_0x09db('0x4')]();var fs_extra=require(_0x09db('0x5'));var auth=require(_0x09db('0x6'));var interaction=require(_0x09db('0x7'));var config=require(_0x09db('0x8'));var controller=require('./analyticCustomReport.controller');router[_0x09db('0x9')]('/',auth[_0x09db('0xa')](),controller[_0x09db('0xb')]);router['get'](_0x09db('0xc'),auth[_0x09db('0xa')](),controller[_0x09db('0xd')]);router[_0x09db('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0x09db('0xe')]);router[_0x09db('0x9')](_0x09db('0xf'),auth[_0x09db('0xa')](),controller[_0x09db('0x10')]);router[_0x09db('0x9')](_0x09db('0x11'),auth[_0x09db('0xa')](),controller['query']);router[_0x09db('0x12')]('/',auth[_0x09db('0xa')](),controller['create']);router[_0x09db('0x13')](_0x09db('0xc'),auth[_0x09db('0xa')](),controller['update']);router['delete']('/:id',auth[_0x09db('0xa')](),controller[_0x09db('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 8baf56d..a1c2e68 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 _0xee14=['STRING','TEXT'];(function(_0x2a0798,_0x4a269e){var _0x12d0a6=function(_0x35edd6){while(--_0x35edd6){_0x2a0798['push'](_0x2a0798['shift']());}};_0x12d0a6(++_0x4a269e);}(_0xee14,0x13a));var _0x4ee1=function(_0xd30a32,_0x4e713b){_0xd30a32=_0xd30a32-0x0;var _0xf789b=_0xee14[_0xd30a32];return _0xf789b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4ee1('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x4ee1('0x0')]},'parent':{'type':Sequelize[_0x4ee1('0x0')]},'table':{'type':Sequelize[_0x4ee1('0x0')]},'conditions':{'type':Sequelize[_0x4ee1('0x1')]},'joins':{'type':Sequelize[_0x4ee1('0x1')]}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x46ed,0x168));var _0xd46e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x46ed[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 17b5c64..f51dd77 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 _0x2542=['getFields','ValidationErrorItem','metric','format','DESC','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','sequelize','SELECT','run','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','save','destroy','then','get','end','error','stack','name','send','index','map','AnalyticDefaultReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','field','replace','function','groupBy','orderBy','alias','parse','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','QueryTypes','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','value'];(function(_0x37dde5,_0x4eb35c){var _0x498478=function(_0x53f711){while(--_0x53f711){_0x37dde5['push'](_0x37dde5['shift']());}};_0x498478(++_0x4eb35c);}(_0x2542,0x169));var _0x2254=function(_0x5cc4df,_0xc11f22){_0x5cc4df=_0x5cc4df-0x0;var _0x363ef9=_0x2542[_0x5cc4df];return _0x363ef9;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];var dbH=require(_0x2254('0x19'))[_0x2254('0x1a')];function respondWithStatusCode(_0x3c326b,_0x381efe){_0x381efe=_0x381efe||0xcc;return function(_0x592a4f){if(_0x592a4f){return _0x3c326b[_0x2254('0x1b')](_0x381efe);}return _0x3c326b[_0x2254('0x1c')](_0x381efe)['end']();};}function respondWithResult(_0x2f4de,_0x1e582d){_0x1e582d=_0x1e582d||0xc8;return function(_0xfb23cb){if(_0xfb23cb){return _0x2f4de[_0x2254('0x1c')](_0x1e582d)[_0x2254('0x1d')](_0xfb23cb);}};}function respondWithFilteredResult(_0xbc5548,_0x50f137){return function(_0x18baf4){if(_0x18baf4){var _0x57247a=typeof _0x50f137[_0x2254('0x1e')]===_0x2254('0x1f')&&typeof _0x50f137[_0x2254('0x20')]===_0x2254('0x1f');var _0x1ae11e=_0x18baf4[_0x2254('0x21')];var _0x497724=_0x57247a?0x0:_0x50f137['offset'];var _0x5ec98d=_0x57247a?_0x18baf4[_0x2254('0x21')]:_0x50f137[_0x2254('0x1e')]+_0x50f137[_0x2254('0x20')];var _0x1f1163;if(_0x5ec98d>=_0x1ae11e){_0x5ec98d=_0x1ae11e;_0x1f1163=0xc8;}else{_0x1f1163=0xce;}_0xbc5548[_0x2254('0x1c')](_0x1f1163);return _0xbc5548[_0x2254('0x22')]('Content-Range',_0x497724+'-'+_0x5ec98d+'/'+_0x1ae11e)[_0x2254('0x1d')](_0x18baf4);}return null;};}function patchUpdates(_0x16148d){return function(_0x906cde){try{jsonpatch['apply'](_0x906cde,_0x16148d,!![]);}catch(_0x52fedc){return BPromise['reject'](_0x52fedc);}return _0x906cde[_0x2254('0x23')]();};}function saveUpdates(_0x559af4,_0xf88b56){return function(_0x56b91e){if(_0x56b91e){return _0x56b91e['update'](_0x559af4)['then'](function(_0x540020){return _0x540020;});}return null;};}function removeEntity(_0x5e5edb,_0x4f797d){return function(_0x1aa71f){if(_0x1aa71f){return _0x1aa71f[_0x2254('0x24')]()[_0x2254('0x25')](function(){var _0x265467=_0x1aa71f[_0x2254('0x26')]({'plain':!![]});var _0x1349c9='DefaultReports';return db['UserProfileResource'][_0x2254('0x24')]({'where':{'type':_0x1349c9,'resourceId':_0x265467['id']}})['then'](function(){return _0x1aa71f;});})[_0x2254('0x25')](function(){_0x5e5edb[_0x2254('0x1c')](0xcc)[_0x2254('0x27')]();});}};}function handleEntityNotFound(_0x3aa0bd,_0x19043b){return function(_0x482688){if(!_0x482688){_0x3aa0bd[_0x2254('0x1b')](0x194);}return _0x482688;};}function handleError(_0x2a789b,_0x21285d){_0x21285d=_0x21285d||0x1f4;return function(_0x37af8b){logger[_0x2254('0x28')](_0x37af8b[_0x2254('0x29')]);if(_0x37af8b[_0x2254('0x2a')]){delete _0x37af8b[_0x2254('0x2a')];}_0x2a789b[_0x2254('0x1c')](_0x21285d)[_0x2254('0x2b')](_0x37af8b);};}exports[_0x2254('0x2c')]=function(_0xad7774,_0x220f2a){var _0x27d30a={},_0x4577f4={},_0x1b16c8={'count':0x0,'rows':[]};var _0x2c929f=_[_0x2254('0x2d')](db[_0x2254('0x2e')]['rawAttributes'],function(_0xe29526){return{'name':_0xe29526[_0x2254('0x2f')],'type':_0xe29526[_0x2254('0x30')][_0x2254('0x31')]};});_0x4577f4[_0x2254('0x32')]=_[_0x2254('0x2d')](_0x2c929f,_0x2254('0x2a'));_0x4577f4[_0x2254('0x33')]=_[_0x2254('0x34')](_0xad7774['query']);_0x4577f4[_0x2254('0x35')]=_[_0x2254('0x36')](_0x4577f4['model'],_0x4577f4[_0x2254('0x33')]);_0x27d30a[_0x2254('0x37')]=_[_0x2254('0x36')](_0x4577f4[_0x2254('0x32')],qs['fields'](_0xad7774['query'][_0x2254('0x38')]));_0x27d30a['attributes']=_0x27d30a[_0x2254('0x37')][_0x2254('0x39')]?_0x27d30a[_0x2254('0x37')]:_0x4577f4[_0x2254('0x32')];if(!_0xad7774[_0x2254('0x33')][_0x2254('0x3a')](_0x2254('0x3b'))){_0x27d30a['limit']=qs[_0x2254('0x20')](_0xad7774[_0x2254('0x33')][_0x2254('0x20')]);_0x27d30a[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0xad7774[_0x2254('0x33')][_0x2254('0x1e')]);}_0x27d30a[_0x2254('0x3c')]=qs[_0x2254('0x3d')](_0xad7774[_0x2254('0x33')]['sort']);_0x27d30a[_0x2254('0x3e')]=qs[_0x2254('0x35')](_[_0x2254('0x3f')](_0xad7774[_0x2254('0x33')],_0x4577f4['filters']),_0x2c929f);if(_0xad7774[_0x2254('0x33')][_0x2254('0x40')]){_0x27d30a[_0x2254('0x3e')]=_[_0x2254('0x41')](_0x27d30a[_0x2254('0x3e')],{'$or':_[_0x2254('0x2d')](_0x2c929f,function(_0x423377){if(_0x423377[_0x2254('0x30')]!=='VIRTUAL'){var _0x362ad1={};_0x362ad1[_0x423377['name']]={'$like':'%'+_0xad7774[_0x2254('0x33')][_0x2254('0x40')]+'%'};return _0x362ad1;}})});}_0x27d30a=_[_0x2254('0x41')]({},_0x27d30a,_0xad7774[_0x2254('0x42')]);var _0x460bb3={'where':_0x27d30a[_0x2254('0x3e')]};return db[_0x2254('0x2e')]['count'](_0x460bb3)[_0x2254('0x25')](function(_0x2f1ff9){_0x1b16c8[_0x2254('0x21')]=_0x2f1ff9;if(_0xad7774[_0x2254('0x33')][_0x2254('0x43')]){_0x27d30a['include']=[{'all':!![]}];}return db[_0x2254('0x2e')][_0x2254('0x44')](_0x27d30a);})[_0x2254('0x25')](function(_0x135ed8){_0x1b16c8[_0x2254('0x45')]=_0x135ed8;return _0x1b16c8;})['then'](respondWithFilteredResult(_0x220f2a,_0x27d30a))[_0x2254('0x46')](handleError(_0x220f2a,null));};exports['show']=function(_0x91e091,_0x1ded9a){var _0xb4d042={'raw':!![],'where':{'id':_0x91e091[_0x2254('0x47')]['id']}},_0x31c31e={};_0x31c31e[_0x2254('0x32')]=_[_0x2254('0x34')](db[_0x2254('0x2e')][_0x2254('0x48')]);_0x31c31e[_0x2254('0x33')]=_[_0x2254('0x34')](_0x91e091[_0x2254('0x33')]);_0x31c31e[_0x2254('0x35')]=_['intersection'](_0x31c31e[_0x2254('0x32')],_0x31c31e[_0x2254('0x33')]);_0xb4d042[_0x2254('0x37')]=_['intersection'](_0x31c31e[_0x2254('0x32')],qs[_0x2254('0x38')](_0x91e091[_0x2254('0x33')][_0x2254('0x38')]));_0xb4d042[_0x2254('0x37')]=_0xb4d042[_0x2254('0x37')][_0x2254('0x39')]?_0xb4d042[_0x2254('0x37')]:_0x31c31e[_0x2254('0x32')];if(_0x91e091['query'][_0x2254('0x43')]){_0xb4d042[_0x2254('0x49')]=[{'all':!![]}];}_0xb4d042=_[_0x2254('0x41')]({},_0xb4d042,_0x91e091[_0x2254('0x42')]);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0xb4d042)[_0x2254('0x25')](handleEntityNotFound(_0x1ded9a,null))[_0x2254('0x25')](respondWithResult(_0x1ded9a,null))[_0x2254('0x46')](handleError(_0x1ded9a,null));};exports[_0x2254('0x4b')]=function(_0x5b14c5,_0x36b977){return db[_0x2254('0x2e')]['create'](_0x5b14c5[_0x2254('0x4c')],{})[_0x2254('0x25')](function(_0x12e2ff){var _0x4331a9=_0x5b14c5['user'][_0x2254('0x26')]({'plain':!![]});if(!_0x4331a9)throw new Error(_0x2254('0x4d'));if(_0x4331a9['role']===_0x2254('0x4e')){var _0x3f0670=_0x12e2ff[_0x2254('0x26')]({'plain':!![]});var _0x43bb88='Reports';return db[_0x2254('0x4f')][_0x2254('0x4a')]({'where':{'name':_0x43bb88,'userProfileId':_0x4331a9[_0x2254('0x50')]},'raw':!![]})['then'](function(_0x4cc18a){if(_0x4cc18a&&_0x4cc18a[_0x2254('0x51')]===0x0){return db[_0x2254('0x52')]['create']({'name':_0x3f0670[_0x2254('0x2a')],'resourceId':_0x3f0670['id'],'type':'DefaultReports','sectionId':_0x4cc18a['id']},{})['then'](function(){return _0x12e2ff;});}else{return _0x12e2ff;}})[_0x2254('0x46')](function(_0x135962){logger[_0x2254('0x28')](_0x2254('0x53'),_0x135962);throw _0x135962;});}return _0x12e2ff;})[_0x2254('0x25')](respondWithResult(_0x36b977,0xc9))['catch'](handleError(_0x36b977,null));};exports['update']=function(_0x1bd988,_0x5e3fbc){if(_0x1bd988[_0x2254('0x4c')]['id']){delete _0x1bd988[_0x2254('0x4c')]['id'];}return db[_0x2254('0x2e')][_0x2254('0x4a')]({'where':{'id':_0x1bd988['params']['id']}})[_0x2254('0x25')](handleEntityNotFound(_0x5e3fbc,null))[_0x2254('0x25')](saveUpdates(_0x1bd988['body'],null))['then'](respondWithResult(_0x5e3fbc,null))[_0x2254('0x46')](handleError(_0x5e3fbc,null));};exports['destroy']=function(_0x2cc59c,_0x305ace){return db[_0x2254('0x2e')][_0x2254('0x4a')]({'where':{'id':_0x2cc59c[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x305ace,null))['then'](removeEntity(_0x305ace,null))[_0x2254('0x46')](handleError(_0x305ace,null));};exports['preview']=function(_0x335c66,_0x510fe0){var _0x4da493=0xa;var _0x5999c8=[_0x2254('0x54'),_0x2254('0x55'),_0x2254('0x56'),_0x2254('0x57')];var _0x13606e={'SUM':_0x2254('0x58'),'COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':_0x2254('0x5b'),'MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':_0x2254('0x5e'),'GROUP_CONCAT ASC':_0x2254('0x5f'),'GROUP_CONCAT DESC':_0x2254('0x60')};var _0x2f391d={'SEC_TO_TIME':_0x2254('0x61'),'DATE':_0x2254('0x62'),'HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x329378=function(_0xae171c){return!_[_0x2254('0x65')]([_0x2254('0x66'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x2254('0x67')],_0xae171c);};var _0x423c17=function(_0x1d73a3){if(!_0x1d73a3||!_0x1d73a3[_0x2254('0x68')][_0x2254('0x39')]){return'';}for(var _0x53b55b='(',_0x45b7bd=0x0;_0x45b7bd<_0x1d73a3[_0x2254('0x68')][_0x2254('0x39')];_0x45b7bd+=0x1){_0x45b7bd>0x0&&(_0x53b55b+='\x20'+_0x1d73a3['operator']+'\x20');_0x53b55b+=_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x69')]?_0x423c17(_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x69')]):_0x1d73a3[_0x2254('0x68')][_0x45b7bd]['field']+'\x20'+_0x1d73a3[_0x2254('0x68')][_0x45b7bd][_0x2254('0x6a')]+(_0x329378(_0x1d73a3['rules'][_0x45b7bd][_0x2254('0x6a')])?'\x20'+_0x1d73a3[_0x2254('0x68')][_0x45b7bd]['value']:'');}return _0x53b55b+')';};var _0x5cc6bd={'where':{'id':_0x335c66['params']['id']}},_0xde4e7,_0xa159a4,_0x486b82,_0x506d95,_0x48406e;_0x5cc6bd=_[_0x2254('0x41')]({},_0x5cc6bd,_0x335c66['options']);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0x5cc6bd)[_0x2254('0x25')](function(_0x1ed6b9){if(_0x1ed6b9){_0xde4e7=_0x1ed6b9;return _0x1ed6b9['getFields']();}return null;})[_0x2254('0x25')](function(_0x5ecf82){if(_0x5ecf82){if(!_0x5ecf82[_0x2254('0x39')]){throw new db[(_0x2254('0x6b'))]['ValidationErrorItem'](_0x2254('0x6c'),0x193);}_0xa159a4=_0x5ecf82;return db[_0x2254('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x3b3b20){if(_0x3b3b20){_0x486b82=_[_0x2254('0x6e')](_0x3b3b20,'id');var _0x3cefbe;var _0x4f77e5=squel[_0x2254('0x6f')]();_0x4f77e5[_0x2254('0x70')](_0xde4e7['table']);for(var _0x1ac8ff=0x0;_0x1ac8ff<_0xa159a4[_0x2254('0x39')];_0x1ac8ff+=0x1){_0x3cefbe=_0xa159a4[_0x1ac8ff]['MetricId']?_0x486b82[_0xa159a4[_0x1ac8ff][_0x2254('0x71')]]['metric']:_0xa159a4[_0x1ac8ff][_0x2254('0x72')];_0x3cefbe=_0xa159a4[_0x1ac8ff]['function']?_[_0x2254('0x73')](_0x13606e[_0xa159a4[_0x1ac8ff][_0x2254('0x74')]],'%s',_0x3cefbe):_0x3cefbe;_0x3cefbe=_0xa159a4[_0x1ac8ff]['format']?_[_0x2254('0x73')](_0x2f391d[_0xa159a4[_0x1ac8ff]['format']],'%s',_0x3cefbe):_0x3cefbe;if(_0xa159a4[_0x1ac8ff][_0x2254('0x75')]){_0x4f77e5[_0x2254('0x69')](_0x3cefbe);}_0xa159a4[_0x1ac8ff][_0x2254('0x76')]&&_0x4f77e5['order'](_0x3cefbe,_0xa159a4[_0x1ac8ff][_0x2254('0x76')]==='DESC'?![]:!![]);_0x4f77e5[_0x2254('0x72')](_0x3cefbe,_0xa159a4[_0x1ac8ff][_0x2254('0x77')]||_0x3cefbe);}if(_0xde4e7['joins']){_0xde4e7['joins']=JSON[_0x2254('0x78')](_0xde4e7[_0x2254('0x79')]);for(var _0x451520=0x0;_0x451520<_0xde4e7[_0x2254('0x79')]['length'];_0x451520+=0x1){if(_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x30')]&&_[_0x2254('0x65')](_0x5999c8,_0xde4e7[_0x2254('0x79')][_0x451520]['type'])&&_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7a')]&&_0xde4e7['joins'][_0x451520][_0x2254('0x7b')]&&_0xde4e7['joins'][_0x451520][_0x2254('0x7c')]){_0x4f77e5[_0xde4e7['joins'][_0x451520]['type']](_0xde4e7['joins'][_0x451520][_0x2254('0x7b')],null,util['format'](_0x2254('0x7d'),_0xde4e7[_0x2254('0x7e')],_0xde4e7['joins'][_0x451520][_0x2254('0x7a')],_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7b')],_0xde4e7[_0x2254('0x79')][_0x451520][_0x2254('0x7c')]));}}}if(_0xde4e7[_0x2254('0x7f')]){_0xde4e7['conditions']=JSON['parse'](_0xde4e7[_0x2254('0x7f')]);_0x4f77e5[_0x2254('0x3e')](_0x423c17(_0xde4e7[_0x2254('0x7f')][_0x2254('0x69')]));}_0x48406e=_0x4f77e5[_0x2254('0x80')]();_0x4f77e5[_0x2254('0x20')](_0x4da493);_0x4f77e5[_0x2254('0x1e')](0x0);logger[_0x2254('0x81')](_0x2254('0x82'),_0x4f77e5[_0x2254('0x83')]());return dbH['sequelize'][_0x2254('0x33')](_0x4f77e5[_0x2254('0x83')](),{'type':dbH['sequelize'][_0x2254('0x84')]['SELECT']});}})[_0x2254('0x25')](respondWithResult(_0x510fe0,null))[_0x2254('0x46')](handleError(_0x510fe0,null));};function runReport(_0x4dfcb4,_0x1c317b,_0x4e699c){var _0x2ad519=_0x1c317b[_0x2254('0x2a')];var _0x30f2c9=0xa;var _0x1f7a48=['join',_0x2254('0x55'),_0x2254('0x56'),_0x2254('0x57')];var _0x3a8d4f={'SUM':'SUM(%s)','COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':'MAX(%s)','MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x2254('0x60')};var _0x2f3650={'SEC_TO_TIME':_0x2254('0x61'),'DATE':_0x2254('0x62'),'HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':_0x2254('0x85')};var _0x251d70=function(_0x2c7705){return!_['includes']([_0x2254('0x66'),'IS\x20NOT\x20NULL',_0x2254('0x86'),'IS\x20NOT\x20EMPTY'],_0x2c7705);};var _0x36d121=function(_0x207a09){if(!_0x207a09||!_0x207a09[_0x2254('0x68')]['length']){return'';}for(var _0x8a3656='(',_0x1554f1=0x0;_0x1554f1<_0x207a09[_0x2254('0x68')][_0x2254('0x39')];_0x1554f1+=0x1){_0x1554f1>0x0&&(_0x8a3656+='\x20'+_0x207a09[_0x2254('0x87')]+'\x20');_0x8a3656+=_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x69')]?_0x36d121(_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x69')]):_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x72')]+'\x20'+_0x207a09[_0x2254('0x68')][_0x1554f1][_0x2254('0x6a')]+(_0x251d70(_0x207a09['rules'][_0x1554f1][_0x2254('0x6a')])?'\x20'+_0x207a09['rules'][_0x1554f1][_0x2254('0x88')]:'');}return _0x8a3656+')';};var _0xb98b40={'where':{'id':_0x4dfcb4['id']}},_0x3b1d5c,_0x2c907a,_0x23b78c,_0x2b5dba,_0x30307a;_0xb98b40=_['merge']({},_0xb98b40,_0x4e699c);return db[_0x2254('0x2e')]['find'](_0xb98b40)[_0x2254('0x25')](function(_0x52712d){if(_0x52712d){_0x3b1d5c=_0x52712d;return _0x52712d[_0x2254('0x89')]();}return null;})[_0x2254('0x25')](function(_0x1d0c8f){if(_0x1d0c8f){if(!_0x1d0c8f['length']){throw new db[(_0x2254('0x6b'))][(_0x2254('0x8a'))](_0x2254('0x6c'),0x193);}_0x2c907a=_0x1d0c8f;return db[_0x2254('0x6d')][_0x2254('0x44')]({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x34185c){if(_0x34185c){_0x23b78c=_[_0x2254('0x6e')](_0x34185c,'id');var _0x5e94b6;var _0x56239e=squel[_0x2254('0x6f')]();_0x56239e['from'](_0x3b1d5c[_0x2254('0x7e')]);for(var _0x3a1365=0x0;_0x3a1365<_0x2c907a[_0x2254('0x39')];_0x3a1365+=0x1){_0x5e94b6=_0x2c907a[_0x3a1365][_0x2254('0x71')]?_0x23b78c[_0x2c907a[_0x3a1365][_0x2254('0x71')]][_0x2254('0x8b')]:_0x2c907a[_0x3a1365][_0x2254('0x72')];_0x5e94b6=_0x2c907a[_0x3a1365]['function']?_[_0x2254('0x73')](_0x3a8d4f[_0x2c907a[_0x3a1365][_0x2254('0x74')]],'%s',_0x5e94b6):_0x5e94b6;_0x5e94b6=_0x2c907a[_0x3a1365][_0x2254('0x8c')]?_['replace'](_0x2f3650[_0x2c907a[_0x3a1365][_0x2254('0x8c')]],'%s',_0x5e94b6):_0x5e94b6;if(_0x2c907a[_0x3a1365][_0x2254('0x75')]){_0x56239e[_0x2254('0x69')](_0x5e94b6);}_0x2c907a[_0x3a1365][_0x2254('0x76')]&&_0x56239e[_0x2254('0x3c')](_0x5e94b6,_0x2c907a[_0x3a1365][_0x2254('0x76')]===_0x2254('0x8d')?![]:!![]);_0x56239e[_0x2254('0x72')](_0x5e94b6,_0x2c907a[_0x3a1365][_0x2254('0x77')]||_0x5e94b6);}if(_0x3b1d5c['joins']){_0x3b1d5c[_0x2254('0x79')]=JSON[_0x2254('0x78')](_0x3b1d5c['joins']);for(var _0x4cec5b=0x0;_0x4cec5b<_0x3b1d5c[_0x2254('0x79')]['length'];_0x4cec5b+=0x1){if(_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')]&&_[_0x2254('0x65')](_0x1f7a48,_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')])&&_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7a')]&&_0x3b1d5c[_0x2254('0x79')][_0x4cec5b]['foreignTable']&&_0x3b1d5c['joins'][_0x4cec5b][_0x2254('0x7c')]){_0x56239e[_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x30')]](_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3b1d5c[_0x2254('0x7e')],_0x3b1d5c['joins'][_0x4cec5b][_0x2254('0x7a')],_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7b')],_0x3b1d5c[_0x2254('0x79')][_0x4cec5b][_0x2254('0x7c')]));}}}if(_0x3b1d5c[_0x2254('0x7f')]){_0x3b1d5c[_0x2254('0x7f')]=JSON['parse'](_0x3b1d5c[_0x2254('0x7f')]);_0x56239e[_0x2254('0x3e')](_0x36d121(_0x3b1d5c['conditions'][_0x2254('0x69')]));}_0x30307a=_0x56239e[_0x2254('0x80')]();_0x56239e[_0x2254('0x20')](_0x30f2c9);_0x56239e[_0x2254('0x1e')](0x0);return;}})[_0x2254('0x25')](function(){if(_0x1c317b[_0x2254('0x8e')]===_0x2254('0x8f')){return null;}var _0x38e2df=_[_0x2254('0x41')](_0x1c317b,{'name':_0x1c317b[_0x2254('0x90')]||_0x1c317b[_0x2254('0x2a')]||_0x3b1d5c['name'],'basename':_0x2ad519,'savename':util[_0x2254('0x8c')](_0x2254('0x91'),_0x1c317b[_0x2254('0x2a')]||_0x3b1d5c[_0x2254('0x2a')],require(_0x2254('0x92'))[_0x2254('0x93')](0x4),_0x1c317b[_0x2254('0x8e')]||'csv'),'reportId':_0x3b1d5c['id'],'reportType':_0x2254('0x94')});return db[_0x2254('0x95')][_0x2254('0x4b')](_0x38e2df,{'raw':!![]});})['then'](function(_0x60f5ac){if(_0x3b1d5c[_0x2254('0x7e')]===_0x2254('0x96')){_0x30307a[_0x2254('0x3e')](_0x3b1d5c[_0x2254('0x7e')]+_0x2254('0x97'),_0x1c317b['startDate'],_0x1c317b[_0x2254('0x98')]);}else{_0x30307a[_0x2254('0x3e')](_0x3b1d5c[_0x2254('0x7e')]+_0x2254('0x99'),_0x1c317b[_0x2254('0x9a')],_0x1c317b['endDate']);}if(_0x60f5ac){logger['info'](_0x2254('0x9b'),_0x30307a['toString']());require(_0x2254('0x9c'))[_0x2254('0x9d')](path[_0x2254('0x54')](__dirname,_0x2254('0x9e'),_0x60f5ac[_0x2254('0x8e')]),[_0x60f5ac['id'],_0x30307a[_0x2254('0x83')](),path['join'](__dirname,'../../files/reports',_0x60f5ac[_0x2254('0x9f')]),_0x2ad519]);return _0x60f5ac;}else{var _0x3317d4=squel[_0x2254('0x6f')]();_0x3317d4[_0x2254('0x70')]('('+_0x30307a['toString']()+')',_0x2254('0xa0'));_0x3317d4[_0x2254('0x72')](_0x2254('0xa1'),_0x2254('0x21'));_0x30307a[_0x2254('0x20')](_0x1c317b[_0x2254('0x20')]||_0x30f2c9);_0x30307a[_0x2254('0x1e')](_0x1c317b[_0x2254('0x1e')]||0x0);return dbH[_0x2254('0xa2')]['query'](_0x3317d4[_0x2254('0x83')](),{'type':dbH[_0x2254('0xa2')][_0x2254('0x84')]['SELECT']})[_0x2254('0x25')](function(_0xe38a28){if(!_0xe38a28[_0x2254('0x39')]){_0x2b5dba=0x0;}else{_0x2b5dba=_0xe38a28[0x0]['count']||0x0;}return dbH['sequelize'][_0x2254('0x33')](_0x30307a[_0x2254('0x83')](),{'type':dbH[_0x2254('0xa2')][_0x2254('0x84')][_0x2254('0xa3')]});})[_0x2254('0x25')](function(_0x4011de){return{'rows':_0x4011de||[],'count':_0x2b5dba};});}});}exports[_0x2254('0xa4')]=function(_0x5cb3d1,_0x1d8238){return runReport(_0x5cb3d1[_0x2254('0x47')],_0x5cb3d1[_0x2254('0x33')],_0x5cb3d1[_0x2254('0x42')])[_0x2254('0x25')](respondWithResult(_0x1d8238,null))[_0x2254('0x46')](handleError(_0x1d8238,null));};exports['runReport']=runReport;exports['query']=function(_0x40339d,_0x4b3b96){var _0x59b8af=0xa;var _0x408695=[_0x2254('0x54'),_0x2254('0x55'),_0x2254('0x56'),'cross_join'];var _0x596eae={'SUM':_0x2254('0x58'),'COUNT':_0x2254('0x59'),'COUNT DISTINCT':_0x2254('0x5a'),'MAX':'MAX(%s)','MIN':_0x2254('0x5c'),'AVG':_0x2254('0x5d'),'GROUP_CONCAT':_0x2254('0x5e'),'GROUP_CONCAT ASC':_0x2254('0x5f'),'GROUP_CONCAT DESC':_0x2254('0x60')};var _0x739a29={'SEC_TO_TIME':_0x2254('0x61'),'DATE':'DATE(%s)','HOUR':_0x2254('0x63'),'ROUND':_0x2254('0x64'),'UNIX_TIMESTAMP':_0x2254('0x85')};var _0x243466=function(_0x1b8587){return!_[_0x2254('0x65')]([_0x2254('0x66'),_0x2254('0xa5'),_0x2254('0x86'),'IS\x20NOT\x20EMPTY'],_0x1b8587);};var _0xbec5d0=function(_0x18f841){if(!_0x18f841||!_0x18f841[_0x2254('0x68')][_0x2254('0x39')]){return'';}for(var _0x275b56='(',_0x315add=0x0;_0x315add<_0x18f841['rules']['length'];_0x315add+=0x1){_0x315add>0x0&&(_0x275b56+='\x20'+_0x18f841[_0x2254('0x87')]+'\x20');_0x275b56+=_0x18f841['rules'][_0x315add][_0x2254('0x69')]?_0xbec5d0(_0x18f841[_0x2254('0x68')][_0x315add][_0x2254('0x69')]):_0x18f841[_0x2254('0x68')][_0x315add]['field']+'\x20'+_0x18f841[_0x2254('0x68')][_0x315add][_0x2254('0x6a')]+(_0x243466(_0x18f841[_0x2254('0x68')][_0x315add]['condition'])?'\x20'+_0x18f841['rules'][_0x315add][_0x2254('0x88')]:'');}return _0x275b56+')';};var _0x51b02a={'where':{'id':_0x40339d[_0x2254('0x47')]['id']}},_0x3e7642,_0xe1abb6,_0x1a44d0,_0x4af6a7,_0x539aba;_0x51b02a=_[_0x2254('0x41')]({},_0x51b02a,_0x40339d[_0x2254('0x42')]);return db[_0x2254('0x2e')][_0x2254('0x4a')](_0x51b02a)['then'](function(_0x34e28b){if(_0x34e28b){_0x3e7642=_0x34e28b;return _0x34e28b[_0x2254('0x89')]();}return null;})[_0x2254('0x25')](function(_0x5d373){if(_0x5d373){if(!_0x5d373[_0x2254('0x39')]){throw new db[(_0x2254('0x6b'))]['ValidationErrorItem'](_0x2254('0x6c'),0x193);}_0xe1abb6=_0x5d373;return db[_0x2254('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x2254('0x25')](function(_0x56a7ce){if(_0x56a7ce){_0x1a44d0=_[_0x2254('0x6e')](_0x56a7ce,'id');var _0x34bf19;var _0x4965c7=squel[_0x2254('0x6f')]();_0x4965c7[_0x2254('0x70')](_0x3e7642[_0x2254('0x7e')]);for(var _0x45541b=0x0;_0x45541b<_0xe1abb6[_0x2254('0x39')];_0x45541b+=0x1){_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x71')]?_0x1a44d0[_0xe1abb6[_0x45541b][_0x2254('0x71')]][_0x2254('0x8b')]:_0xe1abb6[_0x45541b][_0x2254('0x72')];_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x74')]?_[_0x2254('0x73')](_0x596eae[_0xe1abb6[_0x45541b][_0x2254('0x74')]],'%s',_0x34bf19):_0x34bf19;_0x34bf19=_0xe1abb6[_0x45541b][_0x2254('0x8c')]?_[_0x2254('0x73')](_0x739a29[_0xe1abb6[_0x45541b]['format']],'%s',_0x34bf19):_0x34bf19;if(_0xe1abb6[_0x45541b][_0x2254('0x75')]){_0x4965c7[_0x2254('0x69')](_0x34bf19);}_0xe1abb6[_0x45541b]['orderBy']&&_0x4965c7['order'](_0x34bf19,_0xe1abb6[_0x45541b][_0x2254('0x76')]===_0x2254('0x8d')?![]:!![]);_0x4965c7[_0x2254('0x72')](_0x34bf19,_0xe1abb6[_0x45541b][_0x2254('0x77')]||_0x34bf19);}if(_0x3e7642['joins']){_0x3e7642[_0x2254('0x79')]=JSON['parse'](_0x3e7642['joins']);for(var _0x40fec0=0x0;_0x40fec0<_0x3e7642[_0x2254('0x79')][_0x2254('0x39')];_0x40fec0+=0x1){if(_0x3e7642[_0x2254('0x79')][_0x40fec0]['type']&&_[_0x2254('0x65')](_0x408695,_0x3e7642['joins'][_0x40fec0][_0x2254('0x30')])&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7a')]&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')]&&_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7c')]){_0x4965c7[_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x30')]](_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')],null,util['format'](_0x2254('0x7d'),_0x3e7642[_0x2254('0x7e')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7a')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7b')],_0x3e7642[_0x2254('0x79')][_0x40fec0][_0x2254('0x7c')]));}}}if(_0x3e7642['conditions']){_0x3e7642[_0x2254('0x7f')]=JSON[_0x2254('0x78')](_0x3e7642[_0x2254('0x7f')]);_0x4965c7[_0x2254('0x3e')](_0xbec5d0(_0x3e7642[_0x2254('0x7f')]['group']));}_0x539aba=_0x4965c7[_0x2254('0x80')]();_0x4965c7[_0x2254('0x20')](_0x59b8af);_0x4965c7['offset'](0x0);logger[_0x2254('0x81')](_0x2254('0x82'),_0x4965c7[_0x2254('0x83')]());return dbH['sequelize'][_0x2254('0x33')](_0x4965c7[_0x2254('0x83')](),{'type':dbH['sequelize'][_0x2254('0x84')][_0x2254('0xa3')]});}})[_0x2254('0x25')](function(){return{'sql':_0x539aba[_0x2254('0x83')]()};})['then'](respondWithResult(_0x4b3b96,null))[_0x2254('0x46')](handleError(_0x4b3b96,null));}; \ No newline at end of file +var _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x43ed31,_0x429e8a){var _0x49b36e=function(_0x16e3a3){while(--_0x16e3a3){_0x43ed31['push'](_0x43ed31['shift']());}};_0x49b36e(++_0x429e8a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x454d3c,_0x19758d){_0x454d3c=_0x454d3c-0x0;var _0xd770c5=_0x1cb9[_0x454d3c];return _0xd770c5;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 8117b67..05f7f26 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 _0x1126=['exports','define','AnalyticDefaultReport','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x1126,0xc9));var _0x6112=function(_0xa059ea,_0x5cb91e){_0xa059ea=_0xa059ea-0x0;var _0x156a4c=_0x1126[_0xa059ea];return _0x156a4c;};'use strict';var _=require(_0x6112('0x0'));var util=require('util');var logger=require(_0x6112('0x1'))(_0x6112('0x2'));var moment=require('moment');var BPromise=require(_0x6112('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6112('0x4'));var rimraf=require(_0x6112('0x5'));var config=require(_0x6112('0x6'));var attributes=require(_0x6112('0x7'));module[_0x6112('0x8')]=function(_0x480005,_0xd2bbdb){return _0x480005[_0x6112('0x9')](_0x6112('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32e0=['api','moment','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','lodash','../../config/logger'];(function(_0x4d05a0,_0x53aa7e){var _0x4c999c=function(_0x358867){while(--_0x358867){_0x4d05a0['push'](_0x4d05a0['shift']());}};_0x4c999c(++_0x53aa7e);}(_0x32e0,0x15d));var _0x032e=function(_0x4cb095,_0x58da07){_0x4cb095=_0x4cb095-0x0;var _0x2b565d=_0x32e0[_0x4cb095];return _0x2b565d;};'use strict';var _=require(_0x032e('0x0'));var util=require('util');var logger=require(_0x032e('0x1'))(_0x032e('0x2'));var moment=require(_0x032e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x032e('0x4'));var config=require(_0x032e('0x5'));var attributes=require(_0x032e('0x6'));module[_0x032e('0x7')]=function(_0x2372d3,_0x2fb1e9){return _0x2372d3[_0x032e('0x8')]('AnalyticDefaultReport',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 393a015..f4b9bee 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 _0xbea8=['moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util'];(function(_0x2ec3d4,_0x414152){var _0x162b41=function(_0x39a7b0){while(--_0x39a7b0){_0x2ec3d4['push'](_0x2ec3d4['shift']());}};_0x162b41(++_0x414152);}(_0xbea8,0xb2));var _0x8bea=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0xbea8[_0x4b7b69];return _0x173b4c;};'use strict';var _=require(_0x8bea('0x0'));var util=require(_0x8bea('0x1'));var moment=require(_0x8bea('0x2'));var BPromise=require(_0x8bea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8bea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8bea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8bea('0x6'));var jayson=require(_0x8bea('0x7'));var client=jayson[_0x8bea('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x81e953,_0xc9de46,_0x38c191){return new BPromise(function(_0xf27c73,_0x337b1a){return client['request'](_0x81e953,_0x38c191)['then'](function(_0x4e345d){logger[_0x8bea('0x9')](_0x8bea('0xa'),_0xc9de46,_0x8bea('0xb'));logger[_0x8bea('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0xc9de46,_0x8bea('0xb'),JSON[_0x8bea('0xd')](_0x4e345d));if(_0x4e345d[_0x8bea('0xe')]){if(_0x4e345d[_0x8bea('0xe')][_0x8bea('0xf')]===0x1f4){logger[_0x8bea('0xe')](_0x8bea('0xa'),_0xc9de46,_0x4e345d[_0x8bea('0xe')][_0x8bea('0x10')]);return _0x337b1a(_0x4e345d[_0x8bea('0xe')][_0x8bea('0x10')]);}logger[_0x8bea('0xe')](_0x8bea('0xa'),_0xc9de46,_0x4e345d[_0x8bea('0xe')][_0x8bea('0x10')]);return _0xf27c73(_0x4e345d[_0x8bea('0xe')][_0x8bea('0x10')]);}else{logger[_0x8bea('0x9')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xc9de46,_0x8bea('0xb'));_0xf27c73(_0x4e345d['result']['message']);}})[_0x8bea('0x11')](function(_0x2e46f5){logger[_0x8bea('0xe')](_0x8bea('0xa'),_0xc9de46,_0x2e46f5);_0x337b1a(_0x2e46f5);});});} \ No newline at end of file +var _0x27b6=['../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3a3f77,_0x400a0a){var _0x24e317=function(_0x2b4af6){while(--_0x2b4af6){_0x3a3f77['push'](_0x3a3f77['shift']());}};_0x24e317(++_0x400a0a);}(_0x27b6,0x14e));var _0x627b=function(_0xe2d561,_0x12ff21){_0xe2d561=_0xe2d561-0x0;var _0x26a70f=_0x27b6[_0xe2d561];return _0x26a70f;};'use strict';var _=require(_0x627b('0x0'));var util=require(_0x627b('0x1'));var moment=require(_0x627b('0x2'));var BPromise=require(_0x627b('0x3'));var rs=require(_0x627b('0x4'));var fs=require('fs');var Redis=require(_0x627b('0x5'));var db=require(_0x627b('0x6'))['db'];var utils=require(_0x627b('0x7'));var logger=require(_0x627b('0x8'))(_0x627b('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x627b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b6039,_0x613927,_0x452473){return new BPromise(function(_0x30de20,_0x26e466){return client[_0x627b('0xb')](_0x4b6039,_0x452473)['then'](function(_0x240da8){logger['info'](_0x627b('0xc'),_0x613927,_0x627b('0xd'));logger[_0x627b('0xe')](_0x627b('0xf'),_0x613927,_0x627b('0xd'),JSON['stringify'](_0x240da8));if(_0x240da8[_0x627b('0x10')]){if(_0x240da8['error'][_0x627b('0x11')]===0x1f4){logger[_0x627b('0x10')](_0x627b('0xc'),_0x613927,_0x240da8[_0x627b('0x10')][_0x627b('0x12')]);return _0x26e466(_0x240da8[_0x627b('0x10')][_0x627b('0x12')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x613927,_0x240da8[_0x627b('0x10')]['message']);return _0x30de20(_0x240da8['error'][_0x627b('0x12')]);}else{logger[_0x627b('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x613927,'request\x20sent');_0x30de20(_0x240da8['result'][_0x627b('0x12')]);}})['catch'](function(_0x2d93f6){logger[_0x627b('0x10')](_0x627b('0xc'),_0x613927,_0x2d93f6);_0x26e466(_0x2d93f6);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index aaf5dd5..3c0b618 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 _0x2c7d=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','preview','/:id/run','run','/:id/query','delete','destroy','exports','multer','util'];(function(_0x436c65,_0x18d4a1){var _0x3873fa=function(_0x186fa1){while(--_0x186fa1){_0x436c65['push'](_0x436c65['shift']());}};_0x3873fa(++_0x18d4a1);}(_0x2c7d,0x1ec));var _0xd2c7=function(_0x451109,_0x17d2f3){_0x451109=_0x451109-0x0;var _0x2fbe02=_0x2c7d[_0x451109];return _0x2fbe02;};'use strict';var multer=require(_0xd2c7('0x0'));var util=require(_0xd2c7('0x1'));var path=require('path');var timeout=require(_0xd2c7('0x2'));var express=require(_0xd2c7('0x3'));var router=express['Router']();var fs_extra=require(_0xd2c7('0x4'));var auth=require(_0xd2c7('0x5'));var interaction=require(_0xd2c7('0x6'));var config=require('../../config/environment');var controller=require(_0xd2c7('0x7'));router[_0xd2c7('0x8')]('/',auth[_0xd2c7('0x9')](),controller[_0xd2c7('0xa')]);router[_0xd2c7('0x8')](_0xd2c7('0xb'),auth[_0xd2c7('0x9')](),controller['show']);router[_0xd2c7('0x8')]('/:id/preview',auth[_0xd2c7('0x9')](),controller[_0xd2c7('0xc')]);router[_0xd2c7('0x8')](_0xd2c7('0xd'),auth[_0xd2c7('0x9')](),controller[_0xd2c7('0xe')]);router['get'](_0xd2c7('0xf'),auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0xd2c7('0x9')](),controller['create']);router['put']('/:id',auth[_0xd2c7('0x9')](),controller['update']);router[_0xd2c7('0x10')]('/:id',auth[_0xd2c7('0x9')](),controller[_0xd2c7('0x11')]);module[_0xd2c7('0x12')]=router; \ No newline at end of file +var _0x708f=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','post','create','put','update','destroy','exports','connect-timeout','express'];(function(_0x2d3992,_0x1e6690){var _0x119bd7=function(_0x3065dd){while(--_0x3065dd){_0x2d3992['push'](_0x2d3992['shift']());}};_0x119bd7(++_0x1e6690);}(_0x708f,0x11b));var _0xf708=function(_0x100eb2,_0x283b3c){_0x100eb2=_0x100eb2-0x0;var _0xeff6c=_0x708f[_0x100eb2];return _0xeff6c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf708('0x0'));var express=require(_0xf708('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf708('0x2'));var config=require(_0xf708('0x3'));var controller=require('./analyticDefaultReport.controller');router[_0xf708('0x4')]('/',auth[_0xf708('0x5')](),controller[_0xf708('0x6')]);router[_0xf708('0x4')](_0xf708('0x7'),auth[_0xf708('0x5')](),controller[_0xf708('0x8')]);router[_0xf708('0x4')](_0xf708('0x9'),auth[_0xf708('0x5')](),controller[_0xf708('0xa')]);router[_0xf708('0x4')](_0xf708('0xb'),auth[_0xf708('0x5')](),controller['run']);router[_0xf708('0x4')](_0xf708('0xc'),auth[_0xf708('0x5')](),controller['query']);router[_0xf708('0xd')]('/',auth[_0xf708('0x5')](),controller[_0xf708('0xe')]);router[_0xf708('0xf')](_0xf708('0x7'),auth[_0xf708('0x5')](),controller[_0xf708('0x10')]);router['delete'](_0xf708('0x7'),auth[_0xf708('0x5')](),controller[_0xf708('0x11')]);module[_0xf708('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 44806c4..16620d2 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 _0x2e2a=['moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize'];(function(_0x565d49,_0x3737e6){var _0x2807d9=function(_0x36f321){while(--_0x36f321){_0x565d49['push'](_0x565d49['shift']());}};_0x2807d9(++_0x3737e6);}(_0x2e2a,0x15d));var _0xa2e2=function(_0x237398,_0xc0ef22){_0x237398=_0x237398-0x0;var _0x5598de=_0x2e2a[_0x237398];return _0x5598de;};'use strict';var Sequelize=require(_0xa2e2('0x0'));var moment=require(_0xa2e2('0x1'));module[_0xa2e2('0x2')]={'name':{'type':Sequelize[_0xa2e2('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xa2e2('0x4')](_0xa2e2('0x5'),_0xa2e2('0x6'),_0xa2e2('0x7')),'allowNull':![],'defaultValue':_0xa2e2('0x5')},'savename':{'type':Sequelize[_0xa2e2('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xa2e2('0x8')]},'status':{'type':Sequelize[_0xa2e2('0x3')],'defaultValue':_0xa2e2('0x9')},'type':{'type':Sequelize[_0xa2e2('0x4')](_0xa2e2('0xa'),_0xa2e2('0xb')),'allowNull':![],'defaultValue':_0xa2e2('0xa')},'reportId':{'type':Sequelize[_0xa2e2('0xc')](0xb)[_0xa2e2('0xd')]},'reportType':{'type':Sequelize[_0xa2e2('0x3')]}}; \ No newline at end of file +var _0x58d1=['ENUM','pdf','xlsx','DATE','Loading','scheduled','manual','INTEGER','sequelize','moment','exports','STRING'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0x58d1,0xa4));var _0x158d=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x58d1[_0x2a2166];return _0x3bcf50;};'use strict';var Sequelize=require(_0x158d('0x0'));var moment=require(_0x158d('0x1'));module[_0x158d('0x2')]={'name':{'type':Sequelize[_0x158d('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x158d('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x158d('0x4')]('csv',_0x158d('0x5'),_0x158d('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x158d('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x158d('0x7')]},'status':{'type':Sequelize[_0x158d('0x3')],'defaultValue':_0x158d('0x8')},'type':{'type':Sequelize[_0x158d('0x4')]('manual',_0x158d('0x9')),'allowNull':![],'defaultValue':_0x158d('0xa')},'reportId':{'type':Sequelize[_0x158d('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x158d('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index c7acbf2..824c63e 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 _0xbd15=['create','role','update','body','download','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','get','ExtractedReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','params','includeAll','find'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbd15,0x1e9));var _0x5bd1=function(_0x47dd05,_0x4aa69a){_0x47dd05=_0x47dd05-0x0;var _0x1ac7c7=_0xbd15[_0x47dd05];return _0x1ac7c7;};'use strict';var emlformat=require(_0x5bd1('0x0'));var rimraf=require(_0x5bd1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bd1('0x2'));var rp=require(_0x5bd1('0x3'));var moment=require(_0x5bd1('0x4'));var BPromise=require(_0x5bd1('0x5'));var Mustache=require(_0x5bd1('0x6'));var util=require(_0x5bd1('0x7'));var path=require('path');var sox=require(_0x5bd1('0x8'));var csv=require(_0x5bd1('0x9'));var ejs=require(_0x5bd1('0xa'));var fs=require('fs');var fs_extra=require(_0x5bd1('0xb'));var _=require(_0x5bd1('0xc'));var squel=require(_0x5bd1('0xd'));var crypto=require(_0x5bd1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5bd1('0xf'));var toCsv=require(_0x5bd1('0x9'));var querystring=require(_0x5bd1('0x10'));var Papa=require(_0x5bd1('0x11'));var Redis=require('ioredis');var authService=require(_0x5bd1('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bd1('0x13'));var logger=require(_0x5bd1('0x14'))(_0x5bd1('0x15'));var utils=require(_0x5bd1('0x16'));var config=require(_0x5bd1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bd1('0x18'))['db'];function respondWithStatusCode(_0x5823cf,_0x105fba){_0x105fba=_0x105fba||0xcc;return function(_0x4d49e5){if(_0x4d49e5){return _0x5823cf[_0x5bd1('0x19')](_0x105fba);}return _0x5823cf['status'](_0x105fba)['end']();};}function respondWithResult(_0x1eb1b5,_0x41956f){_0x41956f=_0x41956f||0xc8;return function(_0x32d415){if(_0x32d415){return _0x1eb1b5[_0x5bd1('0x1a')](_0x41956f)['json'](_0x32d415);}};}function respondWithFilteredResult(_0x32eb76,_0x2380e7){return function(_0x22665c){if(_0x22665c){var _0x1bf62d=typeof _0x2380e7[_0x5bd1('0x1b')]==='undefined'&&typeof _0x2380e7[_0x5bd1('0x1c')]===_0x5bd1('0x1d');var _0x528c19=_0x22665c[_0x5bd1('0x1e')];var _0x2e98f5=_0x1bf62d?0x0:_0x2380e7[_0x5bd1('0x1b')];var _0x2dd28f=_0x1bf62d?_0x22665c[_0x5bd1('0x1e')]:_0x2380e7[_0x5bd1('0x1b')]+_0x2380e7[_0x5bd1('0x1c')];var _0x5a3167;if(_0x2dd28f>=_0x528c19){_0x2dd28f=_0x528c19;_0x5a3167=0xc8;}else{_0x5a3167=0xce;}_0x32eb76[_0x5bd1('0x1a')](_0x5a3167);return _0x32eb76[_0x5bd1('0x1f')](_0x5bd1('0x20'),_0x2e98f5+'-'+_0x2dd28f+'/'+_0x528c19)['json'](_0x22665c);}return null;};}function patchUpdates(_0x321166){return function(_0x361482){try{jsonpatch[_0x5bd1('0x21')](_0x361482,_0x321166,!![]);}catch(_0x576402){return BPromise[_0x5bd1('0x22')](_0x576402);}return _0x361482[_0x5bd1('0x23')]();};}function saveUpdates(_0x227497,_0x4fc4cc){return function(_0x528f16){if(_0x528f16){return _0x528f16['update'](_0x227497)['then'](function(_0x1f16c0){return _0x1f16c0;});}return null;};}function removeEntity(_0x55a2ef,_0x5bf642){return function(_0x461f17){if(_0x461f17){return _0x461f17['destroy']()[_0x5bd1('0x24')](function(){var _0x15fd8e=_0x461f17[_0x5bd1('0x25')]({'plain':!![]});var _0x5d4318=_0x5bd1('0x26');return db[_0x5bd1('0x27')][_0x5bd1('0x28')]({'where':{'type':_0x5d4318,'resourceId':_0x15fd8e['id']}})['then'](function(){return _0x461f17;});})['then'](function(){_0x55a2ef[_0x5bd1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x203095,_0x96741b){return function(_0x22817c){if(!_0x22817c){_0x203095[_0x5bd1('0x19')](0x194);}return _0x22817c;};}function handleError(_0x5e6052,_0x33b5b0){_0x33b5b0=_0x33b5b0||0x1f4;return function(_0x47ab2e){logger[_0x5bd1('0x29')](_0x47ab2e[_0x5bd1('0x2a')]);if(_0x47ab2e[_0x5bd1('0x2b')]){delete _0x47ab2e[_0x5bd1('0x2b')];}_0x5e6052['status'](_0x33b5b0)[_0x5bd1('0x2c')](_0x47ab2e);};}exports[_0x5bd1('0x2d')]=function(_0x3bed03,_0x36d238){var _0x293c82={},_0x357910={},_0x30d9ac={'count':0x0,'rows':[]};var _0x26222a=_[_0x5bd1('0x2e')](db[_0x5bd1('0x2f')][_0x5bd1('0x30')],function(_0x7232c0){return{'name':_0x7232c0[_0x5bd1('0x31')],'type':_0x7232c0[_0x5bd1('0x32')][_0x5bd1('0x33')]};});_0x357910[_0x5bd1('0x34')]=_[_0x5bd1('0x2e')](_0x26222a,_0x5bd1('0x2b'));_0x357910[_0x5bd1('0x35')]=_[_0x5bd1('0x36')](_0x3bed03[_0x5bd1('0x35')]);_0x357910[_0x5bd1('0x37')]=_[_0x5bd1('0x38')](_0x357910['model'],_0x357910[_0x5bd1('0x35')]);_0x293c82[_0x5bd1('0x39')]=_[_0x5bd1('0x38')](_0x357910[_0x5bd1('0x34')],qs[_0x5bd1('0x3a')](_0x3bed03[_0x5bd1('0x35')][_0x5bd1('0x3a')]));_0x293c82[_0x5bd1('0x39')]=_0x293c82[_0x5bd1('0x39')][_0x5bd1('0x3b')]?_0x293c82['attributes']:_0x357910[_0x5bd1('0x34')];if(!_0x3bed03['query'][_0x5bd1('0x3c')]('nolimit')){_0x293c82['limit']=qs['limit'](_0x3bed03['query'][_0x5bd1('0x1c')]);_0x293c82['offset']=qs['offset'](_0x3bed03[_0x5bd1('0x35')]['offset']);}_0x293c82[_0x5bd1('0x3d')]=qs[_0x5bd1('0x3e')](_0x3bed03[_0x5bd1('0x35')][_0x5bd1('0x3e')]);_0x293c82[_0x5bd1('0x3f')]=qs[_0x5bd1('0x37')](_[_0x5bd1('0x40')](_0x3bed03[_0x5bd1('0x35')],_0x357910[_0x5bd1('0x37')]),_0x26222a);if(_0x3bed03[_0x5bd1('0x35')]['filter']){_0x293c82[_0x5bd1('0x3f')]=_[_0x5bd1('0x41')](_0x293c82[_0x5bd1('0x3f')],{'$or':_[_0x5bd1('0x2e')](_0x26222a,function(_0x4fa200){if(_0x4fa200['type']!==_0x5bd1('0x42')){var _0x3ddb1d={};_0x3ddb1d[_0x4fa200[_0x5bd1('0x2b')]]={'$like':'%'+_0x3bed03['query'][_0x5bd1('0x43')]+'%'};return _0x3ddb1d;}})});}_0x293c82=_['merge']({},_0x293c82,_0x3bed03[_0x5bd1('0x44')]);var _0x36b2a7={'where':_0x293c82[_0x5bd1('0x3f')]};return db[_0x5bd1('0x2f')][_0x5bd1('0x1e')](_0x36b2a7)[_0x5bd1('0x24')](function(_0x18e22f){_0x30d9ac['count']=_0x18e22f;if(_0x3bed03[_0x5bd1('0x35')]['includeAll']){_0x293c82[_0x5bd1('0x45')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x293c82);})[_0x5bd1('0x24')](function(_0x4ac55d){_0x30d9ac[_0x5bd1('0x46')]=_0x4ac55d;return _0x30d9ac;})['then'](respondWithFilteredResult(_0x36d238,_0x293c82))[_0x5bd1('0x47')](handleError(_0x36d238,null));};exports['show']=function(_0x399aa4,_0x2494c8){var _0x1cfea1={'raw':!![],'where':{'id':_0x399aa4[_0x5bd1('0x48')]['id']}},_0x3e43b5={};_0x3e43b5[_0x5bd1('0x34')]=_[_0x5bd1('0x36')](db['AnalyticExtractedReport']['rawAttributes']);_0x3e43b5[_0x5bd1('0x35')]=_[_0x5bd1('0x36')](_0x399aa4['query']);_0x3e43b5[_0x5bd1('0x37')]=_['intersection'](_0x3e43b5[_0x5bd1('0x34')],_0x3e43b5[_0x5bd1('0x35')]);_0x1cfea1[_0x5bd1('0x39')]=_[_0x5bd1('0x38')](_0x3e43b5[_0x5bd1('0x34')],qs[_0x5bd1('0x3a')](_0x399aa4['query'][_0x5bd1('0x3a')]));_0x1cfea1[_0x5bd1('0x39')]=_0x1cfea1[_0x5bd1('0x39')][_0x5bd1('0x3b')]?_0x1cfea1[_0x5bd1('0x39')]:_0x3e43b5[_0x5bd1('0x34')];if(_0x399aa4['query'][_0x5bd1('0x49')]){_0x1cfea1[_0x5bd1('0x45')]=[{'all':!![]}];}_0x1cfea1=_['merge']({},_0x1cfea1,_0x399aa4[_0x5bd1('0x44')]);return db['AnalyticExtractedReport'][_0x5bd1('0x4a')](_0x1cfea1)['then'](handleEntityNotFound(_0x2494c8,null))[_0x5bd1('0x24')](respondWithResult(_0x2494c8,null))[_0x5bd1('0x47')](handleError(_0x2494c8,null));};exports[_0x5bd1('0x4b')]=function(_0x36a1c6,_0x59e145){return db[_0x5bd1('0x2f')][_0x5bd1('0x4b')](_0x36a1c6['body'],{})[_0x5bd1('0x24')](function(_0x175548){var _0x9efafd=_0x36a1c6['user'][_0x5bd1('0x25')]({'plain':!![]});if(!_0x9efafd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9efafd[_0x5bd1('0x4c')]==='user'){var _0x1b1a2e=_0x175548[_0x5bd1('0x25')]({'plain':!![]});var _0x3692ed=_0x5bd1('0x26');return db['UserProfileSection'][_0x5bd1('0x4a')]({'where':{'name':_0x3692ed,'userProfileId':_0x9efafd['userProfileId']},'raw':!![]})[_0x5bd1('0x24')](function(_0x383f38){if(_0x383f38&&_0x383f38['autoAssociation']===0x0){return db[_0x5bd1('0x27')][_0x5bd1('0x4b')]({'name':_0x1b1a2e['name'],'resourceId':_0x1b1a2e['id'],'type':_0x383f38[_0x5bd1('0x2b')],'sectionId':_0x383f38['id']},{})[_0x5bd1('0x24')](function(){return _0x175548;});}else{return _0x175548;}})[_0x5bd1('0x47')](function(_0x816f4f){logger[_0x5bd1('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x816f4f);throw _0x816f4f;});}return _0x175548;})['then'](respondWithResult(_0x59e145,0xc9))['catch'](handleError(_0x59e145,null));};exports[_0x5bd1('0x4d')]=function(_0x3ae5bc,_0x27b489){if(_0x3ae5bc[_0x5bd1('0x4e')]['id']){delete _0x3ae5bc['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x3ae5bc['params']['id']}})[_0x5bd1('0x24')](handleEntityNotFound(_0x27b489,null))[_0x5bd1('0x24')](saveUpdates(_0x3ae5bc[_0x5bd1('0x4e')],null))['then'](respondWithResult(_0x27b489,null))[_0x5bd1('0x47')](handleError(_0x27b489,null));};exports[_0x5bd1('0x28')]=function(_0x5dcf92,_0x410bf1){return db[_0x5bd1('0x2f')][_0x5bd1('0x4a')]({'where':{'id':_0x5dcf92['params']['id']}})[_0x5bd1('0x24')](handleEntityNotFound(_0x410bf1,null))['then'](removeEntity(_0x410bf1,null))[_0x5bd1('0x47')](handleError(_0x410bf1,null));};exports[_0x5bd1('0x4f')]=function(_0xad8531,_0x56c936,_0x34882f){return db[_0x5bd1('0x2f')][_0x5bd1('0x4a')]({'where':{'id':_0xad8531['params']['id']},'attributes':[_0x5bd1('0x2b'),'basename',_0x5bd1('0x50'),_0x5bd1('0x51')],'raw':!![]})[_0x5bd1('0x24')](handleEntityNotFound(_0x56c936,null))['then'](function(_0x19881d){if(_0x19881d){if(!fs[_0x5bd1('0x52')](path[_0x5bd1('0x53')](config[_0x5bd1('0x54')],_0x5bd1('0x55'),_0x19881d['savename']))){throw new db[(_0x5bd1('0x56'))][(_0x5bd1('0x57'))](_0x5bd1('0x58'));}if(_0xad8531[_0x5bd1('0x35')][_0x5bd1('0x59')]){return _0x56c936[_0x5bd1('0x19')](0xc8);}return _0x56c936[_0x5bd1('0x4f')](path[_0x5bd1('0x53')](config[_0x5bd1('0x54')],_0x5bd1('0x55'),_0x19881d['savename']),util[_0x5bd1('0x5a')](_0x5bd1('0x5b'),_0x19881d[_0x5bd1('0x5c')]||_0x19881d[_0x5bd1('0x2b')],_0x19881d[_0x5bd1('0x51')][_0x5bd1('0x5d')]()));}})[_0x5bd1('0x47')](handleError(_0x56c936,null));}; \ No newline at end of file +var _0x5b14=['join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','offset','limit','apply','reject','update','then','destroy','get','ExtractedReports','UserProfileResource','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','attributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','output'];(function(_0x1a219d,_0x405933){var _0x5f133b=function(_0x3ccf2a){while(--_0x3ccf2a){_0x1a219d['push'](_0x1a219d['shift']());}};_0x5f133b(++_0x405933);}(_0x5b14,0x189));var _0x45b1=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x5b14[_0x1a36a5];return _0x746243;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45b1('0x0'));var zipdir=require(_0x45b1('0x1'));var jsonpatch=require(_0x45b1('0x2'));var rp=require(_0x45b1('0x3'));var moment=require(_0x45b1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x45b1('0x5'));var util=require(_0x45b1('0x6'));var path=require('path');var sox=require(_0x45b1('0x7'));var csv=require(_0x45b1('0x8'));var ejs=require(_0x45b1('0x9'));var fs=require('fs');var fs_extra=require(_0x45b1('0xa'));var _=require(_0x45b1('0xb'));var squel=require(_0x45b1('0xc'));var crypto=require(_0x45b1('0xd'));var jsforce=require(_0x45b1('0xe'));var deskjs=require(_0x45b1('0xf'));var toCsv=require(_0x45b1('0x8'));var querystring=require(_0x45b1('0x10'));var Papa=require(_0x45b1('0x11'));var Redis=require('ioredis');var authService=require(_0x45b1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x45b1('0x13'));var hardwareService=require(_0x45b1('0x14'));var logger=require(_0x45b1('0x15'))(_0x45b1('0x16'));var utils=require(_0x45b1('0x17'));var config=require(_0x45b1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x45b1('0x19'))['db'];function respondWithStatusCode(_0x5114f4,_0x4e9071){_0x4e9071=_0x4e9071||0xcc;return function(_0xcd2bc3){if(_0xcd2bc3){return _0x5114f4[_0x45b1('0x1a')](_0x4e9071);}return _0x5114f4['status'](_0x4e9071)[_0x45b1('0x1b')]();};}function respondWithResult(_0x4d10be,_0x5e2f09){_0x5e2f09=_0x5e2f09||0xc8;return function(_0x43d45d){if(_0x43d45d){return _0x4d10be[_0x45b1('0x1c')](_0x5e2f09)[_0x45b1('0x1d')](_0x43d45d);}};}function respondWithFilteredResult(_0x2ab775,_0x31ba7a){return function(_0x2f4b59){if(_0x2f4b59){var _0x18e62d=typeof _0x31ba7a['offset']===_0x45b1('0x1e')&&typeof _0x31ba7a['limit']===_0x45b1('0x1e');var _0x340b7d=_0x2f4b59['count'];var _0x51c780=_0x18e62d?0x0:_0x31ba7a[_0x45b1('0x1f')];var _0x30ca39=_0x18e62d?_0x2f4b59['count']:_0x31ba7a[_0x45b1('0x1f')]+_0x31ba7a[_0x45b1('0x20')];var _0x42c926;if(_0x30ca39>=_0x340b7d){_0x30ca39=_0x340b7d;_0x42c926=0xc8;}else{_0x42c926=0xce;}_0x2ab775[_0x45b1('0x1c')](_0x42c926);return _0x2ab775['set']('Content-Range',_0x51c780+'-'+_0x30ca39+'/'+_0x340b7d)['json'](_0x2f4b59);}return null;};}function patchUpdates(_0x1b8026){return function(_0xadb006){try{jsonpatch[_0x45b1('0x21')](_0xadb006,_0x1b8026,!![]);}catch(_0x541211){return BPromise[_0x45b1('0x22')](_0x541211);}return _0xadb006['save']();};}function saveUpdates(_0x45d5b8,_0x44476b){return function(_0x108870){if(_0x108870){return _0x108870[_0x45b1('0x23')](_0x45d5b8)[_0x45b1('0x24')](function(_0x5929ab){return _0x5929ab;});}return null;};}function removeEntity(_0x4df9a5,_0x2a66d7){return function(_0x1b6024){if(_0x1b6024){return _0x1b6024[_0x45b1('0x25')]()[_0x45b1('0x24')](function(){var _0xee9ac1=_0x1b6024[_0x45b1('0x26')]({'plain':!![]});var _0x1891f7=_0x45b1('0x27');return db[_0x45b1('0x28')]['destroy']({'where':{'type':_0x1891f7,'resourceId':_0xee9ac1['id']}})[_0x45b1('0x24')](function(){return _0x1b6024;});})[_0x45b1('0x24')](function(){_0x4df9a5[_0x45b1('0x1c')](0xcc)[_0x45b1('0x1b')]();});}};}function handleEntityNotFound(_0x4e8183,_0x3ff469){return function(_0xe1cf5a){if(!_0xe1cf5a){_0x4e8183[_0x45b1('0x1a')](0x194);}return _0xe1cf5a;};}function handleError(_0x3245c2,_0x3492f8){_0x3492f8=_0x3492f8||0x1f4;return function(_0x352d76){logger[_0x45b1('0x29')](_0x352d76['stack']);if(_0x352d76[_0x45b1('0x2a')]){delete _0x352d76['name'];}_0x3245c2[_0x45b1('0x1c')](_0x3492f8)[_0x45b1('0x2b')](_0x352d76);};}exports[_0x45b1('0x2c')]=function(_0x125fe3,_0x2fb263){var _0xb4d4e1={},_0x51d721={},_0x56a5f5={'count':0x0,'rows':[]};var _0x5b0a55=_[_0x45b1('0x2d')](db[_0x45b1('0x2e')][_0x45b1('0x2f')],function(_0x3a8780){return{'name':_0x3a8780[_0x45b1('0x30')],'type':_0x3a8780[_0x45b1('0x31')][_0x45b1('0x32')]};});_0x51d721[_0x45b1('0x33')]=_[_0x45b1('0x2d')](_0x5b0a55,_0x45b1('0x2a'));_0x51d721['query']=_[_0x45b1('0x34')](_0x125fe3[_0x45b1('0x35')]);_0x51d721[_0x45b1('0x36')]=_[_0x45b1('0x37')](_0x51d721[_0x45b1('0x33')],_0x51d721[_0x45b1('0x35')]);_0xb4d4e1['attributes']=_[_0x45b1('0x37')](_0x51d721[_0x45b1('0x33')],qs['fields'](_0x125fe3['query'][_0x45b1('0x38')]));_0xb4d4e1['attributes']=_0xb4d4e1['attributes'][_0x45b1('0x39')]?_0xb4d4e1['attributes']:_0x51d721['model'];if(!_0x125fe3[_0x45b1('0x35')][_0x45b1('0x3a')](_0x45b1('0x3b'))){_0xb4d4e1['limit']=qs[_0x45b1('0x20')](_0x125fe3[_0x45b1('0x35')][_0x45b1('0x20')]);_0xb4d4e1[_0x45b1('0x1f')]=qs[_0x45b1('0x1f')](_0x125fe3['query'][_0x45b1('0x1f')]);}_0xb4d4e1[_0x45b1('0x3c')]=qs[_0x45b1('0x3d')](_0x125fe3['query'][_0x45b1('0x3d')]);_0xb4d4e1['where']=qs[_0x45b1('0x36')](_[_0x45b1('0x3e')](_0x125fe3[_0x45b1('0x35')],_0x51d721['filters']),_0x5b0a55);if(_0x125fe3[_0x45b1('0x35')][_0x45b1('0x3f')]){_0xb4d4e1[_0x45b1('0x40')]=_[_0x45b1('0x41')](_0xb4d4e1[_0x45b1('0x40')],{'$or':_[_0x45b1('0x2d')](_0x5b0a55,function(_0x118d38){if(_0x118d38[_0x45b1('0x31')]!==_0x45b1('0x42')){var _0x31bdba={};_0x31bdba[_0x118d38['name']]={'$like':'%'+_0x125fe3[_0x45b1('0x35')][_0x45b1('0x3f')]+'%'};return _0x31bdba;}})});}_0xb4d4e1=_[_0x45b1('0x41')]({},_0xb4d4e1,_0x125fe3[_0x45b1('0x43')]);var _0xdd507d={'where':_0xb4d4e1[_0x45b1('0x40')]};return db[_0x45b1('0x2e')]['count'](_0xdd507d)['then'](function(_0x3f8d1e){_0x56a5f5[_0x45b1('0x44')]=_0x3f8d1e;if(_0x125fe3[_0x45b1('0x35')][_0x45b1('0x45')]){_0xb4d4e1[_0x45b1('0x46')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x45b1('0x47')](_0xb4d4e1);})['then'](function(_0x4cd6aa){_0x56a5f5[_0x45b1('0x48')]=_0x4cd6aa;return _0x56a5f5;})['then'](respondWithFilteredResult(_0x2fb263,_0xb4d4e1))[_0x45b1('0x49')](handleError(_0x2fb263,null));};exports['show']=function(_0x57f16e,_0x331a46){var _0x50862c={'raw':!![],'where':{'id':_0x57f16e[_0x45b1('0x4a')]['id']}},_0x22017f={};_0x22017f['model']=_[_0x45b1('0x34')](db['AnalyticExtractedReport'][_0x45b1('0x2f')]);_0x22017f['query']=_['keys'](_0x57f16e[_0x45b1('0x35')]);_0x22017f['filters']=_[_0x45b1('0x37')](_0x22017f[_0x45b1('0x33')],_0x22017f['query']);_0x50862c[_0x45b1('0x4b')]=_[_0x45b1('0x37')](_0x22017f[_0x45b1('0x33')],qs[_0x45b1('0x38')](_0x57f16e[_0x45b1('0x35')][_0x45b1('0x38')]));_0x50862c[_0x45b1('0x4b')]=_0x50862c[_0x45b1('0x4b')][_0x45b1('0x39')]?_0x50862c[_0x45b1('0x4b')]:_0x22017f[_0x45b1('0x33')];if(_0x57f16e['query'][_0x45b1('0x45')]){_0x50862c[_0x45b1('0x46')]=[{'all':!![]}];}_0x50862c=_['merge']({},_0x50862c,_0x57f16e[_0x45b1('0x43')]);return db[_0x45b1('0x2e')][_0x45b1('0x4c')](_0x50862c)[_0x45b1('0x24')](handleEntityNotFound(_0x331a46,null))[_0x45b1('0x24')](respondWithResult(_0x331a46,null))[_0x45b1('0x49')](handleError(_0x331a46,null));};exports['create']=function(_0x3ad930,_0x2d4126){return db[_0x45b1('0x2e')]['create'](_0x3ad930[_0x45b1('0x4d')],{})[_0x45b1('0x24')](function(_0x17f37c){var _0x5cfbb4=_0x3ad930[_0x45b1('0x4e')][_0x45b1('0x26')]({'plain':!![]});if(!_0x5cfbb4)throw new Error(_0x45b1('0x4f'));if(_0x5cfbb4['role']===_0x45b1('0x4e')){var _0x59fbbe=_0x17f37c['get']({'plain':!![]});var _0x764ae6=_0x45b1('0x27');return db['UserProfileSection'][_0x45b1('0x4c')]({'where':{'name':_0x764ae6,'userProfileId':_0x5cfbb4[_0x45b1('0x50')]},'raw':!![]})[_0x45b1('0x24')](function(_0x464f22){if(_0x464f22&&_0x464f22[_0x45b1('0x51')]===0x0){return db[_0x45b1('0x28')][_0x45b1('0x52')]({'name':_0x59fbbe[_0x45b1('0x2a')],'resourceId':_0x59fbbe['id'],'type':_0x464f22[_0x45b1('0x2a')],'sectionId':_0x464f22['id']},{})[_0x45b1('0x24')](function(){return _0x17f37c;});}else{return _0x17f37c;}})[_0x45b1('0x49')](function(_0x3a182b){logger[_0x45b1('0x29')](_0x45b1('0x53'),_0x3a182b);throw _0x3a182b;});}return _0x17f37c;})['then'](respondWithResult(_0x2d4126,0xc9))[_0x45b1('0x49')](handleError(_0x2d4126,null));};exports['update']=function(_0x4b0ea7,_0x35a64f){if(_0x4b0ea7['body']['id']){delete _0x4b0ea7[_0x45b1('0x4d')]['id'];}return db['AnalyticExtractedReport'][_0x45b1('0x4c')]({'where':{'id':_0x4b0ea7[_0x45b1('0x4a')]['id']}})[_0x45b1('0x24')](handleEntityNotFound(_0x35a64f,null))[_0x45b1('0x24')](saveUpdates(_0x4b0ea7[_0x45b1('0x4d')],null))[_0x45b1('0x24')](respondWithResult(_0x35a64f,null))[_0x45b1('0x49')](handleError(_0x35a64f,null));};exports[_0x45b1('0x25')]=function(_0x2a51e7,_0x5c5285){return db[_0x45b1('0x2e')]['find']({'where':{'id':_0x2a51e7[_0x45b1('0x4a')]['id']}})[_0x45b1('0x24')](handleEntityNotFound(_0x5c5285,null))['then'](removeEntity(_0x5c5285,null))[_0x45b1('0x49')](handleError(_0x5c5285,null));};exports[_0x45b1('0x54')]=function(_0xc87e18,_0x5ea8f9,_0x5e0cb0){return db['AnalyticExtractedReport'][_0x45b1('0x4c')]({'where':{'id':_0xc87e18['params']['id']},'attributes':[_0x45b1('0x2a'),'basename',_0x45b1('0x55'),_0x45b1('0x56')],'raw':!![]})['then'](handleEntityNotFound(_0x5ea8f9,null))[_0x45b1('0x24')](function(_0x1a9f2d){if(_0x1a9f2d){if(!fs['existsSync'](path[_0x45b1('0x57')](config['root'],_0x45b1('0x58'),_0x1a9f2d[_0x45b1('0x55')]))){throw new db[(_0x45b1('0x59'))][(_0x45b1('0x5a'))](_0x45b1('0x5b'));}if(_0xc87e18[_0x45b1('0x35')][_0x45b1('0x5c')]){return _0x5ea8f9[_0x45b1('0x1a')](0xc8);}return _0x5ea8f9[_0x45b1('0x54')](path['join'](config['root'],'server/files/reports',_0x1a9f2d[_0x45b1('0x55')]),util[_0x45b1('0x5d')](_0x45b1('0x5e'),_0x1a9f2d[_0x45b1('0x5f')]||_0x1a9f2d[_0x45b1('0x2a')],_0x1a9f2d[_0x45b1('0x56')]['toLowerCase']()));}})[_0x45b1('0x49')](handleError(_0x5ea8f9,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 24ce7a1..86eee02 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 _0x410d=['rimraf','../../config/environment','./analyticExtractedReport.attributes','AnalyticExtractedReport','lodash','util','api','moment','path'];(function(_0x2ffe2f,_0x5aace9){var _0x315985=function(_0x2257e0){while(--_0x2257e0){_0x2ffe2f['push'](_0x2ffe2f['shift']());}};_0x315985(++_0x5aace9);}(_0x410d,0x187));var _0xd410=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x410d[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xd410('0x0'));var util=require(_0xd410('0x1'));var logger=require('../../config/logger')(_0xd410('0x2'));var moment=require(_0xd410('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd410('0x4'));var rimraf=require(_0xd410('0x5'));var config=require(_0xd410('0x6'));var attributes=require(_0xd410('0x7'));module['exports']=function(_0x5be1ac,_0x24e3bb){return _0x5be1ac['define'](_0xd410('0x8'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb318=['moment','bluebird','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','../../config/logger','api'];(function(_0x5eb0d5,_0x5ce667){var _0x58a70d=function(_0x243309){while(--_0x243309){_0x5eb0d5['push'](_0x5eb0d5['shift']());}};_0x58a70d(++_0x5ce667);}(_0xb318,0x80));var _0x8b31=function(_0x5af383,_0x5e0919){_0x5af383=_0x5af383-0x0;var _0x514abf=_0xb318[_0x5af383];return _0x514abf;};'use strict';var _=require(_0x8b31('0x0'));var util=require(_0x8b31('0x1'));var logger=require(_0x8b31('0x2'))(_0x8b31('0x3'));var moment=require(_0x8b31('0x4'));var BPromise=require(_0x8b31('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8b31('0x6'));var config=require(_0x8b31('0x7'));var attributes=require(_0x8b31('0x8'));module[_0x8b31('0x9')]=function(_0x4b5cff,_0x3637e5){return _0x4b5cff[_0x8b31('0xa')](_0x8b31('0xb'),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 221004f..14af91c 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 _0x8cdf=['request','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4d5d52,_0x544d1c){var _0x2aa066=function(_0x33533b){while(--_0x33533b){_0x4d5d52['push'](_0x4d5d52['shift']());}};_0x2aa066(++_0x544d1c);}(_0x8cdf,0x10d));var _0xf8cd=function(_0x2a62e5,_0x4900b5){_0x2a62e5=_0x2a62e5-0x0;var _0x126b3c=_0x8cdf[_0x2a62e5];return _0x126b3c;};'use strict';var _=require(_0xf8cd('0x0'));var util=require('util');var moment=require(_0xf8cd('0x1'));var BPromise=require(_0xf8cd('0x2'));var rs=require(_0xf8cd('0x3'));var fs=require('fs');var Redis=require(_0xf8cd('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf8cd('0x5'))(_0xf8cd('0x6'));var config=require(_0xf8cd('0x7'));var jayson=require(_0xf8cd('0x8'));var client=jayson[_0xf8cd('0x9')][_0xf8cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xaa9b45,_0x3fe7d0,_0x35bcfc){return new BPromise(function(_0x49379f,_0x5e6c26){return client[_0xf8cd('0xb')](_0xaa9b45,_0x35bcfc)['then'](function(_0x5712b1){logger[_0xf8cd('0xc')](_0xf8cd('0xd'),_0x3fe7d0,'request\x20sent');logger[_0xf8cd('0xe')](_0xf8cd('0xf'),_0x3fe7d0,_0xf8cd('0x10'),JSON['stringify'](_0x5712b1));if(_0x5712b1[_0xf8cd('0x11')]){if(_0x5712b1[_0xf8cd('0x11')]['code']===0x1f4){logger['error'](_0xf8cd('0xd'),_0x3fe7d0,_0x5712b1[_0xf8cd('0x11')]['message']);return _0x5e6c26(_0x5712b1[_0xf8cd('0x11')]['message']);}logger[_0xf8cd('0x11')](_0xf8cd('0xd'),_0x3fe7d0,_0x5712b1[_0xf8cd('0x11')]['message']);return _0x49379f(_0x5712b1[_0xf8cd('0x11')][_0xf8cd('0x12')]);}else{logger[_0xf8cd('0xc')](_0xf8cd('0xd'),_0x3fe7d0,'request\x20sent');_0x49379f(_0x5712b1['result'][_0xf8cd('0x12')]);}})[_0xf8cd('0x13')](function(_0x441268){logger['error'](_0xf8cd('0xd'),_0x3fe7d0,_0x441268);_0x5e6c26(_0x441268);});});} \ No newline at end of file +var _0xc642=['error','AnalyticExtractedReport,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','debug','stringify'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0xc642,0x1a7));var _0x2c64=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xc642[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x2c64('0x0'));var util=require(_0x2c64('0x1'));var moment=require(_0x2c64('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c64('0x3'));var fs=require('fs');var Redis=require(_0x2c64('0x4'));var db=require(_0x2c64('0x5'))['db'];var utils=require(_0x2c64('0x6'));var logger=require(_0x2c64('0x7'))(_0x2c64('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2dddf7,_0x2f13a9,_0x2a5e6b){return new BPromise(function(_0x879cda,_0xc92e18){return client[_0x2c64('0x9')](_0x2dddf7,_0x2a5e6b)[_0x2c64('0xa')](function(_0x2119f0){logger[_0x2c64('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2f13a9,'request\x20sent');logger[_0x2c64('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x2f13a9,'request\x20sent',JSON[_0x2c64('0xd')](_0x2119f0));if(_0x2119f0['error']){if(_0x2119f0[_0x2c64('0xe')]['code']===0x1f4){logger['error'](_0x2c64('0xf'),_0x2f13a9,_0x2119f0[_0x2c64('0xe')][_0x2c64('0x10')]);return _0xc92e18(_0x2119f0[_0x2c64('0xe')][_0x2c64('0x10')]);}logger[_0x2c64('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2f13a9,_0x2119f0['error'][_0x2c64('0x10')]);return _0x879cda(_0x2119f0['error']['message']);}else{logger['info'](_0x2c64('0xf'),_0x2f13a9,_0x2c64('0x11'));_0x879cda(_0x2119f0['result'][_0x2c64('0x10')]);}})[_0x2c64('0x12')](function(_0x566ab5){logger[_0x2c64('0xe')](_0x2c64('0xf'),_0x2f13a9,_0x566ab5);_0xc92e18(_0x566ab5);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 34db31f..8b16819 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 _0x1dda=['create','put','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','/:id','isAuthenticated','post'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x1dda,0x125));var _0xa1dd=function(_0x380e75,_0x486360){_0x380e75=_0x380e75-0x0;var _0x444d96=_0x1dda[_0x380e75];return _0x444d96;};'use strict';var multer=require(_0xa1dd('0x0'));var util=require(_0xa1dd('0x1'));var path=require(_0xa1dd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa1dd('0x3')]();var fs_extra=require(_0xa1dd('0x4'));var auth=require(_0xa1dd('0x5'));var interaction=require(_0xa1dd('0x6'));var config=require(_0xa1dd('0x7'));var controller=require(_0xa1dd('0x8'));router[_0xa1dd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa1dd('0xa'),auth[_0xa1dd('0xb')](),controller['show']);router[_0xa1dd('0x9')]('/:id/download',auth[_0xa1dd('0xb')](),controller['download']);router[_0xa1dd('0xc')]('/',auth['isAuthenticated'](),controller[_0xa1dd('0xd')]);router[_0xa1dd('0xe')]('/:id',auth[_0xa1dd('0xb')](),controller[_0xa1dd('0xf')]);router[_0xa1dd('0x10')](_0xa1dd('0xa'),auth[_0xa1dd('0xb')](),controller[_0xa1dd('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6afc=['./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','create','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6afc,0x1c4));var _0xc6af=function(_0x26e250,_0x12165f){_0x26e250=_0x26e250-0x0;var _0xefcbce=_0x6afc[_0x26e250];return _0xefcbce;};'use strict';var multer=require(_0xc6af('0x0'));var util=require('util');var path=require(_0xc6af('0x1'));var timeout=require(_0xc6af('0x2'));var express=require(_0xc6af('0x3'));var router=express['Router']();var fs_extra=require(_0xc6af('0x4'));var auth=require(_0xc6af('0x5'));var interaction=require(_0xc6af('0x6'));var config=require(_0xc6af('0x7'));var controller=require(_0xc6af('0x8'));router[_0xc6af('0x9')]('/',auth[_0xc6af('0xa')](),controller[_0xc6af('0xb')]);router[_0xc6af('0x9')](_0xc6af('0xc'),auth[_0xc6af('0xa')](),controller[_0xc6af('0xd')]);router['get'](_0xc6af('0xe'),auth[_0xc6af('0xa')](),controller['download']);router[_0xc6af('0xf')]('/',auth[_0xc6af('0xa')](),controller[_0xc6af('0x10')]);router['put'](_0xc6af('0xc'),auth[_0xc6af('0xa')](),controller[_0xc6af('0x11')]);router['delete'](_0xc6af('0xc'),auth[_0xc6af('0xa')](),controller[_0xc6af('0x12')]);module[_0xc6af('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 4e14d61..16b4a14 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 _0xbc6f=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xbc6f,0x6b));var _0xfbc6=function(_0x3e27ba,_0x46b120){_0x3e27ba=_0x3e27ba-0x0;var _0x10b3f2=_0xbc6f[_0x3e27ba];return _0x10b3f2;};'use strict';var Sequelize=require(_0xfbc6('0x0'));module[_0xfbc6('0x1')]={'field':{'type':Sequelize[_0xfbc6('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xfbc6('0x3')]},'format':{'type':Sequelize[_0xfbc6('0x3')]},'groupBy':{'type':Sequelize[_0xfbc6('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xfbc6('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x26a0=['BOOLEAN','exports','TEXT','STRING'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x26a0,0x85));var _0x026a=function(_0x3ec0f0,_0x53d847){_0x3ec0f0=_0x3ec0f0-0x0;var _0x4f0aea=_0x26a0[_0x3ec0f0];return _0x4f0aea;};'use strict';var Sequelize=require('sequelize');module[_0x026a('0x0')]={'field':{'type':Sequelize[_0x026a('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x026a('0x2')]},'format':{'type':Sequelize[_0x026a('0x2')]},'groupBy':{'type':Sequelize[_0x026a('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x026a('0x2')]},'custom':{'type':Sequelize[_0x026a('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 6e75715..db72e96 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 _0xae8a=['squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','apply','reject','save','then','destroy','end','error','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','type','VIRTUAL','options','where','includeAll','findAll','rows','catch','show','length','find','create','body','update','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x5655f7,_0x524f06){var _0x7dd844=function(_0x3309d6){while(--_0x3309d6){_0x5655f7['push'](_0x5655f7['shift']());}};_0x7dd844(++_0x524f06);}(_0xae8a,0x98));var _0xaae8=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xae8a[_0xc6be3a];return _0x56a310;};'use strict';var emlformat=require(_0xaae8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaae8('0x1'));var jsonpatch=require(_0xaae8('0x2'));var rp=require(_0xaae8('0x3'));var moment=require('moment');var BPromise=require(_0xaae8('0x4'));var Mustache=require('mustache');var util=require(_0xaae8('0x5'));var path=require(_0xaae8('0x6'));var sox=require(_0xaae8('0x7'));var csv=require(_0xaae8('0x8'));var ejs=require(_0xaae8('0x9'));var fs=require('fs');var fs_extra=require(_0xaae8('0xa'));var _=require(_0xaae8('0xb'));var squel=require(_0xaae8('0xc'));var crypto=require(_0xaae8('0xd'));var jsforce=require(_0xaae8('0xe'));var deskjs=require(_0xaae8('0xf'));var toCsv=require(_0xaae8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaae8('0x10'));var qs=require(_0xaae8('0x11'));var as=require(_0xaae8('0x12'));var hardwareService=require(_0xaae8('0x13'));var logger=require('../../config/logger')(_0xaae8('0x14'));var utils=require(_0xaae8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xaae8('0x16'));var db=require(_0xaae8('0x17'))['db'];function respondWithStatusCode(_0x44c39c,_0x2a8750){_0x2a8750=_0x2a8750||0xcc;return function(_0x50a7f2){if(_0x50a7f2){return _0x44c39c[_0xaae8('0x18')](_0x2a8750);}return _0x44c39c[_0xaae8('0x19')](_0x2a8750)['end']();};}function respondWithResult(_0x157722,_0x17054b){_0x17054b=_0x17054b||0xc8;return function(_0x5390fa){if(_0x5390fa){return _0x157722[_0xaae8('0x19')](_0x17054b)[_0xaae8('0x1a')](_0x5390fa);}};}function respondWithFilteredResult(_0xfcf988,_0x5c0fbd){return function(_0x265bd5){if(_0x265bd5){var _0x31107d=typeof _0x5c0fbd[_0xaae8('0x1b')]==='undefined'&&typeof _0x5c0fbd[_0xaae8('0x1c')]==='undefined';var _0x5d6142=_0x265bd5[_0xaae8('0x1d')];var _0x2d1fb0=_0x31107d?0x0:_0x5c0fbd[_0xaae8('0x1b')];var _0x540099=_0x31107d?_0x265bd5['count']:_0x5c0fbd[_0xaae8('0x1b')]+_0x5c0fbd['limit'];var _0x2c5103;if(_0x540099>=_0x5d6142){_0x540099=_0x5d6142;_0x2c5103=0xc8;}else{_0x2c5103=0xce;}_0xfcf988['status'](_0x2c5103);return _0xfcf988[_0xaae8('0x1e')]('Content-Range',_0x2d1fb0+'-'+_0x540099+'/'+_0x5d6142)[_0xaae8('0x1a')](_0x265bd5);}return null;};}function patchUpdates(_0x13fdc4){return function(_0x25cb76){try{jsonpatch[_0xaae8('0x1f')](_0x25cb76,_0x13fdc4,!![]);}catch(_0x576d7a){return BPromise[_0xaae8('0x20')](_0x576d7a);}return _0x25cb76[_0xaae8('0x21')]();};}function saveUpdates(_0x43185d,_0x466399){return function(_0x4d84e5){if(_0x4d84e5){return _0x4d84e5['update'](_0x43185d)[_0xaae8('0x22')](function(_0x5f5031){return _0x5f5031;});}return null;};}function removeEntity(_0x2feb92,_0x12e8d1){return function(_0x11a626){if(_0x11a626){return _0x11a626[_0xaae8('0x23')]()['then'](function(){_0x2feb92[_0xaae8('0x19')](0xcc)[_0xaae8('0x24')]();});}};}function handleEntityNotFound(_0x3d6116,_0x53eb7c){return function(_0x54e10a){if(!_0x54e10a){_0x3d6116[_0xaae8('0x18')](0x194);}return _0x54e10a;};}function handleError(_0x3a430a,_0x4f6439){_0x4f6439=_0x4f6439||0x1f4;return function(_0x16c420){logger[_0xaae8('0x25')](_0x16c420['stack']);if(_0x16c420['name']){delete _0x16c420['name'];}_0x3a430a[_0xaae8('0x19')](_0x4f6439)[_0xaae8('0x26')](_0x16c420);};}exports[_0xaae8('0x27')]=function(_0x589cf2,_0x510af2){var _0x377abe={},_0x44ae46={},_0x336d57={'count':0x0,'rows':[]};var _0x2d71d2=_[_0xaae8('0x28')](db[_0xaae8('0x29')][_0xaae8('0x2a')],function(_0x5c4e91){return{'name':_0x5c4e91[_0xaae8('0x2b')],'type':_0x5c4e91['type'][_0xaae8('0x2c')]};});_0x44ae46[_0xaae8('0x2d')]=_['map'](_0x2d71d2,_0xaae8('0x2e'));_0x44ae46[_0xaae8('0x2f')]=_[_0xaae8('0x30')](_0x589cf2[_0xaae8('0x2f')]);_0x44ae46[_0xaae8('0x31')]=_[_0xaae8('0x32')](_0x44ae46[_0xaae8('0x2d')],_0x44ae46['query']);_0x377abe[_0xaae8('0x33')]=_[_0xaae8('0x32')](_0x44ae46[_0xaae8('0x2d')],qs[_0xaae8('0x34')](_0x589cf2[_0xaae8('0x2f')][_0xaae8('0x34')]));_0x377abe['attributes']=_0x377abe[_0xaae8('0x33')]['length']?_0x377abe[_0xaae8('0x33')]:_0x44ae46[_0xaae8('0x2d')];if(!_0x589cf2[_0xaae8('0x2f')][_0xaae8('0x35')](_0xaae8('0x36'))){_0x377abe[_0xaae8('0x1c')]=qs['limit'](_0x589cf2[_0xaae8('0x2f')]['limit']);_0x377abe[_0xaae8('0x1b')]=qs[_0xaae8('0x1b')](_0x589cf2[_0xaae8('0x2f')][_0xaae8('0x1b')]);}_0x377abe['order']=qs[_0xaae8('0x37')](_0x589cf2[_0xaae8('0x2f')]['sort']);_0x377abe['where']=qs[_0xaae8('0x31')](_[_0xaae8('0x38')](_0x589cf2[_0xaae8('0x2f')],_0x44ae46[_0xaae8('0x31')]),_0x2d71d2);if(_0x589cf2[_0xaae8('0x2f')][_0xaae8('0x39')]){_0x377abe['where']=_[_0xaae8('0x3a')](_0x377abe['where'],{'$or':_[_0xaae8('0x28')](_0x2d71d2,function(_0x5328a6){if(_0x5328a6[_0xaae8('0x3b')]!==_0xaae8('0x3c')){var _0x50a694={};_0x50a694[_0x5328a6['name']]={'$like':'%'+_0x589cf2['query'][_0xaae8('0x39')]+'%'};return _0x50a694;}})});}_0x377abe=_['merge']({},_0x377abe,_0x589cf2[_0xaae8('0x3d')]);var _0x261b98={'where':_0x377abe[_0xaae8('0x3e')]};return db[_0xaae8('0x29')]['count'](_0x261b98)[_0xaae8('0x22')](function(_0x129bc3){_0x336d57[_0xaae8('0x1d')]=_0x129bc3;if(_0x589cf2[_0xaae8('0x2f')][_0xaae8('0x3f')]){_0x377abe['include']=[{'all':!![]}];}return db[_0xaae8('0x29')][_0xaae8('0x40')](_0x377abe);})[_0xaae8('0x22')](function(_0x589fe3){_0x336d57[_0xaae8('0x41')]=_0x589fe3;return _0x336d57;})[_0xaae8('0x22')](respondWithFilteredResult(_0x510af2,_0x377abe))[_0xaae8('0x42')](handleError(_0x510af2,null));};exports[_0xaae8('0x43')]=function(_0x50f287,_0x46e4ee){var _0x13cf90={'raw':![],'where':{'id':_0x50f287['params']['id']}},_0x2e0e3b={};_0x2e0e3b[_0xaae8('0x2d')]=_['keys'](db[_0xaae8('0x29')][_0xaae8('0x2a')]);_0x2e0e3b[_0xaae8('0x2f')]=_[_0xaae8('0x30')](_0x50f287[_0xaae8('0x2f')]);_0x2e0e3b['filters']=_['intersection'](_0x2e0e3b[_0xaae8('0x2d')],_0x2e0e3b[_0xaae8('0x2f')]);_0x13cf90['attributes']=_[_0xaae8('0x32')](_0x2e0e3b['model'],qs[_0xaae8('0x34')](_0x50f287[_0xaae8('0x2f')][_0xaae8('0x34')]));_0x13cf90['attributes']=_0x13cf90[_0xaae8('0x33')][_0xaae8('0x44')]?_0x13cf90['attributes']:_0x2e0e3b[_0xaae8('0x2d')];if(_0x50f287[_0xaae8('0x2f')][_0xaae8('0x3f')]){_0x13cf90['include']=[{'all':!![]}];}_0x13cf90=_[_0xaae8('0x3a')]({},_0x13cf90,_0x50f287[_0xaae8('0x3d')]);return db[_0xaae8('0x29')][_0xaae8('0x45')](_0x13cf90)['then'](handleEntityNotFound(_0x46e4ee,null))[_0xaae8('0x22')](respondWithResult(_0x46e4ee,null))[_0xaae8('0x42')](handleError(_0x46e4ee,null));};exports['create']=function(_0x3b7f44,_0x35d844){return db[_0xaae8('0x29')][_0xaae8('0x46')](_0x3b7f44[_0xaae8('0x47')],{})[_0xaae8('0x22')](respondWithResult(_0x35d844,0xc9))[_0xaae8('0x42')](handleError(_0x35d844,null));};exports['bulkCreate']=function(_0x2aa6e5,_0x5c20f1){return db['AnalyticFieldReport']['bulkCreate'](_0x2aa6e5[_0xaae8('0x47')],{'raw':![],'individualHooks':!![]})[_0xaae8('0x22')](respondWithResult(_0x5c20f1,0xc9))[_0xaae8('0x42')](handleError(_0x5c20f1,null));};exports[_0xaae8('0x48')]=function(_0x51692a,_0x2f6d17){if(_0x51692a[_0xaae8('0x47')]['id']){delete _0x51692a[_0xaae8('0x47')]['id'];}return db['AnalyticFieldReport'][_0xaae8('0x45')]({'where':{'id':_0x51692a[_0xaae8('0x49')]['id']}})[_0xaae8('0x22')](handleEntityNotFound(_0x2f6d17,null))[_0xaae8('0x22')](saveUpdates(_0x51692a[_0xaae8('0x47')],null))[_0xaae8('0x22')](respondWithResult(_0x2f6d17,null))[_0xaae8('0x42')](handleError(_0x2f6d17,null));};exports['destroy']=function(_0xb70f27,_0x320dd6){return db['AnalyticFieldReport'][_0xaae8('0x45')]({'where':{'id':_0xb70f27[_0xaae8('0x49')]['id']}})[_0xaae8('0x22')](handleEntityNotFound(_0x320dd6,null))[_0xaae8('0x22')](removeEntity(_0x320dd6,null))[_0xaae8('0x42')](handleError(_0x320dd6,null));};exports[_0xaae8('0x4a')]=function(_0x3319bf,_0x59a46c){return db[_0xaae8('0x29')][_0xaae8('0x23')]({'where':{'id':_0x3319bf[_0xaae8('0x2f')][_0xaae8('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0xaae8('0x22')](respondWithResult(_0x59a46c,0xcc))[_0xaae8('0x42')](handleError(_0x59a46c,null));};exports[_0xaae8('0x4c')]=function(_0x52b68a,_0x32e72e,_0x12478e){return db[_0xaae8('0x4d')][_0xaae8('0x4e')]({'where':{'id':_0x52b68a['params']['id']}})[_0xaae8('0x22')](handleEntityNotFound(_0x32e72e,null))[_0xaae8('0x22')](function(_0x46723c){if(_0x46723c){return db[_0xaae8('0x4f')][_0xaae8('0x50')](function(_0x193505){return db[_0xaae8('0x29')][_0xaae8('0x23')]({'where':{'CustomReportId':_0x52b68a['params']['id']},'transaction':_0x193505})[_0xaae8('0x22')](function(_0x3fe172){var _0x28118c=_[_0xaae8('0x28')](_0x52b68a[_0xaae8('0x47')],function(_0x2cc7ea){delete _0x2cc7ea['id'];_0x2cc7ea['CustomReportId']=_0x52b68a['params']['id'];return _0x2cc7ea;});return db['AnalyticFieldReport'][_0xaae8('0x51')](_0x28118c,{'transaction':_0x193505});});})[_0xaae8('0x22')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x52b68a[_0xaae8('0x49')]['id']}});});}})[_0xaae8('0x22')](respondWithResult(_0x32e72e,null))[_0xaae8('0x42')](handleError(_0x32e72e,null));}; \ No newline at end of file +var _0x2599=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','bulkCreate','bulkDestroy','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','type','model','query','filters','intersection','attributes','fields','length'];(function(_0x5d1e11,_0x1590a5){var _0x5b0718=function(_0x3e9ef3){while(--_0x3e9ef3){_0x5d1e11['push'](_0x5d1e11['shift']());}};_0x5b0718(++_0x1590a5);}(_0x2599,0x117));var _0x9259=function(_0x2a9c15,_0x43ae27){_0x2a9c15=_0x2a9c15-0x0;var _0x16ef80=_0x2599[_0x2a9c15];return _0x16ef80;};'use strict';var emlformat=require(_0x9259('0x0'));var rimraf=require(_0x9259('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9259('0x2'));var rp=require(_0x9259('0x3'));var moment=require(_0x9259('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9259('0x5'));var util=require(_0x9259('0x6'));var path=require(_0x9259('0x7'));var sox=require(_0x9259('0x8'));var csv=require(_0x9259('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9259('0xa'));var _=require('lodash');var squel=require(_0x9259('0xb'));var crypto=require('crypto');var jsforce=require(_0x9259('0xc'));var deskjs=require(_0x9259('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9259('0xe'));var Papa=require(_0x9259('0xf'));var Redis=require(_0x9259('0x10'));var authService=require(_0x9259('0x11'));var qs=require(_0x9259('0x12'));var as=require(_0x9259('0x13'));var hardwareService=require(_0x9259('0x14'));var logger=require(_0x9259('0x15'))(_0x9259('0x16'));var utils=require('../../config/utils');var config=require(_0x9259('0x17'));var licenseUtil=require(_0x9259('0x18'));var db=require(_0x9259('0x19'))['db'];function respondWithStatusCode(_0x28cc53,_0x2d0fd5){_0x2d0fd5=_0x2d0fd5||0xcc;return function(_0x24316b){if(_0x24316b){return _0x28cc53[_0x9259('0x1a')](_0x2d0fd5);}return _0x28cc53[_0x9259('0x1b')](_0x2d0fd5)['end']();};}function respondWithResult(_0x398c6b,_0x44e7d1){_0x44e7d1=_0x44e7d1||0xc8;return function(_0x37adef){if(_0x37adef){return _0x398c6b[_0x9259('0x1b')](_0x44e7d1)['json'](_0x37adef);}};}function respondWithFilteredResult(_0x260809,_0x2665d8){return function(_0x5eee0a){if(_0x5eee0a){var _0xf1fa85=typeof _0x2665d8[_0x9259('0x1c')]===_0x9259('0x1d')&&typeof _0x2665d8[_0x9259('0x1e')]===_0x9259('0x1d');var _0x3c2bfe=_0x5eee0a[_0x9259('0x1f')];var _0x5ee642=_0xf1fa85?0x0:_0x2665d8[_0x9259('0x1c')];var _0x5025bd=_0xf1fa85?_0x5eee0a[_0x9259('0x1f')]:_0x2665d8['offset']+_0x2665d8[_0x9259('0x1e')];var _0x36c33c;if(_0x5025bd>=_0x3c2bfe){_0x5025bd=_0x3c2bfe;_0x36c33c=0xc8;}else{_0x36c33c=0xce;}_0x260809[_0x9259('0x1b')](_0x36c33c);return _0x260809[_0x9259('0x20')]('Content-Range',_0x5ee642+'-'+_0x5025bd+'/'+_0x3c2bfe)[_0x9259('0x21')](_0x5eee0a);}return null;};}function patchUpdates(_0x3bb529){return function(_0x27c900){try{jsonpatch[_0x9259('0x22')](_0x27c900,_0x3bb529,!![]);}catch(_0x4292b7){return BPromise[_0x9259('0x23')](_0x4292b7);}return _0x27c900[_0x9259('0x24')]();};}function saveUpdates(_0x352711,_0x8672f5){return function(_0x40af20){if(_0x40af20){return _0x40af20[_0x9259('0x25')](_0x352711)[_0x9259('0x26')](function(_0x31eb12){return _0x31eb12;});}return null;};}function removeEntity(_0x1b239d,_0x2b43bb){return function(_0x5427e6){if(_0x5427e6){return _0x5427e6[_0x9259('0x27')]()[_0x9259('0x26')](function(){_0x1b239d[_0x9259('0x1b')](0xcc)[_0x9259('0x28')]();});}};}function handleEntityNotFound(_0x115383,_0x58f733){return function(_0x90e5e3){if(!_0x90e5e3){_0x115383[_0x9259('0x1a')](0x194);}return _0x90e5e3;};}function handleError(_0x2c2ca3,_0xa0f9d5){_0xa0f9d5=_0xa0f9d5||0x1f4;return function(_0x5ced0b){logger[_0x9259('0x29')](_0x5ced0b[_0x9259('0x2a')]);if(_0x5ced0b[_0x9259('0x2b')]){delete _0x5ced0b[_0x9259('0x2b')];}_0x2c2ca3[_0x9259('0x1b')](_0xa0f9d5)[_0x9259('0x2c')](_0x5ced0b);};}exports[_0x9259('0x2d')]=function(_0x351645,_0x4f359a){var _0x42eaa1={},_0x2de092={},_0x4ac665={'count':0x0,'rows':[]};var _0x5c19ce=_[_0x9259('0x2e')](db[_0x9259('0x2f')][_0x9259('0x30')],function(_0x17a94c){return{'name':_0x17a94c['fieldName'],'type':_0x17a94c[_0x9259('0x31')]['key']};});_0x2de092[_0x9259('0x32')]=_['map'](_0x5c19ce,_0x9259('0x2b'));_0x2de092[_0x9259('0x33')]=_['keys'](_0x351645[_0x9259('0x33')]);_0x2de092[_0x9259('0x34')]=_[_0x9259('0x35')](_0x2de092['model'],_0x2de092[_0x9259('0x33')]);_0x42eaa1[_0x9259('0x36')]=_[_0x9259('0x35')](_0x2de092['model'],qs[_0x9259('0x37')](_0x351645[_0x9259('0x33')][_0x9259('0x37')]));_0x42eaa1[_0x9259('0x36')]=_0x42eaa1[_0x9259('0x36')][_0x9259('0x38')]?_0x42eaa1['attributes']:_0x2de092[_0x9259('0x32')];if(!_0x351645['query'][_0x9259('0x39')](_0x9259('0x3a'))){_0x42eaa1[_0x9259('0x1e')]=qs['limit'](_0x351645[_0x9259('0x33')][_0x9259('0x1e')]);_0x42eaa1[_0x9259('0x1c')]=qs[_0x9259('0x1c')](_0x351645[_0x9259('0x33')][_0x9259('0x1c')]);}_0x42eaa1[_0x9259('0x3b')]=qs[_0x9259('0x3c')](_0x351645[_0x9259('0x33')][_0x9259('0x3c')]);_0x42eaa1[_0x9259('0x3d')]=qs[_0x9259('0x34')](_[_0x9259('0x3e')](_0x351645[_0x9259('0x33')],_0x2de092[_0x9259('0x34')]),_0x5c19ce);if(_0x351645['query'][_0x9259('0x3f')]){_0x42eaa1[_0x9259('0x3d')]=_[_0x9259('0x40')](_0x42eaa1[_0x9259('0x3d')],{'$or':_[_0x9259('0x2e')](_0x5c19ce,function(_0x4d176f){if(_0x4d176f['type']!==_0x9259('0x41')){var _0x1a7486={};_0x1a7486[_0x4d176f[_0x9259('0x2b')]]={'$like':'%'+_0x351645[_0x9259('0x33')]['filter']+'%'};return _0x1a7486;}})});}_0x42eaa1=_[_0x9259('0x40')]({},_0x42eaa1,_0x351645[_0x9259('0x42')]);var _0x16cf96={'where':_0x42eaa1['where']};return db[_0x9259('0x2f')][_0x9259('0x1f')](_0x16cf96)[_0x9259('0x26')](function(_0x4db055){_0x4ac665[_0x9259('0x1f')]=_0x4db055;if(_0x351645[_0x9259('0x33')][_0x9259('0x43')]){_0x42eaa1[_0x9259('0x44')]=[{'all':!![]}];}return db[_0x9259('0x2f')][_0x9259('0x45')](_0x42eaa1);})[_0x9259('0x26')](function(_0x6214de){_0x4ac665[_0x9259('0x46')]=_0x6214de;return _0x4ac665;})['then'](respondWithFilteredResult(_0x4f359a,_0x42eaa1))[_0x9259('0x47')](handleError(_0x4f359a,null));};exports['show']=function(_0xa8179c,_0x5c3b0d){var _0x44febc={'raw':![],'where':{'id':_0xa8179c[_0x9259('0x48')]['id']}},_0x141273={};_0x141273[_0x9259('0x32')]=_[_0x9259('0x49')](db[_0x9259('0x2f')][_0x9259('0x30')]);_0x141273['query']=_['keys'](_0xa8179c[_0x9259('0x33')]);_0x141273[_0x9259('0x34')]=_['intersection'](_0x141273[_0x9259('0x32')],_0x141273['query']);_0x44febc[_0x9259('0x36')]=_[_0x9259('0x35')](_0x141273[_0x9259('0x32')],qs['fields'](_0xa8179c[_0x9259('0x33')]['fields']));_0x44febc[_0x9259('0x36')]=_0x44febc[_0x9259('0x36')][_0x9259('0x38')]?_0x44febc[_0x9259('0x36')]:_0x141273[_0x9259('0x32')];if(_0xa8179c[_0x9259('0x33')][_0x9259('0x43')]){_0x44febc[_0x9259('0x44')]=[{'all':!![]}];}_0x44febc=_[_0x9259('0x40')]({},_0x44febc,_0xa8179c[_0x9259('0x42')]);return db[_0x9259('0x2f')][_0x9259('0x4a')](_0x44febc)['then'](handleEntityNotFound(_0x5c3b0d,null))['then'](respondWithResult(_0x5c3b0d,null))[_0x9259('0x47')](handleError(_0x5c3b0d,null));};exports[_0x9259('0x4b')]=function(_0x5cae1c,_0x2f1a44){return db[_0x9259('0x2f')][_0x9259('0x4b')](_0x5cae1c[_0x9259('0x4c')],{})[_0x9259('0x26')](respondWithResult(_0x2f1a44,0xc9))[_0x9259('0x47')](handleError(_0x2f1a44,null));};exports['bulkCreate']=function(_0x378591,_0x124b8a){return db[_0x9259('0x2f')][_0x9259('0x4d')](_0x378591[_0x9259('0x4c')],{'raw':![],'individualHooks':!![]})[_0x9259('0x26')](respondWithResult(_0x124b8a,0xc9))['catch'](handleError(_0x124b8a,null));};exports[_0x9259('0x25')]=function(_0x2e7e4e,_0x3f1646){if(_0x2e7e4e[_0x9259('0x4c')]['id']){delete _0x2e7e4e[_0x9259('0x4c')]['id'];}return db[_0x9259('0x2f')][_0x9259('0x4a')]({'where':{'id':_0x2e7e4e[_0x9259('0x48')]['id']}})[_0x9259('0x26')](handleEntityNotFound(_0x3f1646,null))['then'](saveUpdates(_0x2e7e4e[_0x9259('0x4c')],null))[_0x9259('0x26')](respondWithResult(_0x3f1646,null))[_0x9259('0x47')](handleError(_0x3f1646,null));};exports[_0x9259('0x27')]=function(_0x16b63c,_0x4fbafc){return db['AnalyticFieldReport']['find']({'where':{'id':_0x16b63c[_0x9259('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fbafc,null))[_0x9259('0x26')](removeEntity(_0x4fbafc,null))[_0x9259('0x47')](handleError(_0x4fbafc,null));};exports[_0x9259('0x4e')]=function(_0xd4e11f,_0x3311fc){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0xd4e11f[_0x9259('0x33')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3311fc,0xcc))[_0x9259('0x47')](handleError(_0x3311fc,null));};exports['addFields']=function(_0x108774,_0x2b978f,_0x52a52d){return db[_0x9259('0x4f')][_0x9259('0x50')]({'where':{'id':_0x108774[_0x9259('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b978f,null))[_0x9259('0x26')](function(_0x296b00){if(_0x296b00){return db[_0x9259('0x51')][_0x9259('0x52')](function(_0x2b57b1){return db[_0x9259('0x2f')]['destroy']({'where':{'CustomReportId':_0x108774['params']['id']},'transaction':_0x2b57b1})['then'](function(_0x22fc1e){var _0x14447f=_[_0x9259('0x2e')](_0x108774[_0x9259('0x4c')],function(_0x593a1c){delete _0x593a1c['id'];_0x593a1c[_0x9259('0x53')]=_0x108774['params']['id'];return _0x593a1c;});return db['AnalyticFieldReport'][_0x9259('0x4d')](_0x14447f,{'transaction':_0x2b57b1});});})[_0x9259('0x26')](function(){return db['AnalyticFieldReport'][_0x9259('0x45')]({'where':{'CustomReportId':_0x108774['params']['id']}});});}})[_0x9259('0x26')](respondWithResult(_0x2b978f,null))['catch'](handleError(_0x2b978f,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index d3e188e..3b63b5c 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 _0x1d54=['AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','../../config/environment','./analyticFieldReport.attributes'];(function(_0x5b9986,_0x5d376a){var _0x2c3085=function(_0x1e0f8b){while(--_0x1e0f8b){_0x5b9986['push'](_0x5b9986['shift']());}};_0x2c3085(++_0x5d376a);}(_0x1d54,0xda));var _0x41d5=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0x1d54[_0x56e4e7];return _0x383618;};'use strict';var _=require(_0x41d5('0x0'));var util=require('util');var logger=require(_0x41d5('0x1'))(_0x41d5('0x2'));var moment=require(_0x41d5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x41d5('0x4'));var attributes=require(_0x41d5('0x5'));module['exports']=function(_0x61f68a,_0x55d016){return _0x61f68a['define'](_0x41d5('0x6'),attributes,{'tableName':_0x41d5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05d6=['request-promise','rimraf','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','bluebird'];(function(_0x155f98,_0x3ad2c3){var _0x1f3c41=function(_0x8147ed){while(--_0x8147ed){_0x155f98['push'](_0x155f98['shift']());}};_0x1f3c41(++_0x3ad2c3);}(_0x05d6,0xcb));var _0x605d=function(_0x2b3bc9,_0x310614){_0x2b3bc9=_0x2b3bc9-0x0;var _0x3d998c=_0x05d6[_0x2b3bc9];return _0x3d998c;};'use strict';var _=require(_0x605d('0x0'));var util=require(_0x605d('0x1'));var logger=require(_0x605d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x605d('0x3'));var rp=require(_0x605d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x605d('0x5'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x387fcd,_0xa426c3){return _0x387fcd[_0x605d('0x6')](_0x605d('0x7'),attributes,{'tableName':_0x605d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 6538665..ba2e52d 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 _0x9bc9=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0x316e2b,_0x40efd7){var _0x2e4809=function(_0x145130){while(--_0x145130){_0x316e2b['push'](_0x316e2b['shift']());}};_0x2e4809(++_0x40efd7);}(_0x9bc9,0x8c));var _0x99bc=function(_0x43a280,_0x4fddf9){_0x43a280=_0x43a280-0x0;var _0x13ed44=_0x9bc9[_0x43a280];return _0x13ed44;};'use strict';var _=require('lodash');var util=require(_0x99bc('0x0'));var moment=require(_0x99bc('0x1'));var BPromise=require(_0x99bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99bc('0x3'));var db=require(_0x99bc('0x4'))['db'];var utils=require(_0x99bc('0x5'));var logger=require(_0x99bc('0x6'))('rpc');var config=require(_0x99bc('0x7'));var jayson=require(_0x99bc('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ac38e,_0x5aca3a,_0x41d01f){return new BPromise(function(_0x19f5c2,_0x3e25a1){return client[_0x99bc('0x9')](_0x5ac38e,_0x41d01f)['then'](function(_0x56fdfd){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x5aca3a,_0x99bc('0xa'));logger[_0x99bc('0xb')](_0x99bc('0xc'),_0x5aca3a,_0x99bc('0xa'),JSON['stringify'](_0x56fdfd));if(_0x56fdfd[_0x99bc('0xd')]){if(_0x56fdfd[_0x99bc('0xd')][_0x99bc('0xe')]===0x1f4){logger[_0x99bc('0xd')](_0x99bc('0xf'),_0x5aca3a,_0x56fdfd[_0x99bc('0xd')][_0x99bc('0x10')]);return _0x3e25a1(_0x56fdfd['error'][_0x99bc('0x10')]);}logger['error'](_0x99bc('0xf'),_0x5aca3a,_0x56fdfd[_0x99bc('0xd')][_0x99bc('0x10')]);return _0x19f5c2(_0x56fdfd[_0x99bc('0xd')]['message']);}else{logger[_0x99bc('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5aca3a,'request\x20sent');_0x19f5c2(_0x56fdfd[_0x99bc('0x12')][_0x99bc('0x10')]);}})[_0x99bc('0x13')](function(_0x17c08c){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x5aca3a,_0x17c08c);_0x3e25a1(_0x17c08c);});});} \ No newline at end of file +var _0xc12a=['then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xc12a,0x1c1));var _0xac12=function(_0x486ace,_0x2acf99){_0x486ace=_0x486ace-0x0;var _0x236c9b=_0xc12a[_0x486ace];return _0x236c9b;};'use strict';var _=require(_0xac12('0x0'));var util=require(_0xac12('0x1'));var moment=require('moment');var BPromise=require(_0xac12('0x2'));var rs=require(_0xac12('0x3'));var fs=require('fs');var Redis=require(_0xac12('0x4'));var db=require(_0xac12('0x5'))['db'];var utils=require(_0xac12('0x6'));var logger=require(_0xac12('0x7'))(_0xac12('0x8'));var config=require('../../config/environment');var jayson=require(_0xac12('0x9'));var client=jayson[_0xac12('0xa')][_0xac12('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dc4ab,_0x59110f,_0x2c6f8b){return new BPromise(function(_0x2d52eb,_0x5ba157){return client[_0xac12('0xc')](_0x4dc4ab,_0x2c6f8b)[_0xac12('0xd')](function(_0x4ef836){logger[_0xac12('0xe')](_0xac12('0xf'),_0x59110f,_0xac12('0x10'));logger['debug'](_0xac12('0x11'),_0x59110f,_0xac12('0x10'),JSON[_0xac12('0x12')](_0x4ef836));if(_0x4ef836[_0xac12('0x13')]){if(_0x4ef836['error']['code']===0x1f4){logger['error'](_0xac12('0xf'),_0x59110f,_0x4ef836[_0xac12('0x13')][_0xac12('0x14')]);return _0x5ba157(_0x4ef836['error'][_0xac12('0x14')]);}logger['error'](_0xac12('0xf'),_0x59110f,_0x4ef836[_0xac12('0x13')][_0xac12('0x14')]);return _0x2d52eb(_0x4ef836['error'][_0xac12('0x14')]);}else{logger[_0xac12('0xe')](_0xac12('0xf'),_0x59110f,_0xac12('0x10'));_0x2d52eb(_0x4ef836['result'][_0xac12('0x14')]);}})[_0xac12('0x15')](function(_0x4bf0ab){logger[_0xac12('0x13')](_0xac12('0xf'),_0x59110f,_0x4bf0ab);_0x5ba157(_0x4bf0ab);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index da1f792..07b4b08 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(_0x190323,_0x1f88c5){var _0xfa5218=function(_0x27d5cb){while(--_0x27d5cb){_0x190323['push'](_0x190323['shift']());}};_0xfa5218(++_0x1f88c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x2ff872,_0x13836d){var _0x40e5c4=function(_0x20c5ee){while(--_0x20c5ee){_0x2ff872['push'](_0x2ff872['shift']());}};_0x40e5c4(++_0x13836d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 11b269d..6ab5a05 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 _0xcff8=['STRING','name','TEXT','sequelize'];(function(_0x29d9d5,_0x5a1bd8){var _0x1be395=function(_0x54e84f){while(--_0x54e84f){_0x29d9d5['push'](_0x29d9d5['shift']());}};_0x1be395(++_0x5a1bd8);}(_0xcff8,0x14b));var _0x8cff=function(_0xf29500,_0x445dbb){_0xf29500=_0xf29500-0x0;var _0x279d06=_0xcff8[_0xf29500];return _0x279d06;};'use strict';var Sequelize=require(_0x8cff('0x0'));module['exports']={'name':{'type':Sequelize[_0x8cff('0x1')],'allowNull':![],'unique':_0x8cff('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x8cff('0x3')]},'description':{'type':Sequelize[_0x8cff('0x1')]}}; \ No newline at end of file +var _0x180f=['exports','name','STRING','sequelize'];(function(_0x321728,_0x1fbc48){var _0x211876=function(_0x5bf9fc){while(--_0x5bf9fc){_0x321728['push'](_0x321728['shift']());}};_0x211876(++_0x1fbc48);}(_0x180f,0xf3));var _0xf180=function(_0x3a19d4,_0x3f19a4){_0x3a19d4=_0x3a19d4-0x0;var _0x5b858b=_0x180f[_0x3a19d4];return _0x5b858b;};'use strict';var Sequelize=require(_0xf180('0x0'));module[_0xf180('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf180('0x2')},'table':{'type':Sequelize[_0xf180('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xf180('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index ca4f5a9..c16798e 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 _0x00bb=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','destroy','get','Metrics','then','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x30558b,_0x5b1b57){var _0x3c3eb8=function(_0x40c21){while(--_0x40c21){_0x30558b['push'](_0x30558b['shift']());}};_0x3c3eb8(++_0x5b1b57);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x00bb[_0x1e7b16];return _0x37fadc;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){var _0x44efe5=_0x3ab3cc[_0xb00b('0x1f')]({'plain':!![]});var _0x3c9500=_0xb00b('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c9500,'resourceId':_0x44efe5['id']}})[_0xb00b('0x21')](function(){return _0x3ab3cc;});})['then'](function(){_0x2896d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ac55,_0x73b6b0){return function(_0x2592cf){if(!_0x2592cf){_0x16ac55[_0xb00b('0x15')](0x194);}return _0x2592cf;};}function handleError(_0x1f14fa,_0x197379){_0x197379=_0x197379||0x1f4;return function(_0x15d3b9){logger['error'](_0x15d3b9[_0xb00b('0x22')]);if(_0x15d3b9['name']){delete _0x15d3b9[_0xb00b('0x23')];}_0x1f14fa[_0xb00b('0x16')](_0x197379)[_0xb00b('0x24')](_0x15d3b9);};}exports['index']=function(_0x2fc11a,_0x280ed3){var _0x16fbd5={},_0x183233={},_0x303625={'count':0x0,'rows':[]};var _0x2b9824=_[_0xb00b('0x25')](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x54e247){return{'name':_0x54e247[_0xb00b('0x28')],'type':_0x54e247[_0xb00b('0x29')]['key']};});_0x183233[_0xb00b('0x2a')]=_[_0xb00b('0x25')](_0x2b9824,'name');_0x183233[_0xb00b('0x2b')]=_['keys'](_0x2fc11a[_0xb00b('0x2b')]);_0x183233[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x183233[_0xb00b('0x2a')],_0x183233[_0xb00b('0x2b')]);_0x16fbd5[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x183233['model'],qs['fields'](_0x2fc11a['query'][_0xb00b('0x2f')]));_0x16fbd5[_0xb00b('0x2e')]=_0x16fbd5[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x16fbd5['attributes']:_0x183233[_0xb00b('0x2a')];if(!_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x16fbd5[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x16fbd5['offset']=qs['offset'](_0x2fc11a[_0xb00b('0x2b')]['offset']);}_0x16fbd5[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x34')]);_0x16fbd5[_0xb00b('0x35')]=qs[_0xb00b('0x2c')](_[_0xb00b('0x36')](_0x2fc11a['query'],_0x183233[_0xb00b('0x2c')]),_0x2b9824);if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x16fbd5[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x16fbd5[_0xb00b('0x35')],{'$or':_['map'](_0x2b9824,function(_0x36980a){if(_0x36980a[_0xb00b('0x29')]!=='VIRTUAL'){var _0x17ff34={};_0x17ff34[_0x36980a[_0xb00b('0x23')]]={'$like':'%'+_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]+'%'};return _0x17ff34;}})});}_0x16fbd5=_[_0xb00b('0x38')]({},_0x16fbd5,_0x2fc11a['options']);var _0x14ff6a={'where':_0x16fbd5[_0xb00b('0x35')]};return db[_0xb00b('0x26')][_0xb00b('0x39')](_0x14ff6a)['then'](function(_0x4867fe){_0x303625[_0xb00b('0x39')]=_0x4867fe;if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x16fbd5[_0xb00b('0x3b')]=[{'all':!![]}];}return db[_0xb00b('0x26')][_0xb00b('0x3c')](_0x16fbd5);})[_0xb00b('0x21')](function(_0x493841){_0x303625[_0xb00b('0x3d')]=_0x493841;return _0x303625;})[_0xb00b('0x21')](respondWithFilteredResult(_0x280ed3,_0x16fbd5))[_0xb00b('0x3e')](handleError(_0x280ed3,null));};exports[_0xb00b('0x3f')]=function(_0x302ded,_0x1dc4c5){var _0x2e3d83={'raw':!![],'where':{'id':_0x302ded[_0xb00b('0x40')]['id']}},_0x974a29={};_0x974a29[_0xb00b('0x2a')]=_[_0xb00b('0x41')](db[_0xb00b('0x26')]['rawAttributes']);_0x974a29[_0xb00b('0x2b')]=_[_0xb00b('0x41')](_0x302ded[_0xb00b('0x2b')]);_0x974a29[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],_0x974a29[_0xb00b('0x2b')]);_0x2e3d83[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],qs[_0xb00b('0x2f')](_0x302ded[_0xb00b('0x2b')]['fields']));_0x2e3d83['attributes']=_0x2e3d83['attributes'][_0xb00b('0x30')]?_0x2e3d83[_0xb00b('0x2e')]:_0x974a29['model'];if(_0x302ded[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x2e3d83[_0xb00b('0x3b')]=[{'all':!![]}];}_0x2e3d83=_[_0xb00b('0x38')]({},_0x2e3d83,_0x302ded['options']);return db['AnalyticMetric'][_0xb00b('0x42')](_0x2e3d83)[_0xb00b('0x21')](handleEntityNotFound(_0x1dc4c5,null))['then'](respondWithResult(_0x1dc4c5,null))['catch'](handleError(_0x1dc4c5,null));};exports[_0xb00b('0x43')]=function(_0x3a205d,_0x4e0be4){return db[_0xb00b('0x26')]['create'](_0x3a205d['body'],{})['then'](function(_0x465d90){var _0x481515=_0x3a205d[_0xb00b('0x44')][_0xb00b('0x1f')]({'plain':!![]});if(!_0x481515)throw new Error(_0xb00b('0x45'));if(_0x481515[_0xb00b('0x46')]===_0xb00b('0x44')){var _0xda60ca=_0x465d90['get']({'plain':!![]});var _0x5bd40c=_0xb00b('0x20');return db[_0xb00b('0x47')]['find']({'where':{'name':_0x5bd40c,'userProfileId':_0x481515[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x21')](function(_0x57f6ab){if(_0x57f6ab&&_0x57f6ab[_0xb00b('0x49')]===0x0){return db[_0xb00b('0x4a')][_0xb00b('0x43')]({'name':_0xda60ca['name'],'resourceId':_0xda60ca['id'],'type':_0x57f6ab['name'],'sectionId':_0x57f6ab['id']},{})[_0xb00b('0x21')](function(){return _0x465d90;});}else{return _0x465d90;}})[_0xb00b('0x3e')](function(_0x12737d){logger[_0xb00b('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12737d);throw _0x12737d;});}return _0x465d90;})[_0xb00b('0x21')](respondWithResult(_0x4e0be4,0xc9))[_0xb00b('0x3e')](handleError(_0x4e0be4,null));};exports['update']=function(_0x4cd9fd,_0x160965){if(_0x4cd9fd['body']['id']){delete _0x4cd9fd[_0xb00b('0x4c')]['id'];}return db[_0xb00b('0x26')][_0xb00b('0x42')]({'where':{'id':_0x4cd9fd[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x160965,null))[_0xb00b('0x21')](saveUpdates(_0x4cd9fd['body'],null))[_0xb00b('0x21')](respondWithResult(_0x160965,null))['catch'](handleError(_0x160965,null));};exports[_0xb00b('0x1e')]=function(_0x98caa9,_0x4129ba){return db['AnalyticMetric'][_0xb00b('0x42')]({'where':{'id':_0x98caa9[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x4129ba,null))['then'](removeEntity(_0x4129ba,null))[_0xb00b('0x3e')](handleError(_0x4129ba,null));}; \ No newline at end of file +var _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4f3168,_0xb57b40){_0x4f3168=_0x4f3168-0x0;var _0x1271c8=_0x1cb9[_0x4f3168];return _0x1271c8;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index aa930fd..f900ccb 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 _0xf360=['AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./analyticMetric.attributes','exports','define'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf360,0x9e));var _0x0f36=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf360[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x0f36('0x0'));var util=require(_0x0f36('0x1'));var logger=require(_0x0f36('0x2'))('api');var moment=require(_0x0f36('0x3'));var BPromise=require('bluebird');var rp=require(_0x0f36('0x4'));var fs=require('fs');var path=require(_0x0f36('0x5'));var rimraf=require(_0x0f36('0x6'));var config=require('../../config/environment');var attributes=require(_0x0f36('0x7'));module[_0x0f36('0x8')]=function(_0x13d262,_0x110709){return _0x13d262[_0x0f36('0x9')](_0x0f36('0xa'),attributes,{'tableName':_0x0f36('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13f5=['define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x1235a8,_0x2db48e){var _0x41a2cf=function(_0x2c30df){while(--_0x2c30df){_0x1235a8['push'](_0x1235a8['shift']());}};_0x41a2cf(++_0x2db48e);}(_0x13f5,0xc3));var _0x513f=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x13f5[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x513f('0x0'));var util=require(_0x513f('0x1'));var logger=require(_0x513f('0x2'))(_0x513f('0x3'));var moment=require('moment');var BPromise=require(_0x513f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x513f('0x5'));var config=require(_0x513f('0x6'));var attributes=require(_0x513f('0x7'));module[_0x513f('0x8')]=function(_0x8d019b,_0x579681){return _0x8d019b[_0x513f('0x9')](_0x513f('0xa'),attributes,{'tableName':_0x513f('0xb'),'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 64abffd..b4f3ab3 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 _0x2680=['jayson/promise','http','request','info','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x5e534f,_0x3785ff){var _0x1a3e8f=function(_0x38e27e){while(--_0x38e27e){_0x5e534f['push'](_0x5e534f['shift']());}};_0x1a3e8f(++_0x3785ff);}(_0x2680,0x19c));var _0x0268=function(_0x426b84,_0x152c98){_0x426b84=_0x426b84-0x0;var _0x42634d=_0x2680[_0x426b84];return _0x42634d;};'use strict';var _=require(_0x0268('0x0'));var util=require(_0x0268('0x1'));var moment=require(_0x0268('0x2'));var BPromise=require('bluebird');var rs=require(_0x0268('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0268('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0268('0x5'))(_0x0268('0x6'));var config=require(_0x0268('0x7'));var jayson=require(_0x0268('0x8'));var client=jayson['client'][_0x0268('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x506ed3,_0x3db3cc,_0x3f0e3c){return new BPromise(function(_0x2397b6,_0x36cd3c){return client[_0x0268('0xa')](_0x506ed3,_0x3f0e3c)['then'](function(_0x46fc0a){logger[_0x0268('0xb')](_0x0268('0xc'),_0x3db3cc,'request\x20sent');logger['debug'](_0x0268('0xd'),_0x3db3cc,_0x0268('0xe'),JSON[_0x0268('0xf')](_0x46fc0a));if(_0x46fc0a[_0x0268('0x10')]){if(_0x46fc0a[_0x0268('0x10')][_0x0268('0x11')]===0x1f4){logger[_0x0268('0x10')](_0x0268('0xc'),_0x3db3cc,_0x46fc0a['error'][_0x0268('0x12')]);return _0x36cd3c(_0x46fc0a[_0x0268('0x10')][_0x0268('0x12')]);}logger[_0x0268('0x10')](_0x0268('0xc'),_0x3db3cc,_0x46fc0a['error'][_0x0268('0x12')]);return _0x2397b6(_0x46fc0a['error']['message']);}else{logger[_0x0268('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x3db3cc,_0x0268('0xe'));_0x2397b6(_0x46fc0a['result'][_0x0268('0x12')]);}})[_0x0268('0x13')](function(_0x1a79c7){logger[_0x0268('0x10')](_0x0268('0xc'),_0x3db3cc,_0x1a79c7);_0x36cd3c(_0x1a79c7);});});} \ No newline at end of file +var _0x43f1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43f1,0x15d));var _0x143f=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x43f1[_0x1aeda2];return _0x32dc6d;};'use strict';var _=require(_0x143f('0x0'));var util=require(_0x143f('0x1'));var moment=require(_0x143f('0x2'));var BPromise=require(_0x143f('0x3'));var rs=require(_0x143f('0x4'));var fs=require('fs');var Redis=require(_0x143f('0x5'));var db=require(_0x143f('0x6'))['db'];var utils=require(_0x143f('0x7'));var logger=require('../../config/logger')(_0x143f('0x8'));var config=require('../../config/environment');var jayson=require(_0x143f('0x9'));var client=jayson[_0x143f('0xa')][_0x143f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24e9b2,_0x15bb41,_0x504377){return new BPromise(function(_0xa0f99c,_0x5c4003){return client['request'](_0x24e9b2,_0x504377)[_0x143f('0xc')](function(_0x30c2da){logger[_0x143f('0xd')](_0x143f('0xe'),_0x15bb41,_0x143f('0xf'));logger[_0x143f('0x10')](_0x143f('0x11'),_0x15bb41,_0x143f('0xf'),JSON[_0x143f('0x12')](_0x30c2da));if(_0x30c2da['error']){if(_0x30c2da[_0x143f('0x13')]['code']===0x1f4){logger['error'](_0x143f('0xe'),_0x15bb41,_0x30c2da[_0x143f('0x13')]['message']);return _0x5c4003(_0x30c2da[_0x143f('0x13')][_0x143f('0x14')]);}logger[_0x143f('0x13')](_0x143f('0xe'),_0x15bb41,_0x30c2da[_0x143f('0x13')][_0x143f('0x14')]);return _0xa0f99c(_0x30c2da[_0x143f('0x13')][_0x143f('0x14')]);}else{logger[_0x143f('0xd')](_0x143f('0xe'),_0x15bb41,_0x143f('0xf'));_0xa0f99c(_0x30c2da[_0x143f('0x15')][_0x143f('0x14')]);}})['catch'](function(_0x469d76){logger[_0x143f('0x13')](_0x143f('0xe'),_0x15bb41,_0x469d76);_0x5c4003(_0x469d76);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 05cfe7b..c29ea8e 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 _0xaf79=['/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get'];(function(_0x56f0f8,_0x28d84a){var _0x29c23c=function(_0x592f0c){while(--_0x592f0c){_0x56f0f8['push'](_0x56f0f8['shift']());}};_0x29c23c(++_0x28d84a);}(_0xaf79,0x82));var _0x9af7=function(_0x86dbdc,_0x31693b){_0x86dbdc=_0x86dbdc-0x0;var _0x42c1fd=_0xaf79[_0x86dbdc];return _0x42c1fd;};'use strict';var multer=require('multer');var util=require(_0x9af7('0x0'));var path=require(_0x9af7('0x1'));var timeout=require(_0x9af7('0x2'));var express=require(_0x9af7('0x3'));var router=express[_0x9af7('0x4')]();var fs_extra=require(_0x9af7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9af7('0x6'));var config=require(_0x9af7('0x7'));var controller=require(_0x9af7('0x8'));router[_0x9af7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9af7('0x9')](_0x9af7('0xa'),auth[_0x9af7('0xb')](),controller[_0x9af7('0xc')]);router[_0x9af7('0xd')]('/',auth[_0x9af7('0xb')](),controller[_0x9af7('0xe')]);router[_0x9af7('0xf')](_0x9af7('0xa'),auth[_0x9af7('0xb')](),controller[_0x9af7('0x10')]);router[_0x9af7('0x11')]('/:id',auth[_0x9af7('0xb')](),controller[_0x9af7('0x12')]);module[_0x9af7('0x13')]=router; \ No newline at end of file +var _0x5e0c=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x7257ea,_0x415c82){var _0x5ac722=function(_0x12a4c0){while(--_0x12a4c0){_0x7257ea['push'](_0x7257ea['shift']());}};_0x5ac722(++_0x415c82);}(_0x5e0c,0x19f));var _0xc5e0=function(_0x21dc36,_0x54664b){_0x21dc36=_0x21dc36-0x0;var _0xcd8586=_0x5e0c[_0x21dc36];return _0xcd8586;};'use strict';var multer=require('multer');var util=require(_0xc5e0('0x0'));var path=require(_0xc5e0('0x1'));var timeout=require(_0xc5e0('0x2'));var express=require(_0xc5e0('0x3'));var router=express[_0xc5e0('0x4')]();var fs_extra=require(_0xc5e0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc5e0('0x6'));var config=require(_0xc5e0('0x7'));var controller=require(_0xc5e0('0x8'));router[_0xc5e0('0x9')]('/',auth[_0xc5e0('0xa')](),controller['index']);router['get'](_0xc5e0('0xb'),auth['isAuthenticated'](),controller[_0xc5e0('0xc')]);router[_0xc5e0('0xd')]('/',auth[_0xc5e0('0xa')](),controller[_0xc5e0('0xe')]);router['put'](_0xc5e0('0xb'),auth['isAuthenticated'](),controller[_0xc5e0('0xf')]);router[_0xc5e0('0x10')](_0xc5e0('0xb'),auth[_0xc5e0('0xa')](),controller[_0xc5e0('0x11')]);module[_0xc5e0('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 6abc8f8..329219b 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 _0x08be=['sequelize','TEXT'];(function(_0xb867a8,_0x926a63){var _0x1e5dcd=function(_0x1f3c72){while(--_0x1f3c72){_0xb867a8['push'](_0xb867a8['shift']());}};_0x1e5dcd(++_0x926a63);}(_0x08be,0x100));var _0xe08b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x08be[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xe08b('0x0'));module['exports']={'tree':{'type':Sequelize[_0xe08b('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb255=['TEXT','sequelize','exports'];(function(_0x372c3e,_0x4ebb70){var _0x4b5b54=function(_0x1f4e7d){while(--_0x1f4e7d){_0x372c3e['push'](_0x372c3e['shift']());}};_0x4b5b54(++_0x4ebb70);}(_0xb255,0x130));var _0x5b25=function(_0xd20f56,_0x4289bf){_0xd20f56=_0xd20f56-0x0;var _0x366917=_0xb255[_0xd20f56];return _0x366917;};'use strict';var Sequelize=require(_0x5b25('0x0'));module[_0x5b25('0x1')]={'tree':{'type':Sequelize[_0x5b25('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 8ab6738..b14e6ad 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 _0x9eef=['filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','catch','show','keys','rawAttributes','length','include','options','find','create','body','update','params','moment','bluebird','mustache','util','ejs','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','map','AnalyticTreeReport','model','query'];(function(_0xf31a,_0x5f5b89){var _0x4df458=function(_0x1ceeaf){while(--_0x1ceeaf){_0xf31a['push'](_0xf31a['shift']());}};_0x4df458(++_0x5f5b89);}(_0x9eef,0xa2));var _0xf9ee=function(_0x392f82,_0x4dc713){_0x392f82=_0x392f82-0x0;var _0x3ad0b8=_0x9eef[_0x392f82];return _0x3ad0b8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf9ee('0x0'));var BPromise=require(_0xf9ee('0x1'));var Mustache=require(_0xf9ee('0x2'));var util=require(_0xf9ee('0x3'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf9ee('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf9ee('0x5'));var deskjs=require(_0xf9ee('0x6'));var toCsv=require(_0xf9ee('0x7'));var querystring=require('querystring');var Papa=require(_0xf9ee('0x8'));var Redis=require(_0xf9ee('0x9'));var authService=require(_0xf9ee('0xa'));var qs=require(_0xf9ee('0xb'));var as=require(_0xf9ee('0xc'));var hardwareService=require(_0xf9ee('0xd'));var logger=require(_0xf9ee('0xe'))('api');var utils=require(_0xf9ee('0xf'));var config=require(_0xf9ee('0x10'));var licenseUtil=require(_0xf9ee('0x11'));var db=require(_0xf9ee('0x12'))['db'];function respondWithStatusCode(_0x3380de,_0x93fb5c){_0x93fb5c=_0x93fb5c||0xcc;return function(_0x3d9621){if(_0x3d9621){return _0x3380de[_0xf9ee('0x13')](_0x93fb5c);}return _0x3380de[_0xf9ee('0x14')](_0x93fb5c)[_0xf9ee('0x15')]();};}function respondWithResult(_0x1156cd,_0x3f7495){_0x3f7495=_0x3f7495||0xc8;return function(_0x1fc567){if(_0x1fc567){return _0x1156cd['status'](_0x3f7495)['json'](_0x1fc567);}};}function respondWithFilteredResult(_0x2903eb,_0x1f71d5){return function(_0x1a118c){if(_0x1a118c){var _0x519365=typeof _0x1f71d5[_0xf9ee('0x16')]===_0xf9ee('0x17')&&typeof _0x1f71d5[_0xf9ee('0x18')]==='undefined';var _0x57faf5=_0x1a118c[_0xf9ee('0x19')];var _0x10a2dd=_0x519365?0x0:_0x1f71d5[_0xf9ee('0x16')];var _0x52db8e=_0x519365?_0x1a118c[_0xf9ee('0x19')]:_0x1f71d5[_0xf9ee('0x16')]+_0x1f71d5[_0xf9ee('0x18')];var _0x329d61;if(_0x52db8e>=_0x57faf5){_0x52db8e=_0x57faf5;_0x329d61=0xc8;}else{_0x329d61=0xce;}_0x2903eb[_0xf9ee('0x14')](_0x329d61);return _0x2903eb[_0xf9ee('0x1a')](_0xf9ee('0x1b'),_0x10a2dd+'-'+_0x52db8e+'/'+_0x57faf5)['json'](_0x1a118c);}return null;};}function patchUpdates(_0x123f0e){return function(_0x396612){try{jsonpatch[_0xf9ee('0x1c')](_0x396612,_0x123f0e,!![]);}catch(_0x2e5d2f){return BPromise[_0xf9ee('0x1d')](_0x2e5d2f);}return _0x396612[_0xf9ee('0x1e')]();};}function saveUpdates(_0x1a4ee2,_0x24f311){return function(_0x561e79){if(_0x561e79){return _0x561e79['update'](_0x1a4ee2)[_0xf9ee('0x1f')](function(_0x372ac1){return _0x372ac1;});}return null;};}function removeEntity(_0x32cc03,_0x3cd91f){return function(_0x235038){if(_0x235038){return _0x235038['destroy']()[_0xf9ee('0x1f')](function(){_0x32cc03[_0xf9ee('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d3317,_0x432bbe){return function(_0x54fa48){if(!_0x54fa48){_0x5d3317[_0xf9ee('0x13')](0x194);}return _0x54fa48;};}function handleError(_0x29898f,_0x33f648){_0x33f648=_0x33f648||0x1f4;return function(_0xfe553e){logger['error'](_0xfe553e[_0xf9ee('0x20')]);if(_0xfe553e['name']){delete _0xfe553e[_0xf9ee('0x21')];}_0x29898f[_0xf9ee('0x14')](_0x33f648)[_0xf9ee('0x22')](_0xfe553e);};}exports['index']=function(_0x11e2db,_0x236b84){var _0x5f568d={},_0xd36f6c={},_0x3fb302={'count':0x0,'rows':[]};var _0x549a50=_[_0xf9ee('0x23')](db[_0xf9ee('0x24')]['rawAttributes'],function(_0x318eac){return{'name':_0x318eac['fieldName'],'type':_0x318eac['type']['key']};});_0xd36f6c[_0xf9ee('0x25')]=_[_0xf9ee('0x23')](_0x549a50,'name');_0xd36f6c[_0xf9ee('0x26')]=_['keys'](_0x11e2db[_0xf9ee('0x26')]);_0xd36f6c[_0xf9ee('0x27')]=_['intersection'](_0xd36f6c[_0xf9ee('0x25')],_0xd36f6c[_0xf9ee('0x26')]);_0x5f568d[_0xf9ee('0x28')]=_[_0xf9ee('0x29')](_0xd36f6c['model'],qs[_0xf9ee('0x2a')](_0x11e2db[_0xf9ee('0x26')][_0xf9ee('0x2a')]));_0x5f568d['attributes']=_0x5f568d[_0xf9ee('0x28')]['length']?_0x5f568d[_0xf9ee('0x28')]:_0xd36f6c[_0xf9ee('0x25')];if(!_0x11e2db[_0xf9ee('0x26')][_0xf9ee('0x2b')](_0xf9ee('0x2c'))){_0x5f568d['limit']=qs[_0xf9ee('0x18')](_0x11e2db['query'][_0xf9ee('0x18')]);_0x5f568d[_0xf9ee('0x16')]=qs[_0xf9ee('0x16')](_0x11e2db[_0xf9ee('0x26')][_0xf9ee('0x16')]);}_0x5f568d[_0xf9ee('0x2d')]=qs[_0xf9ee('0x2e')](_0x11e2db[_0xf9ee('0x26')][_0xf9ee('0x2e')]);_0x5f568d[_0xf9ee('0x2f')]=qs['filters'](_[_0xf9ee('0x30')](_0x11e2db[_0xf9ee('0x26')],_0xd36f6c['filters']),_0x549a50);if(_0x11e2db[_0xf9ee('0x26')][_0xf9ee('0x31')]){_0x5f568d[_0xf9ee('0x2f')]=_[_0xf9ee('0x32')](_0x5f568d['where'],{'$or':_[_0xf9ee('0x23')](_0x549a50,function(_0x52fbc7){if(_0x52fbc7[_0xf9ee('0x33')]!==_0xf9ee('0x34')){var _0x55b725={};_0x55b725[_0x52fbc7[_0xf9ee('0x21')]]={'$like':'%'+_0x11e2db['query'][_0xf9ee('0x31')]+'%'};return _0x55b725;}})});}_0x5f568d=_[_0xf9ee('0x32')]({},_0x5f568d,_0x11e2db['options']);var _0x5866b8={'where':_0x5f568d[_0xf9ee('0x2f')]};return db[_0xf9ee('0x24')][_0xf9ee('0x19')](_0x5866b8)[_0xf9ee('0x1f')](function(_0x26212b){_0x3fb302['count']=_0x26212b;if(_0x11e2db[_0xf9ee('0x26')]['includeAll']){_0x5f568d['include']=[{'all':!![]}];}return db[_0xf9ee('0x24')][_0xf9ee('0x35')](_0x5f568d);})[_0xf9ee('0x1f')](function(_0x2b315a){_0x3fb302[_0xf9ee('0x36')]=_0x2b315a;return _0x3fb302;})['then'](respondWithFilteredResult(_0x236b84,_0x5f568d))[_0xf9ee('0x37')](handleError(_0x236b84,null));};exports[_0xf9ee('0x38')]=function(_0x32cffc,_0x30198c){var _0x3abb63={'raw':!![],'where':{'id':_0x32cffc['params']['id']}},_0x5002a7={};_0x5002a7[_0xf9ee('0x25')]=_[_0xf9ee('0x39')](db[_0xf9ee('0x24')][_0xf9ee('0x3a')]);_0x5002a7[_0xf9ee('0x26')]=_[_0xf9ee('0x39')](_0x32cffc[_0xf9ee('0x26')]);_0x5002a7[_0xf9ee('0x27')]=_[_0xf9ee('0x29')](_0x5002a7[_0xf9ee('0x25')],_0x5002a7['query']);_0x3abb63['attributes']=_[_0xf9ee('0x29')](_0x5002a7[_0xf9ee('0x25')],qs[_0xf9ee('0x2a')](_0x32cffc[_0xf9ee('0x26')][_0xf9ee('0x2a')]));_0x3abb63[_0xf9ee('0x28')]=_0x3abb63[_0xf9ee('0x28')][_0xf9ee('0x3b')]?_0x3abb63[_0xf9ee('0x28')]:_0x5002a7[_0xf9ee('0x25')];if(_0x32cffc[_0xf9ee('0x26')]['includeAll']){_0x3abb63[_0xf9ee('0x3c')]=[{'all':!![]}];}_0x3abb63=_[_0xf9ee('0x32')]({},_0x3abb63,_0x32cffc[_0xf9ee('0x3d')]);return db[_0xf9ee('0x24')][_0xf9ee('0x3e')](_0x3abb63)[_0xf9ee('0x1f')](handleEntityNotFound(_0x30198c,null))[_0xf9ee('0x1f')](respondWithResult(_0x30198c,null))[_0xf9ee('0x37')](handleError(_0x30198c,null));};exports[_0xf9ee('0x3f')]=function(_0xabd3c,_0x550303){return db[_0xf9ee('0x24')][_0xf9ee('0x3f')](_0xabd3c[_0xf9ee('0x40')],{})['then'](respondWithResult(_0x550303,0xc9))[_0xf9ee('0x37')](handleError(_0x550303,null));};exports[_0xf9ee('0x41')]=function(_0x45a2f6,_0x45e84a){if(_0x45a2f6['body']['id']){delete _0x45a2f6[_0xf9ee('0x40')]['id'];}return db[_0xf9ee('0x24')][_0xf9ee('0x3e')]({'where':{'id':_0x45a2f6['params']['id']}})[_0xf9ee('0x1f')](handleEntityNotFound(_0x45e84a,null))[_0xf9ee('0x1f')](saveUpdates(_0x45a2f6['body'],null))['then'](respondWithResult(_0x45e84a,null))[_0xf9ee('0x37')](handleError(_0x45e84a,null));};exports['destroy']=function(_0x41ab0d,_0x493817){return db[_0xf9ee('0x24')][_0xf9ee('0x3e')]({'where':{'id':_0x41ab0d[_0xf9ee('0x42')]['id']}})[_0xf9ee('0x1f')](handleEntityNotFound(_0x493817,null))[_0xf9ee('0x1f')](removeEntity(_0x493817,null))[_0xf9ee('0x37')](handleError(_0x493817,null));}; \ No newline at end of file +var _0x9328=['then','destroy','end','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','save','update'];(function(_0x333fed,_0x3d2122){var _0x12cac2=function(_0x41d9af){while(--_0x41d9af){_0x333fed['push'](_0x333fed['shift']());}};_0x12cac2(++_0x3d2122);}(_0x9328,0x100));var _0x8932=function(_0x1e00ee,_0x4f48f5){_0x1e00ee=_0x1e00ee-0x0;var _0x4b4ea4=_0x9328[_0x1e00ee];return _0x4b4ea4;};'use strict';var emlformat=require(_0x8932('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8932('0x1'));var rp=require(_0x8932('0x2'));var moment=require('moment');var BPromise=require(_0x8932('0x3'));var Mustache=require('mustache');var util=require(_0x8932('0x4'));var path=require(_0x8932('0x5'));var sox=require(_0x8932('0x6'));var csv=require(_0x8932('0x7'));var ejs=require(_0x8932('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8932('0x9'));var squel=require(_0x8932('0xa'));var crypto=require('crypto');var jsforce=require(_0x8932('0xb'));var deskjs=require(_0x8932('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8932('0xd'));var qs=require(_0x8932('0xe'));var as=require(_0x8932('0xf'));var hardwareService=require(_0x8932('0x10'));var logger=require(_0x8932('0x11'))(_0x8932('0x12'));var utils=require(_0x8932('0x13'));var config=require(_0x8932('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f0eed,_0x13b64e){_0x13b64e=_0x13b64e||0xcc;return function(_0x91f250){if(_0x91f250){return _0x3f0eed[_0x8932('0x15')](_0x13b64e);}return _0x3f0eed[_0x8932('0x16')](_0x13b64e)['end']();};}function respondWithResult(_0x91b6fa,_0x519020){_0x519020=_0x519020||0xc8;return function(_0x3ce343){if(_0x3ce343){return _0x91b6fa[_0x8932('0x16')](_0x519020)[_0x8932('0x17')](_0x3ce343);}};}function respondWithFilteredResult(_0x108f71,_0x1744b3){return function(_0x4b3dbc){if(_0x4b3dbc){var _0x58e534=typeof _0x1744b3[_0x8932('0x18')]==='undefined'&&typeof _0x1744b3[_0x8932('0x19')]===_0x8932('0x1a');var _0x445090=_0x4b3dbc[_0x8932('0x1b')];var _0xceefe9=_0x58e534?0x0:_0x1744b3['offset'];var _0xdfedda=_0x58e534?_0x4b3dbc[_0x8932('0x1b')]:_0x1744b3['offset']+_0x1744b3[_0x8932('0x19')];var _0x319270;if(_0xdfedda>=_0x445090){_0xdfedda=_0x445090;_0x319270=0xc8;}else{_0x319270=0xce;}_0x108f71['status'](_0x319270);return _0x108f71['set'](_0x8932('0x1c'),_0xceefe9+'-'+_0xdfedda+'/'+_0x445090)[_0x8932('0x17')](_0x4b3dbc);}return null;};}function patchUpdates(_0x354051){return function(_0x2daded){try{jsonpatch['apply'](_0x2daded,_0x354051,!![]);}catch(_0x5c7642){return BPromise[_0x8932('0x1d')](_0x5c7642);}return _0x2daded[_0x8932('0x1e')]();};}function saveUpdates(_0x2e77e3,_0x370fb0){return function(_0x244564){if(_0x244564){return _0x244564[_0x8932('0x1f')](_0x2e77e3)[_0x8932('0x20')](function(_0x346d09){return _0x346d09;});}return null;};}function removeEntity(_0x2decd9,_0x20b25d){return function(_0xa46f85){if(_0xa46f85){return _0xa46f85[_0x8932('0x21')]()['then'](function(){_0x2decd9['status'](0xcc)[_0x8932('0x22')]();});}};}function handleEntityNotFound(_0x5ae6a7,_0x58f68b){return function(_0x40523e){if(!_0x40523e){_0x5ae6a7[_0x8932('0x15')](0x194);}return _0x40523e;};}function handleError(_0x4617e0,_0x1f8dbb){_0x1f8dbb=_0x1f8dbb||0x1f4;return function(_0x4e64a1){logger[_0x8932('0x23')](_0x4e64a1[_0x8932('0x24')]);if(_0x4e64a1[_0x8932('0x25')]){delete _0x4e64a1['name'];}_0x4617e0['status'](_0x1f8dbb)[_0x8932('0x26')](_0x4e64a1);};}exports[_0x8932('0x27')]=function(_0x54f8de,_0x346d9f){var _0x542738={},_0x55e7d5={},_0x3b058f={'count':0x0,'rows':[]};var _0x43d3ea=_[_0x8932('0x28')](db[_0x8932('0x29')][_0x8932('0x2a')],function(_0x56ab08){return{'name':_0x56ab08[_0x8932('0x2b')],'type':_0x56ab08['type'][_0x8932('0x2c')]};});_0x55e7d5['model']=_[_0x8932('0x28')](_0x43d3ea,'name');_0x55e7d5['query']=_[_0x8932('0x2d')](_0x54f8de[_0x8932('0x2e')]);_0x55e7d5[_0x8932('0x2f')]=_[_0x8932('0x30')](_0x55e7d5['model'],_0x55e7d5[_0x8932('0x2e')]);_0x542738['attributes']=_['intersection'](_0x55e7d5[_0x8932('0x31')],qs[_0x8932('0x32')](_0x54f8de[_0x8932('0x2e')][_0x8932('0x32')]));_0x542738[_0x8932('0x33')]=_0x542738[_0x8932('0x33')]['length']?_0x542738[_0x8932('0x33')]:_0x55e7d5['model'];if(!_0x54f8de[_0x8932('0x2e')][_0x8932('0x34')]('nolimit')){_0x542738['limit']=qs[_0x8932('0x19')](_0x54f8de[_0x8932('0x2e')][_0x8932('0x19')]);_0x542738[_0x8932('0x18')]=qs[_0x8932('0x18')](_0x54f8de[_0x8932('0x2e')][_0x8932('0x18')]);}_0x542738[_0x8932('0x35')]=qs['sort'](_0x54f8de[_0x8932('0x2e')]['sort']);_0x542738[_0x8932('0x36')]=qs[_0x8932('0x2f')](_[_0x8932('0x37')](_0x54f8de[_0x8932('0x2e')],_0x55e7d5[_0x8932('0x2f')]),_0x43d3ea);if(_0x54f8de[_0x8932('0x2e')][_0x8932('0x38')]){_0x542738[_0x8932('0x36')]=_[_0x8932('0x39')](_0x542738['where'],{'$or':_['map'](_0x43d3ea,function(_0xffe6a7){if(_0xffe6a7[_0x8932('0x3a')]!==_0x8932('0x3b')){var _0x51bf9e={};_0x51bf9e[_0xffe6a7['name']]={'$like':'%'+_0x54f8de[_0x8932('0x2e')][_0x8932('0x38')]+'%'};return _0x51bf9e;}})});}_0x542738=_[_0x8932('0x39')]({},_0x542738,_0x54f8de[_0x8932('0x3c')]);var _0x382fe3={'where':_0x542738[_0x8932('0x36')]};return db[_0x8932('0x29')][_0x8932('0x1b')](_0x382fe3)[_0x8932('0x20')](function(_0x2d580b){_0x3b058f['count']=_0x2d580b;if(_0x54f8de['query'][_0x8932('0x3d')]){_0x542738['include']=[{'all':!![]}];}return db[_0x8932('0x29')][_0x8932('0x3e')](_0x542738);})['then'](function(_0xf04ec){_0x3b058f[_0x8932('0x3f')]=_0xf04ec;return _0x3b058f;})[_0x8932('0x20')](respondWithFilteredResult(_0x346d9f,_0x542738))[_0x8932('0x40')](handleError(_0x346d9f,null));};exports[_0x8932('0x41')]=function(_0x9787ef,_0x4ae01b){var _0x19ad6b={'raw':!![],'where':{'id':_0x9787ef['params']['id']}},_0x6663d3={};_0x6663d3[_0x8932('0x31')]=_['keys'](db['AnalyticTreeReport'][_0x8932('0x2a')]);_0x6663d3[_0x8932('0x2e')]=_[_0x8932('0x2d')](_0x9787ef['query']);_0x6663d3[_0x8932('0x2f')]=_['intersection'](_0x6663d3[_0x8932('0x31')],_0x6663d3[_0x8932('0x2e')]);_0x19ad6b[_0x8932('0x33')]=_[_0x8932('0x30')](_0x6663d3['model'],qs['fields'](_0x9787ef[_0x8932('0x2e')][_0x8932('0x32')]));_0x19ad6b[_0x8932('0x33')]=_0x19ad6b[_0x8932('0x33')][_0x8932('0x42')]?_0x19ad6b['attributes']:_0x6663d3[_0x8932('0x31')];if(_0x9787ef[_0x8932('0x2e')][_0x8932('0x3d')]){_0x19ad6b[_0x8932('0x43')]=[{'all':!![]}];}_0x19ad6b=_[_0x8932('0x39')]({},_0x19ad6b,_0x9787ef['options']);return db[_0x8932('0x29')][_0x8932('0x44')](_0x19ad6b)[_0x8932('0x20')](handleEntityNotFound(_0x4ae01b,null))[_0x8932('0x20')](respondWithResult(_0x4ae01b,null))[_0x8932('0x40')](handleError(_0x4ae01b,null));};exports[_0x8932('0x45')]=function(_0x376a5f,_0x2b5206){return db[_0x8932('0x29')]['create'](_0x376a5f[_0x8932('0x46')],{})[_0x8932('0x20')](respondWithResult(_0x2b5206,0xc9))['catch'](handleError(_0x2b5206,null));};exports[_0x8932('0x1f')]=function(_0x467b38,_0xf190e7){if(_0x467b38[_0x8932('0x46')]['id']){delete _0x467b38[_0x8932('0x46')]['id'];}return db[_0x8932('0x29')][_0x8932('0x44')]({'where':{'id':_0x467b38[_0x8932('0x47')]['id']}})[_0x8932('0x20')](handleEntityNotFound(_0xf190e7,null))[_0x8932('0x20')](saveUpdates(_0x467b38[_0x8932('0x46')],null))['then'](respondWithResult(_0xf190e7,null))[_0x8932('0x40')](handleError(_0xf190e7,null));};exports[_0x8932('0x21')]=function(_0x5c1095,_0x48dda9){return db[_0x8932('0x29')]['find']({'where':{'id':_0x5c1095['params']['id']}})['then'](handleEntityNotFound(_0x48dda9,null))[_0x8932('0x20')](removeEntity(_0x48dda9,null))[_0x8932('0x40')](handleError(_0x48dda9,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index a1d0e31..23a6e86 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 _0xa270=['request-promise','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util','../../config/logger','api','moment'];(function(_0x328171,_0x22903f){var _0x1d3db5=function(_0x14b460){while(--_0x14b460){_0x328171['push'](_0x328171['shift']());}};_0x1d3db5(++_0x22903f);}(_0xa270,0x12f));var _0x0a27=function(_0x2d5d38,_0x8a5d69){_0x2d5d38=_0x2d5d38-0x0;var _0x2fcbe8=_0xa270[_0x2d5d38];return _0x2fcbe8;};'use strict';var _=require(_0x0a27('0x0'));var util=require(_0x0a27('0x1'));var logger=require(_0x0a27('0x2'))(_0x0a27('0x3'));var moment=require(_0x0a27('0x4'));var BPromise=require('bluebird');var rp=require(_0x0a27('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0a27('0x6'));var attributes=require(_0x0a27('0x7'));module[_0x0a27('0x8')]=function(_0x271c6f,_0x492a68){return _0x271c6f[_0x0a27('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x0a27('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d3c=['analytics_report_trees','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x3d3c,0x1bb));var _0xc3d3=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x3d3c[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xc3d3('0x0'));var util=require(_0xc3d3('0x1'));var logger=require(_0xc3d3('0x2'))('api');var moment=require(_0xc3d3('0x3'));var BPromise=require(_0xc3d3('0x4'));var rp=require(_0xc3d3('0x5'));var fs=require('fs');var path=require(_0xc3d3('0x6'));var rimraf=require(_0xc3d3('0x7'));var config=require(_0xc3d3('0x8'));var attributes=require(_0xc3d3('0x9'));module[_0xc3d3('0xa')]=function(_0x369a0f,_0x5cc04e){return _0x369a0f[_0xc3d3('0xb')]('AnalyticTreeReport',attributes,{'tableName':_0xc3d3('0xc'),'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 665788d..1a439cc 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x592485,_0x5a7979){var _0x2c27fb=function(_0x37c5d4){while(--_0x37c5d4){_0x592485['push'](_0x592485['shift']());}};_0x2c27fb(++_0x5a7979);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0xadb5,0xad));var _0x5adb=function(_0xb07bd5,_0x2528af){_0xb07bd5=_0xb07bd5-0x0;var _0x8bd4e7=_0xadb5[_0xb07bd5];return _0x8bd4e7;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 18c9b3f..9606d25 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 _0xa7d2=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','post','create','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7d2,0x122));var _0x2a7d=function(_0x58ae60,_0xa9eb83){_0x58ae60=_0x58ae60-0x0;var _0x246a10=_0xa7d2[_0x58ae60];return _0x246a10;};'use strict';var multer=require('multer');var util=require(_0x2a7d('0x0'));var path=require('path');var timeout=require(_0x2a7d('0x1'));var express=require(_0x2a7d('0x2'));var router=express[_0x2a7d('0x3')]();var fs_extra=require(_0x2a7d('0x4'));var auth=require(_0x2a7d('0x5'));var interaction=require(_0x2a7d('0x6'));var config=require(_0x2a7d('0x7'));var controller=require(_0x2a7d('0x8'));router['get']('/',auth[_0x2a7d('0x9')](),controller[_0x2a7d('0xa')]);router[_0x2a7d('0xb')](_0x2a7d('0xc'),auth[_0x2a7d('0x9')](),controller['show']);router[_0x2a7d('0xd')]('/',auth[_0x2a7d('0x9')](),controller[_0x2a7d('0xe')]);router['put'](_0x2a7d('0xc'),auth[_0x2a7d('0x9')](),controller['update']);router[_0x2a7d('0xf')](_0x2a7d('0xc'),auth[_0x2a7d('0x9')](),controller[_0x2a7d('0x10')]);module[_0x2a7d('0x11')]=router; \ No newline at end of file +var _0x212f=['fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','path','connect-timeout','Router'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0x212f,0x1ea));var _0xf212=function(_0xf6f769,_0x224e7e){_0xf6f769=_0xf6f769-0x0;var _0x1663e9=_0x212f[_0xf6f769];return _0x1663e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf212('0x0'));var timeout=require(_0xf212('0x1'));var express=require('express');var router=express[_0xf212('0x2')]();var fs_extra=require(_0xf212('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf212('0x4'));var config=require(_0xf212('0x5'));var controller=require(_0xf212('0x6'));router[_0xf212('0x7')]('/',auth['isAuthenticated'](),controller[_0xf212('0x8')]);router[_0xf212('0x7')](_0xf212('0x9'),auth[_0xf212('0xa')](),controller[_0xf212('0xb')]);router[_0xf212('0xc')]('/',auth[_0xf212('0xa')](),controller[_0xf212('0xd')]);router['put'](_0xf212('0x9'),auth[_0xf212('0xa')](),controller[_0xf212('0xe')]);router[_0xf212('0xf')](_0xf212('0x9'),auth['isAuthenticated'](),controller[_0xf212('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 59366f7..aea2ecc 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 _0x40ca=['STRING','sequelize'];(function(_0xa957c4,_0x49e0c8){var _0x3157ef=function(_0x3e4b5d){while(--_0x3e4b5d){_0xa957c4['push'](_0xa957c4['shift']());}};_0x3157ef(++_0x49e0c8);}(_0x40ca,0x1a1));var _0xa40c=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x40ca[_0x243b2f];return _0xcb3c2d;};'use strict';var Sequelize=require(_0xa40c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xa40c('0x1')]},'type':{'type':Sequelize[_0xa40c('0x1')]}}; \ No newline at end of file +var _0x2e35=['exports','STRING','sequelize'];(function(_0x4b33d1,_0x2414e1){var _0x9e7221=function(_0x476ecc){while(--_0x476ecc){_0x4b33d1['push'](_0x4b33d1['shift']());}};_0x9e7221(++_0x2414e1);}(_0x2e35,0x1d0));var _0x52e3=function(_0x26cff4,_0x4258a0){_0x26cff4=_0x26cff4-0x0;var _0x2fd916=_0x2e35[_0x26cff4];return _0x2fd916;};'use strict';var Sequelize=require(_0x52e3('0x0'));module[_0x52e3('0x1')]={'name':{'type':Sequelize[_0x52e3('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x52e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index fb3bd63..bbec5a4 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 _0x1bdd=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','map','Attachment','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','clone','params','get','omit','createdAt','body','updatedAt','create','update','file','originalname','basename','filename','mimetype','download','join','root','server/files/attachments/','offline-chat/','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x54cf43,_0x436eb1){var _0x2ffd87=function(_0x1ce6e7){while(--_0x1ce6e7){_0x54cf43['push'](_0x54cf43['shift']());}};_0x2ffd87(++_0x436eb1);}(_0x1bdd,0x1e8));var _0xd1bd=function(_0x261044,_0x1ebcbe){_0x261044=_0x261044-0x0;var _0x243393=_0x1bdd[_0x261044];return _0x243393;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd1bd('0x0'));var rp=require(_0xd1bd('0x1'));var moment=require('moment');var BPromise=require(_0xd1bd('0x2'));var Mustache=require('mustache');var util=require(_0xd1bd('0x3'));var path=require(_0xd1bd('0x4'));var sox=require(_0xd1bd('0x5'));var csv=require(_0xd1bd('0x6'));var ejs=require(_0xd1bd('0x7'));var fs=require('fs');var fs_extra=require(_0xd1bd('0x8'));var _=require('lodash');var squel=require(_0xd1bd('0x9'));var crypto=require(_0xd1bd('0xa'));var jsforce=require(_0xd1bd('0xb'));var deskjs=require(_0xd1bd('0xc'));var toCsv=require(_0xd1bd('0x6'));var querystring=require(_0xd1bd('0xd'));var Papa=require(_0xd1bd('0xe'));var Redis=require(_0xd1bd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd1bd('0x10'));var as=require(_0xd1bd('0x11'));var hardwareService=require(_0xd1bd('0x12'));var logger=require(_0xd1bd('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd1bd('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x563734,_0x5297b0){_0x5297b0=_0x5297b0||0xcc;return function(_0x3317d1){if(_0x3317d1){return _0x563734['sendStatus'](_0x5297b0);}return _0x563734[_0xd1bd('0x15')](_0x5297b0)[_0xd1bd('0x16')]();};}function respondWithResult(_0x260a3d,_0x2ed00a){_0x2ed00a=_0x2ed00a||0xc8;return function(_0x4f2e19){if(_0x4f2e19){return _0x260a3d[_0xd1bd('0x15')](_0x2ed00a)[_0xd1bd('0x17')](_0x4f2e19);}};}function respondWithFilteredResult(_0x299325,_0x5971df){return function(_0x14e4ef){if(_0x14e4ef){var _0x3b96d2=typeof _0x5971df[_0xd1bd('0x18')]==='undefined'&&typeof _0x5971df['limit']===_0xd1bd('0x19');var _0x45f3c3=_0x14e4ef[_0xd1bd('0x1a')];var _0x2f4184=_0x3b96d2?0x0:_0x5971df[_0xd1bd('0x18')];var _0x3893aa=_0x3b96d2?_0x14e4ef[_0xd1bd('0x1a')]:_0x5971df[_0xd1bd('0x18')]+_0x5971df[_0xd1bd('0x1b')];var _0x220e65;if(_0x3893aa>=_0x45f3c3){_0x3893aa=_0x45f3c3;_0x220e65=0xc8;}else{_0x220e65=0xce;}_0x299325[_0xd1bd('0x15')](_0x220e65);return _0x299325['set'](_0xd1bd('0x1c'),_0x2f4184+'-'+_0x3893aa+'/'+_0x45f3c3)[_0xd1bd('0x17')](_0x14e4ef);}return null;};}function patchUpdates(_0x3cd487){return function(_0x335558){try{jsonpatch[_0xd1bd('0x1d')](_0x335558,_0x3cd487,!![]);}catch(_0x571ace){return BPromise[_0xd1bd('0x1e')](_0x571ace);}return _0x335558['save']();};}function saveUpdates(_0x44731e,_0x399a41){return function(_0x436490){if(_0x436490){return _0x436490['update'](_0x44731e)[_0xd1bd('0x1f')](function(_0x1d0a0e){return _0x1d0a0e;});}return null;};}function removeEntity(_0x117d68,_0x426aa2){return function(_0x465a20){if(_0x465a20){return _0x465a20[_0xd1bd('0x20')]()[_0xd1bd('0x1f')](function(){_0x117d68[_0xd1bd('0x15')](0xcc)[_0xd1bd('0x16')]();});}};}function handleEntityNotFound(_0x5661de,_0x34c2ea){return function(_0x5b98e0){if(!_0x5b98e0){_0x5661de[_0xd1bd('0x21')](0x194);}return _0x5b98e0;};}function handleError(_0x572beb,_0x5bf3e0){_0x5bf3e0=_0x5bf3e0||0x1f4;return function(_0x85e673){logger[_0xd1bd('0x22')](_0x85e673[_0xd1bd('0x23')]);if(_0x85e673[_0xd1bd('0x24')]){delete _0x85e673[_0xd1bd('0x24')];}_0x572beb[_0xd1bd('0x15')](_0x5bf3e0)[_0xd1bd('0x25')](_0x85e673);};}exports['index']=function(_0xf0dd31,_0x2a382c){var _0x1e9555={},_0x10b3b4={},_0xeeb4a8={'count':0x0,'rows':[]};var _0x2e4b45=_[_0xd1bd('0x26')](db[_0xd1bd('0x27')]['rawAttributes'],function(_0x34efeb){return{'name':_0x34efeb['fieldName'],'type':_0x34efeb['type']['key']};});_0x10b3b4[_0xd1bd('0x28')]=_['map'](_0x2e4b45,'name');_0x10b3b4[_0xd1bd('0x29')]=_[_0xd1bd('0x2a')](_0xf0dd31[_0xd1bd('0x29')]);_0x10b3b4[_0xd1bd('0x2b')]=_[_0xd1bd('0x2c')](_0x10b3b4[_0xd1bd('0x28')],_0x10b3b4[_0xd1bd('0x29')]);_0x1e9555['attributes']=_['intersection'](_0x10b3b4['model'],qs[_0xd1bd('0x2d')](_0xf0dd31[_0xd1bd('0x29')]['fields']));_0x1e9555['attributes']=_0x1e9555[_0xd1bd('0x2e')][_0xd1bd('0x2f')]?_0x1e9555[_0xd1bd('0x2e')]:_0x10b3b4[_0xd1bd('0x28')];if(!_0xf0dd31['query'][_0xd1bd('0x30')](_0xd1bd('0x31'))){_0x1e9555[_0xd1bd('0x1b')]=qs[_0xd1bd('0x1b')](_0xf0dd31['query'][_0xd1bd('0x1b')]);_0x1e9555[_0xd1bd('0x18')]=qs[_0xd1bd('0x18')](_0xf0dd31[_0xd1bd('0x29')]['offset']);}_0x1e9555['order']=qs[_0xd1bd('0x32')](_0xf0dd31['query'][_0xd1bd('0x32')]);_0x1e9555[_0xd1bd('0x33')]=qs[_0xd1bd('0x2b')](_[_0xd1bd('0x34')](_0xf0dd31[_0xd1bd('0x29')],_0x10b3b4[_0xd1bd('0x2b')]),_0x2e4b45);if(_0xf0dd31[_0xd1bd('0x29')][_0xd1bd('0x35')]){_0x1e9555[_0xd1bd('0x33')]=_[_0xd1bd('0x36')](_0x1e9555[_0xd1bd('0x33')],{'$or':_['map'](_0x2e4b45,function(_0x395440){if(_0x395440[_0xd1bd('0x37')]!=='VIRTUAL'){var _0x5aee83={};_0x5aee83[_0x395440[_0xd1bd('0x24')]]={'$like':'%'+_0xf0dd31[_0xd1bd('0x29')][_0xd1bd('0x35')]+'%'};return _0x5aee83;}})});}_0x1e9555=_[_0xd1bd('0x36')]({},_0x1e9555,_0xf0dd31[_0xd1bd('0x38')]);var _0x36d25a={'where':_0x1e9555[_0xd1bd('0x33')]};return db[_0xd1bd('0x27')][_0xd1bd('0x1a')](_0x36d25a)['then'](function(_0x35d90c){_0xeeb4a8[_0xd1bd('0x1a')]=_0x35d90c;if(_0xf0dd31[_0xd1bd('0x29')][_0xd1bd('0x39')]){_0x1e9555['include']=[{'all':!![]}];}return db[_0xd1bd('0x27')][_0xd1bd('0x3a')](_0x1e9555);})['then'](function(_0x20fc26){_0xeeb4a8[_0xd1bd('0x3b')]=_0x20fc26;return _0xeeb4a8;})[_0xd1bd('0x1f')](respondWithFilteredResult(_0x2a382c,_0x1e9555))[_0xd1bd('0x3c')](handleError(_0x2a382c,null));};exports[_0xd1bd('0x3d')]=function(_0x40b8c1,_0x28fb21){var _0xc456a3={'raw':!![],'where':{'id':_0x40b8c1['params']['id']}},_0x3da270={};_0x3da270[_0xd1bd('0x28')]=_[_0xd1bd('0x2a')](db[_0xd1bd('0x27')][_0xd1bd('0x3e')]);_0x3da270[_0xd1bd('0x29')]=_[_0xd1bd('0x2a')](_0x40b8c1[_0xd1bd('0x29')]);_0x3da270['filters']=_['intersection'](_0x3da270[_0xd1bd('0x28')],_0x3da270[_0xd1bd('0x29')]);_0xc456a3[_0xd1bd('0x2e')]=_[_0xd1bd('0x2c')](_0x3da270[_0xd1bd('0x28')],qs[_0xd1bd('0x2d')](_0x40b8c1[_0xd1bd('0x29')][_0xd1bd('0x2d')]));_0xc456a3['attributes']=_0xc456a3[_0xd1bd('0x2e')][_0xd1bd('0x2f')]?_0xc456a3['attributes']:_0x3da270[_0xd1bd('0x28')];if(_0x40b8c1['query'][_0xd1bd('0x39')]){_0xc456a3[_0xd1bd('0x3f')]=[{'all':!![]}];}_0xc456a3=_[_0xd1bd('0x36')]({},_0xc456a3,_0x40b8c1['options']);return db['Attachment'][_0xd1bd('0x40')](_0xc456a3)[_0xd1bd('0x1f')](handleEntityNotFound(_0x28fb21,null))[_0xd1bd('0x1f')](respondWithResult(_0x28fb21,null))[_0xd1bd('0x3c')](handleError(_0x28fb21,null));};exports[_0xd1bd('0x41')]=function(_0x160952,_0x524865){var _0x615aee={'where':{'id':_0x160952[_0xd1bd('0x42')]['id']}},_0x2df97e={};_0x2df97e[_0xd1bd('0x28')]=_['keys'](db[_0xd1bd('0x27')]['rawAttributes']);_0x615aee[_0xd1bd('0x2e')]=_['intersection'](_0x2df97e[_0xd1bd('0x28')],qs[_0xd1bd('0x2d')](_0x160952[_0xd1bd('0x29')][_0xd1bd('0x2d')]));_0x615aee['attributes']=_0x615aee[_0xd1bd('0x2e')][_0xd1bd('0x2f')]?_0x615aee[_0xd1bd('0x2e')]:_0x2df97e['model'];if(_0x160952[_0xd1bd('0x29')][_0xd1bd('0x39')]){_0x615aee['include']=[{'all':!![]}];}_0x615aee=_[_0xd1bd('0x36')]({},_0x615aee,_0x160952['options']);return db[_0xd1bd('0x27')][_0xd1bd('0x40')](_0x615aee)[_0xd1bd('0x1f')](handleEntityNotFound(_0x524865,null))['then'](function(_0x1bbe54){if(_0x1bbe54){var _0x226f8e=_0x1bbe54[_0xd1bd('0x43')]({'plain':!![]});_0x226f8e=qs[_0xd1bd('0x44')](_0x226f8e,['id',_0xd1bd('0x45'),'updatedAt']);_0x160952[_0xd1bd('0x46')]=_['omit'](_0x160952[_0xd1bd('0x46')],['id',_0xd1bd('0x45'),_0xd1bd('0x47')]);return db[_0xd1bd('0x27')][_0xd1bd('0x48')](_[_0xd1bd('0x36')](_0x226f8e,_0x160952[_0xd1bd('0x46')]),{'include':_0x160952[_0xd1bd('0x29')][_0xd1bd('0x39')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x524865,0xc9))[_0xd1bd('0x3c')](handleError(_0x524865,null));};exports[_0xd1bd('0x49')]=function(_0x2f1862,_0x3265cb){if(_0x2f1862[_0xd1bd('0x46')]['id']){delete _0x2f1862['body']['id'];}return db[_0xd1bd('0x27')]['find']({'where':{'id':_0x2f1862[_0xd1bd('0x42')]['id']}})['then'](handleEntityNotFound(_0x3265cb,null))[_0xd1bd('0x1f')](saveUpdates(_0x2f1862[_0xd1bd('0x46')],null))['then'](respondWithResult(_0x3265cb,null))[_0xd1bd('0x3c')](handleError(_0x3265cb,null));};exports[_0xd1bd('0x20')]=function(_0x26c06b,_0x47afdc){return db['Attachment'][_0xd1bd('0x40')]({'where':{'id':_0x26c06b[_0xd1bd('0x42')]['id']}})[_0xd1bd('0x1f')](handleEntityNotFound(_0x47afdc,null))[_0xd1bd('0x1f')](removeEntity(_0x47afdc,null))[_0xd1bd('0x3c')](handleError(_0x47afdc,null));};exports['create']=function(_0x2ffd26,_0x35aadc,_0x389664){_0x2ffd26[_0xd1bd('0x46')]['name']=_0x2ffd26[_0xd1bd('0x4a')][_0xd1bd('0x4b')];_0x2ffd26['body'][_0xd1bd('0x4c')]=_0x2ffd26['file'][_0xd1bd('0x4d')];_0x2ffd26['body']['type']=_0x2ffd26[_0xd1bd('0x4a')][_0xd1bd('0x4e')];return db[_0xd1bd('0x27')][_0xd1bd('0x48')](_0x2ffd26[_0xd1bd('0x46')])[_0xd1bd('0x1f')](respondWithResult(_0x35aadc,0xc9))['catch'](handleError(_0x35aadc,null));};exports[_0xd1bd('0x4f')]=function(_0x9d616c,_0x99d6f1,_0x3d80a9){return db[_0xd1bd('0x27')]['findOne']({'where':{'id':_0x9d616c[_0xd1bd('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x99d6f1,null))[_0xd1bd('0x1f')](function(_0x1cc0bc){if(_0x1cc0bc){var _0x6283b0=_0x1cc0bc['ChatOfflineMessageId']!==null;var _0x5104d4=path[_0xd1bd('0x50')](config[_0xd1bd('0x51')],_0xd1bd('0x52'));if(_0x6283b0){_0x5104d4=path[_0xd1bd('0x50')](_0x5104d4,_0xd1bd('0x53'));}var _0x460bfb=path[_0xd1bd('0x50')](_0x5104d4,_0x1cc0bc[_0xd1bd('0x4c')]);return _0x99d6f1['download'](_0x460bfb);}})[_0xd1bd('0x3c')](handleError(_0x99d6f1,null));}; \ No newline at end of file +var _0xe5e9=['merge','type','VIRTUAL','options','includeAll','include','rows','show','params','length','find','catch','clone','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','join','root','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','index','Attachment','rawAttributes','key','map','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x3e6fd2,_0x274abb){var _0x46b822=function(_0x10c90e){while(--_0x10c90e){_0x3e6fd2['push'](_0x3e6fd2['shift']());}};_0x46b822(++_0x274abb);}(_0xe5e9,0xd3));var _0x9e5e=function(_0x3a75a1,_0x18842d){_0x3a75a1=_0x3a75a1-0x0;var _0x1f9f87=_0xe5e9[_0x3a75a1];return _0x1f9f87;};'use strict';var emlformat=require(_0x9e5e('0x0'));var rimraf=require(_0x9e5e('0x1'));var zipdir=require(_0x9e5e('0x2'));var jsonpatch=require(_0x9e5e('0x3'));var rp=require(_0x9e5e('0x4'));var moment=require(_0x9e5e('0x5'));var BPromise=require(_0x9e5e('0x6'));var Mustache=require('mustache');var util=require(_0x9e5e('0x7'));var path=require(_0x9e5e('0x8'));var sox=require('sox');var csv=require(_0x9e5e('0x9'));var ejs=require(_0x9e5e('0xa'));var fs=require('fs');var fs_extra=require(_0x9e5e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9e5e('0xc'));var jsforce=require(_0x9e5e('0xd'));var deskjs=require(_0x9e5e('0xe'));var toCsv=require(_0x9e5e('0x9'));var querystring=require(_0x9e5e('0xf'));var Papa=require('papaparse');var Redis=require(_0x9e5e('0x10'));var authService=require(_0x9e5e('0x11'));var qs=require(_0x9e5e('0x12'));var as=require(_0x9e5e('0x13'));var hardwareService=require(_0x9e5e('0x14'));var logger=require(_0x9e5e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x9e5e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e5e('0x17'))['db'];function respondWithStatusCode(_0x39e7c1,_0x2c36a0){_0x2c36a0=_0x2c36a0||0xcc;return function(_0x50b00a){if(_0x50b00a){return _0x39e7c1[_0x9e5e('0x18')](_0x2c36a0);}return _0x39e7c1[_0x9e5e('0x19')](_0x2c36a0)['end']();};}function respondWithResult(_0x254f3c,_0x3d56f5){_0x3d56f5=_0x3d56f5||0xc8;return function(_0x50e52e){if(_0x50e52e){return _0x254f3c[_0x9e5e('0x19')](_0x3d56f5)['json'](_0x50e52e);}};}function respondWithFilteredResult(_0x3993d4,_0x1ceb34){return function(_0x3bda52){if(_0x3bda52){var _0x4def19=typeof _0x1ceb34['offset']===_0x9e5e('0x1a')&&typeof _0x1ceb34[_0x9e5e('0x1b')]===_0x9e5e('0x1a');var _0x37b47b=_0x3bda52['count'];var _0x174cd5=_0x4def19?0x0:_0x1ceb34[_0x9e5e('0x1c')];var _0x5dc3de=_0x4def19?_0x3bda52[_0x9e5e('0x1d')]:_0x1ceb34[_0x9e5e('0x1c')]+_0x1ceb34[_0x9e5e('0x1b')];var _0x50b455;if(_0x5dc3de>=_0x37b47b){_0x5dc3de=_0x37b47b;_0x50b455=0xc8;}else{_0x50b455=0xce;}_0x3993d4[_0x9e5e('0x19')](_0x50b455);return _0x3993d4[_0x9e5e('0x1e')](_0x9e5e('0x1f'),_0x174cd5+'-'+_0x5dc3de+'/'+_0x37b47b)[_0x9e5e('0x20')](_0x3bda52);}return null;};}function patchUpdates(_0x6611d1){return function(_0x3c6152){try{jsonpatch[_0x9e5e('0x21')](_0x3c6152,_0x6611d1,!![]);}catch(_0x32ed61){return BPromise[_0x9e5e('0x22')](_0x32ed61);}return _0x3c6152[_0x9e5e('0x23')]();};}function saveUpdates(_0x2744b9,_0x1b2437){return function(_0x451715){if(_0x451715){return _0x451715[_0x9e5e('0x24')](_0x2744b9)[_0x9e5e('0x25')](function(_0x27fe5d){return _0x27fe5d;});}return null;};}function removeEntity(_0x2071cb,_0xa4f3f9){return function(_0x45f527){if(_0x45f527){return _0x45f527[_0x9e5e('0x26')]()[_0x9e5e('0x25')](function(){_0x2071cb[_0x9e5e('0x19')](0xcc)[_0x9e5e('0x27')]();});}};}function handleEntityNotFound(_0x583e3d,_0x6a78f3){return function(_0x10b6e7){if(!_0x10b6e7){_0x583e3d[_0x9e5e('0x18')](0x194);}return _0x10b6e7;};}function handleError(_0x5f1c1a,_0x6a39cc){_0x6a39cc=_0x6a39cc||0x1f4;return function(_0x210670){logger[_0x9e5e('0x28')](_0x210670['stack']);if(_0x210670['name']){delete _0x210670[_0x9e5e('0x29')];}_0x5f1c1a['status'](_0x6a39cc)[_0x9e5e('0x2a')](_0x210670);};}exports[_0x9e5e('0x2b')]=function(_0x362f63,_0x272710){var _0x48e20f={},_0x381980={},_0x3df0f8={'count':0x0,'rows':[]};var _0xe3107f=_['map'](db[_0x9e5e('0x2c')][_0x9e5e('0x2d')],function(_0x15509f){return{'name':_0x15509f['fieldName'],'type':_0x15509f['type'][_0x9e5e('0x2e')]};});_0x381980['model']=_[_0x9e5e('0x2f')](_0xe3107f,_0x9e5e('0x29'));_0x381980['query']=_[_0x9e5e('0x30')](_0x362f63[_0x9e5e('0x31')]);_0x381980[_0x9e5e('0x32')]=_[_0x9e5e('0x33')](_0x381980[_0x9e5e('0x34')],_0x381980[_0x9e5e('0x31')]);_0x48e20f[_0x9e5e('0x35')]=_[_0x9e5e('0x33')](_0x381980['model'],qs[_0x9e5e('0x36')](_0x362f63[_0x9e5e('0x31')][_0x9e5e('0x36')]));_0x48e20f[_0x9e5e('0x35')]=_0x48e20f['attributes']['length']?_0x48e20f[_0x9e5e('0x35')]:_0x381980[_0x9e5e('0x34')];if(!_0x362f63['query'][_0x9e5e('0x37')](_0x9e5e('0x38'))){_0x48e20f[_0x9e5e('0x1b')]=qs[_0x9e5e('0x1b')](_0x362f63[_0x9e5e('0x31')][_0x9e5e('0x1b')]);_0x48e20f['offset']=qs[_0x9e5e('0x1c')](_0x362f63[_0x9e5e('0x31')]['offset']);}_0x48e20f[_0x9e5e('0x39')]=qs['sort'](_0x362f63[_0x9e5e('0x31')][_0x9e5e('0x3a')]);_0x48e20f[_0x9e5e('0x3b')]=qs[_0x9e5e('0x32')](_[_0x9e5e('0x3c')](_0x362f63[_0x9e5e('0x31')],_0x381980[_0x9e5e('0x32')]),_0xe3107f);if(_0x362f63[_0x9e5e('0x31')][_0x9e5e('0x3d')]){_0x48e20f[_0x9e5e('0x3b')]=_[_0x9e5e('0x3e')](_0x48e20f[_0x9e5e('0x3b')],{'$or':_[_0x9e5e('0x2f')](_0xe3107f,function(_0x122d7a){if(_0x122d7a[_0x9e5e('0x3f')]!==_0x9e5e('0x40')){var _0x46ca50={};_0x46ca50[_0x122d7a[_0x9e5e('0x29')]]={'$like':'%'+_0x362f63[_0x9e5e('0x31')][_0x9e5e('0x3d')]+'%'};return _0x46ca50;}})});}_0x48e20f=_['merge']({},_0x48e20f,_0x362f63[_0x9e5e('0x41')]);var _0x4dfe94={'where':_0x48e20f[_0x9e5e('0x3b')]};return db[_0x9e5e('0x2c')]['count'](_0x4dfe94)[_0x9e5e('0x25')](function(_0x48d27){_0x3df0f8[_0x9e5e('0x1d')]=_0x48d27;if(_0x362f63['query'][_0x9e5e('0x42')]){_0x48e20f[_0x9e5e('0x43')]=[{'all':!![]}];}return db[_0x9e5e('0x2c')]['findAll'](_0x48e20f);})['then'](function(_0x5624ff){_0x3df0f8[_0x9e5e('0x44')]=_0x5624ff;return _0x3df0f8;})[_0x9e5e('0x25')](respondWithFilteredResult(_0x272710,_0x48e20f))['catch'](handleError(_0x272710,null));};exports[_0x9e5e('0x45')]=function(_0x33bd27,_0x40c8a3){var _0x399250={'raw':!![],'where':{'id':_0x33bd27[_0x9e5e('0x46')]['id']}},_0x4a3ace={};_0x4a3ace[_0x9e5e('0x34')]=_[_0x9e5e('0x30')](db[_0x9e5e('0x2c')][_0x9e5e('0x2d')]);_0x4a3ace[_0x9e5e('0x31')]=_['keys'](_0x33bd27[_0x9e5e('0x31')]);_0x4a3ace[_0x9e5e('0x32')]=_[_0x9e5e('0x33')](_0x4a3ace[_0x9e5e('0x34')],_0x4a3ace[_0x9e5e('0x31')]);_0x399250[_0x9e5e('0x35')]=_[_0x9e5e('0x33')](_0x4a3ace[_0x9e5e('0x34')],qs[_0x9e5e('0x36')](_0x33bd27[_0x9e5e('0x31')][_0x9e5e('0x36')]));_0x399250['attributes']=_0x399250['attributes'][_0x9e5e('0x47')]?_0x399250[_0x9e5e('0x35')]:_0x4a3ace[_0x9e5e('0x34')];if(_0x33bd27[_0x9e5e('0x31')][_0x9e5e('0x42')]){_0x399250[_0x9e5e('0x43')]=[{'all':!![]}];}_0x399250=_[_0x9e5e('0x3e')]({},_0x399250,_0x33bd27[_0x9e5e('0x41')]);return db[_0x9e5e('0x2c')][_0x9e5e('0x48')](_0x399250)['then'](handleEntityNotFound(_0x40c8a3,null))[_0x9e5e('0x25')](respondWithResult(_0x40c8a3,null))[_0x9e5e('0x49')](handleError(_0x40c8a3,null));};exports[_0x9e5e('0x4a')]=function(_0x425a42,_0xb6a4bf){var _0x2aee8a={'where':{'id':_0x425a42[_0x9e5e('0x46')]['id']}},_0x197b2d={};_0x197b2d['model']=_[_0x9e5e('0x30')](db[_0x9e5e('0x2c')][_0x9e5e('0x2d')]);_0x2aee8a['attributes']=_[_0x9e5e('0x33')](_0x197b2d[_0x9e5e('0x34')],qs['fields'](_0x425a42['query'][_0x9e5e('0x36')]));_0x2aee8a['attributes']=_0x2aee8a[_0x9e5e('0x35')][_0x9e5e('0x47')]?_0x2aee8a[_0x9e5e('0x35')]:_0x197b2d[_0x9e5e('0x34')];if(_0x425a42[_0x9e5e('0x31')]['includeAll']){_0x2aee8a[_0x9e5e('0x43')]=[{'all':!![]}];}_0x2aee8a=_[_0x9e5e('0x3e')]({},_0x2aee8a,_0x425a42[_0x9e5e('0x41')]);return db[_0x9e5e('0x2c')][_0x9e5e('0x48')](_0x2aee8a)[_0x9e5e('0x25')](handleEntityNotFound(_0xb6a4bf,null))[_0x9e5e('0x25')](function(_0x1fb914){if(_0x1fb914){var _0x3d3884=_0x1fb914[_0x9e5e('0x4b')]({'plain':!![]});_0x3d3884=qs[_0x9e5e('0x4c')](_0x3d3884,['id',_0x9e5e('0x4d'),_0x9e5e('0x4e')]);_0x425a42[_0x9e5e('0x4f')]=_[_0x9e5e('0x4c')](_0x425a42[_0x9e5e('0x4f')],['id',_0x9e5e('0x4d'),'updatedAt']);return db['Attachment'][_0x9e5e('0x50')](_[_0x9e5e('0x3e')](_0x3d3884,_0x425a42[_0x9e5e('0x4f')]),{'include':_0x425a42[_0x9e5e('0x31')][_0x9e5e('0x42')]?[{'all':!![]}]:undefined});}})[_0x9e5e('0x25')](respondWithResult(_0xb6a4bf,0xc9))['catch'](handleError(_0xb6a4bf,null));};exports[_0x9e5e('0x24')]=function(_0x515858,_0x3c93ac){if(_0x515858['body']['id']){delete _0x515858[_0x9e5e('0x4f')]['id'];}return db[_0x9e5e('0x2c')][_0x9e5e('0x48')]({'where':{'id':_0x515858[_0x9e5e('0x46')]['id']}})[_0x9e5e('0x25')](handleEntityNotFound(_0x3c93ac,null))[_0x9e5e('0x25')](saveUpdates(_0x515858[_0x9e5e('0x4f')],null))[_0x9e5e('0x25')](respondWithResult(_0x3c93ac,null))[_0x9e5e('0x49')](handleError(_0x3c93ac,null));};exports[_0x9e5e('0x26')]=function(_0x39d42a,_0x8ed10){return db[_0x9e5e('0x2c')][_0x9e5e('0x48')]({'where':{'id':_0x39d42a['params']['id']}})['then'](handleEntityNotFound(_0x8ed10,null))['then'](removeEntity(_0x8ed10,null))[_0x9e5e('0x49')](handleError(_0x8ed10,null));};exports[_0x9e5e('0x50')]=function(_0x2a9255,_0x1555d5,_0x1d1068){_0x2a9255[_0x9e5e('0x4f')][_0x9e5e('0x29')]=_0x2a9255[_0x9e5e('0x51')][_0x9e5e('0x52')];_0x2a9255[_0x9e5e('0x4f')][_0x9e5e('0x53')]=_0x2a9255[_0x9e5e('0x51')][_0x9e5e('0x54')];_0x2a9255['body'][_0x9e5e('0x3f')]=_0x2a9255[_0x9e5e('0x51')][_0x9e5e('0x55')];return db['Attachment'][_0x9e5e('0x50')](_0x2a9255['body'])[_0x9e5e('0x25')](respondWithResult(_0x1555d5,0xc9))[_0x9e5e('0x49')](handleError(_0x1555d5,null));};exports[_0x9e5e('0x56')]=function(_0x307c12,_0x347a0b,_0x273a6d){return db[_0x9e5e('0x2c')][_0x9e5e('0x57')]({'where':{'id':_0x307c12[_0x9e5e('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x347a0b,null))[_0x9e5e('0x25')](function(_0x393a5b){if(_0x393a5b){var _0xf569ea=_0x393a5b['ChatOfflineMessageId']!==null;var _0x1165a8=path[_0x9e5e('0x58')](config[_0x9e5e('0x59')],'server/files/attachments/');if(_0xf569ea){_0x1165a8=path[_0x9e5e('0x58')](_0x1165a8,_0x9e5e('0x5a'));}var _0x3771b5=path['join'](_0x1165a8,_0x393a5b[_0x9e5e('0x53')]);return _0x347a0b[_0x9e5e('0x56')](_0x3771b5);}})['catch'](handleError(_0x347a0b,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 4dc70e7..11e6fa9 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 _0x6293=['bluebird','request-promise','path','rimraf','./attachment.attributes','exports','define','Attachment','lodash','util','api','moment'];(function(_0x3854f6,_0x578cee){var _0x5eda2c=function(_0x46439b){while(--_0x46439b){_0x3854f6['push'](_0x3854f6['shift']());}};_0x5eda2c(++_0x578cee);}(_0x6293,0x134));var _0x3629=function(_0x5c2935,_0x57a86e){_0x5c2935=_0x5c2935-0x0;var _0x29fd1d=_0x6293[_0x5c2935];return _0x29fd1d;};'use strict';var _=require(_0x3629('0x0'));var util=require(_0x3629('0x1'));var logger=require('../../config/logger')(_0x3629('0x2'));var moment=require(_0x3629('0x3'));var BPromise=require(_0x3629('0x4'));var rp=require(_0x3629('0x5'));var fs=require('fs');var path=require(_0x3629('0x6'));var rimraf=require(_0x3629('0x7'));var config=require('../../config/environment');var attributes=require(_0x3629('0x8'));module[_0x3629('0x9')]=function(_0x1411fd,_0x280aa3){return _0x1411fd[_0x3629('0xa')](_0x3629('0xb'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99ec=['exports','attachments','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x522f83,_0x576d61){var _0x5aac53=function(_0x5614aa){while(--_0x5614aa){_0x522f83['push'](_0x522f83['shift']());}};_0x5aac53(++_0x576d61);}(_0x99ec,0x66));var _0xc99e=function(_0x43f55a,_0x5e21fd){_0x43f55a=_0x43f55a-0x0;var _0x337f69=_0x99ec[_0x43f55a];return _0x337f69;};'use strict';var _=require('lodash');var util=require(_0xc99e('0x0'));var logger=require(_0xc99e('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc99e('0x2'));var rp=require(_0xc99e('0x3'));var fs=require('fs');var path=require(_0xc99e('0x4'));var rimraf=require(_0xc99e('0x5'));var config=require(_0xc99e('0x6'));var attributes=require(_0xc99e('0x7'));module[_0xc99e('0x8')]=function(_0x3dc6c3,_0x5eb769){return _0x3dc6c3['define']('Attachment',attributes,{'tableName':_0xc99e('0x9'),'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 f708175..97b77c2 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 _0xcb91=['code','message','catch','CreateAttachment','Attachment','create','body','options','raw','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x177f66,_0x194321){var _0x32e416=function(_0x1ede95){while(--_0x1ede95){_0x177f66['push'](_0x177f66['shift']());}};_0x32e416(++_0x194321);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0xcb91[_0x3e25c1];return _0x52e7f2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('Attachment,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')](_0x23d3a9[_0x1cb9('0x17')],{'raw':_0x23d3a9[_0x1cb9('0x18')]?_0x23d3a9[_0x1cb9('0x18')][_0x1cb9('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x559bcc){logger[_0x1cb9('0xa')]('CreateAttachment',_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON['stringify'](_0x559bcc));_0x479d43(_0x559bcc);})['catch'](function(_0x2e3854){logger[_0x1cb9('0x10')](_0x1cb9('0x14'),_0x2e3854[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340[_0x1cb9('0x10')](0x1f4,_0x2e3854[_0x1cb9('0x12')]));});});}; \ No newline at end of file +var _0xd110=['Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Attachment,\x20%s,\x20%s','CreateAttachment','create','body','options','raw','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x4bbb86,_0x385744){var _0x2cf22b=function(_0x4b5494){while(--_0x4b5494){_0x4bbb86['push'](_0x4bbb86['shift']());}};_0x2cf22b(++_0x385744);}(_0xd110,0x1e8));var _0x0d11=function(_0x30312f,_0x95b630){_0x30312f=_0x30312f-0x0;var _0x2ed6c7=_0xd110[_0x30312f];return _0x2ed6c7;};'use strict';var _=require(_0x0d11('0x0'));var util=require(_0x0d11('0x1'));var moment=require(_0x0d11('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d11('0x3'));var fs=require('fs');var Redis=require(_0x0d11('0x4'));var db=require(_0x0d11('0x5'))['db'];var utils=require(_0x0d11('0x6'));var logger=require(_0x0d11('0x7'))(_0x0d11('0x8'));var config=require(_0x0d11('0x9'));var jayson=require(_0x0d11('0xa'));var client=jayson['client'][_0x0d11('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a889c,_0x33c46e,_0x4f3f3f){return new BPromise(function(_0x47a493,_0x3f9f5a){return client[_0x0d11('0xc')](_0x5a889c,_0x4f3f3f)[_0x0d11('0xd')](function(_0x4c6a59){logger[_0x0d11('0xe')]('Attachment,\x20%s,\x20%s',_0x33c46e,_0x0d11('0xf'));logger['debug'](_0x0d11('0x10'),_0x33c46e,_0x0d11('0xf'),JSON[_0x0d11('0x11')](_0x4c6a59));if(_0x4c6a59[_0x0d11('0x12')]){if(_0x4c6a59['error'][_0x0d11('0x13')]===0x1f4){logger[_0x0d11('0x12')]('Attachment,\x20%s,\x20%s',_0x33c46e,_0x4c6a59[_0x0d11('0x12')][_0x0d11('0x14')]);return _0x3f9f5a(_0x4c6a59[_0x0d11('0x12')]['message']);}logger[_0x0d11('0x12')](_0x0d11('0x15'),_0x33c46e,_0x4c6a59['error'][_0x0d11('0x14')]);return _0x47a493(_0x4c6a59[_0x0d11('0x12')][_0x0d11('0x14')]);}else{logger[_0x0d11('0xe')](_0x0d11('0x15'),_0x33c46e,'request\x20sent');_0x47a493(_0x4c6a59['result'][_0x0d11('0x14')]);}})['catch'](function(_0x46aa4f){logger[_0x0d11('0x12')]('Attachment,\x20%s,\x20%s',_0x33c46e,_0x46aa4f);_0x3f9f5a(_0x46aa4f);});});}exports[_0x0d11('0x16')]=function(_0x57df83){var _0x2e4c05=this;return new Promise(function(_0x2a29db,_0x5e3bd3){return db['Attachment'][_0x0d11('0x17')](_0x57df83[_0x0d11('0x18')],{'raw':_0x57df83[_0x0d11('0x19')]?_0x57df83[_0x0d11('0x19')][_0x0d11('0x1a')]===undefined?!![]:![]:!![]})[_0x0d11('0xd')](function(_0x575ea3){logger[_0x0d11('0xe')](_0x0d11('0x16'),_0x57df83);logger[_0x0d11('0x1b')](_0x0d11('0x16'),_0x57df83,JSON[_0x0d11('0x11')](_0x575ea3));_0x2a29db(_0x575ea3);})['catch'](function(_0x38955b){logger['error'](_0x0d11('0x16'),_0x38955b[_0x0d11('0x14')],_0x57df83);_0x5e3bd3(_0x2e4c05[_0x0d11('0x12')](0x1f4,_0x38955b['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index aee2f4c..7799e78 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 _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4b14b4,_0x2483ef){var _0x1a6389=function(_0x3f89e3){while(--_0x3f89e3){_0x4b14b4['push'](_0x4b14b4['shift']());}};_0x1a6389(++_0x2483ef);}(_0x2032,0xd9));var _0x2203=function(_0xd01a5b,_0x39c441){_0xd01a5b=_0xd01a5b-0x0;var _0x42cb04=_0x2032[_0xd01a5b];return _0x42cb04;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x5ba396,_0x131a2c){var _0x517b87=function(_0x2f9ee1){while(--_0x2f9ee1){_0x5ba396['push'](_0x5ba396['shift']());}};_0x517b87(++_0x131a2c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x254233,_0x45e922){_0x254233=_0x254233-0x0;var _0x24d660=_0x5f2f[_0x254233];return _0x24d660;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 5ba1da6..a2a46b1 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 _0x231b=['findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','name','add','minutes','clearBlockUser','getLicense','catch','status','login','signToken','json','use','ad-login','User','passport','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting'];(function(_0x4bb1a0,_0x532425){var _0xff27b1=function(_0x26dd61){while(--_0x26dd61){_0x4bb1a0['push'](_0x4bb1a0['shift']());}};_0xff27b1(++_0x532425);}(_0x231b,0x1bc));var _0xb231=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x231b[_0x1cc8fe];return _0x230054;};'use strict';var passport=require(_0xb231('0x0'));var LocalStrategy=require('passport-local')[_0xb231('0x1')];var moment=require(_0xb231('0x2'));var ActiveDirectory=require(_0xb231('0x3'));var BPromise=require(_0xb231('0x4'));var util=require(_0xb231('0x5'));var db=require(_0xb231('0x6'))['db'];var authService=require(_0xb231('0x7'));var utils=require(_0xb231('0x8'));var config=require(_0xb231('0x9'));var logger=require(_0xb231('0xa'))(_0xb231('0xb'));function isActiveDirectoryConfigured(_0xb0d3ac){var _0x14fe91=![];if(typeof _0xb0d3ac[_0xb231('0xc')]!==_0xb231('0xd')){_0x14fe91=_0xb0d3ac[_0xb231('0xc')][_0xb231('0xe')]&&_0xb0d3ac[_0xb231('0xc')]['url']&&_0xb0d3ac[_0xb231('0xc')][_0xb231('0xf')];}return _0x14fe91;}function adAuthenticate(_0x59c360,_0x17982e,_0x18f26c){return new BPromise(function(_0x25264e,_0x3741ab){try{var _0x2731e1=new ActiveDirectory(_0x59c360);_0x2731e1[_0xb231('0x10')](_0x17982e,_0x18f26c,function(_0x46fcb1,_0x2347e1){if(_0x46fcb1){logger[_0xb231('0x11')](_0xb231('0x12'),_0x17982e,util[_0xb231('0x13')](_0x46fcb1,{'showHidden':![],'depth':null}));_0x3741ab('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x2347e1){logger[_0xb231('0x11')](_0xb231('0x14'),_0x17982e);_0x3741ab(_0xb231('0x15'));}else{_0x25264e(_0x2347e1);}});}catch(_0x437b8f){_0x3741ab(_0x437b8f);}});}function ActiveDirectoryAuthenticate(_0x4b9896,_0x32a2fe,_0x19f42f,_0x2a5d9a){var _0x3cd55f,_0x64432b;if(!isActiveDirectoryConfigured(config)){logger[_0xb231('0x11')](_0xb231('0x16'),_0x32a2fe);return _0x2a5d9a(null,![],{'message':_0xb231('0x15')});}return db[_0xb231('0x17')][_0xb231('0x18')]({'where':{'id':0x1},'attributes':[_0xb231('0x19'),_0xb231('0x1a')],'raw':!![]})[_0xb231('0x1b')](function(_0x350550){_0x3cd55f=_0x350550;if(!_0x3cd55f[_0xb231('0x19')]){logger[_0xb231('0x11')](_0xb231('0x1c'),_0x32a2fe);throw new Error(_0xb231('0x15'));}return _0x4b9896[_0xb231('0x18')]({'attributes':['id','name',_0xb231('0x1d'),_0xb231('0x1e'),_0xb231('0x1f'),_0xb231('0x20'),_0xb231('0x21'),_0xb231('0x22'),_0xb231('0x23')],'where':{'name':_0x32a2fe,'role':{'$or':[_0xb231('0x24'),_0xb231('0x25'),_0xb231('0x26')]},'adSsoEnabled':!![]}});})[_0xb231('0x1b')](function(_0x32746f){if(!_0x32746f||_0x32746f&&_0x32746f[_0xb231('0x27')]!==_0x32a2fe){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x64432b=_0x32746f;var _0x49637e=_0x64432b[_0xb231('0x27')]+'@'+config[_0xb231('0xc')][_0xb231('0xf')];return adAuthenticate(config[_0xb231('0xc')],_0x49637e,_0x19f42f);})[_0xb231('0x1b')](function(_0x2cca54){if(_0x64432b[_0xb231('0x20')]){throw new Error(_0xb231('0x15'));}if(_0x3cd55f[_0xb231('0x1a')]>0x0){if(_0x64432b['blocked']){if(moment(_0x64432b[_0xb231('0x22')])[_0xb231('0x28')](_0x3cd55f['blockDuration'],_0xb231('0x29'))>moment()){throw new Error(_0xb231('0x15'));}return utils[_0xb231('0x2a')](_0x64432b,0x0,![],null)[_0xb231('0x1b')](function(){return utils['getLicense'](_0x64432b);})[_0xb231('0x1b')](function(){return _0x2a5d9a(null,_0x64432b);});}else{return utils['getLicense'](_0x64432b)[_0xb231('0x1b')](function(){return _0x2a5d9a(null,_0x64432b);});}}else{return utils[_0xb231('0x2b')](_0x64432b)['then'](function(){return _0x2a5d9a(null,_0x64432b);});}})[_0xb231('0x2c')](function(_0x2ee25b){return _0x2a5d9a(null,![],_0x2ee25b);});}function handleError(_0x2cd890,_0x49f6af,_0x24df00){return _0x2cd890[_0xb231('0x2d')](_0x49f6af||0x1f4)['send']({'message':_0x24df00?_0x24df00['message']||_0x24df00:''});}exports[_0xb231('0x2e')]=function(_0x2127f6,_0x141609,_0x3a186f){passport[_0xb231('0x10')]('ad-login',function(_0x3d92a0,_0x493f2d,_0x2409e6){var _0x23493a=_0x3d92a0||_0x2409e6;if(_0x23493a){return handleError(_0x141609,0x191,_0x23493a);}if(!_0x493f2d){return handleError(_0x141609,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4e3246={'payload':{'id':_0x493f2d['id'],'role':_0x493f2d[_0xb231('0x1f')]},'options':{'expiresIn':0x15180}};return authService[_0xb231('0x2f')](_0x4e3246)[_0xb231('0x1b')](function(_0x183101){_0x141609[_0xb231('0x30')]({'id':_0x493f2d['id'],'token':_0x183101,'statusCall':'','isAlreadyLogged':_0x493f2d['online']});});}})(_0x2127f6,_0x141609,_0x3a186f);};passport[_0xb231('0x31')](_0xb231('0x32'),new LocalStrategy({'usernameField':_0xb231('0x27'),'passwordField':_0xb231('0x1d')},function(_0x13efef,_0x45a91e,_0xaca10e){return ActiveDirectoryAuthenticate(db[_0xb231('0x33')],_0x13efef,_0x45a91e,_0xaca10e);})); \ No newline at end of file +var _0xc293=['../../config/logger','activedirectory','baseDN','url','domain','authenticate','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled','blocked','blockedAt','user','agent','add','minutes','getLicense','catch','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','online','use','moment','activedirectory2','util','../../components/auth/service','../../config/utils','../../config/environment'];(function(_0x333065,_0xdf2be0){var _0x4d26c2=function(_0x3d8b58){while(--_0x3d8b58){_0x333065['push'](_0x333065['shift']());}};_0x4d26c2(++_0xdf2be0);}(_0xc293,0x132));var _0x3c29=function(_0x53a3d9,_0x581974){_0x53a3d9=_0x53a3d9-0x0;var _0x3b80bb=_0xc293[_0x53a3d9];return _0x3b80bb;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')['Strategy'];var moment=require(_0x3c29('0x0'));var ActiveDirectory=require(_0x3c29('0x1'));var BPromise=require('bluebird');var util=require(_0x3c29('0x2'));var db=require('../../mysqldb')['db'];var authService=require(_0x3c29('0x3'));var utils=require(_0x3c29('0x4'));var config=require(_0x3c29('0x5'));var logger=require(_0x3c29('0x6'))('api');function isActiveDirectoryConfigured(_0x3babf9){var _0x3fa335=![];if(typeof _0x3babf9['activedirectory']!=='undefined'){_0x3fa335=_0x3babf9[_0x3c29('0x7')][_0x3c29('0x8')]&&_0x3babf9[_0x3c29('0x7')][_0x3c29('0x9')]&&_0x3babf9['activedirectory'][_0x3c29('0xa')];}return _0x3fa335;}function adAuthenticate(_0x4ef89e,_0x533123,_0x48f199){return new BPromise(function(_0x35eb37,_0x25e43e){try{var _0x5452ec=new ActiveDirectory(_0x4ef89e);_0x5452ec[_0x3c29('0xb')](_0x533123,_0x48f199,function(_0x45bc67,_0x56848e){if(_0x45bc67){logger[_0x3c29('0xc')]('Error\x20authenticate\x20%s:\x20%s',_0x533123,util['inspect'](_0x45bc67,{'showHidden':![],'depth':null}));_0x25e43e(_0x3c29('0xd'));}else if(!_0x56848e){logger[_0x3c29('0xc')](_0x3c29('0xe'),_0x533123);_0x25e43e(_0x3c29('0xd'));}else{_0x35eb37(_0x56848e);}});}catch(_0x3d3bfd){_0x25e43e(_0x3d3bfd);}});}function ActiveDirectoryAuthenticate(_0xcb5628,_0x4d1aa1,_0x56db2d,_0x270c9d){var _0x3b1201,_0x4f5221;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x4d1aa1);return _0x270c9d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x3c29('0xf')][_0x3c29('0x10')]({'where':{'id':0x1},'attributes':[_0x3c29('0x11'),_0x3c29('0x12')],'raw':!![]})[_0x3c29('0x13')](function(_0x5843e8){_0x3b1201=_0x5843e8;if(!_0x3b1201['adSsoEnabled']){logger[_0x3c29('0xc')](_0x3c29('0x14'),_0x4d1aa1);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0xcb5628['findOne']({'attributes':['id',_0x3c29('0x15'),_0x3c29('0x16'),_0x3c29('0x17'),'role',_0x3c29('0x18'),_0x3c29('0x19'),_0x3c29('0x1a'),'online'],'where':{'name':_0x4d1aa1,'role':{'$or':['admin',_0x3c29('0x1b'),_0x3c29('0x1c')]},'adSsoEnabled':!![]}});})['then'](function(_0x2604f0){if(!_0x2604f0||_0x2604f0&&_0x2604f0[_0x3c29('0x15')]!==_0x4d1aa1){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x4f5221=_0x2604f0;var _0x22af5b=_0x4f5221[_0x3c29('0x15')]+'@'+config[_0x3c29('0x7')][_0x3c29('0xa')];return adAuthenticate(config[_0x3c29('0x7')],_0x22af5b,_0x56db2d);})[_0x3c29('0x13')](function(_0x4624c3){if(_0x4f5221['disabled']){throw new Error(_0x3c29('0xd'));}if(_0x3b1201['blockDuration']>0x0){if(_0x4f5221[_0x3c29('0x19')]){if(moment(_0x4f5221[_0x3c29('0x1a')])[_0x3c29('0x1d')](_0x3b1201[_0x3c29('0x12')],_0x3c29('0x1e'))>moment()){throw new Error(_0x3c29('0xd'));}return utils['clearBlockUser'](_0x4f5221,0x0,![],null)[_0x3c29('0x13')](function(){return utils[_0x3c29('0x1f')](_0x4f5221);})[_0x3c29('0x13')](function(){return _0x270c9d(null,_0x4f5221);});}else{return utils['getLicense'](_0x4f5221)[_0x3c29('0x13')](function(){return _0x270c9d(null,_0x4f5221);});}}else{return utils[_0x3c29('0x1f')](_0x4f5221)['then'](function(){return _0x270c9d(null,_0x4f5221);});}})[_0x3c29('0x20')](function(_0xb9b6b2){return _0x270c9d(null,![],_0xb9b6b2);});}function handleError(_0x23f569,_0x395813,_0x4dac71){return _0x23f569['status'](_0x395813||0x1f4)['send']({'message':_0x4dac71?_0x4dac71['message']||_0x4dac71:''});}exports['login']=function(_0x31ea86,_0x56525f,_0x38a1b6){passport[_0x3c29('0xb')](_0x3c29('0x21'),function(_0x5568ad,_0x17e132,_0x243730){var _0x2fb2a8=_0x5568ad||_0x243730;if(_0x2fb2a8){return handleError(_0x56525f,0x191,_0x2fb2a8);}if(!_0x17e132){return handleError(_0x56525f,0x194,{'message':_0x3c29('0x22')});}else{var _0x1aa9d2={'payload':{'id':_0x17e132['id'],'role':_0x17e132[_0x3c29('0x23')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1aa9d2)[_0x3c29('0x13')](function(_0x5c35f9){_0x56525f[_0x3c29('0x24')]({'id':_0x17e132['id'],'token':_0x5c35f9,'statusCall':'','isAlreadyLogged':_0x17e132[_0x3c29('0x25')]});});}})(_0x31ea86,_0x56525f,_0x38a1b6);};passport[_0x3c29('0x26')](_0x3c29('0x21'),new LocalStrategy({'usernameField':'name','passwordField':_0x3c29('0x16')},function(_0x5b3fc6,_0x498dc5,_0x8effbf){return ActiveDirectoryAuthenticate(db['User'],_0x5b3fc6,_0x498dc5,_0x8effbf);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 3d2b63f..27ad7dd 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 _0x4746=['Router','post','express'];(function(_0x4a8035,_0x3f834f){var _0x55690b=function(_0x7e3a4f){while(--_0x7e3a4f){_0x4a8035['push'](_0x4a8035['shift']());}};_0x55690b(++_0x3f834f);}(_0x4746,0x1c7));var _0x6474=function(_0x16c467,_0x53d6fa){_0x16c467=_0x16c467-0x0;var _0x22db4f=_0x4746[_0x16c467];return _0x22db4f;};'use strict';var express=require(_0x6474('0x0'));var router=express[_0x6474('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x6474('0x2')]('/',controller['login']);module['exports']=router; \ No newline at end of file +var _0x0300=['login','exports','express','./authActiveDirectory.controller'];(function(_0x191dca,_0x58375a){var _0x4d3bc5=function(_0x438640){while(--_0x438640){_0x191dca['push'](_0x191dca['shift']());}};_0x4d3bc5(++_0x58375a);}(_0x0300,0x146));var _0x0030=function(_0x4b2962,_0x565501){_0x4b2962=_0x4b2962-0x0;var _0x496615=_0x0300[_0x4b2962];return _0x496615;};'use strict';var express=require(_0x0030('0x0'));var router=express['Router']();var controller=require(_0x0030('0x1'));router['post']('/',controller[_0x0030('0x2')]);module[_0x0030('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 7fb855c..985955a 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(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x7a54,0x106));var _0x47a5=function(_0x3157c3,_0x5e5540){_0x3157c3=_0x3157c3-0x0;var _0x1ebe27=_0x7a54[_0x3157c3];return _0x1ebe27;};'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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7a54,0x106));var _0x47a5=function(_0x58bfa6,_0x719534){_0x58bfa6=_0x58bfa6-0x0;var _0xbefddc=_0x7a54[_0x58bfa6];return _0xbefddc;};'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 a27198e..ac13759 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 _0x7fbe=['../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x5a4400,_0xfae3b6){var _0xf9b532=function(_0x39804e){while(--_0x39804e){_0x5a4400['push'](_0x5a4400['shift']());}};_0xf9b532(++_0xfae3b6);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x290c78,_0x406c3d){_0x290c78=_0x290c78-0x0;var _0x5d5bf5=_0x7fbe[_0x290c78];return _0x5d5bf5;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0xe7fb('0x0')]();var controller=require(_0xe7fb('0x1'));var userController=require(_0xe7fb('0x2'));var authService=require(_0xe7fb('0x3'));router[_0xe7fb('0x4')]('/',controller[_0xe7fb('0x5')]);router[_0xe7fb('0x4')](_0xe7fb('0x6'),controller[_0xe7fb('0x7')],authService[_0xe7fb('0x8')],userController[_0xe7fb('0x5')],authService[_0xe7fb('0x9')]);module[_0xe7fb('0xa')]=router; \ No newline at end of file +var _0x0e5c=['Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','callback','isMiddleware','setTokenCookie','exports','express'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0e5c,0x1d3));var _0xc0e5=function(_0x1ca4c3,_0x554126){_0x1ca4c3=_0x1ca4c3-0x0;var _0x4426a6=_0x0e5c[_0x1ca4c3];return _0x4426a6;};'use strict';var express=require(_0xc0e5('0x0'));var passport=require('passport');var router=express[_0xc0e5('0x1')]();var controller=require(_0xc0e5('0x2'));var userController=require(_0xc0e5('0x3'));var authService=require(_0xc0e5('0x4'));router['get']('/',controller[_0xc0e5('0x5')]);router[_0xc0e5('0x6')](_0xc0e5('0x7'),controller[_0xc0e5('0x8')],authService[_0xc0e5('0x9')],userController['login'],authService[_0xc0e5('0xa')]);module[_0xc0e5('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 c523cb1..1071aad 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 _0x65ca=['randomstring','../../mysqldb','../../components/auth/service','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','blocked','loginAttempts','admin','user','agent','authenticate','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','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','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','host','/reset/','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','password','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','use','jayson/promise','lodash'];(function(_0xeba704,_0x4590a4){var _0x1c08c5=function(_0xfa9ffa){while(--_0xfa9ffa){_0xeba704['push'](_0xeba704['shift']());}};_0x1c08c5(++_0x4590a4);}(_0x65ca,0x142));var _0xa65c=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0x65ca[_0x368587];return _0x42d33c;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0xa65c('0x0'));var _=require(_0xa65c('0x1'));var rs=require(_0xa65c('0x2'));var moment=require('moment');var db=require(_0xa65c('0x3'))['db'];var authService=require(_0xa65c('0x4'));var utils=require('../../config/utils');var client=jayson[_0xa65c('0x5')][_0xa65c('0x6')]({'port':0x232b});function localAuthenticate(_0x1a8d74,_0x1a4af9,_0x3ac924,_0x2b4afe){var _0xa02c75,_0x23480a;return db['Setting'][_0xa65c('0x7')]({'where':{'id':0x1},'attributes':[_0xa65c('0x8'),_0xa65c('0x9')],'raw':!![]})[_0xa65c('0xa')](function(_0x2fb649){_0xa02c75=_0x2fb649;return _0x1a8d74[_0xa65c('0x7')]({'attributes':['id',_0xa65c('0xb'),'password',_0xa65c('0xc'),_0xa65c('0xd'),'disabled',_0xa65c('0xe'),'blockedAt',_0xa65c('0xf')],'where':{'name':_0x1a4af9,'role':{'$or':[_0xa65c('0x10'),_0xa65c('0x11'),_0xa65c('0x12')]}}});})[_0xa65c('0xa')](function(_0x519932){if(!_0x519932||_0x519932&&_0x519932[_0xa65c('0xb')]!==_0x1a4af9){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x23480a=_0x519932;return _0x23480a;}})[_0xa65c('0xa')](function(){_0x23480a[_0xa65c('0x13')](_0x3ac924,function(_0x5d4f8a,_0x159ef7){var _0x38c2fd=_0x23480a['loginAttempts']+0x1;if(_0x5d4f8a){return _0x2b4afe(_0x5d4f8a);}else if(!_0x159ef7){if(_0x23480a[_0xa65c('0x14')]){return _0x2b4afe(null,![],{'message':_0xa65c('0x15')});}else if(_0xa02c75['allowedLoginAttempts']>0x0){if(_0x23480a[_0xa65c('0xe')]){if(_0xa02c75['blockDuration']>0x0){if(moment(_0x23480a[_0xa65c('0x16')])[_0xa65c('0x17')](_0xa02c75[_0xa65c('0x9')],'minutes')>moment()){return _0x2b4afe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xa65c('0x18')](_0x23480a,_0x38c2fd,![],null)[_0xa65c('0xa')](function(){return _0x2b4afe(null,![],{'message':_0xa65c('0x15')});});}}else{return _0x2b4afe(null,![],{'message':_0xa65c('0x15')});}}else{if(_0x38c2fd>=_0xa02c75['allowedLoginAttempts']){return utils['clearBlockUser'](_0x23480a,0x0,!![],moment())[_0xa65c('0xa')](function(){return _0x2b4afe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xa65c('0x18')](_0x23480a,_0x38c2fd,![],null)[_0xa65c('0xa')](function(){return _0x2b4afe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x2b4afe(null,![],{'message':_0xa65c('0x15')});}}else{if(_0x23480a[_0xa65c('0x14')]){return _0x2b4afe(null,![],{'message':_0xa65c('0x15')});}else if(_0xa02c75['allowedLoginAttempts']>0x0){if(_0x23480a[_0xa65c('0xe')]){if(_0xa02c75[_0xa65c('0x9')]>0x0){if(moment(_0x23480a['blockedAt'])[_0xa65c('0x17')](_0xa02c75[_0xa65c('0x9')],'minutes')>moment()){return _0x2b4afe(null,![],{'message':_0xa65c('0x15')});}else{return utils['clearBlockUser'](_0x23480a,0x0,![],null)[_0xa65c('0xa')](function(){return utils[_0xa65c('0x19')](_0x23480a);})[_0xa65c('0xa')](function(){return _0x2b4afe(null,_0x23480a);});}}else{return _0x2b4afe(null,![],{'message':_0xa65c('0x15')});}}else{return utils[_0xa65c('0x18')](_0x23480a,0x0,![],null)[_0xa65c('0xa')](function(){return utils[_0xa65c('0x19')](_0x23480a);})[_0xa65c('0xa')](function(){return _0x2b4afe(null,_0x23480a);})['catch'](function(_0x3e4b0d){return _0x2b4afe(null,![],_0x3e4b0d);});}}else{if(_0x23480a[_0xa65c('0xe')]){return _0x2b4afe(null,![],{'message':_0xa65c('0x15')});}else{return utils[_0xa65c('0x19')](_0x23480a)[_0xa65c('0xa')](function(){return _0x2b4afe(null,_0x23480a);});}}}});})[_0xa65c('0x1a')](function(_0x535f86){return _0x2b4afe(null,![],_0x535f86);});}function sendServiceMail(_0x5f51f3){return db[_0xa65c('0x1b')][_0xa65c('0x1c')]({'where':{'service':!![]},'attributes':['id',_0xa65c('0xb'),_0xa65c('0x1d')],'include':[{'model':db[_0xa65c('0x1e')],'as':_0xa65c('0x1f'),'include':[{'model':db[_0xa65c('0x20')],'as':_0xa65c('0x20')}]}]})[_0xa65c('0xa')](function(_0x53545c){if(!_0x53545c){throw new Error(_0xa65c('0x21'));}var _0x4d8ce2=_0x53545c[_0xa65c('0x22')]();var _0x49e957={'account':_0x4d8ce2,'message':_['merge']({'from':util['format'](_0xa65c('0x23'),_0x53545c[_0xa65c('0xb')],_0x53545c[_0xa65c('0x1d')]||_0x53545c[_0xa65c('0x1f')][_0xa65c('0x11')])},_0x5f51f3)};return client[_0xa65c('0x24')](_0xa65c('0x25'),_0x49e957);})['then'](function(_0x1c1655){if(_0x1c1655[_0xa65c('0x26')]){throw new Error(util[_0xa65c('0x27')](_0xa65c('0x28'),_0x1c1655[_0xa65c('0x26')][_0xa65c('0x29')]||JSON[_0xa65c('0x2a')](_0x1c1655['error'])));}return!![];});}function handleError(_0x5f0ddc,_0x1db5fa,_0x90bf08){return _0x5f0ddc[_0xa65c('0x2b')](_0x1db5fa||0x1f4)[_0xa65c('0x2c')]({'message':_0x90bf08?_0x90bf08['message']||_0x90bf08:''});}exports[_0xa65c('0x2d')]=function(_0x5d41ef,_0x282d78,_0x47a795){passport[_0xa65c('0x13')](_0xa65c('0x2e'),function(_0x5892bc,_0x24a2d5,_0x4bdbe1){var _0x16e225=_0x5892bc||_0x4bdbe1;if(_0x16e225){return handleError(_0x282d78,0x191,_0x16e225);}if(!_0x24a2d5){return handleError(_0x282d78,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x13e213={'payload':{'id':_0x24a2d5['id'],'role':_0x24a2d5[_0xa65c('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0xa65c('0x2f')](_0x13e213)['then'](function(_0x92510a){_0x282d78[_0xa65c('0x30')]({'id':_0x24a2d5['id'],'token':_0x92510a,'statusCall':'','isAlreadyLogged':_0x24a2d5[_0xa65c('0x31')]});});}})(_0x5d41ef,_0x282d78,_0x47a795);};exports[_0xa65c('0x32')]=function(_0x58da94,_0x58918c){if(!_0x58da94['body'][_0xa65c('0x1d')]){return handleError(_0x58918c,0x1f4,{'message':_0xa65c('0x33')});}var _0x12abf1=rs[_0xa65c('0x34')]();_0x58da94[_0xa65c('0x35')][_0xa65c('0x1d')]=_0x58da94[_0xa65c('0x35')][_0xa65c('0x1d')]['trim']()[_0xa65c('0x36')]();var _0xbf8e4d;return db[_0xa65c('0x37')][_0xa65c('0x7')]({'where':{'id':0x1},'attributes':[_0xa65c('0x8'),_0xa65c('0x9')],'raw':!![]})['then'](function(_0x4d1254){_0xbf8e4d=_0x4d1254;return db[_0xa65c('0x38')][_0xa65c('0x1c')]({'where':{'email':_0x58da94[_0xa65c('0x35')][_0xa65c('0x1d')]}});})[_0xa65c('0xa')](function(_0x41344e){if(!_0x41344e){throw new Error(_0xa65c('0x39'));}if(_0x41344e[_0xa65c('0x14')]){throw new Error(_0xa65c('0x3a'));}if(_0x41344e['blocked']){if(moment(_0x41344e[_0xa65c('0x16')])['add'](_0xbf8e4d['blockDuration'],'minutes')>moment()){throw new Error(_0xa65c('0x3b'));}else{_0x41344e['blocked']=![];_0x41344e[_0xa65c('0x16')]=null;}}_0x41344e[_0xa65c('0x3c')]=_0x12abf1;_0x41344e[_0xa65c('0x3d')]=Date[_0xa65c('0x3e')]()+0x36ee80;return _0x41344e[_0xa65c('0x3f')]();})[_0xa65c('0xa')](function(){return sendServiceMail({'to':_0x58da94[_0xa65c('0x35')][_0xa65c('0x1d')],'subject':_0xa65c('0x40'),'text':_0xa65c('0x41')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x58da94[_0xa65c('0x42')][_0xa65c('0x43')]+_0xa65c('0x44')+_0x12abf1+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xa65c('0xa')](function(){_0x58918c[_0xa65c('0x2b')](0xc8)[_0xa65c('0x2c')]({'message':_0xa65c('0x45')});})['catch'](function(_0x504353){return handleError(_0x58918c,0x1f4,_0x504353);});};exports[_0xa65c('0x46')]=function(_0x33acbe,_0x2d0554){return db[_0xa65c('0x38')][_0xa65c('0x1c')]({'where':{'resetPasswordToken':_0x33acbe[_0xa65c('0x47')][_0xa65c('0x48')],'resetPasswordExpires':{'$gt':Date[_0xa65c('0x3e')]()}}})[_0xa65c('0xa')](function(_0x47db53){if(!_0x47db53){throw new Error(_0xa65c('0x49'));}return db[_0xa65c('0x37')]['findOne']({'attributes':['id',_0xa65c('0x4a'),'enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0x207469){if(_0x207469[_0xa65c('0x4a')])authService['validatePasswordPattern'](_0x33acbe[_0xa65c('0x35')][_0xa65c('0x4b')]);if(!_0x207469[_0xa65c('0x4c')]||!_0x47db53[_0xa65c('0x4d')])return _0x47db53;authService[_0xa65c('0x4e')](_0x33acbe[_0xa65c('0x35')]['password'],_0x47db53['previousPasswords'],_0x207469[_0xa65c('0x4f')]);return _0x47db53;})[_0xa65c('0xa')](function(){_0x47db53[_0xa65c('0x4b')]=_0x33acbe['body'][_0xa65c('0x4b')];_0x47db53[_0xa65c('0x3c')]=null;_0x47db53[_0xa65c('0x3d')]=null;return _0x47db53[_0xa65c('0x3f')]();});})[_0xa65c('0xa')](function(){_0x2d0554[_0xa65c('0x2b')](0xc8)['send']({'message':'Password\x20reset!'});})[_0xa65c('0x1a')](function(_0x271cfb){return handleError(_0x2d0554,0x1f4,_0x271cfb);});};passport[_0xa65c('0x50')](_0xa65c('0x2e'),new LocalStrategy({'usernameField':_0xa65c('0xb'),'passwordField':_0xa65c('0x4b')},function(_0x241eed,_0x15d4b7,_0x3381c1){return localAuthenticate(db[_0xa65c('0x38')],_0x241eed,_0x15d4b7,_0x3381c1);})); \ No newline at end of file +var _0x1797=['error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','use','util','passport','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name','password','salt','role','disabled','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blocked','blockDuration','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','format','\x22%s\x22\x20<%s>','request'];(function(_0x449082,_0x1f4485){var _0x21793a=function(_0x4c070a){while(--_0x4c070a){_0x449082['push'](_0x449082['shift']());}};_0x21793a(++_0x1f4485);}(_0x1797,0x78));var _0x7179=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x1797[_0x1b828b];return _0x98da1a;};'use strict';var util=require(_0x7179('0x0'));var passport=require(_0x7179('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0x7179('0x2'));var _=require(_0x7179('0x3'));var rs=require(_0x7179('0x4'));var moment=require(_0x7179('0x5'));var db=require(_0x7179('0x6'))['db'];var authService=require(_0x7179('0x7'));var utils=require(_0x7179('0x8'));var client=jayson[_0x7179('0x9')][_0x7179('0xa')]({'port':0x232b});function localAuthenticate(_0x5bcc11,_0x1d6ec0,_0xdb8bae,_0x6f6e3c){var _0x433987,_0x247b4e;return db[_0x7179('0xb')][_0x7179('0xc')]({'where':{'id':0x1},'attributes':[_0x7179('0xd'),'blockDuration'],'raw':!![]})[_0x7179('0xe')](function(_0xb24c22){_0x433987=_0xb24c22;return _0x5bcc11[_0x7179('0xc')]({'attributes':['id',_0x7179('0xf'),_0x7179('0x10'),_0x7179('0x11'),_0x7179('0x12'),_0x7179('0x13'),'blocked',_0x7179('0x14'),'loginAttempts'],'where':{'name':_0x1d6ec0,'role':{'$or':[_0x7179('0x15'),_0x7179('0x16'),_0x7179('0x17')]}}});})['then'](function(_0x552be0){if(!_0x552be0||_0x552be0&&_0x552be0[_0x7179('0xf')]!==_0x1d6ec0){throw new Error(_0x7179('0x18'));}else{_0x247b4e=_0x552be0;return _0x247b4e;}})[_0x7179('0xe')](function(){_0x247b4e[_0x7179('0x19')](_0xdb8bae,function(_0x18681f,_0x1178fa){var _0x317942=_0x247b4e[_0x7179('0x1a')]+0x1;if(_0x18681f){return _0x6f6e3c(_0x18681f);}else if(!_0x1178fa){if(_0x247b4e[_0x7179('0x13')]){return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});}else if(_0x433987[_0x7179('0xd')]>0x0){if(_0x247b4e[_0x7179('0x1b')]){if(_0x433987[_0x7179('0x1c')]>0x0){if(moment(_0x247b4e[_0x7179('0x14')])[_0x7179('0x1d')](_0x433987[_0x7179('0x1c')],_0x7179('0x1e'))>moment()){return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});}else{return utils[_0x7179('0x1f')](_0x247b4e,_0x317942,![],null)[_0x7179('0xe')](function(){return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});});}}else{return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});}}else{if(_0x317942>=_0x433987['allowedLoginAttempts']){return utils[_0x7179('0x1f')](_0x247b4e,0x0,!![],moment())[_0x7179('0xe')](function(){return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});});}else{return utils[_0x7179('0x1f')](_0x247b4e,_0x317942,![],null)[_0x7179('0xe')](function(){return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});});}}}else{return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});}}else{if(_0x247b4e['disabled']){return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});}else if(_0x433987[_0x7179('0xd')]>0x0){if(_0x247b4e['blocked']){if(_0x433987[_0x7179('0x1c')]>0x0){if(moment(_0x247b4e[_0x7179('0x14')])[_0x7179('0x1d')](_0x433987[_0x7179('0x1c')],_0x7179('0x1e'))>moment()){return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});}else{return utils[_0x7179('0x1f')](_0x247b4e,0x0,![],null)['then'](function(){return utils[_0x7179('0x20')](_0x247b4e);})[_0x7179('0xe')](function(){return _0x6f6e3c(null,_0x247b4e);});}}else{return _0x6f6e3c(null,![],{'message':_0x7179('0x18')});}}else{return utils[_0x7179('0x1f')](_0x247b4e,0x0,![],null)[_0x7179('0xe')](function(){return utils[_0x7179('0x20')](_0x247b4e);})[_0x7179('0xe')](function(){return _0x6f6e3c(null,_0x247b4e);})['catch'](function(_0x27dca3){return _0x6f6e3c(null,![],_0x27dca3);});}}else{if(_0x247b4e[_0x7179('0x1b')]){return _0x6f6e3c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x7179('0x20')](_0x247b4e)[_0x7179('0xe')](function(){return _0x6f6e3c(null,_0x247b4e);});}}}});})[_0x7179('0x21')](function(_0xa6fcd9){return _0x6f6e3c(null,![],_0xa6fcd9);});}function sendServiceMail(_0x24d79d){return db[_0x7179('0x22')][_0x7179('0x23')]({'where':{'service':!![]},'attributes':['id',_0x7179('0xf'),_0x7179('0x24')],'include':[{'model':db['MailServerOut'],'as':_0x7179('0x25'),'include':[{'model':db[_0x7179('0x26')],'as':_0x7179('0x26')}]}]})[_0x7179('0xe')](function(_0x3b1512){if(!_0x3b1512){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x3e7786=_0x3b1512['getSmtpOptions']();var _0x53b7aa={'account':_0x3e7786,'message':_['merge']({'from':util[_0x7179('0x27')](_0x7179('0x28'),_0x3b1512[_0x7179('0xf')],_0x3b1512[_0x7179('0x24')]||_0x3b1512[_0x7179('0x25')]['user'])},_0x24d79d)};return client[_0x7179('0x29')]('SendMail',_0x53b7aa);})[_0x7179('0xe')](function(_0x368d62){if(_0x368d62[_0x7179('0x2a')]){throw new Error(util[_0x7179('0x27')](_0x7179('0x2b'),_0x368d62[_0x7179('0x2a')]['message']||JSON[_0x7179('0x2c')](_0x368d62[_0x7179('0x2a')])));}return!![];});}function handleError(_0x5202e2,_0x11dd47,_0x5ee6c2){return _0x5202e2[_0x7179('0x2d')](_0x11dd47||0x1f4)[_0x7179('0x2e')]({'message':_0x5ee6c2?_0x5ee6c2['message']||_0x5ee6c2:''});}exports['login']=function(_0x7597e7,_0x4a7259,_0x5cfb71){passport[_0x7179('0x19')](_0x7179('0x2f'),function(_0x50d0b2,_0x44ad96,_0xc68f26){var _0x4fd0fe=_0x50d0b2||_0xc68f26;if(_0x4fd0fe){return handleError(_0x4a7259,0x191,_0x4fd0fe);}if(!_0x44ad96){return handleError(_0x4a7259,0x194,{'message':_0x7179('0x30')});}else{var _0x21c80f={'payload':{'id':_0x44ad96['id'],'role':_0x44ad96[_0x7179('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x7179('0x31')](_0x21c80f)['then'](function(_0x3f90fe){_0x4a7259[_0x7179('0x32')]({'id':_0x44ad96['id'],'token':_0x3f90fe,'statusCall':'','isAlreadyLogged':_0x44ad96['online']});});}})(_0x7597e7,_0x4a7259,_0x5cfb71);};exports[_0x7179('0x33')]=function(_0x25e6e9,_0x94c967){if(!_0x25e6e9[_0x7179('0x34')]['email']){return handleError(_0x94c967,0x1f4,{'message':_0x7179('0x35')});}var _0x4b2a45=rs[_0x7179('0x36')]();_0x25e6e9[_0x7179('0x34')][_0x7179('0x24')]=_0x25e6e9[_0x7179('0x34')][_0x7179('0x24')][_0x7179('0x37')]()[_0x7179('0x38')]();var _0x339e3f;return db[_0x7179('0xb')][_0x7179('0xc')]({'where':{'id':0x1},'attributes':[_0x7179('0xd'),_0x7179('0x1c')],'raw':!![]})[_0x7179('0xe')](function(_0x528cd4){_0x339e3f=_0x528cd4;return db[_0x7179('0x39')][_0x7179('0x23')]({'where':{'email':_0x25e6e9[_0x7179('0x34')][_0x7179('0x24')]}});})[_0x7179('0xe')](function(_0xfe536d){if(!_0xfe536d){throw new Error(_0x7179('0x3a'));}if(_0xfe536d[_0x7179('0x13')]){throw new Error(_0x7179('0x3b'));}if(_0xfe536d[_0x7179('0x1b')]){if(moment(_0xfe536d['blockedAt'])['add'](_0x339e3f[_0x7179('0x1c')],'minutes')>moment()){throw new Error(_0x7179('0x3c'));}else{_0xfe536d[_0x7179('0x1b')]=![];_0xfe536d[_0x7179('0x14')]=null;}}_0xfe536d[_0x7179('0x3d')]=_0x4b2a45;_0xfe536d[_0x7179('0x3e')]=Date[_0x7179('0x3f')]()+0x36ee80;return _0xfe536d[_0x7179('0x40')]();})['then'](function(){return sendServiceMail({'to':_0x25e6e9['body']['email'],'subject':_0x7179('0x41'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x7179('0x42')+_0x7179('0x43')+_0x25e6e9[_0x7179('0x44')][_0x7179('0x45')]+'/reset/'+_0x4b2a45+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})['then'](function(){_0x94c967[_0x7179('0x2d')](0xc8)[_0x7179('0x2e')]({'message':_0x7179('0x46')});})[_0x7179('0x21')](function(_0x311766){return handleError(_0x94c967,0x1f4,_0x311766);});};exports[_0x7179('0x47')]=function(_0x4d7c1b,_0x3cfcbc){return db[_0x7179('0x39')][_0x7179('0x23')]({'where':{'resetPasswordToken':_0x4d7c1b['params'][_0x7179('0x48')],'resetPasswordExpires':{'$gt':Date[_0x7179('0x3f')]()}}})[_0x7179('0xe')](function(_0x2a2efc){if(!_0x2a2efc){throw new Error(_0x7179('0x49'));}return db[_0x7179('0xb')][_0x7179('0xc')]({'attributes':['id',_0x7179('0x4a'),_0x7179('0x4b'),_0x7179('0x4c')]})['then'](function(_0x47a34e){if(_0x47a34e[_0x7179('0x4a')])authService[_0x7179('0x4d')](_0x4d7c1b[_0x7179('0x34')][_0x7179('0x10')]);if(!_0x47a34e[_0x7179('0x4b')]||!_0x2a2efc[_0x7179('0x4e')])return _0x2a2efc;authService[_0x7179('0x4f')](_0x4d7c1b[_0x7179('0x34')][_0x7179('0x10')],_0x2a2efc['previousPasswords'],_0x47a34e[_0x7179('0x4c')]);return _0x2a2efc;})['then'](function(){_0x2a2efc[_0x7179('0x10')]=_0x4d7c1b[_0x7179('0x34')][_0x7179('0x10')];_0x2a2efc[_0x7179('0x3d')]=null;_0x2a2efc[_0x7179('0x3e')]=null;return _0x2a2efc[_0x7179('0x40')]();});})[_0x7179('0xe')](function(){_0x3cfcbc[_0x7179('0x2d')](0xc8)[_0x7179('0x2e')]({'message':'Password\x20reset!'});})[_0x7179('0x21')](function(_0x568d51){return handleError(_0x3cfcbc,0x1f4,_0x568d51);});};passport[_0x7179('0x50')](_0x7179('0x2f'),new LocalStrategy({'usernameField':_0x7179('0xf'),'passwordField':_0x7179('0x10')},function(_0x58f7f3,_0x25adbf,_0x3b1275){return localAuthenticate(db[_0x7179('0x39')],_0x58f7f3,_0x25adbf,_0x3b1275);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a82732c..d3ebe6e 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 _0x12e0=['/reset/:token','reset','exports','express','Router','./authLocal.controller','post','forgot'];(function(_0x2cfd0b,_0x12c7b2){var _0x57906e=function(_0x3e2743){while(--_0x3e2743){_0x2cfd0b['push'](_0x2cfd0b['shift']());}};_0x57906e(++_0x12c7b2);}(_0x12e0,0x123));var _0x012e=function(_0x2330d8,_0x48ee0c){_0x2330d8=_0x2330d8-0x0;var _0x4e363d=_0x12e0[_0x2330d8];return _0x4e363d;};'use strict';var express=require(_0x012e('0x0'));var router=express[_0x012e('0x1')]();var controller=require(_0x012e('0x2'));router[_0x012e('0x3')]('/',controller['login']);router[_0x012e('0x3')]('/forgot',controller[_0x012e('0x4')]);router[_0x012e('0x3')](_0x012e('0x5'),controller[_0x012e('0x6')]);module[_0x012e('0x7')]=router; \ No newline at end of file +var _0x4390=['reset','exports','express','Router','./authLocal.controller','post','login','/forgot','forgot'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4390,0xd1));var _0x0439=function(_0xb66cc,_0x49b95f){_0xb66cc=_0xb66cc-0x0;var _0x5da561=_0x4390[_0xb66cc];return _0x5da561;};'use strict';var express=require(_0x0439('0x0'));var router=express[_0x0439('0x1')]();var controller=require(_0x0439('0x2'));router[_0x0439('0x3')]('/',controller[_0x0439('0x4')]);router['post'](_0x0439('0x5'),controller[_0x0439('0x6')]);router[_0x0439('0x3')]('/reset/:token',controller[_0x0439('0x7')]);module[_0x0439('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 0b83173..aa5f6a2 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 _0xcaff=['STRING','BOOLEAN','sequelize'];(function(_0x59ded7,_0x1c5199){var _0x3dbf0a=function(_0x14c70e){while(--_0x14c70e){_0x59ded7['push'](_0x59ded7['shift']());}};_0x3dbf0a(++_0x1c5199);}(_0xcaff,0x1ee));var _0xfcaf=function(_0x2a34fe,_0x4c9f15){_0x2a34fe=_0x2a34fe-0x0;var _0x3de03f=_0xcaff[_0x2a34fe];return _0x3de03f;};'use strict';var Sequelize=require(_0xfcaf('0x0'));module['exports']={'name':{'type':Sequelize[_0xfcaf('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xfcaf('0x1')]},'description':{'type':Sequelize[_0xfcaf('0x1')]},'status':{'type':Sequelize[_0xfcaf('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x3431=['STRING','INTEGER','exports'];(function(_0x2673a4,_0x4d0b8d){var _0x5e3a6a=function(_0x59e268){while(--_0x59e268){_0x2673a4['push'](_0x2673a4['shift']());}};_0x5e3a6a(++_0x4d0b8d);}(_0x3431,0x1e5));var _0x1343=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x3431[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require('sequelize');module[_0x1343('0x0')]={'name':{'type':Sequelize[_0x1343('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x1343('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x1343('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 712f8bb..cb76e5c 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 _0xe1f8=['map','Automation','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','addConditions','ids','omit','getConditions','findOne','length','order','pick','addActions','Action','getActions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index'];(function(_0xdc2052,_0x49c59a){var _0x4b51d5=function(_0x544751){while(--_0x544751){_0xdc2052['push'](_0xdc2052['shift']());}};_0x4b51d5(++_0x49c59a);}(_0xe1f8,0x12f));var _0x8e1f=function(_0x57f3d6,_0x3a65a6){_0x57f3d6=_0x57f3d6-0x0;var _0xba691=_0xe1f8[_0x57f3d6];return _0xba691;};'use strict';var emlformat=require(_0x8e1f('0x0'));var rimraf=require(_0x8e1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8e1f('0x2'));var moment=require(_0x8e1f('0x3'));var BPromise=require(_0x8e1f('0x4'));var Mustache=require(_0x8e1f('0x5'));var util=require(_0x8e1f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8e1f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e1f('0x8'));var _=require(_0x8e1f('0x9'));var squel=require(_0x8e1f('0xa'));var crypto=require(_0x8e1f('0xb'));var jsforce=require(_0x8e1f('0xc'));var deskjs=require(_0x8e1f('0xd'));var toCsv=require(_0x8e1f('0x7'));var querystring=require(_0x8e1f('0xe'));var Papa=require(_0x8e1f('0xf'));var Redis=require(_0x8e1f('0x10'));var authService=require(_0x8e1f('0x11'));var qs=require(_0x8e1f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e1f('0x13'));var logger=require(_0x8e1f('0x14'))(_0x8e1f('0x15'));var utils=require(_0x8e1f('0x16'));var config=require(_0x8e1f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e1f('0x18'))['db'];function respondWithStatusCode(_0xeb7921,_0xad58a3){_0xad58a3=_0xad58a3||0xcc;return function(_0x3db28e){if(_0x3db28e){return _0xeb7921['sendStatus'](_0xad58a3);}return _0xeb7921[_0x8e1f('0x19')](_0xad58a3)[_0x8e1f('0x1a')]();};}function respondWithResult(_0x41707b,_0x2cc0da){_0x2cc0da=_0x2cc0da||0xc8;return function(_0x26f673){if(_0x26f673){return _0x41707b['status'](_0x2cc0da)[_0x8e1f('0x1b')](_0x26f673);}};}function respondWithFilteredResult(_0x51c5ab,_0x47327d){return function(_0x3a47e9){if(_0x3a47e9){var _0xb1ac54=typeof _0x47327d[_0x8e1f('0x1c')]===_0x8e1f('0x1d')&&typeof _0x47327d[_0x8e1f('0x1e')]===_0x8e1f('0x1d');var _0x575c56=_0x3a47e9[_0x8e1f('0x1f')];var _0x826077=_0xb1ac54?0x0:_0x47327d[_0x8e1f('0x1c')];var _0xa87c64=_0xb1ac54?_0x3a47e9['count']:_0x47327d['offset']+_0x47327d['limit'];var _0x2d64c8;if(_0xa87c64>=_0x575c56){_0xa87c64=_0x575c56;_0x2d64c8=0xc8;}else{_0x2d64c8=0xce;}_0x51c5ab['status'](_0x2d64c8);return _0x51c5ab[_0x8e1f('0x20')](_0x8e1f('0x21'),_0x826077+'-'+_0xa87c64+'/'+_0x575c56)[_0x8e1f('0x1b')](_0x3a47e9);}return null;};}function patchUpdates(_0x495601){return function(_0x43f178){try{jsonpatch[_0x8e1f('0x22')](_0x43f178,_0x495601,!![]);}catch(_0x967ac){return BPromise[_0x8e1f('0x23')](_0x967ac);}return _0x43f178['save']();};}function saveUpdates(_0x31a4a1,_0x13b4dc){return function(_0x54e505){if(_0x54e505){return _0x54e505[_0x8e1f('0x24')](_0x31a4a1)[_0x8e1f('0x25')](function(_0x2e3bfe){return _0x2e3bfe;});}return null;};}function removeEntity(_0x585f97,_0x42c6dc){return function(_0x424254){if(_0x424254){return _0x424254[_0x8e1f('0x26')]()[_0x8e1f('0x25')](function(){_0x585f97[_0x8e1f('0x19')](0xcc)[_0x8e1f('0x1a')]();});}};}function handleEntityNotFound(_0x530a62,_0x213745){return function(_0x3359c8){if(!_0x3359c8){_0x530a62[_0x8e1f('0x27')](0x194);}return _0x3359c8;};}function handleError(_0xcaa608,_0x1edbdb){_0x1edbdb=_0x1edbdb||0x1f4;return function(_0x2ad548){logger[_0x8e1f('0x28')](_0x2ad548[_0x8e1f('0x29')]);if(_0x2ad548[_0x8e1f('0x2a')]){delete _0x2ad548[_0x8e1f('0x2a')];}_0xcaa608['status'](_0x1edbdb)[_0x8e1f('0x2b')](_0x2ad548);};}exports[_0x8e1f('0x2c')]=function(_0x23f767,_0x2a3367){var _0x5a5fd8={},_0x1462e1={},_0x30c843={'count':0x0,'rows':[]};var _0x58c362=_[_0x8e1f('0x2d')](db[_0x8e1f('0x2e')]['rawAttributes'],function(_0x149b08){return{'name':_0x149b08[_0x8e1f('0x2f')],'type':_0x149b08[_0x8e1f('0x30')][_0x8e1f('0x31')]};});_0x1462e1[_0x8e1f('0x32')]=_['map'](_0x58c362,_0x8e1f('0x2a'));_0x1462e1[_0x8e1f('0x33')]=_[_0x8e1f('0x34')](_0x23f767[_0x8e1f('0x33')]);_0x1462e1[_0x8e1f('0x35')]=_[_0x8e1f('0x36')](_0x1462e1['model'],_0x1462e1[_0x8e1f('0x33')]);_0x5a5fd8[_0x8e1f('0x37')]=_['intersection'](_0x1462e1[_0x8e1f('0x32')],qs[_0x8e1f('0x38')](_0x23f767[_0x8e1f('0x33')][_0x8e1f('0x38')]));_0x5a5fd8[_0x8e1f('0x37')]=_0x5a5fd8[_0x8e1f('0x37')]['length']?_0x5a5fd8[_0x8e1f('0x37')]:_0x1462e1[_0x8e1f('0x32')];if(!_0x23f767[_0x8e1f('0x33')][_0x8e1f('0x39')](_0x8e1f('0x3a'))){_0x5a5fd8[_0x8e1f('0x1e')]=qs[_0x8e1f('0x1e')](_0x23f767[_0x8e1f('0x33')][_0x8e1f('0x1e')]);_0x5a5fd8['offset']=qs[_0x8e1f('0x1c')](_0x23f767[_0x8e1f('0x33')][_0x8e1f('0x1c')]);}_0x5a5fd8['order']=qs[_0x8e1f('0x3b')](_0x23f767['query'][_0x8e1f('0x3b')]);_0x5a5fd8['where']=qs['filters'](_['pick'](_0x23f767[_0x8e1f('0x33')],_0x1462e1[_0x8e1f('0x35')]),_0x58c362);if(_0x23f767[_0x8e1f('0x33')]['filter']){_0x5a5fd8[_0x8e1f('0x3c')]=_['merge'](_0x5a5fd8[_0x8e1f('0x3c')],{'$or':_[_0x8e1f('0x2d')](_0x58c362,function(_0xaeb197){if(_0xaeb197[_0x8e1f('0x30')]!==_0x8e1f('0x3d')){var _0xefadfd={};_0xefadfd[_0xaeb197[_0x8e1f('0x2a')]]={'$like':'%'+_0x23f767[_0x8e1f('0x33')][_0x8e1f('0x3e')]+'%'};return _0xefadfd;}})});}_0x5a5fd8=_[_0x8e1f('0x3f')]({},_0x5a5fd8,_0x23f767[_0x8e1f('0x40')]);var _0x464493={'where':_0x5a5fd8[_0x8e1f('0x3c')]};return db[_0x8e1f('0x2e')][_0x8e1f('0x1f')](_0x464493)[_0x8e1f('0x25')](function(_0x2bcef3){_0x30c843[_0x8e1f('0x1f')]=_0x2bcef3;if(_0x23f767['query'][_0x8e1f('0x41')]){_0x5a5fd8[_0x8e1f('0x42')]=[{'all':!![]}];}return db[_0x8e1f('0x2e')][_0x8e1f('0x43')](_0x5a5fd8);})[_0x8e1f('0x25')](function(_0x1830ba){_0x30c843[_0x8e1f('0x44')]=_0x1830ba;return _0x30c843;})['then'](respondWithFilteredResult(_0x2a3367,_0x5a5fd8))[_0x8e1f('0x45')](handleError(_0x2a3367,null));};exports[_0x8e1f('0x46')]=function(_0x59d850,_0x7b946){var _0x56888c={'raw':![],'where':{'id':_0x59d850[_0x8e1f('0x47')]['id']}},_0x32a549={};_0x32a549[_0x8e1f('0x32')]=_[_0x8e1f('0x34')](db[_0x8e1f('0x2e')][_0x8e1f('0x48')]);_0x32a549[_0x8e1f('0x33')]=_[_0x8e1f('0x34')](_0x59d850[_0x8e1f('0x33')]);_0x32a549[_0x8e1f('0x35')]=_[_0x8e1f('0x36')](_0x32a549[_0x8e1f('0x32')],_0x32a549['query']);_0x56888c[_0x8e1f('0x37')]=_[_0x8e1f('0x36')](_0x32a549[_0x8e1f('0x32')],qs[_0x8e1f('0x38')](_0x59d850[_0x8e1f('0x33')]['fields']));_0x56888c[_0x8e1f('0x37')]=_0x56888c[_0x8e1f('0x37')]['length']?_0x56888c[_0x8e1f('0x37')]:_0x32a549[_0x8e1f('0x32')];if(_0x59d850['query']['includeAll']){_0x56888c['include']=[{'all':!![]}];}_0x56888c=_['merge']({},_0x56888c,_0x59d850[_0x8e1f('0x40')]);return db[_0x8e1f('0x2e')][_0x8e1f('0x49')](_0x56888c)[_0x8e1f('0x25')](handleEntityNotFound(_0x7b946,null))[_0x8e1f('0x25')](respondWithResult(_0x7b946,null))[_0x8e1f('0x45')](handleError(_0x7b946,null));};exports[_0x8e1f('0x4a')]=function(_0x25d26c,_0x48f93e){return db[_0x8e1f('0x2e')][_0x8e1f('0x4a')](_0x25d26c['body'],{})[_0x8e1f('0x25')](respondWithResult(_0x48f93e,0xc9))['catch'](handleError(_0x48f93e,null));};exports[_0x8e1f('0x24')]=function(_0x29e8bd,_0x2b0659){if(_0x29e8bd['body']['id']){delete _0x29e8bd[_0x8e1f('0x4b')]['id'];}return db[_0x8e1f('0x2e')][_0x8e1f('0x49')]({'where':{'id':_0x29e8bd[_0x8e1f('0x47')]['id']}})['then'](handleEntityNotFound(_0x2b0659,null))['then'](saveUpdates(_0x29e8bd[_0x8e1f('0x4b')],null))['then'](respondWithResult(_0x2b0659,null))[_0x8e1f('0x45')](handleError(_0x2b0659,null));};exports['destroy']=function(_0x4e39ba,_0x468bf5){return db[_0x8e1f('0x2e')][_0x8e1f('0x49')]({'where':{'id':_0x4e39ba[_0x8e1f('0x47')]['id']}})[_0x8e1f('0x25')](handleEntityNotFound(_0x468bf5,null))[_0x8e1f('0x25')](removeEntity(_0x468bf5,null))['catch'](handleError(_0x468bf5,null));};exports[_0x8e1f('0x4c')]=function(_0x3ec999,_0x5cf219,_0x21bde9){return db['Condition'][_0x8e1f('0x49')]({'where':{'id':_0x3ec999['params']['id']}})['then'](handleEntityNotFound(_0x5cf219,null))['then'](function(_0x5590c8){if(_0x5590c8){return _0x5590c8[_0x8e1f('0x4c')](_0x3ec999['body'][_0x8e1f('0x4d')],_[_0x8e1f('0x4e')](_0x3ec999[_0x8e1f('0x4b')],['ids','id'])||{});}})[_0x8e1f('0x25')](respondWithResult(_0x5cf219,null))['catch'](handleError(_0x5cf219,null));};exports[_0x8e1f('0x4f')]=function(_0x7838fc,_0x52b488,_0x29258d){var _0x361bb9={};var _0x9f1f50={};var _0x339e59;var _0x565772;return db[_0x8e1f('0x2e')][_0x8e1f('0x50')]({'where':{'id':_0x7838fc[_0x8e1f('0x47')]['id']}})['then'](handleEntityNotFound(_0x52b488,null))[_0x8e1f('0x25')](function(_0x2403d1){if(_0x2403d1){_0x339e59=_0x2403d1;_0x9f1f50[_0x8e1f('0x32')]=_[_0x8e1f('0x34')](db['Condition'][_0x8e1f('0x48')]);_0x9f1f50[_0x8e1f('0x33')]=_[_0x8e1f('0x34')](_0x7838fc['query']);_0x9f1f50['filters']=_[_0x8e1f('0x36')](_0x9f1f50[_0x8e1f('0x32')],_0x9f1f50['query']);_0x361bb9[_0x8e1f('0x37')]=_[_0x8e1f('0x36')](_0x9f1f50['model'],qs[_0x8e1f('0x38')](_0x7838fc['query'][_0x8e1f('0x38')]));_0x361bb9[_0x8e1f('0x37')]=_0x361bb9[_0x8e1f('0x37')][_0x8e1f('0x51')]?_0x361bb9[_0x8e1f('0x37')]:_0x9f1f50['model'];_0x361bb9[_0x8e1f('0x52')]=qs['sort'](_0x7838fc[_0x8e1f('0x33')][_0x8e1f('0x3b')]);_0x361bb9[_0x8e1f('0x3c')]=qs['filters'](_[_0x8e1f('0x53')](_0x7838fc[_0x8e1f('0x33')],_0x9f1f50['filters']));if(_0x7838fc['query'][_0x8e1f('0x3e')]){_0x361bb9[_0x8e1f('0x3c')]=_[_0x8e1f('0x3f')](_0x361bb9['where'],{'$or':_[_0x8e1f('0x2d')](_0x361bb9['attributes'],function(_0x4f83ee){var _0x328d8f={};_0x328d8f[_0x4f83ee]={'$like':'%'+_0x7838fc[_0x8e1f('0x33')][_0x8e1f('0x3e')]+'%'};return _0x328d8f;})});}_0x361bb9=_[_0x8e1f('0x3f')]({},_0x361bb9,_0x7838fc['options']);return _0x339e59[_0x8e1f('0x4f')](_0x361bb9);}})['then'](function(_0x4c3613){if(_0x4c3613){_0x565772=_0x4c3613[_0x8e1f('0x51')];if(!_0x7838fc['query'][_0x8e1f('0x39')]('nolimit')){_0x361bb9[_0x8e1f('0x1e')]=qs[_0x8e1f('0x1e')](_0x7838fc[_0x8e1f('0x33')][_0x8e1f('0x1e')]);_0x361bb9[_0x8e1f('0x1c')]=qs[_0x8e1f('0x1c')](_0x7838fc[_0x8e1f('0x33')][_0x8e1f('0x1c')]);}return _0x339e59['getConditions'](_0x361bb9);}})['then'](function(_0x469cbf){if(_0x469cbf){return _0x469cbf?{'count':_0x565772,'rows':_0x469cbf}:null;}})[_0x8e1f('0x25')](respondWithResult(_0x52b488,null))[_0x8e1f('0x45')](handleError(_0x52b488,null));};exports[_0x8e1f('0x54')]=function(_0x28791f,_0xe5d364,_0x1edf2d){return db[_0x8e1f('0x55')][_0x8e1f('0x49')]({'where':{'id':_0x28791f[_0x8e1f('0x47')]['id']}})[_0x8e1f('0x25')](handleEntityNotFound(_0xe5d364,null))[_0x8e1f('0x25')](function(_0x36c96d){if(_0x36c96d){return _0x36c96d[_0x8e1f('0x54')](_0x28791f['body'][_0x8e1f('0x4d')],_[_0x8e1f('0x4e')](_0x28791f[_0x8e1f('0x4b')],[_0x8e1f('0x4d'),'id'])||{});}})[_0x8e1f('0x25')](respondWithResult(_0xe5d364,null))[_0x8e1f('0x45')](handleError(_0xe5d364,null));};exports[_0x8e1f('0x56')]=function(_0x9b7c3e,_0x2782ae,_0x4c2b3d){var _0x6e30b2={};var _0x63fe91={};var _0xa759cb;var _0x134430;return db[_0x8e1f('0x2e')][_0x8e1f('0x50')]({'where':{'id':_0x9b7c3e['params']['id']}})[_0x8e1f('0x25')](handleEntityNotFound(_0x2782ae,null))[_0x8e1f('0x25')](function(_0x49c402){if(_0x49c402){_0xa759cb=_0x49c402;_0x63fe91[_0x8e1f('0x32')]=_[_0x8e1f('0x34')](db[_0x8e1f('0x55')][_0x8e1f('0x48')]);_0x63fe91['query']=_['keys'](_0x9b7c3e[_0x8e1f('0x33')]);_0x63fe91[_0x8e1f('0x35')]=_['intersection'](_0x63fe91[_0x8e1f('0x32')],_0x63fe91[_0x8e1f('0x33')]);_0x6e30b2[_0x8e1f('0x37')]=_[_0x8e1f('0x36')](_0x63fe91[_0x8e1f('0x32')],qs[_0x8e1f('0x38')](_0x9b7c3e[_0x8e1f('0x33')]['fields']));_0x6e30b2[_0x8e1f('0x37')]=_0x6e30b2[_0x8e1f('0x37')][_0x8e1f('0x51')]?_0x6e30b2['attributes']:_0x63fe91[_0x8e1f('0x32')];_0x6e30b2[_0x8e1f('0x52')]=qs[_0x8e1f('0x3b')](_0x9b7c3e['query'][_0x8e1f('0x3b')]);_0x6e30b2['where']=qs[_0x8e1f('0x35')](_[_0x8e1f('0x53')](_0x9b7c3e[_0x8e1f('0x33')],_0x63fe91['filters']));if(_0x9b7c3e[_0x8e1f('0x33')][_0x8e1f('0x3e')]){_0x6e30b2[_0x8e1f('0x3c')]=_['merge'](_0x6e30b2[_0x8e1f('0x3c')],{'$or':_[_0x8e1f('0x2d')](_0x6e30b2['attributes'],function(_0x106eff){var _0x25821a={};_0x25821a[_0x106eff]={'$like':'%'+_0x9b7c3e['query']['filter']+'%'};return _0x25821a;})});}_0x6e30b2=_[_0x8e1f('0x3f')]({},_0x6e30b2,_0x9b7c3e[_0x8e1f('0x40')]);return _0xa759cb[_0x8e1f('0x56')](_0x6e30b2);}})[_0x8e1f('0x25')](function(_0x29053e){if(_0x29053e){_0x134430=_0x29053e[_0x8e1f('0x51')];if(!_0x9b7c3e[_0x8e1f('0x33')][_0x8e1f('0x39')](_0x8e1f('0x3a'))){_0x6e30b2[_0x8e1f('0x1e')]=qs[_0x8e1f('0x1e')](_0x9b7c3e[_0x8e1f('0x33')][_0x8e1f('0x1e')]);_0x6e30b2[_0x8e1f('0x1c')]=qs[_0x8e1f('0x1c')](_0x9b7c3e[_0x8e1f('0x33')][_0x8e1f('0x1c')]);}return _0xa759cb[_0x8e1f('0x56')](_0x6e30b2);}})[_0x8e1f('0x25')](function(_0x32f266){if(_0x32f266){return _0x32f266?{'count':_0x134430,'rows':_0x32f266}:null;}})[_0x8e1f('0x25')](respondWithResult(_0x2782ae,null))[_0x8e1f('0x45')](handleError(_0x2782ae,null));}; \ No newline at end of file +var _0x377a=['to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','Automation','findAll','rows','catch','show','params','keys','filters','includeAll','include','options','find','create','body','addConditions','Condition','ids','omit','findOne','getConditions','addActions','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x4f05fe,_0x4ff8db){var _0x269abb=function(_0x4b192c){while(--_0x4b192c){_0x4f05fe['push'](_0x4f05fe['shift']());}};_0x269abb(++_0x4ff8db);}(_0x377a,0x134));var _0xa377=function(_0x4cebcc,_0x56253e){_0x4cebcc=_0x4cebcc-0x0;var _0x4d1669=_0x377a[_0x4cebcc];return _0x4d1669;};'use strict';var emlformat=require(_0xa377('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa377('0x1'));var jsonpatch=require(_0xa377('0x2'));var rp=require(_0xa377('0x3'));var moment=require(_0xa377('0x4'));var BPromise=require(_0xa377('0x5'));var Mustache=require('mustache');var util=require(_0xa377('0x6'));var path=require(_0xa377('0x7'));var sox=require('sox');var csv=require(_0xa377('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa377('0x9'));var squel=require('squel');var crypto=require(_0xa377('0xa'));var jsforce=require(_0xa377('0xb'));var deskjs=require(_0xa377('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa377('0xd'));var Redis=require(_0xa377('0xe'));var authService=require(_0xa377('0xf'));var qs=require(_0xa377('0x10'));var as=require(_0xa377('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa377('0x12'))(_0xa377('0x13'));var utils=require(_0xa377('0x14'));var config=require(_0xa377('0x15'));var licenseUtil=require(_0xa377('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfe799b,_0x1a826){_0x1a826=_0x1a826||0xcc;return function(_0x342408){if(_0x342408){return _0xfe799b['sendStatus'](_0x1a826);}return _0xfe799b[_0xa377('0x17')](_0x1a826)[_0xa377('0x18')]();};}function respondWithResult(_0x55576e,_0x6e68b0){_0x6e68b0=_0x6e68b0||0xc8;return function(_0x48fb61){if(_0x48fb61){return _0x55576e['status'](_0x6e68b0)[_0xa377('0x19')](_0x48fb61);}};}function respondWithFilteredResult(_0x2180f2,_0x854d5a){return function(_0x53e3fd){if(_0x53e3fd){var _0x9bd580=typeof _0x854d5a[_0xa377('0x1a')]==='undefined'&&typeof _0x854d5a[_0xa377('0x1b')]===_0xa377('0x1c');var _0x65356e=_0x53e3fd[_0xa377('0x1d')];var _0x23defe=_0x9bd580?0x0:_0x854d5a[_0xa377('0x1a')];var _0x139383=_0x9bd580?_0x53e3fd[_0xa377('0x1d')]:_0x854d5a[_0xa377('0x1a')]+_0x854d5a[_0xa377('0x1b')];var _0x4d2e44;if(_0x139383>=_0x65356e){_0x139383=_0x65356e;_0x4d2e44=0xc8;}else{_0x4d2e44=0xce;}_0x2180f2[_0xa377('0x17')](_0x4d2e44);return _0x2180f2[_0xa377('0x1e')]('Content-Range',_0x23defe+'-'+_0x139383+'/'+_0x65356e)[_0xa377('0x19')](_0x53e3fd);}return null;};}function patchUpdates(_0x3c3f8a){return function(_0x591b52){try{jsonpatch['apply'](_0x591b52,_0x3c3f8a,!![]);}catch(_0x35e658){return BPromise[_0xa377('0x1f')](_0x35e658);}return _0x591b52[_0xa377('0x20')]();};}function saveUpdates(_0x32bee8,_0x3648a7){return function(_0x4a7cf4){if(_0x4a7cf4){return _0x4a7cf4[_0xa377('0x21')](_0x32bee8)['then'](function(_0x22c3f7){return _0x22c3f7;});}return null;};}function removeEntity(_0x5b569c,_0x409178){return function(_0x3a74ba){if(_0x3a74ba){return _0x3a74ba[_0xa377('0x22')]()[_0xa377('0x23')](function(){_0x5b569c['status'](0xcc)[_0xa377('0x18')]();});}};}function handleEntityNotFound(_0x283309,_0xbb60cb){return function(_0x4d771c){if(!_0x4d771c){_0x283309['sendStatus'](0x194);}return _0x4d771c;};}function handleError(_0x427a8d,_0x170141){_0x170141=_0x170141||0x1f4;return function(_0x9a8cb4){logger['error'](_0x9a8cb4[_0xa377('0x24')]);if(_0x9a8cb4['name']){delete _0x9a8cb4[_0xa377('0x25')];}_0x427a8d[_0xa377('0x17')](_0x170141)[_0xa377('0x26')](_0x9a8cb4);};}exports[_0xa377('0x27')]=function(_0x2a105b,_0x22e6ba){var _0x27c3d6={},_0x38c75c={},_0x31dac7={'count':0x0,'rows':[]};var _0x3a91a0=_[_0xa377('0x28')](db['Automation'][_0xa377('0x29')],function(_0x5ddd06){return{'name':_0x5ddd06[_0xa377('0x2a')],'type':_0x5ddd06[_0xa377('0x2b')]['key']};});_0x38c75c[_0xa377('0x2c')]=_[_0xa377('0x28')](_0x3a91a0,_0xa377('0x25'));_0x38c75c['query']=_['keys'](_0x2a105b['query']);_0x38c75c['filters']=_['intersection'](_0x38c75c['model'],_0x38c75c[_0xa377('0x2d')]);_0x27c3d6['attributes']=_[_0xa377('0x2e')](_0x38c75c[_0xa377('0x2c')],qs[_0xa377('0x2f')](_0x2a105b[_0xa377('0x2d')][_0xa377('0x2f')]));_0x27c3d6[_0xa377('0x30')]=_0x27c3d6[_0xa377('0x30')][_0xa377('0x31')]?_0x27c3d6[_0xa377('0x30')]:_0x38c75c[_0xa377('0x2c')];if(!_0x2a105b[_0xa377('0x2d')][_0xa377('0x32')](_0xa377('0x33'))){_0x27c3d6[_0xa377('0x1b')]=qs[_0xa377('0x1b')](_0x2a105b[_0xa377('0x2d')][_0xa377('0x1b')]);_0x27c3d6[_0xa377('0x1a')]=qs[_0xa377('0x1a')](_0x2a105b[_0xa377('0x2d')][_0xa377('0x1a')]);}_0x27c3d6[_0xa377('0x34')]=qs[_0xa377('0x35')](_0x2a105b[_0xa377('0x2d')]['sort']);_0x27c3d6[_0xa377('0x36')]=qs['filters'](_['pick'](_0x2a105b[_0xa377('0x2d')],_0x38c75c['filters']),_0x3a91a0);if(_0x2a105b[_0xa377('0x2d')][_0xa377('0x37')]){_0x27c3d6['where']=_[_0xa377('0x38')](_0x27c3d6[_0xa377('0x36')],{'$or':_['map'](_0x3a91a0,function(_0x5806e9){if(_0x5806e9[_0xa377('0x2b')]!=='VIRTUAL'){var _0x492513={};_0x492513[_0x5806e9[_0xa377('0x25')]]={'$like':'%'+_0x2a105b['query'][_0xa377('0x37')]+'%'};return _0x492513;}})});}_0x27c3d6=_[_0xa377('0x38')]({},_0x27c3d6,_0x2a105b['options']);var _0x346c9e={'where':_0x27c3d6['where']};return db[_0xa377('0x39')][_0xa377('0x1d')](_0x346c9e)[_0xa377('0x23')](function(_0x247753){_0x31dac7[_0xa377('0x1d')]=_0x247753;if(_0x2a105b[_0xa377('0x2d')]['includeAll']){_0x27c3d6['include']=[{'all':!![]}];}return db[_0xa377('0x39')][_0xa377('0x3a')](_0x27c3d6);})[_0xa377('0x23')](function(_0x2261d2){_0x31dac7[_0xa377('0x3b')]=_0x2261d2;return _0x31dac7;})[_0xa377('0x23')](respondWithFilteredResult(_0x22e6ba,_0x27c3d6))[_0xa377('0x3c')](handleError(_0x22e6ba,null));};exports[_0xa377('0x3d')]=function(_0x43bd1e,_0x3785d4){var _0x56cb0b={'raw':![],'where':{'id':_0x43bd1e[_0xa377('0x3e')]['id']}},_0x244cff={};_0x244cff[_0xa377('0x2c')]=_['keys'](db[_0xa377('0x39')]['rawAttributes']);_0x244cff[_0xa377('0x2d')]=_[_0xa377('0x3f')](_0x43bd1e[_0xa377('0x2d')]);_0x244cff[_0xa377('0x40')]=_[_0xa377('0x2e')](_0x244cff[_0xa377('0x2c')],_0x244cff[_0xa377('0x2d')]);_0x56cb0b[_0xa377('0x30')]=_['intersection'](_0x244cff['model'],qs[_0xa377('0x2f')](_0x43bd1e[_0xa377('0x2d')][_0xa377('0x2f')]));_0x56cb0b[_0xa377('0x30')]=_0x56cb0b[_0xa377('0x30')][_0xa377('0x31')]?_0x56cb0b[_0xa377('0x30')]:_0x244cff[_0xa377('0x2c')];if(_0x43bd1e[_0xa377('0x2d')][_0xa377('0x41')]){_0x56cb0b[_0xa377('0x42')]=[{'all':!![]}];}_0x56cb0b=_[_0xa377('0x38')]({},_0x56cb0b,_0x43bd1e[_0xa377('0x43')]);return db[_0xa377('0x39')][_0xa377('0x44')](_0x56cb0b)[_0xa377('0x23')](handleEntityNotFound(_0x3785d4,null))[_0xa377('0x23')](respondWithResult(_0x3785d4,null))['catch'](handleError(_0x3785d4,null));};exports[_0xa377('0x45')]=function(_0x1fffbf,_0x4db9f8){return db[_0xa377('0x39')]['create'](_0x1fffbf[_0xa377('0x46')],{})[_0xa377('0x23')](respondWithResult(_0x4db9f8,0xc9))['catch'](handleError(_0x4db9f8,null));};exports[_0xa377('0x21')]=function(_0x443962,_0x3801e7){if(_0x443962[_0xa377('0x46')]['id']){delete _0x443962[_0xa377('0x46')]['id'];}return db['Automation']['find']({'where':{'id':_0x443962[_0xa377('0x3e')]['id']}})[_0xa377('0x23')](handleEntityNotFound(_0x3801e7,null))[_0xa377('0x23')](saveUpdates(_0x443962[_0xa377('0x46')],null))[_0xa377('0x23')](respondWithResult(_0x3801e7,null))[_0xa377('0x3c')](handleError(_0x3801e7,null));};exports['destroy']=function(_0x2655fb,_0xbaa63){return db[_0xa377('0x39')][_0xa377('0x44')]({'where':{'id':_0x2655fb[_0xa377('0x3e')]['id']}})[_0xa377('0x23')](handleEntityNotFound(_0xbaa63,null))[_0xa377('0x23')](removeEntity(_0xbaa63,null))[_0xa377('0x3c')](handleError(_0xbaa63,null));};exports[_0xa377('0x47')]=function(_0x5a8981,_0x2ae82b,_0x596bd8){return db[_0xa377('0x48')][_0xa377('0x44')]({'where':{'id':_0x5a8981['params']['id']}})[_0xa377('0x23')](handleEntityNotFound(_0x2ae82b,null))['then'](function(_0x5f5ebb){if(_0x5f5ebb){return _0x5f5ebb[_0xa377('0x47')](_0x5a8981[_0xa377('0x46')][_0xa377('0x49')],_[_0xa377('0x4a')](_0x5a8981['body'],['ids','id'])||{});}})[_0xa377('0x23')](respondWithResult(_0x2ae82b,null))[_0xa377('0x3c')](handleError(_0x2ae82b,null));};exports['getConditions']=function(_0x5553eb,_0x267ade,_0x19c970){var _0x5e4368={};var _0x29eb55={};var _0x1ee447;var _0x4fb217;return db[_0xa377('0x39')][_0xa377('0x4b')]({'where':{'id':_0x5553eb[_0xa377('0x3e')]['id']}})['then'](handleEntityNotFound(_0x267ade,null))['then'](function(_0x13f66d){if(_0x13f66d){_0x1ee447=_0x13f66d;_0x29eb55[_0xa377('0x2c')]=_['keys'](db[_0xa377('0x48')][_0xa377('0x29')]);_0x29eb55['query']=_['keys'](_0x5553eb[_0xa377('0x2d')]);_0x29eb55[_0xa377('0x40')]=_[_0xa377('0x2e')](_0x29eb55[_0xa377('0x2c')],_0x29eb55['query']);_0x5e4368[_0xa377('0x30')]=_[_0xa377('0x2e')](_0x29eb55[_0xa377('0x2c')],qs['fields'](_0x5553eb['query'][_0xa377('0x2f')]));_0x5e4368[_0xa377('0x30')]=_0x5e4368[_0xa377('0x30')][_0xa377('0x31')]?_0x5e4368[_0xa377('0x30')]:_0x29eb55[_0xa377('0x2c')];_0x5e4368[_0xa377('0x34')]=qs[_0xa377('0x35')](_0x5553eb['query'][_0xa377('0x35')]);_0x5e4368[_0xa377('0x36')]=qs[_0xa377('0x40')](_['pick'](_0x5553eb[_0xa377('0x2d')],_0x29eb55[_0xa377('0x40')]));if(_0x5553eb[_0xa377('0x2d')]['filter']){_0x5e4368[_0xa377('0x36')]=_[_0xa377('0x38')](_0x5e4368[_0xa377('0x36')],{'$or':_[_0xa377('0x28')](_0x5e4368['attributes'],function(_0x19a11d){var _0x1f161d={};_0x1f161d[_0x19a11d]={'$like':'%'+_0x5553eb[_0xa377('0x2d')][_0xa377('0x37')]+'%'};return _0x1f161d;})});}_0x5e4368=_[_0xa377('0x38')]({},_0x5e4368,_0x5553eb[_0xa377('0x43')]);return _0x1ee447[_0xa377('0x4c')](_0x5e4368);}})[_0xa377('0x23')](function(_0x54d303){if(_0x54d303){_0x4fb217=_0x54d303[_0xa377('0x31')];if(!_0x5553eb['query']['hasOwnProperty'](_0xa377('0x33'))){_0x5e4368[_0xa377('0x1b')]=qs[_0xa377('0x1b')](_0x5553eb[_0xa377('0x2d')][_0xa377('0x1b')]);_0x5e4368[_0xa377('0x1a')]=qs['offset'](_0x5553eb[_0xa377('0x2d')][_0xa377('0x1a')]);}return _0x1ee447[_0xa377('0x4c')](_0x5e4368);}})[_0xa377('0x23')](function(_0x2140ae){if(_0x2140ae){return _0x2140ae?{'count':_0x4fb217,'rows':_0x2140ae}:null;}})['then'](respondWithResult(_0x267ade,null))[_0xa377('0x3c')](handleError(_0x267ade,null));};exports[_0xa377('0x4d')]=function(_0x5087d9,_0x220d92,_0x356c1e){return db['Action'][_0xa377('0x44')]({'where':{'id':_0x5087d9[_0xa377('0x3e')]['id']}})[_0xa377('0x23')](handleEntityNotFound(_0x220d92,null))[_0xa377('0x23')](function(_0x51e618){if(_0x51e618){return _0x51e618['addActions'](_0x5087d9[_0xa377('0x46')]['ids'],_['omit'](_0x5087d9[_0xa377('0x46')],[_0xa377('0x49'),'id'])||{});}})['then'](respondWithResult(_0x220d92,null))['catch'](handleError(_0x220d92,null));};exports[_0xa377('0x4e')]=function(_0x1ea7c2,_0x1b532b,_0x240886){var _0x427beb={};var _0x491515={};var _0x48519e;var _0x36b257;return db['Automation'][_0xa377('0x4b')]({'where':{'id':_0x1ea7c2[_0xa377('0x3e')]['id']}})[_0xa377('0x23')](handleEntityNotFound(_0x1b532b,null))['then'](function(_0x3aa8be){if(_0x3aa8be){_0x48519e=_0x3aa8be;_0x491515['model']=_[_0xa377('0x3f')](db['Action']['rawAttributes']);_0x491515[_0xa377('0x2d')]=_[_0xa377('0x3f')](_0x1ea7c2[_0xa377('0x2d')]);_0x491515[_0xa377('0x40')]=_[_0xa377('0x2e')](_0x491515[_0xa377('0x2c')],_0x491515['query']);_0x427beb[_0xa377('0x30')]=_[_0xa377('0x2e')](_0x491515['model'],qs[_0xa377('0x2f')](_0x1ea7c2[_0xa377('0x2d')][_0xa377('0x2f')]));_0x427beb[_0xa377('0x30')]=_0x427beb[_0xa377('0x30')][_0xa377('0x31')]?_0x427beb[_0xa377('0x30')]:_0x491515[_0xa377('0x2c')];_0x427beb[_0xa377('0x34')]=qs['sort'](_0x1ea7c2[_0xa377('0x2d')]['sort']);_0x427beb[_0xa377('0x36')]=qs['filters'](_['pick'](_0x1ea7c2['query'],_0x491515['filters']));if(_0x1ea7c2[_0xa377('0x2d')][_0xa377('0x37')]){_0x427beb[_0xa377('0x36')]=_[_0xa377('0x38')](_0x427beb['where'],{'$or':_[_0xa377('0x28')](_0x427beb[_0xa377('0x30')],function(_0x66b7f5){var _0x101fd3={};_0x101fd3[_0x66b7f5]={'$like':'%'+_0x1ea7c2[_0xa377('0x2d')][_0xa377('0x37')]+'%'};return _0x101fd3;})});}_0x427beb=_[_0xa377('0x38')]({},_0x427beb,_0x1ea7c2['options']);return _0x48519e[_0xa377('0x4e')](_0x427beb);}})[_0xa377('0x23')](function(_0x3676cc){if(_0x3676cc){_0x36b257=_0x3676cc[_0xa377('0x31')];if(!_0x1ea7c2[_0xa377('0x2d')][_0xa377('0x32')](_0xa377('0x33'))){_0x427beb[_0xa377('0x1b')]=qs[_0xa377('0x1b')](_0x1ea7c2['query'][_0xa377('0x1b')]);_0x427beb['offset']=qs[_0xa377('0x1a')](_0x1ea7c2[_0xa377('0x2d')][_0xa377('0x1a')]);}return _0x48519e[_0xa377('0x4e')](_0x427beb);}})[_0xa377('0x23')](function(_0x123280){if(_0x123280){return _0x123280?{'count':_0x36b257,'rows':_0x123280}:null;}})['then'](respondWithResult(_0x1b532b,null))[_0xa377('0x3c')](handleError(_0x1b532b,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 7866611..a8f9f05 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 _0xa7fc=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations'];(function(_0x3e665d,_0x36c437){var _0x16bb58=function(_0x422b6d){while(--_0x422b6d){_0x3e665d['push'](_0x3e665d['shift']());}};_0x16bb58(++_0x36c437);}(_0xa7fc,0x138));var _0xca7f=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0xa7fc[_0xbe40ad];return _0x50fac9;};'use strict';var _=require(_0xca7f('0x0'));var util=require(_0xca7f('0x1'));var logger=require('../../config/logger')(_0xca7f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xca7f('0x3'));var fs=require('fs');var path=require(_0xca7f('0x4'));var rimraf=require(_0xca7f('0x5'));var config=require(_0xca7f('0x6'));var attributes=require(_0xca7f('0x7'));module[_0xca7f('0x8')]=function(_0x48eefb,_0x5d5797){return _0x48eefb[_0xca7f('0x9')](_0xca7f('0xa'),attributes,{'tableName':_0xca7f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c7c=['../../config/environment','./automation.attributes','define','Automation','tools_automations','lodash','util','moment','request-promise','rimraf'];(function(_0x2ed395,_0x24323b){var _0x14a5eb=function(_0x12a09b){while(--_0x12a09b){_0x2ed395['push'](_0x2ed395['shift']());}};_0x14a5eb(++_0x24323b);}(_0x3c7c,0x1a9));var _0xc3c7=function(_0xf32c6d,_0x372704){_0xf32c6d=_0xf32c6d-0x0;var _0x156c11=_0x3c7c[_0xf32c6d];return _0x156c11;};'use strict';var _=require(_0xc3c7('0x0'));var util=require(_0xc3c7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc3c7('0x2'));var BPromise=require('bluebird');var rp=require(_0xc3c7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3c7('0x4'));var config=require(_0xc3c7('0x5'));var attributes=require(_0xc3c7('0x6'));module['exports']=function(_0x513f9b,_0x130cde){return _0x513f9b[_0xc3c7('0x7')](_0xc3c7('0x8'),attributes,{'tableName':_0xc3c7('0x9'),'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 4cac613..0613941 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 _0x7cdc=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4c5761,_0x2e66f3){var _0x421454=function(_0x3ba6da){while(--_0x3ba6da){_0x4c5761['push'](_0x4c5761['shift']());}};_0x421454(++_0x2e66f3);}(_0x7cdc,0x190));var _0xc7cd=function(_0xbe948d,_0x57f657){_0xbe948d=_0xbe948d-0x0;var _0x2fc1df=_0x7cdc[_0xbe948d];return _0x2fc1df;};'use strict';var _=require('lodash');var util=require(_0xc7cd('0x0'));var moment=require(_0xc7cd('0x1'));var BPromise=require('bluebird');var rs=require(_0xc7cd('0x2'));var fs=require('fs');var Redis=require(_0xc7cd('0x3'));var db=require(_0xc7cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7cd('0x5'))(_0xc7cd('0x6'));var config=require('../../config/environment');var jayson=require(_0xc7cd('0x7'));var client=jayson[_0xc7cd('0x8')][_0xc7cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c168c,_0x13ffeb,_0x30089e){return new BPromise(function(_0x42a4b8,_0x5b5d3d){return client[_0xc7cd('0xa')](_0x2c168c,_0x30089e)['then'](function(_0x36d8b9){logger[_0xc7cd('0xb')](_0xc7cd('0xc'),_0x13ffeb,_0xc7cd('0xd'));logger['debug'](_0xc7cd('0xe'),_0x13ffeb,_0xc7cd('0xd'),JSON[_0xc7cd('0xf')](_0x36d8b9));if(_0x36d8b9[_0xc7cd('0x10')]){if(_0x36d8b9['error'][_0xc7cd('0x11')]===0x1f4){logger['error'](_0xc7cd('0xc'),_0x13ffeb,_0x36d8b9[_0xc7cd('0x10')][_0xc7cd('0x12')]);return _0x5b5d3d(_0x36d8b9[_0xc7cd('0x10')]['message']);}logger[_0xc7cd('0x10')](_0xc7cd('0xc'),_0x13ffeb,_0x36d8b9['error'][_0xc7cd('0x12')]);return _0x42a4b8(_0x36d8b9['error'][_0xc7cd('0x12')]);}else{logger['info'](_0xc7cd('0xc'),_0x13ffeb,_0xc7cd('0xd'));_0x42a4b8(_0x36d8b9[_0xc7cd('0x13')][_0xc7cd('0x12')]);}})['catch'](function(_0x211e6d){logger[_0xc7cd('0x10')](_0xc7cd('0xc'),_0x13ffeb,_0x211e6d);_0x5b5d3d(_0x211e6d);});});} \ No newline at end of file +var _0xeda7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','Automation,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1b31e3,_0x3f291d){var _0x5b7c8e=function(_0x285cf7){while(--_0x285cf7){_0x1b31e3['push'](_0x1b31e3['shift']());}};_0x5b7c8e(++_0x3f291d);}(_0xeda7,0x196));var _0x7eda=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xeda7[_0x20589d];return _0x422de9;};'use strict';var _=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var moment=require(_0x7eda('0x2'));var BPromise=require(_0x7eda('0x3'));var rs=require(_0x7eda('0x4'));var fs=require('fs');var Redis=require(_0x7eda('0x5'));var db=require(_0x7eda('0x6'))['db'];var utils=require(_0x7eda('0x7'));var logger=require(_0x7eda('0x8'))(_0x7eda('0x9'));var config=require(_0x7eda('0xa'));var jayson=require(_0x7eda('0xb'));var client=jayson[_0x7eda('0xc')][_0x7eda('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x314602,_0x839e38,_0x163427){return new BPromise(function(_0x2bc200,_0x11576a){return client[_0x7eda('0xe')](_0x314602,_0x163427)['then'](function(_0x29bce2){logger['info']('Automation,\x20%s,\x20%s',_0x839e38,_0x7eda('0xf'));logger[_0x7eda('0x10')](_0x7eda('0x11'),_0x839e38,_0x7eda('0xf'),JSON['stringify'](_0x29bce2));if(_0x29bce2['error']){if(_0x29bce2[_0x7eda('0x12')][_0x7eda('0x13')]===0x1f4){logger[_0x7eda('0x12')](_0x7eda('0x14'),_0x839e38,_0x29bce2['error'][_0x7eda('0x15')]);return _0x11576a(_0x29bce2['error'][_0x7eda('0x15')]);}logger[_0x7eda('0x12')](_0x7eda('0x14'),_0x839e38,_0x29bce2[_0x7eda('0x12')][_0x7eda('0x15')]);return _0x2bc200(_0x29bce2[_0x7eda('0x12')][_0x7eda('0x15')]);}else{logger[_0x7eda('0x16')](_0x7eda('0x14'),_0x839e38,'request\x20sent');_0x2bc200(_0x29bce2['result'][_0x7eda('0x15')]);}})['catch'](function(_0x597ce9){logger[_0x7eda('0x12')](_0x7eda('0x14'),_0x839e38,_0x597ce9);_0x11576a(_0x597ce9);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 547577f..d43a235 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 _0x8ece=['addActions','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','getActions','post','create','/:id/conditions','addConditions','/:id/actions'];(function(_0x36d0f3,_0x25b32e){var _0x652721=function(_0x5f1d75){while(--_0x5f1d75){_0x36d0f3['push'](_0x36d0f3['shift']());}};_0x652721(++_0x25b32e);}(_0x8ece,0x195));var _0xe8ec=function(_0x1c3dcf,_0x2bab00){_0x1c3dcf=_0x1c3dcf-0x0;var _0x343dc1=_0x8ece[_0x1c3dcf];return _0x343dc1;};'use strict';var multer=require(_0xe8ec('0x0'));var util=require(_0xe8ec('0x1'));var path=require(_0xe8ec('0x2'));var timeout=require(_0xe8ec('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe8ec('0x4'));var auth=require(_0xe8ec('0x5'));var interaction=require(_0xe8ec('0x6'));var config=require(_0xe8ec('0x7'));var controller=require(_0xe8ec('0x8'));router['get']('/',auth[_0xe8ec('0x9')](),controller[_0xe8ec('0xa')]);router[_0xe8ec('0xb')](_0xe8ec('0xc'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0xd')]);router[_0xe8ec('0xb')]('/:id/conditions',auth[_0xe8ec('0x9')](),controller['getConditions']);router[_0xe8ec('0xb')]('/:id/actions',auth[_0xe8ec('0x9')](),controller[_0xe8ec('0xe')]);router[_0xe8ec('0xf')]('/',auth[_0xe8ec('0x9')](),controller[_0xe8ec('0x10')]);router[_0xe8ec('0xf')](_0xe8ec('0x11'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0x12')]);router[_0xe8ec('0xf')](_0xe8ec('0x13'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0x14')]);router['put'](_0xe8ec('0xc'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0x15')]);router[_0xe8ec('0x16')](_0xe8ec('0xc'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0x17')]);module[_0xe8ec('0x18')]=router; \ No newline at end of file +var _0xe186=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','/:id','update','delete','destroy'];(function(_0x3d4860,_0x283ab0){var _0x443fe0=function(_0x2af6da){while(--_0x2af6da){_0x3d4860['push'](_0x3d4860['shift']());}};_0x443fe0(++_0x283ab0);}(_0xe186,0x146));var _0x6e18=function(_0x28ddc8,_0x1fdee0){_0x28ddc8=_0x28ddc8-0x0;var _0x1c4d21=_0xe186[_0x28ddc8];return _0x1c4d21;};'use strict';var multer=require(_0x6e18('0x0'));var util=require(_0x6e18('0x1'));var path=require('path');var timeout=require(_0x6e18('0x2'));var express=require(_0x6e18('0x3'));var router=express[_0x6e18('0x4')]();var fs_extra=require(_0x6e18('0x5'));var auth=require(_0x6e18('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6e18('0x7'));var controller=require('./automation.controller');router[_0x6e18('0x8')]('/',auth[_0x6e18('0x9')](),controller[_0x6e18('0xa')]);router['get']('/:id',auth[_0x6e18('0x9')](),controller[_0x6e18('0xb')]);router[_0x6e18('0x8')](_0x6e18('0xc'),auth[_0x6e18('0x9')](),controller[_0x6e18('0xd')]);router[_0x6e18('0x8')](_0x6e18('0xe'),auth['isAuthenticated'](),controller[_0x6e18('0xf')]);router[_0x6e18('0x10')]('/',auth[_0x6e18('0x9')](),controller[_0x6e18('0x11')]);router[_0x6e18('0x10')]('/:id/conditions',auth[_0x6e18('0x9')](),controller['addConditions']);router[_0x6e18('0x10')](_0x6e18('0xe'),auth[_0x6e18('0x9')](),controller[_0x6e18('0x12')]);router[_0x6e18('0x13')](_0x6e18('0x14'),auth['isAuthenticated'](),controller[_0x6e18('0x15')]);router[_0x6e18('0x16')](_0x6e18('0x14'),auth['isAuthenticated'](),controller[_0x6e18('0x17')]);module[_0x6e18('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 01c960b..adf9fb7 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 _0xe3f6=['#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#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\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence'];(function(_0x3e32a8,_0x255953){var _0x2997b0=function(_0x2d564a){while(--_0x2d564a){_0x3e32a8['push'](_0x3e32a8['shift']());}};_0x2997b0(++_0x255953);}(_0xe3f6,0x7a));var _0x6e3f=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xe3f6[_0x307d86];return _0x361745;};'use strict';var Sequelize=require(_0x6e3f('0x0'));module[_0x6e3f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6e3f('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x6e3f('0x3')](_0x6e3f('0x4')),'allowNull':![],'defaultValue':_0x6e3f('0x4')},'description':{'type':Sequelize[_0x6e3f('0x5')]},'active':{'type':Sequelize[_0x6e3f('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x6e3f('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x6e3f('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6e3f('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x6e3f('0x9')](0x3)[_0x6e3f('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x6e3f('0x9')](0x3)[_0x6e3f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e3f('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x6e3f('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e3f('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x6e3f('0x9')](0x3)[_0x6e3f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e3f('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6e3f('0x9')](0x5)[_0x6e3f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e3f('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6e3f('0x7')],'defaultValue':0x3,'comment':_0x6e3f('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6e3f('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x6e3f('0x9')](0x3)[_0x6e3f('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6e3f('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x6e3f('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x6e3f('0x11'),_0x6e3f('0x12'),_0x6e3f('0x13')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x6e3f('0x6')],'defaultValue':0x0,'comment':_0x6e3f('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x6e3f('0x9')](0x9)[_0x6e3f('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6e3f('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x6e3f('0x9')](0x9)[_0x6e3f('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x6e3f('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6e3f('0x9')](0x9)[_0x6e3f('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x6e3f('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x6e3f('0x9')](0x9)[_0x6e3f('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6e3f('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x6e3f('0x9')](0x9)[_0x6e3f('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6e3f('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6e3f('0x9')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x6e3f('0x9')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6e3f('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x6e3f('0x9')](0x5)[_0x6e3f('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6e3f('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x6e3f('0x9')](0x9)[_0x6e3f('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6e3f('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x6e3f('0x3')](_0x6e3f('0x1d'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x6e3f('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x6e3f('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x6e3f('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6e3f('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6e3f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x6e3f('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6e3f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6e3f('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e3f('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6e3f('0x9')](0x5)[_0x6e3f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e3f('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x6e3f('0x9')](0x3)[_0x6e3f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e3f('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x6e3f('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6e3f('0x9')](0x3)[_0x6e3f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6e3f('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x6e3f('0x9')](0x5)[_0x6e3f('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6e3f('0x23')}}; \ No newline at end of file +var _0x7ee0=['Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#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','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x32f8de,_0x42f773){var _0x4abd26=function(_0x5064cc){while(--_0x5064cc){_0x32f8de['push'](_0x32f8de['shift']());}};_0x4abd26(++_0x42f773);}(_0x7ee0,0x123));var _0x07ee=function(_0x3533ab,_0x2d84a0){_0x3533ab=_0x3533ab-0x0;var _0x54fb06=_0x7ee0[_0x3533ab];return _0x54fb06;};'use strict';var Sequelize=require('sequelize');module[_0x07ee('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x07ee('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x07ee('0x2')](_0x07ee('0x3')),'allowNull':![],'defaultValue':_0x07ee('0x3')},'description':{'type':Sequelize[_0x07ee('0x4')]},'active':{'type':Sequelize[_0x07ee('0x5')],'defaultValue':0x0,'comment':_0x07ee('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x07ee('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x07ee('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x07ee('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x07ee('0x8')](0x3)[_0x07ee('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x07ee('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x07ee('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x07ee('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0xd')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x07ee('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x07ee('0x8')](0x3)[_0x07ee('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x07ee('0x8')](0x5)[_0x07ee('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x07ee('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x07ee('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x07ee('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x07ee('0x2')](_0x07ee('0x10'),'never',_0x07ee('0x11')),'defaultValue':_0x07ee('0x10')},'dialAMDActive':{'type':Sequelize[_0x07ee('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x07ee('0x8')](0x9)[_0x07ee('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x07ee('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x07ee('0x8')](0x9)[_0x07ee('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x07ee('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x07ee('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x07ee('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x07ee('0x8')](0x9)[_0x07ee('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x07ee('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x07ee('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x07ee('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x07ee('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x07ee('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x07ee('0x8')](0x9)[_0x07ee('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x07ee('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x07ee('0x8')](0x5)[_0x07ee('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x07ee('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x07ee('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x07ee('0x2')](_0x07ee('0x1a'),_0x07ee('0x1b')),'defaultValue':_0x07ee('0x1a')},'dialPrefix':{'type':Sequelize[_0x07ee('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x07ee('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x07ee('0x1c')},'dialCutDigit':{'type':Sequelize[_0x07ee('0x8')](0x3)[_0x07ee('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x07ee('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x07ee('0x8')](0x3)[_0x07ee('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x07ee('0x8')](0x3)[_0x07ee('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x07ee('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x07ee('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x07ee('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x07ee('0x8')](0x3)[_0x07ee('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x07ee('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x07ee('0x8')](0x3)[_0x07ee('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x07ee('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x07ee('0x8')](0x5)[_0x07ee('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x07ee('0x27')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index cd34bc2..e05475c 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 _0x93e7=['join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','spread','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','Campaign','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','create','user','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','IvrCampaigns','UserProfileSection','UserProfileResource','catch','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','nolimit','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','phone','scheduledAt','ContactId','ListId','select','NOW()','field','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','into','cm_hopper','fromQuery','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','ci.OrderBY'];(function(_0x545227,_0x449497){var _0x50dc4c=function(_0x3e4a38){while(--_0x3e4a38){_0x545227['push'](_0x545227['shift']());}};_0x50dc4c(++_0x449497);}(_0x93e7,0x9e));var _0x793e=function(_0x25c044,_0xbd05f8){_0x25c044=_0x25c044-0x0;var _0x558ee5=_0x93e7[_0x25c044];return _0x558ee5;};'use strict';var emlformat=require(_0x793e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x793e('0x1'));var jsonpatch=require(_0x793e('0x2'));var rp=require('request-promise');var moment=require(_0x793e('0x3'));var BPromise=require(_0x793e('0x4'));var Mustache=require(_0x793e('0x5'));var util=require(_0x793e('0x6'));var path=require('path');var sox=require(_0x793e('0x7'));var csv=require('to-csv');var ejs=require(_0x793e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x793e('0x9'));var squel=require('squel');var crypto=require(_0x793e('0xa'));var jsforce=require(_0x793e('0xb'));var deskjs=require(_0x793e('0xc'));var toCsv=require(_0x793e('0xd'));var querystring=require(_0x793e('0xe'));var Papa=require(_0x793e('0xf'));var Redis=require(_0x793e('0x10'));var authService=require(_0x793e('0x11'));var qs=require(_0x793e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x793e('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x793e('0x14'));var db=require(_0x793e('0x15'))['db'];function respondWithStatusCode(_0x57709f,_0x6a5f34){_0x6a5f34=_0x6a5f34||0xcc;return function(_0x2e2efe){if(_0x2e2efe){return _0x57709f[_0x793e('0x16')](_0x6a5f34);}return _0x57709f[_0x793e('0x17')](_0x6a5f34)[_0x793e('0x18')]();};}function respondWithResult(_0x410914,_0x1c7c58){_0x1c7c58=_0x1c7c58||0xc8;return function(_0x3a0952){if(_0x3a0952){return _0x410914[_0x793e('0x17')](_0x1c7c58)[_0x793e('0x19')](_0x3a0952);}};}function respondWithFilteredResult(_0x1121e5,_0x36686c){return function(_0x418b5f){if(_0x418b5f){var _0x18990a=typeof _0x36686c[_0x793e('0x1a')]===_0x793e('0x1b')&&typeof _0x36686c[_0x793e('0x1c')]===_0x793e('0x1b');var _0xeacea6=_0x418b5f['count'];var _0x3b38ef=_0x18990a?0x0:_0x36686c[_0x793e('0x1a')];var _0x4ba056=_0x18990a?_0x418b5f['count']:_0x36686c['offset']+_0x36686c[_0x793e('0x1c')];var _0x2f0494;if(_0x4ba056>=_0xeacea6){_0x4ba056=_0xeacea6;_0x2f0494=0xc8;}else{_0x2f0494=0xce;}_0x1121e5[_0x793e('0x17')](_0x2f0494);return _0x1121e5[_0x793e('0x1d')](_0x793e('0x1e'),_0x3b38ef+'-'+_0x4ba056+'/'+_0xeacea6)[_0x793e('0x19')](_0x418b5f);}return null;};}function patchUpdates(_0x1af167){return function(_0x9413f9){try{jsonpatch[_0x793e('0x1f')](_0x9413f9,_0x1af167,!![]);}catch(_0x31413a){return BPromise[_0x793e('0x20')](_0x31413a);}return _0x9413f9[_0x793e('0x21')]();};}function saveUpdates(_0x1596bf,_0xed37e){return function(_0x33fe28){if(_0x33fe28){return _0x33fe28[_0x793e('0x22')](_0x1596bf)[_0x793e('0x23')](function(_0x4be20c){return _0x4be20c;});}return null;};}function removeEntity(_0x59a4ff,_0xc259c8){return function(_0x36840f){if(_0x36840f){return _0x36840f['destroy']()[_0x793e('0x23')](function(){var _0x491d2a=_0x36840f['get']({'plain':!![]});var _0x55b37a='IvrCampaigns';return db['UserProfileResource'][_0x793e('0x24')]({'where':{'type':_0x55b37a,'resourceId':_0x491d2a['id']}})[_0x793e('0x23')](function(){return _0x36840f;});})[_0x793e('0x23')](function(){_0x59a4ff[_0x793e('0x17')](0xcc)[_0x793e('0x18')]();});}};}function handleEntityNotFound(_0xa144b1,_0x2946ff){return function(_0x90ba05){if(!_0x90ba05){_0xa144b1[_0x793e('0x16')](0x194);}return _0x90ba05;};}function handleError(_0x13f15f,_0x1b339c){_0x1b339c=_0x1b339c||0x1f4;return function(_0x597c7d){logger[_0x793e('0x25')](_0x597c7d['stack']);if(_0x597c7d[_0x793e('0x26')]){delete _0x597c7d['name'];}_0x13f15f[_0x793e('0x17')](_0x1b339c)['send'](_0x597c7d);};}exports[_0x793e('0x27')]=function(_0x557c44,_0x2bebef){var _0x3b2b0c={},_0x5d5091={},_0x4f26cd={'count':0x0,'rows':[]};var _0x16ee93=_['map'](db[_0x793e('0x28')][_0x793e('0x29')],function(_0x103396){return{'name':_0x103396['fieldName'],'type':_0x103396[_0x793e('0x2a')][_0x793e('0x2b')]};});_0x5d5091[_0x793e('0x2c')]=_[_0x793e('0x2d')](_0x16ee93,_0x793e('0x26'));_0x5d5091['query']=_[_0x793e('0x2e')](_0x557c44[_0x793e('0x2f')]);_0x5d5091[_0x793e('0x30')]=_[_0x793e('0x31')](_0x5d5091['model'],_0x5d5091[_0x793e('0x2f')]);_0x3b2b0c[_0x793e('0x32')]=_[_0x793e('0x31')](_0x5d5091[_0x793e('0x2c')],qs[_0x793e('0x33')](_0x557c44['query'][_0x793e('0x33')]));_0x3b2b0c[_0x793e('0x32')]=_0x3b2b0c[_0x793e('0x32')][_0x793e('0x34')]?_0x3b2b0c[_0x793e('0x32')]:_0x5d5091[_0x793e('0x2c')];if(!_0x557c44[_0x793e('0x2f')][_0x793e('0x35')]('nolimit')){_0x3b2b0c[_0x793e('0x1c')]=qs[_0x793e('0x1c')](_0x557c44[_0x793e('0x2f')][_0x793e('0x1c')]);_0x3b2b0c[_0x793e('0x1a')]=qs[_0x793e('0x1a')](_0x557c44['query'][_0x793e('0x1a')]);}_0x3b2b0c[_0x793e('0x36')]=qs[_0x793e('0x37')](_0x557c44[_0x793e('0x2f')][_0x793e('0x37')]);_0x3b2b0c[_0x793e('0x38')]=qs[_0x793e('0x30')](_[_0x793e('0x39')](_0x557c44['query'],_0x5d5091[_0x793e('0x30')]),_0x16ee93);if(_0x557c44[_0x793e('0x2f')][_0x793e('0x3a')]){_0x3b2b0c[_0x793e('0x38')]=_[_0x793e('0x3b')](_0x3b2b0c[_0x793e('0x38')],{'$or':_['map'](_0x16ee93,function(_0x5c6030){if(_0x5c6030[_0x793e('0x2a')]!==_0x793e('0x3c')){var _0x324757={};_0x324757[_0x5c6030[_0x793e('0x26')]]={'$like':'%'+_0x557c44[_0x793e('0x2f')][_0x793e('0x3a')]+'%'};return _0x324757;}})});}_0x3b2b0c=_[_0x793e('0x3b')]({},_0x3b2b0c,_0x557c44[_0x793e('0x3d')]);var _0x14a391={'where':_0x3b2b0c[_0x793e('0x38')]};return db[_0x793e('0x28')][_0x793e('0x3e')](_0x14a391)[_0x793e('0x23')](function(_0x1f3059){_0x4f26cd[_0x793e('0x3e')]=_0x1f3059;if(_0x557c44[_0x793e('0x2f')][_0x793e('0x3f')]){_0x3b2b0c[_0x793e('0x40')]=[{'all':!![]}];}return db[_0x793e('0x28')][_0x793e('0x41')](_0x3b2b0c);})[_0x793e('0x23')](function(_0x42883d){_0x4f26cd[_0x793e('0x42')]=_0x42883d;return _0x4f26cd;})[_0x793e('0x23')](respondWithFilteredResult(_0x2bebef,_0x3b2b0c))['catch'](handleError(_0x2bebef,null));};exports[_0x793e('0x43')]=function(_0x507dca,_0x58ffdb){var _0x2acddb={'raw':![],'where':{'id':_0x507dca[_0x793e('0x44')]['id']}},_0x328d76={};_0x328d76[_0x793e('0x2c')]=_[_0x793e('0x2e')](db[_0x793e('0x28')][_0x793e('0x29')]);_0x328d76[_0x793e('0x2f')]=_[_0x793e('0x2e')](_0x507dca['query']);_0x328d76['filters']=_[_0x793e('0x31')](_0x328d76[_0x793e('0x2c')],_0x328d76[_0x793e('0x2f')]);_0x2acddb[_0x793e('0x32')]=_['intersection'](_0x328d76[_0x793e('0x2c')],qs[_0x793e('0x33')](_0x507dca[_0x793e('0x2f')][_0x793e('0x33')]));_0x2acddb['attributes']=_0x2acddb[_0x793e('0x32')][_0x793e('0x34')]?_0x2acddb[_0x793e('0x32')]:_0x328d76[_0x793e('0x2c')];if(_0x507dca[_0x793e('0x2f')]['includeAll']){_0x2acddb['include']=[{'all':!![]}];}_0x2acddb=_['merge']({},_0x2acddb,_0x507dca['options']);return db[_0x793e('0x28')][_0x793e('0x45')](_0x2acddb)[_0x793e('0x23')](handleEntityNotFound(_0x58ffdb,null))[_0x793e('0x23')](respondWithResult(_0x58ffdb,null))['catch'](handleError(_0x58ffdb,null));};exports[_0x793e('0x46')]=function(_0x794076,_0x112645){return db['Campaign'][_0x793e('0x46')](_0x794076['body'],{})['then'](function(_0x401f2f){var _0x17d38b=_0x794076[_0x793e('0x47')][_0x793e('0x48')]({'plain':!![]});if(!_0x17d38b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17d38b[_0x793e('0x49')]===_0x793e('0x47')){var _0x1e1b94=_0x401f2f[_0x793e('0x48')]({'plain':!![]});var _0x488950='IvrCampaigns';return db['UserProfileSection'][_0x793e('0x45')]({'where':{'name':_0x488950,'userProfileId':_0x17d38b[_0x793e('0x4a')]},'raw':!![]})[_0x793e('0x23')](function(_0x53152f){if(_0x53152f&&_0x53152f[_0x793e('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x1e1b94[_0x793e('0x26')],'resourceId':_0x1e1b94['id'],'type':_0x53152f[_0x793e('0x26')],'sectionId':_0x53152f['id']},{})[_0x793e('0x23')](function(){return _0x401f2f;});}else{return _0x401f2f;}})['catch'](function(_0x250eb8){logger['error'](_0x793e('0x4c'),_0x250eb8);throw _0x250eb8;});}return _0x401f2f;})['then'](respondWithResult(_0x112645,0xc9))['catch'](handleError(_0x112645,null));};exports[_0x793e('0x4d')]=function(_0x5de1ef,_0x431c07){var _0x5f57a7={'where':{'id':_0x5de1ef['params']['id']}},_0x2763c1={};_0x2763c1['model']=_[_0x793e('0x2e')](db[_0x793e('0x28')][_0x793e('0x29')]);_0x5f57a7[_0x793e('0x32')]=_[_0x793e('0x31')](_0x2763c1['model'],qs['fields'](_0x5de1ef[_0x793e('0x2f')][_0x793e('0x33')]));_0x5f57a7['attributes']=_0x5f57a7[_0x793e('0x32')][_0x793e('0x34')]?_0x5f57a7[_0x793e('0x32')]:_0x2763c1[_0x793e('0x2c')];if(_0x5de1ef[_0x793e('0x2f')][_0x793e('0x3f')]){_0x5f57a7[_0x793e('0x40')]=[{'all':!![]}];}_0x5f57a7=_['merge']({},_0x5f57a7,_0x5de1ef[_0x793e('0x3d')]);return db[_0x793e('0x28')]['find'](_0x5f57a7)[_0x793e('0x23')](handleEntityNotFound(_0x431c07,null))[_0x793e('0x23')](function(_0x3e740f){if(_0x3e740f){var _0x21f0d5=_0x3e740f[_0x793e('0x48')]({'plain':!![]});_0x21f0d5=qs[_0x793e('0x4e')](_0x21f0d5,['id',_0x793e('0x4f'),_0x793e('0x50')]);_0x5de1ef[_0x793e('0x51')]=_['omit'](_0x5de1ef[_0x793e('0x51')],['id','createdAt',_0x793e('0x50')]);return db[_0x793e('0x28')][_0x793e('0x46')](_[_0x793e('0x3b')](_0x21f0d5,_0x5de1ef['body']),{'include':_0x5de1ef[_0x793e('0x2f')]['includeAll']?[{'all':!![]}]:undefined})[_0x793e('0x23')](function(_0xf0a09){var _0x274b1b=_0x5de1ef[_0x793e('0x47')][_0x793e('0x48')]({'plain':!![]});if(!_0x274b1b)throw new Error(_0x793e('0x52'));if(_0x274b1b[_0x793e('0x49')]==='user'){var _0x2618dc=_0xf0a09[_0x793e('0x48')]({'plain':!![]});var _0x413379=_0x793e('0x53');return db[_0x793e('0x54')]['find']({'where':{'name':_0x413379,'userProfileId':_0x274b1b['userProfileId']},'raw':!![]})[_0x793e('0x23')](function(_0x28bd9f){if(_0x28bd9f&&_0x28bd9f[_0x793e('0x4b')]===0x0){return db[_0x793e('0x55')][_0x793e('0x46')]({'name':_0x2618dc[_0x793e('0x26')],'resourceId':_0x2618dc['id'],'type':_0x28bd9f[_0x793e('0x26')],'sectionId':_0x28bd9f['id']},{})[_0x793e('0x23')](function(){return _0xf0a09;});}else{return _0xf0a09;}})[_0x793e('0x56')](function(_0x39aad8){logger[_0x793e('0x25')](_0x793e('0x4c'),_0x39aad8);throw _0x39aad8;});}return _0xf0a09;});}})[_0x793e('0x23')](respondWithResult(_0x431c07,0xc9))['catch'](handleError(_0x431c07,null));};exports[_0x793e('0x22')]=function(_0x2e1058,_0x16cd59){if(_0x2e1058[_0x793e('0x51')]['id']){delete _0x2e1058[_0x793e('0x51')]['id'];}return db[_0x793e('0x28')][_0x793e('0x45')]({'where':{'id':_0x2e1058[_0x793e('0x44')]['id']}})[_0x793e('0x23')](handleEntityNotFound(_0x16cd59,null))['then'](saveUpdates(_0x2e1058[_0x793e('0x51')],null))[_0x793e('0x23')](respondWithResult(_0x16cd59,null))[_0x793e('0x56')](handleError(_0x16cd59,null));};exports[_0x793e('0x24')]=function(_0x3f26bf,_0x2f925a){return db[_0x793e('0x28')][_0x793e('0x45')]({'where':{'id':_0x3f26bf[_0x793e('0x44')]['id']}})[_0x793e('0x23')](handleEntityNotFound(_0x2f925a,null))[_0x793e('0x23')](removeEntity(_0x2f925a,null))[_0x793e('0x56')](handleError(_0x2f925a,null));};exports[_0x793e('0x57')]=function(_0x240b7c,_0x556287,_0x535ddd){var _0x3de29d={'raw':!![],'where':{}};var _0x5b9385={};var _0x5d1af7={'count':0x0,'rows':[]};return db[_0x793e('0x28')][_0x793e('0x58')]({'where':{'id':_0x240b7c[_0x793e('0x44')]['id']}})[_0x793e('0x23')](handleEntityNotFound(_0x556287,null))[_0x793e('0x23')](function(_0x4f3596){if(_0x4f3596){_0x5b9385[_0x793e('0x2c')]=_['keys'](db['CmHopper'][_0x793e('0x29')]);_0x5b9385['query']=_[_0x793e('0x2e')](_0x240b7c[_0x793e('0x2f')]);_0x5b9385[_0x793e('0x30')]=_[_0x793e('0x31')](_0x5b9385[_0x793e('0x2c')],_0x5b9385[_0x793e('0x2f')]);_0x3de29d[_0x793e('0x32')]=_[_0x793e('0x31')](_0x5b9385[_0x793e('0x2c')],qs[_0x793e('0x33')](_0x240b7c[_0x793e('0x2f')]['fields']));_0x3de29d[_0x793e('0x32')]=_0x3de29d[_0x793e('0x32')][_0x793e('0x34')]?_0x3de29d['attributes']:_0x5b9385[_0x793e('0x2c')];if(!_0x240b7c[_0x793e('0x2f')][_0x793e('0x35')]('nolimit')){_0x3de29d[_0x793e('0x1c')]=qs[_0x793e('0x1c')](_0x240b7c[_0x793e('0x2f')]['limit']);_0x3de29d[_0x793e('0x1a')]=qs['offset'](_0x240b7c['query']['offset']);}_0x3de29d['order']=qs['sort'](_0x240b7c[_0x793e('0x2f')]['sort']);_0x3de29d['where']=qs[_0x793e('0x30')](_['pick'](_0x240b7c[_0x793e('0x2f')],_0x5b9385[_0x793e('0x30')]));_0x3de29d['where'][_0x793e('0x59')]=_0x4f3596['id'];if(_0x240b7c['query']['filter']){_0x3de29d['where']=_[_0x793e('0x3b')](_0x3de29d[_0x793e('0x38')],{'$or':_['map'](_0x3de29d[_0x793e('0x32')],function(_0x3d40c4){var _0x1d6b7c={};_0x1d6b7c[_0x3d40c4]={'$like':'%'+_0x240b7c[_0x793e('0x2f')][_0x793e('0x3a')]+'%'};return _0x1d6b7c;})});}_0x3de29d=_[_0x793e('0x3b')]({},_0x3de29d,_0x240b7c[_0x793e('0x3d')]);return db[_0x793e('0x5a')][_0x793e('0x3e')]({'where':_0x3de29d[_0x793e('0x38')]})[_0x793e('0x23')](function(_0x1b4fa0){_0x5d1af7['count']=_0x1b4fa0;if(_0x240b7c[_0x793e('0x2f')][_0x793e('0x3f')]){_0x3de29d[_0x793e('0x40')]=[{'all':!![]}];}return db[_0x793e('0x5a')][_0x793e('0x41')](_0x3de29d);})['then'](function(_0x4ba2ee){_0x5d1af7[_0x793e('0x42')]=_0x4ba2ee;return _0x5d1af7;});}})[_0x793e('0x23')](respondWithFilteredResult(_0x556287,_0x3de29d))[_0x793e('0x56')](handleError(_0x556287,null));};exports[_0x793e('0x5b')]=function(_0x289343,_0x291fd4,_0x108cf5){var _0x70a83c={'raw':!![],'where':{}};var _0x17cd3a={};var _0x2cb66b={'count':0x0,'rows':[]};return db[_0x793e('0x28')]['findOne']({'where':{'id':_0x289343[_0x793e('0x44')]['id']}})[_0x793e('0x23')](handleEntityNotFound(_0x291fd4,null))[_0x793e('0x23')](function(_0xe5d4db){if(_0xe5d4db){_0x17cd3a[_0x793e('0x2c')]=_[_0x793e('0x2e')](db['CmHopperHistory'][_0x793e('0x29')]);_0x17cd3a[_0x793e('0x2f')]=_['keys'](_0x289343[_0x793e('0x2f')]);_0x17cd3a[_0x793e('0x30')]=_[_0x793e('0x31')](_0x17cd3a[_0x793e('0x2c')],_0x17cd3a[_0x793e('0x2f')]);_0x70a83c[_0x793e('0x32')]=_[_0x793e('0x31')](_0x17cd3a[_0x793e('0x2c')],qs[_0x793e('0x33')](_0x289343[_0x793e('0x2f')]['fields']));_0x70a83c[_0x793e('0x32')]=_0x70a83c[_0x793e('0x32')][_0x793e('0x34')]?_0x70a83c['attributes']:_0x17cd3a['model'];if(!_0x289343[_0x793e('0x2f')]['hasOwnProperty'](_0x793e('0x5c'))){_0x70a83c[_0x793e('0x1c')]=qs[_0x793e('0x1c')](_0x289343[_0x793e('0x2f')][_0x793e('0x1c')]);_0x70a83c[_0x793e('0x1a')]=qs[_0x793e('0x1a')](_0x289343[_0x793e('0x2f')][_0x793e('0x1a')]);}_0x70a83c[_0x793e('0x36')]=qs[_0x793e('0x37')](_0x289343[_0x793e('0x2f')][_0x793e('0x37')]);_0x70a83c[_0x793e('0x38')]=qs['filters'](_[_0x793e('0x39')](_0x289343[_0x793e('0x2f')],_0x17cd3a[_0x793e('0x30')]));_0x70a83c[_0x793e('0x38')][_0x793e('0x59')]=_0xe5d4db['id'];if(_0x289343[_0x793e('0x2f')][_0x793e('0x3a')]){_0x70a83c['where']=_[_0x793e('0x3b')](_0x70a83c[_0x793e('0x38')],{'$or':_[_0x793e('0x2d')](_0x70a83c[_0x793e('0x32')],function(_0x2189ca){var _0x51fb77={};_0x51fb77[_0x2189ca]={'$like':'%'+_0x289343[_0x793e('0x2f')][_0x793e('0x3a')]+'%'};return _0x51fb77;})});}_0x70a83c=_[_0x793e('0x3b')]({},_0x70a83c,_0x289343[_0x793e('0x3d')]);return db['CmHopperHistory'][_0x793e('0x3e')]({'where':_0x70a83c[_0x793e('0x38')]})[_0x793e('0x23')](function(_0x3ab954){_0x2cb66b[_0x793e('0x3e')]=_0x3ab954;if(_0x289343[_0x793e('0x2f')][_0x793e('0x3f')]){_0x70a83c[_0x793e('0x40')]=[{'all':!![]}];}return db[_0x793e('0x5d')][_0x793e('0x41')](_0x70a83c);})[_0x793e('0x23')](function(_0xc3c628){_0x2cb66b['rows']=_0xc3c628;return _0x2cb66b;});}})[_0x793e('0x23')](respondWithFilteredResult(_0x291fd4,_0x70a83c))[_0x793e('0x56')](handleError(_0x291fd4,null));};exports[_0x793e('0x5e')]=function(_0x59fbe5,_0x4539af,_0x4e39a0){var _0x5eddca={'raw':!![],'where':{}};var _0x6d7e7c={};var _0x15b1b9={'count':0x0,'rows':[]};return db[_0x793e('0x28')][_0x793e('0x58')]({'where':{'id':_0x59fbe5[_0x793e('0x44')]['id']}})['then'](handleEntityNotFound(_0x4539af,null))[_0x793e('0x23')](function(_0x184aaa){if(_0x184aaa){_0x6d7e7c[_0x793e('0x2c')]=_[_0x793e('0x2e')](db[_0x793e('0x5f')]['rawAttributes']);_0x6d7e7c[_0x793e('0x2f')]=_[_0x793e('0x2e')](_0x59fbe5[_0x793e('0x2f')]);_0x6d7e7c[_0x793e('0x30')]=_[_0x793e('0x31')](_0x6d7e7c['model'],_0x6d7e7c[_0x793e('0x2f')]);_0x5eddca[_0x793e('0x32')]=_[_0x793e('0x31')](_0x6d7e7c['model'],qs[_0x793e('0x33')](_0x59fbe5[_0x793e('0x2f')][_0x793e('0x33')]));_0x5eddca[_0x793e('0x32')]=_0x5eddca[_0x793e('0x32')][_0x793e('0x34')]?_0x5eddca['attributes']:_0x6d7e7c[_0x793e('0x2c')];if(!_0x59fbe5[_0x793e('0x2f')][_0x793e('0x35')](_0x793e('0x5c'))){_0x5eddca[_0x793e('0x1c')]=qs[_0x793e('0x1c')](_0x59fbe5[_0x793e('0x2f')][_0x793e('0x1c')]);_0x5eddca['offset']=qs[_0x793e('0x1a')](_0x59fbe5[_0x793e('0x2f')][_0x793e('0x1a')]);}_0x5eddca['order']=qs[_0x793e('0x37')](_0x59fbe5['query']['sort']);_0x5eddca[_0x793e('0x38')]=qs[_0x793e('0x30')](_['pick'](_0x59fbe5[_0x793e('0x2f')],_0x6d7e7c[_0x793e('0x30')]));_0x5eddca[_0x793e('0x38')][_0x793e('0x59')]=_0x184aaa['id'];if(_0x59fbe5[_0x793e('0x2f')][_0x793e('0x3a')]){_0x5eddca['where']=_[_0x793e('0x3b')](_0x5eddca[_0x793e('0x38')],{'$or':_['map'](_0x5eddca[_0x793e('0x32')],function(_0x4a7279){var _0x461ef6={};_0x461ef6[_0x4a7279]={'$like':'%'+_0x59fbe5[_0x793e('0x2f')][_0x793e('0x3a')]+'%'};return _0x461ef6;})});}_0x5eddca=_['merge']({},_0x5eddca,_0x59fbe5[_0x793e('0x3d')]);return db[_0x793e('0x5f')]['count']({'where':_0x5eddca[_0x793e('0x38')]})[_0x793e('0x23')](function(_0x4d31e7){_0x15b1b9[_0x793e('0x3e')]=_0x4d31e7;if(_0x59fbe5[_0x793e('0x2f')]['includeAll']){_0x5eddca[_0x793e('0x40')]=[{'all':!![]}];}return db[_0x793e('0x5f')][_0x793e('0x41')](_0x5eddca);})['then'](function(_0x267e70){_0x15b1b9[_0x793e('0x42')]=_0x267e70;return _0x15b1b9;});}})[_0x793e('0x23')](respondWithFilteredResult(_0x4539af,_0x5eddca))['catch'](handleError(_0x4539af,null));};exports[_0x793e('0x60')]=function(_0xa131b4,_0x5ddd65,_0x257ff7){var _0x304ed6={'raw':!![],'where':{}};var _0xed4cf6={};var _0x265e6e={'count':0x0,'rows':[]};return db[_0x793e('0x28')][_0x793e('0x58')]({'where':{'id':_0xa131b4[_0x793e('0x44')]['id']}})[_0x793e('0x23')](handleEntityNotFound(_0x5ddd65,null))[_0x793e('0x23')](function(_0x3cc565){if(_0x3cc565){_0xed4cf6[_0x793e('0x2c')]=_[_0x793e('0x2e')](db[_0x793e('0x61')][_0x793e('0x29')]);_0xed4cf6['query']=_[_0x793e('0x2e')](_0xa131b4[_0x793e('0x2f')]);_0xed4cf6['filters']=_[_0x793e('0x31')](_0xed4cf6['model'],_0xed4cf6[_0x793e('0x2f')]);_0x304ed6[_0x793e('0x32')]=_[_0x793e('0x31')](_0xed4cf6[_0x793e('0x2c')],qs[_0x793e('0x33')](_0xa131b4[_0x793e('0x2f')]['fields']));_0x304ed6['attributes']=_0x304ed6[_0x793e('0x32')][_0x793e('0x34')]?_0x304ed6['attributes']:_0xed4cf6[_0x793e('0x2c')];if(!_0xa131b4[_0x793e('0x2f')][_0x793e('0x35')](_0x793e('0x5c'))){_0x304ed6[_0x793e('0x1c')]=qs['limit'](_0xa131b4[_0x793e('0x2f')][_0x793e('0x1c')]);_0x304ed6[_0x793e('0x1a')]=qs[_0x793e('0x1a')](_0xa131b4[_0x793e('0x2f')][_0x793e('0x1a')]);}_0x304ed6[_0x793e('0x36')]=qs[_0x793e('0x37')](_0xa131b4[_0x793e('0x2f')][_0x793e('0x37')]);_0x304ed6[_0x793e('0x38')]=qs[_0x793e('0x30')](_[_0x793e('0x39')](_0xa131b4[_0x793e('0x2f')],_0xed4cf6[_0x793e('0x30')]));_0x304ed6['where'][_0x793e('0x59')]=_0x3cc565['id'];if(_0xa131b4[_0x793e('0x2f')][_0x793e('0x3a')]){_0x304ed6[_0x793e('0x38')]=_[_0x793e('0x3b')](_0x304ed6['where'],{'$or':_[_0x793e('0x2d')](_0x304ed6[_0x793e('0x32')],function(_0x5bdeaa){var _0x443784={};_0x443784[_0x5bdeaa]={'$like':'%'+_0xa131b4[_0x793e('0x2f')][_0x793e('0x3a')]+'%'};return _0x443784;})});}_0x304ed6=_[_0x793e('0x3b')]({},_0x304ed6,_0xa131b4['options']);return db[_0x793e('0x61')][_0x793e('0x3e')]({'where':_0x304ed6[_0x793e('0x38')]})[_0x793e('0x23')](function(_0x1edc86){_0x265e6e[_0x793e('0x3e')]=_0x1edc86;if(_0xa131b4[_0x793e('0x2f')][_0x793e('0x3f')]){_0x304ed6[_0x793e('0x40')]=[{'all':!![]}];}return db[_0x793e('0x61')][_0x793e('0x41')](_0x304ed6);})[_0x793e('0x23')](function(_0x4e8195){_0x265e6e[_0x793e('0x42')]=_0x4e8195;return _0x265e6e;});}})[_0x793e('0x23')](respondWithFilteredResult(_0x5ddd65,_0x304ed6))[_0x793e('0x56')](handleError(_0x5ddd65,null));};exports[_0x793e('0x62')]=function(_0x48bc5f,_0x5f45ae,_0x1dff8d){var _0x62d355={};var _0x5ee191={};var _0x9d0c36;var _0x948038;return db[_0x793e('0x28')][_0x793e('0x58')]({'where':{'id':_0x48bc5f[_0x793e('0x44')]['id']}})['then'](handleEntityNotFound(_0x5f45ae,null))[_0x793e('0x23')](function(_0x7fd73c){if(_0x7fd73c){_0x9d0c36=_0x7fd73c;_0x5ee191[_0x793e('0x2c')]=_[_0x793e('0x2e')](db['CmList']['rawAttributes']);_0x5ee191['query']=_[_0x793e('0x2e')](_0x48bc5f[_0x793e('0x2f')]);_0x5ee191['filters']=_['intersection'](_0x5ee191[_0x793e('0x2c')],_0x5ee191[_0x793e('0x2f')]);_0x62d355[_0x793e('0x32')]=_[_0x793e('0x31')](_0x5ee191[_0x793e('0x2c')],qs['fields'](_0x48bc5f[_0x793e('0x2f')][_0x793e('0x33')]));_0x62d355[_0x793e('0x32')]=_0x62d355[_0x793e('0x32')]['length']?_0x62d355[_0x793e('0x32')]:_0x5ee191[_0x793e('0x2c')];_0x62d355[_0x793e('0x36')]=qs[_0x793e('0x37')](_0x48bc5f['query'][_0x793e('0x37')]);_0x62d355[_0x793e('0x38')]=qs['filters'](_[_0x793e('0x39')](_0x48bc5f['query'],_0x5ee191[_0x793e('0x30')]));if(_0x48bc5f[_0x793e('0x2f')][_0x793e('0x3a')]){_0x62d355[_0x793e('0x38')]=_[_0x793e('0x3b')](_0x62d355[_0x793e('0x38')],{'$or':_[_0x793e('0x2d')](_0x62d355['attributes'],function(_0x39bdd5){var _0x472483={};_0x472483[_0x39bdd5]={'$like':'%'+_0x48bc5f[_0x793e('0x2f')][_0x793e('0x3a')]+'%'};return _0x472483;})});}_0x62d355=_['merge']({},_0x62d355,_0x48bc5f[_0x793e('0x3d')]);return _0x9d0c36['getLists'](_0x62d355);}})[_0x793e('0x23')](function(_0x3458be){if(_0x3458be){_0x948038=_0x3458be[_0x793e('0x34')];if(!_0x48bc5f[_0x793e('0x2f')][_0x793e('0x35')]('nolimit')){_0x62d355['limit']=qs['limit'](_0x48bc5f[_0x793e('0x2f')][_0x793e('0x1c')]);_0x62d355[_0x793e('0x1a')]=qs[_0x793e('0x1a')](_0x48bc5f[_0x793e('0x2f')][_0x793e('0x1a')]);}return _0x9d0c36[_0x793e('0x62')](_0x62d355);}})['then'](function(_0x350523){if(_0x350523){return _0x350523?{'count':_0x948038,'rows':_0x350523}:null;}})[_0x793e('0x23')](respondWithResult(_0x5f45ae,null))[_0x793e('0x56')](handleError(_0x5f45ae,null));};exports[_0x793e('0x63')]=function(_0x1c99e1,_0x316554,_0x2b3611){var _0x3de6ff,_0x46e97b;var _0x13855b=[];var _0x3715cf=moment()['format'](_0x793e('0x64'));return db['Campaign'][_0x793e('0x45')]({'where':{'id':_0x1c99e1['params']['id']}})[_0x793e('0x23')](handleEntityNotFound(_0x316554,null))[_0x793e('0x23')](function(_0x4b44e3){if(_0x4b44e3){_0x46e97b=_0x4b44e3;return _0x4b44e3[_0x793e('0x63')](_0x1c99e1[_0x793e('0x51')][_0x793e('0x65')],_[_0x793e('0x4e')](_0x1c99e1[_0x793e('0x51')],['ids','id'])||{});}return null;})['spread'](function(_0x29a363){var _0x59afd5;var _0x2847c3;_0x3de6ff=_0x29a363||[];var _0x1bee4b=[];if(_0x29a363){for(var _0x39c8fc=0x0;_0x39c8fc<_0x29a363[_0x793e('0x34')];_0x39c8fc+=0x1){var _0x1cea5b=_0x29a363[_0x39c8fc][_0x793e('0x48')]({'plain':!![]});_0x46e97b['dialCheckDuplicateType']=_0x1c99e1[_0x793e('0x51')]['dialCheckDuplicateType']?_0x1c99e1[_0x793e('0x51')][_0x793e('0x66')]:_0x46e97b['dialCheckDuplicateType'];switch(_0x46e97b[_0x793e('0x66')]){case _0x793e('0x67'):_0x59afd5=squel[_0x793e('0x68')]()['into']('cm_hopper')['fromQuery']([_0x793e('0x69'),_0x793e('0x6a'),_0x793e('0x6b'),_0x793e('0x6c'),_0x793e('0x59'),_0x793e('0x4f'),'updatedAt'],squel[_0x793e('0x6d')]()['field'](_0x793e('0x69'),_0x793e('0x69'))['field'](_0x793e('0x6e'),_0x793e('0x6a'))[_0x793e('0x6f')]('id',_0x793e('0x6b'))['field'](_0x1cea5b[_0x793e('0x70')][_0x793e('0x71')](),_0x793e('0x6c'))[_0x793e('0x6f')](_0x1c99e1[_0x793e('0x44')]['id'][_0x793e('0x71')](),_0x793e('0x59'))[_0x793e('0x6f')]('\x27'+_0x3715cf+'\x27',_0x793e('0x4f'))[_0x793e('0x6f')]('\x27'+_0x3715cf+'\x27','updatedAt')[_0x793e('0x72')](_0x793e('0x73'))[_0x793e('0x38')]('deletedAt\x20IS\x20NULL')[_0x793e('0x38')](_0x793e('0x74'),_0x1cea5b['CmListId'][_0x793e('0x71')]())[_0x793e('0x38')]('phone\x20IS\x20NOT\x20NULL')[_0x793e('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0x793e('0x6d')]()['field'](_0x793e('0x75'))[_0x793e('0x72')](_0x793e('0x76'))['where'](_0x793e('0x77'),_0x1c99e1['params']['id'][_0x793e('0x71')]()))[_0x793e('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0x793e('0x6d')]()[_0x793e('0x6f')]('COALESCE(phone,\x27\x27)')[_0x793e('0x72')]('cm_hopper')[_0x793e('0x38')](_0x793e('0x77'),_0x1c99e1[_0x793e('0x44')]['id']['toString']())))[_0x793e('0x71')]();break;case'onlyIfOpen':_0x59afd5=squel[_0x793e('0x68')]()[_0x793e('0x78')](_0x793e('0x79'))[_0x793e('0x7a')]([_0x793e('0x69'),_0x793e('0x6a'),_0x793e('0x6b'),_0x793e('0x6c'),_0x793e('0x59'),'createdAt',_0x793e('0x50')],squel[_0x793e('0x6d')]()[_0x793e('0x6f')]('phone',_0x793e('0x69'))['field'](_0x793e('0x6e'),_0x793e('0x6a'))[_0x793e('0x6f')]('id','ContactId')['field'](_0x1cea5b[_0x793e('0x70')][_0x793e('0x71')](),_0x793e('0x6c'))['field'](_0x1c99e1[_0x793e('0x44')]['id']['toString'](),_0x793e('0x59'))['field']('\x27'+_0x3715cf+'\x27','createdAt')[_0x793e('0x6f')]('\x27'+_0x3715cf+'\x27','updatedAt')['from'](_0x793e('0x73'))[_0x793e('0x38')](_0x793e('0x7b'))['where'](_0x793e('0x74'),_0x1cea5b[_0x793e('0x70')][_0x793e('0x71')]())[_0x793e('0x38')](_0x793e('0x7c'))[_0x793e('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0x793e('0x6d')]()[_0x793e('0x6f')](_0x793e('0x7d'))[_0x793e('0x72')]('cm_hopper')['where'](_0x793e('0x77'),_0x1c99e1[_0x793e('0x44')]['id'][_0x793e('0x71')]())))[_0x793e('0x71')]();break;default:_0x59afd5=squel[_0x793e('0x68')]()[_0x793e('0x78')](_0x793e('0x79'))['fromQuery']([_0x793e('0x69'),_0x793e('0x6a'),_0x793e('0x6b'),_0x793e('0x6c'),_0x793e('0x59'),_0x793e('0x4f'),_0x793e('0x50')],squel[_0x793e('0x6d')]()[_0x793e('0x6f')]('phone','phone')['field'](_0x793e('0x6e'),_0x793e('0x6a'))[_0x793e('0x6f')]('id',_0x793e('0x6b'))[_0x793e('0x6f')](_0x1cea5b[_0x793e('0x70')]['toString'](),_0x793e('0x6c'))[_0x793e('0x6f')](_0x1c99e1[_0x793e('0x44')]['id'][_0x793e('0x71')](),_0x793e('0x59'))[_0x793e('0x6f')]('\x27'+_0x3715cf+'\x27',_0x793e('0x4f'))[_0x793e('0x6f')]('\x27'+_0x3715cf+'\x27',_0x793e('0x50'))[_0x793e('0x72')](_0x793e('0x73'))[_0x793e('0x38')]('deletedAt\x20IS\x20NULL')[_0x793e('0x38')](_0x793e('0x74'),_0x1cea5b[_0x793e('0x70')][_0x793e('0x71')]())[_0x793e('0x38')](_0x793e('0x7c')))[_0x793e('0x71')]();}_0x2847c3=squel['insert']()[_0x793e('0x78')]('cm_hopper_additional_phones')[_0x793e('0x7a')](['cmHopperId','scheduledAt',_0x793e('0x69'),_0x793e('0x7e'),_0x793e('0x4f'),'updatedAt'],squel[_0x793e('0x6d')]()[_0x793e('0x6f')](_0x793e('0x7f'),'id')['field']('NOW()','scheduledAt')['field'](_0x793e('0x80'),_0x793e('0x69'))[_0x793e('0x6f')](_0x793e('0x81'),_0x793e('0x7e'))[_0x793e('0x6f')]('\x27'+_0x3715cf+'\x27','createdAt')[_0x793e('0x6f')]('\x27'+_0x3715cf+'\x27',_0x793e('0x50'))[_0x793e('0x72')]('cm_contact_has_items','ci')[_0x793e('0x82')](_0x793e('0x79'),'h',_0x793e('0x83'))[_0x793e('0x38')](_0x793e('0x84'),_0x1cea5b['CmListId'][_0x793e('0x71')]())[_0x793e('0x38')](_0x793e('0x85'),_0x1c99e1[_0x793e('0x44')]['id'][_0x793e('0x71')]())[_0x793e('0x38')]('h.createdAt\x20=\x20?',_0x3715cf))[_0x793e('0x71')]();_0x1bee4b[_0x793e('0x86')](db[_0x793e('0x87')]['query'](_0x59afd5));_0x13855b['push'](db[_0x793e('0x87')]['query'](_0x2847c3));}return BPromise['all'](_0x1bee4b);}})[_0x793e('0x23')](function(){return BPromise[_0x793e('0x88')](_0x13855b);})[_0x793e('0x23')](function(){return _0x3de6ff;})['then'](respondWithResult(_0x316554,null))[_0x793e('0x56')](handleError(_0x316554,null));};exports['removeLists']=function(_0x42fb7c,_0x3d2195,_0x427199){return db[_0x793e('0x28')][_0x793e('0x45')]({'where':{'id':_0x42fb7c[_0x793e('0x44')]['id']}})[_0x793e('0x23')](handleEntityNotFound(_0x3d2195,null))['then'](function(_0x4285d8){if(_0x4285d8){return _0x4285d8[_0x793e('0x89')](_0x42fb7c[_0x793e('0x2f')]['ids']);}})[_0x793e('0x23')](function(_0x20c28c){if(_0x20c28c){return db[_0x793e('0x5a')][_0x793e('0x24')]({'where':{'ListId':_0x42fb7c[_0x793e('0x2f')][_0x793e('0x65')],'CampaignId':_0x42fb7c['params']['id']}})[_0x793e('0x23')](function(){return _0x20c28c;});}})[_0x793e('0x23')](respondWithStatusCode(_0x3d2195,null))[_0x793e('0x56')](handleError(_0x3d2195,null));};exports[_0x793e('0x8a')]=function(_0x11c418,_0x2eea2e,_0xae890){var _0x323cd={};var _0x2a2b9e={};var _0x155327;var _0x125c5a;return db[_0x793e('0x28')][_0x793e('0x58')]({'where':{'id':_0x11c418[_0x793e('0x44')]['id']}})[_0x793e('0x23')](handleEntityNotFound(_0x2eea2e,null))[_0x793e('0x23')](function(_0x215e3f){if(_0x215e3f){_0x155327=_0x215e3f;_0x2a2b9e['model']=_[_0x793e('0x2e')](db['CmList'][_0x793e('0x29')]);_0x2a2b9e[_0x793e('0x2f')]=_[_0x793e('0x2e')](_0x11c418[_0x793e('0x2f')]);_0x2a2b9e[_0x793e('0x30')]=_[_0x793e('0x31')](_0x2a2b9e[_0x793e('0x2c')],_0x2a2b9e[_0x793e('0x2f')]);_0x323cd[_0x793e('0x32')]=_['intersection'](_0x2a2b9e['model'],qs['fields'](_0x11c418[_0x793e('0x2f')][_0x793e('0x33')]));_0x323cd['attributes']=_0x323cd[_0x793e('0x32')][_0x793e('0x34')]?_0x323cd['attributes']:_0x2a2b9e[_0x793e('0x2c')];_0x323cd[_0x793e('0x36')]=qs['sort'](_0x11c418[_0x793e('0x2f')][_0x793e('0x37')]);_0x323cd[_0x793e('0x38')]=qs[_0x793e('0x30')](_['pick'](_0x11c418[_0x793e('0x2f')],_0x2a2b9e[_0x793e('0x30')]));if(_0x11c418['query'][_0x793e('0x3a')]){_0x323cd[_0x793e('0x38')]=_[_0x793e('0x3b')](_0x323cd[_0x793e('0x38')],{'$or':_[_0x793e('0x2d')](_0x323cd[_0x793e('0x32')],function(_0x6009de){var _0x2974fb={};_0x2974fb[_0x6009de]={'$like':'%'+_0x11c418[_0x793e('0x2f')]['filter']+'%'};return _0x2974fb;})});}_0x323cd=_[_0x793e('0x3b')]({},_0x323cd,_0x11c418['options']);return _0x155327[_0x793e('0x8a')](_0x323cd);}})[_0x793e('0x23')](function(_0x2c753c){if(_0x2c753c){_0x125c5a=_0x2c753c[_0x793e('0x34')];if(!_0x11c418[_0x793e('0x2f')]['hasOwnProperty'](_0x793e('0x5c'))){_0x323cd['limit']=qs[_0x793e('0x1c')](_0x11c418['query'][_0x793e('0x1c')]);_0x323cd[_0x793e('0x1a')]=qs[_0x793e('0x1a')](_0x11c418['query']['offset']);}return _0x155327[_0x793e('0x8a')](_0x323cd);}})[_0x793e('0x23')](function(_0x12dfea){if(_0x12dfea){return _0x12dfea?{'count':_0x125c5a,'rows':_0x12dfea}:null;}})[_0x793e('0x23')](respondWithResult(_0x2eea2e,null))[_0x793e('0x56')](handleError(_0x2eea2e,null));};exports[_0x793e('0x8b')]=function(_0x480c39,_0x13fce8,_0x42d268){var _0x28c1d1,_0x3c906d;var _0x47eff0=[];var _0x531c8=moment()[_0x793e('0x8c')](_0x793e('0x64'));return db['Campaign'][_0x793e('0x45')]({'where':{'id':_0x480c39[_0x793e('0x44')]['id']}})[_0x793e('0x23')](handleEntityNotFound(_0x13fce8,null))[_0x793e('0x23')](function(_0x1ff187){if(_0x1ff187){_0x3c906d=_0x1ff187;return _0x1ff187['addBlackLists'](_0x480c39[_0x793e('0x51')]['ids'],_[_0x793e('0x4e')](_0x480c39['body'],[_0x793e('0x65'),'id'])||{});}return null;})[_0x793e('0x8d')](function(_0x3f3f73){var _0x55789f;var _0xb0eed3;_0x28c1d1=_0x3f3f73||[];var _0xb4e812=[];if(_0x3f3f73){for(var _0xd7c784=0x0;_0xd7c784<_0x3f3f73[_0x793e('0x34')];_0xd7c784+=0x1){var _0xd75ed5=_0x3f3f73[_0xd7c784][_0x793e('0x48')]({'plain':!![]});_0x55789f=squel[_0x793e('0x68')]()[_0x793e('0x78')](_0x793e('0x8e'))[_0x793e('0x7a')](['phone',_0x793e('0x6b'),_0x793e('0x6c'),'CampaignId',_0x793e('0x4f'),'updatedAt'],squel[_0x793e('0x6d')]()[_0x793e('0x6f')](_0x793e('0x69'),_0x793e('0x69'))['field']('id','ContactId')[_0x793e('0x6f')](_0xd75ed5[_0x793e('0x70')][_0x793e('0x71')](),'ListId')[_0x793e('0x6f')](_0x480c39[_0x793e('0x44')]['id'][_0x793e('0x71')](),_0x793e('0x59'))['field'](_0x793e('0x6e'),_0x793e('0x4f'))[_0x793e('0x6f')](_0x793e('0x6e'),_0x793e('0x50'))[_0x793e('0x72')](_0x793e('0x73'))['where']('deletedAt\x20IS\x20NULL')[_0x793e('0x38')](_0x793e('0x74'),_0xd75ed5[_0x793e('0x70')]['toString']())[_0x793e('0x38')]('phone\x20IS\x20NOT\x20NULL'))[_0x793e('0x71')]();_0xb4e812['push'](db[_0x793e('0x87')][_0x793e('0x2f')](_0x55789f));}return BPromise[_0x793e('0x88')](_0xb4e812);}})['then'](function(){return _0x28c1d1;})['then'](respondWithResult(_0x13fce8,null))[_0x793e('0x56')](handleError(_0x13fce8,null));};exports[_0x793e('0x8f')]=function(_0xa0913b,_0x2cca00,_0x25abb6){return db[_0x793e('0x28')][_0x793e('0x45')]({'where':{'id':_0xa0913b[_0x793e('0x44')]['id']}})[_0x793e('0x23')](handleEntityNotFound(_0x2cca00,null))[_0x793e('0x23')](function(_0x5c027d){if(_0x5c027d){return _0x5c027d[_0x793e('0x8f')](_0xa0913b['query'][_0x793e('0x65')]);}})[_0x793e('0x23')](function(_0x59575f){if(_0x59575f){return db[_0x793e('0x61')]['destroy']({'where':{'ListId':_0xa0913b[_0x793e('0x2f')][_0x793e('0x65')],'CampaignId':_0xa0913b[_0x793e('0x44')]['id']}})[_0x793e('0x23')](function(){return _0x59575f;});}})[_0x793e('0x23')](respondWithStatusCode(_0x2cca00,null))[_0x793e('0x56')](handleError(_0x2cca00,null));}; \ No newline at end of file +var _0x2ed4=['keys','length','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','rawAttributes','hasOwnProperty','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','addLists','format','ids','dialCheckDuplicateType','always','insert','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','into','NOW()','phone\x20IS\x20NOT\x20NULL','cm_contacts','fromQuery','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','sequelize','push','all','removeLists','getBlackLists','YYYY-MM-DD\x20HH:mm:ss','addBlackLists','spread','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','jsforce','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','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','IvrCampaigns','destroy','end','sendStatus','error','stack','name','send','index','Campaign','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params'];(function(_0x237d67,_0x4ff2db){var _0x292dfb=function(_0x565a7d){while(--_0x565a7d){_0x237d67['push'](_0x237d67['shift']());}};_0x292dfb(++_0x4ff2db);}(_0x2ed4,0xe6));var _0x42ed=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0x2ed4[_0x2984d0];return _0x2885f2;};'use strict';var emlformat=require(_0x42ed('0x0'));var rimraf=require(_0x42ed('0x1'));var zipdir=require(_0x42ed('0x2'));var jsonpatch=require(_0x42ed('0x3'));var rp=require(_0x42ed('0x4'));var moment=require(_0x42ed('0x5'));var BPromise=require(_0x42ed('0x6'));var Mustache=require('mustache');var util=require(_0x42ed('0x7'));var path=require(_0x42ed('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x42ed('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42ed('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x42ed('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x42ed('0xc'));var querystring=require(_0x42ed('0xd'));var Papa=require(_0x42ed('0xe'));var Redis=require(_0x42ed('0xf'));var authService=require(_0x42ed('0x10'));var qs=require(_0x42ed('0x11'));var as=require(_0x42ed('0x12'));var hardwareService=require(_0x42ed('0x13'));var logger=require('../../config/logger')(_0x42ed('0x14'));var utils=require(_0x42ed('0x15'));var config=require(_0x42ed('0x16'));var licenseUtil=require(_0x42ed('0x17'));var db=require(_0x42ed('0x18'))['db'];function respondWithStatusCode(_0x1e1050,_0xc06898){_0xc06898=_0xc06898||0xcc;return function(_0x52e652){if(_0x52e652){return _0x1e1050['sendStatus'](_0xc06898);}return _0x1e1050[_0x42ed('0x19')](_0xc06898)['end']();};}function respondWithResult(_0x49b245,_0x3a65d5){_0x3a65d5=_0x3a65d5||0xc8;return function(_0x1019b0){if(_0x1019b0){return _0x49b245[_0x42ed('0x19')](_0x3a65d5)[_0x42ed('0x1a')](_0x1019b0);}};}function respondWithFilteredResult(_0x22cb6d,_0x11ccda){return function(_0x3adc7d){if(_0x3adc7d){var _0x12e40c=typeof _0x11ccda[_0x42ed('0x1b')]===_0x42ed('0x1c')&&typeof _0x11ccda[_0x42ed('0x1d')]===_0x42ed('0x1c');var _0x444bc2=_0x3adc7d[_0x42ed('0x1e')];var _0x436827=_0x12e40c?0x0:_0x11ccda[_0x42ed('0x1b')];var _0x465782=_0x12e40c?_0x3adc7d[_0x42ed('0x1e')]:_0x11ccda[_0x42ed('0x1b')]+_0x11ccda[_0x42ed('0x1d')];var _0x33336a;if(_0x465782>=_0x444bc2){_0x465782=_0x444bc2;_0x33336a=0xc8;}else{_0x33336a=0xce;}_0x22cb6d['status'](_0x33336a);return _0x22cb6d[_0x42ed('0x1f')](_0x42ed('0x20'),_0x436827+'-'+_0x465782+'/'+_0x444bc2)[_0x42ed('0x1a')](_0x3adc7d);}return null;};}function patchUpdates(_0x3ddd86){return function(_0x506193){try{jsonpatch[_0x42ed('0x21')](_0x506193,_0x3ddd86,!![]);}catch(_0x14d458){return BPromise['reject'](_0x14d458);}return _0x506193[_0x42ed('0x22')]();};}function saveUpdates(_0x4ab52b,_0x23c9f0){return function(_0x2f3268){if(_0x2f3268){return _0x2f3268[_0x42ed('0x23')](_0x4ab52b)[_0x42ed('0x24')](function(_0x444e9a){return _0x444e9a;});}return null;};}function removeEntity(_0xf0fc43,_0x501ddf){return function(_0x39a9d1){if(_0x39a9d1){return _0x39a9d1['destroy']()[_0x42ed('0x24')](function(){var _0x27ba89=_0x39a9d1['get']({'plain':!![]});var _0x2b9e30=_0x42ed('0x25');return db['UserProfileResource'][_0x42ed('0x26')]({'where':{'type':_0x2b9e30,'resourceId':_0x27ba89['id']}})['then'](function(){return _0x39a9d1;});})[_0x42ed('0x24')](function(){_0xf0fc43[_0x42ed('0x19')](0xcc)[_0x42ed('0x27')]();});}};}function handleEntityNotFound(_0x19b973,_0x10c99c){return function(_0x37b112){if(!_0x37b112){_0x19b973[_0x42ed('0x28')](0x194);}return _0x37b112;};}function handleError(_0x508a5c,_0x49fbb6){_0x49fbb6=_0x49fbb6||0x1f4;return function(_0x1b66ce){logger[_0x42ed('0x29')](_0x1b66ce[_0x42ed('0x2a')]);if(_0x1b66ce[_0x42ed('0x2b')]){delete _0x1b66ce[_0x42ed('0x2b')];}_0x508a5c['status'](_0x49fbb6)[_0x42ed('0x2c')](_0x1b66ce);};}exports[_0x42ed('0x2d')]=function(_0x1b00c0,_0x4ff735){var _0x4ed71a={},_0x2cef45={},_0x1baaee={'count':0x0,'rows':[]};var _0x2e59ac=_['map'](db[_0x42ed('0x2e')]['rawAttributes'],function(_0x2c6c23){return{'name':_0x2c6c23[_0x42ed('0x2f')],'type':_0x2c6c23[_0x42ed('0x30')][_0x42ed('0x31')]};});_0x2cef45['model']=_[_0x42ed('0x32')](_0x2e59ac,_0x42ed('0x2b'));_0x2cef45[_0x42ed('0x33')]=_['keys'](_0x1b00c0[_0x42ed('0x33')]);_0x2cef45[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0x2cef45['model'],_0x2cef45[_0x42ed('0x33')]);_0x4ed71a['attributes']=_['intersection'](_0x2cef45[_0x42ed('0x36')],qs[_0x42ed('0x37')](_0x1b00c0['query']['fields']));_0x4ed71a['attributes']=_0x4ed71a[_0x42ed('0x38')]['length']?_0x4ed71a[_0x42ed('0x38')]:_0x2cef45[_0x42ed('0x36')];if(!_0x1b00c0[_0x42ed('0x33')]['hasOwnProperty'](_0x42ed('0x39'))){_0x4ed71a['limit']=qs[_0x42ed('0x1d')](_0x1b00c0['query']['limit']);_0x4ed71a[_0x42ed('0x1b')]=qs[_0x42ed('0x1b')](_0x1b00c0[_0x42ed('0x33')][_0x42ed('0x1b')]);}_0x4ed71a[_0x42ed('0x3a')]=qs[_0x42ed('0x3b')](_0x1b00c0[_0x42ed('0x33')][_0x42ed('0x3b')]);_0x4ed71a[_0x42ed('0x3c')]=qs[_0x42ed('0x34')](_[_0x42ed('0x3d')](_0x1b00c0['query'],_0x2cef45[_0x42ed('0x34')]),_0x2e59ac);if(_0x1b00c0[_0x42ed('0x33')][_0x42ed('0x3e')]){_0x4ed71a[_0x42ed('0x3c')]=_['merge'](_0x4ed71a[_0x42ed('0x3c')],{'$or':_['map'](_0x2e59ac,function(_0x5b4a15){if(_0x5b4a15[_0x42ed('0x30')]!=='VIRTUAL'){var _0x1037ab={};_0x1037ab[_0x5b4a15[_0x42ed('0x2b')]]={'$like':'%'+_0x1b00c0['query']['filter']+'%'};return _0x1037ab;}})});}_0x4ed71a=_[_0x42ed('0x3f')]({},_0x4ed71a,_0x1b00c0[_0x42ed('0x40')]);var _0x3e4cc5={'where':_0x4ed71a[_0x42ed('0x3c')]};return db['Campaign']['count'](_0x3e4cc5)['then'](function(_0x54d69f){_0x1baaee['count']=_0x54d69f;if(_0x1b00c0[_0x42ed('0x33')][_0x42ed('0x41')]){_0x4ed71a['include']=[{'all':!![]}];}return db[_0x42ed('0x2e')]['findAll'](_0x4ed71a);})[_0x42ed('0x24')](function(_0x2c5d69){_0x1baaee[_0x42ed('0x42')]=_0x2c5d69;return _0x1baaee;})['then'](respondWithFilteredResult(_0x4ff735,_0x4ed71a))[_0x42ed('0x43')](handleError(_0x4ff735,null));};exports[_0x42ed('0x44')]=function(_0x5afa1c,_0x201ff0){var _0x320658={'raw':![],'where':{'id':_0x5afa1c[_0x42ed('0x45')]['id']}},_0x4357d4={};_0x4357d4[_0x42ed('0x36')]=_[_0x42ed('0x46')](db[_0x42ed('0x2e')]['rawAttributes']);_0x4357d4[_0x42ed('0x33')]=_[_0x42ed('0x46')](_0x5afa1c[_0x42ed('0x33')]);_0x4357d4['filters']=_['intersection'](_0x4357d4[_0x42ed('0x36')],_0x4357d4[_0x42ed('0x33')]);_0x320658[_0x42ed('0x38')]=_[_0x42ed('0x35')](_0x4357d4[_0x42ed('0x36')],qs[_0x42ed('0x37')](_0x5afa1c[_0x42ed('0x33')][_0x42ed('0x37')]));_0x320658['attributes']=_0x320658['attributes'][_0x42ed('0x47')]?_0x320658[_0x42ed('0x38')]:_0x4357d4[_0x42ed('0x36')];if(_0x5afa1c[_0x42ed('0x33')][_0x42ed('0x41')]){_0x320658[_0x42ed('0x48')]=[{'all':!![]}];}_0x320658=_[_0x42ed('0x3f')]({},_0x320658,_0x5afa1c[_0x42ed('0x40')]);return db[_0x42ed('0x2e')][_0x42ed('0x49')](_0x320658)['then'](handleEntityNotFound(_0x201ff0,null))['then'](respondWithResult(_0x201ff0,null))[_0x42ed('0x43')](handleError(_0x201ff0,null));};exports[_0x42ed('0x4a')]=function(_0x2a54aa,_0x3dcad9){return db['Campaign'][_0x42ed('0x4a')](_0x2a54aa[_0x42ed('0x4b')],{})[_0x42ed('0x24')](function(_0x172836){var _0x3a690f=_0x2a54aa[_0x42ed('0x4c')][_0x42ed('0x4d')]({'plain':!![]});if(!_0x3a690f)throw new Error(_0x42ed('0x4e'));if(_0x3a690f[_0x42ed('0x4f')]===_0x42ed('0x4c')){var _0x543b68=_0x172836[_0x42ed('0x4d')]({'plain':!![]});var _0x15bef4=_0x42ed('0x25');return db[_0x42ed('0x50')][_0x42ed('0x49')]({'where':{'name':_0x15bef4,'userProfileId':_0x3a690f[_0x42ed('0x51')]},'raw':!![]})[_0x42ed('0x24')](function(_0x182d7d){if(_0x182d7d&&_0x182d7d[_0x42ed('0x52')]===0x0){return db[_0x42ed('0x53')][_0x42ed('0x4a')]({'name':_0x543b68[_0x42ed('0x2b')],'resourceId':_0x543b68['id'],'type':_0x182d7d[_0x42ed('0x2b')],'sectionId':_0x182d7d['id']},{})['then'](function(){return _0x172836;});}else{return _0x172836;}})['catch'](function(_0x5b71d9){logger['error'](_0x42ed('0x54'),_0x5b71d9);throw _0x5b71d9;});}return _0x172836;})[_0x42ed('0x24')](respondWithResult(_0x3dcad9,0xc9))[_0x42ed('0x43')](handleError(_0x3dcad9,null));};exports[_0x42ed('0x55')]=function(_0x169c59,_0x926be9){var _0x2e3966={'where':{'id':_0x169c59[_0x42ed('0x45')]['id']}},_0x36596a={};_0x36596a[_0x42ed('0x36')]=_[_0x42ed('0x46')](db[_0x42ed('0x2e')]['rawAttributes']);_0x2e3966[_0x42ed('0x38')]=_['intersection'](_0x36596a[_0x42ed('0x36')],qs[_0x42ed('0x37')](_0x169c59['query']['fields']));_0x2e3966[_0x42ed('0x38')]=_0x2e3966['attributes']['length']?_0x2e3966['attributes']:_0x36596a[_0x42ed('0x36')];if(_0x169c59[_0x42ed('0x33')]['includeAll']){_0x2e3966[_0x42ed('0x48')]=[{'all':!![]}];}_0x2e3966=_[_0x42ed('0x3f')]({},_0x2e3966,_0x169c59[_0x42ed('0x40')]);return db[_0x42ed('0x2e')][_0x42ed('0x49')](_0x2e3966)[_0x42ed('0x24')](handleEntityNotFound(_0x926be9,null))[_0x42ed('0x24')](function(_0x2ecb39){if(_0x2ecb39){var _0xeda830=_0x2ecb39[_0x42ed('0x4d')]({'plain':!![]});_0xeda830=qs[_0x42ed('0x56')](_0xeda830,['id',_0x42ed('0x57'),_0x42ed('0x58')]);_0x169c59[_0x42ed('0x4b')]=_[_0x42ed('0x56')](_0x169c59['body'],['id',_0x42ed('0x57'),_0x42ed('0x58')]);return db[_0x42ed('0x2e')][_0x42ed('0x4a')](_[_0x42ed('0x3f')](_0xeda830,_0x169c59[_0x42ed('0x4b')]),{'include':_0x169c59[_0x42ed('0x33')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x34b84e){var _0x1c1df0=_0x169c59[_0x42ed('0x4c')]['get']({'plain':!![]});if(!_0x1c1df0)throw new Error(_0x42ed('0x4e'));if(_0x1c1df0['role']===_0x42ed('0x4c')){var _0x107735=_0x34b84e[_0x42ed('0x4d')]({'plain':!![]});var _0x306358=_0x42ed('0x25');return db['UserProfileSection'][_0x42ed('0x49')]({'where':{'name':_0x306358,'userProfileId':_0x1c1df0[_0x42ed('0x51')]},'raw':!![]})[_0x42ed('0x24')](function(_0x5d29cb){if(_0x5d29cb&&_0x5d29cb[_0x42ed('0x52')]===0x0){return db[_0x42ed('0x53')]['create']({'name':_0x107735[_0x42ed('0x2b')],'resourceId':_0x107735['id'],'type':_0x5d29cb[_0x42ed('0x2b')],'sectionId':_0x5d29cb['id']},{})[_0x42ed('0x24')](function(){return _0x34b84e;});}else{return _0x34b84e;}})['catch'](function(_0x3abacb){logger[_0x42ed('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3abacb);throw _0x3abacb;});}return _0x34b84e;});}})[_0x42ed('0x24')](respondWithResult(_0x926be9,0xc9))[_0x42ed('0x43')](handleError(_0x926be9,null));};exports['update']=function(_0x2373cd,_0x2dbd7a){if(_0x2373cd['body']['id']){delete _0x2373cd['body']['id'];}return db[_0x42ed('0x2e')][_0x42ed('0x49')]({'where':{'id':_0x2373cd[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x2dbd7a,null))[_0x42ed('0x24')](saveUpdates(_0x2373cd[_0x42ed('0x4b')],null))[_0x42ed('0x24')](respondWithResult(_0x2dbd7a,null))[_0x42ed('0x43')](handleError(_0x2dbd7a,null));};exports[_0x42ed('0x26')]=function(_0x3fe0c8,_0x4de0e5){return db[_0x42ed('0x2e')][_0x42ed('0x49')]({'where':{'id':_0x3fe0c8[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x4de0e5,null))[_0x42ed('0x24')](removeEntity(_0x4de0e5,null))[_0x42ed('0x43')](handleError(_0x4de0e5,null));};exports[_0x42ed('0x59')]=function(_0x3c5edd,_0x29ccc5,_0x35b18d){var _0xd973f={'raw':!![],'where':{}};var _0x239738={};var _0x32d2fa={'count':0x0,'rows':[]};return db['Campaign'][_0x42ed('0x5a')]({'where':{'id':_0x3c5edd[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x29ccc5,null))[_0x42ed('0x24')](function(_0xae3326){if(_0xae3326){_0x239738[_0x42ed('0x36')]=_[_0x42ed('0x46')](db[_0x42ed('0x5b')][_0x42ed('0x5c')]);_0x239738[_0x42ed('0x33')]=_['keys'](_0x3c5edd[_0x42ed('0x33')]);_0x239738[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0x239738['model'],_0x239738['query']);_0xd973f['attributes']=_[_0x42ed('0x35')](_0x239738['model'],qs[_0x42ed('0x37')](_0x3c5edd[_0x42ed('0x33')][_0x42ed('0x37')]));_0xd973f['attributes']=_0xd973f[_0x42ed('0x38')][_0x42ed('0x47')]?_0xd973f[_0x42ed('0x38')]:_0x239738[_0x42ed('0x36')];if(!_0x3c5edd[_0x42ed('0x33')][_0x42ed('0x5d')](_0x42ed('0x39'))){_0xd973f[_0x42ed('0x1d')]=qs[_0x42ed('0x1d')](_0x3c5edd[_0x42ed('0x33')]['limit']);_0xd973f[_0x42ed('0x1b')]=qs[_0x42ed('0x1b')](_0x3c5edd[_0x42ed('0x33')][_0x42ed('0x1b')]);}_0xd973f['order']=qs[_0x42ed('0x3b')](_0x3c5edd['query'][_0x42ed('0x3b')]);_0xd973f[_0x42ed('0x3c')]=qs['filters'](_[_0x42ed('0x3d')](_0x3c5edd[_0x42ed('0x33')],_0x239738['filters']));_0xd973f['where'][_0x42ed('0x5e')]=_0xae3326['id'];if(_0x3c5edd[_0x42ed('0x33')][_0x42ed('0x3e')]){_0xd973f['where']=_['merge'](_0xd973f['where'],{'$or':_['map'](_0xd973f['attributes'],function(_0x32e578){var _0x4a8fd1={};_0x4a8fd1[_0x32e578]={'$like':'%'+_0x3c5edd[_0x42ed('0x33')]['filter']+'%'};return _0x4a8fd1;})});}_0xd973f=_[_0x42ed('0x3f')]({},_0xd973f,_0x3c5edd[_0x42ed('0x40')]);return db[_0x42ed('0x5b')]['count']({'where':_0xd973f[_0x42ed('0x3c')]})['then'](function(_0x567dff){_0x32d2fa[_0x42ed('0x1e')]=_0x567dff;if(_0x3c5edd[_0x42ed('0x33')]['includeAll']){_0xd973f['include']=[{'all':!![]}];}return db['CmHopper'][_0x42ed('0x5f')](_0xd973f);})['then'](function(_0x5d244a){_0x32d2fa[_0x42ed('0x42')]=_0x5d244a;return _0x32d2fa;});}})[_0x42ed('0x24')](respondWithFilteredResult(_0x29ccc5,_0xd973f))[_0x42ed('0x43')](handleError(_0x29ccc5,null));};exports[_0x42ed('0x60')]=function(_0x25ddfe,_0x54d1bf,_0x5df1e0){var _0x57636e={'raw':!![],'where':{}};var _0x525cec={};var _0x3c592e={'count':0x0,'rows':[]};return db[_0x42ed('0x2e')][_0x42ed('0x5a')]({'where':{'id':_0x25ddfe[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x54d1bf,null))[_0x42ed('0x24')](function(_0x4fbc05){if(_0x4fbc05){_0x525cec[_0x42ed('0x36')]=_['keys'](db[_0x42ed('0x61')][_0x42ed('0x5c')]);_0x525cec['query']=_[_0x42ed('0x46')](_0x25ddfe[_0x42ed('0x33')]);_0x525cec[_0x42ed('0x34')]=_['intersection'](_0x525cec[_0x42ed('0x36')],_0x525cec[_0x42ed('0x33')]);_0x57636e[_0x42ed('0x38')]=_[_0x42ed('0x35')](_0x525cec[_0x42ed('0x36')],qs[_0x42ed('0x37')](_0x25ddfe[_0x42ed('0x33')]['fields']));_0x57636e[_0x42ed('0x38')]=_0x57636e['attributes']['length']?_0x57636e[_0x42ed('0x38')]:_0x525cec[_0x42ed('0x36')];if(!_0x25ddfe[_0x42ed('0x33')][_0x42ed('0x5d')](_0x42ed('0x39'))){_0x57636e['limit']=qs[_0x42ed('0x1d')](_0x25ddfe[_0x42ed('0x33')][_0x42ed('0x1d')]);_0x57636e[_0x42ed('0x1b')]=qs[_0x42ed('0x1b')](_0x25ddfe[_0x42ed('0x33')][_0x42ed('0x1b')]);}_0x57636e[_0x42ed('0x3a')]=qs['sort'](_0x25ddfe[_0x42ed('0x33')]['sort']);_0x57636e['where']=qs['filters'](_[_0x42ed('0x3d')](_0x25ddfe[_0x42ed('0x33')],_0x525cec[_0x42ed('0x34')]));_0x57636e[_0x42ed('0x3c')][_0x42ed('0x5e')]=_0x4fbc05['id'];if(_0x25ddfe['query'][_0x42ed('0x3e')]){_0x57636e[_0x42ed('0x3c')]=_['merge'](_0x57636e[_0x42ed('0x3c')],{'$or':_[_0x42ed('0x32')](_0x57636e[_0x42ed('0x38')],function(_0x1cf6d2){var _0xb2dd79={};_0xb2dd79[_0x1cf6d2]={'$like':'%'+_0x25ddfe[_0x42ed('0x33')][_0x42ed('0x3e')]+'%'};return _0xb2dd79;})});}_0x57636e=_[_0x42ed('0x3f')]({},_0x57636e,_0x25ddfe[_0x42ed('0x40')]);return db['CmHopperHistory'][_0x42ed('0x1e')]({'where':_0x57636e[_0x42ed('0x3c')]})[_0x42ed('0x24')](function(_0x24ed38){_0x3c592e[_0x42ed('0x1e')]=_0x24ed38;if(_0x25ddfe[_0x42ed('0x33')][_0x42ed('0x41')]){_0x57636e[_0x42ed('0x48')]=[{'all':!![]}];}return db[_0x42ed('0x61')]['findAll'](_0x57636e);})[_0x42ed('0x24')](function(_0x2d9c05){_0x3c592e['rows']=_0x2d9c05;return _0x3c592e;});}})[_0x42ed('0x24')](respondWithFilteredResult(_0x54d1bf,_0x57636e))[_0x42ed('0x43')](handleError(_0x54d1bf,null));};exports[_0x42ed('0x62')]=function(_0x2e2e43,_0xf9c9ac,_0x536a6a){var _0x1cee27={'raw':!![],'where':{}};var _0x57e4dc={};var _0x2d2301={'count':0x0,'rows':[]};return db[_0x42ed('0x2e')]['findOne']({'where':{'id':_0x2e2e43['params']['id']}})['then'](handleEntityNotFound(_0xf9c9ac,null))[_0x42ed('0x24')](function(_0x21fdb9){if(_0x21fdb9){_0x57e4dc[_0x42ed('0x36')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x57e4dc[_0x42ed('0x33')]=_[_0x42ed('0x46')](_0x2e2e43[_0x42ed('0x33')]);_0x57e4dc[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0x57e4dc[_0x42ed('0x36')],_0x57e4dc[_0x42ed('0x33')]);_0x1cee27['attributes']=_['intersection'](_0x57e4dc[_0x42ed('0x36')],qs[_0x42ed('0x37')](_0x2e2e43[_0x42ed('0x33')][_0x42ed('0x37')]));_0x1cee27['attributes']=_0x1cee27['attributes'][_0x42ed('0x47')]?_0x1cee27['attributes']:_0x57e4dc[_0x42ed('0x36')];if(!_0x2e2e43[_0x42ed('0x33')]['hasOwnProperty'](_0x42ed('0x39'))){_0x1cee27['limit']=qs['limit'](_0x2e2e43[_0x42ed('0x33')][_0x42ed('0x1d')]);_0x1cee27[_0x42ed('0x1b')]=qs[_0x42ed('0x1b')](_0x2e2e43['query'][_0x42ed('0x1b')]);}_0x1cee27[_0x42ed('0x3a')]=qs[_0x42ed('0x3b')](_0x2e2e43[_0x42ed('0x33')][_0x42ed('0x3b')]);_0x1cee27[_0x42ed('0x3c')]=qs[_0x42ed('0x34')](_[_0x42ed('0x3d')](_0x2e2e43[_0x42ed('0x33')],_0x57e4dc[_0x42ed('0x34')]));_0x1cee27[_0x42ed('0x3c')][_0x42ed('0x5e')]=_0x21fdb9['id'];if(_0x2e2e43[_0x42ed('0x33')][_0x42ed('0x3e')]){_0x1cee27['where']=_['merge'](_0x1cee27[_0x42ed('0x3c')],{'$or':_['map'](_0x1cee27['attributes'],function(_0x10c1ed){var _0x13c5af={};_0x13c5af[_0x10c1ed]={'$like':'%'+_0x2e2e43[_0x42ed('0x33')][_0x42ed('0x3e')]+'%'};return _0x13c5af;})});}_0x1cee27=_[_0x42ed('0x3f')]({},_0x1cee27,_0x2e2e43['options']);return db[_0x42ed('0x63')][_0x42ed('0x1e')]({'where':_0x1cee27[_0x42ed('0x3c')]})['then'](function(_0x3b376b){_0x2d2301[_0x42ed('0x1e')]=_0x3b376b;if(_0x2e2e43[_0x42ed('0x33')][_0x42ed('0x41')]){_0x1cee27[_0x42ed('0x48')]=[{'all':!![]}];}return db[_0x42ed('0x63')][_0x42ed('0x5f')](_0x1cee27);})[_0x42ed('0x24')](function(_0x30c29e){_0x2d2301[_0x42ed('0x42')]=_0x30c29e;return _0x2d2301;});}})['then'](respondWithFilteredResult(_0xf9c9ac,_0x1cee27))[_0x42ed('0x43')](handleError(_0xf9c9ac,null));};exports[_0x42ed('0x64')]=function(_0x1d372f,_0xf29020,_0x2c8343){var _0x596c04={'raw':!![],'where':{}};var _0x747ce5={};var _0x542ff8={'count':0x0,'rows':[]};return db[_0x42ed('0x2e')]['findOne']({'where':{'id':_0x1d372f[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0xf29020,null))[_0x42ed('0x24')](function(_0x478a89){if(_0x478a89){_0x747ce5['model']=_[_0x42ed('0x46')](db[_0x42ed('0x65')][_0x42ed('0x5c')]);_0x747ce5[_0x42ed('0x33')]=_['keys'](_0x1d372f[_0x42ed('0x33')]);_0x747ce5[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0x747ce5[_0x42ed('0x36')],_0x747ce5[_0x42ed('0x33')]);_0x596c04[_0x42ed('0x38')]=_[_0x42ed('0x35')](_0x747ce5[_0x42ed('0x36')],qs[_0x42ed('0x37')](_0x1d372f[_0x42ed('0x33')][_0x42ed('0x37')]));_0x596c04[_0x42ed('0x38')]=_0x596c04[_0x42ed('0x38')][_0x42ed('0x47')]?_0x596c04[_0x42ed('0x38')]:_0x747ce5[_0x42ed('0x36')];if(!_0x1d372f[_0x42ed('0x33')][_0x42ed('0x5d')](_0x42ed('0x39'))){_0x596c04[_0x42ed('0x1d')]=qs[_0x42ed('0x1d')](_0x1d372f[_0x42ed('0x33')]['limit']);_0x596c04[_0x42ed('0x1b')]=qs['offset'](_0x1d372f['query']['offset']);}_0x596c04[_0x42ed('0x3a')]=qs[_0x42ed('0x3b')](_0x1d372f[_0x42ed('0x33')]['sort']);_0x596c04[_0x42ed('0x3c')]=qs[_0x42ed('0x34')](_[_0x42ed('0x3d')](_0x1d372f['query'],_0x747ce5[_0x42ed('0x34')]));_0x596c04[_0x42ed('0x3c')][_0x42ed('0x5e')]=_0x478a89['id'];if(_0x1d372f[_0x42ed('0x33')][_0x42ed('0x3e')]){_0x596c04['where']=_['merge'](_0x596c04[_0x42ed('0x3c')],{'$or':_['map'](_0x596c04[_0x42ed('0x38')],function(_0xb299cf){var _0x126bbb={};_0x126bbb[_0xb299cf]={'$like':'%'+_0x1d372f[_0x42ed('0x33')][_0x42ed('0x3e')]+'%'};return _0x126bbb;})});}_0x596c04=_[_0x42ed('0x3f')]({},_0x596c04,_0x1d372f[_0x42ed('0x40')]);return db[_0x42ed('0x65')][_0x42ed('0x1e')]({'where':_0x596c04[_0x42ed('0x3c')]})[_0x42ed('0x24')](function(_0x3faadd){_0x542ff8[_0x42ed('0x1e')]=_0x3faadd;if(_0x1d372f[_0x42ed('0x33')][_0x42ed('0x41')]){_0x596c04[_0x42ed('0x48')]=[{'all':!![]}];}return db[_0x42ed('0x65')][_0x42ed('0x5f')](_0x596c04);})[_0x42ed('0x24')](function(_0x2c4617){_0x542ff8[_0x42ed('0x42')]=_0x2c4617;return _0x542ff8;});}})[_0x42ed('0x24')](respondWithFilteredResult(_0xf29020,_0x596c04))[_0x42ed('0x43')](handleError(_0xf29020,null));};exports['getLists']=function(_0x5d48fa,_0x1955c6,_0x2f9c14){var _0x440016={};var _0x4bacba={};var _0x15650d;var _0x3793a1;return db[_0x42ed('0x2e')][_0x42ed('0x5a')]({'where':{'id':_0x5d48fa[_0x42ed('0x45')]['id']}})['then'](handleEntityNotFound(_0x1955c6,null))[_0x42ed('0x24')](function(_0x556bd6){if(_0x556bd6){_0x15650d=_0x556bd6;_0x4bacba['model']=_[_0x42ed('0x46')](db[_0x42ed('0x66')][_0x42ed('0x5c')]);_0x4bacba['query']=_[_0x42ed('0x46')](_0x5d48fa[_0x42ed('0x33')]);_0x4bacba[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0x4bacba['model'],_0x4bacba[_0x42ed('0x33')]);_0x440016[_0x42ed('0x38')]=_[_0x42ed('0x35')](_0x4bacba[_0x42ed('0x36')],qs['fields'](_0x5d48fa[_0x42ed('0x33')]['fields']));_0x440016['attributes']=_0x440016[_0x42ed('0x38')][_0x42ed('0x47')]?_0x440016[_0x42ed('0x38')]:_0x4bacba[_0x42ed('0x36')];_0x440016[_0x42ed('0x3a')]=qs['sort'](_0x5d48fa[_0x42ed('0x33')]['sort']);_0x440016[_0x42ed('0x3c')]=qs[_0x42ed('0x34')](_[_0x42ed('0x3d')](_0x5d48fa['query'],_0x4bacba[_0x42ed('0x34')]));if(_0x5d48fa[_0x42ed('0x33')][_0x42ed('0x3e')]){_0x440016[_0x42ed('0x3c')]=_[_0x42ed('0x3f')](_0x440016['where'],{'$or':_['map'](_0x440016['attributes'],function(_0x1010ca){var _0x1d198a={};_0x1d198a[_0x1010ca]={'$like':'%'+_0x5d48fa['query'][_0x42ed('0x3e')]+'%'};return _0x1d198a;})});}_0x440016=_[_0x42ed('0x3f')]({},_0x440016,_0x5d48fa[_0x42ed('0x40')]);return _0x15650d['getLists'](_0x440016);}})[_0x42ed('0x24')](function(_0x35d35d){if(_0x35d35d){_0x3793a1=_0x35d35d['length'];if(!_0x5d48fa[_0x42ed('0x33')][_0x42ed('0x5d')]('nolimit')){_0x440016[_0x42ed('0x1d')]=qs[_0x42ed('0x1d')](_0x5d48fa[_0x42ed('0x33')][_0x42ed('0x1d')]);_0x440016[_0x42ed('0x1b')]=qs['offset'](_0x5d48fa['query'][_0x42ed('0x1b')]);}return _0x15650d['getLists'](_0x440016);}})[_0x42ed('0x24')](function(_0x5176b3){if(_0x5176b3){return _0x5176b3?{'count':_0x3793a1,'rows':_0x5176b3}:null;}})['then'](respondWithResult(_0x1955c6,null))[_0x42ed('0x43')](handleError(_0x1955c6,null));};exports[_0x42ed('0x67')]=function(_0x5db1b1,_0x4f59dc,_0x2d2d4f){var _0x42bac9,_0xabcf7a;var _0x4c82b5=[];var _0x4c8673=moment()[_0x42ed('0x68')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x42ed('0x2e')]['find']({'where':{'id':_0x5db1b1['params']['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x4f59dc,null))[_0x42ed('0x24')](function(_0x1ab760){if(_0x1ab760){_0xabcf7a=_0x1ab760;return _0x1ab760[_0x42ed('0x67')](_0x5db1b1[_0x42ed('0x4b')][_0x42ed('0x69')],_['omit'](_0x5db1b1['body'],[_0x42ed('0x69'),'id'])||{});}return null;})['spread'](function(_0x444d2d){var _0x193ffa;var _0x3f7611;_0x42bac9=_0x444d2d||[];var _0x4763a0=[];if(_0x444d2d){for(var _0x3e95ae=0x0;_0x3e95ae<_0x444d2d[_0x42ed('0x47')];_0x3e95ae+=0x1){var _0x36e1a7=_0x444d2d[_0x3e95ae][_0x42ed('0x4d')]({'plain':!![]});_0xabcf7a[_0x42ed('0x6a')]=_0x5db1b1[_0x42ed('0x4b')][_0x42ed('0x6a')]?_0x5db1b1[_0x42ed('0x4b')][_0x42ed('0x6a')]:_0xabcf7a[_0x42ed('0x6a')];switch(_0xabcf7a[_0x42ed('0x6a')]){case _0x42ed('0x6b'):_0x193ffa=squel[_0x42ed('0x6c')]()['into']('cm_hopper')['fromQuery']([_0x42ed('0x6d'),_0x42ed('0x6e'),_0x42ed('0x6f'),_0x42ed('0x70'),_0x42ed('0x5e'),_0x42ed('0x57'),_0x42ed('0x58')],squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x6d'),'phone')[_0x42ed('0x72')]('NOW()',_0x42ed('0x6e'))[_0x42ed('0x72')]('id',_0x42ed('0x6f'))['field'](_0x36e1a7[_0x42ed('0x73')][_0x42ed('0x74')](),_0x42ed('0x70'))[_0x42ed('0x72')](_0x5db1b1[_0x42ed('0x45')]['id'][_0x42ed('0x74')](),_0x42ed('0x5e'))[_0x42ed('0x72')]('\x27'+_0x4c8673+'\x27',_0x42ed('0x57'))['field']('\x27'+_0x4c8673+'\x27',_0x42ed('0x58'))[_0x42ed('0x75')]('cm_contacts')[_0x42ed('0x3c')](_0x42ed('0x76'))['where'](_0x42ed('0x77'),_0x36e1a7[_0x42ed('0x73')][_0x42ed('0x74')]())[_0x42ed('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x42ed('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x78'))[_0x42ed('0x75')](_0x42ed('0x79'))[_0x42ed('0x3c')]('CampaignId\x20=\x20?',_0x5db1b1['params']['id'][_0x42ed('0x74')]()))[_0x42ed('0x3c')](_0x42ed('0x7a'),squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x7b'))[_0x42ed('0x75')](_0x42ed('0x7c'))[_0x42ed('0x3c')](_0x42ed('0x7d'),_0x5db1b1[_0x42ed('0x45')]['id'][_0x42ed('0x74')]())))['toString']();break;case _0x42ed('0x7e'):_0x193ffa=squel[_0x42ed('0x6c')]()[_0x42ed('0x7f')](_0x42ed('0x7c'))['fromQuery'](['phone',_0x42ed('0x6e'),'ContactId',_0x42ed('0x70'),_0x42ed('0x5e'),_0x42ed('0x57'),_0x42ed('0x58')],squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x6d'),_0x42ed('0x6d'))[_0x42ed('0x72')](_0x42ed('0x80'),_0x42ed('0x6e'))[_0x42ed('0x72')]('id',_0x42ed('0x6f'))[_0x42ed('0x72')](_0x36e1a7['CmListId'][_0x42ed('0x74')](),_0x42ed('0x70'))[_0x42ed('0x72')](_0x5db1b1[_0x42ed('0x45')]['id']['toString'](),'CampaignId')[_0x42ed('0x72')]('\x27'+_0x4c8673+'\x27','createdAt')['field']('\x27'+_0x4c8673+'\x27',_0x42ed('0x58'))[_0x42ed('0x75')]('cm_contacts')[_0x42ed('0x3c')](_0x42ed('0x76'))[_0x42ed('0x3c')]('ListId\x20=\x20?',_0x36e1a7[_0x42ed('0x73')][_0x42ed('0x74')]())[_0x42ed('0x3c')](_0x42ed('0x81'))[_0x42ed('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x7b'))[_0x42ed('0x75')](_0x42ed('0x7c'))[_0x42ed('0x3c')](_0x42ed('0x7d'),_0x5db1b1['params']['id'][_0x42ed('0x74')]())))[_0x42ed('0x74')]();break;default:_0x193ffa=squel[_0x42ed('0x6c')]()['into']('cm_hopper')['fromQuery'](['phone',_0x42ed('0x6e'),_0x42ed('0x6f'),_0x42ed('0x70'),_0x42ed('0x5e'),_0x42ed('0x57'),'updatedAt'],squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x6d'),_0x42ed('0x6d'))['field'](_0x42ed('0x80'),_0x42ed('0x6e'))['field']('id',_0x42ed('0x6f'))[_0x42ed('0x72')](_0x36e1a7['CmListId'][_0x42ed('0x74')](),_0x42ed('0x70'))['field'](_0x5db1b1[_0x42ed('0x45')]['id'][_0x42ed('0x74')](),_0x42ed('0x5e'))['field']('\x27'+_0x4c8673+'\x27',_0x42ed('0x57'))[_0x42ed('0x72')]('\x27'+_0x4c8673+'\x27',_0x42ed('0x58'))[_0x42ed('0x75')](_0x42ed('0x82'))[_0x42ed('0x3c')](_0x42ed('0x76'))[_0x42ed('0x3c')](_0x42ed('0x77'),_0x36e1a7[_0x42ed('0x73')][_0x42ed('0x74')]())[_0x42ed('0x3c')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x3f7611=squel['insert']()[_0x42ed('0x7f')]('cm_hopper_additional_phones')[_0x42ed('0x83')]([_0x42ed('0x84'),_0x42ed('0x6e'),'phone',_0x42ed('0x85'),'createdAt','updatedAt'],squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x86'),'id')[_0x42ed('0x72')](_0x42ed('0x80'),'scheduledAt')[_0x42ed('0x72')]('ci.item','phone')['field'](_0x42ed('0x87'),'OrderBy')['field']('\x27'+_0x4c8673+'\x27','createdAt')[_0x42ed('0x72')]('\x27'+_0x4c8673+'\x27','updatedAt')['from'](_0x42ed('0x88'),'ci')[_0x42ed('0x89')](_0x42ed('0x7c'),'h',_0x42ed('0x8a'))[_0x42ed('0x3c')](_0x42ed('0x8b'),_0x36e1a7[_0x42ed('0x73')]['toString']())[_0x42ed('0x3c')](_0x42ed('0x8c'),_0x5db1b1[_0x42ed('0x45')]['id'][_0x42ed('0x74')]())[_0x42ed('0x3c')]('h.createdAt\x20=\x20?',_0x4c8673))[_0x42ed('0x74')]();_0x4763a0['push'](db[_0x42ed('0x8d')][_0x42ed('0x33')](_0x193ffa));_0x4c82b5[_0x42ed('0x8e')](db[_0x42ed('0x8d')][_0x42ed('0x33')](_0x3f7611));}return BPromise[_0x42ed('0x8f')](_0x4763a0);}})['then'](function(){return BPromise[_0x42ed('0x8f')](_0x4c82b5);})['then'](function(){return _0x42bac9;})[_0x42ed('0x24')](respondWithResult(_0x4f59dc,null))[_0x42ed('0x43')](handleError(_0x4f59dc,null));};exports[_0x42ed('0x90')]=function(_0x1fdad2,_0x497189,_0x33fe98){return db[_0x42ed('0x2e')][_0x42ed('0x49')]({'where':{'id':_0x1fdad2['params']['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x497189,null))[_0x42ed('0x24')](function(_0x87e4da){if(_0x87e4da){return _0x87e4da[_0x42ed('0x90')](_0x1fdad2[_0x42ed('0x33')][_0x42ed('0x69')]);}})[_0x42ed('0x24')](function(_0x588be8){if(_0x588be8){return db[_0x42ed('0x5b')][_0x42ed('0x26')]({'where':{'ListId':_0x1fdad2['query'][_0x42ed('0x69')],'CampaignId':_0x1fdad2[_0x42ed('0x45')]['id']}})['then'](function(){return _0x588be8;});}})[_0x42ed('0x24')](respondWithStatusCode(_0x497189,null))[_0x42ed('0x43')](handleError(_0x497189,null));};exports['getBlackLists']=function(_0x38585a,_0x5e666d,_0x2e76fe){var _0x2a7e65={};var _0x3e9aaa={};var _0x5ceb14;var _0x4e3395;return db['Campaign'][_0x42ed('0x5a')]({'where':{'id':_0x38585a[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x5e666d,null))[_0x42ed('0x24')](function(_0x589eda){if(_0x589eda){_0x5ceb14=_0x589eda;_0x3e9aaa[_0x42ed('0x36')]=_[_0x42ed('0x46')](db[_0x42ed('0x66')]['rawAttributes']);_0x3e9aaa[_0x42ed('0x33')]=_['keys'](_0x38585a[_0x42ed('0x33')]);_0x3e9aaa[_0x42ed('0x34')]=_[_0x42ed('0x35')](_0x3e9aaa['model'],_0x3e9aaa[_0x42ed('0x33')]);_0x2a7e65[_0x42ed('0x38')]=_[_0x42ed('0x35')](_0x3e9aaa['model'],qs[_0x42ed('0x37')](_0x38585a[_0x42ed('0x33')][_0x42ed('0x37')]));_0x2a7e65[_0x42ed('0x38')]=_0x2a7e65[_0x42ed('0x38')][_0x42ed('0x47')]?_0x2a7e65[_0x42ed('0x38')]:_0x3e9aaa[_0x42ed('0x36')];_0x2a7e65[_0x42ed('0x3a')]=qs[_0x42ed('0x3b')](_0x38585a[_0x42ed('0x33')][_0x42ed('0x3b')]);_0x2a7e65['where']=qs[_0x42ed('0x34')](_['pick'](_0x38585a[_0x42ed('0x33')],_0x3e9aaa['filters']));if(_0x38585a['query'][_0x42ed('0x3e')]){_0x2a7e65[_0x42ed('0x3c')]=_[_0x42ed('0x3f')](_0x2a7e65[_0x42ed('0x3c')],{'$or':_[_0x42ed('0x32')](_0x2a7e65[_0x42ed('0x38')],function(_0x179d45){var _0x318b00={};_0x318b00[_0x179d45]={'$like':'%'+_0x38585a['query'][_0x42ed('0x3e')]+'%'};return _0x318b00;})});}_0x2a7e65=_[_0x42ed('0x3f')]({},_0x2a7e65,_0x38585a['options']);return _0x5ceb14[_0x42ed('0x91')](_0x2a7e65);}})['then'](function(_0x246fac){if(_0x246fac){_0x4e3395=_0x246fac['length'];if(!_0x38585a[_0x42ed('0x33')][_0x42ed('0x5d')](_0x42ed('0x39'))){_0x2a7e65[_0x42ed('0x1d')]=qs['limit'](_0x38585a[_0x42ed('0x33')][_0x42ed('0x1d')]);_0x2a7e65[_0x42ed('0x1b')]=qs[_0x42ed('0x1b')](_0x38585a['query'][_0x42ed('0x1b')]);}return _0x5ceb14[_0x42ed('0x91')](_0x2a7e65);}})[_0x42ed('0x24')](function(_0x11caa8){if(_0x11caa8){return _0x11caa8?{'count':_0x4e3395,'rows':_0x11caa8}:null;}})[_0x42ed('0x24')](respondWithResult(_0x5e666d,null))[_0x42ed('0x43')](handleError(_0x5e666d,null));};exports['addBlackLists']=function(_0x5a1939,_0x85bfad,_0x5eb30b){var _0x16439f,_0x425aa4;var _0x254191=[];var _0x3eb74d=moment()[_0x42ed('0x68')](_0x42ed('0x92'));return db[_0x42ed('0x2e')][_0x42ed('0x49')]({'where':{'id':_0x5a1939['params']['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x85bfad,null))[_0x42ed('0x24')](function(_0x3c8c37){if(_0x3c8c37){_0x425aa4=_0x3c8c37;return _0x3c8c37[_0x42ed('0x93')](_0x5a1939[_0x42ed('0x4b')][_0x42ed('0x69')],_[_0x42ed('0x56')](_0x5a1939[_0x42ed('0x4b')],['ids','id'])||{});}return null;})[_0x42ed('0x94')](function(_0x2ad77b){var _0x1f4b9b;var _0x12fb8f;_0x16439f=_0x2ad77b||[];var _0x3f3f56=[];if(_0x2ad77b){for(var _0x56596d=0x0;_0x56596d<_0x2ad77b[_0x42ed('0x47')];_0x56596d+=0x1){var _0x1eb4f5=_0x2ad77b[_0x56596d][_0x42ed('0x4d')]({'plain':!![]});_0x1f4b9b=squel['insert']()[_0x42ed('0x7f')]('cm_hopper_black')[_0x42ed('0x83')]([_0x42ed('0x6d'),_0x42ed('0x6f'),_0x42ed('0x70'),_0x42ed('0x5e'),_0x42ed('0x57'),_0x42ed('0x58')],squel[_0x42ed('0x71')]()[_0x42ed('0x72')](_0x42ed('0x6d'),_0x42ed('0x6d'))[_0x42ed('0x72')]('id',_0x42ed('0x6f'))[_0x42ed('0x72')](_0x1eb4f5['CmListId'][_0x42ed('0x74')](),_0x42ed('0x70'))['field'](_0x5a1939['params']['id'][_0x42ed('0x74')](),'CampaignId')[_0x42ed('0x72')](_0x42ed('0x80'),'createdAt')[_0x42ed('0x72')](_0x42ed('0x80'),'updatedAt')['from']('cm_contacts')[_0x42ed('0x3c')](_0x42ed('0x76'))[_0x42ed('0x3c')](_0x42ed('0x77'),_0x1eb4f5['CmListId'][_0x42ed('0x74')]())['where'](_0x42ed('0x81')))[_0x42ed('0x74')]();_0x3f3f56[_0x42ed('0x8e')](db[_0x42ed('0x8d')]['query'](_0x1f4b9b));}return BPromise[_0x42ed('0x8f')](_0x3f3f56);}})[_0x42ed('0x24')](function(){return _0x16439f;})[_0x42ed('0x24')](respondWithResult(_0x85bfad,null))['catch'](handleError(_0x85bfad,null));};exports['removeBlackLists']=function(_0x441bef,_0x391d62,_0x499064){return db['Campaign'][_0x42ed('0x49')]({'where':{'id':_0x441bef[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x391d62,null))[_0x42ed('0x24')](function(_0x2e0ae8){if(_0x2e0ae8){return _0x2e0ae8[_0x42ed('0x95')](_0x441bef[_0x42ed('0x33')][_0x42ed('0x69')]);}})['then'](function(_0x2189f6){if(_0x2189f6){return db['CmHopperBlack'][_0x42ed('0x26')]({'where':{'ListId':_0x441bef[_0x42ed('0x33')][_0x42ed('0x69')],'CampaignId':_0x441bef[_0x42ed('0x45')]['id']}})[_0x42ed('0x24')](function(){return _0x2189f6;});}})[_0x42ed('0x24')](respondWithStatusCode(_0x391d62,null))['catch'](handleError(_0x391d62,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 0480e38..9d45f38 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(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0x7a54,0x106));var _0x47a5=function(_0x2d5ea3,_0x471357){_0x2d5ea3=_0x2d5ea3-0x0;var _0x3ae67c=_0x7a54[_0x2d5ea3];return _0x3ae67c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4db141,_0x74de9b){var _0x4e8b56=function(_0x2dc06f){while(--_0x2dc06f){_0x4db141['push'](_0x4db141['shift']());}};_0x4e8b56(++_0x74de9b);}(_0x7a54,0x106));var _0x47a5=function(_0x2b4202,_0x3cfca9){_0x2b4202=_0x2b4202-0x0;var _0x1cdf02=_0x7a54[_0x2b4202];return _0x1cdf02;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index d3851c2..3056122 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 _0x8e94=['error','code','message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','attributes','limit','include','model','debug','lodash','util','bluebird','ioredis','../../config/utils','jayson/promise','client','request','then','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1d734a,_0xf7cfec){var _0x3eef41=function(_0x5a8d18){while(--_0x5a8d18){_0x1d734a['push'](_0x1d734a['shift']());}};_0x3eef41(++_0xf7cfec);}(_0x8e94,0xf8));var _0x48e9=function(_0x2d0b84,_0x34682d){_0x2d0b84=_0x2d0b84-0x0;var _0x8d0088=_0x8e94[_0x2d0b84];return _0x8d0088;};'use strict';var _=require(_0x48e9('0x0'));var util=require(_0x48e9('0x1'));var moment=require('moment');var BPromise=require(_0x48e9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48e9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x48e9('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x48e9('0x5'));var client=jayson[_0x48e9('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ac9d7,_0x58332f,_0x409f7b){return new BPromise(function(_0x50124c,_0x2e3df6){return client[_0x48e9('0x7')](_0x3ac9d7,_0x409f7b)[_0x48e9('0x8')](function(_0x371e53){logger['info'](_0x48e9('0x9'),_0x58332f,_0x48e9('0xa'));logger['debug'](_0x48e9('0xb'),_0x58332f,'request\x20sent',JSON[_0x48e9('0xc')](_0x371e53));if(_0x371e53[_0x48e9('0xd')]){if(_0x371e53[_0x48e9('0xd')][_0x48e9('0xe')]===0x1f4){logger[_0x48e9('0xd')](_0x48e9('0x9'),_0x58332f,_0x371e53['error'][_0x48e9('0xf')]);return _0x2e3df6(_0x371e53[_0x48e9('0xd')][_0x48e9('0xf')]);}logger['error'](_0x48e9('0x9'),_0x58332f,_0x371e53[_0x48e9('0xd')][_0x48e9('0xf')]);return _0x50124c(_0x371e53[_0x48e9('0xd')][_0x48e9('0xf')]);}else{logger[_0x48e9('0x10')](_0x48e9('0x9'),_0x58332f,_0x48e9('0xa'));_0x50124c(_0x371e53[_0x48e9('0x11')][_0x48e9('0xf')]);}})[_0x48e9('0x12')](function(_0x18135a){logger[_0x48e9('0xd')]('Campaign,\x20%s,\x20%s',_0x58332f,_0x18135a);_0x2e3df6(_0x18135a);});});}exports[_0x48e9('0x13')]=function(_0x421508){var _0x2c0c31=this;return new Promise(function(_0x51ab2d,_0xdb0db){return db[_0x48e9('0x14')][_0x48e9('0x15')]({'raw':_0x421508[_0x48e9('0x16')]?_0x421508[_0x48e9('0x16')][_0x48e9('0x17')]===undefined?!![]:![]:!![],'where':_0x421508[_0x48e9('0x16')]?_0x421508[_0x48e9('0x16')]['where']||null:null,'attributes':_0x421508[_0x48e9('0x16')]?_0x421508[_0x48e9('0x16')][_0x48e9('0x18')]||null:null,'limit':_0x421508['options']?_0x421508['options'][_0x48e9('0x19')]||null:null,'include':_0x421508[_0x48e9('0x16')]?_0x421508[_0x48e9('0x16')][_0x48e9('0x1a')]?_['map'](_0x421508[_0x48e9('0x16')][_0x48e9('0x1a')],function(_0x56f782){return{'model':db[_0x56f782[_0x48e9('0x1b')]],'as':_0x56f782['as'],'attributes':_0x56f782[_0x48e9('0x18')],'include':_0x56f782[_0x48e9('0x1a')]?_['map'](_0x56f782[_0x48e9('0x1a')],function(_0x361bff){return{'model':db[_0x361bff['model']],'as':_0x361bff['as'],'attributes':_0x361bff['attributes'],'include':_0x361bff['include']?_['map'](_0x361bff[_0x48e9('0x1a')],function(_0x1ac2e8){return{'model':db[_0x1ac2e8['model']],'as':_0x1ac2e8['as'],'attributes':_0x1ac2e8[_0x48e9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x48e9('0x8')](function(_0x4aa5f7){logger[_0x48e9('0x10')](_0x48e9('0x13'),_0x421508);logger[_0x48e9('0x1c')](_0x48e9('0x13'),_0x421508,JSON[_0x48e9('0xc')](_0x4aa5f7));_0x51ab2d(_0x4aa5f7);})['catch'](function(_0x64c551){logger[_0x48e9('0xd')]('GetCampaign',_0x64c551[_0x48e9('0xf')],_0x421508);_0xdb0db(_0x2c0c31[_0x48e9('0xd')](0x1f4,_0x64c551[_0x48e9('0xf')]));});});}; \ No newline at end of file +var _0xc874=['request\x20sent','debug','stringify','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Campaign,\x20%s,\x20%s'];(function(_0x3bc697,_0xad172c){var _0x129871=function(_0x17563f){while(--_0x17563f){_0x3bc697['push'](_0x3bc697['shift']());}};_0x129871(++_0xad172c);}(_0xc874,0x154));var _0x4c87=function(_0x2c27ed,_0x5c50f0){_0x2c27ed=_0x2c27ed-0x0;var _0x597bd1=_0xc874[_0x2c27ed];return _0x597bd1;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var moment=require(_0x4c87('0x1'));var BPromise=require(_0x4c87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c87('0x3'))['db'];var utils=require(_0x4c87('0x4'));var logger=require(_0x4c87('0x5'))('rpc');var config=require(_0x4c87('0x6'));var jayson=require(_0x4c87('0x7'));var client=jayson['client'][_0x4c87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dafe0,_0x30c939,_0xdc4a29){return new BPromise(function(_0x116649,_0x5b7720){return client[_0x4c87('0x9')](_0x3dafe0,_0xdc4a29)['then'](function(_0x384268){logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,_0x4c87('0xc'));logger[_0x4c87('0xd')]('Campaign,\x20%s,\x20%s,\x20%s',_0x30c939,_0x4c87('0xc'),JSON[_0x4c87('0xe')](_0x384268));if(_0x384268['error']){if(_0x384268[_0x4c87('0xf')][_0x4c87('0x10')]===0x1f4){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')]['message']);return _0x5b7720(_0x384268['error']['message']);}logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);return _0x116649(_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);}else{logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,'request\x20sent');_0x116649(_0x384268[_0x4c87('0x12')][_0x4c87('0x11')]);}})['catch'](function(_0x575de5){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x575de5);_0x5b7720(_0x575de5);});});}exports[_0x4c87('0x13')]=function(_0x547d92){var _0x428144=this;return new Promise(function(_0x561441,_0x9bc75f){return db[_0x4c87('0x14')][_0x4c87('0x15')]({'raw':_0x547d92[_0x4c87('0x16')]?_0x547d92['options'][_0x4c87('0x17')]===undefined?!![]:![]:!![],'where':_0x547d92[_0x4c87('0x16')]?_0x547d92[_0x4c87('0x16')][_0x4c87('0x18')]||null:null,'attributes':_0x547d92[_0x4c87('0x16')]?_0x547d92[_0x4c87('0x16')][_0x4c87('0x19')]||null:null,'limit':_0x547d92[_0x4c87('0x16')]?_0x547d92['options'][_0x4c87('0x1a')]||null:null,'include':_0x547d92[_0x4c87('0x16')]?_0x547d92['options'][_0x4c87('0x1b')]?_[_0x4c87('0x1c')](_0x547d92['options'][_0x4c87('0x1b')],function(_0x293754){return{'model':db[_0x293754[_0x4c87('0x1d')]],'as':_0x293754['as'],'attributes':_0x293754[_0x4c87('0x19')],'include':_0x293754['include']?_[_0x4c87('0x1c')](_0x293754[_0x4c87('0x1b')],function(_0x4525df){return{'model':db[_0x4525df[_0x4c87('0x1d')]],'as':_0x4525df['as'],'attributes':_0x4525df[_0x4c87('0x19')],'include':_0x4525df[_0x4c87('0x1b')]?_[_0x4c87('0x1c')](_0x4525df[_0x4c87('0x1b')],function(_0x4ca5fb){return{'model':db[_0x4ca5fb[_0x4c87('0x1d')]],'as':_0x4ca5fb['as'],'attributes':_0x4ca5fb['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c87('0x1e')](function(_0x381af7){logger[_0x4c87('0xa')](_0x4c87('0x13'),_0x547d92);logger[_0x4c87('0xd')](_0x4c87('0x13'),_0x547d92,JSON['stringify'](_0x381af7));_0x561441(_0x381af7);})[_0x4c87('0x1f')](function(_0x23483e){logger[_0x4c87('0xf')](_0x4c87('0x13'),_0x23483e[_0x4c87('0x11')],_0x547d92);_0x9bc75f(_0x428144[_0x4c87('0xf')](0x1f4,_0x23483e[_0x4c87('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index a7aa31f..ac59022 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 _0x931f=['/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','/:id','destroy','delete','removeLists','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black'];(function(_0x24581c,_0x48181f){var _0x5c8819=function(_0x193255){while(--_0x193255){_0x24581c['push'](_0x24581c['shift']());}};_0x5c8819(++_0x48181f);}(_0x931f,0x184));var _0xf931=function(_0x5e7514,_0x30c2e1){_0x5e7514=_0x5e7514-0x0;var _0x12f472=_0x931f[_0x5e7514];return _0x12f472;};'use strict';var multer=require(_0xf931('0x0'));var util=require(_0xf931('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf931('0x2'));var router=express['Router']();var fs_extra=require(_0xf931('0x3'));var auth=require(_0xf931('0x4'));var interaction=require(_0xf931('0x5'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0xf931('0x6')]('/',auth[_0xf931('0x7')](),controller[_0xf931('0x8')]);router['get']('/:id',auth[_0xf931('0x7')](),controller[_0xf931('0x9')]);router[_0xf931('0x6')]('/:id/hoppers',auth[_0xf931('0x7')](),controller[_0xf931('0xa')]);router['get'](_0xf931('0xb'),auth['isAuthenticated'](),controller[_0xf931('0xc')]);router[_0xf931('0x6')](_0xf931('0xd'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xf931('0x6')](_0xf931('0xe'),auth[_0xf931('0x7')](),controller['getHopperBlacks']);router[_0xf931('0x6')](_0xf931('0xf'),auth['isAuthenticated'](),controller[_0xf931('0x10')]);router[_0xf931('0x6')](_0xf931('0x11'),auth[_0xf931('0x7')](),controller[_0xf931('0x12')]);router[_0xf931('0x13')]('/',auth['isAuthenticated'](),controller[_0xf931('0x14')]);router[_0xf931('0x13')](_0xf931('0x15'),auth[_0xf931('0x7')](),controller[_0xf931('0x16')]);router['post']('/:id/lists',auth[_0xf931('0x7')](),controller[_0xf931('0x17')]);router[_0xf931('0x13')](_0xf931('0x11'),auth[_0xf931('0x7')](),controller[_0xf931('0x18')]);router[_0xf931('0x19')]('/:id',auth[_0xf931('0x7')](),controller['update']);router['delete'](_0xf931('0x1a'),auth[_0xf931('0x7')](),controller[_0xf931('0x1b')]);router[_0xf931('0x1c')](_0xf931('0xf'),auth[_0xf931('0x7')](),controller[_0xf931('0x1d')]);router['delete'](_0xf931('0x11'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xf931('0x1e')]=router; \ No newline at end of file +var _0x5640=['/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./campaign.controller','isAuthenticated','get','/:id','show'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5640,0x7f));var _0x0564=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5640[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x0564('0x0'));var util=require(_0x0564('0x1'));var path=require(_0x0564('0x2'));var timeout=require(_0x0564('0x3'));var express=require(_0x0564('0x4'));var router=express[_0x0564('0x5')]();var fs_extra=require(_0x0564('0x6'));var auth=require(_0x0564('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0564('0x8'));router['get']('/',auth[_0x0564('0x9')](),controller['index']);router[_0x0564('0xa')](_0x0564('0xb'),auth[_0x0564('0x9')](),controller[_0x0564('0xc')]);router[_0x0564('0xa')](_0x0564('0xd'),auth['isAuthenticated'](),controller[_0x0564('0xe')]);router[_0x0564('0xa')](_0x0564('0xf'),auth[_0x0564('0x9')](),controller[_0x0564('0x10')]);router['get'](_0x0564('0x11'),auth[_0x0564('0x9')](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x0564('0x12')]);router[_0x0564('0xa')](_0x0564('0x13'),auth[_0x0564('0x9')](),controller[_0x0564('0x14')]);router[_0x0564('0xa')]('/:id/blacklists',auth[_0x0564('0x9')](),controller[_0x0564('0x15')]);router[_0x0564('0x16')]('/',auth[_0x0564('0x9')](),controller[_0x0564('0x17')]);router['post'](_0x0564('0x18'),auth[_0x0564('0x9')](),controller[_0x0564('0x19')]);router[_0x0564('0x16')](_0x0564('0x13'),auth[_0x0564('0x9')](),controller[_0x0564('0x1a')]);router['post'](_0x0564('0x1b'),auth[_0x0564('0x9')](),controller['addBlackLists']);router[_0x0564('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x0564('0x1d')]);router[_0x0564('0x1e')](_0x0564('0xb'),auth[_0x0564('0x9')](),controller[_0x0564('0x1f')]);router['delete'](_0x0564('0x13'),auth[_0x0564('0x9')](),controller[_0x0564('0x20')]);router[_0x0564('0x1e')](_0x0564('0x1b'),auth['isAuthenticated'](),controller[_0x0564('0x21')]);module[_0x0564('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 0d25902..db1d627 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 _0x9fa6=['VIRTUAL','getDataValue','sequelize'];(function(_0x32ad42,_0x4c6948){var _0x672a14=function(_0x38950b){while(--_0x38950b){_0x32ad42['push'](_0x32ad42['shift']());}};_0x672a14(++_0x4c6948);}(_0x9fa6,0xc8));var _0x69fa=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x9fa6[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x69fa('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x69fa('0x1')],'get':function(){return this[_0x69fa('0x2')]('key');}}}; \ No newline at end of file +var _0xa3fc=['sequelize','exports','STRING','TEXT','medium','VIRTUAL','getDataValue'];(function(_0x1f9d6c,_0x27aba7){var _0x911504=function(_0x1c5353){while(--_0x1c5353){_0x1f9d6c['push'](_0x1f9d6c['shift']());}};_0x911504(++_0x27aba7);}(_0xa3fc,0x1b2));var _0xca3f=function(_0xfe2e05,_0x21d317){_0xfe2e05=_0xfe2e05-0x0;var _0x322f62=_0xa3fc[_0xfe2e05];return _0x322f62;};'use strict';var Sequelize=require(_0xca3f('0x0'));module[_0xca3f('0x1')]={'key':{'type':Sequelize[_0xca3f('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xca3f('0x3')],'length':_0xca3f('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xca3f('0x5')],'get':function(){return this[_0xca3f('0x6')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 1bc9083..7b408c2 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 _0x3922=['map','CannedAnswer','rawAttributes','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','options','find','body','params','destroy','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','get','CannedAnswers','UserProfileResource','stack','send','index'];(function(_0x5371af,_0x326c14){var _0x8c72c1=function(_0x3f6307){while(--_0x3f6307){_0x5371af['push'](_0x5371af['shift']());}};_0x8c72c1(++_0x326c14);}(_0x3922,0x86));var _0x2392=function(_0x3910f1,_0x421e2e){_0x3910f1=_0x3910f1-0x0;var _0xd06af4=_0x3922[_0x3910f1];return _0xd06af4;};'use strict';var emlformat=require(_0x2392('0x0'));var rimraf=require(_0x2392('0x1'));var zipdir=require(_0x2392('0x2'));var jsonpatch=require(_0x2392('0x3'));var rp=require('request-promise');var moment=require(_0x2392('0x4'));var BPromise=require(_0x2392('0x5'));var Mustache=require(_0x2392('0x6'));var util=require('util');var path=require(_0x2392('0x7'));var sox=require(_0x2392('0x8'));var csv=require(_0x2392('0x9'));var ejs=require(_0x2392('0xa'));var fs=require('fs');var fs_extra=require(_0x2392('0xb'));var _=require(_0x2392('0xc'));var squel=require(_0x2392('0xd'));var crypto=require(_0x2392('0xe'));var jsforce=require(_0x2392('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2392('0x10'));var Papa=require(_0x2392('0x11'));var Redis=require('ioredis');var authService=require(_0x2392('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2392('0x13'));var logger=require(_0x2392('0x14'))('api');var utils=require(_0x2392('0x15'));var config=require(_0x2392('0x16'));var licenseUtil=require(_0x2392('0x17'));var db=require(_0x2392('0x18'))['db'];function respondWithStatusCode(_0x5b5993,_0x5ba249){_0x5ba249=_0x5ba249||0xcc;return function(_0x51a6b1){if(_0x51a6b1){return _0x5b5993[_0x2392('0x19')](_0x5ba249);}return _0x5b5993[_0x2392('0x1a')](_0x5ba249)[_0x2392('0x1b')]();};}function respondWithResult(_0x5e3b35,_0x463e92){_0x463e92=_0x463e92||0xc8;return function(_0x20c8fc){if(_0x20c8fc){return _0x5e3b35[_0x2392('0x1a')](_0x463e92)[_0x2392('0x1c')](_0x20c8fc);}};}function respondWithFilteredResult(_0x3e98fe,_0x207f86){return function(_0x46e48f){if(_0x46e48f){var _0x42d41e=typeof _0x207f86[_0x2392('0x1d')]===_0x2392('0x1e')&&typeof _0x207f86['limit']===_0x2392('0x1e');var _0x562aed=_0x46e48f[_0x2392('0x1f')];var _0xd660c7=_0x42d41e?0x0:_0x207f86[_0x2392('0x1d')];var _0x1f7328=_0x42d41e?_0x46e48f[_0x2392('0x1f')]:_0x207f86[_0x2392('0x1d')]+_0x207f86['limit'];var _0x17591f;if(_0x1f7328>=_0x562aed){_0x1f7328=_0x562aed;_0x17591f=0xc8;}else{_0x17591f=0xce;}_0x3e98fe[_0x2392('0x1a')](_0x17591f);return _0x3e98fe[_0x2392('0x20')](_0x2392('0x21'),_0xd660c7+'-'+_0x1f7328+'/'+_0x562aed)['json'](_0x46e48f);}return null;};}function patchUpdates(_0x3b7305){return function(_0x3ed631){try{jsonpatch[_0x2392('0x22')](_0x3ed631,_0x3b7305,!![]);}catch(_0x347491){return BPromise[_0x2392('0x23')](_0x347491);}return _0x3ed631['save']();};}function saveUpdates(_0x363869,_0x1089f4){return function(_0xd9daad){if(_0xd9daad){return _0xd9daad[_0x2392('0x24')](_0x363869)[_0x2392('0x25')](function(_0x26ab51){return _0x26ab51;});}return null;};}function removeEntity(_0x251466,_0x2bc312){return function(_0x43ade4){if(_0x43ade4){return _0x43ade4['destroy']()[_0x2392('0x25')](function(){var _0x2d27d6=_0x43ade4[_0x2392('0x26')]({'plain':!![]});var _0x122735=_0x2392('0x27');return db[_0x2392('0x28')]['destroy']({'where':{'type':_0x122735,'resourceId':_0x2d27d6['id']}})[_0x2392('0x25')](function(){return _0x43ade4;});})[_0x2392('0x25')](function(){_0x251466[_0x2392('0x1a')](0xcc)[_0x2392('0x1b')]();});}};}function handleEntityNotFound(_0x198704,_0x16b6fc){return function(_0x2a0f78){if(!_0x2a0f78){_0x198704[_0x2392('0x19')](0x194);}return _0x2a0f78;};}function handleError(_0x4e5836,_0x390049){_0x390049=_0x390049||0x1f4;return function(_0x368cec){logger['error'](_0x368cec[_0x2392('0x29')]);if(_0x368cec['name']){delete _0x368cec['name'];}_0x4e5836[_0x2392('0x1a')](_0x390049)[_0x2392('0x2a')](_0x368cec);};}exports[_0x2392('0x2b')]=function(_0x374928,_0x46f4e8){var _0x31aabb={},_0x109adf={},_0x1638c3={'count':0x0,'rows':[]};var _0x497f2a=_[_0x2392('0x2c')](db[_0x2392('0x2d')][_0x2392('0x2e')],function(_0x537777){return{'name':_0x537777['fieldName'],'type':_0x537777[_0x2392('0x2f')]['key']};});_0x109adf[_0x2392('0x30')]=_['map'](_0x497f2a,_0x2392('0x31'));_0x109adf[_0x2392('0x32')]=_[_0x2392('0x33')](_0x374928[_0x2392('0x32')]);_0x109adf[_0x2392('0x34')]=_[_0x2392('0x35')](_0x109adf[_0x2392('0x30')],_0x109adf[_0x2392('0x32')]);_0x31aabb['attributes']=_[_0x2392('0x35')](_0x109adf[_0x2392('0x30')],qs[_0x2392('0x36')](_0x374928[_0x2392('0x32')]['fields']));_0x31aabb[_0x2392('0x37')]=_0x31aabb[_0x2392('0x37')][_0x2392('0x38')]?_0x31aabb['attributes']:_0x109adf[_0x2392('0x30')];if(!_0x374928[_0x2392('0x32')][_0x2392('0x39')]('nolimit')){_0x31aabb['limit']=qs[_0x2392('0x3a')](_0x374928[_0x2392('0x32')][_0x2392('0x3a')]);_0x31aabb[_0x2392('0x1d')]=qs[_0x2392('0x1d')](_0x374928[_0x2392('0x32')][_0x2392('0x1d')]);}_0x31aabb[_0x2392('0x3b')]=qs[_0x2392('0x3c')](_0x374928[_0x2392('0x32')][_0x2392('0x3c')]);_0x31aabb[_0x2392('0x3d')]=qs['filters'](_[_0x2392('0x3e')](_0x374928[_0x2392('0x32')],_0x109adf[_0x2392('0x34')]),_0x497f2a);if(_0x374928[_0x2392('0x32')][_0x2392('0x3f')]){_0x31aabb[_0x2392('0x3d')]=_[_0x2392('0x40')](_0x31aabb[_0x2392('0x3d')],{'$or':[{'key':{'$like':'%'+_0x374928[_0x2392('0x32')][_0x2392('0x3f')]+'%'}},{'value':{'$like':'%'+_0x374928[_0x2392('0x32')][_0x2392('0x3f')]+'%'}}]});}_0x31aabb=_[_0x2392('0x40')]({},_0x31aabb,_0x374928['options']);var _0x5109eb={'where':_0x31aabb[_0x2392('0x3d')]};return db[_0x2392('0x2d')][_0x2392('0x1f')](_0x5109eb)['then'](function(_0x524a38){_0x1638c3[_0x2392('0x1f')]=_0x524a38;if(_0x374928[_0x2392('0x32')][_0x2392('0x41')]){_0x31aabb[_0x2392('0x42')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x31aabb);})[_0x2392('0x25')](function(_0x5e8b50){_0x1638c3[_0x2392('0x43')]=_0x5e8b50;return _0x1638c3;})['then'](respondWithFilteredResult(_0x46f4e8,_0x31aabb))[_0x2392('0x44')](handleError(_0x46f4e8,null));};exports[_0x2392('0x45')]=function(_0x59fd82,_0x4ea8ac){var _0x4e7ed4={'raw':!![],'where':{'id':_0x59fd82['params']['id']}},_0x12e147={};_0x12e147[_0x2392('0x30')]=_[_0x2392('0x33')](db['CannedAnswer'][_0x2392('0x2e')]);_0x12e147[_0x2392('0x32')]=_[_0x2392('0x33')](_0x59fd82[_0x2392('0x32')]);_0x12e147[_0x2392('0x34')]=_['intersection'](_0x12e147['model'],_0x12e147[_0x2392('0x32')]);_0x4e7ed4[_0x2392('0x37')]=_[_0x2392('0x35')](_0x12e147[_0x2392('0x30')],qs[_0x2392('0x36')](_0x59fd82[_0x2392('0x32')][_0x2392('0x36')]));_0x4e7ed4[_0x2392('0x37')]=_0x4e7ed4[_0x2392('0x37')][_0x2392('0x38')]?_0x4e7ed4[_0x2392('0x37')]:_0x12e147[_0x2392('0x30')];if(_0x59fd82[_0x2392('0x32')]['includeAll']){_0x4e7ed4[_0x2392('0x42')]=[{'all':!![]}];}_0x4e7ed4=_[_0x2392('0x40')]({},_0x4e7ed4,_0x59fd82[_0x2392('0x46')]);return db[_0x2392('0x2d')][_0x2392('0x47')](_0x4e7ed4)[_0x2392('0x25')](handleEntityNotFound(_0x4ea8ac,null))[_0x2392('0x25')](respondWithResult(_0x4ea8ac,null))[_0x2392('0x44')](handleError(_0x4ea8ac,null));};exports[_0x2392('0x24')]=function(_0x2a1013,_0x459936){if(_0x2a1013[_0x2392('0x48')]['id']){delete _0x2a1013[_0x2392('0x48')]['id'];}return db[_0x2392('0x2d')]['find']({'where':{'id':_0x2a1013[_0x2392('0x49')]['id']}})['then'](handleEntityNotFound(_0x459936,null))['then'](saveUpdates(_0x2a1013[_0x2392('0x48')],null))[_0x2392('0x25')](respondWithResult(_0x459936,null))[_0x2392('0x44')](handleError(_0x459936,null));};exports[_0x2392('0x4a')]=function(_0x5c2b2f,_0x3feb77){return db['CannedAnswer'][_0x2392('0x47')]({'where':{'id':_0x5c2b2f[_0x2392('0x49')]['id']}})[_0x2392('0x25')](handleEntityNotFound(_0x3feb77,null))[_0x2392('0x25')](removeEntity(_0x3feb77,null))['catch'](handleError(_0x3feb77,null));};exports[_0x2392('0x4b')]=function(_0x16e80f,_0x2b24d6){var _0x4a8871={'key':_0x16e80f[_0x2392('0x48')][_0x2392('0x4c')]};if(_0x16e80f['body'][_0x2392('0x4d')]){_0x4a8871[_0x2392('0x4d')]=_0x16e80f[_0x2392('0x48')][_0x2392('0x4d')];}else if(_0x16e80f[_0x2392('0x48')][_0x2392('0x4e')]){_0x4a8871[_0x2392('0x4e')]=_0x16e80f[_0x2392('0x48')][_0x2392('0x4e')];}else if(_0x16e80f[_0x2392('0x48')][_0x2392('0x4f')]){_0x4a8871[_0x2392('0x4f')]=_0x16e80f[_0x2392('0x48')][_0x2392('0x4f')];}else if(_0x16e80f[_0x2392('0x48')][_0x2392('0x50')]){_0x4a8871[_0x2392('0x50')]=_0x16e80f['body'][_0x2392('0x50')];}return db[_0x2392('0x2d')][_0x2392('0x47')]({'where':_0x4a8871})['then'](function(_0x58117b){if(_0x58117b){throw new db['Sequelize'][(_0x2392('0x51'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x2392('0x2d')][_0x2392('0x4b')](_0x16e80f[_0x2392('0x48')]);})[_0x2392('0x25')](function(_0x4f3c23){var _0x27c20d=_0x16e80f[_0x2392('0x52')][_0x2392('0x26')]({'plain':!![]});if(!_0x27c20d)throw new Error(_0x2392('0x53'));if(_0x27c20d[_0x2392('0x54')]==='user'){var _0x367db5=_0x4f3c23[_0x2392('0x26')]({'plain':!![]});return db[_0x2392('0x55')][_0x2392('0x47')]({'where':{'name':_0x2392('0x27'),'userProfileId':_0x27c20d[_0x2392('0x56')]},'raw':!![]})[_0x2392('0x25')](function(_0x14dbf0){if(_0x14dbf0&&_0x14dbf0[_0x2392('0x57')]===0x0){return db[_0x2392('0x28')][_0x2392('0x4b')]({'name':_0x367db5[_0x2392('0x31')],'resourceId':_0x367db5['id'],'type':_0x14dbf0[_0x2392('0x31')],'sectionId':_0x14dbf0['id']},{})[_0x2392('0x25')](function(){return _0x4f3c23;});}else{return _0x4f3c23;}})[_0x2392('0x44')](function(_0x5a8611){logger[_0x2392('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a8611);throw _0x5a8611;});}return _0x4f3c23;})[_0x2392('0x25')](respondWithResult(_0x2b24d6,0xc9))[_0x2392('0x44')](handleError(_0x2b24d6,null));}; \ No newline at end of file +var _0x2509=['util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','stack','name','send','map','CannedAnswer','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','rows','catch','params','length','options','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0x283023,_0x3cf4dc){var _0x1a1e78=function(_0x267af3){while(--_0x267af3){_0x283023['push'](_0x283023['shift']());}};_0x1a1e78(++_0x3cf4dc);}(_0x2509,0xa8));var _0x9250=function(_0x497e9e,_0x36e053){_0x497e9e=_0x497e9e-0x0;var _0x2aaf55=_0x2509[_0x497e9e];return _0x2aaf55;};'use strict';var emlformat=require(_0x9250('0x0'));var rimraf=require(_0x9250('0x1'));var zipdir=require(_0x9250('0x2'));var jsonpatch=require(_0x9250('0x3'));var rp=require(_0x9250('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9250('0x5'));var util=require(_0x9250('0x6'));var path=require(_0x9250('0x7'));var sox=require(_0x9250('0x8'));var csv=require(_0x9250('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9250('0xa'));var _=require(_0x9250('0xb'));var squel=require(_0x9250('0xc'));var crypto=require(_0x9250('0xd'));var jsforce=require(_0x9250('0xe'));var deskjs=require(_0x9250('0xf'));var toCsv=require(_0x9250('0x9'));var querystring=require('querystring');var Papa=require(_0x9250('0x10'));var Redis=require(_0x9250('0x11'));var authService=require(_0x9250('0x12'));var qs=require(_0x9250('0x13'));var as=require(_0x9250('0x14'));var hardwareService=require(_0x9250('0x15'));var logger=require('../../config/logger')(_0x9250('0x16'));var utils=require('../../config/utils');var config=require(_0x9250('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9250('0x18'))['db'];function respondWithStatusCode(_0xf6ed3e,_0x283b7a){_0x283b7a=_0x283b7a||0xcc;return function(_0x4f0002){if(_0x4f0002){return _0xf6ed3e[_0x9250('0x19')](_0x283b7a);}return _0xf6ed3e['status'](_0x283b7a)['end']();};}function respondWithResult(_0x279607,_0x2084b0){_0x2084b0=_0x2084b0||0xc8;return function(_0x446520){if(_0x446520){return _0x279607[_0x9250('0x1a')](_0x2084b0)[_0x9250('0x1b')](_0x446520);}};}function respondWithFilteredResult(_0xad4788,_0x217a0a){return function(_0xf76576){if(_0xf76576){var _0x176f0e=typeof _0x217a0a['offset']===_0x9250('0x1c')&&typeof _0x217a0a['limit']===_0x9250('0x1c');var _0xb33677=_0xf76576['count'];var _0x3415a5=_0x176f0e?0x0:_0x217a0a[_0x9250('0x1d')];var _0x4acf86=_0x176f0e?_0xf76576[_0x9250('0x1e')]:_0x217a0a[_0x9250('0x1d')]+_0x217a0a[_0x9250('0x1f')];var _0x1bef41;if(_0x4acf86>=_0xb33677){_0x4acf86=_0xb33677;_0x1bef41=0xc8;}else{_0x1bef41=0xce;}_0xad4788[_0x9250('0x1a')](_0x1bef41);return _0xad4788[_0x9250('0x20')](_0x9250('0x21'),_0x3415a5+'-'+_0x4acf86+'/'+_0xb33677)[_0x9250('0x1b')](_0xf76576);}return null;};}function patchUpdates(_0x19a35f){return function(_0x32efa7){try{jsonpatch[_0x9250('0x22')](_0x32efa7,_0x19a35f,!![]);}catch(_0x2f05c1){return BPromise[_0x9250('0x23')](_0x2f05c1);}return _0x32efa7['save']();};}function saveUpdates(_0x3ff395,_0x4d93a4){return function(_0x32c339){if(_0x32c339){return _0x32c339[_0x9250('0x24')](_0x3ff395)[_0x9250('0x25')](function(_0x2f9805){return _0x2f9805;});}return null;};}function removeEntity(_0x5b21ee,_0xd62324){return function(_0x3e3d90){if(_0x3e3d90){return _0x3e3d90[_0x9250('0x26')]()[_0x9250('0x25')](function(){var _0x1f4c83=_0x3e3d90[_0x9250('0x27')]({'plain':!![]});var _0x403d6f=_0x9250('0x28');return db[_0x9250('0x29')][_0x9250('0x26')]({'where':{'type':_0x403d6f,'resourceId':_0x1f4c83['id']}})[_0x9250('0x25')](function(){return _0x3e3d90;});})[_0x9250('0x25')](function(){_0x5b21ee['status'](0xcc)[_0x9250('0x2a')]();});}};}function handleEntityNotFound(_0x28ccfd,_0x4fd07){return function(_0x413280){if(!_0x413280){_0x28ccfd['sendStatus'](0x194);}return _0x413280;};}function handleError(_0x55e97b,_0x44d094){_0x44d094=_0x44d094||0x1f4;return function(_0x50aa8b){logger[_0x9250('0x2b')](_0x50aa8b[_0x9250('0x2c')]);if(_0x50aa8b['name']){delete _0x50aa8b[_0x9250('0x2d')];}_0x55e97b[_0x9250('0x1a')](_0x44d094)[_0x9250('0x2e')](_0x50aa8b);};}exports['index']=function(_0x2cd131,_0x453b10){var _0x53b1c3={},_0x1b8892={},_0x4dc64f={'count':0x0,'rows':[]};var _0x394dce=_[_0x9250('0x2f')](db[_0x9250('0x30')][_0x9250('0x31')],function(_0x10fb2c){return{'name':_0x10fb2c['fieldName'],'type':_0x10fb2c[_0x9250('0x32')][_0x9250('0x33')]};});_0x1b8892[_0x9250('0x34')]=_[_0x9250('0x2f')](_0x394dce,_0x9250('0x2d'));_0x1b8892[_0x9250('0x35')]=_[_0x9250('0x36')](_0x2cd131[_0x9250('0x35')]);_0x1b8892[_0x9250('0x37')]=_[_0x9250('0x38')](_0x1b8892[_0x9250('0x34')],_0x1b8892[_0x9250('0x35')]);_0x53b1c3[_0x9250('0x39')]=_['intersection'](_0x1b8892[_0x9250('0x34')],qs[_0x9250('0x3a')](_0x2cd131['query']['fields']));_0x53b1c3[_0x9250('0x39')]=_0x53b1c3[_0x9250('0x39')]['length']?_0x53b1c3[_0x9250('0x39')]:_0x1b8892[_0x9250('0x34')];if(!_0x2cd131[_0x9250('0x35')][_0x9250('0x3b')]('nolimit')){_0x53b1c3[_0x9250('0x1f')]=qs['limit'](_0x2cd131[_0x9250('0x35')][_0x9250('0x1f')]);_0x53b1c3[_0x9250('0x1d')]=qs[_0x9250('0x1d')](_0x2cd131['query'][_0x9250('0x1d')]);}_0x53b1c3[_0x9250('0x3c')]=qs[_0x9250('0x3d')](_0x2cd131[_0x9250('0x35')][_0x9250('0x3d')]);_0x53b1c3[_0x9250('0x3e')]=qs[_0x9250('0x37')](_[_0x9250('0x3f')](_0x2cd131[_0x9250('0x35')],_0x1b8892['filters']),_0x394dce);if(_0x2cd131['query']['filter']){_0x53b1c3['where']=_['merge'](_0x53b1c3[_0x9250('0x3e')],{'$or':[{'key':{'$like':'%'+_0x2cd131[_0x9250('0x35')][_0x9250('0x40')]+'%'}},{'value':{'$like':'%'+_0x2cd131[_0x9250('0x35')]['filter']+'%'}}]});}_0x53b1c3=_[_0x9250('0x41')]({},_0x53b1c3,_0x2cd131['options']);var _0x24fbff={'where':_0x53b1c3[_0x9250('0x3e')]};return db[_0x9250('0x30')][_0x9250('0x1e')](_0x24fbff)[_0x9250('0x25')](function(_0x7f6c5d){_0x4dc64f[_0x9250('0x1e')]=_0x7f6c5d;if(_0x2cd131[_0x9250('0x35')][_0x9250('0x42')]){_0x53b1c3['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x53b1c3);})[_0x9250('0x25')](function(_0x23839d){_0x4dc64f[_0x9250('0x43')]=_0x23839d;return _0x4dc64f;})[_0x9250('0x25')](respondWithFilteredResult(_0x453b10,_0x53b1c3))[_0x9250('0x44')](handleError(_0x453b10,null));};exports['show']=function(_0x4d8e56,_0x35b123){var _0x1997e8={'raw':!![],'where':{'id':_0x4d8e56[_0x9250('0x45')]['id']}},_0x5c8493={};_0x5c8493['model']=_[_0x9250('0x36')](db[_0x9250('0x30')][_0x9250('0x31')]);_0x5c8493[_0x9250('0x35')]=_[_0x9250('0x36')](_0x4d8e56[_0x9250('0x35')]);_0x5c8493[_0x9250('0x37')]=_[_0x9250('0x38')](_0x5c8493[_0x9250('0x34')],_0x5c8493[_0x9250('0x35')]);_0x1997e8[_0x9250('0x39')]=_[_0x9250('0x38')](_0x5c8493[_0x9250('0x34')],qs[_0x9250('0x3a')](_0x4d8e56[_0x9250('0x35')][_0x9250('0x3a')]));_0x1997e8[_0x9250('0x39')]=_0x1997e8[_0x9250('0x39')][_0x9250('0x46')]?_0x1997e8[_0x9250('0x39')]:_0x5c8493[_0x9250('0x34')];if(_0x4d8e56['query'][_0x9250('0x42')]){_0x1997e8['include']=[{'all':!![]}];}_0x1997e8=_['merge']({},_0x1997e8,_0x4d8e56[_0x9250('0x47')]);return db[_0x9250('0x30')][_0x9250('0x48')](_0x1997e8)[_0x9250('0x25')](handleEntityNotFound(_0x35b123,null))[_0x9250('0x25')](respondWithResult(_0x35b123,null))[_0x9250('0x44')](handleError(_0x35b123,null));};exports[_0x9250('0x24')]=function(_0x315895,_0x2b3a0){if(_0x315895[_0x9250('0x49')]['id']){delete _0x315895[_0x9250('0x49')]['id'];}return db[_0x9250('0x30')]['find']({'where':{'id':_0x315895['params']['id']}})[_0x9250('0x25')](handleEntityNotFound(_0x2b3a0,null))[_0x9250('0x25')](saveUpdates(_0x315895[_0x9250('0x49')],null))['then'](respondWithResult(_0x2b3a0,null))[_0x9250('0x44')](handleError(_0x2b3a0,null));};exports[_0x9250('0x26')]=function(_0xc87e95,_0x3455aa){return db[_0x9250('0x30')][_0x9250('0x48')]({'where':{'id':_0xc87e95['params']['id']}})['then'](handleEntityNotFound(_0x3455aa,null))[_0x9250('0x25')](removeEntity(_0x3455aa,null))[_0x9250('0x44')](handleError(_0x3455aa,null));};exports['create']=function(_0x527a7b,_0x554ae9){var _0x16f5cc={'key':_0x527a7b[_0x9250('0x49')]['key']};if(_0x527a7b[_0x9250('0x49')][_0x9250('0x4a')]){_0x16f5cc[_0x9250('0x4a')]=_0x527a7b[_0x9250('0x49')]['MailAccountId'];}else if(_0x527a7b[_0x9250('0x49')][_0x9250('0x4b')]){_0x16f5cc[_0x9250('0x4b')]=_0x527a7b[_0x9250('0x49')][_0x9250('0x4b')];}else if(_0x527a7b[_0x9250('0x49')]['OpenchannelAccountId']){_0x16f5cc['OpenchannelAccountId']=_0x527a7b['body'][_0x9250('0x4c')];}else if(_0x527a7b['body']['ChatWebsiteId']){_0x16f5cc['ChatWebsiteId']=_0x527a7b['body'][_0x9250('0x4d')];}return db[_0x9250('0x30')][_0x9250('0x48')]({'where':_0x16f5cc})[_0x9250('0x25')](function(_0x343c61){if(_0x343c61){throw new db[(_0x9250('0x4e'))][(_0x9250('0x4f'))](_0x9250('0x50'));}return db[_0x9250('0x30')][_0x9250('0x51')](_0x527a7b['body']);})['then'](function(_0xcb5755){var _0x8224db=_0x527a7b[_0x9250('0x52')][_0x9250('0x27')]({'plain':!![]});if(!_0x8224db)throw new Error(_0x9250('0x53'));if(_0x8224db['role']===_0x9250('0x52')){var _0x51a8d4=_0xcb5755[_0x9250('0x27')]({'plain':!![]});return db[_0x9250('0x54')][_0x9250('0x48')]({'where':{'name':_0x9250('0x28'),'userProfileId':_0x8224db[_0x9250('0x55')]},'raw':!![]})[_0x9250('0x25')](function(_0xcbb50d){if(_0xcbb50d&&_0xcbb50d[_0x9250('0x56')]===0x0){return db[_0x9250('0x29')][_0x9250('0x51')]({'name':_0x51a8d4[_0x9250('0x2d')],'resourceId':_0x51a8d4['id'],'type':_0xcbb50d[_0x9250('0x2d')],'sectionId':_0xcbb50d['id']},{})['then'](function(){return _0xcb5755;});}else{return _0xcb5755;}})['catch'](function(_0x7b9ab0){logger[_0x9250('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7b9ab0);throw _0x7b9ab0;});}return _0xcb5755;})[_0x9250('0x25')](respondWithResult(_0x554ae9,0xc9))[_0x9250('0x44')](handleError(_0x554ae9,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index bba437b..43a8cbd 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 _0x78bb=['utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x242a4f,_0x369c57){var _0x122117=function(_0x55a797){while(--_0x55a797){_0x242a4f['push'](_0x242a4f['shift']());}};_0x122117(++_0x369c57);}(_0x78bb,0x151));var _0xb78b=function(_0xf4129c,_0x44fcf1){_0xf4129c=_0xf4129c-0x0;var _0x426611=_0x78bb[_0xf4129c];return _0x426611;};'use strict';var _=require('lodash');var util=require(_0xb78b('0x0'));var logger=require(_0xb78b('0x1'))('api');var moment=require(_0xb78b('0x2'));var BPromise=require(_0xb78b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb78b('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb78b('0x5'));module[_0xb78b('0x6')]=function(_0x3629b4,_0x384fa7){return _0x3629b4[_0xb78b('0x7')](_0xb78b('0x8'),attributes,{'tableName':_0xb78b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb78b('0xa'),'collate':_0xb78b('0xb')});}; \ No newline at end of file +var _0x7c87=['api','moment','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1c1081,_0x3a900c){var _0x5d9010=function(_0x515a3c){while(--_0x515a3c){_0x1c1081['push'](_0x1c1081['shift']());}};_0x5d9010(++_0x3a900c);}(_0x7c87,0x1a1));var _0x77c8=function(_0x568699,_0x2257be){_0x568699=_0x568699-0x0;var _0x28ed4f=_0x7c87[_0x568699];return _0x28ed4f;};'use strict';var _=require(_0x77c8('0x0'));var util=require(_0x77c8('0x1'));var logger=require(_0x77c8('0x2'))(_0x77c8('0x3'));var moment=require(_0x77c8('0x4'));var BPromise=require('bluebird');var rp=require(_0x77c8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77c8('0x6'));var config=require(_0x77c8('0x7'));var attributes=require(_0x77c8('0x8'));module[_0x77c8('0x9')]=function(_0x51635f,_0x128c99){return _0x51635f[_0x77c8('0xa')](_0x77c8('0xb'),attributes,{'tableName':_0x77c8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x77c8('0xd'),'collate':_0x77c8('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index ad51ab0..7904b91 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(_0x1cc956,_0x13085d){var _0x18a12d=function(_0x2f796c){while(--_0x2f796c){_0x1cc956['push'](_0x1cc956['shift']());}};_0x18a12d(++_0x13085d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0xa0cb1b,_0x7c0fa6){var _0xd0667b=function(_0x5b09c0){while(--_0x5b09c0){_0xa0cb1b['push'](_0xa0cb1b['shift']());}};_0xd0667b(++_0x7c0fa6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 37344eb..caf589a 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 _0xc682=['update','/:id','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','post','put'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0xc682,0x1c2));var _0x2c68=function(_0x5602a6,_0x58887c){_0x5602a6=_0x5602a6-0x0;var _0x364953=_0xc682[_0x5602a6];return _0x364953;};'use strict';var multer=require(_0x2c68('0x0'));var util=require('util');var path=require(_0x2c68('0x1'));var timeout=require(_0x2c68('0x2'));var express=require(_0x2c68('0x3'));var router=express[_0x2c68('0x4')]();var fs_extra=require(_0x2c68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2c68('0x6'));var config=require('../../config/environment');var controller=require(_0x2c68('0x7'));router[_0x2c68('0x8')]('/',auth[_0x2c68('0x9')](),controller['index']);router[_0x2c68('0x8')]('/:id',auth[_0x2c68('0x9')](),controller['show']);router[_0x2c68('0xa')]('/',auth[_0x2c68('0x9')](),controller['create']);router[_0x2c68('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x2c68('0xc')]);router['delete'](_0x2c68('0xd'),auth[_0x2c68('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x84bb=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','post','put','update','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0x364d12,_0x2c31cc){var _0x521308=function(_0x409da9){while(--_0x409da9){_0x364d12['push'](_0x364d12['shift']());}};_0x521308(++_0x2c31cc);}(_0x84bb,0x1d7));var _0xb84b=function(_0xfcc030,_0x3ec053){_0xfcc030=_0xfcc030-0x0;var _0x5caa66=_0x84bb[_0xfcc030];return _0x5caa66;};'use strict';var multer=require('multer');var util=require(_0xb84b('0x0'));var path=require(_0xb84b('0x1'));var timeout=require(_0xb84b('0x2'));var express=require(_0xb84b('0x3'));var router=express[_0xb84b('0x4')]();var fs_extra=require(_0xb84b('0x5'));var auth=require(_0xb84b('0x6'));var interaction=require(_0xb84b('0x7'));var config=require(_0xb84b('0x8'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xb84b('0x9')](),controller[_0xb84b('0xa')]);router['get'](_0xb84b('0xb'),auth[_0xb84b('0x9')](),controller['show']);router[_0xb84b('0xc')]('/',auth[_0xb84b('0x9')](),controller['create']);router[_0xb84b('0xd')]('/:id',auth[_0xb84b('0x9')](),controller[_0xb84b('0xe')]);router[_0xb84b('0xf')](_0xb84b('0xb'),auth[_0xb84b('0x9')](),controller[_0xb84b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index eb31dc7..f074cfc 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 _0x586b=['1970-01-01\x2000:00:01','STRING','INTEGER','DATE'];(function(_0x352cbf,_0x4ad1eb){var _0xa95b9d=function(_0x23701e){while(--_0x23701e){_0x352cbf['push'](_0x352cbf['shift']());}};_0xa95b9d(++_0x4ad1eb);}(_0x586b,0x1bb));var _0xb586=function(_0x16500d,_0x2cd475){_0x16500d=_0x16500d-0x0;var _0x5b5c68=_0x586b[_0x16500d];return _0x5b5c68;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0xb586('0x0')],'allowNull':![],'defaultValue':_0xb586('0x1')},'clid':{'type':Sequelize[_0xb586('0x2')]},'src':{'type':Sequelize[_0xb586('0x2')]},'dst':{'type':Sequelize[_0xb586('0x2')]},'dcontext':{'type':Sequelize[_0xb586('0x2')]},'channel':{'type':Sequelize[_0xb586('0x2')]},'dstchannel':{'type':Sequelize[_0xb586('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xb586('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xb586('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb586('0x2')]},'amaflags':{'type':Sequelize[_0xb586('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb586('0x2')]},'userfield':{'type':Sequelize[_0xb586('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xb586('0x2')]},'sequence':{'type':Sequelize[_0xb586('0x2')]},'peeraccount':{'type':Sequelize[_0xb586('0x2')]},'type':{'type':Sequelize[_0xb586('0x2')]},'tag':{'type':Sequelize[_0xb586('0x2')]}}; \ No newline at end of file +var _0x8482=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8482,0x14e));var _0x2848=function(_0x32a3bc,_0x1db8c6){_0x32a3bc=_0x32a3bc-0x0;var _0xbb43d=_0x8482[_0x32a3bc];return _0xbb43d;};'use strict';var Sequelize=require('sequelize');module[_0x2848('0x0')]={'calldate':{'type':Sequelize[_0x2848('0x1')],'allowNull':![],'defaultValue':_0x2848('0x2')},'clid':{'type':Sequelize[_0x2848('0x3')]},'src':{'type':Sequelize[_0x2848('0x3')]},'dst':{'type':Sequelize[_0x2848('0x3')]},'dcontext':{'type':Sequelize[_0x2848('0x3')]},'channel':{'type':Sequelize[_0x2848('0x3')]},'dstchannel':{'type':Sequelize[_0x2848('0x3')]},'lastapp':{'type':Sequelize[_0x2848('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x2848('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2848('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x2848('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2848('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x2848('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index df3fe2d..c009537 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 _0xf494=['create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','Cdr','includeAll','include','findAll','rows','catch','length','find'];(function(_0x14d915,_0x1bc0f3){var _0x79545=function(_0x331b0b){while(--_0x331b0b){_0x14d915['push'](_0x14d915['shift']());}};_0x79545(++_0x1bc0f3);}(_0xf494,0x1c6));var _0x4f49=function(_0x27cfb1,_0x416566){_0x27cfb1=_0x27cfb1-0x0;var _0xa5d5e7=_0xf494[_0x27cfb1];return _0xa5d5e7;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];function respondWithStatusCode(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xcc;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0x19')](_0x4bf89f);}return _0x12527d[_0x4f49('0x1a')](_0x4bf89f)[_0x4f49('0x1b')]();};}function respondWithResult(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0xc8;return function(_0xfdb477){if(_0xfdb477){return _0x1a0f1e['status'](_0x2f0131)[_0x4f49('0x1c')](_0xfdb477);}};}function respondWithFilteredResult(_0x1f2d0d,_0x415e83){return function(_0x5878f4){if(_0x5878f4){var _0x5bdfaf=typeof _0x415e83[_0x4f49('0x1d')]===_0x4f49('0x1e')&&typeof _0x415e83[_0x4f49('0x1f')]==='undefined';var _0x1dccfd=_0x5878f4[_0x4f49('0x20')];var _0x4e85df=_0x5bdfaf?0x0:_0x415e83['offset'];var _0x5bb23b=_0x5bdfaf?_0x5878f4['count']:_0x415e83['offset']+_0x415e83[_0x4f49('0x1f')];var _0x1834f4;if(_0x5bb23b>=_0x1dccfd){_0x5bb23b=_0x1dccfd;_0x1834f4=0xc8;}else{_0x1834f4=0xce;}_0x1f2d0d[_0x4f49('0x1a')](_0x1834f4);return _0x1f2d0d[_0x4f49('0x21')]('Content-Range',_0x4e85df+'-'+_0x5bb23b+'/'+_0x1dccfd)[_0x4f49('0x1c')](_0x5878f4);}return null;};}function patchUpdates(_0x2aed27){return function(_0x197a49){try{jsonpatch[_0x4f49('0x22')](_0x197a49,_0x2aed27,!![]);}catch(_0xea82f8){return BPromise['reject'](_0xea82f8);}return _0x197a49[_0x4f49('0x23')]();};}function saveUpdates(_0x357446,_0x3ae590){return function(_0x53b57d){if(_0x53b57d){return _0x53b57d[_0x4f49('0x24')](_0x357446)[_0x4f49('0x25')](function(_0x32ca7b){return _0x32ca7b;});}return null;};}function removeEntity(_0x43c458,_0x9d30aa){return function(_0x36187b){if(_0x36187b){return _0x36187b['destroy']()['then'](function(){_0x43c458[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x4fedbb,_0x408552){return function(_0x2c1519){if(!_0x2c1519){_0x4fedbb[_0x4f49('0x19')](0x194);}return _0x2c1519;};}function handleError(_0x525950,_0xc54070){_0xc54070=_0xc54070||0x1f4;return function(_0x2eed1c){logger[_0x4f49('0x26')](_0x2eed1c[_0x4f49('0x27')]);if(_0x2eed1c[_0x4f49('0x28')]){delete _0x2eed1c[_0x4f49('0x28')];}_0x525950['status'](_0xc54070)['send'](_0x2eed1c);};}exports[_0x4f49('0x29')]=function(_0x2c00ee,_0x605c91){var _0x560050={},_0x3cbfbd={},_0x206203={'count':0x0,'rows':[]};var _0x43d8e3=_['map'](db['Cdr'][_0x4f49('0x2a')],function(_0x27d004){return{'name':_0x27d004[_0x4f49('0x2b')],'type':_0x27d004['type'][_0x4f49('0x2c')]};});_0x3cbfbd[_0x4f49('0x2d')]=_[_0x4f49('0x2e')](_0x43d8e3,_0x4f49('0x28'));_0x3cbfbd[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x2c00ee[_0x4f49('0x2f')]);_0x3cbfbd[_0x4f49('0x31')]=_[_0x4f49('0x32')](_0x3cbfbd[_0x4f49('0x2d')],_0x3cbfbd[_0x4f49('0x2f')]);_0x560050[_0x4f49('0x33')]=_[_0x4f49('0x32')](_0x3cbfbd[_0x4f49('0x2d')],qs[_0x4f49('0x34')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x34')]));_0x560050[_0x4f49('0x33')]=_0x560050[_0x4f49('0x33')]['length']?_0x560050[_0x4f49('0x33')]:_0x3cbfbd[_0x4f49('0x2d')];if(!_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x35')](_0x4f49('0x36'))){_0x560050[_0x4f49('0x1f')]=qs[_0x4f49('0x1f')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x1f')]);_0x560050[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x1d')]);}_0x560050['order']=qs[_0x4f49('0x37')](_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x37')]);_0x560050[_0x4f49('0x38')]=qs[_0x4f49('0x31')](_[_0x4f49('0x39')](_0x2c00ee[_0x4f49('0x2f')],_0x3cbfbd[_0x4f49('0x31')]),_0x43d8e3);if(_0x2c00ee[_0x4f49('0x2f')][_0x4f49('0x3a')]){_0x560050[_0x4f49('0x38')]=_[_0x4f49('0x3b')](_0x560050[_0x4f49('0x38')],{'$or':_[_0x4f49('0x2e')](_0x43d8e3,function(_0x4e3f72){if(_0x4e3f72[_0x4f49('0x3c')]!==_0x4f49('0x3d')){var _0x543605={};_0x543605[_0x4e3f72[_0x4f49('0x28')]]={'$like':'%'+_0x2c00ee[_0x4f49('0x2f')]['filter']+'%'};return _0x543605;}})});}_0x560050=_[_0x4f49('0x3b')]({},_0x560050,_0x2c00ee[_0x4f49('0x3e')]);var _0x2548ad={'where':_0x560050[_0x4f49('0x38')]};return db[_0x4f49('0x3f')][_0x4f49('0x20')](_0x2548ad)[_0x4f49('0x25')](function(_0x5d464e){_0x206203['count']=_0x5d464e;if(_0x2c00ee['query'][_0x4f49('0x40')]){_0x560050[_0x4f49('0x41')]=[{'all':!![]}];}return db[_0x4f49('0x3f')][_0x4f49('0x42')](_0x560050);})[_0x4f49('0x25')](function(_0x1ecf6c){_0x206203[_0x4f49('0x43')]=_0x1ecf6c;return _0x206203;})[_0x4f49('0x25')](respondWithFilteredResult(_0x605c91,_0x560050))[_0x4f49('0x44')](handleError(_0x605c91,null));};exports['show']=function(_0x5238a3,_0x412395){var _0x432b5d={'raw':!![],'where':{'id':_0x5238a3['params']['id']}},_0x159642={};_0x159642[_0x4f49('0x2d')]=_['keys'](db['Cdr'][_0x4f49('0x2a')]);_0x159642[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x5238a3['query']);_0x159642[_0x4f49('0x31')]=_[_0x4f49('0x32')](_0x159642['model'],_0x159642[_0x4f49('0x2f')]);_0x432b5d['attributes']=_[_0x4f49('0x32')](_0x159642[_0x4f49('0x2d')],qs[_0x4f49('0x34')](_0x5238a3['query'][_0x4f49('0x34')]));_0x432b5d[_0x4f49('0x33')]=_0x432b5d[_0x4f49('0x33')][_0x4f49('0x45')]?_0x432b5d[_0x4f49('0x33')]:_0x159642[_0x4f49('0x2d')];if(_0x5238a3[_0x4f49('0x2f')][_0x4f49('0x40')]){_0x432b5d[_0x4f49('0x41')]=[{'all':!![]}];}_0x432b5d=_[_0x4f49('0x3b')]({},_0x432b5d,_0x5238a3['options']);return db[_0x4f49('0x3f')][_0x4f49('0x46')](_0x432b5d)['then'](handleEntityNotFound(_0x412395,null))[_0x4f49('0x25')](respondWithResult(_0x412395,null))['catch'](handleError(_0x412395,null));};exports[_0x4f49('0x47')]=function(_0x41c580,_0x2d3dcd){return db[_0x4f49('0x3f')]['create'](_0x41c580[_0x4f49('0x48')],{})[_0x4f49('0x25')](respondWithResult(_0x2d3dcd,0xc9))[_0x4f49('0x44')](handleError(_0x2d3dcd,null));};exports[_0x4f49('0x24')]=function(_0x3ec266,_0x72ea05){if(_0x3ec266[_0x4f49('0x48')]['id']){delete _0x3ec266[_0x4f49('0x48')]['id'];}return db[_0x4f49('0x3f')][_0x4f49('0x46')]({'where':{'id':_0x3ec266[_0x4f49('0x49')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x72ea05,null))[_0x4f49('0x25')](saveUpdates(_0x3ec266[_0x4f49('0x48')],null))[_0x4f49('0x25')](respondWithResult(_0x72ea05,null))[_0x4f49('0x44')](handleError(_0x72ea05,null));};exports['destroy']=function(_0x4eadc2,_0xce5121){return db[_0x4f49('0x3f')][_0x4f49('0x46')]({'where':{'id':_0x4eadc2[_0x4f49('0x49')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0xce5121,null))[_0x4f49('0x25')](removeEntity(_0xce5121,null))[_0x4f49('0x44')](handleError(_0xce5121,null));};exports['describe']=function(_0x6637f4,_0x4ff0a2){return db[_0x4f49('0x3f')][_0x4f49('0x4a')]()[_0x4f49('0x25')](respondWithResult(_0x4ff0a2,null))[_0x4f49('0x44')](handleError(_0x4ff0a2,null));}; \ No newline at end of file +var _0x8c46=['filter','VIRTUAL','merge','options','include','Cdr','rows','catch','includeAll','find','create','body','params','describe','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick'];(function(_0x2346b5,_0x1f178b){var _0x345117=function(_0x163c59){while(--_0x163c59){_0x2346b5['push'](_0x2346b5['shift']());}};_0x345117(++_0x1f178b);}(_0x8c46,0x171));var _0x68c4=function(_0x1ed8de,_0x32a52f){_0x1ed8de=_0x1ed8de-0x0;var _0x4acdae=_0x8c46[_0x1ed8de];return _0x4acdae;};'use strict';var emlformat=require(_0x68c4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x68c4('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x68c4('0x2'));var Mustache=require(_0x68c4('0x3'));var util=require(_0x68c4('0x4'));var path=require(_0x68c4('0x5'));var sox=require(_0x68c4('0x6'));var csv=require(_0x68c4('0x7'));var ejs=require(_0x68c4('0x8'));var fs=require('fs');var fs_extra=require(_0x68c4('0x9'));var _=require(_0x68c4('0xa'));var squel=require(_0x68c4('0xb'));var crypto=require('crypto');var jsforce=require(_0x68c4('0xc'));var deskjs=require(_0x68c4('0xd'));var toCsv=require(_0x68c4('0x7'));var querystring=require('querystring');var Papa=require(_0x68c4('0xe'));var Redis=require(_0x68c4('0xf'));var authService=require(_0x68c4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68c4('0x11'));var logger=require(_0x68c4('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x68c4('0x13'));var licenseUtil=require(_0x68c4('0x14'));var db=require(_0x68c4('0x15'))['db'];function respondWithStatusCode(_0x48783b,_0x3a432a){_0x3a432a=_0x3a432a||0xcc;return function(_0x1f5f42){if(_0x1f5f42){return _0x48783b[_0x68c4('0x16')](_0x3a432a);}return _0x48783b['status'](_0x3a432a)[_0x68c4('0x17')]();};}function respondWithResult(_0x14919c,_0x5e1341){_0x5e1341=_0x5e1341||0xc8;return function(_0x52f031){if(_0x52f031){return _0x14919c[_0x68c4('0x18')](_0x5e1341)[_0x68c4('0x19')](_0x52f031);}};}function respondWithFilteredResult(_0x5be0de,_0xc25f7b){return function(_0x4ea2a4){if(_0x4ea2a4){var _0x1a7045=typeof _0xc25f7b['offset']==='undefined'&&typeof _0xc25f7b[_0x68c4('0x1a')]===_0x68c4('0x1b');var _0x4f4797=_0x4ea2a4[_0x68c4('0x1c')];var _0x1d757c=_0x1a7045?0x0:_0xc25f7b[_0x68c4('0x1d')];var _0x33c5c5=_0x1a7045?_0x4ea2a4[_0x68c4('0x1c')]:_0xc25f7b[_0x68c4('0x1d')]+_0xc25f7b[_0x68c4('0x1a')];var _0x415ef2;if(_0x33c5c5>=_0x4f4797){_0x33c5c5=_0x4f4797;_0x415ef2=0xc8;}else{_0x415ef2=0xce;}_0x5be0de[_0x68c4('0x18')](_0x415ef2);return _0x5be0de[_0x68c4('0x1e')](_0x68c4('0x1f'),_0x1d757c+'-'+_0x33c5c5+'/'+_0x4f4797)['json'](_0x4ea2a4);}return null;};}function patchUpdates(_0x398a71){return function(_0x4edf9f){try{jsonpatch['apply'](_0x4edf9f,_0x398a71,!![]);}catch(_0x34d3a6){return BPromise[_0x68c4('0x20')](_0x34d3a6);}return _0x4edf9f[_0x68c4('0x21')]();};}function saveUpdates(_0x42f0bc,_0x5b8135){return function(_0x35e865){if(_0x35e865){return _0x35e865[_0x68c4('0x22')](_0x42f0bc)['then'](function(_0x201742){return _0x201742;});}return null;};}function removeEntity(_0x392ccf,_0x45f9be){return function(_0x10278e){if(_0x10278e){return _0x10278e[_0x68c4('0x23')]()[_0x68c4('0x24')](function(){_0x392ccf[_0x68c4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ff4a5,_0x55355d){return function(_0xf16a78){if(!_0xf16a78){_0x2ff4a5[_0x68c4('0x16')](0x194);}return _0xf16a78;};}function handleError(_0x57f32,_0x4f9d32){_0x4f9d32=_0x4f9d32||0x1f4;return function(_0x1e14db){logger[_0x68c4('0x25')](_0x1e14db[_0x68c4('0x26')]);if(_0x1e14db[_0x68c4('0x27')]){delete _0x1e14db[_0x68c4('0x27')];}_0x57f32[_0x68c4('0x18')](_0x4f9d32)[_0x68c4('0x28')](_0x1e14db);};}exports['index']=function(_0x26d56b,_0x4b4634){var _0x3772b3={},_0x1442ba={},_0x56ed70={'count':0x0,'rows':[]};var _0x2847d1=_[_0x68c4('0x29')](db['Cdr'][_0x68c4('0x2a')],function(_0x3a1b69){return{'name':_0x3a1b69[_0x68c4('0x2b')],'type':_0x3a1b69[_0x68c4('0x2c')][_0x68c4('0x2d')]};});_0x1442ba[_0x68c4('0x2e')]=_[_0x68c4('0x29')](_0x2847d1,_0x68c4('0x27'));_0x1442ba[_0x68c4('0x2f')]=_[_0x68c4('0x30')](_0x26d56b[_0x68c4('0x2f')]);_0x1442ba[_0x68c4('0x31')]=_[_0x68c4('0x32')](_0x1442ba[_0x68c4('0x2e')],_0x1442ba[_0x68c4('0x2f')]);_0x3772b3[_0x68c4('0x33')]=_[_0x68c4('0x32')](_0x1442ba[_0x68c4('0x2e')],qs['fields'](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x34')]));_0x3772b3[_0x68c4('0x33')]=_0x3772b3[_0x68c4('0x33')][_0x68c4('0x35')]?_0x3772b3['attributes']:_0x1442ba[_0x68c4('0x2e')];if(!_0x26d56b['query']['hasOwnProperty']('nolimit')){_0x3772b3[_0x68c4('0x1a')]=qs[_0x68c4('0x1a')](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x1a')]);_0x3772b3['offset']=qs[_0x68c4('0x1d')](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x1d')]);}_0x3772b3['order']=qs[_0x68c4('0x36')](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x36')]);_0x3772b3[_0x68c4('0x37')]=qs[_0x68c4('0x31')](_[_0x68c4('0x38')](_0x26d56b[_0x68c4('0x2f')],_0x1442ba[_0x68c4('0x31')]),_0x2847d1);if(_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x39')]){_0x3772b3['where']=_['merge'](_0x3772b3[_0x68c4('0x37')],{'$or':_[_0x68c4('0x29')](_0x2847d1,function(_0x460e11){if(_0x460e11[_0x68c4('0x2c')]!==_0x68c4('0x3a')){var _0x13386d={};_0x13386d[_0x460e11[_0x68c4('0x27')]]={'$like':'%'+_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x39')]+'%'};return _0x13386d;}})});}_0x3772b3=_[_0x68c4('0x3b')]({},_0x3772b3,_0x26d56b[_0x68c4('0x3c')]);var _0x30a1cd={'where':_0x3772b3[_0x68c4('0x37')]};return db['Cdr']['count'](_0x30a1cd)[_0x68c4('0x24')](function(_0x2785b4){_0x56ed70[_0x68c4('0x1c')]=_0x2785b4;if(_0x26d56b[_0x68c4('0x2f')]['includeAll']){_0x3772b3[_0x68c4('0x3d')]=[{'all':!![]}];}return db[_0x68c4('0x3e')]['findAll'](_0x3772b3);})['then'](function(_0x4c564a){_0x56ed70[_0x68c4('0x3f')]=_0x4c564a;return _0x56ed70;})['then'](respondWithFilteredResult(_0x4b4634,_0x3772b3))[_0x68c4('0x40')](handleError(_0x4b4634,null));};exports['show']=function(_0x18da6f,_0x2406b1){var _0xbd848f={'raw':!![],'where':{'id':_0x18da6f['params']['id']}},_0xefe68d={};_0xefe68d[_0x68c4('0x2e')]=_[_0x68c4('0x30')](db[_0x68c4('0x3e')][_0x68c4('0x2a')]);_0xefe68d['query']=_[_0x68c4('0x30')](_0x18da6f[_0x68c4('0x2f')]);_0xefe68d[_0x68c4('0x31')]=_[_0x68c4('0x32')](_0xefe68d[_0x68c4('0x2e')],_0xefe68d['query']);_0xbd848f['attributes']=_['intersection'](_0xefe68d[_0x68c4('0x2e')],qs[_0x68c4('0x34')](_0x18da6f[_0x68c4('0x2f')][_0x68c4('0x34')]));_0xbd848f['attributes']=_0xbd848f[_0x68c4('0x33')][_0x68c4('0x35')]?_0xbd848f[_0x68c4('0x33')]:_0xefe68d[_0x68c4('0x2e')];if(_0x18da6f[_0x68c4('0x2f')][_0x68c4('0x41')]){_0xbd848f[_0x68c4('0x3d')]=[{'all':!![]}];}_0xbd848f=_[_0x68c4('0x3b')]({},_0xbd848f,_0x18da6f[_0x68c4('0x3c')]);return db[_0x68c4('0x3e')][_0x68c4('0x42')](_0xbd848f)['then'](handleEntityNotFound(_0x2406b1,null))[_0x68c4('0x24')](respondWithResult(_0x2406b1,null))['catch'](handleError(_0x2406b1,null));};exports[_0x68c4('0x43')]=function(_0x44e3c9,_0x463a6b){return db[_0x68c4('0x3e')]['create'](_0x44e3c9[_0x68c4('0x44')],{})['then'](respondWithResult(_0x463a6b,0xc9))[_0x68c4('0x40')](handleError(_0x463a6b,null));};exports[_0x68c4('0x22')]=function(_0x570e25,_0x250941){if(_0x570e25[_0x68c4('0x44')]['id']){delete _0x570e25[_0x68c4('0x44')]['id'];}return db[_0x68c4('0x3e')][_0x68c4('0x42')]({'where':{'id':_0x570e25[_0x68c4('0x45')]['id']}})['then'](handleEntityNotFound(_0x250941,null))[_0x68c4('0x24')](saveUpdates(_0x570e25[_0x68c4('0x44')],null))[_0x68c4('0x24')](respondWithResult(_0x250941,null))[_0x68c4('0x40')](handleError(_0x250941,null));};exports['destroy']=function(_0x40ecf6,_0x19aec2){return db[_0x68c4('0x3e')][_0x68c4('0x42')]({'where':{'id':_0x40ecf6[_0x68c4('0x45')]['id']}})[_0x68c4('0x24')](handleEntityNotFound(_0x19aec2,null))['then'](removeEntity(_0x19aec2,null))[_0x68c4('0x40')](handleError(_0x19aec2,null));};exports[_0x68c4('0x46')]=function(_0x3db854,_0x51db14){return db[_0x68c4('0x3e')][_0x68c4('0x46')]()['then'](respondWithResult(_0x51db14,null))['catch'](handleError(_0x51db14,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 5f2ccc1..d803dbb 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(_0x1ed46a,_0x254aa2){var _0x4a07d1=function(_0x49fd94){while(--_0x49fd94){_0x1ed46a['push'](_0x1ed46a['shift']());}};_0x4a07d1(++_0x254aa2);}(_0x7a54,0x106));var _0x47a5=function(_0x35befd,_0x3804e6){_0x35befd=_0x35befd-0x0;var _0x164a11=_0x7a54[_0x35befd];return _0x164a11;};'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(_0x51d4e2,_0x1dfeaf){var _0x1eeab3=function(_0x10bb16){while(--_0x10bb16){_0x51d4e2['push'](_0x51d4e2['shift']());}};_0x1eeab3(++_0x1dfeaf);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index ed143cd..a430109 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 _0x2dad=['Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info'];(function(_0x4926cb,_0x2c5cf2){var _0x30ea7b=function(_0x2a55d4){while(--_0x2a55d4){_0x4926cb['push'](_0x4926cb['shift']());}};_0x30ea7b(++_0x2c5cf2);}(_0x2dad,0x1ac));var _0xd2da=function(_0x18a5e7,_0x5397ec){_0x18a5e7=_0x18a5e7-0x0;var _0x2377de=_0x2dad[_0x18a5e7];return _0x2377de;};'use strict';var _=require('lodash');var util=require(_0xd2da('0x0'));var moment=require(_0xd2da('0x1'));var BPromise=require('bluebird');var rs=require(_0xd2da('0x2'));var fs=require('fs');var Redis=require(_0xd2da('0x3'));var db=require(_0xd2da('0x4'))['db'];var utils=require(_0xd2da('0x5'));var logger=require(_0xd2da('0x6'))(_0xd2da('0x7'));var config=require('../../config/environment');var jayson=require(_0xd2da('0x8'));var client=jayson[_0xd2da('0x9')][_0xd2da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54add6,_0x2db13a,_0x38ae10){return new BPromise(function(_0x1213ab,_0x36d489){return client['request'](_0x54add6,_0x38ae10)[_0xd2da('0xb')](function(_0x4d7705){logger[_0xd2da('0xc')](_0xd2da('0xd'),_0x2db13a,_0xd2da('0xe'));logger[_0xd2da('0xf')](_0xd2da('0x10'),_0x2db13a,_0xd2da('0xe'),JSON['stringify'](_0x4d7705));if(_0x4d7705['error']){if(_0x4d7705[_0xd2da('0x11')][_0xd2da('0x12')]===0x1f4){logger[_0xd2da('0x11')]('Cdr,\x20%s,\x20%s',_0x2db13a,_0x4d7705[_0xd2da('0x11')][_0xd2da('0x13')]);return _0x36d489(_0x4d7705[_0xd2da('0x11')]['message']);}logger[_0xd2da('0x11')](_0xd2da('0xd'),_0x2db13a,_0x4d7705[_0xd2da('0x11')][_0xd2da('0x13')]);return _0x1213ab(_0x4d7705[_0xd2da('0x11')][_0xd2da('0x13')]);}else{logger[_0xd2da('0xc')](_0xd2da('0xd'),_0x2db13a,_0xd2da('0xe'));_0x1213ab(_0x4d7705[_0xd2da('0x14')][_0xd2da('0x13')]);}})['catch'](function(_0x36a59b){logger[_0xd2da('0x11')]('Cdr,\x20%s,\x20%s',_0x2db13a,_0x36a59b);_0x36d489(_0x36a59b);});});} \ No newline at end of file +var _0x8fe0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','moment','bluebird'];(function(_0x3f8f62,_0x313077){var _0x44ae90=function(_0x22004b){while(--_0x22004b){_0x3f8f62['push'](_0x3f8f62['shift']());}};_0x44ae90(++_0x313077);}(_0x8fe0,0x112));var _0x08fe=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8fe0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x08fe('0x0'));var BPromise=require(_0x08fe('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08fe('0x2'));var db=require(_0x08fe('0x3'))['db'];var utils=require(_0x08fe('0x4'));var logger=require(_0x08fe('0x5'))(_0x08fe('0x6'));var config=require(_0x08fe('0x7'));var jayson=require(_0x08fe('0x8'));var client=jayson[_0x08fe('0x9')][_0x08fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58c167,_0x10750f,_0x196919){return new BPromise(function(_0x112931,_0x505ce9){return client[_0x08fe('0xb')](_0x58c167,_0x196919)['then'](function(_0x52fdd1){logger[_0x08fe('0xc')]('Cdr,\x20%s,\x20%s',_0x10750f,_0x08fe('0xd'));logger[_0x08fe('0xe')](_0x08fe('0xf'),_0x10750f,_0x08fe('0xd'),JSON[_0x08fe('0x10')](_0x52fdd1));if(_0x52fdd1['error']){if(_0x52fdd1[_0x08fe('0x11')][_0x08fe('0x12')]===0x1f4){logger[_0x08fe('0x11')](_0x08fe('0x13'),_0x10750f,_0x52fdd1['error']['message']);return _0x505ce9(_0x52fdd1[_0x08fe('0x11')][_0x08fe('0x14')]);}logger['error'](_0x08fe('0x13'),_0x10750f,_0x52fdd1['error']['message']);return _0x112931(_0x52fdd1['error'][_0x08fe('0x14')]);}else{logger[_0x08fe('0xc')]('Cdr,\x20%s,\x20%s',_0x10750f,_0x08fe('0xd'));_0x112931(_0x52fdd1[_0x08fe('0x15')][_0x08fe('0x14')]);}})[_0x08fe('0x16')](function(_0x34f48c){logger[_0x08fe('0x11')](_0x08fe('0x13'),_0x10750f,_0x34f48c);_0x505ce9(_0x34f48c);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 2eb521b..b5058ee 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x399b7c,_0x2750b9){var _0x58312b=function(_0x5599db){while(--_0x5599db){_0x399b7c['push'](_0x399b7c['shift']());}};_0x58312b(++_0x2750b9);}(_0xb10b,0x12a));var _0xbb10=function(_0x41c66d,_0x512755){_0x41c66d=_0x41c66d-0x0;var _0x4b3302=_0xb10b[_0x41c66d];return _0x4b3302;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index eee2b09..25f241d 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 _0x6d54=['noop','TEXT','STRING','*,*,*,*','INTEGER'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0x6d54,0x180));var _0x46d5=function(_0x1e948b,_0x548563){_0x1e948b=_0x1e948b-0x0;var _0x238555=_0x6d54[_0x1e948b];return _0x238555;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x46d5('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x46d5('0x1')},'appdata':{'type':Sequelize[_0x46d5('0x2')]()},'description':{'type':Sequelize[_0x46d5('0x3')]},'interval':{'type':Sequelize[_0x46d5('0x3')],'defaultValue':_0x46d5('0x4')}}; \ No newline at end of file +var _0xbf35=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x372c3e,_0x4ebb70){var _0x4b5b54=function(_0x1f4e7d){while(--_0x1f4e7d){_0x372c3e['push'](_0x372c3e['shift']());}};_0x4b5b54(++_0x4ebb70);}(_0xbf35,0x1ad));var _0x5bf3=function(_0x275b3f,_0x50d554){_0x275b3f=_0x275b3f-0x0;var _0x388a81=_0xbf35[_0x275b3f];return _0x388a81;};'use strict';var Sequelize=require(_0x5bf3('0x0'));module[_0x5bf3('0x1')]={'priority':{'type':Sequelize[_0x5bf3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5bf3('0x3')],'allowNull':![],'defaultValue':_0x5bf3('0x4')},'appdata':{'type':Sequelize[_0x5bf3('0x5')]()},'description':{'type':Sequelize[_0x5bf3('0x3')]},'interval':{'type':Sequelize[_0x5bf3('0x3')],'defaultValue':_0x5bf3('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 309ae0c..11d628c 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 _0x6953=['limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','model','keys','ChatApplication','rawAttributes','query','filters','attributes','fields','length','includeAll','include','merge','options','find','catch','body','params','eml-format','rimraf','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x4496c3,_0x156ea4){var _0x3bf641=function(_0x1db148){while(--_0x1db148){_0x4496c3['push'](_0x4496c3['shift']());}};_0x3bf641(++_0x156ea4);}(_0x6953,0x91));var _0x3695=function(_0x48ff16,_0x6eeb91){_0x48ff16=_0x48ff16-0x0;var _0x1018f3=_0x6953[_0x48ff16];return _0x1018f3;};'use strict';var emlformat=require(_0x3695('0x0'));var rimraf=require(_0x3695('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3695('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3695('0x3'));var util=require(_0x3695('0x4'));var path=require(_0x3695('0x5'));var sox=require('sox');var csv=require(_0x3695('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3695('0x7'));var _=require(_0x3695('0x8'));var squel=require(_0x3695('0x9'));var crypto=require(_0x3695('0xa'));var jsforce=require(_0x3695('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3695('0x6'));var querystring=require('querystring');var Papa=require(_0x3695('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3695('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3695('0xe'));var logger=require(_0x3695('0xf'))(_0x3695('0x10'));var utils=require(_0x3695('0x11'));var config=require(_0x3695('0x12'));var licenseUtil=require(_0x3695('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19080e,_0x345587){_0x345587=_0x345587||0xcc;return function(_0x212011){if(_0x212011){return _0x19080e[_0x3695('0x14')](_0x345587);}return _0x19080e[_0x3695('0x15')](_0x345587)[_0x3695('0x16')]();};}function respondWithResult(_0x439bd9,_0x4df429){_0x4df429=_0x4df429||0xc8;return function(_0x26dfc9){if(_0x26dfc9){return _0x439bd9[_0x3695('0x15')](_0x4df429)[_0x3695('0x17')](_0x26dfc9);}};}function respondWithFilteredResult(_0x4ca317,_0x3aa59d){return function(_0x231c7d){if(_0x231c7d){var _0x2cdd3=typeof _0x3aa59d[_0x3695('0x18')]===_0x3695('0x19')&&typeof _0x3aa59d[_0x3695('0x1a')]===_0x3695('0x19');var _0x4fa2d9=_0x231c7d[_0x3695('0x1b')];var _0x5edf8d=_0x2cdd3?0x0:_0x3aa59d[_0x3695('0x18')];var _0xcc93bb=_0x2cdd3?_0x231c7d[_0x3695('0x1b')]:_0x3aa59d[_0x3695('0x18')]+_0x3aa59d[_0x3695('0x1a')];var _0x5dec2a;if(_0xcc93bb>=_0x4fa2d9){_0xcc93bb=_0x4fa2d9;_0x5dec2a=0xc8;}else{_0x5dec2a=0xce;}_0x4ca317[_0x3695('0x15')](_0x5dec2a);return _0x4ca317[_0x3695('0x1c')](_0x3695('0x1d'),_0x5edf8d+'-'+_0xcc93bb+'/'+_0x4fa2d9)[_0x3695('0x17')](_0x231c7d);}return null;};}function patchUpdates(_0xc076a9){return function(_0x1ebba8){try{jsonpatch[_0x3695('0x1e')](_0x1ebba8,_0xc076a9,!![]);}catch(_0xb85811){return BPromise[_0x3695('0x1f')](_0xb85811);}return _0x1ebba8[_0x3695('0x20')]();};}function saveUpdates(_0x1b97d2,_0xf2c747){return function(_0x459f33){if(_0x459f33){return _0x459f33[_0x3695('0x21')](_0x1b97d2)['then'](function(_0x42648c){return _0x42648c;});}return null;};}function removeEntity(_0xdb0934,_0x4899c0){return function(_0x4940e9){if(_0x4940e9){return _0x4940e9[_0x3695('0x22')]()[_0x3695('0x23')](function(){_0xdb0934[_0x3695('0x15')](0xcc)[_0x3695('0x16')]();});}};}function handleEntityNotFound(_0x534d38,_0x180f77){return function(_0x48c2fd){if(!_0x48c2fd){_0x534d38[_0x3695('0x14')](0x194);}return _0x48c2fd;};}function handleError(_0x5319f4,_0xe085de){_0xe085de=_0xe085de||0x1f4;return function(_0x5adea3){logger[_0x3695('0x24')](_0x5adea3[_0x3695('0x25')]);if(_0x5adea3[_0x3695('0x26')]){delete _0x5adea3[_0x3695('0x26')];}_0x5319f4[_0x3695('0x15')](_0xe085de)[_0x3695('0x27')](_0x5adea3);};}exports['show']=function(_0x2be6ee,_0x354ae0){var _0x5f193c={'raw':!![],'where':{'id':_0x2be6ee['params']['id']}},_0x392107={};_0x392107[_0x3695('0x28')]=_[_0x3695('0x29')](db[_0x3695('0x2a')][_0x3695('0x2b')]);_0x392107[_0x3695('0x2c')]=_[_0x3695('0x29')](_0x2be6ee[_0x3695('0x2c')]);_0x392107[_0x3695('0x2d')]=_['intersection'](_0x392107[_0x3695('0x28')],_0x392107[_0x3695('0x2c')]);_0x5f193c[_0x3695('0x2e')]=_['intersection'](_0x392107['model'],qs[_0x3695('0x2f')](_0x2be6ee['query'][_0x3695('0x2f')]));_0x5f193c[_0x3695('0x2e')]=_0x5f193c['attributes'][_0x3695('0x30')]?_0x5f193c['attributes']:_0x392107[_0x3695('0x28')];if(_0x2be6ee[_0x3695('0x2c')][_0x3695('0x31')]){_0x5f193c[_0x3695('0x32')]=[{'all':!![]}];}_0x5f193c=_[_0x3695('0x33')]({},_0x5f193c,_0x2be6ee[_0x3695('0x34')]);return db['ChatApplication'][_0x3695('0x35')](_0x5f193c)[_0x3695('0x23')](handleEntityNotFound(_0x354ae0,null))['then'](respondWithResult(_0x354ae0,null))[_0x3695('0x36')](handleError(_0x354ae0,null));};exports[_0x3695('0x21')]=function(_0x542d33,_0x507c57){if(_0x542d33['body']['id']){delete _0x542d33['body']['id'];}return db[_0x3695('0x2a')][_0x3695('0x35')]({'where':{'id':_0x542d33['params']['id']}})[_0x3695('0x23')](handleEntityNotFound(_0x507c57,null))[_0x3695('0x23')](saveUpdates(_0x542d33[_0x3695('0x37')],null))[_0x3695('0x23')](respondWithResult(_0x507c57,null))['catch'](handleError(_0x507c57,null));};exports['destroy']=function(_0x456c04,_0x470907){return db['ChatApplication'][_0x3695('0x35')]({'where':{'id':_0x456c04[_0x3695('0x38')]['id']}})[_0x3695('0x23')](handleEntityNotFound(_0x470907,null))[_0x3695('0x23')](removeEntity(_0x470907,null))[_0x3695('0x36')](handleError(_0x470907,null));}; \ No newline at end of file +var _0xbde2=['params','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../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','set','Content-Range','reject','save','update','then','error','stack','name','send','show','model','ChatApplication','rawAttributes','query','keys','filters','intersection','fields','attributes','include','merge','options','catch','body','find'];(function(_0x1ef0bc,_0x6e3409){var _0x2e52ed=function(_0x14a440){while(--_0x14a440){_0x1ef0bc['push'](_0x1ef0bc['shift']());}};_0x2e52ed(++_0x6e3409);}(_0xbde2,0x7a));var _0x2bde=function(_0x2c9ef3,_0x33588a){_0x2c9ef3=_0x2c9ef3-0x0;var _0x1d5ad9=_0xbde2[_0x2c9ef3];return _0x1d5ad9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2bde('0x0'));var zipdir=require(_0x2bde('0x1'));var jsonpatch=require(_0x2bde('0x2'));var rp=require('request-promise');var moment=require(_0x2bde('0x3'));var BPromise=require(_0x2bde('0x4'));var Mustache=require(_0x2bde('0x5'));var util=require('util');var path=require(_0x2bde('0x6'));var sox=require(_0x2bde('0x7'));var csv=require(_0x2bde('0x8'));var ejs=require(_0x2bde('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2bde('0xa'));var squel=require(_0x2bde('0xb'));var crypto=require(_0x2bde('0xc'));var jsforce=require(_0x2bde('0xd'));var deskjs=require(_0x2bde('0xe'));var toCsv=require(_0x2bde('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2bde('0xf'));var qs=require(_0x2bde('0x10'));var as=require(_0x2bde('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2bde('0x12'))(_0x2bde('0x13'));var utils=require(_0x2bde('0x14'));var config=require(_0x2bde('0x15'));var licenseUtil=require(_0x2bde('0x16'));var db=require(_0x2bde('0x17'))['db'];function respondWithStatusCode(_0x5c98f3,_0x62de8f){_0x62de8f=_0x62de8f||0xcc;return function(_0x5ba816){if(_0x5ba816){return _0x5c98f3[_0x2bde('0x18')](_0x62de8f);}return _0x5c98f3[_0x2bde('0x19')](_0x62de8f)[_0x2bde('0x1a')]();};}function respondWithResult(_0x22b48,_0x3441dd){_0x3441dd=_0x3441dd||0xc8;return function(_0x2583da){if(_0x2583da){return _0x22b48[_0x2bde('0x19')](_0x3441dd)[_0x2bde('0x1b')](_0x2583da);}};}function respondWithFilteredResult(_0xaa6cec,_0x1bfcda){return function(_0x329331){if(_0x329331){var _0x1b2958=typeof _0x1bfcda[_0x2bde('0x1c')]===_0x2bde('0x1d')&&typeof _0x1bfcda['limit']==='undefined';var _0x145aa3=_0x329331[_0x2bde('0x1e')];var _0x39da17=_0x1b2958?0x0:_0x1bfcda[_0x2bde('0x1c')];var _0x590e44=_0x1b2958?_0x329331[_0x2bde('0x1e')]:_0x1bfcda[_0x2bde('0x1c')]+_0x1bfcda[_0x2bde('0x1f')];var _0x34f820;if(_0x590e44>=_0x145aa3){_0x590e44=_0x145aa3;_0x34f820=0xc8;}else{_0x34f820=0xce;}_0xaa6cec[_0x2bde('0x19')](_0x34f820);return _0xaa6cec[_0x2bde('0x20')](_0x2bde('0x21'),_0x39da17+'-'+_0x590e44+'/'+_0x145aa3)[_0x2bde('0x1b')](_0x329331);}return null;};}function patchUpdates(_0x58e640){return function(_0xe302eb){try{jsonpatch['apply'](_0xe302eb,_0x58e640,!![]);}catch(_0x560202){return BPromise[_0x2bde('0x22')](_0x560202);}return _0xe302eb[_0x2bde('0x23')]();};}function saveUpdates(_0x27b6e1,_0x481dd2){return function(_0x6c0da){if(_0x6c0da){return _0x6c0da[_0x2bde('0x24')](_0x27b6e1)[_0x2bde('0x25')](function(_0x5b4463){return _0x5b4463;});}return null;};}function removeEntity(_0x17d654,_0xc492e4){return function(_0x2479d7){if(_0x2479d7){return _0x2479d7['destroy']()['then'](function(){_0x17d654['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x109da2,_0x5100ca){return function(_0x24139d){if(!_0x24139d){_0x109da2[_0x2bde('0x18')](0x194);}return _0x24139d;};}function handleError(_0x44ad01,_0x27e62f){_0x27e62f=_0x27e62f||0x1f4;return function(_0x4d7371){logger[_0x2bde('0x26')](_0x4d7371[_0x2bde('0x27')]);if(_0x4d7371[_0x2bde('0x28')]){delete _0x4d7371['name'];}_0x44ad01[_0x2bde('0x19')](_0x27e62f)[_0x2bde('0x29')](_0x4d7371);};}exports[_0x2bde('0x2a')]=function(_0x336c7d,_0x800cc){var _0x435ce9={'raw':!![],'where':{'id':_0x336c7d['params']['id']}},_0x2b1eb6={};_0x2b1eb6[_0x2bde('0x2b')]=_['keys'](db[_0x2bde('0x2c')][_0x2bde('0x2d')]);_0x2b1eb6[_0x2bde('0x2e')]=_[_0x2bde('0x2f')](_0x336c7d[_0x2bde('0x2e')]);_0x2b1eb6[_0x2bde('0x30')]=_[_0x2bde('0x31')](_0x2b1eb6[_0x2bde('0x2b')],_0x2b1eb6['query']);_0x435ce9['attributes']=_[_0x2bde('0x31')](_0x2b1eb6[_0x2bde('0x2b')],qs[_0x2bde('0x32')](_0x336c7d[_0x2bde('0x2e')][_0x2bde('0x32')]));_0x435ce9[_0x2bde('0x33')]=_0x435ce9[_0x2bde('0x33')]['length']?_0x435ce9['attributes']:_0x2b1eb6[_0x2bde('0x2b')];if(_0x336c7d[_0x2bde('0x2e')]['includeAll']){_0x435ce9[_0x2bde('0x34')]=[{'all':!![]}];}_0x435ce9=_[_0x2bde('0x35')]({},_0x435ce9,_0x336c7d[_0x2bde('0x36')]);return db[_0x2bde('0x2c')]['find'](_0x435ce9)[_0x2bde('0x25')](handleEntityNotFound(_0x800cc,null))[_0x2bde('0x25')](respondWithResult(_0x800cc,null))[_0x2bde('0x37')](handleError(_0x800cc,null));};exports[_0x2bde('0x24')]=function(_0x109477,_0x1321ab){if(_0x109477['body']['id']){delete _0x109477[_0x2bde('0x38')]['id'];}return db['ChatApplication'][_0x2bde('0x39')]({'where':{'id':_0x109477[_0x2bde('0x3a')]['id']}})[_0x2bde('0x25')](handleEntityNotFound(_0x1321ab,null))[_0x2bde('0x25')](saveUpdates(_0x109477['body'],null))[_0x2bde('0x25')](respondWithResult(_0x1321ab,null))['catch'](handleError(_0x1321ab,null));};exports[_0x2bde('0x3b')]=function(_0x28f77a,_0x2ef2d7){return db['ChatApplication']['find']({'where':{'id':_0x28f77a[_0x2bde('0x3a')]['id']}})[_0x2bde('0x25')](handleEntityNotFound(_0x2ef2d7,null))['then'](removeEntity(_0x2ef2d7,null))[_0x2bde('0x37')](handleError(_0x2ef2d7,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index c89b417..a475f9f 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 _0xdf71=['api','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf71,0x1d2));var _0x1df7=function(_0x70f588,_0x5b85c3){_0x70f588=_0x70f588-0x0;var _0x53ce67=_0xdf71[_0x70f588];return _0x53ce67;};'use strict';var _=require(_0x1df7('0x0'));var util=require('util');var logger=require(_0x1df7('0x1'))(_0x1df7('0x2'));var moment=require(_0x1df7('0x3'));var BPromise=require(_0x1df7('0x4'));var rp=require(_0x1df7('0x5'));var fs=require('fs');var path=require(_0x1df7('0x6'));var rimraf=require(_0x1df7('0x7'));var config=require('../../config/environment');var attributes=require(_0x1df7('0x8'));module[_0x1df7('0x9')]=function(_0x4bc4a8,_0x508a68){return _0x4bc4a8[_0x1df7('0xa')](_0x1df7('0xb'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1df7('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8e51=['ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x8bd715,_0x65741){var _0x8188cc=function(_0x21df44){while(--_0x21df44){_0x8bd715['push'](_0x8bd715['shift']());}};_0x8188cc(++_0x65741);}(_0x8e51,0x1e4));var _0x18e5=function(_0x136ebb,_0x4e8c9a){_0x136ebb=_0x136ebb-0x0;var _0x5cf409=_0x8e51[_0x136ebb];return _0x5cf409;};'use strict';var _=require(_0x18e5('0x0'));var util=require(_0x18e5('0x1'));var logger=require('../../config/logger')(_0x18e5('0x2'));var moment=require(_0x18e5('0x3'));var BPromise=require(_0x18e5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x18e5('0x5'));var rimraf=require(_0x18e5('0x6'));var config=require(_0x18e5('0x7'));var attributes=require(_0x18e5('0x8'));module[_0x18e5('0x9')]=function(_0x303a9e,_0x13001a){return _0x303a9e['define'](_0x18e5('0xa'),attributes,{'tableName':_0x18e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x18e5('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index ad8ef92..b70c927 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 _0x9fa5=['stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x97e014,_0x33fc96){var _0x29e7d6=function(_0x3d5c64){while(--_0x3d5c64){_0x97e014['push'](_0x97e014['shift']());}};_0x29e7d6(++_0x33fc96);}(_0x9fa5,0x95));var _0x59fa=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x9fa5[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x59fa('0x0'));var util=require(_0x59fa('0x1'));var moment=require(_0x59fa('0x2'));var BPromise=require(_0x59fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59fa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x59fa('0x5'))('rpc');var config=require(_0x59fa('0x6'));var jayson=require(_0x59fa('0x7'));var client=jayson[_0x59fa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39046e,_0x45ea44,_0x126e02){return new BPromise(function(_0x2ebeb3,_0x2ef039){return client['request'](_0x39046e,_0x126e02)[_0x59fa('0x9')](function(_0x577fec){logger['info'](_0x59fa('0xa'),_0x45ea44,_0x59fa('0xb'));logger['debug'](_0x59fa('0xc'),_0x45ea44,_0x59fa('0xb'),JSON[_0x59fa('0xd')](_0x577fec));if(_0x577fec[_0x59fa('0xe')]){if(_0x577fec['error'][_0x59fa('0xf')]===0x1f4){logger[_0x59fa('0xe')](_0x59fa('0xa'),_0x45ea44,_0x577fec['error']['message']);return _0x2ef039(_0x577fec[_0x59fa('0xe')][_0x59fa('0x10')]);}logger[_0x59fa('0xe')](_0x59fa('0xa'),_0x45ea44,_0x577fec[_0x59fa('0xe')]['message']);return _0x2ebeb3(_0x577fec[_0x59fa('0xe')][_0x59fa('0x10')]);}else{logger['info'](_0x59fa('0xa'),_0x45ea44,_0x59fa('0xb'));_0x2ebeb3(_0x577fec['result']['message']);}})[_0x59fa('0x11')](function(_0x9b6799){logger[_0x59fa('0xe')](_0x59fa('0xa'),_0x45ea44,_0x9b6799);_0x2ef039(_0x9b6799);});});} \ No newline at end of file +var _0xdae9=['result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatApplication,\x20%s,\x20%s'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xdae9,0xf2));var _0x9dae=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0xdae9[_0x43b584];return _0x48f27b;};'use strict';var _=require('lodash');var util=require(_0x9dae('0x0'));var moment=require(_0x9dae('0x1'));var BPromise=require('bluebird');var rs=require(_0x9dae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9dae('0x3'))['db'];var utils=require(_0x9dae('0x4'));var logger=require(_0x9dae('0x5'))(_0x9dae('0x6'));var config=require('../../config/environment');var jayson=require(_0x9dae('0x7'));var client=jayson[_0x9dae('0x8')][_0x9dae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbeca2f,_0xfea051,_0x3c667e){return new BPromise(function(_0x49d06b,_0x359fda){return client['request'](_0xbeca2f,_0x3c667e)[_0x9dae('0xa')](function(_0xbc95e8){logger[_0x9dae('0xb')]('ChatApplication,\x20%s,\x20%s',_0xfea051,_0x9dae('0xc'));logger['debug'](_0x9dae('0xd'),_0xfea051,_0x9dae('0xc'),JSON[_0x9dae('0xe')](_0xbc95e8));if(_0xbc95e8[_0x9dae('0xf')]){if(_0xbc95e8['error']['code']===0x1f4){logger[_0x9dae('0xf')]('ChatApplication,\x20%s,\x20%s',_0xfea051,_0xbc95e8[_0x9dae('0xf')][_0x9dae('0x10')]);return _0x359fda(_0xbc95e8[_0x9dae('0xf')][_0x9dae('0x10')]);}logger[_0x9dae('0xf')](_0x9dae('0x11'),_0xfea051,_0xbc95e8[_0x9dae('0xf')]['message']);return _0x49d06b(_0xbc95e8['error'][_0x9dae('0x10')]);}else{logger[_0x9dae('0xb')](_0x9dae('0x11'),_0xfea051,_0x9dae('0xc'));_0x49d06b(_0xbc95e8[_0x9dae('0x12')][_0x9dae('0x10')]);}})[_0x9dae('0x13')](function(_0x3e890){logger[_0x9dae('0xf')](_0x9dae('0x11'),_0xfea051,_0x3e890);_0x359fda(_0x3e890);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 7fb0862..8781326 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 _0x83a1=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','show','/:id','isAuthenticated','update','delete','destroy','exports','util'];(function(_0xc8f48a,_0x3ead49){var _0x220317=function(_0x6b160d){while(--_0x6b160d){_0xc8f48a['push'](_0xc8f48a['shift']());}};_0x220317(++_0x3ead49);}(_0x83a1,0xba));var _0x183a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x83a1[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x183a('0x0'));var path=require(_0x183a('0x1'));var timeout=require(_0x183a('0x2'));var express=require(_0x183a('0x3'));var router=express[_0x183a('0x4')]();var fs_extra=require(_0x183a('0x5'));var auth=require(_0x183a('0x6'));var interaction=require(_0x183a('0x7'));var config=require(_0x183a('0x8'));var controller=require(_0x183a('0x9'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x183a('0xa')]);router['put'](_0x183a('0xb'),auth[_0x183a('0xc')](),controller[_0x183a('0xd')]);router[_0x183a('0xe')]('/:id',auth[_0x183a('0xc')](),controller[_0x183a('0xf')]);module[_0x183a('0x10')]=router; \ No newline at end of file +var _0xee97=['./chatApplication.controller','put','/:id','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x452210,_0x5ee6bb){var _0x5d8de4=function(_0x3680ec){while(--_0x3680ec){_0x452210['push'](_0x452210['shift']());}};_0x5d8de4(++_0x5ee6bb);}(_0xee97,0x93));var _0x7ee9=function(_0x2c8bad,_0x3e602b){_0x2c8bad=_0x2c8bad-0x0;var _0x295a7f=_0xee97[_0x2c8bad];return _0x295a7f;};'use strict';var multer=require(_0x7ee9('0x0'));var util=require(_0x7ee9('0x1'));var path=require(_0x7ee9('0x2'));var timeout=require(_0x7ee9('0x3'));var express=require(_0x7ee9('0x4'));var router=express['Router']();var fs_extra=require(_0x7ee9('0x5'));var auth=require(_0x7ee9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7ee9('0x7'));router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7ee9('0x8')](_0x7ee9('0x9'),auth[_0x7ee9('0xa')](),controller[_0x7ee9('0xb')]);router['delete'](_0x7ee9('0x9'),auth[_0x7ee9('0xa')](),controller[_0x7ee9('0xc')]);module[_0x7ee9('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 23f828f..753d6ba 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 _0x2186=['sequelize','BOOLEAN'];(function(_0x3fd27c,_0x2697a2){var _0x954d17=function(_0x28da03){while(--_0x28da03){_0x3fd27c['push'](_0x3fd27c['shift']());}};_0x954d17(++_0x2697a2);}(_0x2186,0x1ca));var _0x6218=function(_0x2ee2f9,_0x3695cc){_0x2ee2f9=_0x2ee2f9-0x0;var _0x24281f=_0x2186[_0x2ee2f9];return _0x24281f;};'use strict';var Sequelize=require(_0x6218('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x6218('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa105=['sequelize','STRING','BOOLEAN'];(function(_0x58f521,_0x22050c){var _0x448b76=function(_0x63e768){while(--_0x63e768){_0x58f521['push'](_0x58f521['shift']());}};_0x448b76(++_0x22050c);}(_0xa105,0xd8));var _0x5a10=function(_0x1abb5e,_0xe299c8){_0x1abb5e=_0x1abb5e-0x0;var _0x11b72b=_0xa105[_0x1abb5e];return _0x11b72b;};'use strict';var Sequelize=require(_0x5a10('0x0'));module['exports']={'name':{'type':Sequelize[_0x5a10('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5a10('0x1')]},'write':{'type':Sequelize[_0x5a10('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 9c458cd..d3cbecd 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 _0x9b59=['json','offset','undefined','limit','count','set','update','then','end','name','send','index','map','ChatGroup','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','length','includeAll','create','catch','body','find','destroy','describe','ChatInternalMessage','params','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','rawAttributes','order','removeMembers','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatGroup.socket','sendStatus','status'];(function(_0x5e07a7,_0x1438b3){var _0x22ced5=function(_0x7c975b){while(--_0x7c975b){_0x5e07a7['push'](_0x5e07a7['shift']());}};_0x22ced5(++_0x1438b3);}(_0x9b59,0x1c7));var _0x99b5=function(_0x5b439f,_0x2ad2ec){_0x5b439f=_0x5b439f-0x0;var _0x579c4c=_0x9b59[_0x5b439f];return _0x579c4c;};'use strict';var emlformat=require(_0x99b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x99b5('0x1'));var jsonpatch=require(_0x99b5('0x2'));var rp=require(_0x99b5('0x3'));var moment=require(_0x99b5('0x4'));var BPromise=require(_0x99b5('0x5'));var Mustache=require(_0x99b5('0x6'));var util=require(_0x99b5('0x7'));var path=require('path');var sox=require(_0x99b5('0x8'));var csv=require(_0x99b5('0x9'));var ejs=require(_0x99b5('0xa'));var fs=require('fs');var fs_extra=require(_0x99b5('0xb'));var _=require(_0x99b5('0xc'));var squel=require(_0x99b5('0xd'));var crypto=require(_0x99b5('0xe'));var jsforce=require(_0x99b5('0xf'));var deskjs=require(_0x99b5('0x10'));var toCsv=require(_0x99b5('0x9'));var querystring=require(_0x99b5('0x11'));var Papa=require(_0x99b5('0x12'));var Redis=require(_0x99b5('0x13'));var authService=require(_0x99b5('0x14'));var qs=require(_0x99b5('0x15'));var as=require(_0x99b5('0x16'));var hardwareService=require(_0x99b5('0x17'));var logger=require(_0x99b5('0x18'))(_0x99b5('0x19'));var utils=require(_0x99b5('0x1a'));var config=require(_0x99b5('0x1b'));var licenseUtil=require(_0x99b5('0x1c'));var db=require('../../mysqldb')['db'];config[_0x99b5('0x1d')]=_[_0x99b5('0x1e')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x99b5('0x1f'))(new Redis(config[_0x99b5('0x1d')]));require(_0x99b5('0x20'))['register'](socket);function respondWithStatusCode(_0x37e28e,_0x1a43d0){_0x1a43d0=_0x1a43d0||0xcc;return function(_0x120a8d){if(_0x120a8d){return _0x37e28e[_0x99b5('0x21')](_0x1a43d0);}return _0x37e28e[_0x99b5('0x22')](_0x1a43d0)['end']();};}function respondWithResult(_0x1b7842,_0x1495d0){_0x1495d0=_0x1495d0||0xc8;return function(_0xf8360c){if(_0xf8360c){return _0x1b7842['status'](_0x1495d0)[_0x99b5('0x23')](_0xf8360c);}};}function respondWithFilteredResult(_0x4471b2,_0xdfed88){return function(_0x17894e){if(_0x17894e){var _0x160d05=typeof _0xdfed88[_0x99b5('0x24')]===_0x99b5('0x25')&&typeof _0xdfed88[_0x99b5('0x26')]===_0x99b5('0x25');var _0xcee95a=_0x17894e['count'];var _0x268a82=_0x160d05?0x0:_0xdfed88[_0x99b5('0x24')];var _0x2689c2=_0x160d05?_0x17894e[_0x99b5('0x27')]:_0xdfed88[_0x99b5('0x24')]+_0xdfed88[_0x99b5('0x26')];var _0x5b9785;if(_0x2689c2>=_0xcee95a){_0x2689c2=_0xcee95a;_0x5b9785=0xc8;}else{_0x5b9785=0xce;}_0x4471b2[_0x99b5('0x22')](_0x5b9785);return _0x4471b2[_0x99b5('0x28')]('Content-Range',_0x268a82+'-'+_0x2689c2+'/'+_0xcee95a)[_0x99b5('0x23')](_0x17894e);}return null;};}function patchUpdates(_0x1b8f43){return function(_0x445cc6){try{jsonpatch['apply'](_0x445cc6,_0x1b8f43,!![]);}catch(_0x233cff){return BPromise['reject'](_0x233cff);}return _0x445cc6['save']();};}function saveUpdates(_0x421583,_0x19b6d1){return function(_0x40b9bb){if(_0x40b9bb){return _0x40b9bb[_0x99b5('0x29')](_0x421583)[_0x99b5('0x2a')](function(_0x357294){return _0x357294;});}return null;};}function removeEntity(_0x7f2675,_0x388973){return function(_0x25245d){if(_0x25245d){return _0x25245d['destroy']()[_0x99b5('0x2a')](function(){_0x7f2675['status'](0xcc)[_0x99b5('0x2b')]();});}};}function handleEntityNotFound(_0x452fca,_0xb803db){return function(_0x50b33b){if(!_0x50b33b){_0x452fca[_0x99b5('0x21')](0x194);}return _0x50b33b;};}function handleError(_0x560b49,_0x31e5e9){_0x31e5e9=_0x31e5e9||0x1f4;return function(_0xe22582){logger['error'](_0xe22582['stack']);if(_0xe22582[_0x99b5('0x2c')]){delete _0xe22582[_0x99b5('0x2c')];}_0x560b49['status'](_0x31e5e9)[_0x99b5('0x2d')](_0xe22582);};}exports[_0x99b5('0x2e')]=function(_0x5759e0,_0x354243){var _0x7e6cb7={},_0x42056f={},_0x4aadb9={'count':0x0,'rows':[]};var _0x63af80=_[_0x99b5('0x2f')](db[_0x99b5('0x30')]['rawAttributes'],function(_0x2f38c4){return{'name':_0x2f38c4['fieldName'],'type':_0x2f38c4[_0x99b5('0x31')][_0x99b5('0x32')]};});_0x42056f[_0x99b5('0x33')]=_[_0x99b5('0x2f')](_0x63af80,_0x99b5('0x2c'));_0x42056f[_0x99b5('0x34')]=_[_0x99b5('0x35')](_0x5759e0[_0x99b5('0x34')]);_0x42056f[_0x99b5('0x36')]=_[_0x99b5('0x37')](_0x42056f[_0x99b5('0x33')],_0x42056f[_0x99b5('0x34')]);_0x7e6cb7[_0x99b5('0x38')]=_['intersection'](_0x42056f[_0x99b5('0x33')],qs['fields'](_0x5759e0[_0x99b5('0x34')][_0x99b5('0x39')]));_0x7e6cb7[_0x99b5('0x38')]=_0x7e6cb7[_0x99b5('0x38')]['length']?_0x7e6cb7[_0x99b5('0x38')]:_0x42056f[_0x99b5('0x33')];if(!_0x5759e0[_0x99b5('0x34')][_0x99b5('0x3a')](_0x99b5('0x3b'))){_0x7e6cb7['limit']=qs[_0x99b5('0x26')](_0x5759e0[_0x99b5('0x34')][_0x99b5('0x26')]);_0x7e6cb7['offset']=qs['offset'](_0x5759e0[_0x99b5('0x34')][_0x99b5('0x24')]);}_0x7e6cb7['order']=qs[_0x99b5('0x3c')](_0x5759e0[_0x99b5('0x34')][_0x99b5('0x3c')]);_0x7e6cb7[_0x99b5('0x3d')]=qs['filters'](_[_0x99b5('0x3e')](_0x5759e0[_0x99b5('0x34')],_0x42056f[_0x99b5('0x36')]),_0x63af80);if(_0x5759e0[_0x99b5('0x34')][_0x99b5('0x3f')]){_0x7e6cb7[_0x99b5('0x3d')]=_[_0x99b5('0x40')](_0x7e6cb7[_0x99b5('0x3d')],{'$or':_[_0x99b5('0x2f')](_0x63af80,function(_0x15f53d){if(_0x15f53d[_0x99b5('0x31')]!==_0x99b5('0x41')){var _0x150117={};_0x150117[_0x15f53d[_0x99b5('0x2c')]]={'$like':'%'+_0x5759e0[_0x99b5('0x34')][_0x99b5('0x3f')]+'%'};return _0x150117;}})});}_0x7e6cb7=_[_0x99b5('0x40')]({},_0x7e6cb7,_0x5759e0[_0x99b5('0x42')]);var _0x417de0={'where':_0x7e6cb7[_0x99b5('0x3d')]};return db['ChatGroup']['count'](_0x417de0)['then'](function(_0x357a72){_0x4aadb9[_0x99b5('0x27')]=_0x357a72;if(_0x5759e0['query']['includeAll']){_0x7e6cb7[_0x99b5('0x43')]=[{'all':!![]}];}return db[_0x99b5('0x30')][_0x99b5('0x44')](_0x7e6cb7);})['then'](function(_0x499b7b){_0x4aadb9[_0x99b5('0x45')]=_0x499b7b;return _0x4aadb9;})[_0x99b5('0x2a')](respondWithFilteredResult(_0x354243,_0x7e6cb7))['catch'](handleError(_0x354243,null));};exports[_0x99b5('0x46')]=function(_0x360fd3,_0x1f2648){var _0x37e768={'raw':!![],'where':{'id':_0x360fd3['params']['id']}},_0x2f1d5a={};_0x2f1d5a[_0x99b5('0x33')]=_['keys'](db[_0x99b5('0x30')]['rawAttributes']);_0x2f1d5a[_0x99b5('0x34')]=_[_0x99b5('0x35')](_0x360fd3[_0x99b5('0x34')]);_0x2f1d5a['filters']=_[_0x99b5('0x37')](_0x2f1d5a['model'],_0x2f1d5a[_0x99b5('0x34')]);_0x37e768[_0x99b5('0x38')]=_[_0x99b5('0x37')](_0x2f1d5a[_0x99b5('0x33')],qs[_0x99b5('0x39')](_0x360fd3[_0x99b5('0x34')]['fields']));_0x37e768[_0x99b5('0x38')]=_0x37e768['attributes'][_0x99b5('0x47')]?_0x37e768[_0x99b5('0x38')]:_0x2f1d5a[_0x99b5('0x33')];if(_0x360fd3[_0x99b5('0x34')][_0x99b5('0x48')]){_0x37e768['include']=[{'all':!![]}];}_0x37e768=_[_0x99b5('0x40')]({},_0x37e768,_0x360fd3[_0x99b5('0x42')]);return db[_0x99b5('0x30')]['find'](_0x37e768)[_0x99b5('0x2a')](handleEntityNotFound(_0x1f2648,null))['then'](respondWithResult(_0x1f2648,null))['catch'](handleError(_0x1f2648,null));};exports[_0x99b5('0x49')]=function(_0x3de5d1,_0x475407){return db[_0x99b5('0x30')][_0x99b5('0x49')](_0x3de5d1['body'],{})[_0x99b5('0x2a')](respondWithResult(_0x475407,0xc9))[_0x99b5('0x4a')](handleError(_0x475407,null));};exports[_0x99b5('0x29')]=function(_0x1e0ca4,_0x2f6f14){if(_0x1e0ca4[_0x99b5('0x4b')]['id']){delete _0x1e0ca4[_0x99b5('0x4b')]['id'];}return db[_0x99b5('0x30')][_0x99b5('0x4c')]({'where':{'id':_0x1e0ca4['params']['id']}})[_0x99b5('0x2a')](handleEntityNotFound(_0x2f6f14,null))[_0x99b5('0x2a')](saveUpdates(_0x1e0ca4[_0x99b5('0x4b')],null))[_0x99b5('0x2a')](respondWithResult(_0x2f6f14,null))[_0x99b5('0x4a')](handleError(_0x2f6f14,null));};exports[_0x99b5('0x4d')]=function(_0x31923e,_0x22eb9d){return db[_0x99b5('0x30')]['find']({'where':{'id':_0x31923e['params']['id']}})[_0x99b5('0x2a')](handleEntityNotFound(_0x22eb9d,null))[_0x99b5('0x2a')](removeEntity(_0x22eb9d,null))[_0x99b5('0x4a')](handleError(_0x22eb9d,null));};exports[_0x99b5('0x4e')]=function(_0x438f64,_0x82a4cd){return db['ChatGroup'][_0x99b5('0x4e')]()[_0x99b5('0x2a')](respondWithResult(_0x82a4cd,null))[_0x99b5('0x4a')](handleError(_0x82a4cd,null));};exports['getUnread']=function(_0x9391a,_0x36bea1,_0x5c1556){return db[_0x99b5('0x4f')]['count']({'where':{'ChatGroupId':_0x9391a[_0x99b5('0x50')]['id'],'ToId':_0x9391a[_0x99b5('0x51')]['id'],'read':![]}})[_0x99b5('0x2a')](function(_0x1d5d95){return{'id':_[_0x99b5('0x52')](_0x9391a[_0x99b5('0x50')]['id']),'count':_0x1d5d95};})[_0x99b5('0x2a')](respondWithResult(_0x36bea1,null))[_0x99b5('0x4a')](handleError(_0x36bea1,null));};exports[_0x99b5('0x53')]=function(_0x31225c,_0x380a48,_0x433323){return db[_0x99b5('0x30')][_0x99b5('0x4c')]({'where':{'id':_0x31225c[_0x99b5('0x50')]['id']}})[_0x99b5('0x2a')](handleEntityNotFound(_0x380a48,null))['then'](function(_0x287dee){if(_0x287dee){return _0x287dee[_0x99b5('0x53')](_0x31225c[_0x99b5('0x4b')][_0x99b5('0x54')],_[_0x99b5('0x55')](_0x31225c[_0x99b5('0x4b')],[_0x99b5('0x54'),'id'])||{});}})['then'](respondWithResult(_0x380a48,null))[_0x99b5('0x4a')](handleError(_0x380a48,null));};exports[_0x99b5('0x56')]=function(_0x42f229,_0x589551,_0x102005){var _0x578914={};var _0x3a055f={};var _0x4bb5bc;var _0x2d2d39;return db[_0x99b5('0x30')][_0x99b5('0x57')]({'where':{'id':_0x42f229['params']['id']}})[_0x99b5('0x2a')](handleEntityNotFound(_0x589551,null))[_0x99b5('0x2a')](function(_0x322841){if(_0x322841){_0x4bb5bc=_0x322841;_0x3a055f[_0x99b5('0x33')]=_[_0x99b5('0x35')](db[_0x99b5('0x58')][_0x99b5('0x59')]);_0x3a055f[_0x99b5('0x34')]=_[_0x99b5('0x35')](_0x42f229[_0x99b5('0x34')]);_0x3a055f[_0x99b5('0x36')]=_['intersection'](_0x3a055f[_0x99b5('0x33')],_0x3a055f['query']);_0x578914[_0x99b5('0x38')]=_['intersection'](_0x3a055f[_0x99b5('0x33')],qs['fields'](_0x42f229['query'][_0x99b5('0x39')]));_0x578914['attributes']=_0x578914['attributes'][_0x99b5('0x47')]?_0x578914[_0x99b5('0x38')]:_0x3a055f[_0x99b5('0x33')];_0x578914[_0x99b5('0x5a')]=qs[_0x99b5('0x3c')](_0x42f229[_0x99b5('0x34')][_0x99b5('0x3c')]);_0x578914[_0x99b5('0x3d')]=qs[_0x99b5('0x36')](_[_0x99b5('0x3e')](_0x42f229[_0x99b5('0x34')],_0x3a055f[_0x99b5('0x36')]));if(_0x42f229[_0x99b5('0x34')]['filter']){_0x578914[_0x99b5('0x3d')]=_['merge'](_0x578914[_0x99b5('0x3d')],{'$or':_[_0x99b5('0x2f')](_0x578914[_0x99b5('0x38')],function(_0x76220e){var _0x181537={};_0x181537[_0x76220e]={'$like':'%'+_0x42f229[_0x99b5('0x34')][_0x99b5('0x3f')]+'%'};return _0x181537;})});}_0x578914=_['merge']({},_0x578914,_0x42f229[_0x99b5('0x42')]);return _0x4bb5bc[_0x99b5('0x56')](_0x578914);}})[_0x99b5('0x2a')](function(_0x49151f){if(_0x49151f){_0x2d2d39=_0x49151f[_0x99b5('0x47')];if(!_0x42f229['query'][_0x99b5('0x3a')](_0x99b5('0x3b'))){_0x578914['limit']=qs['limit'](_0x42f229[_0x99b5('0x34')][_0x99b5('0x26')]);_0x578914[_0x99b5('0x24')]=qs[_0x99b5('0x24')](_0x42f229[_0x99b5('0x34')]['offset']);}return _0x4bb5bc[_0x99b5('0x56')](_0x578914);}})[_0x99b5('0x2a')](function(_0x55f766){if(_0x55f766){return _0x55f766?{'count':_0x2d2d39,'rows':_0x55f766}:null;}})[_0x99b5('0x2a')](respondWithResult(_0x589551,null))['catch'](handleError(_0x589551,null));};exports[_0x99b5('0x5b')]=function(_0x152a53,_0x247633,_0x1574ac){return db[_0x99b5('0x30')][_0x99b5('0x4c')]({'where':{'id':_0x152a53[_0x99b5('0x50')]['id']}})[_0x99b5('0x2a')](handleEntityNotFound(_0x247633,null))[_0x99b5('0x2a')](function(_0x463e76){if(_0x463e76){return _0x463e76[_0x99b5('0x5b')](_0x152a53[_0x99b5('0x34')]['ids']);}})['then'](respondWithStatusCode(_0x247633,null))['catch'](handleError(_0x247633,null));};exports['addMessage']=function(_0x2d9943,_0x57c53e,_0x4484d8){if(_0x2d9943[_0x99b5('0x4b')]['id']){delete _0x2d9943[_0x99b5('0x4b')]['id'];}return db['ChatGroup'][_0x99b5('0x4c')]({'where':{'id':_0x2d9943[_0x99b5('0x50')]['id']}})[_0x99b5('0x2a')](handleEntityNotFound(_0x57c53e,null))['then'](function(_0xef9964){if(_0xef9964){_0x2d9943['body'][_0x99b5('0x5c')]=_0xef9964['id'];return db[_0x99b5('0x4f')][_0x99b5('0x49')](_0x2d9943['body']);}})[_0x99b5('0x2a')](respondWithResult(_0x57c53e,null))[_0x99b5('0x4a')](handleError(_0x57c53e,null));};exports[_0x99b5('0x5d')]=function(_0x7f0a41,_0x29d07a,_0x465a52){var _0xe475d0={};var _0x306648={};var _0x5dccf7;var _0x50333e;return db[_0x99b5('0x30')][_0x99b5('0x57')]({'where':{'id':_0x7f0a41[_0x99b5('0x50')]['id']}})[_0x99b5('0x2a')](handleEntityNotFound(_0x29d07a,null))[_0x99b5('0x2a')](function(_0x18bc90){if(_0x18bc90){_0x5dccf7=_0x18bc90;_0x306648[_0x99b5('0x33')]=_['keys'](db[_0x99b5('0x4f')][_0x99b5('0x59')]);_0x306648[_0x99b5('0x34')]=_['keys'](_0x7f0a41[_0x99b5('0x34')]);_0x306648[_0x99b5('0x36')]=_['intersection'](_0x306648['model'],_0x306648['query']);_0xe475d0[_0x99b5('0x38')]=_['intersection'](_0x306648['model'],qs['fields'](_0x7f0a41[_0x99b5('0x34')][_0x99b5('0x39')]));_0xe475d0['attributes']=_0xe475d0[_0x99b5('0x38')][_0x99b5('0x47')]?_0xe475d0[_0x99b5('0x38')]:_0x306648['model'];_0xe475d0[_0x99b5('0x5a')]=qs['sort'](_0x7f0a41[_0x99b5('0x34')][_0x99b5('0x3c')]);_0xe475d0['where']=qs[_0x99b5('0x36')](_['pick'](_0x7f0a41[_0x99b5('0x34')],_0x306648[_0x99b5('0x36')]));if(_0x7f0a41['query']['filter']){_0xe475d0[_0x99b5('0x3d')]=_[_0x99b5('0x40')](_0xe475d0[_0x99b5('0x3d')],{'$or':_[_0x99b5('0x2f')](_0xe475d0[_0x99b5('0x38')],function(_0x1e03fa){var _0x233111={};_0x233111[_0x1e03fa]={'$like':'%'+_0x7f0a41[_0x99b5('0x34')][_0x99b5('0x3f')]+'%'};return _0x233111;})});}if(_0x7f0a41['query'][_0x99b5('0x5e')]){var _0x461139=_0x7f0a41[_0x99b5('0x34')][_0x99b5('0x5e')][_0x99b5('0x5f')](',');var _0x3e856b={};_0x3e856b[_0x461139[0x0]]={'$gte':moment(_0x461139[0x1])[_0x99b5('0x60')](_0x99b5('0x61'))};_0xe475d0[_0x99b5('0x3d')]=_[_0x99b5('0x40')](_0xe475d0['where'],_0x3e856b);}_0xe475d0=_[_0x99b5('0x40')]({},_0xe475d0,_0x7f0a41['options']);return _0x5dccf7['getMessages'](_0xe475d0);}})[_0x99b5('0x2a')](function(_0x9b24fb){if(_0x9b24fb){_0x50333e=_0x9b24fb['length'];if(!_0x7f0a41[_0x99b5('0x34')][_0x99b5('0x3a')](_0x99b5('0x3b'))){_0xe475d0[_0x99b5('0x26')]=qs[_0x99b5('0x26')](_0x7f0a41['query'][_0x99b5('0x26')]);_0xe475d0[_0x99b5('0x24')]=qs[_0x99b5('0x24')](_0x7f0a41[_0x99b5('0x34')]['offset']);}return _0x5dccf7[_0x99b5('0x5d')](_0xe475d0);}})[_0x99b5('0x2a')](function(_0x99f92f){if(_0x99f92f){return _0x99f92f?{'count':_0x50333e,'rows':_0x99f92f}:null;}})['then'](respondWithResult(_0x29d07a,null))[_0x99b5('0x4a')](handleError(_0x29d07a,null));}; \ No newline at end of file +var _0xce58=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','ChatGroup','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','params','rawAttributes','find','catch','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','omit','getMembers','findOne','User','pick','removeMembers','ids','addMessage','ChatGroupId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs'];(function(_0x1d7efb,_0x22ee45){var _0x4defac=function(_0x3396f7){while(--_0x3396f7){_0x1d7efb['push'](_0x1d7efb['shift']());}};_0x4defac(++_0x22ee45);}(_0xce58,0x174));var _0x8ce5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce58[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8ce5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ce5('0x1'));var jsonpatch=require(_0x8ce5('0x2'));var rp=require('request-promise');var moment=require(_0x8ce5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8ce5('0x4'));var util=require('util');var path=require('path');var sox=require(_0x8ce5('0x5'));var csv=require(_0x8ce5('0x6'));var ejs=require(_0x8ce5('0x7'));var fs=require('fs');var fs_extra=require(_0x8ce5('0x8'));var _=require('lodash');var squel=require(_0x8ce5('0x9'));var crypto=require(_0x8ce5('0xa'));var jsforce=require(_0x8ce5('0xb'));var deskjs=require(_0x8ce5('0xc'));var toCsv=require(_0x8ce5('0x6'));var querystring=require(_0x8ce5('0xd'));var Papa=require(_0x8ce5('0xe'));var Redis=require('ioredis');var authService=require(_0x8ce5('0xf'));var qs=require(_0x8ce5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ce5('0x11'));var logger=require(_0x8ce5('0x12'))('api');var utils=require(_0x8ce5('0x13'));var config=require(_0x8ce5('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ce5('0x15'))['db'];config[_0x8ce5('0x16')]=_[_0x8ce5('0x17')](config[_0x8ce5('0x16')],{'host':_0x8ce5('0x18'),'port':0x18eb});var socket=require(_0x8ce5('0x19'))(new Redis(config[_0x8ce5('0x16')]));require(_0x8ce5('0x1a'))[_0x8ce5('0x1b')](socket);function respondWithStatusCode(_0x5368b1,_0x97636e){_0x97636e=_0x97636e||0xcc;return function(_0x1332d7){if(_0x1332d7){return _0x5368b1[_0x8ce5('0x1c')](_0x97636e);}return _0x5368b1['status'](_0x97636e)['end']();};}function respondWithResult(_0x39204d,_0x1f665f){_0x1f665f=_0x1f665f||0xc8;return function(_0x5633cb){if(_0x5633cb){return _0x39204d['status'](_0x1f665f)[_0x8ce5('0x1d')](_0x5633cb);}};}function respondWithFilteredResult(_0xd34aed,_0x494f1d){return function(_0x3ec98e){if(_0x3ec98e){var _0x512dd0=typeof _0x494f1d['offset']===_0x8ce5('0x1e')&&typeof _0x494f1d[_0x8ce5('0x1f')]===_0x8ce5('0x1e');var _0x1c0043=_0x3ec98e['count'];var _0x26e3c2=_0x512dd0?0x0:_0x494f1d['offset'];var _0x5867ca=_0x512dd0?_0x3ec98e[_0x8ce5('0x20')]:_0x494f1d[_0x8ce5('0x21')]+_0x494f1d[_0x8ce5('0x1f')];var _0x4d38b4;if(_0x5867ca>=_0x1c0043){_0x5867ca=_0x1c0043;_0x4d38b4=0xc8;}else{_0x4d38b4=0xce;}_0xd34aed[_0x8ce5('0x22')](_0x4d38b4);return _0xd34aed[_0x8ce5('0x23')](_0x8ce5('0x24'),_0x26e3c2+'-'+_0x5867ca+'/'+_0x1c0043)[_0x8ce5('0x1d')](_0x3ec98e);}return null;};}function patchUpdates(_0x2184ed){return function(_0x22884e){try{jsonpatch[_0x8ce5('0x25')](_0x22884e,_0x2184ed,!![]);}catch(_0x3b365e){return BPromise[_0x8ce5('0x26')](_0x3b365e);}return _0x22884e[_0x8ce5('0x27')]();};}function saveUpdates(_0x45ec35,_0x2f3463){return function(_0x4d50cc){if(_0x4d50cc){return _0x4d50cc['update'](_0x45ec35)[_0x8ce5('0x28')](function(_0x4ea5b0){return _0x4ea5b0;});}return null;};}function removeEntity(_0x18df06,_0x2c901a){return function(_0x12cc71){if(_0x12cc71){return _0x12cc71[_0x8ce5('0x29')]()[_0x8ce5('0x28')](function(){_0x18df06['status'](0xcc)[_0x8ce5('0x2a')]();});}};}function handleEntityNotFound(_0x58b61f,_0xee89dc){return function(_0x3616ec){if(!_0x3616ec){_0x58b61f[_0x8ce5('0x1c')](0x194);}return _0x3616ec;};}function handleError(_0x58f6db,_0xcd9264){_0xcd9264=_0xcd9264||0x1f4;return function(_0x3fd0a2){logger[_0x8ce5('0x2b')](_0x3fd0a2[_0x8ce5('0x2c')]);if(_0x3fd0a2[_0x8ce5('0x2d')]){delete _0x3fd0a2['name'];}_0x58f6db[_0x8ce5('0x22')](_0xcd9264)['send'](_0x3fd0a2);};}exports[_0x8ce5('0x2e')]=function(_0x378aff,_0x453b9e){var _0x44c449={},_0x393ddb={},_0x42bb98={'count':0x0,'rows':[]};var _0x8c973d=_['map'](db[_0x8ce5('0x2f')]['rawAttributes'],function(_0x5c5b4f){return{'name':_0x5c5b4f[_0x8ce5('0x30')],'type':_0x5c5b4f[_0x8ce5('0x31')][_0x8ce5('0x32')]};});_0x393ddb[_0x8ce5('0x33')]=_[_0x8ce5('0x34')](_0x8c973d,_0x8ce5('0x2d'));_0x393ddb[_0x8ce5('0x35')]=_[_0x8ce5('0x36')](_0x378aff['query']);_0x393ddb[_0x8ce5('0x37')]=_[_0x8ce5('0x38')](_0x393ddb[_0x8ce5('0x33')],_0x393ddb[_0x8ce5('0x35')]);_0x44c449[_0x8ce5('0x39')]=_[_0x8ce5('0x38')](_0x393ddb['model'],qs[_0x8ce5('0x3a')](_0x378aff[_0x8ce5('0x35')][_0x8ce5('0x3a')]));_0x44c449[_0x8ce5('0x39')]=_0x44c449[_0x8ce5('0x39')][_0x8ce5('0x3b')]?_0x44c449['attributes']:_0x393ddb['model'];if(!_0x378aff[_0x8ce5('0x35')][_0x8ce5('0x3c')](_0x8ce5('0x3d'))){_0x44c449['limit']=qs[_0x8ce5('0x1f')](_0x378aff['query'][_0x8ce5('0x1f')]);_0x44c449['offset']=qs[_0x8ce5('0x21')](_0x378aff[_0x8ce5('0x35')]['offset']);}_0x44c449[_0x8ce5('0x3e')]=qs[_0x8ce5('0x3f')](_0x378aff[_0x8ce5('0x35')]['sort']);_0x44c449['where']=qs[_0x8ce5('0x37')](_['pick'](_0x378aff['query'],_0x393ddb[_0x8ce5('0x37')]),_0x8c973d);if(_0x378aff[_0x8ce5('0x35')][_0x8ce5('0x40')]){_0x44c449[_0x8ce5('0x41')]=_['merge'](_0x44c449['where'],{'$or':_['map'](_0x8c973d,function(_0x3cbdc4){if(_0x3cbdc4[_0x8ce5('0x31')]!=='VIRTUAL'){var _0x145a57={};_0x145a57[_0x3cbdc4[_0x8ce5('0x2d')]]={'$like':'%'+_0x378aff[_0x8ce5('0x35')][_0x8ce5('0x40')]+'%'};return _0x145a57;}})});}_0x44c449=_[_0x8ce5('0x42')]({},_0x44c449,_0x378aff[_0x8ce5('0x43')]);var _0x528c77={'where':_0x44c449['where']};return db['ChatGroup']['count'](_0x528c77)[_0x8ce5('0x28')](function(_0x193b2c){_0x42bb98['count']=_0x193b2c;if(_0x378aff['query'][_0x8ce5('0x44')]){_0x44c449[_0x8ce5('0x45')]=[{'all':!![]}];}return db[_0x8ce5('0x2f')][_0x8ce5('0x46')](_0x44c449);})[_0x8ce5('0x28')](function(_0x1be97c){_0x42bb98['rows']=_0x1be97c;return _0x42bb98;})[_0x8ce5('0x28')](respondWithFilteredResult(_0x453b9e,_0x44c449))['catch'](handleError(_0x453b9e,null));};exports['show']=function(_0x490413,_0x555897){var _0x39a189={'raw':!![],'where':{'id':_0x490413[_0x8ce5('0x47')]['id']}},_0x51c430={};_0x51c430['model']=_[_0x8ce5('0x36')](db[_0x8ce5('0x2f')][_0x8ce5('0x48')]);_0x51c430['query']=_['keys'](_0x490413[_0x8ce5('0x35')]);_0x51c430['filters']=_[_0x8ce5('0x38')](_0x51c430[_0x8ce5('0x33')],_0x51c430[_0x8ce5('0x35')]);_0x39a189[_0x8ce5('0x39')]=_[_0x8ce5('0x38')](_0x51c430[_0x8ce5('0x33')],qs[_0x8ce5('0x3a')](_0x490413[_0x8ce5('0x35')]['fields']));_0x39a189[_0x8ce5('0x39')]=_0x39a189[_0x8ce5('0x39')][_0x8ce5('0x3b')]?_0x39a189[_0x8ce5('0x39')]:_0x51c430[_0x8ce5('0x33')];if(_0x490413[_0x8ce5('0x35')][_0x8ce5('0x44')]){_0x39a189['include']=[{'all':!![]}];}_0x39a189=_[_0x8ce5('0x42')]({},_0x39a189,_0x490413['options']);return db[_0x8ce5('0x2f')][_0x8ce5('0x49')](_0x39a189)[_0x8ce5('0x28')](handleEntityNotFound(_0x555897,null))[_0x8ce5('0x28')](respondWithResult(_0x555897,null))[_0x8ce5('0x4a')](handleError(_0x555897,null));};exports[_0x8ce5('0x4b')]=function(_0x31f697,_0x55f90f){return db[_0x8ce5('0x2f')][_0x8ce5('0x4b')](_0x31f697[_0x8ce5('0x4c')],{})[_0x8ce5('0x28')](respondWithResult(_0x55f90f,0xc9))[_0x8ce5('0x4a')](handleError(_0x55f90f,null));};exports['update']=function(_0x5c44b3,_0x59d9da){if(_0x5c44b3[_0x8ce5('0x4c')]['id']){delete _0x5c44b3[_0x8ce5('0x4c')]['id'];}return db[_0x8ce5('0x2f')][_0x8ce5('0x49')]({'where':{'id':_0x5c44b3['params']['id']}})['then'](handleEntityNotFound(_0x59d9da,null))[_0x8ce5('0x28')](saveUpdates(_0x5c44b3['body'],null))[_0x8ce5('0x28')](respondWithResult(_0x59d9da,null))[_0x8ce5('0x4a')](handleError(_0x59d9da,null));};exports['destroy']=function(_0x5a1ee1,_0x3796e2){return db['ChatGroup']['find']({'where':{'id':_0x5a1ee1[_0x8ce5('0x47')]['id']}})[_0x8ce5('0x28')](handleEntityNotFound(_0x3796e2,null))['then'](removeEntity(_0x3796e2,null))[_0x8ce5('0x4a')](handleError(_0x3796e2,null));};exports[_0x8ce5('0x4d')]=function(_0x5380b1,_0x7eab9){return db[_0x8ce5('0x2f')][_0x8ce5('0x4d')]()[_0x8ce5('0x28')](respondWithResult(_0x7eab9,null))[_0x8ce5('0x4a')](handleError(_0x7eab9,null));};exports[_0x8ce5('0x4e')]=function(_0x17b880,_0x283087,_0x1d9deb){return db[_0x8ce5('0x4f')][_0x8ce5('0x20')]({'where':{'ChatGroupId':_0x17b880[_0x8ce5('0x47')]['id'],'ToId':_0x17b880['user']['id'],'read':![]}})['then'](function(_0x5a3abe){return{'id':_[_0x8ce5('0x50')](_0x17b880['params']['id']),'count':_0x5a3abe};})['then'](respondWithResult(_0x283087,null))['catch'](handleError(_0x283087,null));};exports['addMembers']=function(_0x4588f4,_0xc84374,_0x48f7e4){return db[_0x8ce5('0x2f')][_0x8ce5('0x49')]({'where':{'id':_0x4588f4[_0x8ce5('0x47')]['id']}})[_0x8ce5('0x28')](handleEntityNotFound(_0xc84374,null))[_0x8ce5('0x28')](function(_0x5896ef){if(_0x5896ef){return _0x5896ef[_0x8ce5('0x51')](_0x4588f4[_0x8ce5('0x4c')]['ids'],_[_0x8ce5('0x52')](_0x4588f4[_0x8ce5('0x4c')],['ids','id'])||{});}})['then'](respondWithResult(_0xc84374,null))['catch'](handleError(_0xc84374,null));};exports[_0x8ce5('0x53')]=function(_0x5254b4,_0x41b78c,_0x16e3ab){var _0xd58b53={};var _0x2bfece={};var _0x3b178c;var _0x43329c;return db[_0x8ce5('0x2f')][_0x8ce5('0x54')]({'where':{'id':_0x5254b4[_0x8ce5('0x47')]['id']}})[_0x8ce5('0x28')](handleEntityNotFound(_0x41b78c,null))[_0x8ce5('0x28')](function(_0x3aa8f2){if(_0x3aa8f2){_0x3b178c=_0x3aa8f2;_0x2bfece[_0x8ce5('0x33')]=_[_0x8ce5('0x36')](db[_0x8ce5('0x55')][_0x8ce5('0x48')]);_0x2bfece['query']=_['keys'](_0x5254b4['query']);_0x2bfece[_0x8ce5('0x37')]=_[_0x8ce5('0x38')](_0x2bfece[_0x8ce5('0x33')],_0x2bfece[_0x8ce5('0x35')]);_0xd58b53['attributes']=_[_0x8ce5('0x38')](_0x2bfece[_0x8ce5('0x33')],qs[_0x8ce5('0x3a')](_0x5254b4[_0x8ce5('0x35')]['fields']));_0xd58b53['attributes']=_0xd58b53[_0x8ce5('0x39')][_0x8ce5('0x3b')]?_0xd58b53['attributes']:_0x2bfece[_0x8ce5('0x33')];_0xd58b53[_0x8ce5('0x3e')]=qs[_0x8ce5('0x3f')](_0x5254b4[_0x8ce5('0x35')][_0x8ce5('0x3f')]);_0xd58b53[_0x8ce5('0x41')]=qs['filters'](_[_0x8ce5('0x56')](_0x5254b4[_0x8ce5('0x35')],_0x2bfece['filters']));if(_0x5254b4[_0x8ce5('0x35')][_0x8ce5('0x40')]){_0xd58b53[_0x8ce5('0x41')]=_[_0x8ce5('0x42')](_0xd58b53[_0x8ce5('0x41')],{'$or':_[_0x8ce5('0x34')](_0xd58b53[_0x8ce5('0x39')],function(_0xa5e296){var _0x1670d6={};_0x1670d6[_0xa5e296]={'$like':'%'+_0x5254b4[_0x8ce5('0x35')][_0x8ce5('0x40')]+'%'};return _0x1670d6;})});}_0xd58b53=_['merge']({},_0xd58b53,_0x5254b4[_0x8ce5('0x43')]);return _0x3b178c[_0x8ce5('0x53')](_0xd58b53);}})[_0x8ce5('0x28')](function(_0x5eedf6){if(_0x5eedf6){_0x43329c=_0x5eedf6[_0x8ce5('0x3b')];if(!_0x5254b4[_0x8ce5('0x35')][_0x8ce5('0x3c')](_0x8ce5('0x3d'))){_0xd58b53[_0x8ce5('0x1f')]=qs[_0x8ce5('0x1f')](_0x5254b4[_0x8ce5('0x35')]['limit']);_0xd58b53[_0x8ce5('0x21')]=qs[_0x8ce5('0x21')](_0x5254b4['query'][_0x8ce5('0x21')]);}return _0x3b178c['getMembers'](_0xd58b53);}})[_0x8ce5('0x28')](function(_0x138d7b){if(_0x138d7b){return _0x138d7b?{'count':_0x43329c,'rows':_0x138d7b}:null;}})[_0x8ce5('0x28')](respondWithResult(_0x41b78c,null))[_0x8ce5('0x4a')](handleError(_0x41b78c,null));};exports[_0x8ce5('0x57')]=function(_0x44a858,_0x53991b,_0x21edd9){return db[_0x8ce5('0x2f')][_0x8ce5('0x49')]({'where':{'id':_0x44a858[_0x8ce5('0x47')]['id']}})[_0x8ce5('0x28')](handleEntityNotFound(_0x53991b,null))[_0x8ce5('0x28')](function(_0x2bbd3e){if(_0x2bbd3e){return _0x2bbd3e[_0x8ce5('0x57')](_0x44a858[_0x8ce5('0x35')][_0x8ce5('0x58')]);}})[_0x8ce5('0x28')](respondWithStatusCode(_0x53991b,null))[_0x8ce5('0x4a')](handleError(_0x53991b,null));};exports[_0x8ce5('0x59')]=function(_0x95cfe8,_0x41419e,_0x496f62){if(_0x95cfe8['body']['id']){delete _0x95cfe8[_0x8ce5('0x4c')]['id'];}return db[_0x8ce5('0x2f')][_0x8ce5('0x49')]({'where':{'id':_0x95cfe8[_0x8ce5('0x47')]['id']}})[_0x8ce5('0x28')](handleEntityNotFound(_0x41419e,null))[_0x8ce5('0x28')](function(_0x2a55f4){if(_0x2a55f4){_0x95cfe8['body'][_0x8ce5('0x5a')]=_0x2a55f4['id'];return db['ChatInternalMessage'][_0x8ce5('0x4b')](_0x95cfe8[_0x8ce5('0x4c')]);}})[_0x8ce5('0x28')](respondWithResult(_0x41419e,null))[_0x8ce5('0x4a')](handleError(_0x41419e,null));};exports['getMessages']=function(_0x94b356,_0x5abbfd,_0x97527c){var _0x5d5f18={};var _0xca245d={};var _0x58b1a2;var _0x550de8;return db[_0x8ce5('0x2f')]['findOne']({'where':{'id':_0x94b356['params']['id']}})['then'](handleEntityNotFound(_0x5abbfd,null))[_0x8ce5('0x28')](function(_0x277bc1){if(_0x277bc1){_0x58b1a2=_0x277bc1;_0xca245d[_0x8ce5('0x33')]=_[_0x8ce5('0x36')](db[_0x8ce5('0x4f')][_0x8ce5('0x48')]);_0xca245d[_0x8ce5('0x35')]=_[_0x8ce5('0x36')](_0x94b356[_0x8ce5('0x35')]);_0xca245d['filters']=_[_0x8ce5('0x38')](_0xca245d[_0x8ce5('0x33')],_0xca245d['query']);_0x5d5f18[_0x8ce5('0x39')]=_[_0x8ce5('0x38')](_0xca245d[_0x8ce5('0x33')],qs[_0x8ce5('0x3a')](_0x94b356[_0x8ce5('0x35')]['fields']));_0x5d5f18['attributes']=_0x5d5f18[_0x8ce5('0x39')]['length']?_0x5d5f18[_0x8ce5('0x39')]:_0xca245d['model'];_0x5d5f18[_0x8ce5('0x3e')]=qs['sort'](_0x94b356[_0x8ce5('0x35')][_0x8ce5('0x3f')]);_0x5d5f18['where']=qs[_0x8ce5('0x37')](_[_0x8ce5('0x56')](_0x94b356[_0x8ce5('0x35')],_0xca245d[_0x8ce5('0x37')]));if(_0x94b356[_0x8ce5('0x35')][_0x8ce5('0x40')]){_0x5d5f18[_0x8ce5('0x41')]=_[_0x8ce5('0x42')](_0x5d5f18[_0x8ce5('0x41')],{'$or':_[_0x8ce5('0x34')](_0x5d5f18[_0x8ce5('0x39')],function(_0x31a055){var _0x41adc6={};_0x41adc6[_0x31a055]={'$like':'%'+_0x94b356[_0x8ce5('0x35')][_0x8ce5('0x40')]+'%'};return _0x41adc6;})});}if(_0x94b356[_0x8ce5('0x35')]['$gte']){var _0x5d1582=_0x94b356['query'][_0x8ce5('0x5b')]['split'](',');var _0x336afa={};_0x336afa[_0x5d1582[0x0]]={'$gte':moment(_0x5d1582[0x1])[_0x8ce5('0x5c')](_0x8ce5('0x5d'))};_0x5d5f18[_0x8ce5('0x41')]=_[_0x8ce5('0x42')](_0x5d5f18[_0x8ce5('0x41')],_0x336afa);}_0x5d5f18=_[_0x8ce5('0x42')]({},_0x5d5f18,_0x94b356['options']);return _0x58b1a2[_0x8ce5('0x5e')](_0x5d5f18);}})[_0x8ce5('0x28')](function(_0x5edeb5){if(_0x5edeb5){_0x550de8=_0x5edeb5[_0x8ce5('0x3b')];if(!_0x94b356[_0x8ce5('0x35')]['hasOwnProperty'](_0x8ce5('0x3d'))){_0x5d5f18['limit']=qs[_0x8ce5('0x1f')](_0x94b356[_0x8ce5('0x35')][_0x8ce5('0x1f')]);_0x5d5f18[_0x8ce5('0x21')]=qs[_0x8ce5('0x21')](_0x94b356['query'][_0x8ce5('0x21')]);}return _0x58b1a2[_0x8ce5('0x5e')](_0x5d5f18);}})[_0x8ce5('0x28')](function(_0x3cd35f){if(_0x3cd35f){return _0x3cd35f?{'count':_0x550de8,'rows':_0x3cd35f}:null;}})[_0x8ce5('0x28')](respondWithResult(_0x5abbfd,null))[_0x8ce5('0x4a')](handleError(_0x5abbfd,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index d7f924d..ed5c4bb 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 _0x8a42=['hook','exports','events','../../mysqldb','ChatGroup','save','remove','emit','hasOwnProperty'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x8a42,0xe3));var _0x28a4=function(_0x24603f,_0x1d7b0a){_0x24603f=_0x24603f-0x0;var _0x244037=_0x8a42[_0x24603f];return _0x244037;};'use strict';var EventEmitter=require(_0x28a4('0x0'));var ChatGroup=require(_0x28a4('0x1'))['db'][_0x28a4('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x28a4('0x3'),'afterUpdate':'update','afterDestroy':_0x28a4('0x4')};function emitEvent(_0x4a69c0){return function(_0x4931f6,_0x1f7458,_0x14576d){ChatGroupEvents[_0x28a4('0x5')](_0x4a69c0+':'+_0x4931f6['id'],_0x4931f6);ChatGroupEvents[_0x28a4('0x5')](_0x4a69c0,_0x4931f6);_0x14576d(null);};}for(var e in events){if(events[_0x28a4('0x6')](e)){var event=events[e];ChatGroup[_0x28a4('0x7')](e,emitEvent(event));}}module[_0x28a4('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x42fa=['hook','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x5db4b0,_0x17dfb5){var _0x126c9f=function(_0x1f87f2){while(--_0x1f87f2){_0x5db4b0['push'](_0x5db4b0['shift']());}};_0x126c9f(++_0x17dfb5);}(_0x42fa,0x161));var _0xa42f=function(_0x4a7bdf,_0x5f1653){_0x4a7bdf=_0x4a7bdf-0x0;var _0x3c4224=_0x42fa[_0x4a7bdf];return _0x3c4224;};'use strict';var EventEmitter=require(_0xa42f('0x0'));var ChatGroup=require(_0xa42f('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa42f('0x2'),'afterUpdate':_0xa42f('0x3'),'afterDestroy':_0xa42f('0x4')};function emitEvent(_0xe7cc95){return function(_0x365971,_0x657df3,_0x3aabbe){ChatGroupEvents[_0xa42f('0x5')](_0xe7cc95+':'+_0x365971['id'],_0x365971);ChatGroupEvents['emit'](_0xe7cc95,_0x365971);_0x3aabbe(null);};}for(var e in events){if(events[_0xa42f('0x6')](e)){var event=events[e];ChatGroup[_0xa42f('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index a490835..14d5397 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 _0x55da=['ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatGroup.attributes','exports','define'];(function(_0xfb1e57,_0x1f9721){var _0x57c59a=function(_0x2ad978){while(--_0x2ad978){_0xfb1e57['push'](_0xfb1e57['shift']());}};_0x57c59a(++_0x1f9721);}(_0x55da,0x18e));var _0xa55d=function(_0xc7f834,_0x5f1c41){_0xc7f834=_0xc7f834-0x0;var _0x4bee09=_0x55da[_0xc7f834];return _0x4bee09;};'use strict';var _=require('lodash');var util=require(_0xa55d('0x0'));var logger=require(_0xa55d('0x1'))(_0xa55d('0x2'));var moment=require(_0xa55d('0x3'));var BPromise=require(_0xa55d('0x4'));var rp=require(_0xa55d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa55d('0x6'));var attributes=require(_0xa55d('0x7'));module[_0xa55d('0x8')]=function(_0x56db34,_0x4605cd){return _0x56db34[_0xa55d('0x9')](_0xa55d('0xa'),attributes,{'tableName':_0xa55d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7481=['path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','util','../../config/logger','api','moment','request-promise'];(function(_0x37cca2,_0x28e492){var _0x2dfe50=function(_0x2327db){while(--_0x2327db){_0x37cca2['push'](_0x37cca2['shift']());}};_0x2dfe50(++_0x28e492);}(_0x7481,0x1cf));var _0x1748=function(_0x21dcac,_0x5e9ce8){_0x21dcac=_0x21dcac-0x0;var _0x4cf524=_0x7481[_0x21dcac];return _0x4cf524;};'use strict';var _=require('lodash');var util=require(_0x1748('0x0'));var logger=require(_0x1748('0x1'))(_0x1748('0x2'));var moment=require(_0x1748('0x3'));var BPromise=require('bluebird');var rp=require(_0x1748('0x4'));var fs=require('fs');var path=require(_0x1748('0x5'));var rimraf=require(_0x1748('0x6'));var config=require(_0x1748('0x7'));var attributes=require(_0x1748('0x8'));module[_0x1748('0x9')]=function(_0x533587,_0x38672b){return _0x533587[_0x1748('0xa')]('ChatGroup',attributes,{'tableName':_0x1748('0xb'),'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 64790de..0d4bad9 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 _0xf6d1=['ChatGroup,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3b9d79,_0x42f721){var _0x16d93e=function(_0x15d370){while(--_0x15d370){_0x3b9d79['push'](_0x3b9d79['shift']());}};_0x16d93e(++_0x42f721);}(_0xf6d1,0x99));var _0x1f6d=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xf6d1[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x1f6d('0x0'));var util=require(_0x1f6d('0x1'));var moment=require(_0x1f6d('0x2'));var BPromise=require(_0x1f6d('0x3'));var rs=require(_0x1f6d('0x4'));var fs=require('fs');var Redis=require(_0x1f6d('0x5'));var db=require(_0x1f6d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f6d('0x7'))('rpc');var config=require(_0x1f6d('0x8'));var jayson=require(_0x1f6d('0x9'));var client=jayson[_0x1f6d('0xa')][_0x1f6d('0xb')]({'port':0x232a});config[_0x1f6d('0xc')]=_[_0x1f6d('0xd')](config[_0x1f6d('0xc')],{'host':_0x1f6d('0xe'),'port':0x18eb});var socket=require(_0x1f6d('0xf'))(new Redis(config[_0x1f6d('0xc')]));require(_0x1f6d('0x10'))[_0x1f6d('0x11')](socket);function respondWithRpcPromise(_0x523958,_0x25ec55,_0x4f33bd){return new BPromise(function(_0x456882,_0x4aaba1){return client[_0x1f6d('0x12')](_0x523958,_0x4f33bd)[_0x1f6d('0x13')](function(_0x3d813c){logger[_0x1f6d('0x14')]('ChatGroup,\x20%s,\x20%s',_0x25ec55,'request\x20sent');logger[_0x1f6d('0x15')](_0x1f6d('0x16'),_0x25ec55,_0x1f6d('0x17'),JSON[_0x1f6d('0x18')](_0x3d813c));if(_0x3d813c[_0x1f6d('0x19')]){if(_0x3d813c[_0x1f6d('0x19')][_0x1f6d('0x1a')]===0x1f4){logger[_0x1f6d('0x19')](_0x1f6d('0x1b'),_0x25ec55,_0x3d813c[_0x1f6d('0x19')]['message']);return _0x4aaba1(_0x3d813c[_0x1f6d('0x19')][_0x1f6d('0x1c')]);}logger[_0x1f6d('0x19')]('ChatGroup,\x20%s,\x20%s',_0x25ec55,_0x3d813c[_0x1f6d('0x19')][_0x1f6d('0x1c')]);return _0x456882(_0x3d813c['error'][_0x1f6d('0x1c')]);}else{logger[_0x1f6d('0x14')](_0x1f6d('0x1b'),_0x25ec55,_0x1f6d('0x17'));_0x456882(_0x3d813c[_0x1f6d('0x1d')][_0x1f6d('0x1c')]);}})['catch'](function(_0x24c5b8){logger[_0x1f6d('0x19')](_0x1f6d('0x1b'),_0x25ec55,_0x24c5b8);_0x4aaba1(_0x24c5b8);});});} \ No newline at end of file +var _0x871e=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2f26a0,_0x30413c){var _0x34e319=function(_0x160a77){while(--_0x160a77){_0x2f26a0['push'](_0x2f26a0['shift']());}};_0x34e319(++_0x30413c);}(_0x871e,0x1b0));var _0xe871=function(_0x20638e,_0x5ec840){_0x20638e=_0x20638e-0x0;var _0x23fad9=_0x871e[_0x20638e];return _0x23fad9;};'use strict';var _=require(_0xe871('0x0'));var util=require('util');var moment=require(_0xe871('0x1'));var BPromise=require(_0xe871('0x2'));var rs=require(_0xe871('0x3'));var fs=require('fs');var Redis=require(_0xe871('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe871('0x5'));var logger=require(_0xe871('0x6'))(_0xe871('0x7'));var config=require(_0xe871('0x8'));var jayson=require(_0xe871('0x9'));var client=jayson[_0xe871('0xa')][_0xe871('0xb')]({'port':0x232a});config[_0xe871('0xc')]=_[_0xe871('0xd')](config[_0xe871('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe871('0xe'))(new Redis(config['redis']));require('./chatGroup.socket')[_0xe871('0xf')](socket);function respondWithRpcPromise(_0x312687,_0x17a913,_0x5bdd86){return new BPromise(function(_0x8871ff,_0x39c82e){return client[_0xe871('0x10')](_0x312687,_0x5bdd86)[_0xe871('0x11')](function(_0x3c85a8){logger[_0xe871('0x12')](_0xe871('0x13'),_0x17a913,'request\x20sent');logger[_0xe871('0x14')](_0xe871('0x15'),_0x17a913,_0xe871('0x16'),JSON[_0xe871('0x17')](_0x3c85a8));if(_0x3c85a8[_0xe871('0x18')]){if(_0x3c85a8[_0xe871('0x18')][_0xe871('0x19')]===0x1f4){logger[_0xe871('0x18')](_0xe871('0x13'),_0x17a913,_0x3c85a8['error'][_0xe871('0x1a')]);return _0x39c82e(_0x3c85a8['error']['message']);}logger[_0xe871('0x18')](_0xe871('0x13'),_0x17a913,_0x3c85a8[_0xe871('0x18')][_0xe871('0x1a')]);return _0x8871ff(_0x3c85a8[_0xe871('0x18')][_0xe871('0x1a')]);}else{logger[_0xe871('0x12')](_0xe871('0x13'),_0x17a913,_0xe871('0x16'));_0x8871ff(_0x3c85a8['result'][_0xe871('0x1a')]);}})['catch'](function(_0x418b2d){logger[_0xe871('0x18')]('ChatGroup,\x20%s,\x20%s',_0x17a913,_0x418b2d);_0x39c82e(_0x418b2d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 420d533..2f47268 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 _0x5186=['chatGroup:','save','remove','update','emit','removeListener'];(function(_0x208af0,_0x25e792){var _0x5ac16a=function(_0x5aa3e6){while(--_0x5aa3e6){_0x208af0['push'](_0x208af0['shift']());}};_0x5ac16a(++_0x25e792);}(_0x5186,0x11b));var _0x6518=function(_0x1cecaf,_0x5f5210){_0x1cecaf=_0x1cecaf-0x0;var _0x287e6c=_0x5186[_0x1cecaf];return _0x287e6c;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x6518('0x0'),_0x6518('0x1'),_0x6518('0x2')];function createListener(_0x4ad76b,_0x820a35){return function(_0x4fe778){_0x820a35[_0x6518('0x3')](_0x4ad76b,_0x4fe778);};}function removeListener(_0x17a541,_0x59a630){return function(){ChatGroupEvents[_0x6518('0x4')](_0x17a541,_0x59a630);};}exports['register']=function(_0x1d2c59){for(var _0x583882=0x0,_0x46c6cf=events['length'];_0x583882<_0x46c6cf;_0x583882++){var _0x16e757=events[_0x583882];var _0x902ff8=createListener(_0x6518('0x5')+_0x16e757,_0x1d2c59);ChatGroupEvents['on'](_0x16e757,_0x902ff8);}}; \ No newline at end of file +var _0x141c=['emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove','update'];(function(_0x169956,_0xca39f5){var _0x5045dd=function(_0x51b8b6){while(--_0x51b8b6){_0x169956['push'](_0x169956['shift']());}};_0x5045dd(++_0xca39f5);}(_0x141c,0x1f4));var _0xc141=function(_0xd0e827,_0x417431){_0xd0e827=_0xd0e827-0x0;var _0x158b48=_0x141c[_0xd0e827];return _0x158b48;};'use strict';var ChatGroupEvents=require(_0xc141('0x0'));var events=[_0xc141('0x1'),_0xc141('0x2'),_0xc141('0x3')];function createListener(_0x5e9844,_0x56d02a){return function(_0x4aed89){_0x56d02a[_0xc141('0x4')](_0x5e9844,_0x4aed89);};}function removeListener(_0x3d316c,_0x387bd4){return function(){ChatGroupEvents[_0xc141('0x5')](_0x3d316c,_0x387bd4);};}exports[_0xc141('0x6')]=function(_0x233176){for(var _0x4e151b=0x0,_0x5129d8=events[_0xc141('0x7')];_0x4e151b<_0x5129d8;_0x4e151b++){var _0x501d43=events[_0x4e151b];var _0x1ab2aa=createListener(_0xc141('0x8')+_0x501d43,_0x233176);ChatGroupEvents['on'](_0x501d43,_0x1ab2aa);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 1287763..432a3be 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 _0xb980=['/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','addMessage','put','update','destroy','delete','removeMembers','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3c2813,_0x36a0ad){var _0x5eb112=function(_0x4d5286){while(--_0x4d5286){_0x3c2813['push'](_0x3c2813['shift']());}};_0x5eb112(++_0x36a0ad);}(_0xb980,0x1e3));var _0x0b98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb980[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0b98('0x0'));var util=require(_0x0b98('0x1'));var path=require(_0x0b98('0x2'));var timeout=require('connect-timeout');var express=require(_0x0b98('0x3'));var router=express['Router']();var fs_extra=require(_0x0b98('0x4'));var auth=require(_0x0b98('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0b98('0x6'));var controller=require(_0x0b98('0x7'));router[_0x0b98('0x8')]('/',auth[_0x0b98('0x9')](),controller[_0x0b98('0xa')]);router[_0x0b98('0x8')](_0x0b98('0xb'),auth['isAuthenticated'](),controller[_0x0b98('0xc')]);router[_0x0b98('0x8')](_0x0b98('0xd'),auth[_0x0b98('0x9')](),controller[_0x0b98('0xe')]);router[_0x0b98('0x8')](_0x0b98('0xf'),auth[_0x0b98('0x9')](),controller[_0x0b98('0x10')]);router['get'](_0x0b98('0x11'),auth[_0x0b98('0x9')](),controller[_0x0b98('0x12')]);router[_0x0b98('0x8')](_0x0b98('0x13'),auth[_0x0b98('0x9')](),controller[_0x0b98('0x14')]);router['post']('/',auth[_0x0b98('0x9')](),controller[_0x0b98('0x15')]);router[_0x0b98('0x16')]('/:id/members',auth[_0x0b98('0x9')](),controller[_0x0b98('0x17')]);router[_0x0b98('0x16')]('/:id/messages',auth['isAuthenticated'](),controller[_0x0b98('0x18')]);router[_0x0b98('0x19')](_0x0b98('0xd'),auth[_0x0b98('0x9')](),controller[_0x0b98('0x1a')]);router['delete'](_0x0b98('0xd'),auth['isAuthenticated'](),controller[_0x0b98('0x1b')]);router[_0x0b98('0x1c')]('/:id/members',auth[_0x0b98('0x9')](),controller[_0x0b98('0x1d')]);module[_0x0b98('0x1e')]=router; \ No newline at end of file +var _0xe43b=['Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','/:id/unread','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','update','delete','removeMembers','exports','multer','util','path','connect-timeout','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe43b,0xbf));var _0xbe43=function(_0x2fbf2c,_0xb5a8f9){_0x2fbf2c=_0x2fbf2c-0x0;var _0x132005=_0xe43b[_0x2fbf2c];return _0x132005;};'use strict';var multer=require(_0xbe43('0x0'));var util=require(_0xbe43('0x1'));var path=require(_0xbe43('0x2'));var timeout=require(_0xbe43('0x3'));var express=require(_0xbe43('0x4'));var router=express[_0xbe43('0x5')]();var fs_extra=require(_0xbe43('0x6'));var auth=require(_0xbe43('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbe43('0x8'));var controller=require('./chatGroup.controller');router[_0xbe43('0x9')]('/',auth['isAuthenticated'](),controller[_0xbe43('0xa')]);router['get'](_0xbe43('0xb'),auth['isAuthenticated'](),controller[_0xbe43('0xc')]);router['get'](_0xbe43('0xd'),auth[_0xbe43('0xe')](),controller['show']);router[_0xbe43('0x9')](_0xbe43('0xf'),auth['isAuthenticated'](),controller['getUnread']);router[_0xbe43('0x9')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xbe43('0x9')](_0xbe43('0x10'),auth[_0xbe43('0xe')](),controller[_0xbe43('0x11')]);router[_0xbe43('0x12')]('/',auth['isAuthenticated'](),controller[_0xbe43('0x13')]);router[_0xbe43('0x12')](_0xbe43('0x14'),auth[_0xbe43('0xe')](),controller[_0xbe43('0x15')]);router[_0xbe43('0x12')](_0xbe43('0x10'),auth[_0xbe43('0xe')](),controller[_0xbe43('0x16')]);router[_0xbe43('0x17')](_0xbe43('0xd'),auth[_0xbe43('0xe')](),controller[_0xbe43('0x18')]);router[_0xbe43('0x19')](_0xbe43('0xd'),auth[_0xbe43('0xe')](),controller['destroy']);router[_0xbe43('0x19')](_0xbe43('0x14'),auth[_0xbe43('0xe')](),controller[_0xbe43('0x1a')]);module[_0xbe43('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 2c76df6..576d21e 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 _0x8ae1=['STRING','DATE','long','ENUM','sequelize','exports','BOOLEAN','INTEGER','star','thumb','TEXT'];(function(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0x8ae1,0x12d));var _0x18ae=function(_0x3f88ac,_0x52e2a0){_0x3f88ac=_0x3f88ac-0x0;var _0x4bd9b1=_0x8ae1[_0x3f88ac];return _0x4bd9b1;};'use strict';var Sequelize=require(_0x18ae('0x0'));module[_0x18ae('0x1')]={'closed':{'type':Sequelize[_0x18ae('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x18ae('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x18ae('0x4'),_0x18ae('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x18ae('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x18ae('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x18ae('0x8')]},'disposition':{'type':Sequelize[_0x18ae('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x18ae('0x7')]},'browserName':{'type':Sequelize[_0x18ae('0x7')]},'browserVersion':{'type':Sequelize[_0x18ae('0x7')]},'osName':{'type':Sequelize[_0x18ae('0x7')]},'osVersion':{'type':Sequelize[_0x18ae('0x7')]},'deviceModel':{'type':Sequelize[_0x18ae('0x7')]},'deviceVendor':{'type':Sequelize[_0x18ae('0x7')]},'deviceType':{'type':Sequelize[_0x18ae('0x7')]},'referer':{'type':Sequelize[_0x18ae('0x6')]},'customerIp':{'type':Sequelize[_0x18ae('0x7')]},'formData':{'type':Sequelize[_0x18ae('0x6')](_0x18ae('0x9'))},'read1stAt':{'type':Sequelize[_0x18ae('0x8')]},'lastMsgAt':{'type':Sequelize[_0x18ae('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x18ae('0xa')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x18ae('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x18ae('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x18ae('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x18ae('0x3')]}}; \ No newline at end of file +var _0x4418=['DATE','long','out','exports','BOOLEAN','INTEGER','thumb','star','TEXT','STRING'];(function(_0x5ce34a,_0x57887e){var _0x309350=function(_0x52a947){while(--_0x52a947){_0x5ce34a['push'](_0x5ce34a['shift']());}};_0x309350(++_0x57887e);}(_0x4418,0x1cf));var _0x8441=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0x4418[_0x55677b];return _0x104b88;};'use strict';var Sequelize=require('sequelize');module[_0x8441('0x0')]={'closed':{'type':Sequelize[_0x8441('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8441('0x2')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x8441('0x3')),'defaultValue':_0x8441('0x4')},'ratingMessage':{'type':Sequelize[_0x8441('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x8441('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x8441('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8441('0x6')]},'thirdDisposition':{'type':Sequelize[_0x8441('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x8441('0x6')]},'deviceModel':{'type':Sequelize[_0x8441('0x6')]},'deviceVendor':{'type':Sequelize[_0x8441('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x8441('0x5')]},'customerIp':{'type':Sequelize[_0x8441('0x6')]},'formData':{'type':Sequelize[_0x8441('0x5')](_0x8441('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8441('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x8441('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x8441('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x8441('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8441('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 463bd50..5aeb32c 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 _0x7815=['keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','vidaooTopic','vidaooNote','follow','isNull','vidaooMetadata','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','filename','mimetype','Attachment','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','Messages','User','ChatWebsiteId','ContactId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','Smtp','CloudProvider','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','pick','ChatInteractionId','filter','where','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','includeAgent','push','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','files','tmp','server','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','attachments','createdAt','Account','Owner','mkdirSync','Chat','toString','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','read','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','destroy','then','stack','name','send','merge','body','contact','agent','account','map','ChatInteraction','fieldName','type','key','chat','query','user','catch','show','params','model'];(function(_0xa60bc3,_0x3c9a7f){var _0x1b58f3=function(_0x4a7cf7){while(--_0x4a7cf7){_0xa60bc3['push'](_0xa60bc3['shift']());}};_0x1b58f3(++_0x3c9a7f);}(_0x7815,0x158));var _0x5781=function(_0x2579e5,_0x27b94d){_0x2579e5=_0x2579e5-0x0;var _0x34e894=_0x7815[_0x2579e5];return _0x34e894;};'use strict';var rimraf=require(_0x5781('0x0'));var zipdir=require(_0x5781('0x1'));var rp=require(_0x5781('0x2'));var moment=require(_0x5781('0x3'));var BPromise=require(_0x5781('0x4'));var Mustache=require(_0x5781('0x5'));var util=require(_0x5781('0x6'));var path=require(_0x5781('0x7'));var ejs=require(_0x5781('0x8'));var fs=require('fs');var _=require(_0x5781('0x9'));var Redis=require(_0x5781('0xa'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x5781('0xb'))('api');var config=require('../../config/environment');var db=require(_0x5781('0xc'))['db'];config[_0x5781('0xd')]=_[_0x5781('0xe')](config['redis'],{'host':_0x5781('0xf'),'port':0x18eb});var socket=require(_0x5781('0x10'))(new Redis(config[_0x5781('0xd')]));require(_0x5781('0x11'))['register'](socket);var jayson=require(_0x5781('0x12'));var client=jayson[_0x5781('0x13')]['http']({'port':0x232b});var client9004=jayson[_0x5781('0x13')][_0x5781('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x5cf1fc,_0x5f40da,_0xb0f7b2,_0x318d73){return new BPromise(function(_0x3d04b1,_0x4c4b32){var _0x51a5ab=_0x318d73||client;return _0x51a5ab[_0x5781('0x15')](_0x5cf1fc,_0xb0f7b2)['then'](function(_0x3479f5){logger[_0x5781('0x16')](_0x5781('0x17'),_0x5f40da,_0x5781('0x18'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x5f40da,_0x5781('0x18'),JSON[_0x5781('0x19')](_0x3479f5));if(_0x3479f5[_0x5781('0x1a')]){if(_0x3479f5['error']['code']===0x1f4){logger[_0x5781('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x5f40da,_0x3479f5[_0x5781('0x1a')][_0x5781('0x1b')]);return _0x4c4b32(_0x3479f5['error'][_0x5781('0x1b')]);}logger[_0x5781('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x5f40da,_0x3479f5[_0x5781('0x1a')][_0x5781('0x1b')]);return _0x3d04b1(_0x3479f5[_0x5781('0x1a')][_0x5781('0x1b')]);}else{logger[_0x5781('0x16')](_0x5781('0x17'),_0x5f40da,_0x5781('0x18'));_0x3d04b1(_0x3479f5['result'][_0x5781('0x1b')]);}})['catch'](function(_0x382603){logger[_0x5781('0x1a')](_0x5781('0x17'),_0x5f40da,_0x382603);_0x4c4b32(_0x382603);});});}function respondWithStatusCode(_0xd0d13a,_0x5bf6ac){_0x5bf6ac=_0x5bf6ac||0xcc;return function(_0x14955a){if(_0x14955a){return _0xd0d13a[_0x5781('0x1c')](_0x5bf6ac);}return _0xd0d13a[_0x5781('0x1d')](_0x5bf6ac)[_0x5781('0x1e')]();};}function respondWithResult(_0x3e9be5,_0x3cd57e){_0x3cd57e=_0x3cd57e||0xc8;return function(_0x1b10c5){if(_0x1b10c5){return _0x3e9be5[_0x5781('0x1d')](_0x3cd57e)[_0x5781('0x1f')](_0x1b10c5);}};}function respondWithFilteredResult(_0x4c8db6,_0x477389){return function(_0x2f27c5){if(_0x2f27c5){var _0x55aeee=typeof _0x477389['offset']===_0x5781('0x20')&&typeof _0x477389[_0x5781('0x21')]===_0x5781('0x20');var _0x414b8f=_0x2f27c5[_0x5781('0x22')];var _0x5ce811=_0x55aeee?0x0:_0x477389['offset'];var _0x1fcc89=_0x55aeee?_0x2f27c5[_0x5781('0x22')]:_0x477389[_0x5781('0x23')]+_0x477389[_0x5781('0x21')];var _0x480fcd;if(_0x1fcc89>=_0x414b8f){_0x1fcc89=_0x414b8f;_0x480fcd=0xc8;}else{_0x480fcd=0xce;}_0x4c8db6[_0x5781('0x1d')](_0x480fcd);return _0x4c8db6['set'](_0x5781('0x24'),_0x5ce811+'-'+_0x1fcc89+'/'+_0x414b8f)['json'](_0x2f27c5);}return null;};}function saveUpdates(_0x53c09f){return function(_0xaeaf6){if(_0xaeaf6){return _0xaeaf6[_0x5781('0x25')](_0x53c09f)['then'](function(_0x32d8d5){return _0x32d8d5;});}return null;};}function removeEntity(_0x2d5b59){return function(_0x11e9df){if(_0x11e9df){return _0x11e9df[_0x5781('0x26')]()[_0x5781('0x27')](function(){_0x2d5b59[_0x5781('0x1d')](0xcc)[_0x5781('0x1e')]();});}};}function handleEntityNotFound(_0x583a5b){return function(_0x1a98db){if(!_0x1a98db){_0x583a5b[_0x5781('0x1c')](0x194);}return _0x1a98db;};}function handleError(_0x155c9b,_0x16499f){_0x16499f=_0x16499f||0x1f4;return function(_0x418fcf){logger[_0x5781('0x1a')](_0x418fcf[_0x5781('0x28')]);if(_0x418fcf[_0x5781('0x29')]){delete _0x418fcf[_0x5781('0x29')];}_0x155c9b['status'](_0x16499f)[_0x5781('0x2a')](_0x418fcf);};}function getMustacheRender(_0x14553e,_0x396ff8){return Mustache['render'](_0x14553e,_[_0x5781('0x2b')](_0x396ff8[_0x5781('0x2c')],{'contact':_0x396ff8[_0x5781('0x2d')],'message':_0x396ff8[_0x5781('0x1b')],'agent':_0x396ff8[_0x5781('0x2e')],'interaction':_0x396ff8['interaction'],'account':_0x396ff8[_0x5781('0x2f')]}))||'';}exports['index']=function(_0x4aaed9,_0x55561b){var _0x42a761={};var _0x40f174=_[_0x5781('0x30')](db[_0x5781('0x31')]['rawAttributes'],function(_0x446d8a){return{'name':_0x446d8a[_0x5781('0x32')],'type':_0x446d8a[_0x5781('0x33')][_0x5781('0x34')]};});_0x42a761=qs['getOptions'](_0x40f174,_0x4aaed9);return interaction['findAll'](_0x5781('0x35'),_0x4aaed9[_0x5781('0x36')],_0x4aaed9[_0x5781('0x37')],_0x42a761,_0x40f174)[_0x5781('0x27')](respondWithFilteredResult(_0x55561b,_0x42a761))[_0x5781('0x38')](handleError(_0x55561b,null));};exports[_0x5781('0x39')]=function(_0x29d566,_0x1dbaa3){var _0x43647a={'raw':![],'where':{'id':_0x29d566[_0x5781('0x3a')]['id']}},_0x305621={};_0x305621[_0x5781('0x3b')]=_[_0x5781('0x3c')](db[_0x5781('0x31')][_0x5781('0x3d')]);_0x305621[_0x5781('0x36')]=_['keys'](_0x29d566['query']);_0x305621[_0x5781('0x3e')]=_[_0x5781('0x3f')](_0x305621[_0x5781('0x3b')],_0x305621['query']);_0x43647a[_0x5781('0x40')]=_[_0x5781('0x3f')](_0x305621['model'],qs[_0x5781('0x41')](_0x29d566[_0x5781('0x36')][_0x5781('0x41')]));_0x43647a[_0x5781('0x40')]=_0x43647a['attributes'][_0x5781('0x42')]?_0x43647a[_0x5781('0x40')]:_0x305621[_0x5781('0x3b')];if(_0x29d566[_0x5781('0x36')][_0x5781('0x43')]){_0x43647a[_0x5781('0x44')]=[{'all':!![]}];}_0x43647a=_['merge']({},_0x43647a,_0x29d566[_0x5781('0x45')]);return db['ChatInteraction'][_0x5781('0x46')](_0x43647a)[_0x5781('0x27')](handleEntityNotFound(_0x1dbaa3,null))[_0x5781('0x27')](respondWithResult(_0x1dbaa3,null))[_0x5781('0x38')](handleError(_0x1dbaa3,null));};exports[_0x5781('0x47')]=function(_0x206cb3,_0x29fc71){return db[_0x5781('0x31')][_0x5781('0x47')](_0x206cb3[_0x5781('0x2c')],{})['then'](respondWithResult(_0x29fc71,0xc9))[_0x5781('0x38')](handleError(_0x29fc71,null));};exports['update']=function(_0x179304,_0x46c6db){if(_0x179304[_0x5781('0x2c')]['id']){delete _0x179304[_0x5781('0x2c')]['id'];}return db[_0x5781('0x31')]['find']({'where':{'id':_0x179304[_0x5781('0x3a')]['id']}})[_0x5781('0x27')](handleEntityNotFound(_0x46c6db,null))[_0x5781('0x27')](saveUpdates(_0x179304[_0x5781('0x2c')],null))['then'](respondWithResult(_0x46c6db,null))[_0x5781('0x38')](handleError(_0x46c6db,null));};exports['destroy']=function(_0x24db62,_0x1952fd){return db[_0x5781('0x31')]['find']({'where':{'id':_0x24db62[_0x5781('0x3a')]['id']}})['then'](handleEntityNotFound(_0x1952fd,null))[_0x5781('0x27')](removeEntity(_0x1952fd,null))['catch'](handleError(_0x1952fd,null));};exports[_0x5781('0x48')]=function(_0x34f7e9,_0x183af0){return db['ChatInteraction'][_0x5781('0x48')]()[_0x5781('0x27')](respondWithResult(_0x183af0,null))[_0x5781('0x38')](handleError(_0x183af0,null));};exports['createVidaooSession']=function(_0x40edca,_0x244a5b){var _0x3970d3=_0x40edca[_0x5781('0x3a')]['id'];var _0x52e452;var _0x27b97b;var _0x498c31;return db[_0x5781('0x31')][_0x5781('0x49')]({'where':{'id':_0x3970d3}})[_0x5781('0x27')](function(_0x23026d){_0x52e452=_0x23026d;return db[_0x5781('0x4a')][_0x5781('0x49')]({'where':{'id':_0x23026d['ChatWebsiteId']},'attributes':['id',_0x5781('0x4b'),_0x5781('0x4c'),'vidaooTopic','vidaooNote','vidaooMetadata'],'raw':!![]});})['then'](function(_0x1fc184){if(_0x1fc184&&_0x1fc184[_0x5781('0x4b')]&&_0x1fc184[_0x5781('0x4c')]){_0x27b97b=_0x1fc184;var _0x47681f={'interaction':{'id':_0x3970d3},'agent':{'id':_0x40edca[_0x5781('0x37')]['id'],'name':_0x40edca['user'][_0x5781('0x29')],'fullname':_0x40edca['user']['fullname'],'email':_0x40edca[_0x5781('0x37')]['email']},'contact':_0x40edca[_0x5781('0x2c')][_0x5781('0x2d')],'account':_0x40edca['body'][_0x5781('0x2f')]};var _0x3797c5={'rejectUnauthorized':![],'method':_0x5781('0x4d'),'url':_0x5781('0x4e'),'headers':{'X-APIKEY':_0x1fc184[_0x5781('0x4b')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x40edca[_0x5781('0x37')][_0x5781('0x4f')]],'buttons':null,'topic':_0x27b97b[_0x5781('0x50')],'note':_['isNull'](_0x27b97b[_0x5781('0x51')])?null:getMustacheRender(_0x27b97b[_0x5781('0x51')],_0x47681f),'metadata':null},'redirect':_0x5781('0x52'),'json':!![]};try{if(!_[_0x5781('0x53')](_0x27b97b[_0x5781('0x54')])){var _0xcc632f=getMustacheRender(_0x27b97b[_0x5781('0x54')],_0x47681f);var _0x17d12a=JSON[_0x5781('0x55')](_0xcc632f);_0x3797c5['body']['metadata']=_0x17d12a;}}catch(_0x350bc5){throw new db[(_0x5781('0x56'))][(_0x5781('0x57'))](_0x5781('0x58'));}return rp(_0x3797c5);}else{throw new db[(_0x5781('0x56'))][(_0x5781('0x57'))](_0x5781('0x59'));}})[_0x5781('0x27')](function(_0x2be61e){_0x498c31=_0x2be61e;if(_0x498c31['id']){var _0x5b328={'body':_0x498c31[_0x5781('0x5a')],'ChatWebsiteId':_0x27b97b['id'],'ChatInteractionId':_0x52e452['id'],'direction':_0x5781('0x5b'),'UserId':_0x40edca[_0x5781('0x37')]['id']};return db[_0x5781('0x5c')][_0x5781('0x47')](_0x5b328,{});}else{throw new db[(_0x5781('0x56'))][(_0x5781('0x57'))](_0x5781('0x5d'));}})['then'](function(){return _0x52e452[_0x5781('0x5e')]({'vidaooSessionId':_0x498c31['id']});})['then'](respondWithResult(_0x244a5b,null))[_0x5781('0x38')](handleError(_0x244a5b,null));};exports['customUpdate']=function(_0x4f57a8,_0x566c47){if(_0x4f57a8[_0x5781('0x2c')]['id']){delete _0x4f57a8[_0x5781('0x2c')]['id'];}return db[_0x5781('0x31')]['find']({'where':{'id':_0x4f57a8[_0x5781('0x3a')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x5781('0x27')](handleEntityNotFound(_0x566c47,null))['then'](saveUpdates(_0x4f57a8[_0x5781('0x2c')],null))[_0x5781('0x27')](respondWithResult(_0x566c47,null))['catch'](handleError(_0x566c47,null));};exports[_0x5781('0x5f')]=function(_0x550744,_0x517822){if(_0x550744['body']['id']){delete _0x550744[_0x5781('0x2c')]['id'];}return db[_0x5781('0x31')][_0x5781('0x46')]({'where':{'id':_0x550744[_0x5781('0x3a')]['id']}})[_0x5781('0x27')](function(_0x1f6823){if(!_0x1f6823){logger[_0x5781('0x1a')](_0x5781('0x60'),_0x5781('0x5f'),0x194,_0x5781('0x61'));_0x517822[_0x5781('0x1c')](0x194);}else{if(_0x1f6823[_0x5781('0x62')]){throw new db['Sequelize'][(_0x5781('0x57'))](_0x5781('0x63'));}}return _0x1f6823;})[_0x5781('0x27')](function(_0x116dfc){if(_0x116dfc){return _0x116dfc[_0x5781('0x25')]({'closed':_0x550744[_0x5781('0x2c')][_0x5781('0x64')],'disposition':_0x550744[_0x5781('0x2c')][_0x5781('0x65')]})[_0x5781('0x27')](function(_0x2df9ca){return _0x2df9ca;});}})[_0x5781('0x27')](function(){return respondWithRpcPromise(_0x5781('0x66'),_0x5781('0x5f'),_0x550744[_0x5781('0x2c')],client9004);})['then'](respondWithResult(_0x517822,null))['catch'](handleError(_0x517822,null));};exports[_0x5781('0x67')]=function(_0x4eda2c,_0x48c749){_0x4eda2c[_0x5781('0x2c')][_0x5781('0x29')]=_0x4eda2c[_0x5781('0x68')][_0x5781('0x69')];_0x4eda2c[_0x5781('0x2c')]['basename']=_0x4eda2c[_0x5781('0x68')][_0x5781('0x6a')];_0x4eda2c[_0x5781('0x2c')][_0x5781('0x33')]=_0x4eda2c[_0x5781('0x68')][_0x5781('0x6b')];return db[_0x5781('0x6c')][_0x5781('0x47')](_0x4eda2c[_0x5781('0x2c')])[_0x5781('0x27')](respondWithResult(_0x48c749,0xc9))['catch'](handleError(_0x48c749,null));};exports['attachmentDownload']=function(_0x4ae958,_0x371d2e){return db[_0x5781('0x31')][_0x5781('0x49')]({'where':{'id':_0x4ae958[_0x5781('0x3a')]['id']},'raw':!![]})[_0x5781('0x27')](handleEntityNotFound(_0x371d2e,null))[_0x5781('0x27')](function(_0x366b65){if(_0x366b65){if(_0x366b65[_0x5781('0x64')]){return _0x371d2e[_0x5781('0x1d')](0x193)['json']({'status':0x193,'message':_0x5781('0x6d')});}return db[_0x5781('0x6c')]['findOne']({'where':{'id':_0x4ae958[_0x5781('0x36')][_0x5781('0x6e')]},'raw':!![]})[_0x5781('0x27')](handleEntityNotFound(_0x371d2e,null));}})[_0x5781('0x27')](function(_0x42cdce){if(_0x42cdce){var _0x22bb06=_0x42cdce['ChatOfflineMessageId']!==null;var _0x247633=path[_0x5781('0x6f')](config[_0x5781('0x70')],_0x5781('0x71'));if(_0x22bb06){_0x247633=path[_0x5781('0x6f')](_0x247633,_0x5781('0x72'));}var _0x4bb129=path[_0x5781('0x6f')](_0x247633,_0x42cdce[_0x5781('0x73')]);return _0x371d2e[_0x5781('0x74')](_0x4bb129);}})[_0x5781('0x38')](handleError(_0x371d2e,null));};exports[_0x5781('0x75')]=function(_0x8abb86,_0x5826d5){var _0x11e453=null;var _0x20c37d=null;var _0x47ca2b=null;if(_0x8abb86[_0x5781('0x2c')]['id']){delete _0x8abb86[_0x5781('0x2c')]['id'];}if(_0x8abb86[_0x5781('0x2c')][_0x5781('0x76')]){_0x47ca2b=path[_0x5781('0x6f')](config[_0x5781('0x70')],_0x5781('0x77'),util[_0x5781('0x78')](_0x5781('0x79'),Date['now']()));_0x8abb86[_0x5781('0x2c')]['pathTranscript']=_0x47ca2b;}return db[_0x5781('0x31')][_0x5781('0x46')]({'where':{'id':_0x8abb86[_0x5781('0x3a')]['id']},'include':[{'model':db[_0x5781('0x5c')],'as':_0x5781('0x7a'),'include':[{'model':db[_0x5781('0x7b')],'as':_0x5781('0x7b')}]}]})[_0x5781('0x27')](handleEntityNotFound(_0x5826d5,null))[_0x5781('0x27')](saveUpdates(_0x8abb86[_0x5781('0x2c')],null))[_0x5781('0x27')](function(_0x1c989e){if(_0x1c989e){_0x11e453=_0x1c989e;return db[_0x5781('0x4a')][_0x5781('0x46')]({'where':{'id':_0x11e453[_0x5781('0x7c')]}});}})['then'](function(_0x51df6f){if(_0x51df6f){_0x20c37d=_0x51df6f;return db['CmContact'][_0x5781('0x46')]({'where':{'id':_0x11e453[_0x5781('0x7d')]}});}})[_0x5781('0x27')](function(_0x56615b){if(_0x56615b){if(_0x47ca2b){var _0x4dbe70=null;for(var _0x175601=0x1;_0x175601<_0x11e453['Messages']['length'];++_0x175601){_0x4dbe70=_0x11e453[_0x5781('0x7a')][_0x175601];var _0x56cf86=_0x4dbe70[_0x5781('0x62')]?util[_0x5781('0x78')](_0x5781('0x7e'),_0x20c37d[_0x5781('0x7f')],_0x4dbe70[_0x5781('0x62')]):_0x5781('0x80');var _0x2c4c94=_0x8abb86[_0x5781('0x2c')][_0x5781('0x81')]||util['format'](_0x5781('0x7e'),_0x5781('0x82'),_0x4dbe70[_0x5781('0x7d')]);switch(_0x20c37d[_0x5781('0x83')]){case _0x5781('0x84'):_0x56cf86=_0x4dbe70[_0x5781('0x62')]?util[_0x5781('0x78')](_0x5781('0x7e'),_0x20c37d['agentAlias'],_0x4dbe70[_0x5781('0x62')]):_0x5781('0x80');break;case'agent_alias':_0x56cf86=_0x4dbe70[_0x5781('0x62')]?_0x4dbe70['User'][_0x5781('0x85')]||_0x4dbe70[_0x5781('0x7b')][_0x5781('0x86')]:_0x5781('0x80');break;case _0x5781('0x87'):_0x56cf86=_0x4dbe70[_0x5781('0x62')]?_0x4dbe70[_0x5781('0x7b')][_0x5781('0x86')]:_0x5781('0x80');break;default:_0x56cf86=_0x4dbe70[_0x5781('0x62')]?util[_0x5781('0x78')]('%s%d',_0x20c37d[_0x5781('0x7f')],_0x4dbe70[_0x5781('0x62')]):_0x5781('0x80');}var _0x35bbda=util['format'](_0x5781('0x88'),moment(_0x4dbe70['createdAt'])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x4dbe70[_0x5781('0x89')]==='in'?_0x2c4c94:_0x56cf86,_0x4dbe70[_0x5781('0x2c')]);if(!_0x4dbe70[_0x5781('0x8a')]){fs[_0x5781('0x8b')](_0x47ca2b,_0x35bbda);}}return db[_0x5781('0x8c')][_0x5781('0x49')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x5781('0x8d'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x5781('0x8e'),'raw':!![]}]}]});}}})[_0x5781('0x27')](function(_0x54f183){if(!_0x54f183||!_0x54f183[_0x5781('0x8d')]||!_0x8abb86[_0x5781('0x2c')])return _0x11e453;var _0x44615d=_0x54f183['getSmtpOptions']();return respondWithRpcPromise(_0x5781('0x8f'),'sendMail',{'account':_0x44615d,'message':{'from':util['format'](_0x5781('0x90'),_0x54f183[_0x5781('0x29')],_0x54f183[_0x5781('0x4f')]||_0x54f183[_0x5781('0x8d')][_0x5781('0x37')]),'to':_0x8abb86['body'][_0x5781('0x76')],'subject':_0x5781('0x91'),'text':util[_0x5781('0x78')](_0x5781('0x92'),_0x8abb86[_0x5781('0x2c')]['mailTranscript']),'attachments':[{'path':_0x47ca2b}]}})[_0x5781('0x27')](function(){return _0x11e453;})['catch'](function(_0x4d6317){logger[_0x5781('0x1a')](_0x4d6317);});})[_0x5781('0x27')](respondWithStatusCode(_0x5826d5,0xc8))[_0x5781('0x38')](handleError(_0x5826d5,null));};exports['addMessage']=function(_0x4fd988,_0x2601c4){return db[_0x5781('0x5c')]['find']({'where':{'id':_0x4fd988[_0x5781('0x3a')]['id']}})[_0x5781('0x27')](handleEntityNotFound(_0x2601c4,null))[_0x5781('0x27')](function(_0x4088d9){if(_0x4088d9){return _0x4088d9['addMessage'](_0x4fd988[_0x5781('0x2c')][_0x5781('0x93')],_[_0x5781('0x94')](_0x4fd988['body'],[_0x5781('0x93'),'id'])||{});}})[_0x5781('0x27')](respondWithResult(_0x2601c4,null))[_0x5781('0x38')](handleError(_0x2601c4,null));};exports[_0x5781('0x95')]=function(_0x1c49e0,_0x46d27f){var _0x21d21d={'raw':![],'where':{}};var _0xb210fa={};var _0x5c404d={'count':0x0,'rows':[]};return db[_0x5781('0x31')][_0x5781('0x49')]({'where':{'id':_0x1c49e0[_0x5781('0x3a')]['id']}})[_0x5781('0x27')](handleEntityNotFound(_0x46d27f,null))[_0x5781('0x27')](function(_0x93e910){if(_0x93e910){_0xb210fa['model']=_[_0x5781('0x3c')](db[_0x5781('0x5c')]['rawAttributes']);_0xb210fa[_0x5781('0x36')]=_['keys'](_0x1c49e0[_0x5781('0x36')]);_0xb210fa[_0x5781('0x3e')]=_['intersection'](_0xb210fa[_0x5781('0x3b')],_0xb210fa[_0x5781('0x36')]);_0x21d21d[_0x5781('0x40')]=_[_0x5781('0x3f')](_0xb210fa['model'],qs[_0x5781('0x41')](_0x1c49e0[_0x5781('0x36')][_0x5781('0x41')]));_0x21d21d[_0x5781('0x40')]=_0x21d21d['attributes']['length']?_0x21d21d[_0x5781('0x40')]:_0xb210fa[_0x5781('0x3b')];if(!_0x1c49e0[_0x5781('0x36')][_0x5781('0x96')](_0x5781('0x97'))){_0x21d21d[_0x5781('0x21')]=qs[_0x5781('0x21')](_0x1c49e0[_0x5781('0x36')][_0x5781('0x21')]);_0x21d21d[_0x5781('0x23')]=qs[_0x5781('0x23')](_0x1c49e0['query']['offset']);}_0x21d21d[_0x5781('0x98')]=qs[_0x5781('0x99')](_0x1c49e0[_0x5781('0x36')]['sort']);_0x21d21d['where']=qs[_0x5781('0x3e')](_[_0x5781('0x9a')](_0x1c49e0[_0x5781('0x36')],_0xb210fa[_0x5781('0x3e')]));_0x21d21d['where'][_0x5781('0x9b')]=_0x93e910['id'];if(_0x1c49e0[_0x5781('0x36')][_0x5781('0x9c')]){_0x21d21d['where']=_[_0x5781('0x2b')](_0x21d21d[_0x5781('0x9d')],{'$or':_['map'](_0x21d21d[_0x5781('0x40')],function(_0x21c194){var _0xbdff4e={};_0xbdff4e[_0x21c194]={'$like':'%'+_0x1c49e0[_0x5781('0x36')][_0x5781('0x9c')]+'%'};return _0xbdff4e;})});}if(_0x1c49e0[_0x5781('0x36')]['$gte']){var _0x4003c0=_0x1c49e0[_0x5781('0x36')][_0x5781('0x9e')][_0x5781('0x9f')](',');var _0x2dae66={};_0x2dae66[_0x4003c0[0x0]]={'$gte':moment(_0x4003c0[0x1])['format'](_0x5781('0xa0'))};_0x21d21d[_0x5781('0x9d')]=_[_0x5781('0x2b')](_0x21d21d[_0x5781('0x9d')],_0x2dae66);}_0x21d21d=_['merge']({},_0x21d21d,_0x1c49e0[_0x5781('0x45')]);return db[_0x5781('0x5c')][_0x5781('0x22')]({'where':_0x21d21d[_0x5781('0x9d')]})[_0x5781('0x27')](function(_0xb0a0fe){_0x5c404d[_0x5781('0x22')]=_0xb0a0fe;if(_0x1c49e0['query'][_0x5781('0x43')]){_0x21d21d[_0x5781('0x44')]=[{'all':!![]}];}return db[_0x5781('0x5c')][_0x5781('0xa1')](_0x21d21d);})['then'](function(_0x47a3f2){_0x5c404d[_0x5781('0xa2')]=_0x47a3f2;return _0x5c404d;});}})['then'](respondWithFilteredResult(_0x46d27f,_0x21d21d))[_0x5781('0x38')](handleError(_0x46d27f,null));};exports[_0x5781('0xa3')]=function(_0x1f18d6,_0x1dadeb){var _0x5f2a5f={'where':{}},_0x531cd8={},_0x35f54c={'count':0x0,'rows':[]};return db[_0x5781('0x31')][_0x5781('0x49')]({'where':{'id':_0x1f18d6['params']['id']}})[_0x5781('0x27')](handleEntityNotFound(_0x1dadeb,null))['then'](function(_0x13d3d3){if(_0x13d3d3){_0x531cd8['model']=_[_0x5781('0x3c')](db[_0x5781('0x5c')][_0x5781('0x3d')]);_0x531cd8['query']=_[_0x5781('0x3c')](_0x1f18d6[_0x5781('0x36')]);_0x531cd8['filters']=_[_0x5781('0x3f')](_0x531cd8['model'],_0x531cd8['query']);_0x5f2a5f[_0x5781('0x40')]=_[_0x5781('0x3f')](_0x531cd8[_0x5781('0x3b')],qs['fields'](_0x1f18d6[_0x5781('0x36')][_0x5781('0x41')]));_0x5f2a5f['attributes']=_0x5f2a5f[_0x5781('0x40')][_0x5781('0x42')]?_0x5f2a5f[_0x5781('0x40')]:_0x531cd8[_0x5781('0x3b')];if(!_0x1f18d6[_0x5781('0x36')][_0x5781('0x96')](_0x5781('0x97'))){_0x5f2a5f[_0x5781('0x21')]=qs[_0x5781('0x21')](_0x1f18d6[_0x5781('0x36')][_0x5781('0x21')]);_0x5f2a5f[_0x5781('0x23')]=qs[_0x5781('0x23')](_0x1f18d6[_0x5781('0x36')][_0x5781('0x23')]);}_0x5f2a5f[_0x5781('0x98')]=qs[_0x5781('0x99')](_0x1f18d6[_0x5781('0x36')][_0x5781('0x99')]);_0x5f2a5f[_0x5781('0x9d')]=qs['filters'](_['pick'](_0x1f18d6['query'],_0x531cd8[_0x5781('0x3e')]));_0x5f2a5f['where'][_0x5781('0x9b')]=_0x13d3d3['id'];if(_0x1f18d6[_0x5781('0x36')]['filter']){_0x5f2a5f[_0x5781('0x9d')]=_['merge'](_0x5f2a5f[_0x5781('0x9d')],{'$or':_[_0x5781('0x30')](_0x5f2a5f['attributes'],function(_0x34da0a){var _0x2ad68c={};_0x2ad68c[_0x34da0a]={'$like':'%'+_0x1f18d6['query'][_0x5781('0x9c')]+'%'};return _0x2ad68c;})});}_0x5f2a5f['where']['secret']=![];if(_0x1f18d6[_0x5781('0x36')]['id']){_0x5f2a5f[_0x5781('0x9d')]['id']={'$gt':_0x1f18d6[_0x5781('0x36')]['id']};}_0x5f2a5f=_[_0x5781('0x2b')]({},_0x5f2a5f,_0x1f18d6['options']);return db[_0x5781('0x5c')][_0x5781('0x22')]({'where':_0x5f2a5f[_0x5781('0x9d')]})[_0x5781('0x27')](function(_0x44cdea){_0x35f54c['count']=_0x44cdea;_0x5f2a5f[_0x5781('0x44')]=[];if(_0x1f18d6['query'][_0x5781('0xa4')]){_0x5f2a5f[_0x5781('0x44')][_0x5781('0xa5')]({'model':db[_0x5781('0x7b')],'as':_0x5781('0x7b'),'attributes':['id','fullname',_0x5781('0x85')]});}if(_0x1f18d6[_0x5781('0x36')][_0x5781('0x43')]){_0x5f2a5f[_0x5781('0x44')]=[{'all':!![]}];}return db[_0x5781('0x5c')][_0x5781('0xa1')](_0x5f2a5f);})[_0x5781('0x27')](function(_0x972ea4){_0x35f54c['rows']=_0x972ea4;return _0x35f54c;});}})[_0x5781('0x27')](respondWithFilteredResult(_0x1dadeb,_0x5f2a5f))[_0x5781('0x38')](handleError(_0x1dadeb,null));};exports[_0x5781('0xa6')]=function(_0x483a8d,_0xd157b3){return db[_0x5781('0x31')][_0x5781('0x46')]({'where':{'id':_0x483a8d[_0x5781('0x3a')]['id']}})['then'](handleEntityNotFound(_0xd157b3,null))[_0x5781('0x27')](function(_0x451bbe){if(_0x451bbe){return _0x451bbe[_0x5781('0xa7')](_0x483a8d['body']['ids'],_[_0x5781('0x94')](_0x483a8d['body'],[_0x5781('0x93'),'id'])||{})[_0x5781('0xa8')](function(){return db['Tag'][_0x5781('0xa1')]({'attributes':['id',_0x5781('0x29'),'color'],'where':{'id':_0x483a8d[_0x5781('0x2c')][_0x5781('0x93')]}});})[_0x5781('0x27')](function(_0x420cbe){socket[_0x5781('0xa9')](_0x5781('0xaa'),{'id':Number(_0x483a8d[_0x5781('0x3a')]['id']),'tags':_0x420cbe||[]});return{'id':Number(_0x483a8d[_0x5781('0x3a')]['id']),'tags':_0x420cbe||[]};});}})[_0x5781('0x27')](respondWithResult(_0xd157b3,null))[_0x5781('0x38')](handleError(_0xd157b3,null));};exports[_0x5781('0xab')]=function(_0x1e7fa3,_0x5ed456){return db[_0x5781('0x31')][_0x5781('0x46')]({'where':{'id':_0x1e7fa3[_0x5781('0x3a')]['id']}})[_0x5781('0x27')](handleEntityNotFound(_0x5ed456,null))['then'](function(_0x11f591){if(_0x11f591){return _0x11f591['removeTags'](_0x1e7fa3['query'][_0x5781('0x93')]);}})[_0x5781('0x27')](respondWithStatusCode(_0x5ed456,null))[_0x5781('0x38')](handleError(_0x5ed456,null));};exports[_0x5781('0x74')]=function(_0x2bea76,_0x330548){var _0x5c1e78=moment()['unix']()['toString']();var _0x47fa84=path['join'](config['root'],'server',_0x5781('0xac'),_0x5781('0xad'));var _0xe7d14=path[_0x5781('0x6f')](config['root'],_0x5781('0xae'),_0x5781('0xac'),'attachments');var _0xa7e558=path['join'](_0x47fa84,_0x5c1e78);var _0x269280=util['format'](_0x5781('0xaf'),_0x2bea76[_0x5781('0x3a')]['id'],_0x5c1e78);var _0x193aad=path[_0x5781('0x6f')](_0x47fa84,_0x269280);var _0x253c64=[];_0x253c64[_0x5781('0xa5')]({'model':db[_0x5781('0x7b')],'as':_0x5781('0x7b'),'attributes':['id',_0x5781('0x86')],'raw':!![]});_0x253c64[_0x5781('0xa5')]({'model':db[_0x5781('0xb0')],'as':_0x5781('0xb1'),'attributes':['id',_0x5781('0xb2'),_0x5781('0xb3')],'raw':!![]});if(_0x2bea76['query'][_0x5781('0xb4')]){_0x253c64['push']({'model':db[_0x5781('0x6c')],'as':_0x5781('0x6c'),'raw':!![]});}var _0x32fe57=[{'model':db[_0x5781('0x5c')],'as':_0x5781('0x7a'),'attributes':['id',_0x5781('0x2c'),_0x5781('0xb5'),'direction',_0x5781('0x8a'),'read'],'include':_0x253c64}];_0x32fe57[_0x5781('0xa5')]({'model':db[_0x5781('0x4a')],'as':_0x5781('0xb6'),'attributes':['id',_0x5781('0x29')]});_0x32fe57[_0x5781('0xa5')]({'model':db[_0x5781('0x7b')],'as':_0x5781('0xb7'),'attributes':['id','fullname']});return db['ChatInteraction'][_0x5781('0x46')]({'where':{'id':_0x2bea76[_0x5781('0x3a')]['id']},'include':_0x32fe57})['then'](handleEntityNotFound(_0x330548,null))[_0x5781('0x27')](function(_0x42eeb2){if(_0x42eeb2){var _0x5b4d47=_0x42eeb2['get']({'plain':!![]});fs[_0x5781('0xb8')](_0xa7e558);var _0x14fe43={'channel':_0x5781('0xb9'),'account':_0x5b4d47[_0x5781('0xb6')][_0x5781('0x29')],'agent':_0x5b4d47['Owner']?_0x5b4d47['Owner'][_0x5781('0x86')]:'N.A.','createdAt':moment(_0x5b4d47[_0x5781('0xb5')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x5b4d47['closed']?moment(_0x5b4d47['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x5781('0xba')]():'','disposition':_0x5b4d47[_0x5781('0x65')],'chatInfo':{'browser':_0x5b4d47[_0x5781('0xbb')],'os':_0x5b4d47['osName'],'referer':_0x5b4d47[_0x5781('0xbc')],'customerIp':_0x5b4d47[_0x5781('0xbd')],'customerPort':_0x5b4d47[_0x5781('0xbe')]?_0x5b4d47['customerPort']:'N.A.'},'messages':_(_0x5b4d47[_0x5781('0x7a')])[_0x5781('0xbf')]()[_0x5781('0x9c')]({'secret':![]})['map'](function(_0x401ae5){if(_0x401ae5['Attachment']){var _0x3ae7c3=path['join'](_0xe7d14,_0x401ae5[_0x5781('0x6c')][_0x5781('0x73')]);if(fs[_0x5781('0xc0')](_0x3ae7c3)){fs[_0x5781('0xc1')](_0x3ae7c3)[_0x5781('0xc2')](fs['createWriteStream'](path[_0x5781('0x6f')](_0xa7e558,_0x401ae5['Attachment']['basename'])));}}return{'date':moment(_0x401ae5[_0x5781('0xb5')])[_0x5781('0x78')](_0x5781('0xa0'))['toString'](),'sender':_0x401ae5[_0x5781('0x89')]===_0x5781('0x5b')?_0x401ae5[_0x5781('0x7b')]?_0x401ae5[_0x5781('0x7b')][_0x5781('0x86')]:_0x5781('0x80'):_0x401ae5[_0x5781('0xb1')][_0x5781('0xb2')]+(_0x401ae5[_0x5781('0xb1')][_0x5781('0xb3')]?'\x20'+_0x401ae5['Contact'][_0x5781('0xb3')]:''),'body':_0x401ae5[_0x5781('0x6c')]?_0x401ae5[_0x5781('0x6c')][_0x5781('0x73')]:_0x401ae5[_0x5781('0x2c')],'direction':_0x401ae5[_0x5781('0x89')]==='out'?'A':'C','secret':_0x401ae5[_0x5781('0x8a')],'read':_0x401ae5[_0x5781('0xc3')],'attachment':_0x401ae5[_0x5781('0x6c')]};})[_0x5781('0xc4')]()};return ejs['renderFile'](path['join'](config[_0x5781('0x70')],_0x5781('0xae'),_0x5781('0xc5'),_0x5781('0xc6')),{'interaction':_0x14fe43})[_0x5781('0x27')](function(_0x3dbe9c){var _0x5a3378=path['join'](_0xa7e558,_0x5781('0xc7')+_0x5b4d47['id']+'-'+_0x5c1e78+_0x5781('0xc8'));var _0x362871={'path':_0x5a3378,'channel':_0x5781('0xb9'),'interactionId':_0x5b4d47['id']};return pdf[_0x5781('0xc9')](_0x3dbe9c,_0x362871);})[_0x5781('0x27')](function(){return new Promise(function(_0x2cf95c,_0x5dece2){zipdir(_0xa7e558,{'saveTo':_0x193aad},function(_0x20ab62,_0x7d7e88){if(_0x20ab62)return _0x5dece2(_0x20ab62);return _0x2cf95c(_0x7d7e88);});})[_0x5781('0x27')](function(){return new BPromise(function(_0x4e1fe3,_0x427670){rimraf(_0xa7e558,function(_0x3a2d62){if(_0x3a2d62)_0x427670(_0x3a2d62);return _0x4e1fe3();});});})[_0x5781('0x27')](function(){return _0x330548[_0x5781('0x74')](_0x193aad,_0x269280,function(_0x24f5a4){if(_0x24f5a4){logger[_0x5781('0x1a')]('err',_0x24f5a4);}else{fs['unlinkSync'](_0x193aad);}});});});}else{return _0x330548[_0x5781('0x1c')](0xc8);}})[_0x5781('0x38')](handleError(_0x330548,null));}; \ No newline at end of file +var _0x9142=['../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','redis','defaults','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','undefined','limit','offset','count','Content-Range','update','destroy','end','stack','name','send','render','merge','body','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','chat','user','show','model','keys','query','filters','intersection','attributes','length','includeAll','include','find','create','params','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','fullname','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Unauthorized','Attachment','attachId','join','server/files/attachments/','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','User','ChatWebsiteId','CmContact','ContactId','Messages','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','getSmtpOptions','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','ids','getMessages','fields','hasOwnProperty','nolimit','order','sort','where','ChatInteractionId','filter','$gte','split','options','findAll','rows','getMyMessages','pick','includeAgent','push','addTags','setTags','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','server','tmp','files','attachments','firstName','lastName','createdAt','read','Account','Owner','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closedAt','browserName','osName','referer','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','direction','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash'];(function(_0x17f064,_0x26254e){var _0x5cf624=function(_0x28d52f){while(--_0x28d52f){_0x17f064['push'](_0x17f064['shift']());}};_0x5cf624(++_0x26254e);}(_0x9142,0x1ad));var _0x2914=function(_0x237b1e,_0x2f6a59){_0x237b1e=_0x237b1e-0x0;var _0x309c10=_0x9142[_0x237b1e];return _0x309c10;};'use strict';var rimraf=require(_0x2914('0x0'));var zipdir=require(_0x2914('0x1'));var rp=require(_0x2914('0x2'));var moment=require(_0x2914('0x3'));var BPromise=require(_0x2914('0x4'));var Mustache=require('mustache');var util=require(_0x2914('0x5'));var path=require(_0x2914('0x6'));var ejs=require(_0x2914('0x7'));var fs=require('fs');var _=require(_0x2914('0x8'));var Redis=require('ioredis');var interaction=require(_0x2914('0x9'));var qs=require(_0x2914('0xa'));var pdf=require(_0x2914('0xb'));var logger=require(_0x2914('0xc'))(_0x2914('0xd'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x2914('0xe')]=_[_0x2914('0xf')](config[_0x2914('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x2914('0x10'))(new Redis(config[_0x2914('0xe')]));require(_0x2914('0x11'))['register'](socket);var jayson=require(_0x2914('0x12'));var client=jayson[_0x2914('0x13')]['http']({'port':0x232b});var client9004=jayson[_0x2914('0x13')]['http']({'port':0x232c});function respondWithRpcPromise(_0xc5c441,_0x4d03a6,_0x54d39,_0x1f933e){return new BPromise(function(_0x5ab080,_0x32bd49){var _0x161e77=_0x1f933e||client;return _0x161e77[_0x2914('0x14')](_0xc5c441,_0x54d39)[_0x2914('0x15')](function(_0x1665f9){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x4d03a6,_0x2914('0x16'));logger[_0x2914('0x17')](_0x2914('0x18'),_0x4d03a6,'request\x20sent',JSON[_0x2914('0x19')](_0x1665f9));if(_0x1665f9[_0x2914('0x1a')]){if(_0x1665f9[_0x2914('0x1a')]['code']===0x1f4){logger['error'](_0x2914('0x1b'),_0x4d03a6,_0x1665f9[_0x2914('0x1a')][_0x2914('0x1c')]);return _0x32bd49(_0x1665f9[_0x2914('0x1a')]['message']);}logger[_0x2914('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x4d03a6,_0x1665f9[_0x2914('0x1a')][_0x2914('0x1c')]);return _0x5ab080(_0x1665f9[_0x2914('0x1a')][_0x2914('0x1c')]);}else{logger[_0x2914('0x1d')](_0x2914('0x1b'),_0x4d03a6,_0x2914('0x16'));_0x5ab080(_0x1665f9[_0x2914('0x1e')][_0x2914('0x1c')]);}})[_0x2914('0x1f')](function(_0x11199c){logger[_0x2914('0x1a')](_0x2914('0x1b'),_0x4d03a6,_0x11199c);_0x32bd49(_0x11199c);});});}function respondWithStatusCode(_0x4ffabb,_0x29be57){_0x29be57=_0x29be57||0xcc;return function(_0x5b97fd){if(_0x5b97fd){return _0x4ffabb[_0x2914('0x20')](_0x29be57);}return _0x4ffabb[_0x2914('0x21')](_0x29be57)['end']();};}function respondWithResult(_0x3ddc35,_0x4f4884){_0x4f4884=_0x4f4884||0xc8;return function(_0x206efa){if(_0x206efa){return _0x3ddc35['status'](_0x4f4884)[_0x2914('0x22')](_0x206efa);}};}function respondWithFilteredResult(_0x42e1dd,_0x1aa8c2){return function(_0x239e91){if(_0x239e91){var _0x534008=typeof _0x1aa8c2['offset']===_0x2914('0x23')&&typeof _0x1aa8c2[_0x2914('0x24')]===_0x2914('0x23');var _0x4e1041=_0x239e91['count'];var _0x2b072e=_0x534008?0x0:_0x1aa8c2[_0x2914('0x25')];var _0x3da8f9=_0x534008?_0x239e91[_0x2914('0x26')]:_0x1aa8c2[_0x2914('0x25')]+_0x1aa8c2[_0x2914('0x24')];var _0x5e87c8;if(_0x3da8f9>=_0x4e1041){_0x3da8f9=_0x4e1041;_0x5e87c8=0xc8;}else{_0x5e87c8=0xce;}_0x42e1dd['status'](_0x5e87c8);return _0x42e1dd['set'](_0x2914('0x27'),_0x2b072e+'-'+_0x3da8f9+'/'+_0x4e1041)[_0x2914('0x22')](_0x239e91);}return null;};}function saveUpdates(_0x333973){return function(_0x1bc9f7){if(_0x1bc9f7){return _0x1bc9f7[_0x2914('0x28')](_0x333973)[_0x2914('0x15')](function(_0x4a1bfb){return _0x4a1bfb;});}return null;};}function removeEntity(_0x4013ef){return function(_0x864795){if(_0x864795){return _0x864795[_0x2914('0x29')]()['then'](function(){_0x4013ef[_0x2914('0x21')](0xcc)[_0x2914('0x2a')]();});}};}function handleEntityNotFound(_0x547501){return function(_0x1f3cc5){if(!_0x1f3cc5){_0x547501[_0x2914('0x20')](0x194);}return _0x1f3cc5;};}function handleError(_0x16f487,_0x458f7c){_0x458f7c=_0x458f7c||0x1f4;return function(_0x30845e){logger['error'](_0x30845e[_0x2914('0x2b')]);if(_0x30845e[_0x2914('0x2c')]){delete _0x30845e[_0x2914('0x2c')];}_0x16f487[_0x2914('0x21')](_0x458f7c)[_0x2914('0x2d')](_0x30845e);};}function getMustacheRender(_0x46e059,_0x31227a){return Mustache[_0x2914('0x2e')](_0x46e059,_[_0x2914('0x2f')](_0x31227a[_0x2914('0x30')],{'contact':_0x31227a['contact'],'message':_0x31227a[_0x2914('0x1c')],'agent':_0x31227a[_0x2914('0x31')],'interaction':_0x31227a[_0x2914('0x32')],'account':_0x31227a[_0x2914('0x33')]}))||'';}exports[_0x2914('0x34')]=function(_0x4d6912,_0xb04e1c){var _0x2593b8={};var _0x389a45=_[_0x2914('0x35')](db[_0x2914('0x36')][_0x2914('0x37')],function(_0x93f5e){return{'name':_0x93f5e[_0x2914('0x38')],'type':_0x93f5e[_0x2914('0x39')][_0x2914('0x3a')]};});_0x2593b8=qs['getOptions'](_0x389a45,_0x4d6912);return interaction['findAll'](_0x2914('0x3b'),_0x4d6912['query'],_0x4d6912[_0x2914('0x3c')],_0x2593b8,_0x389a45)[_0x2914('0x15')](respondWithFilteredResult(_0xb04e1c,_0x2593b8))[_0x2914('0x1f')](handleError(_0xb04e1c,null));};exports[_0x2914('0x3d')]=function(_0x22cd9f,_0x41c8af){var _0x3c9ce2={'raw':![],'where':{'id':_0x22cd9f['params']['id']}},_0xd6c0df={};_0xd6c0df[_0x2914('0x3e')]=_[_0x2914('0x3f')](db[_0x2914('0x36')][_0x2914('0x37')]);_0xd6c0df[_0x2914('0x40')]=_['keys'](_0x22cd9f[_0x2914('0x40')]);_0xd6c0df[_0x2914('0x41')]=_[_0x2914('0x42')](_0xd6c0df[_0x2914('0x3e')],_0xd6c0df[_0x2914('0x40')]);_0x3c9ce2[_0x2914('0x43')]=_[_0x2914('0x42')](_0xd6c0df[_0x2914('0x3e')],qs['fields'](_0x22cd9f['query']['fields']));_0x3c9ce2[_0x2914('0x43')]=_0x3c9ce2[_0x2914('0x43')][_0x2914('0x44')]?_0x3c9ce2[_0x2914('0x43')]:_0xd6c0df[_0x2914('0x3e')];if(_0x22cd9f[_0x2914('0x40')][_0x2914('0x45')]){_0x3c9ce2[_0x2914('0x46')]=[{'all':!![]}];}_0x3c9ce2=_[_0x2914('0x2f')]({},_0x3c9ce2,_0x22cd9f['options']);return db[_0x2914('0x36')][_0x2914('0x47')](_0x3c9ce2)[_0x2914('0x15')](handleEntityNotFound(_0x41c8af,null))[_0x2914('0x15')](respondWithResult(_0x41c8af,null))['catch'](handleError(_0x41c8af,null));};exports[_0x2914('0x48')]=function(_0x3e4105,_0x1dde03){return db[_0x2914('0x36')][_0x2914('0x48')](_0x3e4105[_0x2914('0x30')],{})[_0x2914('0x15')](respondWithResult(_0x1dde03,0xc9))[_0x2914('0x1f')](handleError(_0x1dde03,null));};exports[_0x2914('0x28')]=function(_0x7b65ee,_0x484b2c){if(_0x7b65ee[_0x2914('0x30')]['id']){delete _0x7b65ee['body']['id'];}return db[_0x2914('0x36')][_0x2914('0x47')]({'where':{'id':_0x7b65ee[_0x2914('0x49')]['id']}})['then'](handleEntityNotFound(_0x484b2c,null))[_0x2914('0x15')](saveUpdates(_0x7b65ee[_0x2914('0x30')],null))[_0x2914('0x15')](respondWithResult(_0x484b2c,null))[_0x2914('0x1f')](handleError(_0x484b2c,null));};exports[_0x2914('0x29')]=function(_0x534e1c,_0x3cdc50){return db[_0x2914('0x36')][_0x2914('0x47')]({'where':{'id':_0x534e1c[_0x2914('0x49')]['id']}})[_0x2914('0x15')](handleEntityNotFound(_0x3cdc50,null))[_0x2914('0x15')](removeEntity(_0x3cdc50,null))[_0x2914('0x1f')](handleError(_0x3cdc50,null));};exports[_0x2914('0x4a')]=function(_0x294ee3,_0x562c01){return db['ChatInteraction'][_0x2914('0x4a')]()[_0x2914('0x15')](respondWithResult(_0x562c01,null))[_0x2914('0x1f')](handleError(_0x562c01,null));};exports[_0x2914('0x4b')]=function(_0x4d38f2,_0x3000c7){var _0x4d8ce7=_0x4d38f2[_0x2914('0x49')]['id'];var _0x177a49;var _0xbc52b7;var _0x5a205e;return db['ChatInteraction']['findOne']({'where':{'id':_0x4d8ce7}})['then'](function(_0x27985e){_0x177a49=_0x27985e;return db[_0x2914('0x4c')][_0x2914('0x4d')]({'where':{'id':_0x27985e['ChatWebsiteId']},'attributes':['id',_0x2914('0x4e'),_0x2914('0x4f'),'vidaooTopic',_0x2914('0x50'),_0x2914('0x51')],'raw':!![]});})[_0x2914('0x15')](function(_0x274590){if(_0x274590&&_0x274590['vidaooApiKey']&&_0x274590[_0x2914('0x4f')]){_0xbc52b7=_0x274590;var _0xb05198={'interaction':{'id':_0x4d8ce7},'agent':{'id':_0x4d38f2[_0x2914('0x3c')]['id'],'name':_0x4d38f2[_0x2914('0x3c')][_0x2914('0x2c')],'fullname':_0x4d38f2[_0x2914('0x3c')][_0x2914('0x52')],'email':_0x4d38f2[_0x2914('0x3c')][_0x2914('0x53')]},'contact':_0x4d38f2[_0x2914('0x30')][_0x2914('0x54')],'account':_0x4d38f2[_0x2914('0x30')]['account']};var _0x506975={'rejectUnauthorized':![],'method':_0x2914('0x55'),'url':_0x2914('0x56'),'headers':{'X-APIKEY':_0x274590[_0x2914('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4d38f2['user'][_0x2914('0x53')]],'buttons':null,'topic':_0xbc52b7[_0x2914('0x57')],'note':_[_0x2914('0x58')](_0xbc52b7[_0x2914('0x50')])?null:getMustacheRender(_0xbc52b7[_0x2914('0x50')],_0xb05198),'metadata':null},'redirect':_0x2914('0x59'),'json':!![]};try{if(!_[_0x2914('0x58')](_0xbc52b7[_0x2914('0x51')])){var _0x1c6ee1=getMustacheRender(_0xbc52b7[_0x2914('0x51')],_0xb05198);var _0x5c472e=JSON[_0x2914('0x5a')](_0x1c6ee1);_0x506975[_0x2914('0x30')][_0x2914('0x5b')]=_0x5c472e;}}catch(_0x473ca2){throw new db[(_0x2914('0x5c'))][(_0x2914('0x5d'))](_0x2914('0x5e'));}return rp(_0x506975);}else{throw new db[(_0x2914('0x5c'))]['ValidationError'](_0x2914('0x5f'));}})[_0x2914('0x15')](function(_0x9e9489){_0x5a205e=_0x9e9489;if(_0x5a205e['id']){var _0x1d238e={'body':_0x5a205e[_0x2914('0x60')],'ChatWebsiteId':_0xbc52b7['id'],'ChatInteractionId':_0x177a49['id'],'direction':_0x2914('0x61'),'UserId':_0x4d38f2[_0x2914('0x3c')]['id']};return db[_0x2914('0x62')][_0x2914('0x48')](_0x1d238e,{});}else{throw new db[(_0x2914('0x5c'))][(_0x2914('0x5d'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x2914('0x15')](function(){return _0x177a49[_0x2914('0x63')]({'vidaooSessionId':_0x5a205e['id']});})[_0x2914('0x15')](respondWithResult(_0x3000c7,null))[_0x2914('0x1f')](handleError(_0x3000c7,null));};exports[_0x2914('0x64')]=function(_0x92a6e4,_0x4f7dc6){if(_0x92a6e4[_0x2914('0x30')]['id']){delete _0x92a6e4[_0x2914('0x30')]['id'];}return db[_0x2914('0x36')]['find']({'where':{'id':_0x92a6e4[_0x2914('0x49')]['id']},'include':[{'model':db['CmContact'],'as':_0x2914('0x65')}]})[_0x2914('0x15')](handleEntityNotFound(_0x4f7dc6,null))['then'](saveUpdates(_0x92a6e4[_0x2914('0x30')],null))[_0x2914('0x15')](respondWithResult(_0x4f7dc6,null))[_0x2914('0x1f')](handleError(_0x4f7dc6,null));};exports[_0x2914('0x66')]=function(_0x2bc177,_0x6361a2){if(_0x2bc177['body']['id']){delete _0x2bc177[_0x2914('0x30')]['id'];}return db[_0x2914('0x36')][_0x2914('0x47')]({'where':{'id':_0x2bc177[_0x2914('0x49')]['id']}})[_0x2914('0x15')](function(_0x1a85bd){if(!_0x1a85bd){logger[_0x2914('0x1a')](_0x2914('0x67'),_0x2914('0x66'),0x194,_0x2914('0x68'));_0x6361a2[_0x2914('0x20')](0x194);}else{if(_0x1a85bd[_0x2914('0x69')]){throw new db[(_0x2914('0x5c'))]['ValidationError'](_0x2914('0x6a'));}}return _0x1a85bd;})['then'](function(_0x11c33e){if(_0x11c33e){return _0x11c33e[_0x2914('0x28')]({'closed':_0x2bc177[_0x2914('0x30')][_0x2914('0x6b')],'disposition':_0x2bc177[_0x2914('0x30')][_0x2914('0x6c')]})[_0x2914('0x15')](function(_0xe9552d){return _0xe9552d;});}})['then'](function(){return respondWithRpcPromise(_0x2914('0x6d'),_0x2914('0x66'),_0x2bc177[_0x2914('0x30')],client9004);})[_0x2914('0x15')](respondWithResult(_0x6361a2,null))[_0x2914('0x1f')](handleError(_0x6361a2,null));};exports[_0x2914('0x6e')]=function(_0x310cdf,_0x287e03){_0x310cdf['body'][_0x2914('0x2c')]=_0x310cdf['file'][_0x2914('0x6f')];_0x310cdf[_0x2914('0x30')][_0x2914('0x70')]=_0x310cdf[_0x2914('0x71')][_0x2914('0x72')];_0x310cdf[_0x2914('0x30')]['type']=_0x310cdf['file'][_0x2914('0x73')];return db['Attachment']['create'](_0x310cdf[_0x2914('0x30')])[_0x2914('0x15')](respondWithResult(_0x287e03,0xc9))['catch'](handleError(_0x287e03,null));};exports['attachmentDownload']=function(_0x1c4e4f,_0x34e12a){return db[_0x2914('0x36')][_0x2914('0x4d')]({'where':{'id':_0x1c4e4f[_0x2914('0x49')]['id']},'raw':!![]})[_0x2914('0x15')](handleEntityNotFound(_0x34e12a,null))[_0x2914('0x15')](function(_0x191e97){if(_0x191e97){if(_0x191e97['closed']){return _0x34e12a[_0x2914('0x21')](0x193)[_0x2914('0x22')]({'status':0x193,'message':_0x2914('0x74')});}return db[_0x2914('0x75')][_0x2914('0x4d')]({'where':{'id':_0x1c4e4f['query'][_0x2914('0x76')]},'raw':!![]})[_0x2914('0x15')](handleEntityNotFound(_0x34e12a,null));}})[_0x2914('0x15')](function(_0x557b5f){if(_0x557b5f){var _0xe9ee00=_0x557b5f['ChatOfflineMessageId']!==null;var _0x1a4c4f=path[_0x2914('0x77')](config['root'],_0x2914('0x78'));if(_0xe9ee00){_0x1a4c4f=path[_0x2914('0x77')](_0x1a4c4f,'offline-chat/');}var _0x8ef8d6=path[_0x2914('0x77')](_0x1a4c4f,_0x557b5f[_0x2914('0x70')]);return _0x34e12a[_0x2914('0x79')](_0x8ef8d6);}})[_0x2914('0x1f')](handleError(_0x34e12a,null));};exports[_0x2914('0x7a')]=function(_0x452964,_0x2e4028){var _0xcd1eb4=null;var _0x4de9f0=null;var _0x51f918=null;if(_0x452964['body']['id']){delete _0x452964[_0x2914('0x30')]['id'];}if(_0x452964[_0x2914('0x30')][_0x2914('0x7b')]){_0x51f918=path[_0x2914('0x77')](config[_0x2914('0x7c')],_0x2914('0x7d'),util[_0x2914('0x7e')](_0x2914('0x7f'),Date[_0x2914('0x80')]()));_0x452964[_0x2914('0x30')]['pathTranscript']=_0x51f918;}return db['ChatInteraction'][_0x2914('0x47')]({'where':{'id':_0x452964[_0x2914('0x49')]['id']},'include':[{'model':db[_0x2914('0x62')],'as':'Messages','include':[{'model':db[_0x2914('0x81')],'as':_0x2914('0x81')}]}]})[_0x2914('0x15')](handleEntityNotFound(_0x2e4028,null))['then'](saveUpdates(_0x452964[_0x2914('0x30')],null))[_0x2914('0x15')](function(_0xa18838){if(_0xa18838){_0xcd1eb4=_0xa18838;return db['ChatWebsite'][_0x2914('0x47')]({'where':{'id':_0xcd1eb4[_0x2914('0x82')]}});}})['then'](function(_0x749286){if(_0x749286){_0x4de9f0=_0x749286;return db[_0x2914('0x83')][_0x2914('0x47')]({'where':{'id':_0xcd1eb4[_0x2914('0x84')]}});}})[_0x2914('0x15')](function(_0x3ee4d6){if(_0x3ee4d6){if(_0x51f918){var _0x3b9418=null;for(var _0x109559=0x1;_0x109559<_0xcd1eb4[_0x2914('0x85')][_0x2914('0x44')];++_0x109559){_0x3b9418=_0xcd1eb4[_0x2914('0x85')][_0x109559];var _0x16faed=_0x3b9418[_0x2914('0x69')]?util[_0x2914('0x7e')](_0x2914('0x86'),_0x4de9f0[_0x2914('0x87')],_0x3b9418[_0x2914('0x69')]):_0x2914('0x88');var _0x55d7a7=_0x452964['body'][_0x2914('0x89')]||util[_0x2914('0x7e')]('%s%d','Visitor',_0x3b9418[_0x2914('0x84')]);switch(_0x4de9f0[_0x2914('0x8a')]){case _0x2914('0x8b'):_0x16faed=_0x3b9418[_0x2914('0x69')]?util[_0x2914('0x7e')](_0x2914('0x86'),_0x4de9f0[_0x2914('0x87')],_0x3b9418['UserId']):_0x2914('0x88');break;case _0x2914('0x8c'):_0x16faed=_0x3b9418['UserId']?_0x3b9418[_0x2914('0x81')][_0x2914('0x8d')]||_0x3b9418[_0x2914('0x81')][_0x2914('0x52')]:'System';break;case _0x2914('0x8e'):_0x16faed=_0x3b9418['UserId']?_0x3b9418[_0x2914('0x81')][_0x2914('0x52')]:_0x2914('0x88');break;default:_0x16faed=_0x3b9418['UserId']?util['format'](_0x2914('0x86'),_0x4de9f0[_0x2914('0x87')],_0x3b9418[_0x2914('0x69')]):_0x2914('0x88');}var _0x5de42d=util[_0x2914('0x7e')](_0x2914('0x8f'),moment(_0x3b9418['createdAt'])[_0x2914('0x7e')](_0x2914('0x90')),_0x3b9418['direction']==='in'?_0x55d7a7:_0x16faed,_0x3b9418[_0x2914('0x30')]);if(!_0x3b9418[_0x2914('0x91')]){fs[_0x2914('0x92')](_0x51f918,_0x5de42d);}}return db[_0x2914('0x93')][_0x2914('0x4d')]({'where':{'service':!![]},'include':[{'model':db[_0x2914('0x94')],'as':_0x2914('0x95'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})['then'](function(_0x4ec4aa){if(!_0x4ec4aa||!_0x4ec4aa[_0x2914('0x95')]||!_0x452964[_0x2914('0x30')])return _0xcd1eb4;var _0x1459d4=_0x4ec4aa[_0x2914('0x96')]();return respondWithRpcPromise(_0x2914('0x97'),_0x2914('0x98'),{'account':_0x1459d4,'message':{'from':util[_0x2914('0x7e')](_0x2914('0x99'),_0x4ec4aa[_0x2914('0x2c')],_0x4ec4aa['email']||_0x4ec4aa[_0x2914('0x95')][_0x2914('0x3c')]),'to':_0x452964[_0x2914('0x30')]['mailTranscript'],'subject':_0x2914('0x9a'),'text':util[_0x2914('0x7e')](_0x2914('0x9b'),_0x452964[_0x2914('0x30')][_0x2914('0x7b')]),'attachments':[{'path':_0x51f918}]}})['then'](function(){return _0xcd1eb4;})[_0x2914('0x1f')](function(_0x55369c){logger[_0x2914('0x1a')](_0x55369c);});})[_0x2914('0x15')](respondWithStatusCode(_0x2e4028,0xc8))['catch'](handleError(_0x2e4028,null));};exports[_0x2914('0x9c')]=function(_0x5cbf0f,_0x24e1c9){return db[_0x2914('0x62')][_0x2914('0x47')]({'where':{'id':_0x5cbf0f[_0x2914('0x49')]['id']}})[_0x2914('0x15')](handleEntityNotFound(_0x24e1c9,null))[_0x2914('0x15')](function(_0x427ffa){if(_0x427ffa){return _0x427ffa[_0x2914('0x9c')](_0x5cbf0f[_0x2914('0x30')][_0x2914('0x9d')],_['omit'](_0x5cbf0f[_0x2914('0x30')],[_0x2914('0x9d'),'id'])||{});}})[_0x2914('0x15')](respondWithResult(_0x24e1c9,null))[_0x2914('0x1f')](handleError(_0x24e1c9,null));};exports[_0x2914('0x9e')]=function(_0x27056c,_0x64374b){var _0x3701b9={'raw':![],'where':{}};var _0x30ac95={};var _0x431ed3={'count':0x0,'rows':[]};return db[_0x2914('0x36')][_0x2914('0x4d')]({'where':{'id':_0x27056c['params']['id']}})['then'](handleEntityNotFound(_0x64374b,null))['then'](function(_0x403a42){if(_0x403a42){_0x30ac95[_0x2914('0x3e')]=_['keys'](db[_0x2914('0x62')][_0x2914('0x37')]);_0x30ac95['query']=_[_0x2914('0x3f')](_0x27056c[_0x2914('0x40')]);_0x30ac95[_0x2914('0x41')]=_[_0x2914('0x42')](_0x30ac95['model'],_0x30ac95[_0x2914('0x40')]);_0x3701b9[_0x2914('0x43')]=_['intersection'](_0x30ac95['model'],qs['fields'](_0x27056c[_0x2914('0x40')][_0x2914('0x9f')]));_0x3701b9[_0x2914('0x43')]=_0x3701b9[_0x2914('0x43')][_0x2914('0x44')]?_0x3701b9[_0x2914('0x43')]:_0x30ac95[_0x2914('0x3e')];if(!_0x27056c['query'][_0x2914('0xa0')](_0x2914('0xa1'))){_0x3701b9[_0x2914('0x24')]=qs[_0x2914('0x24')](_0x27056c[_0x2914('0x40')][_0x2914('0x24')]);_0x3701b9[_0x2914('0x25')]=qs['offset'](_0x27056c[_0x2914('0x40')][_0x2914('0x25')]);}_0x3701b9[_0x2914('0xa2')]=qs[_0x2914('0xa3')](_0x27056c[_0x2914('0x40')][_0x2914('0xa3')]);_0x3701b9[_0x2914('0xa4')]=qs[_0x2914('0x41')](_['pick'](_0x27056c[_0x2914('0x40')],_0x30ac95[_0x2914('0x41')]));_0x3701b9[_0x2914('0xa4')][_0x2914('0xa5')]=_0x403a42['id'];if(_0x27056c[_0x2914('0x40')]['filter']){_0x3701b9[_0x2914('0xa4')]=_[_0x2914('0x2f')](_0x3701b9[_0x2914('0xa4')],{'$or':_[_0x2914('0x35')](_0x3701b9['attributes'],function(_0x55b1cf){var _0x3f2f15={};_0x3f2f15[_0x55b1cf]={'$like':'%'+_0x27056c[_0x2914('0x40')][_0x2914('0xa6')]+'%'};return _0x3f2f15;})});}if(_0x27056c['query'][_0x2914('0xa7')]){var _0x3fd64b=_0x27056c['query'][_0x2914('0xa7')][_0x2914('0xa8')](',');var _0x3f51ce={};_0x3f51ce[_0x3fd64b[0x0]]={'$gte':moment(_0x3fd64b[0x1])[_0x2914('0x7e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3701b9[_0x2914('0xa4')]=_[_0x2914('0x2f')](_0x3701b9[_0x2914('0xa4')],_0x3f51ce);}_0x3701b9=_[_0x2914('0x2f')]({},_0x3701b9,_0x27056c[_0x2914('0xa9')]);return db[_0x2914('0x62')][_0x2914('0x26')]({'where':_0x3701b9[_0x2914('0xa4')]})[_0x2914('0x15')](function(_0x367693){_0x431ed3['count']=_0x367693;if(_0x27056c[_0x2914('0x40')][_0x2914('0x45')]){_0x3701b9['include']=[{'all':!![]}];}return db[_0x2914('0x62')][_0x2914('0xaa')](_0x3701b9);})[_0x2914('0x15')](function(_0x3d0a71){_0x431ed3[_0x2914('0xab')]=_0x3d0a71;return _0x431ed3;});}})[_0x2914('0x15')](respondWithFilteredResult(_0x64374b,_0x3701b9))[_0x2914('0x1f')](handleError(_0x64374b,null));};exports[_0x2914('0xac')]=function(_0x4f77f4,_0x3163f8){var _0x54508d={'where':{}},_0x217220={},_0x15c21c={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x2914('0x4d')]({'where':{'id':_0x4f77f4[_0x2914('0x49')]['id']}})[_0x2914('0x15')](handleEntityNotFound(_0x3163f8,null))[_0x2914('0x15')](function(_0x479248){if(_0x479248){_0x217220[_0x2914('0x3e')]=_['keys'](db[_0x2914('0x62')][_0x2914('0x37')]);_0x217220[_0x2914('0x40')]=_[_0x2914('0x3f')](_0x4f77f4[_0x2914('0x40')]);_0x217220[_0x2914('0x41')]=_[_0x2914('0x42')](_0x217220[_0x2914('0x3e')],_0x217220[_0x2914('0x40')]);_0x54508d[_0x2914('0x43')]=_[_0x2914('0x42')](_0x217220[_0x2914('0x3e')],qs[_0x2914('0x9f')](_0x4f77f4[_0x2914('0x40')]['fields']));_0x54508d[_0x2914('0x43')]=_0x54508d[_0x2914('0x43')]['length']?_0x54508d[_0x2914('0x43')]:_0x217220['model'];if(!_0x4f77f4['query']['hasOwnProperty'](_0x2914('0xa1'))){_0x54508d['limit']=qs['limit'](_0x4f77f4[_0x2914('0x40')]['limit']);_0x54508d[_0x2914('0x25')]=qs['offset'](_0x4f77f4[_0x2914('0x40')]['offset']);}_0x54508d[_0x2914('0xa2')]=qs[_0x2914('0xa3')](_0x4f77f4['query'][_0x2914('0xa3')]);_0x54508d[_0x2914('0xa4')]=qs[_0x2914('0x41')](_[_0x2914('0xad')](_0x4f77f4['query'],_0x217220[_0x2914('0x41')]));_0x54508d[_0x2914('0xa4')][_0x2914('0xa5')]=_0x479248['id'];if(_0x4f77f4[_0x2914('0x40')]['filter']){_0x54508d['where']=_[_0x2914('0x2f')](_0x54508d[_0x2914('0xa4')],{'$or':_[_0x2914('0x35')](_0x54508d[_0x2914('0x43')],function(_0x2ec6f4){var _0x9f2b00={};_0x9f2b00[_0x2ec6f4]={'$like':'%'+_0x4f77f4[_0x2914('0x40')]['filter']+'%'};return _0x9f2b00;})});}_0x54508d[_0x2914('0xa4')]['secret']=![];if(_0x4f77f4[_0x2914('0x40')]['id']){_0x54508d[_0x2914('0xa4')]['id']={'$gt':_0x4f77f4[_0x2914('0x40')]['id']};}_0x54508d=_[_0x2914('0x2f')]({},_0x54508d,_0x4f77f4['options']);return db[_0x2914('0x62')][_0x2914('0x26')]({'where':_0x54508d[_0x2914('0xa4')]})[_0x2914('0x15')](function(_0x391fad){_0x15c21c[_0x2914('0x26')]=_0x391fad;_0x54508d['include']=[];if(_0x4f77f4[_0x2914('0x40')][_0x2914('0xae')]){_0x54508d[_0x2914('0x46')][_0x2914('0xaf')]({'model':db['User'],'as':'User','attributes':['id',_0x2914('0x52'),_0x2914('0x8d')]});}if(_0x4f77f4['query'][_0x2914('0x45')]){_0x54508d[_0x2914('0x46')]=[{'all':!![]}];}return db[_0x2914('0x62')]['findAll'](_0x54508d);})['then'](function(_0x151f38){_0x15c21c['rows']=_0x151f38;return _0x15c21c;});}})[_0x2914('0x15')](respondWithFilteredResult(_0x3163f8,_0x54508d))[_0x2914('0x1f')](handleError(_0x3163f8,null));};exports[_0x2914('0xb0')]=function(_0x10bab4,_0x52bb43){return db[_0x2914('0x36')][_0x2914('0x47')]({'where':{'id':_0x10bab4[_0x2914('0x49')]['id']}})['then'](handleEntityNotFound(_0x52bb43,null))[_0x2914('0x15')](function(_0x4dc3b8){if(_0x4dc3b8){return _0x4dc3b8[_0x2914('0xb1')](_0x10bab4['body'][_0x2914('0x9d')],_[_0x2914('0xb2')](_0x10bab4[_0x2914('0x30')],[_0x2914('0x9d'),'id'])||{})[_0x2914('0xb3')](function(){return db[_0x2914('0xb4')]['findAll']({'attributes':['id','name',_0x2914('0xb5')],'where':{'id':_0x10bab4[_0x2914('0x30')][_0x2914('0x9d')]}});})[_0x2914('0x15')](function(_0x439382){socket[_0x2914('0xb6')](_0x2914('0xb7'),{'id':Number(_0x10bab4[_0x2914('0x49')]['id']),'tags':_0x439382||[]});return{'id':Number(_0x10bab4['params']['id']),'tags':_0x439382||[]};});}})[_0x2914('0x15')](respondWithResult(_0x52bb43,null))[_0x2914('0x1f')](handleError(_0x52bb43,null));};exports[_0x2914('0xb8')]=function(_0x3cf33f,_0x54083d){return db[_0x2914('0x36')]['find']({'where':{'id':_0x3cf33f[_0x2914('0x49')]['id']}})[_0x2914('0x15')](handleEntityNotFound(_0x54083d,null))[_0x2914('0x15')](function(_0x120c06){if(_0x120c06){return _0x120c06[_0x2914('0xb8')](_0x3cf33f[_0x2914('0x40')][_0x2914('0x9d')]);}})[_0x2914('0x15')](respondWithStatusCode(_0x54083d,null))[_0x2914('0x1f')](handleError(_0x54083d,null));};exports['download']=function(_0xd05568,_0x2b91ed){var _0x53df09=moment()[_0x2914('0xb9')]()['toString']();var _0x1d26d5=path[_0x2914('0x77')](config[_0x2914('0x7c')],_0x2914('0xba'),'files',_0x2914('0xbb'));var _0x4a1d34=path[_0x2914('0x77')](config[_0x2914('0x7c')],_0x2914('0xba'),_0x2914('0xbc'),_0x2914('0xbd'));var _0x4e86fb=path[_0x2914('0x77')](_0x1d26d5,_0x53df09);var _0x5bb3b4=util[_0x2914('0x7e')]('transcript-%d-%s.zip',_0xd05568[_0x2914('0x49')]['id'],_0x53df09);var _0x3906a2=path[_0x2914('0x77')](_0x1d26d5,_0x5bb3b4);var _0xe40f5d=[];_0xe40f5d[_0x2914('0xaf')]({'model':db[_0x2914('0x81')],'as':_0x2914('0x81'),'attributes':['id','fullname'],'raw':!![]});_0xe40f5d[_0x2914('0xaf')]({'model':db[_0x2914('0x83')],'as':'Contact','attributes':['id',_0x2914('0xbe'),_0x2914('0xbf')],'raw':!![]});if(_0xd05568[_0x2914('0x40')][_0x2914('0xbd')]){_0xe40f5d[_0x2914('0xaf')]({'model':db[_0x2914('0x75')],'as':'Attachment','raw':!![]});}var _0x2eaf79=[{'model':db[_0x2914('0x62')],'as':_0x2914('0x85'),'attributes':['id',_0x2914('0x30'),_0x2914('0xc0'),'direction',_0x2914('0x91'),_0x2914('0xc1')],'include':_0xe40f5d}];_0x2eaf79[_0x2914('0xaf')]({'model':db[_0x2914('0x4c')],'as':_0x2914('0xc2'),'attributes':['id','name']});_0x2eaf79[_0x2914('0xaf')]({'model':db['User'],'as':_0x2914('0xc3'),'attributes':['id','fullname']});return db[_0x2914('0x36')][_0x2914('0x47')]({'where':{'id':_0xd05568[_0x2914('0x49')]['id']},'include':_0x2eaf79})[_0x2914('0x15')](handleEntityNotFound(_0x2b91ed,null))['then'](function(_0xd1e2bc){if(_0xd1e2bc){var _0x28292c=_0xd1e2bc['get']({'plain':!![]});fs[_0x2914('0xc4')](_0x4e86fb);var _0x29d2be={'channel':_0x2914('0xc5'),'account':_0x28292c['Account']['name'],'agent':_0x28292c['Owner']?_0x28292c[_0x2914('0xc3')][_0x2914('0x52')]:_0x2914('0xc6'),'createdAt':moment(_0x28292c[_0x2914('0xc0')])[_0x2914('0x7e')](_0x2914('0xc7'))[_0x2914('0xc8')](),'closedAt':_0x28292c['closed']?moment(_0x28292c[_0x2914('0xc9')])[_0x2914('0x7e')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2914('0xc8')]():'','disposition':_0x28292c['disposition'],'chatInfo':{'browser':_0x28292c[_0x2914('0xca')],'os':_0x28292c[_0x2914('0xcb')],'referer':_0x28292c[_0x2914('0xcc')],'customerIp':_0x28292c[_0x2914('0xcd')],'customerPort':_0x28292c[_0x2914('0xce')]?_0x28292c[_0x2914('0xce')]:_0x2914('0xc6')},'messages':_(_0x28292c[_0x2914('0x85')])[_0x2914('0xcf')]()[_0x2914('0xa6')]({'secret':![]})[_0x2914('0x35')](function(_0x1a771a){if(_0x1a771a[_0x2914('0x75')]){var _0x14259e=path[_0x2914('0x77')](_0x4a1d34,_0x1a771a[_0x2914('0x75')][_0x2914('0x70')]);if(fs['existsSync'](_0x14259e)){fs[_0x2914('0xd0')](_0x14259e)[_0x2914('0xd1')](fs[_0x2914('0xd2')](path[_0x2914('0x77')](_0x4e86fb,_0x1a771a['Attachment'][_0x2914('0x70')])));}}return{'date':moment(_0x1a771a['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x2914('0xc8')](),'sender':_0x1a771a[_0x2914('0xd3')]===_0x2914('0x61')?_0x1a771a[_0x2914('0x81')]?_0x1a771a[_0x2914('0x81')][_0x2914('0x52')]:_0x2914('0x88'):_0x1a771a[_0x2914('0x65')]['firstName']+(_0x1a771a[_0x2914('0x65')][_0x2914('0xbf')]?'\x20'+_0x1a771a[_0x2914('0x65')][_0x2914('0xbf')]:''),'body':_0x1a771a['Attachment']?_0x1a771a[_0x2914('0x75')][_0x2914('0x70')]:_0x1a771a[_0x2914('0x30')],'direction':_0x1a771a[_0x2914('0xd3')]===_0x2914('0x61')?'A':'C','secret':_0x1a771a[_0x2914('0x91')],'read':_0x1a771a[_0x2914('0xc1')],'attachment':_0x1a771a[_0x2914('0x75')]};})[_0x2914('0xd4')]()};return ejs[_0x2914('0xd5')](path['join'](config[_0x2914('0x7c')],_0x2914('0xba'),_0x2914('0xd6'),_0x2914('0xd7')),{'interaction':_0x29d2be})[_0x2914('0x15')](function(_0x5c1028){var _0x4a6b9a=path[_0x2914('0x77')](_0x4e86fb,_0x2914('0xd8')+_0x28292c['id']+'-'+_0x53df09+_0x2914('0xd9'));var _0x54b9ab={'path':_0x4a6b9a,'channel':_0x2914('0xc5'),'interactionId':_0x28292c['id']};return pdf[_0x2914('0xda')](_0x5c1028,_0x54b9ab);})[_0x2914('0x15')](function(){return new Promise(function(_0x34cf29,_0x3761dd){zipdir(_0x4e86fb,{'saveTo':_0x3906a2},function(_0x1f0efa,_0x15e8f4){if(_0x1f0efa)return _0x3761dd(_0x1f0efa);return _0x34cf29(_0x15e8f4);});})[_0x2914('0x15')](function(){return new BPromise(function(_0xeca6a0,_0x4d3bea){rimraf(_0x4e86fb,function(_0x316197){if(_0x316197)_0x4d3bea(_0x316197);return _0xeca6a0();});});})['then'](function(){return _0x2b91ed[_0x2914('0x79')](_0x3906a2,_0x5bb3b4,function(_0x2ad873){if(_0x2ad873){logger['error']('err',_0x2ad873);}else{fs['unlinkSync'](_0x3906a2);}});});});}else{return _0x2b91ed['sendStatus'](0xc8);}})[_0x2914('0x1f')](handleError(_0x2b91ed,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 81469b0..dc8e665 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 _0x7e2e=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage'];(function(_0x3dee06,_0x3bde8b){var _0xff42aa=function(_0x176e6a){while(--_0x176e6a){_0x3dee06['push'](_0x3dee06['shift']());}};_0xff42aa(++_0x3bde8b);}(_0x7e2e,0x152));var _0xe7e2=function(_0x226d67,_0x827cd7){_0x226d67=_0x226d67-0x0;var _0x14cbd4=_0x7e2e[_0x226d67];return _0x14cbd4;};'use strict';var EventEmitter=require(_0xe7e2('0x0'));var ChatInteraction=require(_0xe7e2('0x1'))['db'][_0xe7e2('0x2')];var ChatMessage=require(_0xe7e2('0x1'))['db'][_0xe7e2('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xe7e2('0x4')](0x0);var events={'afterCreate':_0xe7e2('0x5'),'afterUpdate':_0xe7e2('0x6'),'afterDestroy':_0xe7e2('0x7')};function emitEvent(_0x4e5027){return function(_0xc574db,_0x511234,_0x151b9c){_0xc574db[_0xe7e2('0x8')]({'attributes':['id'],'raw':!![]})[_0xe7e2('0x9')](function(_0x4b6b96){_0xc574db[_0xe7e2('0xa')]('Users',_0x4b6b96['map'](function(_0x4045f6){return{'id':_0x4045f6['id']};}));return ChatMessage[_0xe7e2('0xb')]({'where':{'ChatInteractionId':_0xc574db['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe7e2('0x9')](function(_0x59b4d8){_0xc574db[_0xe7e2('0xa')](_0xe7e2('0xc'),_0x59b4d8[_0xe7e2('0xd')]);ChatInteractionEvents['emit'](_0x4e5027+':'+_0xc574db['id'],_0xc574db);ChatInteractionEvents[_0xe7e2('0xe')](_0x4e5027,_0xc574db);_0x151b9c(null);})[_0xe7e2('0xf')](_0x151b9c(null));};}for(var e in events){if(events[_0xe7e2('0x10')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xe7e2('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x17b8=['emit','catch','hasOwnProperty','hook','exports','ChatInteraction','setMaxListeners','save','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x135fa5,_0x5068d7){var _0x40789f=function(_0x280a2d){while(--_0x280a2d){_0x135fa5['push'](_0x135fa5['shift']());}};_0x40789f(++_0x5068d7);}(_0x17b8,0x147));var _0x817b=function(_0x17b339,_0x57ebcf){_0x17b339=_0x17b339-0x0;var _0x1437c1=_0x17b8[_0x17b339];return _0x1437c1;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0x817b('0x0')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x817b('0x1')](0x0);var events={'afterCreate':_0x817b('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4857ee){return function(_0x2ec9ba,_0x43b5d6,_0x1f6466){_0x2ec9ba[_0x817b('0x3')]({'attributes':['id'],'raw':!![]})[_0x817b('0x4')](function(_0x4862f1){_0x2ec9ba[_0x817b('0x5')](_0x817b('0x6'),_0x4862f1[_0x817b('0x7')](function(_0x49e9bb){return{'id':_0x49e9bb['id']};}));return ChatMessage[_0x817b('0x8')]({'where':{'ChatInteractionId':_0x2ec9ba['id'],'direction':'in','read':![]},'raw':!![]});})[_0x817b('0x4')](function(_0x35439f){_0x2ec9ba[_0x817b('0x5')]('unreadMessages',_0x35439f['length']);ChatInteractionEvents[_0x817b('0x9')](_0x4857ee+':'+_0x2ec9ba['id'],_0x2ec9ba);ChatInteractionEvents[_0x817b('0x9')](_0x4857ee,_0x2ec9ba);_0x1f6466(null);})[_0x817b('0xa')](_0x1f6466(null));};}for(var e in events){if(events[_0x817b('0xb')](e)){var event=events[e];ChatInteraction[_0x817b('0xc')](e,emitEvent(event));}}module[_0x817b('0xd')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index e50b65d..5449594 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 _0xaf6a=['rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','bluebird','request-promise','path'];(function(_0x5a4ec0,_0x1233b3){var _0x5b2ecf=function(_0x1bc9f3){while(--_0x1bc9f3){_0x5a4ec0['push'](_0x5a4ec0['shift']());}};_0x5b2ecf(++_0x1233b3);}(_0xaf6a,0xc2));var _0xaaf6=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xaf6a[_0x2f3848];return _0x102668;};'use strict';var _=require(_0xaaf6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xaaf6('0x1'));var rp=require(_0xaaf6('0x2'));var fs=require('fs');var path=require(_0xaaf6('0x3'));var rimraf=require(_0xaaf6('0x4'));var config=require(_0xaaf6('0x5'));var attributes=require(_0xaaf6('0x6'));module[_0xaaf6('0x7')]=function(_0x5208ae,_0x2e1f5a){return _0x5208ae[_0xaaf6('0x8')](_0xaaf6('0x9'),attributes,{'tableName':_0xaaf6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x252874,_0x36d60b,_0x1b2e0a){if(_0x252874[_0xaaf6('0xb')](_0xaaf6('0xc'))){_0x252874[_0xaaf6('0xd')]=moment()[_0xaaf6('0xe')](_0xaaf6('0xf'));}_0x1b2e0a(null,_0x252874);}},'charset':_0xaaf6('0x10'),'collate':_0xaaf6('0x11')});}; \ No newline at end of file +var _0x76e2=['utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','ChatInteraction','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76e2,0x110));var _0x276e=function(_0x434adb,_0x58959b){_0x434adb=_0x434adb-0x0;var _0x4b7483=_0x76e2[_0x434adb];return _0x4b7483;};'use strict';var _=require(_0x276e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x276e('0x1'));var BPromise=require(_0x276e('0x2'));var rp=require(_0x276e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x276e('0x4'));var config=require(_0x276e('0x5'));var attributes=require(_0x276e('0x6'));module['exports']=function(_0x127471,_0x1b7b6b){return _0x127471['define'](_0x276e('0x7'),attributes,{'tableName':_0x276e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25491f,_0x1b19ea,_0x16c553){if(_0x25491f['changed'](_0x276e('0x9'))){_0x25491f[_0x276e('0xa')]=moment()[_0x276e('0xb')](_0x276e('0xc'));}_0x16c553(null,_0x25491f);}},'charset':_0x276e('0xd'),'collate':_0x276e('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index d48a3f5..1b216e9 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 _0x6674=['socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','AddTagsToChatInteraction','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x2a7523,_0x2c0915){var _0x3c1fd0=function(_0x350c2f){while(--_0x350c2f){_0x2a7523['push'](_0x2a7523['shift']());}};_0x3c1fd0(++_0x2c0915);}(_0x6674,0x113));var _0x4667=function(_0x205edc,_0x52fbb6){_0x205edc=_0x205edc-0x0;var _0x3370e3=_0x6674[_0x205edc];return _0x3370e3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4667('0x0'));var BPromise=require(_0x4667('0x1'));var rs=require(_0x4667('0x2'));var fs=require('fs');var Redis=require(_0x4667('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4667('0x4'))('rpc');var config=require(_0x4667('0x5'));var jayson=require(_0x4667('0x6'));var client=jayson[_0x4667('0x7')][_0x4667('0x8')]({'port':0x232a});config[_0x4667('0x9')]=_[_0x4667('0xa')](config['redis'],{'host':_0x4667('0xb'),'port':0x18eb});var socket=require(_0x4667('0xc'))(new Redis(config[_0x4667('0x9')]));require(_0x4667('0xd'))[_0x4667('0xe')](socket);function respondWithRpcPromise(_0xa99f87,_0x2ad836,_0x1343c6){return new BPromise(function(_0x2f16d7,_0x1eed8a){return client[_0x4667('0xf')](_0xa99f87,_0x1343c6)[_0x4667('0x10')](function(_0x5339c6){logger[_0x4667('0x11')](_0x4667('0x12'),_0x2ad836,_0x4667('0x13'));logger[_0x4667('0x14')](_0x4667('0x15'),_0x2ad836,_0x4667('0x13'),JSON[_0x4667('0x16')](_0x5339c6));if(_0x5339c6['error']){if(_0x5339c6[_0x4667('0x17')]['code']===0x1f4){logger[_0x4667('0x17')](_0x4667('0x12'),_0x2ad836,_0x5339c6[_0x4667('0x17')][_0x4667('0x18')]);return _0x1eed8a(_0x5339c6[_0x4667('0x17')][_0x4667('0x18')]);}logger[_0x4667('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x2ad836,_0x5339c6[_0x4667('0x17')][_0x4667('0x18')]);return _0x2f16d7(_0x5339c6[_0x4667('0x17')][_0x4667('0x18')]);}else{logger[_0x4667('0x11')](_0x4667('0x12'),_0x2ad836,_0x4667('0x13'));_0x2f16d7(_0x5339c6[_0x4667('0x19')][_0x4667('0x18')]);}})[_0x4667('0x1a')](function(_0x54e5df){logger[_0x4667('0x17')](_0x4667('0x12'),_0x2ad836,_0x54e5df);_0x1eed8a(_0x54e5df);});});}exports[_0x4667('0x1b')]=function(_0x4d7029){var _0x45aa16=this;return new Promise(function(_0x3e96fe,_0x56961a){return db[_0x4667('0x1c')][_0x4667('0x1d')](_0x4d7029[_0x4667('0x1e')],{'raw':_0x4d7029['options']?_0x4d7029[_0x4667('0x1f')][_0x4667('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d7029[_0x4667('0x1f')]?_0x4d7029['options'][_0x4667('0x21')]||null:null,'attributes':_0x4d7029[_0x4667('0x1f')]?_0x4d7029[_0x4667('0x1f')][_0x4667('0x22')]||null:null,'limit':_0x4d7029[_0x4667('0x1f')]?_0x4d7029['options']['limit']||null:null})[_0x4667('0x10')](function(_0x3b0e32){logger[_0x4667('0x11')]('UpdateChatInteraction',_0x4d7029);logger[_0x4667('0x14')](_0x4667('0x1b'),_0x4d7029,JSON[_0x4667('0x16')](_0x3b0e32));_0x3e96fe(_0x3b0e32);})[_0x4667('0x1a')](function(_0xd7f79){logger[_0x4667('0x17')](_0x4667('0x1b'),_0xd7f79[_0x4667('0x18')],_0x4d7029);_0x56961a(_0x45aa16[_0x4667('0x17')](0x1f4,_0xd7f79['message']));});});};exports[_0x4667('0x23')]=function(_0x5128f0){return new Promise(function(_0x486cf1,_0x52d942){return db[_0x4667('0x1c')]['find']({'where':_0x5128f0[_0x4667('0x1f')]?_0x5128f0['options'][_0x4667('0x21')]||null:null})[_0x4667('0x10')](function(_0x2c1806){if(_0x2c1806){return _0x2c1806[_0x4667('0x24')](_0x5128f0['body'][_0x4667('0x25')],_[_0x4667('0x26')](_0x5128f0[_0x4667('0x1e')],[_0x4667('0x25'),'id'])||{});}})[_0x4667('0x27')](function(_0x42d20d){logger[_0x4667('0x11')](_0x4667('0x28'),_0x5128f0);logger[_0x4667('0x14')](_0x4667('0x28'),_0x5128f0,JSON[_0x4667('0x16')](_0x42d20d));_0x486cf1(_0x42d20d);})[_0x4667('0x1a')](function(_0x3d6b8c){logger[_0x4667('0x17')]('AddTags',_0x3d6b8c[_0x4667('0x18')],_0x5128f0);_0x52d942(_this[_0x4667('0x17')](0x1f4,_0x3d6b8c[_0x4667('0x18')]));});});}; \ No newline at end of file +var _0x7ce1=['request\x20sent','debug','error','code','ChatInteraction,\x20%s,\x20%s','message','info','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','then','stringify','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request'];(function(_0x16caba,_0x1d2d98){var _0x227f25=function(_0x529242){while(--_0x529242){_0x16caba['push'](_0x16caba['shift']());}};_0x227f25(++_0x1d2d98);}(_0x7ce1,0xea));var _0x17ce=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x7ce1[_0x34eb31];return _0x254994;};'use strict';var _=require(_0x17ce('0x0'));var util=require(_0x17ce('0x1'));var moment=require(_0x17ce('0x2'));var BPromise=require(_0x17ce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x17ce('0x4'));var db=require(_0x17ce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ce('0x6'))('rpc');var config=require(_0x17ce('0x7'));var jayson=require(_0x17ce('0x8'));var client=jayson[_0x17ce('0x9')][_0x17ce('0xa')]({'port':0x232a});config['redis']=_[_0x17ce('0xb')](config[_0x17ce('0xc')],{'host':_0x17ce('0xd'),'port':0x18eb});var socket=require(_0x17ce('0xe'))(new Redis(config['redis']));require(_0x17ce('0xf'))[_0x17ce('0x10')](socket);function respondWithRpcPromise(_0x3bd3ac,_0x213d1e,_0x1444ef){return new BPromise(function(_0x1e2864,_0x2fdba5){return client[_0x17ce('0x11')](_0x3bd3ac,_0x1444ef)['then'](function(_0x42f5eb){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x213d1e,_0x17ce('0x12'));logger[_0x17ce('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x213d1e,_0x17ce('0x12'),JSON['stringify'](_0x42f5eb));if(_0x42f5eb[_0x17ce('0x14')]){if(_0x42f5eb[_0x17ce('0x14')][_0x17ce('0x15')]===0x1f4){logger[_0x17ce('0x14')](_0x17ce('0x16'),_0x213d1e,_0x42f5eb['error'][_0x17ce('0x17')]);return _0x2fdba5(_0x42f5eb['error'][_0x17ce('0x17')]);}logger[_0x17ce('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x213d1e,_0x42f5eb[_0x17ce('0x14')][_0x17ce('0x17')]);return _0x1e2864(_0x42f5eb['error'][_0x17ce('0x17')]);}else{logger[_0x17ce('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x213d1e,'request\x20sent');_0x1e2864(_0x42f5eb['result'][_0x17ce('0x17')]);}})[_0x17ce('0x19')](function(_0xff945){logger['error'](_0x17ce('0x16'),_0x213d1e,_0xff945);_0x2fdba5(_0xff945);});});}exports[_0x17ce('0x1a')]=function(_0x4590ad){var _0x5628b6=this;return new Promise(function(_0x50d76f,_0x3ce4d0){return db[_0x17ce('0x1b')][_0x17ce('0x1c')](_0x4590ad[_0x17ce('0x1d')],{'raw':_0x4590ad['options']?_0x4590ad[_0x17ce('0x1e')][_0x17ce('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4590ad['options']?_0x4590ad[_0x17ce('0x1e')][_0x17ce('0x20')]||null:null,'attributes':_0x4590ad[_0x17ce('0x1e')]?_0x4590ad[_0x17ce('0x1e')][_0x17ce('0x21')]||null:null,'limit':_0x4590ad[_0x17ce('0x1e')]?_0x4590ad['options'][_0x17ce('0x22')]||null:null})[_0x17ce('0x23')](function(_0x42ad05){logger['info'](_0x17ce('0x1a'),_0x4590ad);logger[_0x17ce('0x13')](_0x17ce('0x1a'),_0x4590ad,JSON[_0x17ce('0x24')](_0x42ad05));_0x50d76f(_0x42ad05);})['catch'](function(_0x13806){logger[_0x17ce('0x14')](_0x17ce('0x1a'),_0x13806[_0x17ce('0x17')],_0x4590ad);_0x3ce4d0(_0x5628b6[_0x17ce('0x14')](0x1f4,_0x13806[_0x17ce('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0xff66e3){return new Promise(function(_0xd6210e,_0x5b0fa2){return db[_0x17ce('0x1b')][_0x17ce('0x25')]({'where':_0xff66e3[_0x17ce('0x1e')]?_0xff66e3[_0x17ce('0x1e')][_0x17ce('0x20')]||null:null})[_0x17ce('0x23')](function(_0x3e88a8){if(_0x3e88a8){return _0x3e88a8['addTags'](_0xff66e3[_0x17ce('0x1d')][_0x17ce('0x26')],_[_0x17ce('0x27')](_0xff66e3[_0x17ce('0x1d')],[_0x17ce('0x26'),'id'])||{});}})[_0x17ce('0x28')](function(_0x53ae6c){logger[_0x17ce('0x18')](_0x17ce('0x29'),_0xff66e3);logger['debug'](_0x17ce('0x29'),_0xff66e3,JSON[_0x17ce('0x24')](_0x53ae6c));_0xd6210e(_0x53ae6c);})[_0x17ce('0x19')](function(_0x56052c){logger[_0x17ce('0x14')](_0x17ce('0x29'),_0x56052c[_0x17ce('0x17')],_0xff66e3);_0x5b0fa2(_this['error'](0x1f4,_0x56052c[_0x17ce('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 1794a58..7f5fcd0 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 _0x7857=['chatInteraction:','./chatInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x1d0aee,_0x2c4454){var _0x34ee2c=function(_0x6e3b9d){while(--_0x6e3b9d){_0x1d0aee['push'](_0x1d0aee['shift']());}};_0x34ee2c(++_0x2c4454);}(_0x7857,0x1a9));var _0x7785=function(_0x2b24fb,_0x3e0fe5){_0x2b24fb=_0x2b24fb-0x0;var _0x31c809=_0x7857[_0x2b24fb];return _0x31c809;};'use strict';var ChatInteractionEvents=require(_0x7785('0x0'));var events=[_0x7785('0x1'),'remove',_0x7785('0x2')];function createListener(_0x192376,_0x57ec14){return function(_0x25f0bd){_0x57ec14[_0x7785('0x3')](_0x192376,_0x25f0bd);};}function removeListener(_0x2d425b,_0x4e5021){return function(){ChatInteractionEvents[_0x7785('0x4')](_0x2d425b,_0x4e5021);};}exports[_0x7785('0x5')]=function(_0xdf64c8){for(var _0x555024=0x0,_0x53317c=events[_0x7785('0x6')];_0x555024<_0x53317c;_0x555024++){var _0x27300b=events[_0x555024];var _0x497757=createListener(_0x7785('0x7')+_0x27300b,_0xdf64c8);ChatInteractionEvents['on'](_0x27300b,_0x497757);}}; \ No newline at end of file +var _0xebe7=['register','./chatInteraction.events','save','remove'];(function(_0x2acd6d,_0x2e1bb0){var _0x5a080d=function(_0xed4591){while(--_0xed4591){_0x2acd6d['push'](_0x2acd6d['shift']());}};_0x5a080d(++_0x2e1bb0);}(_0xebe7,0x165));var _0x7ebe=function(_0xb49647,_0x56be38){_0xb49647=_0xb49647-0x0;var _0x264204=_0xebe7[_0xb49647];return _0x264204;};'use strict';var ChatInteractionEvents=require(_0x7ebe('0x0'));var events=[_0x7ebe('0x1'),_0x7ebe('0x2'),'update'];function createListener(_0x16335e,_0xb941ac){return function(_0x4d4fc1){_0xb941ac['emit'](_0x16335e,_0x4d4fc1);};}function removeListener(_0xddb7b7,_0x4ae750){return function(){ChatInteractionEvents['removeListener'](_0xddb7b7,_0x4ae750);};}exports[_0x7ebe('0x3')]=function(_0x4c23ad){for(var _0xbd6236=0x0,_0x242475=events['length'];_0xbd6236<_0x242475;_0xbd6236++){var _0xb03664=events[_0xbd6236];var _0x107102=createListener('chatInteraction:'+_0xb03664,_0x4c23ad);ChatInteractionEvents['on'](_0xb03664,_0x107102);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index e6c08b9..641417d 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 _0x79b4=['tracked','chat','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','get','/:id','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','join','root','server/files/attachments/','now','originalname','/:id/attachment_upload','single','addMessage','/:id/tags'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x79b4,0x141));var _0x479b=function(_0x145dac,_0x28127c){_0x145dac=_0x145dac-0x0;var _0x4a367b=_0x79b4[_0x145dac];return _0x4a367b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x479b('0x0'));var timeout=require(_0x479b('0x1'));var express=require('express');var router=express[_0x479b('0x2')]();var fs_extra=require(_0x479b('0x3'));var auth=require(_0x479b('0x4'));var interaction=require(_0x479b('0x5'));var config=require(_0x479b('0x6'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0x479b('0x7')](),controller['index']);router['get'](_0x479b('0x8'),auth[_0x479b('0x7')](),controller[_0x479b('0x9')]);router[_0x479b('0xa')](_0x479b('0xb'),auth[_0x479b('0xc')](),controller['show']);router['get'](_0x479b('0xd'),auth[_0x479b('0xc')](),controller['attachmentDownload']);router[_0x479b('0xa')](_0x479b('0xe'),auth[_0x479b('0x7')](),controller[_0x479b('0xf')]);router[_0x479b('0xa')]('/:id/my_messages',auth[_0x479b('0xc')](),controller[_0x479b('0x10')]);router[_0x479b('0xa')](_0x479b('0x11'),auth[_0x479b('0x7')](),controller[_0x479b('0x12')]);router[_0x479b('0x13')]('/',auth[_0x479b('0x7')](),controller[_0x479b('0x14')]);router['post'](_0x479b('0x15'),auth[_0x479b('0x7')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5254ec,_0x25def7,_0x4d4015){_0x4d4015(null,path[_0x479b('0x16')](config[_0x479b('0x17')],_0x479b('0x18')));},'filename':function(_0x1874a4,_0x467567,_0x3bcb7b){_0x3bcb7b(null,util['format']('%s-%s',Date[_0x479b('0x19')](),_0x467567[_0x479b('0x1a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x479b('0x13')](_0x479b('0x1b'),upload[_0x479b('0x1c')]('file'),controller['attachmentUpload']);router[_0x479b('0x13')]('/:id/messages',auth[_0x479b('0xc')](),controller[_0x479b('0x1d')]);router['post'](_0x479b('0x1e'),auth[_0x479b('0x7')](),interaction[_0x479b('0x1f')](_0x479b('0x20'),'chatinteraction:addtags'),controller[_0x479b('0x21')]);router[_0x479b('0x22')](_0x479b('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x479b('0x20'),_0x479b('0x23')),controller['update']);router[_0x479b('0x22')](_0x479b('0x24'),controller[_0x479b('0x25')]);router['put']('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x479b('0x26')]);router[_0x479b('0x22')](_0x479b('0x27'),controller[_0x479b('0x28')]);router[_0x479b('0x29')](_0x479b('0xb'),auth[_0x479b('0x7')](),interaction[_0x479b('0x1f')]('chat',_0x479b('0x2a')),controller[_0x479b('0x2b')]);router[_0x479b('0x29')](_0x479b('0x1e'),auth[_0x479b('0x7')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xa4d2=['%s-%s','now','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','addTags','put','chatinteraction:update','customUpdate','/:id/abandon','/:id/close','delete','chatinteraction:destroy','removeTags','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join'];(function(_0x208c8f,_0x3e8ffb){var _0x5033d7=function(_0x20357a){while(--_0x20357a){_0x208c8f['push'](_0x208c8f['shift']());}};_0x5033d7(++_0x3e8ffb);}(_0xa4d2,0x1ba));var _0x2a4d=function(_0x14db9d,_0x7ec740){_0x14db9d=_0x14db9d-0x0;var _0x192d36=_0xa4d2[_0x14db9d];return _0x192d36;};'use strict';var multer=require(_0x2a4d('0x0'));var util=require(_0x2a4d('0x1'));var path=require(_0x2a4d('0x2'));var timeout=require('connect-timeout');var express=require(_0x2a4d('0x3'));var router=express[_0x2a4d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2a4d('0x5'));var interaction=require(_0x2a4d('0x6'));var config=require('../../config/environment');var controller=require(_0x2a4d('0x7'));router[_0x2a4d('0x8')]('/',auth[_0x2a4d('0x9')](),controller[_0x2a4d('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x2a4d('0xb')]);router[_0x2a4d('0x8')](_0x2a4d('0xc'),auth[_0x2a4d('0xd')](),controller[_0x2a4d('0xe')]);router[_0x2a4d('0x8')](_0x2a4d('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x2a4d('0x10')]);router[_0x2a4d('0x8')](_0x2a4d('0x11'),auth[_0x2a4d('0x9')](),controller[_0x2a4d('0x12')]);router['get'](_0x2a4d('0x13'),auth[_0x2a4d('0xd')](),controller[_0x2a4d('0x14')]);router[_0x2a4d('0x8')](_0x2a4d('0x15'),auth[_0x2a4d('0x9')](),controller[_0x2a4d('0x16')]);router[_0x2a4d('0x17')]('/',auth[_0x2a4d('0x9')](),controller[_0x2a4d('0x18')]);router['post'](_0x2a4d('0x19'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x2a4d('0x1a')]({'destination':function(_0x3768e8,_0x34a004,_0x533e87){_0x533e87(null,path[_0x2a4d('0x1b')](config['root'],'server/files/attachments/'));},'filename':function(_0x398eb0,_0x5a593b,_0x10e56f){_0x10e56f(null,util['format'](_0x2a4d('0x1c'),Date[_0x2a4d('0x1d')](),_0x5a593b['originalname'][_0x2a4d('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2a4d('0x17')](_0x2a4d('0x1f'),upload['single'](_0x2a4d('0x20')),controller[_0x2a4d('0x21')]);router[_0x2a4d('0x17')](_0x2a4d('0x11'),auth[_0x2a4d('0xd')](),controller[_0x2a4d('0x22')]);router[_0x2a4d('0x17')](_0x2a4d('0x23'),auth[_0x2a4d('0x9')](),interaction[_0x2a4d('0x24')](_0x2a4d('0x25'),'chatinteraction:addtags'),controller[_0x2a4d('0x26')]);router[_0x2a4d('0x27')](_0x2a4d('0xc'),auth[_0x2a4d('0x9')](),interaction['tracked'](_0x2a4d('0x25'),_0x2a4d('0x28')),controller['update']);router[_0x2a4d('0x27')]('/:id/custom_update',controller[_0x2a4d('0x29')]);router['put'](_0x2a4d('0x2a'),auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0x2a4d('0x27')](_0x2a4d('0x2b'),controller['close']);router[_0x2a4d('0x2c')](_0x2a4d('0xc'),auth['isAuthenticated'](),interaction[_0x2a4d('0x24')](_0x2a4d('0x25'),_0x2a4d('0x2d')),controller['destroy']);router[_0x2a4d('0x2c')](_0x2a4d('0x23'),auth[_0x2a4d('0x9')](),controller[_0x2a4d('0x2e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index ba801bd..6168499 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 _0x009e=['exports','TEXT','medium','BOOLEAN','sequelize'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x009e,0x1cb));var _0xe009=function(_0x553a07,_0x206972){_0x553a07=_0x553a07-0x0;var _0x1c2b0d=_0x009e[_0x553a07];return _0x1c2b0d;};'use strict';var Sequelize=require(_0xe009('0x0'));module[_0xe009('0x1')]={'body':{'type':Sequelize[_0xe009('0x2')](_0xe009('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe009('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xae93=['TEXT','medium','BOOLEAN','sequelize'];(function(_0x26c448,_0x4c4861){var _0x293e4a=function(_0x4af00e){while(--_0x4af00e){_0x26c448['push'](_0x26c448['shift']());}};_0x293e4a(++_0x4c4861);}(_0xae93,0xab));var _0x3ae9=function(_0x128607,_0x242e5f){_0x128607=_0x128607-0x0;var _0x4ba37b=_0xae93[_0x128607];return _0x4ba37b;};'use strict';var Sequelize=require(_0x3ae9('0x0'));module['exports']={'body':{'type':Sequelize[_0x3ae9('0x1')](_0x3ae9('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3ae9('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 078d2f3..1b17328 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 _0x7c70=['sox','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','../../config/license/util','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','name','send','ChatInternalMessage','rawAttributes','fieldName','type','key','query','filters','model','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','params','keys','intersection','length','options','find','body','describe','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','resourceId','push','ToId','read','-createdAt','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0xfeb427,_0x160f45){var _0x39a04c=function(_0x40c1b5){while(--_0x40c1b5){_0xfeb427['push'](_0xfeb427['shift']());}};_0x39a04c(++_0x160f45);}(_0x7c70,0x13d));var _0x07c7=function(_0x5ed65f,_0x23d121){_0x5ed65f=_0x5ed65f-0x0;var _0x1f43ae=_0x7c70[_0x5ed65f];return _0x1f43ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07c7('0x0'));var zipdir=require(_0x07c7('0x1'));var jsonpatch=require(_0x07c7('0x2'));var rp=require(_0x07c7('0x3'));var moment=require('moment');var BPromise=require(_0x07c7('0x4'));var Mustache=require(_0x07c7('0x5'));var util=require(_0x07c7('0x6'));var path=require('path');var sox=require(_0x07c7('0x7'));var csv=require('to-csv');var ejs=require(_0x07c7('0x8'));var fs=require('fs');var fs_extra=require(_0x07c7('0x9'));var _=require('lodash');var squel=require(_0x07c7('0xa'));var crypto=require(_0x07c7('0xb'));var jsforce=require(_0x07c7('0xc'));var deskjs=require(_0x07c7('0xd'));var toCsv=require(_0x07c7('0xe'));var querystring=require(_0x07c7('0xf'));var Papa=require(_0x07c7('0x10'));var Redis=require(_0x07c7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x07c7('0x12'));var as=require(_0x07c7('0x13'));var hardwareService=require(_0x07c7('0x14'));var logger=require(_0x07c7('0x15'))(_0x07c7('0x16'));var utils=require(_0x07c7('0x17'));var config=require(_0x07c7('0x18'));var licenseUtil=require(_0x07c7('0x19'));var db=require('../../mysqldb')['db'];config[_0x07c7('0x1a')]=_[_0x07c7('0x1b')](config[_0x07c7('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x07c7('0x1c'))(new Redis(config[_0x07c7('0x1a')]));require(_0x07c7('0x1d'))[_0x07c7('0x1e')](socket);function respondWithStatusCode(_0x2d4cd6,_0x1417a0){_0x1417a0=_0x1417a0||0xcc;return function(_0x1bf7b4){if(_0x1bf7b4){return _0x2d4cd6[_0x07c7('0x1f')](_0x1417a0);}return _0x2d4cd6[_0x07c7('0x20')](_0x1417a0)[_0x07c7('0x21')]();};}function respondWithResult(_0x2e6001,_0x41cdf5){_0x41cdf5=_0x41cdf5||0xc8;return function(_0x2efdb0){if(_0x2efdb0){return _0x2e6001['status'](_0x41cdf5)[_0x07c7('0x22')](_0x2efdb0);}};}function respondWithFilteredResult(_0x346202,_0x412a08){return function(_0x47befb){if(_0x47befb){var _0x31f1a0=typeof _0x412a08['offset']===_0x07c7('0x23')&&typeof _0x412a08[_0x07c7('0x24')]===_0x07c7('0x23');var _0x3f0110=_0x47befb['count'];var _0x31f81d=_0x31f1a0?0x0:_0x412a08['offset'];var _0x1dfe53=_0x31f1a0?_0x47befb[_0x07c7('0x25')]:_0x412a08[_0x07c7('0x26')]+_0x412a08[_0x07c7('0x24')];var _0x25bc95;if(_0x1dfe53>=_0x3f0110){_0x1dfe53=_0x3f0110;_0x25bc95=0xc8;}else{_0x25bc95=0xce;}_0x346202[_0x07c7('0x20')](_0x25bc95);return _0x346202[_0x07c7('0x27')]('Content-Range',_0x31f81d+'-'+_0x1dfe53+'/'+_0x3f0110)['json'](_0x47befb);}return null;};}function patchUpdates(_0x3182d5){return function(_0xad2ce7){try{jsonpatch[_0x07c7('0x28')](_0xad2ce7,_0x3182d5,!![]);}catch(_0x1ee9cf){return BPromise['reject'](_0x1ee9cf);}return _0xad2ce7[_0x07c7('0x29')]();};}function saveUpdates(_0x33630f,_0x19d338){return function(_0x15c00f){if(_0x15c00f){return _0x15c00f[_0x07c7('0x2a')](_0x33630f)[_0x07c7('0x2b')](function(_0x452426){return _0x452426;});}return null;};}function removeEntity(_0x1c4b74,_0x12c6d5){return function(_0x5109dc){if(_0x5109dc){return _0x5109dc[_0x07c7('0x2c')]()[_0x07c7('0x2b')](function(){_0x1c4b74['status'](0xcc)[_0x07c7('0x21')]();});}};}function handleEntityNotFound(_0x5be7dc,_0x444b9e){return function(_0x49d06e){if(!_0x49d06e){_0x5be7dc[_0x07c7('0x1f')](0x194);}return _0x49d06e;};}function handleError(_0x274a08,_0x23397d){_0x23397d=_0x23397d||0x1f4;return function(_0x2aba62){logger['error'](_0x2aba62['stack']);if(_0x2aba62['name']){delete _0x2aba62[_0x07c7('0x2d')];}_0x274a08[_0x07c7('0x20')](_0x23397d)[_0x07c7('0x2e')](_0x2aba62);};}exports['index']=function(_0x5378f1,_0x25afc1){var _0x12d9bf={},_0x546041={},_0x1ca8f4={'count':0x0,'rows':[]};var _0x38d749=_['map'](db[_0x07c7('0x2f')][_0x07c7('0x30')],function(_0x391bf6){return{'name':_0x391bf6[_0x07c7('0x31')],'type':_0x391bf6[_0x07c7('0x32')][_0x07c7('0x33')]};});_0x546041['model']=_['map'](_0x38d749,'name');_0x546041['query']=_['keys'](_0x5378f1[_0x07c7('0x34')]);_0x546041[_0x07c7('0x35')]=_['intersection'](_0x546041[_0x07c7('0x36')],_0x546041['query']);_0x12d9bf[_0x07c7('0x37')]=_['intersection'](_0x546041[_0x07c7('0x36')],qs[_0x07c7('0x38')](_0x5378f1[_0x07c7('0x34')][_0x07c7('0x38')]));_0x12d9bf[_0x07c7('0x37')]=_0x12d9bf[_0x07c7('0x37')]['length']?_0x12d9bf[_0x07c7('0x37')]:_0x546041['model'];if(!_0x5378f1[_0x07c7('0x34')][_0x07c7('0x39')]('nolimit')){_0x12d9bf[_0x07c7('0x24')]=qs[_0x07c7('0x24')](_0x5378f1['query']['limit']);_0x12d9bf['offset']=qs[_0x07c7('0x26')](_0x5378f1['query'][_0x07c7('0x26')]);}_0x12d9bf[_0x07c7('0x3a')]=qs[_0x07c7('0x3b')](_0x5378f1[_0x07c7('0x34')][_0x07c7('0x3b')]);_0x12d9bf[_0x07c7('0x3c')]=qs[_0x07c7('0x35')](_['pick'](_0x5378f1[_0x07c7('0x34')],_0x546041['filters']),_0x38d749);if(_0x5378f1[_0x07c7('0x34')]['filter']){_0x12d9bf[_0x07c7('0x3c')]=_[_0x07c7('0x3d')](_0x12d9bf['where'],{'$or':_['map'](_0x38d749,function(_0x31e5ab){if(_0x31e5ab[_0x07c7('0x32')]!==_0x07c7('0x3e')){var _0x124190={};_0x124190[_0x31e5ab[_0x07c7('0x2d')]]={'$like':'%'+_0x5378f1[_0x07c7('0x34')][_0x07c7('0x3f')]+'%'};return _0x124190;}})});}_0x12d9bf=_[_0x07c7('0x3d')]({},_0x12d9bf,_0x5378f1['options']);var _0x44bc37={'where':_0x12d9bf[_0x07c7('0x3c')]};return db[_0x07c7('0x2f')][_0x07c7('0x25')](_0x44bc37)[_0x07c7('0x2b')](function(_0x20b0b7){_0x1ca8f4['count']=_0x20b0b7;if(_0x5378f1[_0x07c7('0x34')][_0x07c7('0x40')]){_0x12d9bf['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0x07c7('0x41')](_0x12d9bf);})[_0x07c7('0x2b')](function(_0x73a14f){_0x1ca8f4[_0x07c7('0x42')]=_0x73a14f;return _0x1ca8f4;})[_0x07c7('0x2b')](respondWithFilteredResult(_0x25afc1,_0x12d9bf))[_0x07c7('0x43')](handleError(_0x25afc1,null));};exports['show']=function(_0x3cd829,_0x314b83){var _0x7a5d8d={'raw':!![],'where':{'id':_0x3cd829[_0x07c7('0x44')]['id']}},_0x4f83a8={};_0x4f83a8[_0x07c7('0x36')]=_['keys'](db['ChatInternalMessage'][_0x07c7('0x30')]);_0x4f83a8[_0x07c7('0x34')]=_[_0x07c7('0x45')](_0x3cd829[_0x07c7('0x34')]);_0x4f83a8[_0x07c7('0x35')]=_[_0x07c7('0x46')](_0x4f83a8[_0x07c7('0x36')],_0x4f83a8['query']);_0x7a5d8d[_0x07c7('0x37')]=_['intersection'](_0x4f83a8[_0x07c7('0x36')],qs[_0x07c7('0x38')](_0x3cd829[_0x07c7('0x34')][_0x07c7('0x38')]));_0x7a5d8d['attributes']=_0x7a5d8d[_0x07c7('0x37')][_0x07c7('0x47')]?_0x7a5d8d['attributes']:_0x4f83a8[_0x07c7('0x36')];if(_0x3cd829[_0x07c7('0x34')][_0x07c7('0x40')]){_0x7a5d8d['include']=[{'all':!![]}];}_0x7a5d8d=_['merge']({},_0x7a5d8d,_0x3cd829[_0x07c7('0x48')]);return db[_0x07c7('0x2f')][_0x07c7('0x49')](_0x7a5d8d)['then'](handleEntityNotFound(_0x314b83,null))[_0x07c7('0x2b')](respondWithResult(_0x314b83,null))[_0x07c7('0x43')](handleError(_0x314b83,null));};exports['create']=function(_0x4f79c8,_0x5d5116){return db[_0x07c7('0x2f')]['create'](_0x4f79c8[_0x07c7('0x4a')],{})[_0x07c7('0x2b')](respondWithResult(_0x5d5116,0xc9))[_0x07c7('0x43')](handleError(_0x5d5116,null));};exports[_0x07c7('0x2a')]=function(_0x3de50a,_0x22e224){if(_0x3de50a[_0x07c7('0x4a')]['id']){delete _0x3de50a[_0x07c7('0x4a')]['id'];}return db[_0x07c7('0x2f')][_0x07c7('0x49')]({'where':{'id':_0x3de50a[_0x07c7('0x44')]['id']}})[_0x07c7('0x2b')](handleEntityNotFound(_0x22e224,null))['then'](saveUpdates(_0x3de50a[_0x07c7('0x4a')],null))[_0x07c7('0x2b')](respondWithResult(_0x22e224,null))[_0x07c7('0x43')](handleError(_0x22e224,null));};exports['destroy']=function(_0x12b916,_0x180235){return db[_0x07c7('0x2f')][_0x07c7('0x49')]({'where':{'id':_0x12b916[_0x07c7('0x44')]['id']}})[_0x07c7('0x2b')](handleEntityNotFound(_0x180235,null))[_0x07c7('0x2b')](removeEntity(_0x180235,null))[_0x07c7('0x43')](handleError(_0x180235,null));};exports[_0x07c7('0x4b')]=function(_0x4b79e6,_0x2b6ffa){return db[_0x07c7('0x2f')][_0x07c7('0x4b')]()[_0x07c7('0x2b')](respondWithResult(_0x2b6ffa,null))[_0x07c7('0x43')](handleError(_0x2b6ffa,null));};function wrapUser(_0x1336ee){return function(_0x3025f5){var _0x2050d0=_0x1336ee['get']({'plain':!![]});_0x2050d0[_0x07c7('0x4c')]=[];if(_0x3025f5){_0x2050d0['lastMessageAt']=_0x3025f5[_0x07c7('0x4d')];_0x2050d0[_0x07c7('0x4e')]=_0x3025f5;}else{_0x2050d0[_0x07c7('0x4f')]=moment(0x0)[_0x07c7('0x50')](_0x07c7('0x51'));_0x2050d0[_0x07c7('0x4e')]={};}return _0x2050d0;};}exports[_0x07c7('0x52')]=function(_0xfbcf8b,_0x543028,_0x4e3349){var _0x4ab75c=[];return db[_0x07c7('0x53')][_0x07c7('0x41')]({'where':{'role':[_0x07c7('0x54'),_0x07c7('0x55'),_0x07c7('0x56')]},'attributes':['id',_0x07c7('0x57'),_0x07c7('0x2d'),_0x07c7('0x58'),_0x07c7('0x59'),_0x07c7('0x5a'),_0x07c7('0x5b'),_0x07c7('0x5c'),_0x07c7('0x5d'),'showWebBar'],'order':qs[_0x07c7('0x3b')](_0x07c7('0x5e')),'include':[{'model':db[_0x07c7('0x5f')],'as':_0x07c7('0x60'),'attributes':['id','name',_0x07c7('0x32')],'through':{'attributes':[]}}]})['then'](function(_0x5e6c4c){if(_0x5e6c4c){var _0x14ecd9=_0xfbcf8b[_0x07c7('0x56')][_0x07c7('0x61')]({'plain':!![]});if(!_0x14ecd9)throw new Error(_0x07c7('0x62'));if(_0x14ecd9[_0x07c7('0x58')]===_0x07c7('0x56')){return db[_0x07c7('0x63')][_0x07c7('0x49')]({'where':{'name':_0x07c7('0x64'),'userProfileId':_0x14ecd9['userProfileId']},'raw':!![]})['then'](function(_0x45ee23){if(_0x45ee23){if(_0x45ee23[_0x07c7('0x65')]===0x0){return db[_0x07c7('0x66')][_0x07c7('0x41')]({'where':{'sectionId':_0x45ee23['id']},'raw':!![]})[_0x07c7('0x2b')](function(_0x336ac3){var _0x2f94e1=[];if(_['isEmpty'](_0x336ac3)){_0x2f94e1=_[_0x07c7('0x3f')](_0x5e6c4c,function(_0x52a1c3){if(_0x52a1c3[_0x07c7('0x58')]!==_0x07c7('0x54')){return _0x52a1c3;}});return _0x2f94e1;}else{for(var _0x4250e0=0x0;_0x4250e0<_0x5e6c4c['length'];_0x4250e0++){var _0x69486d=_0x5e6c4c[_0x4250e0];if(_0x69486d[_0x07c7('0x58')]===_0x07c7('0x54')){var _0x53b208=_[_0x07c7('0x49')](_0x336ac3,function(_0x574e76){return _0x574e76[_0x07c7('0x67')]===_0x69486d['id'];});if(_0x53b208)_0x2f94e1[_0x07c7('0x68')](_0x69486d);}else{_0x2f94e1['push'](_0x69486d);}}return _0x2f94e1;}});}else{return _0x5e6c4c;}}else{var _0x26e5ba=_[_0x07c7('0x3f')](_0x5e6c4c,function(_0x5d784d){if(_0x5d784d[_0x07c7('0x58')]!==_0x07c7('0x54')){return _0x5d784d;}});return _0x26e5ba;}});}else{return _0x5e6c4c;}}})[_0x07c7('0x2b')](function(_0x21336f){var _0xcaabb1=[];if(_0x21336f){_0x4ab75c=_0x21336f;for(var _0x117b2a=0x0;_0x117b2a<_0x21336f[_0x07c7('0x47')];_0x117b2a+=0x1){_0x4ab75c[_0x117b2a]['messages']=[];_0xcaabb1['push'](db[_0x07c7('0x2f')][_0x07c7('0x49')]({'where':{'FromId':[_0xfbcf8b['user']['id'],_0x21336f[_0x117b2a]['id']],'ToId':[_0xfbcf8b[_0x07c7('0x56')]['id'],_0x21336f[_0x117b2a]['id']],'ChatGroupId':null},'attributes':['id',_0x07c7('0x4d'),'FromId',_0x07c7('0x69'),_0x07c7('0x6a'),_0x07c7('0x4a')],'order':qs[_0x07c7('0x3b')](_0x07c7('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x07c7('0x2b')](wrapUser(_0x21336f[_0x117b2a])));}return BPromise['all'](_0xcaabb1);}return[];})['then'](function(_0x28ab98){return{'rows':_0x28ab98,'count':_0x28ab98[_0x07c7('0x47')]};})[_0x07c7('0x2b')](respondWithResult(_0x543028,null))[_0x07c7('0x43')](handleError(_0x543028,null));}; \ No newline at end of file +var _0x4c6d=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','ChatInternalMessage','fieldName','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','describe','get','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','fullname','userpic','internal','online','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','FromId','ToId','read','-createdAt','all','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json'];(function(_0x9befec,_0x6c2980){var _0x4007a2=function(_0x2d7703){while(--_0x2d7703){_0x9befec['push'](_0x9befec['shift']());}};_0x4007a2(++_0x6c2980);}(_0x4c6d,0x13b));var _0xd4c6=function(_0x19fe01,_0x2242d6){_0x19fe01=_0x19fe01-0x0;var _0x16bf47=_0x4c6d[_0x19fe01];return _0x16bf47;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd4c6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4c6('0x1'));var rp=require(_0xd4c6('0x2'));var moment=require(_0xd4c6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd4c6('0x4'));var util=require(_0xd4c6('0x5'));var path=require(_0xd4c6('0x6'));var sox=require(_0xd4c6('0x7'));var csv=require(_0xd4c6('0x8'));var ejs=require(_0xd4c6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4c6('0xa'));var squel=require(_0xd4c6('0xb'));var crypto=require('crypto');var jsforce=require(_0xd4c6('0xc'));var deskjs=require(_0xd4c6('0xd'));var toCsv=require(_0xd4c6('0x8'));var querystring=require(_0xd4c6('0xe'));var Papa=require(_0xd4c6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd4c6('0x10'));var as=require(_0xd4c6('0x11'));var hardwareService=require(_0xd4c6('0x12'));var logger=require('../../config/logger')(_0xd4c6('0x13'));var utils=require(_0xd4c6('0x14'));var config=require(_0xd4c6('0x15'));var licenseUtil=require(_0xd4c6('0x16'));var db=require(_0xd4c6('0x17'))['db'];config['redis']=_[_0xd4c6('0x18')](config[_0xd4c6('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xd4c6('0x1a'))(new Redis(config['redis']));require(_0xd4c6('0x1b'))[_0xd4c6('0x1c')](socket);function respondWithStatusCode(_0x1ce987,_0x201a58){_0x201a58=_0x201a58||0xcc;return function(_0x575415){if(_0x575415){return _0x1ce987[_0xd4c6('0x1d')](_0x201a58);}return _0x1ce987[_0xd4c6('0x1e')](_0x201a58)[_0xd4c6('0x1f')]();};}function respondWithResult(_0x42426c,_0x4cfa2a){_0x4cfa2a=_0x4cfa2a||0xc8;return function(_0x389f29){if(_0x389f29){return _0x42426c[_0xd4c6('0x1e')](_0x4cfa2a)[_0xd4c6('0x20')](_0x389f29);}};}function respondWithFilteredResult(_0x4b8c0e,_0x526d04){return function(_0x2ebf29){if(_0x2ebf29){var _0x1ec728=typeof _0x526d04[_0xd4c6('0x21')]===_0xd4c6('0x22')&&typeof _0x526d04[_0xd4c6('0x23')]===_0xd4c6('0x22');var _0x3d11d9=_0x2ebf29['count'];var _0xf8db8a=_0x1ec728?0x0:_0x526d04[_0xd4c6('0x21')];var _0x2eea38=_0x1ec728?_0x2ebf29[_0xd4c6('0x24')]:_0x526d04[_0xd4c6('0x21')]+_0x526d04[_0xd4c6('0x23')];var _0x53b241;if(_0x2eea38>=_0x3d11d9){_0x2eea38=_0x3d11d9;_0x53b241=0xc8;}else{_0x53b241=0xce;}_0x4b8c0e[_0xd4c6('0x1e')](_0x53b241);return _0x4b8c0e[_0xd4c6('0x25')](_0xd4c6('0x26'),_0xf8db8a+'-'+_0x2eea38+'/'+_0x3d11d9)[_0xd4c6('0x20')](_0x2ebf29);}return null;};}function patchUpdates(_0x329c96){return function(_0x266b7f){try{jsonpatch[_0xd4c6('0x27')](_0x266b7f,_0x329c96,!![]);}catch(_0x4dc3af){return BPromise[_0xd4c6('0x28')](_0x4dc3af);}return _0x266b7f[_0xd4c6('0x29')]();};}function saveUpdates(_0x57883c,_0x1712b8){return function(_0x21a5c7){if(_0x21a5c7){return _0x21a5c7[_0xd4c6('0x2a')](_0x57883c)['then'](function(_0x367ee3){return _0x367ee3;});}return null;};}function removeEntity(_0x26e737,_0x53a23c){return function(_0x1028e4){if(_0x1028e4){return _0x1028e4[_0xd4c6('0x2b')]()[_0xd4c6('0x2c')](function(){_0x26e737[_0xd4c6('0x1e')](0xcc)[_0xd4c6('0x1f')]();});}};}function handleEntityNotFound(_0xbd8423,_0x2d112d){return function(_0x5a53b0){if(!_0x5a53b0){_0xbd8423[_0xd4c6('0x1d')](0x194);}return _0x5a53b0;};}function handleError(_0x455e5d,_0x564040){_0x564040=_0x564040||0x1f4;return function(_0x300c9b){logger[_0xd4c6('0x2d')](_0x300c9b[_0xd4c6('0x2e')]);if(_0x300c9b['name']){delete _0x300c9b['name'];}_0x455e5d[_0xd4c6('0x1e')](_0x564040)['send'](_0x300c9b);};}exports['index']=function(_0x22cc63,_0x5e5ccd){var _0x1eb745={},_0xb8870b={},_0x94ccb4={'count':0x0,'rows':[]};var _0x38265e=_['map'](db[_0xd4c6('0x2f')]['rawAttributes'],function(_0x1932ef){return{'name':_0x1932ef[_0xd4c6('0x30')],'type':_0x1932ef['type']['key']};});_0xb8870b[_0xd4c6('0x31')]=_[_0xd4c6('0x32')](_0x38265e,_0xd4c6('0x33'));_0xb8870b['query']=_['keys'](_0x22cc63[_0xd4c6('0x34')]);_0xb8870b[_0xd4c6('0x35')]=_[_0xd4c6('0x36')](_0xb8870b[_0xd4c6('0x31')],_0xb8870b[_0xd4c6('0x34')]);_0x1eb745[_0xd4c6('0x37')]=_[_0xd4c6('0x36')](_0xb8870b[_0xd4c6('0x31')],qs[_0xd4c6('0x38')](_0x22cc63[_0xd4c6('0x34')]['fields']));_0x1eb745[_0xd4c6('0x37')]=_0x1eb745[_0xd4c6('0x37')][_0xd4c6('0x39')]?_0x1eb745[_0xd4c6('0x37')]:_0xb8870b[_0xd4c6('0x31')];if(!_0x22cc63['query'][_0xd4c6('0x3a')](_0xd4c6('0x3b'))){_0x1eb745['limit']=qs[_0xd4c6('0x23')](_0x22cc63['query'][_0xd4c6('0x23')]);_0x1eb745['offset']=qs[_0xd4c6('0x21')](_0x22cc63[_0xd4c6('0x34')]['offset']);}_0x1eb745[_0xd4c6('0x3c')]=qs[_0xd4c6('0x3d')](_0x22cc63[_0xd4c6('0x34')]['sort']);_0x1eb745[_0xd4c6('0x3e')]=qs['filters'](_[_0xd4c6('0x3f')](_0x22cc63[_0xd4c6('0x34')],_0xb8870b[_0xd4c6('0x35')]),_0x38265e);if(_0x22cc63[_0xd4c6('0x34')]['filter']){_0x1eb745['where']=_[_0xd4c6('0x40')](_0x1eb745[_0xd4c6('0x3e')],{'$or':_['map'](_0x38265e,function(_0x51fbd3){if(_0x51fbd3[_0xd4c6('0x41')]!==_0xd4c6('0x42')){var _0x50843a={};_0x50843a[_0x51fbd3[_0xd4c6('0x33')]]={'$like':'%'+_0x22cc63[_0xd4c6('0x34')][_0xd4c6('0x43')]+'%'};return _0x50843a;}})});}_0x1eb745=_[_0xd4c6('0x40')]({},_0x1eb745,_0x22cc63['options']);var _0x248eb8={'where':_0x1eb745[_0xd4c6('0x3e')]};return db['ChatInternalMessage'][_0xd4c6('0x24')](_0x248eb8)[_0xd4c6('0x2c')](function(_0x3f711f){_0x94ccb4[_0xd4c6('0x24')]=_0x3f711f;if(_0x22cc63[_0xd4c6('0x34')][_0xd4c6('0x44')]){_0x1eb745[_0xd4c6('0x45')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xd4c6('0x46')](_0x1eb745);})[_0xd4c6('0x2c')](function(_0x4ff848){_0x94ccb4[_0xd4c6('0x47')]=_0x4ff848;return _0x94ccb4;})[_0xd4c6('0x2c')](respondWithFilteredResult(_0x5e5ccd,_0x1eb745))['catch'](handleError(_0x5e5ccd,null));};exports[_0xd4c6('0x48')]=function(_0x2f19e3,_0x16f7b5){var _0x377392={'raw':!![],'where':{'id':_0x2f19e3[_0xd4c6('0x49')]['id']}},_0x153218={};_0x153218[_0xd4c6('0x31')]=_['keys'](db[_0xd4c6('0x2f')]['rawAttributes']);_0x153218[_0xd4c6('0x34')]=_['keys'](_0x2f19e3[_0xd4c6('0x34')]);_0x153218[_0xd4c6('0x35')]=_[_0xd4c6('0x36')](_0x153218[_0xd4c6('0x31')],_0x153218[_0xd4c6('0x34')]);_0x377392[_0xd4c6('0x37')]=_[_0xd4c6('0x36')](_0x153218[_0xd4c6('0x31')],qs['fields'](_0x2f19e3[_0xd4c6('0x34')][_0xd4c6('0x38')]));_0x377392[_0xd4c6('0x37')]=_0x377392[_0xd4c6('0x37')][_0xd4c6('0x39')]?_0x377392['attributes']:_0x153218[_0xd4c6('0x31')];if(_0x2f19e3[_0xd4c6('0x34')][_0xd4c6('0x44')]){_0x377392[_0xd4c6('0x45')]=[{'all':!![]}];}_0x377392=_[_0xd4c6('0x40')]({},_0x377392,_0x2f19e3[_0xd4c6('0x4a')]);return db[_0xd4c6('0x2f')][_0xd4c6('0x4b')](_0x377392)[_0xd4c6('0x2c')](handleEntityNotFound(_0x16f7b5,null))[_0xd4c6('0x2c')](respondWithResult(_0x16f7b5,null))[_0xd4c6('0x4c')](handleError(_0x16f7b5,null));};exports[_0xd4c6('0x4d')]=function(_0x59084c,_0x2a9343){return db[_0xd4c6('0x2f')][_0xd4c6('0x4d')](_0x59084c[_0xd4c6('0x4e')],{})[_0xd4c6('0x2c')](respondWithResult(_0x2a9343,0xc9))[_0xd4c6('0x4c')](handleError(_0x2a9343,null));};exports[_0xd4c6('0x2a')]=function(_0x4fc2ab,_0x37cd16){if(_0x4fc2ab[_0xd4c6('0x4e')]['id']){delete _0x4fc2ab[_0xd4c6('0x4e')]['id'];}return db[_0xd4c6('0x2f')][_0xd4c6('0x4b')]({'where':{'id':_0x4fc2ab[_0xd4c6('0x49')]['id']}})[_0xd4c6('0x2c')](handleEntityNotFound(_0x37cd16,null))[_0xd4c6('0x2c')](saveUpdates(_0x4fc2ab['body'],null))['then'](respondWithResult(_0x37cd16,null))[_0xd4c6('0x4c')](handleError(_0x37cd16,null));};exports[_0xd4c6('0x2b')]=function(_0x159c0b,_0x437f92){return db[_0xd4c6('0x2f')][_0xd4c6('0x4b')]({'where':{'id':_0x159c0b[_0xd4c6('0x49')]['id']}})['then'](handleEntityNotFound(_0x437f92,null))[_0xd4c6('0x2c')](removeEntity(_0x437f92,null))[_0xd4c6('0x4c')](handleError(_0x437f92,null));};exports[_0xd4c6('0x4f')]=function(_0x1a0df6,_0x42ddf5){return db[_0xd4c6('0x2f')][_0xd4c6('0x4f')]()[_0xd4c6('0x2c')](respondWithResult(_0x42ddf5,null))[_0xd4c6('0x4c')](handleError(_0x42ddf5,null));};function wrapUser(_0x1175a3){return function(_0x5734e4){var _0x399f4e=_0x1175a3[_0xd4c6('0x50')]({'plain':!![]});_0x399f4e['messages']=[];if(_0x5734e4){_0x399f4e[_0xd4c6('0x51')]=_0x5734e4[_0xd4c6('0x52')];_0x399f4e['lastMessage']=_0x5734e4;}else{_0x399f4e[_0xd4c6('0x51')]=moment(0x0)[_0xd4c6('0x53')](_0xd4c6('0x54'));_0x399f4e[_0xd4c6('0x55')]={};}return _0x399f4e;};}exports[_0xd4c6('0x56')]=function(_0x4a2ed3,_0xa1dafa,_0x15fb43){var _0xd500e1=[];return db[_0xd4c6('0x57')]['findAll']({'where':{'role':[_0xd4c6('0x58'),_0xd4c6('0x59'),_0xd4c6('0x5a')]},'attributes':['id',_0xd4c6('0x5b'),_0xd4c6('0x33'),'role',_0xd4c6('0x5c'),_0xd4c6('0x5d'),_0xd4c6('0x5e'),_0xd4c6('0x5f'),'allowmessenger',_0xd4c6('0x60')],'order':qs[_0xd4c6('0x3d')](_0xd4c6('0x61')),'include':[{'model':db[_0xd4c6('0x62')],'as':_0xd4c6('0x63'),'attributes':['id',_0xd4c6('0x33'),_0xd4c6('0x41')],'through':{'attributes':[]}}]})[_0xd4c6('0x2c')](function(_0x5e0b7e){if(_0x5e0b7e){var _0xd83478=_0x4a2ed3[_0xd4c6('0x5a')][_0xd4c6('0x50')]({'plain':!![]});if(!_0xd83478)throw new Error(_0xd4c6('0x64'));if(_0xd83478[_0xd4c6('0x65')]===_0xd4c6('0x5a')){return db[_0xd4c6('0x66')]['find']({'where':{'name':_0xd4c6('0x67'),'userProfileId':_0xd83478[_0xd4c6('0x68')]},'raw':!![]})[_0xd4c6('0x2c')](function(_0x504613){if(_0x504613){if(_0x504613[_0xd4c6('0x69')]===0x0){return db[_0xd4c6('0x6a')][_0xd4c6('0x46')]({'where':{'sectionId':_0x504613['id']},'raw':!![]})[_0xd4c6('0x2c')](function(_0x21a303){var _0x415143=[];if(_[_0xd4c6('0x6b')](_0x21a303)){_0x415143=_[_0xd4c6('0x43')](_0x5e0b7e,function(_0x5bae6e){if(_0x5bae6e[_0xd4c6('0x65')]!==_0xd4c6('0x58')){return _0x5bae6e;}});return _0x415143;}else{for(var _0x21b04a=0x0;_0x21b04a<_0x5e0b7e[_0xd4c6('0x39')];_0x21b04a++){var _0xc06fe9=_0x5e0b7e[_0x21b04a];if(_0xc06fe9['role']===_0xd4c6('0x58')){var _0x2a8968=_[_0xd4c6('0x4b')](_0x21a303,function(_0x1bf8fd){return _0x1bf8fd[_0xd4c6('0x6c')]===_0xc06fe9['id'];});if(_0x2a8968)_0x415143[_0xd4c6('0x6d')](_0xc06fe9);}else{_0x415143[_0xd4c6('0x6d')](_0xc06fe9);}}return _0x415143;}});}else{return _0x5e0b7e;}}else{var _0x150ba5=_[_0xd4c6('0x43')](_0x5e0b7e,function(_0x3216f4){if(_0x3216f4[_0xd4c6('0x65')]!==_0xd4c6('0x58')){return _0x3216f4;}});return _0x150ba5;}});}else{return _0x5e0b7e;}}})[_0xd4c6('0x2c')](function(_0x494f62){var _0x4f17af=[];if(_0x494f62){_0xd500e1=_0x494f62;for(var _0x220c09=0x0;_0x220c09<_0x494f62[_0xd4c6('0x39')];_0x220c09+=0x1){_0xd500e1[_0x220c09][_0xd4c6('0x6e')]=[];_0x4f17af[_0xd4c6('0x6d')](db[_0xd4c6('0x2f')][_0xd4c6('0x4b')]({'where':{'FromId':[_0x4a2ed3['user']['id'],_0x494f62[_0x220c09]['id']],'ToId':[_0x4a2ed3['user']['id'],_0x494f62[_0x220c09]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xd4c6('0x6f'),_0xd4c6('0x70'),_0xd4c6('0x71'),_0xd4c6('0x4e')],'order':qs[_0xd4c6('0x3d')](_0xd4c6('0x72')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd4c6('0x2c')](wrapUser(_0x494f62[_0x220c09])));}return BPromise[_0xd4c6('0x73')](_0x4f17af);}return[];})[_0xd4c6('0x2c')](function(_0x74608d){return{'rows':_0x74608d,'count':_0x74608d[_0xd4c6('0x39')]};})[_0xd4c6('0x2c')](respondWithResult(_0xa1dafa,null))[_0xd4c6('0x4c')](handleError(_0xa1dafa,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index c068524..439278a 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 _0xa322=['update','remove','emit','hasOwnProperty','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x22743d,_0x1cee11){var _0x3d51f0=function(_0x2a3d63){while(--_0x2a3d63){_0x22743d['push'](_0x22743d['shift']());}};_0x3d51f0(++_0x1cee11);}(_0xa322,0x15c));var _0x2a32=function(_0x3060f8,_0x42c110){_0x3060f8=_0x3060f8-0x0;var _0x36119d=_0xa322[_0x3060f8];return _0x36119d;};'use strict';var EventEmitter=require(_0x2a32('0x0'));var ChatInternalMessage=require(_0x2a32('0x1'))['db'][_0x2a32('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x2a32('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2a32('0x4'),'afterDestroy':_0x2a32('0x5')};function emitEvent(_0x390543){return function(_0x57b654,_0x5c8b1c,_0x57ee8c){ChatInternalMessageEvents[_0x2a32('0x6')](_0x390543+':'+_0x57b654['id'],_0x57b654);ChatInternalMessageEvents[_0x2a32('0x6')](_0x390543,_0x57b654);_0x57ee8c(null);};}for(var e in events){if(events[_0x2a32('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x3117=['ChatInternalMessage','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x5e1cb3,_0xb8804b){var _0x4aa975=function(_0x29d432){while(--_0x29d432){_0x5e1cb3['push'](_0x5e1cb3['shift']());}};_0x4aa975(++_0xb8804b);}(_0x3117,0x1af));var _0x7311=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0x3117[_0x31172e];return _0x414ada;};'use strict';var EventEmitter=require(_0x7311('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x7311('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7311('0x2'),'afterUpdate':_0x7311('0x3'),'afterDestroy':_0x7311('0x4')};function emitEvent(_0x5ddfba){return function(_0x935bf8,_0x35dd60,_0x5edaed){ChatInternalMessageEvents[_0x7311('0x5')](_0x5ddfba+':'+_0x935bf8['id'],_0x935bf8);ChatInternalMessageEvents['emit'](_0x5ddfba,_0x935bf8);_0x5edaed(null);};}for(var e in events){if(events[_0x7311('0x6')](e)){var event=events[e];ChatInternalMessage[_0x7311('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index cc9aefc..d4cd7e9 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 _0x514a=['../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','api','request-promise','path','rimraf'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x514a,0x10a));var _0xa514=function(_0x247b77,_0x3b55b5){_0x247b77=_0x247b77-0x0;var _0x5713dc=_0x514a[_0x247b77];return _0x5713dc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa514('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa514('0x1'));var fs=require('fs');var path=require(_0xa514('0x2'));var rimraf=require(_0xa514('0x3'));var config=require(_0xa514('0x4'));var attributes=require(_0xa514('0x5'));module[_0xa514('0x6')]=function(_0x27f676,_0x4535cd){return _0x27f676['define'](_0xa514('0x7'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa514('0x8'),'collate':_0xa514('0x9')});}; \ No newline at end of file +var _0x1055=['api','request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x364b6b,_0x4a9f78){var _0x52760d=function(_0x5ac8c5){while(--_0x5ac8c5){_0x364b6b['push'](_0x364b6b['shift']());}};_0x52760d(++_0x4a9f78);}(_0x1055,0xda));var _0x5105=function(_0x1a4a0b,_0x5e8e4f){_0x1a4a0b=_0x1a4a0b-0x0;var _0x15d52a=_0x1055[_0x1a4a0b];return _0x15d52a;};'use strict';var _=require('lodash');var util=require(_0x5105('0x0'));var logger=require(_0x5105('0x1'))(_0x5105('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5105('0x3'));var fs=require('fs');var path=require(_0x5105('0x4'));var rimraf=require('rimraf');var config=require(_0x5105('0x5'));var attributes=require(_0x5105('0x6'));module[_0x5105('0x7')]=function(_0x304f51,_0x2b94a8){return _0x304f51[_0x5105('0x8')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5105('0x9'),'collate':_0x5105('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index b599a95..23cfdd3 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 _0x81b1=['stringify','error','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xb0865d,_0x60eb75){var _0x2c0945=function(_0x4e6d49){while(--_0x4e6d49){_0xb0865d['push'](_0xb0865d['shift']());}};_0x2c0945(++_0x60eb75);}(_0x81b1,0x12e));var _0x181b=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x81b1[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require(_0x181b('0x0'));var util=require(_0x181b('0x1'));var moment=require(_0x181b('0x2'));var BPromise=require(_0x181b('0x3'));var rs=require(_0x181b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x181b('0x5'))['db'];var utils=require(_0x181b('0x6'));var logger=require(_0x181b('0x7'))(_0x181b('0x8'));var config=require(_0x181b('0x9'));var jayson=require(_0x181b('0xa'));var client=jayson[_0x181b('0xb')][_0x181b('0xc')]({'port':0x232a});config[_0x181b('0xd')]=_[_0x181b('0xe')](config[_0x181b('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x181b('0xd')]));require(_0x181b('0xf'))[_0x181b('0x10')](socket);function respondWithRpcPromise(_0x50f6d1,_0x3ecab5,_0x3abd97){return new BPromise(function(_0xbcdeef,_0x345837){return client[_0x181b('0x11')](_0x50f6d1,_0x3abd97)[_0x181b('0x12')](function(_0x1b8972){logger['info'](_0x181b('0x13'),_0x3ecab5,'request\x20sent');logger['debug'](_0x181b('0x14'),_0x3ecab5,_0x181b('0x15'),JSON[_0x181b('0x16')](_0x1b8972));if(_0x1b8972[_0x181b('0x17')]){if(_0x1b8972[_0x181b('0x17')]['code']===0x1f4){logger[_0x181b('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x3ecab5,_0x1b8972[_0x181b('0x17')][_0x181b('0x18')]);return _0x345837(_0x1b8972[_0x181b('0x17')][_0x181b('0x18')]);}logger[_0x181b('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x3ecab5,_0x1b8972['error'][_0x181b('0x18')]);return _0xbcdeef(_0x1b8972[_0x181b('0x17')][_0x181b('0x18')]);}else{logger[_0x181b('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x3ecab5,'request\x20sent');_0xbcdeef(_0x1b8972['result'][_0x181b('0x18')]);}})[_0x181b('0x1a')](function(_0x1deb5a){logger['error'](_0x181b('0x13'),_0x3ecab5,_0x1deb5a);_0x345837(_0x1deb5a);});});} \ No newline at end of file +var _0xf6d1=['ChatInternalMessage,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x33c55c,_0x4ab195){var _0x61efca=function(_0x5b4072){while(--_0x5b4072){_0x33c55c['push'](_0x33c55c['shift']());}};_0x61efca(++_0x4ab195);}(_0xf6d1,0x99));var _0x1f6d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xf6d1[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x1f6d('0x0'));var util=require(_0x1f6d('0x1'));var moment=require(_0x1f6d('0x2'));var BPromise=require(_0x1f6d('0x3'));var rs=require(_0x1f6d('0x4'));var fs=require('fs');var Redis=require(_0x1f6d('0x5'));var db=require(_0x1f6d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f6d('0x7'))('rpc');var config=require(_0x1f6d('0x8'));var jayson=require(_0x1f6d('0x9'));var client=jayson[_0x1f6d('0xa')][_0x1f6d('0xb')]({'port':0x232a});config[_0x1f6d('0xc')]=_[_0x1f6d('0xd')](config[_0x1f6d('0xc')],{'host':_0x1f6d('0xe'),'port':0x18eb});var socket=require(_0x1f6d('0xf'))(new Redis(config[_0x1f6d('0xc')]));require(_0x1f6d('0x10'))[_0x1f6d('0x11')](socket);function respondWithRpcPromise(_0x523958,_0x25ec55,_0x4f33bd){return new BPromise(function(_0x456882,_0x4aaba1){return client[_0x1f6d('0x12')](_0x523958,_0x4f33bd)[_0x1f6d('0x13')](function(_0x3d813c){logger[_0x1f6d('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x25ec55,'request\x20sent');logger[_0x1f6d('0x15')](_0x1f6d('0x16'),_0x25ec55,_0x1f6d('0x17'),JSON[_0x1f6d('0x18')](_0x3d813c));if(_0x3d813c[_0x1f6d('0x19')]){if(_0x3d813c[_0x1f6d('0x19')][_0x1f6d('0x1a')]===0x1f4){logger[_0x1f6d('0x19')](_0x1f6d('0x1b'),_0x25ec55,_0x3d813c[_0x1f6d('0x19')]['message']);return _0x4aaba1(_0x3d813c[_0x1f6d('0x19')][_0x1f6d('0x1c')]);}logger[_0x1f6d('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x25ec55,_0x3d813c[_0x1f6d('0x19')][_0x1f6d('0x1c')]);return _0x456882(_0x3d813c['error'][_0x1f6d('0x1c')]);}else{logger[_0x1f6d('0x14')](_0x1f6d('0x1b'),_0x25ec55,_0x1f6d('0x17'));_0x456882(_0x3d813c[_0x1f6d('0x1d')][_0x1f6d('0x1c')]);}})['catch'](function(_0x24c5b8){logger[_0x1f6d('0x19')](_0x1f6d('0x1b'),_0x25ec55,_0x24c5b8);_0x4aaba1(_0x24c5b8);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 52a896c..03270f9 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 _0xf3cf=['removeListener','register','length','./chatInternalMessage.events','save','emit'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xf3cf,0x171));var _0xff3c=function(_0x3a78a0,_0x44985f){_0x3a78a0=_0x3a78a0-0x0;var _0x48e917=_0xf3cf[_0x3a78a0];return _0x48e917;};'use strict';var ChatInternalMessageEvents=require(_0xff3c('0x0'));var events=[_0xff3c('0x1'),'remove','update'];function createListener(_0x3425cd,_0xa069a7){return function(_0x1d2d15){_0xa069a7[_0xff3c('0x2')](_0x3425cd,_0x1d2d15);};}function removeListener(_0x1bd519,_0x57feab){return function(){ChatInternalMessageEvents[_0xff3c('0x3')](_0x1bd519,_0x57feab);};}exports[_0xff3c('0x4')]=function(_0x5db86e){for(var _0x1fc3c6=0x0,_0x2e94b9=events[_0xff3c('0x5')];_0x1fc3c6<_0x2e94b9;_0x1fc3c6++){var _0x551fb0=events[_0x1fc3c6];var _0x5e4292=createListener('chatInternalMessage:'+_0x551fb0,_0x5db86e);ChatInternalMessageEvents['on'](_0x551fb0,_0x5e4292);}}; \ No newline at end of file +var _0x98e0=['save','update','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x38e17e,_0x1f5199){var _0x4bffbd=function(_0x18637e){while(--_0x18637e){_0x38e17e['push'](_0x38e17e['shift']());}};_0x4bffbd(++_0x1f5199);}(_0x98e0,0x18f));var _0x098e=function(_0x5c427d,_0x86a80d){_0x5c427d=_0x5c427d-0x0;var _0x4c9c0f=_0x98e0[_0x5c427d];return _0x4c9c0f;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x098e('0x0'),'remove',_0x098e('0x1')];function createListener(_0xe4415b,_0x23c482){return function(_0x5c57c7){_0x23c482[_0x098e('0x2')](_0xe4415b,_0x5c57c7);};}function removeListener(_0x149242,_0x2654ec){return function(){ChatInternalMessageEvents[_0x098e('0x3')](_0x149242,_0x2654ec);};}exports[_0x098e('0x4')]=function(_0x26fa91){for(var _0x42f0dc=0x0,_0x3c92dc=events[_0x098e('0x5')];_0x42f0dc<_0x3c92dc;_0x42f0dc++){var _0x23798a=events[_0x42f0dc];var _0x377ba8=createListener(_0x098e('0x6')+_0x23798a,_0x26fa91);ChatInternalMessageEvents['on'](_0x23798a,_0x377ba8);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index d535a72..c46360a 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 _0xacf0=['/:id','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','show','create','put'];(function(_0x2a6d04,_0x14d5c5){var _0x402e97=function(_0x17524f){while(--_0x17524f){_0x2a6d04['push'](_0x2a6d04['shift']());}};_0x402e97(++_0x14d5c5);}(_0xacf0,0x1d0));var _0x0acf=function(_0x95f0b7,_0x4f5699){_0x95f0b7=_0x95f0b7-0x0;var _0x110033=_0xacf0[_0x95f0b7];return _0x110033;};'use strict';var multer=require(_0x0acf('0x0'));var util=require('util');var path=require(_0x0acf('0x1'));var timeout=require(_0x0acf('0x2'));var express=require(_0x0acf('0x3'));var router=express['Router']();var fs_extra=require(_0x0acf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0acf('0x5'));var config=require('../../config/environment');var controller=require(_0x0acf('0x6'));router[_0x0acf('0x7')]('/',auth[_0x0acf('0x8')](),controller[_0x0acf('0x9')]);router[_0x0acf('0x7')](_0x0acf('0xa'),auth[_0x0acf('0x8')](),controller[_0x0acf('0xb')]);router['get'](_0x0acf('0xc'),auth[_0x0acf('0x8')](),controller['getUsers']);router[_0x0acf('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0acf('0xd')]);router['post']('/',auth[_0x0acf('0x8')](),controller[_0x0acf('0xe')]);router[_0x0acf('0xf')](_0x0acf('0x10'),controller[_0x0acf('0x11')]);router[_0x0acf('0x12')](_0x0acf('0x10'),auth[_0x0acf('0x8')](),controller['destroy']);module[_0x0acf('0x13')]=router; \ No newline at end of file +var _0x29c0=['fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','describe','/users','/:id','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x49c4de,_0xac4172){var _0xdcc4d3=function(_0x1193bc){while(--_0x1193bc){_0x49c4de['push'](_0x49c4de['shift']());}};_0xdcc4d3(++_0xac4172);}(_0x29c0,0x68));var _0x029c=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x29c0[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require(_0x029c('0x0'));var util=require(_0x029c('0x1'));var path=require(_0x029c('0x2'));var timeout=require(_0x029c('0x3'));var express=require(_0x029c('0x4'));var router=express[_0x029c('0x5')]();var fs_extra=require(_0x029c('0x6'));var auth=require(_0x029c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x029c('0x8'));var controller=require(_0x029c('0x9'));router['get']('/',auth[_0x029c('0xa')](),controller[_0x029c('0xb')]);router[_0x029c('0xc')](_0x029c('0xd'),auth[_0x029c('0xa')](),controller[_0x029c('0xe')]);router[_0x029c('0xc')](_0x029c('0xf'),auth[_0x029c('0xa')](),controller['getUsers']);router[_0x029c('0xc')](_0x029c('0x10'),auth[_0x029c('0xa')](),controller['show']);router[_0x029c('0x11')]('/',auth['isAuthenticated'](),controller[_0x029c('0x12')]);router[_0x029c('0x13')](_0x029c('0x10'),controller[_0x029c('0x14')]);router['delete'](_0x029c('0x10'),auth['isAuthenticated'](),controller[_0x029c('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 7d3fff2..3e1a5b9 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 _0x23a3=['out','DATE','STRING','TEXT','medium','BOOLEAN','ENUM'];(function(_0x246a4c,_0x5c64e4){var _0x210079=function(_0x4299cc){while(--_0x4299cc){_0x246a4c['push'](_0x246a4c['shift']());}};_0x210079(++_0x5c64e4);}(_0x23a3,0x131));var _0x323a=function(_0x54d52,_0x2473ba){_0x54d52=_0x54d52-0x0;var _0x968345=_0x23a3[_0x54d52];return _0x968345;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x323a('0x0')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x323a('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x323a('0x2')]('in',_0x323a('0x3')),'defaultValue':_0x323a('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x323a('0x4')]},'providerName':{'type':Sequelize[_0x323a('0x5')]},'providerResponse':{'type':Sequelize[_0x323a('0x6')]}}; \ No newline at end of file +var _0x5454=['out','DATE','STRING','medium'];(function(_0x59db19,_0x30c1c6){var _0x5f0f09=function(_0x36e225){while(--_0x36e225){_0x59db19['push'](_0x59db19['shift']());}};_0x5f0f09(++_0x30c1c6);}(_0x5454,0x15b));var _0x4545=function(_0x1341e4,_0x43f065){_0x1341e4=_0x1341e4-0x0;var _0x17cf1b=_0x5454[_0x1341e4];return _0x17cf1b;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x4545('0x0')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4545('0x1')),'defaultValue':_0x4545('0x1'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4545('0x2')]},'providerName':{'type':Sequelize[_0x4545('0x3')]},'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 74f45b6..fa45eea 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 _0x8ec4=['api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','name','send','index','map','ChatMessage','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','rawAttributes','includeAll','include','find','create','body','update','chat','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','internal','reject','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'];(function(_0x27ce63,_0x5a6a81){var _0x1ebcad=function(_0x44bd74){while(--_0x44bd74){_0x27ce63['push'](_0x27ce63['shift']());}};_0x1ebcad(++_0x5a6a81);}(_0x8ec4,0x187));var _0x48ec=function(_0x25c1e1,_0x5f2be5){_0x25c1e1=_0x25c1e1-0x0;var _0x217801=_0x8ec4[_0x25c1e1];return _0x217801;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48ec('0x0'));var zipdir=require(_0x48ec('0x1'));var jsonpatch=require(_0x48ec('0x2'));var rp=require(_0x48ec('0x3'));var moment=require(_0x48ec('0x4'));var BPromise=require(_0x48ec('0x5'));var Mustache=require(_0x48ec('0x6'));var util=require(_0x48ec('0x7'));var path=require(_0x48ec('0x8'));var sox=require(_0x48ec('0x9'));var csv=require('to-csv');var ejs=require(_0x48ec('0xa'));var fs=require('fs');var fs_extra=require(_0x48ec('0xb'));var _=require(_0x48ec('0xc'));var squel=require(_0x48ec('0xd'));var crypto=require(_0x48ec('0xe'));var jsforce=require(_0x48ec('0xf'));var deskjs=require(_0x48ec('0x10'));var toCsv=require(_0x48ec('0x11'));var querystring=require(_0x48ec('0x12'));var Papa=require(_0x48ec('0x13'));var Redis=require(_0x48ec('0x14'));var authService=require(_0x48ec('0x15'));var qs=require(_0x48ec('0x16'));var as=require(_0x48ec('0x17'));var hardwareService=require(_0x48ec('0x18'));var logger=require(_0x48ec('0x19'))(_0x48ec('0x1a'));var utils=require('../../config/utils');var config=require(_0x48ec('0x1b'));var licenseUtil=require(_0x48ec('0x1c'));var db=require('../../mysqldb')['db'];config[_0x48ec('0x1d')]=_[_0x48ec('0x1e')](config[_0x48ec('0x1d')],{'host':_0x48ec('0x1f'),'port':0x18eb});var socket=require(_0x48ec('0x20'))(new Redis(config['redis']));require('./chatMessage.socket')[_0x48ec('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x48ec('0x22')][_0x48ec('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x48ec('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x4f3e36,_0x2b5aeb,_0x2b5c45,_0x16bbdd){return new BPromise(function(_0x4c7a45,_0x59478f){var _0x6eae48=_0x16bbdd||client;return _0x6eae48['request'](_0x4f3e36,_0x2b5c45)[_0x48ec('0x24')](function(_0x38f355){logger[_0x48ec('0x25')](_0x48ec('0x26'),_0x2b5aeb,_0x48ec('0x27'));logger[_0x48ec('0x28')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2b5aeb,_0x48ec('0x27'),JSON['stringify'](_0x38f355));if(_0x38f355[_0x48ec('0x29')]){if(_0x38f355[_0x48ec('0x29')][_0x48ec('0x2a')]===0x1f4){logger[_0x48ec('0x29')]('ChatMessage,\x20%s,\x20%s',_0x2b5aeb,_0x38f355[_0x48ec('0x29')]['message']);return _0x59478f(_0x38f355['error']['message']);}logger[_0x48ec('0x29')](_0x48ec('0x26'),_0x2b5aeb,_0x38f355[_0x48ec('0x29')]['message']);return _0x4c7a45(_0x38f355[_0x48ec('0x29')][_0x48ec('0x2b')]);}else{logger['info'](_0x48ec('0x26'),_0x2b5aeb,_0x48ec('0x27'));_0x4c7a45(_0x38f355[_0x48ec('0x2c')][_0x48ec('0x2b')]);}})[_0x48ec('0x2d')](function(_0x23208b){logger[_0x48ec('0x29')]('ChatMessage,\x20%s,\x20%s',_0x2b5aeb,_0x23208b);_0x59478f(_0x23208b);});});}function respondWithStatusCode(_0x111b73,_0x5b521a){_0x5b521a=_0x5b521a||0xcc;return function(_0x4d2274){if(_0x4d2274){return _0x111b73[_0x48ec('0x2e')](_0x5b521a);}return _0x111b73[_0x48ec('0x2f')](_0x5b521a)[_0x48ec('0x30')]();};}function respondWithResult(_0x2e5be2,_0x1ca0ce){_0x1ca0ce=_0x1ca0ce||0xc8;return function(_0x58150a){if(_0x58150a){return _0x2e5be2[_0x48ec('0x2f')](_0x1ca0ce)[_0x48ec('0x31')](_0x58150a);}};}function respondWithFilteredResult(_0x27042d,_0xaf499e){return function(_0x10ff8f){if(_0x10ff8f){var _0x16027c=typeof _0xaf499e[_0x48ec('0x32')]===_0x48ec('0x33')&&typeof _0xaf499e[_0x48ec('0x34')]===_0x48ec('0x33');var _0xf706c6=_0x10ff8f[_0x48ec('0x35')];var _0x3c666=_0x16027c?0x0:_0xaf499e[_0x48ec('0x32')];var _0x269a95=_0x16027c?_0x10ff8f[_0x48ec('0x35')]:_0xaf499e[_0x48ec('0x32')]+_0xaf499e[_0x48ec('0x34')];var _0x3209a7;if(_0x269a95>=_0xf706c6){_0x269a95=_0xf706c6;_0x3209a7=0xc8;}else{_0x3209a7=0xce;}_0x27042d[_0x48ec('0x2f')](_0x3209a7);return _0x27042d[_0x48ec('0x36')](_0x48ec('0x37'),_0x3c666+'-'+_0x269a95+'/'+_0xf706c6)[_0x48ec('0x31')](_0x10ff8f);}return null;};}function patchUpdates(_0x3a6d71){return function(_0x1b3360){try{jsonpatch[_0x48ec('0x38')](_0x1b3360,_0x3a6d71,!![]);}catch(_0x29674a){return BPromise['reject'](_0x29674a);}return _0x1b3360[_0x48ec('0x39')]();};}function saveUpdates(_0x4877a,_0x365ba5){return function(_0x7af2eb){if(_0x7af2eb){return _0x7af2eb['update'](_0x4877a)[_0x48ec('0x24')](function(_0x464be4){return _0x464be4;});}return null;};}function removeEntity(_0x56048a,_0x24bf82){return function(_0x2bf546){if(_0x2bf546){return _0x2bf546[_0x48ec('0x3a')]()[_0x48ec('0x24')](function(){_0x56048a[_0x48ec('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x402ac5,_0x20a235){return function(_0x5b3409){if(!_0x5b3409){_0x402ac5['sendStatus'](0x194);}return _0x5b3409;};}function handleError(_0x568888,_0x50f1e8){_0x50f1e8=_0x50f1e8||0x1f4;return function(_0x300d06){logger[_0x48ec('0x29')](_0x300d06['stack']);if(_0x300d06[_0x48ec('0x3b')]){delete _0x300d06[_0x48ec('0x3b')];}_0x568888[_0x48ec('0x2f')](_0x50f1e8)[_0x48ec('0x3c')](_0x300d06);};}exports[_0x48ec('0x3d')]=function(_0x4a1539,_0x2c571a){var _0x6e8f30={},_0x9b7242={},_0x3eb19c={'count':0x0,'rows':[]};var _0x38183a=_[_0x48ec('0x3e')](db[_0x48ec('0x3f')]['rawAttributes'],function(_0x2f2c72){return{'name':_0x2f2c72[_0x48ec('0x40')],'type':_0x2f2c72[_0x48ec('0x41')][_0x48ec('0x42')]};});_0x9b7242['model']=_[_0x48ec('0x3e')](_0x38183a,'name');_0x9b7242['query']=_[_0x48ec('0x43')](_0x4a1539[_0x48ec('0x44')]);_0x9b7242[_0x48ec('0x45')]=_['intersection'](_0x9b7242[_0x48ec('0x46')],_0x9b7242[_0x48ec('0x44')]);_0x6e8f30[_0x48ec('0x47')]=_[_0x48ec('0x48')](_0x9b7242['model'],qs[_0x48ec('0x49')](_0x4a1539['query'][_0x48ec('0x49')]));_0x6e8f30[_0x48ec('0x47')]=_0x6e8f30[_0x48ec('0x47')][_0x48ec('0x4a')]?_0x6e8f30[_0x48ec('0x47')]:_0x9b7242[_0x48ec('0x46')];if(!_0x4a1539[_0x48ec('0x44')][_0x48ec('0x4b')](_0x48ec('0x4c'))){_0x6e8f30[_0x48ec('0x34')]=qs[_0x48ec('0x34')](_0x4a1539['query'][_0x48ec('0x34')]);_0x6e8f30[_0x48ec('0x32')]=qs[_0x48ec('0x32')](_0x4a1539[_0x48ec('0x44')][_0x48ec('0x32')]);}_0x6e8f30[_0x48ec('0x4d')]=qs[_0x48ec('0x4e')](_0x4a1539[_0x48ec('0x44')]['sort']);_0x6e8f30[_0x48ec('0x4f')]=qs['filters'](_[_0x48ec('0x50')](_0x4a1539[_0x48ec('0x44')],_0x9b7242[_0x48ec('0x45')]),_0x38183a);if(_0x4a1539[_0x48ec('0x44')][_0x48ec('0x51')]){_0x6e8f30[_0x48ec('0x4f')]=_[_0x48ec('0x52')](_0x6e8f30[_0x48ec('0x4f')],{'$or':_['map'](_0x38183a,function(_0x30cea5){if(_0x30cea5['type']!==_0x48ec('0x53')){var _0x4c7416={};_0x4c7416[_0x30cea5[_0x48ec('0x3b')]]={'$like':'%'+_0x4a1539[_0x48ec('0x44')][_0x48ec('0x51')]+'%'};return _0x4c7416;}})});}_0x6e8f30=_[_0x48ec('0x52')]({},_0x6e8f30,_0x4a1539[_0x48ec('0x54')]);var _0x5c6975={'where':_0x6e8f30['where']};return db[_0x48ec('0x3f')][_0x48ec('0x35')](_0x5c6975)[_0x48ec('0x24')](function(_0x58898e){_0x3eb19c['count']=_0x58898e;if(_0x4a1539[_0x48ec('0x44')]['includeAll']){_0x6e8f30['include']=[{'all':!![]}];}return db['ChatMessage'][_0x48ec('0x55')](_0x6e8f30);})[_0x48ec('0x24')](function(_0x16f19f){_0x3eb19c[_0x48ec('0x56')]=_0x16f19f;return _0x3eb19c;})[_0x48ec('0x24')](respondWithFilteredResult(_0x2c571a,_0x6e8f30))[_0x48ec('0x2d')](handleError(_0x2c571a,null));};exports[_0x48ec('0x57')]=function(_0x1dc8c8,_0x4c2738){var _0x31e9e5={'raw':!![],'where':{'id':_0x1dc8c8[_0x48ec('0x58')]['id']}},_0x254b36={};_0x254b36[_0x48ec('0x46')]=_[_0x48ec('0x43')](db[_0x48ec('0x3f')][_0x48ec('0x59')]);_0x254b36['query']=_[_0x48ec('0x43')](_0x1dc8c8[_0x48ec('0x44')]);_0x254b36[_0x48ec('0x45')]=_[_0x48ec('0x48')](_0x254b36[_0x48ec('0x46')],_0x254b36[_0x48ec('0x44')]);_0x31e9e5['attributes']=_[_0x48ec('0x48')](_0x254b36[_0x48ec('0x46')],qs['fields'](_0x1dc8c8[_0x48ec('0x44')][_0x48ec('0x49')]));_0x31e9e5['attributes']=_0x31e9e5['attributes'][_0x48ec('0x4a')]?_0x31e9e5['attributes']:_0x254b36[_0x48ec('0x46')];if(_0x1dc8c8[_0x48ec('0x44')][_0x48ec('0x5a')]){_0x31e9e5[_0x48ec('0x5b')]=[{'all':!![]}];}_0x31e9e5=_[_0x48ec('0x52')]({},_0x31e9e5,_0x1dc8c8['options']);return db[_0x48ec('0x3f')][_0x48ec('0x5c')](_0x31e9e5)[_0x48ec('0x24')](handleEntityNotFound(_0x4c2738,null))[_0x48ec('0x24')](respondWithResult(_0x4c2738,null))[_0x48ec('0x2d')](handleError(_0x4c2738,null));};exports[_0x48ec('0x5d')]=function(_0x2c6422,_0x4c3f55){return db[_0x48ec('0x3f')][_0x48ec('0x5d')](_0x2c6422[_0x48ec('0x5e')],{})[_0x48ec('0x24')](respondWithResult(_0x4c3f55,0xc9))[_0x48ec('0x2d')](handleError(_0x4c3f55,null));};exports[_0x48ec('0x5f')]=function(_0x10b8ff,_0x3a167b){if(_0x10b8ff['body']['id']){delete _0x10b8ff[_0x48ec('0x5e')]['id'];}return db['ChatMessage'][_0x48ec('0x5c')]({'where':{'id':_0x10b8ff[_0x48ec('0x58')]['id']}})[_0x48ec('0x24')](handleEntityNotFound(_0x3a167b,null))['then'](saveUpdates(_0x10b8ff[_0x48ec('0x5e')],null))[_0x48ec('0x24')](respondWithResult(_0x3a167b,null))[_0x48ec('0x2d')](handleError(_0x3a167b,null));};exports[_0x48ec('0x3a')]=function(_0x515b67,_0x392fa4){return db[_0x48ec('0x3f')][_0x48ec('0x5c')]({'where':{'id':_0x515b67[_0x48ec('0x58')]['id']}})[_0x48ec('0x24')](handleEntityNotFound(_0x392fa4,null))[_0x48ec('0x24')](removeEntity(_0x392fa4,null))[_0x48ec('0x2d')](handleError(_0x392fa4,null));};exports['describe']=function(_0x113e20,_0x9656a){return db[_0x48ec('0x3f')]['describe']()[_0x48ec('0x24')](respondWithResult(_0x9656a,null))[_0x48ec('0x2d')](handleError(_0x9656a,null));};var interaction_log=require(_0x48ec('0x19'))('chat-interactions');exports['accept']=function(_0x431913,_0x5799ab,_0x6fa3d){var _0x1c79a4={'agent':{},'channel':_0x48ec('0x60')};if(_0x431913[_0x48ec('0x5e')]['id']){delete _0x431913['body']['id'];}_0x431913[_0x48ec('0x5e')]['read']=!![];_0x431913['body'][_0x48ec('0x61')]=moment()['format'](_0x48ec('0x62'));_0x431913[_0x48ec('0x5e')][_0x48ec('0x63')]=_0x431913[_0x48ec('0x5e')]['UserId']||_0x431913[_0x48ec('0x64')]['id'];_0x1c79a4[_0x48ec('0x65')]['id']=_0x431913[_0x48ec('0x5e')][_0x48ec('0x63')];return db['ChatMessage'][_0x48ec('0x5c')]({'where':{'id':_0x431913['params']['id'],'UserId':null}})[_0x48ec('0x24')](handleEntityNotFound(_0x5799ab,null))[_0x48ec('0x24')](saveUpdates(_0x431913[_0x48ec('0x5e')],null))[_0x48ec('0x24')](function(_0x105cb5){if(_0x105cb5){_0x1c79a4[_0x48ec('0x2b')]=_0x105cb5[_0x48ec('0x66')]({'plain':!![]});return db[_0x48ec('0x67')][_0x48ec('0x5c')]({'where':{'id':_0x105cb5[_0x48ec('0x68')]}});}return null;})[_0x48ec('0x24')](handleEntityNotFound(_0x5799ab,null))['then'](function(_0x8962c6){if(_0x8962c6){return _0x8962c6[_0x48ec('0x5f')]({'UserId':_0x431913[_0x48ec('0x5e')][_0x48ec('0x63')],'read1stAt':_['isNil'](_0x8962c6[_0x48ec('0x69')])?moment()[_0x48ec('0x6a')](_0x48ec('0x62')):undefined});}return null;})[_0x48ec('0x24')](function(_0x349d0b){if(_0x349d0b){_0x1c79a4[_0x48ec('0x6b')]=_0x349d0b[_0x48ec('0x66')]({'plain':!![]});interaction_log[_0x48ec('0x25')](_0x48ec('0x6c'),_0x431913[_0x48ec('0x64')]['id'],_0x431913[_0x48ec('0x64')][_0x48ec('0x3b')],_0x431913[_0x48ec('0x64')]['role'],_0x1c79a4[_0x48ec('0x6b')]['id'],_0x431913['body']?JSON[_0x48ec('0x6d')](_0x431913[_0x48ec('0x5e')]):_0x48ec('0x6e'));return respondWithRpcPromise(_0x48ec('0x6f'),_0x48ec('0x70'),_0x1c79a4);}return null;})[_0x48ec('0x24')](function(_0x29b8a2){var _0x4f9eca='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x29b8a2['message'][_0x48ec('0x71')];return db[_0x48ec('0x72')][_0x48ec('0x44')](_0x4f9eca,{'type':db[_0x48ec('0x73')][_0x48ec('0x74')][_0x48ec('0x75')],'raw':!![]})[_0x48ec('0x24')](function(_0x2a7675){return _0x2a7675;});})['then'](function(_0xcf508){if(_0xcf508){_0x1c79a4[_0x48ec('0x2b')][_0x48ec('0x76')]=_0xcf508[0x0];if(!_0x431913[_0x48ec('0x5e')][_0x48ec('0x63')])return;return db[_0x48ec('0x77')][_0x48ec('0x5c')]({'where':{'id':_0x431913[_0x48ec('0x5e')][_0x48ec('0x63')],'role':_0x48ec('0x65')},'attributes':['id','name',_0x48ec('0x78'),'email','internal'],'raw':!![]});}return null;})[_0x48ec('0x24')](function(_0x14f602){if(!_0x14f602)return null;_0x1c79a4['message'][_0x48ec('0x65')]=_0x14f602;return _0x1c79a4;})[_0x48ec('0x24')](function(_0x14b834){if(_0x14b834){if(_0x431913[_0x48ec('0x5e')][_0x48ec('0x79')]){_0x1c79a4[_0x48ec('0x2b')][_0x48ec('0x7a')]=util[_0x48ec('0x6a')](_0x48ec('0x7b'),_0x431913[_0x48ec('0x64')][_0x48ec('0x3b')]);_0x1c79a4[_0x48ec('0x2b')][_0x48ec('0x7c')]=_0x1c79a4['channel'];_0x1c79a4[_0x48ec('0x2b')][_0x48ec('0x7d')]=_0x1c79a4[_0x48ec('0x7c')];_0x1c79a4['message'][_0x48ec('0x7e')]=_0x48ec('0x7f');return respondWithRpcPromise(_0x48ec('0x80'),_0x48ec('0x80'),{'event':_0x48ec('0x81'),'message':_[_0x48ec('0x52')](_0x1c79a4[_0x48ec('0x2b')],JSON[_0x48ec('0x82')](_0x1c79a4['interaction'][_0x48ec('0x83')]))},client9002)[_0x48ec('0x24')](function(){return _0x1c79a4;});}return _0x1c79a4;}return null;})['then'](respondWithResult(_0x5799ab,null))[_0x48ec('0x2d')](handleError(_0x5799ab,null));};var interaction_log=require(_0x48ec('0x19'))(_0x48ec('0x84'));exports['reject']=function(_0xd0091d,_0x533380,_0xb09c35){var _0x552aab={'agent':{},'channel':_0x48ec('0x60')};if(_0xd0091d[_0x48ec('0x5e')]['id']){delete _0xd0091d[_0x48ec('0x5e')]['id'];}_0xd0091d[_0x48ec('0x5e')][_0x48ec('0x63')]=_0xd0091d['body'][_0x48ec('0x63')]||_0xd0091d[_0x48ec('0x64')]['id'];_0x552aab[_0x48ec('0x65')]['id']=_0xd0091d['body'][_0x48ec('0x63')];return db[_0x48ec('0x3f')][_0x48ec('0x5c')]({'where':{'id':_0xd0091d['params']['id'],'UserId':null}})[_0x48ec('0x24')](handleEntityNotFound(_0x533380,null))[_0x48ec('0x24')](function(_0x18a6d1){if(_0x18a6d1){_0x552aab[_0x48ec('0x2b')]=_0x18a6d1['get']({'plain':!![]});return db[_0x48ec('0x67')][_0x48ec('0x5c')]({'where':{'id':_0x18a6d1[_0x48ec('0x68')]}});}return null;})[_0x48ec('0x24')](handleEntityNotFound(_0x533380,null))[_0x48ec('0x24')](function(_0x12fddc){if(_0x12fddc){_0x552aab[_0x48ec('0x6b')]=_0x12fddc['get']({'plain':!![]});interaction_log[_0x48ec('0x25')](_0x48ec('0x85'),_0xd0091d[_0x48ec('0x64')]['id'],_0xd0091d[_0x48ec('0x64')][_0x48ec('0x3b')],_0xd0091d[_0x48ec('0x64')][_0x48ec('0x86')],_0x552aab[_0x48ec('0x6b')]['id'],_0xd0091d[_0x48ec('0x5e')]?JSON[_0x48ec('0x6d')](_0xd0091d[_0x48ec('0x5e')]):_0x48ec('0x6e'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x552aab);}return null;})['then'](function(_0x796c4e){var _0x366c60=_0x48ec('0x87')+_0x796c4e[_0x48ec('0x2b')][_0x48ec('0x71')];return db['sequelize'][_0x48ec('0x44')](_0x366c60,{'type':db[_0x48ec('0x73')]['QueryTypes'][_0x48ec('0x75')],'raw':!![]})[_0x48ec('0x24')](function(_0x3859b9){return _0x3859b9;});})[_0x48ec('0x24')](function(_0x4e01aa){if(_0x4e01aa){_0x552aab[_0x48ec('0x2b')][_0x48ec('0x76')]=_0x4e01aa[0x0];if(!_0xd0091d[_0x48ec('0x5e')][_0x48ec('0x63')])return;return db[_0x48ec('0x77')][_0x48ec('0x5c')]({'where':{'id':_0xd0091d['body'][_0x48ec('0x63')],'role':_0x48ec('0x65')},'attributes':['id','name',_0x48ec('0x78'),_0x48ec('0x88'),_0x48ec('0x89')],'raw':!![]});}return null;})[_0x48ec('0x24')](function(_0xc364c9){if(!_0xc364c9)return null;_0x552aab[_0x48ec('0x2b')][_0x48ec('0x65')]=_0xc364c9;return _0x552aab;})['then'](function(_0x43b600){if(_0x43b600){_0x43b600[_0x48ec('0x2b')][_0x48ec('0x7a')]=util[_0x48ec('0x6a')]('SIP/%s',_0xd0091d['user'][_0x48ec('0x3b')]);_0x43b600[_0x48ec('0x2b')][_0x48ec('0x7c')]=_0x552aab[_0x48ec('0x7c')];_0x43b600[_0x48ec('0x2b')][_0x48ec('0x7d')]=_0x552aab[_0x48ec('0x7c')];_0x43b600[_0x48ec('0x2b')][_0x48ec('0x7e')]=_0x48ec('0x8a');respondWithRpcPromise(_0x48ec('0x80'),'EventManager',{'event':'rejectmessage','message':_[_0x48ec('0x52')](_0x552aab[_0x48ec('0x2b')],JSON[_0x48ec('0x82')](_0x552aab[_0x48ec('0x6b')][_0x48ec('0x83')]))},client9002);return _0x552aab;}return null;})[_0x48ec('0x24')](respondWithResult(_0x533380,null))['catch'](handleError(_0x533380,null));}; \ No newline at end of file +var _0x416e=['fullname','email','internal','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','parse','formData','chat-interactions','reject','agent','ChatInteraction','RejectMessage','rejectMessage','ContactId','event','rejectmessage','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/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatMessage.socket','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','type','keys','filters','intersection','attributes','model','fields','query','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','params','ChatMessage','includeAll','find','create','body','describe','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','UserId','get','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x416e,0x98));var _0xe416=function(_0x123b1f,_0x4adc11){_0x123b1f=_0x123b1f-0x0;var _0x35abee=_0x416e[_0x123b1f];return _0x35abee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe416('0x0'));var jsonpatch=require(_0xe416('0x1'));var rp=require(_0xe416('0x2'));var moment=require(_0xe416('0x3'));var BPromise=require(_0xe416('0x4'));var Mustache=require(_0xe416('0x5'));var util=require(_0xe416('0x6'));var path=require('path');var sox=require(_0xe416('0x7'));var csv=require('to-csv');var ejs=require(_0xe416('0x8'));var fs=require('fs');var fs_extra=require(_0xe416('0x9'));var _=require(_0xe416('0xa'));var squel=require(_0xe416('0xb'));var crypto=require('crypto');var jsforce=require(_0xe416('0xc'));var deskjs=require(_0xe416('0xd'));var toCsv=require(_0xe416('0xe'));var querystring=require(_0xe416('0xf'));var Papa=require(_0xe416('0x10'));var Redis=require(_0xe416('0x11'));var authService=require(_0xe416('0x12'));var qs=require(_0xe416('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe416('0x14'));var logger=require(_0xe416('0x15'))(_0xe416('0x16'));var utils=require(_0xe416('0x17'));var config=require(_0xe416('0x18'));var licenseUtil=require(_0xe416('0x19'));var db=require('../../mysqldb')['db'];config[_0xe416('0x1a')]=_[_0xe416('0x1b')](config[_0xe416('0x1a')],{'host':_0xe416('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe416('0x1a')]));require(_0xe416('0x1d'))['register'](socket);var jayson=require(_0xe416('0x1e'));var client=jayson[_0xe416('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0xe416('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1fe9e5,_0xbedc93,_0xd7e574,_0x5b6ee9){return new BPromise(function(_0x100434,_0x5d1cb4){var _0x3b173a=_0x5b6ee9||client;return _0x3b173a[_0xe416('0x21')](_0x1fe9e5,_0xd7e574)[_0xe416('0x22')](function(_0x596434){logger['info'](_0xe416('0x23'),_0xbedc93,'request\x20sent');logger[_0xe416('0x24')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0xbedc93,'request\x20sent',JSON['stringify'](_0x596434));if(_0x596434[_0xe416('0x25')]){if(_0x596434[_0xe416('0x25')][_0xe416('0x26')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0xbedc93,_0x596434['error'][_0xe416('0x27')]);return _0x5d1cb4(_0x596434[_0xe416('0x25')][_0xe416('0x27')]);}logger[_0xe416('0x25')](_0xe416('0x23'),_0xbedc93,_0x596434[_0xe416('0x25')][_0xe416('0x27')]);return _0x100434(_0x596434[_0xe416('0x25')][_0xe416('0x27')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0xbedc93,_0xe416('0x28'));_0x100434(_0x596434['result'][_0xe416('0x27')]);}})[_0xe416('0x29')](function(_0x346350){logger['error'](_0xe416('0x23'),_0xbedc93,_0x346350);_0x5d1cb4(_0x346350);});});}function respondWithStatusCode(_0x550a0c,_0x5e2876){_0x5e2876=_0x5e2876||0xcc;return function(_0x8f4ecb){if(_0x8f4ecb){return _0x550a0c['sendStatus'](_0x5e2876);}return _0x550a0c[_0xe416('0x2a')](_0x5e2876)['end']();};}function respondWithResult(_0x277577,_0x440471){_0x440471=_0x440471||0xc8;return function(_0x24cc03){if(_0x24cc03){return _0x277577[_0xe416('0x2a')](_0x440471)[_0xe416('0x2b')](_0x24cc03);}};}function respondWithFilteredResult(_0x5c128d,_0x5e4452){return function(_0x3387c5){if(_0x3387c5){var _0x28dea8=typeof _0x5e4452['offset']===_0xe416('0x2c')&&typeof _0x5e4452['limit']===_0xe416('0x2c');var _0x1901bf=_0x3387c5[_0xe416('0x2d')];var _0x1a8706=_0x28dea8?0x0:_0x5e4452['offset'];var _0x464a2f=_0x28dea8?_0x3387c5[_0xe416('0x2d')]:_0x5e4452[_0xe416('0x2e')]+_0x5e4452[_0xe416('0x2f')];var _0xa2415d;if(_0x464a2f>=_0x1901bf){_0x464a2f=_0x1901bf;_0xa2415d=0xc8;}else{_0xa2415d=0xce;}_0x5c128d[_0xe416('0x2a')](_0xa2415d);return _0x5c128d[_0xe416('0x30')](_0xe416('0x31'),_0x1a8706+'-'+_0x464a2f+'/'+_0x1901bf)[_0xe416('0x2b')](_0x3387c5);}return null;};}function patchUpdates(_0x597c7a){return function(_0x2e01b7){try{jsonpatch[_0xe416('0x32')](_0x2e01b7,_0x597c7a,!![]);}catch(_0x4de1fa){return BPromise['reject'](_0x4de1fa);}return _0x2e01b7['save']();};}function saveUpdates(_0x14ae71,_0x35a5e2){return function(_0x1d1760){if(_0x1d1760){return _0x1d1760[_0xe416('0x33')](_0x14ae71)['then'](function(_0x26fdfd){return _0x26fdfd;});}return null;};}function removeEntity(_0x3512a2,_0x235ca7){return function(_0x1c712f){if(_0x1c712f){return _0x1c712f[_0xe416('0x34')]()[_0xe416('0x22')](function(){_0x3512a2[_0xe416('0x2a')](0xcc)[_0xe416('0x35')]();});}};}function handleEntityNotFound(_0x389dd1,_0x162ff1){return function(_0x1eaf47){if(!_0x1eaf47){_0x389dd1[_0xe416('0x36')](0x194);}return _0x1eaf47;};}function handleError(_0x3749e1,_0x20080e){_0x20080e=_0x20080e||0x1f4;return function(_0x840621){logger[_0xe416('0x25')](_0x840621[_0xe416('0x37')]);if(_0x840621[_0xe416('0x38')]){delete _0x840621['name'];}_0x3749e1[_0xe416('0x2a')](_0x20080e)[_0xe416('0x39')](_0x840621);};}exports[_0xe416('0x3a')]=function(_0x4e7e4e,_0x35c893){var _0x484a37={},_0x32b197={},_0x41447d={'count':0x0,'rows':[]};var _0x1255c3=_[_0xe416('0x3b')](db['ChatMessage'][_0xe416('0x3c')],function(_0x255ef6){return{'name':_0x255ef6['fieldName'],'type':_0x255ef6[_0xe416('0x3d')]['key']};});_0x32b197['model']=_[_0xe416('0x3b')](_0x1255c3,'name');_0x32b197['query']=_[_0xe416('0x3e')](_0x4e7e4e['query']);_0x32b197[_0xe416('0x3f')]=_[_0xe416('0x40')](_0x32b197['model'],_0x32b197['query']);_0x484a37[_0xe416('0x41')]=_[_0xe416('0x40')](_0x32b197[_0xe416('0x42')],qs[_0xe416('0x43')](_0x4e7e4e[_0xe416('0x44')][_0xe416('0x43')]));_0x484a37[_0xe416('0x41')]=_0x484a37[_0xe416('0x41')]['length']?_0x484a37[_0xe416('0x41')]:_0x32b197[_0xe416('0x42')];if(!_0x4e7e4e['query'][_0xe416('0x45')]('nolimit')){_0x484a37[_0xe416('0x2f')]=qs['limit'](_0x4e7e4e['query'][_0xe416('0x2f')]);_0x484a37[_0xe416('0x2e')]=qs[_0xe416('0x2e')](_0x4e7e4e[_0xe416('0x44')][_0xe416('0x2e')]);}_0x484a37[_0xe416('0x46')]=qs[_0xe416('0x47')](_0x4e7e4e[_0xe416('0x44')]['sort']);_0x484a37['where']=qs[_0xe416('0x3f')](_[_0xe416('0x48')](_0x4e7e4e[_0xe416('0x44')],_0x32b197['filters']),_0x1255c3);if(_0x4e7e4e[_0xe416('0x44')]['filter']){_0x484a37[_0xe416('0x49')]=_[_0xe416('0x4a')](_0x484a37['where'],{'$or':_[_0xe416('0x3b')](_0x1255c3,function(_0x2622c7){if(_0x2622c7[_0xe416('0x3d')]!==_0xe416('0x4b')){var _0x289558={};_0x289558[_0x2622c7['name']]={'$like':'%'+_0x4e7e4e['query'][_0xe416('0x4c')]+'%'};return _0x289558;}})});}_0x484a37=_[_0xe416('0x4a')]({},_0x484a37,_0x4e7e4e[_0xe416('0x4d')]);var _0x5dc94a={'where':_0x484a37[_0xe416('0x49')]};return db['ChatMessage'][_0xe416('0x2d')](_0x5dc94a)[_0xe416('0x22')](function(_0xebd744){_0x41447d['count']=_0xebd744;if(_0x4e7e4e[_0xe416('0x44')]['includeAll']){_0x484a37[_0xe416('0x4e')]=[{'all':!![]}];}return db['ChatMessage'][_0xe416('0x4f')](_0x484a37);})[_0xe416('0x22')](function(_0x1a8250){_0x41447d['rows']=_0x1a8250;return _0x41447d;})[_0xe416('0x22')](respondWithFilteredResult(_0x35c893,_0x484a37))[_0xe416('0x29')](handleError(_0x35c893,null));};exports['show']=function(_0x4f3b7d,_0x50352f){var _0x17b4df={'raw':!![],'where':{'id':_0x4f3b7d[_0xe416('0x50')]['id']}},_0x430f59={};_0x430f59['model']=_[_0xe416('0x3e')](db[_0xe416('0x51')][_0xe416('0x3c')]);_0x430f59[_0xe416('0x44')]=_['keys'](_0x4f3b7d[_0xe416('0x44')]);_0x430f59[_0xe416('0x3f')]=_[_0xe416('0x40')](_0x430f59[_0xe416('0x42')],_0x430f59[_0xe416('0x44')]);_0x17b4df[_0xe416('0x41')]=_[_0xe416('0x40')](_0x430f59[_0xe416('0x42')],qs[_0xe416('0x43')](_0x4f3b7d['query'][_0xe416('0x43')]));_0x17b4df[_0xe416('0x41')]=_0x17b4df[_0xe416('0x41')]['length']?_0x17b4df['attributes']:_0x430f59[_0xe416('0x42')];if(_0x4f3b7d[_0xe416('0x44')][_0xe416('0x52')]){_0x17b4df[_0xe416('0x4e')]=[{'all':!![]}];}_0x17b4df=_[_0xe416('0x4a')]({},_0x17b4df,_0x4f3b7d[_0xe416('0x4d')]);return db[_0xe416('0x51')][_0xe416('0x53')](_0x17b4df)[_0xe416('0x22')](handleEntityNotFound(_0x50352f,null))[_0xe416('0x22')](respondWithResult(_0x50352f,null))['catch'](handleError(_0x50352f,null));};exports[_0xe416('0x54')]=function(_0x2bc36a,_0x1c9978){return db[_0xe416('0x51')][_0xe416('0x54')](_0x2bc36a[_0xe416('0x55')],{})['then'](respondWithResult(_0x1c9978,0xc9))['catch'](handleError(_0x1c9978,null));};exports[_0xe416('0x33')]=function(_0x5d5e28,_0x2a7d2d){if(_0x5d5e28[_0xe416('0x55')]['id']){delete _0x5d5e28[_0xe416('0x55')]['id'];}return db[_0xe416('0x51')][_0xe416('0x53')]({'where':{'id':_0x5d5e28['params']['id']}})[_0xe416('0x22')](handleEntityNotFound(_0x2a7d2d,null))[_0xe416('0x22')](saveUpdates(_0x5d5e28[_0xe416('0x55')],null))[_0xe416('0x22')](respondWithResult(_0x2a7d2d,null))[_0xe416('0x29')](handleError(_0x2a7d2d,null));};exports[_0xe416('0x34')]=function(_0x2502cb,_0x4c2423){return db[_0xe416('0x51')][_0xe416('0x53')]({'where':{'id':_0x2502cb[_0xe416('0x50')]['id']}})[_0xe416('0x22')](handleEntityNotFound(_0x4c2423,null))[_0xe416('0x22')](removeEntity(_0x4c2423,null))['catch'](handleError(_0x4c2423,null));};exports['describe']=function(_0x514e56,_0x39cb38){return db['ChatMessage'][_0xe416('0x56')]()[_0xe416('0x22')](respondWithResult(_0x39cb38,null))[_0xe416('0x29')](handleError(_0x39cb38,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports['accept']=function(_0x42fea1,_0x2f8969,_0x43a92f){var _0x252c0f={'agent':{},'channel':_0xe416('0x57')};if(_0x42fea1[_0xe416('0x55')]['id']){delete _0x42fea1[_0xe416('0x55')]['id'];}_0x42fea1['body'][_0xe416('0x58')]=!![];_0x42fea1[_0xe416('0x55')][_0xe416('0x59')]=moment()[_0xe416('0x5a')](_0xe416('0x5b'));_0x42fea1[_0xe416('0x55')]['UserId']=_0x42fea1[_0xe416('0x55')]['UserId']||_0x42fea1[_0xe416('0x5c')]['id'];_0x252c0f['agent']['id']=_0x42fea1['body'][_0xe416('0x5d')];return db[_0xe416('0x51')][_0xe416('0x53')]({'where':{'id':_0x42fea1[_0xe416('0x50')]['id'],'UserId':null}})[_0xe416('0x22')](handleEntityNotFound(_0x2f8969,null))[_0xe416('0x22')](saveUpdates(_0x42fea1['body'],null))[_0xe416('0x22')](function(_0x20a6f9){if(_0x20a6f9){_0x252c0f[_0xe416('0x27')]=_0x20a6f9[_0xe416('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0xe416('0x53')]({'where':{'id':_0x20a6f9[_0xe416('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x2f8969,null))[_0xe416('0x22')](function(_0x225a74){if(_0x225a74){return _0x225a74[_0xe416('0x33')]({'UserId':_0x42fea1[_0xe416('0x55')][_0xe416('0x5d')],'read1stAt':_['isNil'](_0x225a74[_0xe416('0x60')])?moment()[_0xe416('0x5a')](_0xe416('0x5b')):undefined});}return null;})[_0xe416('0x22')](function(_0x44c995){if(_0x44c995){_0x252c0f[_0xe416('0x61')]=_0x44c995[_0xe416('0x5e')]({'plain':!![]});interaction_log['info'](_0xe416('0x62'),_0x42fea1[_0xe416('0x5c')]['id'],_0x42fea1[_0xe416('0x5c')][_0xe416('0x38')],_0x42fea1['user'][_0xe416('0x63')],_0x252c0f['interaction']['id'],_0x42fea1[_0xe416('0x55')]?JSON[_0xe416('0x64')](_0x42fea1['body']):_0xe416('0x65'));return respondWithRpcPromise(_0xe416('0x66'),_0xe416('0x67'),_0x252c0f);}return null;})['then'](function(_0x4b599f){var _0x3280d6=_0xe416('0x68')+_0x4b599f['message']['ContactId'];return db[_0xe416('0x69')][_0xe416('0x44')](_0x3280d6,{'type':db[_0xe416('0x6a')]['QueryTypes'][_0xe416('0x6b')],'raw':!![]})[_0xe416('0x22')](function(_0x335fbe){return _0x335fbe;});})[_0xe416('0x22')](function(_0xf75465){if(_0xf75465){_0x252c0f[_0xe416('0x27')][_0xe416('0x6c')]=_0xf75465[0x0];if(!_0x42fea1[_0xe416('0x55')]['UserId'])return;return db[_0xe416('0x6d')][_0xe416('0x53')]({'where':{'id':_0x42fea1[_0xe416('0x55')]['UserId'],'role':'agent'},'attributes':['id',_0xe416('0x38'),_0xe416('0x6e'),_0xe416('0x6f'),_0xe416('0x70')],'raw':!![]});}return null;})['then'](function(_0x49a5d9){if(!_0x49a5d9)return null;_0x252c0f[_0xe416('0x27')]['agent']=_0x49a5d9;return _0x252c0f;})['then'](function(_0x2132d0){if(_0x2132d0){if(_0x42fea1[_0xe416('0x55')]['manual']){_0x252c0f['message'][_0xe416('0x71')]=util[_0xe416('0x5a')](_0xe416('0x72'),_0x42fea1[_0xe416('0x5c')]['name']);_0x252c0f[_0xe416('0x27')][_0xe416('0x73')]=_0x252c0f[_0xe416('0x73')];_0x252c0f[_0xe416('0x27')][_0xe416('0x74')]=_0x252c0f[_0xe416('0x73')];_0x252c0f[_0xe416('0x27')]['event']=_0xe416('0x75');return respondWithRpcPromise(_0xe416('0x76'),_0xe416('0x76'),{'event':_0xe416('0x77'),'message':_['merge'](_0x252c0f[_0xe416('0x27')],JSON[_0xe416('0x78')](_0x252c0f[_0xe416('0x61')][_0xe416('0x79')]))},client9002)[_0xe416('0x22')](function(){return _0x252c0f;});}return _0x252c0f;}return null;})[_0xe416('0x22')](respondWithResult(_0x2f8969,null))[_0xe416('0x29')](handleError(_0x2f8969,null));};var interaction_log=require(_0xe416('0x15'))(_0xe416('0x7a'));exports[_0xe416('0x7b')]=function(_0xd985f2,_0x2b32ac,_0x2166e1){var _0x31f982={'agent':{},'channel':_0xe416('0x57')};if(_0xd985f2[_0xe416('0x55')]['id']){delete _0xd985f2['body']['id'];}_0xd985f2[_0xe416('0x55')][_0xe416('0x5d')]=_0xd985f2[_0xe416('0x55')][_0xe416('0x5d')]||_0xd985f2['user']['id'];_0x31f982[_0xe416('0x7c')]['id']=_0xd985f2[_0xe416('0x55')]['UserId'];return db[_0xe416('0x51')][_0xe416('0x53')]({'where':{'id':_0xd985f2[_0xe416('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b32ac,null))[_0xe416('0x22')](function(_0x3b8dd9){if(_0x3b8dd9){_0x31f982[_0xe416('0x27')]=_0x3b8dd9[_0xe416('0x5e')]({'plain':!![]});return db[_0xe416('0x7d')]['find']({'where':{'id':_0x3b8dd9[_0xe416('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x2b32ac,null))[_0xe416('0x22')](function(_0x4cc75d){if(_0x4cc75d){_0x31f982['interaction']=_0x4cc75d['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xd985f2[_0xe416('0x5c')]['id'],_0xd985f2[_0xe416('0x5c')][_0xe416('0x38')],_0xd985f2['user'][_0xe416('0x63')],_0x31f982[_0xe416('0x61')]['id'],_0xd985f2['body']?JSON[_0xe416('0x64')](_0xd985f2[_0xe416('0x55')]):_0xe416('0x65'));return respondWithRpcPromise(_0xe416('0x7e'),_0xe416('0x7f'),_0x31f982);}return null;})['then'](function(_0x455035){var _0x265458='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x455035[_0xe416('0x27')][_0xe416('0x80')];return db[_0xe416('0x69')][_0xe416('0x44')](_0x265458,{'type':db[_0xe416('0x6a')]['QueryTypes'][_0xe416('0x6b')],'raw':!![]})['then'](function(_0x431f8c){return _0x431f8c;});})[_0xe416('0x22')](function(_0x6f8282){if(_0x6f8282){_0x31f982[_0xe416('0x27')][_0xe416('0x6c')]=_0x6f8282[0x0];if(!_0xd985f2[_0xe416('0x55')][_0xe416('0x5d')])return;return db['User'][_0xe416('0x53')]({'where':{'id':_0xd985f2[_0xe416('0x55')][_0xe416('0x5d')],'role':_0xe416('0x7c')},'attributes':['id',_0xe416('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})[_0xe416('0x22')](function(_0xffb196){if(!_0xffb196)return null;_0x31f982[_0xe416('0x27')][_0xe416('0x7c')]=_0xffb196;return _0x31f982;})['then'](function(_0x5d1ecd){if(_0x5d1ecd){_0x5d1ecd[_0xe416('0x27')][_0xe416('0x71')]=util[_0xe416('0x5a')](_0xe416('0x72'),_0xd985f2[_0xe416('0x5c')]['name']);_0x5d1ecd[_0xe416('0x27')][_0xe416('0x73')]=_0x31f982[_0xe416('0x73')];_0x5d1ecd[_0xe416('0x27')][_0xe416('0x74')]=_0x31f982[_0xe416('0x73')];_0x5d1ecd[_0xe416('0x27')][_0xe416('0x81')]=_0xe416('0x7b');respondWithRpcPromise(_0xe416('0x76'),_0xe416('0x76'),{'event':_0xe416('0x82'),'message':_[_0xe416('0x4a')](_0x31f982[_0xe416('0x27')],JSON[_0xe416('0x78')](_0x31f982['interaction'][_0xe416('0x79')]))},client9002);return _0x31f982;}return null;})[_0xe416('0x22')](respondWithResult(_0x2b32ac,null))[_0xe416('0x29')](handleError(_0x2b32ac,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 55c4a6f..f1a9f06 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 _0xf1dd=['exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5e2dd8,_0x46e6dc){var _0x1cfedc=function(_0x441ae8){while(--_0x441ae8){_0x5e2dd8['push'](_0x5e2dd8['shift']());}};_0x1cfedc(++_0x46e6dc);}(_0xf1dd,0xd3));var _0xdf1d=function(_0x1f1511,_0x4ea911){_0x1f1511=_0x1f1511-0x0;var _0x1d9ab8=_0xf1dd[_0x1f1511];return _0x1d9ab8;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xdf1d('0x0'))['db'][_0xdf1d('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xdf1d('0x2')](0x0);var events={'afterCreate':_0xdf1d('0x3'),'afterUpdate':_0xdf1d('0x4'),'afterDestroy':_0xdf1d('0x5')};function emitEvent(_0x1c2034){return function(_0x4b37b0,_0x44371d,_0xed64aa){ChatMessageEvents[_0xdf1d('0x6')](_0x1c2034+':'+_0x4b37b0['id'],_0x4b37b0);ChatMessageEvents['emit'](_0x1c2034,_0x4b37b0);_0xed64aa(null);};}for(var e in events){if(events[_0xdf1d('0x7')](e)){var event=events[e];ChatMessage[_0xdf1d('0x8')](e,emitEvent(event));}}module[_0xdf1d('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x9951=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x377cd8,_0x3aaabf){var _0x2685e1=function(_0x33a342){while(--_0x33a342){_0x377cd8['push'](_0x377cd8['shift']());}};_0x2685e1(++_0x3aaabf);}(_0x9951,0x187));var _0x1995=function(_0x5eec1f,_0x5302aa){_0x5eec1f=_0x5eec1f-0x0;var _0x59282f=_0x9951[_0x5eec1f];return _0x59282f;};'use strict';var EventEmitter=require(_0x1995('0x0'));var ChatMessage=require(_0x1995('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1995('0x2')](0x0);var events={'afterCreate':_0x1995('0x3'),'afterUpdate':_0x1995('0x4'),'afterDestroy':_0x1995('0x5')};function emitEvent(_0x1bc7b1){return function(_0x10f861,_0x485cda,_0x25e68){ChatMessageEvents[_0x1995('0x6')](_0x1bc7b1+':'+_0x10f861['id'],_0x10f861);ChatMessageEvents[_0x1995('0x6')](_0x1bc7b1,_0x10f861);_0x25e68(null);};}for(var e in events){if(events[_0x1995('0x7')](e)){var event=events[e];ChatMessage[_0x1995('0x8')](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 8890043..bbe93cb 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 _0x8dd6=['out','isNil','UserId','ChatInteraction','findOne','then','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatMessage','fti_chat_messages','FULLTEXT','models','toLowerCase','direction'];(function(_0x2e4e3e,_0x75ae94){var _0x51476b=function(_0x53afdc){while(--_0x53afdc){_0x2e4e3e['push'](_0x2e4e3e['shift']());}};_0x51476b(++_0x75ae94);}(_0x8dd6,0x19f));var _0x68dd=function(_0xaaff66,_0x9eec12){_0xaaff66=_0xaaff66-0x0;var _0x55232e=_0x8dd6[_0xaaff66];return _0x55232e;};'use strict';var _=require(_0x68dd('0x0'));var util=require('util');var logger=require(_0x68dd('0x1'))(_0x68dd('0x2'));var moment=require(_0x68dd('0x3'));var BPromise=require(_0x68dd('0x4'));var rp=require(_0x68dd('0x5'));var fs=require('fs');var path=require(_0x68dd('0x6'));var rimraf=require(_0x68dd('0x7'));var config=require(_0x68dd('0x8'));var attributes=require('./chatMessage.attributes');module[_0x68dd('0x9')]=function(_0x4bbd7b,_0x7097){return _0x4bbd7b[_0x68dd('0xa')](_0x68dd('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x68dd('0xc'),'fields':['body'],'type':_0x68dd('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ab4ae,_0xe42dec,_0x43bc9d){var _0x3314bb=_0x4bbd7b[_0x68dd('0xe')];var _0x1fbec4=_0x1ab4ae['get']({'plain':!![]});if(_0x1fbec4['direction'][_0x68dd('0xf')]()==='in'||_0x1fbec4[_0x68dd('0x10')]['toLowerCase']()===_0x68dd('0x11')&&!_0x1fbec4['secret']&&!_[_0x68dd('0x12')](_0x1fbec4[_0x68dd('0x13')])){_0x3314bb[_0x68dd('0x14')][_0x68dd('0x15')]({'where':{'id':_0x1fbec4['ChatInteractionId']}})[_0x68dd('0x16')](function(_0x425b07){if(_0x425b07){_0x425b07['update']({'lastMsgAt':_0x1fbec4['createdAt'],'lastMsgDirection':_0x1fbec4[_0x68dd('0x10')][_0x68dd('0xf')]()});}})[_0x68dd('0x17')](function(_0x3d735b){console[_0x68dd('0x18')](_0x3d735b);});}_0x43bc9d();}},'charset':_0x68dd('0x19'),'collate':_0x68dd('0x1a')});}; \ No newline at end of file +var _0x3870=['direction','out','isNil','UserId','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','chat_messages','fti_chat_messages','FULLTEXT','get','toLowerCase'];(function(_0x584766,_0x43c53a){var _0x572bfe=function(_0x2392ec){while(--_0x2392ec){_0x584766['push'](_0x584766['shift']());}};_0x572bfe(++_0x43c53a);}(_0x3870,0x15b));var _0x0387=function(_0x1ae109,_0x22ff67){_0x1ae109=_0x1ae109-0x0;var _0xce95c3=_0x3870[_0x1ae109];return _0xce95c3;};'use strict';var _=require(_0x0387('0x0'));var util=require(_0x0387('0x1'));var logger=require(_0x0387('0x2'))(_0x0387('0x3'));var moment=require(_0x0387('0x4'));var BPromise=require(_0x0387('0x5'));var rp=require(_0x0387('0x6'));var fs=require('fs');var path=require(_0x0387('0x7'));var rimraf=require(_0x0387('0x8'));var config=require(_0x0387('0x9'));var attributes=require(_0x0387('0xa'));module[_0x0387('0xb')]=function(_0x2e1bf7,_0x363c4e){return _0x2e1bf7['define']('ChatMessage',attributes,{'tableName':_0x0387('0xc'),'paranoid':![],'indexes':[{'name':_0x0387('0xd'),'fields':['body'],'type':_0x0387('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd1e14b,_0x2d42eb,_0x1bb19b){var _0x9a15a0=_0x2e1bf7['models'];var _0x3f1fbf=_0xd1e14b[_0x0387('0xf')]({'plain':!![]});if(_0x3f1fbf['direction'][_0x0387('0x10')]()==='in'||_0x3f1fbf[_0x0387('0x11')]['toLowerCase']()===_0x0387('0x12')&&!_0x3f1fbf['secret']&&!_[_0x0387('0x13')](_0x3f1fbf[_0x0387('0x14')])){_0x9a15a0['ChatInteraction'][_0x0387('0x15')]({'where':{'id':_0x3f1fbf[_0x0387('0x16')]}})[_0x0387('0x17')](function(_0x237ba3){if(_0x237ba3){_0x237ba3[_0x0387('0x18')]({'lastMsgAt':_0x3f1fbf[_0x0387('0x19')],'lastMsgDirection':_0x3f1fbf[_0x0387('0x11')][_0x0387('0x10')]()});}})['catch'](function(_0x4f2d8a){console[_0x0387('0x1a')](_0x4f2d8a);});}_0x1bb19b();}},'charset':'utf8mb4','collate':_0x0387('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index b5b3de8..7902c7b 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 _0xc824=['client','http','defaults','redis','localhost','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xc824,0x1b0));var _0x4c82=function(_0x4f547f,_0x469df5){_0x4f547f=_0x4f547f-0x0;var _0x511cfa=_0xc824[_0x4f547f];return _0x511cfa;};'use strict';var _=require(_0x4c82('0x0'));var util=require(_0x4c82('0x1'));var moment=require(_0x4c82('0x2'));var BPromise=require(_0x4c82('0x3'));var rs=require(_0x4c82('0x4'));var fs=require('fs');var Redis=require(_0x4c82('0x5'));var db=require(_0x4c82('0x6'))['db'];var utils=require(_0x4c82('0x7'));var logger=require('../../config/logger')(_0x4c82('0x8'));var config=require(_0x4c82('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4c82('0xa')][_0x4c82('0xb')]({'port':0x232a});config['redis']=_[_0x4c82('0xc')](config[_0x4c82('0xd')],{'host':_0x4c82('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4c82('0xd')]));require('./chatMessage.socket')[_0x4c82('0xf')](socket);function respondWithRpcPromise(_0x57c99c,_0x21d56e,_0x5ac194){return new BPromise(function(_0x26c7c5,_0x2113ce){return client[_0x4c82('0x10')](_0x57c99c,_0x5ac194)[_0x4c82('0x11')](function(_0x44ffa9){logger[_0x4c82('0x12')](_0x4c82('0x13'),_0x21d56e,_0x4c82('0x14'));logger[_0x4c82('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x21d56e,_0x4c82('0x14'),JSON['stringify'](_0x44ffa9));if(_0x44ffa9[_0x4c82('0x16')]){if(_0x44ffa9[_0x4c82('0x16')][_0x4c82('0x17')]===0x1f4){logger[_0x4c82('0x16')]('ChatMessage,\x20%s,\x20%s',_0x21d56e,_0x44ffa9['error'][_0x4c82('0x18')]);return _0x2113ce(_0x44ffa9[_0x4c82('0x16')][_0x4c82('0x18')]);}logger['error'](_0x4c82('0x13'),_0x21d56e,_0x44ffa9['error']['message']);return _0x26c7c5(_0x44ffa9[_0x4c82('0x16')][_0x4c82('0x18')]);}else{logger['info'](_0x4c82('0x13'),_0x21d56e,_0x4c82('0x14'));_0x26c7c5(_0x44ffa9[_0x4c82('0x19')][_0x4c82('0x18')]);}})[_0x4c82('0x1a')](function(_0xa15486){logger[_0x4c82('0x16')](_0x4c82('0x13'),_0x21d56e,_0xa15486);_0x2113ce(_0xa15486);});});}exports[_0x4c82('0x1b')]=function(_0x2e29e5){var _0x4c7900=this;return new Promise(function(_0x45a3ae,_0x585f8a){return db[_0x4c82('0x1c')][_0x4c82('0x1d')](_0x2e29e5[_0x4c82('0x1e')],{'raw':_0x2e29e5[_0x4c82('0x1f')]?_0x2e29e5[_0x4c82('0x1f')][_0x4c82('0x20')]===undefined?!![]:![]:!![]})[_0x4c82('0x11')](function(_0x5bc953){logger[_0x4c82('0x12')](_0x4c82('0x1b'),_0x2e29e5);logger['debug']('CreateChatMessage',_0x2e29e5,JSON[_0x4c82('0x21')](_0x5bc953));_0x45a3ae(_0x5bc953);})[_0x4c82('0x1a')](function(_0xb689c3){logger[_0x4c82('0x16')](_0x4c82('0x1b'),_0xb689c3[_0x4c82('0x18')],_0x2e29e5);_0x585f8a(_0x4c7900['error'](0x1f4,_0xb689c3[_0x4c82('0x18')]));});});}; \ No newline at end of file +var _0x76f2=['defaults','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis'];(function(_0x37fcd0,_0x141d80){var _0x3869d4=function(_0x52c5a3){while(--_0x52c5a3){_0x37fcd0['push'](_0x37fcd0['shift']());}};_0x3869d4(++_0x141d80);}(_0x76f2,0x125));var _0x276f=function(_0x58d40f,_0x18f78d){_0x58d40f=_0x58d40f-0x0;var _0x56572c=_0x76f2[_0x58d40f];return _0x56572c;};'use strict';var _=require(_0x276f('0x0'));var util=require(_0x276f('0x1'));var moment=require(_0x276f('0x2'));var BPromise=require(_0x276f('0x3'));var rs=require(_0x276f('0x4'));var fs=require('fs');var Redis=require(_0x276f('0x5'));var db=require(_0x276f('0x6'))['db'];var utils=require(_0x276f('0x7'));var logger=require(_0x276f('0x8'))(_0x276f('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x276f('0xa')][_0x276f('0xb')]({'port':0x232a});config[_0x276f('0xc')]=_[_0x276f('0xd')](config[_0x276f('0xc')],{'host':_0x276f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x276f('0xc')]));require(_0x276f('0xf'))[_0x276f('0x10')](socket);function respondWithRpcPromise(_0x1cf6dc,_0x178ddb,_0x48d337){return new BPromise(function(_0x43520c,_0x558c35){return client[_0x276f('0x11')](_0x1cf6dc,_0x48d337)[_0x276f('0x12')](function(_0x2f7e11){logger[_0x276f('0x13')](_0x276f('0x14'),_0x178ddb,_0x276f('0x15'));logger['debug'](_0x276f('0x16'),_0x178ddb,_0x276f('0x15'),JSON[_0x276f('0x17')](_0x2f7e11));if(_0x2f7e11[_0x276f('0x18')]){if(_0x2f7e11[_0x276f('0x18')][_0x276f('0x19')]===0x1f4){logger[_0x276f('0x18')](_0x276f('0x14'),_0x178ddb,_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);return _0x558c35(_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);}logger[_0x276f('0x18')]('ChatMessage,\x20%s,\x20%s',_0x178ddb,_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);return _0x43520c(_0x2f7e11[_0x276f('0x18')][_0x276f('0x1a')]);}else{logger['info'](_0x276f('0x14'),_0x178ddb,'request\x20sent');_0x43520c(_0x2f7e11['result']['message']);}})[_0x276f('0x1b')](function(_0x15ba3a){logger[_0x276f('0x18')](_0x276f('0x14'),_0x178ddb,_0x15ba3a);_0x558c35(_0x15ba3a);});});}exports[_0x276f('0x1c')]=function(_0x5afc36){var _0xd9a0c1=this;return new Promise(function(_0x27bb24,_0x4c7799){return db[_0x276f('0x1d')][_0x276f('0x1e')](_0x5afc36[_0x276f('0x1f')],{'raw':_0x5afc36[_0x276f('0x20')]?_0x5afc36[_0x276f('0x20')][_0x276f('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0xaa6b1f){logger[_0x276f('0x13')](_0x276f('0x1c'),_0x5afc36);logger['debug'](_0x276f('0x1c'),_0x5afc36,JSON[_0x276f('0x17')](_0xaa6b1f));_0x27bb24(_0xaa6b1f);})[_0x276f('0x1b')](function(_0x46777e){logger[_0x276f('0x18')](_0x276f('0x1c'),_0x46777e[_0x276f('0x1a')],_0x5afc36);_0x4c7799(_0xd9a0c1[_0x276f('0x18')](0x1f4,_0x46777e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 1823d3c..6caa2f2 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 _0x33c5=['remove','emit','removeListener','register','length','chatMessage:','save'];(function(_0x15ad02,_0x56ace9){var _0x3c87da=function(_0x32ced0){while(--_0x32ced0){_0x15ad02['push'](_0x15ad02['shift']());}};_0x3c87da(++_0x56ace9);}(_0x33c5,0xe6));var _0x533c=function(_0x24cc72,_0x4dc73a){_0x24cc72=_0x24cc72-0x0;var _0xd49f1e=_0x33c5[_0x24cc72];return _0xd49f1e;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x533c('0x0'),_0x533c('0x1'),'update'];function createListener(_0x9dafa,_0x26b916){return function(_0x221e43){_0x26b916[_0x533c('0x2')](_0x9dafa,_0x221e43);};}function removeListener(_0x358127,_0x49609e){return function(){ChatMessageEvents[_0x533c('0x3')](_0x358127,_0x49609e);};}exports[_0x533c('0x4')]=function(_0x31d912){for(var _0x151732=0x0,_0x34ca89=events[_0x533c('0x5')];_0x151732<_0x34ca89;_0x151732++){var _0x3a009b=events[_0x151732];var _0x36d74e=createListener(_0x533c('0x6')+_0x3a009b,_0x31d912);ChatMessageEvents['on'](_0x3a009b,_0x36d74e);}}; \ No newline at end of file +var _0x6379=['emit','removeListener','register','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6379,0x84));var _0x9637=function(_0x3ac064,_0x278b44){_0x3ac064=_0x3ac064-0x0;var _0x57a926=_0x6379[_0x3ac064];return _0x57a926;};'use strict';var ChatMessageEvents=require(_0x9637('0x0'));var events=[_0x9637('0x1'),_0x9637('0x2'),_0x9637('0x3')];function createListener(_0x19949a,_0x52d27e){return function(_0x44a9ae){_0x52d27e[_0x9637('0x4')](_0x19949a,_0x44a9ae);};}function removeListener(_0x5f1058,_0x5f50c5){return function(){ChatMessageEvents[_0x9637('0x5')](_0x5f1058,_0x5f50c5);};}exports[_0x9637('0x6')]=function(_0x19f7d0){for(var _0x25087c=0x0,_0xf0db9f=events['length'];_0x25087c<_0xf0db9f;_0x25087c++){var _0x515a84=events[_0x25087c];var _0x21d91b=createListener(_0x9637('0x7')+_0x515a84,_0x19f7d0);ChatMessageEvents['on'](_0x515a84,_0x21d91b);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 41e3578..5110eed 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 _0xa705=['delete','/:id','destroy','exports','express','Router','fs-extra','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','show','post','tracked','chat','chatmessage:create','put','/:id/accept','accept','/:id/reject','reject'];(function(_0x3d3590,_0x23bd12){var _0x1348ff=function(_0x26a61a){while(--_0x26a61a){_0x3d3590['push'](_0x3d3590['shift']());}};_0x1348ff(++_0x23bd12);}(_0xa705,0x1d0));var _0x5a70=function(_0x1bf1a9,_0x36c54b){_0x1bf1a9=_0x1bf1a9-0x0;var _0x12976e=_0xa705[_0x1bf1a9];return _0x12976e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5a70('0x0'));var router=express[_0x5a70('0x1')]();var fs_extra=require(_0x5a70('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x5a70('0x3'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5a70('0x4')]);router[_0x5a70('0x5')](_0x5a70('0x6'),auth[_0x5a70('0x7')](),controller[_0x5a70('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5a70('0x9')]);router[_0x5a70('0xa')]('/',auth['isAuthenticated'](),interaction[_0x5a70('0xb')](_0x5a70('0xc'),_0x5a70('0xd')),controller['create']);router[_0x5a70('0xe')]('/:id',controller['update']);router[_0x5a70('0xe')](_0x5a70('0xf'),auth['isAuthenticated'](),controller[_0x5a70('0x10')]);router[_0x5a70('0xe')](_0x5a70('0x11'),auth[_0x5a70('0x7')](),controller[_0x5a70('0x12')]);router[_0x5a70('0x13')](_0x5a70('0x14'),auth[_0x5a70('0x7')](),controller[_0x5a70('0x15')]);module[_0x5a70('0x16')]=router; \ No newline at end of file +var _0x7d22=['../../components/auth/service','isAuthenticated','index','describe','/:id','show','post','tracked','chatmessage:create','create','put','update','accept','reject','delete','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x2f4c8d,_0x43aa55){var _0x5c7f16=function(_0x5575e3){while(--_0x5575e3){_0x2f4c8d['push'](_0x2f4c8d['shift']());}};_0x5c7f16(++_0x43aa55);}(_0x7d22,0x7f));var _0x27d2=function(_0x1f3748,_0x473ebd){_0x1f3748=_0x1f3748-0x0;var _0x371fdd=_0x7d22[_0x1f3748];return _0x371fdd;};'use strict';var multer=require('multer');var util=require(_0x27d2('0x0'));var path=require(_0x27d2('0x1'));var timeout=require('connect-timeout');var express=require(_0x27d2('0x2'));var router=express[_0x27d2('0x3')]();var fs_extra=require(_0x27d2('0x4'));var auth=require(_0x27d2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatMessage.controller');router['get']('/',auth[_0x27d2('0x6')](),controller[_0x27d2('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x27d2('0x8')]);router['get'](_0x27d2('0x9'),auth[_0x27d2('0x6')](),controller[_0x27d2('0xa')]);router[_0x27d2('0xb')]('/',auth[_0x27d2('0x6')](),interaction[_0x27d2('0xc')]('chat',_0x27d2('0xd')),controller[_0x27d2('0xe')]);router[_0x27d2('0xf')]('/:id',controller[_0x27d2('0x10')]);router['put']('/:id/accept',auth[_0x27d2('0x6')](),controller[_0x27d2('0x11')]);router[_0x27d2('0xf')]('/:id/reject',auth[_0x27d2('0x6')](),controller[_0x27d2('0x12')]);router[_0x27d2('0x13')](_0x27d2('0x9'),auth[_0x27d2('0x6')](),controller[_0x27d2('0x14')]);module[_0x27d2('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 1bab6a1..df83286 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(_0x383268,_0x3c7d0b){var _0x521669=function(_0x39100f){while(--_0x39100f){_0x383268['push'](_0x383268['shift']());}};_0x521669(++_0x3c7d0b);}(_0xadb5,0xad));var _0x5adb=function(_0x10ff43,_0x5ef879){_0x10ff43=_0x10ff43-0x0;var _0x5a33b0=_0xadb5[_0x10ff43];return _0x5a33b0;};'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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x3524a7,_0x3e1d6a){var _0x74afd2=function(_0x34fd7a){while(--_0x34fd7a){_0x3524a7['push'](_0x3524a7['shift']());}};_0x74afd2(++_0x3e1d6a);}(_0xdb28,0x106));var _0x8db2=function(_0x2c4acc,_0x4ff068){_0x2c4acc=_0x2c4acc-0x0;var _0x295d8a=_0xdb28[_0x2c4acc];return _0x295d8a;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 534e929..051d21c 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(_0x39148d,_0x3238ba){var _0x351428=function(_0x27884a){while(--_0x27884a){_0x39148d['push'](_0x39148d['shift']());}};_0x351428(++_0x3238ba);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +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(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x7a54,0x106));var _0x47a5=function(_0x5bbf9e,_0x3343f8){_0x5bbf9e=_0x5bbf9e-0x0;var _0x4419c5=_0x7a54[_0x5bbf9e];return _0x4419c5;};'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 5d25811..3670278 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 _0x053f=['ChatOfflineMessage','setMaxListeners','save','update','remove','hasOwnProperty','exports','../../mysqldb'];(function(_0x5f36e9,_0x5023ae){var _0xb512bc=function(_0x596290){while(--_0x596290){_0x5f36e9['push'](_0x5f36e9['shift']());}};_0xb512bc(++_0x5023ae);}(_0x053f,0xbf));var _0xf053=function(_0x28bd6d,_0x41ab55){_0x28bd6d=_0x28bd6d-0x0;var _0x254d52=_0x053f[_0x28bd6d];return _0x254d52;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0xf053('0x0'))['db'][_0xf053('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xf053('0x2')](0x0);var events={'afterCreate':_0xf053('0x3'),'afterUpdate':_0xf053('0x4'),'afterDestroy':_0xf053('0x5')};function emitEvent(_0x252487){return function(_0x1be712,_0x3189f7,_0x4d319e){ChatOfflineMessageEvents['emit'](_0x252487+':'+_0x1be712['id'],_0x1be712);ChatOfflineMessageEvents['emit'](_0x252487,_0x1be712);_0x4d319e(null);};}for(var e in events){if(events[_0xf053('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xf053('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x4405=['save','events','../../mysqldb','ChatOfflineMessage','setMaxListeners'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4405,0xce));var _0x5440=function(_0x3eb702,_0x54ae25){_0x3eb702=_0x3eb702-0x0;var _0x16ebd1=_0x4405[_0x3eb702];return _0x16ebd1;};'use strict';var EventEmitter=require(_0x5440('0x0'));var ChatOfflineMessage=require(_0x5440('0x1'))['db'][_0x5440('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x5440('0x3')](0x0);var events={'afterCreate':_0x5440('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4dd5fc){return function(_0x530c11,_0x1757eb,_0x334d7d){ChatOfflineMessageEvents['emit'](_0x4dd5fc+':'+_0x530c11['id'],_0x530c11);ChatOfflineMessageEvents['emit'](_0x4dd5fc,_0x530c11);_0x334d7d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index add68d7..7610200 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 _0x4875=['chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x295275,_0x204935){var _0x12d156=function(_0x23c3c2){while(--_0x23c3c2){_0x295275['push'](_0x295275['shift']());}};_0x12d156(++_0x204935);}(_0x4875,0x1d2));var _0x5487=function(_0x4afa19,_0x4440ef){_0x4afa19=_0x4afa19-0x0;var _0x2e6278=_0x4875[_0x4afa19];return _0x2e6278;};'use strict';var attributes=require(_0x5487('0x0'));module[_0x5487('0x1')]=function(_0x53f545){return _0x53f545['define']('ChatOfflineMessage',attributes,{'tableName':_0x5487('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5487('0x3')});}; \ No newline at end of file +var _0xfaba=['exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x175a46,_0x467177){var _0x4050a7=function(_0x43d829){while(--_0x43d829){_0x175a46['push'](_0x175a46['shift']());}};_0x4050a7(++_0x467177);}(_0xfaba,0x1df));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xafab('0x0'));module[_0xafab('0x1')]=function(_0x172d4d){return _0x172d4d[_0xafab('0x2')](_0xafab('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xafab('0x4'),'collate':_0xafab('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 6e739ce..ddf3f2f 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 _0x51b2=['then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0x51b2,0x150));var _0x251b=function(_0x5edc38,_0x1fee22){_0x5edc38=_0x5edc38-0x0;var _0xe32e5=_0x51b2[_0x5edc38];return _0xe32e5;};'use strict';var _=require('lodash');var util=require(_0x251b('0x0'));var moment=require(_0x251b('0x1'));var BPromise=require(_0x251b('0x2'));var rs=require(_0x251b('0x3'));var fs=require('fs');var Redis=require(_0x251b('0x4'));var db=require(_0x251b('0x5'))['db'];var utils=require(_0x251b('0x6'));var logger=require(_0x251b('0x7'))(_0x251b('0x8'));var config=require(_0x251b('0x9'));var jayson=require(_0x251b('0xa'));var client=jayson[_0x251b('0xb')][_0x251b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b055e,_0x232257,_0x252ec1){return new BPromise(function(_0x4d7f0f,_0x10974f){return client[_0x251b('0xd')](_0x1b055e,_0x252ec1)[_0x251b('0xe')](function(_0x3929ed){logger[_0x251b('0xf')](_0x251b('0x10'),_0x232257,_0x251b('0x11'));logger[_0x251b('0x12')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x232257,_0x251b('0x11'),JSON[_0x251b('0x13')](_0x3929ed));if(_0x3929ed[_0x251b('0x14')]){if(_0x3929ed[_0x251b('0x14')][_0x251b('0x15')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x232257,_0x3929ed['error'][_0x251b('0x16')]);return _0x10974f(_0x3929ed[_0x251b('0x14')]['message']);}logger[_0x251b('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x232257,_0x3929ed[_0x251b('0x14')][_0x251b('0x16')]);return _0x4d7f0f(_0x3929ed['error'][_0x251b('0x16')]);}else{logger[_0x251b('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x232257,_0x251b('0x11'));_0x4d7f0f(_0x3929ed[_0x251b('0x17')][_0x251b('0x16')]);}})[_0x251b('0x18')](function(_0x4416f1){logger[_0x251b('0x14')](_0x251b('0x10'),_0x232257,_0x4416f1);_0x10974f(_0x4416f1);});});} \ No newline at end of file +var _0xe4d9=['request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0xe4d9,0x141));var _0x9e4d=function(_0x17e4ee,_0x486725){_0x17e4ee=_0x17e4ee-0x0;var _0x46d765=_0xe4d9[_0x17e4ee];return _0x46d765;};'use strict';var _=require(_0x9e4d('0x0'));var util=require(_0x9e4d('0x1'));var moment=require(_0x9e4d('0x2'));var BPromise=require('bluebird');var rs=require(_0x9e4d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9e4d('0x4'));var logger=require(_0x9e4d('0x5'))('rpc');var config=require(_0x9e4d('0x6'));var jayson=require(_0x9e4d('0x7'));var client=jayson['client'][_0x9e4d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x74b14,_0x5bfad3,_0x5af2a0){return new BPromise(function(_0x36ec30,_0x48d257){return client[_0x9e4d('0x9')](_0x74b14,_0x5af2a0)[_0x9e4d('0xa')](function(_0x4ea141){logger[_0x9e4d('0xb')](_0x9e4d('0xc'),_0x5bfad3,_0x9e4d('0xd'));logger[_0x9e4d('0xe')](_0x9e4d('0xf'),_0x5bfad3,_0x9e4d('0xd'),JSON[_0x9e4d('0x10')](_0x4ea141));if(_0x4ea141[_0x9e4d('0x11')]){if(_0x4ea141[_0x9e4d('0x11')][_0x9e4d('0x12')]===0x1f4){logger[_0x9e4d('0x11')](_0x9e4d('0xc'),_0x5bfad3,_0x4ea141[_0x9e4d('0x11')][_0x9e4d('0x13')]);return _0x48d257(_0x4ea141[_0x9e4d('0x11')]['message']);}logger[_0x9e4d('0x11')](_0x9e4d('0xc'),_0x5bfad3,_0x4ea141[_0x9e4d('0x11')][_0x9e4d('0x13')]);return _0x36ec30(_0x4ea141[_0x9e4d('0x11')][_0x9e4d('0x13')]);}else{logger['info'](_0x9e4d('0xc'),_0x5bfad3,_0x9e4d('0xd'));_0x36ec30(_0x4ea141[_0x9e4d('0x14')][_0x9e4d('0x13')]);}})[_0x9e4d('0x15')](function(_0x42674a){logger['error'](_0x9e4d('0xc'),_0x5bfad3,_0x42674a);_0x48d257(_0x42674a);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 74054fd..d6e5972 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 _0x252a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','create','put','update','delete','exports','multer'];(function(_0x3db3f1,_0x130f14){var _0x59d4b5=function(_0x5001c2){while(--_0x5001c2){_0x3db3f1['push'](_0x3db3f1['shift']());}};_0x59d4b5(++_0x130f14);}(_0x252a,0x17b));var _0xa252=function(_0x5267f4,_0x6b9ea0){_0x5267f4=_0x5267f4-0x0;var _0x15d5c8=_0x252a[_0x5267f4];return _0x15d5c8;};'use strict';var multer=require(_0xa252('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa252('0x1'));var express=require(_0xa252('0x2'));var router=express[_0xa252('0x3')]();var fs_extra=require(_0xa252('0x4'));var auth=require(_0xa252('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa252('0x6'));var controller=require(_0xa252('0x7'));router['get']('/',auth[_0xa252('0x8')](),controller[_0xa252('0x9')]);router[_0xa252('0xa')](_0xa252('0xb'),auth[_0xa252('0x8')](),controller[_0xa252('0xc')]);router[_0xa252('0xa')](_0xa252('0xd'),auth[_0xa252('0x8')](),controller['show']);router['post']('/',auth[_0xa252('0x8')](),controller[_0xa252('0xe')]);router[_0xa252('0xf')]('/:id',auth[_0xa252('0x8')](),controller[_0xa252('0x10')]);router[_0xa252('0x11')](_0xa252('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xa252('0x12')]=router; \ No newline at end of file +var _0x80c6=['exports','multer','util','path','express','Router','fs-extra','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id'];(function(_0x3c863a,_0x34ce85){var _0x2474d6=function(_0x298b4a){while(--_0x298b4a){_0x3c863a['push'](_0x3c863a['shift']());}};_0x2474d6(++_0x34ce85);}(_0x80c6,0x144));var _0x680c=function(_0xc42fc8,_0x2f856a){_0xc42fc8=_0xc42fc8-0x0;var _0x2fe13d=_0x80c6[_0xc42fc8];return _0x2fe13d;};'use strict';var multer=require(_0x680c('0x0'));var util=require(_0x680c('0x1'));var path=require(_0x680c('0x2'));var timeout=require('connect-timeout');var express=require(_0x680c('0x3'));var router=express[_0x680c('0x4')]();var fs_extra=require(_0x680c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x680c('0x6'));var controller=require(_0x680c('0x7'));router[_0x680c('0x8')]('/',auth[_0x680c('0x9')](),controller[_0x680c('0xa')]);router['get'](_0x680c('0xb'),auth['isAuthenticated'](),controller[_0x680c('0xc')]);router[_0x680c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x680c('0xd')]);router[_0x680c('0xe')]('/',auth[_0x680c('0x9')](),controller[_0x680c('0xf')]);router[_0x680c('0x10')](_0x680c('0x11'),auth[_0x680c('0x9')](),controller['update']);router['delete']('/:id',auth[_0x680c('0x9')](),controller['destroy']);module[_0x680c('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 2971063..713c220 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 _0x93db=['ENUM','mouseOver','INTEGER','sequelize','exports','STRING'];(function(_0x16ac8f,_0x52964d){var _0x39d3f5=function(_0x325766){while(--_0x325766){_0x16ac8f['push'](_0x16ac8f['shift']());}};_0x39d3f5(++_0x52964d);}(_0x93db,0x9f));var _0xb93d=function(_0x1a8d78,_0x3f5d7d){_0x1a8d78=_0x1a8d78-0x0;var _0xd12b5b=_0x93db[_0x1a8d78];return _0xd12b5b;};'use strict';var Sequelize=require(_0xb93d('0x0'));module[_0xb93d('0x1')]={'name':{'type':Sequelize[_0xb93d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb93d('0x3')](_0xb93d('0x4'),'timeout'),'defaultValue':_0xb93d('0x4')},'selector':{'type':Sequelize[_0xb93d('0x2')]},'timeout':{'type':Sequelize[_0xb93d('0x5')]}}; \ No newline at end of file +var _0x2cc7=['STRING','ENUM','mouseOver','timeout','INTEGER','exports'];(function(_0x28b599,_0x30ae3d){var _0x1a77cd=function(_0x4f223a){while(--_0x4f223a){_0x28b599['push'](_0x28b599['shift']());}};_0x1a77cd(++_0x30ae3d);}(_0x2cc7,0x1eb));var _0x72cc=function(_0x142cd2,_0x1512ff){_0x142cd2=_0x142cd2-0x0;var _0x2ad733=_0x2cc7[_0x142cd2];return _0x2ad733;};'use strict';var Sequelize=require('sequelize');module[_0x72cc('0x0')]={'name':{'type':Sequelize[_0x72cc('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x72cc('0x2')](_0x72cc('0x3'),_0x72cc('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x72cc('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index a76ddb0..5da0af3 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 _0xa630=['error','stack','name','send','params','model','keys','ChatProactiveAction','query','filters','intersection','fields','attributes','include','merge','find','catch','create','body','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xa630,0xbe));var _0x0a63=function(_0x16e9cc,_0x5aa3aa){_0x16e9cc=_0x16e9cc-0x0;var _0x5e5d05=_0xa630[_0x16e9cc];return _0x5e5d05;};'use strict';var emlformat=require(_0x0a63('0x0'));var rimraf=require(_0x0a63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a63('0x2'));var moment=require('moment');var BPromise=require(_0x0a63('0x3'));var Mustache=require('mustache');var util=require(_0x0a63('0x4'));var path=require(_0x0a63('0x5'));var sox=require(_0x0a63('0x6'));var csv=require(_0x0a63('0x7'));var ejs=require(_0x0a63('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a63('0x9'));var squel=require(_0x0a63('0xa'));var crypto=require(_0x0a63('0xb'));var jsforce=require(_0x0a63('0xc'));var deskjs=require(_0x0a63('0xd'));var toCsv=require(_0x0a63('0x7'));var querystring=require('querystring');var Papa=require(_0x0a63('0xe'));var Redis=require(_0x0a63('0xf'));var authService=require(_0x0a63('0x10'));var qs=require(_0x0a63('0x11'));var as=require(_0x0a63('0x12'));var hardwareService=require(_0x0a63('0x13'));var logger=require(_0x0a63('0x14'))(_0x0a63('0x15'));var utils=require(_0x0a63('0x16'));var config=require(_0x0a63('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a63('0x18'))['db'];function respondWithStatusCode(_0x420043,_0x2fce86){_0x2fce86=_0x2fce86||0xcc;return function(_0x3d6323){if(_0x3d6323){return _0x420043['sendStatus'](_0x2fce86);}return _0x420043[_0x0a63('0x19')](_0x2fce86)['end']();};}function respondWithResult(_0x331e99,_0x19e922){_0x19e922=_0x19e922||0xc8;return function(_0x26b2bc){if(_0x26b2bc){return _0x331e99[_0x0a63('0x19')](_0x19e922)[_0x0a63('0x1a')](_0x26b2bc);}};}function respondWithFilteredResult(_0x23b49d,_0x552b1f){return function(_0x1e3251){if(_0x1e3251){var _0x524a98=typeof _0x552b1f[_0x0a63('0x1b')]==='undefined'&&typeof _0x552b1f[_0x0a63('0x1c')]===_0x0a63('0x1d');var _0x36a9e8=_0x1e3251[_0x0a63('0x1e')];var _0x1f7481=_0x524a98?0x0:_0x552b1f[_0x0a63('0x1b')];var _0x30f292=_0x524a98?_0x1e3251[_0x0a63('0x1e')]:_0x552b1f[_0x0a63('0x1b')]+_0x552b1f[_0x0a63('0x1c')];var _0x2ad167;if(_0x30f292>=_0x36a9e8){_0x30f292=_0x36a9e8;_0x2ad167=0xc8;}else{_0x2ad167=0xce;}_0x23b49d['status'](_0x2ad167);return _0x23b49d['set'](_0x0a63('0x1f'),_0x1f7481+'-'+_0x30f292+'/'+_0x36a9e8)['json'](_0x1e3251);}return null;};}function patchUpdates(_0x2fc87c){return function(_0x5937df){try{jsonpatch[_0x0a63('0x20')](_0x5937df,_0x2fc87c,!![]);}catch(_0x41d6b8){return BPromise[_0x0a63('0x21')](_0x41d6b8);}return _0x5937df[_0x0a63('0x22')]();};}function saveUpdates(_0x5da46b,_0x398a16){return function(_0x4c225a){if(_0x4c225a){return _0x4c225a[_0x0a63('0x23')](_0x5da46b)[_0x0a63('0x24')](function(_0x1bf64a){return _0x1bf64a;});}return null;};}function removeEntity(_0x20c114,_0x343273){return function(_0x1f929f){if(_0x1f929f){return _0x1f929f[_0x0a63('0x25')]()[_0x0a63('0x24')](function(){_0x20c114['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55fb70,_0x4c8637){return function(_0xeacfc9){if(!_0xeacfc9){_0x55fb70['sendStatus'](0x194);}return _0xeacfc9;};}function handleError(_0x496c93,_0x2133cf){_0x2133cf=_0x2133cf||0x1f4;return function(_0x1d5448){logger[_0x0a63('0x26')](_0x1d5448[_0x0a63('0x27')]);if(_0x1d5448['name']){delete _0x1d5448[_0x0a63('0x28')];}_0x496c93[_0x0a63('0x19')](_0x2133cf)[_0x0a63('0x29')](_0x1d5448);};}exports['show']=function(_0x34239b,_0xcf409){var _0x1b7bdb={'raw':!![],'where':{'id':_0x34239b[_0x0a63('0x2a')]['id']}},_0x145090={};_0x145090[_0x0a63('0x2b')]=_[_0x0a63('0x2c')](db[_0x0a63('0x2d')]['rawAttributes']);_0x145090[_0x0a63('0x2e')]=_['keys'](_0x34239b[_0x0a63('0x2e')]);_0x145090[_0x0a63('0x2f')]=_[_0x0a63('0x30')](_0x145090[_0x0a63('0x2b')],_0x145090[_0x0a63('0x2e')]);_0x1b7bdb['attributes']=_[_0x0a63('0x30')](_0x145090[_0x0a63('0x2b')],qs[_0x0a63('0x31')](_0x34239b[_0x0a63('0x2e')]['fields']));_0x1b7bdb[_0x0a63('0x32')]=_0x1b7bdb[_0x0a63('0x32')]['length']?_0x1b7bdb['attributes']:_0x145090[_0x0a63('0x2b')];if(_0x34239b['query']['includeAll']){_0x1b7bdb[_0x0a63('0x33')]=[{'all':!![]}];}_0x1b7bdb=_[_0x0a63('0x34')]({},_0x1b7bdb,_0x34239b['options']);return db[_0x0a63('0x2d')][_0x0a63('0x35')](_0x1b7bdb)[_0x0a63('0x24')](handleEntityNotFound(_0xcf409,null))[_0x0a63('0x24')](respondWithResult(_0xcf409,null))[_0x0a63('0x36')](handleError(_0xcf409,null));};exports['create']=function(_0x5c7b56,_0x22993d){return db[_0x0a63('0x2d')][_0x0a63('0x37')](_0x5c7b56[_0x0a63('0x38')],{})[_0x0a63('0x24')](respondWithResult(_0x22993d,0xc9))[_0x0a63('0x36')](handleError(_0x22993d,null));};exports['update']=function(_0x307fe2,_0x276156){if(_0x307fe2['body']['id']){delete _0x307fe2[_0x0a63('0x38')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x307fe2[_0x0a63('0x2a')]['id']}})[_0x0a63('0x24')](handleEntityNotFound(_0x276156,null))[_0x0a63('0x24')](saveUpdates(_0x307fe2['body'],null))[_0x0a63('0x24')](respondWithResult(_0x276156,null))[_0x0a63('0x36')](handleError(_0x276156,null));};exports[_0x0a63('0x25')]=function(_0x369e68,_0x3f88a1){return db[_0x0a63('0x2d')][_0x0a63('0x35')]({'where':{'id':_0x369e68['params']['id']}})[_0x0a63('0x24')](handleEntityNotFound(_0x3f88a1,null))[_0x0a63('0x24')](removeEntity(_0x3f88a1,null))[_0x0a63('0x36')](handleError(_0x3f88a1,null));}; \ No newline at end of file +var _0x7c1f=['json','undefined','count','offset','limit','Content-Range','apply','reject','update','destroy','then','status','error','stack','name','show','params','model','keys','rawAttributes','query','filters','fields','attributes','length','includeAll','options','ChatProactiveAction','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x449104,_0x2794ea){var _0x239840=function(_0x23b90f){while(--_0x23b90f){_0x449104['push'](_0x449104['shift']());}};_0x239840(++_0x2794ea);}(_0x7c1f,0x194));var _0xf7c1=function(_0xd28528,_0x4f06d9){_0xd28528=_0xd28528-0x0;var _0xa412ed=_0x7c1f[_0xd28528];return _0xa412ed;};'use strict';var emlformat=require(_0xf7c1('0x0'));var rimraf=require(_0xf7c1('0x1'));var zipdir=require(_0xf7c1('0x2'));var jsonpatch=require(_0xf7c1('0x3'));var rp=require(_0xf7c1('0x4'));var moment=require('moment');var BPromise=require(_0xf7c1('0x5'));var Mustache=require(_0xf7c1('0x6'));var util=require(_0xf7c1('0x7'));var path=require('path');var sox=require(_0xf7c1('0x8'));var csv=require(_0xf7c1('0x9'));var ejs=require(_0xf7c1('0xa'));var fs=require('fs');var fs_extra=require(_0xf7c1('0xb'));var _=require('lodash');var squel=require(_0xf7c1('0xc'));var crypto=require(_0xf7c1('0xd'));var jsforce=require(_0xf7c1('0xe'));var deskjs=require(_0xf7c1('0xf'));var toCsv=require(_0xf7c1('0x9'));var querystring=require(_0xf7c1('0x10'));var Papa=require(_0xf7c1('0x11'));var Redis=require(_0xf7c1('0x12'));var authService=require(_0xf7c1('0x13'));var qs=require(_0xf7c1('0x14'));var as=require(_0xf7c1('0x15'));var hardwareService=require(_0xf7c1('0x16'));var logger=require('../../config/logger')(_0xf7c1('0x17'));var utils=require(_0xf7c1('0x18'));var config=require(_0xf7c1('0x19'));var licenseUtil=require(_0xf7c1('0x1a'));var db=require(_0xf7c1('0x1b'))['db'];function respondWithStatusCode(_0x377ca4,_0x4ffd9a){_0x4ffd9a=_0x4ffd9a||0xcc;return function(_0x5f579c){if(_0x5f579c){return _0x377ca4[_0xf7c1('0x1c')](_0x4ffd9a);}return _0x377ca4['status'](_0x4ffd9a)[_0xf7c1('0x1d')]();};}function respondWithResult(_0x212791,_0x5b553f){_0x5b553f=_0x5b553f||0xc8;return function(_0x396f8b){if(_0x396f8b){return _0x212791['status'](_0x5b553f)[_0xf7c1('0x1e')](_0x396f8b);}};}function respondWithFilteredResult(_0x3fc40e,_0x315424){return function(_0x12ccde){if(_0x12ccde){var _0xb567e7=typeof _0x315424['offset']===_0xf7c1('0x1f')&&typeof _0x315424['limit']===_0xf7c1('0x1f');var _0x4f0a0a=_0x12ccde[_0xf7c1('0x20')];var _0x20e3f8=_0xb567e7?0x0:_0x315424[_0xf7c1('0x21')];var _0x15dd26=_0xb567e7?_0x12ccde[_0xf7c1('0x20')]:_0x315424[_0xf7c1('0x21')]+_0x315424[_0xf7c1('0x22')];var _0x43eee9;if(_0x15dd26>=_0x4f0a0a){_0x15dd26=_0x4f0a0a;_0x43eee9=0xc8;}else{_0x43eee9=0xce;}_0x3fc40e['status'](_0x43eee9);return _0x3fc40e['set'](_0xf7c1('0x23'),_0x20e3f8+'-'+_0x15dd26+'/'+_0x4f0a0a)[_0xf7c1('0x1e')](_0x12ccde);}return null;};}function patchUpdates(_0x4ee91e){return function(_0x16d8a1){try{jsonpatch[_0xf7c1('0x24')](_0x16d8a1,_0x4ee91e,!![]);}catch(_0x51aba8){return BPromise[_0xf7c1('0x25')](_0x51aba8);}return _0x16d8a1['save']();};}function saveUpdates(_0x4b202d,_0x59e25f){return function(_0x4333f0){if(_0x4333f0){return _0x4333f0[_0xf7c1('0x26')](_0x4b202d)['then'](function(_0x2932e2){return _0x2932e2;});}return null;};}function removeEntity(_0x18e2b4,_0x4eff1a){return function(_0x33c874){if(_0x33c874){return _0x33c874[_0xf7c1('0x27')]()[_0xf7c1('0x28')](function(){_0x18e2b4[_0xf7c1('0x29')](0xcc)[_0xf7c1('0x1d')]();});}};}function handleEntityNotFound(_0x54f3f3,_0x502f57){return function(_0x5bd8ba){if(!_0x5bd8ba){_0x54f3f3[_0xf7c1('0x1c')](0x194);}return _0x5bd8ba;};}function handleError(_0x2802bf,_0x14ecef){_0x14ecef=_0x14ecef||0x1f4;return function(_0x374efc){logger[_0xf7c1('0x2a')](_0x374efc[_0xf7c1('0x2b')]);if(_0x374efc[_0xf7c1('0x2c')]){delete _0x374efc[_0xf7c1('0x2c')];}_0x2802bf[_0xf7c1('0x29')](_0x14ecef)['send'](_0x374efc);};}exports[_0xf7c1('0x2d')]=function(_0x37c472,_0x4f68c6){var _0x43c7b4={'raw':!![],'where':{'id':_0x37c472[_0xf7c1('0x2e')]['id']}},_0x1f486d={};_0x1f486d[_0xf7c1('0x2f')]=_[_0xf7c1('0x30')](db['ChatProactiveAction'][_0xf7c1('0x31')]);_0x1f486d['query']=_[_0xf7c1('0x30')](_0x37c472[_0xf7c1('0x32')]);_0x1f486d[_0xf7c1('0x33')]=_['intersection'](_0x1f486d[_0xf7c1('0x2f')],_0x1f486d[_0xf7c1('0x32')]);_0x43c7b4['attributes']=_['intersection'](_0x1f486d[_0xf7c1('0x2f')],qs[_0xf7c1('0x34')](_0x37c472[_0xf7c1('0x32')][_0xf7c1('0x34')]));_0x43c7b4[_0xf7c1('0x35')]=_0x43c7b4['attributes'][_0xf7c1('0x36')]?_0x43c7b4[_0xf7c1('0x35')]:_0x1f486d[_0xf7c1('0x2f')];if(_0x37c472[_0xf7c1('0x32')][_0xf7c1('0x37')]){_0x43c7b4['include']=[{'all':!![]}];}_0x43c7b4=_['merge']({},_0x43c7b4,_0x37c472[_0xf7c1('0x38')]);return db[_0xf7c1('0x39')][_0xf7c1('0x3a')](_0x43c7b4)[_0xf7c1('0x28')](handleEntityNotFound(_0x4f68c6,null))[_0xf7c1('0x28')](respondWithResult(_0x4f68c6,null))['catch'](handleError(_0x4f68c6,null));};exports['create']=function(_0x17a667,_0x122e85){return db[_0xf7c1('0x39')][_0xf7c1('0x3b')](_0x17a667['body'],{})[_0xf7c1('0x28')](respondWithResult(_0x122e85,0xc9))['catch'](handleError(_0x122e85,null));};exports[_0xf7c1('0x26')]=function(_0x368e33,_0x1f2141){if(_0x368e33[_0xf7c1('0x3c')]['id']){delete _0x368e33[_0xf7c1('0x3c')]['id'];}return db[_0xf7c1('0x39')][_0xf7c1('0x3a')]({'where':{'id':_0x368e33['params']['id']}})['then'](handleEntityNotFound(_0x1f2141,null))[_0xf7c1('0x28')](saveUpdates(_0x368e33['body'],null))[_0xf7c1('0x28')](respondWithResult(_0x1f2141,null))[_0xf7c1('0x3d')](handleError(_0x1f2141,null));};exports['destroy']=function(_0x22a832,_0x53a2c5){return db['ChatProactiveAction'][_0xf7c1('0x3a')]({'where':{'id':_0x22a832[_0xf7c1('0x2e')]['id']}})[_0xf7c1('0x28')](handleEntityNotFound(_0x53a2c5,null))[_0xf7c1('0x28')](removeEntity(_0x53a2c5,null))['catch'](handleError(_0x53a2c5,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index dd9eb5f..95b9537 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 _0x9134=['bluebird','rimraf','../../config/environment','./chatProactiveAction.attributes','define','chat_proactive_actions','lodash','util','../../config/logger','api','moment'];(function(_0x333798,_0x9f6561){var _0x389f4e=function(_0x193b28){while(--_0x193b28){_0x333798['push'](_0x333798['shift']());}};_0x389f4e(++_0x9f6561);}(_0x9134,0x17c));var _0x4913=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9134[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x4913('0x0'));var util=require(_0x4913('0x1'));var logger=require(_0x4913('0x2'))(_0x4913('0x3'));var moment=require(_0x4913('0x4'));var BPromise=require(_0x4913('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4913('0x6'));var config=require(_0x4913('0x7'));var attributes=require(_0x4913('0x8'));module['exports']=function(_0x40505a,_0x30167a){return _0x40505a[_0x4913('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x4913('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bfc=['request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger','api','bluebird'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x1bfc,0xa3));var _0xc1bf=function(_0x2cdab0,_0x63bff7){_0x2cdab0=_0x2cdab0-0x0;var _0x34ba84=_0x1bfc[_0x2cdab0];return _0x34ba84;};'use strict';var _=require(_0xc1bf('0x0'));var util=require(_0xc1bf('0x1'));var logger=require(_0xc1bf('0x2'))(_0xc1bf('0x3'));var moment=require('moment');var BPromise=require(_0xc1bf('0x4'));var rp=require(_0xc1bf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1bf('0x6'));var config=require(_0xc1bf('0x7'));var attributes=require(_0xc1bf('0x8'));module[_0xc1bf('0x9')]=function(_0x1af09a,_0x372115){return _0x1af09a[_0xc1bf('0xa')](_0xc1bf('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index e8a88e7..221c172 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 _0x74d6=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x41b38b,_0x165650){var _0x420c87=function(_0x129b4f){while(--_0x129b4f){_0x41b38b['push'](_0x41b38b['shift']());}};_0x420c87(++_0x165650);}(_0x74d6,0x166));var _0x674d=function(_0x7d55f3,_0x3c1a94){_0x7d55f3=_0x7d55f3-0x0;var _0x5db403=_0x74d6[_0x7d55f3];return _0x5db403;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x674d('0x0'));var BPromise=require(_0x674d('0x1'));var rs=require(_0x674d('0x2'));var fs=require('fs');var Redis=require(_0x674d('0x3'));var db=require(_0x674d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x674d('0x5'))(_0x674d('0x6'));var config=require(_0x674d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x674d('0x8')][_0x674d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10b1fa,_0x191cfa,_0x195ac5){return new BPromise(function(_0xa0d838,_0x8615fb){return client[_0x674d('0xa')](_0x10b1fa,_0x195ac5)[_0x674d('0xb')](function(_0x3a8b31){logger[_0x674d('0xc')](_0x674d('0xd'),_0x191cfa,_0x674d('0xe'));logger[_0x674d('0xf')](_0x674d('0x10'),_0x191cfa,_0x674d('0xe'),JSON[_0x674d('0x11')](_0x3a8b31));if(_0x3a8b31[_0x674d('0x12')]){if(_0x3a8b31[_0x674d('0x12')]['code']===0x1f4){logger[_0x674d('0x12')](_0x674d('0xd'),_0x191cfa,_0x3a8b31[_0x674d('0x12')]['message']);return _0x8615fb(_0x3a8b31[_0x674d('0x12')][_0x674d('0x13')]);}logger['error'](_0x674d('0xd'),_0x191cfa,_0x3a8b31[_0x674d('0x12')][_0x674d('0x13')]);return _0xa0d838(_0x3a8b31[_0x674d('0x12')]['message']);}else{logger[_0x674d('0xc')](_0x674d('0xd'),_0x191cfa,_0x674d('0xe'));_0xa0d838(_0x3a8b31[_0x674d('0x14')][_0x674d('0x13')]);}})[_0x674d('0x15')](function(_0x35fa6e){logger[_0x674d('0x12')](_0x674d('0xd'),_0x191cfa,_0x35fa6e);_0x8615fb(_0x35fa6e);});});} \ No newline at end of file +var _0xeb74=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x4643ae,_0x588d99){var _0x59ccef=function(_0x41879c){while(--_0x41879c){_0x4643ae['push'](_0x4643ae['shift']());}};_0x59ccef(++_0x588d99);}(_0xeb74,0xe3));var _0x4eb7=function(_0x5725d6,_0xa898cc){_0x5725d6=_0x5725d6-0x0;var _0x1d92ce=_0xeb74[_0x5725d6];return _0x1d92ce;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rs=require(_0x4eb7('0x4'));var fs=require('fs');var Redis=require(_0x4eb7('0x5'));var db=require(_0x4eb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var config=require(_0x4eb7('0x9'));var jayson=require(_0x4eb7('0xa'));var client=jayson[_0x4eb7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3986cd,_0x54859c,_0xcac7c5){return new BPromise(function(_0x2cffe7,_0x588a1c){return client['request'](_0x3986cd,_0xcac7c5)[_0x4eb7('0xc')](function(_0x2f8296){logger['info'](_0x4eb7('0xd'),_0x54859c,'request\x20sent');logger[_0x4eb7('0xe')](_0x4eb7('0xf'),_0x54859c,_0x4eb7('0x10'),JSON['stringify'](_0x2f8296));if(_0x2f8296[_0x4eb7('0x11')]){if(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x12')]===0x1f4){logger[_0x4eb7('0x11')](_0x4eb7('0xd'),_0x54859c,_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);return _0x588a1c(_0x2f8296['error']['message']);}logger['error'](_0x4eb7('0xd'),_0x54859c,_0x2f8296['error'][_0x4eb7('0x13')]);return _0x2cffe7(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);}else{logger[_0x4eb7('0x14')](_0x4eb7('0xd'),_0x54859c,_0x4eb7('0x10'));_0x2cffe7(_0x2f8296[_0x4eb7('0x15')][_0x4eb7('0x13')]);}})[_0x4eb7('0x16')](function(_0x17377f){logger['error'](_0x4eb7('0xd'),_0x54859c,_0x17377f);_0x588a1c(_0x17377f);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index fdfdf00..04fb3a4 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 _0xdbf5=['post','put','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x585b6c,_0x32e3d1){var _0xf20521=function(_0x24a1b7){while(--_0x24a1b7){_0x585b6c['push'](_0x585b6c['shift']());}};_0xf20521(++_0x32e3d1);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x1750ea,_0x28bbb6){_0x1750ea=_0x1750ea-0x0;var _0x56ac1b=_0xdbf5[_0x1750ea];return _0x56ac1b;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')](_0x5dbf('0x9'),auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xb')]);router[_0x5dbf('0xc')]('/',auth[_0x5dbf('0xa')](),controller['create']);router[_0x5dbf('0xd')]('/:id',auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xe')]);router[_0x5dbf('0xf')](_0x5dbf('0x9'),auth['isAuthenticated'](),controller[_0x5dbf('0x10')]);module['exports']=router; \ No newline at end of file +var _0xfdbd=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','/:id','isAuthenticated'];(function(_0x13af36,_0x49bca3){var _0x51e020=function(_0x3e2029){while(--_0x3e2029){_0x13af36['push'](_0x13af36['shift']());}};_0x51e020(++_0x49bca3);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x3da707,_0x30c36d){_0x3da707=_0x3da707-0x0;var _0x342ee7=_0xfdbd[_0x3da707];return _0x342ee7;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get'](_0xdfdb('0xa'),auth[_0xdfdb('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id',auth[_0xdfdb('0xb')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xf')](_0xdfdb('0xa'),auth[_0xdfdb('0xb')](),controller[_0xdfdb('0x10')]);module[_0xdfdb('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 8ad4918..b25fefe 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 _0x0fbd=['beepall','roundrobin','sequelize','STRING','name','rrmemory'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x0fbd,0x1e2));var _0xd0fb=function(_0x1dfd4a,_0x5d4c67){_0x1dfd4a=_0x1dfd4a-0x0;var _0xf7510b=_0x0fbd[_0x1dfd4a];return _0xf7510b;};'use strict';var Sequelize=require(_0xd0fb('0x0'));module['exports']={'name':{'type':Sequelize[_0xd0fb('0x1')],'unique':_0xd0fb('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd0fb('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd0fb('0x3'),_0xd0fb('0x4'),_0xd0fb('0x5'))}}; \ No newline at end of file +var _0xba52=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0xba52,0x1c0));var _0x2ba5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xba52[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x2ba5('0x0'));module[_0x2ba5('0x1')]={'name':{'type':Sequelize[_0x2ba5('0x2')],'unique':_0x2ba5('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2ba5('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2ba5('0x4')](_0x2ba5('0x5'),_0x2ba5('0x6'),_0x2ba5('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index e5389b3..1353c75 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 _0x165f=['api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','update','then','destroy','ChatQueues','UserProfileResource','error','stack','name','send','index','ChatQueue','rawAttributes','fieldName','type','key','getOptions','include','findAll','rows','catch','show','params','keys','query','filters','intersection','attributes','model','fields','length','includeAll','merge','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','sort','pick','ChatQueueId','filter','where','map','User','findAndCountAll','UserId','agent','chatPause','updatedAt','format','SIP','createdAt','getTeams','Team','order','addTeams','ids','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','Agents','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0x375129,_0x127523){var _0x27bc6a=function(_0x34fbb3){while(--_0x34fbb3){_0x375129['push'](_0x375129['shift']());}};_0x27bc6a(++_0x127523);}(_0x165f,0x1f1));var _0xf165=function(_0x11cd32,_0x167c1f){_0x11cd32=_0x11cd32-0x0;var _0x5e9bd2=_0x165f[_0x11cd32];return _0x5e9bd2;};'use strict';var BPromise=require(_0xf165('0x0'));var util=require(_0xf165('0x1'));var _=require(_0xf165('0x2'));var squel=require(_0xf165('0x3'));var Redis=require(_0xf165('0x4'));var qs=require(_0xf165('0x5'));var logger=require(_0xf165('0x6'))(_0xf165('0x7'));var config=require(_0xf165('0x8'));var db=require(_0xf165('0x9'))['db'];config[_0xf165('0xa')]=_['defaults'](config[_0xf165('0xa')],{'host':_0xf165('0xb'),'port':0x18eb});var socket=require(_0xf165('0xc'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xf165('0xd')](socket);function respondWithStatusCode(_0x4c3cd7,_0x339f74){_0x339f74=_0x339f74||0xcc;return function(_0x3a64ba){if(_0x3a64ba){return _0x4c3cd7[_0xf165('0xe')](_0x339f74);}return _0x4c3cd7[_0xf165('0xf')](_0x339f74)[_0xf165('0x10')]();};}function respondWithResult(_0x2fe221,_0x20ca62){_0x20ca62=_0x20ca62||0xc8;return function(_0x5ac3fe){if(_0x5ac3fe){return _0x2fe221[_0xf165('0xf')](_0x20ca62)[_0xf165('0x11')](_0x5ac3fe);}};}function respondWithFilteredResult(_0x46586b,_0x20f7d5){return function(_0x1090a6){if(_0x1090a6){var _0x3513ec=typeof _0x20f7d5['offset']===_0xf165('0x12')&&typeof _0x20f7d5['limit']==='undefined';var _0x179dc7=_0x1090a6[_0xf165('0x13')];var _0x267d32=_0x3513ec?0x0:_0x20f7d5[_0xf165('0x14')];var _0x3a7a76=_0x3513ec?_0x1090a6['count']:_0x20f7d5[_0xf165('0x14')]+_0x20f7d5[_0xf165('0x15')];var _0x117966;if(_0x3a7a76>=_0x179dc7){_0x3a7a76=_0x179dc7;_0x117966=0xc8;}else{_0x117966=0xce;}_0x46586b[_0xf165('0xf')](_0x117966);return _0x46586b['set'](_0xf165('0x16'),_0x267d32+'-'+_0x3a7a76+'/'+_0x179dc7)['json'](_0x1090a6);}return null;};}function saveUpdates(_0x4f427b){return function(_0x3275c0){if(_0x3275c0){return _0x3275c0[_0xf165('0x17')](_0x4f427b)[_0xf165('0x18')](function(_0x5c61bb){return _0x5c61bb;});}return null;};}function removeEntity(_0x4ca6d9){return function(_0x59cf61){if(_0x59cf61){return _0x59cf61[_0xf165('0x19')]()[_0xf165('0x18')](function(){var _0x545a63=_0x59cf61['get']({'plain':!![]});var _0x5a9d93=_0xf165('0x1a');return db[_0xf165('0x1b')][_0xf165('0x19')]({'where':{'type':_0x5a9d93,'resourceId':_0x545a63['id']}})[_0xf165('0x18')](function(){return _0x59cf61;});})[_0xf165('0x18')](function(){_0x4ca6d9[_0xf165('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e135d){return function(_0x13fbde){if(!_0x13fbde){_0x2e135d['sendStatus'](0x194);}return _0x13fbde;};}function handleError(_0x1aafdb,_0x39c052){_0x39c052=_0x39c052||0x1f4;return function(_0x159a29){logger[_0xf165('0x1c')](_0x159a29[_0xf165('0x1d')]);if(_0x159a29[_0xf165('0x1e')]){delete _0x159a29[_0xf165('0x1e')];}_0x1aafdb[_0xf165('0xf')](_0x39c052)[_0xf165('0x1f')](_0x159a29);};}exports[_0xf165('0x20')]=function(_0x330783,_0x22a062){var _0x5dd75f={};var _0x519e4b={'count':0x0,'rows':[]};var _0x58350f=_['map'](db[_0xf165('0x21')][_0xf165('0x22')],function(_0x52b41d){return{'name':_0x52b41d[_0xf165('0x23')],'type':_0x52b41d[_0xf165('0x24')][_0xf165('0x25')]};});_0x5dd75f=qs[_0xf165('0x26')](_0x58350f,_0x330783);var _0x2de644={'where':_0x5dd75f['where']};return db['ChatQueue']['count'](_0x2de644)[_0xf165('0x18')](function(_0x26cda1){_0x519e4b['count']=_0x26cda1;_0x5dd75f[_0xf165('0x27')]=qs[_0xf165('0x27')](_0x330783['query']);return db[_0xf165('0x21')][_0xf165('0x28')](_0x5dd75f);})[_0xf165('0x18')](function(_0x5ce026){_0x519e4b[_0xf165('0x29')]=_0x5ce026;return _0x519e4b;})[_0xf165('0x18')](respondWithFilteredResult(_0x22a062,_0x5dd75f))[_0xf165('0x2a')](handleError(_0x22a062,null));};exports[_0xf165('0x2b')]=function(_0x485877,_0x27a1e6){var _0x2f9123={'raw':!![],'where':{'id':_0x485877[_0xf165('0x2c')]['id']}},_0x304328={};_0x304328['model']=_[_0xf165('0x2d')](db['ChatQueue'][_0xf165('0x22')]);_0x304328[_0xf165('0x2e')]=_[_0xf165('0x2d')](_0x485877['query']);_0x304328[_0xf165('0x2f')]=_[_0xf165('0x30')](_0x304328['model'],_0x304328[_0xf165('0x2e')]);_0x2f9123[_0xf165('0x31')]=_['intersection'](_0x304328[_0xf165('0x32')],qs[_0xf165('0x33')](_0x485877[_0xf165('0x2e')]['fields']));_0x2f9123[_0xf165('0x31')]=_0x2f9123[_0xf165('0x31')][_0xf165('0x34')]?_0x2f9123[_0xf165('0x31')]:_0x304328[_0xf165('0x32')];if(_0x485877['query'][_0xf165('0x35')]){_0x2f9123[_0xf165('0x27')]=[{'all':!![]}];}_0x2f9123=_[_0xf165('0x36')]({},_0x2f9123,_0x485877[_0xf165('0x37')]);return db[_0xf165('0x21')][_0xf165('0x38')](_0x2f9123)[_0xf165('0x18')](handleEntityNotFound(_0x27a1e6,null))[_0xf165('0x18')](respondWithResult(_0x27a1e6,null))[_0xf165('0x2a')](handleError(_0x27a1e6,null));};exports[_0xf165('0x39')]=function(_0x5a8b28,_0x2ff3b7){return db[_0xf165('0x21')]['create'](_0x5a8b28['body'],{})[_0xf165('0x18')](function(_0x35f39a){var _0x32070d=_0x5a8b28[_0xf165('0x3a')][_0xf165('0x3b')]({'plain':!![]});if(!_0x32070d)throw new Error(_0xf165('0x3c'));if(_0x32070d['role']===_0xf165('0x3a')){var _0xf62450=_0x35f39a[_0xf165('0x3b')]({'plain':!![]});var _0x151682=_0xf165('0x1a');return db['UserProfileSection'][_0xf165('0x38')]({'where':{'name':_0x151682,'userProfileId':_0x32070d[_0xf165('0x3d')]},'raw':!![]})[_0xf165('0x18')](function(_0x3c87c9){if(_0x3c87c9&&_0x3c87c9[_0xf165('0x3e')]===0x0){return db[_0xf165('0x1b')]['create']({'name':_0xf62450[_0xf165('0x1e')],'resourceId':_0xf62450['id'],'type':_0x3c87c9[_0xf165('0x1e')],'sectionId':_0x3c87c9['id']},{})[_0xf165('0x18')](function(){return _0x35f39a;});}else{return _0x35f39a;}})[_0xf165('0x2a')](function(_0x5cc693){logger[_0xf165('0x1c')](_0xf165('0x3f'),_0x5cc693);throw _0x5cc693;});}return _0x35f39a;})[_0xf165('0x18')](respondWithResult(_0x2ff3b7,0xc9))[_0xf165('0x2a')](handleError(_0x2ff3b7,null));};exports['update']=function(_0x4e04b7,_0x7b7fc8){if(_0x4e04b7[_0xf165('0x40')]['id']){delete _0x4e04b7[_0xf165('0x40')]['id'];}return db[_0xf165('0x21')][_0xf165('0x38')]({'where':{'id':_0x4e04b7[_0xf165('0x2c')]['id']}})['then'](handleEntityNotFound(_0x7b7fc8,null))['then'](saveUpdates(_0x4e04b7['body'],null))['then'](respondWithResult(_0x7b7fc8,null))['catch'](handleError(_0x7b7fc8,null));};exports[_0xf165('0x19')]=function(_0x2420bb,_0x50e9b6){return db[_0xf165('0x21')]['find']({'where':{'id':_0x2420bb[_0xf165('0x2c')]['id']}})['then'](handleEntityNotFound(_0x50e9b6,null))[_0xf165('0x18')](removeEntity(_0x50e9b6,null))[_0xf165('0x2a')](handleError(_0x50e9b6,null));};exports[_0xf165('0x41')]=function(_0x404575,_0x544703){return db[_0xf165('0x21')]['describe']()[_0xf165('0x18')](respondWithResult(_0x544703,null))[_0xf165('0x2a')](handleError(_0x544703,null));};exports[_0xf165('0x42')]=function(_0x8f5553,_0x5f2af0){var _0x529a5a={'raw':!![],'where':{}},_0x26860e={},_0x26222e;return db[_0xf165('0x21')][_0xf165('0x43')]({'where':{'id':_0x8f5553[_0xf165('0x2c')]['id']}})[_0xf165('0x18')](handleEntityNotFound(_0x5f2af0,null))[_0xf165('0x18')](function(_0x250bcb){if(_0x250bcb){_0x26222e=_0x250bcb[_0xf165('0x3b')]({'plain':!![]});_0x26860e[_0xf165('0x32')]=_[_0xf165('0x2d')](db[_0xf165('0x44')][_0xf165('0x22')]);_0x26860e[_0xf165('0x2e')]=_[_0xf165('0x2d')](_0x8f5553[_0xf165('0x2e')]);_0x26860e[_0xf165('0x2f')]=_[_0xf165('0x30')](_0x26860e['model'],_0x26860e[_0xf165('0x2e')]);_0x529a5a[_0xf165('0x31')]=_[_0xf165('0x30')](_0x26860e[_0xf165('0x32')],qs['fields'](_0x8f5553[_0xf165('0x2e')][_0xf165('0x33')]));_0x529a5a['attributes']=_0x529a5a[_0xf165('0x31')][_0xf165('0x34')]?_0x529a5a[_0xf165('0x31')]:_0x26860e[_0xf165('0x32')];if(!_0x8f5553[_0xf165('0x2e')][_0xf165('0x45')](_0xf165('0x46'))){_0x529a5a[_0xf165('0x15')]=qs[_0xf165('0x15')](_0x8f5553['query'][_0xf165('0x15')]);_0x529a5a[_0xf165('0x14')]=qs[_0xf165('0x14')](_0x8f5553[_0xf165('0x2e')][_0xf165('0x14')]);}_0x529a5a['order']=qs[_0xf165('0x47')](_0x8f5553[_0xf165('0x2e')][_0xf165('0x47')]);_0x529a5a['where']=qs['filters'](_[_0xf165('0x48')](_0x8f5553[_0xf165('0x2e')],_0x26860e[_0xf165('0x2f')]));_0x529a5a['where'][_0xf165('0x49')]=_0x250bcb['id'];if(_0x8f5553['query'][_0xf165('0x4a')]){_0x529a5a[_0xf165('0x4b')]=_[_0xf165('0x36')](_0x529a5a[_0xf165('0x4b')],{'$or':_[_0xf165('0x4c')](_0x529a5a[_0xf165('0x31')],function(_0x1240d9){var _0x4191be={};_0x4191be[_0x1240d9]={'$like':'%'+_0x8f5553[_0xf165('0x2e')][_0xf165('0x4a')]+'%'};return _0x4191be;})});}_0x529a5a=_[_0xf165('0x36')]({},_0x529a5a,_0x8f5553['options']);return db[_0xf165('0x44')][_0xf165('0x28')](_0x529a5a);}})[_0xf165('0x18')](function(_0x379b41){if(_0x379b41){return db[_0xf165('0x4d')][_0xf165('0x4e')]({'where':{'id':_['map'](_0x379b41,_0xf165('0x4f')),'role':_0xf165('0x50')},'attributes':['id',_0xf165('0x1e'),_0xf165('0x51'),_0xf165('0x52'),'createdAt']});}})[_0xf165('0x18')](function(_0x554e32){if(_0x554e32){return{'count':_0x554e32[_0xf165('0x13')],'rows':_[_0xf165('0x4c')](_0x554e32[_0xf165('0x29')],function(_0x153e7d){return{'membername':_0x153e7d[_0xf165('0x1e')],'UserId':_0x153e7d['id'],'queue_name':_0x26222e[_0xf165('0x1e')],'ChatQueueId':_0x26222e['id'],'interface':util[_0xf165('0x53')]('%s/%s',_0xf165('0x54'),_0x153e7d['name']),'penalty':0x0,'paused':_0x153e7d[_0xf165('0x51')],'createdAt':_0x153e7d[_0xf165('0x55')],'updatedAt':_0x153e7d[_0xf165('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf165('0x18')](respondWithFilteredResult(_0x5f2af0,_0x529a5a))['catch'](handleError(_0x5f2af0,null));};exports[_0xf165('0x56')]=function(_0x5523c7,_0x47fa62){var _0xb7ad3={};var _0x432eca={};var _0x152f25;var _0x418c79;return db[_0xf165('0x21')]['findOne']({'where':{'id':_0x5523c7['params']['id']}})[_0xf165('0x18')](handleEntityNotFound(_0x47fa62,null))[_0xf165('0x18')](function(_0x5a4885){if(_0x5a4885){_0x152f25=_0x5a4885;_0x432eca[_0xf165('0x32')]=_[_0xf165('0x2d')](db[_0xf165('0x57')][_0xf165('0x22')]);_0x432eca[_0xf165('0x2e')]=_[_0xf165('0x2d')](_0x5523c7[_0xf165('0x2e')]);_0x432eca['filters']=_['intersection'](_0x432eca['model'],_0x432eca[_0xf165('0x2e')]);_0xb7ad3['attributes']=_['intersection'](_0x432eca[_0xf165('0x32')],qs[_0xf165('0x33')](_0x5523c7[_0xf165('0x2e')][_0xf165('0x33')]));_0xb7ad3['attributes']=_0xb7ad3[_0xf165('0x31')][_0xf165('0x34')]?_0xb7ad3['attributes']:_0x432eca[_0xf165('0x32')];_0xb7ad3[_0xf165('0x58')]=qs[_0xf165('0x47')](_0x5523c7[_0xf165('0x2e')][_0xf165('0x47')]);_0xb7ad3[_0xf165('0x4b')]=qs[_0xf165('0x2f')](_[_0xf165('0x48')](_0x5523c7['query'],_0x432eca[_0xf165('0x2f')]));if(_0x5523c7['query'][_0xf165('0x4a')]){_0xb7ad3[_0xf165('0x4b')]=_[_0xf165('0x36')](_0xb7ad3['where'],{'$or':_[_0xf165('0x4c')](_0xb7ad3[_0xf165('0x31')],function(_0x32d94f){var _0xf1658c={};_0xf1658c[_0x32d94f]={'$like':'%'+_0x5523c7[_0xf165('0x2e')][_0xf165('0x4a')]+'%'};return _0xf1658c;})});}_0xb7ad3=_[_0xf165('0x36')]({},_0xb7ad3,_0x5523c7['options']);return _0x152f25['getTeams'](_0xb7ad3);}})[_0xf165('0x18')](function(_0x5dd0f0){if(_0x5dd0f0){_0x418c79=_0x5dd0f0[_0xf165('0x34')];if(!_0x5523c7['query'][_0xf165('0x45')](_0xf165('0x46'))){_0xb7ad3[_0xf165('0x15')]=qs[_0xf165('0x15')](_0x5523c7[_0xf165('0x2e')][_0xf165('0x15')]);_0xb7ad3[_0xf165('0x14')]=qs[_0xf165('0x14')](_0x5523c7[_0xf165('0x2e')][_0xf165('0x14')]);}return _0x152f25[_0xf165('0x56')](_0xb7ad3);}})[_0xf165('0x18')](function(_0x1e03f1){if(_0x1e03f1){return _0x1e03f1?{'count':_0x418c79,'rows':_0x1e03f1}:null;}})[_0xf165('0x18')](respondWithResult(_0x47fa62,null))['catch'](handleError(_0x47fa62,null));};exports[_0xf165('0x59')]=function(_0x244653,_0x1ba891){var _0x4337ab=_0x244653[_0xf165('0x40')][_0xf165('0x5a')];return db[_0xf165('0x57')][_0xf165('0x28')]({'where':{'id':_0x4337ab},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xf165('0x1e'),_0xf165('0x5b'),_0xf165('0x5c'),_0xf165('0x5d')],'raw':!![]}]})[_0xf165('0x18')](function(_0x1ed118){if(_0x1ed118){var _0x5f07b3=_['flatMap'](_0x1ed118,function(_0x362501){var _0x104f56=_0x362501['get']({'plain':!![]});return _0x104f56['Agents'];});return db[_0xf165('0x21')]['find']({'where':{'id':_0x244653[_0xf165('0x2c')]['id']}})[_0xf165('0x18')](function(_0x1cc3de){return db[_0xf165('0x5e')][_0xf165('0x5f')](function(_0x552527){return _0x1cc3de[_0xf165('0x59')](_0x4337ab,{'transaction':_0x552527})[_0xf165('0x18')](function(){return BPromise[_0xf165('0x60')](_0x5f07b3,function(_0x4605d6){return db[_0xf165('0x44')][_0xf165('0x61')]({'where':{'UserId':_0x4605d6['id'],'ChatQueueId':_0x244653[_0xf165('0x2c')]['id']},'transaction':_0x552527});});})[_0xf165('0x18')](function(){_0x5f07b3[_0xf165('0x62')](function(_0x6a931b){socket[_0xf165('0x63')](_0xf165('0x64'),{'UserId':_0x6a931b['id'],'ChatQueueId':_0x1cc3de['id']});});});});});}})[_0xf165('0x18')](respondWithStatusCode(_0x1ba891,null))['catch'](handleError(_0x1ba891,null));};exports[_0xf165('0x65')]=function(_0x3bd74d,_0x28a24d){return db[_0xf165('0x57')]['findAll']({'where':{'id':_0x3bd74d[_0xf165('0x2e')][_0xf165('0x5a')]},'attributes':['id'],'include':[{'model':db[_0xf165('0x4d')],'as':_0xf165('0x66'),'attributes':['id'],'raw':!![]}]})[_0xf165('0x18')](handleEntityNotFound(_0x28a24d,null))[_0xf165('0x18')](function(_0x4a72b6){var _0x3521fb=_[_0xf165('0x4c')](_0x4a72b6,'id');var _0x2dadac=[];var _0x5b10fb=[];var _0x193df8=squel['select']();_0x193df8[_0xf165('0x67')](_0xf165('0x68'))['from'](_0xf165('0x69'),'tq')[_0xf165('0x6a')](_0xf165('0x6b'),'ut',_0xf165('0x6c'))[_0xf165('0x4b')]('ChatQueueId\x20=\x20?',_0x3bd74d[_0xf165('0x2c')]['id']);for(var _0x2c4f4b=0x0;_0x2c4f4b<_0x4a72b6[_0xf165('0x34')];_0x2c4f4b+=0x1){let _0x461b56=_0x4a72b6[_0x2c4f4b];for(var _0x305a19=0x0;_0x305a19<_0x461b56[_0xf165('0x66')][_0xf165('0x34')];_0x305a19+=0x1){let _0x3c0f6b=_0x461b56[_0xf165('0x66')][_0x305a19];var _0x292e0f=_0x193df8[_0xf165('0x6d')]();_0x292e0f[_0xf165('0x4b')]('ut.UserId\x20=\x20?',_0x3c0f6b['id']);_0x5b10fb[_0xf165('0x6e')](db['sequelize']['query'](_0x292e0f[_0xf165('0x6f')](),{'type':db[_0xf165('0x5e')][_0xf165('0x70')][_0xf165('0x71')]})['then'](function(_0x2854d3){if(_0x2854d3[_0xf165('0x34')]===0x1){return _0x3c0f6b['id'];}else{var _0xdfd4c8=_['every'](_[_0xf165('0x4c')](_0x2854d3,_0xf165('0x72')),function(_0x36c045){return _['includes'](_0x3521fb,_0x36c045);});if(_0xdfd4c8){return _0x3c0f6b['id'];}}}));}}return BPromise[_0xf165('0x73')](_0x5b10fb)[_0xf165('0x18')](function(_0x1a865b){_0x2dadac=_(_0x2dadac)[_0xf165('0x74')](_0x1a865b)[_0xf165('0x75')]()[_0xf165('0x76')]();return db[_0xf165('0x21')][_0xf165('0x38')]({'where':{'id':_0x3bd74d[_0xf165('0x2c')]['id']}})[_0xf165('0x18')](function(_0x22f7cd){return db[_0xf165('0x5e')][_0xf165('0x5f')](function(_0x36d0ea){return _0x22f7cd['removeTeams'](_0x3bd74d[_0xf165('0x2e')][_0xf165('0x5a')],{'transaction':_0x36d0ea})[_0xf165('0x18')](function(){if(!_[_0xf165('0x77')](_0x2dadac)){return _0x22f7cd[_0xf165('0x78')](_0x2dadac,{'transaction':_0x36d0ea});}})['then'](function(){_0x2dadac[_0xf165('0x62')](function(_0x1e74fb){socket[_0xf165('0x63')](_0xf165('0x79'),{'UserId':_0x1e74fb,'ChatQueueId':_0x22f7cd['id']});});});});});});})['then'](respondWithStatusCode(_0x28a24d,null))['catch'](handleError(_0x28a24d,null));};exports['addAgents']=function(_0x1840ed,_0x3983e6){return db['ChatQueue'][_0xf165('0x38')]({'where':{'id':_0x1840ed['params']['id']}})[_0xf165('0x18')](handleEntityNotFound(_0x3983e6,null))[_0xf165('0x18')](function(_0xf55cc1){if(_0xf55cc1){return _0xf55cc1[_0xf165('0x7a')](_0x1840ed[_0xf165('0x40')][_0xf165('0x5a')],_['omit'](_0x1840ed[_0xf165('0x40')],['ids','id'])||{})[_0xf165('0x7b')](function(_0x89b04d){for(var _0x1929d0=0x0;_0x1929d0<_0x1840ed[_0xf165('0x40')][_0xf165('0x5a')][_0xf165('0x34')];_0x1929d0+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x1840ed[_0xf165('0x40')]['ids'][_0x1929d0]),'ChatQueueId':Number(_0x1840ed['params']['id'])});}return _0x89b04d;});}})[_0xf165('0x18')](respondWithResult(_0x3983e6,null))[_0xf165('0x2a')](handleError(_0x3983e6,null));};exports[_0xf165('0x78')]=function(_0x36b2c1,_0x44bbf3){return db[_0xf165('0x21')][_0xf165('0x38')]({'where':{'id':_0x36b2c1[_0xf165('0x2c')]['id']}})['then'](handleEntityNotFound(_0x44bbf3,null))['then'](function(_0x38f64c){if(_0x38f64c){return _0x38f64c['removeAgents'](_0x36b2c1['query'][_0xf165('0x5a')])[_0xf165('0x18')](function(){if(_[_0xf165('0x7c')](_0x36b2c1['query'][_0xf165('0x5a')])){for(var _0x20587b=0x0;_0x20587b<_0x36b2c1[_0xf165('0x2e')][_0xf165('0x5a')][_0xf165('0x34')];_0x20587b+=0x1){socket['emit'](_0xf165('0x79'),{'UserId':Number(_0x36b2c1[_0xf165('0x2e')][_0xf165('0x5a')][_0x20587b]),'ChatQueueId':Number(_0x36b2c1[_0xf165('0x2c')]['id'])});}}else{socket['emit'](_0xf165('0x79'),{'UserId':Number(_0x36b2c1[_0xf165('0x2e')]['ids']),'ChatQueueId':Number(_0x36b2c1[_0xf165('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x44bbf3,null))[_0xf165('0x2a')](handleError(_0x44bbf3,null));};exports['getAgents']=function(_0x2a26cf,_0x33cdbf){var _0x419f89={};var _0x3d2251={};var _0x49b8be;var _0x444111;return db[_0xf165('0x21')][_0xf165('0x43')]({'where':{'id':_0x2a26cf[_0xf165('0x2c')]['id']}})['then'](handleEntityNotFound(_0x33cdbf,null))[_0xf165('0x18')](function(_0x10410b){if(_0x10410b){_0x49b8be=_0x10410b;_0x3d2251[_0xf165('0x32')]=_[_0xf165('0x2d')](db['User'][_0xf165('0x22')]);_0x3d2251['query']=_['keys'](_0x2a26cf[_0xf165('0x2e')]);_0x3d2251[_0xf165('0x2f')]=_[_0xf165('0x30')](_0x3d2251['model'],_0x3d2251['query']);_0x419f89[_0xf165('0x31')]=_[_0xf165('0x30')](_0x3d2251[_0xf165('0x32')],qs[_0xf165('0x33')](_0x2a26cf['query'][_0xf165('0x33')]));_0x419f89['attributes']=_0x419f89[_0xf165('0x31')][_0xf165('0x34')]?_0x419f89[_0xf165('0x31')]:_0x3d2251['model'];_0x419f89[_0xf165('0x58')]=qs[_0xf165('0x47')](_0x2a26cf['query'][_0xf165('0x47')]);_0x419f89[_0xf165('0x4b')]=qs[_0xf165('0x2f')](_[_0xf165('0x48')](_0x2a26cf[_0xf165('0x2e')],_0x3d2251[_0xf165('0x2f')]));if(_0x2a26cf[_0xf165('0x2e')][_0xf165('0x4a')]){_0x419f89[_0xf165('0x4b')]=_[_0xf165('0x36')](_0x419f89[_0xf165('0x4b')],{'$or':_['map'](_0x419f89['attributes'],function(_0xa9b91e){var _0x5eac94={};_0x5eac94[_0xa9b91e]={'$like':'%'+_0x2a26cf[_0xf165('0x2e')]['filter']+'%'};return _0x5eac94;})});}_0x419f89=_['merge']({},_0x419f89,_0x2a26cf[_0xf165('0x37')]);return _0x49b8be[_0xf165('0x7d')](_0x419f89);}})[_0xf165('0x18')](function(_0x33891b){if(_0x33891b){_0x444111=_0x33891b[_0xf165('0x34')];if(!_0x2a26cf['query'][_0xf165('0x45')](_0xf165('0x46'))){_0x419f89['limit']=qs[_0xf165('0x15')](_0x2a26cf[_0xf165('0x2e')]['limit']);_0x419f89['offset']=qs[_0xf165('0x14')](_0x2a26cf[_0xf165('0x2e')]['offset']);}return _0x49b8be[_0xf165('0x7d')](_0x419f89);}})['then'](function(_0x4e6ee7){if(_0x4e6ee7){return _0x4e6ee7?{'count':_0x444111,'rows':_0x4e6ee7}:null;}})[_0xf165('0x18')](respondWithResult(_0x33cdbf,null))[_0xf165('0x2a')](handleError(_0x33cdbf,null));}; \ No newline at end of file +var _0x815d=['error','stack','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','intersection','attributes','includeAll','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','filters','fields','hasOwnProperty','nolimit','sort','pick','filter','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','getTeams','order','addTeams','ids','Team','Agents','voicePause','flatMap','sequelize','each','findOrCreate','userChatQueue:save','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','length','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','transaction','removeTeams','removeAgents','forEach','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','ChatQueues','UserProfileResource'];(function(_0x4b26a9,_0x37ad1){var _0x1ddf55=function(_0x5e52d7){while(--_0x5e52d7){_0x4b26a9['push'](_0x4b26a9['shift']());}};_0x1ddf55(++_0x37ad1);}(_0x815d,0x1c4));var _0xd815=function(_0x2f4859,_0x1b0f9c){_0x2f4859=_0x2f4859-0x0;var _0x25508f=_0x815d[_0x2f4859];return _0x25508f;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xd815('0x0'));var squel=require('squel');var Redis=require(_0xd815('0x1'));var qs=require(_0xd815('0x2'));var logger=require(_0xd815('0x3'))('api');var config=require(_0xd815('0x4'));var db=require(_0xd815('0x5'))['db'];config['redis']=_[_0xd815('0x6')](config[_0xd815('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd815('0x7')]));require('./chatQueue.socket')[_0xd815('0x8')](socket);function respondWithStatusCode(_0x4ec162,_0x3eb0b4){_0x3eb0b4=_0x3eb0b4||0xcc;return function(_0x5c3654){if(_0x5c3654){return _0x4ec162[_0xd815('0x9')](_0x3eb0b4);}return _0x4ec162[_0xd815('0xa')](_0x3eb0b4)[_0xd815('0xb')]();};}function respondWithResult(_0x3b6e30,_0x46fd87){_0x46fd87=_0x46fd87||0xc8;return function(_0x1538e9){if(_0x1538e9){return _0x3b6e30[_0xd815('0xa')](_0x46fd87)[_0xd815('0xc')](_0x1538e9);}};}function respondWithFilteredResult(_0x23b4e9,_0x8ac699){return function(_0x5a38f4){if(_0x5a38f4){var _0x1c1363=typeof _0x8ac699[_0xd815('0xd')]===_0xd815('0xe')&&typeof _0x8ac699[_0xd815('0xf')]===_0xd815('0xe');var _0x5266b8=_0x5a38f4[_0xd815('0x10')];var _0x236289=_0x1c1363?0x0:_0x8ac699[_0xd815('0xd')];var _0x54dbd0=_0x1c1363?_0x5a38f4['count']:_0x8ac699['offset']+_0x8ac699[_0xd815('0xf')];var _0x3894ee;if(_0x54dbd0>=_0x5266b8){_0x54dbd0=_0x5266b8;_0x3894ee=0xc8;}else{_0x3894ee=0xce;}_0x23b4e9[_0xd815('0xa')](_0x3894ee);return _0x23b4e9[_0xd815('0x11')](_0xd815('0x12'),_0x236289+'-'+_0x54dbd0+'/'+_0x5266b8)['json'](_0x5a38f4);}return null;};}function saveUpdates(_0x213330){return function(_0x37b6bc){if(_0x37b6bc){return _0x37b6bc[_0xd815('0x13')](_0x213330)[_0xd815('0x14')](function(_0x2a3e87){return _0x2a3e87;});}return null;};}function removeEntity(_0x5449b5){return function(_0x4049b4){if(_0x4049b4){return _0x4049b4[_0xd815('0x15')]()[_0xd815('0x14')](function(){var _0x37807b=_0x4049b4['get']({'plain':!![]});var _0x532237=_0xd815('0x16');return db[_0xd815('0x17')][_0xd815('0x15')]({'where':{'type':_0x532237,'resourceId':_0x37807b['id']}})[_0xd815('0x14')](function(){return _0x4049b4;});})['then'](function(){_0x5449b5[_0xd815('0xa')](0xcc)[_0xd815('0xb')]();});}};}function handleEntityNotFound(_0x5980ed){return function(_0x78f19d){if(!_0x78f19d){_0x5980ed[_0xd815('0x9')](0x194);}return _0x78f19d;};}function handleError(_0xcd7d4d,_0x2c6622){_0x2c6622=_0x2c6622||0x1f4;return function(_0x40f184){logger[_0xd815('0x18')](_0x40f184[_0xd815('0x19')]);if(_0x40f184[_0xd815('0x1a')]){delete _0x40f184[_0xd815('0x1a')];}_0xcd7d4d['status'](_0x2c6622)['send'](_0x40f184);};}exports[_0xd815('0x1b')]=function(_0x4f1d54,_0x976f47){var _0x27507d={};var _0xbdd7e2={'count':0x0,'rows':[]};var _0xbbcd13=_[_0xd815('0x1c')](db[_0xd815('0x1d')][_0xd815('0x1e')],function(_0xef4ca8){return{'name':_0xef4ca8[_0xd815('0x1f')],'type':_0xef4ca8[_0xd815('0x20')][_0xd815('0x21')]};});_0x27507d=qs[_0xd815('0x22')](_0xbbcd13,_0x4f1d54);var _0x1d162f={'where':_0x27507d[_0xd815('0x23')]};return db[_0xd815('0x1d')][_0xd815('0x10')](_0x1d162f)[_0xd815('0x14')](function(_0x54daf4){_0xbdd7e2['count']=_0x54daf4;_0x27507d[_0xd815('0x24')]=qs[_0xd815('0x24')](_0x4f1d54[_0xd815('0x25')]);return db[_0xd815('0x1d')][_0xd815('0x26')](_0x27507d);})['then'](function(_0x391a4a){_0xbdd7e2[_0xd815('0x27')]=_0x391a4a;return _0xbdd7e2;})[_0xd815('0x14')](respondWithFilteredResult(_0x976f47,_0x27507d))[_0xd815('0x28')](handleError(_0x976f47,null));};exports[_0xd815('0x29')]=function(_0x5ac552,_0x2faa5a){var _0x43db6b={'raw':!![],'where':{'id':_0x5ac552[_0xd815('0x2a')]['id']}},_0x3aab98={};_0x3aab98[_0xd815('0x2b')]=_['keys'](db['ChatQueue'][_0xd815('0x1e')]);_0x3aab98[_0xd815('0x25')]=_[_0xd815('0x2c')](_0x5ac552[_0xd815('0x25')]);_0x3aab98['filters']=_[_0xd815('0x2d')](_0x3aab98['model'],_0x3aab98[_0xd815('0x25')]);_0x43db6b[_0xd815('0x2e')]=_['intersection'](_0x3aab98[_0xd815('0x2b')],qs['fields'](_0x5ac552[_0xd815('0x25')]['fields']));_0x43db6b[_0xd815('0x2e')]=_0x43db6b[_0xd815('0x2e')]['length']?_0x43db6b[_0xd815('0x2e')]:_0x3aab98[_0xd815('0x2b')];if(_0x5ac552[_0xd815('0x25')][_0xd815('0x2f')]){_0x43db6b['include']=[{'all':!![]}];}_0x43db6b=_[_0xd815('0x30')]({},_0x43db6b,_0x5ac552[_0xd815('0x31')]);return db[_0xd815('0x1d')][_0xd815('0x32')](_0x43db6b)[_0xd815('0x14')](handleEntityNotFound(_0x2faa5a,null))['then'](respondWithResult(_0x2faa5a,null))[_0xd815('0x28')](handleError(_0x2faa5a,null));};exports[_0xd815('0x33')]=function(_0x18d6ee,_0xc318da){return db[_0xd815('0x1d')][_0xd815('0x33')](_0x18d6ee[_0xd815('0x34')],{})['then'](function(_0x18f9d9){var _0x5e1727=_0x18d6ee[_0xd815('0x35')][_0xd815('0x36')]({'plain':!![]});if(!_0x5e1727)throw new Error(_0xd815('0x37'));if(_0x5e1727[_0xd815('0x38')]==='user'){var _0xb91835=_0x18f9d9[_0xd815('0x36')]({'plain':!![]});var _0x41770b=_0xd815('0x16');return db[_0xd815('0x39')][_0xd815('0x32')]({'where':{'name':_0x41770b,'userProfileId':_0x5e1727['userProfileId']},'raw':!![]})[_0xd815('0x14')](function(_0x348591){if(_0x348591&&_0x348591[_0xd815('0x3a')]===0x0){return db[_0xd815('0x17')][_0xd815('0x33')]({'name':_0xb91835[_0xd815('0x1a')],'resourceId':_0xb91835['id'],'type':_0x348591['name'],'sectionId':_0x348591['id']},{})[_0xd815('0x14')](function(){return _0x18f9d9;});}else{return _0x18f9d9;}})['catch'](function(_0xa1d152){logger[_0xd815('0x18')](_0xd815('0x3b'),_0xa1d152);throw _0xa1d152;});}return _0x18f9d9;})[_0xd815('0x14')](respondWithResult(_0xc318da,0xc9))['catch'](handleError(_0xc318da,null));};exports[_0xd815('0x13')]=function(_0x3759d3,_0x1aef09){if(_0x3759d3['body']['id']){delete _0x3759d3['body']['id'];}return db[_0xd815('0x1d')]['find']({'where':{'id':_0x3759d3[_0xd815('0x2a')]['id']}})[_0xd815('0x14')](handleEntityNotFound(_0x1aef09,null))[_0xd815('0x14')](saveUpdates(_0x3759d3['body'],null))[_0xd815('0x14')](respondWithResult(_0x1aef09,null))['catch'](handleError(_0x1aef09,null));};exports[_0xd815('0x15')]=function(_0x1281d4,_0x582006){return db[_0xd815('0x1d')]['find']({'where':{'id':_0x1281d4[_0xd815('0x2a')]['id']}})[_0xd815('0x14')](handleEntityNotFound(_0x582006,null))['then'](removeEntity(_0x582006,null))['catch'](handleError(_0x582006,null));};exports[_0xd815('0x3c')]=function(_0x5bb2ab,_0x160322){return db['ChatQueue'][_0xd815('0x3c')]()[_0xd815('0x14')](respondWithResult(_0x160322,null))['catch'](handleError(_0x160322,null));};exports[_0xd815('0x3d')]=function(_0x5ce532,_0x286c4a){var _0x34a449={'raw':!![],'where':{}},_0xf1b8f2={},_0x170460;return db[_0xd815('0x1d')]['findOne']({'where':{'id':_0x5ce532['params']['id']}})['then'](handleEntityNotFound(_0x286c4a,null))['then'](function(_0x3a882c){if(_0x3a882c){_0x170460=_0x3a882c['get']({'plain':!![]});_0xf1b8f2[_0xd815('0x2b')]=_['keys'](db['UserChatQueue'][_0xd815('0x1e')]);_0xf1b8f2[_0xd815('0x25')]=_[_0xd815('0x2c')](_0x5ce532[_0xd815('0x25')]);_0xf1b8f2[_0xd815('0x3e')]=_[_0xd815('0x2d')](_0xf1b8f2['model'],_0xf1b8f2['query']);_0x34a449[_0xd815('0x2e')]=_[_0xd815('0x2d')](_0xf1b8f2[_0xd815('0x2b')],qs[_0xd815('0x3f')](_0x5ce532[_0xd815('0x25')][_0xd815('0x3f')]));_0x34a449[_0xd815('0x2e')]=_0x34a449['attributes']['length']?_0x34a449[_0xd815('0x2e')]:_0xf1b8f2[_0xd815('0x2b')];if(!_0x5ce532[_0xd815('0x25')][_0xd815('0x40')](_0xd815('0x41'))){_0x34a449[_0xd815('0xf')]=qs['limit'](_0x5ce532[_0xd815('0x25')][_0xd815('0xf')]);_0x34a449[_0xd815('0xd')]=qs[_0xd815('0xd')](_0x5ce532[_0xd815('0x25')][_0xd815('0xd')]);}_0x34a449['order']=qs['sort'](_0x5ce532[_0xd815('0x25')][_0xd815('0x42')]);_0x34a449[_0xd815('0x23')]=qs[_0xd815('0x3e')](_[_0xd815('0x43')](_0x5ce532[_0xd815('0x25')],_0xf1b8f2[_0xd815('0x3e')]));_0x34a449[_0xd815('0x23')]['ChatQueueId']=_0x3a882c['id'];if(_0x5ce532['query']['filter']){_0x34a449[_0xd815('0x23')]=_[_0xd815('0x30')](_0x34a449['where'],{'$or':_['map'](_0x34a449[_0xd815('0x2e')],function(_0xef056b){var _0x5cd47f={};_0x5cd47f[_0xef056b]={'$like':'%'+_0x5ce532[_0xd815('0x25')][_0xd815('0x44')]+'%'};return _0x5cd47f;})});}_0x34a449=_['merge']({},_0x34a449,_0x5ce532[_0xd815('0x31')]);return db[_0xd815('0x45')][_0xd815('0x26')](_0x34a449);}})[_0xd815('0x14')](function(_0x49a12f){if(_0x49a12f){return db[_0xd815('0x46')][_0xd815('0x47')]({'where':{'id':_['map'](_0x49a12f,_0xd815('0x48')),'role':_0xd815('0x49')},'attributes':['id',_0xd815('0x1a'),_0xd815('0x4a'),_0xd815('0x4b'),_0xd815('0x4c')]});}})[_0xd815('0x14')](function(_0x3522fd){if(_0x3522fd){return{'count':_0x3522fd[_0xd815('0x10')],'rows':_[_0xd815('0x1c')](_0x3522fd[_0xd815('0x27')],function(_0x55840f){return{'membername':_0x55840f[_0xd815('0x1a')],'UserId':_0x55840f['id'],'queue_name':_0x170460[_0xd815('0x1a')],'ChatQueueId':_0x170460['id'],'interface':util['format']('%s/%s','SIP',_0x55840f[_0xd815('0x1a')]),'penalty':0x0,'paused':_0x55840f[_0xd815('0x4a')],'createdAt':_0x55840f['createdAt'],'updatedAt':_0x55840f[_0xd815('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x286c4a,_0x34a449))[_0xd815('0x28')](handleError(_0x286c4a,null));};exports[_0xd815('0x4d')]=function(_0x3b4e92,_0x1a06f3){var _0x494746={};var _0x56df3e={};var _0x4e215d;var _0x33113c;return db[_0xd815('0x1d')]['findOne']({'where':{'id':_0x3b4e92['params']['id']}})[_0xd815('0x14')](handleEntityNotFound(_0x1a06f3,null))[_0xd815('0x14')](function(_0x2cb03e){if(_0x2cb03e){_0x4e215d=_0x2cb03e;_0x56df3e[_0xd815('0x2b')]=_[_0xd815('0x2c')](db['Team'][_0xd815('0x1e')]);_0x56df3e[_0xd815('0x25')]=_['keys'](_0x3b4e92[_0xd815('0x25')]);_0x56df3e[_0xd815('0x3e')]=_[_0xd815('0x2d')](_0x56df3e[_0xd815('0x2b')],_0x56df3e[_0xd815('0x25')]);_0x494746[_0xd815('0x2e')]=_['intersection'](_0x56df3e[_0xd815('0x2b')],qs[_0xd815('0x3f')](_0x3b4e92[_0xd815('0x25')][_0xd815('0x3f')]));_0x494746[_0xd815('0x2e')]=_0x494746['attributes']['length']?_0x494746[_0xd815('0x2e')]:_0x56df3e[_0xd815('0x2b')];_0x494746[_0xd815('0x4e')]=qs[_0xd815('0x42')](_0x3b4e92[_0xd815('0x25')][_0xd815('0x42')]);_0x494746['where']=qs[_0xd815('0x3e')](_[_0xd815('0x43')](_0x3b4e92[_0xd815('0x25')],_0x56df3e[_0xd815('0x3e')]));if(_0x3b4e92[_0xd815('0x25')][_0xd815('0x44')]){_0x494746['where']=_['merge'](_0x494746[_0xd815('0x23')],{'$or':_[_0xd815('0x1c')](_0x494746['attributes'],function(_0xe85141){var _0x1721f4={};_0x1721f4[_0xe85141]={'$like':'%'+_0x3b4e92[_0xd815('0x25')][_0xd815('0x44')]+'%'};return _0x1721f4;})});}_0x494746=_[_0xd815('0x30')]({},_0x494746,_0x3b4e92[_0xd815('0x31')]);return _0x4e215d[_0xd815('0x4d')](_0x494746);}})[_0xd815('0x14')](function(_0x15b9a9){if(_0x15b9a9){_0x33113c=_0x15b9a9['length'];if(!_0x3b4e92[_0xd815('0x25')]['hasOwnProperty'](_0xd815('0x41'))){_0x494746[_0xd815('0xf')]=qs['limit'](_0x3b4e92[_0xd815('0x25')][_0xd815('0xf')]);_0x494746['offset']=qs[_0xd815('0xd')](_0x3b4e92[_0xd815('0x25')][_0xd815('0xd')]);}return _0x4e215d['getTeams'](_0x494746);}})['then'](function(_0x10e2a7){if(_0x10e2a7){return _0x10e2a7?{'count':_0x33113c,'rows':_0x10e2a7}:null;}})[_0xd815('0x14')](respondWithResult(_0x1a06f3,null))[_0xd815('0x28')](handleError(_0x1a06f3,null));};exports[_0xd815('0x4f')]=function(_0x3efe9d,_0x1a4203){var _0x434c52=_0x3efe9d[_0xd815('0x34')][_0xd815('0x50')];return db[_0xd815('0x51')]['findAll']({'where':{'id':_0x434c52},'attributes':['id'],'include':[{'model':db[_0xd815('0x46')],'as':_0xd815('0x52'),'attributes':['id','name','online',_0xd815('0x53'),'interface'],'raw':!![]}]})['then'](function(_0x4968c9){if(_0x4968c9){var _0x49d88f=_[_0xd815('0x54')](_0x4968c9,function(_0x366eca){var _0x3eeb1d=_0x366eca[_0xd815('0x36')]({'plain':!![]});return _0x3eeb1d[_0xd815('0x52')];});return db['ChatQueue'][_0xd815('0x32')]({'where':{'id':_0x3efe9d[_0xd815('0x2a')]['id']}})['then'](function(_0x20fb49){return db[_0xd815('0x55')]['transaction'](function(_0x3110c9){return _0x20fb49[_0xd815('0x4f')](_0x434c52,{'transaction':_0x3110c9})[_0xd815('0x14')](function(){return BPromise[_0xd815('0x56')](_0x49d88f,function(_0x334039){return db[_0xd815('0x45')][_0xd815('0x57')]({'where':{'UserId':_0x334039['id'],'ChatQueueId':_0x3efe9d['params']['id']},'transaction':_0x3110c9});});})[_0xd815('0x14')](function(){_0x49d88f['forEach'](function(_0x27327b){socket['emit'](_0xd815('0x58'),{'UserId':_0x27327b['id'],'ChatQueueId':_0x20fb49['id']});});});});});}})[_0xd815('0x14')](respondWithStatusCode(_0x1a4203,null))['catch'](handleError(_0x1a4203,null));};exports['removeTeams']=function(_0x13eaec,_0x3da43c){return db[_0xd815('0x51')][_0xd815('0x26')]({'where':{'id':_0x13eaec['query'][_0xd815('0x50')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3da43c,null))[_0xd815('0x14')](function(_0x42f025){var _0xabd0dd=_[_0xd815('0x1c')](_0x42f025,'id');var _0x5c58f2=[];var _0x3dcb77=[];var _0x1863ca=squel[_0xd815('0x59')]();_0x1863ca['field'](_0xd815('0x5a'))[_0xd815('0x5b')](_0xd815('0x5c'),'tq')[_0xd815('0x5d')](_0xd815('0x5e'),'ut',_0xd815('0x5f'))[_0xd815('0x23')]('ChatQueueId\x20=\x20?',_0x13eaec[_0xd815('0x2a')]['id']);for(var _0x21f759=0x0;_0x21f759<_0x42f025[_0xd815('0x60')];_0x21f759+=0x1){let _0x2643f0=_0x42f025[_0x21f759];for(var _0x479a93=0x0;_0x479a93<_0x2643f0[_0xd815('0x52')][_0xd815('0x60')];_0x479a93+=0x1){let _0x1d222e=_0x2643f0[_0xd815('0x52')][_0x479a93];var _0x3c8922=_0x1863ca[_0xd815('0x61')]();_0x3c8922[_0xd815('0x23')](_0xd815('0x62'),_0x1d222e['id']);_0x3dcb77['push'](db[_0xd815('0x55')][_0xd815('0x25')](_0x3c8922[_0xd815('0x63')](),{'type':db[_0xd815('0x55')][_0xd815('0x64')][_0xd815('0x65')]})[_0xd815('0x14')](function(_0xd4abc9){if(_0xd4abc9['length']===0x1){return _0x1d222e['id'];}else{var _0x39b524=_[_0xd815('0x66')](_[_0xd815('0x1c')](_0xd4abc9,'TeamId'),function(_0x4b234e){return _[_0xd815('0x67')](_0xabd0dd,_0x4b234e);});if(_0x39b524){return _0x1d222e['id'];}}}));}}return BPromise[_0xd815('0x68')](_0x3dcb77)['then'](function(_0x36c733){_0x5c58f2=_(_0x5c58f2)[_0xd815('0x69')](_0x36c733)[_0xd815('0x6a')]()[_0xd815('0x6b')]();return db[_0xd815('0x1d')]['find']({'where':{'id':_0x13eaec[_0xd815('0x2a')]['id']}})[_0xd815('0x14')](function(_0x731fef){return db[_0xd815('0x55')][_0xd815('0x6c')](function(_0x75a143){return _0x731fef[_0xd815('0x6d')](_0x13eaec[_0xd815('0x25')][_0xd815('0x50')],{'transaction':_0x75a143})[_0xd815('0x14')](function(){if(!_['isEmpty'](_0x5c58f2)){return _0x731fef[_0xd815('0x6e')](_0x5c58f2,{'transaction':_0x75a143});}})[_0xd815('0x14')](function(){_0x5c58f2[_0xd815('0x6f')](function(_0x22a243){socket[_0xd815('0x70')](_0xd815('0x71'),{'UserId':_0x22a243,'ChatQueueId':_0x731fef['id']});});});});});});})[_0xd815('0x14')](respondWithStatusCode(_0x3da43c,null))['catch'](handleError(_0x3da43c,null));};exports['addAgents']=function(_0x163e0d,_0x8b436f){return db['ChatQueue'][_0xd815('0x32')]({'where':{'id':_0x163e0d[_0xd815('0x2a')]['id']}})[_0xd815('0x14')](handleEntityNotFound(_0x8b436f,null))[_0xd815('0x14')](function(_0x41db56){if(_0x41db56){return _0x41db56[_0xd815('0x72')](_0x163e0d[_0xd815('0x34')][_0xd815('0x50')],_[_0xd815('0x73')](_0x163e0d[_0xd815('0x34')],[_0xd815('0x50'),'id'])||{})[_0xd815('0x74')](function(_0x9a7c51){for(var _0x99678e=0x0;_0x99678e<_0x163e0d['body']['ids'][_0xd815('0x60')];_0x99678e+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x163e0d[_0xd815('0x34')][_0xd815('0x50')][_0x99678e]),'ChatQueueId':Number(_0x163e0d[_0xd815('0x2a')]['id'])});}return _0x9a7c51;});}})['then'](respondWithResult(_0x8b436f,null))[_0xd815('0x28')](handleError(_0x8b436f,null));};exports[_0xd815('0x6e')]=function(_0x2cd9d7,_0x44653e){return db[_0xd815('0x1d')][_0xd815('0x32')]({'where':{'id':_0x2cd9d7[_0xd815('0x2a')]['id']}})[_0xd815('0x14')](handleEntityNotFound(_0x44653e,null))['then'](function(_0x475269){if(_0x475269){return _0x475269[_0xd815('0x6e')](_0x2cd9d7[_0xd815('0x25')][_0xd815('0x50')])[_0xd815('0x14')](function(){if(_[_0xd815('0x75')](_0x2cd9d7['query'][_0xd815('0x50')])){for(var _0x2da407=0x0;_0x2da407<_0x2cd9d7[_0xd815('0x25')]['ids']['length'];_0x2da407+=0x1){socket[_0xd815('0x70')]('userChatQueue:remove',{'UserId':Number(_0x2cd9d7[_0xd815('0x25')][_0xd815('0x50')][_0x2da407]),'ChatQueueId':Number(_0x2cd9d7[_0xd815('0x2a')]['id'])});}}else{socket[_0xd815('0x70')](_0xd815('0x71'),{'UserId':Number(_0x2cd9d7[_0xd815('0x25')]['ids']),'ChatQueueId':Number(_0x2cd9d7[_0xd815('0x2a')]['id'])});}});}})[_0xd815('0x14')](respondWithStatusCode(_0x44653e,null))[_0xd815('0x28')](handleError(_0x44653e,null));};exports[_0xd815('0x76')]=function(_0x448659,_0x5bab0d){var _0x4bba40={};var _0x4ed97e={};var _0x3dd7df;var _0xa7c2f8;return db[_0xd815('0x1d')]['findOne']({'where':{'id':_0x448659[_0xd815('0x2a')]['id']}})[_0xd815('0x14')](handleEntityNotFound(_0x5bab0d,null))['then'](function(_0x322f79){if(_0x322f79){_0x3dd7df=_0x322f79;_0x4ed97e[_0xd815('0x2b')]=_[_0xd815('0x2c')](db[_0xd815('0x46')][_0xd815('0x1e')]);_0x4ed97e[_0xd815('0x25')]=_[_0xd815('0x2c')](_0x448659[_0xd815('0x25')]);_0x4ed97e[_0xd815('0x3e')]=_['intersection'](_0x4ed97e[_0xd815('0x2b')],_0x4ed97e['query']);_0x4bba40['attributes']=_[_0xd815('0x2d')](_0x4ed97e[_0xd815('0x2b')],qs[_0xd815('0x3f')](_0x448659['query'][_0xd815('0x3f')]));_0x4bba40['attributes']=_0x4bba40[_0xd815('0x2e')]['length']?_0x4bba40[_0xd815('0x2e')]:_0x4ed97e[_0xd815('0x2b')];_0x4bba40[_0xd815('0x4e')]=qs['sort'](_0x448659[_0xd815('0x25')][_0xd815('0x42')]);_0x4bba40[_0xd815('0x23')]=qs[_0xd815('0x3e')](_['pick'](_0x448659[_0xd815('0x25')],_0x4ed97e[_0xd815('0x3e')]));if(_0x448659[_0xd815('0x25')][_0xd815('0x44')]){_0x4bba40[_0xd815('0x23')]=_[_0xd815('0x30')](_0x4bba40['where'],{'$or':_['map'](_0x4bba40[_0xd815('0x2e')],function(_0x1d4310){var _0xccdece={};_0xccdece[_0x1d4310]={'$like':'%'+_0x448659[_0xd815('0x25')][_0xd815('0x44')]+'%'};return _0xccdece;})});}_0x4bba40=_[_0xd815('0x30')]({},_0x4bba40,_0x448659['options']);return _0x3dd7df[_0xd815('0x76')](_0x4bba40);}})[_0xd815('0x14')](function(_0x2a9b26){if(_0x2a9b26){_0xa7c2f8=_0x2a9b26['length'];if(!_0x448659[_0xd815('0x25')]['hasOwnProperty'](_0xd815('0x41'))){_0x4bba40[_0xd815('0xf')]=qs['limit'](_0x448659[_0xd815('0x25')][_0xd815('0xf')]);_0x4bba40[_0xd815('0xd')]=qs[_0xd815('0xd')](_0x448659['query'][_0xd815('0xd')]);}return _0x3dd7df[_0xd815('0x76')](_0x4bba40);}})[_0xd815('0x14')](function(_0x5e2148){if(_0x5e2148){return _0x5e2148?{'count':_0xa7c2f8,'rows':_0x5e2148}:null;}})['then'](respondWithResult(_0x5bab0d,null))[_0xd815('0x28')](handleError(_0x5bab0d,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 56e74a2..1baa1bc 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 _0x8f3f=['events','../../mysqldb','ChatQueue','setMaxListeners','update','emit','exports'];(function(_0x35ae65,_0x3235d3){var _0x29b347=function(_0x28251d){while(--_0x28251d){_0x35ae65['push'](_0x35ae65['shift']());}};_0x29b347(++_0x3235d3);}(_0x8f3f,0xe7));var _0xf8f3=function(_0x43111f,_0x32a1a2){_0x43111f=_0x43111f-0x0;var _0xfd01d9=_0x8f3f[_0x43111f];return _0xfd01d9;};'use strict';var EventEmitter=require(_0xf8f3('0x0'));var ChatQueue=require(_0xf8f3('0x1'))['db'][_0xf8f3('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf8f3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf8f3('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3648ca){return function(_0x305653,_0x40dc6b,_0x526218){ChatQueueEvents[_0xf8f3('0x5')](_0x3648ca+':'+_0x305653['id'],_0x305653);ChatQueueEvents[_0xf8f3('0x5')](_0x3648ca,_0x305653);_0x526218(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xf8f3('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0x198a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x140288,_0x224892){var _0x1561c9=function(_0x3c2c0e){while(--_0x3c2c0e){_0x140288['push'](_0x140288['shift']());}};_0x1561c9(++_0x224892);}(_0x198a,0xf4));var _0xa198=function(_0x45e789,_0x240059){_0x45e789=_0x45e789-0x0;var _0x50107b=_0x198a[_0x45e789];return _0x50107b;};'use strict';var EventEmitter=require(_0xa198('0x0'));var ChatQueue=require(_0xa198('0x1'))['db'][_0xa198('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xa198('0x3')](0x0);var events={'afterCreate':_0xa198('0x4'),'afterUpdate':_0xa198('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2f40fe){return function(_0x21b4e1,_0x541323,_0x43b3be){ChatQueueEvents[_0xa198('0x6')](_0x2f40fe+':'+_0x21b4e1['id'],_0x21b4e1);ChatQueueEvents['emit'](_0x2f40fe,_0x21b4e1);_0x43b3be(null);};}for(var e in events){if(events[_0xa198('0x7')](e)){var event=events[e];ChatQueue[_0xa198('0x8')](e,emitEvent(event));}}module[_0xa198('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 3430c22..5882de7 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 _0x7093=['rimraf','../../config/environment','define','ChatQueue','chat_queues','lodash','../../config/logger','api','request-promise','path'];(function(_0x3f161e,_0x28c6b3){var _0x14649f=function(_0x251267){while(--_0x251267){_0x3f161e['push'](_0x3f161e['shift']());}};_0x14649f(++_0x28c6b3);}(_0x7093,0x73));var _0x3709=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7093[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3709('0x0'));var util=require('util');var logger=require(_0x3709('0x1'))(_0x3709('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3709('0x3'));var fs=require('fs');var path=require(_0x3709('0x4'));var rimraf=require(_0x3709('0x5'));var config=require(_0x3709('0x6'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x530923,_0x3ee613){return _0x530923[_0x3709('0x7')](_0x3709('0x8'),attributes,{'tableName':_0x3709('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7ab=['bluebird','request-promise','path','./chatQueue.attributes','define','chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x1a61fe,_0x369759){var _0x39b1a5=function(_0x38ddcb){while(--_0x38ddcb){_0x1a61fe['push'](_0x1a61fe['shift']());}};_0x39b1a5(++_0x369759);}(_0xa7ab,0xcc));var _0xba7a=function(_0x484c54,_0x5a6ebf){_0x484c54=_0x484c54-0x0;var _0x1f3976=_0xa7ab[_0x484c54];return _0x1f3976;};'use strict';var _=require(_0xba7a('0x0'));var util=require(_0xba7a('0x1'));var logger=require(_0xba7a('0x2'))(_0xba7a('0x3'));var moment=require(_0xba7a('0x4'));var BPromise=require(_0xba7a('0x5'));var rp=require(_0xba7a('0x6'));var fs=require('fs');var path=require(_0xba7a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xba7a('0x8'));module['exports']=function(_0x288932,_0x2c3c6f){return _0x288932[_0xba7a('0x9')]('ChatQueue',attributes,{'tableName':_0xba7a('0xa'),'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 aeec004..b7af3aa 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 _0x4c50=['client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ChatQueue','findAll','options','where','limit','include','map','attributes','model','GetChatQueue','debug','stringify','ShowChatQueue','find','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x1c9611,_0x3107a9){var _0x43816e=function(_0x45f153){while(--_0x45f153){_0x1c9611['push'](_0x1c9611['shift']());}};_0x43816e(++_0x3107a9);}(_0x4c50,0x10f));var _0x04c5=function(_0x2d6c00,_0x416d71){_0x2d6c00=_0x2d6c00-0x0;var _0xb60af3=_0x4c50[_0x2d6c00];return _0xb60af3;};'use strict';var _=require(_0x04c5('0x0'));var util=require(_0x04c5('0x1'));var moment=require(_0x04c5('0x2'));var BPromise=require(_0x04c5('0x3'));var rs=require(_0x04c5('0x4'));var fs=require('fs');var Redis=require(_0x04c5('0x5'));var db=require(_0x04c5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x04c5('0x7'));var config=require(_0x04c5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x04c5('0x9')][_0x04c5('0xa')]({'port':0x232a});config[_0x04c5('0xb')]=_[_0x04c5('0xc')](config[_0x04c5('0xb')],{'host':_0x04c5('0xd'),'port':0x18eb});var socket=require(_0x04c5('0xe'))(new Redis(config[_0x04c5('0xb')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x50d0ac,_0x24fc3d,_0x19cdc1){return new BPromise(function(_0x1f083e,_0x42d12e){return client[_0x04c5('0xf')](_0x50d0ac,_0x19cdc1)[_0x04c5('0x10')](function(_0xb0ae5d){logger[_0x04c5('0x11')](_0x04c5('0x12'),_0x24fc3d,'request\x20sent');logger['debug'](_0x04c5('0x13'),_0x24fc3d,_0x04c5('0x14'),JSON['stringify'](_0xb0ae5d));if(_0xb0ae5d[_0x04c5('0x15')]){if(_0xb0ae5d[_0x04c5('0x15')][_0x04c5('0x16')]===0x1f4){logger[_0x04c5('0x15')](_0x04c5('0x12'),_0x24fc3d,_0xb0ae5d['error']['message']);return _0x42d12e(_0xb0ae5d['error']['message']);}logger['error'](_0x04c5('0x12'),_0x24fc3d,_0xb0ae5d['error']['message']);return _0x1f083e(_0xb0ae5d[_0x04c5('0x15')][_0x04c5('0x17')]);}else{logger['info'](_0x04c5('0x12'),_0x24fc3d,_0x04c5('0x14'));_0x1f083e(_0xb0ae5d['result'][_0x04c5('0x17')]);}})['catch'](function(_0x390d52){logger[_0x04c5('0x15')](_0x04c5('0x12'),_0x24fc3d,_0x390d52);_0x42d12e(_0x390d52);});});}exports['GetChatQueue']=function(_0x1a7da2){var _0x3bfe9b=this;return new Promise(function(_0x5a3531,_0x283e8f){return db[_0x04c5('0x18')][_0x04c5('0x19')]({'raw':_0x1a7da2[_0x04c5('0x1a')]?_0x1a7da2[_0x04c5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1a7da2['options']?_0x1a7da2['options'][_0x04c5('0x1b')]||null:null,'attributes':_0x1a7da2[_0x04c5('0x1a')]?_0x1a7da2[_0x04c5('0x1a')]['attributes']||null:null,'limit':_0x1a7da2[_0x04c5('0x1a')]?_0x1a7da2['options'][_0x04c5('0x1c')]||null:null,'include':_0x1a7da2['options']?_0x1a7da2[_0x04c5('0x1a')][_0x04c5('0x1d')]?_[_0x04c5('0x1e')](_0x1a7da2['options'][_0x04c5('0x1d')],function(_0x521e46){return{'model':db[_0x521e46['model']],'as':_0x521e46['as'],'attributes':_0x521e46[_0x04c5('0x1f')],'include':_0x521e46[_0x04c5('0x1d')]?_[_0x04c5('0x1e')](_0x521e46[_0x04c5('0x1d')],function(_0x5759af){return{'model':db[_0x5759af[_0x04c5('0x20')]],'as':_0x5759af['as'],'attributes':_0x5759af[_0x04c5('0x1f')],'include':_0x5759af[_0x04c5('0x1d')]?_[_0x04c5('0x1e')](_0x5759af[_0x04c5('0x1d')],function(_0x2d0d6c){return{'model':db[_0x2d0d6c[_0x04c5('0x20')]],'as':_0x2d0d6c['as'],'attributes':_0x2d0d6c[_0x04c5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x04c5('0x10')](function(_0x14a36){logger['info'](_0x04c5('0x21'),_0x1a7da2);logger[_0x04c5('0x22')](_0x04c5('0x21'),_0x1a7da2,JSON[_0x04c5('0x23')](_0x14a36));_0x5a3531(_0x14a36);})['catch'](function(_0x1d6249){logger['error'](_0x04c5('0x21'),_0x1d6249[_0x04c5('0x17')],_0x1a7da2);_0x283e8f(_0x3bfe9b[_0x04c5('0x15')](0x1f4,_0x1d6249[_0x04c5('0x17')]));});});};exports[_0x04c5('0x24')]=function(_0x45f8d3){var _0x5c63bf=this;return new Promise(function(_0x4905f1,_0x1b48e2){return db[_0x04c5('0x18')][_0x04c5('0x25')]({'raw':_0x45f8d3['options']?_0x45f8d3[_0x04c5('0x1a')][_0x04c5('0x26')]===undefined?!![]:![]:!![],'where':_0x45f8d3[_0x04c5('0x1a')]?_0x45f8d3[_0x04c5('0x1a')][_0x04c5('0x1b')]||null:null,'attributes':_0x45f8d3[_0x04c5('0x1a')]?_0x45f8d3[_0x04c5('0x1a')]['attributes']||null:null,'include':_0x45f8d3['options']?_0x45f8d3['options'][_0x04c5('0x1d')]?_[_0x04c5('0x1e')](_0x45f8d3[_0x04c5('0x1a')][_0x04c5('0x1d')],function(_0x5bd3fc){return{'model':db[_0x5bd3fc['model']],'as':_0x5bd3fc['as'],'attributes':_0x5bd3fc[_0x04c5('0x1f')],'include':_0x5bd3fc[_0x04c5('0x1d')]?_[_0x04c5('0x1e')](_0x5bd3fc['include'],function(_0x168565){return{'model':db[_0x168565['model']],'as':_0x168565['as'],'attributes':_0x168565[_0x04c5('0x1f')],'include':_0x168565[_0x04c5('0x1d')]?_[_0x04c5('0x1e')](_0x168565[_0x04c5('0x1d')],function(_0x35794d){return{'model':db[_0x35794d[_0x04c5('0x20')]],'as':_0x35794d['as'],'attributes':_0x35794d[_0x04c5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x04c5('0x10')](function(_0x51c140){logger['info'](_0x04c5('0x24'),_0x45f8d3);logger[_0x04c5('0x22')](_0x04c5('0x24'),_0x45f8d3,JSON[_0x04c5('0x23')](_0x51c140));_0x4905f1(_0x51c140);})[_0x04c5('0x27')](function(_0x23e958){logger[_0x04c5('0x15')](_0x04c5('0x24'),_0x23e958[_0x04c5('0x17')],_0x45f8d3);_0x1b48e2(_0x5c63bf[_0x04c5('0x15')](0x1f4,_0x23e958[_0x04c5('0x17')]));});});}; \ No newline at end of file +var _0xd1d3=['moment','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','register','request','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','catch','GetChatQueue','ChatQueue','findAll','raw','options','where','include','model','map','attributes','then','debug','ShowChatQueue','stringify','util'];(function(_0xc5e8b2,_0x17c746){var _0x300a20=function(_0x39c489){while(--_0x39c489){_0xc5e8b2['push'](_0xc5e8b2['shift']());}};_0x300a20(++_0x17c746);}(_0xd1d3,0x68));var _0x3d1d=function(_0x37aeff,_0x38c70a){_0x37aeff=_0x37aeff-0x0;var _0x285409=_0xd1d3[_0x37aeff];return _0x285409;};'use strict';var _=require('lodash');var util=require(_0x3d1d('0x0'));var moment=require(_0x3d1d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d1d('0x2'))['db'];var utils=require(_0x3d1d('0x3'));var logger=require('../../config/logger')(_0x3d1d('0x4'));var config=require(_0x3d1d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3d1d('0x6')][_0x3d1d('0x7')]({'port':0x232a});config[_0x3d1d('0x8')]=_['defaults'](config[_0x3d1d('0x8')],{'host':_0x3d1d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d1d('0x8')]));require('./chatQueue.socket')[_0x3d1d('0xa')](socket);function respondWithRpcPromise(_0x56154a,_0x1cb81e,_0x5d2e09){return new BPromise(function(_0x29f76e,_0x23b4a1){return client[_0x3d1d('0xb')](_0x56154a,_0x5d2e09)['then'](function(_0x553661){logger['info']('ChatQueue,\x20%s,\x20%s',_0x1cb81e,_0x3d1d('0xc'));logger['debug'](_0x3d1d('0xd'),_0x1cb81e,_0x3d1d('0xc'),JSON['stringify'](_0x553661));if(_0x553661[_0x3d1d('0xe')]){if(_0x553661[_0x3d1d('0xe')][_0x3d1d('0xf')]===0x1f4){logger[_0x3d1d('0xe')](_0x3d1d('0x10'),_0x1cb81e,_0x553661['error'][_0x3d1d('0x11')]);return _0x23b4a1(_0x553661[_0x3d1d('0xe')][_0x3d1d('0x11')]);}logger[_0x3d1d('0xe')](_0x3d1d('0x10'),_0x1cb81e,_0x553661[_0x3d1d('0xe')][_0x3d1d('0x11')]);return _0x29f76e(_0x553661['error'][_0x3d1d('0x11')]);}else{logger[_0x3d1d('0x12')](_0x3d1d('0x10'),_0x1cb81e,_0x3d1d('0xc'));_0x29f76e(_0x553661[_0x3d1d('0x13')][_0x3d1d('0x11')]);}})[_0x3d1d('0x14')](function(_0x39da0e){logger[_0x3d1d('0xe')]('ChatQueue,\x20%s,\x20%s',_0x1cb81e,_0x39da0e);_0x23b4a1(_0x39da0e);});});}exports[_0x3d1d('0x15')]=function(_0x220c7b){var _0x21f6f6=this;return new Promise(function(_0x15dc5f,_0xca4143){return db[_0x3d1d('0x16')][_0x3d1d('0x17')]({'raw':_0x220c7b['options']?_0x220c7b['options'][_0x3d1d('0x18')]===undefined?!![]:![]:!![],'where':_0x220c7b[_0x3d1d('0x19')]?_0x220c7b[_0x3d1d('0x19')][_0x3d1d('0x1a')]||null:null,'attributes':_0x220c7b[_0x3d1d('0x19')]?_0x220c7b[_0x3d1d('0x19')]['attributes']||null:null,'limit':_0x220c7b['options']?_0x220c7b[_0x3d1d('0x19')]['limit']||null:null,'include':_0x220c7b[_0x3d1d('0x19')]?_0x220c7b['options'][_0x3d1d('0x1b')]?_['map'](_0x220c7b['options'][_0x3d1d('0x1b')],function(_0x2210bf){return{'model':db[_0x2210bf[_0x3d1d('0x1c')]],'as':_0x2210bf['as'],'attributes':_0x2210bf['attributes'],'include':_0x2210bf[_0x3d1d('0x1b')]?_[_0x3d1d('0x1d')](_0x2210bf[_0x3d1d('0x1b')],function(_0x4cc223){return{'model':db[_0x4cc223['model']],'as':_0x4cc223['as'],'attributes':_0x4cc223[_0x3d1d('0x1e')],'include':_0x4cc223[_0x3d1d('0x1b')]?_[_0x3d1d('0x1d')](_0x4cc223[_0x3d1d('0x1b')],function(_0x3b399b){return{'model':db[_0x3b399b[_0x3d1d('0x1c')]],'as':_0x3b399b['as'],'attributes':_0x3b399b['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d1d('0x1f')](function(_0x4ec8c7){logger['info']('GetChatQueue',_0x220c7b);logger[_0x3d1d('0x20')](_0x3d1d('0x15'),_0x220c7b,JSON['stringify'](_0x4ec8c7));_0x15dc5f(_0x4ec8c7);})[_0x3d1d('0x14')](function(_0x1029b6){logger[_0x3d1d('0xe')](_0x3d1d('0x15'),_0x1029b6[_0x3d1d('0x11')],_0x220c7b);_0xca4143(_0x21f6f6[_0x3d1d('0xe')](0x1f4,_0x1029b6[_0x3d1d('0x11')]));});});};exports['ShowChatQueue']=function(_0x240bc4){var _0x1d548a=this;return new Promise(function(_0x38d5cb,_0x1f30d3){return db[_0x3d1d('0x16')]['find']({'raw':_0x240bc4[_0x3d1d('0x19')]?_0x240bc4[_0x3d1d('0x19')][_0x3d1d('0x18')]===undefined?!![]:![]:!![],'where':_0x240bc4['options']?_0x240bc4[_0x3d1d('0x19')][_0x3d1d('0x1a')]||null:null,'attributes':_0x240bc4[_0x3d1d('0x19')]?_0x240bc4['options']['attributes']||null:null,'include':_0x240bc4['options']?_0x240bc4[_0x3d1d('0x19')]['include']?_[_0x3d1d('0x1d')](_0x240bc4[_0x3d1d('0x19')][_0x3d1d('0x1b')],function(_0x476ea5){return{'model':db[_0x476ea5['model']],'as':_0x476ea5['as'],'attributes':_0x476ea5[_0x3d1d('0x1e')],'include':_0x476ea5[_0x3d1d('0x1b')]?_[_0x3d1d('0x1d')](_0x476ea5[_0x3d1d('0x1b')],function(_0x3c938b){return{'model':db[_0x3c938b[_0x3d1d('0x1c')]],'as':_0x3c938b['as'],'attributes':_0x3c938b[_0x3d1d('0x1e')],'include':_0x3c938b[_0x3d1d('0x1b')]?_['map'](_0x3c938b['include'],function(_0x34f1e1){return{'model':db[_0x34f1e1[_0x3d1d('0x1c')]],'as':_0x34f1e1['as'],'attributes':_0x34f1e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d1d('0x1f')](function(_0x152d3d){logger[_0x3d1d('0x12')](_0x3d1d('0x21'),_0x240bc4);logger[_0x3d1d('0x20')](_0x3d1d('0x21'),_0x240bc4,JSON[_0x3d1d('0x22')](_0x152d3d));_0x38d5cb(_0x152d3d);})[_0x3d1d('0x14')](function(_0x3885f0){logger[_0x3d1d('0xe')](_0x3d1d('0x21'),_0x3885f0['message'],_0x240bc4);_0x1f30d3(_0x1d548a[_0x3d1d('0xe')](0x1f4,_0x3885f0[_0x3d1d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 5ea0b32..6d5d5a4 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 _0x207c=['length','chatQueue:','save','remove','update','emit'];(function(_0x53bc91,_0x110e4f){var _0x4fd422=function(_0x2a9869){while(--_0x2a9869){_0x53bc91['push'](_0x53bc91['shift']());}};_0x4fd422(++_0x110e4f);}(_0x207c,0x1e8));var _0xc207=function(_0x1c4866,_0x255b66){_0x1c4866=_0x1c4866-0x0;var _0x4239e6=_0x207c[_0x1c4866];return _0x4239e6;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xc207('0x0'),_0xc207('0x1'),_0xc207('0x2')];function createListener(_0xaaba3d,_0x2b40be){return function(_0x12f1f2){_0x2b40be[_0xc207('0x3')](_0xaaba3d,_0x12f1f2);};}function removeListener(_0x4b9daa,_0x38ff02){return function(){ChatQueueEvents['removeListener'](_0x4b9daa,_0x38ff02);};}exports['register']=function(_0x55023e){for(var _0xc88789=0x0,_0x314561=events[_0xc207('0x4')];_0xc88789<_0x314561;_0xc88789++){var _0x59ff6f=events[_0xc88789];var _0x25cb97=createListener(_0xc207('0x5')+_0x59ff6f,_0x55023e);ChatQueueEvents['on'](_0x59ff6f,_0x25cb97);}}; \ No newline at end of file +var _0x2d17=['update','emit','register','chatQueue:','./chatQueue.events','save'];(function(_0x324229,_0xc9d85f){var _0x2231c3=function(_0x4a22a7){while(--_0x4a22a7){_0x324229['push'](_0x324229['shift']());}};_0x2231c3(++_0xc9d85f);}(_0x2d17,0x17e));var _0x72d1=function(_0x5cdf85,_0x4f5610){_0x5cdf85=_0x5cdf85-0x0;var _0x109a19=_0x2d17[_0x5cdf85];return _0x109a19;};'use strict';var ChatQueueEvents=require(_0x72d1('0x0'));var events=[_0x72d1('0x1'),'remove',_0x72d1('0x2')];function createListener(_0x4727f9,_0x531f4e){return function(_0x3687bc){_0x531f4e[_0x72d1('0x3')](_0x4727f9,_0x3687bc);};}function removeListener(_0x55b722,_0x1dd6d8){return function(){ChatQueueEvents['removeListener'](_0x55b722,_0x1dd6d8);};}exports[_0x72d1('0x4')]=function(_0x50f551){for(var _0x139ba0=0x0,_0x239d1f=events['length'];_0x139ba0<_0x239d1f;_0x139ba0++){var _0x477264=events[_0x139ba0];var _0x422f5a=createListener(_0x72d1('0x5')+_0x477264,_0x50f551);ChatQueueEvents['on'](_0x477264,_0x422f5a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 9f4e633..ec36df3 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x223da7,_0x299033){var _0x3b3fe=function(_0x37948b){while(--_0x37948b){_0x223da7['push'](_0x223da7['shift']());}};_0x3b3fe(++_0x299033);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +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(_0x507ec4,_0x4c246c){var _0x3ac5f7=function(_0x42ab90){while(--_0x42ab90){_0x507ec4['push'](_0x507ec4['shift']());}};_0x3ac5f7(++_0x4c246c);}(_0xe14b,0x93));var _0xbe14=function(_0x1ee887,_0x4fb489){_0x1ee887=_0x1ee887-0x0;var _0x2fd82b=_0xe14b[_0x1ee887];return _0x2fd82b;};'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 2852d37..f617cb9 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 _0xebc7=['sequelize','exports','STRING','DATE','moment'];(function(_0x5c1f21,_0x507172){var _0x18e14a=function(_0xce675f){while(--_0xce675f){_0x5c1f21['push'](_0x5c1f21['shift']());}};_0x18e14a(++_0x507172);}(_0xebc7,0x1b7));var _0x7ebc=function(_0x2344db,_0xa81f56){_0x2344db=_0x2344db-0x0;var _0x5e711c=_0xebc7[_0x2344db];return _0x5e711c;};'use strict';var moment=require(_0x7ebc('0x0'));var Sequelize=require(_0x7ebc('0x1'));module[_0x7ebc('0x2')]={'uniqueid':{'type':Sequelize[_0x7ebc('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7ebc('0x3')]},'joinAt':{'type':Sequelize[_0x7ebc('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7ebc('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7ebc('0x3')]}}; \ No newline at end of file +var _0x16a5=['STRING','DATE'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0x16a5,0x106));var _0x516a=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x16a5[_0x5c351c];return _0x26f3b3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x516a('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x516a('0x1')]},'leaveAt':{'type':Sequelize[_0x516a('0x1')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x516a('0x0')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 92efa48..1e05612 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 _0x8d0a=['undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','sendStatus','error','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','intersection','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8d0a,0x172));var _0xa8d0=function(_0x220c60,_0x3ecb45){_0x220c60=_0x220c60-0x0;var _0x56147f=_0x8d0a[_0x220c60];return _0x56147f;};'use strict';var emlformat=require(_0xa8d0('0x0'));var rimraf=require(_0xa8d0('0x1'));var zipdir=require(_0xa8d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8d0('0x3'));var moment=require(_0xa8d0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa8d0('0x5'));var util=require(_0xa8d0('0x6'));var path=require(_0xa8d0('0x7'));var sox=require('sox');var csv=require(_0xa8d0('0x8'));var ejs=require(_0xa8d0('0x9'));var fs=require('fs');var fs_extra=require(_0xa8d0('0xa'));var _=require(_0xa8d0('0xb'));var squel=require(_0xa8d0('0xc'));var crypto=require(_0xa8d0('0xd'));var jsforce=require(_0xa8d0('0xe'));var deskjs=require(_0xa8d0('0xf'));var toCsv=require(_0xa8d0('0x8'));var querystring=require(_0xa8d0('0x10'));var Papa=require(_0xa8d0('0x11'));var Redis=require(_0xa8d0('0x12'));var authService=require(_0xa8d0('0x13'));var qs=require(_0xa8d0('0x14'));var as=require(_0xa8d0('0x15'));var hardwareService=require(_0xa8d0('0x16'));var logger=require(_0xa8d0('0x17'))(_0xa8d0('0x18'));var utils=require(_0xa8d0('0x19'));var config=require(_0xa8d0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x318fb1,_0x23b588){_0x23b588=_0x23b588||0xcc;return function(_0x572d64){if(_0x572d64){return _0x318fb1['sendStatus'](_0x23b588);}return _0x318fb1[_0xa8d0('0x1b')](_0x23b588)[_0xa8d0('0x1c')]();};}function respondWithResult(_0x3ecc36,_0xbdc234){_0xbdc234=_0xbdc234||0xc8;return function(_0x2ebddf){if(_0x2ebddf){return _0x3ecc36[_0xa8d0('0x1b')](_0xbdc234)[_0xa8d0('0x1d')](_0x2ebddf);}};}function respondWithFilteredResult(_0x1daf70,_0x2871cb){return function(_0x238e85){if(_0x238e85){var _0xfa19ee=typeof _0x2871cb['offset']===_0xa8d0('0x1e')&&typeof _0x2871cb[_0xa8d0('0x1f')]==='undefined';var _0x3e1dc6=_0x238e85[_0xa8d0('0x20')];var _0x2899fb=_0xfa19ee?0x0:_0x2871cb[_0xa8d0('0x21')];var _0x34ce5d=_0xfa19ee?_0x238e85['count']:_0x2871cb[_0xa8d0('0x21')]+_0x2871cb[_0xa8d0('0x1f')];var _0x213de2;if(_0x34ce5d>=_0x3e1dc6){_0x34ce5d=_0x3e1dc6;_0x213de2=0xc8;}else{_0x213de2=0xce;}_0x1daf70[_0xa8d0('0x1b')](_0x213de2);return _0x1daf70[_0xa8d0('0x22')](_0xa8d0('0x23'),_0x2899fb+'-'+_0x34ce5d+'/'+_0x3e1dc6)[_0xa8d0('0x1d')](_0x238e85);}return null;};}function patchUpdates(_0x595452){return function(_0x1a3345){try{jsonpatch[_0xa8d0('0x24')](_0x1a3345,_0x595452,!![]);}catch(_0x3c8843){return BPromise[_0xa8d0('0x25')](_0x3c8843);}return _0x1a3345['save']();};}function saveUpdates(_0x31cf4f,_0x31216e){return function(_0x3212a3){if(_0x3212a3){return _0x3212a3[_0xa8d0('0x26')](_0x31cf4f)['then'](function(_0x150080){return _0x150080;});}return null;};}function removeEntity(_0x30a566,_0x20ae2c){return function(_0x1e9c3e){if(_0x1e9c3e){return _0x1e9c3e['destroy']()[_0xa8d0('0x27')](function(){_0x30a566[_0xa8d0('0x1b')](0xcc)[_0xa8d0('0x1c')]();});}};}function handleEntityNotFound(_0x507d18,_0x34c0bf){return function(_0x5f5dfb){if(!_0x5f5dfb){_0x507d18[_0xa8d0('0x28')](0x194);}return _0x5f5dfb;};}function handleError(_0x291e8e,_0x548076){_0x548076=_0x548076||0x1f4;return function(_0x5d7292){logger[_0xa8d0('0x29')](_0x5d7292['stack']);if(_0x5d7292[_0xa8d0('0x2a')]){delete _0x5d7292[_0xa8d0('0x2a')];}_0x291e8e[_0xa8d0('0x1b')](_0x548076)[_0xa8d0('0x2b')](_0x5d7292);};}exports[_0xa8d0('0x2c')]=function(_0x5a5079,_0x221c6e){var _0x356892={},_0x13de71={},_0x500cec={'count':0x0,'rows':[]};var _0x48c682=_['map'](db[_0xa8d0('0x2d')][_0xa8d0('0x2e')],function(_0x2a8e98){return{'name':_0x2a8e98[_0xa8d0('0x2f')],'type':_0x2a8e98[_0xa8d0('0x30')][_0xa8d0('0x31')]};});_0x13de71[_0xa8d0('0x32')]=_['map'](_0x48c682,_0xa8d0('0x2a'));_0x13de71['query']=_[_0xa8d0('0x33')](_0x5a5079['query']);_0x13de71['filters']=_['intersection'](_0x13de71['model'],_0x13de71[_0xa8d0('0x34')]);_0x356892[_0xa8d0('0x35')]=_['intersection'](_0x13de71['model'],qs[_0xa8d0('0x36')](_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x36')]));_0x356892[_0xa8d0('0x35')]=_0x356892[_0xa8d0('0x35')]['length']?_0x356892['attributes']:_0x13de71[_0xa8d0('0x32')];if(!_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x37')](_0xa8d0('0x38'))){_0x356892[_0xa8d0('0x1f')]=qs[_0xa8d0('0x1f')](_0x5a5079['query'][_0xa8d0('0x1f')]);_0x356892[_0xa8d0('0x21')]=qs[_0xa8d0('0x21')](_0x5a5079['query'][_0xa8d0('0x21')]);}_0x356892[_0xa8d0('0x39')]=qs[_0xa8d0('0x3a')](_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x3a')]);_0x356892[_0xa8d0('0x3b')]=qs[_0xa8d0('0x3c')](_[_0xa8d0('0x3d')](_0x5a5079[_0xa8d0('0x34')],_0x13de71[_0xa8d0('0x3c')]),_0x48c682);if(_0x5a5079[_0xa8d0('0x34')]['filter']){_0x356892[_0xa8d0('0x3b')]=_['merge'](_0x356892[_0xa8d0('0x3b')],{'$or':_[_0xa8d0('0x3e')](_0x48c682,function(_0xd181d1){if(_0xd181d1['type']!==_0xa8d0('0x3f')){var _0x172b6a={};_0x172b6a[_0xd181d1[_0xa8d0('0x2a')]]={'$like':'%'+_0x5a5079['query'][_0xa8d0('0x40')]+'%'};return _0x172b6a;}})});}_0x356892=_[_0xa8d0('0x41')]({},_0x356892,_0x5a5079[_0xa8d0('0x42')]);var _0x3c3080={'where':_0x356892[_0xa8d0('0x3b')]};return db[_0xa8d0('0x2d')][_0xa8d0('0x20')](_0x3c3080)[_0xa8d0('0x27')](function(_0x2e2778){_0x500cec['count']=_0x2e2778;if(_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x43')]){_0x356892[_0xa8d0('0x44')]=[{'all':!![]}];}return db[_0xa8d0('0x2d')][_0xa8d0('0x45')](_0x356892);})[_0xa8d0('0x27')](function(_0x3438b7){_0x500cec[_0xa8d0('0x46')]=_0x3438b7;return _0x500cec;})[_0xa8d0('0x27')](respondWithFilteredResult(_0x221c6e,_0x356892))['catch'](handleError(_0x221c6e,null));};exports[_0xa8d0('0x47')]=function(_0x588e17,_0x21c0e2){var _0x8bbb72={'raw':!![],'where':{'id':_0x588e17[_0xa8d0('0x48')]['id']}},_0x58ec61={};_0x58ec61['model']=_[_0xa8d0('0x33')](db[_0xa8d0('0x2d')][_0xa8d0('0x2e')]);_0x58ec61['query']=_['keys'](_0x588e17[_0xa8d0('0x34')]);_0x58ec61[_0xa8d0('0x3c')]=_[_0xa8d0('0x49')](_0x58ec61[_0xa8d0('0x32')],_0x58ec61[_0xa8d0('0x34')]);_0x8bbb72[_0xa8d0('0x35')]=_[_0xa8d0('0x49')](_0x58ec61[_0xa8d0('0x32')],qs['fields'](_0x588e17[_0xa8d0('0x34')]['fields']));_0x8bbb72[_0xa8d0('0x35')]=_0x8bbb72['attributes'][_0xa8d0('0x4a')]?_0x8bbb72[_0xa8d0('0x35')]:_0x58ec61[_0xa8d0('0x32')];if(_0x588e17['query'][_0xa8d0('0x43')]){_0x8bbb72[_0xa8d0('0x44')]=[{'all':!![]}];}_0x8bbb72=_[_0xa8d0('0x41')]({},_0x8bbb72,_0x588e17[_0xa8d0('0x42')]);return db[_0xa8d0('0x2d')][_0xa8d0('0x4b')](_0x8bbb72)[_0xa8d0('0x27')](handleEntityNotFound(_0x21c0e2,null))[_0xa8d0('0x27')](respondWithResult(_0x21c0e2,null))[_0xa8d0('0x4c')](handleError(_0x21c0e2,null));};exports[_0xa8d0('0x4d')]=function(_0x39f402,_0x3187){return db[_0xa8d0('0x2d')][_0xa8d0('0x4d')](_0x39f402[_0xa8d0('0x4e')],{})['then'](respondWithResult(_0x3187,0xc9))['catch'](handleError(_0x3187,null));};exports[_0xa8d0('0x26')]=function(_0x15f801,_0x3ddebe){if(_0x15f801[_0xa8d0('0x4e')]['id']){delete _0x15f801[_0xa8d0('0x4e')]['id'];}return db[_0xa8d0('0x2d')][_0xa8d0('0x4b')]({'where':{'id':_0x15f801[_0xa8d0('0x48')]['id']}})[_0xa8d0('0x27')](handleEntityNotFound(_0x3ddebe,null))[_0xa8d0('0x27')](saveUpdates(_0x15f801[_0xa8d0('0x4e')],null))[_0xa8d0('0x27')](respondWithResult(_0x3ddebe,null))[_0xa8d0('0x4c')](handleError(_0x3ddebe,null));};exports['destroy']=function(_0x2afc73,_0x31e586){return db[_0xa8d0('0x2d')]['find']({'where':{'id':_0x2afc73[_0xa8d0('0x48')]['id']}})[_0xa8d0('0x27')](handleEntityNotFound(_0x31e586,null))[_0xa8d0('0x27')](removeEntity(_0x31e586,null))[_0xa8d0('0x4c')](handleError(_0x31e586,null));};exports[_0xa8d0('0x4f')]=function(_0x5680c1,_0x54f9e6){return db[_0xa8d0('0x2d')][_0xa8d0('0x4f')]()[_0xa8d0('0x27')](respondWithResult(_0x54f9e6,null))[_0xa8d0('0x4c')](handleError(_0x54f9e6,null));}; \ No newline at end of file +var _0x79bf=['reject','save','update','destroy','then','stack','name','send','index','map','ChatQueueReport','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filters','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','set','Content-Range','json'];(function(_0x6b4dab,_0x1f1c9a){var _0x42e1e2=function(_0x5650c6){while(--_0x5650c6){_0x6b4dab['push'](_0x6b4dab['shift']());}};_0x42e1e2(++_0x1f1c9a);}(_0x79bf,0x1df));var _0xf79b=function(_0x49d21f,_0x6e7f5){_0x49d21f=_0x49d21f-0x0;var _0x1b93f2=_0x79bf[_0x49d21f];return _0x1b93f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf79b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf79b('0x1'));var rp=require('request-promise');var moment=require(_0xf79b('0x2'));var BPromise=require(_0xf79b('0x3'));var Mustache=require(_0xf79b('0x4'));var util=require(_0xf79b('0x5'));var path=require(_0xf79b('0x6'));var sox=require(_0xf79b('0x7'));var csv=require(_0xf79b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf79b('0x9'));var _=require(_0xf79b('0xa'));var squel=require(_0xf79b('0xb'));var crypto=require('crypto');var jsforce=require(_0xf79b('0xc'));var deskjs=require(_0xf79b('0xd'));var toCsv=require(_0xf79b('0x8'));var querystring=require(_0xf79b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf79b('0xf'));var qs=require(_0xf79b('0x10'));var as=require(_0xf79b('0x11'));var hardwareService=require(_0xf79b('0x12'));var logger=require(_0xf79b('0x13'))(_0xf79b('0x14'));var utils=require(_0xf79b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf79b('0x16'));var db=require(_0xf79b('0x17'))['db'];function respondWithStatusCode(_0x1e7c75,_0x1bf2bf){_0x1bf2bf=_0x1bf2bf||0xcc;return function(_0x38e886){if(_0x38e886){return _0x1e7c75[_0xf79b('0x18')](_0x1bf2bf);}return _0x1e7c75[_0xf79b('0x19')](_0x1bf2bf)[_0xf79b('0x1a')]();};}function respondWithResult(_0x1ac99c,_0xe046eb){_0xe046eb=_0xe046eb||0xc8;return function(_0x1bd011){if(_0x1bd011){return _0x1ac99c[_0xf79b('0x19')](_0xe046eb)['json'](_0x1bd011);}};}function respondWithFilteredResult(_0x487967,_0x1647c5){return function(_0x595790){if(_0x595790){var _0x3caf78=typeof _0x1647c5['offset']===_0xf79b('0x1b')&&typeof _0x1647c5['limit']==='undefined';var _0x14b21d=_0x595790['count'];var _0x387e4e=_0x3caf78?0x0:_0x1647c5[_0xf79b('0x1c')];var _0x202d01=_0x3caf78?_0x595790['count']:_0x1647c5[_0xf79b('0x1c')]+_0x1647c5['limit'];var _0x379ac0;if(_0x202d01>=_0x14b21d){_0x202d01=_0x14b21d;_0x379ac0=0xc8;}else{_0x379ac0=0xce;}_0x487967[_0xf79b('0x19')](_0x379ac0);return _0x487967[_0xf79b('0x1d')](_0xf79b('0x1e'),_0x387e4e+'-'+_0x202d01+'/'+_0x14b21d)[_0xf79b('0x1f')](_0x595790);}return null;};}function patchUpdates(_0x4c91a6){return function(_0x27f68b){try{jsonpatch['apply'](_0x27f68b,_0x4c91a6,!![]);}catch(_0x5d33fa){return BPromise[_0xf79b('0x20')](_0x5d33fa);}return _0x27f68b[_0xf79b('0x21')]();};}function saveUpdates(_0x20a975,_0x400cfd){return function(_0x20a503){if(_0x20a503){return _0x20a503[_0xf79b('0x22')](_0x20a975)['then'](function(_0x255c13){return _0x255c13;});}return null;};}function removeEntity(_0x471e42,_0x378db3){return function(_0x13a339){if(_0x13a339){return _0x13a339[_0xf79b('0x23')]()[_0xf79b('0x24')](function(){_0x471e42[_0xf79b('0x19')](0xcc)[_0xf79b('0x1a')]();});}};}function handleEntityNotFound(_0xf1480e,_0x31bd2a){return function(_0x5c9dfb){if(!_0x5c9dfb){_0xf1480e[_0xf79b('0x18')](0x194);}return _0x5c9dfb;};}function handleError(_0x5e7f72,_0x55740a){_0x55740a=_0x55740a||0x1f4;return function(_0x1a99e3){logger['error'](_0x1a99e3[_0xf79b('0x25')]);if(_0x1a99e3[_0xf79b('0x26')]){delete _0x1a99e3[_0xf79b('0x26')];}_0x5e7f72[_0xf79b('0x19')](_0x55740a)[_0xf79b('0x27')](_0x1a99e3);};}exports[_0xf79b('0x28')]=function(_0x3e6171,_0x479b41){var _0x1bd31c={},_0x470f5b={},_0x1a4a13={'count':0x0,'rows':[]};var _0x5751f9=_[_0xf79b('0x29')](db[_0xf79b('0x2a')]['rawAttributes'],function(_0x152b06){return{'name':_0x152b06['fieldName'],'type':_0x152b06[_0xf79b('0x2b')][_0xf79b('0x2c')]};});_0x470f5b[_0xf79b('0x2d')]=_[_0xf79b('0x29')](_0x5751f9,_0xf79b('0x26'));_0x470f5b[_0xf79b('0x2e')]=_[_0xf79b('0x2f')](_0x3e6171[_0xf79b('0x2e')]);_0x470f5b['filters']=_[_0xf79b('0x30')](_0x470f5b[_0xf79b('0x2d')],_0x470f5b[_0xf79b('0x2e')]);_0x1bd31c[_0xf79b('0x31')]=_[_0xf79b('0x30')](_0x470f5b['model'],qs['fields'](_0x3e6171[_0xf79b('0x2e')][_0xf79b('0x32')]));_0x1bd31c[_0xf79b('0x31')]=_0x1bd31c[_0xf79b('0x31')][_0xf79b('0x33')]?_0x1bd31c['attributes']:_0x470f5b['model'];if(!_0x3e6171[_0xf79b('0x2e')][_0xf79b('0x34')](_0xf79b('0x35'))){_0x1bd31c[_0xf79b('0x36')]=qs[_0xf79b('0x36')](_0x3e6171[_0xf79b('0x2e')]['limit']);_0x1bd31c[_0xf79b('0x1c')]=qs[_0xf79b('0x1c')](_0x3e6171[_0xf79b('0x2e')][_0xf79b('0x1c')]);}_0x1bd31c[_0xf79b('0x37')]=qs['sort'](_0x3e6171[_0xf79b('0x2e')]['sort']);_0x1bd31c[_0xf79b('0x38')]=qs['filters'](_[_0xf79b('0x39')](_0x3e6171[_0xf79b('0x2e')],_0x470f5b[_0xf79b('0x3a')]),_0x5751f9);if(_0x3e6171[_0xf79b('0x2e')]['filter']){_0x1bd31c['where']=_['merge'](_0x1bd31c[_0xf79b('0x38')],{'$or':_[_0xf79b('0x29')](_0x5751f9,function(_0x5d0953){if(_0x5d0953[_0xf79b('0x2b')]!=='VIRTUAL'){var _0x14501a={};_0x14501a[_0x5d0953[_0xf79b('0x26')]]={'$like':'%'+_0x3e6171[_0xf79b('0x2e')]['filter']+'%'};return _0x14501a;}})});}_0x1bd31c=_[_0xf79b('0x3b')]({},_0x1bd31c,_0x3e6171[_0xf79b('0x3c')]);var _0x4ae653={'where':_0x1bd31c[_0xf79b('0x38')]};return db['ChatQueueReport'][_0xf79b('0x3d')](_0x4ae653)[_0xf79b('0x24')](function(_0x17bf96){_0x1a4a13[_0xf79b('0x3d')]=_0x17bf96;if(_0x3e6171[_0xf79b('0x2e')][_0xf79b('0x3e')]){_0x1bd31c[_0xf79b('0x3f')]=[{'all':!![]}];}return db[_0xf79b('0x2a')][_0xf79b('0x40')](_0x1bd31c);})[_0xf79b('0x24')](function(_0x1cbb9a){_0x1a4a13[_0xf79b('0x41')]=_0x1cbb9a;return _0x1a4a13;})['then'](respondWithFilteredResult(_0x479b41,_0x1bd31c))[_0xf79b('0x42')](handleError(_0x479b41,null));};exports[_0xf79b('0x43')]=function(_0x4e495d,_0x4a1a04){var _0x12e8a1={'raw':!![],'where':{'id':_0x4e495d[_0xf79b('0x44')]['id']}},_0x3953c8={};_0x3953c8[_0xf79b('0x2d')]=_[_0xf79b('0x2f')](db['ChatQueueReport'][_0xf79b('0x45')]);_0x3953c8[_0xf79b('0x2e')]=_[_0xf79b('0x2f')](_0x4e495d[_0xf79b('0x2e')]);_0x3953c8[_0xf79b('0x3a')]=_[_0xf79b('0x30')](_0x3953c8[_0xf79b('0x2d')],_0x3953c8[_0xf79b('0x2e')]);_0x12e8a1[_0xf79b('0x31')]=_[_0xf79b('0x30')](_0x3953c8[_0xf79b('0x2d')],qs[_0xf79b('0x32')](_0x4e495d[_0xf79b('0x2e')][_0xf79b('0x32')]));_0x12e8a1[_0xf79b('0x31')]=_0x12e8a1[_0xf79b('0x31')]['length']?_0x12e8a1[_0xf79b('0x31')]:_0x3953c8['model'];if(_0x4e495d[_0xf79b('0x2e')][_0xf79b('0x3e')]){_0x12e8a1[_0xf79b('0x3f')]=[{'all':!![]}];}_0x12e8a1=_[_0xf79b('0x3b')]({},_0x12e8a1,_0x4e495d[_0xf79b('0x3c')]);return db[_0xf79b('0x2a')][_0xf79b('0x46')](_0x12e8a1)[_0xf79b('0x24')](handleEntityNotFound(_0x4a1a04,null))[_0xf79b('0x24')](respondWithResult(_0x4a1a04,null))['catch'](handleError(_0x4a1a04,null));};exports['create']=function(_0xba74c7,_0x58fade){return db['ChatQueueReport']['create'](_0xba74c7[_0xf79b('0x47')],{})[_0xf79b('0x24')](respondWithResult(_0x58fade,0xc9))[_0xf79b('0x42')](handleError(_0x58fade,null));};exports['update']=function(_0xe5b3e6,_0xc61317){if(_0xe5b3e6['body']['id']){delete _0xe5b3e6[_0xf79b('0x47')]['id'];}return db[_0xf79b('0x2a')]['find']({'where':{'id':_0xe5b3e6[_0xf79b('0x44')]['id']}})[_0xf79b('0x24')](handleEntityNotFound(_0xc61317,null))[_0xf79b('0x24')](saveUpdates(_0xe5b3e6[_0xf79b('0x47')],null))[_0xf79b('0x24')](respondWithResult(_0xc61317,null))[_0xf79b('0x42')](handleError(_0xc61317,null));};exports[_0xf79b('0x23')]=function(_0x1ca74a,_0x5ed363){return db[_0xf79b('0x2a')][_0xf79b('0x46')]({'where':{'id':_0x1ca74a[_0xf79b('0x44')]['id']}})[_0xf79b('0x24')](handleEntityNotFound(_0x5ed363,null))[_0xf79b('0x24')](removeEntity(_0x5ed363,null))[_0xf79b('0x42')](handleError(_0x5ed363,null));};exports['describe']=function(_0x2ab57a,_0x5ee2b6){return db[_0xf79b('0x2a')][_0xf79b('0x48')]()[_0xf79b('0x24')](respondWithResult(_0x5ee2b6,null))['catch'](handleError(_0x5ee2b6,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index fede79d..2e8d576 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x126d11,_0xc695a8){var _0x5af4bc=function(_0xeacb2f){while(--_0xeacb2f){_0x126d11['push'](_0x126d11['shift']());}};_0x5af4bc(++_0xc695a8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x2847ec,_0x40ce19){var _0x507988=function(_0x3545a1){while(--_0x3545a1){_0x2847ec['push'](_0x2847ec['shift']());}};_0x507988(++_0x40ce19);}(_0xe706,0xa3));var _0x6e70=function(_0x4b573a,_0x13828a){_0x4b573a=_0x4b573a-0x0;var _0x1ae343=_0xe706[_0x4b573a];return _0x1ae343;};'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 b6bf352..d515435 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 _0xd020=['http','then','info','request\x20sent','debug','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','catch','create','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','update','where','attributes','limit','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x502fcf,_0x5c9c96){var _0x3c4186=function(_0x25ca2a){while(--_0x25ca2a){_0x502fcf['push'](_0x502fcf['shift']());}};_0x3c4186(++_0x5c9c96);}(_0xd020,0xab));var _0x0d02=function(_0x5dac37,_0x430287){_0x5dac37=_0x5dac37-0x0;var _0x4cb576=_0xd020[_0x5dac37];return _0x4cb576;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0d02('0x0'));var BPromise=require(_0x0d02('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d02('0x2'));var db=require(_0x0d02('0x3'))['db'];var utils=require(_0x0d02('0x4'));var logger=require(_0x0d02('0x5'))(_0x0d02('0x6'));var config=require(_0x0d02('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d02('0x8')][_0x0d02('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b15c3,_0x4e85d9,_0x457fac){return new BPromise(function(_0x5cdaa7,_0xfdd72e){return client['request'](_0x4b15c3,_0x457fac)[_0x0d02('0xa')](function(_0x579da6){logger[_0x0d02('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x4e85d9,_0x0d02('0xc'));logger[_0x0d02('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x4e85d9,'request\x20sent',JSON[_0x0d02('0xe')](_0x579da6));if(_0x579da6[_0x0d02('0xf')]){if(_0x579da6[_0x0d02('0xf')][_0x0d02('0x10')]===0x1f4){logger[_0x0d02('0xf')](_0x0d02('0x11'),_0x4e85d9,_0x579da6['error'][_0x0d02('0x12')]);return _0xfdd72e(_0x579da6[_0x0d02('0xf')][_0x0d02('0x12')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x4e85d9,_0x579da6[_0x0d02('0xf')][_0x0d02('0x12')]);return _0x5cdaa7(_0x579da6[_0x0d02('0xf')][_0x0d02('0x12')]);}else{logger[_0x0d02('0xb')](_0x0d02('0x11'),_0x4e85d9,_0x0d02('0xc'));_0x5cdaa7(_0x579da6['result'][_0x0d02('0x12')]);}})[_0x0d02('0x13')](function(_0x1ed975){logger[_0x0d02('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x4e85d9,_0x1ed975);_0xfdd72e(_0x1ed975);});});}exports['CreateChatQueueReport']=function(_0x24b3af){var _0x2f8b66=this;return new Promise(function(_0x5ddb35,_0x2a356c){return db['ChatQueueReport'][_0x0d02('0x14')](_0x24b3af[_0x0d02('0x15')],{'raw':_0x24b3af['options']?_0x24b3af[_0x0d02('0x16')][_0x0d02('0x17')]===undefined?!![]:![]:!![]})[_0x0d02('0xa')](function(_0x495e36){logger[_0x0d02('0xb')]('CreateChatQueueReport',_0x24b3af);logger[_0x0d02('0xd')](_0x0d02('0x18'),_0x24b3af,JSON[_0x0d02('0xe')](_0x495e36));_0x5ddb35(_0x495e36);})[_0x0d02('0x13')](function(_0x29025f){logger['error'](_0x0d02('0x18'),_0x29025f['message'],_0x24b3af);_0x2a356c(_0x2f8b66[_0x0d02('0xf')](0x1f4,_0x29025f[_0x0d02('0x12')]));});});};exports[_0x0d02('0x19')]=function(_0x2e1da2){var _0x4354bd=this;return new Promise(function(_0x516693,_0x38680d){return db['ChatQueueReport'][_0x0d02('0x1a')](_0x2e1da2[_0x0d02('0x15')],{'raw':_0x2e1da2[_0x0d02('0x16')]?_0x2e1da2[_0x0d02('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e1da2['options']?_0x2e1da2[_0x0d02('0x16')][_0x0d02('0x1b')]||null:null,'attributes':_0x2e1da2[_0x0d02('0x16')]?_0x2e1da2[_0x0d02('0x16')][_0x0d02('0x1c')]||null:null,'limit':_0x2e1da2['options']?_0x2e1da2[_0x0d02('0x16')][_0x0d02('0x1d')]||null:null})[_0x0d02('0xa')](function(_0x5cd721){logger[_0x0d02('0xb')](_0x0d02('0x19'),_0x2e1da2);logger[_0x0d02('0xd')]('UpdateChatQueueReport',_0x2e1da2,JSON['stringify'](_0x5cd721));_0x516693(_0x5cd721);})[_0x0d02('0x13')](function(_0x1c32a5){logger[_0x0d02('0xf')]('UpdateChatQueueReport',_0x1c32a5[_0x0d02('0x12')],_0x2e1da2);_0x38680d(_0x4354bd[_0x0d02('0xf')](0x1f4,_0x1c32a5[_0x0d02('0x12')]));});});}; \ No newline at end of file +var _0x7f5e=['error','code','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','stringify','UpdateChatQueueReport','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x350322,_0x445604){var _0x1d6fea=function(_0x3ae5cb){while(--_0x3ae5cb){_0x350322['push'](_0x350322['shift']());}};_0x1d6fea(++_0x445604);}(_0x7f5e,0x139));var _0xe7f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7f5e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe7f5('0x0'));var util=require(_0xe7f5('0x1'));var moment=require('moment');var BPromise=require(_0xe7f5('0x2'));var rs=require(_0xe7f5('0x3'));var fs=require('fs');var Redis=require(_0xe7f5('0x4'));var db=require(_0xe7f5('0x5'))['db'];var utils=require(_0xe7f5('0x6'));var logger=require(_0xe7f5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe7f5('0x8'));var client=jayson[_0xe7f5('0x9')][_0xe7f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d870f,_0x109d1c,_0x6caf0d){return new BPromise(function(_0x2b528b,_0x2b7095){return client[_0xe7f5('0xb')](_0x3d870f,_0x6caf0d)[_0xe7f5('0xc')](function(_0x304323){logger['info'](_0xe7f5('0xd'),_0x109d1c,_0xe7f5('0xe'));logger[_0xe7f5('0xf')](_0xe7f5('0x10'),_0x109d1c,_0xe7f5('0xe'),JSON['stringify'](_0x304323));if(_0x304323[_0xe7f5('0x11')]){if(_0x304323[_0xe7f5('0x11')][_0xe7f5('0x12')]===0x1f4){logger[_0xe7f5('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x109d1c,_0x304323[_0xe7f5('0x11')][_0xe7f5('0x13')]);return _0x2b7095(_0x304323[_0xe7f5('0x11')][_0xe7f5('0x13')]);}logger['error'](_0xe7f5('0xd'),_0x109d1c,_0x304323['error'][_0xe7f5('0x13')]);return _0x2b528b(_0x304323[_0xe7f5('0x11')][_0xe7f5('0x13')]);}else{logger[_0xe7f5('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x109d1c,_0xe7f5('0xe'));_0x2b528b(_0x304323[_0xe7f5('0x15')][_0xe7f5('0x13')]);}})[_0xe7f5('0x16')](function(_0x5671aa){logger['error'](_0xe7f5('0xd'),_0x109d1c,_0x5671aa);_0x2b7095(_0x5671aa);});});}exports[_0xe7f5('0x17')]=function(_0x214824){var _0x5ce8c7=this;return new Promise(function(_0x2bdaf8,_0x3141f2){return db[_0xe7f5('0x18')]['create'](_0x214824[_0xe7f5('0x19')],{'raw':_0x214824[_0xe7f5('0x1a')]?_0x214824[_0xe7f5('0x1a')][_0xe7f5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2b7ef0){logger['info'](_0xe7f5('0x17'),_0x214824);logger[_0xe7f5('0xf')](_0xe7f5('0x17'),_0x214824,JSON[_0xe7f5('0x1c')](_0x2b7ef0));_0x2bdaf8(_0x2b7ef0);})[_0xe7f5('0x16')](function(_0x377233){logger[_0xe7f5('0x11')](_0xe7f5('0x17'),_0x377233['message'],_0x214824);_0x3141f2(_0x5ce8c7[_0xe7f5('0x11')](0x1f4,_0x377233[_0xe7f5('0x13')]));});});};exports[_0xe7f5('0x1d')]=function(_0x3aceca){var _0x3dcb99=this;return new Promise(function(_0x54aa75,_0x11d3df){return db[_0xe7f5('0x18')]['update'](_0x3aceca[_0xe7f5('0x19')],{'raw':_0x3aceca[_0xe7f5('0x1a')]?_0x3aceca[_0xe7f5('0x1a')][_0xe7f5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aceca['options']?_0x3aceca[_0xe7f5('0x1a')][_0xe7f5('0x1e')]||null:null,'attributes':_0x3aceca[_0xe7f5('0x1a')]?_0x3aceca['options'][_0xe7f5('0x1f')]||null:null,'limit':_0x3aceca[_0xe7f5('0x1a')]?_0x3aceca['options'][_0xe7f5('0x20')]||null:null})[_0xe7f5('0xc')](function(_0x30a03a){logger['info'](_0xe7f5('0x1d'),_0x3aceca);logger[_0xe7f5('0xf')](_0xe7f5('0x1d'),_0x3aceca,JSON[_0xe7f5('0x1c')](_0x30a03a));_0x54aa75(_0x30a03a);})[_0xe7f5('0x16')](function(_0x166bff){logger[_0xe7f5('0x11')](_0xe7f5('0x1d'),_0x166bff['message'],_0x3aceca);_0x11d3df(_0x3dcb99['error'](0x1f4,_0x166bff[_0xe7f5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index a6711f0..70cfaa8 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 _0x2e13=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x336fe7,_0xb1a2e8){var _0xd976e=function(_0x42fc78){while(--_0x42fc78){_0x336fe7['push'](_0x336fe7['shift']());}};_0xd976e(++_0xb1a2e8);}(_0x2e13,0xd3));var _0x32e1=function(_0x11598d,_0x334e7d){_0x11598d=_0x11598d-0x0;var _0x36210b=_0x2e13[_0x11598d];return _0x36210b;};'use strict';var multer=require(_0x32e1('0x0'));var util=require(_0x32e1('0x1'));var path=require(_0x32e1('0x2'));var timeout=require(_0x32e1('0x3'));var express=require(_0x32e1('0x4'));var router=express[_0x32e1('0x5')]();var fs_extra=require(_0x32e1('0x6'));var auth=require(_0x32e1('0x7'));var interaction=require(_0x32e1('0x8'));var config=require(_0x32e1('0x9'));var controller=require('./chatQueueReport.controller');router[_0x32e1('0xa')]('/',auth[_0x32e1('0xb')](),controller[_0x32e1('0xc')]);router[_0x32e1('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x32e1('0xa')](_0x32e1('0xd'),auth[_0x32e1('0xb')](),controller[_0x32e1('0xe')]);router[_0x32e1('0xf')]('/',auth[_0x32e1('0xb')](),controller[_0x32e1('0x10')]);router[_0x32e1('0x11')](_0x32e1('0xd'),auth[_0x32e1('0xb')](),controller[_0x32e1('0x12')]);router[_0x32e1('0x13')]('/:id',auth[_0x32e1('0xb')](),controller[_0x32e1('0x14')]);module[_0x32e1('0x15')]=router; \ No newline at end of file +var _0xd86d=['get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0xdeab51,_0x5cb7ca){var _0x597a97=function(_0x53fe7e){while(--_0x53fe7e){_0xdeab51['push'](_0xdeab51['shift']());}};_0x597a97(++_0x5cb7ca);}(_0xd86d,0xd3));var _0xdd86=function(_0x5f2f74,_0x48e50a){_0x5f2f74=_0x5f2f74-0x0;var _0x2d4176=_0xd86d[_0x5f2f74];return _0x2d4176;};'use strict';var multer=require(_0xdd86('0x0'));var util=require(_0xdd86('0x1'));var path=require(_0xdd86('0x2'));var timeout=require(_0xdd86('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdd86('0x4'));var auth=require(_0xdd86('0x5'));var interaction=require(_0xdd86('0x6'));var config=require(_0xdd86('0x7'));var controller=require(_0xdd86('0x8'));router[_0xdd86('0x9')]('/',auth[_0xdd86('0xa')](),controller[_0xdd86('0xb')]);router[_0xdd86('0x9')](_0xdd86('0xc'),auth[_0xdd86('0xa')](),controller[_0xdd86('0xd')]);router[_0xdd86('0x9')](_0xdd86('0xe'),auth[_0xdd86('0xa')](),controller['show']);router[_0xdd86('0xf')]('/',auth[_0xdd86('0xa')](),controller[_0xdd86('0x10')]);router[_0xdd86('0x11')](_0xdd86('0xe'),auth[_0xdd86('0xa')](),controller[_0xdd86('0x12')]);router[_0xdd86('0x13')](_0xdd86('0xe'),auth[_0xdd86('0xa')](),controller[_0xdd86('0x14')]);module[_0xdd86('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 86ad55e..21525de 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(_0x38c919,_0x5e0561){var _0x2947d9=function(_0x502753){while(--_0x502753){_0x38c919['push'](_0x38c919['shift']());}};_0x2947d9(++_0x5e0561);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3f3325,_0x51e8ba){_0x3f3325=_0x3f3325-0x0;var _0x28337b=_0xf4eb[_0x3f3325];return _0x28337b;};'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(_0x2c85c0,_0x1dac4f){var _0xf4d4c9=function(_0xcd61ab){while(--_0xcd61ab){_0x2c85c0['push'](_0x2c85c0['shift']());}};_0xf4d4c9(++_0x1dac4f);}(_0x54ef,0x112));var _0xf54e=function(_0x4a84ae,_0x2baa1f){_0x4a84ae=_0x4a84ae-0x0;var _0xdac11=_0x54ef[_0x4a84ae];return _0xdac11;};'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 fca61f3..c44ae26 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 _0xd749=['moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','map','ChatTransferReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','params','fields','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x3ba79c,_0x1547d2){var _0xd2d1a4=function(_0x429fd1){while(--_0x429fd1){_0x3ba79c['push'](_0x3ba79c['shift']());}};_0xd2d1a4(++_0x1547d2);}(_0xd749,0x92));var _0x9d74=function(_0xfec622,_0x3e51fd){_0xfec622=_0xfec622-0x0;var _0x9b0b2f=_0xd749[_0xfec622];return _0x9b0b2f;};'use strict';var emlformat=require(_0x9d74('0x0'));var rimraf=require(_0x9d74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d74('0x2'));var rp=require(_0x9d74('0x3'));var moment=require(_0x9d74('0x4'));var BPromise=require(_0x9d74('0x5'));var Mustache=require(_0x9d74('0x6'));var util=require('util');var path=require(_0x9d74('0x7'));var sox=require(_0x9d74('0x8'));var csv=require(_0x9d74('0x9'));var ejs=require(_0x9d74('0xa'));var fs=require('fs');var fs_extra=require(_0x9d74('0xb'));var _=require(_0x9d74('0xc'));var squel=require(_0x9d74('0xd'));var crypto=require(_0x9d74('0xe'));var jsforce=require(_0x9d74('0xf'));var deskjs=require(_0x9d74('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9d74('0x11'));var Papa=require(_0x9d74('0x12'));var Redis=require(_0x9d74('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9d74('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d74('0x15'))(_0x9d74('0x16'));var utils=require('../../config/utils');var config=require(_0x9d74('0x17'));var licenseUtil=require(_0x9d74('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ad884,_0x5bd938){_0x5bd938=_0x5bd938||0xcc;return function(_0xa45bef){if(_0xa45bef){return _0x2ad884['sendStatus'](_0x5bd938);}return _0x2ad884[_0x9d74('0x19')](_0x5bd938)['end']();};}function respondWithResult(_0xd3d875,_0x5ef83f){_0x5ef83f=_0x5ef83f||0xc8;return function(_0x3e2423){if(_0x3e2423){return _0xd3d875['status'](_0x5ef83f)[_0x9d74('0x1a')](_0x3e2423);}};}function respondWithFilteredResult(_0x262744,_0x2286f3){return function(_0x5bed0c){if(_0x5bed0c){var _0x5dbdf3=typeof _0x2286f3[_0x9d74('0x1b')]===_0x9d74('0x1c')&&typeof _0x2286f3['limit']==='undefined';var _0x54d3b2=_0x5bed0c[_0x9d74('0x1d')];var _0x3e68b0=_0x5dbdf3?0x0:_0x2286f3[_0x9d74('0x1b')];var _0x19d49e=_0x5dbdf3?_0x5bed0c['count']:_0x2286f3['offset']+_0x2286f3[_0x9d74('0x1e')];var _0x590a86;if(_0x19d49e>=_0x54d3b2){_0x19d49e=_0x54d3b2;_0x590a86=0xc8;}else{_0x590a86=0xce;}_0x262744['status'](_0x590a86);return _0x262744['set'](_0x9d74('0x1f'),_0x3e68b0+'-'+_0x19d49e+'/'+_0x54d3b2)[_0x9d74('0x1a')](_0x5bed0c);}return null;};}function patchUpdates(_0x5e04c8){return function(_0x19129e){try{jsonpatch[_0x9d74('0x20')](_0x19129e,_0x5e04c8,!![]);}catch(_0x4b8a37){return BPromise[_0x9d74('0x21')](_0x4b8a37);}return _0x19129e[_0x9d74('0x22')]();};}function saveUpdates(_0x326c6d,_0x2d8902){return function(_0x4fc39e){if(_0x4fc39e){return _0x4fc39e[_0x9d74('0x23')](_0x326c6d)['then'](function(_0x3956a6){return _0x3956a6;});}return null;};}function removeEntity(_0x220c8a,_0x4e6e81){return function(_0x841ec2){if(_0x841ec2){return _0x841ec2[_0x9d74('0x24')]()['then'](function(){_0x220c8a['status'](0xcc)[_0x9d74('0x25')]();});}};}function handleEntityNotFound(_0x4b1196,_0x57c805){return function(_0x96e48c){if(!_0x96e48c){_0x4b1196[_0x9d74('0x26')](0x194);}return _0x96e48c;};}function handleError(_0x4b57b4,_0x5449f4){_0x5449f4=_0x5449f4||0x1f4;return function(_0x87fcb8){logger[_0x9d74('0x27')](_0x87fcb8[_0x9d74('0x28')]);if(_0x87fcb8[_0x9d74('0x29')]){delete _0x87fcb8[_0x9d74('0x29')];}_0x4b57b4[_0x9d74('0x19')](_0x5449f4)['send'](_0x87fcb8);};}exports['index']=function(_0x13c14b,_0xa6dae6){var _0x36f36b={},_0xc46b8e={},_0x211ba6={'count':0x0,'rows':[]};var _0x3fbb03=_[_0x9d74('0x2a')](db[_0x9d74('0x2b')][_0x9d74('0x2c')],function(_0x185b4c){return{'name':_0x185b4c[_0x9d74('0x2d')],'type':_0x185b4c['type']['key']};});_0xc46b8e[_0x9d74('0x2e')]=_[_0x9d74('0x2a')](_0x3fbb03,_0x9d74('0x29'));_0xc46b8e[_0x9d74('0x2f')]=_[_0x9d74('0x30')](_0x13c14b[_0x9d74('0x2f')]);_0xc46b8e[_0x9d74('0x31')]=_[_0x9d74('0x32')](_0xc46b8e['model'],_0xc46b8e[_0x9d74('0x2f')]);_0x36f36b[_0x9d74('0x33')]=_[_0x9d74('0x32')](_0xc46b8e[_0x9d74('0x2e')],qs['fields'](_0x13c14b[_0x9d74('0x2f')]['fields']));_0x36f36b[_0x9d74('0x33')]=_0x36f36b['attributes'][_0x9d74('0x34')]?_0x36f36b[_0x9d74('0x33')]:_0xc46b8e[_0x9d74('0x2e')];if(!_0x13c14b[_0x9d74('0x2f')][_0x9d74('0x35')](_0x9d74('0x36'))){_0x36f36b[_0x9d74('0x1e')]=qs['limit'](_0x13c14b[_0x9d74('0x2f')][_0x9d74('0x1e')]);_0x36f36b[_0x9d74('0x1b')]=qs['offset'](_0x13c14b['query'][_0x9d74('0x1b')]);}_0x36f36b['order']=qs[_0x9d74('0x37')](_0x13c14b['query'][_0x9d74('0x37')]);_0x36f36b[_0x9d74('0x38')]=qs[_0x9d74('0x31')](_[_0x9d74('0x39')](_0x13c14b[_0x9d74('0x2f')],_0xc46b8e['filters']),_0x3fbb03);if(_0x13c14b[_0x9d74('0x2f')][_0x9d74('0x3a')]){_0x36f36b[_0x9d74('0x38')]=_[_0x9d74('0x3b')](_0x36f36b[_0x9d74('0x38')],{'$or':_[_0x9d74('0x2a')](_0x3fbb03,function(_0x33e40c){if(_0x33e40c[_0x9d74('0x3c')]!==_0x9d74('0x3d')){var _0x214832={};_0x214832[_0x33e40c['name']]={'$like':'%'+_0x13c14b[_0x9d74('0x2f')][_0x9d74('0x3a')]+'%'};return _0x214832;}})});}_0x36f36b=_[_0x9d74('0x3b')]({},_0x36f36b,_0x13c14b[_0x9d74('0x3e')]);var _0x5982ee={'where':_0x36f36b[_0x9d74('0x38')]};return db[_0x9d74('0x2b')][_0x9d74('0x1d')](_0x5982ee)['then'](function(_0x1f8b77){_0x211ba6[_0x9d74('0x1d')]=_0x1f8b77;if(_0x13c14b[_0x9d74('0x2f')][_0x9d74('0x3f')]){_0x36f36b[_0x9d74('0x40')]=[{'all':!![]}];}return db[_0x9d74('0x2b')][_0x9d74('0x41')](_0x36f36b);})[_0x9d74('0x42')](function(_0x561bae){_0x211ba6[_0x9d74('0x43')]=_0x561bae;return _0x211ba6;})[_0x9d74('0x42')](respondWithFilteredResult(_0xa6dae6,_0x36f36b))[_0x9d74('0x44')](handleError(_0xa6dae6,null));};exports['show']=function(_0x4fe13f,_0x7d8ef9){var _0x517665={'raw':!![],'where':{'id':_0x4fe13f[_0x9d74('0x45')]['id']}},_0xf4506e={};_0xf4506e[_0x9d74('0x2e')]=_['keys'](db['ChatTransferReport'][_0x9d74('0x2c')]);_0xf4506e[_0x9d74('0x2f')]=_[_0x9d74('0x30')](_0x4fe13f[_0x9d74('0x2f')]);_0xf4506e[_0x9d74('0x31')]=_['intersection'](_0xf4506e[_0x9d74('0x2e')],_0xf4506e[_0x9d74('0x2f')]);_0x517665[_0x9d74('0x33')]=_[_0x9d74('0x32')](_0xf4506e[_0x9d74('0x2e')],qs[_0x9d74('0x46')](_0x4fe13f[_0x9d74('0x2f')][_0x9d74('0x46')]));_0x517665[_0x9d74('0x33')]=_0x517665[_0x9d74('0x33')][_0x9d74('0x34')]?_0x517665['attributes']:_0xf4506e[_0x9d74('0x2e')];if(_0x4fe13f[_0x9d74('0x2f')][_0x9d74('0x3f')]){_0x517665[_0x9d74('0x40')]=[{'all':!![]}];}_0x517665=_[_0x9d74('0x3b')]({},_0x517665,_0x4fe13f[_0x9d74('0x3e')]);return db['ChatTransferReport'][_0x9d74('0x47')](_0x517665)[_0x9d74('0x42')](handleEntityNotFound(_0x7d8ef9,null))['then'](respondWithResult(_0x7d8ef9,null))[_0x9d74('0x44')](handleError(_0x7d8ef9,null));};exports[_0x9d74('0x48')]=function(_0x372130,_0x1b41ac){return db[_0x9d74('0x2b')][_0x9d74('0x48')](_0x372130[_0x9d74('0x49')],{})['then'](respondWithResult(_0x1b41ac,0xc9))['catch'](handleError(_0x1b41ac,null));};exports[_0x9d74('0x23')]=function(_0x158861,_0x5a9f86){if(_0x158861[_0x9d74('0x49')]['id']){delete _0x158861[_0x9d74('0x49')]['id'];}return db[_0x9d74('0x2b')]['find']({'where':{'id':_0x158861[_0x9d74('0x45')]['id']}})[_0x9d74('0x42')](handleEntityNotFound(_0x5a9f86,null))[_0x9d74('0x42')](saveUpdates(_0x158861[_0x9d74('0x49')],null))[_0x9d74('0x42')](respondWithResult(_0x5a9f86,null))[_0x9d74('0x44')](handleError(_0x5a9f86,null));};exports['destroy']=function(_0x9a8a85,_0x3958a8){return db[_0x9d74('0x2b')][_0x9d74('0x47')]({'where':{'id':_0x9a8a85['params']['id']}})[_0x9d74('0x42')](handleEntityNotFound(_0x3958a8,null))[_0x9d74('0x42')](removeEntity(_0x3958a8,null))[_0x9d74('0x44')](handleError(_0x3958a8,null));};exports[_0x9d74('0x4a')]=function(_0x1cecc7,_0x14bbd4){return db[_0x9d74('0x2b')][_0x9d74('0x4a')]()['then'](respondWithResult(_0x14bbd4,null))['catch'](handleError(_0x14bbd4,null));}; \ No newline at end of file +var _0xe854=['ChatTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','create','body','find','catch','describe','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x1f6dd4,_0x20132f){var _0x398228=function(_0x26236d){while(--_0x26236d){_0x1f6dd4['push'](_0x1f6dd4['shift']());}};_0x398228(++_0x20132f);}(_0xe854,0xb6));var _0x4e85=function(_0x2af235,_0x45f664){_0x2af235=_0x2af235-0x0;var _0x593c0e=_0xe854[_0x2af235];return _0x593c0e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4e85('0x0'));var jsonpatch=require(_0x4e85('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4e85('0x2'));var Mustache=require(_0x4e85('0x3'));var util=require(_0x4e85('0x4'));var path=require(_0x4e85('0x5'));var sox=require(_0x4e85('0x6'));var csv=require(_0x4e85('0x7'));var ejs=require(_0x4e85('0x8'));var fs=require('fs');var fs_extra=require(_0x4e85('0x9'));var _=require(_0x4e85('0xa'));var squel=require(_0x4e85('0xb'));var crypto=require(_0x4e85('0xc'));var jsforce=require(_0x4e85('0xd'));var deskjs=require(_0x4e85('0xe'));var toCsv=require(_0x4e85('0x7'));var querystring=require(_0x4e85('0xf'));var Papa=require('papaparse');var Redis=require(_0x4e85('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4e85('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e85('0x12'))(_0x4e85('0x13'));var utils=require('../../config/utils');var config=require(_0x4e85('0x14'));var licenseUtil=require(_0x4e85('0x15'));var db=require(_0x4e85('0x16'))['db'];function respondWithStatusCode(_0x15f3ca,_0x57a5e7){_0x57a5e7=_0x57a5e7||0xcc;return function(_0x381b7b){if(_0x381b7b){return _0x15f3ca[_0x4e85('0x17')](_0x57a5e7);}return _0x15f3ca[_0x4e85('0x18')](_0x57a5e7)[_0x4e85('0x19')]();};}function respondWithResult(_0x94476,_0x49361c){_0x49361c=_0x49361c||0xc8;return function(_0x135903){if(_0x135903){return _0x94476[_0x4e85('0x18')](_0x49361c)[_0x4e85('0x1a')](_0x135903);}};}function respondWithFilteredResult(_0x5093ca,_0x2fcc32){return function(_0xa698bd){if(_0xa698bd){var _0x423562=typeof _0x2fcc32[_0x4e85('0x1b')]===_0x4e85('0x1c')&&typeof _0x2fcc32[_0x4e85('0x1d')]===_0x4e85('0x1c');var _0x23fee2=_0xa698bd[_0x4e85('0x1e')];var _0x891bdf=_0x423562?0x0:_0x2fcc32[_0x4e85('0x1b')];var _0x51f2a9=_0x423562?_0xa698bd['count']:_0x2fcc32[_0x4e85('0x1b')]+_0x2fcc32[_0x4e85('0x1d')];var _0x457d04;if(_0x51f2a9>=_0x23fee2){_0x51f2a9=_0x23fee2;_0x457d04=0xc8;}else{_0x457d04=0xce;}_0x5093ca['status'](_0x457d04);return _0x5093ca['set']('Content-Range',_0x891bdf+'-'+_0x51f2a9+'/'+_0x23fee2)['json'](_0xa698bd);}return null;};}function patchUpdates(_0x7375d7){return function(_0x11a6dc){try{jsonpatch[_0x4e85('0x1f')](_0x11a6dc,_0x7375d7,!![]);}catch(_0x282acd){return BPromise[_0x4e85('0x20')](_0x282acd);}return _0x11a6dc[_0x4e85('0x21')]();};}function saveUpdates(_0x2321eb,_0x683cd6){return function(_0x38f6d2){if(_0x38f6d2){return _0x38f6d2[_0x4e85('0x22')](_0x2321eb)[_0x4e85('0x23')](function(_0x10fa87){return _0x10fa87;});}return null;};}function removeEntity(_0x46fdec,_0x436778){return function(_0x5dad69){if(_0x5dad69){return _0x5dad69[_0x4e85('0x24')]()[_0x4e85('0x23')](function(){_0x46fdec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x324028,_0x3e69bc){return function(_0x1a0000){if(!_0x1a0000){_0x324028['sendStatus'](0x194);}return _0x1a0000;};}function handleError(_0x4eb145,_0x203fc2){_0x203fc2=_0x203fc2||0x1f4;return function(_0x4baaf4){logger[_0x4e85('0x25')](_0x4baaf4[_0x4e85('0x26')]);if(_0x4baaf4[_0x4e85('0x27')]){delete _0x4baaf4['name'];}_0x4eb145[_0x4e85('0x18')](_0x203fc2)[_0x4e85('0x28')](_0x4baaf4);};}exports[_0x4e85('0x29')]=function(_0x3f98d1,_0x23cea5){var _0x5c5afe={},_0x40b1b3={},_0x41df7f={'count':0x0,'rows':[]};var _0x317cd1=_[_0x4e85('0x2a')](db[_0x4e85('0x2b')][_0x4e85('0x2c')],function(_0x5ac67f){return{'name':_0x5ac67f[_0x4e85('0x2d')],'type':_0x5ac67f[_0x4e85('0x2e')][_0x4e85('0x2f')]};});_0x40b1b3['model']=_[_0x4e85('0x2a')](_0x317cd1,'name');_0x40b1b3[_0x4e85('0x30')]=_[_0x4e85('0x31')](_0x3f98d1['query']);_0x40b1b3[_0x4e85('0x32')]=_[_0x4e85('0x33')](_0x40b1b3[_0x4e85('0x34')],_0x40b1b3['query']);_0x5c5afe[_0x4e85('0x35')]=_[_0x4e85('0x33')](_0x40b1b3[_0x4e85('0x34')],qs[_0x4e85('0x36')](_0x3f98d1['query']['fields']));_0x5c5afe[_0x4e85('0x35')]=_0x5c5afe['attributes'][_0x4e85('0x37')]?_0x5c5afe[_0x4e85('0x35')]:_0x40b1b3[_0x4e85('0x34')];if(!_0x3f98d1[_0x4e85('0x30')][_0x4e85('0x38')](_0x4e85('0x39'))){_0x5c5afe[_0x4e85('0x1d')]=qs[_0x4e85('0x1d')](_0x3f98d1[_0x4e85('0x30')][_0x4e85('0x1d')]);_0x5c5afe[_0x4e85('0x1b')]=qs['offset'](_0x3f98d1[_0x4e85('0x30')][_0x4e85('0x1b')]);}_0x5c5afe[_0x4e85('0x3a')]=qs[_0x4e85('0x3b')](_0x3f98d1['query']['sort']);_0x5c5afe[_0x4e85('0x3c')]=qs[_0x4e85('0x32')](_['pick'](_0x3f98d1['query'],_0x40b1b3[_0x4e85('0x32')]),_0x317cd1);if(_0x3f98d1['query'][_0x4e85('0x3d')]){_0x5c5afe[_0x4e85('0x3c')]=_['merge'](_0x5c5afe[_0x4e85('0x3c')],{'$or':_['map'](_0x317cd1,function(_0x3f3ca3){if(_0x3f3ca3[_0x4e85('0x2e')]!==_0x4e85('0x3e')){var _0x42076f={};_0x42076f[_0x3f3ca3[_0x4e85('0x27')]]={'$like':'%'+_0x3f98d1[_0x4e85('0x30')]['filter']+'%'};return _0x42076f;}})});}_0x5c5afe=_[_0x4e85('0x3f')]({},_0x5c5afe,_0x3f98d1[_0x4e85('0x40')]);var _0xd8c40b={'where':_0x5c5afe[_0x4e85('0x3c')]};return db[_0x4e85('0x2b')][_0x4e85('0x1e')](_0xd8c40b)[_0x4e85('0x23')](function(_0x387664){_0x41df7f[_0x4e85('0x1e')]=_0x387664;if(_0x3f98d1['query'][_0x4e85('0x41')]){_0x5c5afe[_0x4e85('0x42')]=[{'all':!![]}];}return db[_0x4e85('0x2b')]['findAll'](_0x5c5afe);})[_0x4e85('0x23')](function(_0x26d28d){_0x41df7f[_0x4e85('0x43')]=_0x26d28d;return _0x41df7f;})[_0x4e85('0x23')](respondWithFilteredResult(_0x23cea5,_0x5c5afe))['catch'](handleError(_0x23cea5,null));};exports[_0x4e85('0x44')]=function(_0x325059,_0x8bad44){var _0x445516={'raw':!![],'where':{'id':_0x325059[_0x4e85('0x45')]['id']}},_0x1539d9={};_0x1539d9[_0x4e85('0x34')]=_[_0x4e85('0x31')](db[_0x4e85('0x2b')]['rawAttributes']);_0x1539d9[_0x4e85('0x30')]=_[_0x4e85('0x31')](_0x325059[_0x4e85('0x30')]);_0x1539d9[_0x4e85('0x32')]=_[_0x4e85('0x33')](_0x1539d9[_0x4e85('0x34')],_0x1539d9[_0x4e85('0x30')]);_0x445516['attributes']=_[_0x4e85('0x33')](_0x1539d9[_0x4e85('0x34')],qs[_0x4e85('0x36')](_0x325059[_0x4e85('0x30')][_0x4e85('0x36')]));_0x445516[_0x4e85('0x35')]=_0x445516['attributes'][_0x4e85('0x37')]?_0x445516[_0x4e85('0x35')]:_0x1539d9['model'];if(_0x325059[_0x4e85('0x30')][_0x4e85('0x41')]){_0x445516['include']=[{'all':!![]}];}_0x445516=_[_0x4e85('0x3f')]({},_0x445516,_0x325059[_0x4e85('0x40')]);return db[_0x4e85('0x2b')]['find'](_0x445516)['then'](handleEntityNotFound(_0x8bad44,null))[_0x4e85('0x23')](respondWithResult(_0x8bad44,null))['catch'](handleError(_0x8bad44,null));};exports['create']=function(_0x247e14,_0x152558){return db[_0x4e85('0x2b')][_0x4e85('0x46')](_0x247e14[_0x4e85('0x47')],{})[_0x4e85('0x23')](respondWithResult(_0x152558,0xc9))['catch'](handleError(_0x152558,null));};exports[_0x4e85('0x22')]=function(_0x22f7b5,_0x1c77af){if(_0x22f7b5['body']['id']){delete _0x22f7b5[_0x4e85('0x47')]['id'];}return db[_0x4e85('0x2b')][_0x4e85('0x48')]({'where':{'id':_0x22f7b5[_0x4e85('0x45')]['id']}})[_0x4e85('0x23')](handleEntityNotFound(_0x1c77af,null))[_0x4e85('0x23')](saveUpdates(_0x22f7b5[_0x4e85('0x47')],null))['then'](respondWithResult(_0x1c77af,null))['catch'](handleError(_0x1c77af,null));};exports['destroy']=function(_0x3854e4,_0x51f128){return db[_0x4e85('0x2b')][_0x4e85('0x48')]({'where':{'id':_0x3854e4[_0x4e85('0x45')]['id']}})[_0x4e85('0x23')](handleEntityNotFound(_0x51f128,null))[_0x4e85('0x23')](removeEntity(_0x51f128,null))[_0x4e85('0x49')](handleError(_0x51f128,null));};exports['describe']=function(_0x1ef18e,_0x10d316){return db[_0x4e85('0x2b')][_0x4e85('0x4a')]()[_0x4e85('0x23')](respondWithResult(_0x10d316,null))['catch'](handleError(_0x10d316,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index b5ce5a0..447bf66 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 _0x5e66=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer'];(function(_0x2ee06b,_0x5d8f95){var _0xdc564d=function(_0x50d18d){while(--_0x50d18d){_0x2ee06b['push'](_0x2ee06b['shift']());}};_0xdc564d(++_0x5d8f95);}(_0x5e66,0x17a));var _0x65e6=function(_0x36c595,_0x7d662){_0x36c595=_0x36c595-0x0;var _0x5f15ed=_0x5e66[_0x36c595];return _0x5f15ed;};'use strict';var _=require(_0x65e6('0x0'));var util=require(_0x65e6('0x1'));var logger=require(_0x65e6('0x2'))(_0x65e6('0x3'));var moment=require('moment');var BPromise=require(_0x65e6('0x4'));var rp=require(_0x65e6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x65e6('0x6'));var config=require(_0x65e6('0x7'));var attributes=require(_0x65e6('0x8'));module[_0x65e6('0x9')]=function(_0x4623ef,_0x2166ba){return _0x4623ef[_0x65e6('0xa')]('ChatTransferReport',attributes,{'tableName':_0x65e6('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x65e6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x59f5=['define','ChatTransferReport','report_chat_transfer','lodash','util','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x59f5,0xdf));var _0x559f=function(_0x16e1b4,_0x304ee7){_0x16e1b4=_0x16e1b4-0x0;var _0x551db1=_0x59f5[_0x16e1b4];return _0x551db1;};'use strict';var _=require(_0x559f('0x0'));var util=require(_0x559f('0x1'));var logger=require('../../config/logger')(_0x559f('0x2'));var moment=require(_0x559f('0x3'));var BPromise=require('bluebird');var rp=require(_0x559f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x559f('0x5'));var config=require(_0x559f('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x559f('0x7')]=function(_0x3ddfe2,_0x36ee8e){return _0x3ddfe2[_0x559f('0x8')](_0x559f('0x9'),attributes,{'tableName':_0x559f('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 5a43064..aa72429 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 _0xfbae=['util','moment','bluebird','randomstring','../../mysqldb','rpc','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfbae,0x87));var _0xefba=function(_0x49a67d,_0x1a7ae6){_0x49a67d=_0x49a67d-0x0;var _0x24dba1=_0xfbae[_0x49a67d];return _0x24dba1;};'use strict';var _=require('lodash');var util=require(_0xefba('0x0'));var moment=require(_0xefba('0x1'));var BPromise=require(_0xefba('0x2'));var rs=require(_0xefba('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefba('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xefba('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8eca89,_0xcf40a3,_0x429973){return new BPromise(function(_0x2c44ea,_0x1a6473){return client[_0xefba('0x6')](_0x8eca89,_0x429973)[_0xefba('0x7')](function(_0x577aad){logger[_0xefba('0x8')](_0xefba('0x9'),_0xcf40a3,_0xefba('0xa'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xcf40a3,_0xefba('0xa'),JSON[_0xefba('0xb')](_0x577aad));if(_0x577aad[_0xefba('0xc')]){if(_0x577aad[_0xefba('0xc')][_0xefba('0xd')]===0x1f4){logger[_0xefba('0xc')](_0xefba('0x9'),_0xcf40a3,_0x577aad[_0xefba('0xc')][_0xefba('0xe')]);return _0x1a6473(_0x577aad['error'][_0xefba('0xe')]);}logger[_0xefba('0xc')](_0xefba('0x9'),_0xcf40a3,_0x577aad[_0xefba('0xc')][_0xefba('0xe')]);return _0x2c44ea(_0x577aad[_0xefba('0xc')]['message']);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0xcf40a3,'request\x20sent');_0x2c44ea(_0x577aad['result'][_0xefba('0xe')]);}})['catch'](function(_0x4d03b3){logger[_0xefba('0xc')](_0xefba('0x9'),_0xcf40a3,_0x4d03b3);_0x1a6473(_0x4d03b3);});});} \ No newline at end of file +var _0xed78=['message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','stringify','error','code','ChatTransferReport,\x20%s,\x20%s'];(function(_0x72aff0,_0x2cbe3f){var _0x452b01=function(_0x391f8f){while(--_0x391f8f){_0x72aff0['push'](_0x72aff0['shift']());}};_0x452b01(++_0x2cbe3f);}(_0xed78,0x13e));var _0x8ed7=function(_0x5bcf90,_0x8dea1b){_0x5bcf90=_0x5bcf90-0x0;var _0x59cd27=_0xed78[_0x5bcf90];return _0x59cd27;};'use strict';var _=require(_0x8ed7('0x0'));var util=require(_0x8ed7('0x1'));var moment=require('moment');var BPromise=require(_0x8ed7('0x2'));var rs=require(_0x8ed7('0x3'));var fs=require('fs');var Redis=require(_0x8ed7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ed7('0x5'));var logger=require(_0x8ed7('0x6'))(_0x8ed7('0x7'));var config=require(_0x8ed7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8ed7('0x9')][_0x8ed7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4148b7,_0x4add14,_0x39928a){return new BPromise(function(_0x2bf001,_0x1b4cd7){return client[_0x8ed7('0xb')](_0x4148b7,_0x39928a)[_0x8ed7('0xc')](function(_0x207d1b){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x4add14,'request\x20sent');logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4add14,_0x8ed7('0xd'),JSON[_0x8ed7('0xe')](_0x207d1b));if(_0x207d1b[_0x8ed7('0xf')]){if(_0x207d1b[_0x8ed7('0xf')][_0x8ed7('0x10')]===0x1f4){logger[_0x8ed7('0xf')](_0x8ed7('0x11'),_0x4add14,_0x207d1b['error'][_0x8ed7('0x12')]);return _0x1b4cd7(_0x207d1b['error'][_0x8ed7('0x12')]);}logger[_0x8ed7('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x4add14,_0x207d1b[_0x8ed7('0xf')][_0x8ed7('0x12')]);return _0x2bf001(_0x207d1b[_0x8ed7('0xf')]['message']);}else{logger[_0x8ed7('0x13')](_0x8ed7('0x11'),_0x4add14,'request\x20sent');_0x2bf001(_0x207d1b['result'][_0x8ed7('0x12')]);}})[_0x8ed7('0x14')](function(_0x5ad9e8){logger['error'](_0x8ed7('0x11'),_0x4add14,_0x5ad9e8);_0x1b4cd7(_0x5ad9e8);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 268d86e..1a47669 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 _0x3990=['delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put'];(function(_0x7c317d,_0x5806ae){var _0x40b74c=function(_0x3a9a15){while(--_0x3a9a15){_0x7c317d['push'](_0x7c317d['shift']());}};_0x40b74c(++_0x5806ae);}(_0x3990,0xb7));var _0x0399=function(_0x1ab681,_0x204fb8){_0x1ab681=_0x1ab681-0x0;var _0x32bf08=_0x3990[_0x1ab681];return _0x32bf08;};'use strict';var multer=require('multer');var util=require(_0x0399('0x0'));var path=require('path');var timeout=require(_0x0399('0x1'));var express=require(_0x0399('0x2'));var router=express[_0x0399('0x3')]();var fs_extra=require(_0x0399('0x4'));var auth=require(_0x0399('0x5'));var interaction=require(_0x0399('0x6'));var config=require('../../config/environment');var controller=require(_0x0399('0x7'));router[_0x0399('0x8')]('/',auth[_0x0399('0x9')](),controller[_0x0399('0xa')]);router[_0x0399('0x8')](_0x0399('0xb'),auth[_0x0399('0x9')](),controller[_0x0399('0xc')]);router[_0x0399('0x8')](_0x0399('0xd'),auth[_0x0399('0x9')](),controller['show']);router[_0x0399('0xe')]('/',auth[_0x0399('0x9')](),controller[_0x0399('0xf')]);router[_0x0399('0x10')](_0x0399('0xd'),auth[_0x0399('0x9')](),controller['update']);router[_0x0399('0x11')](_0x0399('0xd'),auth[_0x0399('0x9')](),controller[_0x0399('0x12')]);module[_0x0399('0x13')]=router; \ No newline at end of file +var _0x5de6=['isAuthenticated','show','post','put','update','delete','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','describe','/:id'];(function(_0x37208d,_0x72da3e){var _0x3f60c4=function(_0x441617){while(--_0x441617){_0x37208d['push'](_0x37208d['shift']());}};_0x3f60c4(++_0x72da3e);}(_0x5de6,0x126));var _0x65de=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5de6[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x65de('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x65de('0x1'));var express=require(_0x65de('0x2'));var router=express['Router']();var fs_extra=require(_0x65de('0x3'));var auth=require(_0x65de('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x65de('0x5'));var controller=require(_0x65de('0x6'));router[_0x65de('0x7')]('/',auth['isAuthenticated'](),controller[_0x65de('0x8')]);router[_0x65de('0x7')](_0x65de('0x9'),auth['isAuthenticated'](),controller[_0x65de('0xa')]);router['get'](_0x65de('0xb'),auth[_0x65de('0xc')](),controller[_0x65de('0xd')]);router[_0x65de('0xe')]('/',auth[_0x65de('0xc')](),controller['create']);router[_0x65de('0xf')](_0x65de('0xb'),auth['isAuthenticated'](),controller[_0x65de('0x10')]);router[_0x65de('0x11')](_0x65de('0xb'),auth[_0x65de('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index e589b76..79e00d0 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 _0x19cf=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','CHAT','alternate','#fafafa'];(function(_0x5d0cd4,_0x54add2){var _0x345816=function(_0xf24de7){while(--_0xf24de7){_0x5d0cd4['push'](_0x5d0cd4['shift']());}};_0x345816(++_0x54add2);}(_0x19cf,0x1ef));var _0xf19c=function(_0x900b5b,_0x25bb14){_0x900b5b=_0x900b5b-0x0;var _0x173700=_0x19cf[_0x900b5b];return _0x173700;};'use strict';var Sequelize=require(_0xf19c('0x0'));var rs=require('randomstring');module[_0xf19c('0x1')]={'name':{'type':Sequelize[_0xf19c('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xf19c('0x2')],'allowNull':![],'unique':_0xf19c('0x3')},'description':{'type':Sequelize[_0xf19c('0x2')]},'mapKey':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0xf19c('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf19c('0x2')],'allowNull':![],'defaultValue':_0xf19c('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf19c('0x2')],'allowNull':![],'defaultValue':_0xf19c('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf19c('0x2')],'allowNull':![],'defaultValue':_0xf19c('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xf19c('0x2')],'allowNull':![],'defaultValue':_0xf19c('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf19c('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf19c('0x2')]},'animation':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf19c('0xa')](_0xf19c('0xb'),_0xf19c('0xc')),'defaultValue':_0xf19c('0xb')},'header_online':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0xd')},'start_chat_button':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0xe')},'offline_chat_button':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0xf')},'header_offline':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0x10')},'download_transcript':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf19c('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf19c('0x11')]},'closingQuestion':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0x12')},'noteTitle':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0x13')},'placeholderMessage':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0x14')},'closingMessage':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xf19c('0xf')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xf19c('0x16')},'conditionAgreement':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0x17')},'ratingType':{'type':Sequelize[_0xf19c('0xa')](_0xf19c('0x18'),_0xf19c('0x19')),'defaultValue':_0xf19c('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xf19c('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf19c('0x1a')]({'items':[{'type':_0xf19c('0x1b'),'variable':null,'config':{'placeholder':_0xf19c('0x1c'),'type':_0xf19c('0x1d'),'required':!![]},'props':{'title':_0xf19c('0x1c'),'helpText':''}},{'type':'input','props':{'title':_0xf19c('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xf19c('0x4'),'type':_0xf19c('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf19c('0x1e')](_0xf19c('0x1f'))?JSON[_0xf19c('0x20')](this[_0xf19c('0x1e')](_0xf19c('0x1f'))):{};},'set':function(_0x3354af){return this[_0xf19c('0x21')](_0xf19c('0x1f'),JSON[_0xf19c('0x1a')](_0x3354af));}},'offlineForm':{'type':Sequelize[_0xf19c('0x11')],'defaultValue':function(){return JSON[_0xf19c('0x1a')]({'items':[{'type':_0xf19c('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf19c('0x4'),'type':_0xf19c('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0xf19c('0x22'),'helpText':_0xf19c('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xf19c('0x1e')](_0xf19c('0x24'))?JSON[_0xf19c('0x20')](this[_0xf19c('0x1e')]('offlineForm')):{};},'set':function(_0x57f743){return this['setDataValue'](_0xf19c('0x24'),JSON['stringify'](_0x57f743));}},'token':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf19c('0x2')]},'forwardOffline':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf19c('0x2')]},'waitingTitle':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0x26')},'offlineMessageBody':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0x27')},'skipUnmanaged':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0x16')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xf19c('0xf')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf19c('0x11')]},'showAgentAvatar':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf19c('0x2')]},'notificationTemplate':{'type':Sequelize[_0xf19c('0x11')],'defaultValue':function(){return _0xf19c('0x28');}},'notificationSound':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xf19c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xf19c('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xf19c('0x29')},'messagesAlignment':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':_0xf19c('0x2a')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xf19c('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf19c('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf19c('0x2')],'allowNull':![],'defaultValue':_0xf19c('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf19c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf19c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf19c('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xf19c('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf19c('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':![],'comment':_0xf19c('0x2c'),'set':function(_0x30a5d6){if(!_0x30a5d6)this[_0xf19c('0x21')](_0xf19c('0x2d'),null);this[_0xf19c('0x21')](_0xf19c('0x2e'),_0x30a5d6);}},'vidaooEscalation':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf19c('0x2')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf19c('0x2f')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xf19c('0x30');}},'vidaooMetadata':{'type':Sequelize[_0xf19c('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf19c('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf19c('0x11')]}}; \ No newline at end of file +var _0x8051=['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.','Send','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','stringify','input','name','getDataValue','onlineForm','setDataValue','textarea','Comments','offlineForm','parse','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'];(function(_0x270016,_0x328f45){var _0x41906a=function(_0x35a677){while(--_0x35a677){_0x270016['push'](_0x270016['shift']());}};_0x41906a(++_0x328f45);}(_0x8051,0x107));var _0x1805=function(_0x50a149,_0x25bdc0){_0x50a149=_0x50a149-0x0;var _0x50ebdb=_0x8051[_0x50a149];return _0x50ebdb;};'use strict';var Sequelize=require(_0x1805('0x0'));var rs=require(_0x1805('0x1'));module[_0x1805('0x2')]={'name':{'type':Sequelize[_0x1805('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x1805('0x3')],'allowNull':![],'unique':_0x1805('0x4')},'description':{'type':Sequelize[_0x1805('0x3')]},'mapKey':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x5')},'mapKeyOffline':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x5')},'key':{'type':Sequelize[_0x1805('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x1805('0x3')],'allowNull':![],'defaultValue':_0x1805('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x1805('0x3')],'allowNull':![],'defaultValue':_0x1805('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x1805('0x3')],'allowNull':![],'defaultValue':_0x1805('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1805('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1805('0x3')]},'animation':{'type':Sequelize[_0x1805('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x1805('0xb')](_0x1805('0xc'),_0x1805('0xd')),'defaultValue':_0x1805('0xc')},'header_online':{'type':Sequelize[_0x1805('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x1805('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x1805('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x1805('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x1805('0xf')]},'closingQuestion':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x1805('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x12')},'noteTitle':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x13')},'placeholderMessage':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x14')},'closingMessage':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x15')},'closingMessageButton':{'type':Sequelize[_0x1805('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x16')},'conditionAgreement':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x1805('0x17')},'ratingType':{'type':Sequelize[_0x1805('0xb')](_0x1805('0x18'),'thumb'),'defaultValue':_0x1805('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x1805('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1805('0x19')]({'items':[{'type':_0x1805('0x1a'),'variable':null,'config':{'placeholder':_0x1805('0x1b'),'type':'text','required':!![]},'props':{'title':_0x1805('0x1b'),'helpText':''}},{'type':_0x1805('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x1805('0x5'),'type':_0x1805('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x1805('0x1c')](_0x1805('0x1d'))?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x4b2035){return this[_0x1805('0x1e')](_0x1805('0x1d'),JSON[_0x1805('0x19')](_0x4b2035));}},'offlineForm':{'type':Sequelize[_0x1805('0xf')],'defaultValue':function(){return JSON[_0x1805('0x19')]({'items':[{'type':_0x1805('0x1a'),'props':{'title':_0x1805('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x1805('0x5'),'type':_0x1805('0x5')},'variable':null},{'type':_0x1805('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0x1805('0x20'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x1805('0x21'))?JSON[_0x1805('0x22')](this['getDataValue']('offlineForm')):{};},'set':function(_0x4665b1){return this[_0x1805('0x1e')]('offlineForm',JSON[_0x1805('0x19')](_0x4665b1));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x1805('0x23')]();}},'autoclose':{'type':Sequelize[_0x1805('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x1805('0x3')]},'forwardOffline':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x1805('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x25')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x1805('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x1805('0x16')},'sendUnmanaged':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x28')},'enableCustomerAttachment':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x1805('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1805('0x3')]},'notificationTemplate':{'type':Sequelize[_0x1805('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1805('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x1805('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1805('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x29')},'verticalAlignment':{'type':Sequelize[_0x1805('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x2a')},'messagesAlignment':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x2b')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x1805('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1805('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1805('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1805('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1805('0x3')],'defaultValue':_0x1805('0x2d')},'systemAvatar':{'type':Sequelize[_0x1805('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1805('0x9')],'comment':_0x1805('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x7e1cf8){if(!_0x7e1cf8)this[_0x1805('0x1e')](_0x1805('0x2f'),null);this[_0x1805('0x1e')](_0x1805('0x30'),_0x7e1cf8);}},'vidaooEscalation':{'type':Sequelize[_0x1805('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x1805('0x3')],'allowNull':![],'defaultValue':_0x1805('0x31')},'vidaooNote':{'type':Sequelize[_0x1805('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x1805('0xa')],'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 0c3ad19..2f37e41 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 _0x12a1=['addProactiveActions','getProactiveActions','ChatProactiveAction','false','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','addAgents','omit','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','User','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','user-agent-parser','../../config/logger','api','../../config/environment','url','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','../../mysqldb','redis','defaults','localhost','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','limit','count','set','update','get','ChatWebsites','sendStatus','stack','name','send','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','model','vendor','%s\x20%s\x20%s','type','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','Disposition','findOne','hasOwnProperty','ChatWebsiteId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sitepic','addAvatar','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','From\x20is\x20mandatory','MapKey\x20is\x20mandatory','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','includes','createdAt','updatedAt','mapKey','from','CmList','List','Contacts','ChatApplication','Applications','Interval','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','ifTime','account','applications','list','orderBy','priority','asc','contact','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','firstName','messageId','autoclose','close','*,*,*,*','UserId','unshift','agent','queueId','ChatQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','offline','files','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','Sequelize','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','ListId','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','remove','addInteraction','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','getLicense','virtual','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','origin','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','color','labelText','textButtonColor','hideWhenOffline','IntervalId','transaction','Transaction','findAndCountAll','getApplications','chatProactiveAction'];(function(_0x4628da,_0x5064c8){var _0x42829e=function(_0x57126f){while(--_0x57126f){_0x4628da['push'](_0x4628da['shift']());}};_0x42829e(++_0x5064c8);}(_0x12a1,0x13a));var _0x112a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x12a1[_0x14add3];return _0x4a174f;};'use strict';var Mustache=require(_0x112a('0x0'));var util=require(_0x112a('0x1'));var path=require(_0x112a('0x2'));var ejs=require(_0x112a('0x3'));var fs=require('fs');var fs_extra=require(_0x112a('0x4'));var _=require(_0x112a('0x5'));var querystring=require(_0x112a('0x6'));var Redis=require(_0x112a('0x7'));var UAParser=require(_0x112a('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0x112a('0x9'))(_0x112a('0xa'));var config=require(_0x112a('0xb'));var url=require(_0x112a('0xc'));var APIBadRequestError=require(_0x112a('0xd'))[_0x112a('0xe')];var APINotFoundError=require('../../errors/api')[_0x112a('0xf')];var APIOutOfIntervalError=require(_0x112a('0xd'))[_0x112a('0x10')];var APIHandleError=require('../../errors/api')[_0x112a('0x11')];var db=require(_0x112a('0x12'))['db'];config[_0x112a('0x13')]=_[_0x112a('0x14')](config[_0x112a('0x13')],{'host':_0x112a('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x112a('0x13')]));require('./chatWebsite.socket')[_0x112a('0x16')](socket);var htmlToText=require('html-to-text');var jayson=require('jayson/promise');var client=jayson[_0x112a('0x17')][_0x112a('0x18')]({'port':0x232c});var client9002=jayson[_0x112a('0x17')][_0x112a('0x18')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0x112a('0x17')][_0x112a('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x58a56e,_0x247c77,_0x5b16b7,_0x5a769e){return new Promise(function(_0x3f9107,_0x1df5e5){var _0x596dec=_0x5a769e||client;return _0x596dec[_0x112a('0x19')](_0x58a56e,_0x5b16b7)[_0x112a('0x1a')](function(_0x52676f){logger[_0x112a('0x1b')](_0x112a('0x1c'),_0x247c77,_0x112a('0x1d'));logger[_0x112a('0x1e')](_0x112a('0x1f'),_0x247c77,_0x112a('0x1d'),JSON[_0x112a('0x20')](_0x52676f));if(_0x52676f[_0x112a('0x21')]){if(_0x52676f[_0x112a('0x21')][_0x112a('0x22')]===0x1f4){logger[_0x112a('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x247c77,_0x52676f[_0x112a('0x21')][_0x112a('0x23')]);return _0x1df5e5(_0x52676f[_0x112a('0x21')]['message']);}logger[_0x112a('0x21')](_0x112a('0x1c'),_0x247c77,_0x52676f[_0x112a('0x21')][_0x112a('0x23')]);return _0x3f9107(_0x52676f['error']['message']);}else{logger['info'](_0x112a('0x1c'),_0x247c77,_0x112a('0x1d'));_0x3f9107(_0x52676f[_0x112a('0x24')][_0x112a('0x23')]);}})[_0x112a('0x25')](function(_0x13618b){logger[_0x112a('0x21')](_0x112a('0x1c'),_0x247c77,_0x13618b);_0x1df5e5(_0x13618b);});});}function respondWithStatusCode(_0x3e2707,_0x1b4d85){_0x1b4d85=_0x1b4d85||0xcc;return function(_0x1d6db9){if(_0x1d6db9){return _0x3e2707['sendStatus'](_0x1b4d85);}return _0x3e2707[_0x112a('0x26')](_0x1b4d85)['end']();};}function respondWithResult(_0x2a25c8,_0x33cc80){_0x33cc80=_0x33cc80||0xc8;return function(_0x299923){if(_0x299923){return _0x2a25c8['status'](_0x33cc80)[_0x112a('0x27')](_0x299923);}};}function respondWithFilteredResult(_0x55b134,_0x514dee){return function(_0x67d7f6){if(_0x67d7f6){var _0x5c7522=typeof _0x514dee[_0x112a('0x28')]==='undefined'&&typeof _0x514dee[_0x112a('0x29')]==='undefined';var _0x2a5193=_0x67d7f6['count'];var _0x5a7046=_0x5c7522?0x0:_0x514dee[_0x112a('0x28')];var _0x33acf2=_0x5c7522?_0x67d7f6[_0x112a('0x2a')]:_0x514dee['offset']+_0x514dee[_0x112a('0x29')];var _0x476289;if(_0x33acf2>=_0x2a5193){_0x33acf2=_0x2a5193;_0x476289=0xc8;}else{_0x476289=0xce;}_0x55b134[_0x112a('0x26')](_0x476289);return _0x55b134[_0x112a('0x2b')]('Content-Range',_0x5a7046+'-'+_0x33acf2+'/'+_0x2a5193)[_0x112a('0x27')](_0x67d7f6);}return null;};}function saveUpdates(_0x25a9eb){return function(_0x1f2846){if(_0x1f2846){return _0x1f2846[_0x112a('0x2c')](_0x25a9eb)[_0x112a('0x1a')](function(_0x148789){return _0x148789;});}return null;};}function removeEntity(_0x262331){return function(_0x18d2f1){if(_0x18d2f1){return _0x18d2f1['destroy']()[_0x112a('0x1a')](function(){var _0x845411=_0x18d2f1[_0x112a('0x2d')]({'plain':!![]});var _0x3b1e25=_0x112a('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x3b1e25,'resourceId':_0x845411['id']}})['then'](function(){return _0x18d2f1;});})[_0x112a('0x1a')](function(){_0x262331['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23deda){return function(_0x3f33ee){if(!_0x3f33ee){_0x23deda[_0x112a('0x2f')](0x194);}return _0x3f33ee;};}function handleError(_0x109cbb,_0x1979b5){_0x1979b5=_0x1979b5||0x1f4;return function(_0x3ab181){logger[_0x112a('0x21')](_0x3ab181[_0x112a('0x30')]);if(_0x3ab181[_0x112a('0x31')]){delete _0x3ab181[_0x112a('0x31')];}_0x109cbb[_0x112a('0x26')](_0x1979b5)[_0x112a('0x32')](_0x3ab181);};}function createInteractionObject(_0x1c7918,_0x29773b,_0x3262f2,_0x176ed2){var _0xde1bdc=new UAParser();var _0x1b5f1d=_0xde1bdc[_0x112a('0x33')](_0x3262f2[_0x112a('0x34')])[_0x112a('0x35')]();var _0x4f489a=_0x29773b[_0x112a('0x36')];if(_0x3262f2[_0x112a('0x37')]){_0x4f489a=_0x3262f2[_0x112a('0x37')];}else if(_0x3262f2[_0x112a('0x38')]){_0x4f489a=_[_0x112a('0x39')](_0x3262f2[_0x112a('0x38')][_0x112a('0x3a')](','));}return{'ContactId':_0x176ed2['id'],'ChatWebsiteId':_0x1c7918,'from':(_0x176ed2['firstName']||'')+'\x20'+(_0x176ed2[_0x112a('0x3b')]||''),'customerIp':_0x4f489a,'customerPort':_0x3262f2[_0x112a('0x3c')]?_0x3262f2[_0x112a('0x3c')]:null,'referer':_0x29773b[_0x112a('0x3d')],'browserName':_0x1b5f1d[_0x112a('0x3e')][_0x112a('0x31')]&&_0x1b5f1d[_0x112a('0x3e')]['version']?util[_0x112a('0x3f')](_0x112a('0x40'),_0x1b5f1d[_0x112a('0x3e')][_0x112a('0x31')],_0x1b5f1d[_0x112a('0x3e')][_0x112a('0x41')]):_0x112a('0x42'),'browserVersion':_0x1b5f1d[_0x112a('0x3e')]['version']||_0x112a('0x42'),'osName':util['format']('%s\x20%s',_0x1b5f1d['os'][_0x112a('0x31')],_0x1b5f1d['os'][_0x112a('0x41')]),'osVersion':_0x1b5f1d['os'][_0x112a('0x41')],'deviceModel':_0x1b5f1d[_0x112a('0x43')][_0x112a('0x44')]&&_0x1b5f1d['device'][_0x112a('0x45')]?util['format'](_0x112a('0x46'),_0x1b5f1d[_0x112a('0x43')][_0x112a('0x44')],_0x1b5f1d[_0x112a('0x43')][_0x112a('0x45')],_0x1b5f1d[_0x112a('0x43')]['type']):null,'deviceVendor':_0x1b5f1d[_0x112a('0x43')][_0x112a('0x45')],'deviceType':_0x1b5f1d[_0x112a('0x43')][_0x112a('0x47')],'formData':JSON['stringify'](_0x29773b)};}exports['index']=function(_0x33c75a,_0x207fbd){var _0x279365={'include':[{'model':db[_0x112a('0x48')],'as':_0x112a('0x49')}]},_0x15e1d7={},_0x43a9f2={'count':0x0,'rows':[]};var _0x198bb8=_[_0x112a('0x4a')](db[_0x112a('0x4b')][_0x112a('0x4c')],function(_0x43840b){return{'name':_0x43840b[_0x112a('0x4d')],'type':_0x43840b[_0x112a('0x47')]['key']};});_0x15e1d7[_0x112a('0x44')]=_[_0x112a('0x4a')](_0x198bb8,_0x112a('0x31'));_0x15e1d7[_0x112a('0x4e')]=_['keys'](_0x33c75a['query']);_0x15e1d7[_0x112a('0x4f')]=_[_0x112a('0x50')](_0x15e1d7[_0x112a('0x44')],_0x15e1d7[_0x112a('0x4e')]);_0x279365['attributes']=_[_0x112a('0x50')](_0x15e1d7[_0x112a('0x44')],qs[_0x112a('0x51')](_0x33c75a[_0x112a('0x4e')][_0x112a('0x51')]));_0x279365[_0x112a('0x52')]=_0x279365[_0x112a('0x52')][_0x112a('0x53')]?_0x279365[_0x112a('0x52')]:_0x15e1d7[_0x112a('0x44')];if(!_0x33c75a['query']['hasOwnProperty'](_0x112a('0x54'))){_0x279365['limit']=qs[_0x112a('0x29')](_0x33c75a[_0x112a('0x4e')][_0x112a('0x29')]);_0x279365[_0x112a('0x28')]=qs[_0x112a('0x28')](_0x33c75a[_0x112a('0x4e')][_0x112a('0x28')]);}_0x279365[_0x112a('0x55')]=qs[_0x112a('0x56')](_0x33c75a[_0x112a('0x4e')][_0x112a('0x56')]);_0x279365[_0x112a('0x57')]=qs['filters'](_[_0x112a('0x58')](_0x33c75a[_0x112a('0x4e')],_0x15e1d7[_0x112a('0x4f')]),_0x198bb8);if(_0x33c75a[_0x112a('0x4e')]['filter']){_0x279365['where']=_[_0x112a('0x59')](_0x279365['where'],{'$or':_[_0x112a('0x4a')](_0x198bb8,function(_0x1101b8){if(_0x1101b8[_0x112a('0x47')]!==_0x112a('0x5a')){var _0xeeb69={};_0xeeb69[_0x1101b8[_0x112a('0x31')]]={'$like':'%'+_0x33c75a['query'][_0x112a('0x5b')]+'%'};return _0xeeb69;}})});}_0x279365=_['merge']({},_0x279365,_0x33c75a[_0x112a('0x5c')]);var _0x22f6a3={'where':_0x279365[_0x112a('0x57')]};return db[_0x112a('0x4b')]['count'](_0x22f6a3)[_0x112a('0x1a')](function(_0x454b22){_0x43a9f2[_0x112a('0x2a')]=_0x454b22;if(_0x33c75a[_0x112a('0x4e')][_0x112a('0x5d')]){_0x279365[_0x112a('0x5e')]=[{'all':!![]}];}return db[_0x112a('0x4b')][_0x112a('0x5f')](_0x279365);})[_0x112a('0x1a')](function(_0xca601f){_0x43a9f2[_0x112a('0x60')]=_0xca601f;return _0x43a9f2;})[_0x112a('0x1a')](respondWithFilteredResult(_0x207fbd,_0x279365))['catch'](handleError(_0x207fbd,null));};exports[_0x112a('0x61')]=function(_0x298c11,_0x45fc0f){var _0x1d61f1={'raw':![],'where':{'id':_0x298c11[_0x112a('0x62')]['id']},'include':[{'model':db[_0x112a('0x48')],'as':'mandatoryDispositionPause'}]},_0x44ba69={};_0x44ba69[_0x112a('0x44')]=_[_0x112a('0x63')](db[_0x112a('0x4b')][_0x112a('0x4c')]);_0x44ba69[_0x112a('0x4e')]=_['keys'](_0x298c11[_0x112a('0x4e')]);_0x44ba69[_0x112a('0x4f')]=_['intersection'](_0x44ba69['model'],_0x44ba69['query']);_0x1d61f1[_0x112a('0x52')]=_['intersection'](_0x44ba69[_0x112a('0x44')],qs[_0x112a('0x51')](_0x298c11[_0x112a('0x4e')][_0x112a('0x51')]));_0x1d61f1['attributes']=_0x1d61f1[_0x112a('0x52')][_0x112a('0x53')]?_0x1d61f1[_0x112a('0x52')]:_0x44ba69[_0x112a('0x44')];if(_0x298c11[_0x112a('0x4e')]['includeAll']){_0x1d61f1['include']=[{'all':!![]}];}_0x1d61f1=_[_0x112a('0x59')]({},_0x1d61f1,_0x298c11[_0x112a('0x5c')]);return db[_0x112a('0x4b')][_0x112a('0x64')](_0x1d61f1)['then'](handleEntityNotFound(_0x45fc0f,null))[_0x112a('0x1a')](respondWithResult(_0x45fc0f,null))[_0x112a('0x25')](handleError(_0x45fc0f,null));};exports[_0x112a('0x65')]=function(_0x860afc,_0x10e0be){return db[_0x112a('0x4b')][_0x112a('0x65')](_0x860afc[_0x112a('0x66')],{})['then'](function(_0x3e53c3){var _0x313b49=_0x860afc[_0x112a('0x67')][_0x112a('0x2d')]({'plain':!![]});if(!_0x313b49)throw new Error(_0x112a('0x68'));if(_0x313b49[_0x112a('0x69')]==='user'){var _0x26d626=_0x3e53c3[_0x112a('0x2d')]({'plain':!![]});var _0x2d2afc=_0x112a('0x2e');return db['UserProfileSection'][_0x112a('0x64')]({'where':{'name':_0x2d2afc,'userProfileId':_0x313b49[_0x112a('0x6a')]},'raw':!![]})['then'](function(_0x5d67c6){if(_0x5d67c6&&_0x5d67c6[_0x112a('0x6b')]===0x0){return db[_0x112a('0x6c')]['create']({'name':_0x26d626[_0x112a('0x31')],'resourceId':_0x26d626['id'],'type':_0x5d67c6[_0x112a('0x31')],'sectionId':_0x5d67c6['id']},{})[_0x112a('0x1a')](function(){return _0x3e53c3;});}else{return _0x3e53c3;}})[_0x112a('0x25')](function(_0x40c00d){logger[_0x112a('0x21')](_0x112a('0x6d'),_0x40c00d);throw _0x40c00d;});}return _0x3e53c3;})['then'](respondWithResult(_0x10e0be,0xc9))[_0x112a('0x25')](handleError(_0x10e0be,null));};exports[_0x112a('0x2c')]=function(_0x4451cb,_0x1fef57){if(_0x4451cb[_0x112a('0x66')]['id']){delete _0x4451cb[_0x112a('0x66')]['id'];}return db[_0x112a('0x4b')][_0x112a('0x64')]({'where':{'id':_0x4451cb['params']['id']},'include':[{'model':db[_0x112a('0x48')],'as':_0x112a('0x49')}]})[_0x112a('0x1a')](handleEntityNotFound(_0x1fef57,null))['then'](saveUpdates(_0x4451cb['body'],null))[_0x112a('0x1a')](respondWithResult(_0x1fef57,null))['catch'](handleError(_0x1fef57,null));};exports[_0x112a('0x6e')]=function(_0x132501,_0x3d776c){return db['ChatWebsite'][_0x112a('0x64')]({'where':{'id':_0x132501[_0x112a('0x62')]['id']}})['then'](handleEntityNotFound(_0x3d776c,null))[_0x112a('0x1a')](removeEntity(_0x3d776c,null))[_0x112a('0x25')](handleError(_0x3d776c,null));};exports[_0x112a('0x6f')]=function(_0x8cda2e,_0x35f24c){return db[_0x112a('0x4b')]['describe']()[_0x112a('0x1a')](respondWithResult(_0x35f24c,null))[_0x112a('0x25')](handleError(_0x35f24c,null));};exports['addDisposition']=function(_0x3526cb,_0x54f7c7){if(_0x3526cb[_0x112a('0x66')]['id']){delete _0x3526cb[_0x112a('0x66')]['id'];}return db[_0x112a('0x4b')][_0x112a('0x64')]({'where':{'id':_0x3526cb[_0x112a('0x62')]['id']}})['then'](handleEntityNotFound(_0x54f7c7,null))[_0x112a('0x1a')](function(_0x452216){if(_0x452216){_0x3526cb[_0x112a('0x66')]['ChatWebsiteId']=_0x452216['id'];return db[_0x112a('0x70')]['create'](_0x3526cb['body']);}})[_0x112a('0x1a')](respondWithResult(_0x54f7c7,null))[_0x112a('0x25')](handleError(_0x54f7c7,null));};exports['getDispositions']=function(_0x5c9682,_0x284964){var _0x15c572={'raw':![],'where':{}};var _0x558cc0={};var _0x118384={'count':0x0,'rows':[]};return db[_0x112a('0x4b')][_0x112a('0x71')]({'where':{'id':_0x5c9682[_0x112a('0x62')]['id']}})['then'](handleEntityNotFound(_0x284964,null))[_0x112a('0x1a')](function(_0x4691e7){if(_0x4691e7){_0x558cc0[_0x112a('0x44')]=_[_0x112a('0x63')](db[_0x112a('0x70')][_0x112a('0x4c')]);_0x558cc0[_0x112a('0x4e')]=_[_0x112a('0x63')](_0x5c9682[_0x112a('0x4e')]);_0x558cc0[_0x112a('0x4f')]=_[_0x112a('0x50')](_0x558cc0[_0x112a('0x44')],_0x558cc0['query']);_0x15c572['attributes']=_[_0x112a('0x50')](_0x558cc0[_0x112a('0x44')],qs['fields'](_0x5c9682['query'][_0x112a('0x51')]));_0x15c572['attributes']=_0x15c572[_0x112a('0x52')][_0x112a('0x53')]?_0x15c572[_0x112a('0x52')]:_0x558cc0[_0x112a('0x44')];if(!_0x5c9682[_0x112a('0x4e')][_0x112a('0x72')](_0x112a('0x54'))){_0x15c572['limit']=qs[_0x112a('0x29')](_0x5c9682[_0x112a('0x4e')][_0x112a('0x29')]);_0x15c572['offset']=qs[_0x112a('0x28')](_0x5c9682[_0x112a('0x4e')][_0x112a('0x28')]);}_0x15c572[_0x112a('0x55')]=qs[_0x112a('0x56')](_0x5c9682[_0x112a('0x4e')][_0x112a('0x56')]);_0x15c572[_0x112a('0x57')]=qs['filters'](_[_0x112a('0x58')](_0x5c9682[_0x112a('0x4e')],_0x558cc0[_0x112a('0x4f')]));_0x15c572[_0x112a('0x57')][_0x112a('0x73')]=_0x4691e7['id'];if(_0x5c9682[_0x112a('0x4e')][_0x112a('0x5b')]){_0x15c572['where']=_[_0x112a('0x59')](_0x15c572[_0x112a('0x57')],{'$or':_[_0x112a('0x4a')](_0x15c572[_0x112a('0x52')],function(_0x12dde2){var _0x259467={};_0x259467[_0x12dde2]={'$like':'%'+_0x5c9682[_0x112a('0x4e')][_0x112a('0x5b')]+'%'};return _0x259467;})});}_0x15c572=_[_0x112a('0x59')]({},_0x15c572,_0x5c9682[_0x112a('0x5c')]);return db[_0x112a('0x70')][_0x112a('0x2a')]({'where':_0x15c572[_0x112a('0x57')]})['then'](function(_0x467eff){_0x118384[_0x112a('0x2a')]=_0x467eff;if(_0x5c9682[_0x112a('0x4e')]['includeAll']){_0x15c572[_0x112a('0x5e')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x15c572);})['then'](function(_0x2ff4c6){_0x118384[_0x112a('0x60')]=_0x2ff4c6;return _0x118384;});}})[_0x112a('0x1a')](respondWithFilteredResult(_0x284964,_0x15c572))[_0x112a('0x25')](handleError(_0x284964,null));};exports[_0x112a('0x74')]=function(_0x3f1d36,_0x4579ed){return db[_0x112a('0x4b')][_0x112a('0x64')]({'where':{'id':_0x3f1d36[_0x112a('0x62')]['id']}})['then'](handleEntityNotFound(_0x4579ed,null))['then'](function(_0x5b245c){if(_0x5b245c){return _0x5b245c[_0x112a('0x74')](_0x3f1d36[_0x112a('0x4e')][_0x112a('0x75')]);}})[_0x112a('0x1a')](respondWithStatusCode(_0x4579ed,null))[_0x112a('0x25')](handleError(_0x4579ed,null));};exports[_0x112a('0x76')]=function(_0x102816,_0x5c4c74){if(_0x102816[_0x112a('0x66')]['id']){delete _0x102816['body']['id'];}return db[_0x112a('0x4b')]['find']({'where':{'id':_0x102816[_0x112a('0x62')]['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0x5c4c74,null))[_0x112a('0x1a')](function(_0x453b9b){if(_0x453b9b){_0x102816['body'][_0x112a('0x73')]=_0x453b9b['id'];return db[_0x112a('0x77')][_0x112a('0x65')](_0x102816['body']);}})[_0x112a('0x1a')](respondWithResult(_0x5c4c74,null))[_0x112a('0x25')](handleError(_0x5c4c74,null));};exports['getAnswers']=function(_0x1f0f33,_0x2095b4){var _0x496238={'raw':![],'where':{}};var _0x2807ba={};var _0x35f5c8={'count':0x0,'rows':[]};return db[_0x112a('0x4b')][_0x112a('0x71')]({'where':{'id':_0x1f0f33[_0x112a('0x62')]['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0x2095b4,null))['then'](function(_0x57e9ef){if(_0x57e9ef){_0x2807ba[_0x112a('0x44')]=_[_0x112a('0x63')](db[_0x112a('0x77')][_0x112a('0x4c')]);_0x2807ba[_0x112a('0x4e')]=_[_0x112a('0x63')](_0x1f0f33['query']);_0x2807ba['filters']=_['intersection'](_0x2807ba['model'],_0x2807ba[_0x112a('0x4e')]);_0x496238[_0x112a('0x52')]=_['intersection'](_0x2807ba['model'],qs['fields'](_0x1f0f33['query'][_0x112a('0x51')]));_0x496238[_0x112a('0x52')]=_0x496238[_0x112a('0x52')]['length']?_0x496238[_0x112a('0x52')]:_0x2807ba[_0x112a('0x44')];if(!_0x1f0f33[_0x112a('0x4e')][_0x112a('0x72')](_0x112a('0x54'))){_0x496238[_0x112a('0x29')]=qs[_0x112a('0x29')](_0x1f0f33[_0x112a('0x4e')][_0x112a('0x29')]);_0x496238[_0x112a('0x28')]=qs['offset'](_0x1f0f33[_0x112a('0x4e')][_0x112a('0x28')]);}_0x496238[_0x112a('0x55')]=qs[_0x112a('0x56')](_0x1f0f33['query'][_0x112a('0x56')]);_0x496238[_0x112a('0x57')]=qs[_0x112a('0x4f')](_['pick'](_0x1f0f33[_0x112a('0x4e')],_0x2807ba[_0x112a('0x4f')]));_0x496238[_0x112a('0x57')]['ChatWebsiteId']=_0x57e9ef['id'];if(_0x1f0f33[_0x112a('0x4e')]['filter']){_0x496238[_0x112a('0x57')]=_[_0x112a('0x59')](_0x496238[_0x112a('0x57')],{'$or':_[_0x112a('0x4a')](_0x496238[_0x112a('0x52')],function(_0x55e45d){var _0x5cd923={};_0x5cd923[_0x55e45d]={'$like':'%'+_0x1f0f33[_0x112a('0x4e')]['filter']+'%'};return _0x5cd923;})});}_0x496238=_['merge']({},_0x496238,_0x1f0f33[_0x112a('0x5c')]);return db['CannedAnswer'][_0x112a('0x2a')]({'where':_0x496238[_0x112a('0x57')]})['then'](function(_0xc7c963){_0x35f5c8['count']=_0xc7c963;if(_0x1f0f33['query'][_0x112a('0x5d')]){_0x496238[_0x112a('0x5e')]=[{'all':!![]}];}return db[_0x112a('0x77')][_0x112a('0x5f')](_0x496238);})[_0x112a('0x1a')](function(_0x37aa4b){_0x35f5c8[_0x112a('0x60')]=_0x37aa4b;return _0x35f5c8;});}})['then'](respondWithFilteredResult(_0x2095b4,_0x496238))[_0x112a('0x25')](handleError(_0x2095b4,null));};exports[_0x112a('0x78')]=function(_0x4890df,_0x25c7bd){return db['ChatWebsite']['find']({'where':{'id':_0x4890df[_0x112a('0x62')]['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0x25c7bd,null))[_0x112a('0x1a')](function(_0x233e90){if(_0x233e90){return _0x233e90[_0x112a('0x78')](_0x4890df[_0x112a('0x4e')]['ids']);}})['then'](respondWithStatusCode(_0x25c7bd,null))['catch'](handleError(_0x25c7bd,null));};exports['addLogo']=function(_0x1d6a1d,_0x518ce5){_0x1d6a1d[_0x112a('0x66')][_0x112a('0x79')]=_0x1d6a1d['file']['filename'];return db[_0x112a('0x4b')]['find']({'where':{'id':_0x1d6a1d[_0x112a('0x62')]['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0x518ce5,null))['then'](saveUpdates(_0x1d6a1d[_0x112a('0x66')],null))['then'](respondWithResult(_0x518ce5,null))[_0x112a('0x25')](handleError(_0x518ce5,null));};exports[_0x112a('0x7a')]=function(_0x3b7b89,_0x1dc7a0){_0x3b7b89[_0x112a('0x66')]['agentAvatar']=_0x3b7b89[_0x112a('0x7b')][_0x112a('0x7c')];return db[_0x112a('0x4b')]['find']({'where':{'id':_0x3b7b89[_0x112a('0x62')]['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0x1dc7a0,null))[_0x112a('0x1a')](saveUpdates(_0x3b7b89[_0x112a('0x66')],null))[_0x112a('0x1a')](respondWithResult(_0x1dc7a0,null))[_0x112a('0x25')](handleError(_0x1dc7a0,null));};exports[_0x112a('0x7d')]=function(_0x3cdb24,_0x1c8bcc){_0x3cdb24[_0x112a('0x66')][_0x112a('0x7e')]=_0x3cdb24[_0x112a('0x7b')][_0x112a('0x7c')];return db[_0x112a('0x4b')][_0x112a('0x64')]({'where':{'id':_0x3cdb24[_0x112a('0x62')]['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0x1c8bcc,null))[_0x112a('0x1a')](saveUpdates(_0x3cdb24[_0x112a('0x66')],null))[_0x112a('0x1a')](respondWithResult(_0x1c8bcc,null))[_0x112a('0x25')](handleError(_0x1c8bcc,null));};exports[_0x112a('0x7f')]=function(_0x2e5941,_0x56016a){_0x2e5941[_0x112a('0x66')][_0x112a('0x80')]=_0x2e5941[_0x112a('0x7b')][_0x112a('0x7c')];return db[_0x112a('0x4b')][_0x112a('0x64')]({'where':{'id':_0x2e5941[_0x112a('0x62')]['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0x56016a,null))[_0x112a('0x1a')](saveUpdates(_0x2e5941[_0x112a('0x66')],null))['then'](respondWithResult(_0x56016a,null))['catch'](handleError(_0x56016a,null));};exports[_0x112a('0x81')]=function(_0x5ea870,_0x3192bb){var _0x2bf3e2=path[_0x112a('0x82')](config[_0x112a('0x83')],_0x112a('0x84'));var _0x58df5c={'where':{'id':_0x5ea870['params']['id']},'attributes':['id',_0x112a('0x79')],'raw':!![]};var _0x2894f4=![];return require('../../config/license/util')['getLicense']()['then'](function(_0x406e10){if(_0x406e10){_0x2894f4=_0x406e10[_0x112a('0x85')];}})['then'](function(){return db[_0x112a('0x4b')]['find'](_0x58df5c);})[_0x112a('0x1a')](handleEntityNotFound(_0x3192bb,null))['then'](function(_0x193b75){if(_0x193b75){if(!_[_0x112a('0x86')](_0x193b75[_0x112a('0x79')])){if(fs[_0x112a('0x87')](path['join'](config[_0x112a('0x83')],_0x112a('0x88'),_0x193b75[_0x112a('0x79')]))&&_0x2894f4){_0x2bf3e2=path['join'](config['root'],_0x112a('0x88'),_0x193b75[_0x112a('0x79')]);}}return _0x3192bb[_0x112a('0x89')](_0x2bf3e2);}})[_0x112a('0x25')](handleError(_0x3192bb,null));};exports['getAvatar']=function(_0x281578,_0x308caa){var _0x39702a=path[_0x112a('0x82')](config['root'],_0x112a('0x8a'));var _0x32d91a={'where':{'id':_0x281578['params']['id']},'attributes':['id',_0x112a('0x8b')],'raw':!![]};return db[_0x112a('0x4b')]['find'](_0x32d91a)[_0x112a('0x1a')](handleEntityNotFound(_0x308caa,null))[_0x112a('0x1a')](function(_0x1a1b2e){if(_0x1a1b2e){if(!_[_0x112a('0x86')](_0x1a1b2e[_0x112a('0x8b')])){if(fs[_0x112a('0x87')](path[_0x112a('0x82')](config['root'],_0x112a('0x8c'),_0x1a1b2e[_0x112a('0x8b')]))){_0x39702a=path[_0x112a('0x82')](config['root'],_0x112a('0x8c'),_0x1a1b2e['agentAvatar']);}}return _0x308caa[_0x112a('0x89')](_0x39702a);}})['catch'](handleError(_0x308caa,null));};exports[_0x112a('0x8d')]=function(_0x1c2b6b,_0x473ae3){var _0x16f7bf=path[_0x112a('0x82')](config[_0x112a('0x83')],_0x112a('0x8e'));var _0x526fa4={'where':{'id':_0x1c2b6b['params']['id']},'attributes':['id',_0x112a('0x7e'),_0x112a('0x8f')],'raw':!![]};return db[_0x112a('0x4b')][_0x112a('0x64')](_0x526fa4)[_0x112a('0x1a')](handleEntityNotFound(_0x473ae3,null))[_0x112a('0x1a')](function(_0x236ab6){if(_0x236ab6){if(!_[_0x112a('0x86')](_0x236ab6[_0x112a('0x7e')])){if(fs[_0x112a('0x87')](path[_0x112a('0x82')](config[_0x112a('0x83')],'server/files/images/avatars/',_0x236ab6[_0x112a('0x7e')]))&&_0x236ab6[_0x112a('0x8f')]){_0x16f7bf=path[_0x112a('0x82')](config[_0x112a('0x83')],_0x112a('0x8c'),_0x236ab6[_0x112a('0x7e')]);}}return _0x473ae3[_0x112a('0x89')](_0x16f7bf);}})['catch'](handleError(_0x473ae3,null));};exports[_0x112a('0x90')]=function(_0x56df4d,_0x221a80){var _0xdd0af1=path[_0x112a('0x82')](config[_0x112a('0x83')],'server/files/images/avatars/system_avatar.png');var _0x460770={'where':{'id':_0x56df4d[_0x112a('0x62')]['id']},'attributes':['id',_0x112a('0x80')],'raw':!![]};return db[_0x112a('0x4b')][_0x112a('0x64')](_0x460770)['then'](handleEntityNotFound(_0x221a80,null))[_0x112a('0x1a')](function(_0x76c756){if(_0x76c756){if(!_[_0x112a('0x86')](_0x76c756[_0x112a('0x80')])){if(fs[_0x112a('0x87')](path[_0x112a('0x82')](config[_0x112a('0x83')],_0x112a('0x8c'),_0x76c756[_0x112a('0x80')]))){_0xdd0af1=path[_0x112a('0x82')](config[_0x112a('0x83')],_0x112a('0x8c'),_0x76c756[_0x112a('0x80')]);}}return _0x221a80[_0x112a('0x89')](_0xdd0af1);}})[_0x112a('0x25')](handleError(_0x221a80,null));};exports['notify']=function(_0x134302,_0x222eba){var _0x32313c={'body':_0x134302[_0x112a('0x66')],'channel':'chat'};var _0x16751b=[];var _0x1c33a0=[];var _0xbaac09={};var _0x62b53a=![];if(_0x134302[_0x112a('0x66')]['id']){delete _0x134302['body']['id'];}if(_[_0x112a('0x86')](_0x134302[_0x112a('0x66')]['from'])){throw new APIBadRequestError(_0x112a('0x91'));}if(_['isNil'](_0x134302[_0x112a('0x66')]['mapKey'])){throw new APIBadRequestError(_0x112a('0x92'));}if(_['isEmpty'](_0x134302[_0x112a('0x66')]['body'])){throw new APIBadRequestError(_0x112a('0x93'));}return db[_0x112a('0x94')][_0x112a('0x6f')]()[_0x112a('0x1a')](function(_0x5448c6){if(!_0x5448c6){throw new Error(_0x112a('0x95'));}_0x16751b=Object[_0x112a('0x63')](_0x5448c6)[_0x112a('0x5b')](function(_0x450e6b){return!['createdAt','updatedAt'][_0x112a('0x96')](_0x450e6b);});_0x1c33a0=Object[_0x112a('0x63')](_0x5448c6)['filter'](function(_0xcca0ca){return![_0x112a('0x97'),_0x112a('0x98'),'CompanyId','ListId'][_0x112a('0x96')](_0xcca0ca);});if(!_['includes'](_0x1c33a0,_0x134302['body'][_0x112a('0x99')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x1c33a0['join'](',\x20'));}_0xbaac09[_0x134302[_0x112a('0x66')][_0x112a('0x99')]]=_0x134302[_0x112a('0x66')][_0x112a('0x9a')];})[_0x112a('0x1a')](function(){return db[_0x112a('0x4b')][_0x112a('0x64')]({'where':{'id':_0x134302['params']['id']},'include':[{'model':db[_0x112a('0x9b')],'as':_0x112a('0x9c'),'include':[{'model':db[_0x112a('0x94')],'as':_0x112a('0x9d'),'where':_0xbaac09,'limit':0x1,'order':[[_0x112a('0x98'),'DESC']]}]},{'model':db[_0x112a('0x9e')],'as':_0x112a('0x9f')},{'model':db[_0x112a('0xa0')],'as':_0x112a('0xa0'),'include':[{'model':db[_0x112a('0xa0')],'as':_0x112a('0xa1'),'attributes':['id',_0x112a('0xa2')],'raw':!![]}]}]});})[_0x112a('0x1a')](function(_0x42a97f){if(!_0x42a97f){throw new APINotFoundError(util['format'](_0x112a('0xa3'),_0x134302['params']['id']));}var _0x45ff5f=_0x42a97f[_0x112a('0xa0')];if(_0x45ff5f){var _0x3a3a38=_0x42a97f['timezone']||undefined;return _0x45ff5f[_0x112a('0xa4')](_0x3a3a38)[_0x112a('0x1a')](function(_0x5a83f8){if(!_0x5a83f8){throw new APIOutOfIntervalError();}return _0x42a97f;});}else{return _0x42a97f;}})[_0x112a('0x1a')](function(_0x3027f3){if(!_0x3027f3[_0x112a('0x9c')]){return;}_0x32313c[_0x112a('0xa5')]=_0x3027f3;_0x32313c[_0x112a('0xa6')]=_0x3027f3[_0x112a('0x9f')];_0x32313c[_0x112a('0xa7')]=_0x3027f3[_0x112a('0x9c')];_0x32313c[_0x112a('0xa6')]=_[_0x112a('0xa8')](_0x32313c[_0x112a('0xa6')],[_0x112a('0xa9')],[_0x112a('0xaa')]);if(_0x32313c[_0x112a('0xa5')]['Applications']){delete _0x32313c[_0x112a('0xa5')][_0x112a('0x9f')];}if(_0x32313c[_0x112a('0xa5')][_0x112a('0x9c')]&&_0x32313c[_0x112a('0xa5')]['List']['Contacts']['length']){return _0x32313c[_0x112a('0xa5')][_0x112a('0x9c')][_0x112a('0x9d')][0x0];}var _0x1af7d7=_[_0x112a('0x14')](_0x134302['body'],{'firstName':_0x134302[_0x112a('0x66')]['from'],'ListId':_0x3027f3['ListId']});_0x1af7d7[_0x134302[_0x112a('0x66')][_0x112a('0x99')]]=_0x134302[_0x112a('0x66')][_0x112a('0x9a')];return db[_0x112a('0x94')][_0x112a('0x65')](_0x1af7d7,{'fields':_0x16751b,'raw':!![]});})[_0x112a('0x1a')](function(_0xc5561d){_0x32313c[_0x112a('0xab')]=_0xc5561d;var _0x24b681=createInteractionObject(_0x134302['params']['id'],_0x134302[_0x112a('0x66')],_0x134302[_0x112a('0xac')],_0xc5561d);var _0x2aeffd={'ChatWebsiteId':_0x134302[_0x112a('0x62')]['id'],'closed':![]};if(_0x134302[_0x112a('0x66')]['threadId']){_0x2aeffd[_0x112a('0xad')]=_0x134302[_0x112a('0x66')][_0x112a('0xad')];return db[_0x112a('0xae')][_0x112a('0x64')]({'where':_0x2aeffd})['then'](function(_0x5ae267){if(_0x5ae267){_0x62b53a=!![];return _0x5ae267;}_0x24b681[_0x112a('0xad')]=_0x134302['body'][_0x112a('0xad')];_0x24b681[_0x112a('0xaf')]=_0x134302[_0x112a('0x66')][_0x112a('0xaf')];return db['ChatInteraction']['create'](_0x24b681);});}_0x2aeffd[_0x112a('0xb0')]=_0xc5561d['id'];if(_0x134302['body'][_0x112a('0xb1')]&&_0x134302[_0x112a('0x66')][_0x112a('0xb1')]['id']){_0x2aeffd['id']=_0x134302['body'][_0x112a('0xb1')]['id'];return db[_0x112a('0xae')]['find']({'where':_0x2aeffd})['then'](function(_0x298222){if(_0x298222){_0x62b53a=!![];return _0x298222;}return db['ChatInteraction'][_0x112a('0x65')](_0x24b681);});}return db[_0x112a('0xae')]['create'](_0x24b681);})[_0x112a('0x1a')](function(_0x1a94a9){if(!_0x62b53a){return _0x1a94a9;}var _0x5c94dc={'from':(_0x32313c[_0x112a('0xab')][_0x112a('0xb2')]||'')+'\x20'+(_0x32313c[_0x112a('0xab')][_0x112a('0x3b')]||'')};if(_0x134302[_0x112a('0x66')][_0x112a('0xad')]&&_0x134302['body'][_0x112a('0xb3')]&&_0x134302[_0x112a('0x66')][_0x112a('0xad')]!=_0x134302[_0x112a('0x66')][_0x112a('0xb3')]){_0x5c94dc[_0x112a('0xad')]=_0x134302[_0x112a('0x66')][_0x112a('0xb3')];}return _0x1a94a9['update'](_0x5c94dc);})['then'](function(_0x14274a){_0x32313c[_0x112a('0xb1')]=_0x14274a[_0x112a('0x2d')]({'plain':!![]});_0x32313c['interaction']['created']=!_0x62b53a;if(_0x32313c[_0x112a('0xb1')]['created']){if(_0x32313c[_0x112a('0xa5')][_0x112a('0xb4')]){_0x32313c[_0x112a('0xa6')]['push']({'id':0x0,'priority':_0x32313c[_0x112a('0xa6')][_0x112a('0x53')]+0x1,'app':_0x112a('0xb5'),'appdata':'unmanaged','interval':_0x112a('0xb6')});}}return db['ChatMessage'][_0x112a('0x65')]({'body':_0x134302[_0x112a('0x66')][_0x112a('0x66')],'ChatWebsiteId':_0x134302[_0x112a('0x62')]['id'],'ChatInteractionId':_0x14274a['id'],'direction':'in','ContactId':_0x32313c[_0x112a('0xab')]['id'],'AttachmentId':_0x134302[_0x112a('0x66')]['AttachmentId']});})[_0x112a('0x1a')](function(_0x36f8c0){_0x32313c[_0x112a('0x23')]=_0x36f8c0;if(!_0x32313c['interaction']['UserId']){return;}return db['User'][_0x112a('0x64')]({'attributes':['id',_0x112a('0x31')],'where':{'id':_0x32313c[_0x112a('0xb1')][_0x112a('0xb7')]}});})[_0x112a('0x1a')](function(_0x181556){if(_0x181556){_0x32313c[_0x112a('0xa6')][_0x112a('0xb8')]({'id':0x0,'priority':0x0,'app':_0x112a('0xb9'),'appdata':_0x181556[_0x112a('0x31')]+','+(_0x32313c[_0x112a('0xa5')]['waitForTheAssignedAgent']||0xa),'interval':_0x112a('0xb6')});_0x32313c['forcedOwnership']=!![];}if(!_0x32313c[_0x112a('0xb1')][_0x112a('0xba')]){return;}return db[_0x112a('0xbb')][_0x112a('0x64')]({'attributes':['id',_0x112a('0x31')],'where':{'id':_0x32313c['interaction'][_0x112a('0xba')]}});})[_0x112a('0x1a')](function(_0x20b963){if(_0x20b963){_0x32313c[_0x112a('0xa6')][_0x112a('0xb8')]({'id':0x0,'priority':0x1,'app':_0x112a('0xbc'),'appdata':_0x20b963[_0x112a('0x31')]+','+(_0x32313c['account'][_0x112a('0xbd')]||0x12c),'interval':_0x112a('0xb6')});}return respondWithRpcPromise('Start',_0x112a('0xbe'),_0x32313c);})[_0x112a('0x1a')](function(_0x11ca85){respondWithRpcPromise(_0x112a('0xbf'),_0x112a('0xbf'),{'event':'notify','message':_0x11ca85},client9002);return _0x11ca85;})[_0x112a('0x1a')](respondWithResult(_0x222eba,null))['catch'](APIHandleError(_0x222eba));};exports[_0x112a('0xc0')]=function(_0x3297f2,_0x145475){var _0x721cbe,_0x4bcb21,_0x3ee23a;var _0x15f2d2=[];var _0x247a75={};var _0x38c2de=_0x3297f2[_0x112a('0xc1')]||[];var _0x2bf03d=[];var _0x3c9ca6;return db[_0x112a('0x94')][_0x112a('0x6f')]()[_0x112a('0x1a')](function(_0x4c73bf){if(!_0x4c73bf){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x15f2d2=_['difference'](_[_0x112a('0x63')](_0x4c73bf),[_0x112a('0x97'),_0x112a('0x98'),'CompanyId','ListId']);if(_0x3297f2[_0x112a('0x66')]['id']){delete _0x3297f2[_0x112a('0x66')]['id'];}if(_[_0x112a('0x86')](_0x3297f2['body'][_0x112a('0x9a')])){throw _0x145475[_0x112a('0x26')](0x1f4)[_0x112a('0x32')](new db['Sequelize'][(_0x112a('0xc2'))](_0x112a('0xc3')));}if(_['isNil'](_0x3297f2[_0x112a('0x66')][_0x112a('0x66')])||_0x3297f2['body']['body']===''){throw _0x145475['status'](0x1f4)[_0x112a('0x32')](new db['Sequelize'][(_0x112a('0xc2'))](_0x112a('0xc4')));}if(_[_0x112a('0x86')](_0x3297f2[_0x112a('0x66')][_0x112a('0xc5')])){throw _0x145475[_0x112a('0x26')](0x1f4)['send'](new db[(_0x112a('0xc6'))][(_0x112a('0xc2'))](_0x112a('0xc7')+_0x15f2d2));}if(!_['includes'](_0x15f2d2,_0x3297f2[_0x112a('0x66')][_0x112a('0xc5')])){throw _0x145475[_0x112a('0x26')](0x1f4)[_0x112a('0x32')](new db[(_0x112a('0xc6'))][(_0x112a('0xc2'))](_0x112a('0xc8')+_0x15f2d2));}_0x247a75[_0x3297f2[_0x112a('0x66')][_0x112a('0xc5')]]=_0x3297f2[_0x112a('0x66')][_0x112a('0x9a')];})[_0x112a('0x1a')](function(){return db[_0x112a('0x4b')]['find']({'where':{'id':_0x3297f2[_0x112a('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0x112a('0x9c')},{'model':db[_0x112a('0xc9')],'as':_0x112a('0xc9')}]});})[_0x112a('0x1a')](handleEntityNotFound(_0x145475,null))[_0x112a('0x1a')](function(_0x22062e){if(_0x22062e&&_0x22062e['List']){_0x4bcb21=_0x22062e;var _0x4e5a4f=_['defaults'](_0x3297f2[_0x112a('0x66')],{'firstName':_0x3297f2[_0x112a('0x66')][_0x112a('0x9a')],'phone':_0x3297f2[_0x112a('0x66')]['from'],'ListId':_0x22062e[_0x112a('0xca')]});_0x4e5a4f[_0x3297f2['body']['mapKeyOffline']]=_0x3297f2[_0x112a('0x66')]['from'];return db[_0x112a('0x94')][_0x112a('0xcb')]({'where':_0x247a75,'defaults':_0x4e5a4f});}})[_0x112a('0xcc')](function(_0x3cc71a){if(_0x3cc71a){_0x3ee23a=_0x3cc71a;var _0x138957=fs[_0x112a('0xcd')](path['join'](config['root'],_0x112a('0xce')),'utf8');var _0x11bd05=ejs[_0x112a('0xcf')](_0x138957,{'body':_[_0x112a('0xd0')](_0x3297f2['body']['body']),'bodyTitle':_0x4bcb21[_0x112a('0xd1')]});return db['ChatOfflineMessage'][_0x112a('0x65')]({'body':_0x11bd05,'plainBody':htmlToText[_0x112a('0xd2')](_0x11bd05),'ContactId':_0x3cc71a['id'],'ChatWebsiteId':_0x4bcb21['id']});}})['then'](function(_0x139e56){_0x3c9ca6=_0x139e56;if(_0x38c2de[_0x112a('0x53')]){var _0x429279=_0x38c2de[_0x112a('0x4a')](function(_0x2c5b7c){return{'name':_0x2c5b7c[_0x112a('0xd3')],'basename':_0x2c5b7c[_0x112a('0x7c')],'type':_0x2c5b7c[_0x112a('0xd4')],'ChatOfflineMessageId':_0x139e56['id']};});_0x2bf03d=_0x429279[_0x112a('0x4a')](_0x5f066d=>{var _0xe22118={'filename':_0x5f066d[_0x112a('0x31')],'path':path['join'](config[_0x112a('0x83')],_0x112a('0xd5'),_0x112a('0xc1'),_0x112a('0xd6'),_0x112a('0xd7'),_0x5f066d['basename'])};return _0xe22118;});if(!_0x4bcb21[_0x112a('0xd8')]){return db[_0x112a('0xd9')]['transaction'](function(_0x3fff18){return db[_0x112a('0xda')][_0x112a('0xdb')](_0x429279,{'transaction':_0x3fff18});});}}})[_0x112a('0x1a')](function(){if(_0x3c9ca6){_0x721cbe=_0x3c9ca6;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x112a('0xdc')],'as':_0x112a('0xdd'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0x112a('0x1a')](function(_0xa67aa){if(_0xa67aa&&_0xa67aa[_0x112a('0xdd')]&&_0x4bcb21[_0x112a('0xde')]&&_0x4bcb21[_0x112a('0xdf')]){var _0x4c42ea=_0xa67aa[_0x112a('0xe0')]();return respondWithRpcPromise(_0x112a('0xe1'),_0x112a('0xe2'),{'account':_0x4c42ea,'message':{'from':util[_0x112a('0x3f')]('\x22%s\x22\x20<%s>',_0xa67aa[_0x112a('0x31')],_0xa67aa[_0x112a('0xe3')]||_0xa67aa[_0x112a('0xdd')]['user']),'to':_0x4bcb21[_0x112a('0xdf')],'subject':_0x4bcb21[_0x112a('0xe4')],'html':_0x721cbe[_0x112a('0x66')],'attachments':_0x2bf03d}},client9003)[_0x112a('0x1a')](function(){return _0x721cbe;})[_0x112a('0x25')](function(_0x2c9c1d){logger[_0x112a('0x21')](_0x2c9c1d);});}})[_0x112a('0x1a')](function(){if(_0x4bcb21&&_0x4bcb21[_0x112a('0xd8')]&&_0x4bcb21[_0x112a('0xe5')]){var _0x1d7056=[];if(_0x38c2de['length']){_0x1d7056=_0x38c2de[_0x112a('0x4a')](function(_0xbc7813){return{'name':_0xbc7813[_0x112a('0xd3')],'basename':_0xbc7813['filename'],'type':_0xbc7813[_0x112a('0xd4')],'ChatOfflineMessageId':_0x3c9ca6['id']};});}var _0x25c810;if(!_[_0x112a('0x86')](_0x4bcb21[_0x112a('0xe6')])){var _0x147528=_[_0x112a('0x4a')](_0x3297f2[_0x112a('0x66')],function(_0x3789ff){return _0x3789ff;});var _0x33afca=_[_0x112a('0xe7')](_0x147528)[0x0];var _0x45bc10=_[_0x112a('0xe8')](_0x33afca,function(_0x4ce7e2){return _0x4ce7e2;});_0x25c810=_0x45bc10[0x1][_0x4bcb21[_0x112a('0xe6')]];}var _0x818aea={'from':_0x3ee23a['email'],'firstName':_0x3ee23a[_0x112a('0xb2')],'lastName':_0x3ee23a[_0x112a('0x3b')],'mapKey':'email','message':{'from':_0x3ee23a[_0x112a('0xe3')],'to':_0x4bcb21[_0x112a('0xc9')][_0x112a('0xe3')],'cc':'','subject':_[_0x112a('0x86')](_0x25c810)?_0x4bcb21[_0x112a('0xe4')]:_0x25c810,'messageId':'','sentAt':new Date(),'attach':_0x1d7056[_0x112a('0x53')],'attachments':_0x1d7056,'originChannel':_0x112a('0xe9'),'ChatWebsiteId':_0x4bcb21['id'],'ChatOfflineMessageId':_0x721cbe['id'],'originTo':_0x4bcb21[_0x112a('0xc9')]['email']},'body':_0x721cbe[_0x112a('0x66')]};var _0x250f4a={'account':{'id':_0x4bcb21['MailAccountId']},'body':_0x818aea,'log':_0x112a('0xea')};return respondWithRpcPromise(_0x112a('0xea'),'notifyMail',_0x250f4a,client9001)[_0x112a('0x1a')](function(){return _0x721cbe;})[_0x112a('0x25')](function(_0x345112){logger[_0x112a('0x21')](_0x345112);});}return;})['then'](function(){if(_0x721cbe){return _0x721cbe;}})[_0x112a('0x1a')](respondWithResult(_0x145475,null))[_0x112a('0x25')](function(_0x593c98){logger[_0x112a('0x21')](_0x112a('0x25'),_0x593c98);for(var _0x4dc856 of _0x38c2de){var _0x241ad4=path['join'](config[_0x112a('0x83')],_0x112a('0xd5'),_0x112a('0xc1'),_0x112a('0xd6'),'offline-chat',_0x4dc856['filename']);fs_extra[_0x112a('0xeb')](_0x241ad4)[_0x112a('0x25')](function(_0x1b8aab){logger[_0x112a('0x21')]('Could\x20not\x20remove\x20attachment\x20file',_0x241ad4,_0x1b8aab);});}});};exports[_0x112a('0xec')]=function(_0x30e92a,_0x5b6f01){return db[_0x112a('0xae')][_0x112a('0x64')]({'where':{'id':_0x30e92a[_0x112a('0x62')]['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0x5b6f01,null))[_0x112a('0x1a')](function(_0x1a6c04){if(_0x1a6c04){return _0x1a6c04[_0x112a('0xec')](_0x30e92a[_0x112a('0x66')][_0x112a('0x75')],_['omit'](_0x30e92a['body'],[_0x112a('0x75'),'id'])||{});}})[_0x112a('0x1a')](respondWithResult(_0x5b6f01,null))[_0x112a('0x25')](handleError(_0x5b6f01,null));};exports[_0x112a('0xed')]=function(_0xfc5dba,_0x132614){var _0x53f8c1={'raw':![],'where':{}};var _0x4cfd63={};var _0x1d6561={'count':0x0,'rows':[]};return db[_0x112a('0x4b')][_0x112a('0x71')]({'where':{'id':_0xfc5dba['params']['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0x132614,null))[_0x112a('0x1a')](function(_0x3d0034){if(_0x3d0034){_0x4cfd63[_0x112a('0x44')]=_['keys'](db['ChatInteraction'][_0x112a('0x4c')]);_0x4cfd63[_0x112a('0x4e')]=_['keys'](_0xfc5dba[_0x112a('0x4e')]);_0x4cfd63[_0x112a('0x4f')]=_['intersection'](_0x4cfd63[_0x112a('0x44')],_0x4cfd63['query']);_0x53f8c1[_0x112a('0x52')]=_[_0x112a('0x50')](_0x4cfd63[_0x112a('0x44')],qs['fields'](_0xfc5dba[_0x112a('0x4e')]['fields']));_0x53f8c1['attributes']=_0x53f8c1['attributes'][_0x112a('0x53')]?_0x53f8c1[_0x112a('0x52')]:_0x4cfd63[_0x112a('0x44')];if(!_0xfc5dba[_0x112a('0x4e')][_0x112a('0x72')]('nolimit')){_0x53f8c1[_0x112a('0x29')]=qs[_0x112a('0x29')](_0xfc5dba[_0x112a('0x4e')]['limit']);_0x53f8c1[_0x112a('0x28')]=qs[_0x112a('0x28')](_0xfc5dba[_0x112a('0x4e')]['offset']);}_0x53f8c1['order']=qs['sort'](_0xfc5dba[_0x112a('0x4e')][_0x112a('0x56')]);_0x53f8c1[_0x112a('0x57')]=qs[_0x112a('0x4f')](_['pick'](_0xfc5dba['query'],_0x4cfd63[_0x112a('0x4f')]));_0x53f8c1[_0x112a('0x57')][_0x112a('0x73')]=_0x3d0034['id'];if(_0xfc5dba[_0x112a('0x4e')][_0x112a('0x5b')]){_0x53f8c1[_0x112a('0x57')]=_['merge'](_0x53f8c1[_0x112a('0x57')],{'$or':_[_0x112a('0x4a')](_0x53f8c1[_0x112a('0x52')],function(_0x584012){var _0x5c78e4={};_0x5c78e4[_0x584012]={'$like':'%'+_0xfc5dba[_0x112a('0x4e')][_0x112a('0x5b')]+'%'};return _0x5c78e4;})});}_0x53f8c1=_[_0x112a('0x59')]({},_0x53f8c1,_0xfc5dba[_0x112a('0x5c')]);return db[_0x112a('0xae')][_0x112a('0x2a')]({'where':_0x53f8c1[_0x112a('0x57')]})[_0x112a('0x1a')](function(_0x17ec3b){_0x1d6561[_0x112a('0x2a')]=_0x17ec3b;if(_0xfc5dba[_0x112a('0x4e')]['includeAll']){_0x53f8c1[_0x112a('0x5e')]=[{'model':db[_0x112a('0x94')],'as':_0x112a('0xee'),'required':![]},{'model':db['User'],'as':_0x112a('0xef'),'attributes':[_0x112a('0x31'),_0x112a('0xf0'),_0x112a('0xf1')],'required':![]},{'model':db[_0x112a('0xf2')],'as':_0x112a('0xf3'),'attributes':['id',_0x112a('0x31'),'color'],'where':_0xfc5dba[_0x112a('0x4e')][_0x112a('0xf4')]?{'id':_0xfc5dba[_0x112a('0x4e')][_0x112a('0xf4')]}:undefined,'required':_0xfc5dba[_0x112a('0x4e')][_0x112a('0xf4')]?!![]:![]}];}return db[_0x112a('0xae')][_0x112a('0x5f')](_0x53f8c1);})['then'](function(_0xff1e62){_0x1d6561[_0x112a('0x60')]=_0xff1e62;return _0x1d6561;});}})[_0x112a('0x1a')](respondWithFilteredResult(_0x132614,_0x53f8c1))[_0x112a('0x25')](handleError(_0x132614,null));};function iftimePromise(_0x535cbb,_0x5c0faa){return respondWithRpcPromise(_0x112a('0xf5'),_0x112a('0xf6'),{'command':_0x5c0faa[_0x112a('0xf7')]?util[_0x112a('0x3f')](_0x112a('0xf8'),_0x535cbb[_0x112a('0xa2')],_0x5c0faa[_0x112a('0xf7')]):util[_0x112a('0x3f')]('iftime\x20%s',_0x535cbb[_0x112a('0xa2')])},client9002)[_0x112a('0x1a')](function(_0x424eb1){var _0x22e24e=_0x424eb1&&_0x424eb1[_0x112a('0xf9')]('true')>=0x0?!![]:![];logger[_0x112a('0x1b')](_0x112a('0xfa'),_0x5c0faa['id'],_0x535cbb['id'],_0x535cbb['interval'],_0x22e24e?_0x112a('0xfb'):_0x112a('0xfc'),_0x5c0faa[_0x112a('0xf7')]?_0x5c0faa[_0x112a('0xf7')]:'No\x20timezone');return _0x22e24e;})[_0x112a('0x25')](function(_0x2dc7ec){logger[_0x112a('0x21')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5c0faa['id'],_0x535cbb['id'],_0x535cbb['interval'],util[_0x112a('0xfd')](_0x2dc7ec,{'showHidden':![],'depth':null}),_0x5c0faa[_0x112a('0xf7')]?_0x5c0faa[_0x112a('0xf7')]:_0x112a('0xfe'));return![];});}exports[_0x112a('0xf6')]=function(_0x80fc5a,_0x2ea2c2){var _0x1fd7f9=0x0;var _0x1a621c=0x0;var _0x477f3b=![];var _0x5fd83d;var _0x45ab3c;return db[_0x112a('0x4b')][_0x112a('0x64')]({'where':{'id':_0x80fc5a[_0x112a('0x62')]['id']},'include':[{'model':db[_0x112a('0xa0')],'as':_0x112a('0xa0'),'include':[{'model':db[_0x112a('0xa0')],'as':_0x112a('0xa1'),'attributes':['id',_0x112a('0xa2')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2ea2c2,null))[_0x112a('0x1a')](function(_0x3ef47c){if(_0x3ef47c){_0x5fd83d=_0x3ef47c;return _0x3ef47c['getProactiveActions']({'raw':!![]});}})[_0x112a('0x1a')](function(_0xa1148a){if(_0x5fd83d){if(_0xa1148a){_0x45ab3c=_0xa1148a;}}return require('../../config/license/util')[_0x112a('0xff')]();})[_0x112a('0x1a')](function(_0x462d57){if(_0x462d57){_0x1a621c=_0x462d57[_0x112a('0x100')];_0x477f3b=_0x462d57[_0x112a('0x85')];}})[_0x112a('0x1a')](function(){return db[_0x112a('0xae')]['count']({'where':{'closed':![]}});})[_0x112a('0x1a')](function(_0x4b6f3e){_0x1fd7f9=_0x4b6f3e;if(_0x1a621c&&_0x4b6f3e>_0x1a621c){return db['License'][_0x112a('0x71')]({'where':{'id':0x1}})[_0x112a('0x1a')](function(_0x1f1089){if(_0x1f1089){_0x1f1089[_0x112a('0x101')](_0x112a('0x102'));}});}})[_0x112a('0x1a')](function(){if(_0x5fd83d[_0x112a('0xa0')]&&_0x5fd83d[_0x112a('0xa0')][_0x112a('0xa1')]){var _0x56d783=[];for(var _0x478666=0x0;_0x478666<_0x5fd83d[_0x112a('0xa0')][_0x112a('0xa1')][_0x112a('0x53')];_0x478666++){var _0x1743e1=_0x5fd83d[_0x112a('0xa0')]['Intervals'][_0x478666][_0x112a('0x2d')]({'plain':!![]});_0x56d783['push'](iftimePromise(_0x1743e1,_0x5fd83d));}return Promise[_0x112a('0x103')](_0x56d783)[_0x112a('0x1a')](function(_0x516e6b){return _[_0x112a('0x104')](_0x516e6b);});}else{return!![];}})['then'](function(_0x14ebde){var _0x357e97=fs['readFileSync'](path[_0x112a('0x82')](config[_0x112a('0x83')],_0x112a('0x105')),'utf8');var _0xd27a23=new url['URL'](_0x5fd83d['address'])[_0x112a('0x106')];var _0x1d61cf='3.5.0';var _0x34070b=![];var _0xce30f7={'chatVersion':_0x1d61cf,'chatWebsiteAddressOrigin':_0xd27a23,'remote':_0x5fd83d[_0x112a('0x107')],'query':querystring[_0x112a('0x20')](_['merge'](_0x5fd83d[_0x112a('0x2d')]({'plain':!![]}),{'customerIp':_0x80fc5a['headers']['x-forwarded-for']||_0x80fc5a[_0x112a('0xac')][_0x112a('0x108')]||_0x80fc5a[_0x112a('0x109')][_0x112a('0x10a')]||_0x80fc5a['ip'],'referer':_0x80fc5a[_0x112a('0xac')][_0x112a('0x3d')],'openedInteractions':_0x1fd7f9,'maxInteractions':_0x1a621c,'virtual':_0x477f3b['virtual'],'online':_0x14ebde,'custom':_0x477f3b}))[_0x112a('0x10b')](/'/g,'\x5c\x27')};_0x2ea2c2['send'](ejs[_0x112a('0xcf')](Mustache[_0x112a('0xcf')](_0x357e97,_0xce30f7),{'proactiveActions':_0x45ab3c,'alignment':_0x5fd83d[_0x112a('0x10c')],'verticalAlignment':_0x5fd83d[_0x112a('0x10d')],'div_color':_0x5fd83d[_0x112a('0x10e')],'labelText':_0x5fd83d[_0x112a('0x10f')],'text_color':_0x5fd83d['textColor'],'text_button_color':_0x5fd83d[_0x112a('0x110')],'button_color':_0x5fd83d['color_button'],'background_color':_0x5fd83d['backgroundColor'],'hideWhenOffline':_0x5fd83d[_0x112a('0x111')],'intervalId':_0x5fd83d[_0x112a('0x112')],'isDevelopment':_0x34070b,'chatVersion':_0x1d61cf}));})[_0x112a('0x25')](handleError(_0x2ea2c2,null));};exports['addApplications']=function(_0x40c9dc,_0x5a2642){var _0x3152c4=_0x40c9dc[_0x112a('0x62')]['id'];var _0x504ce2=_0x40c9dc[_0x112a('0x66')];var _0x59a453=0xc8;var _0x32549e=null;return db[_0x112a('0xd9')][_0x112a('0x113')]({'isolationLevel':db[_0x112a('0xd9')][_0x112a('0x114')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x491454){return db['ChatWebsite'][_0x112a('0x71')]({'where':{'id':_0x3152c4},'transaction':_0x491454})[_0x112a('0x1a')](function(_0x1cdb74){if(_0x1cdb74){return db[_0x112a('0x9e')]['destroy']({'where':{'ChatWebsiteId':_0x3152c4},'transaction':_0x491454})[_0x112a('0x1a')](function(){var _0x4fe8d5=_['map'](_0x504ce2,function(_0x3c8383){_0x3c8383[_0x112a('0x73')]=_0x3152c4;return _0x3c8383;});return db[_0x112a('0x9e')]['bulkCreate'](_0x4fe8d5,{'transaction':_0x491454});});}else{_0x59a453=0x194;_0x32549e=[];}});})[_0x112a('0x1a')](function(){if(_0x59a453!==0x194){return db[_0x112a('0x9e')][_0x112a('0x115')]({'where':{'ChatWebsiteId':_0x3152c4},'order':_0x112a('0xa9')})[_0x112a('0x1a')](function(_0x4d3acf){_0x32549e=_0x4d3acf;});}})['catch'](function(_0x374031){_0x59a453=0x1f4;logger[_0x112a('0x21')](_0x374031['stack']);if(_0x374031[_0x112a('0x31')]){delete _0x374031[_0x112a('0x31')];}_0x32549e=_0x374031;})['finally'](function(){if(_0x32549e===null){_0x5a2642[_0x112a('0x2f')](_0x59a453);}else{if(_0x59a453===0x1f4){_0x5a2642[_0x112a('0x26')](_0x59a453)[_0x112a('0x32')](_0x32549e);}else{_0x5a2642['status'](_0x59a453)[_0x112a('0x27')](_0x32549e);}}});};exports[_0x112a('0x116')]=function(_0x596029,_0x268170){var _0x36c29a={};var _0x2ab0bc={};var _0x20472c;var _0x14ac7a;return db[_0x112a('0x4b')][_0x112a('0x71')]({'where':{'id':_0x596029[_0x112a('0x62')]['id']}})['then'](handleEntityNotFound(_0x268170,null))[_0x112a('0x1a')](function(_0x547c5d){if(_0x547c5d){_0x20472c=_0x547c5d;_0x2ab0bc['model']=_[_0x112a('0x63')](db[_0x112a('0x9e')][_0x112a('0x4c')]);_0x2ab0bc[_0x112a('0x4e')]=_[_0x112a('0x63')](_0x596029['query']);_0x2ab0bc['filters']=_[_0x112a('0x50')](_0x2ab0bc[_0x112a('0x44')],_0x2ab0bc[_0x112a('0x4e')]);_0x36c29a['attributes']=_[_0x112a('0x50')](_0x2ab0bc[_0x112a('0x44')],qs[_0x112a('0x51')](_0x596029[_0x112a('0x4e')]['fields']));_0x36c29a[_0x112a('0x52')]=_0x36c29a[_0x112a('0x52')][_0x112a('0x53')]?_0x36c29a[_0x112a('0x52')]:_0x2ab0bc[_0x112a('0x44')];_0x36c29a[_0x112a('0x55')]=qs['sort'](_0x596029[_0x112a('0x4e')][_0x112a('0x56')]);_0x36c29a[_0x112a('0x57')]=qs[_0x112a('0x4f')](_[_0x112a('0x58')](_0x596029[_0x112a('0x4e')],_0x2ab0bc[_0x112a('0x4f')]));if(_0x596029[_0x112a('0x4e')][_0x112a('0x5b')]){_0x36c29a[_0x112a('0x57')]=_[_0x112a('0x59')](_0x36c29a[_0x112a('0x57')],{'$or':_[_0x112a('0x4a')](_0x36c29a['attributes'],function(_0x37c0e6){var _0x30784b={};_0x30784b[_0x37c0e6]={'$like':'%'+_0x596029[_0x112a('0x4e')][_0x112a('0x5b')]+'%'};return _0x30784b;})});}_0x36c29a=_[_0x112a('0x59')]({},_0x36c29a,_0x596029[_0x112a('0x5c')]);return _0x20472c['getApplications'](_0x36c29a);}})[_0x112a('0x1a')](function(_0x757c9e){if(_0x757c9e){_0x14ac7a=_0x757c9e[_0x112a('0x53')];if(!_0x596029[_0x112a('0x4e')]['hasOwnProperty']('nolimit')){_0x36c29a[_0x112a('0x29')]=qs[_0x112a('0x29')](_0x596029[_0x112a('0x4e')][_0x112a('0x29')]);_0x36c29a['offset']=qs[_0x112a('0x28')](_0x596029['query'][_0x112a('0x28')]);}return _0x20472c['getApplications'](_0x36c29a);}})[_0x112a('0x1a')](function(_0x595495){if(_0x595495){return _0x595495?{'count':_0x14ac7a,'rows':_0x595495}:null;}})[_0x112a('0x1a')](respondWithResult(_0x268170,null))[_0x112a('0x25')](handleError(_0x268170,null));};exports['addProactiveActions']=function(_0x484f23,_0x11bac6){return db[_0x112a('0x117')][_0x112a('0x64')]({'where':{'id':_0x484f23['params']['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0x11bac6,null))[_0x112a('0x1a')](function(_0x2b44b7){if(_0x2b44b7){return _0x2b44b7[_0x112a('0x118')](_0x484f23[_0x112a('0x66')][_0x112a('0x75')],_['omit'](_0x484f23[_0x112a('0x66')],[_0x112a('0x75'),'id'])||{});}})[_0x112a('0x1a')](respondWithResult(_0x11bac6,null))[_0x112a('0x25')](handleError(_0x11bac6,null));};exports[_0x112a('0x119')]=function(_0x293a3c,_0xc4ea77){var _0x3ce873={};var _0x2ac729={};var _0x5b74a4;var _0x3d67a3;return db['ChatWebsite'][_0x112a('0x71')]({'where':{'id':_0x293a3c[_0x112a('0x62')]['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0xc4ea77,null))['then'](function(_0x388931){if(_0x388931){_0x5b74a4=_0x388931;_0x2ac729['model']=_[_0x112a('0x63')](db[_0x112a('0x11a')][_0x112a('0x4c')]);_0x2ac729['query']=_[_0x112a('0x63')](_0x293a3c['query']);_0x2ac729['filters']=_[_0x112a('0x50')](_0x2ac729[_0x112a('0x44')],_0x2ac729['query']);_0x3ce873[_0x112a('0x52')]=_[_0x112a('0x50')](_0x2ac729[_0x112a('0x44')],qs[_0x112a('0x51')](_0x293a3c[_0x112a('0x4e')][_0x112a('0x51')]));_0x3ce873['attributes']=_0x3ce873['attributes']['length']?_0x3ce873[_0x112a('0x52')]:_0x2ac729[_0x112a('0x44')];_0x3ce873[_0x112a('0x55')]=qs[_0x112a('0x56')](_0x293a3c[_0x112a('0x4e')][_0x112a('0x56')]);_0x3ce873[_0x112a('0x57')]=qs[_0x112a('0x4f')](_['pick'](_0x293a3c[_0x112a('0x4e')],_0x2ac729[_0x112a('0x4f')]));if(_0x293a3c[_0x112a('0x4e')][_0x112a('0x5b')]){_0x3ce873[_0x112a('0x57')]=_[_0x112a('0x59')](_0x3ce873['where'],{'$or':_[_0x112a('0x4a')](_0x3ce873[_0x112a('0x52')],function(_0x9dbc04){var _0x2bb0a7={};_0x2bb0a7[_0x9dbc04]={'$like':'%'+_0x293a3c[_0x112a('0x4e')][_0x112a('0x5b')]+'%'};return _0x2bb0a7;})});}_0x3ce873=_['merge']({},_0x3ce873,_0x293a3c[_0x112a('0x5c')]);return _0x5b74a4[_0x112a('0x119')](_0x3ce873);}})[_0x112a('0x1a')](function(_0x3a8766){if(_0x3a8766){_0x3d67a3=_0x3a8766[_0x112a('0x53')];if(!_0x293a3c[_0x112a('0x4e')][_0x112a('0x72')](_0x112a('0x54'))){_0x3ce873[_0x112a('0x29')]=qs['limit'](_0x293a3c[_0x112a('0x4e')][_0x112a('0x29')]);_0x3ce873[_0x112a('0x28')]=qs[_0x112a('0x28')](_0x293a3c[_0x112a('0x4e')][_0x112a('0x28')]);}return _0x5b74a4[_0x112a('0x119')](_0x3ce873);}})[_0x112a('0x1a')](function(_0x2adaa5){if(_0x2adaa5){return _0x2adaa5?{'count':_0x3d67a3,'rows':_0x2adaa5}:null;}})['then'](respondWithResult(_0xc4ea77,null))['catch'](handleError(_0xc4ea77,null));};exports['getFields']=function(_0x47b0c2,_0x48254e){var _0x5ce947=_0x47b0c2['query']['online']===_0x112a('0x11b')?_0x112a('0x11c'):_0x112a('0x11d');return db[_0x112a('0x4b')]['find']({'attributes':['id',_0x5ce947],'where':{'id':_0x47b0c2[_0x112a('0x62')]['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0x48254e,null))['then'](function(_0x119330){if(_0x119330){var _0x4c2b6f=_0x119330[_0x5ce947];var _0x5a67c5=_0x4c2b6f&&_0x4c2b6f[_0x112a('0x11e')]?_0x4c2b6f['items']:[];_0x48254e[_0x112a('0x32')]({'fromKey':_[_0x112a('0x86')](_0x4c2b6f[_0x112a('0x11f')])?undefined:_0x4c2b6f[_0x112a('0x11f')],'count':_0x5a67c5[_0x112a('0x53')],'rows':_0x5a67c5});}})['catch'](handleError(_0x48254e,null));};exports['getOfflineMessages']=function(_0xa4c399,_0x474c5a){var _0x522ba8={'raw':![],'where':{}};var _0xa3fa25={};var _0x582265={'count':0x0,'rows':[]};return db[_0x112a('0x4b')][_0x112a('0x71')]({'where':{'id':_0xa4c399[_0x112a('0x62')]['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0x474c5a,null))[_0x112a('0x1a')](function(_0x3f61af){if(_0x3f61af){_0xa3fa25[_0x112a('0x44')]=_[_0x112a('0x63')](db[_0x112a('0x120')][_0x112a('0x4c')]);_0xa3fa25[_0x112a('0x4e')]=_[_0x112a('0x63')](_0xa4c399[_0x112a('0x4e')]);_0xa3fa25[_0x112a('0x4f')]=_[_0x112a('0x50')](_0xa3fa25[_0x112a('0x44')],_0xa3fa25[_0x112a('0x4e')]);_0x522ba8[_0x112a('0x52')]=_['intersection'](_0xa3fa25[_0x112a('0x44')],qs[_0x112a('0x51')](_0xa4c399[_0x112a('0x4e')][_0x112a('0x51')]));_0x522ba8['attributes']=_0x522ba8['attributes'][_0x112a('0x53')]?_0x522ba8[_0x112a('0x52')]:_0xa3fa25['model'];if(!_0xa4c399[_0x112a('0x4e')][_0x112a('0x72')](_0x112a('0x54'))){_0x522ba8[_0x112a('0x29')]=qs[_0x112a('0x29')](_0xa4c399['query'][_0x112a('0x29')]);_0x522ba8[_0x112a('0x28')]=qs['offset'](_0xa4c399[_0x112a('0x4e')][_0x112a('0x28')]);}_0x522ba8[_0x112a('0x55')]=qs['sort'](_0xa4c399[_0x112a('0x4e')]['sort']);_0x522ba8[_0x112a('0x57')]=qs[_0x112a('0x4f')](_['pick'](_0xa4c399['query'],_0xa3fa25[_0x112a('0x4f')]));_0x522ba8[_0x112a('0x57')]['ChatWebsiteId']=_0x3f61af['id'];if(_0xa4c399[_0x112a('0x4e')]['filter']){_0x522ba8[_0x112a('0x57')]=_[_0x112a('0x59')](_0x522ba8[_0x112a('0x57')],{'$or':_[_0x112a('0x4a')](_0x522ba8[_0x112a('0x52')],function(_0x21b503){var _0x539b06={};_0x539b06[_0x21b503]={'$like':'%'+_0xa4c399['query']['filter']+'%'};return _0x539b06;})});}_0x522ba8=_[_0x112a('0x59')]({},_0x522ba8,_0xa4c399[_0x112a('0x5c')]);return db[_0x112a('0x120')][_0x112a('0x2a')]({'where':_0x522ba8[_0x112a('0x57')]})[_0x112a('0x1a')](function(_0x46f659){_0x582265['count']=_0x46f659;if(_0xa4c399[_0x112a('0x4e')][_0x112a('0x5d')]){_0x522ba8[_0x112a('0x5e')]=[{'all':!![]}];}else{_0x522ba8['include']=[{'model':db[_0x112a('0x94')],'as':_0x112a('0xee'),'required':![]},{'model':db[_0x112a('0xda')],'as':'Attachments','required':![]}];}return db[_0x112a('0x120')][_0x112a('0x5f')](_0x522ba8);})[_0x112a('0x1a')](function(_0x2eec74){_0x582265[_0x112a('0x60')]=_0x2eec74;return _0x582265;});}})[_0x112a('0x1a')](respondWithFilteredResult(_0x474c5a,_0x522ba8))['catch'](handleError(_0x474c5a,null));};exports[_0x112a('0x121')]=function(_0x461117,_0x198d8b){return db[_0x112a('0x4b')][_0x112a('0x64')]({'where':{'id':_0x461117[_0x112a('0x62')]['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0x198d8b,null))[_0x112a('0x1a')](function(_0x20bb05){if(_0x20bb05){return _0x20bb05[_0x112a('0x121')](_0x461117[_0x112a('0x66')][_0x112a('0x75')],_[_0x112a('0x122')](_0x461117['body'],[_0x112a('0x75'),'id'])||{})['spread'](function(_0x3f5e88){for(var _0x59c655=0x0;_0x59c655<_0x461117[_0x112a('0x66')]['ids']['length'];_0x59c655+=0x1){socket[_0x112a('0x123')]('userChatWebsite:save',{'UserId':Number(_0x461117[_0x112a('0x66')]['ids'][_0x59c655]),'ChatWebsiteId':Number(_0x461117[_0x112a('0x62')]['id'])});}return _0x3f5e88;});}})[_0x112a('0x1a')](respondWithResult(_0x198d8b,null))[_0x112a('0x25')](handleError(_0x198d8b,null));};exports[_0x112a('0x124')]=function(_0x22f5bc,_0x21e45e){return db[_0x112a('0x4b')][_0x112a('0x64')]({'where':{'id':_0x22f5bc['params']['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0x21e45e,null))[_0x112a('0x1a')](function(_0x277a23){if(_0x277a23){return _0x277a23[_0x112a('0x124')](_0x22f5bc['query']['ids'])[_0x112a('0x1a')](function(){if(_[_0x112a('0x125')](_0x22f5bc[_0x112a('0x4e')]['ids'])){for(var _0x48dc16=0x0;_0x48dc16<_0x22f5bc[_0x112a('0x4e')]['ids'][_0x112a('0x53')];_0x48dc16+=0x1){socket[_0x112a('0x123')](_0x112a('0x126'),{'UserId':Number(_0x22f5bc[_0x112a('0x4e')][_0x112a('0x75')][_0x48dc16]),'ChatWebsiteId':Number(_0x22f5bc[_0x112a('0x62')]['id'])});}}else{socket['emit'](_0x112a('0x126'),{'UserId':Number(_0x22f5bc[_0x112a('0x4e')]['ids']),'ChatWebsiteId':Number(_0x22f5bc['params']['id'])});}});}})['then'](respondWithStatusCode(_0x21e45e,null))[_0x112a('0x25')](handleError(_0x21e45e,null));};exports[_0x112a('0x127')]=function(_0x1137db,_0xd1a055){var _0x31d2fc={};var _0x407cb3={};var _0xef7b3;var _0x296097;return db['ChatWebsite']['findOne']({'where':{'id':_0x1137db[_0x112a('0x62')]['id']}})[_0x112a('0x1a')](handleEntityNotFound(_0xd1a055,null))[_0x112a('0x1a')](function(_0xcbc1e0){if(_0xcbc1e0){_0xef7b3=_0xcbc1e0;_0x407cb3['model']=_[_0x112a('0x63')](db[_0x112a('0x128')][_0x112a('0x4c')]);_0x407cb3[_0x112a('0x4e')]=_[_0x112a('0x63')](_0x1137db[_0x112a('0x4e')]);_0x407cb3['filters']=_[_0x112a('0x50')](_0x407cb3[_0x112a('0x44')],_0x407cb3[_0x112a('0x4e')]);_0x31d2fc['attributes']=_[_0x112a('0x50')](_0x407cb3[_0x112a('0x44')],qs['fields'](_0x1137db[_0x112a('0x4e')][_0x112a('0x51')]));_0x31d2fc[_0x112a('0x52')]=_0x31d2fc[_0x112a('0x52')]['length']?_0x31d2fc[_0x112a('0x52')]:_0x407cb3[_0x112a('0x44')];_0x31d2fc[_0x112a('0x55')]=qs[_0x112a('0x56')](_0x1137db[_0x112a('0x4e')][_0x112a('0x56')]);_0x31d2fc['where']=qs['filters'](_[_0x112a('0x58')](_0x1137db[_0x112a('0x4e')],_0x407cb3['filters']));if(_0x1137db[_0x112a('0x4e')]['filter']){_0x31d2fc[_0x112a('0x57')]=_['merge'](_0x31d2fc[_0x112a('0x57')],{'$or':_[_0x112a('0x4a')](_0x31d2fc[_0x112a('0x52')],function(_0x16e124){var _0x3ade9a={};_0x3ade9a[_0x16e124]={'$like':'%'+_0x1137db[_0x112a('0x4e')][_0x112a('0x5b')]+'%'};return _0x3ade9a;})});}_0x31d2fc=_[_0x112a('0x59')]({},_0x31d2fc,_0x1137db[_0x112a('0x5c')]);return _0xef7b3[_0x112a('0x127')](_0x31d2fc);}})[_0x112a('0x1a')](function(_0x1ab70e){if(_0x1ab70e){_0x296097=_0x1ab70e[_0x112a('0x53')];if(!_0x1137db[_0x112a('0x4e')][_0x112a('0x72')]('nolimit')){_0x31d2fc[_0x112a('0x29')]=qs['limit'](_0x1137db[_0x112a('0x4e')][_0x112a('0x29')]);_0x31d2fc[_0x112a('0x28')]=qs[_0x112a('0x28')](_0x1137db[_0x112a('0x4e')][_0x112a('0x28')]);}return _0xef7b3[_0x112a('0x127')](_0x31d2fc);}})[_0x112a('0x1a')](function(_0x11c18b){if(_0x11c18b){return _0x11c18b?{'count':_0x296097,'rows':_0x11c18b}:null;}})[_0x112a('0x1a')](respondWithResult(_0xd1a055,null))['catch'](handleError(_0xd1a055,null));}; \ No newline at end of file +var _0xf23c=['attachments','offline-chat','openNewInteraction','transaction','bulkCreate','Smtp','CloudProvider','forwardOffline','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','originalname','toPairsIn','subjectOffline','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','nolimit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','findAll','virtual','custom','License','increment','server/files/chat/iframe.ejs','utf8','URL','address','origin','3.5.0','remote','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findAndCountAll','priority','stack','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','util','ejs','fs-extra','querystring','html-to-text','ioredis','../../components/parsers/qs','api','../../errors/api','APIOutOfIntervalError','APINotFoundError','handleError','../../mysqldb','redis','localhost','register','http','client','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','ChatWebsites','UserProfileResource','end','sendStatus','name','send','Command','getSnippet','format','iftime\x20%s,%s','interval','indexOf','true','ONLINE','OFFLINE','timezone','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','get','all','some','user-agent-parser','setUA','first','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','model','%s\x20%s\x20%s','vendor','type','index','mandatoryDispositionPause','ChatWebsite','fieldName','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','rows','params','Pause','rawAttributes','create','body','role','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','chat','CmContact','describe','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','CompanyId','ListId','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','Interval','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','list','defaults','from','contact','headers','threadId','ChatInteraction','externalUrl','interaction','messageId','created','autoclose','applications','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','EventManager','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype'];(function(_0x57e4aa,_0x482b33){var _0x203e32=function(_0xf03c77){while(--_0xf03c77){_0x57e4aa['push'](_0x57e4aa['shift']());}};_0x203e32(++_0x482b33);}(_0xf23c,0x187));var _0xcf23=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0xf23c[_0x546aaf];return _0x1cbf6d;};'use strict';var Mustache=require('mustache');var util=require(_0xcf23('0x0'));var path=require('path');var ejs=require(_0xcf23('0x1'));var fs=require('fs');var fs_extra=require(_0xcf23('0x2'));var _=require('lodash');var querystring=require(_0xcf23('0x3'));var htmlToText=require(_0xcf23('0x4'));var Redis=require(_0xcf23('0x5'));var jayson=require('jayson/promise');var url=require('url');var qs=require(_0xcf23('0x6'));var logger=require('../../config/logger')(_0xcf23('0x7'));var config=require('../../config/environment');var APIOutOfIntervalError=require(_0xcf23('0x8'))[_0xcf23('0x9')];var APINotFoundError=require(_0xcf23('0x8'))[_0xcf23('0xa')];var APIHandleError=require(_0xcf23('0x8'))[_0xcf23('0xb')];var db=require(_0xcf23('0xc'))['db'];config['redis']=_['defaults'](config[_0xcf23('0xd')],{'host':_0xcf23('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcf23('0xd')]));require('./chatWebsite.socket')[_0xcf23('0xf')](socket);var client=jayson['client'][_0xcf23('0x10')]({'port':0x232c});var client9002=jayson[_0xcf23('0x11')]['http']({'port':0x232a});var client9003=jayson[_0xcf23('0x11')][_0xcf23('0x10')]({'port':0x232b});var client9001=jayson[_0xcf23('0x11')][_0xcf23('0x10')]({'port':0x2329});function respondWithRpcPromise(_0x30b99f,_0x240806,_0x15af06,_0x6febee){return new Promise(function(_0x4d79df,_0x351f28){var _0x281e63=_0x6febee||client;return _0x281e63[_0xcf23('0x12')](_0x30b99f,_0x15af06)[_0xcf23('0x13')](function(_0x489fd9){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x240806,_0xcf23('0x14'));logger[_0xcf23('0x15')](_0xcf23('0x16'),_0x240806,_0xcf23('0x14'),JSON[_0xcf23('0x17')](_0x489fd9));if(_0x489fd9[_0xcf23('0x18')]){if(_0x489fd9['error'][_0xcf23('0x19')]===0x1f4){logger[_0xcf23('0x18')](_0xcf23('0x1a'),_0x240806,_0x489fd9[_0xcf23('0x18')]['message']);return _0x351f28(_0x489fd9[_0xcf23('0x18')][_0xcf23('0x1b')]);}logger[_0xcf23('0x18')](_0xcf23('0x1a'),_0x240806,_0x489fd9[_0xcf23('0x18')]['message']);return _0x4d79df(_0x489fd9[_0xcf23('0x18')][_0xcf23('0x1b')]);}else{logger[_0xcf23('0x1c')](_0xcf23('0x1a'),_0x240806,_0xcf23('0x14'));_0x4d79df(_0x489fd9[_0xcf23('0x1d')]['message']);}})[_0xcf23('0x1e')](function(_0x196ef5){logger[_0xcf23('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x240806,_0x196ef5);_0x351f28(_0x196ef5);});});}function respondWithStatusCode(_0x33fac1,_0x501720){_0x501720=_0x501720||0xcc;return function(_0x4e01b8){if(_0x4e01b8){return _0x33fac1['sendStatus'](_0x501720);}return _0x33fac1[_0xcf23('0x1f')](_0x501720)['end']();};}function respondWithResult(_0x838cae,_0xed58e5){_0xed58e5=_0xed58e5||0xc8;return function(_0x458557){if(_0x458557){return _0x838cae[_0xcf23('0x1f')](_0xed58e5)['json'](_0x458557);}};}function respondWithFilteredResult(_0x2a2f49,_0x3a08d6){return function(_0x24d2c8){if(_0x24d2c8){var _0x3c288f=typeof _0x3a08d6[_0xcf23('0x20')]===_0xcf23('0x21')&&typeof _0x3a08d6[_0xcf23('0x22')]==='undefined';var _0x6eb6d7=_0x24d2c8[_0xcf23('0x23')];var _0x26b581=_0x3c288f?0x0:_0x3a08d6['offset'];var _0x3105c0=_0x3c288f?_0x24d2c8[_0xcf23('0x23')]:_0x3a08d6[_0xcf23('0x20')]+_0x3a08d6[_0xcf23('0x22')];var _0x3db040;if(_0x3105c0>=_0x6eb6d7){_0x3105c0=_0x6eb6d7;_0x3db040=0xc8;}else{_0x3db040=0xce;}_0x2a2f49[_0xcf23('0x1f')](_0x3db040);return _0x2a2f49[_0xcf23('0x24')](_0xcf23('0x25'),_0x26b581+'-'+_0x3105c0+'/'+_0x6eb6d7)[_0xcf23('0x26')](_0x24d2c8);}return null;};}function saveUpdates(_0x5010bb){return function(_0x591d5e){if(_0x591d5e){return _0x591d5e[_0xcf23('0x27')](_0x5010bb)['then'](function(_0x33a2f7){return _0x33a2f7;});}return null;};}function removeEntity(_0x283550){return function(_0x5d1697){if(_0x5d1697){return _0x5d1697[_0xcf23('0x28')]()[_0xcf23('0x13')](function(){var _0x37528e=_0x5d1697['get']({'plain':!![]});var _0x12fbae=_0xcf23('0x29');return db[_0xcf23('0x2a')]['destroy']({'where':{'type':_0x12fbae,'resourceId':_0x37528e['id']}})[_0xcf23('0x13')](function(){return _0x5d1697;});})[_0xcf23('0x13')](function(){_0x283550[_0xcf23('0x1f')](0xcc)[_0xcf23('0x2b')]();});}};}function handleEntityNotFound(_0x27677f){return function(_0x867e77){if(!_0x867e77){_0x27677f[_0xcf23('0x2c')](0x194);}return _0x867e77;};}function handleError(_0x5a8b63,_0x5dcb81){_0x5dcb81=_0x5dcb81||0x1f4;return function(_0x515f11){logger[_0xcf23('0x18')](_0x515f11['stack']);if(_0x515f11[_0xcf23('0x2d')]){delete _0x515f11['name'];}_0x5a8b63[_0xcf23('0x1f')](_0x5dcb81)[_0xcf23('0x2e')](_0x515f11);};}function iftimePromise(_0x2abab9,_0x5eaa19){return respondWithRpcPromise(_0xcf23('0x2f'),_0xcf23('0x30'),{'command':_0x5eaa19['timezone']?util[_0xcf23('0x31')](_0xcf23('0x32'),_0x2abab9[_0xcf23('0x33')],_0x5eaa19['timezone']):util[_0xcf23('0x31')]('iftime\x20%s',_0x2abab9[_0xcf23('0x33')])},client9002)[_0xcf23('0x13')](function(_0x69f535){var _0x5cfe01=_0x69f535&&_0x69f535[_0xcf23('0x34')](_0xcf23('0x35'))>=0x0?!![]:![];logger[_0xcf23('0x1c')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5eaa19['id'],_0x2abab9['id'],_0x2abab9['interval'],_0x5cfe01?_0xcf23('0x36'):_0xcf23('0x37'),_0x5eaa19[_0xcf23('0x38')]?_0x5eaa19[_0xcf23('0x38')]:_0xcf23('0x39'));return _0x5cfe01;})[_0xcf23('0x1e')](function(_0xd08f7){logger[_0xcf23('0x18')](_0xcf23('0x3a'),_0x5eaa19['id'],_0x2abab9['id'],_0x2abab9[_0xcf23('0x33')],util[_0xcf23('0x3b')](_0xd08f7,{'showHidden':![],'depth':null}),_0x5eaa19[_0xcf23('0x38')]?_0x5eaa19[_0xcf23('0x38')]:_0xcf23('0x39'));return![];});}function checkWebsiteIntervals(_0x2e3834){var _0x241936=_['map'](_0x2e3834['Interval']['Intervals'],function(_0x17505d){var _0x12ce56=_0x17505d[_0xcf23('0x3c')]({'plain':!![]});return iftimePromise(_0x12ce56,_0x2e3834);});return Promise[_0xcf23('0x3d')](_0x241936)[_0xcf23('0x13')](function(_0x2150f4){return _[_0xcf23('0x3e')](_0x2150f4);});}function createInteractionObject(_0x5885cf,_0x54da07,_0x44d6f5,_0x28dd72){var _0x10cf49=require(_0xcf23('0x3f'));var _0x45c435=new _0x10cf49();var _0x5dfcae=_0x45c435[_0xcf23('0x40')](_0x44d6f5['user-agent'])['getResult']();var _0x265afb=_0x54da07['customerIp'];if(_0x44d6f5['cf-connecting-ip']){_0x265afb=_0x44d6f5['cf-connecting-ip'];}else if(_0x44d6f5['x-forwarded-for']){_0x265afb=_[_0xcf23('0x41')](_0x44d6f5[_0xcf23('0x42')]['split'](','));}return{'ContactId':_0x28dd72['id'],'ChatWebsiteId':_0x5885cf,'from':(_0x28dd72[_0xcf23('0x43')]||'')+'\x20'+(_0x28dd72[_0xcf23('0x44')]||''),'customerIp':_0x265afb,'customerPort':_0x44d6f5[_0xcf23('0x45')]?_0x44d6f5[_0xcf23('0x45')]:null,'referer':_0x54da07[_0xcf23('0x46')],'browserName':_0x5dfcae[_0xcf23('0x47')][_0xcf23('0x2d')]&&_0x5dfcae[_0xcf23('0x47')][_0xcf23('0x48')]?util[_0xcf23('0x31')](_0xcf23('0x49'),_0x5dfcae['browser'][_0xcf23('0x2d')],_0x5dfcae[_0xcf23('0x47')][_0xcf23('0x48')]):_0xcf23('0x4a'),'browserVersion':_0x5dfcae[_0xcf23('0x47')][_0xcf23('0x48')]||_0xcf23('0x4a'),'osName':util[_0xcf23('0x31')](_0xcf23('0x49'),_0x5dfcae['os'][_0xcf23('0x2d')],_0x5dfcae['os']['version']),'osVersion':_0x5dfcae['os']['version'],'deviceModel':_0x5dfcae[_0xcf23('0x4b')][_0xcf23('0x4c')]&&_0x5dfcae[_0xcf23('0x4b')]['vendor']?util[_0xcf23('0x31')](_0xcf23('0x4d'),_0x5dfcae[_0xcf23('0x4b')][_0xcf23('0x4c')],_0x5dfcae[_0xcf23('0x4b')][_0xcf23('0x4e')],_0x5dfcae[_0xcf23('0x4b')][_0xcf23('0x4f')]):null,'deviceVendor':_0x5dfcae['device'][_0xcf23('0x4e')],'deviceType':_0x5dfcae['device']['type'],'formData':JSON[_0xcf23('0x17')](_0x54da07)};}exports[_0xcf23('0x50')]=function(_0x5150f0,_0x412180){var _0x382aca={'include':[{'model':db['Pause'],'as':_0xcf23('0x51')}]},_0x6f3901={},_0x274bcb={'count':0x0,'rows':[]};var _0x4ec794=_['map'](db[_0xcf23('0x52')]['rawAttributes'],function(_0x415f8e){return{'name':_0x415f8e[_0xcf23('0x53')],'type':_0x415f8e[_0xcf23('0x4f')]['key']};});_0x6f3901[_0xcf23('0x4c')]=_[_0xcf23('0x54')](_0x4ec794,_0xcf23('0x2d'));_0x6f3901['query']=_[_0xcf23('0x55')](_0x5150f0[_0xcf23('0x56')]);_0x6f3901[_0xcf23('0x57')]=_['intersection'](_0x6f3901['model'],_0x6f3901[_0xcf23('0x56')]);_0x382aca[_0xcf23('0x58')]=_[_0xcf23('0x59')](_0x6f3901[_0xcf23('0x4c')],qs[_0xcf23('0x5a')](_0x5150f0['query'][_0xcf23('0x5a')]));_0x382aca[_0xcf23('0x58')]=_0x382aca[_0xcf23('0x58')][_0xcf23('0x5b')]?_0x382aca[_0xcf23('0x58')]:_0x6f3901['model'];if(!_0x5150f0['query'][_0xcf23('0x5c')]('nolimit')){_0x382aca['limit']=qs['limit'](_0x5150f0[_0xcf23('0x56')][_0xcf23('0x22')]);_0x382aca[_0xcf23('0x20')]=qs['offset'](_0x5150f0['query'][_0xcf23('0x20')]);}_0x382aca['order']=qs['sort'](_0x5150f0['query'][_0xcf23('0x5d')]);_0x382aca[_0xcf23('0x5e')]=qs[_0xcf23('0x57')](_[_0xcf23('0x5f')](_0x5150f0[_0xcf23('0x56')],_0x6f3901[_0xcf23('0x57')]),_0x4ec794);if(_0x5150f0['query'][_0xcf23('0x60')]){_0x382aca[_0xcf23('0x5e')]=_[_0xcf23('0x61')](_0x382aca[_0xcf23('0x5e')],{'$or':_['map'](_0x4ec794,function(_0xabddf7){if(_0xabddf7[_0xcf23('0x4f')]!=='VIRTUAL'){var _0x26487b={};_0x26487b[_0xabddf7[_0xcf23('0x2d')]]={'$like':'%'+_0x5150f0['query'][_0xcf23('0x60')]+'%'};return _0x26487b;}})});}_0x382aca=_[_0xcf23('0x61')]({},_0x382aca,_0x5150f0[_0xcf23('0x62')]);var _0x3c3a4b={'where':_0x382aca[_0xcf23('0x5e')]};return db[_0xcf23('0x52')][_0xcf23('0x23')](_0x3c3a4b)['then'](function(_0x1b23c0){_0x274bcb['count']=_0x1b23c0;if(_0x5150f0['query'][_0xcf23('0x63')]){_0x382aca[_0xcf23('0x64')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x382aca);})[_0xcf23('0x13')](function(_0x55d64e){_0x274bcb[_0xcf23('0x65')]=_0x55d64e;return _0x274bcb;})['then'](respondWithFilteredResult(_0x412180,_0x382aca))[_0xcf23('0x1e')](handleError(_0x412180,null));};exports['show']=function(_0x348e15,_0x14b8dd){var _0x5b602f={'raw':![],'where':{'id':_0x348e15[_0xcf23('0x66')]['id']},'include':[{'model':db[_0xcf23('0x67')],'as':_0xcf23('0x51')}]},_0xf27beb={};_0xf27beb[_0xcf23('0x4c')]=_[_0xcf23('0x55')](db[_0xcf23('0x52')][_0xcf23('0x68')]);_0xf27beb[_0xcf23('0x56')]=_['keys'](_0x348e15[_0xcf23('0x56')]);_0xf27beb[_0xcf23('0x57')]=_[_0xcf23('0x59')](_0xf27beb[_0xcf23('0x4c')],_0xf27beb[_0xcf23('0x56')]);_0x5b602f['attributes']=_['intersection'](_0xf27beb['model'],qs[_0xcf23('0x5a')](_0x348e15[_0xcf23('0x56')][_0xcf23('0x5a')]));_0x5b602f['attributes']=_0x5b602f['attributes'][_0xcf23('0x5b')]?_0x5b602f[_0xcf23('0x58')]:_0xf27beb[_0xcf23('0x4c')];if(_0x348e15[_0xcf23('0x56')][_0xcf23('0x63')]){_0x5b602f['include']=[{'all':!![]}];}_0x5b602f=_[_0xcf23('0x61')]({},_0x5b602f,_0x348e15['options']);return db['ChatWebsite']['find'](_0x5b602f)[_0xcf23('0x13')](handleEntityNotFound(_0x14b8dd,null))[_0xcf23('0x13')](respondWithResult(_0x14b8dd,null))[_0xcf23('0x1e')](handleError(_0x14b8dd,null));};exports[_0xcf23('0x69')]=function(_0x2f69db,_0x3168ed){return db[_0xcf23('0x52')][_0xcf23('0x69')](_0x2f69db[_0xcf23('0x6a')],{})[_0xcf23('0x13')](function(_0x1a5efa){var _0x9bc11d=_0x2f69db['user']['get']({'plain':!![]});if(!_0x9bc11d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9bc11d[_0xcf23('0x6b')]===_0xcf23('0x6c')){var _0x1b4d12=_0x1a5efa[_0xcf23('0x3c')]({'plain':!![]});var _0x5218d4=_0xcf23('0x29');return db[_0xcf23('0x6d')][_0xcf23('0x6e')]({'where':{'name':_0x5218d4,'userProfileId':_0x9bc11d['userProfileId']},'raw':!![]})['then'](function(_0x2e5882){if(_0x2e5882&&_0x2e5882['autoAssociation']===0x0){return db[_0xcf23('0x2a')]['create']({'name':_0x1b4d12['name'],'resourceId':_0x1b4d12['id'],'type':_0x2e5882[_0xcf23('0x2d')],'sectionId':_0x2e5882['id']},{})['then'](function(){return _0x1a5efa;});}else{return _0x1a5efa;}})[_0xcf23('0x1e')](function(_0x2595ac){logger[_0xcf23('0x18')](_0xcf23('0x6f'),_0x2595ac);throw _0x2595ac;});}return _0x1a5efa;})[_0xcf23('0x13')](respondWithResult(_0x3168ed,0xc9))[_0xcf23('0x1e')](handleError(_0x3168ed,null));};exports[_0xcf23('0x27')]=function(_0x580fb3,_0x225d96){if(_0x580fb3[_0xcf23('0x6a')]['id']){delete _0x580fb3[_0xcf23('0x6a')]['id'];}return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x580fb3['params']['id']},'include':[{'model':db[_0xcf23('0x67')],'as':_0xcf23('0x51')}]})[_0xcf23('0x13')](handleEntityNotFound(_0x225d96,null))[_0xcf23('0x13')](saveUpdates(_0x580fb3[_0xcf23('0x6a')],null))[_0xcf23('0x13')](respondWithResult(_0x225d96,null))[_0xcf23('0x1e')](handleError(_0x225d96,null));};exports[_0xcf23('0x28')]=function(_0x1a530f,_0x5c02ef){return db[_0xcf23('0x52')]['find']({'where':{'id':_0x1a530f[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x5c02ef,null))[_0xcf23('0x13')](removeEntity(_0x5c02ef,null))[_0xcf23('0x1e')](handleError(_0x5c02ef,null));};exports['describe']=function(_0x3f9f76,_0x57fcf3){return db[_0xcf23('0x52')]['describe']()[_0xcf23('0x13')](respondWithResult(_0x57fcf3,null))[_0xcf23('0x1e')](handleError(_0x57fcf3,null));};exports[_0xcf23('0x70')]=function(_0x1fc6e1,_0xd7ab80){if(_0x1fc6e1[_0xcf23('0x6a')]['id']){delete _0x1fc6e1[_0xcf23('0x6a')]['id'];}return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x1fc6e1[_0xcf23('0x66')]['id']}})['then'](handleEntityNotFound(_0xd7ab80,null))[_0xcf23('0x13')](function(_0x2879f9){if(_0x2879f9){_0x1fc6e1[_0xcf23('0x6a')][_0xcf23('0x71')]=_0x2879f9['id'];return db[_0xcf23('0x72')][_0xcf23('0x69')](_0x1fc6e1['body']);}})['then'](respondWithResult(_0xd7ab80,null))[_0xcf23('0x1e')](handleError(_0xd7ab80,null));};exports[_0xcf23('0x73')]=function(_0x4ded20,_0x5acd00){var _0x170e2e={'raw':![],'where':{}};var _0x56f38f={};var _0x78c888={'count':0x0,'rows':[]};return db[_0xcf23('0x52')][_0xcf23('0x74')]({'where':{'id':_0x4ded20[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x5acd00,null))[_0xcf23('0x13')](function(_0x6b7841){if(_0x6b7841){_0x56f38f['model']=_[_0xcf23('0x55')](db[_0xcf23('0x72')][_0xcf23('0x68')]);_0x56f38f['query']=_['keys'](_0x4ded20[_0xcf23('0x56')]);_0x56f38f['filters']=_[_0xcf23('0x59')](_0x56f38f[_0xcf23('0x4c')],_0x56f38f[_0xcf23('0x56')]);_0x170e2e[_0xcf23('0x58')]=_[_0xcf23('0x59')](_0x56f38f[_0xcf23('0x4c')],qs[_0xcf23('0x5a')](_0x4ded20[_0xcf23('0x56')][_0xcf23('0x5a')]));_0x170e2e['attributes']=_0x170e2e[_0xcf23('0x58')][_0xcf23('0x5b')]?_0x170e2e[_0xcf23('0x58')]:_0x56f38f[_0xcf23('0x4c')];if(!_0x4ded20[_0xcf23('0x56')][_0xcf23('0x5c')]('nolimit')){_0x170e2e[_0xcf23('0x22')]=qs['limit'](_0x4ded20[_0xcf23('0x56')][_0xcf23('0x22')]);_0x170e2e[_0xcf23('0x20')]=qs[_0xcf23('0x20')](_0x4ded20['query']['offset']);}_0x170e2e[_0xcf23('0x75')]=qs[_0xcf23('0x5d')](_0x4ded20[_0xcf23('0x56')][_0xcf23('0x5d')]);_0x170e2e[_0xcf23('0x5e')]=qs[_0xcf23('0x57')](_[_0xcf23('0x5f')](_0x4ded20[_0xcf23('0x56')],_0x56f38f[_0xcf23('0x57')]));_0x170e2e['where']['ChatWebsiteId']=_0x6b7841['id'];if(_0x4ded20['query']['filter']){_0x170e2e[_0xcf23('0x5e')]=_[_0xcf23('0x61')](_0x170e2e['where'],{'$or':_[_0xcf23('0x54')](_0x170e2e[_0xcf23('0x58')],function(_0x59bbaf){var _0x2cf0a9={};_0x2cf0a9[_0x59bbaf]={'$like':'%'+_0x4ded20[_0xcf23('0x56')][_0xcf23('0x60')]+'%'};return _0x2cf0a9;})});}_0x170e2e=_['merge']({},_0x170e2e,_0x4ded20[_0xcf23('0x62')]);return db[_0xcf23('0x72')][_0xcf23('0x23')]({'where':_0x170e2e[_0xcf23('0x5e')]})[_0xcf23('0x13')](function(_0x195463){_0x78c888[_0xcf23('0x23')]=_0x195463;if(_0x4ded20[_0xcf23('0x56')][_0xcf23('0x63')]){_0x170e2e[_0xcf23('0x64')]=[{'all':!![]}];}return db[_0xcf23('0x72')]['findAll'](_0x170e2e);})[_0xcf23('0x13')](function(_0x51d61b){_0x78c888['rows']=_0x51d61b;return _0x78c888;});}})['then'](respondWithFilteredResult(_0x5acd00,_0x170e2e))[_0xcf23('0x1e')](handleError(_0x5acd00,null));};exports[_0xcf23('0x76')]=function(_0x454f39,_0x5bc6cf){return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x454f39[_0xcf23('0x66')]['id']}})['then'](handleEntityNotFound(_0x5bc6cf,null))[_0xcf23('0x13')](function(_0xc45c7){if(_0xc45c7){return _0xc45c7[_0xcf23('0x76')](_0x454f39[_0xcf23('0x56')][_0xcf23('0x77')]);}})['then'](respondWithStatusCode(_0x5bc6cf,null))['catch'](handleError(_0x5bc6cf,null));};exports[_0xcf23('0x78')]=function(_0xfa7750,_0x2f12cb){if(_0xfa7750[_0xcf23('0x6a')]['id']){delete _0xfa7750[_0xcf23('0x6a')]['id'];}return db['ChatWebsite'][_0xcf23('0x6e')]({'where':{'id':_0xfa7750[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x2f12cb,null))['then'](function(_0x48d58f){if(_0x48d58f){_0xfa7750['body'][_0xcf23('0x71')]=_0x48d58f['id'];return db[_0xcf23('0x79')][_0xcf23('0x69')](_0xfa7750[_0xcf23('0x6a')]);}})[_0xcf23('0x13')](respondWithResult(_0x2f12cb,null))[_0xcf23('0x1e')](handleError(_0x2f12cb,null));};exports[_0xcf23('0x7a')]=function(_0x3a45c0,_0x1d64d3){var _0x373138={'raw':![],'where':{}};var _0x4c7c79={};var _0x1e5fa7={'count':0x0,'rows':[]};return db[_0xcf23('0x52')][_0xcf23('0x74')]({'where':{'id':_0x3a45c0[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x1d64d3,null))[_0xcf23('0x13')](function(_0x282805){if(_0x282805){_0x4c7c79['model']=_[_0xcf23('0x55')](db['CannedAnswer'][_0xcf23('0x68')]);_0x4c7c79[_0xcf23('0x56')]=_[_0xcf23('0x55')](_0x3a45c0[_0xcf23('0x56')]);_0x4c7c79['filters']=_[_0xcf23('0x59')](_0x4c7c79['model'],_0x4c7c79['query']);_0x373138[_0xcf23('0x58')]=_[_0xcf23('0x59')](_0x4c7c79[_0xcf23('0x4c')],qs[_0xcf23('0x5a')](_0x3a45c0[_0xcf23('0x56')][_0xcf23('0x5a')]));_0x373138[_0xcf23('0x58')]=_0x373138['attributes'][_0xcf23('0x5b')]?_0x373138['attributes']:_0x4c7c79[_0xcf23('0x4c')];if(!_0x3a45c0['query'][_0xcf23('0x5c')]('nolimit')){_0x373138[_0xcf23('0x22')]=qs[_0xcf23('0x22')](_0x3a45c0[_0xcf23('0x56')][_0xcf23('0x22')]);_0x373138['offset']=qs[_0xcf23('0x20')](_0x3a45c0[_0xcf23('0x56')][_0xcf23('0x20')]);}_0x373138[_0xcf23('0x75')]=qs[_0xcf23('0x5d')](_0x3a45c0['query'][_0xcf23('0x5d')]);_0x373138[_0xcf23('0x5e')]=qs[_0xcf23('0x57')](_[_0xcf23('0x5f')](_0x3a45c0[_0xcf23('0x56')],_0x4c7c79['filters']));_0x373138['where'][_0xcf23('0x71')]=_0x282805['id'];if(_0x3a45c0['query'][_0xcf23('0x60')]){_0x373138[_0xcf23('0x5e')]=_['merge'](_0x373138[_0xcf23('0x5e')],{'$or':_['map'](_0x373138[_0xcf23('0x58')],function(_0xa1cef8){var _0x1f434e={};_0x1f434e[_0xa1cef8]={'$like':'%'+_0x3a45c0['query']['filter']+'%'};return _0x1f434e;})});}_0x373138=_[_0xcf23('0x61')]({},_0x373138,_0x3a45c0[_0xcf23('0x62')]);return db[_0xcf23('0x79')][_0xcf23('0x23')]({'where':_0x373138[_0xcf23('0x5e')]})[_0xcf23('0x13')](function(_0x226c0f){_0x1e5fa7[_0xcf23('0x23')]=_0x226c0f;if(_0x3a45c0[_0xcf23('0x56')][_0xcf23('0x63')]){_0x373138[_0xcf23('0x64')]=[{'all':!![]}];}return db[_0xcf23('0x79')]['findAll'](_0x373138);})['then'](function(_0x58326e){_0x1e5fa7['rows']=_0x58326e;return _0x1e5fa7;});}})['then'](respondWithFilteredResult(_0x1d64d3,_0x373138))[_0xcf23('0x1e')](handleError(_0x1d64d3,null));};exports[_0xcf23('0x7b')]=function(_0x4b5694,_0x130861){return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x4b5694[_0xcf23('0x66')]['id']}})['then'](handleEntityNotFound(_0x130861,null))[_0xcf23('0x13')](function(_0x1b1a77){if(_0x1b1a77){return _0x1b1a77[_0xcf23('0x7b')](_0x4b5694['query'][_0xcf23('0x77')]);}})[_0xcf23('0x13')](respondWithStatusCode(_0x130861,null))[_0xcf23('0x1e')](handleError(_0x130861,null));};exports[_0xcf23('0x7c')]=function(_0x543b2f,_0x200737){_0x543b2f[_0xcf23('0x6a')][_0xcf23('0x7d')]=_0x543b2f[_0xcf23('0x7e')][_0xcf23('0x7f')];return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x543b2f[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x200737,null))[_0xcf23('0x13')](saveUpdates(_0x543b2f[_0xcf23('0x6a')],null))['then'](respondWithResult(_0x200737,null))['catch'](handleError(_0x200737,null));};exports['addAvatar']=function(_0xf4313e,_0x58deaa){_0xf4313e[_0xcf23('0x6a')][_0xcf23('0x80')]=_0xf4313e[_0xcf23('0x7e')][_0xcf23('0x7f')];return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0xf4313e[_0xcf23('0x66')]['id']}})['then'](handleEntityNotFound(_0x58deaa,null))['then'](saveUpdates(_0xf4313e['body'],null))[_0xcf23('0x13')](respondWithResult(_0x58deaa,null))['catch'](handleError(_0x58deaa,null));};exports[_0xcf23('0x81')]=function(_0x467c46,_0x4ff4d0){_0x467c46[_0xcf23('0x6a')][_0xcf23('0x82')]=_0x467c46['file'][_0xcf23('0x7f')];return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x467c46[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x4ff4d0,null))[_0xcf23('0x13')](saveUpdates(_0x467c46[_0xcf23('0x6a')],null))[_0xcf23('0x13')](respondWithResult(_0x4ff4d0,null))['catch'](handleError(_0x4ff4d0,null));};exports[_0xcf23('0x83')]=function(_0x4954db,_0x1da6aa){_0x4954db[_0xcf23('0x6a')][_0xcf23('0x84')]=_0x4954db[_0xcf23('0x7e')]['filename'];return db[_0xcf23('0x52')]['find']({'where':{'id':_0x4954db['params']['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x1da6aa,null))[_0xcf23('0x13')](saveUpdates(_0x4954db[_0xcf23('0x6a')],null))[_0xcf23('0x13')](respondWithResult(_0x1da6aa,null))[_0xcf23('0x1e')](handleError(_0x1da6aa,null));};exports[_0xcf23('0x85')]=function(_0x22b0f6,_0xb7d523){var _0x3764fe=path[_0xcf23('0x86')](config[_0xcf23('0x87')],_0xcf23('0x88'));var _0x131ad3={'where':{'id':_0x22b0f6[_0xcf23('0x66')]['id']},'attributes':['id',_0xcf23('0x7d')],'raw':!![]};var _0xc49b03=![];return require(_0xcf23('0x89'))[_0xcf23('0x8a')]()['then'](function(_0x4944dc){if(_0x4944dc){_0xc49b03=_0x4944dc['custom'];}})[_0xcf23('0x13')](function(){return db['ChatWebsite'][_0xcf23('0x6e')](_0x131ad3);})['then'](handleEntityNotFound(_0xb7d523,null))['then'](function(_0x104fa2){if(_0x104fa2){if(!_[_0xcf23('0x8b')](_0x104fa2['sitepic'])){if(fs[_0xcf23('0x8c')](path[_0xcf23('0x86')](config[_0xcf23('0x87')],'server/files/images/logos/',_0x104fa2[_0xcf23('0x7d')]))&&_0xc49b03){_0x3764fe=path['join'](config[_0xcf23('0x87')],_0xcf23('0x8d'),_0x104fa2['sitepic']);}}return _0xb7d523[_0xcf23('0x8e')](_0x3764fe);}})[_0xcf23('0x1e')](handleError(_0xb7d523,null));};exports[_0xcf23('0x8f')]=function(_0x8f9cf9,_0x59801b){var _0x2b6730=path[_0xcf23('0x86')](config[_0xcf23('0x87')],_0xcf23('0x90'));var _0x3b9616={'where':{'id':_0x8f9cf9['params']['id']},'attributes':['id',_0xcf23('0x80')],'raw':!![]};return db[_0xcf23('0x52')][_0xcf23('0x6e')](_0x3b9616)[_0xcf23('0x13')](handleEntityNotFound(_0x59801b,null))['then'](function(_0x29d6dd){if(_0x29d6dd){if(!_['isNil'](_0x29d6dd[_0xcf23('0x80')])){if(fs['existsSync'](path[_0xcf23('0x86')](config[_0xcf23('0x87')],'server/files/images/avatars/',_0x29d6dd[_0xcf23('0x80')]))){_0x2b6730=path[_0xcf23('0x86')](config[_0xcf23('0x87')],_0xcf23('0x91'),_0x29d6dd[_0xcf23('0x80')]);}}return _0x59801b[_0xcf23('0x8e')](_0x2b6730);}})[_0xcf23('0x1e')](handleError(_0x59801b,null));};exports[_0xcf23('0x92')]=function(_0x23236a,_0x62a303){var _0xffb884=path['join'](config[_0xcf23('0x87')],_0xcf23('0x93'));var _0x3973e5={'where':{'id':_0x23236a[_0xcf23('0x66')]['id']},'attributes':['id',_0xcf23('0x82'),_0xcf23('0x94')],'raw':!![]};return db[_0xcf23('0x52')][_0xcf23('0x6e')](_0x3973e5)['then'](handleEntityNotFound(_0x62a303,null))[_0xcf23('0x13')](function(_0x256c38){if(_0x256c38){if(!_[_0xcf23('0x8b')](_0x256c38[_0xcf23('0x82')])){if(fs[_0xcf23('0x8c')](path[_0xcf23('0x86')](config[_0xcf23('0x87')],_0xcf23('0x91'),_0x256c38['customerAvatar']))&&_0x256c38[_0xcf23('0x94')]){_0xffb884=path['join'](config[_0xcf23('0x87')],_0xcf23('0x91'),_0x256c38[_0xcf23('0x82')]);}}return _0x62a303[_0xcf23('0x8e')](_0xffb884);}})[_0xcf23('0x1e')](handleError(_0x62a303,null));};exports[_0xcf23('0x95')]=function(_0x4fc89f,_0x475944){var _0x2f1d02=path[_0xcf23('0x86')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x49d023={'where':{'id':_0x4fc89f['params']['id']},'attributes':['id',_0xcf23('0x84')],'raw':!![]};return db[_0xcf23('0x52')][_0xcf23('0x6e')](_0x49d023)['then'](handleEntityNotFound(_0x475944,null))[_0xcf23('0x13')](function(_0x598715){if(_0x598715){if(!_[_0xcf23('0x8b')](_0x598715['systemAvatar'])){if(fs[_0xcf23('0x8c')](path['join'](config[_0xcf23('0x87')],_0xcf23('0x91'),_0x598715[_0xcf23('0x84')]))){_0x2f1d02=path['join'](config['root'],_0xcf23('0x91'),_0x598715[_0xcf23('0x84')]);}}return _0x475944[_0xcf23('0x8e')](_0x2f1d02);}})[_0xcf23('0x1e')](handleError(_0x475944,null));};exports[_0xcf23('0x96')]=function(_0x29ff87,_0x4cdac1){var _0x1d879b={'body':_0x29ff87[_0xcf23('0x6a')],'channel':_0xcf23('0x97')};var _0x41739b=[];var _0x3a087e=[];var _0x1ac81c={};var _0x32044b=![];return db[_0xcf23('0x98')][_0xcf23('0x99')]()['then'](function(_0x5d7994){if(!_0x5d7994){throw new db['Sequelize'][(_0xcf23('0x9a'))](_0xcf23('0x9b'));}_0x41739b=_['difference'](_['keys'](_0x5d7994),['createdAt',_0xcf23('0x9c')]);_0x3a087e=_[_0xcf23('0x9d')](_[_0xcf23('0x55')](_0x5d7994),[_0xcf23('0x9e'),'updatedAt',_0xcf23('0x9f'),_0xcf23('0xa0')]);if(_0x29ff87[_0xcf23('0x6a')]['id']){delete _0x29ff87[_0xcf23('0x6a')]['id'];}if(_[_0xcf23('0x8b')](_0x29ff87[_0xcf23('0x6a')]['from'])){throw new db[(_0xcf23('0xa1'))][(_0xcf23('0x9a'))](_0xcf23('0xa2'));}if(_[_0xcf23('0x8b')](_0x29ff87[_0xcf23('0x6a')][_0xcf23('0x6a')])||_0x29ff87[_0xcf23('0x6a')][_0xcf23('0x6a')]===''){throw new db[(_0xcf23('0xa1'))][(_0xcf23('0x9a'))](_0xcf23('0xa3'));}if(_[_0xcf23('0x8b')](_0x29ff87['body']['mapKey'])){throw new db[(_0xcf23('0xa1'))][(_0xcf23('0x9a'))](_0xcf23('0xa4')+_0x3a087e);}if(!_[_0xcf23('0xa5')](_0x3a087e,_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xa6')])){throw new db[(_0xcf23('0xa1'))][(_0xcf23('0x9a'))](_0xcf23('0xa7')+_0x3a087e);}_0x1ac81c[_0x29ff87['body'][_0xcf23('0xa6')]]=_0x29ff87[_0xcf23('0x6a')]['from'];})[_0xcf23('0x13')](function(){return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x29ff87[_0xcf23('0x66')]['id']},'include':[{'model':db[_0xcf23('0xa8')],'as':_0xcf23('0xa9'),'include':[{'model':db[_0xcf23('0x98')],'as':_0xcf23('0xaa'),'where':_0x1ac81c,'limit':0x1,'order':[[_0xcf23('0x9c'),_0xcf23('0xab')]]}]},{'model':db[_0xcf23('0xac')],'as':_0xcf23('0xad')},{'model':db[_0xcf23('0xae')],'as':_0xcf23('0xae'),'include':[{'model':db[_0xcf23('0xae')],'as':_0xcf23('0xaf'),'attributes':['id',_0xcf23('0x33')],'raw':!![]}]}]});})[_0xcf23('0x13')](function(_0x4621da){if(!_0x4621da)throw new APINotFoundError(util[_0xcf23('0x31')](_0xcf23('0xb0'),_0x29ff87['params']['id']));if(!_0x4621da[_0xcf23('0xae')]||!_0x4621da['Interval'][_0xcf23('0xaf')])return[_0x4621da,!![]];return[_0x4621da,checkWebsiteIntervals(_0x4621da)];})[_0xcf23('0xb1')](function(_0x329bba,_0x40ef57){if(!_0x40ef57)throw new APIOutOfIntervalError();if(!_0x329bba['List'])return;_0x1d879b[_0xcf23('0xb2')]=_0x329bba;_0x1d879b[_0xcf23('0xb3')]=_0x329bba[_0xcf23('0xa9')];_0x1d879b['applications']=_['orderBy'](_0x329bba[_0xcf23('0xad')],['priority'],['asc']);if(_0x1d879b[_0xcf23('0xb2')][_0xcf23('0xad')]){delete _0x1d879b['account'][_0xcf23('0xad')];}if(_0x1d879b[_0xcf23('0xb2')][_0xcf23('0xa9')]&&_0x1d879b['account']['List'][_0xcf23('0xaa')][_0xcf23('0x5b')]){return _0x1d879b[_0xcf23('0xb2')][_0xcf23('0xa9')][_0xcf23('0xaa')][0x0];}var _0x200758=_[_0xcf23('0xb4')](_0x29ff87[_0xcf23('0x6a')],{'firstName':_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xb5')],'ListId':_0x329bba[_0xcf23('0xa0')]});_0x200758[_0x29ff87[_0xcf23('0x6a')]['mapKey']]=_0x29ff87[_0xcf23('0x6a')]['from'];return db[_0xcf23('0x98')]['create'](_0x200758,{'fields':_0x41739b,'raw':!![]});})['then'](function(_0x53993d){_0x1d879b[_0xcf23('0xb6')]=_0x53993d;var _0x180d42=createInteractionObject(_0x29ff87[_0xcf23('0x66')]['id'],_0x29ff87['body'],_0x29ff87[_0xcf23('0xb7')],_0x53993d);var _0x3fbfdf={'ChatWebsiteId':_0x29ff87['params']['id'],'closed':![]};if(_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xb8')]){_0x3fbfdf[_0xcf23('0xb8')]=_0x29ff87[_0xcf23('0x6a')]['threadId'];return db[_0xcf23('0xb9')]['find']({'where':_0x3fbfdf})[_0xcf23('0x13')](function(_0x5389e7){if(_0x5389e7){_0x32044b=!![];return _0x5389e7;}_0x180d42['threadId']=_0x29ff87['body']['threadId'];_0x180d42[_0xcf23('0xba')]=_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xba')];return db['ChatInteraction'][_0xcf23('0x69')](_0x180d42);});}_0x3fbfdf['ContactId']=_0x53993d['id'];if(_0x29ff87['body']['interaction']&&_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xbb')]['id']){_0x3fbfdf['id']=_0x29ff87[_0xcf23('0x6a')]['interaction']['id'];return db[_0xcf23('0xb9')][_0xcf23('0x6e')]({'where':_0x3fbfdf})[_0xcf23('0x13')](function(_0x2d2c95){if(_0x2d2c95){_0x32044b=!![];return _0x2d2c95;}return db[_0xcf23('0xb9')]['create'](_0x180d42);});}return db[_0xcf23('0xb9')]['create'](_0x180d42);})[_0xcf23('0x13')](function(_0x25361a){if(!_0x32044b)return _0x25361a;var _0x149290={'from':(_0x1d879b['contact'][_0xcf23('0x43')]||'')+'\x20'+(_0x1d879b[_0xcf23('0xb6')][_0xcf23('0x44')]||'')};if(_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xb8')]&&_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xbc')]&&_0x29ff87['body'][_0xcf23('0xb8')]!=_0x29ff87[_0xcf23('0x6a')]['messageId']){_0x149290['threadId']=_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xbc')];}return _0x25361a['update'](_0x149290);})[_0xcf23('0x13')](function(_0x3fb283){_0x1d879b[_0xcf23('0xbb')]=_0x3fb283[_0xcf23('0x3c')]({'plain':!![]});_0x1d879b[_0xcf23('0xbb')][_0xcf23('0xbd')]=!_0x32044b;if(_0x1d879b[_0xcf23('0xbb')][_0xcf23('0xbd')]){if(_0x1d879b[_0xcf23('0xb2')][_0xcf23('0xbe')]){_0x1d879b[_0xcf23('0xbf')][_0xcf23('0xc0')]({'id':0x0,'priority':_0x1d879b[_0xcf23('0xbf')][_0xcf23('0x5b')]+0x1,'app':_0xcf23('0xc1'),'appdata':'unmanaged','interval':_0xcf23('0xc2')});}}return db['ChatMessage'][_0xcf23('0x69')]({'body':_0x29ff87[_0xcf23('0x6a')][_0xcf23('0x6a')],'ChatWebsiteId':_0x29ff87[_0xcf23('0x66')]['id'],'ChatInteractionId':_0x3fb283['id'],'direction':'in','ContactId':_0x1d879b[_0xcf23('0xb6')]['id'],'AttachmentId':_0x29ff87[_0xcf23('0x6a')][_0xcf23('0xc3')]});})[_0xcf23('0x13')](function(_0x242ea5){_0x1d879b[_0xcf23('0x1b')]=_0x242ea5;if(!_0x1d879b[_0xcf23('0xbb')][_0xcf23('0xc4')]){return;}return db[_0xcf23('0xc5')][_0xcf23('0x6e')]({'attributes':['id','name'],'where':{'id':_0x1d879b['interaction'][_0xcf23('0xc4')]}});})['then'](function(_0x344f03){if(_0x344f03){_0x1d879b[_0xcf23('0xbf')][_0xcf23('0xc6')]({'id':0x0,'priority':0x0,'app':_0xcf23('0xc7'),'appdata':_0x344f03[_0xcf23('0x2d')]+','+(_0x1d879b[_0xcf23('0xb2')][_0xcf23('0xc8')]||0xa),'interval':'*,*,*,*'});_0x1d879b[_0xcf23('0xc9')]=!![];}if(!_0x1d879b[_0xcf23('0xbb')][_0xcf23('0xca')]){return;}return db[_0xcf23('0xcb')][_0xcf23('0x6e')]({'attributes':['id',_0xcf23('0x2d')],'where':{'id':_0x1d879b[_0xcf23('0xbb')][_0xcf23('0xca')]}});})[_0xcf23('0x13')](function(_0x210042){if(_0x210042){_0x1d879b[_0xcf23('0xbf')][_0xcf23('0xc6')]({'id':0x0,'priority':0x1,'app':_0xcf23('0xcc'),'appdata':_0x210042['name']+','+(_0x1d879b[_0xcf23('0xb2')][_0xcf23('0xcd')]||0x12c),'interval':_0xcf23('0xc2')});}return respondWithRpcPromise(_0xcf23('0xce'),'startRouting',_0x1d879b);})[_0xcf23('0x13')](function(_0x4db081){respondWithRpcPromise(_0xcf23('0xcf'),_0xcf23('0xcf'),{'event':_0xcf23('0x96'),'message':_0x4db081},client9002);return _0x4db081;})['then'](respondWithResult(_0x4cdac1,null))['catch'](APIHandleError(_0x4cdac1));};exports['offline']=function(_0x402c44,_0x1f7bb7){var _0x22ae8d,_0x3e01d5,_0x227a0d;var _0x5d52c3=[];var _0x13b233={};var _0x54830e=_0x402c44[_0xcf23('0xd0')]||[];var _0x27314e=[];var _0x4cb9ef;return db['CmContact'][_0xcf23('0x99')]()[_0xcf23('0x13')](function(_0x22e9d9){if(!_0x22e9d9){throw new db[(_0xcf23('0xa1'))][(_0xcf23('0x9a'))](_0xcf23('0x9b'));}_0x5d52c3=_['difference'](_[_0xcf23('0x55')](_0x22e9d9),[_0xcf23('0x9e'),_0xcf23('0x9c'),'CompanyId',_0xcf23('0xa0')]);if(_0x402c44[_0xcf23('0x6a')]['id']){delete _0x402c44[_0xcf23('0x6a')]['id'];}if(_[_0xcf23('0x8b')](_0x402c44[_0xcf23('0x6a')][_0xcf23('0xb5')])){throw _0x1f7bb7[_0xcf23('0x1f')](0x1f4)[_0xcf23('0x2e')](new db[(_0xcf23('0xa1'))][(_0xcf23('0x9a'))](_0xcf23('0xa2')));}if(_[_0xcf23('0x8b')](_0x402c44[_0xcf23('0x6a')]['body'])||_0x402c44[_0xcf23('0x6a')][_0xcf23('0x6a')]===''){throw _0x1f7bb7[_0xcf23('0x1f')](0x1f4)[_0xcf23('0x2e')](new db[(_0xcf23('0xa1'))][(_0xcf23('0x9a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xcf23('0x8b')](_0x402c44['body'][_0xcf23('0xd1')])){throw _0x1f7bb7[_0xcf23('0x1f')](0x1f4)[_0xcf23('0x2e')](new db['Sequelize'][(_0xcf23('0x9a'))](_0xcf23('0xd2')+_0x5d52c3));}if(!_[_0xcf23('0xa5')](_0x5d52c3,_0x402c44[_0xcf23('0x6a')]['mapKeyOffline'])){throw _0x1f7bb7[_0xcf23('0x1f')](0x1f4)['send'](new db[(_0xcf23('0xa1'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5d52c3));}_0x13b233[_0x402c44[_0xcf23('0x6a')][_0xcf23('0xd1')]]=_0x402c44[_0xcf23('0x6a')][_0xcf23('0xb5')];})[_0xcf23('0x13')](function(){return db[_0xcf23('0x52')]['find']({'where':{'id':_0x402c44[_0xcf23('0x66')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0xcf23('0xd3')],'as':_0xcf23('0xd3')}]});})[_0xcf23('0x13')](handleEntityNotFound(_0x1f7bb7,null))[_0xcf23('0x13')](function(_0x51ee19){if(_0x51ee19&&_0x51ee19['List']){_0x3e01d5=_0x51ee19;var _0x2c4cc9=_['defaults'](_0x402c44[_0xcf23('0x6a')],{'firstName':_0x402c44['body'][_0xcf23('0xb5')],'phone':_0x402c44[_0xcf23('0x6a')]['from'],'ListId':_0x51ee19[_0xcf23('0xa0')]});_0x2c4cc9[_0x402c44[_0xcf23('0x6a')][_0xcf23('0xd1')]]=_0x402c44[_0xcf23('0x6a')][_0xcf23('0xb5')];return db[_0xcf23('0x98')][_0xcf23('0xd4')]({'where':_0x13b233,'defaults':_0x2c4cc9});}})[_0xcf23('0xb1')](function(_0xad2536){if(_0xad2536){_0x227a0d=_0xad2536;var _0xf71cfb=fs[_0xcf23('0xd5')](path[_0xcf23('0x86')](config['root'],_0xcf23('0xd6')),'utf8');var _0x481f4f=ejs[_0xcf23('0xd7')](_0xf71cfb,{'body':_[_0xcf23('0xd8')](_0x402c44['body'][_0xcf23('0x6a')]),'bodyTitle':_0x3e01d5[_0xcf23('0xd9')]});return db[_0xcf23('0xda')][_0xcf23('0x69')]({'body':_0x481f4f,'plainBody':htmlToText[_0xcf23('0xdb')](_0x481f4f),'ContactId':_0xad2536['id'],'ChatWebsiteId':_0x3e01d5['id']});}})[_0xcf23('0x13')](function(_0x4f92e3){_0x4cb9ef=_0x4f92e3;if(_0x54830e[_0xcf23('0x5b')]){var _0x5895a4=_0x54830e['map'](function(_0x33ee07){return{'name':_0x33ee07['originalname'],'basename':_0x33ee07['filename'],'type':_0x33ee07[_0xcf23('0xdc')],'ChatOfflineMessageId':_0x4f92e3['id']};});_0x27314e=_0x5895a4[_0xcf23('0x54')](_0x47b33d=>{var _0x29e307={'filename':_0x47b33d['name'],'path':path['join'](config[_0xcf23('0x87')],'server',_0xcf23('0xd0'),_0xcf23('0xdd'),_0xcf23('0xde'),_0x47b33d['basename'])};return _0x29e307;});if(!_0x3e01d5[_0xcf23('0xdf')]){return db['sequelize'][_0xcf23('0xe0')](function(_0x99c971){return db['Attachment'][_0xcf23('0xe1')](_0x5895a4,{'transaction':_0x99c971});});}}})[_0xcf23('0x13')](function(){if(_0x4cb9ef){_0x22ae8d=_0x4cb9ef;return db[_0xcf23('0xd3')][_0xcf23('0x74')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xcf23('0xe2'),'raw':!![],'include':[{'model':db[_0xcf23('0xe3')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xcf23('0x13')](function(_0x44bb74){if(_0x44bb74&&_0x44bb74[_0xcf23('0xe2')]&&_0x3e01d5[_0xcf23('0xe4')]&&_0x3e01d5['forwardOfflineAddress']){var _0x1b2512=_0x44bb74['getSmtpOptions']();return respondWithRpcPromise(_0xcf23('0xe5'),_0xcf23('0xe6'),{'account':_0x1b2512,'message':{'from':util[_0xcf23('0x31')](_0xcf23('0xe7'),_0x44bb74[_0xcf23('0x2d')],_0x44bb74[_0xcf23('0xe8')]||_0x44bb74['Smtp'][_0xcf23('0x6c')]),'to':_0x3e01d5['forwardOfflineAddress'],'subject':_0x3e01d5[_0xcf23('0xe9')],'html':_0x22ae8d['body'],'attachments':_0x27314e}},client9003)[_0xcf23('0x13')](function(){return _0x22ae8d;})[_0xcf23('0x1e')](function(_0x927bf8){logger[_0xcf23('0x18')](_0x927bf8);});}})[_0xcf23('0x13')](function(){if(_0x3e01d5&&_0x3e01d5[_0xcf23('0xdf')]&&_0x3e01d5['MailAccountId']){var _0x3123fc=[];if(_0x54830e[_0xcf23('0x5b')]){_0x3123fc=_0x54830e['map'](function(_0xeedd1){return{'name':_0xeedd1[_0xcf23('0xea')],'basename':_0xeedd1[_0xcf23('0x7f')],'type':_0xeedd1[_0xcf23('0xdc')],'ChatOfflineMessageId':_0x4cb9ef['id']};});}var _0x4ac286;if(!_['isNil'](_0x3e01d5['subjectOffline'])){var _0x4433ab=_[_0xcf23('0x54')](_0x402c44['body'],function(_0x2bbe96){return _0x2bbe96;});var _0x34e430=_[_0xcf23('0xeb')](_0x4433ab)[0x0];var _0x4a8dd9=_['mapValues'](_0x34e430,function(_0x3c83a9){return _0x3c83a9;});_0x4ac286=_0x4a8dd9[0x1][_0x3e01d5[_0xcf23('0xec')]];}var _0x96e17c={'from':_0x227a0d[_0xcf23('0xe8')],'firstName':_0x227a0d[_0xcf23('0x43')],'lastName':_0x227a0d[_0xcf23('0x44')],'mapKey':_0xcf23('0xe8'),'message':{'from':_0x227a0d['email'],'to':_0x3e01d5[_0xcf23('0xd3')][_0xcf23('0xe8')],'cc':'','subject':_[_0xcf23('0x8b')](_0x4ac286)?_0x3e01d5[_0xcf23('0xe9')]:_0x4ac286,'messageId':'','sentAt':new Date(),'attach':_0x3123fc[_0xcf23('0x5b')],'attachments':_0x3123fc,'originChannel':_0xcf23('0xed'),'ChatWebsiteId':_0x3e01d5['id'],'ChatOfflineMessageId':_0x22ae8d['id'],'originTo':_0x3e01d5[_0xcf23('0xd3')][_0xcf23('0xe8')]},'body':_0x22ae8d['body']};var _0x54b706={'account':{'id':_0x3e01d5[_0xcf23('0xee')]},'body':_0x96e17c,'log':_0xcf23('0xef')};return respondWithRpcPromise('NotifyMailAccount',_0xcf23('0xf0'),_0x54b706,client9001)[_0xcf23('0x13')](function(){return _0x22ae8d;})['catch'](function(_0x47dfbb){logger[_0xcf23('0x18')](_0x47dfbb);});}return;})['then'](function(){if(_0x22ae8d){return _0x22ae8d;}})[_0xcf23('0x13')](respondWithResult(_0x1f7bb7,null))[_0xcf23('0x1e')](function(){for(var _0x4240ae of _0x54830e){var _0x536d3d=path[_0xcf23('0x86')](config[_0xcf23('0x87')],'server',_0xcf23('0xd0'),_0xcf23('0xdd'),_0xcf23('0xde'),_0x4240ae['filename']);fs_extra[_0xcf23('0xf1')](_0x536d3d)[_0xcf23('0x1e')](function(_0x547ed0){logger[_0xcf23('0x18')](_0xcf23('0xf2'),_0x536d3d,_0x547ed0);});}});};exports[_0xcf23('0xf3')]=function(_0x12e2fe,_0x372d5b){return db[_0xcf23('0xb9')][_0xcf23('0x6e')]({'where':{'id':_0x12e2fe[_0xcf23('0x66')]['id']}})['then'](handleEntityNotFound(_0x372d5b,null))[_0xcf23('0x13')](function(_0x2bb282){if(_0x2bb282){return _0x2bb282[_0xcf23('0xf3')](_0x12e2fe[_0xcf23('0x6a')][_0xcf23('0x77')],_[_0xcf23('0xf4')](_0x12e2fe[_0xcf23('0x6a')],[_0xcf23('0x77'),'id'])||{});}})[_0xcf23('0x13')](respondWithResult(_0x372d5b,null))[_0xcf23('0x1e')](handleError(_0x372d5b,null));};exports[_0xcf23('0xf5')]=function(_0x400e9b,_0x57e8d8){var _0x2a26ec={'raw':![],'where':{}};var _0x3df89f={};var _0x2cbb42={'count':0x0,'rows':[]};return db[_0xcf23('0x52')][_0xcf23('0x74')]({'where':{'id':_0x400e9b['params']['id']}})['then'](handleEntityNotFound(_0x57e8d8,null))[_0xcf23('0x13')](function(_0x414f01){if(_0x414f01){_0x3df89f['model']=_['keys'](db[_0xcf23('0xb9')][_0xcf23('0x68')]);_0x3df89f['query']=_['keys'](_0x400e9b[_0xcf23('0x56')]);_0x3df89f[_0xcf23('0x57')]=_[_0xcf23('0x59')](_0x3df89f[_0xcf23('0x4c')],_0x3df89f[_0xcf23('0x56')]);_0x2a26ec[_0xcf23('0x58')]=_[_0xcf23('0x59')](_0x3df89f[_0xcf23('0x4c')],qs['fields'](_0x400e9b[_0xcf23('0x56')][_0xcf23('0x5a')]));_0x2a26ec[_0xcf23('0x58')]=_0x2a26ec[_0xcf23('0x58')]['length']?_0x2a26ec[_0xcf23('0x58')]:_0x3df89f['model'];if(!_0x400e9b[_0xcf23('0x56')][_0xcf23('0x5c')](_0xcf23('0xf6'))){_0x2a26ec['limit']=qs[_0xcf23('0x22')](_0x400e9b[_0xcf23('0x56')][_0xcf23('0x22')]);_0x2a26ec['offset']=qs[_0xcf23('0x20')](_0x400e9b[_0xcf23('0x56')][_0xcf23('0x20')]);}_0x2a26ec['order']=qs[_0xcf23('0x5d')](_0x400e9b[_0xcf23('0x56')][_0xcf23('0x5d')]);_0x2a26ec[_0xcf23('0x5e')]=qs['filters'](_['pick'](_0x400e9b[_0xcf23('0x56')],_0x3df89f['filters']));_0x2a26ec[_0xcf23('0x5e')][_0xcf23('0x71')]=_0x414f01['id'];if(_0x400e9b['query'][_0xcf23('0x60')]){_0x2a26ec[_0xcf23('0x5e')]=_[_0xcf23('0x61')](_0x2a26ec['where'],{'$or':_['map'](_0x2a26ec[_0xcf23('0x58')],function(_0xc66ab8){var _0x3586c0={};_0x3586c0[_0xc66ab8]={'$like':'%'+_0x400e9b[_0xcf23('0x56')][_0xcf23('0x60')]+'%'};return _0x3586c0;})});}_0x2a26ec=_[_0xcf23('0x61')]({},_0x2a26ec,_0x400e9b[_0xcf23('0x62')]);return db[_0xcf23('0xb9')]['count']({'where':_0x2a26ec[_0xcf23('0x5e')]})[_0xcf23('0x13')](function(_0x4f210c){_0x2cbb42['count']=_0x4f210c;if(_0x400e9b[_0xcf23('0x56')][_0xcf23('0x63')]){_0x2a26ec[_0xcf23('0x64')]=[{'model':db[_0xcf23('0x98')],'as':_0xcf23('0xf7'),'required':![]},{'model':db[_0xcf23('0xc5')],'as':_0xcf23('0xf8'),'attributes':[_0xcf23('0x2d'),_0xcf23('0xf9'),_0xcf23('0xfa')],'required':![]},{'model':db[_0xcf23('0xfb')],'as':_0xcf23('0xfc'),'attributes':['id',_0xcf23('0x2d'),_0xcf23('0xfd')],'where':_0x400e9b['query'][_0xcf23('0xfe')]?{'id':_0x400e9b[_0xcf23('0x56')][_0xcf23('0xfe')]}:undefined,'required':_0x400e9b[_0xcf23('0x56')][_0xcf23('0xfe')]?!![]:![]}];}return db[_0xcf23('0xb9')][_0xcf23('0xff')](_0x2a26ec);})['then'](function(_0x440d11){_0x2cbb42['rows']=_0x440d11;return _0x2cbb42;});}})['then'](respondWithFilteredResult(_0x57e8d8,_0x2a26ec))['catch'](handleError(_0x57e8d8,null));};exports[_0xcf23('0x30')]=function(_0x5041c2,_0x124aae){var _0x1da0ac=0x0;var _0x4869b4=0x0;var _0x571702=![];var _0x5c90b5;var _0x338828;return db[_0xcf23('0x52')]['find']({'where':{'id':_0x5041c2[_0xcf23('0x66')]['id']},'include':[{'model':db[_0xcf23('0xae')],'as':_0xcf23('0xae'),'include':[{'model':db[_0xcf23('0xae')],'as':'Intervals','attributes':['id',_0xcf23('0x33')]}]}]})[_0xcf23('0x13')](handleEntityNotFound(_0x124aae,null))[_0xcf23('0x13')](function(_0x4eeff1){if(_0x4eeff1){_0x5c90b5=_0x4eeff1;return _0x4eeff1['getProactiveActions']({'raw':!![]});}})['then'](function(_0x3c4650){if(_0x5c90b5){if(_0x3c4650){_0x338828=_0x3c4650;}}return require(_0xcf23('0x89'))['getLicense']();})[_0xcf23('0x13')](function(_0x3550c3){if(_0x3550c3){_0x4869b4=_0x3550c3[_0xcf23('0x100')];_0x571702=_0x3550c3[_0xcf23('0x101')];}})[_0xcf23('0x13')](function(){return db[_0xcf23('0xb9')][_0xcf23('0x23')]({'where':{'closed':![]}});})[_0xcf23('0x13')](function(_0x3540cb){_0x1da0ac=_0x3540cb;if(_0x4869b4&&_0x3540cb>_0x4869b4){return db[_0xcf23('0x102')][_0xcf23('0x74')]({'where':{'id':0x1}})[_0xcf23('0x13')](function(_0x5e4db4){if(_0x5e4db4){_0x5e4db4[_0xcf23('0x103')]('chatLicenseExceeded');}});}})[_0xcf23('0x13')](function(){if(!_0x5c90b5[_0xcf23('0xae')]||!_0x5c90b5[_0xcf23('0xae')][_0xcf23('0xaf')])return!![];return checkWebsiteIntervals(_0x5c90b5);})['then'](function(_0x4cd9df){var _0xb5c5fb=fs[_0xcf23('0xd5')](path[_0xcf23('0x86')](config[_0xcf23('0x87')],_0xcf23('0x104')),_0xcf23('0x105'));var _0x597631=new url[(_0xcf23('0x106'))](_0x5c90b5[_0xcf23('0x107')])[_0xcf23('0x108')];var _0x8d2516=_0xcf23('0x109');var _0x1db326=![];var _0x3c019f={'chatVersion':_0x8d2516,'chatWebsiteAddressOrigin':_0x597631,'remote':_0x5c90b5[_0xcf23('0x10a')],'query':querystring[_0xcf23('0x17')](_[_0xcf23('0x61')](_0x5c90b5[_0xcf23('0x3c')]({'plain':!![]}),{'customerIp':_0x5041c2[_0xcf23('0xb7')][_0xcf23('0x42')]||_0x5041c2[_0xcf23('0xb7')]['x-real-ip']||_0x5041c2[_0xcf23('0x10b')][_0xcf23('0x10c')]||_0x5041c2['ip'],'referer':_0x5041c2['headers'][_0xcf23('0x46')],'openedInteractions':_0x1da0ac,'maxInteractions':_0x4869b4,'virtual':_0x571702[_0xcf23('0x100')],'online':_0x4cd9df,'custom':_0x571702}))[_0xcf23('0x10d')](/'/g,'\x5c\x27')};_0x124aae[_0xcf23('0x2e')](ejs[_0xcf23('0xd7')](Mustache[_0xcf23('0xd7')](_0xb5c5fb,_0x3c019f),{'proactiveActions':_0x338828,'alignment':_0x5c90b5[_0xcf23('0x10e')],'verticalAlignment':_0x5c90b5[_0xcf23('0x10f')],'div_color':_0x5c90b5[_0xcf23('0xfd')],'labelText':_0x5c90b5['labelText'],'text_color':_0x5c90b5[_0xcf23('0x110')],'text_button_color':_0x5c90b5[_0xcf23('0x111')],'button_color':_0x5c90b5[_0xcf23('0x112')],'background_color':_0x5c90b5[_0xcf23('0x113')],'hideWhenOffline':_0x5c90b5[_0xcf23('0x114')],'intervalId':_0x5c90b5[_0xcf23('0x115')],'isDevelopment':_0x1db326,'chatVersion':_0x8d2516}));})[_0xcf23('0x1e')](handleError(_0x124aae,null));};exports[_0xcf23('0x116')]=function(_0x1f33b3,_0x4ffa53){var _0xa14219=_0x1f33b3[_0xcf23('0x66')]['id'];var _0x2cd8cc=_0x1f33b3[_0xcf23('0x6a')];var _0x32342a=0xc8;var _0x585be1=null;return db[_0xcf23('0x117')]['transaction']({'isolationLevel':db[_0xcf23('0x117')][_0xcf23('0x118')][_0xcf23('0x119')]['READ_COMMITTED']},function(_0x186122){return db[_0xcf23('0x52')]['findOne']({'where':{'id':_0xa14219},'transaction':_0x186122})[_0xcf23('0x13')](function(_0x4ca1af){if(_0x4ca1af){return db[_0xcf23('0xac')]['destroy']({'where':{'ChatWebsiteId':_0xa14219},'transaction':_0x186122})[_0xcf23('0x13')](function(){var _0x855ad0=_[_0xcf23('0x54')](_0x2cd8cc,function(_0x111510){_0x111510[_0xcf23('0x71')]=_0xa14219;return _0x111510;});return db[_0xcf23('0xac')]['bulkCreate'](_0x855ad0,{'transaction':_0x186122});});}else{_0x32342a=0x194;_0x585be1=[];}});})[_0xcf23('0x13')](function(){if(_0x32342a!==0x194){return db['ChatApplication'][_0xcf23('0x11a')]({'where':{'ChatWebsiteId':_0xa14219},'order':_0xcf23('0x11b')})[_0xcf23('0x13')](function(_0x5c5a45){_0x585be1=_0x5c5a45;});}})[_0xcf23('0x1e')](function(_0x18687a){_0x32342a=0x1f4;logger[_0xcf23('0x18')](_0x18687a[_0xcf23('0x11c')]);if(_0x18687a[_0xcf23('0x2d')]){delete _0x18687a[_0xcf23('0x2d')];}_0x585be1=_0x18687a;})['finally'](function(){if(_0x585be1===null){_0x4ffa53[_0xcf23('0x2c')](_0x32342a);}else{if(_0x32342a===0x1f4){_0x4ffa53[_0xcf23('0x1f')](_0x32342a)['send'](_0x585be1);}else{_0x4ffa53[_0xcf23('0x1f')](_0x32342a)[_0xcf23('0x26')](_0x585be1);}}});};exports[_0xcf23('0x11d')]=function(_0x3dca5f,_0x15a6d0){var _0x46d26e={};var _0xa53f98={};var _0x3f028e;var _0x42b084;return db[_0xcf23('0x52')][_0xcf23('0x74')]({'where':{'id':_0x3dca5f['params']['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x15a6d0,null))[_0xcf23('0x13')](function(_0x255a3e){if(_0x255a3e){_0x3f028e=_0x255a3e;_0xa53f98[_0xcf23('0x4c')]=_[_0xcf23('0x55')](db[_0xcf23('0xac')]['rawAttributes']);_0xa53f98[_0xcf23('0x56')]=_[_0xcf23('0x55')](_0x3dca5f['query']);_0xa53f98[_0xcf23('0x57')]=_[_0xcf23('0x59')](_0xa53f98[_0xcf23('0x4c')],_0xa53f98[_0xcf23('0x56')]);_0x46d26e['attributes']=_[_0xcf23('0x59')](_0xa53f98[_0xcf23('0x4c')],qs[_0xcf23('0x5a')](_0x3dca5f[_0xcf23('0x56')]['fields']));_0x46d26e['attributes']=_0x46d26e['attributes'][_0xcf23('0x5b')]?_0x46d26e[_0xcf23('0x58')]:_0xa53f98[_0xcf23('0x4c')];_0x46d26e[_0xcf23('0x75')]=qs[_0xcf23('0x5d')](_0x3dca5f['query'][_0xcf23('0x5d')]);_0x46d26e[_0xcf23('0x5e')]=qs['filters'](_[_0xcf23('0x5f')](_0x3dca5f['query'],_0xa53f98['filters']));if(_0x3dca5f[_0xcf23('0x56')]['filter']){_0x46d26e['where']=_['merge'](_0x46d26e[_0xcf23('0x5e')],{'$or':_[_0xcf23('0x54')](_0x46d26e[_0xcf23('0x58')],function(_0x497451){var _0x3440a1={};_0x3440a1[_0x497451]={'$like':'%'+_0x3dca5f['query'][_0xcf23('0x60')]+'%'};return _0x3440a1;})});}_0x46d26e=_[_0xcf23('0x61')]({},_0x46d26e,_0x3dca5f[_0xcf23('0x62')]);return _0x3f028e[_0xcf23('0x11d')](_0x46d26e);}})['then'](function(_0x2f7bae){if(_0x2f7bae){_0x42b084=_0x2f7bae[_0xcf23('0x5b')];if(!_0x3dca5f['query'][_0xcf23('0x5c')]('nolimit')){_0x46d26e[_0xcf23('0x22')]=qs['limit'](_0x3dca5f[_0xcf23('0x56')]['limit']);_0x46d26e['offset']=qs[_0xcf23('0x20')](_0x3dca5f['query'][_0xcf23('0x20')]);}return _0x3f028e[_0xcf23('0x11d')](_0x46d26e);}})[_0xcf23('0x13')](function(_0x37ec32){if(_0x37ec32){return _0x37ec32?{'count':_0x42b084,'rows':_0x37ec32}:null;}})[_0xcf23('0x13')](respondWithResult(_0x15a6d0,null))[_0xcf23('0x1e')](handleError(_0x15a6d0,null));};exports[_0xcf23('0x11e')]=function(_0x392481,_0x38621f){return db[_0xcf23('0x11f')]['find']({'where':{'id':_0x392481[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x38621f,null))[_0xcf23('0x13')](function(_0x2b1c71){if(_0x2b1c71){return _0x2b1c71[_0xcf23('0x11e')](_0x392481[_0xcf23('0x6a')][_0xcf23('0x77')],_[_0xcf23('0xf4')](_0x392481[_0xcf23('0x6a')],[_0xcf23('0x77'),'id'])||{});}})[_0xcf23('0x13')](respondWithResult(_0x38621f,null))['catch'](handleError(_0x38621f,null));};exports[_0xcf23('0x120')]=function(_0x490d32,_0x3b7089){var _0x1e6e77={};var _0x891da0={};var _0x1cf46e;var _0x301f7d;return db[_0xcf23('0x52')][_0xcf23('0x74')]({'where':{'id':_0x490d32[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x3b7089,null))['then'](function(_0x24095e){if(_0x24095e){_0x1cf46e=_0x24095e;_0x891da0[_0xcf23('0x4c')]=_[_0xcf23('0x55')](db[_0xcf23('0x121')][_0xcf23('0x68')]);_0x891da0['query']=_[_0xcf23('0x55')](_0x490d32[_0xcf23('0x56')]);_0x891da0[_0xcf23('0x57')]=_['intersection'](_0x891da0[_0xcf23('0x4c')],_0x891da0[_0xcf23('0x56')]);_0x1e6e77[_0xcf23('0x58')]=_[_0xcf23('0x59')](_0x891da0[_0xcf23('0x4c')],qs['fields'](_0x490d32['query'][_0xcf23('0x5a')]));_0x1e6e77[_0xcf23('0x58')]=_0x1e6e77['attributes'][_0xcf23('0x5b')]?_0x1e6e77[_0xcf23('0x58')]:_0x891da0[_0xcf23('0x4c')];_0x1e6e77[_0xcf23('0x75')]=qs[_0xcf23('0x5d')](_0x490d32[_0xcf23('0x56')]['sort']);_0x1e6e77[_0xcf23('0x5e')]=qs[_0xcf23('0x57')](_['pick'](_0x490d32[_0xcf23('0x56')],_0x891da0[_0xcf23('0x57')]));if(_0x490d32[_0xcf23('0x56')][_0xcf23('0x60')]){_0x1e6e77[_0xcf23('0x5e')]=_[_0xcf23('0x61')](_0x1e6e77['where'],{'$or':_[_0xcf23('0x54')](_0x1e6e77[_0xcf23('0x58')],function(_0xbeed4){var _0x2b0cea={};_0x2b0cea[_0xbeed4]={'$like':'%'+_0x490d32[_0xcf23('0x56')]['filter']+'%'};return _0x2b0cea;})});}_0x1e6e77=_[_0xcf23('0x61')]({},_0x1e6e77,_0x490d32[_0xcf23('0x62')]);return _0x1cf46e[_0xcf23('0x120')](_0x1e6e77);}})[_0xcf23('0x13')](function(_0x24dbde){if(_0x24dbde){_0x301f7d=_0x24dbde[_0xcf23('0x5b')];if(!_0x490d32[_0xcf23('0x56')][_0xcf23('0x5c')]('nolimit')){_0x1e6e77[_0xcf23('0x22')]=qs[_0xcf23('0x22')](_0x490d32[_0xcf23('0x56')]['limit']);_0x1e6e77['offset']=qs[_0xcf23('0x20')](_0x490d32['query'][_0xcf23('0x20')]);}return _0x1cf46e[_0xcf23('0x120')](_0x1e6e77);}})['then'](function(_0x4e9492){if(_0x4e9492){return _0x4e9492?{'count':_0x301f7d,'rows':_0x4e9492}:null;}})['then'](respondWithResult(_0x3b7089,null))[_0xcf23('0x1e')](handleError(_0x3b7089,null));};exports[_0xcf23('0x122')]=function(_0x2e3c79,_0x53ea08){var _0x551d68=_0x2e3c79[_0xcf23('0x56')][_0xcf23('0x123')]===_0xcf23('0x124')?_0xcf23('0x125'):_0xcf23('0x126');return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'attributes':['id',_0x551d68],'where':{'id':_0x2e3c79[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x53ea08,null))[_0xcf23('0x13')](function(_0x4e5e1d){if(_0x4e5e1d){var _0x124848=_0x4e5e1d[_0x551d68];var _0x3fc799=_0x124848&&_0x124848[_0xcf23('0x127')]?_0x124848[_0xcf23('0x127')]:[];_0x53ea08[_0xcf23('0x2e')]({'fromKey':_[_0xcf23('0x8b')](_0x124848[_0xcf23('0x128')])?undefined:_0x124848[_0xcf23('0x128')],'count':_0x3fc799[_0xcf23('0x5b')],'rows':_0x3fc799});}})[_0xcf23('0x1e')](handleError(_0x53ea08,null));};exports[_0xcf23('0x129')]=function(_0x3a5988,_0x29f613){var _0x2e3b11={'raw':![],'where':{}};var _0x571a47={};var _0x4ab642={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xcf23('0x74')]({'where':{'id':_0x3a5988[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x29f613,null))[_0xcf23('0x13')](function(_0xf3c587){if(_0xf3c587){_0x571a47[_0xcf23('0x4c')]=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x571a47[_0xcf23('0x56')]=_[_0xcf23('0x55')](_0x3a5988[_0xcf23('0x56')]);_0x571a47[_0xcf23('0x57')]=_[_0xcf23('0x59')](_0x571a47[_0xcf23('0x4c')],_0x571a47[_0xcf23('0x56')]);_0x2e3b11['attributes']=_[_0xcf23('0x59')](_0x571a47['model'],qs[_0xcf23('0x5a')](_0x3a5988['query'][_0xcf23('0x5a')]));_0x2e3b11[_0xcf23('0x58')]=_0x2e3b11[_0xcf23('0x58')][_0xcf23('0x5b')]?_0x2e3b11[_0xcf23('0x58')]:_0x571a47[_0xcf23('0x4c')];if(!_0x3a5988[_0xcf23('0x56')][_0xcf23('0x5c')]('nolimit')){_0x2e3b11[_0xcf23('0x22')]=qs[_0xcf23('0x22')](_0x3a5988[_0xcf23('0x56')]['limit']);_0x2e3b11['offset']=qs[_0xcf23('0x20')](_0x3a5988[_0xcf23('0x56')]['offset']);}_0x2e3b11[_0xcf23('0x75')]=qs[_0xcf23('0x5d')](_0x3a5988[_0xcf23('0x56')][_0xcf23('0x5d')]);_0x2e3b11['where']=qs[_0xcf23('0x57')](_[_0xcf23('0x5f')](_0x3a5988[_0xcf23('0x56')],_0x571a47[_0xcf23('0x57')]));_0x2e3b11['where'][_0xcf23('0x71')]=_0xf3c587['id'];if(_0x3a5988[_0xcf23('0x56')][_0xcf23('0x60')]){_0x2e3b11[_0xcf23('0x5e')]=_['merge'](_0x2e3b11[_0xcf23('0x5e')],{'$or':_[_0xcf23('0x54')](_0x2e3b11[_0xcf23('0x58')],function(_0x17dd33){var _0x299ee7={};_0x299ee7[_0x17dd33]={'$like':'%'+_0x3a5988[_0xcf23('0x56')][_0xcf23('0x60')]+'%'};return _0x299ee7;})});}_0x2e3b11=_[_0xcf23('0x61')]({},_0x2e3b11,_0x3a5988[_0xcf23('0x62')]);return db[_0xcf23('0xda')][_0xcf23('0x23')]({'where':_0x2e3b11[_0xcf23('0x5e')]})[_0xcf23('0x13')](function(_0x5ba2f3){_0x4ab642[_0xcf23('0x23')]=_0x5ba2f3;if(_0x3a5988[_0xcf23('0x56')]['includeAll']){_0x2e3b11[_0xcf23('0x64')]=[{'all':!![]}];}else{_0x2e3b11[_0xcf23('0x64')]=[{'model':db[_0xcf23('0x98')],'as':_0xcf23('0xf7'),'required':![]},{'model':db[_0xcf23('0x12a')],'as':_0xcf23('0x12b'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x2e3b11);})[_0xcf23('0x13')](function(_0x22ef27){_0x4ab642[_0xcf23('0x65')]=_0x22ef27;return _0x4ab642;});}})[_0xcf23('0x13')](respondWithFilteredResult(_0x29f613,_0x2e3b11))[_0xcf23('0x1e')](handleError(_0x29f613,null));};exports[_0xcf23('0x12c')]=function(_0x1d9a15,_0xc0a573){return db[_0xcf23('0x52')]['find']({'where':{'id':_0x1d9a15[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0xc0a573,null))['then'](function(_0x481370){if(_0x481370){return _0x481370[_0xcf23('0x12c')](_0x1d9a15['body'][_0xcf23('0x77')],_[_0xcf23('0xf4')](_0x1d9a15[_0xcf23('0x6a')],[_0xcf23('0x77'),'id'])||{})[_0xcf23('0xb1')](function(_0x2ff090){for(var _0x1238b6=0x0;_0x1238b6<_0x1d9a15['body']['ids'][_0xcf23('0x5b')];_0x1238b6+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x1d9a15[_0xcf23('0x6a')][_0xcf23('0x77')][_0x1238b6]),'ChatWebsiteId':Number(_0x1d9a15[_0xcf23('0x66')]['id'])});}return _0x2ff090;});}})[_0xcf23('0x13')](respondWithResult(_0xc0a573,null))[_0xcf23('0x1e')](handleError(_0xc0a573,null));};exports['removeAgents']=function(_0x59a725,_0x4b8a4a){return db[_0xcf23('0x52')][_0xcf23('0x6e')]({'where':{'id':_0x59a725[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x4b8a4a,null))[_0xcf23('0x13')](function(_0x838eb2){if(_0x838eb2){return _0x838eb2[_0xcf23('0x12d')](_0x59a725[_0xcf23('0x56')]['ids'])[_0xcf23('0x13')](function(){if(_[_0xcf23('0x12e')](_0x59a725[_0xcf23('0x56')]['ids'])){for(var _0x2c4e67=0x0;_0x2c4e67<_0x59a725[_0xcf23('0x56')]['ids']['length'];_0x2c4e67+=0x1){socket[_0xcf23('0x12f')](_0xcf23('0x130'),{'UserId':Number(_0x59a725[_0xcf23('0x56')][_0xcf23('0x77')][_0x2c4e67]),'ChatWebsiteId':Number(_0x59a725[_0xcf23('0x66')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x59a725['query']['ids']),'ChatWebsiteId':Number(_0x59a725[_0xcf23('0x66')]['id'])});}});}})[_0xcf23('0x13')](respondWithStatusCode(_0x4b8a4a,null))[_0xcf23('0x1e')](handleError(_0x4b8a4a,null));};exports[_0xcf23('0x131')]=function(_0x533d43,_0x4e0084){var _0x1f541f={};var _0x1736ea={};var _0x481ee5;var _0xc8a820;return db['ChatWebsite'][_0xcf23('0x74')]({'where':{'id':_0x533d43[_0xcf23('0x66')]['id']}})[_0xcf23('0x13')](handleEntityNotFound(_0x4e0084,null))[_0xcf23('0x13')](function(_0x242401){if(_0x242401){_0x481ee5=_0x242401;_0x1736ea[_0xcf23('0x4c')]=_[_0xcf23('0x55')](db['User'][_0xcf23('0x68')]);_0x1736ea[_0xcf23('0x56')]=_[_0xcf23('0x55')](_0x533d43['query']);_0x1736ea[_0xcf23('0x57')]=_[_0xcf23('0x59')](_0x1736ea[_0xcf23('0x4c')],_0x1736ea[_0xcf23('0x56')]);_0x1f541f[_0xcf23('0x58')]=_[_0xcf23('0x59')](_0x1736ea['model'],qs['fields'](_0x533d43['query'][_0xcf23('0x5a')]));_0x1f541f[_0xcf23('0x58')]=_0x1f541f[_0xcf23('0x58')][_0xcf23('0x5b')]?_0x1f541f[_0xcf23('0x58')]:_0x1736ea[_0xcf23('0x4c')];_0x1f541f[_0xcf23('0x75')]=qs[_0xcf23('0x5d')](_0x533d43[_0xcf23('0x56')][_0xcf23('0x5d')]);_0x1f541f[_0xcf23('0x5e')]=qs[_0xcf23('0x57')](_[_0xcf23('0x5f')](_0x533d43[_0xcf23('0x56')],_0x1736ea[_0xcf23('0x57')]));if(_0x533d43[_0xcf23('0x56')][_0xcf23('0x60')]){_0x1f541f[_0xcf23('0x5e')]=_['merge'](_0x1f541f[_0xcf23('0x5e')],{'$or':_[_0xcf23('0x54')](_0x1f541f[_0xcf23('0x58')],function(_0x22bc85){var _0xd8f38b={};_0xd8f38b[_0x22bc85]={'$like':'%'+_0x533d43[_0xcf23('0x56')][_0xcf23('0x60')]+'%'};return _0xd8f38b;})});}_0x1f541f=_[_0xcf23('0x61')]({},_0x1f541f,_0x533d43[_0xcf23('0x62')]);return _0x481ee5[_0xcf23('0x131')](_0x1f541f);}})[_0xcf23('0x13')](function(_0x16b16f){if(_0x16b16f){_0xc8a820=_0x16b16f[_0xcf23('0x5b')];if(!_0x533d43[_0xcf23('0x56')][_0xcf23('0x5c')](_0xcf23('0xf6'))){_0x1f541f['limit']=qs['limit'](_0x533d43['query']['limit']);_0x1f541f['offset']=qs[_0xcf23('0x20')](_0x533d43[_0xcf23('0x56')]['offset']);}return _0x481ee5[_0xcf23('0x131')](_0x1f541f);}})['then'](function(_0x4fdaaf){if(_0x4fdaaf){return _0x4fdaaf?{'count':_0xc8a820,'rows':_0x4fdaaf}:null;}})[_0xcf23('0x13')](respondWithResult(_0x4e0084,null))['catch'](handleError(_0x4e0084,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index b6836e0..88b541f 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 _0x5292=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x44a3c7,_0x452e46){var _0x42df2a=function(_0x403ed7){while(--_0x403ed7){_0x44a3c7['push'](_0x44a3c7['shift']());}};_0x42df2a(++_0x452e46);}(_0x5292,0xf7));var _0x2529=function(_0x47e3f8,_0x517bcd){_0x47e3f8=_0x47e3f8-0x0;var _0x4742d5=_0x5292[_0x47e3f8];return _0x4742d5;};'use strict';var EventEmitter=require(_0x2529('0x0'));var ChatWebsite=require(_0x2529('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2529('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2529('0x3'),'afterDestroy':_0x2529('0x4')};function emitEvent(_0x29576c){return function(_0x228165,_0x5d25dc,_0x28c08d){ChatWebsiteEvents['emit'](_0x29576c+':'+_0x228165['id'],_0x228165);ChatWebsiteEvents['emit'](_0x29576c,_0x228165);_0x28c08d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x2529('0x5')](e,emitEvent(event));}}module[_0x2529('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x5636=['hook','exports','events','../../mysqldb','update','remove','emit','hasOwnProperty'];(function(_0x3d6d80,_0x1689b7){var _0x30712a=function(_0x24c266){while(--_0x24c266){_0x3d6d80['push'](_0x3d6d80['shift']());}};_0x30712a(++_0x1689b7);}(_0x5636,0x102));var _0x6563=function(_0xc2588,_0x2ef0fc){_0xc2588=_0xc2588-0x0;var _0x126972=_0x5636[_0xc2588];return _0x126972;};'use strict';var EventEmitter=require(_0x6563('0x0'));var ChatWebsite=require(_0x6563('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6563('0x2'),'afterDestroy':_0x6563('0x3')};function emitEvent(_0x115cc1){return function(_0x4ac653,_0x166a58,_0x12f62f){ChatWebsiteEvents[_0x6563('0x4')](_0x115cc1+':'+_0x4ac653['id'],_0x4ac653);ChatWebsiteEvents[_0x6563('0x4')](_0x115cc1,_0x4ac653);_0x12f62f(null);};}for(var e in events){if(events[_0x6563('0x5')](e)){var event=events[e];ChatWebsite[_0x6563('0x6')](e,emitEvent(event));}}module[_0x6563('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index c368b76..964de83 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 _0x7245=['../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','api','moment','path','rimraf'];(function(_0x1b2b52,_0x622abe){var _0xef5b96=function(_0x5d3a17){while(--_0x5d3a17){_0x1b2b52['push'](_0x1b2b52['shift']());}};_0xef5b96(++_0x622abe);}(_0x7245,0x11d));var _0x5724=function(_0x29cae3,_0x23c465){_0x29cae3=_0x29cae3-0x0;var _0x5aa40a=_0x7245[_0x29cae3];return _0x5aa40a;};'use strict';var _=require(_0x5724('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5724('0x1'));var moment=require(_0x5724('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5724('0x3'));var rimraf=require(_0x5724('0x4'));var config=require(_0x5724('0x5'));var attributes=require(_0x5724('0x6'));module['exports']=function(_0x4e00f2,_0x13d004){return _0x4e00f2[_0x5724('0x7')](_0x5724('0x8'),attributes,{'tableName':_0x5724('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b26=['./chatWebsite.attributes','exports','define','chat_websites','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x2efd1d,_0x44f696){var _0x1ef3f6=function(_0x25da5f){while(--_0x25da5f){_0x2efd1d['push'](_0x2efd1d['shift']());}};_0x1ef3f6(++_0x44f696);}(_0x9b26,0x164));var _0x69b2=function(_0x27a729,_0x392de0){_0x27a729=_0x27a729-0x0;var _0x14f8c0=_0x9b26[_0x27a729];return _0x14f8c0;};'use strict';var _=require(_0x69b2('0x0'));var util=require('util');var logger=require(_0x69b2('0x1'))(_0x69b2('0x2'));var moment=require(_0x69b2('0x3'));var BPromise=require(_0x69b2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x69b2('0x5'));var config=require(_0x69b2('0x6'));var attributes=require(_0x69b2('0x7'));module[_0x69b2('0x8')]=function(_0x2bdfa9,_0x18c865){return _0x2bdfa9[_0x69b2('0x9')]('ChatWebsite',attributes,{'tableName':_0x69b2('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 dda247e..c3fbc83 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 _0x66b8=['request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./chatWebsite.socket'];(function(_0x6f689a,_0x10e193){var _0xf99756=function(_0xa79cf7){while(--_0xa79cf7){_0x6f689a['push'](_0x6f689a['shift']());}};_0xf99756(++_0x10e193);}(_0x66b8,0x70));var _0x866b=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x66b8[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require('lodash');var util=require(_0x866b('0x0'));var moment=require(_0x866b('0x1'));var BPromise=require(_0x866b('0x2'));var rs=require(_0x866b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x866b('0x4'));var logger=require(_0x866b('0x5'))(_0x866b('0x6'));var config=require(_0x866b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x866b('0x8')]['http']({'port':0x232a});config[_0x866b('0x9')]=_[_0x866b('0xa')](config[_0x866b('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x866b('0xb'))(new Redis(config[_0x866b('0x9')]));require(_0x866b('0xc'))['register'](socket);function respondWithRpcPromise(_0x51e748,_0x180a7e,_0x1cada7){return new BPromise(function(_0x2d4822,_0x7ba67b){return client[_0x866b('0xd')](_0x51e748,_0x1cada7)[_0x866b('0xe')](function(_0x56b825){logger['info'](_0x866b('0xf'),_0x180a7e,_0x866b('0x10'));logger[_0x866b('0x11')](_0x866b('0x12'),_0x180a7e,_0x866b('0x10'),JSON['stringify'](_0x56b825));if(_0x56b825[_0x866b('0x13')]){if(_0x56b825['error'][_0x866b('0x14')]===0x1f4){logger[_0x866b('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x180a7e,_0x56b825['error'][_0x866b('0x15')]);return _0x7ba67b(_0x56b825[_0x866b('0x13')][_0x866b('0x15')]);}logger['error'](_0x866b('0xf'),_0x180a7e,_0x56b825['error']['message']);return _0x2d4822(_0x56b825[_0x866b('0x13')][_0x866b('0x15')]);}else{logger[_0x866b('0x16')](_0x866b('0xf'),_0x180a7e,_0x866b('0x10'));_0x2d4822(_0x56b825[_0x866b('0x17')][_0x866b('0x15')]);}})[_0x866b('0x18')](function(_0x3b4386){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x180a7e,_0x3b4386);_0x7ba67b(_0x3b4386);});});} \ No newline at end of file +var _0x9ecf=['register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0x9ecf,0xba));var _0xf9ec=function(_0x531b1e,_0x301978){_0x531b1e=_0x531b1e-0x0;var _0x1208b6=_0x9ecf[_0x531b1e];return _0x1208b6;};'use strict';var _=require(_0xf9ec('0x0'));var util=require(_0xf9ec('0x1'));var moment=require(_0xf9ec('0x2'));var BPromise=require(_0xf9ec('0x3'));var rs=require(_0xf9ec('0x4'));var fs=require('fs');var Redis=require(_0xf9ec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf9ec('0x6'));var logger=require(_0xf9ec('0x7'))(_0xf9ec('0x8'));var config=require(_0xf9ec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf9ec('0xa')][_0xf9ec('0xb')]({'port':0x232a});config[_0xf9ec('0xc')]=_[_0xf9ec('0xd')](config['redis'],{'host':_0xf9ec('0xe'),'port':0x18eb});var socket=require(_0xf9ec('0xf'))(new Redis(config[_0xf9ec('0xc')]));require(_0xf9ec('0x10'))[_0xf9ec('0x11')](socket);function respondWithRpcPromise(_0xa530bd,_0x4d91c0,_0x2a9ff){return new BPromise(function(_0x51b57b,_0x492b09){return client[_0xf9ec('0x12')](_0xa530bd,_0x2a9ff)[_0xf9ec('0x13')](function(_0x2bb375){logger['info'](_0xf9ec('0x14'),_0x4d91c0,_0xf9ec('0x15'));logger[_0xf9ec('0x16')](_0xf9ec('0x17'),_0x4d91c0,'request\x20sent',JSON['stringify'](_0x2bb375));if(_0x2bb375[_0xf9ec('0x18')]){if(_0x2bb375[_0xf9ec('0x18')][_0xf9ec('0x19')]===0x1f4){logger['error'](_0xf9ec('0x14'),_0x4d91c0,_0x2bb375[_0xf9ec('0x18')][_0xf9ec('0x1a')]);return _0x492b09(_0x2bb375[_0xf9ec('0x18')][_0xf9ec('0x1a')]);}logger['error'](_0xf9ec('0x14'),_0x4d91c0,_0x2bb375['error']['message']);return _0x51b57b(_0x2bb375['error'][_0xf9ec('0x1a')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x4d91c0,'request\x20sent');_0x51b57b(_0x2bb375[_0xf9ec('0x1b')][_0xf9ec('0x1a')]);}})[_0xf9ec('0x1c')](function(_0x432274){logger[_0xf9ec('0x18')](_0xf9ec('0x14'),_0x4d91c0,_0x432274);_0x492b09(_0x432274);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 152a8a7..c87b315 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 _0xc14b=['length','./chatWebsite.events','remove','update','emit','removeListener','register'];(function(_0x3d9361,_0x272ecc){var _0x5841a3=function(_0x3b0eb2){while(--_0x3b0eb2){_0x3d9361['push'](_0x3d9361['shift']());}};_0x5841a3(++_0x272ecc);}(_0xc14b,0x7f));var _0xbc14=function(_0x508acd,_0x852c77){_0x508acd=_0x508acd-0x0;var _0x4e8524=_0xc14b[_0x508acd];return _0x4e8524;};'use strict';var ChatWebsiteEvents=require(_0xbc14('0x0'));var events=['save',_0xbc14('0x1'),_0xbc14('0x2')];function createListener(_0x6bf781,_0x5eee2a){return function(_0x21e9f0){_0x5eee2a[_0xbc14('0x3')](_0x6bf781,_0x21e9f0);};}function removeListener(_0x442034,_0x285b8c){return function(){ChatWebsiteEvents[_0xbc14('0x4')](_0x442034,_0x285b8c);};}exports[_0xbc14('0x5')]=function(_0x2ee46b){for(var _0x45a82c=0x0,_0x3a44c6=events[_0xbc14('0x6')];_0x45a82c<_0x3a44c6;_0x45a82c++){var _0x30aa81=events[_0x45a82c];var _0x1de996=createListener('chatWebsite:'+_0x30aa81,_0x2ee46b);ChatWebsiteEvents['on'](_0x30aa81,_0x1de996);}}; \ No newline at end of file +var _0x3e3d=['length','chatWebsite:','./chatWebsite.events','update','emit','removeListener'];(function(_0x4390e2,_0x123a88){var _0x198cfc=function(_0x4a29e5){while(--_0x4a29e5){_0x4390e2['push'](_0x4390e2['shift']());}};_0x198cfc(++_0x123a88);}(_0x3e3d,0x17c));var _0xd3e3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3e3d[_0x397e5f];return _0x5302b8;};'use strict';var ChatWebsiteEvents=require(_0xd3e3('0x0'));var events=['save','remove',_0xd3e3('0x1')];function createListener(_0xdf5d19,_0x5df2ac){return function(_0x25e845){_0x5df2ac[_0xd3e3('0x2')](_0xdf5d19,_0x25e845);};}function removeListener(_0x4e8124,_0x14355d){return function(){ChatWebsiteEvents[_0xd3e3('0x3')](_0x4e8124,_0x14355d);};}exports['register']=function(_0x35c649){for(var _0x5d9ab7=0x0,_0x3882b0=events[_0xd3e3('0x4')];_0x5d9ab7<_0x3882b0;_0x5d9ab7++){var _0x5b2da3=events[_0x5d9ab7];var _0x3e821c=createListener(_0xd3e3('0x5')+_0x5b2da3,_0x35c649);ChatWebsiteEvents['on'](_0x5b2da3,_0x3e821c);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 06dbcec..3af9107 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 _0x3b18=['index','/describe','describe','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','%s-%s','single','join','server/files/images/avatars/','format','now','originalname','file','addAvatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','server/files','attachments','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','/:id/applications','addProactiveActions','addAgents','/:id','update','destroy','delete','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x326ce4,_0x2ef10d){var _0x271ff5=function(_0x2a5c48){while(--_0x2a5c48){_0x326ce4['push'](_0x326ce4['shift']());}};_0x271ff5(++_0x2ef10d);}(_0x3b18,0x1a1));var _0x83b1=function(_0x1be6b8,_0x21d7cf){_0x1be6b8=_0x1be6b8-0x0;var _0xeaecfd=_0x3b18[_0x1be6b8];return _0xeaecfd;};'use strict';var multer=require(_0x83b1('0x0'));var util=require(_0x83b1('0x1'));var path=require(_0x83b1('0x2'));var timeout=require('connect-timeout');var express=require(_0x83b1('0x3'));var router=express[_0x83b1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x83b1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x83b1('0x6'));var controller=require('./chatWebsite.controller');router[_0x83b1('0x7')]('/',auth[_0x83b1('0x8')](),controller[_0x83b1('0x9')]);router[_0x83b1('0x7')](_0x83b1('0xa'),auth[_0x83b1('0x8')](),controller[_0x83b1('0xb')]);router['get']('/:id',auth[_0x83b1('0x8')](),controller['show']);router[_0x83b1('0x7')]('/:id/dispositions',auth[_0x83b1('0x8')](),controller['getDispositions']);router[_0x83b1('0x7')](_0x83b1('0xc'),auth[_0x83b1('0x8')](),controller[_0x83b1('0xd')]);router['get'](_0x83b1('0xe'),controller[_0x83b1('0xf')]);router[_0x83b1('0x7')](_0x83b1('0x10'),controller['getAvatar']);router[_0x83b1('0x7')](_0x83b1('0x11'),controller[_0x83b1('0x12')]);router[_0x83b1('0x7')]('/:id/system_avatar',controller[_0x83b1('0x13')]);router[_0x83b1('0x7')](_0x83b1('0x14'),auth[_0x83b1('0x8')](),controller[_0x83b1('0x15')]);router[_0x83b1('0x7')](_0x83b1('0x16'),controller[_0x83b1('0x17')]);router[_0x83b1('0x7')]('/:id/applications',auth['isAuthenticated'](),controller[_0x83b1('0x18')]);router[_0x83b1('0x7')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['getProactiveActions']);router['get'](_0x83b1('0x19'),controller[_0x83b1('0x1a')]);router[_0x83b1('0x7')](_0x83b1('0x1b'),auth[_0x83b1('0x8')](),controller[_0x83b1('0x1c')]);router[_0x83b1('0x7')](_0x83b1('0x1d'),auth[_0x83b1('0x8')](),controller[_0x83b1('0x1e')]);router[_0x83b1('0x1f')]('/',auth[_0x83b1('0x8')](),controller[_0x83b1('0x20')]);router['post']('/:id/dispositions',auth[_0x83b1('0x8')](),controller[_0x83b1('0x21')]);router[_0x83b1('0x1f')](_0x83b1('0xc'),auth['isAuthenticated'](),controller[_0x83b1('0x22')]);var upload=multer({'storage':multer[_0x83b1('0x23')]({'destination':function(_0x103530,_0x4e6114,_0x7505a1){_0x7505a1(null,path['join'](config[_0x83b1('0x24')],_0x83b1('0x25')));},'filename':function(_0x430b0f,_0x6f3cd8,_0xbdab40){_0xbdab40(null,util['format'](_0x83b1('0x26'),Date['now'](),_0x6f3cd8['originalname']));}})});router[_0x83b1('0x1f')]('/:id/logo',upload[_0x83b1('0x27')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x83b1('0x23')]({'destination':function(_0x1a3d93,_0x2d2fc4,_0x5eeb19){_0x5eeb19(null,path[_0x83b1('0x28')](config[_0x83b1('0x24')],_0x83b1('0x29')));},'filename':function(_0x3928bc,_0x44813b,_0x479613){_0x479613(null,util[_0x83b1('0x2a')]('%s-%s',Date[_0x83b1('0x2b')](),_0x44813b[_0x83b1('0x2c')]));}})});router[_0x83b1('0x1f')](_0x83b1('0x10'),upload[_0x83b1('0x27')](_0x83b1('0x2d')),controller[_0x83b1('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4e1e3d,_0xb42562,_0x96b34){_0x96b34(null,path[_0x83b1('0x28')](config[_0x83b1('0x24')],_0x83b1('0x29')));},'filename':function(_0x2e6678,_0x5685ad,_0x464660){_0x464660(null,util[_0x83b1('0x2a')](_0x83b1('0x26'),Date[_0x83b1('0x2b')](),_0x5685ad[_0x83b1('0x2c')]));}})});router['post']('/:id/customer_avatar',upload['single'](_0x83b1('0x2d')),controller[_0x83b1('0x2f')]);var upload=multer({'storage':multer[_0x83b1('0x23')]({'destination':function(_0x1fe0e4,_0x57aa0e,_0x2a0faa){_0x2a0faa(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x58ab3a,_0x5cee8a,_0x455b7f){_0x455b7f(null,util['format'](_0x83b1('0x26'),Date[_0x83b1('0x2b')](),_0x5cee8a[_0x83b1('0x2c')]));}})});router['post'](_0x83b1('0x30'),upload[_0x83b1('0x27')]('file'),controller[_0x83b1('0x31')]);router[_0x83b1('0x1f')](_0x83b1('0x32'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x83b1('0x23')]({'destination':function(_0x3bd045,_0x372859,_0x15e6bb){const _0x37c671=path['join'](config['root'],_0x83b1('0x33'),_0x83b1('0x34'),'offline-chat');fs_extra[_0x83b1('0x35')](_0x37c671,function(){_0x15e6bb(null,_0x37c671);});},'filename':function(_0x49593f,_0x51770a,_0x46d86b){const _0x5e1a94=_0x51770a[_0x83b1('0x2c')][_0x83b1('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x235260=path[_0x83b1('0x37')](_0x5e1a94);const _0x50036c=Date[_0x83b1('0x2b')]()+'-'+_0x5e1a94[_0x83b1('0x36')](_0x235260,'')+_0x235260;_0x46d86b(null,_0x50036c);}})});router['post'](_0x83b1('0x38'),offlineUploadMulter[_0x83b1('0x39')](),controller[_0x83b1('0x3a')]);router[_0x83b1('0x1f')](_0x83b1('0x14'),auth['isAuthenticated'](),controller[_0x83b1('0x3b')]);router[_0x83b1('0x1f')](_0x83b1('0x3c'),auth[_0x83b1('0x8')](),controller['addApplications']);router[_0x83b1('0x1f')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x83b1('0x3d')]);router['post'](_0x83b1('0x1d'),auth[_0x83b1('0x8')](),controller[_0x83b1('0x3e')]);router['put'](_0x83b1('0x3f'),auth[_0x83b1('0x8')](),controller[_0x83b1('0x40')]);router['delete'](_0x83b1('0x3f'),auth[_0x83b1('0x8')](),controller[_0x83b1('0x41')]);router[_0x83b1('0x42')](_0x83b1('0x43'),auth['isAuthenticated'](),controller[_0x83b1('0x44')]);router[_0x83b1('0x42')](_0x83b1('0xc'),auth[_0x83b1('0x8')](),controller[_0x83b1('0x45')]);router[_0x83b1('0x42')](_0x83b1('0x1d'),auth[_0x83b1('0x8')](),controller[_0x83b1('0x46')]);module['exports']=router; \ No newline at end of file +var _0xd508=['offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','single','file','addLogo','/:id/avatar','server/files/images/avatars/','originalname','addCustomerAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any'];(function(_0x2e1878,_0x2a07ab){var _0x5adf07=function(_0x48e37d){while(--_0x48e37d){_0x2e1878['push'](_0x2e1878['shift']());}};_0x5adf07(++_0x2a07ab);}(_0xd508,0x1c9));var _0x8d50=function(_0x25599a,_0x4024a5){_0x25599a=_0x25599a-0x0;var _0x5b8d3d=_0xd508[_0x25599a];return _0x5b8d3d;};'use strict';var multer=require(_0x8d50('0x0'));var util=require('util');var path=require(_0x8d50('0x1'));var timeout=require('connect-timeout');var express=require(_0x8d50('0x2'));var router=express[_0x8d50('0x3')]();var fs_extra=require(_0x8d50('0x4'));var auth=require(_0x8d50('0x5'));var interaction=require(_0x8d50('0x6'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8d50('0x7')]);router[_0x8d50('0x8')](_0x8d50('0x9'),auth[_0x8d50('0xa')](),controller[_0x8d50('0xb')]);router[_0x8d50('0x8')]('/:id',auth[_0x8d50('0xa')](),controller[_0x8d50('0xc')]);router[_0x8d50('0x8')]('/:id/dispositions',auth[_0x8d50('0xa')](),controller[_0x8d50('0xd')]);router[_0x8d50('0x8')](_0x8d50('0xe'),auth[_0x8d50('0xa')](),controller[_0x8d50('0xf')]);router[_0x8d50('0x8')](_0x8d50('0x10'),controller[_0x8d50('0x11')]);router[_0x8d50('0x8')]('/:id/avatar',controller[_0x8d50('0x12')]);router['get'](_0x8d50('0x13'),controller[_0x8d50('0x14')]);router[_0x8d50('0x8')](_0x8d50('0x15'),controller[_0x8d50('0x16')]);router[_0x8d50('0x8')](_0x8d50('0x17'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x8d50('0x8')](_0x8d50('0x18'),controller[_0x8d50('0x19')]);router[_0x8d50('0x8')](_0x8d50('0x1a'),auth[_0x8d50('0xa')](),controller['getApplications']);router['get']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x8d50('0x1b')]);router['get'](_0x8d50('0x1c'),controller[_0x8d50('0x1d')]);router[_0x8d50('0x8')](_0x8d50('0x1e'),auth[_0x8d50('0xa')](),controller[_0x8d50('0x1f')]);router['get'](_0x8d50('0x20'),auth[_0x8d50('0xa')](),controller[_0x8d50('0x21')]);router[_0x8d50('0x22')]('/',auth[_0x8d50('0xa')](),controller[_0x8d50('0x23')]);router[_0x8d50('0x22')](_0x8d50('0x24'),auth['isAuthenticated'](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x8d50('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x8d50('0x25')]({'destination':function(_0x2406a5,_0x1a5bc9,_0x3d41fb){_0x3d41fb(null,path[_0x8d50('0x26')](config[_0x8d50('0x27')],_0x8d50('0x28')));},'filename':function(_0x322965,_0x58ecd3,_0x247234){_0x247234(null,util[_0x8d50('0x29')](_0x8d50('0x2a'),Date[_0x8d50('0x2b')](),_0x58ecd3['originalname']));}})});router['post'](_0x8d50('0x10'),upload[_0x8d50('0x2c')](_0x8d50('0x2d')),controller[_0x8d50('0x2e')]);var upload=multer({'storage':multer[_0x8d50('0x25')]({'destination':function(_0x5c529f,_0x28c59d,_0x1a5420){_0x1a5420(null,path['join'](config[_0x8d50('0x27')],'server/files/images/avatars/'));},'filename':function(_0x1108b7,_0x23f82f,_0x57ff18){_0x57ff18(null,util[_0x8d50('0x29')](_0x8d50('0x2a'),Date[_0x8d50('0x2b')](),_0x23f82f['originalname']));}})});router[_0x8d50('0x22')](_0x8d50('0x2f'),upload[_0x8d50('0x2c')](_0x8d50('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0x8d50('0x25')]({'destination':function(_0x2c2311,_0x9a8f65,_0x440384){_0x440384(null,path[_0x8d50('0x26')](config[_0x8d50('0x27')],_0x8d50('0x30')));},'filename':function(_0x5781e6,_0x4a6467,_0x43ab50){_0x43ab50(null,util[_0x8d50('0x29')](_0x8d50('0x2a'),Date[_0x8d50('0x2b')](),_0x4a6467[_0x8d50('0x31')]));}})});router[_0x8d50('0x22')](_0x8d50('0x13'),upload[_0x8d50('0x2c')]('file'),controller[_0x8d50('0x32')]);var upload=multer({'storage':multer[_0x8d50('0x25')]({'destination':function(_0x9ed95e,_0xd7e3ad,_0x15cb4b){_0x15cb4b(null,path['join'](config['root'],_0x8d50('0x30')));},'filename':function(_0x4b8253,_0x42310b,_0xfd50f){_0xfd50f(null,util[_0x8d50('0x29')](_0x8d50('0x2a'),Date[_0x8d50('0x2b')](),_0x42310b[_0x8d50('0x31')]));}})});router[_0x8d50('0x22')](_0x8d50('0x15'),upload[_0x8d50('0x2c')]('file'),controller['addSystemAvatar']);router[_0x8d50('0x22')](_0x8d50('0x33'),controller[_0x8d50('0x34')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x279a27,_0x37f8c3,_0xaf9661){const _0x32073d=path[_0x8d50('0x26')](config[_0x8d50('0x27')],_0x8d50('0x35'),_0x8d50('0x36'),_0x8d50('0x37'));fs_extra[_0x8d50('0x38')](_0x32073d,function(){_0xaf9661(null,_0x32073d);});},'filename':function(_0x5f8ffe,_0xbb47f1,_0x5f0e93){const _0x93846f=_0xbb47f1[_0x8d50('0x31')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x50a05c=path[_0x8d50('0x39')](_0x93846f);const _0x3a0492=Date['now']()+'-'+_0x93846f[_0x8d50('0x3a')](_0x50a05c,'')+_0x50a05c;_0x5f0e93(null,_0x3a0492);}})});router[_0x8d50('0x22')](_0x8d50('0x3b'),offlineUploadMulter[_0x8d50('0x3c')](),controller[_0x8d50('0x3d')]);router[_0x8d50('0x22')](_0x8d50('0x17'),auth[_0x8d50('0xa')](),controller[_0x8d50('0x3e')]);router[_0x8d50('0x22')](_0x8d50('0x1a'),auth[_0x8d50('0xa')](),controller[_0x8d50('0x3f')]);router[_0x8d50('0x22')](_0x8d50('0x40'),auth[_0x8d50('0xa')](),controller[_0x8d50('0x41')]);router[_0x8d50('0x22')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x8d50('0x42')]('/:id',auth['isAuthenticated'](),controller[_0x8d50('0x43')]);router[_0x8d50('0x44')](_0x8d50('0x45'),auth['isAuthenticated'](),controller[_0x8d50('0x46')]);router['delete'](_0x8d50('0x24'),auth[_0x8d50('0xa')](),controller[_0x8d50('0x47')]);router[_0x8d50('0x44')](_0x8d50('0xe'),auth['isAuthenticated'](),controller[_0x8d50('0x48')]);router['delete'](_0x8d50('0x20'),auth[_0x8d50('0xa')](),controller['removeAgents']);module[_0x8d50('0x49')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index df53b6f..4f6d41d 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 _0xc75f=['exports','beaver-logger/server','../components/auth/service','../config/environment','Router','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','isAuthenticated'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc75f,0xde));var _0xfc75=function(_0x4c233b,_0x17a4ea){_0x4c233b=_0x4c233b-0x0;var _0xf766af=_0xc75f[_0x4c233b];return _0xf766af;};var beaverLogger=require(_0xfc75('0x0'));var express=require('express');var auth=require(_0xfc75('0x1'));var config=require(_0xfc75('0x2'));var router=express[_0xfc75('0x3')]();var isProduction=config['env']===_0xfc75('0x4')||![];function clientSideLogs(_0x352c38,_0x3b981c,_0x4ff8a6){var _0x4d2991=_0x352c38[_0xfc75('0x5')][_0xfc75('0x6')](_0xfc75('0x7'));if(!_0x4d2991){throw new Error(_0xfc75('0x8'));}return beaverLogger[_0xfc75('0x9')]({'uri':_0xfc75('0xa'),'logger':_0x4d2991,'enableCors':!isProduction})(_0x352c38,_0x3b981c,_0x4ff8a6);}router['use'](auth[_0xfc75('0xb')](),clientSideLogs);module[_0xfc75('0xc')]=router; \ No newline at end of file +var _0x7488=['env','production','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','isAuthenticated','exports','beaver-logger/server','../components/auth/service','../config/environment','Router'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x7488,0x75));var _0x8748=function(_0x348c6a,_0x328c73){_0x348c6a=_0x348c6a-0x0;var _0x2c53e7=_0x7488[_0x348c6a];return _0x2c53e7;};var beaverLogger=require(_0x8748('0x0'));var express=require('express');var auth=require(_0x8748('0x1'));var config=require(_0x8748('0x2'));var router=express[_0x8748('0x3')]();var isProduction=config[_0x8748('0x4')]===_0x8748('0x5')||![];function clientSideLogs(_0xd8c8d3,_0x43a572,_0x6f6c83){var _0x38a167=_0xd8c8d3['app'][_0x8748('0x6')]('client-side-logger');if(!_0x38a167){throw new Error(_0x8748('0x7'));}return beaverLogger[_0x8748('0x8')]({'uri':'/client-logs','logger':_0x38a167,'enableCors':!isProduction})(_0xd8c8d3,_0x43a572,_0x6f6c83);}router['use'](auth[_0x8748('0x9')](),clientSideLogs);module[_0x8748('0xa')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index c6b4e06..6ce17dd 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 _0x4e03=['Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure'];(function(_0x23ad7b,_0x2cac4a){var _0x438d2a=function(_0x3190eb){while(--_0x3190eb){_0x23ad7b['push'](_0x23ad7b['shift']());}};_0x438d2a(++_0x2cac4a);}(_0x4e03,0x199));var _0x34e0=function(_0x42b522,_0xec82d2){_0x42b522=_0x42b522-0x0;var _0x8b4219=_0x4e03[_0x42b522];return _0x8b4219;};'use strict';var Sequelize=require(_0x34e0('0x0'));module[_0x34e0('0x1')]={'name':{'type':Sequelize[_0x34e0('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x34e0('0x3')](_0x34e0('0x4'),_0x34e0('0x5'),_0x34e0('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x34e0('0x3')](_0x34e0('0x7'),_0x34e0('0x8'))},'data1':{'type':Sequelize[_0x34e0('0x2')],'comment':_0x34e0('0x9')},'data2':{'type':Sequelize['STRING'],'comment':_0x34e0('0xa')},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x34e0('0x2')],'comment':_0x34e0('0xb')},'data5':{'type':Sequelize[_0x34e0('0xc')],'comment':_0x34e0('0xd')},'data6':{'type':Sequelize[_0x34e0('0xc')],'comment':_0x34e0('0xe')},'data7':{'type':Sequelize[_0x34e0('0xc')],'comment':_0x34e0('0xf')}}; \ No newline at end of file +var _0xfa1a=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','Google','Outlook365','Dynamics365','STRING'];(function(_0xa07d7b,_0x2933c8){var _0x307e67=function(_0x1cd091){while(--_0x1cd091){_0xa07d7b['push'](_0xa07d7b['shift']());}};_0x307e67(++_0x2933c8);}(_0xfa1a,0x1b8));var _0xafa1=function(_0x3815c2,_0x1f54e3){_0x3815c2=_0x3815c2-0x0;var _0x271f88=_0xfa1a[_0x3815c2];return _0x271f88;};'use strict';var Sequelize=require(_0xafa1('0x0'));module[_0xafa1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xafa1('0x2')](_0xafa1('0x3'),_0xafa1('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xafa1('0x5'),_0xafa1('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xafa1('0x7')],'comment':_0xafa1('0x8')},'data3':{'type':Sequelize[_0xafa1('0x7')],'comment':_0xafa1('0x9')},'data4':{'type':Sequelize[_0xafa1('0x7')],'comment':_0xafa1('0xa')},'data5':{'type':Sequelize[_0xafa1('0xb')],'comment':_0xafa1('0xc')},'data6':{'type':Sequelize[_0xafa1('0xb')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xafa1('0xb')],'comment':_0xafa1('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 2a2dea7..5d58035 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 _0x9b0a=['where','merge','VIRTUAL','filter','includeAll','include','rows','MicrosoftAzure','decryptString','data3','catch','show','params','rawAttributes','length','options','find','service','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','isValidIdToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','padEnd','index','map','CloudProvider','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters'];(function(_0x309f04,_0x2c8400){var _0x5792e4=function(_0x20d4bd){while(--_0x20d4bd){_0x309f04['push'](_0x309f04['shift']());}};_0x5792e4(++_0x2c8400);}(_0x9b0a,0x1ad));var _0xa9b0=function(_0xe9a6fa,_0x531b30){_0xe9a6fa=_0xe9a6fa-0x0;var _0x354869=_0x9b0a[_0xe9a6fa];return _0x354869;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xa9b0('0x0'));var encryptor=require(_0xa9b0('0x1'));var config=require(_0xa9b0('0x2'));var logger=require(_0xa9b0('0x3'))(_0xa9b0('0x4'));var db=require(_0xa9b0('0x5'))['db'];var oauth=require(_0xa9b0('0x6'));config[_0xa9b0('0x7')]=_['defaults'](config[_0xa9b0('0x7')],{'host':_0xa9b0('0x8'),'port':0x18eb});var socket=require(_0xa9b0('0x9'))(new Redis(config[_0xa9b0('0x7')]));var redis=new Redis(config[_0xa9b0('0x7')]);function respondWithStatusCode(_0x373e4b,_0x137caf){_0x137caf=_0x137caf||0xcc;return function(_0x30901b){if(_0x30901b){return _0x373e4b[_0xa9b0('0xa')](_0x137caf);}return _0x373e4b[_0xa9b0('0xb')](_0x137caf)[_0xa9b0('0xc')]();};}function respondWithResult(_0x2a785d,_0x504f1f){_0x504f1f=_0x504f1f||0xc8;return function(_0x4ca27d){if(_0x4ca27d){return _0x2a785d[_0xa9b0('0xb')](_0x504f1f)['json'](_0x4ca27d);}};}function respondWithFilteredResult(_0xd0ea39,_0x1bc3a1){return function(_0x4b7fbc){if(_0x4b7fbc){var _0x44c361=typeof _0x1bc3a1[_0xa9b0('0xd')]===_0xa9b0('0xe')&&typeof _0x1bc3a1[_0xa9b0('0xf')]==='undefined';var _0x25351e=_0x4b7fbc['count'];var _0x3bc6a3=_0x44c361?0x0:_0x1bc3a1[_0xa9b0('0xd')];var _0x4c718d=_0x44c361?_0x4b7fbc[_0xa9b0('0x10')]:_0x1bc3a1['offset']+_0x1bc3a1[_0xa9b0('0xf')];var _0x2d41c5;if(_0x4c718d>=_0x25351e){_0x4c718d=_0x25351e;_0x2d41c5=0xc8;}else{_0x2d41c5=0xce;}_0xd0ea39[_0xa9b0('0xb')](_0x2d41c5);return _0xd0ea39[_0xa9b0('0x11')](_0xa9b0('0x12'),_0x3bc6a3+'-'+_0x4c718d+'/'+_0x25351e)['json'](_0x4b7fbc);}return null;};}function saveUpdates(_0x32e009){return function(_0x45540c){if(_0x45540c){return _0x45540c[_0xa9b0('0x13')](_0x32e009)[_0xa9b0('0x14')](function(_0x36d866){return _0x36d866;});}return null;};}function removeEntity(_0xecd4e8){return function(_0x2eafd7){if(_0x2eafd7){return _0x2eafd7[_0xa9b0('0x15')]()['then'](function(){_0xecd4e8['status'](0xcc)[_0xa9b0('0xc')]();});}};}function handleEntityNotFound(_0x42808c){return function(_0x48f7a1){if(!_0x48f7a1){_0x42808c[_0xa9b0('0xa')](0x194);}return _0x48f7a1;};}function handleError(_0x5b9764,_0x18d8df){_0x18d8df=_0x18d8df||0x1f4;return function(_0x4129e2){logger['error'](_0x4129e2[_0xa9b0('0x16')]);if(_0x4129e2[_0xa9b0('0x17')]){delete _0x4129e2[_0xa9b0('0x17')];}_0x5b9764[_0xa9b0('0xb')](_0x18d8df)['send'](_0x4129e2);};}function maskClientSecret(_0x5b53b2){return _[_0xa9b0('0x18')](_0x5b53b2['slice'](0x0,0x3),0x14,'*');}exports[_0xa9b0('0x19')]=function(_0x35d3c3,_0x117173){var _0x413728={},_0x2fc9b1={},_0x6a0225={'count':0x0,'rows':[]};var _0x24d967=_[_0xa9b0('0x1a')](db[_0xa9b0('0x1b')]['rawAttributes'],function(_0x219cc4){return{'name':_0x219cc4[_0xa9b0('0x1c')],'type':_0x219cc4[_0xa9b0('0x1d')][_0xa9b0('0x1e')]};});_0x2fc9b1[_0xa9b0('0x1f')]=_[_0xa9b0('0x1a')](_0x24d967,'name');_0x2fc9b1[_0xa9b0('0x20')]=_['keys'](_0x35d3c3[_0xa9b0('0x20')]);_0x2fc9b1['filters']=_[_0xa9b0('0x21')](_0x2fc9b1['model'],_0x2fc9b1['query']);_0x413728[_0xa9b0('0x22')]=_[_0xa9b0('0x21')](_0x2fc9b1['model'],qs[_0xa9b0('0x23')](_0x35d3c3['query'][_0xa9b0('0x23')]));_0x413728[_0xa9b0('0x22')]=_0x413728[_0xa9b0('0x22')]['length']?_0x413728[_0xa9b0('0x22')]:_0x2fc9b1[_0xa9b0('0x1f')];if(!_0x35d3c3[_0xa9b0('0x20')][_0xa9b0('0x24')](_0xa9b0('0x25'))){_0x413728[_0xa9b0('0xf')]=qs[_0xa9b0('0xf')](_0x35d3c3[_0xa9b0('0x20')][_0xa9b0('0xf')]);_0x413728[_0xa9b0('0xd')]=qs['offset'](_0x35d3c3[_0xa9b0('0x20')][_0xa9b0('0xd')]);}_0x413728[_0xa9b0('0x26')]=qs[_0xa9b0('0x27')](_0x35d3c3['query'][_0xa9b0('0x27')]);_0x413728['where']=qs[_0xa9b0('0x28')](_['pick'](_0x35d3c3[_0xa9b0('0x20')],_0x2fc9b1[_0xa9b0('0x28')]),_0x24d967);if(_0x35d3c3[_0xa9b0('0x20')]['filter']){_0x413728[_0xa9b0('0x29')]=_[_0xa9b0('0x2a')](_0x413728[_0xa9b0('0x29')],{'$or':_['map'](_0x24d967,function(_0x1f900e){if(_0x1f900e[_0xa9b0('0x1d')]!==_0xa9b0('0x2b')){var _0x2a7fa8={};_0x2a7fa8[_0x1f900e[_0xa9b0('0x17')]]={'$like':'%'+_0x35d3c3[_0xa9b0('0x20')][_0xa9b0('0x2c')]+'%'};return _0x2a7fa8;}})});}_0x413728=_[_0xa9b0('0x2a')]({},_0x413728,_0x35d3c3['options']);var _0x32f5ec={'where':_0x413728[_0xa9b0('0x29')]};return db[_0xa9b0('0x1b')][_0xa9b0('0x10')](_0x32f5ec)[_0xa9b0('0x14')](function(_0x431d57){_0x6a0225[_0xa9b0('0x10')]=_0x431d57;if(_0x35d3c3[_0xa9b0('0x20')][_0xa9b0('0x2d')]){_0x413728[_0xa9b0('0x2e')]=[{'all':!![]}];}return db[_0xa9b0('0x1b')]['findAll'](_0x413728);})[_0xa9b0('0x14')](function(_0x27662b){_0x6a0225[_0xa9b0('0x2f')]=_[_0xa9b0('0x1a')](_0x27662b,function(_0x3c7802){if(_0x3c7802['service']===_0xa9b0('0x30')){var _0x40b5bf=encryptor[_0xa9b0('0x31')](_0x3c7802[_0xa9b0('0x32')]);_0x3c7802['data3']=maskClientSecret(_0x40b5bf);}return _0x3c7802;});return _0x6a0225;})[_0xa9b0('0x14')](respondWithFilteredResult(_0x117173,_0x413728))[_0xa9b0('0x33')](handleError(_0x117173,null));};exports[_0xa9b0('0x34')]=function(_0x5d719f,_0xe3a653){var _0x327a7a={'raw':!![],'where':{'id':_0x5d719f[_0xa9b0('0x35')]['id']}},_0x13849c={};_0x13849c[_0xa9b0('0x1f')]=_['keys'](db[_0xa9b0('0x1b')][_0xa9b0('0x36')]);_0x13849c[_0xa9b0('0x20')]=_['keys'](_0x5d719f[_0xa9b0('0x20')]);_0x13849c[_0xa9b0('0x28')]=_['intersection'](_0x13849c[_0xa9b0('0x1f')],_0x13849c[_0xa9b0('0x20')]);_0x327a7a[_0xa9b0('0x22')]=_[_0xa9b0('0x21')](_0x13849c[_0xa9b0('0x1f')],qs[_0xa9b0('0x23')](_0x5d719f[_0xa9b0('0x20')][_0xa9b0('0x23')]));_0x327a7a[_0xa9b0('0x22')]=_0x327a7a[_0xa9b0('0x22')][_0xa9b0('0x37')]?_0x327a7a[_0xa9b0('0x22')]:_0x13849c[_0xa9b0('0x1f')];if(_0x5d719f[_0xa9b0('0x20')][_0xa9b0('0x2d')]){_0x327a7a[_0xa9b0('0x2e')]=[{'all':!![]}];}_0x327a7a=_[_0xa9b0('0x2a')]({},_0x327a7a,_0x5d719f[_0xa9b0('0x38')]);return db['CloudProvider'][_0xa9b0('0x39')](_0x327a7a)[_0xa9b0('0x14')](handleEntityNotFound(_0xe3a653,null))[_0xa9b0('0x14')](function(_0x2c1c5d){if(_0x2c1c5d[_0xa9b0('0x3a')]==='MicrosoftAzure'){var _0x387bf2=encryptor[_0xa9b0('0x31')](_0x2c1c5d[_0xa9b0('0x32')]);_0x2c1c5d['data3']=maskClientSecret(_0x387bf2);}return _0x2c1c5d;})['then'](respondWithResult(_0xe3a653,null))[_0xa9b0('0x33')](handleError(_0xe3a653,null));};exports[_0xa9b0('0x3b')]=function(_0x36ff6e,_0x323ebb){if(!_0x36ff6e[_0xa9b0('0x3c')]['name'])throw new Error(_0xa9b0('0x3d'));if(!_0x36ff6e[_0xa9b0('0x3c')][_0xa9b0('0x3a')])throw new Error(_0xa9b0('0x3e'));var _0x19630f=db[_0xa9b0('0x1b')][_0xa9b0('0x36')][_0xa9b0('0x3a')][_0xa9b0('0x3f')];if(!_0x19630f[_0xa9b0('0x40')](_0x36ff6e[_0xa9b0('0x3c')][_0xa9b0('0x3a')]))throw new Error(_0xa9b0('0x41')+_0x19630f[_0xa9b0('0x42')](',\x20'));if(_0x36ff6e[_0xa9b0('0x3c')][_0xa9b0('0x3a')]==='MicrosoftAzure'&&_0x36ff6e['body'][_0xa9b0('0x32')]){_0x36ff6e[_0xa9b0('0x3c')]['data3']=encryptor[_0xa9b0('0x43')](_0x36ff6e['body'][_0xa9b0('0x32')]);}return db[_0xa9b0('0x1b')]['create'](_0x36ff6e[_0xa9b0('0x3c')],{})[_0xa9b0('0x14')](respondWithResult(_0x323ebb,0xc9))['catch'](handleError(_0x323ebb,null));};exports[_0xa9b0('0x13')]=function(_0x34e971,_0x3cd4a5){if(_0x34e971[_0xa9b0('0x3c')]['id']){delete _0x34e971[_0xa9b0('0x3c')]['id'];}return db[_0xa9b0('0x1b')][_0xa9b0('0x39')]({'where':{'id':_0x34e971[_0xa9b0('0x35')]['id']}})[_0xa9b0('0x14')](handleEntityNotFound(_0x3cd4a5,null))[_0xa9b0('0x14')](function(_0x3b6fe5){if(_0x3b6fe5[_0xa9b0('0x3a')]===_0xa9b0('0x30')&&_0x34e971['body'][_0xa9b0('0x32')]){_0x34e971[_0xa9b0('0x3c')][_0xa9b0('0x32')]=encryptor[_0xa9b0('0x43')](_0x34e971['body'][_0xa9b0('0x32')]);}return _0x3b6fe5;})[_0xa9b0('0x14')](saveUpdates(_0x34e971[_0xa9b0('0x3c')],null))['then'](respondWithResult(_0x3cd4a5,null))[_0xa9b0('0x33')](handleError(_0x3cd4a5,null));};exports['destroy']=function(_0x18f630,_0x576e61){return db[_0xa9b0('0x1b')]['find']({'where':{'id':_0x18f630['params']['id']}})['then'](handleEntityNotFound(_0x576e61,null))[_0xa9b0('0x14')](removeEntity(_0x576e61,null))[_0xa9b0('0x33')](handleError(_0x576e61,null));};exports[_0xa9b0('0x44')]=function(_0x1bfdc2,_0x371249){return db['CloudProvider'][_0xa9b0('0x45')]({'where':{'id':_0x1bfdc2[_0xa9b0('0x35')]['id']},'raw':!![]})[_0xa9b0('0x14')](function(_0x11c185){if(!_0x11c185)return _0x371249[_0xa9b0('0xa')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x11c185,_0x1bfdc2[_0xa9b0('0x46')]['id'])};})[_0xa9b0('0x14')](respondWithResult(_0x371249,null))['catch'](handleError(_0x371249,null));};exports[_0xa9b0('0x47')]=function(_0x553c30,_0x387ff2){var _0x1db460=_0x553c30[_0xa9b0('0x3c')];var _0x4d46e0;var _0x227352;if(_0x1db460[_0xa9b0('0x48')])throw _0x1db460;redis[_0xa9b0('0x49')](_0x1db460[_0xa9b0('0x4a')])['then'](function(_0x57584e){if(!_0x57584e)throw new Error(_0xa9b0('0x4b'));_0x4d46e0=JSON[_0xa9b0('0x4c')](_0x57584e);var _0x5e68c2=Buffer[_0xa9b0('0x4d')](_0x1db460[_0xa9b0('0x4a')],_0xa9b0('0x4e'))[_0xa9b0('0x4f')]('ascii');_0x227352=JSON[_0xa9b0('0x4c')](_0x5e68c2);if(!oauth[_0xa9b0('0x50')](_0x1db460['id_token'],_0x4d46e0['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x1db460[_0xa9b0('0x4a')]);return oauth['getOauth2MicrosoftAccessToken'](_0x1db460[_0xa9b0('0x51')],_0x4d46e0);})[_0xa9b0('0x14')](function(_0x4e370d){_0x4d46e0[_0xa9b0('0x52')]=_0x4e370d['access_token'];_0x4d46e0[_0xa9b0('0x53')]=_0x4e370d[_0xa9b0('0x54')];return db[_0xa9b0('0x1b')][_0xa9b0('0x13')]({'data5':_0x4d46e0[_0xa9b0('0x52')],'data6':_0x4d46e0[_0xa9b0('0x53')]},{'where':{'id':_0x4d46e0['id']}});})[_0xa9b0('0x14')](function(){oauth[_0xa9b0('0x55')](_0x4d46e0);socket[_0xa9b0('0x56')](_0xa9b0('0x57'),{'id':_0x227352['id']});return;})[_0xa9b0('0x14')](respondWithStatusCode(_0x387ff2,null))['catch'](function(_0x3016a0){if(_0x227352){socket[_0xa9b0('0x56')](_0xa9b0('0x58'),{'id':_0x227352['id']});}if(!_0x4d46e0){logger[_0xa9b0('0x48')](_0xa9b0('0x59'),_0x3016a0);return _0x387ff2[_0xa9b0('0xb')](0x1f4)[_0xa9b0('0x5a')](_0x3016a0[_0xa9b0('0x5b')]);}logger[_0xa9b0('0x48')](_0xa9b0('0x5c'),_0x4d46e0['id'],JSON[_0xa9b0('0x5d')](_0x3016a0));});}; \ No newline at end of file +var _0xf5bc=['code','data5','data6','refresh_token','startRefreshInterval','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','localhost','socket.io-emitter','redis','status','end','json','offset','limit','count','set','Content-Range','update','destroy','then','sendStatus','error','name','send','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','service','MicrosoftAzure','decryptString','data3','catch','show','params','find','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','from','base64','toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken'];(function(_0x47646a,_0x5eda31){var _0x491280=function(_0x3132bf){while(--_0x3132bf){_0x47646a['push'](_0x47646a['shift']());}};_0x491280(++_0x5eda31);}(_0xf5bc,0x126));var _0xcf5b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf5bc[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xcf5b('0x0'));var Redis=require(_0xcf5b('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xcf5b('0x2'));var config=require(_0xcf5b('0x3'));var logger=require(_0xcf5b('0x4'))('api');var db=require(_0xcf5b('0x5'))['db'];var oauth=require(_0xcf5b('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0xcf5b('0x7'),'port':0x18eb});var socket=require(_0xcf5b('0x8'))(new Redis(config[_0xcf5b('0x9')]));var redis=new Redis(config[_0xcf5b('0x9')]);function respondWithStatusCode(_0x29ccdd,_0x4f9c1d){_0x4f9c1d=_0x4f9c1d||0xcc;return function(_0x37019c){if(_0x37019c){return _0x29ccdd['sendStatus'](_0x4f9c1d);}return _0x29ccdd[_0xcf5b('0xa')](_0x4f9c1d)[_0xcf5b('0xb')]();};}function respondWithResult(_0x73607f,_0x20e8e2){_0x20e8e2=_0x20e8e2||0xc8;return function(_0x258126){if(_0x258126){return _0x73607f[_0xcf5b('0xa')](_0x20e8e2)[_0xcf5b('0xc')](_0x258126);}};}function respondWithFilteredResult(_0x3bd30c,_0x180c48){return function(_0x41bde6){if(_0x41bde6){var _0x2bc88b=typeof _0x180c48[_0xcf5b('0xd')]==='undefined'&&typeof _0x180c48[_0xcf5b('0xe')]==='undefined';var _0x1a483d=_0x41bde6[_0xcf5b('0xf')];var _0xe285aa=_0x2bc88b?0x0:_0x180c48[_0xcf5b('0xd')];var _0x568ac1=_0x2bc88b?_0x41bde6[_0xcf5b('0xf')]:_0x180c48[_0xcf5b('0xd')]+_0x180c48[_0xcf5b('0xe')];var _0x2bf234;if(_0x568ac1>=_0x1a483d){_0x568ac1=_0x1a483d;_0x2bf234=0xc8;}else{_0x2bf234=0xce;}_0x3bd30c['status'](_0x2bf234);return _0x3bd30c[_0xcf5b('0x10')](_0xcf5b('0x11'),_0xe285aa+'-'+_0x568ac1+'/'+_0x1a483d)[_0xcf5b('0xc')](_0x41bde6);}return null;};}function saveUpdates(_0x310943){return function(_0x1c2a57){if(_0x1c2a57){return _0x1c2a57[_0xcf5b('0x12')](_0x310943)['then'](function(_0x2b4a89){return _0x2b4a89;});}return null;};}function removeEntity(_0x4ab31e){return function(_0x2831b5){if(_0x2831b5){return _0x2831b5[_0xcf5b('0x13')]()[_0xcf5b('0x14')](function(){_0x4ab31e[_0xcf5b('0xa')](0xcc)[_0xcf5b('0xb')]();});}};}function handleEntityNotFound(_0x52fc62){return function(_0x58caf6){if(!_0x58caf6){_0x52fc62[_0xcf5b('0x15')](0x194);}return _0x58caf6;};}function handleError(_0x30103b,_0x51a716){_0x51a716=_0x51a716||0x1f4;return function(_0x12520e){logger[_0xcf5b('0x16')](_0x12520e['stack']);if(_0x12520e[_0xcf5b('0x17')]){delete _0x12520e[_0xcf5b('0x17')];}_0x30103b[_0xcf5b('0xa')](_0x51a716)[_0xcf5b('0x18')](_0x12520e);};}function maskClientSecret(_0x547630){return _['padEnd'](_0x547630[_0xcf5b('0x19')](0x0,0x3),0x14,'*');}exports[_0xcf5b('0x1a')]=function(_0xea656a,_0xcc0b2a){var _0x3d1efa={},_0x2b2168={},_0x34df38={'count':0x0,'rows':[]};var _0x4d33bd=_[_0xcf5b('0x1b')](db[_0xcf5b('0x1c')][_0xcf5b('0x1d')],function(_0x435a87){return{'name':_0x435a87[_0xcf5b('0x1e')],'type':_0x435a87[_0xcf5b('0x1f')][_0xcf5b('0x20')]};});_0x2b2168['model']=_[_0xcf5b('0x1b')](_0x4d33bd,_0xcf5b('0x17'));_0x2b2168[_0xcf5b('0x21')]=_[_0xcf5b('0x22')](_0xea656a[_0xcf5b('0x21')]);_0x2b2168[_0xcf5b('0x23')]=_[_0xcf5b('0x24')](_0x2b2168[_0xcf5b('0x25')],_0x2b2168['query']);_0x3d1efa[_0xcf5b('0x26')]=_[_0xcf5b('0x24')](_0x2b2168[_0xcf5b('0x25')],qs[_0xcf5b('0x27')](_0xea656a[_0xcf5b('0x21')][_0xcf5b('0x27')]));_0x3d1efa[_0xcf5b('0x26')]=_0x3d1efa[_0xcf5b('0x26')]['length']?_0x3d1efa[_0xcf5b('0x26')]:_0x2b2168[_0xcf5b('0x25')];if(!_0xea656a[_0xcf5b('0x21')][_0xcf5b('0x28')]('nolimit')){_0x3d1efa[_0xcf5b('0xe')]=qs[_0xcf5b('0xe')](_0xea656a[_0xcf5b('0x21')][_0xcf5b('0xe')]);_0x3d1efa['offset']=qs[_0xcf5b('0xd')](_0xea656a[_0xcf5b('0x21')][_0xcf5b('0xd')]);}_0x3d1efa['order']=qs[_0xcf5b('0x29')](_0xea656a['query'][_0xcf5b('0x29')]);_0x3d1efa[_0xcf5b('0x2a')]=qs['filters'](_[_0xcf5b('0x2b')](_0xea656a[_0xcf5b('0x21')],_0x2b2168[_0xcf5b('0x23')]),_0x4d33bd);if(_0xea656a[_0xcf5b('0x21')]['filter']){_0x3d1efa[_0xcf5b('0x2a')]=_['merge'](_0x3d1efa[_0xcf5b('0x2a')],{'$or':_[_0xcf5b('0x1b')](_0x4d33bd,function(_0x1da922){if(_0x1da922[_0xcf5b('0x1f')]!==_0xcf5b('0x2c')){var _0x148da0={};_0x148da0[_0x1da922[_0xcf5b('0x17')]]={'$like':'%'+_0xea656a[_0xcf5b('0x21')][_0xcf5b('0x2d')]+'%'};return _0x148da0;}})});}_0x3d1efa=_[_0xcf5b('0x2e')]({},_0x3d1efa,_0xea656a[_0xcf5b('0x2f')]);var _0x327f4a={'where':_0x3d1efa[_0xcf5b('0x2a')]};return db['CloudProvider']['count'](_0x327f4a)[_0xcf5b('0x14')](function(_0x505ed3){_0x34df38[_0xcf5b('0xf')]=_0x505ed3;if(_0xea656a[_0xcf5b('0x21')][_0xcf5b('0x30')]){_0x3d1efa[_0xcf5b('0x31')]=[{'all':!![]}];}return db[_0xcf5b('0x1c')][_0xcf5b('0x32')](_0x3d1efa);})['then'](function(_0x1f3bb6){_0x34df38['rows']=_[_0xcf5b('0x1b')](_0x1f3bb6,function(_0x223e14){if(_0x223e14[_0xcf5b('0x33')]===_0xcf5b('0x34')){var _0x5bbaa9=encryptor[_0xcf5b('0x35')](_0x223e14[_0xcf5b('0x36')]);_0x223e14[_0xcf5b('0x36')]=maskClientSecret(_0x5bbaa9);}return _0x223e14;});return _0x34df38;})['then'](respondWithFilteredResult(_0xcc0b2a,_0x3d1efa))[_0xcf5b('0x37')](handleError(_0xcc0b2a,null));};exports[_0xcf5b('0x38')]=function(_0x2bc098,_0x2fe792){var _0x4e084a={'raw':!![],'where':{'id':_0x2bc098[_0xcf5b('0x39')]['id']}},_0x5e2a08={};_0x5e2a08[_0xcf5b('0x25')]=_[_0xcf5b('0x22')](db[_0xcf5b('0x1c')][_0xcf5b('0x1d')]);_0x5e2a08[_0xcf5b('0x21')]=_[_0xcf5b('0x22')](_0x2bc098[_0xcf5b('0x21')]);_0x5e2a08[_0xcf5b('0x23')]=_[_0xcf5b('0x24')](_0x5e2a08[_0xcf5b('0x25')],_0x5e2a08[_0xcf5b('0x21')]);_0x4e084a['attributes']=_[_0xcf5b('0x24')](_0x5e2a08[_0xcf5b('0x25')],qs[_0xcf5b('0x27')](_0x2bc098['query']['fields']));_0x4e084a[_0xcf5b('0x26')]=_0x4e084a['attributes']['length']?_0x4e084a[_0xcf5b('0x26')]:_0x5e2a08['model'];if(_0x2bc098[_0xcf5b('0x21')][_0xcf5b('0x30')]){_0x4e084a[_0xcf5b('0x31')]=[{'all':!![]}];}_0x4e084a=_[_0xcf5b('0x2e')]({},_0x4e084a,_0x2bc098['options']);return db[_0xcf5b('0x1c')][_0xcf5b('0x3a')](_0x4e084a)[_0xcf5b('0x14')](handleEntityNotFound(_0x2fe792,null))[_0xcf5b('0x14')](function(_0x2f5a64){if(_0x2f5a64[_0xcf5b('0x33')]===_0xcf5b('0x34')){var _0x227553=encryptor[_0xcf5b('0x35')](_0x2f5a64[_0xcf5b('0x36')]);_0x2f5a64[_0xcf5b('0x36')]=maskClientSecret(_0x227553);}return _0x2f5a64;})['then'](respondWithResult(_0x2fe792,null))['catch'](handleError(_0x2fe792,null));};exports['create']=function(_0x107d34,_0x3085a6){if(!_0x107d34[_0xcf5b('0x3b')][_0xcf5b('0x17')])throw new Error(_0xcf5b('0x3c'));if(!_0x107d34[_0xcf5b('0x3b')][_0xcf5b('0x33')])throw new Error(_0xcf5b('0x3d'));var _0x1381bf=db[_0xcf5b('0x1c')][_0xcf5b('0x1d')][_0xcf5b('0x33')][_0xcf5b('0x3e')];if(!_0x1381bf[_0xcf5b('0x3f')](_0x107d34[_0xcf5b('0x3b')][_0xcf5b('0x33')]))throw new Error(_0xcf5b('0x40')+_0x1381bf[_0xcf5b('0x41')](',\x20'));if(_0x107d34[_0xcf5b('0x3b')]['service']===_0xcf5b('0x34')&&_0x107d34[_0xcf5b('0x3b')][_0xcf5b('0x36')]){_0x107d34[_0xcf5b('0x3b')][_0xcf5b('0x36')]=encryptor[_0xcf5b('0x42')](_0x107d34['body'][_0xcf5b('0x36')]);}return db[_0xcf5b('0x1c')][_0xcf5b('0x43')](_0x107d34[_0xcf5b('0x3b')],{})[_0xcf5b('0x14')](respondWithResult(_0x3085a6,0xc9))[_0xcf5b('0x37')](handleError(_0x3085a6,null));};exports[_0xcf5b('0x12')]=function(_0x53921e,_0x5531c1){if(_0x53921e[_0xcf5b('0x3b')]['id']){delete _0x53921e[_0xcf5b('0x3b')]['id'];}return db[_0xcf5b('0x1c')]['find']({'where':{'id':_0x53921e[_0xcf5b('0x39')]['id']}})[_0xcf5b('0x14')](handleEntityNotFound(_0x5531c1,null))[_0xcf5b('0x14')](function(_0x315923){if(_0x315923[_0xcf5b('0x33')]===_0xcf5b('0x34')&&_0x53921e[_0xcf5b('0x3b')][_0xcf5b('0x36')]){_0x53921e['body'][_0xcf5b('0x36')]=encryptor[_0xcf5b('0x42')](_0x53921e['body'][_0xcf5b('0x36')]);}return _0x315923;})['then'](saveUpdates(_0x53921e['body'],null))[_0xcf5b('0x14')](respondWithResult(_0x5531c1,null))[_0xcf5b('0x37')](handleError(_0x5531c1,null));};exports[_0xcf5b('0x13')]=function(_0x20c092,_0x1ac540){return db[_0xcf5b('0x1c')][_0xcf5b('0x3a')]({'where':{'id':_0x20c092[_0xcf5b('0x39')]['id']}})[_0xcf5b('0x14')](handleEntityNotFound(_0x1ac540,null))['then'](removeEntity(_0x1ac540,null))[_0xcf5b('0x37')](handleError(_0x1ac540,null));};exports[_0xcf5b('0x44')]=function(_0x3d0f70,_0x54921c){return db[_0xcf5b('0x1c')][_0xcf5b('0x45')]({'where':{'id':_0x3d0f70[_0xcf5b('0x39')]['id']},'raw':!![]})['then'](function(_0x4f2a2c){if(!_0x4f2a2c)return _0x54921c['sendStatus'](0x194);return{'url':oauth[_0xcf5b('0x46')](_0x4f2a2c,_0x3d0f70[_0xcf5b('0x47')]['id'])};})[_0xcf5b('0x14')](respondWithResult(_0x54921c,null))[_0xcf5b('0x37')](handleError(_0x54921c,null));};exports[_0xcf5b('0x48')]=function(_0x2f5fa3,_0x168c37){var _0x451fa4=_0x2f5fa3['body'];var _0x31410b;var _0x50bff7;if(_0x451fa4[_0xcf5b('0x16')])throw _0x451fa4;redis[_0xcf5b('0x49')](_0x451fa4[_0xcf5b('0x4a')])['then'](function(_0x303465){if(!_0x303465)throw new Error(_0xcf5b('0x4b'));_0x31410b=JSON['parse'](_0x303465);var _0x1823bb=Buffer[_0xcf5b('0x4c')](_0x451fa4['state'],_0xcf5b('0x4d'))[_0xcf5b('0x4e')](_0xcf5b('0x4f'));_0x50bff7=JSON[_0xcf5b('0x50')](_0x1823bb);if(!oauth[_0xcf5b('0x51')](_0x451fa4[_0xcf5b('0x52')],_0x31410b[_0xcf5b('0x53')]))throw new Error(_0xcf5b('0x54'));redis['del'](_0x451fa4[_0xcf5b('0x4a')]);return oauth[_0xcf5b('0x55')](_0x451fa4[_0xcf5b('0x56')],_0x31410b);})[_0xcf5b('0x14')](function(_0x5776ec){_0x31410b[_0xcf5b('0x57')]=_0x5776ec['access_token'];_0x31410b[_0xcf5b('0x58')]=_0x5776ec[_0xcf5b('0x59')];return db['CloudProvider'][_0xcf5b('0x12')]({'data5':_0x31410b[_0xcf5b('0x57')],'data6':_0x31410b['data6']},{'where':{'id':_0x31410b['id']}});})[_0xcf5b('0x14')](function(){oauth[_0xcf5b('0x5a')](_0x31410b);socket['emit'](_0xcf5b('0x5b'),{'id':_0x50bff7['id']});return;})[_0xcf5b('0x14')](respondWithStatusCode(_0x168c37,null))[_0xcf5b('0x37')](function(_0x53d9f2){if(_0x50bff7){socket['emit'](_0xcf5b('0x5c'),{'id':_0x50bff7['id']});}if(!_0x31410b){logger[_0xcf5b('0x16')](_0xcf5b('0x5d'),_0x53d9f2);return _0x168c37[_0xcf5b('0xa')](0x1f4)[_0xcf5b('0x18')](_0x53d9f2['message']);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x31410b['id'],JSON[_0xcf5b('0x5e')](_0x53d9f2));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 7bfdb9c..f6ec9cc 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 _0x5d76=['rimraf','../../config/environment','define','cloud_providers','util','../../config/logger','api','request-promise','path'];(function(_0x4a1722,_0x1f3cf5){var _0x336d48=function(_0x1adf0e){while(--_0x1adf0e){_0x4a1722['push'](_0x4a1722['shift']());}};_0x336d48(++_0x1f3cf5);}(_0x5d76,0x124));var _0x65d7=function(_0x2d7619,_0x37d122){_0x2d7619=_0x2d7619-0x0;var _0x1f5b00=_0x5d76[_0x2d7619];return _0x1f5b00;};'use strict';var _=require('lodash');var util=require(_0x65d7('0x0'));var logger=require(_0x65d7('0x1'))(_0x65d7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x65d7('0x3'));var fs=require('fs');var path=require(_0x65d7('0x4'));var rimraf=require(_0x65d7('0x5'));var config=require(_0x65d7('0x6'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x1b101d,_0x254f11){return _0x1b101d[_0x65d7('0x7')]('CloudProvider',attributes,{'tableName':_0x65d7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe411=['bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment'];(function(_0x5cf81d,_0x4093d2){var _0xdfb346=function(_0x4cf7c2){while(--_0x4cf7c2){_0x5cf81d['push'](_0x5cf81d['shift']());}};_0xdfb346(++_0x4093d2);}(_0xe411,0x121));var _0x1e41=function(_0x2074b2,_0x5a527a){_0x2074b2=_0x2074b2-0x0;var _0x1e6eb8=_0xe411[_0x2074b2];return _0x1e6eb8;};'use strict';var _=require(_0x1e41('0x0'));var util=require(_0x1e41('0x1'));var logger=require(_0x1e41('0x2'))(_0x1e41('0x3'));var moment=require(_0x1e41('0x4'));var BPromise=require(_0x1e41('0x5'));var rp=require(_0x1e41('0x6'));var fs=require('fs');var path=require(_0x1e41('0x7'));var rimraf=require(_0x1e41('0x8'));var config=require(_0x1e41('0x9'));var attributes=require(_0x1e41('0xa'));module[_0x1e41('0xb')]=function(_0x41ed1f,_0x2db0d7){return _0x41ed1f['define'](_0x1e41('0xc'),attributes,{'tableName':_0x1e41('0xd'),'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 a29d2aa..2ce192e 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 _0xd5fb=['data3','POST','data5','access_token','data6','refresh_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','bind','intervals','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../mysqldb','redis','defaults','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','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','data7','replace','{TENANT_ID}','data2','code','id_token','from','toString','base64','hex','client_id','data1','join','data4','response_mode','form_post','scope','prompt','login','key','value','oauth2Claims','oauth2/','set','stringify','iss','issuer','aud','nonce','isAfter','unix','resolve','CloudProvider','findOne','then'];(function(_0x322296,_0x57eb19){var _0x432ea7=function(_0x4bd2b3){while(--_0x4bd2b3){_0x322296['push'](_0x322296['shift']());}};_0x432ea7(++_0x57eb19);}(_0xd5fb,0xa4));var _0xbd5f=function(_0x38b347,_0x29f7f6){_0x38b347=_0x38b347-0x0;var _0x24134e=_0xd5fb[_0x38b347];return _0x24134e;};'use strict';var _=require('lodash');var crypto=require(_0xbd5f('0x0'));var jwt=require('jsonwebtoken');var moment=require(_0xbd5f('0x1'));var Redis=require(_0xbd5f('0x2'));var rp=require(_0xbd5f('0x3'));var util=require(_0xbd5f('0x4'));var encryptor=require(_0xbd5f('0x5'));var config=require(_0xbd5f('0x6'));var logger=require('../../config/logger')(_0xbd5f('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xbd5f('0x8'))['db'];config[_0xbd5f('0x9')]=_[_0xbd5f('0xa')](config[_0xbd5f('0x9')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xbd5f('0x9')]);var MICROSOFT_AUTH_URL=_0xbd5f('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0xbd5f('0xc'),_0xbd5f('0xd'),_0xbd5f('0xe'),_0xbd5f('0xf'),_0xbd5f('0x10'),_0xbd5f('0x11'),_0xbd5f('0x12')],'Dynamics365':[_0xbd5f('0xc'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xbd5f('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x590fe1){var _0x190c56=_[_0xbd5f('0x14')](AZURE_AUTH_SCOPES[_0x590fe1[_0xbd5f('0x15')]]);if(_0x590fe1[_0xbd5f('0x15')]===_0xbd5f('0x16'))_0x190c56['push'](_0x590fe1[_0xbd5f('0x17')]+'/.default');return _0x190c56['join']('\x20');}function getAccessTokenScope(_0x550da9){if(_0x550da9[_0xbd5f('0x15')]==='Outlook365')return _0xbd5f('0x10');if(_0x550da9[_0xbd5f('0x15')]===_0xbd5f('0x16'))return _0x550da9[_0xbd5f('0x17')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x1e13e7,_0x54ecc3){var _0x44426b=MICROSOFT_AUTH_URL[_0xbd5f('0x18')](_0xbd5f('0x19'),_0x1e13e7[_0xbd5f('0x1a')]);var _0x1cd574=[_0xbd5f('0x1b'),_0xbd5f('0x1c')];var _0x9ce985=Buffer[_0xbd5f('0x1d')](JSON['stringify']({'id':_0x54ecc3}))[_0xbd5f('0x1e')](_0xbd5f('0x1f'));var _0x1137f4=crypto['randomBytes'](0x10)['toString'](_0xbd5f('0x20'));var _0x57c8fc=getAuthorizationScopes(_0x1e13e7);var _0x38f524=[{'key':_0xbd5f('0x21'),'value':_0x1e13e7[_0xbd5f('0x22')]},{'key':'response_type','value':encodeURIComponent(_0x1cd574[_0xbd5f('0x23')]('\x20'))},{'key':'redirect_uri','value':_0x1e13e7[_0xbd5f('0x24')]},{'key':_0xbd5f('0x25'),'value':_0xbd5f('0x26')},{'key':_0xbd5f('0x27'),'value':encodeURIComponent(_0x57c8fc)},{'key':'state','value':_0x9ce985},{'key':'nonce','value':_0x1137f4},{'key':_0xbd5f('0x28'),'value':_0xbd5f('0x29')}];var _0x43e060=_0x44426b+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xbd5f('0x14')](_0x38f524,function(_0x41a6e9){return _0x41a6e9[_0xbd5f('0x2a')]+'='+_0x41a6e9[_0xbd5f('0x2b')];})[_0xbd5f('0x23')]('&');_0x1e13e7[_0xbd5f('0x2c')]={'issuer':_0x44426b[_0xbd5f('0x18')](_0xbd5f('0x2d'),''),'audience':_0x1e13e7['data1'],'state':_0x9ce985,'nonce':_0x1137f4};redis[_0xbd5f('0x2e')](_0x9ce985,JSON[_0xbd5f('0x2f')](_0x1e13e7));return _0x43e060;}function isValidIdToken(_0x791689,_0x34bd05){try{var _0xcdb21f=jwt['decode'](_0x791689,{'complete':!![]});var _0x32cea9=_0xcdb21f['payload'];if(_0x32cea9[_0xbd5f('0x30')]!==_0x34bd05[_0xbd5f('0x31')])return![];if(_0x32cea9[_0xbd5f('0x32')]!==_0x34bd05['audience'])return![];if(_0x32cea9[_0xbd5f('0x33')]!==_0x34bd05['nonce'])return![];if(moment()[_0xbd5f('0x34')](moment[_0xbd5f('0x35')](_0x32cea9['exp'])))return![];return!![];}catch(_0x49e993){throw _0x49e993;}}function refreshOauth2MicrosoftAccessToken(_0xdbc1e2){return Promise[_0xbd5f('0x36')]()['then'](function(){if(_0xdbc1e2['data3'])return _0xdbc1e2;return db[_0xbd5f('0x37')][_0xbd5f('0x38')]({'where':{'id':_0xdbc1e2['id']},'raw':!![]});})[_0xbd5f('0x39')](function(_0x2e7b3b){var _0x35c2d0={'grant_type':'refresh_token','refresh_token':_0x2e7b3b['data6'],'scope':getAccessTokenScope(_0x2e7b3b),'redirect_uri':_0x2e7b3b['data4'],'client_id':_0x2e7b3b[_0xbd5f('0x22')],'client_secret':encryptor['decryptString'](_0x2e7b3b[_0xbd5f('0x3a')])};var _0x4fd332={'method':_0xbd5f('0x3b'),'uri':MICROSOFT_AUTH_URL[_0xbd5f('0x18')](_0xbd5f('0x19'),_0x2e7b3b[_0xbd5f('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x35c2d0,'json':!![]};return rp(_0x4fd332);})[_0xbd5f('0x39')](function(_0x216209){_0xdbc1e2[_0xbd5f('0x3c')]=_0x216209[_0xbd5f('0x3d')];_0xdbc1e2[_0xbd5f('0x3e')]=_0x216209[_0xbd5f('0x3f')];return db[_0xbd5f('0x37')][_0xbd5f('0x40')]({'data5':_0xdbc1e2[_0xbd5f('0x3c')],'data6':_0xdbc1e2['data6']},{'where':{'id':_0xdbc1e2['id']}});})[_0xbd5f('0x39')](function(){return _0xdbc1e2;})[_0xbd5f('0x41')](function(_0x3304ca){logger[_0xbd5f('0x42')](_0xbd5f('0x43'),_0xdbc1e2['id'],_0x3304ca);});}function getOauth2MicrosoftAccessToken(_0x2dd233,_0x1cbc51){var _0xd045b4={'grant_type':'authorization_code','code':_0x2dd233,'scope':getAccessTokenScope(_0x1cbc51),'redirect_uri':_0x1cbc51[_0xbd5f('0x24')],'client_id':_0x1cbc51[_0xbd5f('0x22')],'client_secret':encryptor['decryptString'](_0x1cbc51[_0xbd5f('0x3a')])};var _0x537257={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xbd5f('0x18')](_0xbd5f('0x19'),_0x1cbc51[_0xbd5f('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xd045b4,'json':!![]};return rp(_0x537257);}function startRefreshInterval(_0x381848){var _0x4aa6d9=schedule['intervals'];if(_0x4aa6d9[_0x381848['id']])clearInterval(_0x4aa6d9[_0x381848['id']]);_0x4aa6d9[_0x381848['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xbd5f('0x44')](this,{'id':_0x381848['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xbd5f('0x45')]=_0x4aa6d9;}function startAllRefreshIntervals(){return db[_0xbd5f('0x37')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x2a23b4){var _0x140c17=_0x2a23b4[_0xbd5f('0x14')](function(_0x156c47){return refreshOauth2MicrosoftAccessToken(_0x156c47)['then'](function(_0x4dabb6){startRefreshInterval(_0x4dabb6);});});return Promise[_0xbd5f('0x46')](_0x140c17);})[_0xbd5f('0x41')](function(_0x294ecb){var _0x13cca1=_0x294ecb?util[_0xbd5f('0x47')](_0x294ecb,{'showHidden':![],'depth':null}):'';logger[_0xbd5f('0x42')](_0xbd5f('0x48'),_0x13cca1);});}module[_0xbd5f('0x49')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xf6bd=['set','iss','issuer','aud','isAfter','unix','exp','resolve','then','CloudProvider','findOne','refresh_token','data3','data6','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','bind','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','push','data7','/.default','replace','{TENANT_ID}','data2','code','id_token','from','stringify','randomBytes','toString','client_id','data1','response_type','redirect_uri','data4','form_post','scope','state','nonce','login','value','join','oauth2/'];(function(_0x351ebe,_0x187f58){var _0xbe1706=function(_0x54a3cf){while(--_0x54a3cf){_0x351ebe['push'](_0x351ebe['shift']());}};_0xbe1706(++_0x187f58);}(_0xf6bd,0x1e2));var _0xdf6b=function(_0x578c0e,_0xff70fb){_0x578c0e=_0x578c0e-0x0;var _0x4db2c2=_0xf6bd[_0x578c0e];return _0x4db2c2;};'use strict';var _=require(_0xdf6b('0x0'));var crypto=require(_0xdf6b('0x1'));var jwt=require(_0xdf6b('0x2'));var moment=require(_0xdf6b('0x3'));var Redis=require(_0xdf6b('0x4'));var rp=require(_0xdf6b('0x5'));var util=require(_0xdf6b('0x6'));var encryptor=require(_0xdf6b('0x7'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xdf6b('0x8'));var schedule=require(_0xdf6b('0x9'));var db=require(_0xdf6b('0xa'))['db'];config[_0xdf6b('0xb')]=_[_0xdf6b('0xc')](config['redis'],{'host':_0xdf6b('0xd'),'port':0x18eb});var redis=new Redis(config[_0xdf6b('0xb')]);var MICROSOFT_AUTH_URL=_0xdf6b('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0xdf6b('0xf'),'profile',_0xdf6b('0x10'),_0xdf6b('0x11'),_0xdf6b('0x12'),'https://outlook.office.com/POP.AccessAsUser.All',_0xdf6b('0x13')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xdf6b('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0xdf6b('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1de7d7){var _0x55091a=_[_0xdf6b('0x16')](AZURE_AUTH_SCOPES[_0x1de7d7[_0xdf6b('0x17')]]);if(_0x1de7d7[_0xdf6b('0x17')]===_0xdf6b('0x18'))_0x55091a[_0xdf6b('0x19')](_0x1de7d7[_0xdf6b('0x1a')]+_0xdf6b('0x1b'));return _0x55091a['join']('\x20');}function getAccessTokenScope(_0x4778c2){if(_0x4778c2[_0xdf6b('0x17')]==='Outlook365')return _0xdf6b('0x12');if(_0x4778c2[_0xdf6b('0x17')]===_0xdf6b('0x18'))return _0x4778c2['data7']+_0xdf6b('0x1b');}function generateMicrosoftAuthorizationUrl(_0x5c35d8,_0x3505d6){var _0x2be47c=MICROSOFT_AUTH_URL[_0xdf6b('0x1c')](_0xdf6b('0x1d'),_0x5c35d8[_0xdf6b('0x1e')]);var _0x2ba97a=[_0xdf6b('0x1f'),_0xdf6b('0x20')];var _0x874e8a=Buffer[_0xdf6b('0x21')](JSON[_0xdf6b('0x22')]({'id':_0x3505d6}))['toString']('base64');var _0x1b32b0=crypto[_0xdf6b('0x23')](0x10)[_0xdf6b('0x24')]('hex');var _0x189bd8=getAuthorizationScopes(_0x5c35d8);var _0x116f57=[{'key':_0xdf6b('0x25'),'value':_0x5c35d8[_0xdf6b('0x26')]},{'key':_0xdf6b('0x27'),'value':encodeURIComponent(_0x2ba97a['join']('\x20'))},{'key':_0xdf6b('0x28'),'value':_0x5c35d8[_0xdf6b('0x29')]},{'key':'response_mode','value':_0xdf6b('0x2a')},{'key':_0xdf6b('0x2b'),'value':encodeURIComponent(_0x189bd8)},{'key':_0xdf6b('0x2c'),'value':_0x874e8a},{'key':_0xdf6b('0x2d'),'value':_0x1b32b0},{'key':'prompt','value':_0xdf6b('0x2e')}];var _0x406cd4=_0x2be47c+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xdf6b('0x16')](_0x116f57,function(_0x4a0d37){return _0x4a0d37['key']+'='+_0x4a0d37[_0xdf6b('0x2f')];})[_0xdf6b('0x30')]('&');_0x5c35d8['oauth2Claims']={'issuer':_0x2be47c[_0xdf6b('0x1c')](_0xdf6b('0x31'),''),'audience':_0x5c35d8[_0xdf6b('0x26')],'state':_0x874e8a,'nonce':_0x1b32b0};redis[_0xdf6b('0x32')](_0x874e8a,JSON[_0xdf6b('0x22')](_0x5c35d8));return _0x406cd4;}function isValidIdToken(_0x38af50,_0x50992c){try{var _0x5a36e5=jwt['decode'](_0x38af50,{'complete':!![]});var _0x5f40bc=_0x5a36e5['payload'];if(_0x5f40bc[_0xdf6b('0x33')]!==_0x50992c[_0xdf6b('0x34')])return![];if(_0x5f40bc[_0xdf6b('0x35')]!==_0x50992c['audience'])return![];if(_0x5f40bc['nonce']!==_0x50992c['nonce'])return![];if(moment()[_0xdf6b('0x36')](moment[_0xdf6b('0x37')](_0x5f40bc[_0xdf6b('0x38')])))return![];return!![];}catch(_0x5f29b3){throw _0x5f29b3;}}function refreshOauth2MicrosoftAccessToken(_0x2e6fc8){return Promise[_0xdf6b('0x39')]()[_0xdf6b('0x3a')](function(){if(_0x2e6fc8['data3'])return _0x2e6fc8;return db[_0xdf6b('0x3b')][_0xdf6b('0x3c')]({'where':{'id':_0x2e6fc8['id']},'raw':!![]});})[_0xdf6b('0x3a')](function(_0x2f3bd4){var _0x1fede0={'grant_type':_0xdf6b('0x3d'),'refresh_token':_0x2f3bd4['data6'],'scope':getAccessTokenScope(_0x2f3bd4),'redirect_uri':_0x2f3bd4[_0xdf6b('0x29')],'client_id':_0x2f3bd4[_0xdf6b('0x26')],'client_secret':encryptor['decryptString'](_0x2f3bd4[_0xdf6b('0x3e')])};var _0x1bf2d5={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xdf6b('0x1c')](_0xdf6b('0x1d'),_0x2f3bd4[_0xdf6b('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1fede0,'json':!![]};return rp(_0x1bf2d5);})['then'](function(_0x5a0671){_0x2e6fc8['data5']=_0x5a0671['access_token'];_0x2e6fc8[_0xdf6b('0x3f')]=_0x5a0671[_0xdf6b('0x3d')];return db[_0xdf6b('0x3b')]['update']({'data5':_0x2e6fc8['data5'],'data6':_0x2e6fc8[_0xdf6b('0x3f')]},{'where':{'id':_0x2e6fc8['id']}});})[_0xdf6b('0x3a')](function(){return _0x2e6fc8;})[_0xdf6b('0x40')](function(_0x124111){logger[_0xdf6b('0x41')](_0xdf6b('0x42'),_0x2e6fc8['id'],_0x124111);});}function getOauth2MicrosoftAccessToken(_0x465783,_0x62a94a){var _0x9d6758={'grant_type':_0xdf6b('0x43'),'code':_0x465783,'scope':getAccessTokenScope(_0x62a94a),'redirect_uri':_0x62a94a['data4'],'client_id':_0x62a94a[_0xdf6b('0x26')],'client_secret':encryptor[_0xdf6b('0x44')](_0x62a94a['data3'])};var _0x3730ab={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0xdf6b('0x1d'),_0x62a94a[_0xdf6b('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x9d6758,'json':!![]};return rp(_0x3730ab);}function startRefreshInterval(_0x3c75b1){var _0x4f4a83=schedule['intervals'];if(_0x4f4a83[_0x3c75b1['id']])clearInterval(_0x4f4a83[_0x3c75b1['id']]);_0x4f4a83[_0x3c75b1['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xdf6b('0x45')](this,{'id':_0x3c75b1['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xdf6b('0x46')]=_0x4f4a83;}function startAllRefreshIntervals(){return db[_0xdf6b('0x3b')][_0xdf6b('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x18ba62){var _0x222eb5=_0x18ba62[_0xdf6b('0x16')](function(_0x5731f6){return refreshOauth2MicrosoftAccessToken(_0x5731f6)[_0xdf6b('0x3a')](function(_0x1c5966){startRefreshInterval(_0x1c5966);});});return Promise[_0xdf6b('0x48')](_0x222eb5);})[_0xdf6b('0x40')](function(_0x18daeb){var _0x281acf=_0x18daeb?util[_0xdf6b('0x49')](_0x18daeb,{'showHidden':![],'depth':null}):'';logger[_0xdf6b('0x41')](_0xdf6b('0x4a'),_0x281acf);});}module[_0xdf6b('0x4b')]={'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 a7098c1..30970b7 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 _0xf567=['error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x214d89,_0x45e82e){var _0x3451dd=function(_0x4db85e){while(--_0x4db85e){_0x214d89['push'](_0x214d89['shift']());}};_0x3451dd(++_0x45e82e);}(_0xf567,0x118));var _0x7f56=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf567[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7f56('0x0'));var util=require(_0x7f56('0x1'));var moment=require(_0x7f56('0x2'));var BPromise=require('bluebird');var rs=require(_0x7f56('0x3'));var fs=require('fs');var Redis=require(_0x7f56('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f56('0x5'));var logger=require(_0x7f56('0x6'))(_0x7f56('0x7'));var config=require(_0x7f56('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7f56('0x9')][_0x7f56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1215e3,_0x52959a,_0x3f7ad5){return new BPromise(function(_0x2eaed8,_0x22d94e){return client[_0x7f56('0xb')](_0x1215e3,_0x3f7ad5)[_0x7f56('0xc')](function(_0x3ad7d5){logger[_0x7f56('0xd')](_0x7f56('0xe'),_0x52959a,_0x7f56('0xf'));logger[_0x7f56('0x10')](_0x7f56('0x11'),_0x52959a,_0x7f56('0xf'),JSON[_0x7f56('0x12')](_0x3ad7d5));if(_0x3ad7d5[_0x7f56('0x13')]){if(_0x3ad7d5[_0x7f56('0x13')][_0x7f56('0x14')]===0x1f4){logger[_0x7f56('0x13')](_0x7f56('0xe'),_0x52959a,_0x3ad7d5[_0x7f56('0x13')][_0x7f56('0x15')]);return _0x22d94e(_0x3ad7d5[_0x7f56('0x13')][_0x7f56('0x15')]);}logger['error'](_0x7f56('0xe'),_0x52959a,_0x3ad7d5[_0x7f56('0x13')][_0x7f56('0x15')]);return _0x2eaed8(_0x3ad7d5['error'][_0x7f56('0x15')]);}else{logger[_0x7f56('0xd')]('CloudProvider,\x20%s,\x20%s',_0x52959a,_0x7f56('0xf'));_0x2eaed8(_0x3ad7d5[_0x7f56('0x16')]['message']);}})['catch'](function(_0x1dee75){logger['error'](_0x7f56('0xe'),_0x52959a,_0x1dee75);_0x22d94e(_0x1dee75);});});} \ No newline at end of file +var _0xcbde=['http','request','then','CloudProvider,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x2a18c3,_0x17c9ee){var _0xa9db85=function(_0x592284){while(--_0x592284){_0x2a18c3['push'](_0x2a18c3['shift']());}};_0xa9db85(++_0x17c9ee);}(_0xcbde,0x141));var _0xecbd=function(_0x3b91ca,_0x499085){_0x3b91ca=_0x3b91ca-0x0;var _0x3ab8e7=_0xcbde[_0x3b91ca];return _0x3ab8e7;};'use strict';var _=require(_0xecbd('0x0'));var util=require('util');var moment=require(_0xecbd('0x1'));var BPromise=require(_0xecbd('0x2'));var rs=require(_0xecbd('0x3'));var fs=require('fs');var Redis=require(_0xecbd('0x4'));var db=require(_0xecbd('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xecbd('0x6'));var config=require(_0xecbd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xecbd('0x8')][_0xecbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x545ca6,_0x5d1ba5,_0x2947a0){return new BPromise(function(_0x3e9e7a,_0x2f3b03){return client[_0xecbd('0xa')](_0x545ca6,_0x2947a0)[_0xecbd('0xb')](function(_0x43a04e){logger['info'](_0xecbd('0xc'),_0x5d1ba5,'request\x20sent');logger[_0xecbd('0xd')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5d1ba5,'request\x20sent',JSON[_0xecbd('0xe')](_0x43a04e));if(_0x43a04e['error']){if(_0x43a04e[_0xecbd('0xf')][_0xecbd('0x10')]===0x1f4){logger['error'](_0xecbd('0xc'),_0x5d1ba5,_0x43a04e[_0xecbd('0xf')][_0xecbd('0x11')]);return _0x2f3b03(_0x43a04e[_0xecbd('0xf')][_0xecbd('0x11')]);}logger[_0xecbd('0xf')](_0xecbd('0xc'),_0x5d1ba5,_0x43a04e[_0xecbd('0xf')][_0xecbd('0x11')]);return _0x3e9e7a(_0x43a04e['error'][_0xecbd('0x11')]);}else{logger[_0xecbd('0x12')](_0xecbd('0xc'),_0x5d1ba5,_0xecbd('0x13'));_0x3e9e7a(_0x43a04e[_0xecbd('0x14')][_0xecbd('0x11')]);}})[_0xecbd('0x15')](function(_0x1af064){logger[_0xecbd('0xf')](_0xecbd('0xc'),_0x5d1ba5,_0x1af064);_0x2f3b03(_0x1af064);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 629456e..2a91780 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 _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(_0x2f17a4,_0x32b017){var _0x4b0755=function(_0x399909){while(--_0x399909){_0x2f17a4['push'](_0x2f17a4['shift']());}};_0x4b0755(++_0x32b017);}(_0x2ef3,0xba));var _0x32ef=function(_0x2050c5,_0x52ecee){_0x2050c5=_0x2050c5-0x0;var _0x28d1b8=_0x2ef3[_0x2050c5];return _0x28d1b8;};'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 +var _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x5d063b,_0x3e229a){var _0x342fe8=function(_0x575db6){while(--_0x575db6){_0x5d063b['push'](_0x5d063b['shift']());}};_0x342fe8(++_0x3e229a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'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')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 611ad7d..dd4f9cb 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 _0x3fe1=['STRING','name','exports'];(function(_0x38cc81,_0x5c4e6d){var _0x5c86a8=function(_0x5bc105){while(--_0x5bc105){_0x38cc81['push'](_0x38cc81['shift']());}};_0x5c86a8(++_0x5c4e6d);}(_0x3fe1,0x89));var _0x13fe=function(_0x26d173,_0x5d93f4){_0x26d173=_0x26d173-0x0;var _0x5efd81=_0x3fe1[_0x26d173];return _0x5efd81;};'use strict';var Sequelize=require('sequelize');module[_0x13fe('0x0')]={'name':{'type':Sequelize[_0x13fe('0x1')],'unique':_0x13fe('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x13fe('0x1')]},'companyId':{'type':Sequelize[_0x13fe('0x1')]},'website':{'type':Sequelize[_0x13fe('0x1')]},'phone':{'type':Sequelize[_0x13fe('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x13fe('0x1')]},'street':{'type':Sequelize[_0x13fe('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x13fe('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x13fe('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x13fe('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x13fe('0x1')]},'sCountry':{'type':Sequelize[_0x13fe('0x1')]},'description':{'type':Sequelize[_0x13fe('0x1')]}}; \ No newline at end of file +var _0xbfd1=['name','STRING','exports'];(function(_0x4b1573,_0x746985){var _0x3ca77d=function(_0x53869d){while(--_0x53869d){_0x4b1573['push'](_0x4b1573['shift']());}};_0x3ca77d(++_0x746985);}(_0xbfd1,0x1b5));var _0x1bfd=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbfd1[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0x1bfd('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x1bfd('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1bfd('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x1bfd('0x2')]},'phone':{'type':Sequelize[_0x1bfd('0x2')]},'fax':{'type':Sequelize[_0x1bfd('0x2')]},'type':{'type':Sequelize[_0x1bfd('0x2')]},'street':{'type':Sequelize[_0x1bfd('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1bfd('0x2')]},'country':{'type':Sequelize[_0x1bfd('0x2')]},'email':{'type':Sequelize[_0x1bfd('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1bfd('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x1bfd('0x2')]},'sCity':{'type':Sequelize[_0x1bfd('0x2')]},'sCountry':{'type':Sequelize[_0x1bfd('0x2')]},'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 4740a4d..f578923 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 _0x6acc=['lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','get','Companies','UserProfileResource','destroy','name','send','index','CmCompany','describe','model','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','map','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','ids','omit','getContacts','findOne','CmContact','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x6acc,0xa9));var _0xc6ac=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x6acc[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require(_0xc6ac('0x0'));var rimraf=require(_0xc6ac('0x1'));var zipdir=require(_0xc6ac('0x2'));var jsonpatch=require(_0xc6ac('0x3'));var rp=require(_0xc6ac('0x4'));var moment=require(_0xc6ac('0x5'));var BPromise=require(_0xc6ac('0x6'));var Mustache=require(_0xc6ac('0x7'));var util=require('util');var path=require(_0xc6ac('0x8'));var sox=require('sox');var csv=require(_0xc6ac('0x9'));var ejs=require(_0xc6ac('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6ac('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc6ac('0xc'));var deskjs=require(_0xc6ac('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc6ac('0xe'));var Papa=require(_0xc6ac('0xf'));var Redis=require(_0xc6ac('0x10'));var authService=require(_0xc6ac('0x11'));var qs=require(_0xc6ac('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6ac('0x13'));var logger=require(_0xc6ac('0x14'))(_0xc6ac('0x15'));var utils=require(_0xc6ac('0x16'));var config=require(_0xc6ac('0x17'));var licenseUtil=require(_0xc6ac('0x18'));var db=require(_0xc6ac('0x19'))['db'];function respondWithStatusCode(_0x29f7d7,_0x5bead4){_0x5bead4=_0x5bead4||0xcc;return function(_0x5f1299){if(_0x5f1299){return _0x29f7d7[_0xc6ac('0x1a')](_0x5bead4);}return _0x29f7d7[_0xc6ac('0x1b')](_0x5bead4)[_0xc6ac('0x1c')]();};}function respondWithResult(_0x5575ea,_0x22d783){_0x22d783=_0x22d783||0xc8;return function(_0x45ead3){if(_0x45ead3){return _0x5575ea['status'](_0x22d783)[_0xc6ac('0x1d')](_0x45ead3);}};}function respondWithFilteredResult(_0x4784be,_0x436999){return function(_0x40fb67){if(_0x40fb67){var _0x968f7=typeof _0x436999[_0xc6ac('0x1e')]===_0xc6ac('0x1f')&&typeof _0x436999[_0xc6ac('0x20')]===_0xc6ac('0x1f');var _0x467c57=_0x40fb67['count'];var _0x1336c2=_0x968f7?0x0:_0x436999['offset'];var _0x24d7e6=_0x968f7?_0x40fb67[_0xc6ac('0x21')]:_0x436999[_0xc6ac('0x1e')]+_0x436999['limit'];var _0x76eb9e;if(_0x24d7e6>=_0x467c57){_0x24d7e6=_0x467c57;_0x76eb9e=0xc8;}else{_0x76eb9e=0xce;}_0x4784be[_0xc6ac('0x1b')](_0x76eb9e);return _0x4784be['set'](_0xc6ac('0x22'),_0x1336c2+'-'+_0x24d7e6+'/'+_0x467c57)[_0xc6ac('0x1d')](_0x40fb67);}return null;};}function patchUpdates(_0x646ef4){return function(_0x4d9042){try{jsonpatch[_0xc6ac('0x23')](_0x4d9042,_0x646ef4,!![]);}catch(_0x495712){return BPromise['reject'](_0x495712);}return _0x4d9042[_0xc6ac('0x24')]();};}function saveUpdates(_0x565e57,_0x147040){return function(_0x532a97){if(_0x532a97){return _0x532a97['update'](_0x565e57)[_0xc6ac('0x25')](function(_0x5b5e37){return _0x5b5e37;});}return null;};}function removeEntity(_0x541c61,_0x5d25f8){return function(_0x16cf5b){if(_0x16cf5b){return _0x16cf5b['destroy']()[_0xc6ac('0x25')](function(){var _0x1f8e53=_0x16cf5b[_0xc6ac('0x26')]({'plain':!![]});var _0xccdab1=_0xc6ac('0x27');return db[_0xc6ac('0x28')][_0xc6ac('0x29')]({'where':{'type':_0xccdab1,'resourceId':_0x1f8e53['id']}})['then'](function(){return _0x16cf5b;});})[_0xc6ac('0x25')](function(){_0x541c61[_0xc6ac('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55ef93,_0x4bcbc5){return function(_0xf58d54){if(!_0xf58d54){_0x55ef93['sendStatus'](0x194);}return _0xf58d54;};}function handleError(_0x508f33,_0x229892){_0x229892=_0x229892||0x1f4;return function(_0x4b05dd){logger['error'](_0x4b05dd['stack']);if(_0x4b05dd[_0xc6ac('0x2a')]){delete _0x4b05dd[_0xc6ac('0x2a')];}_0x508f33['status'](_0x229892)[_0xc6ac('0x2b')](_0x4b05dd);};}exports[_0xc6ac('0x2c')]=function(_0x19d957,_0x42a29b){var _0x19bf13={},_0x4fb4f2={},_0x34b86={'count':0x0,'rows':[]};return db[_0xc6ac('0x2d')][_0xc6ac('0x2e')]()[_0xc6ac('0x25')](function(_0x5be943){_0x4fb4f2[_0xc6ac('0x2f')]=_['keys'](_0x5be943);_0x4fb4f2[_0xc6ac('0x30')]=_['keys'](_0x19d957[_0xc6ac('0x30')]);_0x4fb4f2[_0xc6ac('0x31')]=_[_0xc6ac('0x32')](_0x4fb4f2[_0xc6ac('0x2f')],_0x4fb4f2['query']);_0x19bf13[_0xc6ac('0x33')]=_[_0xc6ac('0x32')](_0x4fb4f2[_0xc6ac('0x2f')],qs['fields'](_0x19d957[_0xc6ac('0x30')][_0xc6ac('0x34')]));_0x19bf13['attributes']=_0x19bf13['attributes'][_0xc6ac('0x35')]?_0x19bf13[_0xc6ac('0x33')]:_0x4fb4f2['model'];if(!_0x19d957['query']['hasOwnProperty']('nolimit')){_0x19bf13[_0xc6ac('0x20')]=qs[_0xc6ac('0x20')](_0x19d957[_0xc6ac('0x30')][_0xc6ac('0x20')]);_0x19bf13[_0xc6ac('0x1e')]=qs[_0xc6ac('0x1e')](_0x19d957[_0xc6ac('0x30')][_0xc6ac('0x1e')]);}_0x19bf13[_0xc6ac('0x36')]=qs['sort'](_0x19d957['query'][_0xc6ac('0x37')]);_0x19bf13['where']=qs[_0xc6ac('0x31')](_[_0xc6ac('0x38')](_0x19d957['query'],_0x4fb4f2[_0xc6ac('0x31')]),_0x5be943);if(_0x19d957[_0xc6ac('0x30')][_0xc6ac('0x39')]){_0x19bf13[_0xc6ac('0x3a')]=_[_0xc6ac('0x3b')](_0x19bf13[_0xc6ac('0x3a')],{'$or':_[_0xc6ac('0x3c')](_0x19bf13[_0xc6ac('0x33')],function(_0x5a6c85){var _0x1c1b29={};_0x1c1b29[_0x5a6c85]={'$like':'%'+_0x19d957[_0xc6ac('0x30')][_0xc6ac('0x39')]+'%'};return _0x1c1b29;})});}_0x19bf13=_[_0xc6ac('0x3b')]({},_0x19bf13,_0x19d957[_0xc6ac('0x3d')]);var _0x2ce522={'where':_0x19bf13[_0xc6ac('0x3a')]};return db[_0xc6ac('0x2d')]['count'](_0x2ce522)[_0xc6ac('0x25')](function(_0x5f1d3c){_0x34b86[_0xc6ac('0x21')]=_0x5f1d3c;if(_0x19d957[_0xc6ac('0x30')][_0xc6ac('0x3e')]){_0x19bf13[_0xc6ac('0x3f')]=[{'all':!![]}];}return db[_0xc6ac('0x2d')][_0xc6ac('0x40')](_0x19bf13);})[_0xc6ac('0x25')](function(_0x3d8ff5){_0x34b86[_0xc6ac('0x41')]=_0x3d8ff5;return _0x34b86;})[_0xc6ac('0x25')](respondWithFilteredResult(_0x42a29b,_0x19bf13))[_0xc6ac('0x42')](handleError(_0x42a29b,null));})[_0xc6ac('0x42')](handleError(_0x42a29b,null));};exports[_0xc6ac('0x43')]=function(_0xb7469d,_0x2f7806){var _0x1e5b32={'raw':![],'where':{'id':_0xb7469d['params']['id']}},_0x2268aa={};_0x2268aa[_0xc6ac('0x2f')]=_['keys'](db[_0xc6ac('0x2d')][_0xc6ac('0x44')]);_0x2268aa[_0xc6ac('0x30')]=_[_0xc6ac('0x45')](_0xb7469d[_0xc6ac('0x30')]);_0x2268aa['filters']=_[_0xc6ac('0x32')](_0x2268aa[_0xc6ac('0x2f')],_0x2268aa['query']);_0x1e5b32[_0xc6ac('0x33')]=_[_0xc6ac('0x32')](_0x2268aa[_0xc6ac('0x2f')],qs[_0xc6ac('0x34')](_0xb7469d[_0xc6ac('0x30')][_0xc6ac('0x34')]));_0x1e5b32[_0xc6ac('0x33')]=_0x1e5b32[_0xc6ac('0x33')][_0xc6ac('0x35')]?_0x1e5b32[_0xc6ac('0x33')]:_0x2268aa[_0xc6ac('0x2f')];if(_0xb7469d['query'][_0xc6ac('0x3e')]){_0x1e5b32[_0xc6ac('0x3f')]=[{'all':!![]}];}_0x1e5b32=_[_0xc6ac('0x3b')]({},_0x1e5b32,_0xb7469d[_0xc6ac('0x3d')]);return db[_0xc6ac('0x2d')][_0xc6ac('0x46')](_0x1e5b32)[_0xc6ac('0x25')](handleEntityNotFound(_0x2f7806,null))[_0xc6ac('0x25')](respondWithResult(_0x2f7806,null))[_0xc6ac('0x42')](handleError(_0x2f7806,null));};exports[_0xc6ac('0x47')]=function(_0x4f7eac,_0x15ad67){return db['CmCompany'][_0xc6ac('0x47')](_0x4f7eac[_0xc6ac('0x48')],{})[_0xc6ac('0x25')](function(_0xb91afe){var _0x3d2242=_0x4f7eac[_0xc6ac('0x49')][_0xc6ac('0x26')]({'plain':!![]});if(!_0x3d2242)throw new Error(_0xc6ac('0x4a'));if(_0x3d2242[_0xc6ac('0x4b')]==='user'){var _0x37fd5a=_0xb91afe['get']({'plain':!![]});var _0x1f49a2=_0xc6ac('0x27');return db[_0xc6ac('0x4c')][_0xc6ac('0x46')]({'where':{'name':_0x1f49a2,'userProfileId':_0x3d2242[_0xc6ac('0x4d')]},'raw':!![]})[_0xc6ac('0x25')](function(_0xa5884c){if(_0xa5884c&&_0xa5884c[_0xc6ac('0x4e')]===0x0){return db['UserProfileResource'][_0xc6ac('0x47')]({'name':_0x37fd5a[_0xc6ac('0x2a')],'resourceId':_0x37fd5a['id'],'type':_0xa5884c[_0xc6ac('0x2a')],'sectionId':_0xa5884c['id']},{})['then'](function(){return _0xb91afe;});}else{return _0xb91afe;}})[_0xc6ac('0x42')](function(_0x5bdc9f){logger[_0xc6ac('0x4f')](_0xc6ac('0x50'),_0x5bdc9f);throw _0x5bdc9f;});}return _0xb91afe;})[_0xc6ac('0x25')](respondWithResult(_0x15ad67,0xc9))[_0xc6ac('0x42')](handleError(_0x15ad67,null));};exports['update']=function(_0x5f4138,_0x26924f){if(_0x5f4138[_0xc6ac('0x48')]['id']){delete _0x5f4138[_0xc6ac('0x48')]['id'];}return db['CmCompany'][_0xc6ac('0x46')]({'where':{'id':_0x5f4138[_0xc6ac('0x51')]['id']}})[_0xc6ac('0x25')](handleEntityNotFound(_0x26924f,null))[_0xc6ac('0x25')](saveUpdates(_0x5f4138['body'],null))[_0xc6ac('0x25')](respondWithResult(_0x26924f,null))[_0xc6ac('0x42')](handleError(_0x26924f,null));};exports[_0xc6ac('0x29')]=function(_0x185182,_0x2887cb){return db['CmCompany'][_0xc6ac('0x46')]({'where':{'id':_0x185182[_0xc6ac('0x51')]['id']}})[_0xc6ac('0x25')](handleEntityNotFound(_0x2887cb,null))[_0xc6ac('0x25')](removeEntity(_0x2887cb,null))[_0xc6ac('0x42')](handleError(_0x2887cb,null));};exports[_0xc6ac('0x2e')]=function(_0x92b4a1,_0x1e37d0){return db[_0xc6ac('0x2d')][_0xc6ac('0x2e')]()[_0xc6ac('0x25')](respondWithResult(_0x1e37d0,null))[_0xc6ac('0x42')](handleError(_0x1e37d0,null));};exports[_0xc6ac('0x52')]=function(_0x4c1c1f,_0x132dcb,_0x3ddd3d){return db['CmContact'][_0xc6ac('0x46')]({'where':{'id':_0x4c1c1f[_0xc6ac('0x51')]['id']}})[_0xc6ac('0x25')](handleEntityNotFound(_0x132dcb,null))[_0xc6ac('0x25')](function(_0x390fa1){if(_0x390fa1){return _0x390fa1[_0xc6ac('0x52')](_0x4c1c1f[_0xc6ac('0x48')][_0xc6ac('0x53')],_[_0xc6ac('0x54')](_0x4c1c1f['body'],[_0xc6ac('0x53'),'id'])||{});}})[_0xc6ac('0x25')](respondWithResult(_0x132dcb,null))['catch'](handleError(_0x132dcb,null));};exports[_0xc6ac('0x55')]=function(_0x19388b,_0x4b690f,_0x1d3794){var _0x5ddb2e={};var _0x1cd6ec={};var _0x2ea640;var _0x8a4c31;return db[_0xc6ac('0x2d')][_0xc6ac('0x56')]({'where':{'id':_0x19388b[_0xc6ac('0x51')]['id']}})[_0xc6ac('0x25')](handleEntityNotFound(_0x4b690f,null))[_0xc6ac('0x25')](function(_0x131aa3){if(_0x131aa3){_0x2ea640=_0x131aa3;_0x1cd6ec[_0xc6ac('0x2f')]=_[_0xc6ac('0x45')](db[_0xc6ac('0x57')][_0xc6ac('0x44')]);_0x1cd6ec[_0xc6ac('0x30')]=_['keys'](_0x19388b['query']);_0x1cd6ec[_0xc6ac('0x31')]=_[_0xc6ac('0x32')](_0x1cd6ec[_0xc6ac('0x2f')],_0x1cd6ec[_0xc6ac('0x30')]);_0x5ddb2e[_0xc6ac('0x33')]=_[_0xc6ac('0x32')](_0x1cd6ec['model'],qs[_0xc6ac('0x34')](_0x19388b[_0xc6ac('0x30')][_0xc6ac('0x34')]));_0x5ddb2e['attributes']=_0x5ddb2e[_0xc6ac('0x33')][_0xc6ac('0x35')]?_0x5ddb2e[_0xc6ac('0x33')]:_0x1cd6ec[_0xc6ac('0x2f')];_0x5ddb2e['order']=qs['sort'](_0x19388b[_0xc6ac('0x30')][_0xc6ac('0x37')]);_0x5ddb2e[_0xc6ac('0x3a')]=qs['filters'](_[_0xc6ac('0x38')](_0x19388b[_0xc6ac('0x30')],_0x1cd6ec[_0xc6ac('0x31')]));if(_0x19388b[_0xc6ac('0x30')]['filter']){_0x5ddb2e[_0xc6ac('0x3a')]=_[_0xc6ac('0x3b')](_0x5ddb2e[_0xc6ac('0x3a')],{'$or':_[_0xc6ac('0x3c')](_0x5ddb2e['attributes'],function(_0x5e8608){var _0x5eb6e3={};_0x5eb6e3[_0x5e8608]={'$like':'%'+_0x19388b[_0xc6ac('0x30')][_0xc6ac('0x39')]+'%'};return _0x5eb6e3;})});}_0x5ddb2e=_[_0xc6ac('0x3b')]({},_0x5ddb2e,_0x19388b[_0xc6ac('0x3d')]);return _0x2ea640[_0xc6ac('0x55')](_0x5ddb2e);}})[_0xc6ac('0x25')](function(_0x1e2346){if(_0x1e2346){_0x8a4c31=_0x1e2346[_0xc6ac('0x35')];if(!_0x19388b[_0xc6ac('0x30')][_0xc6ac('0x58')](_0xc6ac('0x59'))){_0x5ddb2e[_0xc6ac('0x20')]=qs[_0xc6ac('0x20')](_0x19388b[_0xc6ac('0x30')][_0xc6ac('0x20')]);_0x5ddb2e[_0xc6ac('0x1e')]=qs[_0xc6ac('0x1e')](_0x19388b[_0xc6ac('0x30')][_0xc6ac('0x1e')]);}return _0x2ea640[_0xc6ac('0x55')](_0x5ddb2e);}})[_0xc6ac('0x25')](function(_0x43b51a){if(_0x43b51a){return _0x43b51a?{'count':_0x8a4c31,'rows':_0x43b51a}:null;}})[_0xc6ac('0x25')](respondWithResult(_0x4b690f,null))[_0xc6ac('0x42')](handleError(_0x4b690f,null));}; \ No newline at end of file +var _0x9b4b=['findAll','rows','catch','show','rawAttributes','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addContacts','CmContact','ids','getContacts','nolimit','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','get','Companies','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','CmCompany','describe','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filters','map','filter','merge','options'];(function(_0x501a13,_0x1bd9dc){var _0x567430=function(_0x3aad95){while(--_0x3aad95){_0x501a13['push'](_0x501a13['shift']());}};_0x567430(++_0x1bd9dc);}(_0x9b4b,0x154));var _0xb9b4=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0x9b4b[_0x10791d];return _0x1b4f9c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb9b4('0x0'));var Mustache=require(_0xb9b4('0x1'));var util=require(_0xb9b4('0x2'));var path=require(_0xb9b4('0x3'));var sox=require(_0xb9b4('0x4'));var csv=require(_0xb9b4('0x5'));var ejs=require(_0xb9b4('0x6'));var fs=require('fs');var fs_extra=require(_0xb9b4('0x7'));var _=require(_0xb9b4('0x8'));var squel=require(_0xb9b4('0x9'));var crypto=require(_0xb9b4('0xa'));var jsforce=require(_0xb9b4('0xb'));var deskjs=require(_0xb9b4('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb9b4('0xd'));var Redis=require(_0xb9b4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb9b4('0xf'));var as=require(_0xb9b4('0x10'));var hardwareService=require(_0xb9b4('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xb9b4('0x12'));var config=require(_0xb9b4('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e3de6,_0x536e1d){_0x536e1d=_0x536e1d||0xcc;return function(_0x32ec76){if(_0x32ec76){return _0x4e3de6['sendStatus'](_0x536e1d);}return _0x4e3de6[_0xb9b4('0x14')](_0x536e1d)['end']();};}function respondWithResult(_0xbcc604,_0x5a488e){_0x5a488e=_0x5a488e||0xc8;return function(_0x40c2b8){if(_0x40c2b8){return _0xbcc604['status'](_0x5a488e)[_0xb9b4('0x15')](_0x40c2b8);}};}function respondWithFilteredResult(_0x2773e2,_0x17774a){return function(_0x2ffc02){if(_0x2ffc02){var _0x47cf22=typeof _0x17774a['offset']==='undefined'&&typeof _0x17774a[_0xb9b4('0x16')]===_0xb9b4('0x17');var _0x5f0e62=_0x2ffc02[_0xb9b4('0x18')];var _0x2865c3=_0x47cf22?0x0:_0x17774a[_0xb9b4('0x19')];var _0x3234b9=_0x47cf22?_0x2ffc02[_0xb9b4('0x18')]:_0x17774a[_0xb9b4('0x19')]+_0x17774a[_0xb9b4('0x16')];var _0x2047dc;if(_0x3234b9>=_0x5f0e62){_0x3234b9=_0x5f0e62;_0x2047dc=0xc8;}else{_0x2047dc=0xce;}_0x2773e2['status'](_0x2047dc);return _0x2773e2[_0xb9b4('0x1a')]('Content-Range',_0x2865c3+'-'+_0x3234b9+'/'+_0x5f0e62)[_0xb9b4('0x15')](_0x2ffc02);}return null;};}function patchUpdates(_0x55f5d5){return function(_0x3d23a8){try{jsonpatch[_0xb9b4('0x1b')](_0x3d23a8,_0x55f5d5,!![]);}catch(_0x38b1a8){return BPromise[_0xb9b4('0x1c')](_0x38b1a8);}return _0x3d23a8[_0xb9b4('0x1d')]();};}function saveUpdates(_0x92d01e,_0x35354a){return function(_0x504d29){if(_0x504d29){return _0x504d29[_0xb9b4('0x1e')](_0x92d01e)[_0xb9b4('0x1f')](function(_0x52605e){return _0x52605e;});}return null;};}function removeEntity(_0x5451c6,_0x365da6){return function(_0x121505){if(_0x121505){return _0x121505['destroy']()['then'](function(){var _0x3c687d=_0x121505[_0xb9b4('0x20')]({'plain':!![]});var _0x487567=_0xb9b4('0x21');return db[_0xb9b4('0x22')][_0xb9b4('0x23')]({'where':{'type':_0x487567,'resourceId':_0x3c687d['id']}})[_0xb9b4('0x1f')](function(){return _0x121505;});})[_0xb9b4('0x1f')](function(){_0x5451c6['status'](0xcc)[_0xb9b4('0x24')]();});}};}function handleEntityNotFound(_0x238b53,_0x1d3307){return function(_0x1afc26){if(!_0x1afc26){_0x238b53[_0xb9b4('0x25')](0x194);}return _0x1afc26;};}function handleError(_0x1ffb5d,_0x1123de){_0x1123de=_0x1123de||0x1f4;return function(_0x4af896){logger[_0xb9b4('0x26')](_0x4af896[_0xb9b4('0x27')]);if(_0x4af896['name']){delete _0x4af896[_0xb9b4('0x28')];}_0x1ffb5d[_0xb9b4('0x14')](_0x1123de)[_0xb9b4('0x29')](_0x4af896);};}exports['index']=function(_0x36a045,_0x400279){var _0xe1b1a1={},_0x13ba16={},_0x189323={'count':0x0,'rows':[]};return db[_0xb9b4('0x2a')][_0xb9b4('0x2b')]()['then'](function(_0x5f1045){_0x13ba16[_0xb9b4('0x2c')]=_['keys'](_0x5f1045);_0x13ba16[_0xb9b4('0x2d')]=_[_0xb9b4('0x2e')](_0x36a045[_0xb9b4('0x2d')]);_0x13ba16['filters']=_['intersection'](_0x13ba16[_0xb9b4('0x2c')],_0x13ba16['query']);_0xe1b1a1['attributes']=_[_0xb9b4('0x2f')](_0x13ba16[_0xb9b4('0x2c')],qs['fields'](_0x36a045[_0xb9b4('0x2d')][_0xb9b4('0x30')]));_0xe1b1a1[_0xb9b4('0x31')]=_0xe1b1a1['attributes'][_0xb9b4('0x32')]?_0xe1b1a1[_0xb9b4('0x31')]:_0x13ba16[_0xb9b4('0x2c')];if(!_0x36a045[_0xb9b4('0x2d')][_0xb9b4('0x33')]('nolimit')){_0xe1b1a1[_0xb9b4('0x16')]=qs['limit'](_0x36a045['query'][_0xb9b4('0x16')]);_0xe1b1a1[_0xb9b4('0x19')]=qs[_0xb9b4('0x19')](_0x36a045[_0xb9b4('0x2d')][_0xb9b4('0x19')]);}_0xe1b1a1['order']=qs[_0xb9b4('0x34')](_0x36a045[_0xb9b4('0x2d')]['sort']);_0xe1b1a1[_0xb9b4('0x35')]=qs['filters'](_[_0xb9b4('0x36')](_0x36a045[_0xb9b4('0x2d')],_0x13ba16[_0xb9b4('0x37')]),_0x5f1045);if(_0x36a045[_0xb9b4('0x2d')]['filter']){_0xe1b1a1[_0xb9b4('0x35')]=_['merge'](_0xe1b1a1[_0xb9b4('0x35')],{'$or':_[_0xb9b4('0x38')](_0xe1b1a1[_0xb9b4('0x31')],function(_0x2a76e5){var _0x555cbf={};_0x555cbf[_0x2a76e5]={'$like':'%'+_0x36a045[_0xb9b4('0x2d')][_0xb9b4('0x39')]+'%'};return _0x555cbf;})});}_0xe1b1a1=_[_0xb9b4('0x3a')]({},_0xe1b1a1,_0x36a045[_0xb9b4('0x3b')]);var _0x2be7f0={'where':_0xe1b1a1[_0xb9b4('0x35')]};return db['CmCompany'][_0xb9b4('0x18')](_0x2be7f0)[_0xb9b4('0x1f')](function(_0x2d23cd){_0x189323[_0xb9b4('0x18')]=_0x2d23cd;if(_0x36a045[_0xb9b4('0x2d')]['includeAll']){_0xe1b1a1['include']=[{'all':!![]}];}return db[_0xb9b4('0x2a')][_0xb9b4('0x3c')](_0xe1b1a1);})['then'](function(_0x5089b1){_0x189323[_0xb9b4('0x3d')]=_0x5089b1;return _0x189323;})[_0xb9b4('0x1f')](respondWithFilteredResult(_0x400279,_0xe1b1a1))[_0xb9b4('0x3e')](handleError(_0x400279,null));})[_0xb9b4('0x3e')](handleError(_0x400279,null));};exports[_0xb9b4('0x3f')]=function(_0x224dd6,_0x4d9158){var _0x2b18d3={'raw':![],'where':{'id':_0x224dd6['params']['id']}},_0xf239db={};_0xf239db[_0xb9b4('0x2c')]=_['keys'](db[_0xb9b4('0x2a')][_0xb9b4('0x40')]);_0xf239db[_0xb9b4('0x2d')]=_[_0xb9b4('0x2e')](_0x224dd6['query']);_0xf239db['filters']=_[_0xb9b4('0x2f')](_0xf239db[_0xb9b4('0x2c')],_0xf239db[_0xb9b4('0x2d')]);_0x2b18d3['attributes']=_['intersection'](_0xf239db[_0xb9b4('0x2c')],qs['fields'](_0x224dd6['query'][_0xb9b4('0x30')]));_0x2b18d3[_0xb9b4('0x31')]=_0x2b18d3['attributes']['length']?_0x2b18d3['attributes']:_0xf239db[_0xb9b4('0x2c')];if(_0x224dd6[_0xb9b4('0x2d')]['includeAll']){_0x2b18d3['include']=[{'all':!![]}];}_0x2b18d3=_[_0xb9b4('0x3a')]({},_0x2b18d3,_0x224dd6[_0xb9b4('0x3b')]);return db[_0xb9b4('0x2a')][_0xb9b4('0x41')](_0x2b18d3)['then'](handleEntityNotFound(_0x4d9158,null))[_0xb9b4('0x1f')](respondWithResult(_0x4d9158,null))[_0xb9b4('0x3e')](handleError(_0x4d9158,null));};exports['create']=function(_0x24f1b1,_0x47591d){return db[_0xb9b4('0x2a')]['create'](_0x24f1b1['body'],{})[_0xb9b4('0x1f')](function(_0x515922){var _0x2db4aa=_0x24f1b1[_0xb9b4('0x42')][_0xb9b4('0x20')]({'plain':!![]});if(!_0x2db4aa)throw new Error(_0xb9b4('0x43'));if(_0x2db4aa[_0xb9b4('0x44')]===_0xb9b4('0x42')){var _0x218d1f=_0x515922[_0xb9b4('0x20')]({'plain':!![]});var _0x2194a4='Companies';return db[_0xb9b4('0x45')][_0xb9b4('0x41')]({'where':{'name':_0x2194a4,'userProfileId':_0x2db4aa[_0xb9b4('0x46')]},'raw':!![]})[_0xb9b4('0x1f')](function(_0x3b1dff){if(_0x3b1dff&&_0x3b1dff['autoAssociation']===0x0){return db[_0xb9b4('0x22')][_0xb9b4('0x47')]({'name':_0x218d1f[_0xb9b4('0x28')],'resourceId':_0x218d1f['id'],'type':_0x3b1dff[_0xb9b4('0x28')],'sectionId':_0x3b1dff['id']},{})['then'](function(){return _0x515922;});}else{return _0x515922;}})[_0xb9b4('0x3e')](function(_0x14d09d){logger['error'](_0xb9b4('0x48'),_0x14d09d);throw _0x14d09d;});}return _0x515922;})['then'](respondWithResult(_0x47591d,0xc9))[_0xb9b4('0x3e')](handleError(_0x47591d,null));};exports[_0xb9b4('0x1e')]=function(_0x224f0a,_0x499e54){if(_0x224f0a[_0xb9b4('0x49')]['id']){delete _0x224f0a[_0xb9b4('0x49')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x224f0a['params']['id']}})['then'](handleEntityNotFound(_0x499e54,null))[_0xb9b4('0x1f')](saveUpdates(_0x224f0a[_0xb9b4('0x49')],null))[_0xb9b4('0x1f')](respondWithResult(_0x499e54,null))[_0xb9b4('0x3e')](handleError(_0x499e54,null));};exports[_0xb9b4('0x23')]=function(_0xf1d689,_0x3ca4d6){return db[_0xb9b4('0x2a')]['find']({'where':{'id':_0xf1d689[_0xb9b4('0x4a')]['id']}})[_0xb9b4('0x1f')](handleEntityNotFound(_0x3ca4d6,null))['then'](removeEntity(_0x3ca4d6,null))[_0xb9b4('0x3e')](handleError(_0x3ca4d6,null));};exports[_0xb9b4('0x2b')]=function(_0x1907f4,_0x349bc8){return db['CmCompany']['describe']()[_0xb9b4('0x1f')](respondWithResult(_0x349bc8,null))[_0xb9b4('0x3e')](handleError(_0x349bc8,null));};exports[_0xb9b4('0x4b')]=function(_0x45987e,_0x2ef6d7,_0x266644){return db[_0xb9b4('0x4c')][_0xb9b4('0x41')]({'where':{'id':_0x45987e[_0xb9b4('0x4a')]['id']}})[_0xb9b4('0x1f')](handleEntityNotFound(_0x2ef6d7,null))[_0xb9b4('0x1f')](function(_0x5d4a90){if(_0x5d4a90){return _0x5d4a90[_0xb9b4('0x4b')](_0x45987e[_0xb9b4('0x49')][_0xb9b4('0x4d')],_['omit'](_0x45987e['body'],[_0xb9b4('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x2ef6d7,null))[_0xb9b4('0x3e')](handleError(_0x2ef6d7,null));};exports[_0xb9b4('0x4e')]=function(_0x4785c0,_0x40f912,_0xd73365){var _0x2fbc3c={};var _0x1f2230={};var _0x97557f;var _0x24a945;return db[_0xb9b4('0x2a')]['findOne']({'where':{'id':_0x4785c0['params']['id']}})[_0xb9b4('0x1f')](handleEntityNotFound(_0x40f912,null))[_0xb9b4('0x1f')](function(_0x4c64d5){if(_0x4c64d5){_0x97557f=_0x4c64d5;_0x1f2230[_0xb9b4('0x2c')]=_[_0xb9b4('0x2e')](db[_0xb9b4('0x4c')][_0xb9b4('0x40')]);_0x1f2230['query']=_[_0xb9b4('0x2e')](_0x4785c0['query']);_0x1f2230[_0xb9b4('0x37')]=_[_0xb9b4('0x2f')](_0x1f2230[_0xb9b4('0x2c')],_0x1f2230[_0xb9b4('0x2d')]);_0x2fbc3c[_0xb9b4('0x31')]=_[_0xb9b4('0x2f')](_0x1f2230[_0xb9b4('0x2c')],qs['fields'](_0x4785c0[_0xb9b4('0x2d')][_0xb9b4('0x30')]));_0x2fbc3c['attributes']=_0x2fbc3c[_0xb9b4('0x31')][_0xb9b4('0x32')]?_0x2fbc3c[_0xb9b4('0x31')]:_0x1f2230[_0xb9b4('0x2c')];_0x2fbc3c['order']=qs[_0xb9b4('0x34')](_0x4785c0[_0xb9b4('0x2d')]['sort']);_0x2fbc3c[_0xb9b4('0x35')]=qs[_0xb9b4('0x37')](_[_0xb9b4('0x36')](_0x4785c0['query'],_0x1f2230[_0xb9b4('0x37')]));if(_0x4785c0[_0xb9b4('0x2d')][_0xb9b4('0x39')]){_0x2fbc3c[_0xb9b4('0x35')]=_['merge'](_0x2fbc3c['where'],{'$or':_[_0xb9b4('0x38')](_0x2fbc3c[_0xb9b4('0x31')],function(_0x200fa6){var _0x584414={};_0x584414[_0x200fa6]={'$like':'%'+_0x4785c0[_0xb9b4('0x2d')]['filter']+'%'};return _0x584414;})});}_0x2fbc3c=_[_0xb9b4('0x3a')]({},_0x2fbc3c,_0x4785c0[_0xb9b4('0x3b')]);return _0x97557f[_0xb9b4('0x4e')](_0x2fbc3c);}})[_0xb9b4('0x1f')](function(_0x43915d){if(_0x43915d){_0x24a945=_0x43915d[_0xb9b4('0x32')];if(!_0x4785c0[_0xb9b4('0x2d')]['hasOwnProperty'](_0xb9b4('0x4f'))){_0x2fbc3c[_0xb9b4('0x16')]=qs['limit'](_0x4785c0[_0xb9b4('0x2d')][_0xb9b4('0x16')]);_0x2fbc3c[_0xb9b4('0x19')]=qs[_0xb9b4('0x19')](_0x4785c0[_0xb9b4('0x2d')][_0xb9b4('0x19')]);}return _0x97557f[_0xb9b4('0x4e')](_0x2fbc3c);}})[_0xb9b4('0x1f')](function(_0x171e9f){if(_0x171e9f){return _0x171e9f?{'count':_0x24a945,'rows':_0x171e9f}:null;}})[_0xb9b4('0x1f')](respondWithResult(_0x40f912,null))[_0xb9b4('0x3e')](handleError(_0x40f912,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index b8e15b2..64fc461 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 _0x455b=['bluebird','path','rimraf','../../config/environment','define','CmCompany','cm_companies','lodash','../../config/logger','api','moment'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x455b,0x1d5));var _0xb455=function(_0x37550d,_0x19ab78){_0x37550d=_0x37550d-0x0;var _0x527aef=_0x455b[_0x37550d];return _0x527aef;};'use strict';var _=require(_0xb455('0x0'));var util=require('util');var logger=require(_0xb455('0x1'))(_0xb455('0x2'));var moment=require(_0xb455('0x3'));var BPromise=require(_0xb455('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb455('0x5'));var rimraf=require(_0xb455('0x6'));var config=require(_0xb455('0x7'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x368385,_0x50246c){return _0x368385[_0xb455('0x8')](_0xb455('0x9'),attributes,{'tableName':_0xb455('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5890=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmCompany','cm_companies','lodash'];(function(_0x45f143,_0x42ba90){var _0x898312=function(_0xe86ac3){while(--_0xe86ac3){_0x45f143['push'](_0x45f143['shift']());}};_0x898312(++_0x42ba90);}(_0x5890,0x15b));var _0x0589=function(_0x3890c3,_0x3ea3ed){_0x3890c3=_0x3890c3-0x0;var _0x1a7d5d=_0x5890[_0x3890c3];return _0x1a7d5d;};'use strict';var _=require(_0x0589('0x0'));var util=require(_0x0589('0x1'));var logger=require(_0x0589('0x2'))('api');var moment=require(_0x0589('0x3'));var BPromise=require(_0x0589('0x4'));var rp=require(_0x0589('0x5'));var fs=require('fs');var path=require(_0x0589('0x6'));var rimraf=require(_0x0589('0x7'));var config=require(_0x0589('0x8'));var attributes=require('./cmCompany.attributes');module[_0x0589('0x9')]=function(_0x224a20,_0xca963c){return _0x224a20['define'](_0x0589('0xa'),attributes,{'tableName':_0x0589('0xb'),'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 8b17fed..e2766e1 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 _0x1a78=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','bluebird','randomstring'];(function(_0xa83023,_0x2ccc21){var _0x557cc0=function(_0xfdf9ad){while(--_0xfdf9ad){_0xa83023['push'](_0xa83023['shift']());}};_0x557cc0(++_0x2ccc21);}(_0x1a78,0x150));var _0x81a7=function(_0x2455dc,_0x7e94f4){_0x2455dc=_0x2455dc-0x0;var _0x25f206=_0x1a78[_0x2455dc];return _0x25f206;};'use strict';var _=require(_0x81a7('0x0'));var util=require(_0x81a7('0x1'));var moment=require('moment');var BPromise=require(_0x81a7('0x2'));var rs=require(_0x81a7('0x3'));var fs=require('fs');var Redis=require(_0x81a7('0x4'));var db=require(_0x81a7('0x5'))['db'];var utils=require(_0x81a7('0x6'));var logger=require(_0x81a7('0x7'))(_0x81a7('0x8'));var config=require(_0x81a7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x81a7('0xa')][_0x81a7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a8914,_0x223894,_0x490b12){return new BPromise(function(_0xf451c4,_0x1532af){return client['request'](_0x1a8914,_0x490b12)['then'](function(_0x3cebde){logger[_0x81a7('0xc')](_0x81a7('0xd'),_0x223894,_0x81a7('0xe'));logger[_0x81a7('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x223894,_0x81a7('0xe'),JSON[_0x81a7('0x10')](_0x3cebde));if(_0x3cebde[_0x81a7('0x11')]){if(_0x3cebde[_0x81a7('0x11')]['code']===0x1f4){logger[_0x81a7('0x11')](_0x81a7('0xd'),_0x223894,_0x3cebde['error']['message']);return _0x1532af(_0x3cebde['error'][_0x81a7('0x12')]);}logger[_0x81a7('0x11')]('CmCompany,\x20%s,\x20%s',_0x223894,_0x3cebde[_0x81a7('0x11')][_0x81a7('0x12')]);return _0xf451c4(_0x3cebde[_0x81a7('0x11')][_0x81a7('0x12')]);}else{logger[_0x81a7('0xc')](_0x81a7('0xd'),_0x223894,_0x81a7('0xe'));_0xf451c4(_0x3cebde[_0x81a7('0x13')][_0x81a7('0x12')]);}})['catch'](function(_0x19e0c8){logger[_0x81a7('0x11')](_0x81a7('0xd'),_0x223894,_0x19e0c8);_0x1532af(_0x19e0c8);});});} \ No newline at end of file +var _0x5533=['debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5533,0x10b));var _0x3553=function(_0x44422c,_0x3916c5){_0x44422c=_0x44422c-0x0;var _0x3963c6=_0x5533[_0x44422c];return _0x3963c6;};'use strict';var _=require('lodash');var util=require(_0x3553('0x0'));var moment=require(_0x3553('0x1'));var BPromise=require(_0x3553('0x2'));var rs=require(_0x3553('0x3'));var fs=require('fs');var Redis=require(_0x3553('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3553('0x5'));var logger=require(_0x3553('0x6'))(_0x3553('0x7'));var config=require(_0x3553('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c6112,_0x11e123,_0x11b6a8){return new BPromise(function(_0x544862,_0x1b6a8e){return client['request'](_0x1c6112,_0x11b6a8)[_0x3553('0x9')](function(_0x2ed1f0){logger[_0x3553('0xa')](_0x3553('0xb'),_0x11e123,_0x3553('0xc'));logger[_0x3553('0xd')](_0x3553('0xe'),_0x11e123,_0x3553('0xc'),JSON[_0x3553('0xf')](_0x2ed1f0));if(_0x2ed1f0[_0x3553('0x10')]){if(_0x2ed1f0[_0x3553('0x10')][_0x3553('0x11')]===0x1f4){logger[_0x3553('0x10')](_0x3553('0xb'),_0x11e123,_0x2ed1f0[_0x3553('0x10')][_0x3553('0x12')]);return _0x1b6a8e(_0x2ed1f0['error'][_0x3553('0x12')]);}logger[_0x3553('0x10')](_0x3553('0xb'),_0x11e123,_0x2ed1f0[_0x3553('0x10')][_0x3553('0x12')]);return _0x544862(_0x2ed1f0['error'][_0x3553('0x12')]);}else{logger[_0x3553('0xa')](_0x3553('0xb'),_0x11e123,'request\x20sent');_0x544862(_0x2ed1f0['result'][_0x3553('0x12')]);}})[_0x3553('0x13')](function(_0x315072){logger[_0x3553('0x10')](_0x3553('0xb'),_0x11e123,_0x315072);_0x1b6a8e(_0x315072);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index a709280..9b317f7 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 _0xc4a1=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','getContacts','post','/:id/contacts','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0xc4a1,0xc0));var _0x1c4a=function(_0xe74d43,_0x5ee3eb){_0xe74d43=_0xe74d43-0x0;var _0x339bdb=_0xc4a1[_0xe74d43];return _0x339bdb;};'use strict';var multer=require('multer');var util=require(_0x1c4a('0x0'));var path=require('path');var timeout=require(_0x1c4a('0x1'));var express=require(_0x1c4a('0x2'));var router=express[_0x1c4a('0x3')]();var fs_extra=require(_0x1c4a('0x4'));var auth=require(_0x1c4a('0x5'));var interaction=require(_0x1c4a('0x6'));var config=require(_0x1c4a('0x7'));var controller=require('./cmCompany.controller');router[_0x1c4a('0x8')]('/',auth[_0x1c4a('0x9')](),controller[_0x1c4a('0xa')]);router[_0x1c4a('0x8')](_0x1c4a('0xb'),auth[_0x1c4a('0x9')](),controller['describe']);router[_0x1c4a('0x8')](_0x1c4a('0xc'),auth[_0x1c4a('0x9')](),controller[_0x1c4a('0xd')]);router[_0x1c4a('0x8')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x1c4a('0xe')]);router[_0x1c4a('0xf')]('/',auth[_0x1c4a('0x9')](),controller['create']);router[_0x1c4a('0xf')](_0x1c4a('0x10'),auth[_0x1c4a('0x9')](),controller['addContacts']);router[_0x1c4a('0x11')]('/:id',auth[_0x1c4a('0x9')](),controller[_0x1c4a('0x12')]);router[_0x1c4a('0x13')](_0x1c4a('0xc'),auth['isAuthenticated'](),controller[_0x1c4a('0x14')]);module[_0x1c4a('0x15')]=router; \ No newline at end of file +var _0x51ac=['isAuthenticated','describe','show','/:id/contacts','getContacts','post','addContacts','put','update','/:id','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe'];(function(_0x2340ab,_0x189b5d){var _0x4b0c47=function(_0x7e7f66){while(--_0x7e7f66){_0x2340ab['push'](_0x2340ab['shift']());}};_0x4b0c47(++_0x189b5d);}(_0x51ac,0xfd));var _0xc51a=function(_0x2f1221,_0x80349a){_0x2f1221=_0x2f1221-0x0;var _0x10d863=_0x51ac[_0x2f1221];return _0x10d863;};'use strict';var multer=require(_0xc51a('0x0'));var util=require(_0xc51a('0x1'));var path=require(_0xc51a('0x2'));var timeout=require('connect-timeout');var express=require(_0xc51a('0x3'));var router=express[_0xc51a('0x4')]();var fs_extra=require(_0xc51a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc51a('0x6'));var config=require(_0xc51a('0x7'));var controller=require('./cmCompany.controller');router[_0xc51a('0x8')]('/',auth['isAuthenticated'](),controller[_0xc51a('0x9')]);router[_0xc51a('0x8')](_0xc51a('0xa'),auth[_0xc51a('0xb')](),controller[_0xc51a('0xc')]);router[_0xc51a('0x8')]('/:id',auth[_0xc51a('0xb')](),controller[_0xc51a('0xd')]);router[_0xc51a('0x8')](_0xc51a('0xe'),auth[_0xc51a('0xb')](),controller[_0xc51a('0xf')]);router[_0xc51a('0x10')]('/',auth[_0xc51a('0xb')](),controller['create']);router[_0xc51a('0x10')](_0xc51a('0xe'),auth[_0xc51a('0xb')](),controller[_0xc51a('0x11')]);router[_0xc51a('0x12')]('/:id',auth[_0xc51a('0xb')](),controller[_0xc51a('0x13')]);router['delete'](_0xc51a('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0xc51a('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 38f9a60..c4e314c 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 _0xb540=['TEXT','INTEGER','DATE','lodash','sequelize','exports','STRING'];(function(_0x390d78,_0x2fccc6){var _0x488767=function(_0xc0e6cf){while(--_0xc0e6cf){_0x390d78['push'](_0x390d78['shift']());}};_0x488767(++_0x2fccc6);}(_0xb540,0x161));var _0x0b54=function(_0x2f0bf4,_0x2060b6){_0x2f0bf4=_0x2f0bf4-0x0;var _0xc1ce60=_0xb540[_0x2f0bf4];return _0xc1ce60;};'use strict';var _=require(_0x0b54('0x0'));var Sequelize=require(_0x0b54('0x1'));module[_0x0b54('0x2')]={'firstName':{'type':Sequelize[_0x0b54('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0b54('0x3')]},'street':{'type':Sequelize[_0x0b54('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x0b54('0x3')]},'country':{'type':Sequelize[_0x0b54('0x3')]},'dateOfBirth':{'type':Sequelize[_0x0b54('0x3')]},'description':{'type':Sequelize[_0x0b54('0x4')]},'phone':{'type':Sequelize[_0x0b54('0x3')]},'mobile':{'type':Sequelize[_0x0b54('0x3')]},'fax':{'type':Sequelize[_0x0b54('0x3')]},'email':{'type':Sequelize[_0x0b54('0x3')]},'url':{'type':Sequelize[_0x0b54('0x3')]},'facebook':{'type':Sequelize[_0x0b54('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x0b54('0x3')]},'skype':{'type':Sequelize[_0x0b54('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x0b54('0x3')]},'line':{'type':Sequelize[_0x0b54('0x3')]},'wechat':{'type':Sequelize[_0x0b54('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x0b54('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x0b54('0x3')]},'priority':{'type':Sequelize[_0x0b54('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0b54('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x0b54('0x3')]},'utcOffset':{'type':Sequelize[_0x0b54('0x5')]}}; \ No newline at end of file +var _0xaff7=['STRING','INTEGER','DATE','NOW','lodash','sequelize'];(function(_0x3f250e,_0x313831){var _0x3aa24c=function(_0x51aeff){while(--_0x51aeff){_0x3f250e['push'](_0x3f250e['shift']());}};_0x3aa24c(++_0x313831);}(_0xaff7,0x18a));var _0x7aff=function(_0x5bd1a9,_0x313714){_0x5bd1a9=_0x5bd1a9-0x0;var _0x2ba345=_0xaff7[_0x5bd1a9];return _0x2ba345;};'use strict';var _=require(_0x7aff('0x0'));var Sequelize=require(_0x7aff('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x7aff('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x7aff('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7aff('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x7aff('0x2')]},'mobile':{'type':Sequelize[_0x7aff('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7aff('0x2')]},'url':{'type':Sequelize[_0x7aff('0x2')]},'facebook':{'type':Sequelize[_0x7aff('0x2')]},'fb_data':{'type':Sequelize[_0x7aff('0x2')]},'twitter':{'type':Sequelize[_0x7aff('0x2')]},'skype':{'type':Sequelize[_0x7aff('0x2')]},'teams':{'type':Sequelize[_0x7aff('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x7aff('0x2')]},'wechat':{'type':Sequelize[_0x7aff('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x7aff('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x7aff('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x7aff('0x4')],'defaultValue':Sequelize[_0x7aff('0x5')]},'dialTimezone':{'type':Sequelize[_0x7aff('0x2')]},'utcOffset':{'type':Sequelize[_0x7aff('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index dbc8ce4..bf1246f 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 _0x8421=['pick','filter','merge','nolimit','setTags','ids','OrderBy','item_types','items','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','ItemType.OrderBy','duplicateAdditionalPhones','toContactId','rescheduleAdditionalPhones','hopperId','findOne','rawAttributes','options','includeAll','include','rows','ContactId','CmHopperFinal','getJscriptySessions','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','join','root','server/files/tmp','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','parse','import','User','No\x20ListId\x20specified','binding','socket_timestamp','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','chat','sms','whatsapp','-createdAt','resolve','includes','channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','fullname','DESC','findAndCountAll','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','Owner','browserName','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','subject','openchannel','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','path','lodash','squel','papaparse','ioredis','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','json','offset','undefined','count','limit','set','Content-Range','then','destroy','end','sendStatus','error','name','send','index','findAll','user','catch','CmContact','find','describe','keys','length','startsWith','columnName','displayName','analytics','CmCustomField','cf_','alias','custom','type','info','hasOwnProperty','body','from','get','mergeWith','isArray','tags','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','all','Tag','Tags','color','query','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','isNil','cf_%d','pickBy','map','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','params','sequelize','text','phone','getTags','model','filters','intersection','attributes','fields','order','sort'];(function(_0x513c59,_0x54a0b8){var _0x1cceff=function(_0x52298f){while(--_0x52298f){_0x513c59['push'](_0x513c59['shift']());}};_0x1cceff(++_0x54a0b8);}(_0x8421,0x164));var _0x1842=function(_0x12704a,_0x51c538){_0x12704a=_0x12704a-0x0;var _0x46e6ee=_0x8421[_0x12704a];return _0x46e6ee;};'use strict';var moment=require(_0x1842('0x0'));var BPromise=require(_0x1842('0x1'));var util=require('util');var path=require(_0x1842('0x2'));var fs=require('fs');var _=require(_0x1842('0x3'));var squel=require(_0x1842('0x4'));var Papa=require(_0x1842('0x5'));var Redis=require(_0x1842('0x6'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require(_0x1842('0x7'))(_0x1842('0x8'));var config=require(_0x1842('0x9'));var shared=require(_0x1842('0xa'));var db=require(_0x1842('0xb'))['db'];config[_0x1842('0xc')]=_[_0x1842('0xd')](config[_0x1842('0xc')],{'host':_0x1842('0xe'),'port':0x18eb});var socket=require(_0x1842('0xf'))(new Redis(config[_0x1842('0xc')]));require('./cmContact.socket')['register'](socket);function respondWithResult(_0x1c6815,_0x462a4a){_0x462a4a=_0x462a4a||0xc8;return function(_0xab5907){if(_0xab5907){return _0x1c6815[_0x1842('0x10')](_0x462a4a)[_0x1842('0x11')](_0xab5907);}};}function respondWithFilteredResult(_0x4951df,_0x9a54d9){return function(_0x5a2ca9){if(_0x5a2ca9){var _0x2dcee5=typeof _0x9a54d9[_0x1842('0x12')]==='undefined'&&typeof _0x9a54d9['limit']===_0x1842('0x13');var _0x49de0a=_0x5a2ca9[_0x1842('0x14')];var _0x4ac6a7=_0x2dcee5?0x0:_0x9a54d9[_0x1842('0x12')];var _0x5b1f8e=_0x2dcee5?_0x5a2ca9[_0x1842('0x14')]:_0x9a54d9[_0x1842('0x12')]+_0x9a54d9[_0x1842('0x15')];var _0x2b0ba1;if(_0x5b1f8e>=_0x49de0a){_0x5b1f8e=_0x49de0a;_0x2b0ba1=0xc8;}else{_0x2b0ba1=0xce;}_0x4951df['status'](_0x2b0ba1);return _0x4951df[_0x1842('0x16')](_0x1842('0x17'),_0x4ac6a7+'-'+_0x5b1f8e+'/'+_0x49de0a)[_0x1842('0x11')](_0x5a2ca9);}return null;};}function saveUpdates(_0x2fe895){return function(_0x30de8a){if(_0x30de8a){return _0x30de8a['update'](_0x2fe895)[_0x1842('0x18')](function(_0x357a91){return _0x357a91;});}return null;};}function removeEntity(_0xd18f54){return function(_0x2f2ed4){if(_0x2f2ed4){return _0x2f2ed4[_0x1842('0x19')]()['then'](function(){_0xd18f54['status'](0xcc)[_0x1842('0x1a')]();});}};}function handleEntityNotFound(_0x5e9e49){return function(_0x47e2f0){if(!_0x47e2f0){_0x5e9e49[_0x1842('0x1b')](0x194);}return _0x47e2f0;};}function handleError(_0x2ff246,_0x3654c2){_0x3654c2=_0x3654c2||0x1f4;return function(_0xd5d75b){logger[_0x1842('0x1c')](_0xd5d75b['stack']);if(_0xd5d75b[_0x1842('0x1d')]){delete _0xd5d75b['name'];}_0x2ff246[_0x1842('0x10')](_0x3654c2)[_0x1842('0x1e')](_0xd5d75b);};}exports[_0x1842('0x1f')]=function(_0x26f408,_0x55aec3){var _0x1fecde={};return contacts['describe']()[_0x1842('0x18')](function(_0x443394){_0x1fecde=qs['getOptions'](_0x443394,_0x26f408);return contacts[_0x1842('0x20')](_0x26f408['query'],_0x26f408[_0x1842('0x21')],_0x1fecde,_0x443394);})[_0x1842('0x18')](respondWithFilteredResult(_0x55aec3,_0x1fecde))[_0x1842('0x22')](handleError(_0x55aec3,null));};exports[_0x1842('0x19')]=function(_0x47b5dc,_0x3a3c1a){return db[_0x1842('0x23')][_0x1842('0x24')]({'where':{'id':_0x47b5dc['params']['id']}})['then'](handleEntityNotFound(_0x3a3c1a,null))[_0x1842('0x18')](removeEntity(_0x3a3c1a,null))[_0x1842('0x22')](handleError(_0x3a3c1a,null));};exports[_0x1842('0x25')]=function(_0x23f21d,_0x49c3fe){return db['CmContact'][_0x1842('0x25')]()[_0x1842('0x18')](function(_0x131800){delete _0x131800['tags'];for(var _0x2777a9=0x0;_0x2777a90x0){return new Promise(function(_0x22b402){var _0x446607=[];for(var _0x3614ec=0x0;_0x3614ec<_0x411515[_0x1842('0x27')];_0x3614ec++){_0x446607['push'](insertAdditionalPhones(_0x411515[_0x3614ec]['contact'],_0x411515[_0x3614ec][_0x1842('0x57')]));}Promise[_0x1842('0x5f')](_0x446607)[_0x1842('0x18')](function(){_0x22b402(0x1);});})[_0x1842('0x18')](function(){return{'success':_0x1a849e,'failure':_0x18923b,'duplicates':_0x2fd642};});}else{return{'success':_0x1a849e,'failure':_0x18923b,'duplicates':_0x2fd642};}}})['then'](respondWithResult(_0x2e5b83,0xc9))[_0x1842('0x22')](handleError(_0x2e5b83,null));};exports['show']=function(_0x1697c0,_0x2bf76d){var _0x438aac;return db[_0x1842('0x23')]['describe']()[_0x1842('0x18')](function(_0x5a8683){return db['CmContact'][_0x1842('0x24')]({'where':{'id':_0x1697c0['params']['id']},'include':[{'model':db[_0x1842('0x60')],'as':_0x1842('0x61'),'attributes':['id','name',_0x1842('0x62')],'required':_0x1697c0[_0x1842('0x63')][_0x1842('0x64')]?!![]:![]},{'model':db[_0x1842('0x48')],'as':_0x1842('0x65'),'where':{'CmContactId':_0x1697c0['params']['id']},'required':![],'include':[{'model':db[_0x1842('0x66')],'as':_0x1842('0x67')}]}],'order':[db['sequelize'][_0x1842('0x68')](_0x1842('0x69'))],'attributes':_[_0x1842('0x26')](_0x5a8683)});})['then'](function(_0x2bc4c2){if(!_['isNil'](_0x2bc4c2)){_0x438aac=_0x2bc4c2['get']({'plain':!![]});var _0x549ed5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2bc4c2&&_0x2bc4c2['ListId']){if(_0x2bc4c2[_0x1842('0x5d')]){_0x549ed5['where'][_0x1842('0x6a')][_0x1842('0x5c')]({'ListId':{'$ne':_0x2bc4c2[_0x1842('0x5d')]}});}}return db[_0x1842('0x2c')]['findAll'](_0x549ed5);}})[_0x1842('0x18')](function(_0x373ea1){if(!_[_0x1842('0x6b')](_0x373ea1)){return _['omit'](_0x438aac,_['map'](_0x373ea1,function(_0x21ae5d){return util['format'](_0x1842('0x6c'),_0x21ae5d['id']);}));}})['then'](handleEntityNotFound(_0x2bf76d,null))[_0x1842('0x18')](respondWithResult(_0x2bf76d,null))[_0x1842('0x22')](handleError(_0x2bf76d,null));};exports[_0x1842('0x3e')]=function(_0xfc9b81,_0x449507){var _0x202e5a;if(_0xfc9b81[_0x1842('0x33')]['id']){delete _0xfc9b81[_0x1842('0x33')]['id'];}if(!_[_0x1842('0x6b')](_0xfc9b81[_0x1842('0x33')][_0x1842('0x54')])){var _0x4b764c=_0xfc9b81[_0x1842('0x33')][_0x1842('0x54')];if(!_[_0x1842('0x6b')](shared['timezones'][_0x4b764c]))_0xfc9b81[_0x1842('0x33')][_0x1842('0x56')]=shared['timezones'][_0x4b764c][_0x1842('0x56')];}return db[_0x1842('0x23')][_0x1842('0x24')]({'where':{'id':_0xfc9b81['params']['id']}})[_0x1842('0x18')](handleEntityNotFound(_0x449507,null))[_0x1842('0x18')](saveUpdates(_0xfc9b81[_0x1842('0x33')],null))[_0x1842('0x18')](function(_0x56e4b0){_0x202e5a=_0x56e4b0;var _0x53c34c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x56e4b0&&_0x56e4b0[_0x1842('0x5d')]){if(_0x56e4b0['ListId']){_0x53c34c['where'][_0x1842('0x6a')][_0x1842('0x5c')]({'ListId':{'$ne':_0x56e4b0[_0x1842('0x5d')]}});}}return db[_0x1842('0x2c')][_0x1842('0x20')](_0x53c34c);})[_0x1842('0x18')](function(_0x34fb52){if(_0x34fb52){return _['omit'](_[_0x1842('0x6d')](_0xfc9b81['body'],function(_0x294b5c,_0x5f5846){return _[_0x1842('0x28')](_0x5f5846,'cf_');}),_[_0x1842('0x6e')](_0x34fb52,function(_0x591abe){return util['format'](_0x1842('0x6c'),_0x591abe['id']);}));}})[_0x1842('0x18')](function(_0x4e70a2){if(_0x4e70a2&&!_[_0x1842('0x6f')](_0x4e70a2)){var _0x151f00=squel[_0x1842('0x3e')]()[_0x1842('0x70')](_0x1842('0x71'))[_0x1842('0x72')](_0x4e70a2)[_0x1842('0x5a')](_0x1842('0x73'),_0xfc9b81[_0x1842('0x74')]['id'])['toParam']();return db[_0x1842('0x75')][_0x1842('0x63')](_0x151f00[_0x1842('0x76')],{'replacements':_0x151f00['values']});}})[_0x1842('0x18')](function(){if(_0xfc9b81[_0x1842('0x33')]['phone']&&_0x202e5a){return db[_0x1842('0x39')][_0x1842('0x3e')]({'phone':_0xfc9b81[_0x1842('0x33')][_0x1842('0x77')],'OrderBy':0x0},{'where':{'ContactId':_0x202e5a['id']}});}})['then'](function(){return _0x202e5a;})['then'](respondWithResult(_0x449507,null))['catch'](handleError(_0x449507,null));};exports[_0x1842('0x78')]=function(_0x2943a0,_0x29b775){var _0x244fd2={};var _0x5472b9={};var _0x3d58c6;var _0x24fa70;return db['CmContact']['findOne']({'where':{'id':_0x2943a0[_0x1842('0x74')]['id']}})[_0x1842('0x18')](handleEntityNotFound(_0x29b775,null))[_0x1842('0x18')](function(_0x20b0ba){if(_0x20b0ba){_0x3d58c6=_0x20b0ba;_0x5472b9[_0x1842('0x79')]=_[_0x1842('0x26')](db[_0x1842('0x60')]['rawAttributes']);_0x5472b9['query']=_[_0x1842('0x26')](_0x2943a0[_0x1842('0x63')]);_0x5472b9[_0x1842('0x7a')]=_[_0x1842('0x7b')](_0x5472b9[_0x1842('0x79')],_0x5472b9['query']);_0x244fd2[_0x1842('0x7c')]=_[_0x1842('0x7b')](_0x5472b9[_0x1842('0x79')],qs['fields'](_0x2943a0['query'][_0x1842('0x7d')]));_0x244fd2[_0x1842('0x7c')]=_0x244fd2[_0x1842('0x7c')][_0x1842('0x27')]?_0x244fd2['attributes']:_0x5472b9[_0x1842('0x79')];_0x244fd2[_0x1842('0x7e')]=qs[_0x1842('0x7f')](_0x2943a0[_0x1842('0x63')]['sort']);_0x244fd2[_0x1842('0x5a')]=qs[_0x1842('0x7a')](_[_0x1842('0x80')](_0x2943a0['query'],_0x5472b9[_0x1842('0x7a')]));if(_0x2943a0[_0x1842('0x63')][_0x1842('0x81')]){_0x244fd2['where']=_[_0x1842('0x82')](_0x244fd2[_0x1842('0x5a')],{'$or':_[_0x1842('0x6e')](_0x244fd2[_0x1842('0x7c')],function(_0x1dfd8f){var _0x1c004b={};_0x1c004b[_0x1dfd8f]={'$like':'%'+_0x2943a0[_0x1842('0x63')][_0x1842('0x81')]+'%'};return _0x1c004b;})});}_0x244fd2=_[_0x1842('0x82')]({},_0x244fd2,_0x2943a0['options']);return _0x3d58c6['getTags'](_0x244fd2);}})['then'](function(_0x243bf3){if(_0x243bf3){_0x24fa70=_0x243bf3[_0x1842('0x27')];if(!_0x2943a0['query'][_0x1842('0x32')](_0x1842('0x83'))){_0x244fd2[_0x1842('0x15')]=qs['limit'](_0x2943a0['query'][_0x1842('0x15')]);_0x244fd2[_0x1842('0x12')]=qs[_0x1842('0x12')](_0x2943a0['query'][_0x1842('0x12')]);}return _0x3d58c6[_0x1842('0x78')](_0x244fd2);}})[_0x1842('0x18')](function(_0x1fcf2c){if(_0x1fcf2c){return _0x1fcf2c?{'count':_0x24fa70,'rows':_0x1fcf2c}:null;}})[_0x1842('0x18')](respondWithResult(_0x29b775,null))[_0x1842('0x22')](handleError(_0x29b775,null));};exports['setTags']=function(_0x3bed11,_0x4ec39c){if(_0x3bed11[_0x1842('0x33')]['id']){delete _0x3bed11[_0x1842('0x33')]['id'];}return db[_0x1842('0x23')]['findOne']({'where':{'id':_0x3bed11[_0x1842('0x74')]['id']}})[_0x1842('0x18')](handleEntityNotFound(_0x4ec39c,null))[_0x1842('0x18')](function(_0x3a763b){if(_0x3a763b){return _0x3a763b[_0x1842('0x84')](_0x3bed11[_0x1842('0x33')][_0x1842('0x85')]||[]);}return null;})['then'](respondWithResult(_0x4ec39c,null))['catch'](handleError(_0x4ec39c,null));};exports['setAdditionalPhones']=function(_0x12a11e,_0x5a4219){var _0x26be4d=[];_0x26be4d[_0x1842('0x5c')](addAdditionalPhones(_0x12a11e[_0x1842('0x33')]));Promise['all'](_0x26be4d)[_0x1842('0x18')](function(){_0x26be4d=[];_0x26be4d[_0x1842('0x5c')](deleteCmHopperPhones(_0x12a11e['body']['id']));_0x26be4d['push'](addCmHopperPhones(_0x12a11e[_0x1842('0x33')]['id']));Promise[_0x1842('0x5f')](_0x26be4d)[_0x1842('0x18')](function(){return[0x1];})[_0x1842('0x18')](respondWithResult(_0x5a4219,null));});};function addAdditionalPhones(_0x3fa12b){var _0x137da3;return new Promise(function(_0x4c8890){return db['CmContactHasItem']['destroy']({'where':{'CmContactId':_0x3fa12b['id']}})[_0x1842('0x18')](function(){db[_0x1842('0x66')][_0x1842('0x20')]({'raw':!![],'attributes':['id',_0x1842('0x86')]})[_0x1842('0x18')](function(_0x2bff78){var _0x1cbc40=[];for(var _0x362ede=0x0;_0x362ede<_0x3fa12b['items'][_0x1842('0x27')];_0x362ede++){var _0x3ba40b=_0x3fa12b[_0x1842('0x87')]?_[_0x1842('0x6b')](_0x3fa12b[_0x1842('0x87')][_0x362ede])?'':_0x3fa12b['item_types'][_0x362ede]:_0x3fa12b[_0x1842('0x88')][_0x362ede][_0x1842('0x89')]?_0x3fa12b[_0x1842('0x88')][_0x362ede]['ItemTypeId']:'';var _0x22867c=_[_0x1842('0x6b')](_0x3fa12b[_0x1842('0x88')][_0x362ede][_0x1842('0x8a')])?'':_0x3fa12b[_0x1842('0x88')][_0x362ede][_0x1842('0x8a')];var _0x46fbbd=_0x3ba40b+':'+_0x3fa12b['items'][_0x362ede]['phone']+'§'+_0x22867c;if(_[_0x1842('0x6b')](_0x137da3))_0x137da3=_0x46fbbd;else _0x137da3+=';'+_0x46fbbd;var _0x2601fb=null;var _0xa30f17=null;if(_0x3fa12b[_0x1842('0x87')]){if(!_[_0x1842('0x6b')](_0x3fa12b['item_types'][_0x362ede])){_0xa30f17=_[_0x1842('0x24')](_0x2bff78,function(_0x3e70ec){return _0x3e70ec['id']===_0x3fa12b[_0x1842('0x87')][_0x362ede];});if(!_[_0x1842('0x6b')](_0xa30f17)){_0x2601fb=_0xa30f17['OrderBy'];}}}else{if(!_[_0x1842('0x6b')](_0x3fa12b[_0x1842('0x88')][_0x362ede])){_0xa30f17=_['find'](_0x2bff78,function(_0x4d0ff3){return _0x4d0ff3['id']===_0x3fa12b[_0x1842('0x88')][_0x362ede]['ItemTypeId'];});if(!_[_0x1842('0x6b')](_0xa30f17)){_0x2601fb=_0x362ede;}}}if(_['isNil'](_0x2601fb)){_0x2601fb=0x64;}_0x1cbc40['push'](addAdditionalPhone(_0x3fa12b['id'],_0x3fa12b['items'][_0x362ede][_0x1842('0x77')],_0x3fa12b[_0x1842('0x87')]?_[_0x1842('0x6b')](_0x3fa12b[_0x1842('0x87')][_0x362ede])?null:_0x3fa12b[_0x1842('0x87')][_0x362ede]:_0x3fa12b[_0x1842('0x88')][_0x362ede][_0x1842('0x89')]?_0x3fa12b[_0x1842('0x88')][_0x362ede][_0x1842('0x89')]:null,_0x2601fb,_0x22867c));}Promise[_0x1842('0x5f')](_0x1cbc40)[_0x1842('0x18')](function(){db['CmContact'][_0x1842('0x3e')]({'AdditionalPhones':_0x137da3},{'where':{'id':_0x3fa12b['id']}})[_0x1842('0x18')](function(){_0x4c8890(0x1);});});});});});}function addAdditionalPhone(_0x508e13,_0x26f6da,_0x5ee428,_0x41c147,_0x344857){return db[_0x1842('0x48')]['find']({'where':{'CmContactId':_0x508e13,'item':_0x26f6da}})['then'](function(_0x5d2670){if(_0x5d2670)logger[_0x1842('0x31')](_0x1842('0x8b'),_0x5d2670);else{db[_0x1842('0x48')][_0x1842('0x53')]({'CmContactId':_0x508e13,'item':_0x26f6da,'ItemTypeId':_0x5ee428,'OrderBy':_0x41c147,'ItemClass':_0x1842('0x8c'),'description':_0x344857});}});}function deleteCmHopperPhones(_0x388ca2){return new Promise(function(_0x16e97){return db[_0x1842('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x388ca2}})[_0x1842('0x18')](function(_0xc22c38){db[_0x1842('0x8d')][_0x1842('0x19')]({'where':{'CmHopperId':{'$in':_['map'](_0xc22c38,'id')}}});})['then'](function(){_0x16e97(0x1);});});}function addCmHopperPhones(_0x24db5a){return new Promise(function(_0x53c3db){return db[_0x1842('0x39')][_0x1842('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x24db5a}})[_0x1842('0x18')](function(_0x350c5f){var _0x41b924=[];_['map'](_0x350c5f,function(_0xb04713){_0x41b924['push'](createCmHopperPhone(_0x24db5a,_0xb04713['id']));});Promise['all'](_0x41b924)['then'](function(){_0x53c3db(0x1);});});});}function createCmHopperPhone(_0x182940,_0x25e2b6){return new Promise(function(_0x5b48a7){db[_0x1842('0x48')][_0x1842('0x20')]({'raw':!![],'attributes':[_0x1842('0x8e'),_0x1842('0x86')],'where':{'CmContactId':_0x182940,'ItemClass':_0x1842('0x8c')},'include':[{'model':db[_0x1842('0x66')],'attributes':[_0x1842('0x86')],'as':_0x1842('0x67')}],'order':['OrderBy',db[_0x1842('0x75')][_0x1842('0x68')](_0x1842('0x8f'))]})[_0x1842('0x18')](function(_0xe221dc){var _0x69d511=0x1;var _0x43dda3=_[_0x1842('0x6e')](_0xe221dc,function(_0x590977){_0x590977['CmHopperId']=_0x25e2b6;_0x590977[_0x1842('0x77')]=_0x590977['item'];_0x590977[_0x1842('0x86')]=_0x69d511;delete _0x590977[_0x1842('0x90')];_0x69d511=_0x69d511+0x1;return _0x590977;});return db['CmHopperAdditionalPhone'][_0x1842('0x58')](_0x43dda3,{});})[_0x1842('0x18')](function(){_0x5b48a7(0x1);});});}function insertAdditionalPhones(_0x593abf,_0xc26c1b){return new Promise(function(_0x3e3313){var _0x74ce5c=[];for(var _0x228b94=0x0;_0x228b94<_0xc26c1b['length'];_0x228b94++){var _0x37171a=_0xc26c1b[_0x228b94];_0x74ce5c['push'](parseContactItemType(_0x37171a));}Promise[_0x1842('0x5f')](_0x74ce5c)[_0x1842('0x18')](function(){var _0x246753={'id':_0x593abf['id'],'items':_0xc26c1b};return addAdditionalPhones(_0x246753)[_0x1842('0x18')](function(){return addCmHopperPhones(_0x593abf['id']);});})[_0x1842('0x18')](function(){_0x3e3313(_0x593abf);});});}function parseContactItemType(_0x745577){return new Promise(function(_0x1953b9){if(_0x745577['hasOwnProperty']('ItemTypeId')){_0x1953b9(_0x745577);}else{return db[_0x1842('0x66')][_0x1842('0x24')]({'where':{'name':_0x745577[_0x1842('0x67')]}})[_0x1842('0x18')](function(_0x5ef37f){if(_[_0x1842('0x6b')](_0x5ef37f))_0x745577[_0x1842('0x89')]=null;else _0x745577[_0x1842('0x89')]=_0x5ef37f['id'];_0x1953b9(_0x745577);});}});}exports['getAdditionalPhones']=function(_0x5b3b1b,_0x4f66cc){return db[_0x1842('0x48')]['findAll']({'raw':!![],'where':{'CmContactId':_0x5b3b1b[_0x1842('0x74')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x1842('0x66')],'as':_0x1842('0x67')}],'order':[['OrderBy'],[db[_0x1842('0x75')][_0x1842('0x68')](_0x1842('0x8f'))]]})['then'](function(_0xd71f01){return _0xd71f01;})[_0x1842('0x18')](respondWithResult(_0x4f66cc,null))[_0x1842('0x22')](handleError(_0x4f66cc,null));};exports[_0x1842('0x91')]=function(_0x219479,_0x4a6162){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x219479[_0x1842('0x33')]['fromContactId']}})[_0x1842('0x18')](function(_0x4c14a2){var _0x3e44cc=_[_0x1842('0x6e')](_0x4c14a2,function(_0x426db5){_0x426db5['CmContactId']=_0x219479[_0x1842('0x33')][_0x1842('0x92')];return _0x426db5;});return db['CmContactHasItem'][_0x1842('0x58')](_0x3e44cc,{});})['then'](function(){return addCmHopperPhones(_0x219479[_0x1842('0x33')]['toContactId']);})[_0x1842('0x18')](function(){return['ok'];})['then'](respondWithResult(_0x4a6162,null))['catch'](handleError(_0x4a6162,null));};exports[_0x1842('0x93')]=function(_0x82bf2a,_0x1e20bd){var _0x39147c=[];_0x39147c[_0x1842('0x5c')](createCmHopperPhone(_0x82bf2a[_0x1842('0x33')]['id'],_0x82bf2a[_0x1842('0x33')][_0x1842('0x94')]));Promise[_0x1842('0x5f')](_0x39147c)[_0x1842('0x18')](function(){return[0x1];})[_0x1842('0x18')](respondWithResult(_0x1e20bd,null));};exports['getHoppers']=function(_0x2611cd,_0x46f0ce){var _0x3f9588={'raw':![],'where':{}};var _0x3cfa34={};var _0x384de9={'count':0x0,'rows':[]};return db[_0x1842('0x23')][_0x1842('0x95')]({'where':{'id':_0x2611cd[_0x1842('0x74')]['id']}})[_0x1842('0x18')](handleEntityNotFound(_0x46f0ce,null))[_0x1842('0x18')](function(_0x273461){if(_0x273461){_0x3cfa34[_0x1842('0x79')]=_['keys'](db[_0x1842('0x39')][_0x1842('0x96')]);_0x3cfa34['query']=_[_0x1842('0x26')](_0x2611cd[_0x1842('0x63')]);_0x3cfa34['filters']=_['intersection'](_0x3cfa34[_0x1842('0x79')],_0x3cfa34[_0x1842('0x63')]);_0x3f9588[_0x1842('0x7c')]=_[_0x1842('0x7b')](_0x3cfa34[_0x1842('0x79')],qs['fields'](_0x2611cd[_0x1842('0x63')]['fields']));_0x3f9588[_0x1842('0x7c')]=_0x3f9588[_0x1842('0x7c')][_0x1842('0x27')]?_0x3f9588[_0x1842('0x7c')]:_0x3cfa34['model'];if(!_0x2611cd[_0x1842('0x63')][_0x1842('0x32')](_0x1842('0x83'))){_0x3f9588[_0x1842('0x15')]=qs[_0x1842('0x15')](_0x2611cd[_0x1842('0x63')]['limit']);_0x3f9588[_0x1842('0x12')]=qs[_0x1842('0x12')](_0x2611cd[_0x1842('0x63')][_0x1842('0x12')]);}_0x3f9588[_0x1842('0x7e')]=qs[_0x1842('0x7f')](_0x2611cd[_0x1842('0x63')][_0x1842('0x7f')]);_0x3f9588['where']=qs[_0x1842('0x7a')](_['pick'](_0x2611cd[_0x1842('0x63')],_0x3cfa34[_0x1842('0x7a')]));_0x3f9588[_0x1842('0x5a')]['ContactId']=_0x273461['id'];if(_0x2611cd[_0x1842('0x63')][_0x1842('0x81')]){_0x3f9588['where']=_[_0x1842('0x82')](_0x3f9588[_0x1842('0x5a')],{'$or':_['map'](_0x3f9588[_0x1842('0x7c')],function(_0x4c7cdb){var _0x1a51fa={};_0x1a51fa[_0x4c7cdb]={'$like':'%'+_0x2611cd[_0x1842('0x63')][_0x1842('0x81')]+'%'};return _0x1a51fa;})});}_0x3f9588=_[_0x1842('0x82')]({},_0x3f9588,_0x2611cd[_0x1842('0x97')]);return db['CmHopper'][_0x1842('0x14')]({'where':_0x3f9588['where']})[_0x1842('0x18')](function(_0x276242){_0x384de9[_0x1842('0x14')]=_0x276242;if(_0x2611cd[_0x1842('0x63')][_0x1842('0x98')]){_0x3f9588[_0x1842('0x99')]=[{'all':!![]}];}return db[_0x1842('0x39')]['findAll'](_0x3f9588);})[_0x1842('0x18')](function(_0x3c7926){_0x384de9[_0x1842('0x9a')]=_0x3c7926;return _0x384de9;});}})['then'](respondWithFilteredResult(_0x46f0ce,_0x3f9588))[_0x1842('0x22')](handleError(_0x46f0ce,null));};exports['getHopperHistories']=function(_0x3c6baf,_0x281367){var _0x3d338a={'raw':!![],'where':{}};var _0x5be79e={};var _0x4a99dc={'count':0x0,'rows':[]};return db[_0x1842('0x23')][_0x1842('0x95')]({'where':{'id':_0x3c6baf[_0x1842('0x74')]['id']}})['then'](handleEntityNotFound(_0x281367,null))['then'](function(_0x123453){if(_0x123453){_0x5be79e[_0x1842('0x79')]=_['keys'](db[_0x1842('0x49')][_0x1842('0x96')]);_0x5be79e['query']=_[_0x1842('0x26')](_0x3c6baf[_0x1842('0x63')]);_0x5be79e['filters']=_[_0x1842('0x7b')](_0x5be79e[_0x1842('0x79')],_0x5be79e['query']);_0x3d338a[_0x1842('0x7c')]=_[_0x1842('0x7b')](_0x5be79e[_0x1842('0x79')],qs['fields'](_0x3c6baf['query']['fields']));_0x3d338a[_0x1842('0x7c')]=_0x3d338a[_0x1842('0x7c')][_0x1842('0x27')]?_0x3d338a[_0x1842('0x7c')]:_0x5be79e[_0x1842('0x79')];if(!_0x3c6baf['query'][_0x1842('0x32')](_0x1842('0x83'))){_0x3d338a[_0x1842('0x15')]=qs[_0x1842('0x15')](_0x3c6baf[_0x1842('0x63')][_0x1842('0x15')]);_0x3d338a['offset']=qs[_0x1842('0x12')](_0x3c6baf['query'][_0x1842('0x12')]);}_0x3d338a[_0x1842('0x7e')]=qs[_0x1842('0x7f')](_0x3c6baf['query'][_0x1842('0x7f')]);_0x3d338a[_0x1842('0x5a')]=qs[_0x1842('0x7a')](_[_0x1842('0x80')](_0x3c6baf[_0x1842('0x63')],_0x5be79e[_0x1842('0x7a')]));_0x3d338a[_0x1842('0x5a')][_0x1842('0x9b')]=_0x123453['id'];if(_0x3c6baf[_0x1842('0x63')][_0x1842('0x81')]){_0x3d338a['where']=_[_0x1842('0x82')](_0x3d338a['where'],{'$or':_[_0x1842('0x6e')](_0x3d338a['attributes'],function(_0x513d9d){var _0x583d48={};_0x583d48[_0x513d9d]={'$like':'%'+_0x3c6baf['query'][_0x1842('0x81')]+'%'};return _0x583d48;})});}_0x3d338a=_[_0x1842('0x82')]({},_0x3d338a,_0x3c6baf[_0x1842('0x97')]);return db[_0x1842('0x49')][_0x1842('0x14')]({'where':_0x3d338a[_0x1842('0x5a')]})['then'](function(_0x168012){_0x4a99dc['count']=_0x168012;if(_0x3c6baf[_0x1842('0x63')][_0x1842('0x98')]){_0x3d338a[_0x1842('0x99')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x1842('0x20')](_0x3d338a);})['then'](function(_0x34b085){_0x4a99dc[_0x1842('0x9a')]=_0x34b085;return _0x4a99dc;});}})['then'](respondWithFilteredResult(_0x281367,_0x3d338a))[_0x1842('0x22')](handleError(_0x281367,null));};exports['getHopperFinals']=function(_0x62a20,_0x5cd541){var _0x3ecf13={'raw':!![],'where':{}};var _0x15aae0={};var _0x421506={'count':0x0,'rows':[]};return db[_0x1842('0x23')][_0x1842('0x95')]({'where':{'id':_0x62a20[_0x1842('0x74')]['id']}})[_0x1842('0x18')](handleEntityNotFound(_0x5cd541,null))['then'](function(_0x216142){if(_0x216142){_0x15aae0[_0x1842('0x79')]=_['keys'](db[_0x1842('0x9c')][_0x1842('0x96')]);_0x15aae0[_0x1842('0x63')]=_[_0x1842('0x26')](_0x62a20[_0x1842('0x63')]);_0x15aae0[_0x1842('0x7a')]=_[_0x1842('0x7b')](_0x15aae0[_0x1842('0x79')],_0x15aae0['query']);_0x3ecf13['attributes']=_['intersection'](_0x15aae0[_0x1842('0x79')],qs[_0x1842('0x7d')](_0x62a20[_0x1842('0x63')][_0x1842('0x7d')]));_0x3ecf13[_0x1842('0x7c')]=_0x3ecf13[_0x1842('0x7c')][_0x1842('0x27')]?_0x3ecf13[_0x1842('0x7c')]:_0x15aae0[_0x1842('0x79')];if(!_0x62a20[_0x1842('0x63')][_0x1842('0x32')]('nolimit')){_0x3ecf13[_0x1842('0x15')]=qs[_0x1842('0x15')](_0x62a20['query'][_0x1842('0x15')]);_0x3ecf13[_0x1842('0x12')]=qs[_0x1842('0x12')](_0x62a20[_0x1842('0x63')][_0x1842('0x12')]);}_0x3ecf13[_0x1842('0x7e')]=qs[_0x1842('0x7f')](_0x62a20['query'][_0x1842('0x7f')]);_0x3ecf13[_0x1842('0x5a')]=qs[_0x1842('0x7a')](_[_0x1842('0x80')](_0x62a20['query'],_0x15aae0[_0x1842('0x7a')]));_0x3ecf13[_0x1842('0x5a')][_0x1842('0x9b')]=_0x216142['id'];if(_0x62a20[_0x1842('0x63')]['filter']){_0x3ecf13[_0x1842('0x5a')]=_[_0x1842('0x82')](_0x3ecf13['where'],{'$or':_[_0x1842('0x6e')](_0x3ecf13['attributes'],function(_0x293ea3){var _0x375c10={};_0x375c10[_0x293ea3]={'$like':'%'+_0x62a20[_0x1842('0x63')][_0x1842('0x81')]+'%'};return _0x375c10;})});}_0x3ecf13=_[_0x1842('0x82')]({},_0x3ecf13,_0x62a20[_0x1842('0x97')]);return db[_0x1842('0x9c')][_0x1842('0x14')]({'where':_0x3ecf13['where']})['then'](function(_0x3b6917){_0x421506[_0x1842('0x14')]=_0x3b6917;if(_0x62a20[_0x1842('0x63')][_0x1842('0x98')]){_0x3ecf13['include']=[{'all':!![]}];}return db[_0x1842('0x9c')][_0x1842('0x20')](_0x3ecf13);})[_0x1842('0x18')](function(_0x31066f){_0x421506[_0x1842('0x9a')]=_0x31066f;return _0x421506;});}})[_0x1842('0x18')](respondWithFilteredResult(_0x5cd541,_0x3ecf13))['catch'](handleError(_0x5cd541,null));};exports[_0x1842('0x9d')]=function(_0x2525d6,_0x516834){var _0x5ac821={'raw':!![],'where':{}};var _0x23a434={};var _0x15824f={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x2525d6[_0x1842('0x74')]['id']}})[_0x1842('0x18')](handleEntityNotFound(_0x516834,null))[_0x1842('0x18')](function(_0x5655c0){if(_0x5655c0){_0x23a434[_0x1842('0x79')]=_['keys'](db[_0x1842('0x4f')][_0x1842('0x96')]);_0x23a434[_0x1842('0x63')]=_[_0x1842('0x26')](_0x2525d6[_0x1842('0x63')]);_0x23a434['filters']=_[_0x1842('0x7b')](_0x23a434[_0x1842('0x79')],_0x23a434[_0x1842('0x63')]);_0x5ac821[_0x1842('0x7c')]=_[_0x1842('0x7b')](_0x23a434['model'],qs[_0x1842('0x7d')](_0x2525d6['query'][_0x1842('0x7d')]));_0x5ac821[_0x1842('0x7c')]=_0x5ac821[_0x1842('0x7c')][_0x1842('0x27')]?_0x5ac821[_0x1842('0x7c')]:_0x23a434[_0x1842('0x79')];if(!_0x2525d6[_0x1842('0x63')][_0x1842('0x32')](_0x1842('0x83'))){_0x5ac821['limit']=qs[_0x1842('0x15')](_0x2525d6['query'][_0x1842('0x15')]);_0x5ac821[_0x1842('0x12')]=qs[_0x1842('0x12')](_0x2525d6[_0x1842('0x63')]['offset']);}_0x5ac821[_0x1842('0x7e')]=qs[_0x1842('0x7f')](_0x2525d6[_0x1842('0x63')][_0x1842('0x7f')]);_0x5ac821[_0x1842('0x5a')]=qs['filters'](_[_0x1842('0x80')](_0x2525d6[_0x1842('0x63')],_0x23a434[_0x1842('0x7a')]));_0x5ac821['where'][_0x1842('0x9b')]=_0x5655c0['id'];if(_0x2525d6['query'][_0x1842('0x81')]){_0x5ac821[_0x1842('0x5a')]=_[_0x1842('0x82')](_0x5ac821['where'],{'$or':_[_0x1842('0x6e')](_0x5ac821['attributes'],function(_0x14d967){var _0x59756e={};_0x59756e[_0x14d967]={'$like':'%'+_0x2525d6[_0x1842('0x63')]['filter']+'%'};return _0x59756e;})});}_0x5ac821=_[_0x1842('0x82')]({},_0x5ac821,_0x2525d6['options']);return db[_0x1842('0x4f')][_0x1842('0x14')]({'where':_0x5ac821[_0x1842('0x5a')]})[_0x1842('0x18')](function(_0x3e90a3){_0x15824f['count']=_0x3e90a3;if(_0x2525d6[_0x1842('0x63')]['includeAll']){_0x5ac821[_0x1842('0x99')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x5ac821);})['then'](function(_0xce8d0b){_0x15824f['rows']=_0xce8d0b;return _0x15824f;});}})[_0x1842('0x18')](respondWithFilteredResult(_0x516834,_0x5ac821))[_0x1842('0x22')](handleError(_0x516834,null));};exports[_0x1842('0x9e')]=function(_0x1e0f02,_0x2c26bd){try{if(!_0x1e0f02['body'][_0x1842('0x5d')]){throw new Error('No\x20ListId\x20specified');}if(!_0x1e0f02[_0x1842('0x33')][_0x1842('0x9f')]){throw new Error(_0x1842('0xa0'));}if(!_0x1e0f02[_0x1842('0x33')][_0x1842('0xa1')]){throw new Error(_0x1842('0xa2'));}if(!_0x1e0f02[_0x1842('0x33')]['socket_timestamp']){throw new Error(_0x1842('0xa3'));}var _0x1177da=_0x1e0f02[_0x1842('0x33')][_0x1842('0x9f')][_0x1842('0xa4')](',');var _0x31e400=_0x1e0f02['body']['binding_values'][_0x1842('0xa4')](',');if(!_0x1177da['length']||!_0x31e400[_0x1842('0x27')]||_0x1177da[_0x1842('0x27')]!==_0x31e400[_0x1842('0x27')]){throw new Error(_0x1842('0xa5'));}_0x1e0f02[_0x1842('0x33')][_0x1842('0x7d')]=_[_0x1842('0xa6')](_0x1177da,_0x31e400);if(!_0x1e0f02[_0x1842('0x33')][_0x1842('0x7d')][_0x1842('0x77')]){throw new Error(_0x1842('0xa7'));}if(!_0x1e0f02[_0x1842('0x33')]['fields'][_0x1842('0xa8')]){throw new Error(_0x1842('0xa9'));}var _0x3431b2=path[_0x1842('0xaa')](config[_0x1842('0xab')],_0x1842('0xac'),_0x1e0f02[_0x1842('0xad')]['filename']);fs[_0x1842('0xae')](_0x3431b2,parseInt(_0x1842('0xaf'),0x8));var _0x305d1a=require(_0x1842('0xb0'))[_0x1842('0xb1')](path['join'](__dirname,_0x1842('0xb2')),[_0x3431b2,_0x1e0f02[_0x1842('0x33')][_0x1842('0x9f')],_0x1e0f02['body'][_0x1842('0xa1')],_0x1e0f02[_0x1842('0x33')]['ListId'],_0x1e0f02[_0x1842('0x33')]['CompanyId'],_0x1e0f02['body'][_0x1842('0x59')],_0x1e0f02['body']['socket_timestamp']]);return _0x2c26bd['status'](0xc8)['json']({'message':_0x1842('0xb3'),'pid':_0x305d1a['pid']});}catch(_0x2b306d){return _0x2c26bd[_0x1842('0x10')](0x1f4)[_0x1842('0x1e')](_0x2b306d);}};exports['upload']=function(_0x59a322,_0x5c172e){var _0x13e6c6=fs['createReadStream'](_0x59a322[_0x1842('0xad')][_0x1842('0x2')]);Papa[_0x1842('0xb4')](_0x13e6c6,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2fec86){return _0x5c172e[_0x1842('0x10')](0xc8)[_0x1842('0x11')]({'file':_0x59a322['file'],'fields':_0x2fec86['meta'][_0x1842('0x7d')]});}});};exports[_0x1842('0xb5')]=function(_0x34be82,_0x3d7eed){return db[_0x1842('0xb6')][_0x1842('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x188b51){var _0x835339=![];if(!_0x34be82[_0x1842('0x33')][_0x1842('0x5d')]){throw new Error(_0x1842('0xb7'));}if(!_0x34be82[_0x1842('0x33')][_0x1842('0xb8')]['phone']){throw new Error(_0x1842('0xa7'));}if(!_0x34be82['body'][_0x1842('0xb8')][_0x1842('0xa8')]){throw new Error(_0x1842('0xa9'));}if(!_0x34be82[_0x1842('0x33')][_0x1842('0xb9')]){throw new Error(_0x1842('0xa3'));}var _0x38eb04=require(_0x1842('0xb0'))['fork'](path[_0x1842('0xaa')](__dirname,_0x1842('0xba')),[_0x34be82[_0x1842('0x74')]['id'],JSON['stringify'](_0x34be82[_0x1842('0x33')]),JSON[_0x1842('0xbb')](_0x188b51)]);_0x38eb04['on'](_0x1842('0xbc'),function(){_0x835339=!![];return _0x3d7eed['status'](0xc8)[_0x1842('0x11')]({'message':_0x1842('0xbd'),'pid':_0x38eb04[_0x1842('0xbe')]});});_0x38eb04['on'](_0x1842('0xbf'),function(_0x53e0ff){if(_0x53e0ff&&!_0x835339){return _0x3d7eed[_0x1842('0x10')](0x1f4)[_0x1842('0x11')]({'message':_0x1842('0xc0'),'pid':_0x38eb04[_0x1842('0xbe')]});}});})[_0x1842('0x22')](handleError(_0x3d7eed,null));};exports[_0x1842('0xc1')]=function(_0x30a156,_0x1e739a){return db[_0x1842('0xb6')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0xd9054f){var _0x46b12f=![];if(!_0x30a156['body'][_0x1842('0x5d')]){throw new Error(_0x1842('0xb7'));}if(!_0x30a156['body'][_0x1842('0xb8')][_0x1842('0x77')]){throw new Error(_0x1842('0xa7'));}if(!_0x30a156[_0x1842('0x33')][_0x1842('0xb8')][_0x1842('0xa8')]){throw new Error(_0x1842('0xa9'));}if(!_0x30a156['body'][_0x1842('0xb9')]){throw new Error(_0x1842('0xa3'));}var _0x261a06=require(_0x1842('0xb0'))[_0x1842('0xb1')](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x30a156[_0x1842('0x74')]['id'],JSON[_0x1842('0xbb')](_0x30a156[_0x1842('0x33')]),JSON['stringify'](_0xd9054f)]);_0x261a06['on'](_0x1842('0xbc'),function(){_0x46b12f=!![];return _0x1e739a[_0x1842('0x10')](0xc8)['json']({'message':_0x1842('0xbd'),'pid':_0x261a06['pid']});});_0x261a06['on']('exit',function(_0xfe28bc){if(_0xfe28bc&&!_0x46b12f){return _0x1e739a[_0x1842('0x10')](0x1f4)[_0x1842('0x11')]({'message':'error\x20child\x20process','pid':_0x261a06[_0x1842('0xbe')]});}});})[_0x1842('0x22')](handleError(_0x1e739a,null));};exports['getJourney']=function(_0x1fa05d,_0x22a74e){var _0x467a86=['mail',_0x1842('0xc2'),_0x1842('0xc3'),'openchannel','fax',_0x1842('0xc4'),'voice'];var _0xf527c={'offset':0x0,'order':qs[_0x1842('0x7f')](_0x1842('0xc5'))},_0x2c45ed={'count':0x0,'rows':[]};Promise[_0x1842('0xc6')]()[_0x1842('0x18')](function(){if(_0x1fa05d['query']['channel']){if(!_[_0x1842('0xc7')](_0x467a86,_0x1fa05d[_0x1842('0x63')][_0x1842('0xc8')][_0x1842('0xc9')]())){throw new Error('Invalid\x20channel');}_0x467a86=[_0x1fa05d[_0x1842('0x63')]['channel'][_0x1842('0xc9')]()];}if(_0x1fa05d[_0x1842('0x63')][_0x1842('0xca')]){try{var _0x2cab0c=JSON[_0x1842('0xb4')](_0x1fa05d[_0x1842('0x63')][_0x1842('0xca')]);if(!moment(_0x2cab0c[_0x1842('0x34')])[_0x1842('0xcb')]()){throw new Error(_0x1842('0xcc'));}if(!moment(_0x2cab0c['to'])[_0x1842('0xcb')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0xaaf842){throw new Error(_0x1842('0xcd'));}}if(!_0x1fa05d['query'][_0x1842('0x32')](_0x1842('0x83'))){_0xf527c[_0x1842('0x15')]=qs[_0x1842('0x15')](_0x1fa05d[_0x1842('0x63')]['limit']||0xa);_0xf527c[_0x1842('0x12')]=qs[_0x1842('0x12')](_0x1fa05d[_0x1842('0x63')][_0x1842('0x12')]);}var _0x23e83e=_0x467a86[_0x1842('0x6e')](function(_0xf0ec7e){if(_0xf0ec7e===_0x1842('0xce')){var _0x2b71de={'attributes':['id',_0x1842('0xcf'),_0x1842('0x30'),'source','destination',_0x1842('0xd0'),_0x1842('0xd1'),'endtime',_0x1842('0xd2'),_0x1842('0xd3'),_0x1842('0xd4'),_0x1842('0xd5'),_0x1842('0xd6'),'userThirdDisposition','UserId'],'where':{'ContactId':_0x1fa05d['params']['id']},'include':[{'model':db[_0x1842('0xb6')],'as':_0x1842('0xb6'),'attributes':['id','name',_0x1842('0xd7'),'alias']}],'order':[['createdAt',_0x1842('0xd8')]]};if(_0x1fa05d[_0x1842('0x63')][_0x1842('0xca')]){_0x2b71de[_0x1842('0x5a')][_0x1842('0xd4')]={'$gte':_0x2cab0c[_0x1842('0x34')],'$lte':_0x2cab0c['to']};}return db[_0x1842('0x4a')][_0x1842('0xd9')](_0x2b71de)['then'](function(_0x15e5bc){_0x2c45ed[_0x1842('0x14')]+=_0x15e5bc[_0x1842('0x14')];return _[_0x1842('0x6e')](_0x15e5bc[_0x1842('0x9a')],function(_0x24091d){var _0x3fbca0=_0x24091d['get']({'plain':!![]});_0x3fbca0[_0x1842('0xc8')]=_0xf0ec7e;if(_0x3fbca0['User']){_0x3fbca0[_0x1842('0xb6')]={'id':_0x3fbca0['User']['id'],'name':_0x3fbca0[_0x1842('0xb6')]['name'],'fullname':_0x3fbca0[_0x1842('0xb6')]['fullname'],'alias':_0x3fbca0[_0x1842('0xb6')]['alias']};}return _0x3fbca0;});});}else{var _0x24c440=_['startCase'](_0xf0ec7e)+(_0xf0ec7e==='chat'?_0x1842('0xda'):_0x1842('0xdb'));var _0x280613={'attributes':['id',_0x1842('0xdc'),_0x1842('0xdd'),_0x1842('0xd4'),_0x1842('0xd3'),_0x1842('0xde'),_0x1842('0xdf'),_0x1842('0xe0'),_0x1842('0xe1'),_0x24c440+'Id'],'where':{'ContactId':_0x1fa05d['params']['id']},'include':[{'model':db[_0x24c440],'as':_0x1842('0xdb'),'attributes':['id',_0x1842('0x1d'),'key']},{'model':db[_0x1842('0xb6')],'as':_0x1842('0xe2'),'attributes':['id',_0x1842('0x1d'),_0x1842('0xd7')]},{'model':db[_0x1842('0x60')],'as':_0x1842('0x61'),'attributes':['id',_0x1842('0x1d'),'color'],'through':{'attributes':[]}}],'order':[[_0x1842('0xd4'),_0x1842('0xd8')]]};if(_0x1fa05d[_0x1842('0x63')][_0x1842('0xca')]){_0x280613[_0x1842('0x5a')][_0x1842('0xd4')]={'$gte':_0x2cab0c[_0x1842('0x34')],'$lte':_0x2cab0c['to']};}switch(_0xf0ec7e){case _0x1842('0xc2'):_0x280613[_0x1842('0x7c')]['push'](_0x1842('0xe3'),'customerIp',_0x1842('0xe4'),_0x1842('0xe5'),'osName',_0x1842('0xe6'),_0x1842('0xe7'),_0x1842('0xe8'),'referer');break;case'mail':_0x280613[_0x1842('0x7c')][_0x1842('0x5c')](_0x1842('0xe9'),'substatus');break;case _0x1842('0xea'):_0x280613[_0x1842('0x7c')]['push'](_0x1842('0xeb'),_0x1842('0xec'));break;}return db[_['startCase'](_0xf0ec7e)+_0x1842('0xed')][_0x1842('0xd9')](_0x280613)[_0x1842('0x18')](function(_0x253ad1){_0x2c45ed[_0x1842('0x14')]+=_0x253ad1[_0x1842('0x14')];return _[_0x1842('0x6e')](_0x253ad1['rows'],function(_0x14bd88){var _0x5d0813=_0x14bd88[_0x1842('0x35')]({'plain':!![]});_0x5d0813[_0x1842('0xc8')]=_0xf0ec7e;if(_0x5d0813['Owner']){_0x5d0813[_0x1842('0xe2')]={'id':_0x5d0813[_0x1842('0xe2')]['id'],'name':_0x5d0813['Owner'][_0x1842('0x1d')],'fullname':_0x5d0813[_0x1842('0xe2')][_0x1842('0xd7')]};}return _0x5d0813;});});}});return Promise[_0x1842('0x5f')](_0x23e83e);})[_0x1842('0x18')](function(_0xb85e07){return _(_0xb85e07)[_0x1842('0xee')]()['sortBy'](_0x1842('0xd4'))[_0x1842('0xef')]()[_0x1842('0xf0')]();})[_0x1842('0x18')](function(_0x28eea0){_0x2c45ed[_0x1842('0x9a')]=_0xf527c[_0x1842('0x15')]?_0x28eea0[_0x1842('0xf1')](_0xf527c['offset'],_0xf527c[_0x1842('0x12')]+_0xf527c[_0x1842('0x15')]):_0x28eea0;return _0x2c45ed;})[_0x1842('0x18')](respondWithFilteredResult(_0x22a74e,_0xf527c))['catch'](handleError(_0x22a74e,null));}; \ No newline at end of file +var _0xd90d=['findOne','rawAttributes','filters','intersection','model','attributes','fields','order','sort','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','PHONE','CmHopperAdditionalPhone','item','ItemType','`ItemType`.OrderBy','getAdditionalPhones','literal','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','includeAll','include','rows','getHopperHistories','CmHopperHistory','merge','getJscriptySessions','JscriptySessionReport','ContactId','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','split','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','createReadStream','parse','import','User','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','../../components/import/cm/csvUpdates','exit','getJourney','chat','openchannel','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','userDisposition','userSecondDisposition','UserId','fullname','alias','DESC','createdAt','startCase','closed','closedAt','disposition','secondDisposition','thirdDisposition','Account','key','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','mail','subject','substatus','externalUrl','threadId','Interaction','findAndCountAll','Owner','flatten','sortBy','reverse','value','moment','bluebird','util','path','lodash','squel','ioredis','../../components/contacts','../../config/logger','api','../../config/environment','defaults','redis','socket.io-emitter','./cmContact.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','error','stack','name','send','describe','then','findAll','query','user','catch','CmContact','find','params','tags','keys','length','startsWith','columnName','displayName','CmCustomField','cf_','custom','type','info','forEach','hasOwnProperty','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','utcOffset','timezones','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','all','Tag','Tags','color','Phones','ContactItemType','sequelize','Phones.OrderBy','format','$and','omit','pickBy','map','cf_%d','table','setFields','id\x20=\x20?','toParam','text','values','phone','getTags'];(function(_0x2ecc65,_0xd75c48){var _0x103cc3=function(_0x3f856b){while(--_0x3f856b){_0x2ecc65['push'](_0x2ecc65['shift']());}};_0x103cc3(++_0xd75c48);}(_0xd90d,0x18b));var _0xdd90=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xd90d[_0x543084];return _0x306a57;};'use strict';var moment=require(_0xdd90('0x0'));var BPromise=require(_0xdd90('0x1'));var util=require(_0xdd90('0x2'));var path=require(_0xdd90('0x3'));var fs=require('fs');var _=require(_0xdd90('0x4'));var squel=require(_0xdd90('0x5'));var Papa=require('papaparse');var Redis=require(_0xdd90('0x6'));var contacts=require(_0xdd90('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xdd90('0x8'))(_0xdd90('0x9'));var config=require(_0xdd90('0xa'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config['redis']=_[_0xdd90('0xb')](config[_0xdd90('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd90('0xd'))(new Redis(config[_0xdd90('0xc')]));require(_0xdd90('0xe'))[_0xdd90('0xf')](socket);function respondWithResult(_0x833fbb,_0x54960e){_0x54960e=_0x54960e||0xc8;return function(_0x269168){if(_0x269168){return _0x833fbb[_0xdd90('0x10')](_0x54960e)[_0xdd90('0x11')](_0x269168);}};}function respondWithFilteredResult(_0x3ff1b6,_0x94acdf){return function(_0x125c26){if(_0x125c26){var _0x5506dd=typeof _0x94acdf[_0xdd90('0x12')]==='undefined'&&typeof _0x94acdf[_0xdd90('0x13')]===_0xdd90('0x14');var _0x596733=_0x125c26['count'];var _0x5a7cd7=_0x5506dd?0x0:_0x94acdf[_0xdd90('0x12')];var _0x194c25=_0x5506dd?_0x125c26[_0xdd90('0x15')]:_0x94acdf[_0xdd90('0x12')]+_0x94acdf[_0xdd90('0x13')];var _0x21e8e3;if(_0x194c25>=_0x596733){_0x194c25=_0x596733;_0x21e8e3=0xc8;}else{_0x21e8e3=0xce;}_0x3ff1b6[_0xdd90('0x10')](_0x21e8e3);return _0x3ff1b6[_0xdd90('0x16')](_0xdd90('0x17'),_0x5a7cd7+'-'+_0x194c25+'/'+_0x596733)[_0xdd90('0x11')](_0x125c26);}return null;};}function saveUpdates(_0x2815d0){return function(_0x226283){if(_0x226283){return _0x226283[_0xdd90('0x18')](_0x2815d0)['then'](function(_0xb0e02e){return _0xb0e02e;});}return null;};}function removeEntity(_0x189125){return function(_0x38323a){if(_0x38323a){return _0x38323a[_0xdd90('0x19')]()['then'](function(){_0x189125[_0xdd90('0x10')](0xcc)[_0xdd90('0x1a')]();});}};}function handleEntityNotFound(_0x3e0138){return function(_0x3d9369){if(!_0x3d9369){_0x3e0138['sendStatus'](0x194);}return _0x3d9369;};}function handleError(_0x5d60b1,_0x475c01){_0x475c01=_0x475c01||0x1f4;return function(_0x56e67b){logger[_0xdd90('0x1b')](_0x56e67b[_0xdd90('0x1c')]);if(_0x56e67b[_0xdd90('0x1d')]){delete _0x56e67b[_0xdd90('0x1d')];}_0x5d60b1[_0xdd90('0x10')](_0x475c01)[_0xdd90('0x1e')](_0x56e67b);};}exports['index']=function(_0x1aff4f,_0x591e91){var _0x57c8ba={};return contacts[_0xdd90('0x1f')]()[_0xdd90('0x20')](function(_0x130b91){_0x57c8ba=qs['getOptions'](_0x130b91,_0x1aff4f);return contacts[_0xdd90('0x21')](_0x1aff4f[_0xdd90('0x22')],_0x1aff4f[_0xdd90('0x23')],_0x57c8ba,_0x130b91);})[_0xdd90('0x20')](respondWithFilteredResult(_0x591e91,_0x57c8ba))[_0xdd90('0x24')](handleError(_0x591e91,null));};exports[_0xdd90('0x19')]=function(_0x35ca74,_0x11ed6b){return db[_0xdd90('0x25')][_0xdd90('0x26')]({'where':{'id':_0x35ca74[_0xdd90('0x27')]['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x11ed6b,null))[_0xdd90('0x20')](removeEntity(_0x11ed6b,null))['catch'](handleError(_0x11ed6b,null));};exports[_0xdd90('0x1f')]=function(_0x499c1f,_0x5ddb85){return db[_0xdd90('0x25')][_0xdd90('0x1f')]()[_0xdd90('0x20')](function(_0x5518d5){delete _0x5518d5[_0xdd90('0x28')];for(var _0x138d77=0x0;_0x138d770x0){return new Promise(function(_0x2b4d4f){var _0xd73694=[];for(var _0x374e75=0x0;_0x374e75<_0x3868b6['length'];_0x374e75++){_0xd73694[_0xdd90('0x5e')](insertAdditionalPhones(_0x3868b6[_0x374e75][_0xdd90('0x62')],_0x3868b6[_0x374e75][_0xdd90('0x59')]));}Promise[_0xdd90('0x63')](_0xd73694)['then'](function(){_0x2b4d4f(0x1);});})[_0xdd90('0x20')](function(){return{'success':_0x509862,'failure':_0x525c77,'duplicates':_0x3ecb93};});}else{return{'success':_0x509862,'failure':_0x525c77,'duplicates':_0x3ecb93};}}})[_0xdd90('0x20')](respondWithResult(_0x5cc781,0xc9))[_0xdd90('0x24')](handleError(_0x5cc781,null));};exports['show']=function(_0x4c0b84,_0x55f013){var _0x40538a;return db[_0xdd90('0x25')]['describe']()['then'](function(_0xa32ea8){return db[_0xdd90('0x25')][_0xdd90('0x26')]({'where':{'id':_0x4c0b84[_0xdd90('0x27')]['id']},'include':[{'model':db[_0xdd90('0x64')],'as':_0xdd90('0x65'),'attributes':['id',_0xdd90('0x1d'),_0xdd90('0x66')],'required':_0x4c0b84[_0xdd90('0x22')]['tag']?!![]:![]},{'model':db[_0xdd90('0x49')],'as':_0xdd90('0x67'),'where':{'CmContactId':_0x4c0b84[_0xdd90('0x27')]['id']},'required':![],'include':[{'model':db[_0xdd90('0x68')],'as':'ItemType'}]}],'order':[db[_0xdd90('0x69')]['literal'](_0xdd90('0x6a'))],'attributes':_[_0xdd90('0x29')](_0xa32ea8)});})[_0xdd90('0x20')](function(_0x227816){if(!_['isNil'](_0x227816)){_0x40538a=_0x227816[_0xdd90('0x37')]({'plain':!![]});var _0x2dd3ce={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x227816&&_0x227816[_0xdd90('0x5f')]){if(_0x227816['ListId']){_0x2dd3ce[_0xdd90('0x5c')]['$and'][_0xdd90('0x5e')]({'ListId':{'$ne':_0x227816[_0xdd90('0x5f')]}});}}return db[_0xdd90('0x2e')]['findAll'](_0x2dd3ce);}})[_0xdd90('0x20')](function(_0x51a5bc){if(!_[_0xdd90('0x55')](_0x51a5bc)){return _['omit'](_0x40538a,_['map'](_0x51a5bc,function(_0x32b916){return util[_0xdd90('0x6b')]('cf_%d',_0x32b916['id']);}));}})['then'](handleEntityNotFound(_0x55f013,null))[_0xdd90('0x20')](respondWithResult(_0x55f013,null))[_0xdd90('0x24')](handleError(_0x55f013,null));};exports['update']=function(_0x975969,_0x34790c){var _0x43ac1e;if(_0x975969[_0xdd90('0x35')]['id']){delete _0x975969[_0xdd90('0x35')]['id'];}if(!_[_0xdd90('0x55')](_0x975969[_0xdd90('0x35')][_0xdd90('0x56')])){var _0x186928=_0x975969[_0xdd90('0x35')][_0xdd90('0x56')];if(!_[_0xdd90('0x55')](shared[_0xdd90('0x58')][_0x186928]))_0x975969[_0xdd90('0x35')][_0xdd90('0x57')]=shared[_0xdd90('0x58')][_0x186928]['utcOffset'];}return db[_0xdd90('0x25')][_0xdd90('0x26')]({'where':{'id':_0x975969[_0xdd90('0x27')]['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x34790c,null))[_0xdd90('0x20')](saveUpdates(_0x975969[_0xdd90('0x35')],null))[_0xdd90('0x20')](function(_0x36d8e1){_0x43ac1e=_0x36d8e1;var _0xe71da3={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x36d8e1&&_0x36d8e1['ListId']){if(_0x36d8e1['ListId']){_0xe71da3[_0xdd90('0x5c')][_0xdd90('0x6c')][_0xdd90('0x5e')]({'ListId':{'$ne':_0x36d8e1[_0xdd90('0x5f')]}});}}return db['CmCustomField']['findAll'](_0xe71da3);})[_0xdd90('0x20')](function(_0x1edfa9){if(_0x1edfa9){return _[_0xdd90('0x6d')](_[_0xdd90('0x6e')](_0x975969[_0xdd90('0x35')],function(_0x378a2c,_0x41d473){return _[_0xdd90('0x2b')](_0x41d473,_0xdd90('0x2f'));}),_[_0xdd90('0x6f')](_0x1edfa9,function(_0x4a9ad4){return util['format'](_0xdd90('0x70'),_0x4a9ad4['id']);}));}})[_0xdd90('0x20')](function(_0x4852ed){if(_0x4852ed&&!_['isEmpty'](_0x4852ed)){var _0x5e75c9=squel['update']()[_0xdd90('0x71')]('cm_contacts')[_0xdd90('0x72')](_0x4852ed)[_0xdd90('0x5c')](_0xdd90('0x73'),_0x975969[_0xdd90('0x27')]['id'])[_0xdd90('0x74')]();return db[_0xdd90('0x69')]['query'](_0x5e75c9[_0xdd90('0x75')],{'replacements':_0x5e75c9[_0xdd90('0x76')]});}})['then'](function(){if(_0x975969[_0xdd90('0x35')][_0xdd90('0x77')]&&_0x43ac1e){return db[_0xdd90('0x3c')]['update']({'phone':_0x975969['body']['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x43ac1e['id']}});}})[_0xdd90('0x20')](function(){return _0x43ac1e;})[_0xdd90('0x20')](respondWithResult(_0x34790c,null))[_0xdd90('0x24')](handleError(_0x34790c,null));};exports[_0xdd90('0x78')]=function(_0x22699c,_0x4cec8e){var _0x2b2916={};var _0x21a961={};var _0x4c8d94;var _0x57ede0;return db[_0xdd90('0x25')][_0xdd90('0x79')]({'where':{'id':_0x22699c[_0xdd90('0x27')]['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x4cec8e,null))[_0xdd90('0x20')](function(_0x2c94ef){if(_0x2c94ef){_0x4c8d94=_0x2c94ef;_0x21a961['model']=_[_0xdd90('0x29')](db[_0xdd90('0x64')][_0xdd90('0x7a')]);_0x21a961[_0xdd90('0x22')]=_[_0xdd90('0x29')](_0x22699c[_0xdd90('0x22')]);_0x21a961[_0xdd90('0x7b')]=_[_0xdd90('0x7c')](_0x21a961[_0xdd90('0x7d')],_0x21a961[_0xdd90('0x22')]);_0x2b2916[_0xdd90('0x7e')]=_[_0xdd90('0x7c')](_0x21a961['model'],qs[_0xdd90('0x7f')](_0x22699c[_0xdd90('0x22')][_0xdd90('0x7f')]));_0x2b2916[_0xdd90('0x7e')]=_0x2b2916[_0xdd90('0x7e')][_0xdd90('0x2a')]?_0x2b2916['attributes']:_0x21a961[_0xdd90('0x7d')];_0x2b2916[_0xdd90('0x80')]=qs[_0xdd90('0x81')](_0x22699c[_0xdd90('0x22')][_0xdd90('0x81')]);_0x2b2916[_0xdd90('0x5c')]=qs['filters'](_[_0xdd90('0x82')](_0x22699c[_0xdd90('0x22')],_0x21a961['filters']));if(_0x22699c[_0xdd90('0x22')][_0xdd90('0x83')]){_0x2b2916['where']=_['merge'](_0x2b2916[_0xdd90('0x5c')],{'$or':_[_0xdd90('0x6f')](_0x2b2916[_0xdd90('0x7e')],function(_0x5afc91){var _0x4ca376={};_0x4ca376[_0x5afc91]={'$like':'%'+_0x22699c['query']['filter']+'%'};return _0x4ca376;})});}_0x2b2916=_['merge']({},_0x2b2916,_0x22699c[_0xdd90('0x84')]);return _0x4c8d94[_0xdd90('0x78')](_0x2b2916);}})[_0xdd90('0x20')](function(_0x107e88){if(_0x107e88){_0x57ede0=_0x107e88[_0xdd90('0x2a')];if(!_0x22699c[_0xdd90('0x22')]['hasOwnProperty'](_0xdd90('0x85'))){_0x2b2916[_0xdd90('0x13')]=qs[_0xdd90('0x13')](_0x22699c[_0xdd90('0x22')][_0xdd90('0x13')]);_0x2b2916['offset']=qs[_0xdd90('0x12')](_0x22699c[_0xdd90('0x22')][_0xdd90('0x12')]);}return _0x4c8d94[_0xdd90('0x78')](_0x2b2916);}})[_0xdd90('0x20')](function(_0x48e988){if(_0x48e988){return _0x48e988?{'count':_0x57ede0,'rows':_0x48e988}:null;}})['then'](respondWithResult(_0x4cec8e,null))[_0xdd90('0x24')](handleError(_0x4cec8e,null));};exports[_0xdd90('0x86')]=function(_0xbd0859,_0x10e40b){if(_0xbd0859[_0xdd90('0x35')]['id']){delete _0xbd0859[_0xdd90('0x35')]['id'];}return db[_0xdd90('0x25')][_0xdd90('0x79')]({'where':{'id':_0xbd0859[_0xdd90('0x27')]['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x10e40b,null))['then'](function(_0x22a95d){if(_0x22a95d){return _0x22a95d[_0xdd90('0x86')](_0xbd0859[_0xdd90('0x35')][_0xdd90('0x87')]||[]);}return null;})['then'](respondWithResult(_0x10e40b,null))[_0xdd90('0x24')](handleError(_0x10e40b,null));};exports[_0xdd90('0x88')]=function(_0x2819c7,_0x5a12d3){var _0x514563=[];_0x514563['push'](addAdditionalPhones(_0x2819c7['body']));Promise['all'](_0x514563)[_0xdd90('0x20')](function(){_0x514563=[];_0x514563[_0xdd90('0x5e')](deleteCmHopperPhones(_0x2819c7[_0xdd90('0x35')]['id']));_0x514563[_0xdd90('0x5e')](addCmHopperPhones(_0x2819c7[_0xdd90('0x35')]['id']));Promise[_0xdd90('0x63')](_0x514563)['then'](function(){return[0x1];})[_0xdd90('0x20')](respondWithResult(_0x5a12d3,null));});};function addAdditionalPhones(_0x106114){var _0x182960;return new Promise(function(_0x1d11d1){return db[_0xdd90('0x49')]['destroy']({'where':{'CmContactId':_0x106114['id']}})[_0xdd90('0x20')](function(){db[_0xdd90('0x68')][_0xdd90('0x21')]({'raw':!![],'attributes':['id',_0xdd90('0x89')]})[_0xdd90('0x20')](function(_0x1e03ca){var _0x1e10c5=[];for(var _0x18b4b8=0x0;_0x18b4b8<_0x106114[_0xdd90('0x8a')][_0xdd90('0x2a')];_0x18b4b8++){var _0x365cfe=_0x106114[_0xdd90('0x8b')]?_[_0xdd90('0x55')](_0x106114[_0xdd90('0x8b')][_0x18b4b8])?'':_0x106114['item_types'][_0x18b4b8]:_0x106114[_0xdd90('0x8a')][_0x18b4b8][_0xdd90('0x8c')]?_0x106114['items'][_0x18b4b8]['ItemTypeId']:'';var _0x409ee6=_[_0xdd90('0x55')](_0x106114['items'][_0x18b4b8]['description'])?'':_0x106114[_0xdd90('0x8a')][_0x18b4b8][_0xdd90('0x8d')];var _0x2486a5=_0x365cfe+':'+_0x106114[_0xdd90('0x8a')][_0x18b4b8]['phone']+'§'+_0x409ee6;if(_[_0xdd90('0x55')](_0x182960))_0x182960=_0x2486a5;else _0x182960+=';'+_0x2486a5;var _0x194b6c=null;var _0x4b57fe=null;if(_0x106114[_0xdd90('0x8b')]){if(!_[_0xdd90('0x55')](_0x106114['item_types'][_0x18b4b8])){_0x4b57fe=_[_0xdd90('0x26')](_0x1e03ca,function(_0x439ea3){return _0x439ea3['id']===_0x106114['item_types'][_0x18b4b8];});if(!_[_0xdd90('0x55')](_0x4b57fe)){_0x194b6c=_0x4b57fe[_0xdd90('0x89')];}}}else{if(!_[_0xdd90('0x55')](_0x106114[_0xdd90('0x8a')][_0x18b4b8])){_0x4b57fe=_[_0xdd90('0x26')](_0x1e03ca,function(_0x2e62){return _0x2e62['id']===_0x106114[_0xdd90('0x8a')][_0x18b4b8][_0xdd90('0x8c')];});if(!_['isNil'](_0x4b57fe)){_0x194b6c=_0x18b4b8;}}}if(_[_0xdd90('0x55')](_0x194b6c)){_0x194b6c=0x64;}_0x1e10c5[_0xdd90('0x5e')](addAdditionalPhone(_0x106114['id'],_0x106114[_0xdd90('0x8a')][_0x18b4b8][_0xdd90('0x77')],_0x106114[_0xdd90('0x8b')]?_[_0xdd90('0x55')](_0x106114[_0xdd90('0x8b')][_0x18b4b8])?null:_0x106114[_0xdd90('0x8b')][_0x18b4b8]:_0x106114['items'][_0x18b4b8][_0xdd90('0x8c')]?_0x106114[_0xdd90('0x8a')][_0x18b4b8][_0xdd90('0x8c')]:null,_0x194b6c,_0x409ee6));}Promise[_0xdd90('0x63')](_0x1e10c5)[_0xdd90('0x20')](function(){db[_0xdd90('0x25')][_0xdd90('0x18')]({'AdditionalPhones':_0x182960},{'where':{'id':_0x106114['id']}})[_0xdd90('0x20')](function(){_0x1d11d1(0x1);});});});});});}function addAdditionalPhone(_0x34bfc1,_0x5bcd99,_0x4f2f18,_0x1f5190,_0x3a9fec){return db[_0xdd90('0x49')][_0xdd90('0x26')]({'where':{'CmContactId':_0x34bfc1,'item':_0x5bcd99}})[_0xdd90('0x20')](function(_0x3f2bfe){if(_0x3f2bfe)logger['info']('contact\x20phone\x20exists',_0x3f2bfe);else{db['CmContactHasItem'][_0xdd90('0x40')]({'CmContactId':_0x34bfc1,'item':_0x5bcd99,'ItemTypeId':_0x4f2f18,'OrderBy':_0x1f5190,'ItemClass':_0xdd90('0x8e'),'description':_0x3a9fec});}});}function deleteCmHopperPhones(_0x190107){return new Promise(function(_0x2c493b){return db[_0xdd90('0x3c')][_0xdd90('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x190107}})['then'](function(_0x1025a9){db[_0xdd90('0x8f')][_0xdd90('0x19')]({'where':{'CmHopperId':{'$in':_[_0xdd90('0x6f')](_0x1025a9,'id')}}});})[_0xdd90('0x20')](function(){_0x2c493b(0x1);});});}function addCmHopperPhones(_0x4806b9){return new Promise(function(_0x3017b3){return db[_0xdd90('0x3c')][_0xdd90('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4806b9}})[_0xdd90('0x20')](function(_0x93785d){var _0x553556=[];_['map'](_0x93785d,function(_0x366f82){_0x553556[_0xdd90('0x5e')](createCmHopperPhone(_0x4806b9,_0x366f82['id']));});Promise[_0xdd90('0x63')](_0x553556)[_0xdd90('0x20')](function(){_0x3017b3(0x1);});});});}function createCmHopperPhone(_0x3deee2,_0x14facd){return new Promise(function(_0x56082b){db[_0xdd90('0x49')][_0xdd90('0x21')]({'raw':!![],'attributes':[_0xdd90('0x90'),'OrderBy'],'where':{'CmContactId':_0x3deee2,'ItemClass':_0xdd90('0x8e')},'include':[{'model':db[_0xdd90('0x68')],'attributes':[_0xdd90('0x89')],'as':_0xdd90('0x91')}],'order':[_0xdd90('0x89'),db[_0xdd90('0x69')]['literal'](_0xdd90('0x92'))]})['then'](function(_0x2c5e25){var _0x3168e6=0x1;var _0x101df8=_['map'](_0x2c5e25,function(_0x46b15a){_0x46b15a['CmHopperId']=_0x14facd;_0x46b15a[_0xdd90('0x77')]=_0x46b15a[_0xdd90('0x90')];_0x46b15a['OrderBy']=_0x3168e6;delete _0x46b15a['ItemType.OrderBy'];_0x3168e6=_0x3168e6+0x1;return _0x46b15a;});return db['CmHopperAdditionalPhone'][_0xdd90('0x5a')](_0x101df8,{});})[_0xdd90('0x20')](function(){_0x56082b(0x1);});});}function insertAdditionalPhones(_0x7d5c6f,_0x2c3a5b){return new Promise(function(_0xafac87){var _0x375345=[];for(var _0x63ce09=0x0;_0x63ce09<_0x2c3a5b[_0xdd90('0x2a')];_0x63ce09++){var _0x3908cb=_0x2c3a5b[_0x63ce09];_0x375345[_0xdd90('0x5e')](parseContactItemType(_0x3908cb));}Promise['all'](_0x375345)[_0xdd90('0x20')](function(){var _0x367349={'id':_0x7d5c6f['id'],'items':_0x2c3a5b};return addAdditionalPhones(_0x367349)[_0xdd90('0x20')](function(){return addCmHopperPhones(_0x7d5c6f['id']);});})[_0xdd90('0x20')](function(){_0xafac87(_0x7d5c6f);});});}function parseContactItemType(_0x1c9175){return new Promise(function(_0x427253){if(_0x1c9175[_0xdd90('0x34')](_0xdd90('0x8c'))){_0x427253(_0x1c9175);}else{return db[_0xdd90('0x68')][_0xdd90('0x26')]({'where':{'name':_0x1c9175[_0xdd90('0x91')]}})[_0xdd90('0x20')](function(_0x22fa73){if(_[_0xdd90('0x55')](_0x22fa73))_0x1c9175[_0xdd90('0x8c')]=null;else _0x1c9175[_0xdd90('0x8c')]=_0x22fa73['id'];_0x427253(_0x1c9175);});}});}exports[_0xdd90('0x93')]=function(_0x5a021e,_0x2b03f2){return db[_0xdd90('0x49')][_0xdd90('0x21')]({'raw':!![],'where':{'CmContactId':_0x5a021e['params']['id'],'ItemClass':_0xdd90('0x8e')},'include':[{'model':db[_0xdd90('0x68')],'as':_0xdd90('0x91')}],'order':[['OrderBy'],[db[_0xdd90('0x69')][_0xdd90('0x94')](_0xdd90('0x92'))]]})[_0xdd90('0x20')](function(_0x2c5b16){return _0x2c5b16;})['then'](respondWithResult(_0x2b03f2,null))[_0xdd90('0x24')](handleError(_0x2b03f2,null));};exports[_0xdd90('0x95')]=function(_0x4572de,_0x20d8fe){return db['CmContactHasItem'][_0xdd90('0x21')]({'raw':!![],'where':{'CmContactId':_0x4572de[_0xdd90('0x35')][_0xdd90('0x96')]}})[_0xdd90('0x20')](function(_0xd835d2){var _0x24505e=_[_0xdd90('0x6f')](_0xd835d2,function(_0x2a3a2f){_0x2a3a2f[_0xdd90('0x97')]=_0x4572de[_0xdd90('0x35')]['toContactId'];return _0x2a3a2f;});return db[_0xdd90('0x49')][_0xdd90('0x5a')](_0x24505e,{});})['then'](function(){return addCmHopperPhones(_0x4572de[_0xdd90('0x35')][_0xdd90('0x98')]);})[_0xdd90('0x20')](function(){return['ok'];})[_0xdd90('0x20')](respondWithResult(_0x20d8fe,null))[_0xdd90('0x24')](handleError(_0x20d8fe,null));};exports[_0xdd90('0x99')]=function(_0x12053d,_0x1b3a0c){var _0x4f06ce=[];_0x4f06ce[_0xdd90('0x5e')](createCmHopperPhone(_0x12053d[_0xdd90('0x35')]['id'],_0x12053d[_0xdd90('0x35')][_0xdd90('0x9a')]));Promise[_0xdd90('0x63')](_0x4f06ce)[_0xdd90('0x20')](function(){return[0x1];})['then'](respondWithResult(_0x1b3a0c,null));};exports['getHoppers']=function(_0x11e833,_0x33e09e){var _0x58a264={'raw':![],'where':{}};var _0x5a95d1={};var _0x15796e={'count':0x0,'rows':[]};return db[_0xdd90('0x25')][_0xdd90('0x79')]({'where':{'id':_0x11e833['params']['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x33e09e,null))[_0xdd90('0x20')](function(_0x539aa5){if(_0x539aa5){_0x5a95d1[_0xdd90('0x7d')]=_[_0xdd90('0x29')](db[_0xdd90('0x3c')][_0xdd90('0x7a')]);_0x5a95d1[_0xdd90('0x22')]=_[_0xdd90('0x29')](_0x11e833[_0xdd90('0x22')]);_0x5a95d1['filters']=_[_0xdd90('0x7c')](_0x5a95d1[_0xdd90('0x7d')],_0x5a95d1[_0xdd90('0x22')]);_0x58a264['attributes']=_['intersection'](_0x5a95d1[_0xdd90('0x7d')],qs[_0xdd90('0x7f')](_0x11e833[_0xdd90('0x22')][_0xdd90('0x7f')]));_0x58a264[_0xdd90('0x7e')]=_0x58a264[_0xdd90('0x7e')][_0xdd90('0x2a')]?_0x58a264[_0xdd90('0x7e')]:_0x5a95d1[_0xdd90('0x7d')];if(!_0x11e833['query'][_0xdd90('0x34')](_0xdd90('0x85'))){_0x58a264[_0xdd90('0x13')]=qs[_0xdd90('0x13')](_0x11e833[_0xdd90('0x22')][_0xdd90('0x13')]);_0x58a264[_0xdd90('0x12')]=qs[_0xdd90('0x12')](_0x11e833[_0xdd90('0x22')][_0xdd90('0x12')]);}_0x58a264['order']=qs[_0xdd90('0x81')](_0x11e833[_0xdd90('0x22')][_0xdd90('0x81')]);_0x58a264['where']=qs[_0xdd90('0x7b')](_[_0xdd90('0x82')](_0x11e833[_0xdd90('0x22')],_0x5a95d1[_0xdd90('0x7b')]));_0x58a264[_0xdd90('0x5c')]['ContactId']=_0x539aa5['id'];if(_0x11e833['query'][_0xdd90('0x83')]){_0x58a264[_0xdd90('0x5c')]=_['merge'](_0x58a264[_0xdd90('0x5c')],{'$or':_[_0xdd90('0x6f')](_0x58a264[_0xdd90('0x7e')],function(_0x12d6a5){var _0x4fe550={};_0x4fe550[_0x12d6a5]={'$like':'%'+_0x11e833[_0xdd90('0x22')][_0xdd90('0x83')]+'%'};return _0x4fe550;})});}_0x58a264=_['merge']({},_0x58a264,_0x11e833[_0xdd90('0x84')]);return db[_0xdd90('0x3c')][_0xdd90('0x15')]({'where':_0x58a264['where']})[_0xdd90('0x20')](function(_0x3a2c71){_0x15796e[_0xdd90('0x15')]=_0x3a2c71;if(_0x11e833[_0xdd90('0x22')][_0xdd90('0x9b')]){_0x58a264[_0xdd90('0x9c')]=[{'all':!![]}];}return db['CmHopper'][_0xdd90('0x21')](_0x58a264);})[_0xdd90('0x20')](function(_0x215e3c){_0x15796e[_0xdd90('0x9d')]=_0x215e3c;return _0x15796e;});}})[_0xdd90('0x20')](respondWithFilteredResult(_0x33e09e,_0x58a264))[_0xdd90('0x24')](handleError(_0x33e09e,null));};exports[_0xdd90('0x9e')]=function(_0x29ad8a,_0x4a9e6d){var _0x49e5b3={'raw':!![],'where':{}};var _0x1fc25d={};var _0x9f6cb7={'count':0x0,'rows':[]};return db[_0xdd90('0x25')]['findOne']({'where':{'id':_0x29ad8a['params']['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x4a9e6d,null))['then'](function(_0xc65d54){if(_0xc65d54){_0x1fc25d[_0xdd90('0x7d')]=_[_0xdd90('0x29')](db[_0xdd90('0x9f')][_0xdd90('0x7a')]);_0x1fc25d[_0xdd90('0x22')]=_['keys'](_0x29ad8a[_0xdd90('0x22')]);_0x1fc25d[_0xdd90('0x7b')]=_['intersection'](_0x1fc25d[_0xdd90('0x7d')],_0x1fc25d[_0xdd90('0x22')]);_0x49e5b3[_0xdd90('0x7e')]=_[_0xdd90('0x7c')](_0x1fc25d['model'],qs[_0xdd90('0x7f')](_0x29ad8a[_0xdd90('0x22')][_0xdd90('0x7f')]));_0x49e5b3['attributes']=_0x49e5b3['attributes']['length']?_0x49e5b3[_0xdd90('0x7e')]:_0x1fc25d[_0xdd90('0x7d')];if(!_0x29ad8a['query'][_0xdd90('0x34')](_0xdd90('0x85'))){_0x49e5b3[_0xdd90('0x13')]=qs[_0xdd90('0x13')](_0x29ad8a[_0xdd90('0x22')][_0xdd90('0x13')]);_0x49e5b3[_0xdd90('0x12')]=qs[_0xdd90('0x12')](_0x29ad8a[_0xdd90('0x22')][_0xdd90('0x12')]);}_0x49e5b3[_0xdd90('0x80')]=qs[_0xdd90('0x81')](_0x29ad8a['query']['sort']);_0x49e5b3[_0xdd90('0x5c')]=qs['filters'](_[_0xdd90('0x82')](_0x29ad8a[_0xdd90('0x22')],_0x1fc25d[_0xdd90('0x7b')]));_0x49e5b3[_0xdd90('0x5c')]['ContactId']=_0xc65d54['id'];if(_0x29ad8a[_0xdd90('0x22')][_0xdd90('0x83')]){_0x49e5b3[_0xdd90('0x5c')]=_[_0xdd90('0xa0')](_0x49e5b3[_0xdd90('0x5c')],{'$or':_[_0xdd90('0x6f')](_0x49e5b3[_0xdd90('0x7e')],function(_0xc755f9){var _0x5c0651={};_0x5c0651[_0xc755f9]={'$like':'%'+_0x29ad8a[_0xdd90('0x22')][_0xdd90('0x83')]+'%'};return _0x5c0651;})});}_0x49e5b3=_[_0xdd90('0xa0')]({},_0x49e5b3,_0x29ad8a[_0xdd90('0x84')]);return db[_0xdd90('0x9f')][_0xdd90('0x15')]({'where':_0x49e5b3[_0xdd90('0x5c')]})[_0xdd90('0x20')](function(_0x5eeee9){_0x9f6cb7[_0xdd90('0x15')]=_0x5eeee9;if(_0x29ad8a[_0xdd90('0x22')]['includeAll']){_0x49e5b3[_0xdd90('0x9c')]=[{'all':!![]}];}return db[_0xdd90('0x9f')][_0xdd90('0x21')](_0x49e5b3);})[_0xdd90('0x20')](function(_0x1d4d70){_0x9f6cb7[_0xdd90('0x9d')]=_0x1d4d70;return _0x9f6cb7;});}})[_0xdd90('0x20')](respondWithFilteredResult(_0x4a9e6d,_0x49e5b3))[_0xdd90('0x24')](handleError(_0x4a9e6d,null));};exports['getHopperFinals']=function(_0x102d32,_0x5e3094){var _0x1d5ae7={'raw':!![],'where':{}};var _0x75f6cc={};var _0x332657={'count':0x0,'rows':[]};return db[_0xdd90('0x25')][_0xdd90('0x79')]({'where':{'id':_0x102d32['params']['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x5e3094,null))[_0xdd90('0x20')](function(_0x1c260a){if(_0x1c260a){_0x75f6cc[_0xdd90('0x7d')]=_[_0xdd90('0x29')](db[_0xdd90('0x4a')][_0xdd90('0x7a')]);_0x75f6cc['query']=_[_0xdd90('0x29')](_0x102d32[_0xdd90('0x22')]);_0x75f6cc[_0xdd90('0x7b')]=_[_0xdd90('0x7c')](_0x75f6cc[_0xdd90('0x7d')],_0x75f6cc[_0xdd90('0x22')]);_0x1d5ae7[_0xdd90('0x7e')]=_[_0xdd90('0x7c')](_0x75f6cc[_0xdd90('0x7d')],qs[_0xdd90('0x7f')](_0x102d32['query'][_0xdd90('0x7f')]));_0x1d5ae7['attributes']=_0x1d5ae7[_0xdd90('0x7e')]['length']?_0x1d5ae7[_0xdd90('0x7e')]:_0x75f6cc[_0xdd90('0x7d')];if(!_0x102d32['query']['hasOwnProperty'](_0xdd90('0x85'))){_0x1d5ae7['limit']=qs['limit'](_0x102d32[_0xdd90('0x22')][_0xdd90('0x13')]);_0x1d5ae7['offset']=qs[_0xdd90('0x12')](_0x102d32['query'][_0xdd90('0x12')]);}_0x1d5ae7[_0xdd90('0x80')]=qs[_0xdd90('0x81')](_0x102d32['query']['sort']);_0x1d5ae7[_0xdd90('0x5c')]=qs['filters'](_['pick'](_0x102d32[_0xdd90('0x22')],_0x75f6cc[_0xdd90('0x7b')]));_0x1d5ae7[_0xdd90('0x5c')]['ContactId']=_0x1c260a['id'];if(_0x102d32[_0xdd90('0x22')]['filter']){_0x1d5ae7[_0xdd90('0x5c')]=_['merge'](_0x1d5ae7[_0xdd90('0x5c')],{'$or':_[_0xdd90('0x6f')](_0x1d5ae7[_0xdd90('0x7e')],function(_0x84ff6f){var _0x2a0908={};_0x2a0908[_0x84ff6f]={'$like':'%'+_0x102d32[_0xdd90('0x22')][_0xdd90('0x83')]+'%'};return _0x2a0908;})});}_0x1d5ae7=_[_0xdd90('0xa0')]({},_0x1d5ae7,_0x102d32[_0xdd90('0x84')]);return db[_0xdd90('0x4a')]['count']({'where':_0x1d5ae7[_0xdd90('0x5c')]})[_0xdd90('0x20')](function(_0x1878ac){_0x332657[_0xdd90('0x15')]=_0x1878ac;if(_0x102d32[_0xdd90('0x22')][_0xdd90('0x9b')]){_0x1d5ae7[_0xdd90('0x9c')]=[{'all':!![]}];}return db[_0xdd90('0x4a')][_0xdd90('0x21')](_0x1d5ae7);})[_0xdd90('0x20')](function(_0x51593c){_0x332657[_0xdd90('0x9d')]=_0x51593c;return _0x332657;});}})[_0xdd90('0x20')](respondWithFilteredResult(_0x5e3094,_0x1d5ae7))[_0xdd90('0x24')](handleError(_0x5e3094,null));};exports[_0xdd90('0xa1')]=function(_0x7bc468,_0x4935be){var _0x20f519={'raw':!![],'where':{}};var _0x2a95d2={};var _0x4c022a={'count':0x0,'rows':[]};return db[_0xdd90('0x25')][_0xdd90('0x79')]({'where':{'id':_0x7bc468[_0xdd90('0x27')]['id']}})[_0xdd90('0x20')](handleEntityNotFound(_0x4935be,null))['then'](function(_0x1382e7){if(_0x1382e7){_0x2a95d2[_0xdd90('0x7d')]=_[_0xdd90('0x29')](db[_0xdd90('0xa2')]['rawAttributes']);_0x2a95d2['query']=_[_0xdd90('0x29')](_0x7bc468[_0xdd90('0x22')]);_0x2a95d2['filters']=_['intersection'](_0x2a95d2['model'],_0x2a95d2[_0xdd90('0x22')]);_0x20f519[_0xdd90('0x7e')]=_[_0xdd90('0x7c')](_0x2a95d2[_0xdd90('0x7d')],qs['fields'](_0x7bc468[_0xdd90('0x22')]['fields']));_0x20f519[_0xdd90('0x7e')]=_0x20f519[_0xdd90('0x7e')][_0xdd90('0x2a')]?_0x20f519[_0xdd90('0x7e')]:_0x2a95d2[_0xdd90('0x7d')];if(!_0x7bc468[_0xdd90('0x22')][_0xdd90('0x34')](_0xdd90('0x85'))){_0x20f519['limit']=qs[_0xdd90('0x13')](_0x7bc468[_0xdd90('0x22')]['limit']);_0x20f519[_0xdd90('0x12')]=qs[_0xdd90('0x12')](_0x7bc468[_0xdd90('0x22')][_0xdd90('0x12')]);}_0x20f519[_0xdd90('0x80')]=qs['sort'](_0x7bc468['query']['sort']);_0x20f519[_0xdd90('0x5c')]=qs[_0xdd90('0x7b')](_[_0xdd90('0x82')](_0x7bc468[_0xdd90('0x22')],_0x2a95d2[_0xdd90('0x7b')]));_0x20f519[_0xdd90('0x5c')][_0xdd90('0xa3')]=_0x1382e7['id'];if(_0x7bc468[_0xdd90('0x22')][_0xdd90('0x83')]){_0x20f519[_0xdd90('0x5c')]=_[_0xdd90('0xa0')](_0x20f519[_0xdd90('0x5c')],{'$or':_['map'](_0x20f519['attributes'],function(_0x59045b){var _0x4bb99a={};_0x4bb99a[_0x59045b]={'$like':'%'+_0x7bc468[_0xdd90('0x22')]['filter']+'%'};return _0x4bb99a;})});}_0x20f519=_[_0xdd90('0xa0')]({},_0x20f519,_0x7bc468[_0xdd90('0x84')]);return db[_0xdd90('0xa2')][_0xdd90('0x15')]({'where':_0x20f519[_0xdd90('0x5c')]})[_0xdd90('0x20')](function(_0x278ebb){_0x4c022a[_0xdd90('0x15')]=_0x278ebb;if(_0x7bc468['query'][_0xdd90('0x9b')]){_0x20f519[_0xdd90('0x9c')]=[{'all':!![]}];}return db[_0xdd90('0xa2')]['findAll'](_0x20f519);})[_0xdd90('0x20')](function(_0x5b591f){_0x4c022a['rows']=_0x5b591f;return _0x4c022a;});}})[_0xdd90('0x20')](respondWithFilteredResult(_0x4935be,_0x20f519))['catch'](handleError(_0x4935be,null));};exports[_0xdd90('0xa4')]=function(_0x329fd5,_0x245d85){try{if(!_0x329fd5['body'][_0xdd90('0x5f')]){throw new Error(_0xdd90('0xa5'));}if(!_0x329fd5['body'][_0xdd90('0xa6')]){throw new Error(_0xdd90('0xa7'));}if(!_0x329fd5[_0xdd90('0x35')][_0xdd90('0xa8')]){throw new Error(_0xdd90('0xa9'));}if(!_0x329fd5[_0xdd90('0x35')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x10dea6=_0x329fd5[_0xdd90('0x35')][_0xdd90('0xa6')][_0xdd90('0xaa')](',');var _0x47ca00=_0x329fd5[_0xdd90('0x35')][_0xdd90('0xa8')][_0xdd90('0xaa')](',');if(!_0x10dea6['length']||!_0x47ca00['length']||_0x10dea6['length']!==_0x47ca00[_0xdd90('0x2a')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x329fd5['body'][_0xdd90('0x7f')]=_['zipObject'](_0x10dea6,_0x47ca00);if(!_0x329fd5[_0xdd90('0x35')][_0xdd90('0x7f')][_0xdd90('0x77')]){throw new Error(_0xdd90('0xab'));}if(!_0x329fd5[_0xdd90('0x35')][_0xdd90('0x7f')][_0xdd90('0xac')]){throw new Error(_0xdd90('0xad'));}var _0x4fe736=path['join'](config[_0xdd90('0xae')],_0xdd90('0xaf'),_0x329fd5[_0xdd90('0xb0')][_0xdd90('0xb1')]);fs[_0xdd90('0xb2')](_0x4fe736,parseInt('0777',0x8));var _0x228918=require(_0xdd90('0xb3'))[_0xdd90('0xb4')](path['join'](__dirname,_0xdd90('0xb5')),[_0x4fe736,_0x329fd5['body'][_0xdd90('0xa6')],_0x329fd5['body'][_0xdd90('0xa8')],_0x329fd5['body'][_0xdd90('0x5f')],_0x329fd5['body'][_0xdd90('0xb6')],_0x329fd5[_0xdd90('0x35')][_0xdd90('0x5b')],_0x329fd5[_0xdd90('0x35')][_0xdd90('0xb7')]]);return _0x245d85[_0xdd90('0x10')](0xc8)[_0xdd90('0x11')]({'message':_0xdd90('0xb8'),'pid':_0x228918[_0xdd90('0xb9')]});}catch(_0xa4ebaf){return _0x245d85[_0xdd90('0x10')](0x1f4)[_0xdd90('0x1e')](_0xa4ebaf);}};exports['upload']=function(_0x334de5,_0x50e222){var _0x2c2165=fs[_0xdd90('0xba')](_0x334de5[_0xdd90('0xb0')][_0xdd90('0x3')]);Papa[_0xdd90('0xbb')](_0x2c2165,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x183283){return _0x50e222['status'](0xc8)[_0xdd90('0x11')]({'file':_0x334de5[_0xdd90('0xb0')],'fields':_0x183283['meta'][_0xdd90('0x7f')]});}});};exports[_0xdd90('0xbc')]=function(_0x59c4c8,_0x29bc70){return db[_0xdd90('0xbd')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xdd90('0xbe')}})[_0xdd90('0x20')](function(_0x313690){var _0x2aa73f=![];if(!_0x59c4c8['body'][_0xdd90('0x5f')]){throw new Error(_0xdd90('0xa5'));}if(!_0x59c4c8['body'][_0xdd90('0xbf')]['phone']){throw new Error(_0xdd90('0xab'));}if(!_0x59c4c8[_0xdd90('0x35')][_0xdd90('0xbf')][_0xdd90('0xac')]){throw new Error(_0xdd90('0xad'));}if(!_0x59c4c8[_0xdd90('0x35')][_0xdd90('0xb7')]){throw new Error(_0xdd90('0xc0'));}var _0x1a4fa5=require(_0xdd90('0xb3'))['fork'](path[_0xdd90('0x3a')](__dirname,_0xdd90('0xc1')),[_0x59c4c8[_0xdd90('0x27')]['id'],JSON[_0xdd90('0xc2')](_0x59c4c8[_0xdd90('0x35')]),JSON['stringify'](_0x313690)]);_0x1a4fa5['on'](_0xdd90('0xc3'),function(){_0x2aa73f=!![];return _0x29bc70[_0xdd90('0x10')](0xc8)[_0xdd90('0x11')]({'message':_0xdd90('0xc4'),'pid':_0x1a4fa5[_0xdd90('0xb9')]});});_0x1a4fa5['on']('exit',function(_0x5b30cc){if(_0x5b30cc&&!_0x2aa73f){return _0x29bc70[_0xdd90('0x10')](0x1f4)[_0xdd90('0x11')]({'message':_0xdd90('0xc5'),'pid':_0x1a4fa5['pid']});}});})[_0xdd90('0x24')](handleError(_0x29bc70,null));};exports['importUpdates']=function(_0x4bc897,_0x25f638){return db['User'][_0xdd90('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xdd90('0xbe')}})[_0xdd90('0x20')](function(_0x4cb5f5){var _0x174e06=![];if(!_0x4bc897[_0xdd90('0x35')][_0xdd90('0x5f')]){throw new Error(_0xdd90('0xa5'));}if(!_0x4bc897['body'][_0xdd90('0xbf')][_0xdd90('0x77')]){throw new Error(_0xdd90('0xab'));}if(!_0x4bc897[_0xdd90('0x35')][_0xdd90('0xbf')]['firstName']){throw new Error(_0xdd90('0xad'));}if(!_0x4bc897[_0xdd90('0x35')][_0xdd90('0xb7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x611330=require('child_process')['fork'](path[_0xdd90('0x3a')](__dirname,_0xdd90('0xc6')),[_0x4bc897[_0xdd90('0x27')]['id'],JSON[_0xdd90('0xc2')](_0x4bc897[_0xdd90('0x35')]),JSON['stringify'](_0x4cb5f5)]);_0x611330['on'](_0xdd90('0xc3'),function(){_0x174e06=!![];return _0x25f638[_0xdd90('0x10')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x611330[_0xdd90('0xb9')]});});_0x611330['on'](_0xdd90('0xc7'),function(_0x4bdbfe){if(_0x4bdbfe&&!_0x174e06){return _0x25f638[_0xdd90('0x10')](0x1f4)[_0xdd90('0x11')]({'message':_0xdd90('0xc5'),'pid':_0x611330[_0xdd90('0xb9')]});}});})[_0xdd90('0x24')](handleError(_0x25f638,null));};exports[_0xdd90('0xc8')]=function(_0xb76df0,_0x1bb466){var _0x31009e=['mail',_0xdd90('0xc9'),'sms',_0xdd90('0xca'),'fax',_0xdd90('0xcb'),_0xdd90('0xcc')];var _0x3358aa={'offset':0x0,'order':qs[_0xdd90('0x81')](_0xdd90('0xcd'))},_0x2cc85a={'count':0x0,'rows':[]};Promise['resolve']()[_0xdd90('0x20')](function(){if(_0xb76df0[_0xdd90('0x22')][_0xdd90('0xce')]){if(!_[_0xdd90('0xcf')](_0x31009e,_0xb76df0[_0xdd90('0x22')][_0xdd90('0xce')][_0xdd90('0xd0')]())){throw new Error(_0xdd90('0xd1'));}_0x31009e=[_0xb76df0[_0xdd90('0x22')][_0xdd90('0xce')][_0xdd90('0xd0')]()];}if(_0xb76df0[_0xdd90('0x22')][_0xdd90('0xd2')]){try{var _0x688e9d=JSON[_0xdd90('0xbb')](_0xb76df0[_0xdd90('0x22')][_0xdd90('0xd2')]);if(!moment(_0x688e9d[_0xdd90('0x36')])[_0xdd90('0xd3')]()){throw new Error(_0xdd90('0xd4'));}if(!moment(_0x688e9d['to'])[_0xdd90('0xd3')]()){throw new Error(_0xdd90('0xd5'));}}catch(_0x416f83){throw new Error(_0xdd90('0xd6'));}}if(!_0xb76df0['query'][_0xdd90('0x34')](_0xdd90('0x85'))){_0x3358aa[_0xdd90('0x13')]=qs[_0xdd90('0x13')](_0xb76df0[_0xdd90('0x22')][_0xdd90('0x13')]||0xa);_0x3358aa[_0xdd90('0x12')]=qs[_0xdd90('0x12')](_0xb76df0['query']['offset']);}var _0x43f975=_0x31009e[_0xdd90('0x6f')](function(_0x3f0e46){if(_0x3f0e46===_0xdd90('0xcc')){var _0x58f850={'attributes':['id',_0xdd90('0xd7'),_0xdd90('0x31'),_0xdd90('0xd8'),_0xdd90('0xd9'),_0xdd90('0xda'),_0xdd90('0xdb'),_0xdd90('0xdc'),_0xdd90('0xdd'),_0xdd90('0xde'),'createdAt',_0xdd90('0xdf'),_0xdd90('0xe0'),'userThirdDisposition',_0xdd90('0xe1')],'where':{'ContactId':_0xb76df0[_0xdd90('0x27')]['id']},'include':[{'model':db[_0xdd90('0xbd')],'as':_0xdd90('0xbd'),'attributes':['id','name',_0xdd90('0xe2'),_0xdd90('0xe3')]}],'order':[['createdAt',_0xdd90('0xe4')]]};if(_0xb76df0[_0xdd90('0x22')]['range']){_0x58f850[_0xdd90('0x5c')][_0xdd90('0xe5')]={'$gte':_0x688e9d['from'],'$lte':_0x688e9d['to']};}return db[_0xdd90('0x4c')]['findAndCountAll'](_0x58f850)[_0xdd90('0x20')](function(_0x1e4f38){_0x2cc85a[_0xdd90('0x15')]+=_0x1e4f38['count'];return _[_0xdd90('0x6f')](_0x1e4f38['rows'],function(_0x4c11d3){var _0x46125e=_0x4c11d3[_0xdd90('0x37')]({'plain':!![]});_0x46125e[_0xdd90('0xce')]=_0x3f0e46;if(_0x46125e['User']){_0x46125e['User']={'id':_0x46125e[_0xdd90('0xbd')]['id'],'name':_0x46125e['User'][_0xdd90('0x1d')],'fullname':_0x46125e[_0xdd90('0xbd')]['fullname'],'alias':_0x46125e[_0xdd90('0xbd')][_0xdd90('0xe3')]};}return _0x46125e;});});}else{var _0x30da30=_[_0xdd90('0xe6')](_0x3f0e46)+(_0x3f0e46===_0xdd90('0xc9')?'Website':'Account');var _0x2c4d3b={'attributes':['id',_0xdd90('0xe7'),_0xdd90('0xe8'),'createdAt',_0xdd90('0xde'),_0xdd90('0xe9'),_0xdd90('0xea'),_0xdd90('0xeb'),_0xdd90('0xe1'),_0x30da30+'Id'],'where':{'ContactId':_0xb76df0[_0xdd90('0x27')]['id']},'include':[{'model':db[_0x30da30],'as':_0xdd90('0xec'),'attributes':['id',_0xdd90('0x1d'),_0xdd90('0xed')]},{'model':db[_0xdd90('0xbd')],'as':'Owner','attributes':['id',_0xdd90('0x1d'),_0xdd90('0xe2')]},{'model':db[_0xdd90('0x64')],'as':'Tags','attributes':['id','name',_0xdd90('0x66')],'through':{'attributes':[]}}],'order':[[_0xdd90('0xe5'),'DESC']]};if(_0xb76df0[_0xdd90('0x22')][_0xdd90('0xd2')]){_0x2c4d3b['where'][_0xdd90('0xe5')]={'$gte':_0x688e9d[_0xdd90('0x36')],'$lte':_0x688e9d['to']};}switch(_0x3f0e46){case _0xdd90('0xc9'):_0x2c4d3b[_0xdd90('0x7e')][_0xdd90('0x5e')](_0xdd90('0xee'),_0xdd90('0xef'),_0xdd90('0xf0'),_0xdd90('0xf1'),'osName',_0xdd90('0xf2'),_0xdd90('0xf3'),_0xdd90('0xf4'),_0xdd90('0xf5'));break;case _0xdd90('0xf6'):_0x2c4d3b['attributes'][_0xdd90('0x5e')](_0xdd90('0xf7'),_0xdd90('0xf8'));break;case _0xdd90('0xca'):_0x2c4d3b['attributes'][_0xdd90('0x5e')](_0xdd90('0xf9'),_0xdd90('0xfa'));break;}return db[_[_0xdd90('0xe6')](_0x3f0e46)+_0xdd90('0xfb')][_0xdd90('0xfc')](_0x2c4d3b)['then'](function(_0x1e2b93){_0x2cc85a['count']+=_0x1e2b93[_0xdd90('0x15')];return _[_0xdd90('0x6f')](_0x1e2b93[_0xdd90('0x9d')],function(_0x24a785){var _0x22ded8=_0x24a785[_0xdd90('0x37')]({'plain':!![]});_0x22ded8[_0xdd90('0xce')]=_0x3f0e46;if(_0x22ded8[_0xdd90('0xfd')]){_0x22ded8[_0xdd90('0xfd')]={'id':_0x22ded8[_0xdd90('0xfd')]['id'],'name':_0x22ded8['Owner'][_0xdd90('0x1d')],'fullname':_0x22ded8[_0xdd90('0xfd')][_0xdd90('0xe2')]};}return _0x22ded8;});});}});return Promise['all'](_0x43f975);})[_0xdd90('0x20')](function(_0xcd847d){return _(_0xcd847d)[_0xdd90('0xfe')]()[_0xdd90('0xff')](_0xdd90('0xe5'))[_0xdd90('0x100')]()[_0xdd90('0x101')]();})[_0xdd90('0x20')](function(_0x524e62){_0x2cc85a[_0xdd90('0x9d')]=_0x3358aa[_0xdd90('0x13')]?_0x524e62['slice'](_0x3358aa['offset'],_0x3358aa['offset']+_0x3358aa['limit']):_0x524e62;return _0x2cc85a;})[_0xdd90('0x20')](respondWithFilteredResult(_0x1bb466,_0x3358aa))[_0xdd90('0x24')](handleError(_0x1bb466,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index e205964..b06aacc 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 _0x8c9a=['hook','exports','events','../../mysqldb','CmContact','setMaxListeners','update','remove','emit'];(function(_0xf5f512,_0x131ec0){var _0x1940c9=function(_0x3e6795){while(--_0x3e6795){_0xf5f512['push'](_0xf5f512['shift']());}};_0x1940c9(++_0x131ec0);}(_0x8c9a,0x158));var _0xa8c9=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8c9a[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0xa8c9('0x0'));var CmContact=require(_0xa8c9('0x1'))['db'][_0xa8c9('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xa8c9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa8c9('0x4'),'afterDestroy':_0xa8c9('0x5')};function emitEvent(_0x484357){return function(_0x530cd7,_0x59ebc9,_0x36cedd){CmContactEvents[_0xa8c9('0x6')](_0x484357+':'+_0x530cd7['id'],_0x530cd7);CmContactEvents[_0xa8c9('0x6')](_0x484357,_0x530cd7);_0x36cedd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xa8c9('0x7')](e,emitEvent(event));}}module[_0xa8c9('0x8')]=CmContactEvents; \ No newline at end of file +var _0x209d=['events','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4d3941,_0x5b0bc0){var _0x5c311b=function(_0x2df585){while(--_0x2df585){_0x4d3941['push'](_0x4d3941['shift']());}};_0x5c311b(++_0x5b0bc0);}(_0x209d,0x190));var _0xd209=function(_0x99919b,_0x561853){_0x99919b=_0x99919b-0x0;var _0xdf31d3=_0x209d[_0x99919b];return _0xdf31d3;};'use strict';var EventEmitter=require(_0xd209('0x0'));var CmContact=require('../../mysqldb')['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd209('0x1'),'afterUpdate':_0xd209('0x2'),'afterDestroy':_0xd209('0x3')};function emitEvent(_0x1fed94){return function(_0x2f2d2e,_0xbb4423,_0x25d02e){CmContactEvents[_0xd209('0x4')](_0x1fed94+':'+_0x2f2d2e['id'],_0x2f2d2e);CmContactEvents[_0xd209('0x4')](_0x1fed94,_0x2f2d2e);_0x25d02e(null);};}for(var e in events){if(events[_0xd209('0x5')](e)){var event=events[e];CmContact[_0xd209('0x6')](e,emitEvent(event));}}module[_0xd209('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index a57474c..0b93e5e 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 _0xf3d8=['lastName','fax','email','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','timezones','utcOffset','add','minutes','then','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','afterCreate','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','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','Lists','length','dialCheckDuplicateType','always','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','message','CmHopperBlack','List\x20not\x20found','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','phone','fti_cm_contacts','firstName'];(function(_0x3bd90a,_0x556542){var _0x4d8431=function(_0x49b1d7){while(--_0x49b1d7){_0x3bd90a['push'](_0x3bd90a['shift']());}};_0x4d8431(++_0x556542);}(_0xf3d8,0x167));var _0x8f3d=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0xf3d8[_0x582d0b];return _0x2e93e1;};'use strict';var _=require(_0x8f3d('0x0'));var util=require(_0x8f3d('0x1'));var logger=require(_0x8f3d('0x2'))(_0x8f3d('0x3'));var moment=require(_0x8f3d('0x4'));var BPromise=require(_0x8f3d('0x5'));var rp=require(_0x8f3d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8f3d('0x7'));var shared=require(_0x8f3d('0x8'));var attributes=require(_0x8f3d('0x9'));module[_0x8f3d('0xa')]=function(_0x33e430,_0x5b1daa){return _0x33e430[_0x8f3d('0xb')]('CmContact',attributes,{'tableName':_0x8f3d('0xc'),'paranoid':!![],'indexes':[{'name':_0x8f3d('0xd'),'fields':[_0x8f3d('0xd')]},{'name':_0x8f3d('0xe'),'fields':[_0x8f3d('0xf'),_0x8f3d('0x10'),'phone','mobile',_0x8f3d('0x11'),_0x8f3d('0x12')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x8f3d('0x13'),'collate':_0x8f3d('0x14'),'hooks':{'afterCreate':function(_0x4a6065,_0x3ede64,_0xc4edec){var _0xcc5901=_0x33e430[_0x8f3d('0x15')];var _0x510a1d=_0x4a6065[_0x8f3d('0x16')]({'plain':!![]});function _0x4b86c8(){return function(_0x320728){logger[_0x8f3d('0x17')](_0x8f3d('0x18'),'afterCreate',util[_0x8f3d('0x19')](_0x320728,{'showHidden':![],'depth':null}));};}function _0x4e871e(_0x2c0c71,_0x1510f7){var _0x403b01=_0x1510f7[_0x8f3d('0x1a')]?_0x1510f7[_0x8f3d('0x1a')]:moment()[_0x8f3d('0x1b')](_0x8f3d('0x1c'));return new BPromise(function(_0x4556cf,_0x52bca7){if(_[_0x8f3d('0x1d')](_0x1510f7[_0x8f3d('0x1e')])){_0x4556cf({'ret':_0x403b01});}else{_0xcc5901[_0x8f3d('0x1f')][_0x8f3d('0x20')]({'where':{'id':_0x2c0c71['id']}})['then'](function(_0x497bc3){if(!_[_0x8f3d('0x1d')](_0x497bc3)){var _0x519e5e=_0x497bc3[_0x8f3d('0x1e')];if(!_[_0x8f3d('0x1d')](_0x519e5e)){var _0x5510fe=shared[_0x8f3d('0x21')];var _0x5e696f=_0x5510fe[_0x519e5e];var _0xcfa740=_0x5510fe[_0x1510f7['dialTimezone']];if(!_['isNil'](_0x5e696f)&&!_['isNil'](_0xcfa740)){var _0x4289b3=_0x5e696f['utcOffset']-_0xcfa740[_0x8f3d('0x22')];_0x403b01=_0x1510f7[_0x8f3d('0x1a')]?_0x1510f7[_0x8f3d('0x1a')]:moment();var _0xbd3c85=moment(_0x403b01)[_0x8f3d('0x23')](_0x4289b3,_0x8f3d('0x24'));_0x4556cf({'ret':_0xbd3c85[_0x8f3d('0x1b')](_0x8f3d('0x1c'))});}else _0x4556cf({'ret':_0x403b01});}else _0x4556cf({'ret':_0x403b01});}else{_0x4556cf({'ret':_0x403b01});}});}});return 0xa;}var _0x3a58d6=function(_0x49888e){return new BPromise(function(_0x15b168,_0x56f189){_0x4e871e(_0x49888e,_0x510a1d)[_0x8f3d('0x25')](function(_0x5b69c6){_0x510a1d['scheduledat']=_0x5b69c6[_0x8f3d('0x26')];_0xcc5901[_0x8f3d('0x27')][_0x8f3d('0x20')]({'where':{'phone':_0x510a1d[_0x8f3d('0xd')],'VoiceQueueId':_0x49888e['id']}})[_0x8f3d('0x25')](function(_0x36fc68){if(!_[_0x8f3d('0x1d')](_0x36fc68)){throw new Error(_0x8f3d('0x28')+_0x510a1d['phone']+_0x8f3d('0x29')+_0x49888e['id']);}return _0xcc5901[_0x8f3d('0x27')][_0x8f3d('0x2a')]({'phone':_0x510a1d['phone'],'ContactId':_0x510a1d['id'],'ListId':_0x510a1d[_0x8f3d('0x2b')],'priority':_0x510a1d[_0x8f3d('0x2c')]?_0x510a1d[_0x8f3d('0x2c')]:0x2,'scheduledat':_0x510a1d[_0x8f3d('0x1a')]?_0x510a1d['scheduledat']:moment()[_0x8f3d('0x1b')](_0x8f3d('0x1c')),'callback':_0x510a1d['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x510a1d[_0x8f3d('0x2d')]?_0x510a1d['callbackUniqueid']:undefined,'callbackat':_0x510a1d[_0x8f3d('0x2d')]?moment()[_0x8f3d('0x1b')](_0x8f3d('0x1c')):undefined,'VoiceQueueId':_0x49888e['id']});})[_0x8f3d('0x2e')](function(_0x4a3aeb){_0x56f189(_0x4a3aeb);});});});};var _0x2a9338=function(_0x4c28f8){return new BPromise(function(_0x48acb9,_0x4d1b44){_0x4e871e(_0x4c28f8,_0x510a1d)[_0x8f3d('0x25')](function(_0x3f9f82){_0x510a1d[_0x8f3d('0x1a')]=_0x3f9f82[_0x8f3d('0x26')];_0xcc5901['CmHopper'][_0x8f3d('0x20')]({'where':{'phone':_0x510a1d[_0x8f3d('0xd')],'VoiceQueueId':_0x4c28f8['id']}})['then'](function(_0x4facb2){if(!_[_0x8f3d('0x1d')](_0x4facb2)){throw new Error(_0x8f3d('0x28')+_0x510a1d[_0x8f3d('0xd')]+_0x8f3d('0x2f')+_0x4c28f8['id']);}return _0xcc5901[_0x8f3d('0x30')][_0x8f3d('0x20')]({'where':{'calleridnum':_0x510a1d[_0x8f3d('0xd')],'VoiceQueueId':_0x4c28f8['id']}});})[_0x8f3d('0x25')](function(_0x11f3ee){if(!_['isNil'](_0x11f3ee)){throw new Error(_0x8f3d('0x31')+_0x510a1d[_0x8f3d('0xd')]+_0x8f3d('0x32')+_0x4c28f8['id']);}return _0xcc5901[_0x8f3d('0x27')]['create']({'phone':_0x510a1d[_0x8f3d('0xd')],'ContactId':_0x510a1d['id'],'ListId':_0x510a1d[_0x8f3d('0x2b')],'priority':_0x510a1d['priority']?_0x510a1d['priority']:0x2,'scheduledat':_0x510a1d[_0x8f3d('0x1a')]?_0x510a1d[_0x8f3d('0x1a')]:moment()[_0x8f3d('0x1b')](_0x8f3d('0x1c')),'callback':_0x510a1d[_0x8f3d('0x2d')]?!![]:![],'callbackuniqueid':_0x510a1d[_0x8f3d('0x2d')]?_0x510a1d[_0x8f3d('0x2d')]:undefined,'callbackat':_0x510a1d[_0x8f3d('0x2d')]?moment()[_0x8f3d('0x1b')](_0x8f3d('0x1c')):undefined,'VoiceQueueId':_0x4c28f8['id']});})[_0x8f3d('0x2e')](function(_0x2894a4){_0x4d1b44(_0x2894a4);});});});};function _0x228d88(){return function(_0x2362ac){logger[_0x8f3d('0x17')](_0x8f3d('0x18'),_0x8f3d('0x33'),util[_0x8f3d('0x19')](_0x2362ac,{'showHidden':![],'depth':null}));};}function _0x2a1770(_0x32d14,_0x7eab21){var _0x20c4d7=_0x7eab21[_0x8f3d('0x1a')]?_0x7eab21[_0x8f3d('0x1a')]:moment()[_0x8f3d('0x1b')](_0x8f3d('0x1c'));return new BPromise(function(_0x4a653d,_0x17a8bd){if(_[_0x8f3d('0x1d')](_0x7eab21[_0x8f3d('0x1e')])){_0x4a653d({'ret':_0x20c4d7});}else{_0xcc5901[_0x8f3d('0x34')][_0x8f3d('0x20')]({'where':{'id':_0x32d14['id']}})['then'](function(_0x75e682){if(!_[_0x8f3d('0x1d')](_0x75e682)){var _0x471fed=_0x75e682[_0x8f3d('0x1e')];if(!_[_0x8f3d('0x1d')](_0x471fed)){var _0x36f206=shared[_0x8f3d('0x21')];var _0x5ecd95=_0x36f206[_0x471fed];var _0x1406c3=_0x36f206[_0x7eab21[_0x8f3d('0x1e')]];if(!_['isNil'](_0x5ecd95)&&!_['isNil'](_0x1406c3)){var _0x5b190e=_0x5ecd95[_0x8f3d('0x22')]-_0x1406c3[_0x8f3d('0x22')];_0x20c4d7=_0x7eab21['scheduledat']?_0x7eab21[_0x8f3d('0x1a')]:moment();var _0x30bdf5=moment(_0x20c4d7)[_0x8f3d('0x23')](_0x5b190e,'minutes');_0x4a653d({'ret':_0x30bdf5[_0x8f3d('0x1b')](_0x8f3d('0x1c'))});}else _0x4a653d({'ret':_0x20c4d7});}else _0x4a653d({'ret':_0x20c4d7});}else{_0x4a653d({'ret':_0x20c4d7});}});}});return 0xa;}var _0x32d3bf=function(_0x4a3418){return new BPromise(function(_0xf53c04,_0x18c3fe){_0x2a1770(_0x4a3418,_0x510a1d)[_0x8f3d('0x25')](function(_0x243ed0){_0x510a1d['scheduledat']=_0x243ed0[_0x8f3d('0x26')];_0xcc5901[_0x8f3d('0x27')][_0x8f3d('0x20')]({'where':{'phone':_0x510a1d[_0x8f3d('0xd')],'CampaignId':_0x4a3418['id']}})[_0x8f3d('0x25')](function(_0x4f36fa){if(!_[_0x8f3d('0x1d')](_0x4f36fa)){throw new Error(_0x8f3d('0x28')+_0x510a1d['phone']+_0x8f3d('0x35')+_0x4a3418['id']);}return _0xcc5901[_0x8f3d('0x27')][_0x8f3d('0x2a')]({'phone':_0x510a1d[_0x8f3d('0xd')],'ContactId':_0x510a1d['id'],'ListId':_0x510a1d[_0x8f3d('0x2b')],'priority':_0x510a1d[_0x8f3d('0x2c')]?_0x510a1d[_0x8f3d('0x2c')]:0x2,'scheduledat':_0x510a1d[_0x8f3d('0x1a')]?_0x510a1d['scheduledat']:moment()[_0x8f3d('0x1b')](_0x8f3d('0x1c')),'callback':_0x510a1d[_0x8f3d('0x2d')]?!![]:![],'callbackuniqueid':_0x510a1d[_0x8f3d('0x2d')]?_0x510a1d['callbackUniqueid']:undefined,'callbackat':_0x510a1d[_0x8f3d('0x2d')]?moment()[_0x8f3d('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x4a3418['id']});})[_0x8f3d('0x2e')](function(_0x424656){_0x18c3fe(_0x424656);});});});};var _0x1bfcab=function(_0x19e15f){return new BPromise(function(_0x2266a8,_0x274d6e){_0x2a1770(_0x19e15f,_0x510a1d)[_0x8f3d('0x25')](function(_0x42b885){_0x510a1d[_0x8f3d('0x1a')]=_0x42b885[_0x8f3d('0x26')];_0xcc5901[_0x8f3d('0x27')]['findOne']({'where':{'phone':_0x510a1d[_0x8f3d('0xd')],'CampaignId':_0x19e15f['id']}})[_0x8f3d('0x25')](function(_0x531115){if(!_['isNil'](_0x531115)){throw new Error(_0x8f3d('0x28')+_0x510a1d[_0x8f3d('0xd')]+_0x8f3d('0x36')+_0x19e15f['id']);}return _0xcc5901[_0x8f3d('0x30')][_0x8f3d('0x20')]({'where':{'calleridnum':_0x510a1d[_0x8f3d('0xd')],'CampaignId':_0x19e15f['id']}});})['then'](function(_0x55cdbc){if(!_[_0x8f3d('0x1d')](_0x55cdbc)){throw new Error(_0x8f3d('0x31')+_0x510a1d[_0x8f3d('0xd')]+_0x8f3d('0x37')+_0x19e15f['id']);}return _0xcc5901['CmHopper']['create']({'phone':_0x510a1d[_0x8f3d('0xd')],'ContactId':_0x510a1d['id'],'ListId':_0x510a1d[_0x8f3d('0x2b')],'priority':_0x510a1d[_0x8f3d('0x2c')]?_0x510a1d[_0x8f3d('0x2c')]:0x2,'scheduledat':_0x510a1d[_0x8f3d('0x1a')]?_0x510a1d[_0x8f3d('0x1a')]:moment()['format'](_0x8f3d('0x1c')),'callback':_0x510a1d[_0x8f3d('0x2d')]?!![]:![],'callbackuniqueid':_0x510a1d[_0x8f3d('0x2d')]?_0x510a1d['callbackUniqueid']:undefined,'callbackat':_0x510a1d[_0x8f3d('0x2d')]?moment()['format'](_0x8f3d('0x1c')):undefined,'CampaignId':_0x19e15f['id']});})['catch'](function(_0x572358){_0x274d6e(_0x572358);});});});};if(_0x510a1d[_0x8f3d('0x2b')]){_0xcc5901[_0x8f3d('0x1f')][_0x8f3d('0x38')]({'where':{'type':_0x8f3d('0x39')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0xcc5901['CmList'],'as':_0x8f3d('0x3a'),'where':{'id':_0x510a1d['ListId']}}]})['then'](function(_0x4a5211){if(_0x4a5211){var _0x4fd54e=[];for(var _0x59077d=0x0,_0x5c2cf6;_0x59077d<_0x4a5211[_0x8f3d('0x3b')];_0x59077d+=0x1){_0x5c2cf6=_0x4a5211[_0x59077d]['get']({'plain':!![]});switch(_0x5c2cf6[_0x8f3d('0x3c')]){case _0x8f3d('0x3d'):_0x2a9338(_0x5c2cf6)[_0x8f3d('0x2e')](_0x4b86c8());break;case _0x8f3d('0x3e'):_0x3a58d6(_0x5c2cf6)['catch'](_0x4b86c8());break;default:_0x2a1770(_0x5c2cf6,_0x510a1d)[_0x8f3d('0x25')](function(_0x350f7b){_0x510a1d[_0x8f3d('0x1a')]=_0x350f7b[_0x8f3d('0x26')];_0xcc5901[_0x8f3d('0x27')][_0x8f3d('0x2a')]({'phone':_0x510a1d[_0x8f3d('0xd')],'ContactId':_0x510a1d['id'],'ListId':_0x510a1d[_0x8f3d('0x2b')],'scheduledat':_0x510a1d[_0x8f3d('0x1a')]?_0x510a1d[_0x8f3d('0x1a')]:moment()[_0x8f3d('0x1b')](_0x8f3d('0x1c')),'priority':_0x510a1d[_0x8f3d('0x2c')]?_0x510a1d[_0x8f3d('0x2c')]:0x2,'callback':_0x510a1d[_0x8f3d('0x2d')]?!![]:![],'callbackuniqueid':_0x510a1d[_0x8f3d('0x2d')]?_0x510a1d[_0x8f3d('0x2d')]:undefined,'callbackat':_0x510a1d['callbackUniqueid']?moment()['format'](_0x8f3d('0x1c')):undefined,'VoiceQueueId':_0x5c2cf6['id']})[_0x8f3d('0x2e')](_0x4b86c8());});}}}})[_0x8f3d('0x25')](function(){return _0xcc5901[_0x8f3d('0x1f')]['findAll']({'where':{'type':_0x8f3d('0x39')},'attributes':['id'],'include':[{'model':_0xcc5901['CmList'],'as':_0x8f3d('0x3f'),'where':{'id':_0x510a1d[_0x8f3d('0x2b')]}}]})['then'](function(_0x3167fb){if(_0x3167fb){var _0x56e450=[];for(var _0x2cfa8f=0x0,_0x2835a4;_0x2cfa8f<_0x3167fb[_0x8f3d('0x3b')];_0x2cfa8f+=0x1){_0x2835a4=_0x3167fb[_0x2cfa8f][_0x8f3d('0x16')]({'plain':!![]});_0xcc5901['CmHopperBlack'][_0x8f3d('0x2a')]({'phone':_0x510a1d['phone'],'ContactId':_0x510a1d['id'],'ListId':_0x510a1d[_0x8f3d('0x2b')],'VoiceQueueId':_0x2835a4['id']})[_0x8f3d('0x2e')](function(_0xc77db0){logger[_0x8f3d('0x17')](_0x8f3d('0x40'),_0x8f3d('0x33'),_0xc77db0[_0x8f3d('0x41')]);});}}});})[_0x8f3d('0x25')](function(){return _0xcc5901[_0x8f3d('0x34')][_0x8f3d('0x38')]({'attributes':['id','dialCheckDuplicateType',_0x8f3d('0x1e')],'include':[{'model':_0xcc5901['CmList'],'as':'Lists','where':{'id':_0x510a1d[_0x8f3d('0x2b')]}}]})['then'](function(_0x13a773){if(_0x13a773){var _0x49526d=[];for(var _0x1d8543=0x0,_0x51f345;_0x1d8543<_0x13a773[_0x8f3d('0x3b')];_0x1d8543+=0x1){_0x51f345=_0x13a773[_0x1d8543][_0x8f3d('0x16')]({'plain':!![]});switch(_0x51f345[_0x8f3d('0x3c')]){case'always':_0x1bfcab(_0x51f345)[_0x8f3d('0x2e')](_0x228d88());break;case _0x8f3d('0x3e'):_0x32d3bf(_0x51f345)['catch'](_0x228d88());break;default:_0xcc5901['CmHopper'][_0x8f3d('0x2a')]({'phone':_0x510a1d['phone'],'ContactId':_0x510a1d['id'],'ListId':_0x510a1d['ListId'],'scheduledat':_0x510a1d[_0x8f3d('0x1a')]?_0x510a1d[_0x8f3d('0x1a')]:moment()[_0x8f3d('0x1b')](_0x8f3d('0x1c')),'priority':_0x510a1d['priority']?_0x510a1d[_0x8f3d('0x2c')]:0x2,'callback':_0x510a1d[_0x8f3d('0x2d')]?!![]:![],'callbackuniqueid':_0x510a1d[_0x8f3d('0x2d')]?_0x510a1d[_0x8f3d('0x2d')]:undefined,'callbackat':_0x510a1d[_0x8f3d('0x2d')]?moment()['format'](_0x8f3d('0x1c')):undefined,'CampaignId':_0x51f345['id']})[_0x8f3d('0x2e')](_0x228d88());}}}});})[_0x8f3d('0x25')](function(){return _0xcc5901[_0x8f3d('0x34')][_0x8f3d('0x38')]({'attributes':['id'],'include':[{'model':_0xcc5901['CmList'],'as':_0x8f3d('0x3f'),'where':{'id':_0x510a1d[_0x8f3d('0x2b')]}}]})[_0x8f3d('0x25')](function(_0x1e3221){if(_0x1e3221){var _0x4cbb96=[];for(var _0x2d12bc=0x0,_0x214c58;_0x2d12bc<_0x1e3221[_0x8f3d('0x3b')];_0x2d12bc+=0x1){_0x214c58=_0x1e3221[_0x2d12bc]['get']({'plain':!![]});_0xcc5901[_0x8f3d('0x42')][_0x8f3d('0x2a')]({'phone':_0x510a1d[_0x8f3d('0xd')],'ContactId':_0x510a1d['id'],'ListId':_0x510a1d[_0x8f3d('0x2b')],'CampaignId':_0x214c58['id']})[_0x8f3d('0x2e')](function(_0xb60eb8){logger[_0x8f3d('0x17')](_0x8f3d('0x40'),'afterCreate',_0xb60eb8[_0x8f3d('0x41')]);});}}});})[_0x8f3d('0x25')](function(){_0xc4edec();})[_0x8f3d('0x2e')](function(_0x5129e9){logger['error'](_0x8f3d('0x40'),_0x8f3d('0x33'),_0x5129e9[_0x8f3d('0x41')]);_0xc4edec(_0x5129e9);});}else{_0xc4edec(new Error(_0x8f3d('0x43')));}},'afterDestroy':function(_0x5d1723,_0x3bc91e,_0x358614){var _0x228f1a=_0x33e430[_0x8f3d('0x15')];var _0x242b36=_0x5d1723[_0x8f3d('0x16')]({'plain':!![]});return _0x228f1a[_0x8f3d('0x27')][_0x8f3d('0x38')]({'raw':!![],'where':{'ListId':_0x242b36[_0x8f3d('0x2b')],'ContactId':_0x242b36['id']}})[_0x8f3d('0x25')](function(_0x3784e0){if(!_['isEmpty'](_0x3784e0)){var _0x1c9f6c=[];for(var _0x7cfc82=0x0;_0x7cfc82<_0x3784e0[_0x8f3d('0x3b')];_0x7cfc82+=0x1){var _0x460a3f=_0x228f1a[_0x8f3d('0x27')]['destroy']({'where':{'ListId':_0x3784e0[_0x7cfc82][_0x8f3d('0x2b')],'ContactId':_0x3784e0[_0x7cfc82][_0x8f3d('0x44')],'VoiceQueueId':_0x3784e0[_0x7cfc82][_0x8f3d('0x45')],'CampaignId':_0x3784e0[_0x7cfc82][_0x8f3d('0x46')]}});_0x1c9f6c[_0x8f3d('0x47')](_0x460a3f);}return BPromise[_0x8f3d('0x48')](_0x1c9f6c);}})[_0x8f3d('0x25')](function(_0x3ebed6){logger[_0x8f3d('0x49')]('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x3ebed6,{'showHidden':![],'depth':null}));_0x358614();})[_0x8f3d('0x2e')](function(_0x3725c2){logger[_0x8f3d('0x17')](_0x8f3d('0x4a'),util[_0x8f3d('0x19')](_0x3725c2,{'showHidden':![],'depth':null}));_0x358614(_0x3725c2);});}}});}; \ No newline at end of file +var _0x4af3=['CmHopperBlack','List\x20not\x20found','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Error]','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','scheduledat','format','dialTimezone','VoiceQueue','findOne','then','isNil','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','afterCreate','inspect','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','dialCheckDuplicateType','CmList','Lists','length','onlyIfOpen','outbound','BlackLists','cmContact,\x20%s,\x20%s','message','Campaign'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0x4af3,0x135));var _0x34af=function(_0xe4e303,_0x8f9657){_0xe4e303=_0xe4e303-0x0;var _0x39021e=_0x4af3[_0xe4e303];return _0x39021e;};'use strict';var _=require('lodash');var util=require(_0x34af('0x0'));var logger=require(_0x34af('0x1'))(_0x34af('0x2'));var moment=require(_0x34af('0x3'));var BPromise=require(_0x34af('0x4'));var rp=require(_0x34af('0x5'));var fs=require('fs');var path=require(_0x34af('0x6'));var rimraf=require('rimraf');var config=require(_0x34af('0x7'));var shared=require(_0x34af('0x8'));var attributes=require(_0x34af('0x9'));module[_0x34af('0xa')]=function(_0x1bb8a5,_0x593e68){return _0x1bb8a5[_0x34af('0xb')](_0x34af('0xc'),attributes,{'tableName':_0x34af('0xd'),'paranoid':!![],'indexes':[{'name':_0x34af('0xe'),'fields':['phone']},{'name':_0x34af('0xf'),'fields':[_0x34af('0x10'),'lastName',_0x34af('0xe'),_0x34af('0x11'),_0x34af('0x12'),'email'],'type':_0x34af('0x13')}],'timestamps':!![],'charset':_0x34af('0x14'),'collate':_0x34af('0x15'),'hooks':{'afterCreate':function(_0x12b8a7,_0x12f8e9,_0x2c5fef){var _0x19a62d=_0x1bb8a5[_0x34af('0x16')];var _0x1b18bb=_0x12b8a7[_0x34af('0x17')]({'plain':!![]});function _0x2b9ef1(){return function(_0x301f66){logger[_0x34af('0x18')](_0x34af('0x19'),'afterCreate',util['inspect'](_0x301f66,{'showHidden':![],'depth':null}));};}function _0x4db957(_0x4f60e7,_0x1d541c){var _0x270a70=_0x1d541c[_0x34af('0x1a')]?_0x1d541c[_0x34af('0x1a')]:moment()[_0x34af('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x49208d,_0x3cd380){if(_['isNil'](_0x1d541c[_0x34af('0x1c')])){_0x49208d({'ret':_0x270a70});}else{_0x19a62d[_0x34af('0x1d')][_0x34af('0x1e')]({'where':{'id':_0x4f60e7['id']}})[_0x34af('0x1f')](function(_0xd69dc6){if(!_[_0x34af('0x20')](_0xd69dc6)){var _0x89e614=_0xd69dc6[_0x34af('0x1c')];if(!_['isNil'](_0x89e614)){var _0x1f0b6f=shared['timezones'];var _0x210ca7=_0x1f0b6f[_0x89e614];var _0x2a36d0=_0x1f0b6f[_0x1d541c[_0x34af('0x1c')]];if(!_[_0x34af('0x20')](_0x210ca7)&&!_[_0x34af('0x20')](_0x2a36d0)){var _0x3a5352=_0x210ca7[_0x34af('0x21')]-_0x2a36d0[_0x34af('0x21')];_0x270a70=_0x1d541c[_0x34af('0x1a')]?_0x1d541c[_0x34af('0x1a')]:moment();var _0xf9b3c9=moment(_0x270a70)[_0x34af('0x22')](_0x3a5352,_0x34af('0x23'));_0x49208d({'ret':_0xf9b3c9[_0x34af('0x1b')](_0x34af('0x24'))});}else _0x49208d({'ret':_0x270a70});}else _0x49208d({'ret':_0x270a70});}else{_0x49208d({'ret':_0x270a70});}});}});return 0xa;}var _0x2cf00a=function(_0x4239f9){return new BPromise(function(_0x475d9a,_0x1aad3a){_0x4db957(_0x4239f9,_0x1b18bb)[_0x34af('0x1f')](function(_0x2780bb){_0x1b18bb['scheduledat']=_0x2780bb[_0x34af('0x25')];_0x19a62d['CmHopper']['findOne']({'where':{'phone':_0x1b18bb[_0x34af('0xe')],'VoiceQueueId':_0x4239f9['id']}})[_0x34af('0x1f')](function(_0x30f85d){if(!_[_0x34af('0x20')](_0x30f85d)){throw new Error(_0x34af('0x26')+_0x1b18bb[_0x34af('0xe')]+_0x34af('0x27')+_0x4239f9['id']);}return _0x19a62d[_0x34af('0x28')][_0x34af('0x29')]({'phone':_0x1b18bb[_0x34af('0xe')],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb['ListId'],'priority':_0x1b18bb[_0x34af('0x2a')]?_0x1b18bb[_0x34af('0x2a')]:0x2,'scheduledat':_0x1b18bb[_0x34af('0x1a')]?_0x1b18bb[_0x34af('0x1a')]:moment()['format'](_0x34af('0x24')),'callback':_0x1b18bb[_0x34af('0x2b')]?!![]:![],'callbackuniqueid':_0x1b18bb[_0x34af('0x2b')]?_0x1b18bb[_0x34af('0x2b')]:undefined,'callbackat':_0x1b18bb[_0x34af('0x2b')]?moment()[_0x34af('0x1b')](_0x34af('0x24')):undefined,'VoiceQueueId':_0x4239f9['id']});})[_0x34af('0x2c')](function(_0x5c0ba6){_0x1aad3a(_0x5c0ba6);});});});};var _0x3db42d=function(_0x50c7c8){return new BPromise(function(_0xda5ac,_0x536fd6){_0x4db957(_0x50c7c8,_0x1b18bb)[_0x34af('0x1f')](function(_0xe42833){_0x1b18bb[_0x34af('0x1a')]=_0xe42833['ret'];_0x19a62d[_0x34af('0x28')][_0x34af('0x1e')]({'where':{'phone':_0x1b18bb['phone'],'VoiceQueueId':_0x50c7c8['id']}})[_0x34af('0x1f')](function(_0x3cdbb6){if(!_[_0x34af('0x20')](_0x3cdbb6)){throw new Error(_0x34af('0x26')+_0x1b18bb['phone']+_0x34af('0x2d')+_0x50c7c8['id']);}return _0x19a62d[_0x34af('0x2e')][_0x34af('0x1e')]({'where':{'calleridnum':_0x1b18bb[_0x34af('0xe')],'VoiceQueueId':_0x50c7c8['id']}});})['then'](function(_0x4938c6){if(!_[_0x34af('0x20')](_0x4938c6)){throw new Error(_0x34af('0x2f')+_0x1b18bb[_0x34af('0xe')]+_0x34af('0x30')+_0x50c7c8['id']);}return _0x19a62d[_0x34af('0x28')][_0x34af('0x29')]({'phone':_0x1b18bb['phone'],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb[_0x34af('0x31')],'priority':_0x1b18bb[_0x34af('0x2a')]?_0x1b18bb[_0x34af('0x2a')]:0x2,'scheduledat':_0x1b18bb['scheduledat']?_0x1b18bb['scheduledat']:moment()[_0x34af('0x1b')](_0x34af('0x24')),'callback':_0x1b18bb[_0x34af('0x2b')]?!![]:![],'callbackuniqueid':_0x1b18bb[_0x34af('0x2b')]?_0x1b18bb['callbackUniqueid']:undefined,'callbackat':_0x1b18bb[_0x34af('0x2b')]?moment()[_0x34af('0x1b')](_0x34af('0x24')):undefined,'VoiceQueueId':_0x50c7c8['id']});})['catch'](function(_0x2b64d7){_0x536fd6(_0x2b64d7);});});});};function _0x176df3(){return function(_0x498616){logger[_0x34af('0x18')](_0x34af('0x19'),_0x34af('0x32'),util[_0x34af('0x33')](_0x498616,{'showHidden':![],'depth':null}));};}function _0x54696b(_0x41796f,_0x375176){var _0x89c242=_0x375176[_0x34af('0x1a')]?_0x375176['scheduledat']:moment()[_0x34af('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x28d2e3,_0x1a746a){if(_[_0x34af('0x20')](_0x375176[_0x34af('0x1c')])){_0x28d2e3({'ret':_0x89c242});}else{_0x19a62d['Campaign']['findOne']({'where':{'id':_0x41796f['id']}})[_0x34af('0x1f')](function(_0x489a89){if(!_['isNil'](_0x489a89)){var _0x19306c=_0x489a89[_0x34af('0x1c')];if(!_[_0x34af('0x20')](_0x19306c)){var _0x1ba1b1=shared[_0x34af('0x34')];var _0x560bee=_0x1ba1b1[_0x19306c];var _0x2db8be=_0x1ba1b1[_0x375176[_0x34af('0x1c')]];if(!_[_0x34af('0x20')](_0x560bee)&&!_[_0x34af('0x20')](_0x2db8be)){var _0x485160=_0x560bee[_0x34af('0x21')]-_0x2db8be[_0x34af('0x21')];_0x89c242=_0x375176[_0x34af('0x1a')]?_0x375176[_0x34af('0x1a')]:moment();var _0x46b4aa=moment(_0x89c242)['add'](_0x485160,_0x34af('0x23'));_0x28d2e3({'ret':_0x46b4aa[_0x34af('0x1b')](_0x34af('0x24'))});}else _0x28d2e3({'ret':_0x89c242});}else _0x28d2e3({'ret':_0x89c242});}else{_0x28d2e3({'ret':_0x89c242});}});}});return 0xa;}var _0x2bab91=function(_0x302115){return new BPromise(function(_0x4825c1,_0x86f06d){_0x54696b(_0x302115,_0x1b18bb)[_0x34af('0x1f')](function(_0x56768b){_0x1b18bb[_0x34af('0x1a')]=_0x56768b[_0x34af('0x25')];_0x19a62d[_0x34af('0x28')][_0x34af('0x1e')]({'where':{'phone':_0x1b18bb[_0x34af('0xe')],'CampaignId':_0x302115['id']}})['then'](function(_0x6f0a76){if(!_[_0x34af('0x20')](_0x6f0a76)){throw new Error(_0x34af('0x26')+_0x1b18bb[_0x34af('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x302115['id']);}return _0x19a62d[_0x34af('0x28')][_0x34af('0x29')]({'phone':_0x1b18bb['phone'],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb['ListId'],'priority':_0x1b18bb[_0x34af('0x2a')]?_0x1b18bb[_0x34af('0x2a')]:0x2,'scheduledat':_0x1b18bb[_0x34af('0x1a')]?_0x1b18bb[_0x34af('0x1a')]:moment()[_0x34af('0x1b')](_0x34af('0x24')),'callback':_0x1b18bb['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1b18bb[_0x34af('0x2b')]?_0x1b18bb[_0x34af('0x2b')]:undefined,'callbackat':_0x1b18bb[_0x34af('0x2b')]?moment()['format'](_0x34af('0x24')):undefined,'CampaignId':_0x302115['id']});})[_0x34af('0x2c')](function(_0x26488b){_0x86f06d(_0x26488b);});});});};var _0x2675d0=function(_0x41e13f){return new BPromise(function(_0x28dd0c,_0x2b2dc3){_0x54696b(_0x41e13f,_0x1b18bb)[_0x34af('0x1f')](function(_0x230ff1){_0x1b18bb[_0x34af('0x1a')]=_0x230ff1[_0x34af('0x25')];_0x19a62d[_0x34af('0x28')][_0x34af('0x1e')]({'where':{'phone':_0x1b18bb[_0x34af('0xe')],'CampaignId':_0x41e13f['id']}})[_0x34af('0x1f')](function(_0xe53ca6){if(!_['isNil'](_0xe53ca6)){throw new Error(_0x34af('0x26')+_0x1b18bb['phone']+_0x34af('0x35')+_0x41e13f['id']);}return _0x19a62d[_0x34af('0x2e')][_0x34af('0x1e')]({'where':{'calleridnum':_0x1b18bb[_0x34af('0xe')],'CampaignId':_0x41e13f['id']}});})['then'](function(_0x2ece57){if(!_[_0x34af('0x20')](_0x2ece57)){throw new Error(_0x34af('0x2f')+_0x1b18bb[_0x34af('0xe')]+_0x34af('0x36')+_0x41e13f['id']);}return _0x19a62d[_0x34af('0x28')][_0x34af('0x29')]({'phone':_0x1b18bb[_0x34af('0xe')],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb[_0x34af('0x31')],'priority':_0x1b18bb[_0x34af('0x2a')]?_0x1b18bb[_0x34af('0x2a')]:0x2,'scheduledat':_0x1b18bb[_0x34af('0x1a')]?_0x1b18bb[_0x34af('0x1a')]:moment()[_0x34af('0x1b')](_0x34af('0x24')),'callback':_0x1b18bb[_0x34af('0x2b')]?!![]:![],'callbackuniqueid':_0x1b18bb['callbackUniqueid']?_0x1b18bb[_0x34af('0x2b')]:undefined,'callbackat':_0x1b18bb[_0x34af('0x2b')]?moment()[_0x34af('0x1b')](_0x34af('0x24')):undefined,'CampaignId':_0x41e13f['id']});})['catch'](function(_0x57b4cd){_0x2b2dc3(_0x57b4cd);});});});};if(_0x1b18bb[_0x34af('0x31')]){_0x19a62d['VoiceQueue'][_0x34af('0x37')]({'where':{'type':'outbound'},'attributes':['id',_0x34af('0x38'),_0x34af('0x1c')],'include':[{'model':_0x19a62d[_0x34af('0x39')],'as':_0x34af('0x3a'),'where':{'id':_0x1b18bb[_0x34af('0x31')]}}]})[_0x34af('0x1f')](function(_0x4b659b){if(_0x4b659b){var _0x393f36=[];for(var _0x19a650=0x0,_0x181caf;_0x19a650<_0x4b659b[_0x34af('0x3b')];_0x19a650+=0x1){_0x181caf=_0x4b659b[_0x19a650][_0x34af('0x17')]({'plain':!![]});switch(_0x181caf[_0x34af('0x38')]){case'always':_0x3db42d(_0x181caf)[_0x34af('0x2c')](_0x2b9ef1());break;case _0x34af('0x3c'):_0x2cf00a(_0x181caf)[_0x34af('0x2c')](_0x2b9ef1());break;default:_0x54696b(_0x181caf,_0x1b18bb)['then'](function(_0x9dc07d){_0x1b18bb[_0x34af('0x1a')]=_0x9dc07d[_0x34af('0x25')];_0x19a62d[_0x34af('0x28')][_0x34af('0x29')]({'phone':_0x1b18bb[_0x34af('0xe')],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb[_0x34af('0x31')],'scheduledat':_0x1b18bb['scheduledat']?_0x1b18bb['scheduledat']:moment()[_0x34af('0x1b')](_0x34af('0x24')),'priority':_0x1b18bb[_0x34af('0x2a')]?_0x1b18bb[_0x34af('0x2a')]:0x2,'callback':_0x1b18bb[_0x34af('0x2b')]?!![]:![],'callbackuniqueid':_0x1b18bb[_0x34af('0x2b')]?_0x1b18bb[_0x34af('0x2b')]:undefined,'callbackat':_0x1b18bb[_0x34af('0x2b')]?moment()[_0x34af('0x1b')](_0x34af('0x24')):undefined,'VoiceQueueId':_0x181caf['id']})[_0x34af('0x2c')](_0x2b9ef1());});}}}})[_0x34af('0x1f')](function(){return _0x19a62d[_0x34af('0x1d')][_0x34af('0x37')]({'where':{'type':_0x34af('0x3d')},'attributes':['id'],'include':[{'model':_0x19a62d[_0x34af('0x39')],'as':_0x34af('0x3e'),'where':{'id':_0x1b18bb[_0x34af('0x31')]}}]})['then'](function(_0x2800c5){if(_0x2800c5){var _0x5cb56e=[];for(var _0x15f6da=0x0,_0x30e1eb;_0x15f6da<_0x2800c5[_0x34af('0x3b')];_0x15f6da+=0x1){_0x30e1eb=_0x2800c5[_0x15f6da]['get']({'plain':!![]});_0x19a62d['CmHopperBlack'][_0x34af('0x29')]({'phone':_0x1b18bb[_0x34af('0xe')],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb[_0x34af('0x31')],'VoiceQueueId':_0x30e1eb['id']})['catch'](function(_0x5f5af8){logger[_0x34af('0x18')](_0x34af('0x3f'),_0x34af('0x32'),_0x5f5af8[_0x34af('0x40')]);});}}});})['then'](function(){return _0x19a62d[_0x34af('0x41')][_0x34af('0x37')]({'attributes':['id',_0x34af('0x38'),_0x34af('0x1c')],'include':[{'model':_0x19a62d[_0x34af('0x39')],'as':_0x34af('0x3a'),'where':{'id':_0x1b18bb['ListId']}}]})[_0x34af('0x1f')](function(_0x3a3329){if(_0x3a3329){var _0x254549=[];for(var _0x40d12c=0x0,_0x3e912b;_0x40d12c<_0x3a3329[_0x34af('0x3b')];_0x40d12c+=0x1){_0x3e912b=_0x3a3329[_0x40d12c][_0x34af('0x17')]({'plain':!![]});switch(_0x3e912b[_0x34af('0x38')]){case'always':_0x2675d0(_0x3e912b)[_0x34af('0x2c')](_0x176df3());break;case'onlyIfOpen':_0x2bab91(_0x3e912b)[_0x34af('0x2c')](_0x176df3());break;default:_0x19a62d[_0x34af('0x28')][_0x34af('0x29')]({'phone':_0x1b18bb['phone'],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb[_0x34af('0x31')],'scheduledat':_0x1b18bb['scheduledat']?_0x1b18bb[_0x34af('0x1a')]:moment()['format'](_0x34af('0x24')),'priority':_0x1b18bb['priority']?_0x1b18bb[_0x34af('0x2a')]:0x2,'callback':_0x1b18bb['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1b18bb[_0x34af('0x2b')]?_0x1b18bb['callbackUniqueid']:undefined,'callbackat':_0x1b18bb['callbackUniqueid']?moment()[_0x34af('0x1b')](_0x34af('0x24')):undefined,'CampaignId':_0x3e912b['id']})[_0x34af('0x2c')](_0x176df3());}}}});})[_0x34af('0x1f')](function(){return _0x19a62d['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x19a62d[_0x34af('0x39')],'as':'BlackLists','where':{'id':_0x1b18bb[_0x34af('0x31')]}}]})[_0x34af('0x1f')](function(_0x3c2b44){if(_0x3c2b44){var _0x54d36b=[];for(var _0x39fbd8=0x0,_0x36460a;_0x39fbd8<_0x3c2b44[_0x34af('0x3b')];_0x39fbd8+=0x1){_0x36460a=_0x3c2b44[_0x39fbd8][_0x34af('0x17')]({'plain':!![]});_0x19a62d[_0x34af('0x42')][_0x34af('0x29')]({'phone':_0x1b18bb[_0x34af('0xe')],'ContactId':_0x1b18bb['id'],'ListId':_0x1b18bb['ListId'],'CampaignId':_0x36460a['id']})['catch'](function(_0x907e61){logger['error'](_0x34af('0x3f'),_0x34af('0x32'),_0x907e61['message']);});}}});})['then'](function(){_0x2c5fef();})[_0x34af('0x2c')](function(_0x28726b){logger[_0x34af('0x18')]('cmContact,\x20%s,\x20%s',_0x34af('0x32'),_0x28726b['message']);_0x2c5fef(_0x28726b);});}else{_0x2c5fef(new Error(_0x34af('0x43')));}},'afterDestroy':function(_0x2f9da2,_0x1f6501,_0x19edde){var _0x2ec0b2=_0x1bb8a5['models'];var _0x2d672e=_0x2f9da2[_0x34af('0x17')]({'plain':!![]});return _0x2ec0b2[_0x34af('0x28')][_0x34af('0x37')]({'raw':!![],'where':{'ListId':_0x2d672e['ListId'],'ContactId':_0x2d672e['id']}})[_0x34af('0x1f')](function(_0x33850c){if(!_['isEmpty'](_0x33850c)){var _0x4a90a6=[];for(var _0xb82a71=0x0;_0xb82a71<_0x33850c['length'];_0xb82a71+=0x1){var _0x352c08=_0x2ec0b2[_0x34af('0x28')][_0x34af('0x44')]({'where':{'ListId':_0x33850c[_0xb82a71][_0x34af('0x31')],'ContactId':_0x33850c[_0xb82a71][_0x34af('0x45')],'VoiceQueueId':_0x33850c[_0xb82a71][_0x34af('0x46')],'CampaignId':_0x33850c[_0xb82a71]['CampaignId']}});_0x4a90a6[_0x34af('0x47')](_0x352c08);}return BPromise[_0x34af('0x48')](_0x4a90a6);}})[_0x34af('0x1f')](function(_0x2813f4){logger[_0x34af('0x49')]('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x2813f4,{'showHidden':![],'depth':null}));_0x19edde();})[_0x34af('0x2c')](function(_0x2b06a1){logger['error'](_0x34af('0x4a'),util[_0x34af('0x33')](_0x2b06a1,{'showHidden':![],'depth':null}));_0x19edde(_0x2b06a1);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 1b7eabd..1e0aa7c 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(_0xf52817,_0x1127d3){var _0x4fef7d=function(_0x5ab922){while(--_0x5ab922){_0xf52817['push'](_0xf52817['shift']());}};_0x4fef7d(++_0x1127d3);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x14a19e,_0x272f60){var _0x3465da=function(_0x30fd27){while(--_0x30fd27){_0x14a19e['push'](_0x14a19e['shift']());}};_0x3465da(++_0x272f60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 9da1b5b..a2c24ea 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 _0x8c25=['INTEGER','STRING','sequelize','exports'];(function(_0x5ce074,_0x548012){var _0x6e06d8=function(_0x3c5988){while(--_0x3c5988){_0x5ce074['push'](_0x5ce074['shift']());}};_0x6e06d8(++_0x548012);}(_0x8c25,0x15e));var _0x58c2=function(_0x27fd77,_0x4ed23f){_0x27fd77=_0x27fd77-0x0;var _0x48a372=_0x8c25[_0x27fd77];return _0x48a372;};'use strict';var Sequelize=require(_0x58c2('0x0'));module[_0x58c2('0x1')]={'CmContactId':{'type':Sequelize[_0x58c2('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x58c2('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x58c2('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x58c2('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x58c2('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x7b05=['STRING','sequelize','exports','INTEGER'];(function(_0x440b28,_0x394b1d){var _0x5e7964=function(_0x38275c){while(--_0x38275c){_0x440b28['push'](_0x440b28['shift']());}};_0x5e7964(++_0x394b1d);}(_0x7b05,0x91));var _0x57b0=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x7b05[_0x34325b];return _0x3da348;};'use strict';var Sequelize=require(_0x57b0('0x0'));module[_0x57b0('0x1')]={'CmContactId':{'type':Sequelize[_0x57b0('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x57b0('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x57b0('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x57b0('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x57b0('0x3')],'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 5928fb6..05f0518 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 _0x18ce=['show','params','rawAttributes','include','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','moment','bluebird','mustache','util','sox','to-csv','fs-extra','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','reject','save','update','then','CmContactHasItems','UserProfileResource','error','name','send','index','CmContactHasItem','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','includeAll','findAll','rows','catch'];(function(_0x4b615f,_0x5ff6f3){var _0x5cb233=function(_0x51a910){while(--_0x51a910){_0x4b615f['push'](_0x4b615f['shift']());}};_0x5cb233(++_0x5ff6f3);}(_0x18ce,0xa6));var _0xe18c=function(_0x49eafb,_0x490b82){_0x49eafb=_0x49eafb-0x0;var _0x2aaa17=_0x18ce[_0x49eafb];return _0x2aaa17;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe18c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe18c('0x1'));var BPromise=require(_0xe18c('0x2'));var Mustache=require(_0xe18c('0x3'));var util=require(_0xe18c('0x4'));var path=require('path');var sox=require(_0xe18c('0x5'));var csv=require(_0xe18c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe18c('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe18c('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe18c('0x9'));var Papa=require('papaparse');var Redis=require(_0xe18c('0xa'));var authService=require(_0xe18c('0xb'));var qs=require(_0xe18c('0xc'));var as=require(_0xe18c('0xd'));var hardwareService=require(_0xe18c('0xe'));var logger=require('../../config/logger')(_0xe18c('0xf'));var utils=require(_0xe18c('0x10'));var config=require(_0xe18c('0x11'));var licenseUtil=require(_0xe18c('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22d240,_0x4e4c6f){_0x4e4c6f=_0x4e4c6f||0xcc;return function(_0x17e47b){if(_0x17e47b){return _0x22d240[_0xe18c('0x13')](_0x4e4c6f);}return _0x22d240[_0xe18c('0x14')](_0x4e4c6f)[_0xe18c('0x15')]();};}function respondWithResult(_0x233b0f,_0x2e4c8a){_0x2e4c8a=_0x2e4c8a||0xc8;return function(_0x35c9ad){if(_0x35c9ad){return _0x233b0f['status'](_0x2e4c8a)[_0xe18c('0x16')](_0x35c9ad);}};}function respondWithFilteredResult(_0x429b9a,_0x573603){return function(_0x19207a){if(_0x19207a){var _0x2f9319=typeof _0x573603[_0xe18c('0x17')]===_0xe18c('0x18')&&typeof _0x573603['limit']==='undefined';var _0x68d2b9=_0x19207a[_0xe18c('0x19')];var _0x87be51=_0x2f9319?0x0:_0x573603[_0xe18c('0x17')];var _0x39f1f7=_0x2f9319?_0x19207a[_0xe18c('0x19')]:_0x573603['offset']+_0x573603[_0xe18c('0x1a')];var _0x1b7141;if(_0x39f1f7>=_0x68d2b9){_0x39f1f7=_0x68d2b9;_0x1b7141=0xc8;}else{_0x1b7141=0xce;}_0x429b9a[_0xe18c('0x14')](_0x1b7141);return _0x429b9a['set']('Content-Range',_0x87be51+'-'+_0x39f1f7+'/'+_0x68d2b9)[_0xe18c('0x16')](_0x19207a);}return null;};}function patchUpdates(_0x34d97a){return function(_0x315f25){try{jsonpatch['apply'](_0x315f25,_0x34d97a,!![]);}catch(_0x30fb78){return BPromise[_0xe18c('0x1b')](_0x30fb78);}return _0x315f25[_0xe18c('0x1c')]();};}function saveUpdates(_0x40f66c,_0xa2f2a){return function(_0x163e5d){if(_0x163e5d){return _0x163e5d[_0xe18c('0x1d')](_0x40f66c)[_0xe18c('0x1e')](function(_0x329238){return _0x329238;});}return null;};}function removeEntity(_0x15efc6,_0x368cd2){return function(_0xc0df52){if(_0xc0df52){return _0xc0df52['destroy']()[_0xe18c('0x1e')](function(){var _0x5c1fc8=_0xc0df52['get']({'plain':!![]});var _0x48d476=_0xe18c('0x1f');return db[_0xe18c('0x20')]['destroy']({'where':{'type':_0x48d476,'resourceId':_0x5c1fc8['id']}})[_0xe18c('0x1e')](function(){return _0xc0df52;});})['then'](function(){_0x15efc6[_0xe18c('0x14')](0xcc)[_0xe18c('0x15')]();});}};}function handleEntityNotFound(_0x4339ef,_0x5090d0){return function(_0x2ed92a){if(!_0x2ed92a){_0x4339ef[_0xe18c('0x13')](0x194);}return _0x2ed92a;};}function handleError(_0x4e9ebb,_0x5b8a57){_0x5b8a57=_0x5b8a57||0x1f4;return function(_0x1831e2){logger[_0xe18c('0x21')](_0x1831e2['stack']);if(_0x1831e2[_0xe18c('0x22')]){delete _0x1831e2[_0xe18c('0x22')];}_0x4e9ebb[_0xe18c('0x14')](_0x5b8a57)[_0xe18c('0x23')](_0x1831e2);};}exports[_0xe18c('0x24')]=function(_0x2fd5a6,_0x120484){var _0x46fcad={},_0x23e630={},_0x2d705a={'count':0x0,'rows':[]};var _0x76531e=_['map'](db[_0xe18c('0x25')]['rawAttributes'],function(_0x482373){return{'name':_0x482373[_0xe18c('0x26')],'type':_0x482373[_0xe18c('0x27')][_0xe18c('0x28')]};});_0x23e630[_0xe18c('0x29')]=_['map'](_0x76531e,_0xe18c('0x22'));_0x23e630['query']=_[_0xe18c('0x2a')](_0x2fd5a6['query']);_0x23e630[_0xe18c('0x2b')]=_['intersection'](_0x23e630[_0xe18c('0x29')],_0x23e630[_0xe18c('0x2c')]);_0x46fcad[_0xe18c('0x2d')]=_[_0xe18c('0x2e')](_0x23e630[_0xe18c('0x29')],qs[_0xe18c('0x2f')](_0x2fd5a6[_0xe18c('0x2c')][_0xe18c('0x2f')]));_0x46fcad[_0xe18c('0x2d')]=_0x46fcad[_0xe18c('0x2d')][_0xe18c('0x30')]?_0x46fcad[_0xe18c('0x2d')]:_0x23e630[_0xe18c('0x29')];if(!_0x2fd5a6[_0xe18c('0x2c')][_0xe18c('0x31')](_0xe18c('0x32'))){_0x46fcad[_0xe18c('0x1a')]=qs[_0xe18c('0x1a')](_0x2fd5a6[_0xe18c('0x2c')][_0xe18c('0x1a')]);_0x46fcad['offset']=qs[_0xe18c('0x17')](_0x2fd5a6['query'][_0xe18c('0x17')]);}_0x46fcad['order']=qs[_0xe18c('0x33')](_0x2fd5a6[_0xe18c('0x2c')][_0xe18c('0x33')]);_0x46fcad[_0xe18c('0x34')]=qs[_0xe18c('0x2b')](_[_0xe18c('0x35')](_0x2fd5a6[_0xe18c('0x2c')],_0x23e630['filters']),_0x76531e);if(_0x2fd5a6['query'][_0xe18c('0x36')]){_0x46fcad[_0xe18c('0x34')]=_['merge'](_0x46fcad[_0xe18c('0x34')],{'$or':_[_0xe18c('0x37')](_0x76531e,function(_0x3e5ecc){if(_0x3e5ecc[_0xe18c('0x27')]!==_0xe18c('0x38')){var _0x21f1c8={};_0x21f1c8[_0x3e5ecc[_0xe18c('0x22')]]={'$like':'%'+_0x2fd5a6[_0xe18c('0x2c')][_0xe18c('0x36')]+'%'};return _0x21f1c8;}})});}_0x46fcad=_[_0xe18c('0x39')]({},_0x46fcad,_0x2fd5a6['options']);var _0x33a1d2={'where':_0x46fcad[_0xe18c('0x34')]};return db[_0xe18c('0x25')][_0xe18c('0x19')](_0x33a1d2)['then'](function(_0x422b3b){_0x2d705a[_0xe18c('0x19')]=_0x422b3b;if(_0x2fd5a6[_0xe18c('0x2c')][_0xe18c('0x3a')]){_0x46fcad['include']=[{'all':!![]}];}return db[_0xe18c('0x25')][_0xe18c('0x3b')](_0x46fcad);})[_0xe18c('0x1e')](function(_0x13ec82){_0x2d705a[_0xe18c('0x3c')]=_0x13ec82;return _0x2d705a;})[_0xe18c('0x1e')](respondWithFilteredResult(_0x120484,_0x46fcad))[_0xe18c('0x3d')](handleError(_0x120484,null));};exports[_0xe18c('0x3e')]=function(_0x41ae70,_0x2772d3){var _0x210a3d={'raw':!![],'where':{'id':_0x41ae70[_0xe18c('0x3f')]['id']}},_0x4b74d5={};_0x4b74d5[_0xe18c('0x29')]=_[_0xe18c('0x2a')](db[_0xe18c('0x25')][_0xe18c('0x40')]);_0x4b74d5[_0xe18c('0x2c')]=_[_0xe18c('0x2a')](_0x41ae70[_0xe18c('0x2c')]);_0x4b74d5[_0xe18c('0x2b')]=_['intersection'](_0x4b74d5[_0xe18c('0x29')],_0x4b74d5['query']);_0x210a3d['attributes']=_[_0xe18c('0x2e')](_0x4b74d5['model'],qs[_0xe18c('0x2f')](_0x41ae70[_0xe18c('0x2c')][_0xe18c('0x2f')]));_0x210a3d['attributes']=_0x210a3d[_0xe18c('0x2d')][_0xe18c('0x30')]?_0x210a3d[_0xe18c('0x2d')]:_0x4b74d5[_0xe18c('0x29')];if(_0x41ae70[_0xe18c('0x2c')]['includeAll']){_0x210a3d[_0xe18c('0x41')]=[{'all':!![]}];}_0x210a3d=_[_0xe18c('0x39')]({},_0x210a3d,_0x41ae70[_0xe18c('0x42')]);return db['CmContactHasItem'][_0xe18c('0x43')](_0x210a3d)['then'](handleEntityNotFound(_0x2772d3,null))[_0xe18c('0x1e')](respondWithResult(_0x2772d3,null))['catch'](handleError(_0x2772d3,null));};exports[_0xe18c('0x44')]=function(_0x3a5189,_0x539a8d){return db[_0xe18c('0x25')]['create'](_0x3a5189[_0xe18c('0x45')],{})[_0xe18c('0x1e')](function(_0x3769b9){var _0x8d733b=_0x3a5189['user'][_0xe18c('0x46')]({'plain':!![]});if(!_0x8d733b)throw new Error(_0xe18c('0x47'));if(_0x8d733b[_0xe18c('0x48')]===_0xe18c('0x49')){var _0x2fff5a=_0x3769b9[_0xe18c('0x46')]({'plain':!![]});var _0x2b1b42=_0xe18c('0x1f');return db['UserProfileSection'][_0xe18c('0x43')]({'where':{'name':_0x2b1b42,'userProfileId':_0x8d733b['userProfileId']},'raw':!![]})['then'](function(_0x4a5f30){if(_0x4a5f30&&_0x4a5f30[_0xe18c('0x4a')]===0x0){return db[_0xe18c('0x20')][_0xe18c('0x44')]({'name':_0x2fff5a[_0xe18c('0x22')],'resourceId':_0x2fff5a['id'],'type':_0x4a5f30['name'],'sectionId':_0x4a5f30['id']},{})[_0xe18c('0x1e')](function(){return _0x3769b9;});}else{return _0x3769b9;}})[_0xe18c('0x3d')](function(_0x9ed626){logger[_0xe18c('0x21')](_0xe18c('0x4b'),_0x9ed626);throw _0x9ed626;});}return _0x3769b9;})[_0xe18c('0x1e')](respondWithResult(_0x539a8d,0xc9))[_0xe18c('0x3d')](handleError(_0x539a8d,null));};exports[_0xe18c('0x1d')]=function(_0x3ffd18,_0x42b731){if(_0x3ffd18[_0xe18c('0x45')]['id']){delete _0x3ffd18[_0xe18c('0x45')]['id'];}return db[_0xe18c('0x25')][_0xe18c('0x43')]({'where':{'id':_0x3ffd18[_0xe18c('0x3f')]['id']}})[_0xe18c('0x1e')](handleEntityNotFound(_0x42b731,null))[_0xe18c('0x1e')](saveUpdates(_0x3ffd18[_0xe18c('0x45')],null))['then'](respondWithResult(_0x42b731,null))[_0xe18c('0x3d')](handleError(_0x42b731,null));};exports['destroy']=function(_0x28bc02,_0x94406a){return db[_0xe18c('0x25')]['find']({'where':{'id':_0x28bc02['params']['id']}})[_0xe18c('0x1e')](handleEntityNotFound(_0x94406a,null))[_0xe18c('0x1e')](removeEntity(_0x94406a,null))[_0xe18c('0x3d')](handleError(_0x94406a,null));}; \ No newline at end of file +var _0xa144=['set','apply','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','filter','where','type','merge','findAll','rows','catch','show','params','length','include','options','create','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit'];(function(_0x45b805,_0x3256b9){var _0x40c931=function(_0x46a9d2){while(--_0x46a9d2){_0x45b805['push'](_0x45b805['shift']());}};_0x40c931(++_0x3256b9);}(_0xa144,0x84));var _0x4a14=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa144[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x4a14('0x0'));var rimraf=require(_0x4a14('0x1'));var zipdir=require(_0x4a14('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a14('0x3'));var moment=require(_0x4a14('0x4'));var BPromise=require(_0x4a14('0x5'));var Mustache=require(_0x4a14('0x6'));var util=require(_0x4a14('0x7'));var path=require(_0x4a14('0x8'));var sox=require(_0x4a14('0x9'));var csv=require(_0x4a14('0xa'));var ejs=require(_0x4a14('0xb'));var fs=require('fs');var fs_extra=require(_0x4a14('0xc'));var _=require(_0x4a14('0xd'));var squel=require(_0x4a14('0xe'));var crypto=require('crypto');var jsforce=require(_0x4a14('0xf'));var deskjs=require(_0x4a14('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4a14('0x11'));var Papa=require('papaparse');var Redis=require(_0x4a14('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4a14('0x13'));var as=require(_0x4a14('0x14'));var hardwareService=require(_0x4a14('0x15'));var logger=require(_0x4a14('0x16'))(_0x4a14('0x17'));var utils=require(_0x4a14('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4a14('0x19'));var db=require(_0x4a14('0x1a'))['db'];function respondWithStatusCode(_0x2a6520,_0x419a31){_0x419a31=_0x419a31||0xcc;return function(_0x19f0e1){if(_0x19f0e1){return _0x2a6520[_0x4a14('0x1b')](_0x419a31);}return _0x2a6520['status'](_0x419a31)['end']();};}function respondWithResult(_0x23e808,_0x704a6a){_0x704a6a=_0x704a6a||0xc8;return function(_0x292fc1){if(_0x292fc1){return _0x23e808[_0x4a14('0x1c')](_0x704a6a)[_0x4a14('0x1d')](_0x292fc1);}};}function respondWithFilteredResult(_0x16f800,_0x17bbe9){return function(_0x5e4f59){if(_0x5e4f59){var _0x145e52=typeof _0x17bbe9[_0x4a14('0x1e')]===_0x4a14('0x1f')&&typeof _0x17bbe9['limit']===_0x4a14('0x1f');var _0xb9b52c=_0x5e4f59[_0x4a14('0x20')];var _0x17ce8d=_0x145e52?0x0:_0x17bbe9['offset'];var _0x250a8a=_0x145e52?_0x5e4f59[_0x4a14('0x20')]:_0x17bbe9[_0x4a14('0x1e')]+_0x17bbe9[_0x4a14('0x21')];var _0x1efeaa;if(_0x250a8a>=_0xb9b52c){_0x250a8a=_0xb9b52c;_0x1efeaa=0xc8;}else{_0x1efeaa=0xce;}_0x16f800[_0x4a14('0x1c')](_0x1efeaa);return _0x16f800[_0x4a14('0x22')]('Content-Range',_0x17ce8d+'-'+_0x250a8a+'/'+_0xb9b52c)['json'](_0x5e4f59);}return null;};}function patchUpdates(_0x26168d){return function(_0x3de17b){try{jsonpatch[_0x4a14('0x23')](_0x3de17b,_0x26168d,!![]);}catch(_0x2f3310){return BPromise[_0x4a14('0x24')](_0x2f3310);}return _0x3de17b[_0x4a14('0x25')]();};}function saveUpdates(_0x208f1c,_0x48fc53){return function(_0x841845){if(_0x841845){return _0x841845[_0x4a14('0x26')](_0x208f1c)[_0x4a14('0x27')](function(_0x1c8065){return _0x1c8065;});}return null;};}function removeEntity(_0x1603a8,_0x1ebf4c){return function(_0x4373c4){if(_0x4373c4){return _0x4373c4[_0x4a14('0x28')]()[_0x4a14('0x27')](function(){var _0x459356=_0x4373c4[_0x4a14('0x29')]({'plain':!![]});var _0x25ce2c=_0x4a14('0x2a');return db[_0x4a14('0x2b')]['destroy']({'where':{'type':_0x25ce2c,'resourceId':_0x459356['id']}})['then'](function(){return _0x4373c4;});})[_0x4a14('0x27')](function(){_0x1603a8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16eb6e,_0x5cac29){return function(_0x339655){if(!_0x339655){_0x16eb6e[_0x4a14('0x1b')](0x194);}return _0x339655;};}function handleError(_0x2e330a,_0x3f70a1){_0x3f70a1=_0x3f70a1||0x1f4;return function(_0x5da19e){logger[_0x4a14('0x2c')](_0x5da19e[_0x4a14('0x2d')]);if(_0x5da19e[_0x4a14('0x2e')]){delete _0x5da19e['name'];}_0x2e330a[_0x4a14('0x1c')](_0x3f70a1)[_0x4a14('0x2f')](_0x5da19e);};}exports[_0x4a14('0x30')]=function(_0x53c46a,_0xe95413){var _0x326d83={},_0x588f20={},_0x4d22dc={'count':0x0,'rows':[]};var _0x2dfee3=_[_0x4a14('0x31')](db[_0x4a14('0x32')][_0x4a14('0x33')],function(_0x5065d8){return{'name':_0x5065d8['fieldName'],'type':_0x5065d8['type'][_0x4a14('0x34')]};});_0x588f20[_0x4a14('0x35')]=_[_0x4a14('0x31')](_0x2dfee3,_0x4a14('0x2e'));_0x588f20['query']=_[_0x4a14('0x36')](_0x53c46a[_0x4a14('0x37')]);_0x588f20[_0x4a14('0x38')]=_['intersection'](_0x588f20[_0x4a14('0x35')],_0x588f20['query']);_0x326d83[_0x4a14('0x39')]=_[_0x4a14('0x3a')](_0x588f20['model'],qs['fields'](_0x53c46a['query'][_0x4a14('0x3b')]));_0x326d83[_0x4a14('0x39')]=_0x326d83['attributes']['length']?_0x326d83[_0x4a14('0x39')]:_0x588f20['model'];if(!_0x53c46a[_0x4a14('0x37')][_0x4a14('0x3c')]('nolimit')){_0x326d83[_0x4a14('0x21')]=qs[_0x4a14('0x21')](_0x53c46a[_0x4a14('0x37')]['limit']);_0x326d83[_0x4a14('0x1e')]=qs['offset'](_0x53c46a['query'][_0x4a14('0x1e')]);}_0x326d83[_0x4a14('0x3d')]=qs['sort'](_0x53c46a[_0x4a14('0x37')][_0x4a14('0x3e')]);_0x326d83['where']=qs['filters'](_['pick'](_0x53c46a[_0x4a14('0x37')],_0x588f20[_0x4a14('0x38')]),_0x2dfee3);if(_0x53c46a[_0x4a14('0x37')][_0x4a14('0x3f')]){_0x326d83['where']=_['merge'](_0x326d83[_0x4a14('0x40')],{'$or':_['map'](_0x2dfee3,function(_0x42546a){if(_0x42546a[_0x4a14('0x41')]!=='VIRTUAL'){var _0x323c4f={};_0x323c4f[_0x42546a[_0x4a14('0x2e')]]={'$like':'%'+_0x53c46a[_0x4a14('0x37')][_0x4a14('0x3f')]+'%'};return _0x323c4f;}})});}_0x326d83=_[_0x4a14('0x42')]({},_0x326d83,_0x53c46a['options']);var _0x167096={'where':_0x326d83[_0x4a14('0x40')]};return db[_0x4a14('0x32')][_0x4a14('0x20')](_0x167096)[_0x4a14('0x27')](function(_0x33e5a7){_0x4d22dc[_0x4a14('0x20')]=_0x33e5a7;if(_0x53c46a[_0x4a14('0x37')]['includeAll']){_0x326d83['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x4a14('0x43')](_0x326d83);})[_0x4a14('0x27')](function(_0x14dc86){_0x4d22dc[_0x4a14('0x44')]=_0x14dc86;return _0x4d22dc;})[_0x4a14('0x27')](respondWithFilteredResult(_0xe95413,_0x326d83))[_0x4a14('0x45')](handleError(_0xe95413,null));};exports[_0x4a14('0x46')]=function(_0x21da90,_0x5d3b6d){var _0x902942={'raw':!![],'where':{'id':_0x21da90[_0x4a14('0x47')]['id']}},_0x143260={};_0x143260[_0x4a14('0x35')]=_[_0x4a14('0x36')](db[_0x4a14('0x32')][_0x4a14('0x33')]);_0x143260[_0x4a14('0x37')]=_[_0x4a14('0x36')](_0x21da90[_0x4a14('0x37')]);_0x143260[_0x4a14('0x38')]=_[_0x4a14('0x3a')](_0x143260[_0x4a14('0x35')],_0x143260['query']);_0x902942[_0x4a14('0x39')]=_[_0x4a14('0x3a')](_0x143260[_0x4a14('0x35')],qs[_0x4a14('0x3b')](_0x21da90[_0x4a14('0x37')][_0x4a14('0x3b')]));_0x902942[_0x4a14('0x39')]=_0x902942[_0x4a14('0x39')][_0x4a14('0x48')]?_0x902942['attributes']:_0x143260['model'];if(_0x21da90[_0x4a14('0x37')]['includeAll']){_0x902942[_0x4a14('0x49')]=[{'all':!![]}];}_0x902942=_[_0x4a14('0x42')]({},_0x902942,_0x21da90[_0x4a14('0x4a')]);return db[_0x4a14('0x32')]['find'](_0x902942)[_0x4a14('0x27')](handleEntityNotFound(_0x5d3b6d,null))[_0x4a14('0x27')](respondWithResult(_0x5d3b6d,null))[_0x4a14('0x45')](handleError(_0x5d3b6d,null));};exports[_0x4a14('0x4b')]=function(_0x3dd1bf,_0x1147e8){return db['CmContactHasItem'][_0x4a14('0x4b')](_0x3dd1bf['body'],{})[_0x4a14('0x27')](function(_0x54b895){var _0x576fab=_0x3dd1bf['user'][_0x4a14('0x29')]({'plain':!![]});if(!_0x576fab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x576fab[_0x4a14('0x4c')]==='user'){var _0x309b4f=_0x54b895['get']({'plain':!![]});var _0x4cbc64=_0x4a14('0x2a');return db[_0x4a14('0x4d')]['find']({'where':{'name':_0x4cbc64,'userProfileId':_0x576fab[_0x4a14('0x4e')]},'raw':!![]})[_0x4a14('0x27')](function(_0x50f833){if(_0x50f833&&_0x50f833[_0x4a14('0x4f')]===0x0){return db[_0x4a14('0x2b')]['create']({'name':_0x309b4f[_0x4a14('0x2e')],'resourceId':_0x309b4f['id'],'type':_0x50f833[_0x4a14('0x2e')],'sectionId':_0x50f833['id']},{})['then'](function(){return _0x54b895;});}else{return _0x54b895;}})['catch'](function(_0x3dea60){logger[_0x4a14('0x2c')](_0x4a14('0x50'),_0x3dea60);throw _0x3dea60;});}return _0x54b895;})[_0x4a14('0x27')](respondWithResult(_0x1147e8,0xc9))['catch'](handleError(_0x1147e8,null));};exports['update']=function(_0x584f42,_0x52c026){if(_0x584f42[_0x4a14('0x51')]['id']){delete _0x584f42['body']['id'];}return db[_0x4a14('0x32')][_0x4a14('0x52')]({'where':{'id':_0x584f42[_0x4a14('0x47')]['id']}})[_0x4a14('0x27')](handleEntityNotFound(_0x52c026,null))[_0x4a14('0x27')](saveUpdates(_0x584f42[_0x4a14('0x51')],null))[_0x4a14('0x27')](respondWithResult(_0x52c026,null))[_0x4a14('0x45')](handleError(_0x52c026,null));};exports[_0x4a14('0x28')]=function(_0xdbbfe3,_0x36a9ae){return db[_0x4a14('0x32')][_0x4a14('0x52')]({'where':{'id':_0xdbbfe3[_0x4a14('0x47')]['id']}})[_0x4a14('0x27')](handleEntityNotFound(_0x36a9ae,null))['then'](removeEntity(_0x36a9ae,null))[_0x4a14('0x45')](handleError(_0x36a9ae,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 09d7834..5a54376 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 _0xfaa1=['CmContactHasItem','cm_contact_has_items','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define'];(function(_0x11bb32,_0x5a92c1){var _0x3035c0=function(_0x4ef894){while(--_0x4ef894){_0x11bb32['push'](_0x11bb32['shift']());}};_0x3035c0(++_0x5a92c1);}(_0xfaa1,0x1af));var _0x1faa=function(_0x1d7ba0,_0xa8ede0){_0x1d7ba0=_0x1d7ba0-0x0;var _0x443c4e=_0xfaa1[_0x1d7ba0];return _0x443c4e;};'use strict';var _=require('lodash');var util=require(_0x1faa('0x0'));var logger=require('../../config/logger')(_0x1faa('0x1'));var moment=require(_0x1faa('0x2'));var BPromise=require(_0x1faa('0x3'));var rp=require(_0x1faa('0x4'));var fs=require('fs');var path=require(_0x1faa('0x5'));var rimraf=require(_0x1faa('0x6'));var config=require(_0x1faa('0x7'));var attributes=require(_0x1faa('0x8'));module[_0x1faa('0x9')]=function(_0x4b9dc4,_0x51eed8){return _0x4b9dc4[_0x1faa('0xa')](_0x1faa('0xb'),attributes,{'tableName':_0x1faa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1152=['util','../../config/logger','api','moment','bluebird','request-promise','path','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash'];(function(_0x482f86,_0x510f24){var _0x1a18cf=function(_0x3a2893){while(--_0x3a2893){_0x482f86['push'](_0x482f86['shift']());}};_0x1a18cf(++_0x510f24);}(_0x1152,0x144));var _0x2115=function(_0x539533,_0x59b89b){_0x539533=_0x539533-0x0;var _0x3942f3=_0x1152[_0x539533];return _0x3942f3;};'use strict';var _=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var logger=require(_0x2115('0x2'))(_0x2115('0x3'));var moment=require(_0x2115('0x4'));var BPromise=require(_0x2115('0x5'));var rp=require(_0x2115('0x6'));var fs=require('fs');var path=require(_0x2115('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2115('0x8'));module[_0x2115('0x9')]=function(_0x31ca15,_0x5a968d){return _0x31ca15[_0x2115('0xa')](_0x2115('0xb'),attributes,{'tableName':_0x2115('0xc'),'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 bb12c58..b98e337 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 _0x29d9=['message','result','catch','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1e5cc3,_0x238a87){var _0x15c596=function(_0x27bb04){while(--_0x27bb04){_0x1e5cc3['push'](_0x1e5cc3['shift']());}};_0x15c596(++_0x238a87);}(_0x29d9,0x16c));var _0x929d=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0x29d9[_0x3b4b1d];return _0x488c36;};'use strict';var _=require('lodash');var util=require(_0x929d('0x0'));var moment=require(_0x929d('0x1'));var BPromise=require(_0x929d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x929d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x929d('0x4'));var config=require(_0x929d('0x5'));var jayson=require(_0x929d('0x6'));var client=jayson['client'][_0x929d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c820f,_0x50bbee,_0x3e4e04){return new BPromise(function(_0x1c293d,_0x3c4d0){return client['request'](_0x5c820f,_0x3e4e04)[_0x929d('0x8')](function(_0x1cb40c){logger[_0x929d('0x9')](_0x929d('0xa'),_0x50bbee,_0x929d('0xb'));logger[_0x929d('0xc')](_0x929d('0xd'),_0x50bbee,_0x929d('0xb'),JSON[_0x929d('0xe')](_0x1cb40c));if(_0x1cb40c[_0x929d('0xf')]){if(_0x1cb40c[_0x929d('0xf')]['code']===0x1f4){logger[_0x929d('0xf')](_0x929d('0xa'),_0x50bbee,_0x1cb40c[_0x929d('0xf')][_0x929d('0x10')]);return _0x3c4d0(_0x1cb40c['error'][_0x929d('0x10')]);}logger['error'](_0x929d('0xa'),_0x50bbee,_0x1cb40c['error']['message']);return _0x1c293d(_0x1cb40c[_0x929d('0xf')][_0x929d('0x10')]);}else{logger[_0x929d('0x9')](_0x929d('0xa'),_0x50bbee,'request\x20sent');_0x1c293d(_0x1cb40c[_0x929d('0x11')][_0x929d('0x10')]);}})[_0x929d('0x12')](function(_0x598198){logger[_0x929d('0xf')](_0x929d('0xa'),_0x50bbee,_0x598198);_0x3c4d0(_0x598198);});});} \ No newline at end of file +var _0xae0d=['result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0xae0d,0x1e6));var _0xdae0=function(_0x21aa44,_0x3919ce){_0x21aa44=_0x21aa44-0x0;var _0xd6207=_0xae0d[_0x21aa44];return _0xd6207;};'use strict';var _=require(_0xdae0('0x0'));var util=require(_0xdae0('0x1'));var moment=require('moment');var BPromise=require(_0xdae0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdae0('0x3'))['db'];var utils=require(_0xdae0('0x4'));var logger=require(_0xdae0('0x5'))(_0xdae0('0x6'));var config=require(_0xdae0('0x7'));var jayson=require(_0xdae0('0x8'));var client=jayson[_0xdae0('0x9')][_0xdae0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5128ff,_0x20c3fb,_0x4cb347){return new BPromise(function(_0x72bfa8,_0x33027a){return client[_0xdae0('0xb')](_0x5128ff,_0x4cb347)[_0xdae0('0xc')](function(_0x2a6542){logger[_0xdae0('0xd')](_0xdae0('0xe'),_0x20c3fb,_0xdae0('0xf'));logger[_0xdae0('0x10')](_0xdae0('0x11'),_0x20c3fb,'request\x20sent',JSON['stringify'](_0x2a6542));if(_0x2a6542[_0xdae0('0x12')]){if(_0x2a6542[_0xdae0('0x12')]['code']===0x1f4){logger[_0xdae0('0x12')](_0xdae0('0xe'),_0x20c3fb,_0x2a6542['error'][_0xdae0('0x13')]);return _0x33027a(_0x2a6542[_0xdae0('0x12')][_0xdae0('0x13')]);}logger[_0xdae0('0x12')](_0xdae0('0xe'),_0x20c3fb,_0x2a6542[_0xdae0('0x12')][_0xdae0('0x13')]);return _0x72bfa8(_0x2a6542[_0xdae0('0x12')][_0xdae0('0x13')]);}else{logger[_0xdae0('0xd')](_0xdae0('0xe'),_0x20c3fb,_0xdae0('0xf'));_0x72bfa8(_0x2a6542[_0xdae0('0x14')]['message']);}})[_0xdae0('0x15')](function(_0x3f0d92){logger['error'](_0xdae0('0xe'),_0x20c3fb,_0x3f0d92);_0x33027a(_0x3f0d92);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index a342b71..6a888c2 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 _0x5226=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','put','update'];(function(_0x336eff,_0x31c3c9){var _0xafb6ad=function(_0x2f230e){while(--_0x2f230e){_0x336eff['push'](_0x336eff['shift']());}};_0xafb6ad(++_0x31c3c9);}(_0x5226,0x16c));var _0x6522=function(_0x2e10bd,_0x5ece63){_0x2e10bd=_0x2e10bd-0x0;var _0x441b4c=_0x5226[_0x2e10bd];return _0x441b4c;};'use strict';var multer=require(_0x6522('0x0'));var util=require(_0x6522('0x1'));var path=require(_0x6522('0x2'));var timeout=require(_0x6522('0x3'));var express=require(_0x6522('0x4'));var router=express['Router']();var fs_extra=require(_0x6522('0x5'));var auth=require(_0x6522('0x6'));var interaction=require(_0x6522('0x7'));var config=require('../../config/environment');var controller=require(_0x6522('0x8'));router[_0x6522('0x9')]('/',auth[_0x6522('0xa')](),controller[_0x6522('0xb')]);router[_0x6522('0x9')](_0x6522('0xc'),auth[_0x6522('0xa')](),controller[_0x6522('0xd')]);router['post']('/',auth[_0x6522('0xa')](),controller['create']);router[_0x6522('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x6522('0xf')]);router[_0x6522('0x10')](_0x6522('0xc'),auth[_0x6522('0xa')](),controller[_0x6522('0x11')]);module[_0x6522('0x12')]=router; \ No newline at end of file +var _0x81e8=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','show','post','isAuthenticated','create','/:id','update','delete','destroy','exports','path'];(function(_0x5b077b,_0x50b707){var _0x16faf7=function(_0x41ba83){while(--_0x41ba83){_0x5b077b['push'](_0x5b077b['shift']());}};_0x16faf7(++_0x50b707);}(_0x81e8,0x1db));var _0x881e=function(_0x55f3c2,_0x335b79){_0x55f3c2=_0x55f3c2-0x0;var _0x4df8bb=_0x81e8[_0x55f3c2];return _0x4df8bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x881e('0x0'));var timeout=require(_0x881e('0x1'));var express=require(_0x881e('0x2'));var router=express[_0x881e('0x3')]();var fs_extra=require(_0x881e('0x4'));var auth=require(_0x881e('0x5'));var interaction=require(_0x881e('0x6'));var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x881e('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x881e('0x8')]);router[_0x881e('0x9')]('/',auth[_0x881e('0xa')](),controller[_0x881e('0xb')]);router['put'](_0x881e('0xc'),auth[_0x881e('0xa')](),controller[_0x881e('0xd')]);router[_0x881e('0xe')](_0x881e('0xc'),auth[_0x881e('0xa')](),controller[_0x881e('0xf')]);module[_0x881e('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 2e5ec8f..cc62ebf 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 _0x6e74=['values','isArray','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','alias','STRING','setDataValue','getDataValue','name','long','select','parse'];(function(_0x33d4a2,_0x2baaf4){var _0x2c793f=function(_0x414303){while(--_0x414303){_0x33d4a2['push'](_0x33d4a2['shift']());}};_0x2c793f(++_0x2baaf4);}(_0x6e74,0x1bf));var _0x46e7=function(_0x24fc65,_0x60903e){_0x24fc65=_0x24fc65-0x0;var _0xa8c637=_0x6e74[_0x24fc65];return _0xa8c637;};'use strict';var Sequelize=require(_0x46e7('0x0'));var _=require(_0x46e7('0x1'));module[_0x46e7('0x2')]={'name':{'type':Sequelize[_0x46e7('0x3')],'get':function(_0x456e2b){return this['getDataValue'](_0x46e7('0x4'));}},'alias':{'type':Sequelize[_0x46e7('0x5')],'allowNull':![],'set':function(_0x2383d3){this[_0x46e7('0x6')](_0x46e7('0x4'),_0x2383d3?_0x2383d3:this[_0x46e7('0x7')](_0x46e7('0x8')));}},'type':{'type':Sequelize[_0x46e7('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x46e7('0x9')),'get':function(){if(this[_0x46e7('0x7')]('type')===_0x46e7('0xa')){return JSON[_0x46e7('0xb')](this[_0x46e7('0x7')](_0x46e7('0xc')));}else{return this[_0x46e7('0x7')](_0x46e7('0xc'));}},'set':function(_0x3f2f78){if(Array[_0x46e7('0xd')](_0x3f2f78)){this['setDataValue'](_0x46e7('0xc'),JSON['stringify'](_0x3f2f78));}else{this['setDataValue'](_0x46e7('0xc'),_0x3f2f78);}}},'required':{'type':Sequelize[_0x46e7('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x46e7('0xf')](_0x46e7('0x10'))}}; \ No newline at end of file +var _0xd665=['type','select','values','isArray','stringify','BOOLEAN','ENUM','voice','VIRTUAL','getDataValue','alias','STRING','name','TEXT','long'];(function(_0x2aadc8,_0x34947e){var _0x35c190=function(_0x539803){while(--_0x539803){_0x2aadc8['push'](_0x2aadc8['shift']());}};_0x35c190(++_0x34947e);}(_0xd665,0xcb));var _0x5d66=function(_0x5bd53e,_0x150a13){_0x5bd53e=_0x5bd53e-0x0;var _0x347e75=_0xd665[_0x5bd53e];return _0x347e75;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x5d66('0x0')],'get':function(_0x58c928){return this[_0x5d66('0x1')](_0x5d66('0x2'));}},'alias':{'type':Sequelize[_0x5d66('0x3')],'allowNull':![],'set':function(_0x1e7638){this['setDataValue']('alias',_0x1e7638?_0x1e7638:this[_0x5d66('0x1')](_0x5d66('0x4')));}},'type':{'type':Sequelize[_0x5d66('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x5d66('0x5')](_0x5d66('0x6')),'get':function(){if(this[_0x5d66('0x1')](_0x5d66('0x7'))===_0x5d66('0x8')){return JSON['parse'](this[_0x5d66('0x1')]('values'));}else{return this[_0x5d66('0x1')](_0x5d66('0x9'));}},'set':function(_0x3fba82){if(Array[_0x5d66('0xa')](_0x3fba82)){this['setDataValue'](_0x5d66('0x9'),JSON[_0x5d66('0xb')](_0x3fba82));}else{this['setDataValue']('values',_0x3fba82);}}},'required':{'type':Sequelize[_0x5d66('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x5d66('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x5d66('0xd')](_0x5d66('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 083a0b5..77172db 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 _0x4567=['INTEGER','defaultValue','queryInterface','addColumn','cm_contacts','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','keys','options','find','catch','body','params','create','sequelize','transaction','TEXT','text','Sequelize'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x4567,0x101));var _0x7456=function(_0xb9cfa9,_0x4fb40a){_0xb9cfa9=_0xb9cfa9-0x0;var _0x4af496=_0x4567[_0xb9cfa9];return _0x4af496;};'use strict';var emlformat=require(_0x7456('0x0'));var rimraf=require(_0x7456('0x1'));var zipdir=require(_0x7456('0x2'));var jsonpatch=require(_0x7456('0x3'));var rp=require('request-promise');var moment=require(_0x7456('0x4'));var BPromise=require(_0x7456('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7456('0x6'));var sox=require(_0x7456('0x7'));var csv=require(_0x7456('0x8'));var ejs=require(_0x7456('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7456('0xa'));var squel=require(_0x7456('0xb'));var crypto=require(_0x7456('0xc'));var jsforce=require(_0x7456('0xd'));var deskjs=require(_0x7456('0xe'));var toCsv=require(_0x7456('0x8'));var querystring=require(_0x7456('0xf'));var Papa=require(_0x7456('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7456('0x11'));var as=require(_0x7456('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7456('0x13'))(_0x7456('0x14'));var utils=require('../../config/utils');var config=require(_0x7456('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7456('0x16'))['db'];function respondWithStatusCode(_0x92cdb5,_0x3e0497){_0x3e0497=_0x3e0497||0xcc;return function(_0x5d1fd4){if(_0x5d1fd4){return _0x92cdb5['sendStatus'](_0x3e0497);}return _0x92cdb5['status'](_0x3e0497)[_0x7456('0x17')]();};}function respondWithResult(_0x14e7bc,_0x272509){_0x272509=_0x272509||0xc8;return function(_0x4a929b){if(_0x4a929b){return _0x14e7bc[_0x7456('0x18')](_0x272509)[_0x7456('0x19')](_0x4a929b);}};}function respondWithFilteredResult(_0x52ba31,_0x4ce03f){return function(_0x3d87d5){if(_0x3d87d5){var _0x4a7386=typeof _0x4ce03f[_0x7456('0x1a')]===_0x7456('0x1b')&&typeof _0x4ce03f[_0x7456('0x1c')]==='undefined';var _0x12fe5b=_0x3d87d5[_0x7456('0x1d')];var _0x181c1e=_0x4a7386?0x0:_0x4ce03f[_0x7456('0x1a')];var _0x21bf43=_0x4a7386?_0x3d87d5[_0x7456('0x1d')]:_0x4ce03f[_0x7456('0x1a')]+_0x4ce03f[_0x7456('0x1c')];var _0x3260f2;if(_0x21bf43>=_0x12fe5b){_0x21bf43=_0x12fe5b;_0x3260f2=0xc8;}else{_0x3260f2=0xce;}_0x52ba31[_0x7456('0x18')](_0x3260f2);return _0x52ba31[_0x7456('0x1e')](_0x7456('0x1f'),_0x181c1e+'-'+_0x21bf43+'/'+_0x12fe5b)[_0x7456('0x19')](_0x3d87d5);}return null;};}function patchUpdates(_0x30934c){return function(_0x556289){try{jsonpatch['apply'](_0x556289,_0x30934c,!![]);}catch(_0x37b084){return BPromise[_0x7456('0x20')](_0x37b084);}return _0x556289['save']();};}function saveUpdates(_0x2ed753,_0xc76672){return function(_0x12cdf7){if(_0x12cdf7){return _0x12cdf7[_0x7456('0x21')](_0x2ed753)[_0x7456('0x22')](function(_0xd51e7){return _0xd51e7;});}return null;};}function removeEntity(_0x18d54e,_0x23b148){return function(_0x45e3f9){if(_0x45e3f9){return _0x45e3f9[_0x7456('0x23')]()[_0x7456('0x22')](function(){_0x18d54e[_0x7456('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac385,_0x253fd3){return function(_0x65b5bd){if(!_0x65b5bd){_0x5ac385['sendStatus'](0x194);}return _0x65b5bd;};}function handleError(_0x1c7959,_0x5ba7fc){_0x5ba7fc=_0x5ba7fc||0x1f4;return function(_0x2a0fce){logger[_0x7456('0x24')](_0x2a0fce[_0x7456('0x25')]);if(_0x2a0fce['name']){delete _0x2a0fce[_0x7456('0x26')];}_0x1c7959['status'](_0x5ba7fc)[_0x7456('0x27')](_0x2a0fce);};}exports[_0x7456('0x28')]=function(_0x3f9bbf,_0x21fd92){var _0x3a59cd={},_0x2f3114={},_0x42e1d4={'count':0x0,'rows':[]};var _0x54c813=_[_0x7456('0x29')](db[_0x7456('0x2a')][_0x7456('0x2b')],function(_0x37151a){return{'name':_0x37151a[_0x7456('0x2c')],'type':_0x37151a['type'][_0x7456('0x2d')]};});_0x2f3114[_0x7456('0x2e')]=_[_0x7456('0x2f')](_['map'](_0x54c813,_0x7456('0x26')),['name']);_0x2f3114['query']=_['keys'](_0x3f9bbf[_0x7456('0x30')]);_0x2f3114['filters']=_[_0x7456('0x31')](_0x2f3114[_0x7456('0x2e')],_0x2f3114[_0x7456('0x30')]);_0x3a59cd[_0x7456('0x32')]=_[_0x7456('0x31')](_0x2f3114[_0x7456('0x2e')],qs[_0x7456('0x33')](_0x3f9bbf[_0x7456('0x30')][_0x7456('0x33')]));_0x3a59cd[_0x7456('0x32')]=_0x3a59cd['attributes'][_0x7456('0x34')]?_0x3a59cd[_0x7456('0x32')]:_0x2f3114[_0x7456('0x2e')];if(!_0x3f9bbf[_0x7456('0x30')]['hasOwnProperty']('nolimit')){_0x3a59cd[_0x7456('0x1c')]=qs[_0x7456('0x1c')](_0x3f9bbf[_0x7456('0x30')][_0x7456('0x1c')]);_0x3a59cd['offset']=qs['offset'](_0x3f9bbf['query'][_0x7456('0x1a')]);}_0x3a59cd[_0x7456('0x35')]=qs[_0x7456('0x36')](_0x3f9bbf['query']['sort']);_0x3a59cd[_0x7456('0x37')]=qs[_0x7456('0x38')](_[_0x7456('0x39')](_0x3f9bbf[_0x7456('0x30')],_0x2f3114[_0x7456('0x38')]),_0x54c813);if(_0x3f9bbf[_0x7456('0x30')][_0x7456('0x3a')]){_0x3a59cd[_0x7456('0x37')]=_[_0x7456('0x3b')](_0x3a59cd[_0x7456('0x37')],{'$or':_[_0x7456('0x29')](_0x54c813,function(_0x452b78){if(_0x452b78[_0x7456('0x3c')]!==_0x7456('0x3d')){var _0x203644={};_0x203644[_0x452b78[_0x7456('0x26')]]={'$like':'%'+_0x3f9bbf[_0x7456('0x30')][_0x7456('0x3a')]+'%'};return _0x203644;}})});}_0x3a59cd=_['merge']({},_0x3a59cd,_0x3f9bbf['options']);var _0x4940c1={'where':_0x3a59cd[_0x7456('0x37')]};return db[_0x7456('0x2a')][_0x7456('0x1d')](_0x4940c1)['then'](function(_0x59efa0){_0x42e1d4['count']=_0x59efa0;if(_0x3f9bbf[_0x7456('0x30')][_0x7456('0x3e')]){_0x3a59cd[_0x7456('0x3f')]=[{'all':!![]}];}return db[_0x7456('0x2a')][_0x7456('0x40')](_0x3a59cd);})[_0x7456('0x22')](function(_0x147947){_0x42e1d4[_0x7456('0x41')]=_0x147947;return _0x42e1d4;})[_0x7456('0x22')](respondWithFilteredResult(_0x21fd92,_0x3a59cd))['catch'](handleError(_0x21fd92,null));};exports[_0x7456('0x42')]=function(_0xfe794f,_0x18da71){var _0x8030b0={'raw':!![],'where':{'id':_0xfe794f['params']['id']}},_0xa73213={};_0xa73213[_0x7456('0x2e')]=_[_0x7456('0x43')](db[_0x7456('0x2a')]['rawAttributes']);_0xa73213[_0x7456('0x30')]=_[_0x7456('0x43')](_0xfe794f['query']);_0xa73213[_0x7456('0x38')]=_[_0x7456('0x31')](_0xa73213['model'],_0xa73213['query']);_0x8030b0[_0x7456('0x32')]=_[_0x7456('0x31')](_0xa73213[_0x7456('0x2e')],qs[_0x7456('0x33')](_0xfe794f[_0x7456('0x30')][_0x7456('0x33')]));_0x8030b0[_0x7456('0x32')]=_0x8030b0[_0x7456('0x32')]['length']?_0x8030b0['attributes']:_0xa73213[_0x7456('0x2e')];if(_0xfe794f[_0x7456('0x30')][_0x7456('0x3e')]){_0x8030b0[_0x7456('0x3f')]=[{'all':!![]}];}_0x8030b0=_[_0x7456('0x3b')]({},_0x8030b0,_0xfe794f[_0x7456('0x44')]);return db[_0x7456('0x2a')][_0x7456('0x45')](_0x8030b0)[_0x7456('0x22')](handleEntityNotFound(_0x18da71,null))[_0x7456('0x22')](respondWithResult(_0x18da71,null))[_0x7456('0x46')](handleError(_0x18da71,null));};exports[_0x7456('0x21')]=function(_0x214ce1,_0x14b904){if(_0x214ce1[_0x7456('0x47')]['id']){delete _0x214ce1[_0x7456('0x47')]['id'];}return db[_0x7456('0x2a')][_0x7456('0x45')]({'where':{'id':_0x214ce1[_0x7456('0x48')]['id']}})[_0x7456('0x22')](handleEntityNotFound(_0x14b904,null))['then'](saveUpdates(_0x214ce1[_0x7456('0x47')],null))[_0x7456('0x22')](respondWithResult(_0x14b904,null))[_0x7456('0x46')](handleError(_0x14b904,null));};exports[_0x7456('0x23')]=function(_0x39bccd,_0x49f3d8){return db[_0x7456('0x2a')]['find']({'where':{'id':_0x39bccd[_0x7456('0x48')]['id']}})[_0x7456('0x22')](handleEntityNotFound(_0x49f3d8,null))[_0x7456('0x22')](removeEntity(_0x49f3d8,null))[_0x7456('0x46')](handleError(_0x49f3d8,null));};exports[_0x7456('0x49')]=function(_0x32e6c8,_0x5f5944){var _0x45f4d8;return db[_0x7456('0x4a')][_0x7456('0x4b')](function(_0x4bbdd7){return db[_0x7456('0x2a')]['create'](_0x32e6c8['body'],{'transaction':_0x4bbdd7})[_0x7456('0x22')](function(_0x4a09bf){_0x45f4d8=_0x4a09bf;var _0x1dc375={'type':db['Sequelize'][_0x7456('0x4c')],'transaction':_0x4bbdd7};switch(_0x32e6c8[_0x7456('0x47')][_0x7456('0x3c')]){case _0x7456('0x4d'):_0x1dc375[_0x7456('0x3c')]=db['Sequelize']['TEXT'];break;case'number':_0x1dc375[_0x7456('0x3c')]=db[_0x7456('0x4e')][_0x7456('0x4f')];break;case'switch':_0x1dc375[_0x7456('0x3c')]=db[_0x7456('0x4e')]['BOOLEAN'];_0x1dc375[_0x7456('0x50')]=![];break;default:}return db['sequelize'][_0x7456('0x51')][_0x7456('0x52')](_0x7456('0x53'),util['format']('cf_%d',_0x45f4d8['id']),_0x1dc375);})[_0x7456('0x22')](function(){return _0x45f4d8;});})[_0x7456('0x22')](respondWithResult(_0x5f5944,0xc9))[_0x7456('0x46')](handleError(_0x5f5944,null));}; \ No newline at end of file +var _0x988e=['limit','count','offset','set','Content-Range','apply','reject','update','then','error','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','catch','body','destroy','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%d','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0x988e,0x140));var _0xe988=function(_0x5b1ed7,_0x3f6e00){_0x5b1ed7=_0x5b1ed7-0x0;var _0xf4852=_0x988e[_0x5b1ed7];return _0xf4852;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe988('0x0'));var zipdir=require(_0xe988('0x1'));var jsonpatch=require(_0xe988('0x2'));var rp=require('request-promise');var moment=require(_0xe988('0x3'));var BPromise=require(_0xe988('0x4'));var Mustache=require(_0xe988('0x5'));var util=require(_0xe988('0x6'));var path=require(_0xe988('0x7'));var sox=require('sox');var csv=require(_0xe988('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe988('0x9'));var squel=require(_0xe988('0xa'));var crypto=require(_0xe988('0xb'));var jsforce=require(_0xe988('0xc'));var deskjs=require(_0xe988('0xd'));var toCsv=require(_0xe988('0x8'));var querystring=require(_0xe988('0xe'));var Papa=require(_0xe988('0xf'));var Redis=require(_0xe988('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe988('0x11'));var hardwareService=require(_0xe988('0x12'));var logger=require(_0xe988('0x13'))(_0xe988('0x14'));var utils=require(_0xe988('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe988('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x108fc6,_0x1af45d){_0x1af45d=_0x1af45d||0xcc;return function(_0x505114){if(_0x505114){return _0x108fc6[_0xe988('0x17')](_0x1af45d);}return _0x108fc6[_0xe988('0x18')](_0x1af45d)[_0xe988('0x19')]();};}function respondWithResult(_0x5513ba,_0x3ad25e){_0x3ad25e=_0x3ad25e||0xc8;return function(_0x33065b){if(_0x33065b){return _0x5513ba[_0xe988('0x18')](_0x3ad25e)[_0xe988('0x1a')](_0x33065b);}};}function respondWithFilteredResult(_0x3e20fe,_0x5b37f9){return function(_0x118f24){if(_0x118f24){var _0x1c102b=typeof _0x5b37f9['offset']===_0xe988('0x1b')&&typeof _0x5b37f9[_0xe988('0x1c')]===_0xe988('0x1b');var _0x29f2bd=_0x118f24[_0xe988('0x1d')];var _0x1e3d42=_0x1c102b?0x0:_0x5b37f9[_0xe988('0x1e')];var _0x5c64b3=_0x1c102b?_0x118f24[_0xe988('0x1d')]:_0x5b37f9['offset']+_0x5b37f9[_0xe988('0x1c')];var _0x743f8b;if(_0x5c64b3>=_0x29f2bd){_0x5c64b3=_0x29f2bd;_0x743f8b=0xc8;}else{_0x743f8b=0xce;}_0x3e20fe[_0xe988('0x18')](_0x743f8b);return _0x3e20fe[_0xe988('0x1f')](_0xe988('0x20'),_0x1e3d42+'-'+_0x5c64b3+'/'+_0x29f2bd)[_0xe988('0x1a')](_0x118f24);}return null;};}function patchUpdates(_0x590faa){return function(_0x36e915){try{jsonpatch[_0xe988('0x21')](_0x36e915,_0x590faa,!![]);}catch(_0x24c958){return BPromise[_0xe988('0x22')](_0x24c958);}return _0x36e915['save']();};}function saveUpdates(_0x160c69,_0x59bee4){return function(_0x3f17cb){if(_0x3f17cb){return _0x3f17cb[_0xe988('0x23')](_0x160c69)[_0xe988('0x24')](function(_0x2587a3){return _0x2587a3;});}return null;};}function removeEntity(_0x3b8c3c,_0x183c96){return function(_0x4988f2){if(_0x4988f2){return _0x4988f2['destroy']()['then'](function(){_0x3b8c3c[_0xe988('0x18')](0xcc)[_0xe988('0x19')]();});}};}function handleEntityNotFound(_0x41fb09,_0x3c69ea){return function(_0x4d5bbc){if(!_0x4d5bbc){_0x41fb09[_0xe988('0x17')](0x194);}return _0x4d5bbc;};}function handleError(_0x1a104c,_0x1684bc){_0x1684bc=_0x1684bc||0x1f4;return function(_0x2cf645){logger[_0xe988('0x25')](_0x2cf645['stack']);if(_0x2cf645[_0xe988('0x26')]){delete _0x2cf645['name'];}_0x1a104c[_0xe988('0x18')](_0x1684bc)['send'](_0x2cf645);};}exports[_0xe988('0x27')]=function(_0x2cad04,_0x87c2cb){var _0x590835={},_0x29d9eb={},_0xad8908={'count':0x0,'rows':[]};var _0x5b615a=_[_0xe988('0x28')](db[_0xe988('0x29')][_0xe988('0x2a')],function(_0x49985c){return{'name':_0x49985c[_0xe988('0x2b')],'type':_0x49985c[_0xe988('0x2c')][_0xe988('0x2d')]};});_0x29d9eb[_0xe988('0x2e')]=_[_0xe988('0x2f')](_[_0xe988('0x28')](_0x5b615a,_0xe988('0x26')),[_0xe988('0x26')]);_0x29d9eb[_0xe988('0x30')]=_[_0xe988('0x31')](_0x2cad04[_0xe988('0x30')]);_0x29d9eb['filters']=_[_0xe988('0x32')](_0x29d9eb['model'],_0x29d9eb[_0xe988('0x30')]);_0x590835[_0xe988('0x33')]=_[_0xe988('0x32')](_0x29d9eb[_0xe988('0x2e')],qs[_0xe988('0x34')](_0x2cad04[_0xe988('0x30')][_0xe988('0x34')]));_0x590835[_0xe988('0x33')]=_0x590835[_0xe988('0x33')][_0xe988('0x35')]?_0x590835['attributes']:_0x29d9eb['model'];if(!_0x2cad04[_0xe988('0x30')][_0xe988('0x36')]('nolimit')){_0x590835['limit']=qs[_0xe988('0x1c')](_0x2cad04[_0xe988('0x30')]['limit']);_0x590835[_0xe988('0x1e')]=qs[_0xe988('0x1e')](_0x2cad04[_0xe988('0x30')][_0xe988('0x1e')]);}_0x590835[_0xe988('0x37')]=qs['sort'](_0x2cad04[_0xe988('0x30')][_0xe988('0x38')]);_0x590835[_0xe988('0x39')]=qs[_0xe988('0x3a')](_[_0xe988('0x3b')](_0x2cad04[_0xe988('0x30')],_0x29d9eb[_0xe988('0x3a')]),_0x5b615a);if(_0x2cad04[_0xe988('0x30')][_0xe988('0x3c')]){_0x590835[_0xe988('0x39')]=_['merge'](_0x590835[_0xe988('0x39')],{'$or':_[_0xe988('0x28')](_0x5b615a,function(_0x363fc1){if(_0x363fc1[_0xe988('0x2c')]!==_0xe988('0x3d')){var _0x22aa21={};_0x22aa21[_0x363fc1[_0xe988('0x26')]]={'$like':'%'+_0x2cad04[_0xe988('0x30')][_0xe988('0x3c')]+'%'};return _0x22aa21;}})});}_0x590835=_[_0xe988('0x3e')]({},_0x590835,_0x2cad04[_0xe988('0x3f')]);var _0x52b610={'where':_0x590835[_0xe988('0x39')]};return db['CmCustomField'][_0xe988('0x1d')](_0x52b610)[_0xe988('0x24')](function(_0x2cc491){_0xad8908[_0xe988('0x1d')]=_0x2cc491;if(_0x2cad04[_0xe988('0x30')][_0xe988('0x40')]){_0x590835[_0xe988('0x41')]=[{'all':!![]}];}return db[_0xe988('0x29')][_0xe988('0x42')](_0x590835);})['then'](function(_0x2194e0){_0xad8908['rows']=_0x2194e0;return _0xad8908;})[_0xe988('0x24')](respondWithFilteredResult(_0x87c2cb,_0x590835))['catch'](handleError(_0x87c2cb,null));};exports[_0xe988('0x43')]=function(_0x13e4de,_0x67e901){var _0x890fe7={'raw':!![],'where':{'id':_0x13e4de[_0xe988('0x44')]['id']}},_0x5d0186={};_0x5d0186[_0xe988('0x2e')]=_[_0xe988('0x31')](db['CmCustomField']['rawAttributes']);_0x5d0186[_0xe988('0x30')]=_['keys'](_0x13e4de[_0xe988('0x30')]);_0x5d0186[_0xe988('0x3a')]=_[_0xe988('0x32')](_0x5d0186['model'],_0x5d0186[_0xe988('0x30')]);_0x890fe7[_0xe988('0x33')]=_['intersection'](_0x5d0186[_0xe988('0x2e')],qs[_0xe988('0x34')](_0x13e4de[_0xe988('0x30')][_0xe988('0x34')]));_0x890fe7[_0xe988('0x33')]=_0x890fe7[_0xe988('0x33')][_0xe988('0x35')]?_0x890fe7[_0xe988('0x33')]:_0x5d0186['model'];if(_0x13e4de[_0xe988('0x30')][_0xe988('0x40')]){_0x890fe7[_0xe988('0x41')]=[{'all':!![]}];}_0x890fe7=_['merge']({},_0x890fe7,_0x13e4de[_0xe988('0x3f')]);return db[_0xe988('0x29')][_0xe988('0x45')](_0x890fe7)[_0xe988('0x24')](handleEntityNotFound(_0x67e901,null))[_0xe988('0x24')](respondWithResult(_0x67e901,null))[_0xe988('0x46')](handleError(_0x67e901,null));};exports['update']=function(_0xe267f2,_0x1a2e55){if(_0xe267f2[_0xe988('0x47')]['id']){delete _0xe267f2['body']['id'];}return db[_0xe988('0x29')][_0xe988('0x45')]({'where':{'id':_0xe267f2[_0xe988('0x44')]['id']}})[_0xe988('0x24')](handleEntityNotFound(_0x1a2e55,null))[_0xe988('0x24')](saveUpdates(_0xe267f2[_0xe988('0x47')],null))[_0xe988('0x24')](respondWithResult(_0x1a2e55,null))[_0xe988('0x46')](handleError(_0x1a2e55,null));};exports[_0xe988('0x48')]=function(_0x36be91,_0x5bd1e7){return db[_0xe988('0x29')][_0xe988('0x45')]({'where':{'id':_0x36be91[_0xe988('0x44')]['id']}})['then'](handleEntityNotFound(_0x5bd1e7,null))[_0xe988('0x24')](removeEntity(_0x5bd1e7,null))['catch'](handleError(_0x5bd1e7,null));};exports[_0xe988('0x49')]=function(_0x573cea,_0x1cae05){var _0x205a40;return db[_0xe988('0x4a')][_0xe988('0x4b')](function(_0x42a7bb){return db[_0xe988('0x29')][_0xe988('0x49')](_0x573cea[_0xe988('0x47')],{'transaction':_0x42a7bb})[_0xe988('0x24')](function(_0x4706cc){_0x205a40=_0x4706cc;var _0x10ab03={'type':db[_0xe988('0x4c')][_0xe988('0x4d')],'transaction':_0x42a7bb};switch(_0x573cea[_0xe988('0x47')][_0xe988('0x2c')]){case _0xe988('0x4e'):_0x10ab03[_0xe988('0x2c')]=db[_0xe988('0x4c')]['TEXT'];break;case _0xe988('0x4f'):_0x10ab03['type']=db['Sequelize'][_0xe988('0x50')];break;case _0xe988('0x51'):_0x10ab03[_0xe988('0x2c')]=db[_0xe988('0x4c')][_0xe988('0x52')];_0x10ab03[_0xe988('0x53')]=![];break;default:}return db[_0xe988('0x4a')]['queryInterface'][_0xe988('0x54')](_0xe988('0x55'),util['format'](_0xe988('0x56'),_0x205a40['id']),_0x10ab03);})['then'](function(){return _0x205a40;});})[_0xe988('0x24')](respondWithResult(_0x1cae05,0xc9))[_0xe988('0x46')](handleError(_0x1cae05,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 6e62885..15c658b 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 _0x79be=['util','../../config/logger','api','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash'];(function(_0x36fab1,_0x355381){var _0xc44716=function(_0x40fefd){while(--_0x40fefd){_0x36fab1['push'](_0x36fab1['shift']());}};_0xc44716(++_0x355381);}(_0x79be,0x12b));var _0xe79b=function(_0x30c8e0,_0x3f3e05){_0x30c8e0=_0x30c8e0-0x0;var _0x49a69c=_0x79be[_0x30c8e0];return _0x49a69c;};'use strict';var _=require(_0xe79b('0x0'));var util=require(_0xe79b('0x1'));var logger=require(_0xe79b('0x2'))(_0xe79b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe79b('0x4'));var rimraf=require(_0xe79b('0x5'));var config=require(_0xe79b('0x6'));var attributes=require(_0xe79b('0x7'));module[_0xe79b('0x8')]=function(_0x3b6e75,_0x5d42d8){return _0x3b6e75[_0xe79b('0x9')](_0xe79b('0xa'),attributes,{'tableName':_0xe79b('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d86=['exports','define','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x55730e,_0xd75445){var _0x2f3596=function(_0x4104bd){while(--_0x4104bd){_0x55730e['push'](_0x55730e['shift']());}};_0x2f3596(++_0xd75445);}(_0x4d86,0x183));var _0x64d8=function(_0x3a1f6c,_0x4d30fb){_0x3a1f6c=_0x3a1f6c-0x0;var _0x4d6a7c=_0x4d86[_0x3a1f6c];return _0x4d6a7c;};'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('bluebird');var rp=require(_0x64d8('0x5'));var fs=require('fs');var path=require(_0x64d8('0x6'));var rimraf=require(_0x64d8('0x7'));var config=require(_0x64d8('0x8'));var attributes=require('./cmCustomField.attributes');module[_0x64d8('0x9')]=function(_0xd83d3,_0x1925f5){return _0xd83d3[_0x64d8('0xa')]('CmCustomField',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 fd87e0d..536c5c8 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 _0x2d34=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1f7355,_0x3fbc6f){var _0x32eae7=function(_0x5c07ff){while(--_0x5c07ff){_0x1f7355['push'](_0x1f7355['shift']());}};_0x32eae7(++_0x3fbc6f);}(_0x2d34,0x156));var _0x42d3=function(_0x3d725a,_0x268334){_0x3d725a=_0x3d725a-0x0;var _0x1ad3ef=_0x2d34[_0x3d725a];return _0x1ad3ef;};'use strict';var _=require('lodash');var util=require(_0x42d3('0x0'));var moment=require(_0x42d3('0x1'));var BPromise=require(_0x42d3('0x2'));var rs=require(_0x42d3('0x3'));var fs=require('fs');var Redis=require(_0x42d3('0x4'));var db=require(_0x42d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x42d3('0x6'));var config=require('../../config/environment');var jayson=require(_0x42d3('0x7'));var client=jayson['client'][_0x42d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48cd68,_0x544b44,_0x40a830){return new BPromise(function(_0x34f057,_0x1d1a2f){return client['request'](_0x48cd68,_0x40a830)['then'](function(_0x1bcf96){logger[_0x42d3('0x9')](_0x42d3('0xa'),_0x544b44,'request\x20sent');logger[_0x42d3('0xb')](_0x42d3('0xc'),_0x544b44,_0x42d3('0xd'),JSON[_0x42d3('0xe')](_0x1bcf96));if(_0x1bcf96[_0x42d3('0xf')]){if(_0x1bcf96[_0x42d3('0xf')][_0x42d3('0x10')]===0x1f4){logger[_0x42d3('0xf')](_0x42d3('0xa'),_0x544b44,_0x1bcf96[_0x42d3('0xf')][_0x42d3('0x11')]);return _0x1d1a2f(_0x1bcf96['error'][_0x42d3('0x11')]);}logger[_0x42d3('0xf')](_0x42d3('0xa'),_0x544b44,_0x1bcf96['error']['message']);return _0x34f057(_0x1bcf96[_0x42d3('0xf')][_0x42d3('0x11')]);}else{logger['info'](_0x42d3('0xa'),_0x544b44,_0x42d3('0xd'));_0x34f057(_0x1bcf96[_0x42d3('0x12')][_0x42d3('0x11')]);}})[_0x42d3('0x13')](function(_0x552ec3){logger[_0x42d3('0xf')](_0x42d3('0xa'),_0x544b44,_0x552ec3);_0x1d1a2f(_0x552ec3);});});} \ No newline at end of file +var _0x57e6=['then','info','debug','request\x20sent','stringify','error','code','message','CmCustomField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','client','http','request'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x57e6,0xc8));var _0x657e=function(_0xd13171,_0xc54453){_0xd13171=_0xd13171-0x0;var _0x452bd0=_0x57e6[_0xd13171];return _0x452bd0;};'use strict';var _=require(_0x657e('0x0'));var util=require(_0x657e('0x1'));var moment=require(_0x657e('0x2'));var BPromise=require(_0x657e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x657e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x657e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x657e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x657e('0x7')][_0x657e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3afbf7,_0x473fa6,_0x3fe08e){return new BPromise(function(_0x313487,_0x456efa){return client[_0x657e('0x9')](_0x3afbf7,_0x3fe08e)[_0x657e('0xa')](function(_0x19820e){logger[_0x657e('0xb')]('CmCustomField,\x20%s,\x20%s',_0x473fa6,'request\x20sent');logger[_0x657e('0xc')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x473fa6,_0x657e('0xd'),JSON[_0x657e('0xe')](_0x19820e));if(_0x19820e['error']){if(_0x19820e[_0x657e('0xf')][_0x657e('0x10')]===0x1f4){logger[_0x657e('0xf')]('CmCustomField,\x20%s,\x20%s',_0x473fa6,_0x19820e[_0x657e('0xf')][_0x657e('0x11')]);return _0x456efa(_0x19820e['error'][_0x657e('0x11')]);}logger[_0x657e('0xf')](_0x657e('0x12'),_0x473fa6,_0x19820e['error'][_0x657e('0x11')]);return _0x313487(_0x19820e[_0x657e('0xf')][_0x657e('0x11')]);}else{logger[_0x657e('0xb')]('CmCustomField,\x20%s,\x20%s',_0x473fa6,'request\x20sent');_0x313487(_0x19820e[_0x657e('0x13')][_0x657e('0x11')]);}})[_0x657e('0x14')](function(_0x3907f2){logger[_0x657e('0xf')]('CmCustomField,\x20%s,\x20%s',_0x473fa6,_0x3907f2);_0x456efa(_0x3907f2);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index a49c5a1..89090d9 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 _0x35e2=['../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2f516f,_0x10197){var _0x5a57f1=function(_0x9e00b5){while(--_0x9e00b5){_0x2f516f['push'](_0x2f516f['shift']());}};_0x5a57f1(++_0x10197);}(_0x35e2,0x1ed));var _0x235e=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x35e2[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x235e('0x0'));var util=require('util');var path=require(_0x235e('0x1'));var timeout=require(_0x235e('0x2'));var express=require(_0x235e('0x3'));var router=express['Router']();var fs_extra=require(_0x235e('0x4'));var auth=require(_0x235e('0x5'));var interaction=require(_0x235e('0x6'));var config=require(_0x235e('0x7'));var controller=require(_0x235e('0x8'));router[_0x235e('0x9')]('/',auth[_0x235e('0xa')](),controller[_0x235e('0xb')]);router[_0x235e('0x9')](_0x235e('0xc'),auth[_0x235e('0xa')](),controller[_0x235e('0xd')]);router[_0x235e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x235e('0xf')](_0x235e('0xc'),auth['isAuthenticated'](),controller[_0x235e('0x10')]);router[_0x235e('0x11')](_0x235e('0xc'),auth[_0x235e('0xa')](),controller[_0x235e('0x12')]);module[_0x235e('0x13')]=router; \ No newline at end of file +var _0xed08=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show','post','create','update'];(function(_0x3bed69,_0xe8d6d9){var _0x3aec02=function(_0xd01efc){while(--_0xd01efc){_0x3bed69['push'](_0x3bed69['shift']());}};_0x3aec02(++_0xe8d6d9);}(_0xed08,0x67));var _0x8ed0=function(_0x231522,_0x46961e){_0x231522=_0x231522-0x0;var _0x3acae2=_0xed08[_0x231522];return _0x3acae2;};'use strict';var multer=require('multer');var util=require(_0x8ed0('0x0'));var path=require(_0x8ed0('0x1'));var timeout=require(_0x8ed0('0x2'));var express=require(_0x8ed0('0x3'));var router=express[_0x8ed0('0x4')]();var fs_extra=require(_0x8ed0('0x5'));var auth=require(_0x8ed0('0x6'));var interaction=require(_0x8ed0('0x7'));var config=require(_0x8ed0('0x8'));var controller=require(_0x8ed0('0x9'));router[_0x8ed0('0xa')]('/',auth[_0x8ed0('0xb')](),controller['index']);router[_0x8ed0('0xa')](_0x8ed0('0xc'),auth[_0x8ed0('0xb')](),controller[_0x8ed0('0xd')]);router[_0x8ed0('0xe')]('/',auth[_0x8ed0('0xb')](),controller[_0x8ed0('0xf')]);router['put'](_0x8ed0('0xc'),auth[_0x8ed0('0xb')](),controller[_0x8ed0('0x10')]);router[_0x8ed0('0x11')]('/:id',auth[_0x8ed0('0xb')](),controller[_0x8ed0('0x12')]);module[_0x8ed0('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index c87e358..59ee31c 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 _0x5f7f=['contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE','format','INTEGER','UNSIGNED'];(function(_0xee8055,_0x1c08b8){var _0x3c8a70=function(_0x6f3a9d){while(--_0x6f3a9d){_0xee8055['push'](_0xee8055['shift']());}};_0x3c8a70(++_0x1c08b8);}(_0x5f7f,0x1d5));var _0xf5f7=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f7f[_0x2f5ac5];return _0x37c9a8;};'use strict';var moment=require(_0xf5f7('0x0'));var Sequelize=require(_0xf5f7('0x1'));module['exports']={'phone':{'type':Sequelize[_0xf5f7('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xf5f7('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf5f7('0x4')],'defaultValue':moment()[_0xf5f7('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xf5f7('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf5f7('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf5f7('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf5f7('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf5f7('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf5f7('0x4')]},'priority':{'type':Sequelize[_0xf5f7('0x6')](0x2)[_0xf5f7('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf5f7('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xf5f7('0x8')},'ListId':{'type':Sequelize[_0xf5f7('0x6')],'unique':_0xf5f7('0x8')},'UserId':{'type':Sequelize[_0xf5f7('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xf5f7('0x6')],'unique':_0xf5f7('0x8')},'CampaignId':{'type':Sequelize[_0xf5f7('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xf5f7('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf5f7('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf5f7('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf5f7('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xf5f7('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x9a70=['STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','DATE','moment','sequelize'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x9a70,0x120));var _0x09a7=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x9a70[_0x1cc8fe];return _0x230054;};'use strict';var moment=require(_0x09a7('0x0'));var Sequelize=require(_0x09a7('0x1'));module['exports']={'phone':{'type':Sequelize[_0x09a7('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x09a7('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x09a7('0x4')](_0x09a7('0x5'))},'countbusyretry':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x09a7('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x09a7('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x09a7('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x09a7('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x09a7('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x09a7('0x8')},'UserId':{'type':Sequelize[_0x09a7('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x09a7('0x6')],'unique':_0x09a7('0x8')},'CampaignId':{'type':Sequelize[_0x09a7('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x09a7('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x09a7('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x09a7('0x9')],'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 a03ba8a..1d17c61 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 _0x0faf=['sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','CmContact','CmCompany','CmList','List','dialActive','getPreviewRecall','scheduledat','recallme','UPDATE','Contact','Company','getOpenContacts','preview','json','CmHopper,\x20%s,\x20%s,\x20%s','timezones','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','limit','undefined','count','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','filters','intersection','concat','$and','$gt','$gte','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$iLike','$notILike','$like','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','deleted','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0faf,0x132));var _0xf0fa=function(_0x5fa520,_0xaf0e7d){_0x5fa520=_0x5fa520-0x0;var _0x1bf6c4=_0x0faf[_0x5fa520];return _0x1bf6c4;};'use strict';var moment=require(_0xf0fa('0x0'));var _=require('lodash');var qs=require(_0xf0fa('0x1'));var logger=require(_0xf0fa('0x2'))(_0xf0fa('0x3'));var shared=require(_0xf0fa('0x4'));var db=require(_0xf0fa('0x5'))['db'];function respondWithResult(_0xdc9ce3,_0x515b12){_0x515b12=_0x515b12||0xc8;return function(_0xc83253){if(_0xc83253){return _0xdc9ce3[_0xf0fa('0x6')](_0x515b12)['json'](_0xc83253);}};}function respondWithFilteredResult(_0x3637a3,_0x44ffa0){return function(_0x25b5c4){if(_0x25b5c4){var _0x3a703b=typeof _0x44ffa0[_0xf0fa('0x7')]==='undefined'&&typeof _0x44ffa0[_0xf0fa('0x8')]===_0xf0fa('0x9');var _0x481a42=_0x25b5c4['count'];var _0x3bda51=_0x3a703b?0x0:_0x44ffa0[_0xf0fa('0x7')];var _0x25dfec=_0x3a703b?_0x25b5c4[_0xf0fa('0xa')]:_0x44ffa0[_0xf0fa('0x7')]+_0x44ffa0[_0xf0fa('0x8')];var _0x379ff6;if(_0x25dfec>=_0x481a42){_0x25dfec=_0x481a42;_0x379ff6=0xc8;}else{_0x379ff6=0xce;}_0x3637a3[_0xf0fa('0x6')](_0x379ff6);return _0x3637a3['set'](_0xf0fa('0xb'),_0x3bda51+'-'+_0x25dfec+'/'+_0x481a42)['json'](_0x25b5c4);}return null;};}function saveUpdates(_0x2f46ff,_0x521034){return function(_0x39ae2b){if(_0x39ae2b){return _0x39ae2b[_0xf0fa('0xc')](_0x2f46ff)[_0xf0fa('0xd')](function(_0x547952){return _0x547952;});}return null;};}function handleEntityNotFound(_0x5821ae,_0x42591b){return function(_0x540a04){if(!_0x540a04){_0x5821ae[_0xf0fa('0xe')](0x194);}return _0x540a04;};}function handleError(_0x81fc49,_0x10ce43){_0x10ce43=_0x10ce43||0x1f4;return function(_0x3203ce){logger[_0xf0fa('0xf')](_0x3203ce[_0xf0fa('0x10')]);if(_0x3203ce[_0xf0fa('0x11')]){delete _0x3203ce[_0xf0fa('0x11')];}_0x81fc49['status'](_0x10ce43)[_0xf0fa('0x12')](_0x3203ce);};}exports[_0xf0fa('0x13')]=function(_0x30ce17,_0x1d3c22){var _0x2bdf82={},_0x386e5f={},_0x5ba2eb={'count':0x0,'rows':[]};var _0x56ef81=_[_0xf0fa('0x14')](db[_0xf0fa('0x15')][_0xf0fa('0x16')],function(_0x2385e2){return{'name':_0x2385e2[_0xf0fa('0x17')],'type':_0x2385e2[_0xf0fa('0x18')][_0xf0fa('0x19')]};});_0x386e5f[_0xf0fa('0x1a')]=_[_0xf0fa('0x14')](_0x56ef81,_0xf0fa('0x11'));_0x386e5f[_0xf0fa('0x1b')]=_['keys'](_0x30ce17[_0xf0fa('0x1b')]);_0x386e5f[_0xf0fa('0x1c')]=_[_0xf0fa('0x1d')](_0x386e5f[_0xf0fa('0x1a')],_0x386e5f[_0xf0fa('0x1b')]);_0x386e5f[_0xf0fa('0x1c')]=_[_0xf0fa('0x1e')](_0x386e5f[_0xf0fa('0x1c')],[_0xf0fa('0x1f'),'$or',_0xf0fa('0x20'),_0xf0fa('0x21'),'$lt',_0xf0fa('0x22'),_0xf0fa('0x23'),_0xf0fa('0x24'),'$not',_0xf0fa('0x25'),_0xf0fa('0x26'),_0xf0fa('0x27'),_0xf0fa('0x28'),'$like','$notLike',_0xf0fa('0x29'),_0xf0fa('0x2a'),_0xf0fa('0x2b'),_0xf0fa('0x2c'),'$contains',_0xf0fa('0x2d'),_0xf0fa('0x2e')]);_0x2bdf82[_0xf0fa('0x2f')]=_['intersection'](_0x386e5f[_0xf0fa('0x1a')],qs['fields'](_0x30ce17[_0xf0fa('0x1b')][_0xf0fa('0x30')]));_0x2bdf82[_0xf0fa('0x2f')]=_0x2bdf82['attributes'][_0xf0fa('0x31')]?_0x2bdf82[_0xf0fa('0x2f')]:_0x386e5f[_0xf0fa('0x1a')];if(!_0x30ce17[_0xf0fa('0x1b')][_0xf0fa('0x32')](_0xf0fa('0x33'))){_0x2bdf82['limit']=qs['limit'](_0x30ce17[_0xf0fa('0x1b')][_0xf0fa('0x8')]);_0x2bdf82['offset']=qs[_0xf0fa('0x7')](_0x30ce17['query']['offset']);}_0x2bdf82['order']=qs[_0xf0fa('0x34')](_0x30ce17['query'][_0xf0fa('0x34')]);_0x2bdf82[_0xf0fa('0x35')]=qs[_0xf0fa('0x1c')](_[_0xf0fa('0x36')](_0x30ce17[_0xf0fa('0x1b')],_0x386e5f[_0xf0fa('0x1c')]),_0x56ef81);if(_0x30ce17[_0xf0fa('0x1b')][_0xf0fa('0x37')]){_0x2bdf82['where']=_[_0xf0fa('0x38')](_0x2bdf82[_0xf0fa('0x35')],{'$or':_[_0xf0fa('0x14')](_0x56ef81,function(_0x5c59a6){if(_0x5c59a6[_0xf0fa('0x18')]!==_0xf0fa('0x39')){var _0x19b137={};_0x19b137[_0x5c59a6[_0xf0fa('0x11')]]={'$like':'%'+_0x30ce17['query']['filter']+'%'};return _0x19b137;}})});}_0x2bdf82=_[_0xf0fa('0x38')]({},_0x2bdf82,_0x30ce17[_0xf0fa('0x3a')]);var _0x2a6560={'where':_0x2bdf82[_0xf0fa('0x35')]};return db[_0xf0fa('0x15')]['count'](_0x2a6560)['then'](function(_0x5a2be0){_0x5ba2eb['count']=_0x5a2be0;if(_0x30ce17[_0xf0fa('0x1b')][_0xf0fa('0x3b')]){_0x2bdf82['include']=[{'all':!![]}];}return db['CmHopper'][_0xf0fa('0x3c')](_0x2bdf82);})[_0xf0fa('0xd')](function(_0x28068c){_0x5ba2eb[_0xf0fa('0x3d')]=_0x28068c;return _0x5ba2eb;})[_0xf0fa('0xd')](respondWithFilteredResult(_0x1d3c22,_0x2bdf82))[_0xf0fa('0x3e')](handleError(_0x1d3c22,null));};exports[_0xf0fa('0x3f')]=function(_0x4f5664,_0x53f408){var _0x344bb0={'raw':!![],'where':{'id':_0x4f5664[_0xf0fa('0x40')]['id']}},_0x1d4830={};_0x1d4830[_0xf0fa('0x1a')]=_[_0xf0fa('0x41')](db[_0xf0fa('0x15')]['rawAttributes']);_0x1d4830[_0xf0fa('0x1b')]=_['keys'](_0x4f5664[_0xf0fa('0x1b')]);_0x1d4830[_0xf0fa('0x1c')]=_[_0xf0fa('0x1d')](_0x1d4830[_0xf0fa('0x1a')],_0x1d4830[_0xf0fa('0x1b')]);_0x344bb0[_0xf0fa('0x2f')]=_[_0xf0fa('0x1d')](_0x1d4830[_0xf0fa('0x1a')],qs[_0xf0fa('0x30')](_0x4f5664['query']['fields']));_0x344bb0['attributes']=_0x344bb0[_0xf0fa('0x2f')][_0xf0fa('0x31')]?_0x344bb0['attributes']:_0x1d4830[_0xf0fa('0x1a')];if(_0x4f5664[_0xf0fa('0x1b')][_0xf0fa('0x3b')]){_0x344bb0[_0xf0fa('0x42')]=[{'all':!![]}];}_0x344bb0=_['merge']({},_0x344bb0,_0x4f5664[_0xf0fa('0x3a')]);return db[_0xf0fa('0x15')][_0xf0fa('0x43')](_0x344bb0)[_0xf0fa('0xd')](handleEntityNotFound(_0x53f408,null))[_0xf0fa('0xd')](respondWithResult(_0x53f408,null))[_0xf0fa('0x3e')](handleError(_0x53f408,null));};exports[_0xf0fa('0x44')]=function(_0x295edd,_0x1b435f){return db['CmHopper'][_0xf0fa('0x44')](_0x295edd[_0xf0fa('0x45')],{})[_0xf0fa('0xd')](respondWithResult(_0x1b435f,0xc9))[_0xf0fa('0x3e')](handleError(_0x1b435f,null));};exports[_0xf0fa('0xc')]=function(_0x2f8c74,_0x53b2a6){if(_0x2f8c74[_0xf0fa('0x45')]['id']){delete _0x2f8c74[_0xf0fa('0x45')]['id'];}return db['CmHopper'][_0xf0fa('0x43')]({'where':{'id':_0x2f8c74[_0xf0fa('0x40')]['id']}})[_0xf0fa('0xd')](handleEntityNotFound(_0x53b2a6,null))[_0xf0fa('0xd')](saveUpdates(_0x2f8c74[_0xf0fa('0x45')],null))[_0xf0fa('0xd')](respondWithResult(_0x53b2a6,null))[_0xf0fa('0x3e')](handleError(_0x53b2a6,null));};exports[_0xf0fa('0x46')]=function(_0x35272e,_0x4cd85e){return db[_0xf0fa('0x15')]['describe']()[_0xf0fa('0xd')](respondWithResult(_0x4cd85e,null))[_0xf0fa('0x3e')](handleError(_0x4cd85e,null));};exports[_0xf0fa('0x47')]=function(_0x569ba9,_0x324765){var _0x20ea09;var _0x354f03=_0x569ba9[_0xf0fa('0x40')]['id'];return db[_0xf0fa('0x15')]['find']({'where':{'id':_0x569ba9[_0xf0fa('0x40')]['id']}})['then'](handleEntityNotFound(_0x324765,null))[_0xf0fa('0xd')](function(_0x821e40){if(_0x821e40){return _0x821e40[_0xf0fa('0x47')]()[_0xf0fa('0xd')](function(_0x8090a7){return _0x8090a7;});}})['then'](function(_0x368f0c){_0x20ea09=_0x368f0c;if(_0x368f0c){if(_0x368f0c[_0xf0fa('0x48')]||_0x368f0c[_0xf0fa('0x49')]){return db[_0x368f0c[_0xf0fa('0x48')]?_0xf0fa('0x4a'):_0xf0fa('0x4b')]['find']({'where':{'id':_0x368f0c[_0xf0fa('0x48')]?_0x368f0c['VoiceQueueId']:_0x368f0c['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0xf0fa('0xd')](function(_0x31b4b0){var _0xa256ee={};if(_0x31b4b0){_[_0xf0fa('0x38')](_0xa256ee,_[_0xf0fa('0x4c')](_0x20ea09[_0xf0fa('0x4d')],[_0xf0fa('0x4e'),_0xf0fa('0x4f'),'id']));_0xa256ee[_0xf0fa('0x50')]=0x15;_0xa256ee['statedesc']=_0xf0fa('0x51');_0xa256ee['campaign']=_0x31b4b0[_0xf0fa('0x11')];_0xa256ee[_0xf0fa('0x52')]=_0x569ba9[_0xf0fa('0x53')][_0xf0fa('0x11')];_0xa256ee['UserId']=_0x569ba9[_0xf0fa('0x53')]['id'];_0xa256ee['deleted']=!![];_0xa256ee[_0xf0fa('0x54')]=moment()[_0xf0fa('0x55')](_0xf0fa('0x56'));_0xa256ee[_0xf0fa('0x57')]=_0x20ea09[_0xf0fa('0x58')];_0xa256ee[_0xf0fa('0x59')]=_0x20ea09['VoiceQueueId']?_0xf0fa('0x5a'):_0xf0fa('0x5b');return db['CmContact'][_0xf0fa('0x43')]({'where':{'id':_0xa256ee[_0xf0fa('0x5c')]},'attributes':['firstName',_0xf0fa('0x5d')]})[_0xf0fa('0xd')](function(_0x57dccd){if(!_[_0xf0fa('0x5e')](_0x324765)&&!_[_0xf0fa('0x5e')](_0x57dccd[_0xf0fa('0x5f')])){_0xa256ee['calleridname']=_0x57dccd[_0xf0fa('0x5f')];if(!_[_0xf0fa('0x5e')](_0x57dccd['lastName'])){_0xa256ee[_0xf0fa('0x60')]+='\x20'+_0x57dccd[_0xf0fa('0x5d')];}}})[_0xf0fa('0x61')](function(){return db['CmHopperFinal'][_0xf0fa('0x44')](_0xa256ee);});}})[_0xf0fa('0xd')](function(_0x5c6dde){return db[_0xf0fa('0x62')][_0xf0fa('0x47')]({'where':{'CmHopperId':_0x354f03}});})[_0xf0fa('0xd')](function(){return _0x324765[_0xf0fa('0x6')](0xcc)[_0xf0fa('0x63')]();})[_0xf0fa('0x3e')](handleError(_0x324765,null));};exports[_0xf0fa('0x64')]=function(_0x337640,_0x32c846){var _0x2c2c30=[];return db['CmContact'][_0xf0fa('0x46')]()[_0xf0fa('0xd')](function(_0x298f47){_0x2c2c30=_[_0xf0fa('0x41')](_0x298f47);return _0x337640[_0xf0fa('0x53')][_0xf0fa('0x65')]({'where':{'type':_0xf0fa('0x66'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xf0fa('0x67'),_0xf0fa('0x68')],'raw':!![]});})[_0xf0fa('0xd')](function(_0x28fdf5){if(_0x28fdf5&&_0x28fdf5[_0xf0fa('0x31')]){return db[_0xf0fa('0x69')][_0xf0fa('0x6a')](function(_0x543a2c){var _0x5638e6={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf0fa('0x55')](_0xf0fa('0x56'))},'VoiceQueueId':{'$in':_[_0xf0fa('0x14')](_0x28fdf5,'id')},'$or':[{'UserId':null},{'UserId':_0x337640[_0xf0fa('0x53')]['id']}]};var _0x5bf7f2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x28fdf5)['filter'](['dialPreviewAutoRecallMe',0x0])[_0xf0fa('0x14')]('id')[_0xf0fa('0x6b')]()},'$or':[{'UserId':null},{'UserId':_0x337640[_0xf0fa('0x53')]['id']}]};var _0x189d30={'$or':[_0x5638e6,_0x5bf7f2]};var _0x508df9=[];if(_0x337640['body'][_0xf0fa('0x6c')]&&_0x337640['body'][_0xf0fa('0x6c')]===_0xf0fa('0x6d')){if(!_[_0xf0fa('0x6e')](_0x337640[_0xf0fa('0x45')][_0xf0fa('0x6f')])){_0x189d30['id']={'$in':_0x337640['body'][_0xf0fa('0x6f')]};}_0x508df9=[[_0xf0fa('0x70'),_0xf0fa('0x71')],[_0xf0fa('0x72'),_0x28fdf5[0x0][_0xf0fa('0x67')]===_0xf0fa('0x71')?_0xf0fa('0x73'):_0xf0fa('0x71')],db[_0xf0fa('0x69')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xf0fa('0x73')]];}else{if(!_['isEmpty'](_0x337640[_0xf0fa('0x45')]['hopperIds'])){_0x189d30['id']={'$notIn':_0x337640['body']['hopperIds']};}_0x508df9=[[_0xf0fa('0x70'),_0xf0fa('0x73')],[_0xf0fa('0x72'),_0x28fdf5[0x0][_0xf0fa('0x67')]],db[_0xf0fa('0x69')][_0xf0fa('0x74')](_0xf0fa('0x75')),['id',_0xf0fa('0x71')]];}return db[_0xf0fa('0x15')][_0xf0fa('0x76')]({'attributes':['id','scheduledat',_0xf0fa('0x58'),'recallme'],'where':_0x189d30,'order':_0x508df9,'transaction':_0x543a2c,'lock':_0x543a2c[_0xf0fa('0x77')]['UPDATE'],'include':[{'model':db[_0xf0fa('0x78')],'as':'Contact','attributes':_0x2c2c30,'include':[{'model':db[_0xf0fa('0x79')],'as':'Company','attributes':['id',_0xf0fa('0x11')]}]},{'model':db[_0xf0fa('0x7a')],'as':_0xf0fa('0x7b'),'attributes':['id',_0xf0fa('0x11')]},{'model':db[_0xf0fa('0x4a')],'as':'Queue','attributes':['id','name',_0xf0fa('0x7c')]}]})[_0xf0fa('0xd')](function(_0x5da2e6){if(_0x5da2e6){return _0x5da2e6['update']({'UserId':_0x337640[_0xf0fa('0x53')]['id']},{'transaction':_0x543a2c});}});});}})[_0xf0fa('0xd')](handleEntityNotFound(_0x32c846,null))[_0xf0fa('0xd')](respondWithResult(_0x32c846,null))[_0xf0fa('0x3e')](handleError(_0x32c846,null));};exports[_0xf0fa('0x7d')]=function(_0x56838f,_0x1a661d,_0x3bdb88){var _0x16492b=[];var _0x5ab304=_0x56838f['params']['id'];var _0x82277a=_0x56838f[_0xf0fa('0x53')]['id'];return db['CmContact']['describe']()[_0xf0fa('0xd')](function(_0x294c1a){_0x16492b=_[_0xf0fa('0x41')](_0x294c1a);return db['sequelize']['transaction'](function(_0x516eec){const _0x39711c={'id':_0x5ab304};return db['CmHopper']['findOne']({'attributes':['id',_0xf0fa('0x7e'),_0xf0fa('0x7f')],'where':_0x39711c,'transaction':_0x516eec,'lock':_0x516eec[_0xf0fa('0x77')][_0xf0fa('0x80')],'include':[{'model':db[_0xf0fa('0x78')],'as':_0xf0fa('0x81'),'attributes':_0x16492b,'include':[{'model':db['CmCompany'],'as':_0xf0fa('0x82'),'attributes':['id',_0xf0fa('0x11')]}]},{'model':db[_0xf0fa('0x7a')],'as':'List','attributes':['id',_0xf0fa('0x11')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xf0fa('0x11'),'dialActive']}]})['then'](function(_0x1f8977){if(_0x1f8977){return _0x1f8977[_0xf0fa('0xc')]({'UserId':_0x82277a},{'transaction':_0x516eec});}});});})[_0xf0fa('0xd')](handleEntityNotFound(_0x1a661d,null))['then'](respondWithResult(_0x1a661d,null))[_0xf0fa('0x3e')](handleError(_0x1a661d,null));};exports[_0xf0fa('0x83')]=function(_0x552b9e,_0x6fc2af){return _0x552b9e[_0xf0fa('0x53')][_0xf0fa('0x65')]({'where':{'type':_0xf0fa('0x66'),'dialActive':!![],'dialMethod':_0xf0fa('0x84')},'attributes':['id'],'raw':!![]})[_0xf0fa('0xd')](function(_0x56265f){if(_0x56265f&&_0x56265f[_0xf0fa('0x31')]){return db['CmHopper'][_0xf0fa('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xf0fa('0x55')](_0xf0fa('0x56'))},'VoiceQueueId':{'$in':_[_0xf0fa('0x14')](_0x56265f,'id')},'$or':[{'UserId':null},{'UserId':_0x552b9e[_0xf0fa('0x53')]['id']}]}});}return 0x0;})[_0xf0fa('0xd')](function(_0x626079){if(!_['isNil'](_0x626079)&&_['isNumber'](_0x626079)){return _0x6fc2af[_0xf0fa('0x6')](0xc8)[_0xf0fa('0x85')]({'contacts':_0x626079});}else{logger['error'](_0xf0fa('0x86'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x6fc2af[_0xf0fa('0xe')](0x194);}})[_0xf0fa('0x3e')](handleError(_0x6fc2af,null));};exports['getTimezones']=function(_0x5a2717,_0x2fe9b0){var _0x5fbd7f=shared[_0xf0fa('0x87')];var _0x21778b=[];_[_0xf0fa('0x14')](_0x5fbd7f,function(_0x52343e){_0x21778b['push']({'id':_0x52343e[_0xf0fa('0x11')],'name':_0x52343e[_0xf0fa('0x11')],'utcOffset':_0x52343e['utcOffset']});});return _0x2fe9b0[_0xf0fa('0x6')](0xc8)['json']({'tz':_0x21778b});};exports[_0xf0fa('0x88')]=function(_0x57f309,_0x4867ca){var _0x2bb0bf=shared['timezones'];var _0x51db99={};if(!_['isNil'](_0x2bb0bf[_0x57f309['body']['id']]))_0x51db99=_0x2bb0bf[_0x57f309[_0xf0fa('0x45')]['id']];return _0x4867ca['status'](0xc8)[_0xf0fa('0x85')](_0x51db99);}; \ No newline at end of file +var _0x8d0a=['$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','map','VIRTUAL','filter','options','CmHopper','count','then','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','Queue','dialActive','LOCK','CmList','List','getOpenContacts','outbound','isNumber','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','set','Content-Range','json','update','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','keys','query','filters','intersection','$and','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains'];(function(_0x1bcdc6,_0x1b4ed1){var _0x5bb4b0=function(_0x1ac468){while(--_0x1ac468){_0x1bcdc6['push'](_0x1bcdc6['shift']());}};_0x5bb4b0(++_0x1b4ed1);}(_0x8d0a,0x65));var _0xa8d0=function(_0x4c2462,_0x29a448){_0x4c2462=_0x4c2462-0x0;var _0x568667=_0x8d0a[_0x4c2462];return _0x568667;};'use strict';var moment=require(_0xa8d0('0x0'));var _=require('lodash');var qs=require(_0xa8d0('0x1'));var logger=require(_0xa8d0('0x2'))(_0xa8d0('0x3'));var shared=require(_0xa8d0('0x4'));var db=require(_0xa8d0('0x5'))['db'];function respondWithResult(_0x477190,_0x528287){_0x528287=_0x528287||0xc8;return function(_0x202833){if(_0x202833){return _0x477190[_0xa8d0('0x6')](_0x528287)['json'](_0x202833);}};}function respondWithFilteredResult(_0x1cac4f,_0x212aaf){return function(_0x1f95a7){if(_0x1f95a7){var _0x1f8b78=typeof _0x212aaf[_0xa8d0('0x7')]==='undefined'&&typeof _0x212aaf['limit']===_0xa8d0('0x8');var _0x823481=_0x1f95a7['count'];var _0x5362af=_0x1f8b78?0x0:_0x212aaf['offset'];var _0x296b54=_0x1f8b78?_0x1f95a7['count']:_0x212aaf[_0xa8d0('0x7')]+_0x212aaf[_0xa8d0('0x9')];var _0x44541e;if(_0x296b54>=_0x823481){_0x296b54=_0x823481;_0x44541e=0xc8;}else{_0x44541e=0xce;}_0x1cac4f[_0xa8d0('0x6')](_0x44541e);return _0x1cac4f[_0xa8d0('0xa')](_0xa8d0('0xb'),_0x5362af+'-'+_0x296b54+'/'+_0x823481)[_0xa8d0('0xc')](_0x1f95a7);}return null;};}function saveUpdates(_0x3bf335,_0x329583){return function(_0x1bfcb6){if(_0x1bfcb6){return _0x1bfcb6[_0xa8d0('0xd')](_0x3bf335)['then'](function(_0x757540){return _0x757540;});}return null;};}function handleEntityNotFound(_0x478f66,_0x5a9193){return function(_0x32ea3e){if(!_0x32ea3e){_0x478f66[_0xa8d0('0xe')](0x194);}return _0x32ea3e;};}function handleError(_0x523ec0,_0x31da9f){_0x31da9f=_0x31da9f||0x1f4;return function(_0x459e9d){logger[_0xa8d0('0xf')](_0x459e9d[_0xa8d0('0x10')]);if(_0x459e9d[_0xa8d0('0x11')]){delete _0x459e9d[_0xa8d0('0x11')];}_0x523ec0['status'](_0x31da9f)[_0xa8d0('0x12')](_0x459e9d);};}exports[_0xa8d0('0x13')]=function(_0x5cf619,_0x2f0b00){var _0x1e325a={},_0x53d168={},_0x32b11a={'count':0x0,'rows':[]};var _0xf9267d=_['map'](db['CmHopper'][_0xa8d0('0x14')],function(_0x25ed8d){return{'name':_0x25ed8d['fieldName'],'type':_0x25ed8d[_0xa8d0('0x15')][_0xa8d0('0x16')]};});_0x53d168[_0xa8d0('0x17')]=_['map'](_0xf9267d,_0xa8d0('0x11'));_0x53d168['query']=_[_0xa8d0('0x18')](_0x5cf619[_0xa8d0('0x19')]);_0x53d168[_0xa8d0('0x1a')]=_[_0xa8d0('0x1b')](_0x53d168[_0xa8d0('0x17')],_0x53d168[_0xa8d0('0x19')]);_0x53d168[_0xa8d0('0x1a')]=_['concat'](_0x53d168['filters'],[_0xa8d0('0x1c'),'$or',_0xa8d0('0x1d'),_0xa8d0('0x1e'),_0xa8d0('0x1f'),_0xa8d0('0x20'),_0xa8d0('0x21'),'$eq',_0xa8d0('0x22'),_0xa8d0('0x23'),_0xa8d0('0x24'),_0xa8d0('0x25'),_0xa8d0('0x26'),_0xa8d0('0x27'),_0xa8d0('0x28'),_0xa8d0('0x29'),'$notILike',_0xa8d0('0x27'),_0xa8d0('0x2a'),_0xa8d0('0x2b'),_0xa8d0('0x2c'),_0xa8d0('0x2d')]);_0x1e325a[_0xa8d0('0x2e')]=_['intersection'](_0x53d168[_0xa8d0('0x17')],qs[_0xa8d0('0x2f')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x2f')]));_0x1e325a['attributes']=_0x1e325a[_0xa8d0('0x2e')][_0xa8d0('0x30')]?_0x1e325a['attributes']:_0x53d168['model'];if(!_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x31')](_0xa8d0('0x32'))){_0x1e325a[_0xa8d0('0x9')]=qs[_0xa8d0('0x9')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x9')]);_0x1e325a[_0xa8d0('0x7')]=qs[_0xa8d0('0x7')](_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x7')]);}_0x1e325a[_0xa8d0('0x33')]=qs['sort'](_0x5cf619['query'][_0xa8d0('0x34')]);_0x1e325a['where']=qs[_0xa8d0('0x1a')](_[_0xa8d0('0x35')](_0x5cf619[_0xa8d0('0x19')],_0x53d168[_0xa8d0('0x1a')]),_0xf9267d);if(_0x5cf619[_0xa8d0('0x19')]['filter']){_0x1e325a['where']=_[_0xa8d0('0x36')](_0x1e325a[_0xa8d0('0x37')],{'$or':_[_0xa8d0('0x38')](_0xf9267d,function(_0x1352ed){if(_0x1352ed[_0xa8d0('0x15')]!==_0xa8d0('0x39')){var _0x5b2d5e={};_0x5b2d5e[_0x1352ed[_0xa8d0('0x11')]]={'$like':'%'+_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x3a')]+'%'};return _0x5b2d5e;}})});}_0x1e325a=_['merge']({},_0x1e325a,_0x5cf619[_0xa8d0('0x3b')]);var _0x4ac500={'where':_0x1e325a[_0xa8d0('0x37')]};return db[_0xa8d0('0x3c')][_0xa8d0('0x3d')](_0x4ac500)[_0xa8d0('0x3e')](function(_0x27515e){_0x32b11a['count']=_0x27515e;if(_0x5cf619[_0xa8d0('0x19')][_0xa8d0('0x3f')]){_0x1e325a[_0xa8d0('0x40')]=[{'all':!![]}];}return db[_0xa8d0('0x3c')][_0xa8d0('0x41')](_0x1e325a);})[_0xa8d0('0x3e')](function(_0x5dea4a){_0x32b11a[_0xa8d0('0x42')]=_0x5dea4a;return _0x32b11a;})[_0xa8d0('0x3e')](respondWithFilteredResult(_0x2f0b00,_0x1e325a))[_0xa8d0('0x43')](handleError(_0x2f0b00,null));};exports[_0xa8d0('0x44')]=function(_0xeba90c,_0x2f5186){var _0x1c1e05={'raw':!![],'where':{'id':_0xeba90c['params']['id']}},_0x10dc8b={};_0x10dc8b[_0xa8d0('0x17')]=_['keys'](db[_0xa8d0('0x3c')][_0xa8d0('0x14')]);_0x10dc8b[_0xa8d0('0x19')]=_[_0xa8d0('0x18')](_0xeba90c[_0xa8d0('0x19')]);_0x10dc8b[_0xa8d0('0x1a')]=_[_0xa8d0('0x1b')](_0x10dc8b[_0xa8d0('0x17')],_0x10dc8b[_0xa8d0('0x19')]);_0x1c1e05[_0xa8d0('0x2e')]=_[_0xa8d0('0x1b')](_0x10dc8b[_0xa8d0('0x17')],qs['fields'](_0xeba90c[_0xa8d0('0x19')][_0xa8d0('0x2f')]));_0x1c1e05[_0xa8d0('0x2e')]=_0x1c1e05[_0xa8d0('0x2e')][_0xa8d0('0x30')]?_0x1c1e05[_0xa8d0('0x2e')]:_0x10dc8b['model'];if(_0xeba90c[_0xa8d0('0x19')][_0xa8d0('0x3f')]){_0x1c1e05[_0xa8d0('0x40')]=[{'all':!![]}];}_0x1c1e05=_[_0xa8d0('0x36')]({},_0x1c1e05,_0xeba90c[_0xa8d0('0x3b')]);return db[_0xa8d0('0x3c')][_0xa8d0('0x45')](_0x1c1e05)[_0xa8d0('0x3e')](handleEntityNotFound(_0x2f5186,null))['then'](respondWithResult(_0x2f5186,null))[_0xa8d0('0x43')](handleError(_0x2f5186,null));};exports['create']=function(_0x3f6760,_0x1ae68b){return db[_0xa8d0('0x3c')][_0xa8d0('0x46')](_0x3f6760['body'],{})[_0xa8d0('0x3e')](respondWithResult(_0x1ae68b,0xc9))[_0xa8d0('0x43')](handleError(_0x1ae68b,null));};exports['update']=function(_0x22be14,_0x4b0d20){if(_0x22be14[_0xa8d0('0x47')]['id']){delete _0x22be14['body']['id'];}return db['CmHopper'][_0xa8d0('0x45')]({'where':{'id':_0x22be14[_0xa8d0('0x48')]['id']}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x4b0d20,null))[_0xa8d0('0x3e')](saveUpdates(_0x22be14['body'],null))[_0xa8d0('0x3e')](respondWithResult(_0x4b0d20,null))[_0xa8d0('0x43')](handleError(_0x4b0d20,null));};exports[_0xa8d0('0x49')]=function(_0x352adc,_0x2258d1){return db['CmHopper'][_0xa8d0('0x49')]()['then'](respondWithResult(_0x2258d1,null))[_0xa8d0('0x43')](handleError(_0x2258d1,null));};exports[_0xa8d0('0x4a')]=function(_0x3dd3ae,_0x5a2aef){var _0x900fd0;var _0x149d65=_0x3dd3ae[_0xa8d0('0x48')]['id'];return db[_0xa8d0('0x3c')][_0xa8d0('0x45')]({'where':{'id':_0x3dd3ae['params']['id']}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x5a2aef,null))[_0xa8d0('0x3e')](function(_0x5329d3){if(_0x5329d3){return _0x5329d3[_0xa8d0('0x4a')]()[_0xa8d0('0x3e')](function(_0x20b617){return _0x20b617;});}})[_0xa8d0('0x3e')](function(_0x2eeed7){_0x900fd0=_0x2eeed7;if(_0x2eeed7){if(_0x2eeed7[_0xa8d0('0x4b')]||_0x2eeed7[_0xa8d0('0x4c')]){return db[_0x2eeed7['VoiceQueueId']?_0xa8d0('0x4d'):'Campaign']['find']({'where':{'id':_0x2eeed7[_0xa8d0('0x4b')]?_0x2eeed7[_0xa8d0('0x4b')]:_0x2eeed7['CampaignId']},'attributes':['id',_0xa8d0('0x11')],'raw':!![]});}}})[_0xa8d0('0x3e')](function(_0x238a3f){var _0x5bc28c={};if(_0x238a3f){_[_0xa8d0('0x36')](_0x5bc28c,_['omit'](_0x900fd0[_0xa8d0('0x4e')],[_0xa8d0('0x4f'),_0xa8d0('0x50'),'id']));_0x5bc28c[_0xa8d0('0x51')]=0x15;_0x5bc28c[_0xa8d0('0x52')]=_0xa8d0('0x53');_0x5bc28c['campaign']=_0x238a3f[_0xa8d0('0x11')];_0x5bc28c[_0xa8d0('0x54')]=_0x3dd3ae[_0xa8d0('0x55')]['name'];_0x5bc28c[_0xa8d0('0x56')]=_0x3dd3ae[_0xa8d0('0x55')]['id'];_0x5bc28c[_0xa8d0('0x53')]=!![];_0x5bc28c[_0xa8d0('0x57')]=moment()[_0xa8d0('0x58')](_0xa8d0('0x59'));_0x5bc28c[_0xa8d0('0x5a')]=_0x900fd0[_0xa8d0('0x5b')];_0x5bc28c[_0xa8d0('0x5c')]=_0x900fd0[_0xa8d0('0x4b')]?_0xa8d0('0x5d'):_0xa8d0('0x5e');return db[_0xa8d0('0x5f')]['find']({'where':{'id':_0x5bc28c[_0xa8d0('0x60')]},'attributes':['firstName',_0xa8d0('0x61')]})['then'](function(_0x575301){if(!_[_0xa8d0('0x62')](_0x5a2aef)&&!_[_0xa8d0('0x62')](_0x575301[_0xa8d0('0x63')])){_0x5bc28c['calleridname']=_0x575301['firstName'];if(!_[_0xa8d0('0x62')](_0x575301[_0xa8d0('0x61')])){_0x5bc28c[_0xa8d0('0x64')]+='\x20'+_0x575301['lastName'];}}})[_0xa8d0('0x65')](function(){return db[_0xa8d0('0x66')][_0xa8d0('0x46')](_0x5bc28c);});}})[_0xa8d0('0x3e')](function(_0x20d3fe){return db[_0xa8d0('0x67')]['destroy']({'where':{'CmHopperId':_0x149d65}});})[_0xa8d0('0x3e')](function(){return _0x5a2aef[_0xa8d0('0x6')](0xcc)[_0xa8d0('0x68')]();})[_0xa8d0('0x43')](handleError(_0x5a2aef,null));};exports[_0xa8d0('0x69')]=function(_0x191df2,_0x3504ac){var _0x3a54a9=[];return db[_0xa8d0('0x5f')][_0xa8d0('0x49')]()['then'](function(_0x2e2237){_0x3a54a9=_[_0xa8d0('0x18')](_0x2e2237);return _0x191df2['user'][_0xa8d0('0x6a')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xa8d0('0x6b')},'attributes':['id',_0xa8d0('0x6c'),_0xa8d0('0x6d')],'raw':!![]});})[_0xa8d0('0x3e')](function(_0x59e607){if(_0x59e607&&_0x59e607['length']){return db[_0xa8d0('0x6e')][_0xa8d0('0x6f')](function(_0x41ebd3){var _0x4820d0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa8d0('0x58')](_0xa8d0('0x59'))},'VoiceQueueId':{'$in':_[_0xa8d0('0x38')](_0x59e607,'id')},'$or':[{'UserId':null},{'UserId':_0x191df2[_0xa8d0('0x55')]['id']}]};var _0x203b29={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x59e607)['filter']([_0xa8d0('0x6d'),0x0])[_0xa8d0('0x38')]('id')[_0xa8d0('0x70')]()},'$or':[{'UserId':null},{'UserId':_0x191df2[_0xa8d0('0x55')]['id']}]};var _0x5a2817={'$or':[_0x4820d0,_0x203b29]};var _0x682412=[];if(_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x71')]&&_0x191df2[_0xa8d0('0x47')]['direction']===_0xa8d0('0x72')){if(!_[_0xa8d0('0x73')](_0x191df2[_0xa8d0('0x47')]['hopperIds'])){_0x5a2817['id']={'$in':_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x74')]};}_0x682412=[[_0xa8d0('0x75'),_0xa8d0('0x76')],[_0xa8d0('0x77'),_0x59e607[0x0]['dialOrderByScheduledAt']===_0xa8d0('0x76')?_0xa8d0('0x78'):'ASC'],db[_0xa8d0('0x6e')][_0xa8d0('0x79')](_0xa8d0('0x7a')),['id',_0xa8d0('0x78')]];}else{if(!_[_0xa8d0('0x73')](_0x191df2[_0xa8d0('0x47')][_0xa8d0('0x74')])){_0x5a2817['id']={'$notIn':_0x191df2['body'][_0xa8d0('0x74')]};}_0x682412=[[_0xa8d0('0x75'),_0xa8d0('0x78')],[_0xa8d0('0x77'),_0x59e607[0x0][_0xa8d0('0x6c')]],db[_0xa8d0('0x6e')][_0xa8d0('0x79')](_0xa8d0('0x7b')),['id','ASC']];}return db[_0xa8d0('0x3c')][_0xa8d0('0x7c')]({'attributes':['id',_0xa8d0('0x7d'),_0xa8d0('0x5b'),_0xa8d0('0x7e')],'where':_0x5a2817,'order':_0x682412,'transaction':_0x41ebd3,'lock':_0x41ebd3['LOCK'][_0xa8d0('0x7f')],'include':[{'model':db[_0xa8d0('0x5f')],'as':_0xa8d0('0x80'),'attributes':_0x3a54a9,'include':[{'model':db[_0xa8d0('0x81')],'as':_0xa8d0('0x82'),'attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0xa8d0('0x11')]},{'model':db[_0xa8d0('0x4d')],'as':_0xa8d0('0x83'),'attributes':['id','name',_0xa8d0('0x84')]}]})[_0xa8d0('0x3e')](function(_0x4e373c){if(_0x4e373c){return _0x4e373c[_0xa8d0('0xd')]({'UserId':_0x191df2[_0xa8d0('0x55')]['id']},{'transaction':_0x41ebd3});}});});}})[_0xa8d0('0x3e')](handleEntityNotFound(_0x3504ac,null))['then'](respondWithResult(_0x3504ac,null))['catch'](handleError(_0x3504ac,null));};exports['getPreviewRecall']=function(_0x2e50c5,_0x5ea683,_0x1effc3){var _0x29d2c1=[];var _0x185a62=_0x2e50c5[_0xa8d0('0x48')]['id'];var _0x5c8ce5=_0x2e50c5[_0xa8d0('0x55')]['id'];return db[_0xa8d0('0x5f')][_0xa8d0('0x49')]()['then'](function(_0x37cba8){_0x29d2c1=_[_0xa8d0('0x18')](_0x37cba8);return db[_0xa8d0('0x6e')][_0xa8d0('0x6f')](function(_0x348529){const _0x4509c6={'id':_0x185a62};return db[_0xa8d0('0x3c')][_0xa8d0('0x7c')]({'attributes':['id',_0xa8d0('0x7d'),'recallme'],'where':_0x4509c6,'transaction':_0x348529,'lock':_0x348529[_0xa8d0('0x85')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xa8d0('0x80'),'attributes':_0x29d2c1,'include':[{'model':db[_0xa8d0('0x81')],'as':'Company','attributes':['id','name']}]},{'model':db[_0xa8d0('0x86')],'as':_0xa8d0('0x87'),'attributes':['id',_0xa8d0('0x11')]},{'model':db[_0xa8d0('0x4d')],'as':_0xa8d0('0x83'),'attributes':['id','name','dialActive']}]})[_0xa8d0('0x3e')](function(_0x12ad99){if(_0x12ad99){return _0x12ad99['update']({'UserId':_0x5c8ce5},{'transaction':_0x348529});}});});})[_0xa8d0('0x3e')](handleEntityNotFound(_0x5ea683,null))['then'](respondWithResult(_0x5ea683,null))[_0xa8d0('0x43')](handleError(_0x5ea683,null));};exports[_0xa8d0('0x88')]=function(_0x975558,_0x4dad88){return _0x975558['user']['getVoiceQueues']({'where':{'type':_0xa8d0('0x89'),'dialActive':!![],'dialMethod':_0xa8d0('0x6b')},'attributes':['id'],'raw':!![]})[_0xa8d0('0x3e')](function(_0x1815c8){if(_0x1815c8&&_0x1815c8[_0xa8d0('0x30')]){return db[_0xa8d0('0x3c')][_0xa8d0('0x3d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa8d0('0x59'))},'VoiceQueueId':{'$in':_['map'](_0x1815c8,'id')},'$or':[{'UserId':null},{'UserId':_0x975558[_0xa8d0('0x55')]['id']}]}});}return 0x0;})[_0xa8d0('0x3e')](function(_0x379286){if(!_[_0xa8d0('0x62')](_0x379286)&&_[_0xa8d0('0x8a')](_0x379286)){return _0x4dad88[_0xa8d0('0x6')](0xc8)['json']({'contacts':_0x379286});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0xa8d0('0x88'),0x194,_0xa8d0('0x8b'));_0x4dad88[_0xa8d0('0xe')](0x194);}})[_0xa8d0('0x43')](handleError(_0x4dad88,null));};exports[_0xa8d0('0x8c')]=function(_0x2e439b,_0xfcdf8c){var _0x543521=shared['timezones'];var _0x458af1=[];_[_0xa8d0('0x38')](_0x543521,function(_0x4eb658){_0x458af1[_0xa8d0('0x8d')]({'id':_0x4eb658['name'],'name':_0x4eb658['name'],'utcOffset':_0x4eb658[_0xa8d0('0x8e')]});});return _0xfcdf8c[_0xa8d0('0x6')](0xc8)[_0xa8d0('0xc')]({'tz':_0x458af1});};exports[_0xa8d0('0x8f')]=function(_0x1d8197,_0x2be1ad){var _0x76609=shared[_0xa8d0('0x90')];var _0x4fc9fe={};if(!_[_0xa8d0('0x62')](_0x76609[_0x1d8197['body']['id']]))_0x4fc9fe=_0x76609[_0x1d8197[_0xa8d0('0x47')]['id']];return _0x2be1ad[_0xa8d0('0x6')](0xc8)[_0xa8d0('0xc')](_0x4fc9fe);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index a82d7ef..69067b3 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 _0xeff8=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone'];(function(_0x3fed8b,_0x207546){var _0x5f3949=function(_0x25524b){while(--_0x25524b){_0x3fed8b['push'](_0x3fed8b['shift']());}};_0x5f3949(++_0x207546);}(_0xeff8,0x186));var _0x8eff=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0xeff8[_0x386c3e];return _0x4b8e13;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x8eff('0xb'),'fields':[_0x8eff('0xb')]},{'name':_0x8eff('0xc'),'fields':[_0x8eff('0xc')]},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe3da=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','priority','lodash','util','../../config/logger'];(function(_0x29ccc1,_0x554f10){var _0x377137=function(_0x28e17b){while(--_0x28e17b){_0x29ccc1['push'](_0x29ccc1['shift']());}};_0x377137(++_0x554f10);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xae3d('0xe'),'fields':[_0xae3d('0xe')]},{'name':'phone','fields':['phone']},{'name':_0xae3d('0xf'),'fields':[_0xae3d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 85c3423..06862f1 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 _0x8c5c=['voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','raw','options','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','message','error','ShowCmHopper','find','CreateCmHopper','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','transaction','LOCK','Contact','keys','User','name','voicePause','length','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','order','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications'];(function(_0x569250,_0x282648){var _0x1ab76e=function(_0x507a51){while(--_0x507a51){_0x569250['push'](_0x569250['shift']());}};_0x1ab76e(++_0x282648);}(_0x8c5c,0x1a2));var _0xc8c5=function(_0x24ea52,_0x1a90d5){_0x24ea52=_0x24ea52-0x0;var _0x419ec3=_0x8c5c[_0x24ea52];return _0x419ec3;};'use strict';var _=require(_0xc8c5('0x0'));var util=require(_0xc8c5('0x1'));var moment=require(_0xc8c5('0x2'));var BPromise=require(_0xc8c5('0x3'));var db=require(_0xc8c5('0x4'))['db'];var logger=require(_0xc8c5('0x5'))(_0xc8c5('0x6'));exports[_0xc8c5('0x7')]=function(_0xabdb9f){var _0x456b18=this;return new Promise(function(_0x1a4bf1,_0x17e85a){return db[_0xc8c5('0x8')][_0xc8c5('0x9')]({'raw':_0xabdb9f['options']?_0xabdb9f['options'][_0xc8c5('0xa')]===undefined?!![]:![]:!![],'where':_0xabdb9f[_0xc8c5('0xb')]?_0xabdb9f['options'][_0xc8c5('0xc')]||null:null,'attributes':_0xabdb9f[_0xc8c5('0xb')]?_0xabdb9f[_0xc8c5('0xb')][_0xc8c5('0xd')]||null:null,'limit':_0xabdb9f[_0xc8c5('0xb')]?_0xabdb9f[_0xc8c5('0xb')][_0xc8c5('0xe')]||null:null,'include':_0xabdb9f[_0xc8c5('0xb')]?_0xabdb9f[_0xc8c5('0xb')][_0xc8c5('0xf')]?_[_0xc8c5('0x10')](_0xabdb9f[_0xc8c5('0xb')][_0xc8c5('0xf')],function(_0x2efb58){return{'model':db[_0x2efb58[_0xc8c5('0x11')]],'as':_0x2efb58['as'],'attributes':_0x2efb58[_0xc8c5('0xd')],'include':_0x2efb58['include']?_[_0xc8c5('0x10')](_0x2efb58[_0xc8c5('0xf')],function(_0x52dba2){return{'model':db[_0x52dba2[_0xc8c5('0x11')]],'as':_0x52dba2['as'],'attributes':_0x52dba2[_0xc8c5('0xd')],'include':_0x52dba2['include']?_[_0xc8c5('0x10')](_0x52dba2[_0xc8c5('0xf')],function(_0x430d90){return{'model':db[_0x430d90[_0xc8c5('0x11')]],'as':_0x430d90['as'],'attributes':_0x430d90['attributes']};}):[]};}):[]};}):[]:[]})[_0xc8c5('0x12')](function(_0x18680f){logger[_0xc8c5('0x13')]('GetCmHopper',_0xabdb9f);logger[_0xc8c5('0x14')](_0xc8c5('0x7'),_0xabdb9f,JSON[_0xc8c5('0x15')](_0x18680f));_0x1a4bf1(_0x18680f);})[_0xc8c5('0x16')](function(_0x1c54d7){logger['error'](_0xc8c5('0x7'),_0x1c54d7[_0xc8c5('0x17')],_0xabdb9f);_0x17e85a(_0x456b18[_0xc8c5('0x18')](0x1f4,_0x1c54d7['message']));});});};exports[_0xc8c5('0x19')]=function(_0x614481){var _0x764c2d=this;return new Promise(function(_0x3781d0,_0x1b5db6){return db['CmHopper'][_0xc8c5('0x1a')]({'raw':_0x614481[_0xc8c5('0xb')]?_0x614481[_0xc8c5('0xb')][_0xc8c5('0xa')]===undefined?!![]:![]:!![],'where':_0x614481[_0xc8c5('0xb')]?_0x614481[_0xc8c5('0xb')][_0xc8c5('0xc')]||null:null,'attributes':_0x614481[_0xc8c5('0xb')]?_0x614481[_0xc8c5('0xb')][_0xc8c5('0xd')]||null:null,'include':_0x614481[_0xc8c5('0xb')]?_0x614481[_0xc8c5('0xb')][_0xc8c5('0xf')]?_[_0xc8c5('0x10')](_0x614481[_0xc8c5('0xb')][_0xc8c5('0xf')],function(_0x44ef22){return{'model':db[_0x44ef22[_0xc8c5('0x11')]],'as':_0x44ef22['as'],'attributes':_0x44ef22[_0xc8c5('0xd')],'include':_0x44ef22[_0xc8c5('0xf')]?_['map'](_0x44ef22[_0xc8c5('0xf')],function(_0x457f78){return{'model':db[_0x457f78['model']],'as':_0x457f78['as'],'attributes':_0x457f78[_0xc8c5('0xd')],'include':_0x457f78['include']?_[_0xc8c5('0x10')](_0x457f78[_0xc8c5('0xf')],function(_0x3d2e48){return{'model':db[_0x3d2e48['model']],'as':_0x3d2e48['as'],'attributes':_0x3d2e48['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x56f8ef){logger['info'](_0xc8c5('0x19'),_0x614481);logger[_0xc8c5('0x14')]('ShowCmHopper',_0x614481,JSON['stringify'](_0x56f8ef));_0x3781d0(_0x56f8ef);})[_0xc8c5('0x16')](function(_0x104ca6){logger[_0xc8c5('0x18')](_0xc8c5('0x19'),_0x104ca6[_0xc8c5('0x17')],_0x614481);_0x1b5db6(_0x764c2d[_0xc8c5('0x18')](0x1f4,_0x104ca6['message']));});});};exports[_0xc8c5('0x1b')]=function(_0x1c252b){var _0xb1e8fd=this;return new Promise(function(_0x53aab8,_0x5765b1){return db['CmHopper']['create'](_0x1c252b[_0xc8c5('0x1c')],{'raw':_0x1c252b['options']?_0x1c252b[_0xc8c5('0xb')][_0xc8c5('0xa')]===undefined?!![]:![]:!![]})[_0xc8c5('0x12')](function(_0x5e2f74){logger[_0xc8c5('0x13')](_0xc8c5('0x1b'),_0x1c252b);logger[_0xc8c5('0x14')](_0xc8c5('0x1b'),_0x1c252b,JSON[_0xc8c5('0x15')](_0x5e2f74));_0x53aab8(_0x5e2f74);})[_0xc8c5('0x16')](function(_0x12cb71){logger[_0xc8c5('0x18')]('CreateCmHopper',_0x12cb71['message'],_0x1c252b);_0x5765b1(_0xb1e8fd[_0xc8c5('0x18')](0x1f4,_0x12cb71[_0xc8c5('0x17')]));});});};exports[_0xc8c5('0x1d')]=function(_0x5b45d8){var _0x56b888=this;return new Promise(function(_0xabc495,_0x37ae9c){return db['CmHopper'][_0xc8c5('0x1e')](_0x5b45d8[_0xc8c5('0x1c')],{'raw':_0x5b45d8[_0xc8c5('0xb')]?_0x5b45d8[_0xc8c5('0xb')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b45d8[_0xc8c5('0xb')]?_0x5b45d8['options'][_0xc8c5('0xc')]||null:null,'attributes':_0x5b45d8[_0xc8c5('0xb')]?_0x5b45d8[_0xc8c5('0xb')][_0xc8c5('0xd')]||null:null,'limit':_0x5b45d8['options']?_0x5b45d8[_0xc8c5('0xb')][_0xc8c5('0xe')]||null:null})['then'](function(_0x926323){logger[_0xc8c5('0x13')](_0xc8c5('0x1d'),_0x5b45d8);logger[_0xc8c5('0x13')](_0xc8c5('0x1f'),JSON[_0xc8c5('0x15')](_0x5b45d8[_0xc8c5('0xb')][_0xc8c5('0xc')]),_0x5b45d8[_0xc8c5('0x1c')][_0xc8c5('0x20')]);logger['debug'](_0xc8c5('0x1d'),_0x5b45d8,JSON[_0xc8c5('0x15')](_0x926323));_0xabc495(_0x926323);})[_0xc8c5('0x16')](function(_0x4ce5b5){logger[_0xc8c5('0x18')]('UpdateCmHopper',_0x4ce5b5[_0xc8c5('0x17')],_0x5b45d8);_0x37ae9c(_0x56b888[_0xc8c5('0x18')](0x1f4,_0x4ce5b5[_0xc8c5('0x17')]));});});};exports[_0xc8c5('0x21')]=function(_0x59ce8a){var _0x23de34=this;return new Promise(function(_0x42edb6,_0x1661da){return db['CmHopper']['destroy']({'where':_0x59ce8a[_0xc8c5('0xb')]?_0x59ce8a[_0xc8c5('0xb')]['where']||null:null})[_0xc8c5('0x12')](function(_0x870558){logger[_0xc8c5('0x13')](_0xc8c5('0x21'),_0x59ce8a);logger[_0xc8c5('0x14')](_0xc8c5('0x21'),_0x59ce8a,JSON[_0xc8c5('0x15')](_0x870558));_0x42edb6(_0x870558);})[_0xc8c5('0x16')](function(_0x2edac6){logger[_0xc8c5('0x18')](_0xc8c5('0x21'),_0x2edac6[_0xc8c5('0x17')],_0x59ce8a);_0x1661da(_0x23de34['error'](0x1f4,_0x2edac6[_0xc8c5('0x17')]));});});};exports[_0xc8c5('0x22')]=function(_0x4409e3){var _0x33d258=this;return new Promise(function(_0x12c6fe,_0x36b392){return db[_0xc8c5('0x23')]['describe']()['then'](function(_0x391d20){return db['sequelize'][_0xc8c5('0x24')](function(_0x1976a9){return db['CmHopper'][_0xc8c5('0x9')]({'where':_0x4409e3[_0xc8c5('0xb')]?_0x4409e3['options'][_0xc8c5('0xc')]||null:null,'attributes':_0x4409e3[_0xc8c5('0xb')]?_0x4409e3['options'][_0xc8c5('0xd')]||null:null,'limit':_0x4409e3[_0xc8c5('0xb')]?_0x4409e3[_0xc8c5('0xb')][_0xc8c5('0xe')]||null:null,'order':_0x4409e3[_0xc8c5('0xb')]?_0x4409e3[_0xc8c5('0xb')]['order']||null:null,'transaction':_0x1976a9,'lock':_0x1976a9[_0xc8c5('0x25')]['UPDATE'],'include':[{'model':db[_0xc8c5('0x23')],'as':_0xc8c5('0x26'),'attributes':_[_0xc8c5('0x27')](_0x391d20)},{'model':db[_0xc8c5('0x28')],'as':'Agent','attributes':['id',_0xc8c5('0x29'),_0xc8c5('0x2a')]}]})[_0xc8c5('0x12')](function(_0x26135f){var _0x274b07=[];var _0x4ebf1e=[];for(var _0x5608b4=0x0;_0x5608b4<_0x26135f[_0xc8c5('0x2b')];_0x5608b4+=0x1){var _0x19ce15=_0x26135f[_0x5608b4]['UserId'];if(_0x19ce15===null){_0x274b07[_0xc8c5('0x2c')](_0x26135f[_0x5608b4][_0xc8c5('0x1e')](_0x4409e3['body'],{'transaction':_0x1976a9}));}else if(!_0x4ebf1e['includes'](_0x19ce15)){_0x4ebf1e[_0xc8c5('0x2c')](_0x19ce15);_0x274b07[_0xc8c5('0x2c')](_0x26135f[_0x5608b4]['update'](_0x4409e3[_0xc8c5('0x1c')],{'transaction':_0x1976a9}));}}return BPromise[_0xc8c5('0x2d')](_0x274b07);});})[_0xc8c5('0x12')](function(_0x1500d3){logger['info']('GetContactDialer',_0x4409e3);if(_0x1500d3[_0xc8c5('0x2b')]>0x0){logger['info'](_0xc8c5('0x2e'),_0x1500d3[0x0]['dataValues']['id'],_0x1500d3[0x0][_0xc8c5('0x2f')][_0xc8c5('0x30')],_0x1500d3[0x0][_0xc8c5('0x2f')]['active']);}logger['debug'](_0xc8c5('0x22'),_0x4409e3,JSON[_0xc8c5('0x15')](_0x1500d3));_0x12c6fe(_0x1500d3);})[_0xc8c5('0x16')](function(_0x2ebefb){logger[_0xc8c5('0x18')](_0xc8c5('0x22'),_0x2ebefb['message'],_0x4409e3);_0x36b392(_0x33d258['error'](0x1f4,_0x2ebefb[_0xc8c5('0x17')]));});});});};exports[_0xc8c5('0x31')]=function(_0x3875e9){var _0x275f99=this;return new Promise(function(_0x4b9db8,_0x10f4a1){return db[_0xc8c5('0x32')][_0xc8c5('0x24')](function(_0x5b5ccd){return db[_0xc8c5('0x33')][_0xc8c5('0x34')](_0x3875e9[_0xc8c5('0x1c')],{'raw':_0x3875e9[_0xc8c5('0xb')]?_0x3875e9['options'][_0xc8c5('0xa')]===undefined?!![]:![]:!![],'transaction':_0x5b5ccd})[_0xc8c5('0x12')](function(){logger[_0xc8c5('0x13')](_0xc8c5('0x35'),JSON[_0xc8c5('0x15')](_0x3875e9[_0xc8c5('0xb')]['where']),_0x3875e9[_0xc8c5('0xb')][_0xc8c5('0xc')]['active']);return db[_0xc8c5('0x8')][_0xc8c5('0x36')]({'where':_0x3875e9['options']?_0x3875e9[_0xc8c5('0xb')][_0xc8c5('0xc')]||null:null,'transaction':_0x5b5ccd});});})[_0xc8c5('0x12')](function(_0x3ce8a3){logger[_0xc8c5('0x13')]('MoveContactManagedDialer',_0x3875e9);logger['debug'](_0xc8c5('0x31'),_0x3875e9,JSON[_0xc8c5('0x15')](_0x3ce8a3));_0x4b9db8(_0x3ce8a3);})[_0xc8c5('0x16')](function(_0x1c159c){logger[_0xc8c5('0x18')]('MoveContactManagedDialer',_0x1c159c[_0xc8c5('0x17')],_0x3875e9);_0x10f4a1(_0x275f99[_0xc8c5('0x18')](0x1f4,_0x1c159c[_0xc8c5('0x17')]));});});};exports[_0xc8c5('0x37')]=function(_0x3e2dd8){var _0x232a24=this;return new Promise(function(_0xec82e8,_0x57a115){return db[_0xc8c5('0x8')][_0xc8c5('0x9')]({'raw':_0x3e2dd8['options']?_0x3e2dd8[_0xc8c5('0xb')][_0xc8c5('0xa')]===undefined?!![]:![]:!![],'where':_0x3e2dd8[_0xc8c5('0xb')]?_0x3e2dd8[_0xc8c5('0xb')]['where']||null:null,'attributes':[[db[_0xc8c5('0x32')]['fn'](_0xc8c5('0x38'),db[_0xc8c5('0x32')]['fn']('IF',db['sequelize'][_0xc8c5('0x39')](_0xc8c5('0x3a')+util[_0xc8c5('0x3b')]('\x22%s\x22',moment()[_0xc8c5('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xc8c5('0x3c')))),_0xc8c5('0x3d')]]})[_0xc8c5('0x12')](function(_0x39430d){logger[_0xc8c5('0x13')](_0xc8c5('0x37'),_0x3e2dd8);logger[_0xc8c5('0x14')](_0xc8c5('0x37'),_0x3e2dd8,JSON[_0xc8c5('0x15')](_0x39430d));_0xec82e8(_0x39430d);})[_0xc8c5('0x16')](function(_0x5ae49a){logger[_0xc8c5('0x18')](_0xc8c5('0x37'),_0x5ae49a['message'],_0x3e2dd8);_0x57a115(_0x232a24[_0xc8c5('0x18')](0x1f4,_0x5ae49a[_0xc8c5('0x17')]));});});};exports[_0xc8c5('0x3e')]=function(_0x119462){var _0x59819a=this;return new Promise(function(_0x12aedf,_0x117ab2){return db[_0xc8c5('0x23')][_0xc8c5('0x3f')]()[_0xc8c5('0x12')](function(){return db[_0xc8c5('0x32')][_0xc8c5('0x24')](function(_0x4e8c83){return db[_0xc8c5('0x8')][_0xc8c5('0x9')]({'where':_0x119462[_0xc8c5('0xb')]?_0x119462[_0xc8c5('0xb')][_0xc8c5('0xc')]||null:null,'attributes':_0x119462[_0xc8c5('0xb')]?_0x119462[_0xc8c5('0xb')][_0xc8c5('0xd')]||null:null,'limit':0x1,'order':_0x119462[_0xc8c5('0xb')]?_0x119462[_0xc8c5('0xb')][_0xc8c5('0x40')]||null:null,'group':db[_0xc8c5('0x8')]['UserId'],'transaction':_0x4e8c83,'lock':_0x4e8c83[_0xc8c5('0x25')]['UPDATE'],'include':_0x119462['options']?_0x119462['options'][_0xc8c5('0xf')]?_['map'](_0x119462[_0xc8c5('0xb')]['include'],function(_0x490871){return{'model':db[_0x490871[_0xc8c5('0x11')]],'as':_0x490871['as'],'attributes':_0x490871[_0xc8c5('0xd')],'include':_0x490871['include']?_['map'](_0x490871[_0xc8c5('0xf')],function(_0x64d501){return{'model':db[_0x64d501['model']],'as':_0x64d501['as'],'attributes':_0x64d501[_0xc8c5('0xd')],'include':_0x64d501[_0xc8c5('0xf')]?_['map'](_0x64d501[_0xc8c5('0xf')],function(_0x2d3265){return{'model':db[_0x2d3265['model']],'as':_0x2d3265['as'],'attributes':_0x2d3265[_0xc8c5('0xd')]};}):[]};}):[]};}):[]:[]})[_0xc8c5('0x12')](function(_0x9b0dae){var _0x76dc93=[];for(var _0x13f67c=0x0;_0x13f67c<_0x9b0dae['length'];_0x13f67c+=0x1){_0x76dc93['push'](_0x9b0dae[_0x13f67c]['update'](_0x119462[_0xc8c5('0x1c')],{'transaction':_0x4e8c83}));}return BPromise[_0xc8c5('0x2d')](_0x76dc93);});})[_0xc8c5('0x12')](function(_0x9c338b){logger[_0xc8c5('0x13')]('GetContactRecallMe',_0x119462);logger[_0xc8c5('0x14')](_0xc8c5('0x3e'),_0x119462,JSON[_0xc8c5('0x15')](_0x9c338b));_0x12aedf(_0x9c338b);})['catch'](function(_0xa4478e){logger[_0xc8c5('0x18')](_0xc8c5('0x3e'),_0xa4478e['message'],_0x119462);_0x117ab2(_0x59819a[_0xc8c5('0x18')](0x1f4,_0xa4478e['message']));});});});};exports[_0xc8c5('0x41')]=function(_0x4608b3){var _0x5f5243=this;return new Promise(function(_0x3f0a6a,_0x2a7345){db[_0xc8c5('0x23')]['describe']()[_0xc8c5('0x12')](function(_0x5e5576){return db[_0xc8c5('0x8')][_0xc8c5('0x9')]({'raw':_0x4608b3[_0xc8c5('0xb')]?_0x4608b3[_0xc8c5('0xb')][_0xc8c5('0xa')]===undefined?!![]:![]:!![],'where':_0x4608b3[_0xc8c5('0xb')]?_0x4608b3['options'][_0xc8c5('0xc')]||null:null,'attributes':_0x4608b3[_0xc8c5('0xb')]?_0x4608b3[_0xc8c5('0xb')][_0xc8c5('0xd')]||null:null,'limit':_0x4608b3[_0xc8c5('0xb')]?_0x4608b3[_0xc8c5('0xb')][_0xc8c5('0xe')]||null:null,'include':_0x4608b3[_0xc8c5('0xb')]?_0x4608b3[_0xc8c5('0xb')][_0xc8c5('0xf')]?_[_0xc8c5('0x10')](_0x4608b3[_0xc8c5('0xb')][_0xc8c5('0xf')],function(_0x2cf1d7){return{'model':db[_0x2cf1d7['model']],'as':_0x2cf1d7['as'],'attributes':_0x2cf1d7['as']===_0xc8c5('0x26')?_[_0xc8c5('0x27')](_0x5e5576):_0x2cf1d7[_0xc8c5('0xd')],'include':_0x2cf1d7[_0xc8c5('0xf')]?_['map'](_0x2cf1d7[_0xc8c5('0xf')],function(_0x3ef035){return{'model':db[_0x3ef035[_0xc8c5('0x11')]],'as':_0x3ef035['as'],'attributes':_0x3ef035[_0xc8c5('0xd')],'include':_0x3ef035[_0xc8c5('0xf')]?_[_0xc8c5('0x10')](_0x3ef035[_0xc8c5('0xf')],function(_0x275012){return{'model':db[_0x275012['model']],'as':_0x275012['as'],'attributes':_0x275012['attributes']};}):[]};}):[]};}):[]:[]})[_0xc8c5('0x12')](function(_0x5df25e){logger[_0xc8c5('0x13')](_0xc8c5('0x7'),_0x4608b3);logger['debug']('GetCmHopper',_0x4608b3,JSON['stringify'](_0x5df25e));_0x3f0a6a(_0x5df25e);})[_0xc8c5('0x16')](function(_0x3cbe07){logger[_0xc8c5('0x18')]('GetCmHopper',_0x3cbe07[_0xc8c5('0x17')],_0x4608b3);_0x2a7345(_0x5f5243[_0xc8c5('0x18')](0x1f4,_0x3cbe07['message']));});});});};exports[_0xc8c5('0x42')]=function(_0x21e830){var _0x53dcdb=this;return new Promise(function(_0x25d5bc,_0x55441f){return db[_0xc8c5('0x23')][_0xc8c5('0x43')]({'raw':!![],'where':{'phone':_0x21e830[_0xc8c5('0xb')][_0xc8c5('0xc')][_0xc8c5('0x44')]},'attributes':['id',_0xc8c5('0x45')],'order':[['id',_0xc8c5('0x46')]]})[_0xc8c5('0x12')](function(_0x2439ae){logger['info'](_0xc8c5('0x47'),_0x21e830);logger[_0xc8c5('0x14')]('getContactByPhone',_0x21e830,JSON['stringify'](_0x2439ae));_0x25d5bc(_0x2439ae);})[_0xc8c5('0x16')](function(_0x536420){logger[_0xc8c5('0x18')](_0xc8c5('0x47'),_0x536420[_0xc8c5('0x17')],_0x21e830);_0x55441f(_0x53dcdb[_0xc8c5('0x18')](0x1f4,_0x536420[_0xc8c5('0x17')]));});});};exports[_0xc8c5('0x48')]=function(_0x210a7c){var _0x398883=this;return new Promise(function(_0x476a96,_0x42c2fe){return db[_0xc8c5('0x32')][_0xc8c5('0x24')](function(_0x32cbb0){var _0x451985=_0x210a7c[_0xc8c5('0xb')]&&_0x210a7c[_0xc8c5('0xb')][_0xc8c5('0xc')]?_0x210a7c[_0xc8c5('0xb')]['where']:{};return db[_0xc8c5('0x8')][_0xc8c5('0x1e')](_0x210a7c['body'],{'where':_0x451985,'transaction':_0x32cbb0})['then'](function(_0x1ea2b3){logger[_0xc8c5('0x13')](_0xc8c5('0x48'),_0x210a7c);logger[_0xc8c5('0x14')](_0xc8c5('0x48'),_0x210a7c,JSON[_0xc8c5('0x15')](_0x1ea2b3));_0x476a96(_0x1ea2b3);})['catch'](function(_0x47aeff){logger['error']('ResetActiveCalls',_0x47aeff[_0xc8c5('0x17')],_0x210a7c);_0x42c2fe(_0x398883[_0xc8c5('0x18')](0x1f4,_0x47aeff['message']));});});});};exports[_0xc8c5('0x49')]=function(_0x158287){var _0x211b2c=this;var _0x166b43=_0x158287[_0xc8c5('0x1c')][_0xc8c5('0xc')][_0xc8c5('0x4a')];var _0x3342b7=_0x158287[_0xc8c5('0x1c')][_0xc8c5('0xc')][_0xc8c5('0x4b')];var _0x508aba=_0x158287['body']['where'][_0xc8c5('0x4c')];return new Promise(function(_0x3f113c,_0x11e92a){return db[_0xc8c5('0x8')]['findAll']({'where':{'voiceQueueId':{'$in':_0x166b43},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xc8c5('0x32')]['literal'](_0xc8c5('0x4d')+_0x3342b7+_0xc8c5('0x4e')),'$gt':db[_0xc8c5('0x32')][_0xc8c5('0x39')](_0xc8c5('0x4f'))}},'UserId':{'$in':_0x508aba}},'include':[{'model':db['CmContact'],'as':_0xc8c5('0x26')},{'model':db['User'],'as':'Agent','attributes':['id','name',_0xc8c5('0x2a')]},{'model':db[_0xc8c5('0x50')],'as':_0xc8c5('0x51')}]})[_0xc8c5('0x12')](function(_0x3f057d){if(_0x3f057d[_0xc8c5('0x2b')]>0x0){return db[_0xc8c5('0x32')]['transaction'](function(_0x26ddac){return db[_0xc8c5('0x8')]['update']({'recallmeNotifiedDate':db['sequelize'][_0xc8c5('0x39')](_0xc8c5('0x4f'))},{'where':{'id':{'$in':_[_0xc8c5('0x10')](_0x3f057d,'id')}},'transaction':_0x26ddac})[_0xc8c5('0x12')](function(){_0x3f113c(_0x3f057d);})[_0xc8c5('0x16')](function(_0x5c0cde){logger[_0xc8c5('0x18')](_0xc8c5('0x49'),_0x5c0cde[_0xc8c5('0x17')],_0x158287);_0x11e92a(_0x211b2c[_0xc8c5('0x18')](0x1f4,_0x5c0cde[_0xc8c5('0x17')]));});})['catch'](function(_0x816ec4){logger[_0xc8c5('0x18')](_0xc8c5('0x49'),_0x816ec4[_0xc8c5('0x17')],_0x158287);_0x11e92a(_0x211b2c[_0xc8c5('0x18')](0x1f4,_0x816ec4[_0xc8c5('0x17')]));});}else{_0x3f113c(_0x3f057d);}});});}; \ No newline at end of file +var _0x6f8b=['find','where','info','create','body','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','UPDATE','Contact','keys','Agent','voicePause','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','literal','NOW()','User','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','moment','bluebird','../../config/logger','GetCmHopper','CmHopper','findAll','options','raw','limit','map','include','model','attributes','then','debug','stringify','catch','message','error','ShowCmHopper'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0x6f8b,0x1b3));var _0xb6f8=function(_0x3bc4ac,_0x252d64){_0x3bc4ac=_0x3bc4ac-0x0;var _0x16bd94=_0x6f8b[_0x3bc4ac];return _0x16bd94;};'use strict';var _=require(_0xb6f8('0x0'));var util=require('util');var moment=require(_0xb6f8('0x1'));var BPromise=require(_0xb6f8('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xb6f8('0x3'))('rpc');exports[_0xb6f8('0x4')]=function(_0x4c26e7){var _0x309ad7=this;return new Promise(function(_0x427f0f,_0x436b40){return db[_0xb6f8('0x5')][_0xb6f8('0x6')]({'raw':_0x4c26e7['options']?_0x4c26e7[_0xb6f8('0x7')][_0xb6f8('0x8')]===undefined?!![]:![]:!![],'where':_0x4c26e7[_0xb6f8('0x7')]?_0x4c26e7[_0xb6f8('0x7')]['where']||null:null,'attributes':_0x4c26e7['options']?_0x4c26e7[_0xb6f8('0x7')]['attributes']||null:null,'limit':_0x4c26e7['options']?_0x4c26e7[_0xb6f8('0x7')][_0xb6f8('0x9')]||null:null,'include':_0x4c26e7[_0xb6f8('0x7')]?_0x4c26e7[_0xb6f8('0x7')]['include']?_[_0xb6f8('0xa')](_0x4c26e7['options'][_0xb6f8('0xb')],function(_0x3333bc){return{'model':db[_0x3333bc[_0xb6f8('0xc')]],'as':_0x3333bc['as'],'attributes':_0x3333bc['attributes'],'include':_0x3333bc[_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x3333bc[_0xb6f8('0xb')],function(_0x4e8bd3){return{'model':db[_0x4e8bd3[_0xb6f8('0xc')]],'as':_0x4e8bd3['as'],'attributes':_0x4e8bd3[_0xb6f8('0xd')],'include':_0x4e8bd3[_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x4e8bd3[_0xb6f8('0xb')],function(_0x102fd2){return{'model':db[_0x102fd2[_0xb6f8('0xc')]],'as':_0x102fd2['as'],'attributes':_0x102fd2['attributes']};}):[]};}):[]};}):[]:[]})[_0xb6f8('0xe')](function(_0x215c5a){logger['info'](_0xb6f8('0x4'),_0x4c26e7);logger[_0xb6f8('0xf')](_0xb6f8('0x4'),_0x4c26e7,JSON[_0xb6f8('0x10')](_0x215c5a));_0x427f0f(_0x215c5a);})[_0xb6f8('0x11')](function(_0xb3736d){logger['error'](_0xb6f8('0x4'),_0xb3736d[_0xb6f8('0x12')],_0x4c26e7);_0x436b40(_0x309ad7[_0xb6f8('0x13')](0x1f4,_0xb3736d[_0xb6f8('0x12')]));});});};exports[_0xb6f8('0x14')]=function(_0x355278){var _0x555ae6=this;return new Promise(function(_0x5a0fc4,_0x41b470){return db[_0xb6f8('0x5')][_0xb6f8('0x15')]({'raw':_0x355278['options']?_0x355278[_0xb6f8('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x355278['options']?_0x355278[_0xb6f8('0x7')][_0xb6f8('0x16')]||null:null,'attributes':_0x355278[_0xb6f8('0x7')]?_0x355278[_0xb6f8('0x7')][_0xb6f8('0xd')]||null:null,'include':_0x355278[_0xb6f8('0x7')]?_0x355278[_0xb6f8('0x7')][_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x355278[_0xb6f8('0x7')]['include'],function(_0x54af6a){return{'model':db[_0x54af6a[_0xb6f8('0xc')]],'as':_0x54af6a['as'],'attributes':_0x54af6a[_0xb6f8('0xd')],'include':_0x54af6a['include']?_[_0xb6f8('0xa')](_0x54af6a[_0xb6f8('0xb')],function(_0x319669){return{'model':db[_0x319669['model']],'as':_0x319669['as'],'attributes':_0x319669[_0xb6f8('0xd')],'include':_0x319669[_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x319669[_0xb6f8('0xb')],function(_0x149fcd){return{'model':db[_0x149fcd[_0xb6f8('0xc')]],'as':_0x149fcd['as'],'attributes':_0x149fcd[_0xb6f8('0xd')]};}):[]};}):[]};}):[]:[]})[_0xb6f8('0xe')](function(_0x19e144){logger[_0xb6f8('0x17')](_0xb6f8('0x14'),_0x355278);logger[_0xb6f8('0xf')]('ShowCmHopper',_0x355278,JSON[_0xb6f8('0x10')](_0x19e144));_0x5a0fc4(_0x19e144);})[_0xb6f8('0x11')](function(_0x238634){logger[_0xb6f8('0x13')](_0xb6f8('0x14'),_0x238634['message'],_0x355278);_0x41b470(_0x555ae6[_0xb6f8('0x13')](0x1f4,_0x238634['message']));});});};exports['CreateCmHopper']=function(_0x2b96d5){var _0x3b1816=this;return new Promise(function(_0x40982b,_0x969d98){return db[_0xb6f8('0x5')][_0xb6f8('0x18')](_0x2b96d5[_0xb6f8('0x19')],{'raw':_0x2b96d5[_0xb6f8('0x7')]?_0x2b96d5[_0xb6f8('0x7')]['raw']===undefined?!![]:![]:!![]})[_0xb6f8('0xe')](function(_0x44566d){logger['info'](_0xb6f8('0x1a'),_0x2b96d5);logger[_0xb6f8('0xf')](_0xb6f8('0x1a'),_0x2b96d5,JSON[_0xb6f8('0x10')](_0x44566d));_0x40982b(_0x44566d);})['catch'](function(_0x401f7c){logger[_0xb6f8('0x13')](_0xb6f8('0x1a'),_0x401f7c[_0xb6f8('0x12')],_0x2b96d5);_0x969d98(_0x3b1816[_0xb6f8('0x13')](0x1f4,_0x401f7c[_0xb6f8('0x12')]));});});};exports[_0xb6f8('0x1b')]=function(_0x47a332){var _0x52062c=this;return new Promise(function(_0x9db1da,_0x4ac7cc){return db[_0xb6f8('0x5')][_0xb6f8('0x1c')](_0x47a332[_0xb6f8('0x19')],{'raw':_0x47a332[_0xb6f8('0x7')]?_0x47a332['options'][_0xb6f8('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47a332[_0xb6f8('0x7')]?_0x47a332[_0xb6f8('0x7')]['where']||null:null,'attributes':_0x47a332[_0xb6f8('0x7')]?_0x47a332[_0xb6f8('0x7')]['attributes']||null:null,'limit':_0x47a332[_0xb6f8('0x7')]?_0x47a332[_0xb6f8('0x7')][_0xb6f8('0x9')]||null:null})[_0xb6f8('0xe')](function(_0x5aa62b){logger[_0xb6f8('0x17')](_0xb6f8('0x1b'),_0x47a332);logger[_0xb6f8('0x17')](_0xb6f8('0x1d'),JSON[_0xb6f8('0x10')](_0x47a332['options'][_0xb6f8('0x16')]),_0x47a332[_0xb6f8('0x19')][_0xb6f8('0x1e')]);logger['debug']('UpdateCmHopper',_0x47a332,JSON['stringify'](_0x5aa62b));_0x9db1da(_0x5aa62b);})[_0xb6f8('0x11')](function(_0x4b93cd){logger['error'](_0xb6f8('0x1b'),_0x4b93cd[_0xb6f8('0x12')],_0x47a332);_0x4ac7cc(_0x52062c[_0xb6f8('0x13')](0x1f4,_0x4b93cd[_0xb6f8('0x12')]));});});};exports[_0xb6f8('0x1f')]=function(_0x26cf20){var _0x31fcf4=this;return new Promise(function(_0x3ca4eb,_0x3b4c80){return db[_0xb6f8('0x5')][_0xb6f8('0x20')]({'where':_0x26cf20[_0xb6f8('0x7')]?_0x26cf20[_0xb6f8('0x7')][_0xb6f8('0x16')]||null:null})[_0xb6f8('0xe')](function(_0x17b9ff){logger[_0xb6f8('0x17')](_0xb6f8('0x1f'),_0x26cf20);logger[_0xb6f8('0xf')](_0xb6f8('0x1f'),_0x26cf20,JSON['stringify'](_0x17b9ff));_0x3ca4eb(_0x17b9ff);})[_0xb6f8('0x11')](function(_0xd886f2){logger[_0xb6f8('0x13')](_0xb6f8('0x1f'),_0xd886f2[_0xb6f8('0x12')],_0x26cf20);_0x3b4c80(_0x31fcf4[_0xb6f8('0x13')](0x1f4,_0xd886f2[_0xb6f8('0x12')]));});});};exports[_0xb6f8('0x21')]=function(_0x528b76){var _0x4088fd=this;return new Promise(function(_0x5552fd,_0x1a3bde){return db[_0xb6f8('0x22')][_0xb6f8('0x23')]()[_0xb6f8('0xe')](function(_0x4d959c){return db[_0xb6f8('0x24')][_0xb6f8('0x25')](function(_0x160f04){return db['CmHopper'][_0xb6f8('0x6')]({'where':_0x528b76[_0xb6f8('0x7')]?_0x528b76[_0xb6f8('0x7')][_0xb6f8('0x16')]||null:null,'attributes':_0x528b76['options']?_0x528b76[_0xb6f8('0x7')][_0xb6f8('0xd')]||null:null,'limit':_0x528b76[_0xb6f8('0x7')]?_0x528b76[_0xb6f8('0x7')][_0xb6f8('0x9')]||null:null,'order':_0x528b76[_0xb6f8('0x7')]?_0x528b76[_0xb6f8('0x7')]['order']||null:null,'transaction':_0x160f04,'lock':_0x160f04['LOCK'][_0xb6f8('0x26')],'include':[{'model':db[_0xb6f8('0x22')],'as':_0xb6f8('0x27'),'attributes':_[_0xb6f8('0x28')](_0x4d959c)},{'model':db['User'],'as':_0xb6f8('0x29'),'attributes':['id','name',_0xb6f8('0x2a')]}]})[_0xb6f8('0xe')](function(_0x5c96d7){var _0x1e3a3d=[];var _0x32e660=[];for(var _0x1e22f6=0x0;_0x1e22f6<_0x5c96d7[_0xb6f8('0x2b')];_0x1e22f6+=0x1){var _0x240195=_0x5c96d7[_0x1e22f6][_0xb6f8('0x2c')];if(_0x240195===null){_0x1e3a3d[_0xb6f8('0x2d')](_0x5c96d7[_0x1e22f6][_0xb6f8('0x1c')](_0x528b76[_0xb6f8('0x19')],{'transaction':_0x160f04}));}else if(!_0x32e660['includes'](_0x240195)){_0x32e660[_0xb6f8('0x2d')](_0x240195);_0x1e3a3d['push'](_0x5c96d7[_0x1e22f6]['update'](_0x528b76[_0xb6f8('0x19')],{'transaction':_0x160f04}));}}return BPromise[_0xb6f8('0x2e')](_0x1e3a3d);});})[_0xb6f8('0xe')](function(_0x1c07ce){logger['info']('GetContactDialer',_0x528b76);if(_0x1c07ce[_0xb6f8('0x2b')]>0x0){logger[_0xb6f8('0x17')](_0xb6f8('0x2f'),_0x1c07ce[0x0][_0xb6f8('0x30')]['id'],_0x1c07ce[0x0][_0xb6f8('0x30')][_0xb6f8('0x31')],_0x1c07ce[0x0]['dataValues'][_0xb6f8('0x1e')]);}logger['debug'](_0xb6f8('0x21'),_0x528b76,JSON[_0xb6f8('0x10')](_0x1c07ce));_0x5552fd(_0x1c07ce);})[_0xb6f8('0x11')](function(_0x1d51ca){logger[_0xb6f8('0x13')]('GetContactDialer',_0x1d51ca['message'],_0x528b76);_0x1a3bde(_0x4088fd[_0xb6f8('0x13')](0x1f4,_0x1d51ca[_0xb6f8('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x3dde1c){var _0x261721=this;return new Promise(function(_0x2f71db,_0x1a1623){return db[_0xb6f8('0x24')]['transaction'](function(_0xdcf13d){return db[_0xb6f8('0x32')][_0xb6f8('0x18')](_0x3dde1c[_0xb6f8('0x19')],{'raw':_0x3dde1c[_0xb6f8('0x7')]?_0x3dde1c['options'][_0xb6f8('0x8')]===undefined?!![]:![]:!![],'transaction':_0xdcf13d})[_0xb6f8('0xe')](function(){logger['info'](_0xb6f8('0x33'),JSON[_0xb6f8('0x10')](_0x3dde1c['options'][_0xb6f8('0x16')]),_0x3dde1c[_0xb6f8('0x7')][_0xb6f8('0x16')][_0xb6f8('0x1e')]);return db[_0xb6f8('0x5')]['destroy']({'where':_0x3dde1c[_0xb6f8('0x7')]?_0x3dde1c[_0xb6f8('0x7')][_0xb6f8('0x16')]||null:null,'transaction':_0xdcf13d});});})[_0xb6f8('0xe')](function(_0x18c10b){logger[_0xb6f8('0x17')]('MoveContactManagedDialer',_0x3dde1c);logger[_0xb6f8('0xf')]('MoveContactManagedDialer',_0x3dde1c,JSON['stringify'](_0x18c10b));_0x2f71db(_0x18c10b);})[_0xb6f8('0x11')](function(_0x39dc2b){logger['error']('MoveContactManagedDialer',_0x39dc2b[_0xb6f8('0x12')],_0x3dde1c);_0x1a1623(_0x261721['error'](0x1f4,_0x39dc2b[_0xb6f8('0x12')]));});});};exports[_0xb6f8('0x34')]=function(_0x46e921){var _0x2d4768=this;return new Promise(function(_0x1a33aa,_0x45ca38){return db[_0xb6f8('0x5')][_0xb6f8('0x6')]({'raw':_0x46e921[_0xb6f8('0x7')]?_0x46e921[_0xb6f8('0x7')][_0xb6f8('0x8')]===undefined?!![]:![]:!![],'where':_0x46e921[_0xb6f8('0x7')]?_0x46e921['options'][_0xb6f8('0x16')]||null:null,'attributes':[[db[_0xb6f8('0x24')]['fn']('COUNT',db[_0xb6f8('0x24')]['fn']('IF',db['sequelize']['literal'](_0xb6f8('0x35')+util[_0xb6f8('0x36')](_0xb6f8('0x37'),moment()['format'](_0xb6f8('0x38')))+_0xb6f8('0x39')))),_0xb6f8('0x3a')]]})[_0xb6f8('0xe')](function(_0x188aed){logger[_0xb6f8('0x17')](_0xb6f8('0x34'),_0x46e921);logger[_0xb6f8('0xf')](_0xb6f8('0x34'),_0x46e921,JSON[_0xb6f8('0x10')](_0x188aed));_0x1a33aa(_0x188aed);})[_0xb6f8('0x11')](function(_0x4058ff){logger['error'](_0xb6f8('0x34'),_0x4058ff[_0xb6f8('0x12')],_0x46e921);_0x45ca38(_0x2d4768['error'](0x1f4,_0x4058ff[_0xb6f8('0x12')]));});});};exports[_0xb6f8('0x3b')]=function(_0x54f7c3){var _0x1d1282=this;return new Promise(function(_0x38c34d,_0x3aa667){return db[_0xb6f8('0x22')]['describe']()[_0xb6f8('0xe')](function(){return db[_0xb6f8('0x24')][_0xb6f8('0x25')](function(_0x1eff36){return db['CmHopper'][_0xb6f8('0x6')]({'where':_0x54f7c3['options']?_0x54f7c3[_0xb6f8('0x7')][_0xb6f8('0x16')]||null:null,'attributes':_0x54f7c3[_0xb6f8('0x7')]?_0x54f7c3['options'][_0xb6f8('0xd')]||null:null,'limit':0x1,'order':_0x54f7c3[_0xb6f8('0x7')]?_0x54f7c3['options']['order']||null:null,'group':db[_0xb6f8('0x5')][_0xb6f8('0x2c')],'transaction':_0x1eff36,'lock':_0x1eff36['LOCK'][_0xb6f8('0x26')],'include':_0x54f7c3[_0xb6f8('0x7')]?_0x54f7c3[_0xb6f8('0x7')][_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x54f7c3['options']['include'],function(_0x486b0b){return{'model':db[_0x486b0b[_0xb6f8('0xc')]],'as':_0x486b0b['as'],'attributes':_0x486b0b[_0xb6f8('0xd')],'include':_0x486b0b[_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x486b0b[_0xb6f8('0xb')],function(_0x33fa77){return{'model':db[_0x33fa77[_0xb6f8('0xc')]],'as':_0x33fa77['as'],'attributes':_0x33fa77[_0xb6f8('0xd')],'include':_0x33fa77[_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x33fa77['include'],function(_0x2d8a0c){return{'model':db[_0x2d8a0c['model']],'as':_0x2d8a0c['as'],'attributes':_0x2d8a0c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2aa26e){var _0xd5af88=[];for(var _0x5ef3b5=0x0;_0x5ef3b5<_0x2aa26e['length'];_0x5ef3b5+=0x1){_0xd5af88[_0xb6f8('0x2d')](_0x2aa26e[_0x5ef3b5][_0xb6f8('0x1c')](_0x54f7c3['body'],{'transaction':_0x1eff36}));}return BPromise[_0xb6f8('0x2e')](_0xd5af88);});})[_0xb6f8('0xe')](function(_0x101675){logger[_0xb6f8('0x17')](_0xb6f8('0x3b'),_0x54f7c3);logger[_0xb6f8('0xf')](_0xb6f8('0x3b'),_0x54f7c3,JSON[_0xb6f8('0x10')](_0x101675));_0x38c34d(_0x101675);})[_0xb6f8('0x11')](function(_0x2d626d){logger[_0xb6f8('0x13')](_0xb6f8('0x3b'),_0x2d626d['message'],_0x54f7c3);_0x3aa667(_0x1d1282[_0xb6f8('0x13')](0x1f4,_0x2d626d[_0xb6f8('0x12')]));});});});};exports['GetCmHopperPreview']=function(_0x3e8031){var _0x23a6a6=this;return new Promise(function(_0x2fb220,_0x33c3b3){db['CmContact'][_0xb6f8('0x23')]()[_0xb6f8('0xe')](function(_0x12ad15){return db[_0xb6f8('0x5')][_0xb6f8('0x6')]({'raw':_0x3e8031[_0xb6f8('0x7')]?_0x3e8031[_0xb6f8('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x3e8031['options']?_0x3e8031[_0xb6f8('0x7')]['where']||null:null,'attributes':_0x3e8031[_0xb6f8('0x7')]?_0x3e8031[_0xb6f8('0x7')][_0xb6f8('0xd')]||null:null,'limit':_0x3e8031[_0xb6f8('0x7')]?_0x3e8031[_0xb6f8('0x7')][_0xb6f8('0x9')]||null:null,'include':_0x3e8031[_0xb6f8('0x7')]?_0x3e8031['options']['include']?_[_0xb6f8('0xa')](_0x3e8031['options'][_0xb6f8('0xb')],function(_0x22e254){return{'model':db[_0x22e254[_0xb6f8('0xc')]],'as':_0x22e254['as'],'attributes':_0x22e254['as']===_0xb6f8('0x27')?_[_0xb6f8('0x28')](_0x12ad15):_0x22e254[_0xb6f8('0xd')],'include':_0x22e254[_0xb6f8('0xb')]?_[_0xb6f8('0xa')](_0x22e254[_0xb6f8('0xb')],function(_0x275d39){return{'model':db[_0x275d39[_0xb6f8('0xc')]],'as':_0x275d39['as'],'attributes':_0x275d39[_0xb6f8('0xd')],'include':_0x275d39['include']?_['map'](_0x275d39['include'],function(_0x46b478){return{'model':db[_0x46b478[_0xb6f8('0xc')]],'as':_0x46b478['as'],'attributes':_0x46b478[_0xb6f8('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51262c){logger['info'](_0xb6f8('0x4'),_0x3e8031);logger[_0xb6f8('0xf')](_0xb6f8('0x4'),_0x3e8031,JSON[_0xb6f8('0x10')](_0x51262c));_0x2fb220(_0x51262c);})[_0xb6f8('0x11')](function(_0x459211){logger[_0xb6f8('0x13')]('GetCmHopper',_0x459211[_0xb6f8('0x12')],_0x3e8031);_0x33c3b3(_0x23a6a6[_0xb6f8('0x13')](0x1f4,_0x459211[_0xb6f8('0x12')]));});});});};exports[_0xb6f8('0x3c')]=function(_0x26be51){var _0x570c47=this;return new Promise(function(_0x559e2b,_0x3eaf12){return db['CmContact'][_0xb6f8('0x3d')]({'raw':!![],'where':{'phone':_0x26be51[_0xb6f8('0x7')]['where']['phone']},'attributes':['id',_0xb6f8('0x3e')],'order':[['id',_0xb6f8('0x3f')]]})['then'](function(_0x3f50cd){logger['info'](_0xb6f8('0x40'),_0x26be51);logger[_0xb6f8('0xf')](_0xb6f8('0x40'),_0x26be51,JSON[_0xb6f8('0x10')](_0x3f50cd));_0x559e2b(_0x3f50cd);})[_0xb6f8('0x11')](function(_0x474755){logger[_0xb6f8('0x13')](_0xb6f8('0x40'),_0x474755[_0xb6f8('0x12')],_0x26be51);_0x3eaf12(_0x570c47[_0xb6f8('0x13')](0x1f4,_0x474755[_0xb6f8('0x12')]));});});};exports['ResetActiveCalls']=function(_0x279e46){var _0x8a1297=this;return new Promise(function(_0x1e3098,_0x31155b){return db[_0xb6f8('0x24')][_0xb6f8('0x25')](function(_0x144319){var _0x4c246a=_0x279e46['options']&&_0x279e46[_0xb6f8('0x7')][_0xb6f8('0x16')]?_0x279e46[_0xb6f8('0x7')][_0xb6f8('0x16')]:{};return db[_0xb6f8('0x5')][_0xb6f8('0x1c')](_0x279e46[_0xb6f8('0x19')],{'where':_0x4c246a,'transaction':_0x144319})['then'](function(_0x2739c6){logger[_0xb6f8('0x17')](_0xb6f8('0x41'),_0x279e46);logger['debug'](_0xb6f8('0x41'),_0x279e46,JSON[_0xb6f8('0x10')](_0x2739c6));_0x1e3098(_0x2739c6);})['catch'](function(_0x3f6e96){logger[_0xb6f8('0x13')](_0xb6f8('0x41'),_0x3f6e96['message'],_0x279e46);_0x31155b(_0x8a1297[_0xb6f8('0x13')](0x1f4,_0x3f6e96[_0xb6f8('0x12')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x1c69a3){var _0x5a5f35=this;var _0x4e55df=_0x1c69a3[_0xb6f8('0x19')][_0xb6f8('0x16')][_0xb6f8('0x42')];var _0x420ef4=_0x1c69a3[_0xb6f8('0x19')][_0xb6f8('0x16')][_0xb6f8('0x43')];var _0x444005=_0x1c69a3[_0xb6f8('0x19')]['where'][_0xb6f8('0x44')];return new Promise(function(_0x593e80,_0x23caa0){return db[_0xb6f8('0x5')][_0xb6f8('0x6')]({'where':{'voiceQueueId':{'$in':_0x4e55df},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x420ef4+_0xb6f8('0x45')),'$gt':db['sequelize'][_0xb6f8('0x46')](_0xb6f8('0x47'))}},'UserId':{'$in':_0x444005}},'include':[{'model':db[_0xb6f8('0x22')],'as':_0xb6f8('0x27')},{'model':db[_0xb6f8('0x48')],'as':'Agent','attributes':['id','name','voicePause']},{'model':db[_0xb6f8('0x49')],'as':_0xb6f8('0x4a')}]})[_0xb6f8('0xe')](function(_0x45b481){if(_0x45b481[_0xb6f8('0x2b')]>0x0){return db[_0xb6f8('0x24')][_0xb6f8('0x25')](function(_0x57609d){return db[_0xb6f8('0x5')][_0xb6f8('0x1c')]({'recallmeNotifiedDate':db[_0xb6f8('0x24')][_0xb6f8('0x46')]('NOW()')},{'where':{'id':{'$in':_['map'](_0x45b481,'id')}},'transaction':_0x57609d})['then'](function(){_0x593e80(_0x45b481);})[_0xb6f8('0x11')](function(_0x4766a1){logger['error'](_0xb6f8('0x4b'),_0x4766a1['message'],_0x1c69a3);_0x23caa0(_0x5a5f35['error'](0x1f4,_0x4766a1['message']));});})[_0xb6f8('0x11')](function(_0x447a14){logger[_0xb6f8('0x13')](_0xb6f8('0x4b'),_0x447a14['message'],_0x1c69a3);_0x23caa0(_0x5a5f35[_0xb6f8('0x13')](0x1f4,_0x447a14[_0xb6f8('0x12')]));});}else{_0x593e80(_0x45b481);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 5689a18..16af9f9 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 _0xfb83=['show','/:id/previewrecall','post','create','/preview','getPreview','update','delete','destroy','exports','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','/describe','getOpenContacts','/:id'];(function(_0x94cd9e,_0x2b50f2){var _0x1bf136=function(_0xf97f0){while(--_0xf97f0){_0x94cd9e['push'](_0x94cd9e['shift']());}};_0x1bf136(++_0x2b50f2);}(_0xfb83,0xbe));var _0x3fb8=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0xfb83[_0x16337a];return _0x422365;};'use strict';var express=require('express');var router=express[_0x3fb8('0x0')]();var auth=require(_0x3fb8('0x1'));var controller=require(_0x3fb8('0x2'));router[_0x3fb8('0x3')]('/',auth[_0x3fb8('0x4')](),controller['index']);router['get'](_0x3fb8('0x5'),auth[_0x3fb8('0x4')](),controller['describe']);router['get']('/opencontacts',auth[_0x3fb8('0x4')](),controller[_0x3fb8('0x6')]);router['get']('/timezones',auth['isAuthenticated'](),controller['getTimezones']);router['get'](_0x3fb8('0x7'),auth[_0x3fb8('0x4')](),controller[_0x3fb8('0x8')]);router[_0x3fb8('0x3')](_0x3fb8('0x9'),auth[_0x3fb8('0x4')](),controller['getPreviewRecall']);router[_0x3fb8('0xa')]('/',auth['isAuthenticated'](),controller[_0x3fb8('0xb')]);router[_0x3fb8('0xa')](_0x3fb8('0xc'),auth['isAuthenticated'](),controller[_0x3fb8('0xd')]);router['post']('/timezone',auth['isAuthenticated'](),controller['getTimezone']);router['put'](_0x3fb8('0x7'),auth[_0x3fb8('0x4')](),controller[_0x3fb8('0xe')]);router[_0x3fb8('0xf')](_0x3fb8('0x7'),auth['isAuthenticated'](),controller[_0x3fb8('0x10')]);module[_0x3fb8('0x11')]=router; \ No newline at end of file +var _0xf3fe=['destroy','exports','express','Router','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put','delete'];(function(_0x217cc8,_0x54a7e0){var _0x27be63=function(_0x25a773){while(--_0x25a773){_0x217cc8['push'](_0x217cc8['shift']());}};_0x27be63(++_0x54a7e0);}(_0xf3fe,0x160));var _0xef3f=function(_0x866ecf,_0x484490){_0x866ecf=_0x866ecf-0x0;var _0x359a7b=_0xf3fe[_0x866ecf];return _0x359a7b;};'use strict';var express=require(_0xef3f('0x0'));var router=express[_0xef3f('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xef3f('0x2'));router[_0xef3f('0x3')]('/',auth[_0xef3f('0x4')](),controller[_0xef3f('0x5')]);router[_0xef3f('0x3')](_0xef3f('0x6'),auth[_0xef3f('0x4')](),controller['describe']);router[_0xef3f('0x3')](_0xef3f('0x7'),auth['isAuthenticated'](),controller[_0xef3f('0x8')]);router[_0xef3f('0x3')](_0xef3f('0x9'),auth[_0xef3f('0x4')](),controller[_0xef3f('0xa')]);router[_0xef3f('0x3')](_0xef3f('0xb'),auth[_0xef3f('0x4')](),controller[_0xef3f('0xc')]);router[_0xef3f('0x3')](_0xef3f('0xd'),auth[_0xef3f('0x4')](),controller[_0xef3f('0xe')]);router[_0xef3f('0xf')]('/',auth[_0xef3f('0x4')](),controller[_0xef3f('0x10')]);router['post'](_0xef3f('0x11'),auth['isAuthenticated'](),controller[_0xef3f('0x12')]);router['post'](_0xef3f('0x13'),auth[_0xef3f('0x4')](),controller[_0xef3f('0x14')]);router[_0xef3f('0x15')](_0xef3f('0xb'),auth[_0xef3f('0x4')](),controller['update']);router[_0xef3f('0x16')]('/:id',auth[_0xef3f('0x4')](),controller[_0xef3f('0x17')]);module[_0xef3f('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index bdf52ac..a9e8944 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 _0xdeac=['exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdeac,0xf4));var _0xcdea=function(_0x1f7ea0,_0x158c29){_0x1f7ea0=_0x1f7ea0-0x0;var _0x1885e3=_0xdeac[_0x1f7ea0];return _0x1885e3;};'use strict';var moment=require(_0xcdea('0x0'));var Sequelize=require('sequelize');module[_0xcdea('0x1')]={'CmHopperId':{'type':Sequelize[_0xcdea('0x2')]},'phone':{'type':Sequelize[_0xcdea('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xcdea('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xcdea('0x4')],'defaultValue':moment()[_0xcdea('0x5')](_0xcdea('0x6'))},'countbusyretry':{'type':Sequelize[_0xcdea('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcdea('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcdea('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xcdea('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcdea('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcdea('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcdea('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcdea('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x706b=['sequelize','exports','INTEGER','STRING','DATE','format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x706b,0x14a));var _0xb706=function(_0x45e9be,_0x7c164e){_0x45e9be=_0x45e9be-0x0;var _0x52e243=_0x706b[_0x45e9be];return _0x52e243;};'use strict';var moment=require('moment');var Sequelize=require(_0xb706('0x0'));module[_0xb706('0x1')]={'CmHopperId':{'type':Sequelize[_0xb706('0x2')]},'phone':{'type':Sequelize[_0xb706('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xb706('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xb706('0x4')],'defaultValue':moment()[_0xb706('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xb706('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb706('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xb706('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb706('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb706('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb706('0x2')],'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 fb715fe..2eb3781 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 _0xcd2a=['mustache','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','stack','name','index','CmHopperAdditionalPhone','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','findAll','rows','catch','show','params','includeAll','include','create','body','user','role','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','bluebird'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0xcd2a,0x134));var _0xacd2=function(_0x1fb038,_0xc3f69b){_0x1fb038=_0x1fb038-0x0;var _0x1600dc=_0xcd2a[_0x1fb038];return _0x1600dc;};'use strict';var emlformat=require(_0xacd2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xacd2('0x1'));var rp=require(_0xacd2('0x2'));var moment=require('moment');var BPromise=require(_0xacd2('0x3'));var Mustache=require(_0xacd2('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xacd2('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xacd2('0x6'));var crypto=require('crypto');var jsforce=require(_0xacd2('0x7'));var deskjs=require(_0xacd2('0x8'));var toCsv=require(_0xacd2('0x9'));var querystring=require(_0xacd2('0xa'));var Papa=require(_0xacd2('0xb'));var Redis=require(_0xacd2('0xc'));var authService=require(_0xacd2('0xd'));var qs=require(_0xacd2('0xe'));var as=require(_0xacd2('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacd2('0x10'))('api');var utils=require(_0xacd2('0x11'));var config=require(_0xacd2('0x12'));var licenseUtil=require(_0xacd2('0x13'));var db=require(_0xacd2('0x14'))['db'];function respondWithStatusCode(_0x379355,_0x33eaef){_0x33eaef=_0x33eaef||0xcc;return function(_0x21e09e){if(_0x21e09e){return _0x379355[_0xacd2('0x15')](_0x33eaef);}return _0x379355[_0xacd2('0x16')](_0x33eaef)[_0xacd2('0x17')]();};}function respondWithResult(_0x1e2780,_0x555502){_0x555502=_0x555502||0xc8;return function(_0x1e408a){if(_0x1e408a){return _0x1e2780[_0xacd2('0x16')](_0x555502)[_0xacd2('0x18')](_0x1e408a);}};}function respondWithFilteredResult(_0x54685d,_0x4c3fcd){return function(_0x554f9e){if(_0x554f9e){var _0x18005f=typeof _0x4c3fcd[_0xacd2('0x19')]===_0xacd2('0x1a')&&typeof _0x4c3fcd['limit']==='undefined';var _0x43516e=_0x554f9e[_0xacd2('0x1b')];var _0x1e80e5=_0x18005f?0x0:_0x4c3fcd[_0xacd2('0x19')];var _0x23ec88=_0x18005f?_0x554f9e[_0xacd2('0x1b')]:_0x4c3fcd[_0xacd2('0x19')]+_0x4c3fcd[_0xacd2('0x1c')];var _0x575261;if(_0x23ec88>=_0x43516e){_0x23ec88=_0x43516e;_0x575261=0xc8;}else{_0x575261=0xce;}_0x54685d[_0xacd2('0x16')](_0x575261);return _0x54685d[_0xacd2('0x1d')](_0xacd2('0x1e'),_0x1e80e5+'-'+_0x23ec88+'/'+_0x43516e)[_0xacd2('0x18')](_0x554f9e);}return null;};}function patchUpdates(_0x11b3c1){return function(_0x260307){try{jsonpatch[_0xacd2('0x1f')](_0x260307,_0x11b3c1,!![]);}catch(_0x3de8e5){return BPromise[_0xacd2('0x20')](_0x3de8e5);}return _0x260307[_0xacd2('0x21')]();};}function saveUpdates(_0x2dedd4,_0x731f0){return function(_0x2a2cb3){if(_0x2a2cb3){return _0x2a2cb3[_0xacd2('0x22')](_0x2dedd4)[_0xacd2('0x23')](function(_0x1dc93d){return _0x1dc93d;});}return null;};}function removeEntity(_0x5cc7e9,_0x34dd20){return function(_0x1e6b88){if(_0x1e6b88){return _0x1e6b88[_0xacd2('0x24')]()[_0xacd2('0x23')](function(){var _0xfd13e4=_0x1e6b88[_0xacd2('0x25')]({'plain':!![]});var _0x495b85=_0xacd2('0x26');return db[_0xacd2('0x27')][_0xacd2('0x24')]({'where':{'type':_0x495b85,'resourceId':_0xfd13e4['id']}})[_0xacd2('0x23')](function(){return _0x1e6b88;});})[_0xacd2('0x23')](function(){_0x5cc7e9[_0xacd2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x107b71,_0x2b8657){return function(_0x4c01e1){if(!_0x4c01e1){_0x107b71[_0xacd2('0x15')](0x194);}return _0x4c01e1;};}function handleError(_0x15492b,_0x37022d){_0x37022d=_0x37022d||0x1f4;return function(_0x41c2c1){logger['error'](_0x41c2c1[_0xacd2('0x28')]);if(_0x41c2c1[_0xacd2('0x29')]){delete _0x41c2c1[_0xacd2('0x29')];}_0x15492b[_0xacd2('0x16')](_0x37022d)['send'](_0x41c2c1);};}exports[_0xacd2('0x2a')]=function(_0x2c7bd6,_0xf729d9){var _0x16e476={},_0x59546d={},_0x279ac8={'count':0x0,'rows':[]};var _0x539916=_['map'](db[_0xacd2('0x2b')][_0xacd2('0x2c')],function(_0x3cd8b0){return{'name':_0x3cd8b0['fieldName'],'type':_0x3cd8b0[_0xacd2('0x2d')][_0xacd2('0x2e')]};});_0x59546d[_0xacd2('0x2f')]=_[_0xacd2('0x30')](_0x539916,_0xacd2('0x29'));_0x59546d[_0xacd2('0x31')]=_[_0xacd2('0x32')](_0x2c7bd6['query']);_0x59546d['filters']=_[_0xacd2('0x33')](_0x59546d['model'],_0x59546d[_0xacd2('0x31')]);_0x16e476[_0xacd2('0x34')]=_[_0xacd2('0x33')](_0x59546d[_0xacd2('0x2f')],qs[_0xacd2('0x35')](_0x2c7bd6[_0xacd2('0x31')][_0xacd2('0x35')]));_0x16e476[_0xacd2('0x34')]=_0x16e476[_0xacd2('0x34')][_0xacd2('0x36')]?_0x16e476[_0xacd2('0x34')]:_0x59546d[_0xacd2('0x2f')];if(!_0x2c7bd6[_0xacd2('0x31')][_0xacd2('0x37')](_0xacd2('0x38'))){_0x16e476[_0xacd2('0x1c')]=qs['limit'](_0x2c7bd6[_0xacd2('0x31')][_0xacd2('0x1c')]);_0x16e476[_0xacd2('0x19')]=qs[_0xacd2('0x19')](_0x2c7bd6[_0xacd2('0x31')][_0xacd2('0x19')]);}_0x16e476['order']=qs[_0xacd2('0x39')](_0x2c7bd6[_0xacd2('0x31')][_0xacd2('0x39')]);_0x16e476[_0xacd2('0x3a')]=qs[_0xacd2('0x3b')](_[_0xacd2('0x3c')](_0x2c7bd6[_0xacd2('0x31')],_0x59546d[_0xacd2('0x3b')]),_0x539916);if(_0x2c7bd6[_0xacd2('0x31')][_0xacd2('0x3d')]){_0x16e476[_0xacd2('0x3a')]=_[_0xacd2('0x3e')](_0x16e476[_0xacd2('0x3a')],{'$or':_['map'](_0x539916,function(_0x30f7a3){if(_0x30f7a3[_0xacd2('0x2d')]!=='VIRTUAL'){var _0xad501b={};_0xad501b[_0x30f7a3[_0xacd2('0x29')]]={'$like':'%'+_0x2c7bd6['query'][_0xacd2('0x3d')]+'%'};return _0xad501b;}})});}_0x16e476=_[_0xacd2('0x3e')]({},_0x16e476,_0x2c7bd6['options']);var _0xb23751={'where':_0x16e476[_0xacd2('0x3a')]};return db['CmHopperAdditionalPhone']['count'](_0xb23751)['then'](function(_0x5015b6){_0x279ac8['count']=_0x5015b6;if(_0x2c7bd6[_0xacd2('0x31')]['includeAll']){_0x16e476['include']=[{'all':!![]}];}return db[_0xacd2('0x2b')][_0xacd2('0x3f')](_0x16e476);})[_0xacd2('0x23')](function(_0x401ba0){_0x279ac8[_0xacd2('0x40')]=_0x401ba0;return _0x279ac8;})['then'](respondWithFilteredResult(_0xf729d9,_0x16e476))[_0xacd2('0x41')](handleError(_0xf729d9,null));};exports[_0xacd2('0x42')]=function(_0x588be1,_0x10db47){var _0x57ca94={'raw':!![],'where':{'id':_0x588be1[_0xacd2('0x43')]['id']}},_0x5d4d2a={};_0x5d4d2a[_0xacd2('0x2f')]=_[_0xacd2('0x32')](db[_0xacd2('0x2b')][_0xacd2('0x2c')]);_0x5d4d2a[_0xacd2('0x31')]=_[_0xacd2('0x32')](_0x588be1[_0xacd2('0x31')]);_0x5d4d2a['filters']=_[_0xacd2('0x33')](_0x5d4d2a['model'],_0x5d4d2a[_0xacd2('0x31')]);_0x57ca94[_0xacd2('0x34')]=_[_0xacd2('0x33')](_0x5d4d2a[_0xacd2('0x2f')],qs[_0xacd2('0x35')](_0x588be1['query'][_0xacd2('0x35')]));_0x57ca94[_0xacd2('0x34')]=_0x57ca94['attributes']['length']?_0x57ca94['attributes']:_0x5d4d2a[_0xacd2('0x2f')];if(_0x588be1[_0xacd2('0x31')][_0xacd2('0x44')]){_0x57ca94[_0xacd2('0x45')]=[{'all':!![]}];}_0x57ca94=_[_0xacd2('0x3e')]({},_0x57ca94,_0x588be1['options']);return db[_0xacd2('0x2b')]['find'](_0x57ca94)[_0xacd2('0x23')](handleEntityNotFound(_0x10db47,null))[_0xacd2('0x23')](respondWithResult(_0x10db47,null))[_0xacd2('0x41')](handleError(_0x10db47,null));};exports[_0xacd2('0x46')]=function(_0x442d2b,_0x26feed){return db[_0xacd2('0x2b')][_0xacd2('0x46')](_0x442d2b[_0xacd2('0x47')],{})[_0xacd2('0x23')](function(_0x2f72fa){var _0x25ff7e=_0x442d2b[_0xacd2('0x48')][_0xacd2('0x25')]({'plain':!![]});if(!_0x25ff7e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25ff7e[_0xacd2('0x49')]==='user'){var _0x1672a5=_0x2f72fa[_0xacd2('0x25')]({'plain':!![]});var _0x2b2fdd=_0xacd2('0x26');return db[_0xacd2('0x4a')][_0xacd2('0x4b')]({'where':{'name':_0x2b2fdd,'userProfileId':_0x25ff7e['userProfileId']},'raw':!![]})[_0xacd2('0x23')](function(_0xc18e6c){if(_0xc18e6c&&_0xc18e6c['autoAssociation']===0x0){return db[_0xacd2('0x27')][_0xacd2('0x46')]({'name':_0x1672a5[_0xacd2('0x29')],'resourceId':_0x1672a5['id'],'type':_0xc18e6c[_0xacd2('0x29')],'sectionId':_0xc18e6c['id']},{})[_0xacd2('0x23')](function(){return _0x2f72fa;});}else{return _0x2f72fa;}})[_0xacd2('0x41')](function(_0x989a48){logger[_0xacd2('0x4c')](_0xacd2('0x4d'),_0x989a48);throw _0x989a48;});}return _0x2f72fa;})[_0xacd2('0x23')](respondWithResult(_0x26feed,0xc9))[_0xacd2('0x41')](handleError(_0x26feed,null));};exports[_0xacd2('0x22')]=function(_0x39b1a9,_0x465c1b){if(_0x39b1a9[_0xacd2('0x47')]['id']){delete _0x39b1a9[_0xacd2('0x47')]['id'];}return db['CmHopperAdditionalPhone'][_0xacd2('0x4b')]({'where':{'id':_0x39b1a9[_0xacd2('0x43')]['id']}})[_0xacd2('0x23')](handleEntityNotFound(_0x465c1b,null))[_0xacd2('0x23')](saveUpdates(_0x39b1a9[_0xacd2('0x47')],null))[_0xacd2('0x23')](respondWithResult(_0x465c1b,null))['catch'](handleError(_0x465c1b,null));};exports['destroy']=function(_0x49cc37,_0x3dceee){return db[_0xacd2('0x2b')][_0xacd2('0x4b')]({'where':{'id':_0x49cc37[_0xacd2('0x43')]['id']}})[_0xacd2('0x23')](handleEntityNotFound(_0x3dceee,null))[_0xacd2('0x23')](removeEntity(_0x3dceee,null))[_0xacd2('0x41')](handleError(_0x3dceee,null));}; \ No newline at end of file +var _0x00ea=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','CmHopperAdditionalPhones','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','include','show','params','includeAll','create','body','user','get'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x00ea,0x1d0));var _0xa00e=function(_0x4334ec,_0x15d4b1){_0x4334ec=_0x4334ec-0x0;var _0x16945d=_0x00ea[_0x4334ec];return _0x16945d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa00e('0x0'));var jsonpatch=require(_0xa00e('0x1'));var rp=require(_0xa00e('0x2'));var moment=require(_0xa00e('0x3'));var BPromise=require(_0xa00e('0x4'));var Mustache=require(_0xa00e('0x5'));var util=require(_0xa00e('0x6'));var path=require(_0xa00e('0x7'));var sox=require('sox');var csv=require(_0xa00e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa00e('0x9'));var crypto=require(_0xa00e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa00e('0xb'));var toCsv=require(_0xa00e('0x8'));var querystring=require(_0xa00e('0xc'));var Papa=require(_0xa00e('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa00e('0xe'));var hardwareService=require(_0xa00e('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xa00e('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xa00e('0x11'));var db=require(_0xa00e('0x12'))['db'];function respondWithStatusCode(_0x1b90c2,_0x5e37db){_0x5e37db=_0x5e37db||0xcc;return function(_0x191004){if(_0x191004){return _0x1b90c2[_0xa00e('0x13')](_0x5e37db);}return _0x1b90c2[_0xa00e('0x14')](_0x5e37db)[_0xa00e('0x15')]();};}function respondWithResult(_0x1a96fb,_0x5abff2){_0x5abff2=_0x5abff2||0xc8;return function(_0x300b26){if(_0x300b26){return _0x1a96fb[_0xa00e('0x14')](_0x5abff2)[_0xa00e('0x16')](_0x300b26);}};}function respondWithFilteredResult(_0x1982e4,_0x528588){return function(_0x5ef3ae){if(_0x5ef3ae){var _0x24f2aa=typeof _0x528588[_0xa00e('0x17')]===_0xa00e('0x18')&&typeof _0x528588['limit']==='undefined';var _0x3f2370=_0x5ef3ae[_0xa00e('0x19')];var _0xde37c6=_0x24f2aa?0x0:_0x528588[_0xa00e('0x17')];var _0x314106=_0x24f2aa?_0x5ef3ae[_0xa00e('0x19')]:_0x528588[_0xa00e('0x17')]+_0x528588[_0xa00e('0x1a')];var _0x523e6c;if(_0x314106>=_0x3f2370){_0x314106=_0x3f2370;_0x523e6c=0xc8;}else{_0x523e6c=0xce;}_0x1982e4[_0xa00e('0x14')](_0x523e6c);return _0x1982e4[_0xa00e('0x1b')]('Content-Range',_0xde37c6+'-'+_0x314106+'/'+_0x3f2370)[_0xa00e('0x16')](_0x5ef3ae);}return null;};}function patchUpdates(_0x4c0300){return function(_0x1b6bb1){try{jsonpatch['apply'](_0x1b6bb1,_0x4c0300,!![]);}catch(_0x3b74c3){return BPromise[_0xa00e('0x1c')](_0x3b74c3);}return _0x1b6bb1[_0xa00e('0x1d')]();};}function saveUpdates(_0x12d20e,_0x3355a0){return function(_0x4de224){if(_0x4de224){return _0x4de224[_0xa00e('0x1e')](_0x12d20e)[_0xa00e('0x1f')](function(_0x27ebcc){return _0x27ebcc;});}return null;};}function removeEntity(_0x4e7887,_0x257541){return function(_0x1ac5bd){if(_0x1ac5bd){return _0x1ac5bd[_0xa00e('0x20')]()[_0xa00e('0x1f')](function(){var _0x4d29e=_0x1ac5bd['get']({'plain':!![]});var _0x3917ad=_0xa00e('0x21');return db['UserProfileResource'][_0xa00e('0x20')]({'where':{'type':_0x3917ad,'resourceId':_0x4d29e['id']}})[_0xa00e('0x1f')](function(){return _0x1ac5bd;});})['then'](function(){_0x4e7887['status'](0xcc)[_0xa00e('0x15')]();});}};}function handleEntityNotFound(_0x261517,_0x3d4c1b){return function(_0x5a55d8){if(!_0x5a55d8){_0x261517[_0xa00e('0x13')](0x194);}return _0x5a55d8;};}function handleError(_0x5bb62d,_0x548122){_0x548122=_0x548122||0x1f4;return function(_0x1bb85f){logger['error'](_0x1bb85f['stack']);if(_0x1bb85f[_0xa00e('0x22')]){delete _0x1bb85f['name'];}_0x5bb62d['status'](_0x548122)[_0xa00e('0x23')](_0x1bb85f);};}exports[_0xa00e('0x24')]=function(_0xb0c5c4,_0x4e366b){var _0x4d0072={},_0x31f901={},_0x3cba91={'count':0x0,'rows':[]};var _0x1d837f=_['map'](db[_0xa00e('0x25')][_0xa00e('0x26')],function(_0x261d0d){return{'name':_0x261d0d[_0xa00e('0x27')],'type':_0x261d0d['type'][_0xa00e('0x28')]};});_0x31f901[_0xa00e('0x29')]=_[_0xa00e('0x2a')](_0x1d837f,'name');_0x31f901[_0xa00e('0x2b')]=_[_0xa00e('0x2c')](_0xb0c5c4[_0xa00e('0x2b')]);_0x31f901[_0xa00e('0x2d')]=_[_0xa00e('0x2e')](_0x31f901[_0xa00e('0x29')],_0x31f901[_0xa00e('0x2b')]);_0x4d0072[_0xa00e('0x2f')]=_['intersection'](_0x31f901[_0xa00e('0x29')],qs[_0xa00e('0x30')](_0xb0c5c4[_0xa00e('0x2b')]['fields']));_0x4d0072[_0xa00e('0x2f')]=_0x4d0072[_0xa00e('0x2f')][_0xa00e('0x31')]?_0x4d0072[_0xa00e('0x2f')]:_0x31f901[_0xa00e('0x29')];if(!_0xb0c5c4[_0xa00e('0x2b')][_0xa00e('0x32')](_0xa00e('0x33'))){_0x4d0072[_0xa00e('0x1a')]=qs['limit'](_0xb0c5c4['query']['limit']);_0x4d0072[_0xa00e('0x17')]=qs['offset'](_0xb0c5c4[_0xa00e('0x2b')]['offset']);}_0x4d0072['order']=qs[_0xa00e('0x34')](_0xb0c5c4['query'][_0xa00e('0x34')]);_0x4d0072['where']=qs[_0xa00e('0x2d')](_[_0xa00e('0x35')](_0xb0c5c4['query'],_0x31f901[_0xa00e('0x2d')]),_0x1d837f);if(_0xb0c5c4[_0xa00e('0x2b')][_0xa00e('0x36')]){_0x4d0072[_0xa00e('0x37')]=_[_0xa00e('0x38')](_0x4d0072[_0xa00e('0x37')],{'$or':_[_0xa00e('0x2a')](_0x1d837f,function(_0x51c0f8){if(_0x51c0f8[_0xa00e('0x39')]!==_0xa00e('0x3a')){var _0xcc3a10={};_0xcc3a10[_0x51c0f8[_0xa00e('0x22')]]={'$like':'%'+_0xb0c5c4[_0xa00e('0x2b')][_0xa00e('0x36')]+'%'};return _0xcc3a10;}})});}_0x4d0072=_[_0xa00e('0x38')]({},_0x4d0072,_0xb0c5c4[_0xa00e('0x3b')]);var _0x5ac963={'where':_0x4d0072[_0xa00e('0x37')]};return db[_0xa00e('0x25')][_0xa00e('0x19')](_0x5ac963)[_0xa00e('0x1f')](function(_0x139030){_0x3cba91[_0xa00e('0x19')]=_0x139030;if(_0xb0c5c4[_0xa00e('0x2b')]['includeAll']){_0x4d0072[_0xa00e('0x3c')]=[{'all':!![]}];}return db[_0xa00e('0x25')]['findAll'](_0x4d0072);})[_0xa00e('0x1f')](function(_0x5d1a4f){_0x3cba91['rows']=_0x5d1a4f;return _0x3cba91;})['then'](respondWithFilteredResult(_0x4e366b,_0x4d0072))['catch'](handleError(_0x4e366b,null));};exports[_0xa00e('0x3d')]=function(_0x4769f3,_0x3dc01a){var _0x3a4fcb={'raw':!![],'where':{'id':_0x4769f3[_0xa00e('0x3e')]['id']}},_0x40b558={};_0x40b558[_0xa00e('0x29')]=_[_0xa00e('0x2c')](db[_0xa00e('0x25')]['rawAttributes']);_0x40b558[_0xa00e('0x2b')]=_[_0xa00e('0x2c')](_0x4769f3[_0xa00e('0x2b')]);_0x40b558['filters']=_[_0xa00e('0x2e')](_0x40b558[_0xa00e('0x29')],_0x40b558[_0xa00e('0x2b')]);_0x3a4fcb['attributes']=_[_0xa00e('0x2e')](_0x40b558[_0xa00e('0x29')],qs['fields'](_0x4769f3[_0xa00e('0x2b')][_0xa00e('0x30')]));_0x3a4fcb[_0xa00e('0x2f')]=_0x3a4fcb['attributes'][_0xa00e('0x31')]?_0x3a4fcb[_0xa00e('0x2f')]:_0x40b558[_0xa00e('0x29')];if(_0x4769f3[_0xa00e('0x2b')][_0xa00e('0x3f')]){_0x3a4fcb[_0xa00e('0x3c')]=[{'all':!![]}];}_0x3a4fcb=_[_0xa00e('0x38')]({},_0x3a4fcb,_0x4769f3[_0xa00e('0x3b')]);return db[_0xa00e('0x25')]['find'](_0x3a4fcb)[_0xa00e('0x1f')](handleEntityNotFound(_0x3dc01a,null))['then'](respondWithResult(_0x3dc01a,null))['catch'](handleError(_0x3dc01a,null));};exports[_0xa00e('0x40')]=function(_0x256528,_0x1fdd4b){return db[_0xa00e('0x25')][_0xa00e('0x40')](_0x256528[_0xa00e('0x41')],{})[_0xa00e('0x1f')](function(_0x10cff3){var _0x1c1e04=_0x256528[_0xa00e('0x42')][_0xa00e('0x43')]({'plain':!![]});if(!_0x1c1e04)throw new Error(_0xa00e('0x44'));if(_0x1c1e04[_0xa00e('0x45')]===_0xa00e('0x42')){var _0x39b4a9=_0x10cff3[_0xa00e('0x43')]({'plain':!![]});var _0x32c7ea=_0xa00e('0x21');return db[_0xa00e('0x46')]['find']({'where':{'name':_0x32c7ea,'userProfileId':_0x1c1e04[_0xa00e('0x47')]},'raw':!![]})['then'](function(_0x531088){if(_0x531088&&_0x531088[_0xa00e('0x48')]===0x0){return db[_0xa00e('0x49')]['create']({'name':_0x39b4a9[_0xa00e('0x22')],'resourceId':_0x39b4a9['id'],'type':_0x531088[_0xa00e('0x22')],'sectionId':_0x531088['id']},{})[_0xa00e('0x1f')](function(){return _0x10cff3;});}else{return _0x10cff3;}})[_0xa00e('0x4a')](function(_0x380d92){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x380d92);throw _0x380d92;});}return _0x10cff3;})[_0xa00e('0x1f')](respondWithResult(_0x1fdd4b,0xc9))[_0xa00e('0x4a')](handleError(_0x1fdd4b,null));};exports['update']=function(_0x9ad4f2,_0x5337b3){if(_0x9ad4f2[_0xa00e('0x41')]['id']){delete _0x9ad4f2[_0xa00e('0x41')]['id'];}return db['CmHopperAdditionalPhone'][_0xa00e('0x4b')]({'where':{'id':_0x9ad4f2[_0xa00e('0x3e')]['id']}})[_0xa00e('0x1f')](handleEntityNotFound(_0x5337b3,null))[_0xa00e('0x1f')](saveUpdates(_0x9ad4f2['body'],null))['then'](respondWithResult(_0x5337b3,null))[_0xa00e('0x4a')](handleError(_0x5337b3,null));};exports[_0xa00e('0x20')]=function(_0xede166,_0x47080e){return db[_0xa00e('0x25')]['find']({'where':{'id':_0xede166['params']['id']}})[_0xa00e('0x1f')](handleEntityNotFound(_0x47080e,null))[_0xa00e('0x1f')](removeEntity(_0x47080e,null))[_0xa00e('0x4a')](handleError(_0x47080e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 347b66a..877f40b 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 _0xe7c4=['bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment'];(function(_0x10d433,_0x139eb7){var _0xc268e5=function(_0x45e05c){while(--_0x45e05c){_0x10d433['push'](_0x10d433['shift']());}};_0xc268e5(++_0x139eb7);}(_0xe7c4,0xa3));var _0x4e7c=function(_0x937a22,_0x3a6682){_0x937a22=_0x937a22-0x0;var _0x18a7ca=_0xe7c4[_0x937a22];return _0x18a7ca;};'use strict';var _=require(_0x4e7c('0x0'));var util=require(_0x4e7c('0x1'));var logger=require(_0x4e7c('0x2'))(_0x4e7c('0x3'));var moment=require(_0x4e7c('0x4'));var BPromise=require(_0x4e7c('0x5'));var rp=require(_0x4e7c('0x6'));var fs=require('fs');var path=require(_0x4e7c('0x7'));var rimraf=require('rimraf');var config=require(_0x4e7c('0x8'));var attributes=require(_0x4e7c('0x9'));module[_0x4e7c('0xa')]=function(_0x16a8f0,_0x439dbc){return _0x16a8f0[_0x4e7c('0xb')](_0x4e7c('0xc'),attributes,{'tableName':_0x4e7c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf88f=['cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone'];(function(_0x2d2194,_0x56fb96){var _0x1febae=function(_0x29990f){while(--_0x29990f){_0x2d2194['push'](_0x2d2194['shift']());}};_0x1febae(++_0x56fb96);}(_0xf88f,0x1bb));var _0xff88=function(_0x1dba79,_0x221474){_0x1dba79=_0x1dba79-0x0;var _0x452a11=_0xf88f[_0x1dba79];return _0x452a11;};'use strict';var _=require(_0xff88('0x0'));var util=require(_0xff88('0x1'));var logger=require(_0xff88('0x2'))(_0xff88('0x3'));var moment=require(_0xff88('0x4'));var BPromise=require(_0xff88('0x5'));var rp=require(_0xff88('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xff88('0x7'));var config=require(_0xff88('0x8'));var attributes=require(_0xff88('0x9'));module['exports']=function(_0x38e1df,_0x406a2e){return _0x38e1df[_0xff88('0xa')](_0xff88('0xb'),attributes,{'tableName':_0xff88('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 ad7480d..3f5de37 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 _0x5525=['CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','error','code','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','entity','ASC','countdropretry','countmachineretry','dialGlobalMaxRetry','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','updatedAt','phone','activateAdditionalPhone','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x71073f,_0x51f669){var _0x48bcb0=function(_0x62a91d){while(--_0x62a91d){_0x71073f['push'](_0x71073f['shift']());}};_0x48bcb0(++_0x51f669);}(_0x5525,0x87));var _0x5552=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5525[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5552('0x0'));var util=require(_0x5552('0x1'));var moment=require(_0x5552('0x2'));var BPromise=require(_0x5552('0x3'));var rs=require(_0x5552('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5552('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5552('0x6'));var jayson=require(_0x5552('0x7'));var client=jayson['client'][_0x5552('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1af266,_0x230857,_0x4ab86c){return new BPromise(function(_0x435989,_0x5746d9){return client[_0x5552('0x9')](_0x1af266,_0x4ab86c)[_0x5552('0xa')](function(_0x2e692d){logger[_0x5552('0xb')](_0x5552('0xc'),_0x230857,_0x5552('0xd'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x230857,_0x5552('0xd'),JSON['stringify'](_0x2e692d));if(_0x2e692d[_0x5552('0xe')]){if(_0x2e692d['error'][_0x5552('0xf')]===0x1f4){logger[_0x5552('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x230857,_0x2e692d[_0x5552('0xe')][_0x5552('0x10')]);return _0x5746d9(_0x2e692d['error']['message']);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x230857,_0x2e692d['error']['message']);return _0x435989(_0x2e692d['error'][_0x5552('0x10')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x230857,_0x5552('0xd'));_0x435989(_0x2e692d['result']['message']);}})[_0x5552('0x11')](function(_0x4d1ba7){logger[_0x5552('0xe')](_0x5552('0xc'),_0x230857,_0x4d1ba7);_0x5746d9(_0x4d1ba7);});});}exports[_0x5552('0x12')]=function(_0x5325df){var _0x449aa3=this;return new Promise(function(_0x3b16e6,_0x3b12f6){return db[_0x5552('0x13')][_0x5552('0x14')]({'raw':!![],'where':{'ContactId':_0x5325df[_0x5552('0x15')][_0x5552('0x16')],'ListId':_0x5325df[_0x5552('0x15')][_0x5552('0x17')],'VoiceQueueId':_0x5325df[_0x5552('0x15')][_0x5552('0x18')]===undefined?null:_0x5325df[_0x5552('0x15')][_0x5552('0x18')],'CampaignId':_0x5325df[_0x5552('0x15')][_0x5552('0x19')]===undefined?null:_0x5325df['body'][_0x5552('0x19')]}})[_0x5552('0xa')](function(_0x1a363a){if(_0x1a363a!=null){return db[_0x5552('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1a363a['id'],'OrderBy':{'$gt':_0x1a363a[_0x5552('0x1b')]}},'order':[[_0x5552('0x1b'),'ASC']]})[_0x5552('0xa')](function(_0x1bcbd2){var _0x4cecb0=0x0;if(_0x1bcbd2){if(_0x1bcbd2[_0x5552('0x1c')]+_0x1bcbd2[_0x5552('0x1d')]+_0x1bcbd2[_0x5552('0x1e')]+_0x1bcbd2[_0x5552('0x1f')]+_0x1bcbd2['countdropretry']+_0x1bcbd2[_0x5552('0x20')]+_0x1bcbd2['countmachineretry']+_0x1bcbd2[_0x5552('0x21')]<_0x5325df[_0x5552('0x22')]['dialGlobalMaxRetry'])_0x4cecb0=0x1;_0x3b16e6({'additional':_0x4cecb0});}else{return db[_0x5552('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1a363a['id']},'order':[[_0x5552('0x1b'),_0x5552('0x23')]]})[_0x5552('0xa')](function(_0x3c47b6){var _0x54a9c7=0x0;if(_0x3c47b6){if(_0x3c47b6[_0x5552('0x1c')]+_0x3c47b6[_0x5552('0x1d')]+_0x3c47b6['countnoanswerretry']+_0x3c47b6[_0x5552('0x1f')]+_0x3c47b6[_0x5552('0x24')]+_0x3c47b6[_0x5552('0x20')]+_0x3c47b6[_0x5552('0x25')]+_0x3c47b6[_0x5552('0x21')]<_0x5325df[_0x5552('0x22')][_0x5552('0x26')])_0x54a9c7=0x1;_0x3b16e6({'additional':_0x54a9c7});}else{_0x3b16e6({'additional':0x0});}})[_0x5552('0x11')](function(_0x2e1171){logger[_0x5552('0xe')](_0x5552('0x12'),_0x2e1171['message']);_0x3b12f6(_0x449aa3[_0x5552('0xe')](0x1f4,_0x2e1171[_0x5552('0x10')]));});}})[_0x5552('0x11')](function(_0x2625b0){logger[_0x5552('0xe')]('VerifyAdditionalPhones',_0x2625b0[_0x5552('0x10')]);_0x3b12f6(_0x449aa3['error'](0x1f4,_0x2625b0[_0x5552('0x10')]));});}else _0x3b16e6({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x430f3e){var _0x230be2=this;return new Promise(function(_0x9db041,_0x5a8eb0){return db['CmHopper'][_0x5552('0x14')]({'raw':!![],'where':{'ContactId':_0x430f3e['body'][_0x5552('0x16')],'ListId':_0x430f3e[_0x5552('0x15')][_0x5552('0x17')],'VoiceQueueId':_0x430f3e['body']['VoiceQueueId']===undefined?null:_0x430f3e[_0x5552('0x15')]['VoiceQueueId'],'CampaignId':_0x430f3e[_0x5552('0x15')][_0x5552('0x19')]===undefined?null:_0x430f3e['body']['CampaignId']}})['then'](function(_0x42a21d){if(_0x42a21d!=null){return db[_0x5552('0x1a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x42a21d['id'],'OrderBy':{'$gte':_0x42a21d['OrderBy']}},'order':[[_0x5552('0x1b'),_0x5552('0x23')]]})[_0x5552('0xa')](function(_0x5dce73){if(_0x5dce73)return activateAdditionalPhone(_0x42a21d,_0x430f3e[_0x5552('0x15')],_0x5dce73,_0x430f3e[_0x5552('0x27')],_0x430f3e[_0x5552('0x28')])['then'](function(_0x3d1dbf){_0x9db041(_0x3d1dbf);});else{return db[_0x5552('0x1a')][_0x5552('0x14')]({'raw':!![],'where':{'CmHopperId':_0x42a21d['id']},'order':[[_0x5552('0x1b'),_0x5552('0x23')]]})[_0x5552('0xa')](function(_0xdcff8e){if(_0xdcff8e)return activateAdditionalPhone(_0x42a21d,_0x430f3e['body'],_0xdcff8e,_0x430f3e[_0x5552('0x27')],_0x430f3e[_0x5552('0x28')])[_0x5552('0xa')](function(_0x5e1fde){_0x9db041(_0x5e1fde);});else{_0x9db041({'id':_0x42a21d['id'],'phone':''});}})['catch'](function(_0x15a4ea){logger[_0x5552('0xe')](_0x5552('0x12'),_0x15a4ea[_0x5552('0x10')]);_0x5a8eb0(_0x230be2['error'](0x1f4,_0x15a4ea[_0x5552('0x10')]));});}})[_0x5552('0x11')](function(_0x4bc8e8){logger[_0x5552('0xe')]('VerifyAdditionalPhones',_0x4bc8e8[_0x5552('0x10')]);_0x5a8eb0(_0x230be2['error'](0x1f4,_0x4bc8e8['message']));});}else _0x9db041(0x1);});});};function activateAdditionalPhone(_0x587a19,_0x492176,_0x31f07c,_0x49e7b8,_0x5eb45a){return new Promise(function(_0xeb6e56,_0x14a2c8){var _0x259c3e;if(_[_0x5552('0x29')](_0x31f07c[_0x5552('0x2a')])){_0x31f07c['scheduledat']=moment();}if(moment()>moment(_0x31f07c[_0x5552('0x2a')])){_0x259c3e=moment()[_0x5552('0x2b')](_0x5eb45a||0x3,_0x5552('0x2c'));}else{if(_0x31f07c[_0x5552('0x1b')]==0x0){_0x259c3e=moment(_0x31f07c[_0x5552('0x2a')]);}else{_0x259c3e=moment()[_0x5552('0x2b')](_0x5eb45a||0x3,_0x5552('0x2c'));}}if(_[_0x5552('0x29')](_0x259c3e)){_0x259c3e=moment()['add'](_0x5eb45a||0x3,_0x5552('0x2c'));}var _0x49964b={'phone':_0x587a19['phone'],'active':0x0,'OrderBy':_[_0x5552('0x29')](_0x587a19[_0x5552('0x1b')])?0x0:_0x587a19['OrderBy'],'scheduledat':moment()[_0x5552('0x2b')](_0x49e7b8||0x1,_0x5552('0x2c')),'countbusyretry':_0x492176[_0x5552('0x1c')],'countcongestionretry':_0x492176[_0x5552('0x1d')],'countnoanswerretry':_0x492176[_0x5552('0x1e')],'countnosuchnumberretry':_0x492176[_0x5552('0x1f')],'countdropretry':_0x492176[_0x5552('0x24')],'countabandonedretry':_0x492176[_0x5552('0x20')],'countmachineretry':_0x492176[_0x5552('0x25')],'countagentrejectretry':_0x492176[_0x5552('0x21')],'createdAt':_0x492176[_0x5552('0x2d')],'updatedAt':_0x492176[_0x5552('0x2e')]};var _0x52a96d={'CmHopperId':_0x587a19['id'],'phone':_0x31f07c[_0x5552('0x2f')],'active':0x0,'OrderBy':_[_0x5552('0x29')](_0x31f07c['OrderBy'])?0x0:_0x31f07c[_0x5552('0x1b')],'scheduledat':_0x259c3e,'countbusyretry':_0x31f07c['countbusyretry'],'countcongestionretry':_0x31f07c[_0x5552('0x1d')],'countnoanswerretry':_0x31f07c[_0x5552('0x1e')],'countnosuchnumberretry':_0x31f07c[_0x5552('0x1f')],'countdropretry':_0x31f07c[_0x5552('0x24')],'countabandonedretry':_0x31f07c[_0x5552('0x20')],'countmachineretry':_0x31f07c['countmachineretry'],'countagentrejectretry':_0x31f07c[_0x5552('0x21')],'createdAt':_0x31f07c['createdAt'],'updatedAt':_0x31f07c['updatedAt']};return db['sequelize']['transaction'](function(_0x3c7bf7){return db[_0x5552('0x1a')]['update'](_0x49964b,{'where':{'id':_0x31f07c['id']}},{'transaction':_0x3c7bf7})[_0x5552('0xa')](function(){return db['CmHopper']['update'](_0x52a96d,{'where':{'id':_0x587a19['id']}},{'transaction':_0x3c7bf7});});})[_0x5552('0xa')](function(_0x3bf224){_0xeb6e56({'id':_0x587a19['id'],'phone':_0x31f07c[_0x5552('0x2f')]});})[_0x5552('0x11')](function(_0x1802e4){logger[_0x5552('0xe')](_0x5552('0x30'),_0x1802e4[_0x5552('0x10')]);_0x14a2c8({'error':_0x1802e4[_0x5552('0x10')]});});});}exports['IncrementPreviewCounters']=function(_0x5053b3){var _0x49c6a7=this;return new Promise(function(_0x3ae99f,_0x13a53f){return db['CmHopper']['update'](_0x5053b3[_0x5552('0x15')]['field'],{'where':{'id':_0x5053b3[_0x5552('0x15')]['id']}})['then'](function(_0x39f4ed){_0x3ae99f(_0x39f4ed);})[_0x5552('0x11')](function(_0x16290a){logger[_0x5552('0xe')]('IncrementPreviewCounters',_0x16290a[_0x5552('0x10')]);_0x13a53f(_0x49c6a7[_0x5552('0xe')](0x1f4,_0x16290a[_0x5552('0x10')]));});});}; \ No newline at end of file +var _0xfb71=['client','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4ef256,_0x2bcd33){var _0x152931=function(_0x56cb69){while(--_0x56cb69){_0x4ef256['push'](_0x4ef256['shift']());}};_0x152931(++_0x2bcd33);}(_0xfb71,0x1ef));var _0x1fb7=function(_0x42acc6,_0x56eeb7){_0x42acc6=_0x42acc6-0x0;var _0x1bb0e4=_0xfb71[_0x42acc6];return _0x1bb0e4;};'use strict';var _=require(_0x1fb7('0x0'));var util=require(_0x1fb7('0x1'));var moment=require(_0x1fb7('0x2'));var BPromise=require(_0x1fb7('0x3'));var rs=require(_0x1fb7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1fb7('0x5'));var logger=require(_0x1fb7('0x6'))(_0x1fb7('0x7'));var config=require('../../config/environment');var jayson=require(_0x1fb7('0x8'));var client=jayson[_0x1fb7('0x9')][_0x1fb7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2112f8,_0x42fc30,_0x45742f){return new BPromise(function(_0x4abac2,_0x287b4a){return client[_0x1fb7('0xb')](_0x2112f8,_0x45742f)['then'](function(_0x968df9){logger[_0x1fb7('0xc')](_0x1fb7('0xd'),_0x42fc30,_0x1fb7('0xe'));logger[_0x1fb7('0xf')](_0x1fb7('0x10'),_0x42fc30,'request\x20sent',JSON['stringify'](_0x968df9));if(_0x968df9[_0x1fb7('0x11')]){if(_0x968df9[_0x1fb7('0x11')][_0x1fb7('0x12')]===0x1f4){logger['error'](_0x1fb7('0xd'),_0x42fc30,_0x968df9[_0x1fb7('0x11')][_0x1fb7('0x13')]);return _0x287b4a(_0x968df9['error']['message']);}logger[_0x1fb7('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x42fc30,_0x968df9['error'][_0x1fb7('0x13')]);return _0x4abac2(_0x968df9['error'][_0x1fb7('0x13')]);}else{logger[_0x1fb7('0xc')](_0x1fb7('0xd'),_0x42fc30,_0x1fb7('0xe'));_0x4abac2(_0x968df9[_0x1fb7('0x14')][_0x1fb7('0x13')]);}})[_0x1fb7('0x15')](function(_0x3126bf){logger[_0x1fb7('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x42fc30,_0x3126bf);_0x287b4a(_0x3126bf);});});}exports[_0x1fb7('0x16')]=function(_0x17de9d){var _0x43b878=this;return new Promise(function(_0x5e34c8,_0x5015b3){return db[_0x1fb7('0x17')][_0x1fb7('0x18')]({'raw':!![],'where':{'ContactId':_0x17de9d[_0x1fb7('0x19')][_0x1fb7('0x1a')],'ListId':_0x17de9d[_0x1fb7('0x19')]['ListId'],'VoiceQueueId':_0x17de9d['body'][_0x1fb7('0x1b')]===undefined?null:_0x17de9d[_0x1fb7('0x19')]['VoiceQueueId'],'CampaignId':_0x17de9d[_0x1fb7('0x19')][_0x1fb7('0x1c')]===undefined?null:_0x17de9d['body']['CampaignId']}})[_0x1fb7('0x1d')](function(_0x294e2b){if(_0x294e2b!=null){return db[_0x1fb7('0x1e')][_0x1fb7('0x18')]({'raw':!![],'where':{'CmHopperId':_0x294e2b['id'],'OrderBy':{'$gt':_0x294e2b[_0x1fb7('0x1f')]}},'order':[[_0x1fb7('0x1f'),_0x1fb7('0x20')]]})['then'](function(_0x3da6af){var _0x2ba773=0x0;if(_0x3da6af){if(_0x3da6af['countbusyretry']+_0x3da6af[_0x1fb7('0x21')]+_0x3da6af['countnoanswerretry']+_0x3da6af['countnosuchnumberretry']+_0x3da6af[_0x1fb7('0x22')]+_0x3da6af[_0x1fb7('0x23')]+_0x3da6af[_0x1fb7('0x24')]+_0x3da6af['countagentrejectretry']<_0x17de9d[_0x1fb7('0x25')][_0x1fb7('0x26')])_0x2ba773=0x1;_0x5e34c8({'additional':_0x2ba773});}else{return db[_0x1fb7('0x1e')][_0x1fb7('0x18')]({'raw':!![],'where':{'CmHopperId':_0x294e2b['id']},'order':[[_0x1fb7('0x1f'),_0x1fb7('0x20')]]})[_0x1fb7('0x1d')](function(_0x378c02){var _0x39bb74=0x0;if(_0x378c02){if(_0x378c02[_0x1fb7('0x27')]+_0x378c02['countcongestionretry']+_0x378c02[_0x1fb7('0x28')]+_0x378c02[_0x1fb7('0x29')]+_0x378c02[_0x1fb7('0x22')]+_0x378c02[_0x1fb7('0x23')]+_0x378c02[_0x1fb7('0x24')]+_0x378c02[_0x1fb7('0x2a')]<_0x17de9d['entity'][_0x1fb7('0x26')])_0x39bb74=0x1;_0x5e34c8({'additional':_0x39bb74});}else{_0x5e34c8({'additional':0x0});}})['catch'](function(_0x5f196f){logger[_0x1fb7('0x11')](_0x1fb7('0x16'),_0x5f196f[_0x1fb7('0x13')]);_0x5015b3(_0x43b878[_0x1fb7('0x11')](0x1f4,_0x5f196f['message']));});}})[_0x1fb7('0x15')](function(_0x468dd0){logger['error'](_0x1fb7('0x16'),_0x468dd0[_0x1fb7('0x13')]);_0x5015b3(_0x43b878[_0x1fb7('0x11')](0x1f4,_0x468dd0[_0x1fb7('0x13')]));});}else _0x5e34c8({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x6240db){var _0x254b3f=this;return new Promise(function(_0x2d2071,_0x301e66){return db[_0x1fb7('0x17')][_0x1fb7('0x18')]({'raw':!![],'where':{'ContactId':_0x6240db[_0x1fb7('0x19')][_0x1fb7('0x1a')],'ListId':_0x6240db['body']['ListId'],'VoiceQueueId':_0x6240db[_0x1fb7('0x19')][_0x1fb7('0x1b')]===undefined?null:_0x6240db[_0x1fb7('0x19')][_0x1fb7('0x1b')],'CampaignId':_0x6240db[_0x1fb7('0x19')][_0x1fb7('0x1c')]===undefined?null:_0x6240db[_0x1fb7('0x19')][_0x1fb7('0x1c')]}})[_0x1fb7('0x1d')](function(_0x4318ed){if(_0x4318ed!=null){return db[_0x1fb7('0x1e')][_0x1fb7('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4318ed['id'],'OrderBy':{'$gte':_0x4318ed[_0x1fb7('0x1f')]}},'order':[[_0x1fb7('0x1f'),_0x1fb7('0x20')]]})['then'](function(_0x6f2c46){if(_0x6f2c46)return activateAdditionalPhone(_0x4318ed,_0x6240db[_0x1fb7('0x19')],_0x6f2c46,_0x6240db[_0x1fb7('0x2b')],_0x6240db[_0x1fb7('0x2c')])['then'](function(_0x36b75d){_0x2d2071(_0x36b75d);});else{return db['CmHopperAdditionalPhone'][_0x1fb7('0x18')]({'raw':!![],'where':{'CmHopperId':_0x4318ed['id']},'order':[[_0x1fb7('0x1f'),'ASC']]})[_0x1fb7('0x1d')](function(_0x2f0da8){if(_0x2f0da8)return activateAdditionalPhone(_0x4318ed,_0x6240db[_0x1fb7('0x19')],_0x2f0da8,_0x6240db[_0x1fb7('0x2b')],_0x6240db[_0x1fb7('0x2c')])[_0x1fb7('0x1d')](function(_0x15d221){_0x2d2071(_0x15d221);});else{_0x2d2071({'id':_0x4318ed['id'],'phone':''});}})[_0x1fb7('0x15')](function(_0x38533a){logger[_0x1fb7('0x11')](_0x1fb7('0x16'),_0x38533a[_0x1fb7('0x13')]);_0x301e66(_0x254b3f[_0x1fb7('0x11')](0x1f4,_0x38533a[_0x1fb7('0x13')]));});}})[_0x1fb7('0x15')](function(_0x142417){logger['error'](_0x1fb7('0x16'),_0x142417[_0x1fb7('0x13')]);_0x301e66(_0x254b3f['error'](0x1f4,_0x142417['message']));});}else _0x2d2071(0x1);});});};function activateAdditionalPhone(_0x425f8c,_0x10c3d2,_0x516431,_0x258630,_0x4bfa2){return new Promise(function(_0x272f57,_0x5ac262){var _0x31580b;if(_[_0x1fb7('0x2d')](_0x516431[_0x1fb7('0x2e')])){_0x516431[_0x1fb7('0x2e')]=moment();}if(moment()>moment(_0x516431[_0x1fb7('0x2e')])){_0x31580b=moment()[_0x1fb7('0x2f')](_0x4bfa2||0x3,_0x1fb7('0x30'));}else{if(_0x516431[_0x1fb7('0x1f')]==0x0){_0x31580b=moment(_0x516431[_0x1fb7('0x2e')]);}else{_0x31580b=moment()['add'](_0x4bfa2||0x3,_0x1fb7('0x30'));}}if(_[_0x1fb7('0x2d')](_0x31580b)){_0x31580b=moment()[_0x1fb7('0x2f')](_0x4bfa2||0x3,_0x1fb7('0x30'));}var _0x5e8eb8={'phone':_0x425f8c[_0x1fb7('0x31')],'active':0x0,'OrderBy':_[_0x1fb7('0x2d')](_0x425f8c[_0x1fb7('0x1f')])?0x0:_0x425f8c[_0x1fb7('0x1f')],'scheduledat':moment()[_0x1fb7('0x2f')](_0x258630||0x1,_0x1fb7('0x30')),'countbusyretry':_0x10c3d2[_0x1fb7('0x27')],'countcongestionretry':_0x10c3d2[_0x1fb7('0x21')],'countnoanswerretry':_0x10c3d2['countnoanswerretry'],'countnosuchnumberretry':_0x10c3d2[_0x1fb7('0x29')],'countdropretry':_0x10c3d2[_0x1fb7('0x22')],'countabandonedretry':_0x10c3d2[_0x1fb7('0x23')],'countmachineretry':_0x10c3d2[_0x1fb7('0x24')],'countagentrejectretry':_0x10c3d2[_0x1fb7('0x2a')],'createdAt':_0x10c3d2[_0x1fb7('0x32')],'updatedAt':_0x10c3d2[_0x1fb7('0x33')]};var _0x5ed54e={'CmHopperId':_0x425f8c['id'],'phone':_0x516431[_0x1fb7('0x31')],'active':0x0,'OrderBy':_[_0x1fb7('0x2d')](_0x516431['OrderBy'])?0x0:_0x516431[_0x1fb7('0x1f')],'scheduledat':_0x31580b,'countbusyretry':_0x516431[_0x1fb7('0x27')],'countcongestionretry':_0x516431['countcongestionretry'],'countnoanswerretry':_0x516431['countnoanswerretry'],'countnosuchnumberretry':_0x516431['countnosuchnumberretry'],'countdropretry':_0x516431[_0x1fb7('0x22')],'countabandonedretry':_0x516431[_0x1fb7('0x23')],'countmachineretry':_0x516431['countmachineretry'],'countagentrejectretry':_0x516431[_0x1fb7('0x2a')],'createdAt':_0x516431[_0x1fb7('0x32')],'updatedAt':_0x516431[_0x1fb7('0x33')]};return db[_0x1fb7('0x34')][_0x1fb7('0x35')](function(_0x438734){return db[_0x1fb7('0x1e')][_0x1fb7('0x36')](_0x5e8eb8,{'where':{'id':_0x516431['id']}},{'transaction':_0x438734})[_0x1fb7('0x1d')](function(){return db[_0x1fb7('0x17')]['update'](_0x5ed54e,{'where':{'id':_0x425f8c['id']}},{'transaction':_0x438734});});})[_0x1fb7('0x1d')](function(_0x5976d6){_0x272f57({'id':_0x425f8c['id'],'phone':_0x516431['phone']});})[_0x1fb7('0x15')](function(_0x4b1ba3){logger[_0x1fb7('0x11')]('activateAdditionalPhone',_0x4b1ba3[_0x1fb7('0x13')]);_0x5ac262({'error':_0x4b1ba3[_0x1fb7('0x13')]});});});}exports[_0x1fb7('0x37')]=function(_0x4be4a6){var _0x27d218=this;return new Promise(function(_0x2fb723,_0x5a3522){return db['CmHopper'][_0x1fb7('0x36')](_0x4be4a6['body']['field'],{'where':{'id':_0x4be4a6[_0x1fb7('0x19')]['id']}})[_0x1fb7('0x1d')](function(_0x31ed3d){_0x2fb723(_0x31ed3d);})[_0x1fb7('0x15')](function(_0x3820bc){logger[_0x1fb7('0x11')](_0x1fb7('0x37'),_0x3820bc['message']);_0x5a3522(_0x27d218[_0x1fb7('0x11')](0x1f4,_0x3820bc[_0x1fb7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index dfb5255..7eedaa8 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 _0x4d6e=['../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','create','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x17d84f,_0x4b29e3){var _0x314944=function(_0x252a44){while(--_0x252a44){_0x17d84f['push'](_0x17d84f['shift']());}};_0x314944(++_0x4b29e3);}(_0x4d6e,0x77));var _0xe4d6=function(_0x41c842,_0x3865f6){_0x41c842=_0x41c842-0x0;var _0x15ee6b=_0x4d6e[_0x41c842];return _0x15ee6b;};'use strict';var multer=require(_0xe4d6('0x0'));var util=require(_0xe4d6('0x1'));var path=require(_0xe4d6('0x2'));var timeout=require(_0xe4d6('0x3'));var express=require(_0xe4d6('0x4'));var router=express['Router']();var fs_extra=require(_0xe4d6('0x5'));var auth=require(_0xe4d6('0x6'));var interaction=require(_0xe4d6('0x7'));var config=require(_0xe4d6('0x8'));var controller=require(_0xe4d6('0x9'));router[_0xe4d6('0xa')]('/',auth[_0xe4d6('0xb')](),controller[_0xe4d6('0xc')]);router[_0xe4d6('0xa')](_0xe4d6('0xd'),auth[_0xe4d6('0xb')](),controller[_0xe4d6('0xe')]);router['post']('/',auth[_0xe4d6('0xb')](),controller[_0xe4d6('0xf')]);router['put'](_0xe4d6('0xd'),auth[_0xe4d6('0xb')](),controller[_0xe4d6('0x10')]);router[_0xe4d6('0x11')](_0xe4d6('0xd'),auth[_0xe4d6('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd9e3=['./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3592a1,_0x24a8d2){var _0x5ba9ef=function(_0x51a263){while(--_0x51a263){_0x3592a1['push'](_0x3592a1['shift']());}};_0x5ba9ef(++_0x24a8d2);}(_0xd9e3,0x7b));var _0x3d9e=function(_0x4fdbdb,_0x101410){_0x4fdbdb=_0x4fdbdb-0x0;var _0x270a8d=_0xd9e3[_0x4fdbdb];return _0x270a8d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3d9e('0x0'));var timeout=require(_0x3d9e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3d9e('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x3d9e('0x3'));var config=require(_0x3d9e('0x4'));var controller=require(_0x3d9e('0x5'));router[_0x3d9e('0x6')]('/',auth[_0x3d9e('0x7')](),controller['index']);router[_0x3d9e('0x6')](_0x3d9e('0x8'),auth[_0x3d9e('0x7')](),controller[_0x3d9e('0x9')]);router[_0x3d9e('0xa')]('/',auth['isAuthenticated'](),controller[_0x3d9e('0xb')]);router[_0x3d9e('0xc')](_0x3d9e('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x3d9e('0xd')](_0x3d9e('0x8'),auth['isAuthenticated'](),controller[_0x3d9e('0xe')]);module[_0x3d9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index abfa11d..281d739 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 _0xaa96=['sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xaa96,0x145));var _0x6aa9=function(_0x34a161,_0x52a77b){_0x34a161=_0x34a161-0x0;var _0x4412a1=_0xaa96[_0x34a161];return _0x4412a1;};'use strict';var moment=require('moment');var Sequelize=require(_0x6aa9('0x0'));module[_0x6aa9('0x1')]={'phone':{'type':Sequelize[_0x6aa9('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6aa9('0x3')],'unique':_0x6aa9('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x6aa9('0x4')},'VoiceQueueId':{'type':Sequelize[_0x6aa9('0x3')],'unique':_0x6aa9('0x4')}}; \ No newline at end of file +var _0x8f6b=['contactListQueue','moment','sequelize','exports','INTEGER'];(function(_0x3f45a5,_0x1aef45){var _0x16d579=function(_0x4b1a49){while(--_0x4b1a49){_0x3f45a5['push'](_0x3f45a5['shift']());}};_0x16d579(++_0x1aef45);}(_0x8f6b,0x146));var _0xb8f6=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x8f6b[_0x481bf7];return _0x461787;};'use strict';var moment=require(_0xb8f6('0x0'));var Sequelize=require(_0xb8f6('0x1'));module[_0xb8f6('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb8f6('0x3')],'unique':_0xb8f6('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xb8f6('0x4')},'VoiceQueueId':{'type':Sequelize[_0xb8f6('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 2059e9c..edd4837 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 _0x9399=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','CmHopperBlack','count','includeAll','include','findAll','rows','catch','params','find','body','describe','eml-format','rimraf','zip-dir'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x9399,0x131));var _0x9939=function(_0x31c520,_0x1637f2){_0x31c520=_0x31c520-0x0;var _0x39512b=_0x9399[_0x31c520];return _0x39512b;};'use strict';var emlformat=require(_0x9939('0x0'));var rimraf=require(_0x9939('0x1'));var zipdir=require(_0x9939('0x2'));var jsonpatch=require(_0x9939('0x3'));var rp=require(_0x9939('0x4'));var moment=require(_0x9939('0x5'));var BPromise=require(_0x9939('0x6'));var Mustache=require(_0x9939('0x7'));var util=require(_0x9939('0x8'));var path=require(_0x9939('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9939('0xa'));var fs=require('fs');var fs_extra=require(_0x9939('0xb'));var _=require('lodash');var squel=require(_0x9939('0xc'));var crypto=require('crypto');var jsforce=require(_0x9939('0xd'));var deskjs=require(_0x9939('0xe'));var toCsv=require(_0x9939('0xf'));var querystring=require(_0x9939('0x10'));var Papa=require(_0x9939('0x11'));var Redis=require(_0x9939('0x12'));var authService=require(_0x9939('0x13'));var qs=require(_0x9939('0x14'));var as=require(_0x9939('0x15'));var hardwareService=require(_0x9939('0x16'));var logger=require(_0x9939('0x17'))(_0x9939('0x18'));var utils=require('../../config/utils');var config=require(_0x9939('0x19'));var licenseUtil=require(_0x9939('0x1a'));var db=require(_0x9939('0x1b'))['db'];function respondWithStatusCode(_0x3e247e,_0x479651){_0x479651=_0x479651||0xcc;return function(_0x1caf5b){if(_0x1caf5b){return _0x3e247e[_0x9939('0x1c')](_0x479651);}return _0x3e247e[_0x9939('0x1d')](_0x479651)[_0x9939('0x1e')]();};}function respondWithResult(_0x850974,_0x1e6543){_0x1e6543=_0x1e6543||0xc8;return function(_0x2888f6){if(_0x2888f6){return _0x850974[_0x9939('0x1d')](_0x1e6543)[_0x9939('0x1f')](_0x2888f6);}};}function respondWithFilteredResult(_0x1d30ff,_0x4df4f8){return function(_0x439be2){if(_0x439be2){var _0x5b822f=typeof _0x4df4f8[_0x9939('0x20')]===_0x9939('0x21')&&typeof _0x4df4f8['limit']==='undefined';var _0xb08cb6=_0x439be2['count'];var _0x272689=_0x5b822f?0x0:_0x4df4f8[_0x9939('0x20')];var _0x2f1444=_0x5b822f?_0x439be2['count']:_0x4df4f8[_0x9939('0x20')]+_0x4df4f8[_0x9939('0x22')];var _0x55bcf7;if(_0x2f1444>=_0xb08cb6){_0x2f1444=_0xb08cb6;_0x55bcf7=0xc8;}else{_0x55bcf7=0xce;}_0x1d30ff[_0x9939('0x1d')](_0x55bcf7);return _0x1d30ff[_0x9939('0x23')](_0x9939('0x24'),_0x272689+'-'+_0x2f1444+'/'+_0xb08cb6)[_0x9939('0x1f')](_0x439be2);}return null;};}function patchUpdates(_0x6fff2){return function(_0x294caa){try{jsonpatch['apply'](_0x294caa,_0x6fff2,!![]);}catch(_0x2109d3){return BPromise[_0x9939('0x25')](_0x2109d3);}return _0x294caa[_0x9939('0x26')]();};}function saveUpdates(_0x276f10,_0x22c65b){return function(_0x22f07e){if(_0x22f07e){return _0x22f07e[_0x9939('0x27')](_0x276f10)[_0x9939('0x28')](function(_0x582bed){return _0x582bed;});}return null;};}function removeEntity(_0x380c16,_0x52adc7){return function(_0x2a6b0a){if(_0x2a6b0a){return _0x2a6b0a[_0x9939('0x29')]()[_0x9939('0x28')](function(){_0x380c16[_0x9939('0x1d')](0xcc)[_0x9939('0x1e')]();});}};}function handleEntityNotFound(_0x3d2c31,_0x3d6beb){return function(_0x5d6811){if(!_0x5d6811){_0x3d2c31[_0x9939('0x1c')](0x194);}return _0x5d6811;};}function handleError(_0xccba8d,_0x1af6e4){_0x1af6e4=_0x1af6e4||0x1f4;return function(_0x1d6e39){logger['error'](_0x1d6e39[_0x9939('0x2a')]);if(_0x1d6e39['name']){delete _0x1d6e39[_0x9939('0x2b')];}_0xccba8d[_0x9939('0x1d')](_0x1af6e4)[_0x9939('0x2c')](_0x1d6e39);};}exports['index']=function(_0x3daf1b,_0x1a3049){var _0x52d149={},_0xe9428d={},_0x32447d={'count':0x0,'rows':[]};var _0x403960=_[_0x9939('0x2d')](db['CmHopperBlack'][_0x9939('0x2e')],function(_0x2c16d6){return{'name':_0x2c16d6['fieldName'],'type':_0x2c16d6[_0x9939('0x2f')][_0x9939('0x30')]};});_0xe9428d[_0x9939('0x31')]=_[_0x9939('0x2d')](_0x403960,_0x9939('0x2b'));_0xe9428d['query']=_[_0x9939('0x32')](_0x3daf1b[_0x9939('0x33')]);_0xe9428d[_0x9939('0x34')]=_[_0x9939('0x35')](_0xe9428d[_0x9939('0x31')],_0xe9428d[_0x9939('0x33')]);_0x52d149[_0x9939('0x36')]=_[_0x9939('0x35')](_0xe9428d['model'],qs[_0x9939('0x37')](_0x3daf1b[_0x9939('0x33')][_0x9939('0x37')]));_0x52d149[_0x9939('0x36')]=_0x52d149['attributes'][_0x9939('0x38')]?_0x52d149['attributes']:_0xe9428d['model'];if(!_0x3daf1b[_0x9939('0x33')][_0x9939('0x39')](_0x9939('0x3a'))){_0x52d149[_0x9939('0x22')]=qs[_0x9939('0x22')](_0x3daf1b[_0x9939('0x33')]['limit']);_0x52d149[_0x9939('0x20')]=qs[_0x9939('0x20')](_0x3daf1b[_0x9939('0x33')][_0x9939('0x20')]);}_0x52d149[_0x9939('0x3b')]=qs[_0x9939('0x3c')](_0x3daf1b['query'][_0x9939('0x3c')]);_0x52d149['where']=qs[_0x9939('0x34')](_['pick'](_0x3daf1b[_0x9939('0x33')],_0xe9428d['filters']),_0x403960);if(_0x3daf1b['query'][_0x9939('0x3d')]){_0x52d149[_0x9939('0x3e')]=_[_0x9939('0x3f')](_0x52d149[_0x9939('0x3e')],{'$or':_['map'](_0x403960,function(_0x2588b1){if(_0x2588b1[_0x9939('0x2f')]!==_0x9939('0x40')){var _0x17a961={};_0x17a961[_0x2588b1[_0x9939('0x2b')]]={'$like':'%'+_0x3daf1b['query']['filter']+'%'};return _0x17a961;}})});}_0x52d149=_[_0x9939('0x3f')]({},_0x52d149,_0x3daf1b[_0x9939('0x41')]);var _0x5b7004={'where':_0x52d149[_0x9939('0x3e')]};return db[_0x9939('0x42')]['count'](_0x5b7004)['then'](function(_0x378202){_0x32447d[_0x9939('0x43')]=_0x378202;if(_0x3daf1b['query'][_0x9939('0x44')]){_0x52d149[_0x9939('0x45')]=[{'all':!![]}];}return db[_0x9939('0x42')][_0x9939('0x46')](_0x52d149);})['then'](function(_0x349a6f){_0x32447d[_0x9939('0x47')]=_0x349a6f;return _0x32447d;})['then'](respondWithFilteredResult(_0x1a3049,_0x52d149))[_0x9939('0x48')](handleError(_0x1a3049,null));};exports['show']=function(_0x43c9c9,_0x24774a){var _0x33ab78={'raw':!![],'where':{'id':_0x43c9c9[_0x9939('0x49')]['id']}},_0x4722ff={};_0x4722ff[_0x9939('0x31')]=_[_0x9939('0x32')](db[_0x9939('0x42')]['rawAttributes']);_0x4722ff['query']=_[_0x9939('0x32')](_0x43c9c9[_0x9939('0x33')]);_0x4722ff['filters']=_[_0x9939('0x35')](_0x4722ff[_0x9939('0x31')],_0x4722ff[_0x9939('0x33')]);_0x33ab78[_0x9939('0x36')]=_[_0x9939('0x35')](_0x4722ff[_0x9939('0x31')],qs['fields'](_0x43c9c9[_0x9939('0x33')][_0x9939('0x37')]));_0x33ab78['attributes']=_0x33ab78[_0x9939('0x36')][_0x9939('0x38')]?_0x33ab78['attributes']:_0x4722ff[_0x9939('0x31')];if(_0x43c9c9[_0x9939('0x33')]['includeAll']){_0x33ab78[_0x9939('0x45')]=[{'all':!![]}];}_0x33ab78=_[_0x9939('0x3f')]({},_0x33ab78,_0x43c9c9[_0x9939('0x41')]);return db[_0x9939('0x42')][_0x9939('0x4a')](_0x33ab78)[_0x9939('0x28')](handleEntityNotFound(_0x24774a,null))['then'](respondWithResult(_0x24774a,null))[_0x9939('0x48')](handleError(_0x24774a,null));};exports[_0x9939('0x27')]=function(_0xb334fc,_0x2accd2){if(_0xb334fc[_0x9939('0x4b')]['id']){delete _0xb334fc['body']['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0xb334fc[_0x9939('0x49')]['id']}})[_0x9939('0x28')](handleEntityNotFound(_0x2accd2,null))[_0x9939('0x28')](saveUpdates(_0xb334fc[_0x9939('0x4b')],null))[_0x9939('0x28')](respondWithResult(_0x2accd2,null))[_0x9939('0x48')](handleError(_0x2accd2,null));};exports[_0x9939('0x29')]=function(_0x8e5b9c,_0x2599ea){return db[_0x9939('0x42')]['find']({'where':{'id':_0x8e5b9c[_0x9939('0x49')]['id']}})[_0x9939('0x28')](handleEntityNotFound(_0x2599ea,null))[_0x9939('0x28')](removeEntity(_0x2599ea,null))[_0x9939('0x48')](handleError(_0x2599ea,null));};exports[_0x9939('0x4c')]=function(_0x86f95a,_0x18162c){return db[_0x9939('0x42')]['describe']()[_0x9939('0x28')](respondWithResult(_0x18162c,null))[_0x9939('0x48')](handleError(_0x18162c,null));}; \ No newline at end of file +var _0x49f3=['map','CmHopperBlack','fieldName','type','query','keys','intersection','model','fields','attributes','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','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','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','stack','name','send','index'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x49f3,0xb0));var _0x349f=function(_0xd94a66,_0x10a072){_0xd94a66=_0xd94a66-0x0;var _0x4a1ec8=_0x49f3[_0xd94a66];return _0x4a1ec8;};'use strict';var emlformat=require(_0x349f('0x0'));var rimraf=require(_0x349f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x349f('0x2'));var rp=require('request-promise');var moment=require(_0x349f('0x3'));var BPromise=require(_0x349f('0x4'));var Mustache=require(_0x349f('0x5'));var util=require(_0x349f('0x6'));var path=require(_0x349f('0x7'));var sox=require(_0x349f('0x8'));var csv=require(_0x349f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x349f('0xa'));var squel=require(_0x349f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x349f('0xc'));var toCsv=require(_0x349f('0x9'));var querystring=require(_0x349f('0xd'));var Papa=require(_0x349f('0xe'));var Redis=require('ioredis');var authService=require(_0x349f('0xf'));var qs=require(_0x349f('0x10'));var as=require(_0x349f('0x11'));var hardwareService=require(_0x349f('0x12'));var logger=require(_0x349f('0x13'))(_0x349f('0x14'));var utils=require(_0x349f('0x15'));var config=require(_0x349f('0x16'));var licenseUtil=require(_0x349f('0x17'));var db=require(_0x349f('0x18'))['db'];function respondWithStatusCode(_0x2004f2,_0x3b03e7){_0x3b03e7=_0x3b03e7||0xcc;return function(_0x1438f7){if(_0x1438f7){return _0x2004f2[_0x349f('0x19')](_0x3b03e7);}return _0x2004f2[_0x349f('0x1a')](_0x3b03e7)[_0x349f('0x1b')]();};}function respondWithResult(_0x152bef,_0x3e348a){_0x3e348a=_0x3e348a||0xc8;return function(_0x2ebb16){if(_0x2ebb16){return _0x152bef[_0x349f('0x1a')](_0x3e348a)[_0x349f('0x1c')](_0x2ebb16);}};}function respondWithFilteredResult(_0x539d7f,_0x2896f7){return function(_0x18860c){if(_0x18860c){var _0x51dd0e=typeof _0x2896f7[_0x349f('0x1d')]===_0x349f('0x1e')&&typeof _0x2896f7[_0x349f('0x1f')]===_0x349f('0x1e');var _0x34b5a9=_0x18860c[_0x349f('0x20')];var _0x3677db=_0x51dd0e?0x0:_0x2896f7['offset'];var _0x4b82c4=_0x51dd0e?_0x18860c['count']:_0x2896f7[_0x349f('0x1d')]+_0x2896f7[_0x349f('0x1f')];var _0x4ba17b;if(_0x4b82c4>=_0x34b5a9){_0x4b82c4=_0x34b5a9;_0x4ba17b=0xc8;}else{_0x4ba17b=0xce;}_0x539d7f[_0x349f('0x1a')](_0x4ba17b);return _0x539d7f[_0x349f('0x21')](_0x349f('0x22'),_0x3677db+'-'+_0x4b82c4+'/'+_0x34b5a9)[_0x349f('0x1c')](_0x18860c);}return null;};}function patchUpdates(_0xadebbc){return function(_0x275b1e){try{jsonpatch['apply'](_0x275b1e,_0xadebbc,!![]);}catch(_0x2689d5){return BPromise[_0x349f('0x23')](_0x2689d5);}return _0x275b1e['save']();};}function saveUpdates(_0x531b0b,_0x12d8f6){return function(_0x29fc0f){if(_0x29fc0f){return _0x29fc0f[_0x349f('0x24')](_0x531b0b)[_0x349f('0x25')](function(_0x193adc){return _0x193adc;});}return null;};}function removeEntity(_0x36b0f4,_0x14b6fe){return function(_0x1174d6){if(_0x1174d6){return _0x1174d6[_0x349f('0x26')]()[_0x349f('0x25')](function(){_0x36b0f4[_0x349f('0x1a')](0xcc)[_0x349f('0x1b')]();});}};}function handleEntityNotFound(_0x17074c,_0xa51138){return function(_0x2d677b){if(!_0x2d677b){_0x17074c[_0x349f('0x19')](0x194);}return _0x2d677b;};}function handleError(_0x1711fe,_0x3bb0ce){_0x3bb0ce=_0x3bb0ce||0x1f4;return function(_0x5099de){logger['error'](_0x5099de[_0x349f('0x27')]);if(_0x5099de['name']){delete _0x5099de[_0x349f('0x28')];}_0x1711fe[_0x349f('0x1a')](_0x3bb0ce)[_0x349f('0x29')](_0x5099de);};}exports[_0x349f('0x2a')]=function(_0x3725e4,_0x532bb9){var _0x2987b2={},_0x52e0cf={},_0x3cad73={'count':0x0,'rows':[]};var _0x1f03bc=_[_0x349f('0x2b')](db[_0x349f('0x2c')]['rawAttributes'],function(_0x1c8e1e){return{'name':_0x1c8e1e[_0x349f('0x2d')],'type':_0x1c8e1e[_0x349f('0x2e')]['key']};});_0x52e0cf['model']=_[_0x349f('0x2b')](_0x1f03bc,_0x349f('0x28'));_0x52e0cf[_0x349f('0x2f')]=_[_0x349f('0x30')](_0x3725e4[_0x349f('0x2f')]);_0x52e0cf['filters']=_[_0x349f('0x31')](_0x52e0cf[_0x349f('0x32')],_0x52e0cf[_0x349f('0x2f')]);_0x2987b2['attributes']=_[_0x349f('0x31')](_0x52e0cf[_0x349f('0x32')],qs[_0x349f('0x33')](_0x3725e4[_0x349f('0x2f')][_0x349f('0x33')]));_0x2987b2[_0x349f('0x34')]=_0x2987b2[_0x349f('0x34')]['length']?_0x2987b2[_0x349f('0x34')]:_0x52e0cf[_0x349f('0x32')];if(!_0x3725e4[_0x349f('0x2f')]['hasOwnProperty'](_0x349f('0x35'))){_0x2987b2[_0x349f('0x1f')]=qs[_0x349f('0x1f')](_0x3725e4[_0x349f('0x2f')][_0x349f('0x1f')]);_0x2987b2[_0x349f('0x1d')]=qs[_0x349f('0x1d')](_0x3725e4[_0x349f('0x2f')][_0x349f('0x1d')]);}_0x2987b2['order']=qs[_0x349f('0x36')](_0x3725e4[_0x349f('0x2f')]['sort']);_0x2987b2['where']=qs[_0x349f('0x37')](_[_0x349f('0x38')](_0x3725e4[_0x349f('0x2f')],_0x52e0cf[_0x349f('0x37')]),_0x1f03bc);if(_0x3725e4[_0x349f('0x2f')][_0x349f('0x39')]){_0x2987b2[_0x349f('0x3a')]=_['merge'](_0x2987b2[_0x349f('0x3a')],{'$or':_[_0x349f('0x2b')](_0x1f03bc,function(_0x2e5e9d){if(_0x2e5e9d[_0x349f('0x2e')]!==_0x349f('0x3b')){var _0x874afc={};_0x874afc[_0x2e5e9d[_0x349f('0x28')]]={'$like':'%'+_0x3725e4[_0x349f('0x2f')][_0x349f('0x39')]+'%'};return _0x874afc;}})});}_0x2987b2=_[_0x349f('0x3c')]({},_0x2987b2,_0x3725e4[_0x349f('0x3d')]);var _0x10444f={'where':_0x2987b2[_0x349f('0x3a')]};return db[_0x349f('0x2c')][_0x349f('0x20')](_0x10444f)['then'](function(_0x1b7e34){_0x3cad73[_0x349f('0x20')]=_0x1b7e34;if(_0x3725e4[_0x349f('0x2f')][_0x349f('0x3e')]){_0x2987b2['include']=[{'all':!![]}];}return db[_0x349f('0x2c')][_0x349f('0x3f')](_0x2987b2);})[_0x349f('0x25')](function(_0x454039){_0x3cad73[_0x349f('0x40')]=_0x454039;return _0x3cad73;})[_0x349f('0x25')](respondWithFilteredResult(_0x532bb9,_0x2987b2))[_0x349f('0x41')](handleError(_0x532bb9,null));};exports[_0x349f('0x42')]=function(_0xde09d4,_0x337f95){var _0x10658b={'raw':!![],'where':{'id':_0xde09d4[_0x349f('0x43')]['id']}},_0x11c30c={};_0x11c30c[_0x349f('0x32')]=_[_0x349f('0x30')](db[_0x349f('0x2c')][_0x349f('0x44')]);_0x11c30c[_0x349f('0x2f')]=_[_0x349f('0x30')](_0xde09d4['query']);_0x11c30c['filters']=_[_0x349f('0x31')](_0x11c30c[_0x349f('0x32')],_0x11c30c['query']);_0x10658b[_0x349f('0x34')]=_['intersection'](_0x11c30c[_0x349f('0x32')],qs[_0x349f('0x33')](_0xde09d4[_0x349f('0x2f')][_0x349f('0x33')]));_0x10658b[_0x349f('0x34')]=_0x10658b[_0x349f('0x34')]['length']?_0x10658b[_0x349f('0x34')]:_0x11c30c[_0x349f('0x32')];if(_0xde09d4[_0x349f('0x2f')][_0x349f('0x3e')]){_0x10658b[_0x349f('0x45')]=[{'all':!![]}];}_0x10658b=_[_0x349f('0x3c')]({},_0x10658b,_0xde09d4[_0x349f('0x3d')]);return db['CmHopperBlack'][_0x349f('0x46')](_0x10658b)[_0x349f('0x25')](handleEntityNotFound(_0x337f95,null))[_0x349f('0x25')](respondWithResult(_0x337f95,null))[_0x349f('0x41')](handleError(_0x337f95,null));};exports[_0x349f('0x24')]=function(_0xde9a16,_0x26877a){if(_0xde9a16['body']['id']){delete _0xde9a16[_0x349f('0x47')]['id'];}return db[_0x349f('0x2c')]['find']({'where':{'id':_0xde9a16[_0x349f('0x43')]['id']}})[_0x349f('0x25')](handleEntityNotFound(_0x26877a,null))[_0x349f('0x25')](saveUpdates(_0xde9a16['body'],null))[_0x349f('0x25')](respondWithResult(_0x26877a,null))['catch'](handleError(_0x26877a,null));};exports['destroy']=function(_0x5214d5,_0x2b402a){return db['CmHopperBlack'][_0x349f('0x46')]({'where':{'id':_0x5214d5['params']['id']}})[_0x349f('0x25')](handleEntityNotFound(_0x2b402a,null))['then'](removeEntity(_0x2b402a,null))[_0x349f('0x41')](handleError(_0x2b402a,null));};exports[_0x349f('0x48')]=function(_0x5807ae,_0x1631b7){return db[_0x349f('0x2c')][_0x349f('0x48')]()[_0x349f('0x25')](respondWithResult(_0x1631b7,null))[_0x349f('0x41')](handleError(_0x1631b7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index cce12d6..c60d724 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 _0x6386=['request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','cm_hopper_black','../../config/logger','api','moment','bluebird'];(function(_0xaad24a,_0x1c7172){var _0x32df5b=function(_0x9550ac){while(--_0x9550ac){_0xaad24a['push'](_0xaad24a['shift']());}};_0x32df5b(++_0x1c7172);}(_0x6386,0xe6));var _0x6638=function(_0x4a8fe8,_0x1ed02f){_0x4a8fe8=_0x4a8fe8-0x0;var _0x60422a=_0x6386[_0x4a8fe8];return _0x60422a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6638('0x0'))(_0x6638('0x1'));var moment=require(_0x6638('0x2'));var BPromise=require(_0x6638('0x3'));var rp=require(_0x6638('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6638('0x5'));var config=require(_0x6638('0x6'));var attributes=require(_0x6638('0x7'));module['exports']=function(_0x884bf,_0x9e8ef3){return _0x884bf['define']('CmHopperBlack',attributes,{'tableName':_0x6638('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a83=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a83,0x79));var _0x33a8=function(_0x1e87e9,_0x123c82){_0x1e87e9=_0x1e87e9-0x0;var _0x41c65e=_0x3a83[_0x1e87e9];return _0x41c65e;};'use strict';var _=require(_0x33a8('0x0'));var util=require(_0x33a8('0x1'));var logger=require(_0x33a8('0x2'))('api');var moment=require(_0x33a8('0x3'));var BPromise=require(_0x33a8('0x4'));var rp=require(_0x33a8('0x5'));var fs=require('fs');var path=require(_0x33a8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x33a8('0x7'));module[_0x33a8('0x8')]=function(_0x3d41c6,_0x210020){return _0x3d41c6['define'](_0x33a8('0x9'),attributes,{'tableName':_0x33a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 4403252..75666e0 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 _0x7db9=['where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','body','raw','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options'];(function(_0x3b70ca,_0x526f11){var _0x10361f=function(_0x5b72c4){while(--_0x5b72c4){_0x3b70ca['push'](_0x3b70ca['shift']());}};_0x10361f(++_0x526f11);}(_0x7db9,0x14c));var _0x97db=function(_0x51e041,_0x34e725){_0x51e041=_0x51e041-0x0;var _0x139f2e=_0x7db9[_0x51e041];return _0x139f2e;};'use strict';var _=require(_0x97db('0x0'));var util=require(_0x97db('0x1'));var moment=require(_0x97db('0x2'));var BPromise=require(_0x97db('0x3'));var rs=require(_0x97db('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97db('0x5'))['db'];var utils=require(_0x97db('0x6'));var logger=require(_0x97db('0x7'))('rpc');var config=require(_0x97db('0x8'));var jayson=require(_0x97db('0x9'));var client=jayson[_0x97db('0xa')][_0x97db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x247dc6,_0x189871,_0x599978){return new BPromise(function(_0x1ff059,_0x37d727){return client['request'](_0x247dc6,_0x599978)[_0x97db('0xc')](function(_0xc0e124){logger[_0x97db('0xd')](_0x97db('0xe'),_0x189871,'request\x20sent');logger[_0x97db('0xf')](_0x97db('0x10'),_0x189871,_0x97db('0x11'),JSON[_0x97db('0x12')](_0xc0e124));if(_0xc0e124[_0x97db('0x13')]){if(_0xc0e124[_0x97db('0x13')][_0x97db('0x14')]===0x1f4){logger[_0x97db('0x13')](_0x97db('0xe'),_0x189871,_0xc0e124[_0x97db('0x13')][_0x97db('0x15')]);return _0x37d727(_0xc0e124[_0x97db('0x13')][_0x97db('0x15')]);}logger[_0x97db('0x13')](_0x97db('0xe'),_0x189871,_0xc0e124['error']['message']);return _0x1ff059(_0xc0e124['error'][_0x97db('0x15')]);}else{logger['info'](_0x97db('0xe'),_0x189871,'request\x20sent');_0x1ff059(_0xc0e124[_0x97db('0x16')][_0x97db('0x15')]);}})[_0x97db('0x17')](function(_0x2ced99){logger[_0x97db('0x13')](_0x97db('0xe'),_0x189871,_0x2ced99);_0x37d727(_0x2ced99);});});}exports[_0x97db('0x18')]=function(_0xdf118b){var _0xa4f895=this;return new Promise(function(_0x294a81,_0x566d1f){return db[_0x97db('0x19')][_0x97db('0x1a')]({'raw':_0xdf118b[_0x97db('0x1b')]?_0xdf118b[_0x97db('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xdf118b[_0x97db('0x1b')]?_0xdf118b[_0x97db('0x1b')][_0x97db('0x1c')]||null:null,'attributes':_0xdf118b[_0x97db('0x1b')]?_0xdf118b[_0x97db('0x1b')][_0x97db('0x1d')]||null:null,'limit':_0xdf118b[_0x97db('0x1b')]?_0xdf118b[_0x97db('0x1b')][_0x97db('0x1e')]||null:null,'include':_0xdf118b['options']?_0xdf118b['options'][_0x97db('0x1f')]?_[_0x97db('0x20')](_0xdf118b[_0x97db('0x1b')]['include'],function(_0x25286f){return{'model':db[_0x25286f[_0x97db('0x21')]],'as':_0x25286f['as'],'attributes':_0x25286f['attributes'],'include':_0x25286f[_0x97db('0x1f')]?_[_0x97db('0x20')](_0x25286f[_0x97db('0x1f')],function(_0x59854f){return{'model':db[_0x59854f['model']],'as':_0x59854f['as'],'attributes':_0x59854f[_0x97db('0x1d')],'include':_0x59854f[_0x97db('0x1f')]?_[_0x97db('0x20')](_0x59854f[_0x97db('0x1f')],function(_0x3345d1){return{'model':db[_0x3345d1['model']],'as':_0x3345d1['as'],'attributes':_0x3345d1[_0x97db('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x97db('0xc')](function(_0x78ea7b){logger['info'](_0x97db('0x18'),_0xdf118b);logger['debug'](_0x97db('0x18'),_0xdf118b,JSON[_0x97db('0x12')](_0x78ea7b));_0x294a81(_0x78ea7b);})['catch'](function(_0x42bf3c){logger[_0x97db('0x13')](_0x97db('0x18'),_0x42bf3c[_0x97db('0x15')],_0xdf118b);_0x566d1f(_0xa4f895[_0x97db('0x13')](0x1f4,_0x42bf3c['message']));});});};exports[_0x97db('0x22')]=function(_0x413004){var _0x2cc89f=this;return new Promise(function(_0x40053c,_0x5ba78){return db[_0x97db('0x19')][_0x97db('0x23')](_0x413004[_0x97db('0x24')],{'raw':_0x413004['options']?_0x413004[_0x97db('0x1b')][_0x97db('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x413004[_0x97db('0x1b')]?_0x413004[_0x97db('0x1b')][_0x97db('0x1c')]||null:null,'attributes':_0x413004[_0x97db('0x1b')]?_0x413004[_0x97db('0x1b')]['attributes']||null:null,'limit':_0x413004['options']?_0x413004[_0x97db('0x1b')][_0x97db('0x1e')]||null:null})[_0x97db('0xc')](function(_0x40bcea){logger[_0x97db('0xd')](_0x97db('0x22'),_0x413004);logger[_0x97db('0xf')](_0x97db('0x22'),_0x413004,JSON[_0x97db('0x12')](_0x40bcea));_0x40053c(_0x40bcea);})[_0x97db('0x17')](function(_0x14b8f6){logger[_0x97db('0x13')](_0x97db('0x22'),_0x14b8f6[_0x97db('0x15')],_0x413004);_0x5ba78(_0x2cc89f[_0x97db('0x13')](0x1f4,_0x14b8f6[_0x97db('0x15')]));});});};exports[_0x97db('0x26')]=function(_0x2ba0df){var _0x39f8c7=this;return new Promise(function(_0x5810f1,_0x14a8fa){return db['CmHopperBlack'][_0x97db('0x27')]({'where':_0x2ba0df[_0x97db('0x1b')]?_0x2ba0df[_0x97db('0x1b')][_0x97db('0x1c')]||null:null})['then'](function(_0x5af3fb){logger[_0x97db('0xd')](_0x97db('0x26'),_0x2ba0df);logger[_0x97db('0xf')]('DestroyCmHopperBlack',_0x2ba0df,JSON[_0x97db('0x12')](_0x5af3fb));_0x5810f1(_0x5af3fb);})[_0x97db('0x17')](function(_0x2e7f77){logger[_0x97db('0x13')](_0x97db('0x26'),_0x2e7f77['message'],_0x2ba0df);_0x14a8fa(_0x39f8c7[_0x97db('0x13')](0x1f4,_0x2e7f77['message']));});});}; \ No newline at end of file +var _0x2163=['map','model','UpdateCmHopperBlack','CmHopperBlack','update','body','destroy','DestroyCmHopperBlack','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopperBlack','options','raw','where','attributes','limit','include'];(function(_0x535e0c,_0x5cfafc){var _0x518585=function(_0x5f1738){while(--_0x5f1738){_0x535e0c['push'](_0x535e0c['shift']());}};_0x518585(++_0x5cfafc);}(_0x2163,0x15e));var _0x3216=function(_0x3a1210,_0x431f1f){_0x3a1210=_0x3a1210-0x0;var _0x18f20f=_0x2163[_0x3a1210];return _0x18f20f;};'use strict';var _=require(_0x3216('0x0'));var util=require(_0x3216('0x1'));var moment=require(_0x3216('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3216('0x3'));var db=require(_0x3216('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3216('0x5'))(_0x3216('0x6'));var config=require(_0x3216('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3216('0x8')][_0x3216('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e34fe,_0x3ffb99,_0x3b892a){return new BPromise(function(_0x534778,_0x305e59){return client[_0x3216('0xa')](_0x4e34fe,_0x3b892a)[_0x3216('0xb')](function(_0x2f457e){logger['info'](_0x3216('0xc'),_0x3ffb99,_0x3216('0xd'));logger[_0x3216('0xe')](_0x3216('0xf'),_0x3ffb99,_0x3216('0xd'),JSON[_0x3216('0x10')](_0x2f457e));if(_0x2f457e[_0x3216('0x11')]){if(_0x2f457e[_0x3216('0x11')][_0x3216('0x12')]===0x1f4){logger['error'](_0x3216('0xc'),_0x3ffb99,_0x2f457e[_0x3216('0x11')][_0x3216('0x13')]);return _0x305e59(_0x2f457e['error'][_0x3216('0x13')]);}logger[_0x3216('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x3ffb99,_0x2f457e[_0x3216('0x11')][_0x3216('0x13')]);return _0x534778(_0x2f457e['error'][_0x3216('0x13')]);}else{logger[_0x3216('0x14')](_0x3216('0xc'),_0x3ffb99,_0x3216('0xd'));_0x534778(_0x2f457e[_0x3216('0x15')][_0x3216('0x13')]);}})[_0x3216('0x16')](function(_0x1bcfa2){logger[_0x3216('0x11')](_0x3216('0xc'),_0x3ffb99,_0x1bcfa2);_0x305e59(_0x1bcfa2);});});}exports[_0x3216('0x17')]=function(_0x406a95){var _0x4f4dca=this;return new Promise(function(_0x17f83b,_0x3ef567){return db['CmHopperBlack']['findAll']({'raw':_0x406a95[_0x3216('0x18')]?_0x406a95[_0x3216('0x18')][_0x3216('0x19')]===undefined?!![]:![]:!![],'where':_0x406a95[_0x3216('0x18')]?_0x406a95[_0x3216('0x18')][_0x3216('0x1a')]||null:null,'attributes':_0x406a95[_0x3216('0x18')]?_0x406a95[_0x3216('0x18')][_0x3216('0x1b')]||null:null,'limit':_0x406a95[_0x3216('0x18')]?_0x406a95[_0x3216('0x18')][_0x3216('0x1c')]||null:null,'include':_0x406a95[_0x3216('0x18')]?_0x406a95[_0x3216('0x18')][_0x3216('0x1d')]?_[_0x3216('0x1e')](_0x406a95[_0x3216('0x18')][_0x3216('0x1d')],function(_0x26f341){return{'model':db[_0x26f341[_0x3216('0x1f')]],'as':_0x26f341['as'],'attributes':_0x26f341['attributes'],'include':_0x26f341[_0x3216('0x1d')]?_[_0x3216('0x1e')](_0x26f341['include'],function(_0xa1e53f){return{'model':db[_0xa1e53f[_0x3216('0x1f')]],'as':_0xa1e53f['as'],'attributes':_0xa1e53f[_0x3216('0x1b')],'include':_0xa1e53f[_0x3216('0x1d')]?_[_0x3216('0x1e')](_0xa1e53f[_0x3216('0x1d')],function(_0x8c10fb){return{'model':db[_0x8c10fb[_0x3216('0x1f')]],'as':_0x8c10fb['as'],'attributes':_0x8c10fb[_0x3216('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3216('0xb')](function(_0x2b4f55){logger[_0x3216('0x14')](_0x3216('0x17'),_0x406a95);logger[_0x3216('0xe')](_0x3216('0x17'),_0x406a95,JSON[_0x3216('0x10')](_0x2b4f55));_0x17f83b(_0x2b4f55);})[_0x3216('0x16')](function(_0x484d86){logger['error'](_0x3216('0x17'),_0x484d86[_0x3216('0x13')],_0x406a95);_0x3ef567(_0x4f4dca[_0x3216('0x11')](0x1f4,_0x484d86[_0x3216('0x13')]));});});};exports[_0x3216('0x20')]=function(_0x4ab4e9){var _0x487509=this;return new Promise(function(_0x120ce4,_0xab0525){return db[_0x3216('0x21')][_0x3216('0x22')](_0x4ab4e9[_0x3216('0x23')],{'raw':_0x4ab4e9['options']?_0x4ab4e9[_0x3216('0x18')][_0x3216('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ab4e9[_0x3216('0x18')]?_0x4ab4e9[_0x3216('0x18')][_0x3216('0x1a')]||null:null,'attributes':_0x4ab4e9['options']?_0x4ab4e9[_0x3216('0x18')][_0x3216('0x1b')]||null:null,'limit':_0x4ab4e9['options']?_0x4ab4e9[_0x3216('0x18')][_0x3216('0x1c')]||null:null})[_0x3216('0xb')](function(_0xca3027){logger[_0x3216('0x14')]('UpdateCmHopperBlack',_0x4ab4e9);logger[_0x3216('0xe')]('UpdateCmHopperBlack',_0x4ab4e9,JSON['stringify'](_0xca3027));_0x120ce4(_0xca3027);})['catch'](function(_0x3171b0){logger[_0x3216('0x11')](_0x3216('0x20'),_0x3171b0['message'],_0x4ab4e9);_0xab0525(_0x487509['error'](0x1f4,_0x3171b0[_0x3216('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x28fdc6){var _0x24202b=this;return new Promise(function(_0x142387,_0x35de93){return db[_0x3216('0x21')][_0x3216('0x24')]({'where':_0x28fdc6[_0x3216('0x18')]?_0x28fdc6[_0x3216('0x18')][_0x3216('0x1a')]||null:null})['then'](function(_0x43ba69){logger[_0x3216('0x14')]('DestroyCmHopperBlack',_0x28fdc6);logger[_0x3216('0xe')]('DestroyCmHopperBlack',_0x28fdc6,JSON[_0x3216('0x10')](_0x43ba69));_0x142387(_0x43ba69);})[_0x3216('0x16')](function(_0x455b3c){logger['error'](_0x3216('0x25'),_0x455b3c[_0x3216('0x13')],_0x28fdc6);_0x35de93(_0x24202b[_0x3216('0x11')](0x1f4,_0x455b3c[_0x3216('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 71e7fd6..1671751 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 _0xc1c6=['../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x142db6,_0x5a1395){var _0x256363=function(_0x530ac4){while(--_0x530ac4){_0x142db6['push'](_0x142db6['shift']());}};_0x256363(++_0x5a1395);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4a588e,_0x4ba6e3){_0x4a588e=_0x4a588e-0x0;var _0x5f2d02=_0xc1c6[_0x4a588e];return _0x5f2d02;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var fs_extra=require(_0x6c1c('0x4'));var auth=require(_0x6c1c('0x5'));var interaction=require(_0x6c1c('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x6c1c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x8')]);router['get'](_0x6c1c('0x9'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x7')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xc')]);router['put'](_0x6c1c('0xd'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xe')]);router[_0x6c1c('0xf')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x10')]);module[_0x6c1c('0x11')]=router; \ No newline at end of file +var _0x187d=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy','exports'];(function(_0x4ab81b,_0x2455f6){var _0x2bd405=function(_0x48c764){while(--_0x48c764){_0x4ab81b['push'](_0x4ab81b['shift']());}};_0x2bd405(++_0x2455f6);}(_0x187d,0x93));var _0xd187=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x187d[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xe'),auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')]('/:id',auth[_0xd187('0x9')](),controller[_0xd187('0x13')]);module[_0xd187('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 8055b1a..655271a 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 _0xd5ce=['endtime','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','STRING','INTEGER','DATE'];(function(_0x341f8c,_0x3822ae){var _0x35e09c=function(_0x53bc9a){while(--_0x53bc9a){_0x341f8c['push'](_0x341f8c['shift']());}};_0x35e09c(++_0x3822ae);}(_0xd5ce,0x1a7));var _0xed5c=function(_0x595a3c,_0x45d7d3){_0x595a3c=_0x595a3c-0x0;var _0x2552f1=_0xd5ce[_0x595a3c];return _0x2552f1;};'use strict';var Sequelize=require(_0xed5c('0x0'));var moment=require(_0xed5c('0x1'));module[_0xed5c('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xed5c('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xed5c('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xed5c('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xed5c('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xed5c('0x3')]},'originatecalleridname':{'type':Sequelize[_0xed5c('0x3')]},'calleridnum':{'type':Sequelize[_0xed5c('0x3')]},'calleridname':{'type':Sequelize[_0xed5c('0x3')]},'starttime':{'type':Sequelize[_0xed5c('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xed5c('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xed5c('0x5')]},'ringtime':{'type':Sequelize[_0xed5c('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xed5c('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xed5c('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xed5c('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xed5c('0x3')]},'membername':{'type':Sequelize[_0xed5c('0x3')]},'reason':{'type':Sequelize[_0xed5c('0x3')]},'disposition':{'type':Sequelize[_0xed5c('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4cd1fc){var _0x1b1d48=this['getDataValue'](_0xed5c('0x6'));if(_0x1b1d48&&_0x4cd1fc){this['setDataValue'](_0xed5c('0x7'),moment(_0x4cd1fc)[_0xed5c('0x8')](moment(_0x1b1d48),_0xed5c('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xed5c('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xed5c('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xed5c('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xed5c('0x5')]},'callback':{'type':Sequelize[_0xed5c('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xed5c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xed5c('0x5')]},'deleted':{'type':Sequelize[_0xed5c('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xed5c('0x5')]},'recallme':{'type':Sequelize[_0xed5c('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xed5c('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xed5c('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xed5c('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xed5c('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xed5c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4a6a=['BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime','seconds'];(function(_0x1fb5ff,_0x483362){var _0x89725b=function(_0x5ec4d9){while(--_0x5ec4d9){_0x1fb5ff['push'](_0x1fb5ff['shift']());}};_0x89725b(++_0x483362);}(_0x4a6a,0x182));var _0xa4a6=function(_0x35d87f,_0x2eb5dc){_0x35d87f=_0x35d87f-0x0;var _0x472257=_0x4a6a[_0x35d87f];return _0x472257;};'use strict';var Sequelize=require(_0xa4a6('0x0'));var moment=require(_0xa4a6('0x1'));module[_0xa4a6('0x2')]={'state':{'type':Sequelize[_0xa4a6('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xa4a6('0x4')]},'scheduledat':{'type':Sequelize[_0xa4a6('0x5')]},'countbusyretry':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa4a6('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xa4a6('0x4')]},'originatecalleridname':{'type':Sequelize[_0xa4a6('0x4')]},'calleridnum':{'type':Sequelize[_0xa4a6('0x4')]},'calleridname':{'type':Sequelize[_0xa4a6('0x4')]},'starttime':{'type':Sequelize[_0xa4a6('0x5')]},'responsetime':{'type':Sequelize[_0xa4a6('0x5')]},'answertime':{'type':Sequelize[_0xa4a6('0x5')]},'droptime':{'type':Sequelize[_0xa4a6('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xa4a6('0x4')]},'campaigntype':{'type':Sequelize[_0xa4a6('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xa4a6('0x4')]},'disposition':{'type':Sequelize[_0xa4a6('0x4')]},'secondDisposition':{'type':Sequelize[_0xa4a6('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa4a6('0x4')]},'dispositionat':{'type':Sequelize[_0xa4a6('0x5')],'set':function(_0x1498ca){var _0x8b01fc=this[_0xa4a6('0x6')]('endtime');if(_0x8b01fc&&_0x1498ca){this[_0xa4a6('0x7')](_0xa4a6('0x8'),moment(_0x1498ca)['diff'](moment(_0x8b01fc),_0xa4a6('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xa4a6('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xa4a6('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xa4a6('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xa4a6('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa4a6('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa4a6('0x5')]},'deleted':{'type':Sequelize[_0xa4a6('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xa4a6('0x5')]},'recallme':{'type':Sequelize[_0xa4a6('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xa4a6('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa4a6('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 8c75014..5c997b2 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 _0xeda8=['calleridnum','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','includeAll','include','rows','catch','show','params','keys','options','find','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','select'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0xeda8,0x104));var _0x8eda=function(_0x98e4ef,_0x385da6){_0x98e4ef=_0x98e4ef-0x0;var _0x1ca8e7=_0xeda8[_0x98e4ef];return _0x1ca8e7;};'use strict';var emlformat=require(_0x8eda('0x0'));var rimraf=require(_0x8eda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eda('0x2'));var rp=require(_0x8eda('0x3'));var moment=require(_0x8eda('0x4'));var BPromise=require(_0x8eda('0x5'));var Mustache=require(_0x8eda('0x6'));var util=require(_0x8eda('0x7'));var path=require(_0x8eda('0x8'));var sox=require(_0x8eda('0x9'));var csv=require(_0x8eda('0xa'));var ejs=require(_0x8eda('0xb'));var fs=require('fs');var fs_extra=require(_0x8eda('0xc'));var _=require(_0x8eda('0xd'));var squel=require('squel');var crypto=require(_0x8eda('0xe'));var jsforce=require(_0x8eda('0xf'));var deskjs=require(_0x8eda('0x10'));var toCsv=require(_0x8eda('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8eda('0x11'));var as=require(_0x8eda('0x12'));var hardwareService=require(_0x8eda('0x13'));var logger=require('../../config/logger')(_0x8eda('0x14'));var utils=require('../../config/utils');var config=require(_0x8eda('0x15'));var licenseUtil=require(_0x8eda('0x16'));var db=require(_0x8eda('0x17'))['db'];function respondWithStatusCode(_0x1ad3df,_0x337573){_0x337573=_0x337573||0xcc;return function(_0x3af00c){if(_0x3af00c){return _0x1ad3df[_0x8eda('0x18')](_0x337573);}return _0x1ad3df[_0x8eda('0x19')](_0x337573)['end']();};}function respondWithResult(_0x500bd4,_0xe04d90){_0xe04d90=_0xe04d90||0xc8;return function(_0x223dcf){if(_0x223dcf){return _0x500bd4['status'](_0xe04d90)[_0x8eda('0x1a')](_0x223dcf);}};}function respondWithFilteredResult(_0x34b1ee,_0x123905){return function(_0x56ff8a){if(_0x56ff8a){var _0x3f2925=typeof _0x123905['offset']===_0x8eda('0x1b')&&typeof _0x123905['limit']===_0x8eda('0x1b');var _0x58023b=_0x56ff8a[_0x8eda('0x1c')];var _0x2a4d2b=_0x3f2925?0x0:_0x123905['offset'];var _0x5e44b7=_0x3f2925?_0x56ff8a[_0x8eda('0x1c')]:_0x123905[_0x8eda('0x1d')]+_0x123905[_0x8eda('0x1e')];var _0x41abfa;if(_0x5e44b7>=_0x58023b){_0x5e44b7=_0x58023b;_0x41abfa=0xc8;}else{_0x41abfa=0xce;}_0x34b1ee[_0x8eda('0x19')](_0x41abfa);return _0x34b1ee[_0x8eda('0x1f')](_0x8eda('0x20'),_0x2a4d2b+'-'+_0x5e44b7+'/'+_0x58023b)[_0x8eda('0x1a')](_0x56ff8a);}return null;};}function patchUpdates(_0x850cce){return function(_0x232786){try{jsonpatch[_0x8eda('0x21')](_0x232786,_0x850cce,!![]);}catch(_0x57f336){return BPromise[_0x8eda('0x22')](_0x57f336);}return _0x232786['save']();};}function saveUpdates(_0x45517e,_0x5183bc){return function(_0x1033d6){if(_0x1033d6){return _0x1033d6[_0x8eda('0x23')](_0x45517e)['then'](function(_0x58e54b){return _0x58e54b;});}return null;};}function removeEntity(_0x56dba4,_0x2a4c99){return function(_0x17cae8){if(_0x17cae8){return _0x17cae8['destroy']()[_0x8eda('0x24')](function(){_0x56dba4[_0x8eda('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25e955,_0xfa57ca){return function(_0x24b1e1){if(!_0x24b1e1){_0x25e955[_0x8eda('0x18')](0x194);}return _0x24b1e1;};}function handleError(_0x2e42e4,_0x5c8488){_0x5c8488=_0x5c8488||0x1f4;return function(_0x41b5a9){logger['error'](_0x41b5a9[_0x8eda('0x25')]);if(_0x41b5a9[_0x8eda('0x26')]){delete _0x41b5a9[_0x8eda('0x26')];}_0x2e42e4['status'](_0x5c8488)[_0x8eda('0x27')](_0x41b5a9);};}exports[_0x8eda('0x28')]=function(_0x1dd12,_0x4cdd2e){var _0x1616ea={},_0x11a999={},_0x5dd315={'count':0x0,'rows':[]};var _0x27d2ce=_[_0x8eda('0x29')](db[_0x8eda('0x2a')][_0x8eda('0x2b')],function(_0x53274e){return{'name':_0x53274e['fieldName'],'type':_0x53274e['type'][_0x8eda('0x2c')]};});_0x11a999[_0x8eda('0x2d')]=_[_0x8eda('0x29')](_0x27d2ce,'name');_0x11a999['query']=_['keys'](_0x1dd12[_0x8eda('0x2e')]);_0x11a999[_0x8eda('0x2f')]=_[_0x8eda('0x30')](_0x11a999['model'],_0x11a999['query']);_0x1616ea['attributes']=_[_0x8eda('0x30')](_0x11a999[_0x8eda('0x2d')],qs[_0x8eda('0x31')](_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x31')]));_0x1616ea[_0x8eda('0x32')]=_0x1616ea[_0x8eda('0x32')][_0x8eda('0x33')]?_0x1616ea[_0x8eda('0x32')]:_0x11a999[_0x8eda('0x2d')];if(!_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x34')](_0x8eda('0x35'))){_0x1616ea[_0x8eda('0x1e')]=qs['limit'](_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x1e')]);_0x1616ea[_0x8eda('0x1d')]=qs['offset'](_0x1dd12['query'][_0x8eda('0x1d')]);}_0x1616ea[_0x8eda('0x36')]=qs[_0x8eda('0x37')](_0x1dd12[_0x8eda('0x2e')]['sort']);_0x1616ea[_0x8eda('0x38')]=qs[_0x8eda('0x2f')](_[_0x8eda('0x39')](_0x1dd12[_0x8eda('0x2e')],_0x11a999[_0x8eda('0x2f')]),_0x27d2ce);if(_0x1dd12[_0x8eda('0x2e')]['filter']){_0x1616ea[_0x8eda('0x38')]=_[_0x8eda('0x3a')](_0x1616ea[_0x8eda('0x38')],{'$or':_[_0x8eda('0x29')](_0x27d2ce,function(_0x261e12){if(_0x261e12[_0x8eda('0x3b')]!=='VIRTUAL'){var _0x1067eb={};_0x1067eb[_0x261e12[_0x8eda('0x26')]]={'$like':'%'+_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x3c')]+'%'};return _0x1067eb;}})});}_0x1616ea=_[_0x8eda('0x3a')]({},_0x1616ea,_0x1dd12['options']);var _0x17ee80={'where':_0x1616ea[_0x8eda('0x38')]};return db[_0x8eda('0x2a')]['count'](_0x17ee80)[_0x8eda('0x24')](function(_0x5d361e){_0x5dd315[_0x8eda('0x1c')]=_0x5d361e;if(_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x3d')]){_0x1616ea[_0x8eda('0x3e')]=[{'all':!![]}];}return db[_0x8eda('0x2a')]['findAll'](_0x1616ea);})['then'](function(_0xbf14a1){_0x5dd315[_0x8eda('0x3f')]=_0xbf14a1;return _0x5dd315;})[_0x8eda('0x24')](respondWithFilteredResult(_0x4cdd2e,_0x1616ea))[_0x8eda('0x40')](handleError(_0x4cdd2e,null));};exports[_0x8eda('0x41')]=function(_0x13b3bc,_0x18b043){var _0xcb6164={'raw':!![],'where':{'id':_0x13b3bc[_0x8eda('0x42')]['id']}},_0x184590={};_0x184590[_0x8eda('0x2d')]=_[_0x8eda('0x43')](db[_0x8eda('0x2a')][_0x8eda('0x2b')]);_0x184590[_0x8eda('0x2e')]=_[_0x8eda('0x43')](_0x13b3bc[_0x8eda('0x2e')]);_0x184590[_0x8eda('0x2f')]=_[_0x8eda('0x30')](_0x184590['model'],_0x184590[_0x8eda('0x2e')]);_0xcb6164[_0x8eda('0x32')]=_['intersection'](_0x184590[_0x8eda('0x2d')],qs[_0x8eda('0x31')](_0x13b3bc['query'][_0x8eda('0x31')]));_0xcb6164[_0x8eda('0x32')]=_0xcb6164['attributes'][_0x8eda('0x33')]?_0xcb6164[_0x8eda('0x32')]:_0x184590[_0x8eda('0x2d')];if(_0x13b3bc['query'][_0x8eda('0x3d')]){_0xcb6164[_0x8eda('0x3e')]=[{'all':!![]}];}_0xcb6164=_[_0x8eda('0x3a')]({},_0xcb6164,_0x13b3bc[_0x8eda('0x44')]);return db[_0x8eda('0x2a')][_0x8eda('0x45')](_0xcb6164)[_0x8eda('0x24')](handleEntityNotFound(_0x18b043,null))['then'](respondWithResult(_0x18b043,null))[_0x8eda('0x40')](handleError(_0x18b043,null));};exports['describe']=function(_0xcde3e,_0x52b026){return db[_0x8eda('0x2a')]['describe']()[_0x8eda('0x24')](respondWithResult(_0x52b026,null))['catch'](handleError(_0x52b026,null));};exports[_0x8eda('0x23')]=function(_0x3aca19,_0xf445){if(_0x3aca19[_0x8eda('0x46')][_0x8eda('0x47')]){delete _0x3aca19[_0x8eda('0x46')][_0x8eda('0x47')];}return db[_0x8eda('0x2a')][_0x8eda('0x45')]({'where':{'uniqueid':_0x3aca19[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0xf445,null))[_0x8eda('0x24')](saveUpdates(_0x3aca19['body'],null))[_0x8eda('0x24')](respondWithResult(_0xf445,null))[_0x8eda('0x40')](handleError(_0xf445,null));};exports[_0x8eda('0x48')]=function(_0x3259de,_0x33ba39,_0x389399){return db[_0x8eda('0x2a')][_0x8eda('0x49')]({'raw':![],'where':{'VoiceQueueId':_0x3259de[_0x8eda('0x42')]['id']},'attributes':[[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4d')))),'noSuchContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4e')))),'noAnswerContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),_0x8eda('0x4f')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db['sequelize']['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x50')))),'congestionContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x51')))),_0x8eda('0x52')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')](_0x8eda('0x53')))),'abandonedContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x8eda('0x54')],[db['sequelize']['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x55')))),_0x8eda('0x56')]]})[_0x8eda('0x24')](handleEntityNotFound(_0x33ba39,null))['then'](respondWithResult(_0x33ba39,null))[_0x8eda('0x40')](handleError(_0x33ba39,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xdd71ce,_0x4ba827,_0xfb98bf){return db['CmHopperFinal'][_0x8eda('0x49')]({'raw':![],'where':{'CampaignId':_0xdd71ce[_0x8eda('0x42')]['id']},'attributes':[[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x8eda('0x4c')](_0x8eda('0x4d')))),'noSuchContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4e')))),_0x8eda('0x57')],[db['sequelize']['fn']('COUNT',db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x58')))),'busyContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x8eda('0x59')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x51')))),_0x8eda('0x52')],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eda('0x4a')]['literal'](_0x8eda('0x53')))),_0x8eda('0x5a')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x8eda('0x5b')))),_0x8eda('0x54')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0x8eda('0x56')]]})[_0x8eda('0x24')](handleEntityNotFound(_0x4ba827,null))['then'](respondWithResult(_0x4ba827,null))[_0x8eda('0x40')](handleError(_0x4ba827,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x47f57c,_0x49d1a1,_0x5e66cd){return db[_0x8eda('0x5c')][_0x8eda('0x45')]({'where':{'id':_0x47f57c[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0x49d1a1,null))[_0x8eda('0x24')](function(_0xe5d324){var _0x589c2f;if(_0xe5d324){_0x589c2f=squel[_0x8eda('0x5d')]()[_0x8eda('0x5e')](_0x8eda('0x5f'))[_0x8eda('0x60')](['phone',_0x8eda('0x61'),_0x8eda('0x62'),_0x8eda('0x63'),_0x8eda('0x64'),_0x8eda('0x65'),_0x8eda('0x66')],squel['select']()[_0x8eda('0x67')](_0x8eda('0x68'),_0x8eda('0x69'))[_0x8eda('0x67')](_0x8eda('0x6a'),_0x8eda('0x61'))[_0x8eda('0x67')](_0x8eda('0x6b'),_0x8eda('0x62'))[_0x8eda('0x67')](_0x8eda('0x6c'),_0x8eda('0x63'))[_0x8eda('0x67')](_0x8eda('0x6d'),'VoiceQueueId')['field'](_0x8eda('0x6a'),_0x8eda('0x65'))[_0x8eda('0x67')](_0x8eda('0x6a'),'updatedAt')[_0x8eda('0x6e')](_0x8eda('0x6f'))['where'](_0x8eda('0x70'),_0x47f57c['params']['id'][_0x8eda('0x71')]())[_0x8eda('0x38')](_0x8eda('0x72'),_0x47f57c['body'][_0x8eda('0x73')][_0x8eda('0x71')]())[_0x8eda('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()[_0x8eda('0x67')]('phone')['from'](_0x8eda('0x5f'))[_0x8eda('0x38')](_0x8eda('0x70'),_0x47f57c[_0x8eda('0x42')]['id']['toString']()))[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x76'))['from'](_0x8eda('0x6f'))[_0x8eda('0x38')](_0x8eda('0x70'),_0x47f57c['params']['id']['toString']())['where'](_0x8eda('0x77')))[_0x8eda('0x78')](_0x8eda('0x62')))[_0x8eda('0x71')]();return db[_0x8eda('0x4a')][_0x8eda('0x2e')](_0x589c2f);}return[];})[_0x8eda('0x24')](respondWithResult(_0x49d1a1,null))[_0x8eda('0x40')](handleError(_0x49d1a1,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1bbe8b,_0x437c6f,_0x1006b1){return db['Campaign'][_0x8eda('0x45')]({'where':{'id':_0x1bbe8b[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0x437c6f,null))[_0x8eda('0x24')](function(_0x33350e){var _0x3e245f;if(_0x33350e){_0x3e245f=squel[_0x8eda('0x5d')]()[_0x8eda('0x5e')](_0x8eda('0x5f'))[_0x8eda('0x60')]([_0x8eda('0x69'),'scheduledAt',_0x8eda('0x62'),_0x8eda('0x63'),_0x8eda('0x79'),_0x8eda('0x65'),_0x8eda('0x66')],squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x68'),_0x8eda('0x69'))[_0x8eda('0x67')](_0x8eda('0x6a'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0x8eda('0x62'))[_0x8eda('0x67')]('ANY_VALUE(ListId)',_0x8eda('0x63'))[_0x8eda('0x67')](_0x8eda('0x7a'),'CampaignId')[_0x8eda('0x67')]('NOW()',_0x8eda('0x65'))['field'](_0x8eda('0x6a'),_0x8eda('0x66'))['from'](_0x8eda('0x6f'))[_0x8eda('0x38')](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]())[_0x8eda('0x38')](_0x8eda('0x72'),_0x1bbe8b[_0x8eda('0x46')][_0x8eda('0x73')][_0x8eda('0x71')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x69'))['from'](_0x8eda('0x5f'))[_0x8eda('0x38')](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]()))[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()['field']('calleridnum')[_0x8eda('0x6e')](_0x8eda('0x6f'))['where'](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]())['where'](_0x8eda('0x77')))[_0x8eda('0x78')](_0x8eda('0x62')))[_0x8eda('0x71')]();return db[_0x8eda('0x4a')][_0x8eda('0x2e')](_0x3e245f);}return[];})[_0x8eda('0x24')](respondWithResult(_0x437c6f,null))['catch'](handleError(_0x437c6f,null));};exports[_0x8eda('0x7c')]=function(_0x11f734,_0x4cb4e6,_0x5d8512){return db['CmHopper'][_0x8eda('0x7d')]({'where':{'VoiceQueueId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x64')],'CampaignId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x79')],'ContactId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x62')]}})[_0x8eda('0x24')](handleEntityNotFound(_0x4cb4e6,null))[_0x8eda('0x24')](function(_0x1a3993){if(_0x1a3993){return _0x1a3993;}return null;})[_0x8eda('0x24')](respondWithResult(_0x4cb4e6,null))[_0x8eda('0x40')](handleError(_0x4cb4e6,null));}; \ No newline at end of file +var _0xeff8=['eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','noAnswerContacts','`state`\x20=\x2011\x20,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','toString','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne'];(function(_0x4d572e,_0x59ceb7){var _0x43a969=function(_0x2184d1){while(--_0x2184d1){_0x4d572e['push'](_0x4d572e['shift']());}};_0x43a969(++_0x59ceb7);}(_0xeff8,0x186));var _0x8eff=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xeff8[_0x42f009];return _0x22a1e0;};'use strict';var emlformat=require(_0x8eff('0x0'));var rimraf=require(_0x8eff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eff('0x2'));var rp=require(_0x8eff('0x3'));var moment=require(_0x8eff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8eff('0x5'));var util=require(_0x8eff('0x6'));var path=require(_0x8eff('0x7'));var sox=require(_0x8eff('0x8'));var csv=require('to-csv');var ejs=require(_0x8eff('0x9'));var fs=require('fs');var fs_extra=require(_0x8eff('0xa'));var _=require(_0x8eff('0xb'));var squel=require(_0x8eff('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eff('0xd'));var deskjs=require(_0x8eff('0xe'));var toCsv=require(_0x8eff('0xf'));var querystring=require(_0x8eff('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eff('0x11'));var qs=require(_0x8eff('0x12'));var as=require(_0x8eff('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eff('0x14'))(_0x8eff('0x15'));var utils=require('../../config/utils');var config=require(_0x8eff('0x16'));var licenseUtil=require(_0x8eff('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xcc;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0x18')](_0x45f280);}return _0x4a399e[_0x8eff('0x19')](_0x45f280)[_0x8eff('0x1a')]();};}function respondWithResult(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0xc8;return function(_0x212a2e){if(_0x212a2e){return _0x56efdf[_0x8eff('0x19')](_0x3e7c01)[_0x8eff('0x1b')](_0x212a2e);}};}function respondWithFilteredResult(_0x228eb1,_0x4cfc91){return function(_0x16202e){if(_0x16202e){var _0xdbb753=typeof _0x4cfc91[_0x8eff('0x1c')]===_0x8eff('0x1d')&&typeof _0x4cfc91[_0x8eff('0x1e')]==='undefined';var _0x32b791=_0x16202e[_0x8eff('0x1f')];var _0x3cd1dc=_0xdbb753?0x0:_0x4cfc91[_0x8eff('0x1c')];var _0x2cd7c5=_0xdbb753?_0x16202e[_0x8eff('0x1f')]:_0x4cfc91[_0x8eff('0x1c')]+_0x4cfc91[_0x8eff('0x1e')];var _0x1b003c;if(_0x2cd7c5>=_0x32b791){_0x2cd7c5=_0x32b791;_0x1b003c=0xc8;}else{_0x1b003c=0xce;}_0x228eb1[_0x8eff('0x19')](_0x1b003c);return _0x228eb1[_0x8eff('0x20')](_0x8eff('0x21'),_0x3cd1dc+'-'+_0x2cd7c5+'/'+_0x32b791)[_0x8eff('0x1b')](_0x16202e);}return null;};}function patchUpdates(_0x2a7337){return function(_0xdbb7b5){try{jsonpatch[_0x8eff('0x22')](_0xdbb7b5,_0x2a7337,!![]);}catch(_0x5e157c){return BPromise[_0x8eff('0x23')](_0x5e157c);}return _0xdbb7b5[_0x8eff('0x24')]();};}function saveUpdates(_0x5a2492,_0x1c4ad3){return function(_0x5ea31f){if(_0x5ea31f){return _0x5ea31f[_0x8eff('0x25')](_0x5a2492)[_0x8eff('0x26')](function(_0x1ccc79){return _0x1ccc79;});}return null;};}function removeEntity(_0x59cc32,_0x1ee09c){return function(_0x4e891c){if(_0x4e891c){return _0x4e891c[_0x8eff('0x27')]()[_0x8eff('0x26')](function(){_0x59cc32['status'](0xcc)[_0x8eff('0x1a')]();});}};}function handleEntityNotFound(_0x5ec3d7,_0x40404b){return function(_0x3b698b){if(!_0x3b698b){_0x5ec3d7[_0x8eff('0x18')](0x194);}return _0x3b698b;};}function handleError(_0x41324b,_0x6359df){_0x6359df=_0x6359df||0x1f4;return function(_0x2e8067){logger['error'](_0x2e8067[_0x8eff('0x28')]);if(_0x2e8067[_0x8eff('0x29')]){delete _0x2e8067[_0x8eff('0x29')];}_0x41324b[_0x8eff('0x19')](_0x6359df)[_0x8eff('0x2a')](_0x2e8067);};}exports[_0x8eff('0x2b')]=function(_0x4cc146,_0x4ed3b8){var _0x44dcdb={},_0x472b19={},_0x17ff3f={'count':0x0,'rows':[]};var _0x5ce071=_[_0x8eff('0x2c')](db[_0x8eff('0x2d')][_0x8eff('0x2e')],function(_0x1da0fa){return{'name':_0x1da0fa[_0x8eff('0x2f')],'type':_0x1da0fa[_0x8eff('0x30')][_0x8eff('0x31')]};});_0x472b19[_0x8eff('0x32')]=_[_0x8eff('0x2c')](_0x5ce071,_0x8eff('0x29'));_0x472b19[_0x8eff('0x33')]=_[_0x8eff('0x34')](_0x4cc146['query']);_0x472b19[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],_0x472b19[_0x8eff('0x33')]);_0x44dcdb['attributes']=_[_0x8eff('0x36')](_0x472b19[_0x8eff('0x32')],qs['fields'](_0x4cc146['query'][_0x8eff('0x37')]));_0x44dcdb[_0x8eff('0x38')]=_0x44dcdb['attributes']['length']?_0x44dcdb['attributes']:_0x472b19[_0x8eff('0x32')];if(!_0x4cc146['query'][_0x8eff('0x39')]('nolimit')){_0x44dcdb[_0x8eff('0x1e')]=qs[_0x8eff('0x1e')](_0x4cc146[_0x8eff('0x33')][_0x8eff('0x1e')]);_0x44dcdb[_0x8eff('0x1c')]=qs[_0x8eff('0x1c')](_0x4cc146['query'][_0x8eff('0x1c')]);}_0x44dcdb['order']=qs[_0x8eff('0x3a')](_0x4cc146['query'][_0x8eff('0x3a')]);_0x44dcdb[_0x8eff('0x3b')]=qs[_0x8eff('0x35')](_[_0x8eff('0x3c')](_0x4cc146['query'],_0x472b19[_0x8eff('0x35')]),_0x5ce071);if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x3d')]){_0x44dcdb['where']=_[_0x8eff('0x3e')](_0x44dcdb[_0x8eff('0x3b')],{'$or':_[_0x8eff('0x2c')](_0x5ce071,function(_0x345bc7){if(_0x345bc7[_0x8eff('0x30')]!==_0x8eff('0x3f')){var _0x29f68e={};_0x29f68e[_0x345bc7[_0x8eff('0x29')]]={'$like':'%'+_0x4cc146[_0x8eff('0x33')]['filter']+'%'};return _0x29f68e;}})});}_0x44dcdb=_['merge']({},_0x44dcdb,_0x4cc146[_0x8eff('0x40')]);var _0x114f8e={'where':_0x44dcdb[_0x8eff('0x3b')]};return db[_0x8eff('0x2d')][_0x8eff('0x1f')](_0x114f8e)[_0x8eff('0x26')](function(_0x18b132){_0x17ff3f['count']=_0x18b132;if(_0x4cc146[_0x8eff('0x33')][_0x8eff('0x41')]){_0x44dcdb['include']=[{'all':!![]}];}return db[_0x8eff('0x2d')][_0x8eff('0x42')](_0x44dcdb);})[_0x8eff('0x26')](function(_0x18309b){_0x17ff3f[_0x8eff('0x43')]=_0x18309b;return _0x17ff3f;})[_0x8eff('0x26')](respondWithFilteredResult(_0x4ed3b8,_0x44dcdb))[_0x8eff('0x44')](handleError(_0x4ed3b8,null));};exports[_0x8eff('0x45')]=function(_0x6d0568,_0x480c4c){var _0x37f376={'raw':!![],'where':{'id':_0x6d0568[_0x8eff('0x46')]['id']}},_0x27a8c9={};_0x27a8c9[_0x8eff('0x32')]=_[_0x8eff('0x34')](db['CmHopperFinal'][_0x8eff('0x2e')]);_0x27a8c9['query']=_[_0x8eff('0x34')](_0x6d0568[_0x8eff('0x33')]);_0x27a8c9[_0x8eff('0x35')]=_[_0x8eff('0x36')](_0x27a8c9['model'],_0x27a8c9[_0x8eff('0x33')]);_0x37f376[_0x8eff('0x38')]=_[_0x8eff('0x36')](_0x27a8c9['model'],qs['fields'](_0x6d0568[_0x8eff('0x33')][_0x8eff('0x37')]));_0x37f376[_0x8eff('0x38')]=_0x37f376[_0x8eff('0x38')][_0x8eff('0x47')]?_0x37f376['attributes']:_0x27a8c9[_0x8eff('0x32')];if(_0x6d0568['query'][_0x8eff('0x41')]){_0x37f376[_0x8eff('0x48')]=[{'all':!![]}];}_0x37f376=_['merge']({},_0x37f376,_0x6d0568['options']);return db['CmHopperFinal']['find'](_0x37f376)['then'](handleEntityNotFound(_0x480c4c,null))['then'](respondWithResult(_0x480c4c,null))[_0x8eff('0x44')](handleError(_0x480c4c,null));};exports[_0x8eff('0x49')]=function(_0x33aa8d,_0x1b5fda){return db[_0x8eff('0x2d')][_0x8eff('0x49')]()[_0x8eff('0x26')](respondWithResult(_0x1b5fda,null))[_0x8eff('0x44')](handleError(_0x1b5fda,null));};exports[_0x8eff('0x25')]=function(_0x3287d6,_0x4c7013){if(_0x3287d6[_0x8eff('0x4a')]['uniqueid']){delete _0x3287d6[_0x8eff('0x4a')][_0x8eff('0x4b')];}return db[_0x8eff('0x2d')][_0x8eff('0x4c')]({'where':{'uniqueid':_0x3287d6[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x4c7013,null))[_0x8eff('0x26')](saveUpdates(_0x3287d6[_0x8eff('0x4a')],null))[_0x8eff('0x26')](respondWithResult(_0x4c7013,null))[_0x8eff('0x44')](handleError(_0x4c7013,null));};exports[_0x8eff('0x4d')]=function(_0x452f7a,_0x47b28d,_0x13ae7c){return db[_0x8eff('0x2d')][_0x8eff('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x452f7a[_0x8eff('0x46')]['id']},'attributes':[[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x51')))),'noAnswerContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db['sequelize'][_0x8eff('0x50')](_0x8eff('0x52')))),_0x8eff('0x53')],[db[_0x8eff('0x4e')]['fn']('COUNT',db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x54')))),_0x8eff('0x55')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x56')))),_0x8eff('0x57')],[db[_0x8eff('0x4e')]['fn']('COUNT',db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x8eff('0x58')],[db['sequelize']['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x59')))),_0x8eff('0x5a')],[db[_0x8eff('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eff('0x4e')]['literal'](_0x8eff('0x5b')))),_0x8eff('0x5c')]]})[_0x8eff('0x26')](handleEntityNotFound(_0x47b28d,null))[_0x8eff('0x26')](respondWithResult(_0x47b28d,null))[_0x8eff('0x44')](handleError(_0x47b28d,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x4064bd,_0x36afc3,_0x1813df){return db[_0x8eff('0x2d')][_0x8eff('0x42')]({'raw':![],'where':{'CampaignId':_0x4064bd[_0x8eff('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0x8eff('0x5d')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x51')))),_0x8eff('0x5e')],[db['sequelize']['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0x8eff('0x50')](_0x8eff('0x52')))),'busyContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db['sequelize']['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0x8eff('0x55')],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x56')))),'dropContacts'],[db['sequelize']['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x5f')))),_0x8eff('0x58')],[db[_0x8eff('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eff('0x4e')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x8eff('0x4e')]['fn'](_0x8eff('0x4f'),db[_0x8eff('0x4e')]['fn']('IF',db[_0x8eff('0x4e')][_0x8eff('0x50')](_0x8eff('0x5b')))),_0x8eff('0x5c')]]})[_0x8eff('0x26')](handleEntityNotFound(_0x36afc3,null))['then'](respondWithResult(_0x36afc3,null))[_0x8eff('0x44')](handleError(_0x36afc3,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x42efc6,_0x35a221,_0x12ebd1){return db[_0x8eff('0x60')][_0x8eff('0x4c')]({'where':{'id':_0x42efc6[_0x8eff('0x46')]['id']}})['then'](handleEntityNotFound(_0x35a221,null))[_0x8eff('0x26')](function(_0x545fcf){var _0x1d8d8f;if(_0x545fcf){_0x1d8d8f=squel[_0x8eff('0x61')]()[_0x8eff('0x62')](_0x8eff('0x63'))[_0x8eff('0x64')]([_0x8eff('0x65'),_0x8eff('0x66'),_0x8eff('0x67'),_0x8eff('0x68'),'VoiceQueueId',_0x8eff('0x69'),_0x8eff('0x6a')],squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')](_0x8eff('0x6d'),_0x8eff('0x65'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x66'))[_0x8eff('0x6c')]('ANY_VALUE(ContactId)','ContactId')['field']('ANY_VALUE(ListId)',_0x8eff('0x68'))[_0x8eff('0x6c')](_0x8eff('0x6f'),_0x8eff('0x70'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x69'))['field'](_0x8eff('0x6e'),_0x8eff('0x6a'))[_0x8eff('0x71')](_0x8eff('0x72'))['where'](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id']['toString']())[_0x8eff('0x3b')](_0x8eff('0x74'),_0x42efc6[_0x8eff('0x4a')]['state']['toString']())['where'](_0x8eff('0x75'))[_0x8eff('0x3b')](_0x8eff('0x76'),squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')](_0x8eff('0x65'))[_0x8eff('0x71')](_0x8eff('0x63'))[_0x8eff('0x3b')](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id']['toString']()))[_0x8eff('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x8eff('0x6b')]()[_0x8eff('0x6c')]('calleridnum')[_0x8eff('0x71')]('cm_hopper_final')[_0x8eff('0x3b')](_0x8eff('0x73'),_0x42efc6[_0x8eff('0x46')]['id'][_0x8eff('0x77')]())[_0x8eff('0x3b')]('state\x20=\x204'))[_0x8eff('0x78')](_0x8eff('0x67')))[_0x8eff('0x77')]();return db[_0x8eff('0x4e')][_0x8eff('0x33')](_0x1d8d8f);}return[];})[_0x8eff('0x26')](respondWithResult(_0x35a221,null))[_0x8eff('0x44')](handleError(_0x35a221,null));};exports[_0x8eff('0x79')]=function(_0x23a771,_0x452b90,_0x43bbce){return db['Campaign'][_0x8eff('0x4c')]({'where':{'id':_0x23a771[_0x8eff('0x46')]['id']}})[_0x8eff('0x26')](handleEntityNotFound(_0x452b90,null))[_0x8eff('0x26')](function(_0x17f63b){var _0x582478;if(_0x17f63b){_0x582478=squel[_0x8eff('0x61')]()[_0x8eff('0x62')]('cm_hopper')['fromQuery']([_0x8eff('0x65'),_0x8eff('0x66'),_0x8eff('0x67'),_0x8eff('0x68'),_0x8eff('0x7a'),_0x8eff('0x69'),'updatedAt'],squel[_0x8eff('0x6b')]()['field'](_0x8eff('0x6d'),_0x8eff('0x65'))['field'](_0x8eff('0x6e'),'scheduledAt')['field'](_0x8eff('0x7b'),'ContactId')[_0x8eff('0x6c')](_0x8eff('0x7c'),'ListId')[_0x8eff('0x6c')](_0x8eff('0x7d'),'CampaignId')[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x69'))[_0x8eff('0x6c')](_0x8eff('0x6e'),_0x8eff('0x6a'))[_0x8eff('0x71')](_0x8eff('0x72'))[_0x8eff('0x3b')]('CampaignId\x20=\x20?',_0x23a771['params']['id']['toString']())[_0x8eff('0x3b')](_0x8eff('0x74'),_0x23a771[_0x8eff('0x4a')]['state'][_0x8eff('0x77')]())[_0x8eff('0x3b')](_0x8eff('0x75'))[_0x8eff('0x3b')](_0x8eff('0x76'),squel[_0x8eff('0x6b')]()['field'](_0x8eff('0x65'))['from'](_0x8eff('0x63'))[_0x8eff('0x3b')](_0x8eff('0x7e'),_0x23a771[_0x8eff('0x46')]['id'][_0x8eff('0x77')]()))[_0x8eff('0x3b')](_0x8eff('0x76'),squel['select']()[_0x8eff('0x6c')](_0x8eff('0x7f'))[_0x8eff('0x71')](_0x8eff('0x72'))[_0x8eff('0x3b')]('CampaignId\x20=\x20?',_0x23a771[_0x8eff('0x46')]['id'][_0x8eff('0x77')]())[_0x8eff('0x3b')]('state\x20=\x204'))['group'](_0x8eff('0x67')))[_0x8eff('0x77')]();return db[_0x8eff('0x4e')]['query'](_0x582478);}return[];})[_0x8eff('0x26')](respondWithResult(_0x452b90,null))['catch'](handleError(_0x452b90,null));};exports['checkContactHopper']=function(_0x10b9ac,_0x6bc93b,_0x10ade6){return db[_0x8eff('0x80')][_0x8eff('0x81')]({'where':{'VoiceQueueId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x70')],'CampaignId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x7a')],'ContactId':_0x10b9ac[_0x8eff('0x4a')][_0x8eff('0x67')]}})[_0x8eff('0x26')](handleEntityNotFound(_0x6bc93b,null))['then'](function(_0x34a0f7){if(_0x34a0f7){return _0x34a0f7;}return null;})[_0x8eff('0x26')](respondWithResult(_0x6bc93b,null))[_0x8eff('0x44')](handleError(_0x6bc93b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 09f347d..27e321a 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 _0x79b4=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x2b5027,_0x349290){var _0x3b85a5=function(_0x3f22ee){while(--_0x3f22ee){_0x2b5027['push'](_0x2b5027['shift']());}};_0x3b85a5(++_0x349290);}(_0x79b4,0xa4));var _0x479b=function(_0x20fa58,_0x4a1276){_0x20fa58=_0x20fa58-0x0;var _0x13c4ab=_0x79b4[_0x20fa58];return _0x13c4ab;};'use strict';var _=require(_0x479b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x479b('0x1'));var moment=require(_0x479b('0x2'));var BPromise=require(_0x479b('0x3'));var rp=require(_0x479b('0x4'));var fs=require('fs');var path=require(_0x479b('0x5'));var rimraf=require(_0x479b('0x6'));var config=require(_0x479b('0x7'));var attributes=require(_0x479b('0x8'));module[_0x479b('0x9')]=function(_0x6c39aa,_0x47a2cc){return _0x6c39aa[_0x479b('0xa')](_0x479b('0xb'),attributes,{'tableName':_0x479b('0xc'),'paranoid':![],'indexes':[{'name':_0x479b('0xd'),'fields':[_0x479b('0xd')]},{'name':_0x479b('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe1bf=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1b5e83,_0x4c485d){var _0x2104c9=function(_0x3d60b9){while(--_0x3d60b9){_0x1b5e83['push'](_0x1b5e83['shift']());}};_0x2104c9(++_0x4c485d);}(_0xe1bf,0xcc));var _0xfe1b=function(_0x1d6470,_0x224b8b){_0x1d6470=_0x1d6470-0x0;var _0x49d303=_0xe1bf[_0x1d6470];return _0x49d303;};'use strict';var _=require(_0xfe1b('0x0'));var util=require(_0xfe1b('0x1'));var logger=require('../../config/logger')(_0xfe1b('0x2'));var moment=require(_0xfe1b('0x3'));var BPromise=require(_0xfe1b('0x4'));var rp=require(_0xfe1b('0x5'));var fs=require('fs');var path=require(_0xfe1b('0x6'));var rimraf=require(_0xfe1b('0x7'));var config=require(_0xfe1b('0x8'));var attributes=require(_0xfe1b('0x9'));module[_0xfe1b('0xa')]=function(_0x5c67a3,_0x31293e){return _0x5c67a3[_0xfe1b('0xb')]('CmHopperFinal',attributes,{'tableName':_0xfe1b('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xfe1b('0xd')]},{'name':_0xfe1b('0xe'),'fields':[_0xfe1b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 22f5130..1f5b9bd 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x28a294,_0x1bb3ce){var _0xd901df=function(_0x58d63d){while(--_0x58d63d){_0x28a294['push'](_0x28a294['shift']());}};_0xd901df(++_0x1bb3ce);}(_0x7a54,0x106));var _0x47a5=function(_0x269e77,_0x1c6714){_0x269e77=_0x269e77-0x0;var _0x2074b4=_0x7a54[_0x269e77];return _0x2074b4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x3f0693,_0x5aac7f){var _0x533f84=function(_0x3f310c){while(--_0x3f310c){_0x3f0693['push'](_0x3f0693['shift']());}};_0x533f84(++_0x5aac7f);}(_0xb10b,0x12a));var _0xbb10=function(_0x3240ff,_0x3b9c3d){_0x3240ff=_0x3240ff-0x0;var _0x514858=_0xb10b[_0x3240ff];return _0x514858;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index cef8450..1d26c04 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 _0x229d=['/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x1966f3,_0x210ea3){var _0x17575f=function(_0x7b18fb){while(--_0x7b18fb){_0x1966f3['push'](_0x1966f3['shift']());}};_0x17575f(++_0x210ea3);}(_0x229d,0x1b0));var _0xd229=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x229d[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xd229('0x0'));var util=require(_0xd229('0x1'));var path=require('path');var timeout=require(_0xd229('0x2'));var express=require(_0xd229('0x3'));var router=express[_0xd229('0x4')]();var fs_extra=require(_0xd229('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd229('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0xd229('0x7')](),controller[_0xd229('0x8')]);router[_0xd229('0x9')](_0xd229('0xa'),auth[_0xd229('0x7')](),controller[_0xd229('0xb')]);router[_0xd229('0x9')](_0xd229('0xc'),auth[_0xd229('0x7')](),controller[_0xd229('0xd')]);router['get'](_0xd229('0xe'),auth[_0xd229('0x7')](),controller[_0xd229('0xf')]);router[_0xd229('0x9')](_0xd229('0x10'),auth[_0xd229('0x7')](),controller[_0xd229('0x11')]);router[_0xd229('0x12')](_0xd229('0x13'),auth['isAuthenticated'](),controller[_0xd229('0x14')]);router[_0xd229('0x12')]('/voice/campaign/moveContacts/:id',auth[_0xd229('0x7')](),controller[_0xd229('0x15')]);router[_0xd229('0x12')](_0xd229('0x16'),auth[_0xd229('0x7')](),controller[_0xd229('0x17')]);router[_0xd229('0x18')](_0xd229('0xc'),auth[_0xd229('0x7')](),controller['update']);module[_0xd229('0x19')]=router; \ No newline at end of file +var _0x6e4d=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','exports'];(function(_0x46d0a8,_0x59080b){var _0x480cf5=function(_0x4efd9b){while(--_0x4efd9b){_0x46d0a8['push'](_0x46d0a8['shift']());}};_0x480cf5(++_0x59080b);}(_0x6e4d,0x1cb));var _0xd6e4=function(_0x3517f1,_0x41b82b){_0x3517f1=_0x3517f1-0x0;var _0x1a1f8d=_0x6e4d[_0x3517f1];return _0x1a1f8d;};'use strict';var multer=require(_0xd6e4('0x0'));var util=require(_0xd6e4('0x1'));var path=require('path');var timeout=require(_0xd6e4('0x2'));var express=require(_0xd6e4('0x3'));var router=express['Router']();var fs_extra=require(_0xd6e4('0x4'));var auth=require(_0xd6e4('0x5'));var interaction=require(_0xd6e4('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xd6e4('0x7')]('/',auth['isAuthenticated'](),controller[_0xd6e4('0x8')]);router[_0xd6e4('0x7')](_0xd6e4('0x9'),auth[_0xd6e4('0xa')](),controller[_0xd6e4('0xb')]);router[_0xd6e4('0x7')](_0xd6e4('0xc'),auth[_0xd6e4('0xa')](),controller[_0xd6e4('0xd')]);router[_0xd6e4('0x7')](_0xd6e4('0xe'),auth[_0xd6e4('0xa')](),controller[_0xd6e4('0xf')]);router['get'](_0xd6e4('0x10'),auth[_0xd6e4('0xa')](),controller[_0xd6e4('0x11')]);router[_0xd6e4('0x12')](_0xd6e4('0x13'),auth[_0xd6e4('0xa')](),controller[_0xd6e4('0x14')]);router['post'](_0xd6e4('0x15'),auth[_0xd6e4('0xa')](),controller[_0xd6e4('0x16')]);router[_0xd6e4('0x12')](_0xd6e4('0x17'),auth[_0xd6e4('0xa')](),controller['checkContactHopper']);router[_0xd6e4('0x18')](_0xd6e4('0xc'),auth[_0xd6e4('0xa')](),controller[_0xd6e4('0x19')]);module[_0xd6e4('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 823a954..b5ea1bf 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 _0x63d5=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x5eb065,_0x30f904){var _0x285720=function(_0x50a242){while(--_0x50a242){_0x5eb065['push'](_0x5eb065['shift']());}};_0x285720(++_0x30f904);}(_0x63d5,0x13f));var _0x563d=function(_0x97acee,_0x202957){_0x97acee=_0x97acee-0x0;var _0x16cc43=_0x63d5[_0x97acee];return _0x16cc43;};'use strict';var Sequelize=require('sequelize');module[_0x563d('0x0')]={'state':{'type':Sequelize[_0x563d('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x563d('0x2')]},'scheduledat':{'type':Sequelize[_0x563d('0x3')]},'countbusyretry':{'type':Sequelize[_0x563d('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x563d('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x563d('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x563d('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x563d('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x563d('0x2')]},'originatecalleridname':{'type':Sequelize[_0x563d('0x2')]},'calleridnum':{'type':Sequelize[_0x563d('0x2')]},'calleridname':{'type':Sequelize[_0x563d('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x563d('0x3')]},'answertime':{'type':Sequelize[_0x563d('0x3')]},'droptime':{'type':Sequelize[_0x563d('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x563d('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x563d('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x563d('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x563d('0x2')]},'campaign':{'type':Sequelize[_0x563d('0x2')]},'campaigntype':{'type':Sequelize[_0x563d('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x563d('0x2')]},'amd':{'type':Sequelize[_0x563d('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x563d('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x563d('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x563d('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x563d('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x563d('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x563d('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x563d('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x563d('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x563d('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x563d('0x2')]}}; \ No newline at end of file +var _0x72f6=['exports','INTEGER','DATE','STRING','BOOLEAN','sequelize'];(function(_0x3b69f9,_0x1e2820){var _0x409f99=function(_0x128d8f){while(--_0x128d8f){_0x3b69f9['push'](_0x3b69f9['shift']());}};_0x409f99(++_0x1e2820);}(_0x72f6,0x1a9));var _0x672f=function(_0x228bee,_0x5b2530){_0x228bee=_0x228bee-0x0;var _0x342513=_0x72f6[_0x228bee];return _0x342513;};'use strict';var Sequelize=require(_0x672f('0x0'));module[_0x672f('0x1')]={'state':{'type':Sequelize[_0x672f('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x672f('0x3')]},'countbusyretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x672f('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x672f('0x4')]},'originatecalleridname':{'type':Sequelize[_0x672f('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x672f('0x4')]},'starttime':{'type':Sequelize[_0x672f('0x3')]},'responsetime':{'type':Sequelize[_0x672f('0x3')]},'answertime':{'type':Sequelize[_0x672f('0x3')]},'droptime':{'type':Sequelize[_0x672f('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x672f('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x672f('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x672f('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x672f('0x3')]},'recallme':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x672f('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x672f('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x672f('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a9e5e95..dfcd6fa 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 _0x90cd=['moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','name','send','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','describe','body','uniqueid','find','eml-format'];(function(_0x354220,_0x4a61a0){var _0x194fb7=function(_0x5865e6){while(--_0x5865e6){_0x354220['push'](_0x354220['shift']());}};_0x194fb7(++_0x4a61a0);}(_0x90cd,0x16c));var _0xd90c=function(_0x5d2028,_0x1db1c9){_0x5d2028=_0x5d2028-0x0;var _0x499711=_0x90cd[_0x5d2028];return _0x499711;};'use strict';var emlformat=require(_0xd90c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd90c('0x1'));var BPromise=require(_0xd90c('0x2'));var Mustache=require(_0xd90c('0x3'));var util=require('util');var path=require(_0xd90c('0x4'));var sox=require(_0xd90c('0x5'));var csv=require(_0xd90c('0x6'));var ejs=require(_0xd90c('0x7'));var fs=require('fs');var fs_extra=require(_0xd90c('0x8'));var _=require(_0xd90c('0x9'));var squel=require(_0xd90c('0xa'));var crypto=require(_0xd90c('0xb'));var jsforce=require(_0xd90c('0xc'));var deskjs=require(_0xd90c('0xd'));var toCsv=require(_0xd90c('0x6'));var querystring=require('querystring');var Papa=require(_0xd90c('0xe'));var Redis=require(_0xd90c('0xf'));var authService=require(_0xd90c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd90c('0x11'));var hardwareService=require(_0xd90c('0x12'));var logger=require(_0xd90c('0x13'))(_0xd90c('0x14'));var utils=require(_0xd90c('0x15'));var config=require(_0xd90c('0x16'));var licenseUtil=require(_0xd90c('0x17'));var db=require(_0xd90c('0x18'))['db'];function respondWithStatusCode(_0x4d16e7,_0x1587e6){_0x1587e6=_0x1587e6||0xcc;return function(_0x42c0b6){if(_0x42c0b6){return _0x4d16e7[_0xd90c('0x19')](_0x1587e6);}return _0x4d16e7[_0xd90c('0x1a')](_0x1587e6)[_0xd90c('0x1b')]();};}function respondWithResult(_0x50d251,_0x5cbb6c){_0x5cbb6c=_0x5cbb6c||0xc8;return function(_0x2ed8ad){if(_0x2ed8ad){return _0x50d251[_0xd90c('0x1a')](_0x5cbb6c)[_0xd90c('0x1c')](_0x2ed8ad);}};}function respondWithFilteredResult(_0x152659,_0x1cd56d){return function(_0x44d8cb){if(_0x44d8cb){var _0x328924=typeof _0x1cd56d[_0xd90c('0x1d')]===_0xd90c('0x1e')&&typeof _0x1cd56d[_0xd90c('0x1f')]==='undefined';var _0x2db91a=_0x44d8cb[_0xd90c('0x20')];var _0x82b799=_0x328924?0x0:_0x1cd56d[_0xd90c('0x1d')];var _0xa3f8db=_0x328924?_0x44d8cb[_0xd90c('0x20')]:_0x1cd56d[_0xd90c('0x1d')]+_0x1cd56d['limit'];var _0x47926c;if(_0xa3f8db>=_0x2db91a){_0xa3f8db=_0x2db91a;_0x47926c=0xc8;}else{_0x47926c=0xce;}_0x152659[_0xd90c('0x1a')](_0x47926c);return _0x152659[_0xd90c('0x21')](_0xd90c('0x22'),_0x82b799+'-'+_0xa3f8db+'/'+_0x2db91a)[_0xd90c('0x1c')](_0x44d8cb);}return null;};}function patchUpdates(_0x493fae){return function(_0x32f054){try{jsonpatch['apply'](_0x32f054,_0x493fae,!![]);}catch(_0xa1e05e){return BPromise['reject'](_0xa1e05e);}return _0x32f054['save']();};}function saveUpdates(_0x39cb6a,_0x270787){return function(_0x287ea7){if(_0x287ea7){return _0x287ea7[_0xd90c('0x23')](_0x39cb6a)[_0xd90c('0x24')](function(_0x1daf30){return _0x1daf30;});}return null;};}function removeEntity(_0x40c23f,_0xa6d06d){return function(_0x187a29){if(_0x187a29){return _0x187a29['destroy']()[_0xd90c('0x24')](function(){_0x40c23f['status'](0xcc)[_0xd90c('0x1b')]();});}};}function handleEntityNotFound(_0xa5fb72,_0x1daf8c){return function(_0x2843cb){if(!_0x2843cb){_0xa5fb72[_0xd90c('0x19')](0x194);}return _0x2843cb;};}function handleError(_0x1975ff,_0x22a778){_0x22a778=_0x22a778||0x1f4;return function(_0x22a6b3){logger[_0xd90c('0x25')](_0x22a6b3['stack']);if(_0x22a6b3[_0xd90c('0x26')]){delete _0x22a6b3[_0xd90c('0x26')];}_0x1975ff[_0xd90c('0x1a')](_0x22a778)[_0xd90c('0x27')](_0x22a6b3);};}exports['index']=function(_0xf4bb52,_0x9eb56d){var _0xff5933={},_0x1ec2f6={},_0x35d0dc={'count':0x0,'rows':[]};var _0x85ae5a=_['map'](db[_0xd90c('0x28')][_0xd90c('0x29')],function(_0x2d7108){return{'name':_0x2d7108[_0xd90c('0x2a')],'type':_0x2d7108[_0xd90c('0x2b')][_0xd90c('0x2c')]};});_0x1ec2f6[_0xd90c('0x2d')]=_[_0xd90c('0x2e')](_0x85ae5a,_0xd90c('0x26'));_0x1ec2f6[_0xd90c('0x2f')]=_[_0xd90c('0x30')](_0xf4bb52[_0xd90c('0x2f')]);_0x1ec2f6[_0xd90c('0x31')]=_[_0xd90c('0x32')](_0x1ec2f6[_0xd90c('0x2d')],_0x1ec2f6[_0xd90c('0x2f')]);_0xff5933[_0xd90c('0x33')]=_[_0xd90c('0x32')](_0x1ec2f6[_0xd90c('0x2d')],qs[_0xd90c('0x34')](_0xf4bb52[_0xd90c('0x2f')]['fields']));_0xff5933['attributes']=_0xff5933[_0xd90c('0x33')]['length']?_0xff5933[_0xd90c('0x33')]:_0x1ec2f6[_0xd90c('0x2d')];if(!_0xf4bb52[_0xd90c('0x2f')][_0xd90c('0x35')](_0xd90c('0x36'))){_0xff5933['limit']=qs[_0xd90c('0x1f')](_0xf4bb52['query'][_0xd90c('0x1f')]);_0xff5933[_0xd90c('0x1d')]=qs['offset'](_0xf4bb52[_0xd90c('0x2f')][_0xd90c('0x1d')]);}_0xff5933[_0xd90c('0x37')]=qs[_0xd90c('0x38')](_0xf4bb52[_0xd90c('0x2f')]['sort']);_0xff5933[_0xd90c('0x39')]=qs[_0xd90c('0x31')](_['pick'](_0xf4bb52[_0xd90c('0x2f')],_0x1ec2f6['filters']),_0x85ae5a);if(_0xf4bb52[_0xd90c('0x2f')]['filter']){_0xff5933['where']=_[_0xd90c('0x3a')](_0xff5933[_0xd90c('0x39')],{'$or':_[_0xd90c('0x2e')](_0x85ae5a,function(_0x3f0634){if(_0x3f0634[_0xd90c('0x2b')]!==_0xd90c('0x3b')){var _0x36992f={};_0x36992f[_0x3f0634['name']]={'$like':'%'+_0xf4bb52[_0xd90c('0x2f')]['filter']+'%'};return _0x36992f;}})});}_0xff5933=_['merge']({},_0xff5933,_0xf4bb52[_0xd90c('0x3c')]);var _0x3697e9={'where':_0xff5933[_0xd90c('0x39')]};return db[_0xd90c('0x28')][_0xd90c('0x20')](_0x3697e9)['then'](function(_0x48cd6a){_0x35d0dc[_0xd90c('0x20')]=_0x48cd6a;if(_0xf4bb52[_0xd90c('0x2f')]['includeAll']){_0xff5933[_0xd90c('0x3d')]=[{'all':!![]}];}return db[_0xd90c('0x28')][_0xd90c('0x3e')](_0xff5933);})[_0xd90c('0x24')](function(_0x10bfa4){_0x35d0dc[_0xd90c('0x3f')]=_0x10bfa4;return _0x35d0dc;})[_0xd90c('0x24')](respondWithFilteredResult(_0x9eb56d,_0xff5933))[_0xd90c('0x40')](handleError(_0x9eb56d,null));};exports[_0xd90c('0x41')]=function(_0x3988ce,_0x53644d){var _0x72eec2={'raw':!![],'where':{'id':_0x3988ce[_0xd90c('0x42')]['id']}},_0x7a249f={};_0x7a249f[_0xd90c('0x2d')]=_['keys'](db[_0xd90c('0x28')][_0xd90c('0x29')]);_0x7a249f[_0xd90c('0x2f')]=_[_0xd90c('0x30')](_0x3988ce[_0xd90c('0x2f')]);_0x7a249f[_0xd90c('0x31')]=_[_0xd90c('0x32')](_0x7a249f['model'],_0x7a249f[_0xd90c('0x2f')]);_0x72eec2[_0xd90c('0x33')]=_[_0xd90c('0x32')](_0x7a249f[_0xd90c('0x2d')],qs['fields'](_0x3988ce[_0xd90c('0x2f')][_0xd90c('0x34')]));_0x72eec2['attributes']=_0x72eec2[_0xd90c('0x33')]['length']?_0x72eec2[_0xd90c('0x33')]:_0x7a249f['model'];if(_0x3988ce[_0xd90c('0x2f')][_0xd90c('0x43')]){_0x72eec2[_0xd90c('0x3d')]=[{'all':!![]}];}_0x72eec2=_[_0xd90c('0x3a')]({},_0x72eec2,_0x3988ce[_0xd90c('0x3c')]);return db[_0xd90c('0x28')]['find'](_0x72eec2)[_0xd90c('0x24')](handleEntityNotFound(_0x53644d,null))[_0xd90c('0x24')](respondWithResult(_0x53644d,null))['catch'](handleError(_0x53644d,null));};exports['create']=function(_0x329269,_0x58d245){return db[_0xd90c('0x28')][_0xd90c('0x44')](_0x329269['body'],{})[_0xd90c('0x24')](respondWithResult(_0x58d245,0xc9))[_0xd90c('0x40')](handleError(_0x58d245,null));};exports[_0xd90c('0x45')]=function(_0x304e11,_0x3bba0c){return db[_0xd90c('0x28')]['describe']()[_0xd90c('0x24')](respondWithResult(_0x3bba0c,null))[_0xd90c('0x40')](handleError(_0x3bba0c,null));};exports[_0xd90c('0x23')]=function(_0x362f1f,_0x13b09a){if(_0x362f1f[_0xd90c('0x46')][_0xd90c('0x47')]){delete _0x362f1f[_0xd90c('0x46')][_0xd90c('0x47')];}return db['CmHopperHistory'][_0xd90c('0x48')]({'where':{'uniqueid':_0x362f1f[_0xd90c('0x42')]['id']}})[_0xd90c('0x24')](handleEntityNotFound(_0x13b09a,null))['then'](saveUpdates(_0x362f1f[_0xd90c('0x46')],null))['then'](respondWithResult(_0x13b09a,null))[_0xd90c('0x40')](handleError(_0x13b09a,null));}; \ No newline at end of file +var _0x52f4=['keys','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','params'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x52f4,0x1ce));var _0x452f=function(_0x58b2b7,_0x2c46e5){_0x58b2b7=_0x58b2b7-0x0;var _0x302ec6=_0x52f4[_0x58b2b7];return _0x302ec6;};'use strict';var emlformat=require(_0x452f('0x0'));var rimraf=require(_0x452f('0x1'));var zipdir=require(_0x452f('0x2'));var jsonpatch=require(_0x452f('0x3'));var rp=require(_0x452f('0x4'));var moment=require(_0x452f('0x5'));var BPromise=require(_0x452f('0x6'));var Mustache=require('mustache');var util=require(_0x452f('0x7'));var path=require(_0x452f('0x8'));var sox=require(_0x452f('0x9'));var csv=require(_0x452f('0xa'));var ejs=require(_0x452f('0xb'));var fs=require('fs');var fs_extra=require(_0x452f('0xc'));var _=require(_0x452f('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x452f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x452f('0xf'));var Redis=require(_0x452f('0x10'));var authService=require(_0x452f('0x11'));var qs=require(_0x452f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x452f('0x13'))('api');var utils=require(_0x452f('0x14'));var config=require(_0x452f('0x15'));var licenseUtil=require(_0x452f('0x16'));var db=require(_0x452f('0x17'))['db'];function respondWithStatusCode(_0x15c7bc,_0x8c1120){_0x8c1120=_0x8c1120||0xcc;return function(_0x75f040){if(_0x75f040){return _0x15c7bc[_0x452f('0x18')](_0x8c1120);}return _0x15c7bc[_0x452f('0x19')](_0x8c1120)[_0x452f('0x1a')]();};}function respondWithResult(_0x121123,_0x25a75b){_0x25a75b=_0x25a75b||0xc8;return function(_0x3d2078){if(_0x3d2078){return _0x121123[_0x452f('0x19')](_0x25a75b)[_0x452f('0x1b')](_0x3d2078);}};}function respondWithFilteredResult(_0x391318,_0x4c8214){return function(_0x1f89d6){if(_0x1f89d6){var _0x121c66=typeof _0x4c8214[_0x452f('0x1c')]==='undefined'&&typeof _0x4c8214[_0x452f('0x1d')]==='undefined';var _0x2d5ac2=_0x1f89d6['count'];var _0x8c0c6=_0x121c66?0x0:_0x4c8214[_0x452f('0x1c')];var _0x36a3ba=_0x121c66?_0x1f89d6['count']:_0x4c8214[_0x452f('0x1c')]+_0x4c8214[_0x452f('0x1d')];var _0x48effd;if(_0x36a3ba>=_0x2d5ac2){_0x36a3ba=_0x2d5ac2;_0x48effd=0xc8;}else{_0x48effd=0xce;}_0x391318[_0x452f('0x19')](_0x48effd);return _0x391318['set'](_0x452f('0x1e'),_0x8c0c6+'-'+_0x36a3ba+'/'+_0x2d5ac2)['json'](_0x1f89d6);}return null;};}function patchUpdates(_0x5068e5){return function(_0x3a10d0){try{jsonpatch[_0x452f('0x1f')](_0x3a10d0,_0x5068e5,!![]);}catch(_0xe36778){return BPromise[_0x452f('0x20')](_0xe36778);}return _0x3a10d0[_0x452f('0x21')]();};}function saveUpdates(_0x23652c,_0x1cc8e6){return function(_0x4e9513){if(_0x4e9513){return _0x4e9513[_0x452f('0x22')](_0x23652c)[_0x452f('0x23')](function(_0x5c6598){return _0x5c6598;});}return null;};}function removeEntity(_0x20ebd1,_0x4f2c49){return function(_0x4b7a7c){if(_0x4b7a7c){return _0x4b7a7c[_0x452f('0x24')]()[_0x452f('0x23')](function(){_0x20ebd1[_0x452f('0x19')](0xcc)[_0x452f('0x1a')]();});}};}function handleEntityNotFound(_0x92bff7,_0x1ad542){return function(_0x42aa53){if(!_0x42aa53){_0x92bff7[_0x452f('0x18')](0x194);}return _0x42aa53;};}function handleError(_0x33503b,_0x266abe){_0x266abe=_0x266abe||0x1f4;return function(_0x45174a){logger[_0x452f('0x25')](_0x45174a[_0x452f('0x26')]);if(_0x45174a[_0x452f('0x27')]){delete _0x45174a[_0x452f('0x27')];}_0x33503b[_0x452f('0x19')](_0x266abe)[_0x452f('0x28')](_0x45174a);};}exports['index']=function(_0x47a4e4,_0x568b22){var _0x449b46={},_0xf90db2={},_0x13d218={'count':0x0,'rows':[]};var _0x18dfc6=_['map'](db[_0x452f('0x29')][_0x452f('0x2a')],function(_0x25b234){return{'name':_0x25b234[_0x452f('0x2b')],'type':_0x25b234[_0x452f('0x2c')][_0x452f('0x2d')]};});_0xf90db2[_0x452f('0x2e')]=_[_0x452f('0x2f')](_0x18dfc6,_0x452f('0x27'));_0xf90db2[_0x452f('0x30')]=_['keys'](_0x47a4e4[_0x452f('0x30')]);_0xf90db2[_0x452f('0x31')]=_[_0x452f('0x32')](_0xf90db2[_0x452f('0x2e')],_0xf90db2[_0x452f('0x30')]);_0x449b46['attributes']=_[_0x452f('0x32')](_0xf90db2[_0x452f('0x2e')],qs[_0x452f('0x33')](_0x47a4e4[_0x452f('0x30')]['fields']));_0x449b46[_0x452f('0x34')]=_0x449b46['attributes'][_0x452f('0x35')]?_0x449b46[_0x452f('0x34')]:_0xf90db2['model'];if(!_0x47a4e4[_0x452f('0x30')][_0x452f('0x36')](_0x452f('0x37'))){_0x449b46[_0x452f('0x1d')]=qs[_0x452f('0x1d')](_0x47a4e4[_0x452f('0x30')][_0x452f('0x1d')]);_0x449b46[_0x452f('0x1c')]=qs[_0x452f('0x1c')](_0x47a4e4['query'][_0x452f('0x1c')]);}_0x449b46[_0x452f('0x38')]=qs['sort'](_0x47a4e4[_0x452f('0x30')]['sort']);_0x449b46['where']=qs['filters'](_[_0x452f('0x39')](_0x47a4e4[_0x452f('0x30')],_0xf90db2[_0x452f('0x31')]),_0x18dfc6);if(_0x47a4e4[_0x452f('0x30')][_0x452f('0x3a')]){_0x449b46[_0x452f('0x3b')]=_['merge'](_0x449b46[_0x452f('0x3b')],{'$or':_[_0x452f('0x2f')](_0x18dfc6,function(_0x10bb98){if(_0x10bb98[_0x452f('0x2c')]!==_0x452f('0x3c')){var _0x5b10a4={};_0x5b10a4[_0x10bb98[_0x452f('0x27')]]={'$like':'%'+_0x47a4e4['query'][_0x452f('0x3a')]+'%'};return _0x5b10a4;}})});}_0x449b46=_[_0x452f('0x3d')]({},_0x449b46,_0x47a4e4[_0x452f('0x3e')]);var _0x50fb1a={'where':_0x449b46['where']};return db[_0x452f('0x29')][_0x452f('0x3f')](_0x50fb1a)[_0x452f('0x23')](function(_0x206a4e){_0x13d218[_0x452f('0x3f')]=_0x206a4e;if(_0x47a4e4[_0x452f('0x30')][_0x452f('0x40')]){_0x449b46[_0x452f('0x41')]=[{'all':!![]}];}return db[_0x452f('0x29')][_0x452f('0x42')](_0x449b46);})[_0x452f('0x23')](function(_0x591266){_0x13d218['rows']=_0x591266;return _0x13d218;})[_0x452f('0x23')](respondWithFilteredResult(_0x568b22,_0x449b46))[_0x452f('0x43')](handleError(_0x568b22,null));};exports[_0x452f('0x44')]=function(_0x1234e8,_0x56384a){var _0x3c58e3={'raw':!![],'where':{'id':_0x1234e8[_0x452f('0x45')]['id']}},_0x2e082f={};_0x2e082f['model']=_[_0x452f('0x46')](db[_0x452f('0x29')][_0x452f('0x2a')]);_0x2e082f['query']=_[_0x452f('0x46')](_0x1234e8[_0x452f('0x30')]);_0x2e082f[_0x452f('0x31')]=_['intersection'](_0x2e082f[_0x452f('0x2e')],_0x2e082f[_0x452f('0x30')]);_0x3c58e3[_0x452f('0x34')]=_['intersection'](_0x2e082f['model'],qs[_0x452f('0x33')](_0x1234e8[_0x452f('0x30')][_0x452f('0x33')]));_0x3c58e3[_0x452f('0x34')]=_0x3c58e3[_0x452f('0x34')][_0x452f('0x35')]?_0x3c58e3[_0x452f('0x34')]:_0x2e082f[_0x452f('0x2e')];if(_0x1234e8[_0x452f('0x30')][_0x452f('0x40')]){_0x3c58e3[_0x452f('0x41')]=[{'all':!![]}];}_0x3c58e3=_[_0x452f('0x3d')]({},_0x3c58e3,_0x1234e8[_0x452f('0x3e')]);return db[_0x452f('0x29')][_0x452f('0x47')](_0x3c58e3)[_0x452f('0x23')](handleEntityNotFound(_0x56384a,null))['then'](respondWithResult(_0x56384a,null))[_0x452f('0x43')](handleError(_0x56384a,null));};exports[_0x452f('0x48')]=function(_0x41234e,_0xd93d30){return db['CmHopperHistory']['create'](_0x41234e[_0x452f('0x49')],{})[_0x452f('0x23')](respondWithResult(_0xd93d30,0xc9))['catch'](handleError(_0xd93d30,null));};exports[_0x452f('0x4a')]=function(_0xe5afaa,_0xab1ed9){return db[_0x452f('0x29')]['describe']()['then'](respondWithResult(_0xab1ed9,null))[_0x452f('0x43')](handleError(_0xab1ed9,null));};exports[_0x452f('0x22')]=function(_0x17e9a5,_0x21a2e9){if(_0x17e9a5[_0x452f('0x49')][_0x452f('0x4b')]){delete _0x17e9a5[_0x452f('0x49')][_0x452f('0x4b')];}return db[_0x452f('0x29')][_0x452f('0x47')]({'where':{'uniqueid':_0x17e9a5[_0x452f('0x45')]['id']}})[_0x452f('0x23')](handleEntityNotFound(_0x21a2e9,null))[_0x452f('0x23')](saveUpdates(_0x17e9a5['body'],null))['then'](respondWithResult(_0x21a2e9,null))[_0x452f('0x43')](handleError(_0x21a2e9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index e9fade0..8795058 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 _0xfece=['lodash','util','bluebird','rimraf','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x303d3e,_0x1cf77a){var _0xeba184=function(_0x58f4ca){while(--_0x58f4ca){_0x303d3e['push'](_0x303d3e['shift']());}};_0xeba184(++_0x1cf77a);}(_0xfece,0x19e));var _0xefec=function(_0x2a381f,_0x27666a){_0x2a381f=_0x2a381f-0x0;var _0x2eb892=_0xfece[_0x2a381f];return _0x2eb892;};'use strict';var _=require(_0xefec('0x0'));var util=require(_0xefec('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xefec('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xefec('0x3'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0xbbd36f,_0x51d968){return _0xbbd36f[_0xefec('0x4')](_0xefec('0x5'),attributes,{'tableName':_0xefec('0x6'),'paranoid':![],'indexes':[{'name':_0xefec('0x7'),'fields':[_0xefec('0x7')]},{'name':_0xefec('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x23db=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0xc3b4a1,_0x43e21c){var _0x16c2cf=function(_0xb0b513){while(--_0xb0b513){_0xc3b4a1['push'](_0xc3b4a1['shift']());}};_0x16c2cf(++_0x43e21c);}(_0x23db,0x141));var _0xb23d=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x23db[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0xb23d('0x0'));var util=require(_0xb23d('0x1'));var logger=require(_0xb23d('0x2'))(_0xb23d('0x3'));var moment=require(_0xb23d('0x4'));var BPromise=require(_0xb23d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb23d('0x6'));var config=require(_0xb23d('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0xb23d('0x8')]=function(_0x3a2ba6,_0x105811){return _0x3a2ba6[_0xb23d('0x9')](_0xb23d('0xa'),attributes,{'tableName':_0xb23d('0xb'),'paranoid':![],'indexes':[{'name':_0xb23d('0xc'),'fields':[_0xb23d('0xc')]},{'name':_0xb23d('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 47976f8..1ea87e8 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 _0xb3d3=['catch','AvgHandleTime','where','sequelize','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','options','raw','info','debug'];(function(_0x1ab11a,_0x2e2f92){var _0x50c375=function(_0x4b9ecf){while(--_0x4b9ecf){_0x1ab11a['push'](_0x1ab11a['shift']());}};_0x50c375(++_0x2e2f92);}(_0xb3d3,0x1ba));var _0x3b3d=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0xb3d3[_0x2a0738];return _0x159679;};'use strict';var _=require(_0x3b3d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3b3d('0x1'));var rs=require(_0x3b3d('0x2'));var fs=require('fs');var Redis=require(_0x3b3d('0x3'));var db=require(_0x3b3d('0x4'))['db'];var utils=require(_0x3b3d('0x5'));var logger=require('../../config/logger')(_0x3b3d('0x6'));var config=require(_0x3b3d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3b3d('0x8')][_0x3b3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3630da,_0x2045fd,_0x447d36){return new BPromise(function(_0x21ba49,_0x43bc1e){return client[_0x3b3d('0xa')](_0x3630da,_0x447d36)[_0x3b3d('0xb')](function(_0x54622f){logger['info'](_0x3b3d('0xc'),_0x2045fd,_0x3b3d('0xd'));logger['debug'](_0x3b3d('0xe'),_0x2045fd,_0x3b3d('0xd'),JSON[_0x3b3d('0xf')](_0x54622f));if(_0x54622f[_0x3b3d('0x10')]){if(_0x54622f['error'][_0x3b3d('0x11')]===0x1f4){logger['error'](_0x3b3d('0xc'),_0x2045fd,_0x54622f[_0x3b3d('0x10')][_0x3b3d('0x12')]);return _0x43bc1e(_0x54622f[_0x3b3d('0x10')]['message']);}logger[_0x3b3d('0x10')](_0x3b3d('0xc'),_0x2045fd,_0x54622f[_0x3b3d('0x10')]['message']);return _0x21ba49(_0x54622f[_0x3b3d('0x10')][_0x3b3d('0x12')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x2045fd,_0x3b3d('0xd'));_0x21ba49(_0x54622f[_0x3b3d('0x13')][_0x3b3d('0x12')]);}})['catch'](function(_0x2cda55){logger[_0x3b3d('0x10')](_0x3b3d('0xc'),_0x2045fd,_0x2cda55);_0x43bc1e(_0x2cda55);});});}exports[_0x3b3d('0x14')]=function(_0x5b7c08){var _0x304f1e=this;return new Promise(function(_0x4be438,_0x5e9b40){return db[_0x3b3d('0x15')][_0x3b3d('0x16')](_0x5b7c08['body'],{'raw':_0x5b7c08[_0x3b3d('0x17')]?_0x5b7c08[_0x3b3d('0x17')][_0x3b3d('0x18')]===undefined?!![]:![]:!![]})[_0x3b3d('0xb')](function(_0x4d19fa){logger[_0x3b3d('0x19')]('CreateCmHopperHistory',_0x5b7c08);logger[_0x3b3d('0x1a')]('CreateCmHopperHistory',_0x5b7c08,JSON[_0x3b3d('0xf')](_0x4d19fa));_0x4be438(_0x4d19fa);})[_0x3b3d('0x1b')](function(_0x511d7c){logger[_0x3b3d('0x10')]('CreateCmHopperHistory',_0x511d7c[_0x3b3d('0x12')],_0x5b7c08);_0x5e9b40(_0x304f1e[_0x3b3d('0x10')](0x1f4,_0x511d7c[_0x3b3d('0x12')]));});});};exports[_0x3b3d('0x1c')]=function(_0x1da3b4){var _0x22dd9a=this;return new Promise(function(_0x14b9b0,_0x5921ee){return db[_0x3b3d('0x15')]['findAll']({'raw':_0x1da3b4['options']?_0x1da3b4['options'][_0x3b3d('0x18')]===undefined?!![]:![]:!![],'where':_0x1da3b4[_0x3b3d('0x17')]?_0x1da3b4[_0x3b3d('0x17')][_0x3b3d('0x1d')]||null:null,'attributes':[[db[_0x3b3d('0x1e')]['fn']('COUNT',db['sequelize'][_0x3b3d('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db[_0x3b3d('0x1e')]['fn']('COUNT',db[_0x3b3d('0x1e')]['fn']('IF',db['sequelize'][_0x3b3d('0x20')](_0x3b3d('0x21')))),_0x3b3d('0x22')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')]('`state`\x20=\x2010,\x201,\x20null'))),_0x3b3d('0x24')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn']('AVG',db[_0x3b3d('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x3b3d('0x25')))),_0x3b3d('0x26')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x27'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x3b3d('0x28')]]})[_0x3b3d('0xb')](function(_0x488224){logger[_0x3b3d('0x19')](_0x3b3d('0x1c'),_0x1da3b4);logger[_0x3b3d('0x1a')](_0x3b3d('0x1c'),_0x1da3b4,JSON[_0x3b3d('0xf')](_0x488224));_0x14b9b0(_0x488224);})[_0x3b3d('0x1b')](function(_0x22be39){logger[_0x3b3d('0x10')](_0x3b3d('0x1c'),_0x22be39['message'],_0x1da3b4);_0x5921ee(_0x22dd9a[_0x3b3d('0x10')](0x1f4,_0x22be39[_0x3b3d('0x12')]));});});};exports[_0x3b3d('0x29')]=function(_0x36e6d1){var _0x316d2d=this;return new Promise(function(_0xd95271,_0x4439eb){return db['CmHopperHistory'][_0x3b3d('0x2a')]({'raw':_0x36e6d1[_0x3b3d('0x17')]?_0x36e6d1[_0x3b3d('0x17')][_0x3b3d('0x18')]===undefined?!![]:![]:!![],'where':_0x36e6d1[_0x3b3d('0x17')]?_0x36e6d1[_0x3b3d('0x17')][_0x3b3d('0x1d')]||null:null,'attributes':[[_0x3b3d('0x2b'),_0x3b3d('0x2c')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db['sequelize'][_0x3b3d('0x20')](_0x3b3d('0x2d')))),_0x3b3d('0x2e')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')](_0x3b3d('0x2f')))),_0x3b3d('0x30')],[db['sequelize']['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db['sequelize'][_0x3b3d('0x20')](_0x3b3d('0x31')))),_0x3b3d('0x32')],[db['sequelize']['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')](_0x3b3d('0x33')))),_0x3b3d('0x34')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x3b3d('0x20')](_0x3b3d('0x35')))),_0x3b3d('0x36')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3b3d('0x37')],[db['sequelize']['fn'](_0x3b3d('0x23'),db['sequelize']['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')]['literal'](_0x3b3d('0x38')))),'outboundBlacklistCallsDay'],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x3b3d('0x20')](_0x3b3d('0x39')))),_0x3b3d('0x3a')],[db['sequelize']['fn']('COUNT',db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')]['literal'](_0x3b3d('0x3b')))),_0x3b3d('0x3c')],[db['sequelize']['fn']('COUNT',db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0x3b3d('0x3d')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')]('`state`\x20=\x2020,\x201,\x20null'))),_0x3b3d('0x3c')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db['sequelize']['fn']('IF',db[_0x3b3d('0x1e')][_0x3b3d('0x20')](_0x3b3d('0x3e')))),_0x3b3d('0x3f')]],'group':[_0x3b3d('0x2b')]})['then'](function(_0x1cb124){logger[_0x3b3d('0x19')]('GetVoiceQueueHopperHistory',_0x36e6d1);logger[_0x3b3d('0x1a')](_0x3b3d('0x29'),_0x36e6d1,JSON[_0x3b3d('0xf')](_0x1cb124));_0xd95271(_0x1cb124);})[_0x3b3d('0x1b')](function(_0x3e0768){logger[_0x3b3d('0x10')](_0x3b3d('0x29'),_0x3e0768[_0x3b3d('0x12')],_0x36e6d1);_0x4439eb(_0x316d2d[_0x3b3d('0x10')](0x1f4,_0x3e0768[_0x3b3d('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x5b33f9){var _0x4a60b2=this;return new Promise(function(_0x1f8183,_0x586bd5){return db[_0x3b3d('0x15')]['findAll']({'raw':_0x5b33f9[_0x3b3d('0x17')]?_0x5b33f9[_0x3b3d('0x17')][_0x3b3d('0x18')]===undefined?!![]:![]:!![],'where':_0x5b33f9[_0x3b3d('0x17')]?_0x5b33f9[_0x3b3d('0x17')]['where']||null:null,'attributes':[[_0x3b3d('0x2b'),'name'],[db[_0x3b3d('0x1e')]['fn']('COUNT',db['sequelize']['col']('id')),_0x3b3d('0x40')],[db[_0x3b3d('0x1e')]['fn'](_0x3b3d('0x23'),db[_0x3b3d('0x1e')]['fn']('IF',db[_0x3b3d('0x1e')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x3b3d('0x41')]],'group':[_0x3b3d('0x2b')]})['then'](function(_0x2c8ca2){logger[_0x3b3d('0x19')](_0x3b3d('0x42'),_0x5b33f9);logger[_0x3b3d('0x1a')]('GetCampaignHopperHistory',_0x5b33f9,JSON[_0x3b3d('0xf')](_0x2c8ca2));_0x1f8183(_0x2c8ca2);})['catch'](function(_0x44a767){logger[_0x3b3d('0x10')](_0x3b3d('0x42'),_0x44a767[_0x3b3d('0x12')],_0x5b33f9);_0x586bd5(_0x4a60b2[_0x3b3d('0x10')](0x1f4,_0x44a767[_0x3b3d('0x12')]));});});}; \ No newline at end of file +var _0x0834=['outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','campaign','name','ivrTotalCallsDays','ivrAnswerCallsDay','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','options','raw','CreateCmHopperHistory','CmHopperHistory','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x0834,0x18e));var _0x4083=function(_0x4eb8c6,_0x5afd27){_0x4eb8c6=_0x4eb8c6-0x0;var _0x6ddea8=_0x0834[_0x4eb8c6];return _0x6ddea8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4083('0x0'));var BPromise=require(_0x4083('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4083('0x2'));var logger=require(_0x4083('0x3'))('rpc');var config=require(_0x4083('0x4'));var jayson=require(_0x4083('0x5'));var client=jayson['client'][_0x4083('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5c5a54,_0x31c7ef,_0x26ed53){return new BPromise(function(_0x2c42bb,_0x1d56dd){return client[_0x4083('0x7')](_0x5c5a54,_0x26ed53)[_0x4083('0x8')](function(_0x3cee37){logger[_0x4083('0x9')](_0x4083('0xa'),_0x31c7ef,_0x4083('0xb'));logger[_0x4083('0xc')](_0x4083('0xd'),_0x31c7ef,_0x4083('0xb'),JSON[_0x4083('0xe')](_0x3cee37));if(_0x3cee37[_0x4083('0xf')]){if(_0x3cee37['error']['code']===0x1f4){logger[_0x4083('0xf')](_0x4083('0xa'),_0x31c7ef,_0x3cee37['error'][_0x4083('0x10')]);return _0x1d56dd(_0x3cee37[_0x4083('0xf')][_0x4083('0x10')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x31c7ef,_0x3cee37[_0x4083('0xf')][_0x4083('0x10')]);return _0x2c42bb(_0x3cee37['error'][_0x4083('0x10')]);}else{logger[_0x4083('0x9')](_0x4083('0xa'),_0x31c7ef,_0x4083('0xb'));_0x2c42bb(_0x3cee37[_0x4083('0x11')]['message']);}})[_0x4083('0x12')](function(_0x10cadd){logger[_0x4083('0xf')](_0x4083('0xa'),_0x31c7ef,_0x10cadd);_0x1d56dd(_0x10cadd);});});}exports['CreateCmHopperHistory']=function(_0x4e7d59){var _0x4d6089=this;return new Promise(function(_0xafda0c,_0x53d525){return db['CmHopperHistory'][_0x4083('0x13')](_0x4e7d59['body'],{'raw':_0x4e7d59[_0x4083('0x14')]?_0x4e7d59[_0x4083('0x14')][_0x4083('0x15')]===undefined?!![]:![]:!![]})[_0x4083('0x8')](function(_0x4b32e9){logger[_0x4083('0x9')]('CreateCmHopperHistory',_0x4e7d59);logger[_0x4083('0xc')](_0x4083('0x16'),_0x4e7d59,JSON[_0x4083('0xe')](_0x4b32e9));_0xafda0c(_0x4b32e9);})[_0x4083('0x12')](function(_0x5d7461){logger[_0x4083('0xf')]('CreateCmHopperHistory',_0x5d7461[_0x4083('0x10')],_0x4e7d59);_0x53d525(_0x4d6089[_0x4083('0xf')](0x1f4,_0x5d7461['message']));});});};exports['AvgHandleTime']=function(_0x3ce623){var _0x5b1f8a=this;return new Promise(function(_0x5d38e0,_0x5f034c){return db[_0x4083('0x17')][_0x4083('0x18')]({'raw':_0x3ce623[_0x4083('0x14')]?_0x3ce623['options'][_0x4083('0x15')]===undefined?!![]:![]:!![],'where':_0x3ce623[_0x4083('0x14')]?_0x3ce623[_0x4083('0x14')]['where']||null:null,'attributes':[[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db['sequelize'][_0x4083('0x1b')]('id')),_0x4083('0x1c')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x1e')))),_0x4083('0x1f')],[db['sequelize']['fn']('COUNT',db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x20')))),_0x4083('0x21')],[db[_0x4083('0x19')]['fn']('COUNT',db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x22')))),_0x4083('0x23')],[db[_0x4083('0x19')]['fn']('AVG',db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x24')))),_0x4083('0x25')],[db[_0x4083('0x19')]['fn']('AVG',db[_0x4083('0x19')]['fn']('IF',db['sequelize'][_0x4083('0x1d')](_0x4083('0x26')))),'predictiveIntervalAvgTalktime']]})[_0x4083('0x8')](function(_0xaeff25){logger[_0x4083('0x9')](_0x4083('0x27'),_0x3ce623);logger['debug']('AvgHandleTime',_0x3ce623,JSON[_0x4083('0xe')](_0xaeff25));_0x5d38e0(_0xaeff25);})[_0x4083('0x12')](function(_0x54267c){logger[_0x4083('0xf')]('AvgHandleTime',_0x54267c[_0x4083('0x10')],_0x3ce623);_0x5f034c(_0x5b1f8a['error'](0x1f4,_0x54267c['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x1f4d37){var _0x4080b1=this;return new Promise(function(_0x31347c,_0x6533ee){return db[_0x4083('0x17')]['findAll']({'raw':_0x1f4d37['options']?_0x1f4d37[_0x4083('0x14')][_0x4083('0x15')]===undefined?!![]:![]:!![],'where':_0x1f4d37['options']?_0x1f4d37[_0x4083('0x14')]['where']||null:null,'attributes':[['campaign','name'],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db['sequelize']['literal'](_0x4083('0x28')))),'outboundNoSuchCallsDay'],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x29')))),'outboundNoAnswerCallsDay'],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db['sequelize']['fn']('IF',db['sequelize'][_0x4083('0x1d')]('`state`\x20=\x204,\x201,\x20null'))),_0x4083('0x2a')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db['sequelize']['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x2b')))),'outboundBusyCallsDay'],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x2c')))),_0x4083('0x2d')],[db[_0x4083('0x19')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x2e')))),_0x4083('0x2f')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db['sequelize'][_0x4083('0x1d')](_0x4083('0x30')))),_0x4083('0x31')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db['sequelize']['fn']('IF',db[_0x4083('0x19')]['literal']('`state`\x20=\x2012,\x201,\x20null'))),_0x4083('0x32')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db['sequelize'][_0x4083('0x1d')]('`state`\x20=\x2013,\x201,\x20null'))),_0x4083('0x33')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db['sequelize']['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x34')))),'outboundOriginateFailureCallsDay'],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x35')))),_0x4083('0x36')],[db['sequelize']['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')]('`state`\x20=\x2016,\x201,\x20null'))),_0x4083('0x37')],[db['sequelize']['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db['sequelize'][_0x4083('0x1d')](_0x4083('0x38')))),_0x4083('0x36')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db['sequelize']['literal'](_0x4083('0x39')))),_0x4083('0x3a')]],'group':['campaign']})[_0x4083('0x8')](function(_0x367e67){logger[_0x4083('0x9')]('GetVoiceQueueHopperHistory',_0x1f4d37);logger[_0x4083('0xc')]('GetVoiceQueueHopperHistory',_0x1f4d37,JSON[_0x4083('0xe')](_0x367e67));_0x31347c(_0x367e67);})[_0x4083('0x12')](function(_0x209be3){logger[_0x4083('0xf')](_0x4083('0x3b'),_0x209be3['message'],_0x1f4d37);_0x6533ee(_0x4080b1['error'](0x1f4,_0x209be3[_0x4083('0x10')]));});});};exports['GetCampaignHopperHistory']=function(_0x3f2c0c){var _0xade4b0=this;return new Promise(function(_0x4d609e,_0x4b3434){return db[_0x4083('0x17')][_0x4083('0x18')]({'raw':_0x3f2c0c[_0x4083('0x14')]?_0x3f2c0c[_0x4083('0x14')][_0x4083('0x15')]===undefined?!![]:![]:!![],'where':_0x3f2c0c['options']?_0x3f2c0c[_0x4083('0x14')]['where']||null:null,'attributes':[[_0x4083('0x3c'),_0x4083('0x3d')],[db[_0x4083('0x19')]['fn']('COUNT',db[_0x4083('0x19')][_0x4083('0x1b')]('id')),_0x4083('0x3e')],[db[_0x4083('0x19')]['fn'](_0x4083('0x1a'),db[_0x4083('0x19')]['fn']('IF',db[_0x4083('0x19')][_0x4083('0x1d')](_0x4083('0x1e')))),_0x4083('0x3f')]],'group':[_0x4083('0x3c')]})[_0x4083('0x8')](function(_0x2858d7){logger[_0x4083('0x9')]('GetCampaignHopperHistory',_0x3f2c0c);logger[_0x4083('0xc')]('GetCampaignHopperHistory',_0x3f2c0c,JSON[_0x4083('0xe')](_0x2858d7));_0x4d609e(_0x2858d7);})[_0x4083('0x12')](function(_0x2a49ae){logger['error']('GetCampaignHopperHistory',_0x2a49ae[_0x4083('0x10')],_0x3f2c0c);_0x4b3434(_0xade4b0[_0x4083('0xf')](0x1f4,_0x2a49ae[_0x4083('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 5332599..254a802 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 _0xfe1a=['describe','show','post','create','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe'];(function(_0x972b32,_0x56ea80){var _0x6e8e75=function(_0x488ed9){while(--_0x488ed9){_0x972b32['push'](_0x972b32['shift']());}};_0x6e8e75(++_0x56ea80);}(_0xfe1a,0x183));var _0xafe1=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xfe1a[_0x21549c];return _0x426cbd;};'use strict';var multer=require('multer');var util=require(_0xafe1('0x0'));var path=require(_0xafe1('0x1'));var timeout=require(_0xafe1('0x2'));var express=require(_0xafe1('0x3'));var router=express[_0xafe1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xafe1('0x5'));var interaction=require(_0xafe1('0x6'));var config=require('../../config/environment');var controller=require(_0xafe1('0x7'));router[_0xafe1('0x8')]('/',auth[_0xafe1('0x9')](),controller[_0xafe1('0xa')]);router[_0xafe1('0x8')](_0xafe1('0xb'),auth[_0xafe1('0x9')](),controller[_0xafe1('0xc')]);router[_0xafe1('0x8')]('/:id',auth[_0xafe1('0x9')](),controller[_0xafe1('0xd')]);router[_0xafe1('0xe')]('/',auth[_0xafe1('0x9')](),controller[_0xafe1('0xf')]);router[_0xafe1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xafe1('0x11')]);module[_0xafe1('0x12')]=router; \ No newline at end of file +var _0xf90f=['show','post','put','update','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf90f,0x1d9));var _0xff90=function(_0x54961a,_0x11fb85){_0x54961a=_0x54961a-0x0;var _0x5a1d3f=_0xf90f[_0x54961a];return _0x5a1d3f;};'use strict';var multer=require(_0xff90('0x0'));var util=require(_0xff90('0x1'));var path=require(_0xff90('0x2'));var timeout=require('connect-timeout');var express=require(_0xff90('0x3'));var router=express['Router']();var fs_extra=require(_0xff90('0x4'));var auth=require(_0xff90('0x5'));var interaction=require(_0xff90('0x6'));var config=require(_0xff90('0x7'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0xff90('0x8')](),controller[_0xff90('0x9')]);router[_0xff90('0xa')](_0xff90('0xb'),auth[_0xff90('0x8')](),controller[_0xff90('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xff90('0xd')]);router[_0xff90('0xe')]('/',auth[_0xff90('0x8')](),controller['create']);router[_0xff90('0xf')]('/:id',auth[_0xff90('0x8')](),controller[_0xff90('0x10')]);module[_0xff90('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 8c1467f..5e94e1d 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 _0x383d=['STRING','name'];(function(_0x1a3b69,_0x5e8506){var _0x477940=function(_0x4600d5){while(--_0x4600d5){_0x1a3b69['push'](_0x1a3b69['shift']());}};_0x477940(++_0x5e8506);}(_0x383d,0x86));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd383('0x0')],'unique':_0xd383('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd383('0x0')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1e19=['name','sequelize','exports','STRING'];(function(_0x12971a,_0x309311){var _0x317bc5=function(_0x1d6917){while(--_0x1d6917){_0x12971a['push'](_0x12971a['shift']());}};_0x317bc5(++_0x309311);}(_0x1e19,0x1c9));var _0x91e1=function(_0x31d370,_0x8aa847){_0x31d370=_0x31d370-0x0;var _0x2c6e73=_0x1e19[_0x31d370];return _0x2c6e73;};'use strict';var Sequelize=require(_0x91e1('0x0'));module[_0x91e1('0x1')]={'name':{'type':Sequelize[_0x91e1('0x2')],'unique':_0x91e1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x91e1('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 b6db556..0b258b2 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 _0x531b=['nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','rows','show','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','addDisposition','ListId','Disposition','findOne','findAll','removeDispositions','ids','CmContact','isArray','tags','join','push','each','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','item','ItemTypeId\x20=\x20?','additionalPhone_','description','cm_contact_has_items','CmContactId\x20=\x20c.id','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','/tmp/list_%d_%s.csv','sendStatus','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','cf_%s','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./cmList.socket','register','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x531b,0x64));var _0xb531=function(_0x17049d,_0x345405){_0x17049d=_0x17049d-0x0;var _0xecc1dd=_0x531b[_0x17049d];return _0xecc1dd;};'use strict';var emlformat=require(_0xb531('0x0'));var rimraf=require(_0xb531('0x1'));var zipdir=require(_0xb531('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb531('0x3'));var moment=require(_0xb531('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb531('0x5'));var util=require(_0xb531('0x6'));var path=require(_0xb531('0x7'));var sox=require(_0xb531('0x8'));var csv=require('to-csv');var ejs=require(_0xb531('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb531('0xa'));var squel=require('squel');var crypto=require(_0xb531('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb531('0xc'));var toCsv=require(_0xb531('0xd'));var querystring=require(_0xb531('0xe'));var Papa=require(_0xb531('0xf'));var Redis=require(_0xb531('0x10'));var authService=require(_0xb531('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb531('0x12'));var utils=require(_0xb531('0x13'));var config=require(_0xb531('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb531('0x15'))['db'];var csv_results;config[_0xb531('0x16')]=_['defaults'](config[_0xb531('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xb531('0x17'))(new Redis(config['redis']));require(_0xb531('0x18'))[_0xb531('0x19')](socket);function respondWithStatusCode(_0x4984fd,_0x285ff2){_0x285ff2=_0x285ff2||0xcc;return function(_0x43b469){if(_0x43b469){return _0x4984fd['sendStatus'](_0x285ff2);}return _0x4984fd[_0xb531('0x1a')](_0x285ff2)[_0xb531('0x1b')]();};}function respondWithResult(_0x2c49cc,_0x1567d6){_0x1567d6=_0x1567d6||0xc8;return function(_0xe4d046){if(_0xe4d046){return _0x2c49cc['status'](_0x1567d6)[_0xb531('0x1c')](_0xe4d046);}};}function respondWithFilteredResult(_0x1268c5,_0xc5ffb6){return function(_0x5f24ba){if(_0x5f24ba){var _0x29086a=typeof _0xc5ffb6['offset']===_0xb531('0x1d')&&typeof _0xc5ffb6[_0xb531('0x1e')]===_0xb531('0x1d');var _0x265176=_0x5f24ba[_0xb531('0x1f')];var _0x20a622=_0x29086a?0x0:_0xc5ffb6['offset'];var _0x570a40=_0x29086a?_0x5f24ba[_0xb531('0x1f')]:_0xc5ffb6[_0xb531('0x20')]+_0xc5ffb6[_0xb531('0x1e')];var _0x224c2a;if(_0x570a40>=_0x265176){_0x570a40=_0x265176;_0x224c2a=0xc8;}else{_0x224c2a=0xce;}_0x1268c5[_0xb531('0x1a')](_0x224c2a);return _0x1268c5['set'](_0xb531('0x21'),_0x20a622+'-'+_0x570a40+'/'+_0x265176)['json'](_0x5f24ba);}return null;};}function patchUpdates(_0x85a5d2){return function(_0x4c2037){try{jsonpatch[_0xb531('0x22')](_0x4c2037,_0x85a5d2,!![]);}catch(_0x4c2849){return BPromise[_0xb531('0x23')](_0x4c2849);}return _0x4c2037[_0xb531('0x24')]();};}function saveUpdates(_0x8bf6f0,_0x332c4d){return function(_0x50f7f5){if(_0x50f7f5){return _0x50f7f5[_0xb531('0x25')](_0x8bf6f0)['then'](function(_0x121618){return _0x121618;});}return null;};}function removeEntity(_0x240fc0,_0x159cdf){return function(_0x492883){if(_0x492883){return _0x492883['destroy']()[_0xb531('0x26')](function(){var _0x1f6988=_0x492883['get']({'plain':!![]});var _0x3c3ef2=_0xb531('0x27');return db[_0xb531('0x28')]['destroy']({'where':{'type':_0x3c3ef2,'resourceId':_0x1f6988['id']}})['then'](function(){return _0x492883;});})[_0xb531('0x26')](function(){_0x240fc0[_0xb531('0x1a')](0xcc)[_0xb531('0x1b')]();});}};}function handleEntityNotFound(_0x2cbb8c,_0x22b529){return function(_0x8edc){if(!_0x8edc){_0x2cbb8c['sendStatus'](0x194);}return _0x8edc;};}function handleError(_0x445d3a,_0x49cb20){_0x49cb20=_0x49cb20||0x1f4;return function(_0x266540){logger[_0xb531('0x29')](_0x266540[_0xb531('0x2a')]);if(_0x266540[_0xb531('0x2b')]){delete _0x266540['name'];}_0x445d3a[_0xb531('0x1a')](_0x49cb20)[_0xb531('0x2c')](_0x266540);};}exports[_0xb531('0x2d')]=function(_0x143488,_0x2c94e6){var _0x5e97ce={},_0x49b0ba={},_0x54e4b3={'count':0x0,'rows':[]};var _0x4c3db2=_[_0xb531('0x2e')](db[_0xb531('0x2f')][_0xb531('0x30')],function(_0x1f8cec){return{'name':_0x1f8cec[_0xb531('0x31')],'type':_0x1f8cec[_0xb531('0x32')][_0xb531('0x33')]};});_0x49b0ba['model']=_['map'](_0x4c3db2,'name');_0x49b0ba[_0xb531('0x34')]=_[_0xb531('0x35')](_0x143488[_0xb531('0x34')]);_0x49b0ba['filters']=_[_0xb531('0x36')](_0x49b0ba['model'],_0x49b0ba[_0xb531('0x34')]);_0x5e97ce[_0xb531('0x37')]=_[_0xb531('0x36')](_0x49b0ba['model'],qs['fields'](_0x143488['query'][_0xb531('0x38')]));_0x5e97ce[_0xb531('0x37')]=_0x5e97ce['attributes'][_0xb531('0x39')]?_0x5e97ce['attributes']:_0x49b0ba[_0xb531('0x3a')];if(!_0x143488[_0xb531('0x34')][_0xb531('0x3b')](_0xb531('0x3c'))){_0x5e97ce['limit']=qs[_0xb531('0x1e')](_0x143488[_0xb531('0x34')][_0xb531('0x1e')]);_0x5e97ce[_0xb531('0x20')]=qs['offset'](_0x143488['query'][_0xb531('0x20')]);}_0x5e97ce[_0xb531('0x3d')]=qs[_0xb531('0x3e')](_0x143488[_0xb531('0x34')]['sort']);_0x5e97ce['where']=qs[_0xb531('0x3f')](_[_0xb531('0x40')](_0x143488[_0xb531('0x34')],_0x49b0ba[_0xb531('0x3f')]),_0x4c3db2);if(_0x143488[_0xb531('0x34')][_0xb531('0x41')]){_0x5e97ce[_0xb531('0x42')]=_[_0xb531('0x43')](_0x5e97ce[_0xb531('0x42')],{'$or':_[_0xb531('0x2e')](_0x4c3db2,function(_0x3b45f7){if(_0x3b45f7[_0xb531('0x32')]!=='VIRTUAL'){var _0x39284a={};_0x39284a[_0x3b45f7['name']]={'$like':'%'+_0x143488[_0xb531('0x34')][_0xb531('0x41')]+'%'};return _0x39284a;}})});}_0x5e97ce=_[_0xb531('0x43')]({},_0x5e97ce,_0x143488[_0xb531('0x44')]);var _0x42670c={'where':_0x5e97ce[_0xb531('0x42')]};return db['CmList'][_0xb531('0x1f')](_0x42670c)[_0xb531('0x26')](function(_0x10eb32){_0x54e4b3[_0xb531('0x1f')]=_0x10eb32;if(_0x143488[_0xb531('0x34')][_0xb531('0x45')]){_0x5e97ce['include']=[{'all':!![]}];}return db[_0xb531('0x2f')]['findAll'](_0x5e97ce);})[_0xb531('0x26')](function(_0x3849a5){_0x54e4b3[_0xb531('0x46')]=_0x3849a5;return _0x54e4b3;})[_0xb531('0x26')](respondWithFilteredResult(_0x2c94e6,_0x5e97ce))['catch'](handleError(_0x2c94e6,null));};exports[_0xb531('0x47')]=function(_0x15ba2b,_0x125663){var _0x3b3643={'raw':![],'where':{'id':_0x15ba2b['params']['id']}},_0x4106c={};_0x4106c[_0xb531('0x3a')]=_[_0xb531('0x35')](db[_0xb531('0x2f')]['rawAttributes']);_0x4106c[_0xb531('0x34')]=_[_0xb531('0x35')](_0x15ba2b[_0xb531('0x34')]);_0x4106c[_0xb531('0x3f')]=_[_0xb531('0x36')](_0x4106c[_0xb531('0x3a')],_0x4106c['query']);_0x3b3643['attributes']=_[_0xb531('0x36')](_0x4106c['model'],qs[_0xb531('0x38')](_0x15ba2b[_0xb531('0x34')][_0xb531('0x38')]));_0x3b3643[_0xb531('0x37')]=_0x3b3643['attributes'][_0xb531('0x39')]?_0x3b3643[_0xb531('0x37')]:_0x4106c[_0xb531('0x3a')];if(_0x15ba2b[_0xb531('0x34')][_0xb531('0x45')]){_0x3b3643[_0xb531('0x48')]=[{'all':!![]}];}_0x3b3643=_[_0xb531('0x43')]({},_0x3b3643,_0x15ba2b[_0xb531('0x44')]);return db['CmList'][_0xb531('0x49')](_0x3b3643)['then'](handleEntityNotFound(_0x125663,null))[_0xb531('0x26')](respondWithResult(_0x125663,null))['catch'](handleError(_0x125663,null));};exports[_0xb531('0x4a')]=function(_0x1636d6,_0x5ddc7f){return db[_0xb531('0x2f')][_0xb531('0x4a')](_0x1636d6[_0xb531('0x4b')],{})[_0xb531('0x26')](function(_0x2c122f){var _0x3517c8=_0x1636d6[_0xb531('0x4c')][_0xb531('0x4d')]({'plain':!![]});if(!_0x3517c8)throw new Error(_0xb531('0x4e'));if(_0x3517c8[_0xb531('0x4f')]===_0xb531('0x4c')){var _0x43f2db=_0x2c122f['get']({'plain':!![]});var _0x2049f7=_0xb531('0x27');return db['UserProfileSection'][_0xb531('0x49')]({'where':{'name':_0x2049f7,'userProfileId':_0x3517c8[_0xb531('0x50')]},'raw':!![]})[_0xb531('0x26')](function(_0x2d0a8f){if(_0x2d0a8f&&_0x2d0a8f[_0xb531('0x51')]===0x0){return db[_0xb531('0x28')][_0xb531('0x4a')]({'name':_0x43f2db[_0xb531('0x2b')],'resourceId':_0x43f2db['id'],'type':_0x2d0a8f[_0xb531('0x2b')],'sectionId':_0x2d0a8f['id']},{})['then'](function(){return _0x2c122f;});}else{return _0x2c122f;}})[_0xb531('0x52')](function(_0x91d439){logger['error'](_0xb531('0x53'),_0x91d439);throw _0x91d439;});}return _0x2c122f;})[_0xb531('0x26')](respondWithResult(_0x5ddc7f,0xc9))[_0xb531('0x52')](handleError(_0x5ddc7f,null));};exports[_0xb531('0x25')]=function(_0x23c1b0,_0x208233){if(_0x23c1b0[_0xb531('0x4b')]['id']){delete _0x23c1b0[_0xb531('0x4b')]['id'];}return db['CmList'][_0xb531('0x49')]({'where':{'id':_0x23c1b0[_0xb531('0x54')]['id']}})[_0xb531('0x26')](handleEntityNotFound(_0x208233,null))['then'](saveUpdates(_0x23c1b0[_0xb531('0x4b')],null))[_0xb531('0x26')](respondWithResult(_0x208233,null))[_0xb531('0x52')](handleError(_0x208233,null));};exports[_0xb531('0x55')]=function(_0x13d237,_0x208d40){return db['CmList'][_0xb531('0x49')]({'where':{'id':_0x13d237[_0xb531('0x54')]['id']}})['then'](handleEntityNotFound(_0x208d40,null))[_0xb531('0x26')](removeEntity(_0x208d40,null))[_0xb531('0x52')](handleError(_0x208d40,null));};exports[_0xb531('0x56')]=function(_0x1861a5,_0x952fb2){return db[_0xb531('0x2f')][_0xb531('0x56')]()[_0xb531('0x26')](respondWithResult(_0x952fb2,null))[_0xb531('0x52')](handleError(_0x952fb2,null));};exports[_0xb531('0x57')]=function(_0x5e627e,_0x4c691a,_0x310d71){if(_0x5e627e[_0xb531('0x4b')]['id']){delete _0x5e627e[_0xb531('0x4b')]['id'];}return db[_0xb531('0x2f')][_0xb531('0x49')]({'where':{'id':_0x5e627e['params']['id']}})['then'](handleEntityNotFound(_0x4c691a,null))[_0xb531('0x26')](function(_0x64495d){if(_0x64495d){_0x5e627e[_0xb531('0x4b')][_0xb531('0x58')]=_0x64495d['id'];return db[_0xb531('0x59')][_0xb531('0x4a')](_0x5e627e[_0xb531('0x4b')]);}})[_0xb531('0x26')](respondWithResult(_0x4c691a,null))[_0xb531('0x52')](handleError(_0x4c691a,null));};exports['getDispositions']=function(_0xd31df1,_0x137ad1,_0x407cb7){var _0x318e90={'raw':![],'where':{}};var _0x13e72f={};var _0x511f6e={'count':0x0,'rows':[]};return db[_0xb531('0x2f')][_0xb531('0x5a')]({'where':{'id':_0xd31df1['params']['id']}})['then'](handleEntityNotFound(_0x137ad1,null))[_0xb531('0x26')](function(_0x248ce6){if(_0x248ce6){_0x13e72f[_0xb531('0x3a')]=_[_0xb531('0x35')](db['Disposition']['rawAttributes']);_0x13e72f['query']=_[_0xb531('0x35')](_0xd31df1[_0xb531('0x34')]);_0x13e72f['filters']=_[_0xb531('0x36')](_0x13e72f[_0xb531('0x3a')],_0x13e72f['query']);_0x318e90['attributes']=_[_0xb531('0x36')](_0x13e72f[_0xb531('0x3a')],qs[_0xb531('0x38')](_0xd31df1[_0xb531('0x34')][_0xb531('0x38')]));_0x318e90['attributes']=_0x318e90['attributes'][_0xb531('0x39')]?_0x318e90[_0xb531('0x37')]:_0x13e72f[_0xb531('0x3a')];if(!_0xd31df1['query'][_0xb531('0x3b')](_0xb531('0x3c'))){_0x318e90['limit']=qs[_0xb531('0x1e')](_0xd31df1[_0xb531('0x34')]['limit']);_0x318e90[_0xb531('0x20')]=qs[_0xb531('0x20')](_0xd31df1[_0xb531('0x34')][_0xb531('0x20')]);}_0x318e90[_0xb531('0x3d')]=qs[_0xb531('0x3e')](_0xd31df1['query'][_0xb531('0x3e')]);_0x318e90[_0xb531('0x42')]=qs[_0xb531('0x3f')](_['pick'](_0xd31df1[_0xb531('0x34')],_0x13e72f[_0xb531('0x3f')]));_0x318e90[_0xb531('0x42')][_0xb531('0x58')]=_0x248ce6['id'];if(_0xd31df1[_0xb531('0x34')]['filter']){_0x318e90[_0xb531('0x42')]=_[_0xb531('0x43')](_0x318e90[_0xb531('0x42')],{'$or':_[_0xb531('0x2e')](_0x318e90['attributes'],function(_0xc9bcf){var _0x56192e={};_0x56192e[_0xc9bcf]={'$like':'%'+_0xd31df1[_0xb531('0x34')]['filter']+'%'};return _0x56192e;})});}_0x318e90=_[_0xb531('0x43')]({},_0x318e90,_0xd31df1[_0xb531('0x44')]);return db['Disposition'][_0xb531('0x1f')]({'where':_0x318e90[_0xb531('0x42')]})[_0xb531('0x26')](function(_0x295ce7){_0x511f6e[_0xb531('0x1f')]=_0x295ce7;if(_0xd31df1['query'][_0xb531('0x45')]){_0x318e90[_0xb531('0x48')]=[{'all':!![]}];}return db[_0xb531('0x59')][_0xb531('0x5b')](_0x318e90);})['then'](function(_0x153a6f){_0x511f6e[_0xb531('0x46')]=_0x153a6f;return _0x511f6e;});}})[_0xb531('0x26')](respondWithFilteredResult(_0x137ad1,_0x318e90))[_0xb531('0x52')](handleError(_0x137ad1,null));};exports[_0xb531('0x5c')]=function(_0x3f3784,_0x226cad,_0x32079b){return db['CmList'][_0xb531('0x49')]({'where':{'id':_0x3f3784[_0xb531('0x54')]['id']}})[_0xb531('0x26')](handleEntityNotFound(_0x226cad,null))[_0xb531('0x26')](function(_0x220c8a){if(_0x220c8a){return _0x220c8a[_0xb531('0x5c')](_0x3f3784[_0xb531('0x34')][_0xb531('0x5d')]);}})[_0xb531('0x26')](respondWithStatusCode(_0x226cad,null))[_0xb531('0x52')](handleError(_0x226cad,null));};exports['addContacts']=function(_0x4d2c8,_0xa36d97,_0x16ad13){return db[_0xb531('0x2f')][_0xb531('0x49')]({'where':{'id':_0x4d2c8['params']['id']}})[_0xb531('0x26')](handleEntityNotFound(_0xa36d97,null))[_0xb531('0x26')](function(_0x224053){if(_0x224053){var _0x5cdf05=[];var _0x17b2a7={'success':[],'errors':[]};return db[_0xb531('0x5e')][_0xb531('0x56')]()['then'](function(_0x7a7028){if(_0x4d2c8[_0xb531('0x4b')]['tags']&&_[_0xb531('0x5f')](_0x4d2c8[_0xb531('0x4b')][_0xb531('0x60')])){if(_0x4d2c8[_0xb531('0x4b')][_0xb531('0x60')]['length']){_0x4d2c8[_0xb531('0x4b')][_0xb531('0x60')]=_0x4d2c8[_0xb531('0x4b')][_0xb531('0x60')][_0xb531('0x61')](';')+';';}else{_0x4d2c8[_0xb531('0x4b')][_0xb531('0x60')]=null;}}else{_0x4d2c8['body'][_0xb531('0x60')]=null;}if(_0x4d2c8['body']&&_[_0xb531('0x5f')](_0x4d2c8[_0xb531('0x4b')])){for(var _0x34f807=0x0;_0x34f807<_0x4d2c8[_0xb531('0x4b')]['length'];_0x34f807+=0x1){_0x4d2c8[_0xb531('0x4b')][_0x34f807]['ListId']=_0x4d2c8[_0xb531('0x54')]['id'];_0x5cdf05[_0xb531('0x62')](_0x4d2c8[_0xb531('0x4b')][_0x34f807]);}return BPromise[_0xb531('0x63')](_0x5cdf05,function(_0x5e6f5a){return db[_0xb531('0x5e')][_0xb531('0x4a')](_[_0xb531('0x64')](_0x5e6f5a,[_0xb531('0x5d'),'id'])||{},{'fields':_[_0xb531('0x35')](_0x7a7028),'raw':!![]})[_0xb531('0x26')](function(_0x4cbbbc){_0x17b2a7['success'][_0xb531('0x62')](_0x4cbbbc[_0xb531('0x65')]);})[_0xb531('0x52')](function(_0x59957c){_0x17b2a7[_0xb531('0x66')][_0xb531('0x62')]({'data':_0x5e6f5a,'error':_0x59957c[_0xb531('0x67')]});});})[_0xb531('0x26')](function(_0x26abdb){return _0x17b2a7;})[_0xb531('0x52')](function(_0x432401){return _0x432401;});}else{_0xa36d97[_0xb531('0x1a')](0x190)[_0xb531('0x1c')]({'message':_0xb531('0x68')});}});}})[_0xb531('0x26')](respondWithResult(_0xa36d97,null))[_0xb531('0x52')](handleError(_0xa36d97,null));};exports[_0xb531('0x69')]=function(_0x1a1c5b,_0x3984ea,_0x527fcd){var _0x233a19;return db['CmList'][_0xb531('0x49')]({'where':{'id':_0x1a1c5b['params']['id']},'include':[{'model':db[_0xb531('0x6a')],'as':_0xb531('0x6b')}]})['then'](handleEntityNotFound(_0x3984ea,null))[_0xb531('0x26')](function(_0x3e3d00){if(_0x3e3d00){_0x233a19=_0x3e3d00;return db[_0xb531('0x5e')][_0xb531('0x30')];}})['then'](function(_0x3c9302){if(_0x3c9302){var _0x47d6db={};var _0x29c22d={};_0x29c22d[_0xb531('0x3a')]=_['concat'](_[_0xb531('0x35')](_0x3c9302),_[_0xb531('0x2e')](_0x233a19[_0xb531('0x6b')],function(_0x5269b0){return util[_0xb531('0x6c')](_0xb531('0x6d'),_0x5269b0['id']);}));_0x29c22d[_0xb531('0x34')]=_[_0xb531('0x35')](_0x1a1c5b[_0xb531('0x34')]);_0x29c22d[_0xb531('0x3f')]=_[_0xb531('0x36')](_0x29c22d[_0xb531('0x3a')],_0x29c22d[_0xb531('0x34')]);_0x47d6db[_0xb531('0x37')]=_[_0xb531('0x36')](_0x29c22d[_0xb531('0x3a')],qs[_0xb531('0x38')](_0x1a1c5b['query'][_0xb531('0x38')]));_0x47d6db[_0xb531('0x37')]=_0x47d6db['attributes'][_0xb531('0x39')]?_0x47d6db['attributes']:_0x29c22d[_0xb531('0x3a')];if(!_0x1a1c5b[_0xb531('0x34')][_0xb531('0x3b')](_0xb531('0x3c'))){_0x47d6db[_0xb531('0x1e')]=qs[_0xb531('0x1e')](_0x1a1c5b['query']['limit']);_0x47d6db[_0xb531('0x20')]=qs[_0xb531('0x20')](_0x1a1c5b[_0xb531('0x34')]['offset']);}_0x47d6db['order']=qs['sort'](_0x1a1c5b[_0xb531('0x34')]['sort']);_0x47d6db['where']=qs[_0xb531('0x3f')](_[_0xb531('0x40')](_0x1a1c5b['query'],_0x29c22d['filters']));_0x47d6db[_0xb531('0x6e')]=!![];if(_0x1a1c5b[_0xb531('0x34')][_0xb531('0x41')]){_0x47d6db[_0xb531('0x42')]=_[_0xb531('0x43')](_0x47d6db[_0xb531('0x42')],{'$or':_[_0xb531('0x2e')](_0x47d6db[_0xb531('0x37')],function(_0x5e9836){var _0x32993d={};_0x32993d[_0x5e9836]={'$like':'%'+_0x1a1c5b[_0xb531('0x34')][_0xb531('0x41')]+'%'};return _0x32993d;})});}_0x47d6db=_[_0xb531('0x43')]({},_0x47d6db,_0x1a1c5b['options']);return _0x233a19['getContacts'](_0x47d6db);}})[_0xb531('0x26')](respondWithResult(_0x3984ea,null))[_0xb531('0x52')](handleError(_0x3984ea,null));};exports['getContactsCsv']=function(_0x3db1f4,_0x122872,_0x539a3d){var _0x4a0ef6;var _0x428309;var _0x23ac20;var _0x5d5fda=_0x3db1f4[_0xb531('0x54')]['id'];csv_results=[];return db[_0xb531('0x6f')][_0xb531('0x5b')]({'attributes':['id',_0xb531('0x2b')],'raw':!![],'order':[_0xb531('0x70')]})['then'](function(_0xb9175b){_0x4a0ef6=_0xb9175b;var _0x1d5d1a=_[_0xb531('0x35')](db[_0xb531('0x5e')]['rawAttributes']);return db[_0xb531('0x6a')][_0xb531('0x5b')]({'raw':!![],'attributes':['id',_0xb531('0x71')]})['then'](function(_0x1c2662){_0x428309=_0x1c2662;var _0x3f1c13=squel[_0xb531('0x72')]()['fields'](_0x1d5d1a)[_0xb531('0x73')](_0xb531('0x74'),'c')[_0xb531('0x42')](_0xb531('0x75'),_0x5d5fda)['where']('c.deletedAt\x20is\x20null')[_0xb531('0x76')]();for(var _0xa22c46=0x0;_0xa22c46<_0x428309[_0xb531('0x39')];_0xa22c46++){_0x3f1c13[_0xb531('0x77')](_0xb531('0x78')+_0x428309[_0xa22c46]['id'],_0xb531('0x79')+_0x428309[_0xa22c46][_0xb531('0x71')]);}for(var _0xa22c46=0x0;_0xa22c46<_0x4a0ef6[_0xb531('0x39')];_0xa22c46++){_0x3f1c13[_0xb531('0x77')](squel[_0xb531('0x72')]()[_0xb531('0x77')](_0xb531('0x7a'))['from']('cm_contact_has_items')['where'](_0xb531('0x7b'),_0x4a0ef6[_0xa22c46]['id'])[_0xb531('0x42')]('CmContactId\x20=\x20c.id'),_0xb531('0x7c')+_0x4a0ef6[_0xa22c46]['name']);_0x3f1c13[_0xb531('0x77')](squel[_0xb531('0x72')]()[_0xb531('0x77')](_0xb531('0x7d'))[_0xb531('0x73')](_0xb531('0x7e'))[_0xb531('0x42')](_0xb531('0x7b'),_0x4a0ef6[_0xa22c46]['id'])[_0xb531('0x42')](_0xb531('0x7f')),'description_additionalPhone_'+_0x4a0ef6[_0xa22c46][_0xb531('0x2b')]);}var _0xa5a9f4=[];_0xa5a9f4[_0xb531('0x62')](_0x3f1c13['toString']());BPromise['each'](_0xa5a9f4,handleQuery)[_0xb531('0x26')](function(_0x5904d6){handleQuery(_0x3f1c13['toString']());var _0x3f5670=csv_results[0x0];if(!_[_0xb531('0x80')](_0x3f5670)){var _0x23b6f1=toCsv(_0x3f5670);var _0x317e65=Date['now']();fs[_0xb531('0x81')](util['format']('/tmp/list_%d_%s.csv',_0x5d5fda,_0x317e65),_0x23b6f1);_0x122872[_0xb531('0x82')](_0xb531('0x83'),_0xb531('0x84')+util['format']('list_%d_%s.csv',_0x5d5fda,_0x317e65));_0x122872[_0xb531('0x82')](_0xb531('0x85'),_0xb531('0x86'));return _0x122872[_0xb531('0x87')](util[_0xb531('0x6c')](_0xb531('0x88'),_0x5d5fda,_0x317e65));}else{return _0x122872[_0xb531('0x89')](0xcc);}});});});};exports[_0xb531('0x8a')]=function(_0x4e73b2,_0x467693,_0x5900fe){var _0x17c3f5;delete _0x4e73b2[_0xb531('0x4b')]['id'];return db[_0xb531('0x2f')][_0xb531('0x5a')]({'where':{'id':_0x4e73b2[_0xb531('0x54')]['id']}})[_0xb531('0x26')](handleEntityNotFound(_0x467693,null))[_0xb531('0x26')](function(_0x3eb875){if(_0x3eb875){return db[_0xb531('0x8b')][_0xb531('0x8c')](function(_0xa8d350){return db['CmCustomField'][_0xb531('0x4a')](_0x4e73b2[_0xb531('0x4b')],{'transaction':_0xa8d350})['then'](function(_0x24bc33){_0x17c3f5=_0x24bc33;return _0x3eb875[_0xb531('0x8d')](_0x24bc33,{'transaction':_0xa8d350});})[_0xb531('0x26')](function(){var _0x4d7724={'type':db[_0xb531('0x8e')][_0xb531('0x8f')],'transaction':_0xa8d350};switch(_0x4e73b2['body'][_0xb531('0x32')]){case'text':_0x4d7724[_0xb531('0x32')]=db[_0xb531('0x8e')][_0xb531('0x8f')];break;case _0xb531('0x90'):_0x4d7724['type']=db[_0xb531('0x8e')][_0xb531('0x91')];break;case _0xb531('0x92'):_0x4d7724[_0xb531('0x32')]=db['Sequelize'][_0xb531('0x93')];_0x4d7724['defaultValue']=![];break;default:}return db[_0xb531('0x8b')][_0xb531('0x94')]['addColumn'](_0xb531('0x74'),util[_0xb531('0x6c')](_0xb531('0x95'),_0x17c3f5['id']),_0x4d7724);})['then'](function(){return _0x17c3f5;});});}})[_0xb531('0x26')](respondWithResult(_0x467693,null))[_0xb531('0x52')](handleError(_0x467693,null));};exports['getCustomFields']=function(_0x109098,_0x3ca9e8,_0x204f69){var _0x550f8d={};var _0x4403de={};var _0x5e69a6;var _0x59bcc6;return db[_0xb531('0x2f')][_0xb531('0x5a')]({'where':{'id':_0x109098['params']['id']}})[_0xb531('0x26')](handleEntityNotFound(_0x3ca9e8,null))[_0xb531('0x26')](function(_0x3cd627){if(_0x3cd627){_0x5e69a6=_0x3cd627;_0x4403de['model']=_[_0xb531('0x35')](db[_0xb531('0x6a')][_0xb531('0x30')]);_0x4403de['query']=_[_0xb531('0x35')](_0x109098['query']);_0x4403de[_0xb531('0x3f')]=_['intersection'](_0x4403de[_0xb531('0x3a')],_0x4403de[_0xb531('0x34')]);_0x550f8d['attributes']=_[_0xb531('0x36')](_0x4403de['model'],qs[_0xb531('0x38')](_0x109098[_0xb531('0x34')][_0xb531('0x38')]));_0x550f8d['attributes']=_0x550f8d[_0xb531('0x37')]['length']?_0x550f8d[_0xb531('0x37')]:_0x4403de[_0xb531('0x3a')];_0x550f8d[_0xb531('0x3d')]=qs[_0xb531('0x3e')](_0x109098[_0xb531('0x34')]['sort']);_0x550f8d[_0xb531('0x42')]=qs[_0xb531('0x3f')](_[_0xb531('0x40')](_0x109098[_0xb531('0x34')],_0x4403de[_0xb531('0x3f')]));_0x550f8d[_0xb531('0x42')]=_[_0xb531('0x43')](_0x550f8d[_0xb531('0x42')],{'$or':[{'ListId':_0x3cd627['id']},{'ListId':null}]});if(_0x109098[_0xb531('0x34')][_0xb531('0x41')]){_0x550f8d[_0xb531('0x42')]=_['merge'](_0x550f8d[_0xb531('0x42')],{'$or':_[_0xb531('0x2e')](_0x550f8d[_0xb531('0x37')],function(_0x2d66e8){var _0x386568={};_0x386568[_0x2d66e8]={'$like':'%'+_0x109098[_0xb531('0x34')][_0xb531('0x41')]+'%'};return _0x386568;})});}_0x550f8d=_[_0xb531('0x43')]({},_0x550f8d,_0x109098['options']);return db[_0xb531('0x6a')]['findAndCountAll'](_0x550f8d);}})[_0xb531('0x26')](respondWithResult(_0x3ca9e8,null))['catch'](handleError(_0x3ca9e8,null));};exports['getGlobalCustomFields']=function(_0x4c1d99,_0x4a88ed){return db[_0xb531('0x6a')][_0xb531('0x96')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x4a88ed,null))[_0xb531('0x26')](function(_0x3d975b){return _0x3d975b;})['then'](respondWithResult(_0x4a88ed,null))[_0xb531('0x52')](handleError(_0x4a88ed,null));};exports['addAgents']=function(_0x50aefd,_0x307236,_0x1cb228){return db[_0xb531('0x2f')][_0xb531('0x49')]({'where':{'id':_0x50aefd['params']['id']}})['then'](handleEntityNotFound(_0x307236,null))['then'](function(_0x83a021){if(_0x83a021){return _0x83a021[_0xb531('0x97')](_0x50aefd['body'][_0xb531('0x5d')],_[_0xb531('0x64')](_0x50aefd[_0xb531('0x4b')],[_0xb531('0x5d'),'id'])||{})[_0xb531('0x98')](function(_0x4dd9df){for(var _0x5edb24=0x0;_0x5edb24<_0x50aefd[_0xb531('0x4b')]['ids']['length'];_0x5edb24+=0x1){socket['emit'](_0xb531('0x99'),{'UserId':Number(_0x50aefd[_0xb531('0x4b')]['ids'][_0x5edb24]),'CmListId':Number(_0x50aefd['params']['id'])});}return _0x4dd9df;});}})['then'](respondWithResult(_0x307236,null))[_0xb531('0x52')](handleError(_0x307236,null));};exports['removeAgents']=function(_0x37b961,_0x242d85,_0x4b39eb){return db[_0xb531('0x2f')][_0xb531('0x49')]({'where':{'id':_0x37b961[_0xb531('0x54')]['id']}})[_0xb531('0x26')](handleEntityNotFound(_0x242d85,null))[_0xb531('0x26')](function(_0x373cbc){if(_0x373cbc){return _0x373cbc[_0xb531('0x9a')](_0x37b961[_0xb531('0x34')]['ids'])[_0xb531('0x26')](function(){if(_['isArray'](_0x37b961['query'][_0xb531('0x5d')])){for(var _0x311832=0x0;_0x311832<_0x37b961[_0xb531('0x34')][_0xb531('0x5d')]['length'];_0x311832+=0x1){socket[_0xb531('0x9b')](_0xb531('0x9c'),{'UserId':Number(_0x37b961[_0xb531('0x34')][_0xb531('0x5d')][_0x311832]),'CmListId':Number(_0x37b961['params']['id'])});}}else{socket[_0xb531('0x9b')]('userCmList:remove',{'UserId':Number(_0x37b961[_0xb531('0x34')][_0xb531('0x5d')]),'CmListId':Number(_0x37b961[_0xb531('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x242d85,null))[_0xb531('0x52')](handleError(_0x242d85,null));};exports[_0xb531('0x9d')]=function(_0x55adf9,_0x11958b,_0x225988){var _0x4fc625={};var _0x3ddd99={};var _0x598a34;var _0x2821c1;return db[_0xb531('0x2f')][_0xb531('0x5a')]({'where':{'id':_0x55adf9['params']['id']}})[_0xb531('0x26')](handleEntityNotFound(_0x11958b,null))[_0xb531('0x26')](function(_0xb6864){if(_0xb6864){_0x598a34=_0xb6864;_0x3ddd99[_0xb531('0x3a')]=_[_0xb531('0x35')](db[_0xb531('0x9e')][_0xb531('0x30')]);_0x3ddd99[_0xb531('0x34')]=_[_0xb531('0x35')](_0x55adf9[_0xb531('0x34')]);_0x3ddd99['filters']=_[_0xb531('0x36')](_0x3ddd99['model'],_0x3ddd99[_0xb531('0x34')]);_0x4fc625[_0xb531('0x37')]=_[_0xb531('0x36')](_0x3ddd99[_0xb531('0x3a')],qs['fields'](_0x55adf9['query'][_0xb531('0x38')]));_0x4fc625[_0xb531('0x37')]=_0x4fc625[_0xb531('0x37')][_0xb531('0x39')]?_0x4fc625[_0xb531('0x37')]:_0x3ddd99[_0xb531('0x3a')];_0x4fc625[_0xb531('0x3d')]=qs[_0xb531('0x3e')](_0x55adf9[_0xb531('0x34')][_0xb531('0x3e')]);_0x4fc625[_0xb531('0x42')]=qs[_0xb531('0x3f')](_['pick'](_0x55adf9[_0xb531('0x34')],_0x3ddd99[_0xb531('0x3f')]));if(_0x55adf9[_0xb531('0x34')][_0xb531('0x41')]){_0x4fc625['where']=_[_0xb531('0x43')](_0x4fc625[_0xb531('0x42')],{'$or':_['map'](_0x4fc625[_0xb531('0x37')],function(_0x3c29a8){var _0x389db7={};_0x389db7[_0x3c29a8]={'$like':'%'+_0x55adf9[_0xb531('0x34')]['filter']+'%'};return _0x389db7;})});}_0x4fc625=_[_0xb531('0x43')]({},_0x4fc625,_0x55adf9[_0xb531('0x44')]);return _0x598a34[_0xb531('0x9d')](_0x4fc625);}})[_0xb531('0x26')](function(_0x441528){if(_0x441528){_0x2821c1=_0x441528[_0xb531('0x39')];if(!_0x55adf9[_0xb531('0x34')]['hasOwnProperty']('nolimit')){_0x4fc625[_0xb531('0x1e')]=qs[_0xb531('0x1e')](_0x55adf9[_0xb531('0x34')]['limit']);_0x4fc625['offset']=qs['offset'](_0x55adf9[_0xb531('0x34')][_0xb531('0x20')]);}return _0x598a34[_0xb531('0x9d')](_0x4fc625);}})[_0xb531('0x26')](function(_0x4053cd){if(_0x4053cd){return _0x4053cd?{'count':_0x2821c1,'rows':_0x4053cd}:null;}})[_0xb531('0x26')](respondWithResult(_0x11958b,null))[_0xb531('0x52')](handleError(_0x11958b,null));};function handleQuery(_0x25a6cc){logger[_0xb531('0x9f')](_0x25a6cc);return db[_0xb531('0x8b')]['query'](_0x25a6cc)[_0xb531('0x98')](function(_0x4de976){csv_results['push'](_0x4de976);})[_0xb531('0x52')](function(_0x3b12d0){logger['error'](_0x3b12d0['message']);});} \ No newline at end of file +var _0x91b7=['BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','Lists','UserProfileResource','sendStatus','error','stack','name','map','CmList','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','CmContact','tags','join','isArray','push','each','omit','success','errors','message','Malformed\x20request\x20syntax','getContacts','concat','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','text/csv','download','addCustomField','sequelize','transaction','CmCustomField','addCustomFields','Sequelize','TEXT','number','INTEGER','switch'];(function(_0x428328,_0x3d6dd2){var _0x14a0de=function(_0x2c5de1){while(--_0x2c5de1){_0x428328['push'](_0x428328['shift']());}};_0x14a0de(++_0x3d6dd2);}(_0x91b7,0x161));var _0x791b=function(_0x1b48cd,_0x4e1a55){_0x1b48cd=_0x1b48cd-0x0;var _0x11a3c8=_0x91b7[_0x1b48cd];return _0x11a3c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x791b('0x0'));var zipdir=require(_0x791b('0x1'));var jsonpatch=require(_0x791b('0x2'));var rp=require(_0x791b('0x3'));var moment=require(_0x791b('0x4'));var BPromise=require(_0x791b('0x5'));var Mustache=require(_0x791b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x791b('0x7'));var csv=require(_0x791b('0x8'));var ejs=require(_0x791b('0x9'));var fs=require('fs');var fs_extra=require(_0x791b('0xa'));var _=require(_0x791b('0xb'));var squel=require(_0x791b('0xc'));var crypto=require('crypto');var jsforce=require(_0x791b('0xd'));var deskjs=require(_0x791b('0xe'));var toCsv=require(_0x791b('0x8'));var querystring=require(_0x791b('0xf'));var Papa=require(_0x791b('0x10'));var Redis=require(_0x791b('0x11'));var authService=require(_0x791b('0x12'));var qs=require(_0x791b('0x13'));var as=require(_0x791b('0x14'));var hardwareService=require(_0x791b('0x15'));var logger=require(_0x791b('0x16'))('api');var utils=require(_0x791b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x791b('0x18'));var db=require(_0x791b('0x19'))['db'];var csv_results;config[_0x791b('0x1a')]=_[_0x791b('0x1b')](config[_0x791b('0x1a')],{'host':_0x791b('0x1c'),'port':0x18eb});var socket=require(_0x791b('0x1d'))(new Redis(config[_0x791b('0x1a')]));require(_0x791b('0x1e'))[_0x791b('0x1f')](socket);function respondWithStatusCode(_0x3312d6,_0x1857b4){_0x1857b4=_0x1857b4||0xcc;return function(_0x18dfdf){if(_0x18dfdf){return _0x3312d6['sendStatus'](_0x1857b4);}return _0x3312d6[_0x791b('0x20')](_0x1857b4)[_0x791b('0x21')]();};}function respondWithResult(_0x2b287b,_0x24b660){_0x24b660=_0x24b660||0xc8;return function(_0x1d4bb4){if(_0x1d4bb4){return _0x2b287b[_0x791b('0x20')](_0x24b660)[_0x791b('0x22')](_0x1d4bb4);}};}function respondWithFilteredResult(_0xe448e1,_0x1c624c){return function(_0x52b006){if(_0x52b006){var _0x37f1c2=typeof _0x1c624c[_0x791b('0x23')]===_0x791b('0x24')&&typeof _0x1c624c[_0x791b('0x25')]==='undefined';var _0x360aa4=_0x52b006[_0x791b('0x26')];var _0x1324de=_0x37f1c2?0x0:_0x1c624c['offset'];var _0x197b45=_0x37f1c2?_0x52b006['count']:_0x1c624c[_0x791b('0x23')]+_0x1c624c[_0x791b('0x25')];var _0x40b4d9;if(_0x197b45>=_0x360aa4){_0x197b45=_0x360aa4;_0x40b4d9=0xc8;}else{_0x40b4d9=0xce;}_0xe448e1[_0x791b('0x20')](_0x40b4d9);return _0xe448e1[_0x791b('0x27')]('Content-Range',_0x1324de+'-'+_0x197b45+'/'+_0x360aa4)[_0x791b('0x22')](_0x52b006);}return null;};}function patchUpdates(_0x158287){return function(_0x2a4bef){try{jsonpatch[_0x791b('0x28')](_0x2a4bef,_0x158287,!![]);}catch(_0x13a36e){return BPromise[_0x791b('0x29')](_0x13a36e);}return _0x2a4bef[_0x791b('0x2a')]();};}function saveUpdates(_0x36476f,_0x3ba7d4){return function(_0x4109bc){if(_0x4109bc){return _0x4109bc['update'](_0x36476f)[_0x791b('0x2b')](function(_0x105342){return _0x105342;});}return null;};}function removeEntity(_0x5ace1e,_0x18764b){return function(_0x54103e){if(_0x54103e){return _0x54103e[_0x791b('0x2c')]()[_0x791b('0x2b')](function(){var _0x2bb917=_0x54103e[_0x791b('0x2d')]({'plain':!![]});var _0x464398=_0x791b('0x2e');return db[_0x791b('0x2f')]['destroy']({'where':{'type':_0x464398,'resourceId':_0x2bb917['id']}})[_0x791b('0x2b')](function(){return _0x54103e;});})['then'](function(){_0x5ace1e[_0x791b('0x20')](0xcc)[_0x791b('0x21')]();});}};}function handleEntityNotFound(_0x3169e4,_0x350b13){return function(_0x1ed720){if(!_0x1ed720){_0x3169e4[_0x791b('0x30')](0x194);}return _0x1ed720;};}function handleError(_0x24c70d,_0x2fd562){_0x2fd562=_0x2fd562||0x1f4;return function(_0x44273f){logger[_0x791b('0x31')](_0x44273f[_0x791b('0x32')]);if(_0x44273f[_0x791b('0x33')]){delete _0x44273f[_0x791b('0x33')];}_0x24c70d[_0x791b('0x20')](_0x2fd562)['send'](_0x44273f);};}exports['index']=function(_0x195858,_0x58ecc4){var _0xc12592={},_0x533b2c={},_0x2fb273={'count':0x0,'rows':[]};var _0x49555b=_[_0x791b('0x34')](db[_0x791b('0x35')][_0x791b('0x36')],function(_0x3fc0fb){return{'name':_0x3fc0fb['fieldName'],'type':_0x3fc0fb[_0x791b('0x37')][_0x791b('0x38')]};});_0x533b2c[_0x791b('0x39')]=_[_0x791b('0x34')](_0x49555b,_0x791b('0x33'));_0x533b2c[_0x791b('0x3a')]=_[_0x791b('0x3b')](_0x195858[_0x791b('0x3a')]);_0x533b2c[_0x791b('0x3c')]=_[_0x791b('0x3d')](_0x533b2c[_0x791b('0x39')],_0x533b2c['query']);_0xc12592[_0x791b('0x3e')]=_[_0x791b('0x3d')](_0x533b2c[_0x791b('0x39')],qs[_0x791b('0x3f')](_0x195858['query']['fields']));_0xc12592[_0x791b('0x3e')]=_0xc12592[_0x791b('0x3e')][_0x791b('0x40')]?_0xc12592[_0x791b('0x3e')]:_0x533b2c[_0x791b('0x39')];if(!_0x195858[_0x791b('0x3a')]['hasOwnProperty'](_0x791b('0x41'))){_0xc12592[_0x791b('0x25')]=qs[_0x791b('0x25')](_0x195858[_0x791b('0x3a')][_0x791b('0x25')]);_0xc12592[_0x791b('0x23')]=qs[_0x791b('0x23')](_0x195858[_0x791b('0x3a')][_0x791b('0x23')]);}_0xc12592[_0x791b('0x42')]=qs[_0x791b('0x43')](_0x195858[_0x791b('0x3a')][_0x791b('0x43')]);_0xc12592[_0x791b('0x44')]=qs[_0x791b('0x3c')](_[_0x791b('0x45')](_0x195858[_0x791b('0x3a')],_0x533b2c[_0x791b('0x3c')]),_0x49555b);if(_0x195858['query'][_0x791b('0x46')]){_0xc12592[_0x791b('0x44')]=_[_0x791b('0x47')](_0xc12592[_0x791b('0x44')],{'$or':_[_0x791b('0x34')](_0x49555b,function(_0x9c21ce){if(_0x9c21ce[_0x791b('0x37')]!==_0x791b('0x48')){var _0x33bf1c={};_0x33bf1c[_0x9c21ce[_0x791b('0x33')]]={'$like':'%'+_0x195858[_0x791b('0x3a')][_0x791b('0x46')]+'%'};return _0x33bf1c;}})});}_0xc12592=_['merge']({},_0xc12592,_0x195858[_0x791b('0x49')]);var _0x1c1c63={'where':_0xc12592[_0x791b('0x44')]};return db[_0x791b('0x35')][_0x791b('0x26')](_0x1c1c63)[_0x791b('0x2b')](function(_0x20ada3){_0x2fb273[_0x791b('0x26')]=_0x20ada3;if(_0x195858['query'][_0x791b('0x4a')]){_0xc12592['include']=[{'all':!![]}];}return db[_0x791b('0x35')][_0x791b('0x4b')](_0xc12592);})[_0x791b('0x2b')](function(_0x31570d){_0x2fb273[_0x791b('0x4c')]=_0x31570d;return _0x2fb273;})[_0x791b('0x2b')](respondWithFilteredResult(_0x58ecc4,_0xc12592))[_0x791b('0x4d')](handleError(_0x58ecc4,null));};exports['show']=function(_0xe94386,_0x3a3a00){var _0x47307b={'raw':![],'where':{'id':_0xe94386[_0x791b('0x4e')]['id']}},_0x5bf6e4={};_0x5bf6e4[_0x791b('0x39')]=_[_0x791b('0x3b')](db[_0x791b('0x35')]['rawAttributes']);_0x5bf6e4[_0x791b('0x3a')]=_['keys'](_0xe94386[_0x791b('0x3a')]);_0x5bf6e4[_0x791b('0x3c')]=_['intersection'](_0x5bf6e4[_0x791b('0x39')],_0x5bf6e4[_0x791b('0x3a')]);_0x47307b[_0x791b('0x3e')]=_[_0x791b('0x3d')](_0x5bf6e4[_0x791b('0x39')],qs['fields'](_0xe94386['query'][_0x791b('0x3f')]));_0x47307b[_0x791b('0x3e')]=_0x47307b[_0x791b('0x3e')][_0x791b('0x40')]?_0x47307b[_0x791b('0x3e')]:_0x5bf6e4[_0x791b('0x39')];if(_0xe94386[_0x791b('0x3a')][_0x791b('0x4a')]){_0x47307b[_0x791b('0x4f')]=[{'all':!![]}];}_0x47307b=_[_0x791b('0x47')]({},_0x47307b,_0xe94386[_0x791b('0x49')]);return db[_0x791b('0x35')][_0x791b('0x50')](_0x47307b)[_0x791b('0x2b')](handleEntityNotFound(_0x3a3a00,null))[_0x791b('0x2b')](respondWithResult(_0x3a3a00,null))[_0x791b('0x4d')](handleError(_0x3a3a00,null));};exports[_0x791b('0x51')]=function(_0x3023b9,_0x26ee6){return db[_0x791b('0x35')][_0x791b('0x51')](_0x3023b9[_0x791b('0x52')],{})[_0x791b('0x2b')](function(_0x2d1b53){var _0x14892b=_0x3023b9['user']['get']({'plain':!![]});if(!_0x14892b)throw new Error(_0x791b('0x53'));if(_0x14892b['role']==='user'){var _0x1b30eb=_0x2d1b53[_0x791b('0x2d')]({'plain':!![]});var _0x953884=_0x791b('0x2e');return db[_0x791b('0x54')][_0x791b('0x50')]({'where':{'name':_0x953884,'userProfileId':_0x14892b[_0x791b('0x55')]},'raw':!![]})['then'](function(_0x5ed6fd){if(_0x5ed6fd&&_0x5ed6fd[_0x791b('0x56')]===0x0){return db['UserProfileResource'][_0x791b('0x51')]({'name':_0x1b30eb[_0x791b('0x33')],'resourceId':_0x1b30eb['id'],'type':_0x5ed6fd[_0x791b('0x33')],'sectionId':_0x5ed6fd['id']},{})[_0x791b('0x2b')](function(){return _0x2d1b53;});}else{return _0x2d1b53;}})[_0x791b('0x4d')](function(_0xfab115){logger[_0x791b('0x31')](_0x791b('0x57'),_0xfab115);throw _0xfab115;});}return _0x2d1b53;})[_0x791b('0x2b')](respondWithResult(_0x26ee6,0xc9))[_0x791b('0x4d')](handleError(_0x26ee6,null));};exports['update']=function(_0x57257f,_0xfa1fa5){if(_0x57257f[_0x791b('0x52')]['id']){delete _0x57257f['body']['id'];}return db[_0x791b('0x35')][_0x791b('0x50')]({'where':{'id':_0x57257f[_0x791b('0x4e')]['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0xfa1fa5,null))[_0x791b('0x2b')](saveUpdates(_0x57257f[_0x791b('0x52')],null))[_0x791b('0x2b')](respondWithResult(_0xfa1fa5,null))[_0x791b('0x4d')](handleError(_0xfa1fa5,null));};exports[_0x791b('0x2c')]=function(_0x2cdee1,_0x8dd962){return db[_0x791b('0x35')]['find']({'where':{'id':_0x2cdee1['params']['id']}})['then'](handleEntityNotFound(_0x8dd962,null))['then'](removeEntity(_0x8dd962,null))['catch'](handleError(_0x8dd962,null));};exports[_0x791b('0x58')]=function(_0x214735,_0x4766c4){return db[_0x791b('0x35')][_0x791b('0x58')]()[_0x791b('0x2b')](respondWithResult(_0x4766c4,null))[_0x791b('0x4d')](handleError(_0x4766c4,null));};exports[_0x791b('0x59')]=function(_0x3d47a9,_0x323442,_0xb9b3b4){if(_0x3d47a9['body']['id']){delete _0x3d47a9[_0x791b('0x52')]['id'];}return db['CmList'][_0x791b('0x50')]({'where':{'id':_0x3d47a9[_0x791b('0x4e')]['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0x323442,null))[_0x791b('0x2b')](function(_0x4cd340){if(_0x4cd340){_0x3d47a9[_0x791b('0x52')][_0x791b('0x5a')]=_0x4cd340['id'];return db[_0x791b('0x5b')][_0x791b('0x51')](_0x3d47a9[_0x791b('0x52')]);}})['then'](respondWithResult(_0x323442,null))['catch'](handleError(_0x323442,null));};exports[_0x791b('0x5c')]=function(_0x53709d,_0x4098d2,_0x4669ae){var _0x2a2226={'raw':![],'where':{}};var _0x199921={};var _0x28ae23={'count':0x0,'rows':[]};return db[_0x791b('0x35')][_0x791b('0x5d')]({'where':{'id':_0x53709d[_0x791b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4098d2,null))['then'](function(_0x443aad){if(_0x443aad){_0x199921[_0x791b('0x39')]=_[_0x791b('0x3b')](db[_0x791b('0x5b')][_0x791b('0x36')]);_0x199921[_0x791b('0x3a')]=_['keys'](_0x53709d[_0x791b('0x3a')]);_0x199921[_0x791b('0x3c')]=_[_0x791b('0x3d')](_0x199921['model'],_0x199921[_0x791b('0x3a')]);_0x2a2226[_0x791b('0x3e')]=_[_0x791b('0x3d')](_0x199921[_0x791b('0x39')],qs[_0x791b('0x3f')](_0x53709d[_0x791b('0x3a')]['fields']));_0x2a2226['attributes']=_0x2a2226[_0x791b('0x3e')][_0x791b('0x40')]?_0x2a2226[_0x791b('0x3e')]:_0x199921[_0x791b('0x39')];if(!_0x53709d[_0x791b('0x3a')][_0x791b('0x5e')]('nolimit')){_0x2a2226[_0x791b('0x25')]=qs[_0x791b('0x25')](_0x53709d[_0x791b('0x3a')]['limit']);_0x2a2226[_0x791b('0x23')]=qs[_0x791b('0x23')](_0x53709d[_0x791b('0x3a')]['offset']);}_0x2a2226[_0x791b('0x42')]=qs[_0x791b('0x43')](_0x53709d['query']['sort']);_0x2a2226['where']=qs['filters'](_[_0x791b('0x45')](_0x53709d[_0x791b('0x3a')],_0x199921['filters']));_0x2a2226[_0x791b('0x44')][_0x791b('0x5a')]=_0x443aad['id'];if(_0x53709d[_0x791b('0x3a')][_0x791b('0x46')]){_0x2a2226[_0x791b('0x44')]=_[_0x791b('0x47')](_0x2a2226[_0x791b('0x44')],{'$or':_[_0x791b('0x34')](_0x2a2226[_0x791b('0x3e')],function(_0x432532){var _0x26c37c={};_0x26c37c[_0x432532]={'$like':'%'+_0x53709d[_0x791b('0x3a')]['filter']+'%'};return _0x26c37c;})});}_0x2a2226=_['merge']({},_0x2a2226,_0x53709d[_0x791b('0x49')]);return db[_0x791b('0x5b')]['count']({'where':_0x2a2226[_0x791b('0x44')]})[_0x791b('0x2b')](function(_0x5336b6){_0x28ae23[_0x791b('0x26')]=_0x5336b6;if(_0x53709d['query'][_0x791b('0x4a')]){_0x2a2226[_0x791b('0x4f')]=[{'all':!![]}];}return db['Disposition'][_0x791b('0x4b')](_0x2a2226);})['then'](function(_0x279cf6){_0x28ae23['rows']=_0x279cf6;return _0x28ae23;});}})[_0x791b('0x2b')](respondWithFilteredResult(_0x4098d2,_0x2a2226))[_0x791b('0x4d')](handleError(_0x4098d2,null));};exports[_0x791b('0x5f')]=function(_0x2404e9,_0x49e734,_0x1f44f9){return db[_0x791b('0x35')][_0x791b('0x50')]({'where':{'id':_0x2404e9[_0x791b('0x4e')]['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0x49e734,null))[_0x791b('0x2b')](function(_0x1b33c8){if(_0x1b33c8){return _0x1b33c8[_0x791b('0x5f')](_0x2404e9[_0x791b('0x3a')][_0x791b('0x60')]);}})['then'](respondWithStatusCode(_0x49e734,null))['catch'](handleError(_0x49e734,null));};exports['addContacts']=function(_0xfbb6bd,_0x566eb5,_0x4b0cc5){return db[_0x791b('0x35')][_0x791b('0x50')]({'where':{'id':_0xfbb6bd[_0x791b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x566eb5,null))[_0x791b('0x2b')](function(_0x170f6e){if(_0x170f6e){var _0x1ef27d=[];var _0x420f99={'success':[],'errors':[]};return db[_0x791b('0x61')][_0x791b('0x58')]()[_0x791b('0x2b')](function(_0xc05672){if(_0xfbb6bd[_0x791b('0x52')][_0x791b('0x62')]&&_['isArray'](_0xfbb6bd['body']['tags'])){if(_0xfbb6bd[_0x791b('0x52')][_0x791b('0x62')]['length']){_0xfbb6bd[_0x791b('0x52')][_0x791b('0x62')]=_0xfbb6bd[_0x791b('0x52')][_0x791b('0x62')][_0x791b('0x63')](';')+';';}else{_0xfbb6bd['body'][_0x791b('0x62')]=null;}}else{_0xfbb6bd[_0x791b('0x52')]['tags']=null;}if(_0xfbb6bd['body']&&_[_0x791b('0x64')](_0xfbb6bd[_0x791b('0x52')])){for(var _0x38dbd6=0x0;_0x38dbd6<_0xfbb6bd[_0x791b('0x52')]['length'];_0x38dbd6+=0x1){_0xfbb6bd[_0x791b('0x52')][_0x38dbd6][_0x791b('0x5a')]=_0xfbb6bd[_0x791b('0x4e')]['id'];_0x1ef27d[_0x791b('0x65')](_0xfbb6bd['body'][_0x38dbd6]);}return BPromise[_0x791b('0x66')](_0x1ef27d,function(_0x44f384){return db['CmContact'][_0x791b('0x51')](_[_0x791b('0x67')](_0x44f384,[_0x791b('0x60'),'id'])||{},{'fields':_[_0x791b('0x3b')](_0xc05672),'raw':!![]})[_0x791b('0x2b')](function(_0x3b707d){_0x420f99[_0x791b('0x68')]['push'](_0x3b707d['dataValues']);})[_0x791b('0x4d')](function(_0x39b5be){_0x420f99[_0x791b('0x69')]['push']({'data':_0x44f384,'error':_0x39b5be[_0x791b('0x6a')]});});})[_0x791b('0x2b')](function(_0x1dc102){return _0x420f99;})[_0x791b('0x4d')](function(_0x1c70cc){return _0x1c70cc;});}else{_0x566eb5[_0x791b('0x20')](0x190)['json']({'message':_0x791b('0x6b')});}});}})[_0x791b('0x2b')](respondWithResult(_0x566eb5,null))['catch'](handleError(_0x566eb5,null));};exports[_0x791b('0x6c')]=function(_0x4ec82e,_0xcf41ce,_0xca043b){var _0x2cdc23;return db[_0x791b('0x35')]['find']({'where':{'id':_0x4ec82e[_0x791b('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x791b('0x2b')](handleEntityNotFound(_0xcf41ce,null))[_0x791b('0x2b')](function(_0x4e3415){if(_0x4e3415){_0x2cdc23=_0x4e3415;return db[_0x791b('0x61')][_0x791b('0x36')];}})[_0x791b('0x2b')](function(_0x5e4331){if(_0x5e4331){var _0x3f7e1d={};var _0x197b20={};_0x197b20[_0x791b('0x39')]=_[_0x791b('0x6d')](_[_0x791b('0x3b')](_0x5e4331),_['map'](_0x2cdc23[_0x791b('0x6e')],function(_0x298632){return util[_0x791b('0x6f')](_0x791b('0x70'),_0x298632['id']);}));_0x197b20['query']=_[_0x791b('0x3b')](_0x4ec82e[_0x791b('0x3a')]);_0x197b20[_0x791b('0x3c')]=_[_0x791b('0x3d')](_0x197b20['model'],_0x197b20['query']);_0x3f7e1d['attributes']=_['intersection'](_0x197b20[_0x791b('0x39')],qs[_0x791b('0x3f')](_0x4ec82e['query'][_0x791b('0x3f')]));_0x3f7e1d[_0x791b('0x3e')]=_0x3f7e1d[_0x791b('0x3e')]['length']?_0x3f7e1d[_0x791b('0x3e')]:_0x197b20['model'];if(!_0x4ec82e['query'][_0x791b('0x5e')](_0x791b('0x41'))){_0x3f7e1d[_0x791b('0x25')]=qs[_0x791b('0x25')](_0x4ec82e[_0x791b('0x3a')]['limit']);_0x3f7e1d[_0x791b('0x23')]=qs[_0x791b('0x23')](_0x4ec82e[_0x791b('0x3a')][_0x791b('0x23')]);}_0x3f7e1d[_0x791b('0x42')]=qs[_0x791b('0x43')](_0x4ec82e[_0x791b('0x3a')][_0x791b('0x43')]);_0x3f7e1d[_0x791b('0x44')]=qs['filters'](_[_0x791b('0x45')](_0x4ec82e[_0x791b('0x3a')],_0x197b20[_0x791b('0x3c')]));_0x3f7e1d[_0x791b('0x71')]=!![];if(_0x4ec82e['query'][_0x791b('0x46')]){_0x3f7e1d[_0x791b('0x44')]=_['merge'](_0x3f7e1d['where'],{'$or':_[_0x791b('0x34')](_0x3f7e1d[_0x791b('0x3e')],function(_0x254fb0){var _0x1bfb78={};_0x1bfb78[_0x254fb0]={'$like':'%'+_0x4ec82e['query'][_0x791b('0x46')]+'%'};return _0x1bfb78;})});}_0x3f7e1d=_[_0x791b('0x47')]({},_0x3f7e1d,_0x4ec82e[_0x791b('0x49')]);return _0x2cdc23['getContacts'](_0x3f7e1d);}})[_0x791b('0x2b')](respondWithResult(_0xcf41ce,null))[_0x791b('0x4d')](handleError(_0xcf41ce,null));};exports[_0x791b('0x72')]=function(_0x252591,_0x1dc6f7,_0x5321c8){var _0x349489;var _0x1739c1;var _0x3de023;var _0xa37a60=_0x252591[_0x791b('0x4e')]['id'];csv_results=[];return db[_0x791b('0x73')][_0x791b('0x4b')]({'attributes':['id','name'],'raw':!![],'order':[_0x791b('0x74')]})[_0x791b('0x2b')](function(_0x1f5f84){_0x349489=_0x1f5f84;var _0xedf09e=_['keys'](db[_0x791b('0x61')][_0x791b('0x36')]);return db['CmCustomField'][_0x791b('0x4b')]({'raw':!![],'attributes':['id',_0x791b('0x75')]})[_0x791b('0x2b')](function(_0x443fd6){_0x1739c1=_0x443fd6;var _0x2817ee=squel[_0x791b('0x76')]()[_0x791b('0x3f')](_0xedf09e)[_0x791b('0x77')](_0x791b('0x78'),'c')[_0x791b('0x44')](_0x791b('0x79'),_0xa37a60)[_0x791b('0x44')](_0x791b('0x7a'))[_0x791b('0x7b')]();for(var _0x2cf3f4=0x0;_0x2cf3f4<_0x1739c1['length'];_0x2cf3f4++){_0x2817ee[_0x791b('0x7c')](_0x791b('0x7d')+_0x1739c1[_0x2cf3f4]['id'],_0x791b('0x7e')+_0x1739c1[_0x2cf3f4]['alias']);}for(var _0x2cf3f4=0x0;_0x2cf3f4<_0x349489[_0x791b('0x40')];_0x2cf3f4++){_0x2817ee[_0x791b('0x7c')](squel[_0x791b('0x76')]()[_0x791b('0x7c')](_0x791b('0x7f'))[_0x791b('0x77')]('cm_contact_has_items')['where'](_0x791b('0x80'),_0x349489[_0x2cf3f4]['id'])[_0x791b('0x44')](_0x791b('0x81')),_0x791b('0x82')+_0x349489[_0x2cf3f4][_0x791b('0x33')]);_0x2817ee[_0x791b('0x7c')](squel[_0x791b('0x76')]()[_0x791b('0x7c')](_0x791b('0x83'))[_0x791b('0x77')](_0x791b('0x84'))[_0x791b('0x44')](_0x791b('0x80'),_0x349489[_0x2cf3f4]['id'])[_0x791b('0x44')](_0x791b('0x81')),_0x791b('0x85')+_0x349489[_0x2cf3f4][_0x791b('0x33')]);}var _0x522de4=[];_0x522de4[_0x791b('0x65')](_0x2817ee['toString']());BPromise['each'](_0x522de4,handleQuery)[_0x791b('0x2b')](function(_0x3431ff){handleQuery(_0x2817ee[_0x791b('0x86')]());var _0x5a3e9a=csv_results[0x0];if(!_[_0x791b('0x87')](_0x5a3e9a)){var _0x1cfacd=toCsv(_0x5a3e9a);var _0x3f8e4b=Date[_0x791b('0x88')]();fs[_0x791b('0x89')](util['format'](_0x791b('0x8a'),_0xa37a60,_0x3f8e4b),_0x1cfacd);_0x1dc6f7[_0x791b('0x8b')](_0x791b('0x8c'),'attachment;\x20filename='+util['format'](_0x791b('0x8d'),_0xa37a60,_0x3f8e4b));_0x1dc6f7[_0x791b('0x8b')]('Content-type',_0x791b('0x8e'));return _0x1dc6f7[_0x791b('0x8f')](util['format'](_0x791b('0x8a'),_0xa37a60,_0x3f8e4b));}else{return _0x1dc6f7[_0x791b('0x30')](0xcc);}});});});};exports[_0x791b('0x90')]=function(_0x49da06,_0x2006fb,_0x13bc0f){var _0x591e3b;delete _0x49da06['body']['id'];return db['CmList'][_0x791b('0x5d')]({'where':{'id':_0x49da06['params']['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0x2006fb,null))[_0x791b('0x2b')](function(_0x23bb0d){if(_0x23bb0d){return db[_0x791b('0x91')][_0x791b('0x92')](function(_0x3a5ce4){return db[_0x791b('0x93')][_0x791b('0x51')](_0x49da06['body'],{'transaction':_0x3a5ce4})['then'](function(_0x15f002){_0x591e3b=_0x15f002;return _0x23bb0d[_0x791b('0x94')](_0x15f002,{'transaction':_0x3a5ce4});})['then'](function(){var _0x240c82={'type':db[_0x791b('0x95')][_0x791b('0x96')],'transaction':_0x3a5ce4};switch(_0x49da06[_0x791b('0x52')]['type']){case'text':_0x240c82[_0x791b('0x37')]=db[_0x791b('0x95')][_0x791b('0x96')];break;case _0x791b('0x97'):_0x240c82[_0x791b('0x37')]=db[_0x791b('0x95')][_0x791b('0x98')];break;case _0x791b('0x99'):_0x240c82[_0x791b('0x37')]=db['Sequelize'][_0x791b('0x9a')];_0x240c82[_0x791b('0x9b')]=![];break;default:}return db['sequelize'][_0x791b('0x9c')][_0x791b('0x9d')](_0x791b('0x78'),util[_0x791b('0x6f')](_0x791b('0x9e'),_0x591e3b['id']),_0x240c82);})[_0x791b('0x2b')](function(){return _0x591e3b;});});}})[_0x791b('0x2b')](respondWithResult(_0x2006fb,null))['catch'](handleError(_0x2006fb,null));};exports[_0x791b('0x9f')]=function(_0x336048,_0x3e7c7c,_0x147e5e){var _0x3d875c={};var _0x39de5d={};var _0x19e648;var _0x4412f6;return db[_0x791b('0x35')][_0x791b('0x5d')]({'where':{'id':_0x336048[_0x791b('0x4e')]['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0x3e7c7c,null))[_0x791b('0x2b')](function(_0x18008b){if(_0x18008b){_0x19e648=_0x18008b;_0x39de5d[_0x791b('0x39')]=_[_0x791b('0x3b')](db[_0x791b('0x93')][_0x791b('0x36')]);_0x39de5d[_0x791b('0x3a')]=_[_0x791b('0x3b')](_0x336048[_0x791b('0x3a')]);_0x39de5d['filters']=_[_0x791b('0x3d')](_0x39de5d[_0x791b('0x39')],_0x39de5d[_0x791b('0x3a')]);_0x3d875c[_0x791b('0x3e')]=_[_0x791b('0x3d')](_0x39de5d[_0x791b('0x39')],qs[_0x791b('0x3f')](_0x336048[_0x791b('0x3a')]['fields']));_0x3d875c[_0x791b('0x3e')]=_0x3d875c[_0x791b('0x3e')][_0x791b('0x40')]?_0x3d875c[_0x791b('0x3e')]:_0x39de5d['model'];_0x3d875c['order']=qs[_0x791b('0x43')](_0x336048[_0x791b('0x3a')][_0x791b('0x43')]);_0x3d875c[_0x791b('0x44')]=qs[_0x791b('0x3c')](_['pick'](_0x336048[_0x791b('0x3a')],_0x39de5d[_0x791b('0x3c')]));_0x3d875c[_0x791b('0x44')]=_[_0x791b('0x47')](_0x3d875c[_0x791b('0x44')],{'$or':[{'ListId':_0x18008b['id']},{'ListId':null}]});if(_0x336048[_0x791b('0x3a')][_0x791b('0x46')]){_0x3d875c[_0x791b('0x44')]=_[_0x791b('0x47')](_0x3d875c[_0x791b('0x44')],{'$or':_[_0x791b('0x34')](_0x3d875c[_0x791b('0x3e')],function(_0x332360){var _0x4f30e1={};_0x4f30e1[_0x332360]={'$like':'%'+_0x336048[_0x791b('0x3a')][_0x791b('0x46')]+'%'};return _0x4f30e1;})});}_0x3d875c=_[_0x791b('0x47')]({},_0x3d875c,_0x336048['options']);return db[_0x791b('0x93')]['findAndCountAll'](_0x3d875c);}})[_0x791b('0x2b')](respondWithResult(_0x3e7c7c,null))[_0x791b('0x4d')](handleError(_0x3e7c7c,null));};exports[_0x791b('0xa0')]=function(_0x31e2cd,_0x56ecfc){return db[_0x791b('0x93')][_0x791b('0xa1')]({'where':{'ListId':null}})[_0x791b('0x2b')](handleEntityNotFound(_0x56ecfc,null))['then'](function(_0x2ba012){return _0x2ba012;})[_0x791b('0x2b')](respondWithResult(_0x56ecfc,null))[_0x791b('0x4d')](handleError(_0x56ecfc,null));};exports['addAgents']=function(_0x32e559,_0x33e171,_0x314663){return db['CmList'][_0x791b('0x50')]({'where':{'id':_0x32e559[_0x791b('0x4e')]['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0x33e171,null))['then'](function(_0x1246e9){if(_0x1246e9){return _0x1246e9['addAgents'](_0x32e559[_0x791b('0x52')][_0x791b('0x60')],_[_0x791b('0x67')](_0x32e559[_0x791b('0x52')],[_0x791b('0x60'),'id'])||{})[_0x791b('0xa2')](function(_0x5b8545){for(var _0x5b9292=0x0;_0x5b9292<_0x32e559[_0x791b('0x52')][_0x791b('0x60')][_0x791b('0x40')];_0x5b9292+=0x1){socket[_0x791b('0xa3')](_0x791b('0xa4'),{'UserId':Number(_0x32e559[_0x791b('0x52')][_0x791b('0x60')][_0x5b9292]),'CmListId':Number(_0x32e559['params']['id'])});}return _0x5b8545;});}})[_0x791b('0x2b')](respondWithResult(_0x33e171,null))[_0x791b('0x4d')](handleError(_0x33e171,null));};exports[_0x791b('0xa5')]=function(_0xb99ec6,_0x1f6c22,_0x586be7){return db[_0x791b('0x35')][_0x791b('0x50')]({'where':{'id':_0xb99ec6[_0x791b('0x4e')]['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0x1f6c22,null))[_0x791b('0x2b')](function(_0x587694){if(_0x587694){return _0x587694['removeAgents'](_0xb99ec6[_0x791b('0x3a')][_0x791b('0x60')])[_0x791b('0x2b')](function(){if(_[_0x791b('0x64')](_0xb99ec6['query'][_0x791b('0x60')])){for(var _0xb82ac8=0x0;_0xb82ac8<_0xb99ec6[_0x791b('0x3a')][_0x791b('0x60')][_0x791b('0x40')];_0xb82ac8+=0x1){socket[_0x791b('0xa3')]('userCmList:remove',{'UserId':Number(_0xb99ec6[_0x791b('0x3a')][_0x791b('0x60')][_0xb82ac8]),'CmListId':Number(_0xb99ec6[_0x791b('0x4e')]['id'])});}}else{socket['emit'](_0x791b('0xa6'),{'UserId':Number(_0xb99ec6[_0x791b('0x3a')][_0x791b('0x60')]),'CmListId':Number(_0xb99ec6[_0x791b('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x1f6c22,null))[_0x791b('0x4d')](handleError(_0x1f6c22,null));};exports[_0x791b('0xa7')]=function(_0x1d8e66,_0x32b7d5,_0x57ca8b){var _0x317155={};var _0x467e6c={};var _0x512e0d;var _0x1556a9;return db[_0x791b('0x35')][_0x791b('0x5d')]({'where':{'id':_0x1d8e66['params']['id']}})[_0x791b('0x2b')](handleEntityNotFound(_0x32b7d5,null))[_0x791b('0x2b')](function(_0x25a8f6){if(_0x25a8f6){_0x512e0d=_0x25a8f6;_0x467e6c[_0x791b('0x39')]=_['keys'](db[_0x791b('0xa8')][_0x791b('0x36')]);_0x467e6c['query']=_['keys'](_0x1d8e66['query']);_0x467e6c[_0x791b('0x3c')]=_[_0x791b('0x3d')](_0x467e6c[_0x791b('0x39')],_0x467e6c[_0x791b('0x3a')]);_0x317155[_0x791b('0x3e')]=_[_0x791b('0x3d')](_0x467e6c[_0x791b('0x39')],qs[_0x791b('0x3f')](_0x1d8e66['query']['fields']));_0x317155[_0x791b('0x3e')]=_0x317155[_0x791b('0x3e')][_0x791b('0x40')]?_0x317155[_0x791b('0x3e')]:_0x467e6c[_0x791b('0x39')];_0x317155[_0x791b('0x42')]=qs[_0x791b('0x43')](_0x1d8e66[_0x791b('0x3a')][_0x791b('0x43')]);_0x317155[_0x791b('0x44')]=qs[_0x791b('0x3c')](_[_0x791b('0x45')](_0x1d8e66[_0x791b('0x3a')],_0x467e6c[_0x791b('0x3c')]));if(_0x1d8e66[_0x791b('0x3a')][_0x791b('0x46')]){_0x317155[_0x791b('0x44')]=_[_0x791b('0x47')](_0x317155[_0x791b('0x44')],{'$or':_['map'](_0x317155[_0x791b('0x3e')],function(_0x344d9a){var _0x5a63a9={};_0x5a63a9[_0x344d9a]={'$like':'%'+_0x1d8e66['query']['filter']+'%'};return _0x5a63a9;})});}_0x317155=_[_0x791b('0x47')]({},_0x317155,_0x1d8e66[_0x791b('0x49')]);return _0x512e0d['getAgents'](_0x317155);}})['then'](function(_0x90d11){if(_0x90d11){_0x1556a9=_0x90d11[_0x791b('0x40')];if(!_0x1d8e66[_0x791b('0x3a')][_0x791b('0x5e')](_0x791b('0x41'))){_0x317155['limit']=qs['limit'](_0x1d8e66[_0x791b('0x3a')]['limit']);_0x317155[_0x791b('0x23')]=qs[_0x791b('0x23')](_0x1d8e66['query'][_0x791b('0x23')]);}return _0x512e0d[_0x791b('0xa7')](_0x317155);}})['then'](function(_0x490671){if(_0x490671){return _0x490671?{'count':_0x1556a9,'rows':_0x490671}:null;}})[_0x791b('0x2b')](respondWithResult(_0x32b7d5,null))['catch'](handleError(_0x32b7d5,null));};function handleQuery(_0x80ac4d){logger['info'](_0x80ac4d);return db[_0x791b('0x91')][_0x791b('0x3a')](_0x80ac4d)['spread'](function(_0x1bfc4b){csv_results[_0x791b('0x65')](_0x1bfc4b);})['catch'](function(_0x2aed7f){logger[_0x791b('0x31')](_0x2aed7f[_0x791b('0x6a')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index ae5a9d8..7f59ee8 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x3cff6f,_0x179de0){var _0x45583d=function(_0x46a9ae){while(--_0x46a9ae){_0x3cff6f['push'](_0x3cff6f['shift']());}};_0x45583d(++_0x179de0);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0x55ca,0x126));var _0xa55c=function(_0xf3e4a0,_0x16a172){_0xf3e4a0=_0xf3e4a0-0x0;var _0x43f1cc=_0x55ca[_0xf3e4a0];return _0x43f1cc;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 3c06418..9f1964d 100644 --- a/server/api/cmList/cmList.model.js +++ b/server/api/cmList/cmList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash','util','api','moment','bluebird','path'];(function(_0x32eab7,_0x54df7a){var _0x440680=function(_0xdbc5cd){while(--_0xdbc5cd){_0x32eab7['push'](_0x32eab7['shift']());}};_0x440680(++_0x54df7a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1fde83,_0x19c888){_0x1fde83=_0x1fde83-0x0;var _0x472d98=_0xb43b[_0x1fde83];return _0x472d98;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','CmList','util'];(function(_0x23e8d2,_0x4c2e4a){var _0x5989c6=function(_0xc71bb1){while(--_0xc71bb1){_0x23e8d2['push'](_0x23e8d2['shift']());}};_0x5989c6(++_0x4c2e4a);}(_0xedd9,0xfc));var _0x9edd=function(_0x34388d,_0x2d6443){_0x34388d=_0x34388d-0x0;var _0x5e388c=_0xedd9[_0x34388d];return _0x5e388c;};'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':'cm_lists','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 d442db5..c724c8f 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 _0x58d7=['request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x58d7,0x135));var _0x758d=function(_0x32ada5,_0x37143a){_0x32ada5=_0x32ada5-0x0;var _0x36d998=_0x58d7[_0x32ada5];return _0x36d998;};'use strict';var _=require('lodash');var util=require(_0x758d('0x0'));var moment=require(_0x758d('0x1'));var BPromise=require(_0x758d('0x2'));var rs=require(_0x758d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x758d('0x4'))['db'];var utils=require(_0x758d('0x5'));var logger=require(_0x758d('0x6'))(_0x758d('0x7'));var config=require(_0x758d('0x8'));var jayson=require(_0x758d('0x9'));var client=jayson['client'][_0x758d('0xa')]({'port':0x232a});config[_0x758d('0xb')]=_[_0x758d('0xc')](config[_0x758d('0xb')],{'host':_0x758d('0xd'),'port':0x18eb});var socket=require(_0x758d('0xe'))(new Redis(config[_0x758d('0xb')]));require(_0x758d('0xf'))[_0x758d('0x10')](socket);function respondWithRpcPromise(_0x3e9c5e,_0x1c6573,_0x54d74f){return new BPromise(function(_0x2c234e,_0x96338c){return client[_0x758d('0x11')](_0x3e9c5e,_0x54d74f)[_0x758d('0x12')](function(_0xc81776){logger[_0x758d('0x13')](_0x758d('0x14'),_0x1c6573,_0x758d('0x15'));logger[_0x758d('0x16')](_0x758d('0x17'),_0x1c6573,_0x758d('0x15'),JSON[_0x758d('0x18')](_0xc81776));if(_0xc81776[_0x758d('0x19')]){if(_0xc81776[_0x758d('0x19')][_0x758d('0x1a')]===0x1f4){logger[_0x758d('0x19')]('CmList,\x20%s,\x20%s',_0x1c6573,_0xc81776[_0x758d('0x19')][_0x758d('0x1b')]);return _0x96338c(_0xc81776[_0x758d('0x19')][_0x758d('0x1b')]);}logger['error'](_0x758d('0x14'),_0x1c6573,_0xc81776[_0x758d('0x19')]['message']);return _0x2c234e(_0xc81776['error'][_0x758d('0x1b')]);}else{logger[_0x758d('0x13')](_0x758d('0x14'),_0x1c6573,_0x758d('0x15'));_0x2c234e(_0xc81776[_0x758d('0x1c')][_0x758d('0x1b')]);}})[_0x758d('0x1d')](function(_0x1aaa67){logger[_0x758d('0x19')]('CmList,\x20%s,\x20%s',_0x1c6573,_0x1aaa67);_0x96338c(_0x1aaa67);});});} \ No newline at end of file +var _0xfcd0=['jayson/promise','redis','defaults','localhost','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0xfcd0,0x1cb));var _0x0fcd=function(_0x33339b,_0x4130e6){_0x33339b=_0x33339b-0x0;var _0x56659e=_0xfcd0[_0x33339b];return _0x56659e;};'use strict';var _=require('lodash');var util=require(_0x0fcd('0x0'));var moment=require('moment');var BPromise=require(_0x0fcd('0x1'));var rs=require(_0x0fcd('0x2'));var fs=require('fs');var Redis=require(_0x0fcd('0x3'));var db=require(_0x0fcd('0x4'))['db'];var utils=require(_0x0fcd('0x5'));var logger=require(_0x0fcd('0x6'))(_0x0fcd('0x7'));var config=require(_0x0fcd('0x8'));var jayson=require(_0x0fcd('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x0fcd('0xa')]=_[_0x0fcd('0xb')](config[_0x0fcd('0xa')],{'host':_0x0fcd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0fcd('0xa')]));require(_0x0fcd('0xd'))[_0x0fcd('0xe')](socket);function respondWithRpcPromise(_0x804b22,_0x16edc5,_0x1bd37d){return new BPromise(function(_0x16202e,_0x13a3b4){return client[_0x0fcd('0xf')](_0x804b22,_0x1bd37d)[_0x0fcd('0x10')](function(_0x110d9b){logger['info'](_0x0fcd('0x11'),_0x16edc5,'request\x20sent');logger['debug'](_0x0fcd('0x12'),_0x16edc5,_0x0fcd('0x13'),JSON[_0x0fcd('0x14')](_0x110d9b));if(_0x110d9b[_0x0fcd('0x15')]){if(_0x110d9b[_0x0fcd('0x15')][_0x0fcd('0x16')]===0x1f4){logger['error'](_0x0fcd('0x11'),_0x16edc5,_0x110d9b[_0x0fcd('0x15')][_0x0fcd('0x17')]);return _0x13a3b4(_0x110d9b['error'][_0x0fcd('0x17')]);}logger[_0x0fcd('0x15')](_0x0fcd('0x11'),_0x16edc5,_0x110d9b[_0x0fcd('0x15')][_0x0fcd('0x17')]);return _0x16202e(_0x110d9b[_0x0fcd('0x15')][_0x0fcd('0x17')]);}else{logger[_0x0fcd('0x18')]('CmList,\x20%s,\x20%s',_0x16edc5,_0x0fcd('0x13'));_0x16202e(_0x110d9b['result']['message']);}})[_0x0fcd('0x19')](function(_0x42c603){logger[_0x0fcd('0x15')](_0x0fcd('0x11'),_0x16edc5,_0x42c603);_0x13a3b4(_0x42c603);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 31f0af3..74f72f0 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 _0x922a=['emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x2162bf,_0x350f79){var _0x517eec=function(_0x29445b){while(--_0x29445b){_0x2162bf['push'](_0x2162bf['shift']());}};_0x517eec(++_0x350f79);}(_0x922a,0xbf));var _0xa922=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x922a[_0x3ff085];return _0x2b68c3;};'use strict';var CmListEvents=require(_0xa922('0x0'));var events=['save','remove','update'];function createListener(_0x29d713,_0xeac76a){return function(_0x40a819){_0xeac76a[_0xa922('0x1')](_0x29d713,_0x40a819);};}function removeListener(_0x99106b,_0x40629d){return function(){CmListEvents[_0xa922('0x2')](_0x99106b,_0x40629d);};}exports[_0xa922('0x3')]=function(_0x457901){for(var _0x382334=0x0,_0x3e4d01=events[_0xa922('0x4')];_0x382334<_0x3e4d01;_0x382334++){var _0x340f2b=events[_0x382334];var _0x43833=createListener(_0xa922('0x5')+_0x340f2b,_0x457901);CmListEvents['on'](_0x340f2b,_0x43833);}}; \ No newline at end of file +var _0x0d9c=['remove','update','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x56a885,_0x336fc8){var _0x186606=function(_0x56327f){while(--_0x56327f){_0x56a885['push'](_0x56a885['shift']());}};_0x186606(++_0x336fc8);}(_0x0d9c,0x9e));var _0xc0d9=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0x0d9c[_0x3eff21];return _0x1945bb;};'use strict';var CmListEvents=require(_0xc0d9('0x0'));var events=[_0xc0d9('0x1'),_0xc0d9('0x2'),_0xc0d9('0x3')];function createListener(_0x36e006,_0x19a1a5){return function(_0x5a84be){_0x19a1a5['emit'](_0x36e006,_0x5a84be);};}function removeListener(_0x5eba60,_0x4c2fcd){return function(){CmListEvents[_0xc0d9('0x4')](_0x5eba60,_0x4c2fcd);};}exports[_0xc0d9('0x5')]=function(_0x3a226b){for(var _0x336804=0x0,_0x17cbec=events[_0xc0d9('0x6')];_0x336804<_0x17cbec;_0x336804++){var _0x2f0386=events[_0x336804];var _0x4ebc5c=createListener(_0xc0d9('0x7')+_0x2f0386,_0x3a226b);CmListEvents['on'](_0x2f0386,_0x4ebc5c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index e1f7528..e6d5b30 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 _0x5c5a=['removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','/:id','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','/:id/dispositions','post','addContacts','addCustomField','addAgents','update','delete','removeDispositions'];(function(_0x3fa663,_0x2e15b0){var _0x5b6bf7=function(_0x5ae789){while(--_0x5ae789){_0x3fa663['push'](_0x3fa663['shift']());}};_0x5b6bf7(++_0x2e15b0);}(_0x5c5a,0x198));var _0xa5c5=function(_0x542085,_0x192524){_0x542085=_0x542085-0x0;var _0x579b5e=_0x5c5a[_0x542085];return _0x579b5e;};'use strict';var multer=require('multer');var util=require(_0xa5c5('0x0'));var path=require(_0xa5c5('0x1'));var timeout=require(_0xa5c5('0x2'));var express=require('express');var router=express[_0xa5c5('0x3')]();var fs_extra=require(_0xa5c5('0x4'));var auth=require(_0xa5c5('0x5'));var interaction=require(_0xa5c5('0x6'));var config=require('../../config/environment');var controller=require(_0xa5c5('0x7'));router[_0xa5c5('0x8')]('/',auth[_0xa5c5('0x9')](),controller['index']);router[_0xa5c5('0x8')]('/describe',auth[_0xa5c5('0x9')](),controller['describe']);router[_0xa5c5('0x8')]('/global_fields',auth[_0xa5c5('0x9')](),controller['getGlobalCustomFields']);router[_0xa5c5('0x8')](_0xa5c5('0xa'),auth[_0xa5c5('0x9')](),controller['show']);router['get']('/:id/dispositions',auth[_0xa5c5('0x9')](),controller[_0xa5c5('0xb')]);router[_0xa5c5('0x8')](_0xa5c5('0xc'),auth[_0xa5c5('0x9')](),controller['getContacts']);router[_0xa5c5('0x8')]('/:id/contacts/csv',auth[_0xa5c5('0x9')](),controller[_0xa5c5('0xd')]);router['get'](_0xa5c5('0xe'),auth[_0xa5c5('0x9')](),controller[_0xa5c5('0xf')]);router[_0xa5c5('0x8')](_0xa5c5('0x10'),auth[_0xa5c5('0x9')](),controller[_0xa5c5('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa5c5('0x12')]);router['post'](_0xa5c5('0x13'),auth[_0xa5c5('0x9')](),controller['addDisposition']);router[_0xa5c5('0x14')](_0xa5c5('0xc'),auth['isAuthenticated'](),controller[_0xa5c5('0x15')]);router[_0xa5c5('0x14')](_0xa5c5('0xe'),auth[_0xa5c5('0x9')](),controller[_0xa5c5('0x16')]);router[_0xa5c5('0x14')]('/:id/users',auth[_0xa5c5('0x9')](),controller[_0xa5c5('0x17')]);router['put'](_0xa5c5('0xa'),auth[_0xa5c5('0x9')](),controller[_0xa5c5('0x18')]);router[_0xa5c5('0x19')](_0xa5c5('0xa'),auth[_0xa5c5('0x9')](),controller['destroy']);router['delete'](_0xa5c5('0x13'),auth['isAuthenticated'](),controller[_0xa5c5('0x1a')]);router['delete'](_0xa5c5('0x10'),auth[_0xa5c5('0x9')](),controller[_0xa5c5('0x1b')]);module[_0xa5c5('0x1c')]=router; \ No newline at end of file +var _0x078a=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/global_fields','getGlobalCustomFields','/:id','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','post','put','update','delete','destroy','removeDispositions','/:id/users'];(function(_0x8d071c,_0x1bfcf3){var _0x26d97a=function(_0x581155){while(--_0x581155){_0x8d071c['push'](_0x8d071c['shift']());}};_0x26d97a(++_0x1bfcf3);}(_0x078a,0x1c1));var _0xa078=function(_0x1df823,_0x2e5839){_0x1df823=_0x1df823-0x0;var _0x5528f2=_0x078a[_0x1df823];return _0x5528f2;};'use strict';var multer=require(_0xa078('0x0'));var util=require(_0xa078('0x1'));var path=require(_0xa078('0x2'));var timeout=require('connect-timeout');var express=require(_0xa078('0x3'));var router=express[_0xa078('0x4')]();var fs_extra=require(_0xa078('0x5'));var auth=require(_0xa078('0x6'));var interaction=require(_0xa078('0x7'));var config=require(_0xa078('0x8'));var controller=require(_0xa078('0x9'));router[_0xa078('0xa')]('/',auth[_0xa078('0xb')](),controller[_0xa078('0xc')]);router[_0xa078('0xa')]('/describe',auth[_0xa078('0xb')](),controller[_0xa078('0xd')]);router[_0xa078('0xa')](_0xa078('0xe'),auth['isAuthenticated'](),controller[_0xa078('0xf')]);router['get'](_0xa078('0x10'),auth[_0xa078('0xb')](),controller['show']);router[_0xa078('0xa')](_0xa078('0x11'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xa078('0xa')](_0xa078('0x12'),auth[_0xa078('0xb')](),controller[_0xa078('0x13')]);router[_0xa078('0xa')](_0xa078('0x14'),auth[_0xa078('0xb')](),controller[_0xa078('0x15')]);router[_0xa078('0xa')](_0xa078('0x16'),auth['isAuthenticated'](),controller[_0xa078('0x17')]);router[_0xa078('0xa')]('/:id/users',auth[_0xa078('0xb')](),controller['getAgents']);router[_0xa078('0x18')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa078('0x18')]('/:id/dispositions',auth[_0xa078('0xb')](),controller['addDisposition']);router['post'](_0xa078('0x12'),auth[_0xa078('0xb')](),controller['addContacts']);router[_0xa078('0x18')](_0xa078('0x16'),auth[_0xa078('0xb')](),controller['addCustomField']);router[_0xa078('0x18')]('/:id/users',auth[_0xa078('0xb')](),controller['addAgents']);router[_0xa078('0x19')]('/:id',auth[_0xa078('0xb')](),controller[_0xa078('0x1a')]);router[_0xa078('0x1b')]('/:id',auth[_0xa078('0xb')](),controller[_0xa078('0x1c')]);router[_0xa078('0x1b')]('/:id/dispositions',auth[_0xa078('0xb')](),controller[_0xa078('0x1d')]);router[_0xa078('0x1b')](_0xa078('0x1e'),auth[_0xa078('0xb')](),controller['removeAgents']);module[_0xa078('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 786cb0f..1d4afbd 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 _0xb717=['field','STRING','exports','VIRTUAL'];(function(_0x32e795,_0x2636fe){var _0x3f833d=function(_0x4f80f2){while(--_0x4f80f2){_0x32e795['push'](_0x32e795['shift']());}};_0x3f833d(++_0x2636fe);}(_0xb717,0x14e));var _0x7b71=function(_0x40385a,_0x108e28){_0x40385a=_0x40385a-0x0;var _0x4a09c4=_0xb717[_0x40385a];return _0x4a09c4;};'use strict';var Sequelize=require('sequelize');module[_0x7b71('0x0')]={'name':{'type':Sequelize[_0x7b71('0x1')],'get':function(_0x539f2a){return this['getDataValue'](_0x7b71('0x2'));}},'field':{'type':Sequelize[_0x7b71('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x7b71('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x7b71('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x2042=['VIRTUAL','field','STRING'];(function(_0x323033,_0x5b2ae5){var _0x39bce3=function(_0x3b9596){while(--_0x3b9596){_0x323033['push'](_0x323033['shift']());}};_0x39bce3(++_0x5b2ae5);}(_0x2042,0x1c8));var _0x2204=function(_0x516e78,_0x52d18b){_0x516e78=_0x516e78-0x0;var _0x12d50c=_0x2042[_0x516e78];return _0x12d50c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2204('0x0')],'get':function(_0x197ecb){return this['getDataValue'](_0x2204('0x1'));}},'field':{'type':Sequelize[_0x2204('0x2')],'allowNull':![]},'operator':{'type':Sequelize[_0x2204('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x2204('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index e3b130b..dda7efa 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x4a3d7a,_0x18b3ad){var _0x3faa6a=function(_0x3b5af3){while(--_0x3b5af3){_0x4a3d7a['push'](_0x4a3d7a['shift']());}};_0x3faa6a(++_0x18b3ad);}(_0x7a54,0x106));var _0x47a5=function(_0x3acd7f,_0x4c3223){_0x3acd7f=_0x3acd7f-0x0;var _0x3ace8a=_0x7a54[_0x3acd7f];return _0x3ace8a;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _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(_0x822270,_0x34f87b){var _0x2aa7cd=function(_0x2545ed){while(--_0x2545ed){_0x822270['push'](_0x822270['shift']());}};_0x2aa7cd(++_0x34f87b);}(_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){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index cb39f98..1cf6d5e 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 _0xda41=['bluebird','request-promise','path','./condition.attributes','define','Condition','tools_conditions','../../config/logger','moment'];(function(_0x23c052,_0x529c10){var _0x4f9d57=function(_0x2dac0d){while(--_0x2dac0d){_0x23c052['push'](_0x23c052['shift']());}};_0x4f9d57(++_0x529c10);}(_0xda41,0x1a5));var _0x1da4=function(_0x30ff7a,_0x2cec2e){_0x30ff7a=_0x30ff7a-0x0;var _0xec36fb=_0xda41[_0x30ff7a];return _0xec36fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1da4('0x0'))('api');var moment=require(_0x1da4('0x1'));var BPromise=require(_0x1da4('0x2'));var rp=require(_0x1da4('0x3'));var fs=require('fs');var path=require(_0x1da4('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1da4('0x5'));module['exports']=function(_0x51fbe4,_0x133b5f){return _0x51fbe4[_0x1da4('0x6')](_0x1da4('0x7'),attributes,{'tableName':_0x1da4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0876=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x556afd,_0x26c2c3){var _0x708f4c=function(_0x3d3205){while(--_0x3d3205){_0x556afd['push'](_0x556afd['shift']());}};_0x708f4c(++_0x26c2c3);}(_0x0876,0xaa));var _0x6087=function(_0x1006fa,_0x306e9a){_0x1006fa=_0x1006fa-0x0;var _0x14d256=_0x0876[_0x1006fa];return _0x14d256;};'use strict';var _=require(_0x6087('0x0'));var util=require(_0x6087('0x1'));var logger=require(_0x6087('0x2'))(_0x6087('0x3'));var moment=require(_0x6087('0x4'));var BPromise=require(_0x6087('0x5'));var rp=require(_0x6087('0x6'));var fs=require('fs');var path=require(_0x6087('0x7'));var rimraf=require(_0x6087('0x8'));var config=require(_0x6087('0x9'));var attributes=require('./condition.attributes');module['exports']=function(_0xd88460,_0x3f9b37){return _0xd88460['define']('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 6c32ef0..b87beaf 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 _0x5563=['result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Condition,\x20%s,\x20%s','message'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x5563,0x75));var _0x3556=function(_0xf59d0d,_0x45d746){_0xf59d0d=_0xf59d0d-0x0;var _0x9fb7ba=_0x5563[_0xf59d0d];return _0x9fb7ba;};'use strict';var _=require(_0x3556('0x0'));var util=require(_0x3556('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3556('0x2'));var db=require(_0x3556('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3556('0x4'))(_0x3556('0x5'));var config=require(_0x3556('0x6'));var jayson=require(_0x3556('0x7'));var client=jayson[_0x3556('0x8')][_0x3556('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x406dd8,_0x49e033,_0x20bacb){return new BPromise(function(_0x41f7b9,_0x5336f1){return client[_0x3556('0xa')](_0x406dd8,_0x20bacb)[_0x3556('0xb')](function(_0x129374){logger[_0x3556('0xc')]('Condition,\x20%s,\x20%s',_0x49e033,'request\x20sent');logger[_0x3556('0xd')](_0x3556('0xe'),_0x49e033,_0x3556('0xf'),JSON[_0x3556('0x10')](_0x129374));if(_0x129374[_0x3556('0x11')]){if(_0x129374['error'][_0x3556('0x12')]===0x1f4){logger[_0x3556('0x11')](_0x3556('0x13'),_0x49e033,_0x129374[_0x3556('0x11')][_0x3556('0x14')]);return _0x5336f1(_0x129374[_0x3556('0x11')][_0x3556('0x14')]);}logger['error'](_0x3556('0x13'),_0x49e033,_0x129374['error'][_0x3556('0x14')]);return _0x41f7b9(_0x129374['error'][_0x3556('0x14')]);}else{logger[_0x3556('0xc')](_0x3556('0x13'),_0x49e033,_0x3556('0xf'));_0x41f7b9(_0x129374[_0x3556('0x15')][_0x3556('0x14')]);}})[_0x3556('0x16')](function(_0x1b1560){logger[_0x3556('0x11')](_0x3556('0x13'),_0x49e033,_0x1b1560);_0x5336f1(_0x1b1560);});});} \ No newline at end of file +var _0x150e=['http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x2573f7,_0x1200bc){var _0x57740d=function(_0x4ecf47){while(--_0x4ecf47){_0x2573f7['push'](_0x2573f7['shift']());}};_0x57740d(++_0x1200bc);}(_0x150e,0x97));var _0xe150=function(_0xe6e557,_0x4f724b){_0xe6e557=_0xe6e557-0x0;var _0x15f8a1=_0x150e[_0xe6e557];return _0x15f8a1;};'use strict';var _=require('lodash');var util=require(_0xe150('0x0'));var moment=require(_0xe150('0x1'));var BPromise=require(_0xe150('0x2'));var rs=require(_0xe150('0x3'));var fs=require('fs');var Redis=require(_0xe150('0x4'));var db=require(_0xe150('0x5'))['db'];var utils=require(_0xe150('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe150('0x7'));var jayson=require(_0xe150('0x8'));var client=jayson['client'][_0xe150('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x285e6,_0x347491,_0x13e6a9){return new BPromise(function(_0x113bb5,_0x4ede04){return client[_0xe150('0xa')](_0x285e6,_0x13e6a9)['then'](function(_0x5aa3b0){logger[_0xe150('0xb')](_0xe150('0xc'),_0x347491,_0xe150('0xd'));logger[_0xe150('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x347491,_0xe150('0xd'),JSON[_0xe150('0xf')](_0x5aa3b0));if(_0x5aa3b0['error']){if(_0x5aa3b0[_0xe150('0x10')]['code']===0x1f4){logger[_0xe150('0x10')](_0xe150('0xc'),_0x347491,_0x5aa3b0['error'][_0xe150('0x11')]);return _0x4ede04(_0x5aa3b0[_0xe150('0x10')][_0xe150('0x11')]);}logger[_0xe150('0x10')]('Condition,\x20%s,\x20%s',_0x347491,_0x5aa3b0[_0xe150('0x10')]['message']);return _0x113bb5(_0x5aa3b0[_0xe150('0x10')][_0xe150('0x11')]);}else{logger[_0xe150('0xb')](_0xe150('0xc'),_0x347491,_0xe150('0xd'));_0x113bb5(_0x5aa3b0[_0xe150('0x12')][_0xe150('0x11')]);}})[_0xe150('0x13')](function(_0x2f2fe1){logger['error'](_0xe150('0xc'),_0x347491,_0x2f2fe1);_0x4ede04(_0x2f2fe1);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index e4ea53b..dfcfe59 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 _0x4ccc=['isAuthenticated','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','/:id'];(function(_0x5216e0,_0x4f8cb9){var _0x5b3f40=function(_0x30c832){while(--_0x30c832){_0x5216e0['push'](_0x5216e0['shift']());}};_0x5b3f40(++_0x4f8cb9);}(_0x4ccc,0x18a));var _0xc4cc=function(_0x27fe5f,_0x2949d1){_0x27fe5f=_0x27fe5f-0x0;var _0x5a5c05=_0x4ccc[_0x27fe5f];return _0x5a5c05;};'use strict';var multer=require('multer');var util=require(_0xc4cc('0x0'));var path=require('path');var timeout=require(_0xc4cc('0x1'));var express=require(_0xc4cc('0x2'));var router=express['Router']();var fs_extra=require(_0xc4cc('0x3'));var auth=require(_0xc4cc('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./condition.controller');router['put'](_0xc4cc('0x5'),auth[_0xc4cc('0x6')](),controller[_0xc4cc('0x7')]);router[_0xc4cc('0x8')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc4cc('0x9')]=router; \ No newline at end of file +var _0x884d=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x884d,0xb6));var _0xd884=function(_0x4fea5b,_0x53ede5){_0x4fea5b=_0x4fea5b-0x0;var _0x280d20=_0x884d[_0x4fea5b];return _0x280d20;};'use strict';var multer=require(_0xd884('0x0'));var util=require('util');var path=require(_0xd884('0x1'));var timeout=require('connect-timeout');var express=require(_0xd884('0x2'));var router=express[_0xd884('0x3')]();var fs_extra=require(_0xd884('0x4'));var auth=require(_0xd884('0x5'));var interaction=require(_0xd884('0x6'));var config=require(_0xd884('0x7'));var controller=require(_0xd884('0x8'));router[_0xd884('0x9')](_0xd884('0xa'),auth[_0xd884('0xb')](),controller[_0xd884('0xc')]);router['delete']('/:id',auth[_0xd884('0xb')](),controller[_0xd884('0xd')]);module[_0xd884('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index e8bf259..35091ae 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 _0x9982=['exports','STRING','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9982,0x9b));var _0x2998=function(_0x15d5c3,_0x1df847){_0x15d5c3=_0x15d5c3-0x0;var _0x258fff=_0x9982[_0x15d5c3];return _0x258fff;};'use strict';var Sequelize=require(_0x2998('0x0'));module[_0x2998('0x1')]={'name':{'type':Sequelize[_0x2998('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x2998('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xd95a=['name','INTEGER','sequelize','exports','STRING'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0xd95a,0x13d));var _0xad95=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd95a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xad95('0x0'));module[_0xad95('0x1')]={'name':{'type':Sequelize[_0xad95('0x2')],'allowNull':![],'unique':_0xad95('0x3')},'OrderBy':{'type':Sequelize[_0xad95('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index d69fd04..0273d0d 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 _0x8aad=['ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','ContactItemTypes','end','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','eml-format','rimraf','fast-json-patch','moment','bluebird','path'];(function(_0x16ca6a,_0x16f18e){var _0x3b597b=function(_0x4ea86a){while(--_0x4ea86a){_0x16ca6a['push'](_0x16ca6a['shift']());}};_0x3b597b(++_0x16f18e);}(_0x8aad,0x146));var _0xd8aa=function(_0x2558c5,_0x52f73f){_0x2558c5=_0x2558c5-0x0;var _0x1ccf2a=_0x8aad[_0x2558c5];return _0x1ccf2a;};'use strict';var emlformat=require(_0xd8aa('0x0'));var rimraf=require(_0xd8aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8aa('0x2'));var rp=require('request-promise');var moment=require(_0xd8aa('0x3'));var BPromise=require(_0xd8aa('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd8aa('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd8aa('0x6'));var fs=require('fs');var fs_extra=require(_0xd8aa('0x7'));var _=require(_0xd8aa('0x8'));var squel=require('squel');var crypto=require(_0xd8aa('0x9'));var jsforce=require(_0xd8aa('0xa'));var deskjs=require(_0xd8aa('0xb'));var toCsv=require(_0xd8aa('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd8aa('0xd'));var authService=require(_0xd8aa('0xe'));var qs=require(_0xd8aa('0xf'));var as=require(_0xd8aa('0x10'));var hardwareService=require(_0xd8aa('0x11'));var logger=require('../../config/logger')(_0xd8aa('0x12'));var utils=require(_0xd8aa('0x13'));var config=require(_0xd8aa('0x14'));var licenseUtil=require(_0xd8aa('0x15'));var db=require(_0xd8aa('0x16'))['db'];function respondWithStatusCode(_0x6ec0eb,_0x549fad){_0x549fad=_0x549fad||0xcc;return function(_0x1e7db8){if(_0x1e7db8){return _0x6ec0eb[_0xd8aa('0x17')](_0x549fad);}return _0x6ec0eb[_0xd8aa('0x18')](_0x549fad)['end']();};}function respondWithResult(_0x5a8c79,_0x275eff){_0x275eff=_0x275eff||0xc8;return function(_0x319ffe){if(_0x319ffe){return _0x5a8c79[_0xd8aa('0x18')](_0x275eff)['json'](_0x319ffe);}};}function respondWithFilteredResult(_0x2678ed,_0x180c56){return function(_0x39b5bc){if(_0x39b5bc){var _0x404ed6=typeof _0x180c56['offset']===_0xd8aa('0x19')&&typeof _0x180c56[_0xd8aa('0x1a')]==='undefined';var _0x16d5c6=_0x39b5bc[_0xd8aa('0x1b')];var _0x32e2cd=_0x404ed6?0x0:_0x180c56[_0xd8aa('0x1c')];var _0x2d34ac=_0x404ed6?_0x39b5bc['count']:_0x180c56[_0xd8aa('0x1c')]+_0x180c56[_0xd8aa('0x1a')];var _0xb156e6;if(_0x2d34ac>=_0x16d5c6){_0x2d34ac=_0x16d5c6;_0xb156e6=0xc8;}else{_0xb156e6=0xce;}_0x2678ed[_0xd8aa('0x18')](_0xb156e6);return _0x2678ed['set'](_0xd8aa('0x1d'),_0x32e2cd+'-'+_0x2d34ac+'/'+_0x16d5c6)[_0xd8aa('0x1e')](_0x39b5bc);}return null;};}function patchUpdates(_0x46d69b){return function(_0x3588ee){try{jsonpatch[_0xd8aa('0x1f')](_0x3588ee,_0x46d69b,!![]);}catch(_0x4fe5d8){return BPromise[_0xd8aa('0x20')](_0x4fe5d8);}return _0x3588ee[_0xd8aa('0x21')]();};}function saveUpdates(_0xc4f55c,_0x5910b3){return function(_0xa7cf85){if(_0xa7cf85){return _0xa7cf85[_0xd8aa('0x22')](_0xc4f55c)[_0xd8aa('0x23')](function(_0x290849){return _0x290849;});}return null;};}function removeEntity(_0x3ef3a9,_0x16758a){return function(_0x1f64f8){if(_0x1f64f8){return _0x1f64f8[_0xd8aa('0x24')]()[_0xd8aa('0x23')](function(){var _0x210176=_0x1f64f8[_0xd8aa('0x25')]({'plain':!![]});var _0x370d6f=_0xd8aa('0x26');return db['UserProfileResource'][_0xd8aa('0x24')]({'where':{'type':_0x370d6f,'resourceId':_0x210176['id']}})[_0xd8aa('0x23')](function(){return _0x1f64f8;});})[_0xd8aa('0x23')](function(){_0x3ef3a9[_0xd8aa('0x18')](0xcc)[_0xd8aa('0x27')]();});}};}function handleEntityNotFound(_0x3696fd,_0x26ab06){return function(_0x19edee){if(!_0x19edee){_0x3696fd[_0xd8aa('0x17')](0x194);}return _0x19edee;};}function handleError(_0xbe531,_0x4cdb90){_0x4cdb90=_0x4cdb90||0x1f4;return function(_0x1f2a28){logger[_0xd8aa('0x28')](_0x1f2a28[_0xd8aa('0x29')]);if(_0x1f2a28['name']){delete _0x1f2a28[_0xd8aa('0x2a')];}_0xbe531['status'](_0x4cdb90)[_0xd8aa('0x2b')](_0x1f2a28);};}exports[_0xd8aa('0x2c')]=function(_0x37902c,_0x168a2e){var _0x44f783={},_0x28f3cc={},_0xd8d3b3={'count':0x0,'rows':[]};var _0x3cbe8d=_['map'](db[_0xd8aa('0x2d')][_0xd8aa('0x2e')],function(_0x11071f){return{'name':_0x11071f[_0xd8aa('0x2f')],'type':_0x11071f[_0xd8aa('0x30')][_0xd8aa('0x31')]};});_0x28f3cc[_0xd8aa('0x32')]=_[_0xd8aa('0x33')](_0x3cbe8d,'name');_0x28f3cc[_0xd8aa('0x34')]=_[_0xd8aa('0x35')](_0x37902c[_0xd8aa('0x34')]);_0x28f3cc['filters']=_[_0xd8aa('0x36')](_0x28f3cc[_0xd8aa('0x32')],_0x28f3cc[_0xd8aa('0x34')]);_0x44f783[_0xd8aa('0x37')]=_[_0xd8aa('0x36')](_0x28f3cc[_0xd8aa('0x32')],qs[_0xd8aa('0x38')](_0x37902c[_0xd8aa('0x34')][_0xd8aa('0x38')]));_0x44f783['attributes']=_0x44f783[_0xd8aa('0x37')][_0xd8aa('0x39')]?_0x44f783[_0xd8aa('0x37')]:_0x28f3cc[_0xd8aa('0x32')];if(!_0x37902c[_0xd8aa('0x34')][_0xd8aa('0x3a')](_0xd8aa('0x3b'))){_0x44f783[_0xd8aa('0x1a')]=qs[_0xd8aa('0x1a')](_0x37902c['query'][_0xd8aa('0x1a')]);_0x44f783['offset']=qs[_0xd8aa('0x1c')](_0x37902c[_0xd8aa('0x34')]['offset']);}_0x44f783[_0xd8aa('0x3c')]=qs[_0xd8aa('0x3d')](_0x37902c[_0xd8aa('0x34')][_0xd8aa('0x3d')]);_0x44f783[_0xd8aa('0x3e')]=qs['filters'](_['pick'](_0x37902c[_0xd8aa('0x34')],_0x28f3cc['filters']),_0x3cbe8d);if(_0x37902c[_0xd8aa('0x34')][_0xd8aa('0x3f')]){_0x44f783[_0xd8aa('0x3e')]=_[_0xd8aa('0x40')](_0x44f783[_0xd8aa('0x3e')],{'$or':_[_0xd8aa('0x33')](_0x3cbe8d,function(_0x3e79b6){if(_0x3e79b6[_0xd8aa('0x30')]!==_0xd8aa('0x41')){var _0xa34bea={};_0xa34bea[_0x3e79b6[_0xd8aa('0x2a')]]={'$like':'%'+_0x37902c['query'][_0xd8aa('0x3f')]+'%'};return _0xa34bea;}})});}_0x44f783=_[_0xd8aa('0x40')]({},_0x44f783,_0x37902c[_0xd8aa('0x42')]);var _0x4b1de0={'where':_0x44f783[_0xd8aa('0x3e')]};return db[_0xd8aa('0x2d')][_0xd8aa('0x1b')](_0x4b1de0)[_0xd8aa('0x23')](function(_0x3a0284){_0xd8d3b3[_0xd8aa('0x1b')]=_0x3a0284;if(_0x37902c[_0xd8aa('0x34')][_0xd8aa('0x43')]){_0x44f783[_0xd8aa('0x44')]=[{'all':!![]}];}return db[_0xd8aa('0x2d')][_0xd8aa('0x45')](_0x44f783);})[_0xd8aa('0x23')](function(_0x3b26c9){_0xd8d3b3[_0xd8aa('0x46')]=_0x3b26c9;return _0xd8d3b3;})[_0xd8aa('0x23')](respondWithFilteredResult(_0x168a2e,_0x44f783))[_0xd8aa('0x47')](handleError(_0x168a2e,null));};exports[_0xd8aa('0x48')]=function(_0x139ed6,_0x5a17aa){var _0x25d2d4={'raw':!![],'where':{'id':_0x139ed6[_0xd8aa('0x49')]['id']}},_0x22cce6={};_0x22cce6[_0xd8aa('0x32')]=_[_0xd8aa('0x35')](db[_0xd8aa('0x2d')]['rawAttributes']);_0x22cce6[_0xd8aa('0x34')]=_['keys'](_0x139ed6[_0xd8aa('0x34')]);_0x22cce6['filters']=_[_0xd8aa('0x36')](_0x22cce6['model'],_0x22cce6['query']);_0x25d2d4[_0xd8aa('0x37')]=_[_0xd8aa('0x36')](_0x22cce6[_0xd8aa('0x32')],qs[_0xd8aa('0x38')](_0x139ed6[_0xd8aa('0x34')][_0xd8aa('0x38')]));_0x25d2d4['attributes']=_0x25d2d4[_0xd8aa('0x37')][_0xd8aa('0x39')]?_0x25d2d4[_0xd8aa('0x37')]:_0x22cce6[_0xd8aa('0x32')];if(_0x139ed6[_0xd8aa('0x34')]['includeAll']){_0x25d2d4['include']=[{'all':!![]}];}_0x25d2d4=_['merge']({},_0x25d2d4,_0x139ed6[_0xd8aa('0x42')]);return db[_0xd8aa('0x2d')][_0xd8aa('0x4a')](_0x25d2d4)[_0xd8aa('0x23')](handleEntityNotFound(_0x5a17aa,null))[_0xd8aa('0x23')](respondWithResult(_0x5a17aa,null))[_0xd8aa('0x47')](handleError(_0x5a17aa,null));};exports['create']=function(_0x221e2b,_0x241e23){return db['ContactItemType'][_0xd8aa('0x4b')](_0x221e2b[_0xd8aa('0x4c')],{})[_0xd8aa('0x23')](function(_0x5ca32b){var _0xee55b3=_0x221e2b[_0xd8aa('0x4d')][_0xd8aa('0x25')]({'plain':!![]});if(!_0xee55b3)throw new Error(_0xd8aa('0x4e'));if(_0xee55b3[_0xd8aa('0x4f')]===_0xd8aa('0x4d')){var _0x4f494d=_0x5ca32b['get']({'plain':!![]});var _0x15a101=_0xd8aa('0x26');return db[_0xd8aa('0x50')][_0xd8aa('0x4a')]({'where':{'name':_0x15a101,'userProfileId':_0xee55b3[_0xd8aa('0x51')]},'raw':!![]})[_0xd8aa('0x23')](function(_0x1922dd){if(_0x1922dd&&_0x1922dd['autoAssociation']===0x0){return db[_0xd8aa('0x52')][_0xd8aa('0x4b')]({'name':_0x4f494d['name'],'resourceId':_0x4f494d['id'],'type':_0x1922dd[_0xd8aa('0x2a')],'sectionId':_0x1922dd['id']},{})['then'](function(){return _0x5ca32b;});}else{return _0x5ca32b;}})[_0xd8aa('0x47')](function(_0x13f202){logger[_0xd8aa('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13f202);throw _0x13f202;});}return _0x5ca32b;})['then'](respondWithResult(_0x241e23,0xc9))['catch'](handleError(_0x241e23,null));};exports['update']=function(_0x406472,_0x1f22cd){if(_0x406472[_0xd8aa('0x4c')]['id']){delete _0x406472['body']['id'];}return db['ContactItemType']['find']({'where':{'id':_0x406472[_0xd8aa('0x49')]['id']}})[_0xd8aa('0x23')](handleEntityNotFound(_0x1f22cd,null))[_0xd8aa('0x23')](saveUpdates(_0x406472[_0xd8aa('0x4c')],null))[_0xd8aa('0x23')](respondWithResult(_0x1f22cd,null))[_0xd8aa('0x47')](handleError(_0x1f22cd,null));};exports[_0xd8aa('0x24')]=function(_0x101105,_0x1503df){return db[_0xd8aa('0x2d')][_0xd8aa('0x4a')]({'where':{'id':_0x101105[_0xd8aa('0x49')]['id']}})[_0xd8aa('0x23')](handleEntityNotFound(_0x1503df,null))['then'](db['CmContactHasItem'][_0xd8aa('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x101105[_0xd8aa('0x49')]['id']}}))[_0xd8aa('0x23')](removeEntity(_0x1503df,null))[_0xd8aa('0x47')](handleError(_0x1503df,null));}; \ No newline at end of file +var _0x9f0e=['index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','intersection','attributes','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','keys','filters','fields','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','get','ContactItemTypes','UserProfileResource','end','error','stack','name','send'];(function(_0x286077,_0x54769c){var _0x3cff3f=function(_0x7b61d0){while(--_0x7b61d0){_0x286077['push'](_0x286077['shift']());}};_0x3cff3f(++_0x54769c);}(_0x9f0e,0x116));var _0xe9f0=function(_0x43e78f,_0x375a3c){_0x43e78f=_0x43e78f-0x0;var _0x2b000d=_0x9f0e[_0x43e78f];return _0x2b000d;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){var _0x372ffd=_0x437d43[_0xe9f0('0x26')]({'plain':!![]});var _0x1321bb=_0xe9f0('0x27');return db[_0xe9f0('0x28')]['destroy']({'where':{'type':_0x1321bb,'resourceId':_0x372ffd['id']}})[_0xe9f0('0x24')](function(){return _0x437d43;});})[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x29')]();});}};}function handleEntityNotFound(_0x4cf1b1,_0x212a38){return function(_0x2613fd){if(!_0x2613fd){_0x4cf1b1[_0xe9f0('0x19')](0x194);}return _0x2613fd;};}function handleError(_0x1f98a7,_0x4335c6){_0x4335c6=_0x4335c6||0x1f4;return function(_0x5457f6){logger[_0xe9f0('0x2a')](_0x5457f6[_0xe9f0('0x2b')]);if(_0x5457f6[_0xe9f0('0x2c')]){delete _0x5457f6[_0xe9f0('0x2c')];}_0x1f98a7[_0xe9f0('0x1a')](_0x4335c6)[_0xe9f0('0x2d')](_0x5457f6);};}exports[_0xe9f0('0x2e')]=function(_0x2efd33,_0x2b6503){var _0x3dbe49={},_0x22806c={},_0x617ad3={'count':0x0,'rows':[]};var _0x445ad0=_[_0xe9f0('0x2f')](db[_0xe9f0('0x30')][_0xe9f0('0x31')],function(_0x80e3ac){return{'name':_0x80e3ac[_0xe9f0('0x32')],'type':_0x80e3ac[_0xe9f0('0x33')][_0xe9f0('0x34')]};});_0x22806c[_0xe9f0('0x35')]=_[_0xe9f0('0x2f')](_0x445ad0,_0xe9f0('0x2c'));_0x22806c[_0xe9f0('0x36')]=_['keys'](_0x2efd33['query']);_0x22806c['filters']=_[_0xe9f0('0x37')](_0x22806c['model'],_0x22806c[_0xe9f0('0x36')]);_0x3dbe49[_0xe9f0('0x38')]=_['intersection'](_0x22806c[_0xe9f0('0x35')],qs['fields'](_0x2efd33['query']['fields']));_0x3dbe49[_0xe9f0('0x38')]=_0x3dbe49[_0xe9f0('0x38')]['length']?_0x3dbe49[_0xe9f0('0x38')]:_0x22806c[_0xe9f0('0x35')];if(!_0x2efd33[_0xe9f0('0x36')]['hasOwnProperty']('nolimit')){_0x3dbe49[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x2efd33[_0xe9f0('0x36')]['limit']);_0x3dbe49[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x2efd33[_0xe9f0('0x36')][_0xe9f0('0x1f')]);}_0x3dbe49[_0xe9f0('0x39')]=qs['sort'](_0x2efd33[_0xe9f0('0x36')][_0xe9f0('0x3a')]);_0x3dbe49[_0xe9f0('0x3b')]=qs['filters'](_[_0xe9f0('0x3c')](_0x2efd33[_0xe9f0('0x36')],_0x22806c['filters']),_0x445ad0);if(_0x2efd33[_0xe9f0('0x36')]['filter']){_0x3dbe49[_0xe9f0('0x3b')]=_['merge'](_0x3dbe49['where'],{'$or':_['map'](_0x445ad0,function(_0x5bddcc){if(_0x5bddcc['type']!==_0xe9f0('0x3d')){var _0x2d4115={};_0x2d4115[_0x5bddcc[_0xe9f0('0x2c')]]={'$like':'%'+_0x2efd33[_0xe9f0('0x36')][_0xe9f0('0x3e')]+'%'};return _0x2d4115;}})});}_0x3dbe49=_[_0xe9f0('0x3f')]({},_0x3dbe49,_0x2efd33[_0xe9f0('0x40')]);var _0x3e79c1={'where':_0x3dbe49[_0xe9f0('0x3b')]};return db['ContactItemType'][_0xe9f0('0x1e')](_0x3e79c1)[_0xe9f0('0x24')](function(_0x36b00a){_0x617ad3['count']=_0x36b00a;if(_0x2efd33['query'][_0xe9f0('0x41')]){_0x3dbe49['include']=[{'all':!![]}];}return db[_0xe9f0('0x30')][_0xe9f0('0x42')](_0x3dbe49);})[_0xe9f0('0x24')](function(_0x42d9d2){_0x617ad3['rows']=_0x42d9d2;return _0x617ad3;})[_0xe9f0('0x24')](respondWithFilteredResult(_0x2b6503,_0x3dbe49))[_0xe9f0('0x43')](handleError(_0x2b6503,null));};exports[_0xe9f0('0x44')]=function(_0x18faaf,_0x37a2ac){var _0x59378a={'raw':!![],'where':{'id':_0x18faaf[_0xe9f0('0x45')]['id']}},_0x60a40d={};_0x60a40d[_0xe9f0('0x35')]=_[_0xe9f0('0x46')](db[_0xe9f0('0x30')]['rawAttributes']);_0x60a40d[_0xe9f0('0x36')]=_['keys'](_0x18faaf['query']);_0x60a40d[_0xe9f0('0x47')]=_[_0xe9f0('0x37')](_0x60a40d['model'],_0x60a40d[_0xe9f0('0x36')]);_0x59378a[_0xe9f0('0x38')]=_[_0xe9f0('0x37')](_0x60a40d[_0xe9f0('0x35')],qs[_0xe9f0('0x48')](_0x18faaf[_0xe9f0('0x36')][_0xe9f0('0x48')]));_0x59378a['attributes']=_0x59378a[_0xe9f0('0x38')]['length']?_0x59378a[_0xe9f0('0x38')]:_0x60a40d['model'];if(_0x18faaf[_0xe9f0('0x36')]['includeAll']){_0x59378a[_0xe9f0('0x49')]=[{'all':!![]}];}_0x59378a=_[_0xe9f0('0x3f')]({},_0x59378a,_0x18faaf[_0xe9f0('0x40')]);return db['ContactItemType'][_0xe9f0('0x4a')](_0x59378a)[_0xe9f0('0x24')](handleEntityNotFound(_0x37a2ac,null))[_0xe9f0('0x24')](respondWithResult(_0x37a2ac,null))[_0xe9f0('0x43')](handleError(_0x37a2ac,null));};exports[_0xe9f0('0x4b')]=function(_0x135175,_0x6ece3f){return db[_0xe9f0('0x30')][_0xe9f0('0x4b')](_0x135175[_0xe9f0('0x4c')],{})[_0xe9f0('0x24')](function(_0x1325a2){var _0x57beee=_0x135175['user'][_0xe9f0('0x26')]({'plain':!![]});if(!_0x57beee)throw new Error(_0xe9f0('0x4d'));if(_0x57beee[_0xe9f0('0x4e')]==='user'){var _0x1ac381=_0x1325a2['get']({'plain':!![]});var _0x323e1e=_0xe9f0('0x27');return db[_0xe9f0('0x4f')][_0xe9f0('0x4a')]({'where':{'name':_0x323e1e,'userProfileId':_0x57beee['userProfileId']},'raw':!![]})[_0xe9f0('0x24')](function(_0x3fa271){if(_0x3fa271&&_0x3fa271['autoAssociation']===0x0){return db[_0xe9f0('0x28')][_0xe9f0('0x4b')]({'name':_0x1ac381[_0xe9f0('0x2c')],'resourceId':_0x1ac381['id'],'type':_0x3fa271[_0xe9f0('0x2c')],'sectionId':_0x3fa271['id']},{})['then'](function(){return _0x1325a2;});}else{return _0x1325a2;}})[_0xe9f0('0x43')](function(_0x3a5d19){logger[_0xe9f0('0x2a')](_0xe9f0('0x50'),_0x3a5d19);throw _0x3a5d19;});}return _0x1325a2;})[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,0xc9))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports[_0xe9f0('0x23')]=function(_0x12d9be,_0x4da78f){if(_0x12d9be[_0xe9f0('0x4c')]['id']){delete _0x12d9be[_0xe9f0('0x4c')]['id'];}return db[_0xe9f0('0x30')][_0xe9f0('0x4a')]({'where':{'id':_0x12d9be[_0xe9f0('0x45')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4da78f,null))[_0xe9f0('0x24')](saveUpdates(_0x12d9be[_0xe9f0('0x4c')],null))[_0xe9f0('0x24')](respondWithResult(_0x4da78f,null))[_0xe9f0('0x43')](handleError(_0x4da78f,null));};exports[_0xe9f0('0x25')]=function(_0x3c26ac,_0x4f1c25){return db[_0xe9f0('0x30')]['find']({'where':{'id':_0x3c26ac[_0xe9f0('0x45')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4f1c25,null))[_0xe9f0('0x24')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3c26ac[_0xe9f0('0x45')]['id']}}))['then'](removeEntity(_0x4f1c25,null))[_0xe9f0('0x43')](handleError(_0x4f1c25,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 56bf82c..b4d3164 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 _0xb758=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ContactItemType','tools_contact_item_types','lodash'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xb758,0x137));var _0x8b75=function(_0x2bda14,_0x4fab1b){_0x2bda14=_0x2bda14-0x0;var _0xb5dd49=_0xb758[_0x2bda14];return _0xb5dd49;};'use strict';var _=require(_0x8b75('0x0'));var util=require('util');var logger=require(_0x8b75('0x1'))(_0x8b75('0x2'));var moment=require(_0x8b75('0x3'));var BPromise=require(_0x8b75('0x4'));var rp=require(_0x8b75('0x5'));var fs=require('fs');var path=require(_0x8b75('0x6'));var rimraf=require(_0x8b75('0x7'));var config=require(_0x8b75('0x8'));var attributes=require('./contactItemType.attributes');module[_0x8b75('0x9')]=function(_0x4b168d,_0x29b445){return _0x4b168d[_0x8b75('0xa')](_0x8b75('0xb'),attributes,{'tableName':_0x8b75('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97a3=['api','moment','rimraf','exports','define','tools_contact_item_types','lodash','util','../../config/logger'];(function(_0xd9efd2,_0x176541){var _0x4919e0=function(_0x452738){while(--_0x452738){_0xd9efd2['push'](_0xd9efd2['shift']());}};_0x4919e0(++_0x176541);}(_0x97a3,0x1ec));var _0x397a=function(_0x5b532f,_0x519c90){_0x5b532f=_0x5b532f-0x0;var _0x51478c=_0x97a3[_0x5b532f];return _0x51478c;};'use strict';var _=require(_0x397a('0x0'));var util=require(_0x397a('0x1'));var logger=require(_0x397a('0x2'))(_0x397a('0x3'));var moment=require(_0x397a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x397a('0x5'));var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module[_0x397a('0x6')]=function(_0x2fc965,_0x2e1b40){return _0x2fc965[_0x397a('0x7')]('ContactItemType',attributes,{'tableName':_0x397a('0x8'),'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 1b4a816..e460243 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 _0xdadf=['client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2a4d1d,_0x564f4b){var _0x326ec6=function(_0x2c1d66){while(--_0x2c1d66){_0x2a4d1d['push'](_0x2a4d1d['shift']());}};_0x326ec6(++_0x564f4b);}(_0xdadf,0x175));var _0xfdad=function(_0x484e09,_0x345171){_0x484e09=_0x484e09-0x0;var _0x546ae1=_0xdadf[_0x484e09];return _0x546ae1;};'use strict';var _=require(_0xfdad('0x0'));var util=require(_0xfdad('0x1'));var moment=require('moment');var BPromise=require(_0xfdad('0x2'));var rs=require(_0xfdad('0x3'));var fs=require('fs');var Redis=require(_0xfdad('0x4'));var db=require(_0xfdad('0x5'))['db'];var utils=require(_0xfdad('0x6'));var logger=require(_0xfdad('0x7'))(_0xfdad('0x8'));var config=require(_0xfdad('0x9'));var jayson=require(_0xfdad('0xa'));var client=jayson[_0xfdad('0xb')][_0xfdad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc9af68,_0x199da6,_0x3bb44e){return new BPromise(function(_0x7ccc23,_0x364d98){return client[_0xfdad('0xd')](_0xc9af68,_0x3bb44e)[_0xfdad('0xe')](function(_0x432263){logger[_0xfdad('0xf')](_0xfdad('0x10'),_0x199da6,_0xfdad('0x11'));logger[_0xfdad('0x12')](_0xfdad('0x13'),_0x199da6,_0xfdad('0x11'),JSON[_0xfdad('0x14')](_0x432263));if(_0x432263[_0xfdad('0x15')]){if(_0x432263[_0xfdad('0x15')][_0xfdad('0x16')]===0x1f4){logger[_0xfdad('0x15')](_0xfdad('0x10'),_0x199da6,_0x432263['error'][_0xfdad('0x17')]);return _0x364d98(_0x432263['error'][_0xfdad('0x17')]);}logger[_0xfdad('0x15')](_0xfdad('0x10'),_0x199da6,_0x432263[_0xfdad('0x15')][_0xfdad('0x17')]);return _0x7ccc23(_0x432263[_0xfdad('0x15')][_0xfdad('0x17')]);}else{logger[_0xfdad('0xf')]('ContactItemType,\x20%s,\x20%s',_0x199da6,_0xfdad('0x11'));_0x7ccc23(_0x432263['result']['message']);}})['catch'](function(_0x2842b8){logger[_0xfdad('0x15')](_0xfdad('0x10'),_0x199da6,_0x2842b8);_0x364d98(_0x2842b8);});});} \ No newline at end of file +var _0x8a08=['catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','info','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ContactItemType,\x20%s,\x20%s','message','result'];(function(_0x383627,_0x5be16e){var _0x2c16a0=function(_0x569b72){while(--_0x569b72){_0x383627['push'](_0x383627['shift']());}};_0x2c16a0(++_0x5be16e);}(_0x8a08,0x145));var _0x88a0=function(_0x2c5731,_0x3dacce){_0x2c5731=_0x2c5731-0x0;var _0x56d8ca=_0x8a08[_0x2c5731];return _0x56d8ca;};'use strict';var _=require(_0x88a0('0x0'));var util=require(_0x88a0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x88a0('0x2'));var fs=require('fs');var Redis=require(_0x88a0('0x3'));var db=require(_0x88a0('0x4'))['db'];var utils=require(_0x88a0('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x88a0('0x6'));var jayson=require(_0x88a0('0x7'));var client=jayson[_0x88a0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e2e37,_0x47f5ce,_0x41e8d0){return new BPromise(function(_0x37a308,_0x5d0a0b){return client['request'](_0x5e2e37,_0x41e8d0)['then'](function(_0x73f326){logger[_0x88a0('0x9')]('ContactItemType,\x20%s,\x20%s',_0x47f5ce,'request\x20sent');logger['debug'](_0x88a0('0xa'),_0x47f5ce,_0x88a0('0xb'),JSON[_0x88a0('0xc')](_0x73f326));if(_0x73f326[_0x88a0('0xd')]){if(_0x73f326[_0x88a0('0xd')]['code']===0x1f4){logger['error'](_0x88a0('0xe'),_0x47f5ce,_0x73f326[_0x88a0('0xd')]['message']);return _0x5d0a0b(_0x73f326[_0x88a0('0xd')]['message']);}logger[_0x88a0('0xd')]('ContactItemType,\x20%s,\x20%s',_0x47f5ce,_0x73f326[_0x88a0('0xd')][_0x88a0('0xf')]);return _0x37a308(_0x73f326['error']['message']);}else{logger['info'](_0x88a0('0xe'),_0x47f5ce,_0x88a0('0xb'));_0x37a308(_0x73f326[_0x88a0('0x10')][_0x88a0('0xf')]);}})[_0x88a0('0x11')](function(_0x547d07){logger[_0x88a0('0xd')]('ContactItemType,\x20%s,\x20%s',_0x47f5ce,_0x547d07);_0x5d0a0b(_0x547d07);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 8aad635..fc07708 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 _0x2f55=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','update','util','connect-timeout','express'];(function(_0x55b7a6,_0x257a2c){var _0x5ad8d4=function(_0x34ad04){while(--_0x34ad04){_0x55b7a6['push'](_0x55b7a6['shift']());}};_0x5ad8d4(++_0x257a2c);}(_0x2f55,0x17d));var _0x52f5=function(_0xc80be2,_0x2c3e28){_0xc80be2=_0xc80be2-0x0;var _0x4b84df=_0x2f55[_0xc80be2];return _0x4b84df;};'use strict';var multer=require('multer');var util=require(_0x52f5('0x0'));var path=require('path');var timeout=require(_0x52f5('0x1'));var express=require(_0x52f5('0x2'));var router=express[_0x52f5('0x3')]();var fs_extra=require(_0x52f5('0x4'));var auth=require(_0x52f5('0x5'));var interaction=require(_0x52f5('0x6'));var config=require('../../config/environment');var controller=require(_0x52f5('0x7'));router[_0x52f5('0x8')]('/',auth[_0x52f5('0x9')](),controller[_0x52f5('0xa')]);router[_0x52f5('0x8')](_0x52f5('0xb'),auth['isAuthenticated'](),controller[_0x52f5('0xc')]);router[_0x52f5('0xd')]('/',auth[_0x52f5('0x9')](),controller[_0x52f5('0xe')]);router['put'](_0x52f5('0xb'),auth[_0x52f5('0x9')](),controller[_0x52f5('0xf')]);router['delete'](_0x52f5('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa106=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa106,0xb5));var _0x6a10=function(_0x9be28f,_0x231334){_0x9be28f=_0x9be28f-0x0;var _0xa9f52d=_0xa106[_0x9be28f];return _0xa9f52d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6a10('0x0'));var timeout=require(_0x6a10('0x1'));var express=require(_0x6a10('0x2'));var router=express[_0x6a10('0x3')]();var fs_extra=require(_0x6a10('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6a10('0x5'));var config=require(_0x6a10('0x6'));var controller=require(_0x6a10('0x7'));router[_0x6a10('0x8')]('/',auth[_0x6a10('0x9')](),controller['index']);router[_0x6a10('0x8')](_0x6a10('0xa'),auth['isAuthenticated'](),controller[_0x6a10('0xb')]);router[_0x6a10('0xc')]('/',auth[_0x6a10('0x9')](),controller[_0x6a10('0xd')]);router[_0x6a10('0xe')](_0x6a10('0xa'),auth['isAuthenticated'](),controller[_0x6a10('0xf')]);router[_0x6a10('0x10')]('/:id',auth[_0x6a10('0x9')](),controller[_0x6a10('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 64bb35d..b760b71 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 _0x757a=['exports','STRING'];(function(_0x323841,_0x1b0dc0){var _0x538060=function(_0x2f7ba6){while(--_0x2f7ba6){_0x323841['push'](_0x323841['shift']());}};_0x538060(++_0x1b0dc0);}(_0x757a,0xde));var _0xa757=function(_0x5b5778,_0x44069){_0x5b5778=_0x5b5778-0x0;var _0x2750f7=_0x757a[_0x5b5778];return _0x2750f7;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x1b745b,_0x3e2d40){var _0x120a9d=function(_0x882a6c){while(--_0x882a6c){_0x1b745b['push'](_0x1b745b['shift']());}};_0x120a9d(++_0x3e2d40);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'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/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b2ce599..3e3ca2e 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 _0x936c=['sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','updatedAt','body','CustomDashboards','UserProfileSection','autoAssociation','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrFaxAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','redis','defaults','localhost','register'];(function(_0x3364db,_0x5e2522){var _0x526ea9=function(_0x35b5d3){while(--_0x35b5d3){_0x3364db['push'](_0x3364db['shift']());}};_0x526ea9(++_0x5e2522);}(_0x936c,0x166));var _0xc936=function(_0x12ae7d,_0x58a3a2){_0x12ae7d=_0x12ae7d-0x0;var _0x5f0f79=_0x936c[_0x12ae7d];return _0x5f0f79;};'use strict';var emlformat=require(_0xc936('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc936('0x1'));var jsonpatch=require(_0xc936('0x2'));var rp=require(_0xc936('0x3'));var moment=require('moment');var BPromise=require(_0xc936('0x4'));var Mustache=require(_0xc936('0x5'));var util=require('util');var path=require(_0xc936('0x6'));var sox=require(_0xc936('0x7'));var csv=require(_0xc936('0x8'));var ejs=require(_0xc936('0x9'));var fs=require('fs');var fs_extra=require(_0xc936('0xa'));var _=require(_0xc936('0xb'));var squel=require(_0xc936('0xc'));var crypto=require('crypto');var jsforce=require(_0xc936('0xd'));var deskjs=require(_0xc936('0xe'));var toCsv=require(_0xc936('0x8'));var querystring=require('querystring');var Papa=require(_0xc936('0xf'));var Redis=require(_0xc936('0x10'));var authService=require(_0xc936('0x11'));var qs=require(_0xc936('0x12'));var as=require(_0xc936('0x13'));var hardwareService=require(_0xc936('0x14'));var logger=require('../../config/logger')(_0xc936('0x15'));var utils=require(_0xc936('0x16'));var config=require(_0xc936('0x17'));var licenseUtil=require(_0xc936('0x18'));var db=require('../../mysqldb')['db'];config[_0xc936('0x19')]=_[_0xc936('0x1a')](config[_0xc936('0x19')],{'host':_0xc936('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboard.socket')[_0xc936('0x1c')](socket);function respondWithStatusCode(_0xa14ffd,_0x4afa2c){_0x4afa2c=_0x4afa2c||0xcc;return function(_0x35452a){if(_0x35452a){return _0xa14ffd[_0xc936('0x1d')](_0x4afa2c);}return _0xa14ffd['status'](_0x4afa2c)[_0xc936('0x1e')]();};}function respondWithResult(_0x2be600,_0x321595){_0x321595=_0x321595||0xc8;return function(_0x2c11a4){if(_0x2c11a4){return _0x2be600[_0xc936('0x1f')](_0x321595)[_0xc936('0x20')](_0x2c11a4);}};}function respondWithFilteredResult(_0x294ec0,_0x3291d7){return function(_0x5e8b1e){if(_0x5e8b1e){var _0x3a6dc3=typeof _0x3291d7['offset']===_0xc936('0x21')&&typeof _0x3291d7[_0xc936('0x22')]===_0xc936('0x21');var _0x298a50=_0x5e8b1e['count'];var _0x4f3184=_0x3a6dc3?0x0:_0x3291d7['offset'];var _0x4d0d4e=_0x3a6dc3?_0x5e8b1e[_0xc936('0x23')]:_0x3291d7[_0xc936('0x24')]+_0x3291d7[_0xc936('0x22')];var _0x1491ea;if(_0x4d0d4e>=_0x298a50){_0x4d0d4e=_0x298a50;_0x1491ea=0xc8;}else{_0x1491ea=0xce;}_0x294ec0['status'](_0x1491ea);return _0x294ec0['set'](_0xc936('0x25'),_0x4f3184+'-'+_0x4d0d4e+'/'+_0x298a50)['json'](_0x5e8b1e);}return null;};}function patchUpdates(_0x3f28b5){return function(_0x5331bd){try{jsonpatch['apply'](_0x5331bd,_0x3f28b5,!![]);}catch(_0x1bd18c){return BPromise[_0xc936('0x26')](_0x1bd18c);}return _0x5331bd[_0xc936('0x27')]();};}function saveUpdates(_0x6a9248,_0x111e6e){return function(_0x31da58){if(_0x31da58){return _0x31da58[_0xc936('0x28')](_0x6a9248)[_0xc936('0x29')](function(_0x5e2a2f){return _0x5e2a2f;});}return null;};}function removeEntity(_0xed286b,_0x4fd5fd){return function(_0x5e83d5){if(_0x5e83d5){return _0x5e83d5[_0xc936('0x2a')]()[_0xc936('0x29')](function(){var _0x428c52=_0x5e83d5[_0xc936('0x2b')]({'plain':!![]});var _0x368607='CustomDashboards';return db['UserProfileResource'][_0xc936('0x2a')]({'where':{'type':_0x368607,'resourceId':_0x428c52['id']}})[_0xc936('0x29')](function(){return _0x5e83d5;});})['then'](function(){_0xed286b[_0xc936('0x1f')](0xcc)[_0xc936('0x1e')]();});}};}function handleEntityNotFound(_0x253827,_0x528bc5){return function(_0x545b16){if(!_0x545b16){_0x253827[_0xc936('0x1d')](0x194);}return _0x545b16;};}function handleError(_0x5eaa57,_0x3d46f6){_0x3d46f6=_0x3d46f6||0x1f4;return function(_0x49c05f){logger[_0xc936('0x2c')](_0x49c05f[_0xc936('0x2d')]);if(_0x49c05f[_0xc936('0x2e')]){delete _0x49c05f[_0xc936('0x2e')];}_0x5eaa57[_0xc936('0x1f')](_0x3d46f6)['send'](_0x49c05f);};}exports[_0xc936('0x2f')]=function(_0x1f7a25,_0x539685){var _0x5d4418={},_0x2baa95={},_0x959699={'count':0x0,'rows':[]};var _0x1e5f32=_[_0xc936('0x30')](db[_0xc936('0x31')][_0xc936('0x32')],function(_0x515610){return{'name':_0x515610[_0xc936('0x33')],'type':_0x515610[_0xc936('0x34')][_0xc936('0x35')]};});_0x2baa95[_0xc936('0x36')]=_[_0xc936('0x30')](_0x1e5f32,_0xc936('0x2e'));_0x2baa95[_0xc936('0x37')]=_[_0xc936('0x38')](_0x1f7a25['query']);_0x2baa95[_0xc936('0x39')]=_[_0xc936('0x3a')](_0x2baa95[_0xc936('0x36')],_0x2baa95[_0xc936('0x37')]);_0x5d4418[_0xc936('0x3b')]=_[_0xc936('0x3a')](_0x2baa95[_0xc936('0x36')],qs[_0xc936('0x3c')](_0x1f7a25[_0xc936('0x37')][_0xc936('0x3c')]));_0x5d4418[_0xc936('0x3b')]=_0x5d4418['attributes'][_0xc936('0x3d')]?_0x5d4418[_0xc936('0x3b')]:_0x2baa95[_0xc936('0x36')];if(!_0x1f7a25['query'][_0xc936('0x3e')](_0xc936('0x3f'))){_0x5d4418[_0xc936('0x22')]=qs['limit'](_0x1f7a25[_0xc936('0x37')][_0xc936('0x22')]);_0x5d4418[_0xc936('0x24')]=qs[_0xc936('0x24')](_0x1f7a25[_0xc936('0x37')][_0xc936('0x24')]);}_0x5d4418[_0xc936('0x40')]=qs[_0xc936('0x41')](_0x1f7a25[_0xc936('0x37')][_0xc936('0x41')]);_0x5d4418[_0xc936('0x42')]=qs['filters'](_[_0xc936('0x43')](_0x1f7a25[_0xc936('0x37')],_0x2baa95[_0xc936('0x39')]),_0x1e5f32);if(_0x1f7a25[_0xc936('0x37')]['filter']){_0x5d4418[_0xc936('0x42')]=_[_0xc936('0x44')](_0x5d4418[_0xc936('0x42')],{'$or':_['map'](_0x1e5f32,function(_0xcfcf9f){if(_0xcfcf9f[_0xc936('0x34')]!==_0xc936('0x45')){var _0x3cb8c8={};_0x3cb8c8[_0xcfcf9f['name']]={'$like':'%'+_0x1f7a25[_0xc936('0x37')][_0xc936('0x46')]+'%'};return _0x3cb8c8;}})});}_0x5d4418=_[_0xc936('0x44')]({},_0x5d4418,_0x1f7a25[_0xc936('0x47')]);var _0xd5a4ea={'where':_0x5d4418['where']};return db[_0xc936('0x31')]['count'](_0xd5a4ea)['then'](function(_0x8c243){_0x959699[_0xc936('0x23')]=_0x8c243;if(_0x1f7a25[_0xc936('0x37')][_0xc936('0x48')]){_0x5d4418[_0xc936('0x49')]=[{'all':!![]}];}return db[_0xc936('0x31')][_0xc936('0x4a')](_0x5d4418);})[_0xc936('0x29')](function(_0x50c924){_0x959699['rows']=_0x50c924;return _0x959699;})['then'](respondWithFilteredResult(_0x539685,_0x5d4418))[_0xc936('0x4b')](handleError(_0x539685,null));};exports['show']=function(_0x3d28b9,_0x5ad7ea){var _0x521e8b={'raw':![],'where':{'id':_0x3d28b9['params']['id']}},_0x39edb6={};_0x39edb6[_0xc936('0x36')]=_[_0xc936('0x38')](db[_0xc936('0x31')][_0xc936('0x32')]);_0x39edb6[_0xc936('0x37')]=_['keys'](_0x3d28b9[_0xc936('0x37')]);_0x39edb6[_0xc936('0x39')]=_['intersection'](_0x39edb6[_0xc936('0x36')],_0x39edb6['query']);_0x521e8b[_0xc936('0x3b')]=_[_0xc936('0x3a')](_0x39edb6[_0xc936('0x36')],qs[_0xc936('0x3c')](_0x3d28b9[_0xc936('0x37')][_0xc936('0x3c')]));_0x521e8b[_0xc936('0x3b')]=_0x521e8b['attributes'][_0xc936('0x3d')]?_0x521e8b['attributes']:_0x39edb6[_0xc936('0x36')];if(_0x3d28b9['query'][_0xc936('0x48')]){_0x521e8b[_0xc936('0x49')]=[{'all':!![]}];}_0x521e8b=_[_0xc936('0x44')]({},_0x521e8b,_0x3d28b9[_0xc936('0x47')]);return db['Dashboard'][_0xc936('0x4c')](_0x521e8b)[_0xc936('0x29')](handleEntityNotFound(_0x5ad7ea,null))[_0xc936('0x29')](respondWithResult(_0x5ad7ea,null))[_0xc936('0x4b')](handleError(_0x5ad7ea,null));};exports['create']=function(_0x5c9561,_0x19f0e2){return db[_0xc936('0x31')][_0xc936('0x4d')](_0x5c9561['body'],{})['then'](function(_0x1b42cd){var _0x35c3c0=_0x5c9561['user'][_0xc936('0x2b')]({'plain':!![]});if(!_0x35c3c0)throw new Error(_0xc936('0x4e'));if(_0x35c3c0['role']===_0xc936('0x4f')){var _0x3f91ef=_0x1b42cd['get']({'plain':!![]});var _0x58fc92='CustomDashboards';return db['UserProfileSection'][_0xc936('0x4c')]({'where':{'name':_0x58fc92,'userProfileId':_0x35c3c0[_0xc936('0x50')]},'raw':!![]})['then'](function(_0x4a1cf2){if(_0x4a1cf2&&_0x4a1cf2['autoAssociation']===0x0){return db[_0xc936('0x51')]['create']({'name':_0x3f91ef[_0xc936('0x2e')],'resourceId':_0x3f91ef['id'],'type':_0x4a1cf2[_0xc936('0x2e')],'sectionId':_0x4a1cf2['id']},{})[_0xc936('0x29')](function(){return _0x1b42cd;});}else{return _0x1b42cd;}})['catch'](function(_0x580a99){logger[_0xc936('0x2c')](_0xc936('0x52'),_0x580a99);throw _0x580a99;});}return _0x1b42cd;})[_0xc936('0x29')](respondWithResult(_0x19f0e2,0xc9))[_0xc936('0x4b')](handleError(_0x19f0e2,null));};exports['clone']=function(_0x3e5620,_0x2f0eec){var _0x5afc13={'where':{'id':_0x3e5620[_0xc936('0x53')]['id']}},_0x1f25df={};_0x1f25df[_0xc936('0x36')]=_[_0xc936('0x38')](db[_0xc936('0x31')][_0xc936('0x32')]);_0x5afc13[_0xc936('0x3b')]=_[_0xc936('0x3a')](_0x1f25df[_0xc936('0x36')],qs[_0xc936('0x3c')](_0x3e5620[_0xc936('0x37')][_0xc936('0x3c')]));_0x5afc13[_0xc936('0x3b')]=_0x5afc13[_0xc936('0x3b')][_0xc936('0x3d')]?_0x5afc13[_0xc936('0x3b')]:_0x1f25df[_0xc936('0x36')];if(_0x3e5620[_0xc936('0x37')]['includeAll']){_0x5afc13[_0xc936('0x49')]=[{'all':!![]}];}_0x5afc13=_[_0xc936('0x44')]({},_0x5afc13,_0x3e5620[_0xc936('0x47')]);return db[_0xc936('0x31')]['find'](_0x5afc13)[_0xc936('0x29')](handleEntityNotFound(_0x2f0eec,null))['then'](function(_0xe453b2){if(_0xe453b2){var _0x10366d=_0xe453b2['get']({'plain':!![]});_0x10366d=qs[_0xc936('0x54')](_0x10366d,['id',_0xc936('0x55'),_0xc936('0x56')]);_0x3e5620[_0xc936('0x57')]=_[_0xc936('0x54')](_0x3e5620['body'],['id',_0xc936('0x55'),_0xc936('0x56')]);return db['Dashboard']['create'](_[_0xc936('0x44')](_0x10366d,_0x3e5620[_0xc936('0x57')]),{'include':_0x3e5620[_0xc936('0x37')][_0xc936('0x48')]?[{'all':!![]}]:undefined})[_0xc936('0x29')](function(_0x18ca04){var _0x372d78=_0x3e5620[_0xc936('0x4f')][_0xc936('0x2b')]({'plain':!![]});if(!_0x372d78)throw new Error(_0xc936('0x4e'));if(_0x372d78['role']==='user'){var _0x458ca2=_0x18ca04[_0xc936('0x2b')]({'plain':!![]});var _0xb0bc2=_0xc936('0x58');return db[_0xc936('0x59')][_0xc936('0x4c')]({'where':{'name':_0xb0bc2,'userProfileId':_0x372d78[_0xc936('0x50')]},'raw':!![]})[_0xc936('0x29')](function(_0x3b6de0){if(_0x3b6de0&&_0x3b6de0[_0xc936('0x5a')]===0x0){return db['UserProfileResource'][_0xc936('0x4d')]({'name':_0x458ca2['name'],'resourceId':_0x458ca2['id'],'type':_0x3b6de0[_0xc936('0x2e')],'sectionId':_0x3b6de0['id']},{})['then'](function(){return _0x18ca04;});}else{return _0x18ca04;}})[_0xc936('0x4b')](function(_0x1a63cd){logger[_0xc936('0x2c')](_0xc936('0x52'),_0x1a63cd);throw _0x1a63cd;});}return _0x18ca04;});}})[_0xc936('0x29')](respondWithResult(_0x2f0eec,0xc9))[_0xc936('0x4b')](handleError(_0x2f0eec,null));};exports[_0xc936('0x28')]=function(_0x54a4cf,_0x78a360){if(_0x54a4cf[_0xc936('0x57')]['id']){delete _0x54a4cf['body']['id'];}return db[_0xc936('0x31')][_0xc936('0x4c')]({'where':{'id':_0x54a4cf['params']['id']}})['then'](handleEntityNotFound(_0x78a360,null))['then'](saveUpdates(_0x54a4cf[_0xc936('0x57')],null))['then'](respondWithResult(_0x78a360,null))['catch'](handleError(_0x78a360,null));};exports['destroy']=function(_0x333e08,_0x10a581){return db[_0xc936('0x31')]['find']({'where':{'id':_0x333e08[_0xc936('0x53')]['id']}})[_0xc936('0x29')](handleEntityNotFound(_0x10a581,null))['then'](removeEntity(_0x10a581,null))[_0xc936('0x4b')](handleError(_0x10a581,null));};function widgetAttributes(_0x1692e9){try{switch(_0x1692e9[_0xc936('0x34')]){case _0xc936('0x5b'):return[{'name':_0xc936('0x5c'),'value':_0x1692e9['attrUrl']||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x0]?_0x1692e9[_0xc936('0x5d')][0x0][_0xc936('0x5e')]:undefined)||'https://'}];case _0xc936('0x5f'):return[{'name':_0xc936('0x60'),'value':_0x1692e9['attrPath']||(_0x1692e9['attrs']&&_0x1692e9[_0xc936('0x5d')][0x0]?_0x1692e9[_0xc936('0x5d')][0x0][_0xc936('0x5e')]:undefined)||''}];case _0xc936('0x61'):return[{'name':_0xc936('0x62'),'value':_0x1692e9[_0xc936('0x62')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x0]?_0x1692e9['attrs'][0x0][_0xc936('0x5e')]:undefined)||_0xc936('0x63')},{'name':_0xc936('0x64'),'value':_0x1692e9[_0xc936('0x64')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9['attrs'][0x1]?_0x1692e9[_0xc936('0x5d')][0x1][_0xc936('0x5e')]:undefined)||_0xc936('0x65')},{'name':_0xc936('0x66'),'value':_0x1692e9['attrFontSize']||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9['attrs'][0x2]?_0x1692e9[_0xc936('0x5d')][0x2][_0xc936('0x5e')]:undefined)||0xc}];case _0xc936('0x67'):return[{'name':_0xc936('0x68'),'value':_0x1692e9['attrMetric']||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x0]?_0x1692e9[_0xc936('0x5d')][0x0]['value']:undefined)||_0xc936('0x69')},{'name':_0xc936('0x6a'),'value':_0x1692e9[_0xc936('0x6a')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9['attrs'][0x1]?_0x1692e9[_0xc936('0x5d')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x1692e9['attrFontSize']||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x2]?_0x1692e9['attrs'][0x2]['value']:undefined)||0x14},{'name':_0xc936('0x6b'),'value':_0x1692e9[_0xc936('0x6b')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9['attrs'][0x3]?_0x1692e9[_0xc936('0x5d')][0x3]['value']:undefined)||'voice'},{'name':_0xc936('0x6c'),'value':_0x1692e9[_0xc936('0x6c')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x4]?_0x1692e9['attrs'][0x4][_0xc936('0x5e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1692e9['attrFaxAccounts']||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x5]?_0x1692e9[_0xc936('0x5d')][0x5][_0xc936('0x5e')]:undefined)||''},{'name':_0xc936('0x6d'),'value':_0x1692e9[_0xc936('0x6d')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x6]?_0x1692e9['attrs'][0x6][_0xc936('0x5e')]:undefined)||''},{'name':_0xc936('0x6e'),'value':_0x1692e9[_0xc936('0x6e')]||(_0x1692e9['attrs']&&_0x1692e9[_0xc936('0x5d')][0x7]?_0x1692e9['attrs'][0x7][_0xc936('0x5e')]:undefined)||''},{'name':_0xc936('0x6f'),'value':_0x1692e9[_0xc936('0x6f')]||(_0x1692e9['attrs']&&_0x1692e9['attrs'][0x8]?_0x1692e9[_0xc936('0x5d')][0x8][_0xc936('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1692e9[_0xc936('0x70')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x9]?_0x1692e9['attrs'][0x9]['value']:undefined)||''}];case _0xc936('0x71'):case _0xc936('0x72'):return[{'name':_0xc936('0x73'),'value':_0x1692e9[_0xc936('0x73')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x0]?_0x1692e9['attrs'][0x0][_0xc936('0x5e')]:undefined)||_0xc936('0x69')},{'name':_0xc936('0x74'),'value':_0x1692e9[_0xc936('0x74')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9['attrs'][0x1]?_0x1692e9['attrs'][0x1]['value']:undefined)||null},{'name':_0xc936('0x75'),'value':_0x1692e9[_0xc936('0x75')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x2]?_0x1692e9[_0xc936('0x5d')][0x2][_0xc936('0x5e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1692e9[_0xc936('0x6a')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x3]?_0x1692e9[_0xc936('0x5d')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x1692e9[_0xc936('0x6b')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x4]?_0x1692e9[_0xc936('0x5d')][0x4]['value']:undefined)||_0xc936('0x76')},{'name':'attrEmailAccounts','value':_0x1692e9[_0xc936('0x6c')]||(_0x1692e9['attrs']&&_0x1692e9[_0xc936('0x5d')][0x5]?_0x1692e9[_0xc936('0x5d')][0x5][_0xc936('0x5e')]:undefined)||''},{'name':_0xc936('0x77'),'value':_0x1692e9['attrFaxAccounts']||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x6]?_0x1692e9['attrs'][0x6][_0xc936('0x5e')]:undefined)||''},{'name':_0xc936('0x6d'),'value':_0x1692e9['attrSmsAccounts']||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x7]?_0x1692e9['attrs'][0x7]['value']:undefined)||''},{'name':_0xc936('0x6e'),'value':_0x1692e9['attrOpenchannelAccounts']||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x8]?_0x1692e9[_0xc936('0x5d')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1692e9[_0xc936('0x6f')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9['attrs'][0x9]?_0x1692e9[_0xc936('0x5d')][0x9][_0xc936('0x5e')]:undefined)||''},{'name':_0xc936('0x70'),'value':_0x1692e9[_0xc936('0x70')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0xa]?_0x1692e9[_0xc936('0x5d')][0xa][_0xc936('0x5e')]:undefined)||''}];case'web-report':return[{'name':_0xc936('0x78'),'type':_0x1692e9[_0xc936('0x79')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9[_0xc936('0x5d')][0x0]?_0x1692e9[_0xc936('0x5d')][0x0][_0xc936('0x34')]:undefined)||null,'value':_0x1692e9['attrReport']||(_0x1692e9['attrs']&&_0x1692e9[_0xc936('0x5d')][0x0]?_0x1692e9[_0xc936('0x5d')][0x0]['value']:undefined)||null},{'name':_0xc936('0x7a'),'value':_0x1692e9[_0xc936('0x7a')]||(_0x1692e9[_0xc936('0x5d')]&&_0x1692e9['attrs'][0x1]?_0x1692e9[_0xc936('0x5d')][0x1][_0xc936('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x179021){logger[_0xc936('0x2c')](_0xc936('0x7b'),JSON[_0xc936('0x7c')](_0x179021));return[];}}exports['addItem']=function(_0x3ce39c,_0x169df7,_0x6e40b9){if(_0x3ce39c[_0xc936('0x57')]['id']){delete _0x3ce39c[_0xc936('0x57')]['id'];}return db[_0xc936('0x31')][_0xc936('0x4c')]({'where':{'id':_0x3ce39c[_0xc936('0x53')]['id']}})['then'](handleEntityNotFound(_0x169df7,null))['then'](function(_0x4ef62f){if(_0x4ef62f){_0x3ce39c['body'][_0xc936('0x7d')]=_0x4ef62f['id'];_0x3ce39c[_0xc936('0x57')]['attrs']=widgetAttributes(_0x3ce39c[_0xc936('0x57')]);return db[_0xc936('0x7e')]['create'](_0x3ce39c['body']);}})[_0xc936('0x29')](respondWithResult(_0x169df7,null))['catch'](handleError(_0x169df7,null));};exports[_0xc936('0x7f')]=function(_0x7a3bc6,_0xd513cd,_0x94e8e0){var _0x2d9098={};var _0x5dd7bc={};var _0x385402;var _0x231501;return db[_0xc936('0x31')][_0xc936('0x80')]({'where':{'id':_0x7a3bc6[_0xc936('0x53')]['id']}})[_0xc936('0x29')](handleEntityNotFound(_0xd513cd,null))[_0xc936('0x29')](function(_0x5c7452){if(_0x5c7452){_0x385402=_0x5c7452;_0x5dd7bc[_0xc936('0x36')]=_[_0xc936('0x38')](db['DashboardItem'][_0xc936('0x32')]);_0x5dd7bc['query']=_[_0xc936('0x38')](_0x7a3bc6[_0xc936('0x37')]);_0x5dd7bc[_0xc936('0x39')]=_['intersection'](_0x5dd7bc[_0xc936('0x36')],_0x5dd7bc[_0xc936('0x37')]);_0x2d9098[_0xc936('0x3b')]=_['intersection'](_0x5dd7bc[_0xc936('0x36')],qs[_0xc936('0x3c')](_0x7a3bc6[_0xc936('0x37')]['fields']));_0x2d9098[_0xc936('0x3b')]=_0x2d9098[_0xc936('0x3b')][_0xc936('0x3d')]?_0x2d9098[_0xc936('0x3b')]:_0x5dd7bc['model'];_0x2d9098[_0xc936('0x40')]=qs['sort'](_0x7a3bc6[_0xc936('0x37')][_0xc936('0x41')]);_0x2d9098[_0xc936('0x42')]=qs[_0xc936('0x39')](_[_0xc936('0x43')](_0x7a3bc6[_0xc936('0x37')],_0x5dd7bc[_0xc936('0x39')]));if(_0x7a3bc6[_0xc936('0x37')][_0xc936('0x46')]){_0x2d9098[_0xc936('0x42')]=_['merge'](_0x2d9098[_0xc936('0x42')],{'$or':_[_0xc936('0x30')](_0x2d9098[_0xc936('0x3b')],function(_0x1c4c36){var _0x4b0af2={};_0x4b0af2[_0x1c4c36]={'$like':'%'+_0x7a3bc6[_0xc936('0x37')][_0xc936('0x46')]+'%'};return _0x4b0af2;})});}_0x2d9098=_[_0xc936('0x44')]({},_0x2d9098,_0x7a3bc6[_0xc936('0x47')]);return _0x385402[_0xc936('0x7f')](_0x2d9098);}})['then'](function(_0x1e0865){if(_0x1e0865){_0x231501=_0x1e0865[_0xc936('0x3d')];if(!_0x7a3bc6['query']['hasOwnProperty'](_0xc936('0x3f'))){_0x2d9098[_0xc936('0x22')]=qs[_0xc936('0x22')](_0x7a3bc6[_0xc936('0x37')][_0xc936('0x22')]);_0x2d9098[_0xc936('0x24')]=qs[_0xc936('0x24')](_0x7a3bc6[_0xc936('0x37')][_0xc936('0x24')]);}return _0x385402[_0xc936('0x7f')](_0x2d9098);}})['then'](function(_0x32da08){if(_0x32da08){return _0x32da08?{'count':_0x231501,'rows':_0x32da08}:null;}})['then'](respondWithResult(_0xd513cd,null))[_0xc936('0x4b')](handleError(_0xd513cd,null));}; \ No newline at end of file +var _0x434c=['attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','nolimit','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','localhost','socket.io-emitter','redis','./dashboard.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','CustomDashboards','UserProfileResource','stack','name','index','rawAttributes','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','Dashboard','includeAll','include','findAll','rows','show','params','keys','filters','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','UserProfileSection','error','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts'];(function(_0x58dd94,_0x11be3a){var _0xc4a529=function(_0x41e11c){while(--_0x41e11c){_0x58dd94['push'](_0x58dd94['shift']());}};_0xc4a529(++_0x11be3a);}(_0x434c,0x116));var _0xc434=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x434c[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0xc434('0x0'));var rimraf=require(_0xc434('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc434('0x2'));var rp=require(_0xc434('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc434('0x4'));var path=require(_0xc434('0x5'));var sox=require('sox');var csv=require(_0xc434('0x6'));var ejs=require(_0xc434('0x7'));var fs=require('fs');var fs_extra=require(_0xc434('0x8'));var _=require(_0xc434('0x9'));var squel=require('squel');var crypto=require(_0xc434('0xa'));var jsforce=require(_0xc434('0xb'));var deskjs=require(_0xc434('0xc'));var toCsv=require(_0xc434('0x6'));var querystring=require(_0xc434('0xd'));var Papa=require('papaparse');var Redis=require(_0xc434('0xe'));var authService=require(_0xc434('0xf'));var qs=require(_0xc434('0x10'));var as=require(_0xc434('0x11'));var hardwareService=require(_0xc434('0x12'));var logger=require(_0xc434('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc434('0x14'));var licenseUtil=require(_0xc434('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xc434('0x16'),'port':0x18eb});var socket=require(_0xc434('0x17'))(new Redis(config[_0xc434('0x18')]));require(_0xc434('0x19'))[_0xc434('0x1a')](socket);function respondWithStatusCode(_0x209166,_0x18a040){_0x18a040=_0x18a040||0xcc;return function(_0x40b3c5){if(_0x40b3c5){return _0x209166[_0xc434('0x1b')](_0x18a040);}return _0x209166[_0xc434('0x1c')](_0x18a040)[_0xc434('0x1d')]();};}function respondWithResult(_0x148e58,_0x3dbdfc){_0x3dbdfc=_0x3dbdfc||0xc8;return function(_0x42a025){if(_0x42a025){return _0x148e58[_0xc434('0x1c')](_0x3dbdfc)['json'](_0x42a025);}};}function respondWithFilteredResult(_0x1a34c1,_0xb64325){return function(_0x159809){if(_0x159809){var _0x130497=typeof _0xb64325[_0xc434('0x1e')]===_0xc434('0x1f')&&typeof _0xb64325[_0xc434('0x20')]==='undefined';var _0x3339d2=_0x159809[_0xc434('0x21')];var _0x96db03=_0x130497?0x0:_0xb64325[_0xc434('0x1e')];var _0x2fbc21=_0x130497?_0x159809[_0xc434('0x21')]:_0xb64325['offset']+_0xb64325[_0xc434('0x20')];var _0x39761f;if(_0x2fbc21>=_0x3339d2){_0x2fbc21=_0x3339d2;_0x39761f=0xc8;}else{_0x39761f=0xce;}_0x1a34c1[_0xc434('0x1c')](_0x39761f);return _0x1a34c1[_0xc434('0x22')](_0xc434('0x23'),_0x96db03+'-'+_0x2fbc21+'/'+_0x3339d2)['json'](_0x159809);}return null;};}function patchUpdates(_0x556aa9){return function(_0x2082e1){try{jsonpatch[_0xc434('0x24')](_0x2082e1,_0x556aa9,!![]);}catch(_0x2438eb){return BPromise[_0xc434('0x25')](_0x2438eb);}return _0x2082e1['save']();};}function saveUpdates(_0x38bd82,_0x50da13){return function(_0x3ae018){if(_0x3ae018){return _0x3ae018[_0xc434('0x26')](_0x38bd82)[_0xc434('0x27')](function(_0x32ef56){return _0x32ef56;});}return null;};}function removeEntity(_0x57d13d,_0xc5d2a7){return function(_0x6698fb){if(_0x6698fb){return _0x6698fb[_0xc434('0x28')]()[_0xc434('0x27')](function(){var _0x5e3823=_0x6698fb['get']({'plain':!![]});var _0x79f667=_0xc434('0x29');return db[_0xc434('0x2a')][_0xc434('0x28')]({'where':{'type':_0x79f667,'resourceId':_0x5e3823['id']}})[_0xc434('0x27')](function(){return _0x6698fb;});})[_0xc434('0x27')](function(){_0x57d13d[_0xc434('0x1c')](0xcc)[_0xc434('0x1d')]();});}};}function handleEntityNotFound(_0x176802,_0x44bfbf){return function(_0x303803){if(!_0x303803){_0x176802[_0xc434('0x1b')](0x194);}return _0x303803;};}function handleError(_0x52821d,_0x36d28b){_0x36d28b=_0x36d28b||0x1f4;return function(_0x396d39){logger['error'](_0x396d39[_0xc434('0x2b')]);if(_0x396d39[_0xc434('0x2c')]){delete _0x396d39[_0xc434('0x2c')];}_0x52821d[_0xc434('0x1c')](_0x36d28b)['send'](_0x396d39);};}exports[_0xc434('0x2d')]=function(_0x85ce80,_0x24d90c){var _0x1778e1={},_0x31bea7={},_0x549b00={'count':0x0,'rows':[]};var _0xb4fcba=_['map'](db['Dashboard'][_0xc434('0x2e')],function(_0x34eba6){return{'name':_0x34eba6['fieldName'],'type':_0x34eba6['type'][_0xc434('0x2f')]};});_0x31bea7[_0xc434('0x30')]=_['map'](_0xb4fcba,_0xc434('0x2c'));_0x31bea7['query']=_['keys'](_0x85ce80[_0xc434('0x31')]);_0x31bea7['filters']=_['intersection'](_0x31bea7[_0xc434('0x30')],_0x31bea7[_0xc434('0x31')]);_0x1778e1[_0xc434('0x32')]=_[_0xc434('0x33')](_0x31bea7[_0xc434('0x30')],qs[_0xc434('0x34')](_0x85ce80[_0xc434('0x31')][_0xc434('0x34')]));_0x1778e1['attributes']=_0x1778e1['attributes'][_0xc434('0x35')]?_0x1778e1[_0xc434('0x32')]:_0x31bea7[_0xc434('0x30')];if(!_0x85ce80[_0xc434('0x31')][_0xc434('0x36')]('nolimit')){_0x1778e1[_0xc434('0x20')]=qs[_0xc434('0x20')](_0x85ce80[_0xc434('0x31')][_0xc434('0x20')]);_0x1778e1[_0xc434('0x1e')]=qs[_0xc434('0x1e')](_0x85ce80['query'][_0xc434('0x1e')]);}_0x1778e1[_0xc434('0x37')]=qs[_0xc434('0x38')](_0x85ce80[_0xc434('0x31')]['sort']);_0x1778e1[_0xc434('0x39')]=qs['filters'](_[_0xc434('0x3a')](_0x85ce80['query'],_0x31bea7['filters']),_0xb4fcba);if(_0x85ce80[_0xc434('0x31')][_0xc434('0x3b')]){_0x1778e1[_0xc434('0x39')]=_[_0xc434('0x3c')](_0x1778e1[_0xc434('0x39')],{'$or':_[_0xc434('0x3d')](_0xb4fcba,function(_0x1aed30){if(_0x1aed30[_0xc434('0x3e')]!==_0xc434('0x3f')){var _0x5a1fc8={};_0x5a1fc8[_0x1aed30['name']]={'$like':'%'+_0x85ce80[_0xc434('0x31')][_0xc434('0x3b')]+'%'};return _0x5a1fc8;}})});}_0x1778e1=_[_0xc434('0x3c')]({},_0x1778e1,_0x85ce80[_0xc434('0x40')]);var _0x5794b0={'where':_0x1778e1[_0xc434('0x39')]};return db[_0xc434('0x41')][_0xc434('0x21')](_0x5794b0)['then'](function(_0x5a937c){_0x549b00[_0xc434('0x21')]=_0x5a937c;if(_0x85ce80[_0xc434('0x31')][_0xc434('0x42')]){_0x1778e1[_0xc434('0x43')]=[{'all':!![]}];}return db[_0xc434('0x41')][_0xc434('0x44')](_0x1778e1);})[_0xc434('0x27')](function(_0x1bd118){_0x549b00[_0xc434('0x45')]=_0x1bd118;return _0x549b00;})[_0xc434('0x27')](respondWithFilteredResult(_0x24d90c,_0x1778e1))['catch'](handleError(_0x24d90c,null));};exports[_0xc434('0x46')]=function(_0x4be616,_0x1fbe75){var _0x53f1f5={'raw':![],'where':{'id':_0x4be616[_0xc434('0x47')]['id']}},_0x300334={};_0x300334[_0xc434('0x30')]=_[_0xc434('0x48')](db[_0xc434('0x41')][_0xc434('0x2e')]);_0x300334[_0xc434('0x31')]=_['keys'](_0x4be616['query']);_0x300334[_0xc434('0x49')]=_['intersection'](_0x300334[_0xc434('0x30')],_0x300334[_0xc434('0x31')]);_0x53f1f5['attributes']=_[_0xc434('0x33')](_0x300334[_0xc434('0x30')],qs[_0xc434('0x34')](_0x4be616['query'][_0xc434('0x34')]));_0x53f1f5['attributes']=_0x53f1f5['attributes'][_0xc434('0x35')]?_0x53f1f5['attributes']:_0x300334[_0xc434('0x30')];if(_0x4be616[_0xc434('0x31')]['includeAll']){_0x53f1f5[_0xc434('0x43')]=[{'all':!![]}];}_0x53f1f5=_['merge']({},_0x53f1f5,_0x4be616[_0xc434('0x40')]);return db[_0xc434('0x41')][_0xc434('0x4a')](_0x53f1f5)[_0xc434('0x27')](handleEntityNotFound(_0x1fbe75,null))[_0xc434('0x27')](respondWithResult(_0x1fbe75,null))[_0xc434('0x4b')](handleError(_0x1fbe75,null));};exports[_0xc434('0x4c')]=function(_0x891eb4,_0x31281b){return db['Dashboard'][_0xc434('0x4c')](_0x891eb4['body'],{})['then'](function(_0x1c5fe1){var _0x39e25f=_0x891eb4[_0xc434('0x4d')][_0xc434('0x4e')]({'plain':!![]});if(!_0x39e25f)throw new Error(_0xc434('0x4f'));if(_0x39e25f[_0xc434('0x50')]===_0xc434('0x4d')){var _0x47bcbe=_0x1c5fe1[_0xc434('0x4e')]({'plain':!![]});var _0x3f79d3=_0xc434('0x29');return db['UserProfileSection'][_0xc434('0x4a')]({'where':{'name':_0x3f79d3,'userProfileId':_0x39e25f[_0xc434('0x51')]},'raw':!![]})[_0xc434('0x27')](function(_0x26d553){if(_0x26d553&&_0x26d553[_0xc434('0x52')]===0x0){return db[_0xc434('0x2a')][_0xc434('0x4c')]({'name':_0x47bcbe[_0xc434('0x2c')],'resourceId':_0x47bcbe['id'],'type':_0x26d553[_0xc434('0x2c')],'sectionId':_0x26d553['id']},{})['then'](function(){return _0x1c5fe1;});}else{return _0x1c5fe1;}})['catch'](function(_0x22547d){logger['error'](_0xc434('0x53'),_0x22547d);throw _0x22547d;});}return _0x1c5fe1;})[_0xc434('0x27')](respondWithResult(_0x31281b,0xc9))[_0xc434('0x4b')](handleError(_0x31281b,null));};exports[_0xc434('0x54')]=function(_0x4da67f,_0x361504){var _0x36303e={'where':{'id':_0x4da67f[_0xc434('0x47')]['id']}},_0x12ad34={};_0x12ad34[_0xc434('0x30')]=_['keys'](db[_0xc434('0x41')][_0xc434('0x2e')]);_0x36303e[_0xc434('0x32')]=_['intersection'](_0x12ad34[_0xc434('0x30')],qs[_0xc434('0x34')](_0x4da67f['query'][_0xc434('0x34')]));_0x36303e[_0xc434('0x32')]=_0x36303e['attributes'][_0xc434('0x35')]?_0x36303e[_0xc434('0x32')]:_0x12ad34[_0xc434('0x30')];if(_0x4da67f[_0xc434('0x31')][_0xc434('0x42')]){_0x36303e[_0xc434('0x43')]=[{'all':!![]}];}_0x36303e=_[_0xc434('0x3c')]({},_0x36303e,_0x4da67f[_0xc434('0x40')]);return db[_0xc434('0x41')][_0xc434('0x4a')](_0x36303e)[_0xc434('0x27')](handleEntityNotFound(_0x361504,null))[_0xc434('0x27')](function(_0x3b42fe){if(_0x3b42fe){var _0x692598=_0x3b42fe['get']({'plain':!![]});_0x692598=qs['omit'](_0x692598,['id',_0xc434('0x55'),_0xc434('0x56')]);_0x4da67f[_0xc434('0x57')]=_['omit'](_0x4da67f[_0xc434('0x57')],['id',_0xc434('0x55'),_0xc434('0x56')]);return db[_0xc434('0x41')][_0xc434('0x4c')](_[_0xc434('0x3c')](_0x692598,_0x4da67f[_0xc434('0x57')]),{'include':_0x4da67f[_0xc434('0x31')][_0xc434('0x42')]?[{'all':!![]}]:undefined})[_0xc434('0x27')](function(_0x4b89ca){var _0x3e7a40=_0x4da67f[_0xc434('0x4d')]['get']({'plain':!![]});if(!_0x3e7a40)throw new Error(_0xc434('0x4f'));if(_0x3e7a40['role']===_0xc434('0x4d')){var _0x339e59=_0x4b89ca[_0xc434('0x4e')]({'plain':!![]});var _0x4cb4ce=_0xc434('0x29');return db[_0xc434('0x58')]['find']({'where':{'name':_0x4cb4ce,'userProfileId':_0x3e7a40[_0xc434('0x51')]},'raw':!![]})[_0xc434('0x27')](function(_0x5259b6){if(_0x5259b6&&_0x5259b6['autoAssociation']===0x0){return db[_0xc434('0x2a')]['create']({'name':_0x339e59[_0xc434('0x2c')],'resourceId':_0x339e59['id'],'type':_0x5259b6[_0xc434('0x2c')],'sectionId':_0x5259b6['id']},{})[_0xc434('0x27')](function(){return _0x4b89ca;});}else{return _0x4b89ca;}})[_0xc434('0x4b')](function(_0x4525fd){logger[_0xc434('0x59')](_0xc434('0x53'),_0x4525fd);throw _0x4525fd;});}return _0x4b89ca;});}})[_0xc434('0x27')](respondWithResult(_0x361504,0xc9))[_0xc434('0x4b')](handleError(_0x361504,null));};exports[_0xc434('0x26')]=function(_0x47ed82,_0x4b643c){if(_0x47ed82[_0xc434('0x57')]['id']){delete _0x47ed82[_0xc434('0x57')]['id'];}return db[_0xc434('0x41')][_0xc434('0x4a')]({'where':{'id':_0x47ed82['params']['id']}})['then'](handleEntityNotFound(_0x4b643c,null))['then'](saveUpdates(_0x47ed82[_0xc434('0x57')],null))[_0xc434('0x27')](respondWithResult(_0x4b643c,null))[_0xc434('0x4b')](handleError(_0x4b643c,null));};exports[_0xc434('0x28')]=function(_0x147707,_0x40fb43){return db[_0xc434('0x41')][_0xc434('0x4a')]({'where':{'id':_0x147707[_0xc434('0x47')]['id']}})['then'](handleEntityNotFound(_0x40fb43,null))[_0xc434('0x27')](removeEntity(_0x40fb43,null))['catch'](handleError(_0x40fb43,null));};function widgetAttributes(_0x5db68d){try{switch(_0x5db68d[_0xc434('0x3e')]){case _0xc434('0x5a'):return[{'name':_0xc434('0x5b'),'value':_0x5db68d[_0xc434('0x5b')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d['attrs'][0x0]?_0x5db68d[_0xc434('0x5c')][0x0][_0xc434('0x5d')]:undefined)||_0xc434('0x5e')}];case'custom':return[{'name':'attrPath','value':_0x5db68d[_0xc434('0x5f')]||(_0x5db68d['attrs']&&_0x5db68d[_0xc434('0x5c')][0x0]?_0x5db68d[_0xc434('0x5c')][0x0]['value']:undefined)||''}];case _0xc434('0x60'):return[{'name':_0xc434('0x61'),'value':_0x5db68d[_0xc434('0x61')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x0]?_0x5db68d[_0xc434('0x5c')][0x0]['value']:undefined)||_0xc434('0x62')},{'name':_0xc434('0x63'),'value':_0x5db68d[_0xc434('0x63')]||(_0x5db68d['attrs']&&_0x5db68d[_0xc434('0x5c')][0x1]?_0x5db68d['attrs'][0x1]['value']:undefined)||_0xc434('0x64')},{'name':'attrFontSize','value':_0x5db68d[_0xc434('0x65')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x2]?_0x5db68d[_0xc434('0x5c')][0x2]['value']:undefined)||0xc}];case _0xc434('0x66'):return[{'name':_0xc434('0x67'),'value':_0x5db68d['attrMetric']||(_0x5db68d['attrs']&&_0x5db68d[_0xc434('0x5c')][0x0]?_0x5db68d[_0xc434('0x5c')][0x0][_0xc434('0x5d')]:undefined)||_0xc434('0x68')},{'name':'attrVoiceQueues','value':_0x5db68d[_0xc434('0x69')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x1]?_0x5db68d['attrs'][0x1][_0xc434('0x5d')]:undefined)||[]},{'name':_0xc434('0x65'),'value':_0x5db68d[_0xc434('0x65')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x2]?_0x5db68d['attrs'][0x2][_0xc434('0x5d')]:undefined)||0x14},{'name':_0xc434('0x6a'),'value':_0x5db68d[_0xc434('0x6a')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x3]?_0x5db68d['attrs'][0x3][_0xc434('0x5d')]:undefined)||_0xc434('0x6b')},{'name':'attrEmailAccounts','value':_0x5db68d['attrEmailAccounts']||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d['attrs'][0x4]?_0x5db68d['attrs'][0x4][_0xc434('0x5d')]:undefined)||''},{'name':_0xc434('0x6c'),'value':_0x5db68d[_0xc434('0x6c')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x5]?_0x5db68d[_0xc434('0x5c')][0x5]['value']:undefined)||''},{'name':_0xc434('0x6d'),'value':_0x5db68d[_0xc434('0x6d')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d['attrs'][0x6]?_0x5db68d[_0xc434('0x5c')][0x6][_0xc434('0x5d')]:undefined)||''},{'name':_0xc434('0x6e'),'value':_0x5db68d[_0xc434('0x6e')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x7]?_0x5db68d[_0xc434('0x5c')][0x7]['value']:undefined)||''},{'name':_0xc434('0x6f'),'value':_0x5db68d[_0xc434('0x6f')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x8]?_0x5db68d[_0xc434('0x5c')][0x8][_0xc434('0x5d')]:undefined)||''},{'name':_0xc434('0x70'),'value':_0x5db68d[_0xc434('0x70')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x9]?_0x5db68d[_0xc434('0x5c')][0x9][_0xc434('0x5d')]:undefined)||''}];case _0xc434('0x71'):case _0xc434('0x72'):return[{'name':_0xc434('0x73'),'value':_0x5db68d[_0xc434('0x73')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d['attrs'][0x0]?_0x5db68d[_0xc434('0x5c')][0x0]['value']:undefined)||_0xc434('0x68')},{'name':_0xc434('0x74'),'value':_0x5db68d[_0xc434('0x74')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x1]?_0x5db68d[_0xc434('0x5c')][0x1][_0xc434('0x5d')]:undefined)||null},{'name':'attrSerie3','value':_0x5db68d[_0xc434('0x75')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x2]?_0x5db68d[_0xc434('0x5c')][0x2][_0xc434('0x5d')]:undefined)||null},{'name':_0xc434('0x69'),'value':_0x5db68d['attrVoiceQueues']||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x3]?_0x5db68d[_0xc434('0x5c')][0x3]['value']:undefined)||[]},{'name':_0xc434('0x6a'),'value':_0x5db68d['attrChannel']||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d['attrs'][0x4]?_0x5db68d[_0xc434('0x5c')][0x4]['value']:undefined)||_0xc434('0x6b')},{'name':_0xc434('0x76'),'value':_0x5db68d[_0xc434('0x76')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x5]?_0x5db68d[_0xc434('0x5c')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x5db68d['attrFaxAccounts']||(_0x5db68d['attrs']&&_0x5db68d['attrs'][0x6]?_0x5db68d[_0xc434('0x5c')][0x6][_0xc434('0x5d')]:undefined)||''},{'name':_0xc434('0x6d'),'value':_0x5db68d['attrSmsAccounts']||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x7]?_0x5db68d[_0xc434('0x5c')][0x7][_0xc434('0x5d')]:undefined)||''},{'name':_0xc434('0x6e'),'value':_0x5db68d[_0xc434('0x6e')]||(_0x5db68d['attrs']&&_0x5db68d[_0xc434('0x5c')][0x8]?_0x5db68d[_0xc434('0x5c')][0x8][_0xc434('0x5d')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5db68d[_0xc434('0x6f')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d['attrs'][0x9]?_0x5db68d[_0xc434('0x5c')][0x9]['value']:undefined)||''},{'name':_0xc434('0x70'),'value':_0x5db68d[_0xc434('0x70')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0xa]?_0x5db68d[_0xc434('0x5c')][0xa][_0xc434('0x5d')]:undefined)||''}];case'web-report':return[{'name':_0xc434('0x77'),'type':_0x5db68d[_0xc434('0x78')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d['attrs'][0x0]?_0x5db68d[_0xc434('0x5c')][0x0][_0xc434('0x3e')]:undefined)||null,'value':_0x5db68d['attrReport']||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x0]?_0x5db68d['attrs'][0x0][_0xc434('0x5d')]:undefined)||null},{'name':_0xc434('0x79'),'value':_0x5db68d[_0xc434('0x79')]||(_0x5db68d[_0xc434('0x5c')]&&_0x5db68d[_0xc434('0x5c')][0x1]?_0x5db68d[_0xc434('0x5c')][0x1][_0xc434('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x37f284){logger[_0xc434('0x59')](_0xc434('0x7a'),JSON[_0xc434('0x7b')](_0x37f284));return[];}}exports[_0xc434('0x7c')]=function(_0x31cb7e,_0x34aa17,_0x4848c9){if(_0x31cb7e['body']['id']){delete _0x31cb7e['body']['id'];}return db[_0xc434('0x41')][_0xc434('0x4a')]({'where':{'id':_0x31cb7e[_0xc434('0x47')]['id']}})[_0xc434('0x27')](handleEntityNotFound(_0x34aa17,null))[_0xc434('0x27')](function(_0x4b42ef){if(_0x4b42ef){_0x31cb7e['body'][_0xc434('0x7d')]=_0x4b42ef['id'];_0x31cb7e[_0xc434('0x57')][_0xc434('0x5c')]=widgetAttributes(_0x31cb7e['body']);return db[_0xc434('0x7e')][_0xc434('0x4c')](_0x31cb7e[_0xc434('0x57')]);}})[_0xc434('0x27')](respondWithResult(_0x34aa17,null))[_0xc434('0x4b')](handleError(_0x34aa17,null));};exports['getItems']=function(_0x1e63e1,_0x4c5242,_0x46b3cf){var _0x3e79a2={};var _0x226f7a={};var _0x532534;var _0x3975bc;return db[_0xc434('0x41')]['findOne']({'where':{'id':_0x1e63e1[_0xc434('0x47')]['id']}})[_0xc434('0x27')](handleEntityNotFound(_0x4c5242,null))[_0xc434('0x27')](function(_0x55abb4){if(_0x55abb4){_0x532534=_0x55abb4;_0x226f7a[_0xc434('0x30')]=_[_0xc434('0x48')](db[_0xc434('0x7e')][_0xc434('0x2e')]);_0x226f7a[_0xc434('0x31')]=_[_0xc434('0x48')](_0x1e63e1[_0xc434('0x31')]);_0x226f7a[_0xc434('0x49')]=_[_0xc434('0x33')](_0x226f7a[_0xc434('0x30')],_0x226f7a[_0xc434('0x31')]);_0x3e79a2[_0xc434('0x32')]=_[_0xc434('0x33')](_0x226f7a[_0xc434('0x30')],qs[_0xc434('0x34')](_0x1e63e1[_0xc434('0x31')][_0xc434('0x34')]));_0x3e79a2[_0xc434('0x32')]=_0x3e79a2['attributes'][_0xc434('0x35')]?_0x3e79a2[_0xc434('0x32')]:_0x226f7a[_0xc434('0x30')];_0x3e79a2[_0xc434('0x37')]=qs[_0xc434('0x38')](_0x1e63e1[_0xc434('0x31')][_0xc434('0x38')]);_0x3e79a2[_0xc434('0x39')]=qs[_0xc434('0x49')](_[_0xc434('0x3a')](_0x1e63e1[_0xc434('0x31')],_0x226f7a[_0xc434('0x49')]));if(_0x1e63e1[_0xc434('0x31')]['filter']){_0x3e79a2[_0xc434('0x39')]=_[_0xc434('0x3c')](_0x3e79a2[_0xc434('0x39')],{'$or':_[_0xc434('0x3d')](_0x3e79a2['attributes'],function(_0x149325){var _0x5a4047={};_0x5a4047[_0x149325]={'$like':'%'+_0x1e63e1[_0xc434('0x31')][_0xc434('0x3b')]+'%'};return _0x5a4047;})});}_0x3e79a2=_[_0xc434('0x3c')]({},_0x3e79a2,_0x1e63e1['options']);return _0x532534[_0xc434('0x7f')](_0x3e79a2);}})[_0xc434('0x27')](function(_0x571156){if(_0x571156){_0x3975bc=_0x571156[_0xc434('0x35')];if(!_0x1e63e1[_0xc434('0x31')]['hasOwnProperty'](_0xc434('0x80'))){_0x3e79a2[_0xc434('0x20')]=qs[_0xc434('0x20')](_0x1e63e1[_0xc434('0x31')][_0xc434('0x20')]);_0x3e79a2[_0xc434('0x1e')]=qs[_0xc434('0x1e')](_0x1e63e1[_0xc434('0x31')][_0xc434('0x1e')]);}return _0x532534[_0xc434('0x7f')](_0x3e79a2);}})[_0xc434('0x27')](function(_0x3fc2d9){if(_0x3fc2d9){return _0x3fc2d9?{'count':_0x3975bc,'rows':_0x3fc2d9}:null;}})['then'](respondWithResult(_0x4c5242,null))[_0xc434('0x4b')](handleError(_0x4c5242,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 26b4df8..a369e36 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 _0x214e=['update','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x29e858,_0x205c0c){var _0x54e531=function(_0x2c4f06){while(--_0x2c4f06){_0x29e858['push'](_0x29e858['shift']());}};_0x54e531(++_0x205c0c);}(_0x214e,0x148));var _0xe214=function(_0x17bb10,_0x17a5f7){_0x17bb10=_0x17bb10-0x0;var _0x1de606=_0x214e[_0x17bb10];return _0x1de606;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xe214('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xe214('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe214('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2384b9){return function(_0x531f72,_0x28d16d,_0x237c87){DashboardEvents['emit'](_0x2384b9+':'+_0x531f72['id'],_0x531f72);DashboardEvents['emit'](_0x2384b9,_0x531f72);_0x237c87(null);};}for(var e in events){if(events[_0xe214('0x3')](e)){var event=events[e];Dashboard[_0xe214('0x4')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x3f3d=['remove','emit','hasOwnProperty','hook','events','Dashboard','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f3d,0xd4));var _0xd3f3=function(_0x3bc298,_0x583d14){_0x3bc298=_0x3bc298-0x0;var _0x31bf58=_0x3f3d[_0x3bc298];return _0x31bf58;};'use strict';var EventEmitter=require(_0xd3f3('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xd3f3('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xd3f3('0x2')](0x0);var events={'afterCreate':_0xd3f3('0x3'),'afterUpdate':'update','afterDestroy':_0xd3f3('0x4')};function emitEvent(_0x50b34b){return function(_0x329bd0,_0x3168ef,_0x328b92){DashboardEvents[_0xd3f3('0x5')](_0x50b34b+':'+_0x329bd0['id'],_0x329bd0);DashboardEvents[_0xd3f3('0x5')](_0x50b34b,_0x329bd0);_0x328b92(null);};}for(var e in events){if(events[_0xd3f3('0x6')](e)){var event=events[e];Dashboard[_0xd3f3('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index d1b8fd5..87f39ef 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 _0x1e56=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','define','dashboards','lodash','util','../../config/logger'];(function(_0xf35bc1,_0x510803){var _0xa6b162=function(_0x1e5cc8){while(--_0x1e5cc8){_0xf35bc1['push'](_0xf35bc1['shift']());}};_0xa6b162(++_0x510803);}(_0x1e56,0x176));var _0x61e5=function(_0x5c1d96,_0x2b6086){_0x5c1d96=_0x5c1d96-0x0;var _0x12e2cc=_0x1e56[_0x5c1d96];return _0x12e2cc;};'use strict';var _=require(_0x61e5('0x0'));var util=require(_0x61e5('0x1'));var logger=require(_0x61e5('0x2'))(_0x61e5('0x3'));var moment=require(_0x61e5('0x4'));var BPromise=require(_0x61e5('0x5'));var rp=require(_0x61e5('0x6'));var fs=require('fs');var path=require(_0x61e5('0x7'));var rimraf=require(_0x61e5('0x8'));var config=require(_0x61e5('0x9'));var attributes=require(_0x61e5('0xa'));module['exports']=function(_0x517cc5,_0x45b5d2){return _0x517cc5[_0x61e5('0xb')]('Dashboard',attributes,{'tableName':_0x61e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e1f=['api','moment','bluebird','request-promise','path','rimraf','exports','Dashboard','dashboards','lodash','../../config/logger'];(function(_0x36798a,_0x347c4f){var _0x578847=function(_0x2b0085){while(--_0x2b0085){_0x36798a['push'](_0x36798a['shift']());}};_0x578847(++_0x347c4f);}(_0x3e1f,0xe5));var _0xf3e1=function(_0x28678d,_0x54324f){_0x28678d=_0x28678d-0x0;var _0x1643e9=_0x3e1f[_0x28678d];return _0x1643e9;};'use strict';var _=require(_0xf3e1('0x0'));var util=require('util');var logger=require(_0xf3e1('0x1'))(_0xf3e1('0x2'));var moment=require(_0xf3e1('0x3'));var BPromise=require(_0xf3e1('0x4'));var rp=require(_0xf3e1('0x5'));var fs=require('fs');var path=require(_0xf3e1('0x6'));var rimraf=require(_0xf3e1('0x7'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0xf3e1('0x8')]=function(_0x3ee96e,_0x4e24f3){return _0x3ee96e['define'](_0xf3e1('0x9'),attributes,{'tableName':_0xf3e1('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 a628d30..eed9fee 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 _0x2a03=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./dashboard.socket','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x7572a9,_0x225e61){var _0x11c9d8=function(_0x27af46){while(--_0x27af46){_0x7572a9['push'](_0x7572a9['shift']());}};_0x11c9d8(++_0x225e61);}(_0x2a03,0xf6));var _0x32a0=function(_0x726624,_0x21f598){_0x726624=_0x726624-0x0;var _0x14fb9f=_0x2a03[_0x726624];return _0x14fb9f;};'use strict';var _=require(_0x32a0('0x0'));var util=require(_0x32a0('0x1'));var moment=require('moment');var BPromise=require(_0x32a0('0x2'));var rs=require(_0x32a0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x32a0('0x4'))('rpc');var config=require(_0x32a0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x32a0('0x6')][_0x32a0('0x7')]({'port':0x232a});config[_0x32a0('0x8')]=_[_0x32a0('0x9')](config[_0x32a0('0x8')],{'host':_0x32a0('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x32a0('0xb'))['register'](socket);function respondWithRpcPromise(_0x4ed9eb,_0x66402,_0x2c1bb7){return new BPromise(function(_0x94aaf1,_0x15c56a){return client[_0x32a0('0xc')](_0x4ed9eb,_0x2c1bb7)[_0x32a0('0xd')](function(_0x1bbcaa){logger['info'](_0x32a0('0xe'),_0x66402,_0x32a0('0xf'));logger[_0x32a0('0x10')](_0x32a0('0x11'),_0x66402,_0x32a0('0xf'),JSON[_0x32a0('0x12')](_0x1bbcaa));if(_0x1bbcaa[_0x32a0('0x13')]){if(_0x1bbcaa[_0x32a0('0x13')][_0x32a0('0x14')]===0x1f4){logger[_0x32a0('0x13')](_0x32a0('0xe'),_0x66402,_0x1bbcaa[_0x32a0('0x13')][_0x32a0('0x15')]);return _0x15c56a(_0x1bbcaa[_0x32a0('0x13')][_0x32a0('0x15')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x66402,_0x1bbcaa[_0x32a0('0x13')][_0x32a0('0x15')]);return _0x94aaf1(_0x1bbcaa['error'][_0x32a0('0x15')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x66402,'request\x20sent');_0x94aaf1(_0x1bbcaa[_0x32a0('0x16')]['message']);}})[_0x32a0('0x17')](function(_0x228269){logger[_0x32a0('0x13')](_0x32a0('0xe'),_0x66402,_0x228269);_0x15c56a(_0x228269);});});} \ No newline at end of file +var _0x9b8d=['../../config/logger','rpc','../../config/environment','client','http','localhost','socket.io-emitter','redis','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5181a6,_0x5c529a){var _0x43ce0a=function(_0x38aa35){while(--_0x38aa35){_0x5181a6['push'](_0x5181a6['shift']());}};_0x43ce0a(++_0x5c529a);}(_0x9b8d,0x122));var _0xd9b8=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0x9b8d[_0x4c4037];return _0x357862;};'use strict';var _=require(_0xd9b8('0x0'));var util=require(_0xd9b8('0x1'));var moment=require('moment');var BPromise=require(_0xd9b8('0x2'));var rs=require(_0xd9b8('0x3'));var fs=require('fs');var Redis=require(_0xd9b8('0x4'));var db=require(_0xd9b8('0x5'))['db'];var utils=require(_0xd9b8('0x6'));var logger=require(_0xd9b8('0x7'))(_0xd9b8('0x8'));var config=require(_0xd9b8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd9b8('0xa')][_0xd9b8('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xd9b8('0xc'),'port':0x18eb});var socket=require(_0xd9b8('0xd'))(new Redis(config[_0xd9b8('0xe')]));require('./dashboard.socket')[_0xd9b8('0xf')](socket);function respondWithRpcPromise(_0x18d709,_0x17bf8f,_0x2e6376){return new BPromise(function(_0x4c6bd1,_0x31de40){return client[_0xd9b8('0x10')](_0x18d709,_0x2e6376)[_0xd9b8('0x11')](function(_0x42e054){logger[_0xd9b8('0x12')](_0xd9b8('0x13'),_0x17bf8f,_0xd9b8('0x14'));logger[_0xd9b8('0x15')](_0xd9b8('0x16'),_0x17bf8f,'request\x20sent',JSON[_0xd9b8('0x17')](_0x42e054));if(_0x42e054[_0xd9b8('0x18')]){if(_0x42e054[_0xd9b8('0x18')][_0xd9b8('0x19')]===0x1f4){logger[_0xd9b8('0x18')](_0xd9b8('0x13'),_0x17bf8f,_0x42e054[_0xd9b8('0x18')]['message']);return _0x31de40(_0x42e054['error'][_0xd9b8('0x1a')]);}logger[_0xd9b8('0x18')](_0xd9b8('0x13'),_0x17bf8f,_0x42e054[_0xd9b8('0x18')][_0xd9b8('0x1a')]);return _0x4c6bd1(_0x42e054['error']['message']);}else{logger['info'](_0xd9b8('0x13'),_0x17bf8f,'request\x20sent');_0x4c6bd1(_0x42e054['result'][_0xd9b8('0x1a')]);}})['catch'](function(_0x377f2c){logger[_0xd9b8('0x18')](_0xd9b8('0x13'),_0x17bf8f,_0x377f2c);_0x31de40(_0x377f2c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index b2dea42..80b6b4b 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 _0x6a55=['./dashboard.events','save','remove','emit','length'];(function(_0xb1665e,_0x9d1e9e){var _0x38438a=function(_0xc32b54){while(--_0xc32b54){_0xb1665e['push'](_0xb1665e['shift']());}};_0x38438a(++_0x9d1e9e);}(_0x6a55,0xff));var _0x56a5=function(_0x5c468f,_0x2e5c25){_0x5c468f=_0x5c468f-0x0;var _0x2136b0=_0x6a55[_0x5c468f];return _0x2136b0;};'use strict';var DashboardEvents=require(_0x56a5('0x0'));var events=[_0x56a5('0x1'),_0x56a5('0x2'),'update'];function createListener(_0x45db14,_0x1ef8cd){return function(_0xa428dc){_0x1ef8cd[_0x56a5('0x3')](_0x45db14,_0xa428dc);};}function removeListener(_0x533130,_0x1b222b){return function(){DashboardEvents['removeListener'](_0x533130,_0x1b222b);};}exports['register']=function(_0x26821e){for(var _0x1a1da0=0x0,_0x1ff44c=events[_0x56a5('0x4')];_0x1a1da0<_0x1ff44c;_0x1a1da0++){var _0x1676f5=events[_0x1a1da0];var _0x38e630=createListener('dashboard:'+_0x1676f5,_0x26821e);DashboardEvents['on'](_0x1676f5,_0x38e630);}}; \ No newline at end of file +var _0x83b0=['emit','register','save','remove'];(function(_0x151a33,_0xb7b974){var _0x36dfaf=function(_0x387fac){while(--_0x387fac){_0x151a33['push'](_0x151a33['shift']());}};_0x36dfaf(++_0xb7b974);}(_0x83b0,0x96));var _0x083b=function(_0x14b8c5,_0x3ad8db){_0x14b8c5=_0x14b8c5-0x0;var _0x43beba=_0x83b0[_0x14b8c5];return _0x43beba;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x083b('0x0'),_0x083b('0x1'),'update'];function createListener(_0xefb421,_0x584879){return function(_0x48cb76){_0x584879[_0x083b('0x2')](_0xefb421,_0x48cb76);};}function removeListener(_0x4a7e0d,_0x45e1fb){return function(){DashboardEvents['removeListener'](_0x4a7e0d,_0x45e1fb);};}exports[_0x083b('0x3')]=function(_0x166c38){for(var _0x1bb480=0x0,_0x2c9254=events['length'];_0x1bb480<_0x2c9254;_0x1bb480++){var _0x597219=events[_0x1bb480];var _0x23ed80=createListener('dashboard:'+_0x597219,_0x166c38);DashboardEvents['on'](_0x597219,_0x23ed80);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index c116d8f..4a386fd 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 _0xc80d=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc80d,0x1ce));var _0xdc80=function(_0x36578f,_0xb188bc){_0x36578f=_0x36578f-0x0;var _0x22b973=_0xc80d[_0x36578f];return _0x22b973;};'use strict';var multer=require(_0xdc80('0x0'));var util=require(_0xdc80('0x1'));var path=require(_0xdc80('0x2'));var timeout=require(_0xdc80('0x3'));var express=require(_0xdc80('0x4'));var router=express['Router']();var fs_extra=require(_0xdc80('0x5'));var auth=require(_0xdc80('0x6'));var interaction=require(_0xdc80('0x7'));var config=require(_0xdc80('0x8'));var controller=require('./dashboard.controller');router[_0xdc80('0x9')]('/',auth[_0xdc80('0xa')](),controller[_0xdc80('0xb')]);router[_0xdc80('0x9')](_0xdc80('0xc'),auth[_0xdc80('0xa')](),controller[_0xdc80('0xd')]);router[_0xdc80('0x9')](_0xdc80('0xe'),auth[_0xdc80('0xa')](),controller[_0xdc80('0xf')]);router[_0xdc80('0x10')]('/',auth['isAuthenticated'](),controller[_0xdc80('0x11')]);router[_0xdc80('0x10')](_0xdc80('0x12'),auth['isAuthenticated'](),controller[_0xdc80('0x13')]);router[_0xdc80('0x10')](_0xdc80('0xe'),auth[_0xdc80('0xa')](),controller[_0xdc80('0x14')]);router[_0xdc80('0x15')]('/:id',auth[_0xdc80('0xa')](),controller[_0xdc80('0x16')]);router[_0xdc80('0x17')](_0xdc80('0xc'),auth[_0xdc80('0xa')](),controller[_0xdc80('0x18')]);module[_0xdc80('0x19')]=router; \ No newline at end of file +var _0xb12b=['update','delete','destroy','exports','multer','util','Router','fs-extra','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/items','getItems','create','post','/:id/clone','put'];(function(_0xc596f,_0x5badc7){var _0x4ad736=function(_0x299d95){while(--_0x299d95){_0xc596f['push'](_0xc596f['shift']());}};_0x4ad736(++_0x5badc7);}(_0xb12b,0x68));var _0xbb12=function(_0x27c3d2,_0x29d81f){_0x27c3d2=_0x27c3d2-0x0;var _0x1db1e9=_0xb12b[_0x27c3d2];return _0x1db1e9;};'use strict';var multer=require(_0xbb12('0x0'));var util=require(_0xbb12('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbb12('0x2')]();var fs_extra=require(_0xbb12('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbb12('0x4'));var controller=require('./dashboard.controller');router[_0xbb12('0x5')]('/',auth['isAuthenticated'](),controller[_0xbb12('0x6')]);router[_0xbb12('0x5')](_0xbb12('0x7'),auth[_0xbb12('0x8')](),controller[_0xbb12('0x9')]);router['get'](_0xbb12('0xa'),auth['isAuthenticated'](),controller[_0xbb12('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbb12('0xc')]);router[_0xbb12('0xd')](_0xbb12('0xe'),auth[_0xbb12('0x8')](),controller['clone']);router[_0xbb12('0xd')]('/:id/items',auth[_0xbb12('0x8')](),controller['addItem']);router[_0xbb12('0xf')](_0xbb12('0x7'),auth[_0xbb12('0x8')](),controller[_0xbb12('0x10')]);router[_0xbb12('0x11')](_0xbb12('0x7'),auth[_0xbb12('0x8')](),controller[_0xbb12('0x12')]);module[_0xbb12('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index f857064..1fef363 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 _0x5d58=['attrs','stringify','INTEGER','#2196f3','STRING','TEXT','parse','getDataValue','setDataValue'];(function(_0x49de4c,_0x3c7405){var _0x220228=function(_0x90e68e){while(--_0x90e68e){_0x49de4c['push'](_0x49de4c['shift']());}};_0x220228(++_0x3c7405);}(_0x5d58,0x187));var _0x85d5=function(_0x27eb22,_0x3a7e96){_0x27eb22=_0x27eb22-0x0;var _0x4ac6da=_0x5d58[_0x27eb22];return _0x4ac6da;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require('lodash');module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x85d5('0x0')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x85d5('0x1')]('long'),'get':function(){try{return JSON[_0x85d5('0x2')](this[_0x85d5('0x3')]('attrs'));}catch(_0x1eb211){return[];}},'set':function(_0x2d457a){try{this[_0x85d5('0x4')](_0x85d5('0x5'),JSON['stringify'](_0x2d457a));}catch(_0x98c963){this[_0x85d5('0x4')]('attrs',JSON[_0x85d5('0x6')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x85d5('0x7')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x85d5('0x7')]},'col':{'type':Sequelize[_0x85d5('0x7')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x85d5('0x8'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x85d5('0x0')]},'titleFontSize':{'type':Sequelize[_0x85d5('0x7')],'defaultValue':0xc}}; \ No newline at end of file +var _0x326f=['#2196f3','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff'];(function(_0x2c049f,_0x21c75e){var _0x26a4fa=function(_0xb78c94){while(--_0xb78c94){_0x2c049f['push'](_0x2c049f['shift']());}};_0x26a4fa(++_0x21c75e);}(_0x326f,0xd1));var _0xf326=function(_0x2de5ca,_0x4bace6){_0x2de5ca=_0x2de5ca-0x0;var _0x4871e5=_0x326f[_0x2de5ca];return _0x4871e5;};'use strict';var Sequelize=require(_0xf326('0x0'));var squel=require('squel');var _=require('lodash');module[_0xf326('0x1')]={'title':{'type':Sequelize[_0xf326('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf326('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf326('0x3')](_0xf326('0x4')),'get':function(){try{return JSON[_0xf326('0x5')](this[_0xf326('0x6')](_0xf326('0x7')));}catch(_0x1b5a56){return[];}},'set':function(_0x3ace29){try{this['setDataValue'](_0xf326('0x7'),JSON[_0xf326('0x8')](_0x3ace29));}catch(_0x165f95){this[_0xf326('0x9')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf326('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf326('0xa')]},'col':{'type':Sequelize[_0xf326('0xa')]},'background':{'type':Sequelize[_0xf326('0x2')],'allowNull':![],'defaultValue':_0xf326('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf326('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xf326('0xa')],'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 c49c0f2..33cf55c 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 _0x7c1f=['attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','limit','reject','save','update','then','destroy','stack','name','send','params','keys','DashboardItem','query','filters','intersection','model','attributes','fields','length','merge','options','find','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts'];(function(_0x4627b5,_0x2ba0d5){var _0x31656c=function(_0x2b05f2){while(--_0x2b05f2){_0x4627b5['push'](_0x4627b5['shift']());}};_0x31656c(++_0x2ba0d5);}(_0x7c1f,0x194));var _0xf7c1=function(_0x3ff2f9,_0x30b865){_0x3ff2f9=_0x3ff2f9-0x0;var _0x2e34ae=_0x7c1f[_0x3ff2f9];return _0x2e34ae;};'use strict';var emlformat=require(_0xf7c1('0x0'));var rimraf=require(_0xf7c1('0x1'));var zipdir=require(_0xf7c1('0x2'));var jsonpatch=require(_0xf7c1('0x3'));var rp=require(_0xf7c1('0x4'));var moment=require('moment');var BPromise=require(_0xf7c1('0x5'));var Mustache=require(_0xf7c1('0x6'));var util=require(_0xf7c1('0x7'));var path=require('path');var sox=require(_0xf7c1('0x8'));var csv=require(_0xf7c1('0x9'));var ejs=require(_0xf7c1('0xa'));var fs=require('fs');var fs_extra=require(_0xf7c1('0xb'));var _=require('lodash');var squel=require(_0xf7c1('0xc'));var crypto=require(_0xf7c1('0xd'));var jsforce=require(_0xf7c1('0xe'));var deskjs=require(_0xf7c1('0xf'));var toCsv=require(_0xf7c1('0x9'));var querystring=require(_0xf7c1('0x10'));var Papa=require(_0xf7c1('0x11'));var Redis=require(_0xf7c1('0x12'));var authService=require(_0xf7c1('0x13'));var qs=require(_0xf7c1('0x14'));var as=require(_0xf7c1('0x15'));var hardwareService=require(_0xf7c1('0x16'));var logger=require('../../config/logger')(_0xf7c1('0x17'));var utils=require(_0xf7c1('0x18'));var config=require(_0xf7c1('0x19'));var licenseUtil=require(_0xf7c1('0x1a'));var db=require(_0xf7c1('0x1b'))['db'];config[_0xf7c1('0x1c')]=_['defaults'](config['redis'],{'host':_0xf7c1('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf7c1('0x1c')]));require(_0xf7c1('0x1e'))['register'](socket);function respondWithStatusCode(_0x396f8b,_0x4a14f7){_0x4a14f7=_0x4a14f7||0xcc;return function(_0x8c60c){if(_0x8c60c){return _0x396f8b[_0xf7c1('0x1f')](_0x4a14f7);}return _0x396f8b[_0xf7c1('0x20')](_0x4a14f7)[_0xf7c1('0x21')]();};}function respondWithResult(_0xb567e7,_0x4f7005){_0x4f7005=_0x4f7005||0xc8;return function(_0xcef462){if(_0xcef462){return _0xb567e7['status'](_0x4f7005)[_0xf7c1('0x22')](_0xcef462);}};}function respondWithFilteredResult(_0x4f0a0a,_0x115010){return function(_0x20e3f8){if(_0x20e3f8){var _0x153861=typeof _0x115010[_0xf7c1('0x23')]===_0xf7c1('0x24')&&typeof _0x115010[_0xf7c1('0x25')]===_0xf7c1('0x24');var _0x43eee9=_0x20e3f8['count'];var _0x59f0d2=_0x153861?0x0:_0x115010[_0xf7c1('0x23')];var _0x3fd7fc=_0x153861?_0x20e3f8['count']:_0x115010[_0xf7c1('0x23')]+_0x115010[_0xf7c1('0x25')];var _0x51aba8;if(_0x3fd7fc>=_0x43eee9){_0x3fd7fc=_0x43eee9;_0x51aba8=0xc8;}else{_0x51aba8=0xce;}_0x4f0a0a[_0xf7c1('0x20')](_0x51aba8);return _0x4f0a0a['set']('Content-Range',_0x59f0d2+'-'+_0x3fd7fc+'/'+_0x43eee9)['json'](_0x20e3f8);}return null;};}function patchUpdates(_0x4333f0){return function(_0x2416f5){try{jsonpatch['apply'](_0x2416f5,_0x4333f0,!![]);}catch(_0x2932e2){return BPromise[_0xf7c1('0x26')](_0x2932e2);}return _0x2416f5[_0xf7c1('0x27')]();};}function saveUpdates(_0x33c874,_0x37b8d8){return function(_0x20ad74){if(_0x20ad74){return _0x20ad74[_0xf7c1('0x28')](_0x33c874)[_0xf7c1('0x29')](function(_0x54f3f3){return _0x54f3f3;});}return null;};}function removeEntity(_0x502f57,_0x5bd8ba){return function(_0x491d4f){if(_0x491d4f){return _0x491d4f[_0xf7c1('0x2a')]()[_0xf7c1('0x29')](function(){_0x502f57[_0xf7c1('0x20')](0xcc)[_0xf7c1('0x21')]();});}};}function handleEntityNotFound(_0x296afb,_0x3d83b0){return function(_0x19af4d){if(!_0x19af4d){_0x296afb[_0xf7c1('0x1f')](0x194);}return _0x19af4d;};}function handleError(_0x549c29,_0x6d74a1){_0x6d74a1=_0x6d74a1||0x1f4;return function(_0x37c472){logger['error'](_0x37c472[_0xf7c1('0x2b')]);if(_0x37c472[_0xf7c1('0x2c')]){delete _0x37c472[_0xf7c1('0x2c')];}_0x549c29[_0xf7c1('0x20')](_0x6d74a1)[_0xf7c1('0x2d')](_0x37c472);};}exports['show']=function(_0x1b353e,_0x5b01b4){var _0xad14c={'raw':![],'where':{'id':_0x1b353e[_0xf7c1('0x2e')]['id']}},_0x3d8049={};_0x3d8049['model']=_[_0xf7c1('0x2f')](db[_0xf7c1('0x30')]['rawAttributes']);_0x3d8049['query']=_[_0xf7c1('0x2f')](_0x1b353e[_0xf7c1('0x31')]);_0x3d8049[_0xf7c1('0x32')]=_[_0xf7c1('0x33')](_0x3d8049[_0xf7c1('0x34')],_0x3d8049['query']);_0xad14c[_0xf7c1('0x35')]=_[_0xf7c1('0x33')](_0x3d8049[_0xf7c1('0x34')],qs[_0xf7c1('0x36')](_0x1b353e[_0xf7c1('0x31')]['fields']));_0xad14c['attributes']=_0xad14c[_0xf7c1('0x35')][_0xf7c1('0x37')]?_0xad14c[_0xf7c1('0x35')]:_0x3d8049[_0xf7c1('0x34')];if(_0x1b353e[_0xf7c1('0x31')]['includeAll']){_0xad14c['include']=[{'all':!![]}];}_0xad14c=_[_0xf7c1('0x38')]({},_0xad14c,_0x1b353e[_0xf7c1('0x39')]);return db[_0xf7c1('0x30')][_0xf7c1('0x3a')](_0xad14c)['then'](handleEntityNotFound(_0x5b01b4,null))[_0xf7c1('0x29')](respondWithResult(_0x5b01b4,null))['catch'](handleError(_0x5b01b4,null));};exports[_0xf7c1('0x2a')]=function(_0x368e33,_0x1f2141){return db[_0xf7c1('0x30')][_0xf7c1('0x3a')]({'where':{'id':_0x368e33[_0xf7c1('0x2e')]['id']}})[_0xf7c1('0x29')](handleEntityNotFound(_0x1f2141,null))['then'](removeEntity(_0x1f2141,null))['catch'](handleError(_0x1f2141,null));};function widgetAttributes(_0x21bed5){try{switch(_0x21bed5['type']){case _0xf7c1('0x3b'):return[{'name':_0xf7c1('0x3c'),'value':_0x21bed5['attrUrl']||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5['attrs'][0x0]?_0x21bed5['attrs'][0x0][_0xf7c1('0x3e')]:undefined)||_0xf7c1('0x3f')}];case _0xf7c1('0x40'):return[{'name':_0xf7c1('0x41'),'value':_0x21bed5['attrPath']||(_0x21bed5['attrs']&&_0x21bed5[_0xf7c1('0x3d')][0x0]?_0x21bed5[_0xf7c1('0x3d')][0x0][_0xf7c1('0x3e')]:undefined)||''}];case _0xf7c1('0x42'):return[{'name':_0xf7c1('0x43'),'value':_0x21bed5[_0xf7c1('0x43')]||(_0x21bed5['attrs']&&_0x21bed5[_0xf7c1('0x3d')][0x0]?_0x21bed5[_0xf7c1('0x3d')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xf7c1('0x44'),'value':_0x21bed5[_0xf7c1('0x44')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5[_0xf7c1('0x3d')][0x1]?_0x21bed5[_0xf7c1('0x3d')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x21bed5[_0xf7c1('0x45')]||(_0x21bed5['attrs']&&_0x21bed5[_0xf7c1('0x3d')][0x2]?_0x21bed5[_0xf7c1('0x3d')][0x2][_0xf7c1('0x3e')]:undefined)||0xc}];case _0xf7c1('0x46'):return[{'name':_0xf7c1('0x47'),'value':_0x21bed5['attrMetric']||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5['attrs'][0x0]?_0x21bed5['attrs'][0x0][_0xf7c1('0x3e')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x21bed5[_0xf7c1('0x48')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5[_0xf7c1('0x3d')][0x1]?_0x21bed5[_0xf7c1('0x3d')][0x1][_0xf7c1('0x3e')]:undefined)||[]},{'name':'attrFontSize','value':_0x21bed5[_0xf7c1('0x45')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5[_0xf7c1('0x3d')][0x2]?_0x21bed5['attrs'][0x2][_0xf7c1('0x3e')]:undefined)||0x14},{'name':_0xf7c1('0x49'),'value':_0x21bed5[_0xf7c1('0x49')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5[_0xf7c1('0x3d')][0x3]?_0x21bed5['attrs'][0x3][_0xf7c1('0x3e')]:undefined)||_0xf7c1('0x4a')},{'name':_0xf7c1('0x4b'),'value':_0x21bed5[_0xf7c1('0x4b')]||(_0x21bed5['attrs']&&_0x21bed5[_0xf7c1('0x3d')][0x4]?_0x21bed5[_0xf7c1('0x3d')][0x4][_0xf7c1('0x3e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x21bed5[_0xf7c1('0x4c')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5[_0xf7c1('0x3d')][0x5]?_0x21bed5['attrs'][0x5][_0xf7c1('0x3e')]:undefined)||''},{'name':_0xf7c1('0x4d'),'value':_0x21bed5[_0xf7c1('0x4d')]||(_0x21bed5['attrs']&&_0x21bed5[_0xf7c1('0x3d')][0x6]?_0x21bed5['attrs'][0x6][_0xf7c1('0x3e')]:undefined)||''},{'name':_0xf7c1('0x4e'),'value':_0x21bed5['attrOpenchannelAccounts']||(_0x21bed5['attrs']&&_0x21bed5[_0xf7c1('0x3d')][0x7]?_0x21bed5['attrs'][0x7]['value']:undefined)||''},{'name':_0xf7c1('0x4f'),'value':_0x21bed5['attrWhatsappAccounts']||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5[_0xf7c1('0x3d')][0x8]?_0x21bed5[_0xf7c1('0x3d')][0x8][_0xf7c1('0x3e')]:undefined)||''},{'name':_0xf7c1('0x50'),'value':_0x21bed5['attrChatWebsites']||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5['attrs'][0x9]?_0x21bed5[_0xf7c1('0x3d')][0x9]['value']:undefined)||''}];case _0xf7c1('0x51'):case _0xf7c1('0x52'):return[{'name':_0xf7c1('0x53'),'value':_0x21bed5[_0xf7c1('0x53')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5['attrs'][0x0]?_0x21bed5['attrs'][0x0][_0xf7c1('0x3e')]:undefined)||_0xf7c1('0x54')},{'name':_0xf7c1('0x55'),'value':_0x21bed5[_0xf7c1('0x55')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5[_0xf7c1('0x3d')][0x1]?_0x21bed5[_0xf7c1('0x3d')][0x1][_0xf7c1('0x3e')]:undefined)||null},{'name':_0xf7c1('0x56'),'value':_0x21bed5[_0xf7c1('0x56')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5[_0xf7c1('0x3d')][0x2]?_0x21bed5[_0xf7c1('0x3d')][0x2]['value']:undefined)||null},{'name':_0xf7c1('0x48'),'value':_0x21bed5[_0xf7c1('0x48')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5[_0xf7c1('0x3d')][0x3]?_0x21bed5[_0xf7c1('0x3d')][0x3]['value']:undefined)||[]},{'name':_0xf7c1('0x49'),'value':_0x21bed5['attrChannel']||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5[_0xf7c1('0x3d')][0x4]?_0x21bed5['attrs'][0x4][_0xf7c1('0x3e')]:undefined)||_0xf7c1('0x4a')},{'name':_0xf7c1('0x4b'),'value':_0x21bed5[_0xf7c1('0x4b')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5[_0xf7c1('0x3d')][0x5]?_0x21bed5[_0xf7c1('0x3d')][0x5][_0xf7c1('0x3e')]:undefined)||''},{'name':_0xf7c1('0x4c'),'value':_0x21bed5[_0xf7c1('0x4c')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5[_0xf7c1('0x3d')][0x6]?_0x21bed5[_0xf7c1('0x3d')][0x6][_0xf7c1('0x3e')]:undefined)||''},{'name':_0xf7c1('0x4d'),'value':_0x21bed5[_0xf7c1('0x4d')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5['attrs'][0x7]?_0x21bed5[_0xf7c1('0x3d')][0x7][_0xf7c1('0x3e')]:undefined)||''},{'name':_0xf7c1('0x4e'),'value':_0x21bed5[_0xf7c1('0x4e')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5[_0xf7c1('0x3d')][0x8]?_0x21bed5[_0xf7c1('0x3d')][0x8]['value']:undefined)||''},{'name':_0xf7c1('0x4f'),'value':_0x21bed5[_0xf7c1('0x4f')]||(_0x21bed5['attrs']&&_0x21bed5[_0xf7c1('0x3d')][0x9]?_0x21bed5[_0xf7c1('0x3d')][0x9][_0xf7c1('0x3e')]:undefined)||''},{'name':_0xf7c1('0x50'),'value':_0x21bed5[_0xf7c1('0x50')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5[_0xf7c1('0x3d')][0xa]?_0x21bed5[_0xf7c1('0x3d')][0xa][_0xf7c1('0x3e')]:undefined)||''}];case _0xf7c1('0x57'):return[{'name':_0xf7c1('0x58'),'type':_0x21bed5['reportType']||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5['attrs'][0x0]?_0x21bed5[_0xf7c1('0x3d')][0x0]['type']:undefined)||null,'value':_0x21bed5[_0xf7c1('0x58')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5['attrs'][0x0]?_0x21bed5[_0xf7c1('0x3d')][0x0]['value']:undefined)||null},{'name':_0xf7c1('0x59'),'value':_0x21bed5[_0xf7c1('0x59')]||(_0x21bed5[_0xf7c1('0x3d')]&&_0x21bed5[_0xf7c1('0x3d')][0x1]?_0x21bed5['attrs'][0x1][_0xf7c1('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x291175){logger[_0xf7c1('0x5a')](_0xf7c1('0x5b'),JSON[_0xf7c1('0x5c')](_0x291175));return[];}}exports[_0xf7c1('0x5d')]=function(_0xa9ebca,_0x2a52b7){if(_0xa9ebca[_0xf7c1('0x5e')]){_0xa9ebca[_0xf7c1('0x5e')][_0xf7c1('0x3d')]=widgetAttributes(_0xa9ebca[_0xf7c1('0x5e')]);}return db['DashboardItem'][_0xf7c1('0x5d')](_0xa9ebca[_0xf7c1('0x5e')],{})[_0xf7c1('0x29')](respondWithResult(_0x2a52b7,0xc9))[_0xf7c1('0x5f')](handleError(_0x2a52b7,null));};exports[_0xf7c1('0x28')]=function(_0x3e9ca5,_0x4d4025){if(_0x3e9ca5[_0xf7c1('0x5e')]['id']){delete _0x3e9ca5[_0xf7c1('0x5e')]['id'];}_0x3e9ca5[_0xf7c1('0x5e')]['attrs']=widgetAttributes(_0x3e9ca5[_0xf7c1('0x5e')]);return db[_0xf7c1('0x30')][_0xf7c1('0x3a')]({'where':{'id':_0x3e9ca5[_0xf7c1('0x2e')]['id']}})[_0xf7c1('0x29')](handleEntityNotFound(_0x4d4025,null))[_0xf7c1('0x29')](saveUpdates(_0x3e9ca5[_0xf7c1('0x5e')],null))[_0xf7c1('0x29')](respondWithResult(_0x4d4025,null))[_0xf7c1('0x5f')](handleError(_0x4d4025,null));}; \ No newline at end of file +var _0x6bfc=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','name','send','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','options','catch','find','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','body','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3d5f84,_0x569548){var _0x1981b8=function(_0x3bf9f3){while(--_0x3bf9f3){_0x3d5f84['push'](_0x3d5f84['shift']());}};_0x1981b8(++_0x569548);}(_0x6bfc,0x159));var _0xc6bf=function(_0xbefad8,_0x469a2a){_0xbefad8=_0xbefad8-0x0;var _0x1f8476=_0x6bfc[_0xbefad8];return _0x1f8476;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6bf('0x0'));var zipdir=require(_0xc6bf('0x1'));var jsonpatch=require(_0xc6bf('0x2'));var rp=require('request-promise');var moment=require(_0xc6bf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc6bf('0x4'));var util=require('util');var path=require(_0xc6bf('0x5'));var sox=require(_0xc6bf('0x6'));var csv=require(_0xc6bf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc6bf('0x8'));var _=require(_0xc6bf('0x9'));var squel=require(_0xc6bf('0xa'));var crypto=require(_0xc6bf('0xb'));var jsforce=require(_0xc6bf('0xc'));var deskjs=require(_0xc6bf('0xd'));var toCsv=require(_0xc6bf('0x7'));var querystring=require(_0xc6bf('0xe'));var Papa=require('papaparse');var Redis=require(_0xc6bf('0xf'));var authService=require(_0xc6bf('0x10'));var qs=require(_0xc6bf('0x11'));var as=require(_0xc6bf('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc6bf('0x13'));var utils=require(_0xc6bf('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc6bf('0x15'))['db'];config[_0xc6bf('0x16')]=_['defaults'](config[_0xc6bf('0x16')],{'host':_0xc6bf('0x17'),'port':0x18eb});var socket=require(_0xc6bf('0x18'))(new Redis(config[_0xc6bf('0x16')]));require(_0xc6bf('0x19'))['register'](socket);function respondWithStatusCode(_0x58dd19,_0x56cb99){_0x56cb99=_0x56cb99||0xcc;return function(_0x391117){if(_0x391117){return _0x58dd19[_0xc6bf('0x1a')](_0x56cb99);}return _0x58dd19[_0xc6bf('0x1b')](_0x56cb99)[_0xc6bf('0x1c')]();};}function respondWithResult(_0x368195,_0x478f6){_0x478f6=_0x478f6||0xc8;return function(_0x54d6a8){if(_0x54d6a8){return _0x368195[_0xc6bf('0x1b')](_0x478f6)['json'](_0x54d6a8);}};}function respondWithFilteredResult(_0x4dec90,_0x195c3f){return function(_0x23a9e9){if(_0x23a9e9){var _0x5bdc69=typeof _0x195c3f[_0xc6bf('0x1d')]===_0xc6bf('0x1e')&&typeof _0x195c3f['limit']===_0xc6bf('0x1e');var _0x4adc0a=_0x23a9e9['count'];var _0x501a3b=_0x5bdc69?0x0:_0x195c3f[_0xc6bf('0x1d')];var _0x15cdd4=_0x5bdc69?_0x23a9e9['count']:_0x195c3f['offset']+_0x195c3f[_0xc6bf('0x1f')];var _0x2e47ce;if(_0x15cdd4>=_0x4adc0a){_0x15cdd4=_0x4adc0a;_0x2e47ce=0xc8;}else{_0x2e47ce=0xce;}_0x4dec90['status'](_0x2e47ce);return _0x4dec90[_0xc6bf('0x20')](_0xc6bf('0x21'),_0x501a3b+'-'+_0x15cdd4+'/'+_0x4adc0a)[_0xc6bf('0x22')](_0x23a9e9);}return null;};}function patchUpdates(_0x56e899){return function(_0x5e2537){try{jsonpatch[_0xc6bf('0x23')](_0x5e2537,_0x56e899,!![]);}catch(_0x202856){return BPromise[_0xc6bf('0x24')](_0x202856);}return _0x5e2537[_0xc6bf('0x25')]();};}function saveUpdates(_0x3b5dd7,_0x2df59e){return function(_0x13080f){if(_0x13080f){return _0x13080f[_0xc6bf('0x26')](_0x3b5dd7)['then'](function(_0x312138){return _0x312138;});}return null;};}function removeEntity(_0x24ed4b,_0x3f0b43){return function(_0x532bc1){if(_0x532bc1){return _0x532bc1[_0xc6bf('0x27')]()[_0xc6bf('0x28')](function(){_0x24ed4b[_0xc6bf('0x1b')](0xcc)[_0xc6bf('0x1c')]();});}};}function handleEntityNotFound(_0x1346d5,_0x15396c){return function(_0x5abf52){if(!_0x5abf52){_0x1346d5['sendStatus'](0x194);}return _0x5abf52;};}function handleError(_0x1b6e7c,_0x519dc8){_0x519dc8=_0x519dc8||0x1f4;return function(_0x36b1c7){logger['error'](_0x36b1c7['stack']);if(_0x36b1c7[_0xc6bf('0x29')]){delete _0x36b1c7[_0xc6bf('0x29')];}_0x1b6e7c[_0xc6bf('0x1b')](_0x519dc8)[_0xc6bf('0x2a')](_0x36b1c7);};}exports['show']=function(_0x478af5,_0x543ad5){var _0x4f0234={'raw':![],'where':{'id':_0x478af5[_0xc6bf('0x2b')]['id']}},_0x32407b={};_0x32407b[_0xc6bf('0x2c')]=_[_0xc6bf('0x2d')](db[_0xc6bf('0x2e')][_0xc6bf('0x2f')]);_0x32407b[_0xc6bf('0x30')]=_[_0xc6bf('0x2d')](_0x478af5[_0xc6bf('0x30')]);_0x32407b[_0xc6bf('0x31')]=_[_0xc6bf('0x32')](_0x32407b[_0xc6bf('0x2c')],_0x32407b[_0xc6bf('0x30')]);_0x4f0234[_0xc6bf('0x33')]=_[_0xc6bf('0x32')](_0x32407b['model'],qs[_0xc6bf('0x34')](_0x478af5[_0xc6bf('0x30')][_0xc6bf('0x34')]));_0x4f0234[_0xc6bf('0x33')]=_0x4f0234['attributes']['length']?_0x4f0234[_0xc6bf('0x33')]:_0x32407b[_0xc6bf('0x2c')];if(_0x478af5[_0xc6bf('0x30')][_0xc6bf('0x35')]){_0x4f0234[_0xc6bf('0x36')]=[{'all':!![]}];}_0x4f0234=_['merge']({},_0x4f0234,_0x478af5[_0xc6bf('0x37')]);return db['DashboardItem']['find'](_0x4f0234)[_0xc6bf('0x28')](handleEntityNotFound(_0x543ad5,null))[_0xc6bf('0x28')](respondWithResult(_0x543ad5,null))[_0xc6bf('0x38')](handleError(_0x543ad5,null));};exports[_0xc6bf('0x27')]=function(_0x2965bc,_0x571bdb){return db[_0xc6bf('0x2e')][_0xc6bf('0x39')]({'where':{'id':_0x2965bc['params']['id']}})[_0xc6bf('0x28')](handleEntityNotFound(_0x571bdb,null))[_0xc6bf('0x28')](removeEntity(_0x571bdb,null))[_0xc6bf('0x38')](handleError(_0x571bdb,null));};function widgetAttributes(_0x59b561){try{switch(_0x59b561['type']){case'iframe':return[{'name':_0xc6bf('0x3a'),'value':_0x59b561[_0xc6bf('0x3a')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561['attrs'][0x0]?_0x59b561[_0xc6bf('0x3b')][0x0]['value']:undefined)||'https://'}];case _0xc6bf('0x3c'):return[{'name':_0xc6bf('0x3d'),'value':_0x59b561[_0xc6bf('0x3d')]||(_0x59b561['attrs']&&_0x59b561['attrs'][0x0]?_0x59b561[_0xc6bf('0x3b')][0x0][_0xc6bf('0x3e')]:undefined)||''}];case _0xc6bf('0x3f'):return[{'name':_0xc6bf('0x40'),'value':_0x59b561[_0xc6bf('0x40')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x0]?_0x59b561['attrs'][0x0][_0xc6bf('0x3e')]:undefined)||_0xc6bf('0x41')},{'name':_0xc6bf('0x42'),'value':_0x59b561['attrTimezone']||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x1]?_0x59b561[_0xc6bf('0x3b')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x59b561['attrFontSize']||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x2]?_0x59b561['attrs'][0x2]['value']:undefined)||0xc}];case _0xc6bf('0x43'):return[{'name':_0xc6bf('0x44'),'value':_0x59b561[_0xc6bf('0x44')]||(_0x59b561['attrs']&&_0x59b561[_0xc6bf('0x3b')][0x0]?_0x59b561[_0xc6bf('0x3b')][0x0][_0xc6bf('0x3e')]:undefined)||_0xc6bf('0x45')},{'name':_0xc6bf('0x46'),'value':_0x59b561[_0xc6bf('0x46')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561['attrs'][0x1]?_0x59b561['attrs'][0x1][_0xc6bf('0x3e')]:undefined)||[]},{'name':_0xc6bf('0x47'),'value':_0x59b561[_0xc6bf('0x47')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x2]?_0x59b561[_0xc6bf('0x3b')][0x2][_0xc6bf('0x3e')]:undefined)||0x14},{'name':_0xc6bf('0x48'),'value':_0x59b561[_0xc6bf('0x48')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x3]?_0x59b561[_0xc6bf('0x3b')][0x3][_0xc6bf('0x3e')]:undefined)||_0xc6bf('0x49')},{'name':_0xc6bf('0x4a'),'value':_0x59b561[_0xc6bf('0x4a')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561['attrs'][0x4]?_0x59b561[_0xc6bf('0x3b')][0x4][_0xc6bf('0x3e')]:undefined)||''},{'name':_0xc6bf('0x4b'),'value':_0x59b561[_0xc6bf('0x4b')]||(_0x59b561['attrs']&&_0x59b561[_0xc6bf('0x3b')][0x5]?_0x59b561[_0xc6bf('0x3b')][0x5][_0xc6bf('0x3e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x59b561[_0xc6bf('0x4c')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x6]?_0x59b561[_0xc6bf('0x3b')][0x6]['value']:undefined)||''},{'name':_0xc6bf('0x4d'),'value':_0x59b561[_0xc6bf('0x4d')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561['attrs'][0x7]?_0x59b561['attrs'][0x7]['value']:undefined)||''},{'name':_0xc6bf('0x4e'),'value':_0x59b561['attrWhatsappAccounts']||(_0x59b561['attrs']&&_0x59b561[_0xc6bf('0x3b')][0x8]?_0x59b561['attrs'][0x8][_0xc6bf('0x3e')]:undefined)||''},{'name':_0xc6bf('0x4f'),'value':_0x59b561[_0xc6bf('0x4f')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x9]?_0x59b561[_0xc6bf('0x3b')][0x9][_0xc6bf('0x3e')]:undefined)||''}];case _0xc6bf('0x50'):case _0xc6bf('0x51'):return[{'name':_0xc6bf('0x52'),'value':_0x59b561[_0xc6bf('0x52')]||(_0x59b561['attrs']&&_0x59b561['attrs'][0x0]?_0x59b561['attrs'][0x0][_0xc6bf('0x3e')]:undefined)||_0xc6bf('0x45')},{'name':'attrSerie2','value':_0x59b561['attrSerie2']||(_0x59b561['attrs']&&_0x59b561[_0xc6bf('0x3b')][0x1]?_0x59b561[_0xc6bf('0x3b')][0x1][_0xc6bf('0x3e')]:undefined)||null},{'name':'attrSerie3','value':_0x59b561[_0xc6bf('0x53')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561['attrs'][0x2]?_0x59b561[_0xc6bf('0x3b')][0x2][_0xc6bf('0x3e')]:undefined)||null},{'name':_0xc6bf('0x46'),'value':_0x59b561[_0xc6bf('0x46')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x3]?_0x59b561['attrs'][0x3]['value']:undefined)||[]},{'name':_0xc6bf('0x48'),'value':_0x59b561[_0xc6bf('0x48')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x4]?_0x59b561['attrs'][0x4][_0xc6bf('0x3e')]:undefined)||_0xc6bf('0x49')},{'name':_0xc6bf('0x4a'),'value':_0x59b561[_0xc6bf('0x4a')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561['attrs'][0x5]?_0x59b561[_0xc6bf('0x3b')][0x5][_0xc6bf('0x3e')]:undefined)||''},{'name':_0xc6bf('0x4b'),'value':_0x59b561[_0xc6bf('0x4b')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x6]?_0x59b561['attrs'][0x6][_0xc6bf('0x3e')]:undefined)||''},{'name':_0xc6bf('0x4c'),'value':_0x59b561['attrSmsAccounts']||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x7]?_0x59b561['attrs'][0x7]['value']:undefined)||''},{'name':_0xc6bf('0x4d'),'value':_0x59b561[_0xc6bf('0x4d')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x8]?_0x59b561[_0xc6bf('0x3b')][0x8][_0xc6bf('0x3e')]:undefined)||''},{'name':_0xc6bf('0x4e'),'value':_0x59b561['attrWhatsappAccounts']||(_0x59b561['attrs']&&_0x59b561[_0xc6bf('0x3b')][0x9]?_0x59b561[_0xc6bf('0x3b')][0x9][_0xc6bf('0x3e')]:undefined)||''},{'name':_0xc6bf('0x4f'),'value':_0x59b561[_0xc6bf('0x4f')]||(_0x59b561['attrs']&&_0x59b561[_0xc6bf('0x3b')][0xa]?_0x59b561[_0xc6bf('0x3b')][0xa][_0xc6bf('0x3e')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x59b561[_0xc6bf('0x54')]||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x0]?_0x59b561[_0xc6bf('0x3b')][0x0]['type']:undefined)||null,'value':_0x59b561['attrReport']||(_0x59b561[_0xc6bf('0x3b')]&&_0x59b561[_0xc6bf('0x3b')][0x0]?_0x59b561[_0xc6bf('0x3b')][0x0][_0xc6bf('0x3e')]:undefined)||null},{'name':_0xc6bf('0x55'),'value':_0x59b561[_0xc6bf('0x55')]||(_0x59b561['attrs']&&_0x59b561['attrs'][0x1]?_0x59b561[_0xc6bf('0x3b')][0x1][_0xc6bf('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x3ea421){logger[_0xc6bf('0x56')](_0xc6bf('0x57'),JSON[_0xc6bf('0x58')](_0x3ea421));return[];}}exports['create']=function(_0x1c724c,_0x49b1dd){if(_0x1c724c[_0xc6bf('0x59')]){_0x1c724c[_0xc6bf('0x59')][_0xc6bf('0x3b')]=widgetAttributes(_0x1c724c[_0xc6bf('0x59')]);}return db[_0xc6bf('0x2e')]['create'](_0x1c724c['body'],{})['then'](respondWithResult(_0x49b1dd,0xc9))['catch'](handleError(_0x49b1dd,null));};exports[_0xc6bf('0x26')]=function(_0x4e60a6,_0x3e07e5){if(_0x4e60a6[_0xc6bf('0x59')]['id']){delete _0x4e60a6[_0xc6bf('0x59')]['id'];}_0x4e60a6[_0xc6bf('0x59')][_0xc6bf('0x3b')]=widgetAttributes(_0x4e60a6[_0xc6bf('0x59')]);return db[_0xc6bf('0x2e')][_0xc6bf('0x39')]({'where':{'id':_0x4e60a6[_0xc6bf('0x2b')]['id']}})[_0xc6bf('0x28')](handleEntityNotFound(_0x3e07e5,null))['then'](saveUpdates(_0x4e60a6['body'],null))[_0xc6bf('0x28')](respondWithResult(_0x3e07e5,null))['catch'](handleError(_0x3e07e5,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 80e2b4a..57214e3 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 _0xb16f=['hook','exports','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x184254,_0x71de93){var _0x5bef8f=function(_0x1cc37d){while(--_0x1cc37d){_0x184254['push'](_0x184254['shift']());}};_0x5bef8f(++_0x71de93);}(_0xb16f,0x1c4));var _0xfb16=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0xb16f[_0x174a72];return _0x32cecd;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xfb16('0x0'))['db'][_0xfb16('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xfb16('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfb16('0x3'),'afterDestroy':_0xfb16('0x4')};function emitEvent(_0x4c8cf1){return function(_0x3e4b4a,_0x5d40ab,_0x419c03){DashboardItemEvents['emit'](_0x4c8cf1+':'+_0x3e4b4a['id'],_0x3e4b4a);DashboardItemEvents[_0xfb16('0x5')](_0x4c8cf1,_0x3e4b4a);_0x419c03(null);};}for(var e in events){if(events[_0xfb16('0x6')](e)){var event=events[e];DashboardItem[_0xfb16('0x7')](e,emitEvent(event));}}module[_0xfb16('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xfc8c=['update','hasOwnProperty','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save'];(function(_0x187ee1,_0x486fdd){var _0x174752=function(_0xd96a00){while(--_0xd96a00){_0x187ee1['push'](_0x187ee1['shift']());}};_0x174752(++_0x486fdd);}(_0xfc8c,0x6b));var _0xcfc8=function(_0x54fe1c,_0x5d208c){_0x54fe1c=_0x54fe1c-0x0;var _0x460aaa=_0xfc8c[_0x54fe1c];return _0x460aaa;};'use strict';var EventEmitter=require(_0xcfc8('0x0'));var DashboardItem=require(_0xcfc8('0x1'))['db'][_0xcfc8('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xcfc8('0x3')](0x0);var events={'afterCreate':_0xcfc8('0x4'),'afterUpdate':_0xcfc8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x36b866){return function(_0x3f8a7c,_0x59e9c,_0x411628){DashboardItemEvents['emit'](_0x36b866+':'+_0x3f8a7c['id'],_0x3f8a7c);DashboardItemEvents['emit'](_0x36b866,_0x3f8a7c);_0x411628(null);};}for(var e in events){if(events[_0xcfc8('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xcfc8('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 6c30bfb..9b028c1 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 _0x928d=['dashboard_items','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define'];(function(_0x5aa1fd,_0x2fe2d2){var _0xd51105=function(_0x2a133c){while(--_0x2a133c){_0x5aa1fd['push'](_0x5aa1fd['shift']());}};_0xd51105(++_0x2fe2d2);}(_0x928d,0x1cd));var _0xd928=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x928d[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xd928('0x0'));var util=require('util');var logger=require(_0xd928('0x1'))(_0xd928('0x2'));var moment=require(_0xd928('0x3'));var BPromise=require('bluebird');var rp=require(_0xd928('0x4'));var fs=require('fs');var path=require(_0xd928('0x5'));var rimraf=require(_0xd928('0x6'));var config=require(_0xd928('0x7'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x167920,_0xef9dd6){return _0x167920[_0xd928('0x8')]('DashboardItem',attributes,{'tableName':_0xd928('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x848c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','DashboardItem','dashboard_items','lodash'];(function(_0x53417c,_0x126dee){var _0x49407d=function(_0x1b1737){while(--_0x1b1737){_0x53417c['push'](_0x53417c['shift']());}};_0x49407d(++_0x126dee);}(_0x848c,0x110));var _0xc848=function(_0x2ad477,_0x323d3a){_0x2ad477=_0x2ad477-0x0;var _0x3083da=_0x848c[_0x2ad477];return _0x3083da;};'use strict';var _=require(_0xc848('0x0'));var util=require(_0xc848('0x1'));var logger=require(_0xc848('0x2'))(_0xc848('0x3'));var moment=require(_0xc848('0x4'));var BPromise=require(_0xc848('0x5'));var rp=require(_0xc848('0x6'));var fs=require('fs');var path=require(_0xc848('0x7'));var rimraf=require(_0xc848('0x8'));var config=require(_0xc848('0x9'));var attributes=require('./dashboardItem.attributes');module[_0xc848('0xa')]=function(_0x415ed5,_0x311b5f){return _0x415ed5['define'](_0xc848('0xb'),attributes,{'tableName':_0xc848('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 003e930..fbd74f6 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 _0xb66b=['defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','stringify','error','DashboardItem,\x20%s,\x20%s','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x5257f9,_0x514ad0){var _0x278222=function(_0x1fd1c6){while(--_0x1fd1c6){_0x5257f9['push'](_0x5257f9['shift']());}};_0x278222(++_0x514ad0);}(_0xb66b,0x113));var _0xbb66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb66b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbb66('0x0'));var BPromise=require(_0xbb66('0x1'));var rs=require(_0xbb66('0x2'));var fs=require('fs');var Redis=require(_0xbb66('0x3'));var db=require(_0xbb66('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb66('0x5'))(_0xbb66('0x6'));var config=require(_0xbb66('0x7'));var jayson=require(_0xbb66('0x8'));var client=jayson[_0xbb66('0x9')]['http']({'port':0x232a});config[_0xbb66('0xa')]=_[_0xbb66('0xb')](config[_0xbb66('0xa')],{'host':_0xbb66('0xc'),'port':0x18eb});var socket=require(_0xbb66('0xd'))(new Redis(config[_0xbb66('0xa')]));require(_0xbb66('0xe'))[_0xbb66('0xf')](socket);function respondWithRpcPromise(_0x2c4365,_0xdc4c36,_0x5c3c3c){return new BPromise(function(_0x5d5c95,_0x45d84a){return client[_0xbb66('0x10')](_0x2c4365,_0x5c3c3c)[_0xbb66('0x11')](function(_0x55a417){logger[_0xbb66('0x12')]('DashboardItem,\x20%s,\x20%s',_0xdc4c36,_0xbb66('0x13'));logger[_0xbb66('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0xdc4c36,_0xbb66('0x13'),JSON[_0xbb66('0x15')](_0x55a417));if(_0x55a417[_0xbb66('0x16')]){if(_0x55a417['error']['code']===0x1f4){logger[_0xbb66('0x16')](_0xbb66('0x17'),_0xdc4c36,_0x55a417[_0xbb66('0x16')]['message']);return _0x45d84a(_0x55a417[_0xbb66('0x16')][_0xbb66('0x18')]);}logger[_0xbb66('0x16')](_0xbb66('0x17'),_0xdc4c36,_0x55a417[_0xbb66('0x16')][_0xbb66('0x18')]);return _0x5d5c95(_0x55a417[_0xbb66('0x16')][_0xbb66('0x18')]);}else{logger[_0xbb66('0x12')](_0xbb66('0x17'),_0xdc4c36,_0xbb66('0x13'));_0x5d5c95(_0x55a417[_0xbb66('0x19')][_0xbb66('0x18')]);}})['catch'](function(_0x486674){logger[_0xbb66('0x16')](_0xbb66('0x17'),_0xdc4c36,_0x486674);_0x45d84a(_0x486674);});});} \ No newline at end of file +var _0x88d9=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x13211b,_0x3050c2){var _0x4adb44=function(_0x3885c6){while(--_0x3885c6){_0x13211b['push'](_0x13211b['shift']());}};_0x4adb44(++_0x3050c2);}(_0x88d9,0xa8));var _0x988d=function(_0x422ec5,_0x4da984){_0x422ec5=_0x422ec5-0x0;var _0x2eff46=_0x88d9[_0x422ec5];return _0x2eff46;};'use strict';var _=require(_0x988d('0x0'));var util=require('util');var moment=require(_0x988d('0x1'));var BPromise=require('bluebird');var rs=require(_0x988d('0x2'));var fs=require('fs');var Redis=require(_0x988d('0x3'));var db=require(_0x988d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x988d('0x5'))(_0x988d('0x6'));var config=require(_0x988d('0x7'));var jayson=require(_0x988d('0x8'));var client=jayson[_0x988d('0x9')][_0x988d('0xa')]({'port':0x232a});config[_0x988d('0xb')]=_[_0x988d('0xc')](config[_0x988d('0xb')],{'host':_0x988d('0xd'),'port':0x18eb});var socket=require(_0x988d('0xe'))(new Redis(config['redis']));require(_0x988d('0xf'))[_0x988d('0x10')](socket);function respondWithRpcPromise(_0x267b97,_0x1e4eb0,_0x4b6dda){return new BPromise(function(_0x56bcc3,_0x508646){return client[_0x988d('0x11')](_0x267b97,_0x4b6dda)[_0x988d('0x12')](function(_0x33e372){logger[_0x988d('0x13')](_0x988d('0x14'),_0x1e4eb0,_0x988d('0x15'));logger[_0x988d('0x16')](_0x988d('0x17'),_0x1e4eb0,'request\x20sent',JSON[_0x988d('0x18')](_0x33e372));if(_0x33e372[_0x988d('0x19')]){if(_0x33e372[_0x988d('0x19')]['code']===0x1f4){logger['error'](_0x988d('0x14'),_0x1e4eb0,_0x33e372[_0x988d('0x19')][_0x988d('0x1a')]);return _0x508646(_0x33e372[_0x988d('0x19')]['message']);}logger[_0x988d('0x19')](_0x988d('0x14'),_0x1e4eb0,_0x33e372[_0x988d('0x19')][_0x988d('0x1a')]);return _0x56bcc3(_0x33e372['error']['message']);}else{logger[_0x988d('0x13')](_0x988d('0x14'),_0x1e4eb0,_0x988d('0x15'));_0x56bcc3(_0x33e372[_0x988d('0x1b')][_0x988d('0x1a')]);}})[_0x988d('0x1c')](function(_0x4b3f8e){logger[_0x988d('0x19')]('DashboardItem,\x20%s,\x20%s',_0x1e4eb0,_0x4b3f8e);_0x508646(_0x4b3f8e);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index bdaa29d..1f0ceaf 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 _0x8ded=['length','dashboardItem:','save','update','emit','removeListener'];(function(_0x47120,_0x4e4359){var _0x6e0048=function(_0x570f0c){while(--_0x570f0c){_0x47120['push'](_0x47120['shift']());}};_0x6e0048(++_0x4e4359);}(_0x8ded,0x158));var _0xd8de=function(_0xc7fae0,_0x5c1cbd){_0xc7fae0=_0xc7fae0-0x0;var _0x13827f=_0x8ded[_0xc7fae0];return _0x13827f;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xd8de('0x0'),'remove',_0xd8de('0x1')];function createListener(_0x19333a,_0x1160b8){return function(_0x1f6a2e){_0x1160b8[_0xd8de('0x2')](_0x19333a,_0x1f6a2e);};}function removeListener(_0x45f62e,_0x4fa540){return function(){DashboardItemEvents[_0xd8de('0x3')](_0x45f62e,_0x4fa540);};}exports['register']=function(_0x545e51){for(var _0x1ac7b4=0x0,_0x244515=events[_0xd8de('0x4')];_0x1ac7b4<_0x244515;_0x1ac7b4++){var _0x34ad7f=events[_0x1ac7b4];var _0x3f7f9f=createListener(_0xd8de('0x5')+_0x34ad7f,_0x545e51);DashboardItemEvents['on'](_0x34ad7f,_0x3f7f9f);}}; \ No newline at end of file +var _0xfcd2=['emit','register','dashboardItem:','./dashboardItem.events','save','update'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xfcd2,0xcf));var _0x2fcd=function(_0x1700d9,_0x244f75){_0x1700d9=_0x1700d9-0x0;var _0x23e78d=_0xfcd2[_0x1700d9];return _0x23e78d;};'use strict';var DashboardItemEvents=require(_0x2fcd('0x0'));var events=[_0x2fcd('0x1'),'remove',_0x2fcd('0x2')];function createListener(_0x294e03,_0x306583){return function(_0x5f16f2){_0x306583[_0x2fcd('0x3')](_0x294e03,_0x5f16f2);};}function removeListener(_0x516a93,_0x489668){return function(){DashboardItemEvents['removeListener'](_0x516a93,_0x489668);};}exports[_0x2fcd('0x4')]=function(_0x20aa02){for(var _0x52ae92=0x0,_0x2a1f50=events['length'];_0x52ae92<_0x2a1f50;_0x52ae92++){var _0x5adc26=events[_0x52ae92];var _0x5030d3=createListener(_0x2fcd('0x5')+_0x5adc26,_0x20aa02);DashboardItemEvents['on'](_0x5adc26,_0x5030d3);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 2e2bbcc..1ebe0a8 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 _0xc555=['/:id','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','show','post','create','put'];(function(_0x3acd37,_0x3092ca){var _0x229bba=function(_0x25cd6b){while(--_0x25cd6b){_0x3acd37['push'](_0x3acd37['shift']());}};_0x229bba(++_0x3092ca);}(_0xc555,0x93));var _0x5c55=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xc555[_0x50007c];return _0x5c1ec7;};'use strict';var multer=require('multer');var util=require(_0x5c55('0x0'));var path=require(_0x5c55('0x1'));var timeout=require(_0x5c55('0x2'));var express=require(_0x5c55('0x3'));var router=express[_0x5c55('0x4')]();var fs_extra=require(_0x5c55('0x5'));var auth=require(_0x5c55('0x6'));var interaction=require(_0x5c55('0x7'));var config=require(_0x5c55('0x8'));var controller=require(_0x5c55('0x9'));router['get']('/:id',auth[_0x5c55('0xa')](),controller[_0x5c55('0xb')]);router[_0x5c55('0xc')]('/',auth[_0x5c55('0xa')](),controller[_0x5c55('0xd')]);router[_0x5c55('0xe')](_0x5c55('0xf'),auth['isAuthenticated'](),controller[_0x5c55('0x10')]);router['delete'](_0x5c55('0xf'),auth[_0x5c55('0xa')](),controller['destroy']);module[_0x5c55('0x11')]=router; \ No newline at end of file +var _0x5100=['/:id','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','post','create','put'];(function(_0x21fc68,_0x459828){var _0x3561e1=function(_0x3dea77){while(--_0x3dea77){_0x21fc68['push'](_0x21fc68['shift']());}};_0x3561e1(++_0x459828);}(_0x5100,0xc2));var _0x0510=function(_0x44fb3d,_0x206053){_0x44fb3d=_0x44fb3d-0x0;var _0x3bdaed=_0x5100[_0x44fb3d];return _0x3bdaed;};'use strict';var multer=require('multer');var util=require(_0x0510('0x0'));var path=require(_0x0510('0x1'));var timeout=require(_0x0510('0x2'));var express=require('express');var router=express[_0x0510('0x3')]();var fs_extra=require(_0x0510('0x4'));var auth=require(_0x0510('0x5'));var interaction=require(_0x0510('0x6'));var config=require(_0x0510('0x7'));var controller=require(_0x0510('0x8'));router[_0x0510('0x9')]('/:id',auth[_0x0510('0xa')](),controller[_0x0510('0xb')]);router[_0x0510('0xc')]('/',auth[_0x0510('0xa')](),controller[_0x0510('0xd')]);router[_0x0510('0xe')](_0x0510('0xf'),auth[_0x0510('0xa')](),controller[_0x0510('0x10')]);router[_0x0510('0x11')](_0x0510('0xf'),auth[_0x0510('0xa')](),controller['destroy']);module[_0x0510('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index ba3da75..ecc9ff2 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 _0x757f=['sequelize','exports','STRING','first','second','third'];(function(_0x8d172d,_0x5734c0){var _0x11fc93=function(_0x5830ad){while(--_0x5830ad){_0x8d172d['push'](_0x8d172d['shift']());}};_0x11fc93(++_0x5734c0);}(_0x757f,0xf0));var _0xf757=function(_0xd4e399,_0x4a8481){_0xd4e399=_0xd4e399-0x0;var _0x1186c9=_0x757f[_0xd4e399];return _0x1186c9;};'use strict';var Sequelize=require(_0xf757('0x0'));module[_0xf757('0x1')]={'name':{'type':Sequelize[_0xf757('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xf757('0x3'),_0xf757('0x4'),_0xf757('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x323b=['exports','STRING','second','third','sequelize'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x323b,0x8b));var _0xb323=function(_0x289ff5,_0x1ef955){_0x289ff5=_0x289ff5-0x0;var _0x42e8bc=_0x323b[_0x289ff5];return _0x42e8bc;};'use strict';var Sequelize=require(_0xb323('0x0'));module[_0xb323('0x1')]={'name':{'type':Sequelize[_0xb323('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0xb323('0x3'),_0xb323('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xb323('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 28c7cb5..4eab239 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 _0x9c48=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','UserProfileResource','error','name','send','index','map','Disposition','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x138e55,_0x3fdc20){var _0x59ca52=function(_0x28f11b){while(--_0x28f11b){_0x138e55['push'](_0x138e55['shift']());}};_0x59ca52(++_0x3fdc20);}(_0x9c48,0xa1));var _0x89c4=function(_0x3afebd,_0x315db2){_0x3afebd=_0x3afebd-0x0;var _0x49858c=_0x9c48[_0x3afebd];return _0x49858c;};'use strict';var emlformat=require(_0x89c4('0x0'));var rimraf=require(_0x89c4('0x1'));var zipdir=require(_0x89c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89c4('0x3'));var moment=require(_0x89c4('0x4'));var BPromise=require(_0x89c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x89c4('0x6'));var sox=require(_0x89c4('0x7'));var csv=require('to-csv');var ejs=require(_0x89c4('0x8'));var fs=require('fs');var fs_extra=require(_0x89c4('0x9'));var _=require(_0x89c4('0xa'));var squel=require(_0x89c4('0xb'));var crypto=require(_0x89c4('0xc'));var jsforce=require(_0x89c4('0xd'));var deskjs=require(_0x89c4('0xe'));var toCsv=require(_0x89c4('0xf'));var querystring=require(_0x89c4('0x10'));var Papa=require(_0x89c4('0x11'));var Redis=require(_0x89c4('0x12'));var authService=require(_0x89c4('0x13'));var qs=require(_0x89c4('0x14'));var as=require(_0x89c4('0x15'));var hardwareService=require(_0x89c4('0x16'));var logger=require(_0x89c4('0x17'))(_0x89c4('0x18'));var utils=require(_0x89c4('0x19'));var config=require(_0x89c4('0x1a'));var licenseUtil=require(_0x89c4('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59516a,_0x58f872){_0x58f872=_0x58f872||0xcc;return function(_0x1d2e9d){if(_0x1d2e9d){return _0x59516a[_0x89c4('0x1c')](_0x58f872);}return _0x59516a[_0x89c4('0x1d')](_0x58f872)[_0x89c4('0x1e')]();};}function respondWithResult(_0x620757,_0x18d0bf){_0x18d0bf=_0x18d0bf||0xc8;return function(_0x84b446){if(_0x84b446){return _0x620757['status'](_0x18d0bf)[_0x89c4('0x1f')](_0x84b446);}};}function respondWithFilteredResult(_0x2bd1d8,_0x5aefe9){return function(_0x4207a5){if(_0x4207a5){var _0x5cd765=typeof _0x5aefe9[_0x89c4('0x20')]===_0x89c4('0x21')&&typeof _0x5aefe9[_0x89c4('0x22')]==='undefined';var _0x41cb06=_0x4207a5['count'];var _0x29342c=_0x5cd765?0x0:_0x5aefe9[_0x89c4('0x20')];var _0x574f49=_0x5cd765?_0x4207a5[_0x89c4('0x23')]:_0x5aefe9['offset']+_0x5aefe9['limit'];var _0x40617b;if(_0x574f49>=_0x41cb06){_0x574f49=_0x41cb06;_0x40617b=0xc8;}else{_0x40617b=0xce;}_0x2bd1d8[_0x89c4('0x1d')](_0x40617b);return _0x2bd1d8[_0x89c4('0x24')]('Content-Range',_0x29342c+'-'+_0x574f49+'/'+_0x41cb06)[_0x89c4('0x1f')](_0x4207a5);}return null;};}function patchUpdates(_0x5b8a37){return function(_0x38e347){try{jsonpatch[_0x89c4('0x25')](_0x38e347,_0x5b8a37,!![]);}catch(_0x55473d){return BPromise[_0x89c4('0x26')](_0x55473d);}return _0x38e347[_0x89c4('0x27')]();};}function saveUpdates(_0x398fc4,_0xc528ee){return function(_0x15ad38){if(_0x15ad38){return _0x15ad38[_0x89c4('0x28')](_0x398fc4)['then'](function(_0x330226){return _0x330226;});}return null;};}function removeEntity(_0x41be54,_0x59e8ee){return function(_0x2e7e6b){if(_0x2e7e6b){return _0x2e7e6b[_0x89c4('0x29')]()[_0x89c4('0x2a')](function(){var _0xd0201d=_0x2e7e6b[_0x89c4('0x2b')]({'plain':!![]});var _0xa739bd='Dispositions';return db[_0x89c4('0x2c')][_0x89c4('0x29')]({'where':{'type':_0xa739bd,'resourceId':_0xd0201d['id']}})[_0x89c4('0x2a')](function(){return _0x2e7e6b;});})[_0x89c4('0x2a')](function(){_0x41be54[_0x89c4('0x1d')](0xcc)[_0x89c4('0x1e')]();});}};}function handleEntityNotFound(_0x1031f5,_0x45b4f1){return function(_0x256b9f){if(!_0x256b9f){_0x1031f5[_0x89c4('0x1c')](0x194);}return _0x256b9f;};}function handleError(_0xcba596,_0x3ee2ff){_0x3ee2ff=_0x3ee2ff||0x1f4;return function(_0x79e258){logger[_0x89c4('0x2d')](_0x79e258['stack']);if(_0x79e258['name']){delete _0x79e258[_0x89c4('0x2e')];}_0xcba596['status'](_0x3ee2ff)[_0x89c4('0x2f')](_0x79e258);};}exports[_0x89c4('0x30')]=function(_0x3ddbf1,_0x387e72){var _0x2c732a={},_0x24f61e={},_0x35c1fb={'count':0x0,'rows':[]};var _0x107222=_[_0x89c4('0x31')](db[_0x89c4('0x32')][_0x89c4('0x33')],function(_0x5b345b){return{'name':_0x5b345b['fieldName'],'type':_0x5b345b['type'][_0x89c4('0x34')]};});_0x24f61e[_0x89c4('0x35')]=_[_0x89c4('0x31')](_0x107222,_0x89c4('0x2e'));_0x24f61e[_0x89c4('0x36')]=_[_0x89c4('0x37')](_0x3ddbf1[_0x89c4('0x36')]);_0x24f61e[_0x89c4('0x38')]=_[_0x89c4('0x39')](_0x24f61e[_0x89c4('0x35')],_0x24f61e[_0x89c4('0x36')]);_0x2c732a[_0x89c4('0x3a')]=_['intersection'](_0x24f61e[_0x89c4('0x35')],qs['fields'](_0x3ddbf1['query'][_0x89c4('0x3b')]));_0x2c732a[_0x89c4('0x3a')]=_0x2c732a[_0x89c4('0x3a')][_0x89c4('0x3c')]?_0x2c732a[_0x89c4('0x3a')]:_0x24f61e['model'];if(!_0x3ddbf1[_0x89c4('0x36')][_0x89c4('0x3d')](_0x89c4('0x3e'))){_0x2c732a['limit']=qs[_0x89c4('0x22')](_0x3ddbf1['query'][_0x89c4('0x22')]);_0x2c732a[_0x89c4('0x20')]=qs[_0x89c4('0x20')](_0x3ddbf1[_0x89c4('0x36')][_0x89c4('0x20')]);}_0x2c732a[_0x89c4('0x3f')]=qs[_0x89c4('0x40')](_0x3ddbf1[_0x89c4('0x36')][_0x89c4('0x40')]);_0x2c732a[_0x89c4('0x41')]=qs[_0x89c4('0x38')](_[_0x89c4('0x42')](_0x3ddbf1[_0x89c4('0x36')],_0x24f61e[_0x89c4('0x38')]),_0x107222);if(_0x3ddbf1['query'][_0x89c4('0x43')]){_0x2c732a[_0x89c4('0x41')]=_[_0x89c4('0x44')](_0x2c732a[_0x89c4('0x41')],{'$or':_[_0x89c4('0x31')](_0x107222,function(_0x4ffd79){if(_0x4ffd79[_0x89c4('0x45')]!==_0x89c4('0x46')){var _0x4ed123={};_0x4ed123[_0x4ffd79[_0x89c4('0x2e')]]={'$like':'%'+_0x3ddbf1[_0x89c4('0x36')][_0x89c4('0x43')]+'%'};return _0x4ed123;}})});}_0x2c732a=_[_0x89c4('0x44')]({},_0x2c732a,_0x3ddbf1['options']);var _0x4f8628={'where':_0x2c732a['where']};return db['Disposition'][_0x89c4('0x23')](_0x4f8628)[_0x89c4('0x2a')](function(_0x2612cd){_0x35c1fb[_0x89c4('0x23')]=_0x2612cd;if(_0x3ddbf1['query'][_0x89c4('0x47')]){_0x2c732a[_0x89c4('0x48')]=[{'all':!![]}];}return db[_0x89c4('0x32')][_0x89c4('0x49')](_0x2c732a);})[_0x89c4('0x2a')](function(_0x2bd72a){_0x35c1fb['rows']=_0x2bd72a;return _0x35c1fb;})['then'](respondWithFilteredResult(_0x387e72,_0x2c732a))[_0x89c4('0x4a')](handleError(_0x387e72,null));};exports[_0x89c4('0x4b')]=function(_0x586766,_0x3f0336){var _0x3f576c={'raw':!![],'where':{'id':_0x586766[_0x89c4('0x4c')]['id']}},_0x956cb9={};_0x956cb9[_0x89c4('0x35')]=_['keys'](db['Disposition'][_0x89c4('0x33')]);_0x956cb9[_0x89c4('0x36')]=_[_0x89c4('0x37')](_0x586766['query']);_0x956cb9[_0x89c4('0x38')]=_[_0x89c4('0x39')](_0x956cb9[_0x89c4('0x35')],_0x956cb9[_0x89c4('0x36')]);_0x3f576c[_0x89c4('0x3a')]=_[_0x89c4('0x39')](_0x956cb9['model'],qs[_0x89c4('0x3b')](_0x586766['query']['fields']));_0x3f576c[_0x89c4('0x3a')]=_0x3f576c[_0x89c4('0x3a')]['length']?_0x3f576c[_0x89c4('0x3a')]:_0x956cb9['model'];if(_0x586766['query'][_0x89c4('0x47')]){_0x3f576c[_0x89c4('0x48')]=[{'all':!![]}];}_0x3f576c=_[_0x89c4('0x44')]({},_0x3f576c,_0x586766[_0x89c4('0x4d')]);return db[_0x89c4('0x32')][_0x89c4('0x4e')](_0x3f576c)[_0x89c4('0x2a')](handleEntityNotFound(_0x3f0336,null))[_0x89c4('0x2a')](respondWithResult(_0x3f0336,null))['catch'](handleError(_0x3f0336,null));};exports[_0x89c4('0x4f')]=function(_0x183115,_0x5e0b35){return db[_0x89c4('0x32')][_0x89c4('0x4f')](_0x183115[_0x89c4('0x50')],{})['then'](function(_0x12ec65){var _0x5c690f=_0x183115[_0x89c4('0x51')][_0x89c4('0x2b')]({'plain':!![]});if(!_0x5c690f)throw new Error(_0x89c4('0x52'));if(_0x5c690f[_0x89c4('0x53')]==='user'){var _0x2e6bcc=_0x12ec65['get']({'plain':!![]});var _0x547804=_0x89c4('0x54');return db[_0x89c4('0x55')][_0x89c4('0x4e')]({'where':{'name':_0x547804,'userProfileId':_0x5c690f[_0x89c4('0x56')]},'raw':!![]})[_0x89c4('0x2a')](function(_0x458d16){if(_0x458d16&&_0x458d16[_0x89c4('0x57')]===0x0){return db[_0x89c4('0x2c')][_0x89c4('0x4f')]({'name':_0x2e6bcc[_0x89c4('0x2e')],'resourceId':_0x2e6bcc['id'],'type':_0x458d16['name'],'sectionId':_0x458d16['id']},{})[_0x89c4('0x2a')](function(){return _0x12ec65;});}else{return _0x12ec65;}})[_0x89c4('0x4a')](function(_0x1eb4bb){logger[_0x89c4('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1eb4bb);throw _0x1eb4bb;});}return _0x12ec65;})[_0x89c4('0x2a')](respondWithResult(_0x5e0b35,0xc9))['catch'](handleError(_0x5e0b35,null));};exports[_0x89c4('0x28')]=function(_0x1e10a1,_0x4fc786){if(_0x1e10a1[_0x89c4('0x50')]['id']){delete _0x1e10a1[_0x89c4('0x50')]['id'];}return db[_0x89c4('0x32')][_0x89c4('0x4e')]({'where':{'id':_0x1e10a1['params']['id']}})['then'](handleEntityNotFound(_0x4fc786,null))['then'](saveUpdates(_0x1e10a1[_0x89c4('0x50')],null))['then'](respondWithResult(_0x4fc786,null))[_0x89c4('0x4a')](handleError(_0x4fc786,null));};exports[_0x89c4('0x29')]=function(_0x303b29,_0x407bd7){return db[_0x89c4('0x32')][_0x89c4('0x4e')]({'where':{'id':_0x303b29[_0x89c4('0x4c')]['id']}})[_0x89c4('0x2a')](handleEntityNotFound(_0x407bd7,null))[_0x89c4('0x2a')](removeEntity(_0x407bd7,null))[_0x89c4('0x4a')](handleError(_0x407bd7,null));}; \ No newline at end of file +var _0x38ec=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','params','options','find','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x4264ee,_0x520320){var _0x46d043=function(_0x4636e8){while(--_0x4636e8){_0x4264ee['push'](_0x4264ee['shift']());}};_0x46d043(++_0x520320);}(_0x38ec,0xfa));var _0xc38e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38ec[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xc38e('0x0'));var rimraf=require(_0xc38e('0x1'));var zipdir=require(_0xc38e('0x2'));var jsonpatch=require(_0xc38e('0x3'));var rp=require(_0xc38e('0x4'));var moment=require(_0xc38e('0x5'));var BPromise=require(_0xc38e('0x6'));var Mustache=require(_0xc38e('0x7'));var util=require(_0xc38e('0x8'));var path=require('path');var sox=require(_0xc38e('0x9'));var csv=require(_0xc38e('0xa'));var ejs=require(_0xc38e('0xb'));var fs=require('fs');var fs_extra=require(_0xc38e('0xc'));var _=require(_0xc38e('0xd'));var squel=require(_0xc38e('0xe'));var crypto=require(_0xc38e('0xf'));var jsforce=require(_0xc38e('0x10'));var deskjs=require(_0xc38e('0x11'));var toCsv=require(_0xc38e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc38e('0x12'));var authService=require(_0xc38e('0x13'));var qs=require(_0xc38e('0x14'));var as=require(_0xc38e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc38e('0x16'))(_0xc38e('0x17'));var utils=require('../../config/utils');var config=require(_0xc38e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x259a4d,_0x3e90ab){_0x3e90ab=_0x3e90ab||0xcc;return function(_0x3c808d){if(_0x3c808d){return _0x259a4d[_0xc38e('0x19')](_0x3e90ab);}return _0x259a4d[_0xc38e('0x1a')](_0x3e90ab)[_0xc38e('0x1b')]();};}function respondWithResult(_0x32273a,_0x33e11a){_0x33e11a=_0x33e11a||0xc8;return function(_0x4f6f89){if(_0x4f6f89){return _0x32273a[_0xc38e('0x1a')](_0x33e11a)[_0xc38e('0x1c')](_0x4f6f89);}};}function respondWithFilteredResult(_0x5cb21f,_0x10fee9){return function(_0x13c707){if(_0x13c707){var _0x1d189f=typeof _0x10fee9[_0xc38e('0x1d')]==='undefined'&&typeof _0x10fee9[_0xc38e('0x1e')]===_0xc38e('0x1f');var _0x38be21=_0x13c707[_0xc38e('0x20')];var _0x29a89b=_0x1d189f?0x0:_0x10fee9[_0xc38e('0x1d')];var _0x14d09f=_0x1d189f?_0x13c707[_0xc38e('0x20')]:_0x10fee9[_0xc38e('0x1d')]+_0x10fee9[_0xc38e('0x1e')];var _0x38e4af;if(_0x14d09f>=_0x38be21){_0x14d09f=_0x38be21;_0x38e4af=0xc8;}else{_0x38e4af=0xce;}_0x5cb21f[_0xc38e('0x1a')](_0x38e4af);return _0x5cb21f['set'](_0xc38e('0x21'),_0x29a89b+'-'+_0x14d09f+'/'+_0x38be21)[_0xc38e('0x1c')](_0x13c707);}return null;};}function patchUpdates(_0x5d8a6c){return function(_0x48e7d4){try{jsonpatch[_0xc38e('0x22')](_0x48e7d4,_0x5d8a6c,!![]);}catch(_0x16f781){return BPromise[_0xc38e('0x23')](_0x16f781);}return _0x48e7d4[_0xc38e('0x24')]();};}function saveUpdates(_0x135f77,_0x45ad96){return function(_0x4bdd5d){if(_0x4bdd5d){return _0x4bdd5d['update'](_0x135f77)[_0xc38e('0x25')](function(_0x388918){return _0x388918;});}return null;};}function removeEntity(_0x4cf9d3,_0xcc1fa){return function(_0x538398){if(_0x538398){return _0x538398[_0xc38e('0x26')]()[_0xc38e('0x25')](function(){var _0x12528c=_0x538398[_0xc38e('0x27')]({'plain':!![]});var _0x35c2de=_0xc38e('0x28');return db[_0xc38e('0x29')]['destroy']({'where':{'type':_0x35c2de,'resourceId':_0x12528c['id']}})['then'](function(){return _0x538398;});})['then'](function(){_0x4cf9d3[_0xc38e('0x1a')](0xcc)[_0xc38e('0x1b')]();});}};}function handleEntityNotFound(_0x3a6203,_0x2b3963){return function(_0x19b6c3){if(!_0x19b6c3){_0x3a6203[_0xc38e('0x19')](0x194);}return _0x19b6c3;};}function handleError(_0x26e70d,_0x2621b2){_0x2621b2=_0x2621b2||0x1f4;return function(_0x76853f){logger[_0xc38e('0x2a')](_0x76853f[_0xc38e('0x2b')]);if(_0x76853f[_0xc38e('0x2c')]){delete _0x76853f[_0xc38e('0x2c')];}_0x26e70d[_0xc38e('0x1a')](_0x2621b2)['send'](_0x76853f);};}exports[_0xc38e('0x2d')]=function(_0x105a8a,_0x35e567){var _0x1f9200={},_0x1880ed={},_0x6dea58={'count':0x0,'rows':[]};var _0x4b2128=_[_0xc38e('0x2e')](db[_0xc38e('0x2f')][_0xc38e('0x30')],function(_0x2eb3a5){return{'name':_0x2eb3a5[_0xc38e('0x31')],'type':_0x2eb3a5[_0xc38e('0x32')][_0xc38e('0x33')]};});_0x1880ed[_0xc38e('0x34')]=_[_0xc38e('0x2e')](_0x4b2128,_0xc38e('0x2c'));_0x1880ed[_0xc38e('0x35')]=_[_0xc38e('0x36')](_0x105a8a[_0xc38e('0x35')]);_0x1880ed[_0xc38e('0x37')]=_[_0xc38e('0x38')](_0x1880ed[_0xc38e('0x34')],_0x1880ed['query']);_0x1f9200['attributes']=_[_0xc38e('0x38')](_0x1880ed[_0xc38e('0x34')],qs[_0xc38e('0x39')](_0x105a8a[_0xc38e('0x35')][_0xc38e('0x39')]));_0x1f9200[_0xc38e('0x3a')]=_0x1f9200['attributes'][_0xc38e('0x3b')]?_0x1f9200[_0xc38e('0x3a')]:_0x1880ed[_0xc38e('0x34')];if(!_0x105a8a[_0xc38e('0x35')][_0xc38e('0x3c')](_0xc38e('0x3d'))){_0x1f9200[_0xc38e('0x1e')]=qs[_0xc38e('0x1e')](_0x105a8a[_0xc38e('0x35')]['limit']);_0x1f9200[_0xc38e('0x1d')]=qs['offset'](_0x105a8a[_0xc38e('0x35')][_0xc38e('0x1d')]);}_0x1f9200[_0xc38e('0x3e')]=qs[_0xc38e('0x3f')](_0x105a8a[_0xc38e('0x35')][_0xc38e('0x3f')]);_0x1f9200[_0xc38e('0x40')]=qs[_0xc38e('0x37')](_[_0xc38e('0x41')](_0x105a8a[_0xc38e('0x35')],_0x1880ed[_0xc38e('0x37')]),_0x4b2128);if(_0x105a8a[_0xc38e('0x35')]['filter']){_0x1f9200[_0xc38e('0x40')]=_[_0xc38e('0x42')](_0x1f9200[_0xc38e('0x40')],{'$or':_[_0xc38e('0x2e')](_0x4b2128,function(_0x4a5b19){if(_0x4a5b19[_0xc38e('0x32')]!=='VIRTUAL'){var _0x18a805={};_0x18a805[_0x4a5b19[_0xc38e('0x2c')]]={'$like':'%'+_0x105a8a[_0xc38e('0x35')]['filter']+'%'};return _0x18a805;}})});}_0x1f9200=_['merge']({},_0x1f9200,_0x105a8a['options']);var _0x502365={'where':_0x1f9200[_0xc38e('0x40')]};return db['Disposition'][_0xc38e('0x20')](_0x502365)['then'](function(_0xc879d3){_0x6dea58[_0xc38e('0x20')]=_0xc879d3;if(_0x105a8a[_0xc38e('0x35')][_0xc38e('0x43')]){_0x1f9200[_0xc38e('0x44')]=[{'all':!![]}];}return db['Disposition'][_0xc38e('0x45')](_0x1f9200);})[_0xc38e('0x25')](function(_0x42287c){_0x6dea58[_0xc38e('0x46')]=_0x42287c;return _0x6dea58;})[_0xc38e('0x25')](respondWithFilteredResult(_0x35e567,_0x1f9200))[_0xc38e('0x47')](handleError(_0x35e567,null));};exports['show']=function(_0xead33f,_0x3f51ef){var _0x1bf043={'raw':!![],'where':{'id':_0xead33f[_0xc38e('0x48')]['id']}},_0x4fd907={};_0x4fd907[_0xc38e('0x34')]=_['keys'](db[_0xc38e('0x2f')]['rawAttributes']);_0x4fd907['query']=_[_0xc38e('0x36')](_0xead33f[_0xc38e('0x35')]);_0x4fd907[_0xc38e('0x37')]=_['intersection'](_0x4fd907['model'],_0x4fd907[_0xc38e('0x35')]);_0x1bf043[_0xc38e('0x3a')]=_[_0xc38e('0x38')](_0x4fd907[_0xc38e('0x34')],qs[_0xc38e('0x39')](_0xead33f[_0xc38e('0x35')][_0xc38e('0x39')]));_0x1bf043[_0xc38e('0x3a')]=_0x1bf043[_0xc38e('0x3a')]['length']?_0x1bf043['attributes']:_0x4fd907['model'];if(_0xead33f[_0xc38e('0x35')][_0xc38e('0x43')]){_0x1bf043[_0xc38e('0x44')]=[{'all':!![]}];}_0x1bf043=_[_0xc38e('0x42')]({},_0x1bf043,_0xead33f[_0xc38e('0x49')]);return db[_0xc38e('0x2f')][_0xc38e('0x4a')](_0x1bf043)[_0xc38e('0x25')](handleEntityNotFound(_0x3f51ef,null))[_0xc38e('0x25')](respondWithResult(_0x3f51ef,null))[_0xc38e('0x47')](handleError(_0x3f51ef,null));};exports[_0xc38e('0x4b')]=function(_0x3c93,_0x28ae3a){return db['Disposition'][_0xc38e('0x4b')](_0x3c93['body'],{})[_0xc38e('0x25')](function(_0x290404){var _0x3c1ac4=_0x3c93[_0xc38e('0x4c')][_0xc38e('0x27')]({'plain':!![]});if(!_0x3c1ac4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c1ac4[_0xc38e('0x4d')]===_0xc38e('0x4c')){var _0x1d95e9=_0x290404[_0xc38e('0x27')]({'plain':!![]});var _0x4df5d4='Dispositions';return db['UserProfileSection'][_0xc38e('0x4a')]({'where':{'name':_0x4df5d4,'userProfileId':_0x3c1ac4[_0xc38e('0x4e')]},'raw':!![]})['then'](function(_0x143a17){if(_0x143a17&&_0x143a17[_0xc38e('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x1d95e9[_0xc38e('0x2c')],'resourceId':_0x1d95e9['id'],'type':_0x143a17[_0xc38e('0x2c')],'sectionId':_0x143a17['id']},{})['then'](function(){return _0x290404;});}else{return _0x290404;}})[_0xc38e('0x47')](function(_0x41881a){logger[_0xc38e('0x2a')](_0xc38e('0x50'),_0x41881a);throw _0x41881a;});}return _0x290404;})['then'](respondWithResult(_0x28ae3a,0xc9))[_0xc38e('0x47')](handleError(_0x28ae3a,null));};exports[_0xc38e('0x51')]=function(_0xba6652,_0x1cf4c7){if(_0xba6652[_0xc38e('0x52')]['id']){delete _0xba6652[_0xc38e('0x52')]['id'];}return db['Disposition'][_0xc38e('0x4a')]({'where':{'id':_0xba6652[_0xc38e('0x48')]['id']}})['then'](handleEntityNotFound(_0x1cf4c7,null))['then'](saveUpdates(_0xba6652['body'],null))[_0xc38e('0x25')](respondWithResult(_0x1cf4c7,null))[_0xc38e('0x47')](handleError(_0x1cf4c7,null));};exports['destroy']=function(_0x38c5ce,_0x17916d){return db[_0xc38e('0x2f')][_0xc38e('0x4a')]({'where':{'id':_0x38c5ce[_0xc38e('0x48')]['id']}})[_0xc38e('0x25')](handleEntityNotFound(_0x17916d,null))[_0xc38e('0x25')](removeEntity(_0x17916d,null))[_0xc38e('0x47')](handleError(_0x17916d,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index a596fe0..394b64a 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 _0x724d=['moment','request-promise','path','rimraf','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api'];(function(_0x134672,_0x4787e6){var _0x32090e=function(_0x3b4436){while(--_0x3b4436){_0x134672['push'](_0x134672['shift']());}};_0x32090e(++_0x4787e6);}(_0x724d,0xab));var _0xd724=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x724d[_0x2555d0];return _0x3bb486;};'use strict';var _=require(_0xd724('0x0'));var util=require(_0xd724('0x1'));var logger=require(_0xd724('0x2'))(_0xd724('0x3'));var moment=require(_0xd724('0x4'));var BPromise=require('bluebird');var rp=require(_0xd724('0x5'));var fs=require('fs');var path=require(_0xd724('0x6'));var rimraf=require(_0xd724('0x7'));var config=require('../../config/environment');var attributes=require(_0xd724('0x8'));module[_0xd724('0x9')]=function(_0x480322,_0x3690a4){return _0x480322[_0xd724('0xa')](_0xd724('0xb'),attributes,{'tableName':_0xd724('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xd724('0xd'),'fields':[_0xd724('0xe'),_0xd724('0xf')]},{'unique':!![],'name':_0xd724('0x10'),'fields':[_0xd724('0xe'),_0xd724('0x11')]},{'unique':!![],'name':'name_mail','fields':['name',_0xd724('0x12')]},{'unique':!![],'name':_0xd724('0x13'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0xd724('0x14'),'fields':['name',_0xd724('0x15')]},{'unique':!![],'name':_0xd724('0x16'),'fields':[_0xd724('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':_0xd724('0x17'),'fields':[_0xd724('0xe'),_0xd724('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb420=['ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xb420,0x1ab));var _0x0b42=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb420[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0b42('0x0'));var util=require(_0x0b42('0x1'));var logger=require(_0x0b42('0x2'))(_0x0b42('0x3'));var moment=require(_0x0b42('0x4'));var BPromise=require('bluebird');var rp=require(_0x0b42('0x5'));var fs=require('fs');var path=require(_0x0b42('0x6'));var rimraf=require(_0x0b42('0x7'));var config=require(_0x0b42('0x8'));var attributes=require(_0x0b42('0x9'));module[_0x0b42('0xa')]=function(_0x130a4b,_0x3d87ba){return _0x130a4b['define'](_0x0b42('0xb'),attributes,{'tableName':_0x0b42('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x0b42('0xd'),'fields':[_0x0b42('0xe'),_0x0b42('0xf')]},{'unique':!![],'name':_0x0b42('0x10'),'fields':['name',_0x0b42('0x11')]},{'unique':!![],'name':_0x0b42('0x12'),'fields':['name',_0x0b42('0x13')]},{'unique':!![],'name':_0x0b42('0x14'),'fields':['name',_0x0b42('0x15')]},{'unique':!![],'name':'name_fax','fields':[_0x0b42('0xe'),'FaxAccountId']},{'unique':!![],'name':_0x0b42('0x16'),'fields':[_0x0b42('0xe'),_0x0b42('0x17')]},{'unique':!![],'name':_0x0b42('0x18'),'fields':['name',_0x0b42('0x19')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index bf0c64f..0914a22 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(_0x29a909,_0x436430){var _0x34432d=function(_0x49dfca){while(--_0x49dfca){_0x29a909['push'](_0x29a909['shift']());}};_0x34432d(++_0x436430);}(_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 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(_0x183cc4,_0xaaa23){var _0x54e0c3=function(_0x4f3af2){while(--_0x4f3af2){_0x183cc4['push'](_0x183cc4['shift']());}};_0x54e0c3(++_0xaaa23);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 6a3e826..3490f8a 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 _0xf44d=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x24023e,_0x5f066d){var _0xc98533=function(_0x28a330){while(--_0x28a330){_0x24023e['push'](_0x24023e['shift']());}};_0xc98533(++_0x5f066d);}(_0xf44d,0x17b));var _0xdf44=function(_0x387c70,_0x2ccc4e){_0x387c70=_0x387c70-0x0;var _0x2fdc97=_0xf44d[_0x387c70];return _0x2fdc97;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdf44('0x0'));var timeout=require(_0xdf44('0x1'));var express=require(_0xdf44('0x2'));var router=express[_0xdf44('0x3')]();var fs_extra=require(_0xdf44('0x4'));var auth=require(_0xdf44('0x5'));var interaction=require(_0xdf44('0x6'));var config=require(_0xdf44('0x7'));var controller=require(_0xdf44('0x8'));router[_0xdf44('0x9')]('/',auth[_0xdf44('0xa')](),controller[_0xdf44('0xb')]);router[_0xdf44('0x9')](_0xdf44('0xc'),auth[_0xdf44('0xa')](),controller['show']);router[_0xdf44('0xd')]('/',auth['isAuthenticated'](),controller[_0xdf44('0xe')]);router[_0xdf44('0xf')](_0xdf44('0xc'),auth['isAuthenticated'](),controller[_0xdf44('0x10')]);router['delete'](_0xdf44('0xc'),auth[_0xdf44('0xa')](),controller['destroy']);module[_0xdf44('0x11')]=router; \ No newline at end of file +var _0xaa44=['./disposition.controller','index','get','/:id','isAuthenticated','post','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x121d9e,_0x11b966){var _0x5df466=function(_0x519340){while(--_0x519340){_0x121d9e['push'](_0x121d9e['shift']());}};_0x5df466(++_0x11b966);}(_0xaa44,0x127));var _0x4aa4=function(_0x5463e5,_0x5b34cb){_0x5463e5=_0x5463e5-0x0;var _0x5d5811=_0xaa44[_0x5463e5];return _0x5d5811;};'use strict';var multer=require('multer');var util=require(_0x4aa4('0x0'));var path=require(_0x4aa4('0x1'));var timeout=require(_0x4aa4('0x2'));var express=require(_0x4aa4('0x3'));var router=express[_0x4aa4('0x4')]();var fs_extra=require(_0x4aa4('0x5'));var auth=require(_0x4aa4('0x6'));var interaction=require(_0x4aa4('0x7'));var config=require(_0x4aa4('0x8'));var controller=require(_0x4aa4('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4aa4('0xa')]);router[_0x4aa4('0xb')](_0x4aa4('0xc'),auth[_0x4aa4('0xd')](),controller['show']);router[_0x4aa4('0xe')]('/',auth[_0x4aa4('0xd')](),controller['create']);router[_0x4aa4('0xf')](_0x4aa4('0xc'),auth[_0x4aa4('0xd')](),controller[_0x4aa4('0x10')]);router['delete'](_0x4aa4('0xc'),auth[_0x4aa4('0xd')](),controller[_0x4aa4('0x11')]);module[_0x4aa4('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 615c1d9..437a7e6 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 _0x5a5a=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','9600','12000','14400','7200','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x5d5ad9,_0x9fe65c){_0x5d5ad9=_0x5d5ad9-0x0;var _0x461f64=_0x5a5a[_0x5d5ad9];return _0x461f64;};'use strict';var Sequelize=require('sequelize');module[_0xa5a5('0x0')]={'name':{'type':Sequelize[_0xa5a5('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa5a5('0x1')]},'ecm':{'type':Sequelize[_0xa5a5('0x2')](_0xa5a5('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xa5a5('0x1')],'defaultValue':_0xa5a5('0x4')},'localstationid':{'type':Sequelize[_0xa5a5('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0xa5a5('0x5'),_0xa5a5('0x6'),'7200',_0xa5a5('0x7'),_0xa5a5('0x8'),_0xa5a5('0x9')),'defaultValue':_0xa5a5('0x6')},'maxrate':{'type':Sequelize[_0xa5a5('0x2')]('2400',_0xa5a5('0x6'),_0xa5a5('0xa'),_0xa5a5('0x7'),_0xa5a5('0x8'),_0xa5a5('0x9')),'defaultValue':_0xa5a5('0x9')},'modem':{'type':Sequelize[_0xa5a5('0x1')],'defaultValue':_0xa5a5('0xb')},'gateway':{'type':Sequelize[_0xa5a5('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa5a5('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa5a5('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa5a5('0x2')]('SIP',_0xa5a5('0xd'),_0xa5a5('0xe'),_0xa5a5('0xf')),'defaultValue':_0xa5a5('0x10')},'key':{'type':Sequelize[_0xa5a5('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa5a5('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xa5a5('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa5a5('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa5a5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa5a5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa5a5('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa5a5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa5a5('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa5a5('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa5a5('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xa5a5('0x12')],'defaultValue':![],'comment':_0xa5a5('0x14'),'set':function(_0x184652){if(!_0x184652)this[_0xa5a5('0x15')](_0xa5a5('0x16'),null);this[_0xa5a5('0x15')]('mandatoryDisposition',_0x184652);}}}; \ No newline at end of file +var _0x49c1=['IAX','DADHI','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','localstationid','2400','7200','9600','14400','4800','12000','v17,v27,v29','INTEGER','SIP'];(function(_0x44a758,_0xf2441b){var _0x3778fb=function(_0x527ad1){while(--_0x527ad1){_0x44a758['push'](_0x44a758['shift']());}};_0x3778fb(++_0xf2441b);}(_0x49c1,0xef));var _0x149c=function(_0x362705,_0x395f45){_0x362705=_0x362705-0x0;var _0x29f928=_0x49c1[_0x362705];return _0x29f928;};'use strict';var Sequelize=require(_0x149c('0x0'));module['exports']={'name':{'type':Sequelize[_0x149c('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x149c('0x1')]},'ecm':{'type':Sequelize[_0x149c('0x2')]('yes','no'),'defaultValue':_0x149c('0x3')},'headerinfo':{'type':Sequelize[_0x149c('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x149c('0x1')],'unique':_0x149c('0x4')},'minrate':{'type':Sequelize['ENUM'](_0x149c('0x5'),'4800',_0x149c('0x6'),_0x149c('0x7'),'12000',_0x149c('0x8')),'defaultValue':_0x149c('0x9')},'maxrate':{'type':Sequelize['ENUM'](_0x149c('0x5'),_0x149c('0x9'),'7200',_0x149c('0x7'),_0x149c('0xa'),_0x149c('0x8')),'defaultValue':_0x149c('0x8')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x149c('0xb')},'gateway':{'type':Sequelize[_0x149c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x149c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x149c('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x149c('0x2')](_0x149c('0xd'),_0x149c('0xe'),_0x149c('0xf'),'KHOMP'),'defaultValue':_0x149c('0xd')},'key':{'type':Sequelize[_0x149c('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x149c('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x149c('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x149c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x149c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x149c('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x149c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x149c('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x149c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x149c('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x149c('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x149c('0x13'),'set':function(_0x160d4f){if(!_0x160d4f)this[_0x149c('0x14')](_0x149c('0x15'),null);this[_0x149c('0x14')](_0x149c('0x16'),_0x160d4f);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 0a6a050..7089f7e 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 _0x9445=['Disposition','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','User','Owner','fullname','internal','Tags','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','priority','finally','getApplications','from-voip-provider','exten','app','system','push','Answer','CDR(type)=inbound-fax','ecm','localstationid','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Set','Wait','addAccountApplications','VoiceExtension','bulkCreate','omit','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','Contacts','List\x20not\x20found','out','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','userFaxAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','client','http','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','limit','undefined','count','offset','Content-Range','reject','update','then','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxAccount','includeAll','include','findAll','rows','show','params','keys','find','create','user','role','UserProfileSection','autoAssociation','body','describe','addDisposition','FaxAccountId','findOne'];(function(_0x10d73b,_0x5c4cb2){var _0x3697bb=function(_0x36f37d){while(--_0x36f37d){_0x10d73b['push'](_0x10d73b['shift']());}};_0x3697bb(++_0x5c4cb2);}(_0x9445,0x1d5));var _0x5944=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9445[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x5944('0x0'));var rimraf=require(_0x5944('0x1'));var zipdir=require(_0x5944('0x2'));var jsonpatch=require(_0x5944('0x3'));var rp=require(_0x5944('0x4'));var moment=require(_0x5944('0x5'));var BPromise=require(_0x5944('0x6'));var Mustache=require(_0x5944('0x7'));var util=require(_0x5944('0x8'));var path=require(_0x5944('0x9'));var sox=require('sox');var csv=require(_0x5944('0xa'));var ejs=require(_0x5944('0xb'));var fs=require('fs');var fs_extra=require(_0x5944('0xc'));var _=require(_0x5944('0xd'));var squel=require(_0x5944('0xe'));var crypto=require(_0x5944('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5944('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5944('0x11'));var Redis=require(_0x5944('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5944('0x13'));var as=require(_0x5944('0x14'));var hardwareService=require(_0x5944('0x15'));var logger=require('../../config/logger')(_0x5944('0x16'));var utils=require(_0x5944('0x17'));var config=require(_0x5944('0x18'));var licenseUtil=require(_0x5944('0x19'));var db=require(_0x5944('0x1a'))['db'];config[_0x5944('0x1b')]=_[_0x5944('0x1c')](config['redis'],{'host':_0x5944('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5944('0x1b')]));require(_0x5944('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5944('0x1f')][_0x5944('0x20')]({'port':0x232c});var client9002=jayson[_0x5944('0x1f')][_0x5944('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1618ff,_0x514e7b,_0x416094,_0x216d15){return new BPromise(function(_0x23dd0b,_0x41b33f){var _0x5009a6=_0x216d15||client;return _0x5009a6[_0x5944('0x21')](_0x1618ff,_0x416094)['then'](function(_0x192da3){logger['info'](_0x5944('0x22'),_0x514e7b,_0x5944('0x23'));logger[_0x5944('0x24')](_0x5944('0x25'),_0x514e7b,_0x5944('0x23'),JSON[_0x5944('0x26')](_0x192da3));if(_0x192da3['error']){if(_0x192da3[_0x5944('0x27')][_0x5944('0x28')]===0x1f4){logger[_0x5944('0x27')](_0x5944('0x22'),_0x514e7b,_0x192da3[_0x5944('0x27')][_0x5944('0x29')]);return _0x41b33f(_0x192da3[_0x5944('0x27')][_0x5944('0x29')]);}logger[_0x5944('0x27')](_0x5944('0x22'),_0x514e7b,_0x192da3[_0x5944('0x27')][_0x5944('0x29')]);return _0x23dd0b(_0x192da3['error'][_0x5944('0x29')]);}else{logger[_0x5944('0x2a')](_0x5944('0x22'),_0x514e7b,_0x5944('0x23'));_0x23dd0b(_0x192da3[_0x5944('0x2b')][_0x5944('0x29')]);}})[_0x5944('0x2c')](function(_0x1698a8){logger[_0x5944('0x27')](_0x5944('0x22'),_0x514e7b,_0x1698a8);_0x41b33f(_0x1698a8);});});}function respondWithStatusCode(_0x4cd127,_0x2a81e6){_0x2a81e6=_0x2a81e6||0xcc;return function(_0x392b24){if(_0x392b24){return _0x4cd127['sendStatus'](_0x2a81e6);}return _0x4cd127[_0x5944('0x2d')](_0x2a81e6)[_0x5944('0x2e')]();};}function respondWithResult(_0x2bab62,_0x45bcf2){_0x45bcf2=_0x45bcf2||0xc8;return function(_0x35d3bd){if(_0x35d3bd){return _0x2bab62[_0x5944('0x2d')](_0x45bcf2)[_0x5944('0x2f')](_0x35d3bd);}};}function respondWithFilteredResult(_0x207569,_0x5e3de3){return function(_0x570428){if(_0x570428){var _0x2fc73a=typeof _0x5e3de3['offset']==='undefined'&&typeof _0x5e3de3[_0x5944('0x30')]===_0x5944('0x31');var _0x562f5a=_0x570428[_0x5944('0x32')];var _0x2e7688=_0x2fc73a?0x0:_0x5e3de3[_0x5944('0x33')];var _0x3b5612=_0x2fc73a?_0x570428[_0x5944('0x32')]:_0x5e3de3[_0x5944('0x33')]+_0x5e3de3[_0x5944('0x30')];var _0x227e9f;if(_0x3b5612>=_0x562f5a){_0x3b5612=_0x562f5a;_0x227e9f=0xc8;}else{_0x227e9f=0xce;}_0x207569['status'](_0x227e9f);return _0x207569['set'](_0x5944('0x34'),_0x2e7688+'-'+_0x3b5612+'/'+_0x562f5a)[_0x5944('0x2f')](_0x570428);}return null;};}function patchUpdates(_0x21cf1c){return function(_0x5a5c92){try{jsonpatch['apply'](_0x5a5c92,_0x21cf1c,!![]);}catch(_0xeb9ea7){return BPromise[_0x5944('0x35')](_0xeb9ea7);}return _0x5a5c92['save']();};}function saveUpdates(_0x312b8d,_0x5c321a){return function(_0x12b829){if(_0x12b829){return _0x12b829[_0x5944('0x36')](_0x312b8d)[_0x5944('0x37')](function(_0x1eddc1){return _0x1eddc1;});}return null;};}function removeEntity(_0x1ab9af,_0x461429){return function(_0x4ad124){if(_0x4ad124){return _0x4ad124[_0x5944('0x38')]()[_0x5944('0x37')](function(){var _0xb8ded3=_0x4ad124[_0x5944('0x39')]({'plain':!![]});var _0x2f8cf6=_0x5944('0x3a');return db[_0x5944('0x3b')][_0x5944('0x38')]({'where':{'type':_0x2f8cf6,'resourceId':_0xb8ded3['id']}})['then'](function(){return _0x4ad124;});})['then'](function(){_0x1ab9af[_0x5944('0x2d')](0xcc)[_0x5944('0x2e')]();});}};}function handleEntityNotFound(_0x2ce53c,_0x276518){return function(_0x55f569){if(!_0x55f569){_0x2ce53c[_0x5944('0x3c')](0x194);}return _0x55f569;};}function handleError(_0x3ed177,_0xe62f66){_0xe62f66=_0xe62f66||0x1f4;return function(_0x3d2734){logger[_0x5944('0x27')](_0x3d2734[_0x5944('0x3d')]);if(_0x3d2734[_0x5944('0x3e')]){delete _0x3d2734[_0x5944('0x3e')];}_0x3ed177[_0x5944('0x2d')](_0xe62f66)[_0x5944('0x3f')](_0x3d2734);};}exports[_0x5944('0x40')]=function(_0x15e945,_0x414e7a){var _0xe7dac0={'include':[{'model':db[_0x5944('0x41')],'as':_0x5944('0x42')}]},_0x290428={},_0x1b9a8b={'count':0x0,'rows':[]};var _0xff1f59=_[_0x5944('0x43')](db['FaxAccount'][_0x5944('0x44')],function(_0x90f0a1){return{'name':_0x90f0a1[_0x5944('0x45')],'type':_0x90f0a1[_0x5944('0x46')][_0x5944('0x47')]};});_0x290428[_0x5944('0x48')]=_[_0x5944('0x43')](_0xff1f59,'name');_0x290428[_0x5944('0x49')]=_['keys'](_0x15e945[_0x5944('0x49')]);_0x290428[_0x5944('0x4a')]=_[_0x5944('0x4b')](_0x290428['model'],_0x290428[_0x5944('0x49')]);_0xe7dac0[_0x5944('0x4c')]=_[_0x5944('0x4b')](_0x290428['model'],qs[_0x5944('0x4d')](_0x15e945[_0x5944('0x49')][_0x5944('0x4d')]));_0xe7dac0['attributes']=_0xe7dac0[_0x5944('0x4c')][_0x5944('0x4e')]?_0xe7dac0[_0x5944('0x4c')]:_0x290428[_0x5944('0x48')];if(!_0x15e945[_0x5944('0x49')][_0x5944('0x4f')](_0x5944('0x50'))){_0xe7dac0[_0x5944('0x30')]=qs[_0x5944('0x30')](_0x15e945[_0x5944('0x49')][_0x5944('0x30')]);_0xe7dac0[_0x5944('0x33')]=qs[_0x5944('0x33')](_0x15e945[_0x5944('0x49')][_0x5944('0x33')]);}_0xe7dac0[_0x5944('0x51')]=qs[_0x5944('0x52')](_0x15e945[_0x5944('0x49')][_0x5944('0x52')]);_0xe7dac0[_0x5944('0x53')]=qs[_0x5944('0x4a')](_['pick'](_0x15e945[_0x5944('0x49')],_0x290428[_0x5944('0x4a')]),_0xff1f59);if(_0x15e945[_0x5944('0x49')][_0x5944('0x54')]){_0xe7dac0[_0x5944('0x53')]=_[_0x5944('0x55')](_0xe7dac0[_0x5944('0x53')],{'$or':_['map'](_0xff1f59,function(_0x59fda3){if(_0x59fda3['type']!==_0x5944('0x56')){var _0x2872a1={};_0x2872a1[_0x59fda3[_0x5944('0x3e')]]={'$like':'%'+_0x15e945[_0x5944('0x49')][_0x5944('0x54')]+'%'};return _0x2872a1;}})});}_0xe7dac0=_[_0x5944('0x55')]({},_0xe7dac0,_0x15e945[_0x5944('0x57')]);var _0x3b2ba6={'where':_0xe7dac0[_0x5944('0x53')]};return db[_0x5944('0x58')][_0x5944('0x32')](_0x3b2ba6)['then'](function(_0x3774d6){_0x1b9a8b[_0x5944('0x32')]=_0x3774d6;if(_0x15e945['query'][_0x5944('0x59')]){_0xe7dac0[_0x5944('0x5a')]=[{'all':!![]}];}return db['FaxAccount'][_0x5944('0x5b')](_0xe7dac0);})['then'](function(_0x2621ec){_0x1b9a8b[_0x5944('0x5c')]=_0x2621ec;return _0x1b9a8b;})[_0x5944('0x37')](respondWithFilteredResult(_0x414e7a,_0xe7dac0))[_0x5944('0x2c')](handleError(_0x414e7a,null));};exports[_0x5944('0x5d')]=function(_0x5bf794,_0x5eba48){var _0x2b8d8e={'raw':![],'where':{'id':_0x5bf794[_0x5944('0x5e')]['id']},'include':[{'model':db[_0x5944('0x41')],'as':_0x5944('0x42')}]},_0x1951db={};_0x1951db[_0x5944('0x48')]=_[_0x5944('0x5f')](db[_0x5944('0x58')]['rawAttributes']);_0x1951db[_0x5944('0x49')]=_[_0x5944('0x5f')](_0x5bf794[_0x5944('0x49')]);_0x1951db['filters']=_[_0x5944('0x4b')](_0x1951db[_0x5944('0x48')],_0x1951db[_0x5944('0x49')]);_0x2b8d8e['attributes']=_[_0x5944('0x4b')](_0x1951db[_0x5944('0x48')],qs[_0x5944('0x4d')](_0x5bf794[_0x5944('0x49')][_0x5944('0x4d')]));_0x2b8d8e['attributes']=_0x2b8d8e[_0x5944('0x4c')]['length']?_0x2b8d8e['attributes']:_0x1951db['model'];if(_0x5bf794[_0x5944('0x49')][_0x5944('0x59')]){_0x2b8d8e[_0x5944('0x5a')]=[{'all':!![]}];}_0x2b8d8e=_['merge']({},_0x2b8d8e,_0x5bf794[_0x5944('0x57')]);return db[_0x5944('0x58')][_0x5944('0x60')](_0x2b8d8e)['then'](handleEntityNotFound(_0x5eba48,null))[_0x5944('0x37')](respondWithResult(_0x5eba48,null))[_0x5944('0x2c')](handleError(_0x5eba48,null));};exports[_0x5944('0x61')]=function(_0x97b1a2,_0x5c7666){return db[_0x5944('0x58')][_0x5944('0x61')](_0x97b1a2['body'],{})[_0x5944('0x37')](function(_0x10f458){var _0x374763=_0x97b1a2[_0x5944('0x62')][_0x5944('0x39')]({'plain':!![]});if(!_0x374763)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x374763[_0x5944('0x63')]==='user'){var _0x58798b=_0x10f458['get']({'plain':!![]});var _0x9dd6a2=_0x5944('0x3a');return db[_0x5944('0x64')]['find']({'where':{'name':_0x9dd6a2,'userProfileId':_0x374763['userProfileId']},'raw':!![]})[_0x5944('0x37')](function(_0x31d0bf){if(_0x31d0bf&&_0x31d0bf[_0x5944('0x65')]===0x0){return db[_0x5944('0x3b')][_0x5944('0x61')]({'name':_0x58798b[_0x5944('0x3e')],'resourceId':_0x58798b['id'],'type':_0x31d0bf['name'],'sectionId':_0x31d0bf['id']},{})['then'](function(){return _0x10f458;});}else{return _0x10f458;}})[_0x5944('0x2c')](function(_0x400f93){logger[_0x5944('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x400f93);throw _0x400f93;});}return _0x10f458;})['then'](respondWithResult(_0x5c7666,0xc9))[_0x5944('0x2c')](handleError(_0x5c7666,null));};exports[_0x5944('0x36')]=function(_0x1dc048,_0x2e3467){if(_0x1dc048[_0x5944('0x66')]['id']){delete _0x1dc048[_0x5944('0x66')]['id'];}return db[_0x5944('0x58')][_0x5944('0x60')]({'where':{'id':_0x1dc048[_0x5944('0x5e')]['id']},'include':[{'model':db[_0x5944('0x41')],'as':_0x5944('0x42')}]})['then'](handleEntityNotFound(_0x2e3467,null))[_0x5944('0x37')](saveUpdates(_0x1dc048[_0x5944('0x66')],null))[_0x5944('0x37')](respondWithResult(_0x2e3467,null))[_0x5944('0x2c')](handleError(_0x2e3467,null));};exports[_0x5944('0x38')]=function(_0x500dbe,_0x2ea21b){return db['FaxAccount'][_0x5944('0x60')]({'where':{'id':_0x500dbe[_0x5944('0x5e')]['id']}})[_0x5944('0x37')](handleEntityNotFound(_0x2ea21b,null))[_0x5944('0x37')](removeEntity(_0x2ea21b,null))[_0x5944('0x2c')](handleError(_0x2ea21b,null));};exports[_0x5944('0x67')]=function(_0x7e9318,_0x326e52){return db['FaxAccount'][_0x5944('0x67')]()[_0x5944('0x37')](respondWithResult(_0x326e52,null))[_0x5944('0x2c')](handleError(_0x326e52,null));};exports[_0x5944('0x68')]=function(_0x34f25f,_0x39994c,_0x1aeff1){if(_0x34f25f[_0x5944('0x66')]['id']){delete _0x34f25f[_0x5944('0x66')]['id'];}return db['FaxAccount'][_0x5944('0x60')]({'where':{'id':_0x34f25f['params']['id']}})[_0x5944('0x37')](handleEntityNotFound(_0x39994c,null))[_0x5944('0x37')](function(_0x4e85a7){if(_0x4e85a7){_0x34f25f[_0x5944('0x66')][_0x5944('0x69')]=_0x4e85a7['id'];return db['Disposition'][_0x5944('0x61')](_0x34f25f[_0x5944('0x66')]);}})[_0x5944('0x37')](respondWithResult(_0x39994c,null))[_0x5944('0x2c')](handleError(_0x39994c,null));};exports['getDispositions']=function(_0x1d17a4,_0x1924db,_0x3671d5){var _0x485c53={'raw':![],'where':{}};var _0x9424a8={};var _0x1acda7={'count':0x0,'rows':[]};return db[_0x5944('0x58')][_0x5944('0x6a')]({'where':{'id':_0x1d17a4[_0x5944('0x5e')]['id']}})[_0x5944('0x37')](handleEntityNotFound(_0x1924db,null))[_0x5944('0x37')](function(_0x1ecdc3){if(_0x1ecdc3){_0x9424a8[_0x5944('0x48')]=_[_0x5944('0x5f')](db[_0x5944('0x6b')][_0x5944('0x44')]);_0x9424a8[_0x5944('0x49')]=_[_0x5944('0x5f')](_0x1d17a4['query']);_0x9424a8[_0x5944('0x4a')]=_[_0x5944('0x4b')](_0x9424a8['model'],_0x9424a8[_0x5944('0x49')]);_0x485c53[_0x5944('0x4c')]=_[_0x5944('0x4b')](_0x9424a8[_0x5944('0x48')],qs[_0x5944('0x4d')](_0x1d17a4[_0x5944('0x49')]['fields']));_0x485c53[_0x5944('0x4c')]=_0x485c53[_0x5944('0x4c')]['length']?_0x485c53['attributes']:_0x9424a8['model'];if(!_0x1d17a4['query'][_0x5944('0x4f')]('nolimit')){_0x485c53[_0x5944('0x30')]=qs[_0x5944('0x30')](_0x1d17a4[_0x5944('0x49')][_0x5944('0x30')]);_0x485c53[_0x5944('0x33')]=qs[_0x5944('0x33')](_0x1d17a4[_0x5944('0x49')][_0x5944('0x33')]);}_0x485c53[_0x5944('0x51')]=qs[_0x5944('0x52')](_0x1d17a4[_0x5944('0x49')][_0x5944('0x52')]);_0x485c53[_0x5944('0x53')]=qs['filters'](_[_0x5944('0x6c')](_0x1d17a4[_0x5944('0x49')],_0x9424a8[_0x5944('0x4a')]));_0x485c53[_0x5944('0x53')][_0x5944('0x69')]=_0x1ecdc3['id'];if(_0x1d17a4[_0x5944('0x49')][_0x5944('0x54')]){_0x485c53['where']=_['merge'](_0x485c53[_0x5944('0x53')],{'$or':_[_0x5944('0x43')](_0x485c53[_0x5944('0x4c')],function(_0x512948){var _0x9d352f={};_0x9d352f[_0x512948]={'$like':'%'+_0x1d17a4[_0x5944('0x49')][_0x5944('0x54')]+'%'};return _0x9d352f;})});}_0x485c53=_[_0x5944('0x55')]({},_0x485c53,_0x1d17a4[_0x5944('0x57')]);return db[_0x5944('0x6b')][_0x5944('0x32')]({'where':_0x485c53[_0x5944('0x53')]})[_0x5944('0x37')](function(_0x2d6ead){_0x1acda7[_0x5944('0x32')]=_0x2d6ead;if(_0x1d17a4[_0x5944('0x49')][_0x5944('0x59')]){_0x485c53['include']=[{'all':!![]}];}return db['Disposition'][_0x5944('0x5b')](_0x485c53);})['then'](function(_0x5e260a){_0x1acda7['rows']=_0x5e260a;return _0x1acda7;});}})[_0x5944('0x37')](respondWithFilteredResult(_0x1924db,_0x485c53))['catch'](handleError(_0x1924db,null));};exports['removeDispositions']=function(_0xbdf83f,_0x2b0b56,_0x30a222){return db['FaxAccount'][_0x5944('0x60')]({'where':{'id':_0xbdf83f[_0x5944('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2b0b56,null))[_0x5944('0x37')](function(_0x2d5264){if(_0x2d5264){return _0x2d5264[_0x5944('0x6d')](_0xbdf83f[_0x5944('0x49')][_0x5944('0x6e')]);}})[_0x5944('0x37')](respondWithStatusCode(_0x2b0b56,null))[_0x5944('0x2c')](handleError(_0x2b0b56,null));};exports[_0x5944('0x6f')]=function(_0x516921,_0x12970e,_0x34f8f9){if(_0x516921[_0x5944('0x66')]['id']){delete _0x516921[_0x5944('0x66')]['id'];}return db['FaxAccount'][_0x5944('0x60')]({'where':{'id':_0x516921[_0x5944('0x5e')]['id']}})[_0x5944('0x37')](handleEntityNotFound(_0x12970e,null))[_0x5944('0x37')](function(_0x561279){if(_0x561279){_0x516921[_0x5944('0x66')][_0x5944('0x69')]=_0x561279['id'];return db[_0x5944('0x70')][_0x5944('0x61')](_0x516921[_0x5944('0x66')]);}})['then'](respondWithResult(_0x12970e,null))[_0x5944('0x2c')](handleError(_0x12970e,null));};exports[_0x5944('0x71')]=function(_0x3f41a6,_0x3d95ea,_0x181020){var _0x5f5920={'raw':![],'where':{}};var _0x5e73b0={};var _0x255ddb={'count':0x0,'rows':[]};return db[_0x5944('0x58')][_0x5944('0x6a')]({'where':{'id':_0x3f41a6[_0x5944('0x5e')]['id']}})[_0x5944('0x37')](handleEntityNotFound(_0x3d95ea,null))[_0x5944('0x37')](function(_0x386dcb){if(_0x386dcb){_0x5e73b0[_0x5944('0x48')]=_[_0x5944('0x5f')](db[_0x5944('0x70')]['rawAttributes']);_0x5e73b0[_0x5944('0x49')]=_[_0x5944('0x5f')](_0x3f41a6[_0x5944('0x49')]);_0x5e73b0[_0x5944('0x4a')]=_[_0x5944('0x4b')](_0x5e73b0['model'],_0x5e73b0[_0x5944('0x49')]);_0x5f5920[_0x5944('0x4c')]=_['intersection'](_0x5e73b0[_0x5944('0x48')],qs['fields'](_0x3f41a6['query'][_0x5944('0x4d')]));_0x5f5920[_0x5944('0x4c')]=_0x5f5920[_0x5944('0x4c')][_0x5944('0x4e')]?_0x5f5920['attributes']:_0x5e73b0['model'];if(!_0x3f41a6[_0x5944('0x49')][_0x5944('0x4f')]('nolimit')){_0x5f5920[_0x5944('0x30')]=qs['limit'](_0x3f41a6[_0x5944('0x49')][_0x5944('0x30')]);_0x5f5920['offset']=qs[_0x5944('0x33')](_0x3f41a6[_0x5944('0x49')][_0x5944('0x33')]);}_0x5f5920[_0x5944('0x51')]=qs[_0x5944('0x52')](_0x3f41a6[_0x5944('0x49')][_0x5944('0x52')]);_0x5f5920[_0x5944('0x53')]=qs[_0x5944('0x4a')](_['pick'](_0x3f41a6[_0x5944('0x49')],_0x5e73b0[_0x5944('0x4a')]));_0x5f5920[_0x5944('0x53')][_0x5944('0x69')]=_0x386dcb['id'];if(_0x3f41a6['query'][_0x5944('0x54')]){_0x5f5920['where']=_[_0x5944('0x55')](_0x5f5920['where'],{'$or':_[_0x5944('0x43')](_0x5f5920[_0x5944('0x4c')],function(_0x22c0bd){var _0x110921={};_0x110921[_0x22c0bd]={'$like':'%'+_0x3f41a6[_0x5944('0x49')]['filter']+'%'};return _0x110921;})});}_0x5f5920=_[_0x5944('0x55')]({},_0x5f5920,_0x3f41a6['options']);return db['CannedAnswer']['count']({'where':_0x5f5920[_0x5944('0x53')]})[_0x5944('0x37')](function(_0x2914a4){_0x255ddb[_0x5944('0x32')]=_0x2914a4;if(_0x3f41a6[_0x5944('0x49')][_0x5944('0x59')]){_0x5f5920[_0x5944('0x5a')]=[{'all':!![]}];}return db[_0x5944('0x70')][_0x5944('0x5b')](_0x5f5920);})[_0x5944('0x37')](function(_0x19952e){_0x255ddb[_0x5944('0x5c')]=_0x19952e;return _0x255ddb;});}})[_0x5944('0x37')](respondWithFilteredResult(_0x3d95ea,_0x5f5920))['catch'](handleError(_0x3d95ea,null));};exports['removeAnswers']=function(_0x198e70,_0x1f2909,_0x337c01){return db[_0x5944('0x58')][_0x5944('0x60')]({'where':{'id':_0x198e70[_0x5944('0x5e')]['id']}})[_0x5944('0x37')](handleEntityNotFound(_0x1f2909,null))[_0x5944('0x37')](function(_0x4807cd){if(_0x4807cd){return _0x4807cd['removeAnswers'](_0x198e70[_0x5944('0x49')][_0x5944('0x6e')]);}})[_0x5944('0x37')](respondWithStatusCode(_0x1f2909,null))['catch'](handleError(_0x1f2909,null));};exports[_0x5944('0x72')]=function(_0x1a3191,_0x41d4e6,_0x1eed83){return db[_0x5944('0x73')][_0x5944('0x60')]({'where':{'id':_0x1a3191[_0x5944('0x5e')]['id']}})['then'](handleEntityNotFound(_0x41d4e6,null))[_0x5944('0x37')](function(_0x3c0b75){if(_0x3c0b75){return _0x3c0b75[_0x5944('0x72')](_0x1a3191['body']['ids'],_['omit'](_0x1a3191['body'],[_0x5944('0x6e'),'id'])||{});}})[_0x5944('0x37')](respondWithResult(_0x41d4e6,null))[_0x5944('0x2c')](handleError(_0x41d4e6,null));};exports[_0x5944('0x74')]=function(_0x30ad37,_0x9ed75c,_0x1d3412){var _0x3ef130={'raw':![],'where':{}};var _0x512f69={};var _0x3d6a0f={'count':0x0,'rows':[]};return db[_0x5944('0x58')][_0x5944('0x6a')]({'where':{'id':_0x30ad37[_0x5944('0x5e')]['id']}})[_0x5944('0x37')](handleEntityNotFound(_0x9ed75c,null))[_0x5944('0x37')](function(_0x15fe12){if(_0x15fe12){_0x512f69[_0x5944('0x48')]=_['keys'](db[_0x5944('0x73')][_0x5944('0x44')]);_0x512f69[_0x5944('0x49')]=_[_0x5944('0x5f')](_0x30ad37[_0x5944('0x49')]);_0x512f69['filters']=_[_0x5944('0x4b')](_0x512f69[_0x5944('0x48')],_0x512f69[_0x5944('0x49')]);_0x3ef130['attributes']=_['intersection'](_0x512f69['model'],qs[_0x5944('0x4d')](_0x30ad37[_0x5944('0x49')]['fields']));_0x3ef130[_0x5944('0x4c')]=_0x3ef130[_0x5944('0x4c')]['length']?_0x3ef130['attributes']:_0x512f69[_0x5944('0x48')];if(!_0x30ad37['query'][_0x5944('0x4f')](_0x5944('0x50'))){_0x3ef130[_0x5944('0x30')]=qs[_0x5944('0x30')](_0x30ad37[_0x5944('0x49')][_0x5944('0x30')]);_0x3ef130[_0x5944('0x33')]=qs[_0x5944('0x33')](_0x30ad37[_0x5944('0x49')][_0x5944('0x33')]);}_0x3ef130[_0x5944('0x51')]=qs['sort'](_0x30ad37[_0x5944('0x49')][_0x5944('0x52')]);_0x3ef130['where']=qs[_0x5944('0x4a')](_['pick'](_0x30ad37[_0x5944('0x49')],_0x512f69[_0x5944('0x4a')]));_0x3ef130['where'][_0x5944('0x69')]=_0x15fe12['id'];if(_0x30ad37[_0x5944('0x49')]['filter']){_0x3ef130['where']=_[_0x5944('0x55')](_0x3ef130[_0x5944('0x53')],{'$or':_[_0x5944('0x43')](_0x3ef130[_0x5944('0x4c')],function(_0x317ae7){var _0x564d66={};_0x564d66[_0x317ae7]={'$like':'%'+_0x30ad37[_0x5944('0x49')][_0x5944('0x54')]+'%'};return _0x564d66;})});}_0x3ef130=_[_0x5944('0x55')]({},_0x3ef130,_0x30ad37['options']);return db['FaxInteraction'][_0x5944('0x32')]({'where':_0x3ef130[_0x5944('0x53')]})[_0x5944('0x37')](function(_0x23bf0d){_0x3d6a0f[_0x5944('0x32')]=_0x23bf0d;if(_0x30ad37[_0x5944('0x49')][_0x5944('0x59')]){_0x3ef130[_0x5944('0x5a')]=[{'model':db[_0x5944('0x75')],'as':'Contact','required':![]},{'model':db[_0x5944('0x76')],'as':_0x5944('0x77'),'attributes':[_0x5944('0x3e'),_0x5944('0x78'),_0x5944('0x79')],'required':![]},{'model':db['Tag'],'as':_0x5944('0x7a'),'attributes':['id','name','color'],'where':_0x30ad37[_0x5944('0x49')][_0x5944('0x7b')]?{'id':_0x30ad37[_0x5944('0x49')][_0x5944('0x7b')]}:undefined,'required':_0x30ad37[_0x5944('0x49')][_0x5944('0x7b')]?!![]:![]}];}return db[_0x5944('0x73')][_0x5944('0x5b')](_0x3ef130);})[_0x5944('0x37')](function(_0x13afd7){_0x3d6a0f[_0x5944('0x5c')]=_0x13afd7;return _0x3d6a0f;});}})[_0x5944('0x37')](respondWithFilteredResult(_0x9ed75c,_0x3ef130))['catch'](handleError(_0x9ed75c,null));};exports['addApplications']=function(_0x53ed4f,_0x54c9cd){var _0x4ab021=_0x53ed4f['params']['id'];var _0x3ef3bc=_0x53ed4f[_0x5944('0x66')];var _0x4bd731=0xc8;var _0x2a6a7f=null;return db[_0x5944('0x7c')][_0x5944('0x7d')]({'isolationLevel':db[_0x5944('0x7c')][_0x5944('0x7e')][_0x5944('0x7f')]['READ_COMMITTED']},function(_0x4f76c1){return db[_0x5944('0x58')]['findOne']({'where':{'id':_0x4ab021},'transaction':_0x4f76c1})[_0x5944('0x37')](function(_0x28eda8){if(_0x28eda8){return db[_0x5944('0x80')]['destroy']({'where':{'FaxAccountId':_0x4ab021},'transaction':_0x4f76c1})[_0x5944('0x37')](function(){var _0x506ace=_['map'](_0x3ef3bc,function(_0x39310e){_0x39310e['FaxAccountId']=_0x4ab021;return _0x39310e;});return db['FaxApplication']['bulkCreate'](_0x506ace,{'transaction':_0x4f76c1});});}else{_0x4bd731=0x194;_0x2a6a7f=[];}});})[_0x5944('0x37')](function(){if(_0x4bd731!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x4ab021},'order':_0x5944('0x81')})[_0x5944('0x37')](function(_0x4de26b){_0x2a6a7f=_0x4de26b;});}})[_0x5944('0x2c')](function(_0x4333d3){_0x4bd731=0x1f4;logger[_0x5944('0x27')](_0x4333d3[_0x5944('0x3d')]);if(_0x4333d3[_0x5944('0x3e')]){delete _0x4333d3[_0x5944('0x3e')];}_0x2a6a7f=_0x4333d3;})[_0x5944('0x82')](function(){if(_0x2a6a7f===null){_0x54c9cd[_0x5944('0x3c')](_0x4bd731);}else{if(_0x4bd731===0x1f4){_0x54c9cd[_0x5944('0x2d')](_0x4bd731)['send'](_0x2a6a7f);}else{_0x54c9cd[_0x5944('0x2d')](_0x4bd731)[_0x5944('0x2f')](_0x2a6a7f);}}});};exports[_0x5944('0x83')]=function(_0x4eaabc,_0x31e2b0,_0x152cfa){var _0x4431fc={};var _0x25f26d={};var _0x4b8c83;var _0x44b73a;return db[_0x5944('0x58')][_0x5944('0x6a')]({'where':{'id':_0x4eaabc[_0x5944('0x5e')]['id']}})[_0x5944('0x37')](handleEntityNotFound(_0x31e2b0,null))[_0x5944('0x37')](function(_0x4c715f){if(_0x4c715f){_0x4b8c83=_0x4c715f;_0x25f26d[_0x5944('0x48')]=_[_0x5944('0x5f')](db[_0x5944('0x80')][_0x5944('0x44')]);_0x25f26d[_0x5944('0x49')]=_[_0x5944('0x5f')](_0x4eaabc[_0x5944('0x49')]);_0x25f26d['filters']=_[_0x5944('0x4b')](_0x25f26d[_0x5944('0x48')],_0x25f26d[_0x5944('0x49')]);_0x4431fc['attributes']=_['intersection'](_0x25f26d['model'],qs[_0x5944('0x4d')](_0x4eaabc[_0x5944('0x49')][_0x5944('0x4d')]));_0x4431fc['attributes']=_0x4431fc[_0x5944('0x4c')][_0x5944('0x4e')]?_0x4431fc[_0x5944('0x4c')]:_0x25f26d[_0x5944('0x48')];_0x4431fc[_0x5944('0x51')]=qs['sort'](_0x4eaabc[_0x5944('0x49')]['sort']);_0x4431fc[_0x5944('0x53')]=qs[_0x5944('0x4a')](_[_0x5944('0x6c')](_0x4eaabc[_0x5944('0x49')],_0x25f26d[_0x5944('0x4a')]));if(_0x4eaabc[_0x5944('0x49')][_0x5944('0x54')]){_0x4431fc[_0x5944('0x53')]=_[_0x5944('0x55')](_0x4431fc[_0x5944('0x53')],{'$or':_[_0x5944('0x43')](_0x4431fc[_0x5944('0x4c')],function(_0x4c0104){var _0x2fa928={};_0x2fa928[_0x4c0104]={'$like':'%'+_0x4eaabc['query']['filter']+'%'};return _0x2fa928;})});}_0x4431fc=_[_0x5944('0x55')]({},_0x4431fc,_0x4eaabc[_0x5944('0x57')]);return _0x4b8c83[_0x5944('0x83')](_0x4431fc);}})[_0x5944('0x37')](function(_0x3dea83){if(_0x3dea83){_0x44b73a=_0x3dea83[_0x5944('0x4e')];if(!_0x4eaabc[_0x5944('0x49')][_0x5944('0x4f')](_0x5944('0x50'))){_0x4431fc[_0x5944('0x30')]=qs[_0x5944('0x30')](_0x4eaabc[_0x5944('0x49')][_0x5944('0x30')]);_0x4431fc['offset']=qs[_0x5944('0x33')](_0x4eaabc[_0x5944('0x49')][_0x5944('0x33')]);}return _0x4b8c83[_0x5944('0x83')](_0x4431fc);}})['then'](function(_0x5d0fca){if(_0x5d0fca){return _0x5d0fca?{'count':_0x44b73a,'rows':_0x5d0fca}:null;}})[_0x5944('0x37')](respondWithResult(_0x31e2b0,null))['catch'](handleError(_0x31e2b0,null));};function Extension(_0x260a74,_0x5c617f,_0x5684ca,_0x5d8aa5){this['context']=_0x5944('0x84');this[_0x5944('0x85')]=_0x260a74['localstationid'];this[_0x5944('0x86')]=_0x5d8aa5;this[_0x5944('0x46')]=_0x5944('0x87');this['description']='Fax\x20Extension';this[_0x5944('0x69')]=_0x260a74['id'];this['priority']=_0x5c617f;this['appdata']=_0x5684ca;}function createExtensionsReciveFax(_0x28263f){var _0x3c39b6=0x1;var _0x35e1cf=[];_0x35e1cf[_0x5944('0x88')](new Extension(_0x28263f,_0x3c39b6,'',_0x5944('0x89')));_0x3c39b6+=0x1;_0x35e1cf[_0x5944('0x88')](new Extension(_0x28263f,_0x3c39b6,_0x5944('0x8a'),'Set'));_0x3c39b6+=0x1;for(var _0x3c5cca in _0x28263f){if(_0x28263f['hasOwnProperty'](_0x3c5cca)&&(_0x3c5cca===_0x5944('0x8b')||_0x3c5cca===_0x5944('0x8c')||_0x3c5cca==='gateway'||_0x3c5cca===_0x5944('0x8d')||_0x3c5cca===_0x5944('0x8e')||_0x3c5cca===_0x5944('0x8f')||_0x3c5cca===_0x5944('0x90')||_0x3c5cca===_0x5944('0x91')||_0x3c5cca==='t38timeout')){_0x35e1cf[_0x5944('0x88')](new Extension(_0x28263f,_0x3c39b6,_0x5944('0x92')+_0x3c5cca+')='+_0x28263f[_0x3c5cca],_0x5944('0x93')));_0x3c39b6+=0x1;}}_0x35e1cf[_0x5944('0x88')](new Extension(_0x28263f,_0x3c39b6,'6',_0x5944('0x94')));_0x3c39b6+=0x1;_0x35e1cf[_0x5944('0x88')](new Extension(_0x28263f,_0x3c39b6,'/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'));_0x3c39b6=0x0;return _0x35e1cf;}exports[_0x5944('0x95')]=function(_0x102b17,_0x2ed908,_0x5690fe){var _0x485223;return db[_0x5944('0x7c')][_0x5944('0x7d')](function(_0x225206){return db['FaxAccount'][_0x5944('0x61')](_0x102b17[_0x5944('0x66')],{'transaction':_0x225206})[_0x5944('0x37')](function(_0x55fd4c){_0x485223=_0x55fd4c[_0x5944('0x39')]({'plain':!![]});return db[_0x5944('0x96')]['bulkCreate'](createExtensionsReciveFax(_0x485223),{'transaction':_0x225206});});})[_0x5944('0x37')](function(){return _0x485223;})['then'](respondWithResult(_0x2ed908,null))[_0x5944('0x2c')](handleError(_0x2ed908,null));};exports['updateAccountApplications']=function(_0x4e7b8b,_0x3b0f1e,_0xbb0b7c){var _0xc3aa8;return db[_0x5944('0x7c')]['transaction'](function(_0x3af8ad){return db[_0x5944('0x58')][_0x5944('0x36')](_0x4e7b8b[_0x5944('0x66')],{'where':{'id':_0x4e7b8b[_0x5944('0x66')]['id']},'transaction':_0x3af8ad})['then'](function(_0xa404aa){return db[_0x5944('0x96')][_0x5944('0x38')]({'where':{'FaxAccountId':_0x4e7b8b[_0x5944('0x66')]['id']},'transaction':_0x3af8ad})[_0x5944('0x37')](function(_0x2e1c8f){return db['VoiceExtension'][_0x5944('0x97')](createExtensionsReciveFax(_[_0x5944('0x98')](_0x4e7b8b[_0x5944('0x66')],[_0x5944('0x99'),_0x5944('0x47'),_0x5944('0x9a'),_0x5944('0x9b'),_0x5944('0x9c'),_0x5944('0x9d')])),{'transaction':_0x3af8ad});});});})['then'](function(){return db['FaxAccount']['findById'](_0x4e7b8b['body']['id']);})[_0x5944('0x37')](respondWithResult(_0x3b0f1e,null))[_0x5944('0x2c')](handleError(_0x3b0f1e,null));};exports[_0x5944('0x9e')]=function(_0x25420a,_0x126a94,_0x3b29ff){var _0x38c627={'raw':!![],'where':{}};var _0x504ae9={};var _0x2ed96b={'count':0x0,'rows':[]};return db[_0x5944('0x58')]['findOne']({'where':{'id':_0x25420a['params']['id']}})[_0x5944('0x37')](handleEntityNotFound(_0x126a94,null))['then'](function(_0x3ed939){if(_0x3ed939){_0x504ae9[_0x5944('0x48')]=_['keys'](db[_0x5944('0x9f')][_0x5944('0x44')]);_0x504ae9[_0x5944('0x49')]=_[_0x5944('0x5f')](_0x25420a['query']);_0x504ae9['filters']=_[_0x5944('0x4b')](_0x504ae9['model'],_0x504ae9[_0x5944('0x49')]);_0x38c627['attributes']=_[_0x5944('0x4b')](_0x504ae9[_0x5944('0x48')],qs['fields'](_0x25420a['query'][_0x5944('0x4d')]));_0x38c627['attributes']=_0x38c627[_0x5944('0x4c')][_0x5944('0x4e')]?_0x38c627[_0x5944('0x4c')]:_0x504ae9[_0x5944('0x48')];if(!_0x25420a[_0x5944('0x49')][_0x5944('0x4f')](_0x5944('0x50'))){_0x38c627['limit']=qs[_0x5944('0x30')](_0x25420a['query'][_0x5944('0x30')]);_0x38c627[_0x5944('0x33')]=qs[_0x5944('0x33')](_0x25420a[_0x5944('0x49')][_0x5944('0x33')]);}_0x38c627[_0x5944('0x51')]=qs[_0x5944('0x52')](_0x25420a['query'][_0x5944('0x52')]);_0x38c627[_0x5944('0x53')]=qs[_0x5944('0x4a')](_[_0x5944('0x6c')](_0x25420a[_0x5944('0x49')],_0x504ae9[_0x5944('0x4a')]));_0x38c627[_0x5944('0x53')][_0x5944('0x69')]=_0x3ed939['id'];if(_0x25420a[_0x5944('0x49')][_0x5944('0x54')]){_0x38c627[_0x5944('0x53')]=_['merge'](_0x38c627[_0x5944('0x53')],{'$or':_[_0x5944('0x43')](_0x38c627[_0x5944('0x4c')],function(_0x4134c4){var _0x2737f4={};_0x2737f4[_0x4134c4]={'$like':'%'+_0x25420a['query'][_0x5944('0x54')]+'%'};return _0x2737f4;})});}if(_0x25420a[_0x5944('0x49')][_0x5944('0xa0')]){var _0x4a6afa=_0x25420a['query']['$gte'][_0x5944('0xa1')](',');var _0xbb6c95={};_0xbb6c95[_0x4a6afa[0x0]]={'$gte':moment(_0x4a6afa[0x1])[_0x5944('0xa2')](_0x5944('0xa3'))};_0x38c627['where']=_['merge'](_0x38c627['where'],_0xbb6c95);}_0x38c627=_[_0x5944('0x55')]({},_0x38c627,_0x25420a[_0x5944('0x57')]);return db[_0x5944('0x9f')]['count']({'where':_0x38c627[_0x5944('0x53')]})[_0x5944('0x37')](function(_0x1aba4e){_0x2ed96b[_0x5944('0x32')]=_0x1aba4e;if(_0x25420a[_0x5944('0x49')][_0x5944('0x59')]){_0x38c627[_0x5944('0x5a')]=[{'all':!![]}];}return db[_0x5944('0x9f')][_0x5944('0x5b')](_0x38c627);})['then'](function(_0x25ecb6){_0x2ed96b[_0x5944('0x5c')]=_0x25ecb6;return _0x2ed96b;});}})[_0x5944('0x37')](respondWithFilteredResult(_0x126a94,_0x38c627))[_0x5944('0x2c')](handleError(_0x126a94,null));};exports['send']=function(_0x551856,_0x2e1fb6,_0x108edd){var _0x3c6d3a,_0x1b5aa7={},_0x121d41;if(_0x551856[_0x5944('0x66')]['to']){_0x121d41=_0x551856[_0x5944('0x66')]['to'][0x0];}return db[_0x5944('0x58')][_0x5944('0x60')]({'where':{'id':_0x551856[_0x5944('0x5e')]['id']},'include':[{'model':db[_0x5944('0xa4')],'as':'List','include':[{'model':db[_0x5944('0x75')],'as':'Contacts','where':{'fax':_0x121d41},'limit':0x1,'order':[[_0x5944('0x9b'),'DESC']]}]}]})[_0x5944('0x37')](handleEntityNotFound(_0x2e1fb6,null))['then'](function(_0x5bef54){_0x3c6d3a=_0x5bef54;if(_0x551856[_0x5944('0x66')][_0x5944('0xa5')]&&_0x551856[_0x5944('0x66')][_0x5944('0xa5')][_0x5944('0x4e')]){for(var _0x5ea850=0x0;_0x5ea850<_0x551856[_0x5944('0x66')]['attachments'][_0x5944('0x4e')];_0x5ea850+=0x1){_0x551856[_0x5944('0x66')][_0x5944('0xa5')][_0x5ea850]={'filename':_0x551856[_0x5944('0x66')][_0x5944('0xa5')][_0x5ea850][_0x5944('0x3e')],'id':_0x551856[_0x5944('0x66')][_0x5944('0xa5')][_0x5ea850]['id'],'path':path[_0x5944('0xa6')](config[_0x5944('0xa7')],_0x5944('0xa8'),_0x551856[_0x5944('0x66')][_0x5944('0xa5')][_0x5ea850][_0x5944('0xa9')])};}}return respondWithRpcPromise(_0x5944('0xaa'),_0x5944('0xaa'),{'FaxAccountId':_[_0x5944('0xab')](_0x551856[_0x5944('0x5e')]['id'])?undefined:_0x551856[_0x5944('0x5e')]['id'],'path':_['isNil'](_0x551856[_0x5944('0x66')]['attachments'][0x0]['path'])?undefined:_0x551856['body'][_0x5944('0xa5')][0x0][_0x5944('0x9')],'fax':_[_0x5944('0xab')](_0x551856[_0x5944('0x66')]['to'][0x0])?undefined:_0x551856[_0x5944('0x66')]['to'][0x0]},client9002);})[_0x5944('0x37')](function(){if(_0x3c6d3a){if(_[_0x5944('0xab')](_0x551856[_0x5944('0x66')][_0x5944('0xac')])){_0x551856[_0x5944('0x66')]['from']=util[_0x5944('0xa2')](_0x5944('0xad'),_0x3c6d3a[_0x5944('0x3e')],_0x3c6d3a[_0x5944('0xae')]);}if(_0x3c6d3a[_0x5944('0xaf')]){if(_0x3c6d3a[_0x5944('0xaf')][_0x5944('0xb0')][_0x5944('0x4e')]){return _0x3c6d3a['List']['Contacts'][0x0];}else{return db[_0x5944('0x75')][_0x5944('0x61')](_[_0x5944('0x1c')](_0x551856[_0x5944('0x66')],{'firstName':_0x551856['body']['to'][0x0],'phone':_0x551856[_0x5944('0x66')]['to'][0x0],'fax':_0x551856[_0x5944('0x66')]['to'][0x0],'ListId':_0x3c6d3a[_0x5944('0x9d')]}));}}else{throw new Error(_0x5944('0xb1'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x5b0be6){if(_0x5b0be6){return db[_0x5944('0x73')][_0x5944('0x60')]({'where':{'ContactId':_0x5b0be6['id'],'closed':![],'FaxAccountId':_0x3c6d3a['id']}})['then'](function(_0x5c5fe3){if(_0x5c5fe3){return[_0x5c5fe3,![]];}return db[_0x5944('0x73')]['create']({'UserId':_0x551856[_0x5944('0x62')]['id'],'ContactId':_0x5b0be6['id'],'FaxAccountId':_0x3c6d3a['id'],'fax':_0x551856[_0x5944('0x66')]['to'][0x0],'firstMsgDirection':_0x5944('0xb2'),'Messages':[_[_0x5944('0x55')](_0x551856[_0x5944('0x66')],{'read':![],'body':_0x551856['body'][_0x5944('0xa5')][0x0]['filename'],'FaxAccountId':_0x3c6d3a['id'],'UserId':_0x551856['user']['id'],'ContactId':_0x5b0be6['id'],'AttachmentId':_0x551856[_0x5944('0x66')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0x5944('0x37')](function(_0x18a235){return[_0x18a235,!![]];});});}else{throw new Error(_0x5944('0xb3'));}})[_0x5944('0xb4')](function(_0x324244,_0x2196f1){if(_0x2196f1){return _0x324244;}return db[_0x5944('0x9f')]['create']({'direction':'out','read':![],'body':_0x551856[_0x5944('0x66')][_0x5944('0xa5')][0x0]['filename'],'FaxAccountId':_0x3c6d3a['id'],'FaxInteractionId':_0x324244['id'],'UserId':_0x551856['user']['id'],'ContactId':_0x324244[_0x5944('0xb5')],'AttachmentId':_0x551856['body']['attachments'][0x0]['id']})['then'](function(_0xb4ba40){_0x324244[_0x5944('0xb6')]['Messages']=[];_0x324244[_0x5944('0xb6')][_0x5944('0xb7')][_0x5944('0x88')](_0xb4ba40[_0x5944('0xb6')]);return _0x324244;});})[_0x5944('0x37')](function(_0x36a965){respondWithRpcPromise(_0x5944('0xb8'),_0x5944('0xb8'),{'FaxAccountId':_[_0x5944('0xab')](_0x551856[_0x5944('0x5e')]['id'])?undefined:_0x551856[_0x5944('0x5e')]['id'],'path':_[_0x5944('0xab')](_0x551856[_0x5944('0x66')][_0x5944('0xa5')][0x0][_0x5944('0x9')])?undefined:_0x551856[_0x5944('0x66')][_0x5944('0xa5')][0x0][_0x5944('0x9')],'fax':_[_0x5944('0xab')](_0x551856[_0x5944('0x66')]['to'][0x0])?undefined:_0x551856[_0x5944('0x66')]['to'][0x0],'AttachmentId':_0x551856[_0x5944('0x66')][_0x5944('0xa5')][0x0]['id']},client9002)[_0x5944('0x37')](function(_0x2dd8ee){logger[_0x5944('0x2a')](_0x5944('0xb9'),_0x2dd8ee);})[_0x5944('0x2c')](function(_0x4e59a6){logger[_0x5944('0x2a')]('SendFaxRpc,\x20%s',_0x4e59a6);});return _0x36a965;})[_0x5944('0x37')](respondWithResult(_0x2e1fb6,null))['catch'](handleError(_0x2e1fb6,null));};exports[_0x5944('0xba')]=function(_0x456fda,_0x34ec12,_0x344647){return db['FaxAccount'][_0x5944('0x60')]({'where':{'id':_0x456fda[_0x5944('0x5e')]['id']}})[_0x5944('0x37')](handleEntityNotFound(_0x34ec12,null))[_0x5944('0x37')](function(_0x12ef8e){if(_0x12ef8e){return _0x12ef8e[_0x5944('0xba')](_0x456fda['body']['ids'],_[_0x5944('0x98')](_0x456fda[_0x5944('0x66')],['ids','id'])||{})[_0x5944('0xb4')](function(_0x1cd1f3){for(var _0x51bc5d=0x0;_0x51bc5d<_0x456fda[_0x5944('0x66')][_0x5944('0x6e')][_0x5944('0x4e')];_0x51bc5d+=0x1){socket['emit'](_0x5944('0xbb'),{'UserId':Number(_0x456fda[_0x5944('0x66')][_0x5944('0x6e')][_0x51bc5d]),'FaxAccountId':Number(_0x456fda[_0x5944('0x5e')]['id'])});}return _0x1cd1f3;});}})['then'](respondWithResult(_0x34ec12,null))[_0x5944('0x2c')](handleError(_0x34ec12,null));};exports[_0x5944('0xbc')]=function(_0x5f32ad,_0x4e070b,_0x33961d){return db[_0x5944('0x58')][_0x5944('0x60')]({'where':{'id':_0x5f32ad[_0x5944('0x5e')]['id']}})[_0x5944('0x37')](handleEntityNotFound(_0x4e070b,null))[_0x5944('0x37')](function(_0x1f69bb){if(_0x1f69bb){return _0x1f69bb[_0x5944('0xbc')](_0x5f32ad[_0x5944('0x49')]['ids'])[_0x5944('0x37')](function(){if(_['isArray'](_0x5f32ad[_0x5944('0x49')][_0x5944('0x6e')])){for(var _0x392e83=0x0;_0x392e83<_0x5f32ad[_0x5944('0x49')][_0x5944('0x6e')]['length'];_0x392e83+=0x1){socket['emit'](_0x5944('0xbd'),{'UserId':Number(_0x5f32ad['query'][_0x5944('0x6e')][_0x392e83]),'FaxAccountId':Number(_0x5f32ad[_0x5944('0x5e')]['id'])});}}else{socket[_0x5944('0xbe')](_0x5944('0xbd'),{'UserId':Number(_0x5f32ad[_0x5944('0x49')][_0x5944('0x6e')]),'FaxAccountId':Number(_0x5f32ad[_0x5944('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x4e070b,null))[_0x5944('0x2c')](handleError(_0x4e070b,null));};exports[_0x5944('0xbf')]=function(_0xc340b8,_0x864c1,_0x125740){var _0x3c7088={};var _0x5cfa42={};var _0x4e0a37;var _0x1cc4ae;return db[_0x5944('0x58')]['findOne']({'where':{'id':_0xc340b8[_0x5944('0x5e')]['id']}})[_0x5944('0x37')](handleEntityNotFound(_0x864c1,null))[_0x5944('0x37')](function(_0xeb8449){if(_0xeb8449){_0x4e0a37=_0xeb8449;_0x5cfa42[_0x5944('0x48')]=_['keys'](db[_0x5944('0x76')][_0x5944('0x44')]);_0x5cfa42[_0x5944('0x49')]=_[_0x5944('0x5f')](_0xc340b8[_0x5944('0x49')]);_0x5cfa42[_0x5944('0x4a')]=_[_0x5944('0x4b')](_0x5cfa42[_0x5944('0x48')],_0x5cfa42[_0x5944('0x49')]);_0x3c7088[_0x5944('0x4c')]=_[_0x5944('0x4b')](_0x5cfa42['model'],qs['fields'](_0xc340b8['query'][_0x5944('0x4d')]));_0x3c7088[_0x5944('0x4c')]=_0x3c7088[_0x5944('0x4c')]['length']?_0x3c7088[_0x5944('0x4c')]:_0x5cfa42[_0x5944('0x48')];_0x3c7088[_0x5944('0x51')]=qs[_0x5944('0x52')](_0xc340b8[_0x5944('0x49')][_0x5944('0x52')]);_0x3c7088[_0x5944('0x53')]=qs[_0x5944('0x4a')](_[_0x5944('0x6c')](_0xc340b8[_0x5944('0x49')],_0x5cfa42['filters']));if(_0xc340b8[_0x5944('0x49')][_0x5944('0x54')]){_0x3c7088['where']=_[_0x5944('0x55')](_0x3c7088['where'],{'$or':_[_0x5944('0x43')](_0x3c7088[_0x5944('0x4c')],function(_0x2e1649){var _0x2479e3={};_0x2479e3[_0x2e1649]={'$like':'%'+_0xc340b8['query'][_0x5944('0x54')]+'%'};return _0x2479e3;})});}_0x3c7088=_['merge']({},_0x3c7088,_0xc340b8[_0x5944('0x57')]);return _0x4e0a37[_0x5944('0xbf')](_0x3c7088);}})[_0x5944('0x37')](function(_0x30b43a){if(_0x30b43a){_0x1cc4ae=_0x30b43a[_0x5944('0x4e')];if(!_0xc340b8[_0x5944('0x49')]['hasOwnProperty']('nolimit')){_0x3c7088[_0x5944('0x30')]=qs[_0x5944('0x30')](_0xc340b8[_0x5944('0x49')][_0x5944('0x30')]);_0x3c7088[_0x5944('0x33')]=qs[_0x5944('0x33')](_0xc340b8[_0x5944('0x49')][_0x5944('0x33')]);}return _0x4e0a37[_0x5944('0xbf')](_0x3c7088);}})[_0x5944('0x37')](function(_0x3869ee){if(_0x3869ee){return _0x3869ee?{'count':_0x1cc4ae,'rows':_0x3869ee}:null;}})[_0x5944('0x37')](respondWithResult(_0x864c1,null))['catch'](handleError(_0x864c1,null));}; \ No newline at end of file +var _0xe244=['FAXOPT(','Wait','ReceiveFax','VoiceExtension','updateAccountApplications','bulkCreate','tech','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','Contacts','updatedAt','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','out','Messages','Contact\x20not\x20found','spread','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','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','./faxAccount.socket','client','http','request','then','info','debug','stringify','error','FaxAccount,\x20%s,\x20%s','message','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','destroy','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','key','map','keys','query','intersection','model','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filters','where','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','fields','length','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','filter','findAll','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','Tag','Tags','color','tag','transaction','sequelize','Transaction','FaxApplication','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','system','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','maxrate','minrate','modem'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe244,0xed));var _0x4e24=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xe244[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e24('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e24('0x1'));var rp=require('request-promise');var moment=require(_0x4e24('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4e24('0x3'));var util=require(_0x4e24('0x4'));var path=require('path');var sox=require(_0x4e24('0x5'));var csv=require('to-csv');var ejs=require(_0x4e24('0x6'));var fs=require('fs');var fs_extra=require(_0x4e24('0x7'));var _=require(_0x4e24('0x8'));var squel=require(_0x4e24('0x9'));var crypto=require('crypto');var jsforce=require(_0x4e24('0xa'));var deskjs=require(_0x4e24('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4e24('0xc'));var Papa=require(_0x4e24('0xd'));var Redis=require('ioredis');var authService=require(_0x4e24('0xe'));var qs=require(_0x4e24('0xf'));var as=require(_0x4e24('0x10'));var hardwareService=require(_0x4e24('0x11'));var logger=require('../../config/logger')(_0x4e24('0x12'));var utils=require('../../config/utils');var config=require(_0x4e24('0x13'));var licenseUtil=require(_0x4e24('0x14'));var db=require(_0x4e24('0x15'))['db'];config['redis']=_[_0x4e24('0x16')](config[_0x4e24('0x17')],{'host':_0x4e24('0x18'),'port':0x18eb});var socket=require(_0x4e24('0x19'))(new Redis(config[_0x4e24('0x17')]));require(_0x4e24('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x4e24('0x1b')][_0x4e24('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x501604,_0x53f921,_0x59b1a0,_0x3722b6){return new BPromise(function(_0x17f80a,_0x580e8b){var _0x317ced=_0x3722b6||client;return _0x317ced[_0x4e24('0x1d')](_0x501604,_0x59b1a0)[_0x4e24('0x1e')](function(_0x4bdfa5){logger[_0x4e24('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x53f921,'request\x20sent');logger[_0x4e24('0x20')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x53f921,'request\x20sent',JSON[_0x4e24('0x21')](_0x4bdfa5));if(_0x4bdfa5['error']){if(_0x4bdfa5['error']['code']===0x1f4){logger[_0x4e24('0x22')](_0x4e24('0x23'),_0x53f921,_0x4bdfa5[_0x4e24('0x22')][_0x4e24('0x24')]);return _0x580e8b(_0x4bdfa5[_0x4e24('0x22')][_0x4e24('0x24')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x53f921,_0x4bdfa5[_0x4e24('0x22')][_0x4e24('0x24')]);return _0x17f80a(_0x4bdfa5[_0x4e24('0x22')]['message']);}else{logger['info'](_0x4e24('0x23'),_0x53f921,'request\x20sent');_0x17f80a(_0x4bdfa5['result'][_0x4e24('0x24')]);}})['catch'](function(_0x22b762){logger[_0x4e24('0x22')](_0x4e24('0x23'),_0x53f921,_0x22b762);_0x580e8b(_0x22b762);});});}function respondWithStatusCode(_0x2ff327,_0x208c29){_0x208c29=_0x208c29||0xcc;return function(_0x3cfb3d){if(_0x3cfb3d){return _0x2ff327['sendStatus'](_0x208c29);}return _0x2ff327[_0x4e24('0x25')](_0x208c29)[_0x4e24('0x26')]();};}function respondWithResult(_0x231765,_0x42eab7){_0x42eab7=_0x42eab7||0xc8;return function(_0x4cc210){if(_0x4cc210){return _0x231765[_0x4e24('0x25')](_0x42eab7)[_0x4e24('0x27')](_0x4cc210);}};}function respondWithFilteredResult(_0x5e8546,_0x500f39){return function(_0x211b20){if(_0x211b20){var _0x4ff509=typeof _0x500f39[_0x4e24('0x28')]===_0x4e24('0x29')&&typeof _0x500f39['limit']===_0x4e24('0x29');var _0x3b4b88=_0x211b20[_0x4e24('0x2a')];var _0x42d135=_0x4ff509?0x0:_0x500f39['offset'];var _0x27daf5=_0x4ff509?_0x211b20[_0x4e24('0x2a')]:_0x500f39[_0x4e24('0x28')]+_0x500f39['limit'];var _0x85f727;if(_0x27daf5>=_0x3b4b88){_0x27daf5=_0x3b4b88;_0x85f727=0xc8;}else{_0x85f727=0xce;}_0x5e8546['status'](_0x85f727);return _0x5e8546[_0x4e24('0x2b')](_0x4e24('0x2c'),_0x42d135+'-'+_0x27daf5+'/'+_0x3b4b88)[_0x4e24('0x27')](_0x211b20);}return null;};}function patchUpdates(_0x540e7e){return function(_0x4f8961){try{jsonpatch[_0x4e24('0x2d')](_0x4f8961,_0x540e7e,!![]);}catch(_0x4f0d13){return BPromise['reject'](_0x4f0d13);}return _0x4f8961[_0x4e24('0x2e')]();};}function saveUpdates(_0xed9f0b,_0x1f7b49){return function(_0xfd3bf8){if(_0xfd3bf8){return _0xfd3bf8[_0x4e24('0x2f')](_0xed9f0b)[_0x4e24('0x1e')](function(_0x1837eb){return _0x1837eb;});}return null;};}function removeEntity(_0x55ed3f,_0x3cf65a){return function(_0x473e80){if(_0x473e80){return _0x473e80[_0x4e24('0x30')]()[_0x4e24('0x1e')](function(){var _0x3f2a0f=_0x473e80['get']({'plain':!![]});var _0x45d2ad=_0x4e24('0x31');return db[_0x4e24('0x32')][_0x4e24('0x30')]({'where':{'type':_0x45d2ad,'resourceId':_0x3f2a0f['id']}})[_0x4e24('0x1e')](function(){return _0x473e80;});})['then'](function(){_0x55ed3f[_0x4e24('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d5aac,_0x1b687a){return function(_0x3da141){if(!_0x3da141){_0x2d5aac[_0x4e24('0x33')](0x194);}return _0x3da141;};}function handleError(_0x1f059a,_0x13a5fa){_0x13a5fa=_0x13a5fa||0x1f4;return function(_0x57ad98){logger[_0x4e24('0x22')](_0x57ad98[_0x4e24('0x34')]);if(_0x57ad98['name']){delete _0x57ad98[_0x4e24('0x35')];}_0x1f059a[_0x4e24('0x25')](_0x13a5fa)[_0x4e24('0x36')](_0x57ad98);};}exports['index']=function(_0x38e766,_0x4f22c5){var _0x2a23b1={'include':[{'model':db[_0x4e24('0x37')],'as':_0x4e24('0x38')}]},_0x4fc341={},_0x180746={'count':0x0,'rows':[]};var _0x1f24b8=_['map'](db[_0x4e24('0x39')][_0x4e24('0x3a')],function(_0x51d744){return{'name':_0x51d744[_0x4e24('0x3b')],'type':_0x51d744['type'][_0x4e24('0x3c')]};});_0x4fc341['model']=_[_0x4e24('0x3d')](_0x1f24b8,_0x4e24('0x35'));_0x4fc341['query']=_[_0x4e24('0x3e')](_0x38e766[_0x4e24('0x3f')]);_0x4fc341['filters']=_[_0x4e24('0x40')](_0x4fc341[_0x4e24('0x41')],_0x4fc341[_0x4e24('0x3f')]);_0x2a23b1[_0x4e24('0x42')]=_[_0x4e24('0x40')](_0x4fc341['model'],qs['fields'](_0x38e766[_0x4e24('0x3f')]['fields']));_0x2a23b1[_0x4e24('0x42')]=_0x2a23b1['attributes']['length']?_0x2a23b1[_0x4e24('0x42')]:_0x4fc341[_0x4e24('0x41')];if(!_0x38e766[_0x4e24('0x3f')][_0x4e24('0x43')](_0x4e24('0x44'))){_0x2a23b1[_0x4e24('0x45')]=qs['limit'](_0x38e766['query'][_0x4e24('0x45')]);_0x2a23b1[_0x4e24('0x28')]=qs['offset'](_0x38e766[_0x4e24('0x3f')][_0x4e24('0x28')]);}_0x2a23b1[_0x4e24('0x46')]=qs[_0x4e24('0x47')](_0x38e766[_0x4e24('0x3f')][_0x4e24('0x47')]);_0x2a23b1['where']=qs['filters'](_[_0x4e24('0x48')](_0x38e766[_0x4e24('0x3f')],_0x4fc341[_0x4e24('0x49')]),_0x1f24b8);if(_0x38e766['query']['filter']){_0x2a23b1[_0x4e24('0x4a')]=_[_0x4e24('0x4b')](_0x2a23b1['where'],{'$or':_[_0x4e24('0x3d')](_0x1f24b8,function(_0xc812c4){if(_0xc812c4[_0x4e24('0x4c')]!==_0x4e24('0x4d')){var _0x3f7d4f={};_0x3f7d4f[_0xc812c4[_0x4e24('0x35')]]={'$like':'%'+_0x38e766[_0x4e24('0x3f')]['filter']+'%'};return _0x3f7d4f;}})});}_0x2a23b1=_[_0x4e24('0x4b')]({},_0x2a23b1,_0x38e766['options']);var _0x19a334={'where':_0x2a23b1[_0x4e24('0x4a')]};return db['FaxAccount'][_0x4e24('0x2a')](_0x19a334)[_0x4e24('0x1e')](function(_0x72d43f){_0x180746['count']=_0x72d43f;if(_0x38e766[_0x4e24('0x3f')][_0x4e24('0x4e')]){_0x2a23b1[_0x4e24('0x4f')]=[{'all':!![]}];}return db[_0x4e24('0x39')]['findAll'](_0x2a23b1);})[_0x4e24('0x1e')](function(_0x29f9b4){_0x180746[_0x4e24('0x50')]=_0x29f9b4;return _0x180746;})['then'](respondWithFilteredResult(_0x4f22c5,_0x2a23b1))[_0x4e24('0x51')](handleError(_0x4f22c5,null));};exports[_0x4e24('0x52')]=function(_0x366d99,_0xc298aa){var _0x385c56={'raw':![],'where':{'id':_0x366d99[_0x4e24('0x53')]['id']},'include':[{'model':db[_0x4e24('0x37')],'as':_0x4e24('0x38')}]},_0x43e072={};_0x43e072[_0x4e24('0x41')]=_[_0x4e24('0x3e')](db[_0x4e24('0x39')][_0x4e24('0x3a')]);_0x43e072[_0x4e24('0x3f')]=_[_0x4e24('0x3e')](_0x366d99[_0x4e24('0x3f')]);_0x43e072[_0x4e24('0x49')]=_[_0x4e24('0x40')](_0x43e072[_0x4e24('0x41')],_0x43e072['query']);_0x385c56[_0x4e24('0x42')]=_[_0x4e24('0x40')](_0x43e072[_0x4e24('0x41')],qs[_0x4e24('0x54')](_0x366d99['query'][_0x4e24('0x54')]));_0x385c56[_0x4e24('0x42')]=_0x385c56[_0x4e24('0x42')][_0x4e24('0x55')]?_0x385c56[_0x4e24('0x42')]:_0x43e072['model'];if(_0x366d99[_0x4e24('0x3f')]['includeAll']){_0x385c56['include']=[{'all':!![]}];}_0x385c56=_[_0x4e24('0x4b')]({},_0x385c56,_0x366d99[_0x4e24('0x56')]);return db[_0x4e24('0x39')][_0x4e24('0x57')](_0x385c56)['then'](handleEntityNotFound(_0xc298aa,null))['then'](respondWithResult(_0xc298aa,null))[_0x4e24('0x51')](handleError(_0xc298aa,null));};exports[_0x4e24('0x58')]=function(_0xefd77e,_0x2b28df){return db[_0x4e24('0x39')][_0x4e24('0x58')](_0xefd77e[_0x4e24('0x59')],{})['then'](function(_0x590c74){var _0x1e373a=_0xefd77e[_0x4e24('0x5a')][_0x4e24('0x5b')]({'plain':!![]});if(!_0x1e373a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e373a[_0x4e24('0x5c')]===_0x4e24('0x5a')){var _0x3b8d64=_0x590c74['get']({'plain':!![]});var _0x16f514='FaxAccounts';return db[_0x4e24('0x5d')][_0x4e24('0x57')]({'where':{'name':_0x16f514,'userProfileId':_0x1e373a[_0x4e24('0x5e')]},'raw':!![]})['then'](function(_0xfb2364){if(_0xfb2364&&_0xfb2364[_0x4e24('0x5f')]===0x0){return db[_0x4e24('0x32')][_0x4e24('0x58')]({'name':_0x3b8d64[_0x4e24('0x35')],'resourceId':_0x3b8d64['id'],'type':_0xfb2364[_0x4e24('0x35')],'sectionId':_0xfb2364['id']},{})['then'](function(){return _0x590c74;});}else{return _0x590c74;}})[_0x4e24('0x51')](function(_0x32e4b1){logger[_0x4e24('0x22')](_0x4e24('0x60'),_0x32e4b1);throw _0x32e4b1;});}return _0x590c74;})[_0x4e24('0x1e')](respondWithResult(_0x2b28df,0xc9))[_0x4e24('0x51')](handleError(_0x2b28df,null));};exports[_0x4e24('0x2f')]=function(_0x1fafea,_0x1d517a){if(_0x1fafea['body']['id']){delete _0x1fafea['body']['id'];}return db[_0x4e24('0x39')][_0x4e24('0x57')]({'where':{'id':_0x1fafea[_0x4e24('0x53')]['id']},'include':[{'model':db[_0x4e24('0x37')],'as':_0x4e24('0x38')}]})[_0x4e24('0x1e')](handleEntityNotFound(_0x1d517a,null))[_0x4e24('0x1e')](saveUpdates(_0x1fafea[_0x4e24('0x59')],null))['then'](respondWithResult(_0x1d517a,null))['catch'](handleError(_0x1d517a,null));};exports[_0x4e24('0x30')]=function(_0x6f68f1,_0x3f24d9){return db[_0x4e24('0x39')][_0x4e24('0x57')]({'where':{'id':_0x6f68f1[_0x4e24('0x53')]['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0x3f24d9,null))['then'](removeEntity(_0x3f24d9,null))[_0x4e24('0x51')](handleError(_0x3f24d9,null));};exports[_0x4e24('0x61')]=function(_0x4cd6fe,_0x30d88d){return db['FaxAccount'][_0x4e24('0x61')]()['then'](respondWithResult(_0x30d88d,null))[_0x4e24('0x51')](handleError(_0x30d88d,null));};exports[_0x4e24('0x62')]=function(_0x5cfd10,_0xaf1519,_0x223356){if(_0x5cfd10[_0x4e24('0x59')]['id']){delete _0x5cfd10['body']['id'];}return db[_0x4e24('0x39')][_0x4e24('0x57')]({'where':{'id':_0x5cfd10[_0x4e24('0x53')]['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0xaf1519,null))[_0x4e24('0x1e')](function(_0x1f2ef6){if(_0x1f2ef6){_0x5cfd10[_0x4e24('0x59')][_0x4e24('0x63')]=_0x1f2ef6['id'];return db[_0x4e24('0x64')]['create'](_0x5cfd10[_0x4e24('0x59')]);}})[_0x4e24('0x1e')](respondWithResult(_0xaf1519,null))[_0x4e24('0x51')](handleError(_0xaf1519,null));};exports[_0x4e24('0x65')]=function(_0x1181ed,_0x2be31a,_0x3c3812){var _0x5d49ac={'raw':![],'where':{}};var _0x27b08e={};var _0x4858cf={'count':0x0,'rows':[]};return db[_0x4e24('0x39')]['findOne']({'where':{'id':_0x1181ed[_0x4e24('0x53')]['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0x2be31a,null))[_0x4e24('0x1e')](function(_0x5f14ed){if(_0x5f14ed){_0x27b08e[_0x4e24('0x41')]=_[_0x4e24('0x3e')](db[_0x4e24('0x64')][_0x4e24('0x3a')]);_0x27b08e[_0x4e24('0x3f')]=_['keys'](_0x1181ed[_0x4e24('0x3f')]);_0x27b08e[_0x4e24('0x49')]=_[_0x4e24('0x40')](_0x27b08e[_0x4e24('0x41')],_0x27b08e[_0x4e24('0x3f')]);_0x5d49ac['attributes']=_[_0x4e24('0x40')](_0x27b08e[_0x4e24('0x41')],qs[_0x4e24('0x54')](_0x1181ed[_0x4e24('0x3f')][_0x4e24('0x54')]));_0x5d49ac['attributes']=_0x5d49ac[_0x4e24('0x42')][_0x4e24('0x55')]?_0x5d49ac[_0x4e24('0x42')]:_0x27b08e[_0x4e24('0x41')];if(!_0x1181ed['query'][_0x4e24('0x43')](_0x4e24('0x44'))){_0x5d49ac['limit']=qs['limit'](_0x1181ed['query'][_0x4e24('0x45')]);_0x5d49ac[_0x4e24('0x28')]=qs[_0x4e24('0x28')](_0x1181ed[_0x4e24('0x3f')][_0x4e24('0x28')]);}_0x5d49ac[_0x4e24('0x46')]=qs[_0x4e24('0x47')](_0x1181ed[_0x4e24('0x3f')][_0x4e24('0x47')]);_0x5d49ac['where']=qs['filters'](_[_0x4e24('0x48')](_0x1181ed[_0x4e24('0x3f')],_0x27b08e[_0x4e24('0x49')]));_0x5d49ac[_0x4e24('0x4a')][_0x4e24('0x63')]=_0x5f14ed['id'];if(_0x1181ed[_0x4e24('0x3f')][_0x4e24('0x66')]){_0x5d49ac[_0x4e24('0x4a')]=_[_0x4e24('0x4b')](_0x5d49ac[_0x4e24('0x4a')],{'$or':_[_0x4e24('0x3d')](_0x5d49ac[_0x4e24('0x42')],function(_0x288492){var _0x1bbc61={};_0x1bbc61[_0x288492]={'$like':'%'+_0x1181ed[_0x4e24('0x3f')][_0x4e24('0x66')]+'%'};return _0x1bbc61;})});}_0x5d49ac=_['merge']({},_0x5d49ac,_0x1181ed['options']);return db[_0x4e24('0x64')][_0x4e24('0x2a')]({'where':_0x5d49ac[_0x4e24('0x4a')]})['then'](function(_0x213417){_0x4858cf['count']=_0x213417;if(_0x1181ed[_0x4e24('0x3f')][_0x4e24('0x4e')]){_0x5d49ac[_0x4e24('0x4f')]=[{'all':!![]}];}return db[_0x4e24('0x64')][_0x4e24('0x67')](_0x5d49ac);})[_0x4e24('0x1e')](function(_0x380cf4){_0x4858cf[_0x4e24('0x50')]=_0x380cf4;return _0x4858cf;});}})['then'](respondWithFilteredResult(_0x2be31a,_0x5d49ac))['catch'](handleError(_0x2be31a,null));};exports[_0x4e24('0x68')]=function(_0x40dd23,_0x394b1d,_0x4d392f){return db[_0x4e24('0x39')][_0x4e24('0x57')]({'where':{'id':_0x40dd23[_0x4e24('0x53')]['id']}})['then'](handleEntityNotFound(_0x394b1d,null))[_0x4e24('0x1e')](function(_0x2f9200){if(_0x2f9200){return _0x2f9200[_0x4e24('0x68')](_0x40dd23[_0x4e24('0x3f')][_0x4e24('0x69')]);}})[_0x4e24('0x1e')](respondWithStatusCode(_0x394b1d,null))[_0x4e24('0x51')](handleError(_0x394b1d,null));};exports[_0x4e24('0x6a')]=function(_0x217415,_0xf4ab61,_0x5ed8c9){if(_0x217415['body']['id']){delete _0x217415['body']['id'];}return db[_0x4e24('0x39')][_0x4e24('0x57')]({'where':{'id':_0x217415['params']['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0xf4ab61,null))[_0x4e24('0x1e')](function(_0x18bb5d){if(_0x18bb5d){_0x217415['body']['FaxAccountId']=_0x18bb5d['id'];return db[_0x4e24('0x6b')]['create'](_0x217415[_0x4e24('0x59')]);}})[_0x4e24('0x1e')](respondWithResult(_0xf4ab61,null))[_0x4e24('0x51')](handleError(_0xf4ab61,null));};exports['getAnswers']=function(_0x5f30a7,_0x5f0aff,_0x1d603c){var _0x3d2d66={'raw':![],'where':{}};var _0x289a83={};var _0x864dae={'count':0x0,'rows':[]};return db[_0x4e24('0x39')][_0x4e24('0x6c')]({'where':{'id':_0x5f30a7[_0x4e24('0x53')]['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0x5f0aff,null))['then'](function(_0x14e5b8){if(_0x14e5b8){_0x289a83[_0x4e24('0x41')]=_['keys'](db[_0x4e24('0x6b')]['rawAttributes']);_0x289a83['query']=_[_0x4e24('0x3e')](_0x5f30a7[_0x4e24('0x3f')]);_0x289a83[_0x4e24('0x49')]=_[_0x4e24('0x40')](_0x289a83[_0x4e24('0x41')],_0x289a83[_0x4e24('0x3f')]);_0x3d2d66['attributes']=_[_0x4e24('0x40')](_0x289a83['model'],qs[_0x4e24('0x54')](_0x5f30a7[_0x4e24('0x3f')]['fields']));_0x3d2d66[_0x4e24('0x42')]=_0x3d2d66[_0x4e24('0x42')][_0x4e24('0x55')]?_0x3d2d66['attributes']:_0x289a83[_0x4e24('0x41')];if(!_0x5f30a7[_0x4e24('0x3f')][_0x4e24('0x43')]('nolimit')){_0x3d2d66[_0x4e24('0x45')]=qs[_0x4e24('0x45')](_0x5f30a7[_0x4e24('0x3f')][_0x4e24('0x45')]);_0x3d2d66[_0x4e24('0x28')]=qs[_0x4e24('0x28')](_0x5f30a7[_0x4e24('0x3f')][_0x4e24('0x28')]);}_0x3d2d66[_0x4e24('0x46')]=qs[_0x4e24('0x47')](_0x5f30a7[_0x4e24('0x3f')][_0x4e24('0x47')]);_0x3d2d66['where']=qs['filters'](_['pick'](_0x5f30a7['query'],_0x289a83['filters']));_0x3d2d66[_0x4e24('0x4a')]['FaxAccountId']=_0x14e5b8['id'];if(_0x5f30a7[_0x4e24('0x3f')]['filter']){_0x3d2d66['where']=_[_0x4e24('0x4b')](_0x3d2d66[_0x4e24('0x4a')],{'$or':_['map'](_0x3d2d66[_0x4e24('0x42')],function(_0xf3fa0c){var _0x282a8d={};_0x282a8d[_0xf3fa0c]={'$like':'%'+_0x5f30a7[_0x4e24('0x3f')]['filter']+'%'};return _0x282a8d;})});}_0x3d2d66=_[_0x4e24('0x4b')]({},_0x3d2d66,_0x5f30a7[_0x4e24('0x56')]);return db[_0x4e24('0x6b')]['count']({'where':_0x3d2d66[_0x4e24('0x4a')]})[_0x4e24('0x1e')](function(_0x2db9b4){_0x864dae[_0x4e24('0x2a')]=_0x2db9b4;if(_0x5f30a7['query'][_0x4e24('0x4e')]){_0x3d2d66[_0x4e24('0x4f')]=[{'all':!![]}];}return db[_0x4e24('0x6b')][_0x4e24('0x67')](_0x3d2d66);})['then'](function(_0x2bd957){_0x864dae[_0x4e24('0x50')]=_0x2bd957;return _0x864dae;});}})[_0x4e24('0x1e')](respondWithFilteredResult(_0x5f0aff,_0x3d2d66))[_0x4e24('0x51')](handleError(_0x5f0aff,null));};exports[_0x4e24('0x6d')]=function(_0x132b01,_0x318370,_0x415593){return db[_0x4e24('0x39')][_0x4e24('0x57')]({'where':{'id':_0x132b01['params']['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0x318370,null))[_0x4e24('0x1e')](function(_0x2a9a62){if(_0x2a9a62){return _0x2a9a62[_0x4e24('0x6d')](_0x132b01[_0x4e24('0x3f')][_0x4e24('0x69')]);}})[_0x4e24('0x1e')](respondWithStatusCode(_0x318370,null))[_0x4e24('0x51')](handleError(_0x318370,null));};exports[_0x4e24('0x6e')]=function(_0x2e7b4a,_0x1771db,_0x48e661){return db[_0x4e24('0x6f')][_0x4e24('0x57')]({'where':{'id':_0x2e7b4a['params']['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0x1771db,null))[_0x4e24('0x1e')](function(_0x5eb45c){if(_0x5eb45c){return _0x5eb45c[_0x4e24('0x6e')](_0x2e7b4a[_0x4e24('0x59')][_0x4e24('0x69')],_[_0x4e24('0x70')](_0x2e7b4a[_0x4e24('0x59')],[_0x4e24('0x69'),'id'])||{});}})[_0x4e24('0x1e')](respondWithResult(_0x1771db,null))[_0x4e24('0x51')](handleError(_0x1771db,null));};exports[_0x4e24('0x71')]=function(_0x6d9292,_0x4228ad,_0x51e10e){var _0x2b8182={'raw':![],'where':{}};var _0x147614={};var _0x2d06c8={'count':0x0,'rows':[]};return db[_0x4e24('0x39')][_0x4e24('0x6c')]({'where':{'id':_0x6d9292[_0x4e24('0x53')]['id']}})['then'](handleEntityNotFound(_0x4228ad,null))[_0x4e24('0x1e')](function(_0x2553c9){if(_0x2553c9){_0x147614[_0x4e24('0x41')]=_[_0x4e24('0x3e')](db[_0x4e24('0x6f')]['rawAttributes']);_0x147614[_0x4e24('0x3f')]=_['keys'](_0x6d9292['query']);_0x147614[_0x4e24('0x49')]=_['intersection'](_0x147614[_0x4e24('0x41')],_0x147614[_0x4e24('0x3f')]);_0x2b8182[_0x4e24('0x42')]=_[_0x4e24('0x40')](_0x147614['model'],qs['fields'](_0x6d9292[_0x4e24('0x3f')]['fields']));_0x2b8182[_0x4e24('0x42')]=_0x2b8182[_0x4e24('0x42')][_0x4e24('0x55')]?_0x2b8182['attributes']:_0x147614[_0x4e24('0x41')];if(!_0x6d9292[_0x4e24('0x3f')]['hasOwnProperty'](_0x4e24('0x44'))){_0x2b8182[_0x4e24('0x45')]=qs[_0x4e24('0x45')](_0x6d9292[_0x4e24('0x3f')][_0x4e24('0x45')]);_0x2b8182['offset']=qs[_0x4e24('0x28')](_0x6d9292['query'][_0x4e24('0x28')]);}_0x2b8182[_0x4e24('0x46')]=qs[_0x4e24('0x47')](_0x6d9292[_0x4e24('0x3f')][_0x4e24('0x47')]);_0x2b8182[_0x4e24('0x4a')]=qs[_0x4e24('0x49')](_['pick'](_0x6d9292[_0x4e24('0x3f')],_0x147614['filters']));_0x2b8182[_0x4e24('0x4a')]['FaxAccountId']=_0x2553c9['id'];if(_0x6d9292[_0x4e24('0x3f')][_0x4e24('0x66')]){_0x2b8182[_0x4e24('0x4a')]=_['merge'](_0x2b8182[_0x4e24('0x4a')],{'$or':_[_0x4e24('0x3d')](_0x2b8182['attributes'],function(_0x402fa6){var _0x2ed537={};_0x2ed537[_0x402fa6]={'$like':'%'+_0x6d9292[_0x4e24('0x3f')]['filter']+'%'};return _0x2ed537;})});}_0x2b8182=_[_0x4e24('0x4b')]({},_0x2b8182,_0x6d9292[_0x4e24('0x56')]);return db[_0x4e24('0x6f')][_0x4e24('0x2a')]({'where':_0x2b8182[_0x4e24('0x4a')]})['then'](function(_0x281edf){_0x2d06c8[_0x4e24('0x2a')]=_0x281edf;if(_0x6d9292[_0x4e24('0x3f')]['includeAll']){_0x2b8182[_0x4e24('0x4f')]=[{'model':db[_0x4e24('0x72')],'as':'Contact','required':![]},{'model':db[_0x4e24('0x73')],'as':_0x4e24('0x74'),'attributes':['name',_0x4e24('0x75'),'internal'],'required':![]},{'model':db[_0x4e24('0x76')],'as':_0x4e24('0x77'),'attributes':['id',_0x4e24('0x35'),_0x4e24('0x78')],'where':_0x6d9292[_0x4e24('0x3f')][_0x4e24('0x79')]?{'id':_0x6d9292['query'][_0x4e24('0x79')]}:undefined,'required':_0x6d9292['query']['tag']?!![]:![]}];}return db[_0x4e24('0x6f')][_0x4e24('0x67')](_0x2b8182);})[_0x4e24('0x1e')](function(_0x184fc8){_0x2d06c8['rows']=_0x184fc8;return _0x2d06c8;});}})[_0x4e24('0x1e')](respondWithFilteredResult(_0x4228ad,_0x2b8182))[_0x4e24('0x51')](handleError(_0x4228ad,null));};exports['addApplications']=function(_0x4bf81f,_0x145c99){var _0x52241a=_0x4bf81f[_0x4e24('0x53')]['id'];var _0xe33034=_0x4bf81f[_0x4e24('0x59')];var _0x52a477=0xc8;var _0x31faa5=null;return db['sequelize'][_0x4e24('0x7a')]({'isolationLevel':db[_0x4e24('0x7b')][_0x4e24('0x7c')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x3ffa8a){return db[_0x4e24('0x39')]['findOne']({'where':{'id':_0x52241a},'transaction':_0x3ffa8a})[_0x4e24('0x1e')](function(_0x39c73b){if(_0x39c73b){return db[_0x4e24('0x7d')]['destroy']({'where':{'FaxAccountId':_0x52241a},'transaction':_0x3ffa8a})[_0x4e24('0x1e')](function(){var _0x25ccef=_['map'](_0xe33034,function(_0x3efc1c){_0x3efc1c['FaxAccountId']=_0x52241a;return _0x3efc1c;});return db[_0x4e24('0x7d')]['bulkCreate'](_0x25ccef,{'transaction':_0x3ffa8a});});}else{_0x52a477=0x194;_0x31faa5=[];}});})[_0x4e24('0x1e')](function(){if(_0x52a477!==0x194){return db[_0x4e24('0x7d')][_0x4e24('0x7e')]({'where':{'FaxAccountId':_0x52241a},'order':_0x4e24('0x7f')})['then'](function(_0x456d70){_0x31faa5=_0x456d70;});}})[_0x4e24('0x51')](function(_0x4c569a){_0x52a477=0x1f4;logger[_0x4e24('0x22')](_0x4c569a[_0x4e24('0x34')]);if(_0x4c569a[_0x4e24('0x35')]){delete _0x4c569a[_0x4e24('0x35')];}_0x31faa5=_0x4c569a;})[_0x4e24('0x80')](function(){if(_0x31faa5===null){_0x145c99[_0x4e24('0x33')](_0x52a477);}else{if(_0x52a477===0x1f4){_0x145c99[_0x4e24('0x25')](_0x52a477)[_0x4e24('0x36')](_0x31faa5);}else{_0x145c99['status'](_0x52a477)[_0x4e24('0x27')](_0x31faa5);}}});};exports[_0x4e24('0x81')]=function(_0x2e92fc,_0x401178,_0x3c9d84){var _0x2b8237={};var _0x14e7b5={};var _0x25e72a;var _0x5bbc10;return db['FaxAccount'][_0x4e24('0x6c')]({'where':{'id':_0x2e92fc[_0x4e24('0x53')]['id']}})['then'](handleEntityNotFound(_0x401178,null))['then'](function(_0x3b892b){if(_0x3b892b){_0x25e72a=_0x3b892b;_0x14e7b5[_0x4e24('0x41')]=_['keys'](db[_0x4e24('0x7d')][_0x4e24('0x3a')]);_0x14e7b5[_0x4e24('0x3f')]=_[_0x4e24('0x3e')](_0x2e92fc[_0x4e24('0x3f')]);_0x14e7b5['filters']=_[_0x4e24('0x40')](_0x14e7b5[_0x4e24('0x41')],_0x14e7b5['query']);_0x2b8237[_0x4e24('0x42')]=_[_0x4e24('0x40')](_0x14e7b5[_0x4e24('0x41')],qs[_0x4e24('0x54')](_0x2e92fc[_0x4e24('0x3f')]['fields']));_0x2b8237[_0x4e24('0x42')]=_0x2b8237[_0x4e24('0x42')]['length']?_0x2b8237['attributes']:_0x14e7b5['model'];_0x2b8237[_0x4e24('0x46')]=qs[_0x4e24('0x47')](_0x2e92fc[_0x4e24('0x3f')]['sort']);_0x2b8237[_0x4e24('0x4a')]=qs[_0x4e24('0x49')](_['pick'](_0x2e92fc[_0x4e24('0x3f')],_0x14e7b5['filters']));if(_0x2e92fc[_0x4e24('0x3f')]['filter']){_0x2b8237[_0x4e24('0x4a')]=_['merge'](_0x2b8237[_0x4e24('0x4a')],{'$or':_['map'](_0x2b8237[_0x4e24('0x42')],function(_0x621d85){var _0x550a63={};_0x550a63[_0x621d85]={'$like':'%'+_0x2e92fc[_0x4e24('0x3f')][_0x4e24('0x66')]+'%'};return _0x550a63;})});}_0x2b8237=_[_0x4e24('0x4b')]({},_0x2b8237,_0x2e92fc[_0x4e24('0x56')]);return _0x25e72a[_0x4e24('0x81')](_0x2b8237);}})['then'](function(_0x4858a3){if(_0x4858a3){_0x5bbc10=_0x4858a3[_0x4e24('0x55')];if(!_0x2e92fc[_0x4e24('0x3f')][_0x4e24('0x43')](_0x4e24('0x44'))){_0x2b8237['limit']=qs['limit'](_0x2e92fc[_0x4e24('0x3f')][_0x4e24('0x45')]);_0x2b8237[_0x4e24('0x28')]=qs[_0x4e24('0x28')](_0x2e92fc['query'][_0x4e24('0x28')]);}return _0x25e72a[_0x4e24('0x81')](_0x2b8237);}})['then'](function(_0x27c0bd){if(_0x27c0bd){return _0x27c0bd?{'count':_0x5bbc10,'rows':_0x27c0bd}:null;}})[_0x4e24('0x1e')](respondWithResult(_0x401178,null))[_0x4e24('0x51')](handleError(_0x401178,null));};function Extension(_0x39c5c0,_0x12001a,_0x2a9b54,_0x27c7b4){this['context']=_0x4e24('0x82');this[_0x4e24('0x83')]=_0x39c5c0['localstationid'];this['app']=_0x27c7b4;this[_0x4e24('0x4c')]=_0x4e24('0x84');this[_0x4e24('0x85')]=_0x4e24('0x86');this[_0x4e24('0x63')]=_0x39c5c0['id'];this[_0x4e24('0x7f')]=_0x12001a;this[_0x4e24('0x87')]=_0x2a9b54;}function createExtensionsReciveFax(_0xd12b0b){var _0x505ee9=0x1;var _0x1583d5=[];_0x1583d5['push'](new Extension(_0xd12b0b,_0x505ee9,'',_0x4e24('0x88')));_0x505ee9+=0x1;_0x1583d5[_0x4e24('0x89')](new Extension(_0xd12b0b,_0x505ee9,_0x4e24('0x8a'),'Set'));_0x505ee9+=0x1;for(var _0x4dfcca in _0xd12b0b){if(_0xd12b0b[_0x4e24('0x43')](_0x4dfcca)&&(_0x4dfcca==='ecm'||_0x4dfcca==='localstationid'||_0x4dfcca===_0x4e24('0x8b')||_0x4dfcca===_0x4e24('0x8c')||_0x4dfcca===_0x4e24('0x8d')||_0x4dfcca===_0x4e24('0x8e')||_0x4dfcca===_0x4e24('0x8f')||_0x4dfcca===_0x4e24('0x90')||_0x4dfcca==='t38timeout')){_0x1583d5['push'](new Extension(_0xd12b0b,_0x505ee9,_0x4e24('0x91')+_0x4dfcca+')='+_0xd12b0b[_0x4dfcca],'Set'));_0x505ee9+=0x1;}}_0x1583d5[_0x4e24('0x89')](new Extension(_0xd12b0b,_0x505ee9,'6',_0x4e24('0x92')));_0x505ee9+=0x1;_0x1583d5[_0x4e24('0x89')](new Extension(_0xd12b0b,_0x505ee9,'/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',_0x4e24('0x93')));_0x505ee9=0x0;return _0x1583d5;}exports['addAccountApplications']=function(_0x59c9e7,_0x455aef,_0x4f28c5){var _0xde5322;return db[_0x4e24('0x7b')][_0x4e24('0x7a')](function(_0x29f1b5){return db[_0x4e24('0x39')]['create'](_0x59c9e7[_0x4e24('0x59')],{'transaction':_0x29f1b5})[_0x4e24('0x1e')](function(_0x2eaa62){_0xde5322=_0x2eaa62[_0x4e24('0x5b')]({'plain':!![]});return db[_0x4e24('0x94')]['bulkCreate'](createExtensionsReciveFax(_0xde5322),{'transaction':_0x29f1b5});});})[_0x4e24('0x1e')](function(){return _0xde5322;})[_0x4e24('0x1e')](respondWithResult(_0x455aef,null))[_0x4e24('0x51')](handleError(_0x455aef,null));};exports[_0x4e24('0x95')]=function(_0x1bd4d8,_0x268e84,_0x251b05){var _0x87a677;return db[_0x4e24('0x7b')][_0x4e24('0x7a')](function(_0x3ceb9b){return db[_0x4e24('0x39')][_0x4e24('0x2f')](_0x1bd4d8[_0x4e24('0x59')],{'where':{'id':_0x1bd4d8[_0x4e24('0x59')]['id']},'transaction':_0x3ceb9b})[_0x4e24('0x1e')](function(_0x12d492){return db[_0x4e24('0x94')][_0x4e24('0x30')]({'where':{'FaxAccountId':_0x1bd4d8[_0x4e24('0x59')]['id']},'transaction':_0x3ceb9b})[_0x4e24('0x1e')](function(_0x513284){return db[_0x4e24('0x94')][_0x4e24('0x96')](createExtensionsReciveFax(_[_0x4e24('0x70')](_0x1bd4d8[_0x4e24('0x59')],[_0x4e24('0x97'),_0x4e24('0x3c'),'createdAt','updatedAt',_0x4e24('0x98'),_0x4e24('0x99')])),{'transaction':_0x3ceb9b});});});})[_0x4e24('0x1e')](function(){return db[_0x4e24('0x39')][_0x4e24('0x9a')](_0x1bd4d8[_0x4e24('0x59')]['id']);})[_0x4e24('0x1e')](respondWithResult(_0x268e84,null))[_0x4e24('0x51')](handleError(_0x268e84,null));};exports[_0x4e24('0x9b')]=function(_0x4c8a89,_0x26f23a,_0x4e0610){var _0x1e07fd={'raw':!![],'where':{}};var _0x211292={};var _0x5d670b={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4e24('0x6c')]({'where':{'id':_0x4c8a89[_0x4e24('0x53')]['id']}})['then'](handleEntityNotFound(_0x26f23a,null))['then'](function(_0x43e694){if(_0x43e694){_0x211292[_0x4e24('0x41')]=_[_0x4e24('0x3e')](db['FaxMessage']['rawAttributes']);_0x211292['query']=_[_0x4e24('0x3e')](_0x4c8a89[_0x4e24('0x3f')]);_0x211292['filters']=_[_0x4e24('0x40')](_0x211292[_0x4e24('0x41')],_0x211292[_0x4e24('0x3f')]);_0x1e07fd[_0x4e24('0x42')]=_['intersection'](_0x211292['model'],qs[_0x4e24('0x54')](_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x54')]));_0x1e07fd[_0x4e24('0x42')]=_0x1e07fd[_0x4e24('0x42')][_0x4e24('0x55')]?_0x1e07fd[_0x4e24('0x42')]:_0x211292[_0x4e24('0x41')];if(!_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x43')](_0x4e24('0x44'))){_0x1e07fd[_0x4e24('0x45')]=qs[_0x4e24('0x45')](_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x45')]);_0x1e07fd[_0x4e24('0x28')]=qs[_0x4e24('0x28')](_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x28')]);}_0x1e07fd[_0x4e24('0x46')]=qs['sort'](_0x4c8a89['query']['sort']);_0x1e07fd[_0x4e24('0x4a')]=qs[_0x4e24('0x49')](_['pick'](_0x4c8a89[_0x4e24('0x3f')],_0x211292[_0x4e24('0x49')]));_0x1e07fd[_0x4e24('0x4a')][_0x4e24('0x63')]=_0x43e694['id'];if(_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x66')]){_0x1e07fd['where']=_[_0x4e24('0x4b')](_0x1e07fd[_0x4e24('0x4a')],{'$or':_[_0x4e24('0x3d')](_0x1e07fd['attributes'],function(_0x217b3c){var _0x3afa15={};_0x3afa15[_0x217b3c]={'$like':'%'+_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x66')]+'%'};return _0x3afa15;})});}if(_0x4c8a89['query'][_0x4e24('0x9c')]){var _0x1c11b5=_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x9c')][_0x4e24('0x9d')](',');var _0x226cb9={};_0x226cb9[_0x1c11b5[0x0]]={'$gte':moment(_0x1c11b5[0x1])[_0x4e24('0x9e')](_0x4e24('0x9f'))};_0x1e07fd[_0x4e24('0x4a')]=_[_0x4e24('0x4b')](_0x1e07fd['where'],_0x226cb9);}_0x1e07fd=_[_0x4e24('0x4b')]({},_0x1e07fd,_0x4c8a89['options']);return db[_0x4e24('0xa0')]['count']({'where':_0x1e07fd[_0x4e24('0x4a')]})[_0x4e24('0x1e')](function(_0x8a49b5){_0x5d670b[_0x4e24('0x2a')]=_0x8a49b5;if(_0x4c8a89[_0x4e24('0x3f')][_0x4e24('0x4e')]){_0x1e07fd[_0x4e24('0x4f')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x1e07fd);})['then'](function(_0x43792e){_0x5d670b[_0x4e24('0x50')]=_0x43792e;return _0x5d670b;});}})[_0x4e24('0x1e')](respondWithFilteredResult(_0x26f23a,_0x1e07fd))[_0x4e24('0x51')](handleError(_0x26f23a,null));};exports[_0x4e24('0x36')]=function(_0x453a6,_0x27604a,_0x3d34d7){var _0x3d24cb,_0x336df2={},_0x1e137d;if(_0x453a6[_0x4e24('0x59')]['to']){_0x1e137d=_0x453a6[_0x4e24('0x59')]['to'][0x0];}return db['FaxAccount'][_0x4e24('0x57')]({'where':{'id':_0x453a6[_0x4e24('0x53')]['id']},'include':[{'model':db[_0x4e24('0xa1')],'as':'List','include':[{'model':db[_0x4e24('0x72')],'as':_0x4e24('0xa2'),'where':{'fax':_0x1e137d},'limit':0x1,'order':[[_0x4e24('0xa3'),_0x4e24('0xa4')]]}]}]})['then'](handleEntityNotFound(_0x27604a,null))[_0x4e24('0x1e')](function(_0x3d0f4b){_0x3d24cb=_0x3d0f4b;if(_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')]&&_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')][_0x4e24('0x55')]){for(var _0x48ef9a=0x0;_0x48ef9a<_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')]['length'];_0x48ef9a+=0x1){_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')][_0x48ef9a]={'filename':_0x453a6[_0x4e24('0x59')]['attachments'][_0x48ef9a][_0x4e24('0x35')],'id':_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')][_0x48ef9a]['id'],'path':path['join'](config[_0x4e24('0xa6')],_0x4e24('0xa7'),_0x453a6['body'][_0x4e24('0xa5')][_0x48ef9a][_0x4e24('0xa8')])};}}return respondWithRpcPromise(_0x4e24('0xa9'),_0x4e24('0xa9'),{'FaxAccountId':_[_0x4e24('0xaa')](_0x453a6['params']['id'])?undefined:_0x453a6['params']['id'],'path':_[_0x4e24('0xaa')](_0x453a6['body'][_0x4e24('0xa5')][0x0]['path'])?undefined:_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')][0x0][_0x4e24('0xab')],'fax':_[_0x4e24('0xaa')](_0x453a6[_0x4e24('0x59')]['to'][0x0])?undefined:_0x453a6['body']['to'][0x0]},client9002);})[_0x4e24('0x1e')](function(){if(_0x3d24cb){if(_[_0x4e24('0xaa')](_0x453a6[_0x4e24('0x59')]['from'])){_0x453a6[_0x4e24('0x59')][_0x4e24('0xac')]=util[_0x4e24('0x9e')](_0x4e24('0xad'),_0x3d24cb[_0x4e24('0x35')],_0x3d24cb[_0x4e24('0xae')]);}if(_0x3d24cb[_0x4e24('0xaf')]){if(_0x3d24cb[_0x4e24('0xaf')][_0x4e24('0xa2')][_0x4e24('0x55')]){return _0x3d24cb[_0x4e24('0xaf')][_0x4e24('0xa2')][0x0];}else{return db[_0x4e24('0x72')][_0x4e24('0x58')](_[_0x4e24('0x16')](_0x453a6['body'],{'firstName':_0x453a6[_0x4e24('0x59')]['to'][0x0],'phone':_0x453a6['body']['to'][0x0],'fax':_0x453a6['body']['to'][0x0],'ListId':_0x3d24cb[_0x4e24('0x99')]}));}}else{throw new Error(_0x4e24('0xb0'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x3e3cdc){if(_0x3e3cdc){return db[_0x4e24('0x6f')][_0x4e24('0x57')]({'where':{'ContactId':_0x3e3cdc['id'],'closed':![],'FaxAccountId':_0x3d24cb['id']}})[_0x4e24('0x1e')](function(_0x39d2a4){if(_0x39d2a4){return[_0x39d2a4,![]];}return db[_0x4e24('0x6f')][_0x4e24('0x58')]({'UserId':_0x453a6[_0x4e24('0x5a')]['id'],'ContactId':_0x3e3cdc['id'],'FaxAccountId':_0x3d24cb['id'],'fax':_0x453a6['body']['to'][0x0],'firstMsgDirection':_0x4e24('0xb1'),'Messages':[_[_0x4e24('0x4b')](_0x453a6['body'],{'read':![],'body':_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')][0x0]['filename'],'FaxAccountId':_0x3d24cb['id'],'UserId':_0x453a6[_0x4e24('0x5a')]['id'],'ContactId':_0x3e3cdc['id'],'AttachmentId':_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0x4e24('0xa0')],'as':_0x4e24('0xb2')}]})['then'](function(_0x5d4b8f){return[_0x5d4b8f,!![]];});});}else{throw new Error(_0x4e24('0xb3'));}})[_0x4e24('0xb4')](function(_0x32ff09,_0x1250ed){if(_0x1250ed){return _0x32ff09;}return db[_0x4e24('0xa0')][_0x4e24('0x58')]({'direction':_0x4e24('0xb1'),'read':![],'body':_0x453a6['body'][_0x4e24('0xa5')][0x0][_0x4e24('0xb5')],'FaxAccountId':_0x3d24cb['id'],'FaxInteractionId':_0x32ff09['id'],'UserId':_0x453a6[_0x4e24('0x5a')]['id'],'ContactId':_0x32ff09['ContactId'],'AttachmentId':_0x453a6['body'][_0x4e24('0xa5')][0x0]['id']})[_0x4e24('0x1e')](function(_0x39da9b){_0x32ff09[_0x4e24('0xb6')][_0x4e24('0xb2')]=[];_0x32ff09[_0x4e24('0xb6')]['Messages'][_0x4e24('0x89')](_0x39da9b[_0x4e24('0xb6')]);return _0x32ff09;});})[_0x4e24('0x1e')](function(_0x1208a0){respondWithRpcPromise(_0x4e24('0xb7'),_0x4e24('0xb7'),{'FaxAccountId':_[_0x4e24('0xaa')](_0x453a6[_0x4e24('0x53')]['id'])?undefined:_0x453a6[_0x4e24('0x53')]['id'],'path':_[_0x4e24('0xaa')](_0x453a6[_0x4e24('0x59')]['attachments'][0x0][_0x4e24('0xab')])?undefined:_0x453a6['body'][_0x4e24('0xa5')][0x0][_0x4e24('0xab')],'fax':_[_0x4e24('0xaa')](_0x453a6[_0x4e24('0x59')]['to'][0x0])?undefined:_0x453a6[_0x4e24('0x59')]['to'][0x0],'AttachmentId':_0x453a6[_0x4e24('0x59')][_0x4e24('0xa5')][0x0]['id']},client9002)['then'](function(_0x37dbce){logger[_0x4e24('0x1f')](_0x4e24('0xb8'),_0x37dbce);})[_0x4e24('0x51')](function(_0x16e564){logger[_0x4e24('0x1f')](_0x4e24('0xb8'),_0x16e564);});return _0x1208a0;})[_0x4e24('0x1e')](respondWithResult(_0x27604a,null))['catch'](handleError(_0x27604a,null));};exports['addAgents']=function(_0x4946e9,_0x3f30bc,_0x2fcdac){return db[_0x4e24('0x39')]['find']({'where':{'id':_0x4946e9[_0x4e24('0x53')]['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0x3f30bc,null))[_0x4e24('0x1e')](function(_0x28af94){if(_0x28af94){return _0x28af94[_0x4e24('0xb9')](_0x4946e9['body'][_0x4e24('0x69')],_[_0x4e24('0x70')](_0x4946e9[_0x4e24('0x59')],[_0x4e24('0x69'),'id'])||{})[_0x4e24('0xb4')](function(_0x430ecd){for(var _0x5dd5dc=0x0;_0x5dd5dc<_0x4946e9['body'][_0x4e24('0x69')][_0x4e24('0x55')];_0x5dd5dc+=0x1){socket[_0x4e24('0xba')]('userFaxAccount:save',{'UserId':Number(_0x4946e9[_0x4e24('0x59')][_0x4e24('0x69')][_0x5dd5dc]),'FaxAccountId':Number(_0x4946e9[_0x4e24('0x53')]['id'])});}return _0x430ecd;});}})[_0x4e24('0x1e')](respondWithResult(_0x3f30bc,null))[_0x4e24('0x51')](handleError(_0x3f30bc,null));};exports['removeAgents']=function(_0x1d4a47,_0x129d25,_0x2ffd19){return db[_0x4e24('0x39')][_0x4e24('0x57')]({'where':{'id':_0x1d4a47[_0x4e24('0x53')]['id']}})[_0x4e24('0x1e')](handleEntityNotFound(_0x129d25,null))[_0x4e24('0x1e')](function(_0x58de57){if(_0x58de57){return _0x58de57[_0x4e24('0xbb')](_0x1d4a47[_0x4e24('0x3f')][_0x4e24('0x69')])[_0x4e24('0x1e')](function(){if(_[_0x4e24('0xbc')](_0x1d4a47['query']['ids'])){for(var _0x42d7f6=0x0;_0x42d7f6<_0x1d4a47[_0x4e24('0x3f')]['ids'][_0x4e24('0x55')];_0x42d7f6+=0x1){socket[_0x4e24('0xba')]('userFaxAccount:remove',{'UserId':Number(_0x1d4a47[_0x4e24('0x3f')][_0x4e24('0x69')][_0x42d7f6]),'FaxAccountId':Number(_0x1d4a47[_0x4e24('0x53')]['id'])});}}else{socket[_0x4e24('0xba')](_0x4e24('0xbd'),{'UserId':Number(_0x1d4a47[_0x4e24('0x3f')][_0x4e24('0x69')]),'FaxAccountId':Number(_0x1d4a47[_0x4e24('0x53')]['id'])});}});}})[_0x4e24('0x1e')](respondWithStatusCode(_0x129d25,null))[_0x4e24('0x51')](handleError(_0x129d25,null));};exports[_0x4e24('0xbe')]=function(_0x334e75,_0x3cf2ba,_0x578f9f){var _0x444b45={};var _0x4d3e8a={};var _0x1ecf4e;var _0x5ddc5f;return db[_0x4e24('0x39')]['findOne']({'where':{'id':_0x334e75[_0x4e24('0x53')]['id']}})['then'](handleEntityNotFound(_0x3cf2ba,null))[_0x4e24('0x1e')](function(_0x28ee2a){if(_0x28ee2a){_0x1ecf4e=_0x28ee2a;_0x4d3e8a[_0x4e24('0x41')]=_[_0x4e24('0x3e')](db[_0x4e24('0x73')][_0x4e24('0x3a')]);_0x4d3e8a[_0x4e24('0x3f')]=_['keys'](_0x334e75['query']);_0x4d3e8a[_0x4e24('0x49')]=_[_0x4e24('0x40')](_0x4d3e8a['model'],_0x4d3e8a[_0x4e24('0x3f')]);_0x444b45[_0x4e24('0x42')]=_[_0x4e24('0x40')](_0x4d3e8a[_0x4e24('0x41')],qs['fields'](_0x334e75[_0x4e24('0x3f')][_0x4e24('0x54')]));_0x444b45[_0x4e24('0x42')]=_0x444b45['attributes'][_0x4e24('0x55')]?_0x444b45[_0x4e24('0x42')]:_0x4d3e8a[_0x4e24('0x41')];_0x444b45['order']=qs[_0x4e24('0x47')](_0x334e75[_0x4e24('0x3f')]['sort']);_0x444b45[_0x4e24('0x4a')]=qs[_0x4e24('0x49')](_[_0x4e24('0x48')](_0x334e75[_0x4e24('0x3f')],_0x4d3e8a[_0x4e24('0x49')]));if(_0x334e75[_0x4e24('0x3f')][_0x4e24('0x66')]){_0x444b45['where']=_[_0x4e24('0x4b')](_0x444b45[_0x4e24('0x4a')],{'$or':_['map'](_0x444b45[_0x4e24('0x42')],function(_0x48d3d9){var _0x3b8a9c={};_0x3b8a9c[_0x48d3d9]={'$like':'%'+_0x334e75[_0x4e24('0x3f')][_0x4e24('0x66')]+'%'};return _0x3b8a9c;})});}_0x444b45=_[_0x4e24('0x4b')]({},_0x444b45,_0x334e75[_0x4e24('0x56')]);return _0x1ecf4e[_0x4e24('0xbe')](_0x444b45);}})[_0x4e24('0x1e')](function(_0x28b5eb){if(_0x28b5eb){_0x5ddc5f=_0x28b5eb[_0x4e24('0x55')];if(!_0x334e75[_0x4e24('0x3f')][_0x4e24('0x43')](_0x4e24('0x44'))){_0x444b45[_0x4e24('0x45')]=qs[_0x4e24('0x45')](_0x334e75['query']['limit']);_0x444b45[_0x4e24('0x28')]=qs['offset'](_0x334e75['query'][_0x4e24('0x28')]);}return _0x1ecf4e[_0x4e24('0xbe')](_0x444b45);}})['then'](function(_0xe45e7b){if(_0xe45e7b){return _0xe45e7b?{'count':_0x5ddc5f,'rows':_0xe45e7b}:null;}})[_0x4e24('0x1e')](respondWithResult(_0x3cf2ba,null))[_0x4e24('0x51')](handleError(_0x3cf2ba,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 9d33b87..c792d59 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 _0xdd7e=['hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit'];(function(_0x29d311,_0x4ec403){var _0x52686f=function(_0x12f5dd){while(--_0x12f5dd){_0x29d311['push'](_0x29d311['shift']());}};_0x52686f(++_0x4ec403);}(_0xdd7e,0x124));var _0xedd7=function(_0x4ec29e,_0x4af919){_0x4ec29e=_0x4ec29e-0x0;var _0x3d200c=_0xdd7e[_0x4ec29e];return _0x3d200c;};'use strict';var EventEmitter=require(_0xedd7('0x0'));var FaxAccount=require(_0xedd7('0x1'))['db'][_0xedd7('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xedd7('0x3')](0x0);var events={'afterCreate':_0xedd7('0x4'),'afterUpdate':_0xedd7('0x5'),'afterDestroy':_0xedd7('0x6')};function emitEvent(_0x3f8f3d){return function(_0x153b6b,_0x5f0ad3,_0x3a582b){FaxAccountEvents[_0xedd7('0x7')](_0x3f8f3d+':'+_0x153b6b['id'],_0x153b6b);FaxAccountEvents[_0xedd7('0x7')](_0x3f8f3d,_0x153b6b);_0x3a582b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xedd7('0x8')](e,emitEvent(event));}}module[_0xedd7('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xe44d=['emit','hasOwnProperty','hook','events','FaxAccount','setMaxListeners','save','update','remove'];(function(_0x1306e9,_0x4fd1ce){var _0x15eafb=function(_0x16ebed){while(--_0x16ebed){_0x1306e9['push'](_0x1306e9['shift']());}};_0x15eafb(++_0x4fd1ce);}(_0xe44d,0xc0));var _0xde44=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xe44d[_0x5c2e3e];return _0x53f64a;};'use strict';var EventEmitter=require(_0xde44('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xde44('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xde44('0x2')](0x0);var events={'afterCreate':_0xde44('0x3'),'afterUpdate':_0xde44('0x4'),'afterDestroy':_0xde44('0x5')};function emitEvent(_0x70ab4d){return function(_0x51e32,_0x534872,_0x27d5da){FaxAccountEvents[_0xde44('0x6')](_0x70ab4d+':'+_0x51e32['id'],_0x51e32);FaxAccountEvents[_0xde44('0x6')](_0x70ab4d,_0x51e32);_0x27d5da(null);};}for(var e in events){if(events[_0xde44('0x7')](e)){var event=events[e];FaxAccount[_0xde44('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 93e69c2..4227384 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 _0xed0c=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxAccount.attributes','exports','FaxAccount'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0xed0c,0x1b8));var _0xced0=function(_0x4991bb,_0x1cb59b){_0x4991bb=_0x4991bb-0x0;var _0x1e14a8=_0xed0c[_0x4991bb];return _0x1e14a8;};'use strict';var _=require(_0xced0('0x0'));var util=require(_0xced0('0x1'));var logger=require(_0xced0('0x2'))(_0xced0('0x3'));var moment=require(_0xced0('0x4'));var BPromise=require('bluebird');var rp=require(_0xced0('0x5'));var fs=require('fs');var path=require(_0xced0('0x6'));var rimraf=require('rimraf');var config=require(_0xced0('0x7'));var attributes=require(_0xced0('0x8'));module[_0xced0('0x9')]=function(_0x12886c,_0x3e3461){return _0x12886c['define'](_0xced0('0xa'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8270=['bluebird','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x2d992e,_0x19de68){var _0x336657=function(_0x1b479f){while(--_0x1b479f){_0x2d992e['push'](_0x2d992e['shift']());}};_0x336657(++_0x19de68);}(_0x8270,0x10c));var _0x0827=function(_0x4d133d,_0x562833){_0x4d133d=_0x4d133d-0x0;var _0x375d87=_0x8270[_0x4d133d];return _0x375d87;};'use strict';var _=require(_0x0827('0x0'));var util=require(_0x0827('0x1'));var logger=require(_0x0827('0x2'))(_0x0827('0x3'));var moment=require(_0x0827('0x4'));var BPromise=require(_0x0827('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0827('0x6'));var config=require(_0x0827('0x7'));var attributes=require(_0x0827('0x8'));module[_0x0827('0x9')]=function(_0xb6357e,_0x2ff546){return _0xb6357e[_0x0827('0xa')](_0x0827('0xb'),attributes,{'tableName':_0x0827('0xc'),'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 f0d4084..5b6d14b 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 _0xe4d6=['find','account','Contacts','Applications','get','list','applications','orderBy','priority','asc','List','length','FaxInteraction','create','Contact\x20not\x20found','spread','autoclose','push','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','queue','startRouting','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','map','include','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','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'];(function(_0xec4a7c,_0x207660){var _0x3f8bfa=function(_0x5e5cde){while(--_0x5e5cde){_0xec4a7c['push'](_0xec4a7c['shift']());}};_0x3f8bfa(++_0x207660);}(_0xe4d6,0x129));var _0x6e4d=function(_0x4d9118,_0x47087d){_0x4d9118=_0x4d9118-0x0;var _0x76c720=_0xe4d6[_0x4d9118];return _0x76c720;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e4d('0x0'));var BPromise=require(_0x6e4d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e4d('0x2'));var db=require(_0x6e4d('0x3'))['db'];var utils=require(_0x6e4d('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6e4d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6e4d('0x6')][_0x6e4d('0x7')]({'port':0x232c});config[_0x6e4d('0x8')]=_[_0x6e4d('0x9')](config[_0x6e4d('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6e4d('0x8')]));require(_0x6e4d('0xa'))[_0x6e4d('0xb')](socket);function respondWithRpcPromise(_0x5497fe,_0x557c79,_0x454c4c){return new BPromise(function(_0x2e7a5e,_0x3614a4){return client[_0x6e4d('0xc')](_0x5497fe,_0x454c4c)[_0x6e4d('0xd')](function(_0x3fd8bf){logger[_0x6e4d('0xe')](_0x6e4d('0xf'),_0x557c79,_0x6e4d('0x10'));logger[_0x6e4d('0x11')](_0x6e4d('0x12'),_0x557c79,_0x6e4d('0x10'),JSON[_0x6e4d('0x13')](_0x3fd8bf));if(_0x3fd8bf[_0x6e4d('0x14')]){if(_0x3fd8bf[_0x6e4d('0x14')]['code']===0x1f4){logger[_0x6e4d('0x14')](_0x6e4d('0xf'),_0x557c79,_0x3fd8bf[_0x6e4d('0x14')][_0x6e4d('0x15')]);return _0x3614a4(_0x3fd8bf[_0x6e4d('0x14')]['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x557c79,_0x3fd8bf['error'][_0x6e4d('0x15')]);return _0x2e7a5e(_0x3fd8bf[_0x6e4d('0x14')][_0x6e4d('0x15')]);}else{logger[_0x6e4d('0xe')](_0x6e4d('0xf'),_0x557c79,'request\x20sent');_0x2e7a5e(_0x3fd8bf[_0x6e4d('0x16')][_0x6e4d('0x15')]);}})['catch'](function(_0x437363){logger[_0x6e4d('0x14')](_0x6e4d('0xf'),_0x557c79,_0x437363);_0x3614a4(_0x437363);});});}exports[_0x6e4d('0x17')]=function(_0x51c3bd){var _0xa29056=this;return new Promise(function(_0x143079,_0x158613){return db[_0x6e4d('0x18')][_0x6e4d('0x19')]({'raw':_0x51c3bd[_0x6e4d('0x1a')]?_0x51c3bd[_0x6e4d('0x1a')][_0x6e4d('0x1b')]===undefined?!![]:![]:!![],'where':_0x51c3bd['options']?_0x51c3bd[_0x6e4d('0x1a')][_0x6e4d('0x1c')]||null:null,'attributes':_0x51c3bd[_0x6e4d('0x1a')]?_0x51c3bd[_0x6e4d('0x1a')][_0x6e4d('0x1d')]||null:null,'limit':_0x51c3bd[_0x6e4d('0x1a')]?_0x51c3bd['options'][_0x6e4d('0x1e')]||null:null,'include':_0x51c3bd['options']?_0x51c3bd[_0x6e4d('0x1a')]['include']?_[_0x6e4d('0x1f')](_0x51c3bd[_0x6e4d('0x1a')]['include'],function(_0x1def08){return{'model':db[_0x1def08['model']],'as':_0x1def08['as'],'attributes':_0x1def08[_0x6e4d('0x1d')],'include':_0x1def08[_0x6e4d('0x20')]?_[_0x6e4d('0x1f')](_0x1def08[_0x6e4d('0x20')],function(_0x5761a1){return{'model':db[_0x5761a1['model']],'as':_0x5761a1['as'],'attributes':_0x5761a1['attributes'],'include':_0x5761a1['include']?_['map'](_0x5761a1[_0x6e4d('0x20')],function(_0x260646){return{'model':db[_0x260646[_0x6e4d('0x21')]],'as':_0x260646['as'],'attributes':_0x260646[_0x6e4d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6e4d('0xd')](function(_0x4c6853){logger['info'](_0x6e4d('0x17'),_0x51c3bd);logger['debug'](_0x6e4d('0x17'),_0x51c3bd,JSON['stringify'](_0x4c6853));_0x143079(_0x4c6853);})['catch'](function(_0x5eb5d7){logger[_0x6e4d('0x14')](_0x6e4d('0x17'),_0x5eb5d7['message'],_0x51c3bd);_0x158613(_0xa29056[_0x6e4d('0x14')](0x1f4,_0x5eb5d7[_0x6e4d('0x15')]));});});};exports[_0x6e4d('0x22')]=function(_0x50cb86,_0x281aaa,_0x2e0cee){var _0x58a11a=this;return new Promise(function(_0x6b69c4,_0x5d3a5b){var _0x45d476={'body':_0x50cb86[_0x6e4d('0x23')],'channel':_0x6e4d('0x24')};var _0x40dd2d=[];var _0x3c133b=[];var _0x1d6fb1={};return db[_0x6e4d('0x25')][_0x6e4d('0x26')]()[_0x6e4d('0xd')](function(_0x5bcce4){if(!_0x5bcce4){throw new db[(_0x6e4d('0x27'))]['ValidationError']('no\x20available\x20attributes');}_0x40dd2d=_[_0x6e4d('0x28')](_[_0x6e4d('0x29')](_0x5bcce4),[_0x6e4d('0x2a'),'updatedAt']);_0x3c133b=_[_0x6e4d('0x28')](_[_0x6e4d('0x29')](_0x5bcce4),[_0x6e4d('0x2a'),_0x6e4d('0x2b'),_0x6e4d('0x2c'),_0x6e4d('0x2d')]);if(_0x50cb86['body']['id']){delete _0x50cb86['body']['id'];}if(_[_0x6e4d('0x2e')](_0x50cb86[_0x6e4d('0x23')][_0x6e4d('0x2f')])){throw new db[(_0x6e4d('0x27'))][(_0x6e4d('0x30'))](_0x6e4d('0x31'));}if(_[_0x6e4d('0x2e')](_0x50cb86[_0x6e4d('0x23')][_0x6e4d('0x23')])||_0x50cb86[_0x6e4d('0x23')]['body']===''){throw new db[(_0x6e4d('0x27'))]['ValidationError'](_0x6e4d('0x32'));}if(_[_0x6e4d('0x2e')](_0x50cb86[_0x6e4d('0x23')][_0x6e4d('0x33')])){throw new db[(_0x6e4d('0x27'))][(_0x6e4d('0x30'))](_0x6e4d('0x34')+_0x3c133b);}if(!_[_0x6e4d('0x35')](_0x3c133b,_0x50cb86['body']['mapKey'])){throw new db[(_0x6e4d('0x27'))][(_0x6e4d('0x30'))](_0x6e4d('0x36')+_0x3c133b);}_0x1d6fb1[_0x50cb86[_0x6e4d('0x23')][_0x6e4d('0x33')]]=_0x50cb86[_0x6e4d('0x23')][_0x6e4d('0x2f')];})['then'](function(){return db['FaxAccount'][_0x6e4d('0x37')]({'where':{'id':_0x50cb86[_0x6e4d('0x38')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x6e4d('0x25')],'as':_0x6e4d('0x39'),'where':_0x1d6fb1,'limit':0x1,'order':[[_0x6e4d('0x2b'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x6e4d('0x3a')}]});})[_0x6e4d('0xd')](function(_0x319bfb){if(_0x319bfb&&_0x319bfb['List']){var _0x8933b2=_0x319bfb[_0x6e4d('0x3b')]({'plain':!![]});_0x45d476[_0x6e4d('0x38')]=_0x8933b2;_0x45d476['applications']=_0x8933b2[_0x6e4d('0x3a')];_0x45d476[_0x6e4d('0x3c')]=_0x8933b2['List'];_0x45d476[_0x6e4d('0x3d')]=_[_0x6e4d('0x3e')](_0x45d476[_0x6e4d('0x3d')],[_0x6e4d('0x3f')],[_0x6e4d('0x40')]);if(_0x45d476[_0x6e4d('0x38')][_0x6e4d('0x3a')]){delete _0x45d476[_0x6e4d('0x38')]['Applications'];}if(_0x45d476['account']['List']&&_0x45d476[_0x6e4d('0x38')][_0x6e4d('0x41')][_0x6e4d('0x39')][_0x6e4d('0x42')]){return _0x45d476['account'][_0x6e4d('0x41')]['Contacts'][0x0];}var _0x51d482=_[_0x6e4d('0x9')](_0x50cb86[_0x6e4d('0x23')],{'firstName':_0x50cb86['body']['from'],'ListId':_0x8933b2['ListId']});_0x51d482[_0x50cb86[_0x6e4d('0x23')][_0x6e4d('0x33')]]=_0x50cb86['body']['from'];return db[_0x6e4d('0x25')]['create'](_0x51d482,{'fields':_0x40dd2d,'raw':!![]});}})[_0x6e4d('0xd')](function(_0x3a0f58){_0x45d476['contact']=_0x3a0f58;if(_0x3a0f58){var _0x48823a={'ContactId':_0x3a0f58['id'],'FaxAccountId':_0x50cb86[_0x6e4d('0x38')]['id'],'fax':_0x3a0f58['fax']};return db[_0x6e4d('0x43')][_0x6e4d('0x37')]({'where':{'ContactId':_0x3a0f58['id'],'closed':![],'FaxAccountId':_0x50cb86[_0x6e4d('0x38')]['id']}})[_0x6e4d('0xd')](function(_0x49a2f3){if(_0x49a2f3){return[_0x49a2f3,![]];}return db[_0x6e4d('0x43')][_0x6e4d('0x44')](_0x48823a)[_0x6e4d('0xd')](function(_0x31d1fd){return[_0x31d1fd,!![]];});});}else{throw new Error(_0x6e4d('0x45'));}})[_0x6e4d('0x46')](function(_0x4bf162,_0x4248b8){var _0x309b37=_0x4bf162[_0x6e4d('0x3b')]({'plain':!![]});if(_0x4248b8){if(_0x45d476[_0x6e4d('0x38')][_0x6e4d('0x47')]){_0x45d476['applications'][_0x6e4d('0x48')]({'id':0x0,'priority':_0x45d476[_0x6e4d('0x3d')][_0x6e4d('0x42')]+0x1,'app':'close','appdata':_0x6e4d('0x49'),'interval':'*,*,*,*'});}_0x309b37[_0x6e4d('0x4a')]=!![];}else{_0x309b37[_0x6e4d('0x4a')]=![];}_0x45d476[_0x6e4d('0x4b')]=_0x309b37;return db[_0x6e4d('0x4c')][_0x6e4d('0x44')]({'body':_0x50cb86['body'][_0x6e4d('0x23')],'FaxAccountId':_0x50cb86[_0x6e4d('0x38')]['id'],'FaxInteractionId':_0x4bf162['id'],'direction':'in','ContactId':_0x4bf162[_0x6e4d('0x4d')],'AttachmentId':_0x50cb86[_0x6e4d('0x23')][_0x6e4d('0x4e')]});})[_0x6e4d('0xd')](function(_0x143112){_0x45d476['message']=_0x143112;if(!_0x45d476['interaction']['UserId'])return;return db[_0x6e4d('0x4f')][_0x6e4d('0x37')]({'attributes':['id',_0x6e4d('0x50')],'where':{'id':_0x45d476[_0x6e4d('0x4b')][_0x6e4d('0x51')]}});})[_0x6e4d('0xd')](function(_0x2732f5){if(_0x2732f5){_0x45d476[_0x6e4d('0x3d')][_0x6e4d('0x52')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2732f5[_0x6e4d('0x50')]+','+(_0x45d476[_0x6e4d('0x38')][_0x6e4d('0x53')]||0xa),'interval':_0x6e4d('0x54')});}if(!_0x45d476[_0x6e4d('0x4b')][_0x6e4d('0x55')])return;return db['FaxQueue']['find']({'attributes':['id',_0x6e4d('0x50')],'where':{'id':_0x45d476[_0x6e4d('0x4b')][_0x6e4d('0x55')]}});})['then'](function(_0x433c8a){if(_0x433c8a){_0x45d476[_0x6e4d('0x3d')]['unshift']({'id':0x0,'priority':0x1,'app':_0x6e4d('0x56'),'appdata':_0x433c8a[_0x6e4d('0x50')]+','+(_0x45d476[_0x6e4d('0x38')]['waitForTheAssignedQueue']||0x12c),'interval':_0x6e4d('0x54')});}return respondWithRpcPromise('Start',_0x6e4d('0x57'),_0x45d476);})['then'](function(_0x5ff435){_0x6b69c4(_0x5ff435);})['catch'](function(_0x36d03f){_0x5d3a5b(_0x58a11a['error'](0x1f4,_0x36d03f[_0x6e4d('0x15')]));});});}; \ No newline at end of file +var _0xb4fa=['find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','orderBy','asc','length','create','contact','FaxInteraction','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','agent','queueId','FaxQueue','unshift','waitForTheAssignedQueue','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./faxAccount.socket','register','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','NotifyFaxAccount','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','keys','createdAt','difference','updatedAt','ListId','body','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes'];(function(_0x224df3,_0x4bee29){var _0x544b14=function(_0x571be3){while(--_0x571be3){_0x224df3['push'](_0x224df3['shift']());}};_0x544b14(++_0x4bee29);}(_0xb4fa,0x82));var _0xab4f=function(_0x2f8d1d,_0x23e53e){_0x2f8d1d=_0x2f8d1d-0x0;var _0x23890d=_0xb4fa[_0x2f8d1d];return _0x23890d;};'use strict';var _=require('lodash');var util=require(_0xab4f('0x0'));var moment=require(_0xab4f('0x1'));var BPromise=require(_0xab4f('0x2'));var rs=require(_0xab4f('0x3'));var fs=require('fs');var Redis=require(_0xab4f('0x4'));var db=require(_0xab4f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xab4f('0x6'))(_0xab4f('0x7'));var config=require('../../config/environment');var jayson=require(_0xab4f('0x8'));var client=jayson[_0xab4f('0x9')]['http']({'port':0x232c});config[_0xab4f('0xa')]=_[_0xab4f('0xb')](config[_0xab4f('0xa')],{'host':_0xab4f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab4f('0xa')]));require(_0xab4f('0xd'))[_0xab4f('0xe')](socket);function respondWithRpcPromise(_0x1dd0b0,_0x2bd57f,_0x2f78eb){return new BPromise(function(_0x41c2df,_0x2ef8f5){return client[_0xab4f('0xf')](_0x1dd0b0,_0x2f78eb)['then'](function(_0x43001d){logger[_0xab4f('0x10')]('FaxAccount,\x20%s,\x20%s',_0x2bd57f,_0xab4f('0x11'));logger[_0xab4f('0x12')](_0xab4f('0x13'),_0x2bd57f,_0xab4f('0x11'),JSON['stringify'](_0x43001d));if(_0x43001d[_0xab4f('0x14')]){if(_0x43001d[_0xab4f('0x14')][_0xab4f('0x15')]===0x1f4){logger[_0xab4f('0x14')](_0xab4f('0x16'),_0x2bd57f,_0x43001d[_0xab4f('0x14')][_0xab4f('0x17')]);return _0x2ef8f5(_0x43001d['error'][_0xab4f('0x17')]);}logger[_0xab4f('0x14')](_0xab4f('0x16'),_0x2bd57f,_0x43001d[_0xab4f('0x14')][_0xab4f('0x17')]);return _0x41c2df(_0x43001d['error'][_0xab4f('0x17')]);}else{logger['info'](_0xab4f('0x16'),_0x2bd57f,'request\x20sent');_0x41c2df(_0x43001d[_0xab4f('0x18')][_0xab4f('0x17')]);}})[_0xab4f('0x19')](function(_0x432c86){logger[_0xab4f('0x14')](_0xab4f('0x16'),_0x2bd57f,_0x432c86);_0x2ef8f5(_0x432c86);});});}exports[_0xab4f('0x1a')]=function(_0x251a5f){var _0x3259a3=this;return new Promise(function(_0x437536,_0x3122c7){return db[_0xab4f('0x1b')][_0xab4f('0x1c')]({'raw':_0x251a5f['options']?_0x251a5f[_0xab4f('0x1d')][_0xab4f('0x1e')]===undefined?!![]:![]:!![],'where':_0x251a5f['options']?_0x251a5f[_0xab4f('0x1d')][_0xab4f('0x1f')]||null:null,'attributes':_0x251a5f[_0xab4f('0x1d')]?_0x251a5f[_0xab4f('0x1d')][_0xab4f('0x20')]||null:null,'limit':_0x251a5f[_0xab4f('0x1d')]?_0x251a5f['options'][_0xab4f('0x21')]||null:null,'include':_0x251a5f[_0xab4f('0x1d')]?_0x251a5f['options'][_0xab4f('0x22')]?_[_0xab4f('0x23')](_0x251a5f[_0xab4f('0x1d')][_0xab4f('0x22')],function(_0x2d2790){return{'model':db[_0x2d2790[_0xab4f('0x24')]],'as':_0x2d2790['as'],'attributes':_0x2d2790[_0xab4f('0x20')],'include':_0x2d2790[_0xab4f('0x22')]?_[_0xab4f('0x23')](_0x2d2790['include'],function(_0x4a00dc){return{'model':db[_0x4a00dc['model']],'as':_0x4a00dc['as'],'attributes':_0x4a00dc[_0xab4f('0x20')],'include':_0x4a00dc[_0xab4f('0x22')]?_[_0xab4f('0x23')](_0x4a00dc['include'],function(_0x335ba4){return{'model':db[_0x335ba4['model']],'as':_0x335ba4['as'],'attributes':_0x335ba4['attributes']};}):[]};}):[]};}):[]:[]})[_0xab4f('0x25')](function(_0x39ce27){logger[_0xab4f('0x10')](_0xab4f('0x1a'),_0x251a5f);logger[_0xab4f('0x12')](_0xab4f('0x1a'),_0x251a5f,JSON['stringify'](_0x39ce27));_0x437536(_0x39ce27);})[_0xab4f('0x19')](function(_0x5e48fa){logger['error'](_0xab4f('0x1a'),_0x5e48fa[_0xab4f('0x17')],_0x251a5f);_0x3122c7(_0x3259a3[_0xab4f('0x14')](0x1f4,_0x5e48fa[_0xab4f('0x17')]));});});};exports[_0xab4f('0x26')]=function(_0x5c5fd0,_0x4b0f4d,_0xdf8c00){var _0x26938f=this;return new Promise(function(_0x3d85f5,_0x13e1fb){var _0x7e3d23={'body':_0x5c5fd0['body'],'channel':_0xab4f('0x27')};var _0x57ed32=[];var _0x103954=[];var _0x576d24={};return db[_0xab4f('0x28')][_0xab4f('0x29')]()['then'](function(_0x576fc8){if(!_0x576fc8){throw new db[(_0xab4f('0x2a'))]['ValidationError'](_0xab4f('0x2b'));}_0x57ed32=_['difference'](_[_0xab4f('0x2c')](_0x576fc8),[_0xab4f('0x2d'),'updatedAt']);_0x103954=_[_0xab4f('0x2e')](_['keys'](_0x576fc8),[_0xab4f('0x2d'),_0xab4f('0x2f'),'CompanyId',_0xab4f('0x30')]);if(_0x5c5fd0['body']['id']){delete _0x5c5fd0[_0xab4f('0x31')]['id'];}if(_['isNil'](_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x32')])){throw new db[(_0xab4f('0x2a'))][(_0xab4f('0x33'))](_0xab4f('0x34'));}if(_['isNil'](_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x31')])||_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x31')]===''){throw new db[(_0xab4f('0x2a'))][(_0xab4f('0x33'))](_0xab4f('0x35'));}if(_[_0xab4f('0x36')](_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x37')])){throw new db['Sequelize'][(_0xab4f('0x33'))](_0xab4f('0x38')+_0x103954);}if(!_[_0xab4f('0x39')](_0x103954,_0x5c5fd0['body'][_0xab4f('0x37')])){throw new db['Sequelize'][(_0xab4f('0x33'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x103954);}_0x576d24[_0x5c5fd0['body'][_0xab4f('0x37')]]=_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x32')];})[_0xab4f('0x25')](function(){return db[_0xab4f('0x1b')][_0xab4f('0x3a')]({'where':{'id':_0x5c5fd0[_0xab4f('0x3b')]['id']},'include':[{'model':db[_0xab4f('0x3c')],'as':_0xab4f('0x3d'),'include':[{'model':db[_0xab4f('0x28')],'as':_0xab4f('0x3e'),'where':_0x576d24,'limit':0x1,'order':[[_0xab4f('0x2f'),_0xab4f('0x3f')]]}]},{'model':db[_0xab4f('0x40')],'as':_0xab4f('0x41')}]});})[_0xab4f('0x25')](function(_0x2b4aad){if(_0x2b4aad&&_0x2b4aad[_0xab4f('0x3d')]){var _0x45731e=_0x2b4aad[_0xab4f('0x42')]({'plain':!![]});_0x7e3d23[_0xab4f('0x3b')]=_0x45731e;_0x7e3d23[_0xab4f('0x43')]=_0x45731e[_0xab4f('0x41')];_0x7e3d23['list']=_0x45731e[_0xab4f('0x3d')];_0x7e3d23[_0xab4f('0x43')]=_[_0xab4f('0x44')](_0x7e3d23[_0xab4f('0x43')],['priority'],[_0xab4f('0x45')]);if(_0x7e3d23[_0xab4f('0x3b')][_0xab4f('0x41')]){delete _0x7e3d23[_0xab4f('0x3b')][_0xab4f('0x41')];}if(_0x7e3d23[_0xab4f('0x3b')][_0xab4f('0x3d')]&&_0x7e3d23['account'][_0xab4f('0x3d')][_0xab4f('0x3e')][_0xab4f('0x46')]){return _0x7e3d23['account']['List'][_0xab4f('0x3e')][0x0];}var _0x128b92=_[_0xab4f('0xb')](_0x5c5fd0['body'],{'firstName':_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x32')],'ListId':_0x45731e[_0xab4f('0x30')]});_0x128b92[_0x5c5fd0[_0xab4f('0x31')]['mapKey']]=_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x32')];return db[_0xab4f('0x28')][_0xab4f('0x47')](_0x128b92,{'fields':_0x57ed32,'raw':!![]});}})[_0xab4f('0x25')](function(_0x343c7b){_0x7e3d23[_0xab4f('0x48')]=_0x343c7b;if(_0x343c7b){var _0x2f6d69={'ContactId':_0x343c7b['id'],'FaxAccountId':_0x5c5fd0[_0xab4f('0x3b')]['id'],'fax':_0x343c7b[_0xab4f('0x27')]};return db['FaxInteraction'][_0xab4f('0x3a')]({'where':{'ContactId':_0x343c7b['id'],'closed':![],'FaxAccountId':_0x5c5fd0['account']['id']}})[_0xab4f('0x25')](function(_0x41eb97){if(_0x41eb97){return[_0x41eb97,![]];}return db[_0xab4f('0x49')]['create'](_0x2f6d69)[_0xab4f('0x25')](function(_0x1851fd){return[_0x1851fd,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xab4f('0x4a')](function(_0xa2ae7c,_0x4bd6e3){var _0x10add1=_0xa2ae7c[_0xab4f('0x42')]({'plain':!![]});if(_0x4bd6e3){if(_0x7e3d23[_0xab4f('0x3b')][_0xab4f('0x4b')]){_0x7e3d23['applications'][_0xab4f('0x4c')]({'id':0x0,'priority':_0x7e3d23[_0xab4f('0x43')][_0xab4f('0x46')]+0x1,'app':_0xab4f('0x4d'),'appdata':_0xab4f('0x4e'),'interval':_0xab4f('0x4f')});}_0x10add1['created']=!![];}else{_0x10add1[_0xab4f('0x50')]=![];}_0x7e3d23[_0xab4f('0x51')]=_0x10add1;return db[_0xab4f('0x52')][_0xab4f('0x47')]({'body':_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x31')],'FaxAccountId':_0x5c5fd0[_0xab4f('0x3b')]['id'],'FaxInteractionId':_0xa2ae7c['id'],'direction':'in','ContactId':_0xa2ae7c[_0xab4f('0x53')],'AttachmentId':_0x5c5fd0[_0xab4f('0x31')][_0xab4f('0x54')]});})[_0xab4f('0x25')](function(_0x2f7cdf){_0x7e3d23['message']=_0x2f7cdf;if(!_0x7e3d23[_0xab4f('0x51')][_0xab4f('0x55')])return;return db['User'][_0xab4f('0x3a')]({'attributes':['id',_0xab4f('0x56')],'where':{'id':_0x7e3d23[_0xab4f('0x51')]['UserId']}});})[_0xab4f('0x25')](function(_0x284c37){if(_0x284c37){_0x7e3d23[_0xab4f('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0xab4f('0x57'),'appdata':_0x284c37[_0xab4f('0x56')]+','+(_0x7e3d23[_0xab4f('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0xab4f('0x4f')});}if(!_0x7e3d23[_0xab4f('0x51')][_0xab4f('0x58')])return;return db[_0xab4f('0x59')][_0xab4f('0x3a')]({'attributes':['id',_0xab4f('0x56')],'where':{'id':_0x7e3d23['interaction'][_0xab4f('0x58')]}});})[_0xab4f('0x25')](function(_0x5ddbc4){if(_0x5ddbc4){_0x7e3d23[_0xab4f('0x43')][_0xab4f('0x5a')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x5ddbc4[_0xab4f('0x56')]+','+(_0x7e3d23['account'][_0xab4f('0x5b')]||0x12c),'interval':_0xab4f('0x4f')});}return respondWithRpcPromise(_0xab4f('0x5c'),_0xab4f('0x5d'),_0x7e3d23);})[_0xab4f('0x25')](function(_0x5528f0){_0x3d85f5(_0x5528f0);})[_0xab4f('0x19')](function(_0x540a84){_0x13e1fb(_0x26938f[_0xab4f('0x14')](0x1f4,_0x540a84[_0xab4f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index cf338f3..a8a297a 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 _0xbb8d=['remove','update','emit','removeListener','length','faxAccount:','./faxAccount.events'];(function(_0x3651e0,_0x3c3856){var _0x1cb5a7=function(_0x5be4b7){while(--_0x5be4b7){_0x3651e0['push'](_0x3651e0['shift']());}};_0x1cb5a7(++_0x3c3856);}(_0xbb8d,0xd1));var _0xdbb8=function(_0xabab90,_0x52dfd7){_0xabab90=_0xabab90-0x0;var _0x42fd9d=_0xbb8d[_0xabab90];return _0x42fd9d;};'use strict';var FaxAccountEvents=require(_0xdbb8('0x0'));var events=['save',_0xdbb8('0x1'),_0xdbb8('0x2')];function createListener(_0x52b79b,_0x49ce9a){return function(_0x28fadd){_0x49ce9a[_0xdbb8('0x3')](_0x52b79b,_0x28fadd);};}function removeListener(_0x1da9e4,_0x360dc2){return function(){FaxAccountEvents[_0xdbb8('0x4')](_0x1da9e4,_0x360dc2);};}exports['register']=function(_0x53a43f){for(var _0x384797=0x0,_0x8246e7=events[_0xdbb8('0x5')];_0x384797<_0x8246e7;_0x384797++){var _0x5e4300=events[_0x384797];var _0x1b61f2=createListener(_0xdbb8('0x6')+_0x5e4300,_0x53a43f);FaxAccountEvents['on'](_0x5e4300,_0x1b61f2);}}; \ No newline at end of file +var _0xa581=['register','faxAccount:','./faxAccount.events','save','update','emit','removeListener'];(function(_0x5b3008,_0x4fb270){var _0x33543b=function(_0x130dd4){while(--_0x130dd4){_0x5b3008['push'](_0x5b3008['shift']());}};_0x33543b(++_0x4fb270);}(_0xa581,0x159));var _0x1a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa581[_0x3dd15e];return _0x231fd0;};'use strict';var FaxAccountEvents=require(_0x1a58('0x0'));var events=[_0x1a58('0x1'),'remove',_0x1a58('0x2')];function createListener(_0x119078,_0xbd9422){return function(_0x410e55){_0xbd9422[_0x1a58('0x3')](_0x119078,_0x410e55);};}function removeListener(_0x41a01e,_0x888eb5){return function(){FaxAccountEvents[_0x1a58('0x4')](_0x41a01e,_0x888eb5);};}exports[_0x1a58('0x5')]=function(_0x34d9ea){for(var _0x414da2=0x0,_0x55f420=events['length'];_0x414da2<_0x55f420;_0x414da2++){var _0x229b43=events[_0x414da2];var _0x2c2f27=createListener(_0x1a58('0x6')+_0x229b43,_0x34d9ea);FaxAccountEvents['on'](_0x229b43,_0x2c2f27);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 5fe2eec..1fb46fa 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 _0x6cfa=['addApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','multer','connect-timeout','Router','fs-extra','./faxAccount.controller','get','isAuthenticated','index','/describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post','create','addAnswer','addInteraction'];(function(_0x4afa72,_0x296430){var _0x55a44b=function(_0x28d31c){while(--_0x28d31c){_0x4afa72['push'](_0x4afa72['shift']());}};_0x55a44b(++_0x296430);}(_0x6cfa,0xa1));var _0xa6cf=function(_0x285db,_0x4f4926){_0x285db=_0x285db-0x0;var _0x2ebec6=_0x6cfa[_0x285db];return _0x2ebec6;};'use strict';var multer=require(_0xa6cf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa6cf('0x1'));var express=require('express');var router=express[_0xa6cf('0x2')]();var fs_extra=require(_0xa6cf('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa6cf('0x4'));router[_0xa6cf('0x5')]('/',auth[_0xa6cf('0x6')](),controller[_0xa6cf('0x7')]);router[_0xa6cf('0x5')](_0xa6cf('0x8'),auth[_0xa6cf('0x6')](),controller['describe']);router[_0xa6cf('0x5')]('/:id',auth[_0xa6cf('0x6')](),controller['show']);router[_0xa6cf('0x5')](_0xa6cf('0x9'),auth[_0xa6cf('0x6')](),controller[_0xa6cf('0xa')]);router['get'](_0xa6cf('0xb'),auth[_0xa6cf('0x6')](),controller[_0xa6cf('0xc')]);router[_0xa6cf('0x5')](_0xa6cf('0xd'),auth['isAuthenticated'](),controller[_0xa6cf('0xe')]);router[_0xa6cf('0x5')](_0xa6cf('0xf'),auth[_0xa6cf('0x6')](),controller[_0xa6cf('0x10')]);router[_0xa6cf('0x5')](_0xa6cf('0x11'),auth['isAuthenticated'](),controller['getMessages']);router[_0xa6cf('0x5')](_0xa6cf('0x12'),auth['isAuthenticated'](),controller[_0xa6cf('0x13')]);router[_0xa6cf('0x14')]('/',auth[_0xa6cf('0x6')](),controller[_0xa6cf('0x15')]);router[_0xa6cf('0x14')]('/:id/dispositions',auth[_0xa6cf('0x6')](),controller['addDisposition']);router[_0xa6cf('0x14')](_0xa6cf('0xb'),auth[_0xa6cf('0x6')](),controller[_0xa6cf('0x16')]);router[_0xa6cf('0x14')](_0xa6cf('0xd'),auth[_0xa6cf('0x6')](),controller[_0xa6cf('0x17')]);router[_0xa6cf('0x14')](_0xa6cf('0xf'),auth[_0xa6cf('0x6')](),controller[_0xa6cf('0x18')]);router[_0xa6cf('0x14')]('/addaccountapplications',auth[_0xa6cf('0x6')](),controller['addAccountApplications']);router[_0xa6cf('0x14')](_0xa6cf('0x19'),auth[_0xa6cf('0x6')](),controller['updateAccountApplications']);router[_0xa6cf('0x14')](_0xa6cf('0x1a'),auth[_0xa6cf('0x6')](),controller[_0xa6cf('0x1b')]);router['post'](_0xa6cf('0x12'),auth['isAuthenticated'](),controller[_0xa6cf('0x1c')]);router[_0xa6cf('0x1d')](_0xa6cf('0x1e'),auth[_0xa6cf('0x6')](),controller[_0xa6cf('0x1f')]);router[_0xa6cf('0x20')]('/:id',auth[_0xa6cf('0x6')](),controller[_0xa6cf('0x21')]);router[_0xa6cf('0x20')](_0xa6cf('0x9'),auth[_0xa6cf('0x6')](),controller['removeDispositions']);router[_0xa6cf('0x20')](_0xa6cf('0xb'),auth[_0xa6cf('0x6')](),controller[_0xa6cf('0x22')]);router[_0xa6cf('0x20')](_0xa6cf('0x12'),auth['isAuthenticated'](),controller[_0xa6cf('0x23')]);module[_0xa6cf('0x24')]=router; \ No newline at end of file +var _0xd000=['show','/:id/dispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','/:id/send','send','put','update','delete','destroy','removeAnswers','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','/:id'];(function(_0x41075d,_0x112862){var _0x11f102=function(_0x49f373){while(--_0x49f373){_0x41075d['push'](_0x41075d['shift']());}};_0x11f102(++_0x112862);}(_0xd000,0x1bd));var _0x0d00=function(_0x221b2e,_0x51a42b){_0x221b2e=_0x221b2e-0x0;var _0x1b3029=_0xd000[_0x221b2e];return _0x1b3029;};'use strict';var multer=require(_0x0d00('0x0'));var util=require(_0x0d00('0x1'));var path=require('path');var timeout=require(_0x0d00('0x2'));var express=require('express');var router=express[_0x0d00('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0d00('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0d00('0x5'));var controller=require('./faxAccount.controller');router[_0x0d00('0x6')]('/',auth['isAuthenticated'](),controller[_0x0d00('0x7')]);router[_0x0d00('0x6')]('/describe',auth[_0x0d00('0x8')](),controller[_0x0d00('0x9')]);router[_0x0d00('0x6')](_0x0d00('0xa'),auth[_0x0d00('0x8')](),controller[_0x0d00('0xb')]);router[_0x0d00('0x6')](_0x0d00('0xc'),auth[_0x0d00('0x8')](),controller['getDispositions']);router['get'](_0x0d00('0xd'),auth[_0x0d00('0x8')](),controller['getAnswers']);router['get'](_0x0d00('0xe'),auth[_0x0d00('0x8')](),controller[_0x0d00('0xf')]);router['get'](_0x0d00('0x10'),auth[_0x0d00('0x8')](),controller[_0x0d00('0x11')]);router['get'](_0x0d00('0x12'),auth[_0x0d00('0x8')](),controller[_0x0d00('0x13')]);router[_0x0d00('0x6')](_0x0d00('0x14'),auth['isAuthenticated'](),controller[_0x0d00('0x15')]);router[_0x0d00('0x16')]('/',auth[_0x0d00('0x8')](),controller[_0x0d00('0x17')]);router[_0x0d00('0x16')](_0x0d00('0xc'),auth[_0x0d00('0x8')](),controller[_0x0d00('0x18')]);router[_0x0d00('0x16')](_0x0d00('0xd'),auth['isAuthenticated'](),controller[_0x0d00('0x19')]);router['post'](_0x0d00('0xe'),auth[_0x0d00('0x8')](),controller[_0x0d00('0x1a')]);router[_0x0d00('0x16')](_0x0d00('0x10'),auth[_0x0d00('0x8')](),controller[_0x0d00('0x1b')]);router['post'](_0x0d00('0x1c'),auth[_0x0d00('0x8')](),controller['addAccountApplications']);router['post'](_0x0d00('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0d00('0x16')](_0x0d00('0x1e'),auth[_0x0d00('0x8')](),controller[_0x0d00('0x1f')]);router[_0x0d00('0x16')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x0d00('0x20')]('/:id',auth[_0x0d00('0x8')](),controller[_0x0d00('0x21')]);router[_0x0d00('0x22')]('/:id',auth[_0x0d00('0x8')](),controller[_0x0d00('0x23')]);router[_0x0d00('0x22')](_0x0d00('0xc'),auth[_0x0d00('0x8')](),controller['removeDispositions']);router[_0x0d00('0x22')](_0x0d00('0xd'),auth[_0x0d00('0x8')](),controller[_0x0d00('0x24')]);router[_0x0d00('0x22')](_0x0d00('0x14'),auth[_0x0d00('0x8')](),controller['removeAgents']);module[_0x0d00('0x25')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index cc08ff0..797e449 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 _0x3969=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x25228f,_0xe71692){var _0x34f9b6=function(_0x5bc413){while(--_0x5bc413){_0x25228f['push'](_0x25228f['shift']());}};_0x34f9b6(++_0xe71692);}(_0x3969,0x1aa));var _0x9396=function(_0x44c277,_0x3a6b27){_0x44c277=_0x44c277-0x0;var _0x3bf8cd=_0x3969[_0x44c277];return _0x3bf8cd;};'use strict';var Sequelize=require(_0x9396('0x0'));module[_0x9396('0x1')]={'priority':{'type':Sequelize[_0x9396('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9396('0x3')],'allowNull':![],'defaultValue':_0x9396('0x4')},'appdata':{'type':Sequelize[_0x9396('0x5')]()},'description':{'type':Sequelize[_0x9396('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9396('0x6')}}; \ No newline at end of file +var _0x7d08=['INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x2ee736,_0x30b781){var _0x253723=function(_0xd26f5f){while(--_0xd26f5f){_0x2ee736['push'](_0x2ee736['shift']());}};_0x253723(++_0x30b781);}(_0x7d08,0x6d));var _0x87d0=function(_0x4286db,_0x244dd2){_0x4286db=_0x4286db-0x0;var _0x2c600e=_0x7d08[_0x4286db];return _0x2c600e;};'use strict';var Sequelize=require(_0x87d0('0x0'));module['exports']={'priority':{'type':Sequelize[_0x87d0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x87d0('0x2')],'allowNull':![],'defaultValue':_0x87d0('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x87d0('0x2')],'defaultValue':_0x87d0('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 837357e..bb618ca 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 _0xbbd9=['includeAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','set','json','apply','reject','save','update','then','sendStatus','error','stack','send','index','map','FaxApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','name','options'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xbbd9,0x1b2));var _0x9bbd=function(_0x3ec751,_0x3009cd){_0x3ec751=_0x3ec751-0x0;var _0x252150=_0xbbd9[_0x3ec751];return _0x252150;};'use strict';var emlformat=require(_0x9bbd('0x0'));var rimraf=require(_0x9bbd('0x1'));var zipdir=require(_0x9bbd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9bbd('0x3'));var moment=require('moment');var BPromise=require(_0x9bbd('0x4'));var Mustache=require('mustache');var util=require(_0x9bbd('0x5'));var path=require(_0x9bbd('0x6'));var sox=require('sox');var csv=require(_0x9bbd('0x7'));var ejs=require(_0x9bbd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bbd('0x9'));var squel=require(_0x9bbd('0xa'));var crypto=require('crypto');var jsforce=require(_0x9bbd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9bbd('0x7'));var querystring=require(_0x9bbd('0xc'));var Papa=require(_0x9bbd('0xd'));var Redis=require('ioredis');var authService=require(_0x9bbd('0xe'));var qs=require(_0x9bbd('0xf'));var as=require(_0x9bbd('0x10'));var hardwareService=require(_0x9bbd('0x11'));var logger=require(_0x9bbd('0x12'))(_0x9bbd('0x13'));var utils=require(_0x9bbd('0x14'));var config=require(_0x9bbd('0x15'));var licenseUtil=require(_0x9bbd('0x16'));var db=require(_0x9bbd('0x17'))['db'];function respondWithStatusCode(_0x2ae6f9,_0x3b6fd9){_0x3b6fd9=_0x3b6fd9||0xcc;return function(_0x31ee4f){if(_0x31ee4f){return _0x2ae6f9['sendStatus'](_0x3b6fd9);}return _0x2ae6f9['status'](_0x3b6fd9)[_0x9bbd('0x18')]();};}function respondWithResult(_0x2b9a2f,_0x124067){_0x124067=_0x124067||0xc8;return function(_0x31d10c){if(_0x31d10c){return _0x2b9a2f['status'](_0x124067)['json'](_0x31d10c);}};}function respondWithFilteredResult(_0x9baab7,_0xf1f788){return function(_0x190645){if(_0x190645){var _0x20e4b2=typeof _0xf1f788[_0x9bbd('0x19')]===_0x9bbd('0x1a')&&typeof _0xf1f788[_0x9bbd('0x1b')]==='undefined';var _0x3506ba=_0x190645[_0x9bbd('0x1c')];var _0xe61e63=_0x20e4b2?0x0:_0xf1f788[_0x9bbd('0x19')];var _0xa408a3=_0x20e4b2?_0x190645[_0x9bbd('0x1c')]:_0xf1f788['offset']+_0xf1f788[_0x9bbd('0x1b')];var _0xb55e;if(_0xa408a3>=_0x3506ba){_0xa408a3=_0x3506ba;_0xb55e=0xc8;}else{_0xb55e=0xce;}_0x9baab7[_0x9bbd('0x1d')](_0xb55e);return _0x9baab7[_0x9bbd('0x1e')]('Content-Range',_0xe61e63+'-'+_0xa408a3+'/'+_0x3506ba)[_0x9bbd('0x1f')](_0x190645);}return null;};}function patchUpdates(_0xeff8ad){return function(_0x4d5239){try{jsonpatch[_0x9bbd('0x20')](_0x4d5239,_0xeff8ad,!![]);}catch(_0x65ad6f){return BPromise[_0x9bbd('0x21')](_0x65ad6f);}return _0x4d5239[_0x9bbd('0x22')]();};}function saveUpdates(_0x2d3f4d,_0x420992){return function(_0x53bf87){if(_0x53bf87){return _0x53bf87[_0x9bbd('0x23')](_0x2d3f4d)[_0x9bbd('0x24')](function(_0x24e78b){return _0x24e78b;});}return null;};}function removeEntity(_0x265837,_0x3913b6){return function(_0x4816f6){if(_0x4816f6){return _0x4816f6['destroy']()[_0x9bbd('0x24')](function(){_0x265837[_0x9bbd('0x1d')](0xcc)[_0x9bbd('0x18')]();});}};}function handleEntityNotFound(_0x3717e7,_0x4d0f20){return function(_0x3c423b){if(!_0x3c423b){_0x3717e7[_0x9bbd('0x25')](0x194);}return _0x3c423b;};}function handleError(_0x2b0305,_0x660eb9){_0x660eb9=_0x660eb9||0x1f4;return function(_0x4fec08){logger[_0x9bbd('0x26')](_0x4fec08[_0x9bbd('0x27')]);if(_0x4fec08['name']){delete _0x4fec08['name'];}_0x2b0305['status'](_0x660eb9)[_0x9bbd('0x28')](_0x4fec08);};}exports[_0x9bbd('0x29')]=function(_0x1a4b49,_0x46e774){var _0x56e3f7={},_0x123379={},_0x54cecd={'count':0x0,'rows':[]};var _0x33b7b7=_[_0x9bbd('0x2a')](db[_0x9bbd('0x2b')][_0x9bbd('0x2c')],function(_0x210e9d){return{'name':_0x210e9d['fieldName'],'type':_0x210e9d[_0x9bbd('0x2d')][_0x9bbd('0x2e')]};});_0x123379[_0x9bbd('0x2f')]=_[_0x9bbd('0x2a')](_0x33b7b7,'name');_0x123379[_0x9bbd('0x30')]=_[_0x9bbd('0x31')](_0x1a4b49[_0x9bbd('0x30')]);_0x123379[_0x9bbd('0x32')]=_[_0x9bbd('0x33')](_0x123379[_0x9bbd('0x2f')],_0x123379['query']);_0x56e3f7[_0x9bbd('0x34')]=_[_0x9bbd('0x33')](_0x123379['model'],qs[_0x9bbd('0x35')](_0x1a4b49['query']['fields']));_0x56e3f7[_0x9bbd('0x34')]=_0x56e3f7['attributes'][_0x9bbd('0x36')]?_0x56e3f7[_0x9bbd('0x34')]:_0x123379[_0x9bbd('0x2f')];if(!_0x1a4b49[_0x9bbd('0x30')]['hasOwnProperty']('nolimit')){_0x56e3f7[_0x9bbd('0x1b')]=qs[_0x9bbd('0x1b')](_0x1a4b49[_0x9bbd('0x30')]['limit']);_0x56e3f7['offset']=qs[_0x9bbd('0x19')](_0x1a4b49[_0x9bbd('0x30')][_0x9bbd('0x19')]);}_0x56e3f7[_0x9bbd('0x37')]=qs[_0x9bbd('0x38')](_0x1a4b49[_0x9bbd('0x30')]['sort']);_0x56e3f7[_0x9bbd('0x39')]=qs[_0x9bbd('0x32')](_['pick'](_0x1a4b49['query'],_0x123379[_0x9bbd('0x32')]),_0x33b7b7);if(_0x1a4b49[_0x9bbd('0x30')][_0x9bbd('0x3a')]){_0x56e3f7[_0x9bbd('0x39')]=_[_0x9bbd('0x3b')](_0x56e3f7[_0x9bbd('0x39')],{'$or':_['map'](_0x33b7b7,function(_0x5a7cba){if(_0x5a7cba[_0x9bbd('0x2d')]!==_0x9bbd('0x3c')){var _0x3c7423={};_0x3c7423[_0x5a7cba[_0x9bbd('0x3d')]]={'$like':'%'+_0x1a4b49[_0x9bbd('0x30')][_0x9bbd('0x3a')]+'%'};return _0x3c7423;}})});}_0x56e3f7=_['merge']({},_0x56e3f7,_0x1a4b49[_0x9bbd('0x3e')]);var _0x44bbee={'where':_0x56e3f7[_0x9bbd('0x39')]};return db[_0x9bbd('0x2b')][_0x9bbd('0x1c')](_0x44bbee)[_0x9bbd('0x24')](function(_0x18abe0){_0x54cecd['count']=_0x18abe0;if(_0x1a4b49['query'][_0x9bbd('0x3f')]){_0x56e3f7['include']=[{'all':!![]}];}return db[_0x9bbd('0x2b')]['findAll'](_0x56e3f7);})['then'](function(_0x18f3e0){_0x54cecd[_0x9bbd('0x40')]=_0x18f3e0;return _0x54cecd;})[_0x9bbd('0x24')](respondWithFilteredResult(_0x46e774,_0x56e3f7))[_0x9bbd('0x41')](handleError(_0x46e774,null));};exports[_0x9bbd('0x42')]=function(_0x5f3b66,_0x50fe01){var _0x1048e4={'raw':!![],'where':{'id':_0x5f3b66['params']['id']}},_0x3b35cc={};_0x3b35cc['model']=_[_0x9bbd('0x31')](db[_0x9bbd('0x2b')][_0x9bbd('0x2c')]);_0x3b35cc[_0x9bbd('0x30')]=_[_0x9bbd('0x31')](_0x5f3b66[_0x9bbd('0x30')]);_0x3b35cc[_0x9bbd('0x32')]=_[_0x9bbd('0x33')](_0x3b35cc[_0x9bbd('0x2f')],_0x3b35cc[_0x9bbd('0x30')]);_0x1048e4[_0x9bbd('0x34')]=_['intersection'](_0x3b35cc['model'],qs[_0x9bbd('0x35')](_0x5f3b66[_0x9bbd('0x30')][_0x9bbd('0x35')]));_0x1048e4[_0x9bbd('0x34')]=_0x1048e4[_0x9bbd('0x34')][_0x9bbd('0x36')]?_0x1048e4[_0x9bbd('0x34')]:_0x3b35cc[_0x9bbd('0x2f')];if(_0x5f3b66[_0x9bbd('0x30')]['includeAll']){_0x1048e4['include']=[{'all':!![]}];}_0x1048e4=_[_0x9bbd('0x3b')]({},_0x1048e4,_0x5f3b66['options']);return db[_0x9bbd('0x2b')][_0x9bbd('0x43')](_0x1048e4)[_0x9bbd('0x24')](handleEntityNotFound(_0x50fe01,null))[_0x9bbd('0x24')](respondWithResult(_0x50fe01,null))[_0x9bbd('0x41')](handleError(_0x50fe01,null));};exports[_0x9bbd('0x44')]=function(_0x60ca87,_0x30575c){return db[_0x9bbd('0x2b')][_0x9bbd('0x44')](_0x60ca87['body'],{})['then'](respondWithResult(_0x30575c,0xc9))[_0x9bbd('0x41')](handleError(_0x30575c,null));};exports[_0x9bbd('0x23')]=function(_0xae8563,_0x53aee1){if(_0xae8563[_0x9bbd('0x45')]['id']){delete _0xae8563[_0x9bbd('0x45')]['id'];}return db[_0x9bbd('0x2b')][_0x9bbd('0x43')]({'where':{'id':_0xae8563['params']['id']}})[_0x9bbd('0x24')](handleEntityNotFound(_0x53aee1,null))['then'](saveUpdates(_0xae8563[_0x9bbd('0x45')],null))['then'](respondWithResult(_0x53aee1,null))[_0x9bbd('0x41')](handleError(_0x53aee1,null));};exports['destroy']=function(_0x29fc3e,_0x2937ce){return db[_0x9bbd('0x2b')]['find']({'where':{'id':_0x29fc3e[_0x9bbd('0x46')]['id']}})[_0x9bbd('0x24')](handleEntityNotFound(_0x2937ce,null))[_0x9bbd('0x24')](removeEntity(_0x2937ce,null))[_0x9bbd('0x41')](handleError(_0x2937ce,null));}; \ No newline at end of file +var _0x2cb8=['sox','to-csv','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','status','json','offset','count','limit','set','reject','update','then','stack','name','send','index','FaxApplication','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path'];(function(_0x2c33e7,_0x1f8c13){var _0xcdffed=function(_0xa71a2b){while(--_0xa71a2b){_0x2c33e7['push'](_0x2c33e7['shift']());}};_0xcdffed(++_0x1f8c13);}(_0x2cb8,0x18a));var _0x82cb=function(_0x410adc,_0x1a4cc2){_0x410adc=_0x410adc-0x0;var _0x3917f2=_0x2cb8[_0x410adc];return _0x3917f2;};'use strict';var emlformat=require(_0x82cb('0x0'));var rimraf=require(_0x82cb('0x1'));var zipdir=require(_0x82cb('0x2'));var jsonpatch=require(_0x82cb('0x3'));var rp=require(_0x82cb('0x4'));var moment=require('moment');var BPromise=require(_0x82cb('0x5'));var Mustache=require('mustache');var util=require(_0x82cb('0x6'));var path=require(_0x82cb('0x7'));var sox=require(_0x82cb('0x8'));var csv=require(_0x82cb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82cb('0xa'));var _=require('lodash');var squel=require(_0x82cb('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x82cb('0xc'));var toCsv=require(_0x82cb('0x9'));var querystring=require('querystring');var Papa=require(_0x82cb('0xd'));var Redis=require(_0x82cb('0xe'));var authService=require(_0x82cb('0xf'));var qs=require(_0x82cb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82cb('0x11'));var logger=require('../../config/logger')(_0x82cb('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x82cb('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x267545,_0x71e296){_0x71e296=_0x71e296||0xcc;return function(_0x4e4856){if(_0x4e4856){return _0x267545['sendStatus'](_0x71e296);}return _0x267545[_0x82cb('0x14')](_0x71e296)['end']();};}function respondWithResult(_0x12e600,_0x233a10){_0x233a10=_0x233a10||0xc8;return function(_0x4649a6){if(_0x4649a6){return _0x12e600[_0x82cb('0x14')](_0x233a10)[_0x82cb('0x15')](_0x4649a6);}};}function respondWithFilteredResult(_0x44c021,_0x495c43){return function(_0x58c721){if(_0x58c721){var _0x4c61ba=typeof _0x495c43[_0x82cb('0x16')]==='undefined'&&typeof _0x495c43['limit']==='undefined';var _0x5b0912=_0x58c721[_0x82cb('0x17')];var _0x4d250b=_0x4c61ba?0x0:_0x495c43[_0x82cb('0x16')];var _0x288fbd=_0x4c61ba?_0x58c721[_0x82cb('0x17')]:_0x495c43['offset']+_0x495c43[_0x82cb('0x18')];var _0x425b2e;if(_0x288fbd>=_0x5b0912){_0x288fbd=_0x5b0912;_0x425b2e=0xc8;}else{_0x425b2e=0xce;}_0x44c021['status'](_0x425b2e);return _0x44c021[_0x82cb('0x19')]('Content-Range',_0x4d250b+'-'+_0x288fbd+'/'+_0x5b0912)[_0x82cb('0x15')](_0x58c721);}return null;};}function patchUpdates(_0x177c9e){return function(_0x154cb3){try{jsonpatch['apply'](_0x154cb3,_0x177c9e,!![]);}catch(_0x3b1ab5){return BPromise[_0x82cb('0x1a')](_0x3b1ab5);}return _0x154cb3['save']();};}function saveUpdates(_0x424554,_0x41ef38){return function(_0x18347c){if(_0x18347c){return _0x18347c[_0x82cb('0x1b')](_0x424554)[_0x82cb('0x1c')](function(_0x327465){return _0x327465;});}return null;};}function removeEntity(_0x231305,_0x16cb45){return function(_0x1a5aa5){if(_0x1a5aa5){return _0x1a5aa5['destroy']()[_0x82cb('0x1c')](function(){_0x231305[_0x82cb('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45168a,_0xda1f77){return function(_0x1b4c3c){if(!_0x1b4c3c){_0x45168a['sendStatus'](0x194);}return _0x1b4c3c;};}function handleError(_0x1af53f,_0x2d5cd0){_0x2d5cd0=_0x2d5cd0||0x1f4;return function(_0x3ecc2b){logger['error'](_0x3ecc2b[_0x82cb('0x1d')]);if(_0x3ecc2b[_0x82cb('0x1e')]){delete _0x3ecc2b[_0x82cb('0x1e')];}_0x1af53f[_0x82cb('0x14')](_0x2d5cd0)[_0x82cb('0x1f')](_0x3ecc2b);};}exports[_0x82cb('0x20')]=function(_0x197497,_0x4b5207){var _0x273291={},_0xfc4553={},_0x45d782={'count':0x0,'rows':[]};var _0x3b3606=_['map'](db[_0x82cb('0x21')][_0x82cb('0x22')],function(_0x96553d){return{'name':_0x96553d[_0x82cb('0x23')],'type':_0x96553d[_0x82cb('0x24')][_0x82cb('0x25')]};});_0xfc4553['model']=_[_0x82cb('0x26')](_0x3b3606,_0x82cb('0x1e'));_0xfc4553[_0x82cb('0x27')]=_[_0x82cb('0x28')](_0x197497['query']);_0xfc4553[_0x82cb('0x29')]=_[_0x82cb('0x2a')](_0xfc4553['model'],_0xfc4553['query']);_0x273291[_0x82cb('0x2b')]=_[_0x82cb('0x2a')](_0xfc4553['model'],qs[_0x82cb('0x2c')](_0x197497[_0x82cb('0x27')][_0x82cb('0x2c')]));_0x273291[_0x82cb('0x2b')]=_0x273291['attributes'][_0x82cb('0x2d')]?_0x273291['attributes']:_0xfc4553[_0x82cb('0x2e')];if(!_0x197497['query'][_0x82cb('0x2f')](_0x82cb('0x30'))){_0x273291['limit']=qs['limit'](_0x197497[_0x82cb('0x27')]['limit']);_0x273291['offset']=qs[_0x82cb('0x16')](_0x197497[_0x82cb('0x27')][_0x82cb('0x16')]);}_0x273291[_0x82cb('0x31')]=qs[_0x82cb('0x32')](_0x197497[_0x82cb('0x27')][_0x82cb('0x32')]);_0x273291[_0x82cb('0x33')]=qs[_0x82cb('0x29')](_[_0x82cb('0x34')](_0x197497[_0x82cb('0x27')],_0xfc4553[_0x82cb('0x29')]),_0x3b3606);if(_0x197497[_0x82cb('0x27')]['filter']){_0x273291[_0x82cb('0x33')]=_[_0x82cb('0x35')](_0x273291['where'],{'$or':_[_0x82cb('0x26')](_0x3b3606,function(_0x2eb021){if(_0x2eb021[_0x82cb('0x24')]!==_0x82cb('0x36')){var _0x53e386={};_0x53e386[_0x2eb021['name']]={'$like':'%'+_0x197497['query'][_0x82cb('0x37')]+'%'};return _0x53e386;}})});}_0x273291=_['merge']({},_0x273291,_0x197497[_0x82cb('0x38')]);var _0x2afac5={'where':_0x273291['where']};return db[_0x82cb('0x21')]['count'](_0x2afac5)[_0x82cb('0x1c')](function(_0x4078c9){_0x45d782[_0x82cb('0x17')]=_0x4078c9;if(_0x197497[_0x82cb('0x27')][_0x82cb('0x39')]){_0x273291[_0x82cb('0x3a')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x273291);})[_0x82cb('0x1c')](function(_0x195a6e){_0x45d782[_0x82cb('0x3b')]=_0x195a6e;return _0x45d782;})[_0x82cb('0x1c')](respondWithFilteredResult(_0x4b5207,_0x273291))[_0x82cb('0x3c')](handleError(_0x4b5207,null));};exports[_0x82cb('0x3d')]=function(_0x40b5c0,_0x5676de){var _0x3f5745={'raw':!![],'where':{'id':_0x40b5c0[_0x82cb('0x3e')]['id']}},_0x479d2a={};_0x479d2a[_0x82cb('0x2e')]=_[_0x82cb('0x28')](db['FaxApplication'][_0x82cb('0x22')]);_0x479d2a[_0x82cb('0x27')]=_[_0x82cb('0x28')](_0x40b5c0[_0x82cb('0x27')]);_0x479d2a[_0x82cb('0x29')]=_[_0x82cb('0x2a')](_0x479d2a[_0x82cb('0x2e')],_0x479d2a[_0x82cb('0x27')]);_0x3f5745[_0x82cb('0x2b')]=_[_0x82cb('0x2a')](_0x479d2a['model'],qs[_0x82cb('0x2c')](_0x40b5c0[_0x82cb('0x27')][_0x82cb('0x2c')]));_0x3f5745[_0x82cb('0x2b')]=_0x3f5745[_0x82cb('0x2b')][_0x82cb('0x2d')]?_0x3f5745[_0x82cb('0x2b')]:_0x479d2a[_0x82cb('0x2e')];if(_0x40b5c0[_0x82cb('0x27')]['includeAll']){_0x3f5745[_0x82cb('0x3a')]=[{'all':!![]}];}_0x3f5745=_['merge']({},_0x3f5745,_0x40b5c0[_0x82cb('0x38')]);return db[_0x82cb('0x21')][_0x82cb('0x3f')](_0x3f5745)[_0x82cb('0x1c')](handleEntityNotFound(_0x5676de,null))[_0x82cb('0x1c')](respondWithResult(_0x5676de,null))[_0x82cb('0x3c')](handleError(_0x5676de,null));};exports[_0x82cb('0x40')]=function(_0x1b1399,_0x3de957){return db[_0x82cb('0x21')][_0x82cb('0x40')](_0x1b1399[_0x82cb('0x41')],{})[_0x82cb('0x1c')](respondWithResult(_0x3de957,0xc9))['catch'](handleError(_0x3de957,null));};exports[_0x82cb('0x1b')]=function(_0x5dd718,_0x570144){if(_0x5dd718[_0x82cb('0x41')]['id']){delete _0x5dd718[_0x82cb('0x41')]['id'];}return db[_0x82cb('0x21')]['find']({'where':{'id':_0x5dd718['params']['id']}})['then'](handleEntityNotFound(_0x570144,null))[_0x82cb('0x1c')](saveUpdates(_0x5dd718[_0x82cb('0x41')],null))['then'](respondWithResult(_0x570144,null))[_0x82cb('0x3c')](handleError(_0x570144,null));};exports[_0x82cb('0x42')]=function(_0x3439a2,_0x2641df){return db[_0x82cb('0x21')][_0x82cb('0x3f')]({'where':{'id':_0x3439a2[_0x82cb('0x3e')]['id']}})[_0x82cb('0x1c')](handleEntityNotFound(_0x2641df,null))[_0x82cb('0x1c')](removeEntity(_0x2641df,null))[_0x82cb('0x3c')](handleError(_0x2641df,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b41fd4f..122bac1 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 _0xd491=['utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','./faxApplication.attributes'];(function(_0x5c70ae,_0x3dcd76){var _0x3b5e9a=function(_0x36fa4c){while(--_0x36fa4c){_0x5c70ae['push'](_0x5c70ae['shift']());}};_0x3b5e9a(++_0x3dcd76);}(_0xd491,0x158));var _0x1d49=function(_0x58c26d,_0x93e0a3){_0x58c26d=_0x58c26d-0x0;var _0x10f4be=_0xd491[_0x58c26d];return _0x10f4be;};'use strict';var _=require(_0x1d49('0x0'));var util=require(_0x1d49('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1d49('0x2'));var BPromise=require('bluebird');var rp=require(_0x1d49('0x3'));var fs=require('fs');var path=require(_0x1d49('0x4'));var rimraf=require(_0x1d49('0x5'));var config=require('../../config/environment');var attributes=require(_0x1d49('0x6'));module['exports']=function(_0xe87781,_0x15de80){return _0xe87781['define']('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1d49('0x7'),'collate':_0x1d49('0x8')});}; \ No newline at end of file +var _0x6682=['moment','request-promise','rimraf','exports','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x80d625,_0xb00711){var _0x400497=function(_0x2b4106){while(--_0x2b4106){_0x80d625['push'](_0x80d625['shift']());}};_0x400497(++_0xb00711);}(_0x6682,0xa8));var _0x2668=function(_0x5b5490,_0x687b7c){_0x5b5490=_0x5b5490-0x0;var _0x2cdc70=_0x6682[_0x5b5490];return _0x2cdc70;};'use strict';var _=require('lodash');var util=require(_0x2668('0x0'));var logger=require(_0x2668('0x1'))('api');var moment=require(_0x2668('0x2'));var BPromise=require('bluebird');var rp=require(_0x2668('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2668('0x4'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x2668('0x5')]=function(_0xc9c43a,_0x2073f6){return _0xc9c43a['define'](_0x2668('0x6'),attributes,{'tableName':_0x2668('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2668('0x8'),'collate':_0x2668('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 60db1da..fd6c529 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 _0xd0b2=['where','attributes','limit','debug','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','options','raw'];(function(_0x25db15,_0x202232){var _0x11a41c=function(_0x17c1bb){while(--_0x17c1bb){_0x25db15['push'](_0x25db15['shift']());}};_0x11a41c(++_0x202232);}(_0xd0b2,0x96));var _0x2d0b=function(_0x2ab1ee,_0xb5a654){_0x2ab1ee=_0x2ab1ee-0x0;var _0x3c1461=_0xd0b2[_0x2ab1ee];return _0x3c1461;};'use strict';var _=require(_0x2d0b('0x0'));var util=require(_0x2d0b('0x1'));var moment=require(_0x2d0b('0x2'));var BPromise=require(_0x2d0b('0x3'));var rs=require(_0x2d0b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d0b('0x5'));var logger=require(_0x2d0b('0x6'))(_0x2d0b('0x7'));var config=require(_0x2d0b('0x8'));var jayson=require(_0x2d0b('0x9'));var client=jayson[_0x2d0b('0xa')][_0x2d0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c3c24,_0x5cb28f,_0x48204c){return new BPromise(function(_0x23485f,_0x58e540){return client[_0x2d0b('0xc')](_0x5c3c24,_0x48204c)['then'](function(_0xd887bd){logger[_0x2d0b('0xd')](_0x2d0b('0xe'),_0x5cb28f,'request\x20sent');logger['debug'](_0x2d0b('0xf'),_0x5cb28f,_0x2d0b('0x10'),JSON[_0x2d0b('0x11')](_0xd887bd));if(_0xd887bd['error']){if(_0xd887bd['error']['code']===0x1f4){logger[_0x2d0b('0x12')](_0x2d0b('0xe'),_0x5cb28f,_0xd887bd[_0x2d0b('0x12')][_0x2d0b('0x13')]);return _0x58e540(_0xd887bd[_0x2d0b('0x12')][_0x2d0b('0x13')]);}logger[_0x2d0b('0x12')]('FaxApplication,\x20%s,\x20%s',_0x5cb28f,_0xd887bd[_0x2d0b('0x12')][_0x2d0b('0x13')]);return _0x23485f(_0xd887bd[_0x2d0b('0x12')][_0x2d0b('0x13')]);}else{logger[_0x2d0b('0xd')](_0x2d0b('0xe'),_0x5cb28f,_0x2d0b('0x10'));_0x23485f(_0xd887bd[_0x2d0b('0x14')][_0x2d0b('0x13')]);}})[_0x2d0b('0x15')](function(_0x1935c9){logger[_0x2d0b('0x12')](_0x2d0b('0xe'),_0x5cb28f,_0x1935c9);_0x58e540(_0x1935c9);});});}exports['UpdateFaxApplication']=function(_0x25e38a){var _0x5e620f=this;return new Promise(function(_0x2a7b4c,_0x8b7843){return db['FaxApplication']['update'](_0x25e38a['body'],{'raw':_0x25e38a['options']?_0x25e38a[_0x2d0b('0x16')][_0x2d0b('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25e38a[_0x2d0b('0x16')]?_0x25e38a['options'][_0x2d0b('0x18')]||null:null,'attributes':_0x25e38a[_0x2d0b('0x16')]?_0x25e38a['options'][_0x2d0b('0x19')]||null:null,'limit':_0x25e38a['options']?_0x25e38a[_0x2d0b('0x16')][_0x2d0b('0x1a')]||null:null})['then'](function(_0x31c208){logger[_0x2d0b('0xd')]('UpdateFaxApplication',_0x25e38a);logger[_0x2d0b('0x1b')]('UpdateFaxApplication',_0x25e38a,JSON[_0x2d0b('0x11')](_0x31c208));_0x2a7b4c(_0x31c208);})[_0x2d0b('0x15')](function(_0x4bb169){logger[_0x2d0b('0x12')](_0x2d0b('0x1c'),_0x4bb169[_0x2d0b('0x13')],_0x25e38a);_0x8b7843(_0x5e620f['error'](0x1f4,_0x4bb169[_0x2d0b('0x13')]));});});}; \ No newline at end of file +var _0xd881=['message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd881,0x182));var _0x1d88=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd881[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x1d88('0x0'));var util=require('util');var moment=require(_0x1d88('0x1'));var BPromise=require(_0x1d88('0x2'));var rs=require(_0x1d88('0x3'));var fs=require('fs');var Redis=require(_0x1d88('0x4'));var db=require(_0x1d88('0x5'))['db'];var utils=require(_0x1d88('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1d88('0x7'));var jayson=require(_0x1d88('0x8'));var client=jayson[_0x1d88('0x9')][_0x1d88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x576757,_0x3aa622,_0x19534b){return new BPromise(function(_0x4f09c7,_0x35e35f){return client[_0x1d88('0xb')](_0x576757,_0x19534b)[_0x1d88('0xc')](function(_0x34a5b9){logger[_0x1d88('0xd')](_0x1d88('0xe'),_0x3aa622,_0x1d88('0xf'));logger[_0x1d88('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3aa622,_0x1d88('0xf'),JSON[_0x1d88('0x11')](_0x34a5b9));if(_0x34a5b9[_0x1d88('0x12')]){if(_0x34a5b9['error'][_0x1d88('0x13')]===0x1f4){logger['error'](_0x1d88('0xe'),_0x3aa622,_0x34a5b9['error']['message']);return _0x35e35f(_0x34a5b9[_0x1d88('0x12')][_0x1d88('0x14')]);}logger['error'](_0x1d88('0xe'),_0x3aa622,_0x34a5b9[_0x1d88('0x12')][_0x1d88('0x14')]);return _0x4f09c7(_0x34a5b9[_0x1d88('0x12')][_0x1d88('0x14')]);}else{logger['info'](_0x1d88('0xe'),_0x3aa622,_0x1d88('0xf'));_0x4f09c7(_0x34a5b9[_0x1d88('0x15')]['message']);}})[_0x1d88('0x16')](function(_0x4bb9a1){logger[_0x1d88('0x12')]('FaxApplication,\x20%s,\x20%s',_0x3aa622,_0x4bb9a1);_0x35e35f(_0x4bb9a1);});});}exports[_0x1d88('0x17')]=function(_0x38f1ae){var _0x246357=this;return new Promise(function(_0x2ff49e,_0x567cc5){return db[_0x1d88('0x18')][_0x1d88('0x19')](_0x38f1ae[_0x1d88('0x1a')],{'raw':_0x38f1ae['options']?_0x38f1ae[_0x1d88('0x1b')][_0x1d88('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38f1ae[_0x1d88('0x1b')]?_0x38f1ae[_0x1d88('0x1b')]['where']||null:null,'attributes':_0x38f1ae[_0x1d88('0x1b')]?_0x38f1ae[_0x1d88('0x1b')]['attributes']||null:null,'limit':_0x38f1ae['options']?_0x38f1ae[_0x1d88('0x1b')]['limit']||null:null})[_0x1d88('0xc')](function(_0x85bab3){logger[_0x1d88('0xd')](_0x1d88('0x17'),_0x38f1ae);logger[_0x1d88('0x10')]('UpdateFaxApplication',_0x38f1ae,JSON[_0x1d88('0x11')](_0x85bab3));_0x2ff49e(_0x85bab3);})[_0x1d88('0x16')](function(_0x1a799a){logger['error']('UpdateFaxApplication',_0x1a799a[_0x1d88('0x14')],_0x38f1ae);_0x567cc5(_0x246357['error'](0x1f4,_0x1a799a[_0x1d88('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index d367259..93dd070 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe605=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x2f72b9,_0x40f759){var _0x206be1=function(_0x4b0941){while(--_0x4b0941){_0x2f72b9['push'](_0x2f72b9['shift']());}};_0x206be1(++_0x40f759);}(_0xe605,0x92));var _0x5e60=function(_0x3a978f,_0x417240){_0x3a978f=_0x3a978f-0x0;var _0x147ba8=_0xe605[_0x3a978f];return _0x147ba8;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/:id',auth[_0x5e60('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5e60('0xd')]);router[_0x5e60('0xe')](_0x5e60('0xf'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x10')]);router[_0x5e60('0x11')]('/:id',auth[_0x5e60('0xb')](),controller['destroy']);module[_0x5e60('0x12')]=router; \ No newline at end of file +var _0xea28=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xea28,0x13a));var _0x8ea2=function(_0x24ba10,_0x12587c){_0x24ba10=_0x24ba10-0x0;var _0x3d8e38=_0xea28[_0x24ba10];return _0x3d8e38;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xf')]('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0x11')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x12')]);router['delete']('/:id',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);module[_0x8ea2('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 922ea5e..ff4be9d 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 _0x2a07=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x3810b3,_0xb48b84){var _0x374702=function(_0x4b34a0){while(--_0x4b34a0){_0x3810b3['push'](_0x3810b3['shift']());}};_0x374702(++_0xb48b84);}(_0x2a07,0x74));var _0x72a0=function(_0x2646f6,_0x287adf){_0x2646f6=_0x2646f6-0x0;var _0x577237=_0x2a07[_0x2646f6];return _0x577237;};'use strict';var Sequelize=require(_0x72a0('0x0'));module[_0x72a0('0x1')]={'closed':{'type':Sequelize[_0x72a0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x72a0('0x3')]},'disposition':{'type':Sequelize[_0x72a0('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x72a0('0x4')]},'note':{'type':Sequelize[_0x72a0('0x4')]},'read1stAt':{'type':Sequelize[_0x72a0('0x3')]},'fax':{'type':Sequelize[_0x72a0('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x72a0('0x5')]('in',_0x72a0('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x72a0('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x72a0('0x5')]('in',_0x72a0('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x72a0('0x7')]}}; \ No newline at end of file +var _0x2a07=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x42512a,_0x2497f5){var _0x49a278=function(_0x526865){while(--_0x526865){_0x42512a['push'](_0x42512a['shift']());}};_0x49a278(++_0x2497f5);}(_0x2a07,0x74));var _0x72a0=function(_0x3b119f,_0x4f10d3){_0x3b119f=_0x3b119f-0x0;var _0x1aff29=_0x2a07[_0x3b119f];return _0x1aff29;};'use strict';var Sequelize=require(_0x72a0('0x0'));module[_0x72a0('0x1')]={'closed':{'type':Sequelize[_0x72a0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x72a0('0x3')]},'disposition':{'type':Sequelize[_0x72a0('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x72a0('0x4')]},'note':{'type':Sequelize[_0x72a0('0x4')]},'read1stAt':{'type':Sequelize[_0x72a0('0x3')]},'fax':{'type':Sequelize[_0x72a0('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x72a0('0x5')]('in',_0x72a0('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x72a0('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x72a0('0x5')]('in',_0x72a0('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x72a0('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 33574f6..dbf675c 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 _0x4dec=['rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','then','error','name','send','index','map','fieldName','key','getOptions','findAll','fax','query','user','catch','show','params','model','FaxInteraction','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','update','find','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','rawAttributes','order','sort','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','spread','Tag','color','download','toString','join','root','server','files','attachments','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createWriteStream','resolve','log','err','unlinkSync'];(function(_0x3237a4,_0x4003e1){var _0xe2fd35=function(_0x7a805a){while(--_0x7a805a){_0x3237a4['push'](_0x3237a4['shift']());}};_0xe2fd35(++_0x4003e1);}(_0x4dec,0xc8));var _0xc4de=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4dec[_0x1facfa];return _0x9ec701;};'use strict';var rimraf=require(_0xc4de('0x0'));var zipdir=require(_0xc4de('0x1'));var moment=require(_0xc4de('0x2'));var BPromise=require(_0xc4de('0x3'));var util=require(_0xc4de('0x4'));var path=require(_0xc4de('0x5'));var fs=require('fs');var _=require(_0xc4de('0x6'));var Redis=require(_0xc4de('0x7'));var interaction=require(_0xc4de('0x8'));var qs=require(_0xc4de('0x9'));var logger=require('../../config/logger')(_0xc4de('0xa'));var config=require(_0xc4de('0xb'));var db=require(_0xc4de('0xc'))['db'];config['redis']=_['defaults'](config[_0xc4de('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc4de('0xe'))(new Redis(config[_0xc4de('0xd')]));require(_0xc4de('0xf'))[_0xc4de('0x10')](socket);function respondWithStatusCode(_0x2ef149,_0x3fe1e4){_0x3fe1e4=_0x3fe1e4||0xcc;return function(_0x1bd53e){if(_0x1bd53e){return _0x2ef149[_0xc4de('0x11')](_0x3fe1e4);}return _0x2ef149[_0xc4de('0x12')](_0x3fe1e4)[_0xc4de('0x13')]();};}function respondWithResult(_0x42db65,_0x47500f){_0x47500f=_0x47500f||0xc8;return function(_0x365b41){if(_0x365b41){return _0x42db65[_0xc4de('0x12')](_0x47500f)['json'](_0x365b41);}};}function respondWithFilteredResult(_0x34f253,_0x5dd911){return function(_0x49cd73){if(_0x49cd73){var _0x5be8e2=typeof _0x5dd911['offset']===_0xc4de('0x14')&&typeof _0x5dd911['limit']==='undefined';var _0x577242=_0x49cd73[_0xc4de('0x15')];var _0x2bbc88=_0x5be8e2?0x0:_0x5dd911['offset'];var _0x32f165=_0x5be8e2?_0x49cd73[_0xc4de('0x15')]:_0x5dd911[_0xc4de('0x16')]+_0x5dd911[_0xc4de('0x17')];var _0x31f5f5;if(_0x32f165>=_0x577242){_0x32f165=_0x577242;_0x31f5f5=0xc8;}else{_0x31f5f5=0xce;}_0x34f253[_0xc4de('0x12')](_0x31f5f5);return _0x34f253[_0xc4de('0x18')](_0xc4de('0x19'),_0x2bbc88+'-'+_0x32f165+'/'+_0x577242)[_0xc4de('0x1a')](_0x49cd73);}return null;};}function saveUpdates(_0xcc2355){return function(_0x2011e5){if(_0x2011e5){return _0x2011e5['update'](_0xcc2355)[_0xc4de('0x1b')](function(_0x233f04){return _0x233f04;});}return null;};}function removeEntity(_0x961469){return function(_0x462bcb){if(_0x462bcb){return _0x462bcb['destroy']()[_0xc4de('0x1b')](function(){_0x961469[_0xc4de('0x12')](0xcc)[_0xc4de('0x13')]();});}};}function handleEntityNotFound(_0x48601c){return function(_0x4201c0){if(!_0x4201c0){_0x48601c[_0xc4de('0x11')](0x194);}return _0x4201c0;};}function handleError(_0x31c0e1,_0x2c2af7){_0x2c2af7=_0x2c2af7||0x1f4;return function(_0xf43d27){logger[_0xc4de('0x1c')](_0xf43d27['stack']);if(_0xf43d27['name']){delete _0xf43d27[_0xc4de('0x1d')];}_0x31c0e1[_0xc4de('0x12')](_0x2c2af7)[_0xc4de('0x1e')](_0xf43d27);};}exports[_0xc4de('0x1f')]=function(_0x2b3890,_0x131275){var _0x32e868={};var _0x16b152=_[_0xc4de('0x20')](db['FaxInteraction']['rawAttributes'],function(_0x1aa0af){return{'name':_0x1aa0af[_0xc4de('0x21')],'type':_0x1aa0af['type'][_0xc4de('0x22')]};});_0x32e868=qs[_0xc4de('0x23')](_0x16b152,_0x2b3890);return interaction[_0xc4de('0x24')](_0xc4de('0x25'),_0x2b3890[_0xc4de('0x26')],_0x2b3890[_0xc4de('0x27')],_0x32e868,_0x16b152)[_0xc4de('0x1b')](respondWithFilteredResult(_0x131275,_0x32e868))[_0xc4de('0x28')](handleError(_0x131275,null));};exports[_0xc4de('0x29')]=function(_0x46e600,_0x455239){var _0x147293={'raw':![],'where':{'id':_0x46e600[_0xc4de('0x2a')]['id']}},_0x194c46={};_0x194c46[_0xc4de('0x2b')]=_['keys'](db[_0xc4de('0x2c')]['rawAttributes']);_0x194c46['query']=_[_0xc4de('0x2d')](_0x46e600[_0xc4de('0x26')]);_0x194c46[_0xc4de('0x2e')]=_[_0xc4de('0x2f')](_0x194c46[_0xc4de('0x2b')],_0x194c46[_0xc4de('0x26')]);_0x147293[_0xc4de('0x30')]=_['intersection'](_0x194c46['model'],qs[_0xc4de('0x31')](_0x46e600[_0xc4de('0x26')][_0xc4de('0x31')]));_0x147293[_0xc4de('0x30')]=_0x147293[_0xc4de('0x30')][_0xc4de('0x32')]?_0x147293['attributes']:_0x194c46[_0xc4de('0x2b')];if(_0x46e600[_0xc4de('0x26')][_0xc4de('0x33')]){_0x147293[_0xc4de('0x34')]=[{'all':!![]}];}_0x147293=_[_0xc4de('0x35')]({},_0x147293,_0x46e600[_0xc4de('0x36')]);return db[_0xc4de('0x2c')]['find'](_0x147293)[_0xc4de('0x1b')](handleEntityNotFound(_0x455239,null))[_0xc4de('0x1b')](respondWithResult(_0x455239,null))[_0xc4de('0x28')](handleError(_0x455239,null));};exports[_0xc4de('0x37')]=function(_0x1fb56e,_0x46c7f8){return db[_0xc4de('0x2c')][_0xc4de('0x37')](_0x1fb56e[_0xc4de('0x38')],{})[_0xc4de('0x1b')](respondWithResult(_0x46c7f8,0xc9))['catch'](handleError(_0x46c7f8,null));};exports[_0xc4de('0x39')]=function(_0x37ad6f,_0x182a32){if(_0x37ad6f['body']['id']){delete _0x37ad6f[_0xc4de('0x38')]['id'];}return db[_0xc4de('0x2c')][_0xc4de('0x3a')]({'where':{'id':_0x37ad6f[_0xc4de('0x2a')]['id']}})[_0xc4de('0x1b')](handleEntityNotFound(_0x182a32,null))['then'](saveUpdates(_0x37ad6f['body'],null))[_0xc4de('0x1b')](respondWithResult(_0x182a32,null))[_0xc4de('0x28')](handleError(_0x182a32,null));};exports[_0xc4de('0x3b')]=function(_0x6e08d8,_0x4566e1){return db[_0xc4de('0x2c')][_0xc4de('0x3a')]({'where':{'id':_0x6e08d8['params']['id']}})[_0xc4de('0x1b')](handleEntityNotFound(_0x4566e1,null))['then'](removeEntity(_0x4566e1,null))[_0xc4de('0x28')](handleError(_0x4566e1,null));};exports['describe']=function(_0x1a7cb6,_0x87a283){return db['FaxInteraction'][_0xc4de('0x3c')]()[_0xc4de('0x1b')](respondWithResult(_0x87a283,null))[_0xc4de('0x28')](handleError(_0x87a283,null));};exports[_0xc4de('0x3d')]=function(_0x1c56c7,_0x12dd9a){return db[_0xc4de('0x3e')]['find']({'where':{'id':_0x1c56c7[_0xc4de('0x2a')]['id']}})[_0xc4de('0x1b')](handleEntityNotFound(_0x12dd9a,null))[_0xc4de('0x1b')](function(_0x3d5dcc){if(_0x3d5dcc){return _0x3d5dcc['addMessage'](_0x1c56c7['body'][_0xc4de('0x3f')],_[_0xc4de('0x40')](_0x1c56c7[_0xc4de('0x38')],[_0xc4de('0x3f'),'id'])||{});}})['then'](respondWithResult(_0x12dd9a,null))[_0xc4de('0x28')](handleError(_0x12dd9a,null));};exports[_0xc4de('0x41')]=function(_0x2472cb,_0x2887be){var _0x2b11a9={'raw':![],'where':{}};var _0x5eaaa8={};var _0x11bdf9={'count':0x0,'rows':[]};return db[_0xc4de('0x2c')][_0xc4de('0x42')]({'where':{'id':_0x2472cb[_0xc4de('0x2a')]['id']}})[_0xc4de('0x1b')](handleEntityNotFound(_0x2887be,null))['then'](function(_0x28f876){if(_0x28f876){_0x5eaaa8[_0xc4de('0x2b')]=_[_0xc4de('0x2d')](db[_0xc4de('0x3e')][_0xc4de('0x43')]);_0x5eaaa8['query']=_[_0xc4de('0x2d')](_0x2472cb['query']);_0x5eaaa8[_0xc4de('0x2e')]=_['intersection'](_0x5eaaa8[_0xc4de('0x2b')],_0x5eaaa8['query']);_0x2b11a9[_0xc4de('0x30')]=_['intersection'](_0x5eaaa8['model'],qs[_0xc4de('0x31')](_0x2472cb['query']['fields']));_0x2b11a9['attributes']=_0x2b11a9['attributes'][_0xc4de('0x32')]?_0x2b11a9['attributes']:_0x5eaaa8[_0xc4de('0x2b')];if(!_0x2472cb[_0xc4de('0x26')]['hasOwnProperty']('nolimit')){_0x2b11a9[_0xc4de('0x17')]=qs[_0xc4de('0x17')](_0x2472cb['query']['limit']);_0x2b11a9['offset']=qs['offset'](_0x2472cb[_0xc4de('0x26')][_0xc4de('0x16')]);}_0x2b11a9[_0xc4de('0x44')]=qs[_0xc4de('0x45')](_0x2472cb['query'][_0xc4de('0x45')]);_0x2b11a9[_0xc4de('0x46')]=qs['filters'](_['pick'](_0x2472cb['query'],_0x5eaaa8[_0xc4de('0x2e')]));_0x2b11a9[_0xc4de('0x46')][_0xc4de('0x47')]=_0x28f876['id'];if(_0x2472cb[_0xc4de('0x26')][_0xc4de('0x48')]){_0x2b11a9[_0xc4de('0x46')]=_[_0xc4de('0x35')](_0x2b11a9['where'],{'$or':_['map'](_0x2b11a9[_0xc4de('0x30')],function(_0x2faf7f){var _0x4b1b22={};_0x4b1b22[_0x2faf7f]={'$like':'%'+_0x2472cb[_0xc4de('0x26')][_0xc4de('0x48')]+'%'};return _0x4b1b22;})});}if(_0x2472cb[_0xc4de('0x26')][_0xc4de('0x49')]){var _0x4e46a2=_0x2472cb[_0xc4de('0x26')]['$gte'][_0xc4de('0x4a')](',');var _0x28d34f={};_0x28d34f[_0x4e46a2[0x0]]={'$gte':moment(_0x4e46a2[0x1])[_0xc4de('0x4b')](_0xc4de('0x4c'))};_0x2b11a9[_0xc4de('0x46')]=_['merge'](_0x2b11a9[_0xc4de('0x46')],_0x28d34f);}_0x2b11a9=_[_0xc4de('0x35')]({},_0x2b11a9,_0x2472cb['options']);return db[_0xc4de('0x3e')][_0xc4de('0x15')]({'where':_0x2b11a9[_0xc4de('0x46')]})[_0xc4de('0x1b')](function(_0x3aba5a){_0x11bdf9[_0xc4de('0x15')]=_0x3aba5a;if(_0x2472cb[_0xc4de('0x26')]['includeAll']){_0x2b11a9[_0xc4de('0x34')]=[{'all':!![]}];}return db[_0xc4de('0x3e')][_0xc4de('0x24')](_0x2b11a9);})['then'](function(_0x409901){_0x11bdf9[_0xc4de('0x4d')]=_0x409901;return _0x11bdf9;});}})['then'](respondWithFilteredResult(_0x2887be,_0x2b11a9))[_0xc4de('0x28')](handleError(_0x2887be,null));};exports['addTags']=function(_0x53acca,_0x4e7e7e){return db['FaxInteraction'][_0xc4de('0x3a')]({'where':{'id':_0x53acca[_0xc4de('0x2a')]['id']}})[_0xc4de('0x1b')](handleEntityNotFound(_0x4e7e7e,null))[_0xc4de('0x1b')](function(_0x500cf9){if(_0x500cf9){return _0x500cf9['setTags'](_0x53acca[_0xc4de('0x38')][_0xc4de('0x3f')],_['omit'](_0x53acca[_0xc4de('0x38')],[_0xc4de('0x3f'),'id'])||{})[_0xc4de('0x4e')](function(){return db[_0xc4de('0x4f')]['findAll']({'attributes':['id',_0xc4de('0x1d'),_0xc4de('0x50')],'where':{'id':_0x53acca[_0xc4de('0x38')][_0xc4de('0x3f')]}});})['then'](function(_0x38b253){socket['emit']('faxInteractionTags:save',{'id':Number(_0x53acca[_0xc4de('0x2a')]['id']),'tags':_0x38b253||[]});return{'id':Number(_0x53acca['params']['id']),'tags':_0x38b253||[]};});}})[_0xc4de('0x1b')](respondWithResult(_0x4e7e7e,null))[_0xc4de('0x28')](handleError(_0x4e7e7e,null));};exports['removeTags']=function(_0x5f518a,_0x27eea7){return db['FaxInteraction'][_0xc4de('0x3a')]({'where':{'id':_0x5f518a['params']['id']}})[_0xc4de('0x1b')](handleEntityNotFound(_0x27eea7,null))[_0xc4de('0x1b')](function(_0x4ec947){if(_0x4ec947){return _0x4ec947['removeTags'](_0x5f518a[_0xc4de('0x26')][_0xc4de('0x3f')]);}})['then'](respondWithStatusCode(_0x27eea7,null))[_0xc4de('0x28')](handleError(_0x27eea7,null));};exports[_0xc4de('0x51')]=function(_0x32f2d0,_0x59638b){var _0x387578=moment()['unix']()[_0xc4de('0x52')]();var _0x3dd4b1=path[_0xc4de('0x53')](config[_0xc4de('0x54')],_0xc4de('0x55'),_0xc4de('0x56'),'tmp');var _0x570375=path[_0xc4de('0x53')](config[_0xc4de('0x54')],'server',_0xc4de('0x56'),_0xc4de('0x57'));var _0x3a08ec=path[_0xc4de('0x53')](_0x3dd4b1,_0x387578);var _0x2f7c28=util[_0xc4de('0x4b')]('transcript-%d-%s.zip',_0x32f2d0['params']['id'],_0x387578);var _0xa8f45c=path[_0xc4de('0x53')](_0x3dd4b1,_0x2f7c28);var _0x47f88d=[];_0x47f88d[_0xc4de('0x58')]({'model':db['Attachment'],'as':_0xc4de('0x59'),'raw':!![]});var _0x54f0ef=[{'model':db['FaxMessage'],'as':_0xc4de('0x5a'),'attributes':['id',_0xc4de('0x38'),_0xc4de('0x5b')],'include':_0x47f88d}];return db[_0xc4de('0x2c')][_0xc4de('0x3a')]({'where':{'id':_0x32f2d0[_0xc4de('0x2a')]['id']},'include':_0x54f0ef})['then'](handleEntityNotFound(_0x59638b,null))[_0xc4de('0x1b')](function(_0x49708b){if(_0x49708b&&_0x49708b[_0xc4de('0x5a')]){var _0x40c473=_0x49708b['get']({'plain':!![]});fs[_0xc4de('0x5c')](_0x3a08ec);for(var _0x1fe0bd=0x0;_0x1fe0bd<_0x40c473['Messages']['length'];_0x1fe0bd++){var _0x57a1d0=_0x40c473[_0xc4de('0x5a')][_0x1fe0bd][_0xc4de('0x59')];if(_0x57a1d0){var _0x517f02=path['join'](_0x570375,_0x57a1d0[_0xc4de('0x5d')]);if(fs[_0xc4de('0x5e')](_0x517f02)){fs['createReadStream'](_0x517f02)['pipe'](fs[_0xc4de('0x5f')](path[_0xc4de('0x53')](_0x3a08ec,_0x57a1d0[_0xc4de('0x5d')])));}}}return BPromise[_0xc4de('0x60')]()['then'](function(){return new BPromise(function(_0xd96da1,_0x4b2a52){zipdir(_0x3a08ec,{'saveTo':_0xa8f45c},function(_0x14e9b9,_0x5f3c13){if(_0x14e9b9)return _0x4b2a52(_0x14e9b9);return _0xd96da1(_0x5f3c13);});})[_0xc4de('0x1b')](function(){return new BPromise(function(_0x7c9942,_0x247881){rimraf(_0x3a08ec,function(_0x2697f3){if(_0x2697f3)_0x247881(_0x2697f3);return _0x7c9942();});});})['then'](function(){return _0x59638b[_0xc4de('0x51')](_0xa8f45c,_0x2f7c28,function(_0x11f946){if(_0x11f946){console[_0xc4de('0x61')](_0xc4de('0x62'),_0x11f946);}else{fs[_0xc4de('0x63')](_0xa8f45c);}});});});}else{return _0x59638b[_0xc4de('0x11')](0xc8);}})[_0xc4de('0x28')](handleError(_0x59638b,null));}; \ No newline at end of file +var _0xebe0=['attachments','join','transcript-%d-%s.zip','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','sendStatus','rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','./faxInteraction.socket','register','status','end','json','offset','limit','count','set','Content-Range','update','then','error','stack','name','index','map','FaxInteraction','rawAttributes','key','findAll','fax','user','catch','show','model','keys','query','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','params','omit','ids','getMessages','findOne','FaxMessage','filters','hasOwnProperty','sort','where','filter','$gte','format','rows','setTags','color','emit','removeTags','download','toString','root','server','tmp','files'];(function(_0x4a6e77,_0x4a677c){var _0x1c137e=function(_0x3ecd59){while(--_0x3ecd59){_0x4a6e77['push'](_0x4a6e77['shift']());}};_0x1c137e(++_0x4a677c);}(_0xebe0,0x127));var _0x0ebe=function(_0x38f95e,_0x357c55){_0x38f95e=_0x38f95e-0x0;var _0x265769=_0xebe0[_0x38f95e];return _0x265769;};'use strict';var rimraf=require(_0x0ebe('0x0'));var zipdir=require(_0x0ebe('0x1'));var moment=require(_0x0ebe('0x2'));var BPromise=require(_0x0ebe('0x3'));var util=require(_0x0ebe('0x4'));var path=require(_0x0ebe('0x5'));var fs=require('fs');var _=require(_0x0ebe('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x0ebe('0x7'));var logger=require(_0x0ebe('0x8'))('api');var config=require('../../config/environment');var db=require(_0x0ebe('0x9'))['db'];config[_0x0ebe('0xa')]=_[_0x0ebe('0xb')](config[_0x0ebe('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ebe('0xa')]));require(_0x0ebe('0xc'))[_0x0ebe('0xd')](socket);function respondWithStatusCode(_0x36cc33,_0x2be20d){_0x2be20d=_0x2be20d||0xcc;return function(_0x2715db){if(_0x2715db){return _0x36cc33['sendStatus'](_0x2be20d);}return _0x36cc33[_0x0ebe('0xe')](_0x2be20d)[_0x0ebe('0xf')]();};}function respondWithResult(_0x41fbf4,_0xbe3819){_0xbe3819=_0xbe3819||0xc8;return function(_0xc73971){if(_0xc73971){return _0x41fbf4['status'](_0xbe3819)[_0x0ebe('0x10')](_0xc73971);}};}function respondWithFilteredResult(_0x516ce2,_0xdb1db4){return function(_0x4c4745){if(_0x4c4745){var _0x228dde=typeof _0xdb1db4[_0x0ebe('0x11')]==='undefined'&&typeof _0xdb1db4[_0x0ebe('0x12')]==='undefined';var _0x4951a0=_0x4c4745['count'];var _0x12b8e9=_0x228dde?0x0:_0xdb1db4[_0x0ebe('0x11')];var _0x57e10d=_0x228dde?_0x4c4745[_0x0ebe('0x13')]:_0xdb1db4[_0x0ebe('0x11')]+_0xdb1db4[_0x0ebe('0x12')];var _0x1eedd8;if(_0x57e10d>=_0x4951a0){_0x57e10d=_0x4951a0;_0x1eedd8=0xc8;}else{_0x1eedd8=0xce;}_0x516ce2[_0x0ebe('0xe')](_0x1eedd8);return _0x516ce2[_0x0ebe('0x14')](_0x0ebe('0x15'),_0x12b8e9+'-'+_0x57e10d+'/'+_0x4951a0)[_0x0ebe('0x10')](_0x4c4745);}return null;};}function saveUpdates(_0x288227){return function(_0x4f81b3){if(_0x4f81b3){return _0x4f81b3[_0x0ebe('0x16')](_0x288227)[_0x0ebe('0x17')](function(_0x4fc42e){return _0x4fc42e;});}return null;};}function removeEntity(_0x18bac3){return function(_0x1d283e){if(_0x1d283e){return _0x1d283e['destroy']()[_0x0ebe('0x17')](function(){_0x18bac3[_0x0ebe('0xe')](0xcc)[_0x0ebe('0xf')]();});}};}function handleEntityNotFound(_0x25a312){return function(_0xf0b506){if(!_0xf0b506){_0x25a312['sendStatus'](0x194);}return _0xf0b506;};}function handleError(_0x2266b4,_0x1ac1ea){_0x1ac1ea=_0x1ac1ea||0x1f4;return function(_0x29547e){logger[_0x0ebe('0x18')](_0x29547e[_0x0ebe('0x19')]);if(_0x29547e[_0x0ebe('0x1a')]){delete _0x29547e[_0x0ebe('0x1a')];}_0x2266b4[_0x0ebe('0xe')](_0x1ac1ea)['send'](_0x29547e);};}exports[_0x0ebe('0x1b')]=function(_0x2045b6,_0x230f82){var _0x218e33={};var _0x1d933b=_[_0x0ebe('0x1c')](db[_0x0ebe('0x1d')][_0x0ebe('0x1e')],function(_0x4f9d5d){return{'name':_0x4f9d5d['fieldName'],'type':_0x4f9d5d['type'][_0x0ebe('0x1f')]};});_0x218e33=qs['getOptions'](_0x1d933b,_0x2045b6);return interaction[_0x0ebe('0x20')](_0x0ebe('0x21'),_0x2045b6['query'],_0x2045b6[_0x0ebe('0x22')],_0x218e33,_0x1d933b)['then'](respondWithFilteredResult(_0x230f82,_0x218e33))[_0x0ebe('0x23')](handleError(_0x230f82,null));};exports[_0x0ebe('0x24')]=function(_0x39ba94,_0x13379f){var _0x145136={'raw':![],'where':{'id':_0x39ba94['params']['id']}},_0x5249b9={};_0x5249b9[_0x0ebe('0x25')]=_[_0x0ebe('0x26')](db[_0x0ebe('0x1d')][_0x0ebe('0x1e')]);_0x5249b9[_0x0ebe('0x27')]=_[_0x0ebe('0x26')](_0x39ba94[_0x0ebe('0x27')]);_0x5249b9['filters']=_[_0x0ebe('0x28')](_0x5249b9[_0x0ebe('0x25')],_0x5249b9['query']);_0x145136[_0x0ebe('0x29')]=_[_0x0ebe('0x28')](_0x5249b9[_0x0ebe('0x25')],qs[_0x0ebe('0x2a')](_0x39ba94['query'][_0x0ebe('0x2a')]));_0x145136[_0x0ebe('0x29')]=_0x145136['attributes'][_0x0ebe('0x2b')]?_0x145136['attributes']:_0x5249b9[_0x0ebe('0x25')];if(_0x39ba94[_0x0ebe('0x27')][_0x0ebe('0x2c')]){_0x145136[_0x0ebe('0x2d')]=[{'all':!![]}];}_0x145136=_[_0x0ebe('0x2e')]({},_0x145136,_0x39ba94[_0x0ebe('0x2f')]);return db['FaxInteraction']['find'](_0x145136)[_0x0ebe('0x17')](handleEntityNotFound(_0x13379f,null))[_0x0ebe('0x17')](respondWithResult(_0x13379f,null))[_0x0ebe('0x23')](handleError(_0x13379f,null));};exports[_0x0ebe('0x30')]=function(_0x598bd3,_0x36811a){return db[_0x0ebe('0x1d')]['create'](_0x598bd3[_0x0ebe('0x31')],{})['then'](respondWithResult(_0x36811a,0xc9))['catch'](handleError(_0x36811a,null));};exports[_0x0ebe('0x16')]=function(_0xaeb96c,_0xcdeb0b){if(_0xaeb96c['body']['id']){delete _0xaeb96c[_0x0ebe('0x31')]['id'];}return db[_0x0ebe('0x1d')][_0x0ebe('0x32')]({'where':{'id':_0xaeb96c['params']['id']}})[_0x0ebe('0x17')](handleEntityNotFound(_0xcdeb0b,null))[_0x0ebe('0x17')](saveUpdates(_0xaeb96c[_0x0ebe('0x31')],null))['then'](respondWithResult(_0xcdeb0b,null))[_0x0ebe('0x23')](handleError(_0xcdeb0b,null));};exports['destroy']=function(_0x15b9e3,_0x2d8954){return db[_0x0ebe('0x1d')][_0x0ebe('0x32')]({'where':{'id':_0x15b9e3['params']['id']}})['then'](handleEntityNotFound(_0x2d8954,null))[_0x0ebe('0x17')](removeEntity(_0x2d8954,null))[_0x0ebe('0x23')](handleError(_0x2d8954,null));};exports[_0x0ebe('0x33')]=function(_0x14a83d,_0x5d6bba){return db[_0x0ebe('0x1d')]['describe']()['then'](respondWithResult(_0x5d6bba,null))[_0x0ebe('0x23')](handleError(_0x5d6bba,null));};exports[_0x0ebe('0x34')]=function(_0x46f800,_0xfa6c0f){return db['FaxMessage']['find']({'where':{'id':_0x46f800[_0x0ebe('0x35')]['id']}})['then'](handleEntityNotFound(_0xfa6c0f,null))[_0x0ebe('0x17')](function(_0x37c391){if(_0x37c391){return _0x37c391[_0x0ebe('0x34')](_0x46f800[_0x0ebe('0x31')]['ids'],_[_0x0ebe('0x36')](_0x46f800['body'],[_0x0ebe('0x37'),'id'])||{});}})[_0x0ebe('0x17')](respondWithResult(_0xfa6c0f,null))['catch'](handleError(_0xfa6c0f,null));};exports[_0x0ebe('0x38')]=function(_0x16c50d,_0x376990){var _0x1347d8={'raw':![],'where':{}};var _0x44e63e={};var _0x3271f2={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x0ebe('0x39')]({'where':{'id':_0x16c50d['params']['id']}})[_0x0ebe('0x17')](handleEntityNotFound(_0x376990,null))['then'](function(_0x3a8820){if(_0x3a8820){_0x44e63e[_0x0ebe('0x25')]=_[_0x0ebe('0x26')](db[_0x0ebe('0x3a')][_0x0ebe('0x1e')]);_0x44e63e[_0x0ebe('0x27')]=_[_0x0ebe('0x26')](_0x16c50d[_0x0ebe('0x27')]);_0x44e63e[_0x0ebe('0x3b')]=_['intersection'](_0x44e63e[_0x0ebe('0x25')],_0x44e63e[_0x0ebe('0x27')]);_0x1347d8[_0x0ebe('0x29')]=_[_0x0ebe('0x28')](_0x44e63e[_0x0ebe('0x25')],qs[_0x0ebe('0x2a')](_0x16c50d[_0x0ebe('0x27')]['fields']));_0x1347d8[_0x0ebe('0x29')]=_0x1347d8[_0x0ebe('0x29')][_0x0ebe('0x2b')]?_0x1347d8['attributes']:_0x44e63e[_0x0ebe('0x25')];if(!_0x16c50d[_0x0ebe('0x27')][_0x0ebe('0x3c')]('nolimit')){_0x1347d8[_0x0ebe('0x12')]=qs[_0x0ebe('0x12')](_0x16c50d[_0x0ebe('0x27')][_0x0ebe('0x12')]);_0x1347d8[_0x0ebe('0x11')]=qs['offset'](_0x16c50d[_0x0ebe('0x27')]['offset']);}_0x1347d8['order']=qs[_0x0ebe('0x3d')](_0x16c50d['query']['sort']);_0x1347d8[_0x0ebe('0x3e')]=qs[_0x0ebe('0x3b')](_['pick'](_0x16c50d[_0x0ebe('0x27')],_0x44e63e['filters']));_0x1347d8['where']['FaxInteractionId']=_0x3a8820['id'];if(_0x16c50d[_0x0ebe('0x27')][_0x0ebe('0x3f')]){_0x1347d8[_0x0ebe('0x3e')]=_[_0x0ebe('0x2e')](_0x1347d8[_0x0ebe('0x3e')],{'$or':_[_0x0ebe('0x1c')](_0x1347d8[_0x0ebe('0x29')],function(_0x17d1ff){var _0x1d4328={};_0x1d4328[_0x17d1ff]={'$like':'%'+_0x16c50d[_0x0ebe('0x27')][_0x0ebe('0x3f')]+'%'};return _0x1d4328;})});}if(_0x16c50d[_0x0ebe('0x27')][_0x0ebe('0x40')]){var _0xda6d33=_0x16c50d[_0x0ebe('0x27')][_0x0ebe('0x40')]['split'](',');var _0x475d57={};_0x475d57[_0xda6d33[0x0]]={'$gte':moment(_0xda6d33[0x1])[_0x0ebe('0x41')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1347d8['where']=_[_0x0ebe('0x2e')](_0x1347d8[_0x0ebe('0x3e')],_0x475d57);}_0x1347d8=_[_0x0ebe('0x2e')]({},_0x1347d8,_0x16c50d[_0x0ebe('0x2f')]);return db[_0x0ebe('0x3a')][_0x0ebe('0x13')]({'where':_0x1347d8[_0x0ebe('0x3e')]})[_0x0ebe('0x17')](function(_0x4a706d){_0x3271f2[_0x0ebe('0x13')]=_0x4a706d;if(_0x16c50d['query']['includeAll']){_0x1347d8[_0x0ebe('0x2d')]=[{'all':!![]}];}return db['FaxMessage'][_0x0ebe('0x20')](_0x1347d8);})['then'](function(_0x3bd5fd){_0x3271f2[_0x0ebe('0x42')]=_0x3bd5fd;return _0x3271f2;});}})[_0x0ebe('0x17')](respondWithFilteredResult(_0x376990,_0x1347d8))[_0x0ebe('0x23')](handleError(_0x376990,null));};exports['addTags']=function(_0x2e6faf,_0x4771f2){return db[_0x0ebe('0x1d')]['find']({'where':{'id':_0x2e6faf[_0x0ebe('0x35')]['id']}})[_0x0ebe('0x17')](handleEntityNotFound(_0x4771f2,null))[_0x0ebe('0x17')](function(_0x1b9543){if(_0x1b9543){return _0x1b9543[_0x0ebe('0x43')](_0x2e6faf[_0x0ebe('0x31')]['ids'],_['omit'](_0x2e6faf[_0x0ebe('0x31')],[_0x0ebe('0x37'),'id'])||{})['spread'](function(){return db['Tag'][_0x0ebe('0x20')]({'attributes':['id',_0x0ebe('0x1a'),_0x0ebe('0x44')],'where':{'id':_0x2e6faf[_0x0ebe('0x31')][_0x0ebe('0x37')]}});})[_0x0ebe('0x17')](function(_0x25e445){socket[_0x0ebe('0x45')]('faxInteractionTags:save',{'id':Number(_0x2e6faf[_0x0ebe('0x35')]['id']),'tags':_0x25e445||[]});return{'id':Number(_0x2e6faf[_0x0ebe('0x35')]['id']),'tags':_0x25e445||[]};});}})[_0x0ebe('0x17')](respondWithResult(_0x4771f2,null))[_0x0ebe('0x23')](handleError(_0x4771f2,null));};exports['removeTags']=function(_0x334f1d,_0x223388){return db[_0x0ebe('0x1d')][_0x0ebe('0x32')]({'where':{'id':_0x334f1d['params']['id']}})[_0x0ebe('0x17')](handleEntityNotFound(_0x223388,null))[_0x0ebe('0x17')](function(_0x6d1271){if(_0x6d1271){return _0x6d1271[_0x0ebe('0x46')](_0x334f1d['query']['ids']);}})['then'](respondWithStatusCode(_0x223388,null))['catch'](handleError(_0x223388,null));};exports[_0x0ebe('0x47')]=function(_0xff5f71,_0x148cd4){var _0x1fb784=moment()['unix']()[_0x0ebe('0x48')]();var _0x359ab1=path['join'](config[_0x0ebe('0x49')],_0x0ebe('0x4a'),'files',_0x0ebe('0x4b'));var _0x3da3e3=path['join'](config[_0x0ebe('0x49')],_0x0ebe('0x4a'),_0x0ebe('0x4c'),_0x0ebe('0x4d'));var _0xc0d517=path[_0x0ebe('0x4e')](_0x359ab1,_0x1fb784);var _0xf96775=util[_0x0ebe('0x41')](_0x0ebe('0x4f'),_0xff5f71[_0x0ebe('0x35')]['id'],_0x1fb784);var _0x362307=path[_0x0ebe('0x4e')](_0x359ab1,_0xf96775);var _0x1f5a6e=[];_0x1f5a6e['push']({'model':db['Attachment'],'as':_0x0ebe('0x50'),'raw':!![]});var _0x358ced=[{'model':db['FaxMessage'],'as':_0x0ebe('0x51'),'attributes':['id','body',_0x0ebe('0x52')],'include':_0x1f5a6e}];return db[_0x0ebe('0x1d')][_0x0ebe('0x32')]({'where':{'id':_0xff5f71[_0x0ebe('0x35')]['id']},'include':_0x358ced})['then'](handleEntityNotFound(_0x148cd4,null))['then'](function(_0xdd5a92){if(_0xdd5a92&&_0xdd5a92[_0x0ebe('0x51')]){var _0x12d2d9=_0xdd5a92['get']({'plain':!![]});fs[_0x0ebe('0x53')](_0xc0d517);for(var _0x4afee5=0x0;_0x4afee5<_0x12d2d9[_0x0ebe('0x51')][_0x0ebe('0x2b')];_0x4afee5++){var _0x1d8867=_0x12d2d9[_0x0ebe('0x51')][_0x4afee5][_0x0ebe('0x50')];if(_0x1d8867){var _0x38e7f7=path[_0x0ebe('0x4e')](_0x3da3e3,_0x1d8867[_0x0ebe('0x54')]);if(fs[_0x0ebe('0x55')](_0x38e7f7)){fs[_0x0ebe('0x56')](_0x38e7f7)[_0x0ebe('0x57')](fs[_0x0ebe('0x58')](path[_0x0ebe('0x4e')](_0xc0d517,_0x1d8867[_0x0ebe('0x54')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x190561,_0x400b7a){zipdir(_0xc0d517,{'saveTo':_0x362307},function(_0x57ebac,_0x4e1ba0){if(_0x57ebac)return _0x400b7a(_0x57ebac);return _0x190561(_0x4e1ba0);});})['then'](function(){return new BPromise(function(_0x8c5cfd,_0x532448){rimraf(_0xc0d517,function(_0x3f6cd8){if(_0x3f6cd8)_0x532448(_0x3f6cd8);return _0x8c5cfd();});});})[_0x0ebe('0x17')](function(){return _0x148cd4[_0x0ebe('0x47')](_0x362307,_0xf96775,function(_0x4e33c0){if(_0x4e33c0){console[_0x0ebe('0x59')](_0x0ebe('0x5a'),_0x4e33c0);}else{fs[_0x0ebe('0x5b')](_0x362307);}});});});}else{return _0x148cd4[_0x0ebe('0x5c')](0xc8);}})[_0x0ebe('0x23')](handleError(_0x148cd4,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index e49adc0..072ea8a 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 _0xabf2=['FaxInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','emit','hasOwnProperty','hook'];(function(_0x12fa8d,_0x3602cf){var _0x525439=function(_0x391a1f){while(--_0x391a1f){_0x12fa8d['push'](_0x12fa8d['shift']());}};_0x525439(++_0x3602cf);}(_0xabf2,0x168));var _0x2abf=function(_0x27b12b,_0x1820b3){_0x27b12b=_0x27b12b-0x0;var _0x4f984a=_0xabf2[_0x27b12b];return _0x4f984a;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0x2abf('0x0')];var FaxMessage=require(_0x2abf('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2abf('0x2')](0x0);var events={'afterCreate':_0x2abf('0x3'),'afterUpdate':_0x2abf('0x4'),'afterDestroy':_0x2abf('0x5')};function emitEvent(_0x3f5027){return function(_0x2f5d4d,_0x628934,_0x25de14){_0x2f5d4d[_0x2abf('0x6')]({'attributes':['id'],'raw':!![]})[_0x2abf('0x7')](function(_0x71a23b){_0x2f5d4d['setDataValue'](_0x2abf('0x8'),_0x71a23b[_0x2abf('0x9')](function(_0x3aa9f2){return{'id':_0x3aa9f2['id']};}));return FaxMessage[_0x2abf('0xa')]({'where':{'FaxInteractionId':_0x2f5d4d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2abf('0x7')](function(_0x2747dd){_0x2f5d4d[_0x2abf('0xb')]('unreadMessages',_0x2747dd['length']);FaxInteractionEvents[_0x2abf('0xc')](_0x3f5027+':'+_0x2f5d4d['id'],_0x2f5d4d);FaxInteractionEvents['emit'](_0x3f5027,_0x2f5d4d);_0x25de14(null);})['catch'](_0x25de14(null));};}for(var e in events){if(events[_0x2abf('0xd')](e)){var event=events[e];FaxInteraction[_0x2abf('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x47c4=['findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers','then','map'];(function(_0x454d39,_0x60939a){var _0xb167c4=function(_0x57c691){while(--_0x57c691){_0x454d39['push'](_0x454d39['shift']());}};_0xb167c4(++_0x60939a);}(_0x47c4,0x7b));var _0x447c=function(_0x43b5a7,_0xf5e3d6){_0x43b5a7=_0x43b5a7-0x0;var _0x5461fe=_0x47c4[_0x43b5a7];return _0x5461fe;};'use strict';var EventEmitter=require(_0x447c('0x0'));var FaxInteraction=require(_0x447c('0x1'))['db'][_0x447c('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x447c('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x447c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x447c('0x5'),'afterDestroy':_0x447c('0x6')};function emitEvent(_0x3de9a9){return function(_0x80fc61,_0x5cdc87,_0xd97edd){_0x80fc61[_0x447c('0x7')]({'attributes':['id'],'raw':!![]})[_0x447c('0x8')](function(_0x354e5a){_0x80fc61['setDataValue']('Users',_0x354e5a[_0x447c('0x9')](function(_0x260e68){return{'id':_0x260e68['id']};}));return FaxMessage[_0x447c('0xa')]({'where':{'FaxInteractionId':_0x80fc61['id'],'direction':'in','read':![]},'raw':!![]});})[_0x447c('0x8')](function(_0x3dd879){_0x80fc61[_0x447c('0xb')](_0x447c('0xc'),_0x3dd879[_0x447c('0xd')]);FaxInteractionEvents['emit'](_0x3de9a9+':'+_0x80fc61['id'],_0x80fc61);FaxInteractionEvents[_0x447c('0xe')](_0x3de9a9,_0x80fc61);_0xd97edd(null);})[_0x447c('0xf')](_0xd97edd(null));};}for(var e in events){if(events[_0x447c('0x10')](e)){var event=events[e];FaxInteraction[_0x447c('0x11')](e,emitEvent(event));}}module[_0x447c('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index c9cb4ab..33b845f 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 _0xceca=['YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./faxInteraction.attributes','exports','fax_interactions','changed','closedAt','format'];(function(_0x382a74,_0xa6ca2){var _0x4e2e95=function(_0x19fc05){while(--_0x19fc05){_0x382a74['push'](_0x382a74['shift']());}};_0x4e2e95(++_0xa6ca2);}(_0xceca,0xfd));var _0xacec=function(_0x38ebb5,_0x5afbba){_0x38ebb5=_0x38ebb5-0x0;var _0x5b95ae=_0xceca[_0x38ebb5];return _0x5b95ae;};'use strict';var _=require(_0xacec('0x0'));var util=require('util');var logger=require(_0xacec('0x1'))(_0xacec('0x2'));var moment=require(_0xacec('0x3'));var BPromise=require(_0xacec('0x4'));var rp=require(_0xacec('0x5'));var fs=require('fs');var path=require(_0xacec('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xacec('0x7'));module[_0xacec('0x8')]=function(_0x247f99,_0x4df3d2){return _0x247f99['define']('FaxInteraction',attributes,{'tableName':_0xacec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25c526,_0x159d88,_0xe310c0){if(_0x25c526[_0xacec('0xa')]('closed')){_0x25c526[_0xacec('0xb')]=moment()[_0xacec('0xc')](_0xacec('0xd'));}_0xe310c0(null,_0x25c526);}}});}; \ No newline at end of file +var _0x88f3=['define','fax_interactions','closedAt','format','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes'];(function(_0x240d29,_0x293207){var _0x1828e5=function(_0x5d0153){while(--_0x5d0153){_0x240d29['push'](_0x240d29['shift']());}};_0x1828e5(++_0x293207);}(_0x88f3,0x184));var _0x388f=function(_0x42150b,_0x46adaa){_0x42150b=_0x42150b-0x0;var _0x306f98=_0x88f3[_0x42150b];return _0x306f98;};'use strict';var _=require('lodash');var util=require(_0x388f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x388f('0x1'));var BPromise=require(_0x388f('0x2'));var rp=require(_0x388f('0x3'));var fs=require('fs');var path=require(_0x388f('0x4'));var rimraf=require(_0x388f('0x5'));var config=require(_0x388f('0x6'));var attributes=require(_0x388f('0x7'));module['exports']=function(_0x42ed88,_0x2128af){return _0x42ed88[_0x388f('0x8')]('FaxInteraction',attributes,{'tableName':_0x388f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4be3a8,_0x4ac36c,_0x57d503){if(_0x4be3a8['changed']('closed')){_0x4be3a8[_0x388f('0xa')]=moment()[_0x388f('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x57d503(null,_0x4be3a8);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 613fa24..c0364bd 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 _0xeea8=['addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','info','FaxInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','where','limit','then'];(function(_0x1a56a5,_0x470d46){var _0x27a7c1=function(_0x25c805){while(--_0x25c805){_0x1a56a5['push'](_0x1a56a5['shift']());}};_0x27a7c1(++_0x470d46);}(_0xeea8,0xa5));var _0x8eea=function(_0x35c6a5,_0x30dab7){_0x35c6a5=_0x35c6a5-0x0;var _0x2deda9=_0xeea8[_0x35c6a5];return _0x2deda9;};'use strict';var _=require('lodash');var util=require(_0x8eea('0x0'));var moment=require(_0x8eea('0x1'));var BPromise=require(_0x8eea('0x2'));var rs=require(_0x8eea('0x3'));var fs=require('fs');var Redis=require(_0x8eea('0x4'));var db=require(_0x8eea('0x5'))['db'];var utils=require(_0x8eea('0x6'));var logger=require(_0x8eea('0x7'))(_0x8eea('0x8'));var config=require(_0x8eea('0x9'));var jayson=require(_0x8eea('0xa'));var client=jayson[_0x8eea('0xb')][_0x8eea('0xc')]({'port':0x232a});config['redis']=_[_0x8eea('0xd')](config[_0x8eea('0xe')],{'host':_0x8eea('0xf'),'port':0x18eb});var socket=require(_0x8eea('0x10'))(new Redis(config[_0x8eea('0xe')]));require('./faxInteraction.socket')[_0x8eea('0x11')](socket);function respondWithRpcPromise(_0xf41fb6,_0x530106,_0xa5239e){return new BPromise(function(_0x1ee7a2,_0xa23cec){return client['request'](_0xf41fb6,_0xa5239e)['then'](function(_0x2715b6){logger[_0x8eea('0x12')](_0x8eea('0x13'),_0x530106,'request\x20sent');logger[_0x8eea('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x530106,_0x8eea('0x15'),JSON[_0x8eea('0x16')](_0x2715b6));if(_0x2715b6[_0x8eea('0x17')]){if(_0x2715b6[_0x8eea('0x17')][_0x8eea('0x18')]===0x1f4){logger['error'](_0x8eea('0x13'),_0x530106,_0x2715b6[_0x8eea('0x17')][_0x8eea('0x19')]);return _0xa23cec(_0x2715b6[_0x8eea('0x17')]['message']);}logger[_0x8eea('0x17')](_0x8eea('0x13'),_0x530106,_0x2715b6['error'][_0x8eea('0x19')]);return _0x1ee7a2(_0x2715b6['error'][_0x8eea('0x19')]);}else{logger[_0x8eea('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x530106,_0x8eea('0x15'));_0x1ee7a2(_0x2715b6[_0x8eea('0x1a')][_0x8eea('0x19')]);}})[_0x8eea('0x1b')](function(_0x8cf11){logger['error'](_0x8eea('0x13'),_0x530106,_0x8cf11);_0xa23cec(_0x8cf11);});});}exports[_0x8eea('0x1c')]=function(_0x30353a){var _0xc71808=this;return new Promise(function(_0x3c26fa,_0x54f8f5){return db[_0x8eea('0x1d')]['update'](_0x30353a[_0x8eea('0x1e')],{'raw':_0x30353a[_0x8eea('0x1f')]?_0x30353a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30353a['options']?_0x30353a[_0x8eea('0x1f')][_0x8eea('0x20')]||null:null,'attributes':_0x30353a[_0x8eea('0x1f')]?_0x30353a[_0x8eea('0x1f')]['attributes']||null:null,'limit':_0x30353a[_0x8eea('0x1f')]?_0x30353a[_0x8eea('0x1f')][_0x8eea('0x21')]||null:null})[_0x8eea('0x22')](function(_0x5d7a82){logger[_0x8eea('0x12')]('UpdateFaxInteraction',_0x30353a);logger[_0x8eea('0x14')](_0x8eea('0x1c'),_0x30353a,JSON[_0x8eea('0x16')](_0x5d7a82));_0x3c26fa(_0x5d7a82);})['catch'](function(_0x2a9928){logger[_0x8eea('0x17')](_0x8eea('0x1c'),_0x2a9928[_0x8eea('0x19')],_0x30353a);_0x54f8f5(_0xc71808['error'](0x1f4,_0x2a9928[_0x8eea('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x6e1386){return new Promise(function(_0x3a05bb,_0x233e43){return db[_0x8eea('0x1d')]['find']({'where':_0x6e1386['options']?_0x6e1386[_0x8eea('0x1f')][_0x8eea('0x20')]||null:null})[_0x8eea('0x22')](function(_0x219301){if(_0x219301){return _0x219301[_0x8eea('0x23')](_0x6e1386['body'][_0x8eea('0x24')],_[_0x8eea('0x25')](_0x6e1386[_0x8eea('0x1e')],[_0x8eea('0x24'),'id'])||{});}})[_0x8eea('0x26')](function(_0xe49b1d){logger[_0x8eea('0x12')]('AddTags',_0x6e1386);logger['debug'](_0x8eea('0x27'),_0x6e1386,JSON['stringify'](_0xe49b1d));_0x3a05bb(_0xe49b1d);})[_0x8eea('0x1b')](function(_0x556065){logger['error']('AddTags',_0x556065['message'],_0x6e1386);_0x233e43(_this[_0x8eea('0x17')](0x1f4,_0x556065[_0x8eea('0x19')]));});});}; \ No newline at end of file +var _0xeb59=['stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','where','limit','find','addTags','body','ids','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x5d5c49,_0x528f94){var _0x41cb72=function(_0x4fe8e2){while(--_0x4fe8e2){_0x5d5c49['push'](_0x5d5c49['shift']());}};_0x41cb72(++_0x528f94);}(_0xeb59,0x108));var _0x9eb5=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0xeb59[_0x5d1044];return _0x3cd90e;};'use strict';var _=require(_0x9eb5('0x0'));var util=require('util');var moment=require(_0x9eb5('0x1'));var BPromise=require(_0x9eb5('0x2'));var rs=require(_0x9eb5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9eb5('0x4'))['db'];var utils=require(_0x9eb5('0x5'));var logger=require(_0x9eb5('0x6'))(_0x9eb5('0x7'));var config=require(_0x9eb5('0x8'));var jayson=require(_0x9eb5('0x9'));var client=jayson[_0x9eb5('0xa')][_0x9eb5('0xb')]({'port':0x232a});config['redis']=_[_0x9eb5('0xc')](config[_0x9eb5('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x9eb5('0xe'))(new Redis(config['redis']));require(_0x9eb5('0xf'))[_0x9eb5('0x10')](socket);function respondWithRpcPromise(_0x8caedc,_0x2afb04,_0x2980fa){return new BPromise(function(_0x4689cf,_0x5038de){return client['request'](_0x8caedc,_0x2980fa)[_0x9eb5('0x11')](function(_0x175f91){logger[_0x9eb5('0x12')](_0x9eb5('0x13'),_0x2afb04,_0x9eb5('0x14'));logger[_0x9eb5('0x15')](_0x9eb5('0x16'),_0x2afb04,_0x9eb5('0x14'),JSON[_0x9eb5('0x17')](_0x175f91));if(_0x175f91[_0x9eb5('0x18')]){if(_0x175f91[_0x9eb5('0x18')][_0x9eb5('0x19')]===0x1f4){logger[_0x9eb5('0x18')](_0x9eb5('0x13'),_0x2afb04,_0x175f91[_0x9eb5('0x18')]['message']);return _0x5038de(_0x175f91['error'][_0x9eb5('0x1a')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x2afb04,_0x175f91[_0x9eb5('0x18')]['message']);return _0x4689cf(_0x175f91[_0x9eb5('0x18')][_0x9eb5('0x1a')]);}else{logger['info'](_0x9eb5('0x13'),_0x2afb04,_0x9eb5('0x14'));_0x4689cf(_0x175f91[_0x9eb5('0x1b')][_0x9eb5('0x1a')]);}})[_0x9eb5('0x1c')](function(_0xec54fa){logger['error'](_0x9eb5('0x13'),_0x2afb04,_0xec54fa);_0x5038de(_0xec54fa);});});}exports[_0x9eb5('0x1d')]=function(_0x5f2321){var _0x257844=this;return new Promise(function(_0x118995,_0x1e3985){return db[_0x9eb5('0x1e')][_0x9eb5('0x1f')](_0x5f2321['body'],{'raw':_0x5f2321[_0x9eb5('0x20')]?_0x5f2321[_0x9eb5('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f2321[_0x9eb5('0x20')]?_0x5f2321[_0x9eb5('0x20')][_0x9eb5('0x21')]||null:null,'attributes':_0x5f2321[_0x9eb5('0x20')]?_0x5f2321['options']['attributes']||null:null,'limit':_0x5f2321[_0x9eb5('0x20')]?_0x5f2321[_0x9eb5('0x20')][_0x9eb5('0x22')]||null:null})[_0x9eb5('0x11')](function(_0xa3dade){logger[_0x9eb5('0x12')](_0x9eb5('0x1d'),_0x5f2321);logger[_0x9eb5('0x15')](_0x9eb5('0x1d'),_0x5f2321,JSON[_0x9eb5('0x17')](_0xa3dade));_0x118995(_0xa3dade);})[_0x9eb5('0x1c')](function(_0x42b1fd){logger['error'](_0x9eb5('0x1d'),_0x42b1fd['message'],_0x5f2321);_0x1e3985(_0x257844[_0x9eb5('0x18')](0x1f4,_0x42b1fd['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x59fd9e){return new Promise(function(_0x4b083f,_0x275960){return db['FaxInteraction'][_0x9eb5('0x23')]({'where':_0x59fd9e[_0x9eb5('0x20')]?_0x59fd9e[_0x9eb5('0x20')][_0x9eb5('0x21')]||null:null})[_0x9eb5('0x11')](function(_0x22de65){if(_0x22de65){return _0x22de65[_0x9eb5('0x24')](_0x59fd9e[_0x9eb5('0x25')][_0x9eb5('0x26')],_['omit'](_0x59fd9e[_0x9eb5('0x25')],['ids','id'])||{});}})[_0x9eb5('0x27')](function(_0x52fab2){logger[_0x9eb5('0x12')](_0x9eb5('0x28'),_0x59fd9e);logger['debug']('AddTags',_0x59fd9e,JSON[_0x9eb5('0x17')](_0x52fab2));_0x4b083f(_0x52fab2);})['catch'](function(_0x423c1d){logger['error'](_0x9eb5('0x28'),_0x423c1d[_0x9eb5('0x1a')],_0x59fd9e);_0x275960(_this[_0x9eb5('0x18')](0x1f4,_0x423c1d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index cee06f7..1c8f4f0 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 _0x3d9c=['save','update','emit','removeListener','length','./faxInteraction.events'];(function(_0x2ca454,_0x285eb5){var _0xaa0037=function(_0x2eaef1){while(--_0x2eaef1){_0x2ca454['push'](_0x2ca454['shift']());}};_0xaa0037(++_0x285eb5);}(_0x3d9c,0x16d));var _0xc3d9=function(_0x108bc4,_0x445adb){_0x108bc4=_0x108bc4-0x0;var _0x712cb5=_0x3d9c[_0x108bc4];return _0x712cb5;};'use strict';var FaxInteractionEvents=require(_0xc3d9('0x0'));var events=[_0xc3d9('0x1'),'remove',_0xc3d9('0x2')];function createListener(_0x58b877,_0x4df908){return function(_0x5a6868){_0x4df908[_0xc3d9('0x3')](_0x58b877,_0x5a6868);};}function removeListener(_0x2fcfc8,_0x32a60e){return function(){FaxInteractionEvents[_0xc3d9('0x4')](_0x2fcfc8,_0x32a60e);};}exports['register']=function(_0x5eed9e){for(var _0x242611=0x0,_0x773b38=events[_0xc3d9('0x5')];_0x242611<_0x773b38;_0x242611++){var _0x2c62c8=events[_0x242611];var _0x8b1d8a=createListener('faxInteraction:'+_0x2c62c8,_0x5eed9e);FaxInteractionEvents['on'](_0x2c62c8,_0x8b1d8a);}}; \ No newline at end of file +var _0xeff4=['./faxInteraction.events','remove','update','removeListener','length','faxInteraction:'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0xeff4,0xcc));var _0x4eff=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0xeff4[_0x5f1cf8];return _0x27d0fa;};'use strict';var FaxInteractionEvents=require(_0x4eff('0x0'));var events=['save',_0x4eff('0x1'),_0x4eff('0x2')];function createListener(_0x133c44,_0x1b43d1){return function(_0x48cdeb){_0x1b43d1['emit'](_0x133c44,_0x48cdeb);};}function removeListener(_0x530b16,_0x2cc132){return function(){FaxInteractionEvents[_0x4eff('0x3')](_0x530b16,_0x2cc132);};}exports['register']=function(_0x1e6139){for(var _0x20087b=0x0,_0x9ac0f8=events[_0x4eff('0x4')];_0x20087b<_0x9ac0f8;_0x20087b++){var _0xc32c70=events[_0x20087b];var _0x20d1e8=createListener(_0x4eff('0x5')+_0xc32c70,_0x1e6139);FaxInteractionEvents['on'](_0xc32c70,_0x20d1e8);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 8f4606e..9e1cfad 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 _0x585d=['fax','addTags','put','/:id','update','delete','faxinteraction:destroy','destroy','removeTags','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','show','getMessages','download','post','create','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x585d,0x135));var _0xd585=function(_0x2d8e23,_0x137866){_0x2d8e23=_0x2d8e23-0x0;var _0x1eb51a=_0x585d[_0x2d8e23];return _0x1eb51a;};'use strict';var multer=require(_0xd585('0x0'));var util=require('util');var path=require(_0xd585('0x1'));var timeout=require('connect-timeout');var express=require(_0xd585('0x2'));var router=express[_0xd585('0x3')]();var fs_extra=require(_0xd585('0x4'));var auth=require(_0xd585('0x5'));var interaction=require(_0xd585('0x6'));var config=require(_0xd585('0x7'));var controller=require(_0xd585('0x8'));router[_0xd585('0x9')]('/',auth[_0xd585('0xa')](),controller[_0xd585('0xb')]);router[_0xd585('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd585('0x9')]('/:id',auth[_0xd585('0xa')](),controller[_0xd585('0xc')]);router[_0xd585('0x9')]('/:id/messages',auth[_0xd585('0xa')](),controller[_0xd585('0xd')]);router[_0xd585('0x9')]('/:id/download',auth[_0xd585('0xa')](),controller[_0xd585('0xe')]);router[_0xd585('0xf')]('/',auth['isAuthenticated'](),controller[_0xd585('0x10')]);router[_0xd585('0xf')](_0xd585('0x11'),auth[_0xd585('0xa')](),controller[_0xd585('0x12')]);router[_0xd585('0xf')](_0xd585('0x13'),auth[_0xd585('0xa')](),interaction[_0xd585('0x14')](_0xd585('0x15'),'faxinteraction:addtags'),controller[_0xd585('0x16')]);router[_0xd585('0x17')](_0xd585('0x18'),auth[_0xd585('0xa')](),interaction[_0xd585('0x14')](_0xd585('0x15'),'faxinteraction:update'),controller[_0xd585('0x19')]);router[_0xd585('0x1a')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xd585('0x15'),_0xd585('0x1b')),controller[_0xd585('0x1c')]);router[_0xd585('0x1a')](_0xd585('0x13'),auth[_0xd585('0xa')](),controller[_0xd585('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xadae=['get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','fax','faxinteraction:update','update','delete','exports','multer','util','path','../../config/environment'];(function(_0x3fc343,_0x2c8627){var _0x14e58b=function(_0x227422){while(--_0x227422){_0x3fc343['push'](_0x3fc343['shift']());}};_0x14e58b(++_0x2c8627);}(_0xadae,0x134));var _0xeada=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xadae[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0xeada('0x0'));var util=require(_0xeada('0x1'));var path=require(_0xeada('0x2'));var timeout=require('connect-timeout');var express=require('express');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(_0xeada('0x3'));var controller=require('./faxInteraction.controller');router[_0xeada('0x4')]('/',auth[_0xeada('0x5')](),controller['index']);router['get'](_0xeada('0x6'),auth[_0xeada('0x5')](),controller[_0xeada('0x7')]);router[_0xeada('0x4')](_0xeada('0x8'),auth[_0xeada('0x5')](),controller[_0xeada('0x9')]);router[_0xeada('0x4')](_0xeada('0xa'),auth[_0xeada('0x5')](),controller[_0xeada('0xb')]);router[_0xeada('0x4')](_0xeada('0xc'),auth['isAuthenticated'](),controller['download']);router[_0xeada('0xd')]('/',auth[_0xeada('0x5')](),controller[_0xeada('0xe')]);router[_0xeada('0xd')](_0xeada('0xa'),auth['isAuthenticated'](),controller[_0xeada('0xf')]);router[_0xeada('0xd')](_0xeada('0x10'),auth[_0xeada('0x5')](),interaction[_0xeada('0x11')]('fax',_0xeada('0x12')),controller['addTags']);router['put']('/:id',auth['isAuthenticated'](),interaction[_0xeada('0x11')](_0xeada('0x13'),_0xeada('0x14')),controller[_0xeada('0x15')]);router[_0xeada('0x16')](_0xeada('0x8'),auth[_0xeada('0x5')](),interaction[_0xeada('0x11')]('fax','faxinteraction:destroy'),controller['destroy']);router[_0xeada('0x16')]('/:id/tags',auth[_0xeada('0x5')](),controller['removeTags']);module[_0xeada('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index af74137..ac7e4bd 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 _0x05b0=['out','DATE','TEXT','medium','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05b0,0x188));var _0x005b=function(_0x4821ab,_0x14a89a){_0x4821ab=_0x4821ab-0x0;var _0x3ddead=_0x05b0[_0x4821ab];return _0x3ddead;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x005b('0x0')](_0x005b('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x005b('0x2')]('in',_0x005b('0x3')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x005b('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0x005b('0x4')]}}; \ No newline at end of file +var _0x98d3=['exports','medium','ENUM','out','TEXT','sequelize'];(function(_0x4ac92f,_0x4a5bf4){var _0x4d6005=function(_0x386e05){while(--_0x386e05){_0x4ac92f['push'](_0x4ac92f['shift']());}};_0x4d6005(++_0x4a5bf4);}(_0x98d3,0x173));var _0x398d=function(_0x29fa5f,_0x457445){_0x29fa5f=_0x29fa5f-0x0;var _0x6bb4ff=_0x98d3[_0x29fa5f];return _0x6bb4ff;};'use strict';var Sequelize=require(_0x398d('0x0'));module[_0x398d('0x1')]={'body':{'type':Sequelize['TEXT'](_0x398d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x398d('0x3')]('in','out'),'defaultValue':_0x398d('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x398d('0x5')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index afef0d6..83c1ebd 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 _0x7af1=['format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','AcceptMessage','acceptMessage','ContactId','sequelize','contact','User','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','interface','motionChannel','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','localhost','./faxMessage.socket','register','jayson/promise','http','client','request','info','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','FaxMessage','includeAll','include','findAll','params','body','find','destroy','describe','fax-interactions','accept','fax','read','readAt'];(function(_0x5e092c,_0x531bcd){var _0x4f14d8=function(_0x5e39b3){while(--_0x5e39b3){_0x5e092c['push'](_0x5e092c['shift']());}};_0x4f14d8(++_0x531bcd);}(_0x7af1,0x1e0));var _0x17af=function(_0xd04149,_0x4f3356){_0xd04149=_0xd04149-0x0;var _0x3892ad=_0x7af1[_0xd04149];return _0x3892ad;};'use strict';var emlformat=require(_0x17af('0x0'));var rimraf=require(_0x17af('0x1'));var zipdir=require(_0x17af('0x2'));var jsonpatch=require(_0x17af('0x3'));var rp=require(_0x17af('0x4'));var moment=require(_0x17af('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x17af('0x6'));var path=require(_0x17af('0x7'));var sox=require(_0x17af('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x17af('0x9'));var _=require(_0x17af('0xa'));var squel=require('squel');var crypto=require(_0x17af('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x17af('0xc'));var toCsv=require(_0x17af('0xd'));var querystring=require(_0x17af('0xe'));var Papa=require('papaparse');var Redis=require(_0x17af('0xf'));var authService=require(_0x17af('0x10'));var qs=require(_0x17af('0x11'));var as=require(_0x17af('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17af('0x13'))(_0x17af('0x14'));var utils=require('../../config/utils');var config=require(_0x17af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x17af('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x17af('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x17af('0x18'))[_0x17af('0x19')](socket);var jayson=require(_0x17af('0x1a'));var client=jayson['client'][_0x17af('0x1b')]({'port':0x232c});var client9002=jayson[_0x17af('0x1c')][_0x17af('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4453bd,_0x192d63,_0x32062e,_0x3d413e){return new BPromise(function(_0x3bcbde,_0x397d4e){var _0x40790f=_0x3d413e||client;return _0x40790f[_0x17af('0x1d')](_0x4453bd,_0x32062e)['then'](function(_0x5440b2){logger[_0x17af('0x1e')](_0x17af('0x1f'),_0x192d63,'request\x20sent');logger[_0x17af('0x20')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x192d63,_0x17af('0x21'),JSON[_0x17af('0x22')](_0x5440b2));if(_0x5440b2[_0x17af('0x23')]){if(_0x5440b2['error']['code']===0x1f4){logger[_0x17af('0x23')](_0x17af('0x1f'),_0x192d63,_0x5440b2['error']['message']);return _0x397d4e(_0x5440b2[_0x17af('0x23')][_0x17af('0x24')]);}logger[_0x17af('0x23')](_0x17af('0x1f'),_0x192d63,_0x5440b2[_0x17af('0x23')][_0x17af('0x24')]);return _0x3bcbde(_0x5440b2['error'][_0x17af('0x24')]);}else{logger['info'](_0x17af('0x1f'),_0x192d63,_0x17af('0x21'));_0x3bcbde(_0x5440b2[_0x17af('0x25')]['message']);}})[_0x17af('0x26')](function(_0x41408d){logger['error'](_0x17af('0x1f'),_0x192d63,_0x41408d);_0x397d4e(_0x41408d);});});}function respondWithStatusCode(_0x37c085,_0x4c96f9){_0x4c96f9=_0x4c96f9||0xcc;return function(_0x55873c){if(_0x55873c){return _0x37c085[_0x17af('0x27')](_0x4c96f9);}return _0x37c085[_0x17af('0x28')](_0x4c96f9)[_0x17af('0x29')]();};}function respondWithResult(_0x34c088,_0x22de77){_0x22de77=_0x22de77||0xc8;return function(_0x4a05bc){if(_0x4a05bc){return _0x34c088[_0x17af('0x28')](_0x22de77)[_0x17af('0x2a')](_0x4a05bc);}};}function respondWithFilteredResult(_0x25eeb2,_0x1f2d33){return function(_0x2336f1){if(_0x2336f1){var _0x3fc832=typeof _0x1f2d33[_0x17af('0x2b')]===_0x17af('0x2c')&&typeof _0x1f2d33[_0x17af('0x2d')]===_0x17af('0x2c');var _0x3604e8=_0x2336f1[_0x17af('0x2e')];var _0x4d1deb=_0x3fc832?0x0:_0x1f2d33[_0x17af('0x2b')];var _0x521161=_0x3fc832?_0x2336f1[_0x17af('0x2e')]:_0x1f2d33[_0x17af('0x2b')]+_0x1f2d33[_0x17af('0x2d')];var _0x18b2ce;if(_0x521161>=_0x3604e8){_0x521161=_0x3604e8;_0x18b2ce=0xc8;}else{_0x18b2ce=0xce;}_0x25eeb2[_0x17af('0x28')](_0x18b2ce);return _0x25eeb2[_0x17af('0x2f')](_0x17af('0x30'),_0x4d1deb+'-'+_0x521161+'/'+_0x3604e8)['json'](_0x2336f1);}return null;};}function patchUpdates(_0x339efd){return function(_0x3375be){try{jsonpatch[_0x17af('0x31')](_0x3375be,_0x339efd,!![]);}catch(_0x39b99b){return BPromise['reject'](_0x39b99b);}return _0x3375be[_0x17af('0x32')]();};}function saveUpdates(_0xd4e348,_0x3f95b1){return function(_0x148e03){if(_0x148e03){return _0x148e03[_0x17af('0x33')](_0xd4e348)[_0x17af('0x34')](function(_0x4dff91){return _0x4dff91;});}return null;};}function removeEntity(_0x28776b,_0x3279ce){return function(_0x1d659c){if(_0x1d659c){return _0x1d659c['destroy']()['then'](function(){_0x28776b[_0x17af('0x28')](0xcc)[_0x17af('0x29')]();});}};}function handleEntityNotFound(_0x36b3b0,_0x42667d){return function(_0xe1d84d){if(!_0xe1d84d){_0x36b3b0[_0x17af('0x27')](0x194);}return _0xe1d84d;};}function handleError(_0x516813,_0x43998a){_0x43998a=_0x43998a||0x1f4;return function(_0x49fa62){logger[_0x17af('0x23')](_0x49fa62[_0x17af('0x35')]);if(_0x49fa62[_0x17af('0x36')]){delete _0x49fa62[_0x17af('0x36')];}_0x516813[_0x17af('0x28')](_0x43998a)[_0x17af('0x37')](_0x49fa62);};}exports[_0x17af('0x38')]=function(_0x2e1c91,_0x4c711d){var _0x30f87e={},_0x540942={},_0x4b9785={'count':0x0,'rows':[]};var _0xa6a2cb=_[_0x17af('0x39')](db['FaxMessage'][_0x17af('0x3a')],function(_0x1e2152){return{'name':_0x1e2152[_0x17af('0x3b')],'type':_0x1e2152[_0x17af('0x3c')]['key']};});_0x540942[_0x17af('0x3d')]=_[_0x17af('0x39')](_0xa6a2cb,_0x17af('0x36'));_0x540942[_0x17af('0x3e')]=_[_0x17af('0x3f')](_0x2e1c91['query']);_0x540942[_0x17af('0x40')]=_[_0x17af('0x41')](_0x540942[_0x17af('0x3d')],_0x540942[_0x17af('0x3e')]);_0x30f87e['attributes']=_[_0x17af('0x41')](_0x540942[_0x17af('0x3d')],qs['fields'](_0x2e1c91['query'][_0x17af('0x42')]));_0x30f87e[_0x17af('0x43')]=_0x30f87e[_0x17af('0x43')][_0x17af('0x44')]?_0x30f87e[_0x17af('0x43')]:_0x540942[_0x17af('0x3d')];if(!_0x2e1c91['query'][_0x17af('0x45')]('nolimit')){_0x30f87e[_0x17af('0x2d')]=qs['limit'](_0x2e1c91[_0x17af('0x3e')][_0x17af('0x2d')]);_0x30f87e[_0x17af('0x2b')]=qs[_0x17af('0x2b')](_0x2e1c91[_0x17af('0x3e')][_0x17af('0x2b')]);}_0x30f87e[_0x17af('0x46')]=qs[_0x17af('0x47')](_0x2e1c91[_0x17af('0x3e')][_0x17af('0x47')]);_0x30f87e['where']=qs[_0x17af('0x40')](_[_0x17af('0x48')](_0x2e1c91[_0x17af('0x3e')],_0x540942[_0x17af('0x40')]),_0xa6a2cb);if(_0x2e1c91['query'][_0x17af('0x49')]){_0x30f87e[_0x17af('0x4a')]=_[_0x17af('0x4b')](_0x30f87e['where'],{'$or':_[_0x17af('0x39')](_0xa6a2cb,function(_0x5a4bdc){if(_0x5a4bdc[_0x17af('0x3c')]!==_0x17af('0x4c')){var _0x1127f3={};_0x1127f3[_0x5a4bdc['name']]={'$like':'%'+_0x2e1c91[_0x17af('0x3e')][_0x17af('0x49')]+'%'};return _0x1127f3;}})});}_0x30f87e=_[_0x17af('0x4b')]({},_0x30f87e,_0x2e1c91[_0x17af('0x4d')]);var _0x4bbd11={'where':_0x30f87e[_0x17af('0x4a')]};return db[_0x17af('0x4e')][_0x17af('0x2e')](_0x4bbd11)[_0x17af('0x34')](function(_0xbd0e09){_0x4b9785[_0x17af('0x2e')]=_0xbd0e09;if(_0x2e1c91[_0x17af('0x3e')][_0x17af('0x4f')]){_0x30f87e[_0x17af('0x50')]=[{'all':!![]}];}return db[_0x17af('0x4e')][_0x17af('0x51')](_0x30f87e);})[_0x17af('0x34')](function(_0x610e2a){_0x4b9785['rows']=_0x610e2a;return _0x4b9785;})['then'](respondWithFilteredResult(_0x4c711d,_0x30f87e))[_0x17af('0x26')](handleError(_0x4c711d,null));};exports['show']=function(_0x194ac3,_0x22c927){var _0x296c23={'raw':!![],'where':{'id':_0x194ac3[_0x17af('0x52')]['id']}},_0x3ef635={};_0x3ef635['model']=_[_0x17af('0x3f')](db[_0x17af('0x4e')][_0x17af('0x3a')]);_0x3ef635[_0x17af('0x3e')]=_[_0x17af('0x3f')](_0x194ac3[_0x17af('0x3e')]);_0x3ef635[_0x17af('0x40')]=_[_0x17af('0x41')](_0x3ef635['model'],_0x3ef635['query']);_0x296c23[_0x17af('0x43')]=_['intersection'](_0x3ef635[_0x17af('0x3d')],qs['fields'](_0x194ac3[_0x17af('0x3e')][_0x17af('0x42')]));_0x296c23[_0x17af('0x43')]=_0x296c23['attributes'][_0x17af('0x44')]?_0x296c23[_0x17af('0x43')]:_0x3ef635[_0x17af('0x3d')];if(_0x194ac3['query']['includeAll']){_0x296c23[_0x17af('0x50')]=[{'all':!![]}];}_0x296c23=_[_0x17af('0x4b')]({},_0x296c23,_0x194ac3[_0x17af('0x4d')]);return db['FaxMessage']['find'](_0x296c23)[_0x17af('0x34')](handleEntityNotFound(_0x22c927,null))[_0x17af('0x34')](respondWithResult(_0x22c927,null))[_0x17af('0x26')](handleError(_0x22c927,null));};exports['update']=function(_0x4f67f6,_0x41e9e6){if(_0x4f67f6[_0x17af('0x53')]['id']){delete _0x4f67f6[_0x17af('0x53')]['id'];}return db[_0x17af('0x4e')][_0x17af('0x54')]({'where':{'id':_0x4f67f6[_0x17af('0x52')]['id']}})[_0x17af('0x34')](handleEntityNotFound(_0x41e9e6,null))[_0x17af('0x34')](saveUpdates(_0x4f67f6[_0x17af('0x53')],null))[_0x17af('0x34')](respondWithResult(_0x41e9e6,null))['catch'](handleError(_0x41e9e6,null));};exports[_0x17af('0x55')]=function(_0x2f6319,_0x21ac34){return db[_0x17af('0x4e')]['find']({'where':{'id':_0x2f6319[_0x17af('0x52')]['id']}})[_0x17af('0x34')](handleEntityNotFound(_0x21ac34,null))['then'](removeEntity(_0x21ac34,null))[_0x17af('0x26')](handleError(_0x21ac34,null));};exports[_0x17af('0x56')]=function(_0x2d352e,_0xa89e27){return db[_0x17af('0x4e')][_0x17af('0x56')]()['then'](respondWithResult(_0xa89e27,null))[_0x17af('0x26')](handleError(_0xa89e27,null));};var interaction_log=require('../../config/logger')(_0x17af('0x57'));exports[_0x17af('0x58')]=function(_0x129a10,_0x1237f1,_0x3d0d5c){var _0x105099={'agent':{},'channel':_0x17af('0x59')};if(_0x129a10['body']['id']){delete _0x129a10['body']['id'];}_0x129a10[_0x17af('0x53')][_0x17af('0x5a')]=!![];_0x129a10['body'][_0x17af('0x5b')]=moment()[_0x17af('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x129a10['body'][_0x17af('0x5d')]=_0x129a10['body'][_0x17af('0x5d')]||_0x129a10[_0x17af('0x5e')]['id'];_0x105099[_0x17af('0x5f')]['id']=_0x129a10[_0x17af('0x53')][_0x17af('0x5d')];return db[_0x17af('0x4e')][_0x17af('0x54')]({'where':{'id':_0x129a10[_0x17af('0x52')]['id'],'UserId':null}})[_0x17af('0x34')](handleEntityNotFound(_0x1237f1,null))[_0x17af('0x34')](saveUpdates(_0x129a10[_0x17af('0x53')],null))[_0x17af('0x34')](function(_0x41d140){if(_0x41d140){_0x105099[_0x17af('0x24')]=_0x41d140[_0x17af('0x60')]({'plain':!![]});return db[_0x17af('0x61')][_0x17af('0x54')]({'where':{'id':_0x41d140[_0x17af('0x62')]}});}return null;})[_0x17af('0x34')](handleEntityNotFound(_0x1237f1,null))[_0x17af('0x34')](function(_0x719d0e){if(_0x719d0e){return _0x719d0e[_0x17af('0x33')]({'UserId':_0x129a10[_0x17af('0x53')][_0x17af('0x5d')],'read1stAt':_[_0x17af('0x63')](_0x719d0e[_0x17af('0x64')])?moment()[_0x17af('0x5c')](_0x17af('0x65')):undefined});}return null;})[_0x17af('0x34')](function(_0x1aaec5){if(_0x1aaec5){_0x105099[_0x17af('0x66')]=_0x1aaec5[_0x17af('0x60')]({'plain':!![]});interaction_log[_0x17af('0x1e')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x129a10[_0x17af('0x5e')]['id'],_0x129a10[_0x17af('0x5e')][_0x17af('0x36')],_0x129a10[_0x17af('0x5e')][_0x17af('0x67')],_0x105099[_0x17af('0x66')]['id'],_0x129a10[_0x17af('0x53')]?JSON['stringify'](_0x129a10[_0x17af('0x53')]):'null');return respondWithRpcPromise(_0x17af('0x68'),_0x17af('0x69'),_0x105099);}return null;})[_0x17af('0x34')](function(_0x319803){var _0x1a5db8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x319803[_0x17af('0x24')][_0x17af('0x6a')];return db[_0x17af('0x6b')][_0x17af('0x3e')](_0x1a5db8,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x17af('0x34')](function(_0x73c90a){return _0x73c90a;});})[_0x17af('0x34')](function(_0x5dc16f){if(_0x5dc16f){_0x105099[_0x17af('0x24')][_0x17af('0x6c')]=_0x5dc16f[0x0];if(!_0x129a10['body'][_0x17af('0x5d')])return;return db[_0x17af('0x6d')][_0x17af('0x54')]({'where':{'id':_0x129a10[_0x17af('0x53')]['UserId'],'role':_0x17af('0x5f')},'attributes':['id','name',_0x17af('0x6e'),_0x17af('0x6f'),_0x17af('0x70')],'raw':!![]});}return null;})[_0x17af('0x34')](function(_0xaa353f){if(!_0xaa353f)return null;_0x105099[_0x17af('0x24')][_0x17af('0x5f')]=_0xaa353f;return _0x105099;})['then'](function(_0x13f29c){if(_0x13f29c){if(_0x129a10['body'][_0x17af('0x71')]){_0x105099[_0x17af('0x24')]['interface']=util[_0x17af('0x5c')](_0x17af('0x72'),_0x129a10[_0x17af('0x5e')]['name']);_0x105099[_0x17af('0x24')]['channel']=_0x105099[_0x17af('0x73')];_0x105099[_0x17af('0x24')]['motionChannel']=_0x105099[_0x17af('0x73')];_0x105099[_0x17af('0x24')][_0x17af('0x74')]=_0x17af('0x58');return respondWithRpcPromise(_0x17af('0x75'),_0x17af('0x75'),{'event':_0x17af('0x76'),'message':_0x105099['message']},client9002)['then'](function(){return _0x105099;});}return _0x105099;}return null;})['then'](respondWithResult(_0x1237f1,null))[_0x17af('0x26')](handleError(_0x1237f1,null));};var interaction_log=require(_0x17af('0x13'))(_0x17af('0x57'));exports[_0x17af('0x77')]=function(_0x5ec098,_0x558a0f,_0x3d7a58){var _0x48c7e3={'agent':{},'channel':_0x17af('0x59')};if(_0x5ec098['body']['id']){delete _0x5ec098[_0x17af('0x53')]['id'];}_0x5ec098[_0x17af('0x53')][_0x17af('0x5d')]=_0x5ec098[_0x17af('0x53')][_0x17af('0x5d')]||_0x5ec098[_0x17af('0x5e')]['id'];_0x48c7e3[_0x17af('0x5f')]['id']=_0x5ec098[_0x17af('0x53')][_0x17af('0x5d')];return db[_0x17af('0x4e')][_0x17af('0x54')]({'where':{'id':_0x5ec098['params']['id'],'UserId':null}})[_0x17af('0x34')](handleEntityNotFound(_0x558a0f,null))['then'](function(_0x2c6350){if(_0x2c6350){_0x48c7e3[_0x17af('0x24')]=_0x2c6350[_0x17af('0x60')]({'plain':!![]});return db['FaxInteraction'][_0x17af('0x54')]({'where':{'id':_0x2c6350[_0x17af('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x558a0f,null))[_0x17af('0x34')](function(_0x5b2fc5){if(_0x5b2fc5){_0x48c7e3[_0x17af('0x66')]=_0x5b2fc5['get']({'plain':!![]});interaction_log['info'](_0x17af('0x78'),_0x5ec098[_0x17af('0x5e')]['id'],_0x5ec098[_0x17af('0x5e')][_0x17af('0x36')],_0x5ec098['user'][_0x17af('0x67')],_0x48c7e3['interaction']['id'],_0x5ec098[_0x17af('0x53')]?JSON[_0x17af('0x22')](_0x5ec098[_0x17af('0x53')]):'null');return respondWithRpcPromise('RejectMessage',_0x17af('0x79'),_0x48c7e3);}return null;})[_0x17af('0x34')](function(_0x5f2517){var _0x111534=_0x17af('0x7a')+_0x5f2517[_0x17af('0x24')][_0x17af('0x6a')];return db[_0x17af('0x6b')][_0x17af('0x3e')](_0x111534,{'type':db[_0x17af('0x7b')][_0x17af('0x7c')]['SELECT'],'raw':!![]})[_0x17af('0x34')](function(_0x4dabb1){return _0x4dabb1;});})['then'](function(_0x3135e0){if(_0x3135e0){_0x48c7e3[_0x17af('0x24')][_0x17af('0x6c')]=_0x3135e0[0x0];if(!_0x5ec098['body']['UserId'])return;return db['User'][_0x17af('0x54')]({'where':{'id':_0x5ec098[_0x17af('0x53')][_0x17af('0x5d')],'role':_0x17af('0x5f')},'attributes':['id',_0x17af('0x36'),_0x17af('0x6e'),_0x17af('0x6f'),_0x17af('0x70')],'raw':!![]});}return null;})[_0x17af('0x34')](function(_0x4990b2){if(!_0x4990b2)return null;_0x48c7e3[_0x17af('0x24')][_0x17af('0x5f')]=_0x4990b2;return _0x48c7e3;})[_0x17af('0x34')](function(_0x20ab9e){if(_0x20ab9e){_0x20ab9e[_0x17af('0x24')][_0x17af('0x7d')]=util[_0x17af('0x5c')]('SIP/%s',_0x5ec098['user'][_0x17af('0x36')]);_0x20ab9e[_0x17af('0x24')]['channel']=_0x48c7e3['channel'];_0x20ab9e['message'][_0x17af('0x7e')]=_0x48c7e3[_0x17af('0x73')];_0x20ab9e[_0x17af('0x24')][_0x17af('0x74')]=_0x17af('0x77');respondWithRpcPromise(_0x17af('0x75'),_0x17af('0x75'),{'event':_0x17af('0x7f'),'message':_0x20ab9e['message']},client9002);return _0x48c7e3;}return null;})[_0x17af('0x34')](respondWithResult(_0x558a0f,null))['catch'](handleError(_0x558a0f,null));};exports[_0x17af('0x80')]=function(_0x48003,_0xca0ddf){var _0x5e3811;return db[_0x17af('0x4e')][_0x17af('0x80')](_0x48003[_0x17af('0x53')],{})['then'](function(_0x1d4e4c){_0x5e3811=_0x1d4e4c;return db[_0x17af('0x81')]['findOne']({'where':{'id':_0x5e3811['ContactId']}});})[_0x17af('0x34')](function(_0x93863e){if(_['isNil'](_0x93863e)){return;}else{_0x5e3811[_0x17af('0x59')]=_0x93863e[_0x17af('0x59')];return db[_0x17af('0x82')][_0x17af('0x83')]({'where':{'id':_0x5e3811[_0x17af('0x84')]}});}})[_0x17af('0x34')](function(_0x2445b5){return respondWithRpcPromise(_0x17af('0x85'),_0x17af('0x85'),{'FaxAccountId':_[_0x17af('0x63')](_0x48003[_0x17af('0x53')])?undefined:_0x48003[_0x17af('0x53')][_0x17af('0x86')],'path':_[_0x17af('0x63')](_0x2445b5)?undefined:util['format'](_0x17af('0x87'),_0x2445b5[_0x17af('0x88')]),'fax':_[_0x17af('0x63')](_0x5e3811['fax'])?undefined:_0x5e3811[_0x17af('0x59')],'AttachmentId':_0x5e3811[_0x17af('0x84')]},client9002);})[_0x17af('0x34')](respondWithResult(_0xca0ddf,0xc9))[_0x17af('0x26')](handleError(_0xca0ddf,null));};exports[_0x17af('0x89')]=function(_0x4e47ec,_0xf40f0){var _0x34dd2a=path[_0x17af('0x8a')](config[_0x17af('0x8b')],_0x17af('0x8c'),_0x17af('0x8d'),_0x17af('0x8e'));return db[_0x17af('0x4e')]['find']({'where':{'id':_0x4e47ec['params']['id']},'include':[{'model':db[_0x17af('0x82')],'as':_0x17af('0x82')}]})[_0x17af('0x34')](handleEntityNotFound(_0xf40f0,null))['then'](function(_0x41224a){if(_0x41224a){return _0xf40f0[_0x17af('0x89')](path[_0x17af('0x8a')](_0x34dd2a,_0x41224a[_0x17af('0x82')][_0x17af('0x88')]));}})[_0x17af('0x26')](handleError(_0xf40f0,null));}; \ No newline at end of file +var _0x3b2a=['../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','where','FaxMessage','includeAll','include','findAll','rows','params','body','describe','fax-interactions','accept','fax','readAt','format','user','agent','UserId','find','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','motionChannel','channel','EventManager','acceptmessage','get','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','User','SIP/%s','event','rejectmessage','create','CmContact','Attachment','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','join','root','server','attachments','download','eml-format','rimraf','zip-dir','fast-json-patch','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x4fa13a,_0x1ff9f3){var _0x470976=function(_0x1ccf25){while(--_0x1ccf25){_0x4fa13a['push'](_0x4fa13a['shift']());}};_0x470976(++_0x1ff9f3);}(_0x3b2a,0x1ae));var _0xa3b2=function(_0x40b19e,_0x51f6ec){_0x40b19e=_0x40b19e-0x0;var _0x423c2f=_0x3b2a[_0x40b19e];return _0x423c2f;};'use strict';var emlformat=require(_0xa3b2('0x0'));var rimraf=require(_0xa3b2('0x1'));var zipdir=require(_0xa3b2('0x2'));var jsonpatch=require(_0xa3b2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa3b2('0x4'));var path=require(_0xa3b2('0x5'));var sox=require('sox');var csv=require(_0xa3b2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa3b2('0x7'));var _=require(_0xa3b2('0x8'));var squel=require(_0xa3b2('0x9'));var crypto=require(_0xa3b2('0xa'));var jsforce=require(_0xa3b2('0xb'));var deskjs=require(_0xa3b2('0xc'));var toCsv=require(_0xa3b2('0x6'));var querystring=require('querystring');var Papa=require(_0xa3b2('0xd'));var Redis=require('ioredis');var authService=require(_0xa3b2('0xe'));var qs=require(_0xa3b2('0xf'));var as=require(_0xa3b2('0x10'));var hardwareService=require(_0xa3b2('0x11'));var logger=require(_0xa3b2('0x12'))('api');var utils=require(_0xa3b2('0x13'));var config=require(_0xa3b2('0x14'));var licenseUtil=require(_0xa3b2('0x15'));var db=require(_0xa3b2('0x16'))['db'];config['redis']=_[_0xa3b2('0x17')](config[_0xa3b2('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xa3b2('0x19'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xa3b2('0x1a')](socket);var jayson=require(_0xa3b2('0x1b'));var client=jayson[_0xa3b2('0x1c')][_0xa3b2('0x1d')]({'port':0x232c});var client9002=jayson[_0xa3b2('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x387c57,_0x32b170,_0x415c54,_0x28dc8c){return new BPromise(function(_0x1afe14,_0x22643f){var _0x45f505=_0x28dc8c||client;return _0x45f505[_0xa3b2('0x1e')](_0x387c57,_0x415c54)[_0xa3b2('0x1f')](function(_0xdd5cfa){logger['info'](_0xa3b2('0x20'),_0x32b170,_0xa3b2('0x21'));logger[_0xa3b2('0x22')](_0xa3b2('0x23'),_0x32b170,'request\x20sent',JSON['stringify'](_0xdd5cfa));if(_0xdd5cfa[_0xa3b2('0x24')]){if(_0xdd5cfa[_0xa3b2('0x24')][_0xa3b2('0x25')]===0x1f4){logger[_0xa3b2('0x24')](_0xa3b2('0x20'),_0x32b170,_0xdd5cfa[_0xa3b2('0x24')][_0xa3b2('0x26')]);return _0x22643f(_0xdd5cfa[_0xa3b2('0x24')][_0xa3b2('0x26')]);}logger[_0xa3b2('0x24')](_0xa3b2('0x20'),_0x32b170,_0xdd5cfa[_0xa3b2('0x24')]['message']);return _0x1afe14(_0xdd5cfa[_0xa3b2('0x24')][_0xa3b2('0x26')]);}else{logger['info'](_0xa3b2('0x20'),_0x32b170,_0xa3b2('0x21'));_0x1afe14(_0xdd5cfa[_0xa3b2('0x27')]['message']);}})[_0xa3b2('0x28')](function(_0x3f805f){logger[_0xa3b2('0x24')](_0xa3b2('0x20'),_0x32b170,_0x3f805f);_0x22643f(_0x3f805f);});});}function respondWithStatusCode(_0x3aaf90,_0x29d80d){_0x29d80d=_0x29d80d||0xcc;return function(_0x430b71){if(_0x430b71){return _0x3aaf90[_0xa3b2('0x29')](_0x29d80d);}return _0x3aaf90['status'](_0x29d80d)[_0xa3b2('0x2a')]();};}function respondWithResult(_0x3545c1,_0xaa0c58){_0xaa0c58=_0xaa0c58||0xc8;return function(_0x55bfa4){if(_0x55bfa4){return _0x3545c1[_0xa3b2('0x2b')](_0xaa0c58)[_0xa3b2('0x2c')](_0x55bfa4);}};}function respondWithFilteredResult(_0x201b98,_0xbb01b1){return function(_0x28b59e){if(_0x28b59e){var _0x58635c=typeof _0xbb01b1[_0xa3b2('0x2d')]===_0xa3b2('0x2e')&&typeof _0xbb01b1[_0xa3b2('0x2f')]===_0xa3b2('0x2e');var _0x30609c=_0x28b59e[_0xa3b2('0x30')];var _0x57bc05=_0x58635c?0x0:_0xbb01b1['offset'];var _0x29afb7=_0x58635c?_0x28b59e['count']:_0xbb01b1[_0xa3b2('0x2d')]+_0xbb01b1[_0xa3b2('0x2f')];var _0x538a3a;if(_0x29afb7>=_0x30609c){_0x29afb7=_0x30609c;_0x538a3a=0xc8;}else{_0x538a3a=0xce;}_0x201b98[_0xa3b2('0x2b')](_0x538a3a);return _0x201b98[_0xa3b2('0x31')](_0xa3b2('0x32'),_0x57bc05+'-'+_0x29afb7+'/'+_0x30609c)[_0xa3b2('0x2c')](_0x28b59e);}return null;};}function patchUpdates(_0x5ad478){return function(_0x5f54ea){try{jsonpatch[_0xa3b2('0x33')](_0x5f54ea,_0x5ad478,!![]);}catch(_0x316bce){return BPromise[_0xa3b2('0x34')](_0x316bce);}return _0x5f54ea[_0xa3b2('0x35')]();};}function saveUpdates(_0x3f5456,_0x46e025){return function(_0x5ca5d9){if(_0x5ca5d9){return _0x5ca5d9[_0xa3b2('0x36')](_0x3f5456)[_0xa3b2('0x1f')](function(_0x2ca82f){return _0x2ca82f;});}return null;};}function removeEntity(_0x387a13,_0x61a086){return function(_0x5d535b){if(_0x5d535b){return _0x5d535b[_0xa3b2('0x37')]()['then'](function(){_0x387a13[_0xa3b2('0x2b')](0xcc)[_0xa3b2('0x2a')]();});}};}function handleEntityNotFound(_0xc266c3,_0x4b799d){return function(_0x178fec){if(!_0x178fec){_0xc266c3[_0xa3b2('0x29')](0x194);}return _0x178fec;};}function handleError(_0x42205a,_0x101318){_0x101318=_0x101318||0x1f4;return function(_0x1fb4ae){logger[_0xa3b2('0x24')](_0x1fb4ae[_0xa3b2('0x38')]);if(_0x1fb4ae[_0xa3b2('0x39')]){delete _0x1fb4ae[_0xa3b2('0x39')];}_0x42205a['status'](_0x101318)[_0xa3b2('0x3a')](_0x1fb4ae);};}exports[_0xa3b2('0x3b')]=function(_0x44c2dd,_0x2573b4){var _0x2a705f={},_0x45060e={},_0x4d6b34={'count':0x0,'rows':[]};var _0xb3460d=_[_0xa3b2('0x3c')](db['FaxMessage'][_0xa3b2('0x3d')],function(_0x224c7a){return{'name':_0x224c7a[_0xa3b2('0x3e')],'type':_0x224c7a[_0xa3b2('0x3f')][_0xa3b2('0x40')]};});_0x45060e[_0xa3b2('0x41')]=_[_0xa3b2('0x3c')](_0xb3460d,_0xa3b2('0x39'));_0x45060e[_0xa3b2('0x42')]=_[_0xa3b2('0x43')](_0x44c2dd[_0xa3b2('0x42')]);_0x45060e[_0xa3b2('0x44')]=_[_0xa3b2('0x45')](_0x45060e[_0xa3b2('0x41')],_0x45060e[_0xa3b2('0x42')]);_0x2a705f[_0xa3b2('0x46')]=_['intersection'](_0x45060e[_0xa3b2('0x41')],qs[_0xa3b2('0x47')](_0x44c2dd[_0xa3b2('0x42')][_0xa3b2('0x47')]));_0x2a705f['attributes']=_0x2a705f[_0xa3b2('0x46')][_0xa3b2('0x48')]?_0x2a705f['attributes']:_0x45060e['model'];if(!_0x44c2dd[_0xa3b2('0x42')][_0xa3b2('0x49')]('nolimit')){_0x2a705f['limit']=qs['limit'](_0x44c2dd[_0xa3b2('0x42')][_0xa3b2('0x2f')]);_0x2a705f[_0xa3b2('0x2d')]=qs['offset'](_0x44c2dd[_0xa3b2('0x42')][_0xa3b2('0x2d')]);}_0x2a705f[_0xa3b2('0x4a')]=qs[_0xa3b2('0x4b')](_0x44c2dd[_0xa3b2('0x42')][_0xa3b2('0x4b')]);_0x2a705f['where']=qs[_0xa3b2('0x44')](_[_0xa3b2('0x4c')](_0x44c2dd[_0xa3b2('0x42')],_0x45060e[_0xa3b2('0x44')]),_0xb3460d);if(_0x44c2dd[_0xa3b2('0x42')][_0xa3b2('0x4d')]){_0x2a705f['where']=_[_0xa3b2('0x4e')](_0x2a705f['where'],{'$or':_[_0xa3b2('0x3c')](_0xb3460d,function(_0x114d29){if(_0x114d29[_0xa3b2('0x3f')]!==_0xa3b2('0x4f')){var _0x1a3346={};_0x1a3346[_0x114d29['name']]={'$like':'%'+_0x44c2dd[_0xa3b2('0x42')]['filter']+'%'};return _0x1a3346;}})});}_0x2a705f=_[_0xa3b2('0x4e')]({},_0x2a705f,_0x44c2dd[_0xa3b2('0x50')]);var _0x718c3d={'where':_0x2a705f[_0xa3b2('0x51')]};return db[_0xa3b2('0x52')]['count'](_0x718c3d)[_0xa3b2('0x1f')](function(_0x2016c7){_0x4d6b34[_0xa3b2('0x30')]=_0x2016c7;if(_0x44c2dd['query'][_0xa3b2('0x53')]){_0x2a705f[_0xa3b2('0x54')]=[{'all':!![]}];}return db[_0xa3b2('0x52')][_0xa3b2('0x55')](_0x2a705f);})[_0xa3b2('0x1f')](function(_0x1a58cc){_0x4d6b34[_0xa3b2('0x56')]=_0x1a58cc;return _0x4d6b34;})[_0xa3b2('0x1f')](respondWithFilteredResult(_0x2573b4,_0x2a705f))[_0xa3b2('0x28')](handleError(_0x2573b4,null));};exports['show']=function(_0x113cdf,_0x4f03f0){var _0x4035c7={'raw':!![],'where':{'id':_0x113cdf[_0xa3b2('0x57')]['id']}},_0x19685c={};_0x19685c[_0xa3b2('0x41')]=_[_0xa3b2('0x43')](db[_0xa3b2('0x52')][_0xa3b2('0x3d')]);_0x19685c[_0xa3b2('0x42')]=_[_0xa3b2('0x43')](_0x113cdf[_0xa3b2('0x42')]);_0x19685c[_0xa3b2('0x44')]=_[_0xa3b2('0x45')](_0x19685c[_0xa3b2('0x41')],_0x19685c[_0xa3b2('0x42')]);_0x4035c7[_0xa3b2('0x46')]=_[_0xa3b2('0x45')](_0x19685c['model'],qs[_0xa3b2('0x47')](_0x113cdf['query'][_0xa3b2('0x47')]));_0x4035c7[_0xa3b2('0x46')]=_0x4035c7[_0xa3b2('0x46')][_0xa3b2('0x48')]?_0x4035c7[_0xa3b2('0x46')]:_0x19685c[_0xa3b2('0x41')];if(_0x113cdf['query'][_0xa3b2('0x53')]){_0x4035c7['include']=[{'all':!![]}];}_0x4035c7=_['merge']({},_0x4035c7,_0x113cdf[_0xa3b2('0x50')]);return db[_0xa3b2('0x52')]['find'](_0x4035c7)[_0xa3b2('0x1f')](handleEntityNotFound(_0x4f03f0,null))[_0xa3b2('0x1f')](respondWithResult(_0x4f03f0,null))[_0xa3b2('0x28')](handleError(_0x4f03f0,null));};exports[_0xa3b2('0x36')]=function(_0x35a0e8,_0x294321){if(_0x35a0e8[_0xa3b2('0x58')]['id']){delete _0x35a0e8[_0xa3b2('0x58')]['id'];}return db[_0xa3b2('0x52')]['find']({'where':{'id':_0x35a0e8[_0xa3b2('0x57')]['id']}})[_0xa3b2('0x1f')](handleEntityNotFound(_0x294321,null))[_0xa3b2('0x1f')](saveUpdates(_0x35a0e8[_0xa3b2('0x58')],null))[_0xa3b2('0x1f')](respondWithResult(_0x294321,null))[_0xa3b2('0x28')](handleError(_0x294321,null));};exports[_0xa3b2('0x37')]=function(_0x45f212,_0x46c863){return db[_0xa3b2('0x52')]['find']({'where':{'id':_0x45f212[_0xa3b2('0x57')]['id']}})[_0xa3b2('0x1f')](handleEntityNotFound(_0x46c863,null))[_0xa3b2('0x1f')](removeEntity(_0x46c863,null))[_0xa3b2('0x28')](handleError(_0x46c863,null));};exports['describe']=function(_0x4179c9,_0x4c6d3d){return db['FaxMessage'][_0xa3b2('0x59')]()[_0xa3b2('0x1f')](respondWithResult(_0x4c6d3d,null))['catch'](handleError(_0x4c6d3d,null));};var interaction_log=require(_0xa3b2('0x12'))(_0xa3b2('0x5a'));exports[_0xa3b2('0x5b')]=function(_0x30094b,_0x52b7c2,_0x334365){var _0x48b994={'agent':{},'channel':_0xa3b2('0x5c')};if(_0x30094b[_0xa3b2('0x58')]['id']){delete _0x30094b['body']['id'];}_0x30094b['body']['read']=!![];_0x30094b[_0xa3b2('0x58')][_0xa3b2('0x5d')]=moment()[_0xa3b2('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x30094b[_0xa3b2('0x58')]['UserId']=_0x30094b['body']['UserId']||_0x30094b[_0xa3b2('0x5f')]['id'];_0x48b994[_0xa3b2('0x60')]['id']=_0x30094b[_0xa3b2('0x58')][_0xa3b2('0x61')];return db['FaxMessage'][_0xa3b2('0x62')]({'where':{'id':_0x30094b[_0xa3b2('0x57')]['id'],'UserId':null}})[_0xa3b2('0x1f')](handleEntityNotFound(_0x52b7c2,null))['then'](saveUpdates(_0x30094b['body'],null))[_0xa3b2('0x1f')](function(_0x3be7f6){if(_0x3be7f6){_0x48b994[_0xa3b2('0x26')]=_0x3be7f6['get']({'plain':!![]});return db['FaxInteraction'][_0xa3b2('0x62')]({'where':{'id':_0x3be7f6[_0xa3b2('0x63')]}});}return null;})[_0xa3b2('0x1f')](handleEntityNotFound(_0x52b7c2,null))[_0xa3b2('0x1f')](function(_0x216396){if(_0x216396){return _0x216396[_0xa3b2('0x36')]({'UserId':_0x30094b['body']['UserId'],'read1stAt':_[_0xa3b2('0x64')](_0x216396[_0xa3b2('0x65')])?moment()[_0xa3b2('0x5e')](_0xa3b2('0x66')):undefined});}return null;})[_0xa3b2('0x1f')](function(_0x3efdf5){if(_0x3efdf5){_0x48b994[_0xa3b2('0x67')]=_0x3efdf5['get']({'plain':!![]});interaction_log[_0xa3b2('0x68')](_0xa3b2('0x69'),_0x30094b['user']['id'],_0x30094b[_0xa3b2('0x5f')]['name'],_0x30094b[_0xa3b2('0x5f')][_0xa3b2('0x6a')],_0x48b994[_0xa3b2('0x67')]['id'],_0x30094b['body']?JSON[_0xa3b2('0x6b')](_0x30094b[_0xa3b2('0x58')]):_0xa3b2('0x6c'));return respondWithRpcPromise(_0xa3b2('0x6d'),_0xa3b2('0x6e'),_0x48b994);}return null;})[_0xa3b2('0x1f')](function(_0x196548){var _0x544ba2=_0xa3b2('0x6f')+_0x196548[_0xa3b2('0x26')][_0xa3b2('0x70')];return db['sequelize'][_0xa3b2('0x42')](_0x544ba2,{'type':db[_0xa3b2('0x71')][_0xa3b2('0x72')][_0xa3b2('0x73')],'raw':!![]})[_0xa3b2('0x1f')](function(_0x3a5bf2){return _0x3a5bf2;});})[_0xa3b2('0x1f')](function(_0x369daf){if(_0x369daf){_0x48b994[_0xa3b2('0x26')][_0xa3b2('0x74')]=_0x369daf[0x0];if(!_0x30094b['body'][_0xa3b2('0x61')])return;return db['User'][_0xa3b2('0x62')]({'where':{'id':_0x30094b['body'][_0xa3b2('0x61')],'role':_0xa3b2('0x60')},'attributes':['id','name',_0xa3b2('0x75'),_0xa3b2('0x76'),_0xa3b2('0x77')],'raw':!![]});}return null;})[_0xa3b2('0x1f')](function(_0x46d8db){if(!_0x46d8db)return null;_0x48b994['message'][_0xa3b2('0x60')]=_0x46d8db;return _0x48b994;})[_0xa3b2('0x1f')](function(_0x3a673f){if(_0x3a673f){if(_0x30094b[_0xa3b2('0x58')][_0xa3b2('0x78')]){_0x48b994['message'][_0xa3b2('0x79')]=util[_0xa3b2('0x5e')]('SIP/%s',_0x30094b[_0xa3b2('0x5f')][_0xa3b2('0x39')]);_0x48b994[_0xa3b2('0x26')]['channel']=_0x48b994['channel'];_0x48b994[_0xa3b2('0x26')][_0xa3b2('0x7a')]=_0x48b994[_0xa3b2('0x7b')];_0x48b994[_0xa3b2('0x26')]['event']=_0xa3b2('0x5b');return respondWithRpcPromise(_0xa3b2('0x7c'),_0xa3b2('0x7c'),{'event':_0xa3b2('0x7d'),'message':_0x48b994[_0xa3b2('0x26')]},client9002)[_0xa3b2('0x1f')](function(){return _0x48b994;});}return _0x48b994;}return null;})[_0xa3b2('0x1f')](respondWithResult(_0x52b7c2,null))[_0xa3b2('0x28')](handleError(_0x52b7c2,null));};var interaction_log=require(_0xa3b2('0x12'))(_0xa3b2('0x5a'));exports[_0xa3b2('0x34')]=function(_0x442fb5,_0x2df943,_0x473c8b){var _0x3108e3={'agent':{},'channel':_0xa3b2('0x5c')};if(_0x442fb5[_0xa3b2('0x58')]['id']){delete _0x442fb5[_0xa3b2('0x58')]['id'];}_0x442fb5[_0xa3b2('0x58')][_0xa3b2('0x61')]=_0x442fb5['body'][_0xa3b2('0x61')]||_0x442fb5['user']['id'];_0x3108e3[_0xa3b2('0x60')]['id']=_0x442fb5[_0xa3b2('0x58')]['UserId'];return db[_0xa3b2('0x52')][_0xa3b2('0x62')]({'where':{'id':_0x442fb5[_0xa3b2('0x57')]['id'],'UserId':null}})[_0xa3b2('0x1f')](handleEntityNotFound(_0x2df943,null))[_0xa3b2('0x1f')](function(_0x501799){if(_0x501799){_0x3108e3[_0xa3b2('0x26')]=_0x501799[_0xa3b2('0x7e')]({'plain':!![]});return db[_0xa3b2('0x7f')]['find']({'where':{'id':_0x501799[_0xa3b2('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x2df943,null))[_0xa3b2('0x1f')](function(_0x1688df){if(_0x1688df){_0x3108e3[_0xa3b2('0x67')]=_0x1688df[_0xa3b2('0x7e')]({'plain':!![]});interaction_log[_0xa3b2('0x68')](_0xa3b2('0x80'),_0x442fb5['user']['id'],_0x442fb5[_0xa3b2('0x5f')][_0xa3b2('0x39')],_0x442fb5['user'][_0xa3b2('0x6a')],_0x3108e3[_0xa3b2('0x67')]['id'],_0x442fb5[_0xa3b2('0x58')]?JSON[_0xa3b2('0x6b')](_0x442fb5['body']):_0xa3b2('0x6c'));return respondWithRpcPromise(_0xa3b2('0x81'),_0xa3b2('0x82'),_0x3108e3);}return null;})[_0xa3b2('0x1f')](function(_0x1eef2e){var _0x1c15d1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1eef2e['message'][_0xa3b2('0x70')];return db[_0xa3b2('0x83')][_0xa3b2('0x42')](_0x1c15d1,{'type':db[_0xa3b2('0x71')][_0xa3b2('0x72')]['SELECT'],'raw':!![]})['then'](function(_0x5782b3){return _0x5782b3;});})['then'](function(_0x41d03c){if(_0x41d03c){_0x3108e3[_0xa3b2('0x26')]['contact']=_0x41d03c[0x0];if(!_0x442fb5['body'][_0xa3b2('0x61')])return;return db[_0xa3b2('0x84')][_0xa3b2('0x62')]({'where':{'id':_0x442fb5[_0xa3b2('0x58')][_0xa3b2('0x61')],'role':_0xa3b2('0x60')},'attributes':['id','name',_0xa3b2('0x75'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x263e5b){if(!_0x263e5b)return null;_0x3108e3['message'][_0xa3b2('0x60')]=_0x263e5b;return _0x3108e3;})[_0xa3b2('0x1f')](function(_0x341581){if(_0x341581){_0x341581[_0xa3b2('0x26')]['interface']=util['format'](_0xa3b2('0x85'),_0x442fb5[_0xa3b2('0x5f')]['name']);_0x341581['message'][_0xa3b2('0x7b')]=_0x3108e3['channel'];_0x341581[_0xa3b2('0x26')][_0xa3b2('0x7a')]=_0x3108e3[_0xa3b2('0x7b')];_0x341581[_0xa3b2('0x26')][_0xa3b2('0x86')]=_0xa3b2('0x34');respondWithRpcPromise(_0xa3b2('0x7c'),'EventManager',{'event':_0xa3b2('0x87'),'message':_0x341581['message']},client9002);return _0x3108e3;}return null;})[_0xa3b2('0x1f')](respondWithResult(_0x2df943,null))[_0xa3b2('0x28')](handleError(_0x2df943,null));};exports[_0xa3b2('0x88')]=function(_0x402a4a,_0x4ed1a8){var _0x8cc6ad;return db['FaxMessage'][_0xa3b2('0x88')](_0x402a4a['body'],{})[_0xa3b2('0x1f')](function(_0x4e3adc){_0x8cc6ad=_0x4e3adc;return db[_0xa3b2('0x89')]['findOne']({'where':{'id':_0x8cc6ad['ContactId']}});})[_0xa3b2('0x1f')](function(_0x171dae){if(_[_0xa3b2('0x64')](_0x171dae)){return;}else{_0x8cc6ad['fax']=_0x171dae['fax'];return db[_0xa3b2('0x8a')][_0xa3b2('0x8b')]({'where':{'id':_0x8cc6ad['AttachmentId']}});}})[_0xa3b2('0x1f')](function(_0xd27910){return respondWithRpcPromise('SendFax',_0xa3b2('0x8c'),{'FaxAccountId':_[_0xa3b2('0x64')](_0x402a4a['body'])?undefined:_0x402a4a[_0xa3b2('0x58')][_0xa3b2('0x8d')],'path':_[_0xa3b2('0x64')](_0xd27910)?undefined:util[_0xa3b2('0x5e')](_0xa3b2('0x8e'),_0xd27910[_0xa3b2('0x8f')]),'fax':_[_0xa3b2('0x64')](_0x8cc6ad[_0xa3b2('0x5c')])?undefined:_0x8cc6ad[_0xa3b2('0x5c')],'AttachmentId':_0x8cc6ad[_0xa3b2('0x90')]},client9002);})[_0xa3b2('0x1f')](respondWithResult(_0x4ed1a8,0xc9))[_0xa3b2('0x28')](handleError(_0x4ed1a8,null));};exports['download']=function(_0x287cd5,_0xa1945c){var _0xbf306d=path[_0xa3b2('0x91')](config[_0xa3b2('0x92')],_0xa3b2('0x93'),'files',_0xa3b2('0x94'));return db['FaxMessage'][_0xa3b2('0x62')]({'where':{'id':_0x287cd5['params']['id']},'include':[{'model':db[_0xa3b2('0x8a')],'as':_0xa3b2('0x8a')}]})[_0xa3b2('0x1f')](handleEntityNotFound(_0xa1945c,null))['then'](function(_0x4c06b6){if(_0x4c06b6){return _0xa1945c[_0xa3b2('0x95')](path[_0xa3b2('0x91')](_0xbf306d,_0x4c06b6['Attachment'][_0xa3b2('0x8f')]));}})[_0xa3b2('0x28')](handleError(_0xa1945c,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 9990cb8..6e34e36 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 _0x8411=['remove','emit','hook','exports','FaxMessage','setMaxListeners'];(function(_0x540ae2,_0x8d5a9a){var _0x25c1d6=function(_0x31a594){while(--_0x31a594){_0x540ae2['push'](_0x540ae2['shift']());}};_0x25c1d6(++_0x8d5a9a);}(_0x8411,0x118));var _0x1841=function(_0x27184a,_0x5ae909){_0x27184a=_0x27184a-0x0;var _0x120869=_0x8411[_0x27184a];return _0x120869;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x1841('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x1841('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1841('0x2')};function emitEvent(_0x30bca9){return function(_0x2e07e5,_0x29c8aa,_0x320ec0){FaxMessageEvents['emit'](_0x30bca9+':'+_0x2e07e5['id'],_0x2e07e5);FaxMessageEvents[_0x1841('0x3')](_0x30bca9,_0x2e07e5);_0x320ec0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x1841('0x4')](e,emitEvent(event));}}module[_0x1841('0x5')]=FaxMessageEvents; \ No newline at end of file +var _0xbea5=['../../mysqldb','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x547df,_0x5576f3){var _0x5c0b0b=function(_0x570196){while(--_0x570196){_0x547df['push'](_0x547df['shift']());}};_0x5c0b0b(++_0x5576f3);}(_0xbea5,0x177));var _0x5bea=function(_0x400b43,_0x55da4e){_0x400b43=_0x400b43-0x0;var _0x3c330f=_0xbea5[_0x400b43];return _0x3c330f;};'use strict';var EventEmitter=require(_0x5bea('0x0'));var FaxMessage=require(_0x5bea('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x5bea('0x2')](0x0);var events={'afterCreate':_0x5bea('0x3'),'afterUpdate':_0x5bea('0x4'),'afterDestroy':_0x5bea('0x5')};function emitEvent(_0x1eb3b6){return function(_0x528183,_0x5cd985,_0xbf43f5){FaxMessageEvents['emit'](_0x1eb3b6+':'+_0x528183['id'],_0x528183);FaxMessageEvents[_0x5bea('0x6')](_0x1eb3b6,_0x528183);_0xbf43f5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x5bea('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 9d7c0d7..b75489e 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 _0x149e=['get','direction','toLowerCase','out','isNil','findOne','then','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models'];(function(_0x2bc9f1,_0x12581b){var _0x1d70b0=function(_0x56c791){while(--_0x56c791){_0x2bc9f1['push'](_0x2bc9f1['shift']());}};_0x1d70b0(++_0x12581b);}(_0x149e,0x1b3));var _0xe149=function(_0x3c39b5,_0x5cfb5b){_0x3c39b5=_0x3c39b5-0x0;var _0x398e36=_0x149e[_0x3c39b5];return _0x398e36;};'use strict';var _=require(_0xe149('0x0'));var util=require('util');var logger=require(_0xe149('0x1'))('api');var moment=require(_0xe149('0x2'));var BPromise=require(_0xe149('0x3'));var rp=require(_0xe149('0x4'));var fs=require('fs');var path=require(_0xe149('0x5'));var rimraf=require(_0xe149('0x6'));var config=require(_0xe149('0x7'));var attributes=require('./faxMessage.attributes');module[_0xe149('0x8')]=function(_0x3a73ad,_0x2dfc87){return _0x3a73ad[_0xe149('0x9')](_0xe149('0xa'),attributes,{'tableName':_0xe149('0xb'),'paranoid':![],'indexes':[{'name':_0xe149('0xc'),'fields':['body'],'type':_0xe149('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c15d2,_0x30414d,_0x17b316){var _0x484c5f=_0x3a73ad[_0xe149('0xe')];var _0x3244d3=_0x1c15d2[_0xe149('0xf')]({'plain':!![]});if(_0x3244d3[_0xe149('0x10')][_0xe149('0x11')]()==='in'||_0x3244d3[_0xe149('0x10')]['toLowerCase']()===_0xe149('0x12')&&!_0x3244d3['secret']&&!_[_0xe149('0x13')](_0x3244d3['UserId'])){_0x484c5f['FaxInteraction'][_0xe149('0x14')]({'where':{'id':_0x3244d3['FaxInteractionId']}})[_0xe149('0x15')](function(_0x11f572){if(_0x11f572){_0x11f572['update']({'lastMsgAt':_0x3244d3[_0xe149('0x16')],'lastMsgDirection':_0x3244d3['direction']['toLowerCase']()});}})['catch'](function(_0x561c3e){console['error'](_0x561c3e);});}_0x17b316();}},'charset':_0xe149('0x17'),'collate':_0xe149('0x18')});}; \ No newline at end of file +var _0xc9d9=['../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','update','catch','error','utf8mb4','utf8mb4_unicode_ci','api','moment','request-promise','path','rimraf'];(function(_0x528d24,_0x2e9c32){var _0x30ac28=function(_0x140c27){while(--_0x140c27){_0x528d24['push'](_0x528d24['shift']());}};_0x30ac28(++_0x2e9c32);}(_0xc9d9,0x1cf));var _0x9c9d=function(_0x121cb0,_0x18bf4a){_0x121cb0=_0x121cb0-0x0;var _0x279ab9=_0xc9d9[_0x121cb0];return _0x279ab9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9c9d('0x0'));var moment=require(_0x9c9d('0x1'));var BPromise=require('bluebird');var rp=require(_0x9c9d('0x2'));var fs=require('fs');var path=require(_0x9c9d('0x3'));var rimraf=require(_0x9c9d('0x4'));var config=require(_0x9c9d('0x5'));var attributes=require(_0x9c9d('0x6'));module[_0x9c9d('0x7')]=function(_0x3f85e2,_0x3da6e2){return _0x3f85e2['define'](_0x9c9d('0x8'),attributes,{'tableName':_0x9c9d('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x9c9d('0xa')],'type':_0x9c9d('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x135539,_0x3ed511,_0x3cf639){var _0x1a0309=_0x3f85e2[_0x9c9d('0xc')];var _0x41d636=_0x135539[_0x9c9d('0xd')]({'plain':!![]});if(_0x41d636[_0x9c9d('0xe')]['toLowerCase']()==='in'||_0x41d636[_0x9c9d('0xe')][_0x9c9d('0xf')]()===_0x9c9d('0x10')&&!_0x41d636['secret']&&!_[_0x9c9d('0x11')](_0x41d636[_0x9c9d('0x12')])){_0x1a0309[_0x9c9d('0x13')][_0x9c9d('0x14')]({'where':{'id':_0x41d636['FaxInteractionId']}})['then'](function(_0xc92950){if(_0xc92950){_0xc92950[_0x9c9d('0x15')]({'lastMsgAt':_0x41d636['createdAt'],'lastMsgDirection':_0x41d636[_0x9c9d('0xe')][_0x9c9d('0xf')]()});}})[_0x9c9d('0x16')](function(_0x3f30f8){console[_0x9c9d('0x17')](_0x3f30f8);});}_0x3cf639();}},'charset':_0x9c9d('0x18'),'collate':_0x9c9d('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 2017f1f..2a438dd 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 _0x2d17=['create','catch','UpdateFaxMessage','FaxMessage','body','options','where','attributes','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateFaxMessage'];(function(_0x2249e3,_0x58f730){var _0x2fb3c8=function(_0x4590b7){while(--_0x4590b7){_0x2249e3['push'](_0x2249e3['shift']());}};_0x2fb3c8(++_0x58f730);}(_0x2d17,0x17e));var _0x72d1=function(_0x84c4f3,_0x29e90d){_0x84c4f3=_0x84c4f3-0x0;var _0x3c0381=_0x2d17[_0x84c4f3];return _0x3c0381;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});config[_0x72d1('0x9')]=_['defaults'](config[_0x72d1('0x9')],{'host':_0x72d1('0xa'),'port':0x18eb});var socket=require(_0x72d1('0xb'))(new Redis(config['redis']));require(_0x72d1('0xc'))[_0x72d1('0xd')](socket);function respondWithRpcPromise(_0x283775,_0x593c91,_0x1d7520){return new BPromise(function(_0x3a35c6,_0x45eb4a){return client[_0x72d1('0xe')](_0x283775,_0x1d7520)[_0x72d1('0xf')](function(_0x3916f2){logger[_0x72d1('0x10')](_0x72d1('0x11'),_0x593c91,_0x72d1('0x12'));logger[_0x72d1('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'),JSON[_0x72d1('0x14')](_0x3916f2));if(_0x3916f2[_0x72d1('0x15')]){if(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x16')]===0x1f4){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);return _0x45eb4a(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);}logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2['error'][_0x72d1('0x17')]);return _0x3a35c6(_0x3916f2['error'][_0x72d1('0x17')]);}else{logger[_0x72d1('0x10')]('FaxMessage,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'));_0x3a35c6(_0x3916f2[_0x72d1('0x18')][_0x72d1('0x17')]);}})['catch'](function(_0x4925f6){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x4925f6);_0x45eb4a(_0x4925f6);});});}exports[_0x72d1('0x19')]=function(_0x1865c1){var _0x8d6890=this;return new Promise(function(_0x2253fd,_0x1e2411){return db['FaxMessage'][_0x72d1('0x1a')](_0x1865c1['body'],{'raw':_0x1865c1['options']?_0x1865c1['options']['raw']===undefined?!![]:![]:!![]})[_0x72d1('0xf')](function(_0x374602){logger['info'](_0x72d1('0x19'),_0x1865c1);logger[_0x72d1('0x13')](_0x72d1('0x19'),_0x1865c1,JSON[_0x72d1('0x14')](_0x374602));_0x2253fd(_0x374602);})[_0x72d1('0x1b')](function(_0x4e6acd){logger['error'](_0x72d1('0x19'),_0x4e6acd[_0x72d1('0x17')],_0x1865c1);_0x1e2411(_0x8d6890[_0x72d1('0x15')](0x1f4,_0x4e6acd[_0x72d1('0x17')]));});});};exports[_0x72d1('0x1c')]=function(_0x33d530){var _0x163bec=this;return new Promise(function(_0x589f7c,_0x57ec9e){return db[_0x72d1('0x1d')]['update'](_0x33d530[_0x72d1('0x1e')],{'raw':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33d530[_0x72d1('0x1f')]?_0x33d530['options'][_0x72d1('0x20')]||null:null,'attributes':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')][_0x72d1('0x21')]||null:null,'limit':_0x33d530['options']?_0x33d530[_0x72d1('0x1f')]['limit']||null:null})[_0x72d1('0xf')](function(_0x32dc5e){logger['info'](_0x72d1('0x1c'),_0x33d530);logger[_0x72d1('0x13')](_0x72d1('0x1c'),_0x33d530,JSON[_0x72d1('0x14')](_0x32dc5e));_0x589f7c(_0x32dc5e);})[_0x72d1('0x1b')](function(_0x52511f){logger[_0x72d1('0x15')](_0x72d1('0x1c'),_0x52511f[_0x72d1('0x17')],_0x33d530);_0x57ec9e(_0x163bec['error'](0x1f4,_0x52511f[_0x72d1('0x17')]));});});}; \ No newline at end of file +var _0x008c=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','catch','options','raw','then','CreateFaxMessage','attributes','limit','UpdateFaxMessage','stringify','lodash','util','moment','bluebird'];(function(_0x425c5b,_0x5a23a5){var _0x3ec47a=function(_0x1aaef9){while(--_0x1aaef9){_0x425c5b['push'](_0x425c5b['shift']());}};_0x3ec47a(++_0x5a23a5);}(_0x008c,0x188));var _0xc008=function(_0x1455f3,_0x2eba86){_0x1455f3=_0x1455f3-0x0;var _0x2a2534=_0x008c[_0x1455f3];return _0x2a2534;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});config[_0xc008('0xd')]=_['defaults'](config[_0xc008('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc008('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xc008('0xf')](socket);function respondWithRpcPromise(_0x7231b4,_0x57c46d,_0x51ba7d){return new BPromise(function(_0x543eb8,_0x1eacfa){return client[_0xc008('0x10')](_0x7231b4,_0x51ba7d)['then'](function(_0xae2dab){logger[_0xc008('0x11')](_0xc008('0x12'),_0x57c46d,_0xc008('0x13'));logger[_0xc008('0x14')](_0xc008('0x15'),_0x57c46d,_0xc008('0x13'),JSON['stringify'](_0xae2dab));if(_0xae2dab['error']){if(_0xae2dab[_0xc008('0x16')]['code']===0x1f4){logger[_0xc008('0x16')](_0xc008('0x12'),_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x1eacfa(_0xae2dab[_0xc008('0x16')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x543eb8(_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x57c46d,'request\x20sent');_0x543eb8(_0xae2dab['result'][_0xc008('0x17')]);}})[_0xc008('0x18')](function(_0x501137){logger[_0xc008('0x16')]('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0x501137);_0x1eacfa(_0x501137);});});}exports['CreateFaxMessage']=function(_0x543e5d){var _0x50261c=this;return new Promise(function(_0x5754a0,_0x4b9726){return db['FaxMessage']['create'](_0x543e5d['body'],{'raw':_0x543e5d['options']?_0x543e5d[_0xc008('0x19')][_0xc008('0x1a')]===undefined?!![]:![]:!![]})[_0xc008('0x1b')](function(_0x415af3){logger[_0xc008('0x11')](_0xc008('0x1c'),_0x543e5d);logger['debug'](_0xc008('0x1c'),_0x543e5d,JSON['stringify'](_0x415af3));_0x5754a0(_0x415af3);})['catch'](function(_0x218599){logger[_0xc008('0x16')](_0xc008('0x1c'),_0x218599[_0xc008('0x17')],_0x543e5d);_0x4b9726(_0x50261c['error'](0x1f4,_0x218599['message']));});});};exports['UpdateFaxMessage']=function(_0x3f7b07){var _0x15dade=this;return new Promise(function(_0x92c582,_0x2e31c2){return db['FaxMessage']['update'](_0x3f7b07['body'],{'raw':_0x3f7b07['options']?_0x3f7b07['options'][_0xc008('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')]['where']||null:null,'attributes':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')][_0xc008('0x1d')]||null:null,'limit':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07['options'][_0xc008('0x1e')]||null:null})[_0xc008('0x1b')](function(_0x53ed35){logger['info']('UpdateFaxMessage',_0x3f7b07);logger[_0xc008('0x14')](_0xc008('0x1f'),_0x3f7b07,JSON[_0xc008('0x20')](_0x53ed35));_0x92c582(_0x53ed35);})[_0xc008('0x18')](function(_0x1de04b){logger[_0xc008('0x16')](_0xc008('0x1f'),_0x1de04b[_0xc008('0x17')],_0x3f7b07);_0x2e31c2(_0x15dade[_0xc008('0x16')](0x1f4,_0x1de04b[_0xc008('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index da3eb33..bfa9a53 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 _0x2483=['removeListener','register','length','faxMessage:','save','remove','update'];(function(_0x4a2ad8,_0x2632ef){var _0x505aea=function(_0x2ab2ea){while(--_0x2ab2ea){_0x4a2ad8['push'](_0x4a2ad8['shift']());}};_0x505aea(++_0x2632ef);}(_0x2483,0xe4));var _0x3248=function(_0x205987,_0x1e73c7){_0x205987=_0x205987-0x0;var _0x214f3e=_0x2483[_0x205987];return _0x214f3e;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x3248('0x0'),_0x3248('0x1'),_0x3248('0x2')];function createListener(_0x3c9c23,_0x599e13){return function(_0x5bf857){_0x599e13['emit'](_0x3c9c23,_0x5bf857);};}function removeListener(_0x3a9d7d,_0x2b5411){return function(){FaxMessageEvents[_0x3248('0x3')](_0x3a9d7d,_0x2b5411);};}exports[_0x3248('0x4')]=function(_0x3e1c1a){for(var _0x5c6f91=0x0,_0xe39cc0=events[_0x3248('0x5')];_0x5c6f91<_0xe39cc0;_0x5c6f91++){var _0x13adff=events[_0x5c6f91];var _0xddfb71=createListener(_0x3248('0x6')+_0x13adff,_0x3e1c1a);FaxMessageEvents['on'](_0x13adff,_0xddfb71);}}; \ No newline at end of file +var _0xdf48=['length','faxMessage:','save','remove','update','emit','removeListener','register'];(function(_0x3be452,_0x13943f){var _0x49ce45=function(_0x4cf632){while(--_0x4cf632){_0x3be452['push'](_0x3be452['shift']());}};_0x49ce45(++_0x13943f);}(_0xdf48,0x7a));var _0x8df4=function(_0x428e26,_0x52cc9f){_0x428e26=_0x428e26-0x0;var _0x3c525e=_0xdf48[_0x428e26];return _0x3c525e;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x8df4('0x0'),_0x8df4('0x1'),_0x8df4('0x2')];function createListener(_0x4b74b0,_0x384d3a){return function(_0x41d137){_0x384d3a[_0x8df4('0x3')](_0x4b74b0,_0x41d137);};}function removeListener(_0x3e0bf4,_0x5219b0){return function(){FaxMessageEvents[_0x8df4('0x4')](_0x3e0bf4,_0x5219b0);};}exports[_0x8df4('0x5')]=function(_0x4adf05){for(var _0xff7c9f=0x0,_0x3a3708=events[_0x8df4('0x6')];_0xff7c9f<_0x3a3708;_0xff7c9f++){var _0x6368dd=events[_0xff7c9f];var _0x3c7d66=createListener(_0x8df4('0x7')+_0x6368dd,_0x4adf05);FaxMessageEvents['on'](_0x6368dd,_0x3c7d66);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index e4b6db0..e50962d 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 _0x57f8=['../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','/:id','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x57f8,0x198));var _0x857f=function(_0x4b6804,_0x301b24){_0x4b6804=_0x4b6804-0x0;var _0x11b4f1=_0x57f8[_0x4b6804];return _0x11b4f1;};'use strict';var multer=require('multer');var util=require(_0x857f('0x0'));var path=require(_0x857f('0x1'));var timeout=require(_0x857f('0x2'));var express=require(_0x857f('0x3'));var router=express[_0x857f('0x4')]();var fs_extra=require(_0x857f('0x5'));var auth=require(_0x857f('0x6'));var interaction=require(_0x857f('0x7'));var config=require(_0x857f('0x8'));var controller=require(_0x857f('0x9'));router[_0x857f('0xa')]('/',auth[_0x857f('0xb')](),controller['index']);router[_0x857f('0xa')](_0x857f('0xc'),auth[_0x857f('0xb')](),controller['describe']);router[_0x857f('0xa')](_0x857f('0xd'),auth[_0x857f('0xb')](),controller['show']);router[_0x857f('0xa')](_0x857f('0xe'),auth[_0x857f('0xb')](),controller['download']);router[_0x857f('0xf')]('/',auth[_0x857f('0xb')](),interaction[_0x857f('0x10')](_0x857f('0x11'),_0x857f('0x12')),controller[_0x857f('0x13')]);router[_0x857f('0x14')]('/:id',auth[_0x857f('0xb')](),controller[_0x857f('0x15')]);router[_0x857f('0x14')](_0x857f('0x16'),auth[_0x857f('0xb')](),controller['accept']);router['put'](_0x857f('0x17'),auth['isAuthenticated'](),controller[_0x857f('0x18')]);router['delete'](_0x857f('0xd'),auth[_0x857f('0xb')](),controller['destroy']);module[_0x857f('0x19')]=router; \ No newline at end of file +var _0x16d2=['./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x16d2,0x123));var _0x216d=function(_0x298fd6,_0x45bcb){_0x298fd6=_0x298fd6-0x0;var _0x3a28c6=_0x16d2[_0x298fd6];return _0x3a28c6;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var fs_extra=require(_0x216d('0x6'));var auth=require(_0x216d('0x7'));var interaction=require(_0x216d('0x8'));var config=require('../../config/environment');var controller=require(_0x216d('0x9'));router[_0x216d('0xa')]('/',auth[_0x216d('0xb')](),controller[_0x216d('0xc')]);router[_0x216d('0xa')](_0x216d('0xd'),auth[_0x216d('0xb')](),controller[_0x216d('0xe')]);router['get'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x10')]);router[_0x216d('0xa')](_0x216d('0x11'),auth[_0x216d('0xb')](),controller['download']);router[_0x216d('0x12')]('/',auth['isAuthenticated'](),interaction[_0x216d('0x13')](_0x216d('0x14'),_0x216d('0x15')),controller[_0x216d('0x16')]);router[_0x216d('0x17')](_0x216d('0xf'),auth['isAuthenticated'](),controller[_0x216d('0x18')]);router['put'](_0x216d('0x19'),auth[_0x216d('0xb')](),controller['accept']);router[_0x216d('0x17')](_0x216d('0x1a'),auth['isAuthenticated'](),controller[_0x216d('0x1b')]);router['delete'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x1c')]);module[_0x216d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 0cf7d9a..164524a 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 _0xf9cf=['rrmemory','beepall','roundrobin','INTEGER','sequelize','exports','name','STRING'];(function(_0x5db17c,_0x6d5c05){var _0x5476be=function(_0x4cd82c){while(--_0x4cd82c){_0x5db17c['push'](_0x5db17c['shift']());}};_0x5476be(++_0x6d5c05);}(_0xf9cf,0xec));var _0xff9c=function(_0x3089cc,_0x35d67a){_0x3089cc=_0x3089cc-0x0;var _0x48fc83=_0xf9cf[_0x3089cc];return _0x48fc83;};'use strict';var Sequelize=require(_0xff9c('0x0'));module[_0xff9c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xff9c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xff9c('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xff9c('0x4'),_0xff9c('0x5'),_0xff9c('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xff9c('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x20dc=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0xa6d0c4,_0x36f539){var _0x3f5569=function(_0x50551a){while(--_0x50551a){_0xa6d0c4['push'](_0xa6d0c4['shift']());}};_0x3f5569(++_0x36f539);}(_0x20dc,0xb8));var _0xc20d=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0x20dc[_0x9d1e6b];return _0x2b3070;};'use strict';var Sequelize=require(_0xc20d('0x0'));module['exports']={'name':{'type':Sequelize[_0xc20d('0x1')],'unique':_0xc20d('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc20d('0x1')]},'timeout':{'type':Sequelize[_0xc20d('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc20d('0x4')](_0xc20d('0x5'),_0xc20d('0x6'),_0xc20d('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc20d('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 13f9794..8b5676d 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 _0x553a=['online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','union','value','removeTeams','isEmpty','addAgents','omit','spread','removeAgents','isArray','userFaxQueue:remove','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/environment','defaults','socket.io-emitter','redis','./faxQueue.socket','sendStatus','status','json','offset','limit','undefined','count','set','update','then','destroy','get','FaxQueues','stack','name','send','index','map','FaxQueue','rawAttributes','key','getOptions','where','include','query','findAll','rows','show','keys','filters','model','fields','attributes','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserFaxQueue','intersection','length','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','filter','User','findAndCountAll','UserId','faxPause','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents'];(function(_0x15bbf1,_0x40ef96){var _0x5c4b47=function(_0x303b4f){while(--_0x303b4f){_0x15bbf1['push'](_0x15bbf1['shift']());}};_0x5c4b47(++_0x40ef96);}(_0x553a,0x192));var _0xa553=function(_0x29d87d,_0x23dc31){_0x29d87d=_0x29d87d-0x0;var _0x1fd84b=_0x553a[_0x29d87d];return _0x1fd84b;};'use strict';var BPromise=require('bluebird');var util=require(_0xa553('0x0'));var _=require('lodash');var squel=require(_0xa553('0x1'));var Redis=require(_0xa553('0x2'));var qs=require(_0xa553('0x3'));var logger=require('../../config/logger')('api');var config=require(_0xa553('0x4'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa553('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa553('0x6'))(new Redis(config[_0xa553('0x7')]));require(_0xa553('0x8'))['register'](socket);function respondWithStatusCode(_0x25bbb7,_0x5f09d8){_0x5f09d8=_0x5f09d8||0xcc;return function(_0x318691){if(_0x318691){return _0x25bbb7[_0xa553('0x9')](_0x5f09d8);}return _0x25bbb7[_0xa553('0xa')](_0x5f09d8)['end']();};}function respondWithResult(_0x5ad48b,_0xc275e6){_0xc275e6=_0xc275e6||0xc8;return function(_0x58c170){if(_0x58c170){return _0x5ad48b[_0xa553('0xa')](_0xc275e6)[_0xa553('0xb')](_0x58c170);}};}function respondWithFilteredResult(_0x137813,_0x47d33d){return function(_0xad89be){if(_0xad89be){var _0x14b606=typeof _0x47d33d[_0xa553('0xc')]==='undefined'&&typeof _0x47d33d[_0xa553('0xd')]===_0xa553('0xe');var _0x39f000=_0xad89be['count'];var _0x5906ab=_0x14b606?0x0:_0x47d33d[_0xa553('0xc')];var _0x26dcc5=_0x14b606?_0xad89be[_0xa553('0xf')]:_0x47d33d[_0xa553('0xc')]+_0x47d33d['limit'];var _0x35cf13;if(_0x26dcc5>=_0x39f000){_0x26dcc5=_0x39f000;_0x35cf13=0xc8;}else{_0x35cf13=0xce;}_0x137813['status'](_0x35cf13);return _0x137813[_0xa553('0x10')]('Content-Range',_0x5906ab+'-'+_0x26dcc5+'/'+_0x39f000)['json'](_0xad89be);}return null;};}function saveUpdates(_0x1d0f4e){return function(_0x48681b){if(_0x48681b){return _0x48681b[_0xa553('0x11')](_0x1d0f4e)[_0xa553('0x12')](function(_0x30d91e){return _0x30d91e;});}return null;};}function removeEntity(_0x54a9f9){return function(_0x102ef5){if(_0x102ef5){return _0x102ef5[_0xa553('0x13')]()['then'](function(){var _0x3e95d3=_0x102ef5[_0xa553('0x14')]({'plain':!![]});var _0x48f071=_0xa553('0x15');return db['UserProfileResource'][_0xa553('0x13')]({'where':{'type':_0x48f071,'resourceId':_0x3e95d3['id']}})[_0xa553('0x12')](function(){return _0x102ef5;});})[_0xa553('0x12')](function(){_0x54a9f9[_0xa553('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cbbe8){return function(_0x250ead){if(!_0x250ead){_0x3cbbe8[_0xa553('0x9')](0x194);}return _0x250ead;};}function handleError(_0x4dc781,_0x17b058){_0x17b058=_0x17b058||0x1f4;return function(_0x4b467d){logger['error'](_0x4b467d[_0xa553('0x16')]);if(_0x4b467d[_0xa553('0x17')]){delete _0x4b467d['name'];}_0x4dc781[_0xa553('0xa')](_0x17b058)[_0xa553('0x18')](_0x4b467d);};}exports[_0xa553('0x19')]=function(_0x5c6066,_0x1d001a){var _0x28fa86={};var _0x22744c={'count':0x0,'rows':[]};var _0x7b0d73=_[_0xa553('0x1a')](db[_0xa553('0x1b')][_0xa553('0x1c')],function(_0x10c08b){return{'name':_0x10c08b['fieldName'],'type':_0x10c08b['type'][_0xa553('0x1d')]};});_0x28fa86=qs[_0xa553('0x1e')](_0x7b0d73,_0x5c6066);var _0x11b61e={'where':_0x28fa86[_0xa553('0x1f')]};return db[_0xa553('0x1b')][_0xa553('0xf')](_0x11b61e)[_0xa553('0x12')](function(_0x4ca838){_0x22744c[_0xa553('0xf')]=_0x4ca838;_0x28fa86[_0xa553('0x20')]=qs[_0xa553('0x20')](_0x5c6066[_0xa553('0x21')]);return db[_0xa553('0x1b')][_0xa553('0x22')](_0x28fa86);})[_0xa553('0x12')](function(_0x2325a5){_0x22744c[_0xa553('0x23')]=_0x2325a5;return _0x22744c;})[_0xa553('0x12')](respondWithFilteredResult(_0x1d001a,_0x28fa86))['catch'](handleError(_0x1d001a,null));};exports[_0xa553('0x24')]=function(_0x5baa42,_0x5cdacc){var _0x4cc4c4={'raw':!![],'where':{'id':_0x5baa42['params']['id']}},_0x4f7b9a={};_0x4f7b9a['model']=_[_0xa553('0x25')](db[_0xa553('0x1b')][_0xa553('0x1c')]);_0x4f7b9a[_0xa553('0x21')]=_[_0xa553('0x25')](_0x5baa42['query']);_0x4f7b9a[_0xa553('0x26')]=_['intersection'](_0x4f7b9a[_0xa553('0x27')],_0x4f7b9a[_0xa553('0x21')]);_0x4cc4c4['attributes']=_['intersection'](_0x4f7b9a[_0xa553('0x27')],qs[_0xa553('0x28')](_0x5baa42[_0xa553('0x21')][_0xa553('0x28')]));_0x4cc4c4[_0xa553('0x29')]=_0x4cc4c4[_0xa553('0x29')]['length']?_0x4cc4c4['attributes']:_0x4f7b9a[_0xa553('0x27')];if(_0x5baa42['query']['includeAll']){_0x4cc4c4[_0xa553('0x20')]=[{'all':!![]}];}_0x4cc4c4=_[_0xa553('0x2a')]({},_0x4cc4c4,_0x5baa42[_0xa553('0x2b')]);return db[_0xa553('0x1b')][_0xa553('0x2c')](_0x4cc4c4)[_0xa553('0x12')](handleEntityNotFound(_0x5cdacc,null))[_0xa553('0x12')](respondWithResult(_0x5cdacc,null))[_0xa553('0x2d')](handleError(_0x5cdacc,null));};exports[_0xa553('0x2e')]=function(_0x298260,_0x205520){return db[_0xa553('0x1b')][_0xa553('0x2e')](_0x298260[_0xa553('0x2f')],{})[_0xa553('0x12')](function(_0x2f3d7d){var _0x6a06ce=_0x298260[_0xa553('0x30')][_0xa553('0x14')]({'plain':!![]});if(!_0x6a06ce)throw new Error(_0xa553('0x31'));if(_0x6a06ce[_0xa553('0x32')]===_0xa553('0x30')){var _0x558a33=_0x2f3d7d[_0xa553('0x14')]({'plain':!![]});var _0x9259cf=_0xa553('0x15');return db[_0xa553('0x33')][_0xa553('0x2c')]({'where':{'name':_0x9259cf,'userProfileId':_0x6a06ce[_0xa553('0x34')]},'raw':!![]})['then'](function(_0x429653){if(_0x429653&&_0x429653['autoAssociation']===0x0){return db[_0xa553('0x35')][_0xa553('0x2e')]({'name':_0x558a33[_0xa553('0x17')],'resourceId':_0x558a33['id'],'type':_0x429653[_0xa553('0x17')],'sectionId':_0x429653['id']},{})[_0xa553('0x12')](function(){return _0x2f3d7d;});}else{return _0x2f3d7d;}})[_0xa553('0x2d')](function(_0x1d5802){logger[_0xa553('0x36')](_0xa553('0x37'),_0x1d5802);throw _0x1d5802;});}return _0x2f3d7d;})[_0xa553('0x12')](respondWithResult(_0x205520,0xc9))[_0xa553('0x2d')](handleError(_0x205520,null));};exports['update']=function(_0x49cb6b,_0x30c332){if(_0x49cb6b['body']['id']){delete _0x49cb6b[_0xa553('0x2f')]['id'];}return db[_0xa553('0x1b')]['find']({'where':{'id':_0x49cb6b[_0xa553('0x38')]['id']}})[_0xa553('0x12')](handleEntityNotFound(_0x30c332,null))['then'](saveUpdates(_0x49cb6b[_0xa553('0x2f')],null))[_0xa553('0x12')](respondWithResult(_0x30c332,null))['catch'](handleError(_0x30c332,null));};exports[_0xa553('0x13')]=function(_0x1d644b,_0x5e3ca9){return db[_0xa553('0x1b')][_0xa553('0x2c')]({'where':{'id':_0x1d644b[_0xa553('0x38')]['id']}})[_0xa553('0x12')](handleEntityNotFound(_0x5e3ca9,null))['then'](removeEntity(_0x5e3ca9,null))[_0xa553('0x2d')](handleError(_0x5e3ca9,null));};exports[_0xa553('0x39')]=function(_0x407e17,_0x524f33){return db[_0xa553('0x1b')][_0xa553('0x39')]()[_0xa553('0x12')](respondWithResult(_0x524f33,null))[_0xa553('0x2d')](handleError(_0x524f33,null));};exports[_0xa553('0x3a')]=function(_0xcaef85,_0x4bcd95){var _0x4abcd9={'raw':!![],'where':{}},_0x299883={},_0x1f81bf;return db[_0xa553('0x1b')][_0xa553('0x3b')]({'where':{'id':_0xcaef85[_0xa553('0x38')]['id']}})[_0xa553('0x12')](handleEntityNotFound(_0x4bcd95,null))[_0xa553('0x12')](function(_0x41cad1){if(_0x41cad1){_0x1f81bf=_0x41cad1['get']({'plain':!![]});_0x299883[_0xa553('0x27')]=_[_0xa553('0x25')](db[_0xa553('0x3c')][_0xa553('0x1c')]);_0x299883[_0xa553('0x21')]=_[_0xa553('0x25')](_0xcaef85[_0xa553('0x21')]);_0x299883[_0xa553('0x26')]=_[_0xa553('0x3d')](_0x299883['model'],_0x299883[_0xa553('0x21')]);_0x4abcd9[_0xa553('0x29')]=_['intersection'](_0x299883[_0xa553('0x27')],qs[_0xa553('0x28')](_0xcaef85[_0xa553('0x21')]['fields']));_0x4abcd9[_0xa553('0x29')]=_0x4abcd9[_0xa553('0x29')][_0xa553('0x3e')]?_0x4abcd9['attributes']:_0x299883[_0xa553('0x27')];if(!_0xcaef85[_0xa553('0x21')][_0xa553('0x3f')](_0xa553('0x40'))){_0x4abcd9[_0xa553('0xd')]=qs[_0xa553('0xd')](_0xcaef85['query'][_0xa553('0xd')]);_0x4abcd9['offset']=qs['offset'](_0xcaef85[_0xa553('0x21')]['offset']);}_0x4abcd9[_0xa553('0x41')]=qs[_0xa553('0x42')](_0xcaef85[_0xa553('0x21')][_0xa553('0x42')]);_0x4abcd9[_0xa553('0x1f')]=qs[_0xa553('0x26')](_[_0xa553('0x43')](_0xcaef85[_0xa553('0x21')],_0x299883['filters']));_0x4abcd9[_0xa553('0x1f')][_0xa553('0x44')]=_0x41cad1['id'];if(_0xcaef85[_0xa553('0x21')][_0xa553('0x45')]){_0x4abcd9[_0xa553('0x1f')]=_[_0xa553('0x2a')](_0x4abcd9[_0xa553('0x1f')],{'$or':_[_0xa553('0x1a')](_0x4abcd9[_0xa553('0x29')],function(_0x483b79){var _0x51615f={};_0x51615f[_0x483b79]={'$like':'%'+_0xcaef85[_0xa553('0x21')][_0xa553('0x45')]+'%'};return _0x51615f;})});}_0x4abcd9=_[_0xa553('0x2a')]({},_0x4abcd9,_0xcaef85['options']);return db[_0xa553('0x3c')]['findAll'](_0x4abcd9);}})['then'](function(_0x3732f6){if(_0x3732f6){return db[_0xa553('0x46')][_0xa553('0x47')]({'where':{'id':_['map'](_0x3732f6,_0xa553('0x48')),'role':'agent'},'attributes':['id','name',_0xa553('0x49'),'updatedAt',_0xa553('0x4a')]});}})[_0xa553('0x12')](function(_0x44a4ec){if(_0x44a4ec){return{'count':_0x44a4ec['count'],'rows':_[_0xa553('0x1a')](_0x44a4ec['rows'],function(_0x1ca868){return{'membername':_0x1ca868[_0xa553('0x17')],'UserId':_0x1ca868['id'],'queue_name':_0x1f81bf[_0xa553('0x17')],'FaxQueueId':_0x1f81bf['id'],'interface':util[_0xa553('0x4b')]('%s/%s',_0xa553('0x4c'),_0x1ca868['name']),'penalty':0x0,'paused':_0x1ca868[_0xa553('0x49')],'createdAt':_0x1ca868[_0xa553('0x4a')],'updatedAt':_0x1ca868['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa553('0x12')](respondWithFilteredResult(_0x4bcd95,_0x4abcd9))[_0xa553('0x2d')](handleError(_0x4bcd95,null));};exports[_0xa553('0x4d')]=function(_0x4d3b8c,_0x244124){var _0x533920={};var _0x4f8a3d={};var _0x3778b3;var _0x4519f1;return db['FaxQueue'][_0xa553('0x3b')]({'where':{'id':_0x4d3b8c[_0xa553('0x38')]['id']}})[_0xa553('0x12')](handleEntityNotFound(_0x244124,null))[_0xa553('0x12')](function(_0x37b58a){if(_0x37b58a){_0x3778b3=_0x37b58a;_0x4f8a3d[_0xa553('0x27')]=_[_0xa553('0x25')](db[_0xa553('0x4e')]['rawAttributes']);_0x4f8a3d[_0xa553('0x21')]=_[_0xa553('0x25')](_0x4d3b8c[_0xa553('0x21')]);_0x4f8a3d['filters']=_[_0xa553('0x3d')](_0x4f8a3d[_0xa553('0x27')],_0x4f8a3d['query']);_0x533920['attributes']=_[_0xa553('0x3d')](_0x4f8a3d[_0xa553('0x27')],qs[_0xa553('0x28')](_0x4d3b8c[_0xa553('0x21')][_0xa553('0x28')]));_0x533920[_0xa553('0x29')]=_0x533920[_0xa553('0x29')][_0xa553('0x3e')]?_0x533920[_0xa553('0x29')]:_0x4f8a3d[_0xa553('0x27')];_0x533920[_0xa553('0x41')]=qs['sort'](_0x4d3b8c['query']['sort']);_0x533920[_0xa553('0x1f')]=qs[_0xa553('0x26')](_[_0xa553('0x43')](_0x4d3b8c[_0xa553('0x21')],_0x4f8a3d[_0xa553('0x26')]));if(_0x4d3b8c[_0xa553('0x21')][_0xa553('0x45')]){_0x533920[_0xa553('0x1f')]=_[_0xa553('0x2a')](_0x533920[_0xa553('0x1f')],{'$or':_['map'](_0x533920[_0xa553('0x29')],function(_0xe5c093){var _0x4aef64={};_0x4aef64[_0xe5c093]={'$like':'%'+_0x4d3b8c[_0xa553('0x21')][_0xa553('0x45')]+'%'};return _0x4aef64;})});}_0x533920=_[_0xa553('0x2a')]({},_0x533920,_0x4d3b8c[_0xa553('0x2b')]);return _0x3778b3[_0xa553('0x4d')](_0x533920);}})[_0xa553('0x12')](function(_0x3359a9){if(_0x3359a9){_0x4519f1=_0x3359a9[_0xa553('0x3e')];if(!_0x4d3b8c[_0xa553('0x21')][_0xa553('0x3f')]('nolimit')){_0x533920['limit']=qs[_0xa553('0xd')](_0x4d3b8c[_0xa553('0x21')][_0xa553('0xd')]);_0x533920['offset']=qs[_0xa553('0xc')](_0x4d3b8c['query'][_0xa553('0xc')]);}return _0x3778b3[_0xa553('0x4d')](_0x533920);}})[_0xa553('0x12')](function(_0x4b1c6a){if(_0x4b1c6a){return _0x4b1c6a?{'count':_0x4519f1,'rows':_0x4b1c6a}:null;}})['then'](respondWithResult(_0x244124,null))[_0xa553('0x2d')](handleError(_0x244124,null));};exports[_0xa553('0x4f')]=function(_0x40026b,_0x3b0e85){var _0x25cd8b=_0x40026b[_0xa553('0x2f')][_0xa553('0x50')];return db['Team'][_0xa553('0x22')]({'where':{'id':_0x25cd8b},'attributes':['id'],'include':[{'model':db[_0xa553('0x46')],'as':_0xa553('0x51'),'attributes':['id',_0xa553('0x17'),_0xa553('0x52'),_0xa553('0x53'),_0xa553('0x54')],'raw':!![]}]})[_0xa553('0x12')](function(_0xdda3fa){if(_0xdda3fa){var _0x35d32d=_[_0xa553('0x55')](_0xdda3fa,function(_0x514b1b){var _0x14e013=_0x514b1b[_0xa553('0x14')]({'plain':!![]});return _0x14e013['Agents'];});return db[_0xa553('0x1b')][_0xa553('0x2c')]({'where':{'id':_0x40026b['params']['id']}})['then'](function(_0x158512){return db[_0xa553('0x56')][_0xa553('0x57')](function(_0x5627fa){return _0x158512[_0xa553('0x4f')](_0x25cd8b,{'transaction':_0x5627fa})[_0xa553('0x12')](function(){return BPromise[_0xa553('0x58')](_0x35d32d,function(_0x2fcc86){return db[_0xa553('0x3c')][_0xa553('0x59')]({'where':{'UserId':_0x2fcc86['id'],'FaxQueueId':_0x40026b['params']['id']},'transaction':_0x5627fa});});})[_0xa553('0x12')](function(){_0x35d32d[_0xa553('0x5a')](function(_0x53d868){socket[_0xa553('0x5b')](_0xa553('0x5c'),{'UserId':_0x53d868['id'],'FaxQueueId':_0x158512['id']});});});});});}})[_0xa553('0x12')](respondWithStatusCode(_0x3b0e85,null))[_0xa553('0x2d')](handleError(_0x3b0e85,null));};exports['removeTeams']=function(_0x96b856,_0x4c2265){return db[_0xa553('0x4e')][_0xa553('0x22')]({'where':{'id':_0x96b856[_0xa553('0x21')][_0xa553('0x50')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa553('0x51'),'attributes':['id'],'raw':!![]}]})[_0xa553('0x12')](handleEntityNotFound(_0x4c2265,null))[_0xa553('0x12')](function(_0x39a4fb){var _0x41405c=_[_0xa553('0x1a')](_0x39a4fb,'id');var _0x59ee9f=[];var _0x183d62=[];var _0x10645c=squel[_0xa553('0x5d')]();_0x10645c[_0xa553('0x5e')](_0xa553('0x5f'))[_0xa553('0x60')](_0xa553('0x61'),'tq')[_0xa553('0x62')](_0xa553('0x63'),'ut',_0xa553('0x64'))[_0xa553('0x1f')](_0xa553('0x65'),_0x96b856[_0xa553('0x38')]['id']);for(var _0x17a920=0x0;_0x17a920<_0x39a4fb[_0xa553('0x3e')];_0x17a920+=0x1){let _0x3f2732=_0x39a4fb[_0x17a920];for(var _0x3f1c00=0x0;_0x3f1c00<_0x3f2732['Agents'][_0xa553('0x3e')];_0x3f1c00+=0x1){let _0x55c543=_0x3f2732[_0xa553('0x51')][_0x3f1c00];var _0xf3eb9e=_0x10645c[_0xa553('0x66')]();_0xf3eb9e[_0xa553('0x1f')](_0xa553('0x67'),_0x55c543['id']);_0x183d62[_0xa553('0x68')](db[_0xa553('0x56')][_0xa553('0x21')](_0xf3eb9e[_0xa553('0x69')](),{'type':db[_0xa553('0x56')][_0xa553('0x6a')]['SELECT']})['then'](function(_0x5b2159){if(_0x5b2159['length']===0x1){return _0x55c543['id'];}else{var _0x502030=_['every'](_[_0xa553('0x1a')](_0x5b2159,_0xa553('0x6b')),function(_0x25ef2f){return _[_0xa553('0x6c')](_0x41405c,_0x25ef2f);});if(_0x502030){return _0x55c543['id'];}}}));}}return BPromise[_0xa553('0x6d')](_0x183d62)[_0xa553('0x12')](function(_0x3f2462){_0x59ee9f=_(_0x59ee9f)[_0xa553('0x6e')](_0x3f2462)['compact']()[_0xa553('0x6f')]();return db[_0xa553('0x1b')][_0xa553('0x2c')]({'where':{'id':_0x96b856['params']['id']}})[_0xa553('0x12')](function(_0x5265c0){return db[_0xa553('0x56')][_0xa553('0x57')](function(_0x21ae41){return _0x5265c0[_0xa553('0x70')](_0x96b856['query'][_0xa553('0x50')],{'transaction':_0x21ae41})[_0xa553('0x12')](function(){if(!_[_0xa553('0x71')](_0x59ee9f)){return _0x5265c0['removeAgents'](_0x59ee9f,{'transaction':_0x21ae41});}})[_0xa553('0x12')](function(){_0x59ee9f[_0xa553('0x5a')](function(_0x34332f){socket['emit']('userFaxQueue:remove',{'UserId':_0x34332f,'FaxQueueId':_0x5265c0['id']});});});});});});})[_0xa553('0x12')](respondWithStatusCode(_0x4c2265,null))['catch'](handleError(_0x4c2265,null));};exports['addAgents']=function(_0x5073ec,_0x395072){return db['FaxQueue']['find']({'where':{'id':_0x5073ec['params']['id']}})[_0xa553('0x12')](handleEntityNotFound(_0x395072,null))[_0xa553('0x12')](function(_0x3ea23e){if(_0x3ea23e){return _0x3ea23e[_0xa553('0x72')](_0x5073ec[_0xa553('0x2f')]['ids'],_[_0xa553('0x73')](_0x5073ec[_0xa553('0x2f')],['ids','id'])||{})[_0xa553('0x74')](function(_0x2a0439){for(var _0x1c49e8=0x0;_0x1c49e8<_0x5073ec[_0xa553('0x2f')][_0xa553('0x50')][_0xa553('0x3e')];_0x1c49e8+=0x1){socket['emit'](_0xa553('0x5c'),{'UserId':Number(_0x5073ec[_0xa553('0x2f')][_0xa553('0x50')][_0x1c49e8]),'FaxQueueId':Number(_0x5073ec[_0xa553('0x38')]['id'])});}return _0x2a0439;});}})[_0xa553('0x12')](respondWithResult(_0x395072,null))['catch'](handleError(_0x395072,null));};exports[_0xa553('0x75')]=function(_0x18541c,_0x526675){return db[_0xa553('0x1b')]['find']({'where':{'id':_0x18541c[_0xa553('0x38')]['id']}})[_0xa553('0x12')](handleEntityNotFound(_0x526675,null))[_0xa553('0x12')](function(_0x1c74ce){if(_0x1c74ce){return _0x1c74ce['removeAgents'](_0x18541c[_0xa553('0x21')][_0xa553('0x50')])[_0xa553('0x12')](function(){if(_[_0xa553('0x76')](_0x18541c['query']['ids'])){for(var _0x348df2=0x0;_0x348df2<_0x18541c[_0xa553('0x21')][_0xa553('0x50')][_0xa553('0x3e')];_0x348df2+=0x1){socket[_0xa553('0x5b')](_0xa553('0x77'),{'UserId':Number(_0x18541c[_0xa553('0x21')]['ids'][_0x348df2]),'FaxQueueId':Number(_0x18541c[_0xa553('0x38')]['id'])});}}else{socket[_0xa553('0x5b')](_0xa553('0x77'),{'UserId':Number(_0x18541c[_0xa553('0x21')][_0xa553('0x50')]),'FaxQueueId':Number(_0x18541c[_0xa553('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x526675,null))[_0xa553('0x2d')](handleError(_0x526675,null));};exports[_0xa553('0x78')]=function(_0x3a0abc,_0x17d9e0){var _0x58a150={};var _0x37c49b={};var _0x4e667a;var _0x977463;return db[_0xa553('0x1b')][_0xa553('0x3b')]({'where':{'id':_0x3a0abc[_0xa553('0x38')]['id']}})[_0xa553('0x12')](handleEntityNotFound(_0x17d9e0,null))[_0xa553('0x12')](function(_0x42dd43){if(_0x42dd43){_0x4e667a=_0x42dd43;_0x37c49b[_0xa553('0x27')]=_[_0xa553('0x25')](db[_0xa553('0x46')]['rawAttributes']);_0x37c49b[_0xa553('0x21')]=_[_0xa553('0x25')](_0x3a0abc['query']);_0x37c49b[_0xa553('0x26')]=_['intersection'](_0x37c49b[_0xa553('0x27')],_0x37c49b['query']);_0x58a150[_0xa553('0x29')]=_[_0xa553('0x3d')](_0x37c49b[_0xa553('0x27')],qs['fields'](_0x3a0abc[_0xa553('0x21')][_0xa553('0x28')]));_0x58a150[_0xa553('0x29')]=_0x58a150['attributes']['length']?_0x58a150[_0xa553('0x29')]:_0x37c49b[_0xa553('0x27')];_0x58a150['order']=qs[_0xa553('0x42')](_0x3a0abc['query'][_0xa553('0x42')]);_0x58a150['where']=qs['filters'](_[_0xa553('0x43')](_0x3a0abc[_0xa553('0x21')],_0x37c49b[_0xa553('0x26')]));if(_0x3a0abc[_0xa553('0x21')]['filter']){_0x58a150[_0xa553('0x1f')]=_['merge'](_0x58a150[_0xa553('0x1f')],{'$or':_[_0xa553('0x1a')](_0x58a150[_0xa553('0x29')],function(_0x557c62){var _0x12eb48={};_0x12eb48[_0x557c62]={'$like':'%'+_0x3a0abc[_0xa553('0x21')]['filter']+'%'};return _0x12eb48;})});}_0x58a150=_[_0xa553('0x2a')]({},_0x58a150,_0x3a0abc[_0xa553('0x2b')]);return _0x4e667a['getAgents'](_0x58a150);}})[_0xa553('0x12')](function(_0x3bd5a7){if(_0x3bd5a7){_0x977463=_0x3bd5a7['length'];if(!_0x3a0abc[_0xa553('0x21')][_0xa553('0x3f')](_0xa553('0x40'))){_0x58a150[_0xa553('0xd')]=qs[_0xa553('0xd')](_0x3a0abc[_0xa553('0x21')][_0xa553('0xd')]);_0x58a150[_0xa553('0xc')]=qs[_0xa553('0xc')](_0x3a0abc[_0xa553('0x21')]['offset']);}return _0x4e667a[_0xa553('0x78')](_0x58a150);}})[_0xa553('0x12')](function(_0x1dcac9){if(_0x1dcac9){return _0x1dcac9?{'count':_0x977463,'rows':_0x1dcac9}:null;}})[_0xa553('0x12')](respondWithResult(_0x17d9e0,null))[_0xa553('0x2d')](handleError(_0x17d9e0,null));}; \ No newline at end of file +var _0x38b8=['value','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','bluebird','lodash','squel','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','./faxQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','rawAttributes','type','key','query','FaxQueue','findAll','rows','catch','show','params','keys','filters','intersection','model','fields','attributes','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','order','sort','where','FaxQueueId','filter','merge','UserFaxQueue','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','pick','nolimit','ids','Team','voicePause','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','compact'];(function(_0x3d0d48,_0x12cb00){var _0x384d2a=function(_0x37d175){while(--_0x37d175){_0x3d0d48['push'](_0x3d0d48['shift']());}};_0x384d2a(++_0x12cb00);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x838b('0x0'));var util=require('util');var _=require(_0x838b('0x1'));var squel=require(_0x838b('0x2'));var Redis=require('ioredis');var qs=require(_0x838b('0x3'));var logger=require('../../config/logger')('api');var config=require(_0x838b('0x4'));var db=require(_0x838b('0x5'))['db'];config['redis']=_['defaults'](config[_0x838b('0x6')],{'host':_0x838b('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x838b('0x6')]));require(_0x838b('0x8'))['register'](socket);function respondWithStatusCode(_0x552245,_0x1a6bc0){_0x1a6bc0=_0x1a6bc0||0xcc;return function(_0x1a4797){if(_0x1a4797){return _0x552245[_0x838b('0x9')](_0x1a6bc0);}return _0x552245['status'](_0x1a6bc0)[_0x838b('0xa')]();};}function respondWithResult(_0x51cf71,_0x3884e3){_0x3884e3=_0x3884e3||0xc8;return function(_0x24ce13){if(_0x24ce13){return _0x51cf71[_0x838b('0xb')](_0x3884e3)[_0x838b('0xc')](_0x24ce13);}};}function respondWithFilteredResult(_0x241e6a,_0x263a96){return function(_0x4d2c3b){if(_0x4d2c3b){var _0x3a57cf=typeof _0x263a96[_0x838b('0xd')]===_0x838b('0xe')&&typeof _0x263a96[_0x838b('0xf')]===_0x838b('0xe');var _0x21cc45=_0x4d2c3b[_0x838b('0x10')];var _0x3324de=_0x3a57cf?0x0:_0x263a96[_0x838b('0xd')];var _0x525c60=_0x3a57cf?_0x4d2c3b[_0x838b('0x10')]:_0x263a96['offset']+_0x263a96['limit'];var _0x584b04;if(_0x525c60>=_0x21cc45){_0x525c60=_0x21cc45;_0x584b04=0xc8;}else{_0x584b04=0xce;}_0x241e6a[_0x838b('0xb')](_0x584b04);return _0x241e6a[_0x838b('0x11')](_0x838b('0x12'),_0x3324de+'-'+_0x525c60+'/'+_0x21cc45)[_0x838b('0xc')](_0x4d2c3b);}return null;};}function saveUpdates(_0x94e893){return function(_0x4a729e){if(_0x4a729e){return _0x4a729e[_0x838b('0x13')](_0x94e893)[_0x838b('0x14')](function(_0x44a62c){return _0x44a62c;});}return null;};}function removeEntity(_0x1e4f5f){return function(_0x48c4ab){if(_0x48c4ab){return _0x48c4ab[_0x838b('0x15')]()[_0x838b('0x14')](function(){var _0x49f209=_0x48c4ab[_0x838b('0x16')]({'plain':!![]});var _0x46eedc='FaxQueues';return db[_0x838b('0x17')][_0x838b('0x15')]({'where':{'type':_0x46eedc,'resourceId':_0x49f209['id']}})[_0x838b('0x14')](function(){return _0x48c4ab;});})['then'](function(){_0x1e4f5f[_0x838b('0xb')](0xcc)[_0x838b('0xa')]();});}};}function handleEntityNotFound(_0x119e4e){return function(_0x1a5241){if(!_0x1a5241){_0x119e4e[_0x838b('0x9')](0x194);}return _0x1a5241;};}function handleError(_0x3f8848,_0x11de0e){_0x11de0e=_0x11de0e||0x1f4;return function(_0x3da3f1){logger[_0x838b('0x18')](_0x3da3f1[_0x838b('0x19')]);if(_0x3da3f1[_0x838b('0x1a')]){delete _0x3da3f1[_0x838b('0x1a')];}_0x3f8848[_0x838b('0xb')](_0x11de0e)[_0x838b('0x1b')](_0x3da3f1);};}exports['index']=function(_0xb9b05f,_0x59be76){var _0x51adc6={};var _0x430400={'count':0x0,'rows':[]};var _0x2bc24c=_[_0x838b('0x1c')](db['FaxQueue'][_0x838b('0x1d')],function(_0x27f385){return{'name':_0x27f385['fieldName'],'type':_0x27f385[_0x838b('0x1e')][_0x838b('0x1f')]};});_0x51adc6=qs['getOptions'](_0x2bc24c,_0xb9b05f);var _0x576bfa={'where':_0x51adc6['where']};return db['FaxQueue']['count'](_0x576bfa)['then'](function(_0x1e74a6){_0x430400[_0x838b('0x10')]=_0x1e74a6;_0x51adc6['include']=qs['include'](_0xb9b05f[_0x838b('0x20')]);return db[_0x838b('0x21')][_0x838b('0x22')](_0x51adc6);})[_0x838b('0x14')](function(_0x16c081){_0x430400[_0x838b('0x23')]=_0x16c081;return _0x430400;})[_0x838b('0x14')](respondWithFilteredResult(_0x59be76,_0x51adc6))[_0x838b('0x24')](handleError(_0x59be76,null));};exports[_0x838b('0x25')]=function(_0x549a0e,_0xe392b1){var _0x756dcc={'raw':!![],'where':{'id':_0x549a0e[_0x838b('0x26')]['id']}},_0xd4f382={};_0xd4f382['model']=_[_0x838b('0x27')](db[_0x838b('0x21')][_0x838b('0x1d')]);_0xd4f382[_0x838b('0x20')]=_[_0x838b('0x27')](_0x549a0e['query']);_0xd4f382[_0x838b('0x28')]=_[_0x838b('0x29')](_0xd4f382[_0x838b('0x2a')],_0xd4f382[_0x838b('0x20')]);_0x756dcc['attributes']=_[_0x838b('0x29')](_0xd4f382[_0x838b('0x2a')],qs['fields'](_0x549a0e[_0x838b('0x20')][_0x838b('0x2b')]));_0x756dcc[_0x838b('0x2c')]=_0x756dcc[_0x838b('0x2c')][_0x838b('0x2d')]?_0x756dcc['attributes']:_0xd4f382[_0x838b('0x2a')];if(_0x549a0e[_0x838b('0x20')]['includeAll']){_0x756dcc[_0x838b('0x2e')]=[{'all':!![]}];}_0x756dcc=_['merge']({},_0x756dcc,_0x549a0e[_0x838b('0x2f')]);return db['FaxQueue'][_0x838b('0x30')](_0x756dcc)['then'](handleEntityNotFound(_0xe392b1,null))[_0x838b('0x14')](respondWithResult(_0xe392b1,null))[_0x838b('0x24')](handleError(_0xe392b1,null));};exports[_0x838b('0x31')]=function(_0x47460d,_0x476db0){return db[_0x838b('0x21')][_0x838b('0x31')](_0x47460d[_0x838b('0x32')],{})[_0x838b('0x14')](function(_0x1fec60){var _0x4ee9c2=_0x47460d[_0x838b('0x33')]['get']({'plain':!![]});if(!_0x4ee9c2)throw new Error(_0x838b('0x34'));if(_0x4ee9c2[_0x838b('0x35')]===_0x838b('0x33')){var _0x11a7c5=_0x1fec60[_0x838b('0x16')]({'plain':!![]});var _0x3934b7=_0x838b('0x36');return db[_0x838b('0x37')]['find']({'where':{'name':_0x3934b7,'userProfileId':_0x4ee9c2[_0x838b('0x38')]},'raw':!![]})[_0x838b('0x14')](function(_0x18db4f){if(_0x18db4f&&_0x18db4f[_0x838b('0x39')]===0x0){return db[_0x838b('0x17')][_0x838b('0x31')]({'name':_0x11a7c5['name'],'resourceId':_0x11a7c5['id'],'type':_0x18db4f[_0x838b('0x1a')],'sectionId':_0x18db4f['id']},{})['then'](function(){return _0x1fec60;});}else{return _0x1fec60;}})[_0x838b('0x24')](function(_0x3e67de){logger['error'](_0x838b('0x3a'),_0x3e67de);throw _0x3e67de;});}return _0x1fec60;})[_0x838b('0x14')](respondWithResult(_0x476db0,0xc9))[_0x838b('0x24')](handleError(_0x476db0,null));};exports[_0x838b('0x13')]=function(_0x4a66fb,_0x51689a){if(_0x4a66fb[_0x838b('0x32')]['id']){delete _0x4a66fb[_0x838b('0x32')]['id'];}return db['FaxQueue'][_0x838b('0x30')]({'where':{'id':_0x4a66fb['params']['id']}})[_0x838b('0x14')](handleEntityNotFound(_0x51689a,null))[_0x838b('0x14')](saveUpdates(_0x4a66fb[_0x838b('0x32')],null))[_0x838b('0x14')](respondWithResult(_0x51689a,null))[_0x838b('0x24')](handleError(_0x51689a,null));};exports['destroy']=function(_0x12e816,_0x5f42a7){return db[_0x838b('0x21')]['find']({'where':{'id':_0x12e816[_0x838b('0x26')]['id']}})[_0x838b('0x14')](handleEntityNotFound(_0x5f42a7,null))['then'](removeEntity(_0x5f42a7,null))[_0x838b('0x24')](handleError(_0x5f42a7,null));};exports[_0x838b('0x3b')]=function(_0x5c1fd2,_0x2e665c){return db['FaxQueue'][_0x838b('0x3b')]()[_0x838b('0x14')](respondWithResult(_0x2e665c,null))['catch'](handleError(_0x2e665c,null));};exports[_0x838b('0x3c')]=function(_0x5739ff,_0x4d7336){var _0x55f812={'raw':!![],'where':{}},_0x583bda={},_0x2aa6b7;return db[_0x838b('0x21')][_0x838b('0x3d')]({'where':{'id':_0x5739ff[_0x838b('0x26')]['id']}})[_0x838b('0x14')](handleEntityNotFound(_0x4d7336,null))[_0x838b('0x14')](function(_0x5ebde7){if(_0x5ebde7){_0x2aa6b7=_0x5ebde7[_0x838b('0x16')]({'plain':!![]});_0x583bda['model']=_[_0x838b('0x27')](db['UserFaxQueue'][_0x838b('0x1d')]);_0x583bda[_0x838b('0x20')]=_[_0x838b('0x27')](_0x5739ff[_0x838b('0x20')]);_0x583bda[_0x838b('0x28')]=_['intersection'](_0x583bda['model'],_0x583bda[_0x838b('0x20')]);_0x55f812[_0x838b('0x2c')]=_['intersection'](_0x583bda['model'],qs[_0x838b('0x2b')](_0x5739ff[_0x838b('0x20')][_0x838b('0x2b')]));_0x55f812[_0x838b('0x2c')]=_0x55f812[_0x838b('0x2c')][_0x838b('0x2d')]?_0x55f812[_0x838b('0x2c')]:_0x583bda[_0x838b('0x2a')];if(!_0x5739ff[_0x838b('0x20')][_0x838b('0x3e')]('nolimit')){_0x55f812['limit']=qs['limit'](_0x5739ff[_0x838b('0x20')][_0x838b('0xf')]);_0x55f812[_0x838b('0xd')]=qs[_0x838b('0xd')](_0x5739ff[_0x838b('0x20')]['offset']);}_0x55f812[_0x838b('0x3f')]=qs['sort'](_0x5739ff['query'][_0x838b('0x40')]);_0x55f812[_0x838b('0x41')]=qs[_0x838b('0x28')](_['pick'](_0x5739ff[_0x838b('0x20')],_0x583bda[_0x838b('0x28')]));_0x55f812[_0x838b('0x41')][_0x838b('0x42')]=_0x5ebde7['id'];if(_0x5739ff[_0x838b('0x20')][_0x838b('0x43')]){_0x55f812['where']=_[_0x838b('0x44')](_0x55f812[_0x838b('0x41')],{'$or':_[_0x838b('0x1c')](_0x55f812[_0x838b('0x2c')],function(_0x3b73ba){var _0x122b52={};_0x122b52[_0x3b73ba]={'$like':'%'+_0x5739ff[_0x838b('0x20')]['filter']+'%'};return _0x122b52;})});}_0x55f812=_[_0x838b('0x44')]({},_0x55f812,_0x5739ff[_0x838b('0x2f')]);return db[_0x838b('0x45')][_0x838b('0x22')](_0x55f812);}})[_0x838b('0x14')](function(_0x359056){if(_0x359056){return db[_0x838b('0x46')][_0x838b('0x47')]({'where':{'id':_[_0x838b('0x1c')](_0x359056,_0x838b('0x48')),'role':'agent'},'attributes':['id',_0x838b('0x1a'),'faxPause',_0x838b('0x49'),_0x838b('0x4a')]});}})[_0x838b('0x14')](function(_0x164e01){if(_0x164e01){return{'count':_0x164e01[_0x838b('0x10')],'rows':_[_0x838b('0x1c')](_0x164e01['rows'],function(_0x393270){return{'membername':_0x393270[_0x838b('0x1a')],'UserId':_0x393270['id'],'queue_name':_0x2aa6b7[_0x838b('0x1a')],'FaxQueueId':_0x2aa6b7['id'],'interface':util[_0x838b('0x4b')](_0x838b('0x4c'),_0x838b('0x4d'),_0x393270[_0x838b('0x1a')]),'penalty':0x0,'paused':_0x393270[_0x838b('0x4e')],'createdAt':_0x393270[_0x838b('0x4a')],'updatedAt':_0x393270[_0x838b('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x838b('0x14')](respondWithFilteredResult(_0x4d7336,_0x55f812))[_0x838b('0x24')](handleError(_0x4d7336,null));};exports[_0x838b('0x4f')]=function(_0xad196e,_0x5503c1){var _0x197865={};var _0x5f182c={};var _0x4e377d;var _0x2e2c91;return db['FaxQueue'][_0x838b('0x3d')]({'where':{'id':_0xad196e[_0x838b('0x26')]['id']}})[_0x838b('0x14')](handleEntityNotFound(_0x5503c1,null))[_0x838b('0x14')](function(_0x2fd614){if(_0x2fd614){_0x4e377d=_0x2fd614;_0x5f182c[_0x838b('0x2a')]=_['keys'](db['Team'][_0x838b('0x1d')]);_0x5f182c[_0x838b('0x20')]=_[_0x838b('0x27')](_0xad196e[_0x838b('0x20')]);_0x5f182c['filters']=_['intersection'](_0x5f182c['model'],_0x5f182c[_0x838b('0x20')]);_0x197865[_0x838b('0x2c')]=_['intersection'](_0x5f182c[_0x838b('0x2a')],qs['fields'](_0xad196e[_0x838b('0x20')]['fields']));_0x197865['attributes']=_0x197865['attributes']['length']?_0x197865[_0x838b('0x2c')]:_0x5f182c[_0x838b('0x2a')];_0x197865['order']=qs[_0x838b('0x40')](_0xad196e['query'][_0x838b('0x40')]);_0x197865[_0x838b('0x41')]=qs[_0x838b('0x28')](_[_0x838b('0x50')](_0xad196e[_0x838b('0x20')],_0x5f182c[_0x838b('0x28')]));if(_0xad196e[_0x838b('0x20')][_0x838b('0x43')]){_0x197865['where']=_[_0x838b('0x44')](_0x197865[_0x838b('0x41')],{'$or':_[_0x838b('0x1c')](_0x197865[_0x838b('0x2c')],function(_0x537c21){var _0x59e508={};_0x59e508[_0x537c21]={'$like':'%'+_0xad196e[_0x838b('0x20')]['filter']+'%'};return _0x59e508;})});}_0x197865=_[_0x838b('0x44')]({},_0x197865,_0xad196e[_0x838b('0x2f')]);return _0x4e377d[_0x838b('0x4f')](_0x197865);}})[_0x838b('0x14')](function(_0x4710ce){if(_0x4710ce){_0x2e2c91=_0x4710ce[_0x838b('0x2d')];if(!_0xad196e[_0x838b('0x20')][_0x838b('0x3e')](_0x838b('0x51'))){_0x197865[_0x838b('0xf')]=qs[_0x838b('0xf')](_0xad196e['query'][_0x838b('0xf')]);_0x197865['offset']=qs['offset'](_0xad196e[_0x838b('0x20')][_0x838b('0xd')]);}return _0x4e377d[_0x838b('0x4f')](_0x197865);}})[_0x838b('0x14')](function(_0x5a301d){if(_0x5a301d){return _0x5a301d?{'count':_0x2e2c91,'rows':_0x5a301d}:null;}})[_0x838b('0x14')](respondWithResult(_0x5503c1,null))[_0x838b('0x24')](handleError(_0x5503c1,null));};exports['addTeams']=function(_0x4fe3c6,_0x42c3a5){var _0x47566b=_0x4fe3c6['body'][_0x838b('0x52')];return db[_0x838b('0x53')]['findAll']({'where':{'id':_0x47566b},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x838b('0x1a'),'online',_0x838b('0x54'),'interface'],'raw':!![]}]})[_0x838b('0x14')](function(_0x2c8ea5){if(_0x2c8ea5){var _0x2cf9be=_[_0x838b('0x55')](_0x2c8ea5,function(_0x31e780){var _0x7d3321=_0x31e780[_0x838b('0x16')]({'plain':!![]});return _0x7d3321[_0x838b('0x56')];});return db[_0x838b('0x21')]['find']({'where':{'id':_0x4fe3c6['params']['id']}})[_0x838b('0x14')](function(_0x1241df){return db[_0x838b('0x57')][_0x838b('0x58')](function(_0x8f3359){return _0x1241df['addTeams'](_0x47566b,{'transaction':_0x8f3359})[_0x838b('0x14')](function(){return BPromise[_0x838b('0x59')](_0x2cf9be,function(_0x56d8bb){return db['UserFaxQueue'][_0x838b('0x5a')]({'where':{'UserId':_0x56d8bb['id'],'FaxQueueId':_0x4fe3c6[_0x838b('0x26')]['id']},'transaction':_0x8f3359});});})[_0x838b('0x14')](function(){_0x2cf9be[_0x838b('0x5b')](function(_0x57ff74){socket[_0x838b('0x5c')](_0x838b('0x5d'),{'UserId':_0x57ff74['id'],'FaxQueueId':_0x1241df['id']});});});});});}})[_0x838b('0x14')](respondWithStatusCode(_0x42c3a5,null))[_0x838b('0x24')](handleError(_0x42c3a5,null));};exports[_0x838b('0x5e')]=function(_0x44a251,_0xa3f233){return db[_0x838b('0x53')][_0x838b('0x22')]({'where':{'id':_0x44a251[_0x838b('0x20')][_0x838b('0x52')]},'attributes':['id'],'include':[{'model':db[_0x838b('0x46')],'as':_0x838b('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xa3f233,null))['then'](function(_0x2882b2){var _0x50b17b=_[_0x838b('0x1c')](_0x2882b2,'id');var _0x3a1bfb=[];var _0x139942=[];var _0x518d7a=squel[_0x838b('0x5f')]();_0x518d7a[_0x838b('0x60')](_0x838b('0x61'))[_0x838b('0x62')](_0x838b('0x63'),'tq')['join'](_0x838b('0x64'),'ut',_0x838b('0x65'))[_0x838b('0x41')](_0x838b('0x66'),_0x44a251[_0x838b('0x26')]['id']);for(var _0x4f509f=0x0;_0x4f509f<_0x2882b2[_0x838b('0x2d')];_0x4f509f+=0x1){let _0x46beed=_0x2882b2[_0x4f509f];for(var _0x2dfe77=0x0;_0x2dfe77<_0x46beed[_0x838b('0x56')][_0x838b('0x2d')];_0x2dfe77+=0x1){let _0x4138f4=_0x46beed[_0x838b('0x56')][_0x2dfe77];var _0x3a97d4=_0x518d7a[_0x838b('0x67')]();_0x3a97d4['where'](_0x838b('0x68'),_0x4138f4['id']);_0x139942[_0x838b('0x69')](db[_0x838b('0x57')][_0x838b('0x20')](_0x3a97d4['toString'](),{'type':db[_0x838b('0x57')][_0x838b('0x6a')][_0x838b('0x6b')]})[_0x838b('0x14')](function(_0x4b3eb2){if(_0x4b3eb2[_0x838b('0x2d')]===0x1){return _0x4138f4['id'];}else{var _0x2750a8=_[_0x838b('0x6c')](_[_0x838b('0x1c')](_0x4b3eb2,_0x838b('0x6d')),function(_0x20f1d0){return _['includes'](_0x50b17b,_0x20f1d0);});if(_0x2750a8){return _0x4138f4['id'];}}}));}}return BPromise[_0x838b('0x6e')](_0x139942)['then'](function(_0x501cbf){_0x3a1bfb=_(_0x3a1bfb)[_0x838b('0x6f')](_0x501cbf)[_0x838b('0x70')]()[_0x838b('0x71')]();return db[_0x838b('0x21')][_0x838b('0x30')]({'where':{'id':_0x44a251[_0x838b('0x26')]['id']}})[_0x838b('0x14')](function(_0x30e526){return db[_0x838b('0x57')]['transaction'](function(_0x222eda){return _0x30e526[_0x838b('0x5e')](_0x44a251['query'][_0x838b('0x52')],{'transaction':_0x222eda})['then'](function(){if(!_['isEmpty'](_0x3a1bfb)){return _0x30e526[_0x838b('0x72')](_0x3a1bfb,{'transaction':_0x222eda});}})['then'](function(){_0x3a1bfb[_0x838b('0x5b')](function(_0x40b4c0){socket[_0x838b('0x5c')](_0x838b('0x73'),{'UserId':_0x40b4c0,'FaxQueueId':_0x30e526['id']});});});});});});})[_0x838b('0x14')](respondWithStatusCode(_0xa3f233,null))[_0x838b('0x24')](handleError(_0xa3f233,null));};exports[_0x838b('0x74')]=function(_0x295212,_0x3c4bf8){return db[_0x838b('0x21')][_0x838b('0x30')]({'where':{'id':_0x295212[_0x838b('0x26')]['id']}})[_0x838b('0x14')](handleEntityNotFound(_0x3c4bf8,null))[_0x838b('0x14')](function(_0x49cabf){if(_0x49cabf){return _0x49cabf[_0x838b('0x74')](_0x295212['body'][_0x838b('0x52')],_['omit'](_0x295212[_0x838b('0x32')],['ids','id'])||{})[_0x838b('0x75')](function(_0x3e3970){for(var _0x212008=0x0;_0x212008<_0x295212[_0x838b('0x32')][_0x838b('0x52')][_0x838b('0x2d')];_0x212008+=0x1){socket['emit'](_0x838b('0x5d'),{'UserId':Number(_0x295212['body'][_0x838b('0x52')][_0x212008]),'FaxQueueId':Number(_0x295212[_0x838b('0x26')]['id'])});}return _0x3e3970;});}})[_0x838b('0x14')](respondWithResult(_0x3c4bf8,null))[_0x838b('0x24')](handleError(_0x3c4bf8,null));};exports[_0x838b('0x72')]=function(_0x412e27,_0x539414){return db[_0x838b('0x21')][_0x838b('0x30')]({'where':{'id':_0x412e27[_0x838b('0x26')]['id']}})[_0x838b('0x14')](handleEntityNotFound(_0x539414,null))['then'](function(_0x3f8fc1){if(_0x3f8fc1){return _0x3f8fc1['removeAgents'](_0x412e27['query'][_0x838b('0x52')])[_0x838b('0x14')](function(){if(_[_0x838b('0x76')](_0x412e27[_0x838b('0x20')]['ids'])){for(var _0x418350=0x0;_0x418350<_0x412e27['query'][_0x838b('0x52')][_0x838b('0x2d')];_0x418350+=0x1){socket[_0x838b('0x5c')](_0x838b('0x73'),{'UserId':Number(_0x412e27['query'][_0x838b('0x52')][_0x418350]),'FaxQueueId':Number(_0x412e27[_0x838b('0x26')]['id'])});}}else{socket['emit'](_0x838b('0x73'),{'UserId':Number(_0x412e27['query'][_0x838b('0x52')]),'FaxQueueId':Number(_0x412e27[_0x838b('0x26')]['id'])});}});}})[_0x838b('0x14')](respondWithStatusCode(_0x539414,null))[_0x838b('0x24')](handleError(_0x539414,null));};exports['getAgents']=function(_0x378e01,_0xe023d3){var _0x4912d7={};var _0x2b95a5={};var _0xd31d36;var _0xfec153;return db[_0x838b('0x21')]['findOne']({'where':{'id':_0x378e01[_0x838b('0x26')]['id']}})[_0x838b('0x14')](handleEntityNotFound(_0xe023d3,null))[_0x838b('0x14')](function(_0x32ce7e){if(_0x32ce7e){_0xd31d36=_0x32ce7e;_0x2b95a5[_0x838b('0x2a')]=_[_0x838b('0x27')](db[_0x838b('0x46')][_0x838b('0x1d')]);_0x2b95a5[_0x838b('0x20')]=_[_0x838b('0x27')](_0x378e01[_0x838b('0x20')]);_0x2b95a5[_0x838b('0x28')]=_['intersection'](_0x2b95a5[_0x838b('0x2a')],_0x2b95a5[_0x838b('0x20')]);_0x4912d7[_0x838b('0x2c')]=_[_0x838b('0x29')](_0x2b95a5[_0x838b('0x2a')],qs[_0x838b('0x2b')](_0x378e01[_0x838b('0x20')][_0x838b('0x2b')]));_0x4912d7[_0x838b('0x2c')]=_0x4912d7[_0x838b('0x2c')]['length']?_0x4912d7[_0x838b('0x2c')]:_0x2b95a5['model'];_0x4912d7[_0x838b('0x3f')]=qs[_0x838b('0x40')](_0x378e01[_0x838b('0x20')]['sort']);_0x4912d7[_0x838b('0x41')]=qs[_0x838b('0x28')](_[_0x838b('0x50')](_0x378e01[_0x838b('0x20')],_0x2b95a5[_0x838b('0x28')]));if(_0x378e01[_0x838b('0x20')][_0x838b('0x43')]){_0x4912d7[_0x838b('0x41')]=_[_0x838b('0x44')](_0x4912d7[_0x838b('0x41')],{'$or':_['map'](_0x4912d7[_0x838b('0x2c')],function(_0x1e1c57){var _0xedd70c={};_0xedd70c[_0x1e1c57]={'$like':'%'+_0x378e01[_0x838b('0x20')]['filter']+'%'};return _0xedd70c;})});}_0x4912d7=_[_0x838b('0x44')]({},_0x4912d7,_0x378e01['options']);return _0xd31d36[_0x838b('0x77')](_0x4912d7);}})[_0x838b('0x14')](function(_0x47c71b){if(_0x47c71b){_0xfec153=_0x47c71b[_0x838b('0x2d')];if(!_0x378e01['query']['hasOwnProperty'](_0x838b('0x51'))){_0x4912d7['limit']=qs[_0x838b('0xf')](_0x378e01['query'][_0x838b('0xf')]);_0x4912d7['offset']=qs['offset'](_0x378e01[_0x838b('0x20')]['offset']);}return _0xd31d36[_0x838b('0x77')](_0x4912d7);}})[_0x838b('0x14')](function(_0x5b4ac7){if(_0x5b4ac7){return _0x5b4ac7?{'count':_0xfec153,'rows':_0x5b4ac7}:null;}})['then'](respondWithResult(_0xe023d3,null))[_0x838b('0x24')](handleError(_0xe023d3,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index afcc3b3..eb3c601 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 _0xa236=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xa236,0x1cd));var _0x6a23=function(_0x5b7a54,_0x167e67){_0x5b7a54=_0x5b7a54-0x0;var _0x3c5114=_0xa236[_0x5b7a54];return _0x3c5114;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x6a23('0x0'))['db'][_0x6a23('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6a23('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6a23('0x3'),'afterDestroy':_0x6a23('0x4')};function emitEvent(_0x2fcf2c){return function(_0x18f0d2,_0x366de7,_0x1be282){FaxQueueEvents[_0x6a23('0x5')](_0x2fcf2c+':'+_0x18f0d2['id'],_0x18f0d2);FaxQueueEvents['emit'](_0x2fcf2c,_0x18f0d2);_0x1be282(null);};}for(var e in events){if(events[_0x6a23('0x6')](e)){var event=events[e];FaxQueue[_0x6a23('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x3fce=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0x3fce,0xdd));var _0xe3fc=function(_0x3f8759,_0x3fe6fb){_0x3f8759=_0x3f8759-0x0;var _0x2d33ca=_0x3fce[_0x3f8759];return _0x2d33ca;};'use strict';var EventEmitter=require(_0xe3fc('0x0'));var FaxQueue=require(_0xe3fc('0x1'))['db'][_0xe3fc('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xe3fc('0x3')](0x0);var events={'afterCreate':_0xe3fc('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x59b3c2){return function(_0x28a02c,_0x3b9131,_0x15d990){FaxQueueEvents['emit'](_0x59b3c2+':'+_0x28a02c['id'],_0x28a02c);FaxQueueEvents[_0xe3fc('0x5')](_0x59b3c2,_0x28a02c);_0x15d990(null);};}for(var e in events){if(events[_0xe3fc('0x6')](e)){var event=events[e];FaxQueue[_0xe3fc('0x7')](e,emitEvent(event));}}module[_0xe3fc('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 5a96346..3c6a157 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 _0x6475=['FaxQueue','fax_queues','lodash','api','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','define'];(function(_0x3f17a3,_0x52a1ff){var _0x4f71b3=function(_0x3facc9){while(--_0x3facc9){_0x3f17a3['push'](_0x3f17a3['shift']());}};_0x4f71b3(++_0x52a1ff);}(_0x6475,0x7a));var _0x5647=function(_0xf36a76,_0x3967b3){_0xf36a76=_0xf36a76-0x0;var _0x414aa5=_0x6475[_0xf36a76];return _0x414aa5;};'use strict';var _=require(_0x5647('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5647('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5647('0x2'));var fs=require('fs');var path=require(_0x5647('0x3'));var rimraf=require(_0x5647('0x4'));var config=require(_0x5647('0x5'));var attributes=require(_0x5647('0x6'));module['exports']=function(_0x34b199,_0x1e237a){return _0x34b199[_0x5647('0x7')](_0x5647('0x8'),attributes,{'tableName':_0x5647('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf0c=['lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues'];(function(_0x5ac5c8,_0x473065){var _0x4229c7=function(_0xe47fde){while(--_0xe47fde){_0x5ac5c8['push'](_0x5ac5c8['shift']());}};_0x4229c7(++_0x473065);}(_0xdf0c,0x197));var _0xcdf0=function(_0x1ca7c4,_0x1436c8){_0x1ca7c4=_0x1ca7c4-0x0;var _0x5399c7=_0xdf0c[_0x1ca7c4];return _0x5399c7;};'use strict';var _=require(_0xcdf0('0x0'));var util=require('util');var logger=require(_0xcdf0('0x1'))(_0xcdf0('0x2'));var moment=require(_0xcdf0('0x3'));var BPromise=require(_0xcdf0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdf0('0x5'));var rimraf=require('rimraf');var config=require(_0xcdf0('0x6'));var attributes=require(_0xcdf0('0x7'));module['exports']=function(_0x58579d,_0x2f3b53){return _0x58579d[_0xcdf0('0x8')](_0xcdf0('0x9'),attributes,{'tableName':_0xcdf0('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 97689be..48f1fa6 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 _0x6ee6=['localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxQueue','ShowFaxQueue','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults'];(function(_0x570ae7,_0x126f0c){var _0x1ed994=function(_0x9c53dc){while(--_0x9c53dc){_0x570ae7['push'](_0x570ae7['shift']());}};_0x1ed994(++_0x126f0c);}(_0x6ee6,0x1e0));var _0x66ee=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0x6ee6[_0x420513];return _0x1b44ec;};'use strict';var _=require(_0x66ee('0x0'));var util=require(_0x66ee('0x1'));var moment=require(_0x66ee('0x2'));var BPromise=require(_0x66ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66ee('0x4'))['db'];var utils=require(_0x66ee('0x5'));var logger=require(_0x66ee('0x6'))(_0x66ee('0x7'));var config=require(_0x66ee('0x8'));var jayson=require(_0x66ee('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x66ee('0xa')]=_[_0x66ee('0xb')](config['redis'],{'host':_0x66ee('0xc'),'port':0x18eb});var socket=require(_0x66ee('0xd'))(new Redis(config[_0x66ee('0xa')]));require(_0x66ee('0xe'))[_0x66ee('0xf')](socket);function respondWithRpcPromise(_0x59835b,_0x130607,_0x262bc6){return new BPromise(function(_0x344cd3,_0x115ba8){return client[_0x66ee('0x10')](_0x59835b,_0x262bc6)[_0x66ee('0x11')](function(_0x833d08){logger['info'](_0x66ee('0x12'),_0x130607,_0x66ee('0x13'));logger[_0x66ee('0x14')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x130607,'request\x20sent',JSON[_0x66ee('0x15')](_0x833d08));if(_0x833d08[_0x66ee('0x16')]){if(_0x833d08[_0x66ee('0x16')][_0x66ee('0x17')]===0x1f4){logger[_0x66ee('0x16')](_0x66ee('0x12'),_0x130607,_0x833d08[_0x66ee('0x16')][_0x66ee('0x18')]);return _0x115ba8(_0x833d08[_0x66ee('0x16')][_0x66ee('0x18')]);}logger[_0x66ee('0x16')]('FaxQueue,\x20%s,\x20%s',_0x130607,_0x833d08['error']['message']);return _0x344cd3(_0x833d08[_0x66ee('0x16')][_0x66ee('0x18')]);}else{logger[_0x66ee('0x19')]('FaxQueue,\x20%s,\x20%s',_0x130607,'request\x20sent');_0x344cd3(_0x833d08[_0x66ee('0x1a')][_0x66ee('0x18')]);}})[_0x66ee('0x1b')](function(_0x1cd109){logger['error'](_0x66ee('0x12'),_0x130607,_0x1cd109);_0x115ba8(_0x1cd109);});});}exports['GetFaxQueue']=function(_0x4f0101){var _0x30c4a5=this;return new Promise(function(_0x107a02,_0x399d70){return db[_0x66ee('0x1c')][_0x66ee('0x1d')]({'raw':_0x4f0101['options']?_0x4f0101[_0x66ee('0x1e')][_0x66ee('0x1f')]===undefined?!![]:![]:!![],'where':_0x4f0101[_0x66ee('0x1e')]?_0x4f0101[_0x66ee('0x1e')][_0x66ee('0x20')]||null:null,'attributes':_0x4f0101[_0x66ee('0x1e')]?_0x4f0101[_0x66ee('0x1e')][_0x66ee('0x21')]||null:null,'limit':_0x4f0101[_0x66ee('0x1e')]?_0x4f0101[_0x66ee('0x1e')][_0x66ee('0x22')]||null:null,'include':_0x4f0101[_0x66ee('0x1e')]?_0x4f0101[_0x66ee('0x1e')][_0x66ee('0x23')]?_[_0x66ee('0x24')](_0x4f0101[_0x66ee('0x1e')][_0x66ee('0x23')],function(_0x4ec3a6){return{'model':db[_0x4ec3a6[_0x66ee('0x25')]],'as':_0x4ec3a6['as'],'attributes':_0x4ec3a6['attributes'],'include':_0x4ec3a6[_0x66ee('0x23')]?_['map'](_0x4ec3a6[_0x66ee('0x23')],function(_0x3d0ece){return{'model':db[_0x3d0ece[_0x66ee('0x25')]],'as':_0x3d0ece['as'],'attributes':_0x3d0ece[_0x66ee('0x21')],'include':_0x3d0ece['include']?_[_0x66ee('0x24')](_0x3d0ece['include'],function(_0x4d9be0){return{'model':db[_0x4d9be0[_0x66ee('0x25')]],'as':_0x4d9be0['as'],'attributes':_0x4d9be0[_0x66ee('0x21')]};}):[]};}):[]};}):[]:[]})[_0x66ee('0x11')](function(_0xcfe12d){logger[_0x66ee('0x19')](_0x66ee('0x26'),_0x4f0101);logger[_0x66ee('0x14')](_0x66ee('0x26'),_0x4f0101,JSON[_0x66ee('0x15')](_0xcfe12d));_0x107a02(_0xcfe12d);})['catch'](function(_0xfb5b62){logger[_0x66ee('0x16')](_0x66ee('0x26'),_0xfb5b62[_0x66ee('0x18')],_0x4f0101);_0x399d70(_0x30c4a5[_0x66ee('0x16')](0x1f4,_0xfb5b62[_0x66ee('0x18')]));});});};exports[_0x66ee('0x27')]=function(_0x4aac93){var _0x17242e=this;return new Promise(function(_0x2f6a48,_0x3409b9){return db[_0x66ee('0x1c')][_0x66ee('0x28')]({'raw':_0x4aac93[_0x66ee('0x1e')]?_0x4aac93[_0x66ee('0x1e')][_0x66ee('0x1f')]===undefined?!![]:![]:!![],'where':_0x4aac93[_0x66ee('0x1e')]?_0x4aac93['options'][_0x66ee('0x20')]||null:null,'attributes':_0x4aac93[_0x66ee('0x1e')]?_0x4aac93[_0x66ee('0x1e')][_0x66ee('0x21')]||null:null,'include':_0x4aac93[_0x66ee('0x1e')]?_0x4aac93[_0x66ee('0x1e')][_0x66ee('0x23')]?_['map'](_0x4aac93[_0x66ee('0x1e')][_0x66ee('0x23')],function(_0x152464){return{'model':db[_0x152464[_0x66ee('0x25')]],'as':_0x152464['as'],'attributes':_0x152464[_0x66ee('0x21')],'include':_0x152464[_0x66ee('0x23')]?_['map'](_0x152464[_0x66ee('0x23')],function(_0x168028){return{'model':db[_0x168028[_0x66ee('0x25')]],'as':_0x168028['as'],'attributes':_0x168028[_0x66ee('0x21')],'include':_0x168028['include']?_[_0x66ee('0x24')](_0x168028['include'],function(_0x5df4a6){return{'model':db[_0x5df4a6[_0x66ee('0x25')]],'as':_0x5df4a6['as'],'attributes':_0x5df4a6[_0x66ee('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a9832){logger['info'](_0x66ee('0x27'),_0x4aac93);logger[_0x66ee('0x14')](_0x66ee('0x27'),_0x4aac93,JSON[_0x66ee('0x15')](_0x5a9832));_0x2f6a48(_0x5a9832);})['catch'](function(_0x3739f1){logger[_0x66ee('0x16')](_0x66ee('0x27'),_0x3739f1[_0x66ee('0x18')],_0x4aac93);_0x3409b9(_0x17242e[_0x66ee('0x16')](0x1f4,_0x3739f1['message']));});});}; \ No newline at end of file +var _0x87bf=['debug','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','options','raw','where','limit','map','include','model','attributes','GetFaxQueue','FaxQueue','find','ShowFaxQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket','register','request','then','info','request\x20sent'];(function(_0x2006e1,_0x1daa2d){var _0x3f4b72=function(_0x133c61){while(--_0x133c61){_0x2006e1['push'](_0x2006e1['shift']());}};_0x3f4b72(++_0x1daa2d);}(_0x87bf,0x1d7));var _0xf87b=function(_0x379eaf,_0x4eb489){_0x379eaf=_0x379eaf-0x0;var _0x326f1f=_0x87bf[_0x379eaf];return _0x326f1f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf87b('0x0'));var BPromise=require(_0xf87b('0x1'));var rs=require(_0xf87b('0x2'));var fs=require('fs');var Redis=require(_0xf87b('0x3'));var db=require(_0xf87b('0x4'))['db'];var utils=require(_0xf87b('0x5'));var logger=require(_0xf87b('0x6'))(_0xf87b('0x7'));var config=require(_0xf87b('0x8'));var jayson=require(_0xf87b('0x9'));var client=jayson[_0xf87b('0xa')][_0xf87b('0xb')]({'port':0x232a});config[_0xf87b('0xc')]=_[_0xf87b('0xd')](config['redis'],{'host':_0xf87b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf87b('0xf'))[_0xf87b('0x10')](socket);function respondWithRpcPromise(_0xb5d67,_0x2be8d9,_0x50c2f4){return new BPromise(function(_0x2c865c,_0x7672de){return client[_0xf87b('0x11')](_0xb5d67,_0x50c2f4)[_0xf87b('0x12')](function(_0x536fe8){logger[_0xf87b('0x13')]('FaxQueue,\x20%s,\x20%s',_0x2be8d9,_0xf87b('0x14'));logger[_0xf87b('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x2be8d9,_0xf87b('0x14'),JSON[_0xf87b('0x16')](_0x536fe8));if(_0x536fe8['error']){if(_0x536fe8[_0xf87b('0x17')][_0xf87b('0x18')]===0x1f4){logger[_0xf87b('0x17')](_0xf87b('0x19'),_0x2be8d9,_0x536fe8[_0xf87b('0x17')]['message']);return _0x7672de(_0x536fe8[_0xf87b('0x17')]['message']);}logger[_0xf87b('0x17')](_0xf87b('0x19'),_0x2be8d9,_0x536fe8['error'][_0xf87b('0x1a')]);return _0x2c865c(_0x536fe8['error']['message']);}else{logger[_0xf87b('0x13')]('FaxQueue,\x20%s,\x20%s',_0x2be8d9,_0xf87b('0x14'));_0x2c865c(_0x536fe8[_0xf87b('0x1b')]['message']);}})[_0xf87b('0x1c')](function(_0x128d86){logger[_0xf87b('0x17')](_0xf87b('0x19'),_0x2be8d9,_0x128d86);_0x7672de(_0x128d86);});});}exports['GetFaxQueue']=function(_0x35c77e){var _0x1104f1=this;return new Promise(function(_0x761545,_0x278159){return db['FaxQueue']['findAll']({'raw':_0x35c77e['options']?_0x35c77e[_0xf87b('0x1d')][_0xf87b('0x1e')]===undefined?!![]:![]:!![],'where':_0x35c77e[_0xf87b('0x1d')]?_0x35c77e[_0xf87b('0x1d')][_0xf87b('0x1f')]||null:null,'attributes':_0x35c77e[_0xf87b('0x1d')]?_0x35c77e[_0xf87b('0x1d')]['attributes']||null:null,'limit':_0x35c77e[_0xf87b('0x1d')]?_0x35c77e['options'][_0xf87b('0x20')]||null:null,'include':_0x35c77e[_0xf87b('0x1d')]?_0x35c77e[_0xf87b('0x1d')]['include']?_[_0xf87b('0x21')](_0x35c77e[_0xf87b('0x1d')][_0xf87b('0x22')],function(_0x40c78e){return{'model':db[_0x40c78e[_0xf87b('0x23')]],'as':_0x40c78e['as'],'attributes':_0x40c78e['attributes'],'include':_0x40c78e[_0xf87b('0x22')]?_['map'](_0x40c78e[_0xf87b('0x22')],function(_0x2ffbcd){return{'model':db[_0x2ffbcd[_0xf87b('0x23')]],'as':_0x2ffbcd['as'],'attributes':_0x2ffbcd[_0xf87b('0x24')],'include':_0x2ffbcd[_0xf87b('0x22')]?_[_0xf87b('0x21')](_0x2ffbcd[_0xf87b('0x22')],function(_0x283cdb){return{'model':db[_0x283cdb[_0xf87b('0x23')]],'as':_0x283cdb['as'],'attributes':_0x283cdb[_0xf87b('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf87b('0x12')](function(_0x343493){logger[_0xf87b('0x13')](_0xf87b('0x25'),_0x35c77e);logger[_0xf87b('0x15')](_0xf87b('0x25'),_0x35c77e,JSON[_0xf87b('0x16')](_0x343493));_0x761545(_0x343493);})[_0xf87b('0x1c')](function(_0x1f0075){logger[_0xf87b('0x17')](_0xf87b('0x25'),_0x1f0075[_0xf87b('0x1a')],_0x35c77e);_0x278159(_0x1104f1[_0xf87b('0x17')](0x1f4,_0x1f0075['message']));});});};exports['ShowFaxQueue']=function(_0x33d857){var _0x4ebda9=this;return new Promise(function(_0x2807a5,_0x126c59){return db[_0xf87b('0x26')][_0xf87b('0x27')]({'raw':_0x33d857['options']?_0x33d857[_0xf87b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x33d857[_0xf87b('0x1d')]?_0x33d857[_0xf87b('0x1d')][_0xf87b('0x1f')]||null:null,'attributes':_0x33d857[_0xf87b('0x1d')]?_0x33d857[_0xf87b('0x1d')][_0xf87b('0x24')]||null:null,'include':_0x33d857['options']?_0x33d857['options'][_0xf87b('0x22')]?_[_0xf87b('0x21')](_0x33d857['options'][_0xf87b('0x22')],function(_0x2b0e69){return{'model':db[_0x2b0e69[_0xf87b('0x23')]],'as':_0x2b0e69['as'],'attributes':_0x2b0e69['attributes'],'include':_0x2b0e69[_0xf87b('0x22')]?_[_0xf87b('0x21')](_0x2b0e69[_0xf87b('0x22')],function(_0x4573b3){return{'model':db[_0x4573b3['model']],'as':_0x4573b3['as'],'attributes':_0x4573b3[_0xf87b('0x24')],'include':_0x4573b3[_0xf87b('0x22')]?_[_0xf87b('0x21')](_0x4573b3[_0xf87b('0x22')],function(_0xe4750f){return{'model':db[_0xe4750f[_0xf87b('0x23')]],'as':_0xe4750f['as'],'attributes':_0xe4750f[_0xf87b('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf87b('0x12')](function(_0x40bf76){logger[_0xf87b('0x13')]('ShowFaxQueue',_0x33d857);logger['debug'](_0xf87b('0x28'),_0x33d857,JSON['stringify'](_0x40bf76));_0x2807a5(_0x40bf76);})[_0xf87b('0x1c')](function(_0x2927cf){logger['error'](_0xf87b('0x28'),_0x2927cf[_0xf87b('0x1a')],_0x33d857);_0x126c59(_0x4ebda9['error'](0x1f4,_0x2927cf[_0xf87b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 7149910..eec9412 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 _0xba6e=['update','emit','register','faxQueue:','./faxQueue.events','save'];(function(_0x5e0bc8,_0x5f056f){var _0x5e9746=function(_0x59b906){while(--_0x59b906){_0x5e0bc8['push'](_0x5e0bc8['shift']());}};_0x5e9746(++_0x5f056f);}(_0xba6e,0x12a));var _0xeba6=function(_0x258807,_0xade93d){_0x258807=_0x258807-0x0;var _0x5a4ea6=_0xba6e[_0x258807];return _0x5a4ea6;};'use strict';var FaxQueueEvents=require(_0xeba6('0x0'));var events=[_0xeba6('0x1'),'remove',_0xeba6('0x2')];function createListener(_0xd32c64,_0x12eb1f){return function(_0x3c1418){_0x12eb1f[_0xeba6('0x3')](_0xd32c64,_0x3c1418);};}function removeListener(_0x2be9b8,_0x56ad15){return function(){FaxQueueEvents['removeListener'](_0x2be9b8,_0x56ad15);};}exports[_0xeba6('0x4')]=function(_0x1ff200){for(var _0x535485=0x0,_0x2ca5b5=events['length'];_0x535485<_0x2ca5b5;_0x535485++){var _0x4be89c=events[_0x535485];var _0x590f26=createListener(_0xeba6('0x5')+_0x4be89c,_0x1ff200);FaxQueueEvents['on'](_0x4be89c,_0x590f26);}}; \ No newline at end of file +var _0x920e=['remove','update','emit','removeListener','register','length','faxQueue:','save'];(function(_0x345d9a,_0x1da2e5){var _0x7fe4f=function(_0x49e20a){while(--_0x49e20a){_0x345d9a['push'](_0x345d9a['shift']());}};_0x7fe4f(++_0x1da2e5);}(_0x920e,0xc7));var _0xe920=function(_0x29ac12,_0x78fc8a){_0x29ac12=_0x29ac12-0x0;var _0x8caade=_0x920e[_0x29ac12];return _0x8caade;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xe920('0x0'),_0xe920('0x1'),_0xe920('0x2')];function createListener(_0x4cc852,_0x2345d7){return function(_0x4598cc){_0x2345d7[_0xe920('0x3')](_0x4cc852,_0x4598cc);};}function removeListener(_0xda2e29,_0x579748){return function(){FaxQueueEvents[_0xe920('0x4')](_0xda2e29,_0x579748);};}exports[_0xe920('0x5')]=function(_0x5bd263){for(var _0x2966b0=0x0,_0x100438=events[_0xe920('0x6')];_0x2966b0<_0x100438;_0x2966b0++){var _0x2ca58d=events[_0x2966b0];var _0x56a01d=createListener(_0xe920('0x7')+_0x2ca58d,_0x5bd263);FaxQueueEvents['on'](_0x2ca58d,_0x56a01d);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 465f06e..d0bc2ad 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 _0xdf55=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','delete','destroy','removeTeams'];(function(_0x4908c7,_0x1c48a1){var _0x44893d=function(_0x49036e){while(--_0x49036e){_0x4908c7['push'](_0x4908c7['shift']());}};_0x44893d(++_0x1c48a1);}(_0xdf55,0x83));var _0x5df5=function(_0x57c22b,_0x54a1fa){_0x57c22b=_0x57c22b-0x0;var _0x5c982e=_0xdf55[_0x57c22b];return _0x5c982e;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require('path');var timeout=require(_0x5df5('0x2'));var express=require(_0x5df5('0x3'));var router=express['Router']();var fs_extra=require(_0x5df5('0x4'));var auth=require(_0x5df5('0x5'));var interaction=require(_0x5df5('0x6'));var config=require('../../config/environment');var controller=require(_0x5df5('0x7'));router[_0x5df5('0x8')]('/',auth[_0x5df5('0x9')](),controller[_0x5df5('0xa')]);router[_0x5df5('0x8')](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xc')]);router['get'](_0x5df5('0xd'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xe')]);router['get']('/:id/members',auth[_0x5df5('0x9')](),controller['getMembers']);router[_0x5df5('0x8')](_0x5df5('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0x5df5('0x8')](_0x5df5('0x10'),auth[_0x5df5('0x9')](),controller[_0x5df5('0x11')]);router[_0x5df5('0x12')]('/',auth[_0x5df5('0x9')](),controller[_0x5df5('0x13')]);router[_0x5df5('0x12')](_0x5df5('0xf'),auth[_0x5df5('0x9')](),controller['addTeams']);router[_0x5df5('0x12')]('/:id/users',auth[_0x5df5('0x9')](),controller[_0x5df5('0x14')]);router[_0x5df5('0x15')](_0x5df5('0xd'),auth[_0x5df5('0x9')](),controller['update']);router[_0x5df5('0x16')](_0x5df5('0xd'),auth['isAuthenticated'](),controller[_0x5df5('0x17')]);router[_0x5df5('0x16')](_0x5df5('0xf'),auth[_0x5df5('0x9')](),controller[_0x5df5('0x18')]);router['delete']('/:id/users',auth[_0x5df5('0x9')](),controller['removeAgents']);module[_0x5df5('0x19')]=router; \ No newline at end of file +var _0xa809=['express','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addAgents','put','update','delete','removeTeams','/:id/users','exports','util'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0xa809,0x1f3));var _0x9a80=function(_0x5be338,_0x5c82f5){_0x5be338=_0x5be338-0x0;var _0x55d43b=_0xa809[_0x5be338];return _0x55d43b;};'use strict';var multer=require('multer');var util=require(_0x9a80('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9a80('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9a80('0x2'));var config=require(_0x9a80('0x3'));var controller=require(_0x9a80('0x4'));router[_0x9a80('0x5')]('/',auth['isAuthenticated'](),controller[_0x9a80('0x6')]);router['get'](_0x9a80('0x7'),auth[_0x9a80('0x8')](),controller['describe']);router[_0x9a80('0x5')](_0x9a80('0x9'),auth[_0x9a80('0x8')](),controller[_0x9a80('0xa')]);router['get'](_0x9a80('0xb'),auth[_0x9a80('0x8')](),controller[_0x9a80('0xc')]);router[_0x9a80('0x5')](_0x9a80('0xd'),auth[_0x9a80('0x8')](),controller[_0x9a80('0xe')]);router[_0x9a80('0x5')]('/:id/users',auth[_0x9a80('0x8')](),controller[_0x9a80('0xf')]);router[_0x9a80('0x10')]('/',auth[_0x9a80('0x8')](),controller[_0x9a80('0x11')]);router[_0x9a80('0x10')](_0x9a80('0xd'),auth[_0x9a80('0x8')](),controller['addTeams']);router[_0x9a80('0x10')]('/:id/users',auth[_0x9a80('0x8')](),controller[_0x9a80('0x12')]);router[_0x9a80('0x13')]('/:id',auth[_0x9a80('0x8')](),controller[_0x9a80('0x14')]);router[_0x9a80('0x15')](_0x9a80('0x9'),auth[_0x9a80('0x8')](),controller['destroy']);router[_0x9a80('0x15')]('/:id/teams',auth[_0x9a80('0x8')](),controller[_0x9a80('0x16')]);router[_0x9a80('0x15')](_0x9a80('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x9a80('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 8c6702c..9e420c1 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 _0xdd50=['STRING','DATE','sequelize','exports'];(function(_0x19c1c8,_0x2f0b5d){var _0x39a68a=function(_0x254985){while(--_0x254985){_0x19c1c8['push'](_0x19c1c8['shift']());}};_0x39a68a(++_0x2f0b5d);}(_0xdd50,0x172));var _0x0dd5=function(_0x548d7d,_0x2d41fc){_0x548d7d=_0x548d7d-0x0;var _0xb1c878=_0xdd50[_0x548d7d];return _0xb1c878;};'use strict';var moment=require('moment');var Sequelize=require(_0x0dd5('0x0'));module[_0x0dd5('0x1')]={'uniqueid':{'type':Sequelize[_0x0dd5('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0dd5('0x2')]},'joinAt':{'type':Sequelize[_0x0dd5('0x3')]},'leaveAt':{'type':Sequelize[_0x0dd5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb18e=['DATE','moment','sequelize','STRING'];(function(_0x49f53c,_0x26dbc9){var _0x464ded=function(_0x22d770){while(--_0x22d770){_0x49f53c['push'](_0x49f53c['shift']());}};_0x464ded(++_0x26dbc9);}(_0xb18e,0x199));var _0xeb18=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0xb18e[_0x59b439];return _0x521ea3;};'use strict';var moment=require(_0xeb18('0x0'));var Sequelize=require(_0xeb18('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xeb18('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xeb18('0x3')]},'leaveAt':{'type':Sequelize[_0xeb18('0x3')]},'acceptAt':{'type':Sequelize[_0xeb18('0x3')]},'exitAt':{'type':Sequelize[_0xeb18('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 8098e13..3b9c051 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 _0xcea2=['reject','save','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','VIRTUAL','filter','merge','options','where','FaxQueueReport','includeAll','include','findAll','rows','catch','params','length','find','create','body','update','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','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/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x57ed78,_0x50b531){var _0x4d2148=function(_0x3327aa){while(--_0x3327aa){_0x57ed78['push'](_0x57ed78['shift']());}};_0x4d2148(++_0x50b531);}(_0xcea2,0x15a));var _0x2cea=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xcea2[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require(_0x2cea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2cea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cea('0x2'));var moment=require(_0x2cea('0x3'));var BPromise=require(_0x2cea('0x4'));var Mustache=require('mustache');var util=require(_0x2cea('0x5'));var path=require(_0x2cea('0x6'));var sox=require(_0x2cea('0x7'));var csv=require('to-csv');var ejs=require(_0x2cea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cea('0x9'));var squel=require(_0x2cea('0xa'));var crypto=require(_0x2cea('0xb'));var jsforce=require(_0x2cea('0xc'));var deskjs=require(_0x2cea('0xd'));var toCsv=require(_0x2cea('0xe'));var querystring=require('querystring');var Papa=require(_0x2cea('0xf'));var Redis=require(_0x2cea('0x10'));var authService=require(_0x2cea('0x11'));var qs=require(_0x2cea('0x12'));var as=require(_0x2cea('0x13'));var hardwareService=require(_0x2cea('0x14'));var logger=require(_0x2cea('0x15'))(_0x2cea('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2cea('0x17'));var db=require(_0x2cea('0x18'))['db'];function respondWithStatusCode(_0x528c1d,_0x4bd265){_0x4bd265=_0x4bd265||0xcc;return function(_0x160eaf){if(_0x160eaf){return _0x528c1d['sendStatus'](_0x4bd265);}return _0x528c1d[_0x2cea('0x19')](_0x4bd265)[_0x2cea('0x1a')]();};}function respondWithResult(_0x4377b1,_0x5cf805){_0x5cf805=_0x5cf805||0xc8;return function(_0x4d7f8b){if(_0x4d7f8b){return _0x4377b1['status'](_0x5cf805)[_0x2cea('0x1b')](_0x4d7f8b);}};}function respondWithFilteredResult(_0x586ad5,_0x3c7130){return function(_0x338669){if(_0x338669){var _0x981e3f=typeof _0x3c7130[_0x2cea('0x1c')]===_0x2cea('0x1d')&&typeof _0x3c7130[_0x2cea('0x1e')]===_0x2cea('0x1d');var _0x1ead4c=_0x338669['count'];var _0x19927a=_0x981e3f?0x0:_0x3c7130[_0x2cea('0x1c')];var _0x20c46c=_0x981e3f?_0x338669[_0x2cea('0x1f')]:_0x3c7130[_0x2cea('0x1c')]+_0x3c7130[_0x2cea('0x1e')];var _0x5d75c4;if(_0x20c46c>=_0x1ead4c){_0x20c46c=_0x1ead4c;_0x5d75c4=0xc8;}else{_0x5d75c4=0xce;}_0x586ad5[_0x2cea('0x19')](_0x5d75c4);return _0x586ad5['set'](_0x2cea('0x20'),_0x19927a+'-'+_0x20c46c+'/'+_0x1ead4c)[_0x2cea('0x1b')](_0x338669);}return null;};}function patchUpdates(_0xa73bea){return function(_0x4fd3d5){try{jsonpatch[_0x2cea('0x21')](_0x4fd3d5,_0xa73bea,!![]);}catch(_0x22249e){return BPromise[_0x2cea('0x22')](_0x22249e);}return _0x4fd3d5[_0x2cea('0x23')]();};}function saveUpdates(_0x3246bc,_0x3f6f0e){return function(_0x10f13a){if(_0x10f13a){return _0x10f13a['update'](_0x3246bc)[_0x2cea('0x24')](function(_0x5e5b46){return _0x5e5b46;});}return null;};}function removeEntity(_0x7d88b9,_0x4926ff){return function(_0x3966d5){if(_0x3966d5){return _0x3966d5[_0x2cea('0x25')]()['then'](function(){_0x7d88b9[_0x2cea('0x19')](0xcc)[_0x2cea('0x1a')]();});}};}function handleEntityNotFound(_0x101314,_0xf0bfbe){return function(_0x3f3ee0){if(!_0x3f3ee0){_0x101314[_0x2cea('0x26')](0x194);}return _0x3f3ee0;};}function handleError(_0x5d032f,_0x4ec9b3){_0x4ec9b3=_0x4ec9b3||0x1f4;return function(_0x32b6a3){logger[_0x2cea('0x27')](_0x32b6a3[_0x2cea('0x28')]);if(_0x32b6a3[_0x2cea('0x29')]){delete _0x32b6a3[_0x2cea('0x29')];}_0x5d032f[_0x2cea('0x19')](_0x4ec9b3)[_0x2cea('0x2a')](_0x32b6a3);};}exports['index']=function(_0xff69ad,_0x128863){var _0x5f3fb4={},_0xfeb8bd={},_0xc398c5={'count':0x0,'rows':[]};var _0x271b2f=_[_0x2cea('0x2b')](db['FaxQueueReport'][_0x2cea('0x2c')],function(_0x128934){return{'name':_0x128934['fieldName'],'type':_0x128934[_0x2cea('0x2d')][_0x2cea('0x2e')]};});_0xfeb8bd[_0x2cea('0x2f')]=_[_0x2cea('0x2b')](_0x271b2f,_0x2cea('0x29'));_0xfeb8bd[_0x2cea('0x30')]=_[_0x2cea('0x31')](_0xff69ad[_0x2cea('0x30')]);_0xfeb8bd[_0x2cea('0x32')]=_[_0x2cea('0x33')](_0xfeb8bd[_0x2cea('0x2f')],_0xfeb8bd['query']);_0x5f3fb4[_0x2cea('0x34')]=_[_0x2cea('0x33')](_0xfeb8bd[_0x2cea('0x2f')],qs[_0x2cea('0x35')](_0xff69ad['query']['fields']));_0x5f3fb4[_0x2cea('0x34')]=_0x5f3fb4[_0x2cea('0x34')]['length']?_0x5f3fb4[_0x2cea('0x34')]:_0xfeb8bd['model'];if(!_0xff69ad[_0x2cea('0x30')]['hasOwnProperty'](_0x2cea('0x36'))){_0x5f3fb4['limit']=qs[_0x2cea('0x1e')](_0xff69ad[_0x2cea('0x30')]['limit']);_0x5f3fb4[_0x2cea('0x1c')]=qs[_0x2cea('0x1c')](_0xff69ad['query'][_0x2cea('0x1c')]);}_0x5f3fb4[_0x2cea('0x37')]=qs[_0x2cea('0x38')](_0xff69ad[_0x2cea('0x30')][_0x2cea('0x38')]);_0x5f3fb4['where']=qs[_0x2cea('0x32')](_[_0x2cea('0x39')](_0xff69ad['query'],_0xfeb8bd['filters']),_0x271b2f);if(_0xff69ad[_0x2cea('0x30')]['filter']){_0x5f3fb4['where']=_['merge'](_0x5f3fb4['where'],{'$or':_[_0x2cea('0x2b')](_0x271b2f,function(_0xb5b358){if(_0xb5b358['type']!==_0x2cea('0x3a')){var _0x3e0683={};_0x3e0683[_0xb5b358[_0x2cea('0x29')]]={'$like':'%'+_0xff69ad['query'][_0x2cea('0x3b')]+'%'};return _0x3e0683;}})});}_0x5f3fb4=_[_0x2cea('0x3c')]({},_0x5f3fb4,_0xff69ad[_0x2cea('0x3d')]);var _0x37d175={'where':_0x5f3fb4[_0x2cea('0x3e')]};return db[_0x2cea('0x3f')][_0x2cea('0x1f')](_0x37d175)[_0x2cea('0x24')](function(_0x2cfa0e){_0xc398c5[_0x2cea('0x1f')]=_0x2cfa0e;if(_0xff69ad[_0x2cea('0x30')][_0x2cea('0x40')]){_0x5f3fb4[_0x2cea('0x41')]=[{'all':!![]}];}return db[_0x2cea('0x3f')][_0x2cea('0x42')](_0x5f3fb4);})[_0x2cea('0x24')](function(_0x36efa8){_0xc398c5[_0x2cea('0x43')]=_0x36efa8;return _0xc398c5;})['then'](respondWithFilteredResult(_0x128863,_0x5f3fb4))[_0x2cea('0x44')](handleError(_0x128863,null));};exports['show']=function(_0x29ab58,_0x1afbb9){var _0x22ce6b={'raw':!![],'where':{'id':_0x29ab58[_0x2cea('0x45')]['id']}},_0x5b5d71={};_0x5b5d71[_0x2cea('0x2f')]=_[_0x2cea('0x31')](db[_0x2cea('0x3f')][_0x2cea('0x2c')]);_0x5b5d71[_0x2cea('0x30')]=_['keys'](_0x29ab58['query']);_0x5b5d71[_0x2cea('0x32')]=_[_0x2cea('0x33')](_0x5b5d71['model'],_0x5b5d71[_0x2cea('0x30')]);_0x22ce6b['attributes']=_[_0x2cea('0x33')](_0x5b5d71['model'],qs[_0x2cea('0x35')](_0x29ab58[_0x2cea('0x30')][_0x2cea('0x35')]));_0x22ce6b[_0x2cea('0x34')]=_0x22ce6b[_0x2cea('0x34')][_0x2cea('0x46')]?_0x22ce6b[_0x2cea('0x34')]:_0x5b5d71[_0x2cea('0x2f')];if(_0x29ab58[_0x2cea('0x30')][_0x2cea('0x40')]){_0x22ce6b['include']=[{'all':!![]}];}_0x22ce6b=_[_0x2cea('0x3c')]({},_0x22ce6b,_0x29ab58[_0x2cea('0x3d')]);return db[_0x2cea('0x3f')][_0x2cea('0x47')](_0x22ce6b)['then'](handleEntityNotFound(_0x1afbb9,null))['then'](respondWithResult(_0x1afbb9,null))[_0x2cea('0x44')](handleError(_0x1afbb9,null));};exports[_0x2cea('0x48')]=function(_0xd922c6,_0x510e0f){return db[_0x2cea('0x3f')][_0x2cea('0x48')](_0xd922c6[_0x2cea('0x49')],{})[_0x2cea('0x24')](respondWithResult(_0x510e0f,0xc9))['catch'](handleError(_0x510e0f,null));};exports[_0x2cea('0x4a')]=function(_0x526e92,_0x4d1b77){if(_0x526e92[_0x2cea('0x49')]['id']){delete _0x526e92[_0x2cea('0x49')]['id'];}return db[_0x2cea('0x3f')][_0x2cea('0x47')]({'where':{'id':_0x526e92['params']['id']}})['then'](handleEntityNotFound(_0x4d1b77,null))[_0x2cea('0x24')](saveUpdates(_0x526e92[_0x2cea('0x49')],null))[_0x2cea('0x24')](respondWithResult(_0x4d1b77,null))[_0x2cea('0x44')](handleError(_0x4d1b77,null));};exports['destroy']=function(_0x4ec462,_0x5d7cb6){return db[_0x2cea('0x3f')][_0x2cea('0x47')]({'where':{'id':_0x4ec462[_0x2cea('0x45')]['id']}})[_0x2cea('0x24')](handleEntityNotFound(_0x5d7cb6,null))[_0x2cea('0x24')](removeEntity(_0x5d7cb6,null))[_0x2cea('0x44')](handleError(_0x5d7cb6,null));};exports[_0x2cea('0x4b')]=function(_0x4d31dc,_0x3f0fd0){return db[_0x2cea('0x3f')][_0x2cea('0x4b')]()['then'](respondWithResult(_0x3f0fd0,null))[_0x2cea('0x44')](handleError(_0x3f0fd0,null));}; \ No newline at end of file +var _0xbefe=['mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','FaxQueueReport','fieldName','key','map','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','type','merge','includeAll','findAll','rows','catch','show','rawAttributes','options','find','create','body','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4ffa03,_0x363a82){var _0x30d661=function(_0x36ba86){while(--_0x36ba86){_0x4ffa03['push'](_0x4ffa03['shift']());}};_0x30d661(++_0x363a82);}(_0xbefe,0x168));var _0xebef=function(_0x1b4f25,_0x387b6c){_0x1b4f25=_0x1b4f25-0x0;var _0x3491f2=_0xbefe[_0x1b4f25];return _0x3491f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebef('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebef('0x1'));var rp=require(_0xebef('0x2'));var moment=require(_0xebef('0x3'));var BPromise=require(_0xebef('0x4'));var Mustache=require(_0xebef('0x5'));var util=require(_0xebef('0x6'));var path=require(_0xebef('0x7'));var sox=require(_0xebef('0x8'));var csv=require('to-csv');var ejs=require(_0xebef('0x9'));var fs=require('fs');var fs_extra=require(_0xebef('0xa'));var _=require(_0xebef('0xb'));var squel=require('squel');var crypto=require(_0xebef('0xc'));var jsforce=require(_0xebef('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xebef('0xe'));var Papa=require(_0xebef('0xf'));var Redis=require(_0xebef('0x10'));var authService=require(_0xebef('0x11'));var qs=require(_0xebef('0x12'));var as=require(_0xebef('0x13'));var hardwareService=require(_0xebef('0x14'));var logger=require(_0xebef('0x15'))('api');var utils=require(_0xebef('0x16'));var config=require(_0xebef('0x17'));var licenseUtil=require(_0xebef('0x18'));var db=require(_0xebef('0x19'))['db'];function respondWithStatusCode(_0x1dcae4,_0x566dbe){_0x566dbe=_0x566dbe||0xcc;return function(_0x584ac2){if(_0x584ac2){return _0x1dcae4['sendStatus'](_0x566dbe);}return _0x1dcae4['status'](_0x566dbe)[_0xebef('0x1a')]();};}function respondWithResult(_0x124634,_0x31772a){_0x31772a=_0x31772a||0xc8;return function(_0x35cd7a){if(_0x35cd7a){return _0x124634[_0xebef('0x1b')](_0x31772a)[_0xebef('0x1c')](_0x35cd7a);}};}function respondWithFilteredResult(_0x5813eb,_0x32ec37){return function(_0x9411d4){if(_0x9411d4){var _0x1921aa=typeof _0x32ec37[_0xebef('0x1d')]===_0xebef('0x1e')&&typeof _0x32ec37[_0xebef('0x1f')]===_0xebef('0x1e');var _0x1e4ddf=_0x9411d4[_0xebef('0x20')];var _0x16856f=_0x1921aa?0x0:_0x32ec37[_0xebef('0x1d')];var _0x5161f1=_0x1921aa?_0x9411d4[_0xebef('0x20')]:_0x32ec37[_0xebef('0x1d')]+_0x32ec37[_0xebef('0x1f')];var _0x502c1e;if(_0x5161f1>=_0x1e4ddf){_0x5161f1=_0x1e4ddf;_0x502c1e=0xc8;}else{_0x502c1e=0xce;}_0x5813eb[_0xebef('0x1b')](_0x502c1e);return _0x5813eb[_0xebef('0x21')](_0xebef('0x22'),_0x16856f+'-'+_0x5161f1+'/'+_0x1e4ddf)[_0xebef('0x1c')](_0x9411d4);}return null;};}function patchUpdates(_0x7ca0cc){return function(_0x138760){try{jsonpatch[_0xebef('0x23')](_0x138760,_0x7ca0cc,!![]);}catch(_0x4cc18e){return BPromise['reject'](_0x4cc18e);}return _0x138760['save']();};}function saveUpdates(_0x59e078,_0x2f1193){return function(_0x38f0b8){if(_0x38f0b8){return _0x38f0b8[_0xebef('0x24')](_0x59e078)[_0xebef('0x25')](function(_0x1ee3b){return _0x1ee3b;});}return null;};}function removeEntity(_0xe8dcbf,_0x5c5091){return function(_0x460104){if(_0x460104){return _0x460104[_0xebef('0x26')]()[_0xebef('0x25')](function(){_0xe8dcbf[_0xebef('0x1b')](0xcc)[_0xebef('0x1a')]();});}};}function handleEntityNotFound(_0x27f212,_0x36ca6b){return function(_0x42d2af){if(!_0x42d2af){_0x27f212[_0xebef('0x27')](0x194);}return _0x42d2af;};}function handleError(_0x2d63a8,_0x456a81){_0x456a81=_0x456a81||0x1f4;return function(_0x4fb77f){logger[_0xebef('0x28')](_0x4fb77f['stack']);if(_0x4fb77f['name']){delete _0x4fb77f['name'];}_0x2d63a8['status'](_0x456a81)['send'](_0x4fb77f);};}exports['index']=function(_0x55732a,_0x5703fc){var _0x506e64={},_0x5a9249={},_0x54001c={'count':0x0,'rows':[]};var _0x136ac3=_['map'](db[_0xebef('0x29')]['rawAttributes'],function(_0x3efbc4){return{'name':_0x3efbc4[_0xebef('0x2a')],'type':_0x3efbc4['type'][_0xebef('0x2b')]};});_0x5a9249['model']=_[_0xebef('0x2c')](_0x136ac3,_0xebef('0x2d'));_0x5a9249[_0xebef('0x2e')]=_[_0xebef('0x2f')](_0x55732a[_0xebef('0x2e')]);_0x5a9249[_0xebef('0x30')]=_['intersection'](_0x5a9249[_0xebef('0x31')],_0x5a9249['query']);_0x506e64[_0xebef('0x32')]=_[_0xebef('0x33')](_0x5a9249[_0xebef('0x31')],qs[_0xebef('0x34')](_0x55732a[_0xebef('0x2e')][_0xebef('0x34')]));_0x506e64[_0xebef('0x32')]=_0x506e64['attributes'][_0xebef('0x35')]?_0x506e64[_0xebef('0x32')]:_0x5a9249[_0xebef('0x31')];if(!_0x55732a[_0xebef('0x2e')][_0xebef('0x36')](_0xebef('0x37'))){_0x506e64[_0xebef('0x1f')]=qs['limit'](_0x55732a[_0xebef('0x2e')][_0xebef('0x1f')]);_0x506e64['offset']=qs[_0xebef('0x1d')](_0x55732a[_0xebef('0x2e')][_0xebef('0x1d')]);}_0x506e64[_0xebef('0x38')]=qs[_0xebef('0x39')](_0x55732a['query'][_0xebef('0x39')]);_0x506e64[_0xebef('0x3a')]=qs['filters'](_['pick'](_0x55732a[_0xebef('0x2e')],_0x5a9249['filters']),_0x136ac3);if(_0x55732a['query']['filter']){_0x506e64[_0xebef('0x3a')]=_['merge'](_0x506e64['where'],{'$or':_[_0xebef('0x2c')](_0x136ac3,function(_0xd9406){if(_0xd9406[_0xebef('0x3b')]!=='VIRTUAL'){var _0x16971a={};_0x16971a[_0xd9406['name']]={'$like':'%'+_0x55732a['query']['filter']+'%'};return _0x16971a;}})});}_0x506e64=_[_0xebef('0x3c')]({},_0x506e64,_0x55732a['options']);var _0x1e7698={'where':_0x506e64['where']};return db['FaxQueueReport'][_0xebef('0x20')](_0x1e7698)[_0xebef('0x25')](function(_0x22703d){_0x54001c[_0xebef('0x20')]=_0x22703d;if(_0x55732a[_0xebef('0x2e')][_0xebef('0x3d')]){_0x506e64['include']=[{'all':!![]}];}return db[_0xebef('0x29')][_0xebef('0x3e')](_0x506e64);})[_0xebef('0x25')](function(_0xdf1921){_0x54001c[_0xebef('0x3f')]=_0xdf1921;return _0x54001c;})[_0xebef('0x25')](respondWithFilteredResult(_0x5703fc,_0x506e64))[_0xebef('0x40')](handleError(_0x5703fc,null));};exports[_0xebef('0x41')]=function(_0xf4b159,_0xa69151){var _0x56fe84={'raw':!![],'where':{'id':_0xf4b159['params']['id']}},_0x5cf908={};_0x5cf908['model']=_[_0xebef('0x2f')](db[_0xebef('0x29')][_0xebef('0x42')]);_0x5cf908[_0xebef('0x2e')]=_[_0xebef('0x2f')](_0xf4b159['query']);_0x5cf908['filters']=_[_0xebef('0x33')](_0x5cf908['model'],_0x5cf908['query']);_0x56fe84[_0xebef('0x32')]=_[_0xebef('0x33')](_0x5cf908[_0xebef('0x31')],qs[_0xebef('0x34')](_0xf4b159[_0xebef('0x2e')][_0xebef('0x34')]));_0x56fe84[_0xebef('0x32')]=_0x56fe84[_0xebef('0x32')][_0xebef('0x35')]?_0x56fe84[_0xebef('0x32')]:_0x5cf908[_0xebef('0x31')];if(_0xf4b159[_0xebef('0x2e')][_0xebef('0x3d')]){_0x56fe84['include']=[{'all':!![]}];}_0x56fe84=_[_0xebef('0x3c')]({},_0x56fe84,_0xf4b159[_0xebef('0x43')]);return db[_0xebef('0x29')][_0xebef('0x44')](_0x56fe84)[_0xebef('0x25')](handleEntityNotFound(_0xa69151,null))[_0xebef('0x25')](respondWithResult(_0xa69151,null))['catch'](handleError(_0xa69151,null));};exports[_0xebef('0x45')]=function(_0x349490,_0x1c7c81){return db['FaxQueueReport']['create'](_0x349490[_0xebef('0x46')],{})['then'](respondWithResult(_0x1c7c81,0xc9))[_0xebef('0x40')](handleError(_0x1c7c81,null));};exports[_0xebef('0x24')]=function(_0x2f22de,_0x1d70e8){if(_0x2f22de[_0xebef('0x46')]['id']){delete _0x2f22de[_0xebef('0x46')]['id'];}return db[_0xebef('0x29')]['find']({'where':{'id':_0x2f22de[_0xebef('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d70e8,null))[_0xebef('0x25')](saveUpdates(_0x2f22de[_0xebef('0x46')],null))[_0xebef('0x25')](respondWithResult(_0x1d70e8,null))[_0xebef('0x40')](handleError(_0x1d70e8,null));};exports['destroy']=function(_0x5f9e80,_0x52f067){return db['FaxQueueReport'][_0xebef('0x44')]({'where':{'id':_0x5f9e80[_0xebef('0x47')]['id']}})[_0xebef('0x25')](handleEntityNotFound(_0x52f067,null))[_0xebef('0x25')](removeEntity(_0x52f067,null))[_0xebef('0x40')](handleError(_0x52f067,null));};exports[_0xebef('0x48')]=function(_0x2b7c09,_0x35a755){return db[_0xebef('0x29')][_0xebef('0x48')]()[_0xebef('0x25')](respondWithResult(_0x35a755,null))[_0xebef('0x40')](handleError(_0x35a755,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 44b6e3f..d1ca9e8 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x2e91dc,_0x2b9015){var _0x3ad4a5=function(_0x365a05){while(--_0x365a05){_0x2e91dc['push'](_0x2e91dc['shift']());}};_0x3ad4a5(++_0x2b9015);}(_0x7a54,0x106));var _0x47a5=function(_0x2183e7,_0x21b3f3){_0x2183e7=_0x2183e7-0x0;var _0x214dcf=_0x7a54[_0x2183e7];return _0x214dcf;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x123088,_0x32a7a8){var _0xfedf22=function(_0xdc652b){while(--_0xdc652b){_0x123088['push'](_0x123088['shift']());}};_0xfedf22(++_0x32a7a8);}(_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 logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 11a427d..7d4b6ff 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 _0xbc81=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','catch','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x858bd8,_0x272e9f){var _0x263940=function(_0x478283){while(--_0x478283){_0x858bd8['push'](_0x858bd8['shift']());}};_0x263940(++_0x272e9f);}(_0xbc81,0x157));var _0x1bc8=function(_0x4733d3,_0x454290){_0x4733d3=_0x4733d3-0x0;var _0x1b9a44=_0xbc81[_0x4733d3];return _0x1b9a44;};'use strict';var _=require(_0x1bc8('0x0'));var util=require(_0x1bc8('0x1'));var moment=require(_0x1bc8('0x2'));var BPromise=require(_0x1bc8('0x3'));var rs=require(_0x1bc8('0x4'));var fs=require('fs');var Redis=require(_0x1bc8('0x5'));var db=require(_0x1bc8('0x6'))['db'];var utils=require(_0x1bc8('0x7'));var logger=require('../../config/logger')(_0x1bc8('0x8'));var config=require(_0x1bc8('0x9'));var jayson=require(_0x1bc8('0xa'));var client=jayson[_0x1bc8('0xb')][_0x1bc8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x313b28,_0x3a0a0c,_0x6ff961){return new BPromise(function(_0x16c3a3,_0x164ada){return client[_0x1bc8('0xd')](_0x313b28,_0x6ff961)['then'](function(_0x3d95ef){logger[_0x1bc8('0xe')](_0x1bc8('0xf'),_0x3a0a0c,'request\x20sent');logger[_0x1bc8('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x3a0a0c,'request\x20sent',JSON[_0x1bc8('0x11')](_0x3d95ef));if(_0x3d95ef[_0x1bc8('0x12')]){if(_0x3d95ef['error'][_0x1bc8('0x13')]===0x1f4){logger[_0x1bc8('0x12')](_0x1bc8('0xf'),_0x3a0a0c,_0x3d95ef[_0x1bc8('0x12')][_0x1bc8('0x14')]);return _0x164ada(_0x3d95ef['error']['message']);}logger[_0x1bc8('0x12')](_0x1bc8('0xf'),_0x3a0a0c,_0x3d95ef[_0x1bc8('0x12')]['message']);return _0x16c3a3(_0x3d95ef[_0x1bc8('0x12')][_0x1bc8('0x14')]);}else{logger[_0x1bc8('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x3a0a0c,'request\x20sent');_0x16c3a3(_0x3d95ef[_0x1bc8('0x15')][_0x1bc8('0x14')]);}})['catch'](function(_0x2356c3){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x3a0a0c,_0x2356c3);_0x164ada(_0x2356c3);});});}exports[_0x1bc8('0x16')]=function(_0x16397e){var _0x4aeb77=this;return new Promise(function(_0x586ea2,_0x55d406){return db[_0x1bc8('0x17')][_0x1bc8('0x18')](_0x16397e[_0x1bc8('0x19')],{'raw':_0x16397e[_0x1bc8('0x1a')]?_0x16397e['options'][_0x1bc8('0x1b')]===undefined?!![]:![]:!![]})[_0x1bc8('0x1c')](function(_0x482dcf){logger['info'](_0x1bc8('0x16'),_0x16397e);logger['debug']('CreateFaxQueueReport',_0x16397e,JSON[_0x1bc8('0x11')](_0x482dcf));_0x586ea2(_0x482dcf);})[_0x1bc8('0x1d')](function(_0x2ef886){logger['error'](_0x1bc8('0x16'),_0x2ef886['message'],_0x16397e);_0x55d406(_0x4aeb77[_0x1bc8('0x12')](0x1f4,_0x2ef886['message']));});});};exports[_0x1bc8('0x1e')]=function(_0x46e86b){var _0x2af4de=this;return new Promise(function(_0x629c1a,_0x3b3a43){return db[_0x1bc8('0x17')][_0x1bc8('0x1f')](_0x46e86b[_0x1bc8('0x19')],{'raw':_0x46e86b[_0x1bc8('0x1a')]?_0x46e86b[_0x1bc8('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46e86b['options']?_0x46e86b[_0x1bc8('0x1a')][_0x1bc8('0x20')]||null:null,'attributes':_0x46e86b[_0x1bc8('0x1a')]?_0x46e86b[_0x1bc8('0x1a')][_0x1bc8('0x21')]||null:null,'limit':_0x46e86b[_0x1bc8('0x1a')]?_0x46e86b['options'][_0x1bc8('0x22')]||null:null})[_0x1bc8('0x1c')](function(_0xe8cbad){logger['info'](_0x1bc8('0x1e'),_0x46e86b);logger[_0x1bc8('0x10')](_0x1bc8('0x1e'),_0x46e86b,JSON[_0x1bc8('0x11')](_0xe8cbad));_0x629c1a(_0xe8cbad);})[_0x1bc8('0x1d')](function(_0x416e79){logger['error'](_0x1bc8('0x1e'),_0x416e79[_0x1bc8('0x14')],_0x46e86b);_0x3b3a43(_0x2af4de[_0x1bc8('0x12')](0x1f4,_0x416e79[_0x1bc8('0x14')]));});});}; \ No newline at end of file +var _0x4366=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','message','FaxQueueReport,\x20%s,\x20%s','result','catch','FaxQueueReport','create','body','options','CreateFaxQueueReport','stringify','update','raw','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x20fb02,_0x96c029){var _0x24a33e=function(_0x4b5c8a){while(--_0x4b5c8a){_0x20fb02['push'](_0x20fb02['shift']());}};_0x24a33e(++_0x96c029);}(_0x4366,0x185));var _0x6436=function(_0x208e67,_0x276ba2){_0x208e67=_0x208e67-0x0;var _0x13cf12=_0x4366[_0x208e67];return _0x13cf12;};'use strict';var _=require(_0x6436('0x0'));var util=require(_0x6436('0x1'));var moment=require(_0x6436('0x2'));var BPromise=require('bluebird');var rs=require(_0x6436('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6436('0x4'))['db'];var utils=require(_0x6436('0x5'));var logger=require('../../config/logger')(_0x6436('0x6'));var config=require(_0x6436('0x7'));var jayson=require(_0x6436('0x8'));var client=jayson[_0x6436('0x9')][_0x6436('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32de80,_0x3f0127,_0x4da957){return new BPromise(function(_0x2e4068,_0x20cea1){return client['request'](_0x32de80,_0x4da957)[_0x6436('0xb')](function(_0x523647){logger[_0x6436('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x3f0127,_0x6436('0xd'));logger[_0x6436('0xe')](_0x6436('0xf'),_0x3f0127,_0x6436('0xd'),JSON['stringify'](_0x523647));if(_0x523647[_0x6436('0x10')]){if(_0x523647[_0x6436('0x10')]['code']===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x3f0127,_0x523647[_0x6436('0x10')][_0x6436('0x11')]);return _0x20cea1(_0x523647[_0x6436('0x10')][_0x6436('0x11')]);}logger[_0x6436('0x10')](_0x6436('0x12'),_0x3f0127,_0x523647[_0x6436('0x10')][_0x6436('0x11')]);return _0x2e4068(_0x523647[_0x6436('0x10')][_0x6436('0x11')]);}else{logger['info'](_0x6436('0x12'),_0x3f0127,_0x6436('0xd'));_0x2e4068(_0x523647[_0x6436('0x13')][_0x6436('0x11')]);}})[_0x6436('0x14')](function(_0x5e5041){logger[_0x6436('0x10')](_0x6436('0x12'),_0x3f0127,_0x5e5041);_0x20cea1(_0x5e5041);});});}exports['CreateFaxQueueReport']=function(_0x889b18){var _0x3417fe=this;return new Promise(function(_0x535a09,_0x7637b){return db[_0x6436('0x15')][_0x6436('0x16')](_0x889b18[_0x6436('0x17')],{'raw':_0x889b18[_0x6436('0x18')]?_0x889b18['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x281542){logger['info'](_0x6436('0x19'),_0x889b18);logger[_0x6436('0xe')](_0x6436('0x19'),_0x889b18,JSON[_0x6436('0x1a')](_0x281542));_0x535a09(_0x281542);})[_0x6436('0x14')](function(_0x302771){logger[_0x6436('0x10')]('CreateFaxQueueReport',_0x302771['message'],_0x889b18);_0x7637b(_0x3417fe[_0x6436('0x10')](0x1f4,_0x302771[_0x6436('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x2ab238){var _0x1df1b3=this;return new Promise(function(_0x5b5d3f,_0x3f5bf1){return db['FaxQueueReport'][_0x6436('0x1b')](_0x2ab238[_0x6436('0x17')],{'raw':_0x2ab238[_0x6436('0x18')]?_0x2ab238['options'][_0x6436('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ab238[_0x6436('0x18')]?_0x2ab238[_0x6436('0x18')][_0x6436('0x1d')]||null:null,'attributes':_0x2ab238['options']?_0x2ab238[_0x6436('0x18')][_0x6436('0x1e')]||null:null,'limit':_0x2ab238[_0x6436('0x18')]?_0x2ab238[_0x6436('0x18')][_0x6436('0x1f')]||null:null})[_0x6436('0xb')](function(_0x131820){logger['info'](_0x6436('0x20'),_0x2ab238);logger[_0x6436('0xe')](_0x6436('0x20'),_0x2ab238,JSON[_0x6436('0x1a')](_0x131820));_0x5b5d3f(_0x131820);})[_0x6436('0x14')](function(_0x459506){logger[_0x6436('0x10')](_0x6436('0x20'),_0x459506[_0x6436('0x11')],_0x2ab238);_0x3f5bf1(_0x1df1b3[_0x6436('0x10')](0x1f4,_0x459506[_0x6436('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index aa31d75..ad379ec 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 _0x9882=['multer','util','connect-timeout','Router','../../components/auth/service','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x43cfed,_0x558e2c){var _0x1fff9f=function(_0x36b3fc){while(--_0x36b3fc){_0x43cfed['push'](_0x43cfed['shift']());}};_0x1fff9f(++_0x558e2c);}(_0x9882,0x6c));var _0x2988=function(_0x2f62e0,_0x5a24e8){_0x2f62e0=_0x2f62e0-0x0;var _0x32926a=_0x9882[_0x2f62e0];return _0x32926a;};'use strict';var multer=require(_0x2988('0x0'));var util=require(_0x2988('0x1'));var path=require('path');var timeout=require(_0x2988('0x2'));var express=require('express');var router=express[_0x2988('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2988('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x2988('0x5')]('/',auth['isAuthenticated'](),controller[_0x2988('0x6')]);router[_0x2988('0x5')](_0x2988('0x7'),auth[_0x2988('0x8')](),controller[_0x2988('0x9')]);router[_0x2988('0x5')](_0x2988('0xa'),auth['isAuthenticated'](),controller[_0x2988('0xb')]);router[_0x2988('0xc')]('/',auth[_0x2988('0x8')](),controller[_0x2988('0xd')]);router[_0x2988('0xe')](_0x2988('0xa'),auth[_0x2988('0x8')](),controller[_0x2988('0xf')]);router['delete']('/:id',auth[_0x2988('0x8')](),controller[_0x2988('0x10')]);module[_0x2988('0x11')]=router; \ No newline at end of file +var _0x0cbd=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x0cbd,0x136));var _0xd0cb=function(_0x28e0ce,_0x2effed){_0x28e0ce=_0x28e0ce-0x0;var _0x3fcf1e=_0x0cbd[_0x28e0ce];return _0x3fcf1e;};'use strict';var multer=require(_0xd0cb('0x0'));var util=require('util');var path=require(_0xd0cb('0x1'));var timeout=require(_0xd0cb('0x2'));var express=require(_0xd0cb('0x3'));var router=express[_0xd0cb('0x4')]();var fs_extra=require(_0xd0cb('0x5'));var auth=require(_0xd0cb('0x6'));var interaction=require(_0xd0cb('0x7'));var config=require(_0xd0cb('0x8'));var controller=require(_0xd0cb('0x9'));router[_0xd0cb('0xa')]('/',auth[_0xd0cb('0xb')](),controller['index']);router['get'](_0xd0cb('0xc'),auth[_0xd0cb('0xb')](),controller[_0xd0cb('0xd')]);router[_0xd0cb('0xa')](_0xd0cb('0xe'),auth['isAuthenticated'](),controller[_0xd0cb('0xf')]);router[_0xd0cb('0x10')]('/',auth['isAuthenticated'](),controller[_0xd0cb('0x11')]);router[_0xd0cb('0x12')](_0xd0cb('0xe'),auth['isAuthenticated'](),controller[_0xd0cb('0x13')]);router[_0xd0cb('0x14')](_0xd0cb('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xd0cb('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index c3d5c45..00e51cc 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x2e1003,_0x3a9dcb){var _0x3a6ded=function(_0x457826){while(--_0x457826){_0x2e1003['push'](_0x2e1003['shift']());}};_0x3a6ded(++_0x3a9dcb);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2e61e0,_0x284dbb){_0x2e61e0=_0x2e61e0-0x0;var _0x1e40c2=_0xf4eb[_0x2e61e0];return _0x1e40c2;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1cf2f1,_0x3fd0b2){_0x1cf2f1=_0x1cf2f1-0x0;var _0x3e02e0=_0x9bde[_0x1cf2f1];return _0x3e02e0;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 5353524..fd9b741 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 _0x259c=['../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x330e77,_0x5118c6){var _0x2095b3=function(_0x1c5dfb){while(--_0x1c5dfb){_0x330e77['push'](_0x330e77['shift']());}};_0x2095b3(++_0x5118c6);}(_0x259c,0xc1));var _0xc259=function(_0x29cfe5,_0x318994){_0x29cfe5=_0x29cfe5-0x0;var _0xed011=_0x259c[_0x29cfe5];return _0xed011;};'use strict';var emlformat=require(_0xc259('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc259('0x1'));var jsonpatch=require(_0xc259('0x2'));var rp=require(_0xc259('0x3'));var moment=require(_0xc259('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc259('0x5'));var util=require('util');var path=require(_0xc259('0x6'));var sox=require(_0xc259('0x7'));var csv=require(_0xc259('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc259('0x9'));var _=require(_0xc259('0xa'));var squel=require(_0xc259('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc259('0xc'));var Redis=require(_0xc259('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc259('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc259('0xf'))(_0xc259('0x10'));var utils=require(_0xc259('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xc259('0x12'));var db=require(_0xc259('0x13'))['db'];function respondWithStatusCode(_0x28dd3e,_0x2f7519){_0x2f7519=_0x2f7519||0xcc;return function(_0x598487){if(_0x598487){return _0x28dd3e['sendStatus'](_0x2f7519);}return _0x28dd3e[_0xc259('0x14')](_0x2f7519)['end']();};}function respondWithResult(_0x12b963,_0x430fad){_0x430fad=_0x430fad||0xc8;return function(_0x33192e){if(_0x33192e){return _0x12b963[_0xc259('0x14')](_0x430fad)[_0xc259('0x15')](_0x33192e);}};}function respondWithFilteredResult(_0xb5f689,_0x46c145){return function(_0x7753cf){if(_0x7753cf){var _0x4d5d0c=typeof _0x46c145['offset']===_0xc259('0x16')&&typeof _0x46c145[_0xc259('0x17')]===_0xc259('0x16');var _0x168931=_0x7753cf['count'];var _0xfec0fc=_0x4d5d0c?0x0:_0x46c145['offset'];var _0x4d5b26=_0x4d5d0c?_0x7753cf['count']:_0x46c145[_0xc259('0x18')]+_0x46c145[_0xc259('0x17')];var _0x2ff6ec;if(_0x4d5b26>=_0x168931){_0x4d5b26=_0x168931;_0x2ff6ec=0xc8;}else{_0x2ff6ec=0xce;}_0xb5f689[_0xc259('0x14')](_0x2ff6ec);return _0xb5f689[_0xc259('0x19')](_0xc259('0x1a'),_0xfec0fc+'-'+_0x4d5b26+'/'+_0x168931)['json'](_0x7753cf);}return null;};}function patchUpdates(_0x17d998){return function(_0x30c368){try{jsonpatch[_0xc259('0x1b')](_0x30c368,_0x17d998,!![]);}catch(_0x5e1be8){return BPromise[_0xc259('0x1c')](_0x5e1be8);}return _0x30c368[_0xc259('0x1d')]();};}function saveUpdates(_0xfc8684,_0x17b863){return function(_0x1a5da5){if(_0x1a5da5){return _0x1a5da5['update'](_0xfc8684)[_0xc259('0x1e')](function(_0x3d76b0){return _0x3d76b0;});}return null;};}function removeEntity(_0x54b146,_0x232d66){return function(_0x4cfe85){if(_0x4cfe85){return _0x4cfe85[_0xc259('0x1f')]()['then'](function(){_0x54b146[_0xc259('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdcf205,_0x5d9990){return function(_0x4b9dba){if(!_0x4b9dba){_0xdcf205[_0xc259('0x20')](0x194);}return _0x4b9dba;};}function handleError(_0x3dee67,_0x42d42f){_0x42d42f=_0x42d42f||0x1f4;return function(_0x2e220e){logger[_0xc259('0x21')](_0x2e220e[_0xc259('0x22')]);if(_0x2e220e[_0xc259('0x23')]){delete _0x2e220e[_0xc259('0x23')];}_0x3dee67[_0xc259('0x14')](_0x42d42f)['send'](_0x2e220e);};}exports[_0xc259('0x24')]=function(_0x5d0c32,_0x2c0540){var _0x2fe9d6={},_0x349a21={},_0x4a534f={'count':0x0,'rows':[]};var _0x31e885=_[_0xc259('0x25')](db[_0xc259('0x26')][_0xc259('0x27')],function(_0x5c5541){return{'name':_0x5c5541[_0xc259('0x28')],'type':_0x5c5541[_0xc259('0x29')]['key']};});_0x349a21[_0xc259('0x2a')]=_['map'](_0x31e885,_0xc259('0x23'));_0x349a21[_0xc259('0x2b')]=_[_0xc259('0x2c')](_0x5d0c32[_0xc259('0x2b')]);_0x349a21[_0xc259('0x2d')]=_[_0xc259('0x2e')](_0x349a21[_0xc259('0x2a')],_0x349a21[_0xc259('0x2b')]);_0x2fe9d6[_0xc259('0x2f')]=_[_0xc259('0x2e')](_0x349a21[_0xc259('0x2a')],qs[_0xc259('0x30')](_0x5d0c32[_0xc259('0x2b')][_0xc259('0x30')]));_0x2fe9d6[_0xc259('0x2f')]=_0x2fe9d6[_0xc259('0x2f')]['length']?_0x2fe9d6[_0xc259('0x2f')]:_0x349a21[_0xc259('0x2a')];if(!_0x5d0c32[_0xc259('0x2b')][_0xc259('0x31')](_0xc259('0x32'))){_0x2fe9d6[_0xc259('0x17')]=qs[_0xc259('0x17')](_0x5d0c32[_0xc259('0x2b')]['limit']);_0x2fe9d6[_0xc259('0x18')]=qs[_0xc259('0x18')](_0x5d0c32[_0xc259('0x2b')][_0xc259('0x18')]);}_0x2fe9d6[_0xc259('0x33')]=qs[_0xc259('0x34')](_0x5d0c32[_0xc259('0x2b')][_0xc259('0x34')]);_0x2fe9d6[_0xc259('0x35')]=qs[_0xc259('0x2d')](_[_0xc259('0x36')](_0x5d0c32[_0xc259('0x2b')],_0x349a21[_0xc259('0x2d')]),_0x31e885);if(_0x5d0c32[_0xc259('0x2b')][_0xc259('0x37')]){_0x2fe9d6['where']=_['merge'](_0x2fe9d6[_0xc259('0x35')],{'$or':_[_0xc259('0x25')](_0x31e885,function(_0x2117c9){if(_0x2117c9[_0xc259('0x29')]!=='VIRTUAL'){var _0x1df01f={};_0x1df01f[_0x2117c9['name']]={'$like':'%'+_0x5d0c32['query']['filter']+'%'};return _0x1df01f;}})});}_0x2fe9d6=_[_0xc259('0x38')]({},_0x2fe9d6,_0x5d0c32['options']);var _0x5a03e6={'where':_0x2fe9d6['where']};return db[_0xc259('0x26')][_0xc259('0x39')](_0x5a03e6)[_0xc259('0x1e')](function(_0x54f43a){_0x4a534f[_0xc259('0x39')]=_0x54f43a;if(_0x5d0c32[_0xc259('0x2b')][_0xc259('0x3a')]){_0x2fe9d6[_0xc259('0x3b')]=[{'all':!![]}];}return db[_0xc259('0x26')][_0xc259('0x3c')](_0x2fe9d6);})[_0xc259('0x1e')](function(_0x5d074b){_0x4a534f[_0xc259('0x3d')]=_0x5d074b;return _0x4a534f;})['then'](respondWithFilteredResult(_0x2c0540,_0x2fe9d6))[_0xc259('0x3e')](handleError(_0x2c0540,null));};exports['show']=function(_0xa9db29,_0x4af100){var _0x5068d9={'raw':!![],'where':{'id':_0xa9db29[_0xc259('0x3f')]['id']}},_0xb60124={};_0xb60124[_0xc259('0x2a')]=_['keys'](db['FaxTransferReport'][_0xc259('0x27')]);_0xb60124[_0xc259('0x2b')]=_[_0xc259('0x2c')](_0xa9db29['query']);_0xb60124['filters']=_[_0xc259('0x2e')](_0xb60124['model'],_0xb60124[_0xc259('0x2b')]);_0x5068d9['attributes']=_[_0xc259('0x2e')](_0xb60124['model'],qs['fields'](_0xa9db29[_0xc259('0x2b')][_0xc259('0x30')]));_0x5068d9['attributes']=_0x5068d9[_0xc259('0x2f')][_0xc259('0x40')]?_0x5068d9[_0xc259('0x2f')]:_0xb60124[_0xc259('0x2a')];if(_0xa9db29['query'][_0xc259('0x3a')]){_0x5068d9[_0xc259('0x3b')]=[{'all':!![]}];}_0x5068d9=_[_0xc259('0x38')]({},_0x5068d9,_0xa9db29['options']);return db[_0xc259('0x26')][_0xc259('0x41')](_0x5068d9)['then'](handleEntityNotFound(_0x4af100,null))[_0xc259('0x1e')](respondWithResult(_0x4af100,null))[_0xc259('0x3e')](handleError(_0x4af100,null));};exports[_0xc259('0x42')]=function(_0x1b8706,_0x11f4e6){return db['FaxTransferReport'][_0xc259('0x42')](_0x1b8706[_0xc259('0x43')],{})['then'](respondWithResult(_0x11f4e6,0xc9))[_0xc259('0x3e')](handleError(_0x11f4e6,null));};exports[_0xc259('0x44')]=function(_0x1ad1e6,_0x342119){if(_0x1ad1e6[_0xc259('0x43')]['id']){delete _0x1ad1e6[_0xc259('0x43')]['id'];}return db['FaxTransferReport'][_0xc259('0x41')]({'where':{'id':_0x1ad1e6[_0xc259('0x3f')]['id']}})['then'](handleEntityNotFound(_0x342119,null))[_0xc259('0x1e')](saveUpdates(_0x1ad1e6['body'],null))[_0xc259('0x1e')](respondWithResult(_0x342119,null))['catch'](handleError(_0x342119,null));};exports[_0xc259('0x1f')]=function(_0x8d0039,_0x2c3f8c){return db[_0xc259('0x26')][_0xc259('0x41')]({'where':{'id':_0x8d0039[_0xc259('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2c3f8c,null))[_0xc259('0x1e')](removeEntity(_0x2c3f8c,null))['catch'](handleError(_0x2c3f8c,null));};exports[_0xc259('0x45')]=function(_0x43ee7c,_0x1805d0){return db[_0xc259('0x26')]['describe']()[_0xc259('0x1e')](respondWithResult(_0x1805d0,null))['catch'](handleError(_0x1805d0,null));}; \ No newline at end of file +var _0xd622=['find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','FaxTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length'];(function(_0x40542f,_0x9c86f7){var _0x3b961f=function(_0x25c185){while(--_0x25c185){_0x40542f['push'](_0x40542f['shift']());}};_0x3b961f(++_0x9c86f7);}(_0xd622,0x124));var _0x2d62=function(_0x2fc661,_0x409b70){_0x2fc661=_0x2fc661-0x0;var _0x2d435f=_0xd622[_0x2fc661];return _0x2d435f;};'use strict';var emlformat=require(_0x2d62('0x0'));var rimraf=require(_0x2d62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d62('0x2'));var rp=require(_0x2d62('0x3'));var moment=require(_0x2d62('0x4'));var BPromise=require(_0x2d62('0x5'));var Mustache=require(_0x2d62('0x6'));var util=require(_0x2d62('0x7'));var path=require('path');var sox=require(_0x2d62('0x8'));var csv=require(_0x2d62('0x9'));var ejs=require(_0x2d62('0xa'));var fs=require('fs');var fs_extra=require(_0x2d62('0xb'));var _=require(_0x2d62('0xc'));var squel=require(_0x2d62('0xd'));var crypto=require(_0x2d62('0xe'));var jsforce=require(_0x2d62('0xf'));var deskjs=require(_0x2d62('0x10'));var toCsv=require(_0x2d62('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2d62('0x11'));var as=require(_0x2d62('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d62('0x13'))(_0x2d62('0x14'));var utils=require(_0x2d62('0x15'));var config=require(_0x2d62('0x16'));var licenseUtil=require(_0x2d62('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d4691,_0x5ac943){_0x5ac943=_0x5ac943||0xcc;return function(_0x12255a){if(_0x12255a){return _0x2d4691['sendStatus'](_0x5ac943);}return _0x2d4691[_0x2d62('0x18')](_0x5ac943)[_0x2d62('0x19')]();};}function respondWithResult(_0x30f63e,_0x318852){_0x318852=_0x318852||0xc8;return function(_0x3a8950){if(_0x3a8950){return _0x30f63e[_0x2d62('0x18')](_0x318852)[_0x2d62('0x1a')](_0x3a8950);}};}function respondWithFilteredResult(_0x5c049a,_0x2ca6ab){return function(_0x1a4610){if(_0x1a4610){var _0x418f4b=typeof _0x2ca6ab['offset']==='undefined'&&typeof _0x2ca6ab['limit']===_0x2d62('0x1b');var _0xcb4b10=_0x1a4610[_0x2d62('0x1c')];var _0x2e6ac6=_0x418f4b?0x0:_0x2ca6ab['offset'];var _0x5f43cc=_0x418f4b?_0x1a4610[_0x2d62('0x1c')]:_0x2ca6ab[_0x2d62('0x1d')]+_0x2ca6ab[_0x2d62('0x1e')];var _0x1e7901;if(_0x5f43cc>=_0xcb4b10){_0x5f43cc=_0xcb4b10;_0x1e7901=0xc8;}else{_0x1e7901=0xce;}_0x5c049a[_0x2d62('0x18')](_0x1e7901);return _0x5c049a['set'](_0x2d62('0x1f'),_0x2e6ac6+'-'+_0x5f43cc+'/'+_0xcb4b10)[_0x2d62('0x1a')](_0x1a4610);}return null;};}function patchUpdates(_0x363a4b){return function(_0x19f08c){try{jsonpatch[_0x2d62('0x20')](_0x19f08c,_0x363a4b,!![]);}catch(_0x512edf){return BPromise[_0x2d62('0x21')](_0x512edf);}return _0x19f08c[_0x2d62('0x22')]();};}function saveUpdates(_0x3efea2,_0x405845){return function(_0x1ff64b){if(_0x1ff64b){return _0x1ff64b[_0x2d62('0x23')](_0x3efea2)[_0x2d62('0x24')](function(_0x5172fd){return _0x5172fd;});}return null;};}function removeEntity(_0xce1f7a,_0x73dffb){return function(_0xd0f252){if(_0xd0f252){return _0xd0f252['destroy']()[_0x2d62('0x24')](function(){_0xce1f7a[_0x2d62('0x18')](0xcc)[_0x2d62('0x19')]();});}};}function handleEntityNotFound(_0x273c42,_0x2ba5d4){return function(_0x2f1f88){if(!_0x2f1f88){_0x273c42['sendStatus'](0x194);}return _0x2f1f88;};}function handleError(_0x12e263,_0x104f76){_0x104f76=_0x104f76||0x1f4;return function(_0x2c1fa5){logger[_0x2d62('0x25')](_0x2c1fa5[_0x2d62('0x26')]);if(_0x2c1fa5[_0x2d62('0x27')]){delete _0x2c1fa5[_0x2d62('0x27')];}_0x12e263[_0x2d62('0x18')](_0x104f76)['send'](_0x2c1fa5);};}exports[_0x2d62('0x28')]=function(_0x555b1a,_0x506b1b){var _0x20eb23={},_0x1b815f={},_0x20902c={'count':0x0,'rows':[]};var _0x586133=_[_0x2d62('0x29')](db[_0x2d62('0x2a')]['rawAttributes'],function(_0x15988a){return{'name':_0x15988a[_0x2d62('0x2b')],'type':_0x15988a[_0x2d62('0x2c')][_0x2d62('0x2d')]};});_0x1b815f[_0x2d62('0x2e')]=_[_0x2d62('0x29')](_0x586133,_0x2d62('0x27'));_0x1b815f[_0x2d62('0x2f')]=_[_0x2d62('0x30')](_0x555b1a[_0x2d62('0x2f')]);_0x1b815f[_0x2d62('0x31')]=_[_0x2d62('0x32')](_0x1b815f[_0x2d62('0x2e')],_0x1b815f['query']);_0x20eb23[_0x2d62('0x33')]=_[_0x2d62('0x32')](_0x1b815f[_0x2d62('0x2e')],qs[_0x2d62('0x34')](_0x555b1a[_0x2d62('0x2f')]['fields']));_0x20eb23[_0x2d62('0x33')]=_0x20eb23[_0x2d62('0x33')]['length']?_0x20eb23[_0x2d62('0x33')]:_0x1b815f['model'];if(!_0x555b1a[_0x2d62('0x2f')][_0x2d62('0x35')](_0x2d62('0x36'))){_0x20eb23[_0x2d62('0x1e')]=qs[_0x2d62('0x1e')](_0x555b1a[_0x2d62('0x2f')][_0x2d62('0x1e')]);_0x20eb23[_0x2d62('0x1d')]=qs[_0x2d62('0x1d')](_0x555b1a[_0x2d62('0x2f')]['offset']);}_0x20eb23['order']=qs[_0x2d62('0x37')](_0x555b1a[_0x2d62('0x2f')][_0x2d62('0x37')]);_0x20eb23[_0x2d62('0x38')]=qs['filters'](_['pick'](_0x555b1a[_0x2d62('0x2f')],_0x1b815f[_0x2d62('0x31')]),_0x586133);if(_0x555b1a[_0x2d62('0x2f')][_0x2d62('0x39')]){_0x20eb23[_0x2d62('0x38')]=_[_0x2d62('0x3a')](_0x20eb23[_0x2d62('0x38')],{'$or':_[_0x2d62('0x29')](_0x586133,function(_0x165e77){if(_0x165e77['type']!=='VIRTUAL'){var _0x1db58e={};_0x1db58e[_0x165e77[_0x2d62('0x27')]]={'$like':'%'+_0x555b1a[_0x2d62('0x2f')][_0x2d62('0x39')]+'%'};return _0x1db58e;}})});}_0x20eb23=_['merge']({},_0x20eb23,_0x555b1a[_0x2d62('0x3b')]);var _0x4f803c={'where':_0x20eb23[_0x2d62('0x38')]};return db[_0x2d62('0x2a')][_0x2d62('0x1c')](_0x4f803c)[_0x2d62('0x24')](function(_0x4fc7cf){_0x20902c[_0x2d62('0x1c')]=_0x4fc7cf;if(_0x555b1a[_0x2d62('0x2f')][_0x2d62('0x3c')]){_0x20eb23[_0x2d62('0x3d')]=[{'all':!![]}];}return db[_0x2d62('0x2a')][_0x2d62('0x3e')](_0x20eb23);})['then'](function(_0x44b733){_0x20902c[_0x2d62('0x3f')]=_0x44b733;return _0x20902c;})[_0x2d62('0x24')](respondWithFilteredResult(_0x506b1b,_0x20eb23))[_0x2d62('0x40')](handleError(_0x506b1b,null));};exports[_0x2d62('0x41')]=function(_0x16c947,_0x2a6541){var _0x25ed8e={'raw':!![],'where':{'id':_0x16c947[_0x2d62('0x42')]['id']}},_0xa164db={};_0xa164db['model']=_[_0x2d62('0x30')](db[_0x2d62('0x2a')]['rawAttributes']);_0xa164db[_0x2d62('0x2f')]=_['keys'](_0x16c947[_0x2d62('0x2f')]);_0xa164db['filters']=_[_0x2d62('0x32')](_0xa164db['model'],_0xa164db[_0x2d62('0x2f')]);_0x25ed8e['attributes']=_[_0x2d62('0x32')](_0xa164db['model'],qs[_0x2d62('0x34')](_0x16c947['query'][_0x2d62('0x34')]));_0x25ed8e[_0x2d62('0x33')]=_0x25ed8e['attributes'][_0x2d62('0x43')]?_0x25ed8e['attributes']:_0xa164db[_0x2d62('0x2e')];if(_0x16c947[_0x2d62('0x2f')][_0x2d62('0x3c')]){_0x25ed8e['include']=[{'all':!![]}];}_0x25ed8e=_[_0x2d62('0x3a')]({},_0x25ed8e,_0x16c947[_0x2d62('0x3b')]);return db['FaxTransferReport'][_0x2d62('0x44')](_0x25ed8e)[_0x2d62('0x24')](handleEntityNotFound(_0x2a6541,null))['then'](respondWithResult(_0x2a6541,null))[_0x2d62('0x40')](handleError(_0x2a6541,null));};exports['create']=function(_0x185f1a,_0x126ea3){return db[_0x2d62('0x2a')][_0x2d62('0x45')](_0x185f1a[_0x2d62('0x46')],{})[_0x2d62('0x24')](respondWithResult(_0x126ea3,0xc9))[_0x2d62('0x40')](handleError(_0x126ea3,null));};exports[_0x2d62('0x23')]=function(_0x282ae0,_0x455dc9){if(_0x282ae0['body']['id']){delete _0x282ae0[_0x2d62('0x46')]['id'];}return db['FaxTransferReport'][_0x2d62('0x44')]({'where':{'id':_0x282ae0[_0x2d62('0x42')]['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x455dc9,null))[_0x2d62('0x24')](saveUpdates(_0x282ae0['body'],null))[_0x2d62('0x24')](respondWithResult(_0x455dc9,null))[_0x2d62('0x40')](handleError(_0x455dc9,null));};exports['destroy']=function(_0x2ab0f3,_0x58a99f){return db[_0x2d62('0x2a')][_0x2d62('0x44')]({'where':{'id':_0x2ab0f3[_0x2d62('0x42')]['id']}})[_0x2d62('0x24')](handleEntityNotFound(_0x58a99f,null))[_0x2d62('0x24')](removeEntity(_0x58a99f,null))[_0x2d62('0x40')](handleError(_0x58a99f,null));};exports['describe']=function(_0x5df5a1,_0x3052ea){return db[_0x2d62('0x2a')][_0x2d62('0x47')]()[_0x2d62('0x24')](respondWithResult(_0x3052ea,null))[_0x2d62('0x40')](handleError(_0x3052ea,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index b06dddb..ec001a4 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 _0xc933=['api','moment','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','FaxTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x28c3a5,_0x252a22){var _0x5c6985=function(_0x174900){while(--_0x174900){_0x28c3a5['push'](_0x28c3a5['shift']());}};_0x5c6985(++_0x252a22);}(_0xc933,0xf9));var _0x3c93=function(_0x261a0a,_0x504411){_0x261a0a=_0x261a0a-0x0;var _0x31e93e=_0xc933[_0x261a0a];return _0x31e93e;};'use strict';var _=require(_0x3c93('0x0'));var util=require(_0x3c93('0x1'));var logger=require(_0x3c93('0x2'))(_0x3c93('0x3'));var moment=require(_0x3c93('0x4'));var BPromise=require('bluebird');var rp=require(_0x3c93('0x5'));var fs=require('fs');var path=require(_0x3c93('0x6'));var rimraf=require(_0x3c93('0x7'));var config=require(_0x3c93('0x8'));var attributes=require(_0x3c93('0x9'));module['exports']=function(_0x1f2667,_0x19939f){return _0x1f2667['define'](_0x3c93('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x3c93('0xb'),'fields':[_0x3c93('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xefdf=['moment','bluebird','path','rimraf','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api'];(function(_0x1aee8a,_0x50b1df){var _0x51f53c=function(_0x5aed5b){while(--_0x5aed5b){_0x1aee8a['push'](_0x1aee8a['shift']());}};_0x51f53c(++_0x50b1df);}(_0xefdf,0x129));var _0xfefd=function(_0x50ac27,_0x1306e3){_0x50ac27=_0x50ac27-0x0;var _0x45f86a=_0xefdf[_0x50ac27];return _0x45f86a;};'use strict';var _=require('lodash');var util=require(_0xfefd('0x0'));var logger=require(_0xfefd('0x1'))(_0xfefd('0x2'));var moment=require(_0xfefd('0x3'));var BPromise=require(_0xfefd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfefd('0x5'));var rimraf=require(_0xfefd('0x6'));var config=require('../../config/environment');var attributes=require(_0xfefd('0x7'));module['exports']=function(_0x952e03,_0x55a4ae){return _0x952e03[_0xfefd('0x8')](_0xfefd('0x9'),attributes,{'tableName':_0xfefd('0xa'),'paranoid':![],'indexes':[{'name':_0xfefd('0xb'),'fields':[_0xfefd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 567fc05..5a50bdf 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 _0xdd51=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5b0d8c,_0x11f3c2){var _0x5050df=function(_0x1ff14f){while(--_0x1ff14f){_0x5b0d8c['push'](_0x5b0d8c['shift']());}};_0x5050df(++_0x11f3c2);}(_0xdd51,0xc1));var _0x1dd5=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xdd51[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x1dd5('0x0'));var util=require(_0x1dd5('0x1'));var moment=require(_0x1dd5('0x2'));var BPromise=require(_0x1dd5('0x3'));var rs=require(_0x1dd5('0x4'));var fs=require('fs');var Redis=require(_0x1dd5('0x5'));var db=require(_0x1dd5('0x6'))['db'];var utils=require(_0x1dd5('0x7'));var logger=require(_0x1dd5('0x8'))(_0x1dd5('0x9'));var config=require(_0x1dd5('0xa'));var jayson=require(_0x1dd5('0xb'));var client=jayson[_0x1dd5('0xc')][_0x1dd5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5e0759,_0x4243ca,_0x5a3d6a){return new BPromise(function(_0x2746c2,_0x4ea819){return client[_0x1dd5('0xe')](_0x5e0759,_0x5a3d6a)['then'](function(_0x555b5b){logger[_0x1dd5('0xf')](_0x1dd5('0x10'),_0x4243ca,_0x1dd5('0x11'));logger[_0x1dd5('0x12')](_0x1dd5('0x13'),_0x4243ca,'request\x20sent',JSON['stringify'](_0x555b5b));if(_0x555b5b['error']){if(_0x555b5b[_0x1dd5('0x14')][_0x1dd5('0x15')]===0x1f4){logger[_0x1dd5('0x14')](_0x1dd5('0x10'),_0x4243ca,_0x555b5b[_0x1dd5('0x14')][_0x1dd5('0x16')]);return _0x4ea819(_0x555b5b['error'][_0x1dd5('0x16')]);}logger[_0x1dd5('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x4243ca,_0x555b5b[_0x1dd5('0x14')][_0x1dd5('0x16')]);return _0x2746c2(_0x555b5b[_0x1dd5('0x14')][_0x1dd5('0x16')]);}else{logger['info'](_0x1dd5('0x10'),_0x4243ca,_0x1dd5('0x11'));_0x2746c2(_0x555b5b[_0x1dd5('0x17')][_0x1dd5('0x16')]);}})['catch'](function(_0x3bf5cd){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x4243ca,_0x3bf5cd);_0x4ea819(_0x3bf5cd);});});} \ No newline at end of file +var _0xe37f=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','FaxTransferReport,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xe37f,0x1dd));var _0xfe37=function(_0x4c3070,_0xc2fb4c){_0x4c3070=_0x4c3070-0x0;var _0x536a44=_0xe37f[_0x4c3070];return _0x536a44;};'use strict';var _=require('lodash');var util=require(_0xfe37('0x0'));var moment=require('moment');var BPromise=require(_0xfe37('0x1'));var rs=require(_0xfe37('0x2'));var fs=require('fs');var Redis=require(_0xfe37('0x3'));var db=require(_0xfe37('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe37('0x5'))(_0xfe37('0x6'));var config=require(_0xfe37('0x7'));var jayson=require(_0xfe37('0x8'));var client=jayson[_0xfe37('0x9')][_0xfe37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3494f5,_0x420a77,_0x7afb57){return new BPromise(function(_0x5811cf,_0x5598a3){return client[_0xfe37('0xb')](_0x3494f5,_0x7afb57)['then'](function(_0x260d7e){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x420a77,_0xfe37('0xc'));logger[_0xfe37('0xd')](_0xfe37('0xe'),_0x420a77,_0xfe37('0xc'),JSON['stringify'](_0x260d7e));if(_0x260d7e[_0xfe37('0xf')]){if(_0x260d7e[_0xfe37('0xf')]['code']===0x1f4){logger[_0xfe37('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x420a77,_0x260d7e[_0xfe37('0xf')][_0xfe37('0x10')]);return _0x5598a3(_0x260d7e[_0xfe37('0xf')]['message']);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x420a77,_0x260d7e[_0xfe37('0xf')]['message']);return _0x5811cf(_0x260d7e['error'][_0xfe37('0x10')]);}else{logger[_0xfe37('0x11')](_0xfe37('0x12'),_0x420a77,_0xfe37('0xc'));_0x5811cf(_0x260d7e[_0xfe37('0x13')][_0xfe37('0x10')]);}})[_0xfe37('0x14')](function(_0x1e0f7f){logger[_0xfe37('0xf')](_0xfe37('0x12'),_0x420a77,_0x1e0f7f);_0x5598a3(_0x1e0f7f);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 645bc63..dcc0446 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 _0xb7e9=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','delete','destroy'];(function(_0x38334c,_0x3b34d4){var _0x36f190=function(_0x4bd57f){while(--_0x4bd57f){_0x38334c['push'](_0x38334c['shift']());}};_0x36f190(++_0x3b34d4);}(_0xb7e9,0xa9));var _0x9b7e=function(_0x26bb15,_0x39b070){_0x26bb15=_0x26bb15-0x0;var _0x7aa58a=_0xb7e9[_0x26bb15];return _0x7aa58a;};'use strict';var multer=require(_0x9b7e('0x0'));var util=require(_0x9b7e('0x1'));var path=require(_0x9b7e('0x2'));var timeout=require(_0x9b7e('0x3'));var express=require(_0x9b7e('0x4'));var router=express[_0x9b7e('0x5')]();var fs_extra=require(_0x9b7e('0x6'));var auth=require(_0x9b7e('0x7'));var interaction=require(_0x9b7e('0x8'));var config=require(_0x9b7e('0x9'));var controller=require(_0x9b7e('0xa'));router[_0x9b7e('0xb')]('/',auth['isAuthenticated'](),controller[_0x9b7e('0xc')]);router[_0x9b7e('0xb')](_0x9b7e('0xd'),auth[_0x9b7e('0xe')](),controller[_0x9b7e('0xf')]);router['get'](_0x9b7e('0x10'),auth[_0x9b7e('0xe')](),controller['show']);router[_0x9b7e('0x11')]('/',auth[_0x9b7e('0xe')](),controller['create']);router['put'](_0x9b7e('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x9b7e('0x12')](_0x9b7e('0x10'),auth[_0x9b7e('0xe')](),controller[_0x9b7e('0x13')]);module[_0x9b7e('0x14')]=router; \ No newline at end of file +var _0x27f0=['multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','destroy'];(function(_0x48fdb2,_0x3b0f10){var _0x23b8b7=function(_0x52ab69){while(--_0x52ab69){_0x48fdb2['push'](_0x48fdb2['shift']());}};_0x23b8b7(++_0x3b0f10);}(_0x27f0,0xd1));var _0x027f=function(_0x2dbcef,_0x1cfecb){_0x2dbcef=_0x2dbcef-0x0;var _0x5a90ea=_0x27f0[_0x2dbcef];return _0x5a90ea;};'use strict';var multer=require(_0x027f('0x0'));var util=require(_0x027f('0x1'));var path=require('path');var timeout=require(_0x027f('0x2'));var express=require(_0x027f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x027f('0x4'));var interaction=require(_0x027f('0x5'));var config=require(_0x027f('0x6'));var controller=require(_0x027f('0x7'));router[_0x027f('0x8')]('/',auth[_0x027f('0x9')](),controller[_0x027f('0xa')]);router[_0x027f('0x8')](_0x027f('0xb'),auth[_0x027f('0x9')](),controller[_0x027f('0xc')]);router['get'](_0x027f('0xd'),auth[_0x027f('0x9')](),controller[_0x027f('0xe')]);router[_0x027f('0xf')]('/',auth['isAuthenticated'](),controller[_0x027f('0x10')]);router['put']('/:id',auth[_0x027f('0x9')](),controller[_0x027f('0x11')]);router['delete'](_0x027f('0xd'),auth[_0x027f('0x9')](),controller[_0x027f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 91731af..52a6afa 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 _0x98ef=['getFields','post','create','addConfiguration','update','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x3799ba,_0x1a8fa5){var _0x16cd36=function(_0x55e168){while(--_0x55e168){_0x3799ba['push'](_0x3799ba['shift']());}};_0x16cd36(++_0x1a8fa5);}(_0x98ef,0xf8));var _0xf98e=function(_0x58b4b5,_0x5cd093){_0x58b4b5=_0x58b4b5-0x0;var _0x261db6=_0x98ef[_0x58b4b5];return _0x261db6;};'use strict';var multer=require(_0xf98e('0x0'));var util=require(_0xf98e('0x1'));var path=require('path');var timeout=require(_0xf98e('0x2'));var express=require('express');var router=express[_0xf98e('0x3')]();var fs_extra=require(_0xf98e('0x4'));var auth=require(_0xf98e('0x5'));var interaction=require(_0xf98e('0x6'));var config=require('../../config/environment');var controller=require(_0xf98e('0x7'));router['get']('/',auth[_0xf98e('0x8')](),controller[_0xf98e('0x9')]);router['get'](_0xf98e('0xa'),auth[_0xf98e('0x8')](),controller[_0xf98e('0xb')]);router[_0xf98e('0xc')](_0xf98e('0xd'),auth[_0xf98e('0x8')](),controller[_0xf98e('0xe')]);router['get'](_0xf98e('0xf'),auth[_0xf98e('0x8')](),controller[_0xf98e('0x10')]);router[_0xf98e('0x11')]('/',auth[_0xf98e('0x8')](),controller[_0xf98e('0x12')]);router[_0xf98e('0x11')]('/:id/configurations',auth[_0xf98e('0x8')](),controller[_0xf98e('0x13')]);router['put'](_0xf98e('0xa'),auth[_0xf98e('0x8')](),controller[_0xf98e('0x14')]);router['delete']('/:id',auth[_0xf98e('0x8')](),controller['destroy']);module[_0xf98e('0x15')]=router; \ No newline at end of file +var _0xe02a=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','delete'];(function(_0x1a7e89,_0x86bb7e){var _0xc8ebc4=function(_0x3ed474){while(--_0x3ed474){_0x1a7e89['push'](_0x1a7e89['shift']());}};_0xc8ebc4(++_0x86bb7e);}(_0xe02a,0xb9));var _0xae02=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe02a[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xae02('0x0'));var util=require(_0xae02('0x1'));var path=require(_0xae02('0x2'));var timeout=require(_0xae02('0x3'));var express=require(_0xae02('0x4'));var router=express[_0xae02('0x5')]();var fs_extra=require(_0xae02('0x6'));var auth=require(_0xae02('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xae02('0x8'));var controller=require(_0xae02('0x9'));router[_0xae02('0xa')]('/',auth[_0xae02('0xb')](),controller[_0xae02('0xc')]);router[_0xae02('0xa')](_0xae02('0xd'),auth[_0xae02('0xb')](),controller['show']);router[_0xae02('0xa')](_0xae02('0xe'),auth['isAuthenticated'](),controller[_0xae02('0xf')]);router[_0xae02('0xa')](_0xae02('0x10'),auth[_0xae02('0xb')](),controller[_0xae02('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xae02('0x12')]);router['post'](_0xae02('0xe'),auth[_0xae02('0xb')](),controller[_0xae02('0x13')]);router[_0xae02('0x14')]('/:id',auth[_0xae02('0xb')](),controller['update']);router[_0xae02('0x15')](_0xae02('0xd'),auth[_0xae02('0xb')](),controller['destroy']);module[_0xae02('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index efe1867..f26641c 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 _0xc9b1=['ENUM','basic','newTab','integrationTab','sequelize','exports','STRING'];(function(_0x2fb73f,_0x41bd3c){var _0x315940=function(_0x1c1ebf){while(--_0x1c1ebf){_0x2fb73f['push'](_0x2fb73f['shift']());}};_0x315940(++_0x41bd3c);}(_0xc9b1,0x13f));var _0x1c9b=function(_0xffa726,_0x4c1e74){_0xffa726=_0xffa726-0x0;var _0x3cb536=_0xc9b1[_0xffa726];return _0x3cb536;};'use strict';var Sequelize=require(_0x1c9b('0x0'));module[_0x1c9b('0x1')]={'name':{'type':Sequelize[_0x1c9b('0x2')]},'description':{'type':Sequelize[_0x1c9b('0x2')]},'username':{'type':Sequelize[_0x1c9b('0x2')]},'remoteUri':{'type':Sequelize[_0x1c9b('0x2')]},'authType':{'type':Sequelize[_0x1c9b('0x3')]('basic'),'defaultValue':_0x1c9b('0x4')},'password':{'type':Sequelize[_0x1c9b('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x1c9b('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x1c9b('0x2')]},'serverUrl':{'type':Sequelize[_0x1c9b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1c9b('0x3')]('integrationTab',_0x1c9b('0x5')),'defaultValue':_0x1c9b('0x6')}}; \ No newline at end of file +var _0xd83e=['basic','integrationTab','newTab','sequelize','STRING'];(function(_0x240eee,_0x249118){var _0x411632=function(_0x99d99f){while(--_0x99d99f){_0x240eee['push'](_0x240eee['shift']());}};_0x411632(++_0x249118);}(_0xd83e,0x152));var _0xed83=function(_0x4a1854,_0x392527){_0x4a1854=_0x4a1854-0x0;var _0x198b47=_0xd83e[_0x4a1854];return _0x198b47;};'use strict';var Sequelize=require(_0xed83('0x0'));module['exports']={'name':{'type':Sequelize[_0xed83('0x1')]},'description':{'type':Sequelize[_0xed83('0x1')]},'username':{'type':Sequelize[_0xed83('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xed83('0x2')),'defaultValue':_0xed83('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xed83('0x1')]},'consumerSecret':{'type':Sequelize[_0xed83('0x1')]},'token':{'type':Sequelize[_0xed83('0x1')]},'tokenSecret':{'type':Sequelize[_0xed83('0x1')]},'serverUrl':{'type':Sequelize[_0xed83('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xed83('0x3'),_0xed83('0x4')),'defaultValue':_0xed83('0x3')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 26ff4e0..fb63397 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 _0xe077=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','stack','name','send','index','map','DeskAccount','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','rawAttributes','find','catch','create','body','update','params','getConfigurations','DeskConfiguration','pick','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','application/json','authType','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','_embedded','entries','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring'];(function(_0x5df61d,_0x158640){var _0x24cc4c=function(_0x2de006){while(--_0x2de006){_0x5df61d['push'](_0x5df61d['shift']());}};_0x24cc4c(++_0x158640);}(_0xe077,0x14b));var _0x7e07=function(_0x8503e0,_0x38132a){_0x8503e0=_0x8503e0-0x0;var _0x433237=_0xe077[_0x8503e0];return _0x433237;};'use strict';var emlformat=require(_0x7e07('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7e07('0x1'));var rp=require(_0x7e07('0x2'));var moment=require(_0x7e07('0x3'));var BPromise=require(_0x7e07('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7e07('0x5'));var sox=require(_0x7e07('0x6'));var csv=require('to-csv');var ejs=require(_0x7e07('0x7'));var fs=require('fs');var fs_extra=require(_0x7e07('0x8'));var _=require('lodash');var squel=require(_0x7e07('0x9'));var crypto=require(_0x7e07('0xa'));var jsforce=require(_0x7e07('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7e07('0xc'));var querystring=require(_0x7e07('0xd'));var Papa=require(_0x7e07('0xe'));var Redis=require('ioredis');var authService=require(_0x7e07('0xf'));var qs=require(_0x7e07('0x10'));var as=require(_0x7e07('0x11'));var hardwareService=require(_0x7e07('0x12'));var logger=require(_0x7e07('0x13'))(_0x7e07('0x14'));var utils=require(_0x7e07('0x15'));var config=require(_0x7e07('0x16'));var licenseUtil=require(_0x7e07('0x17'));var db=require(_0x7e07('0x18'))['db'];var integrations=require(_0x7e07('0x19'));function respondWithStatusCode(_0x2c529a,_0x5235e9){_0x5235e9=_0x5235e9||0xcc;return function(_0x2ba976){if(_0x2ba976){return _0x2c529a[_0x7e07('0x1a')](_0x5235e9);}return _0x2c529a[_0x7e07('0x1b')](_0x5235e9)[_0x7e07('0x1c')]();};}function respondWithResult(_0x333fb6,_0x4eaf4b){_0x4eaf4b=_0x4eaf4b||0xc8;return function(_0x1d1571){if(_0x1d1571){return _0x333fb6[_0x7e07('0x1b')](_0x4eaf4b)[_0x7e07('0x1d')](_0x1d1571);}};}function respondWithFilteredResult(_0x49e917,_0x4f5d17){return function(_0x2f7cf5){if(_0x2f7cf5){var _0x1dcf55=typeof _0x4f5d17[_0x7e07('0x1e')]===_0x7e07('0x1f')&&typeof _0x4f5d17[_0x7e07('0x20')]==='undefined';var _0x353c9a=_0x2f7cf5[_0x7e07('0x21')];var _0x133ae3=_0x1dcf55?0x0:_0x4f5d17['offset'];var _0x254f47=_0x1dcf55?_0x2f7cf5[_0x7e07('0x21')]:_0x4f5d17[_0x7e07('0x1e')]+_0x4f5d17['limit'];var _0x315a6a;if(_0x254f47>=_0x353c9a){_0x254f47=_0x353c9a;_0x315a6a=0xc8;}else{_0x315a6a=0xce;}_0x49e917['status'](_0x315a6a);return _0x49e917[_0x7e07('0x22')](_0x7e07('0x23'),_0x133ae3+'-'+_0x254f47+'/'+_0x353c9a)[_0x7e07('0x1d')](_0x2f7cf5);}return null;};}function patchUpdates(_0x5eb8b3){return function(_0xcf32f){try{jsonpatch['apply'](_0xcf32f,_0x5eb8b3,!![]);}catch(_0x2f2089){return BPromise[_0x7e07('0x24')](_0x2f2089);}return _0xcf32f['save']();};}function saveUpdates(_0x8a50ea,_0x4f9492){return function(_0x532d8c){if(_0x532d8c){return _0x532d8c['update'](_0x8a50ea)[_0x7e07('0x25')](function(_0x29c2df){return _0x29c2df;});}return null;};}function removeEntity(_0x478b05,_0x81ca62){return function(_0x153b19){if(_0x153b19){return _0x153b19[_0x7e07('0x26')]()[_0x7e07('0x25')](function(){_0x478b05[_0x7e07('0x1b')](0xcc)[_0x7e07('0x1c')]();});}};}function handleEntityNotFound(_0x197a35,_0xa5aa5d){return function(_0x300492){if(!_0x300492){_0x197a35[_0x7e07('0x1a')](0x194);}return _0x300492;};}function handleError(_0x470895,_0x460862){_0x460862=_0x460862||0x1f4;return function(_0x9a95ef){logger['error'](_0x9a95ef[_0x7e07('0x27')]);if(_0x9a95ef[_0x7e07('0x28')]){delete _0x9a95ef[_0x7e07('0x28')];}_0x470895[_0x7e07('0x1b')](_0x460862)[_0x7e07('0x29')](_0x9a95ef);};}exports[_0x7e07('0x2a')]=function(_0x2924ba,_0x1cec23){var _0x146394={},_0x9a0abd={},_0x3ee6c2={'count':0x0,'rows':[]};var _0x4407da=_[_0x7e07('0x2b')](db[_0x7e07('0x2c')]['rawAttributes'],function(_0x32e0f9){return{'name':_0x32e0f9[_0x7e07('0x2d')],'type':_0x32e0f9[_0x7e07('0x2e')][_0x7e07('0x2f')]};});_0x9a0abd['model']=_[_0x7e07('0x2b')](_0x4407da,_0x7e07('0x28'));_0x9a0abd[_0x7e07('0x30')]=_[_0x7e07('0x31')](_0x2924ba[_0x7e07('0x30')]);_0x9a0abd[_0x7e07('0x32')]=_[_0x7e07('0x33')](_0x9a0abd[_0x7e07('0x34')],_0x9a0abd[_0x7e07('0x30')]);_0x146394['attributes']=_[_0x7e07('0x33')](_0x9a0abd[_0x7e07('0x34')],qs[_0x7e07('0x35')](_0x2924ba[_0x7e07('0x30')][_0x7e07('0x35')]));_0x146394[_0x7e07('0x36')]=_0x146394['attributes'][_0x7e07('0x37')]?_0x146394['attributes']:_0x9a0abd['model'];if(!_0x2924ba['query'][_0x7e07('0x38')]('nolimit')){_0x146394[_0x7e07('0x20')]=qs[_0x7e07('0x20')](_0x2924ba[_0x7e07('0x30')][_0x7e07('0x20')]);_0x146394[_0x7e07('0x1e')]=qs[_0x7e07('0x1e')](_0x2924ba[_0x7e07('0x30')][_0x7e07('0x1e')]);}_0x146394[_0x7e07('0x39')]=qs[_0x7e07('0x3a')](_0x2924ba['query']['sort']);_0x146394[_0x7e07('0x3b')]=qs[_0x7e07('0x32')](_['pick'](_0x2924ba[_0x7e07('0x30')],_0x9a0abd[_0x7e07('0x32')]),_0x4407da);if(_0x2924ba['query'][_0x7e07('0x3c')]){_0x146394[_0x7e07('0x3b')]=_['merge'](_0x146394[_0x7e07('0x3b')],{'$or':_['map'](_0x4407da,function(_0x313ad5){if(_0x313ad5[_0x7e07('0x2e')]!==_0x7e07('0x3d')){var _0x3c025a={};_0x3c025a[_0x313ad5[_0x7e07('0x28')]]={'$like':'%'+_0x2924ba[_0x7e07('0x30')][_0x7e07('0x3c')]+'%'};return _0x3c025a;}})});}_0x146394=_[_0x7e07('0x3e')]({},_0x146394,_0x2924ba[_0x7e07('0x3f')]);var _0x54491a={'where':_0x146394[_0x7e07('0x3b')]};return db[_0x7e07('0x2c')][_0x7e07('0x21')](_0x54491a)[_0x7e07('0x25')](function(_0x2184d2){_0x3ee6c2[_0x7e07('0x21')]=_0x2184d2;if(_0x2924ba[_0x7e07('0x30')][_0x7e07('0x40')]){_0x146394[_0x7e07('0x41')]=[{'all':!![]}];}return db[_0x7e07('0x2c')][_0x7e07('0x42')](_0x146394);})[_0x7e07('0x25')](function(_0x1744e7){_0x3ee6c2[_0x7e07('0x43')]=_0x1744e7;return _0x3ee6c2;})[_0x7e07('0x25')](respondWithFilteredResult(_0x1cec23,_0x146394))['catch'](handleError(_0x1cec23,null));};exports['show']=function(_0x5ed931,_0x4267ba){var _0x1809a1={'raw':![],'where':{'id':_0x5ed931['params']['id']}},_0x189244={};_0x189244[_0x7e07('0x34')]=_[_0x7e07('0x31')](db[_0x7e07('0x2c')][_0x7e07('0x44')]);_0x189244[_0x7e07('0x30')]=_['keys'](_0x5ed931[_0x7e07('0x30')]);_0x189244[_0x7e07('0x32')]=_['intersection'](_0x189244[_0x7e07('0x34')],_0x189244[_0x7e07('0x30')]);_0x1809a1[_0x7e07('0x36')]=_['intersection'](_0x189244[_0x7e07('0x34')],qs[_0x7e07('0x35')](_0x5ed931[_0x7e07('0x30')]['fields']));_0x1809a1[_0x7e07('0x36')]=_0x1809a1[_0x7e07('0x36')]['length']?_0x1809a1['attributes']:_0x189244[_0x7e07('0x34')];if(_0x5ed931[_0x7e07('0x30')][_0x7e07('0x40')]){_0x1809a1['include']=[{'all':!![]}];}_0x1809a1=_['merge']({},_0x1809a1,_0x5ed931[_0x7e07('0x3f')]);return db[_0x7e07('0x2c')][_0x7e07('0x45')](_0x1809a1)[_0x7e07('0x25')](handleEntityNotFound(_0x4267ba,null))[_0x7e07('0x25')](respondWithResult(_0x4267ba,null))[_0x7e07('0x46')](handleError(_0x4267ba,null));};exports[_0x7e07('0x47')]=function(_0x15c863,_0x5d6763){return db[_0x7e07('0x2c')][_0x7e07('0x47')](_0x15c863[_0x7e07('0x48')],{})['then'](respondWithResult(_0x5d6763,0xc9))[_0x7e07('0x46')](handleError(_0x5d6763,null));};exports[_0x7e07('0x49')]=function(_0x4a9e3b,_0x31d807){if(_0x4a9e3b['body']['id']){delete _0x4a9e3b[_0x7e07('0x48')]['id'];}return db[_0x7e07('0x2c')]['find']({'where':{'id':_0x4a9e3b['params']['id']}})['then'](handleEntityNotFound(_0x31d807,null))['then'](saveUpdates(_0x4a9e3b[_0x7e07('0x48')],null))[_0x7e07('0x25')](respondWithResult(_0x31d807,null))['catch'](handleError(_0x31d807,null));};exports[_0x7e07('0x26')]=function(_0x3e8882,_0x269a30){return db['DeskAccount'][_0x7e07('0x45')]({'where':{'id':_0x3e8882[_0x7e07('0x4a')]['id']}})[_0x7e07('0x25')](handleEntityNotFound(_0x269a30,null))[_0x7e07('0x25')](removeEntity(_0x269a30,null))['catch'](handleError(_0x269a30,null));};exports[_0x7e07('0x4b')]=function(_0x11adb1,_0x22109,_0x13712b){var _0x3bfd68={};var _0x298aef={};var _0x3e2db5;var _0x46b8f6;return db[_0x7e07('0x2c')]['findOne']({'where':{'id':_0x11adb1['params']['id']}})[_0x7e07('0x25')](handleEntityNotFound(_0x22109,null))['then'](function(_0x4af925){if(_0x4af925){_0x3e2db5=_0x4af925;_0x298aef['model']=_[_0x7e07('0x31')](db[_0x7e07('0x4c')][_0x7e07('0x44')]);_0x298aef[_0x7e07('0x30')]=_[_0x7e07('0x31')](_0x11adb1['query']);_0x298aef[_0x7e07('0x32')]=_[_0x7e07('0x33')](_0x298aef['model'],_0x298aef[_0x7e07('0x30')]);_0x3bfd68[_0x7e07('0x36')]=_['intersection'](_0x298aef[_0x7e07('0x34')],qs[_0x7e07('0x35')](_0x11adb1['query'][_0x7e07('0x35')]));_0x3bfd68[_0x7e07('0x36')]=_0x3bfd68[_0x7e07('0x36')][_0x7e07('0x37')]?_0x3bfd68['attributes']:_0x298aef[_0x7e07('0x34')];_0x3bfd68['order']=qs['sort'](_0x11adb1[_0x7e07('0x30')][_0x7e07('0x3a')]);_0x3bfd68[_0x7e07('0x3b')]=qs[_0x7e07('0x32')](_[_0x7e07('0x4d')](_0x11adb1[_0x7e07('0x30')],_0x298aef[_0x7e07('0x32')]));if(_0x11adb1[_0x7e07('0x30')][_0x7e07('0x3c')]){_0x3bfd68[_0x7e07('0x3b')]=_[_0x7e07('0x3e')](_0x3bfd68['where'],{'$or':_['map'](_0x3bfd68[_0x7e07('0x36')],function(_0x24a548){var _0x24e236={};_0x24e236[_0x24a548]={'$like':'%'+_0x11adb1[_0x7e07('0x30')][_0x7e07('0x3c')]+'%'};return _0x24e236;})});}_0x3bfd68=_[_0x7e07('0x3e')]({},_0x3bfd68,_0x11adb1[_0x7e07('0x3f')]);return _0x3e2db5[_0x7e07('0x4b')](_0x3bfd68);}})[_0x7e07('0x25')](function(_0x5c8d59){if(_0x5c8d59){_0x46b8f6=_0x5c8d59['length'];if(!_0x11adb1['query'][_0x7e07('0x38')]('nolimit')){_0x3bfd68[_0x7e07('0x20')]=qs[_0x7e07('0x20')](_0x11adb1[_0x7e07('0x30')]['limit']);_0x3bfd68[_0x7e07('0x1e')]=qs[_0x7e07('0x1e')](_0x11adb1[_0x7e07('0x30')]['offset']);}return _0x3e2db5[_0x7e07('0x4b')](_0x3bfd68);}})[_0x7e07('0x25')](function(_0x5e4973){if(_0x5e4973){return _0x5e4973?{'count':_0x46b8f6,'rows':_0x5e4973}:null;}})['then'](respondWithResult(_0x22109,null))['catch'](handleError(_0x22109,null));};exports['addConfiguration']=function(_0x28567a,_0x152e1b,_0x20f322){if(_0x28567a[_0x7e07('0x48')]['id']){delete _0x28567a[_0x7e07('0x48')]['id'];}return db[_0x7e07('0x2c')][_0x7e07('0x4e')]({'where':{'id':_0x28567a['params']['id']}})[_0x7e07('0x25')](handleEntityNotFound(_0x152e1b,null))['then'](function(_0x51181c){if(_0x51181c){_0x28567a[_0x7e07('0x48')][_0x7e07('0x4f')]=_0x51181c['id'];_0x28567a[_0x7e07('0x48')][_0x7e07('0x50')]=integrations[_0x7e07('0x51')](_0x28567a[_0x7e07('0x48')]['channel'],_0x28567a[_0x7e07('0x48')][_0x7e07('0x2e')]);_0x28567a['body'][_0x7e07('0x52')]=integrations[_0x7e07('0x53')](_0x28567a[_0x7e07('0x48')]['channel'],_0x28567a[_0x7e07('0x48')][_0x7e07('0x2e')]);return db[_0x7e07('0x4c')][_0x7e07('0x47')](_0x28567a[_0x7e07('0x48')],{'include':[{'model':db[_0x7e07('0x54')],'as':_0x7e07('0x50')},{'model':db[_0x7e07('0x54')],'as':_0x7e07('0x52')}]});}return null;})['then'](respondWithResult(_0x152e1b,null))['catch'](handleError(_0x152e1b,null));};exports[_0x7e07('0x55')]=function(_0x208ea0,_0x28b9c4,_0x3d2c78){var _0x3500c1=[{'name':_0x7e07('0x56'),'label':_0x7e07('0x56'),'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 _0x52aa6a='';return db[_0x7e07('0x2c')][_0x7e07('0x4e')]({'where':{'id':_0x208ea0['params']['id']},'attributes':['id',_0x7e07('0x57'),'authType','username',_0x7e07('0x58'),_0x7e07('0x59'),_0x7e07('0x5a'),_0x7e07('0x5b'),_0x7e07('0x5c')]})[_0x7e07('0x25')](handleEntityNotFound(_0x28b9c4,null))[_0x7e07('0x25')](function(_0x44d32f){if(_0x44d32f){_0x52aa6a=_0x44d32f['remoteUri'];var _0x4f8e5e=_0x52aa6a[_0x7e07('0x5d')](-0x1);if(_0x4f8e5e==='/'){_0x52aa6a=_0x52aa6a[_0x7e07('0x5e')](0x0,_0x52aa6a[_0x7e07('0x5f')](_0x4f8e5e));}var _0x1bff2b={'method':_0x7e07('0x60'),'uri':util[_0x7e07('0x61')]('%s/custom_fields',_0x52aa6a),'headers':{'Content-Type':_0x7e07('0x62'),'Accept':_0x7e07('0x62')},'json':!![]};if(_0x44d32f[_0x7e07('0x63')]===_0x7e07('0x64')){_0x1bff2b[_0x7e07('0x65')][_0x7e07('0x66')]=util[_0x7e07('0x61')](_0x7e07('0x67'),new Buffer(util[_0x7e07('0x61')]('%s:%s',_0x44d32f['username'],_0x44d32f[_0x7e07('0x58')]))[_0x7e07('0x68')](_0x7e07('0x69')));}return rp(_0x1bff2b)['then'](function(_0x4eb69a){return _0x3500c1[_0x7e07('0x6a')](_[_0x7e07('0x2b')](_0x4eb69a[_0x7e07('0x6b')][_0x7e07('0x6c')],function(_0x564ec2){return{'id':_0x564ec2[_0x7e07('0x28')],'name':_0x564ec2[_0x7e07('0x28')],'type':_0x564ec2[_0x7e07('0x2e')],'active':_0x564ec2[_0x7e07('0x6d')],'label':_0x564ec2[_0x7e07('0x6e')],'custom':!![]};}));});}})[_0x7e07('0x25')](function(_0x172e8f){return{'count':_0x172e8f[_0x7e07('0x37')],'rows':_0x172e8f};})[_0x7e07('0x25')](respondWithResult(_0x28b9c4,null))[_0x7e07('0x46')](function(_0x3278e6){var _0x546518=_0x208ea0[_0x7e07('0x30')][_0x7e07('0x6f')]?0x1f4:_0x3278e6[_0x7e07('0x70')]||0x1f4;logger[_0x7e07('0x71')](_0x7e07('0x72'),'getFields',_0x546518,JSON['stringify'](_0x3278e6));delete _0x3278e6['name'];if(_0x546518===0x191){_0x546518=0x190;}_0x28b9c4[_0x7e07('0x1b')](_0x546518)[_0x7e07('0x29')](_0x208ea0[_0x7e07('0x30')][_0x7e07('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x3278e6['statusCode']}:_0x3278e6);});}; \ No newline at end of file +var _0xa6ad=['create','body','update','getConfigurations','findOne','order','hasOwnProperty','nolimit','AccountId','channel','Descriptions','getDescriptions','DeskConfiguration','Subjects','DeskField','getFields','priority','authType','username','password','consumerKey','consumerSecret','tokenSecret','remoteUri','slice','substring','lastIndexOf','GET','format','application/json','basic','Authorization','toString','base64','concat','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','show','params','find','catch'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa6ad,0x104));var _0xda6a=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xa6ad[_0x5627e1];return _0x2f013f;};'use strict';var emlformat=require(_0xda6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda6a('0x1'));var jsonpatch=require(_0xda6a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xda6a('0x3'));var path=require(_0xda6a('0x4'));var sox=require(_0xda6a('0x5'));var csv=require(_0xda6a('0x6'));var ejs=require(_0xda6a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xda6a('0x8'));var crypto=require(_0xda6a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xda6a('0xa'));var toCsv=require(_0xda6a('0x6'));var querystring=require(_0xda6a('0xb'));var Papa=require(_0xda6a('0xc'));var Redis=require('ioredis');var authService=require(_0xda6a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xda6a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda6a('0xf'))(_0xda6a('0x10'));var utils=require(_0xda6a('0x11'));var config=require(_0xda6a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xda6a('0x13'))['db'];var integrations=require(_0xda6a('0x14'));function respondWithStatusCode(_0x5c2be0,_0x58fbe4){_0x58fbe4=_0x58fbe4||0xcc;return function(_0x2f17aa){if(_0x2f17aa){return _0x5c2be0[_0xda6a('0x15')](_0x58fbe4);}return _0x5c2be0[_0xda6a('0x16')](_0x58fbe4)[_0xda6a('0x17')]();};}function respondWithResult(_0x2b4bd1,_0x403779){_0x403779=_0x403779||0xc8;return function(_0x1dd694){if(_0x1dd694){return _0x2b4bd1[_0xda6a('0x16')](_0x403779)['json'](_0x1dd694);}};}function respondWithFilteredResult(_0x14a5c0,_0x34d9af){return function(_0x29651a){if(_0x29651a){var _0x341dd1=typeof _0x34d9af[_0xda6a('0x18')]===_0xda6a('0x19')&&typeof _0x34d9af[_0xda6a('0x1a')]==='undefined';var _0x4a7534=_0x29651a[_0xda6a('0x1b')];var _0x4cff3f=_0x341dd1?0x0:_0x34d9af[_0xda6a('0x18')];var _0x107123=_0x341dd1?_0x29651a['count']:_0x34d9af[_0xda6a('0x18')]+_0x34d9af[_0xda6a('0x1a')];var _0x5be8e6;if(_0x107123>=_0x4a7534){_0x107123=_0x4a7534;_0x5be8e6=0xc8;}else{_0x5be8e6=0xce;}_0x14a5c0['status'](_0x5be8e6);return _0x14a5c0[_0xda6a('0x1c')](_0xda6a('0x1d'),_0x4cff3f+'-'+_0x107123+'/'+_0x4a7534)[_0xda6a('0x1e')](_0x29651a);}return null;};}function patchUpdates(_0x3d9d10){return function(_0xa5a333){try{jsonpatch['apply'](_0xa5a333,_0x3d9d10,!![]);}catch(_0x358821){return BPromise[_0xda6a('0x1f')](_0x358821);}return _0xa5a333[_0xda6a('0x20')]();};}function saveUpdates(_0x471002,_0x4ce120){return function(_0xb17c25){if(_0xb17c25){return _0xb17c25['update'](_0x471002)[_0xda6a('0x21')](function(_0x1982d4){return _0x1982d4;});}return null;};}function removeEntity(_0x494f37,_0x2eeb83){return function(_0x1ff413){if(_0x1ff413){return _0x1ff413[_0xda6a('0x22')]()['then'](function(){_0x494f37[_0xda6a('0x16')](0xcc)[_0xda6a('0x17')]();});}};}function handleEntityNotFound(_0x1284d5,_0x1dac8){return function(_0x1d6b4f){if(!_0x1d6b4f){_0x1284d5[_0xda6a('0x15')](0x194);}return _0x1d6b4f;};}function handleError(_0x2bc23a,_0x3bce60){_0x3bce60=_0x3bce60||0x1f4;return function(_0x20c231){logger[_0xda6a('0x23')](_0x20c231[_0xda6a('0x24')]);if(_0x20c231['name']){delete _0x20c231[_0xda6a('0x25')];}_0x2bc23a['status'](_0x3bce60)[_0xda6a('0x26')](_0x20c231);};}exports[_0xda6a('0x27')]=function(_0x5ba61a,_0x4783d5){var _0xeb5ca0={},_0x51b52d={},_0x360a0c={'count':0x0,'rows':[]};var _0x271825=_['map'](db[_0xda6a('0x28')][_0xda6a('0x29')],function(_0x1e78a9){return{'name':_0x1e78a9[_0xda6a('0x2a')],'type':_0x1e78a9[_0xda6a('0x2b')][_0xda6a('0x2c')]};});_0x51b52d[_0xda6a('0x2d')]=_[_0xda6a('0x2e')](_0x271825,_0xda6a('0x25'));_0x51b52d[_0xda6a('0x2f')]=_[_0xda6a('0x30')](_0x5ba61a['query']);_0x51b52d['filters']=_[_0xda6a('0x31')](_0x51b52d[_0xda6a('0x2d')],_0x51b52d[_0xda6a('0x2f')]);_0xeb5ca0[_0xda6a('0x32')]=_[_0xda6a('0x31')](_0x51b52d['model'],qs[_0xda6a('0x33')](_0x5ba61a[_0xda6a('0x2f')]['fields']));_0xeb5ca0[_0xda6a('0x32')]=_0xeb5ca0[_0xda6a('0x32')][_0xda6a('0x34')]?_0xeb5ca0[_0xda6a('0x32')]:_0x51b52d['model'];if(!_0x5ba61a[_0xda6a('0x2f')]['hasOwnProperty']('nolimit')){_0xeb5ca0[_0xda6a('0x1a')]=qs[_0xda6a('0x1a')](_0x5ba61a['query'][_0xda6a('0x1a')]);_0xeb5ca0['offset']=qs['offset'](_0x5ba61a[_0xda6a('0x2f')][_0xda6a('0x18')]);}_0xeb5ca0['order']=qs['sort'](_0x5ba61a['query'][_0xda6a('0x35')]);_0xeb5ca0[_0xda6a('0x36')]=qs[_0xda6a('0x37')](_[_0xda6a('0x38')](_0x5ba61a[_0xda6a('0x2f')],_0x51b52d['filters']),_0x271825);if(_0x5ba61a[_0xda6a('0x2f')]['filter']){_0xeb5ca0['where']=_[_0xda6a('0x39')](_0xeb5ca0[_0xda6a('0x36')],{'$or':_[_0xda6a('0x2e')](_0x271825,function(_0x35396d){if(_0x35396d[_0xda6a('0x2b')]!=='VIRTUAL'){var _0x5e50a0={};_0x5e50a0[_0x35396d[_0xda6a('0x25')]]={'$like':'%'+_0x5ba61a[_0xda6a('0x2f')][_0xda6a('0x3a')]+'%'};return _0x5e50a0;}})});}_0xeb5ca0=_[_0xda6a('0x39')]({},_0xeb5ca0,_0x5ba61a[_0xda6a('0x3b')]);var _0x5906be={'where':_0xeb5ca0[_0xda6a('0x36')]};return db['DeskAccount'][_0xda6a('0x1b')](_0x5906be)['then'](function(_0x52c11c){_0x360a0c[_0xda6a('0x1b')]=_0x52c11c;if(_0x5ba61a[_0xda6a('0x2f')][_0xda6a('0x3c')]){_0xeb5ca0[_0xda6a('0x3d')]=[{'all':!![]}];}return db['DeskAccount'][_0xda6a('0x3e')](_0xeb5ca0);})[_0xda6a('0x21')](function(_0x18ed10){_0x360a0c['rows']=_0x18ed10;return _0x360a0c;})[_0xda6a('0x21')](respondWithFilteredResult(_0x4783d5,_0xeb5ca0))['catch'](handleError(_0x4783d5,null));};exports[_0xda6a('0x3f')]=function(_0x27a829,_0x40a2a4){var _0x4e60f3={'raw':![],'where':{'id':_0x27a829[_0xda6a('0x40')]['id']}},_0x3ce9f1={};_0x3ce9f1[_0xda6a('0x2d')]=_[_0xda6a('0x30')](db[_0xda6a('0x28')][_0xda6a('0x29')]);_0x3ce9f1[_0xda6a('0x2f')]=_[_0xda6a('0x30')](_0x27a829['query']);_0x3ce9f1[_0xda6a('0x37')]=_[_0xda6a('0x31')](_0x3ce9f1[_0xda6a('0x2d')],_0x3ce9f1['query']);_0x4e60f3[_0xda6a('0x32')]=_['intersection'](_0x3ce9f1[_0xda6a('0x2d')],qs[_0xda6a('0x33')](_0x27a829[_0xda6a('0x2f')][_0xda6a('0x33')]));_0x4e60f3['attributes']=_0x4e60f3[_0xda6a('0x32')]['length']?_0x4e60f3[_0xda6a('0x32')]:_0x3ce9f1['model'];if(_0x27a829['query'][_0xda6a('0x3c')]){_0x4e60f3[_0xda6a('0x3d')]=[{'all':!![]}];}_0x4e60f3=_['merge']({},_0x4e60f3,_0x27a829[_0xda6a('0x3b')]);return db['DeskAccount'][_0xda6a('0x41')](_0x4e60f3)[_0xda6a('0x21')](handleEntityNotFound(_0x40a2a4,null))[_0xda6a('0x21')](respondWithResult(_0x40a2a4,null))[_0xda6a('0x42')](handleError(_0x40a2a4,null));};exports['create']=function(_0x118dff,_0x4f6378){return db[_0xda6a('0x28')][_0xda6a('0x43')](_0x118dff[_0xda6a('0x44')],{})['then'](respondWithResult(_0x4f6378,0xc9))[_0xda6a('0x42')](handleError(_0x4f6378,null));};exports[_0xda6a('0x45')]=function(_0x286fe0,_0x48bd2b){if(_0x286fe0[_0xda6a('0x44')]['id']){delete _0x286fe0[_0xda6a('0x44')]['id'];}return db[_0xda6a('0x28')][_0xda6a('0x41')]({'where':{'id':_0x286fe0[_0xda6a('0x40')]['id']}})['then'](handleEntityNotFound(_0x48bd2b,null))[_0xda6a('0x21')](saveUpdates(_0x286fe0[_0xda6a('0x44')],null))['then'](respondWithResult(_0x48bd2b,null))[_0xda6a('0x42')](handleError(_0x48bd2b,null));};exports['destroy']=function(_0x2b49ed,_0x5c2816){return db[_0xda6a('0x28')]['find']({'where':{'id':_0x2b49ed[_0xda6a('0x40')]['id']}})['then'](handleEntityNotFound(_0x5c2816,null))['then'](removeEntity(_0x5c2816,null))[_0xda6a('0x42')](handleError(_0x5c2816,null));};exports[_0xda6a('0x46')]=function(_0x39d761,_0x295b1c,_0x5206a5){var _0x145fe3={};var _0x532b9c={};var _0x2678d0;var _0x51c38c;return db[_0xda6a('0x28')][_0xda6a('0x47')]({'where':{'id':_0x39d761['params']['id']}})[_0xda6a('0x21')](handleEntityNotFound(_0x295b1c,null))[_0xda6a('0x21')](function(_0x4c3a33){if(_0x4c3a33){_0x2678d0=_0x4c3a33;_0x532b9c[_0xda6a('0x2d')]=_[_0xda6a('0x30')](db['DeskConfiguration'][_0xda6a('0x29')]);_0x532b9c[_0xda6a('0x2f')]=_[_0xda6a('0x30')](_0x39d761[_0xda6a('0x2f')]);_0x532b9c[_0xda6a('0x37')]=_[_0xda6a('0x31')](_0x532b9c[_0xda6a('0x2d')],_0x532b9c['query']);_0x145fe3[_0xda6a('0x32')]=_[_0xda6a('0x31')](_0x532b9c[_0xda6a('0x2d')],qs['fields'](_0x39d761[_0xda6a('0x2f')][_0xda6a('0x33')]));_0x145fe3[_0xda6a('0x32')]=_0x145fe3['attributes']['length']?_0x145fe3[_0xda6a('0x32')]:_0x532b9c[_0xda6a('0x2d')];_0x145fe3[_0xda6a('0x48')]=qs[_0xda6a('0x35')](_0x39d761['query']['sort']);_0x145fe3[_0xda6a('0x36')]=qs[_0xda6a('0x37')](_['pick'](_0x39d761['query'],_0x532b9c[_0xda6a('0x37')]));if(_0x39d761['query']['filter']){_0x145fe3['where']=_[_0xda6a('0x39')](_0x145fe3[_0xda6a('0x36')],{'$or':_[_0xda6a('0x2e')](_0x145fe3[_0xda6a('0x32')],function(_0xb585c2){var _0x300208={};_0x300208[_0xb585c2]={'$like':'%'+_0x39d761[_0xda6a('0x2f')][_0xda6a('0x3a')]+'%'};return _0x300208;})});}_0x145fe3=_[_0xda6a('0x39')]({},_0x145fe3,_0x39d761[_0xda6a('0x3b')]);return _0x2678d0[_0xda6a('0x46')](_0x145fe3);}})[_0xda6a('0x21')](function(_0x4df747){if(_0x4df747){_0x51c38c=_0x4df747[_0xda6a('0x34')];if(!_0x39d761[_0xda6a('0x2f')][_0xda6a('0x49')](_0xda6a('0x4a'))){_0x145fe3['limit']=qs[_0xda6a('0x1a')](_0x39d761['query'][_0xda6a('0x1a')]);_0x145fe3[_0xda6a('0x18')]=qs[_0xda6a('0x18')](_0x39d761['query'][_0xda6a('0x18')]);}return _0x2678d0['getConfigurations'](_0x145fe3);}})[_0xda6a('0x21')](function(_0x4efb3d){if(_0x4efb3d){return _0x4efb3d?{'count':_0x51c38c,'rows':_0x4efb3d}:null;}})[_0xda6a('0x21')](respondWithResult(_0x295b1c,null))[_0xda6a('0x42')](handleError(_0x295b1c,null));};exports['addConfiguration']=function(_0x23e888,_0x3c1318,_0x9b0460){if(_0x23e888[_0xda6a('0x44')]['id']){delete _0x23e888[_0xda6a('0x44')]['id'];}return db[_0xda6a('0x28')][_0xda6a('0x47')]({'where':{'id':_0x23e888['params']['id']}})[_0xda6a('0x21')](handleEntityNotFound(_0x3c1318,null))[_0xda6a('0x21')](function(_0x1b8d53){if(_0x1b8d53){_0x23e888[_0xda6a('0x44')][_0xda6a('0x4b')]=_0x1b8d53['id'];_0x23e888[_0xda6a('0x44')]['Subjects']=integrations['getSubjects'](_0x23e888[_0xda6a('0x44')][_0xda6a('0x4c')],_0x23e888[_0xda6a('0x44')][_0xda6a('0x2b')]);_0x23e888[_0xda6a('0x44')][_0xda6a('0x4d')]=integrations[_0xda6a('0x4e')](_0x23e888[_0xda6a('0x44')][_0xda6a('0x4c')],_0x23e888[_0xda6a('0x44')]['type']);return db[_0xda6a('0x4f')][_0xda6a('0x43')](_0x23e888[_0xda6a('0x44')],{'include':[{'model':db['DeskField'],'as':_0xda6a('0x50')},{'model':db[_0xda6a('0x51')],'as':_0xda6a('0x4d')}]});}return null;})['then'](respondWithResult(_0x3c1318,null))[_0xda6a('0x42')](handleError(_0x3c1318,null));};exports[_0xda6a('0x52')]=function(_0x36ee56,_0x360da3,_0x3d32e7){var _0x2bdb08=[{'name':_0xda6a('0x53'),'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 _0x515246='';return db[_0xda6a('0x28')][_0xda6a('0x47')]({'where':{'id':_0x36ee56['params']['id']},'attributes':['id','remoteUri',_0xda6a('0x54'),_0xda6a('0x55'),_0xda6a('0x56'),_0xda6a('0x57'),_0xda6a('0x58'),'token',_0xda6a('0x59')]})[_0xda6a('0x21')](handleEntityNotFound(_0x360da3,null))['then'](function(_0x10294f){if(_0x10294f){_0x515246=_0x10294f[_0xda6a('0x5a')];var _0xcd0f61=_0x515246[_0xda6a('0x5b')](-0x1);if(_0xcd0f61==='/'){_0x515246=_0x515246[_0xda6a('0x5c')](0x0,_0x515246[_0xda6a('0x5d')](_0xcd0f61));}var _0x4b3c2c={'method':_0xda6a('0x5e'),'uri':util[_0xda6a('0x5f')]('%s/custom_fields',_0x515246),'headers':{'Content-Type':_0xda6a('0x60'),'Accept':'application/json'},'json':!![]};if(_0x10294f[_0xda6a('0x54')]===_0xda6a('0x61')){_0x4b3c2c['headers'][_0xda6a('0x62')]=util[_0xda6a('0x5f')]('Basic\x20%s',new Buffer(util[_0xda6a('0x5f')]('%s:%s',_0x10294f[_0xda6a('0x55')],_0x10294f[_0xda6a('0x56')]))[_0xda6a('0x63')](_0xda6a('0x64')));}return rp(_0x4b3c2c)['then'](function(_0xea4bb7){return _0x2bdb08[_0xda6a('0x65')](_[_0xda6a('0x2e')](_0xea4bb7['_embedded'][_0xda6a('0x66')],function(_0x12ad0a){return{'id':_0x12ad0a[_0xda6a('0x25')],'name':_0x12ad0a[_0xda6a('0x25')],'type':_0x12ad0a[_0xda6a('0x2b')],'active':_0x12ad0a['active'],'label':_0x12ad0a[_0xda6a('0x67')],'custom':!![]};}));});}})[_0xda6a('0x21')](function(_0x22b147){return{'count':_0x22b147['length'],'rows':_0x22b147};})[_0xda6a('0x21')](respondWithResult(_0x360da3,null))[_0xda6a('0x42')](function(_0x25da2f){var _0x58cb39=_0x36ee56[_0xda6a('0x2f')][_0xda6a('0x68')]?0x1f4:_0x25da2f[_0xda6a('0x69')]||0x1f4;logger[_0xda6a('0x23')](_0xda6a('0x6a'),_0xda6a('0x52'),_0x58cb39,JSON[_0xda6a('0x6b')](_0x25da2f));delete _0x25da2f[_0xda6a('0x25')];if(_0x58cb39===0x191){_0x58cb39=0x190;}_0x360da3['status'](_0x58cb39)[_0xda6a('0x26')](_0x36ee56[_0xda6a('0x2f')][_0xda6a('0x68')]?{'message':_0xda6a('0x6c'),'statusCode':_0x25da2f['statusCode']}:_0x25da2f);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 7470982..ec79e96 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 _0x456d=['bluebird','request-promise','../../components/integrations/configuration','exports','define','int_desk_accounts','util','../../config/logger','api','moment'];(function(_0x5d68a5,_0x2a0dcb){var _0x75d496=function(_0x25d6b4){while(--_0x25d6b4){_0x5d68a5['push'](_0x5d68a5['shift']());}};_0x75d496(++_0x2a0dcb);}(_0x456d,0x1b4));var _0xd456=function(_0x420e48,_0x57365f){_0x420e48=_0x420e48-0x0;var _0xef56c7=_0x456d[_0x420e48];return _0xef56c7;};'use strict';var _=require('lodash');var util=require(_0xd456('0x0'));var logger=require(_0xd456('0x1'))(_0xd456('0x2'));var moment=require(_0xd456('0x3'));var BPromise=require(_0xd456('0x4'));var rp=require(_0xd456('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xd456('0x6'));module[_0xd456('0x7')]=function(_0x55a644,_0x5a9dc2){return _0x55a644[_0xd456('0x8')]('DeskAccount',attributes,{'tableName':_0xd456('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc05e=['../../config/environment','../../components/integrations/configuration','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5a23a4,_0x2eeb57){var _0x13a098=function(_0x40514f){while(--_0x40514f){_0x5a23a4['push'](_0x5a23a4['shift']());}};_0x13a098(++_0x2eeb57);}(_0xc05e,0x66));var _0xec05=function(_0x3bb216,_0x26eced){_0x3bb216=_0x3bb216-0x0;var _0x24961c=_0xc05e[_0x3bb216];return _0x24961c;};'use strict';var _=require(_0xec05('0x0'));var util=require(_0xec05('0x1'));var logger=require(_0xec05('0x2'))(_0xec05('0x3'));var moment=require(_0xec05('0x4'));var BPromise=require(_0xec05('0x5'));var rp=require(_0xec05('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec05('0x7'));var config=require(_0xec05('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xec05('0x9'));module[_0xec05('0xa')]=function(_0x2babb4,_0x7e859e){return _0x2babb4['define']('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index a6ce86b..0881fdc 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 _0x3d2a=['where','limit','include','map','model','attributes','catch','ShowDeskAccount','find','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw'];(function(_0x2bd462,_0x24c92a){var _0x2e1f03=function(_0x50de7e){while(--_0x50de7e){_0x2bd462['push'](_0x2bd462['shift']());}};_0x2e1f03(++_0x24c92a);}(_0x3d2a,0x1d0));var _0xa3d2=function(_0x468a77,_0x1382be){_0x468a77=_0x468a77-0x0;var _0x2d1c33=_0x3d2a[_0x468a77];return _0x2d1c33;};'use strict';var _=require(_0xa3d2('0x0'));var util=require('util');var moment=require(_0xa3d2('0x1'));var BPromise=require(_0xa3d2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3d2('0x3'))['db'];var utils=require(_0xa3d2('0x4'));var logger=require(_0xa3d2('0x5'))('rpc');var config=require(_0xa3d2('0x6'));var jayson=require(_0xa3d2('0x7'));var client=jayson[_0xa3d2('0x8')][_0xa3d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43c94d,_0x1a6b7b,_0x55f275){return new BPromise(function(_0x48c934,_0x2fa736){return client[_0xa3d2('0xa')](_0x43c94d,_0x55f275)[_0xa3d2('0xb')](function(_0x3652d9){logger[_0xa3d2('0xc')](_0xa3d2('0xd'),_0x1a6b7b,_0xa3d2('0xe'));logger[_0xa3d2('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x1a6b7b,_0xa3d2('0xe'),JSON[_0xa3d2('0x10')](_0x3652d9));if(_0x3652d9[_0xa3d2('0x11')]){if(_0x3652d9['error'][_0xa3d2('0x12')]===0x1f4){logger['error'](_0xa3d2('0xd'),_0x1a6b7b,_0x3652d9[_0xa3d2('0x11')]['message']);return _0x2fa736(_0x3652d9[_0xa3d2('0x11')][_0xa3d2('0x13')]);}logger[_0xa3d2('0x11')]('DeskAccount,\x20%s,\x20%s',_0x1a6b7b,_0x3652d9[_0xa3d2('0x11')][_0xa3d2('0x13')]);return _0x48c934(_0x3652d9['error'][_0xa3d2('0x13')]);}else{logger[_0xa3d2('0xc')](_0xa3d2('0xd'),_0x1a6b7b,_0xa3d2('0xe'));_0x48c934(_0x3652d9[_0xa3d2('0x14')][_0xa3d2('0x13')]);}})['catch'](function(_0x5c64af){logger[_0xa3d2('0x11')](_0xa3d2('0xd'),_0x1a6b7b,_0x5c64af);_0x2fa736(_0x5c64af);});});}exports[_0xa3d2('0x15')]=function(_0x5646da){var _0x2ce6c4=this;return new Promise(function(_0x37df75,_0x2375f1){return db[_0xa3d2('0x16')][_0xa3d2('0x17')]({'raw':_0x5646da[_0xa3d2('0x18')]?_0x5646da[_0xa3d2('0x18')][_0xa3d2('0x19')]===undefined?!![]:![]:!![],'where':_0x5646da[_0xa3d2('0x18')]?_0x5646da[_0xa3d2('0x18')][_0xa3d2('0x1a')]||null:null,'attributes':_0x5646da[_0xa3d2('0x18')]?_0x5646da['options']['attributes']||null:null,'limit':_0x5646da[_0xa3d2('0x18')]?_0x5646da[_0xa3d2('0x18')][_0xa3d2('0x1b')]||null:null,'include':_0x5646da[_0xa3d2('0x18')]?_0x5646da[_0xa3d2('0x18')][_0xa3d2('0x1c')]?_['map'](_0x5646da[_0xa3d2('0x18')]['include'],function(_0x3910f6){return{'model':db[_0x3910f6['model']],'as':_0x3910f6['as'],'attributes':_0x3910f6['attributes'],'include':_0x3910f6['include']?_[_0xa3d2('0x1d')](_0x3910f6[_0xa3d2('0x1c')],function(_0xec738b){return{'model':db[_0xec738b['model']],'as':_0xec738b['as'],'attributes':_0xec738b['attributes'],'include':_0xec738b['include']?_['map'](_0xec738b[_0xa3d2('0x1c')],function(_0x554885){return{'model':db[_0x554885[_0xa3d2('0x1e')]],'as':_0x554885['as'],'attributes':_0x554885[_0xa3d2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa3d2('0xb')](function(_0x14fe23){logger[_0xa3d2('0xc')]('GetDeskAccount',_0x5646da);logger[_0xa3d2('0xf')](_0xa3d2('0x15'),_0x5646da,JSON[_0xa3d2('0x10')](_0x14fe23));_0x37df75(_0x14fe23);})[_0xa3d2('0x20')](function(_0x40617e){logger[_0xa3d2('0x11')](_0xa3d2('0x15'),_0x40617e[_0xa3d2('0x13')],_0x5646da);_0x2375f1(_0x2ce6c4[_0xa3d2('0x11')](0x1f4,_0x40617e[_0xa3d2('0x13')]));});});};exports[_0xa3d2('0x21')]=function(_0x2961b4){var _0x43c35e=this;return new Promise(function(_0xc53b08,_0x1fd24e){return db[_0xa3d2('0x16')][_0xa3d2('0x22')]({'raw':_0x2961b4[_0xa3d2('0x18')]?_0x2961b4[_0xa3d2('0x18')][_0xa3d2('0x19')]===undefined?!![]:![]:!![],'where':_0x2961b4[_0xa3d2('0x18')]?_0x2961b4[_0xa3d2('0x18')][_0xa3d2('0x1a')]||null:null,'attributes':_0x2961b4['options']?_0x2961b4['options'][_0xa3d2('0x1f')]||null:null,'include':_0x2961b4['options']?_0x2961b4[_0xa3d2('0x18')][_0xa3d2('0x1c')]?_['map'](_0x2961b4['options'][_0xa3d2('0x1c')],function(_0x4a1f46){return{'model':db[_0x4a1f46[_0xa3d2('0x1e')]],'as':_0x4a1f46['as'],'attributes':_0x4a1f46[_0xa3d2('0x1f')],'include':_0x4a1f46[_0xa3d2('0x1c')]?_[_0xa3d2('0x1d')](_0x4a1f46[_0xa3d2('0x1c')],function(_0x18cd96){return{'model':db[_0x18cd96[_0xa3d2('0x1e')]],'as':_0x18cd96['as'],'attributes':_0x18cd96[_0xa3d2('0x1f')],'include':_0x18cd96[_0xa3d2('0x1c')]?_[_0xa3d2('0x1d')](_0x18cd96[_0xa3d2('0x1c')],function(_0x34f902){return{'model':db[_0x34f902[_0xa3d2('0x1e')]],'as':_0x34f902['as'],'attributes':_0x34f902[_0xa3d2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa3d2('0xb')](function(_0x129c14){logger[_0xa3d2('0xc')](_0xa3d2('0x21'),_0x2961b4);logger[_0xa3d2('0xf')](_0xa3d2('0x21'),_0x2961b4,JSON[_0xa3d2('0x10')](_0x129c14));_0xc53b08(_0x129c14);})[_0xa3d2('0x20')](function(_0x3ec476){logger[_0xa3d2('0x11')](_0xa3d2('0x21'),_0x3ec476[_0xa3d2('0x13')],_0x2961b4);_0x1fd24e(_0x43c35e[_0xa3d2('0x11')](0x1f4,_0x3ec476[_0xa3d2('0x13')]));});});}; \ No newline at end of file +var _0xbb18=['find','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','include','map','model','debug'];(function(_0xd832be,_0x176f86){var _0xef366=function(_0x486ec8){while(--_0x486ec8){_0xd832be['push'](_0xd832be['shift']());}};_0xef366(++_0x176f86);}(_0xbb18,0xfe));var _0x8bb1=function(_0x3f3519,_0xd53cae){_0x3f3519=_0x3f3519-0x0;var _0x23b6bf=_0xbb18[_0x3f3519];return _0x23b6bf;};'use strict';var _=require(_0x8bb1('0x0'));var util=require(_0x8bb1('0x1'));var moment=require(_0x8bb1('0x2'));var BPromise=require(_0x8bb1('0x3'));var rs=require(_0x8bb1('0x4'));var fs=require('fs');var Redis=require(_0x8bb1('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8bb1('0x6'))(_0x8bb1('0x7'));var config=require(_0x8bb1('0x8'));var jayson=require(_0x8bb1('0x9'));var client=jayson[_0x8bb1('0xa')][_0x8bb1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b9677,_0x46faa0,_0x3a28ea){return new BPromise(function(_0x16a76e,_0x58eb15){return client[_0x8bb1('0xc')](_0x2b9677,_0x3a28ea)[_0x8bb1('0xd')](function(_0x131f61){logger[_0x8bb1('0xe')](_0x8bb1('0xf'),_0x46faa0,_0x8bb1('0x10'));logger['debug'](_0x8bb1('0x11'),_0x46faa0,_0x8bb1('0x10'),JSON[_0x8bb1('0x12')](_0x131f61));if(_0x131f61[_0x8bb1('0x13')]){if(_0x131f61[_0x8bb1('0x13')]['code']===0x1f4){logger['error'](_0x8bb1('0xf'),_0x46faa0,_0x131f61[_0x8bb1('0x13')][_0x8bb1('0x14')]);return _0x58eb15(_0x131f61[_0x8bb1('0x13')][_0x8bb1('0x14')]);}logger[_0x8bb1('0x13')](_0x8bb1('0xf'),_0x46faa0,_0x131f61[_0x8bb1('0x13')][_0x8bb1('0x14')]);return _0x16a76e(_0x131f61[_0x8bb1('0x13')][_0x8bb1('0x14')]);}else{logger[_0x8bb1('0xe')](_0x8bb1('0xf'),_0x46faa0,'request\x20sent');_0x16a76e(_0x131f61[_0x8bb1('0x15')]['message']);}})[_0x8bb1('0x16')](function(_0x149d11){logger[_0x8bb1('0x13')]('DeskAccount,\x20%s,\x20%s',_0x46faa0,_0x149d11);_0x58eb15(_0x149d11);});});}exports[_0x8bb1('0x17')]=function(_0x2e7aeb){var _0x14a483=this;return new Promise(function(_0x4c3e3a,_0x3ee147){return db[_0x8bb1('0x18')][_0x8bb1('0x19')]({'raw':_0x2e7aeb['options']?_0x2e7aeb[_0x8bb1('0x1a')][_0x8bb1('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e7aeb[_0x8bb1('0x1a')]?_0x2e7aeb[_0x8bb1('0x1a')][_0x8bb1('0x1c')]||null:null,'attributes':_0x2e7aeb[_0x8bb1('0x1a')]?_0x2e7aeb['options'][_0x8bb1('0x1d')]||null:null,'limit':_0x2e7aeb[_0x8bb1('0x1a')]?_0x2e7aeb[_0x8bb1('0x1a')]['limit']||null:null,'include':_0x2e7aeb['options']?_0x2e7aeb[_0x8bb1('0x1a')]['include']?_['map'](_0x2e7aeb[_0x8bb1('0x1a')][_0x8bb1('0x1e')],function(_0x31492d){return{'model':db[_0x31492d['model']],'as':_0x31492d['as'],'attributes':_0x31492d[_0x8bb1('0x1d')],'include':_0x31492d[_0x8bb1('0x1e')]?_[_0x8bb1('0x1f')](_0x31492d['include'],function(_0x544898){return{'model':db[_0x544898[_0x8bb1('0x20')]],'as':_0x544898['as'],'attributes':_0x544898[_0x8bb1('0x1d')],'include':_0x544898[_0x8bb1('0x1e')]?_[_0x8bb1('0x1f')](_0x544898['include'],function(_0x42b2bb){return{'model':db[_0x42b2bb['model']],'as':_0x42b2bb['as'],'attributes':_0x42b2bb[_0x8bb1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8bb1('0xd')](function(_0x5456ed){logger['info'](_0x8bb1('0x17'),_0x2e7aeb);logger[_0x8bb1('0x21')](_0x8bb1('0x17'),_0x2e7aeb,JSON[_0x8bb1('0x12')](_0x5456ed));_0x4c3e3a(_0x5456ed);})[_0x8bb1('0x16')](function(_0xe1a9ca){logger[_0x8bb1('0x13')](_0x8bb1('0x17'),_0xe1a9ca['message'],_0x2e7aeb);_0x3ee147(_0x14a483[_0x8bb1('0x13')](0x1f4,_0xe1a9ca[_0x8bb1('0x14')]));});});};exports['ShowDeskAccount']=function(_0x151e55){var _0x101867=this;return new Promise(function(_0x46b998,_0x1c3ae8){return db['DeskAccount'][_0x8bb1('0x22')]({'raw':_0x151e55['options']?_0x151e55['options'][_0x8bb1('0x1b')]===undefined?!![]:![]:!![],'where':_0x151e55[_0x8bb1('0x1a')]?_0x151e55['options'][_0x8bb1('0x1c')]||null:null,'attributes':_0x151e55[_0x8bb1('0x1a')]?_0x151e55[_0x8bb1('0x1a')][_0x8bb1('0x1d')]||null:null,'include':_0x151e55[_0x8bb1('0x1a')]?_0x151e55[_0x8bb1('0x1a')][_0x8bb1('0x1e')]?_[_0x8bb1('0x1f')](_0x151e55['options'][_0x8bb1('0x1e')],function(_0x2f8e40){return{'model':db[_0x2f8e40[_0x8bb1('0x20')]],'as':_0x2f8e40['as'],'attributes':_0x2f8e40[_0x8bb1('0x1d')],'include':_0x2f8e40[_0x8bb1('0x1e')]?_[_0x8bb1('0x1f')](_0x2f8e40['include'],function(_0x303b3b){return{'model':db[_0x303b3b['model']],'as':_0x303b3b['as'],'attributes':_0x303b3b[_0x8bb1('0x1d')],'include':_0x303b3b[_0x8bb1('0x1e')]?_[_0x8bb1('0x1f')](_0x303b3b['include'],function(_0x1ca203){return{'model':db[_0x1ca203[_0x8bb1('0x20')]],'as':_0x1ca203['as'],'attributes':_0x1ca203['attributes']};}):[]};}):[]};}):[]:[]})[_0x8bb1('0xd')](function(_0x3daec8){logger[_0x8bb1('0xe')](_0x8bb1('0x23'),_0x151e55);logger[_0x8bb1('0x21')](_0x8bb1('0x23'),_0x151e55,JSON[_0x8bb1('0x12')](_0x3daec8));_0x46b998(_0x3daec8);})[_0x8bb1('0x16')](function(_0x336709){logger['error']('ShowDeskAccount',_0x336709[_0x8bb1('0x14')],_0x151e55);_0x1c3ae8(_0x101867[_0x8bb1('0x13')](0x1f4,_0x336709[_0x8bb1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index d56ca72..b218734 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 _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4ed58d,_0x46774b){var _0x25a561=function(_0x26bcd0){while(--_0x26bcd0){_0x4ed58d['push'](_0x4ed58d['shift']());}};_0x25a561(++_0x46774b);}(_0x34e8,0x12c));var _0x834e=function(_0x22ee69,_0x2bf0f7){_0x22ee69=_0x22ee69-0x0;var _0x54c406=_0x34e8[_0x22ee69];return _0x54c406;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x2c5f2d,_0x10c2d0){var _0x367760=function(_0x24db49){while(--_0x24db49){_0x2c5f2d['push'](_0x2c5f2d['shift']());}};_0x367760(++_0x10c2d0);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f0278a4..613a9e2 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 _0xf66d=['sequelize','exports','STRING'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0xf66d,0x171));var _0xdf66=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xf66d[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0xdf66('0x0'));module[_0xdf66('0x1')]={'name':{'type':Sequelize[_0xdf66('0x2')]},'description':{'type':Sequelize[_0xdf66('0x2')]}}; \ No newline at end of file +var _0x00fb=['STRING'];(function(_0x13755a,_0x2a6a1b){var _0x40003e=function(_0xfdd49b){while(--_0xfdd49b){_0x13755a['push'](_0x13755a['shift']());}};_0x40003e(++_0x2a6a1b);}(_0x00fb,0x117));var _0xb00f=function(_0x873c6b,_0x4e9a60){_0x873c6b=_0x873c6b-0x0;var _0x2da337=_0x00fb[_0x873c6b];return _0x2da337;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb00f('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index c3587fa..080202c 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 _0x1dd2=['body','params','getFields','findOne','DeskField','fields','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','save','update','destroy','then','name','index','map','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','rows','catch','find','create'];(function(_0x59ac19,_0x2b7c57){var _0x290782=function(_0x4a1d99){while(--_0x4a1d99){_0x59ac19['push'](_0x59ac19['shift']());}};_0x290782(++_0x2b7c57);}(_0x1dd2,0xfe));var _0x21dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x21dd('0x0'));var rimraf=require(_0x21dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21dd('0x2'));var rp=require(_0x21dd('0x3'));var moment=require(_0x21dd('0x4'));var BPromise=require(_0x21dd('0x5'));var Mustache=require(_0x21dd('0x6'));var util=require(_0x21dd('0x7'));var path=require(_0x21dd('0x8'));var sox=require(_0x21dd('0x9'));var csv=require(_0x21dd('0xa'));var ejs=require(_0x21dd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21dd('0xc'));var squel=require('squel');var crypto=require(_0x21dd('0xd'));var jsforce=require(_0x21dd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x21dd('0xa'));var querystring=require(_0x21dd('0xf'));var Papa=require(_0x21dd('0x10'));var Redis=require(_0x21dd('0x11'));var authService=require(_0x21dd('0x12'));var qs=require(_0x21dd('0x13'));var as=require(_0x21dd('0x14'));var hardwareService=require(_0x21dd('0x15'));var logger=require(_0x21dd('0x16'))(_0x21dd('0x17'));var utils=require(_0x21dd('0x18'));var config=require(_0x21dd('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x21dd('0x1a'))['db'];function respondWithStatusCode(_0x11dcd6,_0x39bee3){_0x39bee3=_0x39bee3||0xcc;return function(_0x94fe35){if(_0x94fe35){return _0x11dcd6[_0x21dd('0x1b')](_0x39bee3);}return _0x11dcd6[_0x21dd('0x1c')](_0x39bee3)[_0x21dd('0x1d')]();};}function respondWithResult(_0x6ac096,_0x196742){_0x196742=_0x196742||0xc8;return function(_0x87e71a){if(_0x87e71a){return _0x6ac096[_0x21dd('0x1c')](_0x196742)[_0x21dd('0x1e')](_0x87e71a);}};}function respondWithFilteredResult(_0x1a2d1f,_0x114b32){return function(_0x15d39a){if(_0x15d39a){var _0x3d8932=typeof _0x114b32[_0x21dd('0x1f')]===_0x21dd('0x20')&&typeof _0x114b32['limit']===_0x21dd('0x20');var _0x1236fe=_0x15d39a[_0x21dd('0x21')];var _0x4e8139=_0x3d8932?0x0:_0x114b32[_0x21dd('0x1f')];var _0x3b5efb=_0x3d8932?_0x15d39a[_0x21dd('0x21')]:_0x114b32[_0x21dd('0x1f')]+_0x114b32[_0x21dd('0x22')];var _0x3a77b3;if(_0x3b5efb>=_0x1236fe){_0x3b5efb=_0x1236fe;_0x3a77b3=0xc8;}else{_0x3a77b3=0xce;}_0x1a2d1f[_0x21dd('0x1c')](_0x3a77b3);return _0x1a2d1f[_0x21dd('0x23')]('Content-Range',_0x4e8139+'-'+_0x3b5efb+'/'+_0x1236fe)[_0x21dd('0x1e')](_0x15d39a);}return null;};}function patchUpdates(_0xbf4903){return function(_0x317f4c){try{jsonpatch['apply'](_0x317f4c,_0xbf4903,!![]);}catch(_0x4d348c){return BPromise['reject'](_0x4d348c);}return _0x317f4c[_0x21dd('0x24')]();};}function saveUpdates(_0x5aff58,_0x57045a){return function(_0x2a1296){if(_0x2a1296){return _0x2a1296[_0x21dd('0x25')](_0x5aff58)['then'](function(_0x146779){return _0x146779;});}return null;};}function removeEntity(_0x44b832,_0x1051c3){return function(_0x3efa01){if(_0x3efa01){return _0x3efa01[_0x21dd('0x26')]()[_0x21dd('0x27')](function(){_0x44b832[_0x21dd('0x1c')](0xcc)[_0x21dd('0x1d')]();});}};}function handleEntityNotFound(_0x27a220,_0x2103d8){return function(_0x971249){if(!_0x971249){_0x27a220[_0x21dd('0x1b')](0x194);}return _0x971249;};}function handleError(_0x3e337d,_0x9c0bd0){_0x9c0bd0=_0x9c0bd0||0x1f4;return function(_0xf491cf){logger['error'](_0xf491cf['stack']);if(_0xf491cf['name']){delete _0xf491cf[_0x21dd('0x28')];}_0x3e337d[_0x21dd('0x1c')](_0x9c0bd0)['send'](_0xf491cf);};}exports[_0x21dd('0x29')]=function(_0xc39cb9,_0x15be3c){var _0x358545={},_0x299576={},_0x10dfce={'count':0x0,'rows':[]};var _0x43115a=_[_0x21dd('0x2a')](db[_0x21dd('0x2b')][_0x21dd('0x2c')],function(_0x724f4a){return{'name':_0x724f4a[_0x21dd('0x2d')],'type':_0x724f4a['type'][_0x21dd('0x2e')]};});_0x299576[_0x21dd('0x2f')]=_[_0x21dd('0x2a')](_0x43115a,'name');_0x299576[_0x21dd('0x30')]=_[_0x21dd('0x31')](_0xc39cb9[_0x21dd('0x30')]);_0x299576[_0x21dd('0x32')]=_[_0x21dd('0x33')](_0x299576[_0x21dd('0x2f')],_0x299576[_0x21dd('0x30')]);_0x358545[_0x21dd('0x34')]=_[_0x21dd('0x33')](_0x299576[_0x21dd('0x2f')],qs['fields'](_0xc39cb9[_0x21dd('0x30')]['fields']));_0x358545[_0x21dd('0x34')]=_0x358545['attributes'][_0x21dd('0x35')]?_0x358545[_0x21dd('0x34')]:_0x299576[_0x21dd('0x2f')];if(!_0xc39cb9[_0x21dd('0x30')][_0x21dd('0x36')](_0x21dd('0x37'))){_0x358545[_0x21dd('0x22')]=qs['limit'](_0xc39cb9[_0x21dd('0x30')][_0x21dd('0x22')]);_0x358545[_0x21dd('0x1f')]=qs[_0x21dd('0x1f')](_0xc39cb9[_0x21dd('0x30')][_0x21dd('0x1f')]);}_0x358545[_0x21dd('0x38')]=qs[_0x21dd('0x39')](_0xc39cb9[_0x21dd('0x30')]['sort']);_0x358545[_0x21dd('0x3a')]=qs[_0x21dd('0x32')](_[_0x21dd('0x3b')](_0xc39cb9[_0x21dd('0x30')],_0x299576[_0x21dd('0x32')]),_0x43115a);if(_0xc39cb9[_0x21dd('0x30')][_0x21dd('0x3c')]){_0x358545[_0x21dd('0x3a')]=_['merge'](_0x358545[_0x21dd('0x3a')],{'$or':_[_0x21dd('0x2a')](_0x43115a,function(_0x3203c4){if(_0x3203c4[_0x21dd('0x3d')]!=='VIRTUAL'){var _0x3c5ff4={};_0x3c5ff4[_0x3203c4[_0x21dd('0x28')]]={'$like':'%'+_0xc39cb9['query']['filter']+'%'};return _0x3c5ff4;}})});}_0x358545=_[_0x21dd('0x3e')]({},_0x358545,_0xc39cb9[_0x21dd('0x3f')]);var _0x3a30b4={'where':_0x358545['where']};return db[_0x21dd('0x2b')]['count'](_0x3a30b4)[_0x21dd('0x27')](function(_0x46a4f9){_0x10dfce['count']=_0x46a4f9;if(_0xc39cb9['query'][_0x21dd('0x40')]){_0x358545[_0x21dd('0x41')]=[{'all':!![]}];}return db[_0x21dd('0x2b')]['findAll'](_0x358545);})[_0x21dd('0x27')](function(_0x515064){_0x10dfce[_0x21dd('0x42')]=_0x515064;return _0x10dfce;})[_0x21dd('0x27')](respondWithFilteredResult(_0x15be3c,_0x358545))[_0x21dd('0x43')](handleError(_0x15be3c,null));};exports['show']=function(_0x217352,_0x681c66){var _0x3ddd69={'raw':![],'where':{'id':_0x217352['params']['id']}},_0x4bec03={};_0x4bec03['model']=_[_0x21dd('0x31')](db[_0x21dd('0x2b')][_0x21dd('0x2c')]);_0x4bec03[_0x21dd('0x30')]=_[_0x21dd('0x31')](_0x217352[_0x21dd('0x30')]);_0x4bec03[_0x21dd('0x32')]=_['intersection'](_0x4bec03[_0x21dd('0x2f')],_0x4bec03[_0x21dd('0x30')]);_0x3ddd69[_0x21dd('0x34')]=_[_0x21dd('0x33')](_0x4bec03[_0x21dd('0x2f')],qs['fields'](_0x217352[_0x21dd('0x30')]['fields']));_0x3ddd69['attributes']=_0x3ddd69[_0x21dd('0x34')]['length']?_0x3ddd69[_0x21dd('0x34')]:_0x4bec03[_0x21dd('0x2f')];if(_0x217352[_0x21dd('0x30')][_0x21dd('0x40')]){_0x3ddd69[_0x21dd('0x41')]=[{'all':!![]}];}_0x3ddd69=_['merge']({},_0x3ddd69,_0x217352[_0x21dd('0x3f')]);return db[_0x21dd('0x2b')][_0x21dd('0x44')](_0x3ddd69)[_0x21dd('0x27')](handleEntityNotFound(_0x681c66,null))[_0x21dd('0x27')](respondWithResult(_0x681c66,null))[_0x21dd('0x43')](handleError(_0x681c66,null));};exports[_0x21dd('0x45')]=function(_0x4cc52d,_0x4f161){return db[_0x21dd('0x2b')][_0x21dd('0x45')](_0x4cc52d[_0x21dd('0x46')],{})[_0x21dd('0x27')](respondWithResult(_0x4f161,0xc9))['catch'](handleError(_0x4f161,null));};exports['update']=function(_0x97aa6b,_0x270a23){if(_0x97aa6b['body']['id']){delete _0x97aa6b[_0x21dd('0x46')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x97aa6b[_0x21dd('0x47')]['id']}})[_0x21dd('0x27')](handleEntityNotFound(_0x270a23,null))['then'](saveUpdates(_0x97aa6b['body'],null))[_0x21dd('0x27')](respondWithResult(_0x270a23,null))['catch'](handleError(_0x270a23,null));};exports[_0x21dd('0x26')]=function(_0x1cd01c,_0x471cb8){return db[_0x21dd('0x2b')][_0x21dd('0x44')]({'where':{'id':_0x1cd01c['params']['id']}})[_0x21dd('0x27')](handleEntityNotFound(_0x471cb8,null))[_0x21dd('0x27')](removeEntity(_0x471cb8,null))[_0x21dd('0x43')](handleError(_0x471cb8,null));};exports[_0x21dd('0x48')]=function(_0x3e159a,_0x5c96a8,_0xe165ee){var _0xbef532={};var _0x80cea2={};var _0x4dcf1c;var _0x534bec;return db[_0x21dd('0x2b')][_0x21dd('0x49')]({'where':{'id':_0x3e159a[_0x21dd('0x47')]['id']}})[_0x21dd('0x27')](handleEntityNotFound(_0x5c96a8,null))[_0x21dd('0x27')](function(_0x2bb95b){if(_0x2bb95b){_0x4dcf1c=_0x2bb95b;_0x80cea2[_0x21dd('0x2f')]=_[_0x21dd('0x31')](db[_0x21dd('0x4a')][_0x21dd('0x2c')]);_0x80cea2['query']=_[_0x21dd('0x31')](_0x3e159a[_0x21dd('0x30')]);_0x80cea2[_0x21dd('0x32')]=_[_0x21dd('0x33')](_0x80cea2['model'],_0x80cea2['query']);_0xbef532[_0x21dd('0x34')]=_[_0x21dd('0x33')](_0x80cea2['model'],qs[_0x21dd('0x4b')](_0x3e159a[_0x21dd('0x30')]['fields']));_0xbef532['attributes']=_0xbef532[_0x21dd('0x34')][_0x21dd('0x35')]?_0xbef532[_0x21dd('0x34')]:_0x80cea2[_0x21dd('0x2f')];_0xbef532[_0x21dd('0x38')]=qs['sort'](_0x3e159a[_0x21dd('0x30')][_0x21dd('0x39')]);_0xbef532['where']=qs[_0x21dd('0x32')](_[_0x21dd('0x3b')](_0x3e159a[_0x21dd('0x30')],_0x80cea2[_0x21dd('0x32')]));if(_0x3e159a['query'][_0x21dd('0x3c')]){_0xbef532[_0x21dd('0x3a')]=_[_0x21dd('0x3e')](_0xbef532['where'],{'$or':_[_0x21dd('0x2a')](_0xbef532[_0x21dd('0x34')],function(_0x4178ff){var _0x2ad914={};_0x2ad914[_0x4178ff]={'$like':'%'+_0x3e159a[_0x21dd('0x30')][_0x21dd('0x3c')]+'%'};return _0x2ad914;})});}_0xbef532=_[_0x21dd('0x3e')]({},_0xbef532,_0x3e159a[_0x21dd('0x3f')]);return _0x4dcf1c[_0x21dd('0x48')](_0xbef532);}})[_0x21dd('0x27')](function(_0xc21dca){if(_0xc21dca){_0x534bec=_0xc21dca[_0x21dd('0x35')];if(!_0x3e159a[_0x21dd('0x30')][_0x21dd('0x36')](_0x21dd('0x37'))){_0xbef532[_0x21dd('0x22')]=qs[_0x21dd('0x22')](_0x3e159a['query'][_0x21dd('0x22')]);_0xbef532[_0x21dd('0x1f')]=qs['offset'](_0x3e159a[_0x21dd('0x30')][_0x21dd('0x1f')]);}return _0x4dcf1c[_0x21dd('0x48')](_0xbef532);}})[_0x21dd('0x27')](function(_0x2cf126){if(_0x2cf126){return _0x2cf126?{'count':_0x534bec,'rows':_0x2cf126}:null;}})[_0x21dd('0x27')](respondWithResult(_0x5c96a8,null))['catch'](handleError(_0x5c96a8,null));};exports['getSubjects']=function(_0x438d83,_0x3d1d2f,_0x4ea351){var _0x36597b={};var _0x53a4f4={};var _0x37a461;var _0x1d64e3;return db[_0x21dd('0x2b')]['findOne']({'where':{'id':_0x438d83[_0x21dd('0x47')]['id']}})[_0x21dd('0x27')](handleEntityNotFound(_0x3d1d2f,null))[_0x21dd('0x27')](function(_0x14673c){if(_0x14673c){_0x37a461=_0x14673c;_0x53a4f4[_0x21dd('0x2f')]=_[_0x21dd('0x31')](db[_0x21dd('0x4a')][_0x21dd('0x2c')]);_0x53a4f4['query']=_[_0x21dd('0x31')](_0x438d83[_0x21dd('0x30')]);_0x53a4f4[_0x21dd('0x32')]=_['intersection'](_0x53a4f4[_0x21dd('0x2f')],_0x53a4f4[_0x21dd('0x30')]);_0x36597b[_0x21dd('0x34')]=_['intersection'](_0x53a4f4['model'],qs['fields'](_0x438d83[_0x21dd('0x30')][_0x21dd('0x4b')]));_0x36597b[_0x21dd('0x34')]=_0x36597b[_0x21dd('0x34')][_0x21dd('0x35')]?_0x36597b[_0x21dd('0x34')]:_0x53a4f4[_0x21dd('0x2f')];_0x36597b[_0x21dd('0x38')]=qs[_0x21dd('0x39')](_0x438d83[_0x21dd('0x30')][_0x21dd('0x39')]);_0x36597b[_0x21dd('0x3a')]=qs[_0x21dd('0x32')](_[_0x21dd('0x3b')](_0x438d83[_0x21dd('0x30')],_0x53a4f4[_0x21dd('0x32')]));if(_0x438d83['query']['filter']){_0x36597b[_0x21dd('0x3a')]=_[_0x21dd('0x3e')](_0x36597b[_0x21dd('0x3a')],{'$or':_[_0x21dd('0x2a')](_0x36597b[_0x21dd('0x34')],function(_0x40e243){var _0x33577d={};_0x33577d[_0x40e243]={'$like':'%'+_0x438d83['query'][_0x21dd('0x3c')]+'%'};return _0x33577d;})});}_0x36597b=_[_0x21dd('0x3e')]({},_0x36597b,_0x438d83[_0x21dd('0x3f')]);return _0x37a461[_0x21dd('0x4c')](_0x36597b);}})['then'](function(_0x20b057){if(_0x20b057){_0x1d64e3=_0x20b057[_0x21dd('0x35')];if(!_0x438d83[_0x21dd('0x30')][_0x21dd('0x36')](_0x21dd('0x37'))){_0x36597b[_0x21dd('0x22')]=qs[_0x21dd('0x22')](_0x438d83['query'][_0x21dd('0x22')]);_0x36597b[_0x21dd('0x1f')]=qs[_0x21dd('0x1f')](_0x438d83[_0x21dd('0x30')]['offset']);}return _0x37a461[_0x21dd('0x4c')](_0x36597b);}})[_0x21dd('0x27')](function(_0x23edde){if(_0x23edde){return _0x23edde?{'count':_0x1d64e3,'rows':_0x23edde}:null;}})[_0x21dd('0x27')](respondWithResult(_0x3d1d2f,null))[_0x21dd('0x43')](handleError(_0x3d1d2f,null));};exports[_0x21dd('0x4d')]=function(_0x24bba6,_0x5c7b99,_0x385461){var _0x121d15={};var _0x398b99={};var _0x12ec94;var _0x15c35f;return db[_0x21dd('0x2b')]['findOne']({'where':{'id':_0x24bba6['params']['id']}})[_0x21dd('0x27')](handleEntityNotFound(_0x5c7b99,null))[_0x21dd('0x27')](function(_0x16815b){if(_0x16815b){_0x12ec94=_0x16815b;_0x398b99['model']=_[_0x21dd('0x31')](db[_0x21dd('0x4a')][_0x21dd('0x2c')]);_0x398b99[_0x21dd('0x30')]=_[_0x21dd('0x31')](_0x24bba6[_0x21dd('0x30')]);_0x398b99[_0x21dd('0x32')]=_['intersection'](_0x398b99[_0x21dd('0x2f')],_0x398b99[_0x21dd('0x30')]);_0x121d15['attributes']=_[_0x21dd('0x33')](_0x398b99[_0x21dd('0x2f')],qs[_0x21dd('0x4b')](_0x24bba6[_0x21dd('0x30')][_0x21dd('0x4b')]));_0x121d15[_0x21dd('0x34')]=_0x121d15[_0x21dd('0x34')][_0x21dd('0x35')]?_0x121d15[_0x21dd('0x34')]:_0x398b99[_0x21dd('0x2f')];_0x121d15['order']=qs[_0x21dd('0x39')](_0x24bba6[_0x21dd('0x30')]['sort']);_0x121d15['where']=qs['filters'](_[_0x21dd('0x3b')](_0x24bba6[_0x21dd('0x30')],_0x398b99[_0x21dd('0x32')]));if(_0x24bba6['query'][_0x21dd('0x3c')]){_0x121d15[_0x21dd('0x3a')]=_['merge'](_0x121d15[_0x21dd('0x3a')],{'$or':_[_0x21dd('0x2a')](_0x121d15['attributes'],function(_0x3ac8ea){var _0x42d3c7={};_0x42d3c7[_0x3ac8ea]={'$like':'%'+_0x24bba6['query']['filter']+'%'};return _0x42d3c7;})});}_0x121d15=_['merge']({},_0x121d15,_0x24bba6[_0x21dd('0x3f')]);return _0x12ec94['getDescriptions'](_0x121d15);}})[_0x21dd('0x27')](function(_0x4c760e){if(_0x4c760e){_0x15c35f=_0x4c760e[_0x21dd('0x35')];if(!_0x24bba6[_0x21dd('0x30')][_0x21dd('0x36')]('nolimit')){_0x121d15[_0x21dd('0x22')]=qs[_0x21dd('0x22')](_0x24bba6[_0x21dd('0x30')]['limit']);_0x121d15[_0x21dd('0x1f')]=qs[_0x21dd('0x1f')](_0x24bba6[_0x21dd('0x30')]['offset']);}return _0x12ec94['getDescriptions'](_0x121d15);}})['then'](function(_0x1ff319){if(_0x1ff319){return _0x1ff319?{'count':_0x15c35f,'rows':_0x1ff319}:null;}})[_0x21dd('0x27')](respondWithResult(_0x5c7b99,null))['catch'](handleError(_0x5c7b99,null));};exports['getTags']=function(_0x112dcd,_0x369169,_0x3f9aee){var _0x4db27e={};var _0x1a3f04={};var _0x269cb5;var _0x6f47aa;return db[_0x21dd('0x2b')]['findOne']({'where':{'id':_0x112dcd[_0x21dd('0x47')]['id']}})['then'](handleEntityNotFound(_0x369169,null))[_0x21dd('0x27')](function(_0x2a0b8f){if(_0x2a0b8f){_0x269cb5=_0x2a0b8f;_0x1a3f04[_0x21dd('0x2f')]=_[_0x21dd('0x31')](db['Tag']['rawAttributes']);_0x1a3f04[_0x21dd('0x30')]=_[_0x21dd('0x31')](_0x112dcd[_0x21dd('0x30')]);_0x1a3f04[_0x21dd('0x32')]=_[_0x21dd('0x33')](_0x1a3f04['model'],_0x1a3f04[_0x21dd('0x30')]);_0x4db27e[_0x21dd('0x34')]=_[_0x21dd('0x33')](_0x1a3f04[_0x21dd('0x2f')],qs[_0x21dd('0x4b')](_0x112dcd[_0x21dd('0x30')]['fields']));_0x4db27e[_0x21dd('0x34')]=_0x4db27e[_0x21dd('0x34')][_0x21dd('0x35')]?_0x4db27e[_0x21dd('0x34')]:_0x1a3f04['model'];_0x4db27e[_0x21dd('0x38')]=qs[_0x21dd('0x39')](_0x112dcd[_0x21dd('0x30')][_0x21dd('0x39')]);_0x4db27e[_0x21dd('0x3a')]=qs['filters'](_[_0x21dd('0x3b')](_0x112dcd[_0x21dd('0x30')],_0x1a3f04[_0x21dd('0x32')]));if(_0x112dcd[_0x21dd('0x30')][_0x21dd('0x3c')]){_0x4db27e['where']=_[_0x21dd('0x3e')](_0x4db27e['where'],{'$or':_[_0x21dd('0x2a')](_0x4db27e[_0x21dd('0x34')],function(_0x66ce1f){var _0x618eab={};_0x618eab[_0x66ce1f]={'$like':'%'+_0x112dcd[_0x21dd('0x30')][_0x21dd('0x3c')]+'%'};return _0x618eab;})});}_0x4db27e=_[_0x21dd('0x3e')]({},_0x4db27e,_0x112dcd[_0x21dd('0x3f')]);return _0x269cb5[_0x21dd('0x4e')](_0x4db27e);}})['then'](function(_0x20aa63){if(_0x20aa63){_0x6f47aa=_0x20aa63[_0x21dd('0x35')];if(!_0x112dcd['query']['hasOwnProperty'](_0x21dd('0x37'))){_0x4db27e[_0x21dd('0x22')]=qs['limit'](_0x112dcd[_0x21dd('0x30')]['limit']);_0x4db27e[_0x21dd('0x1f')]=qs[_0x21dd('0x1f')](_0x112dcd['query'][_0x21dd('0x1f')]);}return _0x269cb5[_0x21dd('0x4e')](_0x4db27e);}})[_0x21dd('0x27')](function(_0x5a0108){if(_0x5a0108){return _0x5a0108?{'count':_0x6f47aa,'rows':_0x5a0108}:null;}})[_0x21dd('0x27')](respondWithResult(_0x369169,null))[_0x21dd('0x43')](handleError(_0x369169,null));};exports[_0x21dd('0x4f')]=function(_0x239b3d,_0x4d6bf0,_0x26a153){if(_0x239b3d[_0x21dd('0x46')]['id']){delete _0x239b3d[_0x21dd('0x46')]['id'];}return db[_0x21dd('0x2b')][_0x21dd('0x49')]({'where':{'id':_0x239b3d[_0x21dd('0x47')]['id']}})[_0x21dd('0x27')](handleEntityNotFound(_0x4d6bf0,null))['then'](function(_0x12fc33){if(_0x12fc33){return _0x12fc33[_0x21dd('0x4f')](_0x239b3d[_0x21dd('0x46')][_0x21dd('0x50')]||[]);}return null;})[_0x21dd('0x27')](respondWithResult(_0x4d6bf0,null))[_0x21dd('0x43')](handleError(_0x4d6bf0,null));}; \ No newline at end of file +var _0x16a8=['request-promise','bluebird','mustache','path','sox','ejs','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','query','keys','intersection','attributes','fields','model','hasOwnProperty','sort','filters','pick','filter','merge','where','VIRTUAL','include','rows','show','params','includeAll','options','find','create','body','catch','update','getFields','findOne','order','nolimit','getSubjects','DeskField','length','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir'];(function(_0x584b9d,_0x1cb5c5){var _0x172053=function(_0x5036ec){while(--_0x5036ec){_0x584b9d['push'](_0x584b9d['shift']());}};_0x172053(++_0x1cb5c5);}(_0x16a8,0xa5));var _0x816a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x16a8[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x816a('0x0'));var rimraf=require(_0x816a('0x1'));var zipdir=require(_0x816a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x816a('0x3'));var moment=require('moment');var BPromise=require(_0x816a('0x4'));var Mustache=require(_0x816a('0x5'));var util=require('util');var path=require(_0x816a('0x6'));var sox=require(_0x816a('0x7'));var csv=require('to-csv');var ejs=require(_0x816a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x816a('0x9'));var jsforce=require(_0x816a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x816a('0xb'));var querystring=require(_0x816a('0xc'));var Papa=require(_0x816a('0xd'));var Redis=require(_0x816a('0xe'));var authService=require(_0x816a('0xf'));var qs=require(_0x816a('0x10'));var as=require(_0x816a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x816a('0x12'))(_0x816a('0x13'));var utils=require(_0x816a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x816a('0x15'));var db=require(_0x816a('0x16'))['db'];function respondWithStatusCode(_0x5d5c6d,_0x485cf9){_0x485cf9=_0x485cf9||0xcc;return function(_0xddd554){if(_0xddd554){return _0x5d5c6d[_0x816a('0x17')](_0x485cf9);}return _0x5d5c6d[_0x816a('0x18')](_0x485cf9)[_0x816a('0x19')]();};}function respondWithResult(_0x2b04d2,_0x34bda6){_0x34bda6=_0x34bda6||0xc8;return function(_0x41f943){if(_0x41f943){return _0x2b04d2[_0x816a('0x18')](_0x34bda6)[_0x816a('0x1a')](_0x41f943);}};}function respondWithFilteredResult(_0x3d012b,_0x6ed84e){return function(_0x1c4a78){if(_0x1c4a78){var _0x40f94b=typeof _0x6ed84e[_0x816a('0x1b')]===_0x816a('0x1c')&&typeof _0x6ed84e[_0x816a('0x1d')]===_0x816a('0x1c');var _0x5f1c38=_0x1c4a78['count'];var _0x28afd4=_0x40f94b?0x0:_0x6ed84e[_0x816a('0x1b')];var _0x81162f=_0x40f94b?_0x1c4a78[_0x816a('0x1e')]:_0x6ed84e[_0x816a('0x1b')]+_0x6ed84e[_0x816a('0x1d')];var _0x27b62a;if(_0x81162f>=_0x5f1c38){_0x81162f=_0x5f1c38;_0x27b62a=0xc8;}else{_0x27b62a=0xce;}_0x3d012b[_0x816a('0x18')](_0x27b62a);return _0x3d012b[_0x816a('0x1f')](_0x816a('0x20'),_0x28afd4+'-'+_0x81162f+'/'+_0x5f1c38)[_0x816a('0x1a')](_0x1c4a78);}return null;};}function patchUpdates(_0x159c00){return function(_0x11cf96){try{jsonpatch['apply'](_0x11cf96,_0x159c00,!![]);}catch(_0x1e092b){return BPromise[_0x816a('0x21')](_0x1e092b);}return _0x11cf96[_0x816a('0x22')]();};}function saveUpdates(_0x5731f8,_0x2d926c){return function(_0x56c858){if(_0x56c858){return _0x56c858['update'](_0x5731f8)['then'](function(_0xbcfa02){return _0xbcfa02;});}return null;};}function removeEntity(_0x398e4c,_0x4f2fe7){return function(_0x2087ff){if(_0x2087ff){return _0x2087ff[_0x816a('0x23')]()[_0x816a('0x24')](function(){_0x398e4c['status'](0xcc)[_0x816a('0x19')]();});}};}function handleEntityNotFound(_0x465412,_0x80c28){return function(_0x4429f5){if(!_0x4429f5){_0x465412[_0x816a('0x17')](0x194);}return _0x4429f5;};}function handleError(_0x238b9b,_0x8b846b){_0x8b846b=_0x8b846b||0x1f4;return function(_0xcc7780){logger[_0x816a('0x25')](_0xcc7780[_0x816a('0x26')]);if(_0xcc7780[_0x816a('0x27')]){delete _0xcc7780['name'];}_0x238b9b['status'](_0x8b846b)[_0x816a('0x28')](_0xcc7780);};}exports[_0x816a('0x29')]=function(_0xc631f4,_0x82ee63){var _0x171742={},_0x507665={},_0x191a69={'count':0x0,'rows':[]};var _0x16cf4d=_[_0x816a('0x2a')](db[_0x816a('0x2b')][_0x816a('0x2c')],function(_0x7236da){return{'name':_0x7236da[_0x816a('0x2d')],'type':_0x7236da[_0x816a('0x2e')]['key']};});_0x507665['model']=_['map'](_0x16cf4d,_0x816a('0x27'));_0x507665[_0x816a('0x2f')]=_[_0x816a('0x30')](_0xc631f4['query']);_0x507665['filters']=_[_0x816a('0x31')](_0x507665['model'],_0x507665[_0x816a('0x2f')]);_0x171742[_0x816a('0x32')]=_[_0x816a('0x31')](_0x507665['model'],qs[_0x816a('0x33')](_0xc631f4[_0x816a('0x2f')][_0x816a('0x33')]));_0x171742[_0x816a('0x32')]=_0x171742['attributes']['length']?_0x171742[_0x816a('0x32')]:_0x507665[_0x816a('0x34')];if(!_0xc631f4[_0x816a('0x2f')][_0x816a('0x35')]('nolimit')){_0x171742[_0x816a('0x1d')]=qs['limit'](_0xc631f4[_0x816a('0x2f')][_0x816a('0x1d')]);_0x171742[_0x816a('0x1b')]=qs['offset'](_0xc631f4[_0x816a('0x2f')][_0x816a('0x1b')]);}_0x171742['order']=qs[_0x816a('0x36')](_0xc631f4[_0x816a('0x2f')][_0x816a('0x36')]);_0x171742['where']=qs[_0x816a('0x37')](_[_0x816a('0x38')](_0xc631f4[_0x816a('0x2f')],_0x507665[_0x816a('0x37')]),_0x16cf4d);if(_0xc631f4[_0x816a('0x2f')][_0x816a('0x39')]){_0x171742['where']=_[_0x816a('0x3a')](_0x171742[_0x816a('0x3b')],{'$or':_[_0x816a('0x2a')](_0x16cf4d,function(_0x3fba4e){if(_0x3fba4e[_0x816a('0x2e')]!==_0x816a('0x3c')){var _0x2779e1={};_0x2779e1[_0x3fba4e[_0x816a('0x27')]]={'$like':'%'+_0xc631f4[_0x816a('0x2f')]['filter']+'%'};return _0x2779e1;}})});}_0x171742=_[_0x816a('0x3a')]({},_0x171742,_0xc631f4['options']);var _0x105846={'where':_0x171742[_0x816a('0x3b')]};return db[_0x816a('0x2b')][_0x816a('0x1e')](_0x105846)[_0x816a('0x24')](function(_0x159100){_0x191a69[_0x816a('0x1e')]=_0x159100;if(_0xc631f4['query']['includeAll']){_0x171742[_0x816a('0x3d')]=[{'all':!![]}];}return db[_0x816a('0x2b')]['findAll'](_0x171742);})[_0x816a('0x24')](function(_0x2eba78){_0x191a69[_0x816a('0x3e')]=_0x2eba78;return _0x191a69;})[_0x816a('0x24')](respondWithFilteredResult(_0x82ee63,_0x171742))['catch'](handleError(_0x82ee63,null));};exports[_0x816a('0x3f')]=function(_0x499c67,_0xa1f024){var _0x39a5a5={'raw':![],'where':{'id':_0x499c67[_0x816a('0x40')]['id']}},_0x55f5e4={};_0x55f5e4[_0x816a('0x34')]=_['keys'](db['DeskConfiguration'][_0x816a('0x2c')]);_0x55f5e4[_0x816a('0x2f')]=_[_0x816a('0x30')](_0x499c67[_0x816a('0x2f')]);_0x55f5e4[_0x816a('0x37')]=_['intersection'](_0x55f5e4[_0x816a('0x34')],_0x55f5e4[_0x816a('0x2f')]);_0x39a5a5['attributes']=_[_0x816a('0x31')](_0x55f5e4[_0x816a('0x34')],qs[_0x816a('0x33')](_0x499c67[_0x816a('0x2f')]['fields']));_0x39a5a5[_0x816a('0x32')]=_0x39a5a5[_0x816a('0x32')]['length']?_0x39a5a5['attributes']:_0x55f5e4[_0x816a('0x34')];if(_0x499c67[_0x816a('0x2f')][_0x816a('0x41')]){_0x39a5a5[_0x816a('0x3d')]=[{'all':!![]}];}_0x39a5a5=_[_0x816a('0x3a')]({},_0x39a5a5,_0x499c67[_0x816a('0x42')]);return db['DeskConfiguration'][_0x816a('0x43')](_0x39a5a5)['then'](handleEntityNotFound(_0xa1f024,null))[_0x816a('0x24')](respondWithResult(_0xa1f024,null))['catch'](handleError(_0xa1f024,null));};exports[_0x816a('0x44')]=function(_0x3c8d20,_0x5c355f){return db[_0x816a('0x2b')][_0x816a('0x44')](_0x3c8d20[_0x816a('0x45')],{})[_0x816a('0x24')](respondWithResult(_0x5c355f,0xc9))[_0x816a('0x46')](handleError(_0x5c355f,null));};exports[_0x816a('0x47')]=function(_0x4de6eb,_0x47eba8){if(_0x4de6eb['body']['id']){delete _0x4de6eb[_0x816a('0x45')]['id'];}return db[_0x816a('0x2b')][_0x816a('0x43')]({'where':{'id':_0x4de6eb[_0x816a('0x40')]['id']}})[_0x816a('0x24')](handleEntityNotFound(_0x47eba8,null))[_0x816a('0x24')](saveUpdates(_0x4de6eb[_0x816a('0x45')],null))[_0x816a('0x24')](respondWithResult(_0x47eba8,null))[_0x816a('0x46')](handleError(_0x47eba8,null));};exports['destroy']=function(_0x48783d,_0x482c9c){return db[_0x816a('0x2b')][_0x816a('0x43')]({'where':{'id':_0x48783d['params']['id']}})[_0x816a('0x24')](handleEntityNotFound(_0x482c9c,null))[_0x816a('0x24')](removeEntity(_0x482c9c,null))[_0x816a('0x46')](handleError(_0x482c9c,null));};exports[_0x816a('0x48')]=function(_0x48178d,_0x5348bc,_0x5d32af){var _0x506ef1={};var _0x5d85c8={};var _0x56931b;var _0x38fe02;return db[_0x816a('0x2b')][_0x816a('0x49')]({'where':{'id':_0x48178d[_0x816a('0x40')]['id']}})[_0x816a('0x24')](handleEntityNotFound(_0x5348bc,null))[_0x816a('0x24')](function(_0x3cd250){if(_0x3cd250){_0x56931b=_0x3cd250;_0x5d85c8[_0x816a('0x34')]=_['keys'](db['DeskField'][_0x816a('0x2c')]);_0x5d85c8['query']=_[_0x816a('0x30')](_0x48178d[_0x816a('0x2f')]);_0x5d85c8['filters']=_[_0x816a('0x31')](_0x5d85c8[_0x816a('0x34')],_0x5d85c8[_0x816a('0x2f')]);_0x506ef1['attributes']=_[_0x816a('0x31')](_0x5d85c8[_0x816a('0x34')],qs[_0x816a('0x33')](_0x48178d['query'][_0x816a('0x33')]));_0x506ef1['attributes']=_0x506ef1[_0x816a('0x32')]['length']?_0x506ef1['attributes']:_0x5d85c8[_0x816a('0x34')];_0x506ef1[_0x816a('0x4a')]=qs[_0x816a('0x36')](_0x48178d['query']['sort']);_0x506ef1[_0x816a('0x3b')]=qs['filters'](_[_0x816a('0x38')](_0x48178d['query'],_0x5d85c8[_0x816a('0x37')]));if(_0x48178d[_0x816a('0x2f')][_0x816a('0x39')]){_0x506ef1['where']=_[_0x816a('0x3a')](_0x506ef1[_0x816a('0x3b')],{'$or':_['map'](_0x506ef1[_0x816a('0x32')],function(_0x3b479a){var _0x371971={};_0x371971[_0x3b479a]={'$like':'%'+_0x48178d['query'][_0x816a('0x39')]+'%'};return _0x371971;})});}_0x506ef1=_[_0x816a('0x3a')]({},_0x506ef1,_0x48178d[_0x816a('0x42')]);return _0x56931b[_0x816a('0x48')](_0x506ef1);}})[_0x816a('0x24')](function(_0x2e2016){if(_0x2e2016){_0x38fe02=_0x2e2016['length'];if(!_0x48178d['query'][_0x816a('0x35')](_0x816a('0x4b'))){_0x506ef1[_0x816a('0x1d')]=qs[_0x816a('0x1d')](_0x48178d['query']['limit']);_0x506ef1['offset']=qs['offset'](_0x48178d[_0x816a('0x2f')][_0x816a('0x1b')]);}return _0x56931b[_0x816a('0x48')](_0x506ef1);}})['then'](function(_0x5c9b37){if(_0x5c9b37){return _0x5c9b37?{'count':_0x38fe02,'rows':_0x5c9b37}:null;}})['then'](respondWithResult(_0x5348bc,null))[_0x816a('0x46')](handleError(_0x5348bc,null));};exports[_0x816a('0x4c')]=function(_0x419028,_0x311cdd,_0x4b9883){var _0x22d746={};var _0x5a2b44={};var _0x5375b8;var _0x16cff5;return db[_0x816a('0x2b')][_0x816a('0x49')]({'where':{'id':_0x419028['params']['id']}})[_0x816a('0x24')](handleEntityNotFound(_0x311cdd,null))[_0x816a('0x24')](function(_0x52c642){if(_0x52c642){_0x5375b8=_0x52c642;_0x5a2b44['model']=_[_0x816a('0x30')](db[_0x816a('0x4d')][_0x816a('0x2c')]);_0x5a2b44['query']=_[_0x816a('0x30')](_0x419028['query']);_0x5a2b44[_0x816a('0x37')]=_[_0x816a('0x31')](_0x5a2b44[_0x816a('0x34')],_0x5a2b44['query']);_0x22d746[_0x816a('0x32')]=_[_0x816a('0x31')](_0x5a2b44['model'],qs[_0x816a('0x33')](_0x419028['query'][_0x816a('0x33')]));_0x22d746[_0x816a('0x32')]=_0x22d746['attributes']['length']?_0x22d746[_0x816a('0x32')]:_0x5a2b44['model'];_0x22d746[_0x816a('0x4a')]=qs['sort'](_0x419028[_0x816a('0x2f')][_0x816a('0x36')]);_0x22d746[_0x816a('0x3b')]=qs['filters'](_['pick'](_0x419028[_0x816a('0x2f')],_0x5a2b44[_0x816a('0x37')]));if(_0x419028[_0x816a('0x2f')][_0x816a('0x39')]){_0x22d746[_0x816a('0x3b')]=_[_0x816a('0x3a')](_0x22d746[_0x816a('0x3b')],{'$or':_[_0x816a('0x2a')](_0x22d746[_0x816a('0x32')],function(_0x2392c4){var _0x5a0f12={};_0x5a0f12[_0x2392c4]={'$like':'%'+_0x419028[_0x816a('0x2f')][_0x816a('0x39')]+'%'};return _0x5a0f12;})});}_0x22d746=_[_0x816a('0x3a')]({},_0x22d746,_0x419028[_0x816a('0x42')]);return _0x5375b8[_0x816a('0x4c')](_0x22d746);}})[_0x816a('0x24')](function(_0x2fa341){if(_0x2fa341){_0x16cff5=_0x2fa341[_0x816a('0x4e')];if(!_0x419028[_0x816a('0x2f')][_0x816a('0x35')](_0x816a('0x4b'))){_0x22d746[_0x816a('0x1d')]=qs[_0x816a('0x1d')](_0x419028[_0x816a('0x2f')][_0x816a('0x1d')]);_0x22d746[_0x816a('0x1b')]=qs[_0x816a('0x1b')](_0x419028[_0x816a('0x2f')][_0x816a('0x1b')]);}return _0x5375b8[_0x816a('0x4c')](_0x22d746);}})[_0x816a('0x24')](function(_0x5f1b23){if(_0x5f1b23){return _0x5f1b23?{'count':_0x16cff5,'rows':_0x5f1b23}:null;}})[_0x816a('0x24')](respondWithResult(_0x311cdd,null))[_0x816a('0x46')](handleError(_0x311cdd,null));};exports[_0x816a('0x4f')]=function(_0x31d75d,_0x52e516,_0x532055){var _0x57504f={};var _0x595a18={};var _0x46a08d;var _0x56db27;return db['DeskConfiguration'][_0x816a('0x49')]({'where':{'id':_0x31d75d[_0x816a('0x40')]['id']}})['then'](handleEntityNotFound(_0x52e516,null))[_0x816a('0x24')](function(_0x454b4e){if(_0x454b4e){_0x46a08d=_0x454b4e;_0x595a18[_0x816a('0x34')]=_[_0x816a('0x30')](db[_0x816a('0x4d')][_0x816a('0x2c')]);_0x595a18['query']=_[_0x816a('0x30')](_0x31d75d[_0x816a('0x2f')]);_0x595a18[_0x816a('0x37')]=_[_0x816a('0x31')](_0x595a18[_0x816a('0x34')],_0x595a18[_0x816a('0x2f')]);_0x57504f[_0x816a('0x32')]=_[_0x816a('0x31')](_0x595a18[_0x816a('0x34')],qs[_0x816a('0x33')](_0x31d75d[_0x816a('0x2f')][_0x816a('0x33')]));_0x57504f[_0x816a('0x32')]=_0x57504f[_0x816a('0x32')]['length']?_0x57504f[_0x816a('0x32')]:_0x595a18[_0x816a('0x34')];_0x57504f[_0x816a('0x4a')]=qs['sort'](_0x31d75d[_0x816a('0x2f')][_0x816a('0x36')]);_0x57504f[_0x816a('0x3b')]=qs[_0x816a('0x37')](_[_0x816a('0x38')](_0x31d75d['query'],_0x595a18[_0x816a('0x37')]));if(_0x31d75d[_0x816a('0x2f')][_0x816a('0x39')]){_0x57504f[_0x816a('0x3b')]=_['merge'](_0x57504f[_0x816a('0x3b')],{'$or':_[_0x816a('0x2a')](_0x57504f[_0x816a('0x32')],function(_0x2b0cb8){var _0x4ca15a={};_0x4ca15a[_0x2b0cb8]={'$like':'%'+_0x31d75d[_0x816a('0x2f')][_0x816a('0x39')]+'%'};return _0x4ca15a;})});}_0x57504f=_[_0x816a('0x3a')]({},_0x57504f,_0x31d75d['options']);return _0x46a08d[_0x816a('0x4f')](_0x57504f);}})['then'](function(_0x1e3ca2){if(_0x1e3ca2){_0x56db27=_0x1e3ca2['length'];if(!_0x31d75d[_0x816a('0x2f')][_0x816a('0x35')](_0x816a('0x4b'))){_0x57504f[_0x816a('0x1d')]=qs['limit'](_0x31d75d[_0x816a('0x2f')][_0x816a('0x1d')]);_0x57504f[_0x816a('0x1b')]=qs[_0x816a('0x1b')](_0x31d75d[_0x816a('0x2f')][_0x816a('0x1b')]);}return _0x46a08d[_0x816a('0x4f')](_0x57504f);}})[_0x816a('0x24')](function(_0x24f841){if(_0x24f841){return _0x24f841?{'count':_0x56db27,'rows':_0x24f841}:null;}})[_0x816a('0x24')](respondWithResult(_0x52e516,null))[_0x816a('0x46')](handleError(_0x52e516,null));};exports[_0x816a('0x50')]=function(_0x1c0d55,_0x469167,_0x48d8a3){var _0x39ee07={};var _0xd42a10={};var _0x1c4936;var _0x260174;return db[_0x816a('0x2b')]['findOne']({'where':{'id':_0x1c0d55[_0x816a('0x40')]['id']}})[_0x816a('0x24')](handleEntityNotFound(_0x469167,null))['then'](function(_0x6bcc01){if(_0x6bcc01){_0x1c4936=_0x6bcc01;_0xd42a10[_0x816a('0x34')]=_[_0x816a('0x30')](db[_0x816a('0x51')][_0x816a('0x2c')]);_0xd42a10[_0x816a('0x2f')]=_[_0x816a('0x30')](_0x1c0d55[_0x816a('0x2f')]);_0xd42a10[_0x816a('0x37')]=_[_0x816a('0x31')](_0xd42a10['model'],_0xd42a10[_0x816a('0x2f')]);_0x39ee07['attributes']=_[_0x816a('0x31')](_0xd42a10['model'],qs[_0x816a('0x33')](_0x1c0d55['query'][_0x816a('0x33')]));_0x39ee07[_0x816a('0x32')]=_0x39ee07[_0x816a('0x32')]['length']?_0x39ee07['attributes']:_0xd42a10[_0x816a('0x34')];_0x39ee07[_0x816a('0x4a')]=qs[_0x816a('0x36')](_0x1c0d55[_0x816a('0x2f')][_0x816a('0x36')]);_0x39ee07[_0x816a('0x3b')]=qs[_0x816a('0x37')](_[_0x816a('0x38')](_0x1c0d55[_0x816a('0x2f')],_0xd42a10[_0x816a('0x37')]));if(_0x1c0d55[_0x816a('0x2f')]['filter']){_0x39ee07[_0x816a('0x3b')]=_[_0x816a('0x3a')](_0x39ee07[_0x816a('0x3b')],{'$or':_[_0x816a('0x2a')](_0x39ee07[_0x816a('0x32')],function(_0x23fa0b){var _0x39a174={};_0x39a174[_0x23fa0b]={'$like':'%'+_0x1c0d55[_0x816a('0x2f')][_0x816a('0x39')]+'%'};return _0x39a174;})});}_0x39ee07=_[_0x816a('0x3a')]({},_0x39ee07,_0x1c0d55[_0x816a('0x42')]);return _0x1c4936['getTags'](_0x39ee07);}})['then'](function(_0xbbedda){if(_0xbbedda){_0x260174=_0xbbedda[_0x816a('0x4e')];if(!_0x1c0d55['query'][_0x816a('0x35')]('nolimit')){_0x39ee07[_0x816a('0x1d')]=qs['limit'](_0x1c0d55[_0x816a('0x2f')][_0x816a('0x1d')]);_0x39ee07['offset']=qs[_0x816a('0x1b')](_0x1c0d55[_0x816a('0x2f')][_0x816a('0x1b')]);}return _0x1c4936['getTags'](_0x39ee07);}})[_0x816a('0x24')](function(_0x50658c){if(_0x50658c){return _0x50658c?{'count':_0x260174,'rows':_0x50658c}:null;}})[_0x816a('0x24')](respondWithResult(_0x469167,null))['catch'](handleError(_0x469167,null));};exports['setTags']=function(_0x269f61,_0x1ebb92,_0x5e8d02){if(_0x269f61['body']['id']){delete _0x269f61[_0x816a('0x45')]['id'];}return db[_0x816a('0x2b')][_0x816a('0x49')]({'where':{'id':_0x269f61[_0x816a('0x40')]['id']}})['then'](handleEntityNotFound(_0x1ebb92,null))[_0x816a('0x24')](function(_0x4e353a){if(_0x4e353a){return _0x4e353a[_0x816a('0x52')](_0x269f61['body'][_0x816a('0x53')]||[]);}return null;})[_0x816a('0x24')](respondWithResult(_0x1ebb92,null))[_0x816a('0x46')](handleError(_0x1ebb92,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 274bf25..f23319a 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 _0xfcee=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xfcee,0x160));var _0xefce=function(_0x2b1a4a,_0x12934){_0x2b1a4a=_0x2b1a4a-0x0;var _0x294bff=_0xfcee[_0x2b1a4a];return _0x294bff;};'use strict';var _=require(_0xefce('0x0'));var util=require('util');var logger=require(_0xefce('0x1'))('api');var moment=require(_0xefce('0x2'));var BPromise=require(_0xefce('0x3'));var rp=require(_0xefce('0x4'));var fs=require('fs');var path=require(_0xefce('0x5'));var rimraf=require('rimraf');var config=require(_0xefce('0x6'));var attributes=require(_0xefce('0x7'));module[_0xefce('0x8')]=function(_0x841939,_0x2934fb){return _0x841939[_0xefce('0x9')](_0xefce('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0b8=['request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x48f8d5,_0x34f897){var _0x47f9e5=function(_0x1b417f){while(--_0x1b417f){_0x48f8d5['push'](_0x48f8d5['shift']());}};_0x47f9e5(++_0x34f897);}(_0xa0b8,0x133));var _0x8a0b=function(_0x3c7a73,_0x3cd0f5){_0x3c7a73=_0x3c7a73-0x0;var _0xd0e2b6=_0xa0b8[_0x3c7a73];return _0xd0e2b6;};'use strict';var _=require(_0x8a0b('0x0'));var util=require('util');var logger=require(_0x8a0b('0x1'))(_0x8a0b('0x2'));var moment=require(_0x8a0b('0x3'));var BPromise=require(_0x8a0b('0x4'));var rp=require(_0x8a0b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a0b('0x6'));var config=require(_0x8a0b('0x7'));var attributes=require(_0x8a0b('0x8'));module[_0x8a0b('0x9')]=function(_0x5726a2,_0x320d22){return _0x5726a2[_0x8a0b('0xa')]('DeskConfiguration',attributes,{'tableName':_0x8a0b('0xb'),'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 8d412df..9c57f25 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 _0xda5b=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x23aab3,_0x42cfb4){var _0x162442=function(_0x2586ca){while(--_0x2586ca){_0x23aab3['push'](_0x23aab3['shift']());}};_0x162442(++_0x42cfb4);}(_0xda5b,0x12d));var _0xbda5=function(_0x43c345,_0x4efb4d){_0x43c345=_0x43c345-0x0;var _0x138bfc=_0xda5b[_0x43c345];return _0x138bfc;};'use strict';var _=require(_0xbda5('0x0'));var util=require(_0xbda5('0x1'));var moment=require(_0xbda5('0x2'));var BPromise=require(_0xbda5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbda5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbda5('0x5'));var logger=require(_0xbda5('0x6'))(_0xbda5('0x7'));var config=require(_0xbda5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbda5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37028f,_0x2352a2,_0x2969ec){return new BPromise(function(_0x209ee9,_0x77eb23){return client[_0xbda5('0xa')](_0x37028f,_0x2969ec)[_0xbda5('0xb')](function(_0x5d69e2){logger['info'](_0xbda5('0xc'),_0x2352a2,_0xbda5('0xd'));logger[_0xbda5('0xe')](_0xbda5('0xf'),_0x2352a2,_0xbda5('0xd'),JSON['stringify'](_0x5d69e2));if(_0x5d69e2[_0xbda5('0x10')]){if(_0x5d69e2[_0xbda5('0x10')][_0xbda5('0x11')]===0x1f4){logger[_0xbda5('0x10')](_0xbda5('0xc'),_0x2352a2,_0x5d69e2[_0xbda5('0x10')][_0xbda5('0x12')]);return _0x77eb23(_0x5d69e2[_0xbda5('0x10')][_0xbda5('0x12')]);}logger[_0xbda5('0x10')](_0xbda5('0xc'),_0x2352a2,_0x5d69e2[_0xbda5('0x10')][_0xbda5('0x12')]);return _0x209ee9(_0x5d69e2['error'][_0xbda5('0x12')]);}else{logger[_0xbda5('0x13')](_0xbda5('0xc'),_0x2352a2,_0xbda5('0xd'));_0x209ee9(_0x5d69e2['result'][_0xbda5('0x12')]);}})[_0xbda5('0x14')](function(_0x38258){logger[_0xbda5('0x10')](_0xbda5('0xc'),_0x2352a2,_0x38258);_0x77eb23(_0x38258);});});} \ No newline at end of file +var _0xd26f=['request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x118707,_0x48014e){var _0x2945fb=function(_0x42984c){while(--_0x42984c){_0x118707['push'](_0x118707['shift']());}};_0x2945fb(++_0x48014e);}(_0xd26f,0x113));var _0xfd26=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xd26f[_0x550d12];return _0x12103d;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd26('0x2'));var fs=require('fs');var Redis=require(_0xfd26('0x3'));var db=require(_0xfd26('0x4'))['db'];var utils=require(_0xfd26('0x5'));var logger=require(_0xfd26('0x6'))(_0xfd26('0x7'));var config=require(_0xfd26('0x8'));var jayson=require(_0xfd26('0x9'));var client=jayson[_0xfd26('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22b353,_0x3c148d,_0x1905a2){return new BPromise(function(_0x3d405f,_0x3c9154){return client[_0xfd26('0xb')](_0x22b353,_0x1905a2)['then'](function(_0xcf2fdb){logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));logger[_0xfd26('0xf')](_0xfd26('0x10'),_0x3c148d,'request\x20sent',JSON[_0xfd26('0x11')](_0xcf2fdb));if(_0xcf2fdb['error']){if(_0xcf2fdb[_0xfd26('0x12')]['code']===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3c148d,_0xcf2fdb['error']['message']);return _0x3c9154(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}logger[_0xfd26('0x12')](_0xfd26('0xd'),_0x3c148d,_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);return _0x3d405f(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}else{logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));_0x3d405f(_0xcf2fdb[_0xfd26('0x14')][_0xfd26('0x13')]);}})[_0xfd26('0x15')](function(_0x2f9b37){logger['error'](_0xfd26('0xd'),_0x3c148d,_0x2f9b37);_0x3c9154(_0x2f9b37);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 7993d31..52fcd40 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 _0xa3b9=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','multer'];(function(_0x49754d,_0x171c18){var _0x29326a=function(_0x2f637f){while(--_0x2f637f){_0x49754d['push'](_0x49754d['shift']());}};_0x29326a(++_0x171c18);}(_0xa3b9,0x6b));var _0x9a3b=function(_0x2c4c21,_0x24934c){_0x2c4c21=_0x2c4c21-0x0;var _0x2e79b0=_0xa3b9[_0x2c4c21];return _0x2e79b0;};'use strict';var multer=require(_0x9a3b('0x0'));var util=require(_0x9a3b('0x1'));var path=require(_0x9a3b('0x2'));var timeout=require(_0x9a3b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9a3b('0x4'));var auth=require(_0x9a3b('0x5'));var interaction=require(_0x9a3b('0x6'));var config=require(_0x9a3b('0x7'));var controller=require('./intDeskField.controller');router[_0x9a3b('0x8')]('/',auth['isAuthenticated'](),controller[_0x9a3b('0x9')]);router[_0x9a3b('0x8')](_0x9a3b('0xa'),auth[_0x9a3b('0xb')](),controller[_0x9a3b('0xc')]);router[_0x9a3b('0xd')]('/',auth[_0x9a3b('0xb')](),controller[_0x9a3b('0xe')]);router[_0x9a3b('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x9a3b('0x10')]);router['delete'](_0x9a3b('0xa'),auth['isAuthenticated'](),controller[_0x9a3b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1e4c=['destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x5b7f48,_0x4d8a1d){var _0x2424b0=function(_0x21b28b){while(--_0x21b28b){_0x5b7f48['push'](_0x5b7f48['shift']());}};_0x2424b0(++_0x4d8a1d);}(_0x1e4c,0x1bc));var _0xc1e4=function(_0x5d79d1,_0x406f36){_0x5d79d1=_0x5d79d1-0x0;var _0x277e2e=_0x1e4c[_0x5d79d1];return _0x277e2e;};'use strict';var multer=require(_0xc1e4('0x0'));var util=require(_0xc1e4('0x1'));var path=require(_0xc1e4('0x2'));var timeout=require('connect-timeout');var express=require(_0xc1e4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc1e4('0x4'));var interaction=require(_0xc1e4('0x5'));var config=require(_0xc1e4('0x6'));var controller=require('./intDeskField.controller');router[_0xc1e4('0x7')]('/',auth[_0xc1e4('0x8')](),controller[_0xc1e4('0x9')]);router[_0xc1e4('0x7')](_0xc1e4('0xa'),auth['isAuthenticated'](),controller[_0xc1e4('0xb')]);router[_0xc1e4('0xc')]('/',auth[_0xc1e4('0x8')](),controller['create']);router[_0xc1e4('0xd')]('/:id',auth[_0xc1e4('0x8')](),controller[_0xc1e4('0xe')]);router['delete'](_0xc1e4('0xa'),auth[_0xc1e4('0x8')](),controller[_0xc1e4('0xf')]);module[_0xc1e4('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index ea3502a..11943a0 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 _0x14d2=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x1a1887,_0x92c1c1){var _0x93511c=function(_0x4f87ea){while(--_0x4f87ea){_0x1a1887['push'](_0x1a1887['shift']());}};_0x93511c(++_0x92c1c1);}(_0x14d2,0x13c));var _0x214d=function(_0x40f44e,_0x2c106d){_0x40f44e=_0x40f44e-0x0;var _0x57388f=_0x14d2[_0x40f44e];return _0x57388f;};'use strict';var Sequelize=require(_0x214d('0x0'));module[_0x214d('0x1')]={'type':{'type':Sequelize[_0x214d('0x2')](_0x214d('0x3'),_0x214d('0x4'),_0x214d('0x5'),_0x214d('0x6'),'picklist'),'defaultValue':_0x214d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x214d('0x7')]},'keyType':{'type':Sequelize[_0x214d('0x2')](_0x214d('0x3'),_0x214d('0x4'),_0x214d('0x5'))},'keyContent':{'type':Sequelize[_0x214d('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x214d('0x7')]},'customField':{'type':Sequelize[_0x214d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x214d('0x7')]}}; \ No newline at end of file +var _0xb958=['string','STRING','ENUM','BOOLEAN','sequelize','variable','customVariable','keyValue','picklist'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb958,0x109));var _0x8b95=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0xb958[_0x27dba4];return _0x35ec9d;};'use strict';var Sequelize=require(_0x8b95('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x8b95('0x1'),_0x8b95('0x2'),_0x8b95('0x3'),_0x8b95('0x4')),'defaultValue':_0x8b95('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8b95('0x6')]},'keyType':{'type':Sequelize[_0x8b95('0x7')](_0x8b95('0x5'),_0x8b95('0x1'),_0x8b95('0x2'))},'keyContent':{'type':Sequelize[_0x8b95('0x6')]},'idField':{'type':Sequelize[_0x8b95('0x6')]},'nameField':{'type':Sequelize[_0x8b95('0x6')]},'customField':{'type':Sequelize[_0x8b95('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b95('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 4c272cb..91cacd6 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 _0xf31b=['json','undefined','count','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','name','send','map','DeskField','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x21ea52,_0x445cb3){var _0x25d3ec=function(_0x3c890a){while(--_0x3c890a){_0x21ea52['push'](_0x21ea52['shift']());}};_0x25d3ec(++_0x445cb3);}(_0xf31b,0x1a0));var _0xbf31=function(_0x2c0a95,_0x42356b){_0x2c0a95=_0x2c0a95-0x0;var _0x51e6b4=_0xf31b[_0x2c0a95];return _0x51e6b4;};'use strict';var emlformat=require(_0xbf31('0x0'));var rimraf=require(_0xbf31('0x1'));var zipdir=require(_0xbf31('0x2'));var jsonpatch=require(_0xbf31('0x3'));var rp=require(_0xbf31('0x4'));var moment=require(_0xbf31('0x5'));var BPromise=require(_0xbf31('0x6'));var Mustache=require('mustache');var util=require(_0xbf31('0x7'));var path=require(_0xbf31('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbf31('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf31('0xa'));var squel=require(_0xbf31('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbf31('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbf31('0xd'));var Papa=require(_0xbf31('0xe'));var Redis=require(_0xbf31('0xf'));var authService=require(_0xbf31('0x10'));var qs=require(_0xbf31('0x11'));var as=require(_0xbf31('0x12'));var hardwareService=require(_0xbf31('0x13'));var logger=require(_0xbf31('0x14'))(_0xbf31('0x15'));var utils=require(_0xbf31('0x16'));var config=require(_0xbf31('0x17'));var licenseUtil=require(_0xbf31('0x18'));var db=require(_0xbf31('0x19'))['db'];function respondWithStatusCode(_0x5abe4b,_0x5704a8){_0x5704a8=_0x5704a8||0xcc;return function(_0x4f6183){if(_0x4f6183){return _0x5abe4b['sendStatus'](_0x5704a8);}return _0x5abe4b[_0xbf31('0x1a')](_0x5704a8)[_0xbf31('0x1b')]();};}function respondWithResult(_0xe114de,_0x15520a){_0x15520a=_0x15520a||0xc8;return function(_0x4eba21){if(_0x4eba21){return _0xe114de['status'](_0x15520a)[_0xbf31('0x1c')](_0x4eba21);}};}function respondWithFilteredResult(_0xd37c8e,_0x366685){return function(_0x36ab1d){if(_0x36ab1d){var _0x3ffe46=typeof _0x366685['offset']===_0xbf31('0x1d')&&typeof _0x366685['limit']==='undefined';var _0x3b7439=_0x36ab1d[_0xbf31('0x1e')];var _0x1cb0ce=_0x3ffe46?0x0:_0x366685[_0xbf31('0x1f')];var _0x19878b=_0x3ffe46?_0x36ab1d['count']:_0x366685['offset']+_0x366685[_0xbf31('0x20')];var _0x219cdd;if(_0x19878b>=_0x3b7439){_0x19878b=_0x3b7439;_0x219cdd=0xc8;}else{_0x219cdd=0xce;}_0xd37c8e[_0xbf31('0x1a')](_0x219cdd);return _0xd37c8e['set'](_0xbf31('0x21'),_0x1cb0ce+'-'+_0x19878b+'/'+_0x3b7439)[_0xbf31('0x1c')](_0x36ab1d);}return null;};}function patchUpdates(_0xf968e5){return function(_0x150148){try{jsonpatch[_0xbf31('0x22')](_0x150148,_0xf968e5,!![]);}catch(_0x5777d9){return BPromise[_0xbf31('0x23')](_0x5777d9);}return _0x150148['save']();};}function saveUpdates(_0x557cd6,_0x365824){return function(_0x126c55){if(_0x126c55){return _0x126c55[_0xbf31('0x24')](_0x557cd6)[_0xbf31('0x25')](function(_0x1217c2){return _0x1217c2;});}return null;};}function removeEntity(_0x421274,_0x59f899){return function(_0x1bc70b){if(_0x1bc70b){return _0x1bc70b[_0xbf31('0x26')]()[_0xbf31('0x25')](function(){_0x421274[_0xbf31('0x1a')](0xcc)[_0xbf31('0x1b')]();});}};}function handleEntityNotFound(_0x15b9b3,_0x564a08){return function(_0x2fb722){if(!_0x2fb722){_0x15b9b3[_0xbf31('0x27')](0x194);}return _0x2fb722;};}function handleError(_0x106a9d,_0x139f3b){_0x139f3b=_0x139f3b||0x1f4;return function(_0x224d71){logger['error'](_0x224d71['stack']);if(_0x224d71[_0xbf31('0x28')]){delete _0x224d71[_0xbf31('0x28')];}_0x106a9d[_0xbf31('0x1a')](_0x139f3b)[_0xbf31('0x29')](_0x224d71);};}exports['index']=function(_0x5ecaf1,_0x55e5d1){var _0x556349={},_0x3a6b75={},_0x33b868={'count':0x0,'rows':[]};var _0x5c4f00=_[_0xbf31('0x2a')](db[_0xbf31('0x2b')][_0xbf31('0x2c')],function(_0x529cdb){return{'name':_0x529cdb['fieldName'],'type':_0x529cdb['type'][_0xbf31('0x2d')]};});_0x3a6b75[_0xbf31('0x2e')]=_[_0xbf31('0x2a')](_0x5c4f00,_0xbf31('0x28'));_0x3a6b75[_0xbf31('0x2f')]=_[_0xbf31('0x30')](_0x5ecaf1['query']);_0x3a6b75[_0xbf31('0x31')]=_[_0xbf31('0x32')](_0x3a6b75[_0xbf31('0x2e')],_0x3a6b75[_0xbf31('0x2f')]);_0x556349[_0xbf31('0x33')]=_[_0xbf31('0x32')](_0x3a6b75['model'],qs[_0xbf31('0x34')](_0x5ecaf1['query']['fields']));_0x556349[_0xbf31('0x33')]=_0x556349[_0xbf31('0x33')][_0xbf31('0x35')]?_0x556349['attributes']:_0x3a6b75[_0xbf31('0x2e')];if(!_0x5ecaf1[_0xbf31('0x2f')][_0xbf31('0x36')](_0xbf31('0x37'))){_0x556349[_0xbf31('0x20')]=qs[_0xbf31('0x20')](_0x5ecaf1[_0xbf31('0x2f')]['limit']);_0x556349[_0xbf31('0x1f')]=qs[_0xbf31('0x1f')](_0x5ecaf1[_0xbf31('0x2f')][_0xbf31('0x1f')]);}_0x556349[_0xbf31('0x38')]=qs['sort'](_0x5ecaf1['query'][_0xbf31('0x39')]);_0x556349[_0xbf31('0x3a')]=qs[_0xbf31('0x31')](_[_0xbf31('0x3b')](_0x5ecaf1[_0xbf31('0x2f')],_0x3a6b75[_0xbf31('0x31')]),_0x5c4f00);if(_0x5ecaf1['query'][_0xbf31('0x3c')]){_0x556349[_0xbf31('0x3a')]=_[_0xbf31('0x3d')](_0x556349[_0xbf31('0x3a')],{'$or':_[_0xbf31('0x2a')](_0x5c4f00,function(_0x54f4fc){if(_0x54f4fc[_0xbf31('0x3e')]!==_0xbf31('0x3f')){var _0x5d6271={};_0x5d6271[_0x54f4fc['name']]={'$like':'%'+_0x5ecaf1[_0xbf31('0x2f')][_0xbf31('0x3c')]+'%'};return _0x5d6271;}})});}_0x556349=_['merge']({},_0x556349,_0x5ecaf1[_0xbf31('0x40')]);var _0x276f82={'where':_0x556349[_0xbf31('0x3a')]};return db[_0xbf31('0x2b')][_0xbf31('0x1e')](_0x276f82)[_0xbf31('0x25')](function(_0x3cff71){_0x33b868[_0xbf31('0x1e')]=_0x3cff71;if(_0x5ecaf1[_0xbf31('0x2f')]['includeAll']){_0x556349[_0xbf31('0x41')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0x556349);})[_0xbf31('0x25')](function(_0x25be3a){_0x33b868[_0xbf31('0x42')]=_0x25be3a;return _0x33b868;})[_0xbf31('0x25')](respondWithFilteredResult(_0x55e5d1,_0x556349))[_0xbf31('0x43')](handleError(_0x55e5d1,null));};exports[_0xbf31('0x44')]=function(_0xa5c2c4,_0x1b9508){var _0x11997d={'raw':!![],'where':{'id':_0xa5c2c4[_0xbf31('0x45')]['id']}},_0x20f466={};_0x20f466[_0xbf31('0x2e')]=_[_0xbf31('0x30')](db[_0xbf31('0x2b')][_0xbf31('0x2c')]);_0x20f466[_0xbf31('0x2f')]=_[_0xbf31('0x30')](_0xa5c2c4[_0xbf31('0x2f')]);_0x20f466[_0xbf31('0x31')]=_['intersection'](_0x20f466[_0xbf31('0x2e')],_0x20f466['query']);_0x11997d['attributes']=_[_0xbf31('0x32')](_0x20f466[_0xbf31('0x2e')],qs[_0xbf31('0x34')](_0xa5c2c4[_0xbf31('0x2f')]['fields']));_0x11997d[_0xbf31('0x33')]=_0x11997d[_0xbf31('0x33')][_0xbf31('0x35')]?_0x11997d[_0xbf31('0x33')]:_0x20f466['model'];if(_0xa5c2c4[_0xbf31('0x2f')][_0xbf31('0x46')]){_0x11997d[_0xbf31('0x41')]=[{'all':!![]}];}_0x11997d=_[_0xbf31('0x3d')]({},_0x11997d,_0xa5c2c4['options']);return db[_0xbf31('0x2b')][_0xbf31('0x47')](_0x11997d)[_0xbf31('0x25')](handleEntityNotFound(_0x1b9508,null))[_0xbf31('0x25')](respondWithResult(_0x1b9508,null))[_0xbf31('0x43')](handleError(_0x1b9508,null));};exports['create']=function(_0x40619e,_0x1cbe9c){return db[_0xbf31('0x2b')][_0xbf31('0x48')](_0x40619e[_0xbf31('0x49')],{})[_0xbf31('0x25')](respondWithResult(_0x1cbe9c,0xc9))[_0xbf31('0x43')](handleError(_0x1cbe9c,null));};exports['update']=function(_0x30bd70,_0x222baa){if(_0x30bd70[_0xbf31('0x49')]['id']){delete _0x30bd70[_0xbf31('0x49')]['id'];}return db['DeskField'][_0xbf31('0x47')]({'where':{'id':_0x30bd70[_0xbf31('0x45')]['id']}})[_0xbf31('0x25')](handleEntityNotFound(_0x222baa,null))[_0xbf31('0x25')](saveUpdates(_0x30bd70[_0xbf31('0x49')],null))['then'](respondWithResult(_0x222baa,null))[_0xbf31('0x43')](handleError(_0x222baa,null));};exports['destroy']=function(_0x4f14c5,_0x139c8d){return db[_0xbf31('0x2b')][_0xbf31('0x47')]({'where':{'id':_0x4f14c5['params']['id']}})[_0xbf31('0x25')](handleEntityNotFound(_0x139c8d,null))[_0xbf31('0x25')](removeEntity(_0x139c8d,null))[_0xbf31('0x43')](handleError(_0x139c8d,null));}; \ No newline at end of file +var _0x9a96=['reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','DeskField','findAll','catch','includeAll','include','find','create','body','params','eml-format','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x5b8a37,_0x5f5554){var _0x421c10=function(_0x47e343){while(--_0x47e343){_0x5b8a37['push'](_0x5b8a37['shift']());}};_0x421c10(++_0x5f5554);}(_0x9a96,0x117));var _0x69a9=function(_0x49178e,_0x4b6d5e){_0x49178e=_0x49178e-0x0;var _0x9e9a29=_0x9a96[_0x49178e];return _0x9e9a29;};'use strict';var emlformat=require(_0x69a9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69a9('0x1'));var jsonpatch=require(_0x69a9('0x2'));var rp=require(_0x69a9('0x3'));var moment=require(_0x69a9('0x4'));var BPromise=require(_0x69a9('0x5'));var Mustache=require(_0x69a9('0x6'));var util=require(_0x69a9('0x7'));var path=require(_0x69a9('0x8'));var sox=require('sox');var csv=require(_0x69a9('0x9'));var ejs=require(_0x69a9('0xa'));var fs=require('fs');var fs_extra=require(_0x69a9('0xb'));var _=require(_0x69a9('0xc'));var squel=require(_0x69a9('0xd'));var crypto=require('crypto');var jsforce=require(_0x69a9('0xe'));var deskjs=require(_0x69a9('0xf'));var toCsv=require(_0x69a9('0x9'));var querystring=require(_0x69a9('0x10'));var Papa=require('papaparse');var Redis=require(_0x69a9('0x11'));var authService=require(_0x69a9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x69a9('0x13'));var hardwareService=require(_0x69a9('0x14'));var logger=require(_0x69a9('0x15'))(_0x69a9('0x16'));var utils=require(_0x69a9('0x17'));var config=require(_0x69a9('0x18'));var licenseUtil=require(_0x69a9('0x19'));var db=require(_0x69a9('0x1a'))['db'];function respondWithStatusCode(_0x5ce814,_0x4cd1b5){_0x4cd1b5=_0x4cd1b5||0xcc;return function(_0x5db48a){if(_0x5db48a){return _0x5ce814['sendStatus'](_0x4cd1b5);}return _0x5ce814[_0x69a9('0x1b')](_0x4cd1b5)[_0x69a9('0x1c')]();};}function respondWithResult(_0x414a04,_0x1747d6){_0x1747d6=_0x1747d6||0xc8;return function(_0x5d8dc9){if(_0x5d8dc9){return _0x414a04['status'](_0x1747d6)[_0x69a9('0x1d')](_0x5d8dc9);}};}function respondWithFilteredResult(_0x39c0db,_0x25651d){return function(_0x39275e){if(_0x39275e){var _0x327f9d=typeof _0x25651d[_0x69a9('0x1e')]===_0x69a9('0x1f')&&typeof _0x25651d[_0x69a9('0x20')]==='undefined';var _0x2810eb=_0x39275e['count'];var _0x50381c=_0x327f9d?0x0:_0x25651d[_0x69a9('0x1e')];var _0x5d5c44=_0x327f9d?_0x39275e[_0x69a9('0x21')]:_0x25651d[_0x69a9('0x1e')]+_0x25651d[_0x69a9('0x20')];var _0x1f1c1e;if(_0x5d5c44>=_0x2810eb){_0x5d5c44=_0x2810eb;_0x1f1c1e=0xc8;}else{_0x1f1c1e=0xce;}_0x39c0db[_0x69a9('0x1b')](_0x1f1c1e);return _0x39c0db[_0x69a9('0x22')](_0x69a9('0x23'),_0x50381c+'-'+_0x5d5c44+'/'+_0x2810eb)[_0x69a9('0x1d')](_0x39275e);}return null;};}function patchUpdates(_0x3d52f1){return function(_0x376d32){try{jsonpatch[_0x69a9('0x24')](_0x376d32,_0x3d52f1,!![]);}catch(_0x48248c){return BPromise[_0x69a9('0x25')](_0x48248c);}return _0x376d32[_0x69a9('0x26')]();};}function saveUpdates(_0x32317b,_0x160258){return function(_0x3806f9){if(_0x3806f9){return _0x3806f9[_0x69a9('0x27')](_0x32317b)[_0x69a9('0x28')](function(_0x5351f3){return _0x5351f3;});}return null;};}function removeEntity(_0x57f3b4,_0x1f9517){return function(_0x43815b){if(_0x43815b){return _0x43815b[_0x69a9('0x29')]()['then'](function(){_0x57f3b4[_0x69a9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5877d7,_0x281861){return function(_0x1abc57){if(!_0x1abc57){_0x5877d7[_0x69a9('0x2a')](0x194);}return _0x1abc57;};}function handleError(_0x356f33,_0x4864ea){_0x4864ea=_0x4864ea||0x1f4;return function(_0xecd137){logger[_0x69a9('0x2b')](_0xecd137[_0x69a9('0x2c')]);if(_0xecd137[_0x69a9('0x2d')]){delete _0xecd137[_0x69a9('0x2d')];}_0x356f33[_0x69a9('0x1b')](_0x4864ea)[_0x69a9('0x2e')](_0xecd137);};}exports['index']=function(_0x1c74f5,_0x13e5bf){var _0x190c3e={},_0x19f538={},_0x375877={'count':0x0,'rows':[]};var _0x2a70ad=_[_0x69a9('0x2f')](db['DeskField'][_0x69a9('0x30')],function(_0x410f5b){return{'name':_0x410f5b[_0x69a9('0x31')],'type':_0x410f5b[_0x69a9('0x32')][_0x69a9('0x33')]};});_0x19f538['model']=_[_0x69a9('0x2f')](_0x2a70ad,_0x69a9('0x2d'));_0x19f538['query']=_[_0x69a9('0x34')](_0x1c74f5['query']);_0x19f538[_0x69a9('0x35')]=_[_0x69a9('0x36')](_0x19f538[_0x69a9('0x37')],_0x19f538[_0x69a9('0x38')]);_0x190c3e[_0x69a9('0x39')]=_[_0x69a9('0x36')](_0x19f538[_0x69a9('0x37')],qs[_0x69a9('0x3a')](_0x1c74f5[_0x69a9('0x38')][_0x69a9('0x3a')]));_0x190c3e['attributes']=_0x190c3e[_0x69a9('0x39')][_0x69a9('0x3b')]?_0x190c3e[_0x69a9('0x39')]:_0x19f538[_0x69a9('0x37')];if(!_0x1c74f5[_0x69a9('0x38')][_0x69a9('0x3c')](_0x69a9('0x3d'))){_0x190c3e[_0x69a9('0x20')]=qs[_0x69a9('0x20')](_0x1c74f5[_0x69a9('0x38')][_0x69a9('0x20')]);_0x190c3e[_0x69a9('0x1e')]=qs[_0x69a9('0x1e')](_0x1c74f5[_0x69a9('0x38')][_0x69a9('0x1e')]);}_0x190c3e[_0x69a9('0x3e')]=qs[_0x69a9('0x3f')](_0x1c74f5[_0x69a9('0x38')][_0x69a9('0x3f')]);_0x190c3e[_0x69a9('0x40')]=qs[_0x69a9('0x35')](_[_0x69a9('0x41')](_0x1c74f5[_0x69a9('0x38')],_0x19f538[_0x69a9('0x35')]),_0x2a70ad);if(_0x1c74f5[_0x69a9('0x38')]['filter']){_0x190c3e['where']=_['merge'](_0x190c3e[_0x69a9('0x40')],{'$or':_[_0x69a9('0x2f')](_0x2a70ad,function(_0x8176dd){if(_0x8176dd[_0x69a9('0x32')]!==_0x69a9('0x42')){var _0x26f87c={};_0x26f87c[_0x8176dd[_0x69a9('0x2d')]]={'$like':'%'+_0x1c74f5[_0x69a9('0x38')][_0x69a9('0x43')]+'%'};return _0x26f87c;}})});}_0x190c3e=_[_0x69a9('0x44')]({},_0x190c3e,_0x1c74f5[_0x69a9('0x45')]);var _0x2744aa={'where':_0x190c3e[_0x69a9('0x40')]};return db['DeskField'][_0x69a9('0x21')](_0x2744aa)[_0x69a9('0x28')](function(_0x4469a5){_0x375877['count']=_0x4469a5;if(_0x1c74f5[_0x69a9('0x38')]['includeAll']){_0x190c3e['include']=[{'all':!![]}];}return db[_0x69a9('0x46')][_0x69a9('0x47')](_0x190c3e);})[_0x69a9('0x28')](function(_0x36f031){_0x375877['rows']=_0x36f031;return _0x375877;})[_0x69a9('0x28')](respondWithFilteredResult(_0x13e5bf,_0x190c3e))[_0x69a9('0x48')](handleError(_0x13e5bf,null));};exports['show']=function(_0x48b292,_0x4851ba){var _0x41e4bf={'raw':!![],'where':{'id':_0x48b292['params']['id']}},_0x5b78cd={};_0x5b78cd[_0x69a9('0x37')]=_['keys'](db[_0x69a9('0x46')][_0x69a9('0x30')]);_0x5b78cd[_0x69a9('0x38')]=_[_0x69a9('0x34')](_0x48b292['query']);_0x5b78cd[_0x69a9('0x35')]=_[_0x69a9('0x36')](_0x5b78cd[_0x69a9('0x37')],_0x5b78cd[_0x69a9('0x38')]);_0x41e4bf[_0x69a9('0x39')]=_['intersection'](_0x5b78cd[_0x69a9('0x37')],qs[_0x69a9('0x3a')](_0x48b292[_0x69a9('0x38')][_0x69a9('0x3a')]));_0x41e4bf[_0x69a9('0x39')]=_0x41e4bf[_0x69a9('0x39')]['length']?_0x41e4bf[_0x69a9('0x39')]:_0x5b78cd[_0x69a9('0x37')];if(_0x48b292[_0x69a9('0x38')][_0x69a9('0x49')]){_0x41e4bf[_0x69a9('0x4a')]=[{'all':!![]}];}_0x41e4bf=_[_0x69a9('0x44')]({},_0x41e4bf,_0x48b292[_0x69a9('0x45')]);return db[_0x69a9('0x46')][_0x69a9('0x4b')](_0x41e4bf)[_0x69a9('0x28')](handleEntityNotFound(_0x4851ba,null))[_0x69a9('0x28')](respondWithResult(_0x4851ba,null))[_0x69a9('0x48')](handleError(_0x4851ba,null));};exports['create']=function(_0x4fe86a,_0x41330c){return db[_0x69a9('0x46')][_0x69a9('0x4c')](_0x4fe86a[_0x69a9('0x4d')],{})['then'](respondWithResult(_0x41330c,0xc9))[_0x69a9('0x48')](handleError(_0x41330c,null));};exports[_0x69a9('0x27')]=function(_0x2b6cee,_0x5d2d20){if(_0x2b6cee[_0x69a9('0x4d')]['id']){delete _0x2b6cee[_0x69a9('0x4d')]['id'];}return db[_0x69a9('0x46')][_0x69a9('0x4b')]({'where':{'id':_0x2b6cee[_0x69a9('0x4e')]['id']}})[_0x69a9('0x28')](handleEntityNotFound(_0x5d2d20,null))[_0x69a9('0x28')](saveUpdates(_0x2b6cee[_0x69a9('0x4d')],null))[_0x69a9('0x28')](respondWithResult(_0x5d2d20,null))['catch'](handleError(_0x5d2d20,null));};exports[_0x69a9('0x29')]=function(_0x4094ce,_0x15eb5a){return db['DeskField'][_0x69a9('0x4b')]({'where':{'id':_0x4094ce[_0x69a9('0x4e')]['id']}})['then'](handleEntityNotFound(_0x15eb5a,null))[_0x69a9('0x28')](removeEntity(_0x15eb5a,null))['catch'](handleError(_0x15eb5a,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index cbc6141..b027ccd 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 _0xdf9b=['FieldId','lodash','../../config/logger','bluebird','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','idField'];(function(_0x39cb73,_0x433a65){var _0x52746c=function(_0x2e7a81){while(--_0x2e7a81){_0x39cb73['push'](_0x39cb73['shift']());}};_0x52746c(++_0x433a65);}(_0xdf9b,0xd3));var _0xbdf9=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xdf9b[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0xbdf9('0x0'));var util=require('util');var logger=require(_0xbdf9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbdf9('0x2'));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(_0xbdf9('0x3'));module[_0xbdf9('0x4')]=function(_0x4a268d,_0x57b619){return _0x4a268d[_0xbdf9('0x5')](_0xbdf9('0x6'),attributes,{'tableName':_0xbdf9('0x7'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xbdf9('0x8'),_0xbdf9('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4446=['../../config/environment','./intDeskField.attributes','exports','define','DeskField','idField','FieldId','lodash','util','moment','bluebird','path','rimraf'];(function(_0x3e5bc6,_0x5f4685){var _0x44651a=function(_0x33b4f5){while(--_0x33b4f5){_0x3e5bc6['push'](_0x3e5bc6['shift']());}};_0x44651a(++_0x5f4685);}(_0x4446,0x180));var _0x6444=function(_0x274df2,_0x4856d1){_0x274df2=_0x274df2-0x0;var _0x7163b0=_0x4446[_0x274df2];return _0x7163b0;};'use strict';var _=require(_0x6444('0x0'));var util=require(_0x6444('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6444('0x2'));var BPromise=require(_0x6444('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6444('0x4'));var rimraf=require(_0x6444('0x5'));var config=require(_0x6444('0x6'));var attributes=require(_0x6444('0x7'));module[_0x6444('0x8')]=function(_0x2b21d1,_0x266259){return _0x2b21d1[_0x6444('0x9')](_0x6444('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x6444('0xb'),_0x6444('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index cc9ff7f..55ccda4 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 _0x38ec=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x38ec,0x1f2));var _0xc38e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38ec[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc38e('0x0'));var util=require(_0xc38e('0x1'));var moment=require(_0xc38e('0x2'));var BPromise=require(_0xc38e('0x3'));var rs=require(_0xc38e('0x4'));var fs=require('fs');var Redis=require(_0xc38e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc38e('0x6'))(_0xc38e('0x7'));var config=require('../../config/environment');var jayson=require(_0xc38e('0x8'));var client=jayson['client'][_0xc38e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c8aec,_0x5bac85,_0x23d929){return new BPromise(function(_0x208ae4,_0x52e392){return client[_0xc38e('0xa')](_0x5c8aec,_0x23d929)[_0xc38e('0xb')](function(_0x1e0846){logger[_0xc38e('0xc')](_0xc38e('0xd'),_0x5bac85,_0xc38e('0xe'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x5bac85,_0xc38e('0xe'),JSON['stringify'](_0x1e0846));if(_0x1e0846[_0xc38e('0xf')]){if(_0x1e0846[_0xc38e('0xf')]['code']===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x5bac85,_0x1e0846[_0xc38e('0xf')][_0xc38e('0x10')]);return _0x52e392(_0x1e0846['error']['message']);}logger[_0xc38e('0xf')](_0xc38e('0xd'),_0x5bac85,_0x1e0846['error'][_0xc38e('0x10')]);return _0x208ae4(_0x1e0846[_0xc38e('0xf')][_0xc38e('0x10')]);}else{logger[_0xc38e('0xc')](_0xc38e('0xd'),_0x5bac85,'request\x20sent');_0x208ae4(_0x1e0846[_0xc38e('0x11')][_0xc38e('0x10')]);}})[_0xc38e('0x12')](function(_0x12a51f){logger[_0xc38e('0xf')]('DeskField,\x20%s,\x20%s',_0x5bac85,_0x12a51f);_0x52e392(_0x12a51f);});});} \ No newline at end of file +var _0xfcb0=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','moment'];(function(_0x2c80c1,_0xf479b3){var _0x375cd8=function(_0xeb509a){while(--_0xeb509a){_0x2c80c1['push'](_0x2c80c1['shift']());}};_0x375cd8(++_0xf479b3);}(_0xfcb0,0xc5));var _0x0fcb=function(_0x3687ca,_0x300281){_0x3687ca=_0x3687ca-0x0;var _0xa84cb8=_0xfcb0[_0x3687ca];return _0xa84cb8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0fcb('0x0'));var BPromise=require('bluebird');var rs=require(_0x0fcb('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0fcb('0x2'))['db'];var utils=require(_0x0fcb('0x3'));var logger=require('../../config/logger')(_0x0fcb('0x4'));var config=require(_0x0fcb('0x5'));var jayson=require(_0x0fcb('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x625963,_0x3139b5,_0x55c6bc){return new BPromise(function(_0x12c678,_0x1c7dc2){return client[_0x0fcb('0x7')](_0x625963,_0x55c6bc)[_0x0fcb('0x8')](function(_0x237acb){logger[_0x0fcb('0x9')](_0x0fcb('0xa'),_0x3139b5,_0x0fcb('0xb'));logger[_0x0fcb('0xc')](_0x0fcb('0xd'),_0x3139b5,_0x0fcb('0xb'),JSON['stringify'](_0x237acb));if(_0x237acb[_0x0fcb('0xe')]){if(_0x237acb[_0x0fcb('0xe')][_0x0fcb('0xf')]===0x1f4){logger[_0x0fcb('0xe')](_0x0fcb('0xa'),_0x3139b5,_0x237acb[_0x0fcb('0xe')]['message']);return _0x1c7dc2(_0x237acb[_0x0fcb('0xe')][_0x0fcb('0x10')]);}logger[_0x0fcb('0xe')](_0x0fcb('0xa'),_0x3139b5,_0x237acb['error'][_0x0fcb('0x10')]);return _0x12c678(_0x237acb[_0x0fcb('0xe')][_0x0fcb('0x10')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x3139b5,_0x0fcb('0xb'));_0x12c678(_0x237acb[_0x0fcb('0x11')][_0x0fcb('0x10')]);}})['catch'](function(_0x354899){logger['error']('DeskField,\x20%s,\x20%s',_0x3139b5,_0x354899);_0x1c7dc2(_0x354899);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index ea14810..8880ed4 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 _0x246f=['express','Router','fs-extra','../../components/auth/service','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x246f,0xad));var _0xf246=function(_0x5dbaa1,_0x3e9c1c){_0x5dbaa1=_0x5dbaa1-0x0;var _0xc7492=_0x246f[_0x5dbaa1];return _0xc7492;};'use strict';var multer=require(_0xf246('0x0'));var util=require(_0xf246('0x1'));var path=require('path');var timeout=require(_0xf246('0x2'));var express=require(_0xf246('0x3'));var router=express[_0xf246('0x4')]();var fs_extra=require(_0xf246('0x5'));var auth=require(_0xf246('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf246('0x7'));router['get']('/',auth[_0xf246('0x8')](),controller[_0xf246('0x9')]);router[_0xf246('0xa')](_0xf246('0xb'),auth['isAuthenticated'](),controller[_0xf246('0xc')]);router[_0xf246('0xa')](_0xf246('0xd'),auth[_0xf246('0x8')](),controller[_0xf246('0xe')]);router['get']('/:id/fields',auth[_0xf246('0x8')](),controller[_0xf246('0xf')]);router[_0xf246('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf246('0x10')](_0xf246('0xd'),auth[_0xf246('0x8')](),controller[_0xf246('0x11')]);router[_0xf246('0x12')](_0xf246('0xb'),auth[_0xf246('0x8')](),controller[_0xf246('0x13')]);router[_0xf246('0x14')]('/:id',auth[_0xf246('0x8')](),controller[_0xf246('0x15')]);module['exports']=router; \ No newline at end of file +var _0x720f=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path'];(function(_0x1b02a6,_0x74f890){var _0x31c442=function(_0x185c54){while(--_0x185c54){_0x1b02a6['push'](_0x1b02a6['shift']());}};_0x31c442(++_0x74f890);}(_0x720f,0x1e0));var _0xf720=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x720f[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0xf720('0x0'));var util=require(_0xf720('0x1'));var path=require(_0xf720('0x2'));var timeout=require(_0xf720('0x3'));var express=require('express');var router=express[_0xf720('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf720('0x5'));var interaction=require(_0xf720('0x6'));var config=require(_0xf720('0x7'));var controller=require(_0xf720('0x8'));router[_0xf720('0x9')]('/',auth[_0xf720('0xa')](),controller[_0xf720('0xb')]);router[_0xf720('0x9')](_0xf720('0xc'),auth[_0xf720('0xa')](),controller['show']);router[_0xf720('0x9')](_0xf720('0xd'),auth[_0xf720('0xa')](),controller[_0xf720('0xe')]);router[_0xf720('0x9')]('/:id/fields',auth[_0xf720('0xa')](),controller[_0xf720('0xf')]);router[_0xf720('0x10')]('/',auth[_0xf720('0xa')](),controller[_0xf720('0x11')]);router['post']('/:id/configurations',auth[_0xf720('0xa')](),controller[_0xf720('0x12')]);router[_0xf720('0x13')](_0xf720('0xc'),auth['isAuthenticated'](),controller[_0xf720('0x14')]);router[_0xf720('0x15')](_0xf720('0xc'),auth[_0xf720('0xa')](),controller[_0xf720('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index ed2ba24..9067afc 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 _0x282a=['exports','STRING'];(function(_0x34b0d3,_0x55b139){var _0x37c298=function(_0x1678cc){while(--_0x1678cc){_0x34b0d3['push'](_0x34b0d3['shift']());}};_0x37c298(++_0x55b139);}(_0x282a,0xa2));var _0xa282=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x282a[_0x2dadb9];return _0x2f0097;};'use strict';var Sequelize=require('sequelize');module[_0xa282('0x0')]={'name':{'type':Sequelize[_0xa282('0x1')]},'username':{'type':Sequelize[_0xa282('0x1')]},'password':{'type':Sequelize[_0xa282('0x1')]},'remoteUri':{'type':Sequelize[_0xa282('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa282('0x1')]},'clientSecret':{'type':Sequelize[_0xa282('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa282('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x539d=['STRING','sequelize'];(function(_0x41482a,_0x2fece6){var _0x574b03=function(_0x4750a9){while(--_0x4750a9){_0x41482a['push'](_0x41482a['shift']());}};_0x574b03(++_0x2fece6);}(_0x539d,0x17b));var _0xd539=function(_0x3cec45,_0x37d817){_0x3cec45=_0x3cec45-0x0;var _0x51d691=_0x539d[_0x3cec45];return _0x51d691;};'use strict';var Sequelize=require(_0xd539('0x0'));module['exports']={'name':{'type':Sequelize[_0xd539('0x1')]},'username':{'type':Sequelize[_0xd539('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xd539('0x1')]},'clientId':{'type':Sequelize[_0xd539('0x1')]},'clientSecret':{'type':Sequelize[_0xd539('0x1')]},'serverUrl':{'type':Sequelize[_0xd539('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd539('0x1')]},'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 c3769ae..9c175cb 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 _0x764e=['?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','json','offset','undefined','limit','count','update','then','sendStatus','error','stack','name','status','send','index','map','Dynamics365Account','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','type','VIRTUAL','includeAll','findAll','catch','params','include','merge','options','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','pick','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','Dynamics365Field','substring','format','ticketType','Incident','title','description','customerid','ownerid','caseorigincode','subject','phonecall_activity_parties','accountidname','actualserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','Wrong\x20credentials','statusCode',')/Attributes(','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x764e,0x16d));var _0xe764=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x764e[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require('request-promise');var util=require(_0xe764('0x0'));var _=require(_0xe764('0x1'));var qs=require(_0xe764('0x2'));var logger=require(_0xe764('0x3'))(_0xe764('0x4'));var db=require(_0xe764('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x151fa4,_0x17ef5e){_0x17ef5e=_0x17ef5e||0xc8;return function(_0x35b59f){if(_0x35b59f){return _0x151fa4['status'](_0x17ef5e)[_0xe764('0x6')](_0x35b59f);}};}function respondWithFilteredResult(_0x158ec2,_0x251427){return function(_0x5db900){if(_0x5db900){var _0xdad8c9=typeof _0x251427[_0xe764('0x7')]===_0xe764('0x8')&&typeof _0x251427[_0xe764('0x9')]===_0xe764('0x8');var _0x3dbba4=_0x5db900['count'];var _0x5e6a29=_0xdad8c9?0x0:_0x251427[_0xe764('0x7')];var _0x39b57a=_0xdad8c9?_0x5db900[_0xe764('0xa')]:_0x251427[_0xe764('0x7')]+_0x251427[_0xe764('0x9')];var _0x2840e0;if(_0x39b57a>=_0x3dbba4){_0x39b57a=_0x3dbba4;_0x2840e0=0xc8;}else{_0x2840e0=0xce;}_0x158ec2['status'](_0x2840e0);return _0x158ec2['set']('Content-Range',_0x5e6a29+'-'+_0x39b57a+'/'+_0x3dbba4)[_0xe764('0x6')](_0x5db900);}return null;};}function saveUpdates(_0x3378e2){return function(_0x4af46f){if(_0x4af46f){return _0x4af46f[_0xe764('0xb')](_0x3378e2)['then'](function(_0x5023ba){return _0x5023ba;});}return null;};}function removeEntity(_0x56cde2){return function(_0x2ea124){if(_0x2ea124){return _0x2ea124['destroy']()[_0xe764('0xc')](function(){_0x56cde2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eea7e){return function(_0x553e54){if(!_0x553e54){_0x3eea7e[_0xe764('0xd')](0x194);}return _0x553e54;};}function handleError(_0x52fd34,_0x493e18){_0x493e18=_0x493e18||0x1f4;return function(_0x3b5bea){logger[_0xe764('0xe')](_0x3b5bea[_0xe764('0xf')]);if(_0x3b5bea[_0xe764('0x10')]){delete _0x3b5bea[_0xe764('0x10')];}_0x52fd34[_0xe764('0x11')](_0x493e18)[_0xe764('0x12')](_0x3b5bea);};}exports[_0xe764('0x13')]=function(_0x397439,_0x5a70eb){var _0x56317e={},_0x1da31c={},_0x4493ef={'count':0x0,'rows':[]};var _0xe60144=_[_0xe764('0x14')](db[_0xe764('0x15')][_0xe764('0x16')],function(_0x4de2f2){return{'name':_0x4de2f2['fieldName'],'type':_0x4de2f2['type'][_0xe764('0x17')]};});_0x1da31c['model']=_[_0xe764('0x14')](_0xe60144,_0xe764('0x10'));_0x1da31c[_0xe764('0x18')]=_[_0xe764('0x19')](_0x397439[_0xe764('0x18')]);_0x1da31c['filters']=_[_0xe764('0x1a')](_0x1da31c[_0xe764('0x1b')],_0x1da31c[_0xe764('0x18')]);_0x56317e[_0xe764('0x1c')]=_[_0xe764('0x1a')](_0x1da31c[_0xe764('0x1b')],qs[_0xe764('0x1d')](_0x397439[_0xe764('0x18')][_0xe764('0x1d')]));_0x56317e['attributes']=_0x56317e[_0xe764('0x1c')][_0xe764('0x1e')]?_0x56317e[_0xe764('0x1c')]:_0x1da31c['model'];if(!_0x397439[_0xe764('0x18')][_0xe764('0x1f')](_0xe764('0x20'))){_0x56317e['limit']=qs['limit'](_0x397439[_0xe764('0x18')][_0xe764('0x9')]);_0x56317e[_0xe764('0x7')]=qs[_0xe764('0x7')](_0x397439[_0xe764('0x18')][_0xe764('0x7')]);}_0x56317e['order']=qs[_0xe764('0x21')](_0x397439[_0xe764('0x18')]['sort']);_0x56317e[_0xe764('0x22')]=qs['filters'](_['pick'](_0x397439[_0xe764('0x18')],_0x1da31c[_0xe764('0x23')]),_0xe60144);if(_0x397439[_0xe764('0x18')][_0xe764('0x24')]){_0x56317e[_0xe764('0x22')]=_['merge'](_0x56317e['where'],{'$or':_['map'](_0xe60144,function(_0x504227){if(_0x504227[_0xe764('0x25')]!==_0xe764('0x26')){var _0x4e7044={};_0x4e7044[_0x504227[_0xe764('0x10')]]={'$like':'%'+_0x397439[_0xe764('0x18')][_0xe764('0x24')]+'%'};return _0x4e7044;}})});}_0x56317e=_['merge']({},_0x56317e,_0x397439['options']);var _0x4b6a48={'where':_0x56317e[_0xe764('0x22')]};return db['Dynamics365Account']['count'](_0x4b6a48)[_0xe764('0xc')](function(_0x4f3b01){_0x4493ef[_0xe764('0xa')]=_0x4f3b01;if(_0x397439[_0xe764('0x18')][_0xe764('0x27')]){_0x56317e['include']=[{'all':!![]}];}return db[_0xe764('0x15')][_0xe764('0x28')](_0x56317e);})['then'](function(_0xddd32f){_0x4493ef['rows']=_0xddd32f;return _0x4493ef;})['then'](respondWithFilteredResult(_0x5a70eb,_0x56317e))[_0xe764('0x29')](handleError(_0x5a70eb,null));};exports['show']=function(_0x178126,_0x49f7d9){var _0x5d1f09={'raw':![],'where':{'id':_0x178126[_0xe764('0x2a')]['id']}},_0x573d3d={};_0x573d3d[_0xe764('0x1b')]=_[_0xe764('0x19')](db[_0xe764('0x15')][_0xe764('0x16')]);_0x573d3d[_0xe764('0x18')]=_[_0xe764('0x19')](_0x178126[_0xe764('0x18')]);_0x573d3d[_0xe764('0x23')]=_[_0xe764('0x1a')](_0x573d3d['model'],_0x573d3d[_0xe764('0x18')]);_0x5d1f09['attributes']=_[_0xe764('0x1a')](_0x573d3d[_0xe764('0x1b')],qs[_0xe764('0x1d')](_0x178126[_0xe764('0x18')][_0xe764('0x1d')]));_0x5d1f09[_0xe764('0x1c')]=_0x5d1f09[_0xe764('0x1c')][_0xe764('0x1e')]?_0x5d1f09[_0xe764('0x1c')]:_0x573d3d[_0xe764('0x1b')];if(_0x178126[_0xe764('0x18')][_0xe764('0x27')]){_0x5d1f09[_0xe764('0x2b')]=[{'all':!![]}];}_0x5d1f09=_[_0xe764('0x2c')]({},_0x5d1f09,_0x178126[_0xe764('0x2d')]);return db[_0xe764('0x15')][_0xe764('0x2e')](_0x5d1f09)[_0xe764('0xc')](handleEntityNotFound(_0x49f7d9,null))[_0xe764('0xc')](respondWithResult(_0x49f7d9,null))[_0xe764('0x29')](handleError(_0x49f7d9,null));};exports[_0xe764('0x2f')]=function(_0x4b930a,_0x411bab){return db[_0xe764('0x15')][_0xe764('0x2f')](_0x4b930a[_0xe764('0x30')],{})['then'](respondWithResult(_0x411bab,0xc9))[_0xe764('0x29')](handleError(_0x411bab,null));};exports['update']=function(_0x3cb193,_0x15584d){if(_0x3cb193['body']['id']){delete _0x3cb193['body']['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x3cb193[_0xe764('0x2a')]['id']}})['then'](handleEntityNotFound(_0x15584d,null))[_0xe764('0xc')](saveUpdates(_0x3cb193[_0xe764('0x30')],null))[_0xe764('0xc')](respondWithResult(_0x15584d,null))['catch'](handleError(_0x15584d,null));};exports[_0xe764('0x31')]=function(_0xc767ae,_0x4226b8){return db['Dynamics365Account']['find']({'where':{'id':_0xc767ae[_0xe764('0x2a')]['id']}})[_0xe764('0xc')](handleEntityNotFound(_0x4226b8,null))[_0xe764('0xc')](removeEntity(_0x4226b8,null))[_0xe764('0x29')](handleError(_0x4226b8,null));};exports[_0xe764('0x32')]=function(_0x27e618,_0x734ccc){var _0x515a23={};var _0x21f4ed={};var _0x22989;var _0x4481e2;return db['Dynamics365Account'][_0xe764('0x33')]({'where':{'id':_0x27e618['params']['id']}})[_0xe764('0xc')](handleEntityNotFound(_0x734ccc,null))[_0xe764('0xc')](function(_0x5d1ac7){if(_0x5d1ac7){_0x22989=_0x5d1ac7;_0x21f4ed[_0xe764('0x1b')]=_[_0xe764('0x19')](db[_0xe764('0x34')][_0xe764('0x16')]);_0x21f4ed[_0xe764('0x18')]=_['keys'](_0x27e618[_0xe764('0x18')]);_0x21f4ed['filters']=_[_0xe764('0x1a')](_0x21f4ed[_0xe764('0x1b')],_0x21f4ed['query']);_0x515a23[_0xe764('0x1c')]=_[_0xe764('0x1a')](_0x21f4ed[_0xe764('0x1b')],qs[_0xe764('0x1d')](_0x27e618[_0xe764('0x18')][_0xe764('0x1d')]));_0x515a23[_0xe764('0x1c')]=_0x515a23[_0xe764('0x1c')][_0xe764('0x1e')]?_0x515a23[_0xe764('0x1c')]:_0x21f4ed[_0xe764('0x1b')];_0x515a23['order']=qs[_0xe764('0x21')](_0x27e618[_0xe764('0x18')][_0xe764('0x21')]);_0x515a23[_0xe764('0x22')]=qs[_0xe764('0x23')](_[_0xe764('0x35')](_0x27e618[_0xe764('0x18')],_0x21f4ed[_0xe764('0x23')]));if(_0x27e618[_0xe764('0x18')][_0xe764('0x24')]){_0x515a23['where']=_[_0xe764('0x2c')](_0x515a23['where'],{'$or':_[_0xe764('0x14')](_0x515a23[_0xe764('0x1c')],function(_0x17bb3c){var _0x8a284b={};_0x8a284b[_0x17bb3c]={'$like':'%'+_0x27e618[_0xe764('0x18')][_0xe764('0x24')]+'%'};return _0x8a284b;})});}_0x515a23=_[_0xe764('0x2c')]({},_0x515a23,_0x27e618['options']);return _0x22989['getConfigurations'](_0x515a23);}})[_0xe764('0xc')](function(_0x5a4871){if(_0x5a4871){_0x4481e2=_0x5a4871['length'];if(!_0x27e618[_0xe764('0x18')][_0xe764('0x1f')]('nolimit')){_0x515a23[_0xe764('0x9')]=qs['limit'](_0x27e618['query'][_0xe764('0x9')]);_0x515a23[_0xe764('0x7')]=qs[_0xe764('0x7')](_0x27e618[_0xe764('0x18')][_0xe764('0x7')]);}return _0x22989[_0xe764('0x32')](_0x515a23);}})[_0xe764('0xc')](function(_0x1b2009){if(_0x1b2009){return _0x1b2009?{'count':_0x4481e2,'rows':_0x1b2009}:null;}})[_0xe764('0xc')](respondWithResult(_0x734ccc,null))[_0xe764('0x29')](handleError(_0x734ccc,null));};exports[_0xe764('0x36')]=function(_0xd9eb08,_0x13cfbc){if(_0xd9eb08[_0xe764('0x30')]['id']){delete _0xd9eb08['body']['id'];}return db[_0xe764('0x15')]['findOne']({'where':{'id':_0xd9eb08['params']['id']}})[_0xe764('0xc')](handleEntityNotFound(_0x13cfbc,null))[_0xe764('0xc')](function(_0x13119f){if(_0x13119f){_0xd9eb08[_0xe764('0x30')][_0xe764('0x37')]=_0x13119f['id'];_0xd9eb08[_0xe764('0x30')]['Subjects']=integrations[_0xe764('0x38')](_0xd9eb08[_0xe764('0x30')][_0xe764('0x39')],_0xd9eb08[_0xe764('0x30')][_0xe764('0x25')]);_0xd9eb08[_0xe764('0x30')][_0xe764('0x3a')]=integrations[_0xe764('0x3b')](_0xd9eb08[_0xe764('0x30')][_0xe764('0x39')],_0xd9eb08[_0xe764('0x30')][_0xe764('0x25')]);return db['Dynamics365Configuration']['create'](_0xd9eb08[_0xe764('0x30')],{'include':[{'model':db['Dynamics365Field'],'as':_0xe764('0x3c')},{'model':db[_0xe764('0x3d')],'as':_0xe764('0x3a')}]});}return null;})[_0xe764('0xc')](respondWithResult(_0x13cfbc,null))[_0xe764('0x29')](handleError(_0x13cfbc,null));};function sanitizeRemoteUri(_0x2e9cf9){var _0x469892=_0x2e9cf9['slice'](-0x1);if(_0x469892==='/')return _0x2e9cf9[_0xe764('0x3e')](0x0,_0x2e9cf9['lastIndexOf'](_0x469892));return _0x2e9cf9;}function getWebApiUrl(_0x502d23){return util[_0xe764('0x3f')]('%s/api/data/v9.0/',_0x502d23);}exports['getFields']=function(_0x1e598e,_0x36e057){var _0x29fcca=_0x1e598e[_0xe764('0x18')][_0xe764('0x40')];var _0x596ca8=_0x29fcca==='incident'?_0xe764('0x41'):'PhoneCall';var _0x1ae5fd='';var _0x423059='';var _0x2fba24='';var _0x40a8cd='';var _0x4fbf64='';var _0x1c2b21='';var _0x52de61='';var _0x4d7d39='';var _0x4d313d=[_0xe764('0x42'),_0xe764('0x43'),_0xe764('0x44'),_0xe764('0x45'),_0xe764('0x46'),_0xe764('0x47'),'phonenumber','regardingobjectid','directioncode',_0xe764('0x48')];var _0x23642e=[_0xe764('0x49'),'accountidyominame',_0xe764('0x4a'),'billedserviceunits',_0xe764('0x4b'),'contactidyominame',_0xe764('0x4c'),_0xe764('0x4d'),_0xe764('0x4e'),_0xe764('0x4f'),_0xe764('0x50'),'createdbyyominame',_0xe764('0x51'),_0xe764('0x52'),_0xe764('0x53'),_0xe764('0x54'),_0xe764('0x55'),_0xe764('0x56'),_0xe764('0x57'),_0xe764('0x58'),_0xe764('0x59'),_0xe764('0x5a'),_0xe764('0x5b'),_0xe764('0x5c'),'firstresponsebykpiidname',_0xe764('0x5d'),_0xe764('0x5e'),_0xe764('0x5f'),_0xe764('0x60'),'lastonholdtime',_0xe764('0x61'),_0xe764('0x62'),'modifiedbyexternalpartyyominame',_0xe764('0x63'),_0xe764('0x64'),_0xe764('0x65'),_0xe764('0x66'),_0xe764('0x67'),_0xe764('0x68'),_0xe764('0x69'),_0xe764('0x6a'),_0xe764('0x6b'),'overriddencreatedon',_0xe764('0x6c'),_0xe764('0x6d'),'owneridyominame',_0xe764('0x6e'),_0xe764('0x6f'),_0xe764('0x70'),'prioritycodename',_0xe764('0x71'),_0xe764('0x72'),_0xe764('0x73'),_0xe764('0x74'),_0xe764('0x75'),_0xe764('0x76'),_0xe764('0x77'),_0xe764('0x78'),_0xe764('0x79'),_0xe764('0x7a'),_0xe764('0x7b'),_0xe764('0x7c'),_0xe764('0x7d'),_0xe764('0x7e'),'ticketnumber',_0xe764('0x7f'),_0xe764('0x80'),_0xe764('0x81'),_0xe764('0x82'),_0xe764('0x83')];var _0x4f2783=_0x4d313d['concat'](_0x23642e);return db[_0xe764('0x15')][_0xe764('0x33')]({'where':{'id':_0x1e598e['params']['id']},'attributes':['id',_0xe764('0x84'),_0xe764('0x85'),_0xe764('0x86'),_0xe764('0x87'),'clientId',_0xe764('0x88'),_0xe764('0x89')],'include':[{'model':db['CloudProvider'],'as':_0xe764('0x8a'),'attributes':['id',_0xe764('0x8b'),'data7']}]})[_0xe764('0xc')](handleEntityNotFound(_0x36e057,null))[_0xe764('0xc')](function(_0x214bed){if(_0x214bed){if(_0x214bed[_0xe764('0x89')]){_0x214bed[_0xe764('0x8c')]=_0x214bed['CloudProvider'][_0xe764('0x8b')];_0x4d7d39=sanitizeRemoteUri(_0x214bed[_0xe764('0x8a')]['data7']);_0x52de61=getWebApiUrl(_0x4d7d39);return _0x214bed;}_0x4d7d39=sanitizeRemoteUri(_0x214bed[_0xe764('0x86')]);_0x52de61=getWebApiUrl(_0x4d7d39);var _0x577983={'method':'POST','uri':_0xe764('0x8d')+_0x214bed[_0xe764('0x87')]+_0xe764('0x8e'),'form':{'client_id':_0x214bed['clientId'],'resource':_0x4d7d39,'username':_0x214bed['username'],'password':_0x214bed[_0xe764('0x85')],'grant_type':'password','client_secret':_0x214bed[_0xe764('0x88')]},'json':!![]};return rp(_0x577983);}})[_0xe764('0xc')](function(_0x4bd706){_0x1c2b21=_0x4bd706[_0xe764('0x8c')];var _0x34fb2f={'method':_0xe764('0x8f'),'uri':encodeURI(_0x52de61+_0xe764('0x90')+_0x596ca8+'\x27'),'headers':{'Authorization':_0xe764('0x91')+_0x1c2b21,'If-None-Match':null,'OData-Version':_0xe764('0x92')},'json':!![]};return rp(_0x34fb2f);})[_0xe764('0xc')](function(_0x4ce2c1){var _0x53be47=_0x4ce2c1[_0xe764('0x93')][0x0];var _0x1d6951=_0x53be47[_0xe764('0x94')];var _0x3e574a={'method':_0xe764('0x8f'),'uri':_0x52de61+_0xe764('0x95')+_0x1d6951+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xe764('0x91')+_0x1c2b21,'If-None-Match':null,'OData-Version':_0xe764('0x92')},'json':!![]};return rp(_0x3e574a);})[_0xe764('0xc')](function(_0x6c15f5){_0x1ae5fd=_0x6c15f5;_0x423059=_0x1ae5fd[_0xe764('0x96')];_0x423059=_[_0xe764('0x97')](_0x423059,function(_0x35266c){return!_0x4f2783[_0xe764('0x98')](_0x35266c[_0xe764('0x99')]);});var _0x104199=[];var _0x5c3fbb=[];_0x423059['forEach'](function(_0x1fa57c){if(_0x1fa57c[_0xe764('0x9a')]){var _0x47d1fa=_0x1fa57c['@odata.type']['substring'](_0x1fa57c[_0xe764('0x9a')][_0xe764('0x9b')]('.')+0x1);if(_0x47d1fa===_0xe764('0x9c')){_0x104199['push'](getSelectList(_0x52de61,_0x29fcca,_0x5c3fbb,_0x1ae5fd[_0xe764('0x94')],_0x1fa57c[_0xe764('0x94')],_0x1c2b21));}}});return Promise['all'](_0x104199);})['then'](function(_0x37d8e8){_0x2fba24=_0x37d8e8[0x0];var _0xb4fb15=[];var _0x159e4a=[];_0x423059['forEach'](function(_0x52804d){if(!_['isNil'](_0x52804d['@odata.type'])){var _0x2be225=_0x52804d[_0xe764('0x9a')][_0xe764('0x3e')](_0x52804d[_0xe764('0x9a')]['lastIndexOf']('.')+0x1);if(_0x2be225==='BooleanAttributeMetadata'){_0xb4fb15[_0xe764('0x9d')](getBooleanList(_0x52de61,_0x29fcca,_0x159e4a,_0x1ae5fd[_0xe764('0x94')],_0x52804d[_0xe764('0x94')],_0x1c2b21));}}});return Promise[_0xe764('0x9e')](_0xb4fb15);})[_0xe764('0xc')](function(_0x12187e){_0x40a8cd=_0x12187e[0x0];var _0x191bc3=[];var _0x1ec4e4=[];_0x423059['forEach'](function(_0x88e734){if(_0x88e734[_0xe764('0x9a')]){var _0x205864=_0x88e734['@odata.type'][_0xe764('0x3e')](_0x88e734[_0xe764('0x9a')][_0xe764('0x9b')]('.')+0x1);if(_0x205864==='StringAttributeMetadata'||_0x205864==='DoubleAttributeMetadata'||_0x205864==='BigIntAttributeMetadata'||_0x205864===_0xe764('0x9f')||_0x205864==='MemoAttributeMetadata'||_0x205864===_0xe764('0xa0')||_0x205864===_0xe764('0xa1')||_0x205864===_0xe764('0xa2')||_0x205864===_0xe764('0xa3')||_0x205864===_0xe764('0xa4')){_0x191bc3['push'](getInputList(_0x52de61,_0x29fcca,_0x205864,_0x1ec4e4,_0x1ae5fd[_0xe764('0x94')],_0x88e734[_0xe764('0x94')],_0x1c2b21));}}});return Promise['all'](_0x191bc3);})[_0xe764('0xc')](function(_0x794dc8){_0x4fbf64=_0x794dc8[0x0];var _0x183787=_0x2fba24[_0xe764('0xa5')](_0x40a8cd)[_0xe764('0xa5')](_0x4fbf64);var _0x31ddb3={'count':_0x183787[_0xe764('0x1e')],'rows':_0x183787};return _0x31ddb3;})[_0xe764('0xc')](respondWithResult(_0x36e057,null))[_0xe764('0x29')](function(_0x5610fd){var _0x346ec8=_0x1e598e[_0xe764('0x18')][_0xe764('0xa6')]?0x1f4:_0x5610fd['statusCode']||0x1f4;logger[_0xe764('0xe')](_0x5610fd[_0xe764('0xf')]);delete _0x5610fd[_0xe764('0x10')];if(_0x346ec8===0x191){_0x346ec8=0x190;}_0x36e057[_0xe764('0x11')](_0x346ec8)[_0xe764('0x12')](_0x1e598e[_0xe764('0x18')]['test']?{'message':_0xe764('0xa7'),'statusCode':_0x5610fd[_0xe764('0xa8')]}:_0x5610fd);});};function getSelectList(_0x2a4af4,_0x3ab70c,_0x4b5d46,_0x3d2d3b,_0x3264a9,_0x5269f8){var _0x27e5ac={'method':'GET','uri':_0x2a4af4+_0xe764('0x95')+_0x3d2d3b+_0xe764('0xa9')+_0x3264a9+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xe764('0x91')+_0x5269f8,'If-None-Match':null,'OData-Version':_0xe764('0x92')},'json':!![]};return rp(_0x27e5ac)[_0xe764('0xc')](function(_0x441844){var _0x217e94=[];var _0x34d4b7=_0x441844[_0xe764('0xaa')][_0xe764('0xab')];_0x34d4b7['forEach'](function(_0x5e9fef){_0x217e94['push']({'name':_0x5e9fef[_0xe764('0xac')]['UserLocalizedLabel']['Label'],'value':String(_0x5e9fef[_0xe764('0xad')])});});var _0x4b7313={'id':_0x3ab70c+'_'+_0x441844[_0xe764('0x99')],'name':_0x441844[_0xe764('0xae')][_0xe764('0xaf')]['Label'],'custom':![],'options':_0x217e94};_0x4b5d46[_0xe764('0x9d')](_0x4b7313);return _0x4b5d46;});}function getBooleanList(_0x2ea5b8,_0x421e72,_0x3b2017,_0xf99898,_0x22fcc9,_0x1e3cce){var _0xcdbe4c={'method':_0xe764('0x8f'),'uri':_0x2ea5b8+_0xe764('0x95')+_0xf99898+_0xe764('0xa9')+_0x22fcc9+_0xe764('0xb0'),'headers':{'Authorization':'Bearer\x20'+_0x1e3cce,'If-None-Match':null,'OData-Version':_0xe764('0x92')},'json':!![]};return rp(_0xcdbe4c)['then'](function(_0x29da83){var _0x130adc=[];_0x130adc[_0xe764('0x9d')]({'name':_0x29da83['OptionSet'][_0xe764('0xb1')][_0xe764('0xac')][_0xe764('0xaf')]['Label'],'value':'true'},{'name':_0x29da83[_0xe764('0xaa')][_0xe764('0xb2')]['Label']['UserLocalizedLabel'][_0xe764('0xac')],'value':_0xe764('0xb3')});var _0xeea8fb={'id':_0x421e72+'_'+_0x29da83[_0xe764('0x99')],'name':_0x29da83['DisplayName'][_0xe764('0xaf')][_0xe764('0xac')],'custom':![],'options':_0x130adc};_0x3b2017[_0xe764('0x9d')](_0xeea8fb);return _0x3b2017;});}function getInputList(_0x46560f,_0x426a14,_0x4197ed,_0x8340a7,_0x50e8b0,_0x1cc852,_0x2f7ff7){var _0x3e6d72={'method':'GET','uri':_0x46560f+_0xe764('0x95')+_0x50e8b0+_0xe764('0xa9')+_0x1cc852+_0xe764('0xb4')+_0x4197ed+_0xe764('0xb5'),'headers':{'Authorization':_0xe764('0x91')+_0x2f7ff7,'If-None-Match':null,'OData-Version':_0xe764('0x92')},'json':!![]};return rp(_0x3e6d72)['then'](function(_0x4d8f99){var _0x1f585d={'id':_0x426a14+'_'+_0x4d8f99[_0xe764('0x99')],'name':_0x4d8f99[_0xe764('0xae')][_0xe764('0xaf')]?_0x4d8f99[_0xe764('0xae')]['UserLocalizedLabel'][_0xe764('0xac')]:_0x4d8f99[_0xe764('0x99')],'custom':![],'options':[]};_0x8340a7[_0xe764('0x9d')](_0x1f585d);return _0x8340a7;});} \ No newline at end of file +var _0xcf3b=['clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','POST','/oauth2/token','password','GET','Bearer\x20','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','all','isNil','BooleanAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StateAttributeMetadata','push','concat','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','catch','show','params','length','options','create','body','find','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','username','remoteUri','tenantId','clientId'];(function(_0x54f89f,_0x1843d2){var _0x3b560c=function(_0x5c893d){while(--_0x5c893d){_0x54f89f['push'](_0x54f89f['shift']());}};_0x3b560c(++_0x1843d2);}(_0xcf3b,0xee));var _0xbcf3=function(_0x1c5f9a,_0x288491){_0x1c5f9a=_0x1c5f9a-0x0;var _0x46a5bd=_0xcf3b[_0x1c5f9a];return _0x46a5bd;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0xbcf3('0x0'));var qs=require(_0xbcf3('0x1'));var logger=require(_0xbcf3('0x2'))(_0xbcf3('0x3'));var db=require(_0xbcf3('0x4'))['db'];var integrations=require(_0xbcf3('0x5'));function respondWithResult(_0x506c9d,_0x9fe60c){_0x9fe60c=_0x9fe60c||0xc8;return function(_0x25722a){if(_0x25722a){return _0x506c9d[_0xbcf3('0x6')](_0x9fe60c)[_0xbcf3('0x7')](_0x25722a);}};}function respondWithFilteredResult(_0x5442e5,_0x4c7d3a){return function(_0xfef604){if(_0xfef604){var _0x15274c=typeof _0x4c7d3a[_0xbcf3('0x8')]==='undefined'&&typeof _0x4c7d3a[_0xbcf3('0x9')]==='undefined';var _0x5ee69a=_0xfef604[_0xbcf3('0xa')];var _0x475798=_0x15274c?0x0:_0x4c7d3a['offset'];var _0x19d09b=_0x15274c?_0xfef604[_0xbcf3('0xa')]:_0x4c7d3a[_0xbcf3('0x8')]+_0x4c7d3a['limit'];var _0x3efeda;if(_0x19d09b>=_0x5ee69a){_0x19d09b=_0x5ee69a;_0x3efeda=0xc8;}else{_0x3efeda=0xce;}_0x5442e5['status'](_0x3efeda);return _0x5442e5[_0xbcf3('0xb')](_0xbcf3('0xc'),_0x475798+'-'+_0x19d09b+'/'+_0x5ee69a)[_0xbcf3('0x7')](_0xfef604);}return null;};}function saveUpdates(_0x90fd82){return function(_0x161c2f){if(_0x161c2f){return _0x161c2f[_0xbcf3('0xd')](_0x90fd82)[_0xbcf3('0xe')](function(_0xb6664b){return _0xb6664b;});}return null;};}function removeEntity(_0x18ee99){return function(_0x4cf601){if(_0x4cf601){return _0x4cf601[_0xbcf3('0xf')]()[_0xbcf3('0xe')](function(){_0x18ee99[_0xbcf3('0x6')](0xcc)[_0xbcf3('0x10')]();});}};}function handleEntityNotFound(_0x26fe87){return function(_0x420555){if(!_0x420555){_0x26fe87['sendStatus'](0x194);}return _0x420555;};}function handleError(_0x21e8a5,_0x5fd88d){_0x5fd88d=_0x5fd88d||0x1f4;return function(_0x42ba60){logger[_0xbcf3('0x11')](_0x42ba60[_0xbcf3('0x12')]);if(_0x42ba60[_0xbcf3('0x13')]){delete _0x42ba60['name'];}_0x21e8a5['status'](_0x5fd88d)[_0xbcf3('0x14')](_0x42ba60);};}exports[_0xbcf3('0x15')]=function(_0x2b28af,_0x17cea1){var _0x42d96c={},_0x4b394b={},_0x2932f9={'count':0x0,'rows':[]};var _0x39ce6a=_[_0xbcf3('0x16')](db[_0xbcf3('0x17')][_0xbcf3('0x18')],function(_0xea77d){return{'name':_0xea77d[_0xbcf3('0x19')],'type':_0xea77d[_0xbcf3('0x1a')][_0xbcf3('0x1b')]};});_0x4b394b[_0xbcf3('0x1c')]=_[_0xbcf3('0x16')](_0x39ce6a,_0xbcf3('0x13'));_0x4b394b['query']=_[_0xbcf3('0x1d')](_0x2b28af['query']);_0x4b394b[_0xbcf3('0x1e')]=_[_0xbcf3('0x1f')](_0x4b394b[_0xbcf3('0x1c')],_0x4b394b['query']);_0x42d96c[_0xbcf3('0x20')]=_[_0xbcf3('0x1f')](_0x4b394b[_0xbcf3('0x1c')],qs[_0xbcf3('0x21')](_0x2b28af[_0xbcf3('0x22')][_0xbcf3('0x21')]));_0x42d96c[_0xbcf3('0x20')]=_0x42d96c['attributes']['length']?_0x42d96c['attributes']:_0x4b394b[_0xbcf3('0x1c')];if(!_0x2b28af[_0xbcf3('0x22')][_0xbcf3('0x23')](_0xbcf3('0x24'))){_0x42d96c['limit']=qs[_0xbcf3('0x9')](_0x2b28af[_0xbcf3('0x22')]['limit']);_0x42d96c[_0xbcf3('0x8')]=qs['offset'](_0x2b28af[_0xbcf3('0x22')][_0xbcf3('0x8')]);}_0x42d96c[_0xbcf3('0x25')]=qs[_0xbcf3('0x26')](_0x2b28af[_0xbcf3('0x22')][_0xbcf3('0x26')]);_0x42d96c[_0xbcf3('0x27')]=qs[_0xbcf3('0x1e')](_[_0xbcf3('0x28')](_0x2b28af[_0xbcf3('0x22')],_0x4b394b[_0xbcf3('0x1e')]),_0x39ce6a);if(_0x2b28af[_0xbcf3('0x22')][_0xbcf3('0x29')]){_0x42d96c[_0xbcf3('0x27')]=_['merge'](_0x42d96c[_0xbcf3('0x27')],{'$or':_['map'](_0x39ce6a,function(_0x3a3235){if(_0x3a3235['type']!==_0xbcf3('0x2a')){var _0x45d9fc={};_0x45d9fc[_0x3a3235[_0xbcf3('0x13')]]={'$like':'%'+_0x2b28af[_0xbcf3('0x22')][_0xbcf3('0x29')]+'%'};return _0x45d9fc;}})});}_0x42d96c=_[_0xbcf3('0x2b')]({},_0x42d96c,_0x2b28af['options']);var _0x2c6a42={'where':_0x42d96c[_0xbcf3('0x27')]};return db[_0xbcf3('0x17')]['count'](_0x2c6a42)['then'](function(_0x427285){_0x2932f9['count']=_0x427285;if(_0x2b28af['query'][_0xbcf3('0x2c')]){_0x42d96c['include']=[{'all':!![]}];}return db[_0xbcf3('0x17')]['findAll'](_0x42d96c);})[_0xbcf3('0xe')](function(_0x15fb87){_0x2932f9[_0xbcf3('0x2d')]=_0x15fb87;return _0x2932f9;})['then'](respondWithFilteredResult(_0x17cea1,_0x42d96c))[_0xbcf3('0x2e')](handleError(_0x17cea1,null));};exports[_0xbcf3('0x2f')]=function(_0x2abb92,_0x515b03){var _0x8e63d7={'raw':![],'where':{'id':_0x2abb92[_0xbcf3('0x30')]['id']}},_0x57b18e={};_0x57b18e[_0xbcf3('0x1c')]=_[_0xbcf3('0x1d')](db[_0xbcf3('0x17')][_0xbcf3('0x18')]);_0x57b18e[_0xbcf3('0x22')]=_['keys'](_0x2abb92[_0xbcf3('0x22')]);_0x57b18e['filters']=_['intersection'](_0x57b18e['model'],_0x57b18e[_0xbcf3('0x22')]);_0x8e63d7[_0xbcf3('0x20')]=_[_0xbcf3('0x1f')](_0x57b18e[_0xbcf3('0x1c')],qs[_0xbcf3('0x21')](_0x2abb92[_0xbcf3('0x22')][_0xbcf3('0x21')]));_0x8e63d7[_0xbcf3('0x20')]=_0x8e63d7[_0xbcf3('0x20')][_0xbcf3('0x31')]?_0x8e63d7[_0xbcf3('0x20')]:_0x57b18e['model'];if(_0x2abb92['query'][_0xbcf3('0x2c')]){_0x8e63d7['include']=[{'all':!![]}];}_0x8e63d7=_[_0xbcf3('0x2b')]({},_0x8e63d7,_0x2abb92[_0xbcf3('0x32')]);return db[_0xbcf3('0x17')]['find'](_0x8e63d7)['then'](handleEntityNotFound(_0x515b03,null))[_0xbcf3('0xe')](respondWithResult(_0x515b03,null))[_0xbcf3('0x2e')](handleError(_0x515b03,null));};exports[_0xbcf3('0x33')]=function(_0x5cf0e4,_0x172783){return db[_0xbcf3('0x17')]['create'](_0x5cf0e4[_0xbcf3('0x34')],{})[_0xbcf3('0xe')](respondWithResult(_0x172783,0xc9))[_0xbcf3('0x2e')](handleError(_0x172783,null));};exports['update']=function(_0x14b33b,_0x27f92c){if(_0x14b33b['body']['id']){delete _0x14b33b[_0xbcf3('0x34')]['id'];}return db[_0xbcf3('0x17')][_0xbcf3('0x35')]({'where':{'id':_0x14b33b['params']['id']}})[_0xbcf3('0xe')](handleEntityNotFound(_0x27f92c,null))['then'](saveUpdates(_0x14b33b[_0xbcf3('0x34')],null))[_0xbcf3('0xe')](respondWithResult(_0x27f92c,null))[_0xbcf3('0x2e')](handleError(_0x27f92c,null));};exports[_0xbcf3('0xf')]=function(_0x4ad7bc,_0x503f74){return db['Dynamics365Account'][_0xbcf3('0x35')]({'where':{'id':_0x4ad7bc[_0xbcf3('0x30')]['id']}})[_0xbcf3('0xe')](handleEntityNotFound(_0x503f74,null))[_0xbcf3('0xe')](removeEntity(_0x503f74,null))[_0xbcf3('0x2e')](handleError(_0x503f74,null));};exports[_0xbcf3('0x36')]=function(_0x3a6ec5,_0x3803ef){var _0x4034a4={};var _0x395b32={};var _0x5c4962;var _0x56359f;return db['Dynamics365Account'][_0xbcf3('0x37')]({'where':{'id':_0x3a6ec5['params']['id']}})['then'](handleEntityNotFound(_0x3803ef,null))['then'](function(_0x14c8f7){if(_0x14c8f7){_0x5c4962=_0x14c8f7;_0x395b32[_0xbcf3('0x1c')]=_[_0xbcf3('0x1d')](db[_0xbcf3('0x38')][_0xbcf3('0x18')]);_0x395b32[_0xbcf3('0x22')]=_[_0xbcf3('0x1d')](_0x3a6ec5[_0xbcf3('0x22')]);_0x395b32[_0xbcf3('0x1e')]=_['intersection'](_0x395b32[_0xbcf3('0x1c')],_0x395b32[_0xbcf3('0x22')]);_0x4034a4['attributes']=_['intersection'](_0x395b32[_0xbcf3('0x1c')],qs['fields'](_0x3a6ec5[_0xbcf3('0x22')][_0xbcf3('0x21')]));_0x4034a4[_0xbcf3('0x20')]=_0x4034a4[_0xbcf3('0x20')][_0xbcf3('0x31')]?_0x4034a4[_0xbcf3('0x20')]:_0x395b32['model'];_0x4034a4['order']=qs['sort'](_0x3a6ec5[_0xbcf3('0x22')][_0xbcf3('0x26')]);_0x4034a4[_0xbcf3('0x27')]=qs['filters'](_[_0xbcf3('0x28')](_0x3a6ec5['query'],_0x395b32[_0xbcf3('0x1e')]));if(_0x3a6ec5[_0xbcf3('0x22')]['filter']){_0x4034a4[_0xbcf3('0x27')]=_['merge'](_0x4034a4['where'],{'$or':_[_0xbcf3('0x16')](_0x4034a4[_0xbcf3('0x20')],function(_0x3a50ac){var _0x2b82ca={};_0x2b82ca[_0x3a50ac]={'$like':'%'+_0x3a6ec5[_0xbcf3('0x22')][_0xbcf3('0x29')]+'%'};return _0x2b82ca;})});}_0x4034a4=_['merge']({},_0x4034a4,_0x3a6ec5[_0xbcf3('0x32')]);return _0x5c4962['getConfigurations'](_0x4034a4);}})[_0xbcf3('0xe')](function(_0x1532c4){if(_0x1532c4){_0x56359f=_0x1532c4[_0xbcf3('0x31')];if(!_0x3a6ec5[_0xbcf3('0x22')]['hasOwnProperty'](_0xbcf3('0x24'))){_0x4034a4[_0xbcf3('0x9')]=qs[_0xbcf3('0x9')](_0x3a6ec5[_0xbcf3('0x22')][_0xbcf3('0x9')]);_0x4034a4[_0xbcf3('0x8')]=qs[_0xbcf3('0x8')](_0x3a6ec5['query'][_0xbcf3('0x8')]);}return _0x5c4962[_0xbcf3('0x36')](_0x4034a4);}})['then'](function(_0xa2b16f){if(_0xa2b16f){return _0xa2b16f?{'count':_0x56359f,'rows':_0xa2b16f}:null;}})[_0xbcf3('0xe')](respondWithResult(_0x3803ef,null))[_0xbcf3('0x2e')](handleError(_0x3803ef,null));};exports[_0xbcf3('0x39')]=function(_0x4da0af,_0x23c7f5){if(_0x4da0af[_0xbcf3('0x34')]['id']){delete _0x4da0af[_0xbcf3('0x34')]['id'];}return db[_0xbcf3('0x17')]['findOne']({'where':{'id':_0x4da0af['params']['id']}})[_0xbcf3('0xe')](handleEntityNotFound(_0x23c7f5,null))[_0xbcf3('0xe')](function(_0x2f53b0){if(_0x2f53b0){_0x4da0af['body'][_0xbcf3('0x3a')]=_0x2f53b0['id'];_0x4da0af[_0xbcf3('0x34')][_0xbcf3('0x3b')]=integrations[_0xbcf3('0x3c')](_0x4da0af['body']['channel'],_0x4da0af[_0xbcf3('0x34')]['type']);_0x4da0af['body'][_0xbcf3('0x3d')]=integrations['getDescriptions'](_0x4da0af[_0xbcf3('0x34')][_0xbcf3('0x3e')],_0x4da0af['body']['type']);return db[_0xbcf3('0x38')][_0xbcf3('0x33')](_0x4da0af[_0xbcf3('0x34')],{'include':[{'model':db['Dynamics365Field'],'as':_0xbcf3('0x3b')},{'model':db['Dynamics365Field'],'as':_0xbcf3('0x3d')}]});}return null;})[_0xbcf3('0xe')](respondWithResult(_0x23c7f5,null))[_0xbcf3('0x2e')](handleError(_0x23c7f5,null));};function sanitizeRemoteUri(_0x4d9097){var _0x1635fe=_0x4d9097[_0xbcf3('0x3f')](-0x1);if(_0x1635fe==='/')return _0x4d9097[_0xbcf3('0x40')](0x0,_0x4d9097[_0xbcf3('0x41')](_0x1635fe));return _0x4d9097;}function getWebApiUrl(_0x43bc6d){return util[_0xbcf3('0x42')](_0xbcf3('0x43'),_0x43bc6d);}exports[_0xbcf3('0x44')]=function(_0x220267,_0x42592f){var _0x1f63a0=_0x220267['query'][_0xbcf3('0x45')];var _0x366185=_0x1f63a0===_0xbcf3('0x46')?_0xbcf3('0x47'):_0xbcf3('0x48');var _0x2c1cfc='';var _0x5ab4e9='';var _0x232700='';var _0xba79af='';var _0x4b41e5='';var _0x35cff8='';var _0x46b1bf='';var _0x2e372c='';var _0x41517e=[_0xbcf3('0x49'),'description',_0xbcf3('0x4a'),_0xbcf3('0x4b'),_0xbcf3('0x4c'),_0xbcf3('0x4d'),_0xbcf3('0x4e'),_0xbcf3('0x4f'),_0xbcf3('0x50'),_0xbcf3('0x51')];var _0x5ac2ea=[_0xbcf3('0x52'),_0xbcf3('0x53'),'actualserviceunits',_0xbcf3('0x54'),_0xbcf3('0x55'),'contactidyominame','contractdetailidname',_0xbcf3('0x56'),_0xbcf3('0x57'),_0xbcf3('0x58'),'createdbyname',_0xbcf3('0x59'),'createdon',_0xbcf3('0x5a'),'createdonbehalfbyyominame',_0xbcf3('0x5b'),_0xbcf3('0x5c'),_0xbcf3('0x5d'),'emailaddress',_0xbcf3('0x5e'),_0xbcf3('0x5f'),'entityimage_url',_0xbcf3('0x60'),_0xbcf3('0x61'),_0xbcf3('0x62'),_0xbcf3('0x63'),'importsequencenumber','influencescore',_0xbcf3('0x64'),_0xbcf3('0x65'),'masteridname',_0xbcf3('0x66'),_0xbcf3('0x67'),_0xbcf3('0x68'),'modifiedbyyominame',_0xbcf3('0x69'),_0xbcf3('0x6a'),_0xbcf3('0x6b'),_0xbcf3('0x6c'),'msdyn_iotalertname',_0xbcf3('0x6d'),'onholdtime',_0xbcf3('0x6e'),_0xbcf3('0x6f'),_0xbcf3('0x70'),_0xbcf3('0x71'),_0xbcf3('0x72'),_0xbcf3('0x73'),_0xbcf3('0x74'),_0xbcf3('0x75'),_0xbcf3('0x76'),_0xbcf3('0x77'),_0xbcf3('0x78'),_0xbcf3('0x79'),'responseby',_0xbcf3('0x7a'),_0xbcf3('0x7b'),_0xbcf3('0x7c'),_0xbcf3('0x7d'),_0xbcf3('0x7e'),_0xbcf3('0x7f'),_0xbcf3('0x80'),_0xbcf3('0x81'),_0xbcf3('0x82'),_0xbcf3('0x83'),_0xbcf3('0x84'),_0xbcf3('0x85'),_0xbcf3('0x86'),'utcconversiontimezonecode',_0xbcf3('0x87')];var _0x28cbd2=_0x41517e['concat'](_0x5ac2ea);return db[_0xbcf3('0x17')][_0xbcf3('0x37')]({'where':{'id':_0x220267['params']['id']},'attributes':['id',_0xbcf3('0x88'),'password',_0xbcf3('0x89'),_0xbcf3('0x8a'),_0xbcf3('0x8b'),_0xbcf3('0x8c'),_0xbcf3('0x8d')],'include':[{'model':db[_0xbcf3('0x8e')],'as':_0xbcf3('0x8e'),'attributes':['id',_0xbcf3('0x8f'),'data7']}]})[_0xbcf3('0xe')](handleEntityNotFound(_0x42592f,null))['then'](function(_0x2d7e6c){if(_0x2d7e6c){if(_0x2d7e6c['modernAuthentication']){_0x2d7e6c[_0xbcf3('0x90')]=_0x2d7e6c[_0xbcf3('0x8e')][_0xbcf3('0x8f')];_0x2e372c=sanitizeRemoteUri(_0x2d7e6c[_0xbcf3('0x8e')][_0xbcf3('0x91')]);_0x46b1bf=getWebApiUrl(_0x2e372c);return _0x2d7e6c;}_0x2e372c=sanitizeRemoteUri(_0x2d7e6c['remoteUri']);_0x46b1bf=getWebApiUrl(_0x2e372c);var _0x2ccbd5={'method':_0xbcf3('0x92'),'uri':'https://login.microsoftonline.com/'+_0x2d7e6c[_0xbcf3('0x8a')]+_0xbcf3('0x93'),'form':{'client_id':_0x2d7e6c[_0xbcf3('0x8b')],'resource':_0x2e372c,'username':_0x2d7e6c[_0xbcf3('0x88')],'password':_0x2d7e6c[_0xbcf3('0x94')],'grant_type':_0xbcf3('0x94'),'client_secret':_0x2d7e6c['clientSecret']},'json':!![]};return rp(_0x2ccbd5);}})['then'](function(_0x5efbf6){_0x35cff8=_0x5efbf6['access_token'];var _0x351a70={'method':_0xbcf3('0x95'),'uri':encodeURI(_0x46b1bf+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x366185+'\x27'),'headers':{'Authorization':_0xbcf3('0x96')+_0x35cff8,'If-None-Match':null,'OData-Version':_0xbcf3('0x97')},'json':!![]};return rp(_0x351a70);})[_0xbcf3('0xe')](function(_0x59e01e){var _0x8da568=_0x59e01e[_0xbcf3('0x98')][0x0];var _0x5e63df=_0x8da568['MetadataId'];var _0x3b6624={'method':_0xbcf3('0x95'),'uri':_0x46b1bf+_0xbcf3('0x99')+_0x5e63df+_0xbcf3('0x9a'),'headers':{'Authorization':'Bearer\x20'+_0x35cff8,'If-None-Match':null,'OData-Version':_0xbcf3('0x97')},'json':!![]};return rp(_0x3b6624);})[_0xbcf3('0xe')](function(_0x2e7172){_0x2c1cfc=_0x2e7172;_0x5ab4e9=_0x2c1cfc[_0xbcf3('0x9b')];_0x5ab4e9=_[_0xbcf3('0x9c')](_0x5ab4e9,function(_0x4d0cec){return!_0x28cbd2['includes'](_0x4d0cec[_0xbcf3('0x9d')]);});var _0x2e9613=[];var _0xe8be4c=[];_0x5ab4e9[_0xbcf3('0x9e')](function(_0x510bef){if(_0x510bef[_0xbcf3('0x9f')]){var _0x1231cc=_0x510bef[_0xbcf3('0x9f')][_0xbcf3('0x40')](_0x510bef['@odata.type']['lastIndexOf']('.')+0x1);if(_0x1231cc===_0xbcf3('0xa0')){_0x2e9613['push'](getSelectList(_0x46b1bf,_0x1f63a0,_0xe8be4c,_0x2c1cfc['MetadataId'],_0x510bef[_0xbcf3('0xa1')],_0x35cff8));}}});return Promise[_0xbcf3('0xa2')](_0x2e9613);})[_0xbcf3('0xe')](function(_0x4e9996){_0x232700=_0x4e9996[0x0];var _0x47bd3d=[];var _0x3ec209=[];_0x5ab4e9[_0xbcf3('0x9e')](function(_0x71fdcd){if(!_[_0xbcf3('0xa3')](_0x71fdcd[_0xbcf3('0x9f')])){var _0x1c8e1d=_0x71fdcd['@odata.type'][_0xbcf3('0x40')](_0x71fdcd[_0xbcf3('0x9f')][_0xbcf3('0x41')]('.')+0x1);if(_0x1c8e1d===_0xbcf3('0xa4')){_0x47bd3d['push'](getBooleanList(_0x46b1bf,_0x1f63a0,_0x3ec209,_0x2c1cfc[_0xbcf3('0xa1')],_0x71fdcd['MetadataId'],_0x35cff8));}}});return Promise[_0xbcf3('0xa2')](_0x47bd3d);})[_0xbcf3('0xe')](function(_0x13d024){_0xba79af=_0x13d024[0x0];var _0x54c79a=[];var _0x1a86f7=[];_0x5ab4e9['forEach'](function(_0xb5248e){if(_0xb5248e[_0xbcf3('0x9f')]){var _0x242ef7=_0xb5248e[_0xbcf3('0x9f')][_0xbcf3('0x40')](_0xb5248e[_0xbcf3('0x9f')]['lastIndexOf']('.')+0x1);if(_0x242ef7==='StringAttributeMetadata'||_0x242ef7==='DoubleAttributeMetadata'||_0x242ef7===_0xbcf3('0xa5')||_0x242ef7===_0xbcf3('0xa6')||_0x242ef7===_0xbcf3('0xa7')||_0x242ef7==='DateTimeAttributeMetadata'||_0x242ef7==='StatusAttributeMetadata'||_0x242ef7==='EntityNameAttributeMetadata'||_0x242ef7===_0xbcf3('0xa8')||_0x242ef7==='DecimalAttributeMetadata'){_0x54c79a[_0xbcf3('0xa9')](getInputList(_0x46b1bf,_0x1f63a0,_0x242ef7,_0x1a86f7,_0x2c1cfc[_0xbcf3('0xa1')],_0xb5248e[_0xbcf3('0xa1')],_0x35cff8));}}});return Promise[_0xbcf3('0xa2')](_0x54c79a);})[_0xbcf3('0xe')](function(_0x58ed73){_0x4b41e5=_0x58ed73[0x0];var _0x131dfa=_0x232700[_0xbcf3('0xaa')](_0xba79af)['concat'](_0x4b41e5);var _0x314d90={'count':_0x131dfa[_0xbcf3('0x31')],'rows':_0x131dfa};return _0x314d90;})[_0xbcf3('0xe')](respondWithResult(_0x42592f,null))[_0xbcf3('0x2e')](function(_0x28cbdc){var _0x58f87b=_0x220267[_0xbcf3('0x22')][_0xbcf3('0xab')]?0x1f4:_0x28cbdc[_0xbcf3('0xac')]||0x1f4;logger['error'](_0x28cbdc[_0xbcf3('0x12')]);delete _0x28cbdc['name'];if(_0x58f87b===0x191){_0x58f87b=0x190;}_0x42592f['status'](_0x58f87b)[_0xbcf3('0x14')](_0x220267[_0xbcf3('0x22')][_0xbcf3('0xab')]?{'message':_0xbcf3('0xad'),'statusCode':_0x28cbdc[_0xbcf3('0xac')]}:_0x28cbdc);});};function getSelectList(_0x39932e,_0x516e68,_0x20d07b,_0x1367a9,_0xac4a3f,_0x52ab20){var _0x18db3c={'method':'GET','uri':_0x39932e+_0xbcf3('0x99')+_0x1367a9+_0xbcf3('0xae')+_0xac4a3f+_0xbcf3('0xaf')+_0xbcf3('0xb0'),'headers':{'Authorization':_0xbcf3('0x96')+_0x52ab20,'If-None-Match':null,'OData-Version':_0xbcf3('0x97')},'json':!![]};return rp(_0x18db3c)[_0xbcf3('0xe')](function(_0x52cda3){var _0x44b522=[];var _0x1abb4a=_0x52cda3[_0xbcf3('0xb1')][_0xbcf3('0xb2')];_0x1abb4a[_0xbcf3('0x9e')](function(_0x503e27){_0x44b522[_0xbcf3('0xa9')]({'name':_0x503e27['Label'][_0xbcf3('0xb3')][_0xbcf3('0xb4')],'value':String(_0x503e27[_0xbcf3('0xb5')])});});var _0x3eca3a={'id':_0x516e68+'_'+_0x52cda3[_0xbcf3('0x9d')],'name':_0x52cda3[_0xbcf3('0xb6')][_0xbcf3('0xb3')][_0xbcf3('0xb4')],'custom':![],'options':_0x44b522};_0x20d07b[_0xbcf3('0xa9')](_0x3eca3a);return _0x20d07b;});}function getBooleanList(_0x37f492,_0x394b29,_0x45cc7a,_0x3d90f2,_0x4e5d2e,_0x520d5e){var _0x4fe160={'method':_0xbcf3('0x95'),'uri':_0x37f492+_0xbcf3('0x99')+_0x3d90f2+')/Attributes('+_0x4e5d2e+_0xbcf3('0xb7'),'headers':{'Authorization':_0xbcf3('0x96')+_0x520d5e,'If-None-Match':null,'OData-Version':_0xbcf3('0x97')},'json':!![]};return rp(_0x4fe160)[_0xbcf3('0xe')](function(_0x5e1c24){var _0x19582f=[];_0x19582f['push']({'name':_0x5e1c24['OptionSet'][_0xbcf3('0xb8')][_0xbcf3('0xb4')][_0xbcf3('0xb3')][_0xbcf3('0xb4')],'value':_0xbcf3('0xb9')},{'name':_0x5e1c24['OptionSet']['FalseOption'][_0xbcf3('0xb4')][_0xbcf3('0xb3')][_0xbcf3('0xb4')],'value':_0xbcf3('0xba')});var _0x4d100a={'id':_0x394b29+'_'+_0x5e1c24[_0xbcf3('0x9d')],'name':_0x5e1c24[_0xbcf3('0xb6')][_0xbcf3('0xb3')][_0xbcf3('0xb4')],'custom':![],'options':_0x19582f};_0x45cc7a[_0xbcf3('0xa9')](_0x4d100a);return _0x45cc7a;});}function getInputList(_0x3f5a01,_0xd80d29,_0x4f4c27,_0x1c62f2,_0x22ca14,_0x14622b,_0x42e04b){var _0x2f0dc8={'method':_0xbcf3('0x95'),'uri':_0x3f5a01+'EntityDefinitions('+_0x22ca14+')/Attributes('+_0x14622b+_0xbcf3('0xbb')+_0x4f4c27+_0xbcf3('0xbc'),'headers':{'Authorization':_0xbcf3('0x96')+_0x42e04b,'If-None-Match':null,'OData-Version':_0xbcf3('0x97')},'json':!![]};return rp(_0x2f0dc8)[_0xbcf3('0xe')](function(_0x1d8a1c){var _0x1e04f7={'id':_0xd80d29+'_'+_0x1d8a1c[_0xbcf3('0x9d')],'name':_0x1d8a1c[_0xbcf3('0xb6')][_0xbcf3('0xb3')]?_0x1d8a1c[_0xbcf3('0xb6')][_0xbcf3('0xb3')]['Label']:_0x1d8a1c[_0xbcf3('0x9d')],'custom':![],'options':[]};_0x1c62f2[_0xbcf3('0xa9')](_0x1e04f7);return _0x1c62f2;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 6175c1a..a30f770 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(_0x67a349,_0x567643){var _0x480c4e=function(_0x219c52){while(--_0x219c52){_0x67a349['push'](_0x67a349['shift']());}};_0x480c4e(++_0x567643);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'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 415e9df..0ec3448 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 _0x7ce8=['../../config/environment','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4e105c,_0x351098){var _0x278358=function(_0x142b85){while(--_0x142b85){_0x4e105c['push'](_0x4e105c['shift']());}};_0x278358(++_0x351098);}(_0x7ce8,0xed));var _0x87ce=function(_0x21b359,_0x4dc80e){_0x21b359=_0x21b359-0x0;var _0x57b8e7=_0x7ce8[_0x21b359];return _0x57b8e7;};'use strict';var _=require(_0x87ce('0x0'));var util=require(_0x87ce('0x1'));var moment=require('moment');var BPromise=require(_0x87ce('0x2'));var rs=require(_0x87ce('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87ce('0x4'))['db'];var utils=require(_0x87ce('0x5'));var logger=require(_0x87ce('0x6'))(_0x87ce('0x7'));var config=require(_0x87ce('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x87ce('0x9')][_0x87ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a9d0a,_0xec04ca,_0x23d38f){return new BPromise(function(_0x8d2868,_0x1c3bcc){return client[_0x87ce('0xb')](_0x2a9d0a,_0x23d38f)[_0x87ce('0xc')](function(_0x413dcf){logger[_0x87ce('0xd')](_0x87ce('0xe'),_0xec04ca,'request\x20sent');logger[_0x87ce('0xf')](_0x87ce('0x10'),_0xec04ca,_0x87ce('0x11'),JSON[_0x87ce('0x12')](_0x413dcf));if(_0x413dcf['error']){if(_0x413dcf['error'][_0x87ce('0x13')]===0x1f4){logger[_0x87ce('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0xec04ca,_0x413dcf[_0x87ce('0x14')][_0x87ce('0x15')]);return _0x1c3bcc(_0x413dcf[_0x87ce('0x14')][_0x87ce('0x15')]);}logger[_0x87ce('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0xec04ca,_0x413dcf[_0x87ce('0x14')][_0x87ce('0x15')]);return _0x8d2868(_0x413dcf[_0x87ce('0x14')]['message']);}else{logger[_0x87ce('0xd')](_0x87ce('0xe'),_0xec04ca,_0x87ce('0x11'));_0x8d2868(_0x413dcf[_0x87ce('0x16')][_0x87ce('0x15')]);}})[_0x87ce('0x17')](function(_0x62803d){logger[_0x87ce('0x14')](_0x87ce('0xe'),_0xec04ca,_0x62803d);_0x1c3bcc(_0x62803d);});});}exports[_0x87ce('0x18')]=function(_0x258d3f){var _0x59eec8=this;return new Promise(function(_0x20da25,_0x1e629f){return db[_0x87ce('0x19')]['findAll']({'raw':_0x258d3f[_0x87ce('0x1a')]?_0x258d3f[_0x87ce('0x1a')][_0x87ce('0x1b')]===undefined?!![]:![]:!![],'where':_0x258d3f[_0x87ce('0x1a')]?_0x258d3f['options'][_0x87ce('0x1c')]||null:null,'attributes':_0x258d3f[_0x87ce('0x1a')]?_0x258d3f[_0x87ce('0x1a')][_0x87ce('0x1d')]||null:null,'limit':_0x258d3f[_0x87ce('0x1a')]?_0x258d3f[_0x87ce('0x1a')][_0x87ce('0x1e')]||null:null,'include':_0x258d3f[_0x87ce('0x1a')]?_0x258d3f['options'][_0x87ce('0x1f')]?_[_0x87ce('0x20')](_0x258d3f[_0x87ce('0x1a')]['include'],function(_0x4f0b19){return{'model':db[_0x4f0b19[_0x87ce('0x21')]],'as':_0x4f0b19['as'],'attributes':_0x4f0b19['attributes'],'include':_0x4f0b19[_0x87ce('0x1f')]?_[_0x87ce('0x20')](_0x4f0b19['include'],function(_0x53fb18){return{'model':db[_0x53fb18[_0x87ce('0x21')]],'as':_0x53fb18['as'],'attributes':_0x53fb18[_0x87ce('0x1d')],'include':_0x53fb18[_0x87ce('0x1f')]?_[_0x87ce('0x20')](_0x53fb18[_0x87ce('0x1f')],function(_0x4297f6){return{'model':db[_0x4297f6[_0x87ce('0x21')]],'as':_0x4297f6['as'],'attributes':_0x4297f6[_0x87ce('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x87ce('0xc')](function(_0x4246aa){logger['info'](_0x87ce('0x18'),_0x258d3f);logger[_0x87ce('0xf')]('GetDynamics365Account',_0x258d3f,JSON[_0x87ce('0x12')](_0x4246aa));_0x20da25(_0x4246aa);})[_0x87ce('0x17')](function(_0x306316){logger[_0x87ce('0x14')]('GetDynamics365Account',_0x306316[_0x87ce('0x15')],_0x258d3f);_0x1e629f(_0x59eec8[_0x87ce('0x14')](0x1f4,_0x306316[_0x87ce('0x15')]));});});};exports[_0x87ce('0x22')]=function(_0x16fcca){var _0x554e30=this;return new Promise(function(_0x55bcce,_0xa30625){return db[_0x87ce('0x19')]['find']({'raw':_0x16fcca[_0x87ce('0x1a')]?_0x16fcca[_0x87ce('0x1a')][_0x87ce('0x1b')]===undefined?!![]:![]:!![],'where':_0x16fcca['options']?_0x16fcca[_0x87ce('0x1a')][_0x87ce('0x1c')]||null:null,'attributes':_0x16fcca[_0x87ce('0x1a')]?_0x16fcca[_0x87ce('0x1a')][_0x87ce('0x1d')]||null:null,'include':_0x16fcca[_0x87ce('0x1a')]?_0x16fcca[_0x87ce('0x1a')][_0x87ce('0x1f')]?_['map'](_0x16fcca[_0x87ce('0x1a')][_0x87ce('0x1f')],function(_0x450f82){return{'model':db[_0x450f82['model']],'as':_0x450f82['as'],'attributes':_0x450f82['attributes'],'include':_0x450f82[_0x87ce('0x1f')]?_[_0x87ce('0x20')](_0x450f82[_0x87ce('0x1f')],function(_0x234050){return{'model':db[_0x234050[_0x87ce('0x21')]],'as':_0x234050['as'],'attributes':_0x234050[_0x87ce('0x1d')],'include':_0x234050[_0x87ce('0x1f')]?_['map'](_0x234050['include'],function(_0x5239b4){return{'model':db[_0x5239b4[_0x87ce('0x21')]],'as':_0x5239b4['as'],'attributes':_0x5239b4[_0x87ce('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b88af){logger[_0x87ce('0xd')]('ShowDynamics365Account',_0x16fcca);logger[_0x87ce('0xf')]('ShowDynamics365Account',_0x16fcca,JSON['stringify'](_0x5b88af));_0x55bcce(_0x5b88af);})['catch'](function(_0x366b9f){logger[_0x87ce('0x14')](_0x87ce('0x22'),_0x366b9f[_0x87ce('0x15')],_0x16fcca);_0xa30625(_0x554e30['error'](0x1f4,_0x366b9f[_0x87ce('0x15')]));});});}; \ No newline at end of file +var _0x1a8b=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','include','map','model','then','ShowDynamics365Account','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3dca97,_0x486174){var _0x3cdd9a=function(_0x5f29c5){while(--_0x5f29c5){_0x3dca97['push'](_0x3dca97['shift']());}};_0x3cdd9a(++_0x486174);}(_0x1a8b,0x10a));var _0xb1a8=function(_0x59e40f,_0xd1588b){_0x59e40f=_0x59e40f-0x0;var _0x1532bd=_0x1a8b[_0x59e40f];return _0x1532bd;};'use strict';var _=require(_0xb1a8('0x0'));var util=require(_0xb1a8('0x1'));var moment=require(_0xb1a8('0x2'));var BPromise=require(_0xb1a8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb1a8('0x4'));var db=require(_0xb1a8('0x5'))['db'];var utils=require(_0xb1a8('0x6'));var logger=require(_0xb1a8('0x7'))(_0xb1a8('0x8'));var config=require('../../config/environment');var jayson=require(_0xb1a8('0x9'));var client=jayson['client'][_0xb1a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1befb0,_0xcc083,_0x21360d){return new BPromise(function(_0x3362e1,_0x564c08){return client[_0xb1a8('0xb')](_0x1befb0,_0x21360d)['then'](function(_0x2053ca){logger[_0xb1a8('0xc')](_0xb1a8('0xd'),_0xcc083,_0xb1a8('0xe'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xcc083,'request\x20sent',JSON[_0xb1a8('0xf')](_0x2053ca));if(_0x2053ca[_0xb1a8('0x10')]){if(_0x2053ca[_0xb1a8('0x10')][_0xb1a8('0x11')]===0x1f4){logger['error'](_0xb1a8('0xd'),_0xcc083,_0x2053ca[_0xb1a8('0x10')][_0xb1a8('0x12')]);return _0x564c08(_0x2053ca[_0xb1a8('0x10')][_0xb1a8('0x12')]);}logger[_0xb1a8('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0xcc083,_0x2053ca[_0xb1a8('0x10')][_0xb1a8('0x12')]);return _0x3362e1(_0x2053ca[_0xb1a8('0x10')]['message']);}else{logger[_0xb1a8('0xc')](_0xb1a8('0xd'),_0xcc083,_0xb1a8('0xe'));_0x3362e1(_0x2053ca[_0xb1a8('0x13')]['message']);}})[_0xb1a8('0x14')](function(_0x204fe9){logger[_0xb1a8('0x10')](_0xb1a8('0xd'),_0xcc083,_0x204fe9);_0x564c08(_0x204fe9);});});}exports[_0xb1a8('0x15')]=function(_0xccad2d){var _0x2e550c=this;return new Promise(function(_0x4cf595,_0x56b598){return db[_0xb1a8('0x16')]['findAll']({'raw':_0xccad2d['options']?_0xccad2d[_0xb1a8('0x17')][_0xb1a8('0x18')]===undefined?!![]:![]:!![],'where':_0xccad2d[_0xb1a8('0x17')]?_0xccad2d['options'][_0xb1a8('0x19')]||null:null,'attributes':_0xccad2d[_0xb1a8('0x17')]?_0xccad2d[_0xb1a8('0x17')][_0xb1a8('0x1a')]||null:null,'limit':_0xccad2d[_0xb1a8('0x17')]?_0xccad2d['options'][_0xb1a8('0x1b')]||null:null,'include':_0xccad2d[_0xb1a8('0x17')]?_0xccad2d['options'][_0xb1a8('0x1c')]?_[_0xb1a8('0x1d')](_0xccad2d[_0xb1a8('0x17')][_0xb1a8('0x1c')],function(_0x42ed0f){return{'model':db[_0x42ed0f[_0xb1a8('0x1e')]],'as':_0x42ed0f['as'],'attributes':_0x42ed0f['attributes'],'include':_0x42ed0f['include']?_['map'](_0x42ed0f['include'],function(_0x842c8c){return{'model':db[_0x842c8c['model']],'as':_0x842c8c['as'],'attributes':_0x842c8c[_0xb1a8('0x1a')],'include':_0x842c8c[_0xb1a8('0x1c')]?_[_0xb1a8('0x1d')](_0x842c8c[_0xb1a8('0x1c')],function(_0x4a9da5){return{'model':db[_0x4a9da5[_0xb1a8('0x1e')]],'as':_0x4a9da5['as'],'attributes':_0x4a9da5['attributes']};}):[]};}):[]};}):[]:[]})[_0xb1a8('0x1f')](function(_0x31370c){logger[_0xb1a8('0xc')]('GetDynamics365Account',_0xccad2d);logger['debug'](_0xb1a8('0x15'),_0xccad2d,JSON[_0xb1a8('0xf')](_0x31370c));_0x4cf595(_0x31370c);})[_0xb1a8('0x14')](function(_0x9e3c36){logger[_0xb1a8('0x10')]('GetDynamics365Account',_0x9e3c36['message'],_0xccad2d);_0x56b598(_0x2e550c[_0xb1a8('0x10')](0x1f4,_0x9e3c36[_0xb1a8('0x12')]));});});};exports[_0xb1a8('0x20')]=function(_0x2fa87b){var _0x338842=this;return new Promise(function(_0x2019b9,_0xbf29dd){return db[_0xb1a8('0x16')]['find']({'raw':_0x2fa87b[_0xb1a8('0x17')]?_0x2fa87b[_0xb1a8('0x17')][_0xb1a8('0x18')]===undefined?!![]:![]:!![],'where':_0x2fa87b[_0xb1a8('0x17')]?_0x2fa87b[_0xb1a8('0x17')]['where']||null:null,'attributes':_0x2fa87b['options']?_0x2fa87b[_0xb1a8('0x17')][_0xb1a8('0x1a')]||null:null,'include':_0x2fa87b[_0xb1a8('0x17')]?_0x2fa87b[_0xb1a8('0x17')][_0xb1a8('0x1c')]?_['map'](_0x2fa87b[_0xb1a8('0x17')][_0xb1a8('0x1c')],function(_0x317624){return{'model':db[_0x317624[_0xb1a8('0x1e')]],'as':_0x317624['as'],'attributes':_0x317624[_0xb1a8('0x1a')],'include':_0x317624[_0xb1a8('0x1c')]?_[_0xb1a8('0x1d')](_0x317624['include'],function(_0x4cefc8){return{'model':db[_0x4cefc8['model']],'as':_0x4cefc8['as'],'attributes':_0x4cefc8[_0xb1a8('0x1a')],'include':_0x4cefc8[_0xb1a8('0x1c')]?_[_0xb1a8('0x1d')](_0x4cefc8['include'],function(_0x217acb){return{'model':db[_0x217acb[_0xb1a8('0x1e')]],'as':_0x217acb['as'],'attributes':_0x217acb[_0xb1a8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb1a8('0x1f')](function(_0x25644d){logger[_0xb1a8('0xc')](_0xb1a8('0x20'),_0x2fa87b);logger[_0xb1a8('0x21')]('ShowDynamics365Account',_0x2fa87b,JSON[_0xb1a8('0xf')](_0x25644d));_0x2019b9(_0x25644d);})[_0xb1a8('0x14')](function(_0x325356){logger['error'](_0xb1a8('0x20'),_0x325356[_0xb1a8('0x12')],_0x2fa87b);_0xbf29dd(_0x338842[_0xb1a8('0x10')](0x1f4,_0x325356[_0xb1a8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index ef2cf6d..cb53edc 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 _0x3cd7=['./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','destroy','exports','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x19e471,_0x552c04){var _0x1fb25d=function(_0x283a86){while(--_0x283a86){_0x19e471['push'](_0x19e471['shift']());}};_0x1fb25d(++_0x552c04);}(_0x3cd7,0x69));var _0x73cd=function(_0x1ac1b6,_0x2c5226){_0x1ac1b6=_0x1ac1b6-0x0;var _0x53620b=_0x3cd7[_0x1ac1b6];return _0x53620b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x73cd('0x0'));var timeout=require('connect-timeout');var express=require(_0x73cd('0x1'));var router=express[_0x73cd('0x2')]();var fs_extra=require(_0x73cd('0x3'));var auth=require(_0x73cd('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x73cd('0x5'));router[_0x73cd('0x6')]('/',auth[_0x73cd('0x7')](),controller[_0x73cd('0x8')]);router[_0x73cd('0x6')](_0x73cd('0x9'),auth[_0x73cd('0x7')](),controller[_0x73cd('0xa')]);router[_0x73cd('0x6')](_0x73cd('0xb'),auth[_0x73cd('0x7')](),controller[_0x73cd('0xc')]);router[_0x73cd('0x6')](_0x73cd('0xd'),auth['isAuthenticated'](),controller[_0x73cd('0xe')]);router[_0x73cd('0x6')](_0x73cd('0xf'),auth[_0x73cd('0x7')](),controller['getDescriptions']);router[_0x73cd('0x10')]('/',auth[_0x73cd('0x7')](),controller[_0x73cd('0x11')]);router[_0x73cd('0x12')](_0x73cd('0x9'),auth[_0x73cd('0x7')](),controller[_0x73cd('0x13')]);router['delete']('/:id',auth[_0x73cd('0x7')](),controller[_0x73cd('0x14')]);module[_0x73cd('0x15')]=router; \ No newline at end of file +var _0x6df4=['/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','exports','multer','path','connect-timeout','../../components/auth/service','get','index','isAuthenticated','show'];(function(_0x1fe581,_0x505b64){var _0x393f2d=function(_0x1a8671){while(--_0x1a8671){_0x1fe581['push'](_0x1fe581['shift']());}};_0x393f2d(++_0x505b64);}(_0x6df4,0x78));var _0x46df=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x6df4[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require(_0x46df('0x0'));var util=require('util');var path=require(_0x46df('0x1'));var timeout=require(_0x46df('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x46df('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x46df('0x4')]('/',auth['isAuthenticated'](),controller[_0x46df('0x5')]);router[_0x46df('0x4')]('/:id',auth[_0x46df('0x6')](),controller[_0x46df('0x7')]);router[_0x46df('0x4')](_0x46df('0x8'),auth[_0x46df('0x6')](),controller['getFields']);router[_0x46df('0x4')]('/:id/subjects',auth[_0x46df('0x6')](),controller[_0x46df('0x9')]);router[_0x46df('0x4')](_0x46df('0xa'),auth['isAuthenticated'](),controller[_0x46df('0xb')]);router[_0x46df('0xc')]('/',auth[_0x46df('0x6')](),controller[_0x46df('0xd')]);router['put']('/:id',auth[_0x46df('0x6')](),controller[_0x46df('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x46df('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index a1e0427..51c6c56 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 _0x1c8a=['ENUM','contact','nothing','STRING','BOOLEAN','sequelize','incident','phonecall'];(function(_0xa4928c,_0x16b89c){var _0x27cc29=function(_0x14b819){while(--_0x14b819){_0xa4928c['push'](_0xa4928c['shift']());}};_0x27cc29(++_0x16b89c);}(_0x1c8a,0x105));var _0xa1c8=function(_0x1a40fc,_0x59340b){_0x1a40fc=_0x1a40fc-0x0;var _0xb0cab5=_0x1c8a[_0x1a40fc];return _0xb0cab5;};'use strict';var Sequelize=require(_0xa1c8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xa1c8('0x1'),_0xa1c8('0x2')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xa1c8('0x3')](_0xa1c8('0x4'),_0xa1c8('0x5')),'defaultValue':_0xa1c8('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xa1c8('0x6')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xa1c8('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdc00=['STRING','ENUM','incident','contact','BOOLEAN','sequelize'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xdc00,0x1c1));var _0x0dc0=function(_0x1527e0,_0x43ca55){_0x1527e0=_0x1527e0-0x0;var _0xf8187c=_0xdc00[_0x1527e0];return _0xf8187c;};'use strict';var Sequelize=require(_0x0dc0('0x0'));module['exports']={'name':{'type':Sequelize[_0x0dc0('0x1')]},'description':{'type':Sequelize[_0x0dc0('0x1')]},'ticketType':{'type':Sequelize[_0x0dc0('0x2')](_0x0dc0('0x3'),'phonecall'),'defaultValue':_0x0dc0('0x3')},'moduleCreate':{'type':Sequelize[_0x0dc0('0x2')](_0x0dc0('0x4'),'nothing'),'defaultValue':_0x0dc0('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x0dc0('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x0dc0('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 25ff1cc..bede197 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 _0x908c=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','map','Dynamics365Configuration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','catch','create','body','destroy','findOne','Dynamics365Field','order','getFields','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1d548a,_0x2107eb){var _0x1f4c7a=function(_0xc641fe){while(--_0xc641fe){_0x1d548a['push'](_0x1d548a['shift']());}};_0x1f4c7a(++_0x2107eb);}(_0x908c,0x174));var _0xc908=function(_0x36d2d7,_0x151a55){_0x36d2d7=_0x36d2d7-0x0;var _0x3b3bf9=_0x908c[_0x36d2d7];return _0x3b3bf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc908('0x0'));var zipdir=require(_0xc908('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc908('0x2'));var moment=require(_0xc908('0x3'));var BPromise=require(_0xc908('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc908('0x5'));var sox=require(_0xc908('0x6'));var csv=require(_0xc908('0x7'));var ejs=require(_0xc908('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc908('0x9'));var squel=require(_0xc908('0xa'));var crypto=require('crypto');var jsforce=require(_0xc908('0xb'));var deskjs=require(_0xc908('0xc'));var toCsv=require(_0xc908('0x7'));var querystring=require(_0xc908('0xd'));var Papa=require('papaparse');var Redis=require(_0xc908('0xe'));var authService=require(_0xc908('0xf'));var qs=require(_0xc908('0x10'));var as=require(_0xc908('0x11'));var hardwareService=require(_0xc908('0x12'));var logger=require(_0xc908('0x13'))('api');var utils=require(_0xc908('0x14'));var config=require(_0xc908('0x15'));var licenseUtil=require(_0xc908('0x16'));var db=require(_0xc908('0x17'))['db'];function respondWithStatusCode(_0x56c2ba,_0x4185e9){_0x4185e9=_0x4185e9||0xcc;return function(_0x3349e0){if(_0x3349e0){return _0x56c2ba[_0xc908('0x18')](_0x4185e9);}return _0x56c2ba[_0xc908('0x19')](_0x4185e9)[_0xc908('0x1a')]();};}function respondWithResult(_0x35d62b,_0x1b63ee){_0x1b63ee=_0x1b63ee||0xc8;return function(_0x65ec0c){if(_0x65ec0c){return _0x35d62b[_0xc908('0x19')](_0x1b63ee)[_0xc908('0x1b')](_0x65ec0c);}};}function respondWithFilteredResult(_0x513ac5,_0x180669){return function(_0x48e76b){if(_0x48e76b){var _0x4efe2a=typeof _0x180669['offset']===_0xc908('0x1c')&&typeof _0x180669[_0xc908('0x1d')]===_0xc908('0x1c');var _0x4dcea0=_0x48e76b[_0xc908('0x1e')];var _0x4bc7bd=_0x4efe2a?0x0:_0x180669['offset'];var _0x4d2ef3=_0x4efe2a?_0x48e76b[_0xc908('0x1e')]:_0x180669['offset']+_0x180669['limit'];var _0xa0feed;if(_0x4d2ef3>=_0x4dcea0){_0x4d2ef3=_0x4dcea0;_0xa0feed=0xc8;}else{_0xa0feed=0xce;}_0x513ac5[_0xc908('0x19')](_0xa0feed);return _0x513ac5[_0xc908('0x1f')](_0xc908('0x20'),_0x4bc7bd+'-'+_0x4d2ef3+'/'+_0x4dcea0)[_0xc908('0x1b')](_0x48e76b);}return null;};}function patchUpdates(_0x4e7279){return function(_0x577af7){try{jsonpatch[_0xc908('0x21')](_0x577af7,_0x4e7279,!![]);}catch(_0x51d3fe){return BPromise[_0xc908('0x22')](_0x51d3fe);}return _0x577af7[_0xc908('0x23')]();};}function saveUpdates(_0x41be01,_0x5362ed){return function(_0x292601){if(_0x292601){return _0x292601[_0xc908('0x24')](_0x41be01)[_0xc908('0x25')](function(_0x25ff82){return _0x25ff82;});}return null;};}function removeEntity(_0x272fea,_0x1299f6){return function(_0x9d9d58){if(_0x9d9d58){return _0x9d9d58['destroy']()[_0xc908('0x25')](function(){_0x272fea[_0xc908('0x19')](0xcc)[_0xc908('0x1a')]();});}};}function handleEntityNotFound(_0x5b8365,_0x58414b){return function(_0x45c981){if(!_0x45c981){_0x5b8365[_0xc908('0x18')](0x194);}return _0x45c981;};}function handleError(_0x5cd8c5,_0xba8ee4){_0xba8ee4=_0xba8ee4||0x1f4;return function(_0x1f0b4d){logger[_0xc908('0x26')](_0x1f0b4d['stack']);if(_0x1f0b4d['name']){delete _0x1f0b4d[_0xc908('0x27')];}_0x5cd8c5[_0xc908('0x19')](_0xba8ee4)[_0xc908('0x28')](_0x1f0b4d);};}exports['index']=function(_0x95d8a7,_0x34514a){var _0x21c22d={},_0x4dd077={},_0x34acba={'count':0x0,'rows':[]};var _0xf46e48=_[_0xc908('0x29')](db[_0xc908('0x2a')][_0xc908('0x2b')],function(_0x2f8056){return{'name':_0x2f8056['fieldName'],'type':_0x2f8056['type'][_0xc908('0x2c')]};});_0x4dd077[_0xc908('0x2d')]=_[_0xc908('0x29')](_0xf46e48,_0xc908('0x27'));_0x4dd077[_0xc908('0x2e')]=_[_0xc908('0x2f')](_0x95d8a7[_0xc908('0x2e')]);_0x4dd077[_0xc908('0x30')]=_[_0xc908('0x31')](_0x4dd077[_0xc908('0x2d')],_0x4dd077[_0xc908('0x2e')]);_0x21c22d[_0xc908('0x32')]=_[_0xc908('0x31')](_0x4dd077[_0xc908('0x2d')],qs[_0xc908('0x33')](_0x95d8a7['query'][_0xc908('0x33')]));_0x21c22d[_0xc908('0x32')]=_0x21c22d[_0xc908('0x32')][_0xc908('0x34')]?_0x21c22d[_0xc908('0x32')]:_0x4dd077[_0xc908('0x2d')];if(!_0x95d8a7[_0xc908('0x2e')][_0xc908('0x35')](_0xc908('0x36'))){_0x21c22d['limit']=qs['limit'](_0x95d8a7['query'][_0xc908('0x1d')]);_0x21c22d[_0xc908('0x37')]=qs['offset'](_0x95d8a7[_0xc908('0x2e')][_0xc908('0x37')]);}_0x21c22d['order']=qs[_0xc908('0x38')](_0x95d8a7['query'][_0xc908('0x38')]);_0x21c22d['where']=qs[_0xc908('0x30')](_[_0xc908('0x39')](_0x95d8a7[_0xc908('0x2e')],_0x4dd077['filters']),_0xf46e48);if(_0x95d8a7[_0xc908('0x2e')][_0xc908('0x3a')]){_0x21c22d[_0xc908('0x3b')]=_[_0xc908('0x3c')](_0x21c22d[_0xc908('0x3b')],{'$or':_[_0xc908('0x29')](_0xf46e48,function(_0x5af2d9){if(_0x5af2d9[_0xc908('0x3d')]!==_0xc908('0x3e')){var _0x16b330={};_0x16b330[_0x5af2d9[_0xc908('0x27')]]={'$like':'%'+_0x95d8a7[_0xc908('0x2e')][_0xc908('0x3a')]+'%'};return _0x16b330;}})});}_0x21c22d=_['merge']({},_0x21c22d,_0x95d8a7[_0xc908('0x3f')]);var _0x13c8ee={'where':_0x21c22d[_0xc908('0x3b')]};return db['Dynamics365Configuration'][_0xc908('0x1e')](_0x13c8ee)[_0xc908('0x25')](function(_0x4b25e4){_0x34acba[_0xc908('0x1e')]=_0x4b25e4;if(_0x95d8a7[_0xc908('0x2e')][_0xc908('0x40')]){_0x21c22d['include']=[{'all':!![]}];}return db[_0xc908('0x2a')][_0xc908('0x41')](_0x21c22d);})['then'](function(_0x4b66df){_0x34acba[_0xc908('0x42')]=_0x4b66df;return _0x34acba;})[_0xc908('0x25')](respondWithFilteredResult(_0x34514a,_0x21c22d))['catch'](handleError(_0x34514a,null));};exports[_0xc908('0x43')]=function(_0x34e330,_0x448107){var _0x183d05={'raw':![],'where':{'id':_0x34e330[_0xc908('0x44')]['id']}},_0xbb5ebe={};_0xbb5ebe[_0xc908('0x2d')]=_[_0xc908('0x2f')](db[_0xc908('0x2a')][_0xc908('0x2b')]);_0xbb5ebe[_0xc908('0x2e')]=_[_0xc908('0x2f')](_0x34e330[_0xc908('0x2e')]);_0xbb5ebe[_0xc908('0x30')]=_[_0xc908('0x31')](_0xbb5ebe[_0xc908('0x2d')],_0xbb5ebe['query']);_0x183d05['attributes']=_[_0xc908('0x31')](_0xbb5ebe['model'],qs[_0xc908('0x33')](_0x34e330[_0xc908('0x2e')][_0xc908('0x33')]));_0x183d05[_0xc908('0x32')]=_0x183d05[_0xc908('0x32')][_0xc908('0x34')]?_0x183d05[_0xc908('0x32')]:_0xbb5ebe[_0xc908('0x2d')];if(_0x34e330[_0xc908('0x2e')][_0xc908('0x40')]){_0x183d05['include']=[{'all':!![]}];}_0x183d05=_[_0xc908('0x3c')]({},_0x183d05,_0x34e330[_0xc908('0x3f')]);return db['Dynamics365Configuration']['find'](_0x183d05)[_0xc908('0x25')](handleEntityNotFound(_0x448107,null))[_0xc908('0x25')](respondWithResult(_0x448107,null))[_0xc908('0x45')](handleError(_0x448107,null));};exports[_0xc908('0x46')]=function(_0x2f0751,_0x9d88b){return db[_0xc908('0x2a')][_0xc908('0x46')](_0x2f0751[_0xc908('0x47')],{})[_0xc908('0x25')](respondWithResult(_0x9d88b,0xc9))['catch'](handleError(_0x9d88b,null));};exports[_0xc908('0x24')]=function(_0x177598,_0x270484){if(_0x177598[_0xc908('0x47')]['id']){delete _0x177598[_0xc908('0x47')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x177598[_0xc908('0x44')]['id']}})['then'](handleEntityNotFound(_0x270484,null))['then'](saveUpdates(_0x177598[_0xc908('0x47')],null))[_0xc908('0x25')](respondWithResult(_0x270484,null))[_0xc908('0x45')](handleError(_0x270484,null));};exports[_0xc908('0x48')]=function(_0x37ce85,_0x19f9af){return db[_0xc908('0x2a')]['find']({'where':{'id':_0x37ce85[_0xc908('0x44')]['id']}})[_0xc908('0x25')](handleEntityNotFound(_0x19f9af,null))[_0xc908('0x25')](removeEntity(_0x19f9af,null))[_0xc908('0x45')](handleError(_0x19f9af,null));};exports['getFields']=function(_0x1eb510,_0x50dc68,_0x5969a1){var _0x5aeb23={};var _0x15ef1d={};var _0x4623aa;var _0x27fe37;return db[_0xc908('0x2a')][_0xc908('0x49')]({'where':{'id':_0x1eb510['params']['id']}})[_0xc908('0x25')](handleEntityNotFound(_0x50dc68,null))['then'](function(_0xb0623f){if(_0xb0623f){_0x4623aa=_0xb0623f;_0x15ef1d[_0xc908('0x2d')]=_[_0xc908('0x2f')](db[_0xc908('0x4a')][_0xc908('0x2b')]);_0x15ef1d['query']=_[_0xc908('0x2f')](_0x1eb510[_0xc908('0x2e')]);_0x15ef1d['filters']=_['intersection'](_0x15ef1d[_0xc908('0x2d')],_0x15ef1d[_0xc908('0x2e')]);_0x5aeb23[_0xc908('0x32')]=_[_0xc908('0x31')](_0x15ef1d[_0xc908('0x2d')],qs[_0xc908('0x33')](_0x1eb510['query']['fields']));_0x5aeb23[_0xc908('0x32')]=_0x5aeb23[_0xc908('0x32')]['length']?_0x5aeb23['attributes']:_0x15ef1d[_0xc908('0x2d')];_0x5aeb23[_0xc908('0x4b')]=qs[_0xc908('0x38')](_0x1eb510[_0xc908('0x2e')][_0xc908('0x38')]);_0x5aeb23['where']=qs['filters'](_['pick'](_0x1eb510[_0xc908('0x2e')],_0x15ef1d[_0xc908('0x30')]));if(_0x1eb510[_0xc908('0x2e')][_0xc908('0x3a')]){_0x5aeb23[_0xc908('0x3b')]=_[_0xc908('0x3c')](_0x5aeb23[_0xc908('0x3b')],{'$or':_[_0xc908('0x29')](_0x5aeb23['attributes'],function(_0x39817a){var _0x5c816a={};_0x5c816a[_0x39817a]={'$like':'%'+_0x1eb510['query']['filter']+'%'};return _0x5c816a;})});}_0x5aeb23=_[_0xc908('0x3c')]({},_0x5aeb23,_0x1eb510['options']);return _0x4623aa[_0xc908('0x4c')](_0x5aeb23);}})[_0xc908('0x25')](function(_0x45a84a){if(_0x45a84a){_0x27fe37=_0x45a84a[_0xc908('0x34')];if(!_0x1eb510[_0xc908('0x2e')]['hasOwnProperty']('nolimit')){_0x5aeb23[_0xc908('0x1d')]=qs[_0xc908('0x1d')](_0x1eb510[_0xc908('0x2e')]['limit']);_0x5aeb23[_0xc908('0x37')]=qs[_0xc908('0x37')](_0x1eb510[_0xc908('0x2e')][_0xc908('0x37')]);}return _0x4623aa[_0xc908('0x4c')](_0x5aeb23);}})['then'](function(_0x5223b1){if(_0x5223b1){return _0x5223b1?{'count':_0x27fe37,'rows':_0x5223b1}:null;}})[_0xc908('0x25')](respondWithResult(_0x50dc68,null))[_0xc908('0x45')](handleError(_0x50dc68,null));};exports['getSubjects']=function(_0x1777b1,_0x28b532,_0x2af73e){var _0x52f677={};var _0x2009ed={};var _0x2a0286;var _0x517b28;return db[_0xc908('0x2a')][_0xc908('0x49')]({'where':{'id':_0x1777b1[_0xc908('0x44')]['id']}})['then'](handleEntityNotFound(_0x28b532,null))['then'](function(_0x43dfe6){if(_0x43dfe6){_0x2a0286=_0x43dfe6;_0x2009ed[_0xc908('0x2d')]=_[_0xc908('0x2f')](db[_0xc908('0x4a')][_0xc908('0x2b')]);_0x2009ed[_0xc908('0x2e')]=_[_0xc908('0x2f')](_0x1777b1[_0xc908('0x2e')]);_0x2009ed[_0xc908('0x30')]=_[_0xc908('0x31')](_0x2009ed[_0xc908('0x2d')],_0x2009ed['query']);_0x52f677[_0xc908('0x32')]=_[_0xc908('0x31')](_0x2009ed[_0xc908('0x2d')],qs[_0xc908('0x33')](_0x1777b1[_0xc908('0x2e')][_0xc908('0x33')]));_0x52f677[_0xc908('0x32')]=_0x52f677[_0xc908('0x32')][_0xc908('0x34')]?_0x52f677[_0xc908('0x32')]:_0x2009ed[_0xc908('0x2d')];_0x52f677['order']=qs[_0xc908('0x38')](_0x1777b1[_0xc908('0x2e')][_0xc908('0x38')]);_0x52f677[_0xc908('0x3b')]=qs[_0xc908('0x30')](_[_0xc908('0x39')](_0x1777b1['query'],_0x2009ed[_0xc908('0x30')]));if(_0x1777b1[_0xc908('0x2e')]['filter']){_0x52f677[_0xc908('0x3b')]=_['merge'](_0x52f677[_0xc908('0x3b')],{'$or':_['map'](_0x52f677['attributes'],function(_0x3018b2){var _0x101cdd={};_0x101cdd[_0x3018b2]={'$like':'%'+_0x1777b1[_0xc908('0x2e')][_0xc908('0x3a')]+'%'};return _0x101cdd;})});}_0x52f677=_[_0xc908('0x3c')]({},_0x52f677,_0x1777b1['options']);return _0x2a0286['getSubjects'](_0x52f677);}})[_0xc908('0x25')](function(_0x233b74){if(_0x233b74){_0x517b28=_0x233b74[_0xc908('0x34')];if(!_0x1777b1[_0xc908('0x2e')][_0xc908('0x35')](_0xc908('0x36'))){_0x52f677[_0xc908('0x1d')]=qs[_0xc908('0x1d')](_0x1777b1[_0xc908('0x2e')]['limit']);_0x52f677[_0xc908('0x37')]=qs[_0xc908('0x37')](_0x1777b1[_0xc908('0x2e')][_0xc908('0x37')]);}return _0x2a0286['getSubjects'](_0x52f677);}})['then'](function(_0x5d738d){if(_0x5d738d){return _0x5d738d?{'count':_0x517b28,'rows':_0x5d738d}:null;}})[_0xc908('0x25')](respondWithResult(_0x28b532,null))['catch'](handleError(_0x28b532,null));};exports[_0xc908('0x4d')]=function(_0x5b8471,_0x6851cc,_0x2e08b4){var _0x508712={};var _0x534de3={};var _0x20efb9;var _0xe55f48;return db[_0xc908('0x2a')]['findOne']({'where':{'id':_0x5b8471[_0xc908('0x44')]['id']}})[_0xc908('0x25')](handleEntityNotFound(_0x6851cc,null))[_0xc908('0x25')](function(_0x17dcc7){if(_0x17dcc7){_0x20efb9=_0x17dcc7;_0x534de3[_0xc908('0x2d')]=_[_0xc908('0x2f')](db[_0xc908('0x4a')][_0xc908('0x2b')]);_0x534de3[_0xc908('0x2e')]=_[_0xc908('0x2f')](_0x5b8471['query']);_0x534de3['filters']=_[_0xc908('0x31')](_0x534de3[_0xc908('0x2d')],_0x534de3[_0xc908('0x2e')]);_0x508712[_0xc908('0x32')]=_[_0xc908('0x31')](_0x534de3[_0xc908('0x2d')],qs[_0xc908('0x33')](_0x5b8471['query'][_0xc908('0x33')]));_0x508712[_0xc908('0x32')]=_0x508712['attributes'][_0xc908('0x34')]?_0x508712[_0xc908('0x32')]:_0x534de3['model'];_0x508712[_0xc908('0x4b')]=qs[_0xc908('0x38')](_0x5b8471['query'][_0xc908('0x38')]);_0x508712[_0xc908('0x3b')]=qs[_0xc908('0x30')](_['pick'](_0x5b8471['query'],_0x534de3[_0xc908('0x30')]));if(_0x5b8471['query'][_0xc908('0x3a')]){_0x508712[_0xc908('0x3b')]=_[_0xc908('0x3c')](_0x508712[_0xc908('0x3b')],{'$or':_[_0xc908('0x29')](_0x508712['attributes'],function(_0x9bfe7d){var _0x2b0b7d={};_0x2b0b7d[_0x9bfe7d]={'$like':'%'+_0x5b8471['query'][_0xc908('0x3a')]+'%'};return _0x2b0b7d;})});}_0x508712=_['merge']({},_0x508712,_0x5b8471[_0xc908('0x3f')]);return _0x20efb9[_0xc908('0x4d')](_0x508712);}})[_0xc908('0x25')](function(_0x17747f){if(_0x17747f){_0xe55f48=_0x17747f[_0xc908('0x34')];if(!_0x5b8471['query'][_0xc908('0x35')](_0xc908('0x36'))){_0x508712[_0xc908('0x1d')]=qs[_0xc908('0x1d')](_0x5b8471[_0xc908('0x2e')][_0xc908('0x1d')]);_0x508712[_0xc908('0x37')]=qs[_0xc908('0x37')](_0x5b8471['query'][_0xc908('0x37')]);}return _0x20efb9[_0xc908('0x4d')](_0x508712);}})['then'](function(_0x260255){if(_0x260255){return _0x260255?{'count':_0xe55f48,'rows':_0x260255}:null;}})[_0xc908('0x25')](respondWithResult(_0x6851cc,null))[_0xc908('0x45')](handleError(_0x6851cc,null));}; \ No newline at end of file +var _0x440c=['../../config/utils','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','end','sendStatus','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','body','destroy','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x307108,_0x424a69){var _0x46dbda=function(_0x5d1a2b){while(--_0x5d1a2b){_0x307108['push'](_0x307108['shift']());}};_0x46dbda(++_0x424a69);}(_0x440c,0xcd));var _0xc440=function(_0x525bed,_0x14e3f6){_0x525bed=_0x525bed-0x0;var _0x2fdd05=_0x440c[_0x525bed];return _0x2fdd05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc440('0x0'));var zipdir=require(_0xc440('0x1'));var jsonpatch=require(_0xc440('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc440('0x3'));var Mustache=require('mustache');var util=require(_0xc440('0x4'));var path=require(_0xc440('0x5'));var sox=require(_0xc440('0x6'));var csv=require(_0xc440('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc440('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc440('0x9'));var deskjs=require(_0xc440('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc440('0xb'));var Redis=require('ioredis');var authService=require(_0xc440('0xc'));var qs=require(_0xc440('0xd'));var as=require(_0xc440('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc440('0xf'))(_0xc440('0x10'));var utils=require(_0xc440('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xc440('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4447ae,_0x1795a1){_0x1795a1=_0x1795a1||0xcc;return function(_0x5e49b2){if(_0x5e49b2){return _0x4447ae['sendStatus'](_0x1795a1);}return _0x4447ae['status'](_0x1795a1)['end']();};}function respondWithResult(_0x279253,_0x2bcc92){_0x2bcc92=_0x2bcc92||0xc8;return function(_0xe7c19b){if(_0xe7c19b){return _0x279253[_0xc440('0x13')](_0x2bcc92)['json'](_0xe7c19b);}};}function respondWithFilteredResult(_0x383b3e,_0x4ca5a7){return function(_0x269fd1){if(_0x269fd1){var _0xfce0c8=typeof _0x4ca5a7[_0xc440('0x14')]===_0xc440('0x15')&&typeof _0x4ca5a7[_0xc440('0x16')]===_0xc440('0x15');var _0x3b0b2f=_0x269fd1[_0xc440('0x17')];var _0x2c302b=_0xfce0c8?0x0:_0x4ca5a7[_0xc440('0x14')];var _0x3c67ff=_0xfce0c8?_0x269fd1[_0xc440('0x17')]:_0x4ca5a7['offset']+_0x4ca5a7[_0xc440('0x16')];var _0x205bdb;if(_0x3c67ff>=_0x3b0b2f){_0x3c67ff=_0x3b0b2f;_0x205bdb=0xc8;}else{_0x205bdb=0xce;}_0x383b3e['status'](_0x205bdb);return _0x383b3e[_0xc440('0x18')](_0xc440('0x19'),_0x2c302b+'-'+_0x3c67ff+'/'+_0x3b0b2f)[_0xc440('0x1a')](_0x269fd1);}return null;};}function patchUpdates(_0x5cdcca){return function(_0x1790b1){try{jsonpatch['apply'](_0x1790b1,_0x5cdcca,!![]);}catch(_0x114a87){return BPromise[_0xc440('0x1b')](_0x114a87);}return _0x1790b1['save']();};}function saveUpdates(_0x444cef,_0x36ed55){return function(_0x152230){if(_0x152230){return _0x152230[_0xc440('0x1c')](_0x444cef)['then'](function(_0x2010f2){return _0x2010f2;});}return null;};}function removeEntity(_0x362ef6,_0x42fb69){return function(_0x8b690a){if(_0x8b690a){return _0x8b690a['destroy']()[_0xc440('0x1d')](function(){_0x362ef6[_0xc440('0x13')](0xcc)[_0xc440('0x1e')]();});}};}function handleEntityNotFound(_0x3440e9,_0x14242a){return function(_0x2bfd0f){if(!_0x2bfd0f){_0x3440e9[_0xc440('0x1f')](0x194);}return _0x2bfd0f;};}function handleError(_0x5ee8f3,_0x231dda){_0x231dda=_0x231dda||0x1f4;return function(_0x3bc685){logger['error'](_0x3bc685[_0xc440('0x20')]);if(_0x3bc685['name']){delete _0x3bc685[_0xc440('0x21')];}_0x5ee8f3[_0xc440('0x13')](_0x231dda)[_0xc440('0x22')](_0x3bc685);};}exports[_0xc440('0x23')]=function(_0x135eba,_0x43354c){var _0x51b426={},_0x8ffe44={},_0x1ebb19={'count':0x0,'rows':[]};var _0x169e2f=_['map'](db[_0xc440('0x24')][_0xc440('0x25')],function(_0x17c8dc){return{'name':_0x17c8dc[_0xc440('0x26')],'type':_0x17c8dc[_0xc440('0x27')]['key']};});_0x8ffe44[_0xc440('0x28')]=_[_0xc440('0x29')](_0x169e2f,_0xc440('0x21'));_0x8ffe44['query']=_['keys'](_0x135eba['query']);_0x8ffe44[_0xc440('0x2a')]=_[_0xc440('0x2b')](_0x8ffe44[_0xc440('0x28')],_0x8ffe44[_0xc440('0x2c')]);_0x51b426[_0xc440('0x2d')]=_['intersection'](_0x8ffe44[_0xc440('0x28')],qs[_0xc440('0x2e')](_0x135eba['query'][_0xc440('0x2e')]));_0x51b426[_0xc440('0x2d')]=_0x51b426['attributes']['length']?_0x51b426[_0xc440('0x2d')]:_0x8ffe44['model'];if(!_0x135eba[_0xc440('0x2c')][_0xc440('0x2f')](_0xc440('0x30'))){_0x51b426[_0xc440('0x16')]=qs[_0xc440('0x16')](_0x135eba[_0xc440('0x2c')]['limit']);_0x51b426[_0xc440('0x14')]=qs['offset'](_0x135eba['query'][_0xc440('0x14')]);}_0x51b426[_0xc440('0x31')]=qs[_0xc440('0x32')](_0x135eba[_0xc440('0x2c')][_0xc440('0x32')]);_0x51b426['where']=qs[_0xc440('0x2a')](_[_0xc440('0x33')](_0x135eba[_0xc440('0x2c')],_0x8ffe44['filters']),_0x169e2f);if(_0x135eba[_0xc440('0x2c')][_0xc440('0x34')]){_0x51b426[_0xc440('0x35')]=_['merge'](_0x51b426[_0xc440('0x35')],{'$or':_[_0xc440('0x29')](_0x169e2f,function(_0x16b346){if(_0x16b346['type']!=='VIRTUAL'){var _0xe76400={};_0xe76400[_0x16b346[_0xc440('0x21')]]={'$like':'%'+_0x135eba['query']['filter']+'%'};return _0xe76400;}})});}_0x51b426=_[_0xc440('0x36')]({},_0x51b426,_0x135eba[_0xc440('0x37')]);var _0x49e3f2={'where':_0x51b426['where']};return db[_0xc440('0x24')][_0xc440('0x17')](_0x49e3f2)[_0xc440('0x1d')](function(_0x32d0a7){_0x1ebb19[_0xc440('0x17')]=_0x32d0a7;if(_0x135eba[_0xc440('0x2c')][_0xc440('0x38')]){_0x51b426['include']=[{'all':!![]}];}return db[_0xc440('0x24')][_0xc440('0x39')](_0x51b426);})[_0xc440('0x1d')](function(_0xfc15ee){_0x1ebb19[_0xc440('0x3a')]=_0xfc15ee;return _0x1ebb19;})[_0xc440('0x1d')](respondWithFilteredResult(_0x43354c,_0x51b426))[_0xc440('0x3b')](handleError(_0x43354c,null));};exports[_0xc440('0x3c')]=function(_0x417809,_0x311f72){var _0x44eae0={'raw':![],'where':{'id':_0x417809[_0xc440('0x3d')]['id']}},_0x3e94b3={};_0x3e94b3['model']=_[_0xc440('0x3e')](db[_0xc440('0x24')][_0xc440('0x25')]);_0x3e94b3[_0xc440('0x2c')]=_[_0xc440('0x3e')](_0x417809[_0xc440('0x2c')]);_0x3e94b3[_0xc440('0x2a')]=_[_0xc440('0x2b')](_0x3e94b3[_0xc440('0x28')],_0x3e94b3[_0xc440('0x2c')]);_0x44eae0[_0xc440('0x2d')]=_[_0xc440('0x2b')](_0x3e94b3[_0xc440('0x28')],qs[_0xc440('0x2e')](_0x417809[_0xc440('0x2c')][_0xc440('0x2e')]));_0x44eae0['attributes']=_0x44eae0[_0xc440('0x2d')][_0xc440('0x3f')]?_0x44eae0[_0xc440('0x2d')]:_0x3e94b3['model'];if(_0x417809[_0xc440('0x2c')]['includeAll']){_0x44eae0[_0xc440('0x40')]=[{'all':!![]}];}_0x44eae0=_[_0xc440('0x36')]({},_0x44eae0,_0x417809[_0xc440('0x37')]);return db['Dynamics365Configuration'][_0xc440('0x41')](_0x44eae0)['then'](handleEntityNotFound(_0x311f72,null))[_0xc440('0x1d')](respondWithResult(_0x311f72,null))[_0xc440('0x3b')](handleError(_0x311f72,null));};exports[_0xc440('0x42')]=function(_0x4dd7e6,_0x1e4fd3){return db[_0xc440('0x24')][_0xc440('0x42')](_0x4dd7e6[_0xc440('0x43')],{})[_0xc440('0x1d')](respondWithResult(_0x1e4fd3,0xc9))[_0xc440('0x3b')](handleError(_0x1e4fd3,null));};exports[_0xc440('0x1c')]=function(_0x68b72e,_0x45f2e4){if(_0x68b72e[_0xc440('0x43')]['id']){delete _0x68b72e[_0xc440('0x43')]['id'];}return db[_0xc440('0x24')]['find']({'where':{'id':_0x68b72e['params']['id']}})[_0xc440('0x1d')](handleEntityNotFound(_0x45f2e4,null))[_0xc440('0x1d')](saveUpdates(_0x68b72e[_0xc440('0x43')],null))[_0xc440('0x1d')](respondWithResult(_0x45f2e4,null))['catch'](handleError(_0x45f2e4,null));};exports[_0xc440('0x44')]=function(_0x36cbdb,_0x9429a1){return db[_0xc440('0x24')][_0xc440('0x41')]({'where':{'id':_0x36cbdb['params']['id']}})[_0xc440('0x1d')](handleEntityNotFound(_0x9429a1,null))[_0xc440('0x1d')](removeEntity(_0x9429a1,null))[_0xc440('0x3b')](handleError(_0x9429a1,null));};exports[_0xc440('0x45')]=function(_0x336526,_0x1bf7aa,_0x439821){var _0x3b954e={};var _0x506cc2={};var _0x4883ad;var _0x481e6b;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x336526[_0xc440('0x3d')]['id']}})[_0xc440('0x1d')](handleEntityNotFound(_0x1bf7aa,null))[_0xc440('0x1d')](function(_0x1cd80f){if(_0x1cd80f){_0x4883ad=_0x1cd80f;_0x506cc2[_0xc440('0x28')]=_[_0xc440('0x3e')](db[_0xc440('0x46')]['rawAttributes']);_0x506cc2[_0xc440('0x2c')]=_[_0xc440('0x3e')](_0x336526[_0xc440('0x2c')]);_0x506cc2[_0xc440('0x2a')]=_[_0xc440('0x2b')](_0x506cc2[_0xc440('0x28')],_0x506cc2['query']);_0x3b954e['attributes']=_[_0xc440('0x2b')](_0x506cc2[_0xc440('0x28')],qs[_0xc440('0x2e')](_0x336526[_0xc440('0x2c')][_0xc440('0x2e')]));_0x3b954e[_0xc440('0x2d')]=_0x3b954e[_0xc440('0x2d')][_0xc440('0x3f')]?_0x3b954e[_0xc440('0x2d')]:_0x506cc2[_0xc440('0x28')];_0x3b954e['order']=qs[_0xc440('0x32')](_0x336526['query'][_0xc440('0x32')]);_0x3b954e[_0xc440('0x35')]=qs['filters'](_[_0xc440('0x33')](_0x336526[_0xc440('0x2c')],_0x506cc2[_0xc440('0x2a')]));if(_0x336526[_0xc440('0x2c')]['filter']){_0x3b954e[_0xc440('0x35')]=_[_0xc440('0x36')](_0x3b954e[_0xc440('0x35')],{'$or':_[_0xc440('0x29')](_0x3b954e[_0xc440('0x2d')],function(_0xdc7fc7){var _0x476e6a={};_0x476e6a[_0xdc7fc7]={'$like':'%'+_0x336526[_0xc440('0x2c')][_0xc440('0x34')]+'%'};return _0x476e6a;})});}_0x3b954e=_[_0xc440('0x36')]({},_0x3b954e,_0x336526[_0xc440('0x37')]);return _0x4883ad[_0xc440('0x45')](_0x3b954e);}})['then'](function(_0x578512){if(_0x578512){_0x481e6b=_0x578512[_0xc440('0x3f')];if(!_0x336526[_0xc440('0x2c')][_0xc440('0x2f')](_0xc440('0x30'))){_0x3b954e[_0xc440('0x16')]=qs[_0xc440('0x16')](_0x336526[_0xc440('0x2c')]['limit']);_0x3b954e[_0xc440('0x14')]=qs[_0xc440('0x14')](_0x336526[_0xc440('0x2c')]['offset']);}return _0x4883ad[_0xc440('0x45')](_0x3b954e);}})[_0xc440('0x1d')](function(_0x10d525){if(_0x10d525){return _0x10d525?{'count':_0x481e6b,'rows':_0x10d525}:null;}})[_0xc440('0x1d')](respondWithResult(_0x1bf7aa,null))[_0xc440('0x3b')](handleError(_0x1bf7aa,null));};exports[_0xc440('0x47')]=function(_0x7db8c0,_0xcaff54,_0x3c65c7){var _0x220dec={};var _0x4b1b5a={};var _0x33b414;var _0x23e9eb;return db[_0xc440('0x24')][_0xc440('0x48')]({'where':{'id':_0x7db8c0['params']['id']}})[_0xc440('0x1d')](handleEntityNotFound(_0xcaff54,null))[_0xc440('0x1d')](function(_0x4402d8){if(_0x4402d8){_0x33b414=_0x4402d8;_0x4b1b5a[_0xc440('0x28')]=_[_0xc440('0x3e')](db[_0xc440('0x46')]['rawAttributes']);_0x4b1b5a['query']=_[_0xc440('0x3e')](_0x7db8c0[_0xc440('0x2c')]);_0x4b1b5a[_0xc440('0x2a')]=_[_0xc440('0x2b')](_0x4b1b5a[_0xc440('0x28')],_0x4b1b5a[_0xc440('0x2c')]);_0x220dec[_0xc440('0x2d')]=_[_0xc440('0x2b')](_0x4b1b5a[_0xc440('0x28')],qs['fields'](_0x7db8c0['query'][_0xc440('0x2e')]));_0x220dec[_0xc440('0x2d')]=_0x220dec[_0xc440('0x2d')][_0xc440('0x3f')]?_0x220dec[_0xc440('0x2d')]:_0x4b1b5a['model'];_0x220dec[_0xc440('0x31')]=qs[_0xc440('0x32')](_0x7db8c0[_0xc440('0x2c')][_0xc440('0x32')]);_0x220dec[_0xc440('0x35')]=qs[_0xc440('0x2a')](_[_0xc440('0x33')](_0x7db8c0[_0xc440('0x2c')],_0x4b1b5a['filters']));if(_0x7db8c0[_0xc440('0x2c')][_0xc440('0x34')]){_0x220dec[_0xc440('0x35')]=_[_0xc440('0x36')](_0x220dec[_0xc440('0x35')],{'$or':_[_0xc440('0x29')](_0x220dec['attributes'],function(_0xb038e2){var _0x6ccfdb={};_0x6ccfdb[_0xb038e2]={'$like':'%'+_0x7db8c0[_0xc440('0x2c')][_0xc440('0x34')]+'%'};return _0x6ccfdb;})});}_0x220dec=_[_0xc440('0x36')]({},_0x220dec,_0x7db8c0[_0xc440('0x37')]);return _0x33b414[_0xc440('0x47')](_0x220dec);}})['then'](function(_0x29e5ae){if(_0x29e5ae){_0x23e9eb=_0x29e5ae['length'];if(!_0x7db8c0['query']['hasOwnProperty'](_0xc440('0x30'))){_0x220dec[_0xc440('0x16')]=qs[_0xc440('0x16')](_0x7db8c0['query']['limit']);_0x220dec[_0xc440('0x14')]=qs[_0xc440('0x14')](_0x7db8c0['query']['offset']);}return _0x33b414[_0xc440('0x47')](_0x220dec);}})[_0xc440('0x1d')](function(_0x192557){if(_0x192557){return _0x192557?{'count':_0x23e9eb,'rows':_0x192557}:null;}})['then'](respondWithResult(_0xcaff54,null))[_0xc440('0x3b')](handleError(_0xcaff54,null));};exports[_0xc440('0x49')]=function(_0x191055,_0x53ebe1,_0x38a1d0){var _0xa803a8={};var _0x2f772f={};var _0xf7794b;var _0x5c8515;return db[_0xc440('0x24')][_0xc440('0x48')]({'where':{'id':_0x191055[_0xc440('0x3d')]['id']}})[_0xc440('0x1d')](handleEntityNotFound(_0x53ebe1,null))['then'](function(_0x2b08dd){if(_0x2b08dd){_0xf7794b=_0x2b08dd;_0x2f772f[_0xc440('0x28')]=_[_0xc440('0x3e')](db[_0xc440('0x46')][_0xc440('0x25')]);_0x2f772f[_0xc440('0x2c')]=_[_0xc440('0x3e')](_0x191055[_0xc440('0x2c')]);_0x2f772f['filters']=_['intersection'](_0x2f772f[_0xc440('0x28')],_0x2f772f[_0xc440('0x2c')]);_0xa803a8[_0xc440('0x2d')]=_[_0xc440('0x2b')](_0x2f772f[_0xc440('0x28')],qs[_0xc440('0x2e')](_0x191055[_0xc440('0x2c')][_0xc440('0x2e')]));_0xa803a8[_0xc440('0x2d')]=_0xa803a8[_0xc440('0x2d')][_0xc440('0x3f')]?_0xa803a8[_0xc440('0x2d')]:_0x2f772f[_0xc440('0x28')];_0xa803a8['order']=qs['sort'](_0x191055[_0xc440('0x2c')]['sort']);_0xa803a8['where']=qs[_0xc440('0x2a')](_[_0xc440('0x33')](_0x191055['query'],_0x2f772f[_0xc440('0x2a')]));if(_0x191055['query'][_0xc440('0x34')]){_0xa803a8[_0xc440('0x35')]=_['merge'](_0xa803a8['where'],{'$or':_[_0xc440('0x29')](_0xa803a8[_0xc440('0x2d')],function(_0x6b392d){var _0x2ac368={};_0x2ac368[_0x6b392d]={'$like':'%'+_0x191055[_0xc440('0x2c')][_0xc440('0x34')]+'%'};return _0x2ac368;})});}_0xa803a8=_[_0xc440('0x36')]({},_0xa803a8,_0x191055[_0xc440('0x37')]);return _0xf7794b['getDescriptions'](_0xa803a8);}})[_0xc440('0x1d')](function(_0x84573a){if(_0x84573a){_0x5c8515=_0x84573a[_0xc440('0x3f')];if(!_0x191055[_0xc440('0x2c')][_0xc440('0x2f')](_0xc440('0x30'))){_0xa803a8['limit']=qs[_0xc440('0x16')](_0x191055['query'][_0xc440('0x16')]);_0xa803a8['offset']=qs[_0xc440('0x14')](_0x191055[_0xc440('0x2c')][_0xc440('0x14')]);}return _0xf7794b['getDescriptions'](_0xa803a8);}})[_0xc440('0x1d')](function(_0x2b4ccc){if(_0x2b4ccc){return _0x2b4ccc?{'count':_0x5c8515,'rows':_0x2b4ccc}:null;}})[_0xc440('0x1d')](respondWithResult(_0x53ebe1,null))[_0xc440('0x3b')](handleError(_0x53ebe1,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 5c49e10..37fd5a4 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','util'];(function(_0x58d88a,_0x49fc93){var _0x58601c=function(_0x545821){while(--_0x545821){_0x58d88a['push'](_0x58d88a['shift']());}};_0x58601c(++_0x49fc93);}(_0xedd9,0xfc));var _0x9edd=function(_0x5e98e2,_0x45cd82){_0x5e98e2=_0x5e98e2-0x0;var _0x2322cf=_0xedd9[_0x5e98e2];return _0x2322cf;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x9a19,0x114));var _0x99a1=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0x9a19[_0x3430aa];return _0x2ac5c;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index d25928e..bff9418 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 _0x6b69=['jayson/promise','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x455b20,_0x459e1d){var _0x1f4496=function(_0x484a3a){while(--_0x484a3a){_0x455b20['push'](_0x455b20['shift']());}};_0x1f4496(++_0x459e1d);}(_0x6b69,0x199));var _0x96b6=function(_0x51ec5d,_0x3a2e02){_0x51ec5d=_0x51ec5d-0x0;var _0x182ad2=_0x6b69[_0x51ec5d];return _0x182ad2;};'use strict';var _=require(_0x96b6('0x0'));var util=require(_0x96b6('0x1'));var moment=require(_0x96b6('0x2'));var BPromise=require(_0x96b6('0x3'));var rs=require(_0x96b6('0x4'));var fs=require('fs');var Redis=require(_0x96b6('0x5'));var db=require(_0x96b6('0x6'))['db'];var utils=require(_0x96b6('0x7'));var logger=require(_0x96b6('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x96b6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16664c,_0x23cd03,_0x3ee979){return new BPromise(function(_0x42d4a6,_0x306dbd){return client[_0x96b6('0xa')](_0x16664c,_0x3ee979)[_0x96b6('0xb')](function(_0x1de006){logger[_0x96b6('0xc')](_0x96b6('0xd'),_0x23cd03,_0x96b6('0xe'));logger['debug'](_0x96b6('0xf'),_0x23cd03,'request\x20sent',JSON[_0x96b6('0x10')](_0x1de006));if(_0x1de006[_0x96b6('0x11')]){if(_0x1de006[_0x96b6('0x11')][_0x96b6('0x12')]===0x1f4){logger['error'](_0x96b6('0xd'),_0x23cd03,_0x1de006[_0x96b6('0x11')]['message']);return _0x306dbd(_0x1de006[_0x96b6('0x11')][_0x96b6('0x13')]);}logger[_0x96b6('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x23cd03,_0x1de006['error']['message']);return _0x42d4a6(_0x1de006[_0x96b6('0x11')][_0x96b6('0x13')]);}else{logger[_0x96b6('0xc')](_0x96b6('0xd'),_0x23cd03,_0x96b6('0xe'));_0x42d4a6(_0x1de006[_0x96b6('0x14')][_0x96b6('0x13')]);}})[_0x96b6('0x15')](function(_0x5abe5c){logger[_0x96b6('0x11')](_0x96b6('0xd'),_0x23cd03,_0x5abe5c);_0x306dbd(_0x5abe5c);});});} \ No newline at end of file +var _0xe909=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x46493f,_0x454c82){var _0x220cd0=function(_0x1648de){while(--_0x1648de){_0x46493f['push'](_0x46493f['shift']());}};_0x220cd0(++_0x454c82);}(_0xe909,0x14a));var _0x9e90=function(_0x302e6e,_0x98d53f){_0x302e6e=_0x302e6e-0x0;var _0x406175=_0xe909[_0x302e6e];return _0x406175;};'use strict';var _=require(_0x9e90('0x0'));var util=require(_0x9e90('0x1'));var moment=require(_0x9e90('0x2'));var BPromise=require(_0x9e90('0x3'));var rs=require(_0x9e90('0x4'));var fs=require('fs');var Redis=require(_0x9e90('0x5'));var db=require(_0x9e90('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9e90('0x7'));var config=require(_0x9e90('0x8'));var jayson=require(_0x9e90('0x9'));var client=jayson[_0x9e90('0xa')][_0x9e90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51f277,_0x4a4943,_0x506697){return new BPromise(function(_0xacd02d,_0x17490e){return client[_0x9e90('0xc')](_0x51f277,_0x506697)['then'](function(_0x37958f){logger['info'](_0x9e90('0xd'),_0x4a4943,_0x9e90('0xe'));logger[_0x9e90('0xf')](_0x9e90('0x10'),_0x4a4943,'request\x20sent',JSON[_0x9e90('0x11')](_0x37958f));if(_0x37958f[_0x9e90('0x12')]){if(_0x37958f[_0x9e90('0x12')][_0x9e90('0x13')]===0x1f4){logger[_0x9e90('0x12')](_0x9e90('0xd'),_0x4a4943,_0x37958f[_0x9e90('0x12')][_0x9e90('0x14')]);return _0x17490e(_0x37958f[_0x9e90('0x12')][_0x9e90('0x14')]);}logger[_0x9e90('0x12')](_0x9e90('0xd'),_0x4a4943,_0x37958f[_0x9e90('0x12')][_0x9e90('0x14')]);return _0xacd02d(_0x37958f['error'][_0x9e90('0x14')]);}else{logger[_0x9e90('0x15')](_0x9e90('0xd'),_0x4a4943,_0x9e90('0xe'));_0xacd02d(_0x37958f[_0x9e90('0x16')]['message']);}})['catch'](function(_0x236b52){logger[_0x9e90('0x12')](_0x9e90('0xd'),_0x4a4943,_0x236b52);_0x17490e(_0x236b52);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index d1527cc..773da30 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 _0x52e3=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','update','/:id','exports'];(function(_0x5e2f89,_0x203328){var _0x47ec5a=function(_0x14e97f){while(--_0x14e97f){_0x5e2f89['push'](_0x5e2f89['shift']());}};_0x47ec5a(++_0x203328);}(_0x52e3,0xd1));var _0x352e=function(_0x51bef9,_0x1cd3b0){_0x51bef9=_0x51bef9-0x0;var _0x505f78=_0x52e3[_0x51bef9];return _0x505f78;};'use strict';var multer=require(_0x352e('0x0'));var util=require(_0x352e('0x1'));var path=require(_0x352e('0x2'));var timeout=require(_0x352e('0x3'));var express=require(_0x352e('0x4'));var router=express[_0x352e('0x5')]();var fs_extra=require(_0x352e('0x6'));var auth=require(_0x352e('0x7'));var interaction=require(_0x352e('0x8'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x352e('0x9')]('/',auth[_0x352e('0xa')](),controller[_0x352e('0xb')]);router[_0x352e('0x9')]('/:id',auth[_0x352e('0xa')](),controller[_0x352e('0xc')]);router[_0x352e('0xd')]('/',auth[_0x352e('0xa')](),controller[_0x352e('0xe')]);router[_0x352e('0xf')]('/:id',auth[_0x352e('0xa')](),controller[_0x352e('0x10')]);router['delete'](_0x352e('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x352e('0x12')]=router; \ No newline at end of file +var _0x9df1=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','put','update','delete','destroy','multer'];(function(_0x25d368,_0x59e491){var _0x1c6fc7=function(_0x6d2c6e){while(--_0x6d2c6e){_0x25d368['push'](_0x25d368['shift']());}};_0x1c6fc7(++_0x59e491);}(_0x9df1,0x14f));var _0x19df=function(_0x148379,_0x4bc905){_0x148379=_0x148379-0x0;var _0x33db64=_0x9df1[_0x148379];return _0x33db64;};'use strict';var multer=require(_0x19df('0x0'));var util=require('util');var path=require(_0x19df('0x1'));var timeout=require('connect-timeout');var express=require(_0x19df('0x2'));var router=express[_0x19df('0x3')]();var fs_extra=require(_0x19df('0x4'));var auth=require(_0x19df('0x5'));var interaction=require(_0x19df('0x6'));var config=require(_0x19df('0x7'));var controller=require('./intDynamics365Field.controller');router[_0x19df('0x8')]('/',auth[_0x19df('0x9')](),controller['index']);router[_0x19df('0x8')](_0x19df('0xa'),auth[_0x19df('0x9')](),controller['show']);router[_0x19df('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x19df('0xc')](_0x19df('0xa'),auth[_0x19df('0x9')](),controller[_0x19df('0xd')]);router[_0x19df('0xe')]('/:id',auth[_0x19df('0x9')](),controller[_0x19df('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index fb36f68..d7ed2b9 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 _0x6c88=['ENUM','variable','picklist','string','STRING','sequelize','exports'];(function(_0x5aa7c3,_0x42d1cd){var _0x399a3a=function(_0x2f4653){while(--_0x2f4653){_0x5aa7c3['push'](_0x5aa7c3['shift']());}};_0x399a3a(++_0x42d1cd);}(_0x6c88,0xd7));var _0x86c8=function(_0x2c87dc,_0x139292){_0x2c87dc=_0x2c87dc-0x0;var _0x2b78ec=_0x6c88[_0x2c87dc];return _0x2b78ec;};'use strict';var Sequelize=require(_0x86c8('0x0'));module[_0x86c8('0x1')]={'type':{'type':Sequelize[_0x86c8('0x2')]('string',_0x86c8('0x3'),'customVariable','keyValue',_0x86c8('0x4')),'defaultValue':_0x86c8('0x5')},'content':{'type':Sequelize[_0x86c8('0x6')]},'key':{'type':Sequelize[_0x86c8('0x6')]},'keyType':{'type':Sequelize[_0x86c8('0x2')](_0x86c8('0x5'),_0x86c8('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x86c8('0x6')]},'idField':{'type':Sequelize[_0x86c8('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x86c8('0x6')]}}; \ No newline at end of file +var _0x5dce=['keyValue','STRING','ENUM','BOOLEAN','string','customVariable'];(function(_0x6e10e9,_0x12a36f){var _0x3da05e=function(_0x1e6ac0){while(--_0x1e6ac0){_0x6e10e9['push'](_0x6e10e9['shift']());}};_0x3da05e(++_0x12a36f);}(_0x5dce,0x1ae));var _0xe5dc=function(_0x5b5c48,_0x15ee61){_0x5b5c48=_0x5b5c48-0x0;var _0xbf7c7a=_0x5dce[_0x5b5c48];return _0xbf7c7a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xe5dc('0x0'),'variable',_0xe5dc('0x1'),_0xe5dc('0x2'),'picklist'),'defaultValue':_0xe5dc('0x0')},'content':{'type':Sequelize[_0xe5dc('0x3')]},'key':{'type':Sequelize[_0xe5dc('0x3')]},'keyType':{'type':Sequelize[_0xe5dc('0x4')](_0xe5dc('0x0'),'variable',_0xe5dc('0x1'))},'keyContent':{'type':Sequelize[_0xe5dc('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe5dc('0x3')]},'customField':{'type':Sequelize[_0xe5dc('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe5dc('0x3')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index f864d08..933a2e8 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 _0x4c0e=['catch','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','filters','intersection','attributes','model','fields','query','length','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x4de95b,_0x290dbe){var _0x53dca0=function(_0x3f6164){while(--_0x3f6164){_0x4de95b['push'](_0x4de95b['shift']());}};_0x53dca0(++_0x290dbe);}(_0x4c0e,0x1d4));var _0xe4c0=function(_0x36f82a,_0x4ec395){_0x36f82a=_0x36f82a-0x0;var _0x495067=_0x4c0e[_0x36f82a];return _0x495067;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4c0('0x0'));var zipdir=require(_0xe4c0('0x1'));var jsonpatch=require(_0xe4c0('0x2'));var rp=require(_0xe4c0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe4c0('0x4'));var sox=require('sox');var csv=require(_0xe4c0('0x5'));var ejs=require(_0xe4c0('0x6'));var fs=require('fs');var fs_extra=require(_0xe4c0('0x7'));var _=require(_0xe4c0('0x8'));var squel=require('squel');var crypto=require(_0xe4c0('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe4c0('0xa'));var toCsv=require(_0xe4c0('0x5'));var querystring=require('querystring');var Papa=require(_0xe4c0('0xb'));var Redis=require('ioredis');var authService=require(_0xe4c0('0xc'));var qs=require(_0xe4c0('0xd'));var as=require(_0xe4c0('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe4c0('0xf'));var config=require(_0xe4c0('0x10'));var licenseUtil=require(_0xe4c0('0x11'));var db=require(_0xe4c0('0x12'))['db'];function respondWithStatusCode(_0x487953,_0x176dac){_0x176dac=_0x176dac||0xcc;return function(_0x28c120){if(_0x28c120){return _0x487953['sendStatus'](_0x176dac);}return _0x487953[_0xe4c0('0x13')](_0x176dac)[_0xe4c0('0x14')]();};}function respondWithResult(_0x215550,_0x39415c){_0x39415c=_0x39415c||0xc8;return function(_0x58cb86){if(_0x58cb86){return _0x215550[_0xe4c0('0x13')](_0x39415c)[_0xe4c0('0x15')](_0x58cb86);}};}function respondWithFilteredResult(_0x26485d,_0x5a9290){return function(_0x40e824){if(_0x40e824){var _0x28652b=typeof _0x5a9290['offset']===_0xe4c0('0x16')&&typeof _0x5a9290[_0xe4c0('0x17')]===_0xe4c0('0x16');var _0x21536c=_0x40e824[_0xe4c0('0x18')];var _0x5f500d=_0x28652b?0x0:_0x5a9290[_0xe4c0('0x19')];var _0x414561=_0x28652b?_0x40e824[_0xe4c0('0x18')]:_0x5a9290[_0xe4c0('0x19')]+_0x5a9290['limit'];var _0x587a14;if(_0x414561>=_0x21536c){_0x414561=_0x21536c;_0x587a14=0xc8;}else{_0x587a14=0xce;}_0x26485d[_0xe4c0('0x13')](_0x587a14);return _0x26485d[_0xe4c0('0x1a')](_0xe4c0('0x1b'),_0x5f500d+'-'+_0x414561+'/'+_0x21536c)[_0xe4c0('0x15')](_0x40e824);}return null;};}function patchUpdates(_0x9cc177){return function(_0x528bfb){try{jsonpatch[_0xe4c0('0x1c')](_0x528bfb,_0x9cc177,!![]);}catch(_0x4cd9dd){return BPromise[_0xe4c0('0x1d')](_0x4cd9dd);}return _0x528bfb['save']();};}function saveUpdates(_0x2b0e6e,_0x272cbd){return function(_0x42fdd4){if(_0x42fdd4){return _0x42fdd4[_0xe4c0('0x1e')](_0x2b0e6e)[_0xe4c0('0x1f')](function(_0x25fe12){return _0x25fe12;});}return null;};}function removeEntity(_0x523a5a,_0x4a6cc4){return function(_0x3cbf09){if(_0x3cbf09){return _0x3cbf09[_0xe4c0('0x20')]()[_0xe4c0('0x1f')](function(){_0x523a5a['status'](0xcc)[_0xe4c0('0x14')]();});}};}function handleEntityNotFound(_0x5168c8,_0xdf4dfa){return function(_0xec0178){if(!_0xec0178){_0x5168c8[_0xe4c0('0x21')](0x194);}return _0xec0178;};}function handleError(_0x1973d3,_0x332150){_0x332150=_0x332150||0x1f4;return function(_0x38f819){logger[_0xe4c0('0x22')](_0x38f819[_0xe4c0('0x23')]);if(_0x38f819['name']){delete _0x38f819[_0xe4c0('0x24')];}_0x1973d3['status'](_0x332150)[_0xe4c0('0x25')](_0x38f819);};}exports['index']=function(_0x11174e,_0x297135){var _0x11d749={},_0x532022={},_0x1255ea={'count':0x0,'rows':[]};var _0x33f6c3=_[_0xe4c0('0x26')](db[_0xe4c0('0x27')][_0xe4c0('0x28')],function(_0x32d97e){return{'name':_0x32d97e[_0xe4c0('0x29')],'type':_0x32d97e[_0xe4c0('0x2a')][_0xe4c0('0x2b')]};});_0x532022['model']=_[_0xe4c0('0x26')](_0x33f6c3,_0xe4c0('0x24'));_0x532022['query']=_['keys'](_0x11174e['query']);_0x532022[_0xe4c0('0x2c')]=_[_0xe4c0('0x2d')](_0x532022['model'],_0x532022['query']);_0x11d749[_0xe4c0('0x2e')]=_['intersection'](_0x532022[_0xe4c0('0x2f')],qs[_0xe4c0('0x30')](_0x11174e[_0xe4c0('0x31')][_0xe4c0('0x30')]));_0x11d749[_0xe4c0('0x2e')]=_0x11d749[_0xe4c0('0x2e')][_0xe4c0('0x32')]?_0x11d749[_0xe4c0('0x2e')]:_0x532022[_0xe4c0('0x2f')];if(!_0x11174e[_0xe4c0('0x31')]['hasOwnProperty']('nolimit')){_0x11d749[_0xe4c0('0x17')]=qs[_0xe4c0('0x17')](_0x11174e['query'][_0xe4c0('0x17')]);_0x11d749[_0xe4c0('0x19')]=qs[_0xe4c0('0x19')](_0x11174e['query']['offset']);}_0x11d749[_0xe4c0('0x33')]=qs[_0xe4c0('0x34')](_0x11174e[_0xe4c0('0x31')]['sort']);_0x11d749[_0xe4c0('0x35')]=qs[_0xe4c0('0x2c')](_['pick'](_0x11174e[_0xe4c0('0x31')],_0x532022[_0xe4c0('0x2c')]),_0x33f6c3);if(_0x11174e[_0xe4c0('0x31')][_0xe4c0('0x36')]){_0x11d749[_0xe4c0('0x35')]=_[_0xe4c0('0x37')](_0x11d749[_0xe4c0('0x35')],{'$or':_[_0xe4c0('0x26')](_0x33f6c3,function(_0x490cb9){if(_0x490cb9[_0xe4c0('0x2a')]!==_0xe4c0('0x38')){var _0x549f5b={};_0x549f5b[_0x490cb9[_0xe4c0('0x24')]]={'$like':'%'+_0x11174e['query'][_0xe4c0('0x36')]+'%'};return _0x549f5b;}})});}_0x11d749=_[_0xe4c0('0x37')]({},_0x11d749,_0x11174e['options']);var _0x415e13={'where':_0x11d749[_0xe4c0('0x35')]};return db[_0xe4c0('0x27')][_0xe4c0('0x18')](_0x415e13)[_0xe4c0('0x1f')](function(_0x1df011){_0x1255ea[_0xe4c0('0x18')]=_0x1df011;if(_0x11174e[_0xe4c0('0x31')][_0xe4c0('0x39')]){_0x11d749[_0xe4c0('0x3a')]=[{'all':!![]}];}return db[_0xe4c0('0x27')][_0xe4c0('0x3b')](_0x11d749);})[_0xe4c0('0x1f')](function(_0x39ce6e){_0x1255ea['rows']=_0x39ce6e;return _0x1255ea;})[_0xe4c0('0x1f')](respondWithFilteredResult(_0x297135,_0x11d749))[_0xe4c0('0x3c')](handleError(_0x297135,null));};exports['show']=function(_0x347b4d,_0x3d6e79){var _0x460678={'raw':!![],'where':{'id':_0x347b4d[_0xe4c0('0x3d')]['id']}},_0xf82dd7={};_0xf82dd7[_0xe4c0('0x2f')]=_[_0xe4c0('0x3e')](db[_0xe4c0('0x27')][_0xe4c0('0x28')]);_0xf82dd7[_0xe4c0('0x31')]=_['keys'](_0x347b4d[_0xe4c0('0x31')]);_0xf82dd7['filters']=_['intersection'](_0xf82dd7[_0xe4c0('0x2f')],_0xf82dd7[_0xe4c0('0x31')]);_0x460678['attributes']=_[_0xe4c0('0x2d')](_0xf82dd7['model'],qs[_0xe4c0('0x30')](_0x347b4d[_0xe4c0('0x31')]['fields']));_0x460678['attributes']=_0x460678[_0xe4c0('0x2e')]['length']?_0x460678[_0xe4c0('0x2e')]:_0xf82dd7['model'];if(_0x347b4d[_0xe4c0('0x31')][_0xe4c0('0x39')]){_0x460678[_0xe4c0('0x3a')]=[{'all':!![]}];}_0x460678=_[_0xe4c0('0x37')]({},_0x460678,_0x347b4d['options']);return db[_0xe4c0('0x27')][_0xe4c0('0x3f')](_0x460678)[_0xe4c0('0x1f')](handleEntityNotFound(_0x3d6e79,null))[_0xe4c0('0x1f')](respondWithResult(_0x3d6e79,null))['catch'](handleError(_0x3d6e79,null));};exports[_0xe4c0('0x40')]=function(_0x2d15ed,_0x4742a6){return db[_0xe4c0('0x27')][_0xe4c0('0x40')](_0x2d15ed[_0xe4c0('0x41')],{})[_0xe4c0('0x1f')](respondWithResult(_0x4742a6,0xc9))['catch'](handleError(_0x4742a6,null));};exports[_0xe4c0('0x1e')]=function(_0x2f3009,_0x3313f0){if(_0x2f3009[_0xe4c0('0x41')]['id']){delete _0x2f3009[_0xe4c0('0x41')]['id'];}return db[_0xe4c0('0x27')][_0xe4c0('0x3f')]({'where':{'id':_0x2f3009['params']['id']}})[_0xe4c0('0x1f')](handleEntityNotFound(_0x3313f0,null))['then'](saveUpdates(_0x2f3009[_0xe4c0('0x41')],null))[_0xe4c0('0x1f')](respondWithResult(_0x3313f0,null))[_0xe4c0('0x3c')](handleError(_0x3313f0,null));};exports[_0xe4c0('0x20')]=function(_0x8e57d6,_0x5cc6e9){return db[_0xe4c0('0x27')][_0xe4c0('0x3f')]({'where':{'id':_0x8e57d6['params']['id']}})['then'](handleEntityNotFound(_0x5cc6e9,null))[_0xe4c0('0x1f')](removeEntity(_0x5cc6e9,null))[_0xe4c0('0x3c')](handleError(_0x5cc6e9,null));}; \ No newline at end of file +var _0x3c83=['name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Field','includeAll','include','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack'];(function(_0x3a840c,_0x2c866a){var _0x16627f=function(_0x294d7c){while(--_0x294d7c){_0x3a840c['push'](_0x3a840c['shift']());}};_0x16627f(++_0x2c866a);}(_0x3c83,0x110));var _0x33c8=function(_0x4f2622,_0x2b6b0d){_0x4f2622=_0x4f2622-0x0;var _0x447e16=_0x3c83[_0x4f2622];return _0x447e16;};'use strict';var emlformat=require(_0x33c8('0x0'));var rimraf=require(_0x33c8('0x1'));var zipdir=require(_0x33c8('0x2'));var jsonpatch=require(_0x33c8('0x3'));var rp=require(_0x33c8('0x4'));var moment=require('moment');var BPromise=require(_0x33c8('0x5'));var Mustache=require(_0x33c8('0x6'));var util=require(_0x33c8('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x33c8('0x8'));var fs=require('fs');var fs_extra=require(_0x33c8('0x9'));var _=require(_0x33c8('0xa'));var squel=require(_0x33c8('0xb'));var crypto=require(_0x33c8('0xc'));var jsforce=require(_0x33c8('0xd'));var deskjs=require(_0x33c8('0xe'));var toCsv=require(_0x33c8('0xf'));var querystring=require(_0x33c8('0x10'));var Papa=require(_0x33c8('0x11'));var Redis=require(_0x33c8('0x12'));var authService=require(_0x33c8('0x13'));var qs=require(_0x33c8('0x14'));var as=require(_0x33c8('0x15'));var hardwareService=require(_0x33c8('0x16'));var logger=require(_0x33c8('0x17'))(_0x33c8('0x18'));var utils=require(_0x33c8('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x33c8('0x1a'));var db=require(_0x33c8('0x1b'))['db'];function respondWithStatusCode(_0x3306d3,_0x8fd31c){_0x8fd31c=_0x8fd31c||0xcc;return function(_0xec6e8b){if(_0xec6e8b){return _0x3306d3[_0x33c8('0x1c')](_0x8fd31c);}return _0x3306d3['status'](_0x8fd31c)[_0x33c8('0x1d')]();};}function respondWithResult(_0x5314ff,_0x38f9a7){_0x38f9a7=_0x38f9a7||0xc8;return function(_0x2a25a3){if(_0x2a25a3){return _0x5314ff[_0x33c8('0x1e')](_0x38f9a7)[_0x33c8('0x1f')](_0x2a25a3);}};}function respondWithFilteredResult(_0x17f1db,_0xd93164){return function(_0x39935c){if(_0x39935c){var _0x345d47=typeof _0xd93164[_0x33c8('0x20')]==='undefined'&&typeof _0xd93164[_0x33c8('0x21')]===_0x33c8('0x22');var _0x2cd43e=_0x39935c[_0x33c8('0x23')];var _0x10a3da=_0x345d47?0x0:_0xd93164[_0x33c8('0x20')];var _0x3d66ba=_0x345d47?_0x39935c[_0x33c8('0x23')]:_0xd93164[_0x33c8('0x20')]+_0xd93164['limit'];var _0x5863ab;if(_0x3d66ba>=_0x2cd43e){_0x3d66ba=_0x2cd43e;_0x5863ab=0xc8;}else{_0x5863ab=0xce;}_0x17f1db[_0x33c8('0x1e')](_0x5863ab);return _0x17f1db[_0x33c8('0x24')]('Content-Range',_0x10a3da+'-'+_0x3d66ba+'/'+_0x2cd43e)[_0x33c8('0x1f')](_0x39935c);}return null;};}function patchUpdates(_0x2c1800){return function(_0x3aa413){try{jsonpatch[_0x33c8('0x25')](_0x3aa413,_0x2c1800,!![]);}catch(_0x89a8c0){return BPromise[_0x33c8('0x26')](_0x89a8c0);}return _0x3aa413['save']();};}function saveUpdates(_0x18a709,_0x5d69d3){return function(_0x112edd){if(_0x112edd){return _0x112edd[_0x33c8('0x27')](_0x18a709)[_0x33c8('0x28')](function(_0x539392){return _0x539392;});}return null;};}function removeEntity(_0x4ae85b,_0x20cb6d){return function(_0x572ec2){if(_0x572ec2){return _0x572ec2[_0x33c8('0x29')]()['then'](function(){_0x4ae85b[_0x33c8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc77fa0,_0x28bee2){return function(_0x4c50d1){if(!_0x4c50d1){_0xc77fa0[_0x33c8('0x1c')](0x194);}return _0x4c50d1;};}function handleError(_0x42e30c,_0x68588a){_0x68588a=_0x68588a||0x1f4;return function(_0x32389b){logger[_0x33c8('0x2a')](_0x32389b[_0x33c8('0x2b')]);if(_0x32389b['name']){delete _0x32389b[_0x33c8('0x2c')];}_0x42e30c[_0x33c8('0x1e')](_0x68588a)[_0x33c8('0x2d')](_0x32389b);};}exports[_0x33c8('0x2e')]=function(_0x2bce74,_0x30e97c){var _0x1957cd={},_0x1d2d40={},_0x6db353={'count':0x0,'rows':[]};var _0x506479=_[_0x33c8('0x2f')](db['Dynamics365Field'][_0x33c8('0x30')],function(_0x2aed32){return{'name':_0x2aed32[_0x33c8('0x31')],'type':_0x2aed32[_0x33c8('0x32')][_0x33c8('0x33')]};});_0x1d2d40[_0x33c8('0x34')]=_[_0x33c8('0x2f')](_0x506479,_0x33c8('0x2c'));_0x1d2d40['query']=_['keys'](_0x2bce74[_0x33c8('0x35')]);_0x1d2d40[_0x33c8('0x36')]=_[_0x33c8('0x37')](_0x1d2d40['model'],_0x1d2d40['query']);_0x1957cd['attributes']=_['intersection'](_0x1d2d40['model'],qs[_0x33c8('0x38')](_0x2bce74[_0x33c8('0x35')][_0x33c8('0x38')]));_0x1957cd[_0x33c8('0x39')]=_0x1957cd[_0x33c8('0x39')][_0x33c8('0x3a')]?_0x1957cd[_0x33c8('0x39')]:_0x1d2d40['model'];if(!_0x2bce74[_0x33c8('0x35')][_0x33c8('0x3b')]('nolimit')){_0x1957cd['limit']=qs[_0x33c8('0x21')](_0x2bce74['query']['limit']);_0x1957cd[_0x33c8('0x20')]=qs[_0x33c8('0x20')](_0x2bce74[_0x33c8('0x35')]['offset']);}_0x1957cd[_0x33c8('0x3c')]=qs[_0x33c8('0x3d')](_0x2bce74['query'][_0x33c8('0x3d')]);_0x1957cd[_0x33c8('0x3e')]=qs['filters'](_[_0x33c8('0x3f')](_0x2bce74['query'],_0x1d2d40[_0x33c8('0x36')]),_0x506479);if(_0x2bce74[_0x33c8('0x35')][_0x33c8('0x40')]){_0x1957cd[_0x33c8('0x3e')]=_[_0x33c8('0x41')](_0x1957cd[_0x33c8('0x3e')],{'$or':_[_0x33c8('0x2f')](_0x506479,function(_0x2c6238){if(_0x2c6238[_0x33c8('0x32')]!==_0x33c8('0x42')){var _0x5d34ec={};_0x5d34ec[_0x2c6238[_0x33c8('0x2c')]]={'$like':'%'+_0x2bce74[_0x33c8('0x35')][_0x33c8('0x40')]+'%'};return _0x5d34ec;}})});}_0x1957cd=_['merge']({},_0x1957cd,_0x2bce74[_0x33c8('0x43')]);var _0x1ee6eb={'where':_0x1957cd[_0x33c8('0x3e')]};return db[_0x33c8('0x44')][_0x33c8('0x23')](_0x1ee6eb)[_0x33c8('0x28')](function(_0x2baf9c){_0x6db353['count']=_0x2baf9c;if(_0x2bce74['query'][_0x33c8('0x45')]){_0x1957cd[_0x33c8('0x46')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x1957cd);})[_0x33c8('0x28')](function(_0x494f1c){_0x6db353[_0x33c8('0x47')]=_0x494f1c;return _0x6db353;})[_0x33c8('0x28')](respondWithFilteredResult(_0x30e97c,_0x1957cd))[_0x33c8('0x48')](handleError(_0x30e97c,null));};exports[_0x33c8('0x49')]=function(_0x577cd0,_0x3ca097){var _0x55c6ff={'raw':!![],'where':{'id':_0x577cd0[_0x33c8('0x4a')]['id']}},_0x247427={};_0x247427['model']=_['keys'](db[_0x33c8('0x44')][_0x33c8('0x30')]);_0x247427[_0x33c8('0x35')]=_[_0x33c8('0x4b')](_0x577cd0[_0x33c8('0x35')]);_0x247427['filters']=_[_0x33c8('0x37')](_0x247427[_0x33c8('0x34')],_0x247427['query']);_0x55c6ff[_0x33c8('0x39')]=_[_0x33c8('0x37')](_0x247427['model'],qs['fields'](_0x577cd0['query'][_0x33c8('0x38')]));_0x55c6ff[_0x33c8('0x39')]=_0x55c6ff['attributes'][_0x33c8('0x3a')]?_0x55c6ff[_0x33c8('0x39')]:_0x247427['model'];if(_0x577cd0[_0x33c8('0x35')][_0x33c8('0x45')]){_0x55c6ff[_0x33c8('0x46')]=[{'all':!![]}];}_0x55c6ff=_[_0x33c8('0x41')]({},_0x55c6ff,_0x577cd0['options']);return db['Dynamics365Field'][_0x33c8('0x4c')](_0x55c6ff)[_0x33c8('0x28')](handleEntityNotFound(_0x3ca097,null))[_0x33c8('0x28')](respondWithResult(_0x3ca097,null))['catch'](handleError(_0x3ca097,null));};exports['create']=function(_0x1d17a7,_0x1ab5e6){return db['Dynamics365Field'][_0x33c8('0x4d')](_0x1d17a7[_0x33c8('0x4e')],{})['then'](respondWithResult(_0x1ab5e6,0xc9))[_0x33c8('0x48')](handleError(_0x1ab5e6,null));};exports[_0x33c8('0x27')]=function(_0x27ead4,_0x1ed31e){if(_0x27ead4[_0x33c8('0x4e')]['id']){delete _0x27ead4['body']['id'];}return db[_0x33c8('0x44')][_0x33c8('0x4c')]({'where':{'id':_0x27ead4[_0x33c8('0x4a')]['id']}})[_0x33c8('0x28')](handleEntityNotFound(_0x1ed31e,null))['then'](saveUpdates(_0x27ead4[_0x33c8('0x4e')],null))[_0x33c8('0x28')](respondWithResult(_0x1ed31e,null))[_0x33c8('0x48')](handleError(_0x1ed31e,null));};exports[_0x33c8('0x29')]=function(_0xf437f0,_0x12cb83){return db[_0x33c8('0x44')][_0x33c8('0x4c')]({'where':{'id':_0xf437f0[_0x33c8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12cb83,null))['then'](removeEntity(_0x12cb83,null))[_0x33c8('0x48')](handleError(_0x12cb83,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 43248b8..2887ce2 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 _0xcca3=['path','../../config/environment','./intDynamics365Field.attributes','exports','define','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x57f74a,_0x3f8b13){var _0x15b677=function(_0x332610){while(--_0x332610){_0x57f74a['push'](_0x57f74a['shift']());}};_0x15b677(++_0x3f8b13);}(_0xcca3,0x157));var _0x3cca=function(_0x574dea,_0x4cf209){_0x574dea=_0x574dea-0x0;var _0x3ed444=_0xcca3[_0x574dea];return _0x3ed444;};'use strict';var _=require(_0x3cca('0x0'));var util=require(_0x3cca('0x1'));var logger=require(_0x3cca('0x2'))(_0x3cca('0x3'));var moment=require(_0x3cca('0x4'));var BPromise=require(_0x3cca('0x5'));var rp=require(_0x3cca('0x6'));var fs=require('fs');var path=require(_0x3cca('0x7'));var rimraf=require('rimraf');var config=require(_0x3cca('0x8'));var attributes=require(_0x3cca('0x9'));module[_0x3cca('0xa')]=function(_0x12c7ee,_0xa147c4){return _0x12c7ee[_0x3cca('0xb')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x3cca('0xc'),'fields':[_0x3cca('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc3c7=['../../config/environment','./intDynamics365Field.attributes','exports','define','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x4d9242,_0x385b6e){var _0x59301e=function(_0x54d2ef){while(--_0x54d2ef){_0x4d9242['push'](_0x4d9242['shift']());}};_0x59301e(++_0x385b6e);}(_0xc3c7,0x77));var _0x7c3c=function(_0x1d895d,_0x3e5c93){_0x1d895d=_0x1d895d-0x0;var _0x2dae23=_0xc3c7[_0x1d895d];return _0x2dae23;};'use strict';var _=require(_0x7c3c('0x0'));var util=require(_0x7c3c('0x1'));var logger=require(_0x7c3c('0x2'))('api');var moment=require(_0x7c3c('0x3'));var BPromise=require('bluebird');var rp=require(_0x7c3c('0x4'));var fs=require('fs');var path=require(_0x7c3c('0x5'));var rimraf=require(_0x7c3c('0x6'));var config=require(_0x7c3c('0x7'));var attributes=require(_0x7c3c('0x8'));module[_0x7c3c('0x9')]=function(_0x138e57,_0x5817a9){return _0x138e57[_0x7c3c('0xa')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x7c3c('0xb'),'fields':[_0x7c3c('0xc'),_0x7c3c('0xd')],'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 dbca389..504a209 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 _0x6e04=['client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x2edc2a,_0x459a58){var _0x5217d6=function(_0x342acb){while(--_0x342acb){_0x2edc2a['push'](_0x2edc2a['shift']());}};_0x5217d6(++_0x459a58);}(_0x6e04,0x13a));var _0x46e0=function(_0x193ddf,_0x6f30bb){_0x193ddf=_0x193ddf-0x0;var _0x5bc6df=_0x6e04[_0x193ddf];return _0x5bc6df;};'use strict';var _=require('lodash');var util=require(_0x46e0('0x0'));var moment=require(_0x46e0('0x1'));var BPromise=require(_0x46e0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46e0('0x3'));var db=require(_0x46e0('0x4'))['db'];var utils=require(_0x46e0('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x46e0('0x6'));var jayson=require(_0x46e0('0x7'));var client=jayson[_0x46e0('0x8')][_0x46e0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24a071,_0x229752,_0x5b852b){return new BPromise(function(_0x1b696c,_0x16552a){return client[_0x46e0('0xa')](_0x24a071,_0x5b852b)[_0x46e0('0xb')](function(_0x2fa313){logger[_0x46e0('0xc')](_0x46e0('0xd'),_0x229752,_0x46e0('0xe'));logger[_0x46e0('0xf')](_0x46e0('0x10'),_0x229752,_0x46e0('0xe'),JSON[_0x46e0('0x11')](_0x2fa313));if(_0x2fa313[_0x46e0('0x12')]){if(_0x2fa313['error'][_0x46e0('0x13')]===0x1f4){logger[_0x46e0('0x12')](_0x46e0('0xd'),_0x229752,_0x2fa313['error'][_0x46e0('0x14')]);return _0x16552a(_0x2fa313[_0x46e0('0x12')][_0x46e0('0x14')]);}logger[_0x46e0('0x12')](_0x46e0('0xd'),_0x229752,_0x2fa313[_0x46e0('0x12')]['message']);return _0x1b696c(_0x2fa313['error'][_0x46e0('0x14')]);}else{logger[_0x46e0('0xc')](_0x46e0('0xd'),_0x229752,_0x46e0('0xe'));_0x1b696c(_0x2fa313[_0x46e0('0x15')][_0x46e0('0x14')]);}})[_0x46e0('0x16')](function(_0x12b840){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x229752,_0x12b840);_0x16552a(_0x12b840);});});} \ No newline at end of file +var _0xc9d1=['then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2461d3,_0x1adfe2){var _0x266394=function(_0x365850){while(--_0x365850){_0x2461d3['push'](_0x2461d3['shift']());}};_0x266394(++_0x1adfe2);}(_0xc9d1,0x172));var _0x1c9d=function(_0x12fde3,_0x4800c6){_0x12fde3=_0x12fde3-0x0;var _0x521038=_0xc9d1[_0x12fde3];return _0x521038;};'use strict';var _=require(_0x1c9d('0x0'));var util=require(_0x1c9d('0x1'));var moment=require(_0x1c9d('0x2'));var BPromise=require(_0x1c9d('0x3'));var rs=require(_0x1c9d('0x4'));var fs=require('fs');var Redis=require(_0x1c9d('0x5'));var db=require(_0x1c9d('0x6'))['db'];var utils=require(_0x1c9d('0x7'));var logger=require('../../config/logger')(_0x1c9d('0x8'));var config=require(_0x1c9d('0x9'));var jayson=require(_0x1c9d('0xa'));var client=jayson[_0x1c9d('0xb')][_0x1c9d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f0c2c,_0x23f295,_0x350077){return new BPromise(function(_0x14a1d5,_0x3dea09){return client[_0x1c9d('0xd')](_0x4f0c2c,_0x350077)[_0x1c9d('0xe')](function(_0x447ea0){logger[_0x1c9d('0xf')](_0x1c9d('0x10'),_0x23f295,_0x1c9d('0x11'));logger[_0x1c9d('0x12')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x23f295,_0x1c9d('0x11'),JSON[_0x1c9d('0x13')](_0x447ea0));if(_0x447ea0[_0x1c9d('0x14')]){if(_0x447ea0[_0x1c9d('0x14')][_0x1c9d('0x15')]===0x1f4){logger[_0x1c9d('0x14')](_0x1c9d('0x10'),_0x23f295,_0x447ea0['error'][_0x1c9d('0x16')]);return _0x3dea09(_0x447ea0[_0x1c9d('0x14')]['message']);}logger[_0x1c9d('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x23f295,_0x447ea0['error'][_0x1c9d('0x16')]);return _0x14a1d5(_0x447ea0[_0x1c9d('0x14')]['message']);}else{logger[_0x1c9d('0xf')](_0x1c9d('0x10'),_0x23f295,_0x1c9d('0x11'));_0x14a1d5(_0x447ea0['result']['message']);}})[_0x1c9d('0x17')](function(_0x320bbd){logger[_0x1c9d('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x23f295,_0x320bbd);_0x3dea09(_0x320bbd);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 29c01a8..fb04704 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 _0x5124=['/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0xa8fce0,_0x8efdbb){var _0x5772af=function(_0x1288e0){while(--_0x1288e0){_0xa8fce0['push'](_0xa8fce0['shift']());}};_0x5772af(++_0x8efdbb);}(_0x5124,0x6b));var _0x4512=function(_0x32e7bd,_0x81a7b0){_0x32e7bd=_0x32e7bd-0x0;var _0x17eeb3=_0x5124[_0x32e7bd];return _0x17eeb3;};'use strict';var multer=require(_0x4512('0x0'));var util=require(_0x4512('0x1'));var path=require('path');var timeout=require(_0x4512('0x2'));var express=require(_0x4512('0x3'));var router=express[_0x4512('0x4')]();var fs_extra=require(_0x4512('0x5'));var auth=require(_0x4512('0x6'));var interaction=require(_0x4512('0x7'));var config=require(_0x4512('0x8'));var controller=require('./intFreshdeskAccount.controller');router[_0x4512('0x9')]('/',auth[_0x4512('0xa')](),controller[_0x4512('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4512('0xc')]);router['get'](_0x4512('0xd'),auth[_0x4512('0xa')](),controller[_0x4512('0xe')]);router[_0x4512('0x9')](_0x4512('0xf'),auth[_0x4512('0xa')](),controller['getFields']);router['post']('/',auth[_0x4512('0xa')](),controller[_0x4512('0x10')]);router[_0x4512('0x11')](_0x4512('0xd'),auth[_0x4512('0xa')](),controller[_0x4512('0x12')]);router['put'](_0x4512('0x13'),auth['isAuthenticated'](),controller[_0x4512('0x14')]);router[_0x4512('0x15')](_0x4512('0x13'),auth[_0x4512('0xa')](),controller[_0x4512('0x16')]);module[_0x4512('0x17')]=router; \ No newline at end of file +var _0xbe62=['get','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x46b22a,_0x5bf83a){var _0x44c2e8=function(_0x21b6fc){while(--_0x21b6fc){_0x46b22a['push'](_0x46b22a['shift']());}};_0x44c2e8(++_0x5bf83a);}(_0xbe62,0xf3));var _0x2be6=function(_0x48f3f1,_0x22c934){_0x48f3f1=_0x48f3f1-0x0;var _0xd43a99=_0xbe62[_0x48f3f1];return _0xd43a99;};'use strict';var multer=require('multer');var util=require(_0x2be6('0x0'));var path=require('path');var timeout=require(_0x2be6('0x1'));var express=require('express');var router=express[_0x2be6('0x2')]();var fs_extra=require(_0x2be6('0x3'));var auth=require(_0x2be6('0x4'));var interaction=require(_0x2be6('0x5'));var config=require(_0x2be6('0x6'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0x2be6('0x7')](),controller[_0x2be6('0x8')]);router[_0x2be6('0x9')](_0x2be6('0xa'),auth['isAuthenticated'](),controller[_0x2be6('0xb')]);router['get'](_0x2be6('0xc'),auth[_0x2be6('0x7')](),controller['getConfigurations']);router[_0x2be6('0x9')](_0x2be6('0xd'),auth['isAuthenticated'](),controller[_0x2be6('0xe')]);router[_0x2be6('0xf')]('/',auth['isAuthenticated'](),controller[_0x2be6('0x10')]);router[_0x2be6('0xf')]('/:id/configurations',auth[_0x2be6('0x7')](),controller['addConfiguration']);router[_0x2be6('0x11')](_0x2be6('0xa'),auth['isAuthenticated'](),controller[_0x2be6('0x12')]);router['delete'](_0x2be6('0xa'),auth[_0x2be6('0x7')](),controller[_0x2be6('0x13')]);module[_0x2be6('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 46a2148..ac39325 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 _0xd4a2=['STRING','username','sequelize'];(function(_0x21181b,_0x3dce1c){var _0x141069=function(_0x38146e){while(--_0x38146e){_0x21181b['push'](_0x21181b['shift']());}};_0x141069(++_0x3dce1c);}(_0xd4a2,0x173));var _0x2d4a=function(_0x23f5f3,_0x4a9f3f){_0x23f5f3=_0x23f5f3-0x0;var _0x10c8fb=_0xd4a2[_0x23f5f3];return _0x10c8fb;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2d4a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x2d4a('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2d4a('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x2d4a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x66fa=['exports','STRING','username','remoteUri','sequelize'];(function(_0x12b8b7,_0xff939a){var _0x3cbd4b=function(_0x547a00){while(--_0x547a00){_0x12b8b7['push'](_0x12b8b7['shift']());}};_0x3cbd4b(++_0xff939a);}(_0x66fa,0x117));var _0xa66f=function(_0x2a52fe,_0x2de2fb){_0x2a52fe=_0x2a52fe-0x0;var _0x41e9b4=_0x66fa[_0x2a52fe];return _0x41e9b4;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa66f('0x2')]},'username':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x3')},'apiKey':{'type':Sequelize[_0xa66f('0x2')]},'remoteUri':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x4')},'serverUrl':{'type':Sequelize[_0xa66f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index b8c8d7b..2769706 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 _0xd138=['filter','where','merge','options','findAll','rows','catch','include','find','create','body','update','params','getConfigurations','findOne','FreshdeskConfiguration','AccountId','getSubjects','channel','getDescriptions','Subjects','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','base64','requester','subject','agent','description','priority','group','company','remove','includes','default','custom_text','custom_dropdown','label','choices','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','bluebird','path','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x4f8dce,_0x4778d4){var _0x23f894=function(_0x96e620){while(--_0x96e620){_0x4f8dce['push'](_0x4f8dce['shift']());}};_0x23f894(++_0x4778d4);}(_0xd138,0x1dc));var _0x8d13=function(_0x4f1f4e,_0x3ad8f5){_0x4f1f4e=_0x4f1f4e-0x0;var _0x5a460d=_0xd138[_0x4f1f4e];return _0x5a460d;};'use strict';var emlformat=require(_0x8d13('0x0'));var rimraf=require(_0x8d13('0x1'));var zipdir=require(_0x8d13('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8d13('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8d13('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8d13('0x5'));var crypto=require(_0x8d13('0x6'));var jsforce=require(_0x8d13('0x7'));var deskjs=require('desk.js');var toCsv=require(_0x8d13('0x8'));var querystring=require('querystring');var Papa=require(_0x8d13('0x9'));var Redis=require(_0x8d13('0xa'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8d13('0xb'));var hardwareService=require(_0x8d13('0xc'));var logger=require(_0x8d13('0xd'))('api');var utils=require(_0x8d13('0xe'));var config=require(_0x8d13('0xf'));var licenseUtil=require(_0x8d13('0x10'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8d13('0x11'));function respondWithStatusCode(_0x375c9a,_0x38cfb3){_0x38cfb3=_0x38cfb3||0xcc;return function(_0x1b1137){if(_0x1b1137){return _0x375c9a[_0x8d13('0x12')](_0x38cfb3);}return _0x375c9a[_0x8d13('0x13')](_0x38cfb3)[_0x8d13('0x14')]();};}function respondWithResult(_0x8003cf,_0x37be90){_0x37be90=_0x37be90||0xc8;return function(_0x4dcc50){if(_0x4dcc50){return _0x8003cf[_0x8d13('0x13')](_0x37be90)['json'](_0x4dcc50);}};}function respondWithFilteredResult(_0x562ed9,_0xe697fe){return function(_0x4b4dc9){if(_0x4b4dc9){var _0x1f247a=typeof _0xe697fe[_0x8d13('0x15')]===_0x8d13('0x16')&&typeof _0xe697fe[_0x8d13('0x17')]===_0x8d13('0x16');var _0x16d3f7=_0x4b4dc9[_0x8d13('0x18')];var _0x3b08c3=_0x1f247a?0x0:_0xe697fe[_0x8d13('0x15')];var _0x2c36c4=_0x1f247a?_0x4b4dc9[_0x8d13('0x18')]:_0xe697fe[_0x8d13('0x15')]+_0xe697fe[_0x8d13('0x17')];var _0x411fe3;if(_0x2c36c4>=_0x16d3f7){_0x2c36c4=_0x16d3f7;_0x411fe3=0xc8;}else{_0x411fe3=0xce;}_0x562ed9[_0x8d13('0x13')](_0x411fe3);return _0x562ed9[_0x8d13('0x19')](_0x8d13('0x1a'),_0x3b08c3+'-'+_0x2c36c4+'/'+_0x16d3f7)[_0x8d13('0x1b')](_0x4b4dc9);}return null;};}function patchUpdates(_0x3bf92b){return function(_0x34b84){try{jsonpatch[_0x8d13('0x1c')](_0x34b84,_0x3bf92b,!![]);}catch(_0x346c60){return BPromise[_0x8d13('0x1d')](_0x346c60);}return _0x34b84['save']();};}function saveUpdates(_0x33ce65,_0x3ddc80){return function(_0x3c7524){if(_0x3c7524){return _0x3c7524['update'](_0x33ce65)[_0x8d13('0x1e')](function(_0x171aea){return _0x171aea;});}return null;};}function removeEntity(_0x9745b,_0x1229bf){return function(_0x1ba1f0){if(_0x1ba1f0){return _0x1ba1f0[_0x8d13('0x1f')]()[_0x8d13('0x1e')](function(){_0x9745b[_0x8d13('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38f33c,_0x1786b1){return function(_0x3c8e41){if(!_0x3c8e41){_0x38f33c[_0x8d13('0x12')](0x194);}return _0x3c8e41;};}function handleError(_0x263375,_0x35d5c8){_0x35d5c8=_0x35d5c8||0x1f4;return function(_0xa5b8c0){logger[_0x8d13('0x20')](_0xa5b8c0[_0x8d13('0x21')]);if(_0xa5b8c0[_0x8d13('0x22')]){delete _0xa5b8c0[_0x8d13('0x22')];}_0x263375[_0x8d13('0x13')](_0x35d5c8)['send'](_0xa5b8c0);};}exports['index']=function(_0x58e594,_0x5f5b7b){var _0x34ed06={},_0x1f1604={},_0x39e8bf={'count':0x0,'rows':[]};var _0x4aa003=_[_0x8d13('0x23')](db[_0x8d13('0x24')][_0x8d13('0x25')],function(_0x1c9a93){return{'name':_0x1c9a93[_0x8d13('0x26')],'type':_0x1c9a93[_0x8d13('0x27')][_0x8d13('0x28')]};});_0x1f1604[_0x8d13('0x29')]=_[_0x8d13('0x23')](_0x4aa003,'name');_0x1f1604[_0x8d13('0x2a')]=_[_0x8d13('0x2b')](_0x58e594[_0x8d13('0x2a')]);_0x1f1604[_0x8d13('0x2c')]=_[_0x8d13('0x2d')](_0x1f1604['model'],_0x1f1604[_0x8d13('0x2a')]);_0x34ed06[_0x8d13('0x2e')]=_[_0x8d13('0x2d')](_0x1f1604[_0x8d13('0x29')],qs[_0x8d13('0x2f')](_0x58e594[_0x8d13('0x2a')][_0x8d13('0x2f')]));_0x34ed06[_0x8d13('0x2e')]=_0x34ed06['attributes'][_0x8d13('0x30')]?_0x34ed06[_0x8d13('0x2e')]:_0x1f1604[_0x8d13('0x29')];if(!_0x58e594[_0x8d13('0x2a')][_0x8d13('0x31')](_0x8d13('0x32'))){_0x34ed06[_0x8d13('0x17')]=qs['limit'](_0x58e594['query']['limit']);_0x34ed06[_0x8d13('0x15')]=qs[_0x8d13('0x15')](_0x58e594[_0x8d13('0x2a')][_0x8d13('0x15')]);}_0x34ed06[_0x8d13('0x33')]=qs[_0x8d13('0x34')](_0x58e594[_0x8d13('0x2a')][_0x8d13('0x34')]);_0x34ed06['where']=qs['filters'](_[_0x8d13('0x35')](_0x58e594[_0x8d13('0x2a')],_0x1f1604['filters']),_0x4aa003);if(_0x58e594['query'][_0x8d13('0x36')]){_0x34ed06[_0x8d13('0x37')]=_[_0x8d13('0x38')](_0x34ed06[_0x8d13('0x37')],{'$or':_[_0x8d13('0x23')](_0x4aa003,function(_0x2c3bf9){if(_0x2c3bf9[_0x8d13('0x27')]!=='VIRTUAL'){var _0xdb12c2={};_0xdb12c2[_0x2c3bf9[_0x8d13('0x22')]]={'$like':'%'+_0x58e594[_0x8d13('0x2a')][_0x8d13('0x36')]+'%'};return _0xdb12c2;}})});}_0x34ed06=_[_0x8d13('0x38')]({},_0x34ed06,_0x58e594[_0x8d13('0x39')]);var _0x511435={'where':_0x34ed06[_0x8d13('0x37')]};return db['FreshdeskAccount'][_0x8d13('0x18')](_0x511435)[_0x8d13('0x1e')](function(_0x2090ad){_0x39e8bf[_0x8d13('0x18')]=_0x2090ad;if(_0x58e594[_0x8d13('0x2a')]['includeAll']){_0x34ed06['include']=[{'all':!![]}];}return db[_0x8d13('0x24')][_0x8d13('0x3a')](_0x34ed06);})['then'](function(_0x458dfe){_0x39e8bf[_0x8d13('0x3b')]=_0x458dfe;return _0x39e8bf;})[_0x8d13('0x1e')](respondWithFilteredResult(_0x5f5b7b,_0x34ed06))[_0x8d13('0x3c')](handleError(_0x5f5b7b,null));};exports['show']=function(_0x191878,_0x1cf511){var _0x216af6={'raw':![],'where':{'id':_0x191878['params']['id']}},_0x4ea28e={};_0x4ea28e[_0x8d13('0x29')]=_['keys'](db[_0x8d13('0x24')][_0x8d13('0x25')]);_0x4ea28e[_0x8d13('0x2a')]=_[_0x8d13('0x2b')](_0x191878['query']);_0x4ea28e[_0x8d13('0x2c')]=_[_0x8d13('0x2d')](_0x4ea28e[_0x8d13('0x29')],_0x4ea28e[_0x8d13('0x2a')]);_0x216af6[_0x8d13('0x2e')]=_[_0x8d13('0x2d')](_0x4ea28e['model'],qs[_0x8d13('0x2f')](_0x191878[_0x8d13('0x2a')][_0x8d13('0x2f')]));_0x216af6['attributes']=_0x216af6[_0x8d13('0x2e')][_0x8d13('0x30')]?_0x216af6['attributes']:_0x4ea28e[_0x8d13('0x29')];if(_0x191878['query']['includeAll']){_0x216af6[_0x8d13('0x3d')]=[{'all':!![]}];}_0x216af6=_[_0x8d13('0x38')]({},_0x216af6,_0x191878[_0x8d13('0x39')]);return db[_0x8d13('0x24')][_0x8d13('0x3e')](_0x216af6)[_0x8d13('0x1e')](handleEntityNotFound(_0x1cf511,null))[_0x8d13('0x1e')](respondWithResult(_0x1cf511,null))[_0x8d13('0x3c')](handleError(_0x1cf511,null));};exports['create']=function(_0x5cc1f5,_0x30df88){return db['FreshdeskAccount'][_0x8d13('0x3f')](_0x5cc1f5[_0x8d13('0x40')],{})[_0x8d13('0x1e')](respondWithResult(_0x30df88,0xc9))[_0x8d13('0x3c')](handleError(_0x30df88,null));};exports[_0x8d13('0x41')]=function(_0x3232fa,_0x234baa){if(_0x3232fa[_0x8d13('0x40')]['id']){delete _0x3232fa['body']['id'];}return db[_0x8d13('0x24')][_0x8d13('0x3e')]({'where':{'id':_0x3232fa[_0x8d13('0x42')]['id']}})[_0x8d13('0x1e')](handleEntityNotFound(_0x234baa,null))['then'](saveUpdates(_0x3232fa[_0x8d13('0x40')],null))[_0x8d13('0x1e')](respondWithResult(_0x234baa,null))['catch'](handleError(_0x234baa,null));};exports[_0x8d13('0x1f')]=function(_0x57f676,_0x383c1a){return db[_0x8d13('0x24')][_0x8d13('0x3e')]({'where':{'id':_0x57f676[_0x8d13('0x42')]['id']}})[_0x8d13('0x1e')](handleEntityNotFound(_0x383c1a,null))['then'](removeEntity(_0x383c1a,null))[_0x8d13('0x3c')](handleError(_0x383c1a,null));};exports[_0x8d13('0x43')]=function(_0x20514a,_0x22e6f3,_0x5f3734){var _0x3402dc={};var _0x8ce95e={};var _0x527d55;var _0x4b01e9;return db['FreshdeskAccount'][_0x8d13('0x44')]({'where':{'id':_0x20514a[_0x8d13('0x42')]['id']}})['then'](handleEntityNotFound(_0x22e6f3,null))[_0x8d13('0x1e')](function(_0x4e755b){if(_0x4e755b){_0x527d55=_0x4e755b;_0x8ce95e[_0x8d13('0x29')]=_['keys'](db[_0x8d13('0x45')][_0x8d13('0x25')]);_0x8ce95e['query']=_['keys'](_0x20514a['query']);_0x8ce95e[_0x8d13('0x2c')]=_['intersection'](_0x8ce95e[_0x8d13('0x29')],_0x8ce95e[_0x8d13('0x2a')]);_0x3402dc[_0x8d13('0x2e')]=_['intersection'](_0x8ce95e[_0x8d13('0x29')],qs['fields'](_0x20514a[_0x8d13('0x2a')][_0x8d13('0x2f')]));_0x3402dc[_0x8d13('0x2e')]=_0x3402dc[_0x8d13('0x2e')][_0x8d13('0x30')]?_0x3402dc[_0x8d13('0x2e')]:_0x8ce95e[_0x8d13('0x29')];_0x3402dc[_0x8d13('0x33')]=qs[_0x8d13('0x34')](_0x20514a[_0x8d13('0x2a')]['sort']);_0x3402dc[_0x8d13('0x37')]=qs['filters'](_[_0x8d13('0x35')](_0x20514a[_0x8d13('0x2a')],_0x8ce95e[_0x8d13('0x2c')]));if(_0x20514a['query'][_0x8d13('0x36')]){_0x3402dc[_0x8d13('0x37')]=_[_0x8d13('0x38')](_0x3402dc['where'],{'$or':_[_0x8d13('0x23')](_0x3402dc[_0x8d13('0x2e')],function(_0x1b425f){var _0x447f6c={};_0x447f6c[_0x1b425f]={'$like':'%'+_0x20514a[_0x8d13('0x2a')]['filter']+'%'};return _0x447f6c;})});}_0x3402dc=_[_0x8d13('0x38')]({},_0x3402dc,_0x20514a[_0x8d13('0x39')]);return _0x527d55['getConfigurations'](_0x3402dc);}})[_0x8d13('0x1e')](function(_0x7f6529){if(_0x7f6529){_0x4b01e9=_0x7f6529[_0x8d13('0x30')];if(!_0x20514a[_0x8d13('0x2a')][_0x8d13('0x31')](_0x8d13('0x32'))){_0x3402dc[_0x8d13('0x17')]=qs[_0x8d13('0x17')](_0x20514a['query'][_0x8d13('0x17')]);_0x3402dc[_0x8d13('0x15')]=qs[_0x8d13('0x15')](_0x20514a[_0x8d13('0x2a')][_0x8d13('0x15')]);}return _0x527d55[_0x8d13('0x43')](_0x3402dc);}})['then'](function(_0x5c06a1){if(_0x5c06a1){return _0x5c06a1?{'count':_0x4b01e9,'rows':_0x5c06a1}:null;}})['then'](respondWithResult(_0x22e6f3,null))[_0x8d13('0x3c')](handleError(_0x22e6f3,null));};exports['addConfiguration']=function(_0x39e59c,_0x3d446b,_0x25b5b4){if(_0x39e59c[_0x8d13('0x40')]['id']){delete _0x39e59c['body']['id'];}return db[_0x8d13('0x24')][_0x8d13('0x44')]({'where':{'id':_0x39e59c['params']['id']}})[_0x8d13('0x1e')](handleEntityNotFound(_0x3d446b,null))[_0x8d13('0x1e')](function(_0xfc6856){if(_0xfc6856){_0x39e59c[_0x8d13('0x40')][_0x8d13('0x46')]=_0xfc6856['id'];_0x39e59c[_0x8d13('0x40')]['Subjects']=integrations[_0x8d13('0x47')](_0x39e59c[_0x8d13('0x40')][_0x8d13('0x48')],_0x39e59c['body'][_0x8d13('0x27')]);_0x39e59c['body']['Descriptions']=integrations[_0x8d13('0x49')](_0x39e59c[_0x8d13('0x40')][_0x8d13('0x48')],_0x39e59c['body'][_0x8d13('0x27')]);return db['FreshdeskConfiguration'][_0x8d13('0x3f')](_0x39e59c[_0x8d13('0x40')],{'include':[{'model':db['FreshdeskField'],'as':_0x8d13('0x4a')},{'model':db[_0x8d13('0x4b')],'as':_0x8d13('0x4c')}]});}return null;})[_0x8d13('0x1e')](respondWithResult(_0x3d446b,null))[_0x8d13('0x3c')](handleError(_0x3d446b,null));};exports[_0x8d13('0x4d')]=function(_0xc93f82,_0x17ab99,_0x16fbe2){var _0x4bf4c6='';return db[_0x8d13('0x24')][_0x8d13('0x44')]({'where':{'id':_0xc93f82[_0x8d13('0x42')]['id']},'attributes':['id',_0x8d13('0x4e'),_0x8d13('0x4f')]})[_0x8d13('0x1e')](handleEntityNotFound(_0x17ab99,null))[_0x8d13('0x1e')](function(_0x3b58eb){if(_0x3b58eb){_0x4bf4c6=_0x3b58eb[_0x8d13('0x4e')];var _0x9266a6=_0x4bf4c6[_0x8d13('0x50')](-0x1);if(_0x9266a6==='/'){_0x4bf4c6=_0x4bf4c6[_0x8d13('0x51')](0x0,_0x4bf4c6[_0x8d13('0x52')](_0x9266a6));}return rp({'method':_0x8d13('0x53'),'uri':util[_0x8d13('0x54')](_0x8d13('0x55'),_0x4bf4c6,_0x8d13('0x56')),'headers':{'Authorization':util[_0x8d13('0x54')]('Basic\x20%s',new Buffer(util[_0x8d13('0x54')]('%s:X',_0x3b58eb['apiKey']))['toString'](_0x8d13('0x57')))},'json':!![]});}})[_0x8d13('0x1e')](function(_0x42440c){if(_0x42440c){var _0x5c8df0=[_0x8d13('0x58'),_0x8d13('0x59'),_0x8d13('0x5a'),_0x8d13('0x5b'),_0x8d13('0x13'),_0x8d13('0x5c'),_0x8d13('0x5d'),'source','ticket_type','group',_0x8d13('0x5e')];_[_0x8d13('0x5f')](_0x42440c,function(_0x9b1803){return _0x5c8df0[_0x8d13('0x60')](_0x9b1803[_0x8d13('0x22')])||!_0x9b1803[_0x8d13('0x61')]&&_0x9b1803['type']!==_0x8d13('0x62')&&_0x9b1803['type']!==_0x8d13('0x63');});return{'count':_0x42440c['length'],'rows':_[_0x8d13('0x23')](_0x42440c,function(_0x58a068){return{'id':_0x58a068['name'],'name':_0x58a068[_0x8d13('0x64')],'custom':!_0x58a068[_0x8d13('0x61')],'options':_0x58a068[_0x8d13('0x65')]?_[_0x8d13('0x23')](_0x58a068['choices'],function(_0x521749){return{'name':_['capitalize'](_0x521749),'value':_0x521749};}):[]};})};}})[_0x8d13('0x1e')](respondWithResult(_0x17ab99,null))['catch'](function(_0x543f58){var _0x373bff=_0xc93f82[_0x8d13('0x2a')]['test']?0x1f4:_0x543f58['statusCode']||0x1f4;logger[_0x8d13('0x20')](_0x8d13('0x66'),_0x8d13('0x4d'),_0x373bff,JSON[_0x8d13('0x67')](_0x543f58));delete _0x543f58[_0x8d13('0x22')];if(_0x373bff===0x191){_0x373bff=0x190;}_0x17ab99[_0x8d13('0x13')](_0x373bff)[_0x8d13('0x68')](_0xc93f82['query']['test']?{'message':_0x8d13('0x69'),'statusCode':_0x543f58['statusCode']}:_0x543f58);});}; \ No newline at end of file +var _0xcff8=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','rows','catch','show','params','intersection','find','body','findOne','FreshdeskConfiguration','keys','sort','getConfigurations','getSubjects','Descriptions','channel','create','FreshdeskField','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','source','ticket_type','group','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x515232,_0x3de920){var _0x45685c=function(_0x25bae8){while(--_0x25bae8){_0x515232['push'](_0x515232['shift']());}};_0x45685c(++_0x3de920);}(_0xcff8,0x14b));var _0x8cff=function(_0x4e4e88,_0x5d70ff){_0x4e4e88=_0x4e4e88-0x0;var _0x4a93ae=_0xcff8[_0x4e4e88];return _0x4a93ae;};'use strict';var emlformat=require(_0x8cff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8cff('0x1'));var jsonpatch=require(_0x8cff('0x2'));var rp=require('request-promise');var moment=require(_0x8cff('0x3'));var BPromise=require(_0x8cff('0x4'));var Mustache=require(_0x8cff('0x5'));var util=require(_0x8cff('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(_0x8cff('0x7'));var _=require(_0x8cff('0x8'));var squel=require(_0x8cff('0x9'));var crypto=require(_0x8cff('0xa'));var jsforce=require(_0x8cff('0xb'));var deskjs=require(_0x8cff('0xc'));var toCsv=require(_0x8cff('0xd'));var querystring=require('querystring');var Papa=require(_0x8cff('0xe'));var Redis=require(_0x8cff('0xf'));var authService=require(_0x8cff('0x10'));var qs=require(_0x8cff('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cff('0x12'));var logger=require(_0x8cff('0x13'))(_0x8cff('0x14'));var utils=require(_0x8cff('0x15'));var config=require(_0x8cff('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8cff('0x17'))['db'];var integrations=require(_0x8cff('0x18'));function respondWithStatusCode(_0x20acb7,_0x3e642b){_0x3e642b=_0x3e642b||0xcc;return function(_0x313373){if(_0x313373){return _0x20acb7['sendStatus'](_0x3e642b);}return _0x20acb7[_0x8cff('0x19')](_0x3e642b)['end']();};}function respondWithResult(_0x4b3faf,_0x1d8c09){_0x1d8c09=_0x1d8c09||0xc8;return function(_0x40b492){if(_0x40b492){return _0x4b3faf[_0x8cff('0x19')](_0x1d8c09)[_0x8cff('0x1a')](_0x40b492);}};}function respondWithFilteredResult(_0x26d516,_0xac398f){return function(_0x31214d){if(_0x31214d){var _0xd3cbe9=typeof _0xac398f[_0x8cff('0x1b')]===_0x8cff('0x1c')&&typeof _0xac398f[_0x8cff('0x1d')]===_0x8cff('0x1c');var _0x2db2dd=_0x31214d['count'];var _0x3d07a8=_0xd3cbe9?0x0:_0xac398f['offset'];var _0x585d1d=_0xd3cbe9?_0x31214d['count']:_0xac398f[_0x8cff('0x1b')]+_0xac398f['limit'];var _0x109742;if(_0x585d1d>=_0x2db2dd){_0x585d1d=_0x2db2dd;_0x109742=0xc8;}else{_0x109742=0xce;}_0x26d516[_0x8cff('0x19')](_0x109742);return _0x26d516[_0x8cff('0x1e')](_0x8cff('0x1f'),_0x3d07a8+'-'+_0x585d1d+'/'+_0x2db2dd)['json'](_0x31214d);}return null;};}function patchUpdates(_0x2ab819){return function(_0x448538){try{jsonpatch[_0x8cff('0x20')](_0x448538,_0x2ab819,!![]);}catch(_0x38cfe1){return BPromise[_0x8cff('0x21')](_0x38cfe1);}return _0x448538[_0x8cff('0x22')]();};}function saveUpdates(_0x2d4770,_0x53a9af){return function(_0x3a3321){if(_0x3a3321){return _0x3a3321[_0x8cff('0x23')](_0x2d4770)['then'](function(_0x4e171c){return _0x4e171c;});}return null;};}function removeEntity(_0x4b211e,_0x1d4c93){return function(_0x354c3b){if(_0x354c3b){return _0x354c3b[_0x8cff('0x24')]()[_0x8cff('0x25')](function(){_0x4b211e[_0x8cff('0x19')](0xcc)[_0x8cff('0x26')]();});}};}function handleEntityNotFound(_0xb46b17,_0x149fe5){return function(_0x47c166){if(!_0x47c166){_0xb46b17[_0x8cff('0x27')](0x194);}return _0x47c166;};}function handleError(_0x55f03b,_0xf47d91){_0xf47d91=_0xf47d91||0x1f4;return function(_0x42407f){logger[_0x8cff('0x28')](_0x42407f[_0x8cff('0x29')]);if(_0x42407f[_0x8cff('0x2a')]){delete _0x42407f[_0x8cff('0x2a')];}_0x55f03b[_0x8cff('0x19')](_0xf47d91)[_0x8cff('0x2b')](_0x42407f);};}exports[_0x8cff('0x2c')]=function(_0x1fcb15,_0x1852b2){var _0x60244d={},_0x5248d2={},_0x541a9c={'count':0x0,'rows':[]};var _0x41ea22=_[_0x8cff('0x2d')](db[_0x8cff('0x2e')][_0x8cff('0x2f')],function(_0x59f74b){return{'name':_0x59f74b[_0x8cff('0x30')],'type':_0x59f74b['type'][_0x8cff('0x31')]};});_0x5248d2['model']=_[_0x8cff('0x2d')](_0x41ea22,'name');_0x5248d2[_0x8cff('0x32')]=_['keys'](_0x1fcb15['query']);_0x5248d2[_0x8cff('0x33')]=_['intersection'](_0x5248d2[_0x8cff('0x34')],_0x5248d2['query']);_0x60244d[_0x8cff('0x35')]=_['intersection'](_0x5248d2['model'],qs[_0x8cff('0x36')](_0x1fcb15[_0x8cff('0x32')][_0x8cff('0x36')]));_0x60244d[_0x8cff('0x35')]=_0x60244d[_0x8cff('0x35')][_0x8cff('0x37')]?_0x60244d[_0x8cff('0x35')]:_0x5248d2[_0x8cff('0x34')];if(!_0x1fcb15[_0x8cff('0x32')][_0x8cff('0x38')](_0x8cff('0x39'))){_0x60244d['limit']=qs[_0x8cff('0x1d')](_0x1fcb15[_0x8cff('0x32')]['limit']);_0x60244d[_0x8cff('0x1b')]=qs[_0x8cff('0x1b')](_0x1fcb15[_0x8cff('0x32')][_0x8cff('0x1b')]);}_0x60244d[_0x8cff('0x3a')]=qs['sort'](_0x1fcb15[_0x8cff('0x32')]['sort']);_0x60244d[_0x8cff('0x3b')]=qs[_0x8cff('0x33')](_[_0x8cff('0x3c')](_0x1fcb15[_0x8cff('0x32')],_0x5248d2['filters']),_0x41ea22);if(_0x1fcb15[_0x8cff('0x32')]['filter']){_0x60244d[_0x8cff('0x3b')]=_[_0x8cff('0x3d')](_0x60244d[_0x8cff('0x3b')],{'$or':_[_0x8cff('0x2d')](_0x41ea22,function(_0x29b61d){if(_0x29b61d[_0x8cff('0x3e')]!==_0x8cff('0x3f')){var _0x5c28a3={};_0x5c28a3[_0x29b61d[_0x8cff('0x2a')]]={'$like':'%'+_0x1fcb15['query'][_0x8cff('0x40')]+'%'};return _0x5c28a3;}})});}_0x60244d=_[_0x8cff('0x3d')]({},_0x60244d,_0x1fcb15[_0x8cff('0x41')]);var _0x23d55d={'where':_0x60244d['where']};return db[_0x8cff('0x2e')][_0x8cff('0x42')](_0x23d55d)[_0x8cff('0x25')](function(_0xe2525c){_0x541a9c['count']=_0xe2525c;if(_0x1fcb15[_0x8cff('0x32')][_0x8cff('0x43')]){_0x60244d['include']=[{'all':!![]}];}return db[_0x8cff('0x2e')]['findAll'](_0x60244d);})['then'](function(_0x39849a){_0x541a9c[_0x8cff('0x44')]=_0x39849a;return _0x541a9c;})[_0x8cff('0x25')](respondWithFilteredResult(_0x1852b2,_0x60244d))[_0x8cff('0x45')](handleError(_0x1852b2,null));};exports[_0x8cff('0x46')]=function(_0x571646,_0x403d83){var _0x3c72eb={'raw':![],'where':{'id':_0x571646[_0x8cff('0x47')]['id']}},_0x132ece={};_0x132ece[_0x8cff('0x34')]=_['keys'](db['FreshdeskAccount'][_0x8cff('0x2f')]);_0x132ece['query']=_['keys'](_0x571646[_0x8cff('0x32')]);_0x132ece['filters']=_[_0x8cff('0x48')](_0x132ece[_0x8cff('0x34')],_0x132ece[_0x8cff('0x32')]);_0x3c72eb[_0x8cff('0x35')]=_[_0x8cff('0x48')](_0x132ece['model'],qs[_0x8cff('0x36')](_0x571646['query'][_0x8cff('0x36')]));_0x3c72eb[_0x8cff('0x35')]=_0x3c72eb[_0x8cff('0x35')]['length']?_0x3c72eb[_0x8cff('0x35')]:_0x132ece[_0x8cff('0x34')];if(_0x571646['query'][_0x8cff('0x43')]){_0x3c72eb['include']=[{'all':!![]}];}_0x3c72eb=_['merge']({},_0x3c72eb,_0x571646[_0x8cff('0x41')]);return db['FreshdeskAccount'][_0x8cff('0x49')](_0x3c72eb)[_0x8cff('0x25')](handleEntityNotFound(_0x403d83,null))['then'](respondWithResult(_0x403d83,null))[_0x8cff('0x45')](handleError(_0x403d83,null));};exports['create']=function(_0x45ec06,_0x4f7bc4){return db['FreshdeskAccount']['create'](_0x45ec06[_0x8cff('0x4a')],{})[_0x8cff('0x25')](respondWithResult(_0x4f7bc4,0xc9))[_0x8cff('0x45')](handleError(_0x4f7bc4,null));};exports[_0x8cff('0x23')]=function(_0x3501c5,_0x5d1f9d){if(_0x3501c5[_0x8cff('0x4a')]['id']){delete _0x3501c5[_0x8cff('0x4a')]['id'];}return db[_0x8cff('0x2e')][_0x8cff('0x49')]({'where':{'id':_0x3501c5['params']['id']}})[_0x8cff('0x25')](handleEntityNotFound(_0x5d1f9d,null))['then'](saveUpdates(_0x3501c5[_0x8cff('0x4a')],null))[_0x8cff('0x25')](respondWithResult(_0x5d1f9d,null))['catch'](handleError(_0x5d1f9d,null));};exports[_0x8cff('0x24')]=function(_0x27efda,_0x5c5d){return db['FreshdeskAccount'][_0x8cff('0x49')]({'where':{'id':_0x27efda['params']['id']}})[_0x8cff('0x25')](handleEntityNotFound(_0x5c5d,null))[_0x8cff('0x25')](removeEntity(_0x5c5d,null))['catch'](handleError(_0x5c5d,null));};exports['getConfigurations']=function(_0x57534f,_0x4ddaba,_0x5466b3){var _0x546d0a={};var _0x934063={};var _0x2b0db3;var _0x5a43bd;return db[_0x8cff('0x2e')][_0x8cff('0x4b')]({'where':{'id':_0x57534f[_0x8cff('0x47')]['id']}})[_0x8cff('0x25')](handleEntityNotFound(_0x4ddaba,null))[_0x8cff('0x25')](function(_0x2e77a3){if(_0x2e77a3){_0x2b0db3=_0x2e77a3;_0x934063['model']=_['keys'](db[_0x8cff('0x4c')][_0x8cff('0x2f')]);_0x934063[_0x8cff('0x32')]=_[_0x8cff('0x4d')](_0x57534f[_0x8cff('0x32')]);_0x934063[_0x8cff('0x33')]=_[_0x8cff('0x48')](_0x934063['model'],_0x934063[_0x8cff('0x32')]);_0x546d0a[_0x8cff('0x35')]=_[_0x8cff('0x48')](_0x934063[_0x8cff('0x34')],qs['fields'](_0x57534f[_0x8cff('0x32')][_0x8cff('0x36')]));_0x546d0a[_0x8cff('0x35')]=_0x546d0a[_0x8cff('0x35')][_0x8cff('0x37')]?_0x546d0a[_0x8cff('0x35')]:_0x934063[_0x8cff('0x34')];_0x546d0a['order']=qs[_0x8cff('0x4e')](_0x57534f['query'][_0x8cff('0x4e')]);_0x546d0a['where']=qs[_0x8cff('0x33')](_['pick'](_0x57534f[_0x8cff('0x32')],_0x934063[_0x8cff('0x33')]));if(_0x57534f[_0x8cff('0x32')][_0x8cff('0x40')]){_0x546d0a[_0x8cff('0x3b')]=_['merge'](_0x546d0a[_0x8cff('0x3b')],{'$or':_[_0x8cff('0x2d')](_0x546d0a[_0x8cff('0x35')],function(_0x1b7e2f){var _0x5a70c1={};_0x5a70c1[_0x1b7e2f]={'$like':'%'+_0x57534f[_0x8cff('0x32')][_0x8cff('0x40')]+'%'};return _0x5a70c1;})});}_0x546d0a=_[_0x8cff('0x3d')]({},_0x546d0a,_0x57534f[_0x8cff('0x41')]);return _0x2b0db3[_0x8cff('0x4f')](_0x546d0a);}})['then'](function(_0x59275a){if(_0x59275a){_0x5a43bd=_0x59275a[_0x8cff('0x37')];if(!_0x57534f[_0x8cff('0x32')][_0x8cff('0x38')](_0x8cff('0x39'))){_0x546d0a[_0x8cff('0x1d')]=qs[_0x8cff('0x1d')](_0x57534f['query'][_0x8cff('0x1d')]);_0x546d0a[_0x8cff('0x1b')]=qs['offset'](_0x57534f['query'][_0x8cff('0x1b')]);}return _0x2b0db3[_0x8cff('0x4f')](_0x546d0a);}})[_0x8cff('0x25')](function(_0x295780){if(_0x295780){return _0x295780?{'count':_0x5a43bd,'rows':_0x295780}:null;}})[_0x8cff('0x25')](respondWithResult(_0x4ddaba,null))[_0x8cff('0x45')](handleError(_0x4ddaba,null));};exports['addConfiguration']=function(_0x505907,_0x2585cd,_0xc0d284){if(_0x505907[_0x8cff('0x4a')]['id']){delete _0x505907['body']['id'];}return db[_0x8cff('0x2e')][_0x8cff('0x4b')]({'where':{'id':_0x505907['params']['id']}})['then'](handleEntityNotFound(_0x2585cd,null))[_0x8cff('0x25')](function(_0x26acd3){if(_0x26acd3){_0x505907['body']['AccountId']=_0x26acd3['id'];_0x505907[_0x8cff('0x4a')]['Subjects']=integrations[_0x8cff('0x50')](_0x505907['body']['channel'],_0x505907[_0x8cff('0x4a')]['type']);_0x505907[_0x8cff('0x4a')][_0x8cff('0x51')]=integrations['getDescriptions'](_0x505907[_0x8cff('0x4a')][_0x8cff('0x52')],_0x505907[_0x8cff('0x4a')][_0x8cff('0x3e')]);return db[_0x8cff('0x4c')][_0x8cff('0x53')](_0x505907[_0x8cff('0x4a')],{'include':[{'model':db[_0x8cff('0x54')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0x8cff('0x51')}]});}return null;})['then'](respondWithResult(_0x2585cd,null))['catch'](handleError(_0x2585cd,null));};exports[_0x8cff('0x55')]=function(_0x233cd8,_0x37bc92,_0x1a00c1){var _0x385ea0='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x233cd8[_0x8cff('0x47')]['id']},'attributes':['id',_0x8cff('0x56'),_0x8cff('0x57')]})[_0x8cff('0x25')](handleEntityNotFound(_0x37bc92,null))[_0x8cff('0x25')](function(_0x20d92c){if(_0x20d92c){_0x385ea0=_0x20d92c['remoteUri'];var _0x2815b8=_0x385ea0['slice'](-0x1);if(_0x2815b8==='/'){_0x385ea0=_0x385ea0[_0x8cff('0x58')](0x0,_0x385ea0[_0x8cff('0x59')](_0x2815b8));}return rp({'method':_0x8cff('0x5a'),'uri':util[_0x8cff('0x5b')]('%s/%s',_0x385ea0,_0x8cff('0x5c')),'headers':{'Authorization':util[_0x8cff('0x5b')](_0x8cff('0x5d'),new Buffer(util[_0x8cff('0x5b')](_0x8cff('0x5e'),_0x20d92c[_0x8cff('0x57')]))[_0x8cff('0x5f')](_0x8cff('0x60')))},'json':!![]});}})['then'](function(_0x33a62f){if(_0x33a62f){var _0x194544=[_0x8cff('0x61'),_0x8cff('0x62'),_0x8cff('0x63'),'description',_0x8cff('0x19'),_0x8cff('0x64'),'group',_0x8cff('0x65'),_0x8cff('0x66'),_0x8cff('0x67'),'company'];_[_0x8cff('0x68')](_0x33a62f,function(_0x51c868){return _0x194544[_0x8cff('0x69')](_0x51c868[_0x8cff('0x2a')])||!_0x51c868[_0x8cff('0x6a')]&&_0x51c868['type']!==_0x8cff('0x6b')&&_0x51c868['type']!==_0x8cff('0x6c');});return{'count':_0x33a62f[_0x8cff('0x37')],'rows':_[_0x8cff('0x2d')](_0x33a62f,function(_0x14d0cc){return{'id':_0x14d0cc['name'],'name':_0x14d0cc['label'],'custom':!_0x14d0cc['default'],'options':_0x14d0cc[_0x8cff('0x6d')]?_[_0x8cff('0x2d')](_0x14d0cc[_0x8cff('0x6d')],function(_0x95c58e){return{'name':_[_0x8cff('0x6e')](_0x95c58e),'value':_0x95c58e};}):[]};})};}})[_0x8cff('0x25')](respondWithResult(_0x37bc92,null))[_0x8cff('0x45')](function(_0x3a4e58){var _0x55efc1=_0x233cd8[_0x8cff('0x32')][_0x8cff('0x6f')]?0x1f4:_0x3a4e58[_0x8cff('0x70')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8cff('0x55'),_0x55efc1,JSON[_0x8cff('0x71')](_0x3a4e58));delete _0x3a4e58['name'];if(_0x55efc1===0x191){_0x55efc1=0x190;}_0x37bc92['status'](_0x55efc1)[_0x8cff('0x2b')](_0x233cd8[_0x8cff('0x32')][_0x8cff('0x6f')]?{'message':_0x8cff('0x72'),'statusCode':_0x3a4e58['statusCode']}:_0x3a4e58);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 621b3ea..68fa9f7 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 _0xe5cc=['api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x71cd05,_0x36ac11){var _0x59c9e7=function(_0x5472cd){while(--_0x5472cd){_0x71cd05['push'](_0x71cd05['shift']());}};_0x59c9e7(++_0x36ac11);}(_0xe5cc,0x1e7));var _0xce5c=function(_0x59db19,_0x30c1c6){_0x59db19=_0x59db19-0x0;var _0x5f0f09=_0xe5cc[_0x59db19];return _0x5f0f09;};'use strict';var _=require(_0xce5c('0x0'));var util=require(_0xce5c('0x1'));var logger=require(_0xce5c('0x2'))(_0xce5c('0x3'));var moment=require(_0xce5c('0x4'));var BPromise=require(_0xce5c('0x5'));var rp=require(_0xce5c('0x6'));var fs=require('fs');var path=require(_0xce5c('0x7'));var rimraf=require(_0xce5c('0x8'));var config=require('../../config/environment');var attributes=require(_0xce5c('0x9'));var integrations=require(_0xce5c('0xa'));module['exports']=function(_0x115d35,_0x436c8f){return _0x115d35[_0xce5c('0xb')](_0xce5c('0xc'),attributes,{'tableName':_0xce5c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb174=['rimraf','../../components/integrations/configuration','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','bluebird','request-promise','path'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xb174,0x109));var _0x4b17=function(_0x34420e,_0x5304a9){_0x34420e=_0x34420e-0x0;var _0x19d680=_0xb174[_0x34420e];return _0x19d680;};'use strict';var _=require('lodash');var util=require(_0x4b17('0x0'));var logger=require(_0x4b17('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4b17('0x2'));var rp=require(_0x4b17('0x3'));var fs=require('fs');var path=require(_0x4b17('0x4'));var rimraf=require(_0x4b17('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x4b17('0x6'));module['exports']=function(_0x1482df,_0x3d5581){return _0x1482df['define'](_0x4b17('0x7'),attributes,{'tableName':_0x4b17('0x8'),'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 b6056ab..a795da1 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 _0x7b78=['../../config/environment','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','map','include','model','attributes','ShowFreshdeskAccount','find','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x12b7f9,_0x3c8834){var _0x1d6967=function(_0x4bafcf){while(--_0x4bafcf){_0x12b7f9['push'](_0x12b7f9['shift']());}};_0x1d6967(++_0x3c8834);}(_0x7b78,0x185));var _0x87b7=function(_0x5d8717,_0x4f42d2){_0x5d8717=_0x5d8717-0x0;var _0x326d85=_0x7b78[_0x5d8717];return _0x326d85;};'use strict';var _=require(_0x87b7('0x0'));var util=require(_0x87b7('0x1'));var moment=require(_0x87b7('0x2'));var BPromise=require('bluebird');var rs=require(_0x87b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x87b7('0x5'))(_0x87b7('0x6'));var config=require(_0x87b7('0x7'));var jayson=require(_0x87b7('0x8'));var client=jayson[_0x87b7('0x9')][_0x87b7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x189a97,_0x5070aa,_0x168601){return new BPromise(function(_0x4eec61,_0x212b31){return client['request'](_0x189a97,_0x168601)[_0x87b7('0xb')](function(_0x5e7485){logger[_0x87b7('0xc')](_0x87b7('0xd'),_0x5070aa,'request\x20sent');logger[_0x87b7('0xe')](_0x87b7('0xf'),_0x5070aa,_0x87b7('0x10'),JSON[_0x87b7('0x11')](_0x5e7485));if(_0x5e7485['error']){if(_0x5e7485['error'][_0x87b7('0x12')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x5070aa,_0x5e7485[_0x87b7('0x13')][_0x87b7('0x14')]);return _0x212b31(_0x5e7485[_0x87b7('0x13')][_0x87b7('0x14')]);}logger[_0x87b7('0x13')](_0x87b7('0xd'),_0x5070aa,_0x5e7485[_0x87b7('0x13')]['message']);return _0x4eec61(_0x5e7485['error'][_0x87b7('0x14')]);}else{logger[_0x87b7('0xc')](_0x87b7('0xd'),_0x5070aa,'request\x20sent');_0x4eec61(_0x5e7485[_0x87b7('0x15')]['message']);}})['catch'](function(_0x53cc53){logger[_0x87b7('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x5070aa,_0x53cc53);_0x212b31(_0x53cc53);});});}exports[_0x87b7('0x16')]=function(_0x346d6d){var _0x49b2f0=this;return new Promise(function(_0x16e41b,_0x5dd088){return db[_0x87b7('0x17')][_0x87b7('0x18')]({'raw':_0x346d6d[_0x87b7('0x19')]?_0x346d6d[_0x87b7('0x19')][_0x87b7('0x1a')]===undefined?!![]:![]:!![],'where':_0x346d6d['options']?_0x346d6d['options'][_0x87b7('0x1b')]||null:null,'attributes':_0x346d6d['options']?_0x346d6d[_0x87b7('0x19')]['attributes']||null:null,'limit':_0x346d6d['options']?_0x346d6d[_0x87b7('0x19')][_0x87b7('0x1c')]||null:null,'include':_0x346d6d[_0x87b7('0x19')]?_0x346d6d[_0x87b7('0x19')]['include']?_[_0x87b7('0x1d')](_0x346d6d[_0x87b7('0x19')][_0x87b7('0x1e')],function(_0x47c4ad){return{'model':db[_0x47c4ad[_0x87b7('0x1f')]],'as':_0x47c4ad['as'],'attributes':_0x47c4ad[_0x87b7('0x20')],'include':_0x47c4ad[_0x87b7('0x1e')]?_[_0x87b7('0x1d')](_0x47c4ad['include'],function(_0x253650){return{'model':db[_0x253650[_0x87b7('0x1f')]],'as':_0x253650['as'],'attributes':_0x253650[_0x87b7('0x20')],'include':_0x253650[_0x87b7('0x1e')]?_[_0x87b7('0x1d')](_0x253650[_0x87b7('0x1e')],function(_0x2fd2e5){return{'model':db[_0x2fd2e5[_0x87b7('0x1f')]],'as':_0x2fd2e5['as'],'attributes':_0x2fd2e5[_0x87b7('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5dd2bd){logger['info'](_0x87b7('0x16'),_0x346d6d);logger[_0x87b7('0xe')]('GetFreshdeskAccount',_0x346d6d,JSON[_0x87b7('0x11')](_0x5dd2bd));_0x16e41b(_0x5dd2bd);})['catch'](function(_0x2488c9){logger['error'](_0x87b7('0x16'),_0x2488c9[_0x87b7('0x14')],_0x346d6d);_0x5dd088(_0x49b2f0[_0x87b7('0x13')](0x1f4,_0x2488c9[_0x87b7('0x14')]));});});};exports[_0x87b7('0x21')]=function(_0x536fc5){var _0x597d90=this;return new Promise(function(_0x1804ea,_0x54bc77){return db[_0x87b7('0x17')][_0x87b7('0x22')]({'raw':_0x536fc5[_0x87b7('0x19')]?_0x536fc5[_0x87b7('0x19')][_0x87b7('0x1a')]===undefined?!![]:![]:!![],'where':_0x536fc5[_0x87b7('0x19')]?_0x536fc5[_0x87b7('0x19')]['where']||null:null,'attributes':_0x536fc5[_0x87b7('0x19')]?_0x536fc5[_0x87b7('0x19')][_0x87b7('0x20')]||null:null,'include':_0x536fc5[_0x87b7('0x19')]?_0x536fc5[_0x87b7('0x19')][_0x87b7('0x1e')]?_[_0x87b7('0x1d')](_0x536fc5[_0x87b7('0x19')][_0x87b7('0x1e')],function(_0x2e6a20){return{'model':db[_0x2e6a20['model']],'as':_0x2e6a20['as'],'attributes':_0x2e6a20[_0x87b7('0x20')],'include':_0x2e6a20[_0x87b7('0x1e')]?_[_0x87b7('0x1d')](_0x2e6a20[_0x87b7('0x1e')],function(_0x2d4f0d){return{'model':db[_0x2d4f0d[_0x87b7('0x1f')]],'as':_0x2d4f0d['as'],'attributes':_0x2d4f0d[_0x87b7('0x20')],'include':_0x2d4f0d['include']?_['map'](_0x2d4f0d[_0x87b7('0x1e')],function(_0x4d26e7){return{'model':db[_0x4d26e7['model']],'as':_0x4d26e7['as'],'attributes':_0x4d26e7[_0x87b7('0x20')]};}):[]};}):[]};}):[]:[]})[_0x87b7('0xb')](function(_0x22883c){logger['info'](_0x87b7('0x21'),_0x536fc5);logger[_0x87b7('0xe')](_0x87b7('0x21'),_0x536fc5,JSON[_0x87b7('0x11')](_0x22883c));_0x1804ea(_0x22883c);})[_0x87b7('0x23')](function(_0x71f88e){logger[_0x87b7('0x13')](_0x87b7('0x21'),_0x71f88e[_0x87b7('0x14')],_0x536fc5);_0x54bc77(_0x597d90[_0x87b7('0x13')](0x1f4,_0x71f88e[_0x87b7('0x14')]));});});}; \ No newline at end of file +var _0xa7ac=['../../config/environment','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x377f25,_0x2565d2){var _0x4d70f7=function(_0x5c9023){while(--_0x5c9023){_0x377f25['push'](_0x377f25['shift']());}};_0x4d70f7(++_0x2565d2);}(_0xa7ac,0x14e));var _0xca7a=function(_0x47b6db,_0x73e3fc){_0x47b6db=_0x47b6db-0x0;var _0x1b3b93=_0xa7ac[_0x47b6db];return _0x1b3b93;};'use strict';var _=require('lodash');var util=require(_0xca7a('0x0'));var moment=require('moment');var BPromise=require(_0xca7a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca7a('0x2'));var db=require(_0xca7a('0x3'))['db'];var utils=require(_0xca7a('0x4'));var logger=require(_0xca7a('0x5'))(_0xca7a('0x6'));var config=require(_0xca7a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xca7a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c19cf,_0x2115de,_0x5386c0){return new BPromise(function(_0x1ce1b8,_0xa55113){return client[_0xca7a('0x9')](_0x4c19cf,_0x5386c0)[_0xca7a('0xa')](function(_0x58aa59){logger[_0xca7a('0xb')](_0xca7a('0xc'),_0x2115de,_0xca7a('0xd'));logger[_0xca7a('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2115de,_0xca7a('0xd'),JSON[_0xca7a('0xf')](_0x58aa59));if(_0x58aa59['error']){if(_0x58aa59[_0xca7a('0x10')][_0xca7a('0x11')]===0x1f4){logger[_0xca7a('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x2115de,_0x58aa59[_0xca7a('0x10')][_0xca7a('0x12')]);return _0xa55113(_0x58aa59['error']['message']);}logger[_0xca7a('0x10')](_0xca7a('0xc'),_0x2115de,_0x58aa59[_0xca7a('0x10')][_0xca7a('0x12')]);return _0x1ce1b8(_0x58aa59[_0xca7a('0x10')][_0xca7a('0x12')]);}else{logger[_0xca7a('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x2115de,'request\x20sent');_0x1ce1b8(_0x58aa59['result'][_0xca7a('0x12')]);}})[_0xca7a('0x13')](function(_0x2a92f6){logger[_0xca7a('0x10')](_0xca7a('0xc'),_0x2115de,_0x2a92f6);_0xa55113(_0x2a92f6);});});}exports[_0xca7a('0x14')]=function(_0xbbec7a){var _0x30d8d9=this;return new Promise(function(_0xa53d73,_0x575d5a){return db['FreshdeskAccount'][_0xca7a('0x15')]({'raw':_0xbbec7a['options']?_0xbbec7a[_0xca7a('0x16')][_0xca7a('0x17')]===undefined?!![]:![]:!![],'where':_0xbbec7a[_0xca7a('0x16')]?_0xbbec7a[_0xca7a('0x16')][_0xca7a('0x18')]||null:null,'attributes':_0xbbec7a[_0xca7a('0x16')]?_0xbbec7a['options'][_0xca7a('0x19')]||null:null,'limit':_0xbbec7a[_0xca7a('0x16')]?_0xbbec7a[_0xca7a('0x16')][_0xca7a('0x1a')]||null:null,'include':_0xbbec7a[_0xca7a('0x16')]?_0xbbec7a[_0xca7a('0x16')][_0xca7a('0x1b')]?_[_0xca7a('0x1c')](_0xbbec7a[_0xca7a('0x16')][_0xca7a('0x1b')],function(_0x2f0f33){return{'model':db[_0x2f0f33[_0xca7a('0x1d')]],'as':_0x2f0f33['as'],'attributes':_0x2f0f33[_0xca7a('0x19')],'include':_0x2f0f33[_0xca7a('0x1b')]?_[_0xca7a('0x1c')](_0x2f0f33[_0xca7a('0x1b')],function(_0x1ce7ec){return{'model':db[_0x1ce7ec[_0xca7a('0x1d')]],'as':_0x1ce7ec['as'],'attributes':_0x1ce7ec[_0xca7a('0x19')],'include':_0x1ce7ec[_0xca7a('0x1b')]?_[_0xca7a('0x1c')](_0x1ce7ec[_0xca7a('0x1b')],function(_0x5118f8){return{'model':db[_0x5118f8['model']],'as':_0x5118f8['as'],'attributes':_0x5118f8['attributes']};}):[]};}):[]};}):[]:[]})[_0xca7a('0xa')](function(_0x38daad){logger[_0xca7a('0xb')](_0xca7a('0x14'),_0xbbec7a);logger[_0xca7a('0xe')](_0xca7a('0x14'),_0xbbec7a,JSON['stringify'](_0x38daad));_0xa53d73(_0x38daad);})[_0xca7a('0x13')](function(_0x351f3b){logger['error']('GetFreshdeskAccount',_0x351f3b['message'],_0xbbec7a);_0x575d5a(_0x30d8d9[_0xca7a('0x10')](0x1f4,_0x351f3b['message']));});});};exports['ShowFreshdeskAccount']=function(_0x3ac3ed){var _0x241315=this;return new Promise(function(_0x7fb3b0,_0x209863){return db['FreshdeskAccount']['find']({'raw':_0x3ac3ed[_0xca7a('0x16')]?_0x3ac3ed[_0xca7a('0x16')][_0xca7a('0x17')]===undefined?!![]:![]:!![],'where':_0x3ac3ed['options']?_0x3ac3ed[_0xca7a('0x16')][_0xca7a('0x18')]||null:null,'attributes':_0x3ac3ed['options']?_0x3ac3ed[_0xca7a('0x16')][_0xca7a('0x19')]||null:null,'include':_0x3ac3ed[_0xca7a('0x16')]?_0x3ac3ed[_0xca7a('0x16')][_0xca7a('0x1b')]?_[_0xca7a('0x1c')](_0x3ac3ed[_0xca7a('0x16')]['include'],function(_0x2cd7f8){return{'model':db[_0x2cd7f8[_0xca7a('0x1d')]],'as':_0x2cd7f8['as'],'attributes':_0x2cd7f8[_0xca7a('0x19')],'include':_0x2cd7f8['include']?_[_0xca7a('0x1c')](_0x2cd7f8[_0xca7a('0x1b')],function(_0x16ebb9){return{'model':db[_0x16ebb9[_0xca7a('0x1d')]],'as':_0x16ebb9['as'],'attributes':_0x16ebb9[_0xca7a('0x19')],'include':_0x16ebb9[_0xca7a('0x1b')]?_['map'](_0x16ebb9['include'],function(_0x472f41){return{'model':db[_0x472f41[_0xca7a('0x1d')]],'as':_0x472f41['as'],'attributes':_0x472f41[_0xca7a('0x19')]};}):[]};}):[]};}):[]:[]})[_0xca7a('0xa')](function(_0x5d032a){logger[_0xca7a('0xb')](_0xca7a('0x1e'),_0x3ac3ed);logger[_0xca7a('0xe')](_0xca7a('0x1e'),_0x3ac3ed,JSON[_0xca7a('0xf')](_0x5d032a));_0x7fb3b0(_0x5d032a);})[_0xca7a('0x13')](function(_0x488400){logger[_0xca7a('0x10')](_0xca7a('0x1e'),_0x488400[_0xca7a('0x12')],_0x3ac3ed);_0x209863(_0x241315[_0xca7a('0x10')](0x1f4,_0x488400[_0xca7a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 8a359f2..9059dbc 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 _0x1dbd=['get','index','/:id','isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intFreshdeskConfiguration.controller'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0x1dbd,0x1ec));var _0xd1db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dbd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd1db('0x0'));var util=require(_0xd1db('0x1'));var path=require(_0xd1db('0x2'));var timeout=require(_0xd1db('0x3'));var express=require(_0xd1db('0x4'));var router=express[_0xd1db('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd1db('0x6'));var config=require('../../config/environment');var controller=require(_0xd1db('0x7'));router[_0xd1db('0x8')]('/',auth['isAuthenticated'](),controller[_0xd1db('0x9')]);router[_0xd1db('0x8')](_0xd1db('0xa'),auth[_0xd1db('0xb')](),controller['show']);router[_0xd1db('0x8')](_0xd1db('0xc'),auth[_0xd1db('0xb')](),controller['getFields']);router['get'](_0xd1db('0xd'),auth[_0xd1db('0xb')](),controller[_0xd1db('0xe')]);router[_0xd1db('0x8')](_0xd1db('0xf'),auth['isAuthenticated'](),controller[_0xd1db('0x10')]);router[_0xd1db('0x8')](_0xd1db('0x11'),auth[_0xd1db('0xb')](),controller[_0xd1db('0x12')]);router[_0xd1db('0x13')]('/',auth['isAuthenticated'](),controller[_0xd1db('0x14')]);router[_0xd1db('0x13')](_0xd1db('0x11'),auth[_0xd1db('0xb')](),controller[_0xd1db('0x15')]);router[_0xd1db('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd1db('0x17')]('/:id',auth[_0xd1db('0xb')](),controller['destroy']);module[_0xd1db('0x18')]=router; \ No newline at end of file +var _0xbfe4=['index','get','/:id','/:id/fields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated'];(function(_0x5448c6,_0x108fab){var _0x510306=function(_0x4cd04e){while(--_0x4cd04e){_0x5448c6['push'](_0x5448c6['shift']());}};_0x510306(++_0x108fab);}(_0xbfe4,0x195));var _0x4bfe=function(_0x3e30c1,_0x4f64b3){_0x3e30c1=_0x3e30c1-0x0;var _0xf27341=_0xbfe4[_0x3e30c1];return _0xf27341;};'use strict';var multer=require(_0x4bfe('0x0'));var util=require(_0x4bfe('0x1'));var path=require('path');var timeout=require(_0x4bfe('0x2'));var express=require(_0x4bfe('0x3'));var router=express[_0x4bfe('0x4')]();var fs_extra=require(_0x4bfe('0x5'));var auth=require(_0x4bfe('0x6'));var interaction=require(_0x4bfe('0x7'));var config=require(_0x4bfe('0x8'));var controller=require(_0x4bfe('0x9'));router['get']('/',auth[_0x4bfe('0xa')](),controller[_0x4bfe('0xb')]);router[_0x4bfe('0xc')](_0x4bfe('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x4bfe('0xe'),auth[_0x4bfe('0xa')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x4bfe('0xa')](),controller['getSubjects']);router[_0x4bfe('0xc')](_0x4bfe('0xf'),auth['isAuthenticated'](),controller[_0x4bfe('0x10')]);router[_0x4bfe('0xc')](_0x4bfe('0x11'),auth[_0x4bfe('0xa')](),controller[_0x4bfe('0x12')]);router[_0x4bfe('0x13')]('/',auth[_0x4bfe('0xa')](),controller['create']);router[_0x4bfe('0x13')](_0x4bfe('0x11'),auth[_0x4bfe('0xa')](),controller[_0x4bfe('0x14')]);router[_0x4bfe('0x15')](_0x4bfe('0xd'),auth[_0x4bfe('0xa')](),controller[_0x4bfe('0x16')]);router[_0x4bfe('0x17')](_0x4bfe('0xd'),auth[_0x4bfe('0xa')](),controller[_0x4bfe('0x18')]);module[_0x4bfe('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index c25c788..7ffd40b 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 _0x2d69=['sequelize','STRING'];(function(_0x10bb3b,_0x4ca6bc){var _0x50e5d2=function(_0x1b2e95){while(--_0x1b2e95){_0x10bb3b['push'](_0x10bb3b['shift']());}};_0x50e5d2(++_0x4ca6bc);}(_0x2d69,0x10a));var _0x92d6=function(_0x404be0,_0x27d5f7){_0x404be0=_0x404be0-0x0;var _0x1d9265=_0x2d69[_0x404be0];return _0x1d9265;};'use strict';var Sequelize=require(_0x92d6('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x92d6('0x1')]}}; \ No newline at end of file +var _0xc26f=['STRING','sequelize'];(function(_0x3207a4,_0x1b9024){var _0x5c8dff=function(_0x4611b9){while(--_0x4611b9){_0x3207a4['push'](_0x3207a4['shift']());}};_0x5c8dff(++_0x1b9024);}(_0xc26f,0x1d9));var _0xfc26=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xc26f[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xfc26('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc26('0x1')]},'description':{'type':Sequelize[_0xfc26('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 375e8a7..0b1d1f0 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 _0x27fb=['count','limit','set','Content-Range','apply','save','update','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','model','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','VIRTUAL','filter','merge','FreshdeskConfiguration','includeAll','include','findAll','rows','catch','show','params','fields','options','create','body','destroy','find','getFields','findOne','FreshdeskField','where','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0x27fb,0xe8));var _0xb27f=function(_0x1d4b6c,_0x50eeb5){_0x1d4b6c=_0x1d4b6c-0x0;var _0x20e935=_0x27fb[_0x1d4b6c];return _0x20e935;};'use strict';var emlformat=require(_0xb27f('0x0'));var rimraf=require(_0xb27f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb27f('0x2'));var rp=require(_0xb27f('0x3'));var moment=require(_0xb27f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb27f('0x5'));var util=require(_0xb27f('0x6'));var path=require(_0xb27f('0x7'));var sox=require('sox');var csv=require(_0xb27f('0x8'));var ejs=require(_0xb27f('0x9'));var fs=require('fs');var fs_extra=require(_0xb27f('0xa'));var _=require(_0xb27f('0xb'));var squel=require('squel');var crypto=require(_0xb27f('0xc'));var jsforce=require(_0xb27f('0xd'));var deskjs=require(_0xb27f('0xe'));var toCsv=require(_0xb27f('0x8'));var querystring=require('querystring');var Papa=require(_0xb27f('0xf'));var Redis=require(_0xb27f('0x10'));var authService=require(_0xb27f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb27f('0x12'));var hardwareService=require(_0xb27f('0x13'));var logger=require(_0xb27f('0x14'))(_0xb27f('0x15'));var utils=require(_0xb27f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb27f('0x17'));var db=require(_0xb27f('0x18'))['db'];function respondWithStatusCode(_0x4c802c,_0x115c27){_0x115c27=_0x115c27||0xcc;return function(_0x3f8121){if(_0x3f8121){return _0x4c802c['sendStatus'](_0x115c27);}return _0x4c802c[_0xb27f('0x19')](_0x115c27)['end']();};}function respondWithResult(_0x56fb5a,_0x4e7bbf){_0x4e7bbf=_0x4e7bbf||0xc8;return function(_0x1622ac){if(_0x1622ac){return _0x56fb5a[_0xb27f('0x19')](_0x4e7bbf)[_0xb27f('0x1a')](_0x1622ac);}};}function respondWithFilteredResult(_0x3906f7,_0x144571){return function(_0x6183cd){if(_0x6183cd){var _0xdde44e=typeof _0x144571[_0xb27f('0x1b')]===_0xb27f('0x1c')&&typeof _0x144571['limit']===_0xb27f('0x1c');var _0x4bbcc7=_0x6183cd[_0xb27f('0x1d')];var _0x4b9042=_0xdde44e?0x0:_0x144571[_0xb27f('0x1b')];var _0x18b18a=_0xdde44e?_0x6183cd[_0xb27f('0x1d')]:_0x144571['offset']+_0x144571[_0xb27f('0x1e')];var _0xce85ba;if(_0x18b18a>=_0x4bbcc7){_0x18b18a=_0x4bbcc7;_0xce85ba=0xc8;}else{_0xce85ba=0xce;}_0x3906f7[_0xb27f('0x19')](_0xce85ba);return _0x3906f7[_0xb27f('0x1f')](_0xb27f('0x20'),_0x4b9042+'-'+_0x18b18a+'/'+_0x4bbcc7)[_0xb27f('0x1a')](_0x6183cd);}return null;};}function patchUpdates(_0x422ed4){return function(_0x1abf72){try{jsonpatch[_0xb27f('0x21')](_0x1abf72,_0x422ed4,!![]);}catch(_0x51e236){return BPromise['reject'](_0x51e236);}return _0x1abf72[_0xb27f('0x22')]();};}function saveUpdates(_0x3ee693,_0x255075){return function(_0x5b518d){if(_0x5b518d){return _0x5b518d[_0xb27f('0x23')](_0x3ee693)[_0xb27f('0x24')](function(_0x3cdb70){return _0x3cdb70;});}return null;};}function removeEntity(_0x10969b,_0x32b90b){return function(_0xb574fe){if(_0xb574fe){return _0xb574fe['destroy']()[_0xb27f('0x24')](function(){_0x10969b[_0xb27f('0x19')](0xcc)[_0xb27f('0x25')]();});}};}function handleEntityNotFound(_0x415324,_0x2b08a2){return function(_0x5ebbd3){if(!_0x5ebbd3){_0x415324[_0xb27f('0x26')](0x194);}return _0x5ebbd3;};}function handleError(_0x15ce53,_0x29229b){_0x29229b=_0x29229b||0x1f4;return function(_0x35d692){logger[_0xb27f('0x27')](_0x35d692[_0xb27f('0x28')]);if(_0x35d692[_0xb27f('0x29')]){delete _0x35d692[_0xb27f('0x29')];}_0x15ce53['status'](_0x29229b)[_0xb27f('0x2a')](_0x35d692);};}exports[_0xb27f('0x2b')]=function(_0x178e8e,_0x3ddb5d){var _0x20d727={},_0x21b6fc={},_0x1b3e65={'count':0x0,'rows':[]};var _0x14a15c=_[_0xb27f('0x2c')](db['FreshdeskConfiguration'][_0xb27f('0x2d')],function(_0xc8f47c){return{'name':_0xc8f47c[_0xb27f('0x2e')],'type':_0xc8f47c['type'][_0xb27f('0x2f')]};});_0x21b6fc['model']=_[_0xb27f('0x2c')](_0x14a15c,_0xb27f('0x29'));_0x21b6fc[_0xb27f('0x30')]=_[_0xb27f('0x31')](_0x178e8e['query']);_0x21b6fc[_0xb27f('0x32')]=_['intersection'](_0x21b6fc[_0xb27f('0x33')],_0x21b6fc[_0xb27f('0x30')]);_0x20d727['attributes']=_[_0xb27f('0x34')](_0x21b6fc['model'],qs['fields'](_0x178e8e[_0xb27f('0x30')]['fields']));_0x20d727[_0xb27f('0x35')]=_0x20d727[_0xb27f('0x35')][_0xb27f('0x36')]?_0x20d727[_0xb27f('0x35')]:_0x21b6fc[_0xb27f('0x33')];if(!_0x178e8e[_0xb27f('0x30')][_0xb27f('0x37')](_0xb27f('0x38'))){_0x20d727[_0xb27f('0x1e')]=qs[_0xb27f('0x1e')](_0x178e8e[_0xb27f('0x30')]['limit']);_0x20d727[_0xb27f('0x1b')]=qs['offset'](_0x178e8e[_0xb27f('0x30')][_0xb27f('0x1b')]);}_0x20d727[_0xb27f('0x39')]=qs[_0xb27f('0x3a')](_0x178e8e['query'][_0xb27f('0x3a')]);_0x20d727['where']=qs['filters'](_[_0xb27f('0x3b')](_0x178e8e[_0xb27f('0x30')],_0x21b6fc[_0xb27f('0x32')]),_0x14a15c);if(_0x178e8e['query']['filter']){_0x20d727['where']=_['merge'](_0x20d727['where'],{'$or':_[_0xb27f('0x2c')](_0x14a15c,function(_0x121798){if(_0x121798['type']!==_0xb27f('0x3c')){var _0x1250f2={};_0x1250f2[_0x121798[_0xb27f('0x29')]]={'$like':'%'+_0x178e8e['query'][_0xb27f('0x3d')]+'%'};return _0x1250f2;}})});}_0x20d727=_[_0xb27f('0x3e')]({},_0x20d727,_0x178e8e['options']);var _0x360ef5={'where':_0x20d727['where']};return db[_0xb27f('0x3f')][_0xb27f('0x1d')](_0x360ef5)[_0xb27f('0x24')](function(_0x4c6e8e){_0x1b3e65[_0xb27f('0x1d')]=_0x4c6e8e;if(_0x178e8e['query'][_0xb27f('0x40')]){_0x20d727[_0xb27f('0x41')]=[{'all':!![]}];}return db[_0xb27f('0x3f')][_0xb27f('0x42')](_0x20d727);})[_0xb27f('0x24')](function(_0x3c8f7d){_0x1b3e65[_0xb27f('0x43')]=_0x3c8f7d;return _0x1b3e65;})['then'](respondWithFilteredResult(_0x3ddb5d,_0x20d727))[_0xb27f('0x44')](handleError(_0x3ddb5d,null));};exports[_0xb27f('0x45')]=function(_0x5c0906,_0x36a311){var _0x454e22={'raw':![],'where':{'id':_0x5c0906[_0xb27f('0x46')]['id']}},_0x2e303e={};_0x2e303e[_0xb27f('0x33')]=_[_0xb27f('0x31')](db['FreshdeskConfiguration'][_0xb27f('0x2d')]);_0x2e303e[_0xb27f('0x30')]=_['keys'](_0x5c0906[_0xb27f('0x30')]);_0x2e303e[_0xb27f('0x32')]=_[_0xb27f('0x34')](_0x2e303e[_0xb27f('0x33')],_0x2e303e['query']);_0x454e22['attributes']=_[_0xb27f('0x34')](_0x2e303e[_0xb27f('0x33')],qs[_0xb27f('0x47')](_0x5c0906['query'][_0xb27f('0x47')]));_0x454e22[_0xb27f('0x35')]=_0x454e22['attributes'][_0xb27f('0x36')]?_0x454e22['attributes']:_0x2e303e[_0xb27f('0x33')];if(_0x5c0906[_0xb27f('0x30')][_0xb27f('0x40')]){_0x454e22[_0xb27f('0x41')]=[{'all':!![]}];}_0x454e22=_[_0xb27f('0x3e')]({},_0x454e22,_0x5c0906[_0xb27f('0x48')]);return db[_0xb27f('0x3f')]['find'](_0x454e22)['then'](handleEntityNotFound(_0x36a311,null))[_0xb27f('0x24')](respondWithResult(_0x36a311,null))[_0xb27f('0x44')](handleError(_0x36a311,null));};exports[_0xb27f('0x49')]=function(_0x47237b,_0x12cf5c){return db[_0xb27f('0x3f')][_0xb27f('0x49')](_0x47237b[_0xb27f('0x4a')],{})['then'](respondWithResult(_0x12cf5c,0xc9))[_0xb27f('0x44')](handleError(_0x12cf5c,null));};exports[_0xb27f('0x23')]=function(_0x57e0f2,_0x319068){if(_0x57e0f2['body']['id']){delete _0x57e0f2[_0xb27f('0x4a')]['id'];}return db[_0xb27f('0x3f')]['find']({'where':{'id':_0x57e0f2['params']['id']}})[_0xb27f('0x24')](handleEntityNotFound(_0x319068,null))[_0xb27f('0x24')](saveUpdates(_0x57e0f2[_0xb27f('0x4a')],null))[_0xb27f('0x24')](respondWithResult(_0x319068,null))[_0xb27f('0x44')](handleError(_0x319068,null));};exports[_0xb27f('0x4b')]=function(_0x25f519,_0x2f3c89){return db['FreshdeskConfiguration'][_0xb27f('0x4c')]({'where':{'id':_0x25f519['params']['id']}})[_0xb27f('0x24')](handleEntityNotFound(_0x2f3c89,null))[_0xb27f('0x24')](removeEntity(_0x2f3c89,null))['catch'](handleError(_0x2f3c89,null));};exports[_0xb27f('0x4d')]=function(_0x27dfda,_0x44ebe5,_0x5da2ac){var _0x1bf24b={};var _0xf2c490={};var _0x425f87;var _0x1139cf;return db[_0xb27f('0x3f')][_0xb27f('0x4e')]({'where':{'id':_0x27dfda[_0xb27f('0x46')]['id']}})[_0xb27f('0x24')](handleEntityNotFound(_0x44ebe5,null))[_0xb27f('0x24')](function(_0x2e4db6){if(_0x2e4db6){_0x425f87=_0x2e4db6;_0xf2c490['model']=_[_0xb27f('0x31')](db[_0xb27f('0x4f')][_0xb27f('0x2d')]);_0xf2c490[_0xb27f('0x30')]=_[_0xb27f('0x31')](_0x27dfda['query']);_0xf2c490[_0xb27f('0x32')]=_[_0xb27f('0x34')](_0xf2c490[_0xb27f('0x33')],_0xf2c490[_0xb27f('0x30')]);_0x1bf24b[_0xb27f('0x35')]=_[_0xb27f('0x34')](_0xf2c490[_0xb27f('0x33')],qs[_0xb27f('0x47')](_0x27dfda[_0xb27f('0x30')]['fields']));_0x1bf24b[_0xb27f('0x35')]=_0x1bf24b[_0xb27f('0x35')][_0xb27f('0x36')]?_0x1bf24b[_0xb27f('0x35')]:_0xf2c490['model'];_0x1bf24b[_0xb27f('0x39')]=qs[_0xb27f('0x3a')](_0x27dfda[_0xb27f('0x30')][_0xb27f('0x3a')]);_0x1bf24b[_0xb27f('0x50')]=qs[_0xb27f('0x32')](_[_0xb27f('0x3b')](_0x27dfda[_0xb27f('0x30')],_0xf2c490[_0xb27f('0x32')]));if(_0x27dfda['query'][_0xb27f('0x3d')]){_0x1bf24b[_0xb27f('0x50')]=_[_0xb27f('0x3e')](_0x1bf24b[_0xb27f('0x50')],{'$or':_['map'](_0x1bf24b[_0xb27f('0x35')],function(_0x101991){var _0x4ad744={};_0x4ad744[_0x101991]={'$like':'%'+_0x27dfda[_0xb27f('0x30')][_0xb27f('0x3d')]+'%'};return _0x4ad744;})});}_0x1bf24b=_[_0xb27f('0x3e')]({},_0x1bf24b,_0x27dfda[_0xb27f('0x48')]);return _0x425f87[_0xb27f('0x4d')](_0x1bf24b);}})[_0xb27f('0x24')](function(_0x3bde2f){if(_0x3bde2f){_0x1139cf=_0x3bde2f[_0xb27f('0x36')];if(!_0x27dfda[_0xb27f('0x30')][_0xb27f('0x37')]('nolimit')){_0x1bf24b[_0xb27f('0x1e')]=qs[_0xb27f('0x1e')](_0x27dfda[_0xb27f('0x30')]['limit']);_0x1bf24b[_0xb27f('0x1b')]=qs[_0xb27f('0x1b')](_0x27dfda[_0xb27f('0x30')][_0xb27f('0x1b')]);}return _0x425f87[_0xb27f('0x4d')](_0x1bf24b);}})[_0xb27f('0x24')](function(_0x3843b6){if(_0x3843b6){return _0x3843b6?{'count':_0x1139cf,'rows':_0x3843b6}:null;}})[_0xb27f('0x24')](respondWithResult(_0x44ebe5,null))[_0xb27f('0x44')](handleError(_0x44ebe5,null));};exports[_0xb27f('0x51')]=function(_0x14cea1,_0x171371,_0x149e84){var _0x35c626={};var _0x4bcec4={};var _0x46db18;var _0x1f15bd;return db[_0xb27f('0x3f')][_0xb27f('0x4e')]({'where':{'id':_0x14cea1['params']['id']}})[_0xb27f('0x24')](handleEntityNotFound(_0x171371,null))[_0xb27f('0x24')](function(_0x479569){if(_0x479569){_0x46db18=_0x479569;_0x4bcec4[_0xb27f('0x33')]=_['keys'](db[_0xb27f('0x4f')][_0xb27f('0x2d')]);_0x4bcec4[_0xb27f('0x30')]=_[_0xb27f('0x31')](_0x14cea1['query']);_0x4bcec4[_0xb27f('0x32')]=_['intersection'](_0x4bcec4[_0xb27f('0x33')],_0x4bcec4[_0xb27f('0x30')]);_0x35c626['attributes']=_[_0xb27f('0x34')](_0x4bcec4[_0xb27f('0x33')],qs[_0xb27f('0x47')](_0x14cea1[_0xb27f('0x30')][_0xb27f('0x47')]));_0x35c626['attributes']=_0x35c626[_0xb27f('0x35')]['length']?_0x35c626[_0xb27f('0x35')]:_0x4bcec4[_0xb27f('0x33')];_0x35c626[_0xb27f('0x39')]=qs['sort'](_0x14cea1[_0xb27f('0x30')][_0xb27f('0x3a')]);_0x35c626[_0xb27f('0x50')]=qs[_0xb27f('0x32')](_[_0xb27f('0x3b')](_0x14cea1['query'],_0x4bcec4[_0xb27f('0x32')]));if(_0x14cea1['query'][_0xb27f('0x3d')]){_0x35c626[_0xb27f('0x50')]=_['merge'](_0x35c626[_0xb27f('0x50')],{'$or':_[_0xb27f('0x2c')](_0x35c626['attributes'],function(_0x38c006){var _0x5e5ec4={};_0x5e5ec4[_0x38c006]={'$like':'%'+_0x14cea1[_0xb27f('0x30')][_0xb27f('0x3d')]+'%'};return _0x5e5ec4;})});}_0x35c626=_['merge']({},_0x35c626,_0x14cea1['options']);return _0x46db18[_0xb27f('0x51')](_0x35c626);}})[_0xb27f('0x24')](function(_0x21d9d1){if(_0x21d9d1){_0x1f15bd=_0x21d9d1[_0xb27f('0x36')];if(!_0x14cea1[_0xb27f('0x30')][_0xb27f('0x37')]('nolimit')){_0x35c626['limit']=qs[_0xb27f('0x1e')](_0x14cea1[_0xb27f('0x30')][_0xb27f('0x1e')]);_0x35c626[_0xb27f('0x1b')]=qs[_0xb27f('0x1b')](_0x14cea1['query']['offset']);}return _0x46db18[_0xb27f('0x51')](_0x35c626);}})['then'](function(_0x296ad6){if(_0x296ad6){return _0x296ad6?{'count':_0x1f15bd,'rows':_0x296ad6}:null;}})[_0xb27f('0x24')](respondWithResult(_0x171371,null))[_0xb27f('0x44')](handleError(_0x171371,null));};exports[_0xb27f('0x52')]=function(_0xb1a467,_0xc165dd,_0x527e36){var _0x5d09f0={};var _0x28428e={};var _0xd0be76;var _0x5f2d26;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xb1a467[_0xb27f('0x46')]['id']}})[_0xb27f('0x24')](handleEntityNotFound(_0xc165dd,null))[_0xb27f('0x24')](function(_0x10d672){if(_0x10d672){_0xd0be76=_0x10d672;_0x28428e[_0xb27f('0x33')]=_[_0xb27f('0x31')](db['FreshdeskField']['rawAttributes']);_0x28428e[_0xb27f('0x30')]=_[_0xb27f('0x31')](_0xb1a467[_0xb27f('0x30')]);_0x28428e[_0xb27f('0x32')]=_['intersection'](_0x28428e[_0xb27f('0x33')],_0x28428e[_0xb27f('0x30')]);_0x5d09f0[_0xb27f('0x35')]=_[_0xb27f('0x34')](_0x28428e[_0xb27f('0x33')],qs[_0xb27f('0x47')](_0xb1a467[_0xb27f('0x30')][_0xb27f('0x47')]));_0x5d09f0[_0xb27f('0x35')]=_0x5d09f0[_0xb27f('0x35')][_0xb27f('0x36')]?_0x5d09f0[_0xb27f('0x35')]:_0x28428e['model'];_0x5d09f0[_0xb27f('0x39')]=qs['sort'](_0xb1a467['query'][_0xb27f('0x3a')]);_0x5d09f0[_0xb27f('0x50')]=qs[_0xb27f('0x32')](_[_0xb27f('0x3b')](_0xb1a467[_0xb27f('0x30')],_0x28428e[_0xb27f('0x32')]));if(_0xb1a467[_0xb27f('0x30')][_0xb27f('0x3d')]){_0x5d09f0[_0xb27f('0x50')]=_[_0xb27f('0x3e')](_0x5d09f0[_0xb27f('0x50')],{'$or':_[_0xb27f('0x2c')](_0x5d09f0['attributes'],function(_0x27cf81){var _0x173883={};_0x173883[_0x27cf81]={'$like':'%'+_0xb1a467[_0xb27f('0x30')][_0xb27f('0x3d')]+'%'};return _0x173883;})});}_0x5d09f0=_[_0xb27f('0x3e')]({},_0x5d09f0,_0xb1a467['options']);return _0xd0be76['getDescriptions'](_0x5d09f0);}})[_0xb27f('0x24')](function(_0x427682){if(_0x427682){_0x5f2d26=_0x427682[_0xb27f('0x36')];if(!_0xb1a467[_0xb27f('0x30')]['hasOwnProperty'](_0xb27f('0x38'))){_0x5d09f0[_0xb27f('0x1e')]=qs[_0xb27f('0x1e')](_0xb1a467[_0xb27f('0x30')][_0xb27f('0x1e')]);_0x5d09f0[_0xb27f('0x1b')]=qs[_0xb27f('0x1b')](_0xb1a467[_0xb27f('0x30')][_0xb27f('0x1b')]);}return _0xd0be76['getDescriptions'](_0x5d09f0);}})[_0xb27f('0x24')](function(_0x363bf9){if(_0x363bf9){return _0x363bf9?{'count':_0x5f2d26,'rows':_0x363bf9}:null;}})[_0xb27f('0x24')](respondWithResult(_0xc165dd,null))['catch'](handleError(_0xc165dd,null));};exports[_0xb27f('0x53')]=function(_0x26dfa0,_0x407942,_0x2e693c){var _0x3e8848={};var _0x41d3d1={};var _0xa0c339;var _0xbdbd88;return db[_0xb27f('0x3f')][_0xb27f('0x4e')]({'where':{'id':_0x26dfa0[_0xb27f('0x46')]['id']}})[_0xb27f('0x24')](handleEntityNotFound(_0x407942,null))[_0xb27f('0x24')](function(_0x25d131){if(_0x25d131){_0xa0c339=_0x25d131;_0x41d3d1['model']=_[_0xb27f('0x31')](db[_0xb27f('0x54')]['rawAttributes']);_0x41d3d1[_0xb27f('0x30')]=_[_0xb27f('0x31')](_0x26dfa0[_0xb27f('0x30')]);_0x41d3d1[_0xb27f('0x32')]=_[_0xb27f('0x34')](_0x41d3d1[_0xb27f('0x33')],_0x41d3d1[_0xb27f('0x30')]);_0x3e8848['attributes']=_[_0xb27f('0x34')](_0x41d3d1[_0xb27f('0x33')],qs[_0xb27f('0x47')](_0x26dfa0[_0xb27f('0x30')][_0xb27f('0x47')]));_0x3e8848['attributes']=_0x3e8848[_0xb27f('0x35')]['length']?_0x3e8848[_0xb27f('0x35')]:_0x41d3d1[_0xb27f('0x33')];_0x3e8848[_0xb27f('0x39')]=qs[_0xb27f('0x3a')](_0x26dfa0[_0xb27f('0x30')][_0xb27f('0x3a')]);_0x3e8848['where']=qs[_0xb27f('0x32')](_['pick'](_0x26dfa0[_0xb27f('0x30')],_0x41d3d1[_0xb27f('0x32')]));if(_0x26dfa0[_0xb27f('0x30')]['filter']){_0x3e8848['where']=_[_0xb27f('0x3e')](_0x3e8848[_0xb27f('0x50')],{'$or':_[_0xb27f('0x2c')](_0x3e8848[_0xb27f('0x35')],function(_0x499476){var _0x3c0729={};_0x3c0729[_0x499476]={'$like':'%'+_0x26dfa0[_0xb27f('0x30')]['filter']+'%'};return _0x3c0729;})});}_0x3e8848=_[_0xb27f('0x3e')]({},_0x3e8848,_0x26dfa0[_0xb27f('0x48')]);return _0xa0c339[_0xb27f('0x53')](_0x3e8848);}})[_0xb27f('0x24')](function(_0x37155a){if(_0x37155a){_0xbdbd88=_0x37155a['length'];if(!_0x26dfa0['query'][_0xb27f('0x37')](_0xb27f('0x38'))){_0x3e8848['limit']=qs[_0xb27f('0x1e')](_0x26dfa0[_0xb27f('0x30')][_0xb27f('0x1e')]);_0x3e8848[_0xb27f('0x1b')]=qs[_0xb27f('0x1b')](_0x26dfa0[_0xb27f('0x30')][_0xb27f('0x1b')]);}return _0xa0c339['getTags'](_0x3e8848);}})['then'](function(_0x53a70d){if(_0x53a70d){return _0x53a70d?{'count':_0xbdbd88,'rows':_0x53a70d}:null;}})[_0xb27f('0x24')](respondWithResult(_0x407942,null))[_0xb27f('0x44')](handleError(_0x407942,null));};exports[_0xb27f('0x55')]=function(_0x4c0a72,_0x16e4b8,_0x2dacfb){if(_0x4c0a72[_0xb27f('0x4a')]['id']){delete _0x4c0a72[_0xb27f('0x4a')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4c0a72['params']['id']}})[_0xb27f('0x24')](handleEntityNotFound(_0x16e4b8,null))[_0xb27f('0x24')](function(_0x4c6339){if(_0x4c6339){return _0x4c6339[_0xb27f('0x55')](_0x4c0a72[_0xb27f('0x4a')][_0xb27f('0x56')]||[]);}return null;})[_0xb27f('0x24')](respondWithResult(_0x16e4b8,null))[_0xb27f('0x44')](handleError(_0x16e4b8,null));}; \ No newline at end of file +var _0x509e=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskConfiguration','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x40bd70,_0x2108ff){var _0x5cfab8=function(_0x3c17dc){while(--_0x3c17dc){_0x40bd70['push'](_0x40bd70['shift']());}};_0x5cfab8(++_0x2108ff);}(_0x509e,0x8f));var _0xe509=function(_0x844020,_0x524d8a){_0x844020=_0x844020-0x0;var _0x4fd26e=_0x509e[_0x844020];return _0x4fd26e;};'use strict';var emlformat=require(_0xe509('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe509('0x1'));var jsonpatch=require(_0xe509('0x2'));var rp=require(_0xe509('0x3'));var moment=require(_0xe509('0x4'));var BPromise=require(_0xe509('0x5'));var Mustache=require(_0xe509('0x6'));var util=require('util');var path=require(_0xe509('0x7'));var sox=require('sox');var csv=require(_0xe509('0x8'));var ejs=require(_0xe509('0x9'));var fs=require('fs');var fs_extra=require(_0xe509('0xa'));var _=require(_0xe509('0xb'));var squel=require(_0xe509('0xc'));var crypto=require(_0xe509('0xd'));var jsforce=require(_0xe509('0xe'));var deskjs=require(_0xe509('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe509('0x10'));var Redis=require(_0xe509('0x11'));var authService=require(_0xe509('0x12'));var qs=require(_0xe509('0x13'));var as=require(_0xe509('0x14'));var hardwareService=require(_0xe509('0x15'));var logger=require(_0xe509('0x16'))(_0xe509('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe509('0x18'));var db=require(_0xe509('0x19'))['db'];function respondWithStatusCode(_0x4ab21a,_0x16809b){_0x16809b=_0x16809b||0xcc;return function(_0x1cf5c7){if(_0x1cf5c7){return _0x4ab21a['sendStatus'](_0x16809b);}return _0x4ab21a[_0xe509('0x1a')](_0x16809b)[_0xe509('0x1b')]();};}function respondWithResult(_0x5b9a04,_0x7cd348){_0x7cd348=_0x7cd348||0xc8;return function(_0xe61138){if(_0xe61138){return _0x5b9a04[_0xe509('0x1a')](_0x7cd348)[_0xe509('0x1c')](_0xe61138);}};}function respondWithFilteredResult(_0x2740d8,_0x117eab){return function(_0x2e92cb){if(_0x2e92cb){var _0x4faa13=typeof _0x117eab[_0xe509('0x1d')]===_0xe509('0x1e')&&typeof _0x117eab[_0xe509('0x1f')]===_0xe509('0x1e');var _0x5767f9=_0x2e92cb[_0xe509('0x20')];var _0x87c52=_0x4faa13?0x0:_0x117eab['offset'];var _0x5c0ccd=_0x4faa13?_0x2e92cb[_0xe509('0x20')]:_0x117eab[_0xe509('0x1d')]+_0x117eab[_0xe509('0x1f')];var _0x40d5c3;if(_0x5c0ccd>=_0x5767f9){_0x5c0ccd=_0x5767f9;_0x40d5c3=0xc8;}else{_0x40d5c3=0xce;}_0x2740d8[_0xe509('0x1a')](_0x40d5c3);return _0x2740d8[_0xe509('0x21')](_0xe509('0x22'),_0x87c52+'-'+_0x5c0ccd+'/'+_0x5767f9)[_0xe509('0x1c')](_0x2e92cb);}return null;};}function patchUpdates(_0x6aed70){return function(_0x58236e){try{jsonpatch[_0xe509('0x23')](_0x58236e,_0x6aed70,!![]);}catch(_0x29d0a7){return BPromise[_0xe509('0x24')](_0x29d0a7);}return _0x58236e[_0xe509('0x25')]();};}function saveUpdates(_0x5e0586,_0xbe2502){return function(_0x295575){if(_0x295575){return _0x295575[_0xe509('0x26')](_0x5e0586)[_0xe509('0x27')](function(_0x183ff0){return _0x183ff0;});}return null;};}function removeEntity(_0x15664b,_0x1a3a74){return function(_0x40ce03){if(_0x40ce03){return _0x40ce03[_0xe509('0x28')]()['then'](function(){_0x15664b['status'](0xcc)[_0xe509('0x1b')]();});}};}function handleEntityNotFound(_0x17f7f3,_0x5f0841){return function(_0x1d71a3){if(!_0x1d71a3){_0x17f7f3['sendStatus'](0x194);}return _0x1d71a3;};}function handleError(_0x55911d,_0x4d5552){_0x4d5552=_0x4d5552||0x1f4;return function(_0x3ae3a5){logger[_0xe509('0x29')](_0x3ae3a5['stack']);if(_0x3ae3a5[_0xe509('0x2a')]){delete _0x3ae3a5['name'];}_0x55911d['status'](_0x4d5552)[_0xe509('0x2b')](_0x3ae3a5);};}exports[_0xe509('0x2c')]=function(_0x59357b,_0x6fbf8f){var _0x4c6dff={},_0x1cf20f={},_0x5d5eef={'count':0x0,'rows':[]};var _0xadac0c=_[_0xe509('0x2d')](db[_0xe509('0x2e')]['rawAttributes'],function(_0xb51357){return{'name':_0xb51357[_0xe509('0x2f')],'type':_0xb51357['type'][_0xe509('0x30')]};});_0x1cf20f[_0xe509('0x31')]=_[_0xe509('0x2d')](_0xadac0c,'name');_0x1cf20f[_0xe509('0x32')]=_[_0xe509('0x33')](_0x59357b[_0xe509('0x32')]);_0x1cf20f['filters']=_[_0xe509('0x34')](_0x1cf20f[_0xe509('0x31')],_0x1cf20f[_0xe509('0x32')]);_0x4c6dff['attributes']=_[_0xe509('0x34')](_0x1cf20f[_0xe509('0x31')],qs[_0xe509('0x35')](_0x59357b[_0xe509('0x32')][_0xe509('0x35')]));_0x4c6dff[_0xe509('0x36')]=_0x4c6dff[_0xe509('0x36')][_0xe509('0x37')]?_0x4c6dff[_0xe509('0x36')]:_0x1cf20f[_0xe509('0x31')];if(!_0x59357b[_0xe509('0x32')][_0xe509('0x38')](_0xe509('0x39'))){_0x4c6dff[_0xe509('0x1f')]=qs[_0xe509('0x1f')](_0x59357b['query'][_0xe509('0x1f')]);_0x4c6dff[_0xe509('0x1d')]=qs['offset'](_0x59357b['query'][_0xe509('0x1d')]);}_0x4c6dff[_0xe509('0x3a')]=qs['sort'](_0x59357b[_0xe509('0x32')][_0xe509('0x3b')]);_0x4c6dff[_0xe509('0x3c')]=qs[_0xe509('0x3d')](_[_0xe509('0x3e')](_0x59357b[_0xe509('0x32')],_0x1cf20f[_0xe509('0x3d')]),_0xadac0c);if(_0x59357b[_0xe509('0x32')]['filter']){_0x4c6dff[_0xe509('0x3c')]=_['merge'](_0x4c6dff['where'],{'$or':_[_0xe509('0x2d')](_0xadac0c,function(_0x36f138){if(_0x36f138[_0xe509('0x3f')]!==_0xe509('0x40')){var _0x19a270={};_0x19a270[_0x36f138[_0xe509('0x2a')]]={'$like':'%'+_0x59357b['query'][_0xe509('0x41')]+'%'};return _0x19a270;}})});}_0x4c6dff=_[_0xe509('0x42')]({},_0x4c6dff,_0x59357b[_0xe509('0x43')]);var _0x13f079={'where':_0x4c6dff[_0xe509('0x3c')]};return db[_0xe509('0x2e')][_0xe509('0x20')](_0x13f079)[_0xe509('0x27')](function(_0x597f57){_0x5d5eef[_0xe509('0x20')]=_0x597f57;if(_0x59357b[_0xe509('0x32')][_0xe509('0x44')]){_0x4c6dff[_0xe509('0x45')]=[{'all':!![]}];}return db[_0xe509('0x2e')][_0xe509('0x46')](_0x4c6dff);})[_0xe509('0x27')](function(_0x1db247){_0x5d5eef['rows']=_0x1db247;return _0x5d5eef;})[_0xe509('0x27')](respondWithFilteredResult(_0x6fbf8f,_0x4c6dff))[_0xe509('0x47')](handleError(_0x6fbf8f,null));};exports[_0xe509('0x48')]=function(_0x63e3df,_0x4f9680){var _0x18c2cc={'raw':![],'where':{'id':_0x63e3df[_0xe509('0x49')]['id']}},_0x19fdf6={};_0x19fdf6[_0xe509('0x31')]=_[_0xe509('0x33')](db[_0xe509('0x2e')][_0xe509('0x4a')]);_0x19fdf6[_0xe509('0x32')]=_[_0xe509('0x33')](_0x63e3df[_0xe509('0x32')]);_0x19fdf6[_0xe509('0x3d')]=_[_0xe509('0x34')](_0x19fdf6[_0xe509('0x31')],_0x19fdf6[_0xe509('0x32')]);_0x18c2cc['attributes']=_[_0xe509('0x34')](_0x19fdf6[_0xe509('0x31')],qs[_0xe509('0x35')](_0x63e3df['query'][_0xe509('0x35')]));_0x18c2cc[_0xe509('0x36')]=_0x18c2cc[_0xe509('0x36')][_0xe509('0x37')]?_0x18c2cc[_0xe509('0x36')]:_0x19fdf6[_0xe509('0x31')];if(_0x63e3df[_0xe509('0x32')][_0xe509('0x44')]){_0x18c2cc[_0xe509('0x45')]=[{'all':!![]}];}_0x18c2cc=_[_0xe509('0x42')]({},_0x18c2cc,_0x63e3df['options']);return db[_0xe509('0x2e')][_0xe509('0x4b')](_0x18c2cc)[_0xe509('0x27')](handleEntityNotFound(_0x4f9680,null))[_0xe509('0x27')](respondWithResult(_0x4f9680,null))['catch'](handleError(_0x4f9680,null));};exports[_0xe509('0x4c')]=function(_0x491c85,_0x1f4840){return db[_0xe509('0x2e')][_0xe509('0x4c')](_0x491c85['body'],{})['then'](respondWithResult(_0x1f4840,0xc9))[_0xe509('0x47')](handleError(_0x1f4840,null));};exports[_0xe509('0x26')]=function(_0x115778,_0x33de6e){if(_0x115778[_0xe509('0x4d')]['id']){delete _0x115778['body']['id'];}return db[_0xe509('0x2e')][_0xe509('0x4b')]({'where':{'id':_0x115778[_0xe509('0x49')]['id']}})[_0xe509('0x27')](handleEntityNotFound(_0x33de6e,null))['then'](saveUpdates(_0x115778[_0xe509('0x4d')],null))[_0xe509('0x27')](respondWithResult(_0x33de6e,null))[_0xe509('0x47')](handleError(_0x33de6e,null));};exports[_0xe509('0x28')]=function(_0x10ef1d,_0x56fd29){return db[_0xe509('0x2e')][_0xe509('0x4b')]({'where':{'id':_0x10ef1d[_0xe509('0x49')]['id']}})[_0xe509('0x27')](handleEntityNotFound(_0x56fd29,null))['then'](removeEntity(_0x56fd29,null))[_0xe509('0x47')](handleError(_0x56fd29,null));};exports[_0xe509('0x4e')]=function(_0x1f9042,_0xf29a49,_0x4f2436){var _0x51479c={};var _0x4f54c5={};var _0x4dbe3a;var _0x152d89;return db['FreshdeskConfiguration'][_0xe509('0x4f')]({'where':{'id':_0x1f9042[_0xe509('0x49')]['id']}})[_0xe509('0x27')](handleEntityNotFound(_0xf29a49,null))[_0xe509('0x27')](function(_0x350ee5){if(_0x350ee5){_0x4dbe3a=_0x350ee5;_0x4f54c5[_0xe509('0x31')]=_[_0xe509('0x33')](db[_0xe509('0x50')][_0xe509('0x4a')]);_0x4f54c5['query']=_['keys'](_0x1f9042['query']);_0x4f54c5['filters']=_[_0xe509('0x34')](_0x4f54c5[_0xe509('0x31')],_0x4f54c5[_0xe509('0x32')]);_0x51479c[_0xe509('0x36')]=_[_0xe509('0x34')](_0x4f54c5[_0xe509('0x31')],qs[_0xe509('0x35')](_0x1f9042[_0xe509('0x32')][_0xe509('0x35')]));_0x51479c[_0xe509('0x36')]=_0x51479c[_0xe509('0x36')][_0xe509('0x37')]?_0x51479c[_0xe509('0x36')]:_0x4f54c5[_0xe509('0x31')];_0x51479c[_0xe509('0x3a')]=qs['sort'](_0x1f9042[_0xe509('0x32')][_0xe509('0x3b')]);_0x51479c[_0xe509('0x3c')]=qs[_0xe509('0x3d')](_[_0xe509('0x3e')](_0x1f9042[_0xe509('0x32')],_0x4f54c5[_0xe509('0x3d')]));if(_0x1f9042[_0xe509('0x32')][_0xe509('0x41')]){_0x51479c['where']=_['merge'](_0x51479c[_0xe509('0x3c')],{'$or':_['map'](_0x51479c[_0xe509('0x36')],function(_0x2bf82d){var _0x236c5f={};_0x236c5f[_0x2bf82d]={'$like':'%'+_0x1f9042[_0xe509('0x32')][_0xe509('0x41')]+'%'};return _0x236c5f;})});}_0x51479c=_['merge']({},_0x51479c,_0x1f9042[_0xe509('0x43')]);return _0x4dbe3a[_0xe509('0x4e')](_0x51479c);}})[_0xe509('0x27')](function(_0x32621e){if(_0x32621e){_0x152d89=_0x32621e[_0xe509('0x37')];if(!_0x1f9042[_0xe509('0x32')][_0xe509('0x38')](_0xe509('0x39'))){_0x51479c[_0xe509('0x1f')]=qs[_0xe509('0x1f')](_0x1f9042['query'][_0xe509('0x1f')]);_0x51479c[_0xe509('0x1d')]=qs[_0xe509('0x1d')](_0x1f9042[_0xe509('0x32')][_0xe509('0x1d')]);}return _0x4dbe3a['getFields'](_0x51479c);}})[_0xe509('0x27')](function(_0x257796){if(_0x257796){return _0x257796?{'count':_0x152d89,'rows':_0x257796}:null;}})[_0xe509('0x27')](respondWithResult(_0xf29a49,null))[_0xe509('0x47')](handleError(_0xf29a49,null));};exports[_0xe509('0x51')]=function(_0x5ea89b,_0x5626d6,_0x224de7){var _0x790ba3={};var _0x4696a5={};var _0x398342;var _0x1f1d30;return db[_0xe509('0x2e')]['findOne']({'where':{'id':_0x5ea89b[_0xe509('0x49')]['id']}})[_0xe509('0x27')](handleEntityNotFound(_0x5626d6,null))[_0xe509('0x27')](function(_0xee4def){if(_0xee4def){_0x398342=_0xee4def;_0x4696a5[_0xe509('0x31')]=_[_0xe509('0x33')](db['FreshdeskField'][_0xe509('0x4a')]);_0x4696a5[_0xe509('0x32')]=_[_0xe509('0x33')](_0x5ea89b[_0xe509('0x32')]);_0x4696a5['filters']=_['intersection'](_0x4696a5[_0xe509('0x31')],_0x4696a5[_0xe509('0x32')]);_0x790ba3[_0xe509('0x36')]=_['intersection'](_0x4696a5['model'],qs[_0xe509('0x35')](_0x5ea89b[_0xe509('0x32')][_0xe509('0x35')]));_0x790ba3[_0xe509('0x36')]=_0x790ba3[_0xe509('0x36')][_0xe509('0x37')]?_0x790ba3[_0xe509('0x36')]:_0x4696a5[_0xe509('0x31')];_0x790ba3['order']=qs[_0xe509('0x3b')](_0x5ea89b[_0xe509('0x32')]['sort']);_0x790ba3[_0xe509('0x3c')]=qs['filters'](_[_0xe509('0x3e')](_0x5ea89b[_0xe509('0x32')],_0x4696a5[_0xe509('0x3d')]));if(_0x5ea89b[_0xe509('0x32')][_0xe509('0x41')]){_0x790ba3[_0xe509('0x3c')]=_[_0xe509('0x42')](_0x790ba3['where'],{'$or':_[_0xe509('0x2d')](_0x790ba3[_0xe509('0x36')],function(_0x263f3f){var _0x38b536={};_0x38b536[_0x263f3f]={'$like':'%'+_0x5ea89b['query']['filter']+'%'};return _0x38b536;})});}_0x790ba3=_[_0xe509('0x42')]({},_0x790ba3,_0x5ea89b[_0xe509('0x43')]);return _0x398342[_0xe509('0x51')](_0x790ba3);}})[_0xe509('0x27')](function(_0x46f125){if(_0x46f125){_0x1f1d30=_0x46f125[_0xe509('0x37')];if(!_0x5ea89b[_0xe509('0x32')][_0xe509('0x38')]('nolimit')){_0x790ba3[_0xe509('0x1f')]=qs[_0xe509('0x1f')](_0x5ea89b[_0xe509('0x32')]['limit']);_0x790ba3['offset']=qs[_0xe509('0x1d')](_0x5ea89b[_0xe509('0x32')][_0xe509('0x1d')]);}return _0x398342[_0xe509('0x51')](_0x790ba3);}})[_0xe509('0x27')](function(_0x4df2f6){if(_0x4df2f6){return _0x4df2f6?{'count':_0x1f1d30,'rows':_0x4df2f6}:null;}})['then'](respondWithResult(_0x5626d6,null))[_0xe509('0x47')](handleError(_0x5626d6,null));};exports[_0xe509('0x52')]=function(_0x2b352d,_0x4f94b6,_0xc016dc){var _0x34b8b8={};var _0x5e787c={};var _0x5141bc;var _0xdccc3b;return db[_0xe509('0x2e')]['findOne']({'where':{'id':_0x2b352d['params']['id']}})[_0xe509('0x27')](handleEntityNotFound(_0x4f94b6,null))[_0xe509('0x27')](function(_0x132cd8){if(_0x132cd8){_0x5141bc=_0x132cd8;_0x5e787c[_0xe509('0x31')]=_[_0xe509('0x33')](db[_0xe509('0x50')]['rawAttributes']);_0x5e787c[_0xe509('0x32')]=_[_0xe509('0x33')](_0x2b352d[_0xe509('0x32')]);_0x5e787c['filters']=_[_0xe509('0x34')](_0x5e787c[_0xe509('0x31')],_0x5e787c[_0xe509('0x32')]);_0x34b8b8[_0xe509('0x36')]=_[_0xe509('0x34')](_0x5e787c[_0xe509('0x31')],qs[_0xe509('0x35')](_0x2b352d['query'][_0xe509('0x35')]));_0x34b8b8[_0xe509('0x36')]=_0x34b8b8[_0xe509('0x36')][_0xe509('0x37')]?_0x34b8b8[_0xe509('0x36')]:_0x5e787c['model'];_0x34b8b8[_0xe509('0x3a')]=qs[_0xe509('0x3b')](_0x2b352d[_0xe509('0x32')][_0xe509('0x3b')]);_0x34b8b8[_0xe509('0x3c')]=qs[_0xe509('0x3d')](_[_0xe509('0x3e')](_0x2b352d[_0xe509('0x32')],_0x5e787c[_0xe509('0x3d')]));if(_0x2b352d[_0xe509('0x32')][_0xe509('0x41')]){_0x34b8b8[_0xe509('0x3c')]=_[_0xe509('0x42')](_0x34b8b8[_0xe509('0x3c')],{'$or':_[_0xe509('0x2d')](_0x34b8b8['attributes'],function(_0x50e4e7){var _0x6d3d77={};_0x6d3d77[_0x50e4e7]={'$like':'%'+_0x2b352d['query'][_0xe509('0x41')]+'%'};return _0x6d3d77;})});}_0x34b8b8=_[_0xe509('0x42')]({},_0x34b8b8,_0x2b352d[_0xe509('0x43')]);return _0x5141bc[_0xe509('0x52')](_0x34b8b8);}})[_0xe509('0x27')](function(_0x3a00f8){if(_0x3a00f8){_0xdccc3b=_0x3a00f8['length'];if(!_0x2b352d[_0xe509('0x32')][_0xe509('0x38')](_0xe509('0x39'))){_0x34b8b8['limit']=qs['limit'](_0x2b352d[_0xe509('0x32')][_0xe509('0x1f')]);_0x34b8b8['offset']=qs['offset'](_0x2b352d[_0xe509('0x32')][_0xe509('0x1d')]);}return _0x5141bc[_0xe509('0x52')](_0x34b8b8);}})[_0xe509('0x27')](function(_0x45b8bb){if(_0x45b8bb){return _0x45b8bb?{'count':_0xdccc3b,'rows':_0x45b8bb}:null;}})[_0xe509('0x27')](respondWithResult(_0x4f94b6,null))[_0xe509('0x47')](handleError(_0x4f94b6,null));};exports['getTags']=function(_0x59d1bb,_0x1038a2,_0x3be644){var _0x189407={};var _0x3ef48c={};var _0x140168;var _0x84a6e1;return db[_0xe509('0x2e')]['findOne']({'where':{'id':_0x59d1bb[_0xe509('0x49')]['id']}})['then'](handleEntityNotFound(_0x1038a2,null))[_0xe509('0x27')](function(_0x26d9b0){if(_0x26d9b0){_0x140168=_0x26d9b0;_0x3ef48c['model']=_[_0xe509('0x33')](db[_0xe509('0x53')]['rawAttributes']);_0x3ef48c[_0xe509('0x32')]=_['keys'](_0x59d1bb['query']);_0x3ef48c['filters']=_['intersection'](_0x3ef48c[_0xe509('0x31')],_0x3ef48c[_0xe509('0x32')]);_0x189407[_0xe509('0x36')]=_['intersection'](_0x3ef48c[_0xe509('0x31')],qs['fields'](_0x59d1bb[_0xe509('0x32')][_0xe509('0x35')]));_0x189407[_0xe509('0x36')]=_0x189407[_0xe509('0x36')][_0xe509('0x37')]?_0x189407[_0xe509('0x36')]:_0x3ef48c['model'];_0x189407[_0xe509('0x3a')]=qs['sort'](_0x59d1bb[_0xe509('0x32')][_0xe509('0x3b')]);_0x189407['where']=qs[_0xe509('0x3d')](_['pick'](_0x59d1bb['query'],_0x3ef48c['filters']));if(_0x59d1bb[_0xe509('0x32')]['filter']){_0x189407['where']=_['merge'](_0x189407['where'],{'$or':_[_0xe509('0x2d')](_0x189407['attributes'],function(_0x30d56b){var _0x3f8a61={};_0x3f8a61[_0x30d56b]={'$like':'%'+_0x59d1bb[_0xe509('0x32')][_0xe509('0x41')]+'%'};return _0x3f8a61;})});}_0x189407=_[_0xe509('0x42')]({},_0x189407,_0x59d1bb['options']);return _0x140168[_0xe509('0x54')](_0x189407);}})[_0xe509('0x27')](function(_0x1439d0){if(_0x1439d0){_0x84a6e1=_0x1439d0['length'];if(!_0x59d1bb[_0xe509('0x32')][_0xe509('0x38')](_0xe509('0x39'))){_0x189407[_0xe509('0x1f')]=qs['limit'](_0x59d1bb[_0xe509('0x32')][_0xe509('0x1f')]);_0x189407[_0xe509('0x1d')]=qs[_0xe509('0x1d')](_0x59d1bb[_0xe509('0x32')][_0xe509('0x1d')]);}return _0x140168[_0xe509('0x54')](_0x189407);}})[_0xe509('0x27')](function(_0xaa060){if(_0xaa060){return _0xaa060?{'count':_0x84a6e1,'rows':_0xaa060}:null;}})[_0xe509('0x27')](respondWithResult(_0x1038a2,null))[_0xe509('0x47')](handleError(_0x1038a2,null));};exports[_0xe509('0x55')]=function(_0x4eaa52,_0x43ec4e,_0x447a33){if(_0x4eaa52[_0xe509('0x4d')]['id']){delete _0x4eaa52[_0xe509('0x4d')]['id'];}return db[_0xe509('0x2e')][_0xe509('0x4f')]({'where':{'id':_0x4eaa52[_0xe509('0x49')]['id']}})[_0xe509('0x27')](handleEntityNotFound(_0x43ec4e,null))[_0xe509('0x27')](function(_0x4c092b){if(_0x4c092b){return _0x4c092b[_0xe509('0x55')](_0x4eaa52[_0xe509('0x4d')][_0xe509('0x56')]||[]);}return null;})[_0xe509('0x27')](respondWithResult(_0x43ec4e,null))[_0xe509('0x47')](handleError(_0x43ec4e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 97a3f15..d248f89 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 _0xa6da=['moment','request-promise','path','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','util','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa6da,0x1a9));var _0xaa6d=function(_0x24e574,_0x5774cf){_0x24e574=_0x24e574-0x0;var _0x330234=_0xa6da[_0x24e574];return _0x330234;};'use strict';var _=require(_0xaa6d('0x0'));var util=require(_0xaa6d('0x1'));var logger=require(_0xaa6d('0x2'))(_0xaa6d('0x3'));var moment=require(_0xaa6d('0x4'));var BPromise=require('bluebird');var rp=require(_0xaa6d('0x5'));var fs=require('fs');var path=require(_0xaa6d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaa6d('0x7'));module[_0xaa6d('0x8')]=function(_0x535402,_0x402690){return _0x535402[_0xaa6d('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0xaa6d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9247=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','lodash','util','../../config/logger','api'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x9247,0x1a9));var _0x7924=function(_0x11d486,_0x275600){_0x11d486=_0x11d486-0x0;var _0x24695b=_0x9247[_0x11d486];return _0x24695b;};'use strict';var _=require(_0x7924('0x0'));var util=require(_0x7924('0x1'));var logger=require(_0x7924('0x2'))(_0x7924('0x3'));var moment=require(_0x7924('0x4'));var BPromise=require(_0x7924('0x5'));var rp=require(_0x7924('0x6'));var fs=require('fs');var path=require(_0x7924('0x7'));var rimraf=require(_0x7924('0x8'));var config=require(_0x7924('0x9'));var attributes=require(_0x7924('0xa'));module['exports']=function(_0x3af0fe,_0x207dca){return _0x3af0fe[_0x7924('0xb')](_0x7924('0xc'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 4adeed6..8a739e9 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 _0x6eeb=['result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x348e46,_0x5187dc){var _0x58b74f=function(_0x5e2f00){while(--_0x5e2f00){_0x348e46['push'](_0x348e46['shift']());}};_0x58b74f(++_0x5187dc);}(_0x6eeb,0x14b));var _0xb6ee=function(_0x22382f,_0x5c2e54){_0x22382f=_0x22382f-0x0;var _0x35213b=_0x6eeb[_0x22382f];return _0x35213b;};'use strict';var _=require(_0xb6ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb6ee('0x1'));var rs=require(_0xb6ee('0x2'));var fs=require('fs');var Redis=require(_0xb6ee('0x3'));var db=require(_0xb6ee('0x4'))['db'];var utils=require(_0xb6ee('0x5'));var logger=require(_0xb6ee('0x6'))('rpc');var config=require(_0xb6ee('0x7'));var jayson=require(_0xb6ee('0x8'));var client=jayson[_0xb6ee('0x9')][_0xb6ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19909f,_0x4791d3,_0x122506){return new BPromise(function(_0x56d52e,_0x1e3663){return client[_0xb6ee('0xb')](_0x19909f,_0x122506)['then'](function(_0x1ec2b1){logger['info'](_0xb6ee('0xc'),_0x4791d3,_0xb6ee('0xd'));logger[_0xb6ee('0xe')](_0xb6ee('0xf'),_0x4791d3,_0xb6ee('0xd'),JSON[_0xb6ee('0x10')](_0x1ec2b1));if(_0x1ec2b1['error']){if(_0x1ec2b1[_0xb6ee('0x11')][_0xb6ee('0x12')]===0x1f4){logger['error'](_0xb6ee('0xc'),_0x4791d3,_0x1ec2b1[_0xb6ee('0x11')]['message']);return _0x1e3663(_0x1ec2b1['error'][_0xb6ee('0x13')]);}logger['error'](_0xb6ee('0xc'),_0x4791d3,_0x1ec2b1[_0xb6ee('0x11')][_0xb6ee('0x13')]);return _0x56d52e(_0x1ec2b1['error'][_0xb6ee('0x13')]);}else{logger[_0xb6ee('0x14')](_0xb6ee('0xc'),_0x4791d3,_0xb6ee('0xd'));_0x56d52e(_0x1ec2b1[_0xb6ee('0x15')]['message']);}})['catch'](function(_0x5adad0){logger[_0xb6ee('0x11')](_0xb6ee('0xc'),_0x4791d3,_0x5adad0);_0x1e3663(_0x5adad0);});});} \ No newline at end of file +var _0xd764=['../../config/utils','../../config/environment','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5c469a,_0x1eec70){var _0x270dda=function(_0x2dea52){while(--_0x2dea52){_0x5c469a['push'](_0x5c469a['shift']());}};_0x270dda(++_0x1eec70);}(_0xd764,0x140));var _0x4d76=function(_0x387703,_0x24d046){_0x387703=_0x387703-0x0;var _0x4ca897=_0xd764[_0x387703];return _0x4ca897;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4d76('0x0'));var BPromise=require(_0x4d76('0x1'));var rs=require(_0x4d76('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d76('0x3'))['db'];var utils=require(_0x4d76('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4d76('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4d76('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2105e7,_0x4abeb1,_0x41ae80){return new BPromise(function(_0x3b7c35,_0x43d2fa){return client[_0x4d76('0x7')](_0x2105e7,_0x41ae80)[_0x4d76('0x8')](function(_0x2ab5d4){logger[_0x4d76('0x9')](_0x4d76('0xa'),_0x4abeb1,'request\x20sent');logger[_0x4d76('0xb')](_0x4d76('0xc'),_0x4abeb1,_0x4d76('0xd'),JSON['stringify'](_0x2ab5d4));if(_0x2ab5d4[_0x4d76('0xe')]){if(_0x2ab5d4[_0x4d76('0xe')][_0x4d76('0xf')]===0x1f4){logger['error'](_0x4d76('0xa'),_0x4abeb1,_0x2ab5d4[_0x4d76('0xe')][_0x4d76('0x10')]);return _0x43d2fa(_0x2ab5d4[_0x4d76('0xe')][_0x4d76('0x10')]);}logger[_0x4d76('0xe')](_0x4d76('0xa'),_0x4abeb1,_0x2ab5d4[_0x4d76('0xe')][_0x4d76('0x10')]);return _0x3b7c35(_0x2ab5d4[_0x4d76('0xe')][_0x4d76('0x10')]);}else{logger[_0x4d76('0x9')](_0x4d76('0xa'),_0x4abeb1,_0x4d76('0xd'));_0x3b7c35(_0x2ab5d4[_0x4d76('0x11')][_0x4d76('0x10')]);}})['catch'](function(_0x438609){logger[_0x4d76('0xe')](_0x4d76('0xa'),_0x4abeb1,_0x438609);_0x43d2fa(_0x438609);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index be9f626..c6760e8 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 _0xef60=['update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xef60,0x1cc));var _0x0ef6=function(_0x2ae5ee,_0x58604f){_0x2ae5ee=_0x2ae5ee-0x0;var _0x31e2c9=_0xef60[_0x2ae5ee];return _0x31e2c9;};'use strict';var multer=require('multer');var util=require(_0x0ef6('0x0'));var path=require(_0x0ef6('0x1'));var timeout=require('connect-timeout');var express=require(_0x0ef6('0x2'));var router=express[_0x0ef6('0x3')]();var fs_extra=require(_0x0ef6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0ef6('0x5'));var config=require(_0x0ef6('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x0ef6('0x7')]('/',auth['isAuthenticated'](),controller[_0x0ef6('0x8')]);router[_0x0ef6('0x7')](_0x0ef6('0x9'),auth[_0x0ef6('0xa')](),controller[_0x0ef6('0xb')]);router[_0x0ef6('0xc')]('/',auth[_0x0ef6('0xa')](),controller[_0x0ef6('0xd')]);router[_0x0ef6('0xe')](_0x0ef6('0x9'),auth[_0x0ef6('0xa')](),controller[_0x0ef6('0xf')]);router[_0x0ef6('0x10')](_0x0ef6('0x9'),auth['isAuthenticated'](),controller[_0x0ef6('0x11')]);module[_0x0ef6('0x12')]=router; \ No newline at end of file +var _0x05da=['index','/:id','show','create','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x38d77d,_0x129b8c){var _0xa8cfd2=function(_0x35e427){while(--_0x35e427){_0x38d77d['push'](_0x38d77d['shift']());}};_0xa8cfd2(++_0x129b8c);}(_0x05da,0x104));var _0xa05d=function(_0x28a342,_0x16b671){_0x28a342=_0x28a342-0x0;var _0x52989c=_0x05da[_0x28a342];return _0x52989c;};'use strict';var multer=require('multer');var util=require(_0xa05d('0x0'));var path=require(_0xa05d('0x1'));var timeout=require('connect-timeout');var express=require(_0xa05d('0x2'));var router=express[_0xa05d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa05d('0x4'));var interaction=require(_0xa05d('0x5'));var config=require(_0xa05d('0x6'));var controller=require(_0xa05d('0x7'));router[_0xa05d('0x8')]('/',auth[_0xa05d('0x9')](),controller[_0xa05d('0xa')]);router[_0xa05d('0x8')](_0xa05d('0xb'),auth['isAuthenticated'](),controller[_0xa05d('0xc')]);router['post']('/',auth[_0xa05d('0x9')](),controller[_0xa05d('0xd')]);router['put'](_0xa05d('0xb'),auth[_0xa05d('0x9')](),controller[_0xa05d('0xe')]);router[_0xa05d('0xf')](_0xa05d('0xb'),auth[_0xa05d('0x9')](),controller[_0xa05d('0x10')]);module[_0xa05d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 61feee0..df068ea 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 _0x9132=['picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x530a89,_0x76ec1a){var _0x5947bc=function(_0x2b62f0){while(--_0x2b62f0){_0x530a89['push'](_0x530a89['shift']());}};_0x5947bc(++_0x76ec1a);}(_0x9132,0x112));var _0x2913=function(_0x485852,_0x57d50b){_0x485852=_0x485852-0x0;var _0x32df4e=_0x9132[_0x485852];return _0x32df4e;};'use strict';var Sequelize=require(_0x2913('0x0'));module[_0x2913('0x1')]={'type':{'type':Sequelize[_0x2913('0x2')](_0x2913('0x3'),_0x2913('0x4'),'customVariable',_0x2913('0x5'),_0x2913('0x6')),'defaultValue':_0x2913('0x3')},'content':{'type':Sequelize[_0x2913('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2913('0x2')](_0x2913('0x3'),_0x2913('0x4'),_0x2913('0x8'))},'keyContent':{'type':Sequelize[_0x2913('0x7')]},'idField':{'type':Sequelize[_0x2913('0x7')]},'nameField':{'type':Sequelize[_0x2913('0x7')]},'customField':{'type':Sequelize[_0x2913('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x948d=['variable','customVariable','keyValue','picklist','STRING','sequelize','ENUM','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x948d,0xfd));var _0xd948=function(_0x2ab857,_0x5d3853){_0x2ab857=_0x2ab857-0x0;var _0x523303=_0x948d[_0x2ab857];return _0x523303;};'use strict';var Sequelize=require(_0xd948('0x0'));module['exports']={'type':{'type':Sequelize[_0xd948('0x1')](_0xd948('0x2'),_0xd948('0x3'),_0xd948('0x4'),_0xd948('0x5'),_0xd948('0x6')),'defaultValue':_0xd948('0x2')},'content':{'type':Sequelize[_0xd948('0x7')]},'key':{'type':Sequelize[_0xd948('0x7')]},'keyType':{'type':Sequelize[_0xd948('0x1')]('string',_0xd948('0x3'),_0xd948('0x4'))},'keyContent':{'type':Sequelize[_0xd948('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd948('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 47f96c1..5c47e11 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 _0x9aea=['sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','status','Content-Range','apply','reject','destroy','then','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','create','body','update','find','eml-format','zip-dir','request-promise','moment','mustache','util','path'];(function(_0xa5e821,_0x4dd2f6){var _0x62d0cd=function(_0x119f86){while(--_0x119f86){_0xa5e821['push'](_0xa5e821['shift']());}};_0x62d0cd(++_0x4dd2f6);}(_0x9aea,0xdd));var _0xa9ae=function(_0x28b15d,_0x44a2dd){_0x28b15d=_0x28b15d-0x0;var _0x588241=_0x9aea[_0x28b15d];return _0x588241;};'use strict';var emlformat=require(_0xa9ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa9ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9ae('0x2'));var moment=require(_0xa9ae('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa9ae('0x4'));var util=require(_0xa9ae('0x5'));var path=require(_0xa9ae('0x6'));var sox=require(_0xa9ae('0x7'));var csv=require(_0xa9ae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9ae('0x9'));var _=require(_0xa9ae('0xa'));var squel=require(_0xa9ae('0xb'));var crypto=require('crypto');var jsforce=require(_0xa9ae('0xc'));var deskjs=require(_0xa9ae('0xd'));var toCsv=require(_0xa9ae('0x8'));var querystring=require(_0xa9ae('0xe'));var Papa=require(_0xa9ae('0xf'));var Redis=require(_0xa9ae('0x10'));var authService=require(_0xa9ae('0x11'));var qs=require(_0xa9ae('0x12'));var as=require(_0xa9ae('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9ae('0x14'))('api');var utils=require(_0xa9ae('0x15'));var config=require(_0xa9ae('0x16'));var licenseUtil=require(_0xa9ae('0x17'));var db=require(_0xa9ae('0x18'))['db'];function respondWithStatusCode(_0x35f861,_0x33a72f){_0x33a72f=_0x33a72f||0xcc;return function(_0xa34271){if(_0xa34271){return _0x35f861[_0xa9ae('0x19')](_0x33a72f);}return _0x35f861['status'](_0x33a72f)[_0xa9ae('0x1a')]();};}function respondWithResult(_0x365e90,_0x10882e){_0x10882e=_0x10882e||0xc8;return function(_0x3f7f61){if(_0x3f7f61){return _0x365e90['status'](_0x10882e)[_0xa9ae('0x1b')](_0x3f7f61);}};}function respondWithFilteredResult(_0x1ec742,_0x31c03e){return function(_0x40b756){if(_0x40b756){var _0x77b0a4=typeof _0x31c03e[_0xa9ae('0x1c')]==='undefined'&&typeof _0x31c03e[_0xa9ae('0x1d')]===_0xa9ae('0x1e');var _0x3e31d9=_0x40b756['count'];var _0x4dbb30=_0x77b0a4?0x0:_0x31c03e[_0xa9ae('0x1c')];var _0x581345=_0x77b0a4?_0x40b756['count']:_0x31c03e[_0xa9ae('0x1c')]+_0x31c03e[_0xa9ae('0x1d')];var _0xbfd2ff;if(_0x581345>=_0x3e31d9){_0x581345=_0x3e31d9;_0xbfd2ff=0xc8;}else{_0xbfd2ff=0xce;}_0x1ec742[_0xa9ae('0x1f')](_0xbfd2ff);return _0x1ec742['set'](_0xa9ae('0x20'),_0x4dbb30+'-'+_0x581345+'/'+_0x3e31d9)[_0xa9ae('0x1b')](_0x40b756);}return null;};}function patchUpdates(_0x39f133){return function(_0x688153){try{jsonpatch[_0xa9ae('0x21')](_0x688153,_0x39f133,!![]);}catch(_0x2e204d){return BPromise[_0xa9ae('0x22')](_0x2e204d);}return _0x688153['save']();};}function saveUpdates(_0xc021cf,_0x4ca9a9){return function(_0x49dca9){if(_0x49dca9){return _0x49dca9['update'](_0xc021cf)['then'](function(_0x1afd07){return _0x1afd07;});}return null;};}function removeEntity(_0x4edd55,_0x13fb05){return function(_0x5093ad){if(_0x5093ad){return _0x5093ad[_0xa9ae('0x23')]()[_0xa9ae('0x24')](function(){_0x4edd55[_0xa9ae('0x1f')](0xcc)[_0xa9ae('0x1a')]();});}};}function handleEntityNotFound(_0x12b061,_0x3f3f97){return function(_0x23c1ec){if(!_0x23c1ec){_0x12b061['sendStatus'](0x194);}return _0x23c1ec;};}function handleError(_0x3eb591,_0x3873aa){_0x3873aa=_0x3873aa||0x1f4;return function(_0x2aac9e){logger[_0xa9ae('0x25')](_0x2aac9e[_0xa9ae('0x26')]);if(_0x2aac9e[_0xa9ae('0x27')]){delete _0x2aac9e[_0xa9ae('0x27')];}_0x3eb591['status'](_0x3873aa)['send'](_0x2aac9e);};}exports[_0xa9ae('0x28')]=function(_0x3c324e,_0x3d1131){var _0x3d84d7={},_0x74cd94={},_0x54a821={'count':0x0,'rows':[]};var _0x52dd4f=_[_0xa9ae('0x29')](db[_0xa9ae('0x2a')][_0xa9ae('0x2b')],function(_0x3a48b7){return{'name':_0x3a48b7[_0xa9ae('0x2c')],'type':_0x3a48b7[_0xa9ae('0x2d')]['key']};});_0x74cd94['model']=_[_0xa9ae('0x29')](_0x52dd4f,_0xa9ae('0x27'));_0x74cd94[_0xa9ae('0x2e')]=_[_0xa9ae('0x2f')](_0x3c324e[_0xa9ae('0x2e')]);_0x74cd94[_0xa9ae('0x30')]=_[_0xa9ae('0x31')](_0x74cd94[_0xa9ae('0x32')],_0x74cd94['query']);_0x3d84d7[_0xa9ae('0x33')]=_['intersection'](_0x74cd94[_0xa9ae('0x32')],qs[_0xa9ae('0x34')](_0x3c324e[_0xa9ae('0x2e')]['fields']));_0x3d84d7[_0xa9ae('0x33')]=_0x3d84d7[_0xa9ae('0x33')][_0xa9ae('0x35')]?_0x3d84d7[_0xa9ae('0x33')]:_0x74cd94[_0xa9ae('0x32')];if(!_0x3c324e['query'][_0xa9ae('0x36')](_0xa9ae('0x37'))){_0x3d84d7[_0xa9ae('0x1d')]=qs['limit'](_0x3c324e['query'][_0xa9ae('0x1d')]);_0x3d84d7[_0xa9ae('0x1c')]=qs[_0xa9ae('0x1c')](_0x3c324e[_0xa9ae('0x2e')]['offset']);}_0x3d84d7[_0xa9ae('0x38')]=qs[_0xa9ae('0x39')](_0x3c324e[_0xa9ae('0x2e')][_0xa9ae('0x39')]);_0x3d84d7[_0xa9ae('0x3a')]=qs['filters'](_[_0xa9ae('0x3b')](_0x3c324e['query'],_0x74cd94[_0xa9ae('0x30')]),_0x52dd4f);if(_0x3c324e[_0xa9ae('0x2e')][_0xa9ae('0x3c')]){_0x3d84d7['where']=_[_0xa9ae('0x3d')](_0x3d84d7[_0xa9ae('0x3a')],{'$or':_[_0xa9ae('0x29')](_0x52dd4f,function(_0x48d36b){if(_0x48d36b[_0xa9ae('0x2d')]!==_0xa9ae('0x3e')){var _0x4e2001={};_0x4e2001[_0x48d36b[_0xa9ae('0x27')]]={'$like':'%'+_0x3c324e['query'][_0xa9ae('0x3c')]+'%'};return _0x4e2001;}})});}_0x3d84d7=_[_0xa9ae('0x3d')]({},_0x3d84d7,_0x3c324e['options']);var _0x37da9b={'where':_0x3d84d7[_0xa9ae('0x3a')]};return db[_0xa9ae('0x2a')][_0xa9ae('0x3f')](_0x37da9b)[_0xa9ae('0x24')](function(_0xf48d22){_0x54a821['count']=_0xf48d22;if(_0x3c324e[_0xa9ae('0x2e')][_0xa9ae('0x40')]){_0x3d84d7['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xa9ae('0x41')](_0x3d84d7);})[_0xa9ae('0x24')](function(_0xc4f775){_0x54a821[_0xa9ae('0x42')]=_0xc4f775;return _0x54a821;})['then'](respondWithFilteredResult(_0x3d1131,_0x3d84d7))[_0xa9ae('0x43')](handleError(_0x3d1131,null));};exports[_0xa9ae('0x44')]=function(_0x20dd83,_0x42dab2){var _0x23c91d={'raw':!![],'where':{'id':_0x20dd83[_0xa9ae('0x45')]['id']}},_0x2bef06={};_0x2bef06['model']=_[_0xa9ae('0x2f')](db[_0xa9ae('0x2a')]['rawAttributes']);_0x2bef06[_0xa9ae('0x2e')]=_['keys'](_0x20dd83[_0xa9ae('0x2e')]);_0x2bef06[_0xa9ae('0x30')]=_[_0xa9ae('0x31')](_0x2bef06[_0xa9ae('0x32')],_0x2bef06[_0xa9ae('0x2e')]);_0x23c91d[_0xa9ae('0x33')]=_[_0xa9ae('0x31')](_0x2bef06['model'],qs[_0xa9ae('0x34')](_0x20dd83[_0xa9ae('0x2e')]['fields']));_0x23c91d[_0xa9ae('0x33')]=_0x23c91d[_0xa9ae('0x33')][_0xa9ae('0x35')]?_0x23c91d[_0xa9ae('0x33')]:_0x2bef06[_0xa9ae('0x32')];if(_0x20dd83[_0xa9ae('0x2e')]['includeAll']){_0x23c91d[_0xa9ae('0x46')]=[{'all':!![]}];}_0x23c91d=_['merge']({},_0x23c91d,_0x20dd83[_0xa9ae('0x47')]);return db[_0xa9ae('0x2a')]['find'](_0x23c91d)['then'](handleEntityNotFound(_0x42dab2,null))[_0xa9ae('0x24')](respondWithResult(_0x42dab2,null))[_0xa9ae('0x43')](handleError(_0x42dab2,null));};exports[_0xa9ae('0x48')]=function(_0x47615f,_0x435c29){return db[_0xa9ae('0x2a')][_0xa9ae('0x48')](_0x47615f[_0xa9ae('0x49')],{})['then'](respondWithResult(_0x435c29,0xc9))['catch'](handleError(_0x435c29,null));};exports[_0xa9ae('0x4a')]=function(_0x3cf89c,_0x4efe55){if(_0x3cf89c[_0xa9ae('0x49')]['id']){delete _0x3cf89c[_0xa9ae('0x49')]['id'];}return db[_0xa9ae('0x2a')][_0xa9ae('0x4b')]({'where':{'id':_0x3cf89c[_0xa9ae('0x45')]['id']}})[_0xa9ae('0x24')](handleEntityNotFound(_0x4efe55,null))[_0xa9ae('0x24')](saveUpdates(_0x3cf89c[_0xa9ae('0x49')],null))['then'](respondWithResult(_0x4efe55,null))[_0xa9ae('0x43')](handleError(_0x4efe55,null));};exports[_0xa9ae('0x23')]=function(_0x5ea18d,_0x128f88){return db['FreshdeskField']['find']({'where':{'id':_0x5ea18d['params']['id']}})[_0xa9ae('0x24')](handleEntityNotFound(_0x128f88,null))[_0xa9ae('0x24')](removeEntity(_0x128f88,null))['catch'](handleError(_0x128f88,null));}; \ No newline at end of file +var _0xfc03=['to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','keys','rawAttributes','find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox'];(function(_0x8066c9,_0x5e6f8a){var _0x505a5f=function(_0x1e76dd){while(--_0x1e76dd){_0x8066c9['push'](_0x8066c9['shift']());}};_0x505a5f(++_0x5e6f8a);}(_0xfc03,0x16f));var _0x3fc0=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xfc03[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x3fc0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fc0('0x1'));var jsonpatch=require(_0x3fc0('0x2'));var rp=require('request-promise');var moment=require(_0x3fc0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fc0('0x4'));var util=require(_0x3fc0('0x5'));var path=require(_0x3fc0('0x6'));var sox=require(_0x3fc0('0x7'));var csv=require(_0x3fc0('0x8'));var ejs=require(_0x3fc0('0x9'));var fs=require('fs');var fs_extra=require(_0x3fc0('0xa'));var _=require(_0x3fc0('0xb'));var squel=require('squel');var crypto=require(_0x3fc0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3fc0('0xd'));var toCsv=require(_0x3fc0('0x8'));var querystring=require(_0x3fc0('0xe'));var Papa=require(_0x3fc0('0xf'));var Redis=require('ioredis');var authService=require(_0x3fc0('0x10'));var qs=require(_0x3fc0('0x11'));var as=require(_0x3fc0('0x12'));var hardwareService=require(_0x3fc0('0x13'));var logger=require(_0x3fc0('0x14'))('api');var utils=require(_0x3fc0('0x15'));var config=require(_0x3fc0('0x16'));var licenseUtil=require(_0x3fc0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1011b7,_0x582e22){_0x582e22=_0x582e22||0xcc;return function(_0x3a4cc0){if(_0x3a4cc0){return _0x1011b7[_0x3fc0('0x18')](_0x582e22);}return _0x1011b7['status'](_0x582e22)[_0x3fc0('0x19')]();};}function respondWithResult(_0x422926,_0x392c46){_0x392c46=_0x392c46||0xc8;return function(_0x4eb69a){if(_0x4eb69a){return _0x422926[_0x3fc0('0x1a')](_0x392c46)[_0x3fc0('0x1b')](_0x4eb69a);}};}function respondWithFilteredResult(_0x367ce1,_0x27619a){return function(_0x562ecc){if(_0x562ecc){var _0x277dbf=typeof _0x27619a[_0x3fc0('0x1c')]===_0x3fc0('0x1d')&&typeof _0x27619a['limit']===_0x3fc0('0x1d');var _0x491446=_0x562ecc[_0x3fc0('0x1e')];var _0x3c5026=_0x277dbf?0x0:_0x27619a['offset'];var _0x3bb388=_0x277dbf?_0x562ecc[_0x3fc0('0x1e')]:_0x27619a[_0x3fc0('0x1c')]+_0x27619a[_0x3fc0('0x1f')];var _0x1bd575;if(_0x3bb388>=_0x491446){_0x3bb388=_0x491446;_0x1bd575=0xc8;}else{_0x1bd575=0xce;}_0x367ce1[_0x3fc0('0x1a')](_0x1bd575);return _0x367ce1[_0x3fc0('0x20')](_0x3fc0('0x21'),_0x3c5026+'-'+_0x3bb388+'/'+_0x491446)[_0x3fc0('0x1b')](_0x562ecc);}return null;};}function patchUpdates(_0x5c859e){return function(_0xf13744){try{jsonpatch[_0x3fc0('0x22')](_0xf13744,_0x5c859e,!![]);}catch(_0x34ffa7){return BPromise[_0x3fc0('0x23')](_0x34ffa7);}return _0xf13744[_0x3fc0('0x24')]();};}function saveUpdates(_0x448293,_0x47c770){return function(_0x477674){if(_0x477674){return _0x477674[_0x3fc0('0x25')](_0x448293)[_0x3fc0('0x26')](function(_0x28fc65){return _0x28fc65;});}return null;};}function removeEntity(_0x46c213,_0x303dd2){return function(_0x2f423e){if(_0x2f423e){return _0x2f423e[_0x3fc0('0x27')]()[_0x3fc0('0x26')](function(){_0x46c213[_0x3fc0('0x1a')](0xcc)[_0x3fc0('0x19')]();});}};}function handleEntityNotFound(_0x1abe10,_0x784765){return function(_0xba1a23){if(!_0xba1a23){_0x1abe10[_0x3fc0('0x18')](0x194);}return _0xba1a23;};}function handleError(_0xbec5b5,_0x4f5111){_0x4f5111=_0x4f5111||0x1f4;return function(_0x365c8e){logger[_0x3fc0('0x28')](_0x365c8e[_0x3fc0('0x29')]);if(_0x365c8e[_0x3fc0('0x2a')]){delete _0x365c8e['name'];}_0xbec5b5[_0x3fc0('0x1a')](_0x4f5111)[_0x3fc0('0x2b')](_0x365c8e);};}exports[_0x3fc0('0x2c')]=function(_0x2645b4,_0x559fcc){var _0x1e4d99={},_0x1a2261={},_0x1960a4={'count':0x0,'rows':[]};var _0xac736c=_[_0x3fc0('0x2d')](db[_0x3fc0('0x2e')]['rawAttributes'],function(_0xd9ecae){return{'name':_0xd9ecae[_0x3fc0('0x2f')],'type':_0xd9ecae[_0x3fc0('0x30')][_0x3fc0('0x31')]};});_0x1a2261[_0x3fc0('0x32')]=_[_0x3fc0('0x2d')](_0xac736c,_0x3fc0('0x2a'));_0x1a2261[_0x3fc0('0x33')]=_['keys'](_0x2645b4['query']);_0x1a2261[_0x3fc0('0x34')]=_['intersection'](_0x1a2261[_0x3fc0('0x32')],_0x1a2261[_0x3fc0('0x33')]);_0x1e4d99[_0x3fc0('0x35')]=_[_0x3fc0('0x36')](_0x1a2261[_0x3fc0('0x32')],qs['fields'](_0x2645b4['query'][_0x3fc0('0x37')]));_0x1e4d99[_0x3fc0('0x35')]=_0x1e4d99[_0x3fc0('0x35')][_0x3fc0('0x38')]?_0x1e4d99[_0x3fc0('0x35')]:_0x1a2261['model'];if(!_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x39')](_0x3fc0('0x3a'))){_0x1e4d99['limit']=qs[_0x3fc0('0x1f')](_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x1f')]);_0x1e4d99[_0x3fc0('0x1c')]=qs['offset'](_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x1c')]);}_0x1e4d99['order']=qs[_0x3fc0('0x3b')](_0x2645b4['query'][_0x3fc0('0x3b')]);_0x1e4d99[_0x3fc0('0x3c')]=qs[_0x3fc0('0x34')](_[_0x3fc0('0x3d')](_0x2645b4[_0x3fc0('0x33')],_0x1a2261[_0x3fc0('0x34')]),_0xac736c);if(_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x3e')]){_0x1e4d99[_0x3fc0('0x3c')]=_[_0x3fc0('0x3f')](_0x1e4d99[_0x3fc0('0x3c')],{'$or':_['map'](_0xac736c,function(_0x6bbe04){if(_0x6bbe04[_0x3fc0('0x30')]!==_0x3fc0('0x40')){var _0x28b4d5={};_0x28b4d5[_0x6bbe04[_0x3fc0('0x2a')]]={'$like':'%'+_0x2645b4[_0x3fc0('0x33')]['filter']+'%'};return _0x28b4d5;}})});}_0x1e4d99=_['merge']({},_0x1e4d99,_0x2645b4[_0x3fc0('0x41')]);var _0x3386d2={'where':_0x1e4d99[_0x3fc0('0x3c')]};return db[_0x3fc0('0x2e')][_0x3fc0('0x1e')](_0x3386d2)['then'](function(_0x53b45e){_0x1960a4['count']=_0x53b45e;if(_0x2645b4[_0x3fc0('0x33')][_0x3fc0('0x42')]){_0x1e4d99[_0x3fc0('0x43')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x1e4d99);})[_0x3fc0('0x26')](function(_0x239dc5){_0x1960a4[_0x3fc0('0x44')]=_0x239dc5;return _0x1960a4;})[_0x3fc0('0x26')](respondWithFilteredResult(_0x559fcc,_0x1e4d99))['catch'](handleError(_0x559fcc,null));};exports['show']=function(_0x17510a,_0x2a45dc){var _0x547670={'raw':!![],'where':{'id':_0x17510a['params']['id']}},_0x32768f={};_0x32768f[_0x3fc0('0x32')]=_[_0x3fc0('0x45')](db[_0x3fc0('0x2e')][_0x3fc0('0x46')]);_0x32768f[_0x3fc0('0x33')]=_[_0x3fc0('0x45')](_0x17510a[_0x3fc0('0x33')]);_0x32768f[_0x3fc0('0x34')]=_['intersection'](_0x32768f[_0x3fc0('0x32')],_0x32768f['query']);_0x547670[_0x3fc0('0x35')]=_[_0x3fc0('0x36')](_0x32768f[_0x3fc0('0x32')],qs[_0x3fc0('0x37')](_0x17510a[_0x3fc0('0x33')]['fields']));_0x547670[_0x3fc0('0x35')]=_0x547670[_0x3fc0('0x35')][_0x3fc0('0x38')]?_0x547670[_0x3fc0('0x35')]:_0x32768f['model'];if(_0x17510a[_0x3fc0('0x33')]['includeAll']){_0x547670[_0x3fc0('0x43')]=[{'all':!![]}];}_0x547670=_[_0x3fc0('0x3f')]({},_0x547670,_0x17510a[_0x3fc0('0x41')]);return db[_0x3fc0('0x2e')][_0x3fc0('0x47')](_0x547670)['then'](handleEntityNotFound(_0x2a45dc,null))[_0x3fc0('0x26')](respondWithResult(_0x2a45dc,null))[_0x3fc0('0x48')](handleError(_0x2a45dc,null));};exports[_0x3fc0('0x49')]=function(_0x4c4aed,_0x3df404){return db[_0x3fc0('0x2e')]['create'](_0x4c4aed[_0x3fc0('0x4a')],{})[_0x3fc0('0x26')](respondWithResult(_0x3df404,0xc9))[_0x3fc0('0x48')](handleError(_0x3df404,null));};exports['update']=function(_0x5e5c73,_0x3a35ac){if(_0x5e5c73[_0x3fc0('0x4a')]['id']){delete _0x5e5c73[_0x3fc0('0x4a')]['id'];}return db['FreshdeskField'][_0x3fc0('0x47')]({'where':{'id':_0x5e5c73['params']['id']}})[_0x3fc0('0x26')](handleEntityNotFound(_0x3a35ac,null))['then'](saveUpdates(_0x5e5c73['body'],null))['then'](respondWithResult(_0x3a35ac,null))[_0x3fc0('0x48')](handleError(_0x3a35ac,null));};exports[_0x3fc0('0x27')]=function(_0x141b4c,_0x3730f5){return db[_0x3fc0('0x2e')][_0x3fc0('0x47')]({'where':{'id':_0x141b4c['params']['id']}})[_0x3fc0('0x26')](handleEntityNotFound(_0x3730f5,null))[_0x3fc0('0x26')](removeEntity(_0x3730f5,null))['catch'](handleError(_0x3730f5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 0929d85..95c3a86 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 _0x83ad=['FreshdeskField','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x83ad,0x1df));var _0xd83a=function(_0x3f9584,_0x5ab12c){_0x3f9584=_0x3f9584-0x0;var _0x9d54c=_0x83ad[_0x3f9584];return _0x9d54c;};'use strict';var _=require(_0xd83a('0x0'));var util=require(_0xd83a('0x1'));var logger=require(_0xd83a('0x2'))('api');var moment=require(_0xd83a('0x3'));var BPromise=require(_0xd83a('0x4'));var rp=require(_0xd83a('0x5'));var fs=require('fs');var path=require(_0xd83a('0x6'));var rimraf=require(_0xd83a('0x7'));var config=require(_0xd83a('0x8'));var attributes=require(_0xd83a('0x9'));module['exports']=function(_0x49b97b,_0x158c54){return _0x49b97b[_0xd83a('0xa')](_0xd83a('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xd83a('0xc'),_0xd83a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31c2=['path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','api','moment','request-promise'];(function(_0x47541b,_0x269b12){var _0x11d886=function(_0x5abc92){while(--_0x5abc92){_0x47541b['push'](_0x47541b['shift']());}};_0x11d886(++_0x269b12);}(_0x31c2,0x98));var _0x231c=function(_0x1a0703,_0x1f7b1a){_0x1a0703=_0x1a0703-0x0;var _0x5f5d11=_0x31c2[_0x1a0703];return _0x5f5d11;};'use strict';var _=require(_0x231c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x231c('0x1'));var moment=require(_0x231c('0x2'));var BPromise=require('bluebird');var rp=require(_0x231c('0x3'));var fs=require('fs');var path=require(_0x231c('0x4'));var rimraf=require(_0x231c('0x5'));var config=require(_0x231c('0x6'));var attributes=require(_0x231c('0x7'));module[_0x231c('0x8')]=function(_0x21b4df,_0x4442b9){return _0x21b4df['define'](_0x231c('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x231c('0xa'),'fields':[_0x231c('0xb'),_0x231c('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 267c49e..039cd5b 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 _0x5768=['debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s'];(function(_0x42322d,_0x5567b8){var _0x409906=function(_0x591bb6){while(--_0x591bb6){_0x42322d['push'](_0x42322d['shift']());}};_0x409906(++_0x5567b8);}(_0x5768,0x19f));var _0x8576=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x5768[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x8576('0x0'));var util=require(_0x8576('0x1'));var moment=require(_0x8576('0x2'));var BPromise=require(_0x8576('0x3'));var rs=require(_0x8576('0x4'));var fs=require('fs');var Redis=require(_0x8576('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8576('0x6'));var logger=require(_0x8576('0x7'))(_0x8576('0x8'));var config=require(_0x8576('0x9'));var jayson=require(_0x8576('0xa'));var client=jayson[_0x8576('0xb')][_0x8576('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a60e5,_0x241221,_0x560e53){return new BPromise(function(_0x5f23de,_0x19cb40){return client[_0x8576('0xd')](_0x2a60e5,_0x560e53)[_0x8576('0xe')](function(_0xd1396a){logger[_0x8576('0xf')](_0x8576('0x10'),_0x241221,'request\x20sent');logger[_0x8576('0x11')](_0x8576('0x12'),_0x241221,_0x8576('0x13'),JSON[_0x8576('0x14')](_0xd1396a));if(_0xd1396a[_0x8576('0x15')]){if(_0xd1396a[_0x8576('0x15')]['code']===0x1f4){logger['error'](_0x8576('0x10'),_0x241221,_0xd1396a[_0x8576('0x15')][_0x8576('0x16')]);return _0x19cb40(_0xd1396a[_0x8576('0x15')]['message']);}logger[_0x8576('0x15')](_0x8576('0x10'),_0x241221,_0xd1396a[_0x8576('0x15')]['message']);return _0x5f23de(_0xd1396a[_0x8576('0x15')][_0x8576('0x16')]);}else{logger['info'](_0x8576('0x10'),_0x241221,_0x8576('0x13'));_0x5f23de(_0xd1396a['result']['message']);}})[_0x8576('0x17')](function(_0x65faff){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x241221,_0x65faff);_0x19cb40(_0x65faff);});});} \ No newline at end of file +var _0xcb08=['info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1e5963,_0x4d5f26){var _0x4853ab=function(_0xabd544){while(--_0xabd544){_0x1e5963['push'](_0x1e5963['shift']());}};_0x4853ab(++_0x4d5f26);}(_0xcb08,0xa3));var _0x8cb0=function(_0x11f2fa,_0x38520b){_0x11f2fa=_0x11f2fa-0x0;var _0x5ea329=_0xcb08[_0x11f2fa];return _0x5ea329;};'use strict';var _=require(_0x8cb0('0x0'));var util=require(_0x8cb0('0x1'));var moment=require(_0x8cb0('0x2'));var BPromise=require(_0x8cb0('0x3'));var rs=require(_0x8cb0('0x4'));var fs=require('fs');var Redis=require(_0x8cb0('0x5'));var db=require(_0x8cb0('0x6'))['db'];var utils=require(_0x8cb0('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x8cb0('0x8'));var jayson=require(_0x8cb0('0x9'));var client=jayson[_0x8cb0('0xa')][_0x8cb0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10e25f,_0x3caf23,_0x5e218b){return new BPromise(function(_0x389970,_0x354309){return client[_0x8cb0('0xc')](_0x10e25f,_0x5e218b)[_0x8cb0('0xd')](function(_0x488c2c){logger['info'](_0x8cb0('0xe'),_0x3caf23,'request\x20sent');logger['debug'](_0x8cb0('0xf'),_0x3caf23,_0x8cb0('0x10'),JSON[_0x8cb0('0x11')](_0x488c2c));if(_0x488c2c['error']){if(_0x488c2c[_0x8cb0('0x12')][_0x8cb0('0x13')]===0x1f4){logger[_0x8cb0('0x12')](_0x8cb0('0xe'),_0x3caf23,_0x488c2c[_0x8cb0('0x12')]['message']);return _0x354309(_0x488c2c[_0x8cb0('0x12')][_0x8cb0('0x14')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x3caf23,_0x488c2c[_0x8cb0('0x12')][_0x8cb0('0x14')]);return _0x389970(_0x488c2c['error']['message']);}else{logger[_0x8cb0('0x15')]('FreshdeskField,\x20%s,\x20%s',_0x3caf23,_0x8cb0('0x10'));_0x389970(_0x488c2c[_0x8cb0('0x16')][_0x8cb0('0x14')]);}})['catch'](function(_0x503be7){logger['error'](_0x8cb0('0xe'),_0x3caf23,_0x503be7);_0x354309(_0x503be7);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 40b9377..3877ac3 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 _0xa75b=['post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields'];(function(_0x3b8c7e,_0x2a6013){var _0xa71c6e=function(_0x397609){while(--_0x397609){_0x3b8c7e['push'](_0x3b8c7e['shift']());}};_0xa71c6e(++_0x2a6013);}(_0xa75b,0x170));var _0xba75=function(_0x42fde7,_0x3372b7){_0x42fde7=_0x42fde7-0x0;var _0x632f66=_0xa75b[_0x42fde7];return _0x632f66;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xba75('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['get'](_0xba75('0xe'),auth[_0xba75('0xa')](),controller[_0xba75('0xf')]);router[_0xba75('0x10')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x10')](_0xba75('0x12'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);router[_0xba75('0x14')](_0xba75('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xba75('0x15')]('/:id',auth[_0xba75('0xa')](),controller[_0xba75('0x16')]);module[_0xba75('0x17')]=router; \ No newline at end of file +var _0xbc9d=['express','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout'];(function(_0x42aa1c,_0x271da2){var _0x51f28b=function(_0x3c688a){while(--_0x3c688a){_0x42aa1c['push'](_0x42aa1c['shift']());}};_0x51f28b(++_0x271da2);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x5b1f5b,_0x6dae4d){_0x5b1f5b=_0x5b1f5b-0x0;var _0x43a0f0=_0xbc9d[_0x5b1f5b];return _0x43a0f0;};'use strict';var multer=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var path=require(_0xdbc9('0x2'));var timeout=require(_0xdbc9('0x3'));var express=require(_0xdbc9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbc9('0x5'));var config=require(_0xdbc9('0x6'));var controller=require(_0xdbc9('0x7'));router[_0xdbc9('0x8')]('/',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xa')]);router[_0xdbc9('0x8')]('/:id',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xb')]);router[_0xdbc9('0x8')]('/:id/configurations',auth[_0xdbc9('0x9')](),controller['getConfigurations']);router['get'](_0xdbc9('0xc'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xd')]);router[_0xdbc9('0xe')]('/',auth['isAuthenticated'](),controller[_0xdbc9('0xf')]);router[_0xdbc9('0xe')](_0xdbc9('0x10'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x11')]);router[_0xdbc9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xdbc9('0x13')]);router[_0xdbc9('0x14')](_0xdbc9('0x15'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 231bcd1..a48ffa7 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 _0xf2e3=['STRING','username','remoteUri','sequelize'];(function(_0x40f9a0,_0x3458cc){var _0x3e3144=function(_0x1f8fce){while(--_0x1f8fce){_0x40f9a0['push'](_0x40f9a0['shift']());}};_0x3e3144(++_0x3458cc);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xf2e3[_0x1b6c6d];return _0x290d9d;};'use strict';var Sequelize=require(_0x3f2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f2e('0x1')]},'description':{'type':Sequelize[_0x3f2e('0x1')]},'username':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x2')},'apiKey':{'type':Sequelize[_0x3f2e('0x1')]},'remoteUri':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x3')},'serverUrl':{'type':Sequelize[_0x3f2e('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd824=['exports','STRING','username','remoteUri','sequelize'];(function(_0x548b9c,_0x38f67a){var _0x45f83b=function(_0x541570){while(--_0x541570){_0x548b9c['push'](_0x548b9c['shift']());}};_0x45f83b(++_0x38f67a);}(_0xd824,0xc2));var _0x4d82=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd824[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x3')},'apiKey':{'type':Sequelize[_0x4d82('0x2')]},'remoteUri':{'type':Sequelize[_0x4d82('0x2')],'unique':_0x4d82('0x4')},'serverUrl':{'type':Sequelize[_0x4d82('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index edde92b..744240d 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 _0xb48d=['AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','username','remoteUri','slice','substring','lastIndexOf','format','%s%s','apiKey','users','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','options','FreshsalesAccount','include','rows','catch','show','includeAll','find','create','body','params','findOne','FreshsalesConfiguration','getConfigurations','hasOwnProperty','addConfiguration'];(function(_0x2d3465,_0x59d494){var _0x29dbc9=function(_0x3f57c0){while(--_0x3f57c0){_0x2d3465['push'](_0x2d3465['shift']());}};_0x29dbc9(++_0x59d494);}(_0xb48d,0xdb));var _0xdb48=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xb48d[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb48('0x0'));var zipdir=require(_0xdb48('0x1'));var jsonpatch=require(_0xdb48('0x2'));var rp=require(_0xdb48('0x3'));var moment=require('moment');var BPromise=require(_0xdb48('0x4'));var Mustache=require(_0xdb48('0x5'));var util=require(_0xdb48('0x6'));var path=require('path');var sox=require(_0xdb48('0x7'));var csv=require(_0xdb48('0x8'));var ejs=require(_0xdb48('0x9'));var fs=require('fs');var fs_extra=require(_0xdb48('0xa'));var _=require('lodash');var squel=require(_0xdb48('0xb'));var crypto=require(_0xdb48('0xc'));var jsforce=require(_0xdb48('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdb48('0xe'));var Papa=require('papaparse');var Redis=require(_0xdb48('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdb48('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb48('0x11'));var logger=require(_0xdb48('0x12'))(_0xdb48('0x13'));var utils=require(_0xdb48('0x14'));var config=require(_0xdb48('0x15'));var licenseUtil=require(_0xdb48('0x16'));var db=require(_0xdb48('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xfa9623,_0x5e7453){_0x5e7453=_0x5e7453||0xcc;return function(_0x50c472){if(_0x50c472){return _0xfa9623[_0xdb48('0x18')](_0x5e7453);}return _0xfa9623[_0xdb48('0x19')](_0x5e7453)['end']();};}function respondWithResult(_0x5585cc,_0x47cc34){_0x47cc34=_0x47cc34||0xc8;return function(_0x66af98){if(_0x66af98){return _0x5585cc[_0xdb48('0x19')](_0x47cc34)['json'](_0x66af98);}};}function respondWithFilteredResult(_0x41e7a0,_0x448aa5){return function(_0x27d514){if(_0x27d514){var _0x33e787=typeof _0x448aa5[_0xdb48('0x1a')]===_0xdb48('0x1b')&&typeof _0x448aa5['limit']===_0xdb48('0x1b');var _0x5049c3=_0x27d514[_0xdb48('0x1c')];var _0x51ed3b=_0x33e787?0x0:_0x448aa5[_0xdb48('0x1a')];var _0x41c8ee=_0x33e787?_0x27d514['count']:_0x448aa5['offset']+_0x448aa5['limit'];var _0x1db98c;if(_0x41c8ee>=_0x5049c3){_0x41c8ee=_0x5049c3;_0x1db98c=0xc8;}else{_0x1db98c=0xce;}_0x41e7a0[_0xdb48('0x19')](_0x1db98c);return _0x41e7a0[_0xdb48('0x1d')](_0xdb48('0x1e'),_0x51ed3b+'-'+_0x41c8ee+'/'+_0x5049c3)['json'](_0x27d514);}return null;};}function patchUpdates(_0x419e62){return function(_0x275e22){try{jsonpatch[_0xdb48('0x1f')](_0x275e22,_0x419e62,!![]);}catch(_0x5a1310){return BPromise['reject'](_0x5a1310);}return _0x275e22[_0xdb48('0x20')]();};}function saveUpdates(_0x10be1a,_0x52e2bf){return function(_0x170c2e){if(_0x170c2e){return _0x170c2e[_0xdb48('0x21')](_0x10be1a)[_0xdb48('0x22')](function(_0x303716){return _0x303716;});}return null;};}function removeEntity(_0x2738d5,_0x589519){return function(_0x2737dd){if(_0x2737dd){return _0x2737dd[_0xdb48('0x23')]()[_0xdb48('0x22')](function(){_0x2738d5[_0xdb48('0x19')](0xcc)[_0xdb48('0x24')]();});}};}function handleEntityNotFound(_0x36e641,_0x45b160){return function(_0x2a5b04){if(!_0x2a5b04){_0x36e641[_0xdb48('0x18')](0x194);}return _0x2a5b04;};}function handleError(_0x5ed5f6,_0xb4bc3e){_0xb4bc3e=_0xb4bc3e||0x1f4;return function(_0x29f79c){logger[_0xdb48('0x25')](_0x29f79c[_0xdb48('0x26')]);if(_0x29f79c[_0xdb48('0x27')]){delete _0x29f79c[_0xdb48('0x27')];}_0x5ed5f6[_0xdb48('0x19')](_0xb4bc3e)['send'](_0x29f79c);};}exports[_0xdb48('0x28')]=function(_0x2db54b,_0x466088){var _0x585520={},_0x555c39={},_0x3ebef9={'count':0x0,'rows':[]};var _0x5313bc=_[_0xdb48('0x29')](db['FreshsalesAccount'][_0xdb48('0x2a')],function(_0x12f163){return{'name':_0x12f163[_0xdb48('0x2b')],'type':_0x12f163[_0xdb48('0x2c')][_0xdb48('0x2d')]};});_0x555c39[_0xdb48('0x2e')]=_[_0xdb48('0x29')](_0x5313bc,_0xdb48('0x27'));_0x555c39['query']=_[_0xdb48('0x2f')](_0x2db54b[_0xdb48('0x30')]);_0x555c39[_0xdb48('0x31')]=_['intersection'](_0x555c39[_0xdb48('0x2e')],_0x555c39[_0xdb48('0x30')]);_0x585520['attributes']=_[_0xdb48('0x32')](_0x555c39[_0xdb48('0x2e')],qs[_0xdb48('0x33')](_0x2db54b[_0xdb48('0x30')][_0xdb48('0x33')]));_0x585520['attributes']=_0x585520[_0xdb48('0x34')][_0xdb48('0x35')]?_0x585520[_0xdb48('0x34')]:_0x555c39[_0xdb48('0x2e')];if(!_0x2db54b[_0xdb48('0x30')]['hasOwnProperty'](_0xdb48('0x36'))){_0x585520[_0xdb48('0x37')]=qs[_0xdb48('0x37')](_0x2db54b[_0xdb48('0x30')]['limit']);_0x585520[_0xdb48('0x1a')]=qs['offset'](_0x2db54b[_0xdb48('0x30')][_0xdb48('0x1a')]);}_0x585520[_0xdb48('0x38')]=qs[_0xdb48('0x39')](_0x2db54b['query'][_0xdb48('0x39')]);_0x585520[_0xdb48('0x3a')]=qs[_0xdb48('0x31')](_[_0xdb48('0x3b')](_0x2db54b[_0xdb48('0x30')],_0x555c39[_0xdb48('0x31')]),_0x5313bc);if(_0x2db54b['query'][_0xdb48('0x3c')]){_0x585520['where']=_[_0xdb48('0x3d')](_0x585520[_0xdb48('0x3a')],{'$or':_[_0xdb48('0x29')](_0x5313bc,function(_0x26a2ec){if(_0x26a2ec[_0xdb48('0x2c')]!=='VIRTUAL'){var _0x5619ca={};_0x5619ca[_0x26a2ec['name']]={'$like':'%'+_0x2db54b[_0xdb48('0x30')][_0xdb48('0x3c')]+'%'};return _0x5619ca;}})});}_0x585520=_[_0xdb48('0x3d')]({},_0x585520,_0x2db54b[_0xdb48('0x3e')]);var _0x269f1f={'where':_0x585520[_0xdb48('0x3a')]};return db[_0xdb48('0x3f')][_0xdb48('0x1c')](_0x269f1f)[_0xdb48('0x22')](function(_0x5906d1){_0x3ebef9[_0xdb48('0x1c')]=_0x5906d1;if(_0x2db54b[_0xdb48('0x30')]['includeAll']){_0x585520[_0xdb48('0x40')]=[{'all':!![]}];}return db[_0xdb48('0x3f')]['findAll'](_0x585520);})[_0xdb48('0x22')](function(_0x32d9cd){_0x3ebef9[_0xdb48('0x41')]=_0x32d9cd;return _0x3ebef9;})[_0xdb48('0x22')](respondWithFilteredResult(_0x466088,_0x585520))[_0xdb48('0x42')](handleError(_0x466088,null));};exports[_0xdb48('0x43')]=function(_0xfd92a8,_0x59b849){var _0x52fa70={'raw':![],'where':{'id':_0xfd92a8['params']['id']}},_0x2fa00f={};_0x2fa00f['model']=_[_0xdb48('0x2f')](db['FreshsalesAccount'][_0xdb48('0x2a')]);_0x2fa00f[_0xdb48('0x30')]=_[_0xdb48('0x2f')](_0xfd92a8[_0xdb48('0x30')]);_0x2fa00f['filters']=_[_0xdb48('0x32')](_0x2fa00f[_0xdb48('0x2e')],_0x2fa00f[_0xdb48('0x30')]);_0x52fa70[_0xdb48('0x34')]=_[_0xdb48('0x32')](_0x2fa00f[_0xdb48('0x2e')],qs['fields'](_0xfd92a8[_0xdb48('0x30')]['fields']));_0x52fa70[_0xdb48('0x34')]=_0x52fa70[_0xdb48('0x34')][_0xdb48('0x35')]?_0x52fa70[_0xdb48('0x34')]:_0x2fa00f[_0xdb48('0x2e')];if(_0xfd92a8[_0xdb48('0x30')][_0xdb48('0x44')]){_0x52fa70[_0xdb48('0x40')]=[{'all':!![]}];}_0x52fa70=_[_0xdb48('0x3d')]({},_0x52fa70,_0xfd92a8[_0xdb48('0x3e')]);return db['FreshsalesAccount'][_0xdb48('0x45')](_0x52fa70)['then'](handleEntityNotFound(_0x59b849,null))[_0xdb48('0x22')](respondWithResult(_0x59b849,null))[_0xdb48('0x42')](handleError(_0x59b849,null));};exports[_0xdb48('0x46')]=function(_0x179631,_0x8f2c86){return db[_0xdb48('0x3f')]['create'](_0x179631[_0xdb48('0x47')],{})[_0xdb48('0x22')](respondWithResult(_0x8f2c86,0xc9))[_0xdb48('0x42')](handleError(_0x8f2c86,null));};exports[_0xdb48('0x21')]=function(_0x7ca309,_0x454abd){if(_0x7ca309[_0xdb48('0x47')]['id']){delete _0x7ca309[_0xdb48('0x47')]['id'];}return db[_0xdb48('0x3f')][_0xdb48('0x45')]({'where':{'id':_0x7ca309[_0xdb48('0x48')]['id']}})['then'](handleEntityNotFound(_0x454abd,null))[_0xdb48('0x22')](saveUpdates(_0x7ca309[_0xdb48('0x47')],null))['then'](respondWithResult(_0x454abd,null))[_0xdb48('0x42')](handleError(_0x454abd,null));};exports[_0xdb48('0x23')]=function(_0x54e12a,_0x57f355){return db['FreshsalesAccount'][_0xdb48('0x45')]({'where':{'id':_0x54e12a['params']['id']}})[_0xdb48('0x22')](handleEntityNotFound(_0x57f355,null))[_0xdb48('0x22')](removeEntity(_0x57f355,null))[_0xdb48('0x42')](handleError(_0x57f355,null));};exports['getConfigurations']=function(_0x1673e2,_0x5e3f91,_0x1252d5){var _0x3427bb={};var _0x29f7c4={};var _0x86be37;var _0x21a1de;return db[_0xdb48('0x3f')][_0xdb48('0x49')]({'where':{'id':_0x1673e2[_0xdb48('0x48')]['id']}})[_0xdb48('0x22')](handleEntityNotFound(_0x5e3f91,null))[_0xdb48('0x22')](function(_0x1e9f0a){if(_0x1e9f0a){_0x86be37=_0x1e9f0a;_0x29f7c4[_0xdb48('0x2e')]=_[_0xdb48('0x2f')](db[_0xdb48('0x4a')][_0xdb48('0x2a')]);_0x29f7c4[_0xdb48('0x30')]=_[_0xdb48('0x2f')](_0x1673e2[_0xdb48('0x30')]);_0x29f7c4[_0xdb48('0x31')]=_['intersection'](_0x29f7c4[_0xdb48('0x2e')],_0x29f7c4[_0xdb48('0x30')]);_0x3427bb[_0xdb48('0x34')]=_[_0xdb48('0x32')](_0x29f7c4['model'],qs[_0xdb48('0x33')](_0x1673e2[_0xdb48('0x30')]['fields']));_0x3427bb[_0xdb48('0x34')]=_0x3427bb[_0xdb48('0x34')]['length']?_0x3427bb['attributes']:_0x29f7c4[_0xdb48('0x2e')];_0x3427bb[_0xdb48('0x38')]=qs[_0xdb48('0x39')](_0x1673e2[_0xdb48('0x30')][_0xdb48('0x39')]);_0x3427bb[_0xdb48('0x3a')]=qs['filters'](_['pick'](_0x1673e2[_0xdb48('0x30')],_0x29f7c4[_0xdb48('0x31')]));if(_0x1673e2[_0xdb48('0x30')][_0xdb48('0x3c')]){_0x3427bb[_0xdb48('0x3a')]=_[_0xdb48('0x3d')](_0x3427bb[_0xdb48('0x3a')],{'$or':_['map'](_0x3427bb[_0xdb48('0x34')],function(_0x25f644){var _0x3e861b={};_0x3e861b[_0x25f644]={'$like':'%'+_0x1673e2[_0xdb48('0x30')][_0xdb48('0x3c')]+'%'};return _0x3e861b;})});}_0x3427bb=_[_0xdb48('0x3d')]({},_0x3427bb,_0x1673e2[_0xdb48('0x3e')]);return _0x86be37[_0xdb48('0x4b')](_0x3427bb);}})['then'](function(_0x48855f){if(_0x48855f){_0x21a1de=_0x48855f[_0xdb48('0x35')];if(!_0x1673e2[_0xdb48('0x30')][_0xdb48('0x4c')]('nolimit')){_0x3427bb['limit']=qs[_0xdb48('0x37')](_0x1673e2['query'][_0xdb48('0x37')]);_0x3427bb[_0xdb48('0x1a')]=qs[_0xdb48('0x1a')](_0x1673e2[_0xdb48('0x30')]['offset']);}return _0x86be37[_0xdb48('0x4b')](_0x3427bb);}})[_0xdb48('0x22')](function(_0x268832){if(_0x268832){return _0x268832?{'count':_0x21a1de,'rows':_0x268832}:null;}})['then'](respondWithResult(_0x5e3f91,null))[_0xdb48('0x42')](handleError(_0x5e3f91,null));};exports[_0xdb48('0x4d')]=function(_0x50c754,_0x6a19b,_0x1dcb39){if(_0x50c754[_0xdb48('0x47')]['id']){delete _0x50c754['body']['id'];}return db['FreshsalesAccount'][_0xdb48('0x49')]({'where':{'id':_0x50c754[_0xdb48('0x48')]['id']}})[_0xdb48('0x22')](handleEntityNotFound(_0x6a19b,null))[_0xdb48('0x22')](function(_0x25a827){if(_0x25a827){_0x50c754[_0xdb48('0x47')][_0xdb48('0x4e')]=_0x25a827['id'];_0x50c754[_0xdb48('0x47')][_0xdb48('0x4f')]=integrations[_0xdb48('0x50')](_0x50c754[_0xdb48('0x47')][_0xdb48('0x51')],_0x50c754[_0xdb48('0x47')][_0xdb48('0x2c')]);_0x50c754[_0xdb48('0x47')][_0xdb48('0x52')]=integrations['getDescriptions'](_0x50c754['body'][_0xdb48('0x51')],_0x50c754[_0xdb48('0x47')][_0xdb48('0x2c')]);return db['FreshsalesConfiguration'][_0xdb48('0x46')](_0x50c754['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xdb48('0x4f')},{'model':db[_0xdb48('0x53')],'as':'Descriptions'}]});}return null;})[_0xdb48('0x22')](respondWithResult(_0x6a19b,null))[_0xdb48('0x42')](handleError(_0x6a19b,null));};exports['getFields']=function(_0x4bebe5,_0xe8b44,_0x7d20cb){var _0x407427='';var _0x2fbcfc='';return db[_0xdb48('0x3f')][_0xdb48('0x49')]({'where':{'id':_0x4bebe5[_0xdb48('0x48')]['id']},'attributes':['id',_0xdb48('0x54'),_0xdb48('0x55'),'apiKey']})[_0xdb48('0x22')](handleEntityNotFound(_0xe8b44,null))[_0xdb48('0x22')](function(_0x580751){if(_0x580751){_0x2fbcfc=_0x580751[_0xdb48('0x54')];_0x407427=_0x580751[_0xdb48('0x55')];var _0x5044fc=_0x580751[_0xdb48('0x55')][_0xdb48('0x56')](-0x1);if(_0x5044fc==='/'){_0x407427=_0x407427[_0xdb48('0x57')](0x0,_0x407427[_0xdb48('0x58')](_0x5044fc));}return rp({'method':'GET','uri':util[_0xdb48('0x59')](_0xdb48('0x5a'),_0x407427,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x580751[_0xdb48('0x5b')]},'json':!![]});}})['then'](function(_0x5c2f3d){if(_0x5c2f3d){var _0x8eeb22=_0x5c2f3d[_0xdb48('0x5c')];var _0x24dcf1=![];var _0x22dbce=null;for(_0x22dbce=0x0;_0x22dbce<_0x8eeb22[_0xdb48('0x35')];_0x22dbce++){if(_0x8eeb22[_0x22dbce]['email']===_0x2fbcfc){_0x24dcf1=!![];}}if(_0x24dcf1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xdb48('0x5d')});}}})[_0xdb48('0x22')](respondWithResult(_0xe8b44,null))[_0xdb48('0x42')](function(_0x4ec509){var _0x9cedb6=_0x4bebe5[_0xdb48('0x30')]['test']?0x1f4:_0x4ec509['statusCode']||0x1f4;logger[_0xdb48('0x25')](_0xdb48('0x5e'),'getFields',_0x9cedb6,JSON[_0xdb48('0x5f')](_0x4ec509));delete _0x4ec509[_0xdb48('0x27')];if(_0x9cedb6===0x191){_0x9cedb6=0x190;}_0xe8b44[_0xdb48('0x19')](_0x9cedb6)[_0xdb48('0x60')](_0x4bebe5['query']['test']?{'message':_0xdb48('0x61'),'statusCode':_0x4ec509[_0xdb48('0x62')]}:_0x4ec509);});}; \ No newline at end of file +var _0x9a72=['params','keys','find','catch','create','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','rows','show'];(function(_0x34721e,_0x3da82b){var _0x564c1a=function(_0x4b4a08){while(--_0x4b4a08){_0x34721e['push'](_0x34721e['shift']());}};_0x564c1a(++_0x3da82b);}(_0x9a72,0x8e));var _0x29a7=function(_0x364fa1,_0x125e23){_0x364fa1=_0x364fa1-0x0;var _0x4a062d=_0x9a72[_0x364fa1];return _0x4a062d;};'use strict';var emlformat=require(_0x29a7('0x0'));var rimraf=require(_0x29a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29a7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x29a7('0x3'));var Mustache=require(_0x29a7('0x4'));var util=require(_0x29a7('0x5'));var path=require(_0x29a7('0x6'));var sox=require('sox');var csv=require(_0x29a7('0x7'));var ejs=require(_0x29a7('0x8'));var fs=require('fs');var fs_extra=require(_0x29a7('0x9'));var _=require(_0x29a7('0xa'));var squel=require(_0x29a7('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x29a7('0xc'));var toCsv=require(_0x29a7('0x7'));var querystring=require(_0x29a7('0xd'));var Papa=require(_0x29a7('0xe'));var Redis=require(_0x29a7('0xf'));var authService=require(_0x29a7('0x10'));var qs=require(_0x29a7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x29a7('0x12'))(_0x29a7('0x13'));var utils=require(_0x29a7('0x14'));var config=require(_0x29a7('0x15'));var licenseUtil=require(_0x29a7('0x16'));var db=require(_0x29a7('0x17'))['db'];var integrations=require(_0x29a7('0x18'));function respondWithStatusCode(_0x4a8c3a,_0x1ca193){_0x1ca193=_0x1ca193||0xcc;return function(_0x1078d4){if(_0x1078d4){return _0x4a8c3a[_0x29a7('0x19')](_0x1ca193);}return _0x4a8c3a[_0x29a7('0x1a')](_0x1ca193)['end']();};}function respondWithResult(_0x47c384,_0x3433a3){_0x3433a3=_0x3433a3||0xc8;return function(_0x1f8a84){if(_0x1f8a84){return _0x47c384[_0x29a7('0x1a')](_0x3433a3)[_0x29a7('0x1b')](_0x1f8a84);}};}function respondWithFilteredResult(_0x100ed1,_0x4d7c43){return function(_0x2636f5){if(_0x2636f5){var _0x5b43b9=typeof _0x4d7c43[_0x29a7('0x1c')]===_0x29a7('0x1d')&&typeof _0x4d7c43[_0x29a7('0x1e')]===_0x29a7('0x1d');var _0x67d0c8=_0x2636f5[_0x29a7('0x1f')];var _0x4c0b97=_0x5b43b9?0x0:_0x4d7c43[_0x29a7('0x1c')];var _0x2512aa=_0x5b43b9?_0x2636f5[_0x29a7('0x1f')]:_0x4d7c43[_0x29a7('0x1c')]+_0x4d7c43[_0x29a7('0x1e')];var _0x2acc03;if(_0x2512aa>=_0x67d0c8){_0x2512aa=_0x67d0c8;_0x2acc03=0xc8;}else{_0x2acc03=0xce;}_0x100ed1['status'](_0x2acc03);return _0x100ed1[_0x29a7('0x20')](_0x29a7('0x21'),_0x4c0b97+'-'+_0x2512aa+'/'+_0x67d0c8)[_0x29a7('0x1b')](_0x2636f5);}return null;};}function patchUpdates(_0x250757){return function(_0x4c3307){try{jsonpatch[_0x29a7('0x22')](_0x4c3307,_0x250757,!![]);}catch(_0x4f3370){return BPromise[_0x29a7('0x23')](_0x4f3370);}return _0x4c3307[_0x29a7('0x24')]();};}function saveUpdates(_0x2ef42f,_0x2dd7c0){return function(_0x233e35){if(_0x233e35){return _0x233e35[_0x29a7('0x25')](_0x2ef42f)[_0x29a7('0x26')](function(_0x2d7ac8){return _0x2d7ac8;});}return null;};}function removeEntity(_0x5f4042,_0x8ff3e2){return function(_0x211696){if(_0x211696){return _0x211696[_0x29a7('0x27')]()[_0x29a7('0x26')](function(){_0x5f4042[_0x29a7('0x1a')](0xcc)[_0x29a7('0x28')]();});}};}function handleEntityNotFound(_0x128aec,_0x2cca4e){return function(_0x1116bf){if(!_0x1116bf){_0x128aec[_0x29a7('0x19')](0x194);}return _0x1116bf;};}function handleError(_0x5028c2,_0x555e35){_0x555e35=_0x555e35||0x1f4;return function(_0x5082ae){logger['error'](_0x5082ae[_0x29a7('0x29')]);if(_0x5082ae[_0x29a7('0x2a')]){delete _0x5082ae[_0x29a7('0x2a')];}_0x5028c2[_0x29a7('0x1a')](_0x555e35)['send'](_0x5082ae);};}exports[_0x29a7('0x2b')]=function(_0x2f84a7,_0x308e3d){var _0x3e0d47={},_0x23467e={},_0x2566a7={'count':0x0,'rows':[]};var _0x2cb271=_[_0x29a7('0x2c')](db[_0x29a7('0x2d')][_0x29a7('0x2e')],function(_0x5b52d5){return{'name':_0x5b52d5[_0x29a7('0x2f')],'type':_0x5b52d5['type'][_0x29a7('0x30')]};});_0x23467e[_0x29a7('0x31')]=_['map'](_0x2cb271,_0x29a7('0x2a'));_0x23467e['query']=_['keys'](_0x2f84a7[_0x29a7('0x32')]);_0x23467e[_0x29a7('0x33')]=_[_0x29a7('0x34')](_0x23467e[_0x29a7('0x31')],_0x23467e['query']);_0x3e0d47[_0x29a7('0x35')]=_[_0x29a7('0x34')](_0x23467e[_0x29a7('0x31')],qs[_0x29a7('0x36')](_0x2f84a7[_0x29a7('0x32')][_0x29a7('0x36')]));_0x3e0d47['attributes']=_0x3e0d47[_0x29a7('0x35')][_0x29a7('0x37')]?_0x3e0d47[_0x29a7('0x35')]:_0x23467e[_0x29a7('0x31')];if(!_0x2f84a7[_0x29a7('0x32')][_0x29a7('0x38')](_0x29a7('0x39'))){_0x3e0d47[_0x29a7('0x1e')]=qs[_0x29a7('0x1e')](_0x2f84a7[_0x29a7('0x32')][_0x29a7('0x1e')]);_0x3e0d47[_0x29a7('0x1c')]=qs[_0x29a7('0x1c')](_0x2f84a7[_0x29a7('0x32')][_0x29a7('0x1c')]);}_0x3e0d47[_0x29a7('0x3a')]=qs[_0x29a7('0x3b')](_0x2f84a7[_0x29a7('0x32')][_0x29a7('0x3b')]);_0x3e0d47[_0x29a7('0x3c')]=qs['filters'](_[_0x29a7('0x3d')](_0x2f84a7[_0x29a7('0x32')],_0x23467e[_0x29a7('0x33')]),_0x2cb271);if(_0x2f84a7[_0x29a7('0x32')][_0x29a7('0x3e')]){_0x3e0d47[_0x29a7('0x3c')]=_['merge'](_0x3e0d47[_0x29a7('0x3c')],{'$or':_['map'](_0x2cb271,function(_0x414640){if(_0x414640[_0x29a7('0x3f')]!==_0x29a7('0x40')){var _0x5ea201={};_0x5ea201[_0x414640[_0x29a7('0x2a')]]={'$like':'%'+_0x2f84a7['query'][_0x29a7('0x3e')]+'%'};return _0x5ea201;}})});}_0x3e0d47=_[_0x29a7('0x41')]({},_0x3e0d47,_0x2f84a7[_0x29a7('0x42')]);var _0x2542f8={'where':_0x3e0d47[_0x29a7('0x3c')]};return db[_0x29a7('0x2d')][_0x29a7('0x1f')](_0x2542f8)['then'](function(_0x278bb6){_0x2566a7[_0x29a7('0x1f')]=_0x278bb6;if(_0x2f84a7[_0x29a7('0x32')][_0x29a7('0x43')]){_0x3e0d47['include']=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x3e0d47);})[_0x29a7('0x26')](function(_0x5ceeb7){_0x2566a7[_0x29a7('0x44')]=_0x5ceeb7;return _0x2566a7;})['then'](respondWithFilteredResult(_0x308e3d,_0x3e0d47))['catch'](handleError(_0x308e3d,null));};exports[_0x29a7('0x45')]=function(_0x3a1c8c,_0x31a7cb){var _0xa4344a={'raw':![],'where':{'id':_0x3a1c8c[_0x29a7('0x46')]['id']}},_0x379433={};_0x379433[_0x29a7('0x31')]=_[_0x29a7('0x47')](db['FreshsalesAccount'][_0x29a7('0x2e')]);_0x379433[_0x29a7('0x32')]=_[_0x29a7('0x47')](_0x3a1c8c[_0x29a7('0x32')]);_0x379433[_0x29a7('0x33')]=_[_0x29a7('0x34')](_0x379433['model'],_0x379433['query']);_0xa4344a[_0x29a7('0x35')]=_[_0x29a7('0x34')](_0x379433[_0x29a7('0x31')],qs['fields'](_0x3a1c8c[_0x29a7('0x32')][_0x29a7('0x36')]));_0xa4344a[_0x29a7('0x35')]=_0xa4344a[_0x29a7('0x35')][_0x29a7('0x37')]?_0xa4344a[_0x29a7('0x35')]:_0x379433[_0x29a7('0x31')];if(_0x3a1c8c[_0x29a7('0x32')][_0x29a7('0x43')]){_0xa4344a['include']=[{'all':!![]}];}_0xa4344a=_[_0x29a7('0x41')]({},_0xa4344a,_0x3a1c8c['options']);return db[_0x29a7('0x2d')][_0x29a7('0x48')](_0xa4344a)[_0x29a7('0x26')](handleEntityNotFound(_0x31a7cb,null))['then'](respondWithResult(_0x31a7cb,null))[_0x29a7('0x49')](handleError(_0x31a7cb,null));};exports[_0x29a7('0x4a')]=function(_0x171f48,_0x5e2d53){return db[_0x29a7('0x2d')]['create'](_0x171f48['body'],{})['then'](respondWithResult(_0x5e2d53,0xc9))['catch'](handleError(_0x5e2d53,null));};exports[_0x29a7('0x25')]=function(_0x3597ff,_0x34e4af){if(_0x3597ff['body']['id']){delete _0x3597ff[_0x29a7('0x4b')]['id'];}return db[_0x29a7('0x2d')][_0x29a7('0x48')]({'where':{'id':_0x3597ff['params']['id']}})[_0x29a7('0x26')](handleEntityNotFound(_0x34e4af,null))[_0x29a7('0x26')](saveUpdates(_0x3597ff[_0x29a7('0x4b')],null))['then'](respondWithResult(_0x34e4af,null))[_0x29a7('0x49')](handleError(_0x34e4af,null));};exports[_0x29a7('0x27')]=function(_0x587e91,_0x58ad4d){return db[_0x29a7('0x2d')][_0x29a7('0x48')]({'where':{'id':_0x587e91[_0x29a7('0x46')]['id']}})[_0x29a7('0x26')](handleEntityNotFound(_0x58ad4d,null))[_0x29a7('0x26')](removeEntity(_0x58ad4d,null))[_0x29a7('0x49')](handleError(_0x58ad4d,null));};exports[_0x29a7('0x4c')]=function(_0x5a4c44,_0x367dc9,_0x1f2269){var _0x578618={};var _0xbb0047={};var _0x496fa1;var _0x34666a;return db[_0x29a7('0x2d')][_0x29a7('0x4d')]({'where':{'id':_0x5a4c44['params']['id']}})[_0x29a7('0x26')](handleEntityNotFound(_0x367dc9,null))[_0x29a7('0x26')](function(_0x1e78a2){if(_0x1e78a2){_0x496fa1=_0x1e78a2;_0xbb0047[_0x29a7('0x31')]=_['keys'](db[_0x29a7('0x4e')][_0x29a7('0x2e')]);_0xbb0047[_0x29a7('0x32')]=_[_0x29a7('0x47')](_0x5a4c44[_0x29a7('0x32')]);_0xbb0047[_0x29a7('0x33')]=_[_0x29a7('0x34')](_0xbb0047[_0x29a7('0x31')],_0xbb0047[_0x29a7('0x32')]);_0x578618[_0x29a7('0x35')]=_[_0x29a7('0x34')](_0xbb0047['model'],qs[_0x29a7('0x36')](_0x5a4c44[_0x29a7('0x32')][_0x29a7('0x36')]));_0x578618['attributes']=_0x578618[_0x29a7('0x35')][_0x29a7('0x37')]?_0x578618[_0x29a7('0x35')]:_0xbb0047[_0x29a7('0x31')];_0x578618[_0x29a7('0x3a')]=qs[_0x29a7('0x3b')](_0x5a4c44[_0x29a7('0x32')][_0x29a7('0x3b')]);_0x578618[_0x29a7('0x3c')]=qs['filters'](_[_0x29a7('0x3d')](_0x5a4c44[_0x29a7('0x32')],_0xbb0047[_0x29a7('0x33')]));if(_0x5a4c44[_0x29a7('0x32')][_0x29a7('0x3e')]){_0x578618[_0x29a7('0x3c')]=_['merge'](_0x578618[_0x29a7('0x3c')],{'$or':_[_0x29a7('0x2c')](_0x578618[_0x29a7('0x35')],function(_0x1a63b0){var _0x48f6f6={};_0x48f6f6[_0x1a63b0]={'$like':'%'+_0x5a4c44[_0x29a7('0x32')][_0x29a7('0x3e')]+'%'};return _0x48f6f6;})});}_0x578618=_[_0x29a7('0x41')]({},_0x578618,_0x5a4c44[_0x29a7('0x42')]);return _0x496fa1[_0x29a7('0x4c')](_0x578618);}})['then'](function(_0x56af8a){if(_0x56af8a){_0x34666a=_0x56af8a[_0x29a7('0x37')];if(!_0x5a4c44[_0x29a7('0x32')][_0x29a7('0x38')](_0x29a7('0x39'))){_0x578618[_0x29a7('0x1e')]=qs['limit'](_0x5a4c44[_0x29a7('0x32')]['limit']);_0x578618[_0x29a7('0x1c')]=qs[_0x29a7('0x1c')](_0x5a4c44[_0x29a7('0x32')]['offset']);}return _0x496fa1[_0x29a7('0x4c')](_0x578618);}})[_0x29a7('0x26')](function(_0x4bed23){if(_0x4bed23){return _0x4bed23?{'count':_0x34666a,'rows':_0x4bed23}:null;}})[_0x29a7('0x26')](respondWithResult(_0x367dc9,null))[_0x29a7('0x49')](handleError(_0x367dc9,null));};exports[_0x29a7('0x4f')]=function(_0xff3545,_0x4009e8,_0x109fd0){if(_0xff3545[_0x29a7('0x4b')]['id']){delete _0xff3545[_0x29a7('0x4b')]['id'];}return db[_0x29a7('0x2d')][_0x29a7('0x4d')]({'where':{'id':_0xff3545['params']['id']}})['then'](handleEntityNotFound(_0x4009e8,null))[_0x29a7('0x26')](function(_0x464b9a){if(_0x464b9a){_0xff3545['body'][_0x29a7('0x50')]=_0x464b9a['id'];_0xff3545[_0x29a7('0x4b')][_0x29a7('0x51')]=integrations['getSubjects'](_0xff3545['body'][_0x29a7('0x52')],_0xff3545[_0x29a7('0x4b')][_0x29a7('0x3f')]);_0xff3545[_0x29a7('0x4b')][_0x29a7('0x53')]=integrations[_0x29a7('0x54')](_0xff3545[_0x29a7('0x4b')][_0x29a7('0x52')],_0xff3545[_0x29a7('0x4b')]['type']);return db[_0x29a7('0x4e')][_0x29a7('0x4a')](_0xff3545[_0x29a7('0x4b')],{'include':[{'model':db['FreshsalesField'],'as':_0x29a7('0x51')},{'model':db[_0x29a7('0x55')],'as':_0x29a7('0x53')}]});}return null;})[_0x29a7('0x26')](respondWithResult(_0x4009e8,null))['catch'](handleError(_0x4009e8,null));};exports[_0x29a7('0x56')]=function(_0x5f5666,_0xc8bb0c,_0x1372e6){var _0xdd45c2='';var _0x4fe5ae='';return db[_0x29a7('0x2d')][_0x29a7('0x4d')]({'where':{'id':_0x5f5666[_0x29a7('0x46')]['id']},'attributes':['id',_0x29a7('0x57'),_0x29a7('0x58'),_0x29a7('0x59')]})[_0x29a7('0x26')](handleEntityNotFound(_0xc8bb0c,null))[_0x29a7('0x26')](function(_0x14b39a){if(_0x14b39a){_0x4fe5ae=_0x14b39a[_0x29a7('0x57')];_0xdd45c2=_0x14b39a[_0x29a7('0x58')];var _0x5e5ce2=_0x14b39a['remoteUri']['slice'](-0x1);if(_0x5e5ce2==='/'){_0xdd45c2=_0xdd45c2[_0x29a7('0x5a')](0x0,_0xdd45c2[_0x29a7('0x5b')](_0x5e5ce2));}return rp({'method':_0x29a7('0x5c'),'uri':util[_0x29a7('0x5d')](_0x29a7('0x5e'),_0xdd45c2,_0x29a7('0x5f')),'headers':{'Authorization':_0x29a7('0x60')+_0x14b39a[_0x29a7('0x59')]},'json':!![]});}})[_0x29a7('0x26')](function(_0x4043e9){if(_0x4043e9){var _0x12a711=_0x4043e9[_0x29a7('0x61')];var _0x3fda11=![];var _0x53b4c7=null;for(_0x53b4c7=0x0;_0x53b4c7<_0x12a711['length'];_0x53b4c7++){if(_0x12a711[_0x53b4c7][_0x29a7('0x62')]===_0x4fe5ae){_0x3fda11=!![];}}if(_0x3fda11){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x29a7('0x26')](respondWithResult(_0xc8bb0c,null))[_0x29a7('0x49')](function(_0x4a15ae){var _0x51d07c=_0x5f5666[_0x29a7('0x32')][_0x29a7('0x63')]?0x1f4:_0x4a15ae[_0x29a7('0x64')]||0x1f4;logger[_0x29a7('0x65')](_0x29a7('0x66'),'getFields',_0x51d07c,JSON[_0x29a7('0x67')](_0x4a15ae));delete _0x4a15ae[_0x29a7('0x2a')];if(_0x51d07c===0x191){_0x51d07c=0x190;}_0xc8bb0c[_0x29a7('0x1a')](_0x51d07c)[_0x29a7('0x68')](_0x5f5666['query']['test']?{'message':_0x29a7('0x69'),'statusCode':_0x4a15ae['statusCode']}:_0x4a15ae);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 9f70db8..806d098 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 _0xafc4=['path','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x1e9126,_0x5c310c){var _0x5db7f2=function(_0x3d59db){while(--_0x3d59db){_0x1e9126['push'](_0x1e9126['shift']());}};_0x5db7f2(++_0x5c310c);}(_0xafc4,0x69));var _0x4afc=function(_0x3f3f5e,_0x31da48){_0x3f3f5e=_0x3f3f5e-0x0;var _0xac4ef3=_0xafc4[_0x3f3f5e];return _0xac4ef3;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x4afc('0x6'));module[_0x4afc('0x7')]=function(_0x16953b,_0x1bb281){return _0x16953b[_0x4afc('0x8')](_0x4afc('0x9'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd046=['rimraf','./intFreshsalesAccount.attributes','int_freshsales_accounts','util','../../config/logger','api','bluebird'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xd046,0x129));var _0x6d04=function(_0x554a6b,_0x4006d1){_0x554a6b=_0x554a6b-0x0;var _0xe17e60=_0xd046[_0x554a6b];return _0xe17e60;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var logger=require(_0x6d04('0x1'))(_0x6d04('0x2'));var moment=require('moment');var BPromise=require(_0x6d04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d04('0x4'));var config=require('../../config/environment');var attributes=require(_0x6d04('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xf3b4e7,_0x1968c4){return _0xf3b4e7['define']('FreshsalesAccount',attributes,{'tableName':_0x6d04('0x6'),'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 96bc33b..6157197 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 _0x5204=['catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','attributes','include','model','map','then','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5204,0xdf));var _0x4520=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x5204[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')]({'raw':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4['options'][_0x4520('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e00f4['options']?_0x2e00f4['options']['where']||null:null,'attributes':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4['options'][_0x4520('0x1c')]||null:null,'limit':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4[_0x4520('0x1a')]['limit']||null:null,'include':_0x2e00f4[_0x4520('0x1a')]?_0x2e00f4[_0x4520('0x1a')][_0x4520('0x1d')]?_['map'](_0x2e00f4[_0x4520('0x1a')][_0x4520('0x1d')],function(_0x24eacd){return{'model':db[_0x24eacd[_0x4520('0x1e')]],'as':_0x24eacd['as'],'attributes':_0x24eacd[_0x4520('0x1c')],'include':_0x24eacd['include']?_[_0x4520('0x1f')](_0x24eacd[_0x4520('0x1d')],function(_0x3532aa){return{'model':db[_0x3532aa[_0x4520('0x1e')]],'as':_0x3532aa['as'],'attributes':_0x3532aa['attributes'],'include':_0x3532aa[_0x4520('0x1d')]?_[_0x4520('0x1f')](_0x3532aa[_0x4520('0x1d')],function(_0x21e1f3){return{'model':db[_0x21e1f3[_0x4520('0x1e')]],'as':_0x21e1f3['as'],'attributes':_0x21e1f3[_0x4520('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4520('0x20')](function(_0x195c58){logger[_0x4520('0xc')](_0x4520('0x17'),_0x2e00f4);logger['debug'](_0x4520('0x17'),_0x2e00f4,JSON['stringify'](_0x195c58));_0x4ba69f(_0x195c58);})[_0x4520('0x16')](function(_0x14778a){logger[_0x4520('0x12')](_0x4520('0x17'),_0x14778a[_0x4520('0x14')],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x14778a['message']));});});};exports[_0x4520('0x21')]=function(_0x508c05){var _0x2585eb=this;return new Promise(function(_0x4a6755,_0xf6caff){return db['FreshsalesAccount'][_0x4520('0x22')]({'raw':_0x508c05['options']?_0x508c05['options'][_0x4520('0x1b')]===undefined?!![]:![]:!![],'where':_0x508c05[_0x4520('0x1a')]?_0x508c05[_0x4520('0x1a')]['where']||null:null,'attributes':_0x508c05[_0x4520('0x1a')]?_0x508c05[_0x4520('0x1a')][_0x4520('0x1c')]||null:null,'include':_0x508c05[_0x4520('0x1a')]?_0x508c05['options']['include']?_[_0x4520('0x1f')](_0x508c05[_0x4520('0x1a')]['include'],function(_0x779e94){return{'model':db[_0x779e94[_0x4520('0x1e')]],'as':_0x779e94['as'],'attributes':_0x779e94[_0x4520('0x1c')],'include':_0x779e94[_0x4520('0x1d')]?_[_0x4520('0x1f')](_0x779e94[_0x4520('0x1d')],function(_0x550a0f){return{'model':db[_0x550a0f[_0x4520('0x1e')]],'as':_0x550a0f['as'],'attributes':_0x550a0f[_0x4520('0x1c')],'include':_0x550a0f['include']?_[_0x4520('0x1f')](_0x550a0f['include'],function(_0x8bf557){return{'model':db[_0x8bf557[_0x4520('0x1e')]],'as':_0x8bf557['as'],'attributes':_0x8bf557['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5527a6){logger[_0x4520('0xc')](_0x4520('0x21'),_0x508c05);logger[_0x4520('0xf')](_0x4520('0x21'),_0x508c05,JSON[_0x4520('0x11')](_0x5527a6));_0x4a6755(_0x5527a6);})[_0x4520('0x16')](function(_0x3bfc83){logger['error'](_0x4520('0x21'),_0x3bfc83[_0x4520('0x14')],_0x508c05);_0xf6caff(_0x2585eb[_0x4520('0x12')](0x1f4,_0x3bfc83['message']));});});}; \ No newline at end of file +var _0xfcf0=['request','info','FreshsalesAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','FreshsalesAccount','find','ShowFreshsalesAccount','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xf955a0,_0x17a432){var _0x1663ef=function(_0x2ec2bc){while(--_0x2ec2bc){_0xf955a0['push'](_0xf955a0['shift']());}};_0x1663ef(++_0x17a432);}(_0xfcf0,0x138));var _0x0fcf=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0xfcf0[_0x3817a9];return _0x443f30;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});}exports[_0x0fcf('0x15')]=function(_0x19cfbd){var _0x567320=this;return new Promise(function(_0x18ea32,_0x1a8f58){return db['FreshsalesAccount'][_0x0fcf('0x16')]({'raw':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1a')]||null:null,'limit':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x1b')]||null:null,'include':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x19cfbd[_0x0fcf('0x17')]['include'],function(_0x2eef74){return{'model':db[_0x2eef74[_0x0fcf('0x1e')]],'as':_0x2eef74['as'],'attributes':_0x2eef74[_0x0fcf('0x1a')],'include':_0x2eef74[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x2eef74[_0x0fcf('0x1c')],function(_0x2ce990){return{'model':db[_0x2ce990[_0x0fcf('0x1e')]],'as':_0x2ce990['as'],'attributes':_0x2ce990[_0x0fcf('0x1a')],'include':_0x2ce990['include']?_[_0x0fcf('0x1d')](_0x2ce990[_0x0fcf('0x1c')],function(_0x41b7a2){return{'model':db[_0x41b7a2[_0x0fcf('0x1e')]],'as':_0x41b7a2['as'],'attributes':_0x41b7a2[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0fcf('0x1f')](function(_0x2730b0){logger['info'](_0x0fcf('0x15'),_0x19cfbd);logger[_0x0fcf('0xf')](_0x0fcf('0x15'),_0x19cfbd,JSON[_0x0fcf('0x11')](_0x2730b0));_0x18ea32(_0x2730b0);})['catch'](function(_0x5d9bcd){logger['error'](_0x0fcf('0x15'),_0x5d9bcd['message'],_0x19cfbd);_0x1a8f58(_0x567320[_0x0fcf('0x12')](0x1f4,_0x5d9bcd[_0x0fcf('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0xdfd3ec){var _0x117041=this;return new Promise(function(_0xa52f52,_0x161496){return db[_0x0fcf('0x20')][_0x0fcf('0x21')]({'raw':_0xdfd3ec['options']?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec['options'][_0x0fcf('0x1a')]||null:null,'include':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')],function(_0x344957){return{'model':db[_0x344957[_0x0fcf('0x1e')]],'as':_0x344957['as'],'attributes':_0x344957[_0x0fcf('0x1a')],'include':_0x344957[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x344957[_0x0fcf('0x1c')],function(_0x17346e){return{'model':db[_0x17346e['model']],'as':_0x17346e['as'],'attributes':_0x17346e['attributes'],'include':_0x17346e[_0x0fcf('0x1c')]?_['map'](_0x17346e['include'],function(_0x1a1e07){return{'model':db[_0x1a1e07[_0x0fcf('0x1e')]],'as':_0x1a1e07['as'],'attributes':_0x1a1e07[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57e635){logger[_0x0fcf('0xd')](_0x0fcf('0x22'),_0xdfd3ec);logger[_0x0fcf('0xf')]('ShowFreshsalesAccount',_0xdfd3ec,JSON[_0x0fcf('0x11')](_0x57e635));_0xa52f52(_0x57e635);})[_0x0fcf('0x23')](function(_0x29067e){logger['error']('ShowFreshsalesAccount',_0x29067e['message'],_0xdfd3ec);_0x161496(_0x117041[_0x0fcf('0x12')](0x1f4,_0x29067e[_0x0fcf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 42c94b2..0e2f0ae 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 _0x5a5b=['update','delete','destroy','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/subjects','getSubjects','getDescriptions','/:id/fields','post'];(function(_0x44a573,_0x1e6efc){var _0x4babc6=function(_0x5495aa){while(--_0x5495aa){_0x44a573['push'](_0x44a573['shift']());}};_0x4babc6(++_0x1e6efc);}(_0x5a5b,0x163));var _0xb5a5=function(_0xbdd49,_0x5cc513){_0xbdd49=_0xbdd49-0x0;var _0x1ebdf9=_0x5a5b[_0xbdd49];return _0x1ebdf9;};'use strict';var multer=require(_0xb5a5('0x0'));var util=require('util');var path=require(_0xb5a5('0x1'));var timeout=require(_0xb5a5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb5a5('0x3'));var config=require(_0xb5a5('0x4'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xb5a5('0x5')]('/',auth[_0xb5a5('0x6')](),controller['index']);router[_0xb5a5('0x5')](_0xb5a5('0x7'),auth[_0xb5a5('0x6')](),controller['show']);router['get'](_0xb5a5('0x8'),auth[_0xb5a5('0x6')](),controller[_0xb5a5('0x9')]);router[_0xb5a5('0x5')]('/:id/descriptions',auth[_0xb5a5('0x6')](),controller[_0xb5a5('0xa')]);router[_0xb5a5('0x5')](_0xb5a5('0xb'),auth[_0xb5a5('0x6')](),controller['getFields']);router[_0xb5a5('0xc')]('/',auth[_0xb5a5('0x6')](),controller['create']);router['put'](_0xb5a5('0x7'),auth[_0xb5a5('0x6')](),controller[_0xb5a5('0xd')]);router[_0xb5a5('0xe')](_0xb5a5('0x7'),auth[_0xb5a5('0x6')](),controller[_0xb5a5('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5d53=['show','/:id/subjects','getSubjects','getFields','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x5dc4f1,_0x52e7d3){var _0x2fa955=function(_0x33a5ca){while(--_0x33a5ca){_0x5dc4f1['push'](_0x5dc4f1['shift']());}};_0x2fa955(++_0x52e7d3);}(_0x5d53,0x1d9));var _0x35d5=function(_0x56562d,_0x578183){_0x56562d=_0x56562d-0x0;var _0xdafef9=_0x5d53[_0x56562d];return _0xdafef9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x35d5('0x0'));var timeout=require(_0x35d5('0x1'));var express=require(_0x35d5('0x2'));var router=express[_0x35d5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x35d5('0x4'));var interaction=require(_0x35d5('0x5'));var config=require(_0x35d5('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0x35d5('0x7')](),controller[_0x35d5('0x8')]);router[_0x35d5('0x9')](_0x35d5('0xa'),auth['isAuthenticated'](),controller[_0x35d5('0xb')]);router['get'](_0x35d5('0xc'),auth[_0x35d5('0x7')](),controller[_0x35d5('0xd')]);router['get']('/:id/descriptions',auth[_0x35d5('0x7')](),controller['getDescriptions']);router[_0x35d5('0x9')]('/:id/fields',auth[_0x35d5('0x7')](),controller[_0x35d5('0xe')]);router[_0x35d5('0xf')]('/',auth[_0x35d5('0x7')](),controller[_0x35d5('0x10')]);router[_0x35d5('0x11')](_0x35d5('0xa'),auth[_0x35d5('0x7')](),controller[_0x35d5('0x12')]);router[_0x35d5('0x13')](_0x35d5('0xa'),auth[_0x35d5('0x7')](),controller[_0x35d5('0x14')]);module[_0x35d5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 1a683c2..85b5315 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 _0xcf51=['STRING','sequelize','exports'];(function(_0x24e5a1,_0xbf3b79){var _0x2beaf5=function(_0x8ea197){while(--_0x8ea197){_0x24e5a1['push'](_0x24e5a1['shift']());}};_0x2beaf5(++_0xbf3b79);}(_0xcf51,0x9d));var _0x1cf5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcf51[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x1cf5('0x0'));module[_0x1cf5('0x1')]={'name':{'type':Sequelize[_0x1cf5('0x2')]},'description':{'type':Sequelize[_0x1cf5('0x2')]}}; \ No newline at end of file +var _0xaf56=['STRING','sequelize','exports'];(function(_0x41bb01,_0x1018de){var _0x59dc75=function(_0x405c38){while(--_0x405c38){_0x41bb01['push'](_0x41bb01['shift']());}};_0x59dc75(++_0x1018de);}(_0xaf56,0x1a8));var _0x6af5=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0xaf56[_0x51b0dc];return _0x13fa89;};'use strict';var Sequelize=require(_0x6af5('0x0'));module[_0x6af5('0x1')]={'name':{'type':Sequelize[_0x6af5('0x2')]},'description':{'type':Sequelize[_0x6af5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index f68c78a..927a332 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 _0x2eb2=['fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','includeAll','create','body','find','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','end','stack','name','send','map','FreshsalesConfiguration','rawAttributes'];(function(_0x41f7b2,_0x58547b){var _0x19ec6d=function(_0x11f687){while(--_0x11f687){_0x41f7b2['push'](_0x41f7b2['shift']());}};_0x19ec6d(++_0x58547b);}(_0x2eb2,0x19f));var _0x22eb=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x2eb2[_0xbe200f];return _0x192597;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22eb('0x0'));var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require(_0x22eb('0x5'));var Mustache=require('mustache');var util=require(_0x22eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x7'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f286c,_0x189f05){_0x189f05=_0x189f05||0xcc;return function(_0x128d43){if(_0x128d43){return _0x1f286c[_0x22eb('0x16')](_0x189f05);}return _0x1f286c[_0x22eb('0x17')](_0x189f05)['end']();};}function respondWithResult(_0x350ade,_0x53f14e){_0x53f14e=_0x53f14e||0xc8;return function(_0x1f5089){if(_0x1f5089){return _0x350ade['status'](_0x53f14e)[_0x22eb('0x18')](_0x1f5089);}};}function respondWithFilteredResult(_0x84c668,_0x53abbf){return function(_0x48b63c){if(_0x48b63c){var _0x4bc29a=typeof _0x53abbf[_0x22eb('0x19')]==='undefined'&&typeof _0x53abbf['limit']===_0x22eb('0x1a');var _0x4d9a71=_0x48b63c['count'];var _0xb7a73a=_0x4bc29a?0x0:_0x53abbf[_0x22eb('0x19')];var _0x385bcb=_0x4bc29a?_0x48b63c[_0x22eb('0x1b')]:_0x53abbf[_0x22eb('0x19')]+_0x53abbf['limit'];var _0x4182a8;if(_0x385bcb>=_0x4d9a71){_0x385bcb=_0x4d9a71;_0x4182a8=0xc8;}else{_0x4182a8=0xce;}_0x84c668[_0x22eb('0x17')](_0x4182a8);return _0x84c668[_0x22eb('0x1c')](_0x22eb('0x1d'),_0xb7a73a+'-'+_0x385bcb+'/'+_0x4d9a71)[_0x22eb('0x18')](_0x48b63c);}return null;};}function patchUpdates(_0x517313){return function(_0x2eb115){try{jsonpatch[_0x22eb('0x1e')](_0x2eb115,_0x517313,!![]);}catch(_0x2fc36e){return BPromise['reject'](_0x2fc36e);}return _0x2eb115['save']();};}function saveUpdates(_0x4335b7,_0x267d97){return function(_0x434ecb){if(_0x434ecb){return _0x434ecb[_0x22eb('0x1f')](_0x4335b7)[_0x22eb('0x20')](function(_0x3e8c1c){return _0x3e8c1c;});}return null;};}function removeEntity(_0x43dacb,_0x4e7e69){return function(_0x2e8f7c){if(_0x2e8f7c){return _0x2e8f7c[_0x22eb('0x21')]()[_0x22eb('0x20')](function(){_0x43dacb[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();});}};}function handleEntityNotFound(_0x4da252,_0x12c133){return function(_0x6f8ff3){if(!_0x6f8ff3){_0x4da252[_0x22eb('0x16')](0x194);}return _0x6f8ff3;};}function handleError(_0x5a001e,_0xe0783c){_0xe0783c=_0xe0783c||0x1f4;return function(_0x259847){logger['error'](_0x259847[_0x22eb('0x23')]);if(_0x259847[_0x22eb('0x24')]){delete _0x259847[_0x22eb('0x24')];}_0x5a001e[_0x22eb('0x17')](_0xe0783c)[_0x22eb('0x25')](_0x259847);};}exports['index']=function(_0x49dd59,_0x2a950e){var _0x25e5bc={},_0x44cf91={},_0x7c0119={'count':0x0,'rows':[]};var _0x1599c7=_[_0x22eb('0x26')](db[_0x22eb('0x27')][_0x22eb('0x28')],function(_0x382784){return{'name':_0x382784[_0x22eb('0x29')],'type':_0x382784[_0x22eb('0x2a')][_0x22eb('0x2b')]};});_0x44cf91['model']=_[_0x22eb('0x26')](_0x1599c7,'name');_0x44cf91[_0x22eb('0x2c')]=_[_0x22eb('0x2d')](_0x49dd59[_0x22eb('0x2c')]);_0x44cf91[_0x22eb('0x2e')]=_[_0x22eb('0x2f')](_0x44cf91[_0x22eb('0x30')],_0x44cf91[_0x22eb('0x2c')]);_0x25e5bc[_0x22eb('0x31')]=_[_0x22eb('0x2f')](_0x44cf91[_0x22eb('0x30')],qs['fields'](_0x49dd59['query'][_0x22eb('0x32')]));_0x25e5bc['attributes']=_0x25e5bc['attributes'][_0x22eb('0x33')]?_0x25e5bc[_0x22eb('0x31')]:_0x44cf91[_0x22eb('0x30')];if(!_0x49dd59[_0x22eb('0x2c')][_0x22eb('0x34')](_0x22eb('0x35'))){_0x25e5bc[_0x22eb('0x36')]=qs[_0x22eb('0x36')](_0x49dd59[_0x22eb('0x2c')][_0x22eb('0x36')]);_0x25e5bc['offset']=qs[_0x22eb('0x19')](_0x49dd59['query']['offset']);}_0x25e5bc[_0x22eb('0x37')]=qs[_0x22eb('0x38')](_0x49dd59['query'][_0x22eb('0x38')]);_0x25e5bc[_0x22eb('0x39')]=qs[_0x22eb('0x2e')](_[_0x22eb('0x3a')](_0x49dd59[_0x22eb('0x2c')],_0x44cf91['filters']),_0x1599c7);if(_0x49dd59[_0x22eb('0x2c')][_0x22eb('0x3b')]){_0x25e5bc['where']=_[_0x22eb('0x3c')](_0x25e5bc[_0x22eb('0x39')],{'$or':_[_0x22eb('0x26')](_0x1599c7,function(_0x2cc77c){if(_0x2cc77c[_0x22eb('0x2a')]!=='VIRTUAL'){var _0x51c8b5={};_0x51c8b5[_0x2cc77c[_0x22eb('0x24')]]={'$like':'%'+_0x49dd59[_0x22eb('0x2c')]['filter']+'%'};return _0x51c8b5;}})});}_0x25e5bc=_[_0x22eb('0x3c')]({},_0x25e5bc,_0x49dd59[_0x22eb('0x3d')]);var _0x46c6a1={'where':_0x25e5bc['where']};return db[_0x22eb('0x27')][_0x22eb('0x1b')](_0x46c6a1)[_0x22eb('0x20')](function(_0x2a8517){_0x7c0119[_0x22eb('0x1b')]=_0x2a8517;if(_0x49dd59[_0x22eb('0x2c')]['includeAll']){_0x25e5bc[_0x22eb('0x3e')]=[{'all':!![]}];}return db[_0x22eb('0x27')]['findAll'](_0x25e5bc);})[_0x22eb('0x20')](function(_0x44d39f){_0x7c0119[_0x22eb('0x3f')]=_0x44d39f;return _0x7c0119;})[_0x22eb('0x20')](respondWithFilteredResult(_0x2a950e,_0x25e5bc))[_0x22eb('0x40')](handleError(_0x2a950e,null));};exports[_0x22eb('0x41')]=function(_0x1ff04a,_0x78b250){var _0x1bafa3={'raw':![],'where':{'id':_0x1ff04a[_0x22eb('0x42')]['id']}},_0x82ace8={};_0x82ace8[_0x22eb('0x30')]=_[_0x22eb('0x2d')](db[_0x22eb('0x27')][_0x22eb('0x28')]);_0x82ace8[_0x22eb('0x2c')]=_[_0x22eb('0x2d')](_0x1ff04a[_0x22eb('0x2c')]);_0x82ace8['filters']=_[_0x22eb('0x2f')](_0x82ace8[_0x22eb('0x30')],_0x82ace8['query']);_0x1bafa3[_0x22eb('0x31')]=_[_0x22eb('0x2f')](_0x82ace8['model'],qs['fields'](_0x1ff04a['query'][_0x22eb('0x32')]));_0x1bafa3[_0x22eb('0x31')]=_0x1bafa3['attributes']['length']?_0x1bafa3[_0x22eb('0x31')]:_0x82ace8[_0x22eb('0x30')];if(_0x1ff04a[_0x22eb('0x2c')][_0x22eb('0x43')]){_0x1bafa3[_0x22eb('0x3e')]=[{'all':!![]}];}_0x1bafa3=_[_0x22eb('0x3c')]({},_0x1bafa3,_0x1ff04a[_0x22eb('0x3d')]);return db[_0x22eb('0x27')]['find'](_0x1bafa3)['then'](handleEntityNotFound(_0x78b250,null))[_0x22eb('0x20')](respondWithResult(_0x78b250,null))['catch'](handleError(_0x78b250,null));};exports[_0x22eb('0x44')]=function(_0x4bd819,_0x8a2b2c){return db['FreshsalesConfiguration']['create'](_0x4bd819['body'],{})['then'](respondWithResult(_0x8a2b2c,0xc9))[_0x22eb('0x40')](handleError(_0x8a2b2c,null));};exports['update']=function(_0x320211,_0x3b35c6){if(_0x320211['body']['id']){delete _0x320211[_0x22eb('0x45')]['id'];}return db['FreshsalesConfiguration'][_0x22eb('0x46')]({'where':{'id':_0x320211[_0x22eb('0x42')]['id']}})[_0x22eb('0x20')](handleEntityNotFound(_0x3b35c6,null))[_0x22eb('0x20')](saveUpdates(_0x320211[_0x22eb('0x45')],null))[_0x22eb('0x20')](respondWithResult(_0x3b35c6,null))[_0x22eb('0x40')](handleError(_0x3b35c6,null));};exports[_0x22eb('0x21')]=function(_0x11942d,_0x527ef1){return db[_0x22eb('0x27')][_0x22eb('0x46')]({'where':{'id':_0x11942d['params']['id']}})[_0x22eb('0x20')](handleEntityNotFound(_0x527ef1,null))[_0x22eb('0x20')](removeEntity(_0x527ef1,null))[_0x22eb('0x40')](handleError(_0x527ef1,null));};exports[_0x22eb('0x47')]=function(_0x4fee5c,_0x6c0600,_0x169ae1){var _0x3b1cd2={};var _0x3e3fae={};var _0x447177;var _0x10393b;return db['FreshsalesConfiguration'][_0x22eb('0x48')]({'where':{'id':_0x4fee5c['params']['id']}})[_0x22eb('0x20')](handleEntityNotFound(_0x6c0600,null))['then'](function(_0x13859b){if(_0x13859b){_0x447177=_0x13859b;_0x3e3fae[_0x22eb('0x30')]=_[_0x22eb('0x2d')](db[_0x22eb('0x49')][_0x22eb('0x28')]);_0x3e3fae['query']=_['keys'](_0x4fee5c[_0x22eb('0x2c')]);_0x3e3fae[_0x22eb('0x2e')]=_['intersection'](_0x3e3fae[_0x22eb('0x30')],_0x3e3fae[_0x22eb('0x2c')]);_0x3b1cd2[_0x22eb('0x31')]=_[_0x22eb('0x2f')](_0x3e3fae[_0x22eb('0x30')],qs[_0x22eb('0x32')](_0x4fee5c[_0x22eb('0x2c')][_0x22eb('0x32')]));_0x3b1cd2[_0x22eb('0x31')]=_0x3b1cd2[_0x22eb('0x31')][_0x22eb('0x33')]?_0x3b1cd2['attributes']:_0x3e3fae[_0x22eb('0x30')];_0x3b1cd2[_0x22eb('0x37')]=qs[_0x22eb('0x38')](_0x4fee5c[_0x22eb('0x2c')][_0x22eb('0x38')]);_0x3b1cd2[_0x22eb('0x39')]=qs[_0x22eb('0x2e')](_[_0x22eb('0x3a')](_0x4fee5c[_0x22eb('0x2c')],_0x3e3fae[_0x22eb('0x2e')]));if(_0x4fee5c[_0x22eb('0x2c')][_0x22eb('0x3b')]){_0x3b1cd2[_0x22eb('0x39')]=_[_0x22eb('0x3c')](_0x3b1cd2['where'],{'$or':_['map'](_0x3b1cd2[_0x22eb('0x31')],function(_0x91c8a3){var _0x165e79={};_0x165e79[_0x91c8a3]={'$like':'%'+_0x4fee5c[_0x22eb('0x2c')][_0x22eb('0x3b')]+'%'};return _0x165e79;})});}_0x3b1cd2=_['merge']({},_0x3b1cd2,_0x4fee5c[_0x22eb('0x3d')]);return _0x447177[_0x22eb('0x47')](_0x3b1cd2);}})['then'](function(_0x485408){if(_0x485408){_0x10393b=_0x485408[_0x22eb('0x33')];if(!_0x4fee5c[_0x22eb('0x2c')][_0x22eb('0x34')](_0x22eb('0x35'))){_0x3b1cd2[_0x22eb('0x36')]=qs[_0x22eb('0x36')](_0x4fee5c[_0x22eb('0x2c')][_0x22eb('0x36')]);_0x3b1cd2[_0x22eb('0x19')]=qs[_0x22eb('0x19')](_0x4fee5c[_0x22eb('0x2c')][_0x22eb('0x19')]);}return _0x447177[_0x22eb('0x47')](_0x3b1cd2);}})[_0x22eb('0x20')](function(_0x4aea9d){if(_0x4aea9d){return _0x4aea9d?{'count':_0x10393b,'rows':_0x4aea9d}:null;}})[_0x22eb('0x20')](respondWithResult(_0x6c0600,null))[_0x22eb('0x40')](handleError(_0x6c0600,null));};exports[_0x22eb('0x4a')]=function(_0x5dbc43,_0x1787ec,_0x5ac4c5){var _0x27b082={};var _0x5347b4={};var _0x1919d0;var _0x43f4a1;return db['FreshsalesConfiguration'][_0x22eb('0x48')]({'where':{'id':_0x5dbc43[_0x22eb('0x42')]['id']}})['then'](handleEntityNotFound(_0x1787ec,null))['then'](function(_0x32819b){if(_0x32819b){_0x1919d0=_0x32819b;_0x5347b4[_0x22eb('0x30')]=_[_0x22eb('0x2d')](db[_0x22eb('0x49')][_0x22eb('0x28')]);_0x5347b4[_0x22eb('0x2c')]=_['keys'](_0x5dbc43[_0x22eb('0x2c')]);_0x5347b4['filters']=_['intersection'](_0x5347b4[_0x22eb('0x30')],_0x5347b4[_0x22eb('0x2c')]);_0x27b082[_0x22eb('0x31')]=_[_0x22eb('0x2f')](_0x5347b4[_0x22eb('0x30')],qs[_0x22eb('0x32')](_0x5dbc43[_0x22eb('0x2c')][_0x22eb('0x32')]));_0x27b082['attributes']=_0x27b082['attributes'][_0x22eb('0x33')]?_0x27b082[_0x22eb('0x31')]:_0x5347b4['model'];_0x27b082[_0x22eb('0x37')]=qs[_0x22eb('0x38')](_0x5dbc43[_0x22eb('0x2c')][_0x22eb('0x38')]);_0x27b082[_0x22eb('0x39')]=qs[_0x22eb('0x2e')](_['pick'](_0x5dbc43[_0x22eb('0x2c')],_0x5347b4[_0x22eb('0x2e')]));if(_0x5dbc43[_0x22eb('0x2c')]['filter']){_0x27b082['where']=_[_0x22eb('0x3c')](_0x27b082[_0x22eb('0x39')],{'$or':_[_0x22eb('0x26')](_0x27b082['attributes'],function(_0x2408d9){var _0x4b6cf3={};_0x4b6cf3[_0x2408d9]={'$like':'%'+_0x5dbc43[_0x22eb('0x2c')][_0x22eb('0x3b')]+'%'};return _0x4b6cf3;})});}_0x27b082=_[_0x22eb('0x3c')]({},_0x27b082,_0x5dbc43[_0x22eb('0x3d')]);return _0x1919d0['getDescriptions'](_0x27b082);}})[_0x22eb('0x20')](function(_0x2e35b0){if(_0x2e35b0){_0x43f4a1=_0x2e35b0[_0x22eb('0x33')];if(!_0x5dbc43[_0x22eb('0x2c')][_0x22eb('0x34')](_0x22eb('0x35'))){_0x27b082[_0x22eb('0x36')]=qs[_0x22eb('0x36')](_0x5dbc43[_0x22eb('0x2c')][_0x22eb('0x36')]);_0x27b082[_0x22eb('0x19')]=qs['offset'](_0x5dbc43[_0x22eb('0x2c')][_0x22eb('0x19')]);}return _0x1919d0['getDescriptions'](_0x27b082);}})['then'](function(_0x51d9f4){if(_0x51d9f4){return _0x51d9f4?{'count':_0x43f4a1,'rows':_0x51d9f4}:null;}})[_0x22eb('0x20')](respondWithResult(_0x1787ec,null))[_0x22eb('0x40')](handleError(_0x1787ec,null));};exports['getFields']=function(_0x10726f,_0x15e08a,_0xe6e71d){var _0x41c50e={};var _0x8cbc83={};var _0x4ab4f8;var _0x5e01b5;return db[_0x22eb('0x27')][_0x22eb('0x48')]({'where':{'id':_0x10726f[_0x22eb('0x42')]['id']}})['then'](handleEntityNotFound(_0x15e08a,null))['then'](function(_0xc6af66){if(_0xc6af66){_0x4ab4f8=_0xc6af66;_0x8cbc83['model']=_['keys'](db[_0x22eb('0x49')][_0x22eb('0x28')]);_0x8cbc83['query']=_['keys'](_0x10726f[_0x22eb('0x2c')]);_0x8cbc83[_0x22eb('0x2e')]=_['intersection'](_0x8cbc83[_0x22eb('0x30')],_0x8cbc83[_0x22eb('0x2c')]);_0x41c50e[_0x22eb('0x31')]=_['intersection'](_0x8cbc83[_0x22eb('0x30')],qs[_0x22eb('0x32')](_0x10726f[_0x22eb('0x2c')][_0x22eb('0x32')]));_0x41c50e[_0x22eb('0x31')]=_0x41c50e['attributes'][_0x22eb('0x33')]?_0x41c50e[_0x22eb('0x31')]:_0x8cbc83[_0x22eb('0x30')];_0x41c50e['order']=qs['sort'](_0x10726f[_0x22eb('0x2c')][_0x22eb('0x38')]);_0x41c50e[_0x22eb('0x39')]=qs['filters'](_[_0x22eb('0x3a')](_0x10726f[_0x22eb('0x2c')],_0x8cbc83[_0x22eb('0x2e')]));if(_0x10726f['query'][_0x22eb('0x3b')]){_0x41c50e['where']=_['merge'](_0x41c50e[_0x22eb('0x39')],{'$or':_[_0x22eb('0x26')](_0x41c50e[_0x22eb('0x31')],function(_0x49f362){var _0x3fc402={};_0x3fc402[_0x49f362]={'$like':'%'+_0x10726f[_0x22eb('0x2c')][_0x22eb('0x3b')]+'%'};return _0x3fc402;})});}_0x41c50e=_[_0x22eb('0x3c')]({},_0x41c50e,_0x10726f[_0x22eb('0x3d')]);return _0x4ab4f8['getFields'](_0x41c50e);}})[_0x22eb('0x20')](function(_0x4c88d8){if(_0x4c88d8){_0x5e01b5=_0x4c88d8[_0x22eb('0x33')];if(!_0x10726f[_0x22eb('0x2c')][_0x22eb('0x34')]('nolimit')){_0x41c50e[_0x22eb('0x36')]=qs[_0x22eb('0x36')](_0x10726f[_0x22eb('0x2c')][_0x22eb('0x36')]);_0x41c50e[_0x22eb('0x19')]=qs[_0x22eb('0x19')](_0x10726f[_0x22eb('0x2c')][_0x22eb('0x19')]);}return _0x4ab4f8[_0x22eb('0x4b')](_0x41c50e);}})[_0x22eb('0x20')](function(_0x4281ea){if(_0x4281ea){return _0x4281ea?{'count':_0x5e01b5,'rows':_0x4281ea}:null;}})['then'](respondWithResult(_0x15e08a,null))[_0x22eb('0x40')](handleError(_0x15e08a,null));}; \ No newline at end of file +var _0x12f5=['include','findAll','rows','show','find','catch','create','body','params','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','FreshsalesConfiguration','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll'];(function(_0x1b0a6e,_0x5c4262){var _0x18fd42=function(_0xf8f3a){while(--_0xf8f3a){_0x1b0a6e['push'](_0x1b0a6e['shift']());}};_0x18fd42(++_0x5c4262);}(_0x12f5,0xb6));var _0x512f=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x12f5[_0x5f09c5];return _0x426ad9;};'use strict';var emlformat=require(_0x512f('0x0'));var rimraf=require(_0x512f('0x1'));var zipdir=require(_0x512f('0x2'));var jsonpatch=require(_0x512f('0x3'));var rp=require(_0x512f('0x4'));var moment=require(_0x512f('0x5'));var BPromise=require(_0x512f('0x6'));var Mustache=require('mustache');var util=require(_0x512f('0x7'));var path=require(_0x512f('0x8'));var sox=require(_0x512f('0x9'));var csv=require(_0x512f('0xa'));var ejs=require(_0x512f('0xb'));var fs=require('fs');var fs_extra=require(_0x512f('0xc'));var _=require(_0x512f('0xd'));var squel=require('squel');var crypto=require(_0x512f('0xe'));var jsforce=require(_0x512f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x512f('0xa'));var querystring=require(_0x512f('0x10'));var Papa=require(_0x512f('0x11'));var Redis=require(_0x512f('0x12'));var authService=require(_0x512f('0x13'));var qs=require(_0x512f('0x14'));var as=require(_0x512f('0x15'));var hardwareService=require(_0x512f('0x16'));var logger=require(_0x512f('0x17'))(_0x512f('0x18'));var utils=require(_0x512f('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x512f('0x1a'));var db=require(_0x512f('0x1b'))['db'];function respondWithStatusCode(_0x4b8091,_0x358442){_0x358442=_0x358442||0xcc;return function(_0x55c3d9){if(_0x55c3d9){return _0x4b8091[_0x512f('0x1c')](_0x358442);}return _0x4b8091[_0x512f('0x1d')](_0x358442)[_0x512f('0x1e')]();};}function respondWithResult(_0x332293,_0x3debad){_0x3debad=_0x3debad||0xc8;return function(_0x970e63){if(_0x970e63){return _0x332293[_0x512f('0x1d')](_0x3debad)[_0x512f('0x1f')](_0x970e63);}};}function respondWithFilteredResult(_0x3061bb,_0x4e357a){return function(_0x54e287){if(_0x54e287){var _0x587316=typeof _0x4e357a[_0x512f('0x20')]==='undefined'&&typeof _0x4e357a[_0x512f('0x21')]===_0x512f('0x22');var _0x3631cd=_0x54e287['count'];var _0x524766=_0x587316?0x0:_0x4e357a[_0x512f('0x20')];var _0x40f8ff=_0x587316?_0x54e287[_0x512f('0x23')]:_0x4e357a[_0x512f('0x20')]+_0x4e357a['limit'];var _0x2ee4e6;if(_0x40f8ff>=_0x3631cd){_0x40f8ff=_0x3631cd;_0x2ee4e6=0xc8;}else{_0x2ee4e6=0xce;}_0x3061bb[_0x512f('0x1d')](_0x2ee4e6);return _0x3061bb[_0x512f('0x24')](_0x512f('0x25'),_0x524766+'-'+_0x40f8ff+'/'+_0x3631cd)[_0x512f('0x1f')](_0x54e287);}return null;};}function patchUpdates(_0x137ee8){return function(_0x1c1da5){try{jsonpatch['apply'](_0x1c1da5,_0x137ee8,!![]);}catch(_0x57ab78){return BPromise['reject'](_0x57ab78);}return _0x1c1da5[_0x512f('0x26')]();};}function saveUpdates(_0x34f28d,_0x478daf){return function(_0x49c967){if(_0x49c967){return _0x49c967[_0x512f('0x27')](_0x34f28d)[_0x512f('0x28')](function(_0x18f2a3){return _0x18f2a3;});}return null;};}function removeEntity(_0x141301,_0xa2b57b){return function(_0x13ddba){if(_0x13ddba){return _0x13ddba[_0x512f('0x29')]()[_0x512f('0x28')](function(){_0x141301['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30474e,_0x54a28d){return function(_0x46358f){if(!_0x46358f){_0x30474e['sendStatus'](0x194);}return _0x46358f;};}function handleError(_0x264ac2,_0x3940b3){_0x3940b3=_0x3940b3||0x1f4;return function(_0xfec5d1){logger[_0x512f('0x2a')](_0xfec5d1[_0x512f('0x2b')]);if(_0xfec5d1[_0x512f('0x2c')]){delete _0xfec5d1[_0x512f('0x2c')];}_0x264ac2[_0x512f('0x1d')](_0x3940b3)['send'](_0xfec5d1);};}exports[_0x512f('0x2d')]=function(_0x538767,_0x384c76){var _0x4119c1={},_0x53f0c2={},_0x13d3c9={'count':0x0,'rows':[]};var _0x197998=_[_0x512f('0x2e')](db[_0x512f('0x2f')][_0x512f('0x30')],function(_0x22243d){return{'name':_0x22243d['fieldName'],'type':_0x22243d['type'][_0x512f('0x31')]};});_0x53f0c2['model']=_['map'](_0x197998,_0x512f('0x2c'));_0x53f0c2[_0x512f('0x32')]=_[_0x512f('0x33')](_0x538767[_0x512f('0x32')]);_0x53f0c2[_0x512f('0x34')]=_[_0x512f('0x35')](_0x53f0c2[_0x512f('0x36')],_0x53f0c2['query']);_0x4119c1[_0x512f('0x37')]=_[_0x512f('0x35')](_0x53f0c2[_0x512f('0x36')],qs[_0x512f('0x38')](_0x538767[_0x512f('0x32')]['fields']));_0x4119c1[_0x512f('0x37')]=_0x4119c1[_0x512f('0x37')][_0x512f('0x39')]?_0x4119c1[_0x512f('0x37')]:_0x53f0c2[_0x512f('0x36')];if(!_0x538767[_0x512f('0x32')][_0x512f('0x3a')](_0x512f('0x3b'))){_0x4119c1[_0x512f('0x21')]=qs[_0x512f('0x21')](_0x538767[_0x512f('0x32')][_0x512f('0x21')]);_0x4119c1[_0x512f('0x20')]=qs['offset'](_0x538767[_0x512f('0x32')][_0x512f('0x20')]);}_0x4119c1[_0x512f('0x3c')]=qs['sort'](_0x538767[_0x512f('0x32')][_0x512f('0x3d')]);_0x4119c1['where']=qs[_0x512f('0x34')](_[_0x512f('0x3e')](_0x538767[_0x512f('0x32')],_0x53f0c2['filters']),_0x197998);if(_0x538767[_0x512f('0x32')][_0x512f('0x3f')]){_0x4119c1[_0x512f('0x40')]=_[_0x512f('0x41')](_0x4119c1[_0x512f('0x40')],{'$or':_['map'](_0x197998,function(_0x33852f){if(_0x33852f[_0x512f('0x42')]!==_0x512f('0x43')){var _0x150508={};_0x150508[_0x33852f[_0x512f('0x2c')]]={'$like':'%'+_0x538767[_0x512f('0x32')][_0x512f('0x3f')]+'%'};return _0x150508;}})});}_0x4119c1=_[_0x512f('0x41')]({},_0x4119c1,_0x538767[_0x512f('0x44')]);var _0x55e94e={'where':_0x4119c1['where']};return db['FreshsalesConfiguration']['count'](_0x55e94e)[_0x512f('0x28')](function(_0x63b401){_0x13d3c9['count']=_0x63b401;if(_0x538767[_0x512f('0x32')][_0x512f('0x45')]){_0x4119c1[_0x512f('0x46')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x512f('0x47')](_0x4119c1);})[_0x512f('0x28')](function(_0x561754){_0x13d3c9[_0x512f('0x48')]=_0x561754;return _0x13d3c9;})[_0x512f('0x28')](respondWithFilteredResult(_0x384c76,_0x4119c1))['catch'](handleError(_0x384c76,null));};exports[_0x512f('0x49')]=function(_0x43ff58,_0x18720c){var _0x5ca1a5={'raw':![],'where':{'id':_0x43ff58['params']['id']}},_0xdcaa1c={};_0xdcaa1c[_0x512f('0x36')]=_[_0x512f('0x33')](db[_0x512f('0x2f')][_0x512f('0x30')]);_0xdcaa1c[_0x512f('0x32')]=_[_0x512f('0x33')](_0x43ff58['query']);_0xdcaa1c[_0x512f('0x34')]=_['intersection'](_0xdcaa1c[_0x512f('0x36')],_0xdcaa1c[_0x512f('0x32')]);_0x5ca1a5[_0x512f('0x37')]=_[_0x512f('0x35')](_0xdcaa1c[_0x512f('0x36')],qs[_0x512f('0x38')](_0x43ff58['query']['fields']));_0x5ca1a5[_0x512f('0x37')]=_0x5ca1a5[_0x512f('0x37')][_0x512f('0x39')]?_0x5ca1a5['attributes']:_0xdcaa1c[_0x512f('0x36')];if(_0x43ff58[_0x512f('0x32')][_0x512f('0x45')]){_0x5ca1a5[_0x512f('0x46')]=[{'all':!![]}];}_0x5ca1a5=_[_0x512f('0x41')]({},_0x5ca1a5,_0x43ff58[_0x512f('0x44')]);return db[_0x512f('0x2f')][_0x512f('0x4a')](_0x5ca1a5)[_0x512f('0x28')](handleEntityNotFound(_0x18720c,null))[_0x512f('0x28')](respondWithResult(_0x18720c,null))[_0x512f('0x4b')](handleError(_0x18720c,null));};exports[_0x512f('0x4c')]=function(_0x125c50,_0x428cfa){return db[_0x512f('0x2f')][_0x512f('0x4c')](_0x125c50[_0x512f('0x4d')],{})[_0x512f('0x28')](respondWithResult(_0x428cfa,0xc9))[_0x512f('0x4b')](handleError(_0x428cfa,null));};exports['update']=function(_0x7a0dd8,_0x170bf7){if(_0x7a0dd8['body']['id']){delete _0x7a0dd8[_0x512f('0x4d')]['id'];}return db[_0x512f('0x2f')][_0x512f('0x4a')]({'where':{'id':_0x7a0dd8[_0x512f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x170bf7,null))['then'](saveUpdates(_0x7a0dd8[_0x512f('0x4d')],null))[_0x512f('0x28')](respondWithResult(_0x170bf7,null))[_0x512f('0x4b')](handleError(_0x170bf7,null));};exports[_0x512f('0x29')]=function(_0x51485a,_0x1a4d11){return db[_0x512f('0x2f')][_0x512f('0x4a')]({'where':{'id':_0x51485a[_0x512f('0x4e')]['id']}})[_0x512f('0x28')](handleEntityNotFound(_0x1a4d11,null))[_0x512f('0x28')](removeEntity(_0x1a4d11,null))[_0x512f('0x4b')](handleError(_0x1a4d11,null));};exports[_0x512f('0x4f')]=function(_0xb1c4ec,_0x1d5655,_0x59fd1e){var _0x5d8fab={};var _0x554a5d={};var _0x48591c;var _0x17016b;return db['FreshsalesConfiguration'][_0x512f('0x50')]({'where':{'id':_0xb1c4ec[_0x512f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1d5655,null))[_0x512f('0x28')](function(_0x318f2d){if(_0x318f2d){_0x48591c=_0x318f2d;_0x554a5d[_0x512f('0x36')]=_[_0x512f('0x33')](db[_0x512f('0x51')][_0x512f('0x30')]);_0x554a5d[_0x512f('0x32')]=_[_0x512f('0x33')](_0xb1c4ec[_0x512f('0x32')]);_0x554a5d[_0x512f('0x34')]=_[_0x512f('0x35')](_0x554a5d['model'],_0x554a5d[_0x512f('0x32')]);_0x5d8fab[_0x512f('0x37')]=_['intersection'](_0x554a5d[_0x512f('0x36')],qs[_0x512f('0x38')](_0xb1c4ec[_0x512f('0x32')][_0x512f('0x38')]));_0x5d8fab[_0x512f('0x37')]=_0x5d8fab[_0x512f('0x37')][_0x512f('0x39')]?_0x5d8fab[_0x512f('0x37')]:_0x554a5d[_0x512f('0x36')];_0x5d8fab[_0x512f('0x3c')]=qs[_0x512f('0x3d')](_0xb1c4ec[_0x512f('0x32')][_0x512f('0x3d')]);_0x5d8fab['where']=qs['filters'](_[_0x512f('0x3e')](_0xb1c4ec[_0x512f('0x32')],_0x554a5d['filters']));if(_0xb1c4ec['query'][_0x512f('0x3f')]){_0x5d8fab[_0x512f('0x40')]=_[_0x512f('0x41')](_0x5d8fab['where'],{'$or':_[_0x512f('0x2e')](_0x5d8fab[_0x512f('0x37')],function(_0x43001c){var _0x2ea01c={};_0x2ea01c[_0x43001c]={'$like':'%'+_0xb1c4ec[_0x512f('0x32')][_0x512f('0x3f')]+'%'};return _0x2ea01c;})});}_0x5d8fab=_[_0x512f('0x41')]({},_0x5d8fab,_0xb1c4ec[_0x512f('0x44')]);return _0x48591c[_0x512f('0x4f')](_0x5d8fab);}})['then'](function(_0x1c5b68){if(_0x1c5b68){_0x17016b=_0x1c5b68[_0x512f('0x39')];if(!_0xb1c4ec[_0x512f('0x32')][_0x512f('0x3a')]('nolimit')){_0x5d8fab['limit']=qs[_0x512f('0x21')](_0xb1c4ec[_0x512f('0x32')]['limit']);_0x5d8fab[_0x512f('0x20')]=qs[_0x512f('0x20')](_0xb1c4ec[_0x512f('0x32')][_0x512f('0x20')]);}return _0x48591c[_0x512f('0x4f')](_0x5d8fab);}})[_0x512f('0x28')](function(_0x5ee732){if(_0x5ee732){return _0x5ee732?{'count':_0x17016b,'rows':_0x5ee732}:null;}})['then'](respondWithResult(_0x1d5655,null))[_0x512f('0x4b')](handleError(_0x1d5655,null));};exports['getDescriptions']=function(_0x599708,_0x2fff0c,_0x4be8e2){var _0x2daa6a={};var _0x463b93={};var _0x453511;var _0x5eddea;return db[_0x512f('0x2f')][_0x512f('0x50')]({'where':{'id':_0x599708[_0x512f('0x4e')]['id']}})[_0x512f('0x28')](handleEntityNotFound(_0x2fff0c,null))[_0x512f('0x28')](function(_0x805271){if(_0x805271){_0x453511=_0x805271;_0x463b93[_0x512f('0x36')]=_['keys'](db[_0x512f('0x51')]['rawAttributes']);_0x463b93[_0x512f('0x32')]=_['keys'](_0x599708['query']);_0x463b93[_0x512f('0x34')]=_[_0x512f('0x35')](_0x463b93['model'],_0x463b93[_0x512f('0x32')]);_0x2daa6a[_0x512f('0x37')]=_[_0x512f('0x35')](_0x463b93[_0x512f('0x36')],qs[_0x512f('0x38')](_0x599708[_0x512f('0x32')]['fields']));_0x2daa6a[_0x512f('0x37')]=_0x2daa6a['attributes'][_0x512f('0x39')]?_0x2daa6a[_0x512f('0x37')]:_0x463b93[_0x512f('0x36')];_0x2daa6a[_0x512f('0x3c')]=qs[_0x512f('0x3d')](_0x599708['query'][_0x512f('0x3d')]);_0x2daa6a[_0x512f('0x40')]=qs[_0x512f('0x34')](_[_0x512f('0x3e')](_0x599708[_0x512f('0x32')],_0x463b93['filters']));if(_0x599708['query'][_0x512f('0x3f')]){_0x2daa6a[_0x512f('0x40')]=_[_0x512f('0x41')](_0x2daa6a[_0x512f('0x40')],{'$or':_[_0x512f('0x2e')](_0x2daa6a[_0x512f('0x37')],function(_0x208326){var _0x34cd13={};_0x34cd13[_0x208326]={'$like':'%'+_0x599708[_0x512f('0x32')][_0x512f('0x3f')]+'%'};return _0x34cd13;})});}_0x2daa6a=_[_0x512f('0x41')]({},_0x2daa6a,_0x599708['options']);return _0x453511[_0x512f('0x52')](_0x2daa6a);}})[_0x512f('0x28')](function(_0x9e1ec1){if(_0x9e1ec1){_0x5eddea=_0x9e1ec1[_0x512f('0x39')];if(!_0x599708[_0x512f('0x32')][_0x512f('0x3a')](_0x512f('0x3b'))){_0x2daa6a[_0x512f('0x21')]=qs['limit'](_0x599708[_0x512f('0x32')][_0x512f('0x21')]);_0x2daa6a[_0x512f('0x20')]=qs[_0x512f('0x20')](_0x599708[_0x512f('0x32')][_0x512f('0x20')]);}return _0x453511[_0x512f('0x52')](_0x2daa6a);}})[_0x512f('0x28')](function(_0x114f23){if(_0x114f23){return _0x114f23?{'count':_0x5eddea,'rows':_0x114f23}:null;}})[_0x512f('0x28')](respondWithResult(_0x2fff0c,null))[_0x512f('0x4b')](handleError(_0x2fff0c,null));};exports[_0x512f('0x53')]=function(_0x5f46a7,_0x7a1cbc,_0x52f3ee){var _0x476aad={};var _0x2d16eb={};var _0x11127d;var _0x59e438;return db[_0x512f('0x2f')][_0x512f('0x50')]({'where':{'id':_0x5f46a7['params']['id']}})[_0x512f('0x28')](handleEntityNotFound(_0x7a1cbc,null))['then'](function(_0x67026b){if(_0x67026b){_0x11127d=_0x67026b;_0x2d16eb[_0x512f('0x36')]=_[_0x512f('0x33')](db[_0x512f('0x51')][_0x512f('0x30')]);_0x2d16eb[_0x512f('0x32')]=_[_0x512f('0x33')](_0x5f46a7[_0x512f('0x32')]);_0x2d16eb[_0x512f('0x34')]=_[_0x512f('0x35')](_0x2d16eb[_0x512f('0x36')],_0x2d16eb[_0x512f('0x32')]);_0x476aad[_0x512f('0x37')]=_[_0x512f('0x35')](_0x2d16eb[_0x512f('0x36')],qs[_0x512f('0x38')](_0x5f46a7['query'][_0x512f('0x38')]));_0x476aad['attributes']=_0x476aad[_0x512f('0x37')][_0x512f('0x39')]?_0x476aad['attributes']:_0x2d16eb[_0x512f('0x36')];_0x476aad['order']=qs[_0x512f('0x3d')](_0x5f46a7['query']['sort']);_0x476aad[_0x512f('0x40')]=qs[_0x512f('0x34')](_['pick'](_0x5f46a7['query'],_0x2d16eb[_0x512f('0x34')]));if(_0x5f46a7['query'][_0x512f('0x3f')]){_0x476aad[_0x512f('0x40')]=_[_0x512f('0x41')](_0x476aad[_0x512f('0x40')],{'$or':_[_0x512f('0x2e')](_0x476aad['attributes'],function(_0xa4dac3){var _0xb0a1a7={};_0xb0a1a7[_0xa4dac3]={'$like':'%'+_0x5f46a7[_0x512f('0x32')]['filter']+'%'};return _0xb0a1a7;})});}_0x476aad=_[_0x512f('0x41')]({},_0x476aad,_0x5f46a7['options']);return _0x11127d[_0x512f('0x53')](_0x476aad);}})[_0x512f('0x28')](function(_0x4c5ea1){if(_0x4c5ea1){_0x59e438=_0x4c5ea1['length'];if(!_0x5f46a7[_0x512f('0x32')]['hasOwnProperty']('nolimit')){_0x476aad[_0x512f('0x21')]=qs[_0x512f('0x21')](_0x5f46a7[_0x512f('0x32')][_0x512f('0x21')]);_0x476aad[_0x512f('0x20')]=qs['offset'](_0x5f46a7[_0x512f('0x32')][_0x512f('0x20')]);}return _0x11127d[_0x512f('0x53')](_0x476aad);}})['then'](function(_0x335d04){if(_0x335d04){return _0x335d04?{'count':_0x59e438,'rows':_0x335d04}:null;}})[_0x512f('0x28')](respondWithResult(_0x7a1cbc,null))[_0x512f('0x4b')](handleError(_0x7a1cbc,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index f9ed844..12002cc 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 _0x5c68=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x96347d,_0x3abaa5){var _0x5ec4dd=function(_0x3b873d){while(--_0x3b873d){_0x96347d['push'](_0x96347d['shift']());}};_0x5ec4dd(++_0x3abaa5);}(_0x5c68,0x1e9));var _0x85c6=function(_0x14db22,_0x37cb2f){_0x14db22=_0x14db22-0x0;var _0x4ffb1f=_0x5c68[_0x14db22];return _0x4ffb1f;};'use strict';var _=require(_0x85c6('0x0'));var util=require(_0x85c6('0x1'));var logger=require(_0x85c6('0x2'))(_0x85c6('0x3'));var moment=require(_0x85c6('0x4'));var BPromise=require(_0x85c6('0x5'));var rp=require(_0x85c6('0x6'));var fs=require('fs');var path=require(_0x85c6('0x7'));var rimraf=require('rimraf');var config=require(_0x85c6('0x8'));var attributes=require(_0x85c6('0x9'));module[_0x85c6('0xa')]=function(_0x3391cc,_0x2ad14c){return _0x3391cc[_0x85c6('0xb')](_0x85c6('0xc'),attributes,{'tableName':_0x85c6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01dc=['api','moment','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x544afe,_0x256f92){var _0x12d9e9=function(_0x460830){while(--_0x460830){_0x544afe['push'](_0x544afe['shift']());}};_0x12d9e9(++_0x256f92);}(_0x01dc,0x1aa));var _0xc01d=function(_0x28ab59,_0x592c6f){_0x28ab59=_0x28ab59-0x0;var _0x1a525c=_0x01dc[_0x28ab59];return _0x1a525c;};'use strict';var _=require(_0xc01d('0x0'));var util=require(_0xc01d('0x1'));var logger=require(_0xc01d('0x2'))(_0xc01d('0x3'));var moment=require(_0xc01d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc01d('0x5'));var config=require('../../config/environment');var attributes=require(_0xc01d('0x6'));module[_0xc01d('0x7')]=function(_0x2a748d,_0x2dd4f0){return _0x2a748d[_0xc01d('0x8')](_0xc01d('0x9'),attributes,{'tableName':_0xc01d('0xa'),'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 9a76875..35d71d9 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 _0xea3f=['message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x371e03,_0x60750e){var _0x37789c=function(_0xb9bf6f){while(--_0xb9bf6f){_0x371e03['push'](_0x371e03['shift']());}};_0x37789c(++_0x60750e);}(_0xea3f,0x17d));var _0xfea3=function(_0x53b133,_0x176261){_0x53b133=_0x53b133-0x0;var _0x5647e0=_0xea3f[_0x53b133];return _0x5647e0;};'use strict';var _=require(_0xfea3('0x0'));var util=require(_0xfea3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfea3('0x2'));var db=require(_0xfea3('0x3'))['db'];var utils=require(_0xfea3('0x4'));var logger=require('../../config/logger')(_0xfea3('0x5'));var config=require(_0xfea3('0x6'));var jayson=require(_0xfea3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5f44a7,_0x3a193d,_0x31e21b){return new BPromise(function(_0x2d7fb0,_0x306243){return client[_0xfea3('0x8')](_0x5f44a7,_0x31e21b)[_0xfea3('0x9')](function(_0x348218){logger[_0xfea3('0xa')](_0xfea3('0xb'),_0x3a193d,_0xfea3('0xc'));logger[_0xfea3('0xd')](_0xfea3('0xe'),_0x3a193d,_0xfea3('0xc'),JSON[_0xfea3('0xf')](_0x348218));if(_0x348218[_0xfea3('0x10')]){if(_0x348218[_0xfea3('0x10')][_0xfea3('0x11')]===0x1f4){logger[_0xfea3('0x10')](_0xfea3('0xb'),_0x3a193d,_0x348218[_0xfea3('0x10')][_0xfea3('0x12')]);return _0x306243(_0x348218[_0xfea3('0x10')][_0xfea3('0x12')]);}logger['error'](_0xfea3('0xb'),_0x3a193d,_0x348218[_0xfea3('0x10')][_0xfea3('0x12')]);return _0x2d7fb0(_0x348218[_0xfea3('0x10')][_0xfea3('0x12')]);}else{logger['info'](_0xfea3('0xb'),_0x3a193d,'request\x20sent');_0x2d7fb0(_0x348218[_0xfea3('0x13')][_0xfea3('0x12')]);}})[_0xfea3('0x14')](function(_0x1338a9){logger['error'](_0xfea3('0xb'),_0x3a193d,_0x1338a9);_0x306243(_0x1338a9);});});} \ No newline at end of file +var _0x35a3=['http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x340c76,_0x2aa33c){var _0x304eb3=function(_0x2da4c6){while(--_0x2da4c6){_0x340c76['push'](_0x340c76['shift']());}};_0x304eb3(++_0x2aa33c);}(_0x35a3,0xce));var _0x335a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x35a3[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x335a('0x0'));var util=require(_0x335a('0x1'));var moment=require('moment');var BPromise=require(_0x335a('0x2'));var rs=require(_0x335a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x335a('0x4'));var logger=require(_0x335a('0x5'))(_0x335a('0x6'));var config=require(_0x335a('0x7'));var jayson=require(_0x335a('0x8'));var client=jayson[_0x335a('0x9')][_0x335a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xba8ff7,_0x3155bd,_0x2f0970){return new BPromise(function(_0x3bb2aa,_0x5d1f6f){return client['request'](_0xba8ff7,_0x2f0970)[_0x335a('0xb')](function(_0x773b27){logger[_0x335a('0xc')](_0x335a('0xd'),_0x3155bd,_0x335a('0xe'));logger[_0x335a('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x3155bd,'request\x20sent',JSON['stringify'](_0x773b27));if(_0x773b27['error']){if(_0x773b27[_0x335a('0x10')]['code']===0x1f4){logger[_0x335a('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3155bd,_0x773b27[_0x335a('0x10')]['message']);return _0x5d1f6f(_0x773b27[_0x335a('0x10')][_0x335a('0x11')]);}logger['error'](_0x335a('0xd'),_0x3155bd,_0x773b27[_0x335a('0x10')][_0x335a('0x11')]);return _0x3bb2aa(_0x773b27[_0x335a('0x10')][_0x335a('0x11')]);}else{logger['info'](_0x335a('0xd'),_0x3155bd,_0x335a('0xe'));_0x3bb2aa(_0x773b27['result']['message']);}})['catch'](function(_0x30f0d3){logger['error'](_0x335a('0xd'),_0x3155bd,_0x30f0d3);_0x5d1f6f(_0x30f0d3);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index dbec97c..972b6b1 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 _0x0e9f=['create','put','update','delete','destroy','exports','multer','util','express','../../components/auth/service','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','show'];(function(_0x77773a,_0x5a7026){var _0x1091a2=function(_0x276af5){while(--_0x276af5){_0x77773a['push'](_0x77773a['shift']());}};_0x1091a2(++_0x5a7026);}(_0x0e9f,0x116));var _0xf0e9=function(_0x333e53,_0x36c5f0){_0x333e53=_0x333e53-0x0;var _0x309432=_0x0e9f[_0x333e53];return _0x309432;};'use strict';var multer=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf0e9('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf0e9('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf0e9('0x4'));router[_0xf0e9('0x5')]('/',auth['isAuthenticated'](),controller[_0xf0e9('0x6')]);router['get'](_0xf0e9('0x7'),auth[_0xf0e9('0x8')](),controller[_0xf0e9('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf0e9('0xa')]);router[_0xf0e9('0xb')](_0xf0e9('0x7'),auth['isAuthenticated'](),controller[_0xf0e9('0xc')]);router[_0xf0e9('0xd')](_0xf0e9('0x7'),auth['isAuthenticated'](),controller[_0xf0e9('0xe')]);module[_0xf0e9('0xf')]=router; \ No newline at end of file +var _0xe130=['post','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated'];(function(_0x3190e2,_0x59d896){var _0x4bc460=function(_0x4be02e){while(--_0x4be02e){_0x3190e2['push'](_0x3190e2['shift']());}};_0x4bc460(++_0x59d896);}(_0xe130,0x127));var _0x0e13=function(_0x473b22,_0x5c4780){_0x473b22=_0x473b22-0x0;var _0x466d20=_0xe130[_0x473b22];return _0x466d20;};'use strict';var multer=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var path=require('path');var timeout=require(_0x0e13('0x2'));var express=require(_0x0e13('0x3'));var router=express[_0x0e13('0x4')]();var fs_extra=require(_0x0e13('0x5'));var auth=require(_0x0e13('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0e13('0x7'));var controller=require(_0x0e13('0x8'));router[_0x0e13('0x9')]('/',auth[_0x0e13('0xa')](),controller['index']);router[_0x0e13('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0e13('0xb')]('/',auth[_0x0e13('0xa')](),controller['create']);router['put'](_0x0e13('0xc'),auth[_0x0e13('0xa')](),controller[_0x0e13('0xd')]);router[_0x0e13('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0e13('0xf')]);module[_0x0e13('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 25de499..d3d648e 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 _0x6040=['sequelize','string','variable','customVariable','picklist','STRING','ENUM','BOOLEAN'];(function(_0x46ec6e,_0x5d9430){var _0x1f0884=function(_0x515e65){while(--_0x515e65){_0x46ec6e['push'](_0x46ec6e['shift']());}};_0x1f0884(++_0x5d9430);}(_0x6040,0x70));var _0x0604=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x6040[_0x1e7b16];return _0x37fadc;};'use strict';var Sequelize=require(_0x0604('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x0604('0x1'),_0x0604('0x2'),_0x0604('0x3'),'keyValue',_0x0604('0x4')),'defaultValue':_0x0604('0x1')},'content':{'type':Sequelize[_0x0604('0x5')]},'key':{'type':Sequelize[_0x0604('0x5')]},'keyType':{'type':Sequelize[_0x0604('0x6')]('string',_0x0604('0x2'),_0x0604('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0604('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0604('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0604('0x5')]}}; \ No newline at end of file +var _0x1408=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x2579ab,_0x5d56a5){var _0x5e0fa1=function(_0x34fb3a){while(--_0x34fb3a){_0x2579ab['push'](_0x2579ab['shift']());}};_0x5e0fa1(++_0x5d56a5);}(_0x1408,0x19a));var _0x8140=function(_0x274d8d,_0x5a8cac){_0x274d8d=_0x274d8d-0x0;var _0x113126=_0x1408[_0x274d8d];return _0x113126;};'use strict';var Sequelize=require(_0x8140('0x0'));module['exports']={'type':{'type':Sequelize[_0x8140('0x1')](_0x8140('0x2'),_0x8140('0x3'),_0x8140('0x4'),_0x8140('0x5'),_0x8140('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8140('0x7')]},'key':{'type':Sequelize[_0x8140('0x7')]},'keyType':{'type':Sequelize[_0x8140('0x1')]('string',_0x8140('0x3'),_0x8140('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8140('0x7')]},'nameField':{'type':Sequelize[_0x8140('0x7')]},'customField':{'type':Sequelize[_0x8140('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8140('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 36d7f9c..5d4b24c 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 _0x822d=['attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','then','catch','show','params','find','create','body','destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','end','sendStatus','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0x8955b3,_0x3af8b4){var _0x369673=function(_0x192084){while(--_0x192084){_0x8955b3['push'](_0x8955b3['shift']());}};_0x369673(++_0x3af8b4);}(_0x822d,0xad));var _0xd822=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x822d[_0x15ea09];return _0x3e9c78;};'use strict';var emlformat=require(_0xd822('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd822('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd822('0x2'));var moment=require(_0xd822('0x3'));var BPromise=require(_0xd822('0x4'));var Mustache=require(_0xd822('0x5'));var util=require('util');var path=require(_0xd822('0x6'));var sox=require(_0xd822('0x7'));var csv=require(_0xd822('0x8'));var ejs=require(_0xd822('0x9'));var fs=require('fs');var fs_extra=require(_0xd822('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd822('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd822('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd822('0xd'));var Papa=require(_0xd822('0xe'));var Redis=require(_0xd822('0xf'));var authService=require(_0xd822('0x10'));var qs=require(_0xd822('0x11'));var as=require(_0xd822('0x12'));var hardwareService=require(_0xd822('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xd822('0x14'));var config=require(_0xd822('0x15'));var licenseUtil=require(_0xd822('0x16'));var db=require(_0xd822('0x17'))['db'];function respondWithStatusCode(_0x17384c,_0x5063a0){_0x5063a0=_0x5063a0||0xcc;return function(_0x5a14f0){if(_0x5a14f0){return _0x17384c['sendStatus'](_0x5063a0);}return _0x17384c[_0xd822('0x18')](_0x5063a0)['end']();};}function respondWithResult(_0x3ff112,_0x4749f1){_0x4749f1=_0x4749f1||0xc8;return function(_0x501f59){if(_0x501f59){return _0x3ff112[_0xd822('0x18')](_0x4749f1)[_0xd822('0x19')](_0x501f59);}};}function respondWithFilteredResult(_0x1dea0d,_0x13620e){return function(_0x27b484){if(_0x27b484){var _0x4b0dcc=typeof _0x13620e[_0xd822('0x1a')]===_0xd822('0x1b')&&typeof _0x13620e[_0xd822('0x1c')]===_0xd822('0x1b');var _0x1d13b5=_0x27b484['count'];var _0x116fa9=_0x4b0dcc?0x0:_0x13620e[_0xd822('0x1a')];var _0x61eb77=_0x4b0dcc?_0x27b484[_0xd822('0x1d')]:_0x13620e[_0xd822('0x1a')]+_0x13620e[_0xd822('0x1c')];var _0x436c26;if(_0x61eb77>=_0x1d13b5){_0x61eb77=_0x1d13b5;_0x436c26=0xc8;}else{_0x436c26=0xce;}_0x1dea0d[_0xd822('0x18')](_0x436c26);return _0x1dea0d[_0xd822('0x1e')](_0xd822('0x1f'),_0x116fa9+'-'+_0x61eb77+'/'+_0x1d13b5)[_0xd822('0x19')](_0x27b484);}return null;};}function patchUpdates(_0x20dfe5){return function(_0xa893b7){try{jsonpatch[_0xd822('0x20')](_0xa893b7,_0x20dfe5,!![]);}catch(_0x3b8a3c){return BPromise[_0xd822('0x21')](_0x3b8a3c);}return _0xa893b7['save']();};}function saveUpdates(_0x229c2f,_0x33a1b7){return function(_0x300821){if(_0x300821){return _0x300821[_0xd822('0x22')](_0x229c2f)['then'](function(_0x21d64){return _0x21d64;});}return null;};}function removeEntity(_0x161ef2,_0x4d61ef){return function(_0x23bf75){if(_0x23bf75){return _0x23bf75['destroy']()['then'](function(){_0x161ef2[_0xd822('0x18')](0xcc)[_0xd822('0x23')]();});}};}function handleEntityNotFound(_0x352799,_0x51fb8c){return function(_0x506a0f){if(!_0x506a0f){_0x352799[_0xd822('0x24')](0x194);}return _0x506a0f;};}function handleError(_0x1e684d,_0x2186b2){_0x2186b2=_0x2186b2||0x1f4;return function(_0x219d91){logger['error'](_0x219d91['stack']);if(_0x219d91[_0xd822('0x25')]){delete _0x219d91[_0xd822('0x25')];}_0x1e684d['status'](_0x2186b2)[_0xd822('0x26')](_0x219d91);};}exports[_0xd822('0x27')]=function(_0x9eff1d,_0x250beb){var _0x440a5b={},_0x3532fc={},_0x5ef8d9={'count':0x0,'rows':[]};var _0x5cea7c=_[_0xd822('0x28')](db[_0xd822('0x29')][_0xd822('0x2a')],function(_0x20a2ec){return{'name':_0x20a2ec[_0xd822('0x2b')],'type':_0x20a2ec['type'][_0xd822('0x2c')]};});_0x3532fc[_0xd822('0x2d')]=_[_0xd822('0x28')](_0x5cea7c,_0xd822('0x25'));_0x3532fc[_0xd822('0x2e')]=_[_0xd822('0x2f')](_0x9eff1d[_0xd822('0x2e')]);_0x3532fc[_0xd822('0x30')]=_['intersection'](_0x3532fc[_0xd822('0x2d')],_0x3532fc[_0xd822('0x2e')]);_0x440a5b[_0xd822('0x31')]=_[_0xd822('0x32')](_0x3532fc[_0xd822('0x2d')],qs['fields'](_0x9eff1d['query'][_0xd822('0x33')]));_0x440a5b[_0xd822('0x31')]=_0x440a5b['attributes'][_0xd822('0x34')]?_0x440a5b['attributes']:_0x3532fc[_0xd822('0x2d')];if(!_0x9eff1d[_0xd822('0x2e')][_0xd822('0x35')](_0xd822('0x36'))){_0x440a5b[_0xd822('0x1c')]=qs['limit'](_0x9eff1d[_0xd822('0x2e')][_0xd822('0x1c')]);_0x440a5b[_0xd822('0x1a')]=qs[_0xd822('0x1a')](_0x9eff1d[_0xd822('0x2e')][_0xd822('0x1a')]);}_0x440a5b['order']=qs[_0xd822('0x37')](_0x9eff1d[_0xd822('0x2e')][_0xd822('0x37')]);_0x440a5b[_0xd822('0x38')]=qs[_0xd822('0x30')](_[_0xd822('0x39')](_0x9eff1d['query'],_0x3532fc[_0xd822('0x30')]),_0x5cea7c);if(_0x9eff1d[_0xd822('0x2e')][_0xd822('0x3a')]){_0x440a5b[_0xd822('0x38')]=_[_0xd822('0x3b')](_0x440a5b[_0xd822('0x38')],{'$or':_['map'](_0x5cea7c,function(_0x10a240){if(_0x10a240['type']!==_0xd822('0x3c')){var _0x3fef3c={};_0x3fef3c[_0x10a240[_0xd822('0x25')]]={'$like':'%'+_0x9eff1d[_0xd822('0x2e')]['filter']+'%'};return _0x3fef3c;}})});}_0x440a5b=_['merge']({},_0x440a5b,_0x9eff1d[_0xd822('0x3d')]);var _0x414be0={'where':_0x440a5b['where']};return db['FreshsalesField'][_0xd822('0x1d')](_0x414be0)['then'](function(_0x2f7d11){_0x5ef8d9[_0xd822('0x1d')]=_0x2f7d11;if(_0x9eff1d[_0xd822('0x2e')][_0xd822('0x3e')]){_0x440a5b[_0xd822('0x3f')]=[{'all':!![]}];}return db[_0xd822('0x29')][_0xd822('0x40')](_0x440a5b);})['then'](function(_0x224f58){_0x5ef8d9[_0xd822('0x41')]=_0x224f58;return _0x5ef8d9;})[_0xd822('0x42')](respondWithFilteredResult(_0x250beb,_0x440a5b))[_0xd822('0x43')](handleError(_0x250beb,null));};exports[_0xd822('0x44')]=function(_0x427b57,_0x5c5d3a){var _0xc777a5={'raw':!![],'where':{'id':_0x427b57[_0xd822('0x45')]['id']}},_0x1baf9e={};_0x1baf9e[_0xd822('0x2d')]=_['keys'](db[_0xd822('0x29')][_0xd822('0x2a')]);_0x1baf9e['query']=_[_0xd822('0x2f')](_0x427b57[_0xd822('0x2e')]);_0x1baf9e[_0xd822('0x30')]=_['intersection'](_0x1baf9e['model'],_0x1baf9e[_0xd822('0x2e')]);_0xc777a5[_0xd822('0x31')]=_[_0xd822('0x32')](_0x1baf9e[_0xd822('0x2d')],qs[_0xd822('0x33')](_0x427b57[_0xd822('0x2e')]['fields']));_0xc777a5['attributes']=_0xc777a5[_0xd822('0x31')][_0xd822('0x34')]?_0xc777a5[_0xd822('0x31')]:_0x1baf9e[_0xd822('0x2d')];if(_0x427b57[_0xd822('0x2e')][_0xd822('0x3e')]){_0xc777a5['include']=[{'all':!![]}];}_0xc777a5=_[_0xd822('0x3b')]({},_0xc777a5,_0x427b57[_0xd822('0x3d')]);return db[_0xd822('0x29')][_0xd822('0x46')](_0xc777a5)[_0xd822('0x42')](handleEntityNotFound(_0x5c5d3a,null))[_0xd822('0x42')](respondWithResult(_0x5c5d3a,null))[_0xd822('0x43')](handleError(_0x5c5d3a,null));};exports['create']=function(_0x2e751c,_0x560cf2){return db[_0xd822('0x29')][_0xd822('0x47')](_0x2e751c[_0xd822('0x48')],{})[_0xd822('0x42')](respondWithResult(_0x560cf2,0xc9))['catch'](handleError(_0x560cf2,null));};exports['update']=function(_0x3604b7,_0x481c28){if(_0x3604b7[_0xd822('0x48')]['id']){delete _0x3604b7[_0xd822('0x48')]['id'];}return db[_0xd822('0x29')]['find']({'where':{'id':_0x3604b7[_0xd822('0x45')]['id']}})[_0xd822('0x42')](handleEntityNotFound(_0x481c28,null))[_0xd822('0x42')](saveUpdates(_0x3604b7[_0xd822('0x48')],null))[_0xd822('0x42')](respondWithResult(_0x481c28,null))[_0xd822('0x43')](handleError(_0x481c28,null));};exports[_0xd822('0x49')]=function(_0x3d95d3,_0x445cd4){return db['FreshsalesField'][_0xd822('0x46')]({'where':{'id':_0x3d95d3[_0xd822('0x45')]['id']}})['then'](handleEntityNotFound(_0x445cd4,null))[_0xd822('0x42')](removeEntity(_0x445cd4,null))['catch'](handleError(_0x445cd4,null));}; \ No newline at end of file +var _0xb184=['intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filters','where','merge','VIRTUAL','filter','options','FreshsalesField','includeAll','findAll','catch','show','include','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','rawAttributes','key','model','map','keys'];(function(_0x4f7449,_0x407356){var _0x21e3cb=function(_0x40f623){while(--_0x40f623){_0x4f7449['push'](_0x4f7449['shift']());}};_0x21e3cb(++_0x407356);}(_0xb184,0xef));var _0x4b18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb184[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4b18('0x0'));var rimraf=require(_0x4b18('0x1'));var zipdir=require(_0x4b18('0x2'));var jsonpatch=require(_0x4b18('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4b18('0x4'));var Mustache=require(_0x4b18('0x5'));var util=require(_0x4b18('0x6'));var path=require(_0x4b18('0x7'));var sox=require(_0x4b18('0x8'));var csv=require(_0x4b18('0x9'));var ejs=require(_0x4b18('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4b18('0xb'));var jsforce=require(_0x4b18('0xc'));var deskjs=require(_0x4b18('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4b18('0xe'));var Papa=require(_0x4b18('0xf'));var Redis=require('ioredis');var authService=require(_0x4b18('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4b18('0x11'));var hardwareService=require(_0x4b18('0x12'));var logger=require('../../config/logger')(_0x4b18('0x13'));var utils=require(_0x4b18('0x14'));var config=require(_0x4b18('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54d332,_0x5a1633){_0x5a1633=_0x5a1633||0xcc;return function(_0x53e0fa){if(_0x53e0fa){return _0x54d332[_0x4b18('0x16')](_0x5a1633);}return _0x54d332[_0x4b18('0x17')](_0x5a1633)[_0x4b18('0x18')]();};}function respondWithResult(_0x47964a,_0x4b553d){_0x4b553d=_0x4b553d||0xc8;return function(_0x33021b){if(_0x33021b){return _0x47964a[_0x4b18('0x17')](_0x4b553d)[_0x4b18('0x19')](_0x33021b);}};}function respondWithFilteredResult(_0x85459b,_0x2f70f4){return function(_0x3bbee5){if(_0x3bbee5){var _0x228b08=typeof _0x2f70f4[_0x4b18('0x1a')]===_0x4b18('0x1b')&&typeof _0x2f70f4['limit']==='undefined';var _0x2be03c=_0x3bbee5[_0x4b18('0x1c')];var _0x347f42=_0x228b08?0x0:_0x2f70f4[_0x4b18('0x1a')];var _0x3b180f=_0x228b08?_0x3bbee5[_0x4b18('0x1c')]:_0x2f70f4[_0x4b18('0x1a')]+_0x2f70f4[_0x4b18('0x1d')];var _0x250b37;if(_0x3b180f>=_0x2be03c){_0x3b180f=_0x2be03c;_0x250b37=0xc8;}else{_0x250b37=0xce;}_0x85459b[_0x4b18('0x17')](_0x250b37);return _0x85459b['set'](_0x4b18('0x1e'),_0x347f42+'-'+_0x3b180f+'/'+_0x2be03c)['json'](_0x3bbee5);}return null;};}function patchUpdates(_0x1c5e74){return function(_0x185fa1){try{jsonpatch[_0x4b18('0x1f')](_0x185fa1,_0x1c5e74,!![]);}catch(_0x54712d){return BPromise[_0x4b18('0x20')](_0x54712d);}return _0x185fa1[_0x4b18('0x21')]();};}function saveUpdates(_0x429815,_0x244b0c){return function(_0x252cf3){if(_0x252cf3){return _0x252cf3['update'](_0x429815)[_0x4b18('0x22')](function(_0x301db2){return _0x301db2;});}return null;};}function removeEntity(_0x1519dc,_0x4fa9a9){return function(_0x5b54f5){if(_0x5b54f5){return _0x5b54f5[_0x4b18('0x23')]()[_0x4b18('0x22')](function(){_0x1519dc[_0x4b18('0x17')](0xcc)[_0x4b18('0x18')]();});}};}function handleEntityNotFound(_0x1206d2,_0x1f5a01){return function(_0x245552){if(!_0x245552){_0x1206d2[_0x4b18('0x16')](0x194);}return _0x245552;};}function handleError(_0x214ac4,_0x4982ed){_0x4982ed=_0x4982ed||0x1f4;return function(_0x37dd49){logger[_0x4b18('0x24')](_0x37dd49[_0x4b18('0x25')]);if(_0x37dd49['name']){delete _0x37dd49[_0x4b18('0x26')];}_0x214ac4['status'](_0x4982ed)['send'](_0x37dd49);};}exports[_0x4b18('0x27')]=function(_0x194ea8,_0x52f671){var _0xf3b009={},_0x359873={},_0x30b775={'count':0x0,'rows':[]};var _0x1cab71=_['map'](db['FreshsalesField'][_0x4b18('0x28')],function(_0x4168b6){return{'name':_0x4168b6['fieldName'],'type':_0x4168b6['type'][_0x4b18('0x29')]};});_0x359873[_0x4b18('0x2a')]=_[_0x4b18('0x2b')](_0x1cab71,_0x4b18('0x26'));_0x359873['query']=_[_0x4b18('0x2c')](_0x194ea8['query']);_0x359873['filters']=_[_0x4b18('0x2d')](_0x359873[_0x4b18('0x2a')],_0x359873[_0x4b18('0x2e')]);_0xf3b009['attributes']=_[_0x4b18('0x2d')](_0x359873[_0x4b18('0x2a')],qs[_0x4b18('0x2f')](_0x194ea8['query'][_0x4b18('0x2f')]));_0xf3b009[_0x4b18('0x30')]=_0xf3b009['attributes'][_0x4b18('0x31')]?_0xf3b009[_0x4b18('0x30')]:_0x359873[_0x4b18('0x2a')];if(!_0x194ea8['query'][_0x4b18('0x32')](_0x4b18('0x33'))){_0xf3b009[_0x4b18('0x1d')]=qs[_0x4b18('0x1d')](_0x194ea8[_0x4b18('0x2e')]['limit']);_0xf3b009[_0x4b18('0x1a')]=qs['offset'](_0x194ea8[_0x4b18('0x2e')][_0x4b18('0x1a')]);}_0xf3b009['order']=qs[_0x4b18('0x34')](_0x194ea8[_0x4b18('0x2e')][_0x4b18('0x34')]);_0xf3b009['where']=qs['filters'](_[_0x4b18('0x35')](_0x194ea8[_0x4b18('0x2e')],_0x359873[_0x4b18('0x36')]),_0x1cab71);if(_0x194ea8[_0x4b18('0x2e')]['filter']){_0xf3b009[_0x4b18('0x37')]=_[_0x4b18('0x38')](_0xf3b009[_0x4b18('0x37')],{'$or':_[_0x4b18('0x2b')](_0x1cab71,function(_0x3969ec){if(_0x3969ec['type']!==_0x4b18('0x39')){var _0x720a58={};_0x720a58[_0x3969ec[_0x4b18('0x26')]]={'$like':'%'+_0x194ea8[_0x4b18('0x2e')][_0x4b18('0x3a')]+'%'};return _0x720a58;}})});}_0xf3b009=_[_0x4b18('0x38')]({},_0xf3b009,_0x194ea8[_0x4b18('0x3b')]);var _0x2bb0dc={'where':_0xf3b009[_0x4b18('0x37')]};return db[_0x4b18('0x3c')][_0x4b18('0x1c')](_0x2bb0dc)[_0x4b18('0x22')](function(_0x4ad2ee){_0x30b775[_0x4b18('0x1c')]=_0x4ad2ee;if(_0x194ea8['query'][_0x4b18('0x3d')]){_0xf3b009['include']=[{'all':!![]}];}return db[_0x4b18('0x3c')][_0x4b18('0x3e')](_0xf3b009);})[_0x4b18('0x22')](function(_0x57fca0){_0x30b775['rows']=_0x57fca0;return _0x30b775;})['then'](respondWithFilteredResult(_0x52f671,_0xf3b009))[_0x4b18('0x3f')](handleError(_0x52f671,null));};exports[_0x4b18('0x40')]=function(_0x3c083b,_0x336dc8){var _0x4df3a1={'raw':!![],'where':{'id':_0x3c083b['params']['id']}},_0x19a0f1={};_0x19a0f1[_0x4b18('0x2a')]=_[_0x4b18('0x2c')](db[_0x4b18('0x3c')][_0x4b18('0x28')]);_0x19a0f1[_0x4b18('0x2e')]=_[_0x4b18('0x2c')](_0x3c083b[_0x4b18('0x2e')]);_0x19a0f1['filters']=_['intersection'](_0x19a0f1[_0x4b18('0x2a')],_0x19a0f1['query']);_0x4df3a1['attributes']=_[_0x4b18('0x2d')](_0x19a0f1[_0x4b18('0x2a')],qs['fields'](_0x3c083b['query'][_0x4b18('0x2f')]));_0x4df3a1[_0x4b18('0x30')]=_0x4df3a1[_0x4b18('0x30')]['length']?_0x4df3a1[_0x4b18('0x30')]:_0x19a0f1[_0x4b18('0x2a')];if(_0x3c083b['query']['includeAll']){_0x4df3a1[_0x4b18('0x41')]=[{'all':!![]}];}_0x4df3a1=_[_0x4b18('0x38')]({},_0x4df3a1,_0x3c083b[_0x4b18('0x3b')]);return db['FreshsalesField'][_0x4b18('0x42')](_0x4df3a1)[_0x4b18('0x22')](handleEntityNotFound(_0x336dc8,null))[_0x4b18('0x22')](respondWithResult(_0x336dc8,null))['catch'](handleError(_0x336dc8,null));};exports['create']=function(_0x3a8cf0,_0xa74ccc){return db[_0x4b18('0x3c')][_0x4b18('0x43')](_0x3a8cf0[_0x4b18('0x44')],{})[_0x4b18('0x22')](respondWithResult(_0xa74ccc,0xc9))[_0x4b18('0x3f')](handleError(_0xa74ccc,null));};exports[_0x4b18('0x45')]=function(_0x47cab0,_0x3f3f7e){if(_0x47cab0[_0x4b18('0x44')]['id']){delete _0x47cab0[_0x4b18('0x44')]['id'];}return db[_0x4b18('0x3c')]['find']({'where':{'id':_0x47cab0['params']['id']}})[_0x4b18('0x22')](handleEntityNotFound(_0x3f3f7e,null))[_0x4b18('0x22')](saveUpdates(_0x47cab0[_0x4b18('0x44')],null))[_0x4b18('0x22')](respondWithResult(_0x3f3f7e,null))[_0x4b18('0x3f')](handleError(_0x3f3f7e,null));};exports[_0x4b18('0x23')]=function(_0x4ec8b1,_0x1d04b6){return db[_0x4b18('0x3c')][_0x4b18('0x42')]({'where':{'id':_0x4ec8b1[_0x4b18('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d04b6,null))['then'](removeEntity(_0x1d04b6,null))[_0x4b18('0x3f')](handleError(_0x1d04b6,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index e1de9ac..845f623 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 _0x2884=['request-promise','path','./intFreshsalesField.attributes','exports','FreshsalesField','freshsales_unique_index','idField','lodash','../../config/logger','api','moment'];(function(_0x15d4af,_0x3767c0){var _0x143bc0=function(_0x44d88b){while(--_0x44d88b){_0x15d4af['push'](_0x15d4af['shift']());}};_0x143bc0(++_0x3767c0);}(_0x2884,0x1eb));var _0x4288=function(_0x58dc86,_0x4e6b28){_0x58dc86=_0x58dc86-0x0;var _0x4aae2c=_0x2884[_0x58dc86];return _0x4aae2c;};'use strict';var _=require(_0x4288('0x0'));var util=require('util');var logger=require(_0x4288('0x1'))(_0x4288('0x2'));var moment=require(_0x4288('0x3'));var BPromise=require('bluebird');var rp=require(_0x4288('0x4'));var fs=require('fs');var path=require(_0x4288('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4288('0x6'));module[_0x4288('0x7')]=function(_0x3d67f7,_0x59dffa){return _0x3d67f7['define'](_0x4288('0x8'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x4288('0x9'),'fields':[_0x4288('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6e1c=['idField','FieldId','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x109caa,_0x2d57b4){var _0x2afadd=function(_0x12971c){while(--_0x12971c){_0x109caa['push'](_0x109caa['shift']());}};_0x2afadd(++_0x2d57b4);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc6e1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc6e1('0x1'));var moment=require(_0xc6e1('0x2'));var BPromise=require(_0xc6e1('0x3'));var rp=require(_0xc6e1('0x4'));var fs=require('fs');var path=require(_0xc6e1('0x5'));var rimraf=require(_0xc6e1('0x6'));var config=require(_0xc6e1('0x7'));var attributes=require(_0xc6e1('0x8'));module[_0xc6e1('0x9')]=function(_0x3e2d6c,_0x468a80){return _0x3e2d6c['define'](_0xc6e1('0xa'),attributes,{'tableName':_0xc6e1('0xb'),'paranoid':![],'indexes':[{'name':_0xc6e1('0xc'),'fields':[_0xc6e1('0xd'),_0xc6e1('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index bbd6d8a..7f58944 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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4975,0x86));var _0x5497=function(_0x3a5d2,_0x21bc09){_0x3a5d2=_0x3a5d2-0x0;var _0xeb8660=_0x4975[_0x3a5d2];return _0xeb8660;};'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')]('FreshsalesField,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0xdbf5=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch'];(function(_0x17993c,_0x3bfd92){var _0x3ca20a=function(_0x1196dd){while(--_0x1196dd){_0x17993c['push'](_0x17993c['shift']());}};_0x3ca20a(++_0x3bfd92);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x578918,_0x42883f){_0x578918=_0x578918-0x0;var _0x1c20e8=_0xdbf5[_0x578918];return _0x1c20e8;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5dbf('0x1'));var fs=require('fs');var Redis=require(_0x5dbf('0x2'));var db=require(_0x5dbf('0x3'))['db'];var utils=require(_0x5dbf('0x4'));var logger=require(_0x5dbf('0x5'))(_0x5dbf('0x6'));var config=require(_0x5dbf('0x7'));var jayson=require(_0x5dbf('0x8'));var client=jayson[_0x5dbf('0x9')][_0x5dbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x209b7d,_0x88128e,_0x93e657){return new BPromise(function(_0x52b039,_0x134810){return client['request'](_0x209b7d,_0x93e657)[_0x5dbf('0xb')](function(_0x3bec50){logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,'request\x20sent');logger[_0x5dbf('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x88128e,'request\x20sent',JSON[_0x5dbf('0xf')](_0x3bec50));if(_0x3bec50['error']){if(_0x3bec50['error'][_0x5dbf('0x10')]===0x1f4){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x134810(_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x88128e,_0x3bec50[_0x5dbf('0x11')][_0x5dbf('0x12')]);return _0x52b039(_0x3bec50['error'][_0x5dbf('0x12')]);}else{logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x88128e,_0x5dbf('0x13'));_0x52b039(_0x3bec50[_0x5dbf('0x14')][_0x5dbf('0x12')]);}})[_0x5dbf('0x15')](function(_0x50ef1d){logger['error'](_0x5dbf('0xd'),_0x88128e,_0x50ef1d);_0x134810(_0x50ef1d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 8aa69b8..7a15561 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(_0x1e8864,_0x51c517){var _0x479a3a=function(_0x1e4780){while(--_0x1e4780){_0x1e8864['push'](_0x1e8864['shift']());}};_0x479a3a(++_0x51c517);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x944045,_0x343d55){var _0x7d29f4=function(_0xac25fc){while(--_0xac25fc){_0x944045['push'](_0x944045['shift']());}};_0x7d29f4(++_0x343d55);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index cce1918..76184f3 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 _0xb7de=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0xb7de,0xc7));var _0xeb7d=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xb7de[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0xeb7d('0x0'));module[_0xeb7d('0x1')]={'name':{'type':Sequelize[_0xeb7d('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xeb7d('0x2')],'unique':_0xeb7d('0x3')},'remoteUri':{'type':Sequelize[_0xeb7d('0x2')]},'password':{'type':Sequelize[_0xeb7d('0x2')]},'clientId':{'type':Sequelize[_0xeb7d('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xeb7d('0x2')]},'serverUrl':{'type':Sequelize[_0xeb7d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xeb7d('0x4')](_0xeb7d('0x5'),_0xeb7d('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xd9b4=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xd9b4,0x1c0));var _0x4d9b=function(_0x3f9aeb,_0x231e27){_0x3f9aeb=_0x3f9aeb-0x0;var _0x1772b4=_0xd9b4[_0x3f9aeb];return _0x1772b4;};'use strict';var Sequelize=require(_0x4d9b('0x0'));module[_0x4d9b('0x1')]={'name':{'type':Sequelize[_0x4d9b('0x2')]},'description':{'type':Sequelize[_0x4d9b('0x2')]},'username':{'type':Sequelize[_0x4d9b('0x2')],'unique':_0x4d9b('0x3')},'remoteUri':{'type':Sequelize[_0x4d9b('0x2')]},'password':{'type':Sequelize[_0x4d9b('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x4d9b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4d9b('0x4')](_0x4d9b('0x5'),_0x4d9b('0x6')),'defaultValue':_0x4d9b('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index b574266..6578079 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 _0x1fbc=['../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','key','model','query','keys','attributes','intersection','hasOwnProperty','sort','filters','pick','where','merge','filter','options','includeAll','findAll','rows','catch','params','fields','length','include','find','create','update','body','getConfigurations','findOne','SalesforceConfiguration','order','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login','concat','isNil','ticketType','describe','OwnerId','IsRecurrence','Description','int','picklist','email','textarea','phone','remove','includes','label','custom','picklistValues','value','boolean','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3d9d65,_0x362699){var _0x3ebdd7=function(_0x5f438e){while(--_0x5f438e){_0x3d9d65['push'](_0x3d9d65['shift']());}};_0x3ebdd7(++_0x362699);}(_0x1fbc,0x1db));var _0xc1fb=function(_0x439cb0,_0x9ae459){_0x439cb0=_0x439cb0-0x0;var _0x2babb2=_0x1fbc[_0x439cb0];return _0x2babb2;};'use strict';var emlformat=require(_0xc1fb('0x0'));var rimraf=require(_0xc1fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1fb('0x2'));var rp=require('request-promise');var moment=require(_0xc1fb('0x3'));var BPromise=require(_0xc1fb('0x4'));var Mustache=require('mustache');var util=require(_0xc1fb('0x5'));var path=require(_0xc1fb('0x6'));var sox=require(_0xc1fb('0x7'));var csv=require(_0xc1fb('0x8'));var ejs=require(_0xc1fb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1fb('0xa'));var squel=require(_0xc1fb('0xb'));var crypto=require(_0xc1fb('0xc'));var jsforce=require(_0xc1fb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc1fb('0x8'));var querystring=require(_0xc1fb('0xe'));var Papa=require(_0xc1fb('0xf'));var Redis=require(_0xc1fb('0x10'));var authService=require(_0xc1fb('0x11'));var qs=require(_0xc1fb('0x12'));var as=require(_0xc1fb('0x13'));var hardwareService=require(_0xc1fb('0x14'));var logger=require(_0xc1fb('0x15'))(_0xc1fb('0x16'));var utils=require(_0xc1fb('0x17'));var config=require(_0xc1fb('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xc1fb('0x19'));function respondWithStatusCode(_0x4a3795,_0x30c87c){_0x30c87c=_0x30c87c||0xcc;return function(_0x2ecb8f){if(_0x2ecb8f){return _0x4a3795['sendStatus'](_0x30c87c);}return _0x4a3795[_0xc1fb('0x1a')](_0x30c87c)[_0xc1fb('0x1b')]();};}function respondWithResult(_0x11220f,_0x29f4a3){_0x29f4a3=_0x29f4a3||0xc8;return function(_0x4813c){if(_0x4813c){return _0x11220f['status'](_0x29f4a3)[_0xc1fb('0x1c')](_0x4813c);}};}function respondWithFilteredResult(_0x21f4a2,_0x11ff6e){return function(_0x53c608){if(_0x53c608){var _0x7522ab=typeof _0x11ff6e[_0xc1fb('0x1d')]===_0xc1fb('0x1e')&&typeof _0x11ff6e[_0xc1fb('0x1f')]===_0xc1fb('0x1e');var _0x58d187=_0x53c608['count'];var _0x39bc3e=_0x7522ab?0x0:_0x11ff6e['offset'];var _0x2a39cf=_0x7522ab?_0x53c608[_0xc1fb('0x20')]:_0x11ff6e[_0xc1fb('0x1d')]+_0x11ff6e[_0xc1fb('0x1f')];var _0x50498;if(_0x2a39cf>=_0x58d187){_0x2a39cf=_0x58d187;_0x50498=0xc8;}else{_0x50498=0xce;}_0x21f4a2[_0xc1fb('0x1a')](_0x50498);return _0x21f4a2[_0xc1fb('0x21')](_0xc1fb('0x22'),_0x39bc3e+'-'+_0x2a39cf+'/'+_0x58d187)['json'](_0x53c608);}return null;};}function patchUpdates(_0x1c9c44){return function(_0x1afe75){try{jsonpatch[_0xc1fb('0x23')](_0x1afe75,_0x1c9c44,!![]);}catch(_0x679209){return BPromise[_0xc1fb('0x24')](_0x679209);}return _0x1afe75[_0xc1fb('0x25')]();};}function saveUpdates(_0x3a6c38,_0x889c3a){return function(_0x315fea){if(_0x315fea){return _0x315fea['update'](_0x3a6c38)[_0xc1fb('0x26')](function(_0x1357d1){return _0x1357d1;});}return null;};}function removeEntity(_0x3b6506,_0x3644cc){return function(_0x4e1448){if(_0x4e1448){return _0x4e1448[_0xc1fb('0x27')]()['then'](function(){_0x3b6506['status'](0xcc)[_0xc1fb('0x1b')]();});}};}function handleEntityNotFound(_0x32c4e0,_0x5e6673){return function(_0x2176c3){if(!_0x2176c3){_0x32c4e0[_0xc1fb('0x28')](0x194);}return _0x2176c3;};}function handleError(_0x30693d,_0x2665cb){_0x2665cb=_0x2665cb||0x1f4;return function(_0x1d7f6f){logger[_0xc1fb('0x29')](_0x1d7f6f[_0xc1fb('0x2a')]);if(_0x1d7f6f[_0xc1fb('0x2b')]){delete _0x1d7f6f['name'];}_0x30693d['status'](_0x2665cb)[_0xc1fb('0x2c')](_0x1d7f6f);};}exports[_0xc1fb('0x2d')]=function(_0x8ea64e,_0x126712){var _0x50543b={},_0x53f387={},_0x2af8cf={'count':0x0,'rows':[]};var _0x3fbb92=_[_0xc1fb('0x2e')](db[_0xc1fb('0x2f')][_0xc1fb('0x30')],function(_0x261c60){return{'name':_0x261c60['fieldName'],'type':_0x261c60[_0xc1fb('0x31')][_0xc1fb('0x32')]};});_0x53f387[_0xc1fb('0x33')]=_[_0xc1fb('0x2e')](_0x3fbb92,_0xc1fb('0x2b'));_0x53f387[_0xc1fb('0x34')]=_[_0xc1fb('0x35')](_0x8ea64e[_0xc1fb('0x34')]);_0x53f387['filters']=_['intersection'](_0x53f387[_0xc1fb('0x33')],_0x53f387[_0xc1fb('0x34')]);_0x50543b[_0xc1fb('0x36')]=_[_0xc1fb('0x37')](_0x53f387[_0xc1fb('0x33')],qs['fields'](_0x8ea64e[_0xc1fb('0x34')]['fields']));_0x50543b['attributes']=_0x50543b[_0xc1fb('0x36')]['length']?_0x50543b[_0xc1fb('0x36')]:_0x53f387['model'];if(!_0x8ea64e[_0xc1fb('0x34')][_0xc1fb('0x38')]('nolimit')){_0x50543b[_0xc1fb('0x1f')]=qs[_0xc1fb('0x1f')](_0x8ea64e[_0xc1fb('0x34')][_0xc1fb('0x1f')]);_0x50543b[_0xc1fb('0x1d')]=qs[_0xc1fb('0x1d')](_0x8ea64e[_0xc1fb('0x34')]['offset']);}_0x50543b['order']=qs['sort'](_0x8ea64e[_0xc1fb('0x34')][_0xc1fb('0x39')]);_0x50543b['where']=qs[_0xc1fb('0x3a')](_[_0xc1fb('0x3b')](_0x8ea64e['query'],_0x53f387[_0xc1fb('0x3a')]),_0x3fbb92);if(_0x8ea64e[_0xc1fb('0x34')]['filter']){_0x50543b[_0xc1fb('0x3c')]=_[_0xc1fb('0x3d')](_0x50543b[_0xc1fb('0x3c')],{'$or':_[_0xc1fb('0x2e')](_0x3fbb92,function(_0x4b9e29){if(_0x4b9e29[_0xc1fb('0x31')]!=='VIRTUAL'){var _0x478223={};_0x478223[_0x4b9e29[_0xc1fb('0x2b')]]={'$like':'%'+_0x8ea64e[_0xc1fb('0x34')][_0xc1fb('0x3e')]+'%'};return _0x478223;}})});}_0x50543b=_[_0xc1fb('0x3d')]({},_0x50543b,_0x8ea64e[_0xc1fb('0x3f')]);var _0x504764={'where':_0x50543b['where']};return db[_0xc1fb('0x2f')]['count'](_0x504764)['then'](function(_0x305625){_0x2af8cf[_0xc1fb('0x20')]=_0x305625;if(_0x8ea64e[_0xc1fb('0x34')][_0xc1fb('0x40')]){_0x50543b['include']=[{'all':!![]}];}return db[_0xc1fb('0x2f')][_0xc1fb('0x41')](_0x50543b);})[_0xc1fb('0x26')](function(_0x54ed5b){_0x2af8cf[_0xc1fb('0x42')]=_0x54ed5b;return _0x2af8cf;})[_0xc1fb('0x26')](respondWithFilteredResult(_0x126712,_0x50543b))[_0xc1fb('0x43')](handleError(_0x126712,null));};exports['show']=function(_0x479fa0,_0x4252a6){var _0x326e24={'raw':![],'where':{'id':_0x479fa0[_0xc1fb('0x44')]['id']}},_0x4075c4={};_0x4075c4['model']=_[_0xc1fb('0x35')](db['SalesforceAccount'][_0xc1fb('0x30')]);_0x4075c4[_0xc1fb('0x34')]=_[_0xc1fb('0x35')](_0x479fa0[_0xc1fb('0x34')]);_0x4075c4[_0xc1fb('0x3a')]=_[_0xc1fb('0x37')](_0x4075c4[_0xc1fb('0x33')],_0x4075c4[_0xc1fb('0x34')]);_0x326e24['attributes']=_['intersection'](_0x4075c4[_0xc1fb('0x33')],qs[_0xc1fb('0x45')](_0x479fa0['query'][_0xc1fb('0x45')]));_0x326e24['attributes']=_0x326e24['attributes'][_0xc1fb('0x46')]?_0x326e24['attributes']:_0x4075c4[_0xc1fb('0x33')];if(_0x479fa0[_0xc1fb('0x34')][_0xc1fb('0x40')]){_0x326e24[_0xc1fb('0x47')]=[{'all':!![]}];}_0x326e24=_['merge']({},_0x326e24,_0x479fa0['options']);return db[_0xc1fb('0x2f')][_0xc1fb('0x48')](_0x326e24)[_0xc1fb('0x26')](handleEntityNotFound(_0x4252a6,null))[_0xc1fb('0x26')](respondWithResult(_0x4252a6,null))[_0xc1fb('0x43')](handleError(_0x4252a6,null));};exports['create']=function(_0x25aa1d,_0x525817){return db[_0xc1fb('0x2f')][_0xc1fb('0x49')](_0x25aa1d['body'],{})[_0xc1fb('0x26')](respondWithResult(_0x525817,0xc9))[_0xc1fb('0x43')](handleError(_0x525817,null));};exports[_0xc1fb('0x4a')]=function(_0x4fbadc,_0x5a34a7){if(_0x4fbadc[_0xc1fb('0x4b')]['id']){delete _0x4fbadc['body']['id'];}return db[_0xc1fb('0x2f')][_0xc1fb('0x48')]({'where':{'id':_0x4fbadc[_0xc1fb('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a34a7,null))[_0xc1fb('0x26')](saveUpdates(_0x4fbadc[_0xc1fb('0x4b')],null))['then'](respondWithResult(_0x5a34a7,null))[_0xc1fb('0x43')](handleError(_0x5a34a7,null));};exports[_0xc1fb('0x27')]=function(_0x2665e2,_0x458ae3){return db[_0xc1fb('0x2f')][_0xc1fb('0x48')]({'where':{'id':_0x2665e2[_0xc1fb('0x44')]['id']}})[_0xc1fb('0x26')](handleEntityNotFound(_0x458ae3,null))[_0xc1fb('0x26')](removeEntity(_0x458ae3,null))[_0xc1fb('0x43')](handleError(_0x458ae3,null));};exports[_0xc1fb('0x4c')]=function(_0x5ed71c,_0x34ed25,_0xac38ec){var _0x56463c={};var _0x4b9873={};var _0x161084;var _0x4da701;return db[_0xc1fb('0x2f')][_0xc1fb('0x4d')]({'where':{'id':_0x5ed71c[_0xc1fb('0x44')]['id']}})[_0xc1fb('0x26')](handleEntityNotFound(_0x34ed25,null))[_0xc1fb('0x26')](function(_0x3c2410){if(_0x3c2410){_0x161084=_0x3c2410;_0x4b9873[_0xc1fb('0x33')]=_[_0xc1fb('0x35')](db[_0xc1fb('0x4e')]['rawAttributes']);_0x4b9873[_0xc1fb('0x34')]=_[_0xc1fb('0x35')](_0x5ed71c[_0xc1fb('0x34')]);_0x4b9873[_0xc1fb('0x3a')]=_[_0xc1fb('0x37')](_0x4b9873[_0xc1fb('0x33')],_0x4b9873[_0xc1fb('0x34')]);_0x56463c[_0xc1fb('0x36')]=_[_0xc1fb('0x37')](_0x4b9873[_0xc1fb('0x33')],qs[_0xc1fb('0x45')](_0x5ed71c[_0xc1fb('0x34')][_0xc1fb('0x45')]));_0x56463c[_0xc1fb('0x36')]=_0x56463c[_0xc1fb('0x36')][_0xc1fb('0x46')]?_0x56463c[_0xc1fb('0x36')]:_0x4b9873['model'];_0x56463c[_0xc1fb('0x4f')]=qs['sort'](_0x5ed71c['query'][_0xc1fb('0x39')]);_0x56463c[_0xc1fb('0x3c')]=qs['filters'](_[_0xc1fb('0x3b')](_0x5ed71c[_0xc1fb('0x34')],_0x4b9873[_0xc1fb('0x3a')]));if(_0x5ed71c[_0xc1fb('0x34')][_0xc1fb('0x3e')]){_0x56463c[_0xc1fb('0x3c')]=_['merge'](_0x56463c['where'],{'$or':_[_0xc1fb('0x2e')](_0x56463c[_0xc1fb('0x36')],function(_0x336acc){var _0x4c8d1b={};_0x4c8d1b[_0x336acc]={'$like':'%'+_0x5ed71c['query']['filter']+'%'};return _0x4c8d1b;})});}_0x56463c=_[_0xc1fb('0x3d')]({},_0x56463c,_0x5ed71c[_0xc1fb('0x3f')]);return _0x161084[_0xc1fb('0x4c')](_0x56463c);}})[_0xc1fb('0x26')](function(_0x4af0c5){if(_0x4af0c5){_0x4da701=_0x4af0c5['length'];if(!_0x5ed71c[_0xc1fb('0x34')][_0xc1fb('0x38')](_0xc1fb('0x50'))){_0x56463c['limit']=qs[_0xc1fb('0x1f')](_0x5ed71c[_0xc1fb('0x34')][_0xc1fb('0x1f')]);_0x56463c[_0xc1fb('0x1d')]=qs[_0xc1fb('0x1d')](_0x5ed71c['query'][_0xc1fb('0x1d')]);}return _0x161084['getConfigurations'](_0x56463c);}})[_0xc1fb('0x26')](function(_0x8290c6){if(_0x8290c6){return _0x8290c6?{'count':_0x4da701,'rows':_0x8290c6}:null;}})['then'](respondWithResult(_0x34ed25,null))['catch'](handleError(_0x34ed25,null));};exports[_0xc1fb('0x51')]=function(_0x3e9729,_0x47a713,_0x1a63df){if(_0x3e9729[_0xc1fb('0x4b')]['id']){delete _0x3e9729[_0xc1fb('0x4b')]['id'];}return db[_0xc1fb('0x2f')][_0xc1fb('0x4d')]({'where':{'id':_0x3e9729['params']['id']}})['then'](handleEntityNotFound(_0x47a713,null))['then'](function(_0x2600b3){if(_0x2600b3){_0x3e9729[_0xc1fb('0x4b')]['AccountId']=_0x2600b3['id'];_0x3e9729['body'][_0xc1fb('0x52')]=integrations[_0xc1fb('0x53')](_0x3e9729[_0xc1fb('0x4b')][_0xc1fb('0x54')],_0x3e9729['body'][_0xc1fb('0x31')]);_0x3e9729[_0xc1fb('0x4b')][_0xc1fb('0x55')]=integrations[_0xc1fb('0x56')](_0x3e9729['body'][_0xc1fb('0x54')],_0x3e9729[_0xc1fb('0x4b')][_0xc1fb('0x31')]);return db[_0xc1fb('0x4e')][_0xc1fb('0x49')](_0x3e9729[_0xc1fb('0x4b')],{'include':[{'model':db[_0xc1fb('0x57')],'as':_0xc1fb('0x52')},{'model':db[_0xc1fb('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x47a713,null))[_0xc1fb('0x43')](handleError(_0x47a713,null));};exports[_0xc1fb('0x58')]=function(_0x5dcdf8,_0x22d7a9,_0x45d8d1){var _0xfdaec4;var _0x4213e8='';var _0x203dc8='Task';return db[_0xc1fb('0x2f')][_0xc1fb('0x4d')]({'where':{'id':_0x5dcdf8['params']['id']},'attributes':['id',_0xc1fb('0x59'),_0xc1fb('0x5a'),_0xc1fb('0x5b'),_0xc1fb('0x5c'),_0xc1fb('0x5d'),_0xc1fb('0x5e')]})[_0xc1fb('0x26')](handleEntityNotFound(_0x22d7a9,null))[_0xc1fb('0x26')](function(_0x1678b1){if(_0x1678b1){_0x4213e8=_0x1678b1[_0xc1fb('0x59')];var _0x3da51d=_0x4213e8[_0xc1fb('0x5f')](-0x1);if(_0x3da51d==='/'){_0x4213e8=_0x4213e8[_0xc1fb('0x60')](0x0,_0x4213e8['lastIndexOf'](_0x3da51d));}_0xfdaec4=new jsforce[(_0xc1fb('0x61'))]({'oauth2':{'loginUrl':_0x4213e8,'clientId':_0x1678b1[_0xc1fb('0x5a')],'clientSecret':_0x1678b1['clientSecret']}});return _0xfdaec4[_0xc1fb('0x62')](_0x1678b1['username'],_0x1678b1[_0xc1fb('0x5d')][_0xc1fb('0x63')](_0x1678b1[_0xc1fb('0x5e')]));}})[_0xc1fb('0x26')](function(_0x3f72ad){if(_0x3f72ad){if(!_[_0xc1fb('0x64')](_0x5dcdf8[_0xc1fb('0x34')][_0xc1fb('0x65')])){_0x203dc8=_0x5dcdf8['query'][_0xc1fb('0x65')];}return _0xfdaec4['sobject'](_0x203dc8)[_0xc1fb('0x66')]();}})[_0xc1fb('0x26')](function(_0x42aa6b){var _0x54219f=[_0xc1fb('0x67'),'ActivityDate','IsReminderSet',_0xc1fb('0x68'),'Subject',_0xc1fb('0x69')];var _0x76364f=['string',_0xc1fb('0x6a'),_0xc1fb('0x6b'),'boolean',_0xc1fb('0x6c'),_0xc1fb('0x6d'),_0xc1fb('0x6e')];if(_0x42aa6b){_[_0xc1fb('0x6f')](_0x42aa6b[_0xc1fb('0x45')],function(_0x300791){return _0x54219f[_0xc1fb('0x70')](_0x300791[_0xc1fb('0x2b')])||!_0x76364f[_0xc1fb('0x70')](_0x300791[_0xc1fb('0x31')]);});return{'count':_0x42aa6b[_0xc1fb('0x45')][_0xc1fb('0x46')],'rows':_[_0xc1fb('0x2e')](_0x42aa6b[_0xc1fb('0x45')],function(_0x3328dc){return{'id':_0x3328dc[_0xc1fb('0x2b')],'name':_0x3328dc[_0xc1fb('0x71')],'custom':_0x3328dc[_0xc1fb('0x72')],'options':_0x3328dc[_0xc1fb('0x73')][_0xc1fb('0x46')]>0x0?_[_0xc1fb('0x2e')](_0x3328dc[_0xc1fb('0x73')],function(_0x5df99a){return{'name':_0x5df99a['label'],'value':_0x5df99a[_0xc1fb('0x74')]};}):_0x3328dc[_0xc1fb('0x31')]==_0xc1fb('0x75')?[{'name':_0xc1fb('0x76'),'value':_0xc1fb('0x77')},{'name':_0xc1fb('0x78'),'value':_0xc1fb('0x79')}]:[]};})};}})[_0xc1fb('0x26')](respondWithResult(_0x22d7a9,null))['catch'](function(_0x4c6d76){var _0x35e088=_0x5dcdf8[_0xc1fb('0x34')][_0xc1fb('0x7a')]?0x1f4:_0x4c6d76[_0xc1fb('0x7b')]||0x1f4;logger['error'](_0xc1fb('0x7c'),'getFields',_0x35e088,JSON['stringify'](_0x4c6d76));delete _0x4c6d76['name'];if(_0x35e088===0x191){_0x35e088=0x190;}_0x22d7a9['status'](_0x35e088)['send'](_0x5dcdf8[_0xc1fb('0x34')][_0xc1fb('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x4c6d76['statusCode']}:_0x4c6d76);});}; \ No newline at end of file +var _0xe7ae=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','update','destroy','getConfigurations','findOne','SalesforceConfiguration','order','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','clientId','clientSecret','username','password','securityToken','remoteUri','slice','lastIndexOf','login','concat','isNil','ticketType','sobject','describe','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','False','false','test','statusCode','error','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra'];(function(_0x88849c,_0x37dd09){var _0x296b57=function(_0x292205){while(--_0x292205){_0x88849c['push'](_0x88849c['shift']());}};_0x296b57(++_0x37dd09);}(_0xe7ae,0x1ed));var _0xee7a=function(_0x440d30,_0x397fd8){_0x440d30=_0x440d30-0x0;var _0x38971c=_0xe7ae[_0x440d30];return _0x38971c;};'use strict';var emlformat=require(_0xee7a('0x0'));var rimraf=require(_0xee7a('0x1'));var zipdir=require(_0xee7a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee7a('0x3'));var moment=require(_0xee7a('0x4'));var BPromise=require(_0xee7a('0x5'));var Mustache=require(_0xee7a('0x6'));var util=require(_0xee7a('0x7'));var path=require(_0xee7a('0x8'));var sox=require('sox');var csv=require(_0xee7a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee7a('0xa'));var _=require(_0xee7a('0xb'));var squel=require(_0xee7a('0xc'));var crypto=require(_0xee7a('0xd'));var jsforce=require(_0xee7a('0xe'));var deskjs=require(_0xee7a('0xf'));var toCsv=require(_0xee7a('0x9'));var querystring=require(_0xee7a('0x10'));var Papa=require(_0xee7a('0x11'));var Redis=require(_0xee7a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xee7a('0x13'));var as=require(_0xee7a('0x14'));var hardwareService=require(_0xee7a('0x15'));var logger=require('../../config/logger')(_0xee7a('0x16'));var utils=require(_0xee7a('0x17'));var config=require(_0xee7a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xee7a('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1e9402,_0x25347a){_0x25347a=_0x25347a||0xcc;return function(_0x54eacb){if(_0x54eacb){return _0x1e9402[_0xee7a('0x1a')](_0x25347a);}return _0x1e9402[_0xee7a('0x1b')](_0x25347a)[_0xee7a('0x1c')]();};}function respondWithResult(_0x5ddc4f,_0x4b1345){_0x4b1345=_0x4b1345||0xc8;return function(_0x4a19d3){if(_0x4a19d3){return _0x5ddc4f[_0xee7a('0x1b')](_0x4b1345)[_0xee7a('0x1d')](_0x4a19d3);}};}function respondWithFilteredResult(_0x2e8aca,_0x42119e){return function(_0x1b7366){if(_0x1b7366){var _0x4f3de5=typeof _0x42119e[_0xee7a('0x1e')]==='undefined'&&typeof _0x42119e[_0xee7a('0x1f')]==='undefined';var _0xbd4834=_0x1b7366['count'];var _0x3a084f=_0x4f3de5?0x0:_0x42119e[_0xee7a('0x1e')];var _0x2f3636=_0x4f3de5?_0x1b7366['count']:_0x42119e[_0xee7a('0x1e')]+_0x42119e[_0xee7a('0x1f')];var _0x278d0c;if(_0x2f3636>=_0xbd4834){_0x2f3636=_0xbd4834;_0x278d0c=0xc8;}else{_0x278d0c=0xce;}_0x2e8aca[_0xee7a('0x1b')](_0x278d0c);return _0x2e8aca[_0xee7a('0x20')](_0xee7a('0x21'),_0x3a084f+'-'+_0x2f3636+'/'+_0xbd4834)['json'](_0x1b7366);}return null;};}function patchUpdates(_0x177c0f){return function(_0x15f8b4){try{jsonpatch[_0xee7a('0x22')](_0x15f8b4,_0x177c0f,!![]);}catch(_0x5b7f5d){return BPromise[_0xee7a('0x23')](_0x5b7f5d);}return _0x15f8b4[_0xee7a('0x24')]();};}function saveUpdates(_0xd55040,_0x581acc){return function(_0x43c05d){if(_0x43c05d){return _0x43c05d['update'](_0xd55040)[_0xee7a('0x25')](function(_0x59b447){return _0x59b447;});}return null;};}function removeEntity(_0x414c30,_0x4107e4){return function(_0x57d1b2){if(_0x57d1b2){return _0x57d1b2['destroy']()['then'](function(){_0x414c30[_0xee7a('0x1b')](0xcc)[_0xee7a('0x1c')]();});}};}function handleEntityNotFound(_0x1b4673,_0x30b71b){return function(_0x75e692){if(!_0x75e692){_0x1b4673['sendStatus'](0x194);}return _0x75e692;};}function handleError(_0x297aab,_0x4215a){_0x4215a=_0x4215a||0x1f4;return function(_0x325b55){logger['error'](_0x325b55[_0xee7a('0x26')]);if(_0x325b55[_0xee7a('0x27')]){delete _0x325b55[_0xee7a('0x27')];}_0x297aab[_0xee7a('0x1b')](_0x4215a)['send'](_0x325b55);};}exports[_0xee7a('0x28')]=function(_0x4ce5c9,_0x39e8a8){var _0x16b3d9={},_0x5adaed={},_0x7fd821={'count':0x0,'rows':[]};var _0x30bde9=_[_0xee7a('0x29')](db[_0xee7a('0x2a')][_0xee7a('0x2b')],function(_0x3d0640){return{'name':_0x3d0640[_0xee7a('0x2c')],'type':_0x3d0640[_0xee7a('0x2d')]['key']};});_0x5adaed[_0xee7a('0x2e')]=_[_0xee7a('0x29')](_0x30bde9,_0xee7a('0x27'));_0x5adaed[_0xee7a('0x2f')]=_['keys'](_0x4ce5c9[_0xee7a('0x2f')]);_0x5adaed['filters']=_[_0xee7a('0x30')](_0x5adaed[_0xee7a('0x2e')],_0x5adaed[_0xee7a('0x2f')]);_0x16b3d9[_0xee7a('0x31')]=_[_0xee7a('0x30')](_0x5adaed['model'],qs[_0xee7a('0x32')](_0x4ce5c9[_0xee7a('0x2f')]['fields']));_0x16b3d9[_0xee7a('0x31')]=_0x16b3d9['attributes'][_0xee7a('0x33')]?_0x16b3d9[_0xee7a('0x31')]:_0x5adaed[_0xee7a('0x2e')];if(!_0x4ce5c9[_0xee7a('0x2f')][_0xee7a('0x34')](_0xee7a('0x35'))){_0x16b3d9[_0xee7a('0x1f')]=qs[_0xee7a('0x1f')](_0x4ce5c9['query'][_0xee7a('0x1f')]);_0x16b3d9[_0xee7a('0x1e')]=qs[_0xee7a('0x1e')](_0x4ce5c9[_0xee7a('0x2f')][_0xee7a('0x1e')]);}_0x16b3d9['order']=qs[_0xee7a('0x36')](_0x4ce5c9[_0xee7a('0x2f')][_0xee7a('0x36')]);_0x16b3d9[_0xee7a('0x37')]=qs['filters'](_[_0xee7a('0x38')](_0x4ce5c9['query'],_0x5adaed[_0xee7a('0x39')]),_0x30bde9);if(_0x4ce5c9[_0xee7a('0x2f')][_0xee7a('0x3a')]){_0x16b3d9[_0xee7a('0x37')]=_['merge'](_0x16b3d9['where'],{'$or':_[_0xee7a('0x29')](_0x30bde9,function(_0xb09bc2){if(_0xb09bc2[_0xee7a('0x2d')]!==_0xee7a('0x3b')){var _0x39caf6={};_0x39caf6[_0xb09bc2[_0xee7a('0x27')]]={'$like':'%'+_0x4ce5c9['query'][_0xee7a('0x3a')]+'%'};return _0x39caf6;}})});}_0x16b3d9=_[_0xee7a('0x3c')]({},_0x16b3d9,_0x4ce5c9['options']);var _0x3c7489={'where':_0x16b3d9[_0xee7a('0x37')]};return db[_0xee7a('0x2a')]['count'](_0x3c7489)[_0xee7a('0x25')](function(_0x2f808f){_0x7fd821[_0xee7a('0x3d')]=_0x2f808f;if(_0x4ce5c9['query'][_0xee7a('0x3e')]){_0x16b3d9[_0xee7a('0x3f')]=[{'all':!![]}];}return db[_0xee7a('0x2a')][_0xee7a('0x40')](_0x16b3d9);})[_0xee7a('0x25')](function(_0x204f31){_0x7fd821[_0xee7a('0x41')]=_0x204f31;return _0x7fd821;})['then'](respondWithFilteredResult(_0x39e8a8,_0x16b3d9))['catch'](handleError(_0x39e8a8,null));};exports[_0xee7a('0x42')]=function(_0x5102a3,_0x2cdfa7){var _0x1970e8={'raw':![],'where':{'id':_0x5102a3[_0xee7a('0x43')]['id']}},_0x1d5b0f={};_0x1d5b0f[_0xee7a('0x2e')]=_[_0xee7a('0x44')](db[_0xee7a('0x2a')]['rawAttributes']);_0x1d5b0f[_0xee7a('0x2f')]=_[_0xee7a('0x44')](_0x5102a3[_0xee7a('0x2f')]);_0x1d5b0f['filters']=_[_0xee7a('0x30')](_0x1d5b0f[_0xee7a('0x2e')],_0x1d5b0f['query']);_0x1970e8[_0xee7a('0x31')]=_['intersection'](_0x1d5b0f[_0xee7a('0x2e')],qs[_0xee7a('0x32')](_0x5102a3[_0xee7a('0x2f')][_0xee7a('0x32')]));_0x1970e8[_0xee7a('0x31')]=_0x1970e8[_0xee7a('0x31')][_0xee7a('0x33')]?_0x1970e8[_0xee7a('0x31')]:_0x1d5b0f[_0xee7a('0x2e')];if(_0x5102a3[_0xee7a('0x2f')][_0xee7a('0x3e')]){_0x1970e8[_0xee7a('0x3f')]=[{'all':!![]}];}_0x1970e8=_['merge']({},_0x1970e8,_0x5102a3[_0xee7a('0x45')]);return db[_0xee7a('0x2a')][_0xee7a('0x46')](_0x1970e8)[_0xee7a('0x25')](handleEntityNotFound(_0x2cdfa7,null))['then'](respondWithResult(_0x2cdfa7,null))[_0xee7a('0x47')](handleError(_0x2cdfa7,null));};exports[_0xee7a('0x48')]=function(_0x39c669,_0x3a906b){return db[_0xee7a('0x2a')][_0xee7a('0x48')](_0x39c669[_0xee7a('0x49')],{})[_0xee7a('0x25')](respondWithResult(_0x3a906b,0xc9))[_0xee7a('0x47')](handleError(_0x3a906b,null));};exports[_0xee7a('0x4a')]=function(_0x20f7c4,_0x4b49f6){if(_0x20f7c4[_0xee7a('0x49')]['id']){delete _0x20f7c4[_0xee7a('0x49')]['id'];}return db[_0xee7a('0x2a')][_0xee7a('0x46')]({'where':{'id':_0x20f7c4[_0xee7a('0x43')]['id']}})[_0xee7a('0x25')](handleEntityNotFound(_0x4b49f6,null))[_0xee7a('0x25')](saveUpdates(_0x20f7c4[_0xee7a('0x49')],null))[_0xee7a('0x25')](respondWithResult(_0x4b49f6,null))[_0xee7a('0x47')](handleError(_0x4b49f6,null));};exports[_0xee7a('0x4b')]=function(_0x279b03,_0xe4c8ea){return db[_0xee7a('0x2a')]['find']({'where':{'id':_0x279b03[_0xee7a('0x43')]['id']}})[_0xee7a('0x25')](handleEntityNotFound(_0xe4c8ea,null))['then'](removeEntity(_0xe4c8ea,null))['catch'](handleError(_0xe4c8ea,null));};exports[_0xee7a('0x4c')]=function(_0x1e93dd,_0x3c6cb5,_0x47511d){var _0x3d40dc={};var _0x2a6f5a={};var _0xe0cc5e;var _0x1d7768;return db['SalesforceAccount'][_0xee7a('0x4d')]({'where':{'id':_0x1e93dd[_0xee7a('0x43')]['id']}})[_0xee7a('0x25')](handleEntityNotFound(_0x3c6cb5,null))[_0xee7a('0x25')](function(_0x579846){if(_0x579846){_0xe0cc5e=_0x579846;_0x2a6f5a['model']=_['keys'](db[_0xee7a('0x4e')][_0xee7a('0x2b')]);_0x2a6f5a['query']=_[_0xee7a('0x44')](_0x1e93dd[_0xee7a('0x2f')]);_0x2a6f5a[_0xee7a('0x39')]=_['intersection'](_0x2a6f5a['model'],_0x2a6f5a[_0xee7a('0x2f')]);_0x3d40dc[_0xee7a('0x31')]=_[_0xee7a('0x30')](_0x2a6f5a[_0xee7a('0x2e')],qs[_0xee7a('0x32')](_0x1e93dd[_0xee7a('0x2f')][_0xee7a('0x32')]));_0x3d40dc['attributes']=_0x3d40dc['attributes'][_0xee7a('0x33')]?_0x3d40dc['attributes']:_0x2a6f5a['model'];_0x3d40dc[_0xee7a('0x4f')]=qs['sort'](_0x1e93dd[_0xee7a('0x2f')][_0xee7a('0x36')]);_0x3d40dc[_0xee7a('0x37')]=qs[_0xee7a('0x39')](_[_0xee7a('0x38')](_0x1e93dd[_0xee7a('0x2f')],_0x2a6f5a['filters']));if(_0x1e93dd[_0xee7a('0x2f')]['filter']){_0x3d40dc[_0xee7a('0x37')]=_[_0xee7a('0x3c')](_0x3d40dc[_0xee7a('0x37')],{'$or':_[_0xee7a('0x29')](_0x3d40dc[_0xee7a('0x31')],function(_0x55657c){var _0x309945={};_0x309945[_0x55657c]={'$like':'%'+_0x1e93dd[_0xee7a('0x2f')][_0xee7a('0x3a')]+'%'};return _0x309945;})});}_0x3d40dc=_[_0xee7a('0x3c')]({},_0x3d40dc,_0x1e93dd[_0xee7a('0x45')]);return _0xe0cc5e[_0xee7a('0x4c')](_0x3d40dc);}})['then'](function(_0x40118b){if(_0x40118b){_0x1d7768=_0x40118b['length'];if(!_0x1e93dd[_0xee7a('0x2f')][_0xee7a('0x34')](_0xee7a('0x35'))){_0x3d40dc[_0xee7a('0x1f')]=qs[_0xee7a('0x1f')](_0x1e93dd[_0xee7a('0x2f')][_0xee7a('0x1f')]);_0x3d40dc['offset']=qs[_0xee7a('0x1e')](_0x1e93dd['query'][_0xee7a('0x1e')]);}return _0xe0cc5e['getConfigurations'](_0x3d40dc);}})['then'](function(_0x5af1b1){if(_0x5af1b1){return _0x5af1b1?{'count':_0x1d7768,'rows':_0x5af1b1}:null;}})['then'](respondWithResult(_0x3c6cb5,null))[_0xee7a('0x47')](handleError(_0x3c6cb5,null));};exports[_0xee7a('0x50')]=function(_0x3492f1,_0x7e53c0,_0x297762){if(_0x3492f1[_0xee7a('0x49')]['id']){delete _0x3492f1[_0xee7a('0x49')]['id'];}return db[_0xee7a('0x2a')]['findOne']({'where':{'id':_0x3492f1[_0xee7a('0x43')]['id']}})[_0xee7a('0x25')](handleEntityNotFound(_0x7e53c0,null))[_0xee7a('0x25')](function(_0x1850d0){if(_0x1850d0){_0x3492f1[_0xee7a('0x49')]['AccountId']=_0x1850d0['id'];_0x3492f1['body'][_0xee7a('0x51')]=integrations[_0xee7a('0x52')](_0x3492f1[_0xee7a('0x49')][_0xee7a('0x53')],_0x3492f1[_0xee7a('0x49')][_0xee7a('0x2d')]);_0x3492f1[_0xee7a('0x49')][_0xee7a('0x54')]=integrations[_0xee7a('0x55')](_0x3492f1['body'][_0xee7a('0x53')],_0x3492f1[_0xee7a('0x49')][_0xee7a('0x2d')]);return db[_0xee7a('0x4e')][_0xee7a('0x48')](_0x3492f1['body'],{'include':[{'model':db['SalesforceField'],'as':_0xee7a('0x51')},{'model':db[_0xee7a('0x56')],'as':_0xee7a('0x54')}]});}return null;})[_0xee7a('0x25')](respondWithResult(_0x7e53c0,null))[_0xee7a('0x47')](handleError(_0x7e53c0,null));};exports[_0xee7a('0x57')]=function(_0x31927c,_0x261ede,_0x3d9c60){var _0x615c50;var _0x554da1='';var _0xa54551='Task';return db[_0xee7a('0x2a')][_0xee7a('0x4d')]({'where':{'id':_0x31927c[_0xee7a('0x43')]['id']},'attributes':['id','remoteUri',_0xee7a('0x58'),_0xee7a('0x59'),_0xee7a('0x5a'),_0xee7a('0x5b'),_0xee7a('0x5c')]})['then'](handleEntityNotFound(_0x261ede,null))[_0xee7a('0x25')](function(_0x1142d2){if(_0x1142d2){_0x554da1=_0x1142d2[_0xee7a('0x5d')];var _0x4c46ca=_0x554da1[_0xee7a('0x5e')](-0x1);if(_0x4c46ca==='/'){_0x554da1=_0x554da1['substring'](0x0,_0x554da1[_0xee7a('0x5f')](_0x4c46ca));}_0x615c50=new jsforce['Connection']({'oauth2':{'loginUrl':_0x554da1,'clientId':_0x1142d2[_0xee7a('0x58')],'clientSecret':_0x1142d2['clientSecret']}});return _0x615c50[_0xee7a('0x60')](_0x1142d2['username'],_0x1142d2[_0xee7a('0x5b')][_0xee7a('0x61')](_0x1142d2['securityToken']));}})[_0xee7a('0x25')](function(_0x567235){if(_0x567235){if(!_[_0xee7a('0x62')](_0x31927c[_0xee7a('0x2f')][_0xee7a('0x63')])){_0xa54551=_0x31927c[_0xee7a('0x2f')]['ticketType'];}return _0x615c50[_0xee7a('0x64')](_0xa54551)[_0xee7a('0x65')]();}})['then'](function(_0x2a8ddf){var _0x3da686=['OwnerId','ActivityDate',_0xee7a('0x66'),_0xee7a('0x67'),_0xee7a('0x68'),_0xee7a('0x69')];var _0x249768=[_0xee7a('0x6a'),_0xee7a('0x6b'),_0xee7a('0x6c'),_0xee7a('0x6d'),_0xee7a('0x6e'),_0xee7a('0x6f'),_0xee7a('0x70')];if(_0x2a8ddf){_[_0xee7a('0x71')](_0x2a8ddf['fields'],function(_0x5232b4){return _0x3da686[_0xee7a('0x72')](_0x5232b4[_0xee7a('0x27')])||!_0x249768['includes'](_0x5232b4[_0xee7a('0x2d')]);});return{'count':_0x2a8ddf['fields'][_0xee7a('0x33')],'rows':_[_0xee7a('0x29')](_0x2a8ddf[_0xee7a('0x32')],function(_0x4131b3){return{'id':_0x4131b3['name'],'name':_0x4131b3[_0xee7a('0x73')],'custom':_0x4131b3[_0xee7a('0x74')],'options':_0x4131b3[_0xee7a('0x75')][_0xee7a('0x33')]>0x0?_[_0xee7a('0x29')](_0x4131b3[_0xee7a('0x75')],function(_0x458ade){return{'name':_0x458ade[_0xee7a('0x73')],'value':_0x458ade[_0xee7a('0x76')]};}):_0x4131b3[_0xee7a('0x2d')]==_0xee7a('0x6d')?[{'name':'True','value':'true'},{'name':_0xee7a('0x77'),'value':_0xee7a('0x78')}]:[]};})};}})[_0xee7a('0x25')](respondWithResult(_0x261ede,null))[_0xee7a('0x47')](function(_0x201acb){var _0x565ca8=_0x31927c['query'][_0xee7a('0x79')]?0x1f4:_0x201acb[_0xee7a('0x7a')]||0x1f4;logger[_0xee7a('0x7b')]('getFields,\x20%s,\x20%s,\x20%s',_0xee7a('0x57'),_0x565ca8,JSON['stringify'](_0x201acb));delete _0x201acb[_0xee7a('0x27')];if(_0x565ca8===0x191){_0x565ca8=0x190;}_0x261ede[_0xee7a('0x1b')](_0x565ca8)[_0xee7a('0x7c')](_0x31927c[_0xee7a('0x2f')]['test']?{'message':_0xee7a('0x7d'),'statusCode':_0x201acb['statusCode']}:_0x201acb);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 7406fdc..f96b7f9 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 _0xf418=['SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf418,0x1e3));var _0x8f41=function(_0x468199,_0xc1e9f4){_0x468199=_0x468199-0x0;var _0x1194e0=_0xf418[_0x468199];return _0x1194e0;};'use strict';var _=require(_0x8f41('0x0'));var util=require('util');var logger=require(_0x8f41('0x1'))('api');var moment=require(_0x8f41('0x2'));var BPromise=require(_0x8f41('0x3'));var rp=require(_0x8f41('0x4'));var fs=require('fs');var path=require(_0x8f41('0x5'));var rimraf=require('rimraf');var config=require(_0x8f41('0x6'));var attributes=require(_0x8f41('0x7'));var integrations=require(_0x8f41('0x8'));module[_0x8f41('0x9')]=function(_0x54eff0,_0x2f40f5){return _0x54eff0[_0x8f41('0xa')](_0x8f41('0xb'),attributes,{'tableName':_0x8f41('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9585=['define','SalesforceAccount','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports'];(function(_0x24f7bf,_0x5ca676){var _0xb87006=function(_0x50cb2f){while(--_0x50cb2f){_0x24f7bf['push'](_0x24f7bf['shift']());}};_0xb87006(++_0x5ca676);}(_0x9585,0x15e));var _0x5958=function(_0x9188d3,_0x3b712e){_0x9188d3=_0x9188d3-0x0;var _0x5e5a0d=_0x9585[_0x9188d3];return _0x5e5a0d;};'use strict';var _=require('lodash');var util=require(_0x5958('0x0'));var logger=require('../../config/logger')(_0x5958('0x1'));var moment=require(_0x5958('0x2'));var BPromise=require(_0x5958('0x3'));var rp=require(_0x5958('0x4'));var fs=require('fs');var path=require(_0x5958('0x5'));var rimraf=require(_0x5958('0x6'));var config=require(_0x5958('0x7'));var attributes=require(_0x5958('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x5958('0x9')]=function(_0x48ddaf,_0xc050d5){return _0x48ddaf[_0x5958('0xa')](_0x5958('0xb'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index e8a6ed4..66cf5d9 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 _0x73b6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','SalesforceAccount','findAll','options','raw','where','limit','map','include','model','attributes','GetSalesforceAccount','find','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring'];(function(_0x4fb18a,_0x4186a3){var _0x13bf76=function(_0x48d884){while(--_0x48d884){_0x4fb18a['push'](_0x4fb18a['shift']());}};_0x13bf76(++_0x4186a3);}(_0x73b6,0x6a));var _0x673b=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x73b6[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x673b('0x0'));var util=require(_0x673b('0x1'));var moment=require(_0x673b('0x2'));var BPromise=require(_0x673b('0x3'));var rs=require(_0x673b('0x4'));var fs=require('fs');var Redis=require(_0x673b('0x5'));var db=require(_0x673b('0x6'))['db'];var utils=require(_0x673b('0x7'));var logger=require(_0x673b('0x8'))(_0x673b('0x9'));var config=require(_0x673b('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x673b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ff8a7,_0x491984,_0x15ae49){return new BPromise(function(_0x10e5ae,_0x317033){return client[_0x673b('0xc')](_0x3ff8a7,_0x15ae49)[_0x673b('0xd')](function(_0x21fe23){logger[_0x673b('0xe')](_0x673b('0xf'),_0x491984,'request\x20sent');logger[_0x673b('0x10')](_0x673b('0x11'),_0x491984,_0x673b('0x12'),JSON[_0x673b('0x13')](_0x21fe23));if(_0x21fe23[_0x673b('0x14')]){if(_0x21fe23['error']['code']===0x1f4){logger['error'](_0x673b('0xf'),_0x491984,_0x21fe23[_0x673b('0x14')][_0x673b('0x15')]);return _0x317033(_0x21fe23[_0x673b('0x14')][_0x673b('0x15')]);}logger[_0x673b('0x14')](_0x673b('0xf'),_0x491984,_0x21fe23[_0x673b('0x14')][_0x673b('0x15')]);return _0x10e5ae(_0x21fe23[_0x673b('0x14')]['message']);}else{logger[_0x673b('0xe')](_0x673b('0xf'),_0x491984,_0x673b('0x12'));_0x10e5ae(_0x21fe23[_0x673b('0x16')]['message']);}})[_0x673b('0x17')](function(_0xc92626){logger[_0x673b('0x14')](_0x673b('0xf'),_0x491984,_0xc92626);_0x317033(_0xc92626);});});}exports['GetSalesforceAccount']=function(_0x468a89){var _0x5c4776=this;return new Promise(function(_0x33f754,_0x541eae){return db[_0x673b('0x18')][_0x673b('0x19')]({'raw':_0x468a89[_0x673b('0x1a')]?_0x468a89[_0x673b('0x1a')][_0x673b('0x1b')]===undefined?!![]:![]:!![],'where':_0x468a89['options']?_0x468a89[_0x673b('0x1a')][_0x673b('0x1c')]||null:null,'attributes':_0x468a89[_0x673b('0x1a')]?_0x468a89[_0x673b('0x1a')]['attributes']||null:null,'limit':_0x468a89[_0x673b('0x1a')]?_0x468a89['options'][_0x673b('0x1d')]||null:null,'include':_0x468a89[_0x673b('0x1a')]?_0x468a89[_0x673b('0x1a')]['include']?_[_0x673b('0x1e')](_0x468a89[_0x673b('0x1a')][_0x673b('0x1f')],function(_0x59ca36){return{'model':db[_0x59ca36[_0x673b('0x20')]],'as':_0x59ca36['as'],'attributes':_0x59ca36[_0x673b('0x21')],'include':_0x59ca36[_0x673b('0x1f')]?_[_0x673b('0x1e')](_0x59ca36[_0x673b('0x1f')],function(_0x164516){return{'model':db[_0x164516[_0x673b('0x20')]],'as':_0x164516['as'],'attributes':_0x164516[_0x673b('0x21')],'include':_0x164516[_0x673b('0x1f')]?_[_0x673b('0x1e')](_0x164516[_0x673b('0x1f')],function(_0x99c637){return{'model':db[_0x99c637[_0x673b('0x20')]],'as':_0x99c637['as'],'attributes':_0x99c637[_0x673b('0x21')]};}):[]};}):[]};}):[]:[]})[_0x673b('0xd')](function(_0x5e864e){logger[_0x673b('0xe')]('GetSalesforceAccount',_0x468a89);logger['debug'](_0x673b('0x22'),_0x468a89,JSON[_0x673b('0x13')](_0x5e864e));_0x33f754(_0x5e864e);})[_0x673b('0x17')](function(_0x1ce87e){logger[_0x673b('0x14')](_0x673b('0x22'),_0x1ce87e[_0x673b('0x15')],_0x468a89);_0x541eae(_0x5c4776[_0x673b('0x14')](0x1f4,_0x1ce87e[_0x673b('0x15')]));});});};exports['ShowSalesforceAccount']=function(_0x3139d0){var _0x8a7f62=this;return new Promise(function(_0x31dd3a,_0x5c9c1c){return db[_0x673b('0x18')][_0x673b('0x23')]({'raw':_0x3139d0['options']?_0x3139d0[_0x673b('0x1a')][_0x673b('0x1b')]===undefined?!![]:![]:!![],'where':_0x3139d0[_0x673b('0x1a')]?_0x3139d0[_0x673b('0x1a')][_0x673b('0x1c')]||null:null,'attributes':_0x3139d0[_0x673b('0x1a')]?_0x3139d0[_0x673b('0x1a')]['attributes']||null:null,'include':_0x3139d0[_0x673b('0x1a')]?_0x3139d0[_0x673b('0x1a')][_0x673b('0x1f')]?_[_0x673b('0x1e')](_0x3139d0[_0x673b('0x1a')][_0x673b('0x1f')],function(_0x546cea){return{'model':db[_0x546cea[_0x673b('0x20')]],'as':_0x546cea['as'],'attributes':_0x546cea[_0x673b('0x21')],'include':_0x546cea['include']?_['map'](_0x546cea['include'],function(_0x419b5b){return{'model':db[_0x419b5b['model']],'as':_0x419b5b['as'],'attributes':_0x419b5b[_0x673b('0x21')],'include':_0x419b5b[_0x673b('0x1f')]?_['map'](_0x419b5b[_0x673b('0x1f')],function(_0x35f32b){return{'model':db[_0x35f32b[_0x673b('0x20')]],'as':_0x35f32b['as'],'attributes':_0x35f32b[_0x673b('0x21')]};}):[]};}):[]};}):[]:[]})[_0x673b('0xd')](function(_0x51f366){logger[_0x673b('0xe')]('ShowSalesforceAccount',_0x3139d0);logger['debug']('ShowSalesforceAccount',_0x3139d0,JSON[_0x673b('0x13')](_0x51f366));_0x31dd3a(_0x51f366);})[_0x673b('0x17')](function(_0x44d38b){logger[_0x673b('0x14')](_0x673b('0x24'),_0x44d38b[_0x673b('0x15')],_0x3139d0);_0x5c9c1c(_0x8a7f62[_0x673b('0x14')](0x1f4,_0x44d38b[_0x673b('0x15')]));});});}; \ No newline at end of file +var _0xdaa1=['attributes','info','GetSalesforceAccount','stringify','ShowSalesforceAccount','where','then','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','SalesforceAccount,\x20%s,\x20%s','message','result','SalesforceAccount','options','raw','include','map','model'];(function(_0x4dd523,_0x397fc8){var _0x2b442d=function(_0x28074e){while(--_0x28074e){_0x4dd523['push'](_0x4dd523['shift']());}};_0x2b442d(++_0x397fc8);}(_0xdaa1,0x1ba));var _0x1daa=function(_0x57ed7a,_0x27c8f3){_0x57ed7a=_0x57ed7a-0x0;var _0x1aa635=_0xdaa1[_0x57ed7a];return _0x1aa635;};'use strict';var _=require('lodash');var util=require(_0x1daa('0x0'));var moment=require('moment');var BPromise=require(_0x1daa('0x1'));var rs=require(_0x1daa('0x2'));var fs=require('fs');var Redis=require(_0x1daa('0x3'));var db=require(_0x1daa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1daa('0x5'));var config=require(_0x1daa('0x6'));var jayson=require(_0x1daa('0x7'));var client=jayson[_0x1daa('0x8')][_0x1daa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52650b,_0x1cdc99,_0x59055c){return new BPromise(function(_0x47ac90,_0x302d64){return client[_0x1daa('0xa')](_0x52650b,_0x59055c)['then'](function(_0x25c449){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x1cdc99,_0x1daa('0xb'));logger[_0x1daa('0xc')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1cdc99,_0x1daa('0xb'),JSON['stringify'](_0x25c449));if(_0x25c449['error']){if(_0x25c449[_0x1daa('0xd')]['code']===0x1f4){logger[_0x1daa('0xd')](_0x1daa('0xe'),_0x1cdc99,_0x25c449[_0x1daa('0xd')][_0x1daa('0xf')]);return _0x302d64(_0x25c449[_0x1daa('0xd')][_0x1daa('0xf')]);}logger[_0x1daa('0xd')](_0x1daa('0xe'),_0x1cdc99,_0x25c449[_0x1daa('0xd')][_0x1daa('0xf')]);return _0x47ac90(_0x25c449[_0x1daa('0xd')][_0x1daa('0xf')]);}else{logger['info'](_0x1daa('0xe'),_0x1cdc99,'request\x20sent');_0x47ac90(_0x25c449[_0x1daa('0x10')][_0x1daa('0xf')]);}})['catch'](function(_0x421d5b){logger[_0x1daa('0xd')](_0x1daa('0xe'),_0x1cdc99,_0x421d5b);_0x302d64(_0x421d5b);});});}exports['GetSalesforceAccount']=function(_0x8e086c){var _0x3a13cc=this;return new Promise(function(_0x1a7c42,_0x5b7381){return db[_0x1daa('0x11')]['findAll']({'raw':_0x8e086c[_0x1daa('0x12')]?_0x8e086c[_0x1daa('0x12')][_0x1daa('0x13')]===undefined?!![]:![]:!![],'where':_0x8e086c['options']?_0x8e086c[_0x1daa('0x12')]['where']||null:null,'attributes':_0x8e086c[_0x1daa('0x12')]?_0x8e086c[_0x1daa('0x12')]['attributes']||null:null,'limit':_0x8e086c[_0x1daa('0x12')]?_0x8e086c['options']['limit']||null:null,'include':_0x8e086c[_0x1daa('0x12')]?_0x8e086c[_0x1daa('0x12')][_0x1daa('0x14')]?_[_0x1daa('0x15')](_0x8e086c[_0x1daa('0x12')][_0x1daa('0x14')],function(_0x3c0117){return{'model':db[_0x3c0117[_0x1daa('0x16')]],'as':_0x3c0117['as'],'attributes':_0x3c0117['attributes'],'include':_0x3c0117[_0x1daa('0x14')]?_[_0x1daa('0x15')](_0x3c0117[_0x1daa('0x14')],function(_0xe8dcdd){return{'model':db[_0xe8dcdd[_0x1daa('0x16')]],'as':_0xe8dcdd['as'],'attributes':_0xe8dcdd[_0x1daa('0x17')],'include':_0xe8dcdd[_0x1daa('0x14')]?_[_0x1daa('0x15')](_0xe8dcdd[_0x1daa('0x14')],function(_0x2d40c3){return{'model':db[_0x2d40c3['model']],'as':_0x2d40c3['as'],'attributes':_0x2d40c3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x138961){logger[_0x1daa('0x18')](_0x1daa('0x19'),_0x8e086c);logger['debug']('GetSalesforceAccount',_0x8e086c,JSON[_0x1daa('0x1a')](_0x138961));_0x1a7c42(_0x138961);})['catch'](function(_0x4313dd){logger['error'](_0x1daa('0x19'),_0x4313dd[_0x1daa('0xf')],_0x8e086c);_0x5b7381(_0x3a13cc[_0x1daa('0xd')](0x1f4,_0x4313dd[_0x1daa('0xf')]));});});};exports[_0x1daa('0x1b')]=function(_0x574722){var _0x25b2a9=this;return new Promise(function(_0x14bc6a,_0x497204){return db[_0x1daa('0x11')]['find']({'raw':_0x574722['options']?_0x574722[_0x1daa('0x12')][_0x1daa('0x13')]===undefined?!![]:![]:!![],'where':_0x574722[_0x1daa('0x12')]?_0x574722['options'][_0x1daa('0x1c')]||null:null,'attributes':_0x574722['options']?_0x574722[_0x1daa('0x12')][_0x1daa('0x17')]||null:null,'include':_0x574722[_0x1daa('0x12')]?_0x574722[_0x1daa('0x12')][_0x1daa('0x14')]?_[_0x1daa('0x15')](_0x574722[_0x1daa('0x12')]['include'],function(_0x2bf247){return{'model':db[_0x2bf247[_0x1daa('0x16')]],'as':_0x2bf247['as'],'attributes':_0x2bf247[_0x1daa('0x17')],'include':_0x2bf247[_0x1daa('0x14')]?_[_0x1daa('0x15')](_0x2bf247['include'],function(_0x11967d){return{'model':db[_0x11967d[_0x1daa('0x16')]],'as':_0x11967d['as'],'attributes':_0x11967d['attributes'],'include':_0x11967d[_0x1daa('0x14')]?_[_0x1daa('0x15')](_0x11967d['include'],function(_0x9ae2c2){return{'model':db[_0x9ae2c2[_0x1daa('0x16')]],'as':_0x9ae2c2['as'],'attributes':_0x9ae2c2[_0x1daa('0x17')]};}):[]};}):[]};}):[]:[]})[_0x1daa('0x1d')](function(_0x1ef981){logger['info'](_0x1daa('0x1b'),_0x574722);logger[_0x1daa('0xc')](_0x1daa('0x1b'),_0x574722,JSON['stringify'](_0x1ef981));_0x14bc6a(_0x1ef981);})[_0x1daa('0x1e')](function(_0x2fe17d){logger[_0x1daa('0xd')]('ShowSalesforceAccount',_0x2fe17d[_0x1daa('0xf')],_0x574722);_0x497204(_0x25b2a9['error'](0x1f4,_0x2fe17d['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 52fa7b1..6d37251 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x3094c2,_0x465e2b){var _0x488448=function(_0x21e372){while(--_0x21e372){_0x3094c2['push'](_0x3094c2['shift']());}};_0x488448(++_0x465e2b);}(_0x7a54,0x106));var _0x47a5=function(_0x1f2460,_0xcf0d43){_0x1f2460=_0x1f2460-0x0;var _0x561e5d=_0x7a54[_0x1f2460];return _0x561e5d;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xdb28,0x106));var _0x8db2=function(_0x476396,_0x39b05e){_0x476396=_0x476396-0x0;var _0x215c88=_0xdb28[_0x476396];return _0x215c88;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index b63732c..fba4b2c 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 _0x8829=['Task','Case','ENUM','contact_lead','contact','account_contact_lead','account','nothing','lead','sequelize','STRING'];(function(_0x4a615f,_0x4110d5){var _0x3cca2a=function(_0x2b6257){while(--_0x2b6257){_0x4a615f['push'](_0x4a615f['shift']());}};_0x3cca2a(++_0x4110d5);}(_0x8829,0x195));var _0x9882=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8829[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9882('0x0'));module['exports']={'name':{'type':Sequelize[_0x9882('0x1')]},'description':{'type':Sequelize[_0x9882('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x9882('0x2'),_0x9882('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x9882('0x4')](_0x9882('0x5'),_0x9882('0x6'),'lead',_0x9882('0x7'),_0x9882('0x8')),'defaultValue':_0x9882('0x5')},'moduleCreate':{'type':Sequelize[_0x9882('0x4')](_0x9882('0x9'),_0x9882('0x6'),'lead',_0x9882('0x8')),'defaultValue':_0x9882('0xa')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x9882('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x9882('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x52fd=['account','contact_lead','nothing','sequelize','exports','STRING','ENUM','Task','Case','contact','lead','account_contact_lead'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x52fd,0x18f));var _0xd52f=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x52fd[_0x2283dc];return _0x16db90;};'use strict';var Sequelize=require(_0xd52f('0x0'));module[_0xd52f('0x1')]={'name':{'type':Sequelize[_0xd52f('0x2')]},'description':{'type':Sequelize[_0xd52f('0x2')]},'ticketType':{'type':Sequelize[_0xd52f('0x3')](_0xd52f('0x4'),_0xd52f('0x5')),'defaultValue':_0xd52f('0x4')},'moduleSearch':{'type':Sequelize[_0xd52f('0x3')]('contact_lead',_0xd52f('0x6'),_0xd52f('0x7'),_0xd52f('0x8'),_0xd52f('0x9')),'defaultValue':_0xd52f('0xa')},'moduleCreate':{'type':Sequelize['ENUM'](_0xd52f('0xb'),_0xd52f('0x6'),_0xd52f('0x7'),_0xd52f('0x9')),'defaultValue':_0xd52f('0x7')},'leadId':{'type':Sequelize[_0xd52f('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xd52f('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xd52f('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xd52f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 6e0cdc9..6139ce5 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 _0xb138=['end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','VIRTUAL','merge','includeAll','include','rows','catch','show','params','options','find','create','body','getFields','SalesforceField','order','filter','nolimit','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x1a5540,_0x29a37f){var _0x502523=function(_0x2ee101){while(--_0x2ee101){_0x1a5540['push'](_0x1a5540['shift']());}};_0x502523(++_0x29a37f);}(_0xb138,0x1dd));var _0x8b13=function(_0x38d0a2,_0x4a814a){_0x38d0a2=_0x38d0a2-0x0;var _0x332a78=_0xb138[_0x38d0a2];return _0x332a78;};'use strict';var emlformat=require(_0x8b13('0x0'));var rimraf=require(_0x8b13('0x1'));var zipdir=require(_0x8b13('0x2'));var jsonpatch=require(_0x8b13('0x3'));var rp=require(_0x8b13('0x4'));var moment=require(_0x8b13('0x5'));var BPromise=require(_0x8b13('0x6'));var Mustache=require('mustache');var util=require(_0x8b13('0x7'));var path=require(_0x8b13('0x8'));var sox=require(_0x8b13('0x9'));var csv=require('to-csv');var ejs=require(_0x8b13('0xa'));var fs=require('fs');var fs_extra=require(_0x8b13('0xb'));var _=require('lodash');var squel=require(_0x8b13('0xc'));var crypto=require(_0x8b13('0xd'));var jsforce=require(_0x8b13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8b13('0xf'));var querystring=require(_0x8b13('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b13('0x11'));var qs=require(_0x8b13('0x12'));var as=require(_0x8b13('0x13'));var hardwareService=require(_0x8b13('0x14'));var logger=require(_0x8b13('0x15'))('api');var utils=require(_0x8b13('0x16'));var config=require(_0x8b13('0x17'));var licenseUtil=require(_0x8b13('0x18'));var db=require(_0x8b13('0x19'))['db'];function respondWithStatusCode(_0xb227e0,_0x1893b1){_0x1893b1=_0x1893b1||0xcc;return function(_0x58f97e){if(_0x58f97e){return _0xb227e0['sendStatus'](_0x1893b1);}return _0xb227e0[_0x8b13('0x1a')](_0x1893b1)[_0x8b13('0x1b')]();};}function respondWithResult(_0x5f12b5,_0x51a935){_0x51a935=_0x51a935||0xc8;return function(_0x479773){if(_0x479773){return _0x5f12b5[_0x8b13('0x1a')](_0x51a935)[_0x8b13('0x1c')](_0x479773);}};}function respondWithFilteredResult(_0xf29086,_0x2c615a){return function(_0x13f956){if(_0x13f956){var _0x542357=typeof _0x2c615a[_0x8b13('0x1d')]===_0x8b13('0x1e')&&typeof _0x2c615a[_0x8b13('0x1f')]===_0x8b13('0x1e');var _0x3eed21=_0x13f956[_0x8b13('0x20')];var _0x10fbde=_0x542357?0x0:_0x2c615a[_0x8b13('0x1d')];var _0x4989d3=_0x542357?_0x13f956['count']:_0x2c615a[_0x8b13('0x1d')]+_0x2c615a[_0x8b13('0x1f')];var _0x14a8ac;if(_0x4989d3>=_0x3eed21){_0x4989d3=_0x3eed21;_0x14a8ac=0xc8;}else{_0x14a8ac=0xce;}_0xf29086[_0x8b13('0x1a')](_0x14a8ac);return _0xf29086[_0x8b13('0x21')](_0x8b13('0x22'),_0x10fbde+'-'+_0x4989d3+'/'+_0x3eed21)['json'](_0x13f956);}return null;};}function patchUpdates(_0x1e8a48){return function(_0x3c4d4f){try{jsonpatch[_0x8b13('0x23')](_0x3c4d4f,_0x1e8a48,!![]);}catch(_0x54a309){return BPromise['reject'](_0x54a309);}return _0x3c4d4f[_0x8b13('0x24')]();};}function saveUpdates(_0xcb7621,_0x4f9902){return function(_0x3187ed){if(_0x3187ed){return _0x3187ed[_0x8b13('0x25')](_0xcb7621)[_0x8b13('0x26')](function(_0x213280){return _0x213280;});}return null;};}function removeEntity(_0xc05d5c,_0x583639){return function(_0x339271){if(_0x339271){return _0x339271[_0x8b13('0x27')]()['then'](function(){_0xc05d5c[_0x8b13('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420772,_0x325d68){return function(_0x54786a){if(!_0x54786a){_0x420772[_0x8b13('0x28')](0x194);}return _0x54786a;};}function handleError(_0x3223d8,_0x4f8e58){_0x4f8e58=_0x4f8e58||0x1f4;return function(_0x134c5e){logger[_0x8b13('0x29')](_0x134c5e[_0x8b13('0x2a')]);if(_0x134c5e[_0x8b13('0x2b')]){delete _0x134c5e[_0x8b13('0x2b')];}_0x3223d8['status'](_0x4f8e58)[_0x8b13('0x2c')](_0x134c5e);};}exports[_0x8b13('0x2d')]=function(_0x3475d8,_0x1511bf){var _0x114b01={},_0x2bb51d={},_0x5ab161={'count':0x0,'rows':[]};var _0x35fdca=_[_0x8b13('0x2e')](db[_0x8b13('0x2f')][_0x8b13('0x30')],function(_0x23fde7){return{'name':_0x23fde7[_0x8b13('0x31')],'type':_0x23fde7[_0x8b13('0x32')][_0x8b13('0x33')]};});_0x2bb51d[_0x8b13('0x34')]=_['map'](_0x35fdca,_0x8b13('0x2b'));_0x2bb51d[_0x8b13('0x35')]=_[_0x8b13('0x36')](_0x3475d8[_0x8b13('0x35')]);_0x2bb51d['filters']=_['intersection'](_0x2bb51d[_0x8b13('0x34')],_0x2bb51d['query']);_0x114b01['attributes']=_[_0x8b13('0x37')](_0x2bb51d['model'],qs[_0x8b13('0x38')](_0x3475d8[_0x8b13('0x35')][_0x8b13('0x38')]));_0x114b01[_0x8b13('0x39')]=_0x114b01[_0x8b13('0x39')][_0x8b13('0x3a')]?_0x114b01[_0x8b13('0x39')]:_0x2bb51d[_0x8b13('0x34')];if(!_0x3475d8[_0x8b13('0x35')][_0x8b13('0x3b')]('nolimit')){_0x114b01[_0x8b13('0x1f')]=qs[_0x8b13('0x1f')](_0x3475d8[_0x8b13('0x35')][_0x8b13('0x1f')]);_0x114b01[_0x8b13('0x1d')]=qs[_0x8b13('0x1d')](_0x3475d8[_0x8b13('0x35')][_0x8b13('0x1d')]);}_0x114b01['order']=qs[_0x8b13('0x3c')](_0x3475d8['query'][_0x8b13('0x3c')]);_0x114b01[_0x8b13('0x3d')]=qs[_0x8b13('0x3e')](_[_0x8b13('0x3f')](_0x3475d8[_0x8b13('0x35')],_0x2bb51d[_0x8b13('0x3e')]),_0x35fdca);if(_0x3475d8['query']['filter']){_0x114b01[_0x8b13('0x3d')]=_['merge'](_0x114b01[_0x8b13('0x3d')],{'$or':_['map'](_0x35fdca,function(_0x590a23){if(_0x590a23[_0x8b13('0x32')]!==_0x8b13('0x40')){var _0x2bc877={};_0x2bc877[_0x590a23[_0x8b13('0x2b')]]={'$like':'%'+_0x3475d8['query']['filter']+'%'};return _0x2bc877;}})});}_0x114b01=_[_0x8b13('0x41')]({},_0x114b01,_0x3475d8['options']);var _0x6ba2f3={'where':_0x114b01[_0x8b13('0x3d')]};return db['SalesforceConfiguration'][_0x8b13('0x20')](_0x6ba2f3)[_0x8b13('0x26')](function(_0x35c1d6){_0x5ab161[_0x8b13('0x20')]=_0x35c1d6;if(_0x3475d8[_0x8b13('0x35')][_0x8b13('0x42')]){_0x114b01[_0x8b13('0x43')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x114b01);})['then'](function(_0x3eb3c5){_0x5ab161[_0x8b13('0x44')]=_0x3eb3c5;return _0x5ab161;})[_0x8b13('0x26')](respondWithFilteredResult(_0x1511bf,_0x114b01))[_0x8b13('0x45')](handleError(_0x1511bf,null));};exports[_0x8b13('0x46')]=function(_0x271507,_0x492f7d){var _0x4342db={'raw':![],'where':{'id':_0x271507[_0x8b13('0x47')]['id']}},_0x50e535={};_0x50e535['model']=_[_0x8b13('0x36')](db[_0x8b13('0x2f')][_0x8b13('0x30')]);_0x50e535[_0x8b13('0x35')]=_[_0x8b13('0x36')](_0x271507[_0x8b13('0x35')]);_0x50e535[_0x8b13('0x3e')]=_['intersection'](_0x50e535['model'],_0x50e535['query']);_0x4342db[_0x8b13('0x39')]=_[_0x8b13('0x37')](_0x50e535[_0x8b13('0x34')],qs[_0x8b13('0x38')](_0x271507['query']['fields']));_0x4342db[_0x8b13('0x39')]=_0x4342db['attributes'][_0x8b13('0x3a')]?_0x4342db[_0x8b13('0x39')]:_0x50e535[_0x8b13('0x34')];if(_0x271507[_0x8b13('0x35')][_0x8b13('0x42')]){_0x4342db['include']=[{'all':!![]}];}_0x4342db=_[_0x8b13('0x41')]({},_0x4342db,_0x271507[_0x8b13('0x48')]);return db[_0x8b13('0x2f')][_0x8b13('0x49')](_0x4342db)[_0x8b13('0x26')](handleEntityNotFound(_0x492f7d,null))[_0x8b13('0x26')](respondWithResult(_0x492f7d,null))[_0x8b13('0x45')](handleError(_0x492f7d,null));};exports[_0x8b13('0x4a')]=function(_0x3e192b,_0x518298){return db[_0x8b13('0x2f')]['create'](_0x3e192b[_0x8b13('0x4b')],{})[_0x8b13('0x26')](respondWithResult(_0x518298,0xc9))[_0x8b13('0x45')](handleError(_0x518298,null));};exports['update']=function(_0x148efb,_0x35f612){if(_0x148efb[_0x8b13('0x4b')]['id']){delete _0x148efb[_0x8b13('0x4b')]['id'];}return db[_0x8b13('0x2f')][_0x8b13('0x49')]({'where':{'id':_0x148efb[_0x8b13('0x47')]['id']}})['then'](handleEntityNotFound(_0x35f612,null))[_0x8b13('0x26')](saveUpdates(_0x148efb['body'],null))[_0x8b13('0x26')](respondWithResult(_0x35f612,null))[_0x8b13('0x45')](handleError(_0x35f612,null));};exports[_0x8b13('0x27')]=function(_0x435867,_0x2be640){return db[_0x8b13('0x2f')][_0x8b13('0x49')]({'where':{'id':_0x435867[_0x8b13('0x47')]['id']}})[_0x8b13('0x26')](handleEntityNotFound(_0x2be640,null))[_0x8b13('0x26')](removeEntity(_0x2be640,null))[_0x8b13('0x45')](handleError(_0x2be640,null));};exports[_0x8b13('0x4c')]=function(_0xd55f3b,_0x2bdfae,_0x42c29d){var _0x32e40e={};var _0xa1942a={};var _0x50c354;var _0x1699c6;return db[_0x8b13('0x2f')]['findOne']({'where':{'id':_0xd55f3b[_0x8b13('0x47')]['id']}})[_0x8b13('0x26')](handleEntityNotFound(_0x2bdfae,null))[_0x8b13('0x26')](function(_0x41801b){if(_0x41801b){_0x50c354=_0x41801b;_0xa1942a[_0x8b13('0x34')]=_[_0x8b13('0x36')](db[_0x8b13('0x4d')][_0x8b13('0x30')]);_0xa1942a[_0x8b13('0x35')]=_[_0x8b13('0x36')](_0xd55f3b[_0x8b13('0x35')]);_0xa1942a[_0x8b13('0x3e')]=_[_0x8b13('0x37')](_0xa1942a[_0x8b13('0x34')],_0xa1942a[_0x8b13('0x35')]);_0x32e40e['attributes']=_[_0x8b13('0x37')](_0xa1942a[_0x8b13('0x34')],qs['fields'](_0xd55f3b[_0x8b13('0x35')][_0x8b13('0x38')]));_0x32e40e[_0x8b13('0x39')]=_0x32e40e[_0x8b13('0x39')][_0x8b13('0x3a')]?_0x32e40e['attributes']:_0xa1942a[_0x8b13('0x34')];_0x32e40e[_0x8b13('0x4e')]=qs[_0x8b13('0x3c')](_0xd55f3b['query'][_0x8b13('0x3c')]);_0x32e40e[_0x8b13('0x3d')]=qs['filters'](_[_0x8b13('0x3f')](_0xd55f3b[_0x8b13('0x35')],_0xa1942a[_0x8b13('0x3e')]));if(_0xd55f3b[_0x8b13('0x35')]['filter']){_0x32e40e[_0x8b13('0x3d')]=_[_0x8b13('0x41')](_0x32e40e['where'],{'$or':_[_0x8b13('0x2e')](_0x32e40e[_0x8b13('0x39')],function(_0x311a5e){var _0x23a63c={};_0x23a63c[_0x311a5e]={'$like':'%'+_0xd55f3b['query'][_0x8b13('0x4f')]+'%'};return _0x23a63c;})});}_0x32e40e=_[_0x8b13('0x41')]({},_0x32e40e,_0xd55f3b[_0x8b13('0x48')]);return _0x50c354[_0x8b13('0x4c')](_0x32e40e);}})[_0x8b13('0x26')](function(_0x2fff4e){if(_0x2fff4e){_0x1699c6=_0x2fff4e['length'];if(!_0xd55f3b[_0x8b13('0x35')][_0x8b13('0x3b')](_0x8b13('0x50'))){_0x32e40e['limit']=qs[_0x8b13('0x1f')](_0xd55f3b[_0x8b13('0x35')][_0x8b13('0x1f')]);_0x32e40e[_0x8b13('0x1d')]=qs['offset'](_0xd55f3b['query']['offset']);}return _0x50c354['getFields'](_0x32e40e);}})['then'](function(_0x3ef91f){if(_0x3ef91f){return _0x3ef91f?{'count':_0x1699c6,'rows':_0x3ef91f}:null;}})[_0x8b13('0x26')](respondWithResult(_0x2bdfae,null))['catch'](handleError(_0x2bdfae,null));};exports[_0x8b13('0x51')]=function(_0x5c3928,_0x274bad,_0x2d2fa3){var _0x42790f={};var _0x22c4d4={};var _0x43f12a;var _0x2ff9c3;return db[_0x8b13('0x2f')]['findOne']({'where':{'id':_0x5c3928[_0x8b13('0x47')]['id']}})['then'](handleEntityNotFound(_0x274bad,null))[_0x8b13('0x26')](function(_0x2ce908){if(_0x2ce908){_0x43f12a=_0x2ce908;_0x22c4d4[_0x8b13('0x34')]=_[_0x8b13('0x36')](db[_0x8b13('0x4d')][_0x8b13('0x30')]);_0x22c4d4[_0x8b13('0x35')]=_['keys'](_0x5c3928[_0x8b13('0x35')]);_0x22c4d4['filters']=_[_0x8b13('0x37')](_0x22c4d4[_0x8b13('0x34')],_0x22c4d4[_0x8b13('0x35')]);_0x42790f[_0x8b13('0x39')]=_[_0x8b13('0x37')](_0x22c4d4['model'],qs['fields'](_0x5c3928[_0x8b13('0x35')][_0x8b13('0x38')]));_0x42790f['attributes']=_0x42790f[_0x8b13('0x39')][_0x8b13('0x3a')]?_0x42790f[_0x8b13('0x39')]:_0x22c4d4['model'];_0x42790f[_0x8b13('0x4e')]=qs[_0x8b13('0x3c')](_0x5c3928[_0x8b13('0x35')][_0x8b13('0x3c')]);_0x42790f['where']=qs[_0x8b13('0x3e')](_[_0x8b13('0x3f')](_0x5c3928['query'],_0x22c4d4[_0x8b13('0x3e')]));if(_0x5c3928[_0x8b13('0x35')][_0x8b13('0x4f')]){_0x42790f[_0x8b13('0x3d')]=_[_0x8b13('0x41')](_0x42790f[_0x8b13('0x3d')],{'$or':_[_0x8b13('0x2e')](_0x42790f[_0x8b13('0x39')],function(_0x268dd5){var _0x2cace0={};_0x2cace0[_0x268dd5]={'$like':'%'+_0x5c3928[_0x8b13('0x35')][_0x8b13('0x4f')]+'%'};return _0x2cace0;})});}_0x42790f=_[_0x8b13('0x41')]({},_0x42790f,_0x5c3928[_0x8b13('0x48')]);return _0x43f12a['getSubjects'](_0x42790f);}})[_0x8b13('0x26')](function(_0x578469){if(_0x578469){_0x2ff9c3=_0x578469[_0x8b13('0x3a')];if(!_0x5c3928[_0x8b13('0x35')][_0x8b13('0x3b')](_0x8b13('0x50'))){_0x42790f['limit']=qs['limit'](_0x5c3928[_0x8b13('0x35')][_0x8b13('0x1f')]);_0x42790f['offset']=qs[_0x8b13('0x1d')](_0x5c3928[_0x8b13('0x35')][_0x8b13('0x1d')]);}return _0x43f12a[_0x8b13('0x51')](_0x42790f);}})[_0x8b13('0x26')](function(_0x12aa48){if(_0x12aa48){return _0x12aa48?{'count':_0x2ff9c3,'rows':_0x12aa48}:null;}})[_0x8b13('0x26')](respondWithResult(_0x274bad,null))[_0x8b13('0x45')](handleError(_0x274bad,null));};exports[_0x8b13('0x52')]=function(_0x24211c,_0x48fd36,_0x2a1fd3){var _0x2e7477={};var _0x5ac2c4={};var _0x19e4c4;var _0x432979;return db['SalesforceConfiguration'][_0x8b13('0x53')]({'where':{'id':_0x24211c[_0x8b13('0x47')]['id']}})[_0x8b13('0x26')](handleEntityNotFound(_0x48fd36,null))[_0x8b13('0x26')](function(_0x2d8f50){if(_0x2d8f50){_0x19e4c4=_0x2d8f50;_0x5ac2c4[_0x8b13('0x34')]=_[_0x8b13('0x36')](db[_0x8b13('0x4d')]['rawAttributes']);_0x5ac2c4[_0x8b13('0x35')]=_[_0x8b13('0x36')](_0x24211c[_0x8b13('0x35')]);_0x5ac2c4['filters']=_[_0x8b13('0x37')](_0x5ac2c4['model'],_0x5ac2c4[_0x8b13('0x35')]);_0x2e7477[_0x8b13('0x39')]=_[_0x8b13('0x37')](_0x5ac2c4[_0x8b13('0x34')],qs[_0x8b13('0x38')](_0x24211c[_0x8b13('0x35')][_0x8b13('0x38')]));_0x2e7477[_0x8b13('0x39')]=_0x2e7477[_0x8b13('0x39')][_0x8b13('0x3a')]?_0x2e7477['attributes']:_0x5ac2c4[_0x8b13('0x34')];_0x2e7477[_0x8b13('0x4e')]=qs[_0x8b13('0x3c')](_0x24211c[_0x8b13('0x35')][_0x8b13('0x3c')]);_0x2e7477[_0x8b13('0x3d')]=qs[_0x8b13('0x3e')](_[_0x8b13('0x3f')](_0x24211c[_0x8b13('0x35')],_0x5ac2c4[_0x8b13('0x3e')]));if(_0x24211c[_0x8b13('0x35')][_0x8b13('0x4f')]){_0x2e7477[_0x8b13('0x3d')]=_['merge'](_0x2e7477['where'],{'$or':_[_0x8b13('0x2e')](_0x2e7477['attributes'],function(_0x22e10a){var _0x38a1de={};_0x38a1de[_0x22e10a]={'$like':'%'+_0x24211c['query']['filter']+'%'};return _0x38a1de;})});}_0x2e7477=_[_0x8b13('0x41')]({},_0x2e7477,_0x24211c[_0x8b13('0x48')]);return _0x19e4c4[_0x8b13('0x52')](_0x2e7477);}})[_0x8b13('0x26')](function(_0xed5531){if(_0xed5531){_0x432979=_0xed5531['length'];if(!_0x24211c[_0x8b13('0x35')]['hasOwnProperty'](_0x8b13('0x50'))){_0x2e7477[_0x8b13('0x1f')]=qs['limit'](_0x24211c[_0x8b13('0x35')][_0x8b13('0x1f')]);_0x2e7477[_0x8b13('0x1d')]=qs[_0x8b13('0x1d')](_0x24211c[_0x8b13('0x35')]['offset']);}return _0x19e4c4[_0x8b13('0x52')](_0x2e7477);}})[_0x8b13('0x26')](function(_0x471f25){if(_0x471f25){return _0x471f25?{'count':_0x432979,'rows':_0x471f25}:null;}})['then'](respondWithResult(_0x48fd36,null))[_0x8b13('0x45')](handleError(_0x48fd36,null));}; \ No newline at end of file +var _0x04fa=['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','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','filters','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','intersection','find','create','body','params','getFields','SalesforceField','pick','findOne','getSubjects','getDescriptions','options','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x16ba74,_0x2ebcfa){var _0x4333a6=function(_0x13b137){while(--_0x13b137){_0x16ba74['push'](_0x16ba74['shift']());}};_0x4333a6(++_0x2ebcfa);}(_0x04fa,0x145));var _0xa04f=function(_0x1f8125,_0xde57b){_0x1f8125=_0x1f8125-0x0;var _0x5b2f4a=_0x04fa[_0x1f8125];return _0x5b2f4a;};'use strict';var emlformat=require(_0xa04f('0x0'));var rimraf=require(_0xa04f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa04f('0x2'));var rp=require(_0xa04f('0x3'));var moment=require(_0xa04f('0x4'));var BPromise=require(_0xa04f('0x5'));var Mustache=require('mustache');var util=require(_0xa04f('0x6'));var path=require(_0xa04f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa04f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa04f('0x9'));var squel=require(_0xa04f('0xa'));var crypto=require(_0xa04f('0xb'));var jsforce=require(_0xa04f('0xc'));var deskjs=require(_0xa04f('0xd'));var toCsv=require(_0xa04f('0xe'));var querystring=require(_0xa04f('0xf'));var Papa=require(_0xa04f('0x10'));var Redis=require(_0xa04f('0x11'));var authService=require(_0xa04f('0x12'));var qs=require(_0xa04f('0x13'));var as=require(_0xa04f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa04f('0x15'))(_0xa04f('0x16'));var utils=require(_0xa04f('0x17'));var config=require(_0xa04f('0x18'));var licenseUtil=require(_0xa04f('0x19'));var db=require(_0xa04f('0x1a'))['db'];function respondWithStatusCode(_0x303c8f,_0x27b6f8){_0x27b6f8=_0x27b6f8||0xcc;return function(_0xff9c2a){if(_0xff9c2a){return _0x303c8f[_0xa04f('0x1b')](_0x27b6f8);}return _0x303c8f[_0xa04f('0x1c')](_0x27b6f8)[_0xa04f('0x1d')]();};}function respondWithResult(_0x42dbac,_0x135eae){_0x135eae=_0x135eae||0xc8;return function(_0xcac10b){if(_0xcac10b){return _0x42dbac[_0xa04f('0x1c')](_0x135eae)[_0xa04f('0x1e')](_0xcac10b);}};}function respondWithFilteredResult(_0x3ea8d0,_0x114593){return function(_0x349bed){if(_0x349bed){var _0x573a07=typeof _0x114593[_0xa04f('0x1f')]===_0xa04f('0x20')&&typeof _0x114593[_0xa04f('0x21')]===_0xa04f('0x20');var _0x230950=_0x349bed[_0xa04f('0x22')];var _0x491c30=_0x573a07?0x0:_0x114593['offset'];var _0x3e1af8=_0x573a07?_0x349bed[_0xa04f('0x22')]:_0x114593['offset']+_0x114593['limit'];var _0x24e7ff;if(_0x3e1af8>=_0x230950){_0x3e1af8=_0x230950;_0x24e7ff=0xc8;}else{_0x24e7ff=0xce;}_0x3ea8d0[_0xa04f('0x1c')](_0x24e7ff);return _0x3ea8d0[_0xa04f('0x23')]('Content-Range',_0x491c30+'-'+_0x3e1af8+'/'+_0x230950)['json'](_0x349bed);}return null;};}function patchUpdates(_0x255b1a){return function(_0x4250b2){try{jsonpatch[_0xa04f('0x24')](_0x4250b2,_0x255b1a,!![]);}catch(_0x22384a){return BPromise[_0xa04f('0x25')](_0x22384a);}return _0x4250b2[_0xa04f('0x26')]();};}function saveUpdates(_0xd020a,_0x1f649a){return function(_0x2b94a9){if(_0x2b94a9){return _0x2b94a9[_0xa04f('0x27')](_0xd020a)['then'](function(_0x3741c9){return _0x3741c9;});}return null;};}function removeEntity(_0x1c3c3e,_0x1215dd){return function(_0x375476){if(_0x375476){return _0x375476[_0xa04f('0x28')]()[_0xa04f('0x29')](function(){_0x1c3c3e[_0xa04f('0x1c')](0xcc)[_0xa04f('0x1d')]();});}};}function handleEntityNotFound(_0x169b66,_0x4092cf){return function(_0x2d64af){if(!_0x2d64af){_0x169b66[_0xa04f('0x1b')](0x194);}return _0x2d64af;};}function handleError(_0x853378,_0xe3e793){_0xe3e793=_0xe3e793||0x1f4;return function(_0x572acb){logger[_0xa04f('0x2a')](_0x572acb[_0xa04f('0x2b')]);if(_0x572acb['name']){delete _0x572acb[_0xa04f('0x2c')];}_0x853378[_0xa04f('0x1c')](_0xe3e793)[_0xa04f('0x2d')](_0x572acb);};}exports[_0xa04f('0x2e')]=function(_0x580350,_0x3e075b){var _0x523cb4={},_0x891b9b={},_0x150198={'count':0x0,'rows':[]};var _0x5622e3=_[_0xa04f('0x2f')](db[_0xa04f('0x30')][_0xa04f('0x31')],function(_0x2123e3){return{'name':_0x2123e3[_0xa04f('0x32')],'type':_0x2123e3[_0xa04f('0x33')]['key']};});_0x891b9b['model']=_['map'](_0x5622e3,_0xa04f('0x2c'));_0x891b9b['query']=_['keys'](_0x580350['query']);_0x891b9b[_0xa04f('0x34')]=_['intersection'](_0x891b9b[_0xa04f('0x35')],_0x891b9b[_0xa04f('0x36')]);_0x523cb4[_0xa04f('0x37')]=_['intersection'](_0x891b9b[_0xa04f('0x35')],qs[_0xa04f('0x38')](_0x580350[_0xa04f('0x36')][_0xa04f('0x38')]));_0x523cb4[_0xa04f('0x37')]=_0x523cb4['attributes'][_0xa04f('0x39')]?_0x523cb4['attributes']:_0x891b9b[_0xa04f('0x35')];if(!_0x580350['query'][_0xa04f('0x3a')](_0xa04f('0x3b'))){_0x523cb4[_0xa04f('0x21')]=qs['limit'](_0x580350['query']['limit']);_0x523cb4['offset']=qs[_0xa04f('0x1f')](_0x580350[_0xa04f('0x36')][_0xa04f('0x1f')]);}_0x523cb4[_0xa04f('0x3c')]=qs[_0xa04f('0x3d')](_0x580350[_0xa04f('0x36')][_0xa04f('0x3d')]);_0x523cb4[_0xa04f('0x3e')]=qs[_0xa04f('0x34')](_['pick'](_0x580350[_0xa04f('0x36')],_0x891b9b[_0xa04f('0x34')]),_0x5622e3);if(_0x580350['query'][_0xa04f('0x3f')]){_0x523cb4[_0xa04f('0x3e')]=_[_0xa04f('0x40')](_0x523cb4[_0xa04f('0x3e')],{'$or':_[_0xa04f('0x2f')](_0x5622e3,function(_0x55997e){if(_0x55997e['type']!==_0xa04f('0x41')){var _0xc7c930={};_0xc7c930[_0x55997e[_0xa04f('0x2c')]]={'$like':'%'+_0x580350['query'][_0xa04f('0x3f')]+'%'};return _0xc7c930;}})});}_0x523cb4=_[_0xa04f('0x40')]({},_0x523cb4,_0x580350['options']);var _0x19967d={'where':_0x523cb4[_0xa04f('0x3e')]};return db[_0xa04f('0x30')][_0xa04f('0x22')](_0x19967d)[_0xa04f('0x29')](function(_0x11cf63){_0x150198['count']=_0x11cf63;if(_0x580350[_0xa04f('0x36')][_0xa04f('0x42')]){_0x523cb4[_0xa04f('0x43')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xa04f('0x44')](_0x523cb4);})[_0xa04f('0x29')](function(_0x381e5b){_0x150198[_0xa04f('0x45')]=_0x381e5b;return _0x150198;})['then'](respondWithFilteredResult(_0x3e075b,_0x523cb4))[_0xa04f('0x46')](handleError(_0x3e075b,null));};exports[_0xa04f('0x47')]=function(_0xdca84c,_0x42e80c){var _0x498e3b={'raw':![],'where':{'id':_0xdca84c['params']['id']}},_0x2c9371={};_0x2c9371[_0xa04f('0x35')]=_[_0xa04f('0x48')](db['SalesforceConfiguration'][_0xa04f('0x31')]);_0x2c9371[_0xa04f('0x36')]=_[_0xa04f('0x48')](_0xdca84c[_0xa04f('0x36')]);_0x2c9371[_0xa04f('0x34')]=_[_0xa04f('0x49')](_0x2c9371[_0xa04f('0x35')],_0x2c9371[_0xa04f('0x36')]);_0x498e3b['attributes']=_['intersection'](_0x2c9371['model'],qs[_0xa04f('0x38')](_0xdca84c[_0xa04f('0x36')][_0xa04f('0x38')]));_0x498e3b[_0xa04f('0x37')]=_0x498e3b[_0xa04f('0x37')][_0xa04f('0x39')]?_0x498e3b[_0xa04f('0x37')]:_0x2c9371[_0xa04f('0x35')];if(_0xdca84c[_0xa04f('0x36')]['includeAll']){_0x498e3b['include']=[{'all':!![]}];}_0x498e3b=_[_0xa04f('0x40')]({},_0x498e3b,_0xdca84c['options']);return db[_0xa04f('0x30')][_0xa04f('0x4a')](_0x498e3b)[_0xa04f('0x29')](handleEntityNotFound(_0x42e80c,null))[_0xa04f('0x29')](respondWithResult(_0x42e80c,null))[_0xa04f('0x46')](handleError(_0x42e80c,null));};exports[_0xa04f('0x4b')]=function(_0x3f5265,_0x260d44){return db[_0xa04f('0x30')][_0xa04f('0x4b')](_0x3f5265[_0xa04f('0x4c')],{})[_0xa04f('0x29')](respondWithResult(_0x260d44,0xc9))[_0xa04f('0x46')](handleError(_0x260d44,null));};exports[_0xa04f('0x27')]=function(_0x56f6e7,_0x48c2f1){if(_0x56f6e7[_0xa04f('0x4c')]['id']){delete _0x56f6e7['body']['id'];}return db[_0xa04f('0x30')][_0xa04f('0x4a')]({'where':{'id':_0x56f6e7[_0xa04f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x48c2f1,null))['then'](saveUpdates(_0x56f6e7[_0xa04f('0x4c')],null))[_0xa04f('0x29')](respondWithResult(_0x48c2f1,null))['catch'](handleError(_0x48c2f1,null));};exports['destroy']=function(_0x1caca5,_0xa72d68){return db[_0xa04f('0x30')]['find']({'where':{'id':_0x1caca5[_0xa04f('0x4d')]['id']}})[_0xa04f('0x29')](handleEntityNotFound(_0xa72d68,null))[_0xa04f('0x29')](removeEntity(_0xa72d68,null))[_0xa04f('0x46')](handleError(_0xa72d68,null));};exports[_0xa04f('0x4e')]=function(_0x146254,_0x4ba875,_0x388747){var _0x24ab43={};var _0x8ddb84={};var _0x5ea0d5;var _0x245329;return db[_0xa04f('0x30')]['findOne']({'where':{'id':_0x146254[_0xa04f('0x4d')]['id']}})[_0xa04f('0x29')](handleEntityNotFound(_0x4ba875,null))[_0xa04f('0x29')](function(_0x2d568e){if(_0x2d568e){_0x5ea0d5=_0x2d568e;_0x8ddb84[_0xa04f('0x35')]=_[_0xa04f('0x48')](db[_0xa04f('0x4f')][_0xa04f('0x31')]);_0x8ddb84[_0xa04f('0x36')]=_['keys'](_0x146254[_0xa04f('0x36')]);_0x8ddb84[_0xa04f('0x34')]=_[_0xa04f('0x49')](_0x8ddb84[_0xa04f('0x35')],_0x8ddb84[_0xa04f('0x36')]);_0x24ab43[_0xa04f('0x37')]=_['intersection'](_0x8ddb84[_0xa04f('0x35')],qs[_0xa04f('0x38')](_0x146254[_0xa04f('0x36')][_0xa04f('0x38')]));_0x24ab43[_0xa04f('0x37')]=_0x24ab43[_0xa04f('0x37')][_0xa04f('0x39')]?_0x24ab43[_0xa04f('0x37')]:_0x8ddb84[_0xa04f('0x35')];_0x24ab43[_0xa04f('0x3c')]=qs[_0xa04f('0x3d')](_0x146254[_0xa04f('0x36')][_0xa04f('0x3d')]);_0x24ab43[_0xa04f('0x3e')]=qs[_0xa04f('0x34')](_[_0xa04f('0x50')](_0x146254[_0xa04f('0x36')],_0x8ddb84[_0xa04f('0x34')]));if(_0x146254['query'][_0xa04f('0x3f')]){_0x24ab43['where']=_[_0xa04f('0x40')](_0x24ab43[_0xa04f('0x3e')],{'$or':_[_0xa04f('0x2f')](_0x24ab43[_0xa04f('0x37')],function(_0xff5bd5){var _0x192fc2={};_0x192fc2[_0xff5bd5]={'$like':'%'+_0x146254[_0xa04f('0x36')][_0xa04f('0x3f')]+'%'};return _0x192fc2;})});}_0x24ab43=_[_0xa04f('0x40')]({},_0x24ab43,_0x146254['options']);return _0x5ea0d5[_0xa04f('0x4e')](_0x24ab43);}})['then'](function(_0x3b6a94){if(_0x3b6a94){_0x245329=_0x3b6a94[_0xa04f('0x39')];if(!_0x146254[_0xa04f('0x36')][_0xa04f('0x3a')](_0xa04f('0x3b'))){_0x24ab43['limit']=qs[_0xa04f('0x21')](_0x146254['query'][_0xa04f('0x21')]);_0x24ab43[_0xa04f('0x1f')]=qs[_0xa04f('0x1f')](_0x146254[_0xa04f('0x36')][_0xa04f('0x1f')]);}return _0x5ea0d5[_0xa04f('0x4e')](_0x24ab43);}})[_0xa04f('0x29')](function(_0x4c4030){if(_0x4c4030){return _0x4c4030?{'count':_0x245329,'rows':_0x4c4030}:null;}})[_0xa04f('0x29')](respondWithResult(_0x4ba875,null))[_0xa04f('0x46')](handleError(_0x4ba875,null));};exports['getSubjects']=function(_0x3530df,_0xa76ef4,_0x79e394){var _0x4499d1={};var _0x244826={};var _0x554d5a;var _0xe593da;return db['SalesforceConfiguration'][_0xa04f('0x51')]({'where':{'id':_0x3530df[_0xa04f('0x4d')]['id']}})[_0xa04f('0x29')](handleEntityNotFound(_0xa76ef4,null))[_0xa04f('0x29')](function(_0xfeeb36){if(_0xfeeb36){_0x554d5a=_0xfeeb36;_0x244826['model']=_[_0xa04f('0x48')](db[_0xa04f('0x4f')][_0xa04f('0x31')]);_0x244826[_0xa04f('0x36')]=_[_0xa04f('0x48')](_0x3530df[_0xa04f('0x36')]);_0x244826[_0xa04f('0x34')]=_[_0xa04f('0x49')](_0x244826[_0xa04f('0x35')],_0x244826[_0xa04f('0x36')]);_0x4499d1[_0xa04f('0x37')]=_[_0xa04f('0x49')](_0x244826[_0xa04f('0x35')],qs[_0xa04f('0x38')](_0x3530df['query']['fields']));_0x4499d1[_0xa04f('0x37')]=_0x4499d1['attributes'][_0xa04f('0x39')]?_0x4499d1[_0xa04f('0x37')]:_0x244826['model'];_0x4499d1['order']=qs[_0xa04f('0x3d')](_0x3530df[_0xa04f('0x36')][_0xa04f('0x3d')]);_0x4499d1[_0xa04f('0x3e')]=qs[_0xa04f('0x34')](_[_0xa04f('0x50')](_0x3530df[_0xa04f('0x36')],_0x244826[_0xa04f('0x34')]));if(_0x3530df[_0xa04f('0x36')][_0xa04f('0x3f')]){_0x4499d1['where']=_[_0xa04f('0x40')](_0x4499d1['where'],{'$or':_[_0xa04f('0x2f')](_0x4499d1['attributes'],function(_0x397344){var _0x20ebba={};_0x20ebba[_0x397344]={'$like':'%'+_0x3530df[_0xa04f('0x36')][_0xa04f('0x3f')]+'%'};return _0x20ebba;})});}_0x4499d1=_[_0xa04f('0x40')]({},_0x4499d1,_0x3530df['options']);return _0x554d5a[_0xa04f('0x52')](_0x4499d1);}})[_0xa04f('0x29')](function(_0x296cbe){if(_0x296cbe){_0xe593da=_0x296cbe['length'];if(!_0x3530df[_0xa04f('0x36')][_0xa04f('0x3a')](_0xa04f('0x3b'))){_0x4499d1[_0xa04f('0x21')]=qs[_0xa04f('0x21')](_0x3530df[_0xa04f('0x36')][_0xa04f('0x21')]);_0x4499d1['offset']=qs[_0xa04f('0x1f')](_0x3530df['query']['offset']);}return _0x554d5a[_0xa04f('0x52')](_0x4499d1);}})[_0xa04f('0x29')](function(_0x36edb6){if(_0x36edb6){return _0x36edb6?{'count':_0xe593da,'rows':_0x36edb6}:null;}})[_0xa04f('0x29')](respondWithResult(_0xa76ef4,null))[_0xa04f('0x46')](handleError(_0xa76ef4,null));};exports[_0xa04f('0x53')]=function(_0x6b88de,_0x37bd1e,_0x5dc392){var _0x453296={};var _0x333190={};var _0x59773e;var _0x125bda;return db[_0xa04f('0x30')][_0xa04f('0x51')]({'where':{'id':_0x6b88de[_0xa04f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x37bd1e,null))[_0xa04f('0x29')](function(_0x41e025){if(_0x41e025){_0x59773e=_0x41e025;_0x333190[_0xa04f('0x35')]=_[_0xa04f('0x48')](db['SalesforceField'][_0xa04f('0x31')]);_0x333190['query']=_['keys'](_0x6b88de[_0xa04f('0x36')]);_0x333190['filters']=_['intersection'](_0x333190[_0xa04f('0x35')],_0x333190[_0xa04f('0x36')]);_0x453296['attributes']=_['intersection'](_0x333190[_0xa04f('0x35')],qs[_0xa04f('0x38')](_0x6b88de[_0xa04f('0x36')][_0xa04f('0x38')]));_0x453296[_0xa04f('0x37')]=_0x453296[_0xa04f('0x37')][_0xa04f('0x39')]?_0x453296[_0xa04f('0x37')]:_0x333190[_0xa04f('0x35')];_0x453296[_0xa04f('0x3c')]=qs[_0xa04f('0x3d')](_0x6b88de[_0xa04f('0x36')][_0xa04f('0x3d')]);_0x453296[_0xa04f('0x3e')]=qs[_0xa04f('0x34')](_[_0xa04f('0x50')](_0x6b88de[_0xa04f('0x36')],_0x333190['filters']));if(_0x6b88de[_0xa04f('0x36')]['filter']){_0x453296['where']=_[_0xa04f('0x40')](_0x453296['where'],{'$or':_[_0xa04f('0x2f')](_0x453296[_0xa04f('0x37')],function(_0x2937ee){var _0x389f05={};_0x389f05[_0x2937ee]={'$like':'%'+_0x6b88de[_0xa04f('0x36')]['filter']+'%'};return _0x389f05;})});}_0x453296=_[_0xa04f('0x40')]({},_0x453296,_0x6b88de[_0xa04f('0x54')]);return _0x59773e[_0xa04f('0x53')](_0x453296);}})[_0xa04f('0x29')](function(_0x269542){if(_0x269542){_0x125bda=_0x269542['length'];if(!_0x6b88de['query'][_0xa04f('0x3a')](_0xa04f('0x3b'))){_0x453296[_0xa04f('0x21')]=qs[_0xa04f('0x21')](_0x6b88de[_0xa04f('0x36')][_0xa04f('0x21')]);_0x453296['offset']=qs[_0xa04f('0x1f')](_0x6b88de[_0xa04f('0x36')]['offset']);}return _0x59773e[_0xa04f('0x53')](_0x453296);}})[_0xa04f('0x29')](function(_0x5653f0){if(_0x5653f0){return _0x5653f0?{'count':_0x125bda,'rows':_0x5653f0}:null;}})['then'](respondWithResult(_0x37bd1e,null))[_0xa04f('0x46')](handleError(_0x37bd1e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 766ab01..7279069 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 _0x0b5a=['rimraf','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x182e4d,_0x1e35f5){var _0x3673e9=function(_0x55c4f9){while(--_0x55c4f9){_0x182e4d['push'](_0x182e4d['shift']());}};_0x3673e9(++_0x1e35f5);}(_0x0b5a,0x119));var _0xa0b5=function(_0x547bef,_0x27c33a){_0x547bef=_0x547bef-0x0;var _0x3cfc8f=_0x0b5a[_0x547bef];return _0x3cfc8f;};'use strict';var _=require(_0xa0b5('0x0'));var util=require(_0xa0b5('0x1'));var logger=require(_0xa0b5('0x2'))(_0xa0b5('0x3'));var moment=require(_0xa0b5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa0b5('0x5'));var fs=require('fs');var path=require(_0xa0b5('0x6'));var rimraf=require(_0xa0b5('0x7'));var config=require('../../config/environment');var attributes=require(_0xa0b5('0x8'));module[_0xa0b5('0x9')]=function(_0x4f3fdd,_0xa84b50){return _0x4f3fdd[_0xa0b5('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0xa0b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b58=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceConfiguration','lodash'];(function(_0x5e570c,_0x233990){var _0xc62527=function(_0xd18777){while(--_0xd18777){_0x5e570c['push'](_0x5e570c['shift']());}};_0xc62527(++_0x233990);}(_0x1b58,0x1ee));var _0x81b5=function(_0x46693d,_0x48bf63){_0x46693d=_0x46693d-0x0;var _0x185fcf=_0x1b58[_0x46693d];return _0x185fcf;};'use strict';var _=require(_0x81b5('0x0'));var util=require(_0x81b5('0x1'));var logger=require('../../config/logger')(_0x81b5('0x2'));var moment=require('moment');var BPromise=require(_0x81b5('0x3'));var rp=require(_0x81b5('0x4'));var fs=require('fs');var path=require(_0x81b5('0x5'));var rimraf=require(_0x81b5('0x6'));var config=require(_0x81b5('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x81b5('0x8')]=function(_0x4f306a,_0x29512f){return _0x4f306a[_0x81b5('0x9')](_0x81b5('0xa'),attributes,{'tableName':'int_salesforce_configurations','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 5e7281b..14f9675 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 _0x9277=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0x9277,0x172));var _0x7927=function(_0x5e3ac2,_0x225614){_0x5e3ac2=_0x5e3ac2-0x0;var _0x29a007=_0x9277[_0x5e3ac2];return _0x29a007;};'use strict';var _=require(_0x7927('0x0'));var util=require(_0x7927('0x1'));var moment=require(_0x7927('0x2'));var BPromise=require('bluebird');var rs=require(_0x7927('0x3'));var fs=require('fs');var Redis=require(_0x7927('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7927('0x5'));var logger=require(_0x7927('0x6'))(_0x7927('0x7'));var config=require(_0x7927('0x8'));var jayson=require(_0x7927('0x9'));var client=jayson[_0x7927('0xa')][_0x7927('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x339373,_0x4f8509,_0x1d75bc){return new BPromise(function(_0x115eb0,_0x3c4651){return client[_0x7927('0xc')](_0x339373,_0x1d75bc)[_0x7927('0xd')](function(_0x46179f){logger[_0x7927('0xe')](_0x7927('0xf'),_0x4f8509,_0x7927('0x10'));logger[_0x7927('0x11')](_0x7927('0x12'),_0x4f8509,_0x7927('0x10'),JSON[_0x7927('0x13')](_0x46179f));if(_0x46179f[_0x7927('0x14')]){if(_0x46179f[_0x7927('0x14')][_0x7927('0x15')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4f8509,_0x46179f[_0x7927('0x14')][_0x7927('0x16')]);return _0x3c4651(_0x46179f['error'][_0x7927('0x16')]);}logger[_0x7927('0x14')](_0x7927('0xf'),_0x4f8509,_0x46179f[_0x7927('0x14')][_0x7927('0x16')]);return _0x115eb0(_0x46179f[_0x7927('0x14')][_0x7927('0x16')]);}else{logger['info'](_0x7927('0xf'),_0x4f8509,'request\x20sent');_0x115eb0(_0x46179f[_0x7927('0x17')][_0x7927('0x16')]);}})[_0x7927('0x18')](function(_0x6f6bab){logger[_0x7927('0x14')](_0x7927('0xf'),_0x4f8509,_0x6f6bab);_0x3c4651(_0x6f6bab);});});} \ No newline at end of file +var _0x9e5b=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info'];(function(_0x2fd37c,_0xde537a){var _0xff5ef5=function(_0x5bae19){while(--_0x5bae19){_0x2fd37c['push'](_0x2fd37c['shift']());}};_0xff5ef5(++_0xde537a);}(_0x9e5b,0x12f));var _0xb9e5=function(_0x41022c,_0x5f1d85){_0x41022c=_0x41022c-0x0;var _0x26d10d=_0x9e5b[_0x41022c];return _0x26d10d;};'use strict';var _=require('lodash');var util=require(_0xb9e5('0x0'));var moment=require('moment');var BPromise=require(_0xb9e5('0x1'));var rs=require(_0xb9e5('0x2'));var fs=require('fs');var Redis=require(_0xb9e5('0x3'));var db=require(_0xb9e5('0x4'))['db'];var utils=require(_0xb9e5('0x5'));var logger=require(_0xb9e5('0x6'))('rpc');var config=require(_0xb9e5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb9e5('0x8')][_0xb9e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15529b,_0x35e0ce,_0x3cf59e){return new BPromise(function(_0x3865e4,_0x1de4c0){return client['request'](_0x15529b,_0x3cf59e)[_0xb9e5('0xa')](function(_0x37e97e){logger[_0xb9e5('0xb')](_0xb9e5('0xc'),_0x35e0ce,_0xb9e5('0xd'));logger['debug'](_0xb9e5('0xe'),_0x35e0ce,_0xb9e5('0xd'),JSON[_0xb9e5('0xf')](_0x37e97e));if(_0x37e97e['error']){if(_0x37e97e[_0xb9e5('0x10')][_0xb9e5('0x11')]===0x1f4){logger[_0xb9e5('0x10')](_0xb9e5('0xc'),_0x35e0ce,_0x37e97e[_0xb9e5('0x10')][_0xb9e5('0x12')]);return _0x1de4c0(_0x37e97e['error'][_0xb9e5('0x12')]);}logger[_0xb9e5('0x10')](_0xb9e5('0xc'),_0x35e0ce,_0x37e97e[_0xb9e5('0x10')][_0xb9e5('0x12')]);return _0x3865e4(_0x37e97e['error']['message']);}else{logger[_0xb9e5('0xb')](_0xb9e5('0xc'),_0x35e0ce,_0xb9e5('0xd'));_0x3865e4(_0x37e97e[_0xb9e5('0x13')][_0xb9e5('0x12')]);}})[_0xb9e5('0x14')](function(_0x4ecded){logger['error'](_0xb9e5('0xc'),_0x35e0ce,_0x4ecded);_0x1de4c0(_0x4ecded);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 0900c85..14a02cd 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 _0xc974=['show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id'];(function(_0x37cbd7,_0x5f1e94){var _0x53f7a1=function(_0x5d3a00){while(--_0x5d3a00){_0x37cbd7['push'](_0x37cbd7['shift']());}};_0x53f7a1(++_0x5f1e94);}(_0xc974,0x9b));var _0x4c97=function(_0x135521,_0x38d459){_0x135521=_0x135521-0x0;var _0x54c528=_0xc974[_0x135521];return _0x54c528;};'use strict';var multer=require(_0x4c97('0x0'));var util=require(_0x4c97('0x1'));var path=require('path');var timeout=require(_0x4c97('0x2'));var express=require(_0x4c97('0x3'));var router=express[_0x4c97('0x4')]();var fs_extra=require(_0x4c97('0x5'));var auth=require(_0x4c97('0x6'));var interaction=require(_0x4c97('0x7'));var config=require('../../config/environment');var controller=require(_0x4c97('0x8'));router[_0x4c97('0x9')]('/',auth[_0x4c97('0xa')](),controller[_0x4c97('0xb')]);router[_0x4c97('0x9')](_0x4c97('0xc'),auth[_0x4c97('0xa')](),controller[_0x4c97('0xd')]);router[_0x4c97('0xe')]('/',auth[_0x4c97('0xa')](),controller[_0x4c97('0xf')]);router[_0x4c97('0x10')](_0x4c97('0xc'),auth['isAuthenticated'](),controller[_0x4c97('0x11')]);router[_0x4c97('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4c97('0x13')]);module[_0x4c97('0x14')]=router; \ No newline at end of file +var _0x62b2=['../../config/environment','get','index','isAuthenticated','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2222fe,_0x3be5a5){var _0x22304f=function(_0x41df2d){while(--_0x41df2d){_0x2222fe['push'](_0x2222fe['shift']());}};_0x22304f(++_0x3be5a5);}(_0x62b2,0xdc));var _0x262b=function(_0x48f7e3,_0x46d7cc){_0x48f7e3=_0x48f7e3-0x0;var _0x2459d7=_0x62b2[_0x48f7e3];return _0x2459d7;};'use strict';var multer=require(_0x262b('0x0'));var util=require(_0x262b('0x1'));var path=require(_0x262b('0x2'));var timeout=require(_0x262b('0x3'));var express=require(_0x262b('0x4'));var router=express[_0x262b('0x5')]();var fs_extra=require(_0x262b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x262b('0x7'));var config=require(_0x262b('0x8'));var controller=require('./intSalesforceField.controller');router[_0x262b('0x9')]('/',auth['isAuthenticated'](),controller[_0x262b('0xa')]);router['get']('/:id',auth[_0x262b('0xb')](),controller[_0x262b('0xc')]);router['post']('/',auth[_0x262b('0xb')](),controller['create']);router[_0x262b('0xd')](_0x262b('0xe'),auth[_0x262b('0xb')](),controller[_0x262b('0xf')]);router[_0x262b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x262b('0x11')]);module[_0x262b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 0d0c073..73f7f1d 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 _0xf828=['string','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM'];(function(_0x4f240d,_0x13a89a){var _0x5b92cc=function(_0x33fb91){while(--_0x33fb91){_0x4f240d['push'](_0x4f240d['shift']());}};_0x5b92cc(++_0x13a89a);}(_0xf828,0x6d));var _0x8f82=function(_0x3c9e44,_0x1c24cd){_0x3c9e44=_0x3c9e44-0x0;var _0x2b6b1f=_0xf828[_0x3c9e44];return _0x2b6b1f;};'use strict';var Sequelize=require(_0x8f82('0x0'));module[_0x8f82('0x1')]={'type':{'type':Sequelize[_0x8f82('0x2')](_0x8f82('0x3'),'variable',_0x8f82('0x4'),_0x8f82('0x5'),_0x8f82('0x6')),'defaultValue':_0x8f82('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8f82('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x8f82('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x8f82('0x7')]},'idField':{'type':Sequelize[_0x8f82('0x7')]},'variableName':{'type':Sequelize[_0x8f82('0x7')]}}; \ No newline at end of file +var _0x17b9=['string','variable','picklist','STRING','sequelize','exports','ENUM'];(function(_0x3cdee4,_0xfad487){var _0x35634b=function(_0x37372b){while(--_0x37372b){_0x3cdee4['push'](_0x3cdee4['shift']());}};_0x35634b(++_0xfad487);}(_0x17b9,0x18c));var _0x917b=function(_0x131abd,_0x4d8a17){_0x131abd=_0x131abd-0x0;var _0x49eb22=_0x17b9[_0x131abd];return _0x49eb22;};'use strict';var Sequelize=require(_0x917b('0x0'));module[_0x917b('0x1')]={'type':{'type':Sequelize[_0x917b('0x2')](_0x917b('0x3'),_0x917b('0x4'),'customVariable','keyValue',_0x917b('0x5')),'defaultValue':_0x917b('0x3')},'content':{'type':Sequelize[_0x917b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x917b('0x3'),_0x917b('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x917b('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x917b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 26c20ac..0ea8ba1 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 _0x4182=['apply','reject','update','then','destroy','error','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','model','query','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','SalesforceField','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','json'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x4182,0x15b));var _0x2418=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0x4182[_0x1064bc];return _0x5edc45;};'use strict';var emlformat=require(_0x2418('0x0'));var rimraf=require(_0x2418('0x1'));var zipdir=require(_0x2418('0x2'));var jsonpatch=require(_0x2418('0x3'));var rp=require(_0x2418('0x4'));var moment=require(_0x2418('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2418('0x6'));var util=require(_0x2418('0x7'));var path=require('path');var sox=require(_0x2418('0x8'));var csv=require(_0x2418('0x9'));var ejs=require(_0x2418('0xa'));var fs=require('fs');var fs_extra=require(_0x2418('0xb'));var _=require(_0x2418('0xc'));var squel=require(_0x2418('0xd'));var crypto=require(_0x2418('0xe'));var jsforce=require(_0x2418('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2418('0x10'));var Papa=require(_0x2418('0x11'));var Redis=require(_0x2418('0x12'));var authService=require(_0x2418('0x13'));var qs=require(_0x2418('0x14'));var as=require(_0x2418('0x15'));var hardwareService=require(_0x2418('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2418('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b7836,_0x4e5bd9){_0x4e5bd9=_0x4e5bd9||0xcc;return function(_0xc376a7){if(_0xc376a7){return _0x2b7836[_0x2418('0x18')](_0x4e5bd9);}return _0x2b7836[_0x2418('0x19')](_0x4e5bd9)[_0x2418('0x1a')]();};}function respondWithResult(_0x4a8c76,_0x4fdbc8){_0x4fdbc8=_0x4fdbc8||0xc8;return function(_0xe15f25){if(_0xe15f25){return _0x4a8c76[_0x2418('0x19')](_0x4fdbc8)['json'](_0xe15f25);}};}function respondWithFilteredResult(_0x159074,_0x3bfa49){return function(_0x4004f7){if(_0x4004f7){var _0x3f0d6b=typeof _0x3bfa49[_0x2418('0x1b')]===_0x2418('0x1c')&&typeof _0x3bfa49[_0x2418('0x1d')]===_0x2418('0x1c');var _0x5e0489=_0x4004f7[_0x2418('0x1e')];var _0x226a88=_0x3f0d6b?0x0:_0x3bfa49[_0x2418('0x1b')];var _0x4ef4b8=_0x3f0d6b?_0x4004f7[_0x2418('0x1e')]:_0x3bfa49[_0x2418('0x1b')]+_0x3bfa49[_0x2418('0x1d')];var _0x107fe5;if(_0x4ef4b8>=_0x5e0489){_0x4ef4b8=_0x5e0489;_0x107fe5=0xc8;}else{_0x107fe5=0xce;}_0x159074[_0x2418('0x19')](_0x107fe5);return _0x159074[_0x2418('0x1f')]('Content-Range',_0x226a88+'-'+_0x4ef4b8+'/'+_0x5e0489)[_0x2418('0x20')](_0x4004f7);}return null;};}function patchUpdates(_0x33d596){return function(_0x3ab6a4){try{jsonpatch[_0x2418('0x21')](_0x3ab6a4,_0x33d596,!![]);}catch(_0x346609){return BPromise[_0x2418('0x22')](_0x346609);}return _0x3ab6a4['save']();};}function saveUpdates(_0x2f726b,_0x755f92){return function(_0x61adc3){if(_0x61adc3){return _0x61adc3[_0x2418('0x23')](_0x2f726b)[_0x2418('0x24')](function(_0x5c1434){return _0x5c1434;});}return null;};}function removeEntity(_0x3dea51,_0x3beb9e){return function(_0x5b70da){if(_0x5b70da){return _0x5b70da[_0x2418('0x25')]()[_0x2418('0x24')](function(){_0x3dea51[_0x2418('0x19')](0xcc)[_0x2418('0x1a')]();});}};}function handleEntityNotFound(_0x3f9427,_0x1aff66){return function(_0x5c583a){if(!_0x5c583a){_0x3f9427[_0x2418('0x18')](0x194);}return _0x5c583a;};}function handleError(_0x2badd1,_0x24412f){_0x24412f=_0x24412f||0x1f4;return function(_0x2058f0){logger[_0x2418('0x26')](_0x2058f0['stack']);if(_0x2058f0[_0x2418('0x27')]){delete _0x2058f0[_0x2418('0x27')];}_0x2badd1[_0x2418('0x19')](_0x24412f)[_0x2418('0x28')](_0x2058f0);};}exports[_0x2418('0x29')]=function(_0x42bbbe,_0x5a7f2f){var _0x449618={},_0xbac7ae={},_0x19ced8={'count':0x0,'rows':[]};var _0x29d96e=_['map'](db['SalesforceField'][_0x2418('0x2a')],function(_0x302ff9){return{'name':_0x302ff9[_0x2418('0x2b')],'type':_0x302ff9['type'][_0x2418('0x2c')]};});_0xbac7ae['model']=_[_0x2418('0x2d')](_0x29d96e,'name');_0xbac7ae['query']=_[_0x2418('0x2e')](_0x42bbbe['query']);_0xbac7ae[_0x2418('0x2f')]=_[_0x2418('0x30')](_0xbac7ae[_0x2418('0x31')],_0xbac7ae[_0x2418('0x32')]);_0x449618[_0x2418('0x33')]=_[_0x2418('0x30')](_0xbac7ae[_0x2418('0x31')],qs['fields'](_0x42bbbe['query']['fields']));_0x449618['attributes']=_0x449618[_0x2418('0x33')][_0x2418('0x34')]?_0x449618[_0x2418('0x33')]:_0xbac7ae[_0x2418('0x31')];if(!_0x42bbbe[_0x2418('0x32')][_0x2418('0x35')](_0x2418('0x36'))){_0x449618[_0x2418('0x1d')]=qs[_0x2418('0x1d')](_0x42bbbe[_0x2418('0x32')][_0x2418('0x1d')]);_0x449618[_0x2418('0x1b')]=qs[_0x2418('0x1b')](_0x42bbbe[_0x2418('0x32')][_0x2418('0x1b')]);}_0x449618[_0x2418('0x37')]=qs[_0x2418('0x38')](_0x42bbbe[_0x2418('0x32')][_0x2418('0x38')]);_0x449618['where']=qs[_0x2418('0x2f')](_[_0x2418('0x39')](_0x42bbbe[_0x2418('0x32')],_0xbac7ae[_0x2418('0x2f')]),_0x29d96e);if(_0x42bbbe[_0x2418('0x32')][_0x2418('0x3a')]){_0x449618['where']=_[_0x2418('0x3b')](_0x449618[_0x2418('0x3c')],{'$or':_[_0x2418('0x2d')](_0x29d96e,function(_0x58420f){if(_0x58420f[_0x2418('0x3d')]!==_0x2418('0x3e')){var _0x4cf359={};_0x4cf359[_0x58420f['name']]={'$like':'%'+_0x42bbbe[_0x2418('0x32')][_0x2418('0x3a')]+'%'};return _0x4cf359;}})});}_0x449618=_[_0x2418('0x3b')]({},_0x449618,_0x42bbbe[_0x2418('0x3f')]);var _0x49da60={'where':_0x449618[_0x2418('0x3c')]};return db[_0x2418('0x40')][_0x2418('0x1e')](_0x49da60)[_0x2418('0x24')](function(_0x3b7c7f){_0x19ced8[_0x2418('0x1e')]=_0x3b7c7f;if(_0x42bbbe[_0x2418('0x32')][_0x2418('0x41')]){_0x449618[_0x2418('0x42')]=[{'all':!![]}];}return db[_0x2418('0x40')][_0x2418('0x43')](_0x449618);})[_0x2418('0x24')](function(_0x2f6618){_0x19ced8[_0x2418('0x44')]=_0x2f6618;return _0x19ced8;})[_0x2418('0x24')](respondWithFilteredResult(_0x5a7f2f,_0x449618))[_0x2418('0x45')](handleError(_0x5a7f2f,null));};exports[_0x2418('0x46')]=function(_0xe8d9a3,_0xb3be5b){var _0x2f9e5a={'raw':!![],'where':{'id':_0xe8d9a3[_0x2418('0x47')]['id']}},_0x3953dc={};_0x3953dc[_0x2418('0x31')]=_[_0x2418('0x2e')](db['SalesforceField']['rawAttributes']);_0x3953dc[_0x2418('0x32')]=_['keys'](_0xe8d9a3[_0x2418('0x32')]);_0x3953dc[_0x2418('0x2f')]=_['intersection'](_0x3953dc[_0x2418('0x31')],_0x3953dc[_0x2418('0x32')]);_0x2f9e5a[_0x2418('0x33')]=_[_0x2418('0x30')](_0x3953dc['model'],qs[_0x2418('0x48')](_0xe8d9a3[_0x2418('0x32')][_0x2418('0x48')]));_0x2f9e5a[_0x2418('0x33')]=_0x2f9e5a[_0x2418('0x33')][_0x2418('0x34')]?_0x2f9e5a[_0x2418('0x33')]:_0x3953dc[_0x2418('0x31')];if(_0xe8d9a3[_0x2418('0x32')][_0x2418('0x41')]){_0x2f9e5a['include']=[{'all':!![]}];}_0x2f9e5a=_['merge']({},_0x2f9e5a,_0xe8d9a3[_0x2418('0x3f')]);return db[_0x2418('0x40')][_0x2418('0x49')](_0x2f9e5a)[_0x2418('0x24')](handleEntityNotFound(_0xb3be5b,null))[_0x2418('0x24')](respondWithResult(_0xb3be5b,null))[_0x2418('0x45')](handleError(_0xb3be5b,null));};exports[_0x2418('0x4a')]=function(_0x35c9af,_0x3ba3e1){return db[_0x2418('0x40')][_0x2418('0x4a')](_0x35c9af[_0x2418('0x4b')],{})[_0x2418('0x24')](respondWithResult(_0x3ba3e1,0xc9))['catch'](handleError(_0x3ba3e1,null));};exports['update']=function(_0x3e2b58,_0x4697fe){if(_0x3e2b58[_0x2418('0x4b')]['id']){delete _0x3e2b58[_0x2418('0x4b')]['id'];}return db['SalesforceField'][_0x2418('0x49')]({'where':{'id':_0x3e2b58[_0x2418('0x47')]['id']}})['then'](handleEntityNotFound(_0x4697fe,null))[_0x2418('0x24')](saveUpdates(_0x3e2b58[_0x2418('0x4b')],null))[_0x2418('0x24')](respondWithResult(_0x4697fe,null))[_0x2418('0x45')](handleError(_0x4697fe,null));};exports['destroy']=function(_0x5c579b,_0x3147a3){return db[_0x2418('0x40')][_0x2418('0x49')]({'where':{'id':_0x5c579b[_0x2418('0x47')]['id']}})[_0x2418('0x24')](handleEntityNotFound(_0x3147a3,null))['then'](removeEntity(_0x3147a3,null))[_0x2418('0x45')](handleError(_0x3147a3,null));}; \ No newline at end of file +var _0x6e2e=['../../config/license/hardware','../../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','error','name','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','keys','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6e2e,0xcc));var _0xe6e2=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0x6e2e[_0x38c699];return _0x3b1ded;};'use strict';var emlformat=require(_0xe6e2('0x0'));var rimraf=require(_0xe6e2('0x1'));var zipdir=require(_0xe6e2('0x2'));var jsonpatch=require(_0xe6e2('0x3'));var rp=require(_0xe6e2('0x4'));var moment=require(_0xe6e2('0x5'));var BPromise=require(_0xe6e2('0x6'));var Mustache=require('mustache');var util=require(_0xe6e2('0x7'));var path=require(_0xe6e2('0x8'));var sox=require(_0xe6e2('0x9'));var csv=require('to-csv');var ejs=require(_0xe6e2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe6e2('0xb'));var crypto=require(_0xe6e2('0xc'));var jsforce=require(_0xe6e2('0xd'));var deskjs=require(_0xe6e2('0xe'));var toCsv=require(_0xe6e2('0xf'));var querystring=require(_0xe6e2('0x10'));var Papa=require(_0xe6e2('0x11'));var Redis=require(_0xe6e2('0x12'));var authService=require(_0xe6e2('0x13'));var qs=require(_0xe6e2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6e2('0x15'));var logger=require(_0xe6e2('0x16'))(_0xe6e2('0x17'));var utils=require('../../config/utils');var config=require(_0xe6e2('0x18'));var licenseUtil=require(_0xe6e2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b294d,_0x3d6be8){_0x3d6be8=_0x3d6be8||0xcc;return function(_0xfe8a72){if(_0xfe8a72){return _0x1b294d[_0xe6e2('0x1a')](_0x3d6be8);}return _0x1b294d[_0xe6e2('0x1b')](_0x3d6be8)[_0xe6e2('0x1c')]();};}function respondWithResult(_0x252960,_0x1cf4df){_0x1cf4df=_0x1cf4df||0xc8;return function(_0x69f30f){if(_0x69f30f){return _0x252960[_0xe6e2('0x1b')](_0x1cf4df)['json'](_0x69f30f);}};}function respondWithFilteredResult(_0x35d3b6,_0x4d8fef){return function(_0x3c2dd2){if(_0x3c2dd2){var _0x1cc027=typeof _0x4d8fef[_0xe6e2('0x1d')]===_0xe6e2('0x1e')&&typeof _0x4d8fef[_0xe6e2('0x1f')]===_0xe6e2('0x1e');var _0x4799d8=_0x3c2dd2['count'];var _0xb44f6d=_0x1cc027?0x0:_0x4d8fef[_0xe6e2('0x1d')];var _0x2cb45f=_0x1cc027?_0x3c2dd2[_0xe6e2('0x20')]:_0x4d8fef[_0xe6e2('0x1d')]+_0x4d8fef[_0xe6e2('0x1f')];var _0x10666e;if(_0x2cb45f>=_0x4799d8){_0x2cb45f=_0x4799d8;_0x10666e=0xc8;}else{_0x10666e=0xce;}_0x35d3b6['status'](_0x10666e);return _0x35d3b6[_0xe6e2('0x21')](_0xe6e2('0x22'),_0xb44f6d+'-'+_0x2cb45f+'/'+_0x4799d8)[_0xe6e2('0x23')](_0x3c2dd2);}return null;};}function patchUpdates(_0x58515b){return function(_0x4bbe0e){try{jsonpatch[_0xe6e2('0x24')](_0x4bbe0e,_0x58515b,!![]);}catch(_0x547e44){return BPromise[_0xe6e2('0x25')](_0x547e44);}return _0x4bbe0e[_0xe6e2('0x26')]();};}function saveUpdates(_0x13f882,_0x32ffe2){return function(_0xfff3b2){if(_0xfff3b2){return _0xfff3b2[_0xe6e2('0x27')](_0x13f882)[_0xe6e2('0x28')](function(_0x213ea7){return _0x213ea7;});}return null;};}function removeEntity(_0x246ccc,_0xcf3089){return function(_0x1164b9){if(_0x1164b9){return _0x1164b9[_0xe6e2('0x29')]()['then'](function(){_0x246ccc[_0xe6e2('0x1b')](0xcc)[_0xe6e2('0x1c')]();});}};}function handleEntityNotFound(_0x1c7ec3,_0x3f0e81){return function(_0x595f7f){if(!_0x595f7f){_0x1c7ec3[_0xe6e2('0x1a')](0x194);}return _0x595f7f;};}function handleError(_0x40bfa1,_0x137e53){_0x137e53=_0x137e53||0x1f4;return function(_0x2cf91a){logger[_0xe6e2('0x2a')](_0x2cf91a['stack']);if(_0x2cf91a['name']){delete _0x2cf91a[_0xe6e2('0x2b')];}_0x40bfa1['status'](_0x137e53)['send'](_0x2cf91a);};}exports['index']=function(_0x3f982e,_0x47742c){var _0x1c1c21={},_0x3fc6b7={},_0x5b07dd={'count':0x0,'rows':[]};var _0x4c0b15=_[_0xe6e2('0x2c')](db[_0xe6e2('0x2d')][_0xe6e2('0x2e')],function(_0x231973){return{'name':_0x231973[_0xe6e2('0x2f')],'type':_0x231973[_0xe6e2('0x30')][_0xe6e2('0x31')]};});_0x3fc6b7[_0xe6e2('0x32')]=_[_0xe6e2('0x2c')](_0x4c0b15,_0xe6e2('0x2b'));_0x3fc6b7[_0xe6e2('0x33')]=_['keys'](_0x3f982e['query']);_0x3fc6b7[_0xe6e2('0x34')]=_[_0xe6e2('0x35')](_0x3fc6b7[_0xe6e2('0x32')],_0x3fc6b7[_0xe6e2('0x33')]);_0x1c1c21[_0xe6e2('0x36')]=_[_0xe6e2('0x35')](_0x3fc6b7[_0xe6e2('0x32')],qs[_0xe6e2('0x37')](_0x3f982e[_0xe6e2('0x33')][_0xe6e2('0x37')]));_0x1c1c21[_0xe6e2('0x36')]=_0x1c1c21['attributes'][_0xe6e2('0x38')]?_0x1c1c21[_0xe6e2('0x36')]:_0x3fc6b7[_0xe6e2('0x32')];if(!_0x3f982e[_0xe6e2('0x33')][_0xe6e2('0x39')](_0xe6e2('0x3a'))){_0x1c1c21[_0xe6e2('0x1f')]=qs[_0xe6e2('0x1f')](_0x3f982e[_0xe6e2('0x33')]['limit']);_0x1c1c21['offset']=qs[_0xe6e2('0x1d')](_0x3f982e[_0xe6e2('0x33')][_0xe6e2('0x1d')]);}_0x1c1c21['order']=qs['sort'](_0x3f982e[_0xe6e2('0x33')][_0xe6e2('0x3b')]);_0x1c1c21[_0xe6e2('0x3c')]=qs[_0xe6e2('0x34')](_[_0xe6e2('0x3d')](_0x3f982e[_0xe6e2('0x33')],_0x3fc6b7[_0xe6e2('0x34')]),_0x4c0b15);if(_0x3f982e[_0xe6e2('0x33')][_0xe6e2('0x3e')]){_0x1c1c21['where']=_[_0xe6e2('0x3f')](_0x1c1c21[_0xe6e2('0x3c')],{'$or':_['map'](_0x4c0b15,function(_0x50bd5d){if(_0x50bd5d['type']!==_0xe6e2('0x40')){var _0x4bd6d9={};_0x4bd6d9[_0x50bd5d['name']]={'$like':'%'+_0x3f982e[_0xe6e2('0x33')]['filter']+'%'};return _0x4bd6d9;}})});}_0x1c1c21=_[_0xe6e2('0x3f')]({},_0x1c1c21,_0x3f982e['options']);var _0x439b9b={'where':_0x1c1c21[_0xe6e2('0x3c')]};return db[_0xe6e2('0x2d')]['count'](_0x439b9b)[_0xe6e2('0x28')](function(_0x21e823){_0x5b07dd[_0xe6e2('0x20')]=_0x21e823;if(_0x3f982e['query']['includeAll']){_0x1c1c21[_0xe6e2('0x41')]=[{'all':!![]}];}return db[_0xe6e2('0x2d')][_0xe6e2('0x42')](_0x1c1c21);})[_0xe6e2('0x28')](function(_0x3d3bf3){_0x5b07dd['rows']=_0x3d3bf3;return _0x5b07dd;})[_0xe6e2('0x28')](respondWithFilteredResult(_0x47742c,_0x1c1c21))['catch'](handleError(_0x47742c,null));};exports[_0xe6e2('0x43')]=function(_0x211171,_0x21861c){var _0x1dede3={'raw':!![],'where':{'id':_0x211171[_0xe6e2('0x44')]['id']}},_0x347f3e={};_0x347f3e[_0xe6e2('0x32')]=_[_0xe6e2('0x45')](db[_0xe6e2('0x2d')][_0xe6e2('0x2e')]);_0x347f3e[_0xe6e2('0x33')]=_[_0xe6e2('0x45')](_0x211171[_0xe6e2('0x33')]);_0x347f3e[_0xe6e2('0x34')]=_['intersection'](_0x347f3e[_0xe6e2('0x32')],_0x347f3e[_0xe6e2('0x33')]);_0x1dede3[_0xe6e2('0x36')]=_['intersection'](_0x347f3e[_0xe6e2('0x32')],qs[_0xe6e2('0x37')](_0x211171[_0xe6e2('0x33')]['fields']));_0x1dede3[_0xe6e2('0x36')]=_0x1dede3['attributes']['length']?_0x1dede3[_0xe6e2('0x36')]:_0x347f3e[_0xe6e2('0x32')];if(_0x211171[_0xe6e2('0x33')]['includeAll']){_0x1dede3['include']=[{'all':!![]}];}_0x1dede3=_['merge']({},_0x1dede3,_0x211171[_0xe6e2('0x46')]);return db['SalesforceField'][_0xe6e2('0x47')](_0x1dede3)[_0xe6e2('0x28')](handleEntityNotFound(_0x21861c,null))[_0xe6e2('0x28')](respondWithResult(_0x21861c,null))[_0xe6e2('0x48')](handleError(_0x21861c,null));};exports[_0xe6e2('0x49')]=function(_0x27d144,_0x3839c1){return db['SalesforceField'][_0xe6e2('0x49')](_0x27d144['body'],{})[_0xe6e2('0x28')](respondWithResult(_0x3839c1,0xc9))[_0xe6e2('0x48')](handleError(_0x3839c1,null));};exports[_0xe6e2('0x27')]=function(_0x2181fc,_0x4f1ded){if(_0x2181fc[_0xe6e2('0x4a')]['id']){delete _0x2181fc['body']['id'];}return db[_0xe6e2('0x2d')][_0xe6e2('0x47')]({'where':{'id':_0x2181fc[_0xe6e2('0x44')]['id']}})[_0xe6e2('0x28')](handleEntityNotFound(_0x4f1ded,null))[_0xe6e2('0x28')](saveUpdates(_0x2181fc[_0xe6e2('0x4a')],null))[_0xe6e2('0x28')](respondWithResult(_0x4f1ded,null))[_0xe6e2('0x48')](handleError(_0x4f1ded,null));};exports[_0xe6e2('0x29')]=function(_0x2903ba,_0x101e2b){return db[_0xe6e2('0x2d')][_0xe6e2('0x47')]({'where':{'id':_0x2903ba['params']['id']}})[_0xe6e2('0x28')](handleEntityNotFound(_0x101e2b,null))['then'](removeEntity(_0x101e2b,null))[_0xe6e2('0x48')](handleError(_0x101e2b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index ebe86cd..6bac91e 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 _0xba76=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0xba76,0x1cb));var _0x6ba7=function(_0x376f50,_0x1b6855){_0x376f50=_0x376f50-0x0;var _0x1c5f2e=_0xba76[_0x376f50];return _0x1c5f2e;};'use strict';var _=require(_0x6ba7('0x0'));var util=require(_0x6ba7('0x1'));var logger=require(_0x6ba7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ba7('0x3'));var rp=require(_0x6ba7('0x4'));var fs=require('fs');var path=require(_0x6ba7('0x5'));var rimraf=require(_0x6ba7('0x6'));var config=require(_0x6ba7('0x7'));var attributes=require(_0x6ba7('0x8'));module[_0x6ba7('0x9')]=function(_0x353c60,_0x386945){return _0x353c60[_0x6ba7('0xa')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x6ba7('0xb'),'fields':[_0x6ba7('0xc'),_0x6ba7('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3111=['request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','idField','FieldId','lodash','../../config/logger','api','bluebird'];(function(_0x4b0f70,_0x1a5f81){var _0x1bd81f=function(_0x4bce22){while(--_0x4bce22){_0x4b0f70['push'](_0x4b0f70['shift']());}};_0x1bd81f(++_0x1a5f81);}(_0x3111,0x130));var _0x1311=function(_0x40538d,_0x291ee3){_0x40538d=_0x40538d-0x0;var _0x2fdbb8=_0x3111[_0x40538d];return _0x2fdbb8;};'use strict';var _=require(_0x1311('0x0'));var util=require('util');var logger=require(_0x1311('0x1'))(_0x1311('0x2'));var moment=require('moment');var BPromise=require(_0x1311('0x3'));var rp=require(_0x1311('0x4'));var fs=require('fs');var path=require(_0x1311('0x5'));var rimraf=require(_0x1311('0x6'));var config=require('../../config/environment');var attributes=require(_0x1311('0x7'));module[_0x1311('0x8')]=function(_0x559481,_0x2c3659){return _0x559481[_0x1311('0x9')](_0x1311('0xa'),attributes,{'tableName':_0x1311('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x1311('0xc'),_0x1311('0xd')],'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 33843e9..6905c93 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 _0xff46=['util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash'];(function(_0x1d7e86,_0x29e0b3){var _0x4ba5bb=function(_0x34884a){while(--_0x34884a){_0x1d7e86['push'](_0x1d7e86['shift']());}};_0x4ba5bb(++_0x29e0b3);}(_0xff46,0xf6));var _0x6ff4=function(_0x3039e0,_0x155469){_0x3039e0=_0x3039e0-0x0;var _0x3d817f=_0xff46[_0x3039e0];return _0x3d817f;};'use strict';var _=require(_0x6ff4('0x0'));var util=require(_0x6ff4('0x1'));var moment=require(_0x6ff4('0x2'));var BPromise=require(_0x6ff4('0x3'));var rs=require(_0x6ff4('0x4'));var fs=require('fs');var Redis=require(_0x6ff4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ff4('0x6'))('rpc');var config=require(_0x6ff4('0x7'));var jayson=require(_0x6ff4('0x8'));var client=jayson[_0x6ff4('0x9')][_0x6ff4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcdd8a2,_0x18ead2,_0x30dc86){return new BPromise(function(_0xdd6bd6,_0x3251e2){return client['request'](_0xcdd8a2,_0x30dc86)['then'](function(_0x1462d5){logger[_0x6ff4('0xb')](_0x6ff4('0xc'),_0x18ead2,_0x6ff4('0xd'));logger[_0x6ff4('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x18ead2,_0x6ff4('0xd'),JSON[_0x6ff4('0xf')](_0x1462d5));if(_0x1462d5[_0x6ff4('0x10')]){if(_0x1462d5['error'][_0x6ff4('0x11')]===0x1f4){logger[_0x6ff4('0x10')](_0x6ff4('0xc'),_0x18ead2,_0x1462d5[_0x6ff4('0x10')]['message']);return _0x3251e2(_0x1462d5[_0x6ff4('0x10')][_0x6ff4('0x12')]);}logger[_0x6ff4('0x10')](_0x6ff4('0xc'),_0x18ead2,_0x1462d5[_0x6ff4('0x10')]['message']);return _0xdd6bd6(_0x1462d5[_0x6ff4('0x10')][_0x6ff4('0x12')]);}else{logger['info'](_0x6ff4('0xc'),_0x18ead2,_0x6ff4('0xd'));_0xdd6bd6(_0x1462d5['result'][_0x6ff4('0x12')]);}})['catch'](function(_0x4a4323){logger[_0x6ff4('0x10')](_0x6ff4('0xc'),_0x18ead2,_0x4a4323);_0x3251e2(_0x4a4323);});});} \ No newline at end of file +var _0x8a3d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x2bdf04,_0x5e608e){var _0x33ce04=function(_0x357c41){while(--_0x357c41){_0x2bdf04['push'](_0x2bdf04['shift']());}};_0x33ce04(++_0x5e608e);}(_0x8a3d,0xff));var _0xd8a3=function(_0x5f1e7b,_0x10b34a){_0x5f1e7b=_0x5f1e7b-0x0;var _0x5bbb10=_0x8a3d[_0x5f1e7b];return _0x5bbb10;};'use strict';var _=require(_0xd8a3('0x0'));var util=require(_0xd8a3('0x1'));var moment=require(_0xd8a3('0x2'));var BPromise=require(_0xd8a3('0x3'));var rs=require(_0xd8a3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8a3('0x5'))['db'];var utils=require(_0xd8a3('0x6'));var logger=require(_0xd8a3('0x7'))(_0xd8a3('0x8'));var config=require(_0xd8a3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd8a3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x397763,_0x46d08e,_0x472995){return new BPromise(function(_0x5672a8,_0xf809df){return client['request'](_0x397763,_0x472995)[_0xd8a3('0xb')](function(_0x53b0d0){logger['info'](_0xd8a3('0xc'),_0x46d08e,_0xd8a3('0xd'));logger[_0xd8a3('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x46d08e,'request\x20sent',JSON[_0xd8a3('0xf')](_0x53b0d0));if(_0x53b0d0[_0xd8a3('0x10')]){if(_0x53b0d0[_0xd8a3('0x10')]['code']===0x1f4){logger[_0xd8a3('0x10')](_0xd8a3('0xc'),_0x46d08e,_0x53b0d0[_0xd8a3('0x10')]['message']);return _0xf809df(_0x53b0d0[_0xd8a3('0x10')][_0xd8a3('0x11')]);}logger[_0xd8a3('0x10')](_0xd8a3('0xc'),_0x46d08e,_0x53b0d0[_0xd8a3('0x10')][_0xd8a3('0x11')]);return _0x5672a8(_0x53b0d0['error'][_0xd8a3('0x11')]);}else{logger[_0xd8a3('0x12')](_0xd8a3('0xc'),_0x46d08e,_0xd8a3('0xd'));_0x5672a8(_0x53b0d0[_0xd8a3('0x13')]['message']);}})['catch'](function(_0x4b83fa){logger[_0xd8a3('0x10')](_0xd8a3('0xc'),_0x46d08e,_0x4b83fa);_0xf809df(_0x4b83fa);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 0a44e6e..892a1ce 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 _0xbe85=['update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','create','addConfiguration'];(function(_0x514ff8,_0x163d60){var _0x4ad44a=function(_0x69c24){while(--_0x69c24){_0x514ff8['push'](_0x514ff8['shift']());}};_0x4ad44a(++_0x163d60);}(_0xbe85,0x19c));var _0x5be8=function(_0x450464,_0x29aa58){_0x450464=_0x450464-0x0;var _0x32ce0f=_0xbe85[_0x450464];return _0x32ce0f;};'use strict';var multer=require(_0x5be8('0x0'));var util=require(_0x5be8('0x1'));var path=require(_0x5be8('0x2'));var timeout=require('connect-timeout');var express=require(_0x5be8('0x3'));var router=express[_0x5be8('0x4')]();var fs_extra=require(_0x5be8('0x5'));var auth=require(_0x5be8('0x6'));var interaction=require(_0x5be8('0x7'));var config=require(_0x5be8('0x8'));var controller=require(_0x5be8('0x9'));router[_0x5be8('0xa')]('/',auth[_0x5be8('0xb')](),controller[_0x5be8('0xc')]);router[_0x5be8('0xa')](_0x5be8('0xd'),auth[_0x5be8('0xb')](),controller[_0x5be8('0xe')]);router['get']('/:id/configurations',auth[_0x5be8('0xb')](),controller[_0x5be8('0xf')]);router[_0x5be8('0xa')](_0x5be8('0x10'),auth[_0x5be8('0xb')](),controller[_0x5be8('0x11')]);router['post']('/',auth[_0x5be8('0xb')](),controller[_0x5be8('0x12')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x5be8('0x13')]);router['put'](_0x5be8('0xd'),auth[_0x5be8('0xb')](),controller[_0x5be8('0x14')]);router[_0x5be8('0x15')](_0x5be8('0xd'),auth[_0x5be8('0xb')](),controller[_0x5be8('0x16')]);module[_0x5be8('0x17')]=router; \ No newline at end of file +var _0x8445=['/:id/fields','getFields','post','create','addConfiguration','/:id','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x449284,_0x2f5d76){var _0xcdd966=function(_0x3a55d0){while(--_0x3a55d0){_0x449284['push'](_0x449284['shift']());}};_0xcdd966(++_0x2f5d76);}(_0x8445,0x1a7));var _0x5844=function(_0xda99d6,_0x5d0efa){_0xda99d6=_0xda99d6-0x0;var _0x4d8540=_0x8445[_0xda99d6];return _0x4d8540;};'use strict';var multer=require(_0x5844('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5844('0x1'));var express=require(_0x5844('0x2'));var router=express[_0x5844('0x3')]();var fs_extra=require(_0x5844('0x4'));var auth=require(_0x5844('0x5'));var interaction=require(_0x5844('0x6'));var config=require('../../config/environment');var controller=require(_0x5844('0x7'));router[_0x5844('0x8')]('/',auth['isAuthenticated'](),controller[_0x5844('0x9')]);router['get']('/:id',auth[_0x5844('0xa')](),controller[_0x5844('0xb')]);router['get'](_0x5844('0xc'),auth['isAuthenticated'](),controller[_0x5844('0xd')]);router[_0x5844('0x8')](_0x5844('0xe'),auth[_0x5844('0xa')](),controller[_0x5844('0xf')]);router[_0x5844('0x10')]('/',auth[_0x5844('0xa')](),controller[_0x5844('0x11')]);router[_0x5844('0x10')]('/:id/configurations',auth[_0x5844('0xa')](),controller[_0x5844('0x12')]);router['put'](_0x5844('0x13'),auth[_0x5844('0xa')](),controller['update']);router[_0x5844('0x14')](_0x5844('0x13'),auth['isAuthenticated'](),controller[_0x5844('0x15')]);module[_0x5844('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index ec7ce1d..58637a8 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 _0x00d3=['sequelize','exports','STRING','username'];(function(_0x1ff329,_0x33e086){var _0x28501d=function(_0x38b7c7){while(--_0x38b7c7){_0x1ff329['push'](_0x1ff329['shift']());}};_0x28501d(++_0x33e086);}(_0x00d3,0x108));var _0x300d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x00d3[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x300d('0x0'));module[_0x300d('0x1')]={'name':{'type':Sequelize[_0x300d('0x2')]},'description':{'type':Sequelize[_0x300d('0x2')]},'username':{'type':Sequelize[_0x300d('0x2')],'unique':_0x300d('0x3')},'password':{'type':Sequelize[_0x300d('0x2')]},'email':{'type':Sequelize[_0x300d('0x2')]},'remoteUri':{'type':Sequelize[_0x300d('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x3b2b=['sequelize','exports','STRING','username','remoteUri'];(function(_0x29498c,_0x463c64){var _0x2d2591=function(_0x50d6d2){while(--_0x50d6d2){_0x29498c['push'](_0x29498c['shift']());}};_0x2d2591(++_0x463c64);}(_0x3b2b,0x64));var _0xb3b2=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x3b2b[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0xb3b2('0x0'));module[_0xb3b2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb3b2('0x2')]},'username':{'type':Sequelize[_0xb3b2('0x2')],'unique':_0xb3b2('0x3')},'password':{'type':Sequelize[_0xb3b2('0x2')]},'email':{'type':Sequelize[_0xb3b2('0x2')]},'remoteUri':{'type':Sequelize[_0xb3b2('0x2')],'unique':_0xb3b2('0x4')},'serverUrl':{'type':Sequelize[_0xb3b2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index ad3692e..c6764a5 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 _0xfa51=['notify','sys_class_name','close_notes','closed_by','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','test','statusCode','send','Wrong\x20credentials','true','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','ServicenowAccount','find','body','params','ServicenowConfiguration','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','create','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_created_by','knowledge','calendar_stc','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','assignment_group','business_stc','additional_assignee_list','description','calendar_duration'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xfa51,0xf3));var _0x1fa5=function(_0x26be81,_0x210a4b){_0x26be81=_0x26be81-0x0;var _0x7f0713=_0xfa51[_0x26be81];return _0x7f0713;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1fa5('0x0'));var zipdir=require(_0x1fa5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1fa5('0x2'));var BPromise=require(_0x1fa5('0x3'));var Mustache=require(_0x1fa5('0x4'));var util=require('util');var path=require(_0x1fa5('0x5'));var sox=require(_0x1fa5('0x6'));var csv=require('to-csv');var ejs=require(_0x1fa5('0x7'));var fs=require('fs');var fs_extra=require(_0x1fa5('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1fa5('0x9'));var jsforce=require(_0x1fa5('0xa'));var deskjs=require(_0x1fa5('0xb'));var toCsv=require(_0x1fa5('0xc'));var querystring=require(_0x1fa5('0xd'));var Papa=require(_0x1fa5('0xe'));var Redis=require(_0x1fa5('0xf'));var authService=require(_0x1fa5('0x10'));var qs=require(_0x1fa5('0x11'));var as=require(_0x1fa5('0x12'));var hardwareService=require(_0x1fa5('0x13'));var logger=require(_0x1fa5('0x14'))(_0x1fa5('0x15'));var utils=require(_0x1fa5('0x16'));var config=require(_0x1fa5('0x17'));var licenseUtil=require(_0x1fa5('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1fa5('0x19'));function respondWithStatusCode(_0x384cd7,_0x58b17b){_0x58b17b=_0x58b17b||0xcc;return function(_0x3f24d7){if(_0x3f24d7){return _0x384cd7[_0x1fa5('0x1a')](_0x58b17b);}return _0x384cd7[_0x1fa5('0x1b')](_0x58b17b)[_0x1fa5('0x1c')]();};}function respondWithResult(_0xe5ba4e,_0x513c82){_0x513c82=_0x513c82||0xc8;return function(_0x22a48d){if(_0x22a48d){return _0xe5ba4e['status'](_0x513c82)[_0x1fa5('0x1d')](_0x22a48d);}};}function respondWithFilteredResult(_0x4ae482,_0x547402){return function(_0x52dce9){if(_0x52dce9){var _0x52d4c1=typeof _0x547402[_0x1fa5('0x1e')]===_0x1fa5('0x1f')&&typeof _0x547402[_0x1fa5('0x20')]===_0x1fa5('0x1f');var _0x2c5655=_0x52dce9[_0x1fa5('0x21')];var _0x5e0bbd=_0x52d4c1?0x0:_0x547402['offset'];var _0x1774ad=_0x52d4c1?_0x52dce9[_0x1fa5('0x21')]:_0x547402['offset']+_0x547402['limit'];var _0x146201;if(_0x1774ad>=_0x2c5655){_0x1774ad=_0x2c5655;_0x146201=0xc8;}else{_0x146201=0xce;}_0x4ae482[_0x1fa5('0x1b')](_0x146201);return _0x4ae482[_0x1fa5('0x22')]('Content-Range',_0x5e0bbd+'-'+_0x1774ad+'/'+_0x2c5655)['json'](_0x52dce9);}return null;};}function patchUpdates(_0x57f5b2){return function(_0x5e906d){try{jsonpatch[_0x1fa5('0x23')](_0x5e906d,_0x57f5b2,!![]);}catch(_0xf90b21){return BPromise[_0x1fa5('0x24')](_0xf90b21);}return _0x5e906d[_0x1fa5('0x25')]();};}function saveUpdates(_0x45f0af,_0x2a337d){return function(_0x32e213){if(_0x32e213){return _0x32e213[_0x1fa5('0x26')](_0x45f0af)[_0x1fa5('0x27')](function(_0x4005ce){return _0x4005ce;});}return null;};}function removeEntity(_0x2b94d4,_0x4258c1){return function(_0x3c9a91){if(_0x3c9a91){return _0x3c9a91[_0x1fa5('0x28')]()[_0x1fa5('0x27')](function(){_0x2b94d4[_0x1fa5('0x1b')](0xcc)[_0x1fa5('0x1c')]();});}};}function handleEntityNotFound(_0x37bde0,_0x2668ba){return function(_0x1a9db2){if(!_0x1a9db2){_0x37bde0[_0x1fa5('0x1a')](0x194);}return _0x1a9db2;};}function handleError(_0x256f04,_0x28a3aa){_0x28a3aa=_0x28a3aa||0x1f4;return function(_0x10e50c){logger[_0x1fa5('0x29')](_0x10e50c[_0x1fa5('0x2a')]);if(_0x10e50c[_0x1fa5('0x2b')]){delete _0x10e50c['name'];}_0x256f04['status'](_0x28a3aa)['send'](_0x10e50c);};}exports[_0x1fa5('0x2c')]=function(_0x5229b8,_0x9b889){var _0xf28f33={},_0x4ae47a={},_0x4eb7f6={'count':0x0,'rows':[]};var _0x534ce2=_[_0x1fa5('0x2d')](db['ServicenowAccount'][_0x1fa5('0x2e')],function(_0x58812c){return{'name':_0x58812c['fieldName'],'type':_0x58812c[_0x1fa5('0x2f')][_0x1fa5('0x30')]};});_0x4ae47a['model']=_[_0x1fa5('0x2d')](_0x534ce2,'name');_0x4ae47a['query']=_[_0x1fa5('0x31')](_0x5229b8[_0x1fa5('0x32')]);_0x4ae47a[_0x1fa5('0x33')]=_[_0x1fa5('0x34')](_0x4ae47a[_0x1fa5('0x35')],_0x4ae47a[_0x1fa5('0x32')]);_0xf28f33[_0x1fa5('0x36')]=_['intersection'](_0x4ae47a[_0x1fa5('0x35')],qs['fields'](_0x5229b8[_0x1fa5('0x32')][_0x1fa5('0x37')]));_0xf28f33[_0x1fa5('0x36')]=_0xf28f33[_0x1fa5('0x36')][_0x1fa5('0x38')]?_0xf28f33[_0x1fa5('0x36')]:_0x4ae47a['model'];if(!_0x5229b8[_0x1fa5('0x32')][_0x1fa5('0x39')](_0x1fa5('0x3a'))){_0xf28f33[_0x1fa5('0x20')]=qs[_0x1fa5('0x20')](_0x5229b8['query'][_0x1fa5('0x20')]);_0xf28f33[_0x1fa5('0x1e')]=qs['offset'](_0x5229b8[_0x1fa5('0x32')][_0x1fa5('0x1e')]);}_0xf28f33[_0x1fa5('0x3b')]=qs[_0x1fa5('0x3c')](_0x5229b8[_0x1fa5('0x32')][_0x1fa5('0x3c')]);_0xf28f33[_0x1fa5('0x3d')]=qs[_0x1fa5('0x33')](_[_0x1fa5('0x3e')](_0x5229b8[_0x1fa5('0x32')],_0x4ae47a[_0x1fa5('0x33')]),_0x534ce2);if(_0x5229b8[_0x1fa5('0x32')][_0x1fa5('0x3f')]){_0xf28f33[_0x1fa5('0x3d')]=_[_0x1fa5('0x40')](_0xf28f33[_0x1fa5('0x3d')],{'$or':_[_0x1fa5('0x2d')](_0x534ce2,function(_0x2d7af4){if(_0x2d7af4['type']!==_0x1fa5('0x41')){var _0x2707d6={};_0x2707d6[_0x2d7af4[_0x1fa5('0x2b')]]={'$like':'%'+_0x5229b8[_0x1fa5('0x32')][_0x1fa5('0x3f')]+'%'};return _0x2707d6;}})});}_0xf28f33=_['merge']({},_0xf28f33,_0x5229b8[_0x1fa5('0x42')]);var _0x431a1c={'where':_0xf28f33['where']};return db['ServicenowAccount'][_0x1fa5('0x21')](_0x431a1c)['then'](function(_0x443957){_0x4eb7f6[_0x1fa5('0x21')]=_0x443957;if(_0x5229b8[_0x1fa5('0x32')][_0x1fa5('0x43')]){_0xf28f33[_0x1fa5('0x44')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x1fa5('0x45')](_0xf28f33);})[_0x1fa5('0x27')](function(_0x4d6f4c){_0x4eb7f6[_0x1fa5('0x46')]=_0x4d6f4c;return _0x4eb7f6;})[_0x1fa5('0x27')](respondWithFilteredResult(_0x9b889,_0xf28f33))[_0x1fa5('0x47')](handleError(_0x9b889,null));};exports[_0x1fa5('0x48')]=function(_0x3ddd06,_0x5c5ffa){var _0x484f5e={'raw':![],'where':{'id':_0x3ddd06['params']['id']}},_0x4b6986={};_0x4b6986[_0x1fa5('0x35')]=_[_0x1fa5('0x31')](db[_0x1fa5('0x49')][_0x1fa5('0x2e')]);_0x4b6986[_0x1fa5('0x32')]=_[_0x1fa5('0x31')](_0x3ddd06[_0x1fa5('0x32')]);_0x4b6986[_0x1fa5('0x33')]=_[_0x1fa5('0x34')](_0x4b6986['model'],_0x4b6986[_0x1fa5('0x32')]);_0x484f5e['attributes']=_['intersection'](_0x4b6986[_0x1fa5('0x35')],qs[_0x1fa5('0x37')](_0x3ddd06[_0x1fa5('0x32')]['fields']));_0x484f5e[_0x1fa5('0x36')]=_0x484f5e['attributes'][_0x1fa5('0x38')]?_0x484f5e['attributes']:_0x4b6986['model'];if(_0x3ddd06[_0x1fa5('0x32')]['includeAll']){_0x484f5e[_0x1fa5('0x44')]=[{'all':!![]}];}_0x484f5e=_[_0x1fa5('0x40')]({},_0x484f5e,_0x3ddd06[_0x1fa5('0x42')]);return db['ServicenowAccount'][_0x1fa5('0x4a')](_0x484f5e)[_0x1fa5('0x27')](handleEntityNotFound(_0x5c5ffa,null))[_0x1fa5('0x27')](respondWithResult(_0x5c5ffa,null))[_0x1fa5('0x47')](handleError(_0x5c5ffa,null));};exports['create']=function(_0x36c0c8,_0x36198a){return db[_0x1fa5('0x49')]['create'](_0x36c0c8[_0x1fa5('0x4b')],{})[_0x1fa5('0x27')](respondWithResult(_0x36198a,0xc9))[_0x1fa5('0x47')](handleError(_0x36198a,null));};exports[_0x1fa5('0x26')]=function(_0x47e2ad,_0x571e3b){if(_0x47e2ad[_0x1fa5('0x4b')]['id']){delete _0x47e2ad[_0x1fa5('0x4b')]['id'];}return db[_0x1fa5('0x49')][_0x1fa5('0x4a')]({'where':{'id':_0x47e2ad['params']['id']}})['then'](handleEntityNotFound(_0x571e3b,null))['then'](saveUpdates(_0x47e2ad[_0x1fa5('0x4b')],null))['then'](respondWithResult(_0x571e3b,null))[_0x1fa5('0x47')](handleError(_0x571e3b,null));};exports[_0x1fa5('0x28')]=function(_0x29ef80,_0x5943cd){return db[_0x1fa5('0x49')]['find']({'where':{'id':_0x29ef80[_0x1fa5('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5943cd,null))['then'](removeEntity(_0x5943cd,null))[_0x1fa5('0x47')](handleError(_0x5943cd,null));};exports['getConfigurations']=function(_0x375c57,_0x219164,_0x42af5b){var _0x413bf1={};var _0x315d6d={};var _0x3f3a7c;var _0x41b57d;return db['ServicenowAccount']['findOne']({'where':{'id':_0x375c57['params']['id']}})[_0x1fa5('0x27')](handleEntityNotFound(_0x219164,null))[_0x1fa5('0x27')](function(_0x564afd){if(_0x564afd){_0x3f3a7c=_0x564afd;_0x315d6d[_0x1fa5('0x35')]=_[_0x1fa5('0x31')](db[_0x1fa5('0x4d')][_0x1fa5('0x2e')]);_0x315d6d[_0x1fa5('0x32')]=_[_0x1fa5('0x31')](_0x375c57['query']);_0x315d6d['filters']=_[_0x1fa5('0x34')](_0x315d6d[_0x1fa5('0x35')],_0x315d6d['query']);_0x413bf1[_0x1fa5('0x36')]=_[_0x1fa5('0x34')](_0x315d6d['model'],qs[_0x1fa5('0x37')](_0x375c57['query'][_0x1fa5('0x37')]));_0x413bf1[_0x1fa5('0x36')]=_0x413bf1['attributes'][_0x1fa5('0x38')]?_0x413bf1[_0x1fa5('0x36')]:_0x315d6d[_0x1fa5('0x35')];_0x413bf1[_0x1fa5('0x3b')]=qs[_0x1fa5('0x3c')](_0x375c57[_0x1fa5('0x32')][_0x1fa5('0x3c')]);_0x413bf1[_0x1fa5('0x3d')]=qs[_0x1fa5('0x33')](_[_0x1fa5('0x3e')](_0x375c57[_0x1fa5('0x32')],_0x315d6d[_0x1fa5('0x33')]));if(_0x375c57[_0x1fa5('0x32')][_0x1fa5('0x3f')]){_0x413bf1[_0x1fa5('0x3d')]=_[_0x1fa5('0x40')](_0x413bf1[_0x1fa5('0x3d')],{'$or':_[_0x1fa5('0x2d')](_0x413bf1[_0x1fa5('0x36')],function(_0x1b03b4){var _0x44dd5b={};_0x44dd5b[_0x1b03b4]={'$like':'%'+_0x375c57['query']['filter']+'%'};return _0x44dd5b;})});}_0x413bf1=_[_0x1fa5('0x40')]({},_0x413bf1,_0x375c57[_0x1fa5('0x42')]);return _0x3f3a7c[_0x1fa5('0x4e')](_0x413bf1);}})['then'](function(_0x342e26){if(_0x342e26){_0x41b57d=_0x342e26[_0x1fa5('0x38')];if(!_0x375c57['query'][_0x1fa5('0x39')](_0x1fa5('0x3a'))){_0x413bf1['limit']=qs[_0x1fa5('0x20')](_0x375c57[_0x1fa5('0x32')][_0x1fa5('0x20')]);_0x413bf1['offset']=qs[_0x1fa5('0x1e')](_0x375c57[_0x1fa5('0x32')][_0x1fa5('0x1e')]);}return _0x3f3a7c['getConfigurations'](_0x413bf1);}})[_0x1fa5('0x27')](function(_0x266077){if(_0x266077){return _0x266077?{'count':_0x41b57d,'rows':_0x266077}:null;}})['then'](respondWithResult(_0x219164,null))[_0x1fa5('0x47')](handleError(_0x219164,null));};exports['addConfiguration']=function(_0x1815ef,_0xe2b1f2,_0x23e78e){if(_0x1815ef[_0x1fa5('0x4b')]['id']){delete _0x1815ef[_0x1fa5('0x4b')]['id'];}return db['ServicenowAccount'][_0x1fa5('0x4f')]({'where':{'id':_0x1815ef[_0x1fa5('0x4c')]['id']}})['then'](handleEntityNotFound(_0xe2b1f2,null))['then'](function(_0x3fc196){if(_0x3fc196){_0x1815ef[_0x1fa5('0x4b')][_0x1fa5('0x50')]=_0x3fc196['id'];_0x1815ef['body'][_0x1fa5('0x51')]=integrations[_0x1fa5('0x52')](_0x1815ef[_0x1fa5('0x4b')][_0x1fa5('0x53')],_0x1815ef[_0x1fa5('0x4b')]['type']);_0x1815ef['body'][_0x1fa5('0x54')]=integrations['getDescriptions'](_0x1815ef[_0x1fa5('0x4b')][_0x1fa5('0x53')],_0x1815ef[_0x1fa5('0x4b')][_0x1fa5('0x2f')]);return db[_0x1fa5('0x4d')][_0x1fa5('0x55')](_0x1815ef[_0x1fa5('0x4b')],{'include':[{'model':db[_0x1fa5('0x56')],'as':_0x1fa5('0x51')},{'model':db[_0x1fa5('0x56')],'as':_0x1fa5('0x54')}]});}return null;})[_0x1fa5('0x27')](respondWithResult(_0xe2b1f2,null))[_0x1fa5('0x47')](handleError(_0xe2b1f2,null));};exports[_0x1fa5('0x57')]=function(_0x35c3c5,_0xba7286,_0x562897){var _0x5e0b87=[_0x1fa5('0x58'),_0x1fa5('0x59'),'knowledge',_0x1fa5('0x5a'),_0x1fa5('0x5b'),'notify',_0x1fa5('0x5c'),_0x1fa5('0x5d'),_0x1fa5('0x5e')];var _0x38e917=[_0x1fa5('0x5f'),_0x1fa5('0x58'),_0x1fa5('0x60'),_0x1fa5('0x61'),'upon_reject',_0x1fa5('0x62'),_0x1fa5('0x63'),'hold_reason',_0x1fa5('0x64'),_0x1fa5('0x65'),_0x1fa5('0x66'),'sys_updated_by',_0x1fa5('0x67'),_0x1fa5('0x68'),_0x1fa5('0x69'),'sys_domain','state',_0x1fa5('0x6a'),_0x1fa5('0x6b'),_0x1fa5('0x3b'),_0x1fa5('0x6c'),'closed_at',_0x1fa5('0x6d'),'delivery_plan',_0x1fa5('0x6e'),_0x1fa5('0x6f'),_0x1fa5('0x70'),_0x1fa5('0x71'),_0x1fa5('0x72'),_0x1fa5('0x73'),_0x1fa5('0x74'),_0x1fa5('0x75'),_0x1fa5('0x76'),_0x1fa5('0x77'),'business_duration',_0x1fa5('0x78'),_0x1fa5('0x79'),_0x1fa5('0x7a'),_0x1fa5('0x7b'),_0x1fa5('0x7c'),_0x1fa5('0x7d'),_0x1fa5('0x5a'),_0x1fa5('0x7e'),'short_description','close_code',_0x1fa5('0x7f'),'delivery_task','work_start',_0x1fa5('0x80'),_0x1fa5('0x81'),_0x1fa5('0x82'),_0x1fa5('0x83'),_0x1fa5('0x84'),_0x1fa5('0x85'),_0x1fa5('0x86'),_0x1fa5('0x87'),_0x1fa5('0x88'),'follow_up','parent_incident',_0x1fa5('0x89'),_0x1fa5('0x8a'),_0x1fa5('0x8b'),'incident_state',_0x1fa5('0x8c'),'problem_id',_0x1fa5('0x8d'),_0x1fa5('0x8e'),'activity_due','assigned_to',_0x1fa5('0x5d'),_0x1fa5('0x8f'),_0x1fa5('0x90'),_0x1fa5('0x91'),_0x1fa5('0x92'),'due_date',_0x1fa5('0x93'),_0x1fa5('0x94'),'sys_tags',_0x1fa5('0x95'),_0x1fa5('0x96'),_0x1fa5('0x97'),'location','category'];var _0x12009d='';var _0x80f46d='';var _0x238c2a=[];var _0x503e6d='';var _0x1171de='';var _0x2fdb7c=[];var _0x556202='';var _0x545f13='';var _0x1c84d0={};var _0xd4fce4='';return db[_0x1fa5('0x49')][_0x1fa5('0x4f')]({'where':{'id':_0x35c3c5[_0x1fa5('0x4c')]['id']},'attributes':['id',_0x1fa5('0x98'),'password',_0x1fa5('0x99'),_0x1fa5('0x9a'),_0x1fa5('0x9b')]})[_0x1fa5('0x27')](handleEntityNotFound(_0xba7286,null))[_0x1fa5('0x27')](function(_0xf2c9a7){if(_0xf2c9a7){_0xd4fce4=_0xf2c9a7[_0x1fa5('0x9a')];var _0x9f7e74=_0xd4fce4[_0x1fa5('0x9c')](-0x1);if(_0x9f7e74==='/'){_0xd4fce4=_0xd4fce4[_0x1fa5('0x9d')](0x0,_0xd4fce4[_0x1fa5('0x9e')](_0x9f7e74));}_0x545f13=util[_0x1fa5('0x9f')](_0x1fa5('0xa0'),_0xd4fce4);_0x556202=util[_0x1fa5('0x9f')](_0x1fa5('0xa1'),_0xd4fce4);_0x1c84d0={'user':_0xf2c9a7[_0x1fa5('0x98')],'pass':_0xf2c9a7[_0x1fa5('0xa2')]};var _0x36cabb={'method':'GET','uri':_0x545f13+_0x1fa5('0xa3'),'auth':_0x1c84d0,'json':!![]};return rp(_0x36cabb);}})['then'](function(_0x289dc3){if(_0x289dc3[_0x1fa5('0xa4')][_0x1fa5('0x38')]>0x0){_0x12009d=_0x289dc3[_0x1fa5('0xa4')];}console[_0x1fa5('0xa5')](_0x1fa5('0xa6'),_0x12009d);_0x2fdb7c=[];_0x80f46d=Object[_0x1fa5('0xa7')]([],_0x12009d);_[_0x1fa5('0xa8')](_0x80f46d,function(_0x51c81e){return!_0x5e0b87[_0x1fa5('0xa9')](_0x51c81e[_0x1fa5('0x2b')]);});_0x80f46d[_0x1fa5('0xaa')](function(_0x181856){var _0xbaae68=createFieldObject(_0x556202,_0x1c84d0,_0x181856[_0x1fa5('0xab')],_0x181856['name'],_0x181856[_0x1fa5('0xac')],![]);_0x2fdb7c[_0x1fa5('0xad')](_0xbaae68);});return Promise[_0x1fa5('0xae')](_0x2fdb7c);})[_0x1fa5('0x27')](function(_0x577348){_0x238c2a=_0x577348;_0x503e6d=Object[_0x1fa5('0xa7')]([],_0x12009d);console['log'](_0x1fa5('0xaf'),_0x12009d);_['remove'](_0x503e6d,function(_0x24bd41){return _0x38e917[_0x1fa5('0xa9')](_0x24bd41[_0x1fa5('0x2b')]);});console[_0x1fa5('0xa5')](_0x1fa5('0xb0'),_0x503e6d);_0x2fdb7c=[];_0x503e6d[_0x1fa5('0xaa')](function(_0x260674){var _0x55c99d=createFieldObject(_0x556202,_0x1c84d0,_0x260674[_0x1fa5('0xab')],_0x260674[_0x1fa5('0x2b')],_0x260674['label'],!![]);_0x2fdb7c[_0x1fa5('0xad')](_0x55c99d);});return Promise[_0x1fa5('0xae')](_0x2fdb7c);})['then'](function(_0x8fc47d){_0x1171de=_0x8fc47d;var _0x2a24ce=_0x238c2a[_0x1fa5('0xb1')](_0x1171de);return{'count':_0x2a24ce['length'],'rows':_0x2a24ce};})['then'](respondWithResult(_0xba7286,null))[_0x1fa5('0x47')](function(_0x39bb56){console[_0x1fa5('0xa5')]('ServiceNow\x20error:\x20'+_0x39bb56);var _0x5c949b=_0x35c3c5[_0x1fa5('0x32')][_0x1fa5('0xb2')]?0x1f4:_0x39bb56[_0x1fa5('0xb3')]||0x1f4;logger[_0x1fa5('0x29')](_0x39bb56['stack']);delete _0x39bb56[_0x1fa5('0x2b')];if(_0x5c949b===0x191){_0x5c949b=0x190;}_0xba7286[_0x1fa5('0x1b')](_0x5c949b)[_0x1fa5('0xb4')](_0x35c3c5[_0x1fa5('0x32')][_0x1fa5('0xb2')]?{'message':_0x1fa5('0xb5'),'statusCode':_0x39bb56['statusCode']}:_0x39bb56);});};function createFieldObject(_0xaa7b67,_0x177260,_0x127aeb,_0x5b7ee3,_0x1c5d77,_0x263d4b){return new Promise(function(_0x5ae219,_0x5b88f2){var _0x144acb={'id':_0x5b7ee3,'name':_0x1c5d77,'custom':_0x263d4b};if(_0x127aeb==='boolean'){_0x144acb[_0x1fa5('0x42')]=[{'name':'True','value':_0x1fa5('0xb6')},{'name':'False','value':_0x1fa5('0xb7')}];_0x5ae219(_0x144acb);}else{var _0x247823={'method':_0x1fa5('0xb8'),'uri':_0xaa7b67+_0x1fa5('0xb9')+_0x5b7ee3,'auth':_0x177260,'json':!![]};return rp(_0x247823)['then'](function(_0x356584){var _0x569419=[];if(_0x356584['result']['length']>0x0){_0x356584[_0x1fa5('0xa4')][_0x1fa5('0xaa')](function(_0x4b1916){if(_0x4b1916[_0x1fa5('0xba')]===_0x1fa5('0xb7')){var _0x292500={'name':_0x4b1916['label'],'value':_0x4b1916[_0x1fa5('0xbb')]};_0x569419['push'](_0x292500);}});}_0x144acb[_0x1fa5('0x42')]=_0x569419;if(_0x144acb['options'][_0x1fa5('0x38')]>0x0){_0x5ae219(_0x144acb);}else{if(_0x263d4b==![]){_0x5ae219();}else{_0x5ae219(_0x144acb);}}});}});} \ No newline at end of file +var _0x8fab=['remove','includes','forEach','internalType','label','push','all','assign','TCL:\x20_object','log','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','True','true','sys_choice?sysparm_query=name=incident^element=','inactive','false','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','save','update','then','destroy','end','error','name','send','map','rawAttributes','query','keys','filters','model','attributes','intersection','fields','order','sort','where','type','VIRTUAL','merge','options','ServicenowAccount','include','findAll','catch','show','params','length','includeAll','create','body','find','getConfigurations','pick','filter','hasOwnProperty','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','business_service','priority','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','parent_incident','contact_type','reopened_by','urgency','company','reassignment_count','assigned_to','severity','comments','sla_due','approval','due_date','sys_tags','upon_approval','location','username','password','email','serverUrl','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects'];(function(_0x505489,_0x5b28c1){var _0x103f1d=function(_0x4ece9e){while(--_0x4ece9e){_0x505489['push'](_0x505489['shift']());}};_0x103f1d(++_0x5b28c1);}(_0x8fab,0x178));var _0xb8fa=function(_0x113411,_0x3bf18b){_0x113411=_0x113411-0x0;var _0x1c6a0e=_0x8fab[_0x113411];return _0x1c6a0e;};'use strict';var emlformat=require(_0xb8fa('0x0'));var rimraf=require(_0xb8fa('0x1'));var zipdir=require(_0xb8fa('0x2'));var jsonpatch=require(_0xb8fa('0x3'));var rp=require(_0xb8fa('0x4'));var moment=require(_0xb8fa('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb8fa('0x6'));var path=require(_0xb8fa('0x7'));var sox=require(_0xb8fa('0x8'));var csv=require('to-csv');var ejs=require(_0xb8fa('0x9'));var fs=require('fs');var fs_extra=require(_0xb8fa('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb8fa('0xb'));var jsforce=require(_0xb8fa('0xc'));var deskjs=require(_0xb8fa('0xd'));var toCsv=require(_0xb8fa('0xe'));var querystring=require('querystring');var Papa=require(_0xb8fa('0xf'));var Redis=require(_0xb8fa('0x10'));var authService=require(_0xb8fa('0x11'));var qs=require(_0xb8fa('0x12'));var as=require(_0xb8fa('0x13'));var hardwareService=require(_0xb8fa('0x14'));var logger=require(_0xb8fa('0x15'))('api');var utils=require(_0xb8fa('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb8fa('0x17'));var db=require(_0xb8fa('0x18'))['db'];var integrations=require(_0xb8fa('0x19'));function respondWithStatusCode(_0x404523,_0x5e3d63){_0x5e3d63=_0x5e3d63||0xcc;return function(_0x3b8aeb){if(_0x3b8aeb){return _0x404523[_0xb8fa('0x1a')](_0x5e3d63);}return _0x404523[_0xb8fa('0x1b')](_0x5e3d63)['end']();};}function respondWithResult(_0x219468,_0x84f1ae){_0x84f1ae=_0x84f1ae||0xc8;return function(_0x567a5e){if(_0x567a5e){return _0x219468[_0xb8fa('0x1b')](_0x84f1ae)[_0xb8fa('0x1c')](_0x567a5e);}};}function respondWithFilteredResult(_0x4baa84,_0x774f8c){return function(_0x56d817){if(_0x56d817){var _0x24f20f=typeof _0x774f8c['offset']===_0xb8fa('0x1d')&&typeof _0x774f8c[_0xb8fa('0x1e')]===_0xb8fa('0x1d');var _0x42d7a5=_0x56d817['count'];var _0x627a1=_0x24f20f?0x0:_0x774f8c[_0xb8fa('0x1f')];var _0x50e8e9=_0x24f20f?_0x56d817[_0xb8fa('0x20')]:_0x774f8c[_0xb8fa('0x1f')]+_0x774f8c[_0xb8fa('0x1e')];var _0x3a1a10;if(_0x50e8e9>=_0x42d7a5){_0x50e8e9=_0x42d7a5;_0x3a1a10=0xc8;}else{_0x3a1a10=0xce;}_0x4baa84['status'](_0x3a1a10);return _0x4baa84[_0xb8fa('0x21')](_0xb8fa('0x22'),_0x627a1+'-'+_0x50e8e9+'/'+_0x42d7a5)[_0xb8fa('0x1c')](_0x56d817);}return null;};}function patchUpdates(_0x293604){return function(_0x1648bd){try{jsonpatch['apply'](_0x1648bd,_0x293604,!![]);}catch(_0x5c1582){return BPromise['reject'](_0x5c1582);}return _0x1648bd[_0xb8fa('0x23')]();};}function saveUpdates(_0xe73f6c,_0x2850d2){return function(_0x5f4f4f){if(_0x5f4f4f){return _0x5f4f4f[_0xb8fa('0x24')](_0xe73f6c)[_0xb8fa('0x25')](function(_0x59fba3){return _0x59fba3;});}return null;};}function removeEntity(_0x2d1db4,_0x665bdb){return function(_0x9a58d3){if(_0x9a58d3){return _0x9a58d3[_0xb8fa('0x26')]()[_0xb8fa('0x25')](function(){_0x2d1db4['status'](0xcc)[_0xb8fa('0x27')]();});}};}function handleEntityNotFound(_0x528953,_0x431d81){return function(_0x1d67ee){if(!_0x1d67ee){_0x528953['sendStatus'](0x194);}return _0x1d67ee;};}function handleError(_0x393d3a,_0x50771d){_0x50771d=_0x50771d||0x1f4;return function(_0x376cc1){logger[_0xb8fa('0x28')](_0x376cc1['stack']);if(_0x376cc1['name']){delete _0x376cc1[_0xb8fa('0x29')];}_0x393d3a[_0xb8fa('0x1b')](_0x50771d)[_0xb8fa('0x2a')](_0x376cc1);};}exports['index']=function(_0x510f6f,_0x349066){var _0x17669a={},_0x175221={},_0x56d947={'count':0x0,'rows':[]};var _0x26332c=_[_0xb8fa('0x2b')](db['ServicenowAccount'][_0xb8fa('0x2c')],function(_0x4000dc){return{'name':_0x4000dc['fieldName'],'type':_0x4000dc['type']['key']};});_0x175221['model']=_[_0xb8fa('0x2b')](_0x26332c,_0xb8fa('0x29'));_0x175221[_0xb8fa('0x2d')]=_[_0xb8fa('0x2e')](_0x510f6f[_0xb8fa('0x2d')]);_0x175221[_0xb8fa('0x2f')]=_['intersection'](_0x175221[_0xb8fa('0x30')],_0x175221['query']);_0x17669a[_0xb8fa('0x31')]=_[_0xb8fa('0x32')](_0x175221[_0xb8fa('0x30')],qs[_0xb8fa('0x33')](_0x510f6f[_0xb8fa('0x2d')]['fields']));_0x17669a[_0xb8fa('0x31')]=_0x17669a[_0xb8fa('0x31')]['length']?_0x17669a[_0xb8fa('0x31')]:_0x175221[_0xb8fa('0x30')];if(!_0x510f6f[_0xb8fa('0x2d')]['hasOwnProperty']('nolimit')){_0x17669a[_0xb8fa('0x1e')]=qs[_0xb8fa('0x1e')](_0x510f6f['query']['limit']);_0x17669a[_0xb8fa('0x1f')]=qs['offset'](_0x510f6f[_0xb8fa('0x2d')][_0xb8fa('0x1f')]);}_0x17669a[_0xb8fa('0x34')]=qs[_0xb8fa('0x35')](_0x510f6f[_0xb8fa('0x2d')][_0xb8fa('0x35')]);_0x17669a[_0xb8fa('0x36')]=qs[_0xb8fa('0x2f')](_['pick'](_0x510f6f['query'],_0x175221[_0xb8fa('0x2f')]),_0x26332c);if(_0x510f6f['query']['filter']){_0x17669a[_0xb8fa('0x36')]=_['merge'](_0x17669a[_0xb8fa('0x36')],{'$or':_[_0xb8fa('0x2b')](_0x26332c,function(_0x3e17f5){if(_0x3e17f5[_0xb8fa('0x37')]!==_0xb8fa('0x38')){var _0x543811={};_0x543811[_0x3e17f5[_0xb8fa('0x29')]]={'$like':'%'+_0x510f6f[_0xb8fa('0x2d')]['filter']+'%'};return _0x543811;}})});}_0x17669a=_[_0xb8fa('0x39')]({},_0x17669a,_0x510f6f[_0xb8fa('0x3a')]);var _0x1c93f8={'where':_0x17669a[_0xb8fa('0x36')]};return db[_0xb8fa('0x3b')][_0xb8fa('0x20')](_0x1c93f8)[_0xb8fa('0x25')](function(_0x1e67d8){_0x56d947[_0xb8fa('0x20')]=_0x1e67d8;if(_0x510f6f[_0xb8fa('0x2d')]['includeAll']){_0x17669a[_0xb8fa('0x3c')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xb8fa('0x3d')](_0x17669a);})[_0xb8fa('0x25')](function(_0x1f380e){_0x56d947['rows']=_0x1f380e;return _0x56d947;})['then'](respondWithFilteredResult(_0x349066,_0x17669a))[_0xb8fa('0x3e')](handleError(_0x349066,null));};exports[_0xb8fa('0x3f')]=function(_0x44f1d7,_0x278130){var _0x187fab={'raw':![],'where':{'id':_0x44f1d7[_0xb8fa('0x40')]['id']}},_0xfc2ff4={};_0xfc2ff4[_0xb8fa('0x30')]=_['keys'](db[_0xb8fa('0x3b')][_0xb8fa('0x2c')]);_0xfc2ff4[_0xb8fa('0x2d')]=_[_0xb8fa('0x2e')](_0x44f1d7['query']);_0xfc2ff4[_0xb8fa('0x2f')]=_[_0xb8fa('0x32')](_0xfc2ff4['model'],_0xfc2ff4['query']);_0x187fab[_0xb8fa('0x31')]=_[_0xb8fa('0x32')](_0xfc2ff4[_0xb8fa('0x30')],qs[_0xb8fa('0x33')](_0x44f1d7[_0xb8fa('0x2d')][_0xb8fa('0x33')]));_0x187fab[_0xb8fa('0x31')]=_0x187fab[_0xb8fa('0x31')][_0xb8fa('0x41')]?_0x187fab['attributes']:_0xfc2ff4[_0xb8fa('0x30')];if(_0x44f1d7['query'][_0xb8fa('0x42')]){_0x187fab[_0xb8fa('0x3c')]=[{'all':!![]}];}_0x187fab=_[_0xb8fa('0x39')]({},_0x187fab,_0x44f1d7[_0xb8fa('0x3a')]);return db['ServicenowAccount']['find'](_0x187fab)[_0xb8fa('0x25')](handleEntityNotFound(_0x278130,null))[_0xb8fa('0x25')](respondWithResult(_0x278130,null))['catch'](handleError(_0x278130,null));};exports[_0xb8fa('0x43')]=function(_0x5a473b,_0x4205cc){return db[_0xb8fa('0x3b')][_0xb8fa('0x43')](_0x5a473b[_0xb8fa('0x44')],{})[_0xb8fa('0x25')](respondWithResult(_0x4205cc,0xc9))[_0xb8fa('0x3e')](handleError(_0x4205cc,null));};exports[_0xb8fa('0x24')]=function(_0x3c224f,_0x2ce541){if(_0x3c224f[_0xb8fa('0x44')]['id']){delete _0x3c224f['body']['id'];}return db[_0xb8fa('0x3b')][_0xb8fa('0x45')]({'where':{'id':_0x3c224f[_0xb8fa('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ce541,null))[_0xb8fa('0x25')](saveUpdates(_0x3c224f[_0xb8fa('0x44')],null))[_0xb8fa('0x25')](respondWithResult(_0x2ce541,null))['catch'](handleError(_0x2ce541,null));};exports[_0xb8fa('0x26')]=function(_0x54dc28,_0x673f06){return db[_0xb8fa('0x3b')][_0xb8fa('0x45')]({'where':{'id':_0x54dc28[_0xb8fa('0x40')]['id']}})[_0xb8fa('0x25')](handleEntityNotFound(_0x673f06,null))[_0xb8fa('0x25')](removeEntity(_0x673f06,null))['catch'](handleError(_0x673f06,null));};exports[_0xb8fa('0x46')]=function(_0x1699ea,_0x1fa044,_0x10c259){var _0x2ce3b6={};var _0x3d96d1={};var _0x514ca9;var _0x145782;return db[_0xb8fa('0x3b')]['findOne']({'where':{'id':_0x1699ea['params']['id']}})[_0xb8fa('0x25')](handleEntityNotFound(_0x1fa044,null))['then'](function(_0x5cb3a8){if(_0x5cb3a8){_0x514ca9=_0x5cb3a8;_0x3d96d1[_0xb8fa('0x30')]=_['keys'](db['ServicenowConfiguration'][_0xb8fa('0x2c')]);_0x3d96d1[_0xb8fa('0x2d')]=_['keys'](_0x1699ea[_0xb8fa('0x2d')]);_0x3d96d1[_0xb8fa('0x2f')]=_[_0xb8fa('0x32')](_0x3d96d1[_0xb8fa('0x30')],_0x3d96d1[_0xb8fa('0x2d')]);_0x2ce3b6[_0xb8fa('0x31')]=_[_0xb8fa('0x32')](_0x3d96d1[_0xb8fa('0x30')],qs['fields'](_0x1699ea['query'][_0xb8fa('0x33')]));_0x2ce3b6[_0xb8fa('0x31')]=_0x2ce3b6['attributes'][_0xb8fa('0x41')]?_0x2ce3b6['attributes']:_0x3d96d1[_0xb8fa('0x30')];_0x2ce3b6[_0xb8fa('0x34')]=qs[_0xb8fa('0x35')](_0x1699ea[_0xb8fa('0x2d')]['sort']);_0x2ce3b6[_0xb8fa('0x36')]=qs['filters'](_[_0xb8fa('0x47')](_0x1699ea['query'],_0x3d96d1[_0xb8fa('0x2f')]));if(_0x1699ea[_0xb8fa('0x2d')]['filter']){_0x2ce3b6[_0xb8fa('0x36')]=_[_0xb8fa('0x39')](_0x2ce3b6[_0xb8fa('0x36')],{'$or':_['map'](_0x2ce3b6[_0xb8fa('0x31')],function(_0x5ad7fa){var _0x1bcda9={};_0x1bcda9[_0x5ad7fa]={'$like':'%'+_0x1699ea[_0xb8fa('0x2d')][_0xb8fa('0x48')]+'%'};return _0x1bcda9;})});}_0x2ce3b6=_['merge']({},_0x2ce3b6,_0x1699ea[_0xb8fa('0x3a')]);return _0x514ca9['getConfigurations'](_0x2ce3b6);}})[_0xb8fa('0x25')](function(_0x57c336){if(_0x57c336){_0x145782=_0x57c336[_0xb8fa('0x41')];if(!_0x1699ea[_0xb8fa('0x2d')][_0xb8fa('0x49')](_0xb8fa('0x4a'))){_0x2ce3b6[_0xb8fa('0x1e')]=qs['limit'](_0x1699ea['query']['limit']);_0x2ce3b6[_0xb8fa('0x1f')]=qs[_0xb8fa('0x1f')](_0x1699ea[_0xb8fa('0x2d')]['offset']);}return _0x514ca9[_0xb8fa('0x46')](_0x2ce3b6);}})[_0xb8fa('0x25')](function(_0x568643){if(_0x568643){return _0x568643?{'count':_0x145782,'rows':_0x568643}:null;}})[_0xb8fa('0x25')](respondWithResult(_0x1fa044,null))['catch'](handleError(_0x1fa044,null));};exports[_0xb8fa('0x4b')]=function(_0x344863,_0x3a0c74,_0x32e777){if(_0x344863['body']['id']){delete _0x344863[_0xb8fa('0x44')]['id'];}return db[_0xb8fa('0x3b')][_0xb8fa('0x4c')]({'where':{'id':_0x344863[_0xb8fa('0x40')]['id']}})[_0xb8fa('0x25')](handleEntityNotFound(_0x3a0c74,null))[_0xb8fa('0x25')](function(_0x23de8b){if(_0x23de8b){_0x344863['body'][_0xb8fa('0x4d')]=_0x23de8b['id'];_0x344863['body'][_0xb8fa('0x4e')]=integrations[_0xb8fa('0x4f')](_0x344863['body'][_0xb8fa('0x50')],_0x344863[_0xb8fa('0x44')][_0xb8fa('0x37')]);_0x344863[_0xb8fa('0x44')][_0xb8fa('0x51')]=integrations[_0xb8fa('0x52')](_0x344863['body']['channel'],_0x344863[_0xb8fa('0x44')]['type']);return db[_0xb8fa('0x53')][_0xb8fa('0x43')](_0x344863[_0xb8fa('0x44')],{'include':[{'model':db[_0xb8fa('0x54')],'as':'Subjects'},{'model':db[_0xb8fa('0x54')],'as':_0xb8fa('0x51')}]});}return null;})['then'](respondWithResult(_0x3a0c74,null))[_0xb8fa('0x3e')](handleError(_0x3a0c74,null));};exports[_0xb8fa('0x55')]=function(_0x107ce9,_0x338954,_0x4e158f){var _0x1c5452=['made_sla',_0xb8fa('0x56'),_0xb8fa('0x57'),_0xb8fa('0x58'),_0xb8fa('0x59'),'notify','incident_state','severity',_0xb8fa('0x5a')];var _0x1926bc=[_0xb8fa('0x5b'),_0xb8fa('0x5c'),_0xb8fa('0x5d'),_0xb8fa('0x5e'),_0xb8fa('0x5f'),_0xb8fa('0x60'),'child_incidents','hold_reason',_0xb8fa('0x61'),_0xb8fa('0x62'),_0xb8fa('0x63'),'sys_updated_by',_0xb8fa('0x64'),_0xb8fa('0x65'),_0xb8fa('0x66'),_0xb8fa('0x67'),_0xb8fa('0x68'),_0xb8fa('0x69'),_0xb8fa('0x57'),'order',_0xb8fa('0x6a'),_0xb8fa('0x6b'),_0xb8fa('0x6c'),'delivery_plan',_0xb8fa('0x6d'),'active','work_notes_list',_0xb8fa('0x6e'),_0xb8fa('0x6f'),'sys_domain_path',_0xb8fa('0x70'),_0xb8fa('0x71'),'expected_start',_0xb8fa('0x72'),_0xb8fa('0x73'),_0xb8fa('0x74'),_0xb8fa('0x75'),_0xb8fa('0x76'),_0xb8fa('0x77'),'caller_id','approval_set','subcategory','work_notes',_0xb8fa('0x78'),'close_code','correlation_display',_0xb8fa('0x79'),_0xb8fa('0x7a'),_0xb8fa('0x7b'),_0xb8fa('0x7c'),_0xb8fa('0x7d'),_0xb8fa('0x7e'),_0xb8fa('0x7f'),_0xb8fa('0x80'),'sys_class_name','close_notes','closed_by','follow_up',_0xb8fa('0x81'),'sys_id',_0xb8fa('0x82'),_0xb8fa('0x83'),'incident_state',_0xb8fa('0x84'),'problem_id',_0xb8fa('0x85'),_0xb8fa('0x86'),'activity_due',_0xb8fa('0x87'),_0xb8fa('0x88'),_0xb8fa('0x89'),_0xb8fa('0x8a'),_0xb8fa('0x8b'),'comments_and_work_notes',_0xb8fa('0x8c'),'sys_mod_count','reopen_count',_0xb8fa('0x8d'),'escalation',_0xb8fa('0x8e'),'correlation_id',_0xb8fa('0x8f'),_0xb8fa('0x5a')];var _0x3c539d='';var _0x20464a='';var _0x90d55a=[];var _0x48f081='';var _0xc047b5='';var _0x6317fc=[];var _0x1f159e='';var _0x12e5dd='';var _0x4dc328={};var _0x1967bf='';return db[_0xb8fa('0x3b')]['findOne']({'where':{'id':_0x107ce9[_0xb8fa('0x40')]['id']},'attributes':['id',_0xb8fa('0x90'),_0xb8fa('0x91'),_0xb8fa('0x92'),'remoteUri',_0xb8fa('0x93')]})[_0xb8fa('0x25')](handleEntityNotFound(_0x338954,null))[_0xb8fa('0x25')](function(_0x4ec60e){if(_0x4ec60e){_0x1967bf=_0x4ec60e[_0xb8fa('0x94')];var _0x3dc134=_0x1967bf[_0xb8fa('0x95')](-0x1);if(_0x3dc134==='/'){_0x1967bf=_0x1967bf[_0xb8fa('0x96')](0x0,_0x1967bf[_0xb8fa('0x97')](_0x3dc134));}_0x12e5dd=util[_0xb8fa('0x98')](_0xb8fa('0x99'),_0x1967bf);_0x1f159e=util[_0xb8fa('0x98')]('%s/api/now/table/',_0x1967bf);_0x4dc328={'user':_0x4ec60e[_0xb8fa('0x90')],'pass':_0x4ec60e[_0xb8fa('0x91')]};var _0xea24c1={'method':_0xb8fa('0x9a'),'uri':_0x12e5dd+_0xb8fa('0x9b'),'auth':_0x4dc328,'json':!![]};return rp(_0xea24c1);}})[_0xb8fa('0x25')](function(_0x989267){if(_0x989267[_0xb8fa('0x9c')][_0xb8fa('0x41')]>0x0){_0x3c539d=_0x989267[_0xb8fa('0x9c')];}console['log'](_0xb8fa('0x9d'),_0x3c539d);_0x6317fc=[];_0x20464a=Object['assign']([],_0x3c539d);_[_0xb8fa('0x9e')](_0x20464a,function(_0xe2babf){return!_0x1c5452[_0xb8fa('0x9f')](_0xe2babf['name']);});_0x20464a[_0xb8fa('0xa0')](function(_0x5c6bf2){var _0x29d35e=createFieldObject(_0x1f159e,_0x4dc328,_0x5c6bf2[_0xb8fa('0xa1')],_0x5c6bf2[_0xb8fa('0x29')],_0x5c6bf2[_0xb8fa('0xa2')],![]);_0x6317fc[_0xb8fa('0xa3')](_0x29d35e);});return Promise[_0xb8fa('0xa4')](_0x6317fc);})[_0xb8fa('0x25')](function(_0x1fb348){_0x90d55a=_0x1fb348;_0x48f081=Object[_0xb8fa('0xa5')]([],_0x3c539d);console['log'](_0xb8fa('0xa6'),_0x3c539d);_[_0xb8fa('0x9e')](_0x48f081,function(_0x153c31){return _0x1926bc[_0xb8fa('0x9f')](_0x153c31['name']);});console[_0xb8fa('0xa7')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x48f081);_0x6317fc=[];_0x48f081['forEach'](function(_0x53c3de){var _0x117b25=createFieldObject(_0x1f159e,_0x4dc328,_0x53c3de[_0xb8fa('0xa1')],_0x53c3de[_0xb8fa('0x29')],_0x53c3de['label'],!![]);_0x6317fc[_0xb8fa('0xa3')](_0x117b25);});return Promise[_0xb8fa('0xa4')](_0x6317fc);})['then'](function(_0x280e72){_0xc047b5=_0x280e72;var _0x2c4757=_0x90d55a[_0xb8fa('0xa8')](_0xc047b5);return{'count':_0x2c4757[_0xb8fa('0x41')],'rows':_0x2c4757};})['then'](respondWithResult(_0x338954,null))['catch'](function(_0x3dc579){console['log'](_0xb8fa('0xa9')+_0x3dc579);var _0x32f29e=_0x107ce9[_0xb8fa('0x2d')]['test']?0x1f4:_0x3dc579[_0xb8fa('0xaa')]||0x1f4;logger[_0xb8fa('0x28')](_0x3dc579['stack']);delete _0x3dc579['name'];if(_0x32f29e===0x191){_0x32f29e=0x190;}_0x338954[_0xb8fa('0x1b')](_0x32f29e)[_0xb8fa('0x2a')](_0x107ce9['query'][_0xb8fa('0xab')]?{'message':_0xb8fa('0xac'),'statusCode':_0x3dc579[_0xb8fa('0xaa')]}:_0x3dc579);});};function createFieldObject(_0x346ac5,_0x1789b0,_0x3fba4e,_0x350d0d,_0x34e031,_0x2d4e9d){return new Promise(function(_0x58df4b,_0x18a879){var _0x28ee13={'id':_0x350d0d,'name':_0x34e031,'custom':_0x2d4e9d};if(_0x3fba4e==='boolean'){_0x28ee13[_0xb8fa('0x3a')]=[{'name':_0xb8fa('0xad'),'value':_0xb8fa('0xae')},{'name':'False','value':'false'}];_0x58df4b(_0x28ee13);}else{var _0x33707b={'method':_0xb8fa('0x9a'),'uri':_0x346ac5+_0xb8fa('0xaf')+_0x350d0d,'auth':_0x1789b0,'json':!![]};return rp(_0x33707b)[_0xb8fa('0x25')](function(_0x21261c){var _0x56fa57=[];if(_0x21261c[_0xb8fa('0x9c')][_0xb8fa('0x41')]>0x0){_0x21261c[_0xb8fa('0x9c')][_0xb8fa('0xa0')](function(_0x3ffabb){if(_0x3ffabb[_0xb8fa('0xb0')]===_0xb8fa('0xb1')){var _0x2dad18={'name':_0x3ffabb[_0xb8fa('0xa2')],'value':_0x3ffabb['value']};_0x56fa57[_0xb8fa('0xa3')](_0x2dad18);}});}_0x28ee13[_0xb8fa('0x3a')]=_0x56fa57;if(_0x28ee13['options'][_0xb8fa('0x41')]>0x0){_0x58df4b(_0x28ee13);}else{if(_0x2d4e9d==![]){_0x58df4b();}else{_0x58df4b(_0x28ee13);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 41394de..7203a2f 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 _0xeda8=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x47607c,_0x12f277){var _0x2e658e=function(_0x124330){while(--_0x124330){_0x47607c['push'](_0x47607c['shift']());}};_0x2e658e(++_0x12f277);}(_0xeda8,0x104));var _0x8eda=function(_0x40130b,_0x55f5f3){_0x40130b=_0x40130b-0x0;var _0x2d7dae=_0xeda8[_0x40130b];return _0x2d7dae;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));var integrations=require(_0x8eda('0xa'));module[_0x8eda('0xb')]=function(_0x349361,_0x32abe8){return _0x349361['define'](_0x8eda('0xc'),attributes,{'tableName':_0x8eda('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3da=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api'];(function(_0x3123d7,_0x20d651){var _0x5ec935=function(_0x563ee3){while(--_0x563ee3){_0x3123d7['push'](_0x3123d7['shift']());}};_0x5ec935(++_0x20d651);}(_0xe3da,0x1cd));var _0xae3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe3da[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));var integrations=require(_0xae3d('0xb'));module[_0xae3d('0xc')]=function(_0xa54808,_0x476579){return _0xa54808[_0xae3d('0xd')]('ServicenowAccount',attributes,{'tableName':_0xae3d('0xe'),'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 5bd94e9..9e2827d 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 _0xc1e8=['attributes','limit','include','model','map','ShowServicenowAccount','find','info','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where'];(function(_0x10e6ea,_0x508ca4){var _0x12e721=function(_0x243966){while(--_0x243966){_0x10e6ea['push'](_0x10e6ea['shift']());}};_0x12e721(++_0x508ca4);}(_0xc1e8,0x118));var _0x8c1e=function(_0x4acfd2,_0x5b9374){_0x4acfd2=_0x4acfd2-0x0;var _0x12afbe=_0xc1e8[_0x4acfd2];return _0x12afbe;};'use strict';var _=require('lodash');var util=require(_0x8c1e('0x0'));var moment=require(_0x8c1e('0x1'));var BPromise=require(_0x8c1e('0x2'));var rs=require(_0x8c1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8c1e('0x4'));var logger=require('../../config/logger')(_0x8c1e('0x5'));var config=require(_0x8c1e('0x6'));var jayson=require(_0x8c1e('0x7'));var client=jayson[_0x8c1e('0x8')][_0x8c1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29305c,_0x2ca07c,_0x22659a){return new BPromise(function(_0x1db51b,_0x31d274){return client[_0x8c1e('0xa')](_0x29305c,_0x22659a)['then'](function(_0x13da69){logger['info'](_0x8c1e('0xb'),_0x2ca07c,_0x8c1e('0xc'));logger[_0x8c1e('0xd')](_0x8c1e('0xe'),_0x2ca07c,'request\x20sent',JSON[_0x8c1e('0xf')](_0x13da69));if(_0x13da69[_0x8c1e('0x10')]){if(_0x13da69[_0x8c1e('0x10')]['code']===0x1f4){logger[_0x8c1e('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x2ca07c,_0x13da69[_0x8c1e('0x10')]['message']);return _0x31d274(_0x13da69[_0x8c1e('0x10')][_0x8c1e('0x11')]);}logger['error'](_0x8c1e('0xb'),_0x2ca07c,_0x13da69[_0x8c1e('0x10')][_0x8c1e('0x11')]);return _0x1db51b(_0x13da69[_0x8c1e('0x10')][_0x8c1e('0x11')]);}else{logger['info'](_0x8c1e('0xb'),_0x2ca07c,_0x8c1e('0xc'));_0x1db51b(_0x13da69[_0x8c1e('0x12')][_0x8c1e('0x11')]);}})[_0x8c1e('0x13')](function(_0x5bd9a8){logger[_0x8c1e('0x10')](_0x8c1e('0xb'),_0x2ca07c,_0x5bd9a8);_0x31d274(_0x5bd9a8);});});}exports[_0x8c1e('0x14')]=function(_0x3571d4){var _0x31cdbc=this;return new Promise(function(_0x4466d9,_0x1bc3ab){return db[_0x8c1e('0x15')][_0x8c1e('0x16')]({'raw':_0x3571d4[_0x8c1e('0x17')]?_0x3571d4[_0x8c1e('0x17')][_0x8c1e('0x18')]===undefined?!![]:![]:!![],'where':_0x3571d4[_0x8c1e('0x17')]?_0x3571d4[_0x8c1e('0x17')][_0x8c1e('0x19')]||null:null,'attributes':_0x3571d4[_0x8c1e('0x17')]?_0x3571d4['options'][_0x8c1e('0x1a')]||null:null,'limit':_0x3571d4['options']?_0x3571d4['options'][_0x8c1e('0x1b')]||null:null,'include':_0x3571d4[_0x8c1e('0x17')]?_0x3571d4[_0x8c1e('0x17')]['include']?_['map'](_0x3571d4['options'][_0x8c1e('0x1c')],function(_0x43b3b0){return{'model':db[_0x43b3b0[_0x8c1e('0x1d')]],'as':_0x43b3b0['as'],'attributes':_0x43b3b0['attributes'],'include':_0x43b3b0[_0x8c1e('0x1c')]?_[_0x8c1e('0x1e')](_0x43b3b0[_0x8c1e('0x1c')],function(_0x3c84f4){return{'model':db[_0x3c84f4[_0x8c1e('0x1d')]],'as':_0x3c84f4['as'],'attributes':_0x3c84f4[_0x8c1e('0x1a')],'include':_0x3c84f4[_0x8c1e('0x1c')]?_[_0x8c1e('0x1e')](_0x3c84f4[_0x8c1e('0x1c')],function(_0x3c954a){return{'model':db[_0x3c954a['model']],'as':_0x3c954a['as'],'attributes':_0x3c954a[_0x8c1e('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x321226){logger['info'](_0x8c1e('0x14'),_0x3571d4);logger[_0x8c1e('0xd')]('GetServicenowAccount',_0x3571d4,JSON[_0x8c1e('0xf')](_0x321226));_0x4466d9(_0x321226);})[_0x8c1e('0x13')](function(_0x24c1cf){logger[_0x8c1e('0x10')](_0x8c1e('0x14'),_0x24c1cf[_0x8c1e('0x11')],_0x3571d4);_0x1bc3ab(_0x31cdbc[_0x8c1e('0x10')](0x1f4,_0x24c1cf[_0x8c1e('0x11')]));});});};exports[_0x8c1e('0x1f')]=function(_0xb92983){var _0x561c42=this;return new Promise(function(_0x1cdb70,_0x2454a6){return db[_0x8c1e('0x15')][_0x8c1e('0x20')]({'raw':_0xb92983[_0x8c1e('0x17')]?_0xb92983['options'][_0x8c1e('0x18')]===undefined?!![]:![]:!![],'where':_0xb92983[_0x8c1e('0x17')]?_0xb92983[_0x8c1e('0x17')][_0x8c1e('0x19')]||null:null,'attributes':_0xb92983[_0x8c1e('0x17')]?_0xb92983[_0x8c1e('0x17')][_0x8c1e('0x1a')]||null:null,'include':_0xb92983[_0x8c1e('0x17')]?_0xb92983[_0x8c1e('0x17')][_0x8c1e('0x1c')]?_[_0x8c1e('0x1e')](_0xb92983['options'][_0x8c1e('0x1c')],function(_0x736fae){return{'model':db[_0x736fae['model']],'as':_0x736fae['as'],'attributes':_0x736fae[_0x8c1e('0x1a')],'include':_0x736fae['include']?_[_0x8c1e('0x1e')](_0x736fae[_0x8c1e('0x1c')],function(_0x11e162){return{'model':db[_0x11e162[_0x8c1e('0x1d')]],'as':_0x11e162['as'],'attributes':_0x11e162['attributes'],'include':_0x11e162[_0x8c1e('0x1c')]?_['map'](_0x11e162[_0x8c1e('0x1c')],function(_0xdc64d8){return{'model':db[_0xdc64d8['model']],'as':_0xdc64d8['as'],'attributes':_0xdc64d8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x45eddb){logger[_0x8c1e('0x21')](_0x8c1e('0x1f'),_0xb92983);logger[_0x8c1e('0xd')](_0x8c1e('0x1f'),_0xb92983,JSON['stringify'](_0x45eddb));_0x1cdb70(_0x45eddb);})[_0x8c1e('0x13')](function(_0x41aca3){logger[_0x8c1e('0x10')](_0x8c1e('0x1f'),_0x41aca3[_0x8c1e('0x11')],_0xb92983);_0x2454a6(_0x561c42[_0x8c1e('0x10')](0x1f4,_0x41aca3['message']));});});}; \ No newline at end of file +var _0x5d4d=['raw','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetServicenowAccount','options','where','attributes','limit','include','model','map','then','find'];(function(_0x20059d,_0x244ac6){var _0x5dad42=function(_0x57c112){while(--_0x57c112){_0x20059d['push'](_0x20059d['shift']());}};_0x5dad42(++_0x244ac6);}(_0x5d4d,0xa7));var _0xd5d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d4d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5d4('0x0'));var util=require(_0xd5d4('0x1'));var moment=require(_0xd5d4('0x2'));var BPromise=require(_0xd5d4('0x3'));var rs=require(_0xd5d4('0x4'));var fs=require('fs');var Redis=require(_0xd5d4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5d4('0x6'));var logger=require(_0xd5d4('0x7'))('rpc');var config=require(_0xd5d4('0x8'));var jayson=require(_0xd5d4('0x9'));var client=jayson['client'][_0xd5d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21ca80,_0x7899fe,_0x33a294){return new BPromise(function(_0x276ea3,_0x509ad9){return client['request'](_0x21ca80,_0x33a294)['then'](function(_0x3cfdc7){logger['info'](_0xd5d4('0xb'),_0x7899fe,'request\x20sent');logger[_0xd5d4('0xc')](_0xd5d4('0xd'),_0x7899fe,'request\x20sent',JSON[_0xd5d4('0xe')](_0x3cfdc7));if(_0x3cfdc7[_0xd5d4('0xf')]){if(_0x3cfdc7[_0xd5d4('0xf')][_0xd5d4('0x10')]===0x1f4){logger[_0xd5d4('0xf')](_0xd5d4('0xb'),_0x7899fe,_0x3cfdc7[_0xd5d4('0xf')][_0xd5d4('0x11')]);return _0x509ad9(_0x3cfdc7['error']['message']);}logger['error'](_0xd5d4('0xb'),_0x7899fe,_0x3cfdc7[_0xd5d4('0xf')][_0xd5d4('0x11')]);return _0x276ea3(_0x3cfdc7[_0xd5d4('0xf')]['message']);}else{logger[_0xd5d4('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x7899fe,'request\x20sent');_0x276ea3(_0x3cfdc7[_0xd5d4('0x13')][_0xd5d4('0x11')]);}})[_0xd5d4('0x14')](function(_0x3d3e87){logger[_0xd5d4('0xf')](_0xd5d4('0xb'),_0x7899fe,_0x3d3e87);_0x509ad9(_0x3d3e87);});});}exports[_0xd5d4('0x15')]=function(_0x582da6){var _0x53080c=this;return new Promise(function(_0x249362,_0x55f124){return db['ServicenowAccount']['findAll']({'raw':_0x582da6[_0xd5d4('0x16')]?_0x582da6[_0xd5d4('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x582da6['options']?_0x582da6['options'][_0xd5d4('0x17')]||null:null,'attributes':_0x582da6[_0xd5d4('0x16')]?_0x582da6[_0xd5d4('0x16')][_0xd5d4('0x18')]||null:null,'limit':_0x582da6[_0xd5d4('0x16')]?_0x582da6['options'][_0xd5d4('0x19')]||null:null,'include':_0x582da6['options']?_0x582da6[_0xd5d4('0x16')][_0xd5d4('0x1a')]?_['map'](_0x582da6[_0xd5d4('0x16')][_0xd5d4('0x1a')],function(_0x1e9830){return{'model':db[_0x1e9830[_0xd5d4('0x1b')]],'as':_0x1e9830['as'],'attributes':_0x1e9830[_0xd5d4('0x18')],'include':_0x1e9830[_0xd5d4('0x1a')]?_[_0xd5d4('0x1c')](_0x1e9830[_0xd5d4('0x1a')],function(_0x4f316a){return{'model':db[_0x4f316a['model']],'as':_0x4f316a['as'],'attributes':_0x4f316a[_0xd5d4('0x18')],'include':_0x4f316a[_0xd5d4('0x1a')]?_[_0xd5d4('0x1c')](_0x4f316a[_0xd5d4('0x1a')],function(_0x9d27ca){return{'model':db[_0x9d27ca[_0xd5d4('0x1b')]],'as':_0x9d27ca['as'],'attributes':_0x9d27ca[_0xd5d4('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd5d4('0x1d')](function(_0x3ee11b){logger['info']('GetServicenowAccount',_0x582da6);logger[_0xd5d4('0xc')]('GetServicenowAccount',_0x582da6,JSON['stringify'](_0x3ee11b));_0x249362(_0x3ee11b);})['catch'](function(_0x4807c1){logger[_0xd5d4('0xf')](_0xd5d4('0x15'),_0x4807c1[_0xd5d4('0x11')],_0x582da6);_0x55f124(_0x53080c[_0xd5d4('0xf')](0x1f4,_0x4807c1[_0xd5d4('0x11')]));});});};exports['ShowServicenowAccount']=function(_0x225e2a){var _0x287e5a=this;return new Promise(function(_0x4b5a09,_0x39d88e){return db['ServicenowAccount'][_0xd5d4('0x1e')]({'raw':_0x225e2a[_0xd5d4('0x16')]?_0x225e2a[_0xd5d4('0x16')][_0xd5d4('0x1f')]===undefined?!![]:![]:!![],'where':_0x225e2a[_0xd5d4('0x16')]?_0x225e2a[_0xd5d4('0x16')][_0xd5d4('0x17')]||null:null,'attributes':_0x225e2a[_0xd5d4('0x16')]?_0x225e2a[_0xd5d4('0x16')][_0xd5d4('0x18')]||null:null,'include':_0x225e2a[_0xd5d4('0x16')]?_0x225e2a['options'][_0xd5d4('0x1a')]?_[_0xd5d4('0x1c')](_0x225e2a[_0xd5d4('0x16')][_0xd5d4('0x1a')],function(_0xdf786){return{'model':db[_0xdf786[_0xd5d4('0x1b')]],'as':_0xdf786['as'],'attributes':_0xdf786[_0xd5d4('0x18')],'include':_0xdf786['include']?_[_0xd5d4('0x1c')](_0xdf786[_0xd5d4('0x1a')],function(_0x1810d6){return{'model':db[_0x1810d6[_0xd5d4('0x1b')]],'as':_0x1810d6['as'],'attributes':_0x1810d6[_0xd5d4('0x18')],'include':_0x1810d6[_0xd5d4('0x1a')]?_[_0xd5d4('0x1c')](_0x1810d6['include'],function(_0x14a4f1){return{'model':db[_0x14a4f1['model']],'as':_0x14a4f1['as'],'attributes':_0x14a4f1[_0xd5d4('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd5d4('0x1d')](function(_0x3539f2){logger['info'](_0xd5d4('0x20'),_0x225e2a);logger[_0xd5d4('0xc')](_0xd5d4('0x20'),_0x225e2a,JSON[_0xd5d4('0xe')](_0x3539f2));_0x4b5a09(_0x3539f2);})[_0xd5d4('0x14')](function(_0x584fbe){logger[_0xd5d4('0xf')](_0xd5d4('0x20'),_0x584fbe[_0xd5d4('0x11')],_0x225e2a);_0x39d88e(_0x287e5a[_0xd5d4('0xf')](0x1f4,_0x584fbe[_0xd5d4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 6d06eb9..a457356 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 _0x3b49=['getSubjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x224202,_0x1705ba){var _0x264f0c=function(_0x58e7dc){while(--_0x58e7dc){_0x224202['push'](_0x224202['shift']());}};_0x264f0c(++_0x1705ba);}(_0x3b49,0x1b7));var _0x93b4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3b49[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x93b4('0x0'));var util=require(_0x93b4('0x1'));var path=require(_0x93b4('0x2'));var timeout=require(_0x93b4('0x3'));var express=require(_0x93b4('0x4'));var router=express[_0x93b4('0x5')]();var fs_extra=require(_0x93b4('0x6'));var auth=require(_0x93b4('0x7'));var interaction=require(_0x93b4('0x8'));var config=require(_0x93b4('0x9'));var controller=require(_0x93b4('0xa'));router[_0x93b4('0xb')]('/',auth[_0x93b4('0xc')](),controller[_0x93b4('0xd')]);router['get'](_0x93b4('0xe'),auth[_0x93b4('0xc')](),controller[_0x93b4('0xf')]);router[_0x93b4('0xb')](_0x93b4('0x10'),auth[_0x93b4('0xc')](),controller['getFields']);router[_0x93b4('0xb')]('/:id/subjects',auth[_0x93b4('0xc')](),controller[_0x93b4('0x11')]);router[_0x93b4('0xb')](_0x93b4('0x12'),auth['isAuthenticated'](),controller[_0x93b4('0x13')]);router['post']('/',auth[_0x93b4('0xc')](),controller['create']);router[_0x93b4('0x14')]('/:id',auth[_0x93b4('0xc')](),controller[_0x93b4('0x15')]);router[_0x93b4('0x16')](_0x93b4('0xe'),auth[_0x93b4('0xc')](),controller[_0x93b4('0x17')]);module['exports']=router; \ No newline at end of file +var _0x90e0=['get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller'];(function(_0x50b7e2,_0xe40aa6){var _0x214daf=function(_0x54e66a){while(--_0x54e66a){_0x50b7e2['push'](_0x50b7e2['shift']());}};_0x214daf(++_0xe40aa6);}(_0x90e0,0xb7));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x090e('0x0'));var util=require('util');var path=require(_0x090e('0x1'));var timeout=require(_0x090e('0x2'));var express=require(_0x090e('0x3'));var router=express['Router']();var fs_extra=require(_0x090e('0x4'));var auth=require(_0x090e('0x5'));var interaction=require(_0x090e('0x6'));var config=require(_0x090e('0x7'));var controller=require(_0x090e('0x8'));router[_0x090e('0x9')]('/',auth[_0x090e('0xa')](),controller[_0x090e('0xb')]);router[_0x090e('0x9')](_0x090e('0xc'),auth[_0x090e('0xa')](),controller[_0x090e('0xd')]);router[_0x090e('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x090e('0xe')]);router[_0x090e('0x9')](_0x090e('0xf'),auth['isAuthenticated'](),controller[_0x090e('0x10')]);router[_0x090e('0x9')](_0x090e('0x11'),auth[_0x090e('0xa')](),controller[_0x090e('0x12')]);router[_0x090e('0x13')]('/',auth['isAuthenticated'](),controller[_0x090e('0x14')]);router[_0x090e('0x15')](_0x090e('0xc'),auth[_0x090e('0xa')](),controller[_0x090e('0x16')]);router[_0x090e('0x17')](_0x090e('0xc'),auth[_0x090e('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 28db5ed..cd4141b 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 _0xbe20=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe20,0xa0));var _0x0be2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbe20[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0be2('0x0')]={'name':{'type':Sequelize[_0x0be2('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc615=['exports','STRING'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xc615,0x194));var _0x5c61=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xc615[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require('sequelize');module[_0x5c61('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5c61('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index fe81222..083f36b 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 _0xa16e=['save','update','destroy','then','sendStatus','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','getFields','ServicenowField','hasOwnProperty','getSubjects','findOne','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x47d27b,_0x44671c){var _0x319246=function(_0x1f86fb){while(--_0x1f86fb){_0x47d27b['push'](_0x47d27b['shift']());}};_0x319246(++_0x44671c);}(_0xa16e,0x131));var _0xea16=function(_0x7247a5,_0xe9205){_0x7247a5=_0x7247a5-0x0;var _0x55daf9=_0xa16e[_0x7247a5];return _0x55daf9;};'use strict';var emlformat=require(_0xea16('0x0'));var rimraf=require(_0xea16('0x1'));var zipdir=require(_0xea16('0x2'));var jsonpatch=require(_0xea16('0x3'));var rp=require(_0xea16('0x4'));var moment=require(_0xea16('0x5'));var BPromise=require(_0xea16('0x6'));var Mustache=require(_0xea16('0x7'));var util=require(_0xea16('0x8'));var path=require(_0xea16('0x9'));var sox=require(_0xea16('0xa'));var csv=require('to-csv');var ejs=require(_0xea16('0xb'));var fs=require('fs');var fs_extra=require(_0xea16('0xc'));var _=require(_0xea16('0xd'));var squel=require(_0xea16('0xe'));var crypto=require(_0xea16('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xea16('0x10'));var toCsv=require(_0xea16('0x11'));var querystring=require(_0xea16('0x12'));var Papa=require('papaparse');var Redis=require(_0xea16('0x13'));var authService=require(_0xea16('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xea16('0x15'));var hardwareService=require(_0xea16('0x16'));var logger=require(_0xea16('0x17'))(_0xea16('0x18'));var utils=require(_0xea16('0x19'));var config=require(_0xea16('0x1a'));var licenseUtil=require(_0xea16('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x287e50,_0x2b40b6){_0x2b40b6=_0x2b40b6||0xcc;return function(_0x8c32c3){if(_0x8c32c3){return _0x287e50['sendStatus'](_0x2b40b6);}return _0x287e50['status'](_0x2b40b6)[_0xea16('0x1c')]();};}function respondWithResult(_0x35b849,_0x3e8a4d){_0x3e8a4d=_0x3e8a4d||0xc8;return function(_0x226546){if(_0x226546){return _0x35b849[_0xea16('0x1d')](_0x3e8a4d)[_0xea16('0x1e')](_0x226546);}};}function respondWithFilteredResult(_0x56d6a1,_0x151bdf){return function(_0x232690){if(_0x232690){var _0x310b6a=typeof _0x151bdf['offset']===_0xea16('0x1f')&&typeof _0x151bdf[_0xea16('0x20')]===_0xea16('0x1f');var _0x33ef67=_0x232690[_0xea16('0x21')];var _0x53f20d=_0x310b6a?0x0:_0x151bdf[_0xea16('0x22')];var _0xae9bbc=_0x310b6a?_0x232690[_0xea16('0x21')]:_0x151bdf[_0xea16('0x22')]+_0x151bdf[_0xea16('0x20')];var _0x4ac5f4;if(_0xae9bbc>=_0x33ef67){_0xae9bbc=_0x33ef67;_0x4ac5f4=0xc8;}else{_0x4ac5f4=0xce;}_0x56d6a1[_0xea16('0x1d')](_0x4ac5f4);return _0x56d6a1[_0xea16('0x23')](_0xea16('0x24'),_0x53f20d+'-'+_0xae9bbc+'/'+_0x33ef67)['json'](_0x232690);}return null;};}function patchUpdates(_0x2f6599){return function(_0x2403bb){try{jsonpatch[_0xea16('0x25')](_0x2403bb,_0x2f6599,!![]);}catch(_0x5dc9bf){return BPromise[_0xea16('0x26')](_0x5dc9bf);}return _0x2403bb[_0xea16('0x27')]();};}function saveUpdates(_0x36bafd,_0x312763){return function(_0x4b7fed){if(_0x4b7fed){return _0x4b7fed[_0xea16('0x28')](_0x36bafd)['then'](function(_0x577cde){return _0x577cde;});}return null;};}function removeEntity(_0x16f5a5,_0x19e2e2){return function(_0x1a1f4e){if(_0x1a1f4e){return _0x1a1f4e[_0xea16('0x29')]()[_0xea16('0x2a')](function(){_0x16f5a5[_0xea16('0x1d')](0xcc)[_0xea16('0x1c')]();});}};}function handleEntityNotFound(_0x5eb1a4,_0x4b9feb){return function(_0x2a7e5e){if(!_0x2a7e5e){_0x5eb1a4[_0xea16('0x2b')](0x194);}return _0x2a7e5e;};}function handleError(_0x3bed7a,_0x5a87be){_0x5a87be=_0x5a87be||0x1f4;return function(_0x38d7f6){logger[_0xea16('0x2c')](_0x38d7f6[_0xea16('0x2d')]);if(_0x38d7f6[_0xea16('0x2e')]){delete _0x38d7f6[_0xea16('0x2e')];}_0x3bed7a[_0xea16('0x1d')](_0x5a87be)['send'](_0x38d7f6);};}exports[_0xea16('0x2f')]=function(_0x1c8990,_0x4d9b53){var _0x3d4c80={},_0x226ba9={},_0x2cb892={'count':0x0,'rows':[]};var _0x59768b=_[_0xea16('0x30')](db[_0xea16('0x31')][_0xea16('0x32')],function(_0x599bf3){return{'name':_0x599bf3[_0xea16('0x33')],'type':_0x599bf3['type']['key']};});_0x226ba9[_0xea16('0x34')]=_[_0xea16('0x30')](_0x59768b,'name');_0x226ba9['query']=_['keys'](_0x1c8990[_0xea16('0x35')]);_0x226ba9[_0xea16('0x36')]=_['intersection'](_0x226ba9[_0xea16('0x34')],_0x226ba9['query']);_0x3d4c80['attributes']=_[_0xea16('0x37')](_0x226ba9[_0xea16('0x34')],qs[_0xea16('0x38')](_0x1c8990[_0xea16('0x35')][_0xea16('0x38')]));_0x3d4c80[_0xea16('0x39')]=_0x3d4c80[_0xea16('0x39')][_0xea16('0x3a')]?_0x3d4c80[_0xea16('0x39')]:_0x226ba9[_0xea16('0x34')];if(!_0x1c8990['query']['hasOwnProperty']('nolimit')){_0x3d4c80['limit']=qs[_0xea16('0x20')](_0x1c8990['query'][_0xea16('0x20')]);_0x3d4c80['offset']=qs[_0xea16('0x22')](_0x1c8990[_0xea16('0x35')][_0xea16('0x22')]);}_0x3d4c80[_0xea16('0x3b')]=qs[_0xea16('0x3c')](_0x1c8990[_0xea16('0x35')][_0xea16('0x3c')]);_0x3d4c80[_0xea16('0x3d')]=qs[_0xea16('0x36')](_[_0xea16('0x3e')](_0x1c8990[_0xea16('0x35')],_0x226ba9['filters']),_0x59768b);if(_0x1c8990[_0xea16('0x35')]['filter']){_0x3d4c80[_0xea16('0x3d')]=_[_0xea16('0x3f')](_0x3d4c80[_0xea16('0x3d')],{'$or':_[_0xea16('0x30')](_0x59768b,function(_0x5c7769){if(_0x5c7769[_0xea16('0x40')]!==_0xea16('0x41')){var _0x18d77d={};_0x18d77d[_0x5c7769[_0xea16('0x2e')]]={'$like':'%'+_0x1c8990[_0xea16('0x35')][_0xea16('0x42')]+'%'};return _0x18d77d;}})});}_0x3d4c80=_['merge']({},_0x3d4c80,_0x1c8990[_0xea16('0x43')]);var _0x2fb685={'where':_0x3d4c80[_0xea16('0x3d')]};return db[_0xea16('0x31')][_0xea16('0x21')](_0x2fb685)[_0xea16('0x2a')](function(_0x51c7be){_0x2cb892['count']=_0x51c7be;if(_0x1c8990[_0xea16('0x35')][_0xea16('0x44')]){_0x3d4c80[_0xea16('0x45')]=[{'all':!![]}];}return db[_0xea16('0x31')][_0xea16('0x46')](_0x3d4c80);})[_0xea16('0x2a')](function(_0x535cb3){_0x2cb892[_0xea16('0x47')]=_0x535cb3;return _0x2cb892;})[_0xea16('0x2a')](respondWithFilteredResult(_0x4d9b53,_0x3d4c80))[_0xea16('0x48')](handleError(_0x4d9b53,null));};exports[_0xea16('0x49')]=function(_0x3e551b,_0x4db3c4){var _0x1fe039={'raw':![],'where':{'id':_0x3e551b['params']['id']}},_0x32f98c={};_0x32f98c['model']=_[_0xea16('0x4a')](db['ServicenowConfiguration'][_0xea16('0x32')]);_0x32f98c['query']=_[_0xea16('0x4a')](_0x3e551b['query']);_0x32f98c[_0xea16('0x36')]=_[_0xea16('0x37')](_0x32f98c['model'],_0x32f98c['query']);_0x1fe039['attributes']=_[_0xea16('0x37')](_0x32f98c[_0xea16('0x34')],qs[_0xea16('0x38')](_0x3e551b[_0xea16('0x35')][_0xea16('0x38')]));_0x1fe039[_0xea16('0x39')]=_0x1fe039[_0xea16('0x39')][_0xea16('0x3a')]?_0x1fe039[_0xea16('0x39')]:_0x32f98c['model'];if(_0x3e551b[_0xea16('0x35')][_0xea16('0x44')]){_0x1fe039['include']=[{'all':!![]}];}_0x1fe039=_['merge']({},_0x1fe039,_0x3e551b[_0xea16('0x43')]);return db[_0xea16('0x31')][_0xea16('0x4b')](_0x1fe039)['then'](handleEntityNotFound(_0x4db3c4,null))[_0xea16('0x2a')](respondWithResult(_0x4db3c4,null))[_0xea16('0x48')](handleError(_0x4db3c4,null));};exports[_0xea16('0x4c')]=function(_0x401cb3,_0x2efa2f){return db['ServicenowConfiguration']['create'](_0x401cb3[_0xea16('0x4d')],{})['then'](respondWithResult(_0x2efa2f,0xc9))['catch'](handleError(_0x2efa2f,null));};exports['update']=function(_0x5c31dd,_0x568b1d){if(_0x5c31dd['body']['id']){delete _0x5c31dd[_0xea16('0x4d')]['id'];}return db['ServicenowConfiguration'][_0xea16('0x4b')]({'where':{'id':_0x5c31dd['params']['id']}})[_0xea16('0x2a')](handleEntityNotFound(_0x568b1d,null))[_0xea16('0x2a')](saveUpdates(_0x5c31dd['body'],null))[_0xea16('0x2a')](respondWithResult(_0x568b1d,null))[_0xea16('0x48')](handleError(_0x568b1d,null));};exports[_0xea16('0x29')]=function(_0x5dffee,_0x4fa634){return db[_0xea16('0x31')][_0xea16('0x4b')]({'where':{'id':_0x5dffee[_0xea16('0x4e')]['id']}})[_0xea16('0x2a')](handleEntityNotFound(_0x4fa634,null))['then'](removeEntity(_0x4fa634,null))[_0xea16('0x48')](handleError(_0x4fa634,null));};exports[_0xea16('0x4f')]=function(_0x27ead7,_0x15e8ee,_0x1941f9){var _0x2bc4ec={};var _0x1c1ad0={};var _0x1531b4;var _0x197a18;return db[_0xea16('0x31')]['findOne']({'where':{'id':_0x27ead7['params']['id']}})[_0xea16('0x2a')](handleEntityNotFound(_0x15e8ee,null))[_0xea16('0x2a')](function(_0x120a23){if(_0x120a23){_0x1531b4=_0x120a23;_0x1c1ad0[_0xea16('0x34')]=_[_0xea16('0x4a')](db[_0xea16('0x50')][_0xea16('0x32')]);_0x1c1ad0['query']=_['keys'](_0x27ead7[_0xea16('0x35')]);_0x1c1ad0[_0xea16('0x36')]=_['intersection'](_0x1c1ad0[_0xea16('0x34')],_0x1c1ad0[_0xea16('0x35')]);_0x2bc4ec[_0xea16('0x39')]=_[_0xea16('0x37')](_0x1c1ad0[_0xea16('0x34')],qs['fields'](_0x27ead7[_0xea16('0x35')]['fields']));_0x2bc4ec[_0xea16('0x39')]=_0x2bc4ec[_0xea16('0x39')][_0xea16('0x3a')]?_0x2bc4ec['attributes']:_0x1c1ad0[_0xea16('0x34')];_0x2bc4ec[_0xea16('0x3b')]=qs[_0xea16('0x3c')](_0x27ead7['query'][_0xea16('0x3c')]);_0x2bc4ec['where']=qs[_0xea16('0x36')](_[_0xea16('0x3e')](_0x27ead7[_0xea16('0x35')],_0x1c1ad0['filters']));if(_0x27ead7[_0xea16('0x35')][_0xea16('0x42')]){_0x2bc4ec['where']=_[_0xea16('0x3f')](_0x2bc4ec['where'],{'$or':_[_0xea16('0x30')](_0x2bc4ec['attributes'],function(_0x2aa7a8){var _0x1a51df={};_0x1a51df[_0x2aa7a8]={'$like':'%'+_0x27ead7['query'][_0xea16('0x42')]+'%'};return _0x1a51df;})});}_0x2bc4ec=_[_0xea16('0x3f')]({},_0x2bc4ec,_0x27ead7[_0xea16('0x43')]);return _0x1531b4[_0xea16('0x4f')](_0x2bc4ec);}})[_0xea16('0x2a')](function(_0x4d5dac){if(_0x4d5dac){_0x197a18=_0x4d5dac[_0xea16('0x3a')];if(!_0x27ead7[_0xea16('0x35')][_0xea16('0x51')]('nolimit')){_0x2bc4ec[_0xea16('0x20')]=qs[_0xea16('0x20')](_0x27ead7[_0xea16('0x35')]['limit']);_0x2bc4ec[_0xea16('0x22')]=qs[_0xea16('0x22')](_0x27ead7['query'][_0xea16('0x22')]);}return _0x1531b4[_0xea16('0x4f')](_0x2bc4ec);}})[_0xea16('0x2a')](function(_0x4a32a7){if(_0x4a32a7){return _0x4a32a7?{'count':_0x197a18,'rows':_0x4a32a7}:null;}})[_0xea16('0x2a')](respondWithResult(_0x15e8ee,null))[_0xea16('0x48')](handleError(_0x15e8ee,null));};exports[_0xea16('0x52')]=function(_0x3c4a97,_0x263e6c,_0x1baecc){var _0x4dbbf8={};var _0x32e789={};var _0x538b22;var _0x2efd01;return db[_0xea16('0x31')][_0xea16('0x53')]({'where':{'id':_0x3c4a97[_0xea16('0x4e')]['id']}})[_0xea16('0x2a')](handleEntityNotFound(_0x263e6c,null))[_0xea16('0x2a')](function(_0x1a68b2){if(_0x1a68b2){_0x538b22=_0x1a68b2;_0x32e789[_0xea16('0x34')]=_[_0xea16('0x4a')](db[_0xea16('0x50')]['rawAttributes']);_0x32e789[_0xea16('0x35')]=_[_0xea16('0x4a')](_0x3c4a97['query']);_0x32e789[_0xea16('0x36')]=_['intersection'](_0x32e789[_0xea16('0x34')],_0x32e789[_0xea16('0x35')]);_0x4dbbf8['attributes']=_['intersection'](_0x32e789[_0xea16('0x34')],qs['fields'](_0x3c4a97[_0xea16('0x35')]['fields']));_0x4dbbf8['attributes']=_0x4dbbf8[_0xea16('0x39')][_0xea16('0x3a')]?_0x4dbbf8['attributes']:_0x32e789[_0xea16('0x34')];_0x4dbbf8['order']=qs['sort'](_0x3c4a97['query'][_0xea16('0x3c')]);_0x4dbbf8[_0xea16('0x3d')]=qs['filters'](_['pick'](_0x3c4a97[_0xea16('0x35')],_0x32e789[_0xea16('0x36')]));if(_0x3c4a97[_0xea16('0x35')]['filter']){_0x4dbbf8[_0xea16('0x3d')]=_[_0xea16('0x3f')](_0x4dbbf8[_0xea16('0x3d')],{'$or':_[_0xea16('0x30')](_0x4dbbf8[_0xea16('0x39')],function(_0x310763){var _0x3c45bd={};_0x3c45bd[_0x310763]={'$like':'%'+_0x3c4a97[_0xea16('0x35')][_0xea16('0x42')]+'%'};return _0x3c45bd;})});}_0x4dbbf8=_[_0xea16('0x3f')]({},_0x4dbbf8,_0x3c4a97[_0xea16('0x43')]);return _0x538b22[_0xea16('0x52')](_0x4dbbf8);}})[_0xea16('0x2a')](function(_0x3fda4d){if(_0x3fda4d){_0x2efd01=_0x3fda4d[_0xea16('0x3a')];if(!_0x3c4a97['query'][_0xea16('0x51')](_0xea16('0x54'))){_0x4dbbf8[_0xea16('0x20')]=qs[_0xea16('0x20')](_0x3c4a97[_0xea16('0x35')][_0xea16('0x20')]);_0x4dbbf8[_0xea16('0x22')]=qs['offset'](_0x3c4a97[_0xea16('0x35')][_0xea16('0x22')]);}return _0x538b22[_0xea16('0x52')](_0x4dbbf8);}})[_0xea16('0x2a')](function(_0x2a69f6){if(_0x2a69f6){return _0x2a69f6?{'count':_0x2efd01,'rows':_0x2a69f6}:null;}})[_0xea16('0x2a')](respondWithResult(_0x263e6c,null))['catch'](handleError(_0x263e6c,null));};exports[_0xea16('0x55')]=function(_0x2e7a23,_0x597e50,_0x492f4e){var _0x5d5f78={};var _0x3e4084={};var _0x5555bf;var _0x2af9a8;return db[_0xea16('0x31')]['findOne']({'where':{'id':_0x2e7a23['params']['id']}})[_0xea16('0x2a')](handleEntityNotFound(_0x597e50,null))[_0xea16('0x2a')](function(_0x50f9d6){if(_0x50f9d6){_0x5555bf=_0x50f9d6;_0x3e4084[_0xea16('0x34')]=_[_0xea16('0x4a')](db['ServicenowField'][_0xea16('0x32')]);_0x3e4084['query']=_[_0xea16('0x4a')](_0x2e7a23[_0xea16('0x35')]);_0x3e4084[_0xea16('0x36')]=_[_0xea16('0x37')](_0x3e4084[_0xea16('0x34')],_0x3e4084[_0xea16('0x35')]);_0x5d5f78[_0xea16('0x39')]=_[_0xea16('0x37')](_0x3e4084['model'],qs[_0xea16('0x38')](_0x2e7a23['query'][_0xea16('0x38')]));_0x5d5f78['attributes']=_0x5d5f78[_0xea16('0x39')][_0xea16('0x3a')]?_0x5d5f78['attributes']:_0x3e4084[_0xea16('0x34')];_0x5d5f78['order']=qs[_0xea16('0x3c')](_0x2e7a23[_0xea16('0x35')][_0xea16('0x3c')]);_0x5d5f78[_0xea16('0x3d')]=qs[_0xea16('0x36')](_[_0xea16('0x3e')](_0x2e7a23['query'],_0x3e4084[_0xea16('0x36')]));if(_0x2e7a23['query'][_0xea16('0x42')]){_0x5d5f78[_0xea16('0x3d')]=_[_0xea16('0x3f')](_0x5d5f78['where'],{'$or':_[_0xea16('0x30')](_0x5d5f78['attributes'],function(_0x3bc7c7){var _0x1b97ea={};_0x1b97ea[_0x3bc7c7]={'$like':'%'+_0x2e7a23['query'][_0xea16('0x42')]+'%'};return _0x1b97ea;})});}_0x5d5f78=_[_0xea16('0x3f')]({},_0x5d5f78,_0x2e7a23[_0xea16('0x43')]);return _0x5555bf[_0xea16('0x55')](_0x5d5f78);}})[_0xea16('0x2a')](function(_0x4dbf70){if(_0x4dbf70){_0x2af9a8=_0x4dbf70[_0xea16('0x3a')];if(!_0x2e7a23['query'][_0xea16('0x51')](_0xea16('0x54'))){_0x5d5f78[_0xea16('0x20')]=qs[_0xea16('0x20')](_0x2e7a23[_0xea16('0x35')][_0xea16('0x20')]);_0x5d5f78['offset']=qs['offset'](_0x2e7a23['query'][_0xea16('0x22')]);}return _0x5555bf[_0xea16('0x55')](_0x5d5f78);}})['then'](function(_0x57d192){if(_0x57d192){return _0x57d192?{'count':_0x2af9a8,'rows':_0x57d192}:null;}})[_0xea16('0x2a')](respondWithResult(_0x597e50,null))[_0xea16('0x48')](handleError(_0x597e50,null));}; \ No newline at end of file +var _0x2e58=['name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','ServicenowField','order','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack'];(function(_0x3b76f7,_0x566c53){var _0x43984e=function(_0x164f77){while(--_0x164f77){_0x3b76f7['push'](_0x3b76f7['shift']());}};_0x43984e(++_0x566c53);}(_0x2e58,0x79));var _0x82e5=function(_0xf6268a,_0x4d2a75){_0xf6268a=_0xf6268a-0x0;var _0x479dbd=_0x2e58[_0xf6268a];return _0x479dbd;};'use strict';var emlformat=require(_0x82e5('0x0'));var rimraf=require(_0x82e5('0x1'));var zipdir=require(_0x82e5('0x2'));var jsonpatch=require(_0x82e5('0x3'));var rp=require(_0x82e5('0x4'));var moment=require(_0x82e5('0x5'));var BPromise=require(_0x82e5('0x6'));var Mustache=require('mustache');var util=require(_0x82e5('0x7'));var path=require(_0x82e5('0x8'));var sox=require(_0x82e5('0x9'));var csv=require(_0x82e5('0xa'));var ejs=require(_0x82e5('0xb'));var fs=require('fs');var fs_extra=require(_0x82e5('0xc'));var _=require(_0x82e5('0xd'));var squel=require('squel');var crypto=require(_0x82e5('0xe'));var jsforce=require(_0x82e5('0xf'));var deskjs=require(_0x82e5('0x10'));var toCsv=require(_0x82e5('0xa'));var querystring=require(_0x82e5('0x11'));var Papa=require(_0x82e5('0x12'));var Redis=require('ioredis');var authService=require(_0x82e5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82e5('0x14'));var logger=require('../../config/logger')(_0x82e5('0x15'));var utils=require('../../config/utils');var config=require(_0x82e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x82e5('0x17'))['db'];function respondWithStatusCode(_0x4a4dec,_0x9dd361){_0x9dd361=_0x9dd361||0xcc;return function(_0x8b5892){if(_0x8b5892){return _0x4a4dec[_0x82e5('0x18')](_0x9dd361);}return _0x4a4dec[_0x82e5('0x19')](_0x9dd361)[_0x82e5('0x1a')]();};}function respondWithResult(_0x20d989,_0x4c096d){_0x4c096d=_0x4c096d||0xc8;return function(_0x5e91d1){if(_0x5e91d1){return _0x20d989[_0x82e5('0x19')](_0x4c096d)[_0x82e5('0x1b')](_0x5e91d1);}};}function respondWithFilteredResult(_0x11324b,_0x343ce6){return function(_0x20802c){if(_0x20802c){var _0x557337=typeof _0x343ce6[_0x82e5('0x1c')]===_0x82e5('0x1d')&&typeof _0x343ce6[_0x82e5('0x1e')]==='undefined';var _0x533b3b=_0x20802c[_0x82e5('0x1f')];var _0x5eb889=_0x557337?0x0:_0x343ce6['offset'];var _0x26e7fd=_0x557337?_0x20802c[_0x82e5('0x1f')]:_0x343ce6[_0x82e5('0x1c')]+_0x343ce6[_0x82e5('0x1e')];var _0xf4b53e;if(_0x26e7fd>=_0x533b3b){_0x26e7fd=_0x533b3b;_0xf4b53e=0xc8;}else{_0xf4b53e=0xce;}_0x11324b[_0x82e5('0x19')](_0xf4b53e);return _0x11324b[_0x82e5('0x20')]('Content-Range',_0x5eb889+'-'+_0x26e7fd+'/'+_0x533b3b)['json'](_0x20802c);}return null;};}function patchUpdates(_0x5c7b02){return function(_0x3609cb){try{jsonpatch[_0x82e5('0x21')](_0x3609cb,_0x5c7b02,!![]);}catch(_0x2e0570){return BPromise[_0x82e5('0x22')](_0x2e0570);}return _0x3609cb[_0x82e5('0x23')]();};}function saveUpdates(_0x5a6b4c,_0x3cd89f){return function(_0x425dd3){if(_0x425dd3){return _0x425dd3[_0x82e5('0x24')](_0x5a6b4c)['then'](function(_0x34426b){return _0x34426b;});}return null;};}function removeEntity(_0x2a041e,_0xcca52f){return function(_0x4fe9c9){if(_0x4fe9c9){return _0x4fe9c9[_0x82e5('0x25')]()[_0x82e5('0x26')](function(){_0x2a041e[_0x82e5('0x19')](0xcc)[_0x82e5('0x1a')]();});}};}function handleEntityNotFound(_0x4498f9,_0x211967){return function(_0x497ed8){if(!_0x497ed8){_0x4498f9[_0x82e5('0x18')](0x194);}return _0x497ed8;};}function handleError(_0x344c01,_0x36d4be){_0x36d4be=_0x36d4be||0x1f4;return function(_0x59aacf){logger[_0x82e5('0x27')](_0x59aacf[_0x82e5('0x28')]);if(_0x59aacf[_0x82e5('0x29')]){delete _0x59aacf[_0x82e5('0x29')];}_0x344c01[_0x82e5('0x19')](_0x36d4be)[_0x82e5('0x2a')](_0x59aacf);};}exports[_0x82e5('0x2b')]=function(_0x28a3ac,_0x5551c2){var _0x5c1297={},_0x57e887={},_0x40915b={'count':0x0,'rows':[]};var _0x224daa=_[_0x82e5('0x2c')](db[_0x82e5('0x2d')][_0x82e5('0x2e')],function(_0x6bcf34){return{'name':_0x6bcf34[_0x82e5('0x2f')],'type':_0x6bcf34[_0x82e5('0x30')]['key']};});_0x57e887['model']=_[_0x82e5('0x2c')](_0x224daa,'name');_0x57e887['query']=_[_0x82e5('0x31')](_0x28a3ac['query']);_0x57e887[_0x82e5('0x32')]=_[_0x82e5('0x33')](_0x57e887[_0x82e5('0x34')],_0x57e887[_0x82e5('0x35')]);_0x5c1297['attributes']=_['intersection'](_0x57e887[_0x82e5('0x34')],qs[_0x82e5('0x36')](_0x28a3ac['query'][_0x82e5('0x36')]));_0x5c1297[_0x82e5('0x37')]=_0x5c1297[_0x82e5('0x37')][_0x82e5('0x38')]?_0x5c1297[_0x82e5('0x37')]:_0x57e887['model'];if(!_0x28a3ac[_0x82e5('0x35')][_0x82e5('0x39')](_0x82e5('0x3a'))){_0x5c1297[_0x82e5('0x1e')]=qs[_0x82e5('0x1e')](_0x28a3ac[_0x82e5('0x35')][_0x82e5('0x1e')]);_0x5c1297[_0x82e5('0x1c')]=qs[_0x82e5('0x1c')](_0x28a3ac[_0x82e5('0x35')][_0x82e5('0x1c')]);}_0x5c1297['order']=qs['sort'](_0x28a3ac[_0x82e5('0x35')][_0x82e5('0x3b')]);_0x5c1297['where']=qs[_0x82e5('0x32')](_[_0x82e5('0x3c')](_0x28a3ac[_0x82e5('0x35')],_0x57e887['filters']),_0x224daa);if(_0x28a3ac[_0x82e5('0x35')]['filter']){_0x5c1297['where']=_[_0x82e5('0x3d')](_0x5c1297[_0x82e5('0x3e')],{'$or':_[_0x82e5('0x2c')](_0x224daa,function(_0x23fb4d){if(_0x23fb4d['type']!==_0x82e5('0x3f')){var _0x124693={};_0x124693[_0x23fb4d[_0x82e5('0x29')]]={'$like':'%'+_0x28a3ac[_0x82e5('0x35')]['filter']+'%'};return _0x124693;}})});}_0x5c1297=_[_0x82e5('0x3d')]({},_0x5c1297,_0x28a3ac[_0x82e5('0x40')]);var _0x23222c={'where':_0x5c1297[_0x82e5('0x3e')]};return db[_0x82e5('0x2d')]['count'](_0x23222c)[_0x82e5('0x26')](function(_0x3f368e){_0x40915b['count']=_0x3f368e;if(_0x28a3ac[_0x82e5('0x35')][_0x82e5('0x41')]){_0x5c1297[_0x82e5('0x42')]=[{'all':!![]}];}return db[_0x82e5('0x2d')][_0x82e5('0x43')](_0x5c1297);})[_0x82e5('0x26')](function(_0x200120){_0x40915b[_0x82e5('0x44')]=_0x200120;return _0x40915b;})['then'](respondWithFilteredResult(_0x5551c2,_0x5c1297))[_0x82e5('0x45')](handleError(_0x5551c2,null));};exports['show']=function(_0x114f79,_0x23a80d){var _0x36e701={'raw':![],'where':{'id':_0x114f79[_0x82e5('0x46')]['id']}},_0x656dad={};_0x656dad['model']=_['keys'](db[_0x82e5('0x2d')][_0x82e5('0x2e')]);_0x656dad['query']=_[_0x82e5('0x31')](_0x114f79[_0x82e5('0x35')]);_0x656dad[_0x82e5('0x32')]=_['intersection'](_0x656dad[_0x82e5('0x34')],_0x656dad[_0x82e5('0x35')]);_0x36e701['attributes']=_['intersection'](_0x656dad[_0x82e5('0x34')],qs['fields'](_0x114f79[_0x82e5('0x35')][_0x82e5('0x36')]));_0x36e701[_0x82e5('0x37')]=_0x36e701[_0x82e5('0x37')][_0x82e5('0x38')]?_0x36e701[_0x82e5('0x37')]:_0x656dad['model'];if(_0x114f79[_0x82e5('0x35')][_0x82e5('0x41')]){_0x36e701[_0x82e5('0x42')]=[{'all':!![]}];}_0x36e701=_['merge']({},_0x36e701,_0x114f79[_0x82e5('0x40')]);return db['ServicenowConfiguration'][_0x82e5('0x47')](_0x36e701)[_0x82e5('0x26')](handleEntityNotFound(_0x23a80d,null))[_0x82e5('0x26')](respondWithResult(_0x23a80d,null))['catch'](handleError(_0x23a80d,null));};exports[_0x82e5('0x48')]=function(_0xcfb999,_0x19b427){return db[_0x82e5('0x2d')][_0x82e5('0x48')](_0xcfb999[_0x82e5('0x49')],{})[_0x82e5('0x26')](respondWithResult(_0x19b427,0xc9))[_0x82e5('0x45')](handleError(_0x19b427,null));};exports[_0x82e5('0x24')]=function(_0x28ee1a,_0xa0e570){if(_0x28ee1a[_0x82e5('0x49')]['id']){delete _0x28ee1a['body']['id'];}return db['ServicenowConfiguration'][_0x82e5('0x47')]({'where':{'id':_0x28ee1a['params']['id']}})[_0x82e5('0x26')](handleEntityNotFound(_0xa0e570,null))['then'](saveUpdates(_0x28ee1a[_0x82e5('0x49')],null))[_0x82e5('0x26')](respondWithResult(_0xa0e570,null))[_0x82e5('0x45')](handleError(_0xa0e570,null));};exports[_0x82e5('0x25')]=function(_0x114b3e,_0x572dc1){return db[_0x82e5('0x2d')][_0x82e5('0x47')]({'where':{'id':_0x114b3e[_0x82e5('0x46')]['id']}})[_0x82e5('0x26')](handleEntityNotFound(_0x572dc1,null))[_0x82e5('0x26')](removeEntity(_0x572dc1,null))['catch'](handleError(_0x572dc1,null));};exports[_0x82e5('0x4a')]=function(_0xd0bd3,_0x6fd2a,_0x357fec){var _0x35eafa={};var _0x35447e={};var _0x274cfc;var _0x237d32;return db[_0x82e5('0x2d')][_0x82e5('0x4b')]({'where':{'id':_0xd0bd3['params']['id']}})[_0x82e5('0x26')](handleEntityNotFound(_0x6fd2a,null))['then'](function(_0x204eee){if(_0x204eee){_0x274cfc=_0x204eee;_0x35447e[_0x82e5('0x34')]=_[_0x82e5('0x31')](db[_0x82e5('0x4c')][_0x82e5('0x2e')]);_0x35447e[_0x82e5('0x35')]=_['keys'](_0xd0bd3[_0x82e5('0x35')]);_0x35447e[_0x82e5('0x32')]=_['intersection'](_0x35447e['model'],_0x35447e[_0x82e5('0x35')]);_0x35eafa['attributes']=_[_0x82e5('0x33')](_0x35447e['model'],qs[_0x82e5('0x36')](_0xd0bd3['query']['fields']));_0x35eafa[_0x82e5('0x37')]=_0x35eafa[_0x82e5('0x37')]['length']?_0x35eafa[_0x82e5('0x37')]:_0x35447e[_0x82e5('0x34')];_0x35eafa[_0x82e5('0x4d')]=qs[_0x82e5('0x3b')](_0xd0bd3[_0x82e5('0x35')]['sort']);_0x35eafa[_0x82e5('0x3e')]=qs[_0x82e5('0x32')](_[_0x82e5('0x3c')](_0xd0bd3[_0x82e5('0x35')],_0x35447e[_0x82e5('0x32')]));if(_0xd0bd3[_0x82e5('0x35')][_0x82e5('0x4e')]){_0x35eafa[_0x82e5('0x3e')]=_[_0x82e5('0x3d')](_0x35eafa['where'],{'$or':_[_0x82e5('0x2c')](_0x35eafa[_0x82e5('0x37')],function(_0x4d6202){var _0x40d273={};_0x40d273[_0x4d6202]={'$like':'%'+_0xd0bd3[_0x82e5('0x35')][_0x82e5('0x4e')]+'%'};return _0x40d273;})});}_0x35eafa=_[_0x82e5('0x3d')]({},_0x35eafa,_0xd0bd3[_0x82e5('0x40')]);return _0x274cfc[_0x82e5('0x4a')](_0x35eafa);}})[_0x82e5('0x26')](function(_0x27f16e){if(_0x27f16e){_0x237d32=_0x27f16e[_0x82e5('0x38')];if(!_0xd0bd3[_0x82e5('0x35')][_0x82e5('0x39')]('nolimit')){_0x35eafa['limit']=qs[_0x82e5('0x1e')](_0xd0bd3[_0x82e5('0x35')][_0x82e5('0x1e')]);_0x35eafa[_0x82e5('0x1c')]=qs['offset'](_0xd0bd3['query']['offset']);}return _0x274cfc[_0x82e5('0x4a')](_0x35eafa);}})[_0x82e5('0x26')](function(_0x529d6a){if(_0x529d6a){return _0x529d6a?{'count':_0x237d32,'rows':_0x529d6a}:null;}})[_0x82e5('0x26')](respondWithResult(_0x6fd2a,null))[_0x82e5('0x45')](handleError(_0x6fd2a,null));};exports[_0x82e5('0x4f')]=function(_0xb74347,_0x496ca3,_0x404a62){var _0x384c9b={};var _0x2aab06={};var _0x31d180;var _0x5cd9b2;return db[_0x82e5('0x2d')][_0x82e5('0x4b')]({'where':{'id':_0xb74347[_0x82e5('0x46')]['id']}})[_0x82e5('0x26')](handleEntityNotFound(_0x496ca3,null))['then'](function(_0x500bdb){if(_0x500bdb){_0x31d180=_0x500bdb;_0x2aab06[_0x82e5('0x34')]=_[_0x82e5('0x31')](db[_0x82e5('0x4c')]['rawAttributes']);_0x2aab06['query']=_[_0x82e5('0x31')](_0xb74347['query']);_0x2aab06[_0x82e5('0x32')]=_[_0x82e5('0x33')](_0x2aab06[_0x82e5('0x34')],_0x2aab06['query']);_0x384c9b['attributes']=_[_0x82e5('0x33')](_0x2aab06[_0x82e5('0x34')],qs['fields'](_0xb74347[_0x82e5('0x35')][_0x82e5('0x36')]));_0x384c9b[_0x82e5('0x37')]=_0x384c9b[_0x82e5('0x37')][_0x82e5('0x38')]?_0x384c9b[_0x82e5('0x37')]:_0x2aab06['model'];_0x384c9b[_0x82e5('0x4d')]=qs[_0x82e5('0x3b')](_0xb74347['query'][_0x82e5('0x3b')]);_0x384c9b['where']=qs[_0x82e5('0x32')](_[_0x82e5('0x3c')](_0xb74347['query'],_0x2aab06[_0x82e5('0x32')]));if(_0xb74347[_0x82e5('0x35')]['filter']){_0x384c9b[_0x82e5('0x3e')]=_[_0x82e5('0x3d')](_0x384c9b[_0x82e5('0x3e')],{'$or':_[_0x82e5('0x2c')](_0x384c9b['attributes'],function(_0x1cedc6){var _0x1b2500={};_0x1b2500[_0x1cedc6]={'$like':'%'+_0xb74347['query'][_0x82e5('0x4e')]+'%'};return _0x1b2500;})});}_0x384c9b=_[_0x82e5('0x3d')]({},_0x384c9b,_0xb74347[_0x82e5('0x40')]);return _0x31d180['getSubjects'](_0x384c9b);}})[_0x82e5('0x26')](function(_0x13ae03){if(_0x13ae03){_0x5cd9b2=_0x13ae03[_0x82e5('0x38')];if(!_0xb74347['query']['hasOwnProperty'](_0x82e5('0x3a'))){_0x384c9b[_0x82e5('0x1e')]=qs[_0x82e5('0x1e')](_0xb74347['query'][_0x82e5('0x1e')]);_0x384c9b['offset']=qs[_0x82e5('0x1c')](_0xb74347[_0x82e5('0x35')][_0x82e5('0x1c')]);}return _0x31d180[_0x82e5('0x4f')](_0x384c9b);}})[_0x82e5('0x26')](function(_0x2cc369){if(_0x2cc369){return _0x2cc369?{'count':_0x5cd9b2,'rows':_0x2cc369}:null;}})['then'](respondWithResult(_0x496ca3,null))['catch'](handleError(_0x496ca3,null));};exports[_0x82e5('0x50')]=function(_0x3c26ec,_0x48b294,_0x367bef){var _0x38ea5b={};var _0x4adb85={};var _0x5b279e;var _0xfd532e;return db[_0x82e5('0x2d')][_0x82e5('0x4b')]({'where':{'id':_0x3c26ec[_0x82e5('0x46')]['id']}})['then'](handleEntityNotFound(_0x48b294,null))[_0x82e5('0x26')](function(_0x411152){if(_0x411152){_0x5b279e=_0x411152;_0x4adb85['model']=_[_0x82e5('0x31')](db['ServicenowField']['rawAttributes']);_0x4adb85[_0x82e5('0x35')]=_[_0x82e5('0x31')](_0x3c26ec[_0x82e5('0x35')]);_0x4adb85['filters']=_[_0x82e5('0x33')](_0x4adb85[_0x82e5('0x34')],_0x4adb85[_0x82e5('0x35')]);_0x38ea5b['attributes']=_['intersection'](_0x4adb85['model'],qs[_0x82e5('0x36')](_0x3c26ec[_0x82e5('0x35')][_0x82e5('0x36')]));_0x38ea5b['attributes']=_0x38ea5b[_0x82e5('0x37')]['length']?_0x38ea5b[_0x82e5('0x37')]:_0x4adb85[_0x82e5('0x34')];_0x38ea5b['order']=qs['sort'](_0x3c26ec[_0x82e5('0x35')][_0x82e5('0x3b')]);_0x38ea5b[_0x82e5('0x3e')]=qs[_0x82e5('0x32')](_[_0x82e5('0x3c')](_0x3c26ec['query'],_0x4adb85['filters']));if(_0x3c26ec[_0x82e5('0x35')][_0x82e5('0x4e')]){_0x38ea5b[_0x82e5('0x3e')]=_[_0x82e5('0x3d')](_0x38ea5b['where'],{'$or':_[_0x82e5('0x2c')](_0x38ea5b['attributes'],function(_0x34bf22){var _0x334ddd={};_0x334ddd[_0x34bf22]={'$like':'%'+_0x3c26ec[_0x82e5('0x35')][_0x82e5('0x4e')]+'%'};return _0x334ddd;})});}_0x38ea5b=_['merge']({},_0x38ea5b,_0x3c26ec['options']);return _0x5b279e[_0x82e5('0x50')](_0x38ea5b);}})['then'](function(_0x542d6d){if(_0x542d6d){_0xfd532e=_0x542d6d[_0x82e5('0x38')];if(!_0x3c26ec['query']['hasOwnProperty'](_0x82e5('0x3a'))){_0x38ea5b[_0x82e5('0x1e')]=qs[_0x82e5('0x1e')](_0x3c26ec['query'][_0x82e5('0x1e')]);_0x38ea5b[_0x82e5('0x1c')]=qs[_0x82e5('0x1c')](_0x3c26ec[_0x82e5('0x35')][_0x82e5('0x1c')]);}return _0x5b279e[_0x82e5('0x50')](_0x38ea5b);}})['then'](function(_0x307515){if(_0x307515){return _0x307515?{'count':_0xfd532e,'rows':_0x307515}:null;}})[_0x82e5('0x26')](respondWithResult(_0x48b294,null))[_0x82e5('0x45')](handleError(_0x48b294,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index a9bdaca..dfff144 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 _0xa1cc=['int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./intServicenowConfiguration.attributes','exports'];(function(_0x1ac862,_0xb70bc){var _0x1aab58=function(_0xc1aba5){while(--_0xc1aba5){_0x1ac862['push'](_0x1ac862['shift']());}};_0x1aab58(++_0xb70bc);}(_0xa1cc,0x10f));var _0xca1c=function(_0x4cdb0c,_0xcce858){_0x4cdb0c=_0x4cdb0c-0x0;var _0x48f02d=_0xa1cc[_0x4cdb0c];return _0x48f02d;};'use strict';var _=require(_0xca1c('0x0'));var util=require(_0xca1c('0x1'));var logger=require(_0xca1c('0x2'))('api');var moment=require(_0xca1c('0x3'));var BPromise=require(_0xca1c('0x4'));var rp=require(_0xca1c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca1c('0x6'));var config=require('../../config/environment');var attributes=require(_0xca1c('0x7'));module[_0xca1c('0x8')]=function(_0x375837,_0x98dd5f){return _0x375837['define']('ServicenowConfiguration',attributes,{'tableName':_0xca1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61d0=['rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','bluebird','path'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0x61d0,0x187));var _0x061d=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0x61d0[_0x34232c];return _0x4d4f4e;};'use strict';var _=require(_0x061d('0x0'));var util=require('util');var logger=require(_0x061d('0x1'))(_0x061d('0x2'));var moment=require('moment');var BPromise=require(_0x061d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x061d('0x4'));var rimraf=require(_0x061d('0x5'));var config=require('../../config/environment');var attributes=require(_0x061d('0x6'));module[_0x061d('0x7')]=function(_0x14e976,_0x255478){return _0x14e976[_0x061d('0x8')](_0x061d('0x9'),attributes,{'tableName':_0x061d('0xa'),'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 065723c..a35195b 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 _0x3b64=['code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1d801d,_0x2136a1){var _0x4f81ff=function(_0x4bb819){while(--_0x4bb819){_0x1d801d['push'](_0x1d801d['shift']());}};_0x4f81ff(++_0x2136a1);}(_0x3b64,0x1bd));var _0x43b6=function(_0xabaec7,_0x2b6da7){_0xabaec7=_0xabaec7-0x0;var _0x3af1d6=_0x3b64[_0xabaec7];return _0x3af1d6;};'use strict';var _=require(_0x43b6('0x0'));var util=require(_0x43b6('0x1'));var moment=require(_0x43b6('0x2'));var BPromise=require(_0x43b6('0x3'));var rs=require(_0x43b6('0x4'));var fs=require('fs');var Redis=require(_0x43b6('0x5'));var db=require(_0x43b6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x43b6('0x7'))('rpc');var config=require(_0x43b6('0x8'));var jayson=require(_0x43b6('0x9'));var client=jayson[_0x43b6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cb041,_0x57ed7c,_0x85ae8c){return new BPromise(function(_0x5b4d59,_0x2f2bc9){return client[_0x43b6('0xb')](_0x1cb041,_0x85ae8c)[_0x43b6('0xc')](function(_0x5168cc){logger[_0x43b6('0xd')](_0x43b6('0xe'),_0x57ed7c,_0x43b6('0xf'));logger[_0x43b6('0x10')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x57ed7c,_0x43b6('0xf'),JSON['stringify'](_0x5168cc));if(_0x5168cc['error']){if(_0x5168cc['error'][_0x43b6('0x11')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x57ed7c,_0x5168cc[_0x43b6('0x12')][_0x43b6('0x13')]);return _0x2f2bc9(_0x5168cc[_0x43b6('0x12')][_0x43b6('0x13')]);}logger['error'](_0x43b6('0xe'),_0x57ed7c,_0x5168cc['error'][_0x43b6('0x13')]);return _0x5b4d59(_0x5168cc[_0x43b6('0x12')][_0x43b6('0x13')]);}else{logger[_0x43b6('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x57ed7c,'request\x20sent');_0x5b4d59(_0x5168cc[_0x43b6('0x14')][_0x43b6('0x13')]);}})[_0x43b6('0x15')](function(_0x5ba8c5){logger[_0x43b6('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x57ed7c,_0x5ba8c5);_0x2f2bc9(_0x5ba8c5);});});} \ No newline at end of file +var _0x95fe=['randomstring','ioredis','../../config/logger','../../config/environment','client','http','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment'];(function(_0x32506f,_0x373192){var _0x1e6b33=function(_0x473209){while(--_0x473209){_0x32506f['push'](_0x32506f['shift']());}};_0x1e6b33(++_0x373192);}(_0x95fe,0x154));var _0xe95f=function(_0x3dd972,_0x46dd84){_0x3dd972=_0x3dd972-0x0;var _0x3800e0=_0x95fe[_0x3dd972];return _0x3800e0;};'use strict';var _=require('lodash');var util=require(_0xe95f('0x0'));var moment=require(_0xe95f('0x1'));var BPromise=require('bluebird');var rs=require(_0xe95f('0x2'));var fs=require('fs');var Redis=require(_0xe95f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe95f('0x4'))('rpc');var config=require(_0xe95f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe95f('0x6')][_0xe95f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f709b,_0x571d5c,_0x2123a4){return new BPromise(function(_0x81b820,_0x502426){return client['request'](_0x1f709b,_0x2123a4)['then'](function(_0x247b3d){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x571d5c,_0xe95f('0x8'));logger[_0xe95f('0x9')](_0xe95f('0xa'),_0x571d5c,_0xe95f('0x8'),JSON[_0xe95f('0xb')](_0x247b3d));if(_0x247b3d[_0xe95f('0xc')]){if(_0x247b3d['error'][_0xe95f('0xd')]===0x1f4){logger[_0xe95f('0xc')](_0xe95f('0xe'),_0x571d5c,_0x247b3d[_0xe95f('0xc')][_0xe95f('0xf')]);return _0x502426(_0x247b3d[_0xe95f('0xc')][_0xe95f('0xf')]);}logger['error'](_0xe95f('0xe'),_0x571d5c,_0x247b3d[_0xe95f('0xc')][_0xe95f('0xf')]);return _0x81b820(_0x247b3d[_0xe95f('0xc')][_0xe95f('0xf')]);}else{logger[_0xe95f('0x10')](_0xe95f('0xe'),_0x571d5c,'request\x20sent');_0x81b820(_0x247b3d[_0xe95f('0x11')][_0xe95f('0xf')]);}})[_0xe95f('0x12')](function(_0xfa05dc){logger[_0xe95f('0xc')](_0xe95f('0xe'),_0x571d5c,_0xfa05dc);_0x502426(_0xfa05dc);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index f1161f8..601f9dc 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 _0x636b=['express','Router','../../components/auth/service','../../components/interaction/service','index','get','isAuthenticated','show','post','create','put','/:id','destroy','exports','multer'];(function(_0x3b7cc9,_0x18cd9b){var _0x5751ea=function(_0x141c47){while(--_0x141c47){_0x3b7cc9['push'](_0x3b7cc9['shift']());}};_0x5751ea(++_0x18cd9b);}(_0x636b,0x149));var _0xb636=function(_0x48f77e,_0xd45e6f){_0x48f77e=_0x48f77e-0x0;var _0x2df01f=_0x636b[_0x48f77e];return _0x2df01f;};'use strict';var multer=require(_0xb636('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb636('0x1'));var router=express[_0xb636('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb636('0x3'));var interaction=require(_0xb636('0x4'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb636('0x5')]);router[_0xb636('0x6')]('/:id',auth[_0xb636('0x7')](),controller[_0xb636('0x8')]);router[_0xb636('0x9')]('/',auth[_0xb636('0x7')](),controller[_0xb636('0xa')]);router[_0xb636('0xb')](_0xb636('0xc'),auth[_0xb636('0x7')](),controller['update']);router['delete']('/:id',auth[_0xb636('0x7')](),controller[_0xb636('0xd')]);module[_0xb636('0xe')]=router; \ No newline at end of file +var _0x0961=['/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get'];(function(_0x24ce7d,_0x53c2b2){var _0x445c5d=function(_0x51ec09){while(--_0x51ec09){_0x24ce7d['push'](_0x24ce7d['shift']());}};_0x445c5d(++_0x53c2b2);}(_0x0961,0x81));var _0x1096=function(_0x2deac4,_0xc27a2b){_0x2deac4=_0x2deac4-0x0;var _0x1c0bda=_0x0961[_0x2deac4];return _0x1c0bda;};'use strict';var multer=require(_0x1096('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1096('0x1'));var auth=require(_0x1096('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x1096('0x3'));var controller=require(_0x1096('0x4'));router[_0x1096('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1096('0x6'),auth[_0x1096('0x7')](),controller[_0x1096('0x8')]);router[_0x1096('0x9')]('/',auth[_0x1096('0x7')](),controller['create']);router[_0x1096('0xa')]('/:id',auth[_0x1096('0x7')](),controller[_0x1096('0xb')]);router[_0x1096('0xc')](_0x1096('0x6'),auth['isAuthenticated'](),controller[_0x1096('0xd')]);module[_0x1096('0xe')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 39b1a44..4fa1c14 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 _0xc397=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x49c699,_0x314403){var _0x2853ea=function(_0x68ceb9){while(--_0x68ceb9){_0x49c699['push'](_0x49c699['shift']());}};_0x2853ea(++_0x314403);}(_0xc397,0xce));var _0x7c39=function(_0x270afc,_0x345db2){_0x270afc=_0x270afc-0x0;var _0x3b7d1c=_0xc397[_0x270afc];return _0x3b7d1c;};'use strict';var Sequelize=require(_0x7c39('0x0'));module[_0x7c39('0x1')]={'type':{'type':Sequelize[_0x7c39('0x2')](_0x7c39('0x3'),'variable',_0x7c39('0x4'),_0x7c39('0x5'),_0x7c39('0x6')),'defaultValue':_0x7c39('0x3')},'content':{'type':Sequelize[_0x7c39('0x7')]},'key':{'type':Sequelize[_0x7c39('0x7')]},'keyType':{'type':Sequelize[_0x7c39('0x2')](_0x7c39('0x3'),_0x7c39('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x7c39('0x7')]},'idField':{'type':Sequelize[_0x7c39('0x7')]},'nameField':{'type':Sequelize[_0x7c39('0x7')]},'customField':{'type':Sequelize[_0x7c39('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7c39('0x7')]}}; \ No newline at end of file +var _0xfcda=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfcda,0x100));var _0xafcd=function(_0x1ddb40,_0x2966c8){_0x1ddb40=_0x1ddb40-0x0;var _0x508db9=_0xfcda[_0x1ddb40];return _0x508db9;};'use strict';var Sequelize=require(_0xafcd('0x0'));module[_0xafcd('0x1')]={'type':{'type':Sequelize[_0xafcd('0x2')]('string',_0xafcd('0x3'),_0xafcd('0x4'),_0xafcd('0x5'),_0xafcd('0x6')),'defaultValue':_0xafcd('0x7')},'content':{'type':Sequelize[_0xafcd('0x8')]},'key':{'type':Sequelize[_0xafcd('0x8')]},'keyType':{'type':Sequelize[_0xafcd('0x2')](_0xafcd('0x7'),_0xafcd('0x3'),_0xafcd('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xafcd('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xafcd('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xafcd('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 70fa353..53fd0ec 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 _0x8228=['show','params','rawAttributes','keys','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','attributes','length','sort','where','merge','type','options','ServicenowField','includeAll','include','rows','catch'];(function(_0x16c204,_0x5af1d6){var _0x18ad55=function(_0x1cadad){while(--_0x1cadad){_0x16c204['push'](_0x16c204['shift']());}};_0x18ad55(++_0x5af1d6);}(_0x8228,0x93));var _0x8822=function(_0x5a1187,_0x173a93){_0x5a1187=_0x5a1187-0x0;var _0x48dc37=_0x8228[_0x5a1187];return _0x48dc37;};'use strict';var emlformat=require(_0x8822('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8822('0x1'));var jsonpatch=require(_0x8822('0x2'));var rp=require(_0x8822('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8822('0x4'));var path=require('path');var sox=require(_0x8822('0x5'));var csv=require(_0x8822('0x6'));var ejs=require(_0x8822('0x7'));var fs=require('fs');var fs_extra=require(_0x8822('0x8'));var _=require(_0x8822('0x9'));var squel=require(_0x8822('0xa'));var crypto=require(_0x8822('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8822('0xc'));var toCsv=require(_0x8822('0x6'));var querystring=require(_0x8822('0xd'));var Papa=require(_0x8822('0xe'));var Redis=require(_0x8822('0xf'));var authService=require(_0x8822('0x10'));var qs=require(_0x8822('0x11'));var as=require(_0x8822('0x12'));var hardwareService=require(_0x8822('0x13'));var logger=require(_0x8822('0x14'))(_0x8822('0x15'));var utils=require('../../config/utils');var config=require(_0x8822('0x16'));var licenseUtil=require(_0x8822('0x17'));var db=require(_0x8822('0x18'))['db'];function respondWithStatusCode(_0x2b8a39,_0x1d599d){_0x1d599d=_0x1d599d||0xcc;return function(_0x327f1e){if(_0x327f1e){return _0x2b8a39[_0x8822('0x19')](_0x1d599d);}return _0x2b8a39['status'](_0x1d599d)['end']();};}function respondWithResult(_0x221235,_0xcca431){_0xcca431=_0xcca431||0xc8;return function(_0x21b995){if(_0x21b995){return _0x221235[_0x8822('0x1a')](_0xcca431)[_0x8822('0x1b')](_0x21b995);}};}function respondWithFilteredResult(_0x6d730,_0x53bfe5){return function(_0x36f5f7){if(_0x36f5f7){var _0x596e1d=typeof _0x53bfe5[_0x8822('0x1c')]===_0x8822('0x1d')&&typeof _0x53bfe5[_0x8822('0x1e')]===_0x8822('0x1d');var _0x283b7d=_0x36f5f7[_0x8822('0x1f')];var _0x120c22=_0x596e1d?0x0:_0x53bfe5['offset'];var _0x16b0bb=_0x596e1d?_0x36f5f7['count']:_0x53bfe5[_0x8822('0x1c')]+_0x53bfe5[_0x8822('0x1e')];var _0x1bd355;if(_0x16b0bb>=_0x283b7d){_0x16b0bb=_0x283b7d;_0x1bd355=0xc8;}else{_0x1bd355=0xce;}_0x6d730[_0x8822('0x1a')](_0x1bd355);return _0x6d730[_0x8822('0x20')]('Content-Range',_0x120c22+'-'+_0x16b0bb+'/'+_0x283b7d)[_0x8822('0x1b')](_0x36f5f7);}return null;};}function patchUpdates(_0x4be492){return function(_0x5254c5){try{jsonpatch[_0x8822('0x21')](_0x5254c5,_0x4be492,!![]);}catch(_0x19b7bc){return BPromise[_0x8822('0x22')](_0x19b7bc);}return _0x5254c5[_0x8822('0x23')]();};}function saveUpdates(_0x4b6dca,_0x5d8458){return function(_0x44e76c){if(_0x44e76c){return _0x44e76c[_0x8822('0x24')](_0x4b6dca)[_0x8822('0x25')](function(_0x587fbd){return _0x587fbd;});}return null;};}function removeEntity(_0x434425,_0x28d805){return function(_0x5761b7){if(_0x5761b7){return _0x5761b7[_0x8822('0x26')]()['then'](function(){_0x434425[_0x8822('0x1a')](0xcc)[_0x8822('0x27')]();});}};}function handleEntityNotFound(_0x2522a0,_0xb4aad8){return function(_0x4ac575){if(!_0x4ac575){_0x2522a0[_0x8822('0x19')](0x194);}return _0x4ac575;};}function handleError(_0x3d3d91,_0x2a309c){_0x2a309c=_0x2a309c||0x1f4;return function(_0x344986){logger[_0x8822('0x28')](_0x344986[_0x8822('0x29')]);if(_0x344986[_0x8822('0x2a')]){delete _0x344986[_0x8822('0x2a')];}_0x3d3d91[_0x8822('0x1a')](_0x2a309c)['send'](_0x344986);};}exports[_0x8822('0x2b')]=function(_0x4de7e2,_0xc006f2){var _0x5df05f={},_0x172755={},_0x53b927={'count':0x0,'rows':[]};var _0x287558=_[_0x8822('0x2c')](db['ServicenowField']['rawAttributes'],function(_0xf8b45c){return{'name':_0xf8b45c[_0x8822('0x2d')],'type':_0xf8b45c['type']['key']};});_0x172755[_0x8822('0x2e')]=_[_0x8822('0x2c')](_0x287558,_0x8822('0x2a'));_0x172755[_0x8822('0x2f')]=_['keys'](_0x4de7e2[_0x8822('0x2f')]);_0x172755[_0x8822('0x30')]=_[_0x8822('0x31')](_0x172755['model'],_0x172755[_0x8822('0x2f')]);_0x5df05f['attributes']=_['intersection'](_0x172755[_0x8822('0x2e')],qs[_0x8822('0x32')](_0x4de7e2['query'][_0x8822('0x32')]));_0x5df05f[_0x8822('0x33')]=_0x5df05f['attributes'][_0x8822('0x34')]?_0x5df05f['attributes']:_0x172755['model'];if(!_0x4de7e2[_0x8822('0x2f')]['hasOwnProperty']('nolimit')){_0x5df05f['limit']=qs[_0x8822('0x1e')](_0x4de7e2[_0x8822('0x2f')]['limit']);_0x5df05f[_0x8822('0x1c')]=qs['offset'](_0x4de7e2[_0x8822('0x2f')][_0x8822('0x1c')]);}_0x5df05f['order']=qs['sort'](_0x4de7e2[_0x8822('0x2f')][_0x8822('0x35')]);_0x5df05f[_0x8822('0x36')]=qs[_0x8822('0x30')](_['pick'](_0x4de7e2[_0x8822('0x2f')],_0x172755['filters']),_0x287558);if(_0x4de7e2[_0x8822('0x2f')]['filter']){_0x5df05f[_0x8822('0x36')]=_[_0x8822('0x37')](_0x5df05f['where'],{'$or':_['map'](_0x287558,function(_0x28b54f){if(_0x28b54f[_0x8822('0x38')]!=='VIRTUAL'){var _0x555f3d={};_0x555f3d[_0x28b54f[_0x8822('0x2a')]]={'$like':'%'+_0x4de7e2['query']['filter']+'%'};return _0x555f3d;}})});}_0x5df05f=_['merge']({},_0x5df05f,_0x4de7e2[_0x8822('0x39')]);var _0x2537fc={'where':_0x5df05f[_0x8822('0x36')]};return db[_0x8822('0x3a')][_0x8822('0x1f')](_0x2537fc)[_0x8822('0x25')](function(_0x3ddf8a){_0x53b927[_0x8822('0x1f')]=_0x3ddf8a;if(_0x4de7e2[_0x8822('0x2f')][_0x8822('0x3b')]){_0x5df05f[_0x8822('0x3c')]=[{'all':!![]}];}return db[_0x8822('0x3a')]['findAll'](_0x5df05f);})[_0x8822('0x25')](function(_0x47466a){_0x53b927[_0x8822('0x3d')]=_0x47466a;return _0x53b927;})['then'](respondWithFilteredResult(_0xc006f2,_0x5df05f))[_0x8822('0x3e')](handleError(_0xc006f2,null));};exports[_0x8822('0x3f')]=function(_0x5b868a,_0x1d9520){var _0x37b0d7={'raw':!![],'where':{'id':_0x5b868a[_0x8822('0x40')]['id']}},_0xe1ecf8={};_0xe1ecf8['model']=_['keys'](db[_0x8822('0x3a')][_0x8822('0x41')]);_0xe1ecf8[_0x8822('0x2f')]=_[_0x8822('0x42')](_0x5b868a['query']);_0xe1ecf8[_0x8822('0x30')]=_[_0x8822('0x31')](_0xe1ecf8[_0x8822('0x2e')],_0xe1ecf8[_0x8822('0x2f')]);_0x37b0d7['attributes']=_[_0x8822('0x31')](_0xe1ecf8[_0x8822('0x2e')],qs[_0x8822('0x32')](_0x5b868a[_0x8822('0x2f')][_0x8822('0x32')]));_0x37b0d7[_0x8822('0x33')]=_0x37b0d7['attributes'][_0x8822('0x34')]?_0x37b0d7[_0x8822('0x33')]:_0xe1ecf8[_0x8822('0x2e')];if(_0x5b868a[_0x8822('0x2f')][_0x8822('0x3b')]){_0x37b0d7[_0x8822('0x3c')]=[{'all':!![]}];}_0x37b0d7=_['merge']({},_0x37b0d7,_0x5b868a['options']);return db[_0x8822('0x3a')][_0x8822('0x43')](_0x37b0d7)['then'](handleEntityNotFound(_0x1d9520,null))['then'](respondWithResult(_0x1d9520,null))[_0x8822('0x3e')](handleError(_0x1d9520,null));};exports[_0x8822('0x44')]=function(_0x49e54e,_0xfc0d18){return db['ServicenowField']['create'](_0x49e54e[_0x8822('0x45')],{})['then'](respondWithResult(_0xfc0d18,0xc9))[_0x8822('0x3e')](handleError(_0xfc0d18,null));};exports[_0x8822('0x24')]=function(_0x34ffe0,_0x1db003){if(_0x34ffe0['body']['id']){delete _0x34ffe0['body']['id'];}return db['ServicenowField'][_0x8822('0x43')]({'where':{'id':_0x34ffe0[_0x8822('0x40')]['id']}})[_0x8822('0x25')](handleEntityNotFound(_0x1db003,null))['then'](saveUpdates(_0x34ffe0[_0x8822('0x45')],null))[_0x8822('0x25')](respondWithResult(_0x1db003,null))[_0x8822('0x3e')](handleError(_0x1db003,null));};exports[_0x8822('0x26')]=function(_0x3031bd,_0x70f0cb){return db[_0x8822('0x3a')][_0x8822('0x43')]({'where':{'id':_0x3031bd[_0x8822('0x40')]['id']}})[_0x8822('0x25')](handleEntityNotFound(_0x70f0cb,null))[_0x8822('0x25')](removeEntity(_0x70f0cb,null))[_0x8822('0x3e')](handleError(_0x70f0cb,null));}; \ No newline at end of file +var _0xa16d=['update','body','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','find','create'];(function(_0x2330f3,_0x465d50){var _0x472b15=function(_0x5853b9){while(--_0x5853b9){_0x2330f3['push'](_0x2330f3['shift']());}};_0x472b15(++_0x465d50);}(_0xa16d,0x95));var _0xda16=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xa16d[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0xda16('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda16('0x1'));var jsonpatch=require(_0xda16('0x2'));var rp=require('request-promise');var moment=require(_0xda16('0x3'));var BPromise=require(_0xda16('0x4'));var Mustache=require('mustache');var util=require(_0xda16('0x5'));var path=require(_0xda16('0x6'));var sox=require('sox');var csv=require(_0xda16('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda16('0x8'));var _=require(_0xda16('0x9'));var squel=require(_0xda16('0xa'));var crypto=require(_0xda16('0xb'));var jsforce=require(_0xda16('0xc'));var deskjs=require(_0xda16('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xda16('0xe'));var Redis=require('ioredis');var authService=require(_0xda16('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda16('0x10'));var logger=require(_0xda16('0x11'))(_0xda16('0x12'));var utils=require(_0xda16('0x13'));var config=require(_0xda16('0x14'));var licenseUtil=require(_0xda16('0x15'));var db=require(_0xda16('0x16'))['db'];function respondWithStatusCode(_0x429e1c,_0x131f08){_0x131f08=_0x131f08||0xcc;return function(_0x92f1e8){if(_0x92f1e8){return _0x429e1c[_0xda16('0x17')](_0x131f08);}return _0x429e1c[_0xda16('0x18')](_0x131f08)[_0xda16('0x19')]();};}function respondWithResult(_0x5d2fdd,_0x319e13){_0x319e13=_0x319e13||0xc8;return function(_0x1d8c80){if(_0x1d8c80){return _0x5d2fdd['status'](_0x319e13)[_0xda16('0x1a')](_0x1d8c80);}};}function respondWithFilteredResult(_0x190991,_0x162cda){return function(_0x127af2){if(_0x127af2){var _0x5e152e=typeof _0x162cda[_0xda16('0x1b')]===_0xda16('0x1c')&&typeof _0x162cda[_0xda16('0x1d')]===_0xda16('0x1c');var _0x4370ee=_0x127af2[_0xda16('0x1e')];var _0x231b63=_0x5e152e?0x0:_0x162cda[_0xda16('0x1b')];var _0x4c24dd=_0x5e152e?_0x127af2[_0xda16('0x1e')]:_0x162cda[_0xda16('0x1b')]+_0x162cda[_0xda16('0x1d')];var _0x466592;if(_0x4c24dd>=_0x4370ee){_0x4c24dd=_0x4370ee;_0x466592=0xc8;}else{_0x466592=0xce;}_0x190991['status'](_0x466592);return _0x190991[_0xda16('0x1f')](_0xda16('0x20'),_0x231b63+'-'+_0x4c24dd+'/'+_0x4370ee)['json'](_0x127af2);}return null;};}function patchUpdates(_0x1a89b1){return function(_0xc157d8){try{jsonpatch['apply'](_0xc157d8,_0x1a89b1,!![]);}catch(_0x146509){return BPromise[_0xda16('0x21')](_0x146509);}return _0xc157d8[_0xda16('0x22')]();};}function saveUpdates(_0x185e17,_0x37523b){return function(_0x430881){if(_0x430881){return _0x430881['update'](_0x185e17)[_0xda16('0x23')](function(_0x57ecff){return _0x57ecff;});}return null;};}function removeEntity(_0x2e4176,_0x2fb9dd){return function(_0xaa1570){if(_0xaa1570){return _0xaa1570['destroy']()[_0xda16('0x23')](function(){_0x2e4176[_0xda16('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x225300,_0x380278){return function(_0x169de4){if(!_0x169de4){_0x225300[_0xda16('0x17')](0x194);}return _0x169de4;};}function handleError(_0x46a7e9,_0x574c64){_0x574c64=_0x574c64||0x1f4;return function(_0x18f972){logger[_0xda16('0x24')](_0x18f972[_0xda16('0x25')]);if(_0x18f972[_0xda16('0x26')]){delete _0x18f972['name'];}_0x46a7e9['status'](_0x574c64)['send'](_0x18f972);};}exports[_0xda16('0x27')]=function(_0x3ffd5a,_0x47a6a7){var _0x1a047a={},_0x258487={},_0xdf1f7b={'count':0x0,'rows':[]};var _0x3469bc=_[_0xda16('0x28')](db[_0xda16('0x29')][_0xda16('0x2a')],function(_0x558709){return{'name':_0x558709[_0xda16('0x2b')],'type':_0x558709[_0xda16('0x2c')][_0xda16('0x2d')]};});_0x258487['model']=_[_0xda16('0x28')](_0x3469bc,_0xda16('0x26'));_0x258487['query']=_['keys'](_0x3ffd5a[_0xda16('0x2e')]);_0x258487[_0xda16('0x2f')]=_[_0xda16('0x30')](_0x258487[_0xda16('0x31')],_0x258487[_0xda16('0x2e')]);_0x1a047a[_0xda16('0x32')]=_['intersection'](_0x258487[_0xda16('0x31')],qs[_0xda16('0x33')](_0x3ffd5a[_0xda16('0x2e')]['fields']));_0x1a047a[_0xda16('0x32')]=_0x1a047a[_0xda16('0x32')][_0xda16('0x34')]?_0x1a047a[_0xda16('0x32')]:_0x258487[_0xda16('0x31')];if(!_0x3ffd5a[_0xda16('0x2e')][_0xda16('0x35')]('nolimit')){_0x1a047a[_0xda16('0x1d')]=qs[_0xda16('0x1d')](_0x3ffd5a[_0xda16('0x2e')]['limit']);_0x1a047a[_0xda16('0x1b')]=qs[_0xda16('0x1b')](_0x3ffd5a[_0xda16('0x2e')][_0xda16('0x1b')]);}_0x1a047a[_0xda16('0x36')]=qs['sort'](_0x3ffd5a[_0xda16('0x2e')][_0xda16('0x37')]);_0x1a047a['where']=qs['filters'](_[_0xda16('0x38')](_0x3ffd5a[_0xda16('0x2e')],_0x258487[_0xda16('0x2f')]),_0x3469bc);if(_0x3ffd5a['query'][_0xda16('0x39')]){_0x1a047a[_0xda16('0x3a')]=_[_0xda16('0x3b')](_0x1a047a[_0xda16('0x3a')],{'$or':_['map'](_0x3469bc,function(_0x1574ac){if(_0x1574ac['type']!==_0xda16('0x3c')){var _0x3bc2a5={};_0x3bc2a5[_0x1574ac[_0xda16('0x26')]]={'$like':'%'+_0x3ffd5a['query'][_0xda16('0x39')]+'%'};return _0x3bc2a5;}})});}_0x1a047a=_['merge']({},_0x1a047a,_0x3ffd5a[_0xda16('0x3d')]);var _0x113397={'where':_0x1a047a['where']};return db['ServicenowField']['count'](_0x113397)[_0xda16('0x23')](function(_0x283e96){_0xdf1f7b[_0xda16('0x1e')]=_0x283e96;if(_0x3ffd5a[_0xda16('0x2e')]['includeAll']){_0x1a047a[_0xda16('0x3e')]=[{'all':!![]}];}return db['ServicenowField'][_0xda16('0x3f')](_0x1a047a);})[_0xda16('0x23')](function(_0x16427a){_0xdf1f7b[_0xda16('0x40')]=_0x16427a;return _0xdf1f7b;})[_0xda16('0x23')](respondWithFilteredResult(_0x47a6a7,_0x1a047a))[_0xda16('0x41')](handleError(_0x47a6a7,null));};exports['show']=function(_0x7cb754,_0x2861c0){var _0x15a820={'raw':!![],'where':{'id':_0x7cb754[_0xda16('0x42')]['id']}},_0x254f11={};_0x254f11[_0xda16('0x31')]=_[_0xda16('0x43')](db['ServicenowField']['rawAttributes']);_0x254f11[_0xda16('0x2e')]=_[_0xda16('0x43')](_0x7cb754['query']);_0x254f11[_0xda16('0x2f')]=_[_0xda16('0x30')](_0x254f11[_0xda16('0x31')],_0x254f11['query']);_0x15a820[_0xda16('0x32')]=_[_0xda16('0x30')](_0x254f11[_0xda16('0x31')],qs['fields'](_0x7cb754[_0xda16('0x2e')][_0xda16('0x33')]));_0x15a820[_0xda16('0x32')]=_0x15a820[_0xda16('0x32')][_0xda16('0x34')]?_0x15a820[_0xda16('0x32')]:_0x254f11[_0xda16('0x31')];if(_0x7cb754['query']['includeAll']){_0x15a820[_0xda16('0x3e')]=[{'all':!![]}];}_0x15a820=_[_0xda16('0x3b')]({},_0x15a820,_0x7cb754['options']);return db[_0xda16('0x29')][_0xda16('0x44')](_0x15a820)[_0xda16('0x23')](handleEntityNotFound(_0x2861c0,null))[_0xda16('0x23')](respondWithResult(_0x2861c0,null))[_0xda16('0x41')](handleError(_0x2861c0,null));};exports[_0xda16('0x45')]=function(_0x48cde7,_0x362148){return db[_0xda16('0x29')][_0xda16('0x45')](_0x48cde7['body'],{})[_0xda16('0x23')](respondWithResult(_0x362148,0xc9))[_0xda16('0x41')](handleError(_0x362148,null));};exports[_0xda16('0x46')]=function(_0x2c7773,_0x9fb77a){if(_0x2c7773[_0xda16('0x47')]['id']){delete _0x2c7773[_0xda16('0x47')]['id'];}return db[_0xda16('0x29')][_0xda16('0x44')]({'where':{'id':_0x2c7773[_0xda16('0x42')]['id']}})['then'](handleEntityNotFound(_0x9fb77a,null))['then'](saveUpdates(_0x2c7773[_0xda16('0x47')],null))[_0xda16('0x23')](respondWithResult(_0x9fb77a,null))[_0xda16('0x41')](handleError(_0x9fb77a,null));};exports[_0xda16('0x48')]=function(_0x12d2b4,_0x431bf4){return db[_0xda16('0x29')][_0xda16('0x44')]({'where':{'id':_0x12d2b4[_0xda16('0x42')]['id']}})[_0xda16('0x23')](handleEntityNotFound(_0x431bf4,null))['then'](removeEntity(_0x431bf4,null))[_0xda16('0x41')](handleError(_0x431bf4,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 12e7f82..ecaf2bb 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 _0x7221=['ServicenowField','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x3d30cf,_0x44a974){var _0x11141a=function(_0x4b433d){while(--_0x4b433d){_0x3d30cf['push'](_0x3d30cf['shift']());}};_0x11141a(++_0x44a974);}(_0x7221,0x116));var _0x1722=function(_0x9f6f64,_0x4cd6df){_0x9f6f64=_0x9f6f64-0x0;var _0x3b9f5c=_0x7221[_0x9f6f64];return _0x3b9f5c;};'use strict';var _=require(_0x1722('0x0'));var util=require(_0x1722('0x1'));var logger=require(_0x1722('0x2'))(_0x1722('0x3'));var moment=require(_0x1722('0x4'));var BPromise=require('bluebird');var rp=require(_0x1722('0x5'));var fs=require('fs');var path=require(_0x1722('0x6'));var rimraf=require('rimraf');var config=require(_0x1722('0x7'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x445a21,_0x17f09b){return _0x445a21['define'](_0x1722('0x8'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x1722('0x9'),_0x1722('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9e05=['exports','ServicenowField','servicenow_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0x59eb02,_0xdba397){var _0x259391=function(_0x609f31){while(--_0x609f31){_0x59eb02['push'](_0x59eb02['shift']());}};_0x259391(++_0xdba397);}(_0x9e05,0x1e5));var _0x59e0=function(_0x2b3dda,_0x2f617b){_0x2b3dda=_0x2b3dda-0x0;var _0x561d00=_0x9e05[_0x2b3dda];return _0x561d00;};'use strict';var _=require(_0x59e0('0x0'));var util=require(_0x59e0('0x1'));var logger=require(_0x59e0('0x2'))(_0x59e0('0x3'));var moment=require('moment');var BPromise=require(_0x59e0('0x4'));var rp=require(_0x59e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x59e0('0x6'));var config=require(_0x59e0('0x7'));var attributes=require(_0x59e0('0x8'));module[_0x59e0('0x9')]=function(_0x4994d2,_0xa78e99){return _0x4994d2['define'](_0x59e0('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x59e0('0xb'),'fields':[_0x59e0('0xc'),'FieldId'],'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 a7659c2..c78be61 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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x3d2589,_0x47a78a){var _0x10330f=function(_0x5f0a57){while(--_0x5f0a57){_0x3d2589['push'](_0x3d2589['shift']());}};_0x10330f(++_0x47a78a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb7e7[_0x55abd9];return _0x3e5669;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xac4a,0x13f));var _0xaac4=function(_0x277774,_0x4d34d6){_0x277774=_0x277774-0x0;var _0x4b75ce=_0xac4a[_0x277774];return _0x4b75ce;};'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 041d9ab..3467c83 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x512243,_0x515f84){var _0x2f5cae=function(_0x11e21a){while(--_0x11e21a){_0x512243['push'](_0x512243['shift']());}};_0x2f5cae(++_0x515f84);}(_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 +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(_0x301a3d,_0x1601d3){var _0x1a3374=function(_0x2e55f5){while(--_0x2e55f5){_0x301a3d['push'](_0x301a3d['shift']());}};_0x1a3374(++_0x1601d3);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 4b7974e..1081a05 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(_0x35cad7,_0xbe4867){var _0x289867=function(_0x8042bb){while(--_0x8042bb){_0x35cad7['push'](_0x35cad7['shift']());}};_0x289867(++_0xbe4867);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x4e8c5a,_0x3ca8f6){var _0x525ddd=function(_0x291734){while(--_0x291734){_0x4e8c5a['push'](_0x4e8c5a['shift']());}};_0x525ddd(++_0x3ca8f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 05e93ae..3d4eca1 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 _0x224c=['/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','destroy','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','include','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','order','pick','addConfiguration','AccountId','getSubjects','channel','Subjects','SugarcrmField','Descriptions','getFields','description','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','remoteUri','slice','lastIndexOf','%s%s','JSON','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format'];(function(_0x2d3f7d,_0x50916a){var _0xd77302=function(_0x5cb3ca){while(--_0x5cb3ca){_0x2d3f7d['push'](_0x2d3f7d['shift']());}};_0xd77302(++_0x50916a);}(_0x224c,0x1e2));var _0xc224=function(_0x51b11e,_0x16d4ea){_0x51b11e=_0x51b11e-0x0;var _0x13d9f1=_0x224c[_0x51b11e];return _0x13d9f1;};'use strict';var emlformat=require(_0xc224('0x0'));var rimraf=require(_0xc224('0x1'));var zipdir=require(_0xc224('0x2'));var jsonpatch=require(_0xc224('0x3'));var rp=require(_0xc224('0x4'));var moment=require(_0xc224('0x5'));var BPromise=require(_0xc224('0x6'));var Mustache=require(_0xc224('0x7'));var util=require('util');var path=require(_0xc224('0x8'));var sox=require(_0xc224('0x9'));var csv=require(_0xc224('0xa'));var ejs=require(_0xc224('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc224('0xc'));var squel=require(_0xc224('0xd'));var crypto=require(_0xc224('0xe'));var jsforce=require(_0xc224('0xf'));var deskjs=require(_0xc224('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc224('0x11'));var Papa=require(_0xc224('0x12'));var Redis=require(_0xc224('0x13'));var authService=require(_0xc224('0x14'));var qs=require(_0xc224('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc224('0x16'));var logger=require(_0xc224('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc224('0x18'));var db=require(_0xc224('0x19'))['db'];var integrations=require(_0xc224('0x1a'));function respondWithStatusCode(_0x356109,_0x5dc5e4){_0x5dc5e4=_0x5dc5e4||0xcc;return function(_0x81efa0){if(_0x81efa0){return _0x356109[_0xc224('0x1b')](_0x5dc5e4);}return _0x356109[_0xc224('0x1c')](_0x5dc5e4)[_0xc224('0x1d')]();};}function respondWithResult(_0x499f53,_0x26a257){_0x26a257=_0x26a257||0xc8;return function(_0x486048){if(_0x486048){return _0x499f53[_0xc224('0x1c')](_0x26a257)[_0xc224('0x1e')](_0x486048);}};}function respondWithFilteredResult(_0xeced88,_0x4fa213){return function(_0x11df3d){if(_0x11df3d){var _0x42b305=typeof _0x4fa213[_0xc224('0x1f')]===_0xc224('0x20')&&typeof _0x4fa213[_0xc224('0x21')]===_0xc224('0x20');var _0x5916c5=_0x11df3d[_0xc224('0x22')];var _0x41d9a6=_0x42b305?0x0:_0x4fa213[_0xc224('0x1f')];var _0x1ebf32=_0x42b305?_0x11df3d[_0xc224('0x22')]:_0x4fa213['offset']+_0x4fa213[_0xc224('0x21')];var _0x32cd3f;if(_0x1ebf32>=_0x5916c5){_0x1ebf32=_0x5916c5;_0x32cd3f=0xc8;}else{_0x32cd3f=0xce;}_0xeced88[_0xc224('0x1c')](_0x32cd3f);return _0xeced88['set'](_0xc224('0x23'),_0x41d9a6+'-'+_0x1ebf32+'/'+_0x5916c5)[_0xc224('0x1e')](_0x11df3d);}return null;};}function patchUpdates(_0x6f0838){return function(_0x45c882){try{jsonpatch['apply'](_0x45c882,_0x6f0838,!![]);}catch(_0x2d2eb1){return BPromise['reject'](_0x2d2eb1);}return _0x45c882['save']();};}function saveUpdates(_0x4e1286,_0x2cc131){return function(_0xd3ea7f){if(_0xd3ea7f){return _0xd3ea7f['update'](_0x4e1286)[_0xc224('0x24')](function(_0xa723a8){return _0xa723a8;});}return null;};}function removeEntity(_0x2da216,_0xf31122){return function(_0x173f11){if(_0x173f11){return _0x173f11[_0xc224('0x25')]()[_0xc224('0x24')](function(){_0x2da216[_0xc224('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x115c7e,_0x306e79){return function(_0x533324){if(!_0x533324){_0x115c7e[_0xc224('0x1b')](0x194);}return _0x533324;};}function handleError(_0xbc6fbd,_0x31fcce){_0x31fcce=_0x31fcce||0x1f4;return function(_0x51caf0){logger[_0xc224('0x26')](_0x51caf0[_0xc224('0x27')]);if(_0x51caf0[_0xc224('0x28')]){delete _0x51caf0[_0xc224('0x28')];}_0xbc6fbd['status'](_0x31fcce)[_0xc224('0x29')](_0x51caf0);};}exports[_0xc224('0x2a')]=function(_0x830365,_0x2dede3){var _0x33a76c={},_0x2789a8={},_0x560e9d={'count':0x0,'rows':[]};var _0x48b086=_['map'](db[_0xc224('0x2b')][_0xc224('0x2c')],function(_0x449d6c){return{'name':_0x449d6c[_0xc224('0x2d')],'type':_0x449d6c[_0xc224('0x2e')]['key']};});_0x2789a8[_0xc224('0x2f')]=_[_0xc224('0x30')](_0x48b086,'name');_0x2789a8[_0xc224('0x31')]=_[_0xc224('0x32')](_0x830365[_0xc224('0x31')]);_0x2789a8[_0xc224('0x33')]=_['intersection'](_0x2789a8['model'],_0x2789a8[_0xc224('0x31')]);_0x33a76c[_0xc224('0x34')]=_[_0xc224('0x35')](_0x2789a8[_0xc224('0x2f')],qs['fields'](_0x830365[_0xc224('0x31')][_0xc224('0x36')]));_0x33a76c[_0xc224('0x34')]=_0x33a76c[_0xc224('0x34')][_0xc224('0x37')]?_0x33a76c[_0xc224('0x34')]:_0x2789a8[_0xc224('0x2f')];if(!_0x830365['query'][_0xc224('0x38')](_0xc224('0x39'))){_0x33a76c['limit']=qs[_0xc224('0x21')](_0x830365[_0xc224('0x31')][_0xc224('0x21')]);_0x33a76c[_0xc224('0x1f')]=qs['offset'](_0x830365[_0xc224('0x31')][_0xc224('0x1f')]);}_0x33a76c['order']=qs[_0xc224('0x3a')](_0x830365[_0xc224('0x31')][_0xc224('0x3a')]);_0x33a76c['where']=qs[_0xc224('0x33')](_['pick'](_0x830365[_0xc224('0x31')],_0x2789a8['filters']),_0x48b086);if(_0x830365['query'][_0xc224('0x3b')]){_0x33a76c[_0xc224('0x3c')]=_[_0xc224('0x3d')](_0x33a76c[_0xc224('0x3c')],{'$or':_[_0xc224('0x30')](_0x48b086,function(_0x1f1b43){if(_0x1f1b43[_0xc224('0x2e')]!==_0xc224('0x3e')){var _0x11b22e={};_0x11b22e[_0x1f1b43['name']]={'$like':'%'+_0x830365['query'][_0xc224('0x3b')]+'%'};return _0x11b22e;}})});}_0x33a76c=_['merge']({},_0x33a76c,_0x830365[_0xc224('0x3f')]);var _0x1cb07b={'where':_0x33a76c[_0xc224('0x3c')]};return db['SugarcrmAccount'][_0xc224('0x22')](_0x1cb07b)[_0xc224('0x24')](function(_0x255677){_0x560e9d[_0xc224('0x22')]=_0x255677;if(_0x830365[_0xc224('0x31')]['includeAll']){_0x33a76c['include']=[{'all':!![]}];}return db['SugarcrmAccount'][_0xc224('0x40')](_0x33a76c);})[_0xc224('0x24')](function(_0x37f3a5){_0x560e9d[_0xc224('0x41')]=_0x37f3a5;return _0x560e9d;})['then'](respondWithFilteredResult(_0x2dede3,_0x33a76c))[_0xc224('0x42')](handleError(_0x2dede3,null));};exports[_0xc224('0x43')]=function(_0x210b4d,_0x318437){var _0x152df6={'raw':![],'where':{'id':_0x210b4d[_0xc224('0x44')]['id']}},_0x3d1cd7={};_0x3d1cd7[_0xc224('0x2f')]=_[_0xc224('0x32')](db[_0xc224('0x2b')][_0xc224('0x2c')]);_0x3d1cd7['query']=_[_0xc224('0x32')](_0x210b4d[_0xc224('0x31')]);_0x3d1cd7[_0xc224('0x33')]=_[_0xc224('0x35')](_0x3d1cd7['model'],_0x3d1cd7[_0xc224('0x31')]);_0x152df6[_0xc224('0x34')]=_['intersection'](_0x3d1cd7['model'],qs[_0xc224('0x36')](_0x210b4d[_0xc224('0x31')][_0xc224('0x36')]));_0x152df6[_0xc224('0x34')]=_0x152df6[_0xc224('0x34')]['length']?_0x152df6['attributes']:_0x3d1cd7[_0xc224('0x2f')];if(_0x210b4d[_0xc224('0x31')]['includeAll']){_0x152df6[_0xc224('0x45')]=[{'all':!![]}];}_0x152df6=_['merge']({},_0x152df6,_0x210b4d['options']);return db[_0xc224('0x2b')][_0xc224('0x46')](_0x152df6)[_0xc224('0x24')](handleEntityNotFound(_0x318437,null))['then'](respondWithResult(_0x318437,null))['catch'](handleError(_0x318437,null));};exports[_0xc224('0x47')]=function(_0x581ebf,_0x31ca96){return db[_0xc224('0x2b')]['create'](_0x581ebf[_0xc224('0x48')],{})['then'](respondWithResult(_0x31ca96,0xc9))[_0xc224('0x42')](handleError(_0x31ca96,null));};exports[_0xc224('0x49')]=function(_0x1afd39,_0x29b75b){if(_0x1afd39[_0xc224('0x48')]['id']){delete _0x1afd39[_0xc224('0x48')]['id'];}return db['SugarcrmAccount'][_0xc224('0x46')]({'where':{'id':_0x1afd39[_0xc224('0x44')]['id']}})[_0xc224('0x24')](handleEntityNotFound(_0x29b75b,null))[_0xc224('0x24')](saveUpdates(_0x1afd39[_0xc224('0x48')],null))['then'](respondWithResult(_0x29b75b,null))[_0xc224('0x42')](handleError(_0x29b75b,null));};exports[_0xc224('0x25')]=function(_0x1dc2d4,_0x29bb3d){return db[_0xc224('0x2b')][_0xc224('0x46')]({'where':{'id':_0x1dc2d4[_0xc224('0x44')]['id']}})[_0xc224('0x24')](handleEntityNotFound(_0x29bb3d,null))['then'](removeEntity(_0x29bb3d,null))[_0xc224('0x42')](handleError(_0x29bb3d,null));};exports[_0xc224('0x4a')]=function(_0x3cc5c1,_0x3c012a,_0x27f7a4){var _0x18cd98={};var _0x166487={};var _0x4ecf2b;var _0x2b6eb1;return db[_0xc224('0x2b')][_0xc224('0x4b')]({'where':{'id':_0x3cc5c1[_0xc224('0x44')]['id']}})[_0xc224('0x24')](handleEntityNotFound(_0x3c012a,null))[_0xc224('0x24')](function(_0x894f17){if(_0x894f17){_0x4ecf2b=_0x894f17;_0x166487[_0xc224('0x2f')]=_['keys'](db[_0xc224('0x4c')]['rawAttributes']);_0x166487['query']=_['keys'](_0x3cc5c1[_0xc224('0x31')]);_0x166487[_0xc224('0x33')]=_[_0xc224('0x35')](_0x166487[_0xc224('0x2f')],_0x166487[_0xc224('0x31')]);_0x18cd98[_0xc224('0x34')]=_[_0xc224('0x35')](_0x166487[_0xc224('0x2f')],qs[_0xc224('0x36')](_0x3cc5c1['query'][_0xc224('0x36')]));_0x18cd98['attributes']=_0x18cd98[_0xc224('0x34')]['length']?_0x18cd98['attributes']:_0x166487[_0xc224('0x2f')];_0x18cd98[_0xc224('0x4d')]=qs[_0xc224('0x3a')](_0x3cc5c1['query'][_0xc224('0x3a')]);_0x18cd98['where']=qs['filters'](_[_0xc224('0x4e')](_0x3cc5c1['query'],_0x166487[_0xc224('0x33')]));if(_0x3cc5c1[_0xc224('0x31')][_0xc224('0x3b')]){_0x18cd98['where']=_[_0xc224('0x3d')](_0x18cd98[_0xc224('0x3c')],{'$or':_[_0xc224('0x30')](_0x18cd98[_0xc224('0x34')],function(_0x95d7b3){var _0x5480eb={};_0x5480eb[_0x95d7b3]={'$like':'%'+_0x3cc5c1[_0xc224('0x31')][_0xc224('0x3b')]+'%'};return _0x5480eb;})});}_0x18cd98=_[_0xc224('0x3d')]({},_0x18cd98,_0x3cc5c1['options']);return _0x4ecf2b['getConfigurations'](_0x18cd98);}})[_0xc224('0x24')](function(_0x2b182b){if(_0x2b182b){_0x2b6eb1=_0x2b182b['length'];if(!_0x3cc5c1['query'][_0xc224('0x38')](_0xc224('0x39'))){_0x18cd98[_0xc224('0x21')]=qs[_0xc224('0x21')](_0x3cc5c1[_0xc224('0x31')][_0xc224('0x21')]);_0x18cd98[_0xc224('0x1f')]=qs[_0xc224('0x1f')](_0x3cc5c1['query'][_0xc224('0x1f')]);}return _0x4ecf2b[_0xc224('0x4a')](_0x18cd98);}})[_0xc224('0x24')](function(_0x5d8d65){if(_0x5d8d65){return _0x5d8d65?{'count':_0x2b6eb1,'rows':_0x5d8d65}:null;}})[_0xc224('0x24')](respondWithResult(_0x3c012a,null))[_0xc224('0x42')](handleError(_0x3c012a,null));};exports[_0xc224('0x4f')]=function(_0xf9698d,_0x137d67,_0x463558){if(_0xf9698d[_0xc224('0x48')]['id']){delete _0xf9698d[_0xc224('0x48')]['id'];}return db[_0xc224('0x2b')][_0xc224('0x4b')]({'where':{'id':_0xf9698d[_0xc224('0x44')]['id']}})[_0xc224('0x24')](handleEntityNotFound(_0x137d67,null))[_0xc224('0x24')](function(_0x34c603){if(_0x34c603){_0xf9698d['body'][_0xc224('0x50')]=_0x34c603['id'];_0xf9698d[_0xc224('0x48')]['Subjects']=integrations[_0xc224('0x51')](_0xf9698d[_0xc224('0x48')][_0xc224('0x52')],_0xf9698d['body'][_0xc224('0x2e')]);_0xf9698d[_0xc224('0x48')]['Descriptions']=integrations['getDescriptions'](_0xf9698d['body'][_0xc224('0x52')],_0xf9698d[_0xc224('0x48')]['type']);return db[_0xc224('0x4c')][_0xc224('0x47')](_0xf9698d[_0xc224('0x48')],{'include':[{'model':db['SugarcrmField'],'as':_0xc224('0x53')},{'model':db[_0xc224('0x54')],'as':_0xc224('0x55')}]});}return null;})[_0xc224('0x24')](respondWithResult(_0x137d67,null))[_0xc224('0x42')](handleError(_0x137d67,null));};exports[_0xc224('0x56')]=function(_0x5c428a,_0x493807,_0x417cd4){var _0x5e4575='';var _0x4fcf23=['id','name','assigned_user_id','created_by',_0xc224('0x57'),_0xc224('0x58'),'duration_hours',_0xc224('0x59'),_0xc224('0x5a'),_0xc224('0x5b'),_0xc224('0x5c'),_0xc224('0x5d')];return db[_0xc224('0x2b')]['findOne']({'where':{'id':_0x5c428a['params']['id']},'attributes':['id','username','password',_0xc224('0x5e')]})[_0xc224('0x24')](handleEntityNotFound(_0x493807,null))[_0xc224('0x24')](function(_0x3c780d){if(_0x3c780d){_0x5e4575=_0x3c780d['remoteUri'];var _0x3173f9=_0x5e4575[_0xc224('0x5f')](-0x1);if(_0x3173f9==='/'){_0x5e4575=_0x5e4575['substring'](0x0,_0x5e4575[_0xc224('0x60')](_0x3173f9));}return rp({'method':'POST','uri':util['format'](_0xc224('0x61'),_0x5e4575,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0xc224('0x62'),'response_type':_0xc224('0x62'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3c780d['username'],'password':_0x3c780d['password'],'encryption':'PLAIN'},'application':_0xc224('0x63')})}});}})[_0xc224('0x24')](function(_0x1de222){if(_0x1de222&&_0x1de222[_0xc224('0x28')]!==_0xc224('0x64')&&_0x1de222[_0xc224('0x28')]!==_0xc224('0x65')){return rp({'method':'POST','uri':util[_0xc224('0x66')]('%s%s',_0x5e4575,_0xc224('0x67')),'json':!![],'form':{'method':_0xc224('0x68'),'input_type':_0xc224('0x62'),'response_type':_0xc224('0x62'),'rest_data':JSON['stringify']({'session':_0x1de222['id'],'module_name':_0xc224('0x69')})}})['then'](function(_0x1c4936){if(_0x1c4936){var _0x3d8bac=_[_0xc224('0x6a')](_0x1c4936[_0xc224('0x6b')]);_['remove'](_0x3d8bac,function(_0x3d06a3){return _0x4fcf23[_0xc224('0x6c')](_0x3d06a3[_0xc224('0x28')]);});return{'count':_0x3d8bac[_0xc224('0x37')],'rows':_[_0xc224('0x30')](_0x3d8bac,function(_0x3e8c5a){return{'id':_0x3e8c5a[_0xc224('0x28')],'name':_0x3e8c5a[_0xc224('0x6d')],'custom':_[_0xc224('0x6e')](_0x3e8c5a[_0xc224('0x28')],'_c')?!![]:![],'options':_0x3e8c5a[_0xc224('0x3f')]?_[_0xc224('0x30')](_[_0xc224('0x6a')](_0x3e8c5a[_0xc224('0x3f')]),function(_0x145c00){return{'name':_0x145c00[_0xc224('0x6f')],'value':_0x145c00[_0xc224('0x28')]};}):[]};})};}})[_0xc224('0x24')](respondWithResult(_0x493807,null))[_0xc224('0x42')](function(_0x5b9f56){var _0x3eee3a=_0x5c428a[_0xc224('0x31')][_0xc224('0x70')]?0x1f4:_0x5b9f56[_0xc224('0x71')]||0x1f4;logger[_0xc224('0x26')](_0xc224('0x72'),_0xc224('0x56'),_0x3eee3a,JSON[_0xc224('0x73')](_0x5b9f56));delete _0x5b9f56[_0xc224('0x28')];if(_0x3eee3a===0x191){_0x3eee3a=0x190;}_0x493807[_0xc224('0x1c')](_0x3eee3a)[_0xc224('0x29')](_0x5c428a['query'][_0xc224('0x70')]?{'message':_0xc224('0x74'),'statusCode':_0x5b9f56['statusCode']}:_0x5b9f56);});}else{var _0x2595df=0x1f4;_0x493807['status'](_0x2595df)[_0xc224('0x29')]({'message':_0xc224('0x74'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xf14d=['send','index','map','SugarcrmAccount','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','includeAll','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','where','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','type','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','password','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','values','module_fields','includes','label','endsWith','value','test','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','end','error','name'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xf14d,0xc5));var _0xdf14=function(_0x586e13,_0x4f402e){_0x586e13=_0x586e13-0x0;var _0x332d00=_0xf14d[_0x586e13];return _0x332d00;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf14('0x0'));var zipdir=require(_0xdf14('0x1'));var jsonpatch=require(_0xdf14('0x2'));var rp=require(_0xdf14('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdf14('0x4'));var util=require(_0xdf14('0x5'));var path=require(_0xdf14('0x6'));var sox=require(_0xdf14('0x7'));var csv=require(_0xdf14('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf14('0x9'));var _=require(_0xdf14('0xa'));var squel=require('squel');var crypto=require(_0xdf14('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdf14('0xc'));var toCsv=require(_0xdf14('0x8'));var querystring=require(_0xdf14('0xd'));var Papa=require(_0xdf14('0xe'));var Redis=require(_0xdf14('0xf'));var authService=require(_0xdf14('0x10'));var qs=require(_0xdf14('0x11'));var as=require(_0xdf14('0x12'));var hardwareService=require(_0xdf14('0x13'));var logger=require(_0xdf14('0x14'))(_0xdf14('0x15'));var utils=require(_0xdf14('0x16'));var config=require(_0xdf14('0x17'));var licenseUtil=require(_0xdf14('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdf14('0x19'));function respondWithStatusCode(_0x4c2b51,_0x364c0e){_0x364c0e=_0x364c0e||0xcc;return function(_0x498f66){if(_0x498f66){return _0x4c2b51[_0xdf14('0x1a')](_0x364c0e);}return _0x4c2b51[_0xdf14('0x1b')](_0x364c0e)['end']();};}function respondWithResult(_0x3b64c7,_0xdc77fa){_0xdc77fa=_0xdc77fa||0xc8;return function(_0x11b2e0){if(_0x11b2e0){return _0x3b64c7[_0xdf14('0x1b')](_0xdc77fa)[_0xdf14('0x1c')](_0x11b2e0);}};}function respondWithFilteredResult(_0x4a6a65,_0x2f2093){return function(_0x1b37fd){if(_0x1b37fd){var _0xf76953=typeof _0x2f2093[_0xdf14('0x1d')]===_0xdf14('0x1e')&&typeof _0x2f2093['limit']==='undefined';var _0x524743=_0x1b37fd[_0xdf14('0x1f')];var _0x395866=_0xf76953?0x0:_0x2f2093[_0xdf14('0x1d')];var _0xec3bbd=_0xf76953?_0x1b37fd[_0xdf14('0x1f')]:_0x2f2093[_0xdf14('0x1d')]+_0x2f2093[_0xdf14('0x20')];var _0x1f4c27;if(_0xec3bbd>=_0x524743){_0xec3bbd=_0x524743;_0x1f4c27=0xc8;}else{_0x1f4c27=0xce;}_0x4a6a65[_0xdf14('0x1b')](_0x1f4c27);return _0x4a6a65['set'](_0xdf14('0x21'),_0x395866+'-'+_0xec3bbd+'/'+_0x524743)['json'](_0x1b37fd);}return null;};}function patchUpdates(_0x4f2355){return function(_0x13c3c4){try{jsonpatch[_0xdf14('0x22')](_0x13c3c4,_0x4f2355,!![]);}catch(_0x56d629){return BPromise[_0xdf14('0x23')](_0x56d629);}return _0x13c3c4['save']();};}function saveUpdates(_0x575181,_0xd0baf8){return function(_0x180452){if(_0x180452){return _0x180452[_0xdf14('0x24')](_0x575181)[_0xdf14('0x25')](function(_0x26871c){return _0x26871c;});}return null;};}function removeEntity(_0x5731dc,_0x15b2a4){return function(_0x28d4b8){if(_0x28d4b8){return _0x28d4b8['destroy']()[_0xdf14('0x25')](function(){_0x5731dc['status'](0xcc)[_0xdf14('0x26')]();});}};}function handleEntityNotFound(_0x174162,_0x4911f5){return function(_0x2f1c37){if(!_0x2f1c37){_0x174162[_0xdf14('0x1a')](0x194);}return _0x2f1c37;};}function handleError(_0x36ec98,_0x3d7b2c){_0x3d7b2c=_0x3d7b2c||0x1f4;return function(_0x3d6de4){logger[_0xdf14('0x27')](_0x3d6de4['stack']);if(_0x3d6de4[_0xdf14('0x28')]){delete _0x3d6de4[_0xdf14('0x28')];}_0x36ec98['status'](_0x3d7b2c)[_0xdf14('0x29')](_0x3d6de4);};}exports[_0xdf14('0x2a')]=function(_0x330e86,_0x4ceed4){var _0x969fec={},_0x180a3e={},_0x187b4d={'count':0x0,'rows':[]};var _0x573b6c=_[_0xdf14('0x2b')](db[_0xdf14('0x2c')][_0xdf14('0x2d')],function(_0x15b373){return{'name':_0x15b373[_0xdf14('0x2e')],'type':_0x15b373['type']['key']};});_0x180a3e[_0xdf14('0x2f')]=_[_0xdf14('0x2b')](_0x573b6c,_0xdf14('0x28'));_0x180a3e[_0xdf14('0x30')]=_[_0xdf14('0x31')](_0x330e86[_0xdf14('0x30')]);_0x180a3e['filters']=_[_0xdf14('0x32')](_0x180a3e[_0xdf14('0x2f')],_0x180a3e['query']);_0x969fec[_0xdf14('0x33')]=_['intersection'](_0x180a3e[_0xdf14('0x2f')],qs[_0xdf14('0x34')](_0x330e86['query'][_0xdf14('0x34')]));_0x969fec[_0xdf14('0x33')]=_0x969fec['attributes'][_0xdf14('0x35')]?_0x969fec[_0xdf14('0x33')]:_0x180a3e[_0xdf14('0x2f')];if(!_0x330e86[_0xdf14('0x30')][_0xdf14('0x36')](_0xdf14('0x37'))){_0x969fec['limit']=qs[_0xdf14('0x20')](_0x330e86[_0xdf14('0x30')][_0xdf14('0x20')]);_0x969fec[_0xdf14('0x1d')]=qs['offset'](_0x330e86['query'][_0xdf14('0x1d')]);}_0x969fec[_0xdf14('0x38')]=qs[_0xdf14('0x39')](_0x330e86[_0xdf14('0x30')][_0xdf14('0x39')]);_0x969fec['where']=qs[_0xdf14('0x3a')](_[_0xdf14('0x3b')](_0x330e86[_0xdf14('0x30')],_0x180a3e[_0xdf14('0x3a')]),_0x573b6c);if(_0x330e86[_0xdf14('0x30')]['filter']){_0x969fec['where']=_[_0xdf14('0x3c')](_0x969fec['where'],{'$or':_['map'](_0x573b6c,function(_0x5f4cbf){if(_0x5f4cbf['type']!==_0xdf14('0x3d')){var _0x1adfb5={};_0x1adfb5[_0x5f4cbf[_0xdf14('0x28')]]={'$like':'%'+_0x330e86[_0xdf14('0x30')][_0xdf14('0x3e')]+'%'};return _0x1adfb5;}})});}_0x969fec=_[_0xdf14('0x3c')]({},_0x969fec,_0x330e86[_0xdf14('0x3f')]);var _0x4cdd67={'where':_0x969fec['where']};return db[_0xdf14('0x2c')]['count'](_0x4cdd67)[_0xdf14('0x25')](function(_0x3787c5){_0x187b4d[_0xdf14('0x1f')]=_0x3787c5;if(_0x330e86[_0xdf14('0x30')]['includeAll']){_0x969fec[_0xdf14('0x40')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xdf14('0x41')](_0x969fec);})[_0xdf14('0x25')](function(_0x2b8ef9){_0x187b4d[_0xdf14('0x42')]=_0x2b8ef9;return _0x187b4d;})[_0xdf14('0x25')](respondWithFilteredResult(_0x4ceed4,_0x969fec))[_0xdf14('0x43')](handleError(_0x4ceed4,null));};exports['show']=function(_0xb244f,_0x3a61f9){var _0x1e5042={'raw':![],'where':{'id':_0xb244f[_0xdf14('0x44')]['id']}},_0x346387={};_0x346387[_0xdf14('0x2f')]=_[_0xdf14('0x31')](db[_0xdf14('0x2c')][_0xdf14('0x2d')]);_0x346387[_0xdf14('0x30')]=_[_0xdf14('0x31')](_0xb244f[_0xdf14('0x30')]);_0x346387[_0xdf14('0x3a')]=_['intersection'](_0x346387['model'],_0x346387[_0xdf14('0x30')]);_0x1e5042[_0xdf14('0x33')]=_[_0xdf14('0x32')](_0x346387[_0xdf14('0x2f')],qs['fields'](_0xb244f[_0xdf14('0x30')]['fields']));_0x1e5042['attributes']=_0x1e5042['attributes'][_0xdf14('0x35')]?_0x1e5042[_0xdf14('0x33')]:_0x346387[_0xdf14('0x2f')];if(_0xb244f[_0xdf14('0x30')][_0xdf14('0x45')]){_0x1e5042['include']=[{'all':!![]}];}_0x1e5042=_[_0xdf14('0x3c')]({},_0x1e5042,_0xb244f[_0xdf14('0x3f')]);return db[_0xdf14('0x2c')][_0xdf14('0x46')](_0x1e5042)[_0xdf14('0x25')](handleEntityNotFound(_0x3a61f9,null))[_0xdf14('0x25')](respondWithResult(_0x3a61f9,null))[_0xdf14('0x43')](handleError(_0x3a61f9,null));};exports[_0xdf14('0x47')]=function(_0x2034c6,_0x2b28e0){return db['SugarcrmAccount'][_0xdf14('0x47')](_0x2034c6['body'],{})[_0xdf14('0x25')](respondWithResult(_0x2b28e0,0xc9))[_0xdf14('0x43')](handleError(_0x2b28e0,null));};exports[_0xdf14('0x24')]=function(_0x36370b,_0x33dc6b){if(_0x36370b[_0xdf14('0x48')]['id']){delete _0x36370b[_0xdf14('0x48')]['id'];}return db['SugarcrmAccount'][_0xdf14('0x46')]({'where':{'id':_0x36370b[_0xdf14('0x44')]['id']}})[_0xdf14('0x25')](handleEntityNotFound(_0x33dc6b,null))[_0xdf14('0x25')](saveUpdates(_0x36370b['body'],null))['then'](respondWithResult(_0x33dc6b,null))[_0xdf14('0x43')](handleError(_0x33dc6b,null));};exports['destroy']=function(_0x1a9fcc,_0x30b683){return db[_0xdf14('0x2c')]['find']({'where':{'id':_0x1a9fcc[_0xdf14('0x44')]['id']}})[_0xdf14('0x25')](handleEntityNotFound(_0x30b683,null))[_0xdf14('0x25')](removeEntity(_0x30b683,null))['catch'](handleError(_0x30b683,null));};exports[_0xdf14('0x49')]=function(_0x57b47b,_0x11c21b,_0x44df10){var _0x575f19={};var _0x382372={};var _0x2dee23;var _0x14d51a;return db[_0xdf14('0x2c')][_0xdf14('0x4a')]({'where':{'id':_0x57b47b['params']['id']}})['then'](handleEntityNotFound(_0x11c21b,null))[_0xdf14('0x25')](function(_0x3426c3){if(_0x3426c3){_0x2dee23=_0x3426c3;_0x382372[_0xdf14('0x2f')]=_[_0xdf14('0x31')](db[_0xdf14('0x4b')][_0xdf14('0x2d')]);_0x382372['query']=_[_0xdf14('0x31')](_0x57b47b[_0xdf14('0x30')]);_0x382372[_0xdf14('0x3a')]=_['intersection'](_0x382372[_0xdf14('0x2f')],_0x382372['query']);_0x575f19['attributes']=_[_0xdf14('0x32')](_0x382372[_0xdf14('0x2f')],qs[_0xdf14('0x34')](_0x57b47b[_0xdf14('0x30')][_0xdf14('0x34')]));_0x575f19[_0xdf14('0x33')]=_0x575f19[_0xdf14('0x33')][_0xdf14('0x35')]?_0x575f19[_0xdf14('0x33')]:_0x382372[_0xdf14('0x2f')];_0x575f19['order']=qs[_0xdf14('0x39')](_0x57b47b[_0xdf14('0x30')][_0xdf14('0x39')]);_0x575f19[_0xdf14('0x4c')]=qs[_0xdf14('0x3a')](_[_0xdf14('0x3b')](_0x57b47b[_0xdf14('0x30')],_0x382372[_0xdf14('0x3a')]));if(_0x57b47b[_0xdf14('0x30')][_0xdf14('0x3e')]){_0x575f19[_0xdf14('0x4c')]=_['merge'](_0x575f19[_0xdf14('0x4c')],{'$or':_[_0xdf14('0x2b')](_0x575f19[_0xdf14('0x33')],function(_0x19357f){var _0x136d38={};_0x136d38[_0x19357f]={'$like':'%'+_0x57b47b['query']['filter']+'%'};return _0x136d38;})});}_0x575f19=_['merge']({},_0x575f19,_0x57b47b[_0xdf14('0x3f')]);return _0x2dee23['getConfigurations'](_0x575f19);}})[_0xdf14('0x25')](function(_0x2c012d){if(_0x2c012d){_0x14d51a=_0x2c012d[_0xdf14('0x35')];if(!_0x57b47b['query'][_0xdf14('0x36')](_0xdf14('0x37'))){_0x575f19[_0xdf14('0x20')]=qs['limit'](_0x57b47b['query'][_0xdf14('0x20')]);_0x575f19['offset']=qs[_0xdf14('0x1d')](_0x57b47b[_0xdf14('0x30')][_0xdf14('0x1d')]);}return _0x2dee23[_0xdf14('0x49')](_0x575f19);}})[_0xdf14('0x25')](function(_0x50f6b3){if(_0x50f6b3){return _0x50f6b3?{'count':_0x14d51a,'rows':_0x50f6b3}:null;}})['then'](respondWithResult(_0x11c21b,null))[_0xdf14('0x43')](handleError(_0x11c21b,null));};exports[_0xdf14('0x4d')]=function(_0x513093,_0x3f6a60,_0x34d7cf){if(_0x513093[_0xdf14('0x48')]['id']){delete _0x513093[_0xdf14('0x48')]['id'];}return db[_0xdf14('0x2c')][_0xdf14('0x4a')]({'where':{'id':_0x513093[_0xdf14('0x44')]['id']}})[_0xdf14('0x25')](handleEntityNotFound(_0x3f6a60,null))[_0xdf14('0x25')](function(_0x49de62){if(_0x49de62){_0x513093['body']['AccountId']=_0x49de62['id'];_0x513093[_0xdf14('0x48')][_0xdf14('0x4e')]=integrations[_0xdf14('0x4f')](_0x513093[_0xdf14('0x48')][_0xdf14('0x50')],_0x513093[_0xdf14('0x48')]['type']);_0x513093['body'][_0xdf14('0x51')]=integrations[_0xdf14('0x52')](_0x513093['body']['channel'],_0x513093[_0xdf14('0x48')][_0xdf14('0x53')]);return db[_0xdf14('0x4b')][_0xdf14('0x47')](_0x513093[_0xdf14('0x48')],{'include':[{'model':db[_0xdf14('0x54')],'as':'Subjects'},{'model':db[_0xdf14('0x54')],'as':_0xdf14('0x51')}]});}return null;})[_0xdf14('0x25')](respondWithResult(_0x3f6a60,null))[_0xdf14('0x43')](handleError(_0x3f6a60,null));};exports[_0xdf14('0x55')]=function(_0x3c152e,_0x2d3cba,_0xf3bf33){var _0x1c5d92='';var _0x5d6f85=['id','name',_0xdf14('0x56'),'created_by',_0xdf14('0x57'),_0xdf14('0x58'),_0xdf14('0x59'),'duration_minutes',_0xdf14('0x5a'),_0xdf14('0x5b'),_0xdf14('0x5c'),_0xdf14('0x5d')];return db[_0xdf14('0x2c')][_0xdf14('0x4a')]({'where':{'id':_0x3c152e[_0xdf14('0x44')]['id']},'attributes':['id','username','password','remoteUri']})[_0xdf14('0x25')](handleEntityNotFound(_0x2d3cba,null))['then'](function(_0x2ea592){if(_0x2ea592){_0x1c5d92=_0x2ea592['remoteUri'];var _0x719634=_0x1c5d92[_0xdf14('0x5e')](-0x1);if(_0x719634==='/'){_0x1c5d92=_0x1c5d92[_0xdf14('0x5f')](0x0,_0x1c5d92[_0xdf14('0x60')](_0x719634));}return rp({'method':_0xdf14('0x61'),'uri':util[_0xdf14('0x62')](_0xdf14('0x63'),_0x1c5d92,_0xdf14('0x64')),'json':!![],'form':{'method':_0xdf14('0x65'),'input_type':_0xdf14('0x66'),'response_type':'JSON','rest_data':JSON[_0xdf14('0x67')]({'user_auth':{'user_name':_0x2ea592[_0xdf14('0x68')],'password':_0x2ea592[_0xdf14('0x69')],'encryption':'PLAIN'},'application':_0xdf14('0x6a')})}});}})[_0xdf14('0x25')](function(_0x5c3a0b){if(_0x5c3a0b&&_0x5c3a0b[_0xdf14('0x28')]!==_0xdf14('0x6b')&&_0x5c3a0b[_0xdf14('0x28')]!==_0xdf14('0x6c')){return rp({'method':_0xdf14('0x61'),'uri':util[_0xdf14('0x62')](_0xdf14('0x63'),_0x1c5d92,_0xdf14('0x64')),'json':!![],'form':{'method':_0xdf14('0x6d'),'input_type':'JSON','response_type':_0xdf14('0x66'),'rest_data':JSON[_0xdf14('0x67')]({'session':_0x5c3a0b['id'],'module_name':'Calls'})}})[_0xdf14('0x25')](function(_0x452b03){if(_0x452b03){var _0x3660da=_[_0xdf14('0x6e')](_0x452b03[_0xdf14('0x6f')]);_['remove'](_0x3660da,function(_0xb56a3b){return _0x5d6f85[_0xdf14('0x70')](_0xb56a3b[_0xdf14('0x28')]);});return{'count':_0x3660da[_0xdf14('0x35')],'rows':_[_0xdf14('0x2b')](_0x3660da,function(_0x162886){return{'id':_0x162886['name'],'name':_0x162886[_0xdf14('0x71')],'custom':_[_0xdf14('0x72')](_0x162886[_0xdf14('0x28')],'_c')?!![]:![],'options':_0x162886[_0xdf14('0x3f')]?_[_0xdf14('0x2b')](_[_0xdf14('0x6e')](_0x162886[_0xdf14('0x3f')]),function(_0x2cbb56){return{'name':_0x2cbb56[_0xdf14('0x73')],'value':_0x2cbb56[_0xdf14('0x28')]};}):[]};})};}})[_0xdf14('0x25')](respondWithResult(_0x2d3cba,null))['catch'](function(_0x3274aa){var _0x45311a=_0x3c152e[_0xdf14('0x30')][_0xdf14('0x74')]?0x1f4:_0x3274aa[_0xdf14('0x75')]||0x1f4;logger[_0xdf14('0x27')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x45311a,JSON['stringify'](_0x3274aa));delete _0x3274aa[_0xdf14('0x28')];if(_0x45311a===0x191){_0x45311a=0x190;}_0x2d3cba[_0xdf14('0x1b')](_0x45311a)['send'](_0x3c152e[_0xdf14('0x30')][_0xdf14('0x74')]?{'message':_0xdf14('0x76'),'statusCode':_0x3274aa['statusCode']}:_0x3274aa);});}else{var _0x5661b6=0x1f4;_0x2d3cba['status'](_0x5661b6)[_0xdf14('0x29')]({'message':_0xdf14('0x76'),'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 2b50b65..bd8d388 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 _0xc610=['rimraf','./intSugarcrmAccount.attributes','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x52c4b4,_0x48278b){var _0x12be5b=function(_0x14987d){while(--_0x14987d){_0x52c4b4['push'](_0x52c4b4['shift']());}};_0x12be5b(++_0x48278b);}(_0xc610,0x1d9));var _0x0c61=function(_0x3aeec2,_0x167576){_0x3aeec2=_0x3aeec2-0x0;var _0xbf0ef1=_0xc610[_0x3aeec2];return _0xbf0ef1;};'use strict';var _=require(_0x0c61('0x0'));var util=require(_0x0c61('0x1'));var logger=require(_0x0c61('0x2'))(_0x0c61('0x3'));var moment=require('moment');var BPromise=require(_0x0c61('0x4'));var rp=require(_0x0c61('0x5'));var fs=require('fs');var path=require(_0x0c61('0x6'));var rimraf=require(_0x0c61('0x7'));var config=require('../../config/environment');var attributes=require(_0x0c61('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x0c61('0x9')]=function(_0x1e654c,_0x1d95ad){return _0x1e654c[_0x0c61('0xa')]('SugarcrmAccount',attributes,{'tableName':_0x0c61('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0100=['SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define'];(function(_0xd370d5,_0x3cdbb9){var _0x1250f2=function(_0x4bb0f8){while(--_0x4bb0f8){_0xd370d5['push'](_0xd370d5['shift']());}};_0x1250f2(++_0x3cdbb9);}(_0x0100,0x7a));var _0x0010=function(_0x1889e8,_0x30b3df){_0x1889e8=_0x1889e8-0x0;var _0x3a8bac=_0x0100[_0x1889e8];return _0x3a8bac;};'use strict';var _=require(_0x0010('0x0'));var util=require('util');var logger=require(_0x0010('0x1'))(_0x0010('0x2'));var moment=require('moment');var BPromise=require(_0x0010('0x3'));var rp=require(_0x0010('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0010('0x5'));var config=require(_0x0010('0x6'));var attributes=require(_0x0010('0x7'));var integrations=require(_0x0010('0x8'));module['exports']=function(_0x2ba276,_0x45a0bc){return _0x2ba276[_0x0010('0x9')](_0x0010('0xa'),attributes,{'tableName':_0x0010('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 265e4ee..fe14930 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 _0xb840=['then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','SugarcrmAccount','findAll','options','attributes','limit','include','map','model','GetSugarcrmAccount','ShowSugarcrmAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0xdf053,_0x2834cb){var _0x5c4a2e=function(_0x10dc50){while(--_0x10dc50){_0xdf053['push'](_0xdf053['shift']());}};_0x5c4a2e(++_0x2834cb);}(_0xb840,0x64));var _0x0b84=function(_0x1987db,_0x3816ed){_0x1987db=_0x1987db-0x0;var _0xd903c0=_0xb840[_0x1987db];return _0xd903c0;};'use strict';var _=require(_0x0b84('0x0'));var util=require(_0x0b84('0x1'));var moment=require(_0x0b84('0x2'));var BPromise=require(_0x0b84('0x3'));var rs=require(_0x0b84('0x4'));var fs=require('fs');var Redis=require(_0x0b84('0x5'));var db=require(_0x0b84('0x6'))['db'];var utils=require(_0x0b84('0x7'));var logger=require(_0x0b84('0x8'))(_0x0b84('0x9'));var config=require(_0x0b84('0xa'));var jayson=require(_0x0b84('0xb'));var client=jayson['client'][_0x0b84('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c4c9a,_0x543fed,_0x278241){return new BPromise(function(_0x5a4b6e,_0x4528c1){return client[_0x0b84('0xd')](_0x5c4c9a,_0x278241)[_0x0b84('0xe')](function(_0x39a761){logger[_0x0b84('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x543fed,_0x0b84('0x10'));logger[_0x0b84('0x11')](_0x0b84('0x12'),_0x543fed,_0x0b84('0x10'),JSON[_0x0b84('0x13')](_0x39a761));if(_0x39a761[_0x0b84('0x14')]){if(_0x39a761[_0x0b84('0x14')][_0x0b84('0x15')]===0x1f4){logger[_0x0b84('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x543fed,_0x39a761[_0x0b84('0x14')][_0x0b84('0x16')]);return _0x4528c1(_0x39a761['error'][_0x0b84('0x16')]);}logger['error'](_0x0b84('0x17'),_0x543fed,_0x39a761[_0x0b84('0x14')]['message']);return _0x5a4b6e(_0x39a761['error'][_0x0b84('0x16')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x543fed,_0x0b84('0x10'));_0x5a4b6e(_0x39a761[_0x0b84('0x18')][_0x0b84('0x16')]);}})[_0x0b84('0x19')](function(_0x40b1e4){logger[_0x0b84('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x543fed,_0x40b1e4);_0x4528c1(_0x40b1e4);});});}exports['GetSugarcrmAccount']=function(_0xb4be60){var _0x326b72=this;return new Promise(function(_0x2a9d1e,_0x4375c2){return db[_0x0b84('0x1a')][_0x0b84('0x1b')]({'raw':_0xb4be60['options']?_0xb4be60[_0x0b84('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xb4be60['options']?_0xb4be60[_0x0b84('0x1c')]['where']||null:null,'attributes':_0xb4be60['options']?_0xb4be60[_0x0b84('0x1c')][_0x0b84('0x1d')]||null:null,'limit':_0xb4be60[_0x0b84('0x1c')]?_0xb4be60[_0x0b84('0x1c')][_0x0b84('0x1e')]||null:null,'include':_0xb4be60[_0x0b84('0x1c')]?_0xb4be60[_0x0b84('0x1c')][_0x0b84('0x1f')]?_[_0x0b84('0x20')](_0xb4be60[_0x0b84('0x1c')]['include'],function(_0x5aefe6){return{'model':db[_0x5aefe6['model']],'as':_0x5aefe6['as'],'attributes':_0x5aefe6[_0x0b84('0x1d')],'include':_0x5aefe6['include']?_[_0x0b84('0x20')](_0x5aefe6[_0x0b84('0x1f')],function(_0x1d6f2d){return{'model':db[_0x1d6f2d[_0x0b84('0x21')]],'as':_0x1d6f2d['as'],'attributes':_0x1d6f2d[_0x0b84('0x1d')],'include':_0x1d6f2d['include']?_[_0x0b84('0x20')](_0x1d6f2d['include'],function(_0x30e042){return{'model':db[_0x30e042['model']],'as':_0x30e042['as'],'attributes':_0x30e042['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x78ffee){logger[_0x0b84('0xf')]('GetSugarcrmAccount',_0xb4be60);logger['debug'](_0x0b84('0x22'),_0xb4be60,JSON[_0x0b84('0x13')](_0x78ffee));_0x2a9d1e(_0x78ffee);})[_0x0b84('0x19')](function(_0x33a19e){logger[_0x0b84('0x14')](_0x0b84('0x22'),_0x33a19e[_0x0b84('0x16')],_0xb4be60);_0x4375c2(_0x326b72[_0x0b84('0x14')](0x1f4,_0x33a19e[_0x0b84('0x16')]));});});};exports[_0x0b84('0x23')]=function(_0x1037eb){var _0x391546=this;return new Promise(function(_0x2cdd1a,_0x1e43fc){return db['SugarcrmAccount'][_0x0b84('0x24')]({'raw':_0x1037eb[_0x0b84('0x1c')]?_0x1037eb[_0x0b84('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1037eb[_0x0b84('0x1c')]?_0x1037eb[_0x0b84('0x1c')][_0x0b84('0x25')]||null:null,'attributes':_0x1037eb[_0x0b84('0x1c')]?_0x1037eb[_0x0b84('0x1c')]['attributes']||null:null,'include':_0x1037eb['options']?_0x1037eb[_0x0b84('0x1c')][_0x0b84('0x1f')]?_[_0x0b84('0x20')](_0x1037eb['options'][_0x0b84('0x1f')],function(_0x461706){return{'model':db[_0x461706['model']],'as':_0x461706['as'],'attributes':_0x461706[_0x0b84('0x1d')],'include':_0x461706[_0x0b84('0x1f')]?_['map'](_0x461706[_0x0b84('0x1f')],function(_0x641df4){return{'model':db[_0x641df4[_0x0b84('0x21')]],'as':_0x641df4['as'],'attributes':_0x641df4['attributes'],'include':_0x641df4[_0x0b84('0x1f')]?_['map'](_0x641df4[_0x0b84('0x1f')],function(_0x2fc33c){return{'model':db[_0x2fc33c['model']],'as':_0x2fc33c['as'],'attributes':_0x2fc33c[_0x0b84('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50ed02){logger['info'](_0x0b84('0x23'),_0x1037eb);logger[_0x0b84('0x11')]('ShowSugarcrmAccount',_0x1037eb,JSON[_0x0b84('0x13')](_0x50ed02));_0x2cdd1a(_0x50ed02);})[_0x0b84('0x19')](function(_0x3c6bfb){logger[_0x0b84('0x14')](_0x0b84('0x23'),_0x3c6bfb[_0x0b84('0x16')],_0x1037eb);_0x1e43fc(_0x391546[_0x0b84('0x14')](0x1f4,_0x3c6bfb['message']));});});}; \ No newline at end of file +var _0x175a=['attributes','include','map','model','catch','ShowSugarcrmAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw'];(function(_0x246f36,_0x47addd){var _0x227f58=function(_0x412bc0){while(--_0x412bc0){_0x246f36['push'](_0x246f36['shift']());}};_0x227f58(++_0x47addd);}(_0x175a,0xc6));var _0xa175=function(_0x54b1d8,_0x3356c5){_0x54b1d8=_0x54b1d8-0x0;var _0x5eeacd=_0x175a[_0x54b1d8];return _0x5eeacd;};'use strict';var _=require(_0xa175('0x0'));var util=require(_0xa175('0x1'));var moment=require(_0xa175('0x2'));var BPromise=require(_0xa175('0x3'));var rs=require(_0xa175('0x4'));var fs=require('fs');var Redis=require(_0xa175('0x5'));var db=require(_0xa175('0x6'))['db'];var utils=require(_0xa175('0x7'));var logger=require(_0xa175('0x8'))(_0xa175('0x9'));var config=require(_0xa175('0xa'));var jayson=require(_0xa175('0xb'));var client=jayson['client'][_0xa175('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa142db,_0xbeed5b,_0x43a621){return new BPromise(function(_0x16629a,_0x143056){return client[_0xa175('0xd')](_0xa142db,_0x43a621)[_0xa175('0xe')](function(_0x4f47cf){logger[_0xa175('0xf')](_0xa175('0x10'),_0xbeed5b,_0xa175('0x11'));logger[_0xa175('0x12')](_0xa175('0x13'),_0xbeed5b,_0xa175('0x11'),JSON[_0xa175('0x14')](_0x4f47cf));if(_0x4f47cf[_0xa175('0x15')]){if(_0x4f47cf['error'][_0xa175('0x16')]===0x1f4){logger[_0xa175('0x15')](_0xa175('0x10'),_0xbeed5b,_0x4f47cf[_0xa175('0x15')][_0xa175('0x17')]);return _0x143056(_0x4f47cf[_0xa175('0x15')][_0xa175('0x17')]);}logger[_0xa175('0x15')](_0xa175('0x10'),_0xbeed5b,_0x4f47cf['error'][_0xa175('0x17')]);return _0x16629a(_0x4f47cf[_0xa175('0x15')][_0xa175('0x17')]);}else{logger[_0xa175('0xf')](_0xa175('0x10'),_0xbeed5b,_0xa175('0x11'));_0x16629a(_0x4f47cf[_0xa175('0x18')][_0xa175('0x17')]);}})['catch'](function(_0x40b5f0){logger[_0xa175('0x15')](_0xa175('0x10'),_0xbeed5b,_0x40b5f0);_0x143056(_0x40b5f0);});});}exports[_0xa175('0x19')]=function(_0x2576a4){var _0x20cd5d=this;return new Promise(function(_0x11f3c6,_0x32fc2b){return db[_0xa175('0x1a')][_0xa175('0x1b')]({'raw':_0x2576a4[_0xa175('0x1c')]?_0x2576a4[_0xa175('0x1c')][_0xa175('0x1d')]===undefined?!![]:![]:!![],'where':_0x2576a4[_0xa175('0x1c')]?_0x2576a4['options']['where']||null:null,'attributes':_0x2576a4['options']?_0x2576a4[_0xa175('0x1c')][_0xa175('0x1e')]||null:null,'limit':_0x2576a4[_0xa175('0x1c')]?_0x2576a4[_0xa175('0x1c')]['limit']||null:null,'include':_0x2576a4['options']?_0x2576a4[_0xa175('0x1c')][_0xa175('0x1f')]?_[_0xa175('0x20')](_0x2576a4['options'][_0xa175('0x1f')],function(_0x198398){return{'model':db[_0x198398['model']],'as':_0x198398['as'],'attributes':_0x198398[_0xa175('0x1e')],'include':_0x198398[_0xa175('0x1f')]?_[_0xa175('0x20')](_0x198398[_0xa175('0x1f')],function(_0x1a0f3e){return{'model':db[_0x1a0f3e[_0xa175('0x21')]],'as':_0x1a0f3e['as'],'attributes':_0x1a0f3e['attributes'],'include':_0x1a0f3e['include']?_[_0xa175('0x20')](_0x1a0f3e[_0xa175('0x1f')],function(_0x5d30cb){return{'model':db[_0x5d30cb[_0xa175('0x21')]],'as':_0x5d30cb['as'],'attributes':_0x5d30cb['attributes']};}):[]};}):[]};}):[]:[]})[_0xa175('0xe')](function(_0x53b6ce){logger[_0xa175('0xf')](_0xa175('0x19'),_0x2576a4);logger[_0xa175('0x12')]('GetSugarcrmAccount',_0x2576a4,JSON[_0xa175('0x14')](_0x53b6ce));_0x11f3c6(_0x53b6ce);})[_0xa175('0x22')](function(_0xe630ff){logger[_0xa175('0x15')](_0xa175('0x19'),_0xe630ff['message'],_0x2576a4);_0x32fc2b(_0x20cd5d[_0xa175('0x15')](0x1f4,_0xe630ff[_0xa175('0x17')]));});});};exports[_0xa175('0x23')]=function(_0x167f67){var _0x454abb=this;return new Promise(function(_0x3c15b5,_0x2f04a2){return db[_0xa175('0x1a')][_0xa175('0x24')]({'raw':_0x167f67[_0xa175('0x1c')]?_0x167f67['options'][_0xa175('0x1d')]===undefined?!![]:![]:!![],'where':_0x167f67[_0xa175('0x1c')]?_0x167f67[_0xa175('0x1c')][_0xa175('0x25')]||null:null,'attributes':_0x167f67[_0xa175('0x1c')]?_0x167f67[_0xa175('0x1c')][_0xa175('0x1e')]||null:null,'include':_0x167f67[_0xa175('0x1c')]?_0x167f67[_0xa175('0x1c')][_0xa175('0x1f')]?_[_0xa175('0x20')](_0x167f67[_0xa175('0x1c')][_0xa175('0x1f')],function(_0x5396b5){return{'model':db[_0x5396b5['model']],'as':_0x5396b5['as'],'attributes':_0x5396b5['attributes'],'include':_0x5396b5[_0xa175('0x1f')]?_['map'](_0x5396b5[_0xa175('0x1f')],function(_0x4ff745){return{'model':db[_0x4ff745['model']],'as':_0x4ff745['as'],'attributes':_0x4ff745[_0xa175('0x1e')],'include':_0x4ff745[_0xa175('0x1f')]?_['map'](_0x4ff745[_0xa175('0x1f')],function(_0xe79329){return{'model':db[_0xe79329[_0xa175('0x21')]],'as':_0xe79329['as'],'attributes':_0xe79329[_0xa175('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa175('0xe')](function(_0x4ca35c){logger[_0xa175('0xf')](_0xa175('0x23'),_0x167f67);logger[_0xa175('0x12')](_0xa175('0x23'),_0x167f67,JSON[_0xa175('0x14')](_0x4ca35c));_0x3c15b5(_0x4ca35c);})[_0xa175('0x22')](function(_0x4e08dc){logger['error']('ShowSugarcrmAccount',_0x4e08dc[_0xa175('0x17')],_0x167f67);_0x2f04a2(_0x454abb[_0xa175('0x15')](0x1f4,_0x4e08dc[_0xa175('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index b462b19..a09f462 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 _0x8ed0=['isAuthenticated','index','get','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller'];(function(_0x32fab5,_0x1c3ea6){var _0x1983ea=function(_0x2c2289){while(--_0x2c2289){_0x32fab5['push'](_0x32fab5['shift']());}};_0x1983ea(++_0x1c3ea6);}(_0x8ed0,0xbe));var _0x08ed=function(_0x550416,_0x564dd0){_0x550416=_0x550416-0x0;var _0x4e2345=_0x8ed0[_0x550416];return _0x4e2345;};'use strict';var multer=require(_0x08ed('0x0'));var util=require(_0x08ed('0x1'));var path=require(_0x08ed('0x2'));var timeout=require(_0x08ed('0x3'));var express=require(_0x08ed('0x4'));var router=express[_0x08ed('0x5')]();var fs_extra=require(_0x08ed('0x6'));var auth=require(_0x08ed('0x7'));var interaction=require(_0x08ed('0x8'));var config=require('../../config/environment');var controller=require(_0x08ed('0x9'));router['get']('/',auth[_0x08ed('0xa')](),controller[_0x08ed('0xb')]);router[_0x08ed('0xc')]('/:id',auth[_0x08ed('0xa')](),controller['show']);router[_0x08ed('0xc')](_0x08ed('0xd'),auth[_0x08ed('0xa')](),controller[_0x08ed('0xe')]);router[_0x08ed('0xc')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x08ed('0xf')]);router[_0x08ed('0xc')](_0x08ed('0x10'),auth[_0x08ed('0xa')](),controller[_0x08ed('0x11')]);router[_0x08ed('0x12')]('/',auth[_0x08ed('0xa')](),controller['create']);router[_0x08ed('0x13')](_0x08ed('0x14'),auth['isAuthenticated'](),controller[_0x08ed('0x15')]);router[_0x08ed('0x16')](_0x08ed('0x14'),auth[_0x08ed('0xa')](),controller[_0x08ed('0x17')]);module[_0x08ed('0x18')]=router; \ No newline at end of file +var _0x070e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x070e,0xcb));var _0xe070=function(_0x5400e3,_0x498ca5){_0x5400e3=_0x5400e3-0x0;var _0x2e34c=_0x070e[_0x5400e3];return _0x2e34c;};'use strict';var multer=require(_0xe070('0x0'));var util=require('util');var path=require(_0xe070('0x1'));var timeout=require(_0xe070('0x2'));var express=require(_0xe070('0x3'));var router=express['Router']();var fs_extra=require(_0xe070('0x4'));var auth=require(_0xe070('0x5'));var interaction=require(_0xe070('0x6'));var config=require(_0xe070('0x7'));var controller=require(_0xe070('0x8'));router[_0xe070('0x9')]('/',auth['isAuthenticated'](),controller[_0xe070('0xa')]);router[_0xe070('0x9')](_0xe070('0xb'),auth[_0xe070('0xc')](),controller['show']);router['get']('/:id/fields',auth[_0xe070('0xc')](),controller[_0xe070('0xd')]);router[_0xe070('0x9')](_0xe070('0xe'),auth[_0xe070('0xc')](),controller['getSubjects']);router[_0xe070('0x9')](_0xe070('0xf'),auth[_0xe070('0xc')](),controller['getDescriptions']);router[_0xe070('0x10')]('/',auth['isAuthenticated'](),controller[_0xe070('0x11')]);router[_0xe070('0x12')]('/:id',auth[_0xe070('0xc')](),controller[_0xe070('0x13')]);router[_0xe070('0x14')](_0xe070('0xb'),auth['isAuthenticated'](),controller[_0xe070('0x15')]);module[_0xe070('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index cc403f3..393f63d 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 _0x877e=['STRING'];(function(_0x11cb55,_0x228c6c){var _0x590c0c=function(_0x493293){while(--_0x493293){_0x11cb55['push'](_0x11cb55['shift']());}};_0x590c0c(++_0x228c6c);}(_0x877e,0x18c));var _0xe877=function(_0x473f8d,_0x59dfa3){_0x473f8d=_0x473f8d-0x0;var _0x4ec358=_0x877e[_0x473f8d];return _0x4ec358;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe877('0x0')]},'description':{'type':Sequelize[_0xe877('0x0')]}}; \ No newline at end of file +var _0x3b2c=['sequelize','exports','STRING'];(function(_0x46b1b8,_0x4c310b){var _0x583b24=function(_0x2d756c){while(--_0x2d756c){_0x46b1b8['push'](_0x46b1b8['shift']());}};_0x583b24(++_0x4c310b);}(_0x3b2c,0x13e));var _0xc3b2=function(_0x1b8adf,_0x4b218b){_0x1b8adf=_0x1b8adf-0x0;var _0x14943e=_0x3b2c[_0x1b8adf];return _0x14943e;};'use strict';var Sequelize=require(_0xc3b2('0x0'));module[_0xc3b2('0x1')]={'name':{'type':Sequelize[_0xc3b2('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 5a10421..efb4597 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 _0x083b=['create','body','getFields','findOne','order','getSubjects','getDescriptions','SugarcrmField','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x1987b5,_0x1c3b83){var _0x5c6f49=function(_0x2660c8){while(--_0x2660c8){_0x1987b5['push'](_0x1987b5['shift']());}};_0x5c6f49(++_0x1c3b83);}(_0x083b,0x193));var _0xb083=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0x083b[_0x87239];return _0x53af1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb083('0x0'));var zipdir=require(_0xb083('0x1'));var jsonpatch=require(_0xb083('0x2'));var rp=require('request-promise');var moment=require(_0xb083('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb083('0x4'));var util=require(_0xb083('0x5'));var path=require(_0xb083('0x6'));var sox=require('sox');var csv=require(_0xb083('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb083('0x8'));var _=require(_0xb083('0x9'));var squel=require('squel');var crypto=require(_0xb083('0xa'));var jsforce=require(_0xb083('0xb'));var deskjs=require(_0xb083('0xc'));var toCsv=require(_0xb083('0x7'));var querystring=require('querystring');var Papa=require(_0xb083('0xd'));var Redis=require(_0xb083('0xe'));var authService=require(_0xb083('0xf'));var qs=require(_0xb083('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb083('0x11'));var logger=require('../../config/logger')(_0xb083('0x12'));var utils=require(_0xb083('0x13'));var config=require(_0xb083('0x14'));var licenseUtil=require(_0xb083('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cb9ed,_0x15d815){_0x15d815=_0x15d815||0xcc;return function(_0x292a2b){if(_0x292a2b){return _0x3cb9ed[_0xb083('0x16')](_0x15d815);}return _0x3cb9ed[_0xb083('0x17')](_0x15d815)[_0xb083('0x18')]();};}function respondWithResult(_0x1801ec,_0x32f225){_0x32f225=_0x32f225||0xc8;return function(_0x1a7b72){if(_0x1a7b72){return _0x1801ec[_0xb083('0x17')](_0x32f225)[_0xb083('0x19')](_0x1a7b72);}};}function respondWithFilteredResult(_0x451fe0,_0x1a3d3f){return function(_0xb4a3c){if(_0xb4a3c){var _0x48f2c5=typeof _0x1a3d3f[_0xb083('0x1a')]===_0xb083('0x1b')&&typeof _0x1a3d3f[_0xb083('0x1c')]===_0xb083('0x1b');var _0x445317=_0xb4a3c[_0xb083('0x1d')];var _0x2d7347=_0x48f2c5?0x0:_0x1a3d3f['offset'];var _0x1bb218=_0x48f2c5?_0xb4a3c['count']:_0x1a3d3f[_0xb083('0x1a')]+_0x1a3d3f[_0xb083('0x1c')];var _0x186028;if(_0x1bb218>=_0x445317){_0x1bb218=_0x445317;_0x186028=0xc8;}else{_0x186028=0xce;}_0x451fe0[_0xb083('0x17')](_0x186028);return _0x451fe0[_0xb083('0x1e')](_0xb083('0x1f'),_0x2d7347+'-'+_0x1bb218+'/'+_0x445317)[_0xb083('0x19')](_0xb4a3c);}return null;};}function patchUpdates(_0x3940d7){return function(_0x345f5b){try{jsonpatch[_0xb083('0x20')](_0x345f5b,_0x3940d7,!![]);}catch(_0x3bdf74){return BPromise[_0xb083('0x21')](_0x3bdf74);}return _0x345f5b[_0xb083('0x22')]();};}function saveUpdates(_0x38f3d8,_0x25a9e8){return function(_0x5312c7){if(_0x5312c7){return _0x5312c7[_0xb083('0x23')](_0x38f3d8)[_0xb083('0x24')](function(_0x1c148a){return _0x1c148a;});}return null;};}function removeEntity(_0x5a700d,_0x8fe171){return function(_0x32b242){if(_0x32b242){return _0x32b242[_0xb083('0x25')]()['then'](function(){_0x5a700d[_0xb083('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d9fec,_0x332b65){return function(_0x462348){if(!_0x462348){_0x2d9fec[_0xb083('0x16')](0x194);}return _0x462348;};}function handleError(_0x3d8cfb,_0x37dd15){_0x37dd15=_0x37dd15||0x1f4;return function(_0x3ae8a0){logger['error'](_0x3ae8a0[_0xb083('0x26')]);if(_0x3ae8a0[_0xb083('0x27')]){delete _0x3ae8a0[_0xb083('0x27')];}_0x3d8cfb['status'](_0x37dd15)[_0xb083('0x28')](_0x3ae8a0);};}exports[_0xb083('0x29')]=function(_0xb04a21,_0x35d1f6){var _0x25cf29={},_0x2ba1fe={},_0x1ef4c0={'count':0x0,'rows':[]};var _0x17c788=_[_0xb083('0x2a')](db['SugarcrmConfiguration'][_0xb083('0x2b')],function(_0x2e9fb7){return{'name':_0x2e9fb7['fieldName'],'type':_0x2e9fb7[_0xb083('0x2c')]['key']};});_0x2ba1fe[_0xb083('0x2d')]=_[_0xb083('0x2a')](_0x17c788,_0xb083('0x27'));_0x2ba1fe[_0xb083('0x2e')]=_[_0xb083('0x2f')](_0xb04a21[_0xb083('0x2e')]);_0x2ba1fe[_0xb083('0x30')]=_[_0xb083('0x31')](_0x2ba1fe['model'],_0x2ba1fe['query']);_0x25cf29[_0xb083('0x32')]=_['intersection'](_0x2ba1fe[_0xb083('0x2d')],qs[_0xb083('0x33')](_0xb04a21['query'][_0xb083('0x33')]));_0x25cf29[_0xb083('0x32')]=_0x25cf29['attributes'][_0xb083('0x34')]?_0x25cf29['attributes']:_0x2ba1fe['model'];if(!_0xb04a21[_0xb083('0x2e')][_0xb083('0x35')](_0xb083('0x36'))){_0x25cf29[_0xb083('0x1c')]=qs['limit'](_0xb04a21[_0xb083('0x2e')][_0xb083('0x1c')]);_0x25cf29[_0xb083('0x1a')]=qs[_0xb083('0x1a')](_0xb04a21[_0xb083('0x2e')][_0xb083('0x1a')]);}_0x25cf29['order']=qs[_0xb083('0x37')](_0xb04a21[_0xb083('0x2e')][_0xb083('0x37')]);_0x25cf29[_0xb083('0x38')]=qs[_0xb083('0x30')](_[_0xb083('0x39')](_0xb04a21[_0xb083('0x2e')],_0x2ba1fe['filters']),_0x17c788);if(_0xb04a21['query'][_0xb083('0x3a')]){_0x25cf29[_0xb083('0x38')]=_[_0xb083('0x3b')](_0x25cf29[_0xb083('0x38')],{'$or':_[_0xb083('0x2a')](_0x17c788,function(_0x5457c4){if(_0x5457c4[_0xb083('0x2c')]!==_0xb083('0x3c')){var _0x2befab={};_0x2befab[_0x5457c4[_0xb083('0x27')]]={'$like':'%'+_0xb04a21[_0xb083('0x2e')]['filter']+'%'};return _0x2befab;}})});}_0x25cf29=_['merge']({},_0x25cf29,_0xb04a21[_0xb083('0x3d')]);var _0x438411={'where':_0x25cf29[_0xb083('0x38')]};return db[_0xb083('0x3e')]['count'](_0x438411)[_0xb083('0x24')](function(_0x4b7382){_0x1ef4c0[_0xb083('0x1d')]=_0x4b7382;if(_0xb04a21[_0xb083('0x2e')][_0xb083('0x3f')]){_0x25cf29[_0xb083('0x40')]=[{'all':!![]}];}return db[_0xb083('0x3e')][_0xb083('0x41')](_0x25cf29);})[_0xb083('0x24')](function(_0x5a49b4){_0x1ef4c0[_0xb083('0x42')]=_0x5a49b4;return _0x1ef4c0;})[_0xb083('0x24')](respondWithFilteredResult(_0x35d1f6,_0x25cf29))[_0xb083('0x43')](handleError(_0x35d1f6,null));};exports[_0xb083('0x44')]=function(_0x4683b1,_0x2bebd2){var _0x58d8c9={'raw':![],'where':{'id':_0x4683b1[_0xb083('0x45')]['id']}},_0x112c05={};_0x112c05[_0xb083('0x2d')]=_[_0xb083('0x2f')](db[_0xb083('0x3e')][_0xb083('0x2b')]);_0x112c05[_0xb083('0x2e')]=_[_0xb083('0x2f')](_0x4683b1[_0xb083('0x2e')]);_0x112c05[_0xb083('0x30')]=_[_0xb083('0x31')](_0x112c05[_0xb083('0x2d')],_0x112c05[_0xb083('0x2e')]);_0x58d8c9['attributes']=_[_0xb083('0x31')](_0x112c05[_0xb083('0x2d')],qs[_0xb083('0x33')](_0x4683b1[_0xb083('0x2e')][_0xb083('0x33')]));_0x58d8c9[_0xb083('0x32')]=_0x58d8c9[_0xb083('0x32')][_0xb083('0x34')]?_0x58d8c9[_0xb083('0x32')]:_0x112c05[_0xb083('0x2d')];if(_0x4683b1['query'][_0xb083('0x3f')]){_0x58d8c9[_0xb083('0x40')]=[{'all':!![]}];}_0x58d8c9=_[_0xb083('0x3b')]({},_0x58d8c9,_0x4683b1['options']);return db[_0xb083('0x3e')][_0xb083('0x46')](_0x58d8c9)['then'](handleEntityNotFound(_0x2bebd2,null))[_0xb083('0x24')](respondWithResult(_0x2bebd2,null))[_0xb083('0x43')](handleError(_0x2bebd2,null));};exports[_0xb083('0x47')]=function(_0x2ac4c2,_0x559777){return db[_0xb083('0x3e')]['create'](_0x2ac4c2[_0xb083('0x48')],{})[_0xb083('0x24')](respondWithResult(_0x559777,0xc9))['catch'](handleError(_0x559777,null));};exports[_0xb083('0x23')]=function(_0x33f936,_0x3ebf36){if(_0x33f936[_0xb083('0x48')]['id']){delete _0x33f936[_0xb083('0x48')]['id'];}return db[_0xb083('0x3e')]['find']({'where':{'id':_0x33f936[_0xb083('0x45')]['id']}})[_0xb083('0x24')](handleEntityNotFound(_0x3ebf36,null))[_0xb083('0x24')](saveUpdates(_0x33f936[_0xb083('0x48')],null))[_0xb083('0x24')](respondWithResult(_0x3ebf36,null))[_0xb083('0x43')](handleError(_0x3ebf36,null));};exports[_0xb083('0x25')]=function(_0x3d638a,_0x59f940){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x3d638a[_0xb083('0x45')]['id']}})['then'](handleEntityNotFound(_0x59f940,null))[_0xb083('0x24')](removeEntity(_0x59f940,null))[_0xb083('0x43')](handleError(_0x59f940,null));};exports[_0xb083('0x49')]=function(_0xe27e8c,_0x41538f,_0x3f3ed1){var _0x437884={};var _0x557f6e={};var _0x1b1c3a;var _0x147ac6;return db[_0xb083('0x3e')][_0xb083('0x4a')]({'where':{'id':_0xe27e8c[_0xb083('0x45')]['id']}})[_0xb083('0x24')](handleEntityNotFound(_0x41538f,null))[_0xb083('0x24')](function(_0x380efc){if(_0x380efc){_0x1b1c3a=_0x380efc;_0x557f6e[_0xb083('0x2d')]=_[_0xb083('0x2f')](db['SugarcrmField'][_0xb083('0x2b')]);_0x557f6e['query']=_['keys'](_0xe27e8c[_0xb083('0x2e')]);_0x557f6e[_0xb083('0x30')]=_[_0xb083('0x31')](_0x557f6e['model'],_0x557f6e[_0xb083('0x2e')]);_0x437884['attributes']=_[_0xb083('0x31')](_0x557f6e[_0xb083('0x2d')],qs['fields'](_0xe27e8c[_0xb083('0x2e')][_0xb083('0x33')]));_0x437884[_0xb083('0x32')]=_0x437884['attributes'][_0xb083('0x34')]?_0x437884[_0xb083('0x32')]:_0x557f6e[_0xb083('0x2d')];_0x437884[_0xb083('0x4b')]=qs[_0xb083('0x37')](_0xe27e8c['query'][_0xb083('0x37')]);_0x437884[_0xb083('0x38')]=qs['filters'](_[_0xb083('0x39')](_0xe27e8c[_0xb083('0x2e')],_0x557f6e[_0xb083('0x30')]));if(_0xe27e8c[_0xb083('0x2e')][_0xb083('0x3a')]){_0x437884[_0xb083('0x38')]=_['merge'](_0x437884[_0xb083('0x38')],{'$or':_[_0xb083('0x2a')](_0x437884['attributes'],function(_0x16309){var _0x2e9331={};_0x2e9331[_0x16309]={'$like':'%'+_0xe27e8c[_0xb083('0x2e')][_0xb083('0x3a')]+'%'};return _0x2e9331;})});}_0x437884=_[_0xb083('0x3b')]({},_0x437884,_0xe27e8c['options']);return _0x1b1c3a['getFields'](_0x437884);}})[_0xb083('0x24')](function(_0x5dce84){if(_0x5dce84){_0x147ac6=_0x5dce84[_0xb083('0x34')];if(!_0xe27e8c[_0xb083('0x2e')][_0xb083('0x35')](_0xb083('0x36'))){_0x437884[_0xb083('0x1c')]=qs[_0xb083('0x1c')](_0xe27e8c[_0xb083('0x2e')][_0xb083('0x1c')]);_0x437884[_0xb083('0x1a')]=qs[_0xb083('0x1a')](_0xe27e8c[_0xb083('0x2e')]['offset']);}return _0x1b1c3a[_0xb083('0x49')](_0x437884);}})['then'](function(_0x419bf0){if(_0x419bf0){return _0x419bf0?{'count':_0x147ac6,'rows':_0x419bf0}:null;}})[_0xb083('0x24')](respondWithResult(_0x41538f,null))[_0xb083('0x43')](handleError(_0x41538f,null));};exports[_0xb083('0x4c')]=function(_0x26af4c,_0x1732b3,_0x183600){var _0xec2998={};var _0x32f510={};var _0x16e1e5;var _0x123160;return db[_0xb083('0x3e')][_0xb083('0x4a')]({'where':{'id':_0x26af4c['params']['id']}})[_0xb083('0x24')](handleEntityNotFound(_0x1732b3,null))[_0xb083('0x24')](function(_0x3021e5){if(_0x3021e5){_0x16e1e5=_0x3021e5;_0x32f510[_0xb083('0x2d')]=_[_0xb083('0x2f')](db['SugarcrmField'][_0xb083('0x2b')]);_0x32f510[_0xb083('0x2e')]=_[_0xb083('0x2f')](_0x26af4c['query']);_0x32f510['filters']=_[_0xb083('0x31')](_0x32f510[_0xb083('0x2d')],_0x32f510[_0xb083('0x2e')]);_0xec2998[_0xb083('0x32')]=_[_0xb083('0x31')](_0x32f510[_0xb083('0x2d')],qs[_0xb083('0x33')](_0x26af4c[_0xb083('0x2e')][_0xb083('0x33')]));_0xec2998[_0xb083('0x32')]=_0xec2998[_0xb083('0x32')][_0xb083('0x34')]?_0xec2998[_0xb083('0x32')]:_0x32f510[_0xb083('0x2d')];_0xec2998[_0xb083('0x4b')]=qs[_0xb083('0x37')](_0x26af4c[_0xb083('0x2e')][_0xb083('0x37')]);_0xec2998[_0xb083('0x38')]=qs['filters'](_['pick'](_0x26af4c['query'],_0x32f510[_0xb083('0x30')]));if(_0x26af4c['query'][_0xb083('0x3a')]){_0xec2998[_0xb083('0x38')]=_[_0xb083('0x3b')](_0xec2998['where'],{'$or':_[_0xb083('0x2a')](_0xec2998[_0xb083('0x32')],function(_0x2de6c0){var _0x1010a3={};_0x1010a3[_0x2de6c0]={'$like':'%'+_0x26af4c[_0xb083('0x2e')][_0xb083('0x3a')]+'%'};return _0x1010a3;})});}_0xec2998=_[_0xb083('0x3b')]({},_0xec2998,_0x26af4c['options']);return _0x16e1e5[_0xb083('0x4c')](_0xec2998);}})[_0xb083('0x24')](function(_0x24cbbd){if(_0x24cbbd){_0x123160=_0x24cbbd[_0xb083('0x34')];if(!_0x26af4c[_0xb083('0x2e')][_0xb083('0x35')](_0xb083('0x36'))){_0xec2998['limit']=qs[_0xb083('0x1c')](_0x26af4c[_0xb083('0x2e')][_0xb083('0x1c')]);_0xec2998['offset']=qs[_0xb083('0x1a')](_0x26af4c[_0xb083('0x2e')]['offset']);}return _0x16e1e5[_0xb083('0x4c')](_0xec2998);}})[_0xb083('0x24')](function(_0x1ce62f){if(_0x1ce62f){return _0x1ce62f?{'count':_0x123160,'rows':_0x1ce62f}:null;}})['then'](respondWithResult(_0x1732b3,null))[_0xb083('0x43')](handleError(_0x1732b3,null));};exports[_0xb083('0x4d')]=function(_0x11eb1b,_0x52f3d0,_0x59fe55){var _0x17ea80={};var _0x3308a2={};var _0x4dcdfd;var _0x34e2be;return db[_0xb083('0x3e')][_0xb083('0x4a')]({'where':{'id':_0x11eb1b[_0xb083('0x45')]['id']}})[_0xb083('0x24')](handleEntityNotFound(_0x52f3d0,null))[_0xb083('0x24')](function(_0x288d02){if(_0x288d02){_0x4dcdfd=_0x288d02;_0x3308a2['model']=_[_0xb083('0x2f')](db[_0xb083('0x4e')][_0xb083('0x2b')]);_0x3308a2[_0xb083('0x2e')]=_[_0xb083('0x2f')](_0x11eb1b[_0xb083('0x2e')]);_0x3308a2[_0xb083('0x30')]=_['intersection'](_0x3308a2[_0xb083('0x2d')],_0x3308a2[_0xb083('0x2e')]);_0x17ea80[_0xb083('0x32')]=_[_0xb083('0x31')](_0x3308a2[_0xb083('0x2d')],qs[_0xb083('0x33')](_0x11eb1b[_0xb083('0x2e')]['fields']));_0x17ea80['attributes']=_0x17ea80[_0xb083('0x32')][_0xb083('0x34')]?_0x17ea80[_0xb083('0x32')]:_0x3308a2['model'];_0x17ea80[_0xb083('0x4b')]=qs[_0xb083('0x37')](_0x11eb1b[_0xb083('0x2e')][_0xb083('0x37')]);_0x17ea80['where']=qs['filters'](_['pick'](_0x11eb1b[_0xb083('0x2e')],_0x3308a2[_0xb083('0x30')]));if(_0x11eb1b['query'][_0xb083('0x3a')]){_0x17ea80[_0xb083('0x38')]=_[_0xb083('0x3b')](_0x17ea80[_0xb083('0x38')],{'$or':_[_0xb083('0x2a')](_0x17ea80[_0xb083('0x32')],function(_0x56514b){var _0x5285f1={};_0x5285f1[_0x56514b]={'$like':'%'+_0x11eb1b[_0xb083('0x2e')][_0xb083('0x3a')]+'%'};return _0x5285f1;})});}_0x17ea80=_[_0xb083('0x3b')]({},_0x17ea80,_0x11eb1b[_0xb083('0x3d')]);return _0x4dcdfd[_0xb083('0x4d')](_0x17ea80);}})['then'](function(_0x375bbf){if(_0x375bbf){_0x34e2be=_0x375bbf[_0xb083('0x34')];if(!_0x11eb1b[_0xb083('0x2e')][_0xb083('0x35')](_0xb083('0x36'))){_0x17ea80['limit']=qs['limit'](_0x11eb1b[_0xb083('0x2e')][_0xb083('0x1c')]);_0x17ea80[_0xb083('0x1a')]=qs['offset'](_0x11eb1b[_0xb083('0x2e')][_0xb083('0x1a')]);}return _0x4dcdfd[_0xb083('0x4d')](_0x17ea80);}})[_0xb083('0x24')](function(_0x1d72f9){if(_0x1d72f9){return _0x1d72f9?{'count':_0x34e2be,'rows':_0x1d72f9}:null;}})[_0xb083('0x24')](respondWithResult(_0x52f3d0,null))['catch'](handleError(_0x52f3d0,null));}; \ No newline at end of file +var _0x12c7=['filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','getFields','findOne','SugarcrmField','order','getSubjects','nolimit','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick'];(function(_0x105598,_0xe7dd46){var _0x1b8b5a=function(_0x3fb5a2){while(--_0x3fb5a2){_0x105598['push'](_0x105598['shift']());}};_0x1b8b5a(++_0xe7dd46);}(_0x12c7,0x107));var _0x712c=function(_0x16aca7,_0x26e217){_0x16aca7=_0x16aca7-0x0;var _0x32099c=_0x12c7[_0x16aca7];return _0x32099c;};'use strict';var emlformat=require(_0x712c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x712c('0x1'));var rp=require(_0x712c('0x2'));var moment=require(_0x712c('0x3'));var BPromise=require(_0x712c('0x4'));var Mustache=require(_0x712c('0x5'));var util=require('util');var path=require(_0x712c('0x6'));var sox=require(_0x712c('0x7'));var csv=require(_0x712c('0x8'));var ejs=require(_0x712c('0x9'));var fs=require('fs');var fs_extra=require(_0x712c('0xa'));var _=require(_0x712c('0xb'));var squel=require(_0x712c('0xc'));var crypto=require(_0x712c('0xd'));var jsforce=require(_0x712c('0xe'));var deskjs=require(_0x712c('0xf'));var toCsv=require(_0x712c('0x8'));var querystring=require('querystring');var Papa=require(_0x712c('0x10'));var Redis=require(_0x712c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x712c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x712c('0x13'));var logger=require(_0x712c('0x14'))(_0x712c('0x15'));var utils=require(_0x712c('0x16'));var config=require(_0x712c('0x17'));var licenseUtil=require(_0x712c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a2cf8,_0x32077d){_0x32077d=_0x32077d||0xcc;return function(_0x12956f){if(_0x12956f){return _0x4a2cf8[_0x712c('0x19')](_0x32077d);}return _0x4a2cf8[_0x712c('0x1a')](_0x32077d)[_0x712c('0x1b')]();};}function respondWithResult(_0x2d0d8a,_0x4b8849){_0x4b8849=_0x4b8849||0xc8;return function(_0x239278){if(_0x239278){return _0x2d0d8a[_0x712c('0x1a')](_0x4b8849)[_0x712c('0x1c')](_0x239278);}};}function respondWithFilteredResult(_0x4d5845,_0xb6806a){return function(_0x393716){if(_0x393716){var _0x231ebc=typeof _0xb6806a[_0x712c('0x1d')]===_0x712c('0x1e')&&typeof _0xb6806a[_0x712c('0x1f')]===_0x712c('0x1e');var _0x5df1bd=_0x393716['count'];var _0x5a22de=_0x231ebc?0x0:_0xb6806a['offset'];var _0x11e3f9=_0x231ebc?_0x393716[_0x712c('0x20')]:_0xb6806a[_0x712c('0x1d')]+_0xb6806a[_0x712c('0x1f')];var _0x1e274a;if(_0x11e3f9>=_0x5df1bd){_0x11e3f9=_0x5df1bd;_0x1e274a=0xc8;}else{_0x1e274a=0xce;}_0x4d5845[_0x712c('0x1a')](_0x1e274a);return _0x4d5845[_0x712c('0x21')]('Content-Range',_0x5a22de+'-'+_0x11e3f9+'/'+_0x5df1bd)[_0x712c('0x1c')](_0x393716);}return null;};}function patchUpdates(_0x3614f4){return function(_0xf5525f){try{jsonpatch[_0x712c('0x22')](_0xf5525f,_0x3614f4,!![]);}catch(_0x49632c){return BPromise[_0x712c('0x23')](_0x49632c);}return _0xf5525f[_0x712c('0x24')]();};}function saveUpdates(_0x3fdc74,_0x211b0f){return function(_0x33395c){if(_0x33395c){return _0x33395c[_0x712c('0x25')](_0x3fdc74)[_0x712c('0x26')](function(_0x31cacd){return _0x31cacd;});}return null;};}function removeEntity(_0x31404c,_0x211f84){return function(_0x1cfbcd){if(_0x1cfbcd){return _0x1cfbcd[_0x712c('0x27')]()['then'](function(){_0x31404c[_0x712c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x870fb2,_0x501be5){return function(_0x4b759f){if(!_0x4b759f){_0x870fb2[_0x712c('0x19')](0x194);}return _0x4b759f;};}function handleError(_0x458c07,_0x18b59e){_0x18b59e=_0x18b59e||0x1f4;return function(_0x39a55d){logger[_0x712c('0x28')](_0x39a55d[_0x712c('0x29')]);if(_0x39a55d['name']){delete _0x39a55d['name'];}_0x458c07['status'](_0x18b59e)[_0x712c('0x2a')](_0x39a55d);};}exports['index']=function(_0xc2cbdf,_0x4f7bde){var _0x3b0ccd={},_0x51e406={},_0x4387a0={'count':0x0,'rows':[]};var _0x55a196=_[_0x712c('0x2b')](db[_0x712c('0x2c')][_0x712c('0x2d')],function(_0x37c7bf){return{'name':_0x37c7bf[_0x712c('0x2e')],'type':_0x37c7bf[_0x712c('0x2f')][_0x712c('0x30')]};});_0x51e406['model']=_[_0x712c('0x2b')](_0x55a196,'name');_0x51e406[_0x712c('0x31')]=_[_0x712c('0x32')](_0xc2cbdf[_0x712c('0x31')]);_0x51e406['filters']=_[_0x712c('0x33')](_0x51e406[_0x712c('0x34')],_0x51e406[_0x712c('0x31')]);_0x3b0ccd[_0x712c('0x35')]=_[_0x712c('0x33')](_0x51e406[_0x712c('0x34')],qs[_0x712c('0x36')](_0xc2cbdf[_0x712c('0x31')]['fields']));_0x3b0ccd['attributes']=_0x3b0ccd[_0x712c('0x35')][_0x712c('0x37')]?_0x3b0ccd[_0x712c('0x35')]:_0x51e406[_0x712c('0x34')];if(!_0xc2cbdf[_0x712c('0x31')][_0x712c('0x38')]('nolimit')){_0x3b0ccd[_0x712c('0x1f')]=qs[_0x712c('0x1f')](_0xc2cbdf[_0x712c('0x31')][_0x712c('0x1f')]);_0x3b0ccd[_0x712c('0x1d')]=qs[_0x712c('0x1d')](_0xc2cbdf['query'][_0x712c('0x1d')]);}_0x3b0ccd['order']=qs['sort'](_0xc2cbdf[_0x712c('0x31')][_0x712c('0x39')]);_0x3b0ccd[_0x712c('0x3a')]=qs[_0x712c('0x3b')](_[_0x712c('0x3c')](_0xc2cbdf['query'],_0x51e406['filters']),_0x55a196);if(_0xc2cbdf[_0x712c('0x31')][_0x712c('0x3d')]){_0x3b0ccd['where']=_[_0x712c('0x3e')](_0x3b0ccd[_0x712c('0x3a')],{'$or':_[_0x712c('0x2b')](_0x55a196,function(_0xcbe83d){if(_0xcbe83d[_0x712c('0x2f')]!==_0x712c('0x3f')){var _0x40d8a3={};_0x40d8a3[_0xcbe83d['name']]={'$like':'%'+_0xc2cbdf['query'][_0x712c('0x3d')]+'%'};return _0x40d8a3;}})});}_0x3b0ccd=_[_0x712c('0x3e')]({},_0x3b0ccd,_0xc2cbdf[_0x712c('0x40')]);var _0x2e1275={'where':_0x3b0ccd[_0x712c('0x3a')]};return db[_0x712c('0x2c')]['count'](_0x2e1275)[_0x712c('0x26')](function(_0x494afb){_0x4387a0[_0x712c('0x20')]=_0x494afb;if(_0xc2cbdf['query'][_0x712c('0x41')]){_0x3b0ccd[_0x712c('0x42')]=[{'all':!![]}];}return db[_0x712c('0x2c')][_0x712c('0x43')](_0x3b0ccd);})['then'](function(_0x5ec59e){_0x4387a0['rows']=_0x5ec59e;return _0x4387a0;})[_0x712c('0x26')](respondWithFilteredResult(_0x4f7bde,_0x3b0ccd))[_0x712c('0x44')](handleError(_0x4f7bde,null));};exports[_0x712c('0x45')]=function(_0x280f1b,_0x27e90e){var _0x1a4aca={'raw':![],'where':{'id':_0x280f1b[_0x712c('0x46')]['id']}},_0x639317={};_0x639317[_0x712c('0x34')]=_[_0x712c('0x32')](db[_0x712c('0x2c')][_0x712c('0x2d')]);_0x639317[_0x712c('0x31')]=_[_0x712c('0x32')](_0x280f1b[_0x712c('0x31')]);_0x639317[_0x712c('0x3b')]=_[_0x712c('0x33')](_0x639317[_0x712c('0x34')],_0x639317[_0x712c('0x31')]);_0x1a4aca[_0x712c('0x35')]=_[_0x712c('0x33')](_0x639317[_0x712c('0x34')],qs[_0x712c('0x36')](_0x280f1b[_0x712c('0x31')][_0x712c('0x36')]));_0x1a4aca['attributes']=_0x1a4aca[_0x712c('0x35')][_0x712c('0x37')]?_0x1a4aca[_0x712c('0x35')]:_0x639317[_0x712c('0x34')];if(_0x280f1b['query']['includeAll']){_0x1a4aca[_0x712c('0x42')]=[{'all':!![]}];}_0x1a4aca=_[_0x712c('0x3e')]({},_0x1a4aca,_0x280f1b['options']);return db[_0x712c('0x2c')]['find'](_0x1a4aca)[_0x712c('0x26')](handleEntityNotFound(_0x27e90e,null))[_0x712c('0x26')](respondWithResult(_0x27e90e,null))['catch'](handleError(_0x27e90e,null));};exports[_0x712c('0x47')]=function(_0x4d28e5,_0x2e68e4){return db[_0x712c('0x2c')][_0x712c('0x47')](_0x4d28e5[_0x712c('0x48')],{})['then'](respondWithResult(_0x2e68e4,0xc9))[_0x712c('0x44')](handleError(_0x2e68e4,null));};exports[_0x712c('0x25')]=function(_0x15f320,_0x3b31c1){if(_0x15f320['body']['id']){delete _0x15f320[_0x712c('0x48')]['id'];}return db[_0x712c('0x2c')][_0x712c('0x49')]({'where':{'id':_0x15f320[_0x712c('0x46')]['id']}})[_0x712c('0x26')](handleEntityNotFound(_0x3b31c1,null))[_0x712c('0x26')](saveUpdates(_0x15f320['body'],null))[_0x712c('0x26')](respondWithResult(_0x3b31c1,null))['catch'](handleError(_0x3b31c1,null));};exports['destroy']=function(_0x5c5efc,_0xe28722){return db[_0x712c('0x2c')][_0x712c('0x49')]({'where':{'id':_0x5c5efc[_0x712c('0x46')]['id']}})[_0x712c('0x26')](handleEntityNotFound(_0xe28722,null))['then'](removeEntity(_0xe28722,null))[_0x712c('0x44')](handleError(_0xe28722,null));};exports[_0x712c('0x4a')]=function(_0x108f5d,_0x4a5034,_0x293c75){var _0x4b15a4={};var _0x441c9a={};var _0x3fcaad;var _0xa00c40;return db['SugarcrmConfiguration'][_0x712c('0x4b')]({'where':{'id':_0x108f5d[_0x712c('0x46')]['id']}})[_0x712c('0x26')](handleEntityNotFound(_0x4a5034,null))['then'](function(_0x2044c4){if(_0x2044c4){_0x3fcaad=_0x2044c4;_0x441c9a['model']=_[_0x712c('0x32')](db['SugarcrmField']['rawAttributes']);_0x441c9a['query']=_[_0x712c('0x32')](_0x108f5d[_0x712c('0x31')]);_0x441c9a['filters']=_[_0x712c('0x33')](_0x441c9a['model'],_0x441c9a[_0x712c('0x31')]);_0x4b15a4[_0x712c('0x35')]=_[_0x712c('0x33')](_0x441c9a['model'],qs[_0x712c('0x36')](_0x108f5d['query']['fields']));_0x4b15a4[_0x712c('0x35')]=_0x4b15a4[_0x712c('0x35')][_0x712c('0x37')]?_0x4b15a4[_0x712c('0x35')]:_0x441c9a[_0x712c('0x34')];_0x4b15a4['order']=qs[_0x712c('0x39')](_0x108f5d[_0x712c('0x31')][_0x712c('0x39')]);_0x4b15a4[_0x712c('0x3a')]=qs[_0x712c('0x3b')](_[_0x712c('0x3c')](_0x108f5d[_0x712c('0x31')],_0x441c9a[_0x712c('0x3b')]));if(_0x108f5d['query'][_0x712c('0x3d')]){_0x4b15a4['where']=_['merge'](_0x4b15a4['where'],{'$or':_['map'](_0x4b15a4[_0x712c('0x35')],function(_0x4e5221){var _0x34fb5b={};_0x34fb5b[_0x4e5221]={'$like':'%'+_0x108f5d[_0x712c('0x31')][_0x712c('0x3d')]+'%'};return _0x34fb5b;})});}_0x4b15a4=_[_0x712c('0x3e')]({},_0x4b15a4,_0x108f5d[_0x712c('0x40')]);return _0x3fcaad['getFields'](_0x4b15a4);}})[_0x712c('0x26')](function(_0x548cf3){if(_0x548cf3){_0xa00c40=_0x548cf3[_0x712c('0x37')];if(!_0x108f5d['query'][_0x712c('0x38')]('nolimit')){_0x4b15a4[_0x712c('0x1f')]=qs[_0x712c('0x1f')](_0x108f5d[_0x712c('0x31')][_0x712c('0x1f')]);_0x4b15a4['offset']=qs[_0x712c('0x1d')](_0x108f5d['query'][_0x712c('0x1d')]);}return _0x3fcaad[_0x712c('0x4a')](_0x4b15a4);}})[_0x712c('0x26')](function(_0x3e2552){if(_0x3e2552){return _0x3e2552?{'count':_0xa00c40,'rows':_0x3e2552}:null;}})['then'](respondWithResult(_0x4a5034,null))[_0x712c('0x44')](handleError(_0x4a5034,null));};exports['getSubjects']=function(_0x137310,_0x2b6d10,_0x33b165){var _0x42174a={};var _0x1c09c7={};var _0x35ad94;var _0x4e25fd;return db[_0x712c('0x2c')][_0x712c('0x4b')]({'where':{'id':_0x137310[_0x712c('0x46')]['id']}})[_0x712c('0x26')](handleEntityNotFound(_0x2b6d10,null))[_0x712c('0x26')](function(_0x3303cb){if(_0x3303cb){_0x35ad94=_0x3303cb;_0x1c09c7['model']=_['keys'](db[_0x712c('0x4c')][_0x712c('0x2d')]);_0x1c09c7[_0x712c('0x31')]=_['keys'](_0x137310[_0x712c('0x31')]);_0x1c09c7[_0x712c('0x3b')]=_[_0x712c('0x33')](_0x1c09c7['model'],_0x1c09c7['query']);_0x42174a[_0x712c('0x35')]=_[_0x712c('0x33')](_0x1c09c7[_0x712c('0x34')],qs[_0x712c('0x36')](_0x137310[_0x712c('0x31')]['fields']));_0x42174a[_0x712c('0x35')]=_0x42174a[_0x712c('0x35')]['length']?_0x42174a[_0x712c('0x35')]:_0x1c09c7[_0x712c('0x34')];_0x42174a[_0x712c('0x4d')]=qs[_0x712c('0x39')](_0x137310[_0x712c('0x31')][_0x712c('0x39')]);_0x42174a[_0x712c('0x3a')]=qs[_0x712c('0x3b')](_[_0x712c('0x3c')](_0x137310[_0x712c('0x31')],_0x1c09c7[_0x712c('0x3b')]));if(_0x137310[_0x712c('0x31')]['filter']){_0x42174a[_0x712c('0x3a')]=_[_0x712c('0x3e')](_0x42174a['where'],{'$or':_[_0x712c('0x2b')](_0x42174a[_0x712c('0x35')],function(_0x1a7cf4){var _0x42387d={};_0x42387d[_0x1a7cf4]={'$like':'%'+_0x137310['query'][_0x712c('0x3d')]+'%'};return _0x42387d;})});}_0x42174a=_[_0x712c('0x3e')]({},_0x42174a,_0x137310[_0x712c('0x40')]);return _0x35ad94[_0x712c('0x4e')](_0x42174a);}})[_0x712c('0x26')](function(_0x1ce018){if(_0x1ce018){_0x4e25fd=_0x1ce018[_0x712c('0x37')];if(!_0x137310[_0x712c('0x31')]['hasOwnProperty'](_0x712c('0x4f'))){_0x42174a[_0x712c('0x1f')]=qs['limit'](_0x137310['query'][_0x712c('0x1f')]);_0x42174a[_0x712c('0x1d')]=qs[_0x712c('0x1d')](_0x137310[_0x712c('0x31')]['offset']);}return _0x35ad94[_0x712c('0x4e')](_0x42174a);}})['then'](function(_0x574660){if(_0x574660){return _0x574660?{'count':_0x4e25fd,'rows':_0x574660}:null;}})[_0x712c('0x26')](respondWithResult(_0x2b6d10,null))[_0x712c('0x44')](handleError(_0x2b6d10,null));};exports[_0x712c('0x50')]=function(_0x88fd9,_0x11b928,_0x4b3880){var _0x276ade={};var _0x46f6e5={};var _0x11f94c;var _0x5def84;return db['SugarcrmConfiguration'][_0x712c('0x4b')]({'where':{'id':_0x88fd9[_0x712c('0x46')]['id']}})[_0x712c('0x26')](handleEntityNotFound(_0x11b928,null))[_0x712c('0x26')](function(_0x1e7042){if(_0x1e7042){_0x11f94c=_0x1e7042;_0x46f6e5[_0x712c('0x34')]=_[_0x712c('0x32')](db[_0x712c('0x4c')][_0x712c('0x2d')]);_0x46f6e5['query']=_[_0x712c('0x32')](_0x88fd9[_0x712c('0x31')]);_0x46f6e5['filters']=_['intersection'](_0x46f6e5['model'],_0x46f6e5[_0x712c('0x31')]);_0x276ade[_0x712c('0x35')]=_[_0x712c('0x33')](_0x46f6e5['model'],qs[_0x712c('0x36')](_0x88fd9[_0x712c('0x31')][_0x712c('0x36')]));_0x276ade[_0x712c('0x35')]=_0x276ade['attributes'][_0x712c('0x37')]?_0x276ade[_0x712c('0x35')]:_0x46f6e5['model'];_0x276ade[_0x712c('0x4d')]=qs['sort'](_0x88fd9[_0x712c('0x31')][_0x712c('0x39')]);_0x276ade[_0x712c('0x3a')]=qs['filters'](_[_0x712c('0x3c')](_0x88fd9[_0x712c('0x31')],_0x46f6e5['filters']));if(_0x88fd9[_0x712c('0x31')][_0x712c('0x3d')]){_0x276ade[_0x712c('0x3a')]=_[_0x712c('0x3e')](_0x276ade['where'],{'$or':_[_0x712c('0x2b')](_0x276ade[_0x712c('0x35')],function(_0x3d0074){var _0x23876c={};_0x23876c[_0x3d0074]={'$like':'%'+_0x88fd9[_0x712c('0x31')][_0x712c('0x3d')]+'%'};return _0x23876c;})});}_0x276ade=_[_0x712c('0x3e')]({},_0x276ade,_0x88fd9[_0x712c('0x40')]);return _0x11f94c['getDescriptions'](_0x276ade);}})[_0x712c('0x26')](function(_0x337b19){if(_0x337b19){_0x5def84=_0x337b19[_0x712c('0x37')];if(!_0x88fd9[_0x712c('0x31')][_0x712c('0x38')](_0x712c('0x4f'))){_0x276ade['limit']=qs['limit'](_0x88fd9[_0x712c('0x31')]['limit']);_0x276ade[_0x712c('0x1d')]=qs[_0x712c('0x1d')](_0x88fd9[_0x712c('0x31')][_0x712c('0x1d')]);}return _0x11f94c['getDescriptions'](_0x276ade);}})[_0x712c('0x26')](function(_0x14bbf4){if(_0x14bbf4){return _0x14bbf4?{'count':_0x5def84,'rows':_0x14bbf4}:null;}})['then'](respondWithResult(_0x11b928,null))[_0x712c('0x44')](handleError(_0x11b928,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index edd792d..3fcd714 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 _0x82a7=['define','SugarcrmConfiguration','int_sugarcrm_configurations','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports'];(function(_0x3e82c7,_0x27e47d){var _0x1e4b3e=function(_0x14ca63){while(--_0x14ca63){_0x3e82c7['push'](_0x3e82c7['shift']());}};_0x1e4b3e(++_0x27e47d);}(_0x82a7,0xb7));var _0x782a=function(_0x4ea4bd,_0x545c44){_0x4ea4bd=_0x4ea4bd-0x0;var _0x59a876=_0x82a7[_0x4ea4bd];return _0x59a876;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x782a('0x0'))(_0x782a('0x1'));var moment=require(_0x782a('0x2'));var BPromise=require('bluebird');var rp=require(_0x782a('0x3'));var fs=require('fs');var path=require(_0x782a('0x4'));var rimraf=require(_0x782a('0x5'));var config=require(_0x782a('0x6'));var attributes=require(_0x782a('0x7'));module[_0x782a('0x8')]=function(_0x10bdbf,_0x29d534){return _0x10bdbf[_0x782a('0x9')](_0x782a('0xa'),attributes,{'tableName':_0x782a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee4d=['exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xee4d,0x124));var _0xdee4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xee4d[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xdee4('0x0'));var util=require(_0xdee4('0x1'));var logger=require(_0xdee4('0x2'))(_0xdee4('0x3'));var moment=require(_0xdee4('0x4'));var BPromise=require(_0xdee4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdee4('0x6'));var config=require(_0xdee4('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xdee4('0x8')]=function(_0x5a5d23,_0x4aa018){return _0x5a5d23[_0xdee4('0x9')](_0xdee4('0xa'),attributes,{'tableName':_0xdee4('0xb'),'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 53303a1..d22b76f 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 _0x684d=['../../config/utils','rpc','../../config/environment','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis'];(function(_0x210737,_0x3689da){var _0x126ae9=function(_0x428de3){while(--_0x428de3){_0x210737['push'](_0x210737['shift']());}};_0x126ae9(++_0x3689da);}(_0x684d,0x101));var _0xd684=function(_0x2d0901,_0x2627ee){_0x2d0901=_0x2d0901-0x0;var _0x3455c=_0x684d[_0x2d0901];return _0x3455c;};'use strict';var _=require(_0xd684('0x0'));var util=require('util');var moment=require(_0xd684('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd684('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd684('0x3'));var logger=require('../../config/logger')(_0xd684('0x4'));var config=require(_0xd684('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd684('0x6')][_0xd684('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x453564,_0x19c336,_0x4c7b89){return new BPromise(function(_0xd88571,_0x3e73fa){return client['request'](_0x453564,_0x4c7b89)[_0xd684('0x8')](function(_0x333973){logger[_0xd684('0x9')](_0xd684('0xa'),_0x19c336,_0xd684('0xb'));logger[_0xd684('0xc')](_0xd684('0xd'),_0x19c336,_0xd684('0xb'),JSON[_0xd684('0xe')](_0x333973));if(_0x333973[_0xd684('0xf')]){if(_0x333973[_0xd684('0xf')][_0xd684('0x10')]===0x1f4){logger[_0xd684('0xf')](_0xd684('0xa'),_0x19c336,_0x333973[_0xd684('0xf')]['message']);return _0x3e73fa(_0x333973[_0xd684('0xf')][_0xd684('0x11')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x19c336,_0x333973[_0xd684('0xf')][_0xd684('0x11')]);return _0xd88571(_0x333973[_0xd684('0xf')][_0xd684('0x11')]);}else{logger[_0xd684('0x9')](_0xd684('0xa'),_0x19c336,_0xd684('0xb'));_0xd88571(_0x333973[_0xd684('0x12')][_0xd684('0x11')]);}})[_0xd684('0x13')](function(_0x596769){logger[_0xd684('0xf')](_0xd684('0xa'),_0x19c336,_0x596769);_0x3e73fa(_0x596769);});});} \ No newline at end of file +var _0xfd99=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','code','error','message','SugarcrmConfiguration,\x20%s,\x20%s','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4bf865,_0x2c68eb){var _0x3c96f7=function(_0x3bb091){while(--_0x3bb091){_0x4bf865['push'](_0x4bf865['shift']());}};_0x3c96f7(++_0x2c68eb);}(_0xfd99,0x1c9));var _0x9fd9=function(_0x38a9e6,_0x1b2f5d){_0x38a9e6=_0x38a9e6-0x0;var _0x2bf78b=_0xfd99[_0x38a9e6];return _0x2bf78b;};'use strict';var _=require('lodash');var util=require(_0x9fd9('0x0'));var moment=require(_0x9fd9('0x1'));var BPromise=require('bluebird');var rs=require(_0x9fd9('0x2'));var fs=require('fs');var Redis=require(_0x9fd9('0x3'));var db=require(_0x9fd9('0x4'))['db'];var utils=require(_0x9fd9('0x5'));var logger=require('../../config/logger')(_0x9fd9('0x6'));var config=require(_0x9fd9('0x7'));var jayson=require(_0x9fd9('0x8'));var client=jayson[_0x9fd9('0x9')][_0x9fd9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39fabd,_0x5b0a95,_0xb50453){return new BPromise(function(_0x10b572,_0x699838){return client['request'](_0x39fabd,_0xb50453)[_0x9fd9('0xb')](function(_0x184631){logger[_0x9fd9('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5b0a95,_0x9fd9('0xd'));logger[_0x9fd9('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x5b0a95,_0x9fd9('0xd'),JSON[_0x9fd9('0xf')](_0x184631));if(_0x184631['error']){if(_0x184631['error'][_0x9fd9('0x10')]===0x1f4){logger[_0x9fd9('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5b0a95,_0x184631[_0x9fd9('0x11')][_0x9fd9('0x12')]);return _0x699838(_0x184631[_0x9fd9('0x11')]['message']);}logger[_0x9fd9('0x11')](_0x9fd9('0x13'),_0x5b0a95,_0x184631['error'][_0x9fd9('0x12')]);return _0x10b572(_0x184631[_0x9fd9('0x11')][_0x9fd9('0x12')]);}else{logger[_0x9fd9('0xc')](_0x9fd9('0x13'),_0x5b0a95,'request\x20sent');_0x10b572(_0x184631['result'][_0x9fd9('0x12')]);}})[_0x9fd9('0x14')](function(_0x13f819){logger[_0x9fd9('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5b0a95,_0x13f819);_0x699838(_0x13f819);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 15e5845..a45181d 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 _0x5f57=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','post','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2b068a,_0x4fd066){var _0x4dc1c8=function(_0x3fc556){while(--_0x3fc556){_0x2b068a['push'](_0x2b068a['shift']());}};_0x4dc1c8(++_0x4fd066);}(_0x5f57,0x19d));var _0x75f5=function(_0x565452,_0x17573c){_0x565452=_0x565452-0x0;var _0x162a47=_0x5f57[_0x565452];return _0x162a47;};'use strict';var multer=require(_0x75f5('0x0'));var util=require(_0x75f5('0x1'));var path=require(_0x75f5('0x2'));var timeout=require(_0x75f5('0x3'));var express=require(_0x75f5('0x4'));var router=express[_0x75f5('0x5')]();var fs_extra=require(_0x75f5('0x6'));var auth=require(_0x75f5('0x7'));var interaction=require(_0x75f5('0x8'));var config=require(_0x75f5('0x9'));var controller=require(_0x75f5('0xa'));router[_0x75f5('0xb')]('/',auth[_0x75f5('0xc')](),controller[_0x75f5('0xd')]);router[_0x75f5('0xb')]('/:id',auth[_0x75f5('0xc')](),controller['show']);router[_0x75f5('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x75f5('0xf')](_0x75f5('0x10'),auth[_0x75f5('0xc')](),controller['update']);router[_0x75f5('0x11')]('/:id',auth[_0x75f5('0xc')](),controller[_0x75f5('0x12')]);module[_0x75f5('0x13')]=router; \ No newline at end of file +var _0x4ede=['/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','get'];(function(_0x2d9a23,_0x481dc4){var _0x5198ee=function(_0x27d373){while(--_0x27d373){_0x2d9a23['push'](_0x2d9a23['shift']());}};_0x5198ee(++_0x481dc4);}(_0x4ede,0x190));var _0xe4ed=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4ede[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xe4ed('0x0'));var util=require('util');var path=require(_0xe4ed('0x1'));var timeout=require(_0xe4ed('0x2'));var express=require(_0xe4ed('0x3'));var router=express['Router']();var fs_extra=require(_0xe4ed('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe4ed('0x5'));var config=require('../../config/environment');var controller=require(_0xe4ed('0x6'));router[_0xe4ed('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe4ed('0x7')](_0xe4ed('0x8'),auth[_0xe4ed('0x9')](),controller[_0xe4ed('0xa')]);router[_0xe4ed('0xb')]('/',auth[_0xe4ed('0x9')](),controller[_0xe4ed('0xc')]);router[_0xe4ed('0xd')](_0xe4ed('0x8'),auth['isAuthenticated'](),controller[_0xe4ed('0xe')]);router['delete']('/:id',auth[_0xe4ed('0x9')](),controller[_0xe4ed('0xf')]);module[_0xe4ed('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ef5db62..1036831 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 _0xad2e=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','string'];(function(_0x513332,_0x27ab3b){var _0x4678d4=function(_0x367a68){while(--_0x367a68){_0x513332['push'](_0x513332['shift']());}};_0x4678d4(++_0x27ab3b);}(_0xad2e,0x185));var _0xead2=function(_0x3b6567,_0x4e6350){_0x3b6567=_0x3b6567-0x0;var _0x3b2702=_0xad2e[_0x3b6567];return _0x3b2702;};'use strict';var Sequelize=require(_0xead2('0x0'));module[_0xead2('0x1')]={'type':{'type':Sequelize[_0xead2('0x2')]('string',_0xead2('0x3'),'customVariable',_0xead2('0x4'),_0xead2('0x5')),'defaultValue':_0xead2('0x6')},'content':{'type':Sequelize[_0xead2('0x7')]},'key':{'type':Sequelize[_0xead2('0x7')]},'keyType':{'type':Sequelize[_0xead2('0x2')](_0xead2('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xead2('0x7')]},'nameField':{'type':Sequelize[_0xead2('0x7')]},'customField':{'type':Sequelize[_0xead2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xce8f=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x440947,_0x889078){var _0x45a372=function(_0x45fd7c){while(--_0x45fd7c){_0x440947['push'](_0x440947['shift']());}};_0x45a372(++_0x889078);}(_0xce8f,0xf8));var _0xfce8=function(_0x53e35e,_0x114a69){_0x53e35e=_0x53e35e-0x0;var _0xaaaa6a=_0xce8f[_0x53e35e];return _0xaaaa6a;};'use strict';var Sequelize=require(_0xfce8('0x0'));module[_0xfce8('0x1')]={'type':{'type':Sequelize[_0xfce8('0x2')](_0xfce8('0x3'),_0xfce8('0x4'),_0xfce8('0x5'),_0xfce8('0x6'),_0xfce8('0x7')),'defaultValue':_0xfce8('0x3')},'content':{'type':Sequelize[_0xfce8('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfce8('0x2')]('string','variable',_0xfce8('0x5'))},'keyContent':{'type':Sequelize[_0xfce8('0x8')]},'idField':{'type':Sequelize[_0xfce8('0x8')]},'nameField':{'type':Sequelize[_0xfce8('0x8')]},'customField':{'type':Sequelize[_0xfce8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfce8('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c3b1cce..012f692 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 _0x2b06=['filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','include','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmField','type','key','model','query','keys'];(function(_0x8bf0f,_0x1fe750){var _0xb9a34e=function(_0x6baa2e){while(--_0x6baa2e){_0x8bf0f['push'](_0x8bf0f['shift']());}};_0xb9a34e(++_0x1fe750);}(_0x2b06,0x146));var _0x62b0=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0x2b06[_0x36f47c];return _0x296c55;};'use strict';var emlformat=require(_0x62b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x62b0('0x1'));var jsonpatch=require(_0x62b0('0x2'));var rp=require(_0x62b0('0x3'));var moment=require(_0x62b0('0x4'));var BPromise=require(_0x62b0('0x5'));var Mustache=require(_0x62b0('0x6'));var util=require(_0x62b0('0x7'));var path=require(_0x62b0('0x8'));var sox=require(_0x62b0('0x9'));var csv=require(_0x62b0('0xa'));var ejs=require(_0x62b0('0xb'));var fs=require('fs');var fs_extra=require(_0x62b0('0xc'));var _=require(_0x62b0('0xd'));var squel=require(_0x62b0('0xe'));var crypto=require(_0x62b0('0xf'));var jsforce=require(_0x62b0('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x62b0('0xa'));var querystring=require(_0x62b0('0x11'));var Papa=require(_0x62b0('0x12'));var Redis=require(_0x62b0('0x13'));var authService=require(_0x62b0('0x14'));var qs=require(_0x62b0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x62b0('0x16'))(_0x62b0('0x17'));var utils=require(_0x62b0('0x18'));var config=require(_0x62b0('0x19'));var licenseUtil=require(_0x62b0('0x1a'));var db=require(_0x62b0('0x1b'))['db'];function respondWithStatusCode(_0x23e270,_0x4f43e1){_0x4f43e1=_0x4f43e1||0xcc;return function(_0x2f7e03){if(_0x2f7e03){return _0x23e270['sendStatus'](_0x4f43e1);}return _0x23e270['status'](_0x4f43e1)[_0x62b0('0x1c')]();};}function respondWithResult(_0x19c517,_0x5d65d0){_0x5d65d0=_0x5d65d0||0xc8;return function(_0x33b36e){if(_0x33b36e){return _0x19c517[_0x62b0('0x1d')](_0x5d65d0)['json'](_0x33b36e);}};}function respondWithFilteredResult(_0x567159,_0x3ffb6a){return function(_0x160357){if(_0x160357){var _0x3668e5=typeof _0x3ffb6a['offset']===_0x62b0('0x1e')&&typeof _0x3ffb6a[_0x62b0('0x1f')]===_0x62b0('0x1e');var _0x54c810=_0x160357[_0x62b0('0x20')];var _0x594d9e=_0x3668e5?0x0:_0x3ffb6a['offset'];var _0x3d34ff=_0x3668e5?_0x160357[_0x62b0('0x20')]:_0x3ffb6a[_0x62b0('0x21')]+_0x3ffb6a[_0x62b0('0x1f')];var _0x3c46ad;if(_0x3d34ff>=_0x54c810){_0x3d34ff=_0x54c810;_0x3c46ad=0xc8;}else{_0x3c46ad=0xce;}_0x567159[_0x62b0('0x1d')](_0x3c46ad);return _0x567159[_0x62b0('0x22')](_0x62b0('0x23'),_0x594d9e+'-'+_0x3d34ff+'/'+_0x54c810)['json'](_0x160357);}return null;};}function patchUpdates(_0x5d0fe3){return function(_0x53dcc6){try{jsonpatch[_0x62b0('0x24')](_0x53dcc6,_0x5d0fe3,!![]);}catch(_0xe1ff31){return BPromise['reject'](_0xe1ff31);}return _0x53dcc6[_0x62b0('0x25')]();};}function saveUpdates(_0x4cc4eb,_0x268923){return function(_0xff89ca){if(_0xff89ca){return _0xff89ca[_0x62b0('0x26')](_0x4cc4eb)[_0x62b0('0x27')](function(_0x4ef2f2){return _0x4ef2f2;});}return null;};}function removeEntity(_0x37eedd,_0x30ea46){return function(_0x194afe){if(_0x194afe){return _0x194afe[_0x62b0('0x28')]()[_0x62b0('0x27')](function(){_0x37eedd[_0x62b0('0x1d')](0xcc)[_0x62b0('0x1c')]();});}};}function handleEntityNotFound(_0x35f81a,_0x421fe5){return function(_0x165632){if(!_0x165632){_0x35f81a[_0x62b0('0x29')](0x194);}return _0x165632;};}function handleError(_0x645d4a,_0x4cd78d){_0x4cd78d=_0x4cd78d||0x1f4;return function(_0x4021f4){logger[_0x62b0('0x2a')](_0x4021f4[_0x62b0('0x2b')]);if(_0x4021f4[_0x62b0('0x2c')]){delete _0x4021f4[_0x62b0('0x2c')];}_0x645d4a[_0x62b0('0x1d')](_0x4cd78d)[_0x62b0('0x2d')](_0x4021f4);};}exports[_0x62b0('0x2e')]=function(_0x53db62,_0x4d1981){var _0x2e5179={},_0x578aa1={},_0x365a25={'count':0x0,'rows':[]};var _0x2c40a9=_[_0x62b0('0x2f')](db[_0x62b0('0x30')]['rawAttributes'],function(_0x3eb71d){return{'name':_0x3eb71d['fieldName'],'type':_0x3eb71d[_0x62b0('0x31')][_0x62b0('0x32')]};});_0x578aa1[_0x62b0('0x33')]=_[_0x62b0('0x2f')](_0x2c40a9,_0x62b0('0x2c'));_0x578aa1[_0x62b0('0x34')]=_[_0x62b0('0x35')](_0x53db62['query']);_0x578aa1[_0x62b0('0x36')]=_[_0x62b0('0x37')](_0x578aa1[_0x62b0('0x33')],_0x578aa1[_0x62b0('0x34')]);_0x2e5179['attributes']=_[_0x62b0('0x37')](_0x578aa1[_0x62b0('0x33')],qs['fields'](_0x53db62[_0x62b0('0x34')][_0x62b0('0x38')]));_0x2e5179[_0x62b0('0x39')]=_0x2e5179[_0x62b0('0x39')][_0x62b0('0x3a')]?_0x2e5179[_0x62b0('0x39')]:_0x578aa1[_0x62b0('0x33')];if(!_0x53db62[_0x62b0('0x34')]['hasOwnProperty'](_0x62b0('0x3b'))){_0x2e5179[_0x62b0('0x1f')]=qs[_0x62b0('0x1f')](_0x53db62[_0x62b0('0x34')][_0x62b0('0x1f')]);_0x2e5179[_0x62b0('0x21')]=qs[_0x62b0('0x21')](_0x53db62[_0x62b0('0x34')]['offset']);}_0x2e5179[_0x62b0('0x3c')]=qs[_0x62b0('0x3d')](_0x53db62[_0x62b0('0x34')][_0x62b0('0x3d')]);_0x2e5179[_0x62b0('0x3e')]=qs[_0x62b0('0x36')](_['pick'](_0x53db62[_0x62b0('0x34')],_0x578aa1[_0x62b0('0x36')]),_0x2c40a9);if(_0x53db62[_0x62b0('0x34')][_0x62b0('0x3f')]){_0x2e5179[_0x62b0('0x3e')]=_[_0x62b0('0x40')](_0x2e5179[_0x62b0('0x3e')],{'$or':_[_0x62b0('0x2f')](_0x2c40a9,function(_0x1ca8b6){if(_0x1ca8b6[_0x62b0('0x31')]!=='VIRTUAL'){var _0x54e06e={};_0x54e06e[_0x1ca8b6[_0x62b0('0x2c')]]={'$like':'%'+_0x53db62[_0x62b0('0x34')]['filter']+'%'};return _0x54e06e;}})});}_0x2e5179=_[_0x62b0('0x40')]({},_0x2e5179,_0x53db62[_0x62b0('0x41')]);var _0x2857d8={'where':_0x2e5179[_0x62b0('0x3e')]};return db[_0x62b0('0x30')]['count'](_0x2857d8)[_0x62b0('0x27')](function(_0x55a5c0){_0x365a25[_0x62b0('0x20')]=_0x55a5c0;if(_0x53db62['query'][_0x62b0('0x42')]){_0x2e5179['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x62b0('0x43')](_0x2e5179);})[_0x62b0('0x27')](function(_0x4c8507){_0x365a25['rows']=_0x4c8507;return _0x365a25;})[_0x62b0('0x27')](respondWithFilteredResult(_0x4d1981,_0x2e5179))[_0x62b0('0x44')](handleError(_0x4d1981,null));};exports[_0x62b0('0x45')]=function(_0x48fb70,_0x3cb3e9){var _0x13501c={'raw':!![],'where':{'id':_0x48fb70[_0x62b0('0x46')]['id']}},_0x54f581={};_0x54f581[_0x62b0('0x33')]=_[_0x62b0('0x35')](db['SugarcrmField'][_0x62b0('0x47')]);_0x54f581[_0x62b0('0x34')]=_[_0x62b0('0x35')](_0x48fb70['query']);_0x54f581[_0x62b0('0x36')]=_[_0x62b0('0x37')](_0x54f581[_0x62b0('0x33')],_0x54f581[_0x62b0('0x34')]);_0x13501c[_0x62b0('0x39')]=_[_0x62b0('0x37')](_0x54f581['model'],qs[_0x62b0('0x38')](_0x48fb70[_0x62b0('0x34')][_0x62b0('0x38')]));_0x13501c[_0x62b0('0x39')]=_0x13501c[_0x62b0('0x39')][_0x62b0('0x3a')]?_0x13501c['attributes']:_0x54f581[_0x62b0('0x33')];if(_0x48fb70[_0x62b0('0x34')][_0x62b0('0x42')]){_0x13501c[_0x62b0('0x48')]=[{'all':!![]}];}_0x13501c=_[_0x62b0('0x40')]({},_0x13501c,_0x48fb70[_0x62b0('0x41')]);return db['SugarcrmField']['find'](_0x13501c)[_0x62b0('0x27')](handleEntityNotFound(_0x3cb3e9,null))['then'](respondWithResult(_0x3cb3e9,null))['catch'](handleError(_0x3cb3e9,null));};exports[_0x62b0('0x49')]=function(_0x37c482,_0x3e78f2){return db[_0x62b0('0x30')][_0x62b0('0x49')](_0x37c482[_0x62b0('0x4a')],{})[_0x62b0('0x27')](respondWithResult(_0x3e78f2,0xc9))[_0x62b0('0x44')](handleError(_0x3e78f2,null));};exports[_0x62b0('0x26')]=function(_0x1ab3d7,_0x5596d2){if(_0x1ab3d7[_0x62b0('0x4a')]['id']){delete _0x1ab3d7[_0x62b0('0x4a')]['id'];}return db[_0x62b0('0x30')][_0x62b0('0x4b')]({'where':{'id':_0x1ab3d7[_0x62b0('0x46')]['id']}})[_0x62b0('0x27')](handleEntityNotFound(_0x5596d2,null))[_0x62b0('0x27')](saveUpdates(_0x1ab3d7[_0x62b0('0x4a')],null))['then'](respondWithResult(_0x5596d2,null))[_0x62b0('0x44')](handleError(_0x5596d2,null));};exports['destroy']=function(_0x33514e,_0x590c84){return db['SugarcrmField'][_0x62b0('0x4b')]({'where':{'id':_0x33514e[_0x62b0('0x46')]['id']}})[_0x62b0('0x27')](handleEntityNotFound(_0x590c84,null))[_0x62b0('0x27')](removeEntity(_0x590c84,null))[_0x62b0('0x44')](handleError(_0x590c84,null));}; \ No newline at end of file +var _0x020d=['Content-Range','apply','reject','save','destroy','then','error','name','send','index','SugarcrmField','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','length','options','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x32e9d3,_0x49bcd3){var _0x562fea=function(_0x1c74fa){while(--_0x1c74fa){_0x32e9d3['push'](_0x32e9d3['shift']());}};_0x562fea(++_0x49bcd3);}(_0x020d,0xb6));var _0xd020=function(_0x344468,_0x6a66da){_0x344468=_0x344468-0x0;var _0x1ca8ba=_0x020d[_0x344468];return _0x1ca8ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd020('0x0'));var zipdir=require(_0xd020('0x1'));var jsonpatch=require(_0xd020('0x2'));var rp=require(_0xd020('0x3'));var moment=require(_0xd020('0x4'));var BPromise=require(_0xd020('0x5'));var Mustache=require(_0xd020('0x6'));var util=require(_0xd020('0x7'));var path=require(_0xd020('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd020('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd020('0xa'));var squel=require(_0xd020('0xb'));var crypto=require('crypto');var jsforce=require(_0xd020('0xc'));var deskjs=require(_0xd020('0xd'));var toCsv=require(_0xd020('0xe'));var querystring=require(_0xd020('0xf'));var Papa=require(_0xd020('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd020('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd020('0x12'));var utils=require(_0xd020('0x13'));var config=require(_0xd020('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd020('0x15'))['db'];function respondWithStatusCode(_0x48f477,_0xc195b9){_0xc195b9=_0xc195b9||0xcc;return function(_0x3433b0){if(_0x3433b0){return _0x48f477[_0xd020('0x16')](_0xc195b9);}return _0x48f477[_0xd020('0x17')](_0xc195b9)[_0xd020('0x18')]();};}function respondWithResult(_0x40c6d7,_0x2a8afa){_0x2a8afa=_0x2a8afa||0xc8;return function(_0xb5d97d){if(_0xb5d97d){return _0x40c6d7['status'](_0x2a8afa)[_0xd020('0x19')](_0xb5d97d);}};}function respondWithFilteredResult(_0x32e7df,_0x4b953b){return function(_0x36f925){if(_0x36f925){var _0x55848b=typeof _0x4b953b['offset']===_0xd020('0x1a')&&typeof _0x4b953b[_0xd020('0x1b')]===_0xd020('0x1a');var _0x551235=_0x36f925[_0xd020('0x1c')];var _0x58a8f5=_0x55848b?0x0:_0x4b953b[_0xd020('0x1d')];var _0x50ba7d=_0x55848b?_0x36f925[_0xd020('0x1c')]:_0x4b953b[_0xd020('0x1d')]+_0x4b953b['limit'];var _0x19000e;if(_0x50ba7d>=_0x551235){_0x50ba7d=_0x551235;_0x19000e=0xc8;}else{_0x19000e=0xce;}_0x32e7df[_0xd020('0x17')](_0x19000e);return _0x32e7df[_0xd020('0x1e')](_0xd020('0x1f'),_0x58a8f5+'-'+_0x50ba7d+'/'+_0x551235)[_0xd020('0x19')](_0x36f925);}return null;};}function patchUpdates(_0x59f8aa){return function(_0x4f084c){try{jsonpatch[_0xd020('0x20')](_0x4f084c,_0x59f8aa,!![]);}catch(_0x20a38b){return BPromise[_0xd020('0x21')](_0x20a38b);}return _0x4f084c[_0xd020('0x22')]();};}function saveUpdates(_0x46de25,_0x51abb5){return function(_0x1eea52){if(_0x1eea52){return _0x1eea52['update'](_0x46de25)['then'](function(_0x27f092){return _0x27f092;});}return null;};}function removeEntity(_0x4ad4ba,_0x4b9337){return function(_0x1e74fa){if(_0x1e74fa){return _0x1e74fa[_0xd020('0x23')]()[_0xd020('0x24')](function(){_0x4ad4ba['status'](0xcc)[_0xd020('0x18')]();});}};}function handleEntityNotFound(_0x4dba3a,_0x9600e6){return function(_0x9fe7cf){if(!_0x9fe7cf){_0x4dba3a[_0xd020('0x16')](0x194);}return _0x9fe7cf;};}function handleError(_0x5e820b,_0xa10a6){_0xa10a6=_0xa10a6||0x1f4;return function(_0x3f9862){logger[_0xd020('0x25')](_0x3f9862['stack']);if(_0x3f9862['name']){delete _0x3f9862[_0xd020('0x26')];}_0x5e820b['status'](_0xa10a6)[_0xd020('0x27')](_0x3f9862);};}exports[_0xd020('0x28')]=function(_0x253118,_0x4ff1ba){var _0xd91dc9={},_0x3d5744={},_0x2c24bc={'count':0x0,'rows':[]};var _0x2b9bb4=_['map'](db[_0xd020('0x29')][_0xd020('0x2a')],function(_0x404673){return{'name':_0x404673[_0xd020('0x2b')],'type':_0x404673['type'][_0xd020('0x2c')]};});_0x3d5744[_0xd020('0x2d')]=_[_0xd020('0x2e')](_0x2b9bb4,_0xd020('0x26'));_0x3d5744['query']=_[_0xd020('0x2f')](_0x253118[_0xd020('0x30')]);_0x3d5744[_0xd020('0x31')]=_[_0xd020('0x32')](_0x3d5744[_0xd020('0x2d')],_0x3d5744[_0xd020('0x30')]);_0xd91dc9[_0xd020('0x33')]=_[_0xd020('0x32')](_0x3d5744['model'],qs['fields'](_0x253118['query'][_0xd020('0x34')]));_0xd91dc9['attributes']=_0xd91dc9[_0xd020('0x33')]['length']?_0xd91dc9[_0xd020('0x33')]:_0x3d5744[_0xd020('0x2d')];if(!_0x253118[_0xd020('0x30')]['hasOwnProperty']('nolimit')){_0xd91dc9[_0xd020('0x1b')]=qs[_0xd020('0x1b')](_0x253118[_0xd020('0x30')][_0xd020('0x1b')]);_0xd91dc9['offset']=qs[_0xd020('0x1d')](_0x253118[_0xd020('0x30')][_0xd020('0x1d')]);}_0xd91dc9[_0xd020('0x35')]=qs[_0xd020('0x36')](_0x253118[_0xd020('0x30')][_0xd020('0x36')]);_0xd91dc9[_0xd020('0x37')]=qs[_0xd020('0x31')](_[_0xd020('0x38')](_0x253118['query'],_0x3d5744['filters']),_0x2b9bb4);if(_0x253118[_0xd020('0x30')][_0xd020('0x39')]){_0xd91dc9[_0xd020('0x37')]=_['merge'](_0xd91dc9[_0xd020('0x37')],{'$or':_[_0xd020('0x2e')](_0x2b9bb4,function(_0x1d63a1){if(_0x1d63a1['type']!==_0xd020('0x3a')){var _0x4d7746={};_0x4d7746[_0x1d63a1['name']]={'$like':'%'+_0x253118[_0xd020('0x30')]['filter']+'%'};return _0x4d7746;}})});}_0xd91dc9=_[_0xd020('0x3b')]({},_0xd91dc9,_0x253118['options']);var _0x59cbb4={'where':_0xd91dc9[_0xd020('0x37')]};return db[_0xd020('0x29')][_0xd020('0x1c')](_0x59cbb4)['then'](function(_0x151d16){_0x2c24bc[_0xd020('0x1c')]=_0x151d16;if(_0x253118[_0xd020('0x30')][_0xd020('0x3c')]){_0xd91dc9[_0xd020('0x3d')]=[{'all':!![]}];}return db['SugarcrmField'][_0xd020('0x3e')](_0xd91dc9);})[_0xd020('0x24')](function(_0x26396e){_0x2c24bc['rows']=_0x26396e;return _0x2c24bc;})[_0xd020('0x24')](respondWithFilteredResult(_0x4ff1ba,_0xd91dc9))[_0xd020('0x3f')](handleError(_0x4ff1ba,null));};exports[_0xd020('0x40')]=function(_0x5d59d3,_0x1108a7){var _0x32ad06={'raw':!![],'where':{'id':_0x5d59d3[_0xd020('0x41')]['id']}},_0xb5f983={};_0xb5f983[_0xd020('0x2d')]=_[_0xd020('0x2f')](db[_0xd020('0x29')]['rawAttributes']);_0xb5f983[_0xd020('0x30')]=_['keys'](_0x5d59d3[_0xd020('0x30')]);_0xb5f983[_0xd020('0x31')]=_['intersection'](_0xb5f983[_0xd020('0x2d')],_0xb5f983[_0xd020('0x30')]);_0x32ad06[_0xd020('0x33')]=_[_0xd020('0x32')](_0xb5f983[_0xd020('0x2d')],qs[_0xd020('0x34')](_0x5d59d3[_0xd020('0x30')][_0xd020('0x34')]));_0x32ad06[_0xd020('0x33')]=_0x32ad06[_0xd020('0x33')][_0xd020('0x42')]?_0x32ad06[_0xd020('0x33')]:_0xb5f983[_0xd020('0x2d')];if(_0x5d59d3[_0xd020('0x30')][_0xd020('0x3c')]){_0x32ad06[_0xd020('0x3d')]=[{'all':!![]}];}_0x32ad06=_['merge']({},_0x32ad06,_0x5d59d3[_0xd020('0x43')]);return db[_0xd020('0x29')]['find'](_0x32ad06)[_0xd020('0x24')](handleEntityNotFound(_0x1108a7,null))[_0xd020('0x24')](respondWithResult(_0x1108a7,null))[_0xd020('0x3f')](handleError(_0x1108a7,null));};exports['create']=function(_0x20efa1,_0x365e36){return db[_0xd020('0x29')][_0xd020('0x44')](_0x20efa1['body'],{})[_0xd020('0x24')](respondWithResult(_0x365e36,0xc9))[_0xd020('0x3f')](handleError(_0x365e36,null));};exports['update']=function(_0x3ec91e,_0x15771b){if(_0x3ec91e['body']['id']){delete _0x3ec91e[_0xd020('0x45')]['id'];}return db[_0xd020('0x29')][_0xd020('0x46')]({'where':{'id':_0x3ec91e['params']['id']}})[_0xd020('0x24')](handleEntityNotFound(_0x15771b,null))[_0xd020('0x24')](saveUpdates(_0x3ec91e[_0xd020('0x45')],null))[_0xd020('0x24')](respondWithResult(_0x15771b,null))[_0xd020('0x3f')](handleError(_0x15771b,null));};exports[_0xd020('0x23')]=function(_0x990412,_0x4b5221){return db['SugarcrmField'][_0xd020('0x46')]({'where':{'id':_0x990412[_0xd020('0x41')]['id']}})['then'](handleEntityNotFound(_0x4b5221,null))[_0xd020('0x24')](removeEntity(_0x4b5221,null))[_0xd020('0x3f')](handleError(_0x4b5221,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index b8f9d19..f30521d 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 _0x5c32=['rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x5c32,0x12b));var _0x25c3=function(_0x5e0bd5,_0x59515f){_0x5e0bd5=_0x5e0bd5-0x0;var _0x5d40bd=_0x5c32[_0x5e0bd5];return _0x5d40bd;};'use strict';var _=require(_0x25c3('0x0'));var util=require(_0x25c3('0x1'));var logger=require('../../config/logger')(_0x25c3('0x2'));var moment=require(_0x25c3('0x3'));var BPromise=require(_0x25c3('0x4'));var rp=require(_0x25c3('0x5'));var fs=require('fs');var path=require(_0x25c3('0x6'));var rimraf=require(_0x25c3('0x7'));var config=require(_0x25c3('0x8'));var attributes=require(_0x25c3('0x9'));module[_0x25c3('0xa')]=function(_0x3770df,_0x11912f){return _0x3770df[_0x25c3('0xb')](_0x25c3('0xc'),attributes,{'tableName':_0x25c3('0xd'),'paranoid':![],'indexes':[{'name':_0x25c3('0xe'),'fields':[_0x25c3('0xf'),_0x25c3('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe9f1=['SugarcrmField','sugarcrm_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','path','./intSugarcrmField.attributes'];(function(_0x5cd6fd,_0x430a68){var _0x4153d3=function(_0x1cb77e){while(--_0x1cb77e){_0x5cd6fd['push'](_0x5cd6fd['shift']());}};_0x4153d3(++_0x430a68);}(_0xe9f1,0x139));var _0x1e9f=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xe9f1[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x1e9f('0x0'));var util=require(_0x1e9f('0x1'));var logger=require(_0x1e9f('0x2'))('api');var moment=require(_0x1e9f('0x3'));var BPromise=require(_0x1e9f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e9f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1e9f('0x6'));module['exports']=function(_0x4968c1,_0x556817){return _0x4968c1['define'](_0x1e9f('0x7'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x1e9f('0x8'),'fields':[_0x1e9f('0x9'),'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 7006bd3..91d4769 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 _0x874e=['code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x2a0bb0,_0x1fa696){var _0x5552c9=function(_0x1bc803){while(--_0x1bc803){_0x2a0bb0['push'](_0x2a0bb0['shift']());}};_0x5552c9(++_0x1fa696);}(_0x874e,0x10c));var _0xe874=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x874e[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require(_0xe874('0x0'));var util=require(_0xe874('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe874('0x2'));var fs=require('fs');var Redis=require(_0xe874('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe874('0x4'));var logger=require(_0xe874('0x5'))('rpc');var config=require(_0xe874('0x6'));var jayson=require(_0xe874('0x7'));var client=jayson[_0xe874('0x8')][_0xe874('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xaeae79,_0x5b83a0,_0x418051){return new BPromise(function(_0xb83833,_0x1a8593){return client[_0xe874('0xa')](_0xaeae79,_0x418051)[_0xe874('0xb')](function(_0x13118c){logger[_0xe874('0xc')](_0xe874('0xd'),_0x5b83a0,_0xe874('0xe'));logger[_0xe874('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x5b83a0,_0xe874('0xe'),JSON[_0xe874('0x10')](_0x13118c));if(_0x13118c[_0xe874('0x11')]){if(_0x13118c[_0xe874('0x11')][_0xe874('0x12')]===0x1f4){logger[_0xe874('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x5b83a0,_0x13118c[_0xe874('0x11')][_0xe874('0x13')]);return _0x1a8593(_0x13118c[_0xe874('0x11')][_0xe874('0x13')]);}logger[_0xe874('0x11')](_0xe874('0xd'),_0x5b83a0,_0x13118c[_0xe874('0x11')]['message']);return _0xb83833(_0x13118c['error'][_0xe874('0x13')]);}else{logger['info'](_0xe874('0xd'),_0x5b83a0,'request\x20sent');_0xb83833(_0x13118c[_0xe874('0x14')]['message']);}})[_0xe874('0x15')](function(_0x478b96){logger[_0xe874('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x5b83a0,_0x478b96);_0x1a8593(_0x478b96);});});} \ No newline at end of file +var _0xfbf4=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','http','request'];(function(_0x2a9490,_0x43cb5f){var _0x5bf90e=function(_0x207583){while(--_0x207583){_0x2a9490['push'](_0x2a9490['shift']());}};_0x5bf90e(++_0x43cb5f);}(_0xfbf4,0x75));var _0x4fbf=function(_0x31995d,_0x589acc){_0x31995d=_0x31995d-0x0;var _0x33c391=_0xfbf4[_0x31995d];return _0x33c391;};'use strict';var _=require(_0x4fbf('0x0'));var util=require(_0x4fbf('0x1'));var moment=require('moment');var BPromise=require(_0x4fbf('0x2'));var rs=require(_0x4fbf('0x3'));var fs=require('fs');var Redis=require(_0x4fbf('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4fbf('0x5'));var jayson=require(_0x4fbf('0x6'));var client=jayson['client'][_0x4fbf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a5be8,_0x338674,_0x15a1d2){return new BPromise(function(_0x1ada1f,_0xe12206){return client[_0x4fbf('0x8')](_0x5a5be8,_0x15a1d2)['then'](function(_0x22602c){logger[_0x4fbf('0x9')](_0x4fbf('0xa'),_0x338674,_0x4fbf('0xb'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x338674,_0x4fbf('0xb'),JSON[_0x4fbf('0xc')](_0x22602c));if(_0x22602c[_0x4fbf('0xd')]){if(_0x22602c[_0x4fbf('0xd')][_0x4fbf('0xe')]===0x1f4){logger['error'](_0x4fbf('0xa'),_0x338674,_0x22602c[_0x4fbf('0xd')]['message']);return _0xe12206(_0x22602c[_0x4fbf('0xd')][_0x4fbf('0xf')]);}logger[_0x4fbf('0xd')](_0x4fbf('0xa'),_0x338674,_0x22602c[_0x4fbf('0xd')][_0x4fbf('0xf')]);return _0x1ada1f(_0x22602c[_0x4fbf('0xd')][_0x4fbf('0xf')]);}else{logger[_0x4fbf('0x9')](_0x4fbf('0xa'),_0x338674,_0x4fbf('0xb'));_0x1ada1f(_0x22602c[_0x4fbf('0x10')]['message']);}})[_0x4fbf('0x11')](function(_0x1335e6){logger[_0x4fbf('0xd')](_0x4fbf('0xa'),_0x338674,_0x1335e6);_0xe12206(_0x1335e6);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 16c69b3..a14bc48 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 _0x4a81=['util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','delete','destroy','multer'];(function(_0x11a1a6,_0x3bb701){var _0x38f91e=function(_0x2b4d74){while(--_0x2b4d74){_0x11a1a6['push'](_0x11a1a6['shift']());}};_0x38f91e(++_0x3bb701);}(_0x4a81,0x1b7));var _0x14a8=function(_0x27cdab,_0xb70eb5){_0x27cdab=_0x27cdab-0x0;var _0x61858e=_0x4a81[_0x27cdab];return _0x61858e;};'use strict';var multer=require(_0x14a8('0x0'));var util=require(_0x14a8('0x1'));var path=require(_0x14a8('0x2'));var timeout=require(_0x14a8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x14a8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x14a8('0x5'));var config=require(_0x14a8('0x6'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x14a8('0x7')](),controller['index']);router[_0x14a8('0x8')]('/:id',auth[_0x14a8('0x7')](),controller[_0x14a8('0x9')]);router[_0x14a8('0x8')](_0x14a8('0xa'),auth[_0x14a8('0x7')](),controller['getConfigurations']);router['get'](_0x14a8('0xb'),auth[_0x14a8('0x7')](),controller[_0x14a8('0xc')]);router['post']('/',auth[_0x14a8('0x7')](),controller[_0x14a8('0xd')]);router[_0x14a8('0xe')](_0x14a8('0xa'),auth[_0x14a8('0x7')](),controller[_0x14a8('0xf')]);router[_0x14a8('0x10')](_0x14a8('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x14a8('0x12')](_0x14a8('0x11'),auth['isAuthenticated'](),controller[_0x14a8('0x13')]);module['exports']=router; \ No newline at end of file +var _0xefe5=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','/:id'];(function(_0xbb6185,_0x98d595){var _0x435d96=function(_0x8e0918){while(--_0x8e0918){_0xbb6185['push'](_0xbb6185['shift']());}};_0x435d96(++_0x98d595);}(_0xefe5,0xf6));var _0x5efe=function(_0x4a6de2,_0x451b92){_0x4a6de2=_0x4a6de2-0x0;var _0x5c4cb8=_0xefe5[_0x4a6de2];return _0x5c4cb8;};'use strict';var multer=require(_0x5efe('0x0'));var util=require('util');var path=require(_0x5efe('0x1'));var timeout=require(_0x5efe('0x2'));var express=require('express');var router=express[_0x5efe('0x3')]();var fs_extra=require(_0x5efe('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5efe('0x5'));var config=require('../../config/environment');var controller=require(_0x5efe('0x6'));router[_0x5efe('0x7')]('/',auth[_0x5efe('0x8')](),controller[_0x5efe('0x9')]);router[_0x5efe('0x7')]('/:id',auth[_0x5efe('0x8')](),controller[_0x5efe('0xa')]);router[_0x5efe('0x7')](_0x5efe('0xb'),auth[_0x5efe('0x8')](),controller[_0x5efe('0xc')]);router[_0x5efe('0x7')](_0x5efe('0xd'),auth[_0x5efe('0x8')](),controller['getFields']);router[_0x5efe('0xe')]('/',auth[_0x5efe('0x8')](),controller[_0x5efe('0xf')]);router[_0x5efe('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x5efe('0x10')](_0x5efe('0x11'),auth[_0x5efe('0x8')](),controller[_0x5efe('0x12')]);router[_0x5efe('0x13')](_0x5efe('0x11'),auth[_0x5efe('0x8')](),controller[_0x5efe('0x14')]);module[_0x5efe('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 5a02e69..d2d7445 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 _0x4f55=['STRING','HelpDesk','sequelize'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x4f55,0x11c));var _0x54f5=function(_0x5e0b5a,_0x36e6c5){_0x5e0b5a=_0x5e0b5a-0x0;var _0x210963=_0x4f55[_0x5e0b5a];return _0x210963;};'use strict';var Sequelize=require(_0x54f5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x54f5('0x1')]},'username':{'type':Sequelize[_0x54f5('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x54f5('0x1')],'allowNull':![],'defaultValue':_0x54f5('0x2')},'remoteUri':{'type':Sequelize[_0x54f5('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x54f5('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x54f5('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xcd75=['STRING','HelpDesk','sequelize','exports'];(function(_0x1f0910,_0x5345dc){var _0x1ad566=function(_0x46f0d5){while(--_0x46f0d5){_0x1f0910['push'](_0x1f0910['shift']());}};_0x1ad566(++_0x5345dc);}(_0xcd75,0x10e));var _0x5cd7=function(_0x24e964,_0x5e6454){_0x24e964=_0x24e964-0x0;var _0x4044b5=_0xcd75[_0x24e964];return _0x4044b5;};'use strict';var Sequelize=require(_0x5cd7('0x0'));module[_0x5cd7('0x1')]={'name':{'type':Sequelize[_0x5cd7('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5cd7('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5cd7('0x2')],'allowNull':![],'defaultValue':_0x5cd7('0x3')},'remoteUri':{'type':Sequelize[_0x5cd7('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5cd7('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5cd7('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 7935df0..6e0a497 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 _0x3de2=['mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','rawAttributes','includeAll','catch','create','body','find','params','getConfigurations','findOne','pick','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','sessionName','reference','remove','includes','editable','false','startsWith','cf_','picklistValues','label','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3de2,0x1ea));var _0x23de=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x3de2[_0xaa1b3e];return _0x454d7d;};'use strict';var emlformat=require(_0x23de('0x0'));var rimraf=require(_0x23de('0x1'));var zipdir=require(_0x23de('0x2'));var jsonpatch=require(_0x23de('0x3'));var rp=require(_0x23de('0x4'));var moment=require('moment');var BPromise=require(_0x23de('0x5'));var Mustache=require(_0x23de('0x6'));var util=require(_0x23de('0x7'));var path=require(_0x23de('0x8'));var sox=require(_0x23de('0x9'));var csv=require(_0x23de('0xa'));var ejs=require(_0x23de('0xb'));var fs=require('fs');var fs_extra=require(_0x23de('0xc'));var _=require('lodash');var squel=require(_0x23de('0xd'));var crypto=require('crypto');var jsforce=require(_0x23de('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x23de('0xa'));var querystring=require(_0x23de('0xf'));var Papa=require(_0x23de('0x10'));var Redis=require(_0x23de('0x11'));var authService=require(_0x23de('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x23de('0x13'));var hardwareService=require(_0x23de('0x14'));var logger=require(_0x23de('0x15'))(_0x23de('0x16'));var utils=require(_0x23de('0x17'));var config=require(_0x23de('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x23de('0x19'))['db'];var integrations=require(_0x23de('0x1a'));function respondWithStatusCode(_0x4d560a,_0x2299ac){_0x2299ac=_0x2299ac||0xcc;return function(_0x3fab38){if(_0x3fab38){return _0x4d560a[_0x23de('0x1b')](_0x2299ac);}return _0x4d560a[_0x23de('0x1c')](_0x2299ac)[_0x23de('0x1d')]();};}function respondWithResult(_0x490444,_0x59d38c){_0x59d38c=_0x59d38c||0xc8;return function(_0x438474){if(_0x438474){return _0x490444[_0x23de('0x1c')](_0x59d38c)['json'](_0x438474);}};}function respondWithFilteredResult(_0x3fa752,_0x3f7158){return function(_0x460203){if(_0x460203){var _0x4624ad=typeof _0x3f7158[_0x23de('0x1e')]===_0x23de('0x1f')&&typeof _0x3f7158[_0x23de('0x20')]===_0x23de('0x1f');var _0x30fc00=_0x460203[_0x23de('0x21')];var _0x4ae34b=_0x4624ad?0x0:_0x3f7158[_0x23de('0x1e')];var _0x32c7c8=_0x4624ad?_0x460203[_0x23de('0x21')]:_0x3f7158[_0x23de('0x1e')]+_0x3f7158[_0x23de('0x20')];var _0x2410ca;if(_0x32c7c8>=_0x30fc00){_0x32c7c8=_0x30fc00;_0x2410ca=0xc8;}else{_0x2410ca=0xce;}_0x3fa752[_0x23de('0x1c')](_0x2410ca);return _0x3fa752[_0x23de('0x22')](_0x23de('0x23'),_0x4ae34b+'-'+_0x32c7c8+'/'+_0x30fc00)[_0x23de('0x24')](_0x460203);}return null;};}function patchUpdates(_0x159701){return function(_0x256c23){try{jsonpatch[_0x23de('0x25')](_0x256c23,_0x159701,!![]);}catch(_0x4d429d){return BPromise['reject'](_0x4d429d);}return _0x256c23[_0x23de('0x26')]();};}function saveUpdates(_0x9ea34e,_0x52f18f){return function(_0x2a6e5a){if(_0x2a6e5a){return _0x2a6e5a[_0x23de('0x27')](_0x9ea34e)[_0x23de('0x28')](function(_0x419d89){return _0x419d89;});}return null;};}function removeEntity(_0x594b00,_0x554349){return function(_0x1bf5a6){if(_0x1bf5a6){return _0x1bf5a6[_0x23de('0x29')]()[_0x23de('0x28')](function(){_0x594b00['status'](0xcc)[_0x23de('0x1d')]();});}};}function handleEntityNotFound(_0x451f19,_0xd2f73a){return function(_0xdbe1ed){if(!_0xdbe1ed){_0x451f19[_0x23de('0x1b')](0x194);}return _0xdbe1ed;};}function handleError(_0x2e49fa,_0x321082){_0x321082=_0x321082||0x1f4;return function(_0x4c1e2d){logger[_0x23de('0x2a')](_0x4c1e2d[_0x23de('0x2b')]);if(_0x4c1e2d[_0x23de('0x2c')]){delete _0x4c1e2d[_0x23de('0x2c')];}_0x2e49fa[_0x23de('0x1c')](_0x321082)[_0x23de('0x2d')](_0x4c1e2d);};}exports[_0x23de('0x2e')]=function(_0x585c1c,_0x1cdd33){var _0x11b0c5={},_0x3c8dd2={},_0x36c0cb={'count':0x0,'rows':[]};var _0x12d82c=_[_0x23de('0x2f')](db[_0x23de('0x30')]['rawAttributes'],function(_0x356b80){return{'name':_0x356b80[_0x23de('0x31')],'type':_0x356b80[_0x23de('0x32')][_0x23de('0x33')]};});_0x3c8dd2[_0x23de('0x34')]=_[_0x23de('0x2f')](_0x12d82c,_0x23de('0x2c'));_0x3c8dd2[_0x23de('0x35')]=_[_0x23de('0x36')](_0x585c1c[_0x23de('0x35')]);_0x3c8dd2['filters']=_['intersection'](_0x3c8dd2['model'],_0x3c8dd2[_0x23de('0x35')]);_0x11b0c5[_0x23de('0x37')]=_[_0x23de('0x38')](_0x3c8dd2[_0x23de('0x34')],qs[_0x23de('0x39')](_0x585c1c[_0x23de('0x35')]['fields']));_0x11b0c5['attributes']=_0x11b0c5[_0x23de('0x37')][_0x23de('0x3a')]?_0x11b0c5[_0x23de('0x37')]:_0x3c8dd2['model'];if(!_0x585c1c[_0x23de('0x35')][_0x23de('0x3b')](_0x23de('0x3c'))){_0x11b0c5[_0x23de('0x20')]=qs['limit'](_0x585c1c[_0x23de('0x35')][_0x23de('0x20')]);_0x11b0c5[_0x23de('0x1e')]=qs[_0x23de('0x1e')](_0x585c1c[_0x23de('0x35')]['offset']);}_0x11b0c5[_0x23de('0x3d')]=qs[_0x23de('0x3e')](_0x585c1c[_0x23de('0x35')]['sort']);_0x11b0c5[_0x23de('0x3f')]=qs[_0x23de('0x40')](_['pick'](_0x585c1c[_0x23de('0x35')],_0x3c8dd2[_0x23de('0x40')]),_0x12d82c);if(_0x585c1c['query'][_0x23de('0x41')]){_0x11b0c5[_0x23de('0x3f')]=_[_0x23de('0x42')](_0x11b0c5['where'],{'$or':_['map'](_0x12d82c,function(_0x305d2e){if(_0x305d2e[_0x23de('0x32')]!==_0x23de('0x43')){var _0x15b007={};_0x15b007[_0x305d2e[_0x23de('0x2c')]]={'$like':'%'+_0x585c1c[_0x23de('0x35')][_0x23de('0x41')]+'%'};return _0x15b007;}})});}_0x11b0c5=_[_0x23de('0x42')]({},_0x11b0c5,_0x585c1c[_0x23de('0x44')]);var _0x350520={'where':_0x11b0c5[_0x23de('0x3f')]};return db['VtigerAccount']['count'](_0x350520)['then'](function(_0x59c6c6){_0x36c0cb[_0x23de('0x21')]=_0x59c6c6;if(_0x585c1c[_0x23de('0x35')]['includeAll']){_0x11b0c5[_0x23de('0x45')]=[{'all':!![]}];}return db[_0x23de('0x30')][_0x23de('0x46')](_0x11b0c5);})[_0x23de('0x28')](function(_0x4efd63){_0x36c0cb[_0x23de('0x47')]=_0x4efd63;return _0x36c0cb;})[_0x23de('0x28')](respondWithFilteredResult(_0x1cdd33,_0x11b0c5))['catch'](handleError(_0x1cdd33,null));};exports[_0x23de('0x48')]=function(_0x3ff482,_0x1af17e){var _0x5905c5={'raw':![],'where':{'id':_0x3ff482['params']['id']}},_0x2a74cc={};_0x2a74cc[_0x23de('0x34')]=_[_0x23de('0x36')](db[_0x23de('0x30')][_0x23de('0x49')]);_0x2a74cc['query']=_[_0x23de('0x36')](_0x3ff482[_0x23de('0x35')]);_0x2a74cc[_0x23de('0x40')]=_[_0x23de('0x38')](_0x2a74cc[_0x23de('0x34')],_0x2a74cc['query']);_0x5905c5[_0x23de('0x37')]=_[_0x23de('0x38')](_0x2a74cc['model'],qs['fields'](_0x3ff482[_0x23de('0x35')][_0x23de('0x39')]));_0x5905c5[_0x23de('0x37')]=_0x5905c5[_0x23de('0x37')][_0x23de('0x3a')]?_0x5905c5[_0x23de('0x37')]:_0x2a74cc[_0x23de('0x34')];if(_0x3ff482[_0x23de('0x35')][_0x23de('0x4a')]){_0x5905c5[_0x23de('0x45')]=[{'all':!![]}];}_0x5905c5=_[_0x23de('0x42')]({},_0x5905c5,_0x3ff482[_0x23de('0x44')]);return db[_0x23de('0x30')]['find'](_0x5905c5)[_0x23de('0x28')](handleEntityNotFound(_0x1af17e,null))[_0x23de('0x28')](respondWithResult(_0x1af17e,null))[_0x23de('0x4b')](handleError(_0x1af17e,null));};exports[_0x23de('0x4c')]=function(_0x4b3438,_0x45608a){return db['VtigerAccount']['create'](_0x4b3438[_0x23de('0x4d')],{})[_0x23de('0x28')](respondWithResult(_0x45608a,0xc9))[_0x23de('0x4b')](handleError(_0x45608a,null));};exports[_0x23de('0x27')]=function(_0x7421bf,_0xb5927a){if(_0x7421bf[_0x23de('0x4d')]['id']){delete _0x7421bf['body']['id'];}return db['VtigerAccount'][_0x23de('0x4e')]({'where':{'id':_0x7421bf[_0x23de('0x4f')]['id']}})['then'](handleEntityNotFound(_0xb5927a,null))['then'](saveUpdates(_0x7421bf[_0x23de('0x4d')],null))['then'](respondWithResult(_0xb5927a,null))[_0x23de('0x4b')](handleError(_0xb5927a,null));};exports[_0x23de('0x29')]=function(_0x7daad1,_0x1e4e5c){return db['VtigerAccount']['find']({'where':{'id':_0x7daad1[_0x23de('0x4f')]['id']}})[_0x23de('0x28')](handleEntityNotFound(_0x1e4e5c,null))[_0x23de('0x28')](removeEntity(_0x1e4e5c,null))[_0x23de('0x4b')](handleError(_0x1e4e5c,null));};exports[_0x23de('0x50')]=function(_0x531120,_0x5f2f5,_0x5e77ab){var _0x564c7d={};var _0x4a65ed={};var _0x5a7a4c;var _0x3e92be;return db[_0x23de('0x30')][_0x23de('0x51')]({'where':{'id':_0x531120[_0x23de('0x4f')]['id']}})[_0x23de('0x28')](handleEntityNotFound(_0x5f2f5,null))[_0x23de('0x28')](function(_0x261863){if(_0x261863){_0x5a7a4c=_0x261863;_0x4a65ed[_0x23de('0x34')]=_[_0x23de('0x36')](db['VtigerConfiguration']['rawAttributes']);_0x4a65ed[_0x23de('0x35')]=_[_0x23de('0x36')](_0x531120[_0x23de('0x35')]);_0x4a65ed[_0x23de('0x40')]=_[_0x23de('0x38')](_0x4a65ed[_0x23de('0x34')],_0x4a65ed[_0x23de('0x35')]);_0x564c7d['attributes']=_[_0x23de('0x38')](_0x4a65ed[_0x23de('0x34')],qs[_0x23de('0x39')](_0x531120[_0x23de('0x35')]['fields']));_0x564c7d[_0x23de('0x37')]=_0x564c7d[_0x23de('0x37')]['length']?_0x564c7d[_0x23de('0x37')]:_0x4a65ed[_0x23de('0x34')];_0x564c7d[_0x23de('0x3d')]=qs[_0x23de('0x3e')](_0x531120[_0x23de('0x35')][_0x23de('0x3e')]);_0x564c7d[_0x23de('0x3f')]=qs[_0x23de('0x40')](_[_0x23de('0x52')](_0x531120[_0x23de('0x35')],_0x4a65ed[_0x23de('0x40')]));if(_0x531120[_0x23de('0x35')]['filter']){_0x564c7d[_0x23de('0x3f')]=_[_0x23de('0x42')](_0x564c7d['where'],{'$or':_[_0x23de('0x2f')](_0x564c7d[_0x23de('0x37')],function(_0x3dc2a7){var _0x1a2af8={};_0x1a2af8[_0x3dc2a7]={'$like':'%'+_0x531120[_0x23de('0x35')][_0x23de('0x41')]+'%'};return _0x1a2af8;})});}_0x564c7d=_[_0x23de('0x42')]({},_0x564c7d,_0x531120[_0x23de('0x44')]);return _0x5a7a4c[_0x23de('0x50')](_0x564c7d);}})[_0x23de('0x28')](function(_0x4c8923){if(_0x4c8923){_0x3e92be=_0x4c8923[_0x23de('0x3a')];if(!_0x531120[_0x23de('0x35')][_0x23de('0x3b')](_0x23de('0x3c'))){_0x564c7d[_0x23de('0x20')]=qs['limit'](_0x531120[_0x23de('0x35')][_0x23de('0x20')]);_0x564c7d[_0x23de('0x1e')]=qs[_0x23de('0x1e')](_0x531120[_0x23de('0x35')]['offset']);}return _0x5a7a4c[_0x23de('0x50')](_0x564c7d);}})[_0x23de('0x28')](function(_0x43e452){if(_0x43e452){return _0x43e452?{'count':_0x3e92be,'rows':_0x43e452}:null;}})[_0x23de('0x28')](respondWithResult(_0x5f2f5,null))[_0x23de('0x4b')](handleError(_0x5f2f5,null));};exports['addConfiguration']=function(_0x50c14d,_0x341820,_0x2853ad){if(_0x50c14d['body']['id']){delete _0x50c14d['body']['id'];}return db[_0x23de('0x30')]['findOne']({'where':{'id':_0x50c14d[_0x23de('0x4f')]['id']}})[_0x23de('0x28')](handleEntityNotFound(_0x341820,null))['then'](function(_0x5f0ec6){if(_0x5f0ec6){_0x50c14d[_0x23de('0x4d')]['AccountId']=_0x5f0ec6['id'];_0x50c14d[_0x23de('0x4d')][_0x23de('0x53')]=integrations[_0x23de('0x54')](_0x50c14d[_0x23de('0x4d')][_0x23de('0x55')],_0x50c14d[_0x23de('0x4d')]['type']);_0x50c14d['body'][_0x23de('0x56')]=integrations[_0x23de('0x57')](_0x50c14d[_0x23de('0x4d')][_0x23de('0x55')],_0x50c14d[_0x23de('0x4d')][_0x23de('0x32')]);return db['VtigerConfiguration'][_0x23de('0x4c')](_0x50c14d[_0x23de('0x4d')],{'include':[{'model':db['VtigerField'],'as':_0x23de('0x53')},{'model':db[_0x23de('0x58')],'as':_0x23de('0x56')}]});}return null;})[_0x23de('0x28')](respondWithResult(_0x341820,null))[_0x23de('0x4b')](handleError(_0x341820,null));};var md5=require(_0x23de('0x59'));exports[_0x23de('0x5a')]=function(_0x516e4e,_0x239eec,_0x2c87d3){var _0x496d47=null;var _0x2d0e10=null;var _0x3b4551=null;var _0x2835ab=null;var _0x2e9090='';return db[_0x23de('0x30')][_0x23de('0x51')]({'where':{'id':_0x516e4e['params']['id']},'attributes':['id',_0x23de('0x2c'),_0x23de('0x5b'),'description',_0x23de('0x5c'),_0x23de('0x5d'),_0x23de('0x5e'),_0x23de('0x5f')]})[_0x23de('0x28')](handleEntityNotFound(_0x239eec,null))[_0x23de('0x28')](function(_0x25c973){if(_0x25c973){_0x496d47=_0x25c973[_0x23de('0x5b')];_0x2d0e10=_0x25c973[_0x23de('0x5f')];_0x3b4551=_0x25c973[_0x23de('0x5c')];_0x2e9090=_0x25c973['remoteUri'];var _0x1e8575=_0x2e9090[_0x23de('0x60')](-0x1);if(_0x1e8575==='/'){_0x2e9090=_0x2e9090['substring'](0x0,_0x2e9090[_0x23de('0x61')](_0x1e8575));}_0x2835ab=util[_0x23de('0x62')](_0x23de('0x63'),_0x2e9090);var _0x3e6444={'method':_0x23de('0x64'),'uri':_0x2835ab,'qs':{'operation':_0x23de('0x65'),'username':_0x25c973[_0x23de('0x5b')]},'json':!![]};return rp(_0x3e6444);}})['then'](function(_0x412334){if(_0x412334[_0x23de('0x66')]){var _0x1fc23b={'method':_0x23de('0x67'),'uri':_0x2835ab,'form':{'operation':_0x23de('0x68'),'username':_0x496d47,'accessKey':md5(_0x412334[_0x23de('0x69')][_0x23de('0x6a')]+_0x2d0e10)},'json':!![]};return rp(_0x1fc23b);}})['then'](function(_0x37d8c0){if(_0x37d8c0['success']){var _0x55bd54={'method':_0x23de('0x64'),'uri':_0x2835ab,'qs':{'operation':'describe','username':_0x496d47,'sessionName':_0x37d8c0[_0x23de('0x69')][_0x23de('0x6b')],'elementType':_0x3b4551},'json':!![]};return rp(_0x55bd54);}})[_0x23de('0x28')](function(_0xe91ef3){if(_0xe91ef3[_0x23de('0x66')]){var _0x500d13=['autogenerated',_0x23de('0x6c'),'owner'];_[_0x23de('0x6d')](_0xe91ef3[_0x23de('0x69')][_0x23de('0x39')],function(_0x1128cf){return _0x500d13[_0x23de('0x6e')](_0x1128cf[_0x23de('0x32')][_0x23de('0x2c')]);});_[_0x23de('0x6d')](_0xe91ef3[_0x23de('0x69')][_0x23de('0x39')],function(_0x34fcc8){return _0x34fcc8[_0x23de('0x6f')]===_0x23de('0x70');});return{'count':_0xe91ef3[_0x23de('0x69')][_0x23de('0x39')][_0x23de('0x3a')],'rows':_[_0x23de('0x2f')](_0xe91ef3['result'][_0x23de('0x39')],function(_0x3e2f4c){return{'id':_0x3e2f4c[_0x23de('0x2c')],'name':_0x3e2f4c['label'],'custom':_[_0x23de('0x71')](_0x3e2f4c['name'],_0x23de('0x72'))?!![]:![],'options':_0x3e2f4c[_0x23de('0x32')]['name']==='picklist'&&_0x3e2f4c[_0x23de('0x32')][_0x23de('0x73')][_0x23de('0x3a')]>0x0?_[_0x23de('0x2f')](_0x3e2f4c[_0x23de('0x32')][_0x23de('0x73')],function(_0x3a8a47){return{'name':_0x3a8a47[_0x23de('0x74')],'value':_0x3a8a47[_0x23de('0x75')]};}):[]};})};}})[_0x23de('0x28')](respondWithResult(_0x239eec,null))['catch'](function(_0x1b843c){console[_0x23de('0x76')]('vTiger\x20error:\x20'+_0x1b843c);var _0x448edc=_0x516e4e[_0x23de('0x35')][_0x23de('0x77')]?0x1f4:_0x1b843c[_0x23de('0x78')]||0x1f4;logger[_0x23de('0x2a')](_0x23de('0x79'),_0x23de('0x5a'),_0x448edc,JSON[_0x23de('0x7a')](_0x1b843c));delete _0x1b843c[_0x23de('0x2c')];if(_0x448edc===0x191){_0x448edc=0x190;}_0x239eec[_0x23de('0x1c')](_0x448edc)[_0x23de('0x2d')](_0x516e4e[_0x23de('0x35')][_0x23de('0x77')]?{'message':_0x23de('0x7b'),'statusCode':_0x1b843c[_0x23de('0x78')]}:_0x1b843c);});}; \ No newline at end of file +var _0x6e6d=['picklist','picklistValues','label','value','vTiger\x20error:\x20','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','limit','count','apply','reject','save','then','destroy','stack','name','send','index','VtigerAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','rawAttributes','fields','length','includeAll','include','find','update','body','params','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','VtigerField','md5','username','description','moduleName','remoteUri','serverUrl','slice','substring','%s/webservice.php','GET','success','token','describe','result','sessionName','autogenerated','reference','owner','remove','includes','editable','startsWith','cf_'];(function(_0x3c65e5,_0x1b96f2){var _0x50179f=function(_0x4638ca){while(--_0x4638ca){_0x3c65e5['push'](_0x3c65e5['shift']());}};_0x50179f(++_0x1b96f2);}(_0x6e6d,0x7c));var _0xd6e6=function(_0xfdc070,_0x359a79){_0xfdc070=_0xfdc070-0x0;var _0x4430dd=_0x6e6d[_0xfdc070];return _0x4430dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6e6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd6e6('0x1'));var rp=require(_0xd6e6('0x2'));var moment=require('moment');var BPromise=require(_0xd6e6('0x3'));var Mustache=require(_0xd6e6('0x4'));var util=require('util');var path=require(_0xd6e6('0x5'));var sox=require(_0xd6e6('0x6'));var csv=require('to-csv');var ejs=require(_0xd6e6('0x7'));var fs=require('fs');var fs_extra=require(_0xd6e6('0x8'));var _=require(_0xd6e6('0x9'));var squel=require(_0xd6e6('0xa'));var crypto=require(_0xd6e6('0xb'));var jsforce=require(_0xd6e6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd6e6('0xd'));var querystring=require(_0xd6e6('0xe'));var Papa=require(_0xd6e6('0xf'));var Redis=require(_0xd6e6('0x10'));var authService=require(_0xd6e6('0x11'));var qs=require(_0xd6e6('0x12'));var as=require(_0xd6e6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd6e6('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd6e6('0x15'));var db=require(_0xd6e6('0x16'))['db'];var integrations=require(_0xd6e6('0x17'));function respondWithStatusCode(_0x2b0fd5,_0x376d5e){_0x376d5e=_0x376d5e||0xcc;return function(_0x12984c){if(_0x12984c){return _0x2b0fd5['sendStatus'](_0x376d5e);}return _0x2b0fd5[_0xd6e6('0x18')](_0x376d5e)['end']();};}function respondWithResult(_0x50ac3d,_0x303d98){_0x303d98=_0x303d98||0xc8;return function(_0x256f24){if(_0x256f24){return _0x50ac3d[_0xd6e6('0x18')](_0x303d98)[_0xd6e6('0x19')](_0x256f24);}};}function respondWithFilteredResult(_0x4338dc,_0x23033c){return function(_0x4d13b5){if(_0x4d13b5){var _0x23a295=typeof _0x23033c[_0xd6e6('0x1a')]==='undefined'&&typeof _0x23033c[_0xd6e6('0x1b')]==='undefined';var _0x3b02ec=_0x4d13b5['count'];var _0x476842=_0x23a295?0x0:_0x23033c[_0xd6e6('0x1a')];var _0x1d6d51=_0x23a295?_0x4d13b5[_0xd6e6('0x1c')]:_0x23033c[_0xd6e6('0x1a')]+_0x23033c[_0xd6e6('0x1b')];var _0x200fa6;if(_0x1d6d51>=_0x3b02ec){_0x1d6d51=_0x3b02ec;_0x200fa6=0xc8;}else{_0x200fa6=0xce;}_0x4338dc['status'](_0x200fa6);return _0x4338dc['set']('Content-Range',_0x476842+'-'+_0x1d6d51+'/'+_0x3b02ec)['json'](_0x4d13b5);}return null;};}function patchUpdates(_0x218796){return function(_0x5c10ed){try{jsonpatch[_0xd6e6('0x1d')](_0x5c10ed,_0x218796,!![]);}catch(_0xe7e1bc){return BPromise[_0xd6e6('0x1e')](_0xe7e1bc);}return _0x5c10ed[_0xd6e6('0x1f')]();};}function saveUpdates(_0x28ce0a,_0x6a6a0f){return function(_0x144da1){if(_0x144da1){return _0x144da1['update'](_0x28ce0a)[_0xd6e6('0x20')](function(_0x3da69a){return _0x3da69a;});}return null;};}function removeEntity(_0x54afaf,_0x7a2d7a){return function(_0x2f5f0e){if(_0x2f5f0e){return _0x2f5f0e[_0xd6e6('0x21')]()[_0xd6e6('0x20')](function(){_0x54afaf[_0xd6e6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51c4f4,_0x1ad89e){return function(_0x427157){if(!_0x427157){_0x51c4f4['sendStatus'](0x194);}return _0x427157;};}function handleError(_0x158afd,_0x39526f){_0x39526f=_0x39526f||0x1f4;return function(_0x4bf651){logger['error'](_0x4bf651[_0xd6e6('0x22')]);if(_0x4bf651[_0xd6e6('0x23')]){delete _0x4bf651[_0xd6e6('0x23')];}_0x158afd[_0xd6e6('0x18')](_0x39526f)[_0xd6e6('0x24')](_0x4bf651);};}exports[_0xd6e6('0x25')]=function(_0x346400,_0x1e012f){var _0x5f3245={},_0x2d2b59={},_0x24dc20={'count':0x0,'rows':[]};var _0x42bc39=_['map'](db[_0xd6e6('0x26')]['rawAttributes'],function(_0x309573){return{'name':_0x309573[_0xd6e6('0x27')],'type':_0x309573[_0xd6e6('0x28')][_0xd6e6('0x29')]};});_0x2d2b59[_0xd6e6('0x2a')]=_[_0xd6e6('0x2b')](_0x42bc39,_0xd6e6('0x23'));_0x2d2b59[_0xd6e6('0x2c')]=_[_0xd6e6('0x2d')](_0x346400[_0xd6e6('0x2c')]);_0x2d2b59[_0xd6e6('0x2e')]=_[_0xd6e6('0x2f')](_0x2d2b59['model'],_0x2d2b59['query']);_0x5f3245[_0xd6e6('0x30')]=_[_0xd6e6('0x2f')](_0x2d2b59[_0xd6e6('0x2a')],qs['fields'](_0x346400[_0xd6e6('0x2c')]['fields']));_0x5f3245['attributes']=_0x5f3245['attributes']['length']?_0x5f3245[_0xd6e6('0x30')]:_0x2d2b59['model'];if(!_0x346400[_0xd6e6('0x2c')][_0xd6e6('0x31')]('nolimit')){_0x5f3245[_0xd6e6('0x1b')]=qs[_0xd6e6('0x1b')](_0x346400[_0xd6e6('0x2c')][_0xd6e6('0x1b')]);_0x5f3245['offset']=qs['offset'](_0x346400[_0xd6e6('0x2c')][_0xd6e6('0x1a')]);}_0x5f3245[_0xd6e6('0x32')]=qs[_0xd6e6('0x33')](_0x346400[_0xd6e6('0x2c')]['sort']);_0x5f3245[_0xd6e6('0x34')]=qs[_0xd6e6('0x2e')](_[_0xd6e6('0x35')](_0x346400['query'],_0x2d2b59[_0xd6e6('0x2e')]),_0x42bc39);if(_0x346400[_0xd6e6('0x2c')][_0xd6e6('0x36')]){_0x5f3245['where']=_[_0xd6e6('0x37')](_0x5f3245[_0xd6e6('0x34')],{'$or':_[_0xd6e6('0x2b')](_0x42bc39,function(_0x434d70){if(_0x434d70[_0xd6e6('0x28')]!==_0xd6e6('0x38')){var _0x497d61={};_0x497d61[_0x434d70['name']]={'$like':'%'+_0x346400[_0xd6e6('0x2c')][_0xd6e6('0x36')]+'%'};return _0x497d61;}})});}_0x5f3245=_['merge']({},_0x5f3245,_0x346400[_0xd6e6('0x39')]);var _0x4e0735={'where':_0x5f3245[_0xd6e6('0x34')]};return db[_0xd6e6('0x26')]['count'](_0x4e0735)['then'](function(_0x35b4ad){_0x24dc20[_0xd6e6('0x1c')]=_0x35b4ad;if(_0x346400[_0xd6e6('0x2c')]['includeAll']){_0x5f3245['include']=[{'all':!![]}];}return db[_0xd6e6('0x26')]['findAll'](_0x5f3245);})['then'](function(_0x51c510){_0x24dc20[_0xd6e6('0x3a')]=_0x51c510;return _0x24dc20;})[_0xd6e6('0x20')](respondWithFilteredResult(_0x1e012f,_0x5f3245))[_0xd6e6('0x3b')](handleError(_0x1e012f,null));};exports['show']=function(_0x34792f,_0x1f2640){var _0x393218={'raw':![],'where':{'id':_0x34792f['params']['id']}},_0x5a170c={};_0x5a170c[_0xd6e6('0x2a')]=_['keys'](db[_0xd6e6('0x26')][_0xd6e6('0x3c')]);_0x5a170c[_0xd6e6('0x2c')]=_[_0xd6e6('0x2d')](_0x34792f[_0xd6e6('0x2c')]);_0x5a170c[_0xd6e6('0x2e')]=_[_0xd6e6('0x2f')](_0x5a170c['model'],_0x5a170c['query']);_0x393218['attributes']=_['intersection'](_0x5a170c['model'],qs[_0xd6e6('0x3d')](_0x34792f[_0xd6e6('0x2c')][_0xd6e6('0x3d')]));_0x393218[_0xd6e6('0x30')]=_0x393218[_0xd6e6('0x30')][_0xd6e6('0x3e')]?_0x393218[_0xd6e6('0x30')]:_0x5a170c[_0xd6e6('0x2a')];if(_0x34792f['query'][_0xd6e6('0x3f')]){_0x393218[_0xd6e6('0x40')]=[{'all':!![]}];}_0x393218=_['merge']({},_0x393218,_0x34792f[_0xd6e6('0x39')]);return db[_0xd6e6('0x26')][_0xd6e6('0x41')](_0x393218)[_0xd6e6('0x20')](handleEntityNotFound(_0x1f2640,null))[_0xd6e6('0x20')](respondWithResult(_0x1f2640,null))['catch'](handleError(_0x1f2640,null));};exports['create']=function(_0x34ca92,_0xae4a8d){return db[_0xd6e6('0x26')]['create'](_0x34ca92['body'],{})[_0xd6e6('0x20')](respondWithResult(_0xae4a8d,0xc9))[_0xd6e6('0x3b')](handleError(_0xae4a8d,null));};exports[_0xd6e6('0x42')]=function(_0x2e5343,_0x54fdf7){if(_0x2e5343[_0xd6e6('0x43')]['id']){delete _0x2e5343[_0xd6e6('0x43')]['id'];}return db[_0xd6e6('0x26')]['find']({'where':{'id':_0x2e5343[_0xd6e6('0x44')]['id']}})[_0xd6e6('0x20')](handleEntityNotFound(_0x54fdf7,null))[_0xd6e6('0x20')](saveUpdates(_0x2e5343[_0xd6e6('0x43')],null))['then'](respondWithResult(_0x54fdf7,null))[_0xd6e6('0x3b')](handleError(_0x54fdf7,null));};exports['destroy']=function(_0x30df33,_0x4221a4){return db[_0xd6e6('0x26')]['find']({'where':{'id':_0x30df33['params']['id']}})[_0xd6e6('0x20')](handleEntityNotFound(_0x4221a4,null))[_0xd6e6('0x20')](removeEntity(_0x4221a4,null))[_0xd6e6('0x3b')](handleError(_0x4221a4,null));};exports[_0xd6e6('0x45')]=function(_0xea114d,_0x2ddffb,_0xedffd6){var _0x332b85={};var _0x2a90a7={};var _0x19dd5a;var _0x2cb2c5;return db[_0xd6e6('0x26')][_0xd6e6('0x46')]({'where':{'id':_0xea114d[_0xd6e6('0x44')]['id']}})[_0xd6e6('0x20')](handleEntityNotFound(_0x2ddffb,null))[_0xd6e6('0x20')](function(_0x21e4ab){if(_0x21e4ab){_0x19dd5a=_0x21e4ab;_0x2a90a7['model']=_[_0xd6e6('0x2d')](db[_0xd6e6('0x47')][_0xd6e6('0x3c')]);_0x2a90a7[_0xd6e6('0x2c')]=_[_0xd6e6('0x2d')](_0xea114d['query']);_0x2a90a7[_0xd6e6('0x2e')]=_[_0xd6e6('0x2f')](_0x2a90a7[_0xd6e6('0x2a')],_0x2a90a7[_0xd6e6('0x2c')]);_0x332b85[_0xd6e6('0x30')]=_[_0xd6e6('0x2f')](_0x2a90a7[_0xd6e6('0x2a')],qs['fields'](_0xea114d[_0xd6e6('0x2c')][_0xd6e6('0x3d')]));_0x332b85[_0xd6e6('0x30')]=_0x332b85[_0xd6e6('0x30')]['length']?_0x332b85[_0xd6e6('0x30')]:_0x2a90a7[_0xd6e6('0x2a')];_0x332b85[_0xd6e6('0x32')]=qs['sort'](_0xea114d[_0xd6e6('0x2c')][_0xd6e6('0x33')]);_0x332b85['where']=qs['filters'](_[_0xd6e6('0x35')](_0xea114d[_0xd6e6('0x2c')],_0x2a90a7['filters']));if(_0xea114d[_0xd6e6('0x2c')][_0xd6e6('0x36')]){_0x332b85[_0xd6e6('0x34')]=_[_0xd6e6('0x37')](_0x332b85[_0xd6e6('0x34')],{'$or':_[_0xd6e6('0x2b')](_0x332b85[_0xd6e6('0x30')],function(_0x431ecf){var _0x471d13={};_0x471d13[_0x431ecf]={'$like':'%'+_0xea114d[_0xd6e6('0x2c')][_0xd6e6('0x36')]+'%'};return _0x471d13;})});}_0x332b85=_[_0xd6e6('0x37')]({},_0x332b85,_0xea114d[_0xd6e6('0x39')]);return _0x19dd5a['getConfigurations'](_0x332b85);}})[_0xd6e6('0x20')](function(_0x1b1380){if(_0x1b1380){_0x2cb2c5=_0x1b1380[_0xd6e6('0x3e')];if(!_0xea114d[_0xd6e6('0x2c')]['hasOwnProperty']('nolimit')){_0x332b85[_0xd6e6('0x1b')]=qs['limit'](_0xea114d[_0xd6e6('0x2c')][_0xd6e6('0x1b')]);_0x332b85[_0xd6e6('0x1a')]=qs[_0xd6e6('0x1a')](_0xea114d[_0xd6e6('0x2c')][_0xd6e6('0x1a')]);}return _0x19dd5a[_0xd6e6('0x45')](_0x332b85);}})['then'](function(_0x26b00d){if(_0x26b00d){return _0x26b00d?{'count':_0x2cb2c5,'rows':_0x26b00d}:null;}})[_0xd6e6('0x20')](respondWithResult(_0x2ddffb,null))[_0xd6e6('0x3b')](handleError(_0x2ddffb,null));};exports[_0xd6e6('0x48')]=function(_0x4cf3cf,_0x58a5f7,_0xd08ab4){if(_0x4cf3cf['body']['id']){delete _0x4cf3cf['body']['id'];}return db[_0xd6e6('0x26')]['findOne']({'where':{'id':_0x4cf3cf[_0xd6e6('0x44')]['id']}})[_0xd6e6('0x20')](handleEntityNotFound(_0x58a5f7,null))[_0xd6e6('0x20')](function(_0x1e8873){if(_0x1e8873){_0x4cf3cf[_0xd6e6('0x43')][_0xd6e6('0x49')]=_0x1e8873['id'];_0x4cf3cf['body'][_0xd6e6('0x4a')]=integrations[_0xd6e6('0x4b')](_0x4cf3cf[_0xd6e6('0x43')][_0xd6e6('0x4c')],_0x4cf3cf[_0xd6e6('0x43')][_0xd6e6('0x28')]);_0x4cf3cf[_0xd6e6('0x43')][_0xd6e6('0x4d')]=integrations[_0xd6e6('0x4e')](_0x4cf3cf['body'][_0xd6e6('0x4c')],_0x4cf3cf[_0xd6e6('0x43')][_0xd6e6('0x28')]);return db[_0xd6e6('0x47')][_0xd6e6('0x4f')](_0x4cf3cf['body'],{'include':[{'model':db[_0xd6e6('0x50')],'as':_0xd6e6('0x4a')},{'model':db[_0xd6e6('0x50')],'as':_0xd6e6('0x4d')}]});}return null;})[_0xd6e6('0x20')](respondWithResult(_0x58a5f7,null))['catch'](handleError(_0x58a5f7,null));};var md5=require(_0xd6e6('0x51'));exports['getFields']=function(_0x4cec8f,_0x2019d6,_0x1bb9bb){var _0x3b8694=null;var _0x50a611=null;var _0x122376=null;var _0x3504f4=null;var _0x184b2f='';return db[_0xd6e6('0x26')][_0xd6e6('0x46')]({'where':{'id':_0x4cec8f['params']['id']},'attributes':['id','name',_0xd6e6('0x52'),_0xd6e6('0x53'),_0xd6e6('0x54'),_0xd6e6('0x55'),_0xd6e6('0x56'),'accessKey']})[_0xd6e6('0x20')](handleEntityNotFound(_0x2019d6,null))[_0xd6e6('0x20')](function(_0x229445){if(_0x229445){_0x3b8694=_0x229445[_0xd6e6('0x52')];_0x50a611=_0x229445['accessKey'];_0x122376=_0x229445['moduleName'];_0x184b2f=_0x229445[_0xd6e6('0x55')];var _0x4e2728=_0x184b2f[_0xd6e6('0x57')](-0x1);if(_0x4e2728==='/'){_0x184b2f=_0x184b2f[_0xd6e6('0x58')](0x0,_0x184b2f['lastIndexOf'](_0x4e2728));}_0x3504f4=util['format'](_0xd6e6('0x59'),_0x184b2f);var _0x572786={'method':_0xd6e6('0x5a'),'uri':_0x3504f4,'qs':{'operation':'getchallenge','username':_0x229445[_0xd6e6('0x52')]},'json':!![]};return rp(_0x572786);}})[_0xd6e6('0x20')](function(_0x589a7e){if(_0x589a7e[_0xd6e6('0x5b')]){var _0x3007de={'method':'POST','uri':_0x3504f4,'form':{'operation':'login','username':_0x3b8694,'accessKey':md5(_0x589a7e['result'][_0xd6e6('0x5c')]+_0x50a611)},'json':!![]};return rp(_0x3007de);}})['then'](function(_0x300ec8){if(_0x300ec8['success']){var _0x17881e={'method':_0xd6e6('0x5a'),'uri':_0x3504f4,'qs':{'operation':_0xd6e6('0x5d'),'username':_0x3b8694,'sessionName':_0x300ec8[_0xd6e6('0x5e')][_0xd6e6('0x5f')],'elementType':_0x122376},'json':!![]};return rp(_0x17881e);}})[_0xd6e6('0x20')](function(_0x1d79c8){if(_0x1d79c8[_0xd6e6('0x5b')]){var _0x381b0b=[_0xd6e6('0x60'),_0xd6e6('0x61'),_0xd6e6('0x62')];_[_0xd6e6('0x63')](_0x1d79c8['result']['fields'],function(_0x1147c0){return _0x381b0b[_0xd6e6('0x64')](_0x1147c0['type'][_0xd6e6('0x23')]);});_[_0xd6e6('0x63')](_0x1d79c8['result']['fields'],function(_0x4043d4){return _0x4043d4[_0xd6e6('0x65')]==='false';});return{'count':_0x1d79c8[_0xd6e6('0x5e')][_0xd6e6('0x3d')]['length'],'rows':_[_0xd6e6('0x2b')](_0x1d79c8[_0xd6e6('0x5e')][_0xd6e6('0x3d')],function(_0x367434){return{'id':_0x367434[_0xd6e6('0x23')],'name':_0x367434['label'],'custom':_[_0xd6e6('0x66')](_0x367434['name'],_0xd6e6('0x67'))?!![]:![],'options':_0x367434[_0xd6e6('0x28')]['name']===_0xd6e6('0x68')&&_0x367434['type'][_0xd6e6('0x69')][_0xd6e6('0x3e')]>0x0?_['map'](_0x367434['type']['picklistValues'],function(_0x4068c2){return{'name':_0x4068c2[_0xd6e6('0x6a')],'value':_0x4068c2[_0xd6e6('0x6b')]};}):[]};})};}})[_0xd6e6('0x20')](respondWithResult(_0x2019d6,null))[_0xd6e6('0x3b')](function(_0x27cbcf){console['log'](_0xd6e6('0x6c')+_0x27cbcf);var _0x1a3d50=_0x4cec8f[_0xd6e6('0x2c')]['test']?0x1f4:_0x27cbcf[_0xd6e6('0x6d')]||0x1f4;logger[_0xd6e6('0x6e')](_0xd6e6('0x6f'),'getFields',_0x1a3d50,JSON[_0xd6e6('0x70')](_0x27cbcf));delete _0x27cbcf[_0xd6e6('0x23')];if(_0x1a3d50===0x191){_0x1a3d50=0x190;}_0x2019d6['status'](_0x1a3d50)[_0xd6e6('0x24')](_0x4cec8f[_0xd6e6('0x2c')][_0xd6e6('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x27cbcf['statusCode']}:_0x27cbcf);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 08dfa29..2d40e1b 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 _0xc708=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount','lodash'];(function(_0x297637,_0x2f80b9){var _0x189cdc=function(_0x4a13ff){while(--_0x4a13ff){_0x297637['push'](_0x297637['shift']());}};_0x189cdc(++_0x2f80b9);}(_0xc708,0x1d3));var _0x8c70=function(_0x169d90,_0x1e8ddf){_0x169d90=_0x169d90-0x0;var _0x2b501e=_0xc708[_0x169d90];return _0x2b501e;};'use strict';var _=require(_0x8c70('0x0'));var util=require('util');var logger=require(_0x8c70('0x1'))(_0x8c70('0x2'));var moment=require(_0x8c70('0x3'));var BPromise=require(_0x8c70('0x4'));var rp=require(_0x8c70('0x5'));var fs=require('fs');var path=require(_0x8c70('0x6'));var rimraf=require(_0x8c70('0x7'));var config=require(_0x8c70('0x8'));var attributes=require(_0x8c70('0x9'));var integrations=require(_0x8c70('0xa'));module['exports']=function(_0x211a27,_0x26f5b5){return _0x211a27[_0x8c70('0xb')](_0x8c70('0xc'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe904=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','int_vtiger_accounts','lodash','../../config/logger','api','moment','request-promise'];(function(_0x31adba,_0x101923){var _0x408ad0=function(_0x5c6759){while(--_0x5c6759){_0x31adba['push'](_0x31adba['shift']());}};_0x408ad0(++_0x101923);}(_0xe904,0x73));var _0x4e90=function(_0x52cbaa,_0x4dd3d3){_0x52cbaa=_0x52cbaa-0x0;var _0x38698e=_0xe904[_0x52cbaa];return _0x38698e;};'use strict';var _=require(_0x4e90('0x0'));var util=require('util');var logger=require(_0x4e90('0x1'))(_0x4e90('0x2'));var moment=require(_0x4e90('0x3'));var BPromise=require('bluebird');var rp=require(_0x4e90('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e90('0x5'));var config=require(_0x4e90('0x6'));var attributes=require(_0x4e90('0x7'));var integrations=require(_0x4e90('0x8'));module['exports']=function(_0x1a0eb2,_0x30ad92){return _0x1a0eb2['define']('VtigerAccount',attributes,{'tableName':_0x4e90('0x9'),'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 9410c6a..81b94f8 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 _0x065e=['request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','GetVtigerAccount','VtigerAccount','findAll','options','attributes','limit','include','map','model','find','ShowVtigerAccount','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info'];(function(_0x566c73,_0x571144){var _0x3d77f9=function(_0x470791){while(--_0x470791){_0x566c73['push'](_0x566c73['shift']());}};_0x3d77f9(++_0x571144);}(_0x065e,0x1a7));var _0xe065=function(_0x3e4ba8,_0x5a49ba){_0x3e4ba8=_0x3e4ba8-0x0;var _0x27f8e4=_0x065e[_0x3e4ba8];return _0x27f8e4;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe065('0x1'));var fs=require('fs');var Redis=require(_0xe065('0x2'));var db=require(_0xe065('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe065('0x4'));var config=require(_0xe065('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe065('0x6')][_0xe065('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x189d72,_0x52403a,_0x267122){return new BPromise(function(_0x5afbd4,_0x273e22){return client[_0xe065('0x8')](_0x189d72,_0x267122)[_0xe065('0x9')](function(_0x114497){logger[_0xe065('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x52403a,_0xe065('0xb'));logger[_0xe065('0xc')](_0xe065('0xd'),_0x52403a,_0xe065('0xb'),JSON[_0xe065('0xe')](_0x114497));if(_0x114497[_0xe065('0xf')]){if(_0x114497['error']['code']===0x1f4){logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x273e22(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}logger[_0xe065('0xf')](_0xe065('0x10'),_0x52403a,_0x114497[_0xe065('0xf')]['message']);return _0x5afbd4(_0x114497[_0xe065('0xf')][_0xe065('0x11')]);}else{logger[_0xe065('0xa')](_0xe065('0x10'),_0x52403a,_0xe065('0xb'));_0x5afbd4(_0x114497[_0xe065('0x12')][_0xe065('0x11')]);}})['catch'](function(_0x1ba88d){logger[_0xe065('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x52403a,_0x1ba88d);_0x273e22(_0x1ba88d);});});}exports[_0xe065('0x13')]=function(_0x1d2f7a){var _0x397f05=this;return new Promise(function(_0x14c97c,_0x1e7177){return db[_0xe065('0x14')][_0xe065('0x15')]({'raw':_0x1d2f7a['options']?_0x1d2f7a[_0xe065('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')]['where']||null:null,'attributes':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a['options'][_0xe065('0x17')]||null:null,'limit':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')][_0xe065('0x18')]||null:null,'include':_0x1d2f7a[_0xe065('0x16')]?_0x1d2f7a[_0xe065('0x16')][_0xe065('0x19')]?_[_0xe065('0x1a')](_0x1d2f7a[_0xe065('0x16')]['include'],function(_0x7208af){return{'model':db[_0x7208af[_0xe065('0x1b')]],'as':_0x7208af['as'],'attributes':_0x7208af[_0xe065('0x17')],'include':_0x7208af[_0xe065('0x19')]?_['map'](_0x7208af['include'],function(_0x164965){return{'model':db[_0x164965['model']],'as':_0x164965['as'],'attributes':_0x164965[_0xe065('0x17')],'include':_0x164965[_0xe065('0x19')]?_[_0xe065('0x1a')](_0x164965[_0xe065('0x19')],function(_0x418731){return{'model':db[_0x418731[_0xe065('0x1b')]],'as':_0x418731['as'],'attributes':_0x418731[_0xe065('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe065('0x9')](function(_0x52cd9c){logger['info'](_0xe065('0x13'),_0x1d2f7a);logger[_0xe065('0xc')](_0xe065('0x13'),_0x1d2f7a,JSON[_0xe065('0xe')](_0x52cd9c));_0x14c97c(_0x52cd9c);})['catch'](function(_0x23f573){logger['error']('GetVtigerAccount',_0x23f573[_0xe065('0x11')],_0x1d2f7a);_0x1e7177(_0x397f05[_0xe065('0xf')](0x1f4,_0x23f573[_0xe065('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x883747){var _0x59b915=this;return new Promise(function(_0x12679d,_0x46db7e){return db[_0xe065('0x14')][_0xe065('0x1c')]({'raw':_0x883747['options']?_0x883747[_0xe065('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x883747[_0xe065('0x16')]?_0x883747[_0xe065('0x16')]['where']||null:null,'attributes':_0x883747[_0xe065('0x16')]?_0x883747['options'][_0xe065('0x17')]||null:null,'include':_0x883747['options']?_0x883747[_0xe065('0x16')][_0xe065('0x19')]?_[_0xe065('0x1a')](_0x883747[_0xe065('0x16')]['include'],function(_0x1fe1dc){return{'model':db[_0x1fe1dc[_0xe065('0x1b')]],'as':_0x1fe1dc['as'],'attributes':_0x1fe1dc[_0xe065('0x17')],'include':_0x1fe1dc[_0xe065('0x19')]?_[_0xe065('0x1a')](_0x1fe1dc[_0xe065('0x19')],function(_0x4b822a){return{'model':db[_0x4b822a[_0xe065('0x1b')]],'as':_0x4b822a['as'],'attributes':_0x4b822a[_0xe065('0x17')],'include':_0x4b822a['include']?_[_0xe065('0x1a')](_0x4b822a[_0xe065('0x19')],function(_0x5afc23){return{'model':db[_0x5afc23[_0xe065('0x1b')]],'as':_0x5afc23['as'],'attributes':_0x5afc23[_0xe065('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe065('0x9')](function(_0x35135f){logger['info'](_0xe065('0x1d'),_0x883747);logger['debug'](_0xe065('0x1d'),_0x883747,JSON[_0xe065('0xe')](_0x35135f));_0x12679d(_0x35135f);})[_0xe065('0x1e')](function(_0xcceb12){logger[_0xe065('0xf')](_0xe065('0x1d'),_0xcceb12['message'],_0x883747);_0x46db7e(_0x59b915[_0xe065('0xf')](0x1f4,_0xcceb12[_0xe065('0x11')]));});});}; \ No newline at end of file +var _0xd914=['raw','where','attributes','limit','include','map','model','then','ShowVtigerAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','options'];(function(_0x49f67f,_0x4113a4){var _0x4779a1=function(_0x5064b0){while(--_0x5064b0){_0x49f67f['push'](_0x49f67f['shift']());}};_0x4779a1(++_0x4113a4);}(_0xd914,0x17f));var _0x4d91=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0xd914[_0x3f88bc];return _0x4df1c4;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var moment=require('moment');var BPromise=require(_0x4d91('0x2'));var rs=require(_0x4d91('0x3'));var fs=require('fs');var Redis=require(_0x4d91('0x4'));var db=require(_0x4d91('0x5'))['db'];var utils=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('rpc');var config=require(_0x4d91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4d91('0x9')][_0x4d91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x175ce3,_0x27c0d5,_0x22f2a4){return new BPromise(function(_0x150767,_0x3016c0){return client[_0x4d91('0xb')](_0x175ce3,_0x22f2a4)['then'](function(_0x37bde4){logger[_0x4d91('0xc')](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));logger[_0x4d91('0xf')](_0x4d91('0x10'),_0x27c0d5,'request\x20sent',JSON['stringify'](_0x37bde4));if(_0x37bde4[_0x4d91('0x11')]){if(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x12')]===0x1f4){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')]['message']);return _0x3016c0(_0x37bde4['error'][_0x4d91('0x13')]);}logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);return _0x150767(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);}else{logger['info'](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));_0x150767(_0x37bde4[_0x4d91('0x14')][_0x4d91('0x13')]);}})[_0x4d91('0x15')](function(_0x554ca8){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x554ca8);_0x3016c0(_0x554ca8);});});}exports[_0x4d91('0x16')]=function(_0x44b9a7){var _0x4cfa40=this;return new Promise(function(_0x350e23,_0x3b579b){return db[_0x4d91('0x17')]['findAll']({'raw':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x19')]===undefined?!![]:![]:!![],'where':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x1a')]||null:null,'attributes':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x1b')]||null:null,'limit':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7['options'][_0x4d91('0x1c')]||null:null,'include':_0x44b9a7['options']?_0x44b9a7['options'][_0x4d91('0x1d')]?_[_0x4d91('0x1e')](_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x1d')],function(_0x7d8cbf){return{'model':db[_0x7d8cbf[_0x4d91('0x1f')]],'as':_0x7d8cbf['as'],'attributes':_0x7d8cbf[_0x4d91('0x1b')],'include':_0x7d8cbf[_0x4d91('0x1d')]?_['map'](_0x7d8cbf['include'],function(_0x1ee6b3){return{'model':db[_0x1ee6b3[_0x4d91('0x1f')]],'as':_0x1ee6b3['as'],'attributes':_0x1ee6b3[_0x4d91('0x1b')],'include':_0x1ee6b3[_0x4d91('0x1d')]?_[_0x4d91('0x1e')](_0x1ee6b3[_0x4d91('0x1d')],function(_0x14bdb4){return{'model':db[_0x14bdb4['model']],'as':_0x14bdb4['as'],'attributes':_0x14bdb4[_0x4d91('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4d91('0x20')](function(_0x12ac74){logger['info']('GetVtigerAccount',_0x44b9a7);logger[_0x4d91('0xf')](_0x4d91('0x16'),_0x44b9a7,JSON['stringify'](_0x12ac74));_0x350e23(_0x12ac74);})['catch'](function(_0x42d5a0){logger[_0x4d91('0x11')](_0x4d91('0x16'),_0x42d5a0[_0x4d91('0x13')],_0x44b9a7);_0x3b579b(_0x4cfa40['error'](0x1f4,_0x42d5a0[_0x4d91('0x13')]));});});};exports[_0x4d91('0x21')]=function(_0x468e95){var _0xee7535=this;return new Promise(function(_0xa63422,_0x3466f3){return db[_0x4d91('0x17')]['find']({'raw':_0x468e95[_0x4d91('0x18')]?_0x468e95['options']['raw']===undefined?!![]:![]:!![],'where':_0x468e95[_0x4d91('0x18')]?_0x468e95[_0x4d91('0x18')]['where']||null:null,'attributes':_0x468e95[_0x4d91('0x18')]?_0x468e95[_0x4d91('0x18')][_0x4d91('0x1b')]||null:null,'include':_0x468e95[_0x4d91('0x18')]?_0x468e95[_0x4d91('0x18')]['include']?_[_0x4d91('0x1e')](_0x468e95[_0x4d91('0x18')][_0x4d91('0x1d')],function(_0x2b8131){return{'model':db[_0x2b8131[_0x4d91('0x1f')]],'as':_0x2b8131['as'],'attributes':_0x2b8131[_0x4d91('0x1b')],'include':_0x2b8131['include']?_[_0x4d91('0x1e')](_0x2b8131[_0x4d91('0x1d')],function(_0x5c2247){return{'model':db[_0x5c2247[_0x4d91('0x1f')]],'as':_0x5c2247['as'],'attributes':_0x5c2247[_0x4d91('0x1b')],'include':_0x5c2247[_0x4d91('0x1d')]?_['map'](_0x5c2247[_0x4d91('0x1d')],function(_0x2c8b54){return{'model':db[_0x2c8b54[_0x4d91('0x1f')]],'as':_0x2c8b54['as'],'attributes':_0x2c8b54[_0x4d91('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x64cee3){logger[_0x4d91('0xc')](_0x4d91('0x21'),_0x468e95);logger[_0x4d91('0xf')]('ShowVtigerAccount',_0x468e95,JSON['stringify'](_0x64cee3));_0xa63422(_0x64cee3);})[_0x4d91('0x15')](function(_0x3dac76){logger['error'](_0x4d91('0x21'),_0x3dac76[_0x4d91('0x13')],_0x468e95);_0x3466f3(_0xee7535[_0x4d91('0x11')](0x1f4,_0x3dac76[_0x4d91('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index fb4c015..5868b26 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 _0xd039=['../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x25a42a,_0x3d489b){var _0x1129b1=function(_0x4ae61b){while(--_0x4ae61b){_0x25a42a['push'](_0x25a42a['shift']());}};_0x1129b1(++_0x3d489b);}(_0xd039,0x1b2));var _0x9d03=function(_0x37c925,_0x2ee082){_0x37c925=_0x37c925-0x0;var _0xa19ebc=_0xd039[_0x37c925];return _0xa19ebc;};'use strict';var multer=require('multer');var util=require(_0x9d03('0x0'));var path=require('path');var timeout=require(_0x9d03('0x1'));var express=require(_0x9d03('0x2'));var router=express[_0x9d03('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9d03('0x4'));var interaction=require(_0x9d03('0x5'));var config=require(_0x9d03('0x6'));var controller=require(_0x9d03('0x7'));router[_0x9d03('0x8')]('/',auth[_0x9d03('0x9')](),controller['index']);router[_0x9d03('0x8')]('/:id',auth[_0x9d03('0x9')](),controller[_0x9d03('0xa')]);router[_0x9d03('0x8')](_0x9d03('0xb'),auth['isAuthenticated'](),controller[_0x9d03('0xc')]);router['get'](_0x9d03('0xd'),auth[_0x9d03('0x9')](),controller['getSubjects']);router[_0x9d03('0x8')](_0x9d03('0xe'),auth[_0x9d03('0x9')](),controller[_0x9d03('0xf')]);router[_0x9d03('0x10')]('/',auth['isAuthenticated'](),controller[_0x9d03('0x11')]);router[_0x9d03('0x12')](_0x9d03('0x13'),auth[_0x9d03('0x9')](),controller['update']);router['delete'](_0x9d03('0x13'),auth[_0x9d03('0x9')](),controller[_0x9d03('0x14')]);module[_0x9d03('0x15')]=router; \ No newline at end of file +var _0xa615=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getSubjects','/:id/descriptions','post','put','delete','destroy'];(function(_0x87510b,_0x2bc31d){var _0x54d7ba=function(_0x799d05){while(--_0x799d05){_0x87510b['push'](_0x87510b['shift']());}};_0x54d7ba(++_0x2bc31d);}(_0xa615,0x161));var _0x5a61=function(_0x4a8ba5,_0x36af49){_0x4a8ba5=_0x4a8ba5-0x0;var _0x2840bd=_0xa615[_0x4a8ba5];return _0x2840bd;};'use strict';var multer=require(_0x5a61('0x0'));var util=require(_0x5a61('0x1'));var path=require(_0x5a61('0x2'));var timeout=require(_0x5a61('0x3'));var express=require(_0x5a61('0x4'));var router=express[_0x5a61('0x5')]();var fs_extra=require(_0x5a61('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5a61('0x7'));var config=require(_0x5a61('0x8'));var controller=require(_0x5a61('0x9'));router[_0x5a61('0xa')]('/',auth[_0x5a61('0xb')](),controller['index']);router[_0x5a61('0xa')](_0x5a61('0xc'),auth[_0x5a61('0xb')](),controller[_0x5a61('0xd')]);router[_0x5a61('0xa')](_0x5a61('0xe'),auth[_0x5a61('0xb')](),controller['getFields']);router['get']('/:id/subjects',auth[_0x5a61('0xb')](),controller[_0x5a61('0xf')]);router['get'](_0x5a61('0x10'),auth[_0x5a61('0xb')](),controller['getDescriptions']);router[_0x5a61('0x11')]('/',auth[_0x5a61('0xb')](),controller['create']);router[_0x5a61('0x12')](_0x5a61('0xc'),auth[_0x5a61('0xb')](),controller['update']);router[_0x5a61('0x13')](_0x5a61('0xc'),auth[_0x5a61('0xb')](),controller[_0x5a61('0x14')]);module[_0x5a61('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 e7ee698..973cef8 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 _0x0b3f=['sequelize','exports','STRING'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x0b3f,0x90));var _0xf0b3=function(_0x1ad393,_0x22aa4f){_0x1ad393=_0x1ad393-0x0;var _0x2d2c19=_0x0b3f[_0x1ad393];return _0x2d2c19;};'use strict';var Sequelize=require(_0xf0b3('0x0'));module[_0xf0b3('0x1')]={'name':{'type':Sequelize[_0xf0b3('0x2')]},'description':{'type':Sequelize[_0xf0b3('0x2')]}}; \ No newline at end of file +var _0x5203=['exports'];(function(_0x403ca6,_0x24e284){var _0x4e0e05=function(_0x3a76ba){while(--_0x3a76ba){_0x403ca6['push'](_0x403ca6['shift']());}};_0x4e0e05(++_0x24e284);}(_0x5203,0x186));var _0x3520=function(_0x547ecb,_0x1d6889){_0x547ecb=_0x547ecb-0x0;var _0x148e80=_0x5203[_0x547ecb];return _0x148e80;};'use strict';var Sequelize=require('sequelize');module[_0x3520('0x0')]={'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 169ee2d..c944893 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 _0x6f21=['crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','reject','save','update','destroy','then','error','stack','name','index','map','VtigerConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','getFields','VtigerField','getSubjects','findOne','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0xda5e12,_0x4ec875){var _0x7d52ad=function(_0x2e3561){while(--_0x2e3561){_0xda5e12['push'](_0xda5e12['shift']());}};_0x7d52ad(++_0x4ec875);}(_0x6f21,0x1da));var _0x16f2=function(_0x317bf0,_0x277c03){_0x317bf0=_0x317bf0-0x0;var _0x225932=_0x6f21[_0x317bf0];return _0x225932;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x16f2('0x0'));var jsonpatch=require(_0x16f2('0x1'));var rp=require(_0x16f2('0x2'));var moment=require(_0x16f2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x16f2('0x4'));var path=require(_0x16f2('0x5'));var sox=require(_0x16f2('0x6'));var csv=require(_0x16f2('0x7'));var ejs=require(_0x16f2('0x8'));var fs=require('fs');var fs_extra=require(_0x16f2('0x9'));var _=require(_0x16f2('0xa'));var squel=require(_0x16f2('0xb'));var crypto=require(_0x16f2('0xc'));var jsforce=require(_0x16f2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x16f2('0x7'));var querystring=require('querystring');var Papa=require(_0x16f2('0xe'));var Redis=require(_0x16f2('0xf'));var authService=require(_0x16f2('0x10'));var qs=require(_0x16f2('0x11'));var as=require(_0x16f2('0x12'));var hardwareService=require(_0x16f2('0x13'));var logger=require(_0x16f2('0x14'))('api');var utils=require(_0x16f2('0x15'));var config=require(_0x16f2('0x16'));var licenseUtil=require(_0x16f2('0x17'));var db=require(_0x16f2('0x18'))['db'];function respondWithStatusCode(_0x4a8cbb,_0x42220c){_0x42220c=_0x42220c||0xcc;return function(_0x37b32b){if(_0x37b32b){return _0x4a8cbb[_0x16f2('0x19')](_0x42220c);}return _0x4a8cbb['status'](_0x42220c)[_0x16f2('0x1a')]();};}function respondWithResult(_0x42c892,_0x38d0cf){_0x38d0cf=_0x38d0cf||0xc8;return function(_0x251120){if(_0x251120){return _0x42c892[_0x16f2('0x1b')](_0x38d0cf)[_0x16f2('0x1c')](_0x251120);}};}function respondWithFilteredResult(_0x4a60f8,_0x53f68c){return function(_0x535568){if(_0x535568){var _0x4dcc1a=typeof _0x53f68c['offset']===_0x16f2('0x1d')&&typeof _0x53f68c[_0x16f2('0x1e')]==='undefined';var _0x1d8d5b=_0x535568['count'];var _0x15f85c=_0x4dcc1a?0x0:_0x53f68c[_0x16f2('0x1f')];var _0x48c40f=_0x4dcc1a?_0x535568[_0x16f2('0x20')]:_0x53f68c[_0x16f2('0x1f')]+_0x53f68c[_0x16f2('0x1e')];var _0x4f6630;if(_0x48c40f>=_0x1d8d5b){_0x48c40f=_0x1d8d5b;_0x4f6630=0xc8;}else{_0x4f6630=0xce;}_0x4a60f8[_0x16f2('0x1b')](_0x4f6630);return _0x4a60f8[_0x16f2('0x21')]('Content-Range',_0x15f85c+'-'+_0x48c40f+'/'+_0x1d8d5b)[_0x16f2('0x1c')](_0x535568);}return null;};}function patchUpdates(_0x12cd3d){return function(_0x3666f9){try{jsonpatch['apply'](_0x3666f9,_0x12cd3d,!![]);}catch(_0x11a2b4){return BPromise[_0x16f2('0x22')](_0x11a2b4);}return _0x3666f9[_0x16f2('0x23')]();};}function saveUpdates(_0x487cfc,_0x3c04a2){return function(_0x2d2af2){if(_0x2d2af2){return _0x2d2af2[_0x16f2('0x24')](_0x487cfc)['then'](function(_0x4e9296){return _0x4e9296;});}return null;};}function removeEntity(_0x22d4dc,_0x166c8b){return function(_0xc70c1b){if(_0xc70c1b){return _0xc70c1b[_0x16f2('0x25')]()[_0x16f2('0x26')](function(){_0x22d4dc[_0x16f2('0x1b')](0xcc)[_0x16f2('0x1a')]();});}};}function handleEntityNotFound(_0x40a26a,_0x376163){return function(_0x1cf853){if(!_0x1cf853){_0x40a26a[_0x16f2('0x19')](0x194);}return _0x1cf853;};}function handleError(_0x3bb461,_0x9b9f5f){_0x9b9f5f=_0x9b9f5f||0x1f4;return function(_0x2c21a7){logger[_0x16f2('0x27')](_0x2c21a7[_0x16f2('0x28')]);if(_0x2c21a7[_0x16f2('0x29')]){delete _0x2c21a7[_0x16f2('0x29')];}_0x3bb461['status'](_0x9b9f5f)['send'](_0x2c21a7);};}exports[_0x16f2('0x2a')]=function(_0x496726,_0x32bc0d){var _0x11d13c={},_0x4fa390={},_0x3d646b={'count':0x0,'rows':[]};var _0x4de5e6=_[_0x16f2('0x2b')](db[_0x16f2('0x2c')]['rawAttributes'],function(_0x3716ae){return{'name':_0x3716ae[_0x16f2('0x2d')],'type':_0x3716ae[_0x16f2('0x2e')][_0x16f2('0x2f')]};});_0x4fa390[_0x16f2('0x30')]=_[_0x16f2('0x2b')](_0x4de5e6,_0x16f2('0x29'));_0x4fa390[_0x16f2('0x31')]=_[_0x16f2('0x32')](_0x496726[_0x16f2('0x31')]);_0x4fa390[_0x16f2('0x33')]=_[_0x16f2('0x34')](_0x4fa390[_0x16f2('0x30')],_0x4fa390['query']);_0x11d13c[_0x16f2('0x35')]=_[_0x16f2('0x34')](_0x4fa390[_0x16f2('0x30')],qs[_0x16f2('0x36')](_0x496726['query'][_0x16f2('0x36')]));_0x11d13c['attributes']=_0x11d13c[_0x16f2('0x35')][_0x16f2('0x37')]?_0x11d13c[_0x16f2('0x35')]:_0x4fa390['model'];if(!_0x496726['query'][_0x16f2('0x38')](_0x16f2('0x39'))){_0x11d13c[_0x16f2('0x1e')]=qs['limit'](_0x496726['query']['limit']);_0x11d13c[_0x16f2('0x1f')]=qs[_0x16f2('0x1f')](_0x496726[_0x16f2('0x31')][_0x16f2('0x1f')]);}_0x11d13c[_0x16f2('0x3a')]=qs[_0x16f2('0x3b')](_0x496726[_0x16f2('0x31')][_0x16f2('0x3b')]);_0x11d13c[_0x16f2('0x3c')]=qs['filters'](_[_0x16f2('0x3d')](_0x496726[_0x16f2('0x31')],_0x4fa390['filters']),_0x4de5e6);if(_0x496726['query']['filter']){_0x11d13c[_0x16f2('0x3c')]=_[_0x16f2('0x3e')](_0x11d13c['where'],{'$or':_[_0x16f2('0x2b')](_0x4de5e6,function(_0x476785){if(_0x476785[_0x16f2('0x2e')]!==_0x16f2('0x3f')){var _0x578285={};_0x578285[_0x476785[_0x16f2('0x29')]]={'$like':'%'+_0x496726[_0x16f2('0x31')][_0x16f2('0x40')]+'%'};return _0x578285;}})});}_0x11d13c=_[_0x16f2('0x3e')]({},_0x11d13c,_0x496726[_0x16f2('0x41')]);var _0x2d3bd5={'where':_0x11d13c[_0x16f2('0x3c')]};return db[_0x16f2('0x2c')][_0x16f2('0x20')](_0x2d3bd5)[_0x16f2('0x26')](function(_0x19c24e){_0x3d646b[_0x16f2('0x20')]=_0x19c24e;if(_0x496726[_0x16f2('0x31')][_0x16f2('0x42')]){_0x11d13c[_0x16f2('0x43')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x16f2('0x44')](_0x11d13c);})['then'](function(_0x39b135){_0x3d646b[_0x16f2('0x45')]=_0x39b135;return _0x3d646b;})[_0x16f2('0x26')](respondWithFilteredResult(_0x32bc0d,_0x11d13c))[_0x16f2('0x46')](handleError(_0x32bc0d,null));};exports['show']=function(_0x2164bc,_0x81a681){var _0x316512={'raw':![],'where':{'id':_0x2164bc[_0x16f2('0x47')]['id']}},_0x4974f0={};_0x4974f0[_0x16f2('0x30')]=_[_0x16f2('0x32')](db['VtigerConfiguration'][_0x16f2('0x48')]);_0x4974f0[_0x16f2('0x31')]=_[_0x16f2('0x32')](_0x2164bc[_0x16f2('0x31')]);_0x4974f0[_0x16f2('0x33')]=_[_0x16f2('0x34')](_0x4974f0[_0x16f2('0x30')],_0x4974f0['query']);_0x316512['attributes']=_[_0x16f2('0x34')](_0x4974f0['model'],qs[_0x16f2('0x36')](_0x2164bc[_0x16f2('0x31')][_0x16f2('0x36')]));_0x316512[_0x16f2('0x35')]=_0x316512[_0x16f2('0x35')][_0x16f2('0x37')]?_0x316512[_0x16f2('0x35')]:_0x4974f0[_0x16f2('0x30')];if(_0x2164bc[_0x16f2('0x31')][_0x16f2('0x42')]){_0x316512[_0x16f2('0x43')]=[{'all':!![]}];}_0x316512=_[_0x16f2('0x3e')]({},_0x316512,_0x2164bc[_0x16f2('0x41')]);return db['VtigerConfiguration'][_0x16f2('0x49')](_0x316512)[_0x16f2('0x26')](handleEntityNotFound(_0x81a681,null))[_0x16f2('0x26')](respondWithResult(_0x81a681,null))[_0x16f2('0x46')](handleError(_0x81a681,null));};exports['create']=function(_0x1403fe,_0x2829ab){return db['VtigerConfiguration'][_0x16f2('0x4a')](_0x1403fe[_0x16f2('0x4b')],{})['then'](respondWithResult(_0x2829ab,0xc9))[_0x16f2('0x46')](handleError(_0x2829ab,null));};exports[_0x16f2('0x24')]=function(_0x303328,_0x447838){if(_0x303328['body']['id']){delete _0x303328['body']['id'];}return db[_0x16f2('0x2c')][_0x16f2('0x49')]({'where':{'id':_0x303328[_0x16f2('0x47')]['id']}})[_0x16f2('0x26')](handleEntityNotFound(_0x447838,null))[_0x16f2('0x26')](saveUpdates(_0x303328[_0x16f2('0x4b')],null))[_0x16f2('0x26')](respondWithResult(_0x447838,null))[_0x16f2('0x46')](handleError(_0x447838,null));};exports[_0x16f2('0x25')]=function(_0x2a562c,_0x283ae0){return db[_0x16f2('0x2c')][_0x16f2('0x49')]({'where':{'id':_0x2a562c[_0x16f2('0x47')]['id']}})[_0x16f2('0x26')](handleEntityNotFound(_0x283ae0,null))[_0x16f2('0x26')](removeEntity(_0x283ae0,null))[_0x16f2('0x46')](handleError(_0x283ae0,null));};exports[_0x16f2('0x4c')]=function(_0x36589b,_0x5d103e,_0x39fe14){var _0x347dc2={};var _0x2b1fb0={};var _0x23cdd1;var _0x54b4e6;return db[_0x16f2('0x2c')]['findOne']({'where':{'id':_0x36589b['params']['id']}})[_0x16f2('0x26')](handleEntityNotFound(_0x5d103e,null))[_0x16f2('0x26')](function(_0xba6303){if(_0xba6303){_0x23cdd1=_0xba6303;_0x2b1fb0[_0x16f2('0x30')]=_[_0x16f2('0x32')](db[_0x16f2('0x4d')]['rawAttributes']);_0x2b1fb0['query']=_['keys'](_0x36589b['query']);_0x2b1fb0[_0x16f2('0x33')]=_[_0x16f2('0x34')](_0x2b1fb0[_0x16f2('0x30')],_0x2b1fb0[_0x16f2('0x31')]);_0x347dc2[_0x16f2('0x35')]=_[_0x16f2('0x34')](_0x2b1fb0[_0x16f2('0x30')],qs[_0x16f2('0x36')](_0x36589b['query'][_0x16f2('0x36')]));_0x347dc2['attributes']=_0x347dc2[_0x16f2('0x35')][_0x16f2('0x37')]?_0x347dc2[_0x16f2('0x35')]:_0x2b1fb0['model'];_0x347dc2[_0x16f2('0x3a')]=qs[_0x16f2('0x3b')](_0x36589b[_0x16f2('0x31')][_0x16f2('0x3b')]);_0x347dc2[_0x16f2('0x3c')]=qs[_0x16f2('0x33')](_[_0x16f2('0x3d')](_0x36589b[_0x16f2('0x31')],_0x2b1fb0['filters']));if(_0x36589b[_0x16f2('0x31')][_0x16f2('0x40')]){_0x347dc2['where']=_[_0x16f2('0x3e')](_0x347dc2[_0x16f2('0x3c')],{'$or':_[_0x16f2('0x2b')](_0x347dc2['attributes'],function(_0x5ee66d){var _0x4a48be={};_0x4a48be[_0x5ee66d]={'$like':'%'+_0x36589b[_0x16f2('0x31')]['filter']+'%'};return _0x4a48be;})});}_0x347dc2=_['merge']({},_0x347dc2,_0x36589b[_0x16f2('0x41')]);return _0x23cdd1['getFields'](_0x347dc2);}})[_0x16f2('0x26')](function(_0x5b5980){if(_0x5b5980){_0x54b4e6=_0x5b5980[_0x16f2('0x37')];if(!_0x36589b[_0x16f2('0x31')][_0x16f2('0x38')](_0x16f2('0x39'))){_0x347dc2['limit']=qs[_0x16f2('0x1e')](_0x36589b[_0x16f2('0x31')]['limit']);_0x347dc2['offset']=qs['offset'](_0x36589b[_0x16f2('0x31')][_0x16f2('0x1f')]);}return _0x23cdd1[_0x16f2('0x4c')](_0x347dc2);}})[_0x16f2('0x26')](function(_0x5a5580){if(_0x5a5580){return _0x5a5580?{'count':_0x54b4e6,'rows':_0x5a5580}:null;}})[_0x16f2('0x26')](respondWithResult(_0x5d103e,null))[_0x16f2('0x46')](handleError(_0x5d103e,null));};exports[_0x16f2('0x4e')]=function(_0x4236b5,_0xc44975,_0x46a054){var _0x21b4cf={};var _0x1ed3c8={};var _0x3e1d1f;var _0x5d09c2;return db[_0x16f2('0x2c')][_0x16f2('0x4f')]({'where':{'id':_0x4236b5['params']['id']}})[_0x16f2('0x26')](handleEntityNotFound(_0xc44975,null))[_0x16f2('0x26')](function(_0x53f8ab){if(_0x53f8ab){_0x3e1d1f=_0x53f8ab;_0x1ed3c8[_0x16f2('0x30')]=_['keys'](db[_0x16f2('0x4d')][_0x16f2('0x48')]);_0x1ed3c8[_0x16f2('0x31')]=_[_0x16f2('0x32')](_0x4236b5[_0x16f2('0x31')]);_0x1ed3c8['filters']=_[_0x16f2('0x34')](_0x1ed3c8[_0x16f2('0x30')],_0x1ed3c8['query']);_0x21b4cf['attributes']=_[_0x16f2('0x34')](_0x1ed3c8['model'],qs[_0x16f2('0x36')](_0x4236b5[_0x16f2('0x31')][_0x16f2('0x36')]));_0x21b4cf['attributes']=_0x21b4cf['attributes'][_0x16f2('0x37')]?_0x21b4cf[_0x16f2('0x35')]:_0x1ed3c8[_0x16f2('0x30')];_0x21b4cf[_0x16f2('0x3a')]=qs[_0x16f2('0x3b')](_0x4236b5['query'][_0x16f2('0x3b')]);_0x21b4cf[_0x16f2('0x3c')]=qs['filters'](_[_0x16f2('0x3d')](_0x4236b5['query'],_0x1ed3c8[_0x16f2('0x33')]));if(_0x4236b5[_0x16f2('0x31')][_0x16f2('0x40')]){_0x21b4cf[_0x16f2('0x3c')]=_[_0x16f2('0x3e')](_0x21b4cf[_0x16f2('0x3c')],{'$or':_[_0x16f2('0x2b')](_0x21b4cf[_0x16f2('0x35')],function(_0x51cbeb){var _0x1f2112={};_0x1f2112[_0x51cbeb]={'$like':'%'+_0x4236b5[_0x16f2('0x31')]['filter']+'%'};return _0x1f2112;})});}_0x21b4cf=_[_0x16f2('0x3e')]({},_0x21b4cf,_0x4236b5['options']);return _0x3e1d1f['getSubjects'](_0x21b4cf);}})[_0x16f2('0x26')](function(_0xe36f48){if(_0xe36f48){_0x5d09c2=_0xe36f48[_0x16f2('0x37')];if(!_0x4236b5[_0x16f2('0x31')][_0x16f2('0x38')](_0x16f2('0x39'))){_0x21b4cf[_0x16f2('0x1e')]=qs[_0x16f2('0x1e')](_0x4236b5['query']['limit']);_0x21b4cf[_0x16f2('0x1f')]=qs[_0x16f2('0x1f')](_0x4236b5[_0x16f2('0x31')][_0x16f2('0x1f')]);}return _0x3e1d1f[_0x16f2('0x4e')](_0x21b4cf);}})[_0x16f2('0x26')](function(_0x20fb51){if(_0x20fb51){return _0x20fb51?{'count':_0x5d09c2,'rows':_0x20fb51}:null;}})['then'](respondWithResult(_0xc44975,null))[_0x16f2('0x46')](handleError(_0xc44975,null));};exports[_0x16f2('0x50')]=function(_0x35ffdf,_0x5be2ba,_0x51c22b){var _0x46166b={};var _0x4c11b6={};var _0x1cb909;var _0x5b5eab;return db[_0x16f2('0x2c')][_0x16f2('0x4f')]({'where':{'id':_0x35ffdf[_0x16f2('0x47')]['id']}})[_0x16f2('0x26')](handleEntityNotFound(_0x5be2ba,null))[_0x16f2('0x26')](function(_0x34a180){if(_0x34a180){_0x1cb909=_0x34a180;_0x4c11b6[_0x16f2('0x30')]=_['keys'](db['VtigerField'][_0x16f2('0x48')]);_0x4c11b6[_0x16f2('0x31')]=_[_0x16f2('0x32')](_0x35ffdf[_0x16f2('0x31')]);_0x4c11b6[_0x16f2('0x33')]=_[_0x16f2('0x34')](_0x4c11b6[_0x16f2('0x30')],_0x4c11b6['query']);_0x46166b[_0x16f2('0x35')]=_[_0x16f2('0x34')](_0x4c11b6[_0x16f2('0x30')],qs['fields'](_0x35ffdf[_0x16f2('0x31')][_0x16f2('0x36')]));_0x46166b[_0x16f2('0x35')]=_0x46166b[_0x16f2('0x35')][_0x16f2('0x37')]?_0x46166b[_0x16f2('0x35')]:_0x4c11b6[_0x16f2('0x30')];_0x46166b['order']=qs[_0x16f2('0x3b')](_0x35ffdf[_0x16f2('0x31')][_0x16f2('0x3b')]);_0x46166b[_0x16f2('0x3c')]=qs[_0x16f2('0x33')](_[_0x16f2('0x3d')](_0x35ffdf[_0x16f2('0x31')],_0x4c11b6[_0x16f2('0x33')]));if(_0x35ffdf['query'][_0x16f2('0x40')]){_0x46166b[_0x16f2('0x3c')]=_[_0x16f2('0x3e')](_0x46166b[_0x16f2('0x3c')],{'$or':_[_0x16f2('0x2b')](_0x46166b['attributes'],function(_0xffeaa6){var _0x1ddecb={};_0x1ddecb[_0xffeaa6]={'$like':'%'+_0x35ffdf[_0x16f2('0x31')]['filter']+'%'};return _0x1ddecb;})});}_0x46166b=_[_0x16f2('0x3e')]({},_0x46166b,_0x35ffdf[_0x16f2('0x41')]);return _0x1cb909[_0x16f2('0x50')](_0x46166b);}})[_0x16f2('0x26')](function(_0x4709f6){if(_0x4709f6){_0x5b5eab=_0x4709f6[_0x16f2('0x37')];if(!_0x35ffdf[_0x16f2('0x31')]['hasOwnProperty'](_0x16f2('0x39'))){_0x46166b[_0x16f2('0x1e')]=qs['limit'](_0x35ffdf[_0x16f2('0x31')]['limit']);_0x46166b[_0x16f2('0x1f')]=qs[_0x16f2('0x1f')](_0x35ffdf['query'][_0x16f2('0x1f')]);}return _0x1cb909['getDescriptions'](_0x46166b);}})['then'](function(_0x3715b1){if(_0x3715b1){return _0x3715b1?{'count':_0x5b5eab,'rows':_0x3715b1}:null;}})[_0x16f2('0x26')](respondWithResult(_0x5be2ba,null))[_0x16f2('0x46')](handleError(_0x5be2ba,null));}; \ No newline at end of file +var _0xdeb3=['getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','VtigerConfiguration','count','includeAll','rows','catch','show','keys','include','find','create','body','params','getFields','findOne','VtigerField','pick','getSubjects'];(function(_0x22431e,_0x5af0a3){var _0xd978e9=function(_0x2bbdd7){while(--_0x2bbdd7){_0x22431e['push'](_0x22431e['shift']());}};_0xd978e9(++_0x5af0a3);}(_0xdeb3,0xeb));var _0x3deb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdeb3[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x3deb('0x0'));var rimraf=require(_0x3deb('0x1'));var zipdir=require(_0x3deb('0x2'));var jsonpatch=require(_0x3deb('0x3'));var rp=require(_0x3deb('0x4'));var moment=require(_0x3deb('0x5'));var BPromise=require(_0x3deb('0x6'));var Mustache=require(_0x3deb('0x7'));var util=require(_0x3deb('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3deb('0x9'));var fs=require('fs');var fs_extra=require(_0x3deb('0xa'));var _=require(_0x3deb('0xb'));var squel=require(_0x3deb('0xc'));var crypto=require(_0x3deb('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3deb('0xe'));var querystring=require(_0x3deb('0xf'));var Papa=require(_0x3deb('0x10'));var Redis=require(_0x3deb('0x11'));var authService=require(_0x3deb('0x12'));var qs=require(_0x3deb('0x13'));var as=require(_0x3deb('0x14'));var hardwareService=require(_0x3deb('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3deb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3deb('0x17'))['db'];function respondWithStatusCode(_0x21f596,_0x78aa81){_0x78aa81=_0x78aa81||0xcc;return function(_0x1055dc){if(_0x1055dc){return _0x21f596['sendStatus'](_0x78aa81);}return _0x21f596[_0x3deb('0x18')](_0x78aa81)[_0x3deb('0x19')]();};}function respondWithResult(_0x1a651d,_0x228e23){_0x228e23=_0x228e23||0xc8;return function(_0x329f3a){if(_0x329f3a){return _0x1a651d[_0x3deb('0x18')](_0x228e23)[_0x3deb('0x1a')](_0x329f3a);}};}function respondWithFilteredResult(_0xa25716,_0x4a291e){return function(_0x428f90){if(_0x428f90){var _0xa45605=typeof _0x4a291e['offset']===_0x3deb('0x1b')&&typeof _0x4a291e[_0x3deb('0x1c')]==='undefined';var _0x5cd9db=_0x428f90['count'];var _0x2a8ec4=_0xa45605?0x0:_0x4a291e[_0x3deb('0x1d')];var _0x4adbaa=_0xa45605?_0x428f90['count']:_0x4a291e[_0x3deb('0x1d')]+_0x4a291e[_0x3deb('0x1c')];var _0xb6be32;if(_0x4adbaa>=_0x5cd9db){_0x4adbaa=_0x5cd9db;_0xb6be32=0xc8;}else{_0xb6be32=0xce;}_0xa25716[_0x3deb('0x18')](_0xb6be32);return _0xa25716['set'](_0x3deb('0x1e'),_0x2a8ec4+'-'+_0x4adbaa+'/'+_0x5cd9db)[_0x3deb('0x1a')](_0x428f90);}return null;};}function patchUpdates(_0xbd82de){return function(_0x4ceab2){try{jsonpatch[_0x3deb('0x1f')](_0x4ceab2,_0xbd82de,!![]);}catch(_0x144671){return BPromise[_0x3deb('0x20')](_0x144671);}return _0x4ceab2[_0x3deb('0x21')]();};}function saveUpdates(_0x22ea80,_0x543014){return function(_0x35843b){if(_0x35843b){return _0x35843b[_0x3deb('0x22')](_0x22ea80)[_0x3deb('0x23')](function(_0x428869){return _0x428869;});}return null;};}function removeEntity(_0x12f415,_0x385e2a){return function(_0x3f3d52){if(_0x3f3d52){return _0x3f3d52[_0x3deb('0x24')]()['then'](function(){_0x12f415[_0x3deb('0x18')](0xcc)[_0x3deb('0x19')]();});}};}function handleEntityNotFound(_0x1aacbd,_0x427f9f){return function(_0x472a46){if(!_0x472a46){_0x1aacbd['sendStatus'](0x194);}return _0x472a46;};}function handleError(_0x1185dd,_0x225ea9){_0x225ea9=_0x225ea9||0x1f4;return function(_0x474878){logger[_0x3deb('0x25')](_0x474878[_0x3deb('0x26')]);if(_0x474878[_0x3deb('0x27')]){delete _0x474878[_0x3deb('0x27')];}_0x1185dd['status'](_0x225ea9)['send'](_0x474878);};}exports[_0x3deb('0x28')]=function(_0x520f24,_0x2efb59){var _0x28a4ca={},_0x2bd20f={},_0x492ca0={'count':0x0,'rows':[]};var _0x460512=_['map'](db['VtigerConfiguration'][_0x3deb('0x29')],function(_0x205c22){return{'name':_0x205c22[_0x3deb('0x2a')],'type':_0x205c22[_0x3deb('0x2b')]['key']};});_0x2bd20f['model']=_[_0x3deb('0x2c')](_0x460512,_0x3deb('0x27'));_0x2bd20f['query']=_['keys'](_0x520f24[_0x3deb('0x2d')]);_0x2bd20f[_0x3deb('0x2e')]=_[_0x3deb('0x2f')](_0x2bd20f['model'],_0x2bd20f[_0x3deb('0x2d')]);_0x28a4ca['attributes']=_[_0x3deb('0x2f')](_0x2bd20f[_0x3deb('0x30')],qs[_0x3deb('0x31')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x31')]));_0x28a4ca[_0x3deb('0x32')]=_0x28a4ca[_0x3deb('0x32')][_0x3deb('0x33')]?_0x28a4ca[_0x3deb('0x32')]:_0x2bd20f[_0x3deb('0x30')];if(!_0x520f24['query'][_0x3deb('0x34')](_0x3deb('0x35'))){_0x28a4ca[_0x3deb('0x1c')]=qs[_0x3deb('0x1c')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x1c')]);_0x28a4ca[_0x3deb('0x1d')]=qs[_0x3deb('0x1d')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x1d')]);}_0x28a4ca[_0x3deb('0x36')]=qs[_0x3deb('0x37')](_0x520f24[_0x3deb('0x2d')][_0x3deb('0x37')]);_0x28a4ca[_0x3deb('0x38')]=qs[_0x3deb('0x2e')](_['pick'](_0x520f24['query'],_0x2bd20f[_0x3deb('0x2e')]),_0x460512);if(_0x520f24[_0x3deb('0x2d')][_0x3deb('0x39')]){_0x28a4ca['where']=_[_0x3deb('0x3a')](_0x28a4ca['where'],{'$or':_[_0x3deb('0x2c')](_0x460512,function(_0x53525c){if(_0x53525c[_0x3deb('0x2b')]!=='VIRTUAL'){var _0x3103c5={};_0x3103c5[_0x53525c[_0x3deb('0x27')]]={'$like':'%'+_0x520f24[_0x3deb('0x2d')][_0x3deb('0x39')]+'%'};return _0x3103c5;}})});}_0x28a4ca=_['merge']({},_0x28a4ca,_0x520f24[_0x3deb('0x3b')]);var _0x53fdef={'where':_0x28a4ca[_0x3deb('0x38')]};return db[_0x3deb('0x3c')][_0x3deb('0x3d')](_0x53fdef)[_0x3deb('0x23')](function(_0x3c9310){_0x492ca0[_0x3deb('0x3d')]=_0x3c9310;if(_0x520f24[_0x3deb('0x2d')][_0x3deb('0x3e')]){_0x28a4ca['include']=[{'all':!![]}];}return db[_0x3deb('0x3c')]['findAll'](_0x28a4ca);})['then'](function(_0x5bbbfa){_0x492ca0[_0x3deb('0x3f')]=_0x5bbbfa;return _0x492ca0;})[_0x3deb('0x23')](respondWithFilteredResult(_0x2efb59,_0x28a4ca))[_0x3deb('0x40')](handleError(_0x2efb59,null));};exports[_0x3deb('0x41')]=function(_0x27a64e,_0x7e7374){var _0x2e2c03={'raw':![],'where':{'id':_0x27a64e['params']['id']}},_0x4eed4a={};_0x4eed4a[_0x3deb('0x30')]=_[_0x3deb('0x42')](db[_0x3deb('0x3c')][_0x3deb('0x29')]);_0x4eed4a[_0x3deb('0x2d')]=_['keys'](_0x27a64e[_0x3deb('0x2d')]);_0x4eed4a[_0x3deb('0x2e')]=_[_0x3deb('0x2f')](_0x4eed4a['model'],_0x4eed4a[_0x3deb('0x2d')]);_0x2e2c03[_0x3deb('0x32')]=_[_0x3deb('0x2f')](_0x4eed4a[_0x3deb('0x30')],qs[_0x3deb('0x31')](_0x27a64e['query'][_0x3deb('0x31')]));_0x2e2c03[_0x3deb('0x32')]=_0x2e2c03[_0x3deb('0x32')]['length']?_0x2e2c03['attributes']:_0x4eed4a[_0x3deb('0x30')];if(_0x27a64e[_0x3deb('0x2d')][_0x3deb('0x3e')]){_0x2e2c03[_0x3deb('0x43')]=[{'all':!![]}];}_0x2e2c03=_[_0x3deb('0x3a')]({},_0x2e2c03,_0x27a64e['options']);return db[_0x3deb('0x3c')][_0x3deb('0x44')](_0x2e2c03)[_0x3deb('0x23')](handleEntityNotFound(_0x7e7374,null))[_0x3deb('0x23')](respondWithResult(_0x7e7374,null))[_0x3deb('0x40')](handleError(_0x7e7374,null));};exports[_0x3deb('0x45')]=function(_0x524ac8,_0x384788){return db[_0x3deb('0x3c')]['create'](_0x524ac8[_0x3deb('0x46')],{})[_0x3deb('0x23')](respondWithResult(_0x384788,0xc9))[_0x3deb('0x40')](handleError(_0x384788,null));};exports[_0x3deb('0x22')]=function(_0x448505,_0x4b3cd6){if(_0x448505[_0x3deb('0x46')]['id']){delete _0x448505[_0x3deb('0x46')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x448505['params']['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x4b3cd6,null))[_0x3deb('0x23')](saveUpdates(_0x448505['body'],null))['then'](respondWithResult(_0x4b3cd6,null))[_0x3deb('0x40')](handleError(_0x4b3cd6,null));};exports[_0x3deb('0x24')]=function(_0x8aabc0,_0x3b4688){return db['VtigerConfiguration'][_0x3deb('0x44')]({'where':{'id':_0x8aabc0[_0x3deb('0x47')]['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x3b4688,null))[_0x3deb('0x23')](removeEntity(_0x3b4688,null))[_0x3deb('0x40')](handleError(_0x3b4688,null));};exports[_0x3deb('0x48')]=function(_0x19a1d7,_0x662ee6,_0x5099ee){var _0x4e1fb8={};var _0x20adac={};var _0x375851;var _0x190a74;return db[_0x3deb('0x3c')][_0x3deb('0x49')]({'where':{'id':_0x19a1d7[_0x3deb('0x47')]['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x662ee6,null))[_0x3deb('0x23')](function(_0x2bc3ae){if(_0x2bc3ae){_0x375851=_0x2bc3ae;_0x20adac[_0x3deb('0x30')]=_[_0x3deb('0x42')](db[_0x3deb('0x4a')][_0x3deb('0x29')]);_0x20adac[_0x3deb('0x2d')]=_['keys'](_0x19a1d7['query']);_0x20adac[_0x3deb('0x2e')]=_['intersection'](_0x20adac['model'],_0x20adac[_0x3deb('0x2d')]);_0x4e1fb8[_0x3deb('0x32')]=_[_0x3deb('0x2f')](_0x20adac[_0x3deb('0x30')],qs['fields'](_0x19a1d7[_0x3deb('0x2d')][_0x3deb('0x31')]));_0x4e1fb8[_0x3deb('0x32')]=_0x4e1fb8[_0x3deb('0x32')][_0x3deb('0x33')]?_0x4e1fb8[_0x3deb('0x32')]:_0x20adac[_0x3deb('0x30')];_0x4e1fb8[_0x3deb('0x36')]=qs[_0x3deb('0x37')](_0x19a1d7[_0x3deb('0x2d')][_0x3deb('0x37')]);_0x4e1fb8[_0x3deb('0x38')]=qs[_0x3deb('0x2e')](_[_0x3deb('0x4b')](_0x19a1d7[_0x3deb('0x2d')],_0x20adac[_0x3deb('0x2e')]));if(_0x19a1d7['query'][_0x3deb('0x39')]){_0x4e1fb8[_0x3deb('0x38')]=_[_0x3deb('0x3a')](_0x4e1fb8[_0x3deb('0x38')],{'$or':_[_0x3deb('0x2c')](_0x4e1fb8['attributes'],function(_0x3299e0){var _0x5084da={};_0x5084da[_0x3299e0]={'$like':'%'+_0x19a1d7[_0x3deb('0x2d')][_0x3deb('0x39')]+'%'};return _0x5084da;})});}_0x4e1fb8=_[_0x3deb('0x3a')]({},_0x4e1fb8,_0x19a1d7[_0x3deb('0x3b')]);return _0x375851[_0x3deb('0x48')](_0x4e1fb8);}})[_0x3deb('0x23')](function(_0x4efd88){if(_0x4efd88){_0x190a74=_0x4efd88[_0x3deb('0x33')];if(!_0x19a1d7[_0x3deb('0x2d')][_0x3deb('0x34')](_0x3deb('0x35'))){_0x4e1fb8[_0x3deb('0x1c')]=qs[_0x3deb('0x1c')](_0x19a1d7[_0x3deb('0x2d')][_0x3deb('0x1c')]);_0x4e1fb8[_0x3deb('0x1d')]=qs[_0x3deb('0x1d')](_0x19a1d7[_0x3deb('0x2d')][_0x3deb('0x1d')]);}return _0x375851['getFields'](_0x4e1fb8);}})['then'](function(_0x15dcf1){if(_0x15dcf1){return _0x15dcf1?{'count':_0x190a74,'rows':_0x15dcf1}:null;}})[_0x3deb('0x23')](respondWithResult(_0x662ee6,null))[_0x3deb('0x40')](handleError(_0x662ee6,null));};exports[_0x3deb('0x4c')]=function(_0x13e29a,_0x462061,_0x4a9417){var _0x2723e4={};var _0x50575a={};var _0xc6c09f;var _0x2cefd9;return db[_0x3deb('0x3c')][_0x3deb('0x49')]({'where':{'id':_0x13e29a[_0x3deb('0x47')]['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x462061,null))['then'](function(_0xaaab6f){if(_0xaaab6f){_0xc6c09f=_0xaaab6f;_0x50575a[_0x3deb('0x30')]=_[_0x3deb('0x42')](db[_0x3deb('0x4a')][_0x3deb('0x29')]);_0x50575a[_0x3deb('0x2d')]=_[_0x3deb('0x42')](_0x13e29a['query']);_0x50575a[_0x3deb('0x2e')]=_[_0x3deb('0x2f')](_0x50575a[_0x3deb('0x30')],_0x50575a[_0x3deb('0x2d')]);_0x2723e4[_0x3deb('0x32')]=_['intersection'](_0x50575a[_0x3deb('0x30')],qs[_0x3deb('0x31')](_0x13e29a[_0x3deb('0x2d')][_0x3deb('0x31')]));_0x2723e4[_0x3deb('0x32')]=_0x2723e4[_0x3deb('0x32')][_0x3deb('0x33')]?_0x2723e4[_0x3deb('0x32')]:_0x50575a[_0x3deb('0x30')];_0x2723e4[_0x3deb('0x36')]=qs[_0x3deb('0x37')](_0x13e29a[_0x3deb('0x2d')][_0x3deb('0x37')]);_0x2723e4['where']=qs[_0x3deb('0x2e')](_[_0x3deb('0x4b')](_0x13e29a[_0x3deb('0x2d')],_0x50575a[_0x3deb('0x2e')]));if(_0x13e29a[_0x3deb('0x2d')][_0x3deb('0x39')]){_0x2723e4[_0x3deb('0x38')]=_['merge'](_0x2723e4[_0x3deb('0x38')],{'$or':_[_0x3deb('0x2c')](_0x2723e4[_0x3deb('0x32')],function(_0x9a07b5){var _0x454d2e={};_0x454d2e[_0x9a07b5]={'$like':'%'+_0x13e29a[_0x3deb('0x2d')][_0x3deb('0x39')]+'%'};return _0x454d2e;})});}_0x2723e4=_[_0x3deb('0x3a')]({},_0x2723e4,_0x13e29a[_0x3deb('0x3b')]);return _0xc6c09f[_0x3deb('0x4c')](_0x2723e4);}})[_0x3deb('0x23')](function(_0x4a7067){if(_0x4a7067){_0x2cefd9=_0x4a7067[_0x3deb('0x33')];if(!_0x13e29a[_0x3deb('0x2d')]['hasOwnProperty'](_0x3deb('0x35'))){_0x2723e4[_0x3deb('0x1c')]=qs[_0x3deb('0x1c')](_0x13e29a['query'][_0x3deb('0x1c')]);_0x2723e4['offset']=qs['offset'](_0x13e29a[_0x3deb('0x2d')]['offset']);}return _0xc6c09f[_0x3deb('0x4c')](_0x2723e4);}})[_0x3deb('0x23')](function(_0x4f6105){if(_0x4f6105){return _0x4f6105?{'count':_0x2cefd9,'rows':_0x4f6105}:null;}})['then'](respondWithResult(_0x462061,null))[_0x3deb('0x40')](handleError(_0x462061,null));};exports['getDescriptions']=function(_0x3bebe6,_0x30bc5b,_0xd399e2){var _0x1f03b4={};var _0x5acd2a={};var _0x27fc7e;var _0x2469b6;return db[_0x3deb('0x3c')][_0x3deb('0x49')]({'where':{'id':_0x3bebe6[_0x3deb('0x47')]['id']}})[_0x3deb('0x23')](handleEntityNotFound(_0x30bc5b,null))[_0x3deb('0x23')](function(_0x4bceef){if(_0x4bceef){_0x27fc7e=_0x4bceef;_0x5acd2a[_0x3deb('0x30')]=_['keys'](db[_0x3deb('0x4a')][_0x3deb('0x29')]);_0x5acd2a[_0x3deb('0x2d')]=_[_0x3deb('0x42')](_0x3bebe6[_0x3deb('0x2d')]);_0x5acd2a[_0x3deb('0x2e')]=_['intersection'](_0x5acd2a[_0x3deb('0x30')],_0x5acd2a[_0x3deb('0x2d')]);_0x1f03b4[_0x3deb('0x32')]=_[_0x3deb('0x2f')](_0x5acd2a['model'],qs['fields'](_0x3bebe6['query']['fields']));_0x1f03b4['attributes']=_0x1f03b4[_0x3deb('0x32')][_0x3deb('0x33')]?_0x1f03b4[_0x3deb('0x32')]:_0x5acd2a[_0x3deb('0x30')];_0x1f03b4['order']=qs[_0x3deb('0x37')](_0x3bebe6[_0x3deb('0x2d')][_0x3deb('0x37')]);_0x1f03b4[_0x3deb('0x38')]=qs[_0x3deb('0x2e')](_['pick'](_0x3bebe6[_0x3deb('0x2d')],_0x5acd2a['filters']));if(_0x3bebe6[_0x3deb('0x2d')][_0x3deb('0x39')]){_0x1f03b4[_0x3deb('0x38')]=_[_0x3deb('0x3a')](_0x1f03b4[_0x3deb('0x38')],{'$or':_[_0x3deb('0x2c')](_0x1f03b4[_0x3deb('0x32')],function(_0x2abaec){var _0x2ca178={};_0x2ca178[_0x2abaec]={'$like':'%'+_0x3bebe6[_0x3deb('0x2d')][_0x3deb('0x39')]+'%'};return _0x2ca178;})});}_0x1f03b4=_[_0x3deb('0x3a')]({},_0x1f03b4,_0x3bebe6[_0x3deb('0x3b')]);return _0x27fc7e[_0x3deb('0x4d')](_0x1f03b4);}})['then'](function(_0x26cd49){if(_0x26cd49){_0x2469b6=_0x26cd49[_0x3deb('0x33')];if(!_0x3bebe6[_0x3deb('0x2d')]['hasOwnProperty'](_0x3deb('0x35'))){_0x1f03b4[_0x3deb('0x1c')]=qs[_0x3deb('0x1c')](_0x3bebe6['query']['limit']);_0x1f03b4[_0x3deb('0x1d')]=qs[_0x3deb('0x1d')](_0x3bebe6[_0x3deb('0x2d')][_0x3deb('0x1d')]);}return _0x27fc7e[_0x3deb('0x4d')](_0x1f03b4);}})[_0x3deb('0x23')](function(_0x5716f1){if(_0x5716f1){return _0x5716f1?{'count':_0x2469b6,'rows':_0x5716f1}:null;}})[_0x3deb('0x23')](respondWithResult(_0x30bc5b,null))[_0x3deb('0x40')](handleError(_0x30bc5b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index ee28433..c5162fd 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 _0xaf20=['VtigerConfiguration','util','../../config/logger','request-promise','exports','define'];(function(_0x4ef03f,_0x244690){var _0x5dad87=function(_0x1bbd04){while(--_0x1bbd04){_0x4ef03f['push'](_0x4ef03f['shift']());}};_0x5dad87(++_0x244690);}(_0xaf20,0xc1));var _0x0af2=function(_0x207ab0,_0x47e070){_0x207ab0=_0x207ab0-0x0;var _0x45ef47=_0xaf20[_0x207ab0];return _0x45ef47;};'use strict';var _=require('lodash');var util=require(_0x0af2('0x0'));var logger=require(_0x0af2('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0af2('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x0af2('0x3')]=function(_0x2c4757,_0x4ad863){return _0x2c4757[_0x0af2('0x4')](_0x0af2('0x5'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a1e=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0xc051b2,_0x3d6d9d){var _0x599dc2=function(_0x235ded){while(--_0x235ded){_0xc051b2['push'](_0xc051b2['shift']());}};_0x599dc2(++_0x3d6d9d);}(_0x9a1e,0x144));var _0xe9a1=function(_0x3c25cd,_0x4c3fcb){_0x3c25cd=_0x3c25cd-0x0;var _0x149a64=_0x9a1e[_0x3c25cd];return _0x149a64;};'use strict';var _=require(_0xe9a1('0x0'));var util=require(_0xe9a1('0x1'));var logger=require(_0xe9a1('0x2'))('api');var moment=require(_0xe9a1('0x3'));var BPromise=require(_0xe9a1('0x4'));var rp=require(_0xe9a1('0x5'));var fs=require('fs');var path=require(_0xe9a1('0x6'));var rimraf=require(_0xe9a1('0x7'));var config=require(_0xe9a1('0x8'));var attributes=require(_0xe9a1('0x9'));module['exports']=function(_0x12fa17,_0xaa3aaa){return _0x12fa17[_0xe9a1('0xa')](_0xe9a1('0xb'),attributes,{'tableName':_0xe9a1('0xc'),'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 7ed02af..89fb6d9 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 _0x556c=['request','then','info','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x319411,_0x343204){var _0x46e533=function(_0x491dd1){while(--_0x491dd1){_0x319411['push'](_0x319411['shift']());}};_0x46e533(++_0x343204);}(_0x556c,0x129));var _0xc556=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x556c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc556('0x0'));var util=require(_0xc556('0x1'));var moment=require('moment');var BPromise=require(_0xc556('0x2'));var rs=require(_0xc556('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc556('0x4'))['db'];var utils=require(_0xc556('0x5'));var logger=require(_0xc556('0x6'))(_0xc556('0x7'));var config=require(_0xc556('0x8'));var jayson=require(_0xc556('0x9'));var client=jayson[_0xc556('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x441acb,_0x54e61f,_0x26cbf0){return new BPromise(function(_0xc057f4,_0x18fee3){return client[_0xc556('0xb')](_0x441acb,_0x26cbf0)[_0xc556('0xc')](function(_0x29605e){logger[_0xc556('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x54e61f,'request\x20sent');logger[_0xc556('0xe')](_0xc556('0xf'),_0x54e61f,_0xc556('0x10'),JSON['stringify'](_0x29605e));if(_0x29605e[_0xc556('0x11')]){if(_0x29605e['error'][_0xc556('0x12')]===0x1f4){logger[_0xc556('0x11')](_0xc556('0x13'),_0x54e61f,_0x29605e[_0xc556('0x11')][_0xc556('0x14')]);return _0x18fee3(_0x29605e['error'][_0xc556('0x14')]);}logger[_0xc556('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x54e61f,_0x29605e['error']['message']);return _0xc057f4(_0x29605e[_0xc556('0x11')][_0xc556('0x14')]);}else{logger[_0xc556('0xd')](_0xc556('0x13'),_0x54e61f,_0xc556('0x10'));_0xc057f4(_0x29605e[_0xc556('0x15')][_0xc556('0x14')]);}})['catch'](function(_0x5cb426){logger[_0xc556('0x11')](_0xc556('0x13'),_0x54e61f,_0x5cb426);_0x18fee3(_0x5cb426);});});} \ No newline at end of file +var _0xbaaa=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','error','code','message','request\x20sent','lodash','util','bluebird','randomstring','ioredis'];(function(_0xe18ab7,_0x95a601){var _0x531ce5=function(_0x5ebb8b){while(--_0x5ebb8b){_0xe18ab7['push'](_0xe18ab7['shift']());}};_0x531ce5(++_0x95a601);}(_0xbaaa,0x1b3));var _0xabaa=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xbaaa[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xabaa('0x0'));var util=require(_0xabaa('0x1'));var moment=require('moment');var BPromise=require(_0xabaa('0x2'));var rs=require(_0xabaa('0x3'));var fs=require('fs');var Redis=require(_0xabaa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xabaa('0x5'));var logger=require('../../config/logger')(_0xabaa('0x6'));var config=require(_0xabaa('0x7'));var jayson=require(_0xabaa('0x8'));var client=jayson[_0xabaa('0x9')][_0xabaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d265d,_0x453d96,_0x497e0f){return new BPromise(function(_0x426188,_0x6df816){return client[_0xabaa('0xb')](_0x3d265d,_0x497e0f)[_0xabaa('0xc')](function(_0x3baec1){logger[_0xabaa('0xd')](_0xabaa('0xe'),_0x453d96,'request\x20sent');logger[_0xabaa('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x453d96,'request\x20sent',JSON['stringify'](_0x3baec1));if(_0x3baec1[_0xabaa('0x10')]){if(_0x3baec1[_0xabaa('0x10')][_0xabaa('0x11')]===0x1f4){logger[_0xabaa('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x453d96,_0x3baec1[_0xabaa('0x10')][_0xabaa('0x12')]);return _0x6df816(_0x3baec1[_0xabaa('0x10')]['message']);}logger[_0xabaa('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x453d96,_0x3baec1[_0xabaa('0x10')][_0xabaa('0x12')]);return _0x426188(_0x3baec1[_0xabaa('0x10')][_0xabaa('0x12')]);}else{logger[_0xabaa('0xd')](_0xabaa('0xe'),_0x453d96,_0xabaa('0x13'));_0x426188(_0x3baec1['result'][_0xabaa('0x12')]);}})['catch'](function(_0x581a75){logger['error'](_0xabaa('0xe'),_0x453d96,_0x581a75);_0x6df816(_0x581a75);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 6cd7478..a24970a 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 _0xcdd7=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','post','create','put','update','delete','/:id','destroy','exports','path'];(function(_0x8c4fbe,_0x5b4750){var _0xeec020=function(_0x54be08){while(--_0x54be08){_0x8c4fbe['push'](_0x8c4fbe['shift']());}};_0xeec020(++_0x5b4750);}(_0xcdd7,0x1af));var _0x7cdd=function(_0x32b8c7,_0x145648){_0x32b8c7=_0x32b8c7-0x0;var _0x4c4613=_0xcdd7[_0x32b8c7];return _0x4c4613;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7cdd('0x0'));var timeout=require(_0x7cdd('0x1'));var express=require('express');var router=express[_0x7cdd('0x2')]();var fs_extra=require(_0x7cdd('0x3'));var auth=require(_0x7cdd('0x4'));var interaction=require(_0x7cdd('0x5'));var config=require(_0x7cdd('0x6'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x7cdd('0x7')](),controller[_0x7cdd('0x8')]);router[_0x7cdd('0x9')]('/:id',auth[_0x7cdd('0x7')](),controller['show']);router[_0x7cdd('0xa')]('/',auth[_0x7cdd('0x7')](),controller[_0x7cdd('0xb')]);router[_0x7cdd('0xc')]('/:id',auth[_0x7cdd('0x7')](),controller[_0x7cdd('0xd')]);router[_0x7cdd('0xe')](_0x7cdd('0xf'),auth[_0x7cdd('0x7')](),controller[_0x7cdd('0x10')]);module[_0x7cdd('0x11')]=router; \ No newline at end of file +var _0x1c05=['update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x325149,_0x16196a){var _0x2e9ba1=function(_0x449a2f){while(--_0x449a2f){_0x325149['push'](_0x325149['shift']());}};_0x2e9ba1(++_0x16196a);}(_0x1c05,0x135));var _0x51c0=function(_0x4044b9,_0x396d74){_0x4044b9=_0x4044b9-0x0;var _0x323277=_0x1c05[_0x4044b9];return _0x323277;};'use strict';var multer=require(_0x51c0('0x0'));var util=require(_0x51c0('0x1'));var path=require(_0x51c0('0x2'));var timeout=require(_0x51c0('0x3'));var express=require('express');var router=express[_0x51c0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x51c0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x51c0('0x6')]('/',auth[_0x51c0('0x7')](),controller[_0x51c0('0x8')]);router[_0x51c0('0x6')]('/:id',auth[_0x51c0('0x7')](),controller[_0x51c0('0x9')]);router[_0x51c0('0xa')]('/',auth[_0x51c0('0x7')](),controller[_0x51c0('0xb')]);router[_0x51c0('0xc')](_0x51c0('0xd'),auth[_0x51c0('0x7')](),controller[_0x51c0('0xe')]);router[_0x51c0('0xf')](_0x51c0('0xd'),auth['isAuthenticated'](),controller[_0x51c0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 6e2710c..e4b32d6 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 _0xa3b8=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0xa3b8,0x14c));var _0x8a3b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa3b8[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x8a3b('0x0'));module[_0x8a3b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8a3b('0x2'),_0x8a3b('0x3'),_0x8a3b('0x4'),_0x8a3b('0x5'),_0x8a3b('0x6')),'defaultValue':_0x8a3b('0x2')},'content':{'type':Sequelize[_0x8a3b('0x7')]},'key':{'type':Sequelize[_0x8a3b('0x7')]},'keyType':{'type':Sequelize[_0x8a3b('0x8')](_0x8a3b('0x2'),'variable',_0x8a3b('0x4'))},'keyContent':{'type':Sequelize[_0x8a3b('0x7')]},'idField':{'type':Sequelize[_0x8a3b('0x7')]},'nameField':{'type':Sequelize[_0x8a3b('0x7')]},'customField':{'type':Sequelize[_0x8a3b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8a3b('0x7')]}}; \ No newline at end of file +var _0xadef=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x126c9d,_0x1bea95){var _0x25d1d1=function(_0x1b63b6){while(--_0x1b63b6){_0x126c9d['push'](_0x126c9d['shift']());}};_0x25d1d1(++_0x1bea95);}(_0xadef,0x1d0));var _0xfade=function(_0x2596d0,_0x5ee8ca){_0x2596d0=_0x2596d0-0x0;var _0x1f0533=_0xadef[_0x2596d0];return _0x1f0533;};'use strict';var Sequelize=require(_0xfade('0x0'));module[_0xfade('0x1')]={'type':{'type':Sequelize[_0xfade('0x2')](_0xfade('0x3'),_0xfade('0x4'),_0xfade('0x5'),_0xfade('0x6'),_0xfade('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfade('0x8')]},'key':{'type':Sequelize[_0xfade('0x8')]},'keyType':{'type':Sequelize[_0xfade('0x2')](_0xfade('0x3'),_0xfade('0x4'),_0xfade('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfade('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xfade('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index a9a24a1..fe1e661 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 _0xd31d=['merge','type','options','includeAll','include','VtigerField','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','set','apply','save','update','then','destroy','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','pick','filter','where'];(function(_0x4e0749,_0xd45ce4){var _0x509f65=function(_0x101de8){while(--_0x101de8){_0x4e0749['push'](_0x4e0749['shift']());}};_0x509f65(++_0xd45ce4);}(_0xd31d,0x92));var _0xdd31=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xd31d[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0xdd31('0x0'));var rimraf=require(_0xdd31('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdd31('0x2'));var BPromise=require(_0xdd31('0x3'));var Mustache=require('mustache');var util=require(_0xdd31('0x4'));var path=require(_0xdd31('0x5'));var sox=require(_0xdd31('0x6'));var csv=require(_0xdd31('0x7'));var ejs=require(_0xdd31('0x8'));var fs=require('fs');var fs_extra=require(_0xdd31('0x9'));var _=require(_0xdd31('0xa'));var squel=require(_0xdd31('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdd31('0xc'));var toCsv=require(_0xdd31('0x7'));var querystring=require(_0xdd31('0xd'));var Papa=require('papaparse');var Redis=require(_0xdd31('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdd31('0xf'));var as=require(_0xdd31('0x10'));var hardwareService=require(_0xdd31('0x11'));var logger=require('../../config/logger')(_0xdd31('0x12'));var utils=require('../../config/utils');var config=require(_0xdd31('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd31('0x14'))['db'];function respondWithStatusCode(_0x47527e,_0x2cad0f){_0x2cad0f=_0x2cad0f||0xcc;return function(_0xa3ebc9){if(_0xa3ebc9){return _0x47527e['sendStatus'](_0x2cad0f);}return _0x47527e[_0xdd31('0x15')](_0x2cad0f)[_0xdd31('0x16')]();};}function respondWithResult(_0x3f96ac,_0x922b8e){_0x922b8e=_0x922b8e||0xc8;return function(_0x217a1e){if(_0x217a1e){return _0x3f96ac['status'](_0x922b8e)[_0xdd31('0x17')](_0x217a1e);}};}function respondWithFilteredResult(_0x29030a,_0x190cf9){return function(_0x4e89b2){if(_0x4e89b2){var _0x39cdcc=typeof _0x190cf9[_0xdd31('0x18')]==='undefined'&&typeof _0x190cf9[_0xdd31('0x19')]==='undefined';var _0x3e6964=_0x4e89b2[_0xdd31('0x1a')];var _0x1e292e=_0x39cdcc?0x0:_0x190cf9['offset'];var _0x2cbd68=_0x39cdcc?_0x4e89b2[_0xdd31('0x1a')]:_0x190cf9['offset']+_0x190cf9[_0xdd31('0x19')];var _0x18e31d;if(_0x2cbd68>=_0x3e6964){_0x2cbd68=_0x3e6964;_0x18e31d=0xc8;}else{_0x18e31d=0xce;}_0x29030a['status'](_0x18e31d);return _0x29030a[_0xdd31('0x1b')]('Content-Range',_0x1e292e+'-'+_0x2cbd68+'/'+_0x3e6964)[_0xdd31('0x17')](_0x4e89b2);}return null;};}function patchUpdates(_0x5abd8f){return function(_0x2f191e){try{jsonpatch[_0xdd31('0x1c')](_0x2f191e,_0x5abd8f,!![]);}catch(_0x3638d2){return BPromise['reject'](_0x3638d2);}return _0x2f191e[_0xdd31('0x1d')]();};}function saveUpdates(_0x2b5786,_0x14effb){return function(_0x575f45){if(_0x575f45){return _0x575f45[_0xdd31('0x1e')](_0x2b5786)[_0xdd31('0x1f')](function(_0x5cc405){return _0x5cc405;});}return null;};}function removeEntity(_0x39c70a,_0x35b549){return function(_0x39f238){if(_0x39f238){return _0x39f238[_0xdd31('0x20')]()[_0xdd31('0x1f')](function(){_0x39c70a[_0xdd31('0x15')](0xcc)[_0xdd31('0x16')]();});}};}function handleEntityNotFound(_0x2e75b1,_0x5389a3){return function(_0x64f99f){if(!_0x64f99f){_0x2e75b1['sendStatus'](0x194);}return _0x64f99f;};}function handleError(_0x5dd1de,_0x2f4955){_0x2f4955=_0x2f4955||0x1f4;return function(_0x4ba571){logger['error'](_0x4ba571['stack']);if(_0x4ba571[_0xdd31('0x21')]){delete _0x4ba571[_0xdd31('0x21')];}_0x5dd1de[_0xdd31('0x15')](_0x2f4955)[_0xdd31('0x22')](_0x4ba571);};}exports[_0xdd31('0x23')]=function(_0x228e9f,_0x3e6a5b){var _0xa8a295={},_0x7b0c67={},_0x423906={'count':0x0,'rows':[]};var _0x32cc21=_['map'](db['VtigerField'][_0xdd31('0x24')],function(_0x274263){return{'name':_0x274263[_0xdd31('0x25')],'type':_0x274263['type'][_0xdd31('0x26')]};});_0x7b0c67['model']=_[_0xdd31('0x27')](_0x32cc21,_0xdd31('0x21'));_0x7b0c67[_0xdd31('0x28')]=_[_0xdd31('0x29')](_0x228e9f[_0xdd31('0x28')]);_0x7b0c67[_0xdd31('0x2a')]=_[_0xdd31('0x2b')](_0x7b0c67[_0xdd31('0x2c')],_0x7b0c67[_0xdd31('0x28')]);_0xa8a295['attributes']=_['intersection'](_0x7b0c67['model'],qs[_0xdd31('0x2d')](_0x228e9f[_0xdd31('0x28')][_0xdd31('0x2d')]));_0xa8a295[_0xdd31('0x2e')]=_0xa8a295[_0xdd31('0x2e')]['length']?_0xa8a295[_0xdd31('0x2e')]:_0x7b0c67['model'];if(!_0x228e9f[_0xdd31('0x28')][_0xdd31('0x2f')]('nolimit')){_0xa8a295['limit']=qs[_0xdd31('0x19')](_0x228e9f[_0xdd31('0x28')][_0xdd31('0x19')]);_0xa8a295[_0xdd31('0x18')]=qs[_0xdd31('0x18')](_0x228e9f[_0xdd31('0x28')][_0xdd31('0x18')]);}_0xa8a295['order']=qs[_0xdd31('0x30')](_0x228e9f[_0xdd31('0x28')]['sort']);_0xa8a295['where']=qs[_0xdd31('0x2a')](_[_0xdd31('0x31')](_0x228e9f[_0xdd31('0x28')],_0x7b0c67['filters']),_0x32cc21);if(_0x228e9f[_0xdd31('0x28')][_0xdd31('0x32')]){_0xa8a295[_0xdd31('0x33')]=_[_0xdd31('0x34')](_0xa8a295[_0xdd31('0x33')],{'$or':_['map'](_0x32cc21,function(_0x2da21e){if(_0x2da21e[_0xdd31('0x35')]!=='VIRTUAL'){var _0x60d7d7={};_0x60d7d7[_0x2da21e[_0xdd31('0x21')]]={'$like':'%'+_0x228e9f[_0xdd31('0x28')][_0xdd31('0x32')]+'%'};return _0x60d7d7;}})});}_0xa8a295=_[_0xdd31('0x34')]({},_0xa8a295,_0x228e9f[_0xdd31('0x36')]);var _0x34fec0={'where':_0xa8a295[_0xdd31('0x33')]};return db['VtigerField'][_0xdd31('0x1a')](_0x34fec0)[_0xdd31('0x1f')](function(_0x87d336){_0x423906[_0xdd31('0x1a')]=_0x87d336;if(_0x228e9f[_0xdd31('0x28')][_0xdd31('0x37')]){_0xa8a295[_0xdd31('0x38')]=[{'all':!![]}];}return db[_0xdd31('0x39')][_0xdd31('0x3a')](_0xa8a295);})[_0xdd31('0x1f')](function(_0x35eb77){_0x423906[_0xdd31('0x3b')]=_0x35eb77;return _0x423906;})[_0xdd31('0x1f')](respondWithFilteredResult(_0x3e6a5b,_0xa8a295))[_0xdd31('0x3c')](handleError(_0x3e6a5b,null));};exports[_0xdd31('0x3d')]=function(_0x22ed7f,_0x62119a){var _0x188b10={'raw':!![],'where':{'id':_0x22ed7f[_0xdd31('0x3e')]['id']}},_0x36e0d7={};_0x36e0d7['model']=_[_0xdd31('0x29')](db[_0xdd31('0x39')][_0xdd31('0x24')]);_0x36e0d7[_0xdd31('0x28')]=_[_0xdd31('0x29')](_0x22ed7f[_0xdd31('0x28')]);_0x36e0d7[_0xdd31('0x2a')]=_[_0xdd31('0x2b')](_0x36e0d7[_0xdd31('0x2c')],_0x36e0d7[_0xdd31('0x28')]);_0x188b10[_0xdd31('0x2e')]=_[_0xdd31('0x2b')](_0x36e0d7[_0xdd31('0x2c')],qs['fields'](_0x22ed7f[_0xdd31('0x28')]['fields']));_0x188b10[_0xdd31('0x2e')]=_0x188b10[_0xdd31('0x2e')]['length']?_0x188b10['attributes']:_0x36e0d7['model'];if(_0x22ed7f['query'][_0xdd31('0x37')]){_0x188b10[_0xdd31('0x38')]=[{'all':!![]}];}_0x188b10=_[_0xdd31('0x34')]({},_0x188b10,_0x22ed7f[_0xdd31('0x36')]);return db[_0xdd31('0x39')][_0xdd31('0x3f')](_0x188b10)[_0xdd31('0x1f')](handleEntityNotFound(_0x62119a,null))[_0xdd31('0x1f')](respondWithResult(_0x62119a,null))[_0xdd31('0x3c')](handleError(_0x62119a,null));};exports[_0xdd31('0x40')]=function(_0x1b9ce4,_0x11011a){return db[_0xdd31('0x39')]['create'](_0x1b9ce4[_0xdd31('0x41')],{})[_0xdd31('0x1f')](respondWithResult(_0x11011a,0xc9))[_0xdd31('0x3c')](handleError(_0x11011a,null));};exports[_0xdd31('0x1e')]=function(_0x319038,_0x4a16e2){if(_0x319038[_0xdd31('0x41')]['id']){delete _0x319038[_0xdd31('0x41')]['id'];}return db[_0xdd31('0x39')]['find']({'where':{'id':_0x319038[_0xdd31('0x3e')]['id']}})[_0xdd31('0x1f')](handleEntityNotFound(_0x4a16e2,null))[_0xdd31('0x1f')](saveUpdates(_0x319038[_0xdd31('0x41')],null))[_0xdd31('0x1f')](respondWithResult(_0x4a16e2,null))['catch'](handleError(_0x4a16e2,null));};exports[_0xdd31('0x20')]=function(_0x104e4d,_0x562dd7){return db[_0xdd31('0x39')][_0xdd31('0x3f')]({'where':{'id':_0x104e4d[_0xdd31('0x3e')]['id']}})[_0xdd31('0x1f')](handleEntityNotFound(_0x562dd7,null))['then'](removeEntity(_0x562dd7,null))[_0xdd31('0x3c')](handleError(_0x562dd7,null));}; \ No newline at end of file +var _0x1434=['nolimit','limit','order','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','apply','reject','save','then','destroy','error','stack','name','send','index','VtigerField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x2d9fff,_0x48e513){var _0x5d14f6=function(_0x188cdb){while(--_0x188cdb){_0x2d9fff['push'](_0x2d9fff['shift']());}};_0x5d14f6(++_0x48e513);}(_0x1434,0xf2));var _0x4143=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1434[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x4143('0x0'));var rimraf=require(_0x4143('0x1'));var zipdir=require(_0x4143('0x2'));var jsonpatch=require(_0x4143('0x3'));var rp=require('request-promise');var moment=require(_0x4143('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4143('0x5'));var util=require('util');var path=require(_0x4143('0x6'));var sox=require(_0x4143('0x7'));var csv=require(_0x4143('0x8'));var ejs=require(_0x4143('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4143('0xa'));var crypto=require(_0x4143('0xb'));var jsforce=require(_0x4143('0xc'));var deskjs=require(_0x4143('0xd'));var toCsv=require(_0x4143('0x8'));var querystring=require(_0x4143('0xe'));var Papa=require(_0x4143('0xf'));var Redis=require(_0x4143('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4143('0x11'));var as=require(_0x4143('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4143('0x13'))(_0x4143('0x14'));var utils=require(_0x4143('0x15'));var config=require(_0x4143('0x16'));var licenseUtil=require(_0x4143('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45d19d,_0x466322){_0x466322=_0x466322||0xcc;return function(_0x50a585){if(_0x50a585){return _0x45d19d[_0x4143('0x18')](_0x466322);}return _0x45d19d[_0x4143('0x19')](_0x466322)[_0x4143('0x1a')]();};}function respondWithResult(_0x299816,_0x403377){_0x403377=_0x403377||0xc8;return function(_0x282d89){if(_0x282d89){return _0x299816[_0x4143('0x19')](_0x403377)['json'](_0x282d89);}};}function respondWithFilteredResult(_0xa84864,_0x23be77){return function(_0x488204){if(_0x488204){var _0x44ca90=typeof _0x23be77[_0x4143('0x1b')]===_0x4143('0x1c')&&typeof _0x23be77['limit']===_0x4143('0x1c');var _0x18eec1=_0x488204[_0x4143('0x1d')];var _0x4340e9=_0x44ca90?0x0:_0x23be77['offset'];var _0x153340=_0x44ca90?_0x488204[_0x4143('0x1d')]:_0x23be77['offset']+_0x23be77['limit'];var _0x5657ee;if(_0x153340>=_0x18eec1){_0x153340=_0x18eec1;_0x5657ee=0xc8;}else{_0x5657ee=0xce;}_0xa84864[_0x4143('0x19')](_0x5657ee);return _0xa84864['set']('Content-Range',_0x4340e9+'-'+_0x153340+'/'+_0x18eec1)['json'](_0x488204);}return null;};}function patchUpdates(_0x30d504){return function(_0x110118){try{jsonpatch[_0x4143('0x1e')](_0x110118,_0x30d504,!![]);}catch(_0x48dc34){return BPromise[_0x4143('0x1f')](_0x48dc34);}return _0x110118[_0x4143('0x20')]();};}function saveUpdates(_0x35b8f8,_0x2b37be){return function(_0x58cf69){if(_0x58cf69){return _0x58cf69['update'](_0x35b8f8)[_0x4143('0x21')](function(_0x15c800){return _0x15c800;});}return null;};}function removeEntity(_0x40c48d,_0x52c7f0){return function(_0xfa96e4){if(_0xfa96e4){return _0xfa96e4[_0x4143('0x22')]()[_0x4143('0x21')](function(){_0x40c48d[_0x4143('0x19')](0xcc)[_0x4143('0x1a')]();});}};}function handleEntityNotFound(_0x1f5059,_0x2e7022){return function(_0x21d8d0){if(!_0x21d8d0){_0x1f5059[_0x4143('0x18')](0x194);}return _0x21d8d0;};}function handleError(_0x1978c0,_0x4609be){_0x4609be=_0x4609be||0x1f4;return function(_0x15eeb3){logger[_0x4143('0x23')](_0x15eeb3[_0x4143('0x24')]);if(_0x15eeb3['name']){delete _0x15eeb3[_0x4143('0x25')];}_0x1978c0[_0x4143('0x19')](_0x4609be)[_0x4143('0x26')](_0x15eeb3);};}exports[_0x4143('0x27')]=function(_0xa30554,_0x17f921){var _0x1ec9a8={},_0x1fee85={},_0x5ea84d={'count':0x0,'rows':[]};var _0x2484a3=_['map'](db[_0x4143('0x28')][_0x4143('0x29')],function(_0x416e3c){return{'name':_0x416e3c[_0x4143('0x2a')],'type':_0x416e3c[_0x4143('0x2b')][_0x4143('0x2c')]};});_0x1fee85[_0x4143('0x2d')]=_[_0x4143('0x2e')](_0x2484a3,_0x4143('0x25'));_0x1fee85[_0x4143('0x2f')]=_['keys'](_0xa30554[_0x4143('0x2f')]);_0x1fee85[_0x4143('0x30')]=_['intersection'](_0x1fee85[_0x4143('0x2d')],_0x1fee85[_0x4143('0x2f')]);_0x1ec9a8[_0x4143('0x31')]=_[_0x4143('0x32')](_0x1fee85['model'],qs[_0x4143('0x33')](_0xa30554['query'][_0x4143('0x33')]));_0x1ec9a8['attributes']=_0x1ec9a8['attributes'][_0x4143('0x34')]?_0x1ec9a8['attributes']:_0x1fee85[_0x4143('0x2d')];if(!_0xa30554[_0x4143('0x2f')][_0x4143('0x35')](_0x4143('0x36'))){_0x1ec9a8[_0x4143('0x37')]=qs[_0x4143('0x37')](_0xa30554[_0x4143('0x2f')][_0x4143('0x37')]);_0x1ec9a8[_0x4143('0x1b')]=qs['offset'](_0xa30554[_0x4143('0x2f')]['offset']);}_0x1ec9a8[_0x4143('0x38')]=qs[_0x4143('0x39')](_0xa30554[_0x4143('0x2f')][_0x4143('0x39')]);_0x1ec9a8[_0x4143('0x3a')]=qs[_0x4143('0x30')](_['pick'](_0xa30554['query'],_0x1fee85[_0x4143('0x30')]),_0x2484a3);if(_0xa30554[_0x4143('0x2f')][_0x4143('0x3b')]){_0x1ec9a8[_0x4143('0x3a')]=_['merge'](_0x1ec9a8['where'],{'$or':_['map'](_0x2484a3,function(_0x51575d){if(_0x51575d['type']!=='VIRTUAL'){var _0x5eaaed={};_0x5eaaed[_0x51575d[_0x4143('0x25')]]={'$like':'%'+_0xa30554[_0x4143('0x2f')][_0x4143('0x3b')]+'%'};return _0x5eaaed;}})});}_0x1ec9a8=_[_0x4143('0x3c')]({},_0x1ec9a8,_0xa30554[_0x4143('0x3d')]);var _0x48907f={'where':_0x1ec9a8['where']};return db[_0x4143('0x28')][_0x4143('0x1d')](_0x48907f)[_0x4143('0x21')](function(_0x539ed5){_0x5ea84d[_0x4143('0x1d')]=_0x539ed5;if(_0xa30554[_0x4143('0x2f')][_0x4143('0x3e')]){_0x1ec9a8['include']=[{'all':!![]}];}return db[_0x4143('0x28')][_0x4143('0x3f')](_0x1ec9a8);})['then'](function(_0x46fd76){_0x5ea84d[_0x4143('0x40')]=_0x46fd76;return _0x5ea84d;})[_0x4143('0x21')](respondWithFilteredResult(_0x17f921,_0x1ec9a8))['catch'](handleError(_0x17f921,null));};exports[_0x4143('0x41')]=function(_0x509eb2,_0x1a9ade){var _0x1a819d={'raw':!![],'where':{'id':_0x509eb2[_0x4143('0x42')]['id']}},_0x26e0db={};_0x26e0db[_0x4143('0x2d')]=_[_0x4143('0x43')](db['VtigerField'][_0x4143('0x29')]);_0x26e0db[_0x4143('0x2f')]=_[_0x4143('0x43')](_0x509eb2['query']);_0x26e0db[_0x4143('0x30')]=_[_0x4143('0x32')](_0x26e0db[_0x4143('0x2d')],_0x26e0db[_0x4143('0x2f')]);_0x1a819d['attributes']=_[_0x4143('0x32')](_0x26e0db[_0x4143('0x2d')],qs[_0x4143('0x33')](_0x509eb2[_0x4143('0x2f')][_0x4143('0x33')]));_0x1a819d['attributes']=_0x1a819d[_0x4143('0x31')][_0x4143('0x34')]?_0x1a819d[_0x4143('0x31')]:_0x26e0db[_0x4143('0x2d')];if(_0x509eb2['query'][_0x4143('0x3e')]){_0x1a819d[_0x4143('0x44')]=[{'all':!![]}];}_0x1a819d=_[_0x4143('0x3c')]({},_0x1a819d,_0x509eb2['options']);return db[_0x4143('0x28')][_0x4143('0x45')](_0x1a819d)[_0x4143('0x21')](handleEntityNotFound(_0x1a9ade,null))[_0x4143('0x21')](respondWithResult(_0x1a9ade,null))[_0x4143('0x46')](handleError(_0x1a9ade,null));};exports[_0x4143('0x47')]=function(_0x56492c,_0x59e06a){return db[_0x4143('0x28')][_0x4143('0x47')](_0x56492c[_0x4143('0x48')],{})[_0x4143('0x21')](respondWithResult(_0x59e06a,0xc9))[_0x4143('0x46')](handleError(_0x59e06a,null));};exports[_0x4143('0x49')]=function(_0x182ce7,_0x1acc57){if(_0x182ce7[_0x4143('0x48')]['id']){delete _0x182ce7[_0x4143('0x48')]['id'];}return db[_0x4143('0x28')][_0x4143('0x45')]({'where':{'id':_0x182ce7[_0x4143('0x42')]['id']}})['then'](handleEntityNotFound(_0x1acc57,null))[_0x4143('0x21')](saveUpdates(_0x182ce7[_0x4143('0x48')],null))[_0x4143('0x21')](respondWithResult(_0x1acc57,null))[_0x4143('0x46')](handleError(_0x1acc57,null));};exports[_0x4143('0x22')]=function(_0x27fffe,_0xb8c109){return db['VtigerField'][_0x4143('0x45')]({'where':{'id':_0x27fffe[_0x4143('0x42')]['id']}})[_0x4143('0x21')](handleEntityNotFound(_0xb8c109,null))[_0x4143('0x21')](removeEntity(_0xb8c109,null))['catch'](handleError(_0xb8c109,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index b38f6a4..4b1caba 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 _0xd85e=['vtiger_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define'];(function(_0x136690,_0xc0751a){var _0x26b719=function(_0x501371){while(--_0x501371){_0x136690['push'](_0x136690['shift']());}};_0x26b719(++_0xc0751a);}(_0xd85e,0x92));var _0xed85=function(_0x34fa73,_0x2b1d82){_0x34fa73=_0x34fa73-0x0;var _0x33ea7c=_0xd85e[_0x34fa73];return _0x33ea7c;};'use strict';var _=require(_0xed85('0x0'));var util=require(_0xed85('0x1'));var logger=require(_0xed85('0x2'))(_0xed85('0x3'));var moment=require(_0xed85('0x4'));var BPromise=require(_0xed85('0x5'));var rp=require(_0xed85('0x6'));var fs=require('fs');var path=require(_0xed85('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0xed85('0x8')]=function(_0x5018ad,_0x149a77){return _0x5018ad[_0xed85('0x9')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xed85('0xa'),'fields':['idField',_0xed85('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf245=['../../config/logger','api','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util'];(function(_0x5cf67a,_0x5dfb36){var _0x311c9d=function(_0x4d0df0){while(--_0x4d0df0){_0x5cf67a['push'](_0x5cf67a['shift']());}};_0x311c9d(++_0x5dfb36);}(_0xf245,0x11b));var _0x5f24=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0xf245[_0x36d203];return _0x2f9e62;};'use strict';var _=require(_0x5f24('0x0'));var util=require(_0x5f24('0x1'));var logger=require(_0x5f24('0x2'))(_0x5f24('0x3'));var moment=require('moment');var BPromise=require(_0x5f24('0x4'));var rp=require(_0x5f24('0x5'));var fs=require('fs');var path=require(_0x5f24('0x6'));var rimraf=require(_0x5f24('0x7'));var config=require('../../config/environment');var attributes=require(_0x5f24('0x8'));module['exports']=function(_0xbd4d6d,_0x4dbc71){return _0xbd4d6d[_0x5f24('0x9')](_0x5f24('0xa'),attributes,{'tableName':_0x5f24('0xb'),'paranoid':![],'indexes':[{'name':_0x5f24('0xc'),'fields':[_0x5f24('0xd'),_0x5f24('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 85e9e1d..74f3d0e 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 _0x4cf4=['error','code','message','request\x20sent','result','catch','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x450aae,_0x7be940){var _0x19deed=function(_0x36850b){while(--_0x36850b){_0x450aae['push'](_0x450aae['shift']());}};_0x19deed(++_0x7be940);}(_0x4cf4,0x7e));var _0x44cf=function(_0x25b7dc,_0x4e95c9){_0x25b7dc=_0x25b7dc-0x0;var _0x1c3e7e=_0x4cf4[_0x25b7dc];return _0x1c3e7e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x44cf('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x44cf('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x44cf('0x2'));var logger=require('../../config/logger')(_0x44cf('0x3'));var config=require(_0x44cf('0x4'));var jayson=require(_0x44cf('0x5'));var client=jayson[_0x44cf('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10ea3b,_0x224bc0,_0x553de8){return new BPromise(function(_0x27dda7,_0x2ad45f){return client[_0x44cf('0x7')](_0x10ea3b,_0x553de8)[_0x44cf('0x8')](function(_0x2efadc){logger[_0x44cf('0x9')](_0x44cf('0xa'),_0x224bc0,'request\x20sent');logger[_0x44cf('0xb')](_0x44cf('0xc'),_0x224bc0,'request\x20sent',JSON[_0x44cf('0xd')](_0x2efadc));if(_0x2efadc[_0x44cf('0xe')]){if(_0x2efadc[_0x44cf('0xe')][_0x44cf('0xf')]===0x1f4){logger[_0x44cf('0xe')](_0x44cf('0xa'),_0x224bc0,_0x2efadc[_0x44cf('0xe')][_0x44cf('0x10')]);return _0x2ad45f(_0x2efadc[_0x44cf('0xe')]['message']);}logger[_0x44cf('0xe')](_0x44cf('0xa'),_0x224bc0,_0x2efadc[_0x44cf('0xe')][_0x44cf('0x10')]);return _0x27dda7(_0x2efadc[_0x44cf('0xe')]['message']);}else{logger[_0x44cf('0x9')]('VtigerField,\x20%s,\x20%s',_0x224bc0,_0x44cf('0x11'));_0x27dda7(_0x2efadc[_0x44cf('0x12')][_0x44cf('0x10')]);}})[_0x44cf('0x13')](function(_0x241995){logger[_0x44cf('0xe')](_0x44cf('0xa'),_0x224bc0,_0x241995);_0x2ad45f(_0x241995);});});} \ No newline at end of file +var _0xfcb0=['VtigerField,\x20%s,\x20%s','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3a0dbc,_0x52e9c2){var _0x2b9ea3=function(_0x50f199){while(--_0x50f199){_0x3a0dbc['push'](_0x3a0dbc['shift']());}};_0x2b9ea3(++_0x52e9c2);}(_0xfcb0,0x8e));var _0x0fcb=function(_0x4ae62a,_0x54efa3){_0x4ae62a=_0x4ae62a-0x0;var _0x2f2971=_0xfcb0[_0x4ae62a];return _0x2f2971;};'use strict';var _=require(_0x0fcb('0x0'));var util=require('util');var moment=require(_0x0fcb('0x1'));var BPromise=require(_0x0fcb('0x2'));var rs=require(_0x0fcb('0x3'));var fs=require('fs');var Redis=require(_0x0fcb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fcb('0x5'));var logger=require(_0x0fcb('0x6'))(_0x0fcb('0x7'));var config=require(_0x0fcb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0fcb('0x9')][_0x0fcb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x202ea3,_0x173a39,_0x16e73d){return new BPromise(function(_0x5ab863,_0x396e60){return client['request'](_0x202ea3,_0x16e73d)[_0x0fcb('0xb')](function(_0x3d2378){logger['info']('VtigerField,\x20%s,\x20%s',_0x173a39,'request\x20sent');logger[_0x0fcb('0xc')](_0x0fcb('0xd'),_0x173a39,_0x0fcb('0xe'),JSON[_0x0fcb('0xf')](_0x3d2378));if(_0x3d2378[_0x0fcb('0x10')]){if(_0x3d2378[_0x0fcb('0x10')][_0x0fcb('0x11')]===0x1f4){logger[_0x0fcb('0x10')]('VtigerField,\x20%s,\x20%s',_0x173a39,_0x3d2378['error'][_0x0fcb('0x12')]);return _0x396e60(_0x3d2378[_0x0fcb('0x10')][_0x0fcb('0x12')]);}logger['error'](_0x0fcb('0x13'),_0x173a39,_0x3d2378[_0x0fcb('0x10')]['message']);return _0x5ab863(_0x3d2378[_0x0fcb('0x10')][_0x0fcb('0x12')]);}else{logger[_0x0fcb('0x14')](_0x0fcb('0x13'),_0x173a39,_0x0fcb('0xe'));_0x5ab863(_0x3d2378[_0x0fcb('0x15')][_0x0fcb('0x12')]);}})[_0x0fcb('0x16')](function(_0x53021b){logger[_0x0fcb('0x10')](_0x0fcb('0x13'),_0x173a39,_0x53021b);_0x396e60(_0x53021b);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index d89493e..2a74f7a 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 _0x7fcb=['connect-timeout','express','Router','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path'];(function(_0x27e244,_0x573ae3){var _0xa2c5ac=function(_0x55b0e4){while(--_0x55b0e4){_0x27e244['push'](_0x27e244['shift']());}};_0xa2c5ac(++_0x573ae3);}(_0x7fcb,0xd5));var _0xb7fc=function(_0x5f0f2c,_0x9817bf){_0x5f0f2c=_0x5f0f2c-0x0;var _0x104e69=_0x7fcb[_0x5f0f2c];return _0x104e69;};'use strict';var multer=require(_0xb7fc('0x0'));var util=require(_0xb7fc('0x1'));var path=require(_0xb7fc('0x2'));var timeout=require(_0xb7fc('0x3'));var express=require(_0xb7fc('0x4'));var router=express[_0xb7fc('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb7fc('0x6'));var controller=require(_0xb7fc('0x7'));router[_0xb7fc('0x8')]('/',auth[_0xb7fc('0x9')](),controller[_0xb7fc('0xa')]);router[_0xb7fc('0x8')](_0xb7fc('0xb'),auth[_0xb7fc('0x9')](),controller[_0xb7fc('0xc')]);router['get'](_0xb7fc('0xd'),auth[_0xb7fc('0x9')](),controller[_0xb7fc('0xe')]);router[_0xb7fc('0x8')](_0xb7fc('0xf'),auth[_0xb7fc('0x9')](),controller[_0xb7fc('0x10')]);router[_0xb7fc('0x11')]('/',auth[_0xb7fc('0x9')](),controller[_0xb7fc('0x12')]);router[_0xb7fc('0x11')](_0xb7fc('0xd'),auth[_0xb7fc('0x9')](),controller[_0xb7fc('0x13')]);router[_0xb7fc('0x14')](_0xb7fc('0xb'),auth[_0xb7fc('0x9')](),controller['update']);router[_0xb7fc('0x15')](_0xb7fc('0xb'),auth[_0xb7fc('0x9')](),controller[_0xb7fc('0x16')]);module[_0xb7fc('0x17')]=router; \ No newline at end of file +var _0x5e01=['isAuthenticated','show','/:id/configurations','getConfigurations','post','addConfiguration','put','/:id','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get'];(function(_0x4ce315,_0x388074){var _0x1a6160=function(_0x510e0d){while(--_0x510e0d){_0x4ce315['push'](_0x4ce315['shift']());}};_0x1a6160(++_0x388074);}(_0x5e01,0x160));var _0x15e0=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x5e01[_0x51c819];return _0x15c5d2;};'use strict';var multer=require(_0x15e0('0x0'));var util=require('util');var path=require(_0x15e0('0x1'));var timeout=require(_0x15e0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x15e0('0x3'));var auth=require(_0x15e0('0x4'));var interaction=require(_0x15e0('0x5'));var config=require(_0x15e0('0x6'));var controller=require(_0x15e0('0x7'));router[_0x15e0('0x8')]('/',auth[_0x15e0('0x9')](),controller['index']);router[_0x15e0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x15e0('0xa')]);router[_0x15e0('0x8')](_0x15e0('0xb'),auth[_0x15e0('0x9')](),controller[_0x15e0('0xc')]);router[_0x15e0('0x8')]('/:id/fields',auth[_0x15e0('0x9')](),controller['getFields']);router[_0x15e0('0xd')]('/',auth[_0x15e0('0x9')](),controller['create']);router[_0x15e0('0xd')](_0x15e0('0xb'),auth['isAuthenticated'](),controller[_0x15e0('0xe')]);router[_0x15e0('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x15e0('0x10'),auth[_0x15e0('0x9')](),controller[_0x15e0('0x11')]);module[_0x15e0('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 22a474e..3063220 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 _0x4fb4=['password','token','newTab','integrationTab','exports','STRING','username','remoteUri','ENUM'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x4fb4,0x190));var _0x44fb=function(_0x34e34c,_0x2562a4){_0x34e34c=_0x34e34c-0x0;var _0x23f506=_0x4fb4[_0x34e34c];return _0x23f506;};'use strict';var Sequelize=require('sequelize');module[_0x44fb('0x0')]={'name':{'type':Sequelize[_0x44fb('0x1')]},'description':{'type':Sequelize[_0x44fb('0x1')]},'username':{'type':Sequelize[_0x44fb('0x1')],'unique':_0x44fb('0x2')},'password':{'type':Sequelize[_0x44fb('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x44fb('0x1')],'unique':_0x44fb('0x3')},'authType':{'type':Sequelize[_0x44fb('0x4')](_0x44fb('0x5'),_0x44fb('0x6')),'defaultValue':_0x44fb('0x5')},'serverUrl':{'type':Sequelize[_0x44fb('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x44fb('0x4')]('integrationTab',_0x44fb('0x7')),'defaultValue':_0x44fb('0x8')}}; \ No newline at end of file +var _0x7c1a=['integrationTab','sequelize','exports','STRING','username','ENUM','token','password'];(function(_0x381379,_0x3f3b86){var _0x3e1063=function(_0x4c282d){while(--_0x4c282d){_0x381379['push'](_0x381379['shift']());}};_0x3e1063(++_0x3f3b86);}(_0x7c1a,0x159));var _0xa7c1=function(_0x3a8af0,_0xa738ca){_0x3a8af0=_0x3a8af0-0x0;var _0x4fa12a=_0x7c1a[_0x3a8af0];return _0x4fa12a;};'use strict';var Sequelize=require(_0xa7c1('0x0'));module[_0xa7c1('0x1')]={'name':{'type':Sequelize[_0xa7c1('0x2')]},'description':{'type':Sequelize[_0xa7c1('0x2')]},'username':{'type':Sequelize[_0xa7c1('0x2')],'unique':_0xa7c1('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xa7c1('0x2')]},'remoteUri':{'type':Sequelize[_0xa7c1('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xa7c1('0x4')]('password',_0xa7c1('0x5')),'defaultValue':_0xa7c1('0x6')},'serverUrl':{'type':Sequelize[_0xa7c1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa7c1('0x4')]('integrationTab','newTab'),'defaultValue':_0xa7c1('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 755224a..ea5f2a1 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 _0x6c76=['findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','username','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:%s','toString','base64','headers','%s/token:%s','Sequelize','ValidationError','subject','description','group','ticket_fields','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','ZendeskAccount','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','ZendeskConfiguration','addConfiguration'];(function(_0x261b8f,_0x164a7e){var _0x396c92=function(_0x3f3cd2){while(--_0x3f3cd2){_0x261b8f['push'](_0x261b8f['shift']());}};_0x396c92(++_0x164a7e);}(_0x6c76,0x184));var _0x66c7=function(_0x1a6709,_0xa00fee){_0x1a6709=_0x1a6709-0x0;var _0x2392fa=_0x6c76[_0x1a6709];return _0x2392fa;};'use strict';var emlformat=require(_0x66c7('0x0'));var rimraf=require(_0x66c7('0x1'));var zipdir=require(_0x66c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66c7('0x3'));var moment=require(_0x66c7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x66c7('0x5'));var path=require(_0x66c7('0x6'));var sox=require('sox');var csv=require(_0x66c7('0x7'));var ejs=require(_0x66c7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66c7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c7('0xa'));var deskjs=require(_0x66c7('0xb'));var toCsv=require(_0x66c7('0x7'));var querystring=require('querystring');var Papa=require(_0x66c7('0xc'));var Redis=require(_0x66c7('0xd'));var authService=require(_0x66c7('0xe'));var qs=require(_0x66c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c7('0x10'));var logger=require(_0x66c7('0x11'))(_0x66c7('0x12'));var utils=require(_0x66c7('0x13'));var config=require(_0x66c7('0x14'));var licenseUtil=require(_0x66c7('0x15'));var db=require(_0x66c7('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x18c309,_0x760e36){_0x760e36=_0x760e36||0xcc;return function(_0x35cbc2){if(_0x35cbc2){return _0x18c309[_0x66c7('0x17')](_0x760e36);}return _0x18c309[_0x66c7('0x18')](_0x760e36)[_0x66c7('0x19')]();};}function respondWithResult(_0x618bd7,_0xf3b04){_0xf3b04=_0xf3b04||0xc8;return function(_0x6400fe){if(_0x6400fe){return _0x618bd7['status'](_0xf3b04)[_0x66c7('0x1a')](_0x6400fe);}};}function respondWithFilteredResult(_0x4dd902,_0x208010){return function(_0x39f951){if(_0x39f951){var _0x3c81c0=typeof _0x208010[_0x66c7('0x1b')]===_0x66c7('0x1c')&&typeof _0x208010['limit']==='undefined';var _0x53fb36=_0x39f951['count'];var _0x8ad572=_0x3c81c0?0x0:_0x208010[_0x66c7('0x1b')];var _0x47a299=_0x3c81c0?_0x39f951['count']:_0x208010[_0x66c7('0x1b')]+_0x208010[_0x66c7('0x1d')];var _0x4756f7;if(_0x47a299>=_0x53fb36){_0x47a299=_0x53fb36;_0x4756f7=0xc8;}else{_0x4756f7=0xce;}_0x4dd902[_0x66c7('0x18')](_0x4756f7);return _0x4dd902['set']('Content-Range',_0x8ad572+'-'+_0x47a299+'/'+_0x53fb36)[_0x66c7('0x1a')](_0x39f951);}return null;};}function patchUpdates(_0x237177){return function(_0xf30f9){try{jsonpatch[_0x66c7('0x1e')](_0xf30f9,_0x237177,!![]);}catch(_0x465457){return BPromise[_0x66c7('0x1f')](_0x465457);}return _0xf30f9['save']();};}function saveUpdates(_0x4ddbd2,_0x366e9b){return function(_0x4a2b90){if(_0x4a2b90){return _0x4a2b90[_0x66c7('0x20')](_0x4ddbd2)[_0x66c7('0x21')](function(_0x44bdef){return _0x44bdef;});}return null;};}function removeEntity(_0x1fc9d3,_0x5bfaf6){return function(_0x2736df){if(_0x2736df){return _0x2736df[_0x66c7('0x22')]()['then'](function(){_0x1fc9d3[_0x66c7('0x18')](0xcc)[_0x66c7('0x19')]();});}};}function handleEntityNotFound(_0x2bb86d,_0x2ef6a2){return function(_0x2af0a3){if(!_0x2af0a3){_0x2bb86d['sendStatus'](0x194);}return _0x2af0a3;};}function handleError(_0x5bc4e6,_0x4e514a){_0x4e514a=_0x4e514a||0x1f4;return function(_0x2dd131){logger[_0x66c7('0x23')](_0x2dd131['stack']);if(_0x2dd131[_0x66c7('0x24')]){delete _0x2dd131[_0x66c7('0x24')];}_0x5bc4e6[_0x66c7('0x18')](_0x4e514a)[_0x66c7('0x25')](_0x2dd131);};}exports[_0x66c7('0x26')]=function(_0x27be81,_0x570f0d){var _0xccefb2={},_0x2e2560={},_0xc4b2bf={'count':0x0,'rows':[]};var _0x33be23=_[_0x66c7('0x27')](db['ZendeskAccount'][_0x66c7('0x28')],function(_0x4f1a34){return{'name':_0x4f1a34[_0x66c7('0x29')],'type':_0x4f1a34['type'][_0x66c7('0x2a')]};});_0x2e2560[_0x66c7('0x2b')]=_[_0x66c7('0x27')](_0x33be23,_0x66c7('0x24'));_0x2e2560[_0x66c7('0x2c')]=_[_0x66c7('0x2d')](_0x27be81['query']);_0x2e2560['filters']=_[_0x66c7('0x2e')](_0x2e2560[_0x66c7('0x2b')],_0x2e2560[_0x66c7('0x2c')]);_0xccefb2[_0x66c7('0x2f')]=_[_0x66c7('0x2e')](_0x2e2560[_0x66c7('0x2b')],qs[_0x66c7('0x30')](_0x27be81[_0x66c7('0x2c')][_0x66c7('0x30')]));_0xccefb2[_0x66c7('0x2f')]=_0xccefb2[_0x66c7('0x2f')][_0x66c7('0x31')]?_0xccefb2['attributes']:_0x2e2560['model'];if(!_0x27be81[_0x66c7('0x2c')][_0x66c7('0x32')](_0x66c7('0x33'))){_0xccefb2[_0x66c7('0x1d')]=qs[_0x66c7('0x1d')](_0x27be81[_0x66c7('0x2c')][_0x66c7('0x1d')]);_0xccefb2['offset']=qs[_0x66c7('0x1b')](_0x27be81[_0x66c7('0x2c')][_0x66c7('0x1b')]);}_0xccefb2[_0x66c7('0x34')]=qs[_0x66c7('0x35')](_0x27be81[_0x66c7('0x2c')][_0x66c7('0x35')]);_0xccefb2[_0x66c7('0x36')]=qs[_0x66c7('0x37')](_[_0x66c7('0x38')](_0x27be81[_0x66c7('0x2c')],_0x2e2560['filters']),_0x33be23);if(_0x27be81['query'][_0x66c7('0x39')]){_0xccefb2[_0x66c7('0x36')]=_[_0x66c7('0x3a')](_0xccefb2['where'],{'$or':_['map'](_0x33be23,function(_0x2e31b8){if(_0x2e31b8[_0x66c7('0x3b')]!=='VIRTUAL'){var _0x2d98e4={};_0x2d98e4[_0x2e31b8[_0x66c7('0x24')]]={'$like':'%'+_0x27be81[_0x66c7('0x2c')]['filter']+'%'};return _0x2d98e4;}})});}_0xccefb2=_[_0x66c7('0x3a')]({},_0xccefb2,_0x27be81[_0x66c7('0x3c')]);var _0x9f6ca8={'where':_0xccefb2[_0x66c7('0x36')]};return db[_0x66c7('0x3d')][_0x66c7('0x3e')](_0x9f6ca8)[_0x66c7('0x21')](function(_0x279d27){_0xc4b2bf[_0x66c7('0x3e')]=_0x279d27;if(_0x27be81['query'][_0x66c7('0x3f')]){_0xccefb2[_0x66c7('0x40')]=[{'all':!![]}];}return db[_0x66c7('0x3d')][_0x66c7('0x41')](_0xccefb2);})[_0x66c7('0x21')](function(_0x28983c){_0xc4b2bf[_0x66c7('0x42')]=_0x28983c;return _0xc4b2bf;})[_0x66c7('0x21')](respondWithFilteredResult(_0x570f0d,_0xccefb2))[_0x66c7('0x43')](handleError(_0x570f0d,null));};exports[_0x66c7('0x44')]=function(_0x513317,_0x5bb5fc){var _0x528f5c={'raw':![],'where':{'id':_0x513317[_0x66c7('0x45')]['id']}},_0x209f58={};_0x209f58['model']=_['keys'](db[_0x66c7('0x3d')][_0x66c7('0x28')]);_0x209f58[_0x66c7('0x2c')]=_[_0x66c7('0x2d')](_0x513317[_0x66c7('0x2c')]);_0x209f58['filters']=_[_0x66c7('0x2e')](_0x209f58['model'],_0x209f58['query']);_0x528f5c[_0x66c7('0x2f')]=_[_0x66c7('0x2e')](_0x209f58[_0x66c7('0x2b')],qs[_0x66c7('0x30')](_0x513317['query']['fields']));_0x528f5c[_0x66c7('0x2f')]=_0x528f5c['attributes']['length']?_0x528f5c[_0x66c7('0x2f')]:_0x209f58[_0x66c7('0x2b')];if(_0x513317[_0x66c7('0x2c')][_0x66c7('0x3f')]){_0x528f5c['include']=[{'all':!![]}];}_0x528f5c=_[_0x66c7('0x3a')]({},_0x528f5c,_0x513317[_0x66c7('0x3c')]);return db[_0x66c7('0x3d')]['find'](_0x528f5c)[_0x66c7('0x21')](handleEntityNotFound(_0x5bb5fc,null))[_0x66c7('0x21')](respondWithResult(_0x5bb5fc,null))[_0x66c7('0x43')](handleError(_0x5bb5fc,null));};exports[_0x66c7('0x46')]=function(_0x1b78a6,_0x3b4f34){return db[_0x66c7('0x3d')][_0x66c7('0x46')](_0x1b78a6['body'],{})[_0x66c7('0x21')](respondWithResult(_0x3b4f34,0xc9))[_0x66c7('0x43')](handleError(_0x3b4f34,null));};exports[_0x66c7('0x20')]=function(_0x1386a2,_0x208a15){if(_0x1386a2[_0x66c7('0x47')]['id']){delete _0x1386a2[_0x66c7('0x47')]['id'];}return db[_0x66c7('0x3d')][_0x66c7('0x48')]({'where':{'id':_0x1386a2[_0x66c7('0x45')]['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x208a15,null))[_0x66c7('0x21')](saveUpdates(_0x1386a2[_0x66c7('0x47')],null))[_0x66c7('0x21')](respondWithResult(_0x208a15,null))['catch'](handleError(_0x208a15,null));};exports[_0x66c7('0x22')]=function(_0x225fb6,_0x27070b){return db[_0x66c7('0x3d')]['find']({'where':{'id':_0x225fb6[_0x66c7('0x45')]['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x27070b,null))['then'](removeEntity(_0x27070b,null))[_0x66c7('0x43')](handleError(_0x27070b,null));};exports[_0x66c7('0x49')]=function(_0xe4304c,_0x3dee16,_0x17670c){var _0x1c88c0={};var _0x1ed21e={};var _0x5cd4e9;var _0x933dd6;return db[_0x66c7('0x3d')]['findOne']({'where':{'id':_0xe4304c[_0x66c7('0x45')]['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x3dee16,null))[_0x66c7('0x21')](function(_0x5df6d1){if(_0x5df6d1){_0x5cd4e9=_0x5df6d1;_0x1ed21e[_0x66c7('0x2b')]=_[_0x66c7('0x2d')](db[_0x66c7('0x4a')][_0x66c7('0x28')]);_0x1ed21e[_0x66c7('0x2c')]=_[_0x66c7('0x2d')](_0xe4304c[_0x66c7('0x2c')]);_0x1ed21e[_0x66c7('0x37')]=_['intersection'](_0x1ed21e[_0x66c7('0x2b')],_0x1ed21e[_0x66c7('0x2c')]);_0x1c88c0['attributes']=_[_0x66c7('0x2e')](_0x1ed21e[_0x66c7('0x2b')],qs[_0x66c7('0x30')](_0xe4304c['query']['fields']));_0x1c88c0[_0x66c7('0x2f')]=_0x1c88c0['attributes'][_0x66c7('0x31')]?_0x1c88c0[_0x66c7('0x2f')]:_0x1ed21e[_0x66c7('0x2b')];_0x1c88c0[_0x66c7('0x34')]=qs[_0x66c7('0x35')](_0xe4304c[_0x66c7('0x2c')]['sort']);_0x1c88c0['where']=qs[_0x66c7('0x37')](_[_0x66c7('0x38')](_0xe4304c['query'],_0x1ed21e['filters']));if(_0xe4304c[_0x66c7('0x2c')]['filter']){_0x1c88c0[_0x66c7('0x36')]=_[_0x66c7('0x3a')](_0x1c88c0[_0x66c7('0x36')],{'$or':_[_0x66c7('0x27')](_0x1c88c0['attributes'],function(_0x3b26ac){var _0x1dc6e6={};_0x1dc6e6[_0x3b26ac]={'$like':'%'+_0xe4304c[_0x66c7('0x2c')][_0x66c7('0x39')]+'%'};return _0x1dc6e6;})});}_0x1c88c0=_[_0x66c7('0x3a')]({},_0x1c88c0,_0xe4304c[_0x66c7('0x3c')]);return _0x5cd4e9['getConfigurations'](_0x1c88c0);}})[_0x66c7('0x21')](function(_0x39c18e){if(_0x39c18e){_0x933dd6=_0x39c18e[_0x66c7('0x31')];if(!_0xe4304c['query'][_0x66c7('0x32')]('nolimit')){_0x1c88c0[_0x66c7('0x1d')]=qs[_0x66c7('0x1d')](_0xe4304c[_0x66c7('0x2c')][_0x66c7('0x1d')]);_0x1c88c0[_0x66c7('0x1b')]=qs[_0x66c7('0x1b')](_0xe4304c['query'][_0x66c7('0x1b')]);}return _0x5cd4e9[_0x66c7('0x49')](_0x1c88c0);}})[_0x66c7('0x21')](function(_0x3b24d9){if(_0x3b24d9){return _0x3b24d9?{'count':_0x933dd6,'rows':_0x3b24d9}:null;}})[_0x66c7('0x21')](respondWithResult(_0x3dee16,null))['catch'](handleError(_0x3dee16,null));};exports[_0x66c7('0x4b')]=function(_0x1cb5ef,_0x429096,_0x37f244){if(_0x1cb5ef[_0x66c7('0x47')]['id']){delete _0x1cb5ef[_0x66c7('0x47')]['id'];}return db[_0x66c7('0x3d')][_0x66c7('0x4c')]({'where':{'id':_0x1cb5ef[_0x66c7('0x45')]['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x429096,null))[_0x66c7('0x21')](function(_0x43b582){if(_0x43b582){_0x1cb5ef['body'][_0x66c7('0x4d')]=_0x43b582['id'];_0x1cb5ef[_0x66c7('0x47')][_0x66c7('0x4e')]=integrations[_0x66c7('0x4f')](_0x1cb5ef[_0x66c7('0x47')][_0x66c7('0x50')],_0x1cb5ef[_0x66c7('0x47')]['type']);_0x1cb5ef[_0x66c7('0x47')][_0x66c7('0x51')]=integrations[_0x66c7('0x52')](_0x1cb5ef[_0x66c7('0x47')][_0x66c7('0x50')],_0x1cb5ef[_0x66c7('0x47')][_0x66c7('0x3b')]);return db[_0x66c7('0x4a')][_0x66c7('0x46')](_0x1cb5ef[_0x66c7('0x47')],{'include':[{'model':db[_0x66c7('0x53')],'as':_0x66c7('0x4e')},{'model':db[_0x66c7('0x53')],'as':_0x66c7('0x51')}]});}return null;})[_0x66c7('0x21')](respondWithResult(_0x429096,null))[_0x66c7('0x43')](handleError(_0x429096,null));};exports['getFields']=function(_0x16d404,_0x31bc19,_0x43a623){var _0x153714='';return db[_0x66c7('0x3d')][_0x66c7('0x4c')]({'where':{'id':_0x16d404[_0x66c7('0x45')]['id']},'attributes':['id',_0x66c7('0x54'),_0x66c7('0x55'),_0x66c7('0x56'),_0x66c7('0x57'),_0x66c7('0x58')]})[_0x66c7('0x21')](handleEntityNotFound(_0x31bc19,null))[_0x66c7('0x21')](function(_0x3263ab){if(_0x3263ab){_0x153714=_0x3263ab[_0x66c7('0x58')];var _0x32a428=_0x153714['slice'](-0x1);if(_0x32a428==='/'){_0x153714=_0x153714[_0x66c7('0x59')](0x0,_0x153714[_0x66c7('0x5a')](_0x32a428));}var _0x188d9c={'method':_0x66c7('0x5b'),'uri':util[_0x66c7('0x5c')](_0x66c7('0x5d'),_0x153714,'ticket_fields'),'json':!![]};switch(_0x3263ab['authType']){case _0x66c7('0x55'):_0x188d9c['headers']={'Authorization':util[_0x66c7('0x5c')](_0x66c7('0x5e'),new Buffer(util[_0x66c7('0x5c')](_0x66c7('0x5f'),_0x3263ab[_0x66c7('0x54')],_0x3263ab[_0x66c7('0x55')]))[_0x66c7('0x60')](_0x66c7('0x61')))};break;case _0x66c7('0x56'):_0x188d9c[_0x66c7('0x62')]={'Authorization':util[_0x66c7('0x5c')](_0x66c7('0x5e'),new Buffer(util['format'](_0x66c7('0x63'),_0x3263ab[_0x66c7('0x54')],_0x3263ab[_0x66c7('0x56')]))[_0x66c7('0x60')]('base64'))};break;default:throw new db[(_0x66c7('0x64'))][(_0x66c7('0x65'))]('Unknown\x20authentication\x20type');}return rp(_0x188d9c);}})[_0x66c7('0x21')](function(_0x3a4fe1){if(_0x3a4fe1){var _0x3f25c0=[_0x66c7('0x66'),_0x66c7('0x67'),_0x66c7('0x68'),'assignee'];_['remove'](_0x3a4fe1[_0x66c7('0x69')],function(_0x549b15){return _0x3f25c0['includes'](_0x549b15[_0x66c7('0x3b')]);});return{'count':_0x3a4fe1[_0x66c7('0x69')][_0x66c7('0x31')],'rows':_[_0x66c7('0x27')](_0x3a4fe1[_0x66c7('0x69')],function(_0x536764){return{'id':_0x536764['id'],'name':_0x536764[_0x66c7('0x6a')]>0x7?_0x536764[_0x66c7('0x6b')]:_0x536764['type'],'custom':_0x536764[_0x66c7('0x6a')]>0x7?!![]:![],'options':_0x536764[_0x66c7('0x6c')]?_0x536764[_0x66c7('0x6c')]:_0x536764[_0x66c7('0x6d')]?_0x536764[_0x66c7('0x6d')]:[]};})};}})[_0x66c7('0x21')](respondWithResult(_0x31bc19,null))[_0x66c7('0x43')](function(_0x44a672){var _0x46b54f=_0x16d404[_0x66c7('0x2c')][_0x66c7('0x6e')]?0x1f4:_0x44a672[_0x66c7('0x6f')]||0x1f4;logger[_0x66c7('0x23')](_0x66c7('0x70'),_0x66c7('0x71'),_0x46b54f,JSON[_0x66c7('0x72')](_0x44a672));delete _0x44a672[_0x66c7('0x24')];if(_0x46b54f===0x191){_0x46b54f=0x190;}_0x31bc19[_0x66c7('0x18')](_0x46b54f)[_0x66c7('0x25')](_0x16d404[_0x66c7('0x2c')][_0x66c7('0x6e')]?{'message':_0x66c7('0x73'),'statusCode':_0x44a672[_0x66c7('0x6f')]}:_0x44a672);});}; \ No newline at end of file +var _0x6f7a=['name','send','index','map','ZendeskAccount','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','getConfigurations','findOne','Subjects','getSubjects','channel','getDescriptions','ZendeskConfiguration','ZendeskField','Descriptions','getFields','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','username','password','toString','base64','token','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','description','group','includes','position','title','system_field_options','custom_field_options','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','then'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0xb9a554,_0x3ffcfa){_0xb9a554=_0xb9a554-0x0;var _0x3b2cc8=_0x6f7a[_0xb9a554];return _0x3b2cc8;};'use strict';var emlformat=require(_0xa6f7('0x0'));var rimraf=require(_0xa6f7('0x1'));var zipdir=require(_0xa6f7('0x2'));var jsonpatch=require(_0xa6f7('0x3'));var rp=require('request-promise');var moment=require(_0xa6f7('0x4'));var BPromise=require(_0xa6f7('0x5'));var Mustache=require(_0xa6f7('0x6'));var util=require(_0xa6f7('0x7'));var path=require(_0xa6f7('0x8'));var sox=require(_0xa6f7('0x9'));var csv=require(_0xa6f7('0xa'));var ejs=require(_0xa6f7('0xb'));var fs=require('fs');var fs_extra=require(_0xa6f7('0xc'));var _=require(_0xa6f7('0xd'));var squel=require(_0xa6f7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6f7('0xf'));var toCsv=require(_0xa6f7('0xa'));var querystring=require(_0xa6f7('0x10'));var Papa=require(_0xa6f7('0x11'));var Redis=require(_0xa6f7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6f7('0x13'));var hardwareService=require(_0xa6f7('0x14'));var logger=require('../../config/logger')(_0xa6f7('0x15'));var utils=require('../../config/utils');var config=require(_0xa6f7('0x16'));var licenseUtil=require(_0xa6f7('0x17'));var db=require(_0xa6f7('0x18'))['db'];var integrations=require(_0xa6f7('0x19'));function respondWithStatusCode(_0x5a3035,_0x3fc7f1){_0x3fc7f1=_0x3fc7f1||0xcc;return function(_0x532352){if(_0x532352){return _0x5a3035[_0xa6f7('0x1a')](_0x3fc7f1);}return _0x5a3035[_0xa6f7('0x1b')](_0x3fc7f1)[_0xa6f7('0x1c')]();};}function respondWithResult(_0x4d3d59,_0x34c02d){_0x34c02d=_0x34c02d||0xc8;return function(_0x491fae){if(_0x491fae){return _0x4d3d59[_0xa6f7('0x1b')](_0x34c02d)['json'](_0x491fae);}};}function respondWithFilteredResult(_0x17b814,_0x17f9c5){return function(_0x6efd38){if(_0x6efd38){var _0x47e664=typeof _0x17f9c5[_0xa6f7('0x1d')]===_0xa6f7('0x1e')&&typeof _0x17f9c5[_0xa6f7('0x1f')]===_0xa6f7('0x1e');var _0x5681d5=_0x6efd38['count'];var _0xba7755=_0x47e664?0x0:_0x17f9c5['offset'];var _0x378967=_0x47e664?_0x6efd38[_0xa6f7('0x20')]:_0x17f9c5['offset']+_0x17f9c5[_0xa6f7('0x1f')];var _0xb2cfaa;if(_0x378967>=_0x5681d5){_0x378967=_0x5681d5;_0xb2cfaa=0xc8;}else{_0xb2cfaa=0xce;}_0x17b814[_0xa6f7('0x1b')](_0xb2cfaa);return _0x17b814[_0xa6f7('0x21')](_0xa6f7('0x22'),_0xba7755+'-'+_0x378967+'/'+_0x5681d5)[_0xa6f7('0x23')](_0x6efd38);}return null;};}function patchUpdates(_0x4887ad){return function(_0x3c0c55){try{jsonpatch[_0xa6f7('0x24')](_0x3c0c55,_0x4887ad,!![]);}catch(_0x58b6a1){return BPromise['reject'](_0x58b6a1);}return _0x3c0c55['save']();};}function saveUpdates(_0x1de6c9,_0x119950){return function(_0x566b63){if(_0x566b63){return _0x566b63['update'](_0x1de6c9)['then'](function(_0x2b6a84){return _0x2b6a84;});}return null;};}function removeEntity(_0xc77e8e,_0x28263e){return function(_0x5baaa9){if(_0x5baaa9){return _0x5baaa9['destroy']()[_0xa6f7('0x25')](function(){_0xc77e8e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x402d25,_0x5efdce){return function(_0x35847e){if(!_0x35847e){_0x402d25[_0xa6f7('0x1a')](0x194);}return _0x35847e;};}function handleError(_0x3c79ea,_0x2b4c6c){_0x2b4c6c=_0x2b4c6c||0x1f4;return function(_0x3a3508){logger['error'](_0x3a3508['stack']);if(_0x3a3508[_0xa6f7('0x26')]){delete _0x3a3508[_0xa6f7('0x26')];}_0x3c79ea['status'](_0x2b4c6c)[_0xa6f7('0x27')](_0x3a3508);};}exports[_0xa6f7('0x28')]=function(_0x87bccc,_0x3a7ff9){var _0x224f5a={},_0x10bf77={},_0x353de8={'count':0x0,'rows':[]};var _0x54f72c=_[_0xa6f7('0x29')](db[_0xa6f7('0x2a')][_0xa6f7('0x2b')],function(_0x278bad){return{'name':_0x278bad['fieldName'],'type':_0x278bad[_0xa6f7('0x2c')][_0xa6f7('0x2d')]};});_0x10bf77['model']=_[_0xa6f7('0x29')](_0x54f72c,_0xa6f7('0x26'));_0x10bf77['query']=_['keys'](_0x87bccc[_0xa6f7('0x2e')]);_0x10bf77[_0xa6f7('0x2f')]=_[_0xa6f7('0x30')](_0x10bf77[_0xa6f7('0x31')],_0x10bf77[_0xa6f7('0x2e')]);_0x224f5a['attributes']=_['intersection'](_0x10bf77[_0xa6f7('0x31')],qs['fields'](_0x87bccc[_0xa6f7('0x2e')][_0xa6f7('0x32')]));_0x224f5a[_0xa6f7('0x33')]=_0x224f5a[_0xa6f7('0x33')][_0xa6f7('0x34')]?_0x224f5a[_0xa6f7('0x33')]:_0x10bf77['model'];if(!_0x87bccc[_0xa6f7('0x2e')][_0xa6f7('0x35')](_0xa6f7('0x36'))){_0x224f5a['limit']=qs[_0xa6f7('0x1f')](_0x87bccc['query'][_0xa6f7('0x1f')]);_0x224f5a[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x87bccc['query'][_0xa6f7('0x1d')]);}_0x224f5a[_0xa6f7('0x37')]=qs[_0xa6f7('0x38')](_0x87bccc[_0xa6f7('0x2e')][_0xa6f7('0x38')]);_0x224f5a[_0xa6f7('0x39')]=qs['filters'](_[_0xa6f7('0x3a')](_0x87bccc[_0xa6f7('0x2e')],_0x10bf77[_0xa6f7('0x2f')]),_0x54f72c);if(_0x87bccc[_0xa6f7('0x2e')][_0xa6f7('0x3b')]){_0x224f5a[_0xa6f7('0x39')]=_[_0xa6f7('0x3c')](_0x224f5a[_0xa6f7('0x39')],{'$or':_['map'](_0x54f72c,function(_0x1b5213){if(_0x1b5213[_0xa6f7('0x2c')]!==_0xa6f7('0x3d')){var _0x518088={};_0x518088[_0x1b5213[_0xa6f7('0x26')]]={'$like':'%'+_0x87bccc[_0xa6f7('0x2e')]['filter']+'%'};return _0x518088;}})});}_0x224f5a=_[_0xa6f7('0x3c')]({},_0x224f5a,_0x87bccc[_0xa6f7('0x3e')]);var _0x3ecb88={'where':_0x224f5a[_0xa6f7('0x39')]};return db[_0xa6f7('0x2a')]['count'](_0x3ecb88)[_0xa6f7('0x25')](function(_0x1ce691){_0x353de8[_0xa6f7('0x20')]=_0x1ce691;if(_0x87bccc[_0xa6f7('0x2e')][_0xa6f7('0x3f')]){_0x224f5a[_0xa6f7('0x40')]=[{'all':!![]}];}return db[_0xa6f7('0x2a')][_0xa6f7('0x41')](_0x224f5a);})['then'](function(_0x5ac005){_0x353de8[_0xa6f7('0x42')]=_0x5ac005;return _0x353de8;})[_0xa6f7('0x25')](respondWithFilteredResult(_0x3a7ff9,_0x224f5a))[_0xa6f7('0x43')](handleError(_0x3a7ff9,null));};exports[_0xa6f7('0x44')]=function(_0x2ac07f,_0x387714){var _0x21fdd7={'raw':![],'where':{'id':_0x2ac07f[_0xa6f7('0x45')]['id']}},_0x404552={};_0x404552[_0xa6f7('0x31')]=_['keys'](db[_0xa6f7('0x2a')][_0xa6f7('0x2b')]);_0x404552['query']=_[_0xa6f7('0x46')](_0x2ac07f[_0xa6f7('0x2e')]);_0x404552[_0xa6f7('0x2f')]=_[_0xa6f7('0x30')](_0x404552['model'],_0x404552[_0xa6f7('0x2e')]);_0x21fdd7['attributes']=_['intersection'](_0x404552[_0xa6f7('0x31')],qs[_0xa6f7('0x32')](_0x2ac07f[_0xa6f7('0x2e')][_0xa6f7('0x32')]));_0x21fdd7[_0xa6f7('0x33')]=_0x21fdd7[_0xa6f7('0x33')][_0xa6f7('0x34')]?_0x21fdd7['attributes']:_0x404552[_0xa6f7('0x31')];if(_0x2ac07f[_0xa6f7('0x2e')]['includeAll']){_0x21fdd7[_0xa6f7('0x40')]=[{'all':!![]}];}_0x21fdd7=_[_0xa6f7('0x3c')]({},_0x21fdd7,_0x2ac07f[_0xa6f7('0x3e')]);return db['ZendeskAccount'][_0xa6f7('0x47')](_0x21fdd7)['then'](handleEntityNotFound(_0x387714,null))[_0xa6f7('0x25')](respondWithResult(_0x387714,null))[_0xa6f7('0x43')](handleError(_0x387714,null));};exports[_0xa6f7('0x48')]=function(_0x5f3c84,_0x5df564){return db[_0xa6f7('0x2a')]['create'](_0x5f3c84[_0xa6f7('0x49')],{})['then'](respondWithResult(_0x5df564,0xc9))['catch'](handleError(_0x5df564,null));};exports[_0xa6f7('0x4a')]=function(_0x2e3a04,_0x350071){if(_0x2e3a04[_0xa6f7('0x49')]['id']){delete _0x2e3a04[_0xa6f7('0x49')]['id'];}return db[_0xa6f7('0x2a')]['find']({'where':{'id':_0x2e3a04[_0xa6f7('0x45')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x350071,null))['then'](saveUpdates(_0x2e3a04[_0xa6f7('0x49')],null))['then'](respondWithResult(_0x350071,null))[_0xa6f7('0x43')](handleError(_0x350071,null));};exports['destroy']=function(_0x488efc,_0x60eacc){return db[_0xa6f7('0x2a')][_0xa6f7('0x47')]({'where':{'id':_0x488efc[_0xa6f7('0x45')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x60eacc,null))['then'](removeEntity(_0x60eacc,null))[_0xa6f7('0x43')](handleError(_0x60eacc,null));};exports[_0xa6f7('0x4b')]=function(_0x5cddc9,_0x4b83f6,_0x5991f9){var _0x1d7bcd={};var _0x1c2099={};var _0x134dd7;var _0x55369a;return db[_0xa6f7('0x2a')]['findOne']({'where':{'id':_0x5cddc9[_0xa6f7('0x45')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x4b83f6,null))[_0xa6f7('0x25')](function(_0x1dcb45){if(_0x1dcb45){_0x134dd7=_0x1dcb45;_0x1c2099[_0xa6f7('0x31')]=_['keys'](db['ZendeskConfiguration'][_0xa6f7('0x2b')]);_0x1c2099[_0xa6f7('0x2e')]=_[_0xa6f7('0x46')](_0x5cddc9[_0xa6f7('0x2e')]);_0x1c2099['filters']=_[_0xa6f7('0x30')](_0x1c2099[_0xa6f7('0x31')],_0x1c2099[_0xa6f7('0x2e')]);_0x1d7bcd[_0xa6f7('0x33')]=_[_0xa6f7('0x30')](_0x1c2099[_0xa6f7('0x31')],qs['fields'](_0x5cddc9[_0xa6f7('0x2e')][_0xa6f7('0x32')]));_0x1d7bcd[_0xa6f7('0x33')]=_0x1d7bcd['attributes'][_0xa6f7('0x34')]?_0x1d7bcd[_0xa6f7('0x33')]:_0x1c2099[_0xa6f7('0x31')];_0x1d7bcd[_0xa6f7('0x37')]=qs['sort'](_0x5cddc9['query'][_0xa6f7('0x38')]);_0x1d7bcd[_0xa6f7('0x39')]=qs[_0xa6f7('0x2f')](_[_0xa6f7('0x3a')](_0x5cddc9[_0xa6f7('0x2e')],_0x1c2099[_0xa6f7('0x2f')]));if(_0x5cddc9[_0xa6f7('0x2e')]['filter']){_0x1d7bcd[_0xa6f7('0x39')]=_[_0xa6f7('0x3c')](_0x1d7bcd[_0xa6f7('0x39')],{'$or':_[_0xa6f7('0x29')](_0x1d7bcd[_0xa6f7('0x33')],function(_0x11fba9){var _0xa52de0={};_0xa52de0[_0x11fba9]={'$like':'%'+_0x5cddc9[_0xa6f7('0x2e')][_0xa6f7('0x3b')]+'%'};return _0xa52de0;})});}_0x1d7bcd=_[_0xa6f7('0x3c')]({},_0x1d7bcd,_0x5cddc9[_0xa6f7('0x3e')]);return _0x134dd7['getConfigurations'](_0x1d7bcd);}})[_0xa6f7('0x25')](function(_0x55c5ce){if(_0x55c5ce){_0x55369a=_0x55c5ce[_0xa6f7('0x34')];if(!_0x5cddc9['query'][_0xa6f7('0x35')](_0xa6f7('0x36'))){_0x1d7bcd['limit']=qs[_0xa6f7('0x1f')](_0x5cddc9[_0xa6f7('0x2e')][_0xa6f7('0x1f')]);_0x1d7bcd['offset']=qs[_0xa6f7('0x1d')](_0x5cddc9['query'][_0xa6f7('0x1d')]);}return _0x134dd7[_0xa6f7('0x4b')](_0x1d7bcd);}})['then'](function(_0xd8a485){if(_0xd8a485){return _0xd8a485?{'count':_0x55369a,'rows':_0xd8a485}:null;}})['then'](respondWithResult(_0x4b83f6,null))[_0xa6f7('0x43')](handleError(_0x4b83f6,null));};exports['addConfiguration']=function(_0x14f28e,_0x341dd6,_0x2bf525){if(_0x14f28e[_0xa6f7('0x49')]['id']){delete _0x14f28e[_0xa6f7('0x49')]['id'];}return db[_0xa6f7('0x2a')][_0xa6f7('0x4c')]({'where':{'id':_0x14f28e[_0xa6f7('0x45')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x341dd6,null))[_0xa6f7('0x25')](function(_0x110ea5){if(_0x110ea5){_0x14f28e[_0xa6f7('0x49')]['AccountId']=_0x110ea5['id'];_0x14f28e[_0xa6f7('0x49')][_0xa6f7('0x4d')]=integrations[_0xa6f7('0x4e')](_0x14f28e[_0xa6f7('0x49')][_0xa6f7('0x4f')],_0x14f28e[_0xa6f7('0x49')][_0xa6f7('0x2c')]);_0x14f28e[_0xa6f7('0x49')]['Descriptions']=integrations[_0xa6f7('0x50')](_0x14f28e[_0xa6f7('0x49')][_0xa6f7('0x4f')],_0x14f28e['body'][_0xa6f7('0x2c')]);return db[_0xa6f7('0x51')][_0xa6f7('0x48')](_0x14f28e[_0xa6f7('0x49')],{'include':[{'model':db[_0xa6f7('0x52')],'as':_0xa6f7('0x4d')},{'model':db[_0xa6f7('0x52')],'as':_0xa6f7('0x53')}]});}return null;})['then'](respondWithResult(_0x341dd6,null))['catch'](handleError(_0x341dd6,null));};exports[_0xa6f7('0x54')]=function(_0x326feb,_0x5e6d94,_0x3aa759){var _0x18ff29='';return db[_0xa6f7('0x2a')]['findOne']({'where':{'id':_0x326feb[_0xa6f7('0x45')]['id']},'attributes':['id','username','password','token','authType','remoteUri']})[_0xa6f7('0x25')](handleEntityNotFound(_0x5e6d94,null))[_0xa6f7('0x25')](function(_0x41dc51){if(_0x41dc51){_0x18ff29=_0x41dc51['remoteUri'];var _0x849412=_0x18ff29[_0xa6f7('0x55')](-0x1);if(_0x849412==='/'){_0x18ff29=_0x18ff29[_0xa6f7('0x56')](0x0,_0x18ff29[_0xa6f7('0x57')](_0x849412));}var _0x740cb5={'method':_0xa6f7('0x58'),'uri':util[_0xa6f7('0x59')](_0xa6f7('0x5a'),_0x18ff29,_0xa6f7('0x5b')),'json':!![]};switch(_0x41dc51[_0xa6f7('0x5c')]){case'password':_0x740cb5[_0xa6f7('0x5d')]={'Authorization':util[_0xa6f7('0x59')](_0xa6f7('0x5e'),new Buffer(util[_0xa6f7('0x59')](_0xa6f7('0x5f'),_0x41dc51[_0xa6f7('0x60')],_0x41dc51[_0xa6f7('0x61')]))[_0xa6f7('0x62')](_0xa6f7('0x63')))};break;case _0xa6f7('0x64'):_0x740cb5[_0xa6f7('0x5d')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xa6f7('0x59')](_0xa6f7('0x65'),_0x41dc51[_0xa6f7('0x60')],_0x41dc51['token']))[_0xa6f7('0x62')](_0xa6f7('0x63')))};break;default:throw new db['Sequelize'][(_0xa6f7('0x66'))](_0xa6f7('0x67'));}return rp(_0x740cb5);}})['then'](function(_0x52dcd9){if(_0x52dcd9){var _0xadf749=['subject',_0xa6f7('0x68'),_0xa6f7('0x69'),'assignee'];_['remove'](_0x52dcd9[_0xa6f7('0x5b')],function(_0x1da89a){return _0xadf749[_0xa6f7('0x6a')](_0x1da89a['type']);});return{'count':_0x52dcd9[_0xa6f7('0x5b')][_0xa6f7('0x34')],'rows':_[_0xa6f7('0x29')](_0x52dcd9[_0xa6f7('0x5b')],function(_0x70d8c3){return{'id':_0x70d8c3['id'],'name':_0x70d8c3[_0xa6f7('0x6b')]>0x7?_0x70d8c3[_0xa6f7('0x6c')]:_0x70d8c3[_0xa6f7('0x2c')],'custom':_0x70d8c3[_0xa6f7('0x6b')]>0x7?!![]:![],'options':_0x70d8c3[_0xa6f7('0x6d')]?_0x70d8c3[_0xa6f7('0x6d')]:_0x70d8c3['custom_field_options']?_0x70d8c3[_0xa6f7('0x6e')]:[]};})};}})[_0xa6f7('0x25')](respondWithResult(_0x5e6d94,null))[_0xa6f7('0x43')](function(_0x1f3f99){var _0x46e6c4=_0x326feb[_0xa6f7('0x2e')]['test']?0x1f4:_0x1f3f99[_0xa6f7('0x6f')]||0x1f4;logger[_0xa6f7('0x70')](_0xa6f7('0x71'),_0xa6f7('0x54'),_0x46e6c4,JSON[_0xa6f7('0x72')](_0x1f3f99));delete _0x1f3f99[_0xa6f7('0x26')];if(_0x46e6c4===0x191){_0x46e6c4=0x190;}_0x5e6d94['status'](_0x46e6c4)['send'](_0x326feb[_0xa6f7('0x2e')][_0xa6f7('0x73')]?{'message':_0xa6f7('0x74'),'statusCode':_0x1f3f99[_0xa6f7('0x6f')]}:_0x1f3f99);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index c1f9336..ae4d5aa 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 _0x4274=['request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','api','moment','bluebird'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x4274,0x176));var _0x4427=function(_0x54b648,_0x5648f0){_0x54b648=_0x54b648-0x0;var _0x4f7c5b=_0x4274[_0x54b648];return _0x4f7c5b;};'use strict';var _=require(_0x4427('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4427('0x1'));var moment=require(_0x4427('0x2'));var BPromise=require(_0x4427('0x3'));var rp=require(_0x4427('0x4'));var fs=require('fs');var path=require(_0x4427('0x5'));var rimraf=require(_0x4427('0x6'));var config=require(_0x4427('0x7'));var attributes=require(_0x4427('0x8'));var integrations=require(_0x4427('0x9'));module[_0x4427('0xa')]=function(_0x77dab0,_0x5034dd){return _0x77dab0[_0x4427('0xb')](_0x4427('0xc'),attributes,{'tableName':_0x4427('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c4d=['request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0xf7f765,_0x10c49a){var _0x587bdb=function(_0x182440){while(--_0x182440){_0xf7f765['push'](_0xf7f765['shift']());}};_0x587bdb(++_0x10c49a);}(_0x3c4d,0x1c2));var _0xd3c4=function(_0x238364,_0x505402){_0x238364=_0x238364-0x0;var _0x3a43a6=_0x3c4d[_0x238364];return _0x3a43a6;};'use strict';var _=require(_0xd3c4('0x0'));var util=require(_0xd3c4('0x1'));var logger=require(_0xd3c4('0x2'))(_0xd3c4('0x3'));var moment=require(_0xd3c4('0x4'));var BPromise=require('bluebird');var rp=require(_0xd3c4('0x5'));var fs=require('fs');var path=require(_0xd3c4('0x6'));var rimraf=require(_0xd3c4('0x7'));var config=require('../../config/environment');var attributes=require(_0xd3c4('0x8'));var integrations=require(_0xd3c4('0x9'));module[_0xd3c4('0xa')]=function(_0x313070,_0x51c069){return _0x313070['define'](_0xd3c4('0xb'),attributes,{'tableName':_0xd3c4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 890aceb..448ee53 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 _0x412d=['randomstring','../../mysqldb','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','ZendeskAccount','options','raw','attributes','limit','include','model','map','GetZendeskAccount','debug','ShowZendeskAccount','find','lodash','util','moment','bluebird'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x412d,0xfc));var _0xd412=function(_0x1af1f7,_0x297601){_0x1af1f7=_0x1af1f7-0x0;var _0x4a6da6=_0x412d[_0x1af1f7];return _0x4a6da6;};'use strict';var _=require(_0xd412('0x0'));var util=require(_0xd412('0x1'));var moment=require(_0xd412('0x2'));var BPromise=require(_0xd412('0x3'));var rs=require(_0xd412('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd412('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd412('0x6'));var client=jayson[_0xd412('0x7')][_0xd412('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f3e1f,_0x3bcc59,_0x9319f0){return new BPromise(function(_0x340133,_0x1235e9){return client[_0xd412('0x9')](_0x4f3e1f,_0x9319f0)[_0xd412('0xa')](function(_0x1df613){logger[_0xd412('0xb')](_0xd412('0xc'),_0x3bcc59,'request\x20sent');logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x3bcc59,'request\x20sent',JSON[_0xd412('0xd')](_0x1df613));if(_0x1df613['error']){if(_0x1df613['error'][_0xd412('0xe')]===0x1f4){logger[_0xd412('0xf')](_0xd412('0xc'),_0x3bcc59,_0x1df613[_0xd412('0xf')][_0xd412('0x10')]);return _0x1235e9(_0x1df613['error'][_0xd412('0x10')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x3bcc59,_0x1df613[_0xd412('0xf')][_0xd412('0x10')]);return _0x340133(_0x1df613[_0xd412('0xf')][_0xd412('0x10')]);}else{logger[_0xd412('0xb')](_0xd412('0xc'),_0x3bcc59,_0xd412('0x11'));_0x340133(_0x1df613[_0xd412('0x12')][_0xd412('0x10')]);}})[_0xd412('0x13')](function(_0xbd66d0){logger[_0xd412('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x3bcc59,_0xbd66d0);_0x1235e9(_0xbd66d0);});});}exports['GetZendeskAccount']=function(_0x5c09e8){var _0x4618af=this;return new Promise(function(_0xa94f8e,_0x421b65){return db[_0xd412('0x14')]['findAll']({'raw':_0x5c09e8[_0xd412('0x15')]?_0x5c09e8[_0xd412('0x15')][_0xd412('0x16')]===undefined?!![]:![]:!![],'where':_0x5c09e8['options']?_0x5c09e8['options']['where']||null:null,'attributes':_0x5c09e8[_0xd412('0x15')]?_0x5c09e8[_0xd412('0x15')][_0xd412('0x17')]||null:null,'limit':_0x5c09e8['options']?_0x5c09e8[_0xd412('0x15')][_0xd412('0x18')]||null:null,'include':_0x5c09e8[_0xd412('0x15')]?_0x5c09e8[_0xd412('0x15')]['include']?_['map'](_0x5c09e8['options'][_0xd412('0x19')],function(_0x3c39eb){return{'model':db[_0x3c39eb[_0xd412('0x1a')]],'as':_0x3c39eb['as'],'attributes':_0x3c39eb[_0xd412('0x17')],'include':_0x3c39eb[_0xd412('0x19')]?_[_0xd412('0x1b')](_0x3c39eb['include'],function(_0x42a533){return{'model':db[_0x42a533['model']],'as':_0x42a533['as'],'attributes':_0x42a533[_0xd412('0x17')],'include':_0x42a533['include']?_[_0xd412('0x1b')](_0x42a533[_0xd412('0x19')],function(_0x4ab1e8){return{'model':db[_0x4ab1e8['model']],'as':_0x4ab1e8['as'],'attributes':_0x4ab1e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xd412('0xa')](function(_0x4e720e){logger['info'](_0xd412('0x1c'),_0x5c09e8);logger[_0xd412('0x1d')](_0xd412('0x1c'),_0x5c09e8,JSON[_0xd412('0xd')](_0x4e720e));_0xa94f8e(_0x4e720e);})[_0xd412('0x13')](function(_0x252589){logger[_0xd412('0xf')]('GetZendeskAccount',_0x252589['message'],_0x5c09e8);_0x421b65(_0x4618af[_0xd412('0xf')](0x1f4,_0x252589[_0xd412('0x10')]));});});};exports[_0xd412('0x1e')]=function(_0x31a09b){var _0x26a452=this;return new Promise(function(_0x49ce93,_0x5b541c){return db[_0xd412('0x14')][_0xd412('0x1f')]({'raw':_0x31a09b[_0xd412('0x15')]?_0x31a09b[_0xd412('0x15')][_0xd412('0x16')]===undefined?!![]:![]:!![],'where':_0x31a09b[_0xd412('0x15')]?_0x31a09b[_0xd412('0x15')]['where']||null:null,'attributes':_0x31a09b['options']?_0x31a09b[_0xd412('0x15')][_0xd412('0x17')]||null:null,'include':_0x31a09b[_0xd412('0x15')]?_0x31a09b['options'][_0xd412('0x19')]?_['map'](_0x31a09b['options'][_0xd412('0x19')],function(_0x40dc3c){return{'model':db[_0x40dc3c[_0xd412('0x1a')]],'as':_0x40dc3c['as'],'attributes':_0x40dc3c[_0xd412('0x17')],'include':_0x40dc3c['include']?_['map'](_0x40dc3c['include'],function(_0x1ba74c){return{'model':db[_0x1ba74c[_0xd412('0x1a')]],'as':_0x1ba74c['as'],'attributes':_0x1ba74c['attributes'],'include':_0x1ba74c[_0xd412('0x19')]?_[_0xd412('0x1b')](_0x1ba74c[_0xd412('0x19')],function(_0x40df03){return{'model':db[_0x40df03[_0xd412('0x1a')]],'as':_0x40df03['as'],'attributes':_0x40df03['attributes']};}):[]};}):[]};}):[]:[]})[_0xd412('0xa')](function(_0x65ffb4){logger[_0xd412('0xb')](_0xd412('0x1e'),_0x31a09b);logger[_0xd412('0x1d')](_0xd412('0x1e'),_0x31a09b,JSON[_0xd412('0xd')](_0x65ffb4));_0x49ce93(_0x65ffb4);})[_0xd412('0x13')](function(_0xc3280){logger[_0xd412('0xf')](_0xd412('0x1e'),_0xc3280[_0xd412('0x10')],_0x31a09b);_0x5b541c(_0x26a452['error'](0x1f4,_0xc3280[_0xd412('0x10')]));});});}; \ No newline at end of file +var _0xdaf0=['client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','limit','include','map','model','attributes','ShowZendeskAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0xdaf0,0xb2));var _0x0daf=function(_0x82096d,_0x2f846a){_0x82096d=_0x82096d-0x0;var _0x270dec=_0xdaf0[_0x82096d];return _0x270dec;};'use strict';var _=require(_0x0daf('0x0'));var util=require(_0x0daf('0x1'));var moment=require(_0x0daf('0x2'));var BPromise=require(_0x0daf('0x3'));var rs=require(_0x0daf('0x4'));var fs=require('fs');var Redis=require(_0x0daf('0x5'));var db=require(_0x0daf('0x6'))['db'];var utils=require(_0x0daf('0x7'));var logger=require(_0x0daf('0x8'))(_0x0daf('0x9'));var config=require(_0x0daf('0xa'));var jayson=require(_0x0daf('0xb'));var client=jayson[_0x0daf('0xc')][_0x0daf('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2a2594,_0x29e8ef,_0x33c0e0){return new BPromise(function(_0x3fc5e4,_0x2415b4){return client[_0x0daf('0xe')](_0x2a2594,_0x33c0e0)[_0x0daf('0xf')](function(_0xd2229f){logger[_0x0daf('0x10')](_0x0daf('0x11'),_0x29e8ef,_0x0daf('0x12'));logger[_0x0daf('0x13')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x29e8ef,_0x0daf('0x12'),JSON[_0x0daf('0x14')](_0xd2229f));if(_0xd2229f[_0x0daf('0x15')]){if(_0xd2229f['error'][_0x0daf('0x16')]===0x1f4){logger[_0x0daf('0x15')]('ZendeskAccount,\x20%s,\x20%s',_0x29e8ef,_0xd2229f[_0x0daf('0x15')][_0x0daf('0x17')]);return _0x2415b4(_0xd2229f[_0x0daf('0x15')]['message']);}logger[_0x0daf('0x15')](_0x0daf('0x11'),_0x29e8ef,_0xd2229f[_0x0daf('0x15')][_0x0daf('0x17')]);return _0x3fc5e4(_0xd2229f[_0x0daf('0x15')][_0x0daf('0x17')]);}else{logger[_0x0daf('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x29e8ef,_0x0daf('0x12'));_0x3fc5e4(_0xd2229f[_0x0daf('0x18')][_0x0daf('0x17')]);}})[_0x0daf('0x19')](function(_0x2a8a2d){logger[_0x0daf('0x15')](_0x0daf('0x11'),_0x29e8ef,_0x2a8a2d);_0x2415b4(_0x2a8a2d);});});}exports[_0x0daf('0x1a')]=function(_0x46948a){var _0x453741=this;return new Promise(function(_0xe9058b,_0x511af6){return db[_0x0daf('0x1b')][_0x0daf('0x1c')]({'raw':_0x46948a[_0x0daf('0x1d')]?_0x46948a[_0x0daf('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x46948a[_0x0daf('0x1d')]?_0x46948a['options'][_0x0daf('0x1e')]||null:null,'attributes':_0x46948a[_0x0daf('0x1d')]?_0x46948a[_0x0daf('0x1d')]['attributes']||null:null,'limit':_0x46948a[_0x0daf('0x1d')]?_0x46948a[_0x0daf('0x1d')][_0x0daf('0x1f')]||null:null,'include':_0x46948a[_0x0daf('0x1d')]?_0x46948a[_0x0daf('0x1d')][_0x0daf('0x20')]?_[_0x0daf('0x21')](_0x46948a['options']['include'],function(_0x4c1175){return{'model':db[_0x4c1175[_0x0daf('0x22')]],'as':_0x4c1175['as'],'attributes':_0x4c1175[_0x0daf('0x23')],'include':_0x4c1175[_0x0daf('0x20')]?_[_0x0daf('0x21')](_0x4c1175['include'],function(_0x3e0952){return{'model':db[_0x3e0952[_0x0daf('0x22')]],'as':_0x3e0952['as'],'attributes':_0x3e0952[_0x0daf('0x23')],'include':_0x3e0952[_0x0daf('0x20')]?_[_0x0daf('0x21')](_0x3e0952[_0x0daf('0x20')],function(_0x4ace38){return{'model':db[_0x4ace38[_0x0daf('0x22')]],'as':_0x4ace38['as'],'attributes':_0x4ace38['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b9278){logger[_0x0daf('0x10')]('GetZendeskAccount',_0x46948a);logger[_0x0daf('0x13')]('GetZendeskAccount',_0x46948a,JSON[_0x0daf('0x14')](_0x3b9278));_0xe9058b(_0x3b9278);})[_0x0daf('0x19')](function(_0x433c2d){logger[_0x0daf('0x15')](_0x0daf('0x1a'),_0x433c2d['message'],_0x46948a);_0x511af6(_0x453741[_0x0daf('0x15')](0x1f4,_0x433c2d[_0x0daf('0x17')]));});});};exports[_0x0daf('0x24')]=function(_0x46ef29){var _0x230d91=this;return new Promise(function(_0x2d2486,_0xa09db2){return db['ZendeskAccount']['find']({'raw':_0x46ef29[_0x0daf('0x1d')]?_0x46ef29[_0x0daf('0x1d')][_0x0daf('0x25')]===undefined?!![]:![]:!![],'where':_0x46ef29[_0x0daf('0x1d')]?_0x46ef29[_0x0daf('0x1d')][_0x0daf('0x1e')]||null:null,'attributes':_0x46ef29[_0x0daf('0x1d')]?_0x46ef29['options'][_0x0daf('0x23')]||null:null,'include':_0x46ef29[_0x0daf('0x1d')]?_0x46ef29[_0x0daf('0x1d')][_0x0daf('0x20')]?_['map'](_0x46ef29[_0x0daf('0x1d')][_0x0daf('0x20')],function(_0x317004){return{'model':db[_0x317004[_0x0daf('0x22')]],'as':_0x317004['as'],'attributes':_0x317004[_0x0daf('0x23')],'include':_0x317004[_0x0daf('0x20')]?_[_0x0daf('0x21')](_0x317004[_0x0daf('0x20')],function(_0x1fad47){return{'model':db[_0x1fad47['model']],'as':_0x1fad47['as'],'attributes':_0x1fad47[_0x0daf('0x23')],'include':_0x1fad47[_0x0daf('0x20')]?_[_0x0daf('0x21')](_0x1fad47[_0x0daf('0x20')],function(_0x2ddc89){return{'model':db[_0x2ddc89['model']],'as':_0x2ddc89['as'],'attributes':_0x2ddc89[_0x0daf('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x383ce1){logger['info'](_0x0daf('0x24'),_0x46ef29);logger[_0x0daf('0x13')]('ShowZendeskAccount',_0x46ef29,JSON[_0x0daf('0x14')](_0x383ce1));_0x2d2486(_0x383ce1);})['catch'](function(_0x38bd2a){logger['error'](_0x0daf('0x24'),_0x38bd2a[_0x0daf('0x17')],_0x46ef29);_0xa09db2(_0x230d91[_0x0daf('0x15')](0x1f4,_0x38bd2a['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 21d8fd2..b72ae3b 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 _0x5c00=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/tags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0x5ee61b,_0x57dd69){var _0x3bb49e=function(_0x534b52){while(--_0x534b52){_0x5ee61b['push'](_0x5ee61b['shift']());}};_0x3bb49e(++_0x57dd69);}(_0x5c00,0x17e));var _0x05c0=function(_0x13fcaf,_0x416c69){_0x13fcaf=_0x13fcaf-0x0;var _0x4fa631=_0x5c00[_0x13fcaf];return _0x4fa631;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id/fields',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/descriptions',auth[_0x05c0('0x9')](),controller['getDescriptions']);router[_0x05c0('0x8')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller['getTags']);router[_0x05c0('0x10')]('/',auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0x10')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x12')]);router[_0x05c0('0x13')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller['update']);router[_0x05c0('0x15')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x16')]);module[_0x05c0('0x17')]=router; \ No newline at end of file +var _0x0713=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x4e6ffc,_0xe2e373){var _0x2ba7ac=function(_0xa02f18){while(--_0xa02f18){_0x4e6ffc['push'](_0x4e6ffc['shift']());}};_0x2ba7ac(++_0xe2e373);}(_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'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getFields']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/descriptions',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x8')](_0x3071('0x11'),auth[_0x3071('0x9')](),controller['getTags']);router['post']('/',auth[_0x3071('0x9')](),controller['create']);router[_0x3071('0x12')](_0x3071('0x11'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x14')]);router[_0x3071('0x15')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x16')]);module[_0x3071('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 4023292..f4e9efe 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 _0x944e=['STRING','sequelize','exports'];(function(_0xf3ec54,_0x54a80f){var _0x2edb9a=function(_0x2177d8){while(--_0x2177d8){_0xf3ec54['push'](_0xf3ec54['shift']());}};_0x2edb9a(++_0x54a80f);}(_0x944e,0x15a));var _0xe944=function(_0xff7175,_0xd10aa5){_0xff7175=_0xff7175-0x0;var _0x3fd1c9=_0x944e[_0xff7175];return _0x3fd1c9;};'use strict';var Sequelize=require(_0xe944('0x0'));module[_0xe944('0x1')]={'name':{'type':Sequelize[_0xe944('0x2')]},'description':{'type':Sequelize[_0xe944('0x2')]}}; \ No newline at end of file +var _0xc059=['STRING','exports'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xc059,0xbb));var _0x9c05=function(_0x5eb6e6,_0x17f551){_0x5eb6e6=_0x5eb6e6-0x0;var _0x35c38b=_0xc059[_0x5eb6e6];return _0x35c38b;};'use strict';var Sequelize=require('sequelize');module[_0x9c05('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9c05('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 1713789..d131c5d 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 _0x6139=['then','destroy','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','where','pick','filter','merge','include','findAll','rows','show','params','length','includeAll','options','find','catch','create','body','getFields','findOne','ZendeskField','order','sort','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','apply','reject','save','update'];(function(_0x1f6fd5,_0x399cb0){var _0x587d12=function(_0x4d26e8){while(--_0x4d26e8){_0x1f6fd5['push'](_0x1f6fd5['shift']());}};_0x587d12(++_0x399cb0);}(_0x6139,0x1ea));var _0x9613=function(_0x5c9070,_0x3271d1){_0x5c9070=_0x5c9070-0x0;var _0x54b5af=_0x6139[_0x5c9070];return _0x54b5af;};'use strict';var emlformat=require(_0x9613('0x0'));var rimraf=require(_0x9613('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9613('0x2'));var rp=require('request-promise');var moment=require(_0x9613('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9613('0x4'));var util=require(_0x9613('0x5'));var path=require(_0x9613('0x6'));var sox=require(_0x9613('0x7'));var csv=require(_0x9613('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9613('0x9'));var _=require(_0x9613('0xa'));var squel=require(_0x9613('0xb'));var crypto=require(_0x9613('0xc'));var jsforce=require(_0x9613('0xd'));var deskjs=require(_0x9613('0xe'));var toCsv=require(_0x9613('0x8'));var querystring=require(_0x9613('0xf'));var Papa=require('papaparse');var Redis=require(_0x9613('0x10'));var authService=require(_0x9613('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9613('0x12'));var hardwareService=require(_0x9613('0x13'));var logger=require(_0x9613('0x14'))(_0x9613('0x15'));var utils=require(_0x9613('0x16'));var config=require(_0x9613('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9613('0x18'))['db'];function respondWithStatusCode(_0x501972,_0x4f1e52){_0x4f1e52=_0x4f1e52||0xcc;return function(_0x29ce98){if(_0x29ce98){return _0x501972[_0x9613('0x19')](_0x4f1e52);}return _0x501972[_0x9613('0x1a')](_0x4f1e52)[_0x9613('0x1b')]();};}function respondWithResult(_0x9d89f8,_0x464d4d){_0x464d4d=_0x464d4d||0xc8;return function(_0x445f6f){if(_0x445f6f){return _0x9d89f8[_0x9613('0x1a')](_0x464d4d)[_0x9613('0x1c')](_0x445f6f);}};}function respondWithFilteredResult(_0x5d0144,_0x1ad0a8){return function(_0x54a889){if(_0x54a889){var _0x1ab59b=typeof _0x1ad0a8['offset']==='undefined'&&typeof _0x1ad0a8[_0x9613('0x1d')]===_0x9613('0x1e');var _0x5016d7=_0x54a889[_0x9613('0x1f')];var _0x5c969c=_0x1ab59b?0x0:_0x1ad0a8['offset'];var _0x213d2b=_0x1ab59b?_0x54a889[_0x9613('0x1f')]:_0x1ad0a8['offset']+_0x1ad0a8[_0x9613('0x1d')];var _0x8d7621;if(_0x213d2b>=_0x5016d7){_0x213d2b=_0x5016d7;_0x8d7621=0xc8;}else{_0x8d7621=0xce;}_0x5d0144['status'](_0x8d7621);return _0x5d0144[_0x9613('0x20')](_0x9613('0x21'),_0x5c969c+'-'+_0x213d2b+'/'+_0x5016d7)[_0x9613('0x1c')](_0x54a889);}return null;};}function patchUpdates(_0xdca5be){return function(_0x85cbf9){try{jsonpatch[_0x9613('0x22')](_0x85cbf9,_0xdca5be,!![]);}catch(_0x285d95){return BPromise[_0x9613('0x23')](_0x285d95);}return _0x85cbf9[_0x9613('0x24')]();};}function saveUpdates(_0x2aa489,_0x8c0e18){return function(_0x50ca6e){if(_0x50ca6e){return _0x50ca6e[_0x9613('0x25')](_0x2aa489)[_0x9613('0x26')](function(_0x1c61b0){return _0x1c61b0;});}return null;};}function removeEntity(_0x2f4e29,_0x330483){return function(_0x5243a0){if(_0x5243a0){return _0x5243a0[_0x9613('0x27')]()[_0x9613('0x26')](function(){_0x2f4e29[_0x9613('0x1a')](0xcc)[_0x9613('0x1b')]();});}};}function handleEntityNotFound(_0x384e0d,_0x465ddb){return function(_0x5cb19c){if(!_0x5cb19c){_0x384e0d['sendStatus'](0x194);}return _0x5cb19c;};}function handleError(_0x20f2b3,_0x56ec82){_0x56ec82=_0x56ec82||0x1f4;return function(_0x2134bf){logger[_0x9613('0x28')](_0x2134bf[_0x9613('0x29')]);if(_0x2134bf[_0x9613('0x2a')]){delete _0x2134bf['name'];}_0x20f2b3[_0x9613('0x1a')](_0x56ec82)[_0x9613('0x2b')](_0x2134bf);};}exports[_0x9613('0x2c')]=function(_0x50410f,_0x5ac829){var _0x32b53f={},_0x4b74cd={},_0x120d66={'count':0x0,'rows':[]};var _0x2a7257=_['map'](db[_0x9613('0x2d')][_0x9613('0x2e')],function(_0x13376a){return{'name':_0x13376a[_0x9613('0x2f')],'type':_0x13376a[_0x9613('0x30')][_0x9613('0x31')]};});_0x4b74cd[_0x9613('0x32')]=_[_0x9613('0x33')](_0x2a7257,_0x9613('0x2a'));_0x4b74cd[_0x9613('0x34')]=_[_0x9613('0x35')](_0x50410f['query']);_0x4b74cd[_0x9613('0x36')]=_[_0x9613('0x37')](_0x4b74cd['model'],_0x4b74cd[_0x9613('0x34')]);_0x32b53f[_0x9613('0x38')]=_[_0x9613('0x37')](_0x4b74cd['model'],qs[_0x9613('0x39')](_0x50410f[_0x9613('0x34')]['fields']));_0x32b53f[_0x9613('0x38')]=_0x32b53f['attributes']['length']?_0x32b53f['attributes']:_0x4b74cd[_0x9613('0x32')];if(!_0x50410f['query'][_0x9613('0x3a')](_0x9613('0x3b'))){_0x32b53f[_0x9613('0x1d')]=qs[_0x9613('0x1d')](_0x50410f[_0x9613('0x34')][_0x9613('0x1d')]);_0x32b53f[_0x9613('0x3c')]=qs[_0x9613('0x3c')](_0x50410f['query'][_0x9613('0x3c')]);}_0x32b53f['order']=qs['sort'](_0x50410f[_0x9613('0x34')]['sort']);_0x32b53f[_0x9613('0x3d')]=qs['filters'](_[_0x9613('0x3e')](_0x50410f[_0x9613('0x34')],_0x4b74cd[_0x9613('0x36')]),_0x2a7257);if(_0x50410f['query'][_0x9613('0x3f')]){_0x32b53f[_0x9613('0x3d')]=_[_0x9613('0x40')](_0x32b53f[_0x9613('0x3d')],{'$or':_[_0x9613('0x33')](_0x2a7257,function(_0x545fcc){if(_0x545fcc[_0x9613('0x30')]!=='VIRTUAL'){var _0x9b6cc5={};_0x9b6cc5[_0x545fcc[_0x9613('0x2a')]]={'$like':'%'+_0x50410f[_0x9613('0x34')][_0x9613('0x3f')]+'%'};return _0x9b6cc5;}})});}_0x32b53f=_[_0x9613('0x40')]({},_0x32b53f,_0x50410f['options']);var _0x52eed9={'where':_0x32b53f[_0x9613('0x3d')]};return db[_0x9613('0x2d')][_0x9613('0x1f')](_0x52eed9)[_0x9613('0x26')](function(_0x3c1380){_0x120d66[_0x9613('0x1f')]=_0x3c1380;if(_0x50410f[_0x9613('0x34')]['includeAll']){_0x32b53f[_0x9613('0x41')]=[{'all':!![]}];}return db[_0x9613('0x2d')][_0x9613('0x42')](_0x32b53f);})[_0x9613('0x26')](function(_0x1f80ca){_0x120d66[_0x9613('0x43')]=_0x1f80ca;return _0x120d66;})[_0x9613('0x26')](respondWithFilteredResult(_0x5ac829,_0x32b53f))['catch'](handleError(_0x5ac829,null));};exports[_0x9613('0x44')]=function(_0x2b9d5f,_0x34541e){var _0x13a5d9={'raw':![],'where':{'id':_0x2b9d5f[_0x9613('0x45')]['id']}},_0x34a017={};_0x34a017[_0x9613('0x32')]=_[_0x9613('0x35')](db[_0x9613('0x2d')][_0x9613('0x2e')]);_0x34a017[_0x9613('0x34')]=_[_0x9613('0x35')](_0x2b9d5f[_0x9613('0x34')]);_0x34a017[_0x9613('0x36')]=_['intersection'](_0x34a017[_0x9613('0x32')],_0x34a017[_0x9613('0x34')]);_0x13a5d9['attributes']=_[_0x9613('0x37')](_0x34a017[_0x9613('0x32')],qs['fields'](_0x2b9d5f['query'][_0x9613('0x39')]));_0x13a5d9[_0x9613('0x38')]=_0x13a5d9[_0x9613('0x38')][_0x9613('0x46')]?_0x13a5d9[_0x9613('0x38')]:_0x34a017[_0x9613('0x32')];if(_0x2b9d5f[_0x9613('0x34')][_0x9613('0x47')]){_0x13a5d9[_0x9613('0x41')]=[{'all':!![]}];}_0x13a5d9=_['merge']({},_0x13a5d9,_0x2b9d5f[_0x9613('0x48')]);return db['ZendeskConfiguration'][_0x9613('0x49')](_0x13a5d9)[_0x9613('0x26')](handleEntityNotFound(_0x34541e,null))['then'](respondWithResult(_0x34541e,null))[_0x9613('0x4a')](handleError(_0x34541e,null));};exports[_0x9613('0x4b')]=function(_0x56c7f5,_0x447cf9){return db[_0x9613('0x2d')]['create'](_0x56c7f5[_0x9613('0x4c')],{})[_0x9613('0x26')](respondWithResult(_0x447cf9,0xc9))['catch'](handleError(_0x447cf9,null));};exports[_0x9613('0x25')]=function(_0x3be73e,_0x27da78){if(_0x3be73e[_0x9613('0x4c')]['id']){delete _0x3be73e[_0x9613('0x4c')]['id'];}return db[_0x9613('0x2d')][_0x9613('0x49')]({'where':{'id':_0x3be73e[_0x9613('0x45')]['id']}})[_0x9613('0x26')](handleEntityNotFound(_0x27da78,null))[_0x9613('0x26')](saveUpdates(_0x3be73e[_0x9613('0x4c')],null))[_0x9613('0x26')](respondWithResult(_0x27da78,null))['catch'](handleError(_0x27da78,null));};exports[_0x9613('0x27')]=function(_0x24589f,_0x47c47d){return db[_0x9613('0x2d')][_0x9613('0x49')]({'where':{'id':_0x24589f['params']['id']}})[_0x9613('0x26')](handleEntityNotFound(_0x47c47d,null))[_0x9613('0x26')](removeEntity(_0x47c47d,null))['catch'](handleError(_0x47c47d,null));};exports[_0x9613('0x4d')]=function(_0x581079,_0x5cded1,_0x235e65){var _0x4d1408={};var _0xf44d5a={};var _0x28a43d;var _0x33c43e;return db[_0x9613('0x2d')][_0x9613('0x4e')]({'where':{'id':_0x581079['params']['id']}})[_0x9613('0x26')](handleEntityNotFound(_0x5cded1,null))[_0x9613('0x26')](function(_0x5734f8){if(_0x5734f8){_0x28a43d=_0x5734f8;_0xf44d5a[_0x9613('0x32')]=_['keys'](db[_0x9613('0x4f')]['rawAttributes']);_0xf44d5a[_0x9613('0x34')]=_[_0x9613('0x35')](_0x581079[_0x9613('0x34')]);_0xf44d5a[_0x9613('0x36')]=_['intersection'](_0xf44d5a['model'],_0xf44d5a[_0x9613('0x34')]);_0x4d1408['attributes']=_['intersection'](_0xf44d5a[_0x9613('0x32')],qs[_0x9613('0x39')](_0x581079['query'][_0x9613('0x39')]));_0x4d1408[_0x9613('0x38')]=_0x4d1408[_0x9613('0x38')][_0x9613('0x46')]?_0x4d1408[_0x9613('0x38')]:_0xf44d5a['model'];_0x4d1408[_0x9613('0x50')]=qs[_0x9613('0x51')](_0x581079[_0x9613('0x34')][_0x9613('0x51')]);_0x4d1408[_0x9613('0x3d')]=qs[_0x9613('0x36')](_[_0x9613('0x3e')](_0x581079[_0x9613('0x34')],_0xf44d5a[_0x9613('0x36')]));if(_0x581079[_0x9613('0x34')][_0x9613('0x3f')]){_0x4d1408[_0x9613('0x3d')]=_['merge'](_0x4d1408[_0x9613('0x3d')],{'$or':_['map'](_0x4d1408['attributes'],function(_0x29c849){var _0x5c2a24={};_0x5c2a24[_0x29c849]={'$like':'%'+_0x581079[_0x9613('0x34')]['filter']+'%'};return _0x5c2a24;})});}_0x4d1408=_[_0x9613('0x40')]({},_0x4d1408,_0x581079[_0x9613('0x48')]);return _0x28a43d['getFields'](_0x4d1408);}})[_0x9613('0x26')](function(_0x5dd629){if(_0x5dd629){_0x33c43e=_0x5dd629[_0x9613('0x46')];if(!_0x581079[_0x9613('0x34')][_0x9613('0x3a')](_0x9613('0x3b'))){_0x4d1408[_0x9613('0x1d')]=qs[_0x9613('0x1d')](_0x581079[_0x9613('0x34')][_0x9613('0x1d')]);_0x4d1408[_0x9613('0x3c')]=qs[_0x9613('0x3c')](_0x581079[_0x9613('0x34')]['offset']);}return _0x28a43d[_0x9613('0x4d')](_0x4d1408);}})[_0x9613('0x26')](function(_0x18de58){if(_0x18de58){return _0x18de58?{'count':_0x33c43e,'rows':_0x18de58}:null;}})[_0x9613('0x26')](respondWithResult(_0x5cded1,null))[_0x9613('0x4a')](handleError(_0x5cded1,null));};exports[_0x9613('0x52')]=function(_0x4e6a15,_0x1c3245,_0x270629){var _0x281110={};var _0x256c3c={};var _0x3bdee9;var _0x136669;return db[_0x9613('0x2d')][_0x9613('0x4e')]({'where':{'id':_0x4e6a15[_0x9613('0x45')]['id']}})[_0x9613('0x26')](handleEntityNotFound(_0x1c3245,null))[_0x9613('0x26')](function(_0x4b888e){if(_0x4b888e){_0x3bdee9=_0x4b888e;_0x256c3c[_0x9613('0x32')]=_[_0x9613('0x35')](db[_0x9613('0x4f')][_0x9613('0x2e')]);_0x256c3c[_0x9613('0x34')]=_[_0x9613('0x35')](_0x4e6a15[_0x9613('0x34')]);_0x256c3c[_0x9613('0x36')]=_[_0x9613('0x37')](_0x256c3c['model'],_0x256c3c[_0x9613('0x34')]);_0x281110[_0x9613('0x38')]=_['intersection'](_0x256c3c[_0x9613('0x32')],qs[_0x9613('0x39')](_0x4e6a15['query'][_0x9613('0x39')]));_0x281110[_0x9613('0x38')]=_0x281110[_0x9613('0x38')][_0x9613('0x46')]?_0x281110['attributes']:_0x256c3c[_0x9613('0x32')];_0x281110[_0x9613('0x50')]=qs[_0x9613('0x51')](_0x4e6a15[_0x9613('0x34')][_0x9613('0x51')]);_0x281110['where']=qs['filters'](_[_0x9613('0x3e')](_0x4e6a15[_0x9613('0x34')],_0x256c3c['filters']));if(_0x4e6a15[_0x9613('0x34')]['filter']){_0x281110[_0x9613('0x3d')]=_['merge'](_0x281110[_0x9613('0x3d')],{'$or':_['map'](_0x281110[_0x9613('0x38')],function(_0x2f6d4e){var _0x427bd6={};_0x427bd6[_0x2f6d4e]={'$like':'%'+_0x4e6a15[_0x9613('0x34')][_0x9613('0x3f')]+'%'};return _0x427bd6;})});}_0x281110=_[_0x9613('0x40')]({},_0x281110,_0x4e6a15['options']);return _0x3bdee9[_0x9613('0x52')](_0x281110);}})['then'](function(_0x4823ab){if(_0x4823ab){_0x136669=_0x4823ab[_0x9613('0x46')];if(!_0x4e6a15[_0x9613('0x34')]['hasOwnProperty'](_0x9613('0x3b'))){_0x281110[_0x9613('0x1d')]=qs[_0x9613('0x1d')](_0x4e6a15[_0x9613('0x34')]['limit']);_0x281110[_0x9613('0x3c')]=qs['offset'](_0x4e6a15[_0x9613('0x34')]['offset']);}return _0x3bdee9[_0x9613('0x52')](_0x281110);}})['then'](function(_0x20a331){if(_0x20a331){return _0x20a331?{'count':_0x136669,'rows':_0x20a331}:null;}})[_0x9613('0x26')](respondWithResult(_0x1c3245,null))['catch'](handleError(_0x1c3245,null));};exports[_0x9613('0x53')]=function(_0x107039,_0x283115,_0x13733d){var _0x279e63={};var _0x54e76a={};var _0x498be3;var _0x4bb1d6;return db[_0x9613('0x2d')][_0x9613('0x4e')]({'where':{'id':_0x107039[_0x9613('0x45')]['id']}})[_0x9613('0x26')](handleEntityNotFound(_0x283115,null))['then'](function(_0x3e07ef){if(_0x3e07ef){_0x498be3=_0x3e07ef;_0x54e76a[_0x9613('0x32')]=_[_0x9613('0x35')](db[_0x9613('0x4f')]['rawAttributes']);_0x54e76a['query']=_[_0x9613('0x35')](_0x107039[_0x9613('0x34')]);_0x54e76a[_0x9613('0x36')]=_[_0x9613('0x37')](_0x54e76a['model'],_0x54e76a[_0x9613('0x34')]);_0x279e63[_0x9613('0x38')]=_[_0x9613('0x37')](_0x54e76a[_0x9613('0x32')],qs[_0x9613('0x39')](_0x107039[_0x9613('0x34')][_0x9613('0x39')]));_0x279e63[_0x9613('0x38')]=_0x279e63[_0x9613('0x38')]['length']?_0x279e63[_0x9613('0x38')]:_0x54e76a[_0x9613('0x32')];_0x279e63[_0x9613('0x50')]=qs[_0x9613('0x51')](_0x107039[_0x9613('0x34')][_0x9613('0x51')]);_0x279e63[_0x9613('0x3d')]=qs[_0x9613('0x36')](_[_0x9613('0x3e')](_0x107039[_0x9613('0x34')],_0x54e76a['filters']));if(_0x107039[_0x9613('0x34')]['filter']){_0x279e63[_0x9613('0x3d')]=_['merge'](_0x279e63[_0x9613('0x3d')],{'$or':_['map'](_0x279e63['attributes'],function(_0x1ee2c9){var _0x5f0f48={};_0x5f0f48[_0x1ee2c9]={'$like':'%'+_0x107039[_0x9613('0x34')][_0x9613('0x3f')]+'%'};return _0x5f0f48;})});}_0x279e63=_[_0x9613('0x40')]({},_0x279e63,_0x107039[_0x9613('0x48')]);return _0x498be3[_0x9613('0x53')](_0x279e63);}})[_0x9613('0x26')](function(_0x37f2d4){if(_0x37f2d4){_0x4bb1d6=_0x37f2d4[_0x9613('0x46')];if(!_0x107039[_0x9613('0x34')][_0x9613('0x3a')](_0x9613('0x3b'))){_0x279e63[_0x9613('0x1d')]=qs[_0x9613('0x1d')](_0x107039[_0x9613('0x34')][_0x9613('0x1d')]);_0x279e63[_0x9613('0x3c')]=qs[_0x9613('0x3c')](_0x107039[_0x9613('0x34')][_0x9613('0x3c')]);}return _0x498be3[_0x9613('0x53')](_0x279e63);}})[_0x9613('0x26')](function(_0x30f8f9){if(_0x30f8f9){return _0x30f8f9?{'count':_0x4bb1d6,'rows':_0x30f8f9}:null;}})[_0x9613('0x26')](respondWithResult(_0x283115,null))[_0x9613('0x4a')](handleError(_0x283115,null));};exports[_0x9613('0x54')]=function(_0x1e7f67,_0xb98ef0,_0x25ebb7){var _0x2ea349={};var _0x34b0ff={};var _0x43b6e6;var _0x3ec164;return db[_0x9613('0x2d')]['findOne']({'where':{'id':_0x1e7f67['params']['id']}})[_0x9613('0x26')](handleEntityNotFound(_0xb98ef0,null))[_0x9613('0x26')](function(_0x26b8f3){if(_0x26b8f3){_0x43b6e6=_0x26b8f3;_0x34b0ff[_0x9613('0x32')]=_[_0x9613('0x35')](db[_0x9613('0x55')][_0x9613('0x2e')]);_0x34b0ff[_0x9613('0x34')]=_[_0x9613('0x35')](_0x1e7f67[_0x9613('0x34')]);_0x34b0ff[_0x9613('0x36')]=_[_0x9613('0x37')](_0x34b0ff[_0x9613('0x32')],_0x34b0ff[_0x9613('0x34')]);_0x2ea349[_0x9613('0x38')]=_[_0x9613('0x37')](_0x34b0ff['model'],qs[_0x9613('0x39')](_0x1e7f67[_0x9613('0x34')]['fields']));_0x2ea349[_0x9613('0x38')]=_0x2ea349[_0x9613('0x38')]['length']?_0x2ea349['attributes']:_0x34b0ff[_0x9613('0x32')];_0x2ea349[_0x9613('0x50')]=qs[_0x9613('0x51')](_0x1e7f67[_0x9613('0x34')][_0x9613('0x51')]);_0x2ea349[_0x9613('0x3d')]=qs[_0x9613('0x36')](_[_0x9613('0x3e')](_0x1e7f67[_0x9613('0x34')],_0x34b0ff[_0x9613('0x36')]));if(_0x1e7f67[_0x9613('0x34')][_0x9613('0x3f')]){_0x2ea349[_0x9613('0x3d')]=_[_0x9613('0x40')](_0x2ea349['where'],{'$or':_[_0x9613('0x33')](_0x2ea349[_0x9613('0x38')],function(_0x1bdc5d){var _0x3eb735={};_0x3eb735[_0x1bdc5d]={'$like':'%'+_0x1e7f67[_0x9613('0x34')][_0x9613('0x3f')]+'%'};return _0x3eb735;})});}_0x2ea349=_['merge']({},_0x2ea349,_0x1e7f67[_0x9613('0x48')]);return _0x43b6e6[_0x9613('0x54')](_0x2ea349);}})[_0x9613('0x26')](function(_0x5abf43){if(_0x5abf43){_0x3ec164=_0x5abf43[_0x9613('0x46')];if(!_0x1e7f67[_0x9613('0x34')][_0x9613('0x3a')](_0x9613('0x3b'))){_0x2ea349['limit']=qs['limit'](_0x1e7f67[_0x9613('0x34')][_0x9613('0x1d')]);_0x2ea349[_0x9613('0x3c')]=qs['offset'](_0x1e7f67['query'][_0x9613('0x3c')]);}return _0x43b6e6[_0x9613('0x54')](_0x2ea349);}})[_0x9613('0x26')](function(_0x36ac94){if(_0x36ac94){return _0x36ac94?{'count':_0x3ec164,'rows':_0x36ac94}:null;}})['then'](respondWithResult(_0xb98ef0,null))[_0x9613('0x4a')](handleError(_0xb98ef0,null));};exports['setTags']=function(_0x2f02b1,_0x24304a,_0x51c811){if(_0x2f02b1['body']['id']){delete _0x2f02b1[_0x9613('0x4c')]['id'];}return db[_0x9613('0x2d')][_0x9613('0x4e')]({'where':{'id':_0x2f02b1[_0x9613('0x45')]['id']}})['then'](handleEntityNotFound(_0x24304a,null))[_0x9613('0x26')](function(_0xe2bb6){if(_0xe2bb6){return _0xe2bb6[_0x9613('0x56')](_0x2f02b1[_0x9613('0x4c')][_0x9613('0x57')]||[]);}return null;})[_0x9613('0x26')](respondWithResult(_0x24304a,null))[_0x9613('0x4a')](handleError(_0x24304a,null));}; \ No newline at end of file +var _0x1740=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','destroy','then','end','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','getFields','ZendeskField','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','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'];(function(_0x52960b,_0x1f3321){var _0x520ed8=function(_0x542aa1){while(--_0x542aa1){_0x52960b['push'](_0x52960b['shift']());}};_0x520ed8(++_0x1f3321);}(_0x1740,0x18a));var _0x0174=function(_0xe659cb,_0x104ce2){_0xe659cb=_0xe659cb-0x0;var _0x5ddc1d=_0x1740[_0xe659cb];return _0x5ddc1d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0174('0x0'));var zipdir=require(_0x0174('0x1'));var jsonpatch=require(_0x0174('0x2'));var rp=require(_0x0174('0x3'));var moment=require(_0x0174('0x4'));var BPromise=require(_0x0174('0x5'));var Mustache=require(_0x0174('0x6'));var util=require('util');var path=require(_0x0174('0x7'));var sox=require(_0x0174('0x8'));var csv=require(_0x0174('0x9'));var ejs=require(_0x0174('0xa'));var fs=require('fs');var fs_extra=require(_0x0174('0xb'));var _=require('lodash');var squel=require(_0x0174('0xc'));var crypto=require(_0x0174('0xd'));var jsforce=require(_0x0174('0xe'));var deskjs=require(_0x0174('0xf'));var toCsv=require(_0x0174('0x9'));var querystring=require(_0x0174('0x10'));var Papa=require(_0x0174('0x11'));var Redis=require(_0x0174('0x12'));var authService=require(_0x0174('0x13'));var qs=require(_0x0174('0x14'));var as=require(_0x0174('0x15'));var hardwareService=require(_0x0174('0x16'));var logger=require('../../config/logger')(_0x0174('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0174('0x18'));var db=require(_0x0174('0x19'))['db'];function respondWithStatusCode(_0x4d5590,_0x30213c){_0x30213c=_0x30213c||0xcc;return function(_0x13c991){if(_0x13c991){return _0x4d5590[_0x0174('0x1a')](_0x30213c);}return _0x4d5590[_0x0174('0x1b')](_0x30213c)['end']();};}function respondWithResult(_0x3dd5ed,_0x3b1013){_0x3b1013=_0x3b1013||0xc8;return function(_0x4640ba){if(_0x4640ba){return _0x3dd5ed['status'](_0x3b1013)[_0x0174('0x1c')](_0x4640ba);}};}function respondWithFilteredResult(_0x10fc10,_0x18dac7){return function(_0x17a303){if(_0x17a303){var _0x177e0d=typeof _0x18dac7['offset']===_0x0174('0x1d')&&typeof _0x18dac7[_0x0174('0x1e')]===_0x0174('0x1d');var _0x287140=_0x17a303[_0x0174('0x1f')];var _0x54897c=_0x177e0d?0x0:_0x18dac7[_0x0174('0x20')];var _0x401417=_0x177e0d?_0x17a303[_0x0174('0x1f')]:_0x18dac7['offset']+_0x18dac7[_0x0174('0x1e')];var _0xfa9913;if(_0x401417>=_0x287140){_0x401417=_0x287140;_0xfa9913=0xc8;}else{_0xfa9913=0xce;}_0x10fc10['status'](_0xfa9913);return _0x10fc10[_0x0174('0x21')](_0x0174('0x22'),_0x54897c+'-'+_0x401417+'/'+_0x287140)['json'](_0x17a303);}return null;};}function patchUpdates(_0x5cfe81){return function(_0x510b11){try{jsonpatch['apply'](_0x510b11,_0x5cfe81,!![]);}catch(_0x37e2ac){return BPromise[_0x0174('0x23')](_0x37e2ac);}return _0x510b11['save']();};}function saveUpdates(_0x4d430f,_0x568777){return function(_0x4488ed){if(_0x4488ed){return _0x4488ed['update'](_0x4d430f)['then'](function(_0x5b7b0d){return _0x5b7b0d;});}return null;};}function removeEntity(_0xeb04a1,_0x39fba6){return function(_0x89af08){if(_0x89af08){return _0x89af08[_0x0174('0x24')]()[_0x0174('0x25')](function(){_0xeb04a1[_0x0174('0x1b')](0xcc)[_0x0174('0x26')]();});}};}function handleEntityNotFound(_0x3084e2,_0x5c2122){return function(_0x43b2ba){if(!_0x43b2ba){_0x3084e2[_0x0174('0x1a')](0x194);}return _0x43b2ba;};}function handleError(_0x45e599,_0x5f024f){_0x5f024f=_0x5f024f||0x1f4;return function(_0x1403fe){logger[_0x0174('0x27')](_0x1403fe[_0x0174('0x28')]);if(_0x1403fe[_0x0174('0x29')]){delete _0x1403fe['name'];}_0x45e599[_0x0174('0x1b')](_0x5f024f)['send'](_0x1403fe);};}exports[_0x0174('0x2a')]=function(_0x4da1b2,_0x1ce56b){var _0x32d97c={},_0x4c7a2d={},_0x18f541={'count':0x0,'rows':[]};var _0x255b97=_[_0x0174('0x2b')](db[_0x0174('0x2c')][_0x0174('0x2d')],function(_0x1984b9){return{'name':_0x1984b9['fieldName'],'type':_0x1984b9[_0x0174('0x2e')][_0x0174('0x2f')]};});_0x4c7a2d[_0x0174('0x30')]=_[_0x0174('0x2b')](_0x255b97,_0x0174('0x29'));_0x4c7a2d[_0x0174('0x31')]=_[_0x0174('0x32')](_0x4da1b2['query']);_0x4c7a2d[_0x0174('0x33')]=_[_0x0174('0x34')](_0x4c7a2d['model'],_0x4c7a2d[_0x0174('0x31')]);_0x32d97c[_0x0174('0x35')]=_[_0x0174('0x34')](_0x4c7a2d['model'],qs[_0x0174('0x36')](_0x4da1b2[_0x0174('0x31')][_0x0174('0x36')]));_0x32d97c[_0x0174('0x35')]=_0x32d97c[_0x0174('0x35')][_0x0174('0x37')]?_0x32d97c[_0x0174('0x35')]:_0x4c7a2d[_0x0174('0x30')];if(!_0x4da1b2[_0x0174('0x31')]['hasOwnProperty'](_0x0174('0x38'))){_0x32d97c['limit']=qs['limit'](_0x4da1b2[_0x0174('0x31')][_0x0174('0x1e')]);_0x32d97c[_0x0174('0x20')]=qs[_0x0174('0x20')](_0x4da1b2['query'][_0x0174('0x20')]);}_0x32d97c[_0x0174('0x39')]=qs[_0x0174('0x3a')](_0x4da1b2['query']['sort']);_0x32d97c[_0x0174('0x3b')]=qs[_0x0174('0x33')](_[_0x0174('0x3c')](_0x4da1b2[_0x0174('0x31')],_0x4c7a2d[_0x0174('0x33')]),_0x255b97);if(_0x4da1b2[_0x0174('0x31')][_0x0174('0x3d')]){_0x32d97c[_0x0174('0x3b')]=_[_0x0174('0x3e')](_0x32d97c['where'],{'$or':_['map'](_0x255b97,function(_0x4a1670){if(_0x4a1670[_0x0174('0x2e')]!=='VIRTUAL'){var _0x553f9b={};_0x553f9b[_0x4a1670[_0x0174('0x29')]]={'$like':'%'+_0x4da1b2[_0x0174('0x31')]['filter']+'%'};return _0x553f9b;}})});}_0x32d97c=_[_0x0174('0x3e')]({},_0x32d97c,_0x4da1b2[_0x0174('0x3f')]);var _0xd3bb30={'where':_0x32d97c[_0x0174('0x3b')]};return db[_0x0174('0x2c')][_0x0174('0x1f')](_0xd3bb30)[_0x0174('0x25')](function(_0x5e94d9){_0x18f541[_0x0174('0x1f')]=_0x5e94d9;if(_0x4da1b2['query']['includeAll']){_0x32d97c[_0x0174('0x40')]=[{'all':!![]}];}return db[_0x0174('0x2c')][_0x0174('0x41')](_0x32d97c);})[_0x0174('0x25')](function(_0x5c4171){_0x18f541[_0x0174('0x42')]=_0x5c4171;return _0x18f541;})['then'](respondWithFilteredResult(_0x1ce56b,_0x32d97c))[_0x0174('0x43')](handleError(_0x1ce56b,null));};exports['show']=function(_0xb1728b,_0x255da8){var _0xa1a4ad={'raw':![],'where':{'id':_0xb1728b[_0x0174('0x44')]['id']}},_0xc8e57c={};_0xc8e57c['model']=_[_0x0174('0x32')](db[_0x0174('0x2c')][_0x0174('0x2d')]);_0xc8e57c[_0x0174('0x31')]=_[_0x0174('0x32')](_0xb1728b[_0x0174('0x31')]);_0xc8e57c[_0x0174('0x33')]=_[_0x0174('0x34')](_0xc8e57c[_0x0174('0x30')],_0xc8e57c['query']);_0xa1a4ad[_0x0174('0x35')]=_['intersection'](_0xc8e57c[_0x0174('0x30')],qs[_0x0174('0x36')](_0xb1728b['query']['fields']));_0xa1a4ad[_0x0174('0x35')]=_0xa1a4ad[_0x0174('0x35')][_0x0174('0x37')]?_0xa1a4ad[_0x0174('0x35')]:_0xc8e57c['model'];if(_0xb1728b['query'][_0x0174('0x45')]){_0xa1a4ad[_0x0174('0x40')]=[{'all':!![]}];}_0xa1a4ad=_[_0x0174('0x3e')]({},_0xa1a4ad,_0xb1728b['options']);return db[_0x0174('0x2c')][_0x0174('0x46')](_0xa1a4ad)[_0x0174('0x25')](handleEntityNotFound(_0x255da8,null))['then'](respondWithResult(_0x255da8,null))[_0x0174('0x43')](handleError(_0x255da8,null));};exports[_0x0174('0x47')]=function(_0x3833c7,_0x3c804c){return db[_0x0174('0x2c')][_0x0174('0x47')](_0x3833c7['body'],{})['then'](respondWithResult(_0x3c804c,0xc9))['catch'](handleError(_0x3c804c,null));};exports['update']=function(_0x5a9523,_0x38c294){if(_0x5a9523['body']['id']){delete _0x5a9523[_0x0174('0x48')]['id'];}return db['ZendeskConfiguration'][_0x0174('0x46')]({'where':{'id':_0x5a9523['params']['id']}})[_0x0174('0x25')](handleEntityNotFound(_0x38c294,null))[_0x0174('0x25')](saveUpdates(_0x5a9523[_0x0174('0x48')],null))[_0x0174('0x25')](respondWithResult(_0x38c294,null))[_0x0174('0x43')](handleError(_0x38c294,null));};exports[_0x0174('0x24')]=function(_0x4c8229,_0x3654cd){return db[_0x0174('0x2c')][_0x0174('0x46')]({'where':{'id':_0x4c8229['params']['id']}})[_0x0174('0x25')](handleEntityNotFound(_0x3654cd,null))[_0x0174('0x25')](removeEntity(_0x3654cd,null))[_0x0174('0x43')](handleError(_0x3654cd,null));};exports[_0x0174('0x49')]=function(_0x2471f5,_0x70e5b4,_0x589589){var _0x473ff5={};var _0x3f0345={};var _0x41faa8;var _0x4ebf20;return db[_0x0174('0x2c')]['findOne']({'where':{'id':_0x2471f5[_0x0174('0x44')]['id']}})[_0x0174('0x25')](handleEntityNotFound(_0x70e5b4,null))[_0x0174('0x25')](function(_0x2a03a4){if(_0x2a03a4){_0x41faa8=_0x2a03a4;_0x3f0345[_0x0174('0x30')]=_[_0x0174('0x32')](db[_0x0174('0x4a')][_0x0174('0x2d')]);_0x3f0345[_0x0174('0x31')]=_['keys'](_0x2471f5['query']);_0x3f0345[_0x0174('0x33')]=_[_0x0174('0x34')](_0x3f0345['model'],_0x3f0345[_0x0174('0x31')]);_0x473ff5['attributes']=_[_0x0174('0x34')](_0x3f0345[_0x0174('0x30')],qs['fields'](_0x2471f5[_0x0174('0x31')]['fields']));_0x473ff5[_0x0174('0x35')]=_0x473ff5[_0x0174('0x35')][_0x0174('0x37')]?_0x473ff5[_0x0174('0x35')]:_0x3f0345[_0x0174('0x30')];_0x473ff5[_0x0174('0x39')]=qs[_0x0174('0x3a')](_0x2471f5[_0x0174('0x31')][_0x0174('0x3a')]);_0x473ff5[_0x0174('0x3b')]=qs[_0x0174('0x33')](_[_0x0174('0x3c')](_0x2471f5[_0x0174('0x31')],_0x3f0345[_0x0174('0x33')]));if(_0x2471f5[_0x0174('0x31')][_0x0174('0x3d')]){_0x473ff5[_0x0174('0x3b')]=_[_0x0174('0x3e')](_0x473ff5[_0x0174('0x3b')],{'$or':_[_0x0174('0x2b')](_0x473ff5[_0x0174('0x35')],function(_0x11d1d7){var _0x467a55={};_0x467a55[_0x11d1d7]={'$like':'%'+_0x2471f5[_0x0174('0x31')][_0x0174('0x3d')]+'%'};return _0x467a55;})});}_0x473ff5=_[_0x0174('0x3e')]({},_0x473ff5,_0x2471f5[_0x0174('0x3f')]);return _0x41faa8[_0x0174('0x49')](_0x473ff5);}})[_0x0174('0x25')](function(_0x34a278){if(_0x34a278){_0x4ebf20=_0x34a278[_0x0174('0x37')];if(!_0x2471f5[_0x0174('0x31')][_0x0174('0x4b')](_0x0174('0x38'))){_0x473ff5[_0x0174('0x1e')]=qs[_0x0174('0x1e')](_0x2471f5[_0x0174('0x31')]['limit']);_0x473ff5[_0x0174('0x20')]=qs[_0x0174('0x20')](_0x2471f5[_0x0174('0x31')]['offset']);}return _0x41faa8[_0x0174('0x49')](_0x473ff5);}})[_0x0174('0x25')](function(_0x2bf92c){if(_0x2bf92c){return _0x2bf92c?{'count':_0x4ebf20,'rows':_0x2bf92c}:null;}})[_0x0174('0x25')](respondWithResult(_0x70e5b4,null))[_0x0174('0x43')](handleError(_0x70e5b4,null));};exports[_0x0174('0x4c')]=function(_0x879074,_0xa2f74a,_0x5ee388){var _0x42261b={};var _0x2224c4={};var _0x44ed2f;var _0x5294e0;return db['ZendeskConfiguration'][_0x0174('0x4d')]({'where':{'id':_0x879074[_0x0174('0x44')]['id']}})['then'](handleEntityNotFound(_0xa2f74a,null))['then'](function(_0x496585){if(_0x496585){_0x44ed2f=_0x496585;_0x2224c4[_0x0174('0x30')]=_[_0x0174('0x32')](db[_0x0174('0x4a')]['rawAttributes']);_0x2224c4['query']=_[_0x0174('0x32')](_0x879074[_0x0174('0x31')]);_0x2224c4['filters']=_[_0x0174('0x34')](_0x2224c4['model'],_0x2224c4['query']);_0x42261b['attributes']=_[_0x0174('0x34')](_0x2224c4['model'],qs[_0x0174('0x36')](_0x879074[_0x0174('0x31')]['fields']));_0x42261b[_0x0174('0x35')]=_0x42261b[_0x0174('0x35')][_0x0174('0x37')]?_0x42261b[_0x0174('0x35')]:_0x2224c4[_0x0174('0x30')];_0x42261b[_0x0174('0x39')]=qs[_0x0174('0x3a')](_0x879074['query'][_0x0174('0x3a')]);_0x42261b[_0x0174('0x3b')]=qs[_0x0174('0x33')](_[_0x0174('0x3c')](_0x879074[_0x0174('0x31')],_0x2224c4[_0x0174('0x33')]));if(_0x879074[_0x0174('0x31')][_0x0174('0x3d')]){_0x42261b['where']=_[_0x0174('0x3e')](_0x42261b[_0x0174('0x3b')],{'$or':_[_0x0174('0x2b')](_0x42261b[_0x0174('0x35')],function(_0x22f36e){var _0x386d60={};_0x386d60[_0x22f36e]={'$like':'%'+_0x879074['query'][_0x0174('0x3d')]+'%'};return _0x386d60;})});}_0x42261b=_[_0x0174('0x3e')]({},_0x42261b,_0x879074[_0x0174('0x3f')]);return _0x44ed2f[_0x0174('0x4c')](_0x42261b);}})[_0x0174('0x25')](function(_0x1b4b7c){if(_0x1b4b7c){_0x5294e0=_0x1b4b7c[_0x0174('0x37')];if(!_0x879074[_0x0174('0x31')][_0x0174('0x4b')](_0x0174('0x38'))){_0x42261b[_0x0174('0x1e')]=qs[_0x0174('0x1e')](_0x879074['query'][_0x0174('0x1e')]);_0x42261b[_0x0174('0x20')]=qs[_0x0174('0x20')](_0x879074[_0x0174('0x31')][_0x0174('0x20')]);}return _0x44ed2f['getSubjects'](_0x42261b);}})['then'](function(_0x329b3e){if(_0x329b3e){return _0x329b3e?{'count':_0x5294e0,'rows':_0x329b3e}:null;}})[_0x0174('0x25')](respondWithResult(_0xa2f74a,null))['catch'](handleError(_0xa2f74a,null));};exports['getDescriptions']=function(_0x2b2c89,_0x447094,_0x39a0db){var _0xd14e0={};var _0x1a03bc={};var _0x24bdc7;var _0x46d741;return db[_0x0174('0x2c')][_0x0174('0x4d')]({'where':{'id':_0x2b2c89[_0x0174('0x44')]['id']}})[_0x0174('0x25')](handleEntityNotFound(_0x447094,null))[_0x0174('0x25')](function(_0x328159){if(_0x328159){_0x24bdc7=_0x328159;_0x1a03bc['model']=_[_0x0174('0x32')](db[_0x0174('0x4a')][_0x0174('0x2d')]);_0x1a03bc[_0x0174('0x31')]=_[_0x0174('0x32')](_0x2b2c89[_0x0174('0x31')]);_0x1a03bc[_0x0174('0x33')]=_[_0x0174('0x34')](_0x1a03bc['model'],_0x1a03bc[_0x0174('0x31')]);_0xd14e0[_0x0174('0x35')]=_[_0x0174('0x34')](_0x1a03bc[_0x0174('0x30')],qs['fields'](_0x2b2c89[_0x0174('0x31')][_0x0174('0x36')]));_0xd14e0[_0x0174('0x35')]=_0xd14e0['attributes'][_0x0174('0x37')]?_0xd14e0[_0x0174('0x35')]:_0x1a03bc[_0x0174('0x30')];_0xd14e0['order']=qs[_0x0174('0x3a')](_0x2b2c89[_0x0174('0x31')]['sort']);_0xd14e0[_0x0174('0x3b')]=qs['filters'](_[_0x0174('0x3c')](_0x2b2c89[_0x0174('0x31')],_0x1a03bc['filters']));if(_0x2b2c89[_0x0174('0x31')][_0x0174('0x3d')]){_0xd14e0[_0x0174('0x3b')]=_[_0x0174('0x3e')](_0xd14e0[_0x0174('0x3b')],{'$or':_[_0x0174('0x2b')](_0xd14e0[_0x0174('0x35')],function(_0x4107d2){var _0x3b3cbd={};_0x3b3cbd[_0x4107d2]={'$like':'%'+_0x2b2c89[_0x0174('0x31')][_0x0174('0x3d')]+'%'};return _0x3b3cbd;})});}_0xd14e0=_[_0x0174('0x3e')]({},_0xd14e0,_0x2b2c89[_0x0174('0x3f')]);return _0x24bdc7[_0x0174('0x4e')](_0xd14e0);}})['then'](function(_0x3e3ec1){if(_0x3e3ec1){_0x46d741=_0x3e3ec1[_0x0174('0x37')];if(!_0x2b2c89[_0x0174('0x31')][_0x0174('0x4b')](_0x0174('0x38'))){_0xd14e0[_0x0174('0x1e')]=qs[_0x0174('0x1e')](_0x2b2c89[_0x0174('0x31')][_0x0174('0x1e')]);_0xd14e0[_0x0174('0x20')]=qs[_0x0174('0x20')](_0x2b2c89[_0x0174('0x31')][_0x0174('0x20')]);}return _0x24bdc7['getDescriptions'](_0xd14e0);}})[_0x0174('0x25')](function(_0x4d5021){if(_0x4d5021){return _0x4d5021?{'count':_0x46d741,'rows':_0x4d5021}:null;}})[_0x0174('0x25')](respondWithResult(_0x447094,null))[_0x0174('0x43')](handleError(_0x447094,null));};exports[_0x0174('0x4f')]=function(_0x37c28a,_0x4dfc12,_0x76bb1){var _0x4b217f={};var _0x5eb9da={};var _0x12ee19;var _0x2bed29;return db[_0x0174('0x2c')][_0x0174('0x4d')]({'where':{'id':_0x37c28a[_0x0174('0x44')]['id']}})[_0x0174('0x25')](handleEntityNotFound(_0x4dfc12,null))[_0x0174('0x25')](function(_0x3d79af){if(_0x3d79af){_0x12ee19=_0x3d79af;_0x5eb9da[_0x0174('0x30')]=_[_0x0174('0x32')](db[_0x0174('0x50')]['rawAttributes']);_0x5eb9da[_0x0174('0x31')]=_[_0x0174('0x32')](_0x37c28a[_0x0174('0x31')]);_0x5eb9da[_0x0174('0x33')]=_[_0x0174('0x34')](_0x5eb9da[_0x0174('0x30')],_0x5eb9da[_0x0174('0x31')]);_0x4b217f[_0x0174('0x35')]=_['intersection'](_0x5eb9da[_0x0174('0x30')],qs[_0x0174('0x36')](_0x37c28a[_0x0174('0x31')][_0x0174('0x36')]));_0x4b217f[_0x0174('0x35')]=_0x4b217f[_0x0174('0x35')][_0x0174('0x37')]?_0x4b217f[_0x0174('0x35')]:_0x5eb9da[_0x0174('0x30')];_0x4b217f[_0x0174('0x39')]=qs[_0x0174('0x3a')](_0x37c28a[_0x0174('0x31')][_0x0174('0x3a')]);_0x4b217f['where']=qs['filters'](_[_0x0174('0x3c')](_0x37c28a['query'],_0x5eb9da['filters']));if(_0x37c28a['query'][_0x0174('0x3d')]){_0x4b217f[_0x0174('0x3b')]=_[_0x0174('0x3e')](_0x4b217f[_0x0174('0x3b')],{'$or':_['map'](_0x4b217f[_0x0174('0x35')],function(_0x5137df){var _0x586d0f={};_0x586d0f[_0x5137df]={'$like':'%'+_0x37c28a['query'][_0x0174('0x3d')]+'%'};return _0x586d0f;})});}_0x4b217f=_['merge']({},_0x4b217f,_0x37c28a[_0x0174('0x3f')]);return _0x12ee19['getTags'](_0x4b217f);}})[_0x0174('0x25')](function(_0x4b6c4c){if(_0x4b6c4c){_0x2bed29=_0x4b6c4c['length'];if(!_0x37c28a[_0x0174('0x31')][_0x0174('0x4b')](_0x0174('0x38'))){_0x4b217f[_0x0174('0x1e')]=qs[_0x0174('0x1e')](_0x37c28a[_0x0174('0x31')][_0x0174('0x1e')]);_0x4b217f[_0x0174('0x20')]=qs[_0x0174('0x20')](_0x37c28a[_0x0174('0x31')][_0x0174('0x20')]);}return _0x12ee19[_0x0174('0x4f')](_0x4b217f);}})['then'](function(_0x294002){if(_0x294002){return _0x294002?{'count':_0x2bed29,'rows':_0x294002}:null;}})[_0x0174('0x25')](respondWithResult(_0x4dfc12,null))[_0x0174('0x43')](handleError(_0x4dfc12,null));};exports[_0x0174('0x51')]=function(_0x151d19,_0x501446,_0xb3a03){if(_0x151d19[_0x0174('0x48')]['id']){delete _0x151d19[_0x0174('0x48')]['id'];}return db[_0x0174('0x2c')][_0x0174('0x4d')]({'where':{'id':_0x151d19['params']['id']}})[_0x0174('0x25')](handleEntityNotFound(_0x501446,null))['then'](function(_0x37b345){if(_0x37b345){return _0x37b345['setTags'](_0x151d19[_0x0174('0x48')][_0x0174('0x52')]||[]);}return null;})[_0x0174('0x25')](respondWithResult(_0x501446,null))[_0x0174('0x43')](handleError(_0x501446,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 561285d..c4a3f8a 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 _0x6a95=['bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x6ad401,_0x48e21c){var _0x2b28c5=function(_0x3bcedb){while(--_0x3bcedb){_0x6ad401['push'](_0x6ad401['shift']());}};_0x2b28c5(++_0x48e21c);}(_0x6a95,0x1db));var _0x56a9=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x6a95[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var logger=require(_0x56a9('0x2'))(_0x56a9('0x3'));var moment=require(_0x56a9('0x4'));var BPromise=require(_0x56a9('0x5'));var rp=require(_0x56a9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x56a9('0x7'));var attributes=require(_0x56a9('0x8'));module[_0x56a9('0x9')]=function(_0x2eb132,_0x3c15b6){return _0x2eb132[_0x56a9('0xa')](_0x56a9('0xb'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','util','api','moment','bluebird'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 570a0a3..9a0a965 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 _0xa8bc=['../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2f1d2f,_0x527d85){var _0x2874cf=function(_0x3203df){while(--_0x3203df){_0x2f1d2f['push'](_0x2f1d2f['shift']());}};_0x2874cf(++_0x527d85);}(_0xa8bc,0x1b9));var _0xca8b=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0xa8bc[_0x59b439];return _0x521ea3;};'use strict';var _=require(_0xca8b('0x0'));var util=require(_0xca8b('0x1'));var moment=require(_0xca8b('0x2'));var BPromise=require(_0xca8b('0x3'));var rs=require(_0xca8b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca8b('0x5'))['db'];var utils=require(_0xca8b('0x6'));var logger=require(_0xca8b('0x7'))(_0xca8b('0x8'));var config=require(_0xca8b('0x9'));var jayson=require(_0xca8b('0xa'));var client=jayson[_0xca8b('0xb')][_0xca8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x45f00b,_0x196a57,_0x1e2439){return new BPromise(function(_0x151ba9,_0x214cd2){return client[_0xca8b('0xd')](_0x45f00b,_0x1e2439)[_0xca8b('0xe')](function(_0x22aee0){logger[_0xca8b('0xf')](_0xca8b('0x10'),_0x196a57,_0xca8b('0x11'));logger['debug'](_0xca8b('0x12'),_0x196a57,_0xca8b('0x11'),JSON[_0xca8b('0x13')](_0x22aee0));if(_0x22aee0[_0xca8b('0x14')]){if(_0x22aee0[_0xca8b('0x14')][_0xca8b('0x15')]===0x1f4){logger['error'](_0xca8b('0x10'),_0x196a57,_0x22aee0[_0xca8b('0x14')][_0xca8b('0x16')]);return _0x214cd2(_0x22aee0[_0xca8b('0x14')][_0xca8b('0x16')]);}logger[_0xca8b('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x196a57,_0x22aee0['error'][_0xca8b('0x16')]);return _0x151ba9(_0x22aee0[_0xca8b('0x14')][_0xca8b('0x16')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x196a57,_0xca8b('0x11'));_0x151ba9(_0x22aee0[_0xca8b('0x17')][_0xca8b('0x16')]);}})[_0xca8b('0x18')](function(_0x325a5b){logger[_0xca8b('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x196a57,_0x325a5b);_0x214cd2(_0x325a5b);});});} \ No newline at end of file +var _0x8dd4=['info','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x44d385,_0x1a313a){var _0x5c2cc5=function(_0x5d1d76){while(--_0x5d1d76){_0x44d385['push'](_0x44d385['shift']());}};_0x5c2cc5(++_0x1a313a);}(_0x8dd4,0x88));var _0x48dd=function(_0x1de37d,_0x1dba7d){_0x1de37d=_0x1de37d-0x0;var _0x1371f7=_0x8dd4[_0x1de37d];return _0x1371f7;};'use strict';var _=require('lodash');var util=require(_0x48dd('0x0'));var moment=require(_0x48dd('0x1'));var BPromise=require('bluebird');var rs=require(_0x48dd('0x2'));var fs=require('fs');var Redis=require(_0x48dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x48dd('0x4'));var logger=require(_0x48dd('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x48dd('0x6'));var client=jayson[_0x48dd('0x7')][_0x48dd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a4d51,_0x1f1191,_0x7f01e4){return new BPromise(function(_0x2797b5,_0x34d53d){return client['request'](_0x4a4d51,_0x7f01e4)['then'](function(_0x12e53f){logger['info'](_0x48dd('0x9'),_0x1f1191,_0x48dd('0xa'));logger[_0x48dd('0xb')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1f1191,_0x48dd('0xa'),JSON[_0x48dd('0xc')](_0x12e53f));if(_0x12e53f['error']){if(_0x12e53f[_0x48dd('0xd')][_0x48dd('0xe')]===0x1f4){logger[_0x48dd('0xd')](_0x48dd('0x9'),_0x1f1191,_0x12e53f[_0x48dd('0xd')][_0x48dd('0xf')]);return _0x34d53d(_0x12e53f['error']['message']);}logger['error'](_0x48dd('0x9'),_0x1f1191,_0x12e53f[_0x48dd('0xd')][_0x48dd('0xf')]);return _0x2797b5(_0x12e53f['error']['message']);}else{logger[_0x48dd('0x10')](_0x48dd('0x9'),_0x1f1191,'request\x20sent');_0x2797b5(_0x12e53f[_0x48dd('0x11')][_0x48dd('0xf')]);}})[_0x48dd('0x12')](function(_0x35146d){logger[_0x48dd('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1f1191,_0x35146d);_0x34d53d(_0x35146d);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index c09f053..49e30a8 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 _0x8f57=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8f57,0xe8));var _0x78f5=function(_0x5c6951,_0x507abb){_0x5c6951=_0x5c6951-0x0;var _0x5ee145=_0x8f57[_0x5c6951];return _0x5ee145;};'use strict';var multer=require(_0x78f5('0x0'));var util=require(_0x78f5('0x1'));var path=require(_0x78f5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x78f5('0x3')]();var fs_extra=require(_0x78f5('0x4'));var auth=require(_0x78f5('0x5'));var interaction=require(_0x78f5('0x6'));var config=require(_0x78f5('0x7'));var controller=require('./intZendeskField.controller');router[_0x78f5('0x8')]('/',auth[_0x78f5('0x9')](),controller[_0x78f5('0xa')]);router[_0x78f5('0x8')](_0x78f5('0xb'),auth[_0x78f5('0x9')](),controller[_0x78f5('0xc')]);router[_0x78f5('0xd')]('/',auth[_0x78f5('0x9')](),controller[_0x78f5('0xe')]);router[_0x78f5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x78f5('0x10')]);router[_0x78f5('0x11')](_0x78f5('0xb'),auth[_0x78f5('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5f8e=['index','/:id','show','put','update','delete','destroy','exports','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x31f7c5,_0x3bf428){var _0x19fabc=function(_0x268080){while(--_0x268080){_0x31f7c5['push'](_0x31f7c5['shift']());}};_0x19fabc(++_0x3bf428);}(_0x5f8e,0xd8));var _0xe5f8=function(_0x72895a,_0x433607){_0x72895a=_0x72895a-0x0;var _0x5226d5=_0x5f8e[_0x72895a];return _0x5226d5;};'use strict';var multer=require('multer');var util=require(_0xe5f8('0x0'));var path=require('path');var timeout=require(_0xe5f8('0x1'));var express=require(_0xe5f8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe5f8('0x3'));var config=require(_0xe5f8('0x4'));var controller=require(_0xe5f8('0x5'));router[_0xe5f8('0x6')]('/',auth[_0xe5f8('0x7')](),controller[_0xe5f8('0x8')]);router[_0xe5f8('0x6')](_0xe5f8('0x9'),auth[_0xe5f8('0x7')](),controller[_0xe5f8('0xa')]);router['post']('/',auth[_0xe5f8('0x7')](),controller['create']);router[_0xe5f8('0xb')](_0xe5f8('0x9'),auth['isAuthenticated'](),controller[_0xe5f8('0xc')]);router[_0xe5f8('0xd')](_0xe5f8('0x9'),auth['isAuthenticated'](),controller[_0xe5f8('0xe')]);module[_0xe5f8('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index d182d46..e51e4a7 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 _0xdab4=['customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x246035,_0x2fe406){var _0x8de35f=function(_0xf5d5bc){while(--_0xf5d5bc){_0x246035['push'](_0x246035['shift']());}};_0x8de35f(++_0x2fe406);}(_0xdab4,0x1d4));var _0x4dab=function(_0x2ce504,_0x4f880b){_0x2ce504=_0x2ce504-0x0;var _0x586245=_0xdab4[_0x2ce504];return _0x586245;};'use strict';var Sequelize=require(_0x4dab('0x0'));module['exports']={'type':{'type':Sequelize[_0x4dab('0x1')](_0x4dab('0x2'),_0x4dab('0x3'),_0x4dab('0x4'),_0x4dab('0x5'),'picklist'),'defaultValue':_0x4dab('0x2')},'content':{'type':Sequelize[_0x4dab('0x6')]},'key':{'type':Sequelize[_0x4dab('0x6')]},'keyType':{'type':Sequelize[_0x4dab('0x1')](_0x4dab('0x2'),_0x4dab('0x3'),_0x4dab('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4dab('0x6')]},'nameField':{'type':Sequelize[_0x4dab('0x6')]},'customField':{'type':Sequelize[_0x4dab('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x19a1=['BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x19a1,0x1b1));var _0x119a=function(_0x1e035c,_0xf906b){_0x1e035c=_0x1e035c-0x0;var _0x3a63f0=_0x19a1[_0x1e035c];return _0x3a63f0;};'use strict';var Sequelize=require(_0x119a('0x0'));module['exports']={'type':{'type':Sequelize[_0x119a('0x1')]('string',_0x119a('0x2'),_0x119a('0x3'),_0x119a('0x4'),'picklist'),'defaultValue':_0x119a('0x5')},'content':{'type':Sequelize[_0x119a('0x6')]},'key':{'type':Sequelize[_0x119a('0x6')]},'keyType':{'type':Sequelize[_0x119a('0x1')](_0x119a('0x5'),'variable',_0x119a('0x3'))},'keyContent':{'type':Sequelize[_0x119a('0x6')]},'idField':{'type':Sequelize[_0x119a('0x6')]},'nameField':{'type':Sequelize[_0x119a('0x6')]},'customField':{'type':Sequelize[_0x119a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index d9e9ae5..7cd6bd6 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 _0xe920=['papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','set','save','update','destroy','then','sendStatus','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x4a88ef,_0x47b00b){var _0x223767=function(_0x2d1f2b){while(--_0x2d1f2b){_0x4a88ef['push'](_0x4a88ef['shift']());}};_0x223767(++_0x47b00b);}(_0xe920,0xbe));var _0x0e92=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0xe920[_0x483d8b];return _0x6500f1;};'use strict';var emlformat=require(_0x0e92('0x0'));var rimraf=require(_0x0e92('0x1'));var zipdir=require(_0x0e92('0x2'));var jsonpatch=require(_0x0e92('0x3'));var rp=require(_0x0e92('0x4'));var moment=require(_0x0e92('0x5'));var BPromise=require(_0x0e92('0x6'));var Mustache=require(_0x0e92('0x7'));var util=require(_0x0e92('0x8'));var path=require(_0x0e92('0x9'));var sox=require('sox');var csv=require(_0x0e92('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e92('0xb'));var _=require(_0x0e92('0xc'));var squel=require(_0x0e92('0xd'));var crypto=require(_0x0e92('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0e92('0xf'));var toCsv=require(_0x0e92('0xa'));var querystring=require(_0x0e92('0x10'));var Papa=require(_0x0e92('0x11'));var Redis=require(_0x0e92('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e92('0x13'));var logger=require(_0x0e92('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0e92('0x15'));var db=require(_0x0e92('0x16'))['db'];function respondWithStatusCode(_0x4e411f,_0x3a88f1){_0x3a88f1=_0x3a88f1||0xcc;return function(_0x12113d){if(_0x12113d){return _0x4e411f['sendStatus'](_0x3a88f1);}return _0x4e411f[_0x0e92('0x17')](_0x3a88f1)[_0x0e92('0x18')]();};}function respondWithResult(_0x4e9dc0,_0x3bc59f){_0x3bc59f=_0x3bc59f||0xc8;return function(_0x218f02){if(_0x218f02){return _0x4e9dc0[_0x0e92('0x17')](_0x3bc59f)[_0x0e92('0x19')](_0x218f02);}};}function respondWithFilteredResult(_0x5cce2d,_0x5e70ab){return function(_0x333faf){if(_0x333faf){var _0x211716=typeof _0x5e70ab['offset']==='undefined'&&typeof _0x5e70ab[_0x0e92('0x1a')]==='undefined';var _0x9ecd13=_0x333faf[_0x0e92('0x1b')];var _0x3316a5=_0x211716?0x0:_0x5e70ab[_0x0e92('0x1c')];var _0x153002=_0x211716?_0x333faf[_0x0e92('0x1b')]:_0x5e70ab[_0x0e92('0x1c')]+_0x5e70ab['limit'];var _0x1412ef;if(_0x153002>=_0x9ecd13){_0x153002=_0x9ecd13;_0x1412ef=0xc8;}else{_0x1412ef=0xce;}_0x5cce2d['status'](_0x1412ef);return _0x5cce2d[_0x0e92('0x1d')]('Content-Range',_0x3316a5+'-'+_0x153002+'/'+_0x9ecd13)['json'](_0x333faf);}return null;};}function patchUpdates(_0x47a265){return function(_0x263ba1){try{jsonpatch['apply'](_0x263ba1,_0x47a265,!![]);}catch(_0x433c05){return BPromise['reject'](_0x433c05);}return _0x263ba1[_0x0e92('0x1e')]();};}function saveUpdates(_0x198c5a,_0x5d44e2){return function(_0x3f2105){if(_0x3f2105){return _0x3f2105[_0x0e92('0x1f')](_0x198c5a)['then'](function(_0x3a18e1){return _0x3a18e1;});}return null;};}function removeEntity(_0x53de77,_0x43c54c){return function(_0x40375c){if(_0x40375c){return _0x40375c[_0x0e92('0x20')]()[_0x0e92('0x21')](function(){_0x53de77[_0x0e92('0x17')](0xcc)[_0x0e92('0x18')]();});}};}function handleEntityNotFound(_0xc34ae4,_0x42c5bc){return function(_0x32d258){if(!_0x32d258){_0xc34ae4[_0x0e92('0x22')](0x194);}return _0x32d258;};}function handleError(_0x538bac,_0x3eb532){_0x3eb532=_0x3eb532||0x1f4;return function(_0x47f156){logger['error'](_0x47f156[_0x0e92('0x23')]);if(_0x47f156[_0x0e92('0x24')]){delete _0x47f156['name'];}_0x538bac['status'](_0x3eb532)[_0x0e92('0x25')](_0x47f156);};}exports[_0x0e92('0x26')]=function(_0x5af9b4,_0x515bd9){var _0x140666={},_0x329c5f={},_0xc3d81d={'count':0x0,'rows':[]};var _0x150bc1=_[_0x0e92('0x27')](db[_0x0e92('0x28')][_0x0e92('0x29')],function(_0x367a35){return{'name':_0x367a35[_0x0e92('0x2a')],'type':_0x367a35[_0x0e92('0x2b')][_0x0e92('0x2c')]};});_0x329c5f[_0x0e92('0x2d')]=_[_0x0e92('0x27')](_0x150bc1,_0x0e92('0x24'));_0x329c5f[_0x0e92('0x2e')]=_[_0x0e92('0x2f')](_0x5af9b4[_0x0e92('0x2e')]);_0x329c5f[_0x0e92('0x30')]=_[_0x0e92('0x31')](_0x329c5f[_0x0e92('0x2d')],_0x329c5f['query']);_0x140666[_0x0e92('0x32')]=_[_0x0e92('0x31')](_0x329c5f['model'],qs['fields'](_0x5af9b4[_0x0e92('0x2e')][_0x0e92('0x33')]));_0x140666[_0x0e92('0x32')]=_0x140666[_0x0e92('0x32')][_0x0e92('0x34')]?_0x140666[_0x0e92('0x32')]:_0x329c5f[_0x0e92('0x2d')];if(!_0x5af9b4[_0x0e92('0x2e')]['hasOwnProperty'](_0x0e92('0x35'))){_0x140666[_0x0e92('0x1a')]=qs[_0x0e92('0x1a')](_0x5af9b4[_0x0e92('0x2e')][_0x0e92('0x1a')]);_0x140666[_0x0e92('0x1c')]=qs[_0x0e92('0x1c')](_0x5af9b4[_0x0e92('0x2e')][_0x0e92('0x1c')]);}_0x140666['order']=qs['sort'](_0x5af9b4[_0x0e92('0x2e')][_0x0e92('0x36')]);_0x140666['where']=qs[_0x0e92('0x30')](_['pick'](_0x5af9b4[_0x0e92('0x2e')],_0x329c5f['filters']),_0x150bc1);if(_0x5af9b4[_0x0e92('0x2e')]['filter']){_0x140666[_0x0e92('0x37')]=_[_0x0e92('0x38')](_0x140666[_0x0e92('0x37')],{'$or':_['map'](_0x150bc1,function(_0x58ab21){if(_0x58ab21[_0x0e92('0x2b')]!==_0x0e92('0x39')){var _0xd86fd8={};_0xd86fd8[_0x58ab21['name']]={'$like':'%'+_0x5af9b4[_0x0e92('0x2e')]['filter']+'%'};return _0xd86fd8;}})});}_0x140666=_['merge']({},_0x140666,_0x5af9b4[_0x0e92('0x3a')]);var _0x14475e={'where':_0x140666['where']};return db[_0x0e92('0x28')]['count'](_0x14475e)[_0x0e92('0x21')](function(_0x188f78){_0xc3d81d['count']=_0x188f78;if(_0x5af9b4[_0x0e92('0x2e')]['includeAll']){_0x140666['include']=[{'all':!![]}];}return db['ZendeskField'][_0x0e92('0x3b')](_0x140666);})[_0x0e92('0x21')](function(_0x60bf0b){_0xc3d81d[_0x0e92('0x3c')]=_0x60bf0b;return _0xc3d81d;})['then'](respondWithFilteredResult(_0x515bd9,_0x140666))['catch'](handleError(_0x515bd9,null));};exports[_0x0e92('0x3d')]=function(_0x42909f,_0x328570){var _0xe9e906={'raw':!![],'where':{'id':_0x42909f[_0x0e92('0x3e')]['id']}},_0x4f242d={};_0x4f242d[_0x0e92('0x2d')]=_[_0x0e92('0x2f')](db[_0x0e92('0x28')]['rawAttributes']);_0x4f242d['query']=_[_0x0e92('0x2f')](_0x42909f[_0x0e92('0x2e')]);_0x4f242d['filters']=_[_0x0e92('0x31')](_0x4f242d[_0x0e92('0x2d')],_0x4f242d[_0x0e92('0x2e')]);_0xe9e906[_0x0e92('0x32')]=_[_0x0e92('0x31')](_0x4f242d[_0x0e92('0x2d')],qs['fields'](_0x42909f[_0x0e92('0x2e')][_0x0e92('0x33')]));_0xe9e906[_0x0e92('0x32')]=_0xe9e906['attributes'][_0x0e92('0x34')]?_0xe9e906[_0x0e92('0x32')]:_0x4f242d[_0x0e92('0x2d')];if(_0x42909f[_0x0e92('0x2e')][_0x0e92('0x3f')]){_0xe9e906[_0x0e92('0x40')]=[{'all':!![]}];}_0xe9e906=_[_0x0e92('0x38')]({},_0xe9e906,_0x42909f[_0x0e92('0x3a')]);return db[_0x0e92('0x28')]['find'](_0xe9e906)['then'](handleEntityNotFound(_0x328570,null))[_0x0e92('0x21')](respondWithResult(_0x328570,null))[_0x0e92('0x41')](handleError(_0x328570,null));};exports[_0x0e92('0x42')]=function(_0x2c0c79,_0x3b02da){return db['ZendeskField'][_0x0e92('0x42')](_0x2c0c79[_0x0e92('0x43')],{})['then'](respondWithResult(_0x3b02da,0xc9))['catch'](handleError(_0x3b02da,null));};exports[_0x0e92('0x1f')]=function(_0x4e4ddc,_0x14e7ed){if(_0x4e4ddc[_0x0e92('0x43')]['id']){delete _0x4e4ddc[_0x0e92('0x43')]['id'];}return db[_0x0e92('0x28')][_0x0e92('0x44')]({'where':{'id':_0x4e4ddc['params']['id']}})[_0x0e92('0x21')](handleEntityNotFound(_0x14e7ed,null))[_0x0e92('0x21')](saveUpdates(_0x4e4ddc[_0x0e92('0x43')],null))[_0x0e92('0x21')](respondWithResult(_0x14e7ed,null))[_0x0e92('0x41')](handleError(_0x14e7ed,null));};exports[_0x0e92('0x20')]=function(_0x10a5b2,_0x4a71d1){return db[_0x0e92('0x28')][_0x0e92('0x44')]({'where':{'id':_0x10a5b2['params']['id']}})['then'](handleEntityNotFound(_0x4a71d1,null))[_0x0e92('0x21')](removeEntity(_0x4a71d1,null))['catch'](handleError(_0x4a71d1,null));}; \ No newline at end of file +var _0x8985=['query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','rawAttributes','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','mustache','util','ejs','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','end','error','name','send','index','map','ZendeskField','fieldName','type','key'];(function(_0x33a610,_0x390034){var _0x1893b3=function(_0x531418){while(--_0x531418){_0x33a610['push'](_0x33a610['shift']());}};_0x1893b3(++_0x390034);}(_0x8985,0x198));var _0x5898=function(_0x3fff53,_0xf8d045){_0x3fff53=_0x3fff53-0x0;var _0x41d153=_0x8985[_0x3fff53];return _0x41d153;};'use strict';var emlformat=require(_0x5898('0x0'));var rimraf=require(_0x5898('0x1'));var zipdir=require(_0x5898('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5898('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5898('0x4'));var util=require(_0x5898('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5898('0x6'));var fs=require('fs');var fs_extra=require(_0x5898('0x7'));var _=require(_0x5898('0x8'));var squel=require('squel');var crypto=require(_0x5898('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5898('0xa'));var toCsv=require(_0x5898('0xb'));var querystring=require('querystring');var Papa=require(_0x5898('0xc'));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('../../config/logger')(_0x5898('0xd'));var utils=require(_0x5898('0xe'));var config=require(_0x5898('0xf'));var licenseUtil=require(_0x5898('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fcec2,_0x3f8e8d){_0x3f8e8d=_0x3f8e8d||0xcc;return function(_0x26836c){if(_0x26836c){return _0x1fcec2[_0x5898('0x11')](_0x3f8e8d);}return _0x1fcec2[_0x5898('0x12')](_0x3f8e8d)['end']();};}function respondWithResult(_0x3e4723,_0x119224){_0x119224=_0x119224||0xc8;return function(_0x51c06d){if(_0x51c06d){return _0x3e4723[_0x5898('0x12')](_0x119224)[_0x5898('0x13')](_0x51c06d);}};}function respondWithFilteredResult(_0x5ba4ea,_0x1bfb2b){return function(_0x1b013d){if(_0x1b013d){var _0x322487=typeof _0x1bfb2b[_0x5898('0x14')]===_0x5898('0x15')&&typeof _0x1bfb2b[_0x5898('0x16')]==='undefined';var _0x52a406=_0x1b013d[_0x5898('0x17')];var _0x319a7e=_0x322487?0x0:_0x1bfb2b[_0x5898('0x14')];var _0x3afcbd=_0x322487?_0x1b013d[_0x5898('0x17')]:_0x1bfb2b[_0x5898('0x14')]+_0x1bfb2b[_0x5898('0x16')];var _0x39c9dd;if(_0x3afcbd>=_0x52a406){_0x3afcbd=_0x52a406;_0x39c9dd=0xc8;}else{_0x39c9dd=0xce;}_0x5ba4ea[_0x5898('0x12')](_0x39c9dd);return _0x5ba4ea[_0x5898('0x18')]('Content-Range',_0x319a7e+'-'+_0x3afcbd+'/'+_0x52a406)[_0x5898('0x13')](_0x1b013d);}return null;};}function patchUpdates(_0x449039){return function(_0x5536d7){try{jsonpatch[_0x5898('0x19')](_0x5536d7,_0x449039,!![]);}catch(_0x39b530){return BPromise['reject'](_0x39b530);}return _0x5536d7[_0x5898('0x1a')]();};}function saveUpdates(_0x571f15,_0x341813){return function(_0x30114d){if(_0x30114d){return _0x30114d[_0x5898('0x1b')](_0x571f15)[_0x5898('0x1c')](function(_0x399a69){return _0x399a69;});}return null;};}function removeEntity(_0x425bad,_0x1681f8){return function(_0x51376b){if(_0x51376b){return _0x51376b[_0x5898('0x1d')]()['then'](function(){_0x425bad[_0x5898('0x12')](0xcc)[_0x5898('0x1e')]();});}};}function handleEntityNotFound(_0xf369cf,_0x59bb5f){return function(_0x13e202){if(!_0x13e202){_0xf369cf['sendStatus'](0x194);}return _0x13e202;};}function handleError(_0x591893,_0x3e6699){_0x3e6699=_0x3e6699||0x1f4;return function(_0x22898c){logger[_0x5898('0x1f')](_0x22898c['stack']);if(_0x22898c['name']){delete _0x22898c[_0x5898('0x20')];}_0x591893['status'](_0x3e6699)[_0x5898('0x21')](_0x22898c);};}exports[_0x5898('0x22')]=function(_0x3efd07,_0x256ace){var _0x2f1777={},_0x212c7e={},_0x3a744c={'count':0x0,'rows':[]};var _0x4c0a5f=_[_0x5898('0x23')](db[_0x5898('0x24')]['rawAttributes'],function(_0x5983d1){return{'name':_0x5983d1[_0x5898('0x25')],'type':_0x5983d1[_0x5898('0x26')][_0x5898('0x27')]};});_0x212c7e['model']=_[_0x5898('0x23')](_0x4c0a5f,_0x5898('0x20'));_0x212c7e[_0x5898('0x28')]=_[_0x5898('0x29')](_0x3efd07[_0x5898('0x28')]);_0x212c7e[_0x5898('0x2a')]=_[_0x5898('0x2b')](_0x212c7e[_0x5898('0x2c')],_0x212c7e[_0x5898('0x28')]);_0x2f1777[_0x5898('0x2d')]=_['intersection'](_0x212c7e[_0x5898('0x2c')],qs['fields'](_0x3efd07[_0x5898('0x28')][_0x5898('0x2e')]));_0x2f1777['attributes']=_0x2f1777[_0x5898('0x2d')][_0x5898('0x2f')]?_0x2f1777['attributes']:_0x212c7e['model'];if(!_0x3efd07[_0x5898('0x28')]['hasOwnProperty'](_0x5898('0x30'))){_0x2f1777[_0x5898('0x16')]=qs['limit'](_0x3efd07[_0x5898('0x28')]['limit']);_0x2f1777[_0x5898('0x14')]=qs[_0x5898('0x14')](_0x3efd07['query']['offset']);}_0x2f1777['order']=qs[_0x5898('0x31')](_0x3efd07[_0x5898('0x28')][_0x5898('0x31')]);_0x2f1777[_0x5898('0x32')]=qs[_0x5898('0x2a')](_[_0x5898('0x33')](_0x3efd07[_0x5898('0x28')],_0x212c7e[_0x5898('0x2a')]),_0x4c0a5f);if(_0x3efd07[_0x5898('0x28')][_0x5898('0x34')]){_0x2f1777[_0x5898('0x32')]=_[_0x5898('0x35')](_0x2f1777[_0x5898('0x32')],{'$or':_[_0x5898('0x23')](_0x4c0a5f,function(_0x45ff60){if(_0x45ff60['type']!==_0x5898('0x36')){var _0x51609a={};_0x51609a[_0x45ff60['name']]={'$like':'%'+_0x3efd07[_0x5898('0x28')][_0x5898('0x34')]+'%'};return _0x51609a;}})});}_0x2f1777=_[_0x5898('0x35')]({},_0x2f1777,_0x3efd07[_0x5898('0x37')]);var _0x1b4518={'where':_0x2f1777[_0x5898('0x32')]};return db[_0x5898('0x24')][_0x5898('0x17')](_0x1b4518)['then'](function(_0x4d1d3d){_0x3a744c[_0x5898('0x17')]=_0x4d1d3d;if(_0x3efd07[_0x5898('0x28')][_0x5898('0x38')]){_0x2f1777[_0x5898('0x39')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x2f1777);})[_0x5898('0x1c')](function(_0x4c0446){_0x3a744c['rows']=_0x4c0446;return _0x3a744c;})[_0x5898('0x1c')](respondWithFilteredResult(_0x256ace,_0x2f1777))[_0x5898('0x3a')](handleError(_0x256ace,null));};exports['show']=function(_0x1c24ac,_0xe80604){var _0x3e01b7={'raw':!![],'where':{'id':_0x1c24ac['params']['id']}},_0x126936={};_0x126936[_0x5898('0x2c')]=_[_0x5898('0x29')](db[_0x5898('0x24')][_0x5898('0x3b')]);_0x126936[_0x5898('0x28')]=_[_0x5898('0x29')](_0x1c24ac['query']);_0x126936[_0x5898('0x2a')]=_[_0x5898('0x2b')](_0x126936[_0x5898('0x2c')],_0x126936[_0x5898('0x28')]);_0x3e01b7['attributes']=_['intersection'](_0x126936[_0x5898('0x2c')],qs[_0x5898('0x2e')](_0x1c24ac[_0x5898('0x28')][_0x5898('0x2e')]));_0x3e01b7[_0x5898('0x2d')]=_0x3e01b7['attributes'][_0x5898('0x2f')]?_0x3e01b7['attributes']:_0x126936[_0x5898('0x2c')];if(_0x1c24ac[_0x5898('0x28')][_0x5898('0x38')]){_0x3e01b7['include']=[{'all':!![]}];}_0x3e01b7=_[_0x5898('0x35')]({},_0x3e01b7,_0x1c24ac[_0x5898('0x37')]);return db['ZendeskField'][_0x5898('0x3c')](_0x3e01b7)[_0x5898('0x1c')](handleEntityNotFound(_0xe80604,null))[_0x5898('0x1c')](respondWithResult(_0xe80604,null))['catch'](handleError(_0xe80604,null));};exports['create']=function(_0x816dbc,_0x112316){return db[_0x5898('0x24')][_0x5898('0x3d')](_0x816dbc[_0x5898('0x3e')],{})[_0x5898('0x1c')](respondWithResult(_0x112316,0xc9))[_0x5898('0x3a')](handleError(_0x112316,null));};exports[_0x5898('0x1b')]=function(_0x199728,_0xa7941e){if(_0x199728[_0x5898('0x3e')]['id']){delete _0x199728[_0x5898('0x3e')]['id'];}return db[_0x5898('0x24')][_0x5898('0x3c')]({'where':{'id':_0x199728['params']['id']}})[_0x5898('0x1c')](handleEntityNotFound(_0xa7941e,null))['then'](saveUpdates(_0x199728[_0x5898('0x3e')],null))['then'](respondWithResult(_0xa7941e,null))[_0x5898('0x3a')](handleError(_0xa7941e,null));};exports[_0x5898('0x1d')]=function(_0x5b4e7a,_0x50d1c2){return db[_0x5898('0x24')][_0x5898('0x3c')]({'where':{'id':_0x5b4e7a[_0x5898('0x3f')]['id']}})[_0x5898('0x1c')](handleEntityNotFound(_0x50d1c2,null))[_0x5898('0x1c')](removeEntity(_0x50d1c2,null))['catch'](handleError(_0x50d1c2,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index bc9a9ee..e80a836 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 _0x0381=['rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','idField','lodash','util','../../config/logger','api','moment','path'];(function(_0x5bd02a,_0x24bad5){var _0x983377=function(_0x3c3cce){while(--_0x3c3cce){_0x5bd02a['push'](_0x5bd02a['shift']());}};_0x983377(++_0x24bad5);}(_0x0381,0x102));var _0x1038=function(_0x8eea78,_0x563fc7){_0x8eea78=_0x8eea78-0x0;var _0x448d18=_0x0381[_0x8eea78];return _0x448d18;};'use strict';var _=require(_0x1038('0x0'));var util=require(_0x1038('0x1'));var logger=require(_0x1038('0x2'))(_0x1038('0x3'));var moment=require(_0x1038('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1038('0x5'));var rimraf=require(_0x1038('0x6'));var config=require(_0x1038('0x7'));var attributes=require(_0x1038('0x8'));module[_0x1038('0x9')]=function(_0x58b34d,_0x2d32ea){return _0x58b34d['define'](_0x1038('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x1038('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5676=['moment','request-promise','path','../../config/environment','exports','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x17c6bf,_0x514e01){var _0x76b78=function(_0x470039){while(--_0x470039){_0x17c6bf['push'](_0x17c6bf['shift']());}};_0x76b78(++_0x514e01);}(_0x5676,0xcf));var _0x6567=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5676[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6567('0x0'));var util=require('util');var logger=require(_0x6567('0x1'))('api');var moment=require(_0x6567('0x2'));var BPromise=require('bluebird');var rp=require(_0x6567('0x3'));var fs=require('fs');var path=require(_0x6567('0x4'));var rimraf=require('rimraf');var config=require(_0x6567('0x5'));var attributes=require('./intZendeskField.attributes');module[_0x6567('0x6')]=function(_0x2f33df,_0x312696){return _0x2f33df['define']('ZendeskField',attributes,{'tableName':_0x6567('0x7'),'paranoid':![],'indexes':[{'name':_0x6567('0x8'),'fields':[_0x6567('0x9'),_0x6567('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index b9cc7c2..43a1938 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 _0xba79=['result','catch','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x124ea2,_0x233e17){var _0x641e15=function(_0xead5af){while(--_0xead5af){_0x124ea2['push'](_0x124ea2['shift']());}};_0x641e15(++_0x233e17);}(_0xba79,0x1e2));var _0x9ba7=function(_0x266da8,_0x47419a){_0x266da8=_0x266da8-0x0;var _0x5cdbe0=_0xba79[_0x266da8];return _0x5cdbe0;};'use strict';var _=require(_0x9ba7('0x0'));var util=require('util');var moment=require(_0x9ba7('0x1'));var BPromise=require('bluebird');var rs=require(_0x9ba7('0x2'));var fs=require('fs');var Redis=require(_0x9ba7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ba7('0x4'));var logger=require('../../config/logger')(_0x9ba7('0x5'));var config=require(_0x9ba7('0x6'));var jayson=require(_0x9ba7('0x7'));var client=jayson[_0x9ba7('0x8')][_0x9ba7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x331c24,_0x2724b3,_0x2bfe5a){return new BPromise(function(_0x404d20,_0x1953e2){return client['request'](_0x331c24,_0x2bfe5a)[_0x9ba7('0xa')](function(_0x137bd4){logger[_0x9ba7('0xb')](_0x9ba7('0xc'),_0x2724b3,_0x9ba7('0xd'));logger[_0x9ba7('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x2724b3,_0x9ba7('0xd'),JSON[_0x9ba7('0xf')](_0x137bd4));if(_0x137bd4[_0x9ba7('0x10')]){if(_0x137bd4[_0x9ba7('0x10')]['code']===0x1f4){logger[_0x9ba7('0x10')](_0x9ba7('0xc'),_0x2724b3,_0x137bd4[_0x9ba7('0x10')]['message']);return _0x1953e2(_0x137bd4[_0x9ba7('0x10')]['message']);}logger[_0x9ba7('0x10')]('ZendeskField,\x20%s,\x20%s',_0x2724b3,_0x137bd4['error']['message']);return _0x404d20(_0x137bd4[_0x9ba7('0x10')][_0x9ba7('0x11')]);}else{logger[_0x9ba7('0xb')]('ZendeskField,\x20%s,\x20%s',_0x2724b3,_0x9ba7('0xd'));_0x404d20(_0x137bd4[_0x9ba7('0x12')][_0x9ba7('0x11')]);}})[_0x9ba7('0x13')](function(_0x4654e7){logger['error'](_0x9ba7('0xc'),_0x2724b3,_0x4654e7);_0x1953e2(_0x4654e7);});});} \ No newline at end of file +var _0x2764=['jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x32e6b9,_0x1ba001){var _0xd18132=function(_0x10af6a){while(--_0x10af6a){_0x32e6b9['push'](_0x32e6b9['shift']());}};_0xd18132(++_0x1ba001);}(_0x2764,0x1d9));var _0x4276=function(_0x14c271,_0x24c63d){_0x14c271=_0x14c271-0x0;var _0x16aa21=_0x2764[_0x14c271];return _0x16aa21;};'use strict';var _=require(_0x4276('0x0'));var util=require(_0x4276('0x1'));var moment=require(_0x4276('0x2'));var BPromise=require(_0x4276('0x3'));var rs=require(_0x4276('0x4'));var fs=require('fs');var Redis=require(_0x4276('0x5'));var db=require(_0x4276('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4276('0x7'))(_0x4276('0x8'));var config=require(_0x4276('0x9'));var jayson=require(_0x4276('0xa'));var client=jayson[_0x4276('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x730895,_0x526607,_0x332518){return new BPromise(function(_0x2607e0,_0x457391){return client[_0x4276('0xc')](_0x730895,_0x332518)[_0x4276('0xd')](function(_0x39d73d){logger[_0x4276('0xe')](_0x4276('0xf'),_0x526607,_0x4276('0x10'));logger[_0x4276('0x11')](_0x4276('0x12'),_0x526607,'request\x20sent',JSON[_0x4276('0x13')](_0x39d73d));if(_0x39d73d['error']){if(_0x39d73d[_0x4276('0x14')][_0x4276('0x15')]===0x1f4){logger[_0x4276('0x14')]('ZendeskField,\x20%s,\x20%s',_0x526607,_0x39d73d[_0x4276('0x14')][_0x4276('0x16')]);return _0x457391(_0x39d73d['error'][_0x4276('0x16')]);}logger[_0x4276('0x14')](_0x4276('0xf'),_0x526607,_0x39d73d[_0x4276('0x14')][_0x4276('0x16')]);return _0x2607e0(_0x39d73d['error'][_0x4276('0x16')]);}else{logger['info'](_0x4276('0xf'),_0x526607,_0x4276('0x10'));_0x2607e0(_0x39d73d['result'][_0x4276('0x16')]);}})['catch'](function(_0x22cb90){logger[_0x4276('0x14')](_0x4276('0xf'),_0x526607,_0x22cb90);_0x457391(_0x22cb90);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 6ad1af4..4f03e53 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 _0x40fc=['../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0x40fc,0x9a));var _0xc40f=function(_0x40b9aa,_0x4df8a1){_0x40b9aa=_0x40b9aa-0x0;var _0x13833a=_0x40fc[_0x40b9aa];return _0x13833a;};'use strict';var multer=require(_0xc40f('0x0'));var util=require(_0xc40f('0x1'));var path=require(_0xc40f('0x2'));var timeout=require(_0xc40f('0x3'));var express=require(_0xc40f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc40f('0x5'));var interaction=require(_0xc40f('0x6'));var config=require(_0xc40f('0x7'));var controller=require(_0xc40f('0x8'));router[_0xc40f('0x9')]('/',auth[_0xc40f('0xa')](),controller['index']);router[_0xc40f('0x9')](_0xc40f('0xb'),auth[_0xc40f('0xa')](),controller['show']);router[_0xc40f('0x9')](_0xc40f('0xc'),auth[_0xc40f('0xa')](),controller[_0xc40f('0xd')]);router[_0xc40f('0x9')](_0xc40f('0xe'),auth[_0xc40f('0xa')](),controller[_0xc40f('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc40f('0x10')]);router['post'](_0xc40f('0xc'),auth[_0xc40f('0xa')](),controller[_0xc40f('0x11')]);router[_0xc40f('0x12')](_0xc40f('0xb'),auth[_0xc40f('0xa')](),controller[_0xc40f('0x13')]);router[_0xc40f('0x14')](_0xc40f('0xb'),auth[_0xc40f('0xa')](),controller[_0xc40f('0x15')]);module[_0xc40f('0x16')]=router; \ No newline at end of file +var _0x75cc=['isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','update','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0x75cc,0x1ef));var _0xc75c=function(_0xb7da0e,_0x2adcdb){_0xb7da0e=_0xb7da0e-0x0;var _0x576050=_0x75cc[_0xb7da0e];return _0x576050;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc75c('0x0'));var timeout=require('connect-timeout');var express=require(_0xc75c('0x1'));var router=express[_0xc75c('0x2')]();var fs_extra=require(_0xc75c('0x3'));var auth=require(_0xc75c('0x4'));var interaction=require(_0xc75c('0x5'));var config=require(_0xc75c('0x6'));var controller=require(_0xc75c('0x7'));router[_0xc75c('0x8')]('/',auth[_0xc75c('0x9')](),controller[_0xc75c('0xa')]);router['get'](_0xc75c('0xb'),auth[_0xc75c('0x9')](),controller[_0xc75c('0xc')]);router[_0xc75c('0x8')](_0xc75c('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xc75c('0x8')](_0xc75c('0xe'),auth[_0xc75c('0x9')](),controller[_0xc75c('0xf')]);router[_0xc75c('0x10')]('/',auth[_0xc75c('0x9')](),controller[_0xc75c('0x11')]);router[_0xc75c('0x10')](_0xc75c('0xd'),auth[_0xc75c('0x9')](),controller['addConfiguration']);router['put'](_0xc75c('0xb'),auth[_0xc75c('0x9')](),controller[_0xc75c('0x12')]);router[_0xc75c('0x13')](_0xc75c('0xb'),auth[_0xc75c('0x9')](),controller['destroy']);module[_0xc75c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index b6a4b8d..ce41438 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 _0xd0bb=['exports','STRING','sequelize'];(function(_0x3318c2,_0x2a0910){var _0x5f0d23=function(_0x4c1e3b){while(--_0x4c1e3b){_0x3318c2['push'](_0x3318c2['shift']());}};_0x5f0d23(++_0x2a0910);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x2a0dc9,_0x3802f4){_0x2a0dc9=_0x2a0dc9-0x0;var _0x198be1=_0xd0bb[_0x2a0dc9];return _0x198be1;};'use strict';var Sequelize=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]={'name':{'type':Sequelize[_0xbd0b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd0b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xbd0b('0x2')]},'clientSecret':{'type':Sequelize[_0xbd0b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xbd0b('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6f0d=['exports','STRING'];(function(_0x235e0c,_0x19813c){var _0x3f0c5f=function(_0x4c7eab){while(--_0x4c7eab){_0x235e0c['push'](_0x235e0c['shift']());}};_0x3f0c5f(++_0x19813c);}(_0x6f0d,0x16c));var _0xd6f0=function(_0xee2283,_0xa387b3){_0xee2283=_0xee2283-0x0;var _0x21c824=_0x6f0d[_0xee2283];return _0x21c824;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'name':{'type':Sequelize[_0xd6f0('0x1')]},'description':{'type':Sequelize[_0xd6f0('0x1')]},'host':{'type':Sequelize[_0xd6f0('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd6f0('0x1')]},'clientSecret':{'type':Sequelize[_0xd6f0('0x1')]},'serverUrl':{'type':Sequelize[_0xd6f0('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xd6f0('0x1')]},'refreshToken':{'type':Sequelize[_0xd6f0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 81354dd..2254d72 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 _0x3efc=['attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','host','code','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','fieldName','type','model','query','keys','filters','intersection'];(function(_0x15fbdf,_0x5c964a){var _0x41f773=function(_0x4a2d37){while(--_0x4a2d37){_0x15fbdf['push'](_0x15fbdf['shift']());}};_0x41f773(++_0x5c964a);}(_0x3efc,0x156));var _0xc3ef=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3efc[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xc3ef('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc3ef('0x1'));var rp=require(_0xc3ef('0x2'));var moment=require(_0xc3ef('0x3'));var BPromise=require(_0xc3ef('0x4'));var Mustache=require(_0xc3ef('0x5'));var util=require(_0xc3ef('0x6'));var path=require(_0xc3ef('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc3ef('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc3ef('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc3ef('0xa'));var Redis=require(_0xc3ef('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xc3ef('0xc'));var as=require(_0xc3ef('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3ef('0xe'))(_0xc3ef('0xf'));var utils=require(_0xc3ef('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc3ef('0x11'))['db'];var integrations=require(_0xc3ef('0x12'));function respondWithStatusCode(_0x52afd3,_0x5be2ee){_0x5be2ee=_0x5be2ee||0xcc;return function(_0x21c8b9){if(_0x21c8b9){return _0x52afd3[_0xc3ef('0x13')](_0x5be2ee);}return _0x52afd3[_0xc3ef('0x14')](_0x5be2ee)[_0xc3ef('0x15')]();};}function respondWithResult(_0x10d94a,_0x4ccdb7){_0x4ccdb7=_0x4ccdb7||0xc8;return function(_0x25b2ba){if(_0x25b2ba){return _0x10d94a[_0xc3ef('0x14')](_0x4ccdb7)[_0xc3ef('0x16')](_0x25b2ba);}};}function respondWithFilteredResult(_0x4ff793,_0x4db8f2){return function(_0x33373e){if(_0x33373e){var _0x41eac3=typeof _0x4db8f2[_0xc3ef('0x17')]===_0xc3ef('0x18')&&typeof _0x4db8f2[_0xc3ef('0x19')]===_0xc3ef('0x18');var _0x3cfd95=_0x33373e[_0xc3ef('0x1a')];var _0x6e14d4=_0x41eac3?0x0:_0x4db8f2['offset'];var _0x253c04=_0x41eac3?_0x33373e[_0xc3ef('0x1a')]:_0x4db8f2[_0xc3ef('0x17')]+_0x4db8f2['limit'];var _0x417574;if(_0x253c04>=_0x3cfd95){_0x253c04=_0x3cfd95;_0x417574=0xc8;}else{_0x417574=0xce;}_0x4ff793[_0xc3ef('0x14')](_0x417574);return _0x4ff793[_0xc3ef('0x1b')]('Content-Range',_0x6e14d4+'-'+_0x253c04+'/'+_0x3cfd95)[_0xc3ef('0x16')](_0x33373e);}return null;};}function patchUpdates(_0x456ab2){return function(_0x3b2161){try{jsonpatch[_0xc3ef('0x1c')](_0x3b2161,_0x456ab2,!![]);}catch(_0x2a19ff){return BPromise[_0xc3ef('0x1d')](_0x2a19ff);}return _0x3b2161[_0xc3ef('0x1e')]();};}function saveUpdates(_0x20aec5,_0x37c030){return function(_0x2abe01){if(_0x2abe01){return _0x2abe01[_0xc3ef('0x1f')](_0x20aec5)[_0xc3ef('0x20')](function(_0x1bea04){return _0x1bea04;});}return null;};}function removeEntity(_0x381ae7,_0x335d15){return function(_0x439dff){if(_0x439dff){return _0x439dff[_0xc3ef('0x21')]()[_0xc3ef('0x20')](function(){_0x381ae7[_0xc3ef('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50adca,_0x41b694){return function(_0x6dc01d){if(!_0x6dc01d){_0x50adca[_0xc3ef('0x13')](0x194);}return _0x6dc01d;};}function handleError(_0x20f565,_0x328fef){_0x328fef=_0x328fef||0x1f4;return function(_0x26c043){logger[_0xc3ef('0x22')](_0x26c043[_0xc3ef('0x23')]);if(_0x26c043[_0xc3ef('0x24')]){delete _0x26c043['name'];}_0x20f565[_0xc3ef('0x14')](_0x328fef)[_0xc3ef('0x25')](_0x26c043);};}exports[_0xc3ef('0x26')]=function(_0x57cc24,_0x565d82){var _0xcbd5ae={},_0x19174c={},_0x3d5178={'count':0x0,'rows':[]};var _0x3e778d=_[_0xc3ef('0x27')](db[_0xc3ef('0x28')]['rawAttributes'],function(_0x464223){return{'name':_0x464223[_0xc3ef('0x29')],'type':_0x464223[_0xc3ef('0x2a')]['key']};});_0x19174c[_0xc3ef('0x2b')]=_[_0xc3ef('0x27')](_0x3e778d,_0xc3ef('0x24'));_0x19174c[_0xc3ef('0x2c')]=_[_0xc3ef('0x2d')](_0x57cc24[_0xc3ef('0x2c')]);_0x19174c[_0xc3ef('0x2e')]=_[_0xc3ef('0x2f')](_0x19174c[_0xc3ef('0x2b')],_0x19174c[_0xc3ef('0x2c')]);_0xcbd5ae[_0xc3ef('0x30')]=_['intersection'](_0x19174c[_0xc3ef('0x2b')],qs[_0xc3ef('0x31')](_0x57cc24[_0xc3ef('0x2c')]['fields']));_0xcbd5ae['attributes']=_0xcbd5ae[_0xc3ef('0x30')][_0xc3ef('0x32')]?_0xcbd5ae[_0xc3ef('0x30')]:_0x19174c[_0xc3ef('0x2b')];if(!_0x57cc24['query']['hasOwnProperty'](_0xc3ef('0x33'))){_0xcbd5ae[_0xc3ef('0x19')]=qs[_0xc3ef('0x19')](_0x57cc24[_0xc3ef('0x2c')][_0xc3ef('0x19')]);_0xcbd5ae[_0xc3ef('0x17')]=qs[_0xc3ef('0x17')](_0x57cc24['query'][_0xc3ef('0x17')]);}_0xcbd5ae[_0xc3ef('0x34')]=qs[_0xc3ef('0x35')](_0x57cc24[_0xc3ef('0x2c')][_0xc3ef('0x35')]);_0xcbd5ae['where']=qs[_0xc3ef('0x2e')](_[_0xc3ef('0x36')](_0x57cc24[_0xc3ef('0x2c')],_0x19174c[_0xc3ef('0x2e')]),_0x3e778d);if(_0x57cc24[_0xc3ef('0x2c')]['filter']){_0xcbd5ae[_0xc3ef('0x37')]=_['merge'](_0xcbd5ae[_0xc3ef('0x37')],{'$or':_[_0xc3ef('0x27')](_0x3e778d,function(_0x5b9de8){if(_0x5b9de8[_0xc3ef('0x2a')]!==_0xc3ef('0x38')){var _0x46f8ed={};_0x46f8ed[_0x5b9de8[_0xc3ef('0x24')]]={'$like':'%'+_0x57cc24[_0xc3ef('0x2c')][_0xc3ef('0x39')]+'%'};return _0x46f8ed;}})});}_0xcbd5ae=_[_0xc3ef('0x3a')]({},_0xcbd5ae,_0x57cc24[_0xc3ef('0x3b')]);var _0x4e8024={'where':_0xcbd5ae[_0xc3ef('0x37')]};return db['ZohoAccount']['count'](_0x4e8024)[_0xc3ef('0x20')](function(_0x2c02ca){_0x3d5178[_0xc3ef('0x1a')]=_0x2c02ca;if(_0x57cc24[_0xc3ef('0x2c')]['includeAll']){_0xcbd5ae['include']=[{'all':!![]}];}return db[_0xc3ef('0x28')]['findAll'](_0xcbd5ae);})['then'](function(_0x44dfb5){_0x3d5178[_0xc3ef('0x3c')]=_0x44dfb5;return _0x3d5178;})[_0xc3ef('0x20')](respondWithFilteredResult(_0x565d82,_0xcbd5ae))[_0xc3ef('0x3d')](handleError(_0x565d82,null));};exports[_0xc3ef('0x3e')]=function(_0x163365,_0x25c361){var _0x35d9c2={'raw':![],'where':{'id':_0x163365[_0xc3ef('0x3f')]['id']}},_0x450a47={};_0x450a47[_0xc3ef('0x2b')]=_[_0xc3ef('0x2d')](db[_0xc3ef('0x28')][_0xc3ef('0x40')]);_0x450a47[_0xc3ef('0x2c')]=_[_0xc3ef('0x2d')](_0x163365[_0xc3ef('0x2c')]);_0x450a47[_0xc3ef('0x2e')]=_['intersection'](_0x450a47['model'],_0x450a47[_0xc3ef('0x2c')]);_0x35d9c2[_0xc3ef('0x30')]=_[_0xc3ef('0x2f')](_0x450a47[_0xc3ef('0x2b')],qs['fields'](_0x163365[_0xc3ef('0x2c')][_0xc3ef('0x31')]));_0x35d9c2[_0xc3ef('0x30')]=_0x35d9c2[_0xc3ef('0x30')]['length']?_0x35d9c2[_0xc3ef('0x30')]:_0x450a47[_0xc3ef('0x2b')];if(_0x163365[_0xc3ef('0x2c')][_0xc3ef('0x41')]){_0x35d9c2['include']=[{'all':!![]}];}_0x35d9c2=_['merge']({},_0x35d9c2,_0x163365[_0xc3ef('0x3b')]);return db[_0xc3ef('0x28')][_0xc3ef('0x42')](_0x35d9c2)[_0xc3ef('0x20')](handleEntityNotFound(_0x25c361,null))[_0xc3ef('0x20')](respondWithResult(_0x25c361,null))[_0xc3ef('0x3d')](handleError(_0x25c361,null));};exports[_0xc3ef('0x43')]=function(_0x313941,_0x5d3b8b){return db[_0xc3ef('0x28')][_0xc3ef('0x43')](_0x313941[_0xc3ef('0x44')],{})['then'](respondWithResult(_0x5d3b8b,0xc9))[_0xc3ef('0x3d')](handleError(_0x5d3b8b,null));};exports[_0xc3ef('0x1f')]=function(_0x49bf41,_0x287fd1){if(_0x49bf41[_0xc3ef('0x44')]['id']){delete _0x49bf41[_0xc3ef('0x44')]['id'];}return db[_0xc3ef('0x28')][_0xc3ef('0x42')]({'where':{'id':_0x49bf41[_0xc3ef('0x3f')]['id']}})[_0xc3ef('0x20')](handleEntityNotFound(_0x287fd1,null))[_0xc3ef('0x20')](saveUpdates(_0x49bf41['body'],null))[_0xc3ef('0x20')](respondWithResult(_0x287fd1,null))[_0xc3ef('0x3d')](handleError(_0x287fd1,null));};exports[_0xc3ef('0x21')]=function(_0x35b7b2,_0x941649){return db[_0xc3ef('0x28')]['find']({'where':{'id':_0x35b7b2['params']['id']}})[_0xc3ef('0x20')](handleEntityNotFound(_0x941649,null))[_0xc3ef('0x20')](removeEntity(_0x941649,null))[_0xc3ef('0x3d')](handleError(_0x941649,null));};exports[_0xc3ef('0x45')]=function(_0x2d03cc,_0x7ec3,_0x5d097d){var _0x3b9056={};var _0x312049={};var _0x3267db;var _0x187d11;return db[_0xc3ef('0x28')][_0xc3ef('0x46')]({'where':{'id':_0x2d03cc[_0xc3ef('0x3f')]['id']}})[_0xc3ef('0x20')](handleEntityNotFound(_0x7ec3,null))[_0xc3ef('0x20')](function(_0xc09fc7){if(_0xc09fc7){_0x3267db=_0xc09fc7;_0x312049['model']=_[_0xc3ef('0x2d')](db[_0xc3ef('0x47')][_0xc3ef('0x40')]);_0x312049['query']=_[_0xc3ef('0x2d')](_0x2d03cc['query']);_0x312049[_0xc3ef('0x2e')]=_[_0xc3ef('0x2f')](_0x312049[_0xc3ef('0x2b')],_0x312049[_0xc3ef('0x2c')]);_0x3b9056[_0xc3ef('0x30')]=_[_0xc3ef('0x2f')](_0x312049[_0xc3ef('0x2b')],qs[_0xc3ef('0x31')](_0x2d03cc['query'][_0xc3ef('0x31')]));_0x3b9056[_0xc3ef('0x30')]=_0x3b9056[_0xc3ef('0x30')][_0xc3ef('0x32')]?_0x3b9056[_0xc3ef('0x30')]:_0x312049[_0xc3ef('0x2b')];_0x3b9056['order']=qs[_0xc3ef('0x35')](_0x2d03cc[_0xc3ef('0x2c')][_0xc3ef('0x35')]);_0x3b9056[_0xc3ef('0x37')]=qs['filters'](_[_0xc3ef('0x36')](_0x2d03cc[_0xc3ef('0x2c')],_0x312049[_0xc3ef('0x2e')]));if(_0x2d03cc[_0xc3ef('0x2c')][_0xc3ef('0x39')]){_0x3b9056[_0xc3ef('0x37')]=_[_0xc3ef('0x3a')](_0x3b9056[_0xc3ef('0x37')],{'$or':_['map'](_0x3b9056['attributes'],function(_0x2db2db){var _0x232fdd={};_0x232fdd[_0x2db2db]={'$like':'%'+_0x2d03cc[_0xc3ef('0x2c')]['filter']+'%'};return _0x232fdd;})});}_0x3b9056=_['merge']({},_0x3b9056,_0x2d03cc[_0xc3ef('0x3b')]);return _0x3267db['getConfigurations'](_0x3b9056);}})[_0xc3ef('0x20')](function(_0x45e2b9){if(_0x45e2b9){_0x187d11=_0x45e2b9[_0xc3ef('0x32')];if(!_0x2d03cc[_0xc3ef('0x2c')]['hasOwnProperty'](_0xc3ef('0x33'))){_0x3b9056[_0xc3ef('0x19')]=qs[_0xc3ef('0x19')](_0x2d03cc[_0xc3ef('0x2c')][_0xc3ef('0x19')]);_0x3b9056['offset']=qs[_0xc3ef('0x17')](_0x2d03cc[_0xc3ef('0x2c')][_0xc3ef('0x17')]);}return _0x3267db[_0xc3ef('0x45')](_0x3b9056);}})['then'](function(_0x21b0ff){if(_0x21b0ff){return _0x21b0ff?{'count':_0x187d11,'rows':_0x21b0ff}:null;}})[_0xc3ef('0x20')](respondWithResult(_0x7ec3,null))['catch'](handleError(_0x7ec3,null));};exports[_0xc3ef('0x48')]=function(_0x58b33c,_0x414a61,_0x519ed9){if(_0x58b33c[_0xc3ef('0x44')]['id']){delete _0x58b33c[_0xc3ef('0x44')]['id'];}return db[_0xc3ef('0x28')][_0xc3ef('0x46')]({'where':{'id':_0x58b33c['params']['id']}})[_0xc3ef('0x20')](handleEntityNotFound(_0x414a61,null))['then'](function(_0x8d45fe){if(_0x8d45fe){_0x58b33c[_0xc3ef('0x44')][_0xc3ef('0x49')]=_0x8d45fe['id'];_0x58b33c['body'][_0xc3ef('0x4a')]=integrations['getSubjects'](_0x58b33c[_0xc3ef('0x44')][_0xc3ef('0x4b')],_0x58b33c[_0xc3ef('0x44')][_0xc3ef('0x2a')]);_0x58b33c['body'][_0xc3ef('0x4c')]=integrations[_0xc3ef('0x4d')](_0x58b33c[_0xc3ef('0x44')][_0xc3ef('0x4b')],_0x58b33c['body'][_0xc3ef('0x2a')]);return db[_0xc3ef('0x47')][_0xc3ef('0x43')](_0x58b33c[_0xc3ef('0x44')],{'include':[{'model':db[_0xc3ef('0x4e')],'as':_0xc3ef('0x4a')},{'model':db[_0xc3ef('0x4e')],'as':'Descriptions'}]});}return null;})[_0xc3ef('0x20')](respondWithResult(_0x414a61,null))[_0xc3ef('0x3d')](handleError(_0x414a61,null));};function getAccessToken(_0x198cd1){return new Promise(function(_0x12a7ac,_0x2679f6){var _0x5da8af;switch(_0x198cd1[_0xc3ef('0x4f')]){case'US':_0x5da8af=_0xc3ef('0x50');break;case'AU':_0x5da8af=_0xc3ef('0x51');break;case'EU':_0x5da8af=_0xc3ef('0x52');break;case'IN':_0x5da8af=_0xc3ef('0x53');break;case'CN':_0x5da8af=_0xc3ef('0x54');break;default:_0x5da8af=_0xc3ef('0x52');break;}var _0x162a90={'method':_0xc3ef('0x55'),'uri':_0x5da8af+_0xc3ef('0x56'),'qs':{'refresh_token':_0x198cd1[_0xc3ef('0x57')],'client_id':_0x198cd1[_0xc3ef('0x58')],'client_secret':_0x198cd1[_0xc3ef('0x59')],'grant_type':_0xc3ef('0x5a')},'json':!![]};return rp(_0x162a90)[_0xc3ef('0x20')](function(_0x1fc4ab){if(_0x1fc4ab[_0xc3ef('0x5b')]){_0x12a7ac(_0x1fc4ab[_0xc3ef('0x5b')]);}else{_0x2679f6('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xc3ef('0x3d')](function(_0x5b27b6){_0x2679f6(_0x5b27b6);});});}exports['getFields']=function(_0x5dd3fd,_0x449fac,_0x4eca0e){var _0x2803d2,_0x322694,_0x1d20f2,_0x33d53f,_0x17e081;return db['ZohoAccount']['findOne']({'where':{'id':_0x5dd3fd[_0xc3ef('0x3f')]['id']},'attributes':['id',_0xc3ef('0x5c'),_0xc3ef('0x4f'),_0xc3ef('0x58'),_0xc3ef('0x59'),'serverUrl',_0xc3ef('0x5d'),_0xc3ef('0x57')]})[_0xc3ef('0x20')](handleEntityNotFound(_0x449fac,null))[_0xc3ef('0x20')](function(_0x898d10){_0x17e081=_0x898d10;_0x2803d2=_0x17e081['host'];_0x322694=_0x2803d2===_0xc3ef('0x5e')?'eu':_0xc3ef('0x5f');_0x1d20f2=_0x17e081[_0xc3ef('0x60')];var _0x363c12=_0x1d20f2[_0xc3ef('0x61')](-0x1);if(_0x363c12==='/'||_0x363c12==='\x5c'||_0x363c12===':'){_0x1d20f2=_0x1d20f2[_0xc3ef('0x62')](0x0,_0x1d20f2[_0xc3ef('0x63')](_0x363c12));}if(!_0x17e081[_0xc3ef('0x57')]){throw new Error(_0xc3ef('0x64'));}return getAccessToken(_0x17e081);})[_0xc3ef('0x20')](function(_0x889896){if(_0x889896){return rp({'method':'GET','uri':util[_0xc3ef('0x65')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x322694),'qs':{'module':_0xc3ef('0x66')},'headers':{'Authorization':_0xc3ef('0x67')+_0x889896},'json':!![]});}})['then'](function(_0x8b7685){if(_0x8b7685){if(_0x8b7685['response']&&_0x8b7685['response'][_0xc3ef('0x22')]){throw new Error(_0x8b7685[_0xc3ef('0x68')]['error'][_0xc3ef('0x69')]);}var _0x6fb95a=[];var _0x3b6229=[];var _0x217798=[_0xc3ef('0x6a'),_0xc3ef('0x6b'),_0xc3ef('0x6c'),_0xc3ef('0x6d'),_0xc3ef('0x6e'),_0xc3ef('0x6f'),_0xc3ef('0x70'),_0xc3ef('0x71')];_0x3b6229=_[_0xc3ef('0x72')](_0x8b7685[_0xc3ef('0x31')],function(_0x2862de){return _0x217798[_0xc3ef('0x73')](_0x2862de[_0xc3ef('0x74')]);});for(var _0x48aba8=0x0;_0x48aba8<_0x3b6229['length'];_0x48aba8++){if(_0x3b6229[_0x48aba8][_0xc3ef('0x75')]===![]){_0x6fb95a[_0xc3ef('0x76')]({'id':_0x3b6229[_0x48aba8]['id'],'name':_0x3b6229[_0x48aba8][_0xc3ef('0x77')],'custom':_0x3b6229[_0x48aba8][_0xc3ef('0x78')],'options':_0x3b6229[_0x48aba8][_0xc3ef('0x79')]===_0xc3ef('0x7a')&&_0x3b6229[_0x48aba8][_0xc3ef('0x7b')][_0xc3ef('0x32')]>-0x1?_[_0xc3ef('0x27')](_0x3b6229[_0x48aba8][_0xc3ef('0x7b')],function(_0xdd202a){return{'name':_0xdd202a,'value':_0xdd202a};}):[]});}}return{'count':_0x6fb95a['length'],'rows':_0x6fb95a};}else{return{'count':0x0,'rows':[]};}})[_0xc3ef('0x20')](respondWithResult(_0x449fac,null))[_0xc3ef('0x3d')](function(_0x1a8ff8){var _0x30ab9f=_0x5dd3fd[_0xc3ef('0x2c')][_0xc3ef('0x7c')]?0x1f4:_0x1a8ff8[_0xc3ef('0x7d')]||0x1f4;logger[_0xc3ef('0x22')](_0xc3ef('0x7e'),_0xc3ef('0x7f'),_0x30ab9f,JSON[_0xc3ef('0x80')](_0x1a8ff8));delete _0x1a8ff8['name'];if(_0x30ab9f===0x191){_0x30ab9f=0x190;}_0x449fac[_0xc3ef('0x14')](_0x30ab9f)[_0xc3ef('0x25')](_0x5dd3fd[_0xc3ef('0x2c')][_0xc3ef('0x7c')]?{'message':_0xc3ef('0x81'),'statusCode':_0x1a8ff8['statusCode']}:_0x1a8ff8);});}; \ No newline at end of file +var _0x8827=['count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','ZohoAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','limit','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','rawAttributes','include','create','body','find','params','getConfigurations','findOne','ZohoConfiguration','order','hasOwnProperty','nolimit','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','ZohoField','Subjects','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','serverUrl','code','zoho.eu','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json'];(function(_0x1fb2cd,_0x213c0f){var _0x39a37f=function(_0x435908){while(--_0x435908){_0x1fb2cd['push'](_0x1fb2cd['shift']());}};_0x39a37f(++_0x213c0f);}(_0x8827,0x1e4));var _0x7882=function(_0x4a9dae,_0x1ca5a3){_0x4a9dae=_0x4a9dae-0x0;var _0x30a62e=_0x8827[_0x4a9dae];return _0x30a62e;};'use strict';var emlformat=require(_0x7882('0x0'));var rimraf=require(_0x7882('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7882('0x2'));var rp=require(_0x7882('0x3'));var moment=require(_0x7882('0x4'));var BPromise=require(_0x7882('0x5'));var Mustache=require(_0x7882('0x6'));var util=require(_0x7882('0x7'));var path=require(_0x7882('0x8'));var sox=require(_0x7882('0x9'));var csv=require(_0x7882('0xa'));var ejs=require(_0x7882('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7882('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7882('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7882('0xe'));var Papa=require(_0x7882('0xf'));var Redis=require('ioredis');var authService=require(_0x7882('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7882('0x11'));var hardwareService=require(_0x7882('0x12'));var logger=require(_0x7882('0x13'))('api');var utils=require(_0x7882('0x14'));var config=require(_0x7882('0x15'));var licenseUtil=require(_0x7882('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7882('0x17'));function respondWithStatusCode(_0xec214c,_0x7bd458){_0x7bd458=_0x7bd458||0xcc;return function(_0x453365){if(_0x453365){return _0xec214c[_0x7882('0x18')](_0x7bd458);}return _0xec214c[_0x7882('0x19')](_0x7bd458)[_0x7882('0x1a')]();};}function respondWithResult(_0x2cc1d1,_0x452e0a){_0x452e0a=_0x452e0a||0xc8;return function(_0x1553fc){if(_0x1553fc){return _0x2cc1d1[_0x7882('0x19')](_0x452e0a)[_0x7882('0x1b')](_0x1553fc);}};}function respondWithFilteredResult(_0x452589,_0x594c55){return function(_0x4e820d){if(_0x4e820d){var _0x19d51c=typeof _0x594c55['offset']==='undefined'&&typeof _0x594c55['limit']==='undefined';var _0x49b46b=_0x4e820d[_0x7882('0x1c')];var _0x34f95f=_0x19d51c?0x0:_0x594c55[_0x7882('0x1d')];var _0x267137=_0x19d51c?_0x4e820d[_0x7882('0x1c')]:_0x594c55['offset']+_0x594c55['limit'];var _0x459fab;if(_0x267137>=_0x49b46b){_0x267137=_0x49b46b;_0x459fab=0xc8;}else{_0x459fab=0xce;}_0x452589[_0x7882('0x19')](_0x459fab);return _0x452589[_0x7882('0x1e')](_0x7882('0x1f'),_0x34f95f+'-'+_0x267137+'/'+_0x49b46b)[_0x7882('0x1b')](_0x4e820d);}return null;};}function patchUpdates(_0x56ccf6){return function(_0x22ae12){try{jsonpatch[_0x7882('0x20')](_0x22ae12,_0x56ccf6,!![]);}catch(_0x2ce1c6){return BPromise[_0x7882('0x21')](_0x2ce1c6);}return _0x22ae12[_0x7882('0x22')]();};}function saveUpdates(_0x54a595,_0x3b7aea){return function(_0x1a25fe){if(_0x1a25fe){return _0x1a25fe['update'](_0x54a595)[_0x7882('0x23')](function(_0x220b7e){return _0x220b7e;});}return null;};}function removeEntity(_0x59f8e9,_0x445d9b){return function(_0x360265){if(_0x360265){return _0x360265[_0x7882('0x24')]()[_0x7882('0x23')](function(){_0x59f8e9[_0x7882('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x124e6d,_0x366f06){return function(_0x51ca8d){if(!_0x51ca8d){_0x124e6d[_0x7882('0x18')](0x194);}return _0x51ca8d;};}function handleError(_0x368f74,_0xba09bb){_0xba09bb=_0xba09bb||0x1f4;return function(_0x9883e5){logger[_0x7882('0x25')](_0x9883e5[_0x7882('0x26')]);if(_0x9883e5[_0x7882('0x27')]){delete _0x9883e5[_0x7882('0x27')];}_0x368f74[_0x7882('0x19')](_0xba09bb)[_0x7882('0x28')](_0x9883e5);};}exports['index']=function(_0x518a66,_0x50a440){var _0x47559f={},_0xc6540c={},_0x37e31d={'count':0x0,'rows':[]};var _0x444294=_[_0x7882('0x29')](db[_0x7882('0x2a')]['rawAttributes'],function(_0x1475eb){return{'name':_0x1475eb[_0x7882('0x2b')],'type':_0x1475eb[_0x7882('0x2c')][_0x7882('0x2d')]};});_0xc6540c[_0x7882('0x2e')]=_[_0x7882('0x29')](_0x444294,_0x7882('0x27'));_0xc6540c['query']=_[_0x7882('0x2f')](_0x518a66[_0x7882('0x30')]);_0xc6540c[_0x7882('0x31')]=_[_0x7882('0x32')](_0xc6540c[_0x7882('0x2e')],_0xc6540c[_0x7882('0x30')]);_0x47559f[_0x7882('0x33')]=_[_0x7882('0x32')](_0xc6540c['model'],qs['fields'](_0x518a66[_0x7882('0x30')][_0x7882('0x34')]));_0x47559f[_0x7882('0x33')]=_0x47559f[_0x7882('0x33')][_0x7882('0x35')]?_0x47559f['attributes']:_0xc6540c[_0x7882('0x2e')];if(!_0x518a66['query']['hasOwnProperty']('nolimit')){_0x47559f[_0x7882('0x36')]=qs['limit'](_0x518a66['query']['limit']);_0x47559f[_0x7882('0x1d')]=qs['offset'](_0x518a66[_0x7882('0x30')][_0x7882('0x1d')]);}_0x47559f['order']=qs['sort'](_0x518a66['query']['sort']);_0x47559f[_0x7882('0x37')]=qs['filters'](_[_0x7882('0x38')](_0x518a66[_0x7882('0x30')],_0xc6540c['filters']),_0x444294);if(_0x518a66[_0x7882('0x30')][_0x7882('0x39')]){_0x47559f[_0x7882('0x37')]=_['merge'](_0x47559f['where'],{'$or':_[_0x7882('0x29')](_0x444294,function(_0x1b4dd9){if(_0x1b4dd9['type']!==_0x7882('0x3a')){var _0x2275be={};_0x2275be[_0x1b4dd9[_0x7882('0x27')]]={'$like':'%'+_0x518a66[_0x7882('0x30')]['filter']+'%'};return _0x2275be;}})});}_0x47559f=_[_0x7882('0x3b')]({},_0x47559f,_0x518a66[_0x7882('0x3c')]);var _0x3e85b4={'where':_0x47559f[_0x7882('0x37')]};return db[_0x7882('0x2a')]['count'](_0x3e85b4)[_0x7882('0x23')](function(_0x483153){_0x37e31d['count']=_0x483153;if(_0x518a66[_0x7882('0x30')][_0x7882('0x3d')]){_0x47559f['include']=[{'all':!![]}];}return db[_0x7882('0x2a')][_0x7882('0x3e')](_0x47559f);})[_0x7882('0x23')](function(_0x3f15cd){_0x37e31d[_0x7882('0x3f')]=_0x3f15cd;return _0x37e31d;})[_0x7882('0x23')](respondWithFilteredResult(_0x50a440,_0x47559f))[_0x7882('0x40')](handleError(_0x50a440,null));};exports[_0x7882('0x41')]=function(_0x18d86a,_0x1015dd){var _0x42f229={'raw':![],'where':{'id':_0x18d86a['params']['id']}},_0x17e94={};_0x17e94[_0x7882('0x2e')]=_['keys'](db[_0x7882('0x2a')][_0x7882('0x42')]);_0x17e94[_0x7882('0x30')]=_[_0x7882('0x2f')](_0x18d86a[_0x7882('0x30')]);_0x17e94[_0x7882('0x31')]=_[_0x7882('0x32')](_0x17e94['model'],_0x17e94['query']);_0x42f229[_0x7882('0x33')]=_[_0x7882('0x32')](_0x17e94[_0x7882('0x2e')],qs['fields'](_0x18d86a[_0x7882('0x30')][_0x7882('0x34')]));_0x42f229['attributes']=_0x42f229['attributes'][_0x7882('0x35')]?_0x42f229[_0x7882('0x33')]:_0x17e94[_0x7882('0x2e')];if(_0x18d86a[_0x7882('0x30')][_0x7882('0x3d')]){_0x42f229[_0x7882('0x43')]=[{'all':!![]}];}_0x42f229=_[_0x7882('0x3b')]({},_0x42f229,_0x18d86a[_0x7882('0x3c')]);return db[_0x7882('0x2a')]['find'](_0x42f229)['then'](handleEntityNotFound(_0x1015dd,null))[_0x7882('0x23')](respondWithResult(_0x1015dd,null))['catch'](handleError(_0x1015dd,null));};exports['create']=function(_0x1dd7cc,_0x5c6c6f){return db[_0x7882('0x2a')][_0x7882('0x44')](_0x1dd7cc['body'],{})[_0x7882('0x23')](respondWithResult(_0x5c6c6f,0xc9))['catch'](handleError(_0x5c6c6f,null));};exports['update']=function(_0x15ab38,_0x461982){if(_0x15ab38[_0x7882('0x45')]['id']){delete _0x15ab38[_0x7882('0x45')]['id'];}return db[_0x7882('0x2a')][_0x7882('0x46')]({'where':{'id':_0x15ab38[_0x7882('0x47')]['id']}})[_0x7882('0x23')](handleEntityNotFound(_0x461982,null))['then'](saveUpdates(_0x15ab38[_0x7882('0x45')],null))[_0x7882('0x23')](respondWithResult(_0x461982,null))[_0x7882('0x40')](handleError(_0x461982,null));};exports[_0x7882('0x24')]=function(_0x52c55b,_0x4cd9bc){return db[_0x7882('0x2a')][_0x7882('0x46')]({'where':{'id':_0x52c55b['params']['id']}})[_0x7882('0x23')](handleEntityNotFound(_0x4cd9bc,null))[_0x7882('0x23')](removeEntity(_0x4cd9bc,null))[_0x7882('0x40')](handleError(_0x4cd9bc,null));};exports[_0x7882('0x48')]=function(_0x1ea966,_0x15cfa1,_0xc86566){var _0x2307e2={};var _0x2ec86a={};var _0x21724c;var _0x2ae6e4;return db['ZohoAccount'][_0x7882('0x49')]({'where':{'id':_0x1ea966['params']['id']}})[_0x7882('0x23')](handleEntityNotFound(_0x15cfa1,null))[_0x7882('0x23')](function(_0x581f53){if(_0x581f53){_0x21724c=_0x581f53;_0x2ec86a['model']=_[_0x7882('0x2f')](db[_0x7882('0x4a')][_0x7882('0x42')]);_0x2ec86a['query']=_[_0x7882('0x2f')](_0x1ea966[_0x7882('0x30')]);_0x2ec86a[_0x7882('0x31')]=_[_0x7882('0x32')](_0x2ec86a[_0x7882('0x2e')],_0x2ec86a[_0x7882('0x30')]);_0x2307e2['attributes']=_[_0x7882('0x32')](_0x2ec86a[_0x7882('0x2e')],qs[_0x7882('0x34')](_0x1ea966['query'][_0x7882('0x34')]));_0x2307e2[_0x7882('0x33')]=_0x2307e2['attributes'][_0x7882('0x35')]?_0x2307e2[_0x7882('0x33')]:_0x2ec86a[_0x7882('0x2e')];_0x2307e2[_0x7882('0x4b')]=qs['sort'](_0x1ea966['query']['sort']);_0x2307e2[_0x7882('0x37')]=qs[_0x7882('0x31')](_[_0x7882('0x38')](_0x1ea966['query'],_0x2ec86a[_0x7882('0x31')]));if(_0x1ea966[_0x7882('0x30')][_0x7882('0x39')]){_0x2307e2['where']=_['merge'](_0x2307e2[_0x7882('0x37')],{'$or':_['map'](_0x2307e2[_0x7882('0x33')],function(_0x5855b0){var _0x689ee1={};_0x689ee1[_0x5855b0]={'$like':'%'+_0x1ea966[_0x7882('0x30')]['filter']+'%'};return _0x689ee1;})});}_0x2307e2=_[_0x7882('0x3b')]({},_0x2307e2,_0x1ea966['options']);return _0x21724c['getConfigurations'](_0x2307e2);}})[_0x7882('0x23')](function(_0x1e398b){if(_0x1e398b){_0x2ae6e4=_0x1e398b[_0x7882('0x35')];if(!_0x1ea966[_0x7882('0x30')][_0x7882('0x4c')](_0x7882('0x4d'))){_0x2307e2[_0x7882('0x36')]=qs[_0x7882('0x36')](_0x1ea966['query'][_0x7882('0x36')]);_0x2307e2['offset']=qs[_0x7882('0x1d')](_0x1ea966[_0x7882('0x30')][_0x7882('0x1d')]);}return _0x21724c[_0x7882('0x48')](_0x2307e2);}})[_0x7882('0x23')](function(_0x317bc6){if(_0x317bc6){return _0x317bc6?{'count':_0x2ae6e4,'rows':_0x317bc6}:null;}})[_0x7882('0x23')](respondWithResult(_0x15cfa1,null))[_0x7882('0x40')](handleError(_0x15cfa1,null));};exports[_0x7882('0x4e')]=function(_0x1becab,_0x17919f,_0x172723){if(_0x1becab[_0x7882('0x45')]['id']){delete _0x1becab[_0x7882('0x45')]['id'];}return db[_0x7882('0x2a')][_0x7882('0x49')]({'where':{'id':_0x1becab[_0x7882('0x47')]['id']}})[_0x7882('0x23')](handleEntityNotFound(_0x17919f,null))['then'](function(_0x167398){if(_0x167398){_0x1becab['body']['AccountId']=_0x167398['id'];_0x1becab['body']['Subjects']=integrations[_0x7882('0x4f')](_0x1becab['body'][_0x7882('0x50')],_0x1becab[_0x7882('0x45')]['type']);_0x1becab[_0x7882('0x45')][_0x7882('0x51')]=integrations[_0x7882('0x52')](_0x1becab[_0x7882('0x45')][_0x7882('0x50')],_0x1becab[_0x7882('0x45')]['type']);return db[_0x7882('0x4a')][_0x7882('0x44')](_0x1becab['body'],{'include':[{'model':db[_0x7882('0x53')],'as':_0x7882('0x54')},{'model':db[_0x7882('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x17919f,null))[_0x7882('0x40')](handleError(_0x17919f,null));};function getAccessToken(_0x51593f){return new Promise(function(_0x3a42ba,_0x50765b){var _0x5d37bf;switch(_0x51593f['zone']){case'US':_0x5d37bf=_0x7882('0x55');break;case'AU':_0x5d37bf=_0x7882('0x56');break;case'EU':_0x5d37bf='https://accounts.zoho.eu';break;case'IN':_0x5d37bf='https://accounts.zoho.in';break;case'CN':_0x5d37bf='https://accounts.zoho.com.cn';break;default:_0x5d37bf=_0x7882('0x57');break;}var _0x5406da={'method':'POST','uri':_0x5d37bf+_0x7882('0x58'),'qs':{'refresh_token':_0x51593f[_0x7882('0x59')],'client_id':_0x51593f[_0x7882('0x5a')],'client_secret':_0x51593f[_0x7882('0x5b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5406da)['then'](function(_0x57aa64){if(_0x57aa64[_0x7882('0x5c')]){_0x3a42ba(_0x57aa64[_0x7882('0x5c')]);}else{_0x50765b(_0x7882('0x5d'));}})[_0x7882('0x40')](function(_0x4bb2cd){_0x50765b(_0x4bb2cd);});});}exports['getFields']=function(_0x511dd7,_0x2b09c8,_0x145c5b){var _0xfea3a8,_0x5af2a1,_0x288ebf,_0x7698ca,_0x32201b;return db[_0x7882('0x2a')][_0x7882('0x49')]({'where':{'id':_0x511dd7[_0x7882('0x47')]['id']},'attributes':['id',_0x7882('0x5e'),_0x7882('0x5f'),_0x7882('0x5a'),_0x7882('0x5b'),_0x7882('0x60'),_0x7882('0x61'),_0x7882('0x59')]})[_0x7882('0x23')](handleEntityNotFound(_0x2b09c8,null))[_0x7882('0x23')](function(_0x44bf89){_0x32201b=_0x44bf89;_0xfea3a8=_0x32201b[_0x7882('0x5e')];_0x5af2a1=_0xfea3a8===_0x7882('0x62')?'eu':'com';_0x288ebf=_0x32201b[_0x7882('0x60')];var _0x56eac2=_0x288ebf['slice'](-0x1);if(_0x56eac2==='/'||_0x56eac2==='\x5c'||_0x56eac2===':'){_0x288ebf=_0x288ebf[_0x7882('0x63')](0x0,_0x288ebf[_0x7882('0x64')](_0x56eac2));}if(!_0x32201b['refreshToken']){throw new Error(_0x7882('0x65'));}return getAccessToken(_0x32201b);})[_0x7882('0x23')](function(_0x1f3616){if(_0x1f3616){return rp({'method':'GET','uri':util['format'](_0x7882('0x66'),_0x5af2a1),'qs':{'module':_0x7882('0x67')},'headers':{'Authorization':_0x7882('0x68')+_0x1f3616},'json':!![]});}})['then'](function(_0x544f6a){if(_0x544f6a){if(_0x544f6a[_0x7882('0x69')]&&_0x544f6a[_0x7882('0x69')][_0x7882('0x25')]){throw new Error(_0x544f6a[_0x7882('0x69')][_0x7882('0x25')][_0x7882('0x6a')]);}var _0x2d6e53=[];var _0x358676=[];var _0x2339d3=[_0x7882('0x6b'),_0x7882('0x6c'),_0x7882('0x6d'),_0x7882('0x6e'),'Call_Duration','Call_Result',_0x7882('0x6f'),_0x7882('0x70')];_0x358676=_[_0x7882('0x71')](_0x544f6a[_0x7882('0x34')],function(_0x41935a){return _0x2339d3[_0x7882('0x72')](_0x41935a[_0x7882('0x73')]);});for(var _0x2d6356=0x0;_0x2d6356<_0x358676['length'];_0x2d6356++){if(_0x358676[_0x2d6356][_0x7882('0x74')]===![]){_0x2d6e53[_0x7882('0x75')]({'id':_0x358676[_0x2d6356]['id'],'name':_0x358676[_0x2d6356][_0x7882('0x76')],'custom':_0x358676[_0x2d6356]['custom_field'],'options':_0x358676[_0x2d6356][_0x7882('0x77')]===_0x7882('0x78')&&_0x358676[_0x2d6356][_0x7882('0x79')][_0x7882('0x35')]>-0x1?_[_0x7882('0x29')](_0x358676[_0x2d6356][_0x7882('0x79')],function(_0x5498f9){return{'name':_0x5498f9,'value':_0x5498f9};}):[]});}}return{'count':_0x2d6e53['length'],'rows':_0x2d6e53};}else{return{'count':0x0,'rows':[]};}})[_0x7882('0x23')](respondWithResult(_0x2b09c8,null))['catch'](function(_0x1c9f58){var _0x342414=_0x511dd7[_0x7882('0x30')][_0x7882('0x7a')]?0x1f4:_0x1c9f58[_0x7882('0x7b')]||0x1f4;logger[_0x7882('0x25')](_0x7882('0x7c'),_0x7882('0x7d'),_0x342414,JSON[_0x7882('0x7e')](_0x1c9f58));delete _0x1c9f58[_0x7882('0x27')];if(_0x342414===0x191){_0x342414=0x190;}_0x2b09c8[_0x7882('0x19')](_0x342414)['send'](_0x511dd7['query'][_0x7882('0x7a')]?{'message':_0x7882('0x7f'),'statusCode':_0x1c9f58[_0x7882('0x7b')]}:_0x1c9f58);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e830f6a..9d81257 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 _0x22ea=['then','refresh_token','refreshToken','info','format','name','error','inspect','catch','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded'];(function(_0x34203a,_0x213c29){var _0x183455=function(_0x1601bb){while(--_0x1601bb){_0x34203a['push'](_0x34203a['shift']());}};_0x183455(++_0x213c29);}(_0x22ea,0xb3));var _0xa22e=function(_0x22a54a,_0xf46216){_0x22a54a=_0x22a54a-0x0;var _0x3b2d5c=_0x22ea[_0x22a54a];return _0x3b2d5c;};'use strict';var _=require(_0xa22e('0x0'));var util=require(_0xa22e('0x1'));var logger=require(_0xa22e('0x2'))(_0xa22e('0x3'));var moment=require('moment');var BPromise=require(_0xa22e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa22e('0x5'));var rimraf=require(_0xa22e('0x6'));var config=require(_0xa22e('0x7'));var attributes=require(_0xa22e('0x8'));var integrations=require(_0xa22e('0x9'));module['exports']=function(_0x549c27,_0x172a46){return _0x549c27[_0xa22e('0xa')](_0xa22e('0xb'),attributes,{'tableName':_0xa22e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x326dfb,_0x2c3134,_0x356666){if(_0x326dfb[_0xa22e('0xd')](_0xa22e('0xe'))||_0x326dfb['changed'](_0xa22e('0xf'))||_0x326dfb[_0xa22e('0xd')]('clientId')||_0x326dfb[_0xa22e('0xd')](_0xa22e('0x10'))||_0x326dfb[_0xa22e('0xd')](_0xa22e('0x11'))||_0x326dfb['changed']('host')){var _0x16a29b,_0x2a3eea;_0x16a29b=_0x326dfb[_0xa22e('0xf')];var _0x3047ba=_0x16a29b[_0xa22e('0x12')](-0x1);if(_0x3047ba==='/'||_0x3047ba==='\x5c'||_0x3047ba===':'){_0x16a29b=_0x16a29b[_0xa22e('0x13')](0x0,_0x16a29b[_0xa22e('0x14')](_0x3047ba));}switch(_0x326dfb[_0xa22e('0xe')]){case'US':_0x2a3eea=_0xa22e('0x15');break;case'AU':_0x2a3eea=_0xa22e('0x16');break;case'IN':_0x2a3eea=_0xa22e('0x17');break;case'CN':_0x2a3eea=_0xa22e('0x18');break;default:_0x2a3eea=_0xa22e('0x19');break;}var _0x433cf0={'method':_0xa22e('0x1a'),'uri':_0x2a3eea+_0xa22e('0x1b'),'form':{'grant_type':_0xa22e('0x1c'),'client_id':_0x326dfb[_0xa22e('0x1d')],'client_secret':_0x326dfb[_0xa22e('0x10')],'redirect_uri':_0x326dfb[_0xa22e('0xf')],'code':_0x326dfb[_0xa22e('0x11')]},'headers':{'Content-Type':_0xa22e('0x1e')}};return rp(_0x433cf0)[_0xa22e('0x1f')](function(_0x3ea0df){var _0x368079=JSON['parse'](_0x3ea0df);if(_0x368079[_0xa22e('0x20')]){_0x326dfb[_0xa22e('0x21')]=_0x368079[_0xa22e('0x20')];logger[_0xa22e('0x22')](util[_0xa22e('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x326dfb[_0xa22e('0x24')],_0x326dfb['id']));}else{logger[_0xa22e('0x25')](util[_0xa22e('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x326dfb[_0xa22e('0x24')],_0x326dfb['id']),util[_0xa22e('0x26')](_0x368079,{'showHidden':![],'depth':null}));}return _0x356666(null,_0x2c3134);})[_0xa22e('0x27')](function(_0x283318){logger[_0xa22e('0x25')](util[_0xa22e('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x326dfb['name'],_0x326dfb['id']),util[_0xa22e('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x356666(_0x283318);});}else{return _0x356666(null,_0x2c3134);}},'beforeUpdate':function(_0x17d8d7,_0x364cf0,_0x59146b){if(_0x17d8d7[_0xa22e('0xd')](_0xa22e('0xe'))||_0x17d8d7[_0xa22e('0xd')](_0xa22e('0xf'))||_0x17d8d7[_0xa22e('0xd')](_0xa22e('0x1d'))||_0x17d8d7['changed']('clientSecret')||_0x17d8d7[_0xa22e('0xd')]('code')||_0x17d8d7[_0xa22e('0xd')]('host')){var _0x1c7f1c,_0x4f295e;_0x1c7f1c=_0x17d8d7[_0xa22e('0xf')];var _0x1fb7a7=_0x1c7f1c[_0xa22e('0x12')](-0x1);if(_0x1fb7a7==='/'||_0x1fb7a7==='\x5c'||_0x1fb7a7===':'){_0x1c7f1c=_0x1c7f1c['substring'](0x0,_0x1c7f1c['lastIndexOf'](_0x1fb7a7));}switch(_0x17d8d7[_0xa22e('0xe')]){case'US':_0x4f295e=_0xa22e('0x15');break;case'AU':_0x4f295e=_0xa22e('0x16');break;case'IN':_0x4f295e=_0xa22e('0x17');break;case'CN':_0x4f295e=_0xa22e('0x18');break;default:_0x4f295e=_0xa22e('0x19');break;}var _0x3cde51={'method':_0xa22e('0x1a'),'uri':_0x4f295e+'/oauth/v2/token','form':{'grant_type':_0xa22e('0x1c'),'client_id':_0x17d8d7['clientId'],'client_secret':_0x17d8d7[_0xa22e('0x10')],'redirect_uri':_0x17d8d7['serverUrl'],'code':_0x17d8d7[_0xa22e('0x11')]},'headers':{'Content-Type':_0xa22e('0x1e')}};return rp(_0x3cde51)[_0xa22e('0x1f')](function(_0xafad56){var _0x16e905=JSON['parse'](_0xafad56);if(_0x16e905[_0xa22e('0x20')]){_0x17d8d7[_0xa22e('0x21')]=_0x16e905[_0xa22e('0x20')];logger[_0xa22e('0x22')](util[_0xa22e('0x23')](_0xa22e('0x28'),_0x17d8d7[_0xa22e('0x24')],_0x17d8d7['id']));}else{logger[_0xa22e('0x25')](util['format'](_0xa22e('0x29'),_0x17d8d7[_0xa22e('0x24')],_0x17d8d7['id']),util[_0xa22e('0x26')](_0x16e905,{'showHidden':![],'depth':null}));}return _0x59146b(null,_0x364cf0);})['catch'](function(_0x30713e){logger[_0xa22e('0x25')](util[_0xa22e('0x23')](_0xa22e('0x29'),_0x17d8d7['name'],_0x17d8d7['id']),util[_0xa22e('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x59146b(_0x30713e);});}else{return _0x59146b(null,_0x364cf0);}}}});}; \ No newline at end of file +var _0x39e9=['catch','error','authorization_code','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0x39e9,0x1a7));var _0x939e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x39e9[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x939e('0x0'));var util=require('util');var logger=require(_0x939e('0x1'))(_0x939e('0x2'));var moment=require(_0x939e('0x3'));var BPromise=require(_0x939e('0x4'));var rp=require(_0x939e('0x5'));var fs=require('fs');var path=require(_0x939e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x939e('0x7'));var integrations=require(_0x939e('0x8'));module['exports']=function(_0xfc4168,_0x41d40e){return _0xfc4168[_0x939e('0x9')](_0x939e('0xa'),attributes,{'tableName':_0x939e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1396c2,_0x10f9c0,_0x5577e1){if(_0x1396c2[_0x939e('0xc')](_0x939e('0xd'))||_0x1396c2[_0x939e('0xc')](_0x939e('0xe'))||_0x1396c2[_0x939e('0xc')](_0x939e('0xf'))||_0x1396c2[_0x939e('0xc')](_0x939e('0x10'))||_0x1396c2[_0x939e('0xc')](_0x939e('0x11'))||_0x1396c2[_0x939e('0xc')](_0x939e('0x12'))){var _0x470d7f,_0x42ceb1;_0x470d7f=_0x1396c2[_0x939e('0xe')];var _0x4caabd=_0x470d7f[_0x939e('0x13')](-0x1);if(_0x4caabd==='/'||_0x4caabd==='\x5c'||_0x4caabd===':'){_0x470d7f=_0x470d7f[_0x939e('0x14')](0x0,_0x470d7f[_0x939e('0x15')](_0x4caabd));}switch(_0x1396c2[_0x939e('0xd')]){case'US':_0x42ceb1=_0x939e('0x16');break;case'AU':_0x42ceb1=_0x939e('0x17');break;case'IN':_0x42ceb1='https://accounts.zoho.in';break;case'CN':_0x42ceb1=_0x939e('0x18');break;default:_0x42ceb1=_0x939e('0x19');break;}var _0x4983fc={'method':_0x939e('0x1a'),'uri':_0x42ceb1+_0x939e('0x1b'),'form':{'grant_type':'authorization_code','client_id':_0x1396c2['clientId'],'client_secret':_0x1396c2[_0x939e('0x10')],'redirect_uri':_0x1396c2['serverUrl'],'code':_0x1396c2[_0x939e('0x11')]},'headers':{'Content-Type':_0x939e('0x1c')}};return rp(_0x4983fc)[_0x939e('0x1d')](function(_0xf229d2){var _0x3716aa=JSON[_0x939e('0x1e')](_0xf229d2);if(_0x3716aa[_0x939e('0x1f')]){_0x1396c2[_0x939e('0x20')]=_0x3716aa[_0x939e('0x1f')];logger[_0x939e('0x21')](util[_0x939e('0x22')](_0x939e('0x23'),_0x1396c2[_0x939e('0x24')],_0x1396c2['id']));}else{logger['error'](util['format'](_0x939e('0x25'),_0x1396c2[_0x939e('0x24')],_0x1396c2['id']),util[_0x939e('0x26')](_0x3716aa,{'showHidden':![],'depth':null}));}return _0x5577e1(null,_0x10f9c0);})[_0x939e('0x27')](function(_0x5f0ed9){logger[_0x939e('0x28')](util[_0x939e('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1396c2[_0x939e('0x24')],_0x1396c2['id']),util[_0x939e('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x5577e1(_0x5f0ed9);});}else{return _0x5577e1(null,_0x10f9c0);}},'beforeUpdate':function(_0x203426,_0x14ed48,_0x4f4376){if(_0x203426[_0x939e('0xc')](_0x939e('0xd'))||_0x203426['changed'](_0x939e('0xe'))||_0x203426[_0x939e('0xc')]('clientId')||_0x203426[_0x939e('0xc')]('clientSecret')||_0x203426[_0x939e('0xc')](_0x939e('0x11'))||_0x203426[_0x939e('0xc')](_0x939e('0x12'))){var _0x584ef2,_0x2b66af;_0x584ef2=_0x203426[_0x939e('0xe')];var _0x57f554=_0x584ef2[_0x939e('0x13')](-0x1);if(_0x57f554==='/'||_0x57f554==='\x5c'||_0x57f554===':'){_0x584ef2=_0x584ef2['substring'](0x0,_0x584ef2[_0x939e('0x15')](_0x57f554));}switch(_0x203426[_0x939e('0xd')]){case'US':_0x2b66af=_0x939e('0x16');break;case'AU':_0x2b66af=_0x939e('0x17');break;case'IN':_0x2b66af='https://accounts.zoho.in';break;case'CN':_0x2b66af=_0x939e('0x18');break;default:_0x2b66af=_0x939e('0x19');break;}var _0x4eefce={'method':_0x939e('0x1a'),'uri':_0x2b66af+_0x939e('0x1b'),'form':{'grant_type':_0x939e('0x29'),'client_id':_0x203426[_0x939e('0xf')],'client_secret':_0x203426[_0x939e('0x10')],'redirect_uri':_0x203426['serverUrl'],'code':_0x203426['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4eefce)[_0x939e('0x1d')](function(_0x17befa){var _0x4c1e61=JSON[_0x939e('0x1e')](_0x17befa);if(_0x4c1e61['refresh_token']){_0x203426[_0x939e('0x20')]=_0x4c1e61[_0x939e('0x1f')];logger['info'](util[_0x939e('0x22')](_0x939e('0x23'),_0x203426[_0x939e('0x24')],_0x203426['id']));}else{logger[_0x939e('0x28')](util[_0x939e('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x203426[_0x939e('0x24')],_0x203426['id']),util['inspect'](_0x4c1e61,{'showHidden':![],'depth':null}));}return _0x4f4376(null,_0x14ed48);})[_0x939e('0x27')](function(_0x14b205){logger[_0x939e('0x28')](util[_0x939e('0x22')](_0x939e('0x25'),_0x203426['name'],_0x203426['id']),util[_0x939e('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x4f4376(_0x14b205);});}else{return _0x4f4376(null,_0x14ed48);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 2db20b9..93dfae7 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 _0x806d=['util','moment','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','limit','include','model','attributes','debug','ShowZohoAccount','raw','map','stringify','lodash'];(function(_0x59a20d,_0x35a387){var _0x2202a4=function(_0x2ac951){while(--_0x2ac951){_0x59a20d['push'](_0x59a20d['shift']());}};_0x2202a4(++_0x35a387);}(_0x806d,0x131));var _0xd806=function(_0x238194,_0x50e02b){_0x238194=_0x238194-0x0;var _0x437c8a=_0x806d[_0x238194];return _0x437c8a;};'use strict';var _=require(_0xd806('0x0'));var util=require(_0xd806('0x1'));var moment=require(_0xd806('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd806('0x3'))['db'];var utils=require(_0xd806('0x4'));var logger=require('../../config/logger')(_0xd806('0x5'));var config=require('../../config/environment');var jayson=require(_0xd806('0x6'));var client=jayson[_0xd806('0x7')][_0xd806('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26135a,_0x3a3446,_0x3873bf){return new BPromise(function(_0x1c1932,_0x4c8dea){return client[_0xd806('0x9')](_0x26135a,_0x3873bf)[_0xd806('0xa')](function(_0x902695){logger[_0xd806('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x3a3446,_0xd806('0xc'));logger['debug'](_0xd806('0xd'),_0x3a3446,_0xd806('0xc'),JSON['stringify'](_0x902695));if(_0x902695[_0xd806('0xe')]){if(_0x902695[_0xd806('0xe')][_0xd806('0xf')]===0x1f4){logger[_0xd806('0xe')](_0xd806('0x10'),_0x3a3446,_0x902695[_0xd806('0xe')][_0xd806('0x11')]);return _0x4c8dea(_0x902695[_0xd806('0xe')][_0xd806('0x11')]);}logger[_0xd806('0xe')](_0xd806('0x10'),_0x3a3446,_0x902695['error'][_0xd806('0x11')]);return _0x1c1932(_0x902695[_0xd806('0xe')][_0xd806('0x11')]);}else{logger['info'](_0xd806('0x10'),_0x3a3446,'request\x20sent');_0x1c1932(_0x902695[_0xd806('0x12')][_0xd806('0x11')]);}})[_0xd806('0x13')](function(_0x138725){logger[_0xd806('0xe')](_0xd806('0x10'),_0x3a3446,_0x138725);_0x4c8dea(_0x138725);});});}exports[_0xd806('0x14')]=function(_0x332eec){var _0x1c9ce4=this;return new Promise(function(_0x5bd7a1,_0x38c659){return db[_0xd806('0x15')][_0xd806('0x16')]({'raw':_0x332eec['options']?_0x332eec[_0xd806('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x332eec[_0xd806('0x17')]?_0x332eec[_0xd806('0x17')][_0xd806('0x18')]||null:null,'attributes':_0x332eec[_0xd806('0x17')]?_0x332eec[_0xd806('0x17')]['attributes']||null:null,'limit':_0x332eec['options']?_0x332eec[_0xd806('0x17')][_0xd806('0x19')]||null:null,'include':_0x332eec[_0xd806('0x17')]?_0x332eec[_0xd806('0x17')][_0xd806('0x1a')]?_['map'](_0x332eec['options'][_0xd806('0x1a')],function(_0x1335c9){return{'model':db[_0x1335c9[_0xd806('0x1b')]],'as':_0x1335c9['as'],'attributes':_0x1335c9[_0xd806('0x1c')],'include':_0x1335c9[_0xd806('0x1a')]?_['map'](_0x1335c9[_0xd806('0x1a')],function(_0xf8df1e){return{'model':db[_0xf8df1e['model']],'as':_0xf8df1e['as'],'attributes':_0xf8df1e['attributes'],'include':_0xf8df1e[_0xd806('0x1a')]?_['map'](_0xf8df1e[_0xd806('0x1a')],function(_0xe9664e){return{'model':db[_0xe9664e[_0xd806('0x1b')]],'as':_0xe9664e['as'],'attributes':_0xe9664e[_0xd806('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd806('0xa')](function(_0x59b43d){logger['info'](_0xd806('0x14'),_0x332eec);logger[_0xd806('0x1d')](_0xd806('0x14'),_0x332eec,JSON['stringify'](_0x59b43d));_0x5bd7a1(_0x59b43d);})[_0xd806('0x13')](function(_0x25a2f0){logger[_0xd806('0xe')]('GetZohoAccount',_0x25a2f0[_0xd806('0x11')],_0x332eec);_0x38c659(_0x1c9ce4[_0xd806('0xe')](0x1f4,_0x25a2f0[_0xd806('0x11')]));});});};exports[_0xd806('0x1e')]=function(_0x34d45f){var _0x183d67=this;return new Promise(function(_0x49103a,_0x5845b4){return db['ZohoAccount']['find']({'raw':_0x34d45f[_0xd806('0x17')]?_0x34d45f[_0xd806('0x17')][_0xd806('0x1f')]===undefined?!![]:![]:!![],'where':_0x34d45f[_0xd806('0x17')]?_0x34d45f[_0xd806('0x17')][_0xd806('0x18')]||null:null,'attributes':_0x34d45f[_0xd806('0x17')]?_0x34d45f[_0xd806('0x17')][_0xd806('0x1c')]||null:null,'include':_0x34d45f['options']?_0x34d45f[_0xd806('0x17')][_0xd806('0x1a')]?_[_0xd806('0x20')](_0x34d45f[_0xd806('0x17')]['include'],function(_0x454e28){return{'model':db[_0x454e28['model']],'as':_0x454e28['as'],'attributes':_0x454e28[_0xd806('0x1c')],'include':_0x454e28['include']?_['map'](_0x454e28[_0xd806('0x1a')],function(_0x159c1e){return{'model':db[_0x159c1e['model']],'as':_0x159c1e['as'],'attributes':_0x159c1e[_0xd806('0x1c')],'include':_0x159c1e[_0xd806('0x1a')]?_['map'](_0x159c1e[_0xd806('0x1a')],function(_0x2a94a3){return{'model':db[_0x2a94a3['model']],'as':_0x2a94a3['as'],'attributes':_0x2a94a3[_0xd806('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd806('0xa')](function(_0x51a417){logger['info'](_0xd806('0x1e'),_0x34d45f);logger[_0xd806('0x1d')]('ShowZohoAccount',_0x34d45f,JSON[_0xd806('0x21')](_0x51a417));_0x49103a(_0x51a417);})[_0xd806('0x13')](function(_0x5ed466){logger['error']('ShowZohoAccount',_0x5ed466[_0xd806('0x11')],_0x34d45f);_0x5845b4(_0x183d67[_0xd806('0xe')](0x1f4,_0x5ed466[_0xd806('0x11')]));});});}; \ No newline at end of file +var _0xe9ef=['message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','debug','raw','ShowZohoAccount','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x49da1c,_0xfa5c6d){var _0xf08f6d=function(_0x42ae57){while(--_0x42ae57){_0x49da1c['push'](_0x49da1c['shift']());}};_0xf08f6d(++_0xfa5c6d);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x158e3b,_0x4534b){_0x158e3b=_0x158e3b-0x0;var _0x551a1d=_0xe9ef[_0x158e3b];return _0x551a1d;};'use strict';var _=require(_0xfe9e('0x0'));var util=require('util');var moment=require(_0xfe9e('0x1'));var BPromise=require(_0xfe9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe9e('0x4'));var logger=require(_0xfe9e('0x5'))(_0xfe9e('0x6'));var config=require(_0xfe9e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfe9e('0x8')][_0xfe9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x493722,_0x539d85,_0x1ae09c){return new BPromise(function(_0x51d134,_0x4325a6){return client[_0xfe9e('0xa')](_0x493722,_0x1ae09c)[_0xfe9e('0xb')](function(_0x48cd0b){logger[_0xfe9e('0xc')](_0xfe9e('0xd'),_0x539d85,_0xfe9e('0xe'));logger['debug'](_0xfe9e('0xf'),_0x539d85,'request\x20sent',JSON[_0xfe9e('0x10')](_0x48cd0b));if(_0x48cd0b[_0xfe9e('0x11')]){if(_0x48cd0b[_0xfe9e('0x11')][_0xfe9e('0x12')]===0x1f4){logger[_0xfe9e('0x11')](_0xfe9e('0xd'),_0x539d85,_0x48cd0b[_0xfe9e('0x11')][_0xfe9e('0x13')]);return _0x4325a6(_0x48cd0b[_0xfe9e('0x11')]['message']);}logger[_0xfe9e('0x11')](_0xfe9e('0xd'),_0x539d85,_0x48cd0b['error'][_0xfe9e('0x13')]);return _0x51d134(_0x48cd0b[_0xfe9e('0x11')][_0xfe9e('0x13')]);}else{logger[_0xfe9e('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x539d85,'request\x20sent');_0x51d134(_0x48cd0b[_0xfe9e('0x14')][_0xfe9e('0x13')]);}})[_0xfe9e('0x15')](function(_0x30ad77){logger['error'](_0xfe9e('0xd'),_0x539d85,_0x30ad77);_0x4325a6(_0x30ad77);});});}exports[_0xfe9e('0x16')]=function(_0xdf0a3b){var _0x3e18bc=this;return new Promise(function(_0x495344,_0x299d8c){return db[_0xfe9e('0x17')][_0xfe9e('0x18')]({'raw':_0xdf0a3b[_0xfe9e('0x19')]?_0xdf0a3b[_0xfe9e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xdf0a3b['options']?_0xdf0a3b[_0xfe9e('0x19')][_0xfe9e('0x1a')]||null:null,'attributes':_0xdf0a3b[_0xfe9e('0x19')]?_0xdf0a3b[_0xfe9e('0x19')][_0xfe9e('0x1b')]||null:null,'limit':_0xdf0a3b[_0xfe9e('0x19')]?_0xdf0a3b[_0xfe9e('0x19')][_0xfe9e('0x1c')]||null:null,'include':_0xdf0a3b[_0xfe9e('0x19')]?_0xdf0a3b[_0xfe9e('0x19')][_0xfe9e('0x1d')]?_[_0xfe9e('0x1e')](_0xdf0a3b['options'][_0xfe9e('0x1d')],function(_0x269bcb){return{'model':db[_0x269bcb['model']],'as':_0x269bcb['as'],'attributes':_0x269bcb[_0xfe9e('0x1b')],'include':_0x269bcb['include']?_[_0xfe9e('0x1e')](_0x269bcb[_0xfe9e('0x1d')],function(_0x56308e){return{'model':db[_0x56308e[_0xfe9e('0x1f')]],'as':_0x56308e['as'],'attributes':_0x56308e[_0xfe9e('0x1b')],'include':_0x56308e[_0xfe9e('0x1d')]?_[_0xfe9e('0x1e')](_0x56308e[_0xfe9e('0x1d')],function(_0x42f89d){return{'model':db[_0x42f89d[_0xfe9e('0x1f')]],'as':_0x42f89d['as'],'attributes':_0x42f89d[_0xfe9e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfe9e('0xb')](function(_0x3f7228){logger[_0xfe9e('0xc')](_0xfe9e('0x16'),_0xdf0a3b);logger[_0xfe9e('0x20')]('GetZohoAccount',_0xdf0a3b,JSON['stringify'](_0x3f7228));_0x495344(_0x3f7228);})[_0xfe9e('0x15')](function(_0x116b50){logger[_0xfe9e('0x11')](_0xfe9e('0x16'),_0x116b50['message'],_0xdf0a3b);_0x299d8c(_0x3e18bc[_0xfe9e('0x11')](0x1f4,_0x116b50['message']));});});};exports['ShowZohoAccount']=function(_0x4fcc67){var _0x3a8829=this;return new Promise(function(_0x291a49,_0x130f57){return db['ZohoAccount']['find']({'raw':_0x4fcc67[_0xfe9e('0x19')]?_0x4fcc67[_0xfe9e('0x19')][_0xfe9e('0x21')]===undefined?!![]:![]:!![],'where':_0x4fcc67[_0xfe9e('0x19')]?_0x4fcc67[_0xfe9e('0x19')]['where']||null:null,'attributes':_0x4fcc67['options']?_0x4fcc67[_0xfe9e('0x19')][_0xfe9e('0x1b')]||null:null,'include':_0x4fcc67[_0xfe9e('0x19')]?_0x4fcc67[_0xfe9e('0x19')][_0xfe9e('0x1d')]?_[_0xfe9e('0x1e')](_0x4fcc67[_0xfe9e('0x19')][_0xfe9e('0x1d')],function(_0x4f5c40){return{'model':db[_0x4f5c40[_0xfe9e('0x1f')]],'as':_0x4f5c40['as'],'attributes':_0x4f5c40[_0xfe9e('0x1b')],'include':_0x4f5c40[_0xfe9e('0x1d')]?_['map'](_0x4f5c40[_0xfe9e('0x1d')],function(_0xfd3e47){return{'model':db[_0xfd3e47['model']],'as':_0xfd3e47['as'],'attributes':_0xfd3e47['attributes'],'include':_0xfd3e47[_0xfe9e('0x1d')]?_[_0xfe9e('0x1e')](_0xfd3e47[_0xfe9e('0x1d')],function(_0x31a933){return{'model':db[_0x31a933[_0xfe9e('0x1f')]],'as':_0x31a933['as'],'attributes':_0x31a933[_0xfe9e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfe9e('0xb')](function(_0x4d0947){logger['info'](_0xfe9e('0x22'),_0x4fcc67);logger[_0xfe9e('0x20')](_0xfe9e('0x22'),_0x4fcc67,JSON[_0xfe9e('0x10')](_0x4d0947));_0x291a49(_0x4d0947);})[_0xfe9e('0x15')](function(_0x334409){logger[_0xfe9e('0x11')]('ShowZohoAccount',_0x334409[_0xfe9e('0x13')],_0x4fcc67);_0x130f57(_0x3a8829['error'](0x1f4,_0x334409[_0xfe9e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index a949186..6b3947c 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 _0xab35=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x5b2cee,_0x4bdddd){var _0x432cd6=function(_0x471aff){while(--_0x471aff){_0x5b2cee['push'](_0x5b2cee['shift']());}};_0x432cd6(++_0x4bdddd);}(_0xab35,0x75));var _0x5ab3=function(_0x443494,_0x51fc7e){_0x443494=_0x443494-0x0;var _0x4a6794=_0xab35[_0x443494];return _0x4a6794;};'use strict';var multer=require(_0x5ab3('0x0'));var util=require(_0x5ab3('0x1'));var path=require(_0x5ab3('0x2'));var timeout=require(_0x5ab3('0x3'));var express=require(_0x5ab3('0x4'));var router=express[_0x5ab3('0x5')]();var fs_extra=require(_0x5ab3('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5ab3('0x7'));var controller=require(_0x5ab3('0x8'));router[_0x5ab3('0x9')]('/',auth[_0x5ab3('0xa')](),controller['index']);router[_0x5ab3('0x9')](_0x5ab3('0xb'),auth['isAuthenticated'](),controller[_0x5ab3('0xc')]);router['get'](_0x5ab3('0xd'),auth['isAuthenticated'](),controller[_0x5ab3('0xe')]);router[_0x5ab3('0x9')](_0x5ab3('0xf'),auth[_0x5ab3('0xa')](),controller['getSubjects']);router[_0x5ab3('0x9')](_0x5ab3('0x10'),auth[_0x5ab3('0xa')](),controller[_0x5ab3('0x11')]);router[_0x5ab3('0x12')]('/',auth[_0x5ab3('0xa')](),controller[_0x5ab3('0x13')]);router[_0x5ab3('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5ab3('0x15')]('/:id',auth[_0x5ab3('0xa')](),controller['destroy']);module[_0x5ab3('0x16')]=router; \ No newline at end of file +var _0x80d1=['getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields'];(function(_0x1776ed,_0x168065){var _0x383c1c=function(_0x2facae){while(--_0x2facae){_0x1776ed['push'](_0x1776ed['shift']());}};_0x383c1c(++_0x168065);}(_0x80d1,0x12d));var _0x180d=function(_0x4773f0,_0x2b77be){_0x4773f0=_0x4773f0-0x0;var _0x327ef2=_0x80d1[_0x4773f0];return _0x327ef2;};'use strict';var multer=require(_0x180d('0x0'));var util=require('util');var path=require(_0x180d('0x1'));var timeout=require(_0x180d('0x2'));var express=require(_0x180d('0x3'));var router=express[_0x180d('0x4')]();var fs_extra=require(_0x180d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x180d('0x6'));var controller=require(_0x180d('0x7'));router[_0x180d('0x8')]('/',auth[_0x180d('0x9')](),controller['index']);router[_0x180d('0x8')](_0x180d('0xa'),auth[_0x180d('0x9')](),controller[_0x180d('0xb')]);router['get'](_0x180d('0xc'),auth[_0x180d('0x9')](),controller[_0x180d('0xd')]);router[_0x180d('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x180d('0xe')]);router['get'](_0x180d('0xf'),auth[_0x180d('0x9')](),controller[_0x180d('0x10')]);router[_0x180d('0x11')]('/',auth[_0x180d('0x9')](),controller[_0x180d('0x12')]);router['put']('/:id',auth[_0x180d('0x9')](),controller[_0x180d('0x13')]);router[_0x180d('0x14')](_0x180d('0xa'),auth[_0x180d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 56ba72d..7f97524 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 _0xf280=['contact','nothing','exports','STRING','ENUM','lead'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf280,0x1ac));var _0x0f28=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0xf280[_0x2c9b79];return _0x265032;};'use strict';var Sequelize=require('sequelize');module[_0x0f28('0x0')]={'name':{'type':Sequelize[_0x0f28('0x1')]},'moduleCreate':{'type':Sequelize[_0x0f28('0x2')](_0x0f28('0x3'),_0x0f28('0x4'),_0x0f28('0x5')),'defaultValue':_0x0f28('0x3')},'moduleSearch':{'type':Sequelize[_0x0f28('0x2')]('contact_lead',_0x0f28('0x4'),_0x0f28('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x0f28('0x1')]}}; \ No newline at end of file +var _0x7a43=['contact','nothing','contact_lead','exports','STRING','ENUM','lead'];(function(_0x279d3f,_0x55285d){var _0xb6b0ed=function(_0x498e14){while(--_0x498e14){_0x279d3f['push'](_0x279d3f['shift']());}};_0xb6b0ed(++_0x55285d);}(_0x7a43,0x13e));var _0x37a4=function(_0x40ef7a,_0x5e574f){_0x40ef7a=_0x40ef7a-0x0;var _0x1fb000=_0x7a43[_0x40ef7a];return _0x1fb000;};'use strict';var Sequelize=require('sequelize');module[_0x37a4('0x0')]={'name':{'type':Sequelize[_0x37a4('0x1')]},'moduleCreate':{'type':Sequelize[_0x37a4('0x2')](_0x37a4('0x3'),_0x37a4('0x4'),_0x37a4('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x37a4('0x2')](_0x37a4('0x6'),_0x37a4('0x4'),_0x37a4('0x3')),'defaultValue':_0x37a4('0x6')},'description':{'type':Sequelize[_0x37a4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 3c7ca85..5be34e2 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 _0x3454=['key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','include','ZohoConfiguration','findAll','rows','catch','keys','find','create','body','params','ZohoField','getFields','getSubjects','options','getDescriptions','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0x3454,0xbe));var _0x4345=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3454[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x4345('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4345('0x1'));var rp=require('request-promise');var moment=require(_0x4345('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4345('0x3'));var util=require(_0x4345('0x4'));var path=require(_0x4345('0x5'));var sox=require(_0x4345('0x6'));var csv=require(_0x4345('0x7'));var ejs=require(_0x4345('0x8'));var fs=require('fs');var fs_extra=require(_0x4345('0x9'));var _=require(_0x4345('0xa'));var squel=require('squel');var crypto=require(_0x4345('0xb'));var jsforce=require(_0x4345('0xc'));var deskjs=require(_0x4345('0xd'));var toCsv=require(_0x4345('0x7'));var querystring=require(_0x4345('0xe'));var Papa=require(_0x4345('0xf'));var Redis=require(_0x4345('0x10'));var authService=require(_0x4345('0x11'));var qs=require(_0x4345('0x12'));var as=require(_0x4345('0x13'));var hardwareService=require(_0x4345('0x14'));var logger=require(_0x4345('0x15'))('api');var utils=require(_0x4345('0x16'));var config=require(_0x4345('0x17'));var licenseUtil=require(_0x4345('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6e844a,_0x57f0cc){_0x57f0cc=_0x57f0cc||0xcc;return function(_0x37c245){if(_0x37c245){return _0x6e844a[_0x4345('0x19')](_0x57f0cc);}return _0x6e844a[_0x4345('0x1a')](_0x57f0cc)[_0x4345('0x1b')]();};}function respondWithResult(_0x1be947,_0x599e77){_0x599e77=_0x599e77||0xc8;return function(_0x1e0faf){if(_0x1e0faf){return _0x1be947[_0x4345('0x1a')](_0x599e77)['json'](_0x1e0faf);}};}function respondWithFilteredResult(_0x2da0c0,_0x59b61d){return function(_0x2610da){if(_0x2610da){var _0x1bcf8d=typeof _0x59b61d[_0x4345('0x1c')]===_0x4345('0x1d')&&typeof _0x59b61d[_0x4345('0x1e')]===_0x4345('0x1d');var _0x2bfbe3=_0x2610da[_0x4345('0x1f')];var _0x35d601=_0x1bcf8d?0x0:_0x59b61d[_0x4345('0x1c')];var _0x37132a=_0x1bcf8d?_0x2610da[_0x4345('0x1f')]:_0x59b61d[_0x4345('0x1c')]+_0x59b61d['limit'];var _0x570824;if(_0x37132a>=_0x2bfbe3){_0x37132a=_0x2bfbe3;_0x570824=0xc8;}else{_0x570824=0xce;}_0x2da0c0['status'](_0x570824);return _0x2da0c0['set'](_0x4345('0x20'),_0x35d601+'-'+_0x37132a+'/'+_0x2bfbe3)[_0x4345('0x21')](_0x2610da);}return null;};}function patchUpdates(_0x2b1bc5){return function(_0x592de7){try{jsonpatch['apply'](_0x592de7,_0x2b1bc5,!![]);}catch(_0x1d1b45){return BPromise[_0x4345('0x22')](_0x1d1b45);}return _0x592de7[_0x4345('0x23')]();};}function saveUpdates(_0x5e22af,_0x47d1e1){return function(_0x9cb23){if(_0x9cb23){return _0x9cb23[_0x4345('0x24')](_0x5e22af)[_0x4345('0x25')](function(_0x2828cc){return _0x2828cc;});}return null;};}function removeEntity(_0x5e431b,_0x1d5294){return function(_0x5885bd){if(_0x5885bd){return _0x5885bd[_0x4345('0x26')]()[_0x4345('0x25')](function(){_0x5e431b[_0x4345('0x1a')](0xcc)[_0x4345('0x1b')]();});}};}function handleEntityNotFound(_0x40a9e8,_0x4ac68a){return function(_0xb18d78){if(!_0xb18d78){_0x40a9e8[_0x4345('0x19')](0x194);}return _0xb18d78;};}function handleError(_0x25842a,_0x2f186a){_0x2f186a=_0x2f186a||0x1f4;return function(_0x4780e1){logger['error'](_0x4780e1[_0x4345('0x27')]);if(_0x4780e1[_0x4345('0x28')]){delete _0x4780e1['name'];}_0x25842a['status'](_0x2f186a)[_0x4345('0x29')](_0x4780e1);};}exports[_0x4345('0x2a')]=function(_0x4dd3e6,_0x4163c0){var _0x755b68={},_0x531db1={},_0x3609b1={'count':0x0,'rows':[]};var _0x2a7ff7=_[_0x4345('0x2b')](db['ZohoConfiguration'][_0x4345('0x2c')],function(_0x12e947){return{'name':_0x12e947[_0x4345('0x2d')],'type':_0x12e947[_0x4345('0x2e')][_0x4345('0x2f')]};});_0x531db1[_0x4345('0x30')]=_[_0x4345('0x2b')](_0x2a7ff7,_0x4345('0x28'));_0x531db1[_0x4345('0x31')]=_['keys'](_0x4dd3e6[_0x4345('0x31')]);_0x531db1['filters']=_[_0x4345('0x32')](_0x531db1['model'],_0x531db1[_0x4345('0x31')]);_0x755b68[_0x4345('0x33')]=_[_0x4345('0x32')](_0x531db1['model'],qs[_0x4345('0x34')](_0x4dd3e6[_0x4345('0x31')][_0x4345('0x34')]));_0x755b68[_0x4345('0x33')]=_0x755b68[_0x4345('0x33')][_0x4345('0x35')]?_0x755b68[_0x4345('0x33')]:_0x531db1[_0x4345('0x30')];if(!_0x4dd3e6[_0x4345('0x31')][_0x4345('0x36')](_0x4345('0x37'))){_0x755b68['limit']=qs[_0x4345('0x1e')](_0x4dd3e6[_0x4345('0x31')]['limit']);_0x755b68[_0x4345('0x1c')]=qs[_0x4345('0x1c')](_0x4dd3e6[_0x4345('0x31')]['offset']);}_0x755b68[_0x4345('0x38')]=qs[_0x4345('0x39')](_0x4dd3e6[_0x4345('0x31')]['sort']);_0x755b68[_0x4345('0x3a')]=qs['filters'](_[_0x4345('0x3b')](_0x4dd3e6['query'],_0x531db1[_0x4345('0x3c')]),_0x2a7ff7);if(_0x4dd3e6[_0x4345('0x31')][_0x4345('0x3d')]){_0x755b68[_0x4345('0x3a')]=_[_0x4345('0x3e')](_0x755b68['where'],{'$or':_[_0x4345('0x2b')](_0x2a7ff7,function(_0xacd027){if(_0xacd027[_0x4345('0x2e')]!==_0x4345('0x3f')){var _0xebe0d={};_0xebe0d[_0xacd027[_0x4345('0x28')]]={'$like':'%'+_0x4dd3e6['query'][_0x4345('0x3d')]+'%'};return _0xebe0d;}})});}_0x755b68=_['merge']({},_0x755b68,_0x4dd3e6['options']);var _0x245ce2={'where':_0x755b68[_0x4345('0x3a')]};return db['ZohoConfiguration'][_0x4345('0x1f')](_0x245ce2)['then'](function(_0x2a4af3){_0x3609b1[_0x4345('0x1f')]=_0x2a4af3;if(_0x4dd3e6[_0x4345('0x31')]['includeAll']){_0x755b68[_0x4345('0x40')]=[{'all':!![]}];}return db[_0x4345('0x41')][_0x4345('0x42')](_0x755b68);})[_0x4345('0x25')](function(_0x5a9b53){_0x3609b1[_0x4345('0x43')]=_0x5a9b53;return _0x3609b1;})[_0x4345('0x25')](respondWithFilteredResult(_0x4163c0,_0x755b68))[_0x4345('0x44')](handleError(_0x4163c0,null));};exports['show']=function(_0x54624b,_0x45afa9){var _0x51b21e={'raw':![],'where':{'id':_0x54624b['params']['id']}},_0x5a89c2={};_0x5a89c2[_0x4345('0x30')]=_[_0x4345('0x45')](db[_0x4345('0x41')]['rawAttributes']);_0x5a89c2[_0x4345('0x31')]=_[_0x4345('0x45')](_0x54624b[_0x4345('0x31')]);_0x5a89c2[_0x4345('0x3c')]=_[_0x4345('0x32')](_0x5a89c2[_0x4345('0x30')],_0x5a89c2['query']);_0x51b21e[_0x4345('0x33')]=_[_0x4345('0x32')](_0x5a89c2[_0x4345('0x30')],qs['fields'](_0x54624b[_0x4345('0x31')][_0x4345('0x34')]));_0x51b21e['attributes']=_0x51b21e[_0x4345('0x33')][_0x4345('0x35')]?_0x51b21e[_0x4345('0x33')]:_0x5a89c2[_0x4345('0x30')];if(_0x54624b[_0x4345('0x31')]['includeAll']){_0x51b21e[_0x4345('0x40')]=[{'all':!![]}];}_0x51b21e=_[_0x4345('0x3e')]({},_0x51b21e,_0x54624b['options']);return db[_0x4345('0x41')][_0x4345('0x46')](_0x51b21e)[_0x4345('0x25')](handleEntityNotFound(_0x45afa9,null))[_0x4345('0x25')](respondWithResult(_0x45afa9,null))[_0x4345('0x44')](handleError(_0x45afa9,null));};exports[_0x4345('0x47')]=function(_0x5b406f,_0x5932ce){return db[_0x4345('0x41')][_0x4345('0x47')](_0x5b406f[_0x4345('0x48')],{})['then'](respondWithResult(_0x5932ce,0xc9))[_0x4345('0x44')](handleError(_0x5932ce,null));};exports['update']=function(_0x1c2b29,_0x44d994){if(_0x1c2b29[_0x4345('0x48')]['id']){delete _0x1c2b29[_0x4345('0x48')]['id'];}return db[_0x4345('0x41')][_0x4345('0x46')]({'where':{'id':_0x1c2b29['params']['id']}})['then'](handleEntityNotFound(_0x44d994,null))[_0x4345('0x25')](saveUpdates(_0x1c2b29[_0x4345('0x48')],null))[_0x4345('0x25')](respondWithResult(_0x44d994,null))[_0x4345('0x44')](handleError(_0x44d994,null));};exports[_0x4345('0x26')]=function(_0x527038,_0x18f362){return db[_0x4345('0x41')][_0x4345('0x46')]({'where':{'id':_0x527038[_0x4345('0x49')]['id']}})[_0x4345('0x25')](handleEntityNotFound(_0x18f362,null))[_0x4345('0x25')](removeEntity(_0x18f362,null))[_0x4345('0x44')](handleError(_0x18f362,null));};exports['getFields']=function(_0x591682,_0x4990cd,_0x43e8e4){var _0x5255a5={};var _0x1e249a={};var _0x1f17ce;var _0x467d9e;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x591682['params']['id']}})[_0x4345('0x25')](handleEntityNotFound(_0x4990cd,null))[_0x4345('0x25')](function(_0x150291){if(_0x150291){_0x1f17ce=_0x150291;_0x1e249a[_0x4345('0x30')]=_[_0x4345('0x45')](db[_0x4345('0x4a')][_0x4345('0x2c')]);_0x1e249a[_0x4345('0x31')]=_[_0x4345('0x45')](_0x591682[_0x4345('0x31')]);_0x1e249a[_0x4345('0x3c')]=_[_0x4345('0x32')](_0x1e249a['model'],_0x1e249a[_0x4345('0x31')]);_0x5255a5[_0x4345('0x33')]=_['intersection'](_0x1e249a['model'],qs[_0x4345('0x34')](_0x591682['query'][_0x4345('0x34')]));_0x5255a5['attributes']=_0x5255a5[_0x4345('0x33')]['length']?_0x5255a5[_0x4345('0x33')]:_0x1e249a[_0x4345('0x30')];_0x5255a5['order']=qs[_0x4345('0x39')](_0x591682[_0x4345('0x31')]['sort']);_0x5255a5[_0x4345('0x3a')]=qs[_0x4345('0x3c')](_[_0x4345('0x3b')](_0x591682[_0x4345('0x31')],_0x1e249a[_0x4345('0x3c')]));if(_0x591682[_0x4345('0x31')][_0x4345('0x3d')]){_0x5255a5[_0x4345('0x3a')]=_[_0x4345('0x3e')](_0x5255a5[_0x4345('0x3a')],{'$or':_['map'](_0x5255a5['attributes'],function(_0xcde9e5){var _0x17511e={};_0x17511e[_0xcde9e5]={'$like':'%'+_0x591682[_0x4345('0x31')][_0x4345('0x3d')]+'%'};return _0x17511e;})});}_0x5255a5=_[_0x4345('0x3e')]({},_0x5255a5,_0x591682['options']);return _0x1f17ce[_0x4345('0x4b')](_0x5255a5);}})['then'](function(_0x26ad3a){if(_0x26ad3a){_0x467d9e=_0x26ad3a[_0x4345('0x35')];if(!_0x591682['query']['hasOwnProperty'](_0x4345('0x37'))){_0x5255a5[_0x4345('0x1e')]=qs[_0x4345('0x1e')](_0x591682[_0x4345('0x31')][_0x4345('0x1e')]);_0x5255a5[_0x4345('0x1c')]=qs[_0x4345('0x1c')](_0x591682['query'][_0x4345('0x1c')]);}return _0x1f17ce[_0x4345('0x4b')](_0x5255a5);}})[_0x4345('0x25')](function(_0x45bca3){if(_0x45bca3){return _0x45bca3?{'count':_0x467d9e,'rows':_0x45bca3}:null;}})[_0x4345('0x25')](respondWithResult(_0x4990cd,null))[_0x4345('0x44')](handleError(_0x4990cd,null));};exports[_0x4345('0x4c')]=function(_0x3bb7ab,_0x54a1a8,_0x2b0697){var _0x29723a={};var _0xf14733={};var _0x5d0749;var _0xeef7db;return db[_0x4345('0x41')]['findOne']({'where':{'id':_0x3bb7ab['params']['id']}})['then'](handleEntityNotFound(_0x54a1a8,null))[_0x4345('0x25')](function(_0x22fe31){if(_0x22fe31){_0x5d0749=_0x22fe31;_0xf14733[_0x4345('0x30')]=_[_0x4345('0x45')](db['ZohoField'][_0x4345('0x2c')]);_0xf14733[_0x4345('0x31')]=_[_0x4345('0x45')](_0x3bb7ab[_0x4345('0x31')]);_0xf14733[_0x4345('0x3c')]=_[_0x4345('0x32')](_0xf14733[_0x4345('0x30')],_0xf14733[_0x4345('0x31')]);_0x29723a['attributes']=_[_0x4345('0x32')](_0xf14733[_0x4345('0x30')],qs[_0x4345('0x34')](_0x3bb7ab[_0x4345('0x31')][_0x4345('0x34')]));_0x29723a['attributes']=_0x29723a[_0x4345('0x33')]['length']?_0x29723a[_0x4345('0x33')]:_0xf14733[_0x4345('0x30')];_0x29723a[_0x4345('0x38')]=qs[_0x4345('0x39')](_0x3bb7ab['query']['sort']);_0x29723a[_0x4345('0x3a')]=qs[_0x4345('0x3c')](_[_0x4345('0x3b')](_0x3bb7ab[_0x4345('0x31')],_0xf14733['filters']));if(_0x3bb7ab[_0x4345('0x31')][_0x4345('0x3d')]){_0x29723a[_0x4345('0x3a')]=_[_0x4345('0x3e')](_0x29723a[_0x4345('0x3a')],{'$or':_[_0x4345('0x2b')](_0x29723a[_0x4345('0x33')],function(_0x38c696){var _0x2c5398={};_0x2c5398[_0x38c696]={'$like':'%'+_0x3bb7ab['query'][_0x4345('0x3d')]+'%'};return _0x2c5398;})});}_0x29723a=_[_0x4345('0x3e')]({},_0x29723a,_0x3bb7ab[_0x4345('0x4d')]);return _0x5d0749['getSubjects'](_0x29723a);}})[_0x4345('0x25')](function(_0x4bee18){if(_0x4bee18){_0xeef7db=_0x4bee18[_0x4345('0x35')];if(!_0x3bb7ab[_0x4345('0x31')][_0x4345('0x36')](_0x4345('0x37'))){_0x29723a[_0x4345('0x1e')]=qs[_0x4345('0x1e')](_0x3bb7ab[_0x4345('0x31')][_0x4345('0x1e')]);_0x29723a[_0x4345('0x1c')]=qs[_0x4345('0x1c')](_0x3bb7ab['query'][_0x4345('0x1c')]);}return _0x5d0749[_0x4345('0x4c')](_0x29723a);}})[_0x4345('0x25')](function(_0x4582f3){if(_0x4582f3){return _0x4582f3?{'count':_0xeef7db,'rows':_0x4582f3}:null;}})[_0x4345('0x25')](respondWithResult(_0x54a1a8,null))['catch'](handleError(_0x54a1a8,null));};exports[_0x4345('0x4e')]=function(_0x72ada3,_0x3b53f9,_0x31a5cb){var _0x26d70d={};var _0x4d1bb6={};var _0x66f796;var _0x1f1f79;return db[_0x4345('0x41')]['findOne']({'where':{'id':_0x72ada3[_0x4345('0x49')]['id']}})[_0x4345('0x25')](handleEntityNotFound(_0x3b53f9,null))[_0x4345('0x25')](function(_0x34af5b){if(_0x34af5b){_0x66f796=_0x34af5b;_0x4d1bb6[_0x4345('0x30')]=_[_0x4345('0x45')](db[_0x4345('0x4a')][_0x4345('0x2c')]);_0x4d1bb6[_0x4345('0x31')]=_[_0x4345('0x45')](_0x72ada3['query']);_0x4d1bb6[_0x4345('0x3c')]=_[_0x4345('0x32')](_0x4d1bb6['model'],_0x4d1bb6['query']);_0x26d70d['attributes']=_[_0x4345('0x32')](_0x4d1bb6[_0x4345('0x30')],qs[_0x4345('0x34')](_0x72ada3[_0x4345('0x31')]['fields']));_0x26d70d['attributes']=_0x26d70d[_0x4345('0x33')][_0x4345('0x35')]?_0x26d70d[_0x4345('0x33')]:_0x4d1bb6[_0x4345('0x30')];_0x26d70d['order']=qs['sort'](_0x72ada3[_0x4345('0x31')][_0x4345('0x39')]);_0x26d70d[_0x4345('0x3a')]=qs[_0x4345('0x3c')](_[_0x4345('0x3b')](_0x72ada3[_0x4345('0x31')],_0x4d1bb6['filters']));if(_0x72ada3[_0x4345('0x31')][_0x4345('0x3d')]){_0x26d70d[_0x4345('0x3a')]=_['merge'](_0x26d70d['where'],{'$or':_[_0x4345('0x2b')](_0x26d70d[_0x4345('0x33')],function(_0x17b53a){var _0x5b83ea={};_0x5b83ea[_0x17b53a]={'$like':'%'+_0x72ada3[_0x4345('0x31')][_0x4345('0x3d')]+'%'};return _0x5b83ea;})});}_0x26d70d=_[_0x4345('0x3e')]({},_0x26d70d,_0x72ada3[_0x4345('0x4d')]);return _0x66f796[_0x4345('0x4e')](_0x26d70d);}})['then'](function(_0x1948d5){if(_0x1948d5){_0x1f1f79=_0x1948d5[_0x4345('0x35')];if(!_0x72ada3[_0x4345('0x31')][_0x4345('0x36')]('nolimit')){_0x26d70d[_0x4345('0x1e')]=qs[_0x4345('0x1e')](_0x72ada3[_0x4345('0x31')]['limit']);_0x26d70d[_0x4345('0x1c')]=qs[_0x4345('0x1c')](_0x72ada3['query'][_0x4345('0x1c')]);}return _0x66f796['getDescriptions'](_0x26d70d);}})['then'](function(_0x14b218){if(_0x14b218){return _0x14b218?{'count':_0x1f1f79,'rows':_0x14b218}:null;}})[_0x4345('0x25')](respondWithResult(_0x3b53f9,null))[_0x4345('0x44')](handleError(_0x3b53f9,null));}; \ No newline at end of file +var _0xafe4=['save','update','destroy','then','status','error','stack','name','send','index','map','ZohoConfiguration','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','rows','show','params','rawAttributes','options','find','catch','create','body','findOne','ZohoField','pick','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x8b4939,_0x4a8076){var _0x40e5fb=function(_0x5c507f){while(--_0x5c507f){_0x8b4939['push'](_0x8b4939['shift']());}};_0x40e5fb(++_0x4a8076);}(_0xafe4,0x1c8));var _0x4afe=function(_0x3acddd,_0x17ae87){_0x3acddd=_0x3acddd-0x0;var _0x376479=_0xafe4[_0x3acddd];return _0x376479;};'use strict';var emlformat=require(_0x4afe('0x0'));var rimraf=require(_0x4afe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4afe('0x2'));var rp=require('request-promise');var moment=require(_0x4afe('0x3'));var BPromise=require(_0x4afe('0x4'));var Mustache=require(_0x4afe('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afe('0x6'));var ejs=require(_0x4afe('0x7'));var fs=require('fs');var fs_extra=require(_0x4afe('0x8'));var _=require(_0x4afe('0x9'));var squel=require(_0x4afe('0xa'));var crypto=require(_0x4afe('0xb'));var jsforce=require(_0x4afe('0xc'));var deskjs=require(_0x4afe('0xd'));var toCsv=require(_0x4afe('0x6'));var querystring=require(_0x4afe('0xe'));var Papa=require(_0x4afe('0xf'));var Redis=require(_0x4afe('0x10'));var authService=require(_0x4afe('0x11'));var qs=require(_0x4afe('0x12'));var as=require(_0x4afe('0x13'));var hardwareService=require(_0x4afe('0x14'));var logger=require(_0x4afe('0x15'))(_0x4afe('0x16'));var utils=require(_0x4afe('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4afe('0x18'));var db=require(_0x4afe('0x19'))['db'];function respondWithStatusCode(_0x40d4dc,_0x157482){_0x157482=_0x157482||0xcc;return function(_0x3c1efe){if(_0x3c1efe){return _0x40d4dc[_0x4afe('0x1a')](_0x157482);}return _0x40d4dc['status'](_0x157482)[_0x4afe('0x1b')]();};}function respondWithResult(_0x19e097,_0x12a569){_0x12a569=_0x12a569||0xc8;return function(_0x568c2c){if(_0x568c2c){return _0x19e097['status'](_0x12a569)[_0x4afe('0x1c')](_0x568c2c);}};}function respondWithFilteredResult(_0x509eea,_0xe9aa01){return function(_0x198a4e){if(_0x198a4e){var _0x37de88=typeof _0xe9aa01['offset']===_0x4afe('0x1d')&&typeof _0xe9aa01[_0x4afe('0x1e')]===_0x4afe('0x1d');var _0x64d6d6=_0x198a4e[_0x4afe('0x1f')];var _0x6495db=_0x37de88?0x0:_0xe9aa01[_0x4afe('0x20')];var _0x29a710=_0x37de88?_0x198a4e[_0x4afe('0x1f')]:_0xe9aa01[_0x4afe('0x20')]+_0xe9aa01[_0x4afe('0x1e')];var _0xe40c74;if(_0x29a710>=_0x64d6d6){_0x29a710=_0x64d6d6;_0xe40c74=0xc8;}else{_0xe40c74=0xce;}_0x509eea['status'](_0xe40c74);return _0x509eea[_0x4afe('0x21')](_0x4afe('0x22'),_0x6495db+'-'+_0x29a710+'/'+_0x64d6d6)[_0x4afe('0x1c')](_0x198a4e);}return null;};}function patchUpdates(_0x3b4d8e){return function(_0x170915){try{jsonpatch[_0x4afe('0x23')](_0x170915,_0x3b4d8e,!![]);}catch(_0x4395c5){return BPromise['reject'](_0x4395c5);}return _0x170915[_0x4afe('0x24')]();};}function saveUpdates(_0x3ff210,_0x519fe3){return function(_0x2bb0c7){if(_0x2bb0c7){return _0x2bb0c7[_0x4afe('0x25')](_0x3ff210)['then'](function(_0x469256){return _0x469256;});}return null;};}function removeEntity(_0x2c6177,_0x5655a5){return function(_0x5d9a0a){if(_0x5d9a0a){return _0x5d9a0a[_0x4afe('0x26')]()[_0x4afe('0x27')](function(){_0x2c6177[_0x4afe('0x28')](0xcc)[_0x4afe('0x1b')]();});}};}function handleEntityNotFound(_0x30b183,_0x4903bd){return function(_0x4c5d34){if(!_0x4c5d34){_0x30b183[_0x4afe('0x1a')](0x194);}return _0x4c5d34;};}function handleError(_0x2b6fdc,_0x16b108){_0x16b108=_0x16b108||0x1f4;return function(_0x4a1563){logger[_0x4afe('0x29')](_0x4a1563[_0x4afe('0x2a')]);if(_0x4a1563[_0x4afe('0x2b')]){delete _0x4a1563['name'];}_0x2b6fdc[_0x4afe('0x28')](_0x16b108)[_0x4afe('0x2c')](_0x4a1563);};}exports[_0x4afe('0x2d')]=function(_0x6280e9,_0x56da2f){var _0xd59ab2={},_0x546ba8={},_0x50b255={'count':0x0,'rows':[]};var _0x36e3a7=_[_0x4afe('0x2e')](db[_0x4afe('0x2f')]['rawAttributes'],function(_0x53f00d){return{'name':_0x53f00d['fieldName'],'type':_0x53f00d[_0x4afe('0x30')]['key']};});_0x546ba8['model']=_[_0x4afe('0x2e')](_0x36e3a7,_0x4afe('0x2b'));_0x546ba8[_0x4afe('0x31')]=_[_0x4afe('0x32')](_0x6280e9['query']);_0x546ba8[_0x4afe('0x33')]=_[_0x4afe('0x34')](_0x546ba8[_0x4afe('0x35')],_0x546ba8[_0x4afe('0x31')]);_0xd59ab2[_0x4afe('0x36')]=_[_0x4afe('0x34')](_0x546ba8[_0x4afe('0x35')],qs['fields'](_0x6280e9[_0x4afe('0x31')][_0x4afe('0x37')]));_0xd59ab2[_0x4afe('0x36')]=_0xd59ab2['attributes'][_0x4afe('0x38')]?_0xd59ab2[_0x4afe('0x36')]:_0x546ba8[_0x4afe('0x35')];if(!_0x6280e9[_0x4afe('0x31')]['hasOwnProperty'](_0x4afe('0x39'))){_0xd59ab2[_0x4afe('0x1e')]=qs[_0x4afe('0x1e')](_0x6280e9[_0x4afe('0x31')]['limit']);_0xd59ab2[_0x4afe('0x20')]=qs[_0x4afe('0x20')](_0x6280e9[_0x4afe('0x31')][_0x4afe('0x20')]);}_0xd59ab2[_0x4afe('0x3a')]=qs[_0x4afe('0x3b')](_0x6280e9['query'][_0x4afe('0x3b')]);_0xd59ab2['where']=qs['filters'](_['pick'](_0x6280e9[_0x4afe('0x31')],_0x546ba8['filters']),_0x36e3a7);if(_0x6280e9['query'][_0x4afe('0x3c')]){_0xd59ab2[_0x4afe('0x3d')]=_[_0x4afe('0x3e')](_0xd59ab2[_0x4afe('0x3d')],{'$or':_[_0x4afe('0x2e')](_0x36e3a7,function(_0x5665a4){if(_0x5665a4[_0x4afe('0x30')]!==_0x4afe('0x3f')){var _0x44c233={};_0x44c233[_0x5665a4[_0x4afe('0x2b')]]={'$like':'%'+_0x6280e9[_0x4afe('0x31')][_0x4afe('0x3c')]+'%'};return _0x44c233;}})});}_0xd59ab2=_['merge']({},_0xd59ab2,_0x6280e9['options']);var _0x51e850={'where':_0xd59ab2[_0x4afe('0x3d')]};return db[_0x4afe('0x2f')]['count'](_0x51e850)['then'](function(_0x1bb32f){_0x50b255[_0x4afe('0x1f')]=_0x1bb32f;if(_0x6280e9[_0x4afe('0x31')][_0x4afe('0x40')]){_0xd59ab2[_0x4afe('0x41')]=[{'all':!![]}];}return db[_0x4afe('0x2f')]['findAll'](_0xd59ab2);})['then'](function(_0x24de7d){_0x50b255[_0x4afe('0x42')]=_0x24de7d;return _0x50b255;})['then'](respondWithFilteredResult(_0x56da2f,_0xd59ab2))['catch'](handleError(_0x56da2f,null));};exports[_0x4afe('0x43')]=function(_0xff2767,_0x5091e9){var _0x118767={'raw':![],'where':{'id':_0xff2767[_0x4afe('0x44')]['id']}},_0x147afe={};_0x147afe[_0x4afe('0x35')]=_[_0x4afe('0x32')](db['ZohoConfiguration'][_0x4afe('0x45')]);_0x147afe[_0x4afe('0x31')]=_[_0x4afe('0x32')](_0xff2767['query']);_0x147afe[_0x4afe('0x33')]=_[_0x4afe('0x34')](_0x147afe['model'],_0x147afe[_0x4afe('0x31')]);_0x118767[_0x4afe('0x36')]=_[_0x4afe('0x34')](_0x147afe[_0x4afe('0x35')],qs[_0x4afe('0x37')](_0xff2767['query'][_0x4afe('0x37')]));_0x118767[_0x4afe('0x36')]=_0x118767[_0x4afe('0x36')][_0x4afe('0x38')]?_0x118767[_0x4afe('0x36')]:_0x147afe[_0x4afe('0x35')];if(_0xff2767[_0x4afe('0x31')][_0x4afe('0x40')]){_0x118767[_0x4afe('0x41')]=[{'all':!![]}];}_0x118767=_[_0x4afe('0x3e')]({},_0x118767,_0xff2767[_0x4afe('0x46')]);return db['ZohoConfiguration'][_0x4afe('0x47')](_0x118767)[_0x4afe('0x27')](handleEntityNotFound(_0x5091e9,null))[_0x4afe('0x27')](respondWithResult(_0x5091e9,null))[_0x4afe('0x48')](handleError(_0x5091e9,null));};exports[_0x4afe('0x49')]=function(_0xb946c4,_0x4bf0d6){return db[_0x4afe('0x2f')][_0x4afe('0x49')](_0xb946c4['body'],{})[_0x4afe('0x27')](respondWithResult(_0x4bf0d6,0xc9))[_0x4afe('0x48')](handleError(_0x4bf0d6,null));};exports[_0x4afe('0x25')]=function(_0x187f18,_0x5118b5){if(_0x187f18['body']['id']){delete _0x187f18[_0x4afe('0x4a')]['id'];}return db[_0x4afe('0x2f')]['find']({'where':{'id':_0x187f18[_0x4afe('0x44')]['id']}})[_0x4afe('0x27')](handleEntityNotFound(_0x5118b5,null))['then'](saveUpdates(_0x187f18[_0x4afe('0x4a')],null))[_0x4afe('0x27')](respondWithResult(_0x5118b5,null))['catch'](handleError(_0x5118b5,null));};exports['destroy']=function(_0x188e30,_0x49301d){return db[_0x4afe('0x2f')][_0x4afe('0x47')]({'where':{'id':_0x188e30[_0x4afe('0x44')]['id']}})[_0x4afe('0x27')](handleEntityNotFound(_0x49301d,null))['then'](removeEntity(_0x49301d,null))['catch'](handleError(_0x49301d,null));};exports['getFields']=function(_0x4f9d4f,_0x1a1ce6,_0xf33899){var _0x78117d={};var _0x2413f7={};var _0x53d9ee;var _0x1801d7;return db[_0x4afe('0x2f')][_0x4afe('0x4b')]({'where':{'id':_0x4f9d4f[_0x4afe('0x44')]['id']}})[_0x4afe('0x27')](handleEntityNotFound(_0x1a1ce6,null))[_0x4afe('0x27')](function(_0x483581){if(_0x483581){_0x53d9ee=_0x483581;_0x2413f7['model']=_[_0x4afe('0x32')](db[_0x4afe('0x4c')][_0x4afe('0x45')]);_0x2413f7[_0x4afe('0x31')]=_['keys'](_0x4f9d4f[_0x4afe('0x31')]);_0x2413f7[_0x4afe('0x33')]=_[_0x4afe('0x34')](_0x2413f7[_0x4afe('0x35')],_0x2413f7[_0x4afe('0x31')]);_0x78117d[_0x4afe('0x36')]=_[_0x4afe('0x34')](_0x2413f7[_0x4afe('0x35')],qs[_0x4afe('0x37')](_0x4f9d4f[_0x4afe('0x31')][_0x4afe('0x37')]));_0x78117d[_0x4afe('0x36')]=_0x78117d[_0x4afe('0x36')][_0x4afe('0x38')]?_0x78117d[_0x4afe('0x36')]:_0x2413f7['model'];_0x78117d[_0x4afe('0x3a')]=qs[_0x4afe('0x3b')](_0x4f9d4f[_0x4afe('0x31')]['sort']);_0x78117d[_0x4afe('0x3d')]=qs[_0x4afe('0x33')](_[_0x4afe('0x4d')](_0x4f9d4f[_0x4afe('0x31')],_0x2413f7['filters']));if(_0x4f9d4f[_0x4afe('0x31')]['filter']){_0x78117d[_0x4afe('0x3d')]=_['merge'](_0x78117d[_0x4afe('0x3d')],{'$or':_[_0x4afe('0x2e')](_0x78117d[_0x4afe('0x36')],function(_0x27c25f){var _0x550ec0={};_0x550ec0[_0x27c25f]={'$like':'%'+_0x4f9d4f[_0x4afe('0x31')]['filter']+'%'};return _0x550ec0;})});}_0x78117d=_[_0x4afe('0x3e')]({},_0x78117d,_0x4f9d4f[_0x4afe('0x46')]);return _0x53d9ee[_0x4afe('0x4e')](_0x78117d);}})[_0x4afe('0x27')](function(_0xb9146d){if(_0xb9146d){_0x1801d7=_0xb9146d['length'];if(!_0x4f9d4f[_0x4afe('0x31')][_0x4afe('0x4f')](_0x4afe('0x39'))){_0x78117d[_0x4afe('0x1e')]=qs[_0x4afe('0x1e')](_0x4f9d4f[_0x4afe('0x31')][_0x4afe('0x1e')]);_0x78117d[_0x4afe('0x20')]=qs[_0x4afe('0x20')](_0x4f9d4f[_0x4afe('0x31')][_0x4afe('0x20')]);}return _0x53d9ee[_0x4afe('0x4e')](_0x78117d);}})[_0x4afe('0x27')](function(_0x2628bd){if(_0x2628bd){return _0x2628bd?{'count':_0x1801d7,'rows':_0x2628bd}:null;}})['then'](respondWithResult(_0x1a1ce6,null))['catch'](handleError(_0x1a1ce6,null));};exports[_0x4afe('0x50')]=function(_0x2b4c04,_0x291b05,_0x36371f){var _0x5e87db={};var _0x455bd9={};var _0x51bef6;var _0x1fa3ba;return db[_0x4afe('0x2f')][_0x4afe('0x4b')]({'where':{'id':_0x2b4c04[_0x4afe('0x44')]['id']}})[_0x4afe('0x27')](handleEntityNotFound(_0x291b05,null))[_0x4afe('0x27')](function(_0x28b548){if(_0x28b548){_0x51bef6=_0x28b548;_0x455bd9[_0x4afe('0x35')]=_[_0x4afe('0x32')](db[_0x4afe('0x4c')][_0x4afe('0x45')]);_0x455bd9[_0x4afe('0x31')]=_[_0x4afe('0x32')](_0x2b4c04[_0x4afe('0x31')]);_0x455bd9[_0x4afe('0x33')]=_['intersection'](_0x455bd9['model'],_0x455bd9[_0x4afe('0x31')]);_0x5e87db['attributes']=_[_0x4afe('0x34')](_0x455bd9[_0x4afe('0x35')],qs['fields'](_0x2b4c04['query'][_0x4afe('0x37')]));_0x5e87db['attributes']=_0x5e87db[_0x4afe('0x36')][_0x4afe('0x38')]?_0x5e87db[_0x4afe('0x36')]:_0x455bd9[_0x4afe('0x35')];_0x5e87db[_0x4afe('0x3a')]=qs[_0x4afe('0x3b')](_0x2b4c04[_0x4afe('0x31')][_0x4afe('0x3b')]);_0x5e87db[_0x4afe('0x3d')]=qs[_0x4afe('0x33')](_[_0x4afe('0x4d')](_0x2b4c04[_0x4afe('0x31')],_0x455bd9[_0x4afe('0x33')]));if(_0x2b4c04[_0x4afe('0x31')][_0x4afe('0x3c')]){_0x5e87db[_0x4afe('0x3d')]=_[_0x4afe('0x3e')](_0x5e87db[_0x4afe('0x3d')],{'$or':_[_0x4afe('0x2e')](_0x5e87db['attributes'],function(_0x5ab454){var _0x499336={};_0x499336[_0x5ab454]={'$like':'%'+_0x2b4c04[_0x4afe('0x31')]['filter']+'%'};return _0x499336;})});}_0x5e87db=_[_0x4afe('0x3e')]({},_0x5e87db,_0x2b4c04['options']);return _0x51bef6['getSubjects'](_0x5e87db);}})['then'](function(_0x1d86f0){if(_0x1d86f0){_0x1fa3ba=_0x1d86f0[_0x4afe('0x38')];if(!_0x2b4c04[_0x4afe('0x31')]['hasOwnProperty'](_0x4afe('0x39'))){_0x5e87db[_0x4afe('0x1e')]=qs[_0x4afe('0x1e')](_0x2b4c04[_0x4afe('0x31')]['limit']);_0x5e87db[_0x4afe('0x20')]=qs[_0x4afe('0x20')](_0x2b4c04['query'][_0x4afe('0x20')]);}return _0x51bef6[_0x4afe('0x50')](_0x5e87db);}})['then'](function(_0x12ef42){if(_0x12ef42){return _0x12ef42?{'count':_0x1fa3ba,'rows':_0x12ef42}:null;}})[_0x4afe('0x27')](respondWithResult(_0x291b05,null))[_0x4afe('0x48')](handleError(_0x291b05,null));};exports[_0x4afe('0x51')]=function(_0x4efaed,_0x460f4c,_0x404b2d){var _0xe1ce4f={};var _0x5b93eb={};var _0x576d5a;var _0x5ece36;return db[_0x4afe('0x2f')][_0x4afe('0x4b')]({'where':{'id':_0x4efaed[_0x4afe('0x44')]['id']}})[_0x4afe('0x27')](handleEntityNotFound(_0x460f4c,null))[_0x4afe('0x27')](function(_0x1580a8){if(_0x1580a8){_0x576d5a=_0x1580a8;_0x5b93eb[_0x4afe('0x35')]=_[_0x4afe('0x32')](db[_0x4afe('0x4c')][_0x4afe('0x45')]);_0x5b93eb['query']=_['keys'](_0x4efaed[_0x4afe('0x31')]);_0x5b93eb[_0x4afe('0x33')]=_[_0x4afe('0x34')](_0x5b93eb[_0x4afe('0x35')],_0x5b93eb[_0x4afe('0x31')]);_0xe1ce4f[_0x4afe('0x36')]=_[_0x4afe('0x34')](_0x5b93eb['model'],qs[_0x4afe('0x37')](_0x4efaed[_0x4afe('0x31')][_0x4afe('0x37')]));_0xe1ce4f[_0x4afe('0x36')]=_0xe1ce4f[_0x4afe('0x36')]['length']?_0xe1ce4f[_0x4afe('0x36')]:_0x5b93eb[_0x4afe('0x35')];_0xe1ce4f[_0x4afe('0x3a')]=qs['sort'](_0x4efaed[_0x4afe('0x31')][_0x4afe('0x3b')]);_0xe1ce4f[_0x4afe('0x3d')]=qs[_0x4afe('0x33')](_[_0x4afe('0x4d')](_0x4efaed[_0x4afe('0x31')],_0x5b93eb['filters']));if(_0x4efaed[_0x4afe('0x31')][_0x4afe('0x3c')]){_0xe1ce4f[_0x4afe('0x3d')]=_[_0x4afe('0x3e')](_0xe1ce4f['where'],{'$or':_[_0x4afe('0x2e')](_0xe1ce4f[_0x4afe('0x36')],function(_0x3bb4ea){var _0x437a20={};_0x437a20[_0x3bb4ea]={'$like':'%'+_0x4efaed[_0x4afe('0x31')][_0x4afe('0x3c')]+'%'};return _0x437a20;})});}_0xe1ce4f=_['merge']({},_0xe1ce4f,_0x4efaed[_0x4afe('0x46')]);return _0x576d5a[_0x4afe('0x51')](_0xe1ce4f);}})['then'](function(_0x87ca24){if(_0x87ca24){_0x5ece36=_0x87ca24[_0x4afe('0x38')];if(!_0x4efaed[_0x4afe('0x31')][_0x4afe('0x4f')](_0x4afe('0x39'))){_0xe1ce4f[_0x4afe('0x1e')]=qs[_0x4afe('0x1e')](_0x4efaed[_0x4afe('0x31')][_0x4afe('0x1e')]);_0xe1ce4f[_0x4afe('0x20')]=qs[_0x4afe('0x20')](_0x4efaed['query']['offset']);}return _0x576d5a['getDescriptions'](_0xe1ce4f);}})['then'](function(_0x9d624d){if(_0x9d624d){return _0x9d624d?{'count':_0x5ece36,'rows':_0x9d624d}:null;}})['then'](respondWithResult(_0x460f4c,null))[_0x4afe('0x48')](handleError(_0x460f4c,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 3025105..bea756f 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 _0x4a2d=['moment','request-promise','path','rimraf','../../config/environment','exports','define','ZohoConfiguration','lodash','util','../../config/logger','api'];(function(_0x170add,_0x5e6fae){var _0x1cebdb=function(_0x4d06ea){while(--_0x4d06ea){_0x170add['push'](_0x170add['shift']());}};_0x1cebdb(++_0x5e6fae);}(_0x4a2d,0xa4));var _0xd4a2=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x4a2d[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xd4a2('0x0'));var util=require(_0xd4a2('0x1'));var logger=require(_0xd4a2('0x2'))(_0xd4a2('0x3'));var moment=require(_0xd4a2('0x4'));var BPromise=require('bluebird');var rp=require(_0xd4a2('0x5'));var fs=require('fs');var path=require(_0xd4a2('0x6'));var rimraf=require(_0xd4a2('0x7'));var config=require(_0xd4a2('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0xd4a2('0x9')]=function(_0x46d123,_0x2d68eb){return _0x46d123[_0xd4a2('0xa')](_0xd4a2('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e9f=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x342594,_0x8f2cc7){var _0x4a08c4=function(_0x6ddde6){while(--_0x6ddde6){_0x342594['push'](_0x342594['shift']());}};_0x4a08c4(++_0x8f2cc7);}(_0x8e9f,0x16e));var _0xf8e9=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x8e9f[_0x2555d0];return _0x3bb486;};'use strict';var _=require(_0xf8e9('0x0'));var util=require('util');var logger=require(_0xf8e9('0x1'))(_0xf8e9('0x2'));var moment=require(_0xf8e9('0x3'));var BPromise=require(_0xf8e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8e9('0x5'));var rimraf=require(_0xf8e9('0x6'));var config=require(_0xf8e9('0x7'));var attributes=require(_0xf8e9('0x8'));module[_0xf8e9('0x9')]=function(_0x1b9202,_0x27e326){return _0x1b9202[_0xf8e9('0xa')]('ZohoConfiguration',attributes,{'tableName':_0xf8e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 3056be1..50d4f88 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 _0xd771=['jayson/promise','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1c688b,_0x4df102){var _0x4d4577=function(_0x29a41b){while(--_0x29a41b){_0x1c688b['push'](_0x1c688b['shift']());}};_0x4d4577(++_0x4df102);}(_0xd771,0x7a));var _0x1d77=function(_0x2a2cd2,_0x311687){_0x2a2cd2=_0x2a2cd2-0x0;var _0x244b78=_0xd771[_0x2a2cd2];return _0x244b78;};'use strict';var _=require(_0x1d77('0x0'));var util=require('util');var moment=require(_0x1d77('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1d77('0x2'));var logger=require(_0x1d77('0x3'))(_0x1d77('0x4'));var config=require(_0x1d77('0x5'));var jayson=require(_0x1d77('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36c9ca,_0x31e47b,_0x407ea6){return new BPromise(function(_0x1adb19,_0xdf9f5f){return client[_0x1d77('0x7')](_0x36c9ca,_0x407ea6)['then'](function(_0x3fd87e){logger[_0x1d77('0x8')](_0x1d77('0x9'),_0x31e47b,_0x1d77('0xa'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x31e47b,_0x1d77('0xa'),JSON[_0x1d77('0xb')](_0x3fd87e));if(_0x3fd87e['error']){if(_0x3fd87e[_0x1d77('0xc')][_0x1d77('0xd')]===0x1f4){logger[_0x1d77('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x31e47b,_0x3fd87e[_0x1d77('0xc')]['message']);return _0xdf9f5f(_0x3fd87e[_0x1d77('0xc')]['message']);}logger[_0x1d77('0xc')](_0x1d77('0x9'),_0x31e47b,_0x3fd87e[_0x1d77('0xc')][_0x1d77('0xe')]);return _0x1adb19(_0x3fd87e[_0x1d77('0xc')][_0x1d77('0xe')]);}else{logger[_0x1d77('0x8')](_0x1d77('0x9'),_0x31e47b,_0x1d77('0xa'));_0x1adb19(_0x3fd87e[_0x1d77('0xf')][_0x1d77('0xe')]);}})['catch'](function(_0x45daa8){logger[_0x1d77('0xc')](_0x1d77('0x9'),_0x31e47b,_0x45daa8);_0xdf9f5f(_0x45daa8);});});} \ No newline at end of file +var _0x0e88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0xf4666e,_0x571140){var _0x1853f1=function(_0x5160a5){while(--_0x5160a5){_0xf4666e['push'](_0xf4666e['shift']());}};_0x1853f1(++_0x571140);}(_0x0e88,0x1c7));var _0x80e8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0e88[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x80e8('0x0'));var util=require(_0x80e8('0x1'));var moment=require(_0x80e8('0x2'));var BPromise=require(_0x80e8('0x3'));var rs=require(_0x80e8('0x4'));var fs=require('fs');var Redis=require(_0x80e8('0x5'));var db=require(_0x80e8('0x6'))['db'];var utils=require(_0x80e8('0x7'));var logger=require(_0x80e8('0x8'))('rpc');var config=require(_0x80e8('0x9'));var jayson=require(_0x80e8('0xa'));var client=jayson[_0x80e8('0xb')][_0x80e8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x262992,_0x24daec,_0x440ca1){return new BPromise(function(_0x4ac345,_0x4c69dd){return client[_0x80e8('0xd')](_0x262992,_0x440ca1)[_0x80e8('0xe')](function(_0x39d043){logger[_0x80e8('0xf')](_0x80e8('0x10'),_0x24daec,_0x80e8('0x11'));logger[_0x80e8('0x12')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x24daec,_0x80e8('0x11'),JSON['stringify'](_0x39d043));if(_0x39d043[_0x80e8('0x13')]){if(_0x39d043[_0x80e8('0x13')][_0x80e8('0x14')]===0x1f4){logger['error'](_0x80e8('0x10'),_0x24daec,_0x39d043[_0x80e8('0x13')][_0x80e8('0x15')]);return _0x4c69dd(_0x39d043[_0x80e8('0x13')][_0x80e8('0x15')]);}logger[_0x80e8('0x13')](_0x80e8('0x10'),_0x24daec,_0x39d043[_0x80e8('0x13')][_0x80e8('0x15')]);return _0x4ac345(_0x39d043['error'][_0x80e8('0x15')]);}else{logger[_0x80e8('0xf')](_0x80e8('0x10'),_0x24daec,_0x80e8('0x11'));_0x4ac345(_0x39d043[_0x80e8('0x16')][_0x80e8('0x15')]);}})['catch'](function(_0x25bff1){logger[_0x80e8('0x13')](_0x80e8('0x10'),_0x24daec,_0x25bff1);_0x4c69dd(_0x25bff1);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 8bbc7cf..9f9b84e 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 _0x927c=['fs-extra','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x927c,0x109));var _0xc927=function(_0x1916df,_0x3b977d){_0x1916df=_0x1916df-0x0;var _0x1852de=_0x927c[_0x1916df];return _0x1852de;};'use strict';var multer=require(_0xc927('0x0'));var util=require(_0xc927('0x1'));var path=require('path');var timeout=require(_0xc927('0x2'));var express=require(_0xc927('0x3'));var router=express[_0xc927('0x4')]();var fs_extra=require(_0xc927('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc927('0x6'));var config=require('../../config/environment');var controller=require(_0xc927('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc927('0x8')]('/:id',auth[_0xc927('0x9')](),controller[_0xc927('0xa')]);router['post']('/',auth[_0xc927('0x9')](),controller[_0xc927('0xb')]);router[_0xc927('0xc')](_0xc927('0xd'),auth[_0xc927('0x9')](),controller[_0xc927('0xe')]);router[_0xc927('0xf')]('/:id',auth[_0xc927('0x9')](),controller[_0xc927('0x10')]);module[_0xc927('0x11')]=router; \ No newline at end of file +var _0x9d13=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy'];(function(_0x235b0d,_0x3dc9c9){var _0x3be595=function(_0x1de0f1){while(--_0x1de0f1){_0x235b0d['push'](_0x235b0d['shift']());}};_0x3be595(++_0x3dc9c9);}(_0x9d13,0x13c));var _0x39d1=function(_0x4fe9d8,_0x39f8be){_0x4fe9d8=_0x4fe9d8-0x0;var _0x561b44=_0x9d13[_0x4fe9d8];return _0x561b44;};'use strict';var multer=require(_0x39d1('0x0'));var util=require(_0x39d1('0x1'));var path=require(_0x39d1('0x2'));var timeout=require(_0x39d1('0x3'));var express=require(_0x39d1('0x4'));var router=express[_0x39d1('0x5')]();var fs_extra=require(_0x39d1('0x6'));var auth=require(_0x39d1('0x7'));var interaction=require(_0x39d1('0x8'));var config=require('../../config/environment');var controller=require(_0x39d1('0x9'));router['get']('/',auth[_0x39d1('0xa')](),controller[_0x39d1('0xb')]);router[_0x39d1('0xc')]('/:id',auth[_0x39d1('0xa')](),controller['show']);router[_0x39d1('0xd')]('/',auth['isAuthenticated'](),controller[_0x39d1('0xe')]);router[_0x39d1('0xf')](_0x39d1('0x10'),auth['isAuthenticated'](),controller[_0x39d1('0x11')]);router[_0x39d1('0x12')](_0x39d1('0x10'),auth[_0x39d1('0xa')](),controller[_0x39d1('0x13')]);module[_0x39d1('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 8b5bbc2..a4e55ec 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 _0xa6a8=['string','STRING','sequelize','exports','ENUM','customVariable','keyValue','picklist'];(function(_0x449a63,_0x3c6e29){var _0x3bc08f=function(_0x55898e){while(--_0x55898e){_0x449a63['push'](_0x449a63['shift']());}};_0x3bc08f(++_0x3c6e29);}(_0xa6a8,0xaa));var _0x8a6a=function(_0x52d6b4,_0x30453c){_0x52d6b4=_0x52d6b4-0x0;var _0xe09124=_0xa6a8[_0x52d6b4];return _0xe09124;};'use strict';var Sequelize=require(_0x8a6a('0x0'));module[_0x8a6a('0x1')]={'type':{'type':Sequelize[_0x8a6a('0x2')]('string','variable',_0x8a6a('0x3'),_0x8a6a('0x4'),_0x8a6a('0x5')),'defaultValue':_0x8a6a('0x6')},'content':{'type':Sequelize[_0x8a6a('0x7')]},'key':{'type':Sequelize[_0x8a6a('0x7')]},'keyType':{'type':Sequelize[_0x8a6a('0x2')]('string','variable',_0x8a6a('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8a6a('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8a6a('0x7')]}}; \ No newline at end of file +var _0xbd9c=['picklist','string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0xda99d6,_0x5d0efa){var _0x4d8540=function(_0x5e2e94){while(--_0x5e2e94){_0xda99d6['push'](_0xda99d6['shift']());}};_0x4d8540(++_0x5d0efa);}(_0xbd9c,0x10a));var _0xcbd9=function(_0x241424,_0x25eb5d){_0x241424=_0x241424-0x0;var _0x3da798=_0xbd9c[_0x241424];return _0x3da798;};'use strict';var Sequelize=require(_0xcbd9('0x0'));module[_0xcbd9('0x1')]={'type':{'type':Sequelize[_0xcbd9('0x2')]('string',_0xcbd9('0x3'),'customVariable','keyValue',_0xcbd9('0x4')),'defaultValue':_0xcbd9('0x5')},'content':{'type':Sequelize[_0xcbd9('0x6')]},'key':{'type':Sequelize[_0xcbd9('0x6')]},'keyType':{'type':Sequelize[_0xcbd9('0x2')](_0xcbd9('0x5'),_0xcbd9('0x3'),_0xcbd9('0x7'))},'keyContent':{'type':Sequelize[_0xcbd9('0x6')]},'idField':{'type':Sequelize[_0xcbd9('0x6')]},'nameField':{'type':Sequelize[_0xcbd9('0x6')]},'customField':{'type':Sequelize[_0xcbd9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcbd9('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index fb0a3a5..6ab843f 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 _0xf36b=['ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','ZohoField','includeAll','include','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x3a304a,_0x93bbf9){var _0x1757a3=function(_0x3b0b6d){while(--_0x3b0b6d){_0x3a304a['push'](_0x3a304a['shift']());}};_0x1757a3(++_0x93bbf9);}(_0xf36b,0x127));var _0xbf36=function(_0x3c6bc5,_0x13df30){_0x3c6bc5=_0x3c6bc5-0x0;var _0x1005cc=_0xf36b[_0x3c6bc5];return _0x1005cc;};'use strict';var emlformat=require(_0xbf36('0x0'));var rimraf=require(_0xbf36('0x1'));var zipdir=require(_0xbf36('0x2'));var jsonpatch=require(_0xbf36('0x3'));var rp=require(_0xbf36('0x4'));var moment=require(_0xbf36('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbf36('0x6'));var util=require(_0xbf36('0x7'));var path=require(_0xbf36('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbf36('0x9'));var fs=require('fs');var fs_extra=require(_0xbf36('0xa'));var _=require('lodash');var squel=require(_0xbf36('0xb'));var crypto=require(_0xbf36('0xc'));var jsforce=require(_0xbf36('0xd'));var deskjs=require(_0xbf36('0xe'));var toCsv=require(_0xbf36('0xf'));var querystring=require(_0xbf36('0x10'));var Papa=require(_0xbf36('0x11'));var Redis=require(_0xbf36('0x12'));var authService=require(_0xbf36('0x13'));var qs=require(_0xbf36('0x14'));var as=require(_0xbf36('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf36('0x16'))(_0xbf36('0x17'));var utils=require(_0xbf36('0x18'));var config=require(_0xbf36('0x19'));var licenseUtil=require(_0xbf36('0x1a'));var db=require(_0xbf36('0x1b'))['db'];function respondWithStatusCode(_0x907d6f,_0x2fa0b2){_0x2fa0b2=_0x2fa0b2||0xcc;return function(_0x45753e){if(_0x45753e){return _0x907d6f[_0xbf36('0x1c')](_0x2fa0b2);}return _0x907d6f[_0xbf36('0x1d')](_0x2fa0b2)[_0xbf36('0x1e')]();};}function respondWithResult(_0x359b47,_0x1a26ba){_0x1a26ba=_0x1a26ba||0xc8;return function(_0x43c5f6){if(_0x43c5f6){return _0x359b47[_0xbf36('0x1d')](_0x1a26ba)['json'](_0x43c5f6);}};}function respondWithFilteredResult(_0xba9145,_0x4994d0){return function(_0x3c6d80){if(_0x3c6d80){var _0x39a390=typeof _0x4994d0[_0xbf36('0x1f')]==='undefined'&&typeof _0x4994d0[_0xbf36('0x20')]===_0xbf36('0x21');var _0x4a5e32=_0x3c6d80[_0xbf36('0x22')];var _0x2291a8=_0x39a390?0x0:_0x4994d0[_0xbf36('0x1f')];var _0x8288ac=_0x39a390?_0x3c6d80[_0xbf36('0x22')]:_0x4994d0[_0xbf36('0x1f')]+_0x4994d0[_0xbf36('0x20')];var _0x3a5235;if(_0x8288ac>=_0x4a5e32){_0x8288ac=_0x4a5e32;_0x3a5235=0xc8;}else{_0x3a5235=0xce;}_0xba9145[_0xbf36('0x1d')](_0x3a5235);return _0xba9145[_0xbf36('0x23')](_0xbf36('0x24'),_0x2291a8+'-'+_0x8288ac+'/'+_0x4a5e32)['json'](_0x3c6d80);}return null;};}function patchUpdates(_0x5ca9a0){return function(_0x535927){try{jsonpatch['apply'](_0x535927,_0x5ca9a0,!![]);}catch(_0x32b418){return BPromise['reject'](_0x32b418);}return _0x535927[_0xbf36('0x25')]();};}function saveUpdates(_0x3889e4,_0x57550e){return function(_0x53f777){if(_0x53f777){return _0x53f777[_0xbf36('0x26')](_0x3889e4)[_0xbf36('0x27')](function(_0xe51c){return _0xe51c;});}return null;};}function removeEntity(_0x42475e,_0x4c5181){return function(_0x38a8f5){if(_0x38a8f5){return _0x38a8f5[_0xbf36('0x28')]()[_0xbf36('0x27')](function(){_0x42475e[_0xbf36('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d04f0,_0x55b95a){return function(_0x4dfa28){if(!_0x4dfa28){_0x4d04f0[_0xbf36('0x1c')](0x194);}return _0x4dfa28;};}function handleError(_0x2a7b7e,_0x35b1e8){_0x35b1e8=_0x35b1e8||0x1f4;return function(_0x3c5eb4){logger['error'](_0x3c5eb4[_0xbf36('0x29')]);if(_0x3c5eb4[_0xbf36('0x2a')]){delete _0x3c5eb4[_0xbf36('0x2a')];}_0x2a7b7e['status'](_0x35b1e8)[_0xbf36('0x2b')](_0x3c5eb4);};}exports[_0xbf36('0x2c')]=function(_0x22a91c,_0x4561f3){var _0x1e468d={},_0x20dacd={},_0x1b9c04={'count':0x0,'rows':[]};var _0x13951d=_[_0xbf36('0x2d')](db['ZohoField'][_0xbf36('0x2e')],function(_0x362b76){return{'name':_0x362b76[_0xbf36('0x2f')],'type':_0x362b76[_0xbf36('0x30')]['key']};});_0x20dacd[_0xbf36('0x31')]=_['map'](_0x13951d,_0xbf36('0x2a'));_0x20dacd[_0xbf36('0x32')]=_[_0xbf36('0x33')](_0x22a91c[_0xbf36('0x32')]);_0x20dacd[_0xbf36('0x34')]=_['intersection'](_0x20dacd['model'],_0x20dacd['query']);_0x1e468d[_0xbf36('0x35')]=_[_0xbf36('0x36')](_0x20dacd[_0xbf36('0x31')],qs[_0xbf36('0x37')](_0x22a91c[_0xbf36('0x32')][_0xbf36('0x37')]));_0x1e468d['attributes']=_0x1e468d[_0xbf36('0x35')][_0xbf36('0x38')]?_0x1e468d[_0xbf36('0x35')]:_0x20dacd[_0xbf36('0x31')];if(!_0x22a91c[_0xbf36('0x32')][_0xbf36('0x39')](_0xbf36('0x3a'))){_0x1e468d[_0xbf36('0x20')]=qs[_0xbf36('0x20')](_0x22a91c[_0xbf36('0x32')][_0xbf36('0x20')]);_0x1e468d[_0xbf36('0x1f')]=qs[_0xbf36('0x1f')](_0x22a91c['query'][_0xbf36('0x1f')]);}_0x1e468d['order']=qs[_0xbf36('0x3b')](_0x22a91c[_0xbf36('0x32')][_0xbf36('0x3b')]);_0x1e468d[_0xbf36('0x3c')]=qs[_0xbf36('0x34')](_[_0xbf36('0x3d')](_0x22a91c['query'],_0x20dacd[_0xbf36('0x34')]),_0x13951d);if(_0x22a91c[_0xbf36('0x32')]['filter']){_0x1e468d['where']=_[_0xbf36('0x3e')](_0x1e468d[_0xbf36('0x3c')],{'$or':_[_0xbf36('0x2d')](_0x13951d,function(_0x1a4306){if(_0x1a4306['type']!==_0xbf36('0x3f')){var _0x593a34={};_0x593a34[_0x1a4306[_0xbf36('0x2a')]]={'$like':'%'+_0x22a91c[_0xbf36('0x32')][_0xbf36('0x40')]+'%'};return _0x593a34;}})});}_0x1e468d=_[_0xbf36('0x3e')]({},_0x1e468d,_0x22a91c[_0xbf36('0x41')]);var _0x1ef0e5={'where':_0x1e468d['where']};return db[_0xbf36('0x42')][_0xbf36('0x22')](_0x1ef0e5)[_0xbf36('0x27')](function(_0x38f4dc){_0x1b9c04['count']=_0x38f4dc;if(_0x22a91c[_0xbf36('0x32')][_0xbf36('0x43')]){_0x1e468d[_0xbf36('0x44')]=[{'all':!![]}];}return db[_0xbf36('0x42')]['findAll'](_0x1e468d);})[_0xbf36('0x27')](function(_0x3873d1){_0x1b9c04[_0xbf36('0x45')]=_0x3873d1;return _0x1b9c04;})['then'](respondWithFilteredResult(_0x4561f3,_0x1e468d))[_0xbf36('0x46')](handleError(_0x4561f3,null));};exports[_0xbf36('0x47')]=function(_0x2965b2,_0x87431b){var _0x413f20={'raw':!![],'where':{'id':_0x2965b2['params']['id']}},_0x5cb9ef={};_0x5cb9ef['model']=_[_0xbf36('0x33')](db[_0xbf36('0x42')][_0xbf36('0x2e')]);_0x5cb9ef[_0xbf36('0x32')]=_['keys'](_0x2965b2[_0xbf36('0x32')]);_0x5cb9ef[_0xbf36('0x34')]=_['intersection'](_0x5cb9ef[_0xbf36('0x31')],_0x5cb9ef[_0xbf36('0x32')]);_0x413f20[_0xbf36('0x35')]=_[_0xbf36('0x36')](_0x5cb9ef[_0xbf36('0x31')],qs['fields'](_0x2965b2[_0xbf36('0x32')][_0xbf36('0x37')]));_0x413f20[_0xbf36('0x35')]=_0x413f20[_0xbf36('0x35')][_0xbf36('0x38')]?_0x413f20[_0xbf36('0x35')]:_0x5cb9ef[_0xbf36('0x31')];if(_0x2965b2['query'][_0xbf36('0x43')]){_0x413f20[_0xbf36('0x44')]=[{'all':!![]}];}_0x413f20=_[_0xbf36('0x3e')]({},_0x413f20,_0x2965b2['options']);return db['ZohoField'][_0xbf36('0x48')](_0x413f20)[_0xbf36('0x27')](handleEntityNotFound(_0x87431b,null))['then'](respondWithResult(_0x87431b,null))[_0xbf36('0x46')](handleError(_0x87431b,null));};exports[_0xbf36('0x49')]=function(_0x53ac3d,_0x240eab){return db[_0xbf36('0x42')][_0xbf36('0x49')](_0x53ac3d[_0xbf36('0x4a')],{})[_0xbf36('0x27')](respondWithResult(_0x240eab,0xc9))[_0xbf36('0x46')](handleError(_0x240eab,null));};exports[_0xbf36('0x26')]=function(_0x4329d8,_0x1ad5ae){if(_0x4329d8[_0xbf36('0x4a')]['id']){delete _0x4329d8[_0xbf36('0x4a')]['id'];}return db[_0xbf36('0x42')][_0xbf36('0x48')]({'where':{'id':_0x4329d8[_0xbf36('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1ad5ae,null))[_0xbf36('0x27')](saveUpdates(_0x4329d8[_0xbf36('0x4a')],null))['then'](respondWithResult(_0x1ad5ae,null))[_0xbf36('0x46')](handleError(_0x1ad5ae,null));};exports['destroy']=function(_0x516a9e,_0x5a8e0c){return db['ZohoField']['find']({'where':{'id':_0x516a9e['params']['id']}})[_0xbf36('0x27')](handleEntityNotFound(_0x5a8e0c,null))['then'](removeEntity(_0x5a8e0c,null))['catch'](handleError(_0x5a8e0c,null));}; \ No newline at end of file +var _0xe127=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','ZohoField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service'];(function(_0x5b1f14,_0x5a772b){var _0x27371d=function(_0x2e1547){while(--_0x2e1547){_0x5b1f14['push'](_0x5b1f14['shift']());}};_0x27371d(++_0x5a772b);}(_0xe127,0x1e2));var _0x7e12=function(_0x1222fa,_0x3fa16d){_0x1222fa=_0x1222fa-0x0;var _0x494b92=_0xe127[_0x1222fa];return _0x494b92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e12('0x0'));var zipdir=require(_0x7e12('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e12('0x2'));var moment=require(_0x7e12('0x3'));var BPromise=require(_0x7e12('0x4'));var Mustache=require('mustache');var util=require(_0x7e12('0x5'));var path=require(_0x7e12('0x6'));var sox=require(_0x7e12('0x7'));var csv=require(_0x7e12('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e12('0x9'));var squel=require(_0x7e12('0xa'));var crypto=require('crypto');var jsforce=require(_0x7e12('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7e12('0x8'));var querystring=require(_0x7e12('0xc'));var Papa=require('papaparse');var Redis=require(_0x7e12('0xd'));var authService=require(_0x7e12('0xe'));var qs=require(_0x7e12('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e12('0x10'));var logger=require('../../config/logger')(_0x7e12('0x11'));var utils=require(_0x7e12('0x12'));var config=require(_0x7e12('0x13'));var licenseUtil=require(_0x7e12('0x14'));var db=require(_0x7e12('0x15'))['db'];function respondWithStatusCode(_0x12da35,_0x16b02f){_0x16b02f=_0x16b02f||0xcc;return function(_0x3da31c){if(_0x3da31c){return _0x12da35[_0x7e12('0x16')](_0x16b02f);}return _0x12da35['status'](_0x16b02f)['end']();};}function respondWithResult(_0x4a0956,_0x5a00d3){_0x5a00d3=_0x5a00d3||0xc8;return function(_0x3e4b4b){if(_0x3e4b4b){return _0x4a0956[_0x7e12('0x17')](_0x5a00d3)['json'](_0x3e4b4b);}};}function respondWithFilteredResult(_0x42b6ee,_0x2c201c){return function(_0x409f45){if(_0x409f45){var _0x1d9326=typeof _0x2c201c[_0x7e12('0x18')]===_0x7e12('0x19')&&typeof _0x2c201c[_0x7e12('0x1a')]===_0x7e12('0x19');var _0x65453f=_0x409f45[_0x7e12('0x1b')];var _0x13eb3e=_0x1d9326?0x0:_0x2c201c[_0x7e12('0x18')];var _0x4c1e24=_0x1d9326?_0x409f45[_0x7e12('0x1b')]:_0x2c201c[_0x7e12('0x18')]+_0x2c201c[_0x7e12('0x1a')];var _0x44cfcb;if(_0x4c1e24>=_0x65453f){_0x4c1e24=_0x65453f;_0x44cfcb=0xc8;}else{_0x44cfcb=0xce;}_0x42b6ee[_0x7e12('0x17')](_0x44cfcb);return _0x42b6ee[_0x7e12('0x1c')](_0x7e12('0x1d'),_0x13eb3e+'-'+_0x4c1e24+'/'+_0x65453f)[_0x7e12('0x1e')](_0x409f45);}return null;};}function patchUpdates(_0x55de45){return function(_0x292fad){try{jsonpatch['apply'](_0x292fad,_0x55de45,!![]);}catch(_0x5d3e1a){return BPromise[_0x7e12('0x1f')](_0x5d3e1a);}return _0x292fad[_0x7e12('0x20')]();};}function saveUpdates(_0x88b28c,_0x228119){return function(_0x38ab81){if(_0x38ab81){return _0x38ab81[_0x7e12('0x21')](_0x88b28c)[_0x7e12('0x22')](function(_0x4505d0){return _0x4505d0;});}return null;};}function removeEntity(_0x371b5a,_0xadc6e2){return function(_0x1cef98){if(_0x1cef98){return _0x1cef98[_0x7e12('0x23')]()['then'](function(){_0x371b5a[_0x7e12('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x686e3a,_0x3c6e0a){return function(_0x2dc8ce){if(!_0x2dc8ce){_0x686e3a[_0x7e12('0x16')](0x194);}return _0x2dc8ce;};}function handleError(_0x216b70,_0x57cce7){_0x57cce7=_0x57cce7||0x1f4;return function(_0x1c0bff){logger[_0x7e12('0x24')](_0x1c0bff['stack']);if(_0x1c0bff[_0x7e12('0x25')]){delete _0x1c0bff['name'];}_0x216b70['status'](_0x57cce7)[_0x7e12('0x26')](_0x1c0bff);};}exports[_0x7e12('0x27')]=function(_0x4f0c58,_0x1d0870){var _0x1bbf2f={},_0x1aee48={},_0x3c191e={'count':0x0,'rows':[]};var _0x40fe24=_['map'](db[_0x7e12('0x28')][_0x7e12('0x29')],function(_0x1b28f5){return{'name':_0x1b28f5[_0x7e12('0x2a')],'type':_0x1b28f5[_0x7e12('0x2b')][_0x7e12('0x2c')]};});_0x1aee48['model']=_[_0x7e12('0x2d')](_0x40fe24,'name');_0x1aee48[_0x7e12('0x2e')]=_[_0x7e12('0x2f')](_0x4f0c58[_0x7e12('0x2e')]);_0x1aee48[_0x7e12('0x30')]=_[_0x7e12('0x31')](_0x1aee48[_0x7e12('0x32')],_0x1aee48[_0x7e12('0x2e')]);_0x1bbf2f[_0x7e12('0x33')]=_['intersection'](_0x1aee48[_0x7e12('0x32')],qs[_0x7e12('0x34')](_0x4f0c58[_0x7e12('0x2e')][_0x7e12('0x34')]));_0x1bbf2f[_0x7e12('0x33')]=_0x1bbf2f['attributes'][_0x7e12('0x35')]?_0x1bbf2f['attributes']:_0x1aee48[_0x7e12('0x32')];if(!_0x4f0c58[_0x7e12('0x2e')][_0x7e12('0x36')]('nolimit')){_0x1bbf2f['limit']=qs[_0x7e12('0x1a')](_0x4f0c58[_0x7e12('0x2e')][_0x7e12('0x1a')]);_0x1bbf2f[_0x7e12('0x18')]=qs[_0x7e12('0x18')](_0x4f0c58[_0x7e12('0x2e')][_0x7e12('0x18')]);}_0x1bbf2f['order']=qs[_0x7e12('0x37')](_0x4f0c58[_0x7e12('0x2e')]['sort']);_0x1bbf2f[_0x7e12('0x38')]=qs[_0x7e12('0x30')](_[_0x7e12('0x39')](_0x4f0c58[_0x7e12('0x2e')],_0x1aee48[_0x7e12('0x30')]),_0x40fe24);if(_0x4f0c58[_0x7e12('0x2e')][_0x7e12('0x3a')]){_0x1bbf2f[_0x7e12('0x38')]=_[_0x7e12('0x3b')](_0x1bbf2f[_0x7e12('0x38')],{'$or':_['map'](_0x40fe24,function(_0x2a9619){if(_0x2a9619[_0x7e12('0x2b')]!=='VIRTUAL'){var _0x6ebcb8={};_0x6ebcb8[_0x2a9619[_0x7e12('0x25')]]={'$like':'%'+_0x4f0c58[_0x7e12('0x2e')][_0x7e12('0x3a')]+'%'};return _0x6ebcb8;}})});}_0x1bbf2f=_['merge']({},_0x1bbf2f,_0x4f0c58[_0x7e12('0x3c')]);var _0x586bf1={'where':_0x1bbf2f['where']};return db['ZohoField'][_0x7e12('0x1b')](_0x586bf1)['then'](function(_0x24c278){_0x3c191e['count']=_0x24c278;if(_0x4f0c58[_0x7e12('0x2e')][_0x7e12('0x3d')]){_0x1bbf2f[_0x7e12('0x3e')]=[{'all':!![]}];}return db[_0x7e12('0x28')][_0x7e12('0x3f')](_0x1bbf2f);})[_0x7e12('0x22')](function(_0x48ea04){_0x3c191e[_0x7e12('0x40')]=_0x48ea04;return _0x3c191e;})[_0x7e12('0x22')](respondWithFilteredResult(_0x1d0870,_0x1bbf2f))[_0x7e12('0x41')](handleError(_0x1d0870,null));};exports[_0x7e12('0x42')]=function(_0x57e88a,_0x36b9a3){var _0x1975a6={'raw':!![],'where':{'id':_0x57e88a[_0x7e12('0x43')]['id']}},_0x1588fa={};_0x1588fa[_0x7e12('0x32')]=_[_0x7e12('0x2f')](db['ZohoField'][_0x7e12('0x29')]);_0x1588fa[_0x7e12('0x2e')]=_[_0x7e12('0x2f')](_0x57e88a[_0x7e12('0x2e')]);_0x1588fa[_0x7e12('0x30')]=_[_0x7e12('0x31')](_0x1588fa[_0x7e12('0x32')],_0x1588fa['query']);_0x1975a6[_0x7e12('0x33')]=_[_0x7e12('0x31')](_0x1588fa[_0x7e12('0x32')],qs['fields'](_0x57e88a[_0x7e12('0x2e')][_0x7e12('0x34')]));_0x1975a6[_0x7e12('0x33')]=_0x1975a6[_0x7e12('0x33')][_0x7e12('0x35')]?_0x1975a6[_0x7e12('0x33')]:_0x1588fa[_0x7e12('0x32')];if(_0x57e88a[_0x7e12('0x2e')][_0x7e12('0x3d')]){_0x1975a6[_0x7e12('0x3e')]=[{'all':!![]}];}_0x1975a6=_[_0x7e12('0x3b')]({},_0x1975a6,_0x57e88a[_0x7e12('0x3c')]);return db[_0x7e12('0x28')]['find'](_0x1975a6)[_0x7e12('0x22')](handleEntityNotFound(_0x36b9a3,null))['then'](respondWithResult(_0x36b9a3,null))[_0x7e12('0x41')](handleError(_0x36b9a3,null));};exports[_0x7e12('0x44')]=function(_0x5903c7,_0x3c79e5){return db[_0x7e12('0x28')][_0x7e12('0x44')](_0x5903c7[_0x7e12('0x45')],{})['then'](respondWithResult(_0x3c79e5,0xc9))[_0x7e12('0x41')](handleError(_0x3c79e5,null));};exports[_0x7e12('0x21')]=function(_0x2d11fd,_0x4f01ea){if(_0x2d11fd[_0x7e12('0x45')]['id']){delete _0x2d11fd['body']['id'];}return db[_0x7e12('0x28')][_0x7e12('0x46')]({'where':{'id':_0x2d11fd[_0x7e12('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f01ea,null))[_0x7e12('0x22')](saveUpdates(_0x2d11fd[_0x7e12('0x45')],null))[_0x7e12('0x22')](respondWithResult(_0x4f01ea,null))[_0x7e12('0x41')](handleError(_0x4f01ea,null));};exports[_0x7e12('0x23')]=function(_0x3744e7,_0x25bac3){return db[_0x7e12('0x28')][_0x7e12('0x46')]({'where':{'id':_0x3744e7[_0x7e12('0x43')]['id']}})[_0x7e12('0x22')](handleEntityNotFound(_0x25bac3,null))['then'](removeEntity(_0x25bac3,null))[_0x7e12('0x41')](handleError(_0x25bac3,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d0015cf..4f9826d 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 _0x323f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','util','api'];(function(_0x15b97a,_0x405cd8){var _0x729867=function(_0x460d87){while(--_0x460d87){_0x15b97a['push'](_0x15b97a['shift']());}};_0x729867(++_0x405cd8);}(_0x323f,0x1ee));var _0xf323=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x323f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));module[_0xf323('0x9')]=function(_0x371707,_0x5d7d60){return _0x371707[_0xf323('0xa')](_0xf323('0xb'),attributes,{'tableName':_0xf323('0xc'),'paranoid':![],'indexes':[{'name':_0xf323('0xd'),'fields':[_0xf323('0xe'),_0xf323('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa46e=['path','../../config/environment','exports','define','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x5a0b65,_0x3bc1bc){var _0x2b228b=function(_0x5bbdcc){while(--_0x5bbdcc){_0x5a0b65['push'](_0x5a0b65['shift']());}};_0x2b228b(++_0x3bc1bc);}(_0xa46e,0x8a));var _0xea46=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xa46e[_0x363ef8];return _0x148822;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./intZohoField.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('ZohoField',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[{'name':_0xea46('0xa'),'fields':[_0xea46('0xb'),_0xea46('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 4682706..74dfff5 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 _0x2d6c=['then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x568233,_0x1e6cfc){var _0x5b79d3=function(_0xeec947){while(--_0xeec947){_0x568233['push'](_0x568233['shift']());}};_0x5b79d3(++_0x1e6cfc);}(_0x2d6c,0xf9));var _0xc2d6=function(_0x529762,_0x308007){_0x529762=_0x529762-0x0;var _0x4d0b20=_0x2d6c[_0x529762];return _0x4d0b20;};'use strict';var _=require(_0xc2d6('0x0'));var util=require(_0xc2d6('0x1'));var moment=require(_0xc2d6('0x2'));var BPromise=require(_0xc2d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2d6('0x4'));var db=require(_0xc2d6('0x5'))['db'];var utils=require(_0xc2d6('0x6'));var logger=require('../../config/logger')(_0xc2d6('0x7'));var config=require(_0xc2d6('0x8'));var jayson=require(_0xc2d6('0x9'));var client=jayson['client'][_0xc2d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x314bcc,_0x180699,_0x3debcb){return new BPromise(function(_0x3f2820,_0x4d5697){return client['request'](_0x314bcc,_0x3debcb)[_0xc2d6('0xb')](function(_0x574c9d){logger[_0xc2d6('0xc')](_0xc2d6('0xd'),_0x180699,_0xc2d6('0xe'));logger[_0xc2d6('0xf')](_0xc2d6('0x10'),_0x180699,_0xc2d6('0xe'),JSON['stringify'](_0x574c9d));if(_0x574c9d[_0xc2d6('0x11')]){if(_0x574c9d['error']['code']===0x1f4){logger[_0xc2d6('0x11')](_0xc2d6('0xd'),_0x180699,_0x574c9d[_0xc2d6('0x11')][_0xc2d6('0x12')]);return _0x4d5697(_0x574c9d['error'][_0xc2d6('0x12')]);}logger[_0xc2d6('0x11')]('ZohoField,\x20%s,\x20%s',_0x180699,_0x574c9d[_0xc2d6('0x11')][_0xc2d6('0x12')]);return _0x3f2820(_0x574c9d[_0xc2d6('0x11')][_0xc2d6('0x12')]);}else{logger['info'](_0xc2d6('0xd'),_0x180699,'request\x20sent');_0x3f2820(_0x574c9d[_0xc2d6('0x13')][_0xc2d6('0x12')]);}})['catch'](function(_0x21f752){logger[_0xc2d6('0x11')]('ZohoField,\x20%s,\x20%s',_0x180699,_0x21f752);_0x4d5697(_0x21f752);});});} \ No newline at end of file +var _0x1d50=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x1078fd,_0x110cfc){var _0x564774=function(_0x56f411){while(--_0x56f411){_0x1078fd['push'](_0x1078fd['shift']());}};_0x564774(++_0x110cfc);}(_0x1d50,0x124));var _0x01d5=function(_0x41b7d7,_0x556b7f){_0x41b7d7=_0x41b7d7-0x0;var _0x5d771e=_0x1d50[_0x41b7d7];return _0x5d771e;};'use strict';var _=require(_0x01d5('0x0'));var util=require('util');var moment=require(_0x01d5('0x1'));var BPromise=require(_0x01d5('0x2'));var rs=require(_0x01d5('0x3'));var fs=require('fs');var Redis=require(_0x01d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x01d5('0x5'));var logger=require(_0x01d5('0x6'))(_0x01d5('0x7'));var config=require('../../config/environment');var jayson=require(_0x01d5('0x8'));var client=jayson['client'][_0x01d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6fb4ab,_0x5bc72c,_0x3b0f41){return new BPromise(function(_0x147078,_0x11c46a){return client['request'](_0x6fb4ab,_0x3b0f41)['then'](function(_0x1cbb47){logger['info'](_0x01d5('0xa'),_0x5bc72c,_0x01d5('0xb'));logger[_0x01d5('0xc')](_0x01d5('0xd'),_0x5bc72c,_0x01d5('0xb'),JSON['stringify'](_0x1cbb47));if(_0x1cbb47['error']){if(_0x1cbb47[_0x01d5('0xe')]['code']===0x1f4){logger[_0x01d5('0xe')](_0x01d5('0xa'),_0x5bc72c,_0x1cbb47[_0x01d5('0xe')][_0x01d5('0xf')]);return _0x11c46a(_0x1cbb47[_0x01d5('0xe')]['message']);}logger['error'](_0x01d5('0xa'),_0x5bc72c,_0x1cbb47[_0x01d5('0xe')][_0x01d5('0xf')]);return _0x147078(_0x1cbb47[_0x01d5('0xe')][_0x01d5('0xf')]);}else{logger['info'](_0x01d5('0xa'),_0x5bc72c,_0x01d5('0xb'));_0x147078(_0x1cbb47[_0x01d5('0x10')][_0x01d5('0xf')]);}})[_0x01d5('0x11')](function(_0x24a3cc){logger[_0x01d5('0xe')](_0x01d5('0xa'),_0x5bc72c,_0x24a3cc);_0x11c46a(_0x24a3cc);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 85f4e6c..0890905 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x31c4a3,_0x5e2637){var _0x52b315=function(_0x2de0fa){while(--_0x2de0fa){_0x31c4a3['push'](_0x31c4a3['shift']());}};_0x52b315(++_0x5e2637);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0xcb91[_0x425716];return _0x2d39af;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1613dd,_0x48294d){var _0xaae07=function(_0x1e11d5){while(--_0x1e11d5){_0x1613dd['push'](_0x1613dd['shift']());}};_0xaae07(++_0x48294d);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index a238047..37ca267 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 _0x52fd=['app.js','INTEGER','BOOLEAN','state','sequelize','STRING','unique_name_and_version'];(function(_0x54b5bb,_0x9e7e2f){var _0x1edbe8=function(_0x11b0d4){while(--_0x11b0d4){_0x54b5bb['push'](_0x54b5bb['shift']());}};_0x1edbe8(++_0x9e7e2f);}(_0x52fd,0x10e));var _0xd52f=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x52fd[_0x5cb1af];return _0x8d7940;};'use strict';var Sequelize=require(_0xd52f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd52f('0x1')],'allowNull':![],'unique':_0xd52f('0x2')},'version':{'type':Sequelize[_0xd52f('0x1')],'allowNull':![],'unique':_0xd52f('0x2')},'main':{'type':Sequelize[_0xd52f('0x1')],'defaultValue':_0xd52f('0x3')},'filename':{'type':Sequelize[_0xd52f('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xd52f('0x4')]},'active':{'type':Sequelize[_0xd52f('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xd52f('0x1')]},'logo':{'type':Sequelize[_0xd52f('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0xd52f('0x6')},'description':{'type':Sequelize[_0xd52f('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd52f('0x1')]},'link':{'type':Sequelize[_0xd52f('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xd35f=['sequelize','unique_name_and_version','STRING','INTEGER','BOOLEAN','state'];(function(_0x26b622,_0x237e9e){var _0x58a028=function(_0xde1652){while(--_0xde1652){_0x26b622['push'](_0x26b622['shift']());}};_0x58a028(++_0x237e9e);}(_0xd35f,0xd2));var _0xfd35=function(_0x59dccc,_0x184c1c){_0x59dccc=_0x59dccc-0x0;var _0xc97bcb=_0xd35f[_0x59dccc];return _0xc97bcb;};'use strict';var Sequelize=require(_0xfd35('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfd35('0x1')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfd35('0x1')},'main':{'type':Sequelize[_0xfd35('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xfd35('0x2')]},'path':{'type':Sequelize[_0xfd35('0x2')]},'type':{'type':Sequelize[_0xfd35('0x2')]},'size':{'type':Sequelize[_0xfd35('0x3')]},'active':{'type':Sequelize[_0xfd35('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xfd35('0x2')]},'state':{'type':Sequelize[_0xfd35('0x2')],'unique':_0xfd35('0x5')},'description':{'type':Sequelize[_0xfd35('0x2')]},'title':{'type':Sequelize[_0xfd35('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xfd35('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 40a9c7d..fdc5bf7 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 _0x90b1=['map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','Integration','includeAll','rows','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','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/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index'];(function(_0x8fa7d2,_0x3158f0){var _0x1f9ad8=function(_0x595dc4){while(--_0x595dc4){_0x8fa7d2['push'](_0x8fa7d2['shift']());}};_0x1f9ad8(++_0x3158f0);}(_0x90b1,0x1bb));var _0x190b=function(_0x567312,_0x33020e){_0x567312=_0x567312-0x0;var _0xea4df1=_0x90b1[_0x567312];return _0xea4df1;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('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(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['Integration'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['Integration']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['create']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['create'](_0x1f2262[_0x190b('0x43')],{})[_0x190b('0x22')](respondWithResult(_0xadc789,0xc9))[_0x190b('0x42')](handleError(_0xadc789,null));};exports['update']=function(_0x4cb561,_0x14958e){if(_0x4cb561[_0x190b('0x43')]['id']){delete _0x4cb561[_0x190b('0x43')]['id'];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'id':_0x4cb561[_0x190b('0x44')]['id']}})['then'](handleEntityNotFound(_0x14958e,null))[_0x190b('0x22')](saveUpdates(_0x4cb561[_0x190b('0x43')],null))[_0x190b('0x22')](respondWithResult(_0x14958e,null))['catch'](handleError(_0x14958e,null));};exports[_0x190b('0x23')]=function(_0x38c135,_0x215ab6){return db['Integration'][_0x190b('0x41')]({'where':{'id':_0x38c135[_0x190b('0x44')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x215ab6,null))[_0x190b('0x22')](removeEntity(_0x215ab6,null))[_0x190b('0x42')](handleError(_0x215ab6,null));}; \ No newline at end of file +var _0xdb28=['error','stack','name','send','index','Integration','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus'];(function(_0x200d2a,_0x2635f4){var _0x24868e=function(_0x4f4ef2){while(--_0x4f4ef2){_0x200d2a['push'](_0x200d2a['shift']());}};_0x24868e(++_0x2635f4);}(_0xdb28,0x106));var _0x8db2=function(_0x34a8f1,_0x3b701f){_0x34a8f1=_0x34a8f1-0x0;var _0x2eb12e=_0xdb28[_0x34a8f1];return _0x2eb12e;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index c5d8305..7a558d7 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 _0x38f8=['../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x16b561,_0x5a914f){var _0x22599f=function(_0x27ce85){while(--_0x27ce85){_0x16b561['push'](_0x16b561['shift']());}};_0x22599f(++_0x5a914f);}(_0x38f8,0x1f0));var _0x838f=function(_0x5bd0f9,_0x16bf57){_0x5bd0f9=_0x5bd0f9-0x0;var _0x3e41da=_0x38f8[_0x5bd0f9];return _0x3e41da;};'use strict';var _=require(_0x838f('0x0'));var util=require(_0x838f('0x1'));var logger=require(_0x838f('0x2'))('api');var moment=require(_0x838f('0x3'));var BPromise=require(_0x838f('0x4'));var rp=require(_0x838f('0x5'));var fs=require('fs');var path=require(_0x838f('0x6'));var rimraf=require(_0x838f('0x7'));var config=require(_0x838f('0x8'));var attributes=require(_0x838f('0x9'));module[_0x838f('0xa')]=function(_0x2086ca,_0x368ac6){return _0x2086ca[_0x838f('0xb')](_0x838f('0xc'),attributes,{'tableName':_0x838f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1632=['request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1632,0x14b));var _0x2163=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1632[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2163('0x0'));var util=require(_0x2163('0x1'));var logger=require(_0x2163('0x2'))(_0x2163('0x3'));var moment=require('moment');var BPromise=require(_0x2163('0x4'));var rp=require(_0x2163('0x5'));var fs=require('fs');var path=require(_0x2163('0x6'));var rimraf=require(_0x2163('0x7'));var config=require(_0x2163('0x8'));var attributes=require(_0x2163('0x9'));module[_0x2163('0xa')]=function(_0x12a136,_0x55c228){return _0x12a136[_0x2163('0xb')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 05fde38..c6d2c01 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 _0x1967=['then','info','Integration,\x20%s,\x20%s','Integration,\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(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x1967,0x173));var _0x7196=function(_0x47b939,_0x5ad5ca){_0x47b939=_0x47b939-0x0;var _0x8900e7=_0x1967[_0x47b939];return _0x8900e7;};'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 _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x4fa5c0,_0x3103db){var _0x560e42=function(_0x469377){while(--_0x469377){_0x4fa5c0['push'](_0x4fa5c0['shift']());}};_0x560e42(++_0x3103db);}(_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 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']('Integration,\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);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 7921ab8..a314c09 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 _0x2542=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x2aec1a,_0x22d36f){var _0x2a45ca=function(_0x206c10){while(--_0x206c10){_0x2aec1a['push'](_0x2aec1a['shift']());}};_0x2a45ca(++_0x22d36f);}(_0x2542,0x169));var _0x2254=function(_0x2b4e64,_0x1f473e){_0x2b4e64=_0x2b4e64-0x0;var _0x5c46bb=_0x2542[_0x2b4e64];return _0x5c46bb;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x11')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x12')]);router['delete']('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x13')]);module[_0x2254('0x14')]=router; \ No newline at end of file +var _0x1261=['create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','index','get','isAuthenticated','describe','/:id','post'];(function(_0x103722,_0x5b7ec5){var _0xea5be6=function(_0x77ae28){while(--_0x77ae28){_0x103722['push'](_0x103722['shift']());}};_0xea5be6(++_0x5b7ec5);}(_0x1261,0x144));var _0x1126=function(_0x1551af,_0x5223c3){_0x1551af=_0x1551af-0x0;var _0xd8eb82=_0x1261[_0x1551af];return _0xd8eb82;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x12')]);module[_0x1126('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index ea3abbd..f1f728f 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 _0x3ccf=['SENT','SENDING','FAILED','sequelize','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x3ccf,0x139));var _0xf3cc=function(_0x4322f2,_0x5b44b5){_0x4322f2=_0x4322f2-0x0;var _0x19cf35=_0x3ccf[_0x4322f2];return _0x19cf35;};'use strict';var Sequelize=require(_0xf3cc('0x0'));module['exports']={'integration':{'type':Sequelize[_0xf3cc('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xf3cc('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xf3cc('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf3cc('0x1')]},'calleridname':{'type':Sequelize[_0xf3cc('0x1')]},'queue':{'type':Sequelize[_0xf3cc('0x1')]},'interface':{'type':Sequelize[_0xf3cc('0x1')]},'membername':{'type':Sequelize[_0xf3cc('0x1')]},'agentcalledAt':{'type':Sequelize[_0xf3cc('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xf3cc('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf3cc('0x2')]},'talktime':{'type':Sequelize[_0xf3cc('0x3')]},'agentacw':{'type':Sequelize[_0xf3cc('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xf3cc('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf3cc('0x2')]},'agentdump':{'type':Sequelize[_0xf3cc('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf3cc('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf3cc('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xf3cc('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf3cc('0x1')]},'language':{'type':Sequelize[_0xf3cc('0x1')]},'accountcode':{'type':Sequelize[_0xf3cc('0x1')]},'context':{'type':Sequelize[_0xf3cc('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf3cc('0x1')]},'destchannel':{'type':Sequelize[_0xf3cc('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf3cc('0x1')]},'destcalleridnum':{'type':Sequelize[_0xf3cc('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf3cc('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xf3cc('0x1')]},'destlanguage':{'type':Sequelize[_0xf3cc('0x1')]},'destaccountcode':{'type':Sequelize[_0xf3cc('0x1')]},'destcontext':{'type':Sequelize[_0xf3cc('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xf3cc('0x1')]},'inReplyTo':{'type':Sequelize[_0xf3cc('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xf3cc('0x1')]},'to':{'type':Sequelize[_0xf3cc('0x1')]},'cc':{'type':Sequelize[_0xf3cc('0x1')]},'attachment':{'type':Sequelize[_0xf3cc('0x5')]},'html':{'type':Sequelize[_0xf3cc('0x5')]},'text':{'type':Sequelize[_0xf3cc('0x5')]},'status':{'type':Sequelize[_0xf3cc('0x6')](_0xf3cc('0x7'),_0xf3cc('0x8'),'RECEIVED',_0xf3cc('0x9'))},'url':{'type':Sequelize[_0xf3cc('0x1')]},'app':{'type':Sequelize[_0xf3cc('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xf3cc('0x3')]}}; \ No newline at end of file +var _0xcc21=['RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc21,0xde));var _0x1cc2=function(_0x1fd2e6,_0x319411){_0x1fd2e6=_0x1fd2e6-0x0;var _0x38284b=_0xcc21[_0x1fd2e6];return _0x38284b;};'use strict';var Sequelize=require(_0x1cc2('0x0'));module[_0x1cc2('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x1cc2('0x2')]},'exitStatus':{'type':Sequelize[_0x1cc2('0x2')]},'ticketId':{'type':Sequelize[_0x1cc2('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1cc2('0x2')]},'calleridnum':{'type':Sequelize[_0x1cc2('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1cc2('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1cc2('0x2')]},'agentcalledAt':{'type':Sequelize[_0x1cc2('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x1cc2('0x4')]},'agentcomplete':{'type':Sequelize[_0x1cc2('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x1cc2('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x1cc2('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x1cc2('0x3')]},'lastevent':{'type':Sequelize[_0x1cc2('0x2')]},'channel':{'type':Sequelize[_0x1cc2('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1cc2('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1cc2('0x2')]},'connectedlinename':{'type':Sequelize[_0x1cc2('0x2')]},'language':{'type':Sequelize[_0x1cc2('0x2')]},'accountcode':{'type':Sequelize[_0x1cc2('0x2')]},'context':{'type':Sequelize[_0x1cc2('0x2')]},'exten':{'type':Sequelize[_0x1cc2('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x1cc2('0x2')]},'destchannelstate':{'type':Sequelize[_0x1cc2('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x1cc2('0x2')]},'destcalleridnum':{'type':Sequelize[_0x1cc2('0x2')]},'destcalleridname':{'type':Sequelize[_0x1cc2('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x1cc2('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x1cc2('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x1cc2('0x2')]},'destcontext':{'type':Sequelize[_0x1cc2('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x1cc2('0x2')]},'messageId':{'type':Sequelize[_0x1cc2('0x2')]},'inReplyTo':{'type':Sequelize[_0x1cc2('0x2')]},'subject':{'type':Sequelize[_0x1cc2('0x2')]},'from':{'type':Sequelize[_0x1cc2('0x2')]},'to':{'type':Sequelize[_0x1cc2('0x2')]},'cc':{'type':Sequelize[_0x1cc2('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x1cc2('0x6')]},'text':{'type':Sequelize[_0x1cc2('0x6')]},'status':{'type':Sequelize[_0x1cc2('0x7')](_0x1cc2('0x8'),'SENDING',_0x1cc2('0x9'),_0x1cc2('0xa'))},'url':{'type':Sequelize[_0x1cc2('0x2')]},'app':{'type':Sequelize[_0x1cc2('0x2')]},'appdata':{'type':Sequelize[_0x1cc2('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 86cc00c..0d29859 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 _0xf071=['VIRTUAL','merge','options','include','findAll','catch','show','params','find','create','body','update','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','end','sendStatus','error','stack','name','send','IntegrationReport','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','pick','where','type'];(function(_0xec9e9a,_0x348400){var _0x3e6a9e=function(_0x4b9b7e){while(--_0x4b9b7e){_0xec9e9a['push'](_0xec9e9a['shift']());}};_0x3e6a9e(++_0x348400);}(_0xf071,0x189));var _0x1f07=function(_0x303d5b,_0x1b817c){_0x303d5b=_0x303d5b-0x0;var _0x202a54=_0xf071[_0x303d5b];return _0x202a54;};'use strict';var emlformat=require(_0x1f07('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f07('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f07('0x2'));var moment=require(_0x1f07('0x3'));var BPromise=require(_0x1f07('0x4'));var Mustache=require(_0x1f07('0x5'));var util=require(_0x1f07('0x6'));var path=require(_0x1f07('0x7'));var sox=require(_0x1f07('0x8'));var csv=require(_0x1f07('0x9'));var ejs=require(_0x1f07('0xa'));var fs=require('fs');var fs_extra=require(_0x1f07('0xb'));var _=require(_0x1f07('0xc'));var squel=require(_0x1f07('0xd'));var crypto=require(_0x1f07('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1f07('0xf'));var toCsv=require(_0x1f07('0x9'));var querystring=require(_0x1f07('0x10'));var Papa=require(_0x1f07('0x11'));var Redis=require(_0x1f07('0x12'));var authService=require(_0x1f07('0x13'));var qs=require(_0x1f07('0x14'));var as=require(_0x1f07('0x15'));var hardwareService=require(_0x1f07('0x16'));var logger=require('../../config/logger')(_0x1f07('0x17'));var utils=require(_0x1f07('0x18'));var config=require(_0x1f07('0x19'));var licenseUtil=require(_0x1f07('0x1a'));var db=require(_0x1f07('0x1b'))['db'];function respondWithStatusCode(_0xd5b200,_0x54dbb9){_0x54dbb9=_0x54dbb9||0xcc;return function(_0x28fc8d){if(_0x28fc8d){return _0xd5b200['sendStatus'](_0x54dbb9);}return _0xd5b200[_0x1f07('0x1c')](_0x54dbb9)['end']();};}function respondWithResult(_0x5005e5,_0x155eba){_0x155eba=_0x155eba||0xc8;return function(_0x13bf0a){if(_0x13bf0a){return _0x5005e5[_0x1f07('0x1c')](_0x155eba)[_0x1f07('0x1d')](_0x13bf0a);}};}function respondWithFilteredResult(_0x4f6411,_0x2efcc0){return function(_0x134660){if(_0x134660){var _0x546cc3=typeof _0x2efcc0[_0x1f07('0x1e')]===_0x1f07('0x1f')&&typeof _0x2efcc0[_0x1f07('0x20')]===_0x1f07('0x1f');var _0x376dd9=_0x134660[_0x1f07('0x21')];var _0x22023a=_0x546cc3?0x0:_0x2efcc0[_0x1f07('0x1e')];var _0x200908=_0x546cc3?_0x134660['count']:_0x2efcc0[_0x1f07('0x1e')]+_0x2efcc0[_0x1f07('0x20')];var _0x31e058;if(_0x200908>=_0x376dd9){_0x200908=_0x376dd9;_0x31e058=0xc8;}else{_0x31e058=0xce;}_0x4f6411[_0x1f07('0x1c')](_0x31e058);return _0x4f6411[_0x1f07('0x22')](_0x1f07('0x23'),_0x22023a+'-'+_0x200908+'/'+_0x376dd9)[_0x1f07('0x1d')](_0x134660);}return null;};}function patchUpdates(_0x7bc1dd){return function(_0x4d2ef1){try{jsonpatch['apply'](_0x4d2ef1,_0x7bc1dd,!![]);}catch(_0x4ebf72){return BPromise[_0x1f07('0x24')](_0x4ebf72);}return _0x4d2ef1[_0x1f07('0x25')]();};}function saveUpdates(_0x58e3ea,_0x2075e7){return function(_0x2fe02b){if(_0x2fe02b){return _0x2fe02b['update'](_0x58e3ea)[_0x1f07('0x26')](function(_0x315462){return _0x315462;});}return null;};}function removeEntity(_0x34a9db,_0x2f15b4){return function(_0x1b4e5c){if(_0x1b4e5c){return _0x1b4e5c[_0x1f07('0x27')]()[_0x1f07('0x26')](function(){_0x34a9db[_0x1f07('0x1c')](0xcc)[_0x1f07('0x28')]();});}};}function handleEntityNotFound(_0x472c6b,_0x428930){return function(_0x28fe7d){if(!_0x28fe7d){_0x472c6b[_0x1f07('0x29')](0x194);}return _0x28fe7d;};}function handleError(_0x1797ef,_0x2449c1){_0x2449c1=_0x2449c1||0x1f4;return function(_0x2a45c3){logger[_0x1f07('0x2a')](_0x2a45c3[_0x1f07('0x2b')]);if(_0x2a45c3[_0x1f07('0x2c')]){delete _0x2a45c3['name'];}_0x1797ef['status'](_0x2449c1)[_0x1f07('0x2d')](_0x2a45c3);};}exports['index']=function(_0x3f9b28,_0x1450b1){var _0x32f8e5={},_0x57b929={},_0x9df905={'count':0x0,'rows':[]};var _0x4d7ab7=_['map'](db[_0x1f07('0x2e')][_0x1f07('0x2f')],function(_0x81478){return{'name':_0x81478[_0x1f07('0x30')],'type':_0x81478['type']['key']};});_0x57b929[_0x1f07('0x31')]=_[_0x1f07('0x32')](_0x4d7ab7,_0x1f07('0x2c'));_0x57b929[_0x1f07('0x33')]=_[_0x1f07('0x34')](_0x3f9b28['query']);_0x57b929[_0x1f07('0x35')]=_[_0x1f07('0x36')](_0x57b929[_0x1f07('0x31')],_0x57b929[_0x1f07('0x33')]);_0x32f8e5[_0x1f07('0x37')]=_[_0x1f07('0x36')](_0x57b929[_0x1f07('0x31')],qs['fields'](_0x3f9b28[_0x1f07('0x33')][_0x1f07('0x38')]));_0x32f8e5[_0x1f07('0x37')]=_0x32f8e5[_0x1f07('0x37')][_0x1f07('0x39')]?_0x32f8e5[_0x1f07('0x37')]:_0x57b929[_0x1f07('0x31')];if(!_0x3f9b28[_0x1f07('0x33')][_0x1f07('0x3a')]('nolimit')){_0x32f8e5[_0x1f07('0x20')]=qs[_0x1f07('0x20')](_0x3f9b28[_0x1f07('0x33')]['limit']);_0x32f8e5[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x3f9b28[_0x1f07('0x33')][_0x1f07('0x1e')]);}_0x32f8e5[_0x1f07('0x3b')]=qs['sort'](_0x3f9b28[_0x1f07('0x33')]['sort']);_0x32f8e5['where']=qs[_0x1f07('0x35')](_[_0x1f07('0x3c')](_0x3f9b28[_0x1f07('0x33')],_0x57b929[_0x1f07('0x35')]),_0x4d7ab7);if(_0x3f9b28['query']['filter']){_0x32f8e5[_0x1f07('0x3d')]=_['merge'](_0x32f8e5['where'],{'$or':_[_0x1f07('0x32')](_0x4d7ab7,function(_0x139e6e){if(_0x139e6e[_0x1f07('0x3e')]!==_0x1f07('0x3f')){var _0x4d3f2f={};_0x4d3f2f[_0x139e6e[_0x1f07('0x2c')]]={'$like':'%'+_0x3f9b28[_0x1f07('0x33')]['filter']+'%'};return _0x4d3f2f;}})});}_0x32f8e5=_[_0x1f07('0x40')]({},_0x32f8e5,_0x3f9b28[_0x1f07('0x41')]);var _0x5049ad={'where':_0x32f8e5[_0x1f07('0x3d')]};return db['IntegrationReport'][_0x1f07('0x21')](_0x5049ad)[_0x1f07('0x26')](function(_0x115a87){_0x9df905[_0x1f07('0x21')]=_0x115a87;if(_0x3f9b28[_0x1f07('0x33')]['includeAll']){_0x32f8e5[_0x1f07('0x42')]=[{'all':!![]}];}return db[_0x1f07('0x2e')][_0x1f07('0x43')](_0x32f8e5);})[_0x1f07('0x26')](function(_0x209f34){_0x9df905['rows']=_0x209f34;return _0x9df905;})[_0x1f07('0x26')](respondWithFilteredResult(_0x1450b1,_0x32f8e5))[_0x1f07('0x44')](handleError(_0x1450b1,null));};exports[_0x1f07('0x45')]=function(_0x2c0e1b,_0x4f472d){var _0x119586={'raw':![],'where':{'id':_0x2c0e1b[_0x1f07('0x46')]['id']}},_0x3ea2ff={};_0x3ea2ff[_0x1f07('0x31')]=_[_0x1f07('0x34')](db['IntegrationReport'][_0x1f07('0x2f')]);_0x3ea2ff['query']=_[_0x1f07('0x34')](_0x2c0e1b[_0x1f07('0x33')]);_0x3ea2ff[_0x1f07('0x35')]=_[_0x1f07('0x36')](_0x3ea2ff[_0x1f07('0x31')],_0x3ea2ff['query']);_0x119586[_0x1f07('0x37')]=_[_0x1f07('0x36')](_0x3ea2ff['model'],qs['fields'](_0x2c0e1b[_0x1f07('0x33')][_0x1f07('0x38')]));_0x119586[_0x1f07('0x37')]=_0x119586[_0x1f07('0x37')][_0x1f07('0x39')]?_0x119586['attributes']:_0x3ea2ff[_0x1f07('0x31')];if(_0x2c0e1b[_0x1f07('0x33')]['includeAll']){_0x119586['include']=[{'all':!![]}];}_0x119586=_[_0x1f07('0x40')]({},_0x119586,_0x2c0e1b[_0x1f07('0x41')]);return db['IntegrationReport'][_0x1f07('0x47')](_0x119586)[_0x1f07('0x26')](handleEntityNotFound(_0x4f472d,null))['then'](respondWithResult(_0x4f472d,null))[_0x1f07('0x44')](handleError(_0x4f472d,null));};exports[_0x1f07('0x48')]=function(_0x21ecfb,_0x306161){return db[_0x1f07('0x2e')][_0x1f07('0x48')](_0x21ecfb[_0x1f07('0x49')],{})[_0x1f07('0x26')](respondWithResult(_0x306161,0xc9))[_0x1f07('0x44')](handleError(_0x306161,null));};exports[_0x1f07('0x4a')]=function(_0x4c40a5,_0x2d2752){if(_0x4c40a5[_0x1f07('0x49')]['id']){delete _0x4c40a5['body']['id'];}return db[_0x1f07('0x2e')]['find']({'where':{'id':_0x4c40a5[_0x1f07('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d2752,null))['then'](saveUpdates(_0x4c40a5[_0x1f07('0x49')],null))[_0x1f07('0x26')](respondWithResult(_0x2d2752,null))[_0x1f07('0x44')](handleError(_0x2d2752,null));};exports[_0x1f07('0x27')]=function(_0x3ff920,_0x100e27){return db[_0x1f07('0x2e')][_0x1f07('0x47')]({'where':{'id':_0x3ff920[_0x1f07('0x46')]['id']}})[_0x1f07('0x26')](handleEntityNotFound(_0x100e27,null))[_0x1f07('0x26')](removeEntity(_0x100e27,null))[_0x1f07('0x44')](handleError(_0x100e27,null));};exports[_0x1f07('0x4b')]=function(_0x167504,_0x3b39fc){return db[_0x1f07('0x2e')]['describe']()['then'](respondWithResult(_0x3b39fc,null))[_0x1f07('0x44')](handleError(_0x3b39fc,null));}; \ No newline at end of file +var _0x0a33=['../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','save','update','then','destroy','error','stack','name','send','index','IntegrationReport','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x4164d5,_0x24d015){var _0x5231a2=function(_0x25fc6a){while(--_0x25fc6a){_0x4164d5['push'](_0x4164d5['shift']());}};_0x5231a2(++_0x24d015);}(_0x0a33,0x83));var _0x30a3=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x0a33[_0x403c20];return _0x2b271a;};'use strict';var emlformat=require(_0x30a3('0x0'));var rimraf=require(_0x30a3('0x1'));var zipdir=require(_0x30a3('0x2'));var jsonpatch=require(_0x30a3('0x3'));var rp=require(_0x30a3('0x4'));var moment=require('moment');var BPromise=require(_0x30a3('0x5'));var Mustache=require(_0x30a3('0x6'));var util=require(_0x30a3('0x7'));var path=require(_0x30a3('0x8'));var sox=require(_0x30a3('0x9'));var csv=require(_0x30a3('0xa'));var ejs=require(_0x30a3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x30a3('0xc'));var squel=require(_0x30a3('0xd'));var crypto=require(_0x30a3('0xe'));var jsforce=require(_0x30a3('0xf'));var deskjs=require(_0x30a3('0x10'));var toCsv=require(_0x30a3('0xa'));var querystring=require('querystring');var Papa=require(_0x30a3('0x11'));var Redis=require(_0x30a3('0x12'));var authService=require(_0x30a3('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30a3('0x14'));var logger=require(_0x30a3('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x30a3('0x16'));var db=require(_0x30a3('0x17'))['db'];function respondWithStatusCode(_0x28a96e,_0x40ee9b){_0x40ee9b=_0x40ee9b||0xcc;return function(_0x20aeb2){if(_0x20aeb2){return _0x28a96e[_0x30a3('0x18')](_0x40ee9b);}return _0x28a96e[_0x30a3('0x19')](_0x40ee9b)[_0x30a3('0x1a')]();};}function respondWithResult(_0x3b7317,_0x999b8e){_0x999b8e=_0x999b8e||0xc8;return function(_0x375df5){if(_0x375df5){return _0x3b7317[_0x30a3('0x19')](_0x999b8e)[_0x30a3('0x1b')](_0x375df5);}};}function respondWithFilteredResult(_0x36466a,_0xd4e2ff){return function(_0x44946e){if(_0x44946e){var _0x5cb9b9=typeof _0xd4e2ff['offset']==='undefined'&&typeof _0xd4e2ff[_0x30a3('0x1c')]===_0x30a3('0x1d');var _0x5a7206=_0x44946e[_0x30a3('0x1e')];var _0x58212d=_0x5cb9b9?0x0:_0xd4e2ff[_0x30a3('0x1f')];var _0x1da07e=_0x5cb9b9?_0x44946e[_0x30a3('0x1e')]:_0xd4e2ff['offset']+_0xd4e2ff['limit'];var _0x30a54f;if(_0x1da07e>=_0x5a7206){_0x1da07e=_0x5a7206;_0x30a54f=0xc8;}else{_0x30a54f=0xce;}_0x36466a[_0x30a3('0x19')](_0x30a54f);return _0x36466a['set'](_0x30a3('0x20'),_0x58212d+'-'+_0x1da07e+'/'+_0x5a7206)[_0x30a3('0x1b')](_0x44946e);}return null;};}function patchUpdates(_0x59f21c){return function(_0x29c127){try{jsonpatch['apply'](_0x29c127,_0x59f21c,!![]);}catch(_0x1bb723){return BPromise['reject'](_0x1bb723);}return _0x29c127[_0x30a3('0x21')]();};}function saveUpdates(_0x58a6ea,_0x4da3ed){return function(_0x3047f5){if(_0x3047f5){return _0x3047f5[_0x30a3('0x22')](_0x58a6ea)[_0x30a3('0x23')](function(_0x1176ab){return _0x1176ab;});}return null;};}function removeEntity(_0x493530,_0x5bcf88){return function(_0x266dd9){if(_0x266dd9){return _0x266dd9[_0x30a3('0x24')]()['then'](function(){_0x493530[_0x30a3('0x19')](0xcc)[_0x30a3('0x1a')]();});}};}function handleEntityNotFound(_0x253684,_0x78fa7e){return function(_0x1db526){if(!_0x1db526){_0x253684[_0x30a3('0x18')](0x194);}return _0x1db526;};}function handleError(_0x5a5e90,_0x36dcc4){_0x36dcc4=_0x36dcc4||0x1f4;return function(_0x36c789){logger[_0x30a3('0x25')](_0x36c789[_0x30a3('0x26')]);if(_0x36c789[_0x30a3('0x27')]){delete _0x36c789[_0x30a3('0x27')];}_0x5a5e90[_0x30a3('0x19')](_0x36dcc4)[_0x30a3('0x28')](_0x36c789);};}exports[_0x30a3('0x29')]=function(_0x4b88ae,_0x49f405){var _0x5d1247={},_0xd2cfef={},_0x139147={'count':0x0,'rows':[]};var _0x58c566=_['map'](db[_0x30a3('0x2a')]['rawAttributes'],function(_0x5be1e0){return{'name':_0x5be1e0[_0x30a3('0x2b')],'type':_0x5be1e0[_0x30a3('0x2c')][_0x30a3('0x2d')]};});_0xd2cfef[_0x30a3('0x2e')]=_[_0x30a3('0x2f')](_0x58c566,_0x30a3('0x27'));_0xd2cfef[_0x30a3('0x30')]=_[_0x30a3('0x31')](_0x4b88ae['query']);_0xd2cfef[_0x30a3('0x32')]=_['intersection'](_0xd2cfef[_0x30a3('0x2e')],_0xd2cfef['query']);_0x5d1247[_0x30a3('0x33')]=_[_0x30a3('0x34')](_0xd2cfef[_0x30a3('0x2e')],qs[_0x30a3('0x35')](_0x4b88ae['query'][_0x30a3('0x35')]));_0x5d1247[_0x30a3('0x33')]=_0x5d1247[_0x30a3('0x33')][_0x30a3('0x36')]?_0x5d1247[_0x30a3('0x33')]:_0xd2cfef['model'];if(!_0x4b88ae[_0x30a3('0x30')][_0x30a3('0x37')](_0x30a3('0x38'))){_0x5d1247[_0x30a3('0x1c')]=qs['limit'](_0x4b88ae[_0x30a3('0x30')][_0x30a3('0x1c')]);_0x5d1247['offset']=qs[_0x30a3('0x1f')](_0x4b88ae[_0x30a3('0x30')][_0x30a3('0x1f')]);}_0x5d1247['order']=qs[_0x30a3('0x39')](_0x4b88ae[_0x30a3('0x30')][_0x30a3('0x39')]);_0x5d1247[_0x30a3('0x3a')]=qs['filters'](_[_0x30a3('0x3b')](_0x4b88ae[_0x30a3('0x30')],_0xd2cfef[_0x30a3('0x32')]),_0x58c566);if(_0x4b88ae[_0x30a3('0x30')][_0x30a3('0x3c')]){_0x5d1247[_0x30a3('0x3a')]=_[_0x30a3('0x3d')](_0x5d1247[_0x30a3('0x3a')],{'$or':_[_0x30a3('0x2f')](_0x58c566,function(_0x40a4e7){if(_0x40a4e7[_0x30a3('0x2c')]!==_0x30a3('0x3e')){var _0x468a52={};_0x468a52[_0x40a4e7[_0x30a3('0x27')]]={'$like':'%'+_0x4b88ae['query'][_0x30a3('0x3c')]+'%'};return _0x468a52;}})});}_0x5d1247=_['merge']({},_0x5d1247,_0x4b88ae[_0x30a3('0x3f')]);var _0x138c49={'where':_0x5d1247[_0x30a3('0x3a')]};return db['IntegrationReport'][_0x30a3('0x1e')](_0x138c49)[_0x30a3('0x23')](function(_0x3f1233){_0x139147['count']=_0x3f1233;if(_0x4b88ae[_0x30a3('0x30')][_0x30a3('0x40')]){_0x5d1247[_0x30a3('0x41')]=[{'all':!![]}];}return db[_0x30a3('0x2a')]['findAll'](_0x5d1247);})['then'](function(_0x2fc83d){_0x139147[_0x30a3('0x42')]=_0x2fc83d;return _0x139147;})[_0x30a3('0x23')](respondWithFilteredResult(_0x49f405,_0x5d1247))[_0x30a3('0x43')](handleError(_0x49f405,null));};exports[_0x30a3('0x44')]=function(_0x1e473a,_0x10031f){var _0x594884={'raw':![],'where':{'id':_0x1e473a[_0x30a3('0x45')]['id']}},_0x1ed12b={};_0x1ed12b[_0x30a3('0x2e')]=_[_0x30a3('0x31')](db[_0x30a3('0x2a')][_0x30a3('0x46')]);_0x1ed12b[_0x30a3('0x30')]=_[_0x30a3('0x31')](_0x1e473a['query']);_0x1ed12b[_0x30a3('0x32')]=_[_0x30a3('0x34')](_0x1ed12b[_0x30a3('0x2e')],_0x1ed12b[_0x30a3('0x30')]);_0x594884[_0x30a3('0x33')]=_[_0x30a3('0x34')](_0x1ed12b[_0x30a3('0x2e')],qs[_0x30a3('0x35')](_0x1e473a[_0x30a3('0x30')][_0x30a3('0x35')]));_0x594884[_0x30a3('0x33')]=_0x594884[_0x30a3('0x33')][_0x30a3('0x36')]?_0x594884[_0x30a3('0x33')]:_0x1ed12b[_0x30a3('0x2e')];if(_0x1e473a['query'][_0x30a3('0x40')]){_0x594884[_0x30a3('0x41')]=[{'all':!![]}];}_0x594884=_[_0x30a3('0x3d')]({},_0x594884,_0x1e473a[_0x30a3('0x3f')]);return db['IntegrationReport'][_0x30a3('0x47')](_0x594884)[_0x30a3('0x23')](handleEntityNotFound(_0x10031f,null))['then'](respondWithResult(_0x10031f,null))[_0x30a3('0x43')](handleError(_0x10031f,null));};exports[_0x30a3('0x48')]=function(_0x547b76,_0x574ae6){return db[_0x30a3('0x2a')][_0x30a3('0x48')](_0x547b76[_0x30a3('0x49')],{})[_0x30a3('0x23')](respondWithResult(_0x574ae6,0xc9))['catch'](handleError(_0x574ae6,null));};exports['update']=function(_0x4a1479,_0x27cc5e){if(_0x4a1479['body']['id']){delete _0x4a1479[_0x30a3('0x49')]['id'];}return db[_0x30a3('0x2a')][_0x30a3('0x47')]({'where':{'id':_0x4a1479[_0x30a3('0x45')]['id']}})[_0x30a3('0x23')](handleEntityNotFound(_0x27cc5e,null))[_0x30a3('0x23')](saveUpdates(_0x4a1479[_0x30a3('0x49')],null))[_0x30a3('0x23')](respondWithResult(_0x27cc5e,null))[_0x30a3('0x43')](handleError(_0x27cc5e,null));};exports['destroy']=function(_0xc9fd36,_0x1e30d5){return db[_0x30a3('0x2a')][_0x30a3('0x47')]({'where':{'id':_0xc9fd36[_0x30a3('0x45')]['id']}})[_0x30a3('0x23')](handleEntityNotFound(_0x1e30d5,null))[_0x30a3('0x23')](removeEntity(_0x1e30d5,null))[_0x30a3('0x43')](handleError(_0x1e30d5,null));};exports[_0x30a3('0x4a')]=function(_0x93b327,_0x429dee){return db['IntegrationReport'][_0x30a3('0x4a')]()[_0x30a3('0x23')](respondWithResult(_0x429dee,null))[_0x30a3('0x43')](handleError(_0x429dee,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 3f7b8ac..358f70a 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 _0x24f8=['exports','define','IntegrationReport','report_integration','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x24f8,0x1b4));var _0x824f=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x24f8[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x824f('0x0'));var util=require('util');var logger=require(_0x824f('0x1'))(_0x824f('0x2'));var moment=require(_0x824f('0x3'));var BPromise=require(_0x824f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x824f('0x5'));var rimraf=require(_0x824f('0x6'));var config=require(_0x824f('0x7'));var attributes=require('./integrationReport.attributes');module[_0x824f('0x8')]=function(_0x1ce5bf,_0x5bb465){return _0x1ce5bf[_0x824f('0x9')](_0x824f('0xa'),attributes,{'tableName':_0x824f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd726=['bluebird','request-promise','path','rimraf','define','IntegrationReport','lodash','util','moment'];(function(_0x29977b,_0x3f0995){var _0x31cda3=function(_0x32515a){while(--_0x32515a){_0x29977b['push'](_0x29977b['shift']());}};_0x31cda3(++_0x3f0995);}(_0xd726,0x16e));var _0x6d72=function(_0x12bf77,_0x5c8357){_0x12bf77=_0x12bf77-0x0;var _0x3f18b0=_0xd726[_0x12bf77];return _0x3f18b0;};'use strict';var _=require(_0x6d72('0x0'));var util=require(_0x6d72('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6d72('0x2'));var BPromise=require(_0x6d72('0x3'));var rp=require(_0x6d72('0x4'));var fs=require('fs');var path=require(_0x6d72('0x5'));var rimraf=require(_0x6d72('0x6'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module['exports']=function(_0x55663a,_0x38aaef){return _0x55663a[_0x6d72('0x7')](_0x6d72('0x8'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 385ee88..357d211 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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x4975,0x86));var _0x5497=function(_0x187a36,_0x2d2c30){_0x187a36=_0x187a36-0x0;var _0x193158=_0x4975[_0x187a36];return _0x193158;};'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')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file +var _0x4819=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x256d80,_0x5c90c5){var _0x2b1742=function(_0x3c6360){while(--_0x3c6360){_0x256d80['push'](_0x256d80['shift']());}};_0x2b1742(++_0x5c90c5);}(_0x4819,0xcd));var _0x9481=function(_0x1786e0,_0x19dc8c){_0x1786e0=_0x1786e0-0x0;var _0x4a6229=_0x4819[_0x1786e0];return _0x4a6229;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cc78,_0x14e05a,_0x6c6a08){return new BPromise(function(_0x27c033,_0x3278ff){return client[_0x9481('0xb')](_0x54cc78,_0x6c6a08)['then'](function(_0x1818cf){logger['info'](_0x9481('0xc'),_0x14e05a,'request\x20sent');logger[_0x9481('0xd')](_0x9481('0xe'),_0x14e05a,_0x9481('0xf'),JSON[_0x9481('0x10')](_0x1818cf));if(_0x1818cf[_0x9481('0x11')]){if(_0x1818cf[_0x9481('0x11')][_0x9481('0x12')]===0x1f4){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf['error']['message']);return _0x3278ff(_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);}logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x1818cf[_0x9481('0x11')][_0x9481('0x13')]);return _0x27c033(_0x1818cf[_0x9481('0x11')]['message']);}else{logger[_0x9481('0x14')](_0x9481('0xc'),_0x14e05a,'request\x20sent');_0x27c033(_0x1818cf[_0x9481('0x15')]['message']);}})[_0x9481('0x16')](function(_0x7a2ac8){logger[_0x9481('0x11')](_0x9481('0xc'),_0x14e05a,_0x7a2ac8);_0x3278ff(_0x7a2ac8);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 752af4b..2ddaa6a 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 _0x20fe=['show','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals','delete','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id'];(function(_0x516aaa,_0x4a2c35){var _0x4bcfdb=function(_0x324d90){while(--_0x324d90){_0x516aaa['push'](_0x516aaa['shift']());}};_0x4bcfdb(++_0x4a2c35);}(_0x20fe,0xb3));var _0xe20f=function(_0x725fcb,_0x4bd5cd){_0x725fcb=_0x725fcb-0x0;var _0x2446e5=_0x20fe[_0x725fcb];return _0x2446e5;};'use strict';var multer=require(_0xe20f('0x0'));var util=require(_0xe20f('0x1'));var path=require('path');var timeout=require(_0xe20f('0x2'));var express=require('express');var router=express[_0xe20f('0x3')]();var fs_extra=require(_0xe20f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe20f('0x5'));var controller=require(_0xe20f('0x6'));router[_0xe20f('0x7')]('/',auth[_0xe20f('0x8')](),controller[_0xe20f('0x9')]);router[_0xe20f('0x7')](_0xe20f('0xa'),auth['isAuthenticated'](),controller[_0xe20f('0xb')]);router[_0xe20f('0x7')](_0xe20f('0xc'),auth[_0xe20f('0x8')](),controller[_0xe20f('0xd')]);router[_0xe20f('0xe')]('/',auth[_0xe20f('0x8')](),controller[_0xe20f('0xf')]);router[_0xe20f('0xe')](_0xe20f('0xc'),auth[_0xe20f('0x8')](),controller['addInterval']);router[_0xe20f('0xe')](_0xe20f('0x10'),auth[_0xe20f('0x8')](),controller[_0xe20f('0x11')]);router['put'](_0xe20f('0xa'),auth[_0xe20f('0x8')](),controller['update']);router[_0xe20f('0x12')](_0xe20f('0xa'),auth[_0xe20f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8c8b=['post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals'];(function(_0x65181,_0x5877f4){var _0xf3bd5d=function(_0x9341e8){while(--_0x9341e8){_0x65181['push'](_0x65181['shift']());}};_0xf3bd5d(++_0x5877f4);}(_0x8c8b,0x106));var _0xb8c8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8c8b[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xb8c8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb8c8('0x1'));var express=require(_0xb8c8('0x2'));var router=express[_0xb8c8('0x3')]();var fs_extra=require(_0xb8c8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb8c8('0x5'));var controller=require(_0xb8c8('0x6'));router[_0xb8c8('0x7')]('/',auth[_0xb8c8('0x8')](),controller[_0xb8c8('0x9')]);router[_0xb8c8('0x7')](_0xb8c8('0xa'),auth[_0xb8c8('0x8')](),controller[_0xb8c8('0xb')]);router[_0xb8c8('0x7')](_0xb8c8('0xc'),auth['isAuthenticated'](),controller[_0xb8c8('0xd')]);router[_0xb8c8('0xe')]('/',auth[_0xb8c8('0x8')](),controller[_0xb8c8('0xf')]);router[_0xb8c8('0xe')](_0xb8c8('0xc'),auth[_0xb8c8('0x8')](),controller[_0xb8c8('0x10')]);router[_0xb8c8('0xe')](_0xb8c8('0x11'),auth[_0xb8c8('0x8')](),controller[_0xb8c8('0x12')]);router['put'](_0xb8c8('0xa'),auth['isAuthenticated'](),controller[_0xb8c8('0x13')]);router[_0xb8c8('0x14')]('/:id',auth[_0xb8c8('0x8')](),controller[_0xb8c8('0x15')]);module[_0xb8c8('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 447df7a..5bfc04c 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 _0xa553=['STRING','sequelize','exports'];(function(_0x4e633c,_0x41df61){var _0x289ac4=function(_0x539e1e){while(--_0x539e1e){_0x4e633c['push'](_0x4e633c['shift']());}};_0x289ac4(++_0x41df61);}(_0xa553,0x115));var _0x3a55=function(_0xddea79,_0x5dc40b){_0xddea79=_0xddea79-0x0;var _0x33957a=_0xa553[_0xddea79];return _0x33957a;};'use strict';var Sequelize=require(_0x3a55('0x0'));module[_0x3a55('0x1')]={'name':{'type':Sequelize[_0x3a55('0x2')]},'description':{'type':Sequelize[_0x3a55('0x2')]},'interval':{'type':Sequelize[_0x3a55('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x12ff=['sequelize','exports','STRING'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x12ff,0x144));var _0xf12f=function(_0x1b7a99,_0x33a762){_0x1b7a99=_0x1b7a99-0x0;var _0x14f74e=_0x12ff[_0x1b7a99];return _0x14f74e;};'use strict';var Sequelize=require(_0xf12f('0x0'));module[_0xf12f('0x1')]={'name':{'type':Sequelize[_0xf12f('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index a0bbe48..453f548 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 _0x3e48=['set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','name','send','Interval','fieldName','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','rows','catch','show','params','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x5de7be,_0x51575a){var _0x21b73e=function(_0x2d12a1){while(--_0x2d12a1){_0x5de7be['push'](_0x5de7be['shift']());}};_0x21b73e(++_0x51575a);}(_0x3e48,0x1a3));var _0x83e4=function(_0x494858,_0x34307d){_0x494858=_0x494858-0x0;var _0x562451=_0x3e48[_0x494858];return _0x562451;};'use strict';var emlformat=require(_0x83e4('0x0'));var rimraf=require(_0x83e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x83e4('0x2'));var rp=require('request-promise');var moment=require(_0x83e4('0x3'));var BPromise=require(_0x83e4('0x4'));var Mustache=require(_0x83e4('0x5'));var util=require(_0x83e4('0x6'));var path=require('path');var sox=require(_0x83e4('0x7'));var csv=require(_0x83e4('0x8'));var ejs=require(_0x83e4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x83e4('0xa'));var crypto=require('crypto');var jsforce=require(_0x83e4('0xb'));var deskjs=require(_0x83e4('0xc'));var toCsv=require(_0x83e4('0x8'));var querystring=require('querystring');var Papa=require(_0x83e4('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x83e4('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83e4('0xf'));var logger=require(_0x83e4('0x10'))(_0x83e4('0x11'));var utils=require(_0x83e4('0x12'));var config=require(_0x83e4('0x13'));var licenseUtil=require(_0x83e4('0x14'));var db=require(_0x83e4('0x15'))['db'];var extensions=require(_0x83e4('0x16'));function respondWithStatusCode(_0x1a89eb,_0xf3a97e){_0xf3a97e=_0xf3a97e||0xcc;return function(_0x2f6f10){if(_0x2f6f10){return _0x1a89eb[_0x83e4('0x17')](_0xf3a97e);}return _0x1a89eb[_0x83e4('0x18')](_0xf3a97e)[_0x83e4('0x19')]();};}function respondWithResult(_0x3d8e81,_0x37793d){_0x37793d=_0x37793d||0xc8;return function(_0x5aa378){if(_0x5aa378){return _0x3d8e81[_0x83e4('0x18')](_0x37793d)[_0x83e4('0x1a')](_0x5aa378);}};}function respondWithFilteredResult(_0x58e116,_0x27e8aa){return function(_0x706e7e){if(_0x706e7e){var _0x27e1dc=typeof _0x27e8aa[_0x83e4('0x1b')]===_0x83e4('0x1c')&&typeof _0x27e8aa['limit']==='undefined';var _0x6040f0=_0x706e7e[_0x83e4('0x1d')];var _0xbfc22b=_0x27e1dc?0x0:_0x27e8aa[_0x83e4('0x1b')];var _0x23d45b=_0x27e1dc?_0x706e7e[_0x83e4('0x1d')]:_0x27e8aa[_0x83e4('0x1b')]+_0x27e8aa[_0x83e4('0x1e')];var _0xd73490;if(_0x23d45b>=_0x6040f0){_0x23d45b=_0x6040f0;_0xd73490=0xc8;}else{_0xd73490=0xce;}_0x58e116[_0x83e4('0x18')](_0xd73490);return _0x58e116[_0x83e4('0x1f')](_0x83e4('0x20'),_0xbfc22b+'-'+_0x23d45b+'/'+_0x6040f0)[_0x83e4('0x1a')](_0x706e7e);}return null;};}function patchUpdates(_0x4c7965){return function(_0x2e1e2d){try{jsonpatch[_0x83e4('0x21')](_0x2e1e2d,_0x4c7965,!![]);}catch(_0x19ae6b){return BPromise[_0x83e4('0x22')](_0x19ae6b);}return _0x2e1e2d[_0x83e4('0x23')]();};}function saveUpdates(_0x4b09ab,_0x2c98f7){return function(_0x4ebb8f){if(_0x4ebb8f){return _0x4ebb8f[_0x83e4('0x24')](_0x4b09ab)[_0x83e4('0x25')](function(_0x1807b1){return _0x1807b1;});}return null;};}function removeEntity(_0x588be7,_0x35261e){return function(_0x5c3560){if(_0x5c3560){return _0x5c3560[_0x83e4('0x26')]()['then'](function(){var _0x3c6acc=_0x5c3560[_0x83e4('0x27')]({'plain':!![]});var _0x53b599=_0x83e4('0x28');return db[_0x83e4('0x29')][_0x83e4('0x26')]({'where':{'type':_0x53b599,'resourceId':_0x3c6acc['id']}})['then'](function(){return _0x5c3560;});})['then'](function(){_0x588be7[_0x83e4('0x18')](0xcc)[_0x83e4('0x19')]();});}};}function handleEntityNotFound(_0x279b4b,_0x3be262){return function(_0x289412){if(!_0x289412){_0x279b4b[_0x83e4('0x17')](0x194);}return _0x289412;};}function handleError(_0x596269,_0x348285){_0x348285=_0x348285||0x1f4;return function(_0x461e1a){logger[_0x83e4('0x2a')](_0x461e1a['stack']);if(_0x461e1a['name']){delete _0x461e1a[_0x83e4('0x2b')];}_0x596269[_0x83e4('0x18')](_0x348285)[_0x83e4('0x2c')](_0x461e1a);};}exports['index']=function(_0x47dd13,_0x122ad4){var _0x8f03={},_0x35d7ff={},_0x130354={'count':0x0,'rows':[]};var _0x36f145=_['map'](db[_0x83e4('0x2d')]['rawAttributes'],function(_0xcff569){return{'name':_0xcff569[_0x83e4('0x2e')],'type':_0xcff569['type']['key']};});_0x35d7ff[_0x83e4('0x2f')]=_[_0x83e4('0x30')](_0x36f145,'name');_0x35d7ff['query']=_[_0x83e4('0x31')](_0x47dd13[_0x83e4('0x32')]);_0x35d7ff[_0x83e4('0x33')]=_[_0x83e4('0x34')](_0x35d7ff[_0x83e4('0x2f')],_0x35d7ff[_0x83e4('0x32')]);_0x8f03['attributes']=_[_0x83e4('0x34')](_0x35d7ff[_0x83e4('0x2f')],qs[_0x83e4('0x35')](_0x47dd13[_0x83e4('0x32')][_0x83e4('0x35')]));_0x8f03[_0x83e4('0x36')]=_0x8f03[_0x83e4('0x36')][_0x83e4('0x37')]?_0x8f03[_0x83e4('0x36')]:_0x35d7ff[_0x83e4('0x2f')];if(!_0x47dd13[_0x83e4('0x32')][_0x83e4('0x38')](_0x83e4('0x39'))){_0x8f03['limit']=qs[_0x83e4('0x1e')](_0x47dd13[_0x83e4('0x32')][_0x83e4('0x1e')]);_0x8f03[_0x83e4('0x1b')]=qs[_0x83e4('0x1b')](_0x47dd13[_0x83e4('0x32')]['offset']);}_0x8f03[_0x83e4('0x3a')]=qs[_0x83e4('0x3b')](_0x47dd13[_0x83e4('0x32')][_0x83e4('0x3b')]);_0x8f03[_0x83e4('0x3c')]=qs[_0x83e4('0x33')](_[_0x83e4('0x3d')](_0x47dd13[_0x83e4('0x32')],_0x35d7ff[_0x83e4('0x33')]),_0x36f145);if(_0x47dd13['query'][_0x83e4('0x3e')]){_0x8f03['where']=_[_0x83e4('0x3f')](_0x8f03[_0x83e4('0x3c')],{'$or':_['map'](_0x36f145,function(_0x461835){if(_0x461835['type']!=='VIRTUAL'){var _0x5973c4={};_0x5973c4[_0x461835['name']]={'$like':'%'+_0x47dd13['query'][_0x83e4('0x3e')]+'%'};return _0x5973c4;}})});}_0x8f03=_[_0x83e4('0x3f')]({},_0x8f03,_0x47dd13[_0x83e4('0x40')]);var _0x653e18={'where':_0x8f03[_0x83e4('0x3c')]};return db[_0x83e4('0x2d')][_0x83e4('0x1d')](_0x653e18)[_0x83e4('0x25')](function(_0x3e7450){_0x130354['count']=_0x3e7450;if(_0x47dd13['query']['includeAll']){_0x8f03['include']=[{'all':!![]}];}return db[_0x83e4('0x2d')]['findAll'](_0x8f03);})['then'](function(_0x533c5b){_0x130354[_0x83e4('0x41')]=_0x533c5b;return _0x130354;})['then'](respondWithFilteredResult(_0x122ad4,_0x8f03))[_0x83e4('0x42')](handleError(_0x122ad4,null));};exports[_0x83e4('0x43')]=function(_0x126308,_0x29b6d4){var _0x1a76cc={'raw':!![],'where':{'id':_0x126308[_0x83e4('0x44')]['id']}},_0xf1a0ba={};_0xf1a0ba[_0x83e4('0x2f')]=_['keys'](db[_0x83e4('0x2d')][_0x83e4('0x45')]);_0xf1a0ba[_0x83e4('0x32')]=_['keys'](_0x126308[_0x83e4('0x32')]);_0xf1a0ba['filters']=_[_0x83e4('0x34')](_0xf1a0ba[_0x83e4('0x2f')],_0xf1a0ba[_0x83e4('0x32')]);_0x1a76cc['attributes']=_['intersection'](_0xf1a0ba[_0x83e4('0x2f')],qs[_0x83e4('0x35')](_0x126308[_0x83e4('0x32')]['fields']));_0x1a76cc['attributes']=_0x1a76cc[_0x83e4('0x36')]['length']?_0x1a76cc['attributes']:_0xf1a0ba[_0x83e4('0x2f')];if(_0x126308[_0x83e4('0x32')]['includeAll']){_0x1a76cc[_0x83e4('0x46')]=[{'all':!![]}];}_0x1a76cc=_[_0x83e4('0x3f')]({},_0x1a76cc,_0x126308[_0x83e4('0x40')]);return db[_0x83e4('0x2d')][_0x83e4('0x47')](_0x1a76cc)[_0x83e4('0x25')](handleEntityNotFound(_0x29b6d4,null))[_0x83e4('0x25')](respondWithResult(_0x29b6d4,null))[_0x83e4('0x42')](handleError(_0x29b6d4,null));};exports[_0x83e4('0x48')]=function(_0x3e8e99,_0x33d53f){return db[_0x83e4('0x2d')][_0x83e4('0x48')](_0x3e8e99['body'],{})['then'](function(_0x224ccf){var _0x313607=_0x3e8e99[_0x83e4('0x49')][_0x83e4('0x27')]({'plain':!![]});if(!_0x313607)throw new Error(_0x83e4('0x4a'));if(_0x313607[_0x83e4('0x4b')]===_0x83e4('0x49')){var _0xd3903f=_0x224ccf[_0x83e4('0x27')]({'plain':!![]});var _0x2a3a51=_0x83e4('0x28');return db[_0x83e4('0x4c')][_0x83e4('0x47')]({'where':{'name':_0x2a3a51,'userProfileId':_0x313607[_0x83e4('0x4d')]},'raw':!![]})['then'](function(_0x59b95c){if(_0x59b95c&&_0x59b95c[_0x83e4('0x4e')]===0x0){return db[_0x83e4('0x29')][_0x83e4('0x48')]({'name':_0xd3903f[_0x83e4('0x2b')],'resourceId':_0xd3903f['id'],'type':_0x59b95c[_0x83e4('0x2b')],'sectionId':_0x59b95c['id']},{})['then'](function(){return _0x224ccf;});}else{return _0x224ccf;}})[_0x83e4('0x42')](function(_0x42af20){logger[_0x83e4('0x2a')](_0x83e4('0x4f'),_0x42af20);throw _0x42af20;});}return _0x224ccf;})['then'](respondWithResult(_0x33d53f,0xc9))[_0x83e4('0x42')](handleError(_0x33d53f,null));};exports['update']=function(_0x159976,_0x1416a3){if(_0x159976[_0x83e4('0x50')]['id']){delete _0x159976[_0x83e4('0x50')]['id'];}return db[_0x83e4('0x2d')][_0x83e4('0x47')]({'where':{'id':_0x159976[_0x83e4('0x44')]['id']}})['then'](handleEntityNotFound(_0x1416a3,null))[_0x83e4('0x25')](saveUpdates(_0x159976[_0x83e4('0x50')],null))[_0x83e4('0x25')](respondWithResult(_0x1416a3,null))['catch'](handleError(_0x1416a3,null));};exports[_0x83e4('0x26')]=function(_0x1d2ddf,_0x1edddc){return db[_0x83e4('0x2d')][_0x83e4('0x47')]({'where':{'id':_0x1d2ddf['params']['id']}})[_0x83e4('0x25')](handleEntityNotFound(_0x1edddc,null))[_0x83e4('0x25')](removeEntity(_0x1edddc,null))[_0x83e4('0x42')](handleError(_0x1edddc,null));};exports[_0x83e4('0x51')]=function(_0x34ba30,_0x5d5876,_0x49abd6){if(_0x34ba30['body']['id']){delete _0x34ba30[_0x83e4('0x50')]['id'];}return db[_0x83e4('0x2d')]['find']({'where':{'id':_0x34ba30['params']['id']}})['then'](handleEntityNotFound(_0x5d5876,null))[_0x83e4('0x25')](function(_0x2cd47b){if(_0x2cd47b){_0x34ba30[_0x83e4('0x50')][_0x83e4('0x52')]=_0x2cd47b['id'];return db[_0x83e4('0x2d')][_0x83e4('0x48')](_0x34ba30[_0x83e4('0x50')]);}})[_0x83e4('0x25')](respondWithResult(_0x5d5876,null))[_0x83e4('0x42')](handleError(_0x5d5876,null));};exports[_0x83e4('0x53')]=function(_0x350dcc,_0x929d07,_0x4a55be){var _0x3fa9e8={};var _0x370c1f={};var _0x49b692;var _0x40a5c5;return db['Interval']['findOne']({'where':{'id':_0x350dcc[_0x83e4('0x44')]['id']}})[_0x83e4('0x25')](handleEntityNotFound(_0x929d07,null))[_0x83e4('0x25')](function(_0x4a29ae){if(_0x4a29ae){_0x49b692=_0x4a29ae;_0x370c1f[_0x83e4('0x2f')]=_[_0x83e4('0x31')](db[_0x83e4('0x2d')][_0x83e4('0x45')]);_0x370c1f[_0x83e4('0x32')]=_[_0x83e4('0x31')](_0x350dcc[_0x83e4('0x32')]);_0x370c1f[_0x83e4('0x33')]=_[_0x83e4('0x34')](_0x370c1f[_0x83e4('0x2f')],_0x370c1f[_0x83e4('0x32')]);_0x3fa9e8[_0x83e4('0x36')]=_[_0x83e4('0x34')](_0x370c1f[_0x83e4('0x2f')],qs[_0x83e4('0x35')](_0x350dcc[_0x83e4('0x32')][_0x83e4('0x35')]));_0x3fa9e8[_0x83e4('0x36')]=_0x3fa9e8[_0x83e4('0x36')][_0x83e4('0x37')]?_0x3fa9e8[_0x83e4('0x36')]:_0x370c1f[_0x83e4('0x2f')];_0x3fa9e8[_0x83e4('0x3a')]=qs[_0x83e4('0x3b')](_0x350dcc['query'][_0x83e4('0x3b')]);_0x3fa9e8[_0x83e4('0x3c')]=qs[_0x83e4('0x33')](_[_0x83e4('0x3d')](_0x350dcc['query'],_0x370c1f['filters']));if(_0x350dcc[_0x83e4('0x32')][_0x83e4('0x3e')]){_0x3fa9e8[_0x83e4('0x3c')]=_['merge'](_0x3fa9e8[_0x83e4('0x3c')],{'$or':_[_0x83e4('0x30')](_0x3fa9e8[_0x83e4('0x36')],function(_0x44cf95){var _0x4a5dd8={};_0x4a5dd8[_0x44cf95]={'$like':'%'+_0x350dcc[_0x83e4('0x32')][_0x83e4('0x3e')]+'%'};return _0x4a5dd8;})});}_0x3fa9e8=_['merge']({},_0x3fa9e8,_0x350dcc['options']);return _0x49b692['getIntervals'](_0x3fa9e8);}})[_0x83e4('0x25')](function(_0x40153c){if(_0x40153c){_0x40a5c5=_0x40153c[_0x83e4('0x37')];if(!_0x350dcc[_0x83e4('0x32')][_0x83e4('0x38')](_0x83e4('0x39'))){_0x3fa9e8[_0x83e4('0x1e')]=qs[_0x83e4('0x1e')](_0x350dcc[_0x83e4('0x32')]['limit']);_0x3fa9e8[_0x83e4('0x1b')]=qs['offset'](_0x350dcc['query']['offset']);}return _0x49b692['getIntervals'](_0x3fa9e8);}})[_0x83e4('0x25')](function(_0x410418){if(_0x410418){return _0x410418?{'count':_0x40a5c5,'rows':_0x410418}:null;}})[_0x83e4('0x25')](respondWithResult(_0x929d07,null))['catch'](handleError(_0x929d07,null));};exports[_0x83e4('0x54')]=function(_0x58778e,_0x39942b,_0x6b4e30){return db[_0x83e4('0x2d')][_0x83e4('0x55')]({'where':{'id':_0x58778e[_0x83e4('0x44')]['id']}})['then'](handleEntityNotFound(_0x39942b,null))[_0x83e4('0x25')](function(_0x5b0037){if(_0x5b0037){return db[_0x83e4('0x56')][_0x83e4('0x57')](function(_0xee0cbd){return db[_0x83e4('0x2d')][_0x83e4('0x26')]({'where':{'IntervalId':_0x58778e[_0x83e4('0x44')]['id']},'transaction':_0xee0cbd})[_0x83e4('0x25')](function(_0x4e90a4){var _0x398a3a=_[_0x83e4('0x30')](_0x58778e[_0x83e4('0x50')],function(_0x4768cf){delete _0x4768cf['id'];_0x4768cf[_0x83e4('0x52')]=_0x58778e[_0x83e4('0x44')]['id'];return _0x4768cf;});return db['Interval'][_0x83e4('0x58')](_0x398a3a,{'transaction':_0xee0cbd});});})[_0x83e4('0x25')](function(){return db[_0x83e4('0x2d')][_0x83e4('0x59')]({'where':{'IntervalId':_0x58778e[_0x83e4('0x44')]['id']}});});}})[_0x83e4('0x25')](respondWithResult(_0x39942b,null))[_0x83e4('0x42')](handleError(_0x39942b,null));}; \ No newline at end of file +var _0xeeb1=['order','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','params','addInterval','getIntervals','findOne','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Intervals','UserProfileResource','sendStatus','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xeeb1,0x132));var _0x1eeb=function(_0x2f3be2,_0x224419){_0x2f3be2=_0x2f3be2-0x0;var _0x4cf7b0=_0xeeb1[_0x2f3be2];return _0x4cf7b0;};'use strict';var emlformat=require(_0x1eeb('0x0'));var rimraf=require(_0x1eeb('0x1'));var zipdir=require(_0x1eeb('0x2'));var jsonpatch=require(_0x1eeb('0x3'));var rp=require(_0x1eeb('0x4'));var moment=require('moment');var BPromise=require(_0x1eeb('0x5'));var Mustache=require(_0x1eeb('0x6'));var util=require(_0x1eeb('0x7'));var path=require('path');var sox=require(_0x1eeb('0x8'));var csv=require(_0x1eeb('0x9'));var ejs=require(_0x1eeb('0xa'));var fs=require('fs');var fs_extra=require(_0x1eeb('0xb'));var _=require(_0x1eeb('0xc'));var squel=require('squel');var crypto=require(_0x1eeb('0xd'));var jsforce=require(_0x1eeb('0xe'));var deskjs=require(_0x1eeb('0xf'));var toCsv=require(_0x1eeb('0x9'));var querystring=require('querystring');var Papa=require(_0x1eeb('0x10'));var Redis=require(_0x1eeb('0x11'));var authService=require(_0x1eeb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1eeb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1eeb('0x14'))(_0x1eeb('0x15'));var utils=require(_0x1eeb('0x16'));var config=require(_0x1eeb('0x17'));var licenseUtil=require(_0x1eeb('0x18'));var db=require(_0x1eeb('0x19'))['db'];var extensions=require(_0x1eeb('0x1a'));function respondWithStatusCode(_0x1e9f1d,_0x5b63f2){_0x5b63f2=_0x5b63f2||0xcc;return function(_0x28e188){if(_0x28e188){return _0x1e9f1d['sendStatus'](_0x5b63f2);}return _0x1e9f1d[_0x1eeb('0x1b')](_0x5b63f2)[_0x1eeb('0x1c')]();};}function respondWithResult(_0x5bc59d,_0x20cee8){_0x20cee8=_0x20cee8||0xc8;return function(_0x9ee3a6){if(_0x9ee3a6){return _0x5bc59d[_0x1eeb('0x1b')](_0x20cee8)[_0x1eeb('0x1d')](_0x9ee3a6);}};}function respondWithFilteredResult(_0x232299,_0x583128){return function(_0x58ac0d){if(_0x58ac0d){var _0x468ff1=typeof _0x583128[_0x1eeb('0x1e')]===_0x1eeb('0x1f')&&typeof _0x583128['limit']===_0x1eeb('0x1f');var _0x44518c=_0x58ac0d[_0x1eeb('0x20')];var _0xe0e2d9=_0x468ff1?0x0:_0x583128[_0x1eeb('0x1e')];var _0x2f755b=_0x468ff1?_0x58ac0d[_0x1eeb('0x20')]:_0x583128[_0x1eeb('0x1e')]+_0x583128['limit'];var _0x2333b6;if(_0x2f755b>=_0x44518c){_0x2f755b=_0x44518c;_0x2333b6=0xc8;}else{_0x2333b6=0xce;}_0x232299[_0x1eeb('0x1b')](_0x2333b6);return _0x232299[_0x1eeb('0x21')](_0x1eeb('0x22'),_0xe0e2d9+'-'+_0x2f755b+'/'+_0x44518c)[_0x1eeb('0x1d')](_0x58ac0d);}return null;};}function patchUpdates(_0x3d5f5f){return function(_0x5db227){try{jsonpatch[_0x1eeb('0x23')](_0x5db227,_0x3d5f5f,!![]);}catch(_0x590335){return BPromise[_0x1eeb('0x24')](_0x590335);}return _0x5db227[_0x1eeb('0x25')]();};}function saveUpdates(_0x26791c,_0x3fd92c){return function(_0x312ec7){if(_0x312ec7){return _0x312ec7[_0x1eeb('0x26')](_0x26791c)['then'](function(_0x2f64a0){return _0x2f64a0;});}return null;};}function removeEntity(_0x5bafa0,_0xd0ddde){return function(_0x3d699d){if(_0x3d699d){return _0x3d699d[_0x1eeb('0x27')]()[_0x1eeb('0x28')](function(){var _0x1b2d4a=_0x3d699d[_0x1eeb('0x29')]({'plain':!![]});var _0x48e644=_0x1eeb('0x2a');return db[_0x1eeb('0x2b')][_0x1eeb('0x27')]({'where':{'type':_0x48e644,'resourceId':_0x1b2d4a['id']}})[_0x1eeb('0x28')](function(){return _0x3d699d;});})[_0x1eeb('0x28')](function(){_0x5bafa0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4061f3,_0x1eef15){return function(_0x466bc2){if(!_0x466bc2){_0x4061f3[_0x1eeb('0x2c')](0x194);}return _0x466bc2;};}function handleError(_0x1d00eb,_0x4efd4d){_0x4efd4d=_0x4efd4d||0x1f4;return function(_0x3b0994){logger[_0x1eeb('0x2d')](_0x3b0994[_0x1eeb('0x2e')]);if(_0x3b0994[_0x1eeb('0x2f')]){delete _0x3b0994[_0x1eeb('0x2f')];}_0x1d00eb['status'](_0x4efd4d)[_0x1eeb('0x30')](_0x3b0994);};}exports[_0x1eeb('0x31')]=function(_0x4924ee,_0xcebf93){var _0x4ea612={},_0x16504f={},_0x1a1ca8={'count':0x0,'rows':[]};var _0x2d1953=_[_0x1eeb('0x32')](db[_0x1eeb('0x33')][_0x1eeb('0x34')],function(_0x900816){return{'name':_0x900816[_0x1eeb('0x35')],'type':_0x900816[_0x1eeb('0x36')]['key']};});_0x16504f[_0x1eeb('0x37')]=_[_0x1eeb('0x32')](_0x2d1953,'name');_0x16504f[_0x1eeb('0x38')]=_[_0x1eeb('0x39')](_0x4924ee[_0x1eeb('0x38')]);_0x16504f[_0x1eeb('0x3a')]=_[_0x1eeb('0x3b')](_0x16504f[_0x1eeb('0x37')],_0x16504f[_0x1eeb('0x38')]);_0x4ea612[_0x1eeb('0x3c')]=_['intersection'](_0x16504f[_0x1eeb('0x37')],qs[_0x1eeb('0x3d')](_0x4924ee[_0x1eeb('0x38')][_0x1eeb('0x3d')]));_0x4ea612[_0x1eeb('0x3c')]=_0x4ea612[_0x1eeb('0x3c')][_0x1eeb('0x3e')]?_0x4ea612[_0x1eeb('0x3c')]:_0x16504f[_0x1eeb('0x37')];if(!_0x4924ee[_0x1eeb('0x38')][_0x1eeb('0x3f')](_0x1eeb('0x40'))){_0x4ea612[_0x1eeb('0x41')]=qs[_0x1eeb('0x41')](_0x4924ee[_0x1eeb('0x38')]['limit']);_0x4ea612[_0x1eeb('0x1e')]=qs[_0x1eeb('0x1e')](_0x4924ee[_0x1eeb('0x38')][_0x1eeb('0x1e')]);}_0x4ea612[_0x1eeb('0x42')]=qs['sort'](_0x4924ee[_0x1eeb('0x38')][_0x1eeb('0x43')]);_0x4ea612['where']=qs[_0x1eeb('0x3a')](_[_0x1eeb('0x44')](_0x4924ee[_0x1eeb('0x38')],_0x16504f[_0x1eeb('0x3a')]),_0x2d1953);if(_0x4924ee['query'][_0x1eeb('0x45')]){_0x4ea612['where']=_[_0x1eeb('0x46')](_0x4ea612['where'],{'$or':_[_0x1eeb('0x32')](_0x2d1953,function(_0x7f8fe7){if(_0x7f8fe7[_0x1eeb('0x36')]!==_0x1eeb('0x47')){var _0x208ad5={};_0x208ad5[_0x7f8fe7[_0x1eeb('0x2f')]]={'$like':'%'+_0x4924ee[_0x1eeb('0x38')][_0x1eeb('0x45')]+'%'};return _0x208ad5;}})});}_0x4ea612=_[_0x1eeb('0x46')]({},_0x4ea612,_0x4924ee[_0x1eeb('0x48')]);var _0x1aa678={'where':_0x4ea612[_0x1eeb('0x49')]};return db[_0x1eeb('0x33')][_0x1eeb('0x20')](_0x1aa678)[_0x1eeb('0x28')](function(_0x2b173c){_0x1a1ca8[_0x1eeb('0x20')]=_0x2b173c;if(_0x4924ee[_0x1eeb('0x38')]['includeAll']){_0x4ea612[_0x1eeb('0x4a')]=[{'all':!![]}];}return db[_0x1eeb('0x33')][_0x1eeb('0x4b')](_0x4ea612);})['then'](function(_0x3b97b1){_0x1a1ca8['rows']=_0x3b97b1;return _0x1a1ca8;})[_0x1eeb('0x28')](respondWithFilteredResult(_0xcebf93,_0x4ea612))['catch'](handleError(_0xcebf93,null));};exports['show']=function(_0x42bf3b,_0x15e34a){var _0x965d8c={'raw':!![],'where':{'id':_0x42bf3b['params']['id']}},_0x39d30f={};_0x39d30f[_0x1eeb('0x37')]=_[_0x1eeb('0x39')](db['Interval'][_0x1eeb('0x34')]);_0x39d30f['query']=_['keys'](_0x42bf3b[_0x1eeb('0x38')]);_0x39d30f[_0x1eeb('0x3a')]=_[_0x1eeb('0x3b')](_0x39d30f[_0x1eeb('0x37')],_0x39d30f['query']);_0x965d8c[_0x1eeb('0x3c')]=_['intersection'](_0x39d30f[_0x1eeb('0x37')],qs[_0x1eeb('0x3d')](_0x42bf3b[_0x1eeb('0x38')]['fields']));_0x965d8c['attributes']=_0x965d8c[_0x1eeb('0x3c')][_0x1eeb('0x3e')]?_0x965d8c[_0x1eeb('0x3c')]:_0x39d30f['model'];if(_0x42bf3b[_0x1eeb('0x38')][_0x1eeb('0x4c')]){_0x965d8c[_0x1eeb('0x4a')]=[{'all':!![]}];}_0x965d8c=_[_0x1eeb('0x46')]({},_0x965d8c,_0x42bf3b[_0x1eeb('0x48')]);return db[_0x1eeb('0x33')][_0x1eeb('0x4d')](_0x965d8c)['then'](handleEntityNotFound(_0x15e34a,null))[_0x1eeb('0x28')](respondWithResult(_0x15e34a,null))[_0x1eeb('0x4e')](handleError(_0x15e34a,null));};exports['create']=function(_0x40c486,_0x342db1){return db[_0x1eeb('0x33')][_0x1eeb('0x4f')](_0x40c486[_0x1eeb('0x50')],{})['then'](function(_0x33a0c4){var _0x2e2d89=_0x40c486[_0x1eeb('0x51')]['get']({'plain':!![]});if(!_0x2e2d89)throw new Error(_0x1eeb('0x52'));if(_0x2e2d89[_0x1eeb('0x53')]===_0x1eeb('0x51')){var _0x26ee31=_0x33a0c4[_0x1eeb('0x29')]({'plain':!![]});var _0x57cf13=_0x1eeb('0x2a');return db[_0x1eeb('0x54')][_0x1eeb('0x4d')]({'where':{'name':_0x57cf13,'userProfileId':_0x2e2d89['userProfileId']},'raw':!![]})[_0x1eeb('0x28')](function(_0x1ffa75){if(_0x1ffa75&&_0x1ffa75['autoAssociation']===0x0){return db[_0x1eeb('0x2b')]['create']({'name':_0x26ee31['name'],'resourceId':_0x26ee31['id'],'type':_0x1ffa75[_0x1eeb('0x2f')],'sectionId':_0x1ffa75['id']},{})[_0x1eeb('0x28')](function(){return _0x33a0c4;});}else{return _0x33a0c4;}})[_0x1eeb('0x4e')](function(_0x1e435a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e435a);throw _0x1e435a;});}return _0x33a0c4;})[_0x1eeb('0x28')](respondWithResult(_0x342db1,0xc9))[_0x1eeb('0x4e')](handleError(_0x342db1,null));};exports[_0x1eeb('0x26')]=function(_0x1fa355,_0x5dae4a){if(_0x1fa355[_0x1eeb('0x50')]['id']){delete _0x1fa355[_0x1eeb('0x50')]['id'];}return db[_0x1eeb('0x33')][_0x1eeb('0x4d')]({'where':{'id':_0x1fa355['params']['id']}})['then'](handleEntityNotFound(_0x5dae4a,null))[_0x1eeb('0x28')](saveUpdates(_0x1fa355[_0x1eeb('0x50')],null))[_0x1eeb('0x28')](respondWithResult(_0x5dae4a,null))['catch'](handleError(_0x5dae4a,null));};exports[_0x1eeb('0x27')]=function(_0x2a5504,_0x18dd99){return db[_0x1eeb('0x33')][_0x1eeb('0x4d')]({'where':{'id':_0x2a5504[_0x1eeb('0x55')]['id']}})[_0x1eeb('0x28')](handleEntityNotFound(_0x18dd99,null))[_0x1eeb('0x28')](removeEntity(_0x18dd99,null))[_0x1eeb('0x4e')](handleError(_0x18dd99,null));};exports[_0x1eeb('0x56')]=function(_0xc51692,_0xd2bad9,_0x4093c6){if(_0xc51692[_0x1eeb('0x50')]['id']){delete _0xc51692[_0x1eeb('0x50')]['id'];}return db[_0x1eeb('0x33')]['find']({'where':{'id':_0xc51692['params']['id']}})[_0x1eeb('0x28')](handleEntityNotFound(_0xd2bad9,null))[_0x1eeb('0x28')](function(_0x5a2105){if(_0x5a2105){_0xc51692['body']['IntervalId']=_0x5a2105['id'];return db[_0x1eeb('0x33')]['create'](_0xc51692[_0x1eeb('0x50')]);}})[_0x1eeb('0x28')](respondWithResult(_0xd2bad9,null))[_0x1eeb('0x4e')](handleError(_0xd2bad9,null));};exports[_0x1eeb('0x57')]=function(_0x30a1e9,_0x5dc7d5,_0x597e1b){var _0x259ede={};var _0x371733={};var _0x37363a;var _0x365d75;return db[_0x1eeb('0x33')][_0x1eeb('0x58')]({'where':{'id':_0x30a1e9[_0x1eeb('0x55')]['id']}})[_0x1eeb('0x28')](handleEntityNotFound(_0x5dc7d5,null))[_0x1eeb('0x28')](function(_0x64b8e4){if(_0x64b8e4){_0x37363a=_0x64b8e4;_0x371733['model']=_[_0x1eeb('0x39')](db['Interval'][_0x1eeb('0x34')]);_0x371733[_0x1eeb('0x38')]=_[_0x1eeb('0x39')](_0x30a1e9[_0x1eeb('0x38')]);_0x371733[_0x1eeb('0x3a')]=_[_0x1eeb('0x3b')](_0x371733[_0x1eeb('0x37')],_0x371733[_0x1eeb('0x38')]);_0x259ede[_0x1eeb('0x3c')]=_[_0x1eeb('0x3b')](_0x371733['model'],qs['fields'](_0x30a1e9[_0x1eeb('0x38')]['fields']));_0x259ede[_0x1eeb('0x3c')]=_0x259ede[_0x1eeb('0x3c')][_0x1eeb('0x3e')]?_0x259ede[_0x1eeb('0x3c')]:_0x371733[_0x1eeb('0x37')];_0x259ede['order']=qs[_0x1eeb('0x43')](_0x30a1e9['query'][_0x1eeb('0x43')]);_0x259ede[_0x1eeb('0x49')]=qs[_0x1eeb('0x3a')](_[_0x1eeb('0x44')](_0x30a1e9[_0x1eeb('0x38')],_0x371733[_0x1eeb('0x3a')]));if(_0x30a1e9[_0x1eeb('0x38')]['filter']){_0x259ede['where']=_['merge'](_0x259ede['where'],{'$or':_[_0x1eeb('0x32')](_0x259ede['attributes'],function(_0x27786e){var _0x4f14fe={};_0x4f14fe[_0x27786e]={'$like':'%'+_0x30a1e9['query'][_0x1eeb('0x45')]+'%'};return _0x4f14fe;})});}_0x259ede=_['merge']({},_0x259ede,_0x30a1e9[_0x1eeb('0x48')]);return _0x37363a[_0x1eeb('0x57')](_0x259ede);}})[_0x1eeb('0x28')](function(_0x518035){if(_0x518035){_0x365d75=_0x518035['length'];if(!_0x30a1e9[_0x1eeb('0x38')][_0x1eeb('0x3f')](_0x1eeb('0x40'))){_0x259ede[_0x1eeb('0x41')]=qs['limit'](_0x30a1e9[_0x1eeb('0x38')][_0x1eeb('0x41')]);_0x259ede[_0x1eeb('0x1e')]=qs[_0x1eeb('0x1e')](_0x30a1e9[_0x1eeb('0x38')][_0x1eeb('0x1e')]);}return _0x37363a[_0x1eeb('0x57')](_0x259ede);}})['then'](function(_0x4ae464){if(_0x4ae464){return _0x4ae464?{'count':_0x365d75,'rows':_0x4ae464}:null;}})[_0x1eeb('0x28')](respondWithResult(_0x5dc7d5,null))['catch'](handleError(_0x5dc7d5,null));};exports['addIntervals']=function(_0x4088a7,_0x5596d0,_0x5b17f3){return db[_0x1eeb('0x33')][_0x1eeb('0x58')]({'where':{'id':_0x4088a7[_0x1eeb('0x55')]['id']}})[_0x1eeb('0x28')](handleEntityNotFound(_0x5596d0,null))[_0x1eeb('0x28')](function(_0x2a8918){if(_0x2a8918){return db[_0x1eeb('0x59')][_0x1eeb('0x5a')](function(_0x576869){return db[_0x1eeb('0x33')][_0x1eeb('0x27')]({'where':{'IntervalId':_0x4088a7[_0x1eeb('0x55')]['id']},'transaction':_0x576869})[_0x1eeb('0x28')](function(_0x292dd8){var _0x5f4461=_[_0x1eeb('0x32')](_0x4088a7[_0x1eeb('0x50')],function(_0x265ef2){delete _0x265ef2['id'];_0x265ef2[_0x1eeb('0x5b')]=_0x4088a7[_0x1eeb('0x55')]['id'];return _0x265ef2;});return db[_0x1eeb('0x33')][_0x1eeb('0x5c')](_0x5f4461,{'transaction':_0x576869});});})['then'](function(){return db[_0x1eeb('0x33')]['findAll']({'where':{'IntervalId':_0x4088a7[_0x1eeb('0x55')]['id']}});});}})[_0x1eeb('0x28')](respondWithResult(_0x5596d0,null))[_0x1eeb('0x4e')](handleError(_0x5596d0,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index f136247..074d902 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 _0xa6f7=['rewrite','interval','getIntervals','then','all','map','reduce','./interval.attributes','../../utils/iftime','iftime','exports','define','tools_intervals'];(function(_0xa62ef2,_0x2617e9){var _0x1d0d2e=function(_0x3a00d5){while(--_0x3a00d5){_0xa62ef2['push'](_0xa62ef2['shift']());}};_0x1d0d2e(++_0x2617e9);}(_0xa6f7,0x6f));var _0x7a6f=function(_0x55447e,_0x5a209b){_0x55447e=_0x55447e-0x0;var _0x5bd6fd=_0xa6f7[_0x55447e];return _0x5bd6fd;};'use strict';var attributes=require(_0x7a6f('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x7a6f('0x1'))[_0x7a6f('0x2')];module[_0x7a6f('0x3')]=function(_0x4368cb){return _0x4368cb[_0x7a6f('0x4')]('Interval',attributes,{'tableName':_0x7a6f('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x69d7cf){extensions[_0x7a6f('0x6')](_0x4368cb,_0x69d7cf);},'afterBulkCreate':function(_0x366616,_0x1da210,_0x4a301d){_0x4a301d();extensions[_0x7a6f('0x6')](_0x4368cb,_0x366616[0x0]);},'afterUpdate':function(_0x3e17cf){extensions[_0x7a6f('0x6')](_0x4368cb,_0x3e17cf);},'afterDestroy':function(_0x435a1f){extensions[_0x7a6f('0x6')](_0x4368cb,_0x435a1f);}},'instanceMethods':{'ifTime':function(_0x19fb3c=undefined,_0x2d287=new Date()){if(typeof this[_0x7a6f('0x7')]==='string'){return iftime(this[_0x7a6f('0x7')],_0x19fb3c,_0x2d287);}else{return this[_0x7a6f('0x8')]()[_0x7a6f('0x9')](function(_0x11a860){return Promise[_0x7a6f('0xa')](_0x11a860[_0x7a6f('0xb')](function(_0x1988f6){return _0x1988f6['ifTime'](_0x19fb3c,_0x2d287);}));})[_0x7a6f('0x9')](function(_0x4747f5){return _0x4747f5[_0x7a6f('0xc')](function(_0x2743a0,_0x2d7d5f){return _0x2743a0||_0x2d7d5f;},![]);});}}}});}; \ No newline at end of file +var _0xcc36=['reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval','tools_intervals','rewrite','interval','getIntervals','all','map','ifTime'];(function(_0x3a752c,_0x498b78){var _0x2a5189=function(_0x408792){while(--_0x408792){_0x3a752c['push'](_0x3a752c['shift']());}};_0x2a5189(++_0x498b78);}(_0xcc36,0x1cf));var _0x6cc3=function(_0x1b33ec,_0x4c5bb3){_0x1b33ec=_0x1b33ec-0x0;var _0x36c0a4=_0xcc36[_0x1b33ec];return _0x36c0a4;};'use strict';var attributes=require(_0x6cc3('0x0'));var extensions=require(_0x6cc3('0x1'));var iftime=require(_0x6cc3('0x2'))['iftime'];module[_0x6cc3('0x3')]=function(_0x3efee6){return _0x3efee6[_0x6cc3('0x4')](_0x6cc3('0x5'),attributes,{'tableName':_0x6cc3('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x534849){extensions['rewrite'](_0x3efee6,_0x534849);},'afterBulkCreate':function(_0x44f45b,_0x4213a5,_0x2c4b94){_0x2c4b94();extensions[_0x6cc3('0x7')](_0x3efee6,_0x44f45b[0x0]);},'afterUpdate':function(_0x1593e5){extensions[_0x6cc3('0x7')](_0x3efee6,_0x1593e5);},'afterDestroy':function(_0x3d667f){extensions[_0x6cc3('0x7')](_0x3efee6,_0x3d667f);}},'instanceMethods':{'ifTime':function(_0x1151c8=undefined,_0xfb2b3d=new Date()){if(typeof this[_0x6cc3('0x8')]==='string'){return iftime(this[_0x6cc3('0x8')],_0x1151c8,_0xfb2b3d);}else{return this[_0x6cc3('0x9')]()['then'](function(_0x5ad97b){return Promise[_0x6cc3('0xa')](_0x5ad97b[_0x6cc3('0xb')](function(_0x9850d0){return _0x9850d0[_0x6cc3('0xc')](_0x1151c8,_0xfb2b3d);}));})['then'](function(_0x464b91){return _0x464b91[_0x6cc3('0xd')](function(_0x4bf9dc,_0x46b441){return _0x4bf9dc||_0x46b441;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 4875a9b..3061452 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 _0x97ab=['findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','intervalIds','isArray','intervals','string','IntervalIftime:\x20interval\x20strings\x20=\x20%s','join','Iftime','silly','IntervalIftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowInterval','find','all','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name'];(function(_0x27c5e9,_0x23d409){var _0xf547f2=function(_0x154cc3){while(--_0x154cc3){_0x27c5e9['push'](_0x27c5e9['shift']());}};_0xf547f2(++_0x23d409);}(_0x97ab,0x16e));var _0xb97a=function(_0x457e7b,_0x1a9137){_0x457e7b=_0x457e7b-0x0;var _0x3282eb=_0x97ab[_0x457e7b];return _0x3282eb;};'use strict';var _=require(_0xb97a('0x0'));var util=require(_0xb97a('0x1'));var db=require(_0xb97a('0x2'))['db'];var iftime=require(_0xb97a('0x3'))[_0xb97a('0x4')];var logger=require('../../config/logger')(_0xb97a('0x5'));exports[_0xb97a('0x6')]=function(_0x59b51a){var _0x3c9dcb=this;return new Promise(function(_0x37646b,_0xd728d9){return db[_0xb97a('0x7')][_0xb97a('0x8')]({'raw':_0x59b51a['options']?_0x59b51a[_0xb97a('0x9')][_0xb97a('0xa')]===undefined?!![]:![]:!![],'where':_0x59b51a['options']?_0x59b51a['options'][_0xb97a('0xb')]||null:null,'attributes':_0x59b51a['options']?_0x59b51a[_0xb97a('0x9')][_0xb97a('0xc')]||null:null,'limit':_0x59b51a[_0xb97a('0x9')]?_0x59b51a[_0xb97a('0x9')][_0xb97a('0xd')]||null:null,'include':_0x59b51a['options']?_0x59b51a[_0xb97a('0x9')][_0xb97a('0xe')]?_[_0xb97a('0xf')](_0x59b51a[_0xb97a('0x9')][_0xb97a('0xe')],function(_0x37c7d1){return{'model':db[_0x37c7d1[_0xb97a('0x10')]],'as':_0x37c7d1['as'],'attributes':_0x37c7d1[_0xb97a('0xc')],'include':_0x37c7d1[_0xb97a('0xe')]?_[_0xb97a('0xf')](_0x37c7d1['include'],function(_0x5ec8cb){return{'model':db[_0x5ec8cb[_0xb97a('0x10')]],'as':_0x5ec8cb['as'],'attributes':_0x5ec8cb['attributes'],'include':_0x5ec8cb[_0xb97a('0xe')]?_['map'](_0x5ec8cb[_0xb97a('0xe')],function(_0x6279bd){return{'model':db[_0x6279bd['model']],'as':_0x6279bd['as'],'attributes':_0x6279bd[_0xb97a('0xc')]};}):[]};}):[]};}):[]:[]})[_0xb97a('0x11')](function(_0x4e320d){logger[_0xb97a('0x12')](_0xb97a('0x6'),_0x59b51a);logger[_0xb97a('0x13')](_0xb97a('0x6'),_0x59b51a,JSON[_0xb97a('0x14')](_0x4e320d));_0x37646b(_0x4e320d);})[_0xb97a('0x15')](function(_0x21b4ad){logger[_0xb97a('0x16')]('GetInterval',_0x21b4ad[_0xb97a('0x17')],_0x59b51a);_0xd728d9(_0x3c9dcb[_0xb97a('0x16')](0x1f4,_0x21b4ad['message']));});});};exports[_0xb97a('0x18')]=function(_0x3c6509){var _0x415866=this;return new Promise(function(_0x5b2810,_0x350bcf){return db[_0xb97a('0x7')][_0xb97a('0x19')]({'raw':_0x3c6509[_0xb97a('0x9')]?_0x3c6509[_0xb97a('0x9')][_0xb97a('0xa')]===undefined?!![]:![]:!![],'where':_0x3c6509[_0xb97a('0x9')]?_0x3c6509[_0xb97a('0x9')][_0xb97a('0xb')]||null:null,'attributes':_0x3c6509['options']?_0x3c6509['options']['attributes']||null:null,'include':_0x3c6509[_0xb97a('0x9')]?_0x3c6509[_0xb97a('0x9')]['include']?_['map'](_0x3c6509['options'][_0xb97a('0xe')],function(_0x51382e){return{'model':db[_0x51382e['model']],'as':_0x51382e['as'],'attributes':_0x51382e[_0xb97a('0xc')],'include':_0x51382e['include']?_[_0xb97a('0xf')](_0x51382e['include'],function(_0x4ac1c9){return{'model':db[_0x4ac1c9[_0xb97a('0x10')]],'as':_0x4ac1c9['as'],'attributes':_0x4ac1c9[_0xb97a('0xc')],'include':_0x4ac1c9[_0xb97a('0xe')]?_[_0xb97a('0xf')](_0x4ac1c9['include'],function(_0x108479){return{'model':db[_0x108479[_0xb97a('0x10')]],'as':_0x108479['as'],'attributes':_0x108479[_0xb97a('0xc')]};}):[]};}):[]};}):[]:[]})[_0xb97a('0x11')](function(_0x12ad2d){logger[_0xb97a('0x12')](_0xb97a('0x18'),_0x3c6509);logger[_0xb97a('0x13')](_0xb97a('0x18'),_0x3c6509,JSON[_0xb97a('0x14')](_0x12ad2d));_0x5b2810(_0x12ad2d);})[_0xb97a('0x15')](function(_0x4b5fbd){logger[_0xb97a('0x16')](_0xb97a('0x18'),_0x4b5fbd['message'],_0x3c6509);_0x350bcf(_0x415866[_0xb97a('0x16')](0x1f4,_0x4b5fbd[_0xb97a('0x17')]));});});};function checkArrayOfIntervals(_0x44b356,_0x348760){var _0x101484=[];return db[_0xb97a('0x7')]['findAll']({'where':{'id':_0x44b356}})[_0xb97a('0x11')](function(_0xa06f6a){_0x101484=_0xa06f6a;return Promise[_0xb97a('0x1a')](_0x101484[_0xb97a('0xf')](function(_0x231821){return _0x231821['ifTime'](_0x348760);}));})[_0xb97a('0x11')](function(_0x561030){var _0x6453e1=_0x561030[_0xb97a('0x1b')](function(_0x1b9f63,_0xf2dfa5){return _0x1b9f63||_0xf2dfa5;},![]);logger[_0xb97a('0x12')](util['format'](_0xb97a('0x1c'),_0x101484[_0xb97a('0xf')](function(_0x3977a5){return _0x3977a5[_0xb97a('0x1d')];})['join'](',\x20'),_0x101484[_0xb97a('0xf')](function(_0x5cbfa4){return _0x5cbfa4['id'];})['join'](',\x20')));return _0x6453e1;});}function checkSingleInterval(_0xf1017d,_0x5509ce){return db[_0xb97a('0x7')][_0xb97a('0x1e')](_0xf1017d)[_0xb97a('0x11')](function(_0x1c5c5e){if(_0x1c5c5e){logger[_0xb97a('0x12')](util[_0xb97a('0x1f')](_0xb97a('0x20'),_0x1c5c5e[_0xb97a('0x1d')],_0x1c5c5e['id']));return _0x1c5c5e[_0xb97a('0x21')](_0x5509ce);}});}exports['IntervalIftime']=function(_0x5ca674){var _0xab31bb=_0x5ca674[_0xb97a('0x22')];var _0x2608c3=Array[_0xb97a('0x23')](_0x5ca674[_0xb97a('0x24')])?_0x5ca674[_0xb97a('0x24')]:typeof _0x5ca674[_0xb97a('0x24')]===_0xb97a('0x25')?[_0x5ca674[_0xb97a('0x24')]]:[];var _0x2a0787=_0x5ca674['timezone']||undefined;var _0x3bfd30=![];if(_0x2608c3['length']){logger[_0xb97a('0x12')](util['format'](_0xb97a('0x26'),_0x2608c3[_0xb97a('0x27')](';\x20')));}if(_0x2a0787){logger['info'](util[_0xb97a('0x1f')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x2a0787));}logger[_0xb97a('0x13')](_0xb97a('0x28'),_0x3bfd30);logger[_0xb97a('0x29')](_0xb97a('0x2a'),_0x5ca674);return Promise[_0xb97a('0x2b')]()[_0xb97a('0x11')](function(){if(Array[_0xb97a('0x23')](_0xab31bb)){return checkArrayOfIntervals(_0xab31bb,_0x2a0787);}else if(_0xab31bb){return checkSingleInterval(_0xab31bb,_0x2a0787);}})[_0xb97a('0x11')](function(_0x23b23e){var _0x2e599e=_0x2608c3[_0xb97a('0x1b')](function(_0x19b947,_0x476cd4){return _0x19b947||iftime(_0x476cd4,_0x2a0787);},![]);_0x3bfd30=_0x23b23e||_0x2e599e;return _0x3bfd30;})[_0xb97a('0x15')](function(_0x4aa667){logger[_0xb97a('0x16')](_0xb97a('0x2a'),_0x5ca674,_0x4aa667);throw this[_0xb97a('0x16')](0x1f4,_0x4aa667[_0xb97a('0x17')]);});}; \ No newline at end of file +var _0x13d7=['resolve','isArray','util','../../mysqldb','iftime','GetInterval','options','where','attributes','limit','map','include','model','stringify','error','message','ShowInterval','Interval','find','then','debug','catch','ifTime','reduce','format','name','join','findById','intervalIds','intervals','string','length','info','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','IntervalIftime'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x13d7,0x1be));var _0x713d=function(_0x179936,_0x33e1d3){_0x179936=_0x179936-0x0;var _0x215348=_0x13d7[_0x179936];return _0x215348;};'use strict';var _=require('lodash');var util=require(_0x713d('0x0'));var db=require(_0x713d('0x1'))['db'];var iftime=require('../../utils/iftime')[_0x713d('0x2')];var logger=require('../../config/logger')('rpc');exports[_0x713d('0x3')]=function(_0xfb1f46){var _0x377dc9=this;return new Promise(function(_0xb9d213,_0x312798){return db['Interval']['findAll']({'raw':_0xfb1f46['options']?_0xfb1f46['options']['raw']===undefined?!![]:![]:!![],'where':_0xfb1f46[_0x713d('0x4')]?_0xfb1f46[_0x713d('0x4')][_0x713d('0x5')]||null:null,'attributes':_0xfb1f46[_0x713d('0x4')]?_0xfb1f46[_0x713d('0x4')][_0x713d('0x6')]||null:null,'limit':_0xfb1f46[_0x713d('0x4')]?_0xfb1f46[_0x713d('0x4')][_0x713d('0x7')]||null:null,'include':_0xfb1f46['options']?_0xfb1f46['options']['include']?_[_0x713d('0x8')](_0xfb1f46[_0x713d('0x4')][_0x713d('0x9')],function(_0x47340a){return{'model':db[_0x47340a[_0x713d('0xa')]],'as':_0x47340a['as'],'attributes':_0x47340a[_0x713d('0x6')],'include':_0x47340a[_0x713d('0x9')]?_[_0x713d('0x8')](_0x47340a['include'],function(_0x44a007){return{'model':db[_0x44a007[_0x713d('0xa')]],'as':_0x44a007['as'],'attributes':_0x44a007[_0x713d('0x6')],'include':_0x44a007[_0x713d('0x9')]?_[_0x713d('0x8')](_0x44a007['include'],function(_0x284eba){return{'model':db[_0x284eba['model']],'as':_0x284eba['as'],'attributes':_0x284eba[_0x713d('0x6')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35e541){logger['info']('GetInterval',_0xfb1f46);logger['debug'](_0x713d('0x3'),_0xfb1f46,JSON[_0x713d('0xb')](_0x35e541));_0xb9d213(_0x35e541);})['catch'](function(_0x9bf9d7){logger[_0x713d('0xc')](_0x713d('0x3'),_0x9bf9d7[_0x713d('0xd')],_0xfb1f46);_0x312798(_0x377dc9[_0x713d('0xc')](0x1f4,_0x9bf9d7[_0x713d('0xd')]));});});};exports[_0x713d('0xe')]=function(_0x286bbd){var _0x245429=this;return new Promise(function(_0x4b4fc7,_0x1e8b0b){return db[_0x713d('0xf')][_0x713d('0x10')]({'raw':_0x286bbd[_0x713d('0x4')]?_0x286bbd['options']['raw']===undefined?!![]:![]:!![],'where':_0x286bbd[_0x713d('0x4')]?_0x286bbd['options']['where']||null:null,'attributes':_0x286bbd[_0x713d('0x4')]?_0x286bbd['options'][_0x713d('0x6')]||null:null,'include':_0x286bbd[_0x713d('0x4')]?_0x286bbd[_0x713d('0x4')][_0x713d('0x9')]?_['map'](_0x286bbd[_0x713d('0x4')][_0x713d('0x9')],function(_0x39ab92){return{'model':db[_0x39ab92[_0x713d('0xa')]],'as':_0x39ab92['as'],'attributes':_0x39ab92[_0x713d('0x6')],'include':_0x39ab92[_0x713d('0x9')]?_[_0x713d('0x8')](_0x39ab92[_0x713d('0x9')],function(_0x3e3b71){return{'model':db[_0x3e3b71[_0x713d('0xa')]],'as':_0x3e3b71['as'],'attributes':_0x3e3b71[_0x713d('0x6')],'include':_0x3e3b71[_0x713d('0x9')]?_[_0x713d('0x8')](_0x3e3b71['include'],function(_0x236ed0){return{'model':db[_0x236ed0[_0x713d('0xa')]],'as':_0x236ed0['as'],'attributes':_0x236ed0[_0x713d('0x6')]};}):[]};}):[]};}):[]:[]})[_0x713d('0x11')](function(_0x509f96){logger['info']('ShowInterval',_0x286bbd);logger[_0x713d('0x12')](_0x713d('0xe'),_0x286bbd,JSON['stringify'](_0x509f96));_0x4b4fc7(_0x509f96);})[_0x713d('0x13')](function(_0x5e6d93){logger[_0x713d('0xc')]('ShowInterval',_0x5e6d93['message'],_0x286bbd);_0x1e8b0b(_0x245429[_0x713d('0xc')](0x1f4,_0x5e6d93['message']));});});};function checkArrayOfIntervals(_0x2c6102,_0x59fefa){var _0x504425=[];return db[_0x713d('0xf')]['findAll']({'where':{'id':_0x2c6102}})[_0x713d('0x11')](function(_0x3a9c3d){_0x504425=_0x3a9c3d;return Promise['all'](_0x504425[_0x713d('0x8')](function(_0x347b08){return _0x347b08[_0x713d('0x14')](_0x59fefa);}));})['then'](function(_0x22d9f5){var _0x23c82e=_0x22d9f5[_0x713d('0x15')](function(_0x5a21b9,_0x21c7b3){return _0x5a21b9||_0x21c7b3;},![]);logger['info'](util[_0x713d('0x16')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x504425[_0x713d('0x8')](function(_0x30bf5b){return _0x30bf5b[_0x713d('0x17')];})[_0x713d('0x18')](',\x20'),_0x504425[_0x713d('0x8')](function(_0x35fd99){return _0x35fd99['id'];})[_0x713d('0x18')](',\x20')));return _0x23c82e;});}function checkSingleInterval(_0x230b62,_0x2d7da1){return db['Interval'][_0x713d('0x19')](_0x230b62)[_0x713d('0x11')](function(_0x2f3670){if(_0x2f3670){logger['info'](util[_0x713d('0x16')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x2f3670[_0x713d('0x17')],_0x2f3670['id']));return _0x2f3670[_0x713d('0x14')](_0x2d7da1);}});}exports['IntervalIftime']=function(_0x2bb783){var _0x2ae94e=_0x2bb783[_0x713d('0x1a')];var _0x4b79de=Array['isArray'](_0x2bb783[_0x713d('0x1b')])?_0x2bb783[_0x713d('0x1b')]:typeof _0x2bb783[_0x713d('0x1b')]===_0x713d('0x1c')?[_0x2bb783[_0x713d('0x1b')]]:[];var _0x151ad5=_0x2bb783['timezone']||undefined;var _0x29a45=![];if(_0x4b79de[_0x713d('0x1d')]){logger[_0x713d('0x1e')](util[_0x713d('0x16')](_0x713d('0x1f'),_0x4b79de[_0x713d('0x18')](';\x20')));}if(_0x151ad5){logger[_0x713d('0x1e')](util[_0x713d('0x16')](_0x713d('0x20'),_0x151ad5));}logger[_0x713d('0x12')]('Iftime',_0x29a45);logger[_0x713d('0x21')](_0x713d('0x22'),_0x2bb783);return Promise[_0x713d('0x23')]()[_0x713d('0x11')](function(){if(Array[_0x713d('0x24')](_0x2ae94e)){return checkArrayOfIntervals(_0x2ae94e,_0x151ad5);}else if(_0x2ae94e){return checkSingleInterval(_0x2ae94e,_0x151ad5);}})[_0x713d('0x11')](function(_0xcad1ff){var _0x56989c=_0x4b79de['reduce'](function(_0xbb9d68,_0x21ad4c){return _0xbb9d68||iftime(_0x21ad4c,_0x151ad5);},![]);_0x29a45=_0xcad1ff||_0x56989c;return _0x29a45;})[_0x713d('0x13')](function(_0x5da304){logger[_0x713d('0xc')](_0x713d('0x22'),_0x2bb783,_0x5da304);throw this[_0x713d('0xc')](0x1f4,_0x5da304[_0x713d('0xd')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 06b9fee..a600ffd 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0b0e,0x187));var _0xe0b0=function(_0x562ec5,_0x36b5a4){_0x562ec5=_0x562ec5-0x0;var _0x279c8c=_0x0b0e[_0x562ec5];return _0x279c8c;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x200392,_0x395a5c){var _0x466400=function(_0x3846dd){while(--_0x3846dd){_0x200392['push'](_0x200392['shift']());}};_0x466400(++_0x395a5c);}(_0xdb28,0x106));var _0x8db2=function(_0x33b8bf,_0x2b45c1){_0x33b8bf=_0x33b8bf-0x0;var _0x236592=_0xdb28[_0x33b8bf];return _0x236592;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 173cae2..5002923 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 _0xb605=['x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger','3eAmWpBVP0','summary','description','stringify','issuetype','Bug','email','fields','customfield_11501','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb605,0x1c7));var _0x5b60=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0xb605[_0x53e3fa];return _0xe8584a;};'use strict';var BPromise=require(_0x5b60('0x0'));var https=require('https');var logger=require(_0x5b60('0x1'))('api');var USERNAME='support';var PASSWORD=_0x5b60('0x2');function openIssue(_0x37f5af,_0x3ca11b){var _0xef9b92={'fields':{'project':{'key':_0x37f5af['key']||'MOTGUI'},'summary':(_0x37f5af[_0x5b60('0x3')]||'Report')+'\x20from\x20'+_0x37f5af['ip'],'description':_0x37f5af[_0x5b60('0x4')]||JSON[_0x5b60('0x5')](_0x37f5af),'issuetype':{'name':_0x37f5af[_0x5b60('0x6')]||_0x5b60('0x7')}}};_0xef9b92['fields']['customfield_11500']=_0x37f5af[_0x5b60('0x8')];_0xef9b92[_0x5b60('0x9')][_0x5b60('0xa')]=_0x37f5af['oldToken'];_0xef9b92[_0x5b60('0x9')][_0x5b60('0xb')]=_0x37f5af[_0x5b60('0xc')];_0xef9b92[_0x5b60('0x9')][_0x5b60('0xd')]=_0x37f5af[_0x5b60('0xe')];_0xef9b92[_0x5b60('0x9')]['customfield_11504']=_0x37f5af[_0x5b60('0xf')];_0xef9b92[_0x5b60('0x9')][_0x5b60('0x10')]=_0x37f5af['ip'];var _0x5073fe={'host':_0x5b60('0x11'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x5b60('0x12'),'timeout':0x4e20,'headers':{'Content-Type':_0x5b60('0x13'),'Authorization':_0x5b60('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0x5b60('0x15')](_0x5b60('0x16'))}};var _0x2bac87=JSON['stringify'](_0xef9b92);var _0x3f838c=https[_0x5b60('0x17')](_0x5073fe,function(_0x38d322){_0x38d322[_0x5b60('0x18')](_0x5b60('0x19'));var _0x4bc4af='';_0x38d322['on']('data',function(_0xb6ca3e){_0x4bc4af+=_0xb6ca3e;});_0x38d322['on'](_0x5b60('0x1a'),function(){if(_0x3ca11b){return _0x3ca11b[_0x5b60('0x1b')](_0x38d322[_0x5b60('0x1c')])[_0x5b60('0x1d')](JSON[_0x5b60('0x1e')](_0x4bc4af));}});});_0x3f838c['on']('error',function(_0x7e9aa1){if(_0x3ca11b){return _0x3ca11b[_0x5b60('0x1b')](0x1f4)[_0x5b60('0x1d')]({'errors':[{'message':_0x5b60('0x1f'),'type':_0x5b60('0x20')}]});}});_0x3f838c['write'](_0x2bac87);_0x3f838c[_0x5b60('0x1a')]();}exports[_0x5b60('0x21')]=openIssue;exports[_0x5b60('0x22')]=function(_0x260e8c,_0x26e4e8){_0x260e8c[_0x5b60('0x23')]['ip']=_0x260e8c[_0x5b60('0x24')][_0x5b60('0x25')]||_0x260e8c[_0x5b60('0x26')][_0x5b60('0x27')]||_0x260e8c['socket'][_0x5b60('0x27')]||_0x260e8c[_0x5b60('0x26')][_0x5b60('0x28')][_0x5b60('0x27')];return openIssue(_0x260e8c[_0x5b60('0x23')],_0x26e4e8);}; \ No newline at end of file +var _0x7f88=['support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','fields','customfield_11500','email','oldToken','customfield_11502','name','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','toString','base64','request','setEncoding','utf8','data','end','json','parse','error','status','api.jira','openIssue','send','headers','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0x7f88,0x1a0));var _0x87f8=function(_0xb0abac,_0x11379d){_0xb0abac=_0xb0abac-0x0;var _0x5c6ab3=_0x7f88[_0xb0abac];return _0x5c6ab3;};'use strict';var BPromise=require(_0x87f8('0x0'));var https=require(_0x87f8('0x1'));var logger=require(_0x87f8('0x2'))(_0x87f8('0x3'));var USERNAME=_0x87f8('0x4');var PASSWORD=_0x87f8('0x5');function openIssue(_0x39cbf9,_0x38051f){var _0xa9e383={'fields':{'project':{'key':_0x39cbf9[_0x87f8('0x6')]||_0x87f8('0x7')},'summary':(_0x39cbf9[_0x87f8('0x8')]||_0x87f8('0x9'))+'\x20from\x20'+_0x39cbf9['ip'],'description':_0x39cbf9[_0x87f8('0xa')]||JSON[_0x87f8('0xb')](_0x39cbf9),'issuetype':{'name':_0x39cbf9[_0x87f8('0xc')]||'Bug'}}};_0xa9e383[_0x87f8('0xd')][_0x87f8('0xe')]=_0x39cbf9[_0x87f8('0xf')];_0xa9e383[_0x87f8('0xd')]['customfield_11501']=_0x39cbf9[_0x87f8('0x10')];_0xa9e383[_0x87f8('0xd')][_0x87f8('0x11')]=_0x39cbf9['newToken'];_0xa9e383[_0x87f8('0xd')]['customfield_11503']=_0x39cbf9[_0x87f8('0x12')];_0xa9e383[_0x87f8('0xd')]['customfield_11504']=_0x39cbf9['reason'];_0xa9e383[_0x87f8('0xd')][_0x87f8('0x13')]=_0x39cbf9['ip'];var _0x50a963={'host':_0x87f8('0x14'),'port':0x1bb,'path':_0x87f8('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x87f8('0x16'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x87f8('0x17')](_0x87f8('0x18'))}};var _0x417efc=JSON['stringify'](_0xa9e383);var _0xb4a59b=https[_0x87f8('0x19')](_0x50a963,function(_0x396d6b){_0x396d6b[_0x87f8('0x1a')](_0x87f8('0x1b'));var _0x43be7b='';_0x396d6b['on'](_0x87f8('0x1c'),function(_0x326777){_0x43be7b+=_0x326777;});_0x396d6b['on'](_0x87f8('0x1d'),function(){if(_0x38051f){return _0x38051f['status'](_0x396d6b['statusCode'])[_0x87f8('0x1e')](JSON[_0x87f8('0x1f')](_0x43be7b));}});});_0xb4a59b['on'](_0x87f8('0x20'),function(_0x19232d){if(_0x38051f){return _0x38051f[_0x87f8('0x21')](0x1f4)[_0x87f8('0x1e')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x87f8('0x22')}]});}});_0xb4a59b['write'](_0x417efc);_0xb4a59b['end']();}exports[_0x87f8('0x23')]=openIssue;exports[_0x87f8('0x24')]=function(_0xbc66e7,_0x335381){_0xbc66e7['body']['ip']=_0xbc66e7[_0x87f8('0x25')]['x-forwarded-for']||_0xbc66e7[_0x87f8('0x26')][_0x87f8('0x27')]||_0xbc66e7[_0x87f8('0x28')]['remoteAddress']||_0xbc66e7[_0x87f8('0x26')][_0x87f8('0x28')][_0x87f8('0x27')];return openIssue(_0xbc66e7[_0x87f8('0x29')],_0x335381);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 3e977b9..d43b089 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 _0xbdb7=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get','describe','show','post','isAuthenticated','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x22bcdc,_0x5e01fa){var _0x439547=function(_0x3ca99d){while(--_0x3ca99d){_0x22bcdc['push'](_0x22bcdc['shift']());}};_0x439547(++_0x5e01fa);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x543bf6,_0x763bd7){_0x543bf6=_0x543bf6-0x0;var _0x4187b3=_0xbdb7[_0x543bf6];return _0x4187b3;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xe')]('/',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0x11')](_0x7bdb('0x12'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0x14')]);module[_0x7bdb('0x15')]=router; \ No newline at end of file +var _0x55e0=['./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2d3ade,_0x2d3ecb){var _0x152540=function(_0x33b0f0){while(--_0x33b0f0){_0x2d3ade['push'](_0x2d3ade['shift']());}};_0x152540(++_0x2d3ecb);}(_0x55e0,0xdc));var _0x055e=function(_0x5c6527,_0x34c61e){_0x5c6527=_0x5c6527-0x0;var _0x2c7d4e=_0x55e0[_0x5c6527];return _0x2c7d4e;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/describe',auth[_0x055e('0xa')](),controller[_0x055e('0xb')]);router[_0x055e('0x9')](_0x055e('0xc'),auth[_0x055e('0xa')](),controller['show']);router[_0x055e('0xd')]('/',auth[_0x055e('0xa')](),controller[_0x055e('0xe')]);router[_0x055e('0xf')](_0x055e('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x055e('0x10')]('/:id',auth[_0x055e('0xa')](),controller[_0x055e('0x11')]);module[_0x055e('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index ad36b00..8a837ac 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0x409732,_0x148b52){_0x409732=_0x409732-0x0;var _0x4e0c6d=_0x7a54[_0x409732];return _0x4e0c6d;};'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(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7a54,0x106));var _0x47a5=function(_0x10c184,_0x2dc94c){_0x10c184=_0x10c184-0x0;var _0xfd3c1c=_0x7a54[_0x10c184];return _0xfd3c1c;};'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 d1f40e5..bee032b 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 _0xdb94=['keys','find','create','body','destroy','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','sort','pick','where','VIRTUAL','filter','includeAll','include','findAll','rows','catch'];(function(_0x43f6d0,_0x4420f0){var _0x34bbd8=function(_0x3fd2d7){while(--_0x3fd2d7){_0x43f6d0['push'](_0x43f6d0['shift']());}};_0x34bbd8(++_0x4420f0);}(_0xdb94,0xe5));var _0x4db9=function(_0xe91593,_0x21cce1){_0xe91593=_0xe91593-0x0;var _0x39b10b=_0xdb94[_0xe91593];return _0x39b10b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4db9('0x0'));var zipdir=require(_0x4db9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4db9('0x2'));var moment=require(_0x4db9('0x3'));var BPromise=require(_0x4db9('0x4'));var Mustache=require(_0x4db9('0x5'));var util=require(_0x4db9('0x6'));var path=require('path');var sox=require(_0x4db9('0x7'));var csv=require('to-csv');var ejs=require(_0x4db9('0x8'));var fs=require('fs');var fs_extra=require(_0x4db9('0x9'));var _=require(_0x4db9('0xa'));var squel=require(_0x4db9('0xb'));var crypto=require(_0x4db9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4db9('0xd'));var toCsv=require(_0x4db9('0xe'));var querystring=require(_0x4db9('0xf'));var Papa=require(_0x4db9('0x10'));var Redis=require(_0x4db9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4db9('0x12'));var as=require(_0x4db9('0x13'));var hardwareService=require(_0x4db9('0x14'));var logger=require(_0x4db9('0x15'))(_0x4db9('0x16'));var utils=require(_0x4db9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4db9('0x18'));var db=require(_0x4db9('0x19'))['db'];function respondWithStatusCode(_0x59f01c,_0x549c92){_0x549c92=_0x549c92||0xcc;return function(_0x19f2d3){if(_0x19f2d3){return _0x59f01c[_0x4db9('0x1a')](_0x549c92);}return _0x59f01c[_0x4db9('0x1b')](_0x549c92)['end']();};}function respondWithResult(_0x1a93be,_0x3dde55){_0x3dde55=_0x3dde55||0xc8;return function(_0x2018d2){if(_0x2018d2){return _0x1a93be[_0x4db9('0x1b')](_0x3dde55)[_0x4db9('0x1c')](_0x2018d2);}};}function respondWithFilteredResult(_0x585230,_0x1b1062){return function(_0x1a5a9c){if(_0x1a5a9c){var _0x5d4d70=typeof _0x1b1062[_0x4db9('0x1d')]===_0x4db9('0x1e')&&typeof _0x1b1062[_0x4db9('0x1f')]==='undefined';var _0xedc513=_0x1a5a9c[_0x4db9('0x20')];var _0x4c5f4f=_0x5d4d70?0x0:_0x1b1062['offset'];var _0x493923=_0x5d4d70?_0x1a5a9c[_0x4db9('0x20')]:_0x1b1062[_0x4db9('0x1d')]+_0x1b1062['limit'];var _0x375515;if(_0x493923>=_0xedc513){_0x493923=_0xedc513;_0x375515=0xc8;}else{_0x375515=0xce;}_0x585230[_0x4db9('0x1b')](_0x375515);return _0x585230[_0x4db9('0x21')](_0x4db9('0x22'),_0x4c5f4f+'-'+_0x493923+'/'+_0xedc513)[_0x4db9('0x1c')](_0x1a5a9c);}return null;};}function patchUpdates(_0x28b7f6){return function(_0x34a6ed){try{jsonpatch[_0x4db9('0x23')](_0x34a6ed,_0x28b7f6,!![]);}catch(_0x3256f4){return BPromise[_0x4db9('0x24')](_0x3256f4);}return _0x34a6ed[_0x4db9('0x25')]();};}function saveUpdates(_0x102402,_0x4d56a1){return function(_0x42cc40){if(_0x42cc40){return _0x42cc40[_0x4db9('0x26')](_0x102402)['then'](function(_0x37c81f){return _0x37c81f;});}return null;};}function removeEntity(_0x3f4931,_0x4419af){return function(_0x402898){if(_0x402898){return _0x402898['destroy']()[_0x4db9('0x27')](function(){_0x3f4931['status'](0xcc)[_0x4db9('0x28')]();});}};}function handleEntityNotFound(_0x1c82b6,_0x135aa7){return function(_0x47e89c){if(!_0x47e89c){_0x1c82b6[_0x4db9('0x1a')](0x194);}return _0x47e89c;};}function handleError(_0x622db6,_0x47464d){_0x47464d=_0x47464d||0x1f4;return function(_0x5e7d29){logger['error'](_0x5e7d29[_0x4db9('0x29')]);if(_0x5e7d29['name']){delete _0x5e7d29[_0x4db9('0x2a')];}_0x622db6[_0x4db9('0x1b')](_0x47464d)[_0x4db9('0x2b')](_0x5e7d29);};}exports[_0x4db9('0x2c')]=function(_0x384df5,_0x3c3fcf){var _0x1d0dc2={},_0x373a7d={},_0x4c4a47={'count':0x0,'rows':[]};var _0x35f757=_['map'](db[_0x4db9('0x2d')][_0x4db9('0x2e')],function(_0x1e7840){return{'name':_0x1e7840[_0x4db9('0x2f')],'type':_0x1e7840[_0x4db9('0x30')]['key']};});_0x373a7d[_0x4db9('0x31')]=_[_0x4db9('0x32')](_0x35f757,_0x4db9('0x2a'));_0x373a7d[_0x4db9('0x33')]=_['keys'](_0x384df5['query']);_0x373a7d[_0x4db9('0x34')]=_[_0x4db9('0x35')](_0x373a7d['model'],_0x373a7d['query']);_0x1d0dc2[_0x4db9('0x36')]=_['intersection'](_0x373a7d['model'],qs[_0x4db9('0x37')](_0x384df5[_0x4db9('0x33')]['fields']));_0x1d0dc2[_0x4db9('0x36')]=_0x1d0dc2[_0x4db9('0x36')][_0x4db9('0x38')]?_0x1d0dc2[_0x4db9('0x36')]:_0x373a7d['model'];if(!_0x384df5[_0x4db9('0x33')]['hasOwnProperty']('nolimit')){_0x1d0dc2['limit']=qs[_0x4db9('0x1f')](_0x384df5[_0x4db9('0x33')]['limit']);_0x1d0dc2[_0x4db9('0x1d')]=qs[_0x4db9('0x1d')](_0x384df5['query']['offset']);}_0x1d0dc2['order']=qs[_0x4db9('0x39')](_0x384df5['query'][_0x4db9('0x39')]);_0x1d0dc2['where']=qs[_0x4db9('0x34')](_[_0x4db9('0x3a')](_0x384df5[_0x4db9('0x33')],_0x373a7d[_0x4db9('0x34')]),_0x35f757);if(_0x384df5[_0x4db9('0x33')]['filter']){_0x1d0dc2[_0x4db9('0x3b')]=_['merge'](_0x1d0dc2[_0x4db9('0x3b')],{'$or':_[_0x4db9('0x32')](_0x35f757,function(_0x15929e){if(_0x15929e[_0x4db9('0x30')]!==_0x4db9('0x3c')){var _0x4159d2={};_0x4159d2[_0x15929e['name']]={'$like':'%'+_0x384df5[_0x4db9('0x33')][_0x4db9('0x3d')]+'%'};return _0x4159d2;}})});}_0x1d0dc2=_['merge']({},_0x1d0dc2,_0x384df5['options']);var _0x404af3={'where':_0x1d0dc2[_0x4db9('0x3b')]};return db[_0x4db9('0x2d')][_0x4db9('0x20')](_0x404af3)[_0x4db9('0x27')](function(_0x36a648){_0x4c4a47[_0x4db9('0x20')]=_0x36a648;if(_0x384df5[_0x4db9('0x33')][_0x4db9('0x3e')]){_0x1d0dc2[_0x4db9('0x3f')]=[{'all':!![]}];}return db[_0x4db9('0x2d')][_0x4db9('0x40')](_0x1d0dc2);})['then'](function(_0x2716d6){_0x4c4a47[_0x4db9('0x41')]=_0x2716d6;return _0x4c4a47;})[_0x4db9('0x27')](respondWithFilteredResult(_0x3c3fcf,_0x1d0dc2))[_0x4db9('0x42')](handleError(_0x3c3fcf,null));};exports['show']=function(_0x57d32d,_0x248891){var _0x2b18a2={'raw':!![],'where':{'id':_0x57d32d['params']['id']}},_0x2fc233={};_0x2fc233[_0x4db9('0x31')]=_['keys'](db[_0x4db9('0x2d')][_0x4db9('0x2e')]);_0x2fc233[_0x4db9('0x33')]=_[_0x4db9('0x43')](_0x57d32d[_0x4db9('0x33')]);_0x2fc233['filters']=_[_0x4db9('0x35')](_0x2fc233[_0x4db9('0x31')],_0x2fc233[_0x4db9('0x33')]);_0x2b18a2[_0x4db9('0x36')]=_[_0x4db9('0x35')](_0x2fc233['model'],qs[_0x4db9('0x37')](_0x57d32d[_0x4db9('0x33')][_0x4db9('0x37')]));_0x2b18a2[_0x4db9('0x36')]=_0x2b18a2[_0x4db9('0x36')][_0x4db9('0x38')]?_0x2b18a2[_0x4db9('0x36')]:_0x2fc233[_0x4db9('0x31')];if(_0x57d32d[_0x4db9('0x33')]['includeAll']){_0x2b18a2[_0x4db9('0x3f')]=[{'all':!![]}];}_0x2b18a2=_['merge']({},_0x2b18a2,_0x57d32d['options']);return db[_0x4db9('0x2d')][_0x4db9('0x44')](_0x2b18a2)['then'](handleEntityNotFound(_0x248891,null))['then'](respondWithResult(_0x248891,null))[_0x4db9('0x42')](handleError(_0x248891,null));};exports[_0x4db9('0x45')]=function(_0x3fc788,_0x7f0aac){return db[_0x4db9('0x2d')][_0x4db9('0x45')](_0x3fc788[_0x4db9('0x46')],{})[_0x4db9('0x27')](respondWithResult(_0x7f0aac,0xc9))[_0x4db9('0x42')](handleError(_0x7f0aac,null));};exports[_0x4db9('0x26')]=function(_0x43312c,_0x5495de){if(_0x43312c[_0x4db9('0x46')]['id']){delete _0x43312c[_0x4db9('0x46')]['id'];}return db['JscriptyAnswerReport'][_0x4db9('0x44')]({'where':{'id':_0x43312c['params']['id']}})[_0x4db9('0x27')](handleEntityNotFound(_0x5495de,null))[_0x4db9('0x27')](saveUpdates(_0x43312c[_0x4db9('0x46')],null))[_0x4db9('0x27')](respondWithResult(_0x5495de,null))[_0x4db9('0x42')](handleError(_0x5495de,null));};exports[_0x4db9('0x47')]=function(_0x3f1aac,_0x3b8d8c){return db[_0x4db9('0x2d')][_0x4db9('0x44')]({'where':{'id':_0x3f1aac[_0x4db9('0x48')]['id']}})[_0x4db9('0x27')](handleEntityNotFound(_0x3b8d8c,null))[_0x4db9('0x27')](removeEntity(_0x3b8d8c,null))['catch'](handleError(_0x3b8d8c,null));};exports['describe']=function(_0x5ececc,_0x161e2e){return db['JscriptyAnswerReport'][_0x4db9('0x49')]()['then'](respondWithResult(_0x161e2e,null))[_0x4db9('0x42')](handleError(_0x161e2e,null));}; \ No newline at end of file +var _0x4074=['params','rawAttributes','intersection','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','error','stack','name','index','fieldName','type','key','model','map','query','keys','attributes','fields','length','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','JscriptyAnswerReport','then','includeAll','findAll','rows','show'];(function(_0x16db61,_0x598ca3){var _0x1747ee=function(_0x4ff641){while(--_0x4ff641){_0x16db61['push'](_0x16db61['shift']());}};_0x1747ee(++_0x598ca3);}(_0x4074,0xf0));var _0x4407=function(_0x5af6fb,_0x277951){_0x5af6fb=_0x5af6fb-0x0;var _0xa77a4a=_0x4074[_0x5af6fb];return _0xa77a4a;};'use strict';var emlformat=require(_0x4407('0x0'));var rimraf=require(_0x4407('0x1'));var zipdir=require(_0x4407('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4407('0x3'));var moment=require(_0x4407('0x4'));var BPromise=require(_0x4407('0x5'));var Mustache=require(_0x4407('0x6'));var util=require(_0x4407('0x7'));var path=require(_0x4407('0x8'));var sox=require(_0x4407('0x9'));var csv=require(_0x4407('0xa'));var ejs=require(_0x4407('0xb'));var fs=require('fs');var fs_extra=require(_0x4407('0xc'));var _=require('lodash');var squel=require(_0x4407('0xd'));var crypto=require('crypto');var jsforce=require(_0x4407('0xe'));var deskjs=require(_0x4407('0xf'));var toCsv=require(_0x4407('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4407('0x10'));var qs=require(_0x4407('0x11'));var as=require(_0x4407('0x12'));var hardwareService=require(_0x4407('0x13'));var logger=require(_0x4407('0x14'))(_0x4407('0x15'));var utils=require(_0x4407('0x16'));var config=require(_0x4407('0x17'));var licenseUtil=require(_0x4407('0x18'));var db=require(_0x4407('0x19'))['db'];function respondWithStatusCode(_0x14f398,_0x5d0c41){_0x5d0c41=_0x5d0c41||0xcc;return function(_0x3f8f23){if(_0x3f8f23){return _0x14f398[_0x4407('0x1a')](_0x5d0c41);}return _0x14f398['status'](_0x5d0c41)[_0x4407('0x1b')]();};}function respondWithResult(_0x4c62b9,_0x1d2ec8){_0x1d2ec8=_0x1d2ec8||0xc8;return function(_0x27724a){if(_0x27724a){return _0x4c62b9[_0x4407('0x1c')](_0x1d2ec8)[_0x4407('0x1d')](_0x27724a);}};}function respondWithFilteredResult(_0x1840dd,_0x417e19){return function(_0x1c5a0c){if(_0x1c5a0c){var _0x2e709f=typeof _0x417e19['offset']===_0x4407('0x1e')&&typeof _0x417e19[_0x4407('0x1f')]===_0x4407('0x1e');var _0x367d55=_0x1c5a0c[_0x4407('0x20')];var _0x5b50b7=_0x2e709f?0x0:_0x417e19[_0x4407('0x21')];var _0x54caa1=_0x2e709f?_0x1c5a0c[_0x4407('0x20')]:_0x417e19[_0x4407('0x21')]+_0x417e19[_0x4407('0x1f')];var _0x2db8b2;if(_0x54caa1>=_0x367d55){_0x54caa1=_0x367d55;_0x2db8b2=0xc8;}else{_0x2db8b2=0xce;}_0x1840dd[_0x4407('0x1c')](_0x2db8b2);return _0x1840dd['set'](_0x4407('0x22'),_0x5b50b7+'-'+_0x54caa1+'/'+_0x367d55)['json'](_0x1c5a0c);}return null;};}function patchUpdates(_0x36a948){return function(_0x28bb2c){try{jsonpatch[_0x4407('0x23')](_0x28bb2c,_0x36a948,!![]);}catch(_0x445fe6){return BPromise['reject'](_0x445fe6);}return _0x28bb2c[_0x4407('0x24')]();};}function saveUpdates(_0x1fa9f1,_0x137f8e){return function(_0x2c880a){if(_0x2c880a){return _0x2c880a[_0x4407('0x25')](_0x1fa9f1)['then'](function(_0xa7265d){return _0xa7265d;});}return null;};}function removeEntity(_0x16272f,_0x5e214c){return function(_0x21b048){if(_0x21b048){return _0x21b048[_0x4407('0x26')]()['then'](function(){_0x16272f[_0x4407('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309274,_0x5386f4){return function(_0x40fb1e){if(!_0x40fb1e){_0x309274['sendStatus'](0x194);}return _0x40fb1e;};}function handleError(_0x374754,_0x4bf227){_0x4bf227=_0x4bf227||0x1f4;return function(_0x57ba27){logger[_0x4407('0x27')](_0x57ba27[_0x4407('0x28')]);if(_0x57ba27[_0x4407('0x29')]){delete _0x57ba27['name'];}_0x374754['status'](_0x4bf227)['send'](_0x57ba27);};}exports[_0x4407('0x2a')]=function(_0x2feb6b,_0x1f9828){var _0x84a8a={},_0x1d6b3d={},_0x37fba1={'count':0x0,'rows':[]};var _0x182bd9=_['map'](db['JscriptyAnswerReport']['rawAttributes'],function(_0x28e99e){return{'name':_0x28e99e[_0x4407('0x2b')],'type':_0x28e99e[_0x4407('0x2c')][_0x4407('0x2d')]};});_0x1d6b3d[_0x4407('0x2e')]=_[_0x4407('0x2f')](_0x182bd9,_0x4407('0x29'));_0x1d6b3d[_0x4407('0x30')]=_[_0x4407('0x31')](_0x2feb6b[_0x4407('0x30')]);_0x1d6b3d['filters']=_['intersection'](_0x1d6b3d[_0x4407('0x2e')],_0x1d6b3d[_0x4407('0x30')]);_0x84a8a[_0x4407('0x32')]=_['intersection'](_0x1d6b3d[_0x4407('0x2e')],qs[_0x4407('0x33')](_0x2feb6b[_0x4407('0x30')][_0x4407('0x33')]));_0x84a8a[_0x4407('0x32')]=_0x84a8a['attributes'][_0x4407('0x34')]?_0x84a8a['attributes']:_0x1d6b3d[_0x4407('0x2e')];if(!_0x2feb6b['query']['hasOwnProperty'](_0x4407('0x35'))){_0x84a8a[_0x4407('0x1f')]=qs[_0x4407('0x1f')](_0x2feb6b[_0x4407('0x30')][_0x4407('0x1f')]);_0x84a8a[_0x4407('0x21')]=qs[_0x4407('0x21')](_0x2feb6b['query'][_0x4407('0x21')]);}_0x84a8a[_0x4407('0x36')]=qs[_0x4407('0x37')](_0x2feb6b[_0x4407('0x30')][_0x4407('0x37')]);_0x84a8a['where']=qs[_0x4407('0x38')](_['pick'](_0x2feb6b[_0x4407('0x30')],_0x1d6b3d[_0x4407('0x38')]),_0x182bd9);if(_0x2feb6b[_0x4407('0x30')][_0x4407('0x39')]){_0x84a8a['where']=_[_0x4407('0x3a')](_0x84a8a[_0x4407('0x3b')],{'$or':_[_0x4407('0x2f')](_0x182bd9,function(_0x1bf4e2){if(_0x1bf4e2[_0x4407('0x2c')]!==_0x4407('0x3c')){var _0x30de66={};_0x30de66[_0x1bf4e2[_0x4407('0x29')]]={'$like':'%'+_0x2feb6b[_0x4407('0x30')]['filter']+'%'};return _0x30de66;}})});}_0x84a8a=_['merge']({},_0x84a8a,_0x2feb6b[_0x4407('0x3d')]);var _0xc47d0e={'where':_0x84a8a[_0x4407('0x3b')]};return db[_0x4407('0x3e')]['count'](_0xc47d0e)[_0x4407('0x3f')](function(_0x2cb65e){_0x37fba1[_0x4407('0x20')]=_0x2cb65e;if(_0x2feb6b['query'][_0x4407('0x40')]){_0x84a8a['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x4407('0x41')](_0x84a8a);})[_0x4407('0x3f')](function(_0x234fa5){_0x37fba1[_0x4407('0x42')]=_0x234fa5;return _0x37fba1;})[_0x4407('0x3f')](respondWithFilteredResult(_0x1f9828,_0x84a8a))['catch'](handleError(_0x1f9828,null));};exports[_0x4407('0x43')]=function(_0xf79768,_0x819b8b){var _0x15ba7b={'raw':!![],'where':{'id':_0xf79768[_0x4407('0x44')]['id']}},_0x5b41cf={};_0x5b41cf[_0x4407('0x2e')]=_[_0x4407('0x31')](db[_0x4407('0x3e')][_0x4407('0x45')]);_0x5b41cf['query']=_[_0x4407('0x31')](_0xf79768['query']);_0x5b41cf['filters']=_[_0x4407('0x46')](_0x5b41cf[_0x4407('0x2e')],_0x5b41cf['query']);_0x15ba7b[_0x4407('0x32')]=_[_0x4407('0x46')](_0x5b41cf[_0x4407('0x2e')],qs[_0x4407('0x33')](_0xf79768['query'][_0x4407('0x33')]));_0x15ba7b[_0x4407('0x32')]=_0x15ba7b[_0x4407('0x32')][_0x4407('0x34')]?_0x15ba7b[_0x4407('0x32')]:_0x5b41cf['model'];if(_0xf79768[_0x4407('0x30')][_0x4407('0x40')]){_0x15ba7b[_0x4407('0x47')]=[{'all':!![]}];}_0x15ba7b=_[_0x4407('0x3a')]({},_0x15ba7b,_0xf79768[_0x4407('0x3d')]);return db['JscriptyAnswerReport'][_0x4407('0x48')](_0x15ba7b)[_0x4407('0x3f')](handleEntityNotFound(_0x819b8b,null))[_0x4407('0x3f')](respondWithResult(_0x819b8b,null))[_0x4407('0x49')](handleError(_0x819b8b,null));};exports['create']=function(_0x18ff16,_0x2b18b8){return db['JscriptyAnswerReport'][_0x4407('0x4a')](_0x18ff16[_0x4407('0x4b')],{})['then'](respondWithResult(_0x2b18b8,0xc9))[_0x4407('0x49')](handleError(_0x2b18b8,null));};exports[_0x4407('0x25')]=function(_0x5ea36,_0x4fbc1f){if(_0x5ea36[_0x4407('0x4b')]['id']){delete _0x5ea36['body']['id'];}return db['JscriptyAnswerReport'][_0x4407('0x48')]({'where':{'id':_0x5ea36[_0x4407('0x44')]['id']}})['then'](handleEntityNotFound(_0x4fbc1f,null))[_0x4407('0x3f')](saveUpdates(_0x5ea36[_0x4407('0x4b')],null))[_0x4407('0x3f')](respondWithResult(_0x4fbc1f,null))[_0x4407('0x49')](handleError(_0x4fbc1f,null));};exports[_0x4407('0x26')]=function(_0x5a2c2b,_0x39865e){return db[_0x4407('0x3e')][_0x4407('0x48')]({'where':{'id':_0x5a2c2b[_0x4407('0x44')]['id']}})[_0x4407('0x3f')](handleEntityNotFound(_0x39865e,null))[_0x4407('0x3f')](removeEntity(_0x39865e,null))[_0x4407('0x49')](handleError(_0x39865e,null));};exports[_0x4407('0x4c')]=function(_0xd1dd66,_0x55f0ef){return db[_0x4407('0x3e')]['describe']()[_0x4407('0x3f')](respondWithResult(_0x55f0ef,null))[_0x4407('0x49')](handleError(_0x55f0ef,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 933c064..b96f91d 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 _0xc45d=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment','request-promise'];(function(_0x37301a,_0x3a5c69){var _0x3e5c49=function(_0x5fea81){while(--_0x5fea81){_0x37301a['push'](_0x37301a['shift']());}};_0x3e5c49(++_0x3a5c69);}(_0xc45d,0x103));var _0xdc45=function(_0x5e2152,_0x172f3d){_0x5e2152=_0x5e2152-0x0;var _0x5ddcf6=_0xc45d[_0x5e2152];return _0x5ddcf6;};'use strict';var _=require(_0xdc45('0x0'));var util=require(_0xdc45('0x1'));var logger=require('../../config/logger')(_0xdc45('0x2'));var moment=require(_0xdc45('0x3'));var BPromise=require('bluebird');var rp=require(_0xdc45('0x4'));var fs=require('fs');var path=require(_0xdc45('0x5'));var rimraf=require(_0xdc45('0x6'));var config=require(_0xdc45('0x7'));var attributes=require(_0xdc45('0x8'));module[_0xdc45('0x9')]=function(_0x280192,_0x183954){return _0x280192['define'](_0xdc45('0xa'),attributes,{'tableName':_0xdc45('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff0e=['request-promise','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x50e6d7,_0x64c311){var _0x3df90e=function(_0x379bde){while(--_0x379bde){_0x50e6d7['push'](_0x50e6d7['shift']());}};_0x3df90e(++_0x64c311);}(_0xff0e,0x18b));var _0xeff0=function(_0x1732db,_0x2e22e9){_0x1732db=_0x1732db-0x0;var _0x3698b0=_0xff0e[_0x1732db];return _0x3698b0;};'use strict';var _=require(_0xeff0('0x0'));var util=require(_0xeff0('0x1'));var logger=require(_0xeff0('0x2'))(_0xeff0('0x3'));var moment=require('moment');var BPromise=require(_0xeff0('0x4'));var rp=require(_0xeff0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeff0('0x6'));var config=require(_0xeff0('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xeff0('0x8')]=function(_0x2ee5cf,_0x4e2587){return _0x2ee5cf[_0xeff0('0x9')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index d2954a0..23569da 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 _0xe02d=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent'];(function(_0xa56034,_0x444c23){var _0x55c686=function(_0x2b8328){while(--_0x2b8328){_0xa56034['push'](_0xa56034['shift']());}};_0x55c686(++_0x444c23);}(_0xe02d,0x1d9));var _0xde02=function(_0x3c57c7,_0x18e494){_0x3c57c7=_0x3c57c7-0x0;var _0x9c2cbb=_0xe02d[_0x3c57c7];return _0x9c2cbb;};'use strict';var _=require(_0xde02('0x0'));var util=require(_0xde02('0x1'));var moment=require(_0xde02('0x2'));var BPromise=require('bluebird');var rs=require(_0xde02('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde02('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xde02('0x5'))('rpc');var config=require(_0xde02('0x6'));var jayson=require(_0xde02('0x7'));var client=jayson[_0xde02('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b7c1a,_0x4f5163,_0x515f87){return new BPromise(function(_0x263480,_0x48ef47){return client['request'](_0x2b7c1a,_0x515f87)[_0xde02('0x9')](function(_0x12ec2a){logger[_0xde02('0xa')](_0xde02('0xb'),_0x4f5163,_0xde02('0xc'));logger['debug'](_0xde02('0xd'),_0x4f5163,'request\x20sent',JSON[_0xde02('0xe')](_0x12ec2a));if(_0x12ec2a[_0xde02('0xf')]){if(_0x12ec2a['error']['code']===0x1f4){logger['error'](_0xde02('0xb'),_0x4f5163,_0x12ec2a[_0xde02('0xf')]['message']);return _0x48ef47(_0x12ec2a[_0xde02('0xf')][_0xde02('0x10')]);}logger[_0xde02('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4f5163,_0x12ec2a[_0xde02('0xf')][_0xde02('0x10')]);return _0x263480(_0x12ec2a['error'][_0xde02('0x10')]);}else{logger[_0xde02('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4f5163,_0xde02('0xc'));_0x263480(_0x12ec2a['result']['message']);}})[_0xde02('0x11')](function(_0x4c2752){logger[_0xde02('0xf')](_0xde02('0xb'),_0x4f5163,_0x4c2752);_0x48ef47(_0x4c2752);});});} \ No newline at end of file +var _0xcd9f=['http','request','info','request\x20sent','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0x4e0ada,_0x38dadd){var _0xcea372=function(_0x19b418){while(--_0x19b418){_0x4e0ada['push'](_0x4e0ada['shift']());}};_0xcea372(++_0x38dadd);}(_0xcd9f,0xa2));var _0xfcd9=function(_0x110494,_0x2e9593){_0x110494=_0x110494-0x0;var _0x63952c=_0xcd9f[_0x110494];return _0x63952c;};'use strict';var _=require(_0xfcd9('0x0'));var util=require('util');var moment=require(_0xfcd9('0x1'));var BPromise=require(_0xfcd9('0x2'));var rs=require(_0xfcd9('0x3'));var fs=require('fs');var Redis=require(_0xfcd9('0x4'));var db=require(_0xfcd9('0x5'))['db'];var utils=require(_0xfcd9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfcd9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfcd9('0x8')][_0xfcd9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34e7f2,_0x54e134,_0x4d3aae){return new BPromise(function(_0x15e5c3,_0x556615){return client[_0xfcd9('0xa')](_0x34e7f2,_0x4d3aae)['then'](function(_0x38503b){logger[_0xfcd9('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x54e134,_0xfcd9('0xc'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x54e134,'request\x20sent',JSON['stringify'](_0x38503b));if(_0x38503b['error']){if(_0x38503b[_0xfcd9('0xd')][_0xfcd9('0xe')]===0x1f4){logger[_0xfcd9('0xd')](_0xfcd9('0xf'),_0x54e134,_0x38503b[_0xfcd9('0xd')][_0xfcd9('0x10')]);return _0x556615(_0x38503b[_0xfcd9('0xd')][_0xfcd9('0x10')]);}logger[_0xfcd9('0xd')](_0xfcd9('0xf'),_0x54e134,_0x38503b[_0xfcd9('0xd')][_0xfcd9('0x10')]);return _0x15e5c3(_0x38503b[_0xfcd9('0xd')][_0xfcd9('0x10')]);}else{logger[_0xfcd9('0xb')](_0xfcd9('0xf'),_0x54e134,_0xfcd9('0xc'));_0x15e5c3(_0x38503b[_0xfcd9('0x11')][_0xfcd9('0x10')]);}})[_0xfcd9('0x12')](function(_0x59cf96){logger[_0xfcd9('0xd')](_0xfcd9('0xf'),_0x54e134,_0x59cf96);_0x556615(_0x59cf96);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index a139783..7634cc3 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 _0x2e43=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','getSummary','post','create','/:id/clone','put','delete','destroy','exports'];(function(_0x31e185,_0x40dc4e){var _0x2718c9=function(_0x1bf736){while(--_0x1bf736){_0x31e185['push'](_0x31e185['shift']());}};_0x2718c9(++_0x40dc4e);}(_0x2e43,0x168));var _0x32e4=function(_0x27ee81,_0x336e7a){_0x27ee81=_0x27ee81-0x0;var _0x267182=_0x2e43[_0x27ee81];return _0x267182;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x32e4('0x0'));var timeout=require(_0x32e4('0x1'));var express=require('express');var router=express[_0x32e4('0x2')]();var fs_extra=require(_0x32e4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x32e4('0x4'));var config=require(_0x32e4('0x5'));var controller=require(_0x32e4('0x6'));router[_0x32e4('0x7')]('/',auth['isAuthenticated'](),controller[_0x32e4('0x8')]);router[_0x32e4('0x7')](_0x32e4('0x9'),auth[_0x32e4('0xa')](),controller[_0x32e4('0xb')]);router['get'](_0x32e4('0xc'),auth[_0x32e4('0xa')](),controller[_0x32e4('0xd')]);router[_0x32e4('0x7')](_0x32e4('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x32e4('0x7')](_0x32e4('0xf'),auth[_0x32e4('0xa')](),timeout('30s'),controller[_0x32e4('0x10')]);router[_0x32e4('0x11')]('/',auth[_0x32e4('0xa')](),controller[_0x32e4('0x12')]);router[_0x32e4('0x11')](_0x32e4('0x13'),auth[_0x32e4('0xa')](),controller['clone']);router[_0x32e4('0x14')]('/:id',auth[_0x32e4('0xa')](),controller['update']);router[_0x32e4('0x15')]('/:id',auth[_0x32e4('0xa')](),controller[_0x32e4('0x16')]);module[_0x32e4('0x17')]=router; \ No newline at end of file +var _0xcb14=['/:id/answers','getAnswers','30s','getSummary','post','/:id/clone','clone','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcb14,0x10f));var _0x4cb1=function(_0x52b993,_0x13ef76){_0x52b993=_0x52b993-0x0;var _0x1ac4ff=_0xcb14[_0x52b993];return _0x1ac4ff;};'use strict';var multer=require(_0x4cb1('0x0'));var util=require(_0x4cb1('0x1'));var path=require(_0x4cb1('0x2'));var timeout=require(_0x4cb1('0x3'));var express=require(_0x4cb1('0x4'));var router=express[_0x4cb1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4cb1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4cb1('0x7'));var controller=require(_0x4cb1('0x8'));router[_0x4cb1('0x9')]('/',auth[_0x4cb1('0xa')](),controller[_0x4cb1('0xb')]);router['get'](_0x4cb1('0xc'),auth[_0x4cb1('0xa')](),controller[_0x4cb1('0xd')]);router[_0x4cb1('0x9')]('/:id/sessions',auth[_0x4cb1('0xa')](),controller[_0x4cb1('0xe')]);router['get'](_0x4cb1('0xf'),auth[_0x4cb1('0xa')](),controller[_0x4cb1('0x10')]);router[_0x4cb1('0x9')]('/:id/summary',auth[_0x4cb1('0xa')](),timeout(_0x4cb1('0x11')),controller[_0x4cb1('0x12')]);router[_0x4cb1('0x13')]('/',auth[_0x4cb1('0xa')](),controller['create']);router[_0x4cb1('0x13')](_0x4cb1('0x14'),auth[_0x4cb1('0xa')](),controller[_0x4cb1('0x15')]);router[_0x4cb1('0x16')]('/:id',auth[_0x4cb1('0xa')](),controller[_0x4cb1('0x17')]);router[_0x4cb1('0x18')]('/:id',auth[_0x4cb1('0xa')](),controller[_0x4cb1('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 655ab83..1656049 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 _0xa976=['formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue'];(function(_0x46928a,_0xc2829a){var _0x952bc0=function(_0x4acb8d){while(--_0x4acb8d){_0x46928a['push'](_0x46928a['shift']());}};_0x952bc0(++_0xc2829a);}(_0xa976,0x14a));var _0x6a97=function(_0x54fdc0,_0x19fb7b){_0x54fdc0=_0x54fdc0-0x0;var _0x5e7292=_0xa976[_0x54fdc0];return _0x5e7292;};'use strict';var Sequelize=require(_0x6a97('0x0'));var _=require(_0x6a97('0x1'));var util=require(_0x6a97('0x2'));module[_0x6a97('0x3')]={'name':{'type':Sequelize[_0x6a97('0x4')],'unique':_0x6a97('0x5')},'description':{'type':Sequelize[_0x6a97('0x4')]},'formData':{'type':Sequelize[_0x6a97('0x6')](_0x6a97('0x7')),'set':function(_0x245601){if(_[_0x6a97('0x8')](_0x245601)){this[_0x6a97('0x9')](_0x6a97('0xa'),JSON[_0x6a97('0xb')](_0x245601));}else if(_['isString'](_0x245601)){this[_0x6a97('0x9')](_0x6a97('0xa'),_0x245601);}else{this[_0x6a97('0x9')](_0x6a97('0xa'),util[_0x6a97('0xc')](_0x6a97('0xd'),this[_0x6a97('0xe')](_0x6a97('0x5'))||'',this[_0x6a97('0xe')](_0x6a97('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6a97('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6a97('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0xe26c=['getDataValue','description','BOOLEAN','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x16d1e3,_0x54cf8b){var _0x3c0592=function(_0x31c7f4){while(--_0x31c7f4){_0x16d1e3['push'](_0x16d1e3['shift']());}};_0x3c0592(++_0x54cf8b);}(_0xe26c,0x146));var _0xce26=function(_0x29b4ff,_0x16b0de){_0x29b4ff=_0x29b4ff-0x0;var _0x2c383f=_0xe26c[_0x29b4ff];return _0x2c383f;};'use strict';var Sequelize=require('sequelize');var _=require(_0xce26('0x0'));var util=require(_0xce26('0x1'));module[_0xce26('0x2')]={'name':{'type':Sequelize[_0xce26('0x3')],'unique':_0xce26('0x4')},'description':{'type':Sequelize[_0xce26('0x3')]},'formData':{'type':Sequelize[_0xce26('0x5')](_0xce26('0x6')),'set':function(_0x2e2509){if(_[_0xce26('0x7')](_0x2e2509)){this[_0xce26('0x8')]('formData',JSON[_0xce26('0x9')](_0x2e2509));}else if(_[_0xce26('0xa')](_0x2e2509)){this[_0xce26('0x8')](_0xce26('0xb'),_0x2e2509);}else{this[_0xce26('0x8')](_0xce26('0xb'),util[_0xce26('0xc')](_0xce26('0xd'),this[_0xce26('0xe')](_0xce26('0x4'))||'',this[_0xce26('0xe')](_0xce26('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xce26('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xce26('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 07b114f..3194aae 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 _0x671e=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then','get','Projects','UserProfileResource','end','stack','name','send','index','map','JscriptyProject','type','key','model','query','intersection','attributes','fields','length','order','sort','where','filters','VIRTUAL','merge','options','include','findAll','catch','show','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','rawAttributes','createdAt','updatedAt','omit','role','UserProfileSection','error','update','getSessions','findOne','JscriptySessionReport','hasOwnProperty','pick','ProjectId','filter','rows','nolimit','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','push','now','setHeader','Content-disposition','format','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x931383,_0x1cc915){var _0x41215d=function(_0x317a8c){while(--_0x317a8c){_0x931383['push'](_0x931383['shift']());}};_0x41215d(++_0x1cc915);}(_0x671e,0xd6));var _0xe671=function(_0x44c009,_0x2e5ecc){_0x44c009=_0x44c009-0x0;var _0x4f6931=_0x671e[_0x44c009];return _0x4f6931;};'use strict';var emlformat=require(_0xe671('0x0'));var rimraf=require(_0xe671('0x1'));var zipdir=require(_0xe671('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe671('0x3'));var moment=require(_0xe671('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe671('0x5'));var util=require(_0xe671('0x6'));var path=require(_0xe671('0x7'));var sox=require('sox');var csv=require(_0xe671('0x8'));var ejs=require(_0xe671('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe671('0xa'));var squel=require(_0xe671('0xb'));var crypto=require(_0xe671('0xc'));var jsforce=require(_0xe671('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe671('0x8'));var querystring=require(_0xe671('0xe'));var Papa=require(_0xe671('0xf'));var Redis=require(_0xe671('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe671('0x11'));var hardwareService=require(_0xe671('0x12'));var logger=require(_0xe671('0x13'))('api');var utils=require(_0xe671('0x14'));var config=require(_0xe671('0x15'));var licenseUtil=require(_0xe671('0x16'));var db=require(_0xe671('0x17'))['db'];function respondWithStatusCode(_0x57767b,_0x3a051e){_0x3a051e=_0x3a051e||0xcc;return function(_0x4f8054){if(_0x4f8054){return _0x57767b[_0xe671('0x18')](_0x3a051e);}return _0x57767b['status'](_0x3a051e)['end']();};}function respondWithResult(_0x5222a7,_0x59688e){_0x59688e=_0x59688e||0xc8;return function(_0xcf6e92){if(_0xcf6e92){return _0x5222a7[_0xe671('0x19')](_0x59688e)[_0xe671('0x1a')](_0xcf6e92);}};}function respondWithFilteredResult(_0x2d427f,_0x53ceee){return function(_0x19d49c){if(_0x19d49c){var _0x6aea49=typeof _0x53ceee[_0xe671('0x1b')]===_0xe671('0x1c')&&typeof _0x53ceee[_0xe671('0x1d')]==='undefined';var _0x135e68=_0x19d49c[_0xe671('0x1e')];var _0x3ef34b=_0x6aea49?0x0:_0x53ceee[_0xe671('0x1b')];var _0xf28a70=_0x6aea49?_0x19d49c[_0xe671('0x1e')]:_0x53ceee[_0xe671('0x1b')]+_0x53ceee[_0xe671('0x1d')];var _0x4a24bf;if(_0xf28a70>=_0x135e68){_0xf28a70=_0x135e68;_0x4a24bf=0xc8;}else{_0x4a24bf=0xce;}_0x2d427f[_0xe671('0x19')](_0x4a24bf);return _0x2d427f[_0xe671('0x1f')](_0xe671('0x20'),_0x3ef34b+'-'+_0xf28a70+'/'+_0x135e68)[_0xe671('0x1a')](_0x19d49c);}return null;};}function patchUpdates(_0x565623){return function(_0x1f6521){try{jsonpatch['apply'](_0x1f6521,_0x565623,!![]);}catch(_0x1acc81){return BPromise[_0xe671('0x21')](_0x1acc81);}return _0x1f6521['save']();};}function saveUpdates(_0x50bc70,_0x2e9d94){return function(_0x23f1db){if(_0x23f1db){return _0x23f1db['update'](_0x50bc70)['then'](function(_0x3c796b){return _0x3c796b;});}return null;};}function removeEntity(_0x5ed70f,_0x1479e9){return function(_0x511ff5){if(_0x511ff5){return _0x511ff5[_0xe671('0x22')]()[_0xe671('0x23')](function(){var _0x49f190=_0x511ff5[_0xe671('0x24')]({'plain':!![]});var _0x15e433=_0xe671('0x25');return db[_0xe671('0x26')][_0xe671('0x22')]({'where':{'type':_0x15e433,'resourceId':_0x49f190['id']}})[_0xe671('0x23')](function(){return _0x511ff5;});})[_0xe671('0x23')](function(){_0x5ed70f['status'](0xcc)[_0xe671('0x27')]();});}};}function handleEntityNotFound(_0x2ca3d0,_0x346991){return function(_0x559872){if(!_0x559872){_0x2ca3d0[_0xe671('0x18')](0x194);}return _0x559872;};}function handleError(_0x6daba5,_0x3988b7){_0x3988b7=_0x3988b7||0x1f4;return function(_0x385f4f){logger['error'](_0x385f4f[_0xe671('0x28')]);if(_0x385f4f[_0xe671('0x29')]){delete _0x385f4f[_0xe671('0x29')];}_0x6daba5['status'](_0x3988b7)[_0xe671('0x2a')](_0x385f4f);};}exports[_0xe671('0x2b')]=function(_0x51b43e,_0x1087ec){var _0x3e319a={},_0x18e95b={},_0x28f014={'count':0x0,'rows':[]};var _0x3c6ac5=_[_0xe671('0x2c')](db[_0xe671('0x2d')]['rawAttributes'],function(_0x398de3){return{'name':_0x398de3['fieldName'],'type':_0x398de3[_0xe671('0x2e')][_0xe671('0x2f')]};});_0x18e95b[_0xe671('0x30')]=_['map'](_0x3c6ac5,_0xe671('0x29'));_0x18e95b[_0xe671('0x31')]=_['keys'](_0x51b43e['query']);_0x18e95b['filters']=_[_0xe671('0x32')](_0x18e95b['model'],_0x18e95b[_0xe671('0x31')]);_0x3e319a[_0xe671('0x33')]=_['intersection'](_0x18e95b['model'],qs[_0xe671('0x34')](_0x51b43e[_0xe671('0x31')][_0xe671('0x34')]));_0x3e319a[_0xe671('0x33')]=_0x3e319a['attributes'][_0xe671('0x35')]?_0x3e319a[_0xe671('0x33')]:_0x18e95b[_0xe671('0x30')];if(!_0x51b43e[_0xe671('0x31')]['hasOwnProperty']('nolimit')){_0x3e319a[_0xe671('0x1d')]=qs[_0xe671('0x1d')](_0x51b43e[_0xe671('0x31')][_0xe671('0x1d')]);_0x3e319a[_0xe671('0x1b')]=qs[_0xe671('0x1b')](_0x51b43e[_0xe671('0x31')][_0xe671('0x1b')]);}_0x3e319a[_0xe671('0x36')]=qs[_0xe671('0x37')](_0x51b43e['query'][_0xe671('0x37')]);_0x3e319a[_0xe671('0x38')]=qs[_0xe671('0x39')](_['pick'](_0x51b43e[_0xe671('0x31')],_0x18e95b[_0xe671('0x39')]),_0x3c6ac5);if(_0x51b43e[_0xe671('0x31')]['filter']){_0x3e319a['where']=_['merge'](_0x3e319a['where'],{'$or':_[_0xe671('0x2c')](_0x3c6ac5,function(_0x56bf3c){if(_0x56bf3c[_0xe671('0x2e')]!==_0xe671('0x3a')){var _0x40f892={};_0x40f892[_0x56bf3c[_0xe671('0x29')]]={'$like':'%'+_0x51b43e[_0xe671('0x31')]['filter']+'%'};return _0x40f892;}})});}_0x3e319a=_[_0xe671('0x3b')]({},_0x3e319a,_0x51b43e[_0xe671('0x3c')]);var _0x370ef8={'where':_0x3e319a[_0xe671('0x38')]};return db[_0xe671('0x2d')][_0xe671('0x1e')](_0x370ef8)[_0xe671('0x23')](function(_0xc0e8ce){_0x28f014[_0xe671('0x1e')]=_0xc0e8ce;if(_0x51b43e[_0xe671('0x31')]['includeAll']){_0x3e319a[_0xe671('0x3d')]=[{'all':!![]}];}return db['JscriptyProject'][_0xe671('0x3e')](_0x3e319a);})[_0xe671('0x23')](function(_0x4e99bc){_0x28f014['rows']=_0x4e99bc;return _0x28f014;})[_0xe671('0x23')](respondWithFilteredResult(_0x1087ec,_0x3e319a))[_0xe671('0x3f')](handleError(_0x1087ec,null));};exports[_0xe671('0x40')]=function(_0x2bdf2b,_0x1bdc4b){var _0x8a4e28={'raw':![],'where':{'id':_0x2bdf2b['params']['id']}},_0x354b72={};_0x354b72[_0xe671('0x30')]=_[_0xe671('0x41')](db[_0xe671('0x2d')]['rawAttributes']);_0x354b72['query']=_[_0xe671('0x41')](_0x2bdf2b[_0xe671('0x31')]);_0x354b72['filters']=_[_0xe671('0x32')](_0x354b72['model'],_0x354b72[_0xe671('0x31')]);_0x8a4e28[_0xe671('0x33')]=_[_0xe671('0x32')](_0x354b72[_0xe671('0x30')],qs['fields'](_0x2bdf2b[_0xe671('0x31')][_0xe671('0x34')]));_0x8a4e28['attributes']=_0x8a4e28['attributes']['length']?_0x8a4e28[_0xe671('0x33')]:_0x354b72[_0xe671('0x30')];if(_0x2bdf2b['query'][_0xe671('0x42')]){_0x8a4e28[_0xe671('0x3d')]=[{'all':!![]}];}_0x8a4e28=_[_0xe671('0x3b')]({},_0x8a4e28,_0x2bdf2b['options']);return db[_0xe671('0x2d')]['find'](_0x8a4e28)[_0xe671('0x23')](handleEntityNotFound(_0x1bdc4b,null))['then'](respondWithResult(_0x1bdc4b,null))[_0xe671('0x3f')](handleError(_0x1bdc4b,null));};exports[_0xe671('0x43')]=function(_0x470996,_0x525888){return db['JscriptyProject'][_0xe671('0x43')](_0x470996[_0xe671('0x44')],{})[_0xe671('0x23')](function(_0x755624){var _0x25c708=_0x470996[_0xe671('0x45')][_0xe671('0x24')]({'plain':!![]});if(!_0x25c708)throw new Error(_0xe671('0x46'));if(_0x25c708['role']===_0xe671('0x45')){var _0x2cfbfd=_0x755624[_0xe671('0x24')]({'plain':!![]});var _0x3b0afc='Projects';return db['UserProfileSection'][_0xe671('0x47')]({'where':{'name':_0x3b0afc,'userProfileId':_0x25c708[_0xe671('0x48')]},'raw':!![]})['then'](function(_0x1e059d){if(_0x1e059d&&_0x1e059d[_0xe671('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x2cfbfd[_0xe671('0x29')],'resourceId':_0x2cfbfd['id'],'type':_0x1e059d[_0xe671('0x29')],'sectionId':_0x1e059d['id']},{})[_0xe671('0x23')](function(){return _0x755624;});}else{return _0x755624;}})[_0xe671('0x3f')](function(_0x491ca6){logger['error'](_0xe671('0x4a'),_0x491ca6);throw _0x491ca6;});}return _0x755624;})[_0xe671('0x23')](respondWithResult(_0x525888,0xc9))[_0xe671('0x3f')](handleError(_0x525888,null));};exports[_0xe671('0x4b')]=function(_0x3428a4,_0x1e943d){var _0xfebefe={'where':{'id':_0x3428a4[_0xe671('0x4c')]['id']}},_0x18bcbc={};_0x18bcbc[_0xe671('0x30')]=_[_0xe671('0x41')](db[_0xe671('0x2d')][_0xe671('0x4d')]);_0xfebefe[_0xe671('0x33')]=_[_0xe671('0x32')](_0x18bcbc['model'],qs['fields'](_0x3428a4[_0xe671('0x31')][_0xe671('0x34')]));_0xfebefe[_0xe671('0x33')]=_0xfebefe[_0xe671('0x33')][_0xe671('0x35')]?_0xfebefe['attributes']:_0x18bcbc['model'];if(_0x3428a4['query'][_0xe671('0x42')]){_0xfebefe['include']=[{'all':!![]}];}_0xfebefe=_[_0xe671('0x3b')]({},_0xfebefe,_0x3428a4[_0xe671('0x3c')]);return db[_0xe671('0x2d')][_0xe671('0x47')](_0xfebefe)[_0xe671('0x23')](handleEntityNotFound(_0x1e943d,null))[_0xe671('0x23')](function(_0x244f82){if(_0x244f82){var _0x555c61=_0x244f82[_0xe671('0x24')]({'plain':!![]});_0x555c61=qs['omit'](_0x555c61,['id',_0xe671('0x4e'),_0xe671('0x4f')]);_0x3428a4[_0xe671('0x44')]=_[_0xe671('0x50')](_0x3428a4[_0xe671('0x44')],['id',_0xe671('0x4e'),_0xe671('0x4f')]);return db[_0xe671('0x2d')]['create'](_[_0xe671('0x3b')](_0x555c61,_0x3428a4[_0xe671('0x44')]),{'include':_0x3428a4[_0xe671('0x31')][_0xe671('0x42')]?[{'all':!![]}]:undefined})[_0xe671('0x23')](function(_0x102429){var _0x1b2fca=_0x3428a4[_0xe671('0x45')][_0xe671('0x24')]({'plain':!![]});if(!_0x1b2fca)throw new Error(_0xe671('0x46'));if(_0x1b2fca[_0xe671('0x51')]===_0xe671('0x45')){var _0x3c0882=_0x102429[_0xe671('0x24')]({'plain':!![]});var _0x68e5e7=_0xe671('0x25');return db[_0xe671('0x52')]['find']({'where':{'name':_0x68e5e7,'userProfileId':_0x1b2fca['userProfileId']},'raw':!![]})['then'](function(_0x13269e){if(_0x13269e&&_0x13269e[_0xe671('0x49')]===0x0){return db['UserProfileResource'][_0xe671('0x43')]({'name':_0x3c0882[_0xe671('0x29')],'resourceId':_0x3c0882['id'],'type':_0x13269e['name'],'sectionId':_0x13269e['id']},{})['then'](function(){return _0x102429;});}else{return _0x102429;}})['catch'](function(_0x4438b7){logger[_0xe671('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4438b7);throw _0x4438b7;});}return _0x102429;});}})[_0xe671('0x23')](respondWithResult(_0x1e943d,0xc9))[_0xe671('0x3f')](handleError(_0x1e943d,null));};exports[_0xe671('0x54')]=function(_0x429eff,_0x334fef){if(_0x429eff['body']['id']){delete _0x429eff[_0xe671('0x44')]['id'];}return db[_0xe671('0x2d')]['find']({'where':{'id':_0x429eff[_0xe671('0x4c')]['id']}})[_0xe671('0x23')](handleEntityNotFound(_0x334fef,null))[_0xe671('0x23')](saveUpdates(_0x429eff[_0xe671('0x44')],null))[_0xe671('0x23')](respondWithResult(_0x334fef,null))[_0xe671('0x3f')](handleError(_0x334fef,null));};exports[_0xe671('0x22')]=function(_0x47a8ec,_0x2eaf09){return db[_0xe671('0x2d')][_0xe671('0x47')]({'where':{'id':_0x47a8ec[_0xe671('0x4c')]['id']}})[_0xe671('0x23')](handleEntityNotFound(_0x2eaf09,null))[_0xe671('0x23')](removeEntity(_0x2eaf09,null))['catch'](handleError(_0x2eaf09,null));};exports[_0xe671('0x55')]=function(_0x210f66,_0x2e6ce1,_0x4eaeb2){var _0x544866={'raw':!![],'where':{}};var _0x72bf00={};var _0xe13349={'count':0x0,'rows':[]};return db[_0xe671('0x2d')][_0xe671('0x56')]({'where':{'id':_0x210f66[_0xe671('0x4c')]['id']}})[_0xe671('0x23')](handleEntityNotFound(_0x2e6ce1,null))[_0xe671('0x23')](function(_0x104e3a){if(_0x104e3a){_0x72bf00[_0xe671('0x30')]=_['keys'](db[_0xe671('0x57')]['rawAttributes']);_0x72bf00[_0xe671('0x31')]=_['keys'](_0x210f66['query']);_0x72bf00['filters']=_[_0xe671('0x32')](_0x72bf00[_0xe671('0x30')],_0x72bf00['query']);_0x544866['attributes']=_[_0xe671('0x32')](_0x72bf00[_0xe671('0x30')],qs[_0xe671('0x34')](_0x210f66[_0xe671('0x31')][_0xe671('0x34')]));_0x544866[_0xe671('0x33')]=_0x544866[_0xe671('0x33')][_0xe671('0x35')]?_0x544866[_0xe671('0x33')]:_0x72bf00[_0xe671('0x30')];if(!_0x210f66['query'][_0xe671('0x58')]('nolimit')){_0x544866['limit']=qs[_0xe671('0x1d')](_0x210f66[_0xe671('0x31')][_0xe671('0x1d')]);_0x544866[_0xe671('0x1b')]=qs[_0xe671('0x1b')](_0x210f66[_0xe671('0x31')][_0xe671('0x1b')]);}_0x544866[_0xe671('0x36')]=qs[_0xe671('0x37')](_0x210f66[_0xe671('0x31')][_0xe671('0x37')]);_0x544866[_0xe671('0x38')]=qs['filters'](_[_0xe671('0x59')](_0x210f66[_0xe671('0x31')],_0x72bf00[_0xe671('0x39')]));_0x544866[_0xe671('0x38')][_0xe671('0x5a')]=_0x104e3a['id'];if(_0x210f66[_0xe671('0x31')][_0xe671('0x5b')]){_0x544866['where']=_['merge'](_0x544866[_0xe671('0x38')],{'$or':_['map'](_0x544866[_0xe671('0x33')],function(_0x1e0eeb){var _0x53ae8f={};_0x53ae8f[_0x1e0eeb]={'$like':'%'+_0x210f66[_0xe671('0x31')][_0xe671('0x5b')]+'%'};return _0x53ae8f;})});}_0x544866=_[_0xe671('0x3b')]({},_0x544866,_0x210f66[_0xe671('0x3c')]);return db[_0xe671('0x57')]['count']({'where':_0x544866[_0xe671('0x38')]})[_0xe671('0x23')](function(_0x14ba24){_0xe13349[_0xe671('0x1e')]=_0x14ba24;if(_0x210f66[_0xe671('0x31')][_0xe671('0x42')]){_0x544866[_0xe671('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x544866);})[_0xe671('0x23')](function(_0x4bf993){_0xe13349[_0xe671('0x5c')]=_0x4bf993;return _0xe13349;});}})[_0xe671('0x23')](respondWithFilteredResult(_0x2e6ce1,_0x544866))['catch'](handleError(_0x2e6ce1,null));};exports['getAnswers']=function(_0x4a4642,_0x5dcace,_0x5366c7){var _0x18585b={'raw':!![],'where':{}};var _0x41fec2={};var _0x538f84={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xe671('0x56')]({'where':{'id':_0x4a4642[_0xe671('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5dcace,null))[_0xe671('0x23')](function(_0x32d3bf){if(_0x32d3bf){_0x41fec2['model']=_[_0xe671('0x41')](db['JscriptyAnswerReport'][_0xe671('0x4d')]);_0x41fec2['query']=_[_0xe671('0x41')](_0x4a4642[_0xe671('0x31')]);_0x41fec2[_0xe671('0x39')]=_['intersection'](_0x41fec2[_0xe671('0x30')],_0x41fec2[_0xe671('0x31')]);_0x18585b[_0xe671('0x33')]=_[_0xe671('0x32')](_0x41fec2[_0xe671('0x30')],qs['fields'](_0x4a4642['query']['fields']));_0x18585b[_0xe671('0x33')]=_0x18585b['attributes']['length']?_0x18585b[_0xe671('0x33')]:_0x41fec2['model'];if(!_0x4a4642[_0xe671('0x31')][_0xe671('0x58')](_0xe671('0x5d'))){_0x18585b['limit']=qs[_0xe671('0x1d')](_0x4a4642[_0xe671('0x31')][_0xe671('0x1d')]);_0x18585b[_0xe671('0x1b')]=qs[_0xe671('0x1b')](_0x4a4642[_0xe671('0x31')][_0xe671('0x1b')]);}_0x18585b[_0xe671('0x36')]=qs['sort'](_0x4a4642[_0xe671('0x31')][_0xe671('0x37')]);_0x18585b[_0xe671('0x38')]=qs[_0xe671('0x39')](_[_0xe671('0x59')](_0x4a4642[_0xe671('0x31')],_0x41fec2[_0xe671('0x39')]));_0x18585b['where'][_0xe671('0x5a')]=_0x32d3bf['id'];if(_0x4a4642[_0xe671('0x31')][_0xe671('0x5b')]){_0x18585b[_0xe671('0x38')]=_[_0xe671('0x3b')](_0x18585b[_0xe671('0x38')],{'$or':_[_0xe671('0x2c')](_0x18585b['attributes'],function(_0x118342){var _0x146bf7={};_0x146bf7[_0x118342]={'$like':'%'+_0x4a4642[_0xe671('0x31')]['filter']+'%'};return _0x146bf7;})});}_0x18585b=_[_0xe671('0x3b')]({},_0x18585b,_0x4a4642['options']);return db[_0xe671('0x5e')]['count']({'where':_0x18585b['where']})['then'](function(_0x2a55c8){_0x538f84[_0xe671('0x1e')]=_0x2a55c8;if(_0x4a4642[_0xe671('0x31')][_0xe671('0x42')]){_0x18585b['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xe671('0x3e')](_0x18585b);})[_0xe671('0x23')](function(_0x67a47a){_0x538f84[_0xe671('0x5c')]=_0x67a47a;return _0x538f84;});}})[_0xe671('0x23')](respondWithFilteredResult(_0x5dcace,_0x18585b))[_0xe671('0x3f')](handleError(_0x5dcace,null));};function char(_0x136dfc){return _0xe671('0x5f')===typeof _0x136dfc?String['fromCharCode']['apply'](null,arguments):_0x136dfc;}function needsEncapsulation(_0x44cb06){return!!_0x44cb06&&(_0x44cb06['toString']()['indexOf'](char(0xd))>=0x0||_0x44cb06[_0xe671('0x60')]()[_0xe671('0x61')](char(0xa))>=0x0||_0x44cb06[_0xe671('0x60')]()[_0xe671('0x61')](char(0x2c))>=0x0||_0x44cb06[_0xe671('0x60')]()[_0xe671('0x61')](char(0x22))>=0x0);}function encapsulate(_0x6b2263){var _0x103860=char(0x22),_0x38a32a='\x5c'+char(0x22),_0x21db9b=_0x6b2263['toString']()[_0xe671('0x62')](new RegExp(_0x103860,'g'),_0x38a32a);return _0x103860+_0x21db9b+_0x103860;}exports[_0xe671('0x63')]=function(_0x5d395d,_0x5228a8,_0x5016e3){var _0x141386,_0x1b529b;var _0x208ec6={'where':{'ProjectId':_0x5d395d['params']['id']}};if(_0x5d395d[_0xe671('0x31')]['startTime']){_0x208ec6['where'][_0xe671('0x64')]=JSON[_0xe671('0x65')](_0x5d395d['query'][_0xe671('0x66')]);}return db[_0xe671('0x57')][_0xe671('0x3e')](_0x208ec6)['then'](handleEntityNotFound(_0x5228a8,null))[_0xe671('0x23')](function(_0x2a4dd6){if(_0x2a4dd6){_0x141386=_0x2a4dd6;return db[_0xe671('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0xe671('0x2c')](_0x141386,'id')},'ProjectId':_0x5d395d[_0xe671('0x4c')]['id']},'order':_0xe671('0x68')});}})[_0xe671('0x23')](handleEntityNotFound(_0x5228a8,null))['then'](function(_0x540028){if(_0x540028){_0x1b529b=_0x540028;var _0x15fd6d={};for(var _0x565b5d=0x0,_0x41d8bd=_0x1b529b['length'];_0x565b5d<_0x41d8bd;_0x565b5d++){if(!_0x15fd6d[_0xe671('0x58')](_0x1b529b[_0x565b5d]['questionId'])){_0x15fd6d[_0x1b529b[_0x565b5d][_0xe671('0x69')]]=needsEncapsulation(_0x1b529b[_0x565b5d][_0xe671('0x6a')])?encapsulate(_0x1b529b[_0x565b5d][_0xe671('0x6a')]):_0x1b529b[_0x565b5d][_0xe671('0x6a')];}}var _0x3fa327=[],_0xc22114={};for(var _0x5bcdf5=0x0,_0x5b5102=_0x141386[_0xe671('0x35')];_0x5bcdf5<_0x5b5102;_0x5bcdf5++){_0xc22114={'ProjectId':_0x5d395d['params']['id'],'SessionId':_0x141386[_0x5bcdf5]['id'],'StartTime':moment(_0x141386[_0x5bcdf5][_0xe671('0x64')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x37bad5=0x0,_0x1fb161=_0x1b529b['length'];_0x37bad5<_0x1fb161;_0x37bad5++){if(_0x1b529b[_0x37bad5]['SessionId']==_0x141386[_0x5bcdf5]['id']&&_0x15fd6d[_0xe671('0x58')](_0x1b529b[_0x37bad5][_0xe671('0x69')])){_0xc22114[_0x15fd6d[_0x1b529b[_0x37bad5][_0xe671('0x69')]]]=_0x1b529b[_0x37bad5]['answer'];}}for(var _0x30cef9 in _0x15fd6d){if(!_0xc22114[_0xe671('0x58')](_0x15fd6d[_0x30cef9])){_0xc22114[_0x15fd6d[_0x30cef9]]=null;}}_0x3fa327[_0xe671('0x6b')](_0xc22114);}return _0x3fa327;}})[_0xe671('0x23')](function(_0x253258){if(!_['isEmpty'](_0x253258)){var _0x2a7f71=toCsv(_0x253258);var _0x16a4cf=Date[_0xe671('0x6c')]();fs['writeFileSync'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x5d395d['params']['id'],_0x16a4cf),_0x2a7f71);_0x5228a8[_0xe671('0x6d')](_0xe671('0x6e'),'attachment;\x20filename='+util[_0xe671('0x6f')](_0xe671('0x70'),_0x5d395d[_0xe671('0x4c')]['id'],_0x16a4cf));_0x5228a8[_0xe671('0x6d')](_0xe671('0x71'),_0xe671('0x72'));return _0x5228a8[_0xe671('0x73')](util[_0xe671('0x6f')](_0xe671('0x74'),_0x5d395d[_0xe671('0x4c')]['id'],_0x16a4cf));}else{return _0x5228a8[_0xe671('0x18')](0xcc);}})['catch'](handleError(_0x5228a8,null));}; \ No newline at end of file +var _0xb240=['/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','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','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','Projects','UserProfileSection','userProfileId','autoAssociation','clone','createdAt','updatedAt','omit','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','isEmpty','writeFileSync','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download'];(function(_0x2427a3,_0x109751){var _0x50b56e=function(_0x5e3cb6){while(--_0x5e3cb6){_0x2427a3['push'](_0x2427a3['shift']());}};_0x50b56e(++_0x109751);}(_0xb240,0x7e));var _0x0b24=function(_0x3bc243,_0x1115b9){_0x3bc243=_0x3bc243-0x0;var _0x396460=_0xb240[_0x3bc243];return _0x396460;};'use strict';var emlformat=require(_0x0b24('0x0'));var rimraf=require(_0x0b24('0x1'));var zipdir=require(_0x0b24('0x2'));var jsonpatch=require(_0x0b24('0x3'));var rp=require(_0x0b24('0x4'));var moment=require(_0x0b24('0x5'));var BPromise=require(_0x0b24('0x6'));var Mustache=require(_0x0b24('0x7'));var util=require(_0x0b24('0x8'));var path=require('path');var sox=require(_0x0b24('0x9'));var csv=require(_0x0b24('0xa'));var ejs=require(_0x0b24('0xb'));var fs=require('fs');var fs_extra=require(_0x0b24('0xc'));var _=require(_0x0b24('0xd'));var squel=require('squel');var crypto=require(_0x0b24('0xe'));var jsforce=require(_0x0b24('0xf'));var deskjs=require(_0x0b24('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b24('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0b24('0x12'));var as=require(_0x0b24('0x13'));var hardwareService=require(_0x0b24('0x14'));var logger=require(_0x0b24('0x15'))(_0x0b24('0x16'));var utils=require(_0x0b24('0x17'));var config=require(_0x0b24('0x18'));var licenseUtil=require(_0x0b24('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46957d,_0x2381a1){_0x2381a1=_0x2381a1||0xcc;return function(_0x4bb796){if(_0x4bb796){return _0x46957d[_0x0b24('0x1a')](_0x2381a1);}return _0x46957d[_0x0b24('0x1b')](_0x2381a1)[_0x0b24('0x1c')]();};}function respondWithResult(_0x452889,_0x5dc21f){_0x5dc21f=_0x5dc21f||0xc8;return function(_0x4b60fc){if(_0x4b60fc){return _0x452889['status'](_0x5dc21f)['json'](_0x4b60fc);}};}function respondWithFilteredResult(_0x2ea61f,_0x1aae67){return function(_0x459bb1){if(_0x459bb1){var _0x5c2ee7=typeof _0x1aae67[_0x0b24('0x1d')]===_0x0b24('0x1e')&&typeof _0x1aae67[_0x0b24('0x1f')]===_0x0b24('0x1e');var _0xa28e7e=_0x459bb1[_0x0b24('0x20')];var _0x5518a5=_0x5c2ee7?0x0:_0x1aae67[_0x0b24('0x1d')];var _0x1d619f=_0x5c2ee7?_0x459bb1['count']:_0x1aae67[_0x0b24('0x1d')]+_0x1aae67['limit'];var _0x5b395f;if(_0x1d619f>=_0xa28e7e){_0x1d619f=_0xa28e7e;_0x5b395f=0xc8;}else{_0x5b395f=0xce;}_0x2ea61f[_0x0b24('0x1b')](_0x5b395f);return _0x2ea61f[_0x0b24('0x21')](_0x0b24('0x22'),_0x5518a5+'-'+_0x1d619f+'/'+_0xa28e7e)['json'](_0x459bb1);}return null;};}function patchUpdates(_0x2fec2b){return function(_0x3c0260){try{jsonpatch['apply'](_0x3c0260,_0x2fec2b,!![]);}catch(_0x20c5d5){return BPromise[_0x0b24('0x23')](_0x20c5d5);}return _0x3c0260[_0x0b24('0x24')]();};}function saveUpdates(_0x1e1746,_0x46124d){return function(_0x3302e4){if(_0x3302e4){return _0x3302e4[_0x0b24('0x25')](_0x1e1746)[_0x0b24('0x26')](function(_0x454500){return _0x454500;});}return null;};}function removeEntity(_0x59483c,_0x55ae1c){return function(_0x1f88cf){if(_0x1f88cf){return _0x1f88cf[_0x0b24('0x27')]()[_0x0b24('0x26')](function(){var _0xc93a22=_0x1f88cf['get']({'plain':!![]});var _0x294d39='Projects';return db[_0x0b24('0x28')][_0x0b24('0x27')]({'where':{'type':_0x294d39,'resourceId':_0xc93a22['id']}})[_0x0b24('0x26')](function(){return _0x1f88cf;});})[_0x0b24('0x26')](function(){_0x59483c[_0x0b24('0x1b')](0xcc)[_0x0b24('0x1c')]();});}};}function handleEntityNotFound(_0x26fd02,_0x3af4d0){return function(_0x1a40e7){if(!_0x1a40e7){_0x26fd02[_0x0b24('0x1a')](0x194);}return _0x1a40e7;};}function handleError(_0x1d5fd5,_0x9c9873){_0x9c9873=_0x9c9873||0x1f4;return function(_0xd47f05){logger[_0x0b24('0x29')](_0xd47f05[_0x0b24('0x2a')]);if(_0xd47f05[_0x0b24('0x2b')]){delete _0xd47f05[_0x0b24('0x2b')];}_0x1d5fd5[_0x0b24('0x1b')](_0x9c9873)[_0x0b24('0x2c')](_0xd47f05);};}exports[_0x0b24('0x2d')]=function(_0x4a5b53,_0x27c7d9){var _0x5be1ad={},_0x3b4d80={},_0x3b2487={'count':0x0,'rows':[]};var _0x5508da=_[_0x0b24('0x2e')](db[_0x0b24('0x2f')][_0x0b24('0x30')],function(_0x872e26){return{'name':_0x872e26['fieldName'],'type':_0x872e26[_0x0b24('0x31')][_0x0b24('0x32')]};});_0x3b4d80['model']=_[_0x0b24('0x2e')](_0x5508da,_0x0b24('0x2b'));_0x3b4d80[_0x0b24('0x33')]=_[_0x0b24('0x34')](_0x4a5b53[_0x0b24('0x33')]);_0x3b4d80[_0x0b24('0x35')]=_[_0x0b24('0x36')](_0x3b4d80[_0x0b24('0x37')],_0x3b4d80[_0x0b24('0x33')]);_0x5be1ad[_0x0b24('0x38')]=_['intersection'](_0x3b4d80[_0x0b24('0x37')],qs[_0x0b24('0x39')](_0x4a5b53[_0x0b24('0x33')]['fields']));_0x5be1ad[_0x0b24('0x38')]=_0x5be1ad[_0x0b24('0x38')][_0x0b24('0x3a')]?_0x5be1ad[_0x0b24('0x38')]:_0x3b4d80['model'];if(!_0x4a5b53[_0x0b24('0x33')][_0x0b24('0x3b')](_0x0b24('0x3c'))){_0x5be1ad[_0x0b24('0x1f')]=qs[_0x0b24('0x1f')](_0x4a5b53[_0x0b24('0x33')][_0x0b24('0x1f')]);_0x5be1ad[_0x0b24('0x1d')]=qs[_0x0b24('0x1d')](_0x4a5b53[_0x0b24('0x33')][_0x0b24('0x1d')]);}_0x5be1ad[_0x0b24('0x3d')]=qs[_0x0b24('0x3e')](_0x4a5b53[_0x0b24('0x33')][_0x0b24('0x3e')]);_0x5be1ad[_0x0b24('0x3f')]=qs[_0x0b24('0x35')](_[_0x0b24('0x40')](_0x4a5b53[_0x0b24('0x33')],_0x3b4d80[_0x0b24('0x35')]),_0x5508da);if(_0x4a5b53[_0x0b24('0x33')][_0x0b24('0x41')]){_0x5be1ad[_0x0b24('0x3f')]=_[_0x0b24('0x42')](_0x5be1ad['where'],{'$or':_[_0x0b24('0x2e')](_0x5508da,function(_0x1d887a){if(_0x1d887a[_0x0b24('0x31')]!==_0x0b24('0x43')){var _0x383d77={};_0x383d77[_0x1d887a[_0x0b24('0x2b')]]={'$like':'%'+_0x4a5b53[_0x0b24('0x33')][_0x0b24('0x41')]+'%'};return _0x383d77;}})});}_0x5be1ad=_[_0x0b24('0x42')]({},_0x5be1ad,_0x4a5b53[_0x0b24('0x44')]);var _0x53a721={'where':_0x5be1ad[_0x0b24('0x3f')]};return db['JscriptyProject'][_0x0b24('0x20')](_0x53a721)[_0x0b24('0x26')](function(_0x3e3972){_0x3b2487['count']=_0x3e3972;if(_0x4a5b53['query'][_0x0b24('0x45')]){_0x5be1ad['include']=[{'all':!![]}];}return db[_0x0b24('0x2f')][_0x0b24('0x46')](_0x5be1ad);})[_0x0b24('0x26')](function(_0x5153bd){_0x3b2487[_0x0b24('0x47')]=_0x5153bd;return _0x3b2487;})['then'](respondWithFilteredResult(_0x27c7d9,_0x5be1ad))[_0x0b24('0x48')](handleError(_0x27c7d9,null));};exports[_0x0b24('0x49')]=function(_0x5cd950,_0x4bc6f6){var _0x2984d0={'raw':![],'where':{'id':_0x5cd950[_0x0b24('0x4a')]['id']}},_0x4d373f={};_0x4d373f[_0x0b24('0x37')]=_[_0x0b24('0x34')](db[_0x0b24('0x2f')][_0x0b24('0x30')]);_0x4d373f[_0x0b24('0x33')]=_[_0x0b24('0x34')](_0x5cd950['query']);_0x4d373f[_0x0b24('0x35')]=_[_0x0b24('0x36')](_0x4d373f[_0x0b24('0x37')],_0x4d373f['query']);_0x2984d0[_0x0b24('0x38')]=_['intersection'](_0x4d373f[_0x0b24('0x37')],qs[_0x0b24('0x39')](_0x5cd950[_0x0b24('0x33')]['fields']));_0x2984d0['attributes']=_0x2984d0[_0x0b24('0x38')][_0x0b24('0x3a')]?_0x2984d0[_0x0b24('0x38')]:_0x4d373f[_0x0b24('0x37')];if(_0x5cd950['query'][_0x0b24('0x45')]){_0x2984d0[_0x0b24('0x4b')]=[{'all':!![]}];}_0x2984d0=_[_0x0b24('0x42')]({},_0x2984d0,_0x5cd950[_0x0b24('0x44')]);return db[_0x0b24('0x2f')][_0x0b24('0x4c')](_0x2984d0)[_0x0b24('0x26')](handleEntityNotFound(_0x4bc6f6,null))[_0x0b24('0x26')](respondWithResult(_0x4bc6f6,null))[_0x0b24('0x48')](handleError(_0x4bc6f6,null));};exports[_0x0b24('0x4d')]=function(_0x5b1e28,_0xbf9e7f){return db[_0x0b24('0x2f')]['create'](_0x5b1e28[_0x0b24('0x4e')],{})[_0x0b24('0x26')](function(_0x556e00){var _0x4508b9=_0x5b1e28['user']['get']({'plain':!![]});if(!_0x4508b9)throw new Error(_0x0b24('0x4f'));if(_0x4508b9['role']===_0x0b24('0x50')){var _0x3e790b=_0x556e00[_0x0b24('0x51')]({'plain':!![]});var _0x5a9762=_0x0b24('0x52');return db[_0x0b24('0x53')][_0x0b24('0x4c')]({'where':{'name':_0x5a9762,'userProfileId':_0x4508b9[_0x0b24('0x54')]},'raw':!![]})['then'](function(_0x136928){if(_0x136928&&_0x136928[_0x0b24('0x55')]===0x0){return db[_0x0b24('0x28')][_0x0b24('0x4d')]({'name':_0x3e790b[_0x0b24('0x2b')],'resourceId':_0x3e790b['id'],'type':_0x136928[_0x0b24('0x2b')],'sectionId':_0x136928['id']},{})['then'](function(){return _0x556e00;});}else{return _0x556e00;}})[_0x0b24('0x48')](function(_0xcae01c){logger[_0x0b24('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcae01c);throw _0xcae01c;});}return _0x556e00;})[_0x0b24('0x26')](respondWithResult(_0xbf9e7f,0xc9))['catch'](handleError(_0xbf9e7f,null));};exports[_0x0b24('0x56')]=function(_0x1142ed,_0x40d5f5){var _0x185ec6={'where':{'id':_0x1142ed['params']['id']}},_0x43ab99={};_0x43ab99['model']=_[_0x0b24('0x34')](db[_0x0b24('0x2f')][_0x0b24('0x30')]);_0x185ec6['attributes']=_[_0x0b24('0x36')](_0x43ab99[_0x0b24('0x37')],qs[_0x0b24('0x39')](_0x1142ed[_0x0b24('0x33')][_0x0b24('0x39')]));_0x185ec6['attributes']=_0x185ec6[_0x0b24('0x38')][_0x0b24('0x3a')]?_0x185ec6[_0x0b24('0x38')]:_0x43ab99['model'];if(_0x1142ed[_0x0b24('0x33')][_0x0b24('0x45')]){_0x185ec6[_0x0b24('0x4b')]=[{'all':!![]}];}_0x185ec6=_[_0x0b24('0x42')]({},_0x185ec6,_0x1142ed[_0x0b24('0x44')]);return db[_0x0b24('0x2f')]['find'](_0x185ec6)[_0x0b24('0x26')](handleEntityNotFound(_0x40d5f5,null))['then'](function(_0x17f3f1){if(_0x17f3f1){var _0x18fabe=_0x17f3f1['get']({'plain':!![]});_0x18fabe=qs['omit'](_0x18fabe,['id',_0x0b24('0x57'),_0x0b24('0x58')]);_0x1142ed['body']=_[_0x0b24('0x59')](_0x1142ed['body'],['id',_0x0b24('0x57'),'updatedAt']);return db[_0x0b24('0x2f')][_0x0b24('0x4d')](_['merge'](_0x18fabe,_0x1142ed[_0x0b24('0x4e')]),{'include':_0x1142ed[_0x0b24('0x33')][_0x0b24('0x45')]?[{'all':!![]}]:undefined})[_0x0b24('0x26')](function(_0x62ec5d){var _0x33e8de=_0x1142ed['user']['get']({'plain':!![]});if(!_0x33e8de)throw new Error(_0x0b24('0x4f'));if(_0x33e8de[_0x0b24('0x5a')]===_0x0b24('0x50')){var _0x4248aa=_0x62ec5d[_0x0b24('0x51')]({'plain':!![]});var _0x1bb687=_0x0b24('0x52');return db['UserProfileSection'][_0x0b24('0x4c')]({'where':{'name':_0x1bb687,'userProfileId':_0x33e8de[_0x0b24('0x54')]},'raw':!![]})[_0x0b24('0x26')](function(_0x2cabb8){if(_0x2cabb8&&_0x2cabb8['autoAssociation']===0x0){return db['UserProfileResource'][_0x0b24('0x4d')]({'name':_0x4248aa[_0x0b24('0x2b')],'resourceId':_0x4248aa['id'],'type':_0x2cabb8[_0x0b24('0x2b')],'sectionId':_0x2cabb8['id']},{})[_0x0b24('0x26')](function(){return _0x62ec5d;});}else{return _0x62ec5d;}})[_0x0b24('0x48')](function(_0x12cf6d){logger[_0x0b24('0x29')](_0x0b24('0x5b'),_0x12cf6d);throw _0x12cf6d;});}return _0x62ec5d;});}})[_0x0b24('0x26')](respondWithResult(_0x40d5f5,0xc9))[_0x0b24('0x48')](handleError(_0x40d5f5,null));};exports[_0x0b24('0x25')]=function(_0x49b9ac,_0x114b12){if(_0x49b9ac[_0x0b24('0x4e')]['id']){delete _0x49b9ac[_0x0b24('0x4e')]['id'];}return db[_0x0b24('0x2f')][_0x0b24('0x4c')]({'where':{'id':_0x49b9ac[_0x0b24('0x4a')]['id']}})[_0x0b24('0x26')](handleEntityNotFound(_0x114b12,null))[_0x0b24('0x26')](saveUpdates(_0x49b9ac['body'],null))[_0x0b24('0x26')](respondWithResult(_0x114b12,null))['catch'](handleError(_0x114b12,null));};exports[_0x0b24('0x27')]=function(_0x5b754c,_0x4c1928){return db[_0x0b24('0x2f')][_0x0b24('0x4c')]({'where':{'id':_0x5b754c['params']['id']}})['then'](handleEntityNotFound(_0x4c1928,null))[_0x0b24('0x26')](removeEntity(_0x4c1928,null))[_0x0b24('0x48')](handleError(_0x4c1928,null));};exports[_0x0b24('0x5c')]=function(_0xcd72db,_0x1dc8f1,_0x4c4fed){var _0x3e8568={'raw':!![],'where':{}};var _0x1b43b7={};var _0x5dd846={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x0b24('0x5d')]({'where':{'id':_0xcd72db['params']['id']}})[_0x0b24('0x26')](handleEntityNotFound(_0x1dc8f1,null))[_0x0b24('0x26')](function(_0x359120){if(_0x359120){_0x1b43b7[_0x0b24('0x37')]=_[_0x0b24('0x34')](db['JscriptySessionReport'][_0x0b24('0x30')]);_0x1b43b7['query']=_['keys'](_0xcd72db[_0x0b24('0x33')]);_0x1b43b7['filters']=_['intersection'](_0x1b43b7[_0x0b24('0x37')],_0x1b43b7[_0x0b24('0x33')]);_0x3e8568[_0x0b24('0x38')]=_['intersection'](_0x1b43b7[_0x0b24('0x37')],qs[_0x0b24('0x39')](_0xcd72db[_0x0b24('0x33')][_0x0b24('0x39')]));_0x3e8568[_0x0b24('0x38')]=_0x3e8568[_0x0b24('0x38')]['length']?_0x3e8568['attributes']:_0x1b43b7[_0x0b24('0x37')];if(!_0xcd72db[_0x0b24('0x33')][_0x0b24('0x3b')](_0x0b24('0x3c'))){_0x3e8568[_0x0b24('0x1f')]=qs[_0x0b24('0x1f')](_0xcd72db[_0x0b24('0x33')][_0x0b24('0x1f')]);_0x3e8568[_0x0b24('0x1d')]=qs[_0x0b24('0x1d')](_0xcd72db[_0x0b24('0x33')][_0x0b24('0x1d')]);}_0x3e8568[_0x0b24('0x3d')]=qs[_0x0b24('0x3e')](_0xcd72db['query'][_0x0b24('0x3e')]);_0x3e8568[_0x0b24('0x3f')]=qs[_0x0b24('0x35')](_[_0x0b24('0x40')](_0xcd72db[_0x0b24('0x33')],_0x1b43b7[_0x0b24('0x35')]));_0x3e8568['where'][_0x0b24('0x5e')]=_0x359120['id'];if(_0xcd72db['query'][_0x0b24('0x41')]){_0x3e8568[_0x0b24('0x3f')]=_[_0x0b24('0x42')](_0x3e8568['where'],{'$or':_['map'](_0x3e8568[_0x0b24('0x38')],function(_0x5a4d99){var _0x11e42a={};_0x11e42a[_0x5a4d99]={'$like':'%'+_0xcd72db[_0x0b24('0x33')]['filter']+'%'};return _0x11e42a;})});}_0x3e8568=_[_0x0b24('0x42')]({},_0x3e8568,_0xcd72db['options']);return db['JscriptySessionReport'][_0x0b24('0x20')]({'where':_0x3e8568[_0x0b24('0x3f')]})[_0x0b24('0x26')](function(_0x2c1ff5){_0x5dd846[_0x0b24('0x20')]=_0x2c1ff5;if(_0xcd72db[_0x0b24('0x33')]['includeAll']){_0x3e8568['include']=[{'all':!![]}];}return db[_0x0b24('0x5f')][_0x0b24('0x46')](_0x3e8568);})['then'](function(_0x28b4fc){_0x5dd846[_0x0b24('0x47')]=_0x28b4fc;return _0x5dd846;});}})[_0x0b24('0x26')](respondWithFilteredResult(_0x1dc8f1,_0x3e8568))['catch'](handleError(_0x1dc8f1,null));};exports[_0x0b24('0x60')]=function(_0x33b85a,_0x5e77ac,_0x3fc8cf){var _0xcc015b={'raw':!![],'where':{}};var _0x21c974={};var _0x30698e={'count':0x0,'rows':[]};return db[_0x0b24('0x2f')][_0x0b24('0x5d')]({'where':{'id':_0x33b85a[_0x0b24('0x4a')]['id']}})[_0x0b24('0x26')](handleEntityNotFound(_0x5e77ac,null))['then'](function(_0xaae528){if(_0xaae528){_0x21c974['model']=_[_0x0b24('0x34')](db[_0x0b24('0x61')]['rawAttributes']);_0x21c974[_0x0b24('0x33')]=_[_0x0b24('0x34')](_0x33b85a['query']);_0x21c974[_0x0b24('0x35')]=_[_0x0b24('0x36')](_0x21c974['model'],_0x21c974['query']);_0xcc015b[_0x0b24('0x38')]=_[_0x0b24('0x36')](_0x21c974[_0x0b24('0x37')],qs[_0x0b24('0x39')](_0x33b85a[_0x0b24('0x33')][_0x0b24('0x39')]));_0xcc015b['attributes']=_0xcc015b[_0x0b24('0x38')]['length']?_0xcc015b['attributes']:_0x21c974[_0x0b24('0x37')];if(!_0x33b85a[_0x0b24('0x33')][_0x0b24('0x3b')](_0x0b24('0x3c'))){_0xcc015b[_0x0b24('0x1f')]=qs[_0x0b24('0x1f')](_0x33b85a[_0x0b24('0x33')][_0x0b24('0x1f')]);_0xcc015b[_0x0b24('0x1d')]=qs[_0x0b24('0x1d')](_0x33b85a['query'][_0x0b24('0x1d')]);}_0xcc015b['order']=qs[_0x0b24('0x3e')](_0x33b85a['query'][_0x0b24('0x3e')]);_0xcc015b[_0x0b24('0x3f')]=qs[_0x0b24('0x35')](_['pick'](_0x33b85a[_0x0b24('0x33')],_0x21c974[_0x0b24('0x35')]));_0xcc015b[_0x0b24('0x3f')][_0x0b24('0x5e')]=_0xaae528['id'];if(_0x33b85a[_0x0b24('0x33')][_0x0b24('0x41')]){_0xcc015b[_0x0b24('0x3f')]=_[_0x0b24('0x42')](_0xcc015b[_0x0b24('0x3f')],{'$or':_[_0x0b24('0x2e')](_0xcc015b[_0x0b24('0x38')],function(_0x1eb14a){var _0x274451={};_0x274451[_0x1eb14a]={'$like':'%'+_0x33b85a[_0x0b24('0x33')][_0x0b24('0x41')]+'%'};return _0x274451;})});}_0xcc015b=_[_0x0b24('0x42')]({},_0xcc015b,_0x33b85a[_0x0b24('0x44')]);return db[_0x0b24('0x61')][_0x0b24('0x20')]({'where':_0xcc015b[_0x0b24('0x3f')]})[_0x0b24('0x26')](function(_0x18317c){_0x30698e[_0x0b24('0x20')]=_0x18317c;if(_0x33b85a[_0x0b24('0x33')][_0x0b24('0x45')]){_0xcc015b[_0x0b24('0x4b')]=[{'all':!![]}];}return db[_0x0b24('0x61')][_0x0b24('0x46')](_0xcc015b);})['then'](function(_0x444c17){_0x30698e[_0x0b24('0x47')]=_0x444c17;return _0x30698e;});}})['then'](respondWithFilteredResult(_0x5e77ac,_0xcc015b))['catch'](handleError(_0x5e77ac,null));};function char(_0x1c2fce){return _0x0b24('0x62')===typeof _0x1c2fce?String[_0x0b24('0x63')][_0x0b24('0x64')](null,arguments):_0x1c2fce;}function needsEncapsulation(_0x5f10eb){return!!_0x5f10eb&&(_0x5f10eb[_0x0b24('0x65')]()[_0x0b24('0x66')](char(0xd))>=0x0||_0x5f10eb[_0x0b24('0x65')]()[_0x0b24('0x66')](char(0xa))>=0x0||_0x5f10eb['toString']()[_0x0b24('0x66')](char(0x2c))>=0x0||_0x5f10eb['toString']()[_0x0b24('0x66')](char(0x22))>=0x0);}function encapsulate(_0x5649ac){var _0x178a20=char(0x22),_0x5b693d='\x5c'+char(0x22),_0x38a32d=_0x5649ac[_0x0b24('0x65')]()[_0x0b24('0x67')](new RegExp(_0x178a20,'g'),_0x5b693d);return _0x178a20+_0x38a32d+_0x178a20;}exports[_0x0b24('0x68')]=function(_0x555171,_0xc29c7d,_0x4abf45){var _0x2b8c24,_0x44074c;var _0x1c1904={'where':{'ProjectId':_0x555171[_0x0b24('0x4a')]['id']}};if(_0x555171[_0x0b24('0x33')]['startTime']){_0x1c1904[_0x0b24('0x3f')][_0x0b24('0x69')]=JSON[_0x0b24('0x6a')](_0x555171[_0x0b24('0x33')][_0x0b24('0x6b')]);}return db[_0x0b24('0x5f')][_0x0b24('0x46')](_0x1c1904)['then'](handleEntityNotFound(_0xc29c7d,null))['then'](function(_0x598a9c){if(_0x598a9c){_0x2b8c24=_0x598a9c;return db[_0x0b24('0x6c')][_0x0b24('0x46')]({'where':{'SessionId':{'$in':_[_0x0b24('0x2e')](_0x2b8c24,'id')},'ProjectId':_0x555171[_0x0b24('0x4a')]['id']},'order':_0x0b24('0x6d')});}})['then'](handleEntityNotFound(_0xc29c7d,null))[_0x0b24('0x26')](function(_0x55ded7){if(_0x55ded7){_0x44074c=_0x55ded7;var _0x566977={};for(var _0x4f5fc8=0x0,_0x2e7c1f=_0x44074c[_0x0b24('0x3a')];_0x4f5fc8<_0x2e7c1f;_0x4f5fc8++){if(!_0x566977['hasOwnProperty'](_0x44074c[_0x4f5fc8]['questionId'])){_0x566977[_0x44074c[_0x4f5fc8][_0x0b24('0x6e')]]=needsEncapsulation(_0x44074c[_0x4f5fc8][_0x0b24('0x6f')])?encapsulate(_0x44074c[_0x4f5fc8][_0x0b24('0x6f')]):_0x44074c[_0x4f5fc8][_0x0b24('0x6f')];}}var _0x254d22=[],_0x482cc6={};for(var _0x53ae0b=0x0,_0x345309=_0x2b8c24[_0x0b24('0x3a')];_0x53ae0b<_0x345309;_0x53ae0b++){_0x482cc6={'ProjectId':_0x555171[_0x0b24('0x4a')]['id'],'SessionId':_0x2b8c24[_0x53ae0b]['id'],'StartTime':moment(_0x2b8c24[_0x53ae0b][_0x0b24('0x69')])[_0x0b24('0x70')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x5b0e62=0x0,_0x4a4243=_0x44074c[_0x0b24('0x3a')];_0x5b0e62<_0x4a4243;_0x5b0e62++){if(_0x44074c[_0x5b0e62][_0x0b24('0x71')]==_0x2b8c24[_0x53ae0b]['id']&&_0x566977['hasOwnProperty'](_0x44074c[_0x5b0e62][_0x0b24('0x6e')])){_0x482cc6[_0x566977[_0x44074c[_0x5b0e62][_0x0b24('0x6e')]]]=_0x44074c[_0x5b0e62][_0x0b24('0x72')];}}for(var _0x37ebce in _0x566977){if(!_0x482cc6[_0x0b24('0x3b')](_0x566977[_0x37ebce])){_0x482cc6[_0x566977[_0x37ebce]]=null;}}_0x254d22[_0x0b24('0x73')](_0x482cc6);}return _0x254d22;}})['then'](function(_0x3f5aa7){if(!_[_0x0b24('0x74')](_0x3f5aa7)){var _0x444d50=toCsv(_0x3f5aa7);var _0x40378b=Date['now']();fs[_0x0b24('0x75')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x555171[_0x0b24('0x4a')]['id'],_0x40378b),_0x444d50);_0xc29c7d['setHeader'](_0x0b24('0x76'),_0x0b24('0x77')+util[_0x0b24('0x70')](_0x0b24('0x78'),_0x555171['params']['id'],_0x40378b));_0xc29c7d['setHeader'](_0x0b24('0x79'),_0x0b24('0x7a'));return _0xc29c7d[_0x0b24('0x7b')](util[_0x0b24('0x70')](_0x0b24('0x7c'),_0x555171['params']['id'],_0x40378b));}else{return _0xc29c7d['sendStatus'](0xcc);}})['catch'](handleError(_0xc29c7d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index e8074f0..0d76c1e 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 _0x1052=['rimraf','exports','define','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3133aa,_0x5c0b82){var _0xe348be=function(_0x17e3b6){while(--_0x17e3b6){_0x3133aa['push'](_0x3133aa['shift']());}};_0xe348be(++_0x5c0b82);}(_0x1052,0xf4));var _0x2105=function(_0x44769c,_0x4b2cc6){_0x44769c=_0x44769c-0x0;var _0x216eb5=_0x1052[_0x44769c];return _0x216eb5;};'use strict';var _=require(_0x2105('0x0'));var util=require(_0x2105('0x1'));var logger=require(_0x2105('0x2'))(_0x2105('0x3'));var moment=require(_0x2105('0x4'));var BPromise=require(_0x2105('0x5'));var rp=require(_0x2105('0x6'));var fs=require('fs');var path=require(_0x2105('0x7'));var rimraf=require(_0x2105('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x2105('0x9')]=function(_0x4a4e6b,_0x126cd9){return _0x4a4e6b[_0x2105('0xa')]('JscriptyProject',attributes,{'tableName':_0x2105('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02a7=['jscripty_projects','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x02a7,0x7a));var _0x702a=function(_0x2df5f8,_0x95e563){_0x2df5f8=_0x2df5f8-0x0;var _0x430988=_0x02a7[_0x2df5f8];return _0x430988;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rp=require(_0x702a('0x3'));var fs=require('fs');var path=require(_0x702a('0x4'));var rimraf=require(_0x702a('0x5'));var config=require(_0x702a('0x6'));var attributes=require(_0x702a('0x7'));module['exports']=function(_0x1bcfe5,_0x5b7d8c){return _0x1bcfe5[_0x702a('0x8')](_0x702a('0x9'),attributes,{'tableName':_0x702a('0xa'),'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 200acad..13801e9 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x5714e0,_0xbf4ccd){var _0x348053=function(_0x32e904){while(--_0x32e904){_0x5714e0['push'](_0x5714e0['shift']());}};_0x348053(++_0xbf4ccd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x16c60f,_0x518ed4){var _0xdb92f5=function(_0x59bc47){while(--_0x59bc47){_0x16c60f['push'](_0x16c60f['shift']());}};_0xdb92f5(++_0x518ed4);}(_0x70e0,0x17b));var _0x070e=function(_0xd7febc,_0x47c598){_0xd7febc=_0xd7febc-0x0;var _0x4e7d8e=_0x70e0[_0xd7febc];return _0x4e7d8e;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index b2b7bd5..b206691 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 _0x65b0=['/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index'];(function(_0x302069,_0x54ce82){var _0x506dd5=function(_0x2fb194){while(--_0x2fb194){_0x302069['push'](_0x302069['shift']());}};_0x506dd5(++_0x54ce82);}(_0x65b0,0x8f));var _0x065b=function(_0x250d05,_0x397c0d){_0x250d05=_0x250d05-0x0;var _0x572957=_0x65b0[_0x250d05];return _0x572957;};'use strict';var multer=require(_0x065b('0x0'));var util=require('util');var path=require(_0x065b('0x1'));var timeout=require('connect-timeout');var express=require(_0x065b('0x2'));var router=express[_0x065b('0x3')]();var fs_extra=require(_0x065b('0x4'));var auth=require(_0x065b('0x5'));var interaction=require(_0x065b('0x6'));var config=require('../../config/environment');var controller=require(_0x065b('0x7'));router[_0x065b('0x8')]('/',auth[_0x065b('0x9')](),controller[_0x065b('0xa')]);router[_0x065b('0x8')](_0x065b('0xb'),auth['isAuthenticated'](),controller[_0x065b('0xc')]);router[_0x065b('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x065b('0xd')]);router[_0x065b('0xe')]('/',auth[_0x065b('0x9')](),controller[_0x065b('0xf')]);router[_0x065b('0x10')](_0x065b('0x11'),auth[_0x065b('0x9')](),controller[_0x065b('0x12')]);router[_0x065b('0x13')]('/:id',auth[_0x065b('0x9')](),controller[_0x065b('0x14')]);module[_0x065b('0x15')]=router; \ No newline at end of file +var _0xbfff=['isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get'];(function(_0xc51a9f,_0x32f733){var _0x52f703=function(_0x1fe12d){while(--_0x1fe12d){_0xc51a9f['push'](_0xc51a9f['shift']());}};_0x52f703(++_0x32f733);}(_0xbfff,0x1b9));var _0xfbff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbfff[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfbff('0x0'));var util=require('util');var path=require(_0xfbff('0x1'));var timeout=require(_0xfbff('0x2'));var express=require(_0xfbff('0x3'));var router=express['Router']();var fs_extra=require(_0xfbff('0x4'));var auth=require(_0xfbff('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfbff('0x6'));var controller=require(_0xfbff('0x7'));router[_0xfbff('0x8')]('/',auth[_0xfbff('0x9')](),controller[_0xfbff('0xa')]);router[_0xfbff('0x8')](_0xfbff('0xb'),auth['isAuthenticated'](),controller[_0xfbff('0xc')]);router[_0xfbff('0x8')](_0xfbff('0xd'),auth[_0xfbff('0x9')](),controller['show']);router['post']('/',auth[_0xfbff('0x9')](),controller[_0xfbff('0xe')]);router[_0xfbff('0xf')](_0xfbff('0xd'),auth['isAuthenticated'](),controller[_0xfbff('0x10')]);router[_0xfbff('0x11')]('/:id',auth[_0xfbff('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 3f9d4d7..f1accd3 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x16f9a0,_0x1f9e74){_0x16f9a0=_0x16f9a0-0x0;var _0x5abeca=_0x7a54[_0x16f9a0];return _0x5abeca;};'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(_0x4596c5,_0x11bafb){_0x4596c5=_0x4596c5-0x0;var _0x3bc0db=_0x7a54[_0x4596c5];return _0x3bc0db;};'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 6564f06..b545532 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 _0x8c66=['status','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','keys','create','body','params','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','limit','count'];(function(_0x305c93,_0x3421dc){var _0x5bae39=function(_0x59ff63){while(--_0x59ff63){_0x305c93['push'](_0x305c93['shift']());}};_0x5bae39(++_0x3421dc);}(_0x8c66,0x105));var _0x68c6=function(_0x226f94,_0x111cb2){_0x226f94=_0x226f94-0x0;var _0xb4249f=_0x8c66[_0x226f94];return _0xb4249f;};'use strict';var emlformat=require(_0x68c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x68c6('0x1'));var jsonpatch=require(_0x68c6('0x2'));var rp=require(_0x68c6('0x3'));var moment=require(_0x68c6('0x4'));var BPromise=require(_0x68c6('0x5'));var Mustache=require(_0x68c6('0x6'));var util=require('util');var path=require(_0x68c6('0x7'));var sox=require(_0x68c6('0x8'));var csv=require('to-csv');var ejs=require(_0x68c6('0x9'));var fs=require('fs');var fs_extra=require(_0x68c6('0xa'));var _=require('lodash');var squel=require(_0x68c6('0xb'));var crypto=require(_0x68c6('0xc'));var jsforce=require(_0x68c6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x68c6('0xe'));var querystring=require(_0x68c6('0xf'));var Papa=require(_0x68c6('0x10'));var Redis=require(_0x68c6('0x11'));var authService=require(_0x68c6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x68c6('0x13'));var hardwareService=require(_0x68c6('0x14'));var logger=require(_0x68c6('0x15'))(_0x68c6('0x16'));var utils=require('../../config/utils');var config=require(_0x68c6('0x17'));var licenseUtil=require(_0x68c6('0x18'));var db=require(_0x68c6('0x19'))['db'];function respondWithStatusCode(_0x3cb968,_0x4863d3){_0x4863d3=_0x4863d3||0xcc;return function(_0x53bff1){if(_0x53bff1){return _0x3cb968['sendStatus'](_0x4863d3);}return _0x3cb968['status'](_0x4863d3)[_0x68c6('0x1a')]();};}function respondWithResult(_0xc1efb,_0x214248){_0x214248=_0x214248||0xc8;return function(_0x1cf269){if(_0x1cf269){return _0xc1efb['status'](_0x214248)[_0x68c6('0x1b')](_0x1cf269);}};}function respondWithFilteredResult(_0x2feab1,_0x51a381){return function(_0x80d7b3){if(_0x80d7b3){var _0x19756e=typeof _0x51a381[_0x68c6('0x1c')]==='undefined'&&typeof _0x51a381[_0x68c6('0x1d')]==='undefined';var _0x36b05e=_0x80d7b3[_0x68c6('0x1e')];var _0x4035e6=_0x19756e?0x0:_0x51a381[_0x68c6('0x1c')];var _0x25eb25=_0x19756e?_0x80d7b3[_0x68c6('0x1e')]:_0x51a381[_0x68c6('0x1c')]+_0x51a381['limit'];var _0x35754;if(_0x25eb25>=_0x36b05e){_0x25eb25=_0x36b05e;_0x35754=0xc8;}else{_0x35754=0xce;}_0x2feab1[_0x68c6('0x1f')](_0x35754);return _0x2feab1['set'](_0x68c6('0x20'),_0x4035e6+'-'+_0x25eb25+'/'+_0x36b05e)['json'](_0x80d7b3);}return null;};}function patchUpdates(_0xda1513){return function(_0x17cd07){try{jsonpatch[_0x68c6('0x21')](_0x17cd07,_0xda1513,!![]);}catch(_0x12df29){return BPromise['reject'](_0x12df29);}return _0x17cd07[_0x68c6('0x22')]();};}function saveUpdates(_0x374f46,_0x5a71b2){return function(_0x2da3cb){if(_0x2da3cb){return _0x2da3cb[_0x68c6('0x23')](_0x374f46)[_0x68c6('0x24')](function(_0x18748d){return _0x18748d;});}return null;};}function removeEntity(_0x579256,_0x47bb9d){return function(_0x13d6eb){if(_0x13d6eb){return _0x13d6eb[_0x68c6('0x25')]()[_0x68c6('0x24')](function(){_0x579256['status'](0xcc)[_0x68c6('0x1a')]();});}};}function handleEntityNotFound(_0x446b01,_0x121c27){return function(_0x29697d){if(!_0x29697d){_0x446b01[_0x68c6('0x26')](0x194);}return _0x29697d;};}function handleError(_0x5cbd0b,_0x155b2d){_0x155b2d=_0x155b2d||0x1f4;return function(_0x22604c){logger[_0x68c6('0x27')](_0x22604c[_0x68c6('0x28')]);if(_0x22604c[_0x68c6('0x29')]){delete _0x22604c[_0x68c6('0x29')];}_0x5cbd0b[_0x68c6('0x1f')](_0x155b2d)[_0x68c6('0x2a')](_0x22604c);};}exports['index']=function(_0x279de1,_0x488985){var _0x3fbd69={},_0x1d5b36={},_0x331d69={'count':0x0,'rows':[]};var _0x2e28ce=_[_0x68c6('0x2b')](db[_0x68c6('0x2c')][_0x68c6('0x2d')],function(_0x353a5d){return{'name':_0x353a5d[_0x68c6('0x2e')],'type':_0x353a5d[_0x68c6('0x2f')][_0x68c6('0x30')]};});_0x1d5b36[_0x68c6('0x31')]=_['map'](_0x2e28ce,'name');_0x1d5b36[_0x68c6('0x32')]=_['keys'](_0x279de1[_0x68c6('0x32')]);_0x1d5b36['filters']=_[_0x68c6('0x33')](_0x1d5b36[_0x68c6('0x31')],_0x1d5b36[_0x68c6('0x32')]);_0x3fbd69[_0x68c6('0x34')]=_[_0x68c6('0x33')](_0x1d5b36['model'],qs[_0x68c6('0x35')](_0x279de1[_0x68c6('0x32')]['fields']));_0x3fbd69[_0x68c6('0x34')]=_0x3fbd69[_0x68c6('0x34')][_0x68c6('0x36')]?_0x3fbd69[_0x68c6('0x34')]:_0x1d5b36['model'];if(!_0x279de1['query']['hasOwnProperty']('nolimit')){_0x3fbd69[_0x68c6('0x1d')]=qs[_0x68c6('0x1d')](_0x279de1['query'][_0x68c6('0x1d')]);_0x3fbd69[_0x68c6('0x1c')]=qs[_0x68c6('0x1c')](_0x279de1[_0x68c6('0x32')][_0x68c6('0x1c')]);}_0x3fbd69['order']=qs[_0x68c6('0x37')](_0x279de1[_0x68c6('0x32')][_0x68c6('0x37')]);_0x3fbd69[_0x68c6('0x38')]=qs[_0x68c6('0x39')](_['pick'](_0x279de1[_0x68c6('0x32')],_0x1d5b36['filters']),_0x2e28ce);if(_0x279de1[_0x68c6('0x32')][_0x68c6('0x3a')]){_0x3fbd69[_0x68c6('0x38')]=_['merge'](_0x3fbd69[_0x68c6('0x38')],{'$or':_[_0x68c6('0x2b')](_0x2e28ce,function(_0x4889cb){if(_0x4889cb[_0x68c6('0x2f')]!==_0x68c6('0x3b')){var _0x34373b={};_0x34373b[_0x4889cb[_0x68c6('0x29')]]={'$like':'%'+_0x279de1[_0x68c6('0x32')][_0x68c6('0x3a')]+'%'};return _0x34373b;}})});}_0x3fbd69=_[_0x68c6('0x3c')]({},_0x3fbd69,_0x279de1[_0x68c6('0x3d')]);var _0x25c583={'where':_0x3fbd69['where']};return db[_0x68c6('0x2c')]['count'](_0x25c583)[_0x68c6('0x24')](function(_0x2d8ff0){_0x331d69['count']=_0x2d8ff0;if(_0x279de1['query'][_0x68c6('0x3e')]){_0x3fbd69[_0x68c6('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x68c6('0x40')](_0x3fbd69);})[_0x68c6('0x24')](function(_0x22b1d8){_0x331d69['rows']=_0x22b1d8;return _0x331d69;})[_0x68c6('0x24')](respondWithFilteredResult(_0x488985,_0x3fbd69))[_0x68c6('0x41')](handleError(_0x488985,null));};exports[_0x68c6('0x42')]=function(_0x4c86c8,_0x26d609){var _0xa2d6fe={'raw':!![],'where':{'id':_0x4c86c8['params']['id']}},_0x377e9b={};_0x377e9b[_0x68c6('0x31')]=_[_0x68c6('0x43')](db['JscriptyQuestionReport'][_0x68c6('0x2d')]);_0x377e9b[_0x68c6('0x32')]=_[_0x68c6('0x43')](_0x4c86c8[_0x68c6('0x32')]);_0x377e9b[_0x68c6('0x39')]=_['intersection'](_0x377e9b[_0x68c6('0x31')],_0x377e9b[_0x68c6('0x32')]);_0xa2d6fe[_0x68c6('0x34')]=_['intersection'](_0x377e9b[_0x68c6('0x31')],qs[_0x68c6('0x35')](_0x4c86c8[_0x68c6('0x32')][_0x68c6('0x35')]));_0xa2d6fe[_0x68c6('0x34')]=_0xa2d6fe[_0x68c6('0x34')]['length']?_0xa2d6fe[_0x68c6('0x34')]:_0x377e9b['model'];if(_0x4c86c8[_0x68c6('0x32')][_0x68c6('0x3e')]){_0xa2d6fe[_0x68c6('0x3f')]=[{'all':!![]}];}_0xa2d6fe=_['merge']({},_0xa2d6fe,_0x4c86c8['options']);return db[_0x68c6('0x2c')]['find'](_0xa2d6fe)[_0x68c6('0x24')](handleEntityNotFound(_0x26d609,null))[_0x68c6('0x24')](respondWithResult(_0x26d609,null))[_0x68c6('0x41')](handleError(_0x26d609,null));};exports[_0x68c6('0x44')]=function(_0x35dddf,_0x28f492){return db[_0x68c6('0x2c')][_0x68c6('0x44')](_0x35dddf['body'],{})[_0x68c6('0x24')](respondWithResult(_0x28f492,0xc9))[_0x68c6('0x41')](handleError(_0x28f492,null));};exports['update']=function(_0x583397,_0x1ec64a){if(_0x583397[_0x68c6('0x45')]['id']){delete _0x583397[_0x68c6('0x45')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x583397[_0x68c6('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ec64a,null))['then'](saveUpdates(_0x583397[_0x68c6('0x45')],null))[_0x68c6('0x24')](respondWithResult(_0x1ec64a,null))[_0x68c6('0x41')](handleError(_0x1ec64a,null));};exports[_0x68c6('0x25')]=function(_0x3d726f,_0x36681a){return db[_0x68c6('0x2c')][_0x68c6('0x47')]({'where':{'id':_0x3d726f[_0x68c6('0x46')]['id']}})[_0x68c6('0x24')](handleEntityNotFound(_0x36681a,null))[_0x68c6('0x24')](removeEntity(_0x36681a,null))[_0x68c6('0x41')](handleError(_0x36681a,null));};exports['describe']=function(_0x564c1b,_0x243e77){return db[_0x68c6('0x2c')][_0x68c6('0x48')]()[_0x68c6('0x24')](respondWithResult(_0x243e77,null))['catch'](handleError(_0x243e77,null));}; \ No newline at end of file +var _0xbd1d=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','name','map','JscriptyQuestionReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xbd1d,0x7c));var _0xdbd1=function(_0xfd794c,_0x542ed3){_0xfd794c=_0xfd794c-0x0;var _0x27a4a5=_0xbd1d[_0xfd794c];return _0x27a4a5;};'use strict';var emlformat=require(_0xdbd1('0x0'));var rimraf=require(_0xdbd1('0x1'));var zipdir=require(_0xdbd1('0x2'));var jsonpatch=require(_0xdbd1('0x3'));var rp=require(_0xdbd1('0x4'));var moment=require(_0xdbd1('0x5'));var BPromise=require(_0xdbd1('0x6'));var Mustache=require('mustache');var util=require(_0xdbd1('0x7'));var path=require(_0xdbd1('0x8'));var sox=require(_0xdbd1('0x9'));var csv=require(_0xdbd1('0xa'));var ejs=require(_0xdbd1('0xb'));var fs=require('fs');var fs_extra=require(_0xdbd1('0xc'));var _=require(_0xdbd1('0xd'));var squel=require(_0xdbd1('0xe'));var crypto=require(_0xdbd1('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xdbd1('0x10'));var toCsv=require(_0xdbd1('0xa'));var querystring=require(_0xdbd1('0x11'));var Papa=require('papaparse');var Redis=require(_0xdbd1('0x12'));var authService=require(_0xdbd1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdbd1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbd1('0x15'))(_0xdbd1('0x16'));var utils=require(_0xdbd1('0x17'));var config=require(_0xdbd1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xdbd1('0x19'))['db'];function respondWithStatusCode(_0x372504,_0xd3ab1e){_0xd3ab1e=_0xd3ab1e||0xcc;return function(_0x12458f){if(_0x12458f){return _0x372504['sendStatus'](_0xd3ab1e);}return _0x372504[_0xdbd1('0x1a')](_0xd3ab1e)[_0xdbd1('0x1b')]();};}function respondWithResult(_0x17a5e6,_0x4a3240){_0x4a3240=_0x4a3240||0xc8;return function(_0x3cc948){if(_0x3cc948){return _0x17a5e6[_0xdbd1('0x1a')](_0x4a3240)['json'](_0x3cc948);}};}function respondWithFilteredResult(_0x3e7775,_0x4023e0){return function(_0x331e8c){if(_0x331e8c){var _0x31c824=typeof _0x4023e0[_0xdbd1('0x1c')]==='undefined'&&typeof _0x4023e0[_0xdbd1('0x1d')]===_0xdbd1('0x1e');var _0x1a9df1=_0x331e8c[_0xdbd1('0x1f')];var _0x4f2ce8=_0x31c824?0x0:_0x4023e0[_0xdbd1('0x1c')];var _0x2bb1f5=_0x31c824?_0x331e8c[_0xdbd1('0x1f')]:_0x4023e0[_0xdbd1('0x1c')]+_0x4023e0['limit'];var _0x145373;if(_0x2bb1f5>=_0x1a9df1){_0x2bb1f5=_0x1a9df1;_0x145373=0xc8;}else{_0x145373=0xce;}_0x3e7775['status'](_0x145373);return _0x3e7775[_0xdbd1('0x20')](_0xdbd1('0x21'),_0x4f2ce8+'-'+_0x2bb1f5+'/'+_0x1a9df1)[_0xdbd1('0x22')](_0x331e8c);}return null;};}function patchUpdates(_0x69eda9){return function(_0x4d1505){try{jsonpatch[_0xdbd1('0x23')](_0x4d1505,_0x69eda9,!![]);}catch(_0xd31b62){return BPromise['reject'](_0xd31b62);}return _0x4d1505[_0xdbd1('0x24')]();};}function saveUpdates(_0x1bef8b,_0x3e5d78){return function(_0x4d2e16){if(_0x4d2e16){return _0x4d2e16[_0xdbd1('0x25')](_0x1bef8b)[_0xdbd1('0x26')](function(_0x296300){return _0x296300;});}return null;};}function removeEntity(_0x51d32f,_0x44fa9f){return function(_0x2cad21){if(_0x2cad21){return _0x2cad21['destroy']()[_0xdbd1('0x26')](function(){_0x51d32f[_0xdbd1('0x1a')](0xcc)[_0xdbd1('0x1b')]();});}};}function handleEntityNotFound(_0x3c54a3,_0x4214c3){return function(_0xf36820){if(!_0xf36820){_0x3c54a3['sendStatus'](0x194);}return _0xf36820;};}function handleError(_0x5923d3,_0x299f10){_0x299f10=_0x299f10||0x1f4;return function(_0x217c23){logger['error'](_0x217c23['stack']);if(_0x217c23[_0xdbd1('0x27')]){delete _0x217c23[_0xdbd1('0x27')];}_0x5923d3[_0xdbd1('0x1a')](_0x299f10)['send'](_0x217c23);};}exports['index']=function(_0x39d261,_0xa8b65d){var _0x53448d={},_0x312f96={},_0x17a217={'count':0x0,'rows':[]};var _0x4a071e=_[_0xdbd1('0x28')](db[_0xdbd1('0x29')][_0xdbd1('0x2a')],function(_0x1e77eb){return{'name':_0x1e77eb['fieldName'],'type':_0x1e77eb['type']['key']};});_0x312f96[_0xdbd1('0x2b')]=_[_0xdbd1('0x28')](_0x4a071e,_0xdbd1('0x27'));_0x312f96[_0xdbd1('0x2c')]=_[_0xdbd1('0x2d')](_0x39d261[_0xdbd1('0x2c')]);_0x312f96[_0xdbd1('0x2e')]=_[_0xdbd1('0x2f')](_0x312f96[_0xdbd1('0x2b')],_0x312f96[_0xdbd1('0x2c')]);_0x53448d[_0xdbd1('0x30')]=_[_0xdbd1('0x2f')](_0x312f96[_0xdbd1('0x2b')],qs[_0xdbd1('0x31')](_0x39d261[_0xdbd1('0x2c')][_0xdbd1('0x31')]));_0x53448d[_0xdbd1('0x30')]=_0x53448d[_0xdbd1('0x30')][_0xdbd1('0x32')]?_0x53448d[_0xdbd1('0x30')]:_0x312f96[_0xdbd1('0x2b')];if(!_0x39d261[_0xdbd1('0x2c')][_0xdbd1('0x33')](_0xdbd1('0x34'))){_0x53448d[_0xdbd1('0x1d')]=qs[_0xdbd1('0x1d')](_0x39d261['query'][_0xdbd1('0x1d')]);_0x53448d[_0xdbd1('0x1c')]=qs['offset'](_0x39d261[_0xdbd1('0x2c')][_0xdbd1('0x1c')]);}_0x53448d[_0xdbd1('0x35')]=qs[_0xdbd1('0x36')](_0x39d261['query']['sort']);_0x53448d[_0xdbd1('0x37')]=qs[_0xdbd1('0x2e')](_['pick'](_0x39d261[_0xdbd1('0x2c')],_0x312f96['filters']),_0x4a071e);if(_0x39d261[_0xdbd1('0x2c')][_0xdbd1('0x38')]){_0x53448d[_0xdbd1('0x37')]=_['merge'](_0x53448d[_0xdbd1('0x37')],{'$or':_[_0xdbd1('0x28')](_0x4a071e,function(_0x4b38c7){if(_0x4b38c7[_0xdbd1('0x39')]!==_0xdbd1('0x3a')){var _0x185306={};_0x185306[_0x4b38c7['name']]={'$like':'%'+_0x39d261[_0xdbd1('0x2c')][_0xdbd1('0x38')]+'%'};return _0x185306;}})});}_0x53448d=_['merge']({},_0x53448d,_0x39d261[_0xdbd1('0x3b')]);var _0x21fcca={'where':_0x53448d[_0xdbd1('0x37')]};return db[_0xdbd1('0x29')]['count'](_0x21fcca)['then'](function(_0x410a33){_0x17a217['count']=_0x410a33;if(_0x39d261[_0xdbd1('0x2c')][_0xdbd1('0x3c')]){_0x53448d[_0xdbd1('0x3d')]=[{'all':!![]}];}return db[_0xdbd1('0x29')][_0xdbd1('0x3e')](_0x53448d);})['then'](function(_0x532ee1){_0x17a217[_0xdbd1('0x3f')]=_0x532ee1;return _0x17a217;})[_0xdbd1('0x26')](respondWithFilteredResult(_0xa8b65d,_0x53448d))['catch'](handleError(_0xa8b65d,null));};exports[_0xdbd1('0x40')]=function(_0x29496a,_0x5f3526){var _0x1412dd={'raw':!![],'where':{'id':_0x29496a[_0xdbd1('0x41')]['id']}},_0x297ba8={};_0x297ba8['model']=_[_0xdbd1('0x2d')](db['JscriptyQuestionReport'][_0xdbd1('0x2a')]);_0x297ba8['query']=_['keys'](_0x29496a[_0xdbd1('0x2c')]);_0x297ba8['filters']=_[_0xdbd1('0x2f')](_0x297ba8['model'],_0x297ba8['query']);_0x1412dd[_0xdbd1('0x30')]=_[_0xdbd1('0x2f')](_0x297ba8[_0xdbd1('0x2b')],qs[_0xdbd1('0x31')](_0x29496a['query'][_0xdbd1('0x31')]));_0x1412dd[_0xdbd1('0x30')]=_0x1412dd[_0xdbd1('0x30')][_0xdbd1('0x32')]?_0x1412dd[_0xdbd1('0x30')]:_0x297ba8['model'];if(_0x29496a['query'][_0xdbd1('0x3c')]){_0x1412dd[_0xdbd1('0x3d')]=[{'all':!![]}];}_0x1412dd=_['merge']({},_0x1412dd,_0x29496a[_0xdbd1('0x3b')]);return db[_0xdbd1('0x29')][_0xdbd1('0x42')](_0x1412dd)[_0xdbd1('0x26')](handleEntityNotFound(_0x5f3526,null))[_0xdbd1('0x26')](respondWithResult(_0x5f3526,null))[_0xdbd1('0x43')](handleError(_0x5f3526,null));};exports[_0xdbd1('0x44')]=function(_0x20fa88,_0x461c3a){return db[_0xdbd1('0x29')][_0xdbd1('0x44')](_0x20fa88[_0xdbd1('0x45')],{})['then'](respondWithResult(_0x461c3a,0xc9))[_0xdbd1('0x43')](handleError(_0x461c3a,null));};exports[_0xdbd1('0x25')]=function(_0x3042f1,_0x402d22){if(_0x3042f1[_0xdbd1('0x45')]['id']){delete _0x3042f1[_0xdbd1('0x45')]['id'];}return db[_0xdbd1('0x29')][_0xdbd1('0x42')]({'where':{'id':_0x3042f1['params']['id']}})['then'](handleEntityNotFound(_0x402d22,null))[_0xdbd1('0x26')](saveUpdates(_0x3042f1[_0xdbd1('0x45')],null))['then'](respondWithResult(_0x402d22,null))['catch'](handleError(_0x402d22,null));};exports[_0xdbd1('0x46')]=function(_0x5a5bd6,_0x5b418f){return db[_0xdbd1('0x29')][_0xdbd1('0x42')]({'where':{'id':_0x5a5bd6[_0xdbd1('0x41')]['id']}})['then'](handleEntityNotFound(_0x5b418f,null))[_0xdbd1('0x26')](removeEntity(_0x5b418f,null))['catch'](handleError(_0x5b418f,null));};exports[_0xdbd1('0x47')]=function(_0x339227,_0x4ff4a9){return db[_0xdbd1('0x29')][_0xdbd1('0x47')]()[_0xdbd1('0x26')](respondWithResult(_0x4ff4a9,null))[_0xdbd1('0x43')](handleError(_0x4ff4a9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 1df58ea..39d09ff 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 _0xbc89=['request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x49e454,_0x22328f){var _0x21d045=function(_0x36c9d0){while(--_0x36c9d0){_0x49e454['push'](_0x49e454['shift']());}};_0x21d045(++_0x22328f);}(_0xbc89,0xea));var _0x9bc8=function(_0x1e2671,_0x4cf90a){_0x1e2671=_0x1e2671-0x0;var _0x492489=_0xbc89[_0x1e2671];return _0x492489;};'use strict';var _=require(_0x9bc8('0x0'));var util=require(_0x9bc8('0x1'));var logger=require(_0x9bc8('0x2'))(_0x9bc8('0x3'));var moment=require(_0x9bc8('0x4'));var BPromise=require(_0x9bc8('0x5'));var rp=require(_0x9bc8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9bc8('0x7'));var config=require(_0x9bc8('0x8'));var attributes=require(_0x9bc8('0x9'));module[_0x9bc8('0xa')]=function(_0x28481b,_0x4b6ddf){return _0x28481b['define'](_0x9bc8('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cdb=['lodash','util','moment','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x2fc5db,_0x2253b1){var _0x1ef11b=function(_0x2846a5){while(--_0x2846a5){_0x2fc5db['push'](_0x2fc5db['shift']());}};_0x1ef11b(++_0x2253b1);}(_0x8cdb,0x82));var _0xb8cd=function(_0x237766,_0x1f1bd6){_0x237766=_0x237766-0x0;var _0x5a538a=_0x8cdb[_0x237766];return _0x5a538a;};'use strict';var _=require(_0xb8cd('0x0'));var util=require(_0xb8cd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb8cd('0x2'));var BPromise=require('bluebird');var rp=require(_0xb8cd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb8cd('0x4'));var config=require(_0xb8cd('0x5'));var attributes=require(_0xb8cd('0x6'));module['exports']=function(_0x180043,_0x35d893){return _0x180043[_0xb8cd('0x7')](_0xb8cd('0x8'),attributes,{'tableName':_0xb8cd('0x9'),'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 a7abd30..90fe454 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 _0x8ebd=['error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x1d8119,_0xc98f17){var _0x3e30f6=function(_0x2c7f3e){while(--_0x2c7f3e){_0x1d8119['push'](_0x1d8119['shift']());}};_0x3e30f6(++_0xc98f17);}(_0x8ebd,0x194));var _0xd8eb=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x8ebd[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xd8eb('0x0'));var util=require(_0xd8eb('0x1'));var moment=require(_0xd8eb('0x2'));var BPromise=require('bluebird');var rs=require(_0xd8eb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8eb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd8eb('0x5'))(_0xd8eb('0x6'));var config=require(_0xd8eb('0x7'));var jayson=require(_0xd8eb('0x8'));var client=jayson[_0xd8eb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dd14c,_0x3a4e28,_0x3e9e31){return new BPromise(function(_0x59a8ac,_0x3516f8){return client[_0xd8eb('0xa')](_0x3dd14c,_0x3e9e31)['then'](function(_0x1801d5){logger[_0xd8eb('0xb')](_0xd8eb('0xc'),_0x3a4e28,'request\x20sent');logger[_0xd8eb('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x3a4e28,_0xd8eb('0xe'),JSON[_0xd8eb('0xf')](_0x1801d5));if(_0x1801d5['error']){if(_0x1801d5[_0xd8eb('0x10')][_0xd8eb('0x11')]===0x1f4){logger['error'](_0xd8eb('0xc'),_0x3a4e28,_0x1801d5[_0xd8eb('0x10')][_0xd8eb('0x12')]);return _0x3516f8(_0x1801d5[_0xd8eb('0x10')]['message']);}logger['error'](_0xd8eb('0xc'),_0x3a4e28,_0x1801d5[_0xd8eb('0x10')][_0xd8eb('0x12')]);return _0x59a8ac(_0x1801d5[_0xd8eb('0x10')][_0xd8eb('0x12')]);}else{logger['info'](_0xd8eb('0xc'),_0x3a4e28,_0xd8eb('0xe'));_0x59a8ac(_0x1801d5[_0xd8eb('0x13')]['message']);}})['catch'](function(_0x148e3f){logger[_0xd8eb('0x10')](_0xd8eb('0xc'),_0x3a4e28,_0x148e3f);_0x3516f8(_0x148e3f);});});} \ No newline at end of file +var _0x46c1=['client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xc1005a,_0x7c33ed){var _0x3deb10=function(_0x2e4bcb){while(--_0x2e4bcb){_0xc1005a['push'](_0xc1005a['shift']());}};_0x3deb10(++_0x7c33ed);}(_0x46c1,0x7a));var _0x146c=function(_0xb4bc0f,_0x1614bf){_0xb4bc0f=_0xb4bc0f-0x0;var _0x5a0505=_0x46c1[_0xb4bc0f];return _0x5a0505;};'use strict';var _=require(_0x146c('0x0'));var util=require(_0x146c('0x1'));var moment=require('moment');var BPromise=require(_0x146c('0x2'));var rs=require(_0x146c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x146c('0x4'))['db'];var utils=require(_0x146c('0x5'));var logger=require(_0x146c('0x6'))(_0x146c('0x7'));var config=require(_0x146c('0x8'));var jayson=require(_0x146c('0x9'));var client=jayson[_0x146c('0xa')][_0x146c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ded39,_0x6eb957,_0x255047){return new BPromise(function(_0x51fb42,_0x557302){return client[_0x146c('0xc')](_0x3ded39,_0x255047)['then'](function(_0x4d2004){logger[_0x146c('0xd')](_0x146c('0xe'),_0x6eb957,_0x146c('0xf'));logger[_0x146c('0x10')](_0x146c('0x11'),_0x6eb957,'request\x20sent',JSON[_0x146c('0x12')](_0x4d2004));if(_0x4d2004['error']){if(_0x4d2004[_0x146c('0x13')]['code']===0x1f4){logger[_0x146c('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x6eb957,_0x4d2004[_0x146c('0x13')][_0x146c('0x14')]);return _0x557302(_0x4d2004['error'][_0x146c('0x14')]);}logger[_0x146c('0x13')](_0x146c('0xe'),_0x6eb957,_0x4d2004[_0x146c('0x13')][_0x146c('0x14')]);return _0x51fb42(_0x4d2004[_0x146c('0x13')][_0x146c('0x14')]);}else{logger[_0x146c('0xd')](_0x146c('0xe'),_0x6eb957,'request\x20sent');_0x51fb42(_0x4d2004['result'][_0x146c('0x14')]);}})[_0x146c('0x15')](function(_0x3b0360){logger[_0x146c('0x13')](_0x146c('0xe'),_0x6eb957,_0x3b0360);_0x557302(_0x3b0360);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index e6e307f..180436b 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 _0x1350=['../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x2211b2,_0x3c32a7){var _0x1ff209=function(_0x9193ae){while(--_0x9193ae){_0x2211b2['push'](_0x2211b2['shift']());}};_0x1ff209(++_0x3c32a7);}(_0x1350,0x14a));var _0x0135=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1350[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0135('0x0'));var util=require('util');var path=require(_0x0135('0x1'));var timeout=require(_0x0135('0x2'));var express=require(_0x0135('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0135('0x4'));var interaction=require(_0x0135('0x5'));var config=require(_0x0135('0x6'));var controller=require(_0x0135('0x7'));router[_0x0135('0x8')]('/',auth[_0x0135('0x9')](),controller['index']);router[_0x0135('0x8')](_0x0135('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0135('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0135('0xb')]);router[_0x0135('0x8')](_0x0135('0xc'),auth[_0x0135('0x9')](),controller[_0x0135('0xd')]);router[_0x0135('0xe')]('/',auth['isAuthenticated'](),controller[_0x0135('0xf')]);router[_0x0135('0x10')]('/:id',auth[_0x0135('0x9')](),controller[_0x0135('0x11')]);router[_0x0135('0x12')]('/:id',auth[_0x0135('0x9')](),controller[_0x0135('0x13')]);module[_0x0135('0x14')]=router; \ No newline at end of file +var _0xf097=['/describe','describe','/:id','isAuthenticated','show','/:id/questions','post','create','put','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf097,0x105));var _0x7f09=function(_0x31f800,_0x567886){_0x31f800=_0x31f800-0x0;var _0x75c97a=_0xf097[_0x31f800];return _0x75c97a;};'use strict';var multer=require(_0x7f09('0x0'));var util=require(_0x7f09('0x1'));var path=require(_0x7f09('0x2'));var timeout=require(_0x7f09('0x3'));var express=require(_0x7f09('0x4'));var router=express['Router']();var fs_extra=require(_0x7f09('0x5'));var auth=require(_0x7f09('0x6'));var interaction=require(_0x7f09('0x7'));var config=require(_0x7f09('0x8'));var controller=require(_0x7f09('0x9'));router[_0x7f09('0xa')]('/',auth['isAuthenticated'](),controller[_0x7f09('0xb')]);router[_0x7f09('0xa')](_0x7f09('0xc'),auth['isAuthenticated'](),controller[_0x7f09('0xd')]);router[_0x7f09('0xa')](_0x7f09('0xe'),auth[_0x7f09('0xf')](),controller[_0x7f09('0x10')]);router[_0x7f09('0xa')](_0x7f09('0x11'),auth[_0x7f09('0xf')](),controller['getQuestions']);router[_0x7f09('0x12')]('/',auth[_0x7f09('0xf')](),controller[_0x7f09('0x13')]);router[_0x7f09('0x14')](_0x7f09('0xe'),auth[_0x7f09('0xf')](),controller['update']);router['delete']('/:id',auth[_0x7f09('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index fa13d47..deaa48d 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 _0xa6ce=['exports','DATE','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0x3a39cd,_0x24ca85){var _0x155de6=function(_0x45fae4){while(--_0x45fae4){_0x3a39cd['push'](_0x3a39cd['shift']());}};_0x155de6(++_0x24ca85);}(_0xa6ce,0x15e));var _0xea6c=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xa6ce[_0x525c7b];return _0x27b33e;};'use strict';var moment=require(_0xea6c('0x0'));var Sequelize=require('sequelize');module[_0xea6c('0x1')]={'starttime':{'type':Sequelize[_0xea6c('0x2')],'set':function(_0x56b5bd){this[_0xea6c('0x3')](_0xea6c('0x4'),_0x56b5bd);this['setDataValue']('endtime',moment()[_0xea6c('0x5')](_0xea6c('0x6')));}},'endtime':{'type':Sequelize[_0xea6c('0x2')]},'membername':{'type':Sequelize[_0xea6c('0x7')]},'projectname':{'type':Sequelize[_0xea6c('0x7')]},'queue':{'type':Sequelize[_0xea6c('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xea6c('0x7')]},'calleridnum':{'type':Sequelize[_0xea6c('0x7')]},'completed':{'type':Sequelize[_0xea6c('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x2178=['moment','exports','DATE','starttime','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x41bf04,_0x47c75b){var _0x233862=function(_0x1ccd6f){while(--_0x1ccd6f){_0x41bf04['push'](_0x41bf04['shift']());}};_0x233862(++_0x47c75b);}(_0x2178,0x1b0));var _0x8217=function(_0x45ce30,_0x2b5ec7){_0x45ce30=_0x45ce30-0x0;var _0x2eeafb=_0x2178[_0x45ce30];return _0x2eeafb;};'use strict';var moment=require(_0x8217('0x0'));var Sequelize=require('sequelize');module[_0x8217('0x1')]={'starttime':{'type':Sequelize[_0x8217('0x2')],'set':function(_0x450e40){this['setDataValue'](_0x8217('0x3'),_0x450e40);this[_0x8217('0x4')]('endtime',moment()[_0x8217('0x5')](_0x8217('0x6')));}},'endtime':{'type':Sequelize[_0x8217('0x2')]},'membername':{'type':Sequelize[_0x8217('0x7')]},'projectname':{'type':Sequelize[_0x8217('0x7')]},'queue':{'type':Sequelize[_0x8217('0x7')]},'uniqueid':{'type':Sequelize[_0x8217('0x7')]},'calleridname':{'type':Sequelize[_0x8217('0x7')]},'calleridnum':{'type':Sequelize[_0x8217('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 58f8add..ea15fc3 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 _0x2155=['json','offset','undefined','count','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','include','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','order','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0x2155,0x1c8));var _0x5215=function(_0x2c96c0,_0x490d48){_0x2c96c0=_0x2c96c0-0x0;var _0x30c3a9=_0x2155[_0x2c96c0];return _0x30c3a9;};'use strict';var emlformat=require(_0x5215('0x0'));var rimraf=require(_0x5215('0x1'));var zipdir=require(_0x5215('0x2'));var jsonpatch=require(_0x5215('0x3'));var rp=require(_0x5215('0x4'));var moment=require(_0x5215('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5215('0x6'));var util=require('util');var path=require(_0x5215('0x7'));var sox=require(_0x5215('0x8'));var csv=require(_0x5215('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5215('0xa'));var squel=require(_0x5215('0xb'));var crypto=require(_0x5215('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5215('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5215('0xe'));var authService=require(_0x5215('0xf'));var qs=require(_0x5215('0x10'));var as=require(_0x5215('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5215('0x12'))('api');var utils=require(_0x5215('0x13'));var config=require(_0x5215('0x14'));var licenseUtil=require(_0x5215('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x426bb7,_0x27d561){_0x27d561=_0x27d561||0xcc;return function(_0x13d84c){if(_0x13d84c){return _0x426bb7[_0x5215('0x16')](_0x27d561);}return _0x426bb7[_0x5215('0x17')](_0x27d561)['end']();};}function respondWithResult(_0x10649e,_0x4ec4a2){_0x4ec4a2=_0x4ec4a2||0xc8;return function(_0x1c2fe9){if(_0x1c2fe9){return _0x10649e['status'](_0x4ec4a2)[_0x5215('0x18')](_0x1c2fe9);}};}function respondWithFilteredResult(_0x272018,_0x21a0f2){return function(_0x27a56d){if(_0x27a56d){var _0x4fe272=typeof _0x21a0f2[_0x5215('0x19')]==='undefined'&&typeof _0x21a0f2['limit']===_0x5215('0x1a');var _0x3d4312=_0x27a56d['count'];var _0x2d4fb8=_0x4fe272?0x0:_0x21a0f2[_0x5215('0x19')];var _0x1571b6=_0x4fe272?_0x27a56d[_0x5215('0x1b')]:_0x21a0f2[_0x5215('0x19')]+_0x21a0f2['limit'];var _0x2cbd0f;if(_0x1571b6>=_0x3d4312){_0x1571b6=_0x3d4312;_0x2cbd0f=0xc8;}else{_0x2cbd0f=0xce;}_0x272018[_0x5215('0x17')](_0x2cbd0f);return _0x272018['set'](_0x5215('0x1c'),_0x2d4fb8+'-'+_0x1571b6+'/'+_0x3d4312)['json'](_0x27a56d);}return null;};}function patchUpdates(_0x30fd8d){return function(_0xdba510){try{jsonpatch[_0x5215('0x1d')](_0xdba510,_0x30fd8d,!![]);}catch(_0x50f2ae){return BPromise[_0x5215('0x1e')](_0x50f2ae);}return _0xdba510[_0x5215('0x1f')]();};}function saveUpdates(_0x2e3f7a,_0x59e5fe){return function(_0x13837c){if(_0x13837c){return _0x13837c[_0x5215('0x20')](_0x2e3f7a)[_0x5215('0x21')](function(_0x2b76e4){return _0x2b76e4;});}return null;};}function removeEntity(_0x4c3851,_0x3d1e8d){return function(_0x7761c9){if(_0x7761c9){return _0x7761c9['destroy']()['then'](function(){_0x4c3851[_0x5215('0x17')](0xcc)[_0x5215('0x22')]();});}};}function handleEntityNotFound(_0x38631c,_0x510353){return function(_0xc481c4){if(!_0xc481c4){_0x38631c[_0x5215('0x16')](0x194);}return _0xc481c4;};}function handleError(_0x47bf40,_0x4e3326){_0x4e3326=_0x4e3326||0x1f4;return function(_0x49f7a4){logger[_0x5215('0x23')](_0x49f7a4[_0x5215('0x24')]);if(_0x49f7a4[_0x5215('0x25')]){delete _0x49f7a4['name'];}_0x47bf40['status'](_0x4e3326)[_0x5215('0x26')](_0x49f7a4);};}exports[_0x5215('0x27')]=function(_0x78da45,_0x26f4ac){var _0x5cc8db={},_0x51287={},_0x3d75bb={'count':0x0,'rows':[]};var _0x2ea6ef=_[_0x5215('0x28')](db[_0x5215('0x29')][_0x5215('0x2a')],function(_0x1f2f2f){return{'name':_0x1f2f2f[_0x5215('0x2b')],'type':_0x1f2f2f['type'][_0x5215('0x2c')]};});_0x51287[_0x5215('0x2d')]=_[_0x5215('0x28')](_0x2ea6ef,'name');_0x51287[_0x5215('0x2e')]=_[_0x5215('0x2f')](_0x78da45[_0x5215('0x2e')]);_0x51287['filters']=_[_0x5215('0x30')](_0x51287[_0x5215('0x2d')],_0x51287[_0x5215('0x2e')]);_0x5cc8db[_0x5215('0x31')]=_['intersection'](_0x51287['model'],qs['fields'](_0x78da45[_0x5215('0x2e')]['fields']));_0x5cc8db[_0x5215('0x31')]=_0x5cc8db[_0x5215('0x31')][_0x5215('0x32')]?_0x5cc8db[_0x5215('0x31')]:_0x51287[_0x5215('0x2d')];if(!_0x78da45[_0x5215('0x2e')][_0x5215('0x33')](_0x5215('0x34'))){_0x5cc8db['limit']=qs[_0x5215('0x35')](_0x78da45[_0x5215('0x2e')][_0x5215('0x35')]);_0x5cc8db[_0x5215('0x19')]=qs[_0x5215('0x19')](_0x78da45[_0x5215('0x2e')][_0x5215('0x19')]);}_0x5cc8db['order']=qs[_0x5215('0x36')](_0x78da45[_0x5215('0x2e')][_0x5215('0x36')]);_0x5cc8db[_0x5215('0x37')]=qs[_0x5215('0x38')](_[_0x5215('0x39')](_0x78da45['query'],_0x51287[_0x5215('0x38')]),_0x2ea6ef);if(_0x78da45[_0x5215('0x2e')][_0x5215('0x3a')]){_0x5cc8db[_0x5215('0x37')]=_[_0x5215('0x3b')](_0x5cc8db[_0x5215('0x37')],{'$or':_[_0x5215('0x28')](_0x2ea6ef,function(_0x30984f){if(_0x30984f[_0x5215('0x3c')]!==_0x5215('0x3d')){var _0x3d78a6={};_0x3d78a6[_0x30984f[_0x5215('0x25')]]={'$like':'%'+_0x78da45[_0x5215('0x2e')][_0x5215('0x3a')]+'%'};return _0x3d78a6;}})});}_0x5cc8db=_[_0x5215('0x3b')]({},_0x5cc8db,_0x78da45[_0x5215('0x3e')]);var _0x20e876={'where':_0x5cc8db[_0x5215('0x37')]};return db[_0x5215('0x29')][_0x5215('0x1b')](_0x20e876)[_0x5215('0x21')](function(_0x518e24){_0x3d75bb[_0x5215('0x1b')]=_0x518e24;if(_0x78da45[_0x5215('0x2e')][_0x5215('0x3f')]){_0x5cc8db['include']=[{'all':!![]}];}return db[_0x5215('0x29')][_0x5215('0x40')](_0x5cc8db);})[_0x5215('0x21')](function(_0x4836db){_0x3d75bb[_0x5215('0x41')]=_0x4836db;return _0x3d75bb;})[_0x5215('0x21')](respondWithFilteredResult(_0x26f4ac,_0x5cc8db))[_0x5215('0x42')](handleError(_0x26f4ac,null));};exports[_0x5215('0x43')]=function(_0x2cd288,_0x40268e){var _0x14473f={'raw':!![],'where':{'id':_0x2cd288[_0x5215('0x44')]['id']}},_0x39571b={};_0x39571b['model']=_[_0x5215('0x2f')](db[_0x5215('0x29')]['rawAttributes']);_0x39571b['query']=_[_0x5215('0x2f')](_0x2cd288[_0x5215('0x2e')]);_0x39571b['filters']=_[_0x5215('0x30')](_0x39571b[_0x5215('0x2d')],_0x39571b[_0x5215('0x2e')]);_0x14473f['attributes']=_[_0x5215('0x30')](_0x39571b[_0x5215('0x2d')],qs[_0x5215('0x45')](_0x2cd288[_0x5215('0x2e')][_0x5215('0x45')]));_0x14473f[_0x5215('0x31')]=_0x14473f[_0x5215('0x31')][_0x5215('0x32')]?_0x14473f[_0x5215('0x31')]:_0x39571b[_0x5215('0x2d')];if(_0x2cd288[_0x5215('0x2e')][_0x5215('0x3f')]){_0x14473f[_0x5215('0x46')]=[{'all':!![]}];}_0x14473f=_['merge']({},_0x14473f,_0x2cd288['options']);return db[_0x5215('0x29')]['find'](_0x14473f)[_0x5215('0x21')](handleEntityNotFound(_0x40268e,null))['then'](respondWithResult(_0x40268e,null))['catch'](handleError(_0x40268e,null));};exports[_0x5215('0x47')]=function(_0x5f1846,_0xe59d44){return db[_0x5215('0x29')]['create'](_0x5f1846[_0x5215('0x48')],{})[_0x5215('0x21')](respondWithResult(_0xe59d44,0xc9))[_0x5215('0x42')](handleError(_0xe59d44,null));};exports[_0x5215('0x20')]=function(_0x3557c6,_0x588b3f){if(_0x3557c6[_0x5215('0x48')]['id']){delete _0x3557c6[_0x5215('0x48')]['id'];}return db[_0x5215('0x29')]['find']({'where':{'id':_0x3557c6['params']['id']}})['then'](handleEntityNotFound(_0x588b3f,null))['then'](saveUpdates(_0x3557c6[_0x5215('0x48')],null))['then'](respondWithResult(_0x588b3f,null))['catch'](handleError(_0x588b3f,null));};exports[_0x5215('0x49')]=function(_0x249a90,_0x58e0e9){return db[_0x5215('0x29')]['find']({'where':{'id':_0x249a90[_0x5215('0x44')]['id']}})[_0x5215('0x21')](handleEntityNotFound(_0x58e0e9,null))[_0x5215('0x21')](removeEntity(_0x58e0e9,null))[_0x5215('0x42')](handleError(_0x58e0e9,null));};exports['describe']=function(_0x225712,_0x5a56a2){return db[_0x5215('0x29')][_0x5215('0x4a')]()['then'](respondWithResult(_0x5a56a2,null))[_0x5215('0x42')](handleError(_0x5a56a2,null));};exports[_0x5215('0x4b')]=function(_0x33c87f,_0x13a556,_0x102ef4){var _0x1766e8={'raw':!![],'where':{}};var _0x299bae={};var _0x3d4e27={'count':0x0,'rows':[]};return db[_0x5215('0x29')][_0x5215('0x4c')]({'where':{'id':_0x33c87f[_0x5215('0x44')]['id']}})[_0x5215('0x21')](handleEntityNotFound(_0x13a556,null))[_0x5215('0x21')](function(_0x28f1f2){if(_0x28f1f2){_0x299bae[_0x5215('0x2d')]=_[_0x5215('0x2f')](db[_0x5215('0x4d')][_0x5215('0x2a')]);_0x299bae[_0x5215('0x2e')]=_[_0x5215('0x2f')](_0x33c87f[_0x5215('0x2e')]);_0x299bae[_0x5215('0x38')]=_['intersection'](_0x299bae[_0x5215('0x2d')],_0x299bae[_0x5215('0x2e')]);_0x1766e8['attributes']=_[_0x5215('0x30')](_0x299bae['model'],qs[_0x5215('0x45')](_0x33c87f[_0x5215('0x2e')][_0x5215('0x45')]));_0x1766e8[_0x5215('0x31')]=_0x1766e8['attributes']['length']?_0x1766e8[_0x5215('0x31')]:_0x299bae[_0x5215('0x2d')];if(!_0x33c87f[_0x5215('0x2e')][_0x5215('0x33')](_0x5215('0x34'))){_0x1766e8[_0x5215('0x35')]=qs[_0x5215('0x35')](_0x33c87f[_0x5215('0x2e')][_0x5215('0x35')]);_0x1766e8[_0x5215('0x19')]=qs[_0x5215('0x19')](_0x33c87f[_0x5215('0x2e')][_0x5215('0x19')]);}_0x1766e8[_0x5215('0x4e')]=qs['sort'](_0x33c87f[_0x5215('0x2e')]['sort']);_0x1766e8[_0x5215('0x37')]=qs[_0x5215('0x38')](_[_0x5215('0x39')](_0x33c87f['query'],_0x299bae['filters']));_0x1766e8[_0x5215('0x37')][_0x5215('0x4f')]=_0x28f1f2['id'];if(_0x33c87f[_0x5215('0x2e')][_0x5215('0x3a')]){_0x1766e8[_0x5215('0x37')]=_[_0x5215('0x3b')](_0x1766e8['where'],{'$or':_[_0x5215('0x28')](_0x1766e8[_0x5215('0x31')],function(_0x48b4fc){var _0x49b4de={};_0x49b4de[_0x48b4fc]={'$like':'%'+_0x33c87f[_0x5215('0x2e')]['filter']+'%'};return _0x49b4de;})});}_0x1766e8=_[_0x5215('0x3b')]({},_0x1766e8,_0x33c87f[_0x5215('0x3e')]);return db[_0x5215('0x4d')]['count']({'where':_0x1766e8['where']})[_0x5215('0x21')](function(_0x1a6d90){_0x3d4e27[_0x5215('0x1b')]=_0x1a6d90;if(_0x33c87f[_0x5215('0x2e')][_0x5215('0x3f')]){_0x1766e8[_0x5215('0x46')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x1766e8);})[_0x5215('0x21')](function(_0x38498b){_0x3d4e27['rows']=_0x38498b;return _0x3d4e27;});}})[_0x5215('0x21')](respondWithFilteredResult(_0x13a556,_0x1766e8))[_0x5215('0x42')](handleError(_0x13a556,null));}; \ No newline at end of file +var _0xf4bb=['papaparse','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','save','then','sendStatus','error','name','send','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','merge','where','options','includeAll','findAll','params','find','catch','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','order','include','rows','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf4bb,0x165));var _0xbf4b=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xf4bb[_0x4baae2];return _0x1a2285;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf4b('0x0'));var zipdir=require(_0xbf4b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf4b('0x2'));var moment=require(_0xbf4b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xbf4b('0x4'));var sox=require(_0xbf4b('0x5'));var csv=require(_0xbf4b('0x6'));var ejs=require(_0xbf4b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf4b('0x8'));var squel=require(_0xbf4b('0x9'));var crypto=require(_0xbf4b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbf4b('0xb'));var toCsv=require(_0xbf4b('0x6'));var querystring=require(_0xbf4b('0xc'));var Papa=require(_0xbf4b('0xd'));var Redis=require(_0xbf4b('0xe'));var authService=require(_0xbf4b('0xf'));var qs=require(_0xbf4b('0x10'));var as=require(_0xbf4b('0x11'));var hardwareService=require(_0xbf4b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xbf4b('0x13'));var config=require(_0xbf4b('0x14'));var licenseUtil=require(_0xbf4b('0x15'));var db=require(_0xbf4b('0x16'))['db'];function respondWithStatusCode(_0x434ec3,_0x29dc90){_0x29dc90=_0x29dc90||0xcc;return function(_0x15a02a){if(_0x15a02a){return _0x434ec3['sendStatus'](_0x29dc90);}return _0x434ec3[_0xbf4b('0x17')](_0x29dc90)[_0xbf4b('0x18')]();};}function respondWithResult(_0x2ee864,_0x2b8151){_0x2b8151=_0x2b8151||0xc8;return function(_0xa5d818){if(_0xa5d818){return _0x2ee864[_0xbf4b('0x17')](_0x2b8151)['json'](_0xa5d818);}};}function respondWithFilteredResult(_0x4ff406,_0x1bed98){return function(_0x13974b){if(_0x13974b){var _0x263fc0=typeof _0x1bed98[_0xbf4b('0x19')]===_0xbf4b('0x1a')&&typeof _0x1bed98[_0xbf4b('0x1b')]===_0xbf4b('0x1a');var _0x1607cf=_0x13974b[_0xbf4b('0x1c')];var _0x1fba5f=_0x263fc0?0x0:_0x1bed98[_0xbf4b('0x19')];var _0x482698=_0x263fc0?_0x13974b[_0xbf4b('0x1c')]:_0x1bed98['offset']+_0x1bed98[_0xbf4b('0x1b')];var _0x2f4723;if(_0x482698>=_0x1607cf){_0x482698=_0x1607cf;_0x2f4723=0xc8;}else{_0x2f4723=0xce;}_0x4ff406[_0xbf4b('0x17')](_0x2f4723);return _0x4ff406[_0xbf4b('0x1d')](_0xbf4b('0x1e'),_0x1fba5f+'-'+_0x482698+'/'+_0x1607cf)[_0xbf4b('0x1f')](_0x13974b);}return null;};}function patchUpdates(_0x212e01){return function(_0x4d24ca){try{jsonpatch['apply'](_0x4d24ca,_0x212e01,!![]);}catch(_0x54e7a6){return BPromise[_0xbf4b('0x20')](_0x54e7a6);}return _0x4d24ca[_0xbf4b('0x21')]();};}function saveUpdates(_0x4e4992,_0x18a9f7){return function(_0x228b25){if(_0x228b25){return _0x228b25['update'](_0x4e4992)[_0xbf4b('0x22')](function(_0x59dda5){return _0x59dda5;});}return null;};}function removeEntity(_0x8db155,_0x100198){return function(_0x4612a4){if(_0x4612a4){return _0x4612a4['destroy']()[_0xbf4b('0x22')](function(){_0x8db155[_0xbf4b('0x17')](0xcc)[_0xbf4b('0x18')]();});}};}function handleEntityNotFound(_0x2b6c27,_0x164f91){return function(_0x3c3f8e){if(!_0x3c3f8e){_0x2b6c27[_0xbf4b('0x23')](0x194);}return _0x3c3f8e;};}function handleError(_0x27fef2,_0x1ddd28){_0x1ddd28=_0x1ddd28||0x1f4;return function(_0x548d02){logger[_0xbf4b('0x24')](_0x548d02['stack']);if(_0x548d02[_0xbf4b('0x25')]){delete _0x548d02['name'];}_0x27fef2[_0xbf4b('0x17')](_0x1ddd28)[_0xbf4b('0x26')](_0x548d02);};}exports[_0xbf4b('0x27')]=function(_0x146229,_0x324a3b){var _0x25e1cd={},_0x49adf7={},_0x3c70f7={'count':0x0,'rows':[]};var _0x202af0=_[_0xbf4b('0x28')](db[_0xbf4b('0x29')][_0xbf4b('0x2a')],function(_0x181032){return{'name':_0x181032['fieldName'],'type':_0x181032[_0xbf4b('0x2b')][_0xbf4b('0x2c')]};});_0x49adf7[_0xbf4b('0x2d')]=_[_0xbf4b('0x28')](_0x202af0,_0xbf4b('0x25'));_0x49adf7[_0xbf4b('0x2e')]=_[_0xbf4b('0x2f')](_0x146229[_0xbf4b('0x2e')]);_0x49adf7['filters']=_[_0xbf4b('0x30')](_0x49adf7[_0xbf4b('0x2d')],_0x49adf7['query']);_0x25e1cd[_0xbf4b('0x31')]=_[_0xbf4b('0x30')](_0x49adf7[_0xbf4b('0x2d')],qs[_0xbf4b('0x32')](_0x146229['query'][_0xbf4b('0x32')]));_0x25e1cd[_0xbf4b('0x31')]=_0x25e1cd[_0xbf4b('0x31')][_0xbf4b('0x33')]?_0x25e1cd[_0xbf4b('0x31')]:_0x49adf7[_0xbf4b('0x2d')];if(!_0x146229[_0xbf4b('0x2e')]['hasOwnProperty'](_0xbf4b('0x34'))){_0x25e1cd[_0xbf4b('0x1b')]=qs[_0xbf4b('0x1b')](_0x146229[_0xbf4b('0x2e')][_0xbf4b('0x1b')]);_0x25e1cd['offset']=qs[_0xbf4b('0x19')](_0x146229[_0xbf4b('0x2e')][_0xbf4b('0x19')]);}_0x25e1cd['order']=qs[_0xbf4b('0x35')](_0x146229[_0xbf4b('0x2e')][_0xbf4b('0x35')]);_0x25e1cd['where']=qs[_0xbf4b('0x36')](_[_0xbf4b('0x37')](_0x146229['query'],_0x49adf7[_0xbf4b('0x36')]),_0x202af0);if(_0x146229[_0xbf4b('0x2e')][_0xbf4b('0x38')]){_0x25e1cd['where']=_[_0xbf4b('0x39')](_0x25e1cd[_0xbf4b('0x3a')],{'$or':_[_0xbf4b('0x28')](_0x202af0,function(_0x4f6106){if(_0x4f6106['type']!=='VIRTUAL'){var _0x979a41={};_0x979a41[_0x4f6106[_0xbf4b('0x25')]]={'$like':'%'+_0x146229[_0xbf4b('0x2e')]['filter']+'%'};return _0x979a41;}})});}_0x25e1cd=_[_0xbf4b('0x39')]({},_0x25e1cd,_0x146229[_0xbf4b('0x3b')]);var _0x4de848={'where':_0x25e1cd[_0xbf4b('0x3a')]};return db[_0xbf4b('0x29')][_0xbf4b('0x1c')](_0x4de848)['then'](function(_0x4a43c3){_0x3c70f7[_0xbf4b('0x1c')]=_0x4a43c3;if(_0x146229[_0xbf4b('0x2e')][_0xbf4b('0x3c')]){_0x25e1cd['include']=[{'all':!![]}];}return db[_0xbf4b('0x29')][_0xbf4b('0x3d')](_0x25e1cd);})[_0xbf4b('0x22')](function(_0x4fff25){_0x3c70f7['rows']=_0x4fff25;return _0x3c70f7;})[_0xbf4b('0x22')](respondWithFilteredResult(_0x324a3b,_0x25e1cd))['catch'](handleError(_0x324a3b,null));};exports['show']=function(_0x4f4f8c,_0x4e7ec7){var _0x4d8bc6={'raw':!![],'where':{'id':_0x4f4f8c[_0xbf4b('0x3e')]['id']}},_0x5de729={};_0x5de729[_0xbf4b('0x2d')]=_[_0xbf4b('0x2f')](db[_0xbf4b('0x29')]['rawAttributes']);_0x5de729[_0xbf4b('0x2e')]=_[_0xbf4b('0x2f')](_0x4f4f8c[_0xbf4b('0x2e')]);_0x5de729[_0xbf4b('0x36')]=_[_0xbf4b('0x30')](_0x5de729[_0xbf4b('0x2d')],_0x5de729[_0xbf4b('0x2e')]);_0x4d8bc6[_0xbf4b('0x31')]=_[_0xbf4b('0x30')](_0x5de729[_0xbf4b('0x2d')],qs[_0xbf4b('0x32')](_0x4f4f8c[_0xbf4b('0x2e')][_0xbf4b('0x32')]));_0x4d8bc6['attributes']=_0x4d8bc6['attributes'][_0xbf4b('0x33')]?_0x4d8bc6['attributes']:_0x5de729['model'];if(_0x4f4f8c[_0xbf4b('0x2e')]['includeAll']){_0x4d8bc6['include']=[{'all':!![]}];}_0x4d8bc6=_['merge']({},_0x4d8bc6,_0x4f4f8c[_0xbf4b('0x3b')]);return db[_0xbf4b('0x29')][_0xbf4b('0x3f')](_0x4d8bc6)[_0xbf4b('0x22')](handleEntityNotFound(_0x4e7ec7,null))[_0xbf4b('0x22')](respondWithResult(_0x4e7ec7,null))[_0xbf4b('0x40')](handleError(_0x4e7ec7,null));};exports['create']=function(_0x13290d,_0xfb3c7b){return db['JscriptySessionReport']['create'](_0x13290d[_0xbf4b('0x41')],{})['then'](respondWithResult(_0xfb3c7b,0xc9))[_0xbf4b('0x40')](handleError(_0xfb3c7b,null));};exports['update']=function(_0x2366e3,_0x2d473f){if(_0x2366e3['body']['id']){delete _0x2366e3['body']['id'];}return db[_0xbf4b('0x29')]['find']({'where':{'id':_0x2366e3[_0xbf4b('0x3e')]['id']}})[_0xbf4b('0x22')](handleEntityNotFound(_0x2d473f,null))['then'](saveUpdates(_0x2366e3[_0xbf4b('0x41')],null))[_0xbf4b('0x22')](respondWithResult(_0x2d473f,null))[_0xbf4b('0x40')](handleError(_0x2d473f,null));};exports[_0xbf4b('0x42')]=function(_0x524c19,_0x206346){return db[_0xbf4b('0x29')][_0xbf4b('0x3f')]({'where':{'id':_0x524c19[_0xbf4b('0x3e')]['id']}})[_0xbf4b('0x22')](handleEntityNotFound(_0x206346,null))['then'](removeEntity(_0x206346,null))['catch'](handleError(_0x206346,null));};exports[_0xbf4b('0x43')]=function(_0x3bb225,_0x43d57f){return db[_0xbf4b('0x29')][_0xbf4b('0x43')]()[_0xbf4b('0x22')](respondWithResult(_0x43d57f,null))[_0xbf4b('0x40')](handleError(_0x43d57f,null));};exports[_0xbf4b('0x44')]=function(_0x3d5d1a,_0x3239ae,_0x471253){var _0x4779b6={'raw':!![],'where':{}};var _0x5068cc={};var _0x31b933={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xbf4b('0x45')]({'where':{'id':_0x3d5d1a['params']['id']}})[_0xbf4b('0x22')](handleEntityNotFound(_0x3239ae,null))[_0xbf4b('0x22')](function(_0x49d4a1){if(_0x49d4a1){_0x5068cc[_0xbf4b('0x2d')]=_[_0xbf4b('0x2f')](db[_0xbf4b('0x46')][_0xbf4b('0x2a')]);_0x5068cc['query']=_['keys'](_0x3d5d1a['query']);_0x5068cc[_0xbf4b('0x36')]=_[_0xbf4b('0x30')](_0x5068cc[_0xbf4b('0x2d')],_0x5068cc[_0xbf4b('0x2e')]);_0x4779b6[_0xbf4b('0x31')]=_[_0xbf4b('0x30')](_0x5068cc['model'],qs[_0xbf4b('0x32')](_0x3d5d1a[_0xbf4b('0x2e')][_0xbf4b('0x32')]));_0x4779b6[_0xbf4b('0x31')]=_0x4779b6[_0xbf4b('0x31')][_0xbf4b('0x33')]?_0x4779b6[_0xbf4b('0x31')]:_0x5068cc[_0xbf4b('0x2d')];if(!_0x3d5d1a[_0xbf4b('0x2e')]['hasOwnProperty'](_0xbf4b('0x34'))){_0x4779b6['limit']=qs[_0xbf4b('0x1b')](_0x3d5d1a[_0xbf4b('0x2e')][_0xbf4b('0x1b')]);_0x4779b6[_0xbf4b('0x19')]=qs['offset'](_0x3d5d1a[_0xbf4b('0x2e')][_0xbf4b('0x19')]);}_0x4779b6[_0xbf4b('0x47')]=qs[_0xbf4b('0x35')](_0x3d5d1a[_0xbf4b('0x2e')][_0xbf4b('0x35')]);_0x4779b6['where']=qs[_0xbf4b('0x36')](_['pick'](_0x3d5d1a[_0xbf4b('0x2e')],_0x5068cc[_0xbf4b('0x36')]));_0x4779b6['where']['SessionId']=_0x49d4a1['id'];if(_0x3d5d1a['query']['filter']){_0x4779b6[_0xbf4b('0x3a')]=_['merge'](_0x4779b6[_0xbf4b('0x3a')],{'$or':_[_0xbf4b('0x28')](_0x4779b6[_0xbf4b('0x31')],function(_0xfc8bf){var _0x2bd2b7={};_0x2bd2b7[_0xfc8bf]={'$like':'%'+_0x3d5d1a['query']['filter']+'%'};return _0x2bd2b7;})});}_0x4779b6=_[_0xbf4b('0x39')]({},_0x4779b6,_0x3d5d1a[_0xbf4b('0x3b')]);return db[_0xbf4b('0x46')][_0xbf4b('0x1c')]({'where':_0x4779b6['where']})[_0xbf4b('0x22')](function(_0x12d501){_0x31b933[_0xbf4b('0x1c')]=_0x12d501;if(_0x3d5d1a[_0xbf4b('0x2e')][_0xbf4b('0x3c')]){_0x4779b6[_0xbf4b('0x48')]=[{'all':!![]}];}return db[_0xbf4b('0x46')][_0xbf4b('0x3d')](_0x4779b6);})[_0xbf4b('0x22')](function(_0x37b21a){_0x31b933[_0xbf4b('0x49')]=_0x37b21a;return _0x31b933;});}})[_0xbf4b('0x22')](respondWithFilteredResult(_0x3239ae,_0x4779b6))[_0xbf4b('0x40')](handleError(_0x3239ae,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index e0c00f3..7e9dbd7 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 _0x277c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','report_jscripty_sessions','lodash','../../config/logger'];(function(_0x49713a,_0x2c367e){var _0x5ad13f=function(_0x3e2a8d){while(--_0x3e2a8d){_0x49713a['push'](_0x49713a['shift']());}};_0x5ad13f(++_0x2c367e);}(_0x277c,0x153));var _0xc277=function(_0x6ccf36,_0x13b0af){_0x6ccf36=_0x6ccf36-0x0;var _0x4bb025=_0x277c[_0x6ccf36];return _0x4bb025;};'use strict';var _=require(_0xc277('0x0'));var util=require('util');var logger=require(_0xc277('0x1'))(_0xc277('0x2'));var moment=require(_0xc277('0x3'));var BPromise=require(_0xc277('0x4'));var rp=require(_0xc277('0x5'));var fs=require('fs');var path=require(_0xc277('0x6'));var rimraf=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x1a6582,_0x5a4f03){return _0x1a6582[_0xc277('0x9')]('JscriptySessionReport',attributes,{'tableName':_0xc277('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fb4=['./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x4fb4,0x190));var _0x44fb=function(_0x5ca75e,_0x2395f2){_0x5ca75e=_0x5ca75e-0x0;var _0x270cfb=_0x4fb4[_0x5ca75e];return _0x270cfb;};'use strict';var _=require('lodash');var util=require(_0x44fb('0x0'));var logger=require(_0x44fb('0x1'))(_0x44fb('0x2'));var moment=require(_0x44fb('0x3'));var BPromise=require(_0x44fb('0x4'));var rp=require(_0x44fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var attributes=require(_0x44fb('0x8'));module[_0x44fb('0x9')]=function(_0x375d33,_0x173e70){return _0x375d33[_0x44fb('0xa')](_0x44fb('0xb'),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 5938870..d50773c 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 _0x7046=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5f2730,_0x433ad9){var _0x242fda=function(_0x327208){while(--_0x327208){_0x5f2730['push'](_0x5f2730['shift']());}};_0x242fda(++_0x433ad9);}(_0x7046,0x144));var _0x6704=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x7046[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var BPromise=require(_0x6704('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6704('0x4'));var db=require(_0x6704('0x5'))['db'];var utils=require(_0x6704('0x6'));var logger=require('../../config/logger')(_0x6704('0x7'));var config=require(_0x6704('0x8'));var jayson=require(_0x6704('0x9'));var client=jayson[_0x6704('0xa')][_0x6704('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4badf8,_0x5ced8,_0x49b8b6){return new BPromise(function(_0x56b1ff,_0x390ace){return client['request'](_0x4badf8,_0x49b8b6)['then'](function(_0x3ca599){logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,_0x6704('0xe'));logger[_0x6704('0xf')](_0x6704('0x10'),_0x5ced8,_0x6704('0xe'),JSON[_0x6704('0x11')](_0x3ca599));if(_0x3ca599['error']){if(_0x3ca599[_0x6704('0x12')][_0x6704('0x13')]===0x1f4){logger['error'](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x390ace(_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);}logger[_0x6704('0x12')](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x56b1ff(_0x3ca599['error'][_0x6704('0x14')]);}else{logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,'request\x20sent');_0x56b1ff(_0x3ca599[_0x6704('0x15')][_0x6704('0x14')]);}})[_0x6704('0x16')](function(_0x29fa46){logger[_0x6704('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x5ced8,_0x29fa46);_0x390ace(_0x29fa46);});});} \ No newline at end of file +var _0x4e2e=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1f9bc9,_0x321bd6){var _0x643523=function(_0x49ece8){while(--_0x49ece8){_0x1f9bc9['push'](_0x1f9bc9['shift']());}};_0x643523(++_0x321bd6);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x3411de,_0x21665b){_0x3411de=_0x3411de-0x0;var _0x247fa0=_0x4e2e[_0x3411de];return _0x247fa0;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var moment=require(_0xe4e2('0x1'));var BPromise=require(_0xe4e2('0x2'));var rs=require(_0xe4e2('0x3'));var fs=require('fs');var Redis=require(_0xe4e2('0x4'));var db=require(_0xe4e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4e2('0x6'))(_0xe4e2('0x7'));var config=require(_0xe4e2('0x8'));var jayson=require(_0xe4e2('0x9'));var client=jayson['client'][_0xe4e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36b1c6,_0x1c4e64,_0x125338){return new BPromise(function(_0x956c75,_0x27304b){return client[_0xe4e2('0xb')](_0x36b1c6,_0x125338)[_0xe4e2('0xc')](function(_0x4912da){logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));logger['debug'](_0xe4e2('0x10'),_0x1c4e64,_0xe4e2('0xf'),JSON[_0xe4e2('0x11')](_0x4912da));if(_0x4912da[_0xe4e2('0x12')]){if(_0x4912da[_0xe4e2('0x12')]['code']===0x1f4){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x27304b(_0x4912da['error'][_0xe4e2('0x13')]);}logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x4912da[_0xe4e2('0x12')][_0xe4e2('0x13')]);return _0x956c75(_0x4912da['error']['message']);}else{logger[_0xe4e2('0xd')](_0xe4e2('0xe'),_0x1c4e64,_0xe4e2('0xf'));_0x956c75(_0x4912da[_0xe4e2('0x14')][_0xe4e2('0x13')]);}})['catch'](function(_0x754778){logger[_0xe4e2('0x12')](_0xe4e2('0xe'),_0x1c4e64,_0x754778);_0x27304b(_0x754778);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index d8d2d56..c13845f 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 _0xaeee=['Router','fs-extra','./license.controller','get','index','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','util','connect-timeout','express'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaeee,0x1af));var _0xeaee=function(_0x2436b7,_0x5007a7){_0x2436b7=_0x2436b7-0x0;var _0xfb46f4=_0xaeee[_0x2436b7];return _0xfb46f4;};'use strict';var multer=require(_0xeaee('0x0'));var util=require(_0xeaee('0x1'));var path=require('path');var timeout=require(_0xeaee('0x2'));var express=require(_0xeaee('0x3'));var router=express[_0xeaee('0x4')]();var fs_extra=require(_0xeaee('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xeaee('0x6'));router[_0xeaee('0x7')]('/',controller[_0xeaee('0x8')]);router['put'](_0xeaee('0x9'),auth[_0xeaee('0xa')](),controller[_0xeaee('0xb')]);router[_0xeaee('0x7')](_0xeaee('0xc'),auth[_0xeaee('0xa')](),controller[_0xeaee('0xd')]);module[_0xeaee('0xe')]=router; \ No newline at end of file +var _0x8f04=['../../components/interaction/service','../../config/environment','get','index','put','isAuthenticated','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x289e48,_0x2fe387){var _0x56d497=function(_0x2abb13){while(--_0x2abb13){_0x289e48['push'](_0x289e48['shift']());}};_0x56d497(++_0x2fe387);}(_0x8f04,0xda));var _0x48f0=function(_0x1e6f26,_0x27d992){_0x1e6f26=_0x1e6f26-0x0;var _0x4820f9=_0x8f04[_0x1e6f26];return _0x4820f9;};'use strict';var multer=require(_0x48f0('0x0'));var util=require(_0x48f0('0x1'));var path=require('path');var timeout=require(_0x48f0('0x2'));var express=require(_0x48f0('0x3'));var router=express['Router']();var fs_extra=require(_0x48f0('0x4'));var auth=require(_0x48f0('0x5'));var interaction=require(_0x48f0('0x6'));var config=require(_0x48f0('0x7'));var controller=require('./license.controller');router[_0x48f0('0x8')]('/',controller[_0x48f0('0x9')]);router[_0x48f0('0xa')]('/:id',auth[_0x48f0('0xb')](),controller[_0x48f0('0xc')]);router[_0x48f0('0x8')]('/download_log_file',auth[_0x48f0('0xb')](),controller['downloadLogFile']);module[_0x48f0('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 31b8b6e..910308f 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 _0x4aa5=['STRING','INTEGER','exports','TEXT'];(function(_0x5e42a4,_0x1b48be){var _0x51acb8=function(_0x5c4827){while(--_0x5c4827){_0x5e42a4['push'](_0x5e42a4['shift']());}};_0x51acb8(++_0x1b48be);}(_0x4aa5,0xf2));var _0x54aa=function(_0x224211,_0xed797a){_0x224211=_0x224211-0x0;var _0x15e5b4=_0x4aa5[_0x224211];return _0x15e5b4;};'use strict';var Sequelize=require('sequelize');module[_0x54aa('0x0')]={'license':{'type':Sequelize[_0x54aa('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x54aa('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x54aa('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfd5c=['sequelize','exports','STRING'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xfd5c,0x19e));var _0xcfd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd5c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcfd5('0x0'));module[_0xcfd5('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xcfd5('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 b9f4188..50051a0 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 _0x336a=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','end','name','send','../../config/license/util','model','query','filters','attributes','fields','length','merge','options','getLicense','catch','update','body','find','params','get','checkLicense','key','downloadLogFile','license-info.log','join','/var','xcally','Content-disposition','attachment;\x20filename=','set','Content-Type','text/plain','download','eml-format','rimraf','zip-dir'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x336a,0x156));var _0xa336=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x336a[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0xa336('0x0'));var rimraf=require(_0xa336('0x1'));var zipdir=require(_0xa336('0x2'));var jsonpatch=require(_0xa336('0x3'));var rp=require(_0xa336('0x4'));var moment=require(_0xa336('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa336('0x6'));var util=require(_0xa336('0x7'));var path=require(_0xa336('0x8'));var sox=require(_0xa336('0x9'));var csv=require(_0xa336('0xa'));var ejs=require(_0xa336('0xb'));var fs=require('fs');var fs_extra=require(_0xa336('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa336('0xd'));var jsforce=require(_0xa336('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa336('0xa'));var querystring=require('querystring');var Papa=require(_0xa336('0xf'));var Redis=require(_0xa336('0x10'));var authService=require(_0xa336('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa336('0x12'));var hardwareService=require(_0xa336('0x13'));var logger=require(_0xa336('0x14'))('api');var utils=require(_0xa336('0x15'));var config=require(_0xa336('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa336('0x17'))['db'];function respondWithStatusCode(_0x5127a7,_0x1208c2){_0x1208c2=_0x1208c2||0xcc;return function(_0x152f46){if(_0x152f46){return _0x5127a7[_0xa336('0x18')](_0x1208c2);}return _0x5127a7[_0xa336('0x19')](_0x1208c2)['end']();};}function respondWithResult(_0x1748f0,_0x145114){_0x145114=_0x145114||0xc8;return function(_0x3583f1){if(_0x3583f1){return _0x1748f0['status'](_0x145114)[_0xa336('0x1a')](_0x3583f1);}};}function respondWithFilteredResult(_0x350220,_0x3ec8f7){return function(_0x36e4ed){if(_0x36e4ed){var _0x2f2647=typeof _0x3ec8f7[_0xa336('0x1b')]===_0xa336('0x1c')&&typeof _0x3ec8f7['limit']===_0xa336('0x1c');var _0x48316f=_0x36e4ed[_0xa336('0x1d')];var _0x4ac77d=_0x2f2647?0x0:_0x3ec8f7['offset'];var _0x26b1e8=_0x2f2647?_0x36e4ed[_0xa336('0x1d')]:_0x3ec8f7[_0xa336('0x1b')]+_0x3ec8f7[_0xa336('0x1e')];var _0x1808e8;if(_0x26b1e8>=_0x48316f){_0x26b1e8=_0x48316f;_0x1808e8=0xc8;}else{_0x1808e8=0xce;}_0x350220[_0xa336('0x19')](_0x1808e8);return _0x350220['set'](_0xa336('0x1f'),_0x4ac77d+'-'+_0x26b1e8+'/'+_0x48316f)[_0xa336('0x1a')](_0x36e4ed);}return null;};}function patchUpdates(_0x317b9a){return function(_0x437e06){try{jsonpatch[_0xa336('0x20')](_0x437e06,_0x317b9a,!![]);}catch(_0x461334){return BPromise[_0xa336('0x21')](_0x461334);}return _0x437e06[_0xa336('0x22')]();};}function saveUpdates(_0x16a70e,_0xc4aab7){return function(_0x4d77f7){if(_0x4d77f7){return _0x4d77f7['update'](_0x16a70e)[_0xa336('0x23')](function(_0x2cac17){return _0x2cac17;});}return null;};}function removeEntity(_0x4b82dd,_0x2bde91){return function(_0x2b0634){if(_0x2b0634){return _0x2b0634[_0xa336('0x24')]()[_0xa336('0x23')](function(){_0x4b82dd[_0xa336('0x19')](0xcc)[_0xa336('0x25')]();});}};}function handleEntityNotFound(_0x2472e7,_0x3bf81f){return function(_0x3360cc){if(!_0x3360cc){_0x2472e7[_0xa336('0x18')](0x194);}return _0x3360cc;};}function handleError(_0x426c94,_0x3c8c17){_0x3c8c17=_0x3c8c17||0x1f4;return function(_0x5d0f16){logger['error'](_0x5d0f16['stack']);if(_0x5d0f16[_0xa336('0x26')]){delete _0x5d0f16[_0xa336('0x26')];}_0x426c94[_0xa336('0x19')](_0x3c8c17)[_0xa336('0x27')](_0x5d0f16);};}var utilLicense=require(_0xa336('0x28'));exports['index']=function(_0x233cdd,_0x2afe21){var _0x56cadb={'raw':!![],'where':{'id':0x1}},_0x1f541d={};_0x1f541d[_0xa336('0x29')]=_['keys'](db['License']['rawAttributes']);_0x1f541d[_0xa336('0x2a')]=_['keys'](_0x233cdd[_0xa336('0x2a')]);_0x1f541d[_0xa336('0x2b')]=_['intersection'](_0x1f541d[_0xa336('0x29')],_0x1f541d[_0xa336('0x2a')]);_0x56cadb[_0xa336('0x2c')]=_['intersection'](_0x1f541d[_0xa336('0x29')],qs[_0xa336('0x2d')](_0x233cdd['query'][_0xa336('0x2d')]));_0x56cadb[_0xa336('0x2c')]=_0x56cadb[_0xa336('0x2c')][_0xa336('0x2e')]?_0x56cadb[_0xa336('0x2c')]:_0x1f541d[_0xa336('0x29')];_0x56cadb=_[_0xa336('0x2f')]({},_0x56cadb,_0x233cdd[_0xa336('0x30')]);return utilLicense[_0xa336('0x31')](_0x56cadb)[_0xa336('0x23')](respondWithResult(_0x2afe21,null))[_0xa336('0x32')](handleError(_0x2afe21,null));};exports[_0xa336('0x33')]=function(_0x5b8f33,_0x2c1d47){if(_0x5b8f33[_0xa336('0x34')]['id']){delete _0x5b8f33[_0xa336('0x34')]['id'];}return db['License'][_0xa336('0x35')]({'where':{'id':_0x5b8f33[_0xa336('0x36')]['id']}})[_0xa336('0x23')](handleEntityNotFound(_0x2c1d47,null))[_0xa336('0x23')](function(_0x2f2e8f){var _0x3d9d77=_0x2f2e8f[_0xa336('0x37')]({'plain':!![]});return utilLicense[_0xa336('0x38')](_0x3d9d77,_0x5b8f33['body'][_0xa336('0x39')]);})[_0xa336('0x23')](function(_0x4f6479){if(!_0x4f6479['demo']){return saveUpdates(_0x5b8f33[_0xa336('0x34')],null);}return _0x4f6479;})[_0xa336('0x23')](respondWithResult(_0x2c1d47,null))[_0xa336('0x32')](handleError(_0x2c1d47,null));};exports[_0xa336('0x3a')]=function(_0x22e9eb,_0x367550){var _0x4dd855=_0xa336('0x3b');var _0x3265ff=path[_0xa336('0x3c')](_0xa336('0x3d'),'log',_0xa336('0x3e'),_0x4dd855);_0x367550['setHeader'](_0xa336('0x3f'),_0xa336('0x40')+_0x4dd855);_0x367550[_0xa336('0x41')](_0xa336('0x42'),_0xa336('0x43'));_0x367550[_0xa336('0x44')](_0x3265ff);}; \ No newline at end of file +var _0x430a=['json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','../../config/license/util','License','query','keys','filters','model','attributes','fields','length','merge','options','getLicense','catch','body','params','get','checkLicense','key','downloadLogFile','log','xcally','setHeader','attachment;\x20filename=','set','Content-Type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status'];(function(_0x37c9e6,_0x3233d7){var _0x54c830=function(_0x5aa834){while(--_0x5aa834){_0x37c9e6['push'](_0x37c9e6['shift']());}};_0x54c830(++_0x3233d7);}(_0x430a,0x1e0));var _0xa430=function(_0x20c4fe,_0x308afc){_0x20c4fe=_0x20c4fe-0x0;var _0x585c12=_0x430a[_0x20c4fe];return _0x585c12;};'use strict';var emlformat=require(_0xa430('0x0'));var rimraf=require(_0xa430('0x1'));var zipdir=require(_0xa430('0x2'));var jsonpatch=require(_0xa430('0x3'));var rp=require(_0xa430('0x4'));var moment=require(_0xa430('0x5'));var BPromise=require(_0xa430('0x6'));var Mustache=require(_0xa430('0x7'));var util=require('util');var path=require(_0xa430('0x8'));var sox=require(_0xa430('0x9'));var csv=require(_0xa430('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa430('0xb'));var _=require(_0xa430('0xc'));var squel=require(_0xa430('0xd'));var crypto=require('crypto');var jsforce=require(_0xa430('0xe'));var deskjs=require(_0xa430('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa430('0x10'));var Papa=require(_0xa430('0x11'));var Redis=require(_0xa430('0x12'));var authService=require(_0xa430('0x13'));var qs=require(_0xa430('0x14'));var as=require(_0xa430('0x15'));var hardwareService=require(_0xa430('0x16'));var logger=require(_0xa430('0x17'))(_0xa430('0x18'));var utils=require(_0xa430('0x19'));var config=require(_0xa430('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xa430('0x1b'))['db'];function respondWithStatusCode(_0x59229c,_0x1321b0){_0x1321b0=_0x1321b0||0xcc;return function(_0x587364){if(_0x587364){return _0x59229c[_0xa430('0x1c')](_0x1321b0);}return _0x59229c['status'](_0x1321b0)[_0xa430('0x1d')]();};}function respondWithResult(_0x3759b3,_0x297acb){_0x297acb=_0x297acb||0xc8;return function(_0x174c22){if(_0x174c22){return _0x3759b3[_0xa430('0x1e')](_0x297acb)[_0xa430('0x1f')](_0x174c22);}};}function respondWithFilteredResult(_0x261a65,_0x304da2){return function(_0xb64f18){if(_0xb64f18){var _0x4099ca=typeof _0x304da2[_0xa430('0x20')]===_0xa430('0x21')&&typeof _0x304da2['limit']==='undefined';var _0x461f3f=_0xb64f18[_0xa430('0x22')];var _0x5a6f12=_0x4099ca?0x0:_0x304da2[_0xa430('0x20')];var _0x42074e=_0x4099ca?_0xb64f18[_0xa430('0x22')]:_0x304da2[_0xa430('0x20')]+_0x304da2[_0xa430('0x23')];var _0x1ab432;if(_0x42074e>=_0x461f3f){_0x42074e=_0x461f3f;_0x1ab432=0xc8;}else{_0x1ab432=0xce;}_0x261a65[_0xa430('0x1e')](_0x1ab432);return _0x261a65['set'](_0xa430('0x24'),_0x5a6f12+'-'+_0x42074e+'/'+_0x461f3f)[_0xa430('0x1f')](_0xb64f18);}return null;};}function patchUpdates(_0x178961){return function(_0x582b1d){try{jsonpatch[_0xa430('0x25')](_0x582b1d,_0x178961,!![]);}catch(_0x9dc384){return BPromise[_0xa430('0x26')](_0x9dc384);}return _0x582b1d[_0xa430('0x27')]();};}function saveUpdates(_0xb7ee05,_0x5a0eeb){return function(_0x5eb86c){if(_0x5eb86c){return _0x5eb86c[_0xa430('0x28')](_0xb7ee05)['then'](function(_0x22ca96){return _0x22ca96;});}return null;};}function removeEntity(_0x4f4c8c,_0x139091){return function(_0x190674){if(_0x190674){return _0x190674[_0xa430('0x29')]()[_0xa430('0x2a')](function(){_0x4f4c8c[_0xa430('0x1e')](0xcc)[_0xa430('0x1d')]();});}};}function handleEntityNotFound(_0x540a5c,_0x54b6eb){return function(_0x12d137){if(!_0x12d137){_0x540a5c['sendStatus'](0x194);}return _0x12d137;};}function handleError(_0xd18735,_0x3bb78f){_0x3bb78f=_0x3bb78f||0x1f4;return function(_0x552fb4){logger[_0xa430('0x2b')](_0x552fb4[_0xa430('0x2c')]);if(_0x552fb4[_0xa430('0x2d')]){delete _0x552fb4['name'];}_0xd18735[_0xa430('0x1e')](_0x3bb78f)[_0xa430('0x2e')](_0x552fb4);};}var utilLicense=require(_0xa430('0x2f'));exports['index']=function(_0x4181f7,_0x4ffbea){var _0x12d6bc={'raw':!![],'where':{'id':0x1}},_0x3d1666={};_0x3d1666['model']=_['keys'](db[_0xa430('0x30')]['rawAttributes']);_0x3d1666[_0xa430('0x31')]=_[_0xa430('0x32')](_0x4181f7[_0xa430('0x31')]);_0x3d1666[_0xa430('0x33')]=_['intersection'](_0x3d1666[_0xa430('0x34')],_0x3d1666[_0xa430('0x31')]);_0x12d6bc[_0xa430('0x35')]=_['intersection'](_0x3d1666[_0xa430('0x34')],qs[_0xa430('0x36')](_0x4181f7[_0xa430('0x31')][_0xa430('0x36')]));_0x12d6bc[_0xa430('0x35')]=_0x12d6bc[_0xa430('0x35')][_0xa430('0x37')]?_0x12d6bc[_0xa430('0x35')]:_0x3d1666[_0xa430('0x34')];_0x12d6bc=_[_0xa430('0x38')]({},_0x12d6bc,_0x4181f7[_0xa430('0x39')]);return utilLicense[_0xa430('0x3a')](_0x12d6bc)['then'](respondWithResult(_0x4ffbea,null))[_0xa430('0x3b')](handleError(_0x4ffbea,null));};exports['update']=function(_0x8dbb9a,_0x40fad7){if(_0x8dbb9a[_0xa430('0x3c')]['id']){delete _0x8dbb9a['body']['id'];}return db[_0xa430('0x30')]['find']({'where':{'id':_0x8dbb9a[_0xa430('0x3d')]['id']}})['then'](handleEntityNotFound(_0x40fad7,null))[_0xa430('0x2a')](function(_0x4f1d9e){var _0x3c844e=_0x4f1d9e[_0xa430('0x3e')]({'plain':!![]});return utilLicense[_0xa430('0x3f')](_0x3c844e,_0x8dbb9a[_0xa430('0x3c')][_0xa430('0x40')]);})[_0xa430('0x2a')](function(_0x40b7af){if(!_0x40b7af['demo']){return saveUpdates(_0x8dbb9a[_0xa430('0x3c')],null);}return _0x40b7af;})['then'](respondWithResult(_0x40fad7,null))['catch'](handleError(_0x40fad7,null));};exports[_0xa430('0x41')]=function(_0x57ae56,_0xb350ec){var _0x4b1c0f='license-info.log';var _0x672ed4=path['join']('/var',_0xa430('0x42'),_0xa430('0x43'),_0x4b1c0f);_0xb350ec[_0xa430('0x44')]('Content-disposition',_0xa430('0x45')+_0x4b1c0f);_0xb350ec[_0xa430('0x46')](_0xa430('0x47'),'text/plain');_0xb350ec[_0xa430('0x48')](_0x672ed4);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 1c0fb17..60b9ecd 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 _0x1e89=['bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','util','api','moment'];(function(_0x51f9b9,_0x534962){var _0x47a44b=function(_0x45e137){while(--_0x45e137){_0x51f9b9['push'](_0x51f9b9['shift']());}};_0x47a44b(++_0x534962);}(_0x1e89,0x1bf));var _0x91e8=function(_0x245675,_0x18e533){_0x245675=_0x245675-0x0;var _0x2c9a25=_0x1e89[_0x245675];return _0x2c9a25;};'use strict';var _=require('lodash');var util=require(_0x91e8('0x0'));var logger=require('../../config/logger')(_0x91e8('0x1'));var moment=require(_0x91e8('0x2'));var BPromise=require(_0x91e8('0x3'));var rp=require(_0x91e8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91e8('0x5'));var config=require(_0x91e8('0x6'));var attributes=require(_0x91e8('0x7'));module[_0x91e8('0x8')]=function(_0x3d61e3,_0x1cafae){return _0x3d61e3['define']('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79d2=['rimraf','../../config/environment','exports','define','License','license','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x79d2,0xc9));var _0x279d=function(_0xf3ae5e,_0x385757){_0xf3ae5e=_0xf3ae5e-0x0;var _0x353c92=_0x79d2[_0xf3ae5e];return _0x353c92;};'use strict';var _=require(_0x279d('0x0'));var util=require('util');var logger=require(_0x279d('0x1'))(_0x279d('0x2'));var moment=require(_0x279d('0x3'));var BPromise=require(_0x279d('0x4'));var rp=require(_0x279d('0x5'));var fs=require('fs');var path=require(_0x279d('0x6'));var rimraf=require(_0x279d('0x7'));var config=require(_0x279d('0x8'));var attributes=require('./license.attributes');module[_0x279d('0x9')]=function(_0x396d9a,_0x507316){return _0x396d9a[_0x279d('0xa')](_0x279d('0xb'),attributes,{'tableName':_0x279d('0xc'),'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 1f89efc..6a3d4d6 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 _0x934d=['request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2ed6b4,_0x56e240){var _0xeb9013=function(_0x219b99){while(--_0x219b99){_0x2ed6b4['push'](_0x2ed6b4['shift']());}};_0xeb9013(++_0x56e240);}(_0x934d,0xda));var _0xd934=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x934d[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require(_0xd934('0x0'));var util=require('util');var moment=require(_0xd934('0x1'));var BPromise=require(_0xd934('0x2'));var rs=require(_0xd934('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd934('0x4'))['db'];var utils=require(_0xd934('0x5'));var logger=require(_0xd934('0x6'))(_0xd934('0x7'));var config=require(_0xd934('0x8'));var jayson=require(_0xd934('0x9'));var client=jayson[_0xd934('0xa')][_0xd934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33cf93,_0x3b5656,_0x19cf05){return new BPromise(function(_0xd562e6,_0x53137c){return client[_0xd934('0xc')](_0x33cf93,_0x19cf05)[_0xd934('0xd')](function(_0x2e055a){logger[_0xd934('0xe')](_0xd934('0xf'),_0x3b5656,_0xd934('0x10'));logger[_0xd934('0x11')](_0xd934('0x12'),_0x3b5656,_0xd934('0x10'),JSON['stringify'](_0x2e055a));if(_0x2e055a[_0xd934('0x13')]){if(_0x2e055a[_0xd934('0x13')]['code']===0x1f4){logger[_0xd934('0x13')]('License,\x20%s,\x20%s',_0x3b5656,_0x2e055a[_0xd934('0x13')][_0xd934('0x14')]);return _0x53137c(_0x2e055a['error'][_0xd934('0x14')]);}logger[_0xd934('0x13')](_0xd934('0xf'),_0x3b5656,_0x2e055a['error']['message']);return _0xd562e6(_0x2e055a[_0xd934('0x13')][_0xd934('0x14')]);}else{logger[_0xd934('0xe')](_0xd934('0xf'),_0x3b5656,'request\x20sent');_0xd562e6(_0x2e055a[_0xd934('0x15')]['message']);}})[_0xd934('0x16')](function(_0x1a9229){logger[_0xd934('0x13')](_0xd934('0xf'),_0x3b5656,_0x1a9229);_0x53137c(_0x1a9229);});});} \ No newline at end of file +var _0x4957=['debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','License,\x20%s,\x20%s','request\x20sent'];(function(_0x2c97a9,_0xd6a400){var _0x26b5aa=function(_0x3c5cf7){while(--_0x3c5cf7){_0x2c97a9['push'](_0x2c97a9['shift']());}};_0x26b5aa(++_0xd6a400);}(_0x4957,0xbf));var _0x7495=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x4957[_0x29db36];return _0x234e87;};'use strict';var _=require(_0x7495('0x0'));var util=require(_0x7495('0x1'));var moment=require(_0x7495('0x2'));var BPromise=require(_0x7495('0x3'));var rs=require(_0x7495('0x4'));var fs=require('fs');var Redis=require(_0x7495('0x5'));var db=require(_0x7495('0x6'))['db'];var utils=require(_0x7495('0x7'));var logger=require('../../config/logger')(_0x7495('0x8'));var config=require('../../config/environment');var jayson=require(_0x7495('0x9'));var client=jayson['client'][_0x7495('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25cf5d,_0x9e9134,_0x388d51){return new BPromise(function(_0x513aae,_0x4af3f5){return client[_0x7495('0xb')](_0x25cf5d,_0x388d51)[_0x7495('0xc')](function(_0x1ff1f5){logger[_0x7495('0xd')](_0x7495('0xe'),_0x9e9134,_0x7495('0xf'));logger[_0x7495('0x10')]('License,\x20%s,\x20%s,\x20%s',_0x9e9134,_0x7495('0xf'),JSON[_0x7495('0x11')](_0x1ff1f5));if(_0x1ff1f5[_0x7495('0x12')]){if(_0x1ff1f5['error'][_0x7495('0x13')]===0x1f4){logger[_0x7495('0x12')](_0x7495('0xe'),_0x9e9134,_0x1ff1f5['error']['message']);return _0x4af3f5(_0x1ff1f5[_0x7495('0x12')][_0x7495('0x14')]);}logger['error'](_0x7495('0xe'),_0x9e9134,_0x1ff1f5[_0x7495('0x12')][_0x7495('0x14')]);return _0x513aae(_0x1ff1f5[_0x7495('0x12')]['message']);}else{logger[_0x7495('0xd')](_0x7495('0xe'),_0x9e9134,_0x7495('0xf'));_0x513aae(_0x1ff1f5[_0x7495('0x15')][_0x7495('0x14')]);}})[_0x7495('0x16')](function(_0x5e5c4b){logger['error'](_0x7495('0xe'),_0x9e9134,_0x5e5c4b);_0x4af3f5(_0x5e5c4b);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index bcbcecf..a511ad5 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 _0xf492=['addSmtp','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','removeAnswers','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','/:id/in_servers'];(function(_0x41bdb7,_0x2d3c1c){var _0xa1e594=function(_0x4aa014){while(--_0x4aa014){_0x41bdb7['push'](_0x41bdb7['shift']());}};_0xa1e594(++_0x2d3c1c);}(_0xf492,0x72));var _0x2f49=function(_0x4f21fc,_0x210323){_0x4f21fc=_0x4f21fc-0x0;var _0x4dd29f=_0xf492[_0x4f21fc];return _0x4dd29f;};'use strict';var multer=require(_0x2f49('0x0'));var util=require(_0x2f49('0x1'));var path=require(_0x2f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f49('0x3'));var router=express[_0x2f49('0x4')]();var fs_extra=require(_0x2f49('0x5'));var auth=require(_0x2f49('0x6'));var interaction=require(_0x2f49('0x7'));var config=require(_0x2f49('0x8'));var controller=require(_0x2f49('0x9'));router[_0x2f49('0xa')]('/',auth[_0x2f49('0xb')](),controller[_0x2f49('0xc')]);router[_0x2f49('0xa')](_0x2f49('0xd'),auth[_0x2f49('0xb')](),controller['describe']);router[_0x2f49('0xa')](_0x2f49('0xe'),auth[_0x2f49('0xb')](),controller[_0x2f49('0xf')]);router[_0x2f49('0xa')](_0x2f49('0x10'),auth[_0x2f49('0xb')](),controller[_0x2f49('0x11')]);router[_0x2f49('0xa')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2f49('0x12')]);router[_0x2f49('0xa')]('/:id/in_servers',auth[_0x2f49('0xb')](),controller[_0x2f49('0x13')]);router[_0x2f49('0xa')](_0x2f49('0x14'),auth[_0x2f49('0xb')](),controller[_0x2f49('0x15')]);router['get']('/:id/interactions',auth[_0x2f49('0xb')](),controller[_0x2f49('0x16')]);router['get'](_0x2f49('0x17'),auth['isAuthenticated'](),controller[_0x2f49('0x18')]);router[_0x2f49('0xa')](_0x2f49('0x19'),auth[_0x2f49('0xb')](),controller[_0x2f49('0x1a')]);router[_0x2f49('0xa')](_0x2f49('0x1b'),auth[_0x2f49('0xb')](),controller[_0x2f49('0x1c')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x2f49('0x1d')]);router[_0x2f49('0x1e')](_0x2f49('0x10'),auth[_0x2f49('0xb')](),controller[_0x2f49('0x1f')]);router['post'](_0x2f49('0x20'),auth[_0x2f49('0xb')](),controller[_0x2f49('0x21')]);router[_0x2f49('0x1e')]('/',auth[_0x2f49('0xb')](),controller[_0x2f49('0x22')]);router[_0x2f49('0x1e')](_0x2f49('0x23'),auth[_0x2f49('0xb')](),controller['addImap']);router[_0x2f49('0x1e')]('/:id/out_servers',auth[_0x2f49('0xb')](),controller[_0x2f49('0x24')]);router[_0x2f49('0x1e')]('/:id/interactions',auth[_0x2f49('0xb')](),controller[_0x2f49('0x25')]);router[_0x2f49('0x1e')](_0x2f49('0x17'),auth[_0x2f49('0xb')](),controller[_0x2f49('0x26')]);router[_0x2f49('0x1e')](_0x2f49('0x27'),auth['isAuthenticated'](),controller[_0x2f49('0x28')]);router[_0x2f49('0x1e')](_0x2f49('0x29'),auth[_0x2f49('0xb')](),controller[_0x2f49('0x2a')]);router[_0x2f49('0x2b')](_0x2f49('0xe'),auth[_0x2f49('0xb')](),controller[_0x2f49('0x2c')]);router[_0x2f49('0x2d')](_0x2f49('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x2f49('0x2d')](_0x2f49('0x20'),auth['isAuthenticated'](),controller[_0x2f49('0x2e')]);router[_0x2f49('0x2d')](_0x2f49('0x23'),auth[_0x2f49('0xb')](),controller['removeImap']);router[_0x2f49('0x2d')](_0x2f49('0x14'),auth[_0x2f49('0xb')](),controller['removeSmtp']);router['delete'](_0x2f49('0xe'),auth[_0x2f49('0xb')](),controller[_0x2f49('0x2f')]);router[_0x2f49('0x2d')](_0x2f49('0x29'),auth[_0x2f49('0xb')](),controller[_0x2f49('0x30')]);module[_0x2f49('0x31')]=router; \ No newline at end of file +var _0x9159=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','create','addImap','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','send','addAgents','put','update','delete','removeAnswers','destroy','removeAgents','exports','multer','util'];(function(_0x449796,_0x143ded){var _0x435666=function(_0x3522ab){while(--_0x3522ab){_0x449796['push'](_0x449796['shift']());}};_0x435666(++_0x143ded);}(_0x9159,0x155));var _0x9915=function(_0x1597e2,_0x388d3e){_0x1597e2=_0x1597e2-0x0;var _0x4c8c0a=_0x9159[_0x1597e2];return _0x4c8c0a;};'use strict';var multer=require(_0x9915('0x0'));var util=require(_0x9915('0x1'));var path=require(_0x9915('0x2'));var timeout=require(_0x9915('0x3'));var express=require(_0x9915('0x4'));var router=express[_0x9915('0x5')]();var fs_extra=require(_0x9915('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9915('0x7'));var config=require('../../config/environment');var controller=require(_0x9915('0x8'));router[_0x9915('0x9')]('/',auth[_0x9915('0xa')](),controller[_0x9915('0xb')]);router['get'](_0x9915('0xc'),auth[_0x9915('0xa')](),controller[_0x9915('0xd')]);router[_0x9915('0x9')](_0x9915('0xe'),auth[_0x9915('0xa')](),controller[_0x9915('0xf')]);router['get'](_0x9915('0x10'),auth[_0x9915('0xa')](),controller[_0x9915('0x11')]);router[_0x9915('0x9')](_0x9915('0x12'),auth[_0x9915('0xa')](),controller[_0x9915('0x13')]);router[_0x9915('0x9')](_0x9915('0x14'),auth[_0x9915('0xa')](),controller[_0x9915('0x15')]);router[_0x9915('0x9')](_0x9915('0x16'),auth['isAuthenticated'](),controller[_0x9915('0x17')]);router[_0x9915('0x9')](_0x9915('0x18'),auth['isAuthenticated'](),controller[_0x9915('0x19')]);router['get']('/:id/applications',auth[_0x9915('0xa')](),controller[_0x9915('0x1a')]);router['get']('/:id/messages',auth[_0x9915('0xa')](),controller[_0x9915('0x1b')]);router['get'](_0x9915('0x1c'),auth[_0x9915('0xa')](),controller[_0x9915('0x1d')]);router[_0x9915('0x9')](_0x9915('0x1e'),auth[_0x9915('0xa')](),controller[_0x9915('0x1f')]);router[_0x9915('0x20')](_0x9915('0x10'),auth[_0x9915('0xa')](),controller['addDisposition']);router[_0x9915('0x20')](_0x9915('0x12'),auth['isAuthenticated'](),controller['addAnswer']);router['post']('/',auth['isAuthenticated'](),controller[_0x9915('0x21')]);router['post'](_0x9915('0x14'),auth[_0x9915('0xa')](),controller[_0x9915('0x22')]);router[_0x9915('0x20')](_0x9915('0x16'),auth[_0x9915('0xa')](),controller[_0x9915('0x23')]);router[_0x9915('0x20')](_0x9915('0x18'),auth[_0x9915('0xa')](),controller[_0x9915('0x24')]);router[_0x9915('0x20')](_0x9915('0x25'),auth[_0x9915('0xa')](),controller[_0x9915('0x26')]);router['post'](_0x9915('0x27'),auth[_0x9915('0xa')](),controller[_0x9915('0x28')]);router['post']('/:id/users',auth[_0x9915('0xa')](),controller[_0x9915('0x29')]);router[_0x9915('0x2a')]('/:id',auth[_0x9915('0xa')](),controller[_0x9915('0x2b')]);router[_0x9915('0x2c')](_0x9915('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x9915('0x2c')](_0x9915('0x12'),auth[_0x9915('0xa')](),controller[_0x9915('0x2d')]);router[_0x9915('0x2c')](_0x9915('0x14'),auth[_0x9915('0xa')](),controller['removeImap']);router['delete'](_0x9915('0x16'),auth[_0x9915('0xa')](),controller['removeSmtp']);router[_0x9915('0x2c')]('/:id',auth['isAuthenticated'](),controller[_0x9915('0x2e')]);router[_0x9915('0x2c')](_0x9915('0x1e'),auth[_0x9915('0xa')](),controller[_0x9915('0x2f')]);module[_0x9915('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index f8a4d8b..0937e7c 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 _0x06f1=['hotmail','yahoo','outlook365','getDataValue','provider','custom','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail'];(function(_0x2d8efc,_0x58e635){var _0x4a7f2d=function(_0x5404e7){while(--_0x5404e7){_0x2d8efc['push'](_0x2d8efc['shift']());}};_0x4a7f2d(++_0x58e635);}(_0x06f1,0x1a8));var _0x106f=function(_0x4e0ec1,_0x144293){_0x4e0ec1=_0x4e0ec1-0x0;var _0x9b5934=_0x06f1[_0x4e0ec1];return _0x9b5934;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x106f('0x0')]},'name':{'type':Sequelize[_0x106f('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x106f('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x106f('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x106f('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0x106f('0x2')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x106f('0x3')},'fontSize':{'type':Sequelize[_0x106f('0x4')](0x2)[_0x106f('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x106f('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x106f('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x106f('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x106f('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x106f('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x106f('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x106f('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x106f('0x8'),'set':function(_0x277cd1){if(!_0x277cd1)this[_0x106f('0x9')]('mandatoryDispositionPauseId',null);this[_0x106f('0x9')](_0x106f('0xa'),_0x277cd1);}},'provider':{'type':Sequelize[_0x106f('0xb')](_0x106f('0xc'),_0x106f('0xd'),_0x106f('0xe'),_0x106f('0xf')),'defaultValue':null,'get':function(){if(!this[_0x106f('0x10')](_0x106f('0x11')))return'custom';return this[_0x106f('0x10')]('provider');},'set':function(_0x869d60){if(_0x869d60===_0x106f('0x12'))_0x869d60=null;return this[_0x106f('0x9')](_0x106f('0x11'),_0x869d60);}}}; \ No newline at end of file +var _0x46a1=['setDataValue','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom'];(function(_0x3bd22e,_0x50cba6){var _0x4b9f28=function(_0x51efb7){while(--_0x51efb7){_0x3bd22e['push'](_0x3bd22e['shift']());}};_0x4b9f28(++_0x50cba6);}(_0x46a1,0xe5));var _0x146a=function(_0x799323,_0x1cbc70){_0x799323=_0x799323-0x0;var _0x27de39=_0x46a1[_0x799323];return _0x27de39;};'use strict';var Sequelize=require(_0x146a('0x0'));module[_0x146a('0x1')]={'description':{'type':Sequelize[_0x146a('0x2')]},'name':{'type':Sequelize[_0x146a('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x146a('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x146a('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x146a('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x146a('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x146a('0x4')]},'markAsUnread':{'type':Sequelize[_0x146a('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x146a('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x146a('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x146a('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x146a('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x146a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x146a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x146a('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x146a('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x146a('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x146a('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x146a('0x3')],'defaultValue':![],'comment':_0x146a('0x8'),'set':function(_0x129bf9){if(!_0x129bf9)this['setDataValue'](_0x146a('0x9'),null);this['setDataValue'](_0x146a('0xa'),_0x129bf9);}},'provider':{'type':Sequelize[_0x146a('0xb')](_0x146a('0xc'),_0x146a('0xd'),_0x146a('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x146a('0xf')](_0x146a('0x10')))return _0x146a('0x11');return this[_0x146a('0xf')](_0x146a('0x10'));},'set':function(_0x64d1f0){if(_0x64d1f0===_0x146a('0x11'))_0x64d1f0=null;return this[_0x146a('0x12')](_0x146a('0x10'),_0x64d1f0);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index bc445b9..98426fb 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 _0x7006=['isNil','from','attachments','join','server/files/attachments','sendMail','List\x20not\x20found','Contacts','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','User','moment','bluebird','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','Content-Range','update','destroy','get','MailAccounts','end','sendStatus','stack','name','send','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','yahoo','smtp-mail.outlook.com','user','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','authentication','Imap','Smtp','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','keys','filters','attributes','fields','length','order','where','pick','filter','merge','options','include','rows','show','params','Pause','rawAttributes','intersection','includeAll','body','provider','find','Mail\x20Account\x20not\x20found','describe','MailAccountId','getDispositions','findOne','Disposition','hasOwnProperty','nolimit','sort','findAll','removeDispositions','addAnswer','create','getAnswers','CannedAnswer','removeAnswers','ids','custom','email','ListId','active','role','userProfileId','autoAssociation','getImap','addImap','getSmtp','addSmtp','removeSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','Owner','fullname','Tag','Tags','color','tag','addApplications','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','split','format','MailMessage','inlineCss','CmList','List','updatedAt','DESC','CloudProvider'];(function(_0x504f7e,_0x3fe287){var _0x4ebaf3=function(_0x3b4882){while(--_0x3b4882){_0x504f7e['push'](_0x504f7e['shift']());}};_0x4ebaf3(++_0x3fe287);}(_0x7006,0x191));var _0x6700=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0x7006[_0x1b5aea];return _0x51cae9;};'use strict';var moment=require(_0x6700('0x0'));var BPromise=require(_0x6700('0x1'));var util=require('util');var path=require(_0x6700('0x2'));var _=require(_0x6700('0x3'));var juice=require(_0x6700('0x4'));var Redis=require(_0x6700('0x5'));var qs=require(_0x6700('0x6'));var logger=require(_0x6700('0x7'))(_0x6700('0x8'));var config=require('../../config/environment');var db=require(_0x6700('0x9'))['db'];config[_0x6700('0xa')]=_[_0x6700('0xb')](config['redis'],{'host':_0x6700('0xc'),'port':0x18eb});var socket=require(_0x6700('0xd'))(new Redis(config[_0x6700('0xa')]));require('./mailAccount.socket')[_0x6700('0xe')](socket);var jayson=require(_0x6700('0xf'));var client=jayson[_0x6700('0x10')][_0x6700('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x4cf540,_0x55c5b9,_0x54aba8,_0x3da7e7){return new BPromise(function(_0x44d3e8,_0x57845b){var _0xb194d0=_0x3da7e7||client;return _0xb194d0[_0x6700('0x12')](_0x4cf540,_0x54aba8)[_0x6700('0x13')](function(_0x3fddc9){logger[_0x6700('0x14')]('MailAccount,\x20%s,\x20%s',_0x55c5b9,_0x6700('0x15'));logger[_0x6700('0x16')](_0x6700('0x17'),_0x55c5b9,_0x6700('0x15'),JSON[_0x6700('0x18')](_0x3fddc9));if(_0x3fddc9[_0x6700('0x19')]){if(_0x3fddc9['error'][_0x6700('0x1a')]===0x1f4){logger[_0x6700('0x19')](_0x6700('0x1b'),_0x55c5b9,_0x3fddc9[_0x6700('0x19')]['message']);return _0x57845b(_0x3fddc9[_0x6700('0x19')][_0x6700('0x1c')]);}logger[_0x6700('0x19')]('MailAccount,\x20%s,\x20%s',_0x55c5b9,_0x3fddc9['error'][_0x6700('0x1c')]);return _0x44d3e8(_0x3fddc9['error'][_0x6700('0x1c')]);}else{logger[_0x6700('0x14')]('MailAccount,\x20%s,\x20%s',_0x55c5b9,_0x6700('0x15'));_0x44d3e8(_0x3fddc9[_0x6700('0x1d')][_0x6700('0x1c')]);}})[_0x6700('0x1e')](function(_0x29cf9b){logger[_0x6700('0x19')](_0x6700('0x1b'),_0x55c5b9,_0x29cf9b);_0x57845b(_0x29cf9b);});});}function respondWithStatusCode(_0x493ad0,_0xd08fab){_0xd08fab=_0xd08fab||0xcc;return function(_0x1eb39b){if(_0x1eb39b){return _0x493ad0['sendStatus'](_0xd08fab);}return _0x493ad0[_0x6700('0x1f')](_0xd08fab)['end']();};}function respondWithResult(_0xc52dc7,_0x13e40d){_0x13e40d=_0x13e40d||0xc8;return function(_0x336baf){if(_0x336baf){return _0xc52dc7[_0x6700('0x1f')](_0x13e40d)[_0x6700('0x20')](_0x336baf);}};}function respondWithFilteredResult(_0x464ce3,_0x3ac0bf){return function(_0x38a1db){if(_0x38a1db){var _0x3f7466=typeof _0x3ac0bf[_0x6700('0x21')]===_0x6700('0x22')&&typeof _0x3ac0bf[_0x6700('0x23')]==='undefined';var _0x37e3dd=_0x38a1db[_0x6700('0x24')];var _0x12e1b2=_0x3f7466?0x0:_0x3ac0bf['offset'];var _0xcb5504=_0x3f7466?_0x38a1db[_0x6700('0x24')]:_0x3ac0bf[_0x6700('0x21')]+_0x3ac0bf[_0x6700('0x23')];var _0x1f636c;if(_0xcb5504>=_0x37e3dd){_0xcb5504=_0x37e3dd;_0x1f636c=0xc8;}else{_0x1f636c=0xce;}_0x464ce3[_0x6700('0x1f')](_0x1f636c);return _0x464ce3['set'](_0x6700('0x25'),_0x12e1b2+'-'+_0xcb5504+'/'+_0x37e3dd)[_0x6700('0x20')](_0x38a1db);}return null;};}function saveUpdates(_0x127f58){return function(_0x590798){if(_0x590798){return _0x590798[_0x6700('0x26')](_0x127f58)[_0x6700('0x13')](function(_0x15ae56){return _0x15ae56;});}return null;};}function removeEntity(_0x1fa933){return function(_0x28002a){if(_0x28002a){return _0x28002a[_0x6700('0x27')]()['then'](function(){var _0x7732cd=_0x28002a[_0x6700('0x28')]({'plain':!![]});var _0x2203d5=_0x6700('0x29');return db['UserProfileResource'][_0x6700('0x27')]({'where':{'type':_0x2203d5,'resourceId':_0x7732cd['id']}})[_0x6700('0x13')](function(){return _0x28002a;});})[_0x6700('0x13')](function(){_0x1fa933[_0x6700('0x1f')](0xcc)[_0x6700('0x2a')]();});}};}function handleEntityNotFound(_0x43dcc4){return function(_0x351e49){if(!_0x351e49){_0x43dcc4[_0x6700('0x2b')](0x194);}return _0x351e49;};}function handleError(_0x4c1ad2,_0x34d59c){_0x34d59c=_0x34d59c||0x1f4;return function(_0x16b88e){logger[_0x6700('0x19')](_0x16b88e[_0x6700('0x2c')]);if(_0x16b88e[_0x6700('0x2d')]){delete _0x16b88e[_0x6700('0x2d')];}_0x4c1ad2[_0x6700('0x1f')](_0x34d59c)[_0x6700('0x2e')](_0x16b88e);};}function getImapHost(_0x58ff0c){switch(_0x58ff0c){case _0x6700('0x2f'):return _0x6700('0x30');case'yahoo':return _0x6700('0x31');case _0x6700('0x32'):return _0x6700('0x33');case _0x6700('0x34'):return'outlook.office365.com';}throw new Error(_0x6700('0x35'),_0x58ff0c);}function getSmtpHost(_0x47636c){switch(_0x47636c){case _0x6700('0x2f'):return'smtp.gmail.com';case _0x6700('0x36'):return'smtp.mail.yahoo.com';case _0x6700('0x32'):return _0x6700('0x37');case _0x6700('0x34'):return'smtp.office365.com';}throw new Error(_0x6700('0x35'),_0x47636c);}function getAuthenticationOptions(_0x8045da,_0x4143d4){var _0x48b52d={};var _0x491f9c={};if(_0x8045da){_0x48b52d[_0x6700('0x38')]=_0x491f9c[_0x6700('0x38')]=_0x4143d4[_0x6700('0x39')];_0x48b52d[_0x6700('0x3a')]=_0x491f9c['pass']=_0x4143d4['password'];if(_0x4143d4[_0x6700('0x3b')]){_0x48b52d[_0x6700('0x3b')]=_0x491f9c['modernAuthentication']=!![];_0x48b52d[_0x6700('0x3c')]=_0x491f9c[_0x6700('0x3c')]=_0x4143d4[_0x6700('0x3c')];_0x48b52d[_0x6700('0x3a')]=_0x491f9c[_0x6700('0x3d')]=null;}else{_0x48b52d[_0x6700('0x3c')]=_0x491f9c['CloudProviderId']=null;}_0x48b52d[_0x6700('0x3e')]=getImapHost(_0x8045da);_0x48b52d[_0x6700('0x3f')]=0x3e1;_0x491f9c[_0x6700('0x3e')]=getSmtpHost(_0x8045da);_0x491f9c[_0x6700('0x3f')]=0x24b;_0x491f9c[_0x6700('0x40')]=![];_0x48b52d[_0x6700('0x41')]=_0x491f9c['service']=null;}else{if(_0x4143d4[_0x6700('0x42')]){_0x48b52d[_0x6700('0x38')]=_0x491f9c[_0x6700('0x38')]=_0x4143d4['username'];_0x48b52d[_0x6700('0x3a')]=_0x491f9c[_0x6700('0x3d')]=_0x4143d4[_0x6700('0x3a')];}else{_0x48b52d[_0x6700('0x42')]=_0x491f9c[_0x6700('0x42')]=![];_0x48b52d['user']=_0x491f9c['user']=null;_0x48b52d[_0x6700('0x3a')]=_0x491f9c[_0x6700('0x3d')]=null;}_0x48b52d[_0x6700('0x3e')]=_0x4143d4[_0x6700('0x43')][_0x6700('0x3e')];_0x48b52d[_0x6700('0x3f')]=_0x4143d4[_0x6700('0x43')][_0x6700('0x3f')];_0x491f9c[_0x6700('0x3e')]=_0x4143d4[_0x6700('0x44')]['host'];_0x491f9c[_0x6700('0x3f')]=_0x4143d4[_0x6700('0x44')]['port'];}return{'Imap':_0x48b52d,'Smtp':_0x491f9c};}exports['index']=function(_0x148a93,_0x52c65c){var _0x14e4c6={'include':[{'model':db[_0x6700('0x45')],'as':_0x6700('0x43')},{'model':db[_0x6700('0x46')],'as':_0x6700('0x44')},{'model':db['Pause'],'as':_0x6700('0x47')}]},_0x4f9de7={},_0x24a951={'count':0x0,'rows':[]};var _0x527fa6=_[_0x6700('0x48')](db[_0x6700('0x49')]['rawAttributes'],function(_0x37664d){return{'name':_0x37664d[_0x6700('0x4a')],'type':_0x37664d[_0x6700('0x4b')][_0x6700('0x4c')]};});_0x4f9de7[_0x6700('0x4d')]=_[_0x6700('0x48')](_0x527fa6,_0x6700('0x2d'));_0x4f9de7[_0x6700('0x4e')]=_[_0x6700('0x4f')](_0x148a93[_0x6700('0x4e')]);_0x4f9de7[_0x6700('0x50')]=_['intersection'](_0x4f9de7[_0x6700('0x4d')],_0x4f9de7[_0x6700('0x4e')]);_0x14e4c6[_0x6700('0x51')]=_['intersection'](_0x4f9de7[_0x6700('0x4d')],qs[_0x6700('0x52')](_0x148a93[_0x6700('0x4e')][_0x6700('0x52')]));_0x14e4c6['attributes']=_0x14e4c6[_0x6700('0x51')][_0x6700('0x53')]?_0x14e4c6[_0x6700('0x51')]:_0x4f9de7['model'];if(!_0x148a93[_0x6700('0x4e')]['hasOwnProperty']('nolimit')){_0x14e4c6[_0x6700('0x23')]=qs[_0x6700('0x23')](_0x148a93[_0x6700('0x4e')][_0x6700('0x23')]);_0x14e4c6['offset']=qs[_0x6700('0x21')](_0x148a93[_0x6700('0x4e')][_0x6700('0x21')]);}_0x14e4c6[_0x6700('0x54')]=qs['sort'](_0x148a93['query']['sort']);_0x14e4c6[_0x6700('0x55')]=qs[_0x6700('0x50')](_[_0x6700('0x56')](_0x148a93[_0x6700('0x4e')],_0x4f9de7[_0x6700('0x50')]),_0x527fa6);if(_0x148a93[_0x6700('0x4e')][_0x6700('0x57')]){_0x14e4c6['where']=_[_0x6700('0x58')](_0x14e4c6['where'],{'$or':_[_0x6700('0x48')](_0x527fa6,function(_0x222c31){if(_0x222c31['type']!=='VIRTUAL'){var _0x5a0b0e={};_0x5a0b0e[_0x222c31[_0x6700('0x2d')]]={'$like':'%'+_0x148a93['query'][_0x6700('0x57')]+'%'};return _0x5a0b0e;}})});}_0x14e4c6=_[_0x6700('0x58')]({},_0x14e4c6,_0x148a93[_0x6700('0x59')]);var _0x53c254={'where':_0x14e4c6[_0x6700('0x55')]};return db[_0x6700('0x49')][_0x6700('0x24')](_0x53c254)[_0x6700('0x13')](function(_0x1268fa){_0x24a951[_0x6700('0x24')]=_0x1268fa;if(_0x148a93['query']['includeAll']){_0x14e4c6[_0x6700('0x5a')]=[{'all':!![]}];}return db[_0x6700('0x49')]['findAll'](_0x14e4c6);})[_0x6700('0x13')](function(_0x44b1b2){_0x24a951[_0x6700('0x5b')]=_0x44b1b2;return _0x24a951;})[_0x6700('0x13')](respondWithFilteredResult(_0x52c65c,_0x14e4c6))['catch'](handleError(_0x52c65c,null));};exports[_0x6700('0x5c')]=function(_0x2f893b,_0x4eb227){var _0x42cbb1={'raw':![],'where':{'id':_0x2f893b[_0x6700('0x5d')]['id']},'include':[{'model':db[_0x6700('0x45')],'as':'Imap'},{'model':db[_0x6700('0x46')],'as':_0x6700('0x44')},{'model':db[_0x6700('0x5e')],'as':_0x6700('0x47')}]},_0x2fb4bc={};_0x2fb4bc[_0x6700('0x4d')]=_['keys'](db[_0x6700('0x49')][_0x6700('0x5f')]);_0x2fb4bc[_0x6700('0x4e')]=_[_0x6700('0x4f')](_0x2f893b[_0x6700('0x4e')]);_0x2fb4bc[_0x6700('0x50')]=_[_0x6700('0x60')](_0x2fb4bc[_0x6700('0x4d')],_0x2fb4bc[_0x6700('0x4e')]);_0x42cbb1['attributes']=_[_0x6700('0x60')](_0x2fb4bc[_0x6700('0x4d')],qs[_0x6700('0x52')](_0x2f893b[_0x6700('0x4e')][_0x6700('0x52')]));_0x42cbb1['attributes']=_0x42cbb1[_0x6700('0x51')][_0x6700('0x53')]?_0x42cbb1[_0x6700('0x51')]:_0x2fb4bc[_0x6700('0x4d')];if(_0x2f893b[_0x6700('0x4e')][_0x6700('0x61')]){_0x42cbb1['include']=[{'all':!![]}];}_0x42cbb1=_['merge']({},_0x42cbb1,_0x2f893b[_0x6700('0x59')]);return db[_0x6700('0x49')]['find'](_0x42cbb1)[_0x6700('0x13')](handleEntityNotFound(_0x4eb227,null))['then'](respondWithResult(_0x4eb227,null))['catch'](handleError(_0x4eb227,null));};exports[_0x6700('0x26')]=function(_0x33f4bd,_0x55f779){if(_0x33f4bd[_0x6700('0x62')]['id']){delete _0x33f4bd[_0x6700('0x62')]['id'];}var _0x13c7c0=_0x33f4bd[_0x6700('0x62')][_0x6700('0x63')]==='custom'?null:_0x33f4bd[_0x6700('0x62')]['provider'];var _0x1fd0e2=_0x33f4bd[_0x6700('0x62')][_0x6700('0x43')]||{};var _0x36df47=_0x33f4bd[_0x6700('0x62')][_0x6700('0x44')]||{};if(_0x13c7c0){_0x1fd0e2[_0x6700('0x3e')]=getImapHost(_0x13c7c0);_0x1fd0e2[_0x6700('0x3f')]=0x3e1;_0x36df47[_0x6700('0x3e')]=getSmtpHost(_0x13c7c0);_0x36df47[_0x6700('0x3f')]=0x24b;_0x36df47[_0x6700('0x40')]=![];}if(_0x36df47['modernAuthentication']){_0x36df47[_0x6700('0x40')]=![];}else{_0x36df47[_0x6700('0x3c')]=null;}if(!_0x1fd0e2[_0x6700('0x3b')])_0x1fd0e2[_0x6700('0x3c')]=null;_0x33f4bd[_0x6700('0x62')]['Imap']=_0x1fd0e2;_0x33f4bd[_0x6700('0x62')][_0x6700('0x44')]=_0x36df47;return db[_0x6700('0x49')][_0x6700('0x64')]({'where':{'id':_0x33f4bd[_0x6700('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x6700('0x43')},{'model':db[_0x6700('0x46')],'as':_0x6700('0x44')},{'model':db['Pause'],'as':_0x6700('0x47')}]})['then'](handleEntityNotFound(_0x55f779,null))[_0x6700('0x13')](function(_0x2c2a73){if(!_0x2c2a73)throw new Error(_0x6700('0x65'));if(_0x2c2a73[_0x6700('0x41')])delete _0x33f4bd[_0x6700('0x62')][_0x6700('0x43')];return _0x2c2a73;})[_0x6700('0x13')](saveUpdates(_0x33f4bd[_0x6700('0x62')],null))[_0x6700('0x13')](function(_0x2c373a){if(!_0x33f4bd['body']['Imap'])return _0x2c373a;return db[_0x6700('0x45')][_0x6700('0x26')](_0x33f4bd['body'][_0x6700('0x43')],{'where':{'MailAccountId':_0x2c373a['id']}})[_0x6700('0x13')](function(){return _0x2c373a;});})[_0x6700('0x13')](function(_0x4aea99){if(!_0x33f4bd[_0x6700('0x62')][_0x6700('0x44')])return _0x4aea99;return db[_0x6700('0x46')][_0x6700('0x26')](_0x33f4bd['body'][_0x6700('0x44')],{'where':{'MailAccountId':_0x4aea99['id']}})[_0x6700('0x13')](function(){return _0x4aea99;});})[_0x6700('0x13')](respondWithResult(_0x55f779,null))[_0x6700('0x1e')](handleError(_0x55f779,null));};exports[_0x6700('0x66')]=function(_0x56bb8c,_0x320a22){return db[_0x6700('0x49')][_0x6700('0x66')]()[_0x6700('0x13')](respondWithResult(_0x320a22,null))[_0x6700('0x1e')](handleError(_0x320a22,null));};exports['addDisposition']=function(_0x1e6295,_0x14c921){if(_0x1e6295['body']['id']){delete _0x1e6295[_0x6700('0x62')]['id'];}return db[_0x6700('0x49')][_0x6700('0x64')]({'where':{'id':_0x1e6295[_0x6700('0x5d')]['id']}})[_0x6700('0x13')](handleEntityNotFound(_0x14c921,null))['then'](function(_0x295586){if(_0x295586){_0x1e6295['body'][_0x6700('0x67')]=_0x295586['id'];return db['Disposition']['create'](_0x1e6295['body']);}})['then'](respondWithResult(_0x14c921,null))['catch'](handleError(_0x14c921,null));};exports[_0x6700('0x68')]=function(_0x1d6c0c,_0x558f4e){var _0x3885bb={'raw':![],'where':{}};var _0xa66b2d={};var _0x5d2260={'count':0x0,'rows':[]};return db['MailAccount'][_0x6700('0x69')]({'where':{'id':_0x1d6c0c['params']['id']}})[_0x6700('0x13')](handleEntityNotFound(_0x558f4e,null))[_0x6700('0x13')](function(_0x29a413){if(_0x29a413){_0xa66b2d['model']=_[_0x6700('0x4f')](db[_0x6700('0x6a')]['rawAttributes']);_0xa66b2d[_0x6700('0x4e')]=_[_0x6700('0x4f')](_0x1d6c0c[_0x6700('0x4e')]);_0xa66b2d[_0x6700('0x50')]=_[_0x6700('0x60')](_0xa66b2d['model'],_0xa66b2d[_0x6700('0x4e')]);_0x3885bb[_0x6700('0x51')]=_[_0x6700('0x60')](_0xa66b2d['model'],qs['fields'](_0x1d6c0c[_0x6700('0x4e')]['fields']));_0x3885bb[_0x6700('0x51')]=_0x3885bb[_0x6700('0x51')]['length']?_0x3885bb[_0x6700('0x51')]:_0xa66b2d[_0x6700('0x4d')];if(!_0x1d6c0c[_0x6700('0x4e')][_0x6700('0x6b')](_0x6700('0x6c'))){_0x3885bb['limit']=qs[_0x6700('0x23')](_0x1d6c0c[_0x6700('0x4e')]['limit']);_0x3885bb[_0x6700('0x21')]=qs[_0x6700('0x21')](_0x1d6c0c['query'][_0x6700('0x21')]);}_0x3885bb[_0x6700('0x54')]=qs[_0x6700('0x6d')](_0x1d6c0c['query'][_0x6700('0x6d')]);_0x3885bb[_0x6700('0x55')]=qs['filters'](_[_0x6700('0x56')](_0x1d6c0c[_0x6700('0x4e')],_0xa66b2d['filters']));_0x3885bb['where'][_0x6700('0x67')]=_0x29a413['id'];if(_0x1d6c0c['query'][_0x6700('0x57')]){_0x3885bb[_0x6700('0x55')]=_[_0x6700('0x58')](_0x3885bb['where'],{'$or':_[_0x6700('0x48')](_0x3885bb['attributes'],function(_0x2c3a70){var _0x43a61c={};_0x43a61c[_0x2c3a70]={'$like':'%'+_0x1d6c0c['query'][_0x6700('0x57')]+'%'};return _0x43a61c;})});}_0x3885bb=_[_0x6700('0x58')]({},_0x3885bb,_0x1d6c0c[_0x6700('0x59')]);return db[_0x6700('0x6a')]['count']({'where':_0x3885bb[_0x6700('0x55')]})[_0x6700('0x13')](function(_0x41c96b){_0x5d2260[_0x6700('0x24')]=_0x41c96b;if(_0x1d6c0c[_0x6700('0x4e')][_0x6700('0x61')]){_0x3885bb[_0x6700('0x5a')]=[{'all':!![]}];}return db[_0x6700('0x6a')][_0x6700('0x6e')](_0x3885bb);})[_0x6700('0x13')](function(_0x175579){_0x5d2260[_0x6700('0x5b')]=_0x175579;return _0x5d2260;});}})['then'](respondWithFilteredResult(_0x558f4e,_0x3885bb))['catch'](handleError(_0x558f4e,null));};exports['removeDispositions']=function(_0x48a60e,_0x2b3bc1){return db['MailAccount'][_0x6700('0x64')]({'where':{'id':_0x48a60e[_0x6700('0x5d')]['id']}})[_0x6700('0x13')](handleEntityNotFound(_0x2b3bc1,null))[_0x6700('0x13')](function(_0x38d811){if(_0x38d811){return _0x38d811[_0x6700('0x6f')](_0x48a60e[_0x6700('0x4e')]['ids']);}})[_0x6700('0x13')](respondWithStatusCode(_0x2b3bc1,null))['catch'](handleError(_0x2b3bc1,null));};exports[_0x6700('0x70')]=function(_0x3c6022,_0x3f0b76){if(_0x3c6022[_0x6700('0x62')]['id']){delete _0x3c6022[_0x6700('0x62')]['id'];}return db[_0x6700('0x49')][_0x6700('0x64')]({'where':{'id':_0x3c6022[_0x6700('0x5d')]['id']}})[_0x6700('0x13')](handleEntityNotFound(_0x3f0b76,null))['then'](function(_0x6fdbf7){if(_0x6fdbf7){_0x3c6022[_0x6700('0x62')][_0x6700('0x67')]=_0x6fdbf7['id'];return db['CannedAnswer'][_0x6700('0x71')](_0x3c6022[_0x6700('0x62')]);}})[_0x6700('0x13')](respondWithResult(_0x3f0b76,null))[_0x6700('0x1e')](handleError(_0x3f0b76,null));};exports[_0x6700('0x72')]=function(_0x355460,_0x3d2bba){var _0x747186={'raw':![],'where':{}};var _0x426a5c={};var _0x202d87={'count':0x0,'rows':[]};return db[_0x6700('0x49')][_0x6700('0x69')]({'where':{'id':_0x355460[_0x6700('0x5d')]['id']}})[_0x6700('0x13')](handleEntityNotFound(_0x3d2bba,null))[_0x6700('0x13')](function(_0x3afbfc){if(_0x3afbfc){_0x426a5c[_0x6700('0x4d')]=_['keys'](db[_0x6700('0x73')]['rawAttributes']);_0x426a5c[_0x6700('0x4e')]=_[_0x6700('0x4f')](_0x355460[_0x6700('0x4e')]);_0x426a5c[_0x6700('0x50')]=_[_0x6700('0x60')](_0x426a5c['model'],_0x426a5c[_0x6700('0x4e')]);_0x747186['attributes']=_[_0x6700('0x60')](_0x426a5c['model'],qs['fields'](_0x355460[_0x6700('0x4e')][_0x6700('0x52')]));_0x747186[_0x6700('0x51')]=_0x747186[_0x6700('0x51')][_0x6700('0x53')]?_0x747186[_0x6700('0x51')]:_0x426a5c['model'];if(!_0x355460[_0x6700('0x4e')][_0x6700('0x6b')](_0x6700('0x6c'))){_0x747186[_0x6700('0x23')]=qs['limit'](_0x355460[_0x6700('0x4e')]['limit']);_0x747186[_0x6700('0x21')]=qs[_0x6700('0x21')](_0x355460[_0x6700('0x4e')][_0x6700('0x21')]);}_0x747186[_0x6700('0x54')]=qs[_0x6700('0x6d')](_0x355460[_0x6700('0x4e')][_0x6700('0x6d')]);_0x747186[_0x6700('0x55')]=qs[_0x6700('0x50')](_[_0x6700('0x56')](_0x355460[_0x6700('0x4e')],_0x426a5c[_0x6700('0x50')]));_0x747186[_0x6700('0x55')][_0x6700('0x67')]=_0x3afbfc['id'];if(_0x355460[_0x6700('0x4e')][_0x6700('0x57')]){_0x747186[_0x6700('0x55')]=_[_0x6700('0x58')](_0x747186[_0x6700('0x55')],{'$or':_[_0x6700('0x48')](_0x747186[_0x6700('0x51')],function(_0x5ccb1c){var _0x159595={};_0x159595[_0x5ccb1c]={'$like':'%'+_0x355460[_0x6700('0x4e')]['filter']+'%'};return _0x159595;})});}_0x747186=_[_0x6700('0x58')]({},_0x747186,_0x355460[_0x6700('0x59')]);return db[_0x6700('0x73')][_0x6700('0x24')]({'where':_0x747186[_0x6700('0x55')]})[_0x6700('0x13')](function(_0x1a207b){_0x202d87['count']=_0x1a207b;if(_0x355460[_0x6700('0x4e')][_0x6700('0x61')]){_0x747186[_0x6700('0x5a')]=[{'all':!![]}];}return db[_0x6700('0x73')][_0x6700('0x6e')](_0x747186);})[_0x6700('0x13')](function(_0x5df451){_0x202d87['rows']=_0x5df451;return _0x202d87;});}})[_0x6700('0x13')](respondWithFilteredResult(_0x3d2bba,_0x747186))[_0x6700('0x1e')](handleError(_0x3d2bba,null));};exports['removeAnswers']=function(_0x56d9f1,_0x6a45c4){return db['MailAccount'][_0x6700('0x64')]({'where':{'id':_0x56d9f1['params']['id']}})[_0x6700('0x13')](handleEntityNotFound(_0x6a45c4,null))['then'](function(_0x13a9aa){if(_0x13a9aa){return _0x13a9aa[_0x6700('0x74')](_0x56d9f1[_0x6700('0x4e')][_0x6700('0x75')]);}})[_0x6700('0x13')](respondWithStatusCode(_0x6a45c4,null))[_0x6700('0x1e')](handleError(_0x6a45c4,null));};exports[_0x6700('0x71')]=function(_0x2ed08e,_0x4ce6b0){var _0x32c9e5={'name':_0x2ed08e[_0x6700('0x62')][_0x6700('0x2d')],'key':_0x2ed08e[_0x6700('0x62')][_0x6700('0x4c')],'provider':_0x2ed08e[_0x6700('0x62')][_0x6700('0x63')]===_0x6700('0x76')?null:_0x2ed08e[_0x6700('0x62')]['provider'],'email':_0x2ed08e[_0x6700('0x62')][_0x6700('0x77')],'ListId':_0x2ed08e[_0x6700('0x62')][_0x6700('0x78')],'active':!_['isNil'](_0x2ed08e[_0x6700('0x62')][_0x6700('0x79')])?_0x2ed08e[_0x6700('0x62')]['active']:!![],'description':_0x2ed08e[_0x6700('0x62')]['description']||null};var _0x168536=getAuthenticationOptions(_0x32c9e5[_0x6700('0x63')],_0x2ed08e[_0x6700('0x62')]);_0x32c9e5[_0x6700('0x43')]=_0x168536[_0x6700('0x43')];_0x32c9e5['Smtp']=_0x168536[_0x6700('0x44')];return db[_0x6700('0x49')][_0x6700('0x71')](_0x32c9e5,{'include':[{'model':db[_0x6700('0x46')],'as':_0x6700('0x44')},{'model':db['MailServerIn'],'as':'Imap'}]})['then'](function(_0x3b8ea2){var _0x562958=_0x2ed08e['user'][_0x6700('0x28')]({'plain':!![]});if(!_0x562958)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x562958[_0x6700('0x7a')]===_0x6700('0x38')){var _0x3b7e49=_0x3b8ea2[_0x6700('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x6700('0x64')]({'where':{'name':'MailAccounts','userProfileId':_0x562958[_0x6700('0x7b')]},'raw':!![]})['then'](function(_0x53627b){if(_0x53627b&&_0x53627b[_0x6700('0x7c')]===0x0){return db['UserProfileResource'][_0x6700('0x71')]({'name':_0x3b7e49[_0x6700('0x2d')],'resourceId':_0x3b7e49['id'],'type':_0x53627b[_0x6700('0x2d')],'sectionId':_0x53627b['id']},{})['then'](function(){return _0x3b8ea2;});}else{return _0x3b8ea2;}})[_0x6700('0x1e')](function(_0x5493a4){logger[_0x6700('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5493a4);throw _0x5493a4;});}return _0x3b8ea2;})['then'](respondWithResult(_0x4ce6b0,0xc9))['catch'](handleError(_0x4ce6b0,null));};exports['getImap']=function(_0x33ce5d,_0x45647e){return db[_0x6700('0x49')]['findOne']({'where':{'id':_0x33ce5d[_0x6700('0x5d')]['id']}})['then'](handleEntityNotFound(_0x45647e,null))[_0x6700('0x13')](function(_0x183935){if(_0x183935){return _0x183935[_0x6700('0x7d')]();}return null;})[_0x6700('0x13')](respondWithResult(_0x45647e,null))['catch'](handleError(_0x45647e,null));};exports[_0x6700('0x7e')]=function(_0x21d084,_0x24d96d){if(_0x21d084[_0x6700('0x62')]['id']){delete _0x21d084[_0x6700('0x62')]['id'];}return db['MailAccount'][_0x6700('0x64')]({'where':{'id':_0x21d084[_0x6700('0x5d')]['id']}})['then'](handleEntityNotFound(_0x24d96d,null))[_0x6700('0x13')](function(_0x209795){if(_0x209795){_0x21d084[_0x6700('0x62')][_0x6700('0x67')]=_0x209795['id'];return db[_0x6700('0x45')][_0x6700('0x71')](_0x21d084['body']);}})['then'](respondWithResult(_0x24d96d,null))[_0x6700('0x1e')](handleError(_0x24d96d,null));};exports['removeImap']=function(_0x5a37ee,_0x488cf2){return db[_0x6700('0x49')]['findOne']({'where':{'id':_0x5a37ee[_0x6700('0x5d')]['id']}})[_0x6700('0x13')](handleEntityNotFound(_0x488cf2,null))['then'](function(_0x5a02a1){if(_0x5a02a1){return _0x5a02a1['setImap'](null);}return null;})[_0x6700('0x13')](respondWithStatusCode(_0x488cf2,null))['catch'](handleError(_0x488cf2,null));};exports[_0x6700('0x7f')]=function(_0x469512,_0x43d731){return db[_0x6700('0x49')][_0x6700('0x69')]({'where':{'id':_0x469512[_0x6700('0x5d')]['id']}})[_0x6700('0x13')](handleEntityNotFound(_0x43d731,null))[_0x6700('0x13')](function(_0x3328c7){if(_0x3328c7){return _0x3328c7['getSmtp']();}return null;})[_0x6700('0x13')](respondWithResult(_0x43d731,null))[_0x6700('0x1e')](handleError(_0x43d731,null));};exports[_0x6700('0x80')]=function(_0x1aa4aa,_0x157cc2){if(_0x1aa4aa[_0x6700('0x62')]['id']){delete _0x1aa4aa[_0x6700('0x62')]['id'];}return db[_0x6700('0x49')][_0x6700('0x64')]({'where':{'id':_0x1aa4aa[_0x6700('0x5d')]['id']}})['then'](handleEntityNotFound(_0x157cc2,null))[_0x6700('0x13')](function(_0xd58de4){if(_0xd58de4){_0x1aa4aa['body'][_0x6700('0x67')]=_0xd58de4['id'];return db['MailServerOut'][_0x6700('0x71')](_0x1aa4aa['body']);}})['then'](respondWithResult(_0x157cc2,null))[_0x6700('0x1e')](handleError(_0x157cc2,null));};exports[_0x6700('0x81')]=function(_0x285378,_0x4de6f6){return db['MailAccount'][_0x6700('0x69')]({'where':{'id':_0x285378[_0x6700('0x5d')]['id']}})[_0x6700('0x13')](handleEntityNotFound(_0x4de6f6,null))[_0x6700('0x13')](function(_0x118a92){if(_0x118a92){return _0x118a92['setSmtp'](null);}return null;})[_0x6700('0x13')](respondWithStatusCode(_0x4de6f6,null))[_0x6700('0x1e')](handleError(_0x4de6f6,null));};exports[_0x6700('0x82')]=function(_0x22ea4a,_0xf379ca){return db['MailInteraction'][_0x6700('0x64')]({'where':{'id':_0x22ea4a['params']['id']}})[_0x6700('0x13')](handleEntityNotFound(_0xf379ca,null))[_0x6700('0x13')](function(_0x86cab9){if(_0x86cab9){return _0x86cab9['addInteraction'](_0x22ea4a[_0x6700('0x62')][_0x6700('0x75')],_[_0x6700('0x83')](_0x22ea4a['body'],['ids','id'])||{});}})['then'](respondWithResult(_0xf379ca,null))['catch'](handleError(_0xf379ca,null));};exports[_0x6700('0x84')]=function(_0x41e51f,_0x70eca4){var _0x1c17d9={'raw':![],'where':{}};var _0x152bcb={};var _0x5cbbc9={'count':0x0,'rows':[]};return db[_0x6700('0x49')][_0x6700('0x69')]({'where':{'id':_0x41e51f['params']['id']}})['then'](handleEntityNotFound(_0x70eca4,null))[_0x6700('0x13')](function(_0x1cf64b){if(_0x1cf64b){_0x152bcb['model']=_[_0x6700('0x4f')](db[_0x6700('0x85')][_0x6700('0x5f')]);_0x152bcb[_0x6700('0x4e')]=_[_0x6700('0x4f')](_0x41e51f['query']);_0x152bcb['filters']=_[_0x6700('0x60')](_0x152bcb[_0x6700('0x4d')],_0x152bcb[_0x6700('0x4e')]);_0x1c17d9[_0x6700('0x51')]=_[_0x6700('0x60')](_0x152bcb[_0x6700('0x4d')],qs['fields'](_0x41e51f[_0x6700('0x4e')]['fields']));_0x1c17d9[_0x6700('0x51')]=_0x1c17d9[_0x6700('0x51')][_0x6700('0x53')]?_0x1c17d9['attributes']:_0x152bcb[_0x6700('0x4d')];if(!_0x41e51f['query'][_0x6700('0x6b')](_0x6700('0x6c'))){_0x1c17d9[_0x6700('0x23')]=qs[_0x6700('0x23')](_0x41e51f[_0x6700('0x4e')][_0x6700('0x23')]);_0x1c17d9[_0x6700('0x21')]=qs[_0x6700('0x21')](_0x41e51f[_0x6700('0x4e')][_0x6700('0x21')]);}_0x1c17d9[_0x6700('0x54')]=qs['sort'](_0x41e51f[_0x6700('0x4e')][_0x6700('0x6d')]);_0x1c17d9[_0x6700('0x55')]=qs[_0x6700('0x50')](_[_0x6700('0x56')](_0x41e51f['query'],_0x152bcb[_0x6700('0x50')]));_0x1c17d9[_0x6700('0x55')][_0x6700('0x67')]=_0x1cf64b['id'];if(_0x41e51f['query']['filter']){_0x1c17d9[_0x6700('0x55')]=_['merge'](_0x1c17d9[_0x6700('0x55')],{'$or':_[_0x6700('0x48')](_0x1c17d9[_0x6700('0x51')],function(_0x3505e3){var _0x2c4433={};_0x2c4433[_0x3505e3]={'$like':'%'+_0x41e51f[_0x6700('0x4e')][_0x6700('0x57')]+'%'};return _0x2c4433;})});}_0x1c17d9=_['merge']({},_0x1c17d9,_0x41e51f[_0x6700('0x59')]);return db[_0x6700('0x85')][_0x6700('0x24')]({'where':_0x1c17d9[_0x6700('0x55')]})[_0x6700('0x13')](function(_0xb2cf94){_0x5cbbc9[_0x6700('0x24')]=_0xb2cf94;if(_0x41e51f[_0x6700('0x4e')][_0x6700('0x61')]){_0x1c17d9[_0x6700('0x5a')]=[{'model':db[_0x6700('0x86')],'as':_0x6700('0x87'),'required':![]},{'model':db['User'],'as':_0x6700('0x88'),'attributes':[_0x6700('0x2d'),_0x6700('0x89'),'internal'],'required':![]},{'model':db[_0x6700('0x8a')],'as':_0x6700('0x8b'),'attributes':['id','name',_0x6700('0x8c')],'where':_0x41e51f[_0x6700('0x4e')][_0x6700('0x8d')]?{'id':_0x41e51f[_0x6700('0x4e')][_0x6700('0x8d')]}:undefined,'required':_0x41e51f['query'][_0x6700('0x8d')]?!![]:![]}];}return db[_0x6700('0x85')]['findAll'](_0x1c17d9);})[_0x6700('0x13')](function(_0x3e940f){_0x5cbbc9[_0x6700('0x5b')]=_0x3e940f;return _0x5cbbc9;});}})[_0x6700('0x13')](respondWithFilteredResult(_0x70eca4,_0x1c17d9))[_0x6700('0x1e')](handleError(_0x70eca4,null));};exports[_0x6700('0x8e')]=function addApplications(_0x2445d4,_0x3f00a7){var _0x2e0794=_0x2445d4[_0x6700('0x5d')]['id'];var _0x11d973=_0x2445d4[_0x6700('0x62')];var _0x33528c=0xc8;var _0x114b91=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x6700('0x8f')]['ISOLATION_LEVELS'][_0x6700('0x90')]},function(_0x2c73e4){return db['MailAccount']['findOne']({'where':{'id':_0x2e0794},'transaction':_0x2c73e4})[_0x6700('0x13')](function(_0x41910d){if(_0x41910d){return db[_0x6700('0x91')][_0x6700('0x27')]({'where':{'MailAccountId':_0x2e0794},'transaction':_0x2c73e4})[_0x6700('0x13')](function(){var _0x5240a0=_['map'](_0x11d973,function(_0x2c9bf5){_0x2c9bf5[_0x6700('0x67')]=_0x2e0794;return _0x2c9bf5;});return db[_0x6700('0x91')][_0x6700('0x92')](_0x5240a0,{'transaction':_0x2c73e4});});}else{_0x33528c=0x194;_0x114b91=[];}});})[_0x6700('0x13')](function(){if(_0x33528c!==0x194){return db[_0x6700('0x91')][_0x6700('0x93')]({'where':{'MailAccountId':_0x2e0794},'order':_0x6700('0x94')})[_0x6700('0x13')](function(_0x361a06){_0x114b91=_0x361a06;});}})[_0x6700('0x1e')](function(_0x2f617a){_0x33528c=0x1f4;logger[_0x6700('0x19')](_0x2f617a[_0x6700('0x2c')]);if(_0x2f617a[_0x6700('0x2d')]){delete _0x2f617a[_0x6700('0x2d')];}_0x114b91=_0x2f617a;})['finally'](function(){if(_0x114b91===null){_0x3f00a7[_0x6700('0x2b')](_0x33528c);}else{if(_0x33528c===0x1f4){_0x3f00a7['status'](_0x33528c)[_0x6700('0x2e')](_0x114b91);}else{_0x3f00a7[_0x6700('0x1f')](_0x33528c)['json'](_0x114b91);}}});};exports[_0x6700('0x95')]=function(_0x415f09,_0x5bdc61){var _0x350a7c={};var _0x383968={};var _0x1b81f4;var _0x274dbf;return db[_0x6700('0x49')][_0x6700('0x69')]({'where':{'id':_0x415f09[_0x6700('0x5d')]['id']}})[_0x6700('0x13')](handleEntityNotFound(_0x5bdc61,null))['then'](function(_0x5ac158){if(_0x5ac158){_0x1b81f4=_0x5ac158;_0x383968['model']=_[_0x6700('0x4f')](db[_0x6700('0x91')][_0x6700('0x5f')]);_0x383968['query']=_[_0x6700('0x4f')](_0x415f09['query']);_0x383968['filters']=_['intersection'](_0x383968[_0x6700('0x4d')],_0x383968['query']);_0x350a7c[_0x6700('0x51')]=_[_0x6700('0x60')](_0x383968[_0x6700('0x4d')],qs[_0x6700('0x52')](_0x415f09[_0x6700('0x4e')][_0x6700('0x52')]));_0x350a7c[_0x6700('0x51')]=_0x350a7c[_0x6700('0x51')]['length']?_0x350a7c[_0x6700('0x51')]:_0x383968['model'];_0x350a7c['order']=qs[_0x6700('0x6d')](_0x415f09['query'][_0x6700('0x6d')]);_0x350a7c[_0x6700('0x55')]=qs[_0x6700('0x50')](_[_0x6700('0x56')](_0x415f09[_0x6700('0x4e')],_0x383968[_0x6700('0x50')]));if(_0x415f09[_0x6700('0x4e')]['filter']){_0x350a7c['where']=_[_0x6700('0x58')](_0x350a7c[_0x6700('0x55')],{'$or':_['map'](_0x350a7c['attributes'],function(_0x56f1c3){var _0x7ab9b2={};_0x7ab9b2[_0x56f1c3]={'$like':'%'+_0x415f09[_0x6700('0x4e')][_0x6700('0x57')]+'%'};return _0x7ab9b2;})});}_0x350a7c=_[_0x6700('0x58')]({},_0x350a7c,_0x415f09[_0x6700('0x59')]);return _0x1b81f4[_0x6700('0x95')](_0x350a7c);}})[_0x6700('0x13')](function(_0x3f3526){if(_0x3f3526){_0x274dbf=_0x3f3526[_0x6700('0x53')];if(!_0x415f09[_0x6700('0x4e')][_0x6700('0x6b')]('nolimit')){_0x350a7c['limit']=qs['limit'](_0x415f09[_0x6700('0x4e')][_0x6700('0x23')]);_0x350a7c[_0x6700('0x21')]=qs[_0x6700('0x21')](_0x415f09[_0x6700('0x4e')][_0x6700('0x21')]);}return _0x1b81f4[_0x6700('0x95')](_0x350a7c);}})[_0x6700('0x13')](function(_0xc9cc51){if(_0xc9cc51){return _0xc9cc51?{'count':_0x274dbf,'rows':_0xc9cc51}:null;}})[_0x6700('0x13')](respondWithResult(_0x5bdc61,null))[_0x6700('0x1e')](handleError(_0x5bdc61,null));};exports[_0x6700('0x96')]=function(_0x44024a,_0xecba48){var _0x351c58={'raw':!![],'where':{}};var _0x29d9a4={};var _0x27ebea={'count':0x0,'rows':[]};return db[_0x6700('0x49')][_0x6700('0x69')]({'where':{'id':_0x44024a[_0x6700('0x5d')]['id']}})[_0x6700('0x13')](handleEntityNotFound(_0xecba48,null))[_0x6700('0x13')](function(_0xe2d8ce){if(_0xe2d8ce){_0x29d9a4[_0x6700('0x4d')]=_[_0x6700('0x4f')](db['MailMessage']['rawAttributes']);_0x29d9a4[_0x6700('0x4e')]=_[_0x6700('0x4f')](_0x44024a[_0x6700('0x4e')]);_0x29d9a4[_0x6700('0x50')]=_[_0x6700('0x60')](_0x29d9a4[_0x6700('0x4d')],_0x29d9a4[_0x6700('0x4e')]);_0x351c58[_0x6700('0x51')]=_[_0x6700('0x60')](_0x29d9a4['model'],qs['fields'](_0x44024a[_0x6700('0x4e')][_0x6700('0x52')]));_0x351c58[_0x6700('0x51')]=_0x351c58['attributes']['length']?_0x351c58[_0x6700('0x51')]:_0x29d9a4[_0x6700('0x4d')];if(!_0x44024a[_0x6700('0x4e')][_0x6700('0x6b')](_0x6700('0x6c'))){_0x351c58['limit']=qs[_0x6700('0x23')](_0x44024a[_0x6700('0x4e')][_0x6700('0x23')]);_0x351c58[_0x6700('0x21')]=qs['offset'](_0x44024a[_0x6700('0x4e')][_0x6700('0x21')]);}_0x351c58[_0x6700('0x54')]=qs['sort'](_0x44024a['query'][_0x6700('0x6d')]);_0x351c58[_0x6700('0x55')]=qs['filters'](_[_0x6700('0x56')](_0x44024a[_0x6700('0x4e')],_0x29d9a4['filters']));_0x351c58['where'][_0x6700('0x67')]=_0xe2d8ce['id'];if(_0x44024a[_0x6700('0x4e')][_0x6700('0x57')]){_0x351c58[_0x6700('0x55')]=_[_0x6700('0x58')](_0x351c58['where'],{'$or':_[_0x6700('0x48')](_0x351c58['attributes'],function(_0x5b51a5){var _0x2019ce={};_0x2019ce[_0x5b51a5]={'$like':'%'+_0x44024a['query'][_0x6700('0x57')]+'%'};return _0x2019ce;})});}if(_0x44024a[_0x6700('0x4e')]['$gte']){var _0x58ca21=_0x44024a[_0x6700('0x4e')]['$gte'][_0x6700('0x97')](',');var _0x5c0acd={};_0x5c0acd[_0x58ca21[0x0]]={'$gte':moment(_0x58ca21[0x1])[_0x6700('0x98')]('YYYY-MM-DD\x20HH:mm:ss')};_0x351c58[_0x6700('0x55')]=_['merge'](_0x351c58[_0x6700('0x55')],_0x5c0acd);}_0x351c58=_[_0x6700('0x58')]({},_0x351c58,_0x44024a[_0x6700('0x59')]);return db[_0x6700('0x99')][_0x6700('0x24')]({'where':_0x351c58[_0x6700('0x55')]})[_0x6700('0x13')](function(_0x152272){_0x27ebea[_0x6700('0x24')]=_0x152272;if(_0x44024a['query'][_0x6700('0x61')]){_0x351c58[_0x6700('0x5a')]=[{'all':!![]}];}return db[_0x6700('0x99')][_0x6700('0x6e')](_0x351c58);})[_0x6700('0x13')](function(_0x402a5d){if(_0x44024a[_0x6700('0x4e')][_0x6700('0x9a')]==='true'){for(var _0x15554d=0x0;_0x15554d<_0x402a5d[_0x6700('0x53')];_0x15554d++){_0x402a5d[_0x15554d]['body']=juice(_0x402a5d[_0x15554d][_0x6700('0x62')]);}}_0x27ebea[_0x6700('0x5b')]=_0x402a5d;return _0x27ebea;});}})[_0x6700('0x13')](respondWithFilteredResult(_0xecba48,_0x351c58))[_0x6700('0x1e')](handleError(_0xecba48,null));};exports[_0x6700('0x2e')]=function(_0x4a595c,_0x1460fe){var _0x3ccb2b,_0x11afe4={},_0x47f6c2;if(_0x4a595c[_0x6700('0x62')]['to']){_0x47f6c2=_0x4a595c[_0x6700('0x62')]['to'][_0x6700('0x97')](',')[0x0];}return db[_0x6700('0x49')][_0x6700('0x64')]({'where':{'id':_0x4a595c[_0x6700('0x5d')]['id']},'include':[{'model':db[_0x6700('0x9b')],'as':_0x6700('0x9c'),'include':[{'model':db[_0x6700('0x86')],'as':'Contacts','where':{'email':_0x47f6c2},'limit':0x1,'order':[[_0x6700('0x9d'),_0x6700('0x9e')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6700('0x9f'),'raw':!![]}]}]})[_0x6700('0x13')](handleEntityNotFound(_0x1460fe,null))[_0x6700('0x13')](function(_0x4500cc){if(!_0x4500cc)return;_0x3ccb2b=_0x4500cc;if(!_0x4500cc[_0x6700('0x44')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x6700('0xa0')](_0x4a595c[_0x6700('0x62')]['from'])){_0x4a595c[_0x6700('0x62')][_0x6700('0xa1')]=util[_0x6700('0x98')]('%s\x20<%s>',_0x4500cc[_0x6700('0x2d')],_0x4500cc[_0x6700('0x77')]||_0x4500cc[_0x6700('0x44')]['user']);}if(_0x4a595c[_0x6700('0x62')][_0x6700('0xa2')]&&_0x4a595c[_0x6700('0x62')][_0x6700('0xa2')][_0x6700('0x53')]){for(var _0x377770=0x0;_0x377770<_0x4a595c['body'][_0x6700('0xa2')][_0x6700('0x53')];_0x377770+=0x1){_0x4a595c['body'][_0x6700('0xa2')][_0x377770]={'filename':_0x4a595c['body'][_0x6700('0xa2')][_0x377770]['name'],'path':path[_0x6700('0xa3')](config['root'],_0x6700('0xa4'),_0x4a595c[_0x6700('0x62')][_0x6700('0xa2')][_0x377770]['basename'])};}}var _0x4c369e=_0x4500cc['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x6700('0xa5'),{'account':_0x4c369e,'message':_0x4a595c[_0x6700('0x62')]});})['then'](function(_0x4a8c6e){if(!_0x4a8c6e)return;_0x11afe4=_0x4a8c6e;if(!_0x3ccb2b[_0x6700('0x9c')])throw new Error(_0x6700('0xa6'));if(_0x3ccb2b[_0x6700('0x9c')][_0x6700('0xa7')]['length'])return _0x3ccb2b[_0x6700('0x9c')]['Contacts'][0x0];return db[_0x6700('0x86')][_0x6700('0x71')](_['defaults'](_0x4a595c['body'],{'firstName':_0x4a595c['body']['to'],'email':_0x4a595c[_0x6700('0x62')]['to'],'phone':_0x4a595c[_0x6700('0x62')]['to'],'ListId':_0x3ccb2b[_0x6700('0x78')]}));})['then'](function(_0x3fb294){if(!_0x3fb294)return;var _0x47b738={'UserId':_0x4a595c[_0x6700('0x38')]['id'],'ContactId':_0x3fb294['id'],'MailAccountId':_0x3ccb2b['id'],'inReplyTo':_0x11afe4[_0x6700('0xa8')],'to':_0x4a595c[_0x6700('0x62')][_0x6700('0xa1')],'cc':_0x4a595c[_0x6700('0x62')]['cc'],'subject':_0x4a595c[_0x6700('0x62')]['subject'],'attach':_0x4a595c['body'][_0x6700('0xa9')],'firstMsgDirection':_0x6700('0xaa'),'lastMsgAt':moment()[_0x6700('0x98')](_0x6700('0xab')),'lastMsgDirection':_0x6700('0xaa'),'Messages':[_[_0x6700('0x58')](_0x4a595c[_0x6700('0x62')],{'messageId':_0x11afe4['messageId'],'sentAt':moment()[_0x6700('0x98')](_0x6700('0xab')),'read':!![],'MailAccountId':_0x3ccb2b['id'],'UserId':_0x4a595c['user']['id'],'ContactId':_0x3fb294['id']})]};if(_0x4a595c[_0x6700('0x62')]['Interaction']){_0x47b738=_[_0x6700('0x58')](_0x47b738,_0x4a595c[_0x6700('0x62')][_0x6700('0xac')]);}return db['MailInteraction'][_0x6700('0x71')](_0x47b738,{'include':[{'model':db[_0x6700('0x99')],'as':_0x6700('0xad')}]});})[_0x6700('0x13')](respondWithResult(_0x1460fe,null))['catch'](handleError(_0x1460fe,null));};exports[_0x6700('0xae')]=function(_0x6977c3,_0x9228a4){return db[_0x6700('0x49')]['find']({'where':{'id':_0x6977c3['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0x6700('0x44'),'raw':!![],'include':[{'model':db[_0x6700('0x9f')],'as':'CloudProvider','raw':!![]}]}]})[_0x6700('0x13')](handleEntityNotFound(_0x9228a4,null))[_0x6700('0x13')](function(_0x4026e2){if(!_0x4026e2[_0x6700('0x44')])return;var _0x2d618e=_0x4026e2[_0x6700('0xaf')]();return respondWithRpcPromise(_0x6700('0xb0'),'verifySmtp',{'account':_0x2d618e});})[_0x6700('0x13')](respondWithResult(_0x9228a4,null))[_0x6700('0x1e')](handleError(_0x9228a4,null));};exports[_0x6700('0x27')]=function(_0x3357eb,_0x32304e){return db[_0x6700('0x49')][_0x6700('0x64')]({'where':{'id':_0x3357eb[_0x6700('0x5d')]['id']}})['then'](handleEntityNotFound(_0x32304e,null))[_0x6700('0x13')](function(_0x350075){if(_0x350075&&_0x350075[_0x6700('0x41')]){throw new db[(_0x6700('0xb1'))][(_0x6700('0xb2'))](_0x6700('0xb3'));}return _0x350075;})[_0x6700('0x13')](removeEntity(_0x32304e,null))[_0x6700('0x1e')](handleError(_0x32304e,null));};exports[_0x6700('0xb4')]=function(_0xb8ffe7,_0xf19409){return db[_0x6700('0x49')]['find']({'where':{'id':_0xb8ffe7['params']['id']}})[_0x6700('0x13')](handleEntityNotFound(_0xf19409,null))[_0x6700('0x13')](function(_0x5a04a8){if(_0x5a04a8){return _0x5a04a8[_0x6700('0xb4')](_0xb8ffe7[_0x6700('0x62')][_0x6700('0x75')],_[_0x6700('0x83')](_0xb8ffe7[_0x6700('0x62')],[_0x6700('0x75'),'id'])||{})[_0x6700('0xb5')](function(_0x539f29){for(var _0x26452c=0x0;_0x26452c<_0xb8ffe7[_0x6700('0x62')][_0x6700('0x75')]['length'];_0x26452c+=0x1){socket[_0x6700('0xb6')]('userMailAccount:save',{'UserId':Number(_0xb8ffe7[_0x6700('0x62')][_0x6700('0x75')][_0x26452c]),'MailAccountId':Number(_0xb8ffe7[_0x6700('0x5d')]['id'])});}return _0x539f29;});}})[_0x6700('0x13')](respondWithResult(_0xf19409,null))[_0x6700('0x1e')](handleError(_0xf19409,null));};exports[_0x6700('0xb7')]=function(_0x5c4876,_0x3e41a3){return db[_0x6700('0x49')][_0x6700('0x64')]({'where':{'id':_0x5c4876['params']['id']}})['then'](handleEntityNotFound(_0x3e41a3,null))[_0x6700('0x13')](function(_0x42c546){if(_0x42c546){return _0x42c546['removeAgents'](_0x5c4876[_0x6700('0x4e')][_0x6700('0x75')])[_0x6700('0x13')](function(){if(_[_0x6700('0xb8')](_0x5c4876[_0x6700('0x4e')]['ids'])){for(var _0x4c03f2=0x0;_0x4c03f2<_0x5c4876['query']['ids']['length'];_0x4c03f2+=0x1){socket[_0x6700('0xb6')](_0x6700('0xb9'),{'UserId':Number(_0x5c4876[_0x6700('0x4e')][_0x6700('0x75')][_0x4c03f2]),'MailAccountId':Number(_0x5c4876[_0x6700('0x5d')]['id'])});}}else{socket[_0x6700('0xb6')](_0x6700('0xb9'),{'UserId':Number(_0x5c4876['query'][_0x6700('0x75')]),'MailAccountId':Number(_0x5c4876[_0x6700('0x5d')]['id'])});}});}})[_0x6700('0x13')](respondWithStatusCode(_0x3e41a3,null))['catch'](handleError(_0x3e41a3,null));};exports['getAgents']=function(_0xce3e0e,_0x3f0de4){var _0x85623e={};var _0x4e03d5={};var _0x51798f;var _0x8d346e;return db[_0x6700('0x49')][_0x6700('0x69')]({'where':{'id':_0xce3e0e[_0x6700('0x5d')]['id']}})[_0x6700('0x13')](handleEntityNotFound(_0x3f0de4,null))[_0x6700('0x13')](function(_0x59401a){if(_0x59401a){_0x51798f=_0x59401a;_0x4e03d5[_0x6700('0x4d')]=_['keys'](db[_0x6700('0xba')]['rawAttributes']);_0x4e03d5['query']=_[_0x6700('0x4f')](_0xce3e0e[_0x6700('0x4e')]);_0x4e03d5[_0x6700('0x50')]=_[_0x6700('0x60')](_0x4e03d5['model'],_0x4e03d5['query']);_0x85623e['attributes']=_[_0x6700('0x60')](_0x4e03d5[_0x6700('0x4d')],qs['fields'](_0xce3e0e['query'][_0x6700('0x52')]));_0x85623e['attributes']=_0x85623e['attributes'][_0x6700('0x53')]?_0x85623e['attributes']:_0x4e03d5['model'];_0x85623e[_0x6700('0x54')]=qs[_0x6700('0x6d')](_0xce3e0e[_0x6700('0x4e')][_0x6700('0x6d')]);_0x85623e[_0x6700('0x55')]=qs['filters'](_[_0x6700('0x56')](_0xce3e0e[_0x6700('0x4e')],_0x4e03d5[_0x6700('0x50')]));if(_0xce3e0e['query'][_0x6700('0x57')]){_0x85623e['where']=_[_0x6700('0x58')](_0x85623e['where'],{'$or':_[_0x6700('0x48')](_0x85623e[_0x6700('0x51')],function(_0x454243){var _0x5423a0={};_0x5423a0[_0x454243]={'$like':'%'+_0xce3e0e[_0x6700('0x4e')][_0x6700('0x57')]+'%'};return _0x5423a0;})});}_0x85623e=_['merge']({},_0x85623e,_0xce3e0e[_0x6700('0x59')]);return _0x51798f['getAgents'](_0x85623e);}})[_0x6700('0x13')](function(_0x20bb6e){if(_0x20bb6e){_0x8d346e=_0x20bb6e[_0x6700('0x53')];if(!_0xce3e0e[_0x6700('0x4e')]['hasOwnProperty'](_0x6700('0x6c'))){_0x85623e[_0x6700('0x23')]=qs[_0x6700('0x23')](_0xce3e0e[_0x6700('0x4e')][_0x6700('0x23')]);_0x85623e['offset']=qs[_0x6700('0x21')](_0xce3e0e['query']['offset']);}return _0x51798f['getAgents'](_0x85623e);}})[_0x6700('0x13')](function(_0xde5a8d){if(_0xde5a8d){return _0xde5a8d?{'count':_0x8d346e,'rows':_0xde5a8d}:null;}})[_0x6700('0x13')](respondWithResult(_0x3f0de4,null))[_0x6700('0x1e')](handleError(_0x3f0de4,null));}; \ No newline at end of file +var _0x8606=['status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','MailAccounts','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','length','filter','rows','removeDispositions','ids','CannedAnswer','create','getAnswers','removeAnswers','custom','email','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','getImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','color','tag','addApplications','sequelize','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','MailMessage','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','Contacts','updatedAt','Smtp\x20configuration\x20not\x20found','isNil','from','format','%s\x20<%s>','attachments','join','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','ListId','subject','attach','out','messageId','Interaction','Messages','getSmtpOptions','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','juice','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus'];(function(_0x1329f0,_0x28e343){var _0x1c7c61=function(_0x3f6348){while(--_0x3f6348){_0x1329f0['push'](_0x1329f0['shift']());}};_0x1c7c61(++_0x28e343);}(_0x8606,0xa5));var _0x6860=function(_0x4cee17,_0xda2b5){_0x4cee17=_0x4cee17-0x0;var _0x1d3b07=_0x8606[_0x4cee17];return _0x1d3b07;};'use strict';var moment=require(_0x6860('0x0'));var BPromise=require(_0x6860('0x1'));var util=require('util');var path=require(_0x6860('0x2'));var _=require(_0x6860('0x3'));var juice=require(_0x6860('0x4'));var Redis=require(_0x6860('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x6860('0x6'))(_0x6860('0x7'));var config=require(_0x6860('0x8'));var db=require(_0x6860('0x9'))['db'];config[_0x6860('0xa')]=_[_0x6860('0xb')](config[_0x6860('0xa')],{'host':_0x6860('0xc'),'port':0x18eb});var socket=require(_0x6860('0xd'))(new Redis(config[_0x6860('0xa')]));require(_0x6860('0xe'))[_0x6860('0xf')](socket);var jayson=require(_0x6860('0x10'));var client=jayson[_0x6860('0x11')]['http']({'port':0x232b});function respondWithRpcPromise(_0x30c417,_0x3f8acd,_0x4976fb,_0x178995){return new BPromise(function(_0x35ff29,_0x228bc2){var _0x39f279=_0x178995||client;return _0x39f279[_0x6860('0x12')](_0x30c417,_0x4976fb)[_0x6860('0x13')](function(_0x41799d){logger[_0x6860('0x14')](_0x6860('0x15'),_0x3f8acd,_0x6860('0x16'));logger['debug'](_0x6860('0x17'),_0x3f8acd,_0x6860('0x16'),JSON['stringify'](_0x41799d));if(_0x41799d[_0x6860('0x18')]){if(_0x41799d[_0x6860('0x18')][_0x6860('0x19')]===0x1f4){logger[_0x6860('0x18')](_0x6860('0x15'),_0x3f8acd,_0x41799d[_0x6860('0x18')]['message']);return _0x228bc2(_0x41799d[_0x6860('0x18')][_0x6860('0x1a')]);}logger['error'](_0x6860('0x15'),_0x3f8acd,_0x41799d[_0x6860('0x18')]['message']);return _0x35ff29(_0x41799d[_0x6860('0x18')][_0x6860('0x1a')]);}else{logger[_0x6860('0x14')](_0x6860('0x15'),_0x3f8acd,'request\x20sent');_0x35ff29(_0x41799d['result'][_0x6860('0x1a')]);}})[_0x6860('0x1b')](function(_0x29cd5f){logger[_0x6860('0x18')]('MailAccount,\x20%s,\x20%s',_0x3f8acd,_0x29cd5f);_0x228bc2(_0x29cd5f);});});}function respondWithStatusCode(_0x36bbfd,_0x395a9f){_0x395a9f=_0x395a9f||0xcc;return function(_0x591a7b){if(_0x591a7b){return _0x36bbfd[_0x6860('0x1c')](_0x395a9f);}return _0x36bbfd[_0x6860('0x1d')](_0x395a9f)[_0x6860('0x1e')]();};}function respondWithResult(_0x37f73d,_0x37b735){_0x37b735=_0x37b735||0xc8;return function(_0x2d75a4){if(_0x2d75a4){return _0x37f73d[_0x6860('0x1d')](_0x37b735)[_0x6860('0x1f')](_0x2d75a4);}};}function respondWithFilteredResult(_0x5390b4,_0x4b4b97){return function(_0x187801){if(_0x187801){var _0x38fc26=typeof _0x4b4b97[_0x6860('0x20')]==='undefined'&&typeof _0x4b4b97[_0x6860('0x21')]===_0x6860('0x22');var _0x4e4bff=_0x187801[_0x6860('0x23')];var _0x2d8c35=_0x38fc26?0x0:_0x4b4b97['offset'];var _0x3926a5=_0x38fc26?_0x187801[_0x6860('0x23')]:_0x4b4b97['offset']+_0x4b4b97[_0x6860('0x21')];var _0x16a4fd;if(_0x3926a5>=_0x4e4bff){_0x3926a5=_0x4e4bff;_0x16a4fd=0xc8;}else{_0x16a4fd=0xce;}_0x5390b4[_0x6860('0x1d')](_0x16a4fd);return _0x5390b4[_0x6860('0x24')](_0x6860('0x25'),_0x2d8c35+'-'+_0x3926a5+'/'+_0x4e4bff)[_0x6860('0x1f')](_0x187801);}return null;};}function saveUpdates(_0x19b268){return function(_0x2ec067){if(_0x2ec067){return _0x2ec067[_0x6860('0x26')](_0x19b268)['then'](function(_0x325966){return _0x325966;});}return null;};}function removeEntity(_0x276587){return function(_0xd53f06){if(_0xd53f06){return _0xd53f06[_0x6860('0x27')]()[_0x6860('0x13')](function(){var _0x31ba6c=_0xd53f06[_0x6860('0x28')]({'plain':!![]});var _0x347365=_0x6860('0x29');return db['UserProfileResource'][_0x6860('0x27')]({'where':{'type':_0x347365,'resourceId':_0x31ba6c['id']}})[_0x6860('0x13')](function(){return _0xd53f06;});})['then'](function(){_0x276587['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x187e8e){return function(_0x57bada){if(!_0x57bada){_0x187e8e[_0x6860('0x1c')](0x194);}return _0x57bada;};}function handleError(_0x31ac7c,_0x4fab87){_0x4fab87=_0x4fab87||0x1f4;return function(_0x20a509){logger[_0x6860('0x18')](_0x20a509[_0x6860('0x2a')]);if(_0x20a509[_0x6860('0x2b')]){delete _0x20a509['name'];}_0x31ac7c[_0x6860('0x1d')](_0x4fab87)[_0x6860('0x2c')](_0x20a509);};}function getImapHost(_0xee4861){switch(_0xee4861){case _0x6860('0x2d'):return _0x6860('0x2e');case _0x6860('0x2f'):return _0x6860('0x30');case _0x6860('0x31'):return _0x6860('0x32');case'outlook365':return _0x6860('0x33');}throw new Error('Unknown\x20email\x20service\x20provider',_0xee4861);}function getSmtpHost(_0x3840ca){switch(_0x3840ca){case _0x6860('0x2d'):return _0x6860('0x34');case _0x6860('0x2f'):return _0x6860('0x35');case _0x6860('0x31'):return _0x6860('0x36');case'outlook365':return _0x6860('0x37');}throw new Error(_0x6860('0x38'),_0x3840ca);}function getAuthenticationOptions(_0x4e0122,_0x24ce57){var _0x2d3177={};var _0x70a080={};if(_0x4e0122){_0x2d3177['user']=_0x70a080[_0x6860('0x39')]=_0x24ce57[_0x6860('0x3a')];_0x2d3177[_0x6860('0x3b')]=_0x70a080[_0x6860('0x3c')]=_0x24ce57[_0x6860('0x3b')];if(_0x24ce57['modernAuthentication']){_0x2d3177[_0x6860('0x3d')]=_0x70a080[_0x6860('0x3d')]=!![];_0x2d3177[_0x6860('0x3e')]=_0x70a080[_0x6860('0x3e')]=_0x24ce57[_0x6860('0x3e')];_0x2d3177[_0x6860('0x3b')]=_0x70a080[_0x6860('0x3c')]=null;}else{_0x2d3177[_0x6860('0x3e')]=_0x70a080[_0x6860('0x3e')]=null;}_0x2d3177[_0x6860('0x3f')]=getImapHost(_0x4e0122);_0x2d3177[_0x6860('0x40')]=0x3e1;_0x70a080['host']=getSmtpHost(_0x4e0122);_0x70a080[_0x6860('0x40')]=0x24b;_0x70a080[_0x6860('0x41')]=![];_0x2d3177['service']=_0x70a080[_0x6860('0x42')]=null;}else{if(_0x24ce57[_0x6860('0x43')]){_0x2d3177[_0x6860('0x39')]=_0x70a080[_0x6860('0x39')]=_0x24ce57[_0x6860('0x3a')];_0x2d3177['password']=_0x70a080[_0x6860('0x3c')]=_0x24ce57[_0x6860('0x3b')];}else{_0x2d3177[_0x6860('0x43')]=_0x70a080['authentication']=![];_0x2d3177[_0x6860('0x39')]=_0x70a080['user']=null;_0x2d3177[_0x6860('0x3b')]=_0x70a080[_0x6860('0x3c')]=null;}_0x2d3177[_0x6860('0x3f')]=_0x24ce57['Imap']['host'];_0x2d3177[_0x6860('0x40')]=_0x24ce57[_0x6860('0x44')][_0x6860('0x40')];_0x70a080[_0x6860('0x3f')]=_0x24ce57[_0x6860('0x45')][_0x6860('0x3f')];_0x70a080['port']=_0x24ce57[_0x6860('0x45')]['port'];}return{'Imap':_0x2d3177,'Smtp':_0x70a080};}exports[_0x6860('0x46')]=function(_0x5e2400,_0xb9ac72){var _0x1b9251={'include':[{'model':db[_0x6860('0x47')],'as':_0x6860('0x44')},{'model':db[_0x6860('0x48')],'as':_0x6860('0x45')},{'model':db[_0x6860('0x49')],'as':_0x6860('0x4a')}]},_0x474973={},_0x5a3a6b={'count':0x0,'rows':[]};var _0x583f92=_[_0x6860('0x4b')](db[_0x6860('0x4c')][_0x6860('0x4d')],function(_0x37d975){return{'name':_0x37d975['fieldName'],'type':_0x37d975[_0x6860('0x4e')][_0x6860('0x4f')]};});_0x474973[_0x6860('0x50')]=_[_0x6860('0x4b')](_0x583f92,_0x6860('0x2b'));_0x474973[_0x6860('0x51')]=_[_0x6860('0x52')](_0x5e2400['query']);_0x474973['filters']=_['intersection'](_0x474973[_0x6860('0x50')],_0x474973[_0x6860('0x51')]);_0x1b9251[_0x6860('0x53')]=_[_0x6860('0x54')](_0x474973[_0x6860('0x50')],qs[_0x6860('0x55')](_0x5e2400[_0x6860('0x51')][_0x6860('0x55')]));_0x1b9251['attributes']=_0x1b9251[_0x6860('0x53')]['length']?_0x1b9251['attributes']:_0x474973[_0x6860('0x50')];if(!_0x5e2400[_0x6860('0x51')][_0x6860('0x56')](_0x6860('0x57'))){_0x1b9251[_0x6860('0x21')]=qs[_0x6860('0x21')](_0x5e2400[_0x6860('0x51')][_0x6860('0x21')]);_0x1b9251[_0x6860('0x20')]=qs[_0x6860('0x20')](_0x5e2400['query'][_0x6860('0x20')]);}_0x1b9251[_0x6860('0x58')]=qs['sort'](_0x5e2400[_0x6860('0x51')][_0x6860('0x59')]);_0x1b9251[_0x6860('0x5a')]=qs['filters'](_[_0x6860('0x5b')](_0x5e2400[_0x6860('0x51')],_0x474973[_0x6860('0x5c')]),_0x583f92);if(_0x5e2400[_0x6860('0x51')]['filter']){_0x1b9251[_0x6860('0x5a')]=_[_0x6860('0x5d')](_0x1b9251['where'],{'$or':_['map'](_0x583f92,function(_0x33604d){if(_0x33604d['type']!==_0x6860('0x5e')){var _0x330689={};_0x330689[_0x33604d['name']]={'$like':'%'+_0x5e2400['query']['filter']+'%'};return _0x330689;}})});}_0x1b9251=_[_0x6860('0x5d')]({},_0x1b9251,_0x5e2400[_0x6860('0x5f')]);var _0x4bab39={'where':_0x1b9251[_0x6860('0x5a')]};return db[_0x6860('0x4c')][_0x6860('0x23')](_0x4bab39)[_0x6860('0x13')](function(_0x1b7f70){_0x5a3a6b[_0x6860('0x23')]=_0x1b7f70;if(_0x5e2400['query'][_0x6860('0x60')]){_0x1b9251['include']=[{'all':!![]}];}return db[_0x6860('0x4c')][_0x6860('0x61')](_0x1b9251);})[_0x6860('0x13')](function(_0x2fcf19){_0x5a3a6b['rows']=_0x2fcf19;return _0x5a3a6b;})[_0x6860('0x13')](respondWithFilteredResult(_0xb9ac72,_0x1b9251))[_0x6860('0x1b')](handleError(_0xb9ac72,null));};exports[_0x6860('0x62')]=function(_0x53bd92,_0x578cf2){var _0x4d13bc={'raw':![],'where':{'id':_0x53bd92[_0x6860('0x63')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x6860('0x48')],'as':_0x6860('0x45')},{'model':db[_0x6860('0x49')],'as':_0x6860('0x4a')}]},_0x23dc2a={};_0x23dc2a[_0x6860('0x50')]=_['keys'](db[_0x6860('0x4c')][_0x6860('0x4d')]);_0x23dc2a['query']=_[_0x6860('0x52')](_0x53bd92[_0x6860('0x51')]);_0x23dc2a[_0x6860('0x5c')]=_[_0x6860('0x54')](_0x23dc2a['model'],_0x23dc2a[_0x6860('0x51')]);_0x4d13bc[_0x6860('0x53')]=_[_0x6860('0x54')](_0x23dc2a[_0x6860('0x50')],qs[_0x6860('0x55')](_0x53bd92[_0x6860('0x51')]['fields']));_0x4d13bc[_0x6860('0x53')]=_0x4d13bc[_0x6860('0x53')]['length']?_0x4d13bc[_0x6860('0x53')]:_0x23dc2a[_0x6860('0x50')];if(_0x53bd92['query']['includeAll']){_0x4d13bc[_0x6860('0x64')]=[{'all':!![]}];}_0x4d13bc=_['merge']({},_0x4d13bc,_0x53bd92[_0x6860('0x5f')]);return db['MailAccount'][_0x6860('0x65')](_0x4d13bc)[_0x6860('0x13')](handleEntityNotFound(_0x578cf2,null))[_0x6860('0x13')](respondWithResult(_0x578cf2,null))['catch'](handleError(_0x578cf2,null));};exports[_0x6860('0x26')]=function(_0x3a570c,_0x2896e9){if(_0x3a570c[_0x6860('0x66')]['id']){delete _0x3a570c['body']['id'];}var _0x276948=_0x3a570c[_0x6860('0x66')][_0x6860('0x67')]==='custom'?null:_0x3a570c[_0x6860('0x66')][_0x6860('0x67')];var _0x181b56=_0x3a570c[_0x6860('0x66')][_0x6860('0x44')]||{};var _0x2eeb48=_0x3a570c[_0x6860('0x66')][_0x6860('0x45')]||{};if(_0x276948){_0x181b56[_0x6860('0x3f')]=getImapHost(_0x276948);_0x181b56[_0x6860('0x40')]=0x3e1;_0x2eeb48[_0x6860('0x3f')]=getSmtpHost(_0x276948);_0x2eeb48[_0x6860('0x40')]=0x24b;_0x2eeb48['secure']=![];}if(_0x2eeb48['modernAuthentication']){_0x2eeb48['secure']=![];}else{_0x2eeb48[_0x6860('0x3e')]=null;}if(!_0x181b56[_0x6860('0x3d')])_0x181b56[_0x6860('0x3e')]=null;_0x3a570c['body'][_0x6860('0x44')]=_0x181b56;_0x3a570c[_0x6860('0x66')][_0x6860('0x45')]=_0x2eeb48;return db['MailAccount'][_0x6860('0x65')]({'where':{'id':_0x3a570c[_0x6860('0x63')]['id']},'include':[{'model':db[_0x6860('0x47')],'as':_0x6860('0x44')},{'model':db[_0x6860('0x48')],'as':_0x6860('0x45')},{'model':db[_0x6860('0x49')],'as':_0x6860('0x4a')}]})[_0x6860('0x13')](handleEntityNotFound(_0x2896e9,null))[_0x6860('0x13')](function(_0x4473ab){if(!_0x4473ab)throw new Error(_0x6860('0x68'));if(_0x4473ab[_0x6860('0x42')])delete _0x3a570c[_0x6860('0x66')][_0x6860('0x44')];return _0x4473ab;})[_0x6860('0x13')](saveUpdates(_0x3a570c[_0x6860('0x66')],null))['then'](function(_0x35cb99){if(!_0x3a570c['body']['Imap'])return _0x35cb99;return db[_0x6860('0x47')][_0x6860('0x26')](_0x3a570c[_0x6860('0x66')][_0x6860('0x44')],{'where':{'MailAccountId':_0x35cb99['id']}})[_0x6860('0x13')](function(){return _0x35cb99;});})[_0x6860('0x13')](function(_0x2c0bc9){if(!_0x3a570c[_0x6860('0x66')][_0x6860('0x45')])return _0x2c0bc9;return db[_0x6860('0x48')][_0x6860('0x26')](_0x3a570c[_0x6860('0x66')]['Smtp'],{'where':{'MailAccountId':_0x2c0bc9['id']}})[_0x6860('0x13')](function(){return _0x2c0bc9;});})['then'](respondWithResult(_0x2896e9,null))[_0x6860('0x1b')](handleError(_0x2896e9,null));};exports['describe']=function(_0x4a56cd,_0x3df45e){return db[_0x6860('0x4c')][_0x6860('0x69')]()[_0x6860('0x13')](respondWithResult(_0x3df45e,null))[_0x6860('0x1b')](handleError(_0x3df45e,null));};exports[_0x6860('0x6a')]=function(_0x565f2e,_0x3902d2){if(_0x565f2e[_0x6860('0x66')]['id']){delete _0x565f2e[_0x6860('0x66')]['id'];}return db[_0x6860('0x4c')]['find']({'where':{'id':_0x565f2e['params']['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x3902d2,null))[_0x6860('0x13')](function(_0x56f5bb){if(_0x56f5bb){_0x565f2e['body'][_0x6860('0x6b')]=_0x56f5bb['id'];return db[_0x6860('0x6c')]['create'](_0x565f2e['body']);}})['then'](respondWithResult(_0x3902d2,null))[_0x6860('0x1b')](handleError(_0x3902d2,null));};exports[_0x6860('0x6d')]=function(_0x384a32,_0x17e3bc){var _0x320662={'raw':![],'where':{}};var _0x44f724={};var _0x5708da={'count':0x0,'rows':[]};return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x384a32[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x17e3bc,null))['then'](function(_0x4d4d51){if(_0x4d4d51){_0x44f724[_0x6860('0x50')]=_[_0x6860('0x52')](db[_0x6860('0x6c')][_0x6860('0x4d')]);_0x44f724[_0x6860('0x51')]=_['keys'](_0x384a32[_0x6860('0x51')]);_0x44f724[_0x6860('0x5c')]=_['intersection'](_0x44f724[_0x6860('0x50')],_0x44f724[_0x6860('0x51')]);_0x320662[_0x6860('0x53')]=_[_0x6860('0x54')](_0x44f724[_0x6860('0x50')],qs['fields'](_0x384a32[_0x6860('0x51')][_0x6860('0x55')]));_0x320662[_0x6860('0x53')]=_0x320662[_0x6860('0x53')][_0x6860('0x6f')]?_0x320662[_0x6860('0x53')]:_0x44f724['model'];if(!_0x384a32['query']['hasOwnProperty']('nolimit')){_0x320662['limit']=qs[_0x6860('0x21')](_0x384a32[_0x6860('0x51')][_0x6860('0x21')]);_0x320662[_0x6860('0x20')]=qs[_0x6860('0x20')](_0x384a32[_0x6860('0x51')][_0x6860('0x20')]);}_0x320662[_0x6860('0x58')]=qs[_0x6860('0x59')](_0x384a32[_0x6860('0x51')]['sort']);_0x320662[_0x6860('0x5a')]=qs['filters'](_['pick'](_0x384a32[_0x6860('0x51')],_0x44f724[_0x6860('0x5c')]));_0x320662['where']['MailAccountId']=_0x4d4d51['id'];if(_0x384a32[_0x6860('0x51')][_0x6860('0x70')]){_0x320662['where']=_[_0x6860('0x5d')](_0x320662[_0x6860('0x5a')],{'$or':_[_0x6860('0x4b')](_0x320662['attributes'],function(_0x2c446f){var _0x52abb5={};_0x52abb5[_0x2c446f]={'$like':'%'+_0x384a32[_0x6860('0x51')][_0x6860('0x70')]+'%'};return _0x52abb5;})});}_0x320662=_[_0x6860('0x5d')]({},_0x320662,_0x384a32[_0x6860('0x5f')]);return db[_0x6860('0x6c')][_0x6860('0x23')]({'where':_0x320662[_0x6860('0x5a')]})[_0x6860('0x13')](function(_0x25da5e){_0x5708da['count']=_0x25da5e;if(_0x384a32[_0x6860('0x51')][_0x6860('0x60')]){_0x320662[_0x6860('0x64')]=[{'all':!![]}];}return db[_0x6860('0x6c')]['findAll'](_0x320662);})[_0x6860('0x13')](function(_0x3fbaaa){_0x5708da[_0x6860('0x71')]=_0x3fbaaa;return _0x5708da;});}})['then'](respondWithFilteredResult(_0x17e3bc,_0x320662))[_0x6860('0x1b')](handleError(_0x17e3bc,null));};exports[_0x6860('0x72')]=function(_0x48a83d,_0x278b13){return db['MailAccount'][_0x6860('0x65')]({'where':{'id':_0x48a83d['params']['id']}})['then'](handleEntityNotFound(_0x278b13,null))[_0x6860('0x13')](function(_0x207b5e){if(_0x207b5e){return _0x207b5e[_0x6860('0x72')](_0x48a83d[_0x6860('0x51')][_0x6860('0x73')]);}})[_0x6860('0x13')](respondWithStatusCode(_0x278b13,null))[_0x6860('0x1b')](handleError(_0x278b13,null));};exports['addAnswer']=function(_0x24557e,_0x491225){if(_0x24557e[_0x6860('0x66')]['id']){delete _0x24557e[_0x6860('0x66')]['id'];}return db[_0x6860('0x4c')]['find']({'where':{'id':_0x24557e[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x491225,null))[_0x6860('0x13')](function(_0x4c63d1){if(_0x4c63d1){_0x24557e[_0x6860('0x66')]['MailAccountId']=_0x4c63d1['id'];return db[_0x6860('0x74')][_0x6860('0x75')](_0x24557e[_0x6860('0x66')]);}})[_0x6860('0x13')](respondWithResult(_0x491225,null))[_0x6860('0x1b')](handleError(_0x491225,null));};exports[_0x6860('0x76')]=function(_0x1f7cd5,_0x5f5724){var _0x368a7a={'raw':![],'where':{}};var _0x498cb4={};var _0x2ec95e={'count':0x0,'rows':[]};return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x1f7cd5[_0x6860('0x63')]['id']}})['then'](handleEntityNotFound(_0x5f5724,null))[_0x6860('0x13')](function(_0x3022ea){if(_0x3022ea){_0x498cb4['model']=_['keys'](db[_0x6860('0x74')][_0x6860('0x4d')]);_0x498cb4['query']=_[_0x6860('0x52')](_0x1f7cd5[_0x6860('0x51')]);_0x498cb4[_0x6860('0x5c')]=_[_0x6860('0x54')](_0x498cb4[_0x6860('0x50')],_0x498cb4[_0x6860('0x51')]);_0x368a7a['attributes']=_[_0x6860('0x54')](_0x498cb4[_0x6860('0x50')],qs['fields'](_0x1f7cd5[_0x6860('0x51')][_0x6860('0x55')]));_0x368a7a[_0x6860('0x53')]=_0x368a7a[_0x6860('0x53')][_0x6860('0x6f')]?_0x368a7a['attributes']:_0x498cb4['model'];if(!_0x1f7cd5[_0x6860('0x51')][_0x6860('0x56')](_0x6860('0x57'))){_0x368a7a[_0x6860('0x21')]=qs[_0x6860('0x21')](_0x1f7cd5[_0x6860('0x51')][_0x6860('0x21')]);_0x368a7a[_0x6860('0x20')]=qs[_0x6860('0x20')](_0x1f7cd5[_0x6860('0x51')]['offset']);}_0x368a7a['order']=qs['sort'](_0x1f7cd5[_0x6860('0x51')][_0x6860('0x59')]);_0x368a7a[_0x6860('0x5a')]=qs[_0x6860('0x5c')](_[_0x6860('0x5b')](_0x1f7cd5[_0x6860('0x51')],_0x498cb4['filters']));_0x368a7a['where'][_0x6860('0x6b')]=_0x3022ea['id'];if(_0x1f7cd5[_0x6860('0x51')][_0x6860('0x70')]){_0x368a7a[_0x6860('0x5a')]=_[_0x6860('0x5d')](_0x368a7a[_0x6860('0x5a')],{'$or':_[_0x6860('0x4b')](_0x368a7a[_0x6860('0x53')],function(_0x179b6e){var _0x37e05e={};_0x37e05e[_0x179b6e]={'$like':'%'+_0x1f7cd5[_0x6860('0x51')][_0x6860('0x70')]+'%'};return _0x37e05e;})});}_0x368a7a=_[_0x6860('0x5d')]({},_0x368a7a,_0x1f7cd5[_0x6860('0x5f')]);return db['CannedAnswer'][_0x6860('0x23')]({'where':_0x368a7a['where']})[_0x6860('0x13')](function(_0x523952){_0x2ec95e[_0x6860('0x23')]=_0x523952;if(_0x1f7cd5['query']['includeAll']){_0x368a7a[_0x6860('0x64')]=[{'all':!![]}];}return db[_0x6860('0x74')]['findAll'](_0x368a7a);})[_0x6860('0x13')](function(_0xa696fd){_0x2ec95e[_0x6860('0x71')]=_0xa696fd;return _0x2ec95e;});}})['then'](respondWithFilteredResult(_0x5f5724,_0x368a7a))['catch'](handleError(_0x5f5724,null));};exports[_0x6860('0x77')]=function(_0x29a262,_0xa232fd){return db['MailAccount']['find']({'where':{'id':_0x29a262['params']['id']}})['then'](handleEntityNotFound(_0xa232fd,null))[_0x6860('0x13')](function(_0x2693f0){if(_0x2693f0){return _0x2693f0['removeAnswers'](_0x29a262[_0x6860('0x51')]['ids']);}})[_0x6860('0x13')](respondWithStatusCode(_0xa232fd,null))[_0x6860('0x1b')](handleError(_0xa232fd,null));};exports[_0x6860('0x75')]=function(_0x51a106,_0x2e199d){var _0x3e0c55={'name':_0x51a106[_0x6860('0x66')]['name'],'key':_0x51a106[_0x6860('0x66')][_0x6860('0x4f')],'provider':_0x51a106[_0x6860('0x66')][_0x6860('0x67')]===_0x6860('0x78')?null:_0x51a106[_0x6860('0x66')]['provider'],'email':_0x51a106[_0x6860('0x66')][_0x6860('0x79')],'ListId':_0x51a106[_0x6860('0x66')]['ListId'],'active':!_['isNil'](_0x51a106[_0x6860('0x66')][_0x6860('0x7a')])?_0x51a106[_0x6860('0x66')][_0x6860('0x7a')]:!![],'description':_0x51a106[_0x6860('0x66')][_0x6860('0x7b')]||null};var _0x1c2c42=getAuthenticationOptions(_0x3e0c55[_0x6860('0x67')],_0x51a106[_0x6860('0x66')]);_0x3e0c55[_0x6860('0x44')]=_0x1c2c42[_0x6860('0x44')];_0x3e0c55[_0x6860('0x45')]=_0x1c2c42[_0x6860('0x45')];return db[_0x6860('0x4c')][_0x6860('0x75')](_0x3e0c55,{'include':[{'model':db['MailServerOut'],'as':_0x6860('0x45')},{'model':db[_0x6860('0x47')],'as':_0x6860('0x44')}]})['then'](function(_0x134139){var _0x10ef3a=_0x51a106[_0x6860('0x39')][_0x6860('0x28')]({'plain':!![]});if(!_0x10ef3a)throw new Error(_0x6860('0x7c'));if(_0x10ef3a['role']==='user'){var _0x3f4c13=_0x134139[_0x6860('0x28')]({'plain':!![]});return db[_0x6860('0x7d')]['find']({'where':{'name':_0x6860('0x29'),'userProfileId':_0x10ef3a[_0x6860('0x7e')]},'raw':!![]})[_0x6860('0x13')](function(_0x2940ae){if(_0x2940ae&&_0x2940ae[_0x6860('0x7f')]===0x0){return db[_0x6860('0x80')]['create']({'name':_0x3f4c13['name'],'resourceId':_0x3f4c13['id'],'type':_0x2940ae[_0x6860('0x2b')],'sectionId':_0x2940ae['id']},{})[_0x6860('0x13')](function(){return _0x134139;});}else{return _0x134139;}})[_0x6860('0x1b')](function(_0x5a878e){logger[_0x6860('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a878e);throw _0x5a878e;});}return _0x134139;})[_0x6860('0x13')](respondWithResult(_0x2e199d,0xc9))[_0x6860('0x1b')](handleError(_0x2e199d,null));};exports['getImap']=function(_0x242386,_0x485dd9){return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x242386['params']['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x485dd9,null))[_0x6860('0x13')](function(_0x26f09d){if(_0x26f09d){return _0x26f09d[_0x6860('0x81')]();}return null;})[_0x6860('0x13')](respondWithResult(_0x485dd9,null))[_0x6860('0x1b')](handleError(_0x485dd9,null));};exports['addImap']=function(_0x223d6e,_0x1c8488){if(_0x223d6e[_0x6860('0x66')]['id']){delete _0x223d6e[_0x6860('0x66')]['id'];}return db['MailAccount'][_0x6860('0x65')]({'where':{'id':_0x223d6e[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x1c8488,null))[_0x6860('0x13')](function(_0x5725c9){if(_0x5725c9){_0x223d6e[_0x6860('0x66')][_0x6860('0x6b')]=_0x5725c9['id'];return db['MailServerIn'][_0x6860('0x75')](_0x223d6e[_0x6860('0x66')]);}})[_0x6860('0x13')](respondWithResult(_0x1c8488,null))[_0x6860('0x1b')](handleError(_0x1c8488,null));};exports['removeImap']=function(_0x19ebd2,_0x327a15){return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x19ebd2[_0x6860('0x63')]['id']}})['then'](handleEntityNotFound(_0x327a15,null))[_0x6860('0x13')](function(_0x6248ad){if(_0x6248ad){return _0x6248ad[_0x6860('0x82')](null);}return null;})[_0x6860('0x13')](respondWithStatusCode(_0x327a15,null))[_0x6860('0x1b')](handleError(_0x327a15,null));};exports[_0x6860('0x83')]=function(_0x40adac,_0x37adc1){return db['MailAccount'][_0x6860('0x6e')]({'where':{'id':_0x40adac[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x37adc1,null))[_0x6860('0x13')](function(_0x18ff7e){if(_0x18ff7e){return _0x18ff7e[_0x6860('0x83')]();}return null;})[_0x6860('0x13')](respondWithResult(_0x37adc1,null))[_0x6860('0x1b')](handleError(_0x37adc1,null));};exports[_0x6860('0x84')]=function(_0x32f958,_0x18947b){if(_0x32f958[_0x6860('0x66')]['id']){delete _0x32f958[_0x6860('0x66')]['id'];}return db[_0x6860('0x4c')][_0x6860('0x65')]({'where':{'id':_0x32f958[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x18947b,null))['then'](function(_0x252012){if(_0x252012){_0x32f958[_0x6860('0x66')][_0x6860('0x6b')]=_0x252012['id'];return db[_0x6860('0x48')]['create'](_0x32f958[_0x6860('0x66')]);}})[_0x6860('0x13')](respondWithResult(_0x18947b,null))[_0x6860('0x1b')](handleError(_0x18947b,null));};exports[_0x6860('0x85')]=function(_0x527711,_0x4cc73f){return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x527711[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x4cc73f,null))[_0x6860('0x13')](function(_0xb6c9b8){if(_0xb6c9b8){return _0xb6c9b8[_0x6860('0x86')](null);}return null;})[_0x6860('0x13')](respondWithStatusCode(_0x4cc73f,null))[_0x6860('0x1b')](handleError(_0x4cc73f,null));};exports[_0x6860('0x87')]=function(_0x545f70,_0x3850a0){return db[_0x6860('0x88')]['find']({'where':{'id':_0x545f70['params']['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x3850a0,null))[_0x6860('0x13')](function(_0x2ad0a5){if(_0x2ad0a5){return _0x2ad0a5['addInteraction'](_0x545f70[_0x6860('0x66')][_0x6860('0x73')],_[_0x6860('0x89')](_0x545f70[_0x6860('0x66')],[_0x6860('0x73'),'id'])||{});}})['then'](respondWithResult(_0x3850a0,null))[_0x6860('0x1b')](handleError(_0x3850a0,null));};exports[_0x6860('0x8a')]=function(_0x1555eb,_0x20fc62){var _0x21745d={'raw':![],'where':{}};var _0x3f1671={};var _0x1d2d37={'count':0x0,'rows':[]};return db[_0x6860('0x4c')]['findOne']({'where':{'id':_0x1555eb[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x20fc62,null))[_0x6860('0x13')](function(_0x14aab4){if(_0x14aab4){_0x3f1671[_0x6860('0x50')]=_['keys'](db[_0x6860('0x88')][_0x6860('0x4d')]);_0x3f1671[_0x6860('0x51')]=_[_0x6860('0x52')](_0x1555eb[_0x6860('0x51')]);_0x3f1671['filters']=_['intersection'](_0x3f1671[_0x6860('0x50')],_0x3f1671[_0x6860('0x51')]);_0x21745d[_0x6860('0x53')]=_[_0x6860('0x54')](_0x3f1671['model'],qs[_0x6860('0x55')](_0x1555eb['query'][_0x6860('0x55')]));_0x21745d['attributes']=_0x21745d[_0x6860('0x53')]['length']?_0x21745d[_0x6860('0x53')]:_0x3f1671['model'];if(!_0x1555eb[_0x6860('0x51')][_0x6860('0x56')]('nolimit')){_0x21745d[_0x6860('0x21')]=qs[_0x6860('0x21')](_0x1555eb['query'][_0x6860('0x21')]);_0x21745d[_0x6860('0x20')]=qs[_0x6860('0x20')](_0x1555eb[_0x6860('0x51')][_0x6860('0x20')]);}_0x21745d[_0x6860('0x58')]=qs[_0x6860('0x59')](_0x1555eb['query'][_0x6860('0x59')]);_0x21745d['where']=qs[_0x6860('0x5c')](_[_0x6860('0x5b')](_0x1555eb[_0x6860('0x51')],_0x3f1671[_0x6860('0x5c')]));_0x21745d[_0x6860('0x5a')][_0x6860('0x6b')]=_0x14aab4['id'];if(_0x1555eb[_0x6860('0x51')][_0x6860('0x70')]){_0x21745d[_0x6860('0x5a')]=_[_0x6860('0x5d')](_0x21745d[_0x6860('0x5a')],{'$or':_[_0x6860('0x4b')](_0x21745d['attributes'],function(_0x19a284){var _0x11169a={};_0x11169a[_0x19a284]={'$like':'%'+_0x1555eb['query'][_0x6860('0x70')]+'%'};return _0x11169a;})});}_0x21745d=_['merge']({},_0x21745d,_0x1555eb['options']);return db['MailInteraction'][_0x6860('0x23')]({'where':_0x21745d[_0x6860('0x5a')]})[_0x6860('0x13')](function(_0x549da9){_0x1d2d37['count']=_0x549da9;if(_0x1555eb[_0x6860('0x51')][_0x6860('0x60')]){_0x21745d['include']=[{'model':db[_0x6860('0x8b')],'as':_0x6860('0x8c'),'required':![]},{'model':db[_0x6860('0x8d')],'as':_0x6860('0x8e'),'attributes':[_0x6860('0x2b'),'fullname',_0x6860('0x8f')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x6860('0x2b'),_0x6860('0x90')],'where':_0x1555eb[_0x6860('0x51')]['tag']?{'id':_0x1555eb[_0x6860('0x51')][_0x6860('0x91')]}:undefined,'required':_0x1555eb[_0x6860('0x51')][_0x6860('0x91')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x21745d);})['then'](function(_0x699c03){_0x1d2d37[_0x6860('0x71')]=_0x699c03;return _0x1d2d37;});}})[_0x6860('0x13')](respondWithFilteredResult(_0x20fc62,_0x21745d))[_0x6860('0x1b')](handleError(_0x20fc62,null));};exports[_0x6860('0x92')]=function addApplications(_0x2dec0c,_0x50b51f){var _0x3c0b07=_0x2dec0c[_0x6860('0x63')]['id'];var _0x488640=_0x2dec0c[_0x6860('0x66')];var _0x2204e4=0xc8;var _0x5bd97e=null;return db[_0x6860('0x93')]['transaction']({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x6860('0x94')]},function(_0x4ec1e4){return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x3c0b07},'transaction':_0x4ec1e4})['then'](function(_0x2b4d89){if(_0x2b4d89){return db['MailApplication'][_0x6860('0x27')]({'where':{'MailAccountId':_0x3c0b07},'transaction':_0x4ec1e4})[_0x6860('0x13')](function(){var _0x118a65=_[_0x6860('0x4b')](_0x488640,function(_0x4f24a2){_0x4f24a2[_0x6860('0x6b')]=_0x3c0b07;return _0x4f24a2;});return db['MailApplication']['bulkCreate'](_0x118a65,{'transaction':_0x4ec1e4});});}else{_0x2204e4=0x194;_0x5bd97e=[];}});})[_0x6860('0x13')](function(){if(_0x2204e4!==0x194){return db[_0x6860('0x95')][_0x6860('0x96')]({'where':{'MailAccountId':_0x3c0b07},'order':_0x6860('0x97')})[_0x6860('0x13')](function(_0x177ea9){_0x5bd97e=_0x177ea9;});}})[_0x6860('0x1b')](function(_0x1a5cc1){_0x2204e4=0x1f4;logger['error'](_0x1a5cc1['stack']);if(_0x1a5cc1[_0x6860('0x2b')]){delete _0x1a5cc1[_0x6860('0x2b')];}_0x5bd97e=_0x1a5cc1;})[_0x6860('0x98')](function(){if(_0x5bd97e===null){_0x50b51f[_0x6860('0x1c')](_0x2204e4);}else{if(_0x2204e4===0x1f4){_0x50b51f[_0x6860('0x1d')](_0x2204e4)['send'](_0x5bd97e);}else{_0x50b51f[_0x6860('0x1d')](_0x2204e4)['json'](_0x5bd97e);}}});};exports[_0x6860('0x99')]=function(_0x17e3b4,_0x45d7c7){var _0x4b9895={};var _0x16a394={};var _0x29e204;var _0x1e300d;return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x17e3b4[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x45d7c7,null))[_0x6860('0x13')](function(_0x3b7622){if(_0x3b7622){_0x29e204=_0x3b7622;_0x16a394[_0x6860('0x50')]=_[_0x6860('0x52')](db[_0x6860('0x95')]['rawAttributes']);_0x16a394[_0x6860('0x51')]=_[_0x6860('0x52')](_0x17e3b4[_0x6860('0x51')]);_0x16a394[_0x6860('0x5c')]=_[_0x6860('0x54')](_0x16a394[_0x6860('0x50')],_0x16a394[_0x6860('0x51')]);_0x4b9895[_0x6860('0x53')]=_[_0x6860('0x54')](_0x16a394[_0x6860('0x50')],qs[_0x6860('0x55')](_0x17e3b4['query'][_0x6860('0x55')]));_0x4b9895['attributes']=_0x4b9895[_0x6860('0x53')][_0x6860('0x6f')]?_0x4b9895['attributes']:_0x16a394[_0x6860('0x50')];_0x4b9895[_0x6860('0x58')]=qs[_0x6860('0x59')](_0x17e3b4[_0x6860('0x51')][_0x6860('0x59')]);_0x4b9895['where']=qs['filters'](_[_0x6860('0x5b')](_0x17e3b4[_0x6860('0x51')],_0x16a394[_0x6860('0x5c')]));if(_0x17e3b4[_0x6860('0x51')][_0x6860('0x70')]){_0x4b9895[_0x6860('0x5a')]=_['merge'](_0x4b9895[_0x6860('0x5a')],{'$or':_[_0x6860('0x4b')](_0x4b9895[_0x6860('0x53')],function(_0x241104){var _0x55f563={};_0x55f563[_0x241104]={'$like':'%'+_0x17e3b4[_0x6860('0x51')][_0x6860('0x70')]+'%'};return _0x55f563;})});}_0x4b9895=_[_0x6860('0x5d')]({},_0x4b9895,_0x17e3b4[_0x6860('0x5f')]);return _0x29e204[_0x6860('0x99')](_0x4b9895);}})[_0x6860('0x13')](function(_0x545f91){if(_0x545f91){_0x1e300d=_0x545f91[_0x6860('0x6f')];if(!_0x17e3b4['query'][_0x6860('0x56')](_0x6860('0x57'))){_0x4b9895[_0x6860('0x21')]=qs[_0x6860('0x21')](_0x17e3b4['query'][_0x6860('0x21')]);_0x4b9895[_0x6860('0x20')]=qs[_0x6860('0x20')](_0x17e3b4[_0x6860('0x51')][_0x6860('0x20')]);}return _0x29e204[_0x6860('0x99')](_0x4b9895);}})[_0x6860('0x13')](function(_0x208bcb){if(_0x208bcb){return _0x208bcb?{'count':_0x1e300d,'rows':_0x208bcb}:null;}})[_0x6860('0x13')](respondWithResult(_0x45d7c7,null))[_0x6860('0x1b')](handleError(_0x45d7c7,null));};exports['getMessages']=function(_0x2e6146,_0x2bfea3){var _0xcfdcdc={'raw':!![],'where':{}};var _0x47021e={};var _0x342784={'count':0x0,'rows':[]};return db[_0x6860('0x4c')][_0x6860('0x6e')]({'where':{'id':_0x2e6146['params']['id']}})['then'](handleEntityNotFound(_0x2bfea3,null))[_0x6860('0x13')](function(_0x400245){if(_0x400245){_0x47021e[_0x6860('0x50')]=_[_0x6860('0x52')](db[_0x6860('0x9a')][_0x6860('0x4d')]);_0x47021e[_0x6860('0x51')]=_['keys'](_0x2e6146[_0x6860('0x51')]);_0x47021e[_0x6860('0x5c')]=_[_0x6860('0x54')](_0x47021e[_0x6860('0x50')],_0x47021e[_0x6860('0x51')]);_0xcfdcdc[_0x6860('0x53')]=_[_0x6860('0x54')](_0x47021e[_0x6860('0x50')],qs['fields'](_0x2e6146[_0x6860('0x51')][_0x6860('0x55')]));_0xcfdcdc[_0x6860('0x53')]=_0xcfdcdc[_0x6860('0x53')][_0x6860('0x6f')]?_0xcfdcdc['attributes']:_0x47021e[_0x6860('0x50')];if(!_0x2e6146[_0x6860('0x51')][_0x6860('0x56')](_0x6860('0x57'))){_0xcfdcdc[_0x6860('0x21')]=qs['limit'](_0x2e6146['query'][_0x6860('0x21')]);_0xcfdcdc[_0x6860('0x20')]=qs[_0x6860('0x20')](_0x2e6146['query'][_0x6860('0x20')]);}_0xcfdcdc[_0x6860('0x58')]=qs['sort'](_0x2e6146[_0x6860('0x51')]['sort']);_0xcfdcdc['where']=qs['filters'](_[_0x6860('0x5b')](_0x2e6146[_0x6860('0x51')],_0x47021e[_0x6860('0x5c')]));_0xcfdcdc[_0x6860('0x5a')][_0x6860('0x6b')]=_0x400245['id'];if(_0x2e6146[_0x6860('0x51')][_0x6860('0x70')]){_0xcfdcdc[_0x6860('0x5a')]=_[_0x6860('0x5d')](_0xcfdcdc[_0x6860('0x5a')],{'$or':_[_0x6860('0x4b')](_0xcfdcdc[_0x6860('0x53')],function(_0x3af513){var _0x5ab899={};_0x5ab899[_0x3af513]={'$like':'%'+_0x2e6146[_0x6860('0x51')][_0x6860('0x70')]+'%'};return _0x5ab899;})});}if(_0x2e6146['query']['$gte']){var _0x23d994=_0x2e6146[_0x6860('0x51')]['$gte']['split'](',');var _0x14237d={};_0x14237d[_0x23d994[0x0]]={'$gte':moment(_0x23d994[0x1])['format'](_0x6860('0x9b'))};_0xcfdcdc[_0x6860('0x5a')]=_['merge'](_0xcfdcdc[_0x6860('0x5a')],_0x14237d);}_0xcfdcdc=_['merge']({},_0xcfdcdc,_0x2e6146['options']);return db[_0x6860('0x9a')]['count']({'where':_0xcfdcdc[_0x6860('0x5a')]})[_0x6860('0x13')](function(_0x355925){_0x342784['count']=_0x355925;if(_0x2e6146[_0x6860('0x51')][_0x6860('0x60')]){_0xcfdcdc[_0x6860('0x64')]=[{'all':!![]}];}return db[_0x6860('0x9a')][_0x6860('0x61')](_0xcfdcdc);})[_0x6860('0x13')](function(_0x537c1a){if(_0x2e6146[_0x6860('0x51')][_0x6860('0x9c')]===_0x6860('0x9d')){for(var _0x10e71e=0x0;_0x10e71e<_0x537c1a['length'];_0x10e71e++){_0x537c1a[_0x10e71e][_0x6860('0x66')]=juice(_0x537c1a[_0x10e71e][_0x6860('0x66')]);}}_0x342784[_0x6860('0x71')]=_0x537c1a;return _0x342784;});}})[_0x6860('0x13')](respondWithFilteredResult(_0x2bfea3,_0xcfdcdc))[_0x6860('0x1b')](handleError(_0x2bfea3,null));};exports[_0x6860('0x2c')]=function(_0x1ced2f,_0x3cadc8){var _0x3b74a4,_0x54e354={},_0x281217;if(_0x1ced2f[_0x6860('0x66')]['to']){_0x281217=_0x1ced2f[_0x6860('0x66')]['to'][_0x6860('0x9e')](',')[0x0];}return db[_0x6860('0x4c')][_0x6860('0x65')]({'where':{'id':_0x1ced2f[_0x6860('0x63')]['id']},'include':[{'model':db[_0x6860('0x9f')],'as':_0x6860('0xa0'),'include':[{'model':db[_0x6860('0x8b')],'as':_0x6860('0xa1'),'where':{'email':_0x281217},'limit':0x1,'order':[[_0x6860('0xa2'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x6860('0x45'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x6860('0x13')](handleEntityNotFound(_0x3cadc8,null))[_0x6860('0x13')](function(_0x285bb0){if(!_0x285bb0)return;_0x3b74a4=_0x285bb0;if(!_0x285bb0['Smtp'])throw new Error(_0x6860('0xa3'));if(_[_0x6860('0xa4')](_0x1ced2f[_0x6860('0x66')]['from'])){_0x1ced2f[_0x6860('0x66')][_0x6860('0xa5')]=util[_0x6860('0xa6')](_0x6860('0xa7'),_0x285bb0[_0x6860('0x2b')],_0x285bb0[_0x6860('0x79')]||_0x285bb0['Smtp']['user']);}if(_0x1ced2f[_0x6860('0x66')][_0x6860('0xa8')]&&_0x1ced2f[_0x6860('0x66')][_0x6860('0xa8')]['length']){for(var _0x3dfd49=0x0;_0x3dfd49<_0x1ced2f[_0x6860('0x66')][_0x6860('0xa8')]['length'];_0x3dfd49+=0x1){_0x1ced2f[_0x6860('0x66')][_0x6860('0xa8')][_0x3dfd49]={'filename':_0x1ced2f[_0x6860('0x66')]['attachments'][_0x3dfd49][_0x6860('0x2b')],'path':path[_0x6860('0xa9')](config['root'],_0x6860('0xaa'),_0x1ced2f[_0x6860('0x66')][_0x6860('0xa8')][_0x3dfd49][_0x6860('0xab')])};}}var _0x16e19d=_0x285bb0['getSmtpOptions']();return respondWithRpcPromise(_0x6860('0xac'),_0x6860('0xad'),{'account':_0x16e19d,'message':_0x1ced2f[_0x6860('0x66')]});})[_0x6860('0x13')](function(_0x50bb63){if(!_0x50bb63)return;_0x54e354=_0x50bb63;if(!_0x3b74a4[_0x6860('0xa0')])throw new Error(_0x6860('0xae'));if(_0x3b74a4[_0x6860('0xa0')]['Contacts'][_0x6860('0x6f')])return _0x3b74a4[_0x6860('0xa0')][_0x6860('0xa1')][0x0];return db[_0x6860('0x8b')][_0x6860('0x75')](_[_0x6860('0xb')](_0x1ced2f[_0x6860('0x66')],{'firstName':_0x1ced2f[_0x6860('0x66')]['to'],'email':_0x1ced2f[_0x6860('0x66')]['to'],'phone':_0x1ced2f[_0x6860('0x66')]['to'],'ListId':_0x3b74a4[_0x6860('0xaf')]}));})[_0x6860('0x13')](function(_0x3b65dd){if(!_0x3b65dd)return;var _0xa960dc={'UserId':_0x1ced2f[_0x6860('0x39')]['id'],'ContactId':_0x3b65dd['id'],'MailAccountId':_0x3b74a4['id'],'inReplyTo':_0x54e354['messageId'],'to':_0x1ced2f[_0x6860('0x66')][_0x6860('0xa5')],'cc':_0x1ced2f[_0x6860('0x66')]['cc'],'subject':_0x1ced2f[_0x6860('0x66')][_0x6860('0xb0')],'attach':_0x1ced2f[_0x6860('0x66')][_0x6860('0xb1')],'firstMsgDirection':_0x6860('0xb2'),'lastMsgAt':moment()[_0x6860('0xa6')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x6860('0x5d')](_0x1ced2f[_0x6860('0x66')],{'messageId':_0x54e354[_0x6860('0xb3')],'sentAt':moment()[_0x6860('0xa6')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3b74a4['id'],'UserId':_0x1ced2f[_0x6860('0x39')]['id'],'ContactId':_0x3b65dd['id']})]};if(_0x1ced2f[_0x6860('0x66')][_0x6860('0xb4')]){_0xa960dc=_[_0x6860('0x5d')](_0xa960dc,_0x1ced2f['body'][_0x6860('0xb4')]);}return db[_0x6860('0x88')][_0x6860('0x75')](_0xa960dc,{'include':[{'model':db[_0x6860('0x9a')],'as':_0x6860('0xb5')}]});})[_0x6860('0x13')](respondWithResult(_0x3cadc8,null))['catch'](handleError(_0x3cadc8,null));};exports['verifySmtp']=function(_0x5cbcea,_0x5efaa8){return db[_0x6860('0x4c')][_0x6860('0x65')]({'where':{'id':_0x5cbcea[_0x6860('0x63')]['id']},'include':[{'model':db[_0x6860('0x48')],'as':_0x6860('0x45'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x6860('0x13')](handleEntityNotFound(_0x5efaa8,null))[_0x6860('0x13')](function(_0x444f67){if(!_0x444f67['Smtp'])return;var _0x21c4f8=_0x444f67[_0x6860('0xb6')]();return respondWithRpcPromise(_0x6860('0xb7'),'verifySmtp',{'account':_0x21c4f8});})[_0x6860('0x13')](respondWithResult(_0x5efaa8,null))['catch'](handleError(_0x5efaa8,null));};exports['destroy']=function(_0x28fbb7,_0xa59cec){return db['MailAccount'][_0x6860('0x65')]({'where':{'id':_0x28fbb7[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0xa59cec,null))[_0x6860('0x13')](function(_0x5c5e16){if(_0x5c5e16&&_0x5c5e16[_0x6860('0x42')]){throw new db['Sequelize'][(_0x6860('0xb8'))](_0x6860('0xb9'));}return _0x5c5e16;})[_0x6860('0x13')](removeEntity(_0xa59cec,null))[_0x6860('0x1b')](handleError(_0xa59cec,null));};exports[_0x6860('0xba')]=function(_0x34eb75,_0x316b32){return db['MailAccount'][_0x6860('0x65')]({'where':{'id':_0x34eb75['params']['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x316b32,null))[_0x6860('0x13')](function(_0x5946f3){if(_0x5946f3){return _0x5946f3[_0x6860('0xba')](_0x34eb75[_0x6860('0x66')][_0x6860('0x73')],_[_0x6860('0x89')](_0x34eb75['body'],['ids','id'])||{})[_0x6860('0xbb')](function(_0x2d0064){for(var _0x839903=0x0;_0x839903<_0x34eb75[_0x6860('0x66')][_0x6860('0x73')][_0x6860('0x6f')];_0x839903+=0x1){socket[_0x6860('0xbc')](_0x6860('0xbd'),{'UserId':Number(_0x34eb75[_0x6860('0x66')][_0x6860('0x73')][_0x839903]),'MailAccountId':Number(_0x34eb75[_0x6860('0x63')]['id'])});}return _0x2d0064;});}})[_0x6860('0x13')](respondWithResult(_0x316b32,null))['catch'](handleError(_0x316b32,null));};exports[_0x6860('0xbe')]=function(_0x303aa2,_0x1262ea){return db[_0x6860('0x4c')][_0x6860('0x65')]({'where':{'id':_0x303aa2[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x1262ea,null))[_0x6860('0x13')](function(_0x65e066){if(_0x65e066){return _0x65e066[_0x6860('0xbe')](_0x303aa2[_0x6860('0x51')][_0x6860('0x73')])[_0x6860('0x13')](function(){if(_[_0x6860('0xbf')](_0x303aa2[_0x6860('0x51')][_0x6860('0x73')])){for(var _0x413769=0x0;_0x413769<_0x303aa2['query'][_0x6860('0x73')][_0x6860('0x6f')];_0x413769+=0x1){socket[_0x6860('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x303aa2[_0x6860('0x51')][_0x6860('0x73')][_0x413769]),'MailAccountId':Number(_0x303aa2['params']['id'])});}}else{socket[_0x6860('0xbc')](_0x6860('0xc0'),{'UserId':Number(_0x303aa2['query'][_0x6860('0x73')]),'MailAccountId':Number(_0x303aa2[_0x6860('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x1262ea,null))['catch'](handleError(_0x1262ea,null));};exports[_0x6860('0xc1')]=function(_0x2163b5,_0x4feffa){var _0x362f47={};var _0x8a3acd={};var _0x2c9802;var _0x458892;return db['MailAccount']['findOne']({'where':{'id':_0x2163b5[_0x6860('0x63')]['id']}})[_0x6860('0x13')](handleEntityNotFound(_0x4feffa,null))[_0x6860('0x13')](function(_0xa06eaa){if(_0xa06eaa){_0x2c9802=_0xa06eaa;_0x8a3acd[_0x6860('0x50')]=_['keys'](db[_0x6860('0x8d')][_0x6860('0x4d')]);_0x8a3acd['query']=_['keys'](_0x2163b5['query']);_0x8a3acd[_0x6860('0x5c')]=_[_0x6860('0x54')](_0x8a3acd[_0x6860('0x50')],_0x8a3acd['query']);_0x362f47['attributes']=_[_0x6860('0x54')](_0x8a3acd[_0x6860('0x50')],qs['fields'](_0x2163b5['query'][_0x6860('0x55')]));_0x362f47[_0x6860('0x53')]=_0x362f47[_0x6860('0x53')][_0x6860('0x6f')]?_0x362f47[_0x6860('0x53')]:_0x8a3acd[_0x6860('0x50')];_0x362f47[_0x6860('0x58')]=qs[_0x6860('0x59')](_0x2163b5[_0x6860('0x51')][_0x6860('0x59')]);_0x362f47[_0x6860('0x5a')]=qs[_0x6860('0x5c')](_[_0x6860('0x5b')](_0x2163b5['query'],_0x8a3acd[_0x6860('0x5c')]));if(_0x2163b5[_0x6860('0x51')][_0x6860('0x70')]){_0x362f47['where']=_[_0x6860('0x5d')](_0x362f47[_0x6860('0x5a')],{'$or':_[_0x6860('0x4b')](_0x362f47[_0x6860('0x53')],function(_0x503303){var _0x47c150={};_0x47c150[_0x503303]={'$like':'%'+_0x2163b5[_0x6860('0x51')]['filter']+'%'};return _0x47c150;})});}_0x362f47=_[_0x6860('0x5d')]({},_0x362f47,_0x2163b5[_0x6860('0x5f')]);return _0x2c9802[_0x6860('0xc1')](_0x362f47);}})[_0x6860('0x13')](function(_0x46f9a2){if(_0x46f9a2){_0x458892=_0x46f9a2['length'];if(!_0x2163b5['query'][_0x6860('0x56')](_0x6860('0x57'))){_0x362f47['limit']=qs[_0x6860('0x21')](_0x2163b5[_0x6860('0x51')][_0x6860('0x21')]);_0x362f47[_0x6860('0x20')]=qs[_0x6860('0x20')](_0x2163b5[_0x6860('0x51')]['offset']);}return _0x2c9802[_0x6860('0xc1')](_0x362f47);}})[_0x6860('0x13')](function(_0x1de938){if(_0x1de938){return _0x1de938?{'count':_0x458892,'rows':_0x1de938}:null;}})[_0x6860('0x13')](respondWithResult(_0x4feffa,null))[_0x6860('0x1b')](handleError(_0x4feffa,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index e22c0e8..daeef4b 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 _0xe08b=['events','MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xe08b,0x10e));var _0xbe08=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xe08b[_0x484e36];return _0xafc85d;};'use strict';var EventEmitter=require(_0xbe08('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xbe08('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xbe08('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbe08('0x3'),'afterDestroy':_0xbe08('0x4')};function emitEvent(_0x27b8f8){return function(_0x469522,_0x41edfb,_0x1ba7e6){MailAccountEvents[_0xbe08('0x5')](_0x27b8f8+':'+_0x469522['id'],_0x469522);MailAccountEvents[_0xbe08('0x5')](_0x27b8f8,_0x469522);_0x1ba7e6(null);};}for(var e in events){if(events[_0xbe08('0x6')](e)){var event=events[e];MailAccount[_0xbe08('0x7')](e,emitEvent(event));}}module[_0xbe08('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x9a18=['exports','events','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x9a18,0x187));var _0x89a1=function(_0x528fbc,_0x5261de){_0x528fbc=_0x528fbc-0x0;var _0xe5ddd1=_0x9a18[_0x528fbc];return _0xe5ddd1;};'use strict';var EventEmitter=require(_0x89a1('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x89a1('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x89a1('0x2')](0x0);var events={'afterCreate':_0x89a1('0x3'),'afterUpdate':_0x89a1('0x4'),'afterDestroy':_0x89a1('0x5')};function emitEvent(_0x48a67a){return function(_0x33e91b,_0x2b7678,_0x287f38){MailAccountEvents[_0x89a1('0x6')](_0x48a67a+':'+_0x33e91b['id'],_0x33e91b);MailAccountEvents[_0x89a1('0x6')](_0x48a67a,_0x33e91b);_0x287f38(null);};}for(var e in events){if(events[_0x89a1('0x7')](e)){var event=events[e];MailAccount[_0x89a1('0x8')](e,emitEvent(event));}}module[_0x89a1('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 29e685d..fb4d6ee 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 _0x8cea=['Cloud\x20Provider\x20configuration\x20not\x20found','user','auth','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider'];(function(_0x2d8dd1,_0x3ab91d){var _0x2466b2=function(_0x5cbb31){while(--_0x5cbb31){_0x2d8dd1['push'](_0x2d8dd1['shift']());}};_0x2466b2(++_0x3ab91d);}(_0x8cea,0xaf));var _0xa8ce=function(_0xb24fad,_0xd58756){_0xb24fad=_0xb24fad-0x0;var _0x173226=_0x8cea[_0xb24fad];return _0x173226;};'use strict';var attributes=require(_0xa8ce('0x0'));module[_0xa8ce('0x1')]=function(_0x3544b7){return _0x3544b7[_0xa8ce('0x2')](_0xa8ce('0x3'),attributes,{'tableName':_0xa8ce('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xe2f289=this;var _0x2c5ee5={'id':_0xe2f289['id'],'tls':{'rejectUnauthorized':![]}};if(_0xe2f289[_0xa8ce('0x5')]!==_0xa8ce('0x6')){_0x2c5ee5[_0xa8ce('0x7')]=_0xe2f289[_0xa8ce('0x5')];}else{_0x2c5ee5['host']=_0xe2f289[_0xa8ce('0x8')][_0xa8ce('0x9')];_0x2c5ee5['port']=_0xe2f289[_0xa8ce('0x8')][_0xa8ce('0xa')];_0x2c5ee5['secure']=_0xe2f289[_0xa8ce('0x8')][_0xa8ce('0xb')];}if(_0xe2f289[_0xa8ce('0x8')][_0xa8ce('0xc')]){if(_0xe2f289[_0xa8ce('0x8')][_0xa8ce('0xd')]){if(!_0xe2f289[_0xa8ce('0x8')][_0xa8ce('0xe')])throw new Error(_0xa8ce('0xf'));_0x2c5ee5['auth']={'type':'OAuth2','user':_0xe2f289[_0xa8ce('0x8')][_0xa8ce('0x10')],'accessToken':_0xe2f289[_0xa8ce('0x8')][_0xa8ce('0xe')]['data5']};}else{_0x2c5ee5[_0xa8ce('0x11')]={'user':_0xe2f289[_0xa8ce('0x8')][_0xa8ce('0x10')],'pass':_0xe2f289[_0xa8ce('0x8')][_0xa8ce('0x12')]};}}return _0x2c5ee5;}}});}; \ No newline at end of file +var _0xc7e6=['exports','mail_accounts','provider','custom','Smtp','host','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','pass','./mailAccount.attributes'];(function(_0x11a69f,_0x1aeee9){var _0x2e8af4=function(_0x27e9d0){while(--_0x27e9d0){_0x11a69f['push'](_0x11a69f['shift']());}};_0x2e8af4(++_0x1aeee9);}(_0xc7e6,0x1a3));var _0x6c7e=function(_0x4ede04,_0x58132b){_0x4ede04=_0x4ede04-0x0;var _0x49ccfc=_0xc7e6[_0x4ede04];return _0x49ccfc;};'use strict';var attributes=require(_0x6c7e('0x0'));module[_0x6c7e('0x1')]=function(_0x31dfe6){return _0x31dfe6['define']('MailAccount',attributes,{'tableName':_0x6c7e('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x314a23=this;var _0x2d38d5={'id':_0x314a23['id'],'tls':{'rejectUnauthorized':![]}};if(_0x314a23[_0x6c7e('0x3')]!==_0x6c7e('0x4')){_0x2d38d5['service']=_0x314a23['provider'];}else{_0x2d38d5['host']=_0x314a23[_0x6c7e('0x5')][_0x6c7e('0x6')];_0x2d38d5['port']=_0x314a23[_0x6c7e('0x5')]['port'];_0x2d38d5['secure']=_0x314a23[_0x6c7e('0x5')][_0x6c7e('0x7')];}if(_0x314a23[_0x6c7e('0x5')][_0x6c7e('0x8')]){if(_0x314a23[_0x6c7e('0x5')][_0x6c7e('0x9')]){if(!_0x314a23[_0x6c7e('0x5')]['CloudProvider'])throw new Error(_0x6c7e('0xa'));_0x2d38d5[_0x6c7e('0xb')]={'type':'OAuth2','user':_0x314a23['Smtp'][_0x6c7e('0xc')],'accessToken':_0x314a23[_0x6c7e('0x5')]['CloudProvider'][_0x6c7e('0xd')]};}else{_0x2d38d5['auth']={'user':_0x314a23[_0x6c7e('0x5')]['user'],'pass':_0x314a23[_0x6c7e('0x5')][_0x6c7e('0xe')]};}}return _0x2d38d5;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 7ff2912..2c2495a 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 _0x5a5a=['ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','waitForTheAssignedQueue','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowMailAccount','find','smtp','smtpOptions','NotifyMailAccount','body','mail','keys','rawAttributes','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','CloudProvider','account','omit','applications','list','priority','asc','autoclose','push','length','close','*,*,*,*','create','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','get','created','attachments','originTo','bcc'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x5c9499,_0x221b1){_0x5c9499=_0x5c9499-0x0;var _0x1370d4=_0x5a5a[_0x5c9499];return _0x1370d4;};'use strict';var _=require('lodash');var moment=require(_0xa5a5('0x0'));var BPromise=require(_0xa5a5('0x1'));var rs=require(_0xa5a5('0x2'));var Redis=require(_0xa5a5('0x3'));var db=require(_0xa5a5('0x4'))['db'];var logger=require('../../config/logger')(_0xa5a5('0x5'));var config=require(_0xa5a5('0x6'));var jayson=require(_0xa5a5('0x7'));var client=jayson['client']['http']({'port':0x232c});config[_0xa5a5('0x8')]=_[_0xa5a5('0x9')](config['redis'],{'host':_0xa5a5('0xa'),'port':0x18eb});var socket=require(_0xa5a5('0xb'))(new Redis(config[_0xa5a5('0x8')]));require(_0xa5a5('0xc'))[_0xa5a5('0xd')](socket);function respondWithRpcPromise(_0x5b593d,_0x158a80,_0x15ab15){return new BPromise(function(_0x18f261,_0x2dace1){return client[_0xa5a5('0xe')](_0x5b593d,_0x15ab15)[_0xa5a5('0xf')](function(_0x2b1098){logger[_0xa5a5('0x10')](_0xa5a5('0x11'),_0x158a80,_0xa5a5('0x12'));logger[_0xa5a5('0x13')](_0xa5a5('0x14'),_0x158a80,'request\x20sent',JSON[_0xa5a5('0x15')](_0x2b1098));if(_0x2b1098[_0xa5a5('0x16')]){if(_0x2b1098[_0xa5a5('0x16')][_0xa5a5('0x17')]===0x1f4){logger[_0xa5a5('0x16')](_0xa5a5('0x11'),_0x158a80,_0x2b1098['error'][_0xa5a5('0x18')]);return _0x2dace1(_0x2b1098[_0xa5a5('0x16')][_0xa5a5('0x18')]);}logger[_0xa5a5('0x16')](_0xa5a5('0x11'),_0x158a80,_0x2b1098[_0xa5a5('0x16')][_0xa5a5('0x18')]);return _0x18f261(_0x2b1098[_0xa5a5('0x16')]['message']);}else{logger[_0xa5a5('0x10')](_0xa5a5('0x11'),_0x158a80,_0xa5a5('0x12'));_0x18f261(_0x2b1098[_0xa5a5('0x19')][_0xa5a5('0x18')]);}})[_0xa5a5('0x1a')](function(_0x28c89f){logger['error'](_0xa5a5('0x11'),_0x158a80,_0x28c89f);_0x2dace1(_0x28c89f);});});}exports[_0xa5a5('0x1b')]=function(_0x21488a){var _0x3776cb=this;return new Promise(function(_0x5e3412,_0x244c9a){return db['MailAccount'][_0xa5a5('0x1c')]({'raw':_0x21488a[_0xa5a5('0x1d')]?_0x21488a[_0xa5a5('0x1d')][_0xa5a5('0x1e')]===undefined?!![]:![]:!![],'where':_0x21488a['options']?_0x21488a['options'][_0xa5a5('0x1f')]||null:null,'attributes':_0x21488a[_0xa5a5('0x1d')]?_0x21488a[_0xa5a5('0x1d')]['attributes']||null:null,'limit':_0x21488a[_0xa5a5('0x1d')]?_0x21488a['options'][_0xa5a5('0x20')]||null:null,'include':_0x21488a['options']?_0x21488a['options'][_0xa5a5('0x21')]?_[_0xa5a5('0x22')](_0x21488a[_0xa5a5('0x1d')][_0xa5a5('0x21')],function(_0x55ed28){return{'model':db[_0x55ed28[_0xa5a5('0x23')]],'as':_0x55ed28['as'],'attributes':_0x55ed28['attributes'],'include':_0x55ed28[_0xa5a5('0x21')]?_[_0xa5a5('0x22')](_0x55ed28['include'],function(_0x5ccc1e){return{'model':db[_0x5ccc1e[_0xa5a5('0x23')]],'as':_0x5ccc1e['as'],'attributes':_0x5ccc1e[_0xa5a5('0x24')],'include':_0x5ccc1e['include']?_['map'](_0x5ccc1e[_0xa5a5('0x21')],function(_0x20b3a5){return{'model':db[_0x20b3a5[_0xa5a5('0x23')]],'as':_0x20b3a5['as'],'attributes':_0x20b3a5[_0xa5a5('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa5a5('0xf')](function(_0x3bdd0a){logger['info'](_0xa5a5('0x1b'),_0x21488a);logger['debug'](_0xa5a5('0x1b'),_0x21488a,JSON['stringify'](_0x3bdd0a));_0x5e3412(_0x3bdd0a);})[_0xa5a5('0x1a')](function(_0x190a33){logger['error']('GetMailAccount',_0x190a33['message'],_0x21488a);_0x244c9a(_0x3776cb[_0xa5a5('0x16')](0x1f4,_0x190a33['message']));});});};exports[_0xa5a5('0x25')]=function(_0x378dda){var _0x511cac=this;return new Promise(function(_0x3d0773,_0x275701){return db['MailAccount'][_0xa5a5('0x26')]({'raw':_0x378dda[_0xa5a5('0x1d')]?_0x378dda[_0xa5a5('0x1d')][_0xa5a5('0x1e')]===undefined?!![]:![]:!![],'where':_0x378dda[_0xa5a5('0x1d')]?_0x378dda[_0xa5a5('0x1d')][_0xa5a5('0x1f')]||null:null,'attributes':_0x378dda['options']?_0x378dda[_0xa5a5('0x1d')][_0xa5a5('0x24')]||null:null,'include':_0x378dda[_0xa5a5('0x1d')]?_0x378dda[_0xa5a5('0x1d')][_0xa5a5('0x21')]?_[_0xa5a5('0x22')](_0x378dda[_0xa5a5('0x1d')][_0xa5a5('0x21')],function(_0x631c7d){return{'model':db[_0x631c7d[_0xa5a5('0x23')]],'as':_0x631c7d['as'],'attributes':_0x631c7d[_0xa5a5('0x24')],'include':_0x631c7d[_0xa5a5('0x21')]?_[_0xa5a5('0x22')](_0x631c7d[_0xa5a5('0x21')],function(_0x2dd414){return{'model':db[_0x2dd414[_0xa5a5('0x23')]],'as':_0x2dd414['as'],'attributes':_0x2dd414[_0xa5a5('0x24')],'include':_0x2dd414['include']?_[_0xa5a5('0x22')](_0x2dd414['include'],function(_0x49c55d){return{'model':db[_0x49c55d['model']],'as':_0x49c55d['as'],'attributes':_0x49c55d[_0xa5a5('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f049c){if(_0x378dda[_0xa5a5('0x1d')][_0xa5a5('0x27')]===!![])_0x1f049c['setDataValue'](_0xa5a5('0x28'),_0x1f049c['getSmtpOptions']());logger['info'](_0xa5a5('0x25'),_0x378dda);logger[_0xa5a5('0x13')]('ShowMailAccount',_0x378dda,JSON[_0xa5a5('0x15')](_0x1f049c));_0x3d0773(_0x1f049c);})['catch'](function(_0x5572c4){logger[_0xa5a5('0x16')]('ShowMailAccount',_0x5572c4[_0xa5a5('0x18')],_0x378dda);_0x275701(_0x511cac['error'](0x1f4,_0x5572c4[_0xa5a5('0x18')]));});});};exports[_0xa5a5('0x29')]=function(_0x1a1083){var _0x32cb42=this;return new Promise(function(_0x71fb38,_0x2788a5){var _0x5e52c2={'body':_0x1a1083[_0xa5a5('0x2a')],'channel':_0xa5a5('0x2b')};var _0x4591ce=_['difference'](_[_0xa5a5('0x2c')](db['CmContact'][_0xa5a5('0x2d')]),[_0xa5a5('0x2e'),'updatedAt',_0xa5a5('0x2f'),_0xa5a5('0x30')]);var _0x2373f4=![];if(_0x1a1083[_0xa5a5('0x2a')]['id']){delete _0x1a1083[_0xa5a5('0x2a')]['id'];}if(_['isNil'](_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x31')])){return _0x2788a5(_0x32cb42['error'](0x1f4,_0xa5a5('0x32')));}if(_[_0xa5a5('0x33')](_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x2a')])||_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x2a')]===''){return _0x2788a5(_0x32cb42[_0xa5a5('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xa5a5('0x33')](_0x1a1083['body'][_0xa5a5('0x34')])){return _0x2788a5(_0x32cb42['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4591ce));}if(!_[_0xa5a5('0x35')](_0x4591ce,_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x34')])){return _0x2788a5(_0x32cb42['error'](0x1f4,_0xa5a5('0x36')+_0x4591ce));}var _0x52acb0={};_0x52acb0[_0x1a1083['body'][_0xa5a5('0x34')]]=_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x31')];return db['MailAccount'][_0xa5a5('0x26')]({'where':{'id':_0x1a1083['account']['id']},'include':[{'model':db['CmList'],'as':_0xa5a5('0x37'),'include':[{'model':db[_0xa5a5('0x38')],'as':_0xa5a5('0x39'),'where':_0x52acb0,'limit':0x1,'order':[[_0xa5a5('0x3a'),_0xa5a5('0x3b')]]}]},{'model':db[_0xa5a5('0x3c')],'as':_0xa5a5('0x3d')},{'model':db[_0xa5a5('0x3e')],'as':'Smtp','include':[{'model':db[_0xa5a5('0x3f')],'as':_0xa5a5('0x3f')}]}]})[_0xa5a5('0xf')](function(_0x232bc5){if(_0x232bc5&&_0x232bc5[_0xa5a5('0x37')]){var _0x1178b6=_0x232bc5['get']({'plain':!![]});_0x5e52c2[_0xa5a5('0x40')]=_[_0xa5a5('0x41')](_0x1178b6,['Applications',_0xa5a5('0x37')]);_0x5e52c2[_0xa5a5('0x40')][_0xa5a5('0x28')]=_0x232bc5['getSmtpOptions']();_0x5e52c2[_0xa5a5('0x42')]=_0x1178b6[_0xa5a5('0x3d')];_0x5e52c2[_0xa5a5('0x43')]=_0x1178b6[_0xa5a5('0x37')];_0x5e52c2['applications']=_['orderBy'](_0x5e52c2[_0xa5a5('0x42')],[_0xa5a5('0x44')],[_0xa5a5('0x45')]);if(_0x5e52c2['account']&&_0x5e52c2[_0xa5a5('0x40')][_0xa5a5('0x46')]){_0x5e52c2[_0xa5a5('0x42')][_0xa5a5('0x47')]({'id':0x0,'priority':_0x5e52c2[_0xa5a5('0x42')][_0xa5a5('0x48')]+0x1,'app':_0xa5a5('0x49'),'appdata':'autoclose','interval':_0xa5a5('0x4a')});}if(_0x5e52c2[_0xa5a5('0x40')][_0xa5a5('0x3d')]){delete _0x5e52c2[_0xa5a5('0x40')][_0xa5a5('0x3d')];}if(_0x5e52c2[_0xa5a5('0x40')]['List']){delete _0x5e52c2[_0xa5a5('0x40')][_0xa5a5('0x37')];}if(_0x1178b6[_0xa5a5('0x37')]['Contacts'][_0xa5a5('0x48')]){return _0x1178b6[_0xa5a5('0x37')]['Contacts'][0x0];}var _0x2acc34=_[_0xa5a5('0x9')](_0x1a1083[_0xa5a5('0x2a')],{'firstName':_0x1a1083[_0xa5a5('0x2a')]['from'],'ListId':_0x1178b6['ListId']});_0x2acc34[_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x34')]]=_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x31')];return db[_0xa5a5('0x38')][_0xa5a5('0x4b')](_0x2acc34);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x3d7f84){_0x5e52c2[_0xa5a5('0x4c')]=_0x3d7f84;if(_0x3d7f84){if(!_0x1a1083[_0xa5a5('0x2a')]['message']['messageId']){_0x1a1083['body'][_0xa5a5('0x18')][_0xa5a5('0x4d')]=rs[_0xa5a5('0x4e')]()+'\x20'+_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x18')][_0xa5a5('0x31')];}var _0x467c92={'ContactId':_0x3d7f84['id'],'MailAccountId':_0x1a1083[_0xa5a5('0x40')]['id'],'inReplyTo':_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x18')]['messageId'],'to':_0x1a1083[_0xa5a5('0x2a')]['message'][_0xa5a5('0x31')],'cc':_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x18')]['cc'],'subject':_0x1a1083['body'][_0xa5a5('0x18')][_0xa5a5('0x4f')],'attach':_0x1a1083['body'][_0xa5a5('0x18')][_0xa5a5('0x50')],'lastMsgAt':moment()[_0xa5a5('0x51')](_0xa5a5('0x52')),'lastMsgDirection':'in'};return db[_0xa5a5('0x53')][_0xa5a5('0x26')]({'where':{'closed':![],'MailAccountId':_0x1a1083[_0xa5a5('0x40')]['id']},'include':[{'model':db[_0xa5a5('0x54')],'as':_0xa5a5('0x55'),'attributes':[_0xa5a5('0x4d')],'where':{'messageId':_0x1a1083['body'][_0xa5a5('0x18')][_0xa5a5('0x56')]}}]})[_0xa5a5('0xf')](function(_0x591fc5){if(_0x591fc5){return[_0x591fc5,![]];}return db[_0xa5a5('0x53')][_0xa5a5('0x4b')](_0x467c92)[_0xa5a5('0xf')](function(_0x21e58a){return[_0x21e58a,!![]];});});}else{throw new Error(_0xa5a5('0x57'));}})[_0xa5a5('0x58')](function(_0x314068,_0x1dc8e4){if(_0x314068){_0x2373f4=_0x1dc8e4;if(!_0x1dc8e4){return _0x314068[_0xa5a5('0x59')]({'inReplyTo':_0x1a1083['body']['message'][_0xa5a5('0x4d')],'to':_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x18')]['from'],'cc':_0x1a1083[_0xa5a5('0x2a')]['message']['cc'],'subject':_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x18')][_0xa5a5('0x4f')],'attach':_0x314068[_0xa5a5('0x50')]?_0x314068['attach']:_0x1a1083['body'][_0xa5a5('0x18')][_0xa5a5('0x50')],'substatus':null,'substatusAt':moment()['format'](_0xa5a5('0x52')),'lastMsgAt':moment()[_0xa5a5('0x51')](_0xa5a5('0x52')),'lastMsgDirection':'in'});}else{return _0x314068;}}})[_0xa5a5('0xf')](function(_0x56157e){_0x5e52c2['interaction']=_0x56157e[_0xa5a5('0x5a')]({'plain':!![]});_0x5e52c2['interaction'][_0xa5a5('0x5b')]=_0x2373f4;return db[_0xa5a5('0x54')][_0xa5a5('0x4b')]({'body':_0x1a1083[_0xa5a5('0x2a')]['body'],'MailAccountId':_0x1a1083[_0xa5a5('0x40')]['id'],'MailInteractionId':_0x56157e['id'],'direction':'in','ContactId':_0x5e52c2['contact']['id'],'messageId':_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x18')][_0xa5a5('0x4d')],'from':_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x18')][_0xa5a5('0x31')],'to':_0x1a1083[_0xa5a5('0x2a')]['message']['to'],'cc':_0x1a1083[_0xa5a5('0x2a')]['message']['cc'],'subject':_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x18')][_0xa5a5('0x4f')],'attach':_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x18')][_0xa5a5('0x50')],'Attachments':_0x1a1083['body'][_0xa5a5('0x18')][_0xa5a5('0x5c')],'originTo':_0x1a1083['body'][_0xa5a5('0x18')][_0xa5a5('0x5d')],'originCc':_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x18')]['originCc'],'bcc':_0x1a1083[_0xa5a5('0x2a')][_0xa5a5('0x18')][_0xa5a5('0x5e')],'ChatWebsiteId':_0x1a1083[_0xa5a5('0x2a')]['message'][_0xa5a5('0x5f')]||null,'originChannel':_0x1a1083[_0xa5a5('0x2a')]['message'][_0xa5a5('0x60')]||_0xa5a5('0x61'),'ChatOfflineMessageId':_0x1a1083['body']['message'][_0xa5a5('0x62')]||null},{'include':[{'model':db['Attachment'],'as':_0xa5a5('0x63')}]});})[_0xa5a5('0xf')](function(_0x2b62d0){_0x5e52c2['message']=_0x2b62d0;if(!_0x5e52c2[_0xa5a5('0x64')][_0xa5a5('0x65')]){return;}return db[_0xa5a5('0x66')][_0xa5a5('0x26')]({'attributes':['id',_0xa5a5('0x67')],'where':{'id':_0x5e52c2[_0xa5a5('0x64')]['UserId']}});})['then'](function(_0x2ec0f6){if(_0x2ec0f6){_0x5e52c2[_0xa5a5('0x42')][_0xa5a5('0x68')]({'id':0x0,'priority':0x0,'app':_0xa5a5('0x69'),'appdata':_0x2ec0f6['name']+','+(_0x5e52c2[_0xa5a5('0x40')][_0xa5a5('0x6a')]||0xa),'interval':'*,*,*,*'});}if(!_0x5e52c2[_0xa5a5('0x64')][_0xa5a5('0x6b')]){return;}return db[_0xa5a5('0x6c')][_0xa5a5('0x26')]({'attributes':['id',_0xa5a5('0x67')],'where':{'id':_0x5e52c2['interaction'][_0xa5a5('0x6b')]}});})[_0xa5a5('0xf')](function(_0x5b9c77){if(_0x5b9c77){_0x5e52c2['applications'][_0xa5a5('0x68')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x5b9c77[_0xa5a5('0x67')]+','+(_0x5e52c2[_0xa5a5('0x40')][_0xa5a5('0x6d')]||0x12c),'interval':_0xa5a5('0x4a')});}return respondWithRpcPromise(_0xa5a5('0x6e'),_0xa5a5('0x6f'),_0x5e52c2);})['then'](function(_0x32ef99){_0x71fb38(_0x32ef99);})[_0xa5a5('0x1a')](function(_0xdcb054){_0x2788a5(_0x32cb42[_0xa5a5('0x16')](0x1f4,_0xdcb054[_0xa5a5('0x18')]));});});}; \ No newline at end of file +var _0x723e=['List','Applications','applications','list','orderBy','asc','autoclose','length','close','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','update','interaction','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','MailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','ShowMailAccount','stringify','body','mail','difference','keys','createdAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','CmContact','Contacts','updatedAt','DESC','MailApplication','MailServerOut','CloudProvider'];(function(_0x347c23,_0x594d48){var _0x11c554=function(_0x1bc8a4){while(--_0x1bc8a4){_0x347c23['push'](_0x347c23['shift']());}};_0x11c554(++_0x594d48);}(_0x723e,0x179));var _0xe723=function(_0x9c3c56,_0x169b56){_0x9c3c56=_0x9c3c56-0x0;var _0x2dd782=_0x723e[_0x9c3c56];return _0x2dd782;};'use strict';var _=require('lodash');var moment=require(_0xe723('0x0'));var BPromise=require(_0xe723('0x1'));var rs=require(_0xe723('0x2'));var Redis=require(_0xe723('0x3'));var db=require(_0xe723('0x4'))['db'];var logger=require(_0xe723('0x5'))(_0xe723('0x6'));var config=require(_0xe723('0x7'));var jayson=require(_0xe723('0x8'));var client=jayson[_0xe723('0x9')]['http']({'port':0x232c});config[_0xe723('0xa')]=_[_0xe723('0xb')](config[_0xe723('0xa')],{'host':_0xe723('0xc'),'port':0x18eb});var socket=require(_0xe723('0xd'))(new Redis(config[_0xe723('0xa')]));require(_0xe723('0xe'))[_0xe723('0xf')](socket);function respondWithRpcPromise(_0x4a6983,_0x380444,_0x270346){return new BPromise(function(_0x34831f,_0x5a43fb){return client[_0xe723('0x10')](_0x4a6983,_0x270346)[_0xe723('0x11')](function(_0xcf68e2){logger['info'](_0xe723('0x12'),_0x380444,_0xe723('0x13'));logger[_0xe723('0x14')](_0xe723('0x15'),_0x380444,_0xe723('0x13'),JSON['stringify'](_0xcf68e2));if(_0xcf68e2[_0xe723('0x16')]){if(_0xcf68e2['error']['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x380444,_0xcf68e2[_0xe723('0x16')][_0xe723('0x17')]);return _0x5a43fb(_0xcf68e2[_0xe723('0x16')][_0xe723('0x17')]);}logger[_0xe723('0x16')]('MailAccount,\x20%s,\x20%s',_0x380444,_0xcf68e2[_0xe723('0x16')][_0xe723('0x17')]);return _0x34831f(_0xcf68e2[_0xe723('0x16')][_0xe723('0x17')]);}else{logger[_0xe723('0x18')](_0xe723('0x12'),_0x380444,_0xe723('0x13'));_0x34831f(_0xcf68e2[_0xe723('0x19')][_0xe723('0x17')]);}})[_0xe723('0x1a')](function(_0x2057d7){logger[_0xe723('0x16')](_0xe723('0x12'),_0x380444,_0x2057d7);_0x5a43fb(_0x2057d7);});});}exports[_0xe723('0x1b')]=function(_0x5e8a90){var _0x5b2308=this;return new Promise(function(_0x31c839,_0x1ed6fb){return db['MailAccount'][_0xe723('0x1c')]({'raw':_0x5e8a90[_0xe723('0x1d')]?_0x5e8a90['options'][_0xe723('0x1e')]===undefined?!![]:![]:!![],'where':_0x5e8a90['options']?_0x5e8a90[_0xe723('0x1d')][_0xe723('0x1f')]||null:null,'attributes':_0x5e8a90[_0xe723('0x1d')]?_0x5e8a90[_0xe723('0x1d')][_0xe723('0x20')]||null:null,'limit':_0x5e8a90[_0xe723('0x1d')]?_0x5e8a90[_0xe723('0x1d')][_0xe723('0x21')]||null:null,'include':_0x5e8a90[_0xe723('0x1d')]?_0x5e8a90[_0xe723('0x1d')][_0xe723('0x22')]?_[_0xe723('0x23')](_0x5e8a90['options'][_0xe723('0x22')],function(_0x59f095){return{'model':db[_0x59f095[_0xe723('0x24')]],'as':_0x59f095['as'],'attributes':_0x59f095[_0xe723('0x20')],'include':_0x59f095[_0xe723('0x22')]?_[_0xe723('0x23')](_0x59f095[_0xe723('0x22')],function(_0x598f15){return{'model':db[_0x598f15[_0xe723('0x24')]],'as':_0x598f15['as'],'attributes':_0x598f15['attributes'],'include':_0x598f15['include']?_[_0xe723('0x23')](_0x598f15['include'],function(_0x3e6bc0){return{'model':db[_0x3e6bc0[_0xe723('0x24')]],'as':_0x3e6bc0['as'],'attributes':_0x3e6bc0[_0xe723('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1edbb2){logger[_0xe723('0x18')]('GetMailAccount',_0x5e8a90);logger[_0xe723('0x14')]('GetMailAccount',_0x5e8a90,JSON['stringify'](_0x1edbb2));_0x31c839(_0x1edbb2);})[_0xe723('0x1a')](function(_0x2c2240){logger[_0xe723('0x16')](_0xe723('0x1b'),_0x2c2240['message'],_0x5e8a90);_0x1ed6fb(_0x5b2308['error'](0x1f4,_0x2c2240[_0xe723('0x17')]));});});};exports['ShowMailAccount']=function(_0x3855c7){var _0x318f7f=this;return new Promise(function(_0x398054,_0xb91a9c){return db[_0xe723('0x25')][_0xe723('0x26')]({'raw':_0x3855c7[_0xe723('0x1d')]?_0x3855c7[_0xe723('0x1d')][_0xe723('0x1e')]===undefined?!![]:![]:!![],'where':_0x3855c7[_0xe723('0x1d')]?_0x3855c7[_0xe723('0x1d')][_0xe723('0x1f')]||null:null,'attributes':_0x3855c7[_0xe723('0x1d')]?_0x3855c7[_0xe723('0x1d')]['attributes']||null:null,'include':_0x3855c7[_0xe723('0x1d')]?_0x3855c7['options'][_0xe723('0x22')]?_[_0xe723('0x23')](_0x3855c7['options']['include'],function(_0x2f1940){return{'model':db[_0x2f1940[_0xe723('0x24')]],'as':_0x2f1940['as'],'attributes':_0x2f1940[_0xe723('0x20')],'include':_0x2f1940[_0xe723('0x22')]?_[_0xe723('0x23')](_0x2f1940[_0xe723('0x22')],function(_0x5122da){return{'model':db[_0x5122da[_0xe723('0x24')]],'as':_0x5122da['as'],'attributes':_0x5122da[_0xe723('0x20')],'include':_0x5122da[_0xe723('0x22')]?_[_0xe723('0x23')](_0x5122da[_0xe723('0x22')],function(_0x37bb5d){return{'model':db[_0x37bb5d[_0xe723('0x24')]],'as':_0x37bb5d['as'],'attributes':_0x37bb5d[_0xe723('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe723('0x11')](function(_0x3dca81){if(_0x3855c7[_0xe723('0x1d')][_0xe723('0x27')]===!![])_0x3dca81[_0xe723('0x28')](_0xe723('0x29'),_0x3dca81[_0xe723('0x2a')]());logger[_0xe723('0x18')]('ShowMailAccount',_0x3855c7);logger[_0xe723('0x14')](_0xe723('0x2b'),_0x3855c7,JSON[_0xe723('0x2c')](_0x3dca81));_0x398054(_0x3dca81);})[_0xe723('0x1a')](function(_0x5325a5){logger['error'](_0xe723('0x2b'),_0x5325a5[_0xe723('0x17')],_0x3855c7);_0xb91a9c(_0x318f7f[_0xe723('0x16')](0x1f4,_0x5325a5[_0xe723('0x17')]));});});};exports['NotifyMailAccount']=function(_0x5d5f24){var _0x314551=this;return new Promise(function(_0x2f1618,_0x24909){var _0x245512={'body':_0x5d5f24[_0xe723('0x2d')],'channel':_0xe723('0x2e')};var _0x471843=_[_0xe723('0x2f')](_[_0xe723('0x30')](db['CmContact']['rawAttributes']),[_0xe723('0x31'),'updatedAt','CompanyId',_0xe723('0x32')]);var _0x55530b=![];if(_0x5d5f24[_0xe723('0x2d')]['id']){delete _0x5d5f24[_0xe723('0x2d')]['id'];}if(_[_0xe723('0x33')](_0x5d5f24[_0xe723('0x2d')][_0xe723('0x34')])){return _0x24909(_0x314551[_0xe723('0x16')](0x1f4,_0xe723('0x35')));}if(_['isNil'](_0x5d5f24['body'][_0xe723('0x2d')])||_0x5d5f24['body'][_0xe723('0x2d')]===''){return _0x24909(_0x314551['error'](0x1f4,_0xe723('0x36')));}if(_[_0xe723('0x33')](_0x5d5f24[_0xe723('0x2d')][_0xe723('0x37')])){return _0x24909(_0x314551[_0xe723('0x16')](0x1f4,_0xe723('0x38')+_0x471843));}if(!_[_0xe723('0x39')](_0x471843,_0x5d5f24[_0xe723('0x2d')][_0xe723('0x37')])){return _0x24909(_0x314551['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x471843));}var _0x1824b6={};_0x1824b6[_0x5d5f24[_0xe723('0x2d')][_0xe723('0x37')]]=_0x5d5f24['body']['from'];return db['MailAccount'][_0xe723('0x26')]({'where':{'id':_0x5d5f24[_0xe723('0x3a')]['id']},'include':[{'model':db[_0xe723('0x3b')],'as':'List','include':[{'model':db[_0xe723('0x3c')],'as':_0xe723('0x3d'),'where':_0x1824b6,'limit':0x1,'order':[[_0xe723('0x3e'),_0xe723('0x3f')]]}]},{'model':db[_0xe723('0x40')],'as':'Applications'},{'model':db[_0xe723('0x41')],'as':'Smtp','include':[{'model':db[_0xe723('0x42')],'as':'CloudProvider'}]}]})['then'](function(_0x1590fe){if(_0x1590fe&&_0x1590fe[_0xe723('0x43')]){var _0x22a1d3=_0x1590fe['get']({'plain':!![]});_0x245512[_0xe723('0x3a')]=_['omit'](_0x22a1d3,[_0xe723('0x44'),_0xe723('0x43')]);_0x245512[_0xe723('0x3a')][_0xe723('0x29')]=_0x1590fe[_0xe723('0x2a')]();_0x245512[_0xe723('0x45')]=_0x22a1d3[_0xe723('0x44')];_0x245512[_0xe723('0x46')]=_0x22a1d3[_0xe723('0x43')];_0x245512['applications']=_[_0xe723('0x47')](_0x245512[_0xe723('0x45')],['priority'],[_0xe723('0x48')]);if(_0x245512[_0xe723('0x3a')]&&_0x245512['account'][_0xe723('0x49')]){_0x245512['applications']['push']({'id':0x0,'priority':_0x245512[_0xe723('0x45')][_0xe723('0x4a')]+0x1,'app':_0xe723('0x4b'),'appdata':_0xe723('0x49'),'interval':_0xe723('0x4c')});}if(_0x245512['account'][_0xe723('0x44')]){delete _0x245512[_0xe723('0x3a')][_0xe723('0x44')];}if(_0x245512[_0xe723('0x3a')][_0xe723('0x43')]){delete _0x245512[_0xe723('0x3a')][_0xe723('0x43')];}if(_0x22a1d3[_0xe723('0x43')][_0xe723('0x3d')][_0xe723('0x4a')]){return _0x22a1d3['List'][_0xe723('0x3d')][0x0];}var _0x10fb8a=_[_0xe723('0xb')](_0x5d5f24[_0xe723('0x2d')],{'firstName':_0x5d5f24['body'][_0xe723('0x34')],'ListId':_0x22a1d3[_0xe723('0x32')]});_0x10fb8a[_0x5d5f24['body'][_0xe723('0x37')]]=_0x5d5f24[_0xe723('0x2d')][_0xe723('0x34')];return db[_0xe723('0x3c')][_0xe723('0x4d')](_0x10fb8a);}else{throw new Error(_0xe723('0x4e'));}})['then'](function(_0x3a3dd7){_0x245512['contact']=_0x3a3dd7;if(_0x3a3dd7){if(!_0x5d5f24['body'][_0xe723('0x17')]['messageId']){_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x4f')]=rs[_0xe723('0x50')]()+'\x20'+_0x5d5f24[_0xe723('0x2d')]['message'][_0xe723('0x34')];}var _0x43faea={'ContactId':_0x3a3dd7['id'],'MailAccountId':_0x5d5f24[_0xe723('0x3a')]['id'],'inReplyTo':_0x5d5f24['body']['message'][_0xe723('0x4f')],'to':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')]['from'],'cc':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')]['cc'],'subject':_0x5d5f24['body']['message'][_0xe723('0x51')],'attach':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x52')],'lastMsgAt':moment()[_0xe723('0x53')](_0xe723('0x54')),'lastMsgDirection':'in'};return db[_0xe723('0x55')]['find']({'where':{'closed':![],'MailAccountId':_0x5d5f24['account']['id']},'include':[{'model':db['MailMessage'],'as':_0xe723('0x56'),'attributes':[_0xe723('0x4f')],'where':{'messageId':_0x5d5f24['body'][_0xe723('0x17')][_0xe723('0x57')]}}]})[_0xe723('0x11')](function(_0x4e9777){if(_0x4e9777){return[_0x4e9777,![]];}return db['MailInteraction'][_0xe723('0x4d')](_0x43faea)[_0xe723('0x11')](function(_0x2463c3){return[_0x2463c3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2d0ab5,_0x5b24a6){if(_0x2d0ab5){_0x55530b=_0x5b24a6;if(!_0x5b24a6){return _0x2d0ab5[_0xe723('0x58')]({'inReplyTo':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x4f')],'to':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x34')],'cc':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')]['cc'],'subject':_0x5d5f24['body'][_0xe723('0x17')][_0xe723('0x51')],'attach':_0x2d0ab5[_0xe723('0x52')]?_0x2d0ab5[_0xe723('0x52')]:_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')]['attach'],'substatus':null,'substatusAt':moment()[_0xe723('0x53')](_0xe723('0x54')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2d0ab5;}}})[_0xe723('0x11')](function(_0x2d5721){_0x245512[_0xe723('0x59')]=_0x2d5721['get']({'plain':!![]});_0x245512['interaction'][_0xe723('0x5a')]=_0x55530b;return db['MailMessage'][_0xe723('0x4d')]({'body':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x2d')],'MailAccountId':_0x5d5f24[_0xe723('0x3a')]['id'],'MailInteractionId':_0x2d5721['id'],'direction':'in','ContactId':_0x245512[_0xe723('0x5b')]['id'],'messageId':_0x5d5f24['body']['message'][_0xe723('0x4f')],'from':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')]['from'],'to':_0x5d5f24[_0xe723('0x2d')]['message']['to'],'cc':_0x5d5f24['body'][_0xe723('0x17')]['cc'],'subject':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x51')],'attach':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')]['attach'],'Attachments':_0x5d5f24[_0xe723('0x2d')]['message'][_0xe723('0x5c')],'originTo':_0x5d5f24[_0xe723('0x2d')]['message'][_0xe723('0x5d')],'originCc':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x5e')],'bcc':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x5f')],'ChatWebsiteId':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x60')]||null,'originChannel':_0x5d5f24[_0xe723('0x2d')][_0xe723('0x17')][_0xe723('0x61')]||_0xe723('0x62'),'ChatOfflineMessageId':_0x5d5f24[_0xe723('0x2d')]['message'][_0xe723('0x63')]||null},{'include':[{'model':db[_0xe723('0x64')],'as':_0xe723('0x65')}]});})['then'](function(_0x330ab0){_0x245512[_0xe723('0x17')]=_0x330ab0;if(!_0x245512[_0xe723('0x59')][_0xe723('0x66')]){return;}return db[_0xe723('0x67')][_0xe723('0x26')]({'attributes':['id',_0xe723('0x68')],'where':{'id':_0x245512[_0xe723('0x59')][_0xe723('0x66')]}});})[_0xe723('0x11')](function(_0x5dc44a){if(_0x5dc44a){_0x245512[_0xe723('0x45')][_0xe723('0x69')]({'id':0x0,'priority':0x0,'app':_0xe723('0x6a'),'appdata':_0x5dc44a[_0xe723('0x68')]+','+(_0x245512[_0xe723('0x3a')][_0xe723('0x6b')]||0xa),'interval':'*,*,*,*'});}if(!_0x245512[_0xe723('0x59')][_0xe723('0x6c')]){return;}return db['MailQueue']['find']({'attributes':['id',_0xe723('0x68')],'where':{'id':_0x245512[_0xe723('0x59')]['queueId']}});})[_0xe723('0x11')](function(_0x1993d1){if(_0x1993d1){_0x245512['applications']['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1993d1[_0xe723('0x68')]+','+(_0x245512['account']['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe723('0x6d'),_0xe723('0x6e'),_0x245512);})[_0xe723('0x11')](function(_0x296bf1){_0x2f1618(_0x296bf1);})[_0xe723('0x1a')](function(_0x42d66a){_0x24909(_0x314551[_0xe723('0x16')](0x1f4,_0x42d66a['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 08bc65f..49e586d 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 _0x0c33=['save','remove','emit','register','length','mailAccount:','./mailAccount.events'];(function(_0x149ca0,_0x2ac7f5){var _0x56b6b9=function(_0x486ac3){while(--_0x486ac3){_0x149ca0['push'](_0x149ca0['shift']());}};_0x56b6b9(++_0x2ac7f5);}(_0x0c33,0x180));var _0x30c3=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0x0c33[_0x149083];return _0x4dc74e;};'use strict';var MailAccountEvents=require(_0x30c3('0x0'));var events=[_0x30c3('0x1'),_0x30c3('0x2'),'update'];function createListener(_0x41ed80,_0x3bdf3f){return function(_0x2e8f21){_0x3bdf3f[_0x30c3('0x3')](_0x41ed80,_0x2e8f21);};}function removeListener(_0x1d9671,_0x407d23){return function(){MailAccountEvents['removeListener'](_0x1d9671,_0x407d23);};}exports[_0x30c3('0x4')]=function(_0x14983d){for(var _0x5f3191=0x0,_0x10e3b7=events[_0x30c3('0x5')];_0x5f3191<_0x10e3b7;_0x5f3191++){var _0x11249f=events[_0x5f3191];var _0x428449=createListener(_0x30c3('0x6')+_0x11249f,_0x14983d);MailAccountEvents['on'](_0x11249f,_0x428449);}}; \ No newline at end of file +var _0x0f19=['removeListener','register','length','./mailAccount.events','save','remove'];(function(_0x322548,_0x15266a){var _0x94e920=function(_0x5996b8){while(--_0x5996b8){_0x322548['push'](_0x322548['shift']());}};_0x94e920(++_0x15266a);}(_0x0f19,0xf3));var _0x90f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f19[_0x3dd15e];return _0x231fd0;};'use strict';var MailAccountEvents=require(_0x90f1('0x0'));var events=[_0x90f1('0x1'),_0x90f1('0x2'),'update'];function createListener(_0xb585a2,_0x3c9632){return function(_0x549e5c){_0x3c9632['emit'](_0xb585a2,_0x549e5c);};}function removeListener(_0x16cf66,_0x5dc5dc){return function(){MailAccountEvents[_0x90f1('0x3')](_0x16cf66,_0x5dc5dc);};}exports[_0x90f1('0x4')]=function(_0x162220){for(var _0x5525d5=0x0,_0x4a57ae=events[_0x90f1('0x5')];_0x5525d5<_0x4a57ae;_0x5525d5++){var _0x519c56=events[_0x5525d5];var _0x4156c2=createListener('mailAccount:'+_0x519c56,_0x162220);MailAccountEvents['on'](_0x519c56,_0x4156c2);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 6f7e667..409f251 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 _0x91aa=['destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','delete'];(function(_0x38c652,_0x1ea1b7){var _0x218a37=function(_0x5dcb2a){while(--_0x5dcb2a){_0x38c652['push'](_0x38c652['shift']());}};_0x218a37(++_0x1ea1b7);}(_0x91aa,0xa2));var _0xa91a=function(_0x337ab0,_0x4ce760){_0x337ab0=_0x337ab0-0x0;var _0x1428a5=_0x91aa[_0x337ab0];return _0x1428a5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa91a('0x0'));var express=require(_0xa91a('0x1'));var router=express[_0xa91a('0x2')]();var fs_extra=require(_0xa91a('0x3'));var auth=require(_0xa91a('0x4'));var interaction=require(_0xa91a('0x5'));var config=require(_0xa91a('0x6'));var controller=require(_0xa91a('0x7'));router[_0xa91a('0x8')](_0xa91a('0x9'),auth[_0xa91a('0xa')](),controller[_0xa91a('0xb')]);router[_0xa91a('0xc')](_0xa91a('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xa91a('0xd')](_0xa91a('0x9'),auth[_0xa91a('0xa')](),controller[_0xa91a('0xe')]);module[_0xa91a('0xf')]=router; \ No newline at end of file +var _0xc025=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailApplication.controller','get','/:id','isAuthenticated','put','update','delete'];(function(_0xffc5a3,_0x39e49f){var _0xca5b3=function(_0x22d031){while(--_0x22d031){_0xffc5a3['push'](_0xffc5a3['shift']());}};_0xca5b3(++_0x39e49f);}(_0xc025,0xe2));var _0x5c02=function(_0x57cb38,_0x377f1c){_0x57cb38=_0x57cb38-0x0;var _0x56af6c=_0xc025[_0x57cb38];return _0x56af6c;};'use strict';var multer=require('multer');var util=require(_0x5c02('0x0'));var path=require(_0x5c02('0x1'));var timeout=require(_0x5c02('0x2'));var express=require(_0x5c02('0x3'));var router=express[_0x5c02('0x4')]();var fs_extra=require(_0x5c02('0x5'));var auth=require(_0x5c02('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5c02('0x7'));router[_0x5c02('0x8')](_0x5c02('0x9'),auth[_0x5c02('0xa')](),controller['show']);router[_0x5c02('0xb')](_0x5c02('0x9'),auth['isAuthenticated'](),controller[_0x5c02('0xc')]);router[_0x5c02('0xd')](_0x5c02('0x9'),auth[_0x5c02('0xa')](),controller[_0x5c02('0xe')]);module[_0x5c02('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 f301aa7..a99b215 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 _0x4b51=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x102683,_0x1ac309){var _0x4e16c5=function(_0x382e7e){while(--_0x382e7e){_0x102683['push'](_0x102683['shift']());}};_0x4e16c5(++_0x1ac309);}(_0x4b51,0x105));var _0x14b5=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x4b51[_0x164af1];return _0x5d81a2;};'use strict';var Sequelize=require(_0x14b5('0x0'));module[_0x14b5('0x1')]={'priority':{'type':Sequelize[_0x14b5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x14b5('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x14b5('0x4')]()},'description':{'type':Sequelize[_0x14b5('0x3')]},'interval':{'type':Sequelize[_0x14b5('0x3')],'defaultValue':_0x14b5('0x5')}}; \ No newline at end of file +var _0x0e73=['noop','TEXT','sequelize','INTEGER','STRING'];(function(_0x5ba24b,_0x4ae1a5){var _0x39d28c=function(_0x367ef5){while(--_0x367ef5){_0x5ba24b['push'](_0x5ba24b['shift']());}};_0x39d28c(++_0x4ae1a5);}(_0x0e73,0x110));var _0x30e7=function(_0x5bf601,_0x8fb76d){_0x5bf601=_0x5bf601-0x0;var _0x4ea9b6=_0x0e73[_0x5bf601];return _0x4ea9b6;};'use strict';var Sequelize=require(_0x30e7('0x0'));module['exports']={'priority':{'type':Sequelize[_0x30e7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x30e7('0x2')],'allowNull':![],'defaultValue':_0x30e7('0x3')},'appdata':{'type':Sequelize[_0x30e7('0x4')]()},'description':{'type':Sequelize[_0x30e7('0x2')]},'interval':{'type':Sequelize[_0x30e7('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 763d7e1..e580bd4 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x16496c,_0x7acac4){var _0x1a6a59=function(_0x2e0464){while(--_0x2e0464){_0x16496c['push'](_0x16496c['shift']());}};_0x1a6a59(++_0x7acac4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x14477e,_0x44d4da){_0x14477e=_0x14477e-0x0;var _0x5d4a05=_0xcb91[_0x14477e];return _0x5d4a05;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file +var _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0xaa88[_0x38eb23];return _0x48506a;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index a05c52c..a9a288b 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 _0x1cd4=['./mailApplication.attributes','exports','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3ac77e,_0x460e0c){var _0x475be1=function(_0x5c8080){while(--_0x5c8080){_0x3ac77e['push'](_0x3ac77e['shift']());}};_0x475be1(++_0x460e0c);}(_0x1cd4,0x10e));var _0x41cd=function(_0x2a5de6,_0x26434d){_0x2a5de6=_0x2a5de6-0x0;var _0x423946=_0x1cd4[_0x2a5de6];return _0x423946;};'use strict';var _=require(_0x41cd('0x0'));var util=require(_0x41cd('0x1'));var logger=require(_0x41cd('0x2'))(_0x41cd('0x3'));var moment=require(_0x41cd('0x4'));var BPromise=require(_0x41cd('0x5'));var rp=require(_0x41cd('0x6'));var fs=require('fs');var path=require(_0x41cd('0x7'));var rimraf=require(_0x41cd('0x8'));var config=require(_0x41cd('0x9'));var attributes=require(_0x41cd('0xa'));module[_0x41cd('0xb')]=function(_0x5ab8e2,_0x8fb19c){return _0x5ab8e2['define']('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x41cd('0xc'),'collate':_0x41cd('0xd')});}; \ No newline at end of file +var _0x3c9b=['utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x3c9b,0x105));var _0xb3c9=function(_0x3ca96a,_0x3efc44){_0x3ca96a=_0x3ca96a-0x0;var _0x438fe1=_0x3c9b[_0x3ca96a];return _0x438fe1;};'use strict';var _=require(_0xb3c9('0x0'));var util=require('util');var logger=require(_0xb3c9('0x1'))(_0xb3c9('0x2'));var moment=require('moment');var BPromise=require(_0xb3c9('0x3'));var rp=require(_0xb3c9('0x4'));var fs=require('fs');var path=require(_0xb3c9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb3c9('0x6'));module[_0xb3c9('0x7')]=function(_0x271ff1,_0xbae567){return _0x271ff1[_0xb3c9('0x8')](_0xb3c9('0x9'),attributes,{'tableName':_0xb3c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb3c9('0xb'),'collate':_0xb3c9('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index c279359..fb42edd 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 _0x56c8=['request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','raw','where','options','limit','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x8b6ddb,_0x30ea41){var _0x5a3b01=function(_0x29db6a){while(--_0x29db6a){_0x8b6ddb['push'](_0x8b6ddb['shift']());}};_0x5a3b01(++_0x30ea41);}(_0x56c8,0x170));var _0x856c=function(_0x4a2e25,_0x5736f2){_0x4a2e25=_0x4a2e25-0x0;var _0x54df21=_0x56c8[_0x4a2e25];return _0x54df21;};'use strict';var _=require('lodash');var util=require(_0x856c('0x0'));var moment=require(_0x856c('0x1'));var BPromise=require(_0x856c('0x2'));var rs=require(_0x856c('0x3'));var fs=require('fs');var Redis=require(_0x856c('0x4'));var db=require(_0x856c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x856c('0x6'));var config=require(_0x856c('0x7'));var jayson=require(_0x856c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5108c2,_0x2a4699,_0x465382){return new BPromise(function(_0x33fcec,_0x209086){return client[_0x856c('0x9')](_0x5108c2,_0x465382)[_0x856c('0xa')](function(_0x223112){logger[_0x856c('0xb')](_0x856c('0xc'),_0x2a4699,_0x856c('0xd'));logger['debug'](_0x856c('0xe'),_0x2a4699,_0x856c('0xd'),JSON['stringify'](_0x223112));if(_0x223112[_0x856c('0xf')]){if(_0x223112['error'][_0x856c('0x10')]===0x1f4){logger[_0x856c('0xf')](_0x856c('0xc'),_0x2a4699,_0x223112['error']['message']);return _0x209086(_0x223112[_0x856c('0xf')]['message']);}logger[_0x856c('0xf')]('MailApplication,\x20%s,\x20%s',_0x2a4699,_0x223112[_0x856c('0xf')][_0x856c('0x11')]);return _0x33fcec(_0x223112['error'][_0x856c('0x11')]);}else{logger[_0x856c('0xb')](_0x856c('0xc'),_0x2a4699,_0x856c('0xd'));_0x33fcec(_0x223112[_0x856c('0x12')][_0x856c('0x11')]);}})[_0x856c('0x13')](function(_0x53b1e0){logger[_0x856c('0xf')](_0x856c('0xc'),_0x2a4699,_0x53b1e0);_0x209086(_0x53b1e0);});});}exports[_0x856c('0x14')]=function(_0xca0d1c){var _0x5eb6d3=this;return new Promise(function(_0x150120,_0x1f2f04){return db[_0x856c('0x15')][_0x856c('0x16')](_0xca0d1c[_0x856c('0x17')],{'raw':_0xca0d1c['options']?_0xca0d1c['options'][_0x856c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xca0d1c['options']?_0xca0d1c['options'][_0x856c('0x19')]||null:null,'attributes':_0xca0d1c[_0x856c('0x1a')]?_0xca0d1c['options']['attributes']||null:null,'limit':_0xca0d1c['options']?_0xca0d1c[_0x856c('0x1a')][_0x856c('0x1b')]||null:null})[_0x856c('0xa')](function(_0x431f02){logger[_0x856c('0xb')](_0x856c('0x14'),_0xca0d1c);logger['debug'](_0x856c('0x14'),_0xca0d1c,JSON[_0x856c('0x1c')](_0x431f02));_0x150120(_0x431f02);})[_0x856c('0x13')](function(_0x4bab3c){logger[_0x856c('0xf')](_0x856c('0x14'),_0x4bab3c[_0x856c('0x11')],_0xca0d1c);_0x1f2f04(_0x5eb6d3[_0x856c('0xf')](0x1f4,_0x4bab3c['message']));});});}; \ No newline at end of file +var _0xd0ee=['error','code','message','MailApplication,\x20%s,\x20%s','info','UpdateMailApplication','MailApplication','update','options','raw','limit','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5c8a68,_0x495158){var _0x11697a=function(_0x1a9695){while(--_0x1a9695){_0x5c8a68['push'](_0x5c8a68['shift']());}};_0x11697a(++_0x495158);}(_0xd0ee,0x12f));var _0xed0e=function(_0x3fe5c9,_0x28befd){_0x3fe5c9=_0x3fe5c9-0x0;var _0x42adee=_0xd0ee[_0x3fe5c9];return _0x42adee;};'use strict';var _=require(_0xed0e('0x0'));var util=require(_0xed0e('0x1'));var moment=require(_0xed0e('0x2'));var BPromise=require(_0xed0e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed0e('0x4'));var db=require(_0xed0e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xed0e('0x6'));var config=require(_0xed0e('0x7'));var jayson=require(_0xed0e('0x8'));var client=jayson[_0xed0e('0x9')][_0xed0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53fc31,_0x455c9e,_0x4eec05){return new BPromise(function(_0x295a00,_0x3015cd){return client[_0xed0e('0xb')](_0x53fc31,_0x4eec05)['then'](function(_0x5b11ad){logger['info']('MailApplication,\x20%s,\x20%s',_0x455c9e,_0xed0e('0xc'));logger[_0xed0e('0xd')](_0xed0e('0xe'),_0x455c9e,_0xed0e('0xc'),JSON[_0xed0e('0xf')](_0x5b11ad));if(_0x5b11ad[_0xed0e('0x10')]){if(_0x5b11ad[_0xed0e('0x10')][_0xed0e('0x11')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x455c9e,_0x5b11ad[_0xed0e('0x10')]['message']);return _0x3015cd(_0x5b11ad[_0xed0e('0x10')][_0xed0e('0x12')]);}logger['error'](_0xed0e('0x13'),_0x455c9e,_0x5b11ad[_0xed0e('0x10')][_0xed0e('0x12')]);return _0x295a00(_0x5b11ad['error'][_0xed0e('0x12')]);}else{logger[_0xed0e('0x14')]('MailApplication,\x20%s,\x20%s',_0x455c9e,'request\x20sent');_0x295a00(_0x5b11ad['result'][_0xed0e('0x12')]);}})['catch'](function(_0x285f06){logger[_0xed0e('0x10')](_0xed0e('0x13'),_0x455c9e,_0x285f06);_0x3015cd(_0x285f06);});});}exports[_0xed0e('0x15')]=function(_0x5c412e){var _0xf15aa5=this;return new Promise(function(_0x5ecd6c,_0x514afe){return db[_0xed0e('0x16')][_0xed0e('0x17')](_0x5c412e['body'],{'raw':_0x5c412e[_0xed0e('0x18')]?_0x5c412e[_0xed0e('0x18')][_0xed0e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c412e[_0xed0e('0x18')]?_0x5c412e[_0xed0e('0x18')]['where']||null:null,'attributes':_0x5c412e['options']?_0x5c412e[_0xed0e('0x18')]['attributes']||null:null,'limit':_0x5c412e[_0xed0e('0x18')]?_0x5c412e['options'][_0xed0e('0x1a')]||null:null})[_0xed0e('0x1b')](function(_0x5ed521){logger['info'](_0xed0e('0x15'),_0x5c412e);logger['debug'](_0xed0e('0x15'),_0x5c412e,JSON['stringify'](_0x5ed521));_0x5ecd6c(_0x5ed521);})[_0xed0e('0x1c')](function(_0x202aa0){logger[_0xed0e('0x10')]('UpdateMailApplication',_0x202aa0['message'],_0x5c412e);_0x514afe(_0xf15aa5[_0xed0e('0x10')](0x1f4,_0x202aa0[_0xed0e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index f3280a5..8130fcd 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 _0x964c=['delete','destroy','/:id/tags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','mail','mailinteraction:addtags','addTags','put','/:id','tracked','update'];(function(_0xc66f3d,_0x4db447){var _0x3335c2=function(_0x371629){while(--_0x371629){_0xc66f3d['push'](_0xc66f3d['shift']());}};_0x3335c2(++_0x4db447);}(_0x964c,0x130));var _0xc964=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x964c[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0xc964('0x0'));var router=express[_0xc964('0x1')]();var auth=require(_0xc964('0x2'));var interaction=require(_0xc964('0x3'));var controller=require(_0xc964('0x4'));router[_0xc964('0x5')]('/',auth[_0xc964('0x6')](),controller[_0xc964('0x7')]);router[_0xc964('0x5')](_0xc964('0x8'),auth['isAuthenticated'](),controller[_0xc964('0x9')]);router[_0xc964('0x5')]('/:id',auth[_0xc964('0x6')](),controller[_0xc964('0xa')]);router['get'](_0xc964('0xb'),auth[_0xc964('0x6')](),controller[_0xc964('0xc')]);router[_0xc964('0x5')](_0xc964('0xd'),auth[_0xc964('0x6')](),controller['download']);router['post']('/',auth[_0xc964('0x6')](),controller['create']);router['post'](_0xc964('0xb'),auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0xc964('0x6')](),interaction['tracked'](_0xc964('0xe'),_0xc964('0xf')),controller[_0xc964('0x10')]);router[_0xc964('0x11')](_0xc964('0x12'),auth[_0xc964('0x6')](),interaction[_0xc964('0x13')](_0xc964('0xe'),'mailinteraction:update'),controller[_0xc964('0x14')]);router[_0xc964('0x15')]('/:id',auth[_0xc964('0x6')](),interaction[_0xc964('0x13')](_0xc964('0xe'),'mailinteraction:destroy'),controller[_0xc964('0x16')]);router[_0xc964('0x15')](_0xc964('0x17'),auth[_0xc964('0x6')](),controller['removeTags']);module[_0xc964('0x18')]=router; \ No newline at end of file +var _0xaa46=['exports','express','../../components/auth/service','../../components/interaction/service','get','index','describe','/:id','show','isAuthenticated','getMessages','post','/:id/messages','addMessage','/:id/tags','mailinteraction:addtags','addTags','put','tracked','mail','update','delete','mailinteraction:destroy','destroy','removeTags'];(function(_0x3234d5,_0x5d1d26){var _0x852f37=function(_0x174442){while(--_0x174442){_0x3234d5['push'](_0x3234d5['shift']());}};_0x852f37(++_0x5d1d26);}(_0xaa46,0x12d));var _0x6aa4=function(_0x499aab,_0x79ef10){_0x499aab=_0x499aab-0x0;var _0x1174b1=_0xaa46[_0x499aab];return _0x1174b1;};'use strict';var express=require(_0x6aa4('0x0'));var router=express['Router']();var auth=require(_0x6aa4('0x1'));var interaction=require(_0x6aa4('0x2'));var controller=require('./mailInteraction.controller');router[_0x6aa4('0x3')]('/',auth['isAuthenticated'](),controller[_0x6aa4('0x4')]);router[_0x6aa4('0x3')]('/describe',auth['isAuthenticated'](),controller[_0x6aa4('0x5')]);router[_0x6aa4('0x3')](_0x6aa4('0x6'),auth['isAuthenticated'](),controller[_0x6aa4('0x7')]);router[_0x6aa4('0x3')]('/:id/messages',auth[_0x6aa4('0x8')](),controller[_0x6aa4('0x9')]);router[_0x6aa4('0x3')]('/:id/download',auth[_0x6aa4('0x8')](),controller['download']);router[_0x6aa4('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6aa4('0xa')](_0x6aa4('0xb'),auth[_0x6aa4('0x8')](),controller[_0x6aa4('0xc')]);router[_0x6aa4('0xa')](_0x6aa4('0xd'),auth[_0x6aa4('0x8')](),interaction['tracked']('mail',_0x6aa4('0xe')),controller[_0x6aa4('0xf')]);router[_0x6aa4('0x10')](_0x6aa4('0x6'),auth['isAuthenticated'](),interaction[_0x6aa4('0x11')](_0x6aa4('0x12'),'mailinteraction:update'),controller[_0x6aa4('0x13')]);router[_0x6aa4('0x14')]('/:id',auth[_0x6aa4('0x8')](),interaction[_0x6aa4('0x11')](_0x6aa4('0x12'),_0x6aa4('0x15')),controller[_0x6aa4('0x16')]);router[_0x6aa4('0x14')](_0x6aa4('0xd'),auth[_0x6aa4('0x8')](),controller[_0x6aa4('0x17')]);module[_0x6aa4('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 5f10866..72aa52b 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 _0x0ddd=['TEXT','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','long'];(function(_0x1714e5,_0x38659e){var _0x37a0d2=function(_0x45f6bf){while(--_0x45f6bf){_0x1714e5['push'](_0x1714e5['shift']());}};_0x37a0d2(++_0x38659e);}(_0x0ddd,0xad));var _0xd0dd=function(_0x435fa4,_0x5d579f){_0x435fa4=_0x435fa4-0x0;var _0x35a3a3=_0x0ddd[_0x435fa4];return _0x35a3a3;};'use strict';var Sequelize=require(_0xd0dd('0x0'));var iconv=require(_0xd0dd('0x1'));module[_0xd0dd('0x2')]={'closed':{'type':Sequelize[_0xd0dd('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd0dd('0x4')]},'disposition':{'type':Sequelize[_0xd0dd('0x5')]},'secondDisposition':{'type':Sequelize[_0xd0dd('0x5')]},'thirdDisposition':{'type':Sequelize[_0xd0dd('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xd0dd('0x5')](0x1fe)},'to':{'type':Sequelize[_0xd0dd('0x5')]},'cc':{'type':Sequelize['TEXT'](_0xd0dd('0x6'))},'subject':{'type':Sequelize[_0xd0dd('0x7')]()},'attach':{'type':Sequelize[_0xd0dd('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd0dd('0x4')]},'substatus':{'type':Sequelize[_0xd0dd('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xd0dd('0x8')]('in',_0xd0dd('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd0dd('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xd0dd('0x8')]('in',_0xd0dd('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd0dd('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1607=['DATE','STRING','TEXT','long','ENUM','out','INTEGER','sequelize','iconv','exports','BOOLEAN'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x1607,0x75));var _0x7160=function(_0x54262a,_0x338649){_0x54262a=_0x54262a-0x0;var _0x342e2f=_0x1607[_0x54262a];return _0x342e2f;};'use strict';var Sequelize=require(_0x7160('0x0'));var iconv=require(_0x7160('0x1'));module[_0x7160('0x2')]={'closed':{'type':Sequelize[_0x7160('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7160('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7160('0x5')]},'note':{'type':Sequelize[_0x7160('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x7160('0x5')]},'cc':{'type':Sequelize[_0x7160('0x6')](_0x7160('0x7'))},'subject':{'type':Sequelize[_0x7160('0x6')]()},'attach':{'type':Sequelize[_0x7160('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x7160('0x4')]},'substatus':{'type':Sequelize[_0x7160('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x7160('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7160('0x8')]('in',_0x7160('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7160('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7160('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7160('0xa')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 0b51350..a7c3deb 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 _0x3784=['undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','stack','index','map','MailInteraction','rawAttributes','fieldName','key','getOptions','findAll','mail','user','catch','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','MailMessage','nolimit','order','sort','where','filters','pick','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','setTags','Tag','name','emit','download','toString','join','root','server','files','format','transcript-%d-%s.zip','attachments','push','Attachments','Messages','from','bcc','createdAt','get','each','missing.recipient@your.company.com','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','type','readFileSync','build','writeFileSync','unlinkSync','eml-format','bluebird','util','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','html-entities','defaults','redis','socket.io-emitter','./mailInteraction.socket','register','status','json','offset'];(function(_0x2518d9,_0x181bfd){var _0x3b2bb6=function(_0x37b0f5){while(--_0x37b0f5){_0x2518d9['push'](_0x2518d9['shift']());}};_0x3b2bb6(++_0x181bfd);}(_0x3784,0x137));var _0x4378=function(_0x36628b,_0x468f90){_0x36628b=_0x36628b-0x0;var _0xc15ef4=_0x3784[_0x36628b];return _0xc15ef4;};'use strict';var emlformat=require(_0x4378('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x4378('0x1'));var util=require(_0x4378('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x4378('0x3'));var juice=require(_0x4378('0x4'));var Redis=require(_0x4378('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x4378('0x6'));var logger=require(_0x4378('0x7'))(_0x4378('0x8'));var config=require(_0x4378('0x9'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x4378('0xa'));config['redis']=_[_0x4378('0xb')](config[_0x4378('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4378('0xd'))(new Redis(config[_0x4378('0xc')]));require(_0x4378('0xe'))[_0x4378('0xf')](socket);function respondWithStatusCode(_0x2fb781,_0xe908cf){_0xe908cf=_0xe908cf||0xcc;return function(_0x4f9499){if(_0x4f9499){return _0x2fb781['sendStatus'](_0xe908cf);}return _0x2fb781['status'](_0xe908cf)['end']();};}function respondWithResult(_0x46d08e,_0x492763){_0x492763=_0x492763||0xc8;return function(_0x3654c6){if(_0x3654c6){return _0x46d08e[_0x4378('0x10')](_0x492763)[_0x4378('0x11')](_0x3654c6);}};}function respondWithFilteredResult(_0x25a48c,_0x38d942){return function(_0x4ebf93){if(_0x4ebf93){var _0x3846a3=typeof _0x38d942[_0x4378('0x12')]===_0x4378('0x13')&&typeof _0x38d942[_0x4378('0x14')]===_0x4378('0x13');var _0x3b36d1=_0x4ebf93[_0x4378('0x15')];var _0x30de90=_0x3846a3?0x0:_0x38d942[_0x4378('0x12')];var _0x2596fa=_0x3846a3?_0x4ebf93[_0x4378('0x15')]:_0x38d942['offset']+_0x38d942[_0x4378('0x14')];var _0x5b91c9;if(_0x2596fa>=_0x3b36d1){_0x2596fa=_0x3b36d1;_0x5b91c9=0xc8;}else{_0x5b91c9=0xce;}_0x25a48c['status'](_0x5b91c9);return _0x25a48c[_0x4378('0x16')](_0x4378('0x17'),_0x30de90+'-'+_0x2596fa+'/'+_0x3b36d1)['json'](_0x4ebf93);}return null;};}function saveUpdates(_0x4a6fb7){return function(_0xa35b44){if(_0xa35b44){return _0xa35b44[_0x4378('0x18')](_0x4a6fb7)[_0x4378('0x19')](function(_0x14d190){return _0x14d190;});}return null;};}function removeEntity(_0xbc435c){return function(_0x2e44c2){if(_0x2e44c2){return _0x2e44c2[_0x4378('0x1a')]()[_0x4378('0x19')](function(){_0xbc435c[_0x4378('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a09a3){return function(_0x8cbf){if(!_0x8cbf){_0x4a09a3[_0x4378('0x1b')](0x194);}return _0x8cbf;};}function handleError(_0xab71ff,_0x2ca792){_0x2ca792=_0x2ca792||0x1f4;return function(_0x22c68d){logger[_0x4378('0x1c')](_0x22c68d[_0x4378('0x1d')]);if(_0x22c68d['name']){delete _0x22c68d['name'];}_0xab71ff[_0x4378('0x10')](_0x2ca792)['send'](_0x22c68d);};}exports[_0x4378('0x1e')]=function(_0x315dd3,_0x30bc30){var _0x198ff5={};var _0x3f971c=_[_0x4378('0x1f')](db[_0x4378('0x20')][_0x4378('0x21')],function(_0x467b3d){return{'name':_0x467b3d[_0x4378('0x22')],'type':_0x467b3d['type'][_0x4378('0x23')]};});_0x198ff5=qs[_0x4378('0x24')](_0x3f971c,_0x315dd3);return interaction[_0x4378('0x25')](_0x4378('0x26'),_0x315dd3['query'],_0x315dd3[_0x4378('0x27')],_0x198ff5,_0x3f971c)[_0x4378('0x19')](respondWithFilteredResult(_0x30bc30,_0x198ff5))[_0x4378('0x28')](handleError(_0x30bc30,null));};exports[_0x4378('0x29')]=function(_0x542aeb,_0x497728){var _0x316ac6={'raw':![],'where':{'id':_0x542aeb[_0x4378('0x2a')]['id']}},_0x3445c0={};_0x3445c0[_0x4378('0x2b')]=_[_0x4378('0x2c')](db[_0x4378('0x20')][_0x4378('0x21')]);_0x3445c0[_0x4378('0x2d')]=_[_0x4378('0x2c')](_0x542aeb[_0x4378('0x2d')]);_0x3445c0['filters']=_[_0x4378('0x2e')](_0x3445c0['model'],_0x3445c0[_0x4378('0x2d')]);_0x316ac6[_0x4378('0x2f')]=_['intersection'](_0x3445c0[_0x4378('0x2b')],qs[_0x4378('0x30')](_0x542aeb[_0x4378('0x2d')][_0x4378('0x30')]));_0x316ac6[_0x4378('0x2f')]=_0x316ac6[_0x4378('0x2f')][_0x4378('0x31')]?_0x316ac6[_0x4378('0x2f')]:_0x3445c0['model'];if(_0x542aeb[_0x4378('0x2d')][_0x4378('0x32')]){_0x316ac6[_0x4378('0x33')]=[{'all':!![]}];}_0x316ac6=_[_0x4378('0x34')]({},_0x316ac6,_0x542aeb[_0x4378('0x35')]);return db[_0x4378('0x20')][_0x4378('0x36')](_0x316ac6)[_0x4378('0x19')](handleEntityNotFound(_0x497728,null))[_0x4378('0x19')](respondWithResult(_0x497728,null))[_0x4378('0x28')](handleError(_0x497728,null));};exports['create']=function(_0x12aedd,_0x24633f){return db[_0x4378('0x20')][_0x4378('0x37')](_0x12aedd[_0x4378('0x38')],{})[_0x4378('0x19')](respondWithResult(_0x24633f,0xc9))[_0x4378('0x28')](handleError(_0x24633f,null));};exports['update']=function(_0x40ca00,_0x5db05f){if(_0x40ca00[_0x4378('0x38')]['id']){delete _0x40ca00['body']['id'];}return db[_0x4378('0x20')][_0x4378('0x36')]({'where':{'id':_0x40ca00[_0x4378('0x2a')]['id']}})[_0x4378('0x19')](handleEntityNotFound(_0x5db05f,null))[_0x4378('0x19')](saveUpdates(_0x40ca00[_0x4378('0x38')],null))[_0x4378('0x19')](respondWithResult(_0x5db05f,null))[_0x4378('0x28')](handleError(_0x5db05f,null));};exports[_0x4378('0x1a')]=function(_0x36cdd0,_0x5bc56a){return db[_0x4378('0x20')][_0x4378('0x36')]({'where':{'id':_0x36cdd0[_0x4378('0x2a')]['id']}})[_0x4378('0x19')](handleEntityNotFound(_0x5bc56a,null))[_0x4378('0x19')](removeEntity(_0x5bc56a,null))[_0x4378('0x28')](handleError(_0x5bc56a,null));};exports[_0x4378('0x39')]=function(_0x5d5381,_0x2d3fad){return db[_0x4378('0x20')][_0x4378('0x39')]()['then'](respondWithResult(_0x2d3fad,null))[_0x4378('0x28')](handleError(_0x2d3fad,null));};exports[_0x4378('0x3a')]=function(_0x337ec8,_0x1396c2){return db['MailMessage'][_0x4378('0x36')]({'where':{'id':_0x337ec8['params']['id']}})[_0x4378('0x19')](handleEntityNotFound(_0x1396c2,null))['then'](function(_0x28ad27){if(_0x28ad27){return _0x28ad27['addMessage'](_0x337ec8['body'][_0x4378('0x3b')],_[_0x4378('0x3c')](_0x337ec8[_0x4378('0x38')],[_0x4378('0x3b'),'id'])||{});}})[_0x4378('0x19')](respondWithResult(_0x1396c2,null))[_0x4378('0x28')](handleError(_0x1396c2,null));};exports[_0x4378('0x3d')]=function(_0xe4fa4a,_0x43e277){var _0x55c8bd={'raw':![],'where':{}};var _0x563631={};var _0x51bf21={'count':0x0,'rows':[]};return db['MailInteraction'][_0x4378('0x3e')]({'where':{'id':_0xe4fa4a[_0x4378('0x2a')]['id']}})[_0x4378('0x19')](handleEntityNotFound(_0x43e277,null))[_0x4378('0x19')](function(_0x4163d6){if(_0x4163d6){_0x563631[_0x4378('0x2b')]=_['keys'](db[_0x4378('0x3f')][_0x4378('0x21')]);_0x563631[_0x4378('0x2d')]=_['keys'](_0xe4fa4a[_0x4378('0x2d')]);_0x563631['filters']=_[_0x4378('0x2e')](_0x563631[_0x4378('0x2b')],_0x563631[_0x4378('0x2d')]);_0x55c8bd['attributes']=_['intersection'](_0x563631[_0x4378('0x2b')],qs[_0x4378('0x30')](_0xe4fa4a[_0x4378('0x2d')]['fields']));_0x55c8bd[_0x4378('0x2f')]=_0x55c8bd[_0x4378('0x2f')][_0x4378('0x31')]?_0x55c8bd[_0x4378('0x2f')]:_0x563631['model'];if(!_0xe4fa4a['query']['hasOwnProperty'](_0x4378('0x40'))){_0x55c8bd[_0x4378('0x14')]=qs[_0x4378('0x14')](_0xe4fa4a['query'][_0x4378('0x14')]);_0x55c8bd[_0x4378('0x12')]=qs[_0x4378('0x12')](_0xe4fa4a[_0x4378('0x2d')][_0x4378('0x12')]);}_0x55c8bd[_0x4378('0x41')]=qs[_0x4378('0x42')](_0xe4fa4a[_0x4378('0x2d')][_0x4378('0x42')]);_0x55c8bd[_0x4378('0x43')]=qs[_0x4378('0x44')](_[_0x4378('0x45')](_0xe4fa4a[_0x4378('0x2d')],_0x563631[_0x4378('0x44')]));_0x55c8bd[_0x4378('0x43')][_0x4378('0x46')]=_0x4163d6['id'];if(_0xe4fa4a[_0x4378('0x2d')][_0x4378('0x47')]){_0x55c8bd[_0x4378('0x43')]=_[_0x4378('0x34')](_0x55c8bd[_0x4378('0x43')],{'$or':_[_0x4378('0x1f')](_0x55c8bd[_0x4378('0x2f')],function(_0x4cf1e8){var _0x2d5ee9={};_0x2d5ee9[_0x4cf1e8]={'$like':'%'+_0xe4fa4a[_0x4378('0x2d')][_0x4378('0x47')]+'%'};return _0x2d5ee9;})});}if(_0xe4fa4a[_0x4378('0x2d')][_0x4378('0x48')]){var _0x221c18=_0xe4fa4a[_0x4378('0x2d')]['$gte'][_0x4378('0x49')](',');var _0x5631c0={};_0x5631c0[_0x221c18[0x0]]={'$gte':moment(_0x221c18[0x1])['format'](_0x4378('0x4a'))};_0x55c8bd['where']=_[_0x4378('0x34')](_0x55c8bd[_0x4378('0x43')],_0x5631c0);}_0x55c8bd=_[_0x4378('0x34')]({},_0x55c8bd,_0xe4fa4a[_0x4378('0x35')]);return db[_0x4378('0x3f')][_0x4378('0x15')]({'where':_0x55c8bd[_0x4378('0x43')]})[_0x4378('0x19')](function(_0x4ec957){_0x51bf21[_0x4378('0x15')]=_0x4ec957;if(_0xe4fa4a[_0x4378('0x2d')][_0x4378('0x32')]){_0x55c8bd[_0x4378('0x33')]=[{'all':!![]}];}return db[_0x4378('0x3f')]['findAll'](_0x55c8bd);})[_0x4378('0x19')](function(_0x462fae){if(_0xe4fa4a[_0x4378('0x2d')][_0x4378('0x4b')]===_0x4378('0x4c')){for(var _0x515f61=0x0;_0x515f61<_0x462fae[_0x4378('0x31')];_0x515f61++){_0x462fae[_0x515f61][_0x4378('0x38')]=juice(_0x462fae[_0x515f61]['body']);}}_0x51bf21[_0x4378('0x4d')]=_0x462fae;return _0x51bf21;});}})[_0x4378('0x19')](respondWithFilteredResult(_0x43e277,_0x55c8bd))[_0x4378('0x28')](handleError(_0x43e277,null));};exports['addTags']=function(_0x3d3376,_0x1c3d93){return db[_0x4378('0x20')][_0x4378('0x36')]({'where':{'id':_0x3d3376['params']['id']}})['then'](handleEntityNotFound(_0x1c3d93,null))[_0x4378('0x19')](function(_0x561006){if(_0x561006){return _0x561006[_0x4378('0x4e')](_0x3d3376[_0x4378('0x38')][_0x4378('0x3b')],_[_0x4378('0x3c')](_0x3d3376[_0x4378('0x38')],[_0x4378('0x3b'),'id'])||{})['spread'](function(){return db[_0x4378('0x4f')][_0x4378('0x25')]({'attributes':['id',_0x4378('0x50'),'color'],'where':{'id':_0x3d3376['body']['ids']}});})['then'](function(_0x1eef4e){socket[_0x4378('0x51')]('mailInteractionTags:save',{'id':Number(_0x3d3376[_0x4378('0x2a')]['id']),'tags':_0x1eef4e||[]});return{'id':Number(_0x3d3376['params']['id']),'tags':_0x1eef4e||[]};});}})[_0x4378('0x19')](respondWithResult(_0x1c3d93,null))[_0x4378('0x28')](handleError(_0x1c3d93,null));};exports['removeTags']=function(_0x3f4076,_0x3029f4){return db[_0x4378('0x20')][_0x4378('0x36')]({'where':{'id':_0x3f4076[_0x4378('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3029f4,null))['then'](function(_0x1927b9){if(_0x1927b9){return _0x1927b9['removeTags'](_0x3f4076['query'][_0x4378('0x3b')]);}})[_0x4378('0x19')](respondWithStatusCode(_0x3029f4,null))['catch'](handleError(_0x3029f4,null));};exports[_0x4378('0x52')]=function(_0x3a555f,_0x55d11d){var _0x622527=moment()['unix']()[_0x4378('0x53')]();var _0x1a05a8=path[_0x4378('0x54')](config[_0x4378('0x55')],_0x4378('0x56'),_0x4378('0x57'),'tmp');var _0x5412ca=path[_0x4378('0x54')](config[_0x4378('0x55')],'server','files','attachments');var _0x37b234=path[_0x4378('0x54')](_0x1a05a8,_0x622527);var _0x2ce001=util[_0x4378('0x58')](_0x4378('0x59'),_0x3a555f[_0x4378('0x2a')]['id'],_0x622527);var _0x40440a=path[_0x4378('0x54')](_0x1a05a8,_0x2ce001);var _0x4ac7d5=[];if(_0x3a555f['query'][_0x4378('0x5a')]){_0x4ac7d5[_0x4378('0x5b')]({'model':db['Attachment'],'as':_0x4378('0x5c'),'raw':!![]});}var _0x60f8b9=[{'model':db[_0x4378('0x3f')],'as':_0x4378('0x5d'),'attributes':['id','body',_0x4378('0x5e'),'to','cc',_0x4378('0x5f'),'subject',_0x4378('0x60')],'where':{'secret':![]},'order':qs[_0x4378('0x42')]('id'),'include':_0x4ac7d5}];return db['MailInteraction'][_0x4378('0x36')]({'where':{'id':_0x3a555f[_0x4378('0x2a')]['id']},'include':_0x60f8b9})[_0x4378('0x19')](handleEntityNotFound(_0x55d11d,null))['then'](function(_0x526a14){if(_0x526a14&&_0x526a14[_0x4378('0x5d')]){var _0x1fb8c9=_0x526a14[_0x4378('0x61')]({'plain':!![]});fs['mkdirSync'](_0x37b234);return BPromise[_0x4378('0x62')](_0x1fb8c9[_0x4378('0x5d')],function(_0x7d07dc,_0x550e5c){var _0x558533={'from':_0x7d07dc[_0x4378('0x5e')],'to':_0x7d07dc['to']||_0x4378('0x63'),'subject':_0x7d07dc[_0x4378('0x64')],'html':htmlEntities['decode'](_0x7d07dc[_0x4378('0x38')]),'headers':{'Date':moment(_0x7d07dc[_0x4378('0x60')])[_0x4378('0x58')](_0x4378('0x65'))},'attachments':[]};if(_0x7d07dc['cc']){_0x558533[_0x4378('0x66')]['Cc']=_0x7d07dc['cc'];}if(_0x7d07dc['bcc']){_0x558533[_0x4378('0x66')][_0x4378('0x67')]=_0x7d07dc[_0x4378('0x5f')];}return new BPromise(function(_0x4cefe2,_0xa8944a){if(_0x7d07dc[_0x4378('0x5c')]){for(var _0x585360=0x0;_0x585360<_0x7d07dc[_0x4378('0x5c')][_0x4378('0x31')];_0x585360++){var _0x17f908=_0x7d07dc[_0x4378('0x5c')][_0x585360];var _0x2cf14e=path[_0x4378('0x54')](_0x5412ca,_0x17f908[_0x4378('0x68')]);if(fs['existsSync'](_0x2cf14e)){_0x558533[_0x4378('0x5a')][_0x4378('0x5b')]({'name':_0x17f908[_0x4378('0x50')],'contentType':_0x17f908[_0x4378('0x69')],'data':fs[_0x4378('0x6a')](_0x2cf14e)});}}}emlformat[_0x4378('0x6b')](_0x558533,function(_0x361c3a,_0x3307d){if(_0x361c3a)return _0xa8944a(_0x361c3a);fs[_0x4378('0x6c')](path[_0x4378('0x54')](_0x37b234,util[_0x4378('0x58')]('message%d.eml',_0x550e5c)),_0x3307d);return _0x4cefe2(_0x3307d);});});})[_0x4378('0x19')](function(){return new BPromise(function(_0x468448,_0x4dddec){zipdir(_0x37b234,{'saveTo':_0x40440a},function(_0x5376c4,_0x5c7a28){if(_0x5376c4)return _0x4dddec(_0x5376c4);return _0x468448(_0x5c7a28);});})['then'](function(){return new BPromise(function(_0x1a2647,_0x2d0006){rimraf(_0x37b234,function(_0xf88460){if(_0xf88460)_0x2d0006(_0xf88460);return _0x1a2647();});});})[_0x4378('0x19')](function(){return _0x55d11d[_0x4378('0x52')](_0x40440a,_0x2ce001,function(_0x1bbcc6){if(!_0x1bbcc6)fs[_0x4378('0x6d')](_0x40440a);});});});}else{return _0x55d11d[_0x4378('0x1b')](0xc8);}})['catch'](handleError(_0x55d11d,null));}; \ No newline at end of file +var _0xf4d2=['bcc','headers','Bcc','Attachments','basename','type','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','moment','bluebird','util','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','html-entities','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','stack','name','send','index','map','MailInteraction','rawAttributes','getOptions','mail','query','user','catch','show','params','model','filters','attributes','intersection','length','includeAll','include','merge','options','find','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','keys','fields','order','sort','where','pick','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','transcript-%d-%s.zip','push','createdAt','Messages','get','mkdirSync','each','from','missing.recipient@your.company.com','decode'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xf4d2,0x78));var _0x2f4d=function(_0xbb25f,_0x4d988b){_0xbb25f=_0xbb25f-0x0;var _0xf9e79c=_0xf4d2[_0xbb25f];return _0xf9e79c;};'use strict';var emlformat=require(_0x2f4d('0x0'));var rimraf=require(_0x2f4d('0x1'));var zipdir=require('zip-dir');var moment=require(_0x2f4d('0x2'));var BPromise=require(_0x2f4d('0x3'));var util=require(_0x2f4d('0x4'));var path=require('path');var fs=require('fs');var _=require('lodash');var juice=require(_0x2f4d('0x5'));var Redis=require(_0x2f4d('0x6'));var interaction=require(_0x2f4d('0x7'));var qs=require(_0x2f4d('0x8'));var logger=require('../../config/logger')(_0x2f4d('0x9'));var config=require(_0x2f4d('0xa'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x2f4d('0xb'));config['redis']=_[_0x2f4d('0xc')](config[_0x2f4d('0xd')],{'host':_0x2f4d('0xe'),'port':0x18eb});var socket=require(_0x2f4d('0xf'))(new Redis(config[_0x2f4d('0xd')]));require(_0x2f4d('0x10'))[_0x2f4d('0x11')](socket);function respondWithStatusCode(_0x49878e,_0x55b845){_0x55b845=_0x55b845||0xcc;return function(_0x319c7){if(_0x319c7){return _0x49878e[_0x2f4d('0x12')](_0x55b845);}return _0x49878e[_0x2f4d('0x13')](_0x55b845)[_0x2f4d('0x14')]();};}function respondWithResult(_0x57cf0d,_0x4ded13){_0x4ded13=_0x4ded13||0xc8;return function(_0x5ea910){if(_0x5ea910){return _0x57cf0d['status'](_0x4ded13)[_0x2f4d('0x15')](_0x5ea910);}};}function respondWithFilteredResult(_0x3b560d,_0x46737e){return function(_0x1b4b7f){if(_0x1b4b7f){var _0x2385ef=typeof _0x46737e[_0x2f4d('0x16')]===_0x2f4d('0x17')&&typeof _0x46737e['limit']===_0x2f4d('0x17');var _0x53d1f5=_0x1b4b7f['count'];var _0xc75384=_0x2385ef?0x0:_0x46737e['offset'];var _0xa02a7=_0x2385ef?_0x1b4b7f[_0x2f4d('0x18')]:_0x46737e[_0x2f4d('0x16')]+_0x46737e[_0x2f4d('0x19')];var _0x360ba7;if(_0xa02a7>=_0x53d1f5){_0xa02a7=_0x53d1f5;_0x360ba7=0xc8;}else{_0x360ba7=0xce;}_0x3b560d[_0x2f4d('0x13')](_0x360ba7);return _0x3b560d[_0x2f4d('0x1a')](_0x2f4d('0x1b'),_0xc75384+'-'+_0xa02a7+'/'+_0x53d1f5)['json'](_0x1b4b7f);}return null;};}function saveUpdates(_0x768713){return function(_0x3336f8){if(_0x3336f8){return _0x3336f8[_0x2f4d('0x1c')](_0x768713)[_0x2f4d('0x1d')](function(_0x529b16){return _0x529b16;});}return null;};}function removeEntity(_0x10a18c){return function(_0x537afe){if(_0x537afe){return _0x537afe[_0x2f4d('0x1e')]()['then'](function(){_0x10a18c['status'](0xcc)[_0x2f4d('0x14')]();});}};}function handleEntityNotFound(_0x4f5ab5){return function(_0x385841){if(!_0x385841){_0x4f5ab5['sendStatus'](0x194);}return _0x385841;};}function handleError(_0x622d00,_0x35e4cf){_0x35e4cf=_0x35e4cf||0x1f4;return function(_0x3178bd){logger['error'](_0x3178bd[_0x2f4d('0x1f')]);if(_0x3178bd[_0x2f4d('0x20')]){delete _0x3178bd[_0x2f4d('0x20')];}_0x622d00[_0x2f4d('0x13')](_0x35e4cf)[_0x2f4d('0x21')](_0x3178bd);};}exports[_0x2f4d('0x22')]=function(_0x52cab2,_0x319f93){var _0x1b4b44={};var _0x143a48=_[_0x2f4d('0x23')](db[_0x2f4d('0x24')][_0x2f4d('0x25')],function(_0x5f1ccc){return{'name':_0x5f1ccc['fieldName'],'type':_0x5f1ccc['type']['key']};});_0x1b4b44=qs[_0x2f4d('0x26')](_0x143a48,_0x52cab2);return interaction['findAll'](_0x2f4d('0x27'),_0x52cab2[_0x2f4d('0x28')],_0x52cab2[_0x2f4d('0x29')],_0x1b4b44,_0x143a48)[_0x2f4d('0x1d')](respondWithFilteredResult(_0x319f93,_0x1b4b44))[_0x2f4d('0x2a')](handleError(_0x319f93,null));};exports[_0x2f4d('0x2b')]=function(_0x22c594,_0x579c8f){var _0xe374be={'raw':![],'where':{'id':_0x22c594[_0x2f4d('0x2c')]['id']}},_0x12d3a2={};_0x12d3a2[_0x2f4d('0x2d')]=_['keys'](db[_0x2f4d('0x24')][_0x2f4d('0x25')]);_0x12d3a2['query']=_['keys'](_0x22c594[_0x2f4d('0x28')]);_0x12d3a2[_0x2f4d('0x2e')]=_['intersection'](_0x12d3a2[_0x2f4d('0x2d')],_0x12d3a2['query']);_0xe374be[_0x2f4d('0x2f')]=_[_0x2f4d('0x30')](_0x12d3a2['model'],qs['fields'](_0x22c594[_0x2f4d('0x28')]['fields']));_0xe374be['attributes']=_0xe374be[_0x2f4d('0x2f')][_0x2f4d('0x31')]?_0xe374be[_0x2f4d('0x2f')]:_0x12d3a2[_0x2f4d('0x2d')];if(_0x22c594[_0x2f4d('0x28')][_0x2f4d('0x32')]){_0xe374be[_0x2f4d('0x33')]=[{'all':!![]}];}_0xe374be=_[_0x2f4d('0x34')]({},_0xe374be,_0x22c594[_0x2f4d('0x35')]);return db[_0x2f4d('0x24')][_0x2f4d('0x36')](_0xe374be)[_0x2f4d('0x1d')](handleEntityNotFound(_0x579c8f,null))[_0x2f4d('0x1d')](respondWithResult(_0x579c8f,null))[_0x2f4d('0x2a')](handleError(_0x579c8f,null));};exports[_0x2f4d('0x37')]=function(_0x396202,_0x3dedc9){return db[_0x2f4d('0x24')]['create'](_0x396202['body'],{})[_0x2f4d('0x1d')](respondWithResult(_0x3dedc9,0xc9))[_0x2f4d('0x2a')](handleError(_0x3dedc9,null));};exports['update']=function(_0x24ead2,_0x38993c){if(_0x24ead2[_0x2f4d('0x38')]['id']){delete _0x24ead2[_0x2f4d('0x38')]['id'];}return db[_0x2f4d('0x24')][_0x2f4d('0x36')]({'where':{'id':_0x24ead2[_0x2f4d('0x2c')]['id']}})[_0x2f4d('0x1d')](handleEntityNotFound(_0x38993c,null))['then'](saveUpdates(_0x24ead2['body'],null))[_0x2f4d('0x1d')](respondWithResult(_0x38993c,null))['catch'](handleError(_0x38993c,null));};exports[_0x2f4d('0x1e')]=function(_0x22d515,_0x536a60){return db[_0x2f4d('0x24')][_0x2f4d('0x36')]({'where':{'id':_0x22d515[_0x2f4d('0x2c')]['id']}})[_0x2f4d('0x1d')](handleEntityNotFound(_0x536a60,null))[_0x2f4d('0x1d')](removeEntity(_0x536a60,null))['catch'](handleError(_0x536a60,null));};exports[_0x2f4d('0x39')]=function(_0x18bc99,_0x4220f9){return db[_0x2f4d('0x24')][_0x2f4d('0x39')]()[_0x2f4d('0x1d')](respondWithResult(_0x4220f9,null))[_0x2f4d('0x2a')](handleError(_0x4220f9,null));};exports[_0x2f4d('0x3a')]=function(_0x5aab2c,_0x5214a7){return db[_0x2f4d('0x3b')]['find']({'where':{'id':_0x5aab2c[_0x2f4d('0x2c')]['id']}})[_0x2f4d('0x1d')](handleEntityNotFound(_0x5214a7,null))['then'](function(_0x32524b){if(_0x32524b){return _0x32524b['addMessage'](_0x5aab2c[_0x2f4d('0x38')][_0x2f4d('0x3c')],_[_0x2f4d('0x3d')](_0x5aab2c[_0x2f4d('0x38')],['ids','id'])||{});}})[_0x2f4d('0x1d')](respondWithResult(_0x5214a7,null))['catch'](handleError(_0x5214a7,null));};exports[_0x2f4d('0x3e')]=function(_0x9a8eed,_0x5924d1){var _0xd3ca4d={'raw':![],'where':{}};var _0x387c96={};var _0x5a2c5c={'count':0x0,'rows':[]};return db[_0x2f4d('0x24')][_0x2f4d('0x3f')]({'where':{'id':_0x9a8eed[_0x2f4d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5924d1,null))[_0x2f4d('0x1d')](function(_0x193678){if(_0x193678){_0x387c96[_0x2f4d('0x2d')]=_['keys'](db[_0x2f4d('0x3b')]['rawAttributes']);_0x387c96[_0x2f4d('0x28')]=_[_0x2f4d('0x40')](_0x9a8eed[_0x2f4d('0x28')]);_0x387c96['filters']=_[_0x2f4d('0x30')](_0x387c96[_0x2f4d('0x2d')],_0x387c96[_0x2f4d('0x28')]);_0xd3ca4d[_0x2f4d('0x2f')]=_[_0x2f4d('0x30')](_0x387c96['model'],qs[_0x2f4d('0x41')](_0x9a8eed[_0x2f4d('0x28')][_0x2f4d('0x41')]));_0xd3ca4d[_0x2f4d('0x2f')]=_0xd3ca4d[_0x2f4d('0x2f')][_0x2f4d('0x31')]?_0xd3ca4d[_0x2f4d('0x2f')]:_0x387c96['model'];if(!_0x9a8eed[_0x2f4d('0x28')]['hasOwnProperty']('nolimit')){_0xd3ca4d[_0x2f4d('0x19')]=qs[_0x2f4d('0x19')](_0x9a8eed['query'][_0x2f4d('0x19')]);_0xd3ca4d[_0x2f4d('0x16')]=qs[_0x2f4d('0x16')](_0x9a8eed[_0x2f4d('0x28')][_0x2f4d('0x16')]);}_0xd3ca4d[_0x2f4d('0x42')]=qs[_0x2f4d('0x43')](_0x9a8eed['query'][_0x2f4d('0x43')]);_0xd3ca4d[_0x2f4d('0x44')]=qs[_0x2f4d('0x2e')](_[_0x2f4d('0x45')](_0x9a8eed[_0x2f4d('0x28')],_0x387c96['filters']));_0xd3ca4d[_0x2f4d('0x44')]['MailInteractionId']=_0x193678['id'];if(_0x9a8eed[_0x2f4d('0x28')][_0x2f4d('0x46')]){_0xd3ca4d[_0x2f4d('0x44')]=_[_0x2f4d('0x34')](_0xd3ca4d[_0x2f4d('0x44')],{'$or':_[_0x2f4d('0x23')](_0xd3ca4d['attributes'],function(_0x3e8a97){var _0x5c709c={};_0x5c709c[_0x3e8a97]={'$like':'%'+_0x9a8eed[_0x2f4d('0x28')][_0x2f4d('0x46')]+'%'};return _0x5c709c;})});}if(_0x9a8eed[_0x2f4d('0x28')][_0x2f4d('0x47')]){var _0x20f1d2=_0x9a8eed[_0x2f4d('0x28')][_0x2f4d('0x47')]['split'](',');var _0xc98817={};_0xc98817[_0x20f1d2[0x0]]={'$gte':moment(_0x20f1d2[0x1])[_0x2f4d('0x48')](_0x2f4d('0x49'))};_0xd3ca4d[_0x2f4d('0x44')]=_[_0x2f4d('0x34')](_0xd3ca4d['where'],_0xc98817);}_0xd3ca4d=_['merge']({},_0xd3ca4d,_0x9a8eed[_0x2f4d('0x35')]);return db[_0x2f4d('0x3b')][_0x2f4d('0x18')]({'where':_0xd3ca4d['where']})[_0x2f4d('0x1d')](function(_0x32175f){_0x5a2c5c[_0x2f4d('0x18')]=_0x32175f;if(_0x9a8eed['query'][_0x2f4d('0x32')]){_0xd3ca4d[_0x2f4d('0x33')]=[{'all':!![]}];}return db[_0x2f4d('0x3b')][_0x2f4d('0x4a')](_0xd3ca4d);})[_0x2f4d('0x1d')](function(_0x18fd65){if(_0x9a8eed[_0x2f4d('0x28')]['inlineCss']==='true'){for(var _0x59ef81=0x0;_0x59ef81<_0x18fd65[_0x2f4d('0x31')];_0x59ef81++){_0x18fd65[_0x59ef81]['body']=juice(_0x18fd65[_0x59ef81][_0x2f4d('0x38')]);}}_0x5a2c5c[_0x2f4d('0x4b')]=_0x18fd65;return _0x5a2c5c;});}})[_0x2f4d('0x1d')](respondWithFilteredResult(_0x5924d1,_0xd3ca4d))[_0x2f4d('0x2a')](handleError(_0x5924d1,null));};exports[_0x2f4d('0x4c')]=function(_0x287a38,_0x1d7136){return db['MailInteraction']['find']({'where':{'id':_0x287a38[_0x2f4d('0x2c')]['id']}})[_0x2f4d('0x1d')](handleEntityNotFound(_0x1d7136,null))[_0x2f4d('0x1d')](function(_0x1475b6){if(_0x1475b6){return _0x1475b6['setTags'](_0x287a38[_0x2f4d('0x38')]['ids'],_[_0x2f4d('0x3d')](_0x287a38['body'],[_0x2f4d('0x3c'),'id'])||{})['spread'](function(){return db[_0x2f4d('0x4d')][_0x2f4d('0x4a')]({'attributes':['id',_0x2f4d('0x20'),_0x2f4d('0x4e')],'where':{'id':_0x287a38[_0x2f4d('0x38')][_0x2f4d('0x3c')]}});})[_0x2f4d('0x1d')](function(_0x5bec21){socket[_0x2f4d('0x4f')](_0x2f4d('0x50'),{'id':Number(_0x287a38['params']['id']),'tags':_0x5bec21||[]});return{'id':Number(_0x287a38[_0x2f4d('0x2c')]['id']),'tags':_0x5bec21||[]};});}})[_0x2f4d('0x1d')](respondWithResult(_0x1d7136,null))[_0x2f4d('0x2a')](handleError(_0x1d7136,null));};exports['removeTags']=function(_0x398102,_0x18d188){return db[_0x2f4d('0x24')]['find']({'where':{'id':_0x398102[_0x2f4d('0x2c')]['id']}})[_0x2f4d('0x1d')](handleEntityNotFound(_0x18d188,null))['then'](function(_0xc0ebc3){if(_0xc0ebc3){return _0xc0ebc3[_0x2f4d('0x51')](_0x398102[_0x2f4d('0x28')][_0x2f4d('0x3c')]);}})[_0x2f4d('0x1d')](respondWithStatusCode(_0x18d188,null))['catch'](handleError(_0x18d188,null));};exports[_0x2f4d('0x52')]=function(_0x4b6824,_0x52d7bb){var _0x158cc8=moment()[_0x2f4d('0x53')]()[_0x2f4d('0x54')]();var _0xd30d21=path['join'](config[_0x2f4d('0x55')],_0x2f4d('0x56'),_0x2f4d('0x57'),_0x2f4d('0x58'));var _0x598ce3=path[_0x2f4d('0x59')](config[_0x2f4d('0x55')],_0x2f4d('0x56'),_0x2f4d('0x57'),'attachments');var _0x3c3e30=path[_0x2f4d('0x59')](_0xd30d21,_0x158cc8);var _0x4be56b=util[_0x2f4d('0x48')](_0x2f4d('0x5a'),_0x4b6824[_0x2f4d('0x2c')]['id'],_0x158cc8);var _0x3ad5aa=path[_0x2f4d('0x59')](_0xd30d21,_0x4be56b);var _0x5e92f3=[];if(_0x4b6824[_0x2f4d('0x28')]['attachments']){_0x5e92f3[_0x2f4d('0x5b')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0xdde44a=[{'model':db[_0x2f4d('0x3b')],'as':'Messages','attributes':['id',_0x2f4d('0x38'),'from','to','cc','bcc','subject',_0x2f4d('0x5c')],'where':{'secret':![]},'order':qs[_0x2f4d('0x43')]('id'),'include':_0x5e92f3}];return db[_0x2f4d('0x24')]['find']({'where':{'id':_0x4b6824[_0x2f4d('0x2c')]['id']},'include':_0xdde44a})[_0x2f4d('0x1d')](handleEntityNotFound(_0x52d7bb,null))[_0x2f4d('0x1d')](function(_0x57f9ac){if(_0x57f9ac&&_0x57f9ac[_0x2f4d('0x5d')]){var _0x31c2c1=_0x57f9ac[_0x2f4d('0x5e')]({'plain':!![]});fs[_0x2f4d('0x5f')](_0x3c3e30);return BPromise[_0x2f4d('0x60')](_0x31c2c1[_0x2f4d('0x5d')],function(_0x5f47c2,_0xdd069e){var _0x602403={'from':_0x5f47c2[_0x2f4d('0x61')],'to':_0x5f47c2['to']||_0x2f4d('0x62'),'subject':_0x5f47c2['subject'],'html':htmlEntities[_0x2f4d('0x63')](_0x5f47c2[_0x2f4d('0x38')]),'headers':{'Date':moment(_0x5f47c2['createdAt'])[_0x2f4d('0x48')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x5f47c2['cc']){_0x602403['headers']['Cc']=_0x5f47c2['cc'];}if(_0x5f47c2[_0x2f4d('0x64')]){_0x602403[_0x2f4d('0x65')][_0x2f4d('0x66')]=_0x5f47c2[_0x2f4d('0x64')];}return new BPromise(function(_0x360b61,_0x7b39eb){if(_0x5f47c2[_0x2f4d('0x67')]){for(var _0x14821a=0x0;_0x14821a<_0x5f47c2['Attachments'][_0x2f4d('0x31')];_0x14821a++){var _0x77a824=_0x5f47c2[_0x2f4d('0x67')][_0x14821a];var _0x339c13=path[_0x2f4d('0x59')](_0x598ce3,_0x77a824[_0x2f4d('0x68')]);if(fs['existsSync'](_0x339c13)){_0x602403['attachments'][_0x2f4d('0x5b')]({'name':_0x77a824[_0x2f4d('0x20')],'contentType':_0x77a824[_0x2f4d('0x69')],'data':fs['readFileSync'](_0x339c13)});}}}emlformat[_0x2f4d('0x6a')](_0x602403,function(_0xe3b79a,_0x13dced){if(_0xe3b79a)return _0x7b39eb(_0xe3b79a);fs[_0x2f4d('0x6b')](path[_0x2f4d('0x59')](_0x3c3e30,util[_0x2f4d('0x48')](_0x2f4d('0x6c'),_0xdd069e)),_0x13dced);return _0x360b61(_0x13dced);});});})[_0x2f4d('0x1d')](function(){return new BPromise(function(_0xedd213,_0xad7b29){zipdir(_0x3c3e30,{'saveTo':_0x3ad5aa},function(_0x400e3e,_0x173141){if(_0x400e3e)return _0xad7b29(_0x400e3e);return _0xedd213(_0x173141);});})[_0x2f4d('0x1d')](function(){return new BPromise(function(_0x29bd40,_0xb1848){rimraf(_0x3c3e30,function(_0x578d52){if(_0x578d52)_0xb1848(_0x578d52);return _0x29bd40();});});})['then'](function(){return _0x52d7bb[_0x2f4d('0x52')](_0x3ad5aa,_0x4be56b,function(_0x4ec167){if(!_0x4ec167)fs[_0x2f4d('0x6d')](_0x3ad5aa);});});});}else{return _0x52d7bb[_0x2f4d('0x12')](0xc8);}})[_0x2f4d('0x2a')](handleError(_0x52d7bb,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index c75b289..9f5a055 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 _0x720f=['map','findAll','length','emit','catch','hasOwnProperty','hook','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','update','remove','then','setDataValue','Users'];(function(_0x413051,_0x4f5a49){var _0x363295=function(_0x23695c){while(--_0x23695c){_0x413051['push'](_0x413051['shift']());}};_0x363295(++_0x4f5a49);}(_0x720f,0x197));var _0xf720=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x720f[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0xf720('0x0')];var MailMessage=require(_0xf720('0x1'))['db'][_0xf720('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf720('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf720('0x4'),'afterDestroy':_0xf720('0x5')};function emitEvent(_0x16c48e){return function(_0x5cb470,_0x224da3,_0x38f033){_0x5cb470['getUsers']({'attributes':['id'],'raw':!![]})[_0xf720('0x6')](function(_0xb96e33){_0x5cb470[_0xf720('0x7')](_0xf720('0x8'),_0xb96e33[_0xf720('0x9')](function(_0x1a2a47){return{'id':_0x1a2a47['id']};}));return MailMessage[_0xf720('0xa')]({'where':{'MailInteractionId':_0x5cb470['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf720('0x6')](function(_0x1b7e97){_0x5cb470[_0xf720('0x7')]('unreadMessages',_0x1b7e97[_0xf720('0xb')]);MailInteractionEvents[_0xf720('0xc')](_0x16c48e+':'+_0x5cb470['id'],_0x5cb470);MailInteractionEvents[_0xf720('0xc')](_0x16c48e,_0x5cb470);_0x38f033(null);})[_0xf720('0xd')](_0x38f033(null));};}for(var e in events){if(events[_0xf720('0xe')](e)){var event=events[e];MailInteraction[_0xf720('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x0d82=['MailInteraction','setMaxListeners','save','remove','getUsers','then','setDataValue','unreadMessages','length','emit','hook','exports'];(function(_0x28aebb,_0x25ddee){var _0x282e8e=function(_0xf1cf70){while(--_0xf1cf70){_0x28aebb['push'](_0x28aebb['shift']());}};_0x282e8e(++_0x25ddee);}(_0x0d82,0x1bc));var _0x20d8=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x0d82[_0x273c39];return _0x46d6b5;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x20d8('0x0')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x20d8('0x1')](0x0);var events={'afterCreate':_0x20d8('0x2'),'afterUpdate':'update','afterDestroy':_0x20d8('0x3')};function emitEvent(_0x3e2324){return function(_0x294fc6,_0x371851,_0xd05948){_0x294fc6[_0x20d8('0x4')]({'attributes':['id'],'raw':!![]})[_0x20d8('0x5')](function(_0x2c8bc9){_0x294fc6[_0x20d8('0x6')]('Users',_0x2c8bc9['map'](function(_0x45c1e6){return{'id':_0x45c1e6['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x294fc6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x20d8('0x5')](function(_0x5566cb){_0x294fc6[_0x20d8('0x6')](_0x20d8('0x7'),_0x5566cb[_0x20d8('0x8')]);MailInteractionEvents['emit'](_0x3e2324+':'+_0x294fc6['id'],_0x294fc6);MailInteractionEvents[_0x20d8('0x9')](_0x3e2324,_0x294fc6);_0xd05948(null);})['catch'](_0xd05948(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x20d8('0xa')](e,emitEvent(event));}}module[_0x20d8('0xb')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 99a3ed1..d135eca 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 _0x90ec=['api','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','fti_mail_interactions','subject','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','models','update','then','catch','utf8mb4','lodash','util','../../config/logger'];(function(_0x45d686,_0x58077e){var _0x2fef28=function(_0x5bdcac){while(--_0x5bdcac){_0x45d686['push'](_0x45d686['shift']());}};_0x2fef28(++_0x58077e);}(_0x90ec,0x1f1));var _0xc90e=function(_0x59478e,_0x5d98d6){_0x59478e=_0x59478e-0x0;var _0x3c6ea1=_0x90ec[_0x59478e];return _0x3c6ea1;};'use strict';var _=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var logger=require(_0xc90e('0x2'))(_0xc90e('0x3'));var moment=require('moment');var BPromise=require(_0xc90e('0x4'));var rp=require(_0xc90e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc90e('0x6'));var config=require(_0xc90e('0x7'));var attributes=require(_0xc90e('0x8'));module[_0xc90e('0x9')]=function(_0x2c0e1e,_0x7eb20a){return _0x2c0e1e[_0xc90e('0xa')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xc90e('0xb'),'fields':[_0xc90e('0xc'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x155a03,_0x468728,_0x584dcf){if(_0x155a03[_0xc90e('0xd')]){_0x155a03[_0xc90e('0xe')]=moment()['format'](_0xc90e('0xf'));}if(_0x155a03[_0xc90e('0x10')]){_0x155a03[_0xc90e('0x11')]=moment()[_0xc90e('0x12')](_0xc90e('0xf'));}_0x584dcf(null,_0x468728);},'beforeUpdate':function(_0x32514c,_0x4a0add,_0x3617b6){if(_0x32514c[_0xc90e('0x13')]('substatus')){_0x32514c[_0xc90e('0xe')]=_0x32514c[_0xc90e('0xd')]?moment()['format'](_0xc90e('0xf')):null;}if(_0x32514c['changed'](_0xc90e('0x10'))){_0x32514c[_0xc90e('0x11')]=moment()['format'](_0xc90e('0xf'));_0x32514c['substatus']=null;_0x32514c['substatusAt']=null;}_0x3617b6(null,_0x32514c);},'afterUpdate':function(_0x2a0ecc,_0x8c9ea4,_0x16c3c8){var _0x232602=_0x2c0e1e[_0xc90e('0x14')];var _0x2c1932=_0x2a0ecc['get']({'plain':!![]});if(_0x2c1932[_0xc90e('0x10')]){return _0x232602['MailMessage'][_0xc90e('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x2c1932['id']}})[_0xc90e('0x16')](function(){_0x16c3c8();})[_0xc90e('0x17')](function(_0x338b82){_0x16c3c8(_0x338b82);});}else{_0x16c3c8();}}},'charset':_0xc90e('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3e79=['moment','bluebird','rimraf','../../config/environment','./mailInteraction.attributes','MailInteraction','mail_interactions','fti_mail_interactions','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','closed','substatusAt','get','MailMessage','update','then','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x2ace13,_0x4a1699){var _0x28d0ef=function(_0x45e027){while(--_0x45e027){_0x2ace13['push'](_0x2ace13['shift']());}};_0x28d0ef(++_0x4a1699);}(_0x3e79,0x19a));var _0x93e7=function(_0x1db76,_0x1e047c){_0x1db76=_0x1db76-0x0;var _0x49f54d=_0x3e79[_0x1db76];return _0x49f54d;};'use strict';var _=require(_0x93e7('0x0'));var util=require(_0x93e7('0x1'));var logger=require(_0x93e7('0x2'))(_0x93e7('0x3'));var moment=require(_0x93e7('0x4'));var BPromise=require(_0x93e7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x93e7('0x6'));var config=require(_0x93e7('0x7'));var attributes=require(_0x93e7('0x8'));module['exports']=function(_0x268c36,_0x2caa75){return _0x268c36['define'](_0x93e7('0x9'),attributes,{'tableName':_0x93e7('0xa'),'paranoid':![],'indexes':[{'name':_0x93e7('0xb'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1fd7ed,_0x5626ee,_0x4dfca8){if(_0x1fd7ed[_0x93e7('0xc')]){_0x1fd7ed['substatusAt']=moment()[_0x93e7('0xd')](_0x93e7('0xe'));}if(_0x1fd7ed['closed']){_0x1fd7ed[_0x93e7('0xf')]=moment()[_0x93e7('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4dfca8(null,_0x5626ee);},'beforeUpdate':function(_0x40f0b6,_0x5a882e,_0x1d716d){if(_0x40f0b6['changed'](_0x93e7('0xc'))){_0x40f0b6['substatusAt']=_0x40f0b6['substatus']?moment()[_0x93e7('0xd')](_0x93e7('0xe')):null;}if(_0x40f0b6['changed'](_0x93e7('0x10'))){_0x40f0b6[_0x93e7('0xf')]=moment()['format'](_0x93e7('0xe'));_0x40f0b6[_0x93e7('0xc')]=null;_0x40f0b6[_0x93e7('0x11')]=null;}_0x1d716d(null,_0x40f0b6);},'afterUpdate':function(_0x45a2f0,_0x2ebcb3,_0x5e5436){var _0x4e2d6e=_0x268c36['models'];var _0x3d53d3=_0x45a2f0[_0x93e7('0x12')]({'plain':!![]});if(_0x3d53d3[_0x93e7('0x10')]){return _0x4e2d6e[_0x93e7('0x13')][_0x93e7('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x3d53d3['id']}})[_0x93e7('0x15')](function(){_0x5e5436();})['catch'](function(_0x85ea1f){_0x5e5436(_0x85ea1f);});}else{_0x5e5436();}}},'charset':'utf8mb4','collate':_0x93e7('0x16')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 2a3fe04..5455898 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 _0x5f77=['message','info','catch','MailInteraction','update','options','raw','where','attributes','limit','then','UpdateMailInteraction','find','addTags','body','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1dc91b,_0x5282c9){var _0x3ba8ba=function(_0x139b28){while(--_0x139b28){_0x1dc91b['push'](_0x1dc91b['shift']());}};_0x3ba8ba(++_0x5282c9);}(_0x5f77,0x108));var _0x75f7=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x5f77[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x75f7('0x0'));var util=require(_0x75f7('0x1'));var moment=require(_0x75f7('0x2'));var BPromise=require('bluebird');var rs=require(_0x75f7('0x3'));var fs=require('fs');var Redis=require(_0x75f7('0x4'));var db=require(_0x75f7('0x5'))['db'];var utils=require(_0x75f7('0x6'));var logger=require('../../config/logger')(_0x75f7('0x7'));var config=require(_0x75f7('0x8'));var jayson=require(_0x75f7('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x75f7('0xa')]=_[_0x75f7('0xb')](config['redis'],{'host':_0x75f7('0xc'),'port':0x18eb});var socket=require(_0x75f7('0xd'))(new Redis(config[_0x75f7('0xa')]));require(_0x75f7('0xe'))['register'](socket);function respondWithRpcPromise(_0x407404,_0x14be08,_0x1a2717){return new BPromise(function(_0x227ca2,_0x534e7e){return client[_0x75f7('0xf')](_0x407404,_0x1a2717)['then'](function(_0x2b7710){logger['info'](_0x75f7('0x10'),_0x14be08,_0x75f7('0x11'));logger[_0x75f7('0x12')](_0x75f7('0x13'),_0x14be08,_0x75f7('0x11'),JSON[_0x75f7('0x14')](_0x2b7710));if(_0x2b7710[_0x75f7('0x15')]){if(_0x2b7710['error'][_0x75f7('0x16')]===0x1f4){logger[_0x75f7('0x15')](_0x75f7('0x10'),_0x14be08,_0x2b7710['error'][_0x75f7('0x17')]);return _0x534e7e(_0x2b7710['error'][_0x75f7('0x17')]);}logger[_0x75f7('0x15')](_0x75f7('0x10'),_0x14be08,_0x2b7710[_0x75f7('0x15')][_0x75f7('0x17')]);return _0x227ca2(_0x2b7710[_0x75f7('0x15')]['message']);}else{logger[_0x75f7('0x18')](_0x75f7('0x10'),_0x14be08,_0x75f7('0x11'));_0x227ca2(_0x2b7710['result'][_0x75f7('0x17')]);}})[_0x75f7('0x19')](function(_0x257ae9){logger[_0x75f7('0x15')](_0x75f7('0x10'),_0x14be08,_0x257ae9);_0x534e7e(_0x257ae9);});});}exports['UpdateMailInteraction']=function(_0x36a889){var _0x1e1054=this;return new Promise(function(_0x634e2a,_0x489b23){return db[_0x75f7('0x1a')][_0x75f7('0x1b')](_0x36a889['body'],{'raw':_0x36a889[_0x75f7('0x1c')]?_0x36a889[_0x75f7('0x1c')][_0x75f7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36a889[_0x75f7('0x1c')]?_0x36a889[_0x75f7('0x1c')][_0x75f7('0x1e')]||null:null,'attributes':_0x36a889[_0x75f7('0x1c')]?_0x36a889[_0x75f7('0x1c')][_0x75f7('0x1f')]||null:null,'limit':_0x36a889[_0x75f7('0x1c')]?_0x36a889['options'][_0x75f7('0x20')]||null:null})[_0x75f7('0x21')](function(_0x4c1ad2){logger[_0x75f7('0x18')]('UpdateMailInteraction',_0x36a889);logger[_0x75f7('0x12')](_0x75f7('0x22'),_0x36a889,JSON[_0x75f7('0x14')](_0x4c1ad2));_0x634e2a(_0x4c1ad2);})[_0x75f7('0x19')](function(_0x19c9e6){logger[_0x75f7('0x15')](_0x75f7('0x22'),_0x19c9e6[_0x75f7('0x17')],_0x36a889);_0x489b23(_0x1e1054[_0x75f7('0x15')](0x1f4,_0x19c9e6[_0x75f7('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0x65cb56){return new Promise(function(_0x569f94,_0x1f6930){return db['MailInteraction'][_0x75f7('0x23')]({'where':_0x65cb56[_0x75f7('0x1c')]?_0x65cb56['options']['where']||null:null})[_0x75f7('0x21')](function(_0x572909){if(_0x572909){return _0x572909[_0x75f7('0x24')](_0x65cb56[_0x75f7('0x25')]['ids'],_['omit'](_0x65cb56[_0x75f7('0x25')],[_0x75f7('0x26'),'id'])||{});}})[_0x75f7('0x27')](function(_0x56f2d5){logger[_0x75f7('0x18')](_0x75f7('0x28'),_0x65cb56);logger[_0x75f7('0x12')](_0x75f7('0x28'),_0x65cb56,JSON['stringify'](_0x56f2d5));_0x569f94(_0x56f2d5);})['catch'](function(_0xe25d63){logger[_0x75f7('0x15')]('AddTags',_0xe25d63[_0x75f7('0x17')],_0x65cb56);_0x1f6930(_this[_0x75f7('0x15')](0x1f4,_0xe25d63[_0x75f7('0x17')]));});});}; \ No newline at end of file +var _0x33de=['body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','addTags','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','./mailInteraction.socket','then','info','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update'];(function(_0x5513cf,_0x226a41){var _0x35d40d=function(_0x421f46){while(--_0x421f46){_0x5513cf['push'](_0x5513cf['shift']());}};_0x35d40d(++_0x226a41);}(_0x33de,0x14b));var _0xe33d=function(_0x19a7cb,_0x1384f7){_0x19a7cb=_0x19a7cb-0x0;var _0x455ed2=_0x33de[_0x19a7cb];return _0x455ed2;};'use strict';var _=require(_0xe33d('0x0'));var util=require(_0xe33d('0x1'));var moment=require(_0xe33d('0x2'));var BPromise=require(_0xe33d('0x3'));var rs=require(_0xe33d('0x4'));var fs=require('fs');var Redis=require(_0xe33d('0x5'));var db=require(_0xe33d('0x6'))['db'];var utils=require(_0xe33d('0x7'));var logger=require(_0xe33d('0x8'))(_0xe33d('0x9'));var config=require(_0xe33d('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe33d('0xb')]['http']({'port':0x232a});config[_0xe33d('0xc')]=_['defaults'](config['redis'],{'host':_0xe33d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe33d('0xc')]));require(_0xe33d('0xe'))['register'](socket);function respondWithRpcPromise(_0x5c81b3,_0x489cde,_0x5a858c){return new BPromise(function(_0x530f6a,_0x54544e){return client['request'](_0x5c81b3,_0x5a858c)[_0xe33d('0xf')](function(_0x4da3c3){logger[_0xe33d('0x10')](_0xe33d('0x11'),_0x489cde,'request\x20sent');logger[_0xe33d('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x489cde,_0xe33d('0x13'),JSON[_0xe33d('0x14')](_0x4da3c3));if(_0x4da3c3[_0xe33d('0x15')]){if(_0x4da3c3[_0xe33d('0x15')][_0xe33d('0x16')]===0x1f4){logger[_0xe33d('0x15')](_0xe33d('0x11'),_0x489cde,_0x4da3c3[_0xe33d('0x15')][_0xe33d('0x17')]);return _0x54544e(_0x4da3c3[_0xe33d('0x15')][_0xe33d('0x17')]);}logger[_0xe33d('0x15')](_0xe33d('0x11'),_0x489cde,_0x4da3c3[_0xe33d('0x15')]['message']);return _0x530f6a(_0x4da3c3['error'][_0xe33d('0x17')]);}else{logger['info'](_0xe33d('0x11'),_0x489cde,'request\x20sent');_0x530f6a(_0x4da3c3[_0xe33d('0x18')][_0xe33d('0x17')]);}})[_0xe33d('0x19')](function(_0x2b96c4){logger[_0xe33d('0x15')](_0xe33d('0x11'),_0x489cde,_0x2b96c4);_0x54544e(_0x2b96c4);});});}exports[_0xe33d('0x1a')]=function(_0x422af9){var _0x4db3bd=this;return new Promise(function(_0x2e8dec,_0x3eab67){return db[_0xe33d('0x1b')][_0xe33d('0x1c')](_0x422af9[_0xe33d('0x1d')],{'raw':_0x422af9['options']?_0x422af9[_0xe33d('0x1e')][_0xe33d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x422af9[_0xe33d('0x1e')]?_0x422af9[_0xe33d('0x1e')][_0xe33d('0x20')]||null:null,'attributes':_0x422af9['options']?_0x422af9[_0xe33d('0x1e')][_0xe33d('0x21')]||null:null,'limit':_0x422af9[_0xe33d('0x1e')]?_0x422af9[_0xe33d('0x1e')][_0xe33d('0x22')]||null:null})[_0xe33d('0xf')](function(_0x48dfe2){logger[_0xe33d('0x10')](_0xe33d('0x1a'),_0x422af9);logger[_0xe33d('0x12')](_0xe33d('0x1a'),_0x422af9,JSON[_0xe33d('0x14')](_0x48dfe2));_0x2e8dec(_0x48dfe2);})[_0xe33d('0x19')](function(_0x3e1afb){logger[_0xe33d('0x15')](_0xe33d('0x1a'),_0x3e1afb[_0xe33d('0x17')],_0x422af9);_0x3eab67(_0x4db3bd[_0xe33d('0x15')](0x1f4,_0x3e1afb[_0xe33d('0x17')]));});});};exports[_0xe33d('0x23')]=function(_0x2b515f){return new Promise(function(_0x2070da,_0x133d54){return db[_0xe33d('0x1b')][_0xe33d('0x24')]({'where':_0x2b515f[_0xe33d('0x1e')]?_0x2b515f[_0xe33d('0x1e')]['where']||null:null})[_0xe33d('0xf')](function(_0x4fd5cb){if(_0x4fd5cb){return _0x4fd5cb[_0xe33d('0x25')](_0x2b515f['body']['ids'],_['omit'](_0x2b515f['body'],['ids','id'])||{});}})[_0xe33d('0x26')](function(_0xeb8313){logger[_0xe33d('0x10')](_0xe33d('0x27'),_0x2b515f);logger[_0xe33d('0x12')](_0xe33d('0x27'),_0x2b515f,JSON[_0xe33d('0x14')](_0xeb8313));_0x2070da(_0xeb8313);})[_0xe33d('0x19')](function(_0x4cba46){logger[_0xe33d('0x15')](_0xe33d('0x27'),_0x4cba46[_0xe33d('0x17')],_0x2b515f);_0x133d54(_this[_0xe33d('0x15')](0x1f4,_0x4cba46[_0xe33d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 370a725..c7f946d 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 _0xf0a1=['./mailInteraction.events','remove','update','emit','register','length','mailInteraction:'];(function(_0x5ebcda,_0x5aaa0a){var _0x179c8e=function(_0x253a48){while(--_0x253a48){_0x5ebcda['push'](_0x5ebcda['shift']());}};_0x179c8e(++_0x5aaa0a);}(_0xf0a1,0x173));var _0x1f0a=function(_0x3a8236,_0xefd7ce){_0x3a8236=_0x3a8236-0x0;var _0x2f8eb1=_0xf0a1[_0x3a8236];return _0x2f8eb1;};'use strict';var MailInteractionEvents=require(_0x1f0a('0x0'));var events=['save',_0x1f0a('0x1'),_0x1f0a('0x2')];function createListener(_0x3fa8b3,_0x3069ff){return function(_0x3caa55){_0x3069ff[_0x1f0a('0x3')](_0x3fa8b3,_0x3caa55);};}function removeListener(_0x26d129,_0x55a1e3){return function(){MailInteractionEvents['removeListener'](_0x26d129,_0x55a1e3);};}exports[_0x1f0a('0x4')]=function(_0x2bff6d){for(var _0x38f597=0x0,_0x3b611f=events[_0x1f0a('0x5')];_0x38f597<_0x3b611f;_0x38f597++){var _0x1d787c=events[_0x38f597];var _0x39d88a=createListener(_0x1f0a('0x6')+_0x1d787c,_0x2bff6d);MailInteractionEvents['on'](_0x1d787c,_0x39d88a);}}; \ No newline at end of file +var _0xf6c1=['removeListener','mailInteraction:','./mailInteraction.events','save','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf6c1,0x192));var _0x1f6c=function(_0x4e5470,_0x3a0507){_0x4e5470=_0x4e5470-0x0;var _0x2249a2=_0xf6c1[_0x4e5470];return _0x2249a2;};'use strict';var MailInteractionEvents=require(_0x1f6c('0x0'));var events=[_0x1f6c('0x1'),'remove','update'];function createListener(_0x28a64b,_0x3c5c50){return function(_0xcf68b5){_0x3c5c50[_0x1f6c('0x2')](_0x28a64b,_0xcf68b5);};}function removeListener(_0x1bbd19,_0x59d82b){return function(){MailInteractionEvents[_0x1f6c('0x3')](_0x1bbd19,_0x59d82b);};}exports['register']=function(_0x177c6c){for(var _0x370a1c=0x0,_0x4b4f64=events['length'];_0x370a1c<_0x4b4f64;_0x370a1c++){var _0x3046af=events[_0x370a1c];var _0x32bb77=createListener(_0x1f6c('0x4')+_0x3046af,_0x177c6c);MailInteractionEvents['on'](_0x3046af,_0x32bb77);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 536d91e..dc47017 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 _0xc9ed=['create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','mail','mailmessage:create'];(function(_0x27c389,_0x4da994){var _0x76862a=function(_0x14d85d){while(--_0x14d85d){_0x27c389['push'](_0x27c389['shift']());}};_0x76862a(++_0x4da994);}(_0xc9ed,0x12b));var _0xdc9e=function(_0x45ac0c,_0x2f8a58){_0x45ac0c=_0x45ac0c-0x0;var _0x4b4074=_0xc9ed[_0x45ac0c];return _0x4b4074;};'use strict';var multer=require(_0xdc9e('0x0'));var util=require(_0xdc9e('0x1'));var path=require(_0xdc9e('0x2'));var timeout=require('connect-timeout');var express=require(_0xdc9e('0x3'));var router=express[_0xdc9e('0x4')]();var fs_extra=require(_0xdc9e('0x5'));var auth=require(_0xdc9e('0x6'));var interaction=require(_0xdc9e('0x7'));var config=require(_0xdc9e('0x8'));var controller=require(_0xdc9e('0x9'));router[_0xdc9e('0xa')]('/',auth['isAuthenticated'](),controller[_0xdc9e('0xb')]);router[_0xdc9e('0xa')](_0xdc9e('0xc'),auth[_0xdc9e('0xd')](),controller[_0xdc9e('0xe')]);router[_0xdc9e('0xa')](_0xdc9e('0xf'),auth[_0xdc9e('0xd')](),controller[_0xdc9e('0x10')]);router[_0xdc9e('0xa')]('/:id/download',auth[_0xdc9e('0xd')](),controller['download']);router[_0xdc9e('0x11')]('/',auth[_0xdc9e('0xd')](),interaction['tracked'](_0xdc9e('0x12'),_0xdc9e('0x13')),controller[_0xdc9e('0x14')]);router[_0xdc9e('0x15')](_0xdc9e('0xf'),auth[_0xdc9e('0xd')](),controller[_0xdc9e('0x16')]);router[_0xdc9e('0x15')](_0xdc9e('0x17'),auth['isAuthenticated'](),controller[_0xdc9e('0x18')]);router['put'](_0xdc9e('0x19'),auth[_0xdc9e('0xd')](),controller['reject']);router[_0xdc9e('0x1a')](_0xdc9e('0xf'),auth['isAuthenticated'](),controller[_0xdc9e('0x1b')]);module[_0xdc9e('0x1c')]=router; \ No newline at end of file +var _0x8bc8=['Router','./mailMessage.controller','isAuthenticated','get','/describe','describe','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','/:id','update','put','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x334d1e,_0x28a488){var _0x3b33ba=function(_0x25afca){while(--_0x25afca){_0x334d1e['push'](_0x334d1e['shift']());}};_0x3b33ba(++_0x28a488);}(_0x8bc8,0xc4));var _0x88bc=function(_0x418ca7,_0x2f4468){_0x418ca7=_0x418ca7-0x0;var _0x235d6a=_0x8bc8[_0x418ca7];return _0x235d6a;};'use strict';var multer=require(_0x88bc('0x0'));var util=require(_0x88bc('0x1'));var path=require(_0x88bc('0x2'));var timeout=require(_0x88bc('0x3'));var express=require('express');var router=express[_0x88bc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x88bc('0x5'));router['get']('/',auth[_0x88bc('0x6')](),controller['index']);router[_0x88bc('0x7')](_0x88bc('0x8'),auth[_0x88bc('0x6')](),controller[_0x88bc('0x9')]);router[_0x88bc('0x7')]('/:id',auth[_0x88bc('0x6')](),controller[_0x88bc('0xa')]);router['get'](_0x88bc('0xb'),auth[_0x88bc('0x6')](),controller[_0x88bc('0xc')]);router[_0x88bc('0xd')]('/',auth[_0x88bc('0x6')](),interaction[_0x88bc('0xe')](_0x88bc('0xf'),_0x88bc('0x10')),controller[_0x88bc('0x11')]);router['put'](_0x88bc('0x12'),auth[_0x88bc('0x6')](),controller[_0x88bc('0x13')]);router[_0x88bc('0x14')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x88bc('0x14')](_0x88bc('0x15'),auth['isAuthenticated'](),controller['reject']);router[_0x88bc('0x16')]('/:id',auth[_0x88bc('0x6')](),controller[_0x88bc('0x17')]);module[_0x88bc('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 63d28ad..eb5b4a4 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 _0xfe69=['STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','TEXT','long','medium','ENUM','out'];(function(_0xbf4ddf,_0x66b3cb){var _0x3cb273=function(_0x3cf903){while(--_0x3cf903){_0xbf4ddf['push'](_0xbf4ddf['shift']());}};_0x3cb273(++_0x66b3cb);}(_0xfe69,0x1c1));var _0x9fe6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfe69[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x9fe6('0x0'));var _=require(_0x9fe6('0x1'));module['exports']={'body':{'type':Sequelize[_0x9fe6('0x2')](_0x9fe6('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9fe6('0x2')](_0x9fe6('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9fe6('0x5')]('in','out'),'defaultValue':_0x9fe6('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9fe6('0x7')](0x1fe)},'from':{'type':Sequelize[_0x9fe6('0x7')]},'to':{'type':Sequelize[_0x9fe6('0x2')]('long')},'cc':{'type':Sequelize[_0x9fe6('0x2')](_0x9fe6('0x3'))},'bcc':{'type':Sequelize[_0x9fe6('0x2')](_0x9fe6('0x3'))},'subject':{'type':Sequelize[_0x9fe6('0x2')]},'sentAt':{'type':Sequelize[_0x9fe6('0x8')]},'attach':{'type':Sequelize[_0x9fe6('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x9fe6('0x8')]},'originTo':{'type':Sequelize[_0x9fe6('0x2')]('long')},'originCc':{'type':Sequelize[_0x9fe6('0x2')](_0x9fe6('0x3'))},'originChannel':{'type':Sequelize[_0x9fe6('0x5')](_0x9fe6('0xa'),_0x9fe6('0xb')),'defaultValue':_0x9fe6('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x90e0=['exports','TEXT','long','medium','BOOLEAN','ENUM','out','DATE','INTEGER','Chat','Email','lodash'];(function(_0x284240,_0x555b56){var _0x390667=function(_0x409454){while(--_0x409454){_0x284240['push'](_0x284240['shift']());}};_0x390667(++_0x555b56);}(_0x90e0,0xe3));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var _=require(_0x090e('0x0'));module[_0x090e('0x1')]={'body':{'type':Sequelize[_0x090e('0x2')](_0x090e('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x090e('0x2')](_0x090e('0x4'))},'read':{'type':Sequelize[_0x090e('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x090e('0x6')]('in',_0x090e('0x7')),'defaultValue':_0x090e('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x090e('0x2')](_0x090e('0x3'))},'bcc':{'type':Sequelize[_0x090e('0x2')](_0x090e('0x3'))},'subject':{'type':Sequelize[_0x090e('0x2')]},'sentAt':{'type':Sequelize[_0x090e('0x8')]},'attach':{'type':Sequelize[_0x090e('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x090e('0x8')]},'originTo':{'type':Sequelize[_0x090e('0x2')](_0x090e('0x3'))},'originCc':{'type':Sequelize[_0x090e('0x2')](_0x090e('0x3'))},'originChannel':{'type':Sequelize[_0x090e('0x6')]('Email',_0x090e('0xa')),'defaultValue':_0x090e('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index eb6ac46..f55e9b0 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 _0x4f6f=['existsSync','push','readFileSync','writeFileSync','download','unlinkSync','eml-format','bluebird','path','lodash','ioredis','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','code','error','message','info','catch','status','json','offset','undefined','count','limit','set','update','destroy','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','MailMessage','show','includeAll','include','find','body','params','describe','create','direction','secret','split','MailAccount','findOne','CmList','CmContact','Contacts','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','List','ListId','List\x20not\x20found','SendMail','sendMail','mail','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','read1stAt','format','role','interaction','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','QueryTypes','SELECT','interface','fromString','rejectmessage','unix','toString','root','server','files','message-%s.eml','bcc','subject','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc'];(function(_0x21d6b5,_0x14623a){var _0x4919ba=function(_0x3165e9){while(--_0x3165e9){_0x21d6b5['push'](_0x21d6b5['shift']());}};_0x4919ba(++_0x14623a);}(_0x4f6f,0x1d7));var _0xf4f6=function(_0x43f489,_0x2b4fea){_0x43f489=_0x43f489-0x0;var _0x4134b4=_0x4f6f[_0x43f489];return _0x4134b4;};'use strict';var emlformat=require(_0xf4f6('0x0'));var moment=require('moment');var BPromise=require(_0xf4f6('0x1'));var util=require('util');var path=require(_0xf4f6('0x2'));var fs=require('fs');var _=require(_0xf4f6('0x3'));var Redis=require(_0xf4f6('0x4'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0xf4f6('0x5'))(_0xf4f6('0x6'));var interaction_log=require(_0xf4f6('0x5'))(_0xf4f6('0x7'));var config=require(_0xf4f6('0x8'));var db=require(_0xf4f6('0x9'))['db'];config[_0xf4f6('0xa')]=_[_0xf4f6('0xb')](config[_0xf4f6('0xa')],{'host':_0xf4f6('0xc'),'port':0x18eb});var socket=require(_0xf4f6('0xd'))(new Redis(config[_0xf4f6('0xa')]));var htmlEntities=require('html-entities');require(_0xf4f6('0xe'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xf4f6('0xf')][_0xf4f6('0x10')]({'port':0x232c});var client9003=jayson[_0xf4f6('0xf')]['http']({'port':0x232b});var client9002=jayson[_0xf4f6('0xf')][_0xf4f6('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x54d8f8,_0x363fd0,_0x2d870c,_0x4e513f){return new BPromise(function(_0x5922a3,_0x22cf20){var _0x3625ea=_0x4e513f||client;return _0x3625ea[_0xf4f6('0x11')](_0x54d8f8,_0x2d870c)[_0xf4f6('0x12')](function(_0x539172){logger['info'](_0xf4f6('0x13'),_0x363fd0,_0xf4f6('0x14'));logger[_0xf4f6('0x15')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x363fd0,_0xf4f6('0x14'),JSON['stringify'](_0x539172));if(_0x539172['error']){if(_0x539172['error'][_0xf4f6('0x16')]===0x1f4){logger[_0xf4f6('0x17')]('MailMessage,\x20%s,\x20%s',_0x363fd0,_0x539172['error'][_0xf4f6('0x18')]);return _0x22cf20(_0x539172[_0xf4f6('0x17')][_0xf4f6('0x18')]);}logger[_0xf4f6('0x17')](_0xf4f6('0x13'),_0x363fd0,_0x539172[_0xf4f6('0x17')][_0xf4f6('0x18')]);return _0x5922a3(_0x539172[_0xf4f6('0x17')]['message']);}else{logger[_0xf4f6('0x19')](_0xf4f6('0x13'),_0x363fd0,_0xf4f6('0x14'));_0x5922a3(_0x539172['result']['message']);}})[_0xf4f6('0x1a')](function(_0x4e0696){logger[_0xf4f6('0x17')](_0xf4f6('0x13'),_0x363fd0,_0x4e0696);_0x22cf20(_0x4e0696);});});}function respondWithResult(_0xbf63d,_0x434b04){_0x434b04=_0x434b04||0xc8;return function(_0x1163c1){if(_0x1163c1){return _0xbf63d[_0xf4f6('0x1b')](_0x434b04)[_0xf4f6('0x1c')](_0x1163c1);}};}function respondWithFilteredResult(_0x13e33d,_0x14a473){return function(_0x384a9b){if(_0x384a9b){var _0x394c2c=typeof _0x14a473[_0xf4f6('0x1d')]===_0xf4f6('0x1e')&&typeof _0x14a473['limit']===_0xf4f6('0x1e');var _0x54c4bf=_0x384a9b[_0xf4f6('0x1f')];var _0x566f15=_0x394c2c?0x0:_0x14a473[_0xf4f6('0x1d')];var _0x46595b=_0x394c2c?_0x384a9b[_0xf4f6('0x1f')]:_0x14a473[_0xf4f6('0x1d')]+_0x14a473[_0xf4f6('0x20')];var _0x1f9524;if(_0x46595b>=_0x54c4bf){_0x46595b=_0x54c4bf;_0x1f9524=0xc8;}else{_0x1f9524=0xce;}_0x13e33d['status'](_0x1f9524);return _0x13e33d[_0xf4f6('0x21')]('Content-Range',_0x566f15+'-'+_0x46595b+'/'+_0x54c4bf)['json'](_0x384a9b);}return null;};}function saveUpdates(_0x57ca17){return function(_0x23b6e0){if(_0x23b6e0){return _0x23b6e0[_0xf4f6('0x22')](_0x57ca17)[_0xf4f6('0x12')](function(_0x164e35){return _0x164e35;});}return null;};}function removeEntity(_0x472a8d){return function(_0x557513){if(_0x557513){return _0x557513[_0xf4f6('0x23')]()[_0xf4f6('0x12')](function(){_0x472a8d[_0xf4f6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be3ce){return function(_0x5dcb98){if(!_0x5dcb98){_0x3be3ce['sendStatus'](0x194);}return _0x5dcb98;};}function handleError(_0x121d7b,_0x1a2887){_0x1a2887=_0x1a2887||0x1f4;return function(_0x365a78){logger[_0xf4f6('0x17')](_0x365a78[_0xf4f6('0x24')]);if(_0x365a78[_0xf4f6('0x25')]){delete _0x365a78['name'];}_0x121d7b[_0xf4f6('0x1b')](_0x1a2887)[_0xf4f6('0x26')](_0x365a78);};}exports[_0xf4f6('0x27')]=function(_0x239494,_0x17429f){var _0x4fc829={},_0x245e22={},_0x28ea3f={'count':0x0,'rows':[]};var _0x63abff=_[_0xf4f6('0x28')](db['MailMessage'][_0xf4f6('0x29')],function(_0x23982e){return{'name':_0x23982e['fieldName'],'type':_0x23982e['type'][_0xf4f6('0x2a')]};});_0x245e22[_0xf4f6('0x2b')]=_[_0xf4f6('0x28')](_0x63abff,'name');_0x245e22[_0xf4f6('0x2c')]=_[_0xf4f6('0x2d')](_0x239494[_0xf4f6('0x2c')]);_0x245e22[_0xf4f6('0x2e')]=_[_0xf4f6('0x2f')](_0x245e22[_0xf4f6('0x2b')],_0x245e22[_0xf4f6('0x2c')]);_0x4fc829[_0xf4f6('0x30')]=_[_0xf4f6('0x2f')](_0x245e22['model'],qs[_0xf4f6('0x31')](_0x239494[_0xf4f6('0x2c')][_0xf4f6('0x31')]));_0x4fc829[_0xf4f6('0x30')]=_0x4fc829['attributes'][_0xf4f6('0x32')]?_0x4fc829[_0xf4f6('0x30')]:_0x245e22[_0xf4f6('0x2b')];if(!_0x239494[_0xf4f6('0x2c')][_0xf4f6('0x33')](_0xf4f6('0x34'))){_0x4fc829[_0xf4f6('0x20')]=qs[_0xf4f6('0x20')](_0x239494[_0xf4f6('0x2c')]['limit']);_0x4fc829[_0xf4f6('0x1d')]=qs[_0xf4f6('0x1d')](_0x239494[_0xf4f6('0x2c')][_0xf4f6('0x1d')]);}_0x4fc829[_0xf4f6('0x35')]=qs[_0xf4f6('0x36')](_0x239494[_0xf4f6('0x2c')][_0xf4f6('0x36')]);_0x4fc829[_0xf4f6('0x37')]=qs[_0xf4f6('0x2e')](_[_0xf4f6('0x38')](_0x239494[_0xf4f6('0x2c')],_0x245e22['filters']),_0x63abff);if(_0x239494[_0xf4f6('0x2c')][_0xf4f6('0x39')]){_0x4fc829['where']=_[_0xf4f6('0x3a')](_0x4fc829[_0xf4f6('0x37')],{'$or':_[_0xf4f6('0x28')](_0x63abff,function(_0x525eae){if(_0x525eae[_0xf4f6('0x3b')]!==_0xf4f6('0x3c')){var _0x41fa15={};_0x41fa15[_0x525eae[_0xf4f6('0x25')]]={'$like':'%'+_0x239494[_0xf4f6('0x2c')][_0xf4f6('0x39')]+'%'};return _0x41fa15;}})});}_0x4fc829=_[_0xf4f6('0x3a')]({},_0x4fc829,_0x239494[_0xf4f6('0x3d')]);var _0x41d92f={'where':_0x4fc829['where']};return db[_0xf4f6('0x3e')]['count'](_0x41d92f)[_0xf4f6('0x12')](function(_0x383b5a){_0x28ea3f[_0xf4f6('0x1f')]=_0x383b5a;if(_0x239494[_0xf4f6('0x2c')]['includeAll']){_0x4fc829['include']=[{'all':!![]}];}return db[_0xf4f6('0x3e')]['findAll'](_0x4fc829);})['then'](function(_0x1288c3){_0x28ea3f['rows']=_0x1288c3;return _0x28ea3f;})['then'](respondWithFilteredResult(_0x17429f,_0x4fc829))[_0xf4f6('0x1a')](handleError(_0x17429f,null));};exports[_0xf4f6('0x3f')]=function(_0xac212d,_0x2d2d2a){var _0x58738a={'raw':!![],'where':{'id':_0xac212d['params']['id']}},_0x5ddc39={};_0x5ddc39['model']=_['keys'](db[_0xf4f6('0x3e')][_0xf4f6('0x29')]);_0x5ddc39[_0xf4f6('0x2c')]=_[_0xf4f6('0x2d')](_0xac212d['query']);_0x5ddc39[_0xf4f6('0x2e')]=_[_0xf4f6('0x2f')](_0x5ddc39[_0xf4f6('0x2b')],_0x5ddc39[_0xf4f6('0x2c')]);_0x58738a[_0xf4f6('0x30')]=_['intersection'](_0x5ddc39[_0xf4f6('0x2b')],qs[_0xf4f6('0x31')](_0xac212d['query'][_0xf4f6('0x31')]));_0x58738a[_0xf4f6('0x30')]=_0x58738a[_0xf4f6('0x30')][_0xf4f6('0x32')]?_0x58738a[_0xf4f6('0x30')]:_0x5ddc39[_0xf4f6('0x2b')];if(_0xac212d[_0xf4f6('0x2c')][_0xf4f6('0x40')]){_0x58738a[_0xf4f6('0x41')]=[{'all':!![]}];}_0x58738a=_['merge']({},_0x58738a,_0xac212d[_0xf4f6('0x3d')]);return db[_0xf4f6('0x3e')][_0xf4f6('0x42')](_0x58738a)[_0xf4f6('0x12')](handleEntityNotFound(_0x2d2d2a,null))[_0xf4f6('0x12')](respondWithResult(_0x2d2d2a,null))[_0xf4f6('0x1a')](handleError(_0x2d2d2a,null));};exports['update']=function(_0x3b945f,_0x4b6c3f){if(_0x3b945f[_0xf4f6('0x43')]['id']){delete _0x3b945f[_0xf4f6('0x43')]['id'];}return db['MailMessage'][_0xf4f6('0x42')]({'where':{'id':_0x3b945f[_0xf4f6('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b6c3f,null))['then'](saveUpdates(_0x3b945f[_0xf4f6('0x43')],null))[_0xf4f6('0x12')](respondWithResult(_0x4b6c3f,null))[_0xf4f6('0x1a')](handleError(_0x4b6c3f,null));};exports[_0xf4f6('0x23')]=function(_0x3c1ad6,_0x2c8554){return db[_0xf4f6('0x3e')]['find']({'where':{'id':_0x3c1ad6[_0xf4f6('0x44')]['id']}})[_0xf4f6('0x12')](handleEntityNotFound(_0x2c8554,null))[_0xf4f6('0x12')](removeEntity(_0x2c8554,null))[_0xf4f6('0x1a')](handleError(_0x2c8554,null));};exports[_0xf4f6('0x45')]=function(_0x393826,_0x3b93d1){return db[_0xf4f6('0x3e')][_0xf4f6('0x45')]()[_0xf4f6('0x12')](respondWithResult(_0x3b93d1,null))[_0xf4f6('0x1a')](handleError(_0x3b93d1,null));};exports[_0xf4f6('0x46')]=function(_0xe653fb,_0xc7f14){return db['MailMessage'][_0xf4f6('0x46')](_0xe653fb['body'])['then'](function(_0x2dbbc4){if(_0x2dbbc4){if(_0x2dbbc4[_0xf4f6('0x47')]==='out'&&!_0x2dbbc4[_0xf4f6('0x48')]){var _0x4a153d,_0x561c12,_0x1fd573;if(_0xe653fb['body']['to']){_0x561c12=_0xe653fb[_0xf4f6('0x43')]['to'][_0xf4f6('0x49')](',')[0x0];}return db[_0xf4f6('0x4a')][_0xf4f6('0x4b')]({'where':{'id':_0x2dbbc4['MailAccountId']},'include':[{'model':db[_0xf4f6('0x4c')],'as':'List','include':[{'model':db[_0xf4f6('0x4d')],'as':_0xf4f6('0x4e'),'where':{'email':_0x561c12},'limit':0x1,'order':[['updatedAt',_0xf4f6('0x4f')]]}]},{'model':db[_0xf4f6('0x50')],'as':_0xf4f6('0x51'),'raw':!![],'include':[{'model':db[_0xf4f6('0x52')],'as':_0xf4f6('0x52'),'raw':!![]}]}]})['then'](function(_0x374a8c){_0x4a153d=_0x374a8c;if(!_0x4a153d||!_0x4a153d[_0xf4f6('0x51')])return;var _0x5ed96a=_0x4a153d[_0xf4f6('0x53')]();if(_0xe653fb['body'][_0xf4f6('0x54')]&&_0xe653fb[_0xf4f6('0x43')][_0xf4f6('0x54')][_0xf4f6('0x32')]){for(var _0x5c8c1a=0x0;_0x5c8c1a<_0xe653fb[_0xf4f6('0x43')][_0xf4f6('0x54')][_0xf4f6('0x32')];_0x5c8c1a+=0x1){_0xe653fb[_0xf4f6('0x43')]['attachments'][_0x5c8c1a]={'filename':_0xe653fb[_0xf4f6('0x43')]['attachments'][_0x5c8c1a][_0xf4f6('0x25')],'path':path[_0xf4f6('0x55')](config['root'],_0xf4f6('0x56'),_0xe653fb[_0xf4f6('0x43')][_0xf4f6('0x54')][_0x5c8c1a][_0xf4f6('0x57')])};}}_0x1fd573={'account':_0x5ed96a,'message':_0xe653fb[_0xf4f6('0x43')]};return;})[_0xf4f6('0x12')](function(){if(_0x4a153d[_0xf4f6('0x58')]){if(_0x4a153d[_0xf4f6('0x58')][_0xf4f6('0x4e')]['length']){return _0x4a153d[_0xf4f6('0x58')][_0xf4f6('0x4e')][0x0];}else{return db[_0xf4f6('0x4d')][_0xf4f6('0x46')](_[_0xf4f6('0xb')](_0xe653fb['body'],{'firstName':_0xe653fb[_0xf4f6('0x43')]['to'],'email':_0xe653fb[_0xf4f6('0x43')]['to'],'phone':_0xe653fb[_0xf4f6('0x43')]['to'],'ListId':_0x4a153d[_0xf4f6('0x59')]}));}}else{throw new Error(_0xf4f6('0x5a'));}})[_0xf4f6('0x12')](function(){if(_0x1fd573){return respondWithRpcPromise(_0xf4f6('0x5b'),_0xf4f6('0x5c'),_0x1fd573,client9003)[_0xf4f6('0x12')](function(_0x23b17e){return _0x2dbbc4[_0xf4f6('0x22')]({'read':!![],'messageId':_0x23b17e['messageId'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xf4f6('0x1a')](function(_0x5e3ba8){logger[_0xf4f6('0x17')]('%s',JSON['stringify'](_0x5e3ba8));return _0x2dbbc4;});}return _0x2dbbc4;});}return _0x2dbbc4;}})[_0xf4f6('0x12')](respondWithResult(_0xc7f14,0xc9))[_0xf4f6('0x1a')](handleError(_0xc7f14,null));};exports['accept']=function(_0x248f96,_0x7172d4){var _0x119a9d={'agent':{},'channel':_0xf4f6('0x5d')};if(_0x248f96['body']['id']){delete _0x248f96[_0xf4f6('0x43')]['id'];}_0x248f96[_0xf4f6('0x43')]['read']=!![];_0x248f96[_0xf4f6('0x43')][_0xf4f6('0x5e')]=moment()['format'](_0xf4f6('0x5f'));_0x248f96[_0xf4f6('0x43')][_0xf4f6('0x60')]=_0x248f96['body'][_0xf4f6('0x60')]||_0x248f96[_0xf4f6('0x61')]['id'];_0x119a9d[_0xf4f6('0x62')]['id']=_0x248f96[_0xf4f6('0x43')]['UserId'];return db[_0xf4f6('0x3e')][_0xf4f6('0x42')]({'where':{'id':_0x248f96[_0xf4f6('0x44')]['id'],'UserId':null}})[_0xf4f6('0x12')](handleEntityNotFound(_0x7172d4,null))[_0xf4f6('0x12')](saveUpdates(_0x248f96['body'],null))['then'](function(_0x2c502d){if(_0x2c502d){_0x119a9d[_0xf4f6('0x18')]=_0x2c502d[_0xf4f6('0x63')]({'plain':!![]});return db[_0xf4f6('0x64')][_0xf4f6('0x42')]({'where':{'id':_0x2c502d['MailInteractionId']}});}return null;})[_0xf4f6('0x12')](handleEntityNotFound(_0x7172d4,null))['then'](function(_0x41dd7c){if(_0x41dd7c){return _0x41dd7c[_0xf4f6('0x22')]({'UserId':_0x248f96['body'][_0xf4f6('0x60')],'read1stAt':_['isNil'](_0x41dd7c[_0xf4f6('0x65')])?moment()[_0xf4f6('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf4f6('0x12')](function(_0x15ac7f){if(_0x15ac7f){_0x119a9d['interaction']=_0x15ac7f['get']({'plain':!![]});interaction_log[_0xf4f6('0x19')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x248f96[_0xf4f6('0x61')]['id'],_0x248f96['user']['name'],_0x248f96['user'][_0xf4f6('0x67')],_0x119a9d[_0xf4f6('0x68')]['id'],_0x248f96['body']?JSON[_0xf4f6('0x69')](_0x248f96['body']):_0xf4f6('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xf4f6('0x6b'),_0x119a9d);}return null;})[_0xf4f6('0x12')](function(_0x430d17){var _0x559c5b=_0xf4f6('0x6c')+_0x430d17[_0xf4f6('0x18')]['ContactId'];return db[_0xf4f6('0x6d')][_0xf4f6('0x2c')](_0x559c5b,{'type':db[_0xf4f6('0x6e')]['QueryTypes']['SELECT'],'raw':!![]})[_0xf4f6('0x12')](function(_0x3d2ea2){return _0x3d2ea2;});})['then'](function(_0x303916){if(_0x303916){_0x119a9d[_0xf4f6('0x18')][_0xf4f6('0x6f')]=_0x303916[0x0];if(!_0x248f96[_0xf4f6('0x43')][_0xf4f6('0x60')])return;return db['User'][_0xf4f6('0x42')]({'where':{'id':_0x248f96[_0xf4f6('0x43')][_0xf4f6('0x60')],'role':_0xf4f6('0x62')},'attributes':['id','name',_0xf4f6('0x70'),_0xf4f6('0x71'),_0xf4f6('0x72')],'raw':!![]});}return null;})[_0xf4f6('0x12')](function(_0x6d1681){if(!_0x6d1681)return null;_0x119a9d['message'][_0xf4f6('0x62')]=_0x6d1681;return _0x119a9d;})['then'](function(_0x4a8c7c){if(_0x4a8c7c){if(_0x248f96[_0xf4f6('0x43')][_0xf4f6('0x73')]){_0x119a9d[_0xf4f6('0x18')]['interface']=util[_0xf4f6('0x66')](_0xf4f6('0x74'),_0x248f96[_0xf4f6('0x61')]['name']);_0x119a9d[_0xf4f6('0x18')][_0xf4f6('0x75')]=_0x119a9d[_0xf4f6('0x75')];_0x119a9d[_0xf4f6('0x18')][_0xf4f6('0x76')]=_0x119a9d[_0xf4f6('0x75')];_0x119a9d[_0xf4f6('0x18')][_0xf4f6('0x77')]=_0xf4f6('0x78');_0x119a9d[_0xf4f6('0x18')][_0xf4f6('0x43')]=htmlToText['fromString'](_0x119a9d['message'][_0xf4f6('0x43')]);return respondWithRpcPromise(_0xf4f6('0x79'),_0xf4f6('0x79'),{'event':_0xf4f6('0x7a'),'message':_0x119a9d[_0xf4f6('0x18')]},client9002)[_0xf4f6('0x12')](function(){return _0x119a9d;});}return _0x119a9d;}return null;})[_0xf4f6('0x12')](respondWithResult(_0x7172d4,null))[_0xf4f6('0x1a')](handleError(_0x7172d4,null));};exports[_0xf4f6('0x7b')]=function(_0x45ce2c,_0x50f19f){var _0x5b084b={'agent':{},'channel':_0xf4f6('0x5d')};if(_0x45ce2c[_0xf4f6('0x43')]['id']){delete _0x45ce2c[_0xf4f6('0x43')]['id'];}_0x45ce2c[_0xf4f6('0x43')]['UserId']=_0x45ce2c[_0xf4f6('0x43')]['UserId']||_0x45ce2c[_0xf4f6('0x61')]['id'];_0x5b084b[_0xf4f6('0x62')]['id']=_0x45ce2c[_0xf4f6('0x43')][_0xf4f6('0x60')];return db[_0xf4f6('0x3e')][_0xf4f6('0x42')]({'where':{'id':_0x45ce2c['params']['id'],'UserId':null}})[_0xf4f6('0x12')](handleEntityNotFound(_0x50f19f,null))[_0xf4f6('0x12')](function(_0xd02c0){if(_0xd02c0){_0x5b084b[_0xf4f6('0x18')]=_0xd02c0[_0xf4f6('0x63')]({'plain':!![]});return db['MailInteraction'][_0xf4f6('0x42')]({'where':{'id':_0xd02c0[_0xf4f6('0x7c')]}});}return null;})[_0xf4f6('0x12')](handleEntityNotFound(_0x50f19f,null))['then'](function(_0x41a640){if(_0x41a640){_0x5b084b[_0xf4f6('0x68')]=_0x41a640[_0xf4f6('0x63')]({'plain':!![]});interaction_log['info'](_0xf4f6('0x7d'),_0x45ce2c[_0xf4f6('0x61')]['id'],_0x45ce2c[_0xf4f6('0x61')]['name'],_0x45ce2c[_0xf4f6('0x61')]['role'],_0x5b084b[_0xf4f6('0x68')]['id'],_0x45ce2c[_0xf4f6('0x43')]?JSON['stringify'](_0x45ce2c['body']):'null');return respondWithRpcPromise('RejectMessage',_0xf4f6('0x7e'),_0x5b084b);}return null;})['then'](function(_0x5b376f){var _0x35bf5e=_0xf4f6('0x6c')+_0x5b376f['message'][_0xf4f6('0x7f')];return db['sequelize'][_0xf4f6('0x2c')](_0x35bf5e,{'type':db[_0xf4f6('0x6e')][_0xf4f6('0x80')][_0xf4f6('0x81')],'raw':!![]})[_0xf4f6('0x12')](function(_0x39b486){return _0x39b486;});})['then'](function(_0x3f286d){if(_0x3f286d){_0x5b084b[_0xf4f6('0x18')][_0xf4f6('0x6f')]=_0x3f286d[0x0];if(!_0x45ce2c[_0xf4f6('0x43')]['UserId'])return;return db['User'][_0xf4f6('0x42')]({'where':{'id':_0x45ce2c[_0xf4f6('0x43')]['UserId'],'role':_0xf4f6('0x62')},'attributes':['id',_0xf4f6('0x25'),'fullname',_0xf4f6('0x71'),'internal'],'raw':!![]});}return null;})[_0xf4f6('0x12')](function(_0x248707){if(!_0x248707)return null;_0x5b084b[_0xf4f6('0x18')]['agent']=_0x248707;return _0x5b084b;})[_0xf4f6('0x12')](function(_0x104105){if(_0x104105){_0x104105[_0xf4f6('0x18')][_0xf4f6('0x82')]=util[_0xf4f6('0x66')](_0xf4f6('0x74'),_0x45ce2c['user'][_0xf4f6('0x25')]);_0x104105[_0xf4f6('0x18')][_0xf4f6('0x75')]=_0x5b084b[_0xf4f6('0x75')];_0x104105[_0xf4f6('0x18')][_0xf4f6('0x76')]=_0x5b084b[_0xf4f6('0x75')];_0x104105[_0xf4f6('0x18')][_0xf4f6('0x77')]=_0xf4f6('0x7b');_0x104105[_0xf4f6('0x18')][_0xf4f6('0x43')]=htmlToText[_0xf4f6('0x83')](_0x5b084b[_0xf4f6('0x18')]['body']);respondWithRpcPromise(_0xf4f6('0x79'),_0xf4f6('0x79'),{'event':_0xf4f6('0x84'),'message':_0x104105[_0xf4f6('0x18')]},client9002);return _0x5b084b;}return null;})['then'](respondWithResult(_0x50f19f,null))[_0xf4f6('0x1a')](handleError(_0x50f19f,null));};exports['download']=function(_0x34ac54,_0x48db92){var _0x2f4c0c=moment()[_0xf4f6('0x85')]()[_0xf4f6('0x86')]();var _0xf80726=path[_0xf4f6('0x55')](config[_0xf4f6('0x87')],_0xf4f6('0x88'),_0xf4f6('0x89'),'tmp');var _0x477da6=path[_0xf4f6('0x55')](config[_0xf4f6('0x87')],_0xf4f6('0x88'),_0xf4f6('0x89'),_0xf4f6('0x54'));var _0x47475d=util[_0xf4f6('0x66')](_0xf4f6('0x8a'),_0x2f4c0c);return db[_0xf4f6('0x3e')][_0xf4f6('0x42')]({'where':{'id':_0x34ac54[_0xf4f6('0x44')]['id']},'attributes':['id',_0xf4f6('0x43'),'from','to','cc',_0xf4f6('0x8b'),_0xf4f6('0x8c'),_0xf4f6('0x8d')],'include':_0x34ac54[_0xf4f6('0x2c')]['attachments']?[{'model':db[_0xf4f6('0x8e')],'as':_0xf4f6('0x8f')}]:undefined})[_0xf4f6('0x12')](handleEntityNotFound(_0x48db92,null))[_0xf4f6('0x12')](function(_0xc8965b){if(_0xc8965b){var _0x5355d2=_0xc8965b;var _0x2fd747={'from':_0x5355d2[_0xf4f6('0x90')],'to':_0x5355d2['to'],'subject':_0x5355d2['subject'],'html':htmlEntities[_0xf4f6('0x91')](_0x5355d2[_0xf4f6('0x43')]),'headers':{'Date':moment(_0x5355d2[_0xf4f6('0x8d')])[_0xf4f6('0x66')](_0xf4f6('0x92'))},'attachments':[]};if(_0xc8965b['cc']){_0x2fd747[_0xf4f6('0x93')]['Cc']=_0xc8965b['cc'];}if(_0xc8965b[_0xf4f6('0x8b')]){_0x2fd747[_0xf4f6('0x93')][_0xf4f6('0x94')]=_0xc8965b[_0xf4f6('0x8b')];}return new BPromise(function(_0xe6221e,_0xf693ce){if(_0xc8965b['Attachments']){for(var _0x43dee0=0x0;_0x43dee0<_0xc8965b[_0xf4f6('0x8f')][_0xf4f6('0x32')];_0x43dee0++){var _0x42f679=_0xc8965b[_0xf4f6('0x8f')][_0x43dee0];var _0x4c45bf=path['join'](_0x477da6,_0x42f679[_0xf4f6('0x57')]);if(fs[_0xf4f6('0x95')](_0x4c45bf)){_0x2fd747['attachments'][_0xf4f6('0x96')]({'name':_0x42f679[_0xf4f6('0x25')],'contentType':_0x42f679['type'],'data':fs[_0xf4f6('0x97')](_0x4c45bf)});}}}emlformat['build'](_0x2fd747,function(_0x322bf1,_0x529194){if(_0x322bf1)return _0xf693ce(_0x322bf1);fs[_0xf4f6('0x98')](path[_0xf4f6('0x55')](_0xf80726,_0x47475d),_0x529194);return _0xe6221e(_0x529194);});});}})[_0xf4f6('0x12')](function(_0x12ccb4){if(_0x12ccb4){return _0x48db92[_0xf4f6('0x99')](path['join'](_0xf80726,_0x47475d),_0x47475d,function(_0x5eba95){if(!_0x5eba95)fs[_0xf4f6('0x9a')](path[_0xf4f6('0x55')](_0xf80726,_0x47475d));});}})[_0xf4f6('0x1a')](handleError(_0x48db92,null));}; \ No newline at end of file +var _0x7b08=['redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','stringify','error','code','message','MailMessage,\x20%s,\x20%s','request\x20sent','result','offset','undefined','count','status','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','body','destroy','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','List','ListId','SendMail','sendMail','update','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','event','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','User','fullname','download','unix','toString','tmp','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment'];(function(_0x1be0fe,_0x3bf372){var _0x508b01=function(_0x4f4678){while(--_0x4f4678){_0x1be0fe['push'](_0x1be0fe['shift']());}};_0x508b01(++_0x3bf372);}(_0x7b08,0x131));var _0x87b0=function(_0x51c3d6,_0x590080){_0x51c3d6=_0x51c3d6-0x0;var _0x6d59d6=_0x7b08[_0x51c3d6];return _0x6d59d6;};'use strict';var emlformat=require(_0x87b0('0x0'));var moment=require(_0x87b0('0x1'));var BPromise=require(_0x87b0('0x2'));var util=require(_0x87b0('0x3'));var path=require(_0x87b0('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x87b0('0x5'));var htmlToText=require(_0x87b0('0x6'));var qs=require(_0x87b0('0x7'));var logger=require(_0x87b0('0x8'))(_0x87b0('0x9'));var interaction_log=require(_0x87b0('0x8'))('mail-interactions');var config=require(_0x87b0('0xa'));var db=require('../../mysqldb')['db'];config[_0x87b0('0xb')]=_[_0x87b0('0xc')](config[_0x87b0('0xb')],{'host':_0x87b0('0xd'),'port':0x18eb});var socket=require(_0x87b0('0xe'))(new Redis(config['redis']));var htmlEntities=require(_0x87b0('0xf'));require(_0x87b0('0x10'))[_0x87b0('0x11')](socket);var jayson=require(_0x87b0('0x12'));var client=jayson[_0x87b0('0x13')][_0x87b0('0x14')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0x87b0('0x13')][_0x87b0('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x4d81e8,_0x435922,_0x3a32c,_0x1fce80){return new BPromise(function(_0x23fd7a,_0x138adb){var _0x361e80=_0x1fce80||client;return _0x361e80[_0x87b0('0x15')](_0x4d81e8,_0x3a32c)[_0x87b0('0x16')](function(_0x488d8d){logger[_0x87b0('0x17')]('MailMessage,\x20%s,\x20%s',_0x435922,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x435922,'request\x20sent',JSON[_0x87b0('0x18')](_0x488d8d));if(_0x488d8d[_0x87b0('0x19')]){if(_0x488d8d[_0x87b0('0x19')][_0x87b0('0x1a')]===0x1f4){logger[_0x87b0('0x19')]('MailMessage,\x20%s,\x20%s',_0x435922,_0x488d8d[_0x87b0('0x19')][_0x87b0('0x1b')]);return _0x138adb(_0x488d8d['error'][_0x87b0('0x1b')]);}logger[_0x87b0('0x19')](_0x87b0('0x1c'),_0x435922,_0x488d8d['error'][_0x87b0('0x1b')]);return _0x23fd7a(_0x488d8d['error'][_0x87b0('0x1b')]);}else{logger['info'](_0x87b0('0x1c'),_0x435922,_0x87b0('0x1d'));_0x23fd7a(_0x488d8d[_0x87b0('0x1e')]['message']);}})['catch'](function(_0x5ecd9e){logger[_0x87b0('0x19')](_0x87b0('0x1c'),_0x435922,_0x5ecd9e);_0x138adb(_0x5ecd9e);});});}function respondWithResult(_0x581e47,_0x2a7310){_0x2a7310=_0x2a7310||0xc8;return function(_0x2be17e){if(_0x2be17e){return _0x581e47['status'](_0x2a7310)['json'](_0x2be17e);}};}function respondWithFilteredResult(_0x962ca7,_0x22f916){return function(_0x218080){if(_0x218080){var _0x2d6062=typeof _0x22f916[_0x87b0('0x1f')]==='undefined'&&typeof _0x22f916['limit']===_0x87b0('0x20');var _0x3be2c2=_0x218080[_0x87b0('0x21')];var _0x9b4bfe=_0x2d6062?0x0:_0x22f916[_0x87b0('0x1f')];var _0x48576d=_0x2d6062?_0x218080[_0x87b0('0x21')]:_0x22f916['offset']+_0x22f916['limit'];var _0xcdb983;if(_0x48576d>=_0x3be2c2){_0x48576d=_0x3be2c2;_0xcdb983=0xc8;}else{_0xcdb983=0xce;}_0x962ca7[_0x87b0('0x22')](_0xcdb983);return _0x962ca7['set']('Content-Range',_0x9b4bfe+'-'+_0x48576d+'/'+_0x3be2c2)['json'](_0x218080);}return null;};}function saveUpdates(_0x8fa621){return function(_0x514a25){if(_0x514a25){return _0x514a25['update'](_0x8fa621)['then'](function(_0x3d932e){return _0x3d932e;});}return null;};}function removeEntity(_0x3fb0a4){return function(_0x43f487){if(_0x43f487){return _0x43f487['destroy']()[_0x87b0('0x16')](function(){_0x3fb0a4[_0x87b0('0x22')](0xcc)[_0x87b0('0x23')]();});}};}function handleEntityNotFound(_0x35e076){return function(_0xf024f3){if(!_0xf024f3){_0x35e076[_0x87b0('0x24')](0x194);}return _0xf024f3;};}function handleError(_0x47bcf2,_0x287984){_0x287984=_0x287984||0x1f4;return function(_0xcab5a2){logger[_0x87b0('0x19')](_0xcab5a2[_0x87b0('0x25')]);if(_0xcab5a2[_0x87b0('0x26')]){delete _0xcab5a2[_0x87b0('0x26')];}_0x47bcf2[_0x87b0('0x22')](_0x287984)['send'](_0xcab5a2);};}exports[_0x87b0('0x27')]=function(_0xf1fb90,_0x129b20){var _0x1032f7={},_0x10f19e={},_0x4d971a={'count':0x0,'rows':[]};var _0x5c72f3=_[_0x87b0('0x28')](db[_0x87b0('0x29')][_0x87b0('0x2a')],function(_0x31ddb2){return{'name':_0x31ddb2[_0x87b0('0x2b')],'type':_0x31ddb2[_0x87b0('0x2c')][_0x87b0('0x2d')]};});_0x10f19e[_0x87b0('0x2e')]=_['map'](_0x5c72f3,_0x87b0('0x26'));_0x10f19e[_0x87b0('0x2f')]=_[_0x87b0('0x30')](_0xf1fb90[_0x87b0('0x2f')]);_0x10f19e[_0x87b0('0x31')]=_[_0x87b0('0x32')](_0x10f19e[_0x87b0('0x2e')],_0x10f19e[_0x87b0('0x2f')]);_0x1032f7[_0x87b0('0x33')]=_[_0x87b0('0x32')](_0x10f19e['model'],qs[_0x87b0('0x34')](_0xf1fb90[_0x87b0('0x2f')][_0x87b0('0x34')]));_0x1032f7[_0x87b0('0x33')]=_0x1032f7[_0x87b0('0x33')][_0x87b0('0x35')]?_0x1032f7['attributes']:_0x10f19e[_0x87b0('0x2e')];if(!_0xf1fb90['query'][_0x87b0('0x36')](_0x87b0('0x37'))){_0x1032f7[_0x87b0('0x38')]=qs[_0x87b0('0x38')](_0xf1fb90['query'][_0x87b0('0x38')]);_0x1032f7[_0x87b0('0x1f')]=qs[_0x87b0('0x1f')](_0xf1fb90[_0x87b0('0x2f')][_0x87b0('0x1f')]);}_0x1032f7['order']=qs[_0x87b0('0x39')](_0xf1fb90[_0x87b0('0x2f')][_0x87b0('0x39')]);_0x1032f7[_0x87b0('0x3a')]=qs[_0x87b0('0x31')](_[_0x87b0('0x3b')](_0xf1fb90[_0x87b0('0x2f')],_0x10f19e[_0x87b0('0x31')]),_0x5c72f3);if(_0xf1fb90[_0x87b0('0x2f')][_0x87b0('0x3c')]){_0x1032f7[_0x87b0('0x3a')]=_[_0x87b0('0x3d')](_0x1032f7[_0x87b0('0x3a')],{'$or':_[_0x87b0('0x28')](_0x5c72f3,function(_0x6d6496){if(_0x6d6496[_0x87b0('0x2c')]!==_0x87b0('0x3e')){var _0x58b42d={};_0x58b42d[_0x6d6496[_0x87b0('0x26')]]={'$like':'%'+_0xf1fb90[_0x87b0('0x2f')][_0x87b0('0x3c')]+'%'};return _0x58b42d;}})});}_0x1032f7=_['merge']({},_0x1032f7,_0xf1fb90['options']);var _0x30000f={'where':_0x1032f7[_0x87b0('0x3a')]};return db[_0x87b0('0x29')]['count'](_0x30000f)['then'](function(_0x37efec){_0x4d971a[_0x87b0('0x21')]=_0x37efec;if(_0xf1fb90[_0x87b0('0x2f')]['includeAll']){_0x1032f7[_0x87b0('0x3f')]=[{'all':!![]}];}return db[_0x87b0('0x29')]['findAll'](_0x1032f7);})['then'](function(_0x565493){_0x4d971a[_0x87b0('0x40')]=_0x565493;return _0x4d971a;})[_0x87b0('0x16')](respondWithFilteredResult(_0x129b20,_0x1032f7))[_0x87b0('0x41')](handleError(_0x129b20,null));};exports[_0x87b0('0x42')]=function(_0x261fa1,_0x38ef46){var _0x3d9e47={'raw':!![],'where':{'id':_0x261fa1[_0x87b0('0x43')]['id']}},_0x1c7906={};_0x1c7906[_0x87b0('0x2e')]=_[_0x87b0('0x30')](db[_0x87b0('0x29')][_0x87b0('0x2a')]);_0x1c7906[_0x87b0('0x2f')]=_[_0x87b0('0x30')](_0x261fa1[_0x87b0('0x2f')]);_0x1c7906[_0x87b0('0x31')]=_[_0x87b0('0x32')](_0x1c7906['model'],_0x1c7906[_0x87b0('0x2f')]);_0x3d9e47[_0x87b0('0x33')]=_[_0x87b0('0x32')](_0x1c7906['model'],qs[_0x87b0('0x34')](_0x261fa1[_0x87b0('0x2f')][_0x87b0('0x34')]));_0x3d9e47[_0x87b0('0x33')]=_0x3d9e47[_0x87b0('0x33')][_0x87b0('0x35')]?_0x3d9e47['attributes']:_0x1c7906['model'];if(_0x261fa1[_0x87b0('0x2f')][_0x87b0('0x44')]){_0x3d9e47[_0x87b0('0x3f')]=[{'all':!![]}];}_0x3d9e47=_['merge']({},_0x3d9e47,_0x261fa1[_0x87b0('0x45')]);return db[_0x87b0('0x29')][_0x87b0('0x46')](_0x3d9e47)[_0x87b0('0x16')](handleEntityNotFound(_0x38ef46,null))[_0x87b0('0x16')](respondWithResult(_0x38ef46,null))[_0x87b0('0x41')](handleError(_0x38ef46,null));};exports['update']=function(_0x811dbb,_0xae3d74){if(_0x811dbb[_0x87b0('0x47')]['id']){delete _0x811dbb['body']['id'];}return db[_0x87b0('0x29')]['find']({'where':{'id':_0x811dbb['params']['id']}})[_0x87b0('0x16')](handleEntityNotFound(_0xae3d74,null))[_0x87b0('0x16')](saveUpdates(_0x811dbb[_0x87b0('0x47')],null))[_0x87b0('0x16')](respondWithResult(_0xae3d74,null))[_0x87b0('0x41')](handleError(_0xae3d74,null));};exports[_0x87b0('0x48')]=function(_0x1a9c71,_0x264b09){return db[_0x87b0('0x29')][_0x87b0('0x46')]({'where':{'id':_0x1a9c71[_0x87b0('0x43')]['id']}})['then'](handleEntityNotFound(_0x264b09,null))[_0x87b0('0x16')](removeEntity(_0x264b09,null))[_0x87b0('0x41')](handleError(_0x264b09,null));};exports[_0x87b0('0x49')]=function(_0x1b1e54,_0x217936){return db[_0x87b0('0x29')][_0x87b0('0x49')]()[_0x87b0('0x16')](respondWithResult(_0x217936,null))[_0x87b0('0x41')](handleError(_0x217936,null));};exports[_0x87b0('0x4a')]=function(_0x29d8e3,_0x532987){return db[_0x87b0('0x29')]['create'](_0x29d8e3['body'])[_0x87b0('0x16')](function(_0x315640){if(_0x315640){if(_0x315640[_0x87b0('0x4b')]===_0x87b0('0x4c')&&!_0x315640[_0x87b0('0x4d')]){var _0x109827,_0x5ecf58,_0x407a8c;if(_0x29d8e3[_0x87b0('0x47')]['to']){_0x5ecf58=_0x29d8e3[_0x87b0('0x47')]['to'][_0x87b0('0x4e')](',')[0x0];}return db[_0x87b0('0x4f')][_0x87b0('0x50')]({'where':{'id':_0x315640[_0x87b0('0x51')]},'include':[{'model':db[_0x87b0('0x52')],'as':'List','include':[{'model':db[_0x87b0('0x53')],'as':_0x87b0('0x54'),'where':{'email':_0x5ecf58},'limit':0x1,'order':[['updatedAt',_0x87b0('0x55')]]}]},{'model':db[_0x87b0('0x56')],'as':_0x87b0('0x57'),'raw':!![],'include':[{'model':db[_0x87b0('0x58')],'as':_0x87b0('0x58'),'raw':!![]}]}]})[_0x87b0('0x16')](function(_0x5d67bf){_0x109827=_0x5d67bf;if(!_0x109827||!_0x109827[_0x87b0('0x57')])return;var _0x1e36b1=_0x109827['getSmtpOptions']();if(_0x29d8e3[_0x87b0('0x47')][_0x87b0('0x59')]&&_0x29d8e3[_0x87b0('0x47')]['attachments'][_0x87b0('0x35')]){for(var _0x5cf3d7=0x0;_0x5cf3d7<_0x29d8e3[_0x87b0('0x47')][_0x87b0('0x59')][_0x87b0('0x35')];_0x5cf3d7+=0x1){_0x29d8e3[_0x87b0('0x47')][_0x87b0('0x59')][_0x5cf3d7]={'filename':_0x29d8e3[_0x87b0('0x47')][_0x87b0('0x59')][_0x5cf3d7][_0x87b0('0x26')],'path':path[_0x87b0('0x5a')](config[_0x87b0('0x5b')],_0x87b0('0x5c'),_0x29d8e3['body'][_0x87b0('0x59')][_0x5cf3d7]['basename'])};}}_0x407a8c={'account':_0x1e36b1,'message':_0x29d8e3['body']};return;})[_0x87b0('0x16')](function(){if(_0x109827['List']){if(_0x109827['List'][_0x87b0('0x54')][_0x87b0('0x35')]){return _0x109827[_0x87b0('0x5d')][_0x87b0('0x54')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x29d8e3['body'],{'firstName':_0x29d8e3['body']['to'],'email':_0x29d8e3[_0x87b0('0x47')]['to'],'phone':_0x29d8e3[_0x87b0('0x47')]['to'],'ListId':_0x109827[_0x87b0('0x5e')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x87b0('0x16')](function(){if(_0x407a8c){return respondWithRpcPromise(_0x87b0('0x5f'),_0x87b0('0x60'),_0x407a8c,client9003)[_0x87b0('0x16')](function(_0x3879a5){return _0x315640[_0x87b0('0x61')]({'read':!![],'messageId':_0x3879a5['messageId'],'sentAt':moment()[_0x87b0('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x87b0('0x41')](function(_0x4aaa4c){logger[_0x87b0('0x19')]('%s',JSON[_0x87b0('0x18')](_0x4aaa4c));return _0x315640;});}return _0x315640;});}return _0x315640;}})[_0x87b0('0x16')](respondWithResult(_0x532987,0xc9))[_0x87b0('0x41')](handleError(_0x532987,null));};exports[_0x87b0('0x63')]=function(_0x3ab9a4,_0x4c6d32){var _0xbd73a6={'agent':{},'channel':_0x87b0('0x64')};if(_0x3ab9a4[_0x87b0('0x47')]['id']){delete _0x3ab9a4[_0x87b0('0x47')]['id'];}_0x3ab9a4['body'][_0x87b0('0x65')]=!![];_0x3ab9a4[_0x87b0('0x47')][_0x87b0('0x66')]=moment()[_0x87b0('0x62')](_0x87b0('0x67'));_0x3ab9a4['body'][_0x87b0('0x68')]=_0x3ab9a4['body'][_0x87b0('0x68')]||_0x3ab9a4[_0x87b0('0x69')]['id'];_0xbd73a6[_0x87b0('0x6a')]['id']=_0x3ab9a4[_0x87b0('0x47')][_0x87b0('0x68')];return db['MailMessage'][_0x87b0('0x46')]({'where':{'id':_0x3ab9a4[_0x87b0('0x43')]['id'],'UserId':null}})[_0x87b0('0x16')](handleEntityNotFound(_0x4c6d32,null))[_0x87b0('0x16')](saveUpdates(_0x3ab9a4[_0x87b0('0x47')],null))['then'](function(_0x15e5c5){if(_0x15e5c5){_0xbd73a6[_0x87b0('0x1b')]=_0x15e5c5[_0x87b0('0x6b')]({'plain':!![]});return db[_0x87b0('0x6c')][_0x87b0('0x46')]({'where':{'id':_0x15e5c5[_0x87b0('0x6d')]}});}return null;})['then'](handleEntityNotFound(_0x4c6d32,null))['then'](function(_0x4979bf){if(_0x4979bf){return _0x4979bf[_0x87b0('0x61')]({'UserId':_0x3ab9a4['body'][_0x87b0('0x68')],'read1stAt':_[_0x87b0('0x6e')](_0x4979bf[_0x87b0('0x6f')])?moment()[_0x87b0('0x62')](_0x87b0('0x67')):undefined});}return null;})[_0x87b0('0x16')](function(_0x2a9a32){if(_0x2a9a32){_0xbd73a6['interaction']=_0x2a9a32[_0x87b0('0x6b')]({'plain':!![]});interaction_log[_0x87b0('0x17')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ab9a4['user']['id'],_0x3ab9a4[_0x87b0('0x69')][_0x87b0('0x26')],_0x3ab9a4[_0x87b0('0x69')][_0x87b0('0x70')],_0xbd73a6[_0x87b0('0x71')]['id'],_0x3ab9a4[_0x87b0('0x47')]?JSON[_0x87b0('0x18')](_0x3ab9a4[_0x87b0('0x47')]):_0x87b0('0x72'));return respondWithRpcPromise(_0x87b0('0x73'),'acceptMessage',_0xbd73a6);}return null;})[_0x87b0('0x16')](function(_0x5004de){var _0x411367=_0x87b0('0x74')+_0x5004de['message'][_0x87b0('0x75')];return db['sequelize'][_0x87b0('0x2f')](_0x411367,{'type':db[_0x87b0('0x76')]['QueryTypes'][_0x87b0('0x77')],'raw':!![]})[_0x87b0('0x16')](function(_0x3c6a88){return _0x3c6a88;});})['then'](function(_0x26b950){if(_0x26b950){_0xbd73a6[_0x87b0('0x1b')][_0x87b0('0x78')]=_0x26b950[0x0];if(!_0x3ab9a4['body'][_0x87b0('0x68')])return;return db['User'][_0x87b0('0x46')]({'where':{'id':_0x3ab9a4[_0x87b0('0x47')][_0x87b0('0x68')],'role':'agent'},'attributes':['id',_0x87b0('0x26'),'fullname',_0x87b0('0x79'),_0x87b0('0x7a')],'raw':!![]});}return null;})['then'](function(_0x4d4c51){if(!_0x4d4c51)return null;_0xbd73a6[_0x87b0('0x1b')]['agent']=_0x4d4c51;return _0xbd73a6;})[_0x87b0('0x16')](function(_0x4a1488){if(_0x4a1488){if(_0x3ab9a4[_0x87b0('0x47')][_0x87b0('0x7b')]){_0xbd73a6[_0x87b0('0x1b')][_0x87b0('0x7c')]=util['format'](_0x87b0('0x7d'),_0x3ab9a4[_0x87b0('0x69')]['name']);_0xbd73a6['message'][_0x87b0('0x7e')]=_0xbd73a6['channel'];_0xbd73a6[_0x87b0('0x1b')]['motionChannel']=_0xbd73a6[_0x87b0('0x7e')];_0xbd73a6[_0x87b0('0x1b')][_0x87b0('0x7f')]=_0x87b0('0x63');_0xbd73a6['message'][_0x87b0('0x47')]=htmlToText[_0x87b0('0x80')](_0xbd73a6[_0x87b0('0x1b')][_0x87b0('0x47')]);return respondWithRpcPromise(_0x87b0('0x81'),'EventManager',{'event':'acceptmessage','message':_0xbd73a6[_0x87b0('0x1b')]},client9002)[_0x87b0('0x16')](function(){return _0xbd73a6;});}return _0xbd73a6;}return null;})[_0x87b0('0x16')](respondWithResult(_0x4c6d32,null))[_0x87b0('0x41')](handleError(_0x4c6d32,null));};exports[_0x87b0('0x82')]=function(_0x5ba3eb,_0x6c90ce){var _0x27e6fc={'agent':{},'channel':'mail'};if(_0x5ba3eb['body']['id']){delete _0x5ba3eb[_0x87b0('0x47')]['id'];}_0x5ba3eb[_0x87b0('0x47')][_0x87b0('0x68')]=_0x5ba3eb[_0x87b0('0x47')]['UserId']||_0x5ba3eb['user']['id'];_0x27e6fc[_0x87b0('0x6a')]['id']=_0x5ba3eb[_0x87b0('0x47')][_0x87b0('0x68')];return db[_0x87b0('0x29')][_0x87b0('0x46')]({'where':{'id':_0x5ba3eb['params']['id'],'UserId':null}})[_0x87b0('0x16')](handleEntityNotFound(_0x6c90ce,null))[_0x87b0('0x16')](function(_0x3ffc2a){if(_0x3ffc2a){_0x27e6fc[_0x87b0('0x1b')]=_0x3ffc2a['get']({'plain':!![]});return db[_0x87b0('0x6c')]['find']({'where':{'id':_0x3ffc2a[_0x87b0('0x6d')]}});}return null;})[_0x87b0('0x16')](handleEntityNotFound(_0x6c90ce,null))[_0x87b0('0x16')](function(_0x5d2cbe){if(_0x5d2cbe){_0x27e6fc[_0x87b0('0x71')]=_0x5d2cbe[_0x87b0('0x6b')]({'plain':!![]});interaction_log[_0x87b0('0x17')](_0x87b0('0x83'),_0x5ba3eb[_0x87b0('0x69')]['id'],_0x5ba3eb[_0x87b0('0x69')]['name'],_0x5ba3eb['user'][_0x87b0('0x70')],_0x27e6fc[_0x87b0('0x71')]['id'],_0x5ba3eb[_0x87b0('0x47')]?JSON[_0x87b0('0x18')](_0x5ba3eb[_0x87b0('0x47')]):_0x87b0('0x72'));return respondWithRpcPromise(_0x87b0('0x84'),'rejectMessage',_0x27e6fc);}return null;})[_0x87b0('0x16')](function(_0x23307e){var _0x3d1083=_0x87b0('0x74')+_0x23307e['message'][_0x87b0('0x75')];return db[_0x87b0('0x85')][_0x87b0('0x2f')](_0x3d1083,{'type':db[_0x87b0('0x76')]['QueryTypes'][_0x87b0('0x77')],'raw':!![]})[_0x87b0('0x16')](function(_0x53cd5e){return _0x53cd5e;});})[_0x87b0('0x16')](function(_0x16da81){if(_0x16da81){_0x27e6fc[_0x87b0('0x1b')][_0x87b0('0x78')]=_0x16da81[0x0];if(!_0x5ba3eb['body'][_0x87b0('0x68')])return;return db[_0x87b0('0x86')]['find']({'where':{'id':_0x5ba3eb[_0x87b0('0x47')][_0x87b0('0x68')],'role':_0x87b0('0x6a')},'attributes':['id','name',_0x87b0('0x87'),_0x87b0('0x79'),'internal'],'raw':!![]});}return null;})[_0x87b0('0x16')](function(_0x24e571){if(!_0x24e571)return null;_0x27e6fc[_0x87b0('0x1b')]['agent']=_0x24e571;return _0x27e6fc;})[_0x87b0('0x16')](function(_0x559c5b){if(_0x559c5b){_0x559c5b[_0x87b0('0x1b')][_0x87b0('0x7c')]=util[_0x87b0('0x62')](_0x87b0('0x7d'),_0x5ba3eb[_0x87b0('0x69')][_0x87b0('0x26')]);_0x559c5b[_0x87b0('0x1b')]['channel']=_0x27e6fc[_0x87b0('0x7e')];_0x559c5b[_0x87b0('0x1b')]['motionChannel']=_0x27e6fc[_0x87b0('0x7e')];_0x559c5b[_0x87b0('0x1b')]['event']=_0x87b0('0x82');_0x559c5b[_0x87b0('0x1b')]['body']=htmlToText[_0x87b0('0x80')](_0x27e6fc[_0x87b0('0x1b')][_0x87b0('0x47')]);respondWithRpcPromise(_0x87b0('0x81'),_0x87b0('0x81'),{'event':'rejectmessage','message':_0x559c5b[_0x87b0('0x1b')]},client9002);return _0x27e6fc;}return null;})[_0x87b0('0x16')](respondWithResult(_0x6c90ce,null))[_0x87b0('0x41')](handleError(_0x6c90ce,null));};exports[_0x87b0('0x88')]=function(_0x444ecc,_0x9320c3){var _0x47c360=moment()[_0x87b0('0x89')]()[_0x87b0('0x8a')]();var _0x484724=path[_0x87b0('0x5a')](config[_0x87b0('0x5b')],'server','files',_0x87b0('0x8b'));var _0x33e965=path['join'](config['root'],_0x87b0('0x8c'),_0x87b0('0x8d'),_0x87b0('0x59'));var _0x16f9d1=util[_0x87b0('0x62')](_0x87b0('0x8e'),_0x47c360);return db['MailMessage'][_0x87b0('0x46')]({'where':{'id':_0x444ecc[_0x87b0('0x43')]['id']},'attributes':['id',_0x87b0('0x47'),_0x87b0('0x8f'),'to','cc',_0x87b0('0x90'),_0x87b0('0x91'),_0x87b0('0x92')],'include':_0x444ecc[_0x87b0('0x2f')][_0x87b0('0x59')]?[{'model':db[_0x87b0('0x93')],'as':_0x87b0('0x94')}]:undefined})[_0x87b0('0x16')](handleEntityNotFound(_0x9320c3,null))[_0x87b0('0x16')](function(_0x3dc3ab){if(_0x3dc3ab){var _0x1930a3=_0x3dc3ab;var _0x18da91={'from':_0x1930a3[_0x87b0('0x8f')],'to':_0x1930a3['to'],'subject':_0x1930a3['subject'],'html':htmlEntities[_0x87b0('0x95')](_0x1930a3[_0x87b0('0x47')]),'headers':{'Date':moment(_0x1930a3[_0x87b0('0x92')])[_0x87b0('0x62')](_0x87b0('0x96'))},'attachments':[]};if(_0x3dc3ab['cc']){_0x18da91[_0x87b0('0x97')]['Cc']=_0x3dc3ab['cc'];}if(_0x3dc3ab[_0x87b0('0x90')]){_0x18da91[_0x87b0('0x97')][_0x87b0('0x98')]=_0x3dc3ab[_0x87b0('0x90')];}return new BPromise(function(_0x56aa3a,_0x297de0){if(_0x3dc3ab[_0x87b0('0x94')]){for(var _0xbffce5=0x0;_0xbffce5<_0x3dc3ab[_0x87b0('0x94')]['length'];_0xbffce5++){var _0x2aae07=_0x3dc3ab[_0x87b0('0x94')][_0xbffce5];var _0x27aa79=path['join'](_0x33e965,_0x2aae07['basename']);if(fs['existsSync'](_0x27aa79)){_0x18da91['attachments'][_0x87b0('0x99')]({'name':_0x2aae07[_0x87b0('0x26')],'contentType':_0x2aae07['type'],'data':fs[_0x87b0('0x9a')](_0x27aa79)});}}}emlformat[_0x87b0('0x9b')](_0x18da91,function(_0x323bd6,_0x2ebcb2){if(_0x323bd6)return _0x297de0(_0x323bd6);fs[_0x87b0('0x9c')](path[_0x87b0('0x5a')](_0x484724,_0x16f9d1),_0x2ebcb2);return _0x56aa3a(_0x2ebcb2);});});}})[_0x87b0('0x16')](function(_0x28bcf8){if(_0x28bcf8){return _0x9320c3[_0x87b0('0x88')](path[_0x87b0('0x5a')](_0x484724,_0x16f9d1),_0x16f9d1,function(_0x42c685){if(!_0x42c685)fs[_0x87b0('0x9d')](path[_0x87b0('0x5a')](_0x484724,_0x16f9d1));});}})[_0x87b0('0x41')](handleError(_0x9320c3,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index b41250b..51a2792 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 _0x7c96=['emit','hasOwnProperty','hook','exports','events','MailMessage','setMaxListeners','update','remove'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x7c96,0xf7));var _0x67c9=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x7c96[_0x1a36a5];return _0x746243;};'use strict';var EventEmitter=require(_0x67c9('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x67c9('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x67c9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x67c9('0x3'),'afterDestroy':_0x67c9('0x4')};function emitEvent(_0x189da8){return function(_0x4b6f92,_0x5d7b24,_0x170508){MailMessageEvents[_0x67c9('0x5')](_0x189da8+':'+_0x4b6f92['id'],_0x4b6f92);MailMessageEvents['emit'](_0x189da8,_0x4b6f92);_0x170508(null);};}for(var e in events){if(events[_0x67c9('0x6')](e)){var event=events[e];MailMessage[_0x67c9('0x7')](e,emitEvent(event));}}module[_0x67c9('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x4aa7=['MailMessage','setMaxListeners','save','update','remove','emit','exports','../../mysqldb'];(function(_0x5a4e82,_0x22e4b7){var _0x536af9=function(_0x45a484){while(--_0x45a484){_0x5a4e82['push'](_0x5a4e82['shift']());}};_0x536af9(++_0x22e4b7);}(_0x4aa7,0x14f));var _0x74aa=function(_0x3ce6b2,_0x1fc0b0){_0x3ce6b2=_0x3ce6b2-0x0;var _0x98a558=_0x4aa7[_0x3ce6b2];return _0x98a558;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x74aa('0x0'))['db'][_0x74aa('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x74aa('0x2')](0x0);var events={'afterCreate':_0x74aa('0x3'),'afterUpdate':_0x74aa('0x4'),'afterDestroy':_0x74aa('0x5')};function emitEvent(_0x64ec4b){return function(_0x1851b6,_0x5ad9ee,_0x368835){MailMessageEvents[_0x74aa('0x6')](_0x64ec4b+':'+_0x1851b6['id'],_0x1851b6);MailMessageEvents['emit'](_0x64ec4b,_0x1851b6);_0x368835(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x74aa('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index ac45b36..83330f2 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 _0x7dcc=['./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString','toLowerCase','direction','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','html-to-text','path'];(function(_0x860e84,_0x3a791f){var _0x23cc7f=function(_0x8bf945){while(--_0x8bf945){_0x860e84['push'](_0x860e84['shift']());}};_0x23cc7f(++_0x3a791f);}(_0x7dcc,0xf8));var _0xc7dc=function(_0x204191,_0x55d566){_0x204191=_0x204191-0x0;var _0x526ccf=_0x7dcc[_0x204191];return _0x526ccf;};'use strict';var _=require(_0xc7dc('0x0'));var util=require(_0xc7dc('0x1'));var logger=require('../../config/logger')(_0xc7dc('0x2'));var moment=require(_0xc7dc('0x3'));var BPromise=require(_0xc7dc('0x4'));var rp=require(_0xc7dc('0x5'));var htmlToText=require(_0xc7dc('0x6'));var fs=require('fs');var path=require(_0xc7dc('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc7dc('0x8'));module[_0xc7dc('0x9')]=function(_0x2842c0,_0xe1c567){return _0x2842c0['define'](_0xc7dc('0xa'),attributes,{'tableName':_0xc7dc('0xb'),'paranoid':![],'indexes':[{'name':_0xc7dc('0xc'),'fields':['messageId']},{'name':'fti_mail_messages','fields':[_0xc7dc('0xd'),_0xc7dc('0xe')],'type':_0xc7dc('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3ebe10,_0x37839d,_0x43792e){if(_0x3ebe10[_0xc7dc('0x10')]){_0x3ebe10[_0xc7dc('0xd')]=htmlToText[_0xc7dc('0x11')](_0x3ebe10[_0xc7dc('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x43792e(null,_0x37839d);},'afterCreate':function(_0x23397d,_0x54bb9d,_0x23573d){var _0x55fce3=_0x2842c0['models'];var _0x43be25=_0x23397d['get']({'plain':!![]});if(_0x43be25['direction'][_0xc7dc('0x12')]()==='in'||_0x43be25[_0xc7dc('0x13')][_0xc7dc('0x12')]()===_0xc7dc('0x14')&&!_0x43be25[_0xc7dc('0x15')]&&!_[_0xc7dc('0x16')](_0x43be25[_0xc7dc('0x17')])){_0x55fce3[_0xc7dc('0x18')]['findOne']({'where':{'id':_0x43be25[_0xc7dc('0x19')]}})[_0xc7dc('0x1a')](function(_0x593552){if(_0x593552){_0x593552[_0xc7dc('0x1b')]({'lastMsgAt':_0x43be25[_0xc7dc('0x1c')],'lastMsgDirection':_0x43be25['direction']['toLowerCase']()});}})[_0xc7dc('0x1d')](function(_0x9dc25c){console[_0xc7dc('0x1e')](_0x9dc25c);});}_0x23573d();}},'charset':'utf8mb4','collate':_0xc7dc('0x1f')});}; \ No newline at end of file +var _0xdac3=['path','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','get','direction','out','secret','isNil','UserId','findOne','then','update','createdAt','toLowerCase','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0xdac3,0x1db));var _0x3dac=function(_0x1d03f1,_0x7f2edf){_0x1d03f1=_0x1d03f1-0x0;var _0x40c77e=_0xdac3[_0x1d03f1];return _0x40c77e;};'use strict';var _=require(_0x3dac('0x0'));var util=require(_0x3dac('0x1'));var logger=require(_0x3dac('0x2'))(_0x3dac('0x3'));var moment=require('moment');var BPromise=require(_0x3dac('0x4'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x3dac('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3dac('0x6'));module[_0x3dac('0x7')]=function(_0x171f4d,_0x4cc640){return _0x171f4d[_0x3dac('0x8')](_0x3dac('0x9'),attributes,{'tableName':_0x3dac('0xa'),'paranoid':![],'indexes':[{'name':_0x3dac('0xb'),'fields':[_0x3dac('0xb')]},{'name':_0x3dac('0xc'),'fields':[_0x3dac('0xd'),'subject'],'type':_0x3dac('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5e8fed,_0x206b6b,_0x363c0e){if(_0x5e8fed[_0x3dac('0xf')]){_0x5e8fed[_0x3dac('0xd')]=htmlToText[_0x3dac('0x10')](_0x5e8fed[_0x3dac('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x363c0e(null,_0x206b6b);},'afterCreate':function(_0x2ea8e2,_0x2829bd,_0x2d1644){var _0x16d66e=_0x171f4d['models'];var _0x3ce309=_0x2ea8e2[_0x3dac('0x11')]({'plain':!![]});if(_0x3ce309[_0x3dac('0x12')]['toLowerCase']()==='in'||_0x3ce309[_0x3dac('0x12')]['toLowerCase']()===_0x3dac('0x13')&&!_0x3ce309[_0x3dac('0x14')]&&!_[_0x3dac('0x15')](_0x3ce309[_0x3dac('0x16')])){_0x16d66e['MailInteraction'][_0x3dac('0x17')]({'where':{'id':_0x3ce309['MailInteractionId']}})[_0x3dac('0x18')](function(_0xe567b6){if(_0xe567b6){_0xe567b6[_0x3dac('0x19')]({'lastMsgAt':_0x3ce309[_0x3dac('0x1a')],'lastMsgDirection':_0x3ce309[_0x3dac('0x12')][_0x3dac('0x1b')]()});}})[_0x3dac('0x1c')](function(_0x3695fc){console[_0x3dac('0x1d')](_0x3695fc);});}_0x2d1644();}},'charset':_0x3dac('0x1e'),'collate':_0x3dac('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index a2c7891..6981fc7 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 _0x1a37=['debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','register','request','then','request\x20sent'];(function(_0x4f0e9c,_0x402a17){var _0x854504=function(_0xb936b1){while(--_0xb936b1){_0x4f0e9c['push'](_0x4f0e9c['shift']());}};_0x854504(++_0x402a17);}(_0x1a37,0xb4));var _0x71a3=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x1a37[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var BPromise=require(_0x71a3('0x3'));var rs=require(_0x71a3('0x4'));var fs=require('fs');var Redis=require(_0x71a3('0x5'));var db=require(_0x71a3('0x6'))['db'];var utils=require(_0x71a3('0x7'));var logger=require(_0x71a3('0x8'))(_0x71a3('0x9'));var config=require('../../config/environment');var jayson=require(_0x71a3('0xa'));var client=jayson['client'][_0x71a3('0xb')]({'port':0x232a});config[_0x71a3('0xc')]=_[_0x71a3('0xd')](config[_0x71a3('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailMessage.socket')[_0x71a3('0xe')](socket);function respondWithRpcPromise(_0x18320a,_0x3709bc,_0x3aeb48){return new BPromise(function(_0x3a7fc1,_0x2215f2){return client[_0x71a3('0xf')](_0x18320a,_0x3aeb48)[_0x71a3('0x10')](function(_0x5c464c){logger['info']('MailMessage,\x20%s,\x20%s',_0x3709bc,_0x71a3('0x11'));logger[_0x71a3('0x12')](_0x71a3('0x13'),_0x3709bc,_0x71a3('0x11'),JSON[_0x71a3('0x14')](_0x5c464c));if(_0x5c464c[_0x71a3('0x15')]){if(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x16')]===0x1f4){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5c464c[_0x71a3('0x15')]['message']);return _0x2215f2(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x3709bc,_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);return _0x3a7fc1(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}else{logger[_0x71a3('0x19')](_0x71a3('0x17'),_0x3709bc,'request\x20sent');_0x3a7fc1(_0x5c464c[_0x71a3('0x1a')][_0x71a3('0x18')]);}})['catch'](function(_0x5f4562){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5f4562);_0x2215f2(_0x5f4562);});});}exports[_0x71a3('0x1b')]=function(_0x1c4ec2){var _0x4a7980=this;return new Promise(function(_0x596328,_0x1ab947){return db[_0x71a3('0x1c')][_0x71a3('0x1d')](_0x1c4ec2[_0x71a3('0x1e')],{'raw':_0x1c4ec2[_0x71a3('0x1f')]?_0x1c4ec2['options'][_0x71a3('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x3bf78e){logger[_0x71a3('0x19')](_0x71a3('0x1b'),_0x1c4ec2);logger[_0x71a3('0x12')](_0x71a3('0x1b'),_0x1c4ec2,JSON[_0x71a3('0x14')](_0x3bf78e));_0x596328(_0x3bf78e);})['catch'](function(_0x26e6e7){logger[_0x71a3('0x15')](_0x71a3('0x1b'),_0x26e6e7[_0x71a3('0x18')],_0x1c4ec2);_0x1ab947(_0x4a7980[_0x71a3('0x15')](0x1f4,_0x26e6e7['message']));});});}; \ No newline at end of file +var _0xfcbb=['catch','CreateMailMessage','body','options','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2c2756,_0xb17e2a){var _0x10d3ae=function(_0x2a8a20){while(--_0x2a8a20){_0x2c2756['push'](_0x2c2756['shift']());}};_0x10d3ae(++_0xb17e2a);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x167fb3,_0x594755){_0x167fb3=_0x167fb3-0x0;var _0x198223=_0xfcbb[_0x167fb3];return _0x198223;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});config[_0xbfcb('0xa')]=_[_0xbfcb('0xb')](config[_0xbfcb('0xa')],{'host':_0xbfcb('0xc'),'port':0x18eb});var socket=require(_0xbfcb('0xd'))(new Redis(config['redis']));require(_0xbfcb('0xe'))[_0xbfcb('0xf')](socket);function respondWithRpcPromise(_0x346685,_0x52b2f8,_0x2c72f3){return new BPromise(function(_0x3d01fa,_0x3e735a){return client[_0xbfcb('0x10')](_0x346685,_0x2c72f3)[_0xbfcb('0x11')](function(_0x1fad67){logger['info'](_0xbfcb('0x12'),_0x52b2f8,_0xbfcb('0x13'));logger[_0xbfcb('0x14')](_0xbfcb('0x15'),_0x52b2f8,'request\x20sent',JSON[_0xbfcb('0x16')](_0x1fad67));if(_0x1fad67['error']){if(_0x1fad67[_0xbfcb('0x17')][_0xbfcb('0x18')]===0x1f4){logger[_0xbfcb('0x17')](_0xbfcb('0x12'),_0x52b2f8,_0x1fad67[_0xbfcb('0x17')][_0xbfcb('0x19')]);return _0x3e735a(_0x1fad67[_0xbfcb('0x17')][_0xbfcb('0x19')]);}logger[_0xbfcb('0x17')](_0xbfcb('0x12'),_0x52b2f8,_0x1fad67[_0xbfcb('0x17')][_0xbfcb('0x19')]);return _0x3d01fa(_0x1fad67[_0xbfcb('0x17')][_0xbfcb('0x19')]);}else{logger[_0xbfcb('0x1a')](_0xbfcb('0x12'),_0x52b2f8,_0xbfcb('0x13'));_0x3d01fa(_0x1fad67[_0xbfcb('0x1b')][_0xbfcb('0x19')]);}})[_0xbfcb('0x1c')](function(_0xccd6ff){logger[_0xbfcb('0x17')]('MailMessage,\x20%s,\x20%s',_0x52b2f8,_0xccd6ff);_0x3e735a(_0xccd6ff);});});}exports[_0xbfcb('0x1d')]=function(_0x37263b){var _0x54ec7a=this;return new Promise(function(_0xa3c089,_0x1a7225){return db['MailMessage']['create'](_0x37263b[_0xbfcb('0x1e')],{'raw':_0x37263b[_0xbfcb('0x1f')]?_0x37263b[_0xbfcb('0x1f')][_0xbfcb('0x20')]===undefined?!![]:![]:!![]})[_0xbfcb('0x11')](function(_0x56c158){logger[_0xbfcb('0x1a')](_0xbfcb('0x1d'),_0x37263b);logger[_0xbfcb('0x14')](_0xbfcb('0x1d'),_0x37263b,JSON[_0xbfcb('0x16')](_0x56c158));_0xa3c089(_0x56c158);})[_0xbfcb('0x1c')](function(_0x69c8e9){logger[_0xbfcb('0x17')](_0xbfcb('0x1d'),_0x69c8e9[_0xbfcb('0x19')],_0x37263b);_0x1a7225(_0x54ec7a[_0xbfcb('0x17')](0x1f4,_0x69c8e9[_0xbfcb('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 36e7ef7..b61b99c 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 _0x6d04=['register','mailMessage:','./mailMessage.events','update','emit','removeListener'];(function(_0x5ce0f1,_0x2921d5){var _0x762c7a=function(_0x2d1a06){while(--_0x2d1a06){_0x5ce0f1['push'](_0x5ce0f1['shift']());}};_0x762c7a(++_0x2921d5);}(_0x6d04,0x74));var _0x46d0=function(_0x295627,_0x48231d){_0x295627=_0x295627-0x0;var _0x35ef9c=_0x6d04[_0x295627];return _0x35ef9c;};'use strict';var MailMessageEvents=require(_0x46d0('0x0'));var events=['save','remove',_0x46d0('0x1')];function createListener(_0x1371b7,_0x59d25b){return function(_0x52833f){_0x59d25b[_0x46d0('0x2')](_0x1371b7,_0x52833f);};}function removeListener(_0x100421,_0x8148e1){return function(){MailMessageEvents[_0x46d0('0x3')](_0x100421,_0x8148e1);};}exports[_0x46d0('0x4')]=function(_0x2c5ce8){for(var _0x5efd2f=0x0,_0x4d66b4=events['length'];_0x5efd2f<_0x4d66b4;_0x5efd2f++){var _0x5a621b=events[_0x5efd2f];var _0x52bd79=createListener(_0x46d0('0x5')+_0x5a621b,_0x2c5ce8);MailMessageEvents['on'](_0x5a621b,_0x52bd79);}}; \ No newline at end of file +var _0x9643=['remove','update','emit','register','length','./mailMessage.events'];(function(_0x32fc6d,_0xa1cfe9){var _0x45eb18=function(_0xc5588d){while(--_0xc5588d){_0x32fc6d['push'](_0x32fc6d['shift']());}};_0x45eb18(++_0xa1cfe9);}(_0x9643,0x119));var _0x3964=function(_0x1b9ff4,_0x29bea7){_0x1b9ff4=_0x1b9ff4-0x0;var _0x25ed26=_0x9643[_0x1b9ff4];return _0x25ed26;};'use strict';var MailMessageEvents=require(_0x3964('0x0'));var events=['save',_0x3964('0x1'),_0x3964('0x2')];function createListener(_0x23a8e4,_0x59d292){return function(_0x462333){_0x59d292[_0x3964('0x3')](_0x23a8e4,_0x462333);};}function removeListener(_0x564ec8,_0x49a8a2){return function(){MailMessageEvents['removeListener'](_0x564ec8,_0x49a8a2);};}exports[_0x3964('0x4')]=function(_0x20a2b6){for(var _0x296b6a=0x0,_0x4a264a=events[_0x3964('0x5')];_0x296b6a<_0x4a264a;_0x296b6a++){var _0x2406a4=events[_0x296b6a];var _0x53c312=createListener('mailMessage:'+_0x2406a4,_0x20a2b6);MailMessageEvents['on'](_0x2406a4,_0x53c312);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 054acde..54cf3e4 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 _0xbd7c=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','path'];(function(_0x30399b,_0x4f37a8){var _0x3745f9=function(_0x1a0eab){while(--_0x1a0eab){_0x30399b['push'](_0x30399b['shift']());}};_0x3745f9(++_0x4f37a8);}(_0xbd7c,0xd6));var _0xcbd7=function(_0x49c7ff,_0x434c5f){_0x49c7ff=_0x49c7ff-0x0;var _0x3a91de=_0xbd7c[_0x49c7ff];return _0x3a91de;};'use strict';var multer=require(_0xcbd7('0x0'));var util=require(_0xcbd7('0x1'));var path=require(_0xcbd7('0x2'));var timeout=require(_0xcbd7('0x3'));var express=require(_0xcbd7('0x4'));var router=express[_0xcbd7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcbd7('0x6'));var interaction=require(_0xcbd7('0x7'));var config=require(_0xcbd7('0x8'));var controller=require(_0xcbd7('0x9'));router[_0xcbd7('0xa')]('/',auth[_0xcbd7('0xb')](),controller[_0xcbd7('0xc')]);router[_0xcbd7('0xa')](_0xcbd7('0xd'),auth[_0xcbd7('0xb')](),controller['describe']);router[_0xcbd7('0xa')](_0xcbd7('0xe'),auth[_0xcbd7('0xb')](),controller['show']);router[_0xcbd7('0xa')](_0xcbd7('0xf'),auth[_0xcbd7('0xb')](),controller[_0xcbd7('0x10')]);router['get'](_0xcbd7('0x11'),auth[_0xcbd7('0xb')](),controller[_0xcbd7('0x12')]);router[_0xcbd7('0xa')](_0xcbd7('0x13'),auth['isAuthenticated'](),controller[_0xcbd7('0x14')]);router['post']('/',auth[_0xcbd7('0xb')](),controller[_0xcbd7('0x15')]);router[_0xcbd7('0x16')](_0xcbd7('0x11'),auth[_0xcbd7('0xb')](),controller['addTeams']);router[_0xcbd7('0x16')](_0xcbd7('0x13'),auth[_0xcbd7('0xb')](),controller[_0xcbd7('0x17')]);router[_0xcbd7('0x18')](_0xcbd7('0xe'),auth[_0xcbd7('0xb')](),controller[_0xcbd7('0x19')]);router['delete']('/:id',auth[_0xcbd7('0xb')](),controller[_0xcbd7('0x1a')]);router[_0xcbd7('0x1b')](_0xcbd7('0x11'),auth[_0xcbd7('0xb')](),controller[_0xcbd7('0x1c')]);router[_0xcbd7('0x1b')](_0xcbd7('0x13'),auth['isAuthenticated'](),controller[_0xcbd7('0x1d')]);module[_0xcbd7('0x1e')]=router; \ No newline at end of file +var _0xbd0d=['isAuthenticated','index','get','/describe','describe','show','getMembers','getTeams','/:id/users','create','post','addTeams','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./mailQueue.controller'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0xbd0d,0x1b3));var _0xdbd0=function(_0xe446b9,_0x4b27df){_0xe446b9=_0xe446b9-0x0;var _0xb77c67=_0xbd0d[_0xe446b9];return _0xb77c67;};'use strict';var multer=require(_0xdbd0('0x0'));var util=require(_0xdbd0('0x1'));var path=require('path');var timeout=require(_0xdbd0('0x2'));var express=require(_0xdbd0('0x3'));var router=express[_0xdbd0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbd0('0x5'));var config=require('../../config/environment');var controller=require(_0xdbd0('0x6'));router['get']('/',auth[_0xdbd0('0x7')](),controller[_0xdbd0('0x8')]);router[_0xdbd0('0x9')](_0xdbd0('0xa'),auth['isAuthenticated'](),controller[_0xdbd0('0xb')]);router[_0xdbd0('0x9')]('/:id',auth[_0xdbd0('0x7')](),controller[_0xdbd0('0xc')]);router[_0xdbd0('0x9')]('/:id/members',auth[_0xdbd0('0x7')](),controller[_0xdbd0('0xd')]);router[_0xdbd0('0x9')]('/:id/teams',auth[_0xdbd0('0x7')](),controller[_0xdbd0('0xe')]);router[_0xdbd0('0x9')](_0xdbd0('0xf'),auth[_0xdbd0('0x7')](),controller['getAgents']);router['post']('/',auth[_0xdbd0('0x7')](),controller[_0xdbd0('0x10')]);router[_0xdbd0('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0xdbd0('0x12')]);router[_0xdbd0('0x11')](_0xdbd0('0xf'),auth[_0xdbd0('0x7')](),controller['addAgents']);router['put'](_0xdbd0('0x13'),auth['isAuthenticated'](),controller[_0xdbd0('0x14')]);router[_0xdbd0('0x15')](_0xdbd0('0x13'),auth[_0xdbd0('0x7')](),controller[_0xdbd0('0x16')]);router[_0xdbd0('0x15')]('/:id/teams',auth[_0xdbd0('0x7')](),controller[_0xdbd0('0x17')]);router[_0xdbd0('0x15')](_0xdbd0('0xf'),auth[_0xdbd0('0x7')](),controller[_0xdbd0('0x18')]);module[_0xdbd0('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 55447d5..83d7a10 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 _0x8f95=['roundrobin','name','ENUM','beepall'];(function(_0x565ffe,_0x5ebbbe){var _0x31b86e=function(_0x3abc6d){while(--_0x3abc6d){_0x565ffe['push'](_0x565ffe['shift']());}};_0x31b86e(++_0x5ebbbe);}(_0x8f95,0x1cd));var _0x58f9=function(_0x2ec1fd,_0x17048b){_0x2ec1fd=_0x2ec1fd-0x0;var _0x57bd0d=_0x8f95[_0x2ec1fd];return _0x57bd0d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x58f9('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x58f9('0x1')]('rrmemory',_0x58f9('0x2'),_0x58f9('0x3'))}}; \ No newline at end of file +var _0x50ee=['name','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x15c3df,_0x530c8d){var _0x51f259=function(_0x19b945){while(--_0x19b945){_0x15c3df['push'](_0x15c3df['shift']());}};_0x51f259(++_0x530c8d);}(_0x50ee,0x117));var _0xe50e=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0x50ee[_0x52e68e];return _0x3211a4;};'use strict';var Sequelize=require(_0xe50e('0x0'));module[_0xe50e('0x1')]={'name':{'type':Sequelize[_0xe50e('0x2')],'unique':_0xe50e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe50e('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xe50e('0x4'),_0xe50e('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index e3cbd17..3f8d4fe 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 _0x1bae=['forEach','emit','userMailQueue:save','removeTeams','select','field','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','update','then','get','MailQueues','UserProfileResource','destroy','error','stack','name','send','map','MailQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','fields','attributes','merge','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','describe','getMembers','findOne','UserMailQueue','length','nolimit','order','sort','pick','MailQueueId','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','filter','hasOwnProperty','addTeams','ids','Agents','online','voicePause','transaction','each','findOrCreate'];(function(_0x2514a0,_0x45e3aa){var _0xfb63cf=function(_0x2be31e){while(--_0x2be31e){_0x2514a0['push'](_0x2514a0['shift']());}};_0xfb63cf(++_0x45e3aa);}(_0x1bae,0x94));var _0xe1ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1bae[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require('bluebird');var util=require(_0xe1ba('0x0'));var _=require(_0xe1ba('0x1'));var squel=require('squel');var Redis=require(_0xe1ba('0x2'));var qs=require(_0xe1ba('0x3'));var logger=require('../../config/logger')(_0xe1ba('0x4'));var config=require(_0xe1ba('0x5'));var db=require(_0xe1ba('0x6'))['db'];config['redis']=_['defaults'](config[_0xe1ba('0x7')],{'host':_0xe1ba('0x8'),'port':0x18eb});var socket=require(_0xe1ba('0x9'))(new Redis(config[_0xe1ba('0x7')]));require(_0xe1ba('0xa'))[_0xe1ba('0xb')](socket);function respondWithStatusCode(_0x3fcd26,_0x4a2bd9){_0x4a2bd9=_0x4a2bd9||0xcc;return function(_0xdc1b64){if(_0xdc1b64){return _0x3fcd26[_0xe1ba('0xc')](_0x4a2bd9);}return _0x3fcd26[_0xe1ba('0xd')](_0x4a2bd9)[_0xe1ba('0xe')]();};}function respondWithResult(_0x50d2b6,_0x438667){_0x438667=_0x438667||0xc8;return function(_0x52c95d){if(_0x52c95d){return _0x50d2b6[_0xe1ba('0xd')](_0x438667)[_0xe1ba('0xf')](_0x52c95d);}};}function respondWithFilteredResult(_0x7f5668,_0x5b79de){return function(_0x4f9cf8){if(_0x4f9cf8){var _0x47fe3b=typeof _0x5b79de['offset']==='undefined'&&typeof _0x5b79de[_0xe1ba('0x10')]===_0xe1ba('0x11');var _0x5e4c0e=_0x4f9cf8['count'];var _0x590122=_0x47fe3b?0x0:_0x5b79de[_0xe1ba('0x12')];var _0x21cb3e=_0x47fe3b?_0x4f9cf8[_0xe1ba('0x13')]:_0x5b79de[_0xe1ba('0x12')]+_0x5b79de[_0xe1ba('0x10')];var _0x5367ab;if(_0x21cb3e>=_0x5e4c0e){_0x21cb3e=_0x5e4c0e;_0x5367ab=0xc8;}else{_0x5367ab=0xce;}_0x7f5668[_0xe1ba('0xd')](_0x5367ab);return _0x7f5668[_0xe1ba('0x14')](_0xe1ba('0x15'),_0x590122+'-'+_0x21cb3e+'/'+_0x5e4c0e)[_0xe1ba('0xf')](_0x4f9cf8);}return null;};}function saveUpdates(_0x2bd10a){return function(_0x5f0f03){if(_0x5f0f03){return _0x5f0f03[_0xe1ba('0x16')](_0x2bd10a)[_0xe1ba('0x17')](function(_0x232bcc){return _0x232bcc;});}return null;};}function removeEntity(_0x2e443e){return function(_0x1d9d6b){if(_0x1d9d6b){return _0x1d9d6b['destroy']()[_0xe1ba('0x17')](function(){var _0x2e20af=_0x1d9d6b[_0xe1ba('0x18')]({'plain':!![]});var _0x466bd6=_0xe1ba('0x19');return db[_0xe1ba('0x1a')][_0xe1ba('0x1b')]({'where':{'type':_0x466bd6,'resourceId':_0x2e20af['id']}})[_0xe1ba('0x17')](function(){return _0x1d9d6b;});})[_0xe1ba('0x17')](function(){_0x2e443e[_0xe1ba('0xd')](0xcc)[_0xe1ba('0xe')]();});}};}function handleEntityNotFound(_0x19c676){return function(_0x3d264b){if(!_0x3d264b){_0x19c676['sendStatus'](0x194);}return _0x3d264b;};}function handleError(_0x39749d,_0x4c0d44){_0x4c0d44=_0x4c0d44||0x1f4;return function(_0x4f6c68){logger[_0xe1ba('0x1c')](_0x4f6c68[_0xe1ba('0x1d')]);if(_0x4f6c68[_0xe1ba('0x1e')]){delete _0x4f6c68[_0xe1ba('0x1e')];}_0x39749d[_0xe1ba('0xd')](_0x4c0d44)[_0xe1ba('0x1f')](_0x4f6c68);};}exports['index']=function(_0x490977,_0x2e86db){var _0x2b1158={};var _0x1839f0={'count':0x0,'rows':[]};var _0x24ab6e=_[_0xe1ba('0x20')](db[_0xe1ba('0x21')][_0xe1ba('0x22')],function(_0xfd5b59){return{'name':_0xfd5b59['fieldName'],'type':_0xfd5b59[_0xe1ba('0x23')][_0xe1ba('0x24')]};});_0x2b1158=qs[_0xe1ba('0x25')](_0x24ab6e,_0x490977);var _0x528c3d={'where':_0x2b1158[_0xe1ba('0x26')]};return db['MailQueue'][_0xe1ba('0x13')](_0x528c3d)[_0xe1ba('0x17')](function(_0x2992b8){_0x1839f0[_0xe1ba('0x13')]=_0x2992b8;_0x2b1158[_0xe1ba('0x27')]=qs[_0xe1ba('0x27')](_0x490977['query']);return db['MailQueue'][_0xe1ba('0x28')](_0x2b1158);})['then'](function(_0x3b0e12){_0x1839f0[_0xe1ba('0x29')]=_0x3b0e12;return _0x1839f0;})[_0xe1ba('0x17')](respondWithFilteredResult(_0x2e86db,_0x2b1158))[_0xe1ba('0x2a')](handleError(_0x2e86db,null));};exports[_0xe1ba('0x2b')]=function(_0x1a5a4a,_0xd021c2){var _0x1f1ceb={'raw':!![],'where':{'id':_0x1a5a4a[_0xe1ba('0x2c')]['id']}},_0x114d21={};_0x114d21[_0xe1ba('0x2d')]=_[_0xe1ba('0x2e')](db['MailQueue'][_0xe1ba('0x22')]);_0x114d21['query']=_[_0xe1ba('0x2e')](_0x1a5a4a[_0xe1ba('0x2f')]);_0x114d21[_0xe1ba('0x30')]=_[_0xe1ba('0x31')](_0x114d21[_0xe1ba('0x2d')],_0x114d21['query']);_0x1f1ceb['attributes']=_[_0xe1ba('0x31')](_0x114d21[_0xe1ba('0x2d')],qs[_0xe1ba('0x32')](_0x1a5a4a[_0xe1ba('0x2f')]['fields']));_0x1f1ceb[_0xe1ba('0x33')]=_0x1f1ceb['attributes']['length']?_0x1f1ceb[_0xe1ba('0x33')]:_0x114d21[_0xe1ba('0x2d')];if(_0x1a5a4a[_0xe1ba('0x2f')]['includeAll']){_0x1f1ceb[_0xe1ba('0x27')]=[{'all':!![]}];}_0x1f1ceb=_[_0xe1ba('0x34')]({},_0x1f1ceb,_0x1a5a4a[_0xe1ba('0x35')]);return db[_0xe1ba('0x21')]['find'](_0x1f1ceb)[_0xe1ba('0x17')](handleEntityNotFound(_0xd021c2,null))[_0xe1ba('0x17')](respondWithResult(_0xd021c2,null))[_0xe1ba('0x2a')](handleError(_0xd021c2,null));};exports[_0xe1ba('0x36')]=function(_0x313d97,_0x406edd){return db[_0xe1ba('0x21')][_0xe1ba('0x36')](_0x313d97[_0xe1ba('0x37')],{})[_0xe1ba('0x17')](function(_0xcef7d3){var _0x15de09=_0x313d97['user']['get']({'plain':!![]});if(!_0x15de09)throw new Error(_0xe1ba('0x38'));if(_0x15de09[_0xe1ba('0x39')]===_0xe1ba('0x3a')){var _0x4639fc=_0xcef7d3['get']({'plain':!![]});var _0x33cfe3=_0xe1ba('0x19');return db[_0xe1ba('0x3b')][_0xe1ba('0x3c')]({'where':{'name':_0x33cfe3,'userProfileId':_0x15de09[_0xe1ba('0x3d')]},'raw':!![]})[_0xe1ba('0x17')](function(_0x42dc04){if(_0x42dc04&&_0x42dc04['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4639fc[_0xe1ba('0x1e')],'resourceId':_0x4639fc['id'],'type':_0x42dc04[_0xe1ba('0x1e')],'sectionId':_0x42dc04['id']},{})['then'](function(){return _0xcef7d3;});}else{return _0xcef7d3;}})[_0xe1ba('0x2a')](function(_0x254395){logger[_0xe1ba('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x254395);throw _0x254395;});}return _0xcef7d3;})[_0xe1ba('0x17')](respondWithResult(_0x406edd,0xc9))[_0xe1ba('0x2a')](handleError(_0x406edd,null));};exports['update']=function(_0x2de56c,_0x43b014){if(_0x2de56c[_0xe1ba('0x37')]['id']){delete _0x2de56c[_0xe1ba('0x37')]['id'];}return db[_0xe1ba('0x21')][_0xe1ba('0x3c')]({'where':{'id':_0x2de56c['params']['id']}})[_0xe1ba('0x17')](handleEntityNotFound(_0x43b014,null))[_0xe1ba('0x17')](saveUpdates(_0x2de56c[_0xe1ba('0x37')],null))[_0xe1ba('0x17')](respondWithResult(_0x43b014,null))[_0xe1ba('0x2a')](handleError(_0x43b014,null));};exports[_0xe1ba('0x1b')]=function(_0x21e0ef,_0x33aa5e){return db[_0xe1ba('0x21')][_0xe1ba('0x3c')]({'where':{'id':_0x21e0ef[_0xe1ba('0x2c')]['id']}})[_0xe1ba('0x17')](handleEntityNotFound(_0x33aa5e,null))['then'](removeEntity(_0x33aa5e,null))[_0xe1ba('0x2a')](handleError(_0x33aa5e,null));};exports[_0xe1ba('0x3e')]=function(_0xe1b9df,_0x37cb14){return db[_0xe1ba('0x21')]['describe']()[_0xe1ba('0x17')](respondWithResult(_0x37cb14,null))['catch'](handleError(_0x37cb14,null));};exports[_0xe1ba('0x3f')]=function(_0x146278,_0xf87848){var _0x20578a={'raw':!![],'where':{}},_0x3f0b2d={},_0x1a5762;return db[_0xe1ba('0x21')][_0xe1ba('0x40')]({'where':{'id':_0x146278[_0xe1ba('0x2c')]['id']}})['then'](handleEntityNotFound(_0xf87848,null))[_0xe1ba('0x17')](function(_0x1496c7){if(_0x1496c7){_0x1a5762=_0x1496c7[_0xe1ba('0x18')]({'plain':!![]});_0x3f0b2d[_0xe1ba('0x2d')]=_['keys'](db[_0xe1ba('0x41')][_0xe1ba('0x22')]);_0x3f0b2d['query']=_[_0xe1ba('0x2e')](_0x146278[_0xe1ba('0x2f')]);_0x3f0b2d[_0xe1ba('0x30')]=_[_0xe1ba('0x31')](_0x3f0b2d[_0xe1ba('0x2d')],_0x3f0b2d[_0xe1ba('0x2f')]);_0x20578a[_0xe1ba('0x33')]=_[_0xe1ba('0x31')](_0x3f0b2d['model'],qs[_0xe1ba('0x32')](_0x146278[_0xe1ba('0x2f')]['fields']));_0x20578a[_0xe1ba('0x33')]=_0x20578a[_0xe1ba('0x33')][_0xe1ba('0x42')]?_0x20578a[_0xe1ba('0x33')]:_0x3f0b2d[_0xe1ba('0x2d')];if(!_0x146278['query']['hasOwnProperty'](_0xe1ba('0x43'))){_0x20578a['limit']=qs[_0xe1ba('0x10')](_0x146278['query'][_0xe1ba('0x10')]);_0x20578a[_0xe1ba('0x12')]=qs[_0xe1ba('0x12')](_0x146278[_0xe1ba('0x2f')][_0xe1ba('0x12')]);}_0x20578a[_0xe1ba('0x44')]=qs['sort'](_0x146278[_0xe1ba('0x2f')][_0xe1ba('0x45')]);_0x20578a[_0xe1ba('0x26')]=qs[_0xe1ba('0x30')](_[_0xe1ba('0x46')](_0x146278['query'],_0x3f0b2d['filters']));_0x20578a[_0xe1ba('0x26')][_0xe1ba('0x47')]=_0x1496c7['id'];if(_0x146278[_0xe1ba('0x2f')]['filter']){_0x20578a['where']=_['merge'](_0x20578a['where'],{'$or':_[_0xe1ba('0x20')](_0x20578a[_0xe1ba('0x33')],function(_0x96cac3){var _0x3ef2b4={};_0x3ef2b4[_0x96cac3]={'$like':'%'+_0x146278[_0xe1ba('0x2f')]['filter']+'%'};return _0x3ef2b4;})});}_0x20578a=_[_0xe1ba('0x34')]({},_0x20578a,_0x146278[_0xe1ba('0x35')]);return db[_0xe1ba('0x41')][_0xe1ba('0x28')](_0x20578a);}})[_0xe1ba('0x17')](function(_0x6920ce){if(_0x6920ce){return db[_0xe1ba('0x48')][_0xe1ba('0x49')]({'where':{'id':_[_0xe1ba('0x20')](_0x6920ce,_0xe1ba('0x4a')),'role':'agent'},'attributes':['id',_0xe1ba('0x1e'),_0xe1ba('0x4b'),_0xe1ba('0x4c'),_0xe1ba('0x4d')]});}})[_0xe1ba('0x17')](function(_0x184b9b){if(_0x184b9b){return{'count':_0x184b9b[_0xe1ba('0x13')],'rows':_[_0xe1ba('0x20')](_0x184b9b['rows'],function(_0x2a081f){return{'membername':_0x2a081f[_0xe1ba('0x1e')],'UserId':_0x2a081f['id'],'queue_name':_0x1a5762[_0xe1ba('0x1e')],'MailQueueId':_0x1a5762['id'],'interface':util['format'](_0xe1ba('0x4e'),_0xe1ba('0x4f'),_0x2a081f[_0xe1ba('0x1e')]),'penalty':0x0,'paused':_0x2a081f[_0xe1ba('0x4b')],'createdAt':_0x2a081f[_0xe1ba('0x4d')],'updatedAt':_0x2a081f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe1ba('0x17')](respondWithFilteredResult(_0xf87848,_0x20578a))[_0xe1ba('0x2a')](handleError(_0xf87848,null));};exports[_0xe1ba('0x50')]=function(_0x4c9173,_0x52e574){var _0x5ddc05={};var _0x37a4b6={};var _0x3dc67a;var _0x199824;return db['MailQueue']['findOne']({'where':{'id':_0x4c9173[_0xe1ba('0x2c')]['id']}})[_0xe1ba('0x17')](handleEntityNotFound(_0x52e574,null))[_0xe1ba('0x17')](function(_0x516e89){if(_0x516e89){_0x3dc67a=_0x516e89;_0x37a4b6[_0xe1ba('0x2d')]=_['keys'](db[_0xe1ba('0x51')][_0xe1ba('0x22')]);_0x37a4b6[_0xe1ba('0x2f')]=_['keys'](_0x4c9173[_0xe1ba('0x2f')]);_0x37a4b6[_0xe1ba('0x30')]=_[_0xe1ba('0x31')](_0x37a4b6[_0xe1ba('0x2d')],_0x37a4b6[_0xe1ba('0x2f')]);_0x5ddc05['attributes']=_[_0xe1ba('0x31')](_0x37a4b6[_0xe1ba('0x2d')],qs[_0xe1ba('0x32')](_0x4c9173[_0xe1ba('0x2f')][_0xe1ba('0x32')]));_0x5ddc05[_0xe1ba('0x33')]=_0x5ddc05[_0xe1ba('0x33')][_0xe1ba('0x42')]?_0x5ddc05[_0xe1ba('0x33')]:_0x37a4b6[_0xe1ba('0x2d')];_0x5ddc05[_0xe1ba('0x44')]=qs['sort'](_0x4c9173[_0xe1ba('0x2f')]['sort']);_0x5ddc05[_0xe1ba('0x26')]=qs[_0xe1ba('0x30')](_[_0xe1ba('0x46')](_0x4c9173['query'],_0x37a4b6[_0xe1ba('0x30')]));if(_0x4c9173[_0xe1ba('0x2f')][_0xe1ba('0x52')]){_0x5ddc05[_0xe1ba('0x26')]=_[_0xe1ba('0x34')](_0x5ddc05[_0xe1ba('0x26')],{'$or':_[_0xe1ba('0x20')](_0x5ddc05[_0xe1ba('0x33')],function(_0x10f165){var _0xbc81e2={};_0xbc81e2[_0x10f165]={'$like':'%'+_0x4c9173[_0xe1ba('0x2f')][_0xe1ba('0x52')]+'%'};return _0xbc81e2;})});}_0x5ddc05=_['merge']({},_0x5ddc05,_0x4c9173[_0xe1ba('0x35')]);return _0x3dc67a[_0xe1ba('0x50')](_0x5ddc05);}})['then'](function(_0x716cb4){if(_0x716cb4){_0x199824=_0x716cb4[_0xe1ba('0x42')];if(!_0x4c9173[_0xe1ba('0x2f')][_0xe1ba('0x53')](_0xe1ba('0x43'))){_0x5ddc05[_0xe1ba('0x10')]=qs[_0xe1ba('0x10')](_0x4c9173[_0xe1ba('0x2f')][_0xe1ba('0x10')]);_0x5ddc05['offset']=qs[_0xe1ba('0x12')](_0x4c9173[_0xe1ba('0x2f')][_0xe1ba('0x12')]);}return _0x3dc67a['getTeams'](_0x5ddc05);}})[_0xe1ba('0x17')](function(_0x2db952){if(_0x2db952){return _0x2db952?{'count':_0x199824,'rows':_0x2db952}:null;}})[_0xe1ba('0x17')](respondWithResult(_0x52e574,null))[_0xe1ba('0x2a')](handleError(_0x52e574,null));};exports[_0xe1ba('0x54')]=function(_0x33fe13,_0x52c920){var _0x1a52a3=_0x33fe13[_0xe1ba('0x37')][_0xe1ba('0x55')];return db[_0xe1ba('0x51')][_0xe1ba('0x28')]({'where':{'id':_0x1a52a3},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe1ba('0x56'),'attributes':['id',_0xe1ba('0x1e'),_0xe1ba('0x57'),_0xe1ba('0x58'),'interface'],'raw':!![]}]})[_0xe1ba('0x17')](function(_0x2166d0){if(_0x2166d0){var _0x276e6c=_['flatMap'](_0x2166d0,function(_0x408abd){var _0x2ade60=_0x408abd['get']({'plain':!![]});return _0x2ade60[_0xe1ba('0x56')];});return db[_0xe1ba('0x21')][_0xe1ba('0x3c')]({'where':{'id':_0x33fe13[_0xe1ba('0x2c')]['id']}})['then'](function(_0x1e2e2b){return db['sequelize'][_0xe1ba('0x59')](function(_0x58fad0){return _0x1e2e2b[_0xe1ba('0x54')](_0x1a52a3,{'transaction':_0x58fad0})[_0xe1ba('0x17')](function(){return BPromise[_0xe1ba('0x5a')](_0x276e6c,function(_0x216441){return db[_0xe1ba('0x41')][_0xe1ba('0x5b')]({'where':{'UserId':_0x216441['id'],'MailQueueId':_0x33fe13[_0xe1ba('0x2c')]['id']},'transaction':_0x58fad0});});})[_0xe1ba('0x17')](function(){_0x276e6c[_0xe1ba('0x5c')](function(_0x2b68ca){socket[_0xe1ba('0x5d')](_0xe1ba('0x5e'),{'UserId':_0x2b68ca['id'],'MailQueueId':_0x1e2e2b['id']});});});});});}})[_0xe1ba('0x17')](respondWithStatusCode(_0x52c920,null))[_0xe1ba('0x2a')](handleError(_0x52c920,null));};exports[_0xe1ba('0x5f')]=function(_0xb3b7c2,_0x10aa91){return db[_0xe1ba('0x51')][_0xe1ba('0x28')]({'where':{'id':_0xb3b7c2[_0xe1ba('0x2f')][_0xe1ba('0x55')]},'attributes':['id'],'include':[{'model':db[_0xe1ba('0x48')],'as':_0xe1ba('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x10aa91,null))[_0xe1ba('0x17')](function(_0x18b853){var _0x4d9ada=_[_0xe1ba('0x20')](_0x18b853,'id');var _0x13b119=[];var _0x2f3061=[];var _0x1917be=squel[_0xe1ba('0x60')]();_0x1917be[_0xe1ba('0x61')]('tq.TeamId')['from']('team_has_mail_queues','tq')[_0xe1ba('0x62')](_0xe1ba('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe1ba('0x26')](_0xe1ba('0x64'),_0xb3b7c2['params']['id']);for(var _0x2d4026=0x0;_0x2d4026<_0x18b853[_0xe1ba('0x42')];_0x2d4026+=0x1){let _0x48ccd0=_0x18b853[_0x2d4026];for(var _0x452bdb=0x0;_0x452bdb<_0x48ccd0[_0xe1ba('0x56')][_0xe1ba('0x42')];_0x452bdb+=0x1){let _0xfddcac=_0x48ccd0['Agents'][_0x452bdb];var _0x50fbb5=_0x1917be[_0xe1ba('0x65')]();_0x50fbb5[_0xe1ba('0x26')](_0xe1ba('0x66'),_0xfddcac['id']);_0x2f3061[_0xe1ba('0x67')](db[_0xe1ba('0x68')][_0xe1ba('0x2f')](_0x50fbb5[_0xe1ba('0x69')](),{'type':db[_0xe1ba('0x68')][_0xe1ba('0x6a')][_0xe1ba('0x6b')]})['then'](function(_0x2e452d){if(_0x2e452d[_0xe1ba('0x42')]===0x1){return _0xfddcac['id'];}else{var _0x48ccf6=_[_0xe1ba('0x6c')](_[_0xe1ba('0x20')](_0x2e452d,_0xe1ba('0x6d')),function(_0x5c9cd8){return _[_0xe1ba('0x6e')](_0x4d9ada,_0x5c9cd8);});if(_0x48ccf6){return _0xfddcac['id'];}}}));}}return BPromise[_0xe1ba('0x6f')](_0x2f3061)[_0xe1ba('0x17')](function(_0x34d8d9){_0x13b119=_(_0x13b119)['union'](_0x34d8d9)[_0xe1ba('0x70')]()['value']();return db[_0xe1ba('0x21')]['find']({'where':{'id':_0xb3b7c2['params']['id']}})[_0xe1ba('0x17')](function(_0x14a85e){return db[_0xe1ba('0x68')][_0xe1ba('0x59')](function(_0x14f65f){return _0x14a85e[_0xe1ba('0x5f')](_0xb3b7c2[_0xe1ba('0x2f')][_0xe1ba('0x55')],{'transaction':_0x14f65f})[_0xe1ba('0x17')](function(){if(!_['isEmpty'](_0x13b119)){return _0x14a85e['removeAgents'](_0x13b119,{'transaction':_0x14f65f});}})[_0xe1ba('0x17')](function(){_0x13b119['forEach'](function(_0x1699c7){socket[_0xe1ba('0x5d')](_0xe1ba('0x71'),{'UserId':_0x1699c7,'MailQueueId':_0x14a85e['id']});});});});});});})[_0xe1ba('0x17')](respondWithStatusCode(_0x10aa91,null))[_0xe1ba('0x2a')](handleError(_0x10aa91,null));};exports[_0xe1ba('0x72')]=function(_0x5adef1,_0x4be735){return db[_0xe1ba('0x21')]['find']({'where':{'id':_0x5adef1['params']['id']}})[_0xe1ba('0x17')](handleEntityNotFound(_0x4be735,null))['then'](function(_0x5ad078){if(_0x5ad078){return _0x5ad078[_0xe1ba('0x72')](_0x5adef1[_0xe1ba('0x37')][_0xe1ba('0x55')],_[_0xe1ba('0x73')](_0x5adef1['body'],[_0xe1ba('0x55'),'id'])||{})[_0xe1ba('0x74')](function(_0x6cc764){for(var _0x5992a1=0x0;_0x5992a1<_0x5adef1['body'][_0xe1ba('0x55')][_0xe1ba('0x42')];_0x5992a1+=0x1){socket['emit'](_0xe1ba('0x5e'),{'UserId':Number(_0x5adef1[_0xe1ba('0x37')][_0xe1ba('0x55')][_0x5992a1]),'MailQueueId':Number(_0x5adef1[_0xe1ba('0x2c')]['id'])});}return _0x6cc764;});}})[_0xe1ba('0x17')](respondWithResult(_0x4be735,null))[_0xe1ba('0x2a')](handleError(_0x4be735,null));};exports[_0xe1ba('0x75')]=function(_0x1ae595,_0x2d7395){return db[_0xe1ba('0x21')]['find']({'where':{'id':_0x1ae595[_0xe1ba('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2d7395,null))['then'](function(_0x5900a9){if(_0x5900a9){return _0x5900a9[_0xe1ba('0x75')](_0x1ae595[_0xe1ba('0x2f')][_0xe1ba('0x55')])['then'](function(){if(_[_0xe1ba('0x76')](_0x1ae595[_0xe1ba('0x2f')][_0xe1ba('0x55')])){for(var _0x23f5cc=0x0;_0x23f5cc<_0x1ae595['query']['ids']['length'];_0x23f5cc+=0x1){socket[_0xe1ba('0x5d')](_0xe1ba('0x71'),{'UserId':Number(_0x1ae595[_0xe1ba('0x2f')][_0xe1ba('0x55')][_0x23f5cc]),'MailQueueId':Number(_0x1ae595[_0xe1ba('0x2c')]['id'])});}}else{socket[_0xe1ba('0x5d')]('userMailQueue:remove',{'UserId':Number(_0x1ae595[_0xe1ba('0x2f')]['ids']),'MailQueueId':Number(_0x1ae595['params']['id'])});}});}})[_0xe1ba('0x17')](respondWithStatusCode(_0x2d7395,null))[_0xe1ba('0x2a')](handleError(_0x2d7395,null));};exports[_0xe1ba('0x77')]=function(_0x3d8fdd,_0x506cfd){var _0x795896={};var _0x154259={};var _0x48d0a6;var _0x40c10d;return db[_0xe1ba('0x21')][_0xe1ba('0x40')]({'where':{'id':_0x3d8fdd[_0xe1ba('0x2c')]['id']}})[_0xe1ba('0x17')](handleEntityNotFound(_0x506cfd,null))['then'](function(_0x3eab02){if(_0x3eab02){_0x48d0a6=_0x3eab02;_0x154259[_0xe1ba('0x2d')]=_[_0xe1ba('0x2e')](db[_0xe1ba('0x48')][_0xe1ba('0x22')]);_0x154259[_0xe1ba('0x2f')]=_[_0xe1ba('0x2e')](_0x3d8fdd[_0xe1ba('0x2f')]);_0x154259[_0xe1ba('0x30')]=_['intersection'](_0x154259['model'],_0x154259['query']);_0x795896[_0xe1ba('0x33')]=_[_0xe1ba('0x31')](_0x154259['model'],qs[_0xe1ba('0x32')](_0x3d8fdd[_0xe1ba('0x2f')][_0xe1ba('0x32')]));_0x795896[_0xe1ba('0x33')]=_0x795896['attributes'][_0xe1ba('0x42')]?_0x795896[_0xe1ba('0x33')]:_0x154259[_0xe1ba('0x2d')];_0x795896[_0xe1ba('0x44')]=qs['sort'](_0x3d8fdd['query'][_0xe1ba('0x45')]);_0x795896[_0xe1ba('0x26')]=qs['filters'](_[_0xe1ba('0x46')](_0x3d8fdd[_0xe1ba('0x2f')],_0x154259[_0xe1ba('0x30')]));if(_0x3d8fdd[_0xe1ba('0x2f')]['filter']){_0x795896[_0xe1ba('0x26')]=_[_0xe1ba('0x34')](_0x795896[_0xe1ba('0x26')],{'$or':_[_0xe1ba('0x20')](_0x795896[_0xe1ba('0x33')],function(_0x52c96d){var _0x5eefa9={};_0x5eefa9[_0x52c96d]={'$like':'%'+_0x3d8fdd[_0xe1ba('0x2f')][_0xe1ba('0x52')]+'%'};return _0x5eefa9;})});}_0x795896=_[_0xe1ba('0x34')]({},_0x795896,_0x3d8fdd['options']);return _0x48d0a6['getAgents'](_0x795896);}})[_0xe1ba('0x17')](function(_0x1b7209){if(_0x1b7209){_0x40c10d=_0x1b7209[_0xe1ba('0x42')];if(!_0x3d8fdd[_0xe1ba('0x2f')]['hasOwnProperty'](_0xe1ba('0x43'))){_0x795896['limit']=qs[_0xe1ba('0x10')](_0x3d8fdd[_0xe1ba('0x2f')]['limit']);_0x795896[_0xe1ba('0x12')]=qs['offset'](_0x3d8fdd['query'][_0xe1ba('0x12')]);}return _0x48d0a6[_0xe1ba('0x77')](_0x795896);}})[_0xe1ba('0x17')](function(_0x672e6a){if(_0x672e6a){return _0x672e6a?{'count':_0x40c10d,'rows':_0x672e6a}:null;}})[_0xe1ba('0x17')](respondWithResult(_0x506cfd,null))['catch'](handleError(_0x506cfd,null));}; \ No newline at end of file +var _0x4f28=['name','send','index','map','rawAttributes','fieldName','where','MailQueue','include','findAll','rows','catch','show','model','keys','query','filters','intersection','fields','attributes','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','MailQueues','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','params','UserMailQueue','length','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','User','findAndCountAll','agent','createdAt','format','%s/%s','SIP','mailPause','updatedAt','getTeams','Team','filter','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','includes','all','union','compact','emit','addAgents','omit','spread','removeAgents','userMailQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','error'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4f28,0xd7));var _0x84f2=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x4f28[_0x433a86];return _0x23000c;};'use strict';var BPromise=require(_0x84f2('0x0'));var util=require(_0x84f2('0x1'));var _=require(_0x84f2('0x2'));var squel=require(_0x84f2('0x3'));var Redis=require('ioredis');var qs=require(_0x84f2('0x4'));var logger=require(_0x84f2('0x5'))(_0x84f2('0x6'));var config=require(_0x84f2('0x7'));var db=require(_0x84f2('0x8'))['db'];config[_0x84f2('0x9')]=_['defaults'](config['redis'],{'host':_0x84f2('0xa'),'port':0x18eb});var socket=require(_0x84f2('0xb'))(new Redis(config[_0x84f2('0x9')]));require(_0x84f2('0xc'))['register'](socket);function respondWithStatusCode(_0x4e8599,_0x1e5024){_0x1e5024=_0x1e5024||0xcc;return function(_0x178f39){if(_0x178f39){return _0x4e8599[_0x84f2('0xd')](_0x1e5024);}return _0x4e8599[_0x84f2('0xe')](_0x1e5024)[_0x84f2('0xf')]();};}function respondWithResult(_0x4ffc6d,_0x54d640){_0x54d640=_0x54d640||0xc8;return function(_0x3c6eb1){if(_0x3c6eb1){return _0x4ffc6d['status'](_0x54d640)[_0x84f2('0x10')](_0x3c6eb1);}};}function respondWithFilteredResult(_0xe95066,_0x7d1323){return function(_0x5d692f){if(_0x5d692f){var _0x439229=typeof _0x7d1323['offset']===_0x84f2('0x11')&&typeof _0x7d1323[_0x84f2('0x12')]===_0x84f2('0x11');var _0x1c9be6=_0x5d692f[_0x84f2('0x13')];var _0x575dbb=_0x439229?0x0:_0x7d1323[_0x84f2('0x14')];var _0x239928=_0x439229?_0x5d692f[_0x84f2('0x13')]:_0x7d1323[_0x84f2('0x14')]+_0x7d1323[_0x84f2('0x12')];var _0x28b20d;if(_0x239928>=_0x1c9be6){_0x239928=_0x1c9be6;_0x28b20d=0xc8;}else{_0x28b20d=0xce;}_0xe95066[_0x84f2('0xe')](_0x28b20d);return _0xe95066[_0x84f2('0x15')](_0x84f2('0x16'),_0x575dbb+'-'+_0x239928+'/'+_0x1c9be6)['json'](_0x5d692f);}return null;};}function saveUpdates(_0x4718a3){return function(_0xe4eead){if(_0xe4eead){return _0xe4eead[_0x84f2('0x17')](_0x4718a3)[_0x84f2('0x18')](function(_0x5c03b8){return _0x5c03b8;});}return null;};}function removeEntity(_0x506716){return function(_0x3179e2){if(_0x3179e2){return _0x3179e2[_0x84f2('0x19')]()[_0x84f2('0x18')](function(){var _0x43b768=_0x3179e2['get']({'plain':!![]});var _0x576789='MailQueues';return db['UserProfileResource'][_0x84f2('0x19')]({'where':{'type':_0x576789,'resourceId':_0x43b768['id']}})[_0x84f2('0x18')](function(){return _0x3179e2;});})[_0x84f2('0x18')](function(){_0x506716[_0x84f2('0xe')](0xcc)[_0x84f2('0xf')]();});}};}function handleEntityNotFound(_0x5b4b0e){return function(_0x34b6b2){if(!_0x34b6b2){_0x5b4b0e[_0x84f2('0xd')](0x194);}return _0x34b6b2;};}function handleError(_0x91fcf7,_0x4a458c){_0x4a458c=_0x4a458c||0x1f4;return function(_0x9dcef8){logger[_0x84f2('0x1a')](_0x9dcef8['stack']);if(_0x9dcef8['name']){delete _0x9dcef8[_0x84f2('0x1b')];}_0x91fcf7[_0x84f2('0xe')](_0x4a458c)[_0x84f2('0x1c')](_0x9dcef8);};}exports[_0x84f2('0x1d')]=function(_0x1d7f25,_0x50f1ef){var _0x582d9f={};var _0x1589c7={'count':0x0,'rows':[]};var _0x317913=_[_0x84f2('0x1e')](db['MailQueue'][_0x84f2('0x1f')],function(_0x4769d5){return{'name':_0x4769d5[_0x84f2('0x20')],'type':_0x4769d5['type']['key']};});_0x582d9f=qs['getOptions'](_0x317913,_0x1d7f25);var _0x4ff773={'where':_0x582d9f[_0x84f2('0x21')]};return db[_0x84f2('0x22')][_0x84f2('0x13')](_0x4ff773)[_0x84f2('0x18')](function(_0xcd5b52){_0x1589c7['count']=_0xcd5b52;_0x582d9f['include']=qs[_0x84f2('0x23')](_0x1d7f25['query']);return db[_0x84f2('0x22')][_0x84f2('0x24')](_0x582d9f);})[_0x84f2('0x18')](function(_0x5d00aa){_0x1589c7[_0x84f2('0x25')]=_0x5d00aa;return _0x1589c7;})[_0x84f2('0x18')](respondWithFilteredResult(_0x50f1ef,_0x582d9f))[_0x84f2('0x26')](handleError(_0x50f1ef,null));};exports[_0x84f2('0x27')]=function(_0x2c87fb,_0x5d6e04){var _0x480f6b={'raw':!![],'where':{'id':_0x2c87fb['params']['id']}},_0x1d13e3={};_0x1d13e3[_0x84f2('0x28')]=_[_0x84f2('0x29')](db[_0x84f2('0x22')][_0x84f2('0x1f')]);_0x1d13e3['query']=_['keys'](_0x2c87fb[_0x84f2('0x2a')]);_0x1d13e3[_0x84f2('0x2b')]=_[_0x84f2('0x2c')](_0x1d13e3['model'],_0x1d13e3[_0x84f2('0x2a')]);_0x480f6b['attributes']=_[_0x84f2('0x2c')](_0x1d13e3[_0x84f2('0x28')],qs[_0x84f2('0x2d')](_0x2c87fb[_0x84f2('0x2a')][_0x84f2('0x2d')]));_0x480f6b[_0x84f2('0x2e')]=_0x480f6b[_0x84f2('0x2e')]['length']?_0x480f6b[_0x84f2('0x2e')]:_0x1d13e3['model'];if(_0x2c87fb[_0x84f2('0x2a')][_0x84f2('0x2f')]){_0x480f6b[_0x84f2('0x23')]=[{'all':!![]}];}_0x480f6b=_[_0x84f2('0x30')]({},_0x480f6b,_0x2c87fb[_0x84f2('0x31')]);return db[_0x84f2('0x22')][_0x84f2('0x32')](_0x480f6b)[_0x84f2('0x18')](handleEntityNotFound(_0x5d6e04,null))[_0x84f2('0x18')](respondWithResult(_0x5d6e04,null))[_0x84f2('0x26')](handleError(_0x5d6e04,null));};exports[_0x84f2('0x33')]=function(_0x434ac8,_0x49af6b){return db[_0x84f2('0x22')]['create'](_0x434ac8[_0x84f2('0x34')],{})[_0x84f2('0x18')](function(_0xfdd4cc){var _0xa2f94=_0x434ac8[_0x84f2('0x35')]['get']({'plain':!![]});if(!_0xa2f94)throw new Error(_0x84f2('0x36'));if(_0xa2f94[_0x84f2('0x37')]===_0x84f2('0x35')){var _0x4af9db=_0xfdd4cc[_0x84f2('0x38')]({'plain':!![]});var _0x1551ba=_0x84f2('0x39');return db['UserProfileSection'][_0x84f2('0x32')]({'where':{'name':_0x1551ba,'userProfileId':_0xa2f94[_0x84f2('0x3a')]},'raw':!![]})[_0x84f2('0x18')](function(_0x215242){if(_0x215242&&_0x215242['autoAssociation']===0x0){return db['UserProfileResource'][_0x84f2('0x33')]({'name':_0x4af9db['name'],'resourceId':_0x4af9db['id'],'type':_0x215242['name'],'sectionId':_0x215242['id']},{})['then'](function(){return _0xfdd4cc;});}else{return _0xfdd4cc;}})[_0x84f2('0x26')](function(_0x7952fb){logger[_0x84f2('0x1a')](_0x84f2('0x3b'),_0x7952fb);throw _0x7952fb;});}return _0xfdd4cc;})[_0x84f2('0x18')](respondWithResult(_0x49af6b,0xc9))[_0x84f2('0x26')](handleError(_0x49af6b,null));};exports[_0x84f2('0x17')]=function(_0x593c16,_0x3a59c6){if(_0x593c16[_0x84f2('0x34')]['id']){delete _0x593c16[_0x84f2('0x34')]['id'];}return db[_0x84f2('0x22')][_0x84f2('0x32')]({'where':{'id':_0x593c16['params']['id']}})[_0x84f2('0x18')](handleEntityNotFound(_0x3a59c6,null))['then'](saveUpdates(_0x593c16[_0x84f2('0x34')],null))[_0x84f2('0x18')](respondWithResult(_0x3a59c6,null))[_0x84f2('0x26')](handleError(_0x3a59c6,null));};exports[_0x84f2('0x19')]=function(_0x5f17a5,_0x335f24){return db['MailQueue'][_0x84f2('0x32')]({'where':{'id':_0x5f17a5['params']['id']}})[_0x84f2('0x18')](handleEntityNotFound(_0x335f24,null))[_0x84f2('0x18')](removeEntity(_0x335f24,null))[_0x84f2('0x26')](handleError(_0x335f24,null));};exports['describe']=function(_0x2fe77d,_0x4e4897){return db['MailQueue'][_0x84f2('0x3c')]()[_0x84f2('0x18')](respondWithResult(_0x4e4897,null))[_0x84f2('0x26')](handleError(_0x4e4897,null));};exports[_0x84f2('0x3d')]=function(_0x4a7cbb,_0x13c459){var _0x60dbab={'raw':!![],'where':{}},_0x40232a={},_0x53f2a7;return db[_0x84f2('0x22')][_0x84f2('0x3e')]({'where':{'id':_0x4a7cbb[_0x84f2('0x3f')]['id']}})[_0x84f2('0x18')](handleEntityNotFound(_0x13c459,null))[_0x84f2('0x18')](function(_0x58b474){if(_0x58b474){_0x53f2a7=_0x58b474[_0x84f2('0x38')]({'plain':!![]});_0x40232a[_0x84f2('0x28')]=_[_0x84f2('0x29')](db[_0x84f2('0x40')][_0x84f2('0x1f')]);_0x40232a[_0x84f2('0x2a')]=_['keys'](_0x4a7cbb[_0x84f2('0x2a')]);_0x40232a['filters']=_[_0x84f2('0x2c')](_0x40232a[_0x84f2('0x28')],_0x40232a[_0x84f2('0x2a')]);_0x60dbab['attributes']=_['intersection'](_0x40232a['model'],qs['fields'](_0x4a7cbb[_0x84f2('0x2a')]['fields']));_0x60dbab[_0x84f2('0x2e')]=_0x60dbab[_0x84f2('0x2e')][_0x84f2('0x41')]?_0x60dbab['attributes']:_0x40232a['model'];if(!_0x4a7cbb[_0x84f2('0x2a')][_0x84f2('0x42')](_0x84f2('0x43'))){_0x60dbab[_0x84f2('0x12')]=qs[_0x84f2('0x12')](_0x4a7cbb[_0x84f2('0x2a')]['limit']);_0x60dbab[_0x84f2('0x14')]=qs[_0x84f2('0x14')](_0x4a7cbb[_0x84f2('0x2a')][_0x84f2('0x14')]);}_0x60dbab[_0x84f2('0x44')]=qs['sort'](_0x4a7cbb[_0x84f2('0x2a')][_0x84f2('0x45')]);_0x60dbab[_0x84f2('0x21')]=qs[_0x84f2('0x2b')](_[_0x84f2('0x46')](_0x4a7cbb[_0x84f2('0x2a')],_0x40232a[_0x84f2('0x2b')]));_0x60dbab[_0x84f2('0x21')][_0x84f2('0x47')]=_0x58b474['id'];if(_0x4a7cbb[_0x84f2('0x2a')]['filter']){_0x60dbab[_0x84f2('0x21')]=_[_0x84f2('0x30')](_0x60dbab[_0x84f2('0x21')],{'$or':_[_0x84f2('0x1e')](_0x60dbab[_0x84f2('0x2e')],function(_0x4b8b3c){var _0x33118b={};_0x33118b[_0x4b8b3c]={'$like':'%'+_0x4a7cbb[_0x84f2('0x2a')]['filter']+'%'};return _0x33118b;})});}_0x60dbab=_[_0x84f2('0x30')]({},_0x60dbab,_0x4a7cbb['options']);return db[_0x84f2('0x40')][_0x84f2('0x24')](_0x60dbab);}})[_0x84f2('0x18')](function(_0x1fa4f7){if(_0x1fa4f7){return db[_0x84f2('0x48')][_0x84f2('0x49')]({'where':{'id':_[_0x84f2('0x1e')](_0x1fa4f7,'UserId'),'role':_0x84f2('0x4a')},'attributes':['id',_0x84f2('0x1b'),'mailPause','updatedAt',_0x84f2('0x4b')]});}})[_0x84f2('0x18')](function(_0x19cb49){if(_0x19cb49){return{'count':_0x19cb49[_0x84f2('0x13')],'rows':_['map'](_0x19cb49[_0x84f2('0x25')],function(_0x1ad507){return{'membername':_0x1ad507[_0x84f2('0x1b')],'UserId':_0x1ad507['id'],'queue_name':_0x53f2a7[_0x84f2('0x1b')],'MailQueueId':_0x53f2a7['id'],'interface':util[_0x84f2('0x4c')](_0x84f2('0x4d'),_0x84f2('0x4e'),_0x1ad507['name']),'penalty':0x0,'paused':_0x1ad507[_0x84f2('0x4f')],'createdAt':_0x1ad507[_0x84f2('0x4b')],'updatedAt':_0x1ad507[_0x84f2('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x84f2('0x18')](respondWithFilteredResult(_0x13c459,_0x60dbab))[_0x84f2('0x26')](handleError(_0x13c459,null));};exports[_0x84f2('0x51')]=function(_0x4b6f82,_0x31bb35){var _0x5a5d68={};var _0x22fff3={};var _0x4c374d;var _0x3bd026;return db[_0x84f2('0x22')][_0x84f2('0x3e')]({'where':{'id':_0x4b6f82[_0x84f2('0x3f')]['id']}})[_0x84f2('0x18')](handleEntityNotFound(_0x31bb35,null))[_0x84f2('0x18')](function(_0x3fdc66){if(_0x3fdc66){_0x4c374d=_0x3fdc66;_0x22fff3['model']=_[_0x84f2('0x29')](db[_0x84f2('0x52')][_0x84f2('0x1f')]);_0x22fff3[_0x84f2('0x2a')]=_[_0x84f2('0x29')](_0x4b6f82[_0x84f2('0x2a')]);_0x22fff3[_0x84f2('0x2b')]=_[_0x84f2('0x2c')](_0x22fff3[_0x84f2('0x28')],_0x22fff3[_0x84f2('0x2a')]);_0x5a5d68[_0x84f2('0x2e')]=_['intersection'](_0x22fff3[_0x84f2('0x28')],qs[_0x84f2('0x2d')](_0x4b6f82[_0x84f2('0x2a')][_0x84f2('0x2d')]));_0x5a5d68['attributes']=_0x5a5d68[_0x84f2('0x2e')][_0x84f2('0x41')]?_0x5a5d68[_0x84f2('0x2e')]:_0x22fff3[_0x84f2('0x28')];_0x5a5d68['order']=qs[_0x84f2('0x45')](_0x4b6f82[_0x84f2('0x2a')][_0x84f2('0x45')]);_0x5a5d68['where']=qs[_0x84f2('0x2b')](_['pick'](_0x4b6f82[_0x84f2('0x2a')],_0x22fff3[_0x84f2('0x2b')]));if(_0x4b6f82[_0x84f2('0x2a')][_0x84f2('0x53')]){_0x5a5d68[_0x84f2('0x21')]=_[_0x84f2('0x30')](_0x5a5d68[_0x84f2('0x21')],{'$or':_[_0x84f2('0x1e')](_0x5a5d68['attributes'],function(_0x104396){var _0x3ae33e={};_0x3ae33e[_0x104396]={'$like':'%'+_0x4b6f82['query'][_0x84f2('0x53')]+'%'};return _0x3ae33e;})});}_0x5a5d68=_[_0x84f2('0x30')]({},_0x5a5d68,_0x4b6f82['options']);return _0x4c374d[_0x84f2('0x51')](_0x5a5d68);}})['then'](function(_0x2d0fe1){if(_0x2d0fe1){_0x3bd026=_0x2d0fe1[_0x84f2('0x41')];if(!_0x4b6f82[_0x84f2('0x2a')][_0x84f2('0x42')](_0x84f2('0x43'))){_0x5a5d68['limit']=qs['limit'](_0x4b6f82[_0x84f2('0x2a')][_0x84f2('0x12')]);_0x5a5d68['offset']=qs[_0x84f2('0x14')](_0x4b6f82[_0x84f2('0x2a')]['offset']);}return _0x4c374d[_0x84f2('0x51')](_0x5a5d68);}})['then'](function(_0x292f63){if(_0x292f63){return _0x292f63?{'count':_0x3bd026,'rows':_0x292f63}:null;}})['then'](respondWithResult(_0x31bb35,null))[_0x84f2('0x26')](handleError(_0x31bb35,null));};exports[_0x84f2('0x54')]=function(_0xefca1c,_0x2cc2dc){var _0x466c0d=_0xefca1c['body'][_0x84f2('0x55')];return db[_0x84f2('0x52')][_0x84f2('0x24')]({'where':{'id':_0x466c0d},'attributes':['id'],'include':[{'model':db['User'],'as':_0x84f2('0x56'),'attributes':['id','name',_0x84f2('0x57'),_0x84f2('0x58'),_0x84f2('0x59')],'raw':!![]}]})[_0x84f2('0x18')](function(_0x49674a){if(_0x49674a){var _0x4b3691=_[_0x84f2('0x5a')](_0x49674a,function(_0x428ccc){var _0x2a46aa=_0x428ccc[_0x84f2('0x38')]({'plain':!![]});return _0x2a46aa[_0x84f2('0x56')];});return db['MailQueue']['find']({'where':{'id':_0xefca1c[_0x84f2('0x3f')]['id']}})[_0x84f2('0x18')](function(_0x593d6e){return db[_0x84f2('0x5b')][_0x84f2('0x5c')](function(_0x4e8273){return _0x593d6e[_0x84f2('0x54')](_0x466c0d,{'transaction':_0x4e8273})[_0x84f2('0x18')](function(){return BPromise[_0x84f2('0x5d')](_0x4b3691,function(_0xe165d){return db['UserMailQueue'][_0x84f2('0x5e')]({'where':{'UserId':_0xe165d['id'],'MailQueueId':_0xefca1c[_0x84f2('0x3f')]['id']},'transaction':_0x4e8273});});})[_0x84f2('0x18')](function(){_0x4b3691['forEach'](function(_0x5320d3){socket['emit'](_0x84f2('0x5f'),{'UserId':_0x5320d3['id'],'MailQueueId':_0x593d6e['id']});});});});});}})['then'](respondWithStatusCode(_0x2cc2dc,null))[_0x84f2('0x26')](handleError(_0x2cc2dc,null));};exports[_0x84f2('0x60')]=function(_0x167841,_0x2f48e3){return db[_0x84f2('0x52')][_0x84f2('0x24')]({'where':{'id':_0x167841['query'][_0x84f2('0x55')]},'attributes':['id'],'include':[{'model':db[_0x84f2('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x84f2('0x18')](handleEntityNotFound(_0x2f48e3,null))[_0x84f2('0x18')](function(_0x3b9071){var _0x5e27f7=_[_0x84f2('0x1e')](_0x3b9071,'id');var _0x44964c=[];var _0x21ab09=[];var _0x9852fa=squel[_0x84f2('0x61')]();_0x9852fa[_0x84f2('0x62')](_0x84f2('0x63'))[_0x84f2('0x64')]('team_has_mail_queues','tq')[_0x84f2('0x65')](_0x84f2('0x66'),'ut',_0x84f2('0x67'))[_0x84f2('0x21')](_0x84f2('0x68'),_0x167841['params']['id']);for(var _0x1b5479=0x0;_0x1b5479<_0x3b9071[_0x84f2('0x41')];_0x1b5479+=0x1){let _0x1389c5=_0x3b9071[_0x1b5479];for(var _0x3120ca=0x0;_0x3120ca<_0x1389c5[_0x84f2('0x56')]['length'];_0x3120ca+=0x1){let _0x1f13c5=_0x1389c5['Agents'][_0x3120ca];var _0x50f718=_0x9852fa[_0x84f2('0x69')]();_0x50f718[_0x84f2('0x21')](_0x84f2('0x6a'),_0x1f13c5['id']);_0x21ab09[_0x84f2('0x6b')](db['sequelize'][_0x84f2('0x2a')](_0x50f718[_0x84f2('0x6c')](),{'type':db[_0x84f2('0x5b')]['QueryTypes']['SELECT']})[_0x84f2('0x18')](function(_0x25251b){if(_0x25251b[_0x84f2('0x41')]===0x1){return _0x1f13c5['id'];}else{var _0x5f1c4b=_[_0x84f2('0x6d')](_[_0x84f2('0x1e')](_0x25251b,'TeamId'),function(_0x37a1e1){return _[_0x84f2('0x6e')](_0x5e27f7,_0x37a1e1);});if(_0x5f1c4b){return _0x1f13c5['id'];}}}));}}return BPromise[_0x84f2('0x6f')](_0x21ab09)['then'](function(_0x4dfe62){_0x44964c=_(_0x44964c)[_0x84f2('0x70')](_0x4dfe62)[_0x84f2('0x71')]()['value']();return db['MailQueue']['find']({'where':{'id':_0x167841[_0x84f2('0x3f')]['id']}})[_0x84f2('0x18')](function(_0x45e038){return db[_0x84f2('0x5b')][_0x84f2('0x5c')](function(_0x1bc674){return _0x45e038[_0x84f2('0x60')](_0x167841[_0x84f2('0x2a')][_0x84f2('0x55')],{'transaction':_0x1bc674})[_0x84f2('0x18')](function(){if(!_['isEmpty'](_0x44964c)){return _0x45e038['removeAgents'](_0x44964c,{'transaction':_0x1bc674});}})['then'](function(){_0x44964c['forEach'](function(_0x14f4ee){socket[_0x84f2('0x72')]('userMailQueue:remove',{'UserId':_0x14f4ee,'MailQueueId':_0x45e038['id']});});});});});});})[_0x84f2('0x18')](respondWithStatusCode(_0x2f48e3,null))[_0x84f2('0x26')](handleError(_0x2f48e3,null));};exports[_0x84f2('0x73')]=function(_0x5a69a4,_0x18e286){return db[_0x84f2('0x22')][_0x84f2('0x32')]({'where':{'id':_0x5a69a4[_0x84f2('0x3f')]['id']}})[_0x84f2('0x18')](handleEntityNotFound(_0x18e286,null))[_0x84f2('0x18')](function(_0x1507c6){if(_0x1507c6){return _0x1507c6[_0x84f2('0x73')](_0x5a69a4[_0x84f2('0x34')][_0x84f2('0x55')],_[_0x84f2('0x74')](_0x5a69a4[_0x84f2('0x34')],[_0x84f2('0x55'),'id'])||{})[_0x84f2('0x75')](function(_0x737b4a){for(var _0x35b5d1=0x0;_0x35b5d1<_0x5a69a4[_0x84f2('0x34')]['ids']['length'];_0x35b5d1+=0x1){socket[_0x84f2('0x72')](_0x84f2('0x5f'),{'UserId':Number(_0x5a69a4['body']['ids'][_0x35b5d1]),'MailQueueId':Number(_0x5a69a4[_0x84f2('0x3f')]['id'])});}return _0x737b4a;});}})[_0x84f2('0x18')](respondWithResult(_0x18e286,null))[_0x84f2('0x26')](handleError(_0x18e286,null));};exports['removeAgents']=function(_0x34cd75,_0x3273b8){return db[_0x84f2('0x22')]['find']({'where':{'id':_0x34cd75[_0x84f2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3273b8,null))['then'](function(_0x5b151c){if(_0x5b151c){return _0x5b151c[_0x84f2('0x76')](_0x34cd75[_0x84f2('0x2a')][_0x84f2('0x55')])[_0x84f2('0x18')](function(){if(_['isArray'](_0x34cd75[_0x84f2('0x2a')][_0x84f2('0x55')])){for(var _0x42bbf7=0x0;_0x42bbf7<_0x34cd75[_0x84f2('0x2a')][_0x84f2('0x55')][_0x84f2('0x41')];_0x42bbf7+=0x1){socket[_0x84f2('0x72')](_0x84f2('0x77'),{'UserId':Number(_0x34cd75['query'][_0x84f2('0x55')][_0x42bbf7]),'MailQueueId':Number(_0x34cd75['params']['id'])});}}else{socket[_0x84f2('0x72')](_0x84f2('0x77'),{'UserId':Number(_0x34cd75[_0x84f2('0x2a')][_0x84f2('0x55')]),'MailQueueId':Number(_0x34cd75[_0x84f2('0x3f')]['id'])});}});}})[_0x84f2('0x18')](respondWithStatusCode(_0x3273b8,null))['catch'](handleError(_0x3273b8,null));};exports[_0x84f2('0x78')]=function(_0x3e4768,_0x10dc70){var _0x1868c9={};var _0x42c5e5={};var _0x373616;var _0x46a427;return db[_0x84f2('0x22')][_0x84f2('0x3e')]({'where':{'id':_0x3e4768[_0x84f2('0x3f')]['id']}})[_0x84f2('0x18')](handleEntityNotFound(_0x10dc70,null))[_0x84f2('0x18')](function(_0x105d8a){if(_0x105d8a){_0x373616=_0x105d8a;_0x42c5e5['model']=_[_0x84f2('0x29')](db[_0x84f2('0x48')][_0x84f2('0x1f')]);_0x42c5e5[_0x84f2('0x2a')]=_[_0x84f2('0x29')](_0x3e4768[_0x84f2('0x2a')]);_0x42c5e5[_0x84f2('0x2b')]=_['intersection'](_0x42c5e5[_0x84f2('0x28')],_0x42c5e5[_0x84f2('0x2a')]);_0x1868c9['attributes']=_[_0x84f2('0x2c')](_0x42c5e5[_0x84f2('0x28')],qs[_0x84f2('0x2d')](_0x3e4768['query']['fields']));_0x1868c9[_0x84f2('0x2e')]=_0x1868c9[_0x84f2('0x2e')]['length']?_0x1868c9[_0x84f2('0x2e')]:_0x42c5e5[_0x84f2('0x28')];_0x1868c9['order']=qs[_0x84f2('0x45')](_0x3e4768['query'][_0x84f2('0x45')]);_0x1868c9['where']=qs[_0x84f2('0x2b')](_['pick'](_0x3e4768[_0x84f2('0x2a')],_0x42c5e5[_0x84f2('0x2b')]));if(_0x3e4768['query'][_0x84f2('0x53')]){_0x1868c9[_0x84f2('0x21')]=_['merge'](_0x1868c9[_0x84f2('0x21')],{'$or':_[_0x84f2('0x1e')](_0x1868c9[_0x84f2('0x2e')],function(_0x5af138){var _0x4792f1={};_0x4792f1[_0x5af138]={'$like':'%'+_0x3e4768[_0x84f2('0x2a')][_0x84f2('0x53')]+'%'};return _0x4792f1;})});}_0x1868c9=_[_0x84f2('0x30')]({},_0x1868c9,_0x3e4768['options']);return _0x373616[_0x84f2('0x78')](_0x1868c9);}})[_0x84f2('0x18')](function(_0xd637e2){if(_0xd637e2){_0x46a427=_0xd637e2['length'];if(!_0x3e4768[_0x84f2('0x2a')][_0x84f2('0x42')](_0x84f2('0x43'))){_0x1868c9[_0x84f2('0x12')]=qs['limit'](_0x3e4768['query'][_0x84f2('0x12')]);_0x1868c9[_0x84f2('0x14')]=qs[_0x84f2('0x14')](_0x3e4768[_0x84f2('0x2a')][_0x84f2('0x14')]);}return _0x373616[_0x84f2('0x78')](_0x1868c9);}})[_0x84f2('0x18')](function(_0x3dfe63){if(_0x3dfe63){return _0x3dfe63?{'count':_0x46a427,'rows':_0x3dfe63}:null;}})[_0x84f2('0x18')](respondWithResult(_0x10dc70,null))[_0x84f2('0x26')](handleError(_0x10dc70,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 5825fcb..5101adb 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 _0x66e5=['../../mysqldb','MailQueue','save','remove','emit','hasOwnProperty','exports'];(function(_0x4ac428,_0x35c6a2){var _0x513988=function(_0x5ae4f6){while(--_0x5ae4f6){_0x4ac428['push'](_0x4ac428['shift']());}};_0x513988(++_0x35c6a2);}(_0x66e5,0x181));var _0x566e=function(_0x44a101,_0x3729bc){_0x44a101=_0x44a101-0x0;var _0x351900=_0x66e5[_0x44a101];return _0x351900;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x566e('0x0'))['db'][_0x566e('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x566e('0x2'),'afterUpdate':'update','afterDestroy':_0x566e('0x3')};function emitEvent(_0x3fb549){return function(_0x14c41d,_0x564071,_0x5ac47d){MailQueueEvents[_0x566e('0x4')](_0x3fb549+':'+_0x14c41d['id'],_0x14c41d);MailQueueEvents[_0x566e('0x4')](_0x3fb549,_0x14c41d);_0x5ac47d(null);};}for(var e in events){if(events[_0x566e('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x566e('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x0f0a=['events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x38065f,_0x241cf4){var _0x2d546f=function(_0xb61491){while(--_0xb61491){_0x38065f['push'](_0x38065f['shift']());}};_0x2d546f(++_0x241cf4);}(_0x0f0a,0x96));var _0xa0f0=function(_0x459bc1,_0x57866f){_0x459bc1=_0x459bc1-0x0;var _0x4d16ce=_0x0f0a[_0x459bc1];return _0x4d16ce;};'use strict';var EventEmitter=require(_0xa0f0('0x0'));var MailQueue=require(_0xa0f0('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa0f0('0x2')](0x0);var events={'afterCreate':_0xa0f0('0x3'),'afterUpdate':_0xa0f0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b20c3){return function(_0x105f46,_0x40e3c7,_0x416bb0){MailQueueEvents[_0xa0f0('0x5')](_0x2b20c3+':'+_0x105f46['id'],_0x105f46);MailQueueEvents[_0xa0f0('0x5')](_0x2b20c3,_0x105f46);_0x416bb0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 9a78480..b43c184 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 _0xe5f9=['bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','util','api','moment'];(function(_0xca1091,_0x539dbf){var _0xd3019c=function(_0xd629e0){while(--_0xd629e0){_0xca1091['push'](_0xca1091['shift']());}};_0xd3019c(++_0x539dbf);}(_0xe5f9,0x126));var _0x9e5f=function(_0x1e2775,_0x3901d2){_0x1e2775=_0x1e2775-0x0;var _0x19ed56=_0xe5f9[_0x1e2775];return _0x19ed56;};'use strict';var _=require('lodash');var util=require(_0x9e5f('0x0'));var logger=require('../../config/logger')(_0x9e5f('0x1'));var moment=require(_0x9e5f('0x2'));var BPromise=require(_0x9e5f('0x3'));var rp=require(_0x9e5f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e5f('0x5'));var config=require(_0x9e5f('0x6'));var attributes=require(_0x9e5f('0x7'));module['exports']=function(_0x3bafbc,_0x5a0423){return _0x3bafbc[_0x9e5f('0x8')](_0x9e5f('0x9'),attributes,{'tableName':_0x9e5f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6279=['../../config/environment','mail_queues','lodash','util','api','bluebird','path','rimraf'];(function(_0x4e0a8f,_0x418168){var _0xeaff5b=function(_0xfa0aba){while(--_0xfa0aba){_0x4e0a8f['push'](_0x4e0a8f['shift']());}};_0xeaff5b(++_0x418168);}(_0x6279,0x1ca));var _0x9627=function(_0x316371,_0x3c225f){_0x316371=_0x316371-0x0;var _0x576f72=_0x6279[_0x316371];return _0x576f72;};'use strict';var _=require(_0x9627('0x0'));var util=require(_0x9627('0x1'));var logger=require('../../config/logger')(_0x9627('0x2'));var moment=require('moment');var BPromise=require(_0x9627('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9627('0x4'));var rimraf=require(_0x9627('0x5'));var config=require(_0x9627('0x6'));var attributes=require('./mailQueue.attributes');module['exports']=function(_0x42f8d4,_0x240b1d){return _0x42f8d4['define']('MailQueue',attributes,{'tableName':_0x9627('0x7'),'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 d353f97..454a00d 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 _0xc5ab=['debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMailQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','MailQueue','ShowMailQueue','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','MailQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x310da1,_0x390f65){var _0x333d17=function(_0x27d0f8){while(--_0x27d0f8){_0x310da1['push'](_0x310da1['shift']());}};_0x333d17(++_0x390f65);}(_0xc5ab,0x19b));var _0xbc5a=function(_0x308229,_0x4eb303){_0x308229=_0x308229-0x0;var _0x1af419=_0xc5ab[_0x308229];return _0x1af419;};'use strict';var _=require('lodash');var util=require(_0xbc5a('0x0'));var moment=require(_0xbc5a('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc5a('0x2'));var fs=require('fs');var Redis=require(_0xbc5a('0x3'));var db=require(_0xbc5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc5a('0x5'))(_0xbc5a('0x6'));var config=require(_0xbc5a('0x7'));var jayson=require(_0xbc5a('0x8'));var client=jayson['client'][_0xbc5a('0x9')]({'port':0x232a});config[_0xbc5a('0xa')]=_[_0xbc5a('0xb')](config['redis'],{'host':_0xbc5a('0xc'),'port':0x18eb});var socket=require(_0xbc5a('0xd'))(new Redis(config[_0xbc5a('0xa')]));require(_0xbc5a('0xe'))[_0xbc5a('0xf')](socket);function respondWithRpcPromise(_0x11f065,_0x51b1e8,_0x543869){return new BPromise(function(_0x11b5de,_0x21694e){return client['request'](_0x11f065,_0x543869)['then'](function(_0x133339){logger['info'](_0xbc5a('0x10'),_0x51b1e8,_0xbc5a('0x11'));logger[_0xbc5a('0x12')](_0xbc5a('0x13'),_0x51b1e8,_0xbc5a('0x11'),JSON[_0xbc5a('0x14')](_0x133339));if(_0x133339[_0xbc5a('0x15')]){if(_0x133339[_0xbc5a('0x15')][_0xbc5a('0x16')]===0x1f4){logger[_0xbc5a('0x15')]('MailQueue,\x20%s,\x20%s',_0x51b1e8,_0x133339[_0xbc5a('0x15')][_0xbc5a('0x17')]);return _0x21694e(_0x133339['error']['message']);}logger[_0xbc5a('0x15')](_0xbc5a('0x10'),_0x51b1e8,_0x133339[_0xbc5a('0x15')][_0xbc5a('0x17')]);return _0x11b5de(_0x133339[_0xbc5a('0x15')][_0xbc5a('0x17')]);}else{logger[_0xbc5a('0x18')](_0xbc5a('0x10'),_0x51b1e8,_0xbc5a('0x11'));_0x11b5de(_0x133339['result']['message']);}})[_0xbc5a('0x19')](function(_0x2b37bd){logger['error'](_0xbc5a('0x10'),_0x51b1e8,_0x2b37bd);_0x21694e(_0x2b37bd);});});}exports[_0xbc5a('0x1a')]=function(_0x4f791c){var _0x151b31=this;return new Promise(function(_0x99fc44,_0x5db1bd){return db['MailQueue'][_0xbc5a('0x1b')]({'raw':_0x4f791c['options']?_0x4f791c[_0xbc5a('0x1c')][_0xbc5a('0x1d')]===undefined?!![]:![]:!![],'where':_0x4f791c[_0xbc5a('0x1c')]?_0x4f791c['options'][_0xbc5a('0x1e')]||null:null,'attributes':_0x4f791c[_0xbc5a('0x1c')]?_0x4f791c['options'][_0xbc5a('0x1f')]||null:null,'limit':_0x4f791c[_0xbc5a('0x1c')]?_0x4f791c[_0xbc5a('0x1c')][_0xbc5a('0x20')]||null:null,'include':_0x4f791c[_0xbc5a('0x1c')]?_0x4f791c[_0xbc5a('0x1c')][_0xbc5a('0x21')]?_['map'](_0x4f791c[_0xbc5a('0x1c')][_0xbc5a('0x21')],function(_0x2a5672){return{'model':db[_0x2a5672[_0xbc5a('0x22')]],'as':_0x2a5672['as'],'attributes':_0x2a5672[_0xbc5a('0x1f')],'include':_0x2a5672[_0xbc5a('0x21')]?_['map'](_0x2a5672['include'],function(_0x1bc88f){return{'model':db[_0x1bc88f[_0xbc5a('0x22')]],'as':_0x1bc88f['as'],'attributes':_0x1bc88f[_0xbc5a('0x1f')],'include':_0x1bc88f[_0xbc5a('0x21')]?_[_0xbc5a('0x23')](_0x1bc88f[_0xbc5a('0x21')],function(_0x5467fa){return{'model':db[_0x5467fa[_0xbc5a('0x22')]],'as':_0x5467fa['as'],'attributes':_0x5467fa[_0xbc5a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbc5a('0x24')](function(_0x47347d){logger['info'](_0xbc5a('0x1a'),_0x4f791c);logger[_0xbc5a('0x12')](_0xbc5a('0x1a'),_0x4f791c,JSON[_0xbc5a('0x14')](_0x47347d));_0x99fc44(_0x47347d);})[_0xbc5a('0x19')](function(_0x4757ca){logger[_0xbc5a('0x15')](_0xbc5a('0x1a'),_0x4757ca[_0xbc5a('0x17')],_0x4f791c);_0x5db1bd(_0x151b31[_0xbc5a('0x15')](0x1f4,_0x4757ca[_0xbc5a('0x17')]));});});};exports['ShowMailQueue']=function(_0x2deffa){var _0x1c2be2=this;return new Promise(function(_0x4114cf,_0x37387c){return db[_0xbc5a('0x25')]['find']({'raw':_0x2deffa['options']?_0x2deffa['options'][_0xbc5a('0x1d')]===undefined?!![]:![]:!![],'where':_0x2deffa[_0xbc5a('0x1c')]?_0x2deffa[_0xbc5a('0x1c')]['where']||null:null,'attributes':_0x2deffa[_0xbc5a('0x1c')]?_0x2deffa['options'][_0xbc5a('0x1f')]||null:null,'include':_0x2deffa[_0xbc5a('0x1c')]?_0x2deffa[_0xbc5a('0x1c')][_0xbc5a('0x21')]?_[_0xbc5a('0x23')](_0x2deffa['options'][_0xbc5a('0x21')],function(_0x53657c){return{'model':db[_0x53657c[_0xbc5a('0x22')]],'as':_0x53657c['as'],'attributes':_0x53657c['attributes'],'include':_0x53657c[_0xbc5a('0x21')]?_[_0xbc5a('0x23')](_0x53657c['include'],function(_0x3fe039){return{'model':db[_0x3fe039['model']],'as':_0x3fe039['as'],'attributes':_0x3fe039['attributes'],'include':_0x3fe039[_0xbc5a('0x21')]?_[_0xbc5a('0x23')](_0x3fe039[_0xbc5a('0x21')],function(_0x3474e9){return{'model':db[_0x3474e9[_0xbc5a('0x22')]],'as':_0x3474e9['as'],'attributes':_0x3474e9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x25df9f){logger[_0xbc5a('0x18')](_0xbc5a('0x26'),_0x2deffa);logger[_0xbc5a('0x12')](_0xbc5a('0x26'),_0x2deffa,JSON[_0xbc5a('0x14')](_0x25df9f));_0x4114cf(_0x25df9f);})['catch'](function(_0x17e5c1){logger[_0xbc5a('0x15')]('ShowMailQueue',_0x17e5c1[_0xbc5a('0x17')],_0x2deffa);_0x37387c(_0x1c2be2[_0xbc5a('0x15')](0x1f4,_0x17e5c1[_0xbc5a('0x17')]));});});}; \ No newline at end of file +var _0x652b=['../../config/utils','../../config/logger','rpc','client','defaults','localhost','socket.io-emitter','redis','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','message','GetMailQueue','MailQueue','findAll','options','include','map','model','attributes','stringify','catch','ShowMailQueue','find','where','debug','lodash','util','moment','randomstring'];(function(_0x311666,_0x17b07d){var _0x2bc692=function(_0x200073){while(--_0x200073){_0x311666['push'](_0x311666['shift']());}};_0x2bc692(++_0x17b07d);}(_0x652b,0x68));var _0xb652=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0x652b[_0x57975f];return _0x4793b8;};'use strict';var _=require(_0xb652('0x0'));var util=require(_0xb652('0x1'));var moment=require(_0xb652('0x2'));var BPromise=require('bluebird');var rs=require(_0xb652('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb652('0x4'));var logger=require(_0xb652('0x5'))(_0xb652('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb652('0x7')]['http']({'port':0x232a});config['redis']=_[_0xb652('0x8')](config['redis'],{'host':_0xb652('0x9'),'port':0x18eb});var socket=require(_0xb652('0xa'))(new Redis(config[_0xb652('0xb')]));require(_0xb652('0xc'))[_0xb652('0xd')](socket);function respondWithRpcPromise(_0x374775,_0x4b6c18,_0x47eec5){return new BPromise(function(_0x368635,_0x1ebe2b){return client[_0xb652('0xe')](_0x374775,_0x47eec5)[_0xb652('0xf')](function(_0x5d347c){logger[_0xb652('0x10')](_0xb652('0x11'),_0x4b6c18,_0xb652('0x12'));logger['debug'](_0xb652('0x13'),_0x4b6c18,_0xb652('0x12'),JSON['stringify'](_0x5d347c));if(_0x5d347c['error']){if(_0x5d347c['error']['code']===0x1f4){logger[_0xb652('0x14')]('MailQueue,\x20%s,\x20%s',_0x4b6c18,_0x5d347c[_0xb652('0x14')][_0xb652('0x15')]);return _0x1ebe2b(_0x5d347c[_0xb652('0x14')]['message']);}logger[_0xb652('0x14')](_0xb652('0x11'),_0x4b6c18,_0x5d347c[_0xb652('0x14')][_0xb652('0x15')]);return _0x368635(_0x5d347c['error'][_0xb652('0x15')]);}else{logger[_0xb652('0x10')](_0xb652('0x11'),_0x4b6c18,_0xb652('0x12'));_0x368635(_0x5d347c['result'][_0xb652('0x15')]);}})['catch'](function(_0xa6ed9b){logger[_0xb652('0x14')](_0xb652('0x11'),_0x4b6c18,_0xa6ed9b);_0x1ebe2b(_0xa6ed9b);});});}exports[_0xb652('0x16')]=function(_0x58ee68){var _0x1de010=this;return new Promise(function(_0x3fb9c2,_0x3fc43e){return db[_0xb652('0x17')][_0xb652('0x18')]({'raw':_0x58ee68[_0xb652('0x19')]?_0x58ee68['options']['raw']===undefined?!![]:![]:!![],'where':_0x58ee68[_0xb652('0x19')]?_0x58ee68[_0xb652('0x19')]['where']||null:null,'attributes':_0x58ee68['options']?_0x58ee68[_0xb652('0x19')]['attributes']||null:null,'limit':_0x58ee68[_0xb652('0x19')]?_0x58ee68[_0xb652('0x19')]['limit']||null:null,'include':_0x58ee68['options']?_0x58ee68[_0xb652('0x19')][_0xb652('0x1a')]?_[_0xb652('0x1b')](_0x58ee68[_0xb652('0x19')][_0xb652('0x1a')],function(_0x2f7186){return{'model':db[_0x2f7186[_0xb652('0x1c')]],'as':_0x2f7186['as'],'attributes':_0x2f7186[_0xb652('0x1d')],'include':_0x2f7186['include']?_['map'](_0x2f7186['include'],function(_0x1f169a){return{'model':db[_0x1f169a['model']],'as':_0x1f169a['as'],'attributes':_0x1f169a[_0xb652('0x1d')],'include':_0x1f169a['include']?_[_0xb652('0x1b')](_0x1f169a[_0xb652('0x1a')],function(_0x3b74eb){return{'model':db[_0x3b74eb[_0xb652('0x1c')]],'as':_0x3b74eb['as'],'attributes':_0x3b74eb[_0xb652('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x459c03){logger['info'](_0xb652('0x16'),_0x58ee68);logger['debug'](_0xb652('0x16'),_0x58ee68,JSON[_0xb652('0x1e')](_0x459c03));_0x3fb9c2(_0x459c03);})[_0xb652('0x1f')](function(_0x39de0d){logger[_0xb652('0x14')](_0xb652('0x16'),_0x39de0d[_0xb652('0x15')],_0x58ee68);_0x3fc43e(_0x1de010[_0xb652('0x14')](0x1f4,_0x39de0d[_0xb652('0x15')]));});});};exports[_0xb652('0x20')]=function(_0x30c001){var _0x4a557a=this;return new Promise(function(_0x22a2f5,_0x30f3ee){return db[_0xb652('0x17')][_0xb652('0x21')]({'raw':_0x30c001[_0xb652('0x19')]?_0x30c001[_0xb652('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x30c001[_0xb652('0x19')]?_0x30c001[_0xb652('0x19')][_0xb652('0x22')]||null:null,'attributes':_0x30c001[_0xb652('0x19')]?_0x30c001[_0xb652('0x19')][_0xb652('0x1d')]||null:null,'include':_0x30c001[_0xb652('0x19')]?_0x30c001[_0xb652('0x19')][_0xb652('0x1a')]?_[_0xb652('0x1b')](_0x30c001['options'][_0xb652('0x1a')],function(_0x4d8d82){return{'model':db[_0x4d8d82['model']],'as':_0x4d8d82['as'],'attributes':_0x4d8d82['attributes'],'include':_0x4d8d82[_0xb652('0x1a')]?_[_0xb652('0x1b')](_0x4d8d82[_0xb652('0x1a')],function(_0x4f17fd){return{'model':db[_0x4f17fd[_0xb652('0x1c')]],'as':_0x4f17fd['as'],'attributes':_0x4f17fd['attributes'],'include':_0x4f17fd[_0xb652('0x1a')]?_['map'](_0x4f17fd[_0xb652('0x1a')],function(_0x5895a0){return{'model':db[_0x5895a0[_0xb652('0x1c')]],'as':_0x5895a0['as'],'attributes':_0x5895a0[_0xb652('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb652('0xf')](function(_0x2b9d61){logger['info'](_0xb652('0x20'),_0x30c001);logger[_0xb652('0x23')](_0xb652('0x20'),_0x30c001,JSON[_0xb652('0x1e')](_0x2b9d61));_0x22a2f5(_0x2b9d61);})['catch'](function(_0x3164f4){logger[_0xb652('0x14')]('ShowMailQueue',_0x3164f4[_0xb652('0x15')],_0x30c001);_0x30f3ee(_0x4a557a['error'](0x1f4,_0x3164f4['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index e3278c0..16e30e4 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 _0x689b=['./mailQueue.events','remove','emit','removeListener','register','length','mailQueue:'];(function(_0x3a6c4d,_0x598bc9){var _0x2423c9=function(_0x1ff5c3){while(--_0x1ff5c3){_0x3a6c4d['push'](_0x3a6c4d['shift']());}};_0x2423c9(++_0x598bc9);}(_0x689b,0x142));var _0xb689=function(_0x4c2a2a,_0x80671d){_0x4c2a2a=_0x4c2a2a-0x0;var _0x4cfbe2=_0x689b[_0x4c2a2a];return _0x4cfbe2;};'use strict';var MailQueueEvents=require(_0xb689('0x0'));var events=['save',_0xb689('0x1'),'update'];function createListener(_0x5e98bb,_0x213562){return function(_0x2530a1){_0x213562[_0xb689('0x2')](_0x5e98bb,_0x2530a1);};}function removeListener(_0x4378a8,_0x2bcd76){return function(){MailQueueEvents[_0xb689('0x3')](_0x4378a8,_0x2bcd76);};}exports[_0xb689('0x4')]=function(_0x4bb98f){for(var _0x1b9fed=0x0,_0x5ee263=events[_0xb689('0x5')];_0x1b9fed<_0x5ee263;_0x1b9fed++){var _0x56c6ba=events[_0x1b9fed];var _0x6eaf58=createListener(_0xb689('0x6')+_0x56c6ba,_0x4bb98f);MailQueueEvents['on'](_0x56c6ba,_0x6eaf58);}}; \ No newline at end of file +var _0xf263=['emit','removeListener','mailQueue:','./mailQueue.events','remove','update'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xf263,0x141));var _0x3f26=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0xf263[_0x3b76f7];return _0x43984e;};'use strict';var MailQueueEvents=require(_0x3f26('0x0'));var events=['save',_0x3f26('0x1'),_0x3f26('0x2')];function createListener(_0x3d5fc5,_0xbfe52e){return function(_0x5bdc34){_0xbfe52e[_0x3f26('0x3')](_0x3d5fc5,_0x5bdc34);};}function removeListener(_0x339e00,_0x1f71b1){return function(){MailQueueEvents[_0x3f26('0x4')](_0x339e00,_0x1f71b1);};}exports['register']=function(_0x1c4702){for(var _0xede9da=0x0,_0xee877a=events['length'];_0xede9da<_0xee877a;_0xede9da++){var _0x19eb2e=events[_0xede9da];var _0x204c72=createListener(_0x3f26('0x5')+_0x19eb2e,_0x1c4702);MailQueueEvents['on'](_0x19eb2e,_0x204c72);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index be4ee7b..127ad60 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 _0x55ec=['get','/describe','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index'];(function(_0x3d72ae,_0x83e594){var _0x4198df=function(_0x41a910){while(--_0x41a910){_0x3d72ae['push'](_0x3d72ae['shift']());}};_0x4198df(++_0x83e594);}(_0x55ec,0x105));var _0xc55e=function(_0x2f3d29,_0x150e7b){_0x2f3d29=_0x2f3d29-0x0;var _0x53d69d=_0x55ec[_0x2f3d29];return _0x53d69d;};'use strict';var multer=require(_0xc55e('0x0'));var util=require(_0xc55e('0x1'));var path=require(_0xc55e('0x2'));var timeout=require(_0xc55e('0x3'));var express=require(_0xc55e('0x4'));var router=express['Router']();var fs_extra=require(_0xc55e('0x5'));var auth=require(_0xc55e('0x6'));var interaction=require(_0xc55e('0x7'));var config=require(_0xc55e('0x8'));var controller=require(_0xc55e('0x9'));router['get']('/',auth[_0xc55e('0xa')](),controller[_0xc55e('0xb')]);router[_0xc55e('0xc')](_0xc55e('0xd'),auth[_0xc55e('0xa')](),controller['describe']);router[_0xc55e('0xc')]('/:id',auth[_0xc55e('0xa')](),controller[_0xc55e('0xe')]);router['post']('/',auth[_0xc55e('0xa')](),controller['create']);router[_0xc55e('0xf')](_0xc55e('0x10'),auth[_0xc55e('0xa')](),controller[_0xc55e('0x11')]);router[_0xc55e('0x12')](_0xc55e('0x10'),auth[_0xc55e('0xa')](),controller[_0xc55e('0x13')]);module[_0xc55e('0x14')]=router; \ No newline at end of file +var _0x5eb7=['Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x246804,_0x4ade0c){var _0x46a37=function(_0x57ef0b){while(--_0x57ef0b){_0x246804['push'](_0x246804['shift']());}};_0x46a37(++_0x4ade0c);}(_0x5eb7,0xf8));var _0x75eb=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x5eb7[_0xb24a3e];return _0x4038d7;};'use strict';var multer=require('multer');var util=require(_0x75eb('0x0'));var path=require(_0x75eb('0x1'));var timeout=require(_0x75eb('0x2'));var express=require(_0x75eb('0x3'));var router=express[_0x75eb('0x4')]();var fs_extra=require(_0x75eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x75eb('0x6'));var config=require(_0x75eb('0x7'));var controller=require(_0x75eb('0x8'));router[_0x75eb('0x9')]('/',auth[_0x75eb('0xa')](),controller[_0x75eb('0xb')]);router[_0x75eb('0x9')]('/describe',auth[_0x75eb('0xa')](),controller['describe']);router[_0x75eb('0x9')](_0x75eb('0xc'),auth['isAuthenticated'](),controller[_0x75eb('0xd')]);router[_0x75eb('0xe')]('/',auth[_0x75eb('0xa')](),controller[_0x75eb('0xf')]);router[_0x75eb('0x10')](_0x75eb('0xc'),auth[_0x75eb('0xa')](),controller[_0x75eb('0x11')]);router[_0x75eb('0x12')](_0x75eb('0xc'),auth[_0x75eb('0xa')](),controller[_0x75eb('0x13')]);module[_0x75eb('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index f0cc53b..b6f432d 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 _0xefa7=['DATE','moment','exports','STRING'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xefa7,0xc5));var _0x7efa=function(_0x24769b,_0x6ef7ff){_0x24769b=_0x24769b-0x0;var _0x5b08a1=_0xefa7[_0x24769b];return _0x5b08a1;};'use strict';var moment=require(_0x7efa('0x0'));var Sequelize=require('sequelize');module[_0x7efa('0x1')]={'uniqueid':{'type':Sequelize[_0x7efa('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7efa('0x2')]},'joinAt':{'type':Sequelize[_0x7efa('0x3')]},'leaveAt':{'type':Sequelize[_0x7efa('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7efa('0x2')]}}; \ No newline at end of file +var _0x7671=['DATE','moment','sequelize','exports','STRING'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7671,0xec));var _0x1767=function(_0x594f70,_0x379643){_0x594f70=_0x594f70-0x0;var _0x41d23c=_0x7671[_0x594f70];return _0x41d23c;};'use strict';var moment=require(_0x1767('0x0'));var Sequelize=require(_0x1767('0x1'));module[_0x1767('0x2')]={'uniqueid':{'type':Sequelize[_0x1767('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1767('0x3')]},'joinAt':{'type':Sequelize[_0x1767('0x4')]},'leaveAt':{'type':Sequelize[_0x1767('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1767('0x4')]},'reason':{'type':Sequelize[_0x1767('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index bae978e..246ec83 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 _0x3d04=['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','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','rows','catch','show','params','rawAttributes','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset'];(function(_0x5c9471,_0x52d34c){var _0x538af8=function(_0x5ecc7d){while(--_0x5ecc7d){_0x5c9471['push'](_0x5c9471['shift']());}};_0x538af8(++_0x52d34c);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x43d0('0x0'));var rimraf=require(_0x43d0('0x1'));var zipdir=require(_0x43d0('0x2'));var jsonpatch=require(_0x43d0('0x3'));var rp=require(_0x43d0('0x4'));var moment=require(_0x43d0('0x5'));var BPromise=require(_0x43d0('0x6'));var Mustache=require(_0x43d0('0x7'));var util=require('util');var path=require(_0x43d0('0x8'));var sox=require(_0x43d0('0x9'));var csv=require(_0x43d0('0xa'));var ejs=require(_0x43d0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43d0('0xc'));var deskjs=require(_0x43d0('0xd'));var toCsv=require(_0x43d0('0xa'));var querystring=require(_0x43d0('0xe'));var Papa=require(_0x43d0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43d0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x43d0('0x11'))(_0x43d0('0x12'));var utils=require(_0x43d0('0x13'));var config=require(_0x43d0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x43d0('0x15'))['db'];function respondWithStatusCode(_0x23daaa,_0x546b23){_0x546b23=_0x546b23||0xcc;return function(_0x29773b){if(_0x29773b){return _0x23daaa[_0x43d0('0x16')](_0x546b23);}return _0x23daaa[_0x43d0('0x17')](_0x546b23)['end']();};}function respondWithResult(_0xd262a8,_0x2454fa){_0x2454fa=_0x2454fa||0xc8;return function(_0x436130){if(_0x436130){return _0xd262a8['status'](_0x2454fa)[_0x43d0('0x18')](_0x436130);}};}function respondWithFilteredResult(_0x357f87,_0x44e6ec){return function(_0x1218b5){if(_0x1218b5){var _0x91b4a1=typeof _0x44e6ec['offset']==='undefined'&&typeof _0x44e6ec[_0x43d0('0x19')]===_0x43d0('0x1a');var _0x35decf=_0x1218b5['count'];var _0x2c641e=_0x91b4a1?0x0:_0x44e6ec['offset'];var _0x2c9d06=_0x91b4a1?_0x1218b5[_0x43d0('0x1b')]:_0x44e6ec[_0x43d0('0x1c')]+_0x44e6ec['limit'];var _0x3d7dcc;if(_0x2c9d06>=_0x35decf){_0x2c9d06=_0x35decf;_0x3d7dcc=0xc8;}else{_0x3d7dcc=0xce;}_0x357f87[_0x43d0('0x17')](_0x3d7dcc);return _0x357f87['set'](_0x43d0('0x1d'),_0x2c641e+'-'+_0x2c9d06+'/'+_0x35decf)[_0x43d0('0x18')](_0x1218b5);}return null;};}function patchUpdates(_0x348429){return function(_0x248622){try{jsonpatch[_0x43d0('0x1e')](_0x248622,_0x348429,!![]);}catch(_0x28381b){return BPromise[_0x43d0('0x1f')](_0x28381b);}return _0x248622[_0x43d0('0x20')]();};}function saveUpdates(_0x30febc,_0xc8a644){return function(_0xec5f07){if(_0xec5f07){return _0xec5f07[_0x43d0('0x21')](_0x30febc)[_0x43d0('0x22')](function(_0xbc72e6){return _0xbc72e6;});}return null;};}function removeEntity(_0x2efd77,_0x48aa18){return function(_0x2c7b24){if(_0x2c7b24){return _0x2c7b24[_0x43d0('0x23')]()['then'](function(){_0x2efd77[_0x43d0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29c111,_0x44497b){return function(_0x5dd310){if(!_0x5dd310){_0x29c111[_0x43d0('0x16')](0x194);}return _0x5dd310;};}function handleError(_0x238c64,_0x5ac4c0){_0x5ac4c0=_0x5ac4c0||0x1f4;return function(_0x12df30){logger[_0x43d0('0x24')](_0x12df30[_0x43d0('0x25')]);if(_0x12df30['name']){delete _0x12df30[_0x43d0('0x26')];}_0x238c64[_0x43d0('0x17')](_0x5ac4c0)[_0x43d0('0x27')](_0x12df30);};}exports[_0x43d0('0x28')]=function(_0x37d78f,_0x440ecb){var _0x31a057={},_0x4a3cd4={},_0x2b0784={'count':0x0,'rows':[]};var _0x2f5bc5=_[_0x43d0('0x29')](db['MailQueueReport']['rawAttributes'],function(_0x52c37b){return{'name':_0x52c37b[_0x43d0('0x2a')],'type':_0x52c37b[_0x43d0('0x2b')][_0x43d0('0x2c')]};});_0x4a3cd4[_0x43d0('0x2d')]=_[_0x43d0('0x29')](_0x2f5bc5,_0x43d0('0x26'));_0x4a3cd4['query']=_[_0x43d0('0x2e')](_0x37d78f[_0x43d0('0x2f')]);_0x4a3cd4[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0x4a3cd4[_0x43d0('0x2d')],_0x4a3cd4[_0x43d0('0x2f')]);_0x31a057[_0x43d0('0x32')]=_[_0x43d0('0x31')](_0x4a3cd4[_0x43d0('0x2d')],qs[_0x43d0('0x33')](_0x37d78f[_0x43d0('0x2f')]['fields']));_0x31a057[_0x43d0('0x32')]=_0x31a057[_0x43d0('0x32')][_0x43d0('0x34')]?_0x31a057[_0x43d0('0x32')]:_0x4a3cd4['model'];if(!_0x37d78f[_0x43d0('0x2f')]['hasOwnProperty'](_0x43d0('0x35'))){_0x31a057[_0x43d0('0x19')]=qs['limit'](_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x19')]);_0x31a057[_0x43d0('0x1c')]=qs[_0x43d0('0x1c')](_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x1c')]);}_0x31a057[_0x43d0('0x36')]=qs[_0x43d0('0x37')](_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x37')]);_0x31a057[_0x43d0('0x38')]=qs['filters'](_[_0x43d0('0x39')](_0x37d78f[_0x43d0('0x2f')],_0x4a3cd4[_0x43d0('0x30')]),_0x2f5bc5);if(_0x37d78f[_0x43d0('0x2f')][_0x43d0('0x3a')]){_0x31a057[_0x43d0('0x38')]=_[_0x43d0('0x3b')](_0x31a057[_0x43d0('0x38')],{'$or':_[_0x43d0('0x29')](_0x2f5bc5,function(_0x43bcc5){if(_0x43bcc5[_0x43d0('0x2b')]!==_0x43d0('0x3c')){var _0x19843c={};_0x19843c[_0x43bcc5[_0x43d0('0x26')]]={'$like':'%'+_0x37d78f['query'][_0x43d0('0x3a')]+'%'};return _0x19843c;}})});}_0x31a057=_[_0x43d0('0x3b')]({},_0x31a057,_0x37d78f[_0x43d0('0x3d')]);var _0xc3f9c7={'where':_0x31a057[_0x43d0('0x38')]};return db[_0x43d0('0x3e')][_0x43d0('0x1b')](_0xc3f9c7)[_0x43d0('0x22')](function(_0x4ae965){_0x2b0784['count']=_0x4ae965;if(_0x37d78f[_0x43d0('0x2f')]['includeAll']){_0x31a057['include']=[{'all':!![]}];}return db[_0x43d0('0x3e')]['findAll'](_0x31a057);})[_0x43d0('0x22')](function(_0x5027d0){_0x2b0784[_0x43d0('0x3f')]=_0x5027d0;return _0x2b0784;})['then'](respondWithFilteredResult(_0x440ecb,_0x31a057))[_0x43d0('0x40')](handleError(_0x440ecb,null));};exports[_0x43d0('0x41')]=function(_0x468b32,_0x4e817e){var _0x3eb2e9={'raw':!![],'where':{'id':_0x468b32[_0x43d0('0x42')]['id']}},_0x520406={};_0x520406['model']=_['keys'](db[_0x43d0('0x3e')][_0x43d0('0x43')]);_0x520406['query']=_[_0x43d0('0x2e')](_0x468b32[_0x43d0('0x2f')]);_0x520406[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0x520406[_0x43d0('0x2d')],_0x520406['query']);_0x3eb2e9[_0x43d0('0x32')]=_[_0x43d0('0x31')](_0x520406[_0x43d0('0x2d')],qs[_0x43d0('0x33')](_0x468b32['query'][_0x43d0('0x33')]));_0x3eb2e9[_0x43d0('0x32')]=_0x3eb2e9[_0x43d0('0x32')][_0x43d0('0x34')]?_0x3eb2e9[_0x43d0('0x32')]:_0x520406['model'];if(_0x468b32[_0x43d0('0x2f')][_0x43d0('0x44')]){_0x3eb2e9['include']=[{'all':!![]}];}_0x3eb2e9=_[_0x43d0('0x3b')]({},_0x3eb2e9,_0x468b32[_0x43d0('0x3d')]);return db[_0x43d0('0x3e')]['find'](_0x3eb2e9)[_0x43d0('0x22')](handleEntityNotFound(_0x4e817e,null))['then'](respondWithResult(_0x4e817e,null))[_0x43d0('0x40')](handleError(_0x4e817e,null));};exports['create']=function(_0x1f55e9,_0x269d99){return db[_0x43d0('0x3e')][_0x43d0('0x45')](_0x1f55e9[_0x43d0('0x46')],{})['then'](respondWithResult(_0x269d99,0xc9))[_0x43d0('0x40')](handleError(_0x269d99,null));};exports['update']=function(_0x5a6364,_0x3e7392){if(_0x5a6364[_0x43d0('0x46')]['id']){delete _0x5a6364[_0x43d0('0x46')]['id'];}return db[_0x43d0('0x3e')][_0x43d0('0x47')]({'where':{'id':_0x5a6364[_0x43d0('0x42')]['id']}})[_0x43d0('0x22')](handleEntityNotFound(_0x3e7392,null))[_0x43d0('0x22')](saveUpdates(_0x5a6364[_0x43d0('0x46')],null))[_0x43d0('0x22')](respondWithResult(_0x3e7392,null))[_0x43d0('0x40')](handleError(_0x3e7392,null));};exports['destroy']=function(_0x338203,_0xd78af1){return db[_0x43d0('0x3e')]['find']({'where':{'id':_0x338203[_0x43d0('0x42')]['id']}})['then'](handleEntityNotFound(_0xd78af1,null))['then'](removeEntity(_0xd78af1,null))[_0x43d0('0x40')](handleError(_0xd78af1,null));};exports[_0x43d0('0x48')]=function(_0x234571,_0x127815){return db[_0x43d0('0x3e')]['describe']()['then'](respondWithResult(_0x127815,null))[_0x43d0('0x40')](handleError(_0x127815,null));}; \ No newline at end of file +var _0x66fa=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','MailQueueReport','findAll','rows','catch','merge','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x66fa,0x117));var _0xa66f=function(_0x533b54,_0x37cb25){_0x533b54=_0x533b54-0x0;var _0x117228=_0x66fa[_0x533b54];return _0x117228;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['MailQueueReport'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['MailQueueReport'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':!![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['MailQueueReport'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['MailQueueReport'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));};exports[_0xa66f('0x4a')]=function(_0x5d77d1,_0x389b9a){return db['MailQueueReport'][_0xa66f('0x4a')]()['then'](respondWithResult(_0x389b9a,null))['catch'](handleError(_0x389b9a,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index cd16788..efae914 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 _0x5419=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util'];(function(_0x100682,_0x11afec){var _0xcb6e87=function(_0x3ef421){while(--_0x3ef421){_0x100682['push'](_0x100682['shift']());}};_0xcb6e87(++_0x11afec);}(_0x5419,0x175));var _0x9541=function(_0x4aafa7,_0x5c8164){_0x4aafa7=_0x4aafa7-0x0;var _0x50ca96=_0x5419[_0x4aafa7];return _0x50ca96;};'use strict';var _=require(_0x9541('0x0'));var util=require(_0x9541('0x1'));var logger=require(_0x9541('0x2'))(_0x9541('0x3'));var moment=require(_0x9541('0x4'));var BPromise=require(_0x9541('0x5'));var rp=require(_0x9541('0x6'));var fs=require('fs');var path=require(_0x9541('0x7'));var rimraf=require(_0x9541('0x8'));var config=require(_0x9541('0x9'));var attributes=require('./mailQueueReport.attributes');module[_0x9541('0xa')]=function(_0x1f9139,_0xbdabaf){return _0x1f9139[_0x9541('0xb')](_0x9541('0xc'),attributes,{'tableName':_0x9541('0xd'),'paranoid':![],'indexes':[{'name':_0x9541('0xe'),'fields':[_0x9541('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d8b=['./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x438912,_0x3f7f74){var _0x18112f=function(_0x1b8ac9){while(--_0x1b8ac9){_0x438912['push'](_0x438912['shift']());}};_0x18112f(++_0x3f7f74);}(_0x2d8b,0x13b));var _0xb2d8=function(_0x2b6b57,_0xda3e1a){_0x2b6b57=_0x2b6b57-0x0;var _0x3470b6=_0x2d8b[_0x2b6b57];return _0x3470b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb2d8('0x0'));var moment=require(_0xb2d8('0x1'));var BPromise=require('bluebird');var rp=require(_0xb2d8('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2d8('0x3'));var config=require(_0xb2d8('0x4'));var attributes=require(_0xb2d8('0x5'));module[_0xb2d8('0x6')]=function(_0x3c12c2,_0xe9ec34){return _0x3c12c2[_0xb2d8('0x7')](_0xb2d8('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xb2d8('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index f89b7b0..f7c9349 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(_0x2d3b4e,_0x165e9f){var _0x21f631=function(_0x444529){while(--_0x444529){_0x2d3b4e['push'](_0x2d3b4e['shift']());}};_0x21f631(++_0x165e9f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xc4aa[_0x4ff09b];return _0x3f5c2e;};'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 _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x56adb2,_0x5ca06d){var _0x3e24b7=function(_0x208aac){while(--_0x208aac){_0x56adb2['push'](_0x56adb2['shift']());}};_0x3e24b7(++_0x5ca06d);}(_0x326f,0xd1));var _0xf326=function(_0x36b6cc,_0x299ee4){_0x36b6cc=_0x36b6cc-0x0;var _0x393f5a=_0x326f[_0x36b6cc];return _0x393f5a;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 8aba71a..f1f6afc 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4102d1,_0x25410b){var _0x1ae60d=function(_0x19b968){while(--_0x19b968){_0x4102d1['push'](_0x4102d1['shift']());}};_0x1ae60d(++_0x25410b);}(_0xedd9,0xfc));var _0x9edd=function(_0x2070b3,_0x288570){_0x2070b3=_0x2070b3-0x0;var _0xe7256b=_0xedd9[_0x2070b3];return _0xe7256b;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4e1104,_0xd6d1a5){var _0x57b6ae=function(_0x518897){while(--_0x518897){_0x4e1104['push'](_0x4e1104['shift']());}};_0x57b6ae(++_0xd6d1a5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0xcb91[_0x576d8a];return _0x3dc3ef;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 5ac49bc..d328bd8 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 _0xd3de=['STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x10f074,_0x44eb0b){var _0x2a6d3f=function(_0x8956b0){while(--_0x8956b0){_0x10f074['push'](_0x10f074['shift']());}};_0x2a6d3f(++_0x44eb0b);}(_0xd3de,0xb8));var _0xed3d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd3de[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xed3d('0x0'));module['exports']={'description':{'type':Sequelize[_0xed3d('0x1')]},'host':{'type':Sequelize[_0xed3d('0x1')]},'authentication':{'type':Sequelize[_0xed3d('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xed3d('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xed3d('0x3')]},'tls':{'type':Sequelize[_0xed3d('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xed3d('0x1')],'defaultValue':_0xed3d('0x4')},'connTimeout':{'type':Sequelize[_0xed3d('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xed3d('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7f32=['STRING','BOOLEAN','INTEGER','INBOX','sequelize','exports'];(function(_0x19a55d,_0x13c587){var _0x577370=function(_0x275408){while(--_0x275408){_0x19a55d['push'](_0x19a55d['shift']());}};_0x577370(++_0x13c587);}(_0x7f32,0x9a));var _0x27f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7f32[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x27f3('0x0'));module[_0x27f3('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x27f3('0x2')]},'authentication':{'type':Sequelize[_0x27f3('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x27f3('0x2')]},'password':{'type':Sequelize[_0x27f3('0x2')]},'port':{'type':Sequelize[_0x27f3('0x4')]},'tls':{'type':Sequelize[_0x27f3('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x27f3('0x2')],'defaultValue':_0x27f3('0x5')},'connTimeout':{'type':Sequelize[_0x27f3('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x27f3('0x2')]},'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 8cbef1b..9e67c2e 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 _0xac76=['bluebird','request-promise','rimraf','./mailServerIn.attributes','define','mail_servers_in','lodash','util','../../config/logger','api','moment'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xac76,0xf8));var _0x6ac7=function(_0x49e52e,_0x15f616){_0x49e52e=_0x49e52e-0x0;var _0x36a6e6=_0xac76[_0x49e52e];return _0x36a6e6;};'use strict';var _=require(_0x6ac7('0x0'));var util=require(_0x6ac7('0x1'));var logger=require(_0x6ac7('0x2'))(_0x6ac7('0x3'));var moment=require(_0x6ac7('0x4'));var BPromise=require(_0x6ac7('0x5'));var rp=require(_0x6ac7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ac7('0x7'));var config=require('../../config/environment');var attributes=require(_0x6ac7('0x8'));module['exports']=function(_0xc67a42,_0x35dc29){return _0xc67a42[_0x6ac7('0x9')]('MailServerIn',attributes,{'tableName':_0x6ac7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad55=['bluebird','request-promise','../../config/environment','MailServerIn','mail_servers_in','lodash','util','api'];(function(_0x11dbc2,_0x14e0a8){var _0xefee44=function(_0x1b02d5){while(--_0x1b02d5){_0x11dbc2['push'](_0x11dbc2['shift']());}};_0xefee44(++_0x14e0a8);}(_0xad55,0x1ad));var _0x5ad5=function(_0x597a71,_0x87ba50){_0x597a71=_0x597a71-0x0;var _0x181220=_0xad55[_0x597a71];return _0x181220;};'use strict';var _=require(_0x5ad5('0x0'));var util=require(_0x5ad5('0x1'));var logger=require('../../config/logger')(_0x5ad5('0x2'));var moment=require('moment');var BPromise=require(_0x5ad5('0x3'));var rp=require(_0x5ad5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5ad5('0x5'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x3fa40d,_0x1715a0){return _0x3fa40d['define'](_0x5ad5('0x6'),attributes,{'tableName':_0x5ad5('0x7'),'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 48460ab..6b8f1f1 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 _0xe130=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','options','raw','attributes','include','model','map','lodash','util','bluebird','randomstring','ioredis'];(function(_0x32f864,_0x6bc87){var _0x36e88f=function(_0x25aa86){while(--_0x25aa86){_0x32f864['push'](_0x32f864['shift']());}};_0x36e88f(++_0x6bc87);}(_0xe130,0x127));var _0x0e13=function(_0x1e3437,_0x3df181){_0x1e3437=_0x1e3437-0x0;var _0x434bc2=_0xe130[_0x1e3437];return _0x434bc2;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var moment=require('moment');var BPromise=require(_0x0e13('0x2'));var rs=require(_0x0e13('0x3'));var fs=require('fs');var Redis=require(_0x0e13('0x4'));var db=require(_0x0e13('0x5'))['db'];var utils=require(_0x0e13('0x6'));var logger=require('../../config/logger')(_0x0e13('0x7'));var config=require(_0x0e13('0x8'));var jayson=require(_0x0e13('0x9'));var client=jayson[_0x0e13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1774a5,_0x5f0d09,_0x567031){return new BPromise(function(_0x5aaa22,_0x2faf49){return client[_0x0e13('0xb')](_0x1774a5,_0x567031)['then'](function(_0x5d066a){logger[_0x0e13('0xc')](_0x0e13('0xd'),_0x5f0d09,_0x0e13('0xe'));logger[_0x0e13('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x5f0d09,'request\x20sent',JSON[_0x0e13('0x10')](_0x5d066a));if(_0x5d066a[_0x0e13('0x11')]){if(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x12')]===0x1f4){logger['error'](_0x0e13('0xd'),_0x5f0d09,_0x5d066a['error'][_0x0e13('0x13')]);return _0x2faf49(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);}logger[_0x0e13('0x11')](_0x0e13('0xd'),_0x5f0d09,_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);return _0x5aaa22(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);}else{logger['info'](_0x0e13('0xd'),_0x5f0d09,_0x0e13('0xe'));_0x5aaa22(_0x5d066a[_0x0e13('0x14')][_0x0e13('0x13')]);}})[_0x0e13('0x15')](function(_0x32f76a){logger['error'](_0x0e13('0xd'),_0x5f0d09,_0x32f76a);_0x2faf49(_0x32f76a);});});}exports[_0x0e13('0x16')]=function(_0x510a2b){var _0x487e2c=this;return new Promise(function(_0x3b85fd,_0x5001aa){return db[_0x0e13('0x17')]['findAll']({'raw':_0x510a2b[_0x0e13('0x18')]?_0x510a2b[_0x0e13('0x18')][_0x0e13('0x19')]===undefined?!![]:![]:!![],'where':_0x510a2b[_0x0e13('0x18')]?_0x510a2b[_0x0e13('0x18')]['where']||null:null,'attributes':_0x510a2b['options']?_0x510a2b['options'][_0x0e13('0x1a')]||null:null,'limit':_0x510a2b[_0x0e13('0x18')]?_0x510a2b['options']['limit']||null:null,'include':_0x510a2b[_0x0e13('0x18')]?_0x510a2b[_0x0e13('0x18')][_0x0e13('0x1b')]?_['map'](_0x510a2b[_0x0e13('0x18')][_0x0e13('0x1b')],function(_0x22cc15){return{'model':db[_0x22cc15[_0x0e13('0x1c')]],'as':_0x22cc15['as'],'attributes':_0x22cc15[_0x0e13('0x1a')],'include':_0x22cc15[_0x0e13('0x1b')]?_[_0x0e13('0x1d')](_0x22cc15[_0x0e13('0x1b')],function(_0x3d6abf){return{'model':db[_0x3d6abf[_0x0e13('0x1c')]],'as':_0x3d6abf['as'],'attributes':_0x3d6abf[_0x0e13('0x1a')],'include':_0x3d6abf[_0x0e13('0x1b')]?_[_0x0e13('0x1d')](_0x3d6abf[_0x0e13('0x1b')],function(_0xfd19ed){return{'model':db[_0xfd19ed[_0x0e13('0x1c')]],'as':_0xfd19ed['as'],'attributes':_0xfd19ed[_0x0e13('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37fe42){logger[_0x0e13('0xc')](_0x0e13('0x16'),_0x510a2b);logger['debug'](_0x0e13('0x16'),_0x510a2b,JSON[_0x0e13('0x10')](_0x37fe42));_0x3b85fd(_0x37fe42);})[_0x0e13('0x15')](function(_0x4606de){logger['error'](_0x0e13('0x16'),_0x4606de[_0x0e13('0x13')],_0x510a2b);_0x5001aa(_0x487e2c[_0x0e13('0x11')](0x1f4,_0x4606de[_0x0e13('0x13')]));});});}; \ No newline at end of file +var _0x9756=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','MailServerIn','findAll','options','raw','where','attributes','include','map','model','GetMailServerIn','stringify'];(function(_0xf89c3,_0x351bf1){var _0x274fc8=function(_0x5e0c91){while(--_0x5e0c91){_0xf89c3['push'](_0xf89c3['shift']());}};_0x274fc8(++_0x351bf1);}(_0x9756,0x108));var _0x6975=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x9756[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x6975('0x0'));var util=require(_0x6975('0x1'));var moment=require(_0x6975('0x2'));var BPromise=require(_0x6975('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6975('0x4'));var db=require(_0x6975('0x5'))['db'];var utils=require(_0x6975('0x6'));var logger=require(_0x6975('0x7'))(_0x6975('0x8'));var config=require('../../config/environment');var jayson=require(_0x6975('0x9'));var client=jayson[_0x6975('0xa')][_0x6975('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5708aa,_0x404da8,_0x5bdf17){return new BPromise(function(_0x5a3ac7,_0x4c1bd2){return client['request'](_0x5708aa,_0x5bdf17)[_0x6975('0xc')](function(_0x3901cc){logger[_0x6975('0xd')](_0x6975('0xe'),_0x404da8,'request\x20sent');logger[_0x6975('0xf')](_0x6975('0x10'),_0x404da8,'request\x20sent',JSON['stringify'](_0x3901cc));if(_0x3901cc[_0x6975('0x11')]){if(_0x3901cc[_0x6975('0x11')]['code']===0x1f4){logger[_0x6975('0x11')](_0x6975('0xe'),_0x404da8,_0x3901cc[_0x6975('0x11')][_0x6975('0x12')]);return _0x4c1bd2(_0x3901cc[_0x6975('0x11')][_0x6975('0x12')]);}logger[_0x6975('0x11')]('MailServerIn,\x20%s,\x20%s',_0x404da8,_0x3901cc['error'][_0x6975('0x12')]);return _0x5a3ac7(_0x3901cc['error'][_0x6975('0x12')]);}else{logger[_0x6975('0xd')]('MailServerIn,\x20%s,\x20%s',_0x404da8,_0x6975('0x13'));_0x5a3ac7(_0x3901cc[_0x6975('0x14')][_0x6975('0x12')]);}})[_0x6975('0x15')](function(_0x1f86a5){logger[_0x6975('0x11')](_0x6975('0xe'),_0x404da8,_0x1f86a5);_0x4c1bd2(_0x1f86a5);});});}exports['GetMailServerIn']=function(_0x470121){var _0x3699b7=this;return new Promise(function(_0x4c1754,_0x1093c1){return db[_0x6975('0x16')][_0x6975('0x17')]({'raw':_0x470121['options']?_0x470121[_0x6975('0x18')][_0x6975('0x19')]===undefined?!![]:![]:!![],'where':_0x470121[_0x6975('0x18')]?_0x470121['options'][_0x6975('0x1a')]||null:null,'attributes':_0x470121[_0x6975('0x18')]?_0x470121[_0x6975('0x18')][_0x6975('0x1b')]||null:null,'limit':_0x470121[_0x6975('0x18')]?_0x470121[_0x6975('0x18')]['limit']||null:null,'include':_0x470121['options']?_0x470121['options'][_0x6975('0x1c')]?_[_0x6975('0x1d')](_0x470121[_0x6975('0x18')][_0x6975('0x1c')],function(_0x13e398){return{'model':db[_0x13e398[_0x6975('0x1e')]],'as':_0x13e398['as'],'attributes':_0x13e398['attributes'],'include':_0x13e398[_0x6975('0x1c')]?_[_0x6975('0x1d')](_0x13e398[_0x6975('0x1c')],function(_0x2bbbcc){return{'model':db[_0x2bbbcc[_0x6975('0x1e')]],'as':_0x2bbbcc['as'],'attributes':_0x2bbbcc[_0x6975('0x1b')],'include':_0x2bbbcc['include']?_[_0x6975('0x1d')](_0x2bbbcc[_0x6975('0x1c')],function(_0x43423e){return{'model':db[_0x43423e[_0x6975('0x1e')]],'as':_0x43423e['as'],'attributes':_0x43423e['attributes']};}):[]};}):[]};}):[]:[]})[_0x6975('0xc')](function(_0x2d7cb2){logger['info'](_0x6975('0x1f'),_0x470121);logger[_0x6975('0xf')]('GetMailServerIn',_0x470121,JSON[_0x6975('0x20')](_0x2d7cb2));_0x4c1754(_0x2d7cb2);})[_0x6975('0x15')](function(_0x29400b){logger['error'](_0x6975('0x1f'),_0x29400b['message'],_0x470121);_0x1093c1(_0x3699b7[_0x6975('0x11')](0x1f4,_0x29400b[_0x6975('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index b0120ff..f7e8d87 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(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x7a54,0x106));var _0x47a5=function(_0x4fb7e0,_0x382bb1){_0x4fb7e0=_0x4fb7e0-0x0;var _0x15e8b4=_0x7a54[_0x4fb7e0];return _0x15e8b4;};'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(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x7a54,0x106));var _0x47a5=function(_0x158097,_0x1ac853){_0x158097=_0x158097-0x0;var _0xc8171e=_0x7a54[_0x158097];return _0xc8171e;};'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 79e1bfc..53c7020 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 _0xdd4f=['sequelize','STRING','BOOLEAN'];(function(_0x308c25,_0x175a53){var _0x38b20d=function(_0x591c2e){while(--_0x591c2e){_0x308c25['push'](_0x308c25['shift']());}};_0x38b20d(++_0x175a53);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x4623bb,_0x1a8b43){_0x4623bb=_0x4623bb-0x0;var _0x4e2450=_0xdd4f[_0x4623bb];return _0x4e2450;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xfdd4('0x1')]},'pass':{'type':Sequelize[_0xfdd4('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xfdd4('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xfdd4('0x1')]},'authentication':{'type':Sequelize[_0xfdd4('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2032=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x633e46,_0x541f6b){var _0x353960=function(_0x3585c1){while(--_0x3585c1){_0x633e46['push'](_0x633e46['shift']());}};_0x353960(++_0x541f6b);}(_0x2032,0xd9));var _0x2203=function(_0x5b6110,_0x1fd1c9){_0x5b6110=_0x5b6110-0x0;var _0x5064a4=_0x2032[_0x5b6110];return _0x5064a4;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'description':{'type':Sequelize[_0x2203('0x1')]},'host':{'type':Sequelize[_0x2203('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x2203('0x1')]},'port':{'type':Sequelize[_0x2203('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x2203('0x1')]},'authentication':{'type':Sequelize[_0x2203('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x2203('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 272b1f4..7c2c4cc 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 _0x8d6e=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','error','name','index','map','MailServerOut','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','catch','show','params','rawAttributes','fields','options','find','create','body','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x17211b,_0x5a652b){var _0x278395=function(_0x1e28c6){while(--_0x1e28c6){_0x17211b['push'](_0x17211b['shift']());}};_0x278395(++_0x5a652b);}(_0x8d6e,0xc8));var _0xe8d6=function(_0x411c3d,_0x307f78){_0x411c3d=_0x411c3d-0x0;var _0x3869b4=_0x8d6e[_0x411c3d];return _0x3869b4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe8d6('0x0'));var jsonpatch=require(_0xe8d6('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe8d6('0x2'));var Mustache=require(_0xe8d6('0x3'));var util=require(_0xe8d6('0x4'));var path=require(_0xe8d6('0x5'));var sox=require('sox');var csv=require(_0xe8d6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe8d6('0x7'));var squel=require(_0xe8d6('0x8'));var crypto=require(_0xe8d6('0x9'));var jsforce=require(_0xe8d6('0xa'));var deskjs=require(_0xe8d6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe8d6('0xc'));var Papa=require(_0xe8d6('0xd'));var Redis=require(_0xe8d6('0xe'));var authService=require(_0xe8d6('0xf'));var qs=require(_0xe8d6('0x10'));var as=require(_0xe8d6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe8d6('0x12'));var utils=require(_0xe8d6('0x13'));var config=require(_0xe8d6('0x14'));var licenseUtil=require(_0xe8d6('0x15'));var db=require(_0xe8d6('0x16'))['db'];function respondWithStatusCode(_0x70fba8,_0x4b7a23){_0x4b7a23=_0x4b7a23||0xcc;return function(_0x306a42){if(_0x306a42){return _0x70fba8[_0xe8d6('0x17')](_0x4b7a23);}return _0x70fba8[_0xe8d6('0x18')](_0x4b7a23)[_0xe8d6('0x19')]();};}function respondWithResult(_0x237d9e,_0x3fcdf1){_0x3fcdf1=_0x3fcdf1||0xc8;return function(_0x1cea83){if(_0x1cea83){return _0x237d9e[_0xe8d6('0x18')](_0x3fcdf1)['json'](_0x1cea83);}};}function respondWithFilteredResult(_0x28ad05,_0x5a822f){return function(_0x35f580){if(_0x35f580){var _0x27aa5e=typeof _0x5a822f[_0xe8d6('0x1a')]===_0xe8d6('0x1b')&&typeof _0x5a822f[_0xe8d6('0x1c')]==='undefined';var _0x4817bb=_0x35f580[_0xe8d6('0x1d')];var _0x48ed06=_0x27aa5e?0x0:_0x5a822f[_0xe8d6('0x1a')];var _0x7eb279=_0x27aa5e?_0x35f580[_0xe8d6('0x1d')]:_0x5a822f['offset']+_0x5a822f['limit'];var _0x101925;if(_0x7eb279>=_0x4817bb){_0x7eb279=_0x4817bb;_0x101925=0xc8;}else{_0x101925=0xce;}_0x28ad05['status'](_0x101925);return _0x28ad05['set'](_0xe8d6('0x1e'),_0x48ed06+'-'+_0x7eb279+'/'+_0x4817bb)[_0xe8d6('0x1f')](_0x35f580);}return null;};}function patchUpdates(_0x5136a0){return function(_0x3bc32f){try{jsonpatch['apply'](_0x3bc32f,_0x5136a0,!![]);}catch(_0x5cd3b3){return BPromise[_0xe8d6('0x20')](_0x5cd3b3);}return _0x3bc32f[_0xe8d6('0x21')]();};}function saveUpdates(_0xfa202a,_0x2a2207){return function(_0x4bb67a){if(_0x4bb67a){return _0x4bb67a[_0xe8d6('0x22')](_0xfa202a)[_0xe8d6('0x23')](function(_0x3518fb){return _0x3518fb;});}return null;};}function removeEntity(_0x3fc07d,_0x5287cd){return function(_0x5fca4){if(_0x5fca4){return _0x5fca4[_0xe8d6('0x24')]()[_0xe8d6('0x23')](function(){_0x3fc07d[_0xe8d6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a62d8,_0x344d70){return function(_0x339f02){if(!_0x339f02){_0x3a62d8[_0xe8d6('0x17')](0x194);}return _0x339f02;};}function handleError(_0x54abd0,_0x5db2f2){_0x5db2f2=_0x5db2f2||0x1f4;return function(_0x3100ce){logger[_0xe8d6('0x25')](_0x3100ce['stack']);if(_0x3100ce[_0xe8d6('0x26')]){delete _0x3100ce[_0xe8d6('0x26')];}_0x54abd0[_0xe8d6('0x18')](_0x5db2f2)['send'](_0x3100ce);};}exports[_0xe8d6('0x27')]=function(_0x562578,_0x287b36){var _0x565b0f={},_0x2508e7={},_0x340eac={'count':0x0,'rows':[]};var _0x27b74c=_[_0xe8d6('0x28')](db[_0xe8d6('0x29')]['rawAttributes'],function(_0x2f3ba4){return{'name':_0x2f3ba4[_0xe8d6('0x2a')],'type':_0x2f3ba4[_0xe8d6('0x2b')][_0xe8d6('0x2c')]};});_0x2508e7[_0xe8d6('0x2d')]=_[_0xe8d6('0x28')](_0x27b74c,_0xe8d6('0x26'));_0x2508e7['query']=_[_0xe8d6('0x2e')](_0x562578[_0xe8d6('0x2f')]);_0x2508e7[_0xe8d6('0x30')]=_[_0xe8d6('0x31')](_0x2508e7[_0xe8d6('0x2d')],_0x2508e7['query']);_0x565b0f[_0xe8d6('0x32')]=_[_0xe8d6('0x31')](_0x2508e7['model'],qs['fields'](_0x562578['query']['fields']));_0x565b0f[_0xe8d6('0x32')]=_0x565b0f[_0xe8d6('0x32')][_0xe8d6('0x33')]?_0x565b0f['attributes']:_0x2508e7[_0xe8d6('0x2d')];if(!_0x562578['query'][_0xe8d6('0x34')]('nolimit')){_0x565b0f[_0xe8d6('0x1c')]=qs[_0xe8d6('0x1c')](_0x562578[_0xe8d6('0x2f')]['limit']);_0x565b0f[_0xe8d6('0x1a')]=qs[_0xe8d6('0x1a')](_0x562578[_0xe8d6('0x2f')][_0xe8d6('0x1a')]);}_0x565b0f[_0xe8d6('0x35')]=qs[_0xe8d6('0x36')](_0x562578['query']['sort']);_0x565b0f[_0xe8d6('0x37')]=qs[_0xe8d6('0x30')](_[_0xe8d6('0x38')](_0x562578[_0xe8d6('0x2f')],_0x2508e7['filters']),_0x27b74c);if(_0x562578[_0xe8d6('0x2f')][_0xe8d6('0x39')]){_0x565b0f[_0xe8d6('0x37')]=_['merge'](_0x565b0f['where'],{'$or':_['map'](_0x27b74c,function(_0x343e0e){if(_0x343e0e['type']!==_0xe8d6('0x3a')){var _0x4153ca={};_0x4153ca[_0x343e0e[_0xe8d6('0x26')]]={'$like':'%'+_0x562578[_0xe8d6('0x2f')]['filter']+'%'};return _0x4153ca;}})});}_0x565b0f=_[_0xe8d6('0x3b')]({},_0x565b0f,_0x562578['options']);var _0x5e8bb2={'where':_0x565b0f[_0xe8d6('0x37')]};return db[_0xe8d6('0x29')][_0xe8d6('0x1d')](_0x5e8bb2)[_0xe8d6('0x23')](function(_0x309ac3){_0x340eac['count']=_0x309ac3;if(_0x562578[_0xe8d6('0x2f')][_0xe8d6('0x3c')]){_0x565b0f[_0xe8d6('0x3d')]=[{'all':!![]}];}return db[_0xe8d6('0x29')]['findAll'](_0x565b0f);})[_0xe8d6('0x23')](function(_0x30fcbe){_0x340eac['rows']=_0x30fcbe;return _0x340eac;})[_0xe8d6('0x23')](respondWithFilteredResult(_0x287b36,_0x565b0f))[_0xe8d6('0x3e')](handleError(_0x287b36,null));};exports[_0xe8d6('0x3f')]=function(_0x1d8a85,_0x1b0ad4){var _0x1c9810={'raw':!![],'where':{'id':_0x1d8a85[_0xe8d6('0x40')]['id']}},_0x2057fc={};_0x2057fc[_0xe8d6('0x2d')]=_['keys'](db['MailServerOut'][_0xe8d6('0x41')]);_0x2057fc[_0xe8d6('0x2f')]=_[_0xe8d6('0x2e')](_0x1d8a85[_0xe8d6('0x2f')]);_0x2057fc[_0xe8d6('0x30')]=_['intersection'](_0x2057fc['model'],_0x2057fc[_0xe8d6('0x2f')]);_0x1c9810[_0xe8d6('0x32')]=_[_0xe8d6('0x31')](_0x2057fc[_0xe8d6('0x2d')],qs[_0xe8d6('0x42')](_0x1d8a85[_0xe8d6('0x2f')]['fields']));_0x1c9810[_0xe8d6('0x32')]=_0x1c9810[_0xe8d6('0x32')][_0xe8d6('0x33')]?_0x1c9810['attributes']:_0x2057fc[_0xe8d6('0x2d')];if(_0x1d8a85[_0xe8d6('0x2f')]['includeAll']){_0x1c9810[_0xe8d6('0x3d')]=[{'all':!![]}];}_0x1c9810=_[_0xe8d6('0x3b')]({},_0x1c9810,_0x1d8a85[_0xe8d6('0x43')]);return db[_0xe8d6('0x29')][_0xe8d6('0x44')](_0x1c9810)[_0xe8d6('0x23')](handleEntityNotFound(_0x1b0ad4,null))[_0xe8d6('0x23')](respondWithResult(_0x1b0ad4,null))[_0xe8d6('0x3e')](handleError(_0x1b0ad4,null));};exports[_0xe8d6('0x45')]=function(_0x4898c7,_0x30ca57){return db['MailServerOut'][_0xe8d6('0x45')](_0x4898c7['body'],{})['then'](respondWithResult(_0x30ca57,0xc9))[_0xe8d6('0x3e')](handleError(_0x30ca57,null));};exports[_0xe8d6('0x22')]=function(_0xbb1e5b,_0x23e02a){if(_0xbb1e5b[_0xe8d6('0x46')]['id']){delete _0xbb1e5b['body']['id'];}return db['MailServerOut'][_0xe8d6('0x44')]({'where':{'id':_0xbb1e5b['params']['id']}})['then'](handleEntityNotFound(_0x23e02a,null))[_0xe8d6('0x23')](saveUpdates(_0xbb1e5b[_0xe8d6('0x46')],null))[_0xe8d6('0x23')](respondWithResult(_0x23e02a,null))['catch'](handleError(_0x23e02a,null));};exports['destroy']=function(_0x29ef4c,_0x2640b1){return db[_0xe8d6('0x29')][_0xe8d6('0x44')]({'where':{'id':_0x29ef4c[_0xe8d6('0x40')]['id']}})[_0xe8d6('0x23')](handleEntityNotFound(_0x2640b1,null))[_0xe8d6('0x23')](removeEntity(_0x2640b1,null))[_0xe8d6('0x3e')](handleError(_0x2640b1,null));}; \ No newline at end of file +var _0xcae8=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','reject','update','then','destroy','sendStatus','error','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','keys','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','params','intersection','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4add39,_0x2c9474){var _0x393bd1=function(_0x38ff29){while(--_0x38ff29){_0x4add39['push'](_0x4add39['shift']());}};_0x393bd1(++_0x2c9474);}(_0xcae8,0xcf));var _0x8cae=function(_0xd31621,_0x17b567){_0xd31621=_0xd31621-0x0;var _0x2e7ac0=_0xcae8[_0xd31621];return _0x2e7ac0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cae('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cae('0x1'));var rp=require(_0x8cae('0x2'));var moment=require(_0x8cae('0x3'));var BPromise=require(_0x8cae('0x4'));var Mustache=require(_0x8cae('0x5'));var util=require('util');var path=require(_0x8cae('0x6'));var sox=require(_0x8cae('0x7'));var csv=require(_0x8cae('0x8'));var ejs=require(_0x8cae('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8cae('0xa'));var squel=require(_0x8cae('0xb'));var crypto=require(_0x8cae('0xc'));var jsforce=require(_0x8cae('0xd'));var deskjs=require(_0x8cae('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8cae('0xf'));var Papa=require(_0x8cae('0x10'));var Redis=require(_0x8cae('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8cae('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cae('0x13'));var logger=require(_0x8cae('0x14'))(_0x8cae('0x15'));var utils=require(_0x8cae('0x16'));var config=require(_0x8cae('0x17'));var licenseUtil=require(_0x8cae('0x18'));var db=require(_0x8cae('0x19'))['db'];function respondWithStatusCode(_0x3df5e8,_0x8bd9d8){_0x8bd9d8=_0x8bd9d8||0xcc;return function(_0xb4bc0e){if(_0xb4bc0e){return _0x3df5e8['sendStatus'](_0x8bd9d8);}return _0x3df5e8[_0x8cae('0x1a')](_0x8bd9d8)[_0x8cae('0x1b')]();};}function respondWithResult(_0x35577f,_0x1fb56a){_0x1fb56a=_0x1fb56a||0xc8;return function(_0x2e13eb){if(_0x2e13eb){return _0x35577f[_0x8cae('0x1a')](_0x1fb56a)[_0x8cae('0x1c')](_0x2e13eb);}};}function respondWithFilteredResult(_0x54dba7,_0x4519c2){return function(_0x25f50b){if(_0x25f50b){var _0x542ca8=typeof _0x4519c2['offset']===_0x8cae('0x1d')&&typeof _0x4519c2['limit']===_0x8cae('0x1d');var _0x4398d2=_0x25f50b[_0x8cae('0x1e')];var _0x361835=_0x542ca8?0x0:_0x4519c2['offset'];var _0x3c1d0b=_0x542ca8?_0x25f50b[_0x8cae('0x1e')]:_0x4519c2[_0x8cae('0x1f')]+_0x4519c2[_0x8cae('0x20')];var _0x461917;if(_0x3c1d0b>=_0x4398d2){_0x3c1d0b=_0x4398d2;_0x461917=0xc8;}else{_0x461917=0xce;}_0x54dba7['status'](_0x461917);return _0x54dba7['set'](_0x8cae('0x21'),_0x361835+'-'+_0x3c1d0b+'/'+_0x4398d2)['json'](_0x25f50b);}return null;};}function patchUpdates(_0x48186d){return function(_0x4cc3cb){try{jsonpatch['apply'](_0x4cc3cb,_0x48186d,!![]);}catch(_0x1bb6a9){return BPromise[_0x8cae('0x22')](_0x1bb6a9);}return _0x4cc3cb['save']();};}function saveUpdates(_0x8da8ac,_0x277897){return function(_0x1ac465){if(_0x1ac465){return _0x1ac465[_0x8cae('0x23')](_0x8da8ac)[_0x8cae('0x24')](function(_0x491790){return _0x491790;});}return null;};}function removeEntity(_0x3eac40,_0x872d56){return function(_0xd76900){if(_0xd76900){return _0xd76900[_0x8cae('0x25')]()[_0x8cae('0x24')](function(){_0x3eac40[_0x8cae('0x1a')](0xcc)[_0x8cae('0x1b')]();});}};}function handleEntityNotFound(_0x7d0fb1,_0x637eae){return function(_0x18e42e){if(!_0x18e42e){_0x7d0fb1[_0x8cae('0x26')](0x194);}return _0x18e42e;};}function handleError(_0x569e5,_0x3d432a){_0x3d432a=_0x3d432a||0x1f4;return function(_0x34268b){logger[_0x8cae('0x27')](_0x34268b['stack']);if(_0x34268b[_0x8cae('0x28')]){delete _0x34268b[_0x8cae('0x28')];}_0x569e5[_0x8cae('0x1a')](_0x3d432a)[_0x8cae('0x29')](_0x34268b);};}exports[_0x8cae('0x2a')]=function(_0x4393fd,_0x361928){var _0x73baf5={},_0x8df7a0={},_0x87ac5={'count':0x0,'rows':[]};var _0x3fd556=_[_0x8cae('0x2b')](db[_0x8cae('0x2c')][_0x8cae('0x2d')],function(_0x25aade){return{'name':_0x25aade[_0x8cae('0x2e')],'type':_0x25aade['type'][_0x8cae('0x2f')]};});_0x8df7a0['model']=_[_0x8cae('0x2b')](_0x3fd556,'name');_0x8df7a0['query']=_[_0x8cae('0x30')](_0x4393fd[_0x8cae('0x31')]);_0x8df7a0[_0x8cae('0x32')]=_['intersection'](_0x8df7a0['model'],_0x8df7a0[_0x8cae('0x31')]);_0x73baf5['attributes']=_['intersection'](_0x8df7a0[_0x8cae('0x33')],qs['fields'](_0x4393fd['query'][_0x8cae('0x34')]));_0x73baf5[_0x8cae('0x35')]=_0x73baf5[_0x8cae('0x35')][_0x8cae('0x36')]?_0x73baf5[_0x8cae('0x35')]:_0x8df7a0[_0x8cae('0x33')];if(!_0x4393fd[_0x8cae('0x31')][_0x8cae('0x37')](_0x8cae('0x38'))){_0x73baf5['limit']=qs[_0x8cae('0x20')](_0x4393fd[_0x8cae('0x31')][_0x8cae('0x20')]);_0x73baf5[_0x8cae('0x1f')]=qs[_0x8cae('0x1f')](_0x4393fd[_0x8cae('0x31')][_0x8cae('0x1f')]);}_0x73baf5['order']=qs[_0x8cae('0x39')](_0x4393fd[_0x8cae('0x31')]['sort']);_0x73baf5[_0x8cae('0x3a')]=qs[_0x8cae('0x32')](_[_0x8cae('0x3b')](_0x4393fd['query'],_0x8df7a0['filters']),_0x3fd556);if(_0x4393fd[_0x8cae('0x31')][_0x8cae('0x3c')]){_0x73baf5['where']=_[_0x8cae('0x3d')](_0x73baf5[_0x8cae('0x3a')],{'$or':_[_0x8cae('0x2b')](_0x3fd556,function(_0x1296b8){if(_0x1296b8[_0x8cae('0x3e')]!=='VIRTUAL'){var _0x4cac27={};_0x4cac27[_0x1296b8[_0x8cae('0x28')]]={'$like':'%'+_0x4393fd[_0x8cae('0x31')][_0x8cae('0x3c')]+'%'};return _0x4cac27;}})});}_0x73baf5=_[_0x8cae('0x3d')]({},_0x73baf5,_0x4393fd[_0x8cae('0x3f')]);var _0x54e97f={'where':_0x73baf5[_0x8cae('0x3a')]};return db[_0x8cae('0x2c')][_0x8cae('0x1e')](_0x54e97f)[_0x8cae('0x24')](function(_0x479f64){_0x87ac5[_0x8cae('0x1e')]=_0x479f64;if(_0x4393fd[_0x8cae('0x31')][_0x8cae('0x40')]){_0x73baf5[_0x8cae('0x41')]=[{'all':!![]}];}return db[_0x8cae('0x2c')][_0x8cae('0x42')](_0x73baf5);})['then'](function(_0x26ce2c){_0x87ac5['rows']=_0x26ce2c;return _0x87ac5;})[_0x8cae('0x24')](respondWithFilteredResult(_0x361928,_0x73baf5))[_0x8cae('0x43')](handleError(_0x361928,null));};exports[_0x8cae('0x44')]=function(_0x550567,_0xd32fc5){var _0x491a76={'raw':!![],'where':{'id':_0x550567[_0x8cae('0x45')]['id']}},_0x117ce1={};_0x117ce1[_0x8cae('0x33')]=_[_0x8cae('0x30')](db[_0x8cae('0x2c')][_0x8cae('0x2d')]);_0x117ce1[_0x8cae('0x31')]=_[_0x8cae('0x30')](_0x550567['query']);_0x117ce1['filters']=_[_0x8cae('0x46')](_0x117ce1[_0x8cae('0x33')],_0x117ce1[_0x8cae('0x31')]);_0x491a76['attributes']=_[_0x8cae('0x46')](_0x117ce1[_0x8cae('0x33')],qs[_0x8cae('0x34')](_0x550567[_0x8cae('0x31')]['fields']));_0x491a76[_0x8cae('0x35')]=_0x491a76[_0x8cae('0x35')][_0x8cae('0x36')]?_0x491a76[_0x8cae('0x35')]:_0x117ce1[_0x8cae('0x33')];if(_0x550567[_0x8cae('0x31')][_0x8cae('0x40')]){_0x491a76[_0x8cae('0x41')]=[{'all':!![]}];}_0x491a76=_[_0x8cae('0x3d')]({},_0x491a76,_0x550567[_0x8cae('0x3f')]);return db[_0x8cae('0x2c')][_0x8cae('0x47')](_0x491a76)[_0x8cae('0x24')](handleEntityNotFound(_0xd32fc5,null))[_0x8cae('0x24')](respondWithResult(_0xd32fc5,null))[_0x8cae('0x43')](handleError(_0xd32fc5,null));};exports['create']=function(_0x1af5d2,_0x590970){return db[_0x8cae('0x2c')][_0x8cae('0x48')](_0x1af5d2[_0x8cae('0x49')],{})[_0x8cae('0x24')](respondWithResult(_0x590970,0xc9))['catch'](handleError(_0x590970,null));};exports[_0x8cae('0x23')]=function(_0x50048f,_0x3117a4){if(_0x50048f[_0x8cae('0x49')]['id']){delete _0x50048f[_0x8cae('0x49')]['id'];}return db[_0x8cae('0x2c')][_0x8cae('0x47')]({'where':{'id':_0x50048f['params']['id']}})[_0x8cae('0x24')](handleEntityNotFound(_0x3117a4,null))[_0x8cae('0x24')](saveUpdates(_0x50048f[_0x8cae('0x49')],null))[_0x8cae('0x24')](respondWithResult(_0x3117a4,null))[_0x8cae('0x43')](handleError(_0x3117a4,null));};exports[_0x8cae('0x25')]=function(_0xc3fe9b,_0x17336e){return db['MailServerOut'][_0x8cae('0x47')]({'where':{'id':_0xc3fe9b[_0x8cae('0x45')]['id']}})[_0x8cae('0x24')](handleEntityNotFound(_0x17336e,null))[_0x8cae('0x24')](removeEntity(_0x17336e,null))[_0x8cae('0x43')](handleError(_0x17336e,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 299ca34..a292c85 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 _0x06c0=['./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x362adb,_0x481786){var _0x4d66e4=function(_0x5ad228){while(--_0x5ad228){_0x362adb['push'](_0x362adb['shift']());}};_0x4d66e4(++_0x481786);}(_0x06c0,0x1d2));var _0x006c=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x06c0[_0x29b609];return _0x54c952;};'use strict';var _=require('lodash');var util=require(_0x006c('0x0'));var logger=require(_0x006c('0x1'))(_0x006c('0x2'));var moment=require(_0x006c('0x3'));var BPromise=require(_0x006c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x006c('0x5'));var rimraf=require(_0x006c('0x6'));var config=require('../../config/environment');var attributes=require(_0x006c('0x7'));module[_0x006c('0x8')]=function(_0xd1bb61,_0x48e600){return _0xd1bb61['define'](_0x006c('0x9'),attributes,{'tableName':_0x006c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46c7=['../../config/environment','./mailServerOut.attributes','MailServerOut','mail_servers_out','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x3f2ecf,_0x4ccad6){var _0xa6dd7e=function(_0x5e04c3){while(--_0x5e04c3){_0x3f2ecf['push'](_0x3f2ecf['shift']());}};_0xa6dd7e(++_0x4ccad6);}(_0x46c7,0x138));var _0x746c=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x46c7[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x746c('0x0'));var util=require(_0x746c('0x1'));var logger=require(_0x746c('0x2'))('api');var moment=require(_0x746c('0x3'));var BPromise=require('bluebird');var rp=require(_0x746c('0x4'));var fs=require('fs');var path=require(_0x746c('0x5'));var rimraf=require(_0x746c('0x6'));var config=require(_0x746c('0x7'));var attributes=require(_0x746c('0x8'));module['exports']=function(_0x585360,_0x4b00b4){return _0x585360['define'](_0x746c('0x9'),attributes,{'tableName':_0x746c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 16d0a20..2c24415 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4ed239,_0x3bb2d8){var _0x19b898=function(_0x302fe8){while(--_0x302fe8){_0x4ed239['push'](_0x4ed239['shift']());}};_0x19b898(++_0x3bb2d8);}(_0x2ef3,0xba));var _0x32ef=function(_0x4415b2,_0x2424cf){_0x4415b2=_0x4415b2-0x0;var _0x8a4fdb=_0x2ef3[_0x4415b2];return _0x8a4fdb;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x50514b,_0x83db65){var _0x5d8587=function(_0x327ba5){while(--_0x327ba5){_0x50514b['push'](_0x50514b['shift']());}};_0x5d8587(++_0x83db65);}(_0xadb5,0xad));var _0x5adb=function(_0x152b2c,_0x432f2e){_0x152b2c=_0x152b2c-0x0;var _0x4d13c1=_0xadb5[_0x152b2c];return _0x4d13c1;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 61a6224..8a736d6 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 _0x4405=['/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','show','post'];(function(_0x1a55b1,_0x96ec8b){var _0x3ba4b0=function(_0x1f37b9){while(--_0x1f37b9){_0x1a55b1['push'](_0x1a55b1['shift']());}};_0x3ba4b0(++_0x96ec8b);}(_0x4405,0x64));var _0x5440=function(_0x4c05ee,_0x10d59c){_0x4c05ee=_0x4c05ee-0x0;var _0x438118=_0x4405[_0x4c05ee];return _0x438118;};'use strict';var multer=require(_0x5440('0x0'));var util=require(_0x5440('0x1'));var path=require('path');var timeout=require(_0x5440('0x2'));var express=require(_0x5440('0x3'));var router=express[_0x5440('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5440('0x5'));var config=require(_0x5440('0x6'));var controller=require(_0x5440('0x7'));router[_0x5440('0x8')]('/',auth[_0x5440('0x9')](),controller[_0x5440('0xa')]);router[_0x5440('0x8')](_0x5440('0xb'),auth[_0x5440('0x9')](),controller['describe']);router[_0x5440('0x8')]('/:id',auth[_0x5440('0x9')](),controller[_0x5440('0xc')]);router[_0x5440('0xd')]('/',auth[_0x5440('0x9')](),controller['create']);router['put'](_0x5440('0xe'),auth[_0x5440('0x9')](),controller[_0x5440('0xf')]);router[_0x5440('0x10')]('/:id',auth[_0x5440('0x9')](),controller[_0x5440('0x11')]);module[_0x5440('0x12')]=router; \ No newline at end of file +var _0x5219=['destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete'];(function(_0xbced6b,_0x3aa946){var _0x22e543=function(_0x10609e){while(--_0x10609e){_0xbced6b['push'](_0xbced6b['shift']());}};_0x22e543(++_0x3aa946);}(_0x5219,0x17d));var _0x9521=function(_0x561aeb,_0x50082a){_0x561aeb=_0x561aeb-0x0;var _0x2d036e=_0x5219[_0x561aeb];return _0x2d036e;};'use strict';var multer=require(_0x9521('0x0'));var util=require('util');var path=require(_0x9521('0x1'));var timeout=require(_0x9521('0x2'));var express=require('express');var router=express[_0x9521('0x3')]();var fs_extra=require(_0x9521('0x4'));var auth=require(_0x9521('0x5'));var interaction=require(_0x9521('0x6'));var config=require(_0x9521('0x7'));var controller=require(_0x9521('0x8'));router[_0x9521('0x9')]('/',auth[_0x9521('0xa')](),controller[_0x9521('0xb')]);router['get'](_0x9521('0xc'),auth['isAuthenticated'](),controller[_0x9521('0xd')]);router['get'](_0x9521('0xe'),auth['isAuthenticated'](),controller[_0x9521('0xf')]);router['post']('/',auth[_0x9521('0xa')](),controller[_0x9521('0x10')]);router[_0x9521('0x11')](_0x9521('0xe'),auth[_0x9521('0xa')](),controller['update']);router[_0x9521('0x12')](_0x9521('0xe'),auth['isAuthenticated'](),controller[_0x9521('0x13')]);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 fee0117..0158bd4 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 _0x02a7=['exports','STRING'];(function(_0x28edda,_0xbd447a){var _0x21f4a4=function(_0x5ae05e){while(--_0x5ae05e){_0x28edda['push'](_0x28edda['shift']());}};_0x21f4a4(++_0xbd447a);}(_0x02a7,0x7a));var _0x702a=function(_0xb6cb17,_0x468c5c){_0xb6cb17=_0xb6cb17-0x0;var _0x5292db=_0x02a7[_0xb6cb17];return _0x5292db;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x702a('0x1')]}}; \ No newline at end of file +var _0xa1f6=['name','sequelize','exports','STRING'];(function(_0x1cdb2d,_0x8f1f76){var _0x4dafe3=function(_0xec694e){while(--_0xec694e){_0x1cdb2d['push'](_0x1cdb2d['shift']());}};_0x4dafe3(++_0x8f1f76);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x1486e5,_0x39684f){_0x1486e5=_0x1486e5-0x0;var _0x29d89b=_0xa1f6[_0x1486e5];return _0x29d89b;};'use strict';var Sequelize=require(_0x6a1f('0x0'));module[_0x6a1f('0x1')]={'name':{'type':Sequelize[_0x6a1f('0x2')],'unique':_0x6a1f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6a1f('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 5cee285..051b402 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 _0xa946=['includeAll','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','save','update','destroy','error','stack','name','send','index','map','MailSubstatus','fieldName','key','model','keys','query','filters','intersection','fields','length','attributes','sort','where','merge','type','VIRTUAL','filter','options','count','then','findAll','rows','catch','show','rawAttributes'];(function(_0x10db9a,_0x537876){var _0x3fbae0=function(_0x35f276){while(--_0x35f276){_0x10db9a['push'](_0x10db9a['shift']());}};_0x3fbae0(++_0x537876);}(_0xa946,0x17e));var _0x6a94=function(_0x356312,_0x4e93b7){_0x356312=_0x356312-0x0;var _0x1b1055=_0xa946[_0x356312];return _0x1b1055;};'use strict';var emlformat=require(_0x6a94('0x0'));var rimraf=require(_0x6a94('0x1'));var zipdir=require(_0x6a94('0x2'));var jsonpatch=require(_0x6a94('0x3'));var rp=require(_0x6a94('0x4'));var moment=require(_0x6a94('0x5'));var BPromise=require(_0x6a94('0x6'));var Mustache=require(_0x6a94('0x7'));var util=require(_0x6a94('0x8'));var path=require(_0x6a94('0x9'));var sox=require(_0x6a94('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a94('0xb'));var squel=require('squel');var crypto=require(_0x6a94('0xc'));var jsforce=require(_0x6a94('0xd'));var deskjs=require(_0x6a94('0xe'));var toCsv=require(_0x6a94('0xf'));var querystring=require(_0x6a94('0x10'));var Papa=require(_0x6a94('0x11'));var Redis=require(_0x6a94('0x12'));var authService=require(_0x6a94('0x13'));var qs=require(_0x6a94('0x14'));var as=require(_0x6a94('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a94('0x16'))(_0x6a94('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6a94('0x18'))['db'];function respondWithStatusCode(_0x54a75e,_0x7c5e9c){_0x7c5e9c=_0x7c5e9c||0xcc;return function(_0x4d6098){if(_0x4d6098){return _0x54a75e[_0x6a94('0x19')](_0x7c5e9c);}return _0x54a75e['status'](_0x7c5e9c)[_0x6a94('0x1a')]();};}function respondWithResult(_0x125b21,_0x5c2220){_0x5c2220=_0x5c2220||0xc8;return function(_0x63bc7){if(_0x63bc7){return _0x125b21[_0x6a94('0x1b')](_0x5c2220)[_0x6a94('0x1c')](_0x63bc7);}};}function respondWithFilteredResult(_0x2b865d,_0x5646f9){return function(_0x11b55e){if(_0x11b55e){var _0x51bbb6=typeof _0x5646f9[_0x6a94('0x1d')]===_0x6a94('0x1e')&&typeof _0x5646f9[_0x6a94('0x1f')]===_0x6a94('0x1e');var _0x140212=_0x11b55e['count'];var _0x21a783=_0x51bbb6?0x0:_0x5646f9[_0x6a94('0x1d')];var _0x1b181b=_0x51bbb6?_0x11b55e['count']:_0x5646f9[_0x6a94('0x1d')]+_0x5646f9['limit'];var _0x495ecd;if(_0x1b181b>=_0x140212){_0x1b181b=_0x140212;_0x495ecd=0xc8;}else{_0x495ecd=0xce;}_0x2b865d['status'](_0x495ecd);return _0x2b865d['set'](_0x6a94('0x20'),_0x21a783+'-'+_0x1b181b+'/'+_0x140212)[_0x6a94('0x1c')](_0x11b55e);}return null;};}function patchUpdates(_0x5a9d8e){return function(_0x2a28bf){try{jsonpatch[_0x6a94('0x21')](_0x2a28bf,_0x5a9d8e,!![]);}catch(_0x25d034){return BPromise['reject'](_0x25d034);}return _0x2a28bf[_0x6a94('0x22')]();};}function saveUpdates(_0x21b52f,_0x18b382){return function(_0xae0df3){if(_0xae0df3){return _0xae0df3[_0x6a94('0x23')](_0x21b52f)['then'](function(_0xf645db){return _0xf645db;});}return null;};}function removeEntity(_0x4ad7bf,_0x32b8d0){return function(_0x134475){if(_0x134475){return _0x134475[_0x6a94('0x24')]()['then'](function(){_0x4ad7bf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c2f10,_0x401afb){return function(_0x431999){if(!_0x431999){_0x4c2f10[_0x6a94('0x19')](0x194);}return _0x431999;};}function handleError(_0x1c74b3,_0x2c6d78){_0x2c6d78=_0x2c6d78||0x1f4;return function(_0x4ac8bf){logger[_0x6a94('0x25')](_0x4ac8bf[_0x6a94('0x26')]);if(_0x4ac8bf[_0x6a94('0x27')]){delete _0x4ac8bf[_0x6a94('0x27')];}_0x1c74b3['status'](_0x2c6d78)[_0x6a94('0x28')](_0x4ac8bf);};}exports[_0x6a94('0x29')]=function(_0x4eca32,_0x1723f5){var _0x55f2a5={},_0x33b8fd={},_0x406c12={'count':0x0,'rows':[]};var _0xd3d2d1=_[_0x6a94('0x2a')](db[_0x6a94('0x2b')]['rawAttributes'],function(_0xb98248){return{'name':_0xb98248[_0x6a94('0x2c')],'type':_0xb98248['type'][_0x6a94('0x2d')]};});_0x33b8fd[_0x6a94('0x2e')]=_[_0x6a94('0x2a')](_0xd3d2d1,_0x6a94('0x27'));_0x33b8fd['query']=_[_0x6a94('0x2f')](_0x4eca32[_0x6a94('0x30')]);_0x33b8fd[_0x6a94('0x31')]=_['intersection'](_0x33b8fd[_0x6a94('0x2e')],_0x33b8fd[_0x6a94('0x30')]);_0x55f2a5['attributes']=_[_0x6a94('0x32')](_0x33b8fd[_0x6a94('0x2e')],qs[_0x6a94('0x33')](_0x4eca32['query'][_0x6a94('0x33')]));_0x55f2a5['attributes']=_0x55f2a5['attributes'][_0x6a94('0x34')]?_0x55f2a5[_0x6a94('0x35')]:_0x33b8fd[_0x6a94('0x2e')];if(!_0x4eca32[_0x6a94('0x30')]['hasOwnProperty']('nolimit')){_0x55f2a5[_0x6a94('0x1f')]=qs[_0x6a94('0x1f')](_0x4eca32[_0x6a94('0x30')][_0x6a94('0x1f')]);_0x55f2a5[_0x6a94('0x1d')]=qs[_0x6a94('0x1d')](_0x4eca32[_0x6a94('0x30')]['offset']);}_0x55f2a5['order']=qs[_0x6a94('0x36')](_0x4eca32[_0x6a94('0x30')][_0x6a94('0x36')]);_0x55f2a5[_0x6a94('0x37')]=qs[_0x6a94('0x31')](_['pick'](_0x4eca32[_0x6a94('0x30')],_0x33b8fd[_0x6a94('0x31')]),_0xd3d2d1);if(_0x4eca32[_0x6a94('0x30')]['filter']){_0x55f2a5[_0x6a94('0x37')]=_[_0x6a94('0x38')](_0x55f2a5['where'],{'$or':_['map'](_0xd3d2d1,function(_0x54378c){if(_0x54378c[_0x6a94('0x39')]!==_0x6a94('0x3a')){var _0x499fa4={};_0x499fa4[_0x54378c[_0x6a94('0x27')]]={'$like':'%'+_0x4eca32[_0x6a94('0x30')][_0x6a94('0x3b')]+'%'};return _0x499fa4;}})});}_0x55f2a5=_[_0x6a94('0x38')]({},_0x55f2a5,_0x4eca32[_0x6a94('0x3c')]);var _0x4d6f7c={'where':_0x55f2a5[_0x6a94('0x37')]};return db[_0x6a94('0x2b')][_0x6a94('0x3d')](_0x4d6f7c)[_0x6a94('0x3e')](function(_0xa90d74){_0x406c12[_0x6a94('0x3d')]=_0xa90d74;if(_0x4eca32[_0x6a94('0x30')]['includeAll']){_0x55f2a5['include']=[{'all':!![]}];}return db[_0x6a94('0x2b')][_0x6a94('0x3f')](_0x55f2a5);})[_0x6a94('0x3e')](function(_0x317a50){_0x406c12[_0x6a94('0x40')]=_0x317a50;return _0x406c12;})['then'](respondWithFilteredResult(_0x1723f5,_0x55f2a5))[_0x6a94('0x41')](handleError(_0x1723f5,null));};exports[_0x6a94('0x42')]=function(_0x5d86be,_0x53115f){var _0x36f5b9={'raw':!![],'where':{'id':_0x5d86be['params']['id']}},_0x916a47={};_0x916a47['model']=_[_0x6a94('0x2f')](db[_0x6a94('0x2b')][_0x6a94('0x43')]);_0x916a47[_0x6a94('0x30')]=_[_0x6a94('0x2f')](_0x5d86be[_0x6a94('0x30')]);_0x916a47[_0x6a94('0x31')]=_['intersection'](_0x916a47[_0x6a94('0x2e')],_0x916a47[_0x6a94('0x30')]);_0x36f5b9[_0x6a94('0x35')]=_[_0x6a94('0x32')](_0x916a47[_0x6a94('0x2e')],qs[_0x6a94('0x33')](_0x5d86be[_0x6a94('0x30')][_0x6a94('0x33')]));_0x36f5b9[_0x6a94('0x35')]=_0x36f5b9['attributes'][_0x6a94('0x34')]?_0x36f5b9[_0x6a94('0x35')]:_0x916a47[_0x6a94('0x2e')];if(_0x5d86be[_0x6a94('0x30')][_0x6a94('0x44')]){_0x36f5b9[_0x6a94('0x45')]=[{'all':!![]}];}_0x36f5b9=_[_0x6a94('0x38')]({},_0x36f5b9,_0x5d86be[_0x6a94('0x3c')]);return db[_0x6a94('0x2b')][_0x6a94('0x46')](_0x36f5b9)['then'](handleEntityNotFound(_0x53115f,null))[_0x6a94('0x3e')](respondWithResult(_0x53115f,null))['catch'](handleError(_0x53115f,null));};exports['create']=function(_0x3ccbcd,_0x2bdffe){return db[_0x6a94('0x2b')][_0x6a94('0x47')](_0x3ccbcd[_0x6a94('0x48')],{})[_0x6a94('0x3e')](respondWithResult(_0x2bdffe,0xc9))[_0x6a94('0x41')](handleError(_0x2bdffe,null));};exports[_0x6a94('0x23')]=function(_0x352d2d,_0x1120a0){if(_0x352d2d[_0x6a94('0x48')]['id']){delete _0x352d2d['body']['id'];}return db[_0x6a94('0x2b')][_0x6a94('0x46')]({'where':{'id':_0x352d2d[_0x6a94('0x49')]['id']}})[_0x6a94('0x3e')](handleEntityNotFound(_0x1120a0,null))[_0x6a94('0x3e')](saveUpdates(_0x352d2d[_0x6a94('0x48')],null))['then'](respondWithResult(_0x1120a0,null))[_0x6a94('0x41')](handleError(_0x1120a0,null));};exports[_0x6a94('0x24')]=function(_0x594b6e,_0x755090){return db[_0x6a94('0x2b')]['find']({'where':{'id':_0x594b6e[_0x6a94('0x49')]['id']}})[_0x6a94('0x3e')](handleEntityNotFound(_0x755090,null))['then'](removeEntity(_0x755090,null))['catch'](handleError(_0x755090,null));};exports[_0x6a94('0x4a')]=function(_0x4e1041,_0x3cb410){return db[_0x6a94('0x2b')][_0x6a94('0x4a')]()[_0x6a94('0x3e')](respondWithResult(_0x3cb410,null))[_0x6a94('0x41')](handleError(_0x3cb410,null));}; \ No newline at end of file +var _0x46d9=['offset','undefined','count','apply','reject','update','then','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','catch','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0x46d9,0xc4));var _0x946d=function(_0x5e9142,_0x29abc0){_0x5e9142=_0x5e9142-0x0;var _0x4763e2=_0x46d9[_0x5e9142];return _0x4763e2;};'use strict';var emlformat=require(_0x946d('0x0'));var rimraf=require(_0x946d('0x1'));var zipdir=require(_0x946d('0x2'));var jsonpatch=require(_0x946d('0x3'));var rp=require(_0x946d('0x4'));var moment=require('moment');var BPromise=require(_0x946d('0x5'));var Mustache=require(_0x946d('0x6'));var util=require(_0x946d('0x7'));var path=require(_0x946d('0x8'));var sox=require(_0x946d('0x9'));var csv=require(_0x946d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x946d('0xb'));var _=require(_0x946d('0xc'));var squel=require(_0x946d('0xd'));var crypto=require(_0x946d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x946d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x946d('0x10'));var Papa=require(_0x946d('0x11'));var Redis=require(_0x946d('0x12'));var authService=require(_0x946d('0x13'));var qs=require(_0x946d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x946d('0x15'))(_0x946d('0x16'));var utils=require(_0x946d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x946d('0x18'));var db=require(_0x946d('0x19'))['db'];function respondWithStatusCode(_0x4258a0,_0x557b1b){_0x557b1b=_0x557b1b||0xcc;return function(_0x1100cb){if(_0x1100cb){return _0x4258a0[_0x946d('0x1a')](_0x557b1b);}return _0x4258a0[_0x946d('0x1b')](_0x557b1b)[_0x946d('0x1c')]();};}function respondWithResult(_0x361d6d,_0x2e068b){_0x2e068b=_0x2e068b||0xc8;return function(_0x2b5381){if(_0x2b5381){return _0x361d6d['status'](_0x2e068b)['json'](_0x2b5381);}};}function respondWithFilteredResult(_0x236758,_0x40c9d6){return function(_0x1d6dba){if(_0x1d6dba){var _0x4b3f86=typeof _0x40c9d6[_0x946d('0x1d')]==='undefined'&&typeof _0x40c9d6['limit']===_0x946d('0x1e');var _0x5d6392=_0x1d6dba[_0x946d('0x1f')];var _0x12b87a=_0x4b3f86?0x0:_0x40c9d6[_0x946d('0x1d')];var _0x5f4849=_0x4b3f86?_0x1d6dba['count']:_0x40c9d6['offset']+_0x40c9d6['limit'];var _0x57e1dc;if(_0x5f4849>=_0x5d6392){_0x5f4849=_0x5d6392;_0x57e1dc=0xc8;}else{_0x57e1dc=0xce;}_0x236758[_0x946d('0x1b')](_0x57e1dc);return _0x236758['set']('Content-Range',_0x12b87a+'-'+_0x5f4849+'/'+_0x5d6392)['json'](_0x1d6dba);}return null;};}function patchUpdates(_0x228e76){return function(_0x367dc2){try{jsonpatch[_0x946d('0x20')](_0x367dc2,_0x228e76,!![]);}catch(_0xf563ac){return BPromise[_0x946d('0x21')](_0xf563ac);}return _0x367dc2['save']();};}function saveUpdates(_0x49d9ec,_0x4052a7){return function(_0x366ff3){if(_0x366ff3){return _0x366ff3[_0x946d('0x22')](_0x49d9ec)['then'](function(_0x1bc435){return _0x1bc435;});}return null;};}function removeEntity(_0x1c6520,_0x3eec0f){return function(_0x34051f){if(_0x34051f){return _0x34051f['destroy']()[_0x946d('0x23')](function(){_0x1c6520[_0x946d('0x1b')](0xcc)[_0x946d('0x1c')]();});}};}function handleEntityNotFound(_0x216e10,_0x430a9c){return function(_0x465c2d){if(!_0x465c2d){_0x216e10[_0x946d('0x1a')](0x194);}return _0x465c2d;};}function handleError(_0x3ba1b1,_0x19d424){_0x19d424=_0x19d424||0x1f4;return function(_0x5ba5e1){logger[_0x946d('0x24')](_0x5ba5e1[_0x946d('0x25')]);if(_0x5ba5e1[_0x946d('0x26')]){delete _0x5ba5e1[_0x946d('0x26')];}_0x3ba1b1[_0x946d('0x1b')](_0x19d424)[_0x946d('0x27')](_0x5ba5e1);};}exports[_0x946d('0x28')]=function(_0x7cc0,_0x18f2d5){var _0x503ef6={},_0x64ad19={},_0x5a1c0b={'count':0x0,'rows':[]};var _0x18cbf9=_['map'](db[_0x946d('0x29')][_0x946d('0x2a')],function(_0x156736){return{'name':_0x156736[_0x946d('0x2b')],'type':_0x156736[_0x946d('0x2c')][_0x946d('0x2d')]};});_0x64ad19[_0x946d('0x2e')]=_[_0x946d('0x2f')](_0x18cbf9,_0x946d('0x26'));_0x64ad19['query']=_[_0x946d('0x30')](_0x7cc0['query']);_0x64ad19['filters']=_[_0x946d('0x31')](_0x64ad19[_0x946d('0x2e')],_0x64ad19[_0x946d('0x32')]);_0x503ef6[_0x946d('0x33')]=_[_0x946d('0x31')](_0x64ad19['model'],qs[_0x946d('0x34')](_0x7cc0[_0x946d('0x32')]['fields']));_0x503ef6['attributes']=_0x503ef6[_0x946d('0x33')][_0x946d('0x35')]?_0x503ef6[_0x946d('0x33')]:_0x64ad19[_0x946d('0x2e')];if(!_0x7cc0[_0x946d('0x32')][_0x946d('0x36')](_0x946d('0x37'))){_0x503ef6[_0x946d('0x38')]=qs['limit'](_0x7cc0[_0x946d('0x32')]['limit']);_0x503ef6[_0x946d('0x1d')]=qs[_0x946d('0x1d')](_0x7cc0[_0x946d('0x32')][_0x946d('0x1d')]);}_0x503ef6[_0x946d('0x39')]=qs[_0x946d('0x3a')](_0x7cc0[_0x946d('0x32')][_0x946d('0x3a')]);_0x503ef6[_0x946d('0x3b')]=qs[_0x946d('0x3c')](_[_0x946d('0x3d')](_0x7cc0[_0x946d('0x32')],_0x64ad19[_0x946d('0x3c')]),_0x18cbf9);if(_0x7cc0[_0x946d('0x32')][_0x946d('0x3e')]){_0x503ef6[_0x946d('0x3b')]=_[_0x946d('0x3f')](_0x503ef6[_0x946d('0x3b')],{'$or':_[_0x946d('0x2f')](_0x18cbf9,function(_0x2cf1ff){if(_0x2cf1ff[_0x946d('0x2c')]!=='VIRTUAL'){var _0x34eb2c={};_0x34eb2c[_0x2cf1ff['name']]={'$like':'%'+_0x7cc0[_0x946d('0x32')][_0x946d('0x3e')]+'%'};return _0x34eb2c;}})});}_0x503ef6=_[_0x946d('0x3f')]({},_0x503ef6,_0x7cc0[_0x946d('0x40')]);var _0x593083={'where':_0x503ef6[_0x946d('0x3b')]};return db[_0x946d('0x29')]['count'](_0x593083)[_0x946d('0x23')](function(_0x405299){_0x5a1c0b[_0x946d('0x1f')]=_0x405299;if(_0x7cc0[_0x946d('0x32')][_0x946d('0x41')]){_0x503ef6['include']=[{'all':!![]}];}return db[_0x946d('0x29')][_0x946d('0x42')](_0x503ef6);})[_0x946d('0x23')](function(_0x1d4850){_0x5a1c0b['rows']=_0x1d4850;return _0x5a1c0b;})[_0x946d('0x23')](respondWithFilteredResult(_0x18f2d5,_0x503ef6))[_0x946d('0x43')](handleError(_0x18f2d5,null));};exports['show']=function(_0x51bfd3,_0x12de7a){var _0x46f80f={'raw':!![],'where':{'id':_0x51bfd3[_0x946d('0x44')]['id']}},_0x13fe87={};_0x13fe87[_0x946d('0x2e')]=_['keys'](db['MailSubstatus']['rawAttributes']);_0x13fe87[_0x946d('0x32')]=_[_0x946d('0x30')](_0x51bfd3[_0x946d('0x32')]);_0x13fe87[_0x946d('0x3c')]=_[_0x946d('0x31')](_0x13fe87['model'],_0x13fe87['query']);_0x46f80f[_0x946d('0x33')]=_['intersection'](_0x13fe87[_0x946d('0x2e')],qs[_0x946d('0x34')](_0x51bfd3[_0x946d('0x32')][_0x946d('0x34')]));_0x46f80f[_0x946d('0x33')]=_0x46f80f['attributes'][_0x946d('0x35')]?_0x46f80f[_0x946d('0x33')]:_0x13fe87[_0x946d('0x2e')];if(_0x51bfd3[_0x946d('0x32')][_0x946d('0x41')]){_0x46f80f[_0x946d('0x45')]=[{'all':!![]}];}_0x46f80f=_[_0x946d('0x3f')]({},_0x46f80f,_0x51bfd3[_0x946d('0x40')]);return db['MailSubstatus'][_0x946d('0x46')](_0x46f80f)[_0x946d('0x23')](handleEntityNotFound(_0x12de7a,null))[_0x946d('0x23')](respondWithResult(_0x12de7a,null))[_0x946d('0x43')](handleError(_0x12de7a,null));};exports['create']=function(_0x39294f,_0x35f25e){return db['MailSubstatus'][_0x946d('0x47')](_0x39294f['body'],{})[_0x946d('0x23')](respondWithResult(_0x35f25e,0xc9))[_0x946d('0x43')](handleError(_0x35f25e,null));};exports['update']=function(_0x11a63b,_0x462e86){if(_0x11a63b['body']['id']){delete _0x11a63b[_0x946d('0x48')]['id'];}return db[_0x946d('0x29')]['find']({'where':{'id':_0x11a63b[_0x946d('0x44')]['id']}})[_0x946d('0x23')](handleEntityNotFound(_0x462e86,null))[_0x946d('0x23')](saveUpdates(_0x11a63b['body'],null))['then'](respondWithResult(_0x462e86,null))[_0x946d('0x43')](handleError(_0x462e86,null));};exports[_0x946d('0x49')]=function(_0x3be90b,_0x2030f8){return db[_0x946d('0x29')][_0x946d('0x46')]({'where':{'id':_0x3be90b[_0x946d('0x44')]['id']}})[_0x946d('0x23')](handleEntityNotFound(_0x2030f8,null))[_0x946d('0x23')](removeEntity(_0x2030f8,null))[_0x946d('0x43')](handleError(_0x2030f8,null));};exports[_0x946d('0x4a')]=function(_0x94347b,_0x4ca4eb){return db['MailSubstatus'][_0x946d('0x4a')]()[_0x946d('0x23')](respondWithResult(_0x4ca4eb,null))[_0x946d('0x43')](handleError(_0x4ca4eb,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index d132504..785858a 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 _0x37bb=['setMaxListeners','update','emit','hasOwnProperty','hook','events','MailSubstatus'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x37bb,0x171));var _0xb37b=function(_0x1587f8,_0x4fb948){_0x1587f8=_0x1587f8-0x0;var _0x3b080e=_0x37bb[_0x1587f8];return _0x3b080e;};'use strict';var EventEmitter=require(_0xb37b('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xb37b('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xb37b('0x2')](0x0);var events={'afterUpdate':_0xb37b('0x3')};function emitEvent(_0x4a20f8){return function(_0x408183,_0x801b22,_0xf6ad61){MailSubstatusEvents[_0xb37b('0x4')](_0x4a20f8+':'+_0x408183['id'],_0x408183);MailSubstatusEvents[_0xb37b('0x4')](_0x4a20f8,_0x408183);_0xf6ad61(null);};}for(var e in events){if(events[_0xb37b('0x5')](e)){var event=events[e];MailSubstatus[_0xb37b('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x71c6=['emit','hasOwnProperty','hook','exports','events','MailSubstatus','setMaxListeners','update'];(function(_0x44a72d,_0x3b4c6c){var _0x515d3c=function(_0x2177a4){while(--_0x2177a4){_0x44a72d['push'](_0x44a72d['shift']());}};_0x515d3c(++_0x3b4c6c);}(_0x71c6,0x14c));var _0x671c=function(_0x289747,_0x2af673){_0x289747=_0x289747-0x0;var _0x106987=_0x71c6[_0x289747];return _0x106987;};'use strict';var EventEmitter=require(_0x671c('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x671c('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x671c('0x2')](0x0);var events={'afterUpdate':_0x671c('0x3')};function emitEvent(_0xb0300c){return function(_0x1f5381,_0xc64b46,_0x2693c7){MailSubstatusEvents['emit'](_0xb0300c+':'+_0x1f5381['id'],_0x1f5381);MailSubstatusEvents[_0x671c('0x4')](_0xb0300c,_0x1f5381);_0x2693c7(null);};}for(var e in events){if(events[_0x671c('0x5')](e)){var event=events[e];MailSubstatus[_0x671c('0x6')](e,emitEvent(event));}}module[_0x671c('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index a971e9d..41b7d8b 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 _0xbbe1=['_previousDataValues','catch','exports','models','MailSubstatus','Condition','update','name'];(function(_0x47e9d9,_0x3e4e54){var _0xd000e=function(_0x3746a0){while(--_0x3746a0){_0x47e9d9['push'](_0x47e9d9['shift']());}};_0xd000e(++_0x3e4e54);}(_0xbbe1,0x11a));var _0x1bbe=function(_0x5ee71e,_0x28e6bf){_0x5ee71e=_0x5ee71e-0x0;var _0x1675b1=_0xbbe1[_0x5ee71e];return _0x1675b1;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x1bbe('0x0')]=function(_0x5679f2){var _0x2d1318=_0x5679f2[_0x1bbe('0x1')];return _0x5679f2['define'](_0x1bbe('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x34601b,_0x1ec624,_0x5927fa){return _0x2d1318[_0x1bbe('0x3')][_0x1bbe('0x4')]({'value':_0x34601b[_0x1bbe('0x5')]},{'where':{'field':'mailSubstatus','value':_0x34601b[_0x1bbe('0x6')][_0x1bbe('0x5')]}})['then'](function(){_0x5927fa();})[_0x1bbe('0x7')](function(_0x3409c5){_0x5927fa(_0x3409c5);});}}});}; \ No newline at end of file +var _0xa365=['then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','update','_previousDataValues','name'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xa365,0x1d6));var _0x5a36=function(_0xe798c,_0xc970b5){_0xe798c=_0xe798c-0x0;var _0xe121b5=_0xa365[_0xe798c];return _0xe121b5;};'use strict';var attributes=require(_0x5a36('0x0'));module[_0x5a36('0x1')]=function(_0x45882e){var _0x37c368=_0x45882e[_0x5a36('0x2')];return _0x45882e[_0x5a36('0x3')](_0x5a36('0x4'),attributes,{'tableName':_0x5a36('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x59a4bd,_0x568c3b,_0x860172){return _0x37c368[_0x5a36('0x6')][_0x5a36('0x7')]({'value':_0x59a4bd['name']},{'where':{'field':'mailSubstatus','value':_0x59a4bd[_0x5a36('0x8')][_0x5a36('0x9')]}})[_0x5a36('0xa')](function(){_0x860172();})[_0x5a36('0xb')](function(_0x3097ee){_0x860172(_0x3097ee);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 0ee3e3b..a02cfce 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 _0x6bf6=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error'];(function(_0x4dd524,_0x2247e5){var _0x482629=function(_0x1fc3a0){while(--_0x1fc3a0){_0x4dd524['push'](_0x4dd524['shift']());}};_0x482629(++_0x2247e5);}(_0x6bf6,0x11c));var _0x66bf=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x6bf6[_0x2f9467];return _0x39894c;};'use strict';var _=require(_0x66bf('0x0'));var util=require(_0x66bf('0x1'));var moment=require(_0x66bf('0x2'));var BPromise=require('bluebird');var rs=require(_0x66bf('0x3'));var fs=require('fs');var Redis=require(_0x66bf('0x4'));var db=require(_0x66bf('0x5'))['db'];var utils=require(_0x66bf('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x66bf('0x7'));var client=jayson[_0x66bf('0x8')][_0x66bf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1550cb,_0x2fe224,_0x44745f){return new BPromise(function(_0xc88849,_0x5968ea){return client[_0x66bf('0xa')](_0x1550cb,_0x44745f)['then'](function(_0x3323cd){logger['info'](_0x66bf('0xb'),_0x2fe224,_0x66bf('0xc'));logger[_0x66bf('0xd')](_0x66bf('0xe'),_0x2fe224,'request\x20sent',JSON['stringify'](_0x3323cd));if(_0x3323cd[_0x66bf('0xf')]){if(_0x3323cd[_0x66bf('0xf')]['code']===0x1f4){logger[_0x66bf('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x2fe224,_0x3323cd[_0x66bf('0xf')]['message']);return _0x5968ea(_0x3323cd[_0x66bf('0xf')][_0x66bf('0x10')]);}logger[_0x66bf('0xf')](_0x66bf('0xb'),_0x2fe224,_0x3323cd[_0x66bf('0xf')][_0x66bf('0x10')]);return _0xc88849(_0x3323cd[_0x66bf('0xf')][_0x66bf('0x10')]);}else{logger[_0x66bf('0x11')](_0x66bf('0xb'),_0x2fe224,_0x66bf('0xc'));_0xc88849(_0x3323cd[_0x66bf('0x12')][_0x66bf('0x10')]);}})[_0x66bf('0x13')](function(_0x292551){logger['error'](_0x66bf('0xb'),_0x2fe224,_0x292551);_0x5968ea(_0x292551);});});} \ No newline at end of file +var _0x7816=['jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xddc012,_0x5cf07a){var _0x395581=function(_0x483e9d){while(--_0x483e9d){_0xddc012['push'](_0xddc012['shift']());}};_0x395581(++_0x5cf07a);}(_0x7816,0x166));var _0x6781=function(_0x38c74e,_0x1090b3){_0x38c74e=_0x38c74e-0x0;var _0x758e83=_0x7816[_0x38c74e];return _0x758e83;};'use strict';var _=require(_0x6781('0x0'));var util=require(_0x6781('0x1'));var moment=require(_0x6781('0x2'));var BPromise=require(_0x6781('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6781('0x4'));var db=require(_0x6781('0x5'))['db'];var utils=require(_0x6781('0x6'));var logger=require(_0x6781('0x7'))(_0x6781('0x8'));var config=require(_0x6781('0x9'));var jayson=require(_0x6781('0xa'));var client=jayson[_0x6781('0xb')][_0x6781('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e11f6,_0x570b,_0x4bf43c){return new BPromise(function(_0x21cc12,_0x1a7593){return client['request'](_0x3e11f6,_0x4bf43c)[_0x6781('0xd')](function(_0x2ed3f5){logger[_0x6781('0xe')](_0x6781('0xf'),_0x570b,_0x6781('0x10'));logger['debug'](_0x6781('0x11'),_0x570b,_0x6781('0x10'),JSON[_0x6781('0x12')](_0x2ed3f5));if(_0x2ed3f5[_0x6781('0x13')]){if(_0x2ed3f5[_0x6781('0x13')]['code']===0x1f4){logger['error'](_0x6781('0xf'),_0x570b,_0x2ed3f5['error'][_0x6781('0x14')]);return _0x1a7593(_0x2ed3f5['error']['message']);}logger[_0x6781('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x570b,_0x2ed3f5[_0x6781('0x13')][_0x6781('0x14')]);return _0x21cc12(_0x2ed3f5[_0x6781('0x13')][_0x6781('0x14')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x570b,_0x6781('0x10'));_0x21cc12(_0x2ed3f5[_0x6781('0x15')][_0x6781('0x14')]);}})[_0x6781('0x16')](function(_0x2b4393){logger[_0x6781('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x570b,_0x2b4393);_0x1a7593(_0x2b4393);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 2d175fd..ef65df2 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 _0x1f3c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete'];(function(_0x11af6c,_0xf0fc16){var _0x2b043f=function(_0x2e5e87){while(--_0x2e5e87){_0x11af6c['push'](_0x11af6c['shift']());}};_0x2b043f(++_0xf0fc16);}(_0x1f3c,0x1e0));var _0xc1f3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1f3c[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xc1f3('0x0'));var util=require(_0xc1f3('0x1'));var path=require(_0xc1f3('0x2'));var timeout=require(_0xc1f3('0x3'));var express=require(_0xc1f3('0x4'));var router=express[_0xc1f3('0x5')]();var fs_extra=require(_0xc1f3('0x6'));var auth=require(_0xc1f3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc1f3('0x8'));var controller=require('./mailTransferReport.controller');router[_0xc1f3('0x9')]('/',auth[_0xc1f3('0xa')](),controller[_0xc1f3('0xb')]);router[_0xc1f3('0x9')](_0xc1f3('0xc'),auth['isAuthenticated'](),controller[_0xc1f3('0xd')]);router[_0xc1f3('0x9')](_0xc1f3('0xe'),auth[_0xc1f3('0xa')](),controller[_0xc1f3('0xf')]);router['post']('/',auth[_0xc1f3('0xa')](),controller[_0xc1f3('0x10')]);router[_0xc1f3('0x11')]('/:id',auth[_0xc1f3('0xa')](),controller[_0xc1f3('0x12')]);router[_0xc1f3('0x13')](_0xc1f3('0xe'),auth[_0xc1f3('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfaf8=['../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3f7177,_0x3c7b79){var _0x5889ff=function(_0x5b0dac){while(--_0x5b0dac){_0x3f7177['push'](_0x3f7177['shift']());}};_0x5889ff(++_0x3c7b79);}(_0xfaf8,0x1ed));var _0x8faf=function(_0x4d3ba9,_0x2c3527){_0x4d3ba9=_0x4d3ba9-0x0;var _0x37bca8=_0xfaf8[_0x4d3ba9];return _0x37bca8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8faf('0x0'));var timeout=require(_0x8faf('0x1'));var express=require(_0x8faf('0x2'));var router=express[_0x8faf('0x3')]();var fs_extra=require(_0x8faf('0x4'));var auth=require(_0x8faf('0x5'));var interaction=require(_0x8faf('0x6'));var config=require(_0x8faf('0x7'));var controller=require(_0x8faf('0x8'));router[_0x8faf('0x9')]('/',auth[_0x8faf('0xa')](),controller['index']);router['get'](_0x8faf('0xb'),auth[_0x8faf('0xa')](),controller['describe']);router[_0x8faf('0x9')](_0x8faf('0xc'),auth[_0x8faf('0xa')](),controller[_0x8faf('0xd')]);router[_0x8faf('0xe')]('/',auth[_0x8faf('0xa')](),controller[_0x8faf('0xf')]);router[_0x8faf('0x10')](_0x8faf('0xc'),auth['isAuthenticated'](),controller[_0x8faf('0x11')]);router[_0x8faf('0x12')](_0x8faf('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x8faf('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index f84c721..de4f268 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x1dc139,_0x226f22){var _0x5b0e6b=function(_0x19e8bc){while(--_0x19e8bc){_0x1dc139['push'](_0x1dc139['shift']());}};_0x5b0e6b(++_0x226f22);}(_0x00bb,0x1d8));var _0xb00b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x00bb[_0x56482c];return _0x5aae7a;};'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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x312602,_0x48b89a){var _0x1d58f9=function(_0x2b857f){while(--_0x2b857f){_0x312602['push'](_0x312602['shift']());}};_0x1d58f9(++_0x48b89a);}(_0xaa88,0x137));var _0x8aa8=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xaa88[_0x16d10f];return _0x50c823;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 93ca5dc..fc58673 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 _0x5b63=['include','rows','show','params','find','create','update','body','catch','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','MailTransferReport','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll'];(function(_0xbb8e71,_0x52b7ba){var _0x15f5d2=function(_0xb968a4){while(--_0xb968a4){_0xbb8e71['push'](_0xbb8e71['shift']());}};_0x15f5d2(++_0x52b7ba);}(_0x5b63,0x136));var _0x35b6=function(_0xe2699d,_0x529eef){_0xe2699d=_0xe2699d-0x0;var _0x2a4d1a=_0x5b63[_0xe2699d];return _0x2a4d1a;};'use strict';var emlformat=require(_0x35b6('0x0'));var rimraf=require(_0x35b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35b6('0x2'));var rp=require(_0x35b6('0x3'));var moment=require(_0x35b6('0x4'));var BPromise=require(_0x35b6('0x5'));var Mustache=require(_0x35b6('0x6'));var util=require(_0x35b6('0x7'));var path=require('path');var sox=require(_0x35b6('0x8'));var csv=require(_0x35b6('0x9'));var ejs=require(_0x35b6('0xa'));var fs=require('fs');var fs_extra=require(_0x35b6('0xb'));var _=require(_0x35b6('0xc'));var squel=require('squel');var crypto=require(_0x35b6('0xd'));var jsforce=require(_0x35b6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x35b6('0xf'));var Papa=require(_0x35b6('0x10'));var Redis=require(_0x35b6('0x11'));var authService=require(_0x35b6('0x12'));var qs=require(_0x35b6('0x13'));var as=require(_0x35b6('0x14'));var hardwareService=require(_0x35b6('0x15'));var logger=require(_0x35b6('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x35b6('0x17'));var licenseUtil=require(_0x35b6('0x18'));var db=require(_0x35b6('0x19'))['db'];function respondWithStatusCode(_0xdda425,_0x598e59){_0x598e59=_0x598e59||0xcc;return function(_0x43d683){if(_0x43d683){return _0xdda425[_0x35b6('0x1a')](_0x598e59);}return _0xdda425['status'](_0x598e59)[_0x35b6('0x1b')]();};}function respondWithResult(_0x4df324,_0x4e5596){_0x4e5596=_0x4e5596||0xc8;return function(_0x5bbf73){if(_0x5bbf73){return _0x4df324[_0x35b6('0x1c')](_0x4e5596)[_0x35b6('0x1d')](_0x5bbf73);}};}function respondWithFilteredResult(_0x37a01e,_0x2486bc){return function(_0x2b85a5){if(_0x2b85a5){var _0xea4b3f=typeof _0x2486bc[_0x35b6('0x1e')]==='undefined'&&typeof _0x2486bc[_0x35b6('0x1f')]===_0x35b6('0x20');var _0x293bcc=_0x2b85a5[_0x35b6('0x21')];var _0x388d5e=_0xea4b3f?0x0:_0x2486bc[_0x35b6('0x1e')];var _0x20299d=_0xea4b3f?_0x2b85a5[_0x35b6('0x21')]:_0x2486bc[_0x35b6('0x1e')]+_0x2486bc[_0x35b6('0x1f')];var _0xfe732f;if(_0x20299d>=_0x293bcc){_0x20299d=_0x293bcc;_0xfe732f=0xc8;}else{_0xfe732f=0xce;}_0x37a01e[_0x35b6('0x1c')](_0xfe732f);return _0x37a01e[_0x35b6('0x22')](_0x35b6('0x23'),_0x388d5e+'-'+_0x20299d+'/'+_0x293bcc)['json'](_0x2b85a5);}return null;};}function patchUpdates(_0xe8d932){return function(_0x538de3){try{jsonpatch['apply'](_0x538de3,_0xe8d932,!![]);}catch(_0x4b1074){return BPromise[_0x35b6('0x24')](_0x4b1074);}return _0x538de3[_0x35b6('0x25')]();};}function saveUpdates(_0x2bcc14,_0x358577){return function(_0x2e7096){if(_0x2e7096){return _0x2e7096['update'](_0x2bcc14)[_0x35b6('0x26')](function(_0x3f023c){return _0x3f023c;});}return null;};}function removeEntity(_0x5dd14c,_0x5929aa){return function(_0x56e24c){if(_0x56e24c){return _0x56e24c[_0x35b6('0x27')]()[_0x35b6('0x26')](function(){_0x5dd14c[_0x35b6('0x1c')](0xcc)[_0x35b6('0x1b')]();});}};}function handleEntityNotFound(_0x14924c,_0x4069fb){return function(_0x48e276){if(!_0x48e276){_0x14924c[_0x35b6('0x1a')](0x194);}return _0x48e276;};}function handleError(_0x26ac8b,_0x1f2519){_0x1f2519=_0x1f2519||0x1f4;return function(_0x21e3c0){logger[_0x35b6('0x28')](_0x21e3c0[_0x35b6('0x29')]);if(_0x21e3c0[_0x35b6('0x2a')]){delete _0x21e3c0[_0x35b6('0x2a')];}_0x26ac8b[_0x35b6('0x1c')](_0x1f2519)[_0x35b6('0x2b')](_0x21e3c0);};}exports['index']=function(_0x2c0dc2,_0x4463f4){var _0x37bbb6={},_0x17666d={},_0x292936={'count':0x0,'rows':[]};var _0x250e71=_[_0x35b6('0x2c')](db[_0x35b6('0x2d')]['rawAttributes'],function(_0x1667bc){return{'name':_0x1667bc[_0x35b6('0x2e')],'type':_0x1667bc[_0x35b6('0x2f')][_0x35b6('0x30')]};});_0x17666d['model']=_['map'](_0x250e71,_0x35b6('0x2a'));_0x17666d['query']=_[_0x35b6('0x31')](_0x2c0dc2['query']);_0x17666d[_0x35b6('0x32')]=_[_0x35b6('0x33')](_0x17666d[_0x35b6('0x34')],_0x17666d[_0x35b6('0x35')]);_0x37bbb6[_0x35b6('0x36')]=_[_0x35b6('0x33')](_0x17666d['model'],qs['fields'](_0x2c0dc2['query'][_0x35b6('0x37')]));_0x37bbb6['attributes']=_0x37bbb6[_0x35b6('0x36')][_0x35b6('0x38')]?_0x37bbb6[_0x35b6('0x36')]:_0x17666d[_0x35b6('0x34')];if(!_0x2c0dc2[_0x35b6('0x35')][_0x35b6('0x39')](_0x35b6('0x3a'))){_0x37bbb6[_0x35b6('0x1f')]=qs[_0x35b6('0x1f')](_0x2c0dc2['query'][_0x35b6('0x1f')]);_0x37bbb6[_0x35b6('0x1e')]=qs['offset'](_0x2c0dc2[_0x35b6('0x35')][_0x35b6('0x1e')]);}_0x37bbb6[_0x35b6('0x3b')]=qs[_0x35b6('0x3c')](_0x2c0dc2['query'][_0x35b6('0x3c')]);_0x37bbb6[_0x35b6('0x3d')]=qs[_0x35b6('0x32')](_['pick'](_0x2c0dc2[_0x35b6('0x35')],_0x17666d[_0x35b6('0x32')]),_0x250e71);if(_0x2c0dc2[_0x35b6('0x35')]['filter']){_0x37bbb6[_0x35b6('0x3d')]=_[_0x35b6('0x3e')](_0x37bbb6[_0x35b6('0x3d')],{'$or':_[_0x35b6('0x2c')](_0x250e71,function(_0xe8fe3c){if(_0xe8fe3c['type']!=='VIRTUAL'){var _0x761151={};_0x761151[_0xe8fe3c[_0x35b6('0x2a')]]={'$like':'%'+_0x2c0dc2[_0x35b6('0x35')]['filter']+'%'};return _0x761151;}})});}_0x37bbb6=_[_0x35b6('0x3e')]({},_0x37bbb6,_0x2c0dc2[_0x35b6('0x3f')]);var _0x387638={'where':_0x37bbb6['where']};return db[_0x35b6('0x2d')][_0x35b6('0x21')](_0x387638)[_0x35b6('0x26')](function(_0x16f887){_0x292936[_0x35b6('0x21')]=_0x16f887;if(_0x2c0dc2['query'][_0x35b6('0x40')]){_0x37bbb6[_0x35b6('0x41')]=[{'all':!![]}];}return db[_0x35b6('0x2d')]['findAll'](_0x37bbb6);})[_0x35b6('0x26')](function(_0x11dedb){_0x292936[_0x35b6('0x42')]=_0x11dedb;return _0x292936;})[_0x35b6('0x26')](respondWithFilteredResult(_0x4463f4,_0x37bbb6))['catch'](handleError(_0x4463f4,null));};exports[_0x35b6('0x43')]=function(_0x8c1731,_0x5ca2b1){var _0x45ac9b={'raw':!![],'where':{'id':_0x8c1731[_0x35b6('0x44')]['id']}},_0x42324a={};_0x42324a[_0x35b6('0x34')]=_[_0x35b6('0x31')](db[_0x35b6('0x2d')]['rawAttributes']);_0x42324a['query']=_[_0x35b6('0x31')](_0x8c1731[_0x35b6('0x35')]);_0x42324a[_0x35b6('0x32')]=_[_0x35b6('0x33')](_0x42324a[_0x35b6('0x34')],_0x42324a[_0x35b6('0x35')]);_0x45ac9b[_0x35b6('0x36')]=_[_0x35b6('0x33')](_0x42324a['model'],qs[_0x35b6('0x37')](_0x8c1731[_0x35b6('0x35')][_0x35b6('0x37')]));_0x45ac9b[_0x35b6('0x36')]=_0x45ac9b[_0x35b6('0x36')]['length']?_0x45ac9b[_0x35b6('0x36')]:_0x42324a[_0x35b6('0x34')];if(_0x8c1731[_0x35b6('0x35')]['includeAll']){_0x45ac9b[_0x35b6('0x41')]=[{'all':!![]}];}_0x45ac9b=_[_0x35b6('0x3e')]({},_0x45ac9b,_0x8c1731[_0x35b6('0x3f')]);return db[_0x35b6('0x2d')][_0x35b6('0x45')](_0x45ac9b)['then'](handleEntityNotFound(_0x5ca2b1,null))[_0x35b6('0x26')](respondWithResult(_0x5ca2b1,null))['catch'](handleError(_0x5ca2b1,null));};exports[_0x35b6('0x46')]=function(_0x18a3e7,_0x16dfde){return db['MailTransferReport'][_0x35b6('0x46')](_0x18a3e7['body'],{})[_0x35b6('0x26')](respondWithResult(_0x16dfde,0xc9))['catch'](handleError(_0x16dfde,null));};exports[_0x35b6('0x47')]=function(_0xcd969f,_0x283d98){if(_0xcd969f[_0x35b6('0x48')]['id']){delete _0xcd969f['body']['id'];}return db[_0x35b6('0x2d')][_0x35b6('0x45')]({'where':{'id':_0xcd969f[_0x35b6('0x44')]['id']}})[_0x35b6('0x26')](handleEntityNotFound(_0x283d98,null))[_0x35b6('0x26')](saveUpdates(_0xcd969f['body'],null))[_0x35b6('0x26')](respondWithResult(_0x283d98,null))[_0x35b6('0x49')](handleError(_0x283d98,null));};exports[_0x35b6('0x27')]=function(_0x8e265d,_0x5eb2fd){return db[_0x35b6('0x2d')][_0x35b6('0x45')]({'where':{'id':_0x8e265d[_0x35b6('0x44')]['id']}})['then'](handleEntityNotFound(_0x5eb2fd,null))[_0x35b6('0x26')](removeEntity(_0x5eb2fd,null))[_0x35b6('0x49')](handleError(_0x5eb2fd,null));};exports['describe']=function(_0xd27cea,_0x33e4d7){return db['MailTransferReport'][_0x35b6('0x4a')]()[_0x35b6('0x26')](respondWithResult(_0x33e4d7,null))[_0x35b6('0x49')](handleError(_0x33e4d7,null));}; \ No newline at end of file +var _0xe6da=['update','destroy','then','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','options','includeAll','MailTransferReport','findAll','catch','show','fields','include','find','create','body','params','rimraf','request-promise','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save'];(function(_0xf2076b,_0x3b7d60){var _0x3c24a8=function(_0x275685){while(--_0x275685){_0xf2076b['push'](_0xf2076b['shift']());}};_0x3c24a8(++_0x3b7d60);}(_0xe6da,0x19c));var _0xae6d=function(_0x2db5cc,_0x18623b){_0x2db5cc=_0x2db5cc-0x0;var _0xde0b21=_0xe6da[_0x2db5cc];return _0xde0b21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xae6d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xae6d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xae6d('0x2'));var path=require(_0xae6d('0x3'));var sox=require('sox');var csv=require(_0xae6d('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae6d('0x5'));var _=require('lodash');var squel=require(_0xae6d('0x6'));var crypto=require(_0xae6d('0x7'));var jsforce=require(_0xae6d('0x8'));var deskjs=require(_0xae6d('0x9'));var toCsv=require(_0xae6d('0x4'));var querystring=require(_0xae6d('0xa'));var Papa=require(_0xae6d('0xb'));var Redis=require('ioredis');var authService=require(_0xae6d('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xae6d('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae6d('0xe'))(_0xae6d('0xf'));var utils=require('../../config/utils');var config=require(_0xae6d('0x10'));var licenseUtil=require(_0xae6d('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17e5ce,_0x2fd3dc){_0x2fd3dc=_0x2fd3dc||0xcc;return function(_0x1ca1dc){if(_0x1ca1dc){return _0x17e5ce[_0xae6d('0x12')](_0x2fd3dc);}return _0x17e5ce[_0xae6d('0x13')](_0x2fd3dc)[_0xae6d('0x14')]();};}function respondWithResult(_0x2d9be4,_0x5077fb){_0x5077fb=_0x5077fb||0xc8;return function(_0x40e923){if(_0x40e923){return _0x2d9be4['status'](_0x5077fb)[_0xae6d('0x15')](_0x40e923);}};}function respondWithFilteredResult(_0x44a3d7,_0xc6b301){return function(_0x281d39){if(_0x281d39){var _0x128417=typeof _0xc6b301[_0xae6d('0x16')]==='undefined'&&typeof _0xc6b301[_0xae6d('0x17')]===_0xae6d('0x18');var _0x2704ca=_0x281d39['count'];var _0x1579c2=_0x128417?0x0:_0xc6b301['offset'];var _0x440fd6=_0x128417?_0x281d39[_0xae6d('0x19')]:_0xc6b301[_0xae6d('0x16')]+_0xc6b301['limit'];var _0x9bde08;if(_0x440fd6>=_0x2704ca){_0x440fd6=_0x2704ca;_0x9bde08=0xc8;}else{_0x9bde08=0xce;}_0x44a3d7[_0xae6d('0x13')](_0x9bde08);return _0x44a3d7['set']('Content-Range',_0x1579c2+'-'+_0x440fd6+'/'+_0x2704ca)[_0xae6d('0x15')](_0x281d39);}return null;};}function patchUpdates(_0x4cdfd8){return function(_0x5ea660){try{jsonpatch[_0xae6d('0x1a')](_0x5ea660,_0x4cdfd8,!![]);}catch(_0xc4f552){return BPromise[_0xae6d('0x1b')](_0xc4f552);}return _0x5ea660[_0xae6d('0x1c')]();};}function saveUpdates(_0x509191,_0x483b96){return function(_0x3d5b13){if(_0x3d5b13){return _0x3d5b13[_0xae6d('0x1d')](_0x509191)['then'](function(_0x1d5cda){return _0x1d5cda;});}return null;};}function removeEntity(_0x37bbe3,_0x520328){return function(_0x578463){if(_0x578463){return _0x578463[_0xae6d('0x1e')]()[_0xae6d('0x1f')](function(){_0x37bbe3[_0xae6d('0x13')](0xcc)[_0xae6d('0x14')]();});}};}function handleEntityNotFound(_0x394d06,_0x1f0847){return function(_0x3a8579){if(!_0x3a8579){_0x394d06[_0xae6d('0x12')](0x194);}return _0x3a8579;};}function handleError(_0x8b2501,_0x24d0ab){_0x24d0ab=_0x24d0ab||0x1f4;return function(_0x51dbe9){logger['error'](_0x51dbe9['stack']);if(_0x51dbe9['name']){delete _0x51dbe9[_0xae6d('0x20')];}_0x8b2501[_0xae6d('0x13')](_0x24d0ab)[_0xae6d('0x21')](_0x51dbe9);};}exports['index']=function(_0x19058c,_0x2d0dbe){var _0x1b3ea2={},_0x1d4dec={},_0x410e4f={'count':0x0,'rows':[]};var _0x3bb625=_[_0xae6d('0x22')](db['MailTransferReport']['rawAttributes'],function(_0x5c1927){return{'name':_0x5c1927[_0xae6d('0x23')],'type':_0x5c1927['type'][_0xae6d('0x24')]};});_0x1d4dec[_0xae6d('0x25')]=_[_0xae6d('0x22')](_0x3bb625,_0xae6d('0x20'));_0x1d4dec[_0xae6d('0x26')]=_[_0xae6d('0x27')](_0x19058c[_0xae6d('0x26')]);_0x1d4dec[_0xae6d('0x28')]=_[_0xae6d('0x29')](_0x1d4dec[_0xae6d('0x25')],_0x1d4dec[_0xae6d('0x26')]);_0x1b3ea2[_0xae6d('0x2a')]=_[_0xae6d('0x29')](_0x1d4dec[_0xae6d('0x25')],qs['fields'](_0x19058c['query']['fields']));_0x1b3ea2[_0xae6d('0x2a')]=_0x1b3ea2[_0xae6d('0x2a')]['length']?_0x1b3ea2[_0xae6d('0x2a')]:_0x1d4dec[_0xae6d('0x25')];if(!_0x19058c[_0xae6d('0x26')][_0xae6d('0x2b')](_0xae6d('0x2c'))){_0x1b3ea2['limit']=qs[_0xae6d('0x17')](_0x19058c[_0xae6d('0x26')]['limit']);_0x1b3ea2[_0xae6d('0x16')]=qs['offset'](_0x19058c[_0xae6d('0x26')][_0xae6d('0x16')]);}_0x1b3ea2[_0xae6d('0x2d')]=qs['sort'](_0x19058c['query'][_0xae6d('0x2e')]);_0x1b3ea2['where']=qs[_0xae6d('0x28')](_['pick'](_0x19058c['query'],_0x1d4dec[_0xae6d('0x28')]),_0x3bb625);if(_0x19058c['query'][_0xae6d('0x2f')]){_0x1b3ea2['where']=_[_0xae6d('0x30')](_0x1b3ea2['where'],{'$or':_['map'](_0x3bb625,function(_0x2f450e){if(_0x2f450e[_0xae6d('0x31')]!==_0xae6d('0x32')){var _0x5dfa51={};_0x5dfa51[_0x2f450e[_0xae6d('0x20')]]={'$like':'%'+_0x19058c['query'][_0xae6d('0x2f')]+'%'};return _0x5dfa51;}})});}_0x1b3ea2=_[_0xae6d('0x30')]({},_0x1b3ea2,_0x19058c[_0xae6d('0x33')]);var _0x5866a6={'where':_0x1b3ea2['where']};return db['MailTransferReport'][_0xae6d('0x19')](_0x5866a6)[_0xae6d('0x1f')](function(_0x54ebee){_0x410e4f[_0xae6d('0x19')]=_0x54ebee;if(_0x19058c['query'][_0xae6d('0x34')]){_0x1b3ea2['include']=[{'all':!![]}];}return db[_0xae6d('0x35')][_0xae6d('0x36')](_0x1b3ea2);})[_0xae6d('0x1f')](function(_0x5a2bad){_0x410e4f['rows']=_0x5a2bad;return _0x410e4f;})[_0xae6d('0x1f')](respondWithFilteredResult(_0x2d0dbe,_0x1b3ea2))[_0xae6d('0x37')](handleError(_0x2d0dbe,null));};exports[_0xae6d('0x38')]=function(_0x1fa1b2,_0x992df){var _0x44fdf9={'raw':!![],'where':{'id':_0x1fa1b2['params']['id']}},_0x482ece={};_0x482ece[_0xae6d('0x25')]=_['keys'](db[_0xae6d('0x35')]['rawAttributes']);_0x482ece[_0xae6d('0x26')]=_[_0xae6d('0x27')](_0x1fa1b2[_0xae6d('0x26')]);_0x482ece[_0xae6d('0x28')]=_['intersection'](_0x482ece[_0xae6d('0x25')],_0x482ece[_0xae6d('0x26')]);_0x44fdf9[_0xae6d('0x2a')]=_[_0xae6d('0x29')](_0x482ece[_0xae6d('0x25')],qs[_0xae6d('0x39')](_0x1fa1b2[_0xae6d('0x26')][_0xae6d('0x39')]));_0x44fdf9[_0xae6d('0x2a')]=_0x44fdf9[_0xae6d('0x2a')]['length']?_0x44fdf9['attributes']:_0x482ece[_0xae6d('0x25')];if(_0x1fa1b2[_0xae6d('0x26')][_0xae6d('0x34')]){_0x44fdf9[_0xae6d('0x3a')]=[{'all':!![]}];}_0x44fdf9=_[_0xae6d('0x30')]({},_0x44fdf9,_0x1fa1b2[_0xae6d('0x33')]);return db[_0xae6d('0x35')][_0xae6d('0x3b')](_0x44fdf9)[_0xae6d('0x1f')](handleEntityNotFound(_0x992df,null))[_0xae6d('0x1f')](respondWithResult(_0x992df,null))[_0xae6d('0x37')](handleError(_0x992df,null));};exports['create']=function(_0x4f94f4,_0x4de859){return db[_0xae6d('0x35')][_0xae6d('0x3c')](_0x4f94f4[_0xae6d('0x3d')],{})['then'](respondWithResult(_0x4de859,0xc9))['catch'](handleError(_0x4de859,null));};exports[_0xae6d('0x1d')]=function(_0x23191c,_0x2dec2d){if(_0x23191c[_0xae6d('0x3d')]['id']){delete _0x23191c[_0xae6d('0x3d')]['id'];}return db['MailTransferReport'][_0xae6d('0x3b')]({'where':{'id':_0x23191c[_0xae6d('0x3e')]['id']}})[_0xae6d('0x1f')](handleEntityNotFound(_0x2dec2d,null))[_0xae6d('0x1f')](saveUpdates(_0x23191c[_0xae6d('0x3d')],null))[_0xae6d('0x1f')](respondWithResult(_0x2dec2d,null))[_0xae6d('0x37')](handleError(_0x2dec2d,null));};exports[_0xae6d('0x1e')]=function(_0x1f4032,_0x4d3714){return db[_0xae6d('0x35')][_0xae6d('0x3b')]({'where':{'id':_0x1f4032['params']['id']}})[_0xae6d('0x1f')](handleEntityNotFound(_0x4d3714,null))[_0xae6d('0x1f')](removeEntity(_0x4d3714,null))[_0xae6d('0x37')](handleError(_0x4d3714,null));};exports['describe']=function(_0x5aad3b,_0x536f9f){return db[_0xae6d('0x35')]['describe']()['then'](respondWithResult(_0x536f9f,null))[_0xae6d('0x37')](handleError(_0x536f9f,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index bbc5712..ab6b76c 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 _0xaf5a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','util'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xaf5a,0x144));var _0xaaf5=function(_0x425d5e,_0x3b9040){_0x425d5e=_0x425d5e-0x0;var _0x3cc67b=_0xaf5a[_0x425d5e];return _0x3cc67b;};'use strict';var _=require('lodash');var util=require(_0xaaf5('0x0'));var logger=require('../../config/logger')(_0xaaf5('0x1'));var moment=require(_0xaaf5('0x2'));var BPromise=require(_0xaaf5('0x3'));var rp=require(_0xaaf5('0x4'));var fs=require('fs');var path=require(_0xaaf5('0x5'));var rimraf=require(_0xaaf5('0x6'));var config=require(_0xaaf5('0x7'));var attributes=require(_0xaaf5('0x8'));module['exports']=function(_0x3b1281,_0x5b9ec4){return _0x3b1281[_0xaaf5('0x9')](_0xaaf5('0xa'),attributes,{'tableName':_0xaaf5('0xb'),'paranoid':![],'indexes':[{'name':_0xaaf5('0xc'),'fields':[_0xaaf5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0763=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes'];(function(_0x24534a,_0x3638a8){var _0x58d2b5=function(_0x447ae0){while(--_0x447ae0){_0x24534a['push'](_0x24534a['shift']());}};_0x58d2b5(++_0x3638a8);}(_0x0763,0x87));var _0x3076=function(_0x28b4cd,_0x573ff1){_0x28b4cd=_0x28b4cd-0x0;var _0x4229cc=_0x0763[_0x28b4cd];return _0x4229cc;};'use strict';var _=require(_0x3076('0x0'));var util=require('util');var logger=require(_0x3076('0x1'))(_0x3076('0x2'));var moment=require('moment');var BPromise=require(_0x3076('0x3'));var rp=require(_0x3076('0x4'));var fs=require('fs');var path=require(_0x3076('0x5'));var rimraf=require(_0x3076('0x6'));var config=require('../../config/environment');var attributes=require(_0x3076('0x7'));module[_0x3076('0x8')]=function(_0x1ce2ff,_0x1b5f4e){return _0x1ce2ff[_0x3076('0x9')](_0x3076('0xa'),attributes,{'tableName':_0x3076('0xb'),'paranoid':![],'indexes':[{'name':_0x3076('0xc'),'fields':[_0x3076('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 06fa119..372912d 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 _0x37a2=['then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x45775e,_0x589d0d){var _0x236388=function(_0x5ec134){while(--_0x5ec134){_0x45775e['push'](_0x45775e['shift']());}};_0x236388(++_0x589d0d);}(_0x37a2,0x196));var _0x237a=function(_0x4952ad,_0x160074){_0x4952ad=_0x4952ad-0x0;var _0x5c7ffb=_0x37a2[_0x4952ad];return _0x5c7ffb;};'use strict';var _=require(_0x237a('0x0'));var util=require(_0x237a('0x1'));var moment=require(_0x237a('0x2'));var BPromise=require(_0x237a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x237a('0x4'));var db=require(_0x237a('0x5'))['db'];var utils=require(_0x237a('0x6'));var logger=require(_0x237a('0x7'))('rpc');var config=require(_0x237a('0x8'));var jayson=require(_0x237a('0x9'));var client=jayson['client'][_0x237a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bbf86,_0xed129d,_0x294116){return new BPromise(function(_0x47b1cf,_0x312871){return client[_0x237a('0xb')](_0x1bbf86,_0x294116)[_0x237a('0xc')](function(_0x25c8b5){logger[_0x237a('0xd')](_0x237a('0xe'),_0xed129d,_0x237a('0xf'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0xed129d,'request\x20sent',JSON['stringify'](_0x25c8b5));if(_0x25c8b5[_0x237a('0x10')]){if(_0x25c8b5[_0x237a('0x10')]['code']===0x1f4){logger['error'](_0x237a('0xe'),_0xed129d,_0x25c8b5[_0x237a('0x10')][_0x237a('0x11')]);return _0x312871(_0x25c8b5[_0x237a('0x10')][_0x237a('0x11')]);}logger[_0x237a('0x10')](_0x237a('0xe'),_0xed129d,_0x25c8b5[_0x237a('0x10')][_0x237a('0x11')]);return _0x47b1cf(_0x25c8b5[_0x237a('0x10')][_0x237a('0x11')]);}else{logger[_0x237a('0xd')]('MailTransferReport,\x20%s,\x20%s',_0xed129d,_0x237a('0xf'));_0x47b1cf(_0x25c8b5[_0x237a('0x12')][_0x237a('0x11')]);}})['catch'](function(_0x298b3b){logger[_0x237a('0x10')](_0x237a('0xe'),_0xed129d,_0x298b3b);_0x312871(_0x298b3b);});});} \ No newline at end of file +var _0x1c55=['jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x521930,_0x2db99){var _0x340de4=function(_0x4fe715){while(--_0x4fe715){_0x521930['push'](_0x521930['shift']());}};_0x340de4(++_0x2db99);}(_0x1c55,0x15f));var _0x51c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1c55[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x51c5('0x0'));var util=require(_0x51c5('0x1'));var moment=require(_0x51c5('0x2'));var BPromise=require(_0x51c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51c5('0x4'));var db=require(_0x51c5('0x5'))['db'];var utils=require(_0x51c5('0x6'));var logger=require(_0x51c5('0x7'))('rpc');var config=require(_0x51c5('0x8'));var jayson=require(_0x51c5('0x9'));var client=jayson[_0x51c5('0xa')][_0x51c5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54316e,_0x144c9a,_0x2f398a){return new BPromise(function(_0x325142,_0x525ccd){return client[_0x51c5('0xc')](_0x54316e,_0x2f398a)[_0x51c5('0xd')](function(_0x541310){logger['info'](_0x51c5('0xe'),_0x144c9a,_0x51c5('0xf'));logger[_0x51c5('0x10')](_0x51c5('0x11'),_0x144c9a,_0x51c5('0xf'),JSON[_0x51c5('0x12')](_0x541310));if(_0x541310['error']){if(_0x541310[_0x51c5('0x13')][_0x51c5('0x14')]===0x1f4){logger[_0x51c5('0x13')](_0x51c5('0xe'),_0x144c9a,_0x541310['error']['message']);return _0x525ccd(_0x541310[_0x51c5('0x13')][_0x51c5('0x15')]);}logger[_0x51c5('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x144c9a,_0x541310['error'][_0x51c5('0x15')]);return _0x325142(_0x541310[_0x51c5('0x13')][_0x51c5('0x15')]);}else{logger[_0x51c5('0x16')](_0x51c5('0xe'),_0x144c9a,'request\x20sent');_0x325142(_0x541310[_0x51c5('0x17')][_0x51c5('0x15')]);}})['catch'](function(_0x24a953){logger[_0x51c5('0x13')](_0x51c5('0xe'),_0x144c9a,_0x24a953);_0x525ccd(_0x24a953);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index c7df2bd..a70d71b 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 _0x5881=['delete','destroy','exports','multer','util','path','express','fs-extra','../../config/environment','./memberReport.controller','index','get','describe','/:id','show','post','isAuthenticated','create','put','update'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5881,0x17f));var _0x1588=function(_0xbb04e7,_0x1078b7){_0xbb04e7=_0xbb04e7-0x0;var _0x122b60=_0x5881[_0xbb04e7];return _0x122b60;};'use strict';var multer=require(_0x1588('0x0'));var util=require(_0x1588('0x1'));var path=require(_0x1588('0x2'));var timeout=require('connect-timeout');var express=require(_0x1588('0x3'));var router=express['Router']();var fs_extra=require(_0x1588('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1588('0x5'));var controller=require(_0x1588('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1588('0x7')]);router[_0x1588('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1588('0x9')]);router[_0x1588('0x8')](_0x1588('0xa'),auth['isAuthenticated'](),controller[_0x1588('0xb')]);router[_0x1588('0xc')]('/',auth[_0x1588('0xd')](),controller[_0x1588('0xe')]);router[_0x1588('0xf')]('/:id',auth[_0x1588('0xd')](),controller[_0x1588('0x10')]);router[_0x1588('0x11')](_0x1588('0xa'),auth['isAuthenticated'](),controller[_0x1588('0x12')]);module[_0x1588('0x13')]=router; \ No newline at end of file +var _0x15ec=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/:id','post','put','destroy','exports'];(function(_0x441b07,_0x568e5b){var _0x1c0a65=function(_0x22e15f){while(--_0x22e15f){_0x441b07['push'](_0x441b07['shift']());}};_0x1c0a65(++_0x568e5b);}(_0x15ec,0x1ea));var _0xc15e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x15ec[_0x28947d];return _0x12d2ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc15e('0x0'));var timeout=require(_0xc15e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc15e('0x2'));var auth=require(_0xc15e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc15e('0x4'));var controller=require(_0xc15e('0x5'));router[_0xc15e('0x6')]('/',auth[_0xc15e('0x7')](),controller[_0xc15e('0x8')]);router['get']('/describe',auth[_0xc15e('0x7')](),controller['describe']);router[_0xc15e('0x6')](_0xc15e('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc15e('0xa')]('/',auth[_0xc15e('0x7')](),controller['create']);router[_0xc15e('0xb')](_0xc15e('0x9'),auth[_0xc15e('0x7')](),controller['update']);router['delete']('/:id',auth[_0xc15e('0x7')](),controller[_0xc15e('0xc')]);module[_0xc15e('0xd')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 9d10d6d..345fc5e 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 _0xbc1c=['DATE','getDataValue','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER'];(function(_0x2b2628,_0x59fd5d){var _0x2a5e06=function(_0x39586d){while(--_0x39586d){_0x2b2628['push'](_0x2b2628['shift']());}};_0x2a5e06(++_0x59fd5d);}(_0xbc1c,0x1a8));var _0xcbc1=function(_0x15876c,_0x510dd4){_0x15876c=_0x15876c-0x0;var _0x39d91b=_0xbc1c[_0x15876c];return _0x39d91b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcbc1('0x0'));module[_0xcbc1('0x1')]={'channel':{'type':Sequelize[_0xcbc1('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xcbc1('0x2')]},'type':{'type':Sequelize[_0xcbc1('0x2')],'defaultValue':_0xcbc1('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xcbc1('0x4')]},'enterAt':{'type':Sequelize[_0xcbc1('0x5')]},'exitAt':{'type':Sequelize[_0xcbc1('0x5')],'set':function(_0x5e2d59){var _0xf62c91=moment(_0x5e2d59);var _0x536676=moment(this[_0xcbc1('0x6')]('enterAt'));var _0x4566bd=_0xf62c91['diff'](_0x536676,_0xcbc1('0x7'));this[_0xcbc1('0x8')](_0xcbc1('0x9'),_0x5e2d59);this[_0xcbc1('0x8')](_0xcbc1('0xa'),_0x4566bd>=0x0?_0x4566bd:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xcbc1('0xb')},'data2':{'type':Sequelize[_0xcbc1('0x2')],'comment':_0xcbc1('0xc')},'data3':{'type':Sequelize[_0xcbc1('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xcbc1('0x4')]},'uniqueid':{'type':Sequelize[_0xcbc1('0x2')]}}; \ No newline at end of file +var _0xcfef=['DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING'];(function(_0x4c6c7b,_0x4fcdac){var _0x2be20c=function(_0x5d7cdc){while(--_0x5d7cdc){_0x4c6c7b['push'](_0x4c6c7b['shift']());}};_0x2be20c(++_0x4fcdac);}(_0xcfef,0xfc));var _0xfcfe=function(_0x57e3c2,_0x4ed852){_0x57e3c2=_0x57e3c2-0x0;var _0x82134f=_0xcfef[_0x57e3c2];return _0x82134f;};'use strict';var Sequelize=require(_0xfcfe('0x0'));var moment=require('moment');module[_0xfcfe('0x1')]={'channel':{'type':Sequelize[_0xfcfe('0x2')]},'membername':{'type':Sequelize[_0xfcfe('0x2')]},'interface':{'type':Sequelize[_0xfcfe('0x2')]},'type':{'type':Sequelize[_0xfcfe('0x2')],'defaultValue':_0xfcfe('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xfcfe('0x4')]},'enterAt':{'type':Sequelize[_0xfcfe('0x5')]},'exitAt':{'type':Sequelize[_0xfcfe('0x5')],'set':function(_0xafd645){var _0x1809ce=moment(_0xafd645);var _0x199457=moment(this[_0xfcfe('0x6')]('enterAt'));var _0x3cc671=_0x1809ce['diff'](_0x199457,_0xfcfe('0x7'));this[_0xfcfe('0x8')](_0xfcfe('0x9'),_0xafd645);this['setDataValue']('duration',_0x3cc671>=0x0?_0x3cc671:null);}},'data1':{'type':Sequelize[_0xfcfe('0x2')],'comment':_0xfcfe('0xa')},'data2':{'type':Sequelize[_0xfcfe('0x2')],'comment':_0xfcfe('0xb')},'data3':{'type':Sequelize['STRING'],'comment':_0xfcfe('0xc')},'data4':{'type':Sequelize[_0xfcfe('0x2')],'comment':_0xfcfe('0xd')},'data5':{'type':Sequelize[_0xfcfe('0x2')],'comment':_0xfcfe('0xe')},'role':{'type':Sequelize[_0xfcfe('0x2')]},'internal':{'type':Sequelize[_0xfcfe('0x4')]},'uniqueid':{'type':Sequelize[_0xfcfe('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 3688381..1ab68db 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x5bd7f1,_0x3f711f){var _0x2211f4=function(_0x45518d){while(--_0x45518d){_0x5bd7f1['push'](_0x5bd7f1['shift']());}};_0x2211f4(++_0x3f711f);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x55ca,0x126));var _0xa55c=function(_0x1b6563,_0x3bf0f1){_0x1b6563=_0x1b6563-0x0;var _0xdea7b8=_0x55ca[_0x1b6563];return _0xdea7b8;};'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 f9cecd1..1198853 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 _0x1c1d=['membername','interface','util','../../config/logger','api','moment','bluebird','rimraf','./memberReport.attributes','exports','MemberReport','report_member','membername_interface'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1c1d,0xab));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd1c1('0x0'));var logger=require(_0xd1c1('0x1'))(_0xd1c1('0x2'));var moment=require(_0xd1c1('0x3'));var BPromise=require(_0xd1c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd1c1('0x5'));var config=require('../../config/environment');var attributes=require(_0xd1c1('0x6'));module[_0xd1c1('0x7')]=function(_0xeeae65,_0x36d065){return _0xeeae65['define'](_0xd1c1('0x8'),attributes,{'tableName':_0xd1c1('0x9'),'paranoid':![],'indexes':[{'name':_0xd1c1('0xa'),'fields':[_0xd1c1('0xb'),_0xd1c1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1490=['define','report_member','interface','lodash','api','bluebird','path','rimraf','../../config/environment','./memberReport.attributes'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0x1490,0x85));var _0x0149=function(_0x24584f,_0x5d09a4){_0x24584f=_0x24584f-0x0;var _0x103fa2=_0x1490[_0x24584f];return _0x103fa2;};'use strict';var _=require(_0x0149('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0149('0x1'));var moment=require('moment');var BPromise=require(_0x0149('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0149('0x3'));var rimraf=require(_0x0149('0x4'));var config=require(_0x0149('0x5'));var attributes=require(_0x0149('0x6'));module['exports']=function(_0x1042c3,_0xb8ab15){return _0x1042c3[_0x0149('0x7')]('MemberReport',attributes,{'tableName':_0x0149('0x8'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0x0149('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 4f191bd..b78b356 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 _0xed5c=['request\x20sent','debug','error','message','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','map','model','then','stringify','CreateMemberReport','create','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','MemberReport,\x20%s,\x20%s'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xed5c,0x81));var _0xced5=function(_0x56da0d,_0x1bffe2){_0x56da0d=_0x56da0d-0x0;var _0x87337c=_0xed5c[_0x56da0d];return _0x87337c;};'use strict';var _=require(_0xced5('0x0'));var util=require(_0xced5('0x1'));var moment=require(_0xced5('0x2'));var BPromise=require(_0xced5('0x3'));var rs=require(_0xced5('0x4'));var fs=require('fs');var Redis=require(_0xced5('0x5'));var db=require(_0xced5('0x6'))['db'];var utils=require(_0xced5('0x7'));var logger=require(_0xced5('0x8'))(_0xced5('0x9'));var config=require('../../config/environment');var jayson=require(_0xced5('0xa'));var client=jayson[_0xced5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c59d1,_0x31a495,_0xc738da){return new BPromise(function(_0x2857d8,_0x2113e4){return client[_0xced5('0xc')](_0x5c59d1,_0xc738da)['then'](function(_0x50d620){logger[_0xced5('0xd')](_0xced5('0xe'),_0x31a495,_0xced5('0xf'));logger[_0xced5('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x31a495,_0xced5('0xf'),JSON['stringify'](_0x50d620));if(_0x50d620[_0xced5('0x11')]){if(_0x50d620[_0xced5('0x11')]['code']===0x1f4){logger[_0xced5('0x11')]('MemberReport,\x20%s,\x20%s',_0x31a495,_0x50d620[_0xced5('0x11')][_0xced5('0x12')]);return _0x2113e4(_0x50d620[_0xced5('0x11')][_0xced5('0x12')]);}logger[_0xced5('0x11')](_0xced5('0xe'),_0x31a495,_0x50d620[_0xced5('0x11')]['message']);return _0x2857d8(_0x50d620['error'][_0xced5('0x12')]);}else{logger[_0xced5('0xd')](_0xced5('0xe'),_0x31a495,'request\x20sent');_0x2857d8(_0x50d620['result'][_0xced5('0x12')]);}})[_0xced5('0x13')](function(_0x3e1dfc){logger[_0xced5('0x11')](_0xced5('0xe'),_0x31a495,_0x3e1dfc);_0x2113e4(_0x3e1dfc);});});}exports[_0xced5('0x14')]=function(_0x54c5a4){var _0x29a3ba=this;return new Promise(function(_0x153e29,_0x5d1615){return db[_0xced5('0x15')][_0xced5('0x16')]({'raw':_0x54c5a4[_0xced5('0x17')]?_0x54c5a4['options'][_0xced5('0x18')]===undefined?!![]:![]:!![],'where':_0x54c5a4[_0xced5('0x17')]?_0x54c5a4[_0xced5('0x17')]['where']||null:null,'attributes':_0x54c5a4[_0xced5('0x17')]?_0x54c5a4[_0xced5('0x17')][_0xced5('0x19')]||null:null,'limit':_0x54c5a4[_0xced5('0x17')]?_0x54c5a4[_0xced5('0x17')][_0xced5('0x1a')]||null:null,'include':_0x54c5a4['options']?_0x54c5a4[_0xced5('0x17')][_0xced5('0x1b')]?_[_0xced5('0x1c')](_0x54c5a4[_0xced5('0x17')][_0xced5('0x1b')],function(_0x18f299){return{'model':db[_0x18f299[_0xced5('0x1d')]],'as':_0x18f299['as'],'attributes':_0x18f299[_0xced5('0x19')],'include':_0x18f299[_0xced5('0x1b')]?_[_0xced5('0x1c')](_0x18f299[_0xced5('0x1b')],function(_0x2f092b){return{'model':db[_0x2f092b[_0xced5('0x1d')]],'as':_0x2f092b['as'],'attributes':_0x2f092b[_0xced5('0x19')],'include':_0x2f092b['include']?_['map'](_0x2f092b[_0xced5('0x1b')],function(_0x2cd6c4){return{'model':db[_0x2cd6c4[_0xced5('0x1d')]],'as':_0x2cd6c4['as'],'attributes':_0x2cd6c4[_0xced5('0x19')]};}):[]};}):[]};}):[]:[]})[_0xced5('0x1e')](function(_0x26790a){logger[_0xced5('0xd')](_0xced5('0x14'),_0x54c5a4);logger[_0xced5('0x10')](_0xced5('0x14'),_0x54c5a4,JSON[_0xced5('0x1f')](_0x26790a));_0x153e29(_0x26790a);})['catch'](function(_0x20aa83){logger[_0xced5('0x11')]('GetMemberReport',_0x20aa83['message'],_0x54c5a4);_0x5d1615(_0x29a3ba['error'](0x1f4,_0x20aa83['message']));});});};exports[_0xced5('0x20')]=function(_0x2f7cd4){var _0x9d2fee=this;return new Promise(function(_0x409ff4,_0xd502de){return db['MemberReport'][_0xced5('0x21')](_0x2f7cd4['body'],{'raw':_0x2f7cd4[_0xced5('0x17')]?_0x2f7cd4[_0xced5('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1bb977){logger['info'](_0xced5('0x20'),_0x2f7cd4);logger[_0xced5('0x10')](_0xced5('0x20'),_0x2f7cd4,JSON[_0xced5('0x1f')](_0x1bb977));_0x409ff4(_0x1bb977);})[_0xced5('0x13')](function(_0x1dc754){logger[_0xced5('0x11')]('CreateMemberReport',_0x1dc754[_0xced5('0x12')],_0x2f7cd4);_0xd502de(_0x9d2fee[_0xced5('0x11')](0x1f4,_0x1dc754['message']));});});};exports[_0xced5('0x22')]=function(_0x3ff95d){var _0x542afe=this;return new Promise(function(_0x288ab0,_0x4701b6){return db['MemberReport'][_0xced5('0x23')](_0x3ff95d['body'],{'raw':_0x3ff95d[_0xced5('0x17')]?_0x3ff95d['options'][_0xced5('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ff95d[_0xced5('0x17')]?_0x3ff95d['options']['where']||null:null,'attributes':_0x3ff95d[_0xced5('0x17')]?_0x3ff95d[_0xced5('0x17')]['attributes']||null:null,'limit':_0x3ff95d[_0xced5('0x17')]?_0x3ff95d[_0xced5('0x17')]['limit']||null:null})[_0xced5('0x1e')](function(_0x17059d){logger[_0xced5('0xd')]('UpdateMemberReport',_0x3ff95d);logger[_0xced5('0x10')](_0xced5('0x22'),_0x3ff95d,JSON[_0xced5('0x1f')](_0x17059d));_0x288ab0(_0x17059d);})['catch'](function(_0x14bfdd){logger[_0xced5('0x11')](_0xced5('0x22'),_0x14bfdd['message'],_0x3ff95d);_0x4701b6(_0x542afe[_0xced5('0x11')](0x1f4,_0x14bfdd['message']));});});}; \ No newline at end of file +var _0x908e=['findAll','options','where','attributes','limit','include','map','model','then','catch','create','body','CreateMemberReport','update','raw','UpdateMemberReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MemberReport,\x20%s,\x20%s','GetMemberReport','MemberReport'];(function(_0x79c783,_0x59fcdc){var _0x2fec1a=function(_0xca579d){while(--_0xca579d){_0x79c783['push'](_0x79c783['shift']());}};_0x2fec1a(++_0x59fcdc);}(_0x908e,0x182));var _0xe908=function(_0x4a81e5,_0x2ea101){_0x4a81e5=_0x4a81e5-0x0;var _0x237fc8=_0x908e[_0x4a81e5];return _0x237fc8;};'use strict';var _=require(_0xe908('0x0'));var util=require(_0xe908('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe908('0x2'));var fs=require('fs');var Redis=require(_0xe908('0x3'));var db=require(_0xe908('0x4'))['db'];var utils=require(_0xe908('0x5'));var logger=require('../../config/logger')(_0xe908('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe908('0x7')][_0xe908('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2df114,_0x1f6cd2,_0x7a1fdd){return new BPromise(function(_0x6e8920,_0x57dacd){return client[_0xe908('0x9')](_0x2df114,_0x7a1fdd)['then'](function(_0xab6e38){logger[_0xe908('0xa')]('MemberReport,\x20%s,\x20%s',_0x1f6cd2,'request\x20sent');logger[_0xe908('0xb')](_0xe908('0xc'),_0x1f6cd2,_0xe908('0xd'),JSON[_0xe908('0xe')](_0xab6e38));if(_0xab6e38[_0xe908('0xf')]){if(_0xab6e38[_0xe908('0xf')][_0xe908('0x10')]===0x1f4){logger[_0xe908('0xf')]('MemberReport,\x20%s,\x20%s',_0x1f6cd2,_0xab6e38['error'][_0xe908('0x11')]);return _0x57dacd(_0xab6e38['error'][_0xe908('0x11')]);}logger[_0xe908('0xf')](_0xe908('0x12'),_0x1f6cd2,_0xab6e38[_0xe908('0xf')][_0xe908('0x11')]);return _0x6e8920(_0xab6e38['error'][_0xe908('0x11')]);}else{logger[_0xe908('0xa')](_0xe908('0x12'),_0x1f6cd2,_0xe908('0xd'));_0x6e8920(_0xab6e38['result']['message']);}})['catch'](function(_0x2aead7){logger[_0xe908('0xf')](_0xe908('0x12'),_0x1f6cd2,_0x2aead7);_0x57dacd(_0x2aead7);});});}exports[_0xe908('0x13')]=function(_0x5134e4){var _0x1e0032=this;return new Promise(function(_0x28b2a1,_0x457c57){return db[_0xe908('0x14')][_0xe908('0x15')]({'raw':_0x5134e4['options']?_0x5134e4[_0xe908('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5134e4[_0xe908('0x16')]?_0x5134e4[_0xe908('0x16')][_0xe908('0x17')]||null:null,'attributes':_0x5134e4[_0xe908('0x16')]?_0x5134e4[_0xe908('0x16')][_0xe908('0x18')]||null:null,'limit':_0x5134e4[_0xe908('0x16')]?_0x5134e4[_0xe908('0x16')][_0xe908('0x19')]||null:null,'include':_0x5134e4[_0xe908('0x16')]?_0x5134e4[_0xe908('0x16')][_0xe908('0x1a')]?_[_0xe908('0x1b')](_0x5134e4[_0xe908('0x16')][_0xe908('0x1a')],function(_0x537e56){return{'model':db[_0x537e56['model']],'as':_0x537e56['as'],'attributes':_0x537e56[_0xe908('0x18')],'include':_0x537e56[_0xe908('0x1a')]?_[_0xe908('0x1b')](_0x537e56['include'],function(_0x541d81){return{'model':db[_0x541d81[_0xe908('0x1c')]],'as':_0x541d81['as'],'attributes':_0x541d81['attributes'],'include':_0x541d81[_0xe908('0x1a')]?_[_0xe908('0x1b')](_0x541d81[_0xe908('0x1a')],function(_0x69f6c0){return{'model':db[_0x69f6c0[_0xe908('0x1c')]],'as':_0x69f6c0['as'],'attributes':_0x69f6c0['attributes']};}):[]};}):[]};}):[]:[]})[_0xe908('0x1d')](function(_0x19e180){logger[_0xe908('0xa')](_0xe908('0x13'),_0x5134e4);logger[_0xe908('0xb')]('GetMemberReport',_0x5134e4,JSON[_0xe908('0xe')](_0x19e180));_0x28b2a1(_0x19e180);})[_0xe908('0x1e')](function(_0x29ce56){logger[_0xe908('0xf')](_0xe908('0x13'),_0x29ce56[_0xe908('0x11')],_0x5134e4);_0x457c57(_0x1e0032[_0xe908('0xf')](0x1f4,_0x29ce56[_0xe908('0x11')]));});});};exports['CreateMemberReport']=function(_0xda590f){var _0x99fd59=this;return new Promise(function(_0x132dfa,_0x160aad){return db[_0xe908('0x14')][_0xe908('0x1f')](_0xda590f[_0xe908('0x20')],{'raw':_0xda590f[_0xe908('0x16')]?_0xda590f[_0xe908('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xe908('0x1d')](function(_0x5e3bc9){logger[_0xe908('0xa')](_0xe908('0x21'),_0xda590f);logger['debug'](_0xe908('0x21'),_0xda590f,JSON['stringify'](_0x5e3bc9));_0x132dfa(_0x5e3bc9);})['catch'](function(_0x459a85){logger[_0xe908('0xf')](_0xe908('0x21'),_0x459a85[_0xe908('0x11')],_0xda590f);_0x160aad(_0x99fd59['error'](0x1f4,_0x459a85[_0xe908('0x11')]));});});};exports['UpdateMemberReport']=function(_0x43904f){var _0x484529=this;return new Promise(function(_0x12e2e5,_0x495a99){return db[_0xe908('0x14')][_0xe908('0x22')](_0x43904f[_0xe908('0x20')],{'raw':_0x43904f[_0xe908('0x16')]?_0x43904f[_0xe908('0x16')][_0xe908('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43904f[_0xe908('0x16')]?_0x43904f[_0xe908('0x16')]['where']||null:null,'attributes':_0x43904f[_0xe908('0x16')]?_0x43904f[_0xe908('0x16')][_0xe908('0x18')]||null:null,'limit':_0x43904f[_0xe908('0x16')]?_0x43904f[_0xe908('0x16')][_0xe908('0x19')]||null:null})[_0xe908('0x1d')](function(_0x446ddc){logger[_0xe908('0xa')](_0xe908('0x24'),_0x43904f);logger[_0xe908('0xb')](_0xe908('0x24'),_0x43904f,JSON['stringify'](_0x446ddc));_0x12e2e5(_0x446ddc);})[_0xe908('0x1e')](function(_0x513f6e){logger[_0xe908('0xf')](_0xe908('0x24'),_0x513f6e[_0xe908('0x11')],_0x43904f);_0x495a99(_0x484529[_0xe908('0xf')](0x1f4,_0x513f6e[_0xe908('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 84d76a9..afc7913 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 _0x7553=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','exports'];(function(_0x2e58c7,_0x23d092){var _0x26eb00=function(_0x343124){while(--_0x343124){_0x2e58c7['push'](_0x2e58c7['shift']());}};_0x26eb00(++_0x23d092);}(_0x7553,0x1c3));var _0x3755=function(_0x45cea1,_0x45db40){_0x45cea1=_0x45cea1-0x0;var _0xda8ddd=_0x7553[_0x45cea1];return _0xda8ddd;};'use strict';var multer=require(_0x3755('0x0'));var util=require(_0x3755('0x1'));var path=require('path');var timeout=require(_0x3755('0x2'));var express=require(_0x3755('0x3'));var router=express[_0x3755('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3755('0x5'));var interaction=require(_0x3755('0x6'));var config=require(_0x3755('0x7'));var controller=require(_0x3755('0x8'));router[_0x3755('0x9')]('/',controller['index']);module[_0x3755('0xa')]=router; \ No newline at end of file +var _0x943a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path'];(function(_0x58fbb5,_0x3d0990){var _0x3db1e3=function(_0x417efb){while(--_0x417efb){_0x58fbb5['push'](_0x58fbb5['shift']());}};_0x3db1e3(++_0x3d0990);}(_0x943a,0x1aa));var _0xa943=function(_0xe0e597,_0x415663){_0xe0e597=_0xe0e597-0x0;var _0x1e09a6=_0x943a[_0xe0e597];return _0x1e09a6;};'use strict';var multer=require(_0xa943('0x0'));var util=require(_0xa943('0x1'));var path=require(_0xa943('0x2'));var timeout=require(_0xa943('0x3'));var express=require(_0xa943('0x4'));var router=express[_0xa943('0x5')]();var fs_extra=require(_0xa943('0x6'));var auth=require(_0xa943('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa943('0x8'));var controller=require(_0xa943('0x9'));router[_0xa943('0xa')]('/',controller[_0xa943('0xb')]);module[_0xa943('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 24085cf..33daebf 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 _0x39ef=['sequelize','STRING'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x39ef,0x16a));var _0xf39e=function(_0x185f00,_0x1f9754){_0x185f00=_0x185f00-0x0;var _0x2ef08e=_0x39ef[_0x185f00];return _0x2ef08e;};'use strict';var Sequelize=require(_0xf39e('0x0'));module['exports']={'version':{'type':Sequelize[_0xf39e('0x1')],'unique':'version'}}; \ No newline at end of file +var _0xd5be=['STRING','sequelize','exports'];(function(_0x2e6562,_0x5733c9){var _0x1dbc84=function(_0x305c28){while(--_0x305c28){_0x2e6562['push'](_0x2e6562['shift']());}};_0x1dbc84(++_0x5733c9);}(_0xd5be,0xa6));var _0xed5b=function(_0x3b0c9d,_0x3ddeb5){_0x3b0c9d=_0x3b0c9d-0x0;var _0xcfc8d7=_0xd5be[_0x3b0c9d];return _0xcfc8d7;};'use strict';var Sequelize=require(_0xed5b('0x0'));module[_0xed5b('0x1')]={'version':{'type':Sequelize[_0xed5b('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index c8dd4ce..fa8717a 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 _0x31f5=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','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','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','then','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','Migration','includeAll','include','rows','catch','eml-format','zip-dir'];(function(_0x57c95d,_0x520097){var _0x55ad24=function(_0xe46447){while(--_0xe46447){_0x57c95d['push'](_0x57c95d['shift']());}};_0x55ad24(++_0x520097);}(_0x31f5,0x18a));var _0x531f=function(_0x11bee4,_0x117d71){_0x11bee4=_0x11bee4-0x0;var _0x110e2a=_0x31f5[_0x11bee4];return _0x110e2a;};'use strict';var emlformat=require(_0x531f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x531f('0x1'));var jsonpatch=require(_0x531f('0x2'));var rp=require(_0x531f('0x3'));var moment=require(_0x531f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x531f('0x5'));var util=require(_0x531f('0x6'));var path=require(_0x531f('0x7'));var sox=require(_0x531f('0x8'));var csv=require(_0x531f('0x9'));var ejs=require(_0x531f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x531f('0xb'));var jsforce=require(_0x531f('0xc'));var deskjs=require(_0x531f('0xd'));var toCsv=require(_0x531f('0x9'));var querystring=require(_0x531f('0xe'));var Papa=require(_0x531f('0xf'));var Redis=require(_0x531f('0x10'));var authService=require(_0x531f('0x11'));var qs=require(_0x531f('0x12'));var as=require(_0x531f('0x13'));var hardwareService=require(_0x531f('0x14'));var logger=require(_0x531f('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x531f('0x16'));var db=require(_0x531f('0x17'))['db'];function respondWithStatusCode(_0x518e61,_0x25b399){_0x25b399=_0x25b399||0xcc;return function(_0x180009){if(_0x180009){return _0x518e61['sendStatus'](_0x25b399);}return _0x518e61[_0x531f('0x18')](_0x25b399)[_0x531f('0x19')]();};}function respondWithResult(_0x37236a,_0x3f9db2){_0x3f9db2=_0x3f9db2||0xc8;return function(_0x166ddd){if(_0x166ddd){return _0x37236a[_0x531f('0x18')](_0x3f9db2)['json'](_0x166ddd);}};}function respondWithFilteredResult(_0x2393d7,_0x36596b){return function(_0x52f46d){if(_0x52f46d){var _0x48c8e5=typeof _0x36596b[_0x531f('0x1a')]==='undefined'&&typeof _0x36596b['limit']===_0x531f('0x1b');var _0x1dadcd=_0x52f46d[_0x531f('0x1c')];var _0x453c55=_0x48c8e5?0x0:_0x36596b[_0x531f('0x1a')];var _0x495607=_0x48c8e5?_0x52f46d[_0x531f('0x1c')]:_0x36596b[_0x531f('0x1a')]+_0x36596b[_0x531f('0x1d')];var _0x5765dd;if(_0x495607>=_0x1dadcd){_0x495607=_0x1dadcd;_0x5765dd=0xc8;}else{_0x5765dd=0xce;}_0x2393d7[_0x531f('0x18')](_0x5765dd);return _0x2393d7[_0x531f('0x1e')](_0x531f('0x1f'),_0x453c55+'-'+_0x495607+'/'+_0x1dadcd)['json'](_0x52f46d);}return null;};}function patchUpdates(_0x52c64e){return function(_0x2136a7){try{jsonpatch[_0x531f('0x20')](_0x2136a7,_0x52c64e,!![]);}catch(_0x30742c){return BPromise[_0x531f('0x21')](_0x30742c);}return _0x2136a7['save']();};}function saveUpdates(_0x1748cf,_0x320cf4){return function(_0x38fefe){if(_0x38fefe){return _0x38fefe['update'](_0x1748cf)[_0x531f('0x22')](function(_0xe009c3){return _0xe009c3;});}return null;};}function removeEntity(_0x10fc92,_0x5bfff0){return function(_0x1b0307){if(_0x1b0307){return _0x1b0307['destroy']()[_0x531f('0x22')](function(){_0x10fc92['status'](0xcc)[_0x531f('0x19')]();});}};}function handleEntityNotFound(_0x3b7d34,_0x524e1c){return function(_0x46ad7f){if(!_0x46ad7f){_0x3b7d34[_0x531f('0x23')](0x194);}return _0x46ad7f;};}function handleError(_0x3a7174,_0x131935){_0x131935=_0x131935||0x1f4;return function(_0x48b2e7){logger[_0x531f('0x24')](_0x48b2e7[_0x531f('0x25')]);if(_0x48b2e7[_0x531f('0x26')]){delete _0x48b2e7[_0x531f('0x26')];}_0x3a7174['status'](_0x131935)[_0x531f('0x27')](_0x48b2e7);};}exports[_0x531f('0x28')]=function(_0x536e40,_0x13a215){var _0x43513f={},_0x353cfc={},_0xe5eb65={'count':0x0,'rows':[]};var _0x187a4a=_[_0x531f('0x29')](db['Migration']['rawAttributes'],function(_0xeaa399){return{'name':_0xeaa399[_0x531f('0x2a')],'type':_0xeaa399[_0x531f('0x2b')][_0x531f('0x2c')]};});_0x353cfc[_0x531f('0x2d')]=_[_0x531f('0x29')](_0x187a4a,'name');_0x353cfc[_0x531f('0x2e')]=_[_0x531f('0x2f')](_0x536e40[_0x531f('0x2e')]);_0x353cfc[_0x531f('0x30')]=_[_0x531f('0x31')](_0x353cfc[_0x531f('0x2d')],_0x353cfc['query']);_0x43513f[_0x531f('0x32')]=_[_0x531f('0x31')](_0x353cfc[_0x531f('0x2d')],qs[_0x531f('0x33')](_0x536e40['query']['fields']));_0x43513f[_0x531f('0x32')]=_0x43513f['attributes']['length']?_0x43513f[_0x531f('0x32')]:_0x353cfc[_0x531f('0x2d')];if(!_0x536e40[_0x531f('0x2e')][_0x531f('0x34')](_0x531f('0x35'))){_0x43513f[_0x531f('0x1d')]=qs['limit'](_0x536e40[_0x531f('0x2e')][_0x531f('0x1d')]);_0x43513f[_0x531f('0x1a')]=qs['offset'](_0x536e40[_0x531f('0x2e')][_0x531f('0x1a')]);}_0x43513f[_0x531f('0x36')]=qs[_0x531f('0x37')](_0x536e40[_0x531f('0x2e')][_0x531f('0x37')]);_0x43513f['where']=qs[_0x531f('0x30')](_[_0x531f('0x38')](_0x536e40[_0x531f('0x2e')],_0x353cfc[_0x531f('0x30')]),_0x187a4a);if(_0x536e40[_0x531f('0x2e')]['filter']){_0x43513f[_0x531f('0x39')]=_[_0x531f('0x3a')](_0x43513f[_0x531f('0x39')],{'$or':_['map'](_0x187a4a,function(_0x208efa){if(_0x208efa[_0x531f('0x2b')]!==_0x531f('0x3b')){var _0x59dee1={};_0x59dee1[_0x208efa[_0x531f('0x26')]]={'$like':'%'+_0x536e40['query']['filter']+'%'};return _0x59dee1;}})});}_0x43513f=_[_0x531f('0x3a')]({},_0x43513f,_0x536e40[_0x531f('0x3c')]);var _0x5f5954={'where':_0x43513f[_0x531f('0x39')]};return db[_0x531f('0x3d')][_0x531f('0x1c')](_0x5f5954)[_0x531f('0x22')](function(_0x21dc7b){_0xe5eb65[_0x531f('0x1c')]=_0x21dc7b;if(_0x536e40[_0x531f('0x2e')][_0x531f('0x3e')]){_0x43513f[_0x531f('0x3f')]=[{'all':!![]}];}return db[_0x531f('0x3d')]['findAll'](_0x43513f);})[_0x531f('0x22')](function(_0x148753){_0xe5eb65[_0x531f('0x40')]=_0x148753;return _0xe5eb65;})[_0x531f('0x22')](respondWithFilteredResult(_0x13a215,_0x43513f))[_0x531f('0x41')](handleError(_0x13a215,null));}; \ No newline at end of file +var _0x248b=['map','Migration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','index'];(function(_0xd038ec,_0x1d14b1){var _0xc3fec=function(_0x51a09f){while(--_0x51a09f){_0xd038ec['push'](_0xd038ec['shift']());}};_0xc3fec(++_0x1d14b1);}(_0x248b,0x167));var _0xb248=function(_0x43e7d8,_0x12f692){_0x43e7d8=_0x43e7d8-0x0;var _0x24bb71=_0x248b[_0x43e7d8];return _0x24bb71;};'use strict';var emlformat=require(_0xb248('0x0'));var rimraf=require(_0xb248('0x1'));var zipdir=require(_0xb248('0x2'));var jsonpatch=require(_0xb248('0x3'));var rp=require('request-promise');var moment=require(_0xb248('0x4'));var BPromise=require(_0xb248('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb248('0x6'));var sox=require(_0xb248('0x7'));var csv=require(_0xb248('0x8'));var ejs=require(_0xb248('0x9'));var fs=require('fs');var fs_extra=require(_0xb248('0xa'));var _=require(_0xb248('0xb'));var squel=require(_0xb248('0xc'));var crypto=require(_0xb248('0xd'));var jsforce=require(_0xb248('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb248('0xf'));var Redis=require(_0xb248('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb248('0x11'));var as=require(_0xb248('0x12'));var hardwareService=require(_0xb248('0x13'));var logger=require(_0xb248('0x14'))(_0xb248('0x15'));var utils=require(_0xb248('0x16'));var config=require(_0xb248('0x17'));var licenseUtil=require(_0xb248('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x515636,_0x3419fe){_0x3419fe=_0x3419fe||0xcc;return function(_0x512ab0){if(_0x512ab0){return _0x515636['sendStatus'](_0x3419fe);}return _0x515636[_0xb248('0x19')](_0x3419fe)['end']();};}function respondWithResult(_0x461dd2,_0x5d7609){_0x5d7609=_0x5d7609||0xc8;return function(_0x13618d){if(_0x13618d){return _0x461dd2['status'](_0x5d7609)[_0xb248('0x1a')](_0x13618d);}};}function respondWithFilteredResult(_0x51d727,_0x43171e){return function(_0x42ceaf){if(_0x42ceaf){var _0x566e4e=typeof _0x43171e[_0xb248('0x1b')]==='undefined'&&typeof _0x43171e[_0xb248('0x1c')]===_0xb248('0x1d');var _0x25036d=_0x42ceaf[_0xb248('0x1e')];var _0x199560=_0x566e4e?0x0:_0x43171e[_0xb248('0x1b')];var _0x1960ba=_0x566e4e?_0x42ceaf[_0xb248('0x1e')]:_0x43171e[_0xb248('0x1b')]+_0x43171e['limit'];var _0x5a385a;if(_0x1960ba>=_0x25036d){_0x1960ba=_0x25036d;_0x5a385a=0xc8;}else{_0x5a385a=0xce;}_0x51d727['status'](_0x5a385a);return _0x51d727[_0xb248('0x1f')](_0xb248('0x20'),_0x199560+'-'+_0x1960ba+'/'+_0x25036d)['json'](_0x42ceaf);}return null;};}function patchUpdates(_0x3b33dd){return function(_0x325f04){try{jsonpatch[_0xb248('0x21')](_0x325f04,_0x3b33dd,!![]);}catch(_0x20df7b){return BPromise[_0xb248('0x22')](_0x20df7b);}return _0x325f04['save']();};}function saveUpdates(_0x39364b,_0x569d5c){return function(_0x159e6f){if(_0x159e6f){return _0x159e6f[_0xb248('0x23')](_0x39364b)[_0xb248('0x24')](function(_0x38d992){return _0x38d992;});}return null;};}function removeEntity(_0x4567e6,_0x1462ed){return function(_0x3d5a5d){if(_0x3d5a5d){return _0x3d5a5d[_0xb248('0x25')]()[_0xb248('0x24')](function(){_0x4567e6[_0xb248('0x19')](0xcc)[_0xb248('0x26')]();});}};}function handleEntityNotFound(_0x581e28,_0x4e6eea){return function(_0x3787d6){if(!_0x3787d6){_0x581e28['sendStatus'](0x194);}return _0x3787d6;};}function handleError(_0x137ba1,_0x38d49c){_0x38d49c=_0x38d49c||0x1f4;return function(_0x90bd35){logger[_0xb248('0x27')](_0x90bd35['stack']);if(_0x90bd35[_0xb248('0x28')]){delete _0x90bd35[_0xb248('0x28')];}_0x137ba1[_0xb248('0x19')](_0x38d49c)[_0xb248('0x29')](_0x90bd35);};}exports[_0xb248('0x2a')]=function(_0x7797aa,_0xa734d3){var _0xd23a06={},_0x3e7d1d={},_0x2e6437={'count':0x0,'rows':[]};var _0x12f53a=_[_0xb248('0x2b')](db[_0xb248('0x2c')][_0xb248('0x2d')],function(_0x9315e1){return{'name':_0x9315e1[_0xb248('0x2e')],'type':_0x9315e1[_0xb248('0x2f')][_0xb248('0x30')]};});_0x3e7d1d[_0xb248('0x31')]=_[_0xb248('0x2b')](_0x12f53a,_0xb248('0x28'));_0x3e7d1d['query']=_[_0xb248('0x32')](_0x7797aa[_0xb248('0x33')]);_0x3e7d1d[_0xb248('0x34')]=_[_0xb248('0x35')](_0x3e7d1d[_0xb248('0x31')],_0x3e7d1d['query']);_0xd23a06[_0xb248('0x36')]=_[_0xb248('0x35')](_0x3e7d1d['model'],qs['fields'](_0x7797aa[_0xb248('0x33')]['fields']));_0xd23a06['attributes']=_0xd23a06['attributes'][_0xb248('0x37')]?_0xd23a06[_0xb248('0x36')]:_0x3e7d1d[_0xb248('0x31')];if(!_0x7797aa[_0xb248('0x33')][_0xb248('0x38')]('nolimit')){_0xd23a06[_0xb248('0x1c')]=qs[_0xb248('0x1c')](_0x7797aa['query'][_0xb248('0x1c')]);_0xd23a06[_0xb248('0x1b')]=qs[_0xb248('0x1b')](_0x7797aa[_0xb248('0x33')][_0xb248('0x1b')]);}_0xd23a06[_0xb248('0x39')]=qs['sort'](_0x7797aa[_0xb248('0x33')][_0xb248('0x3a')]);_0xd23a06[_0xb248('0x3b')]=qs['filters'](_[_0xb248('0x3c')](_0x7797aa['query'],_0x3e7d1d[_0xb248('0x34')]),_0x12f53a);if(_0x7797aa[_0xb248('0x33')][_0xb248('0x3d')]){_0xd23a06['where']=_[_0xb248('0x3e')](_0xd23a06[_0xb248('0x3b')],{'$or':_[_0xb248('0x2b')](_0x12f53a,function(_0x19d1ee){if(_0x19d1ee[_0xb248('0x2f')]!==_0xb248('0x3f')){var _0x3b7ed1={};_0x3b7ed1[_0x19d1ee['name']]={'$like':'%'+_0x7797aa['query'][_0xb248('0x3d')]+'%'};return _0x3b7ed1;}})});}_0xd23a06=_[_0xb248('0x3e')]({},_0xd23a06,_0x7797aa[_0xb248('0x40')]);var _0x3c4bcf={'where':_0xd23a06[_0xb248('0x3b')]};return db['Migration'][_0xb248('0x1e')](_0x3c4bcf)['then'](function(_0x22decd){_0x2e6437[_0xb248('0x1e')]=_0x22decd;if(_0x7797aa['query'][_0xb248('0x41')]){_0xd23a06['include']=[{'all':!![]}];}return db[_0xb248('0x2c')]['findAll'](_0xd23a06);})[_0xb248('0x24')](function(_0x1b280c){_0x2e6437[_0xb248('0x42')]=_0x1b280c;return _0x2e6437;})[_0xb248('0x24')](respondWithFilteredResult(_0xa734d3,_0xd23a06))['catch'](handleError(_0xa734d3,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index cb6bf32..e2641e6 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 _0x7a40=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','migrations'];(function(_0x3553c6,_0x2f1dd4){var _0x1d36e6=function(_0x435aec){while(--_0x435aec){_0x3553c6['push'](_0x3553c6['shift']());}};_0x1d36e6(++_0x2f1dd4);}(_0x7a40,0x1ad));var _0x07a4=function(_0x1f21e5,_0x322b83){_0x1f21e5=_0x1f21e5-0x0;var _0x298037=_0x7a40[_0x1f21e5];return _0x298037;};'use strict';var _=require(_0x07a4('0x0'));var util=require('util');var logger=require(_0x07a4('0x1'))(_0x07a4('0x2'));var moment=require(_0x07a4('0x3'));var BPromise=require(_0x07a4('0x4'));var rp=require(_0x07a4('0x5'));var fs=require('fs');var path=require(_0x07a4('0x6'));var rimraf=require(_0x07a4('0x7'));var config=require(_0x07a4('0x8'));var attributes=require(_0x07a4('0x9'));module[_0x07a4('0xa')]=function(_0x5528ef,_0xfd2026){return _0x5528ef[_0x07a4('0xb')]('Migration',attributes,{'tableName':_0x07a4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x273f=['moment','bluebird','request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash','util','api'];(function(_0x1dbb4a,_0x2a2803){var _0x537b13=function(_0x2c45e1){while(--_0x2c45e1){_0x1dbb4a['push'](_0x1dbb4a['shift']());}};_0x537b13(++_0x2a2803);}(_0x273f,0xd5));var _0xf273=function(_0x434d98,_0xf8b99b){_0x434d98=_0x434d98-0x0;var _0x206138=_0x273f[_0x434d98];return _0x206138;};'use strict';var _=require(_0xf273('0x0'));var util=require(_0xf273('0x1'));var logger=require('../../config/logger')(_0xf273('0x2'));var moment=require(_0xf273('0x3'));var BPromise=require(_0xf273('0x4'));var rp=require(_0xf273('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf273('0x6'));var config=require(_0xf273('0x7'));var attributes=require(_0xf273('0x8'));module[_0xf273('0x9')]=function(_0x23616f,_0x392788){return _0x23616f[_0xf273('0xa')]('Migration',attributes,{'tableName':_0xf273('0xb'),'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 0d9ca57..fcf4409 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 _0xcc40=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xcc40,0x97));var _0x0cc4=function(_0x36a974,_0x381b74){_0x36a974=_0x36a974-0x0;var _0x2d0781=_0xcc40[_0x36a974];return _0x2d0781;};'use strict';var _=require(_0x0cc4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0cc4('0x1'));var rs=require(_0x0cc4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cc4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cc4('0x4'))(_0x0cc4('0x5'));var config=require('../../config/environment');var jayson=require(_0x0cc4('0x6'));var client=jayson['client'][_0x0cc4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x58f080,_0x5e1afa,_0x349c6a){return new BPromise(function(_0x2fd087,_0x2f00f3){return client['request'](_0x58f080,_0x349c6a)['then'](function(_0x7e2dbf){logger[_0x0cc4('0x8')]('Migration,\x20%s,\x20%s',_0x5e1afa,'request\x20sent');logger[_0x0cc4('0x9')](_0x0cc4('0xa'),_0x5e1afa,_0x0cc4('0xb'),JSON[_0x0cc4('0xc')](_0x7e2dbf));if(_0x7e2dbf[_0x0cc4('0xd')]){if(_0x7e2dbf[_0x0cc4('0xd')][_0x0cc4('0xe')]===0x1f4){logger[_0x0cc4('0xd')](_0x0cc4('0xf'),_0x5e1afa,_0x7e2dbf[_0x0cc4('0xd')][_0x0cc4('0x10')]);return _0x2f00f3(_0x7e2dbf[_0x0cc4('0xd')][_0x0cc4('0x10')]);}logger[_0x0cc4('0xd')](_0x0cc4('0xf'),_0x5e1afa,_0x7e2dbf['error'][_0x0cc4('0x10')]);return _0x2fd087(_0x7e2dbf[_0x0cc4('0xd')][_0x0cc4('0x10')]);}else{logger[_0x0cc4('0x8')](_0x0cc4('0xf'),_0x5e1afa,'request\x20sent');_0x2fd087(_0x7e2dbf[_0x0cc4('0x11')][_0x0cc4('0x10')]);}})[_0x0cc4('0x12')](function(_0x439755){logger['error'](_0x0cc4('0xf'),_0x5e1afa,_0x439755);_0x2f00f3(_0x439755);});});} \ No newline at end of file +var _0x14b7=['then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x14b7,0x144));var _0x714b=function(_0x368c85,_0x586b0a){_0x368c85=_0x368c85-0x0;var _0x3477c2=_0x14b7[_0x368c85];return _0x3477c2;};'use strict';var _=require(_0x714b('0x0'));var util=require(_0x714b('0x1'));var moment=require(_0x714b('0x2'));var BPromise=require(_0x714b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x714b('0x4'));var db=require(_0x714b('0x5'))['db'];var utils=require(_0x714b('0x6'));var logger=require(_0x714b('0x7'))(_0x714b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x714b('0x9')][_0x714b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a0a91,_0x5ee9a5,_0x39b5e4){return new BPromise(function(_0x26489c,_0x53f14c){return client[_0x714b('0xb')](_0x2a0a91,_0x39b5e4)[_0x714b('0xc')](function(_0x50dab0){logger[_0x714b('0xd')](_0x714b('0xe'),_0x5ee9a5,_0x714b('0xf'));logger['debug'](_0x714b('0x10'),_0x5ee9a5,'request\x20sent',JSON['stringify'](_0x50dab0));if(_0x50dab0[_0x714b('0x11')]){if(_0x50dab0[_0x714b('0x11')]['code']===0x1f4){logger[_0x714b('0x11')](_0x714b('0xe'),_0x5ee9a5,_0x50dab0[_0x714b('0x11')][_0x714b('0x12')]);return _0x53f14c(_0x50dab0['error'][_0x714b('0x12')]);}logger['error'](_0x714b('0xe'),_0x5ee9a5,_0x50dab0[_0x714b('0x11')][_0x714b('0x12')]);return _0x26489c(_0x50dab0[_0x714b('0x11')][_0x714b('0x12')]);}else{logger[_0x714b('0xd')](_0x714b('0xe'),_0x5ee9a5,_0x714b('0xf'));_0x26489c(_0x50dab0[_0x714b('0x13')][_0x714b('0x12')]);}})[_0x714b('0x14')](function(_0x1d81b3){logger['error'](_0x714b('0xe'),_0x5ee9a5,_0x1d81b3);_0x53f14c(_0x1d81b3);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 84edae1..6aacd10 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 _0xcbe7=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','put','update','destroy','util','path'];(function(_0x42ee1e,_0x3f1a64){var _0x1e21b8=function(_0x56098b){while(--_0x56098b){_0x42ee1e['push'](_0x42ee1e['shift']());}};_0x1e21b8(++_0x3f1a64);}(_0xcbe7,0x152));var _0x7cbe=function(_0x32ed2c,_0x133299){_0x32ed2c=_0x32ed2c-0x0;var _0x7d7900=_0xcbe7[_0x32ed2c];return _0x7d7900;};'use strict';var multer=require('multer');var util=require(_0x7cbe('0x0'));var path=require(_0x7cbe('0x1'));var timeout=require(_0x7cbe('0x2'));var express=require(_0x7cbe('0x3'));var router=express[_0x7cbe('0x4')]();var fs_extra=require(_0x7cbe('0x5'));var auth=require(_0x7cbe('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7cbe('0x7'));var controller=require('./network.controller');router['get']('/',auth[_0x7cbe('0x8')](),controller[_0x7cbe('0x9')]);router[_0x7cbe('0xa')](_0x7cbe('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7cbe('0xc')]('/',auth[_0x7cbe('0x8')](),controller[_0x7cbe('0xd')]);router[_0x7cbe('0xe')](_0x7cbe('0xb'),auth['isAuthenticated'](),controller[_0x7cbe('0xf')]);router['delete'](_0x7cbe('0xb'),auth[_0x7cbe('0x8')](),controller[_0x7cbe('0x10')]);module['exports']=router; \ No newline at end of file +var _0x649f=['update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','put','/:id'];(function(_0x2d435b,_0x1943f6){var _0x10ff4d=function(_0x5142c6){while(--_0x5142c6){_0x2d435b['push'](_0x2d435b['shift']());}};_0x10ff4d(++_0x1943f6);}(_0x649f,0x93));var _0xf649=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x649f[_0x1573ea];return _0x51c0e2;};'use strict';var multer=require(_0xf649('0x0'));var util=require(_0xf649('0x1'));var path=require(_0xf649('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf649('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf649('0x4'));var interaction=require(_0xf649('0x5'));var config=require(_0xf649('0x6'));var controller=require(_0xf649('0x7'));router[_0xf649('0x8')]('/',auth[_0xf649('0x9')](),controller[_0xf649('0xa')]);router[_0xf649('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf649('0xb')]);router[_0xf649('0xc')]('/',auth[_0xf649('0x9')](),controller['create']);router[_0xf649('0xd')](_0xf649('0xe'),auth[_0xf649('0x9')](),controller[_0xf649('0xf')]);router['delete'](_0xf649('0xe'),auth[_0xf649('0x9')](),controller[_0xf649('0x10')]);module[_0xf649('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 8b1a558..2ecdf44 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 _0x9d07=['stun','turn','STRING','sequelize','exports','ENUM','localnet'];(function(_0x576e3a,_0x540867){var _0x4c8b0e=function(_0x4869d0){while(--_0x4869d0){_0x576e3a['push'](_0x576e3a['shift']());}};_0x4c8b0e(++_0x540867);}(_0x9d07,0xa4));var _0x79d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d07[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x79d0('0x0'));module[_0x79d0('0x1')]={'type':{'type':Sequelize[_0x79d0('0x2')](_0x79d0('0x3'),'externip',_0x79d0('0x4'),_0x79d0('0x5'))},'value':{'type':Sequelize[_0x79d0('0x6')]},'username':{'type':Sequelize[_0x79d0('0x6')]},'password':{'type':Sequelize[_0x79d0('0x6')]}}; \ No newline at end of file +var _0x7ec6=['localnet','stun','turn','exports','ENUM'];(function(_0x3f9044,_0x37a904){var _0x2988dd=function(_0x447542){while(--_0x447542){_0x3f9044['push'](_0x3f9044['shift']());}};_0x2988dd(++_0x37a904);}(_0x7ec6,0x102));var _0x67ec=function(_0xe2b8fc,_0x3ec76a){_0xe2b8fc=_0xe2b8fc-0x0;var _0x1bfefb=_0x7ec6[_0xe2b8fc];return _0x1bfefb;};'use strict';var Sequelize=require('sequelize');module[_0x67ec('0x0')]={'type':{'type':Sequelize[_0x67ec('0x1')](_0x67ec('0x2'),'externip',_0x67ec('0x3'),_0x67ec('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'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 4db7312..7f9bc02 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 _0xc585=['debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','undefined','limit','count','update','destroy','end','sendStatus','stack','name','index','map','Network','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','findAll','show','rawAttributes','include','catch','create','body','STUN','join','root','writeFileSync','res_stun_monitor.so','readFileSync','server/files/templates/turn_multiple.ejs','utf8','render','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','toUpperCase','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','TURN','params','util','path','ejs','lodash','../../components/parsers/qs','api','client','request','then','Network,\x20%s,\x20%s','request\x20sent'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc585,0xee));var _0x5c58=function(_0x37e74e,_0x46455b){_0x37e74e=_0x37e74e-0x0;var _0x80d023=_0xc585[_0x37e74e];return _0x80d023;};'use strict';var util=require(_0x5c58('0x0'));var path=require(_0x5c58('0x1'));var ejs=require(_0x5c58('0x2'));var fs=require('fs');var _=require(_0x5c58('0x3'));var qs=require(_0x5c58('0x4'));var logger=require('../../config/logger')(_0x5c58('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x5c58('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f1241,_0x61c74,_0x45e23c,_0x59952b){return new Promise(function(_0x1345c9,_0x2674d9){var _0x1323db=_0x59952b||client;return _0x1323db[_0x5c58('0x7')](_0x3f1241,_0x45e23c)[_0x5c58('0x8')](function(_0x4e41da){logger['info'](_0x5c58('0x9'),_0x61c74,_0x5c58('0xa'));logger[_0x5c58('0xb')](_0x5c58('0xc'),_0x61c74,'request\x20sent',JSON[_0x5c58('0xd')](_0x4e41da));if(_0x4e41da[_0x5c58('0xe')]){if(_0x4e41da[_0x5c58('0xe')][_0x5c58('0xf')]===0x1f4){logger[_0x5c58('0xe')](_0x5c58('0x9'),_0x61c74,_0x4e41da[_0x5c58('0xe')]['message']);return _0x2674d9(_0x4e41da[_0x5c58('0xe')][_0x5c58('0x10')]);}logger[_0x5c58('0xe')]('Network,\x20%s,\x20%s',_0x61c74,_0x4e41da[_0x5c58('0xe')][_0x5c58('0x10')]);return _0x1345c9(_0x4e41da['error'][_0x5c58('0x10')]);}else{logger['info'](_0x5c58('0x9'),_0x61c74,_0x5c58('0xa'));_0x1345c9(_0x4e41da[_0x5c58('0x11')][_0x5c58('0x10')]);}})['catch'](function(_0x1cd0b2){logger[_0x5c58('0xe')](_0x5c58('0x9'),_0x61c74,_0x1cd0b2);_0x2674d9(_0x1cd0b2);});});}function respondWithResult(_0x22124d,_0x5e745d){_0x5e745d=_0x5e745d||0xc8;return function(_0x51e995){if(_0x51e995){return _0x22124d[_0x5c58('0x12')](_0x5e745d)[_0x5c58('0x13')](_0x51e995);}};}function respondWithFilteredResult(_0x2b5afa,_0x345b47){return function(_0x2464c2){if(_0x2464c2){var _0x374865=typeof _0x345b47[_0x5c58('0x14')]===_0x5c58('0x15')&&typeof _0x345b47[_0x5c58('0x16')]===_0x5c58('0x15');var _0x54b61e=_0x2464c2[_0x5c58('0x17')];var _0x1dccf2=_0x374865?0x0:_0x345b47[_0x5c58('0x14')];var _0x1a3f6d=_0x374865?_0x2464c2[_0x5c58('0x17')]:_0x345b47['offset']+_0x345b47[_0x5c58('0x16')];var _0x59f2d3;if(_0x1a3f6d>=_0x54b61e){_0x1a3f6d=_0x54b61e;_0x59f2d3=0xc8;}else{_0x59f2d3=0xce;}_0x2b5afa[_0x5c58('0x12')](_0x59f2d3);return _0x2b5afa['set']('Content-Range',_0x1dccf2+'-'+_0x1a3f6d+'/'+_0x54b61e)['json'](_0x2464c2);}return null;};}function saveUpdates(_0x4893bc){return function(_0x1b2fff){if(_0x1b2fff){return _0x1b2fff[_0x5c58('0x18')](_0x4893bc)['then'](function(_0x3bcca2){return _0x3bcca2;});}return null;};}function removeEntity(_0x4e485e){return function(_0x5e5813){if(_0x5e5813){return _0x5e5813[_0x5c58('0x19')]()[_0x5c58('0x8')](function(){_0x4e485e[_0x5c58('0x12')](0xcc)[_0x5c58('0x1a')]();});}};}function handleEntityNotFound(_0xb6bd9c){return function(_0x5b8253){if(!_0x5b8253){_0xb6bd9c[_0x5c58('0x1b')](0x194);}return _0x5b8253;};}function handleError(_0x2ea08b,_0x322a5f){_0x322a5f=_0x322a5f||0x1f4;return function(_0x43b7f3){logger[_0x5c58('0xe')](_0x43b7f3[_0x5c58('0x1c')]);if(_0x43b7f3['name']){delete _0x43b7f3[_0x5c58('0x1d')];}_0x2ea08b[_0x5c58('0x12')](_0x322a5f)['send'](_0x43b7f3);};}exports[_0x5c58('0x1e')]=function(_0x58424d,_0x17e19a){var _0x5daa77={},_0x44ccb2={},_0x10551b={'count':0x0,'rows':[]};var _0x59441d=_[_0x5c58('0x1f')](db[_0x5c58('0x20')]['rawAttributes'],function(_0x313243){return{'name':_0x313243[_0x5c58('0x21')],'type':_0x313243[_0x5c58('0x22')][_0x5c58('0x23')]};});_0x44ccb2[_0x5c58('0x24')]=_[_0x5c58('0x1f')](_0x59441d,'name');_0x44ccb2['query']=_[_0x5c58('0x25')](_0x58424d['query']);_0x44ccb2[_0x5c58('0x26')]=_[_0x5c58('0x27')](_0x44ccb2[_0x5c58('0x24')],_0x44ccb2['query']);_0x5daa77[_0x5c58('0x28')]=_[_0x5c58('0x27')](_0x44ccb2[_0x5c58('0x24')],qs[_0x5c58('0x29')](_0x58424d[_0x5c58('0x2a')]['fields']));_0x5daa77[_0x5c58('0x28')]=_0x5daa77[_0x5c58('0x28')][_0x5c58('0x2b')]?_0x5daa77[_0x5c58('0x28')]:_0x44ccb2[_0x5c58('0x24')];if(!_0x58424d[_0x5c58('0x2a')][_0x5c58('0x2c')](_0x5c58('0x2d'))){_0x5daa77[_0x5c58('0x16')]=qs[_0x5c58('0x16')](_0x58424d[_0x5c58('0x2a')][_0x5c58('0x16')]);_0x5daa77['offset']=qs[_0x5c58('0x14')](_0x58424d['query'][_0x5c58('0x14')]);}_0x5daa77[_0x5c58('0x2e')]=qs[_0x5c58('0x2f')](_0x58424d[_0x5c58('0x2a')][_0x5c58('0x2f')]);_0x5daa77['where']=qs['filters'](_[_0x5c58('0x30')](_0x58424d['query'],_0x44ccb2[_0x5c58('0x26')]),_0x59441d);if(_0x58424d['query'][_0x5c58('0x31')]){_0x5daa77['where']=_[_0x5c58('0x32')](_0x5daa77[_0x5c58('0x33')],{'$or':_['map'](_0x59441d,function(_0x174730){if(_0x174730[_0x5c58('0x22')]!=='VIRTUAL'){var _0x3f487a={};_0x3f487a[_0x174730[_0x5c58('0x1d')]]={'$like':'%'+_0x58424d[_0x5c58('0x2a')]['filter']+'%'};return _0x3f487a;}})});}_0x5daa77=_[_0x5c58('0x32')]({},_0x5daa77,_0x58424d[_0x5c58('0x34')]);var _0x13221a={'where':_0x5daa77[_0x5c58('0x33')]};return db[_0x5c58('0x20')]['count'](_0x13221a)[_0x5c58('0x8')](function(_0x5cb1dc){_0x10551b[_0x5c58('0x17')]=_0x5cb1dc;if(_0x58424d[_0x5c58('0x2a')][_0x5c58('0x35')]){_0x5daa77['include']=[{'all':!![]}];}return db[_0x5c58('0x20')][_0x5c58('0x36')](_0x5daa77);})[_0x5c58('0x8')](function(_0x10c35f){_0x10551b['rows']=_0x10c35f;return _0x10551b;})[_0x5c58('0x8')](respondWithFilteredResult(_0x17e19a,_0x5daa77))['catch'](handleError(_0x17e19a,null));};exports[_0x5c58('0x37')]=function(_0x145721,_0x20da84){var _0x2a0722={'raw':!![],'where':{'id':_0x145721['params']['id']}},_0x4314e3={};_0x4314e3[_0x5c58('0x24')]=_[_0x5c58('0x25')](db[_0x5c58('0x20')][_0x5c58('0x38')]);_0x4314e3[_0x5c58('0x2a')]=_['keys'](_0x145721['query']);_0x4314e3[_0x5c58('0x26')]=_[_0x5c58('0x27')](_0x4314e3[_0x5c58('0x24')],_0x4314e3[_0x5c58('0x2a')]);_0x2a0722[_0x5c58('0x28')]=_['intersection'](_0x4314e3[_0x5c58('0x24')],qs[_0x5c58('0x29')](_0x145721['query'][_0x5c58('0x29')]));_0x2a0722[_0x5c58('0x28')]=_0x2a0722[_0x5c58('0x28')]['length']?_0x2a0722[_0x5c58('0x28')]:_0x4314e3[_0x5c58('0x24')];if(_0x145721['query'][_0x5c58('0x35')]){_0x2a0722[_0x5c58('0x39')]=[{'all':!![]}];}_0x2a0722=_['merge']({},_0x2a0722,_0x145721[_0x5c58('0x34')]);return db[_0x5c58('0x20')]['find'](_0x2a0722)[_0x5c58('0x8')](handleEntityNotFound(_0x20da84,null))[_0x5c58('0x8')](respondWithResult(_0x20da84,null))[_0x5c58('0x3a')](handleError(_0x20da84,null));};exports[_0x5c58('0x3b')]=function(_0x13ff88,_0x4bc298){var _0x5080ba;return db[_0x5c58('0x20')][_0x5c58('0x3b')](_0x13ff88[_0x5c58('0x3c')],{'raw':!![]})['then'](function(_0x32b90a){_0x5080ba=_0x32b90a;return db['Network'][_0x5c58('0x36')]({'where':{'type':_0x13ff88[_0x5c58('0x3c')]['type']},'raw':!![]});})[_0x5c58('0x8')](function(_0x44d710){if(_0x5080ba[_0x5c58('0x22')]['toUpperCase']()==_0x5c58('0x3d')){var _0x26732c=fs['readFileSync'](path[_0x5c58('0x3e')](config[_0x5c58('0x3f')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x506bd9=ejs['render'](_0x26732c,{'networks':_0x44d710||[]});fs[_0x5c58('0x40')]('/etc/asterisk/stun_xcally.conf',_0x506bd9);return respondWithRpcPromise('Reload','create',{'module':_0x5c58('0x41')});}else if(_0x5080ba[_0x5c58('0x22')]['toUpperCase']()=='TURN'){var _0x3c1751=fs[_0x5c58('0x42')](path['join'](config[_0x5c58('0x3f')],_0x5c58('0x43')),_0x5c58('0x44'));var _0x455889=ejs[_0x5c58('0x45')](_0x3c1751,{'networks':_0x44d710||[]});fs[_0x5c58('0x40')](_0x5c58('0x46'),_0x455889);return respondWithRpcPromise(_0x5c58('0x47'),_0x5c58('0x3b'),{'module':'res_stun_monitor.so'});}else{var _0x5f3f25=fs[_0x5c58('0x42')](path[_0x5c58('0x3e')](config[_0x5c58('0x3f')],_0x5c58('0x48')),_0x5c58('0x44'));var _0x48306b=ejs[_0x5c58('0x45')](_0x5f3f25,{'networks':_0x44d710||[]});fs[_0x5c58('0x40')](util[_0x5c58('0x49')](_0x5c58('0x4a'),_0x13ff88[_0x5c58('0x3c')]['type'][_0x5c58('0x4b')]()),_0x48306b);return respondWithRpcPromise(_0x5c58('0x47'),'create',{'module':_0x5c58('0x4c')});}})[_0x5c58('0x8')](function(){return _0x5080ba;})['then'](respondWithResult(_0x4bc298,0xc9))[_0x5c58('0x3a')](handleError(_0x4bc298,null));};exports[_0x5c58('0x18')]=function(_0x58d206,_0x4ad500){var _0x37017e;return db[_0x5c58('0x20')][_0x5c58('0x4d')]({'where':{'id':_0x58d206['params']['id']}})['then'](handleEntityNotFound(_0x4ad500,null))[_0x5c58('0x8')](saveUpdates(_0x58d206[_0x5c58('0x3c')],null))[_0x5c58('0x8')](function(_0xb0245a){if(_0xb0245a){_0x37017e=_0xb0245a;return db[_0x5c58('0x20')][_0x5c58('0x36')]({'where':{'type':_0x37017e[_0x5c58('0x22')]},'raw':!![]});}return null;})[_0x5c58('0x8')](function(_0x4d7df5){if(_0x37017e[_0x5c58('0x22')][_0x5c58('0x4e')]()=='STUN'){var _0x2ac716=fs[_0x5c58('0x42')](path['join'](config['root'],_0x5c58('0x4f')),'utf8');var _0x30a9bc=ejs[_0x5c58('0x45')](_0x2ac716,{'networks':_0x4d7df5||[]});fs['writeFileSync'](_0x5c58('0x50'),_0x30a9bc);return respondWithRpcPromise(_0x5c58('0x47'),_0x5c58('0x18'),{'module':'res_stun_monitor.so'});}else if(_0x37017e[_0x5c58('0x22')][_0x5c58('0x4e')]()==_0x5c58('0x51')){var _0x338b8b=fs['readFileSync'](path['join'](config[_0x5c58('0x3f')],'server/files/templates/turn_multiple.ejs'),_0x5c58('0x44'));var _0x1ff5a0=ejs['render'](_0x338b8b,{'networks':_0x4d7df5||[]});fs[_0x5c58('0x40')](_0x5c58('0x46'),_0x1ff5a0);return respondWithRpcPromise('Reload',_0x5c58('0x18'),{'module':_0x5c58('0x41')});}else{var _0x17f263=fs[_0x5c58('0x42')](path['join'](config[_0x5c58('0x3f')],_0x5c58('0x48')),_0x5c58('0x44'));var _0x5599ae=ejs['render'](_0x17f263,{'networks':_0x4d7df5||[]});fs['writeFileSync'](util[_0x5c58('0x49')](_0x5c58('0x4a'),_0x58d206['body']['type']['toLowerCase']()),_0x5599ae);return respondWithRpcPromise('Reload',_0x5c58('0x18'),{'module':_0x5c58('0x4c')});}})['then'](function(_0x395d95){if(_0x395d95){return _0x37017e;}return null;})[_0x5c58('0x8')](respondWithResult(_0x4ad500,null))[_0x5c58('0x3a')](handleError(_0x4ad500,null));};exports[_0x5c58('0x19')]=function(_0x2f4dfd,_0x5d4cb3){var _0x3dc45f;return db[_0x5c58('0x20')][_0x5c58('0x4d')]({'where':{'id':_0x2f4dfd[_0x5c58('0x52')]['id']}})[_0x5c58('0x8')](function(_0x1bb51f){_0x3dc45f=_0x1bb51f;return _0x1bb51f;})[_0x5c58('0x8')](handleEntityNotFound(_0x5d4cb3,null))[_0x5c58('0x8')](removeEntity(_0x5d4cb3,null))[_0x5c58('0x8')](function(){if(_0x3dc45f){return db['Network']['findAll']({'where':{'type':_0x3dc45f[_0x5c58('0x22')]},'raw':!![]});}})[_0x5c58('0x8')](function(_0x3373b7){if(_0x3dc45f[_0x5c58('0x22')][_0x5c58('0x4e')]()=='STUN'){var _0x55dee3=fs['readFileSync'](path[_0x5c58('0x3e')](config[_0x5c58('0x3f')],_0x5c58('0x4f')),'utf8');var _0x3fc22b=ejs['render'](_0x55dee3,{'networks':_0x3373b7||[]});fs[_0x5c58('0x40')](_0x5c58('0x50'),_0x3fc22b);return respondWithRpcPromise(_0x5c58('0x47'),_0x5c58('0x19'),{'module':_0x5c58('0x41')});}else if(_0x3dc45f[_0x5c58('0x22')][_0x5c58('0x4e')]()==_0x5c58('0x51')){var _0x4284b3=fs[_0x5c58('0x42')](path[_0x5c58('0x3e')](config[_0x5c58('0x3f')],_0x5c58('0x43')),_0x5c58('0x44'));var _0x2bb6ae=ejs[_0x5c58('0x45')](_0x4284b3,{'networks':_0x3373b7||[]});fs[_0x5c58('0x40')]('/etc/asterisk/turn_xcally.conf',_0x2bb6ae);return respondWithRpcPromise('Reload',_0x5c58('0x19'),{'module':'res_stun_monitor.so'});}else{var _0x4a35ce=fs[_0x5c58('0x42')](path[_0x5c58('0x3e')](config[_0x5c58('0x3f')],_0x5c58('0x48')),'utf8');var _0x36d968=ejs[_0x5c58('0x45')](_0x4a35ce,{'networks':_0x3373b7||[]});fs[_0x5c58('0x40')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3dc45f[_0x5c58('0x22')]['toLowerCase']()),_0x36d968);return respondWithRpcPromise(_0x5c58('0x47'),_0x5c58('0x19'),{'module':_0x5c58('0x4c')});}})['catch'](handleError(_0x5d4cb3,null));}; \ No newline at end of file +var _0x50e2=['VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','create','TURN','server/files/templates/turn_multiple.ejs','Reload','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','/etc/asterisk/turn_xcally.conf','util','path','ejs','lodash','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','catch','json','limit','undefined','count','offset','status','set','Content-Range','update','then','destroy','end','stack','name','send','map','Network','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50e2,0x1cd));var _0x250e=function(_0x19b3f8,_0x150751){_0x19b3f8=_0x19b3f8-0x0;var _0x22c3a1=_0x50e2[_0x19b3f8];return _0x22c3a1;};'use strict';var util=require(_0x250e('0x0'));var path=require(_0x250e('0x1'));var ejs=require(_0x250e('0x2'));var fs=require('fs');var _=require(_0x250e('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x250e('0x4'))(_0x250e('0x5'));var config=require(_0x250e('0x6'));var db=require(_0x250e('0x7'))['db'];var jayson=require(_0x250e('0x8'));var client=jayson[_0x250e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ce580,_0x5ca90c,_0x3c0c57,_0x3c35ea){return new Promise(function(_0x39fcf7,_0x4aae21){var _0x5f2073=_0x3c35ea||client;return _0x5f2073[_0x250e('0xa')](_0x1ce580,_0x3c0c57)['then'](function(_0x27cb0f){logger[_0x250e('0xb')](_0x250e('0xc'),_0x5ca90c,_0x250e('0xd'));logger[_0x250e('0xe')](_0x250e('0xf'),_0x5ca90c,'request\x20sent',JSON['stringify'](_0x27cb0f));if(_0x27cb0f[_0x250e('0x10')]){if(_0x27cb0f[_0x250e('0x10')][_0x250e('0x11')]===0x1f4){logger[_0x250e('0x10')](_0x250e('0xc'),_0x5ca90c,_0x27cb0f['error'][_0x250e('0x12')]);return _0x4aae21(_0x27cb0f[_0x250e('0x10')][_0x250e('0x12')]);}logger[_0x250e('0x10')](_0x250e('0xc'),_0x5ca90c,_0x27cb0f[_0x250e('0x10')][_0x250e('0x12')]);return _0x39fcf7(_0x27cb0f[_0x250e('0x10')][_0x250e('0x12')]);}else{logger[_0x250e('0xb')](_0x250e('0xc'),_0x5ca90c,_0x250e('0xd'));_0x39fcf7(_0x27cb0f['result'][_0x250e('0x12')]);}})[_0x250e('0x13')](function(_0x28e0be){logger['error'](_0x250e('0xc'),_0x5ca90c,_0x28e0be);_0x4aae21(_0x28e0be);});});}function respondWithResult(_0x19c4ca,_0x5bfd08){_0x5bfd08=_0x5bfd08||0xc8;return function(_0x2b85bb){if(_0x2b85bb){return _0x19c4ca['status'](_0x5bfd08)[_0x250e('0x14')](_0x2b85bb);}};}function respondWithFilteredResult(_0x18da1c,_0x38ce96){return function(_0xabdb6a){if(_0xabdb6a){var _0xe096a8=typeof _0x38ce96['offset']==='undefined'&&typeof _0x38ce96[_0x250e('0x15')]===_0x250e('0x16');var _0x22308c=_0xabdb6a[_0x250e('0x17')];var _0x42cb7e=_0xe096a8?0x0:_0x38ce96[_0x250e('0x18')];var _0x19c0fe=_0xe096a8?_0xabdb6a[_0x250e('0x17')]:_0x38ce96[_0x250e('0x18')]+_0x38ce96[_0x250e('0x15')];var _0x576407;if(_0x19c0fe>=_0x22308c){_0x19c0fe=_0x22308c;_0x576407=0xc8;}else{_0x576407=0xce;}_0x18da1c[_0x250e('0x19')](_0x576407);return _0x18da1c[_0x250e('0x1a')](_0x250e('0x1b'),_0x42cb7e+'-'+_0x19c0fe+'/'+_0x22308c)[_0x250e('0x14')](_0xabdb6a);}return null;};}function saveUpdates(_0x195b48){return function(_0x42891c){if(_0x42891c){return _0x42891c[_0x250e('0x1c')](_0x195b48)[_0x250e('0x1d')](function(_0x3b429e){return _0x3b429e;});}return null;};}function removeEntity(_0x130cc8){return function(_0x354ed6){if(_0x354ed6){return _0x354ed6[_0x250e('0x1e')]()[_0x250e('0x1d')](function(){_0x130cc8['status'](0xcc)[_0x250e('0x1f')]();});}};}function handleEntityNotFound(_0x28804c){return function(_0x2258e4){if(!_0x2258e4){_0x28804c['sendStatus'](0x194);}return _0x2258e4;};}function handleError(_0x189ed1,_0x13b7d0){_0x13b7d0=_0x13b7d0||0x1f4;return function(_0x4230db){logger['error'](_0x4230db[_0x250e('0x20')]);if(_0x4230db[_0x250e('0x21')]){delete _0x4230db[_0x250e('0x21')];}_0x189ed1[_0x250e('0x19')](_0x13b7d0)[_0x250e('0x22')](_0x4230db);};}exports['index']=function(_0x5aa3f7,_0x1fd9a2){var _0x5a042f={},_0x4b77d0={},_0x920d6e={'count':0x0,'rows':[]};var _0x22145b=_[_0x250e('0x23')](db[_0x250e('0x24')][_0x250e('0x25')],function(_0xd10cc4){return{'name':_0xd10cc4[_0x250e('0x26')],'type':_0xd10cc4[_0x250e('0x27')][_0x250e('0x28')]};});_0x4b77d0['model']=_[_0x250e('0x23')](_0x22145b,_0x250e('0x21'));_0x4b77d0[_0x250e('0x29')]=_[_0x250e('0x2a')](_0x5aa3f7[_0x250e('0x29')]);_0x4b77d0[_0x250e('0x2b')]=_[_0x250e('0x2c')](_0x4b77d0[_0x250e('0x2d')],_0x4b77d0[_0x250e('0x29')]);_0x5a042f[_0x250e('0x2e')]=_[_0x250e('0x2c')](_0x4b77d0[_0x250e('0x2d')],qs['fields'](_0x5aa3f7[_0x250e('0x29')][_0x250e('0x2f')]));_0x5a042f[_0x250e('0x2e')]=_0x5a042f[_0x250e('0x2e')][_0x250e('0x30')]?_0x5a042f[_0x250e('0x2e')]:_0x4b77d0[_0x250e('0x2d')];if(!_0x5aa3f7[_0x250e('0x29')][_0x250e('0x31')](_0x250e('0x32'))){_0x5a042f[_0x250e('0x15')]=qs[_0x250e('0x15')](_0x5aa3f7[_0x250e('0x29')][_0x250e('0x15')]);_0x5a042f[_0x250e('0x18')]=qs['offset'](_0x5aa3f7[_0x250e('0x29')]['offset']);}_0x5a042f['order']=qs[_0x250e('0x33')](_0x5aa3f7[_0x250e('0x29')][_0x250e('0x33')]);_0x5a042f[_0x250e('0x34')]=qs[_0x250e('0x2b')](_['pick'](_0x5aa3f7[_0x250e('0x29')],_0x4b77d0['filters']),_0x22145b);if(_0x5aa3f7[_0x250e('0x29')][_0x250e('0x35')]){_0x5a042f[_0x250e('0x34')]=_[_0x250e('0x36')](_0x5a042f['where'],{'$or':_[_0x250e('0x23')](_0x22145b,function(_0x59fd58){if(_0x59fd58[_0x250e('0x27')]!==_0x250e('0x37')){var _0x3cc175={};_0x3cc175[_0x59fd58['name']]={'$like':'%'+_0x5aa3f7[_0x250e('0x29')][_0x250e('0x35')]+'%'};return _0x3cc175;}})});}_0x5a042f=_[_0x250e('0x36')]({},_0x5a042f,_0x5aa3f7[_0x250e('0x38')]);var _0x501f54={'where':_0x5a042f['where']};return db[_0x250e('0x24')][_0x250e('0x17')](_0x501f54)[_0x250e('0x1d')](function(_0x34bc2e){_0x920d6e['count']=_0x34bc2e;if(_0x5aa3f7['query'][_0x250e('0x39')]){_0x5a042f['include']=[{'all':!![]}];}return db[_0x250e('0x24')][_0x250e('0x3a')](_0x5a042f);})[_0x250e('0x1d')](function(_0x41cfd7){_0x920d6e[_0x250e('0x3b')]=_0x41cfd7;return _0x920d6e;})[_0x250e('0x1d')](respondWithFilteredResult(_0x1fd9a2,_0x5a042f))[_0x250e('0x13')](handleError(_0x1fd9a2,null));};exports[_0x250e('0x3c')]=function(_0x6816cc,_0x1f1d26){var _0x3a22b5={'raw':!![],'where':{'id':_0x6816cc[_0x250e('0x3d')]['id']}},_0x76bb67={};_0x76bb67['model']=_[_0x250e('0x2a')](db[_0x250e('0x24')][_0x250e('0x25')]);_0x76bb67[_0x250e('0x29')]=_['keys'](_0x6816cc['query']);_0x76bb67[_0x250e('0x2b')]=_['intersection'](_0x76bb67['model'],_0x76bb67['query']);_0x3a22b5['attributes']=_[_0x250e('0x2c')](_0x76bb67[_0x250e('0x2d')],qs[_0x250e('0x2f')](_0x6816cc['query'][_0x250e('0x2f')]));_0x3a22b5['attributes']=_0x3a22b5[_0x250e('0x2e')][_0x250e('0x30')]?_0x3a22b5[_0x250e('0x2e')]:_0x76bb67[_0x250e('0x2d')];if(_0x6816cc[_0x250e('0x29')][_0x250e('0x39')]){_0x3a22b5[_0x250e('0x3e')]=[{'all':!![]}];}_0x3a22b5=_['merge']({},_0x3a22b5,_0x6816cc[_0x250e('0x38')]);return db[_0x250e('0x24')][_0x250e('0x3f')](_0x3a22b5)['then'](handleEntityNotFound(_0x1f1d26,null))[_0x250e('0x1d')](respondWithResult(_0x1f1d26,null))[_0x250e('0x13')](handleError(_0x1f1d26,null));};exports['create']=function(_0x1fa718,_0x549252){var _0x32d6be;return db[_0x250e('0x24')]['create'](_0x1fa718[_0x250e('0x40')],{'raw':!![]})[_0x250e('0x1d')](function(_0x424bf3){_0x32d6be=_0x424bf3;return db[_0x250e('0x24')][_0x250e('0x3a')]({'where':{'type':_0x1fa718[_0x250e('0x40')]['type']},'raw':!![]});})[_0x250e('0x1d')](function(_0x1becd4){if(_0x32d6be[_0x250e('0x27')][_0x250e('0x41')]()==_0x250e('0x42')){var _0x35d545=fs[_0x250e('0x43')](path[_0x250e('0x44')](config[_0x250e('0x45')],_0x250e('0x46')),_0x250e('0x47'));var _0x299b13=ejs[_0x250e('0x48')](_0x35d545,{'networks':_0x1becd4||[]});fs[_0x250e('0x49')](_0x250e('0x4a'),_0x299b13);return respondWithRpcPromise('Reload',_0x250e('0x4b'),{'module':'res_stun_monitor.so'});}else if(_0x32d6be[_0x250e('0x27')][_0x250e('0x41')]()==_0x250e('0x4c')){var _0xb7abbf=fs[_0x250e('0x43')](path['join'](config[_0x250e('0x45')],_0x250e('0x4d')),_0x250e('0x47'));var _0x232248=ejs[_0x250e('0x48')](_0xb7abbf,{'networks':_0x1becd4||[]});fs[_0x250e('0x49')]('/etc/asterisk/turn_xcally.conf',_0x232248);return respondWithRpcPromise(_0x250e('0x4e'),_0x250e('0x4b'),{'module':_0x250e('0x4f')});}else{var _0x41b682=fs[_0x250e('0x43')](path['join'](config[_0x250e('0x45')],_0x250e('0x50')),_0x250e('0x47'));var _0x296451=ejs[_0x250e('0x48')](_0x41b682,{'networks':_0x1becd4||[]});fs['writeFileSync'](util[_0x250e('0x51')](_0x250e('0x52'),_0x1fa718[_0x250e('0x40')][_0x250e('0x27')][_0x250e('0x53')]()),_0x296451);return respondWithRpcPromise(_0x250e('0x4e'),'create',{'module':_0x250e('0x54')});}})[_0x250e('0x1d')](function(){return _0x32d6be;})['then'](respondWithResult(_0x549252,0xc9))[_0x250e('0x13')](handleError(_0x549252,null));};exports['update']=function(_0x59fbaf,_0x7fd944){var _0x5b23db;return db[_0x250e('0x24')][_0x250e('0x3f')]({'where':{'id':_0x59fbaf[_0x250e('0x3d')]['id']}})[_0x250e('0x1d')](handleEntityNotFound(_0x7fd944,null))['then'](saveUpdates(_0x59fbaf[_0x250e('0x40')],null))[_0x250e('0x1d')](function(_0x43f60d){if(_0x43f60d){_0x5b23db=_0x43f60d;return db[_0x250e('0x24')][_0x250e('0x3a')]({'where':{'type':_0x5b23db[_0x250e('0x27')]},'raw':!![]});}return null;})[_0x250e('0x1d')](function(_0x170946){if(_0x5b23db['type'][_0x250e('0x41')]()=='STUN'){var _0x5e416b=fs[_0x250e('0x43')](path[_0x250e('0x44')](config[_0x250e('0x45')],'server/files/templates/stun_multiple.ejs'),_0x250e('0x47'));var _0x3e303a=ejs[_0x250e('0x48')](_0x5e416b,{'networks':_0x170946||[]});fs[_0x250e('0x49')](_0x250e('0x4a'),_0x3e303a);return respondWithRpcPromise(_0x250e('0x4e'),_0x250e('0x1c'),{'module':'res_stun_monitor.so'});}else if(_0x5b23db[_0x250e('0x27')][_0x250e('0x41')]()==_0x250e('0x4c')){var _0x55e83f=fs[_0x250e('0x43')](path['join'](config[_0x250e('0x45')],_0x250e('0x4d')),_0x250e('0x47'));var _0x21d702=ejs['render'](_0x55e83f,{'networks':_0x170946||[]});fs['writeFileSync'](_0x250e('0x55'),_0x21d702);return respondWithRpcPromise(_0x250e('0x4e'),_0x250e('0x1c'),{'module':_0x250e('0x4f')});}else{var _0x133282=fs[_0x250e('0x43')](path[_0x250e('0x44')](config[_0x250e('0x45')],_0x250e('0x50')),_0x250e('0x47'));var _0xe8a7be=ejs[_0x250e('0x48')](_0x133282,{'networks':_0x170946||[]});fs[_0x250e('0x49')](util[_0x250e('0x51')](_0x250e('0x52'),_0x59fbaf[_0x250e('0x40')][_0x250e('0x27')]['toLowerCase']()),_0xe8a7be);return respondWithRpcPromise('Reload',_0x250e('0x1c'),{'module':_0x250e('0x54')});}})['then'](function(_0x2f43f0){if(_0x2f43f0){return _0x5b23db;}return null;})[_0x250e('0x1d')](respondWithResult(_0x7fd944,null))['catch'](handleError(_0x7fd944,null));};exports['destroy']=function(_0xacd764,_0x48147f){var _0x188c06;return db[_0x250e('0x24')]['find']({'where':{'id':_0xacd764[_0x250e('0x3d')]['id']}})['then'](function(_0x4546f3){_0x188c06=_0x4546f3;return _0x4546f3;})[_0x250e('0x1d')](handleEntityNotFound(_0x48147f,null))['then'](removeEntity(_0x48147f,null))['then'](function(){if(_0x188c06){return db[_0x250e('0x24')][_0x250e('0x3a')]({'where':{'type':_0x188c06['type']},'raw':!![]});}})[_0x250e('0x1d')](function(_0x123407){if(_0x188c06[_0x250e('0x27')][_0x250e('0x41')]()=='STUN'){var _0x59bf8a=fs[_0x250e('0x43')](path['join'](config[_0x250e('0x45')],'server/files/templates/stun_multiple.ejs'),_0x250e('0x47'));var _0x57a9d2=ejs[_0x250e('0x48')](_0x59bf8a,{'networks':_0x123407||[]});fs[_0x250e('0x49')](_0x250e('0x4a'),_0x57a9d2);return respondWithRpcPromise('Reload',_0x250e('0x1e'),{'module':'res_stun_monitor.so'});}else if(_0x188c06[_0x250e('0x27')][_0x250e('0x41')]()==_0x250e('0x4c')){var _0x57d674=fs['readFileSync'](path['join'](config[_0x250e('0x45')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x376956=ejs[_0x250e('0x48')](_0x57d674,{'networks':_0x123407||[]});fs[_0x250e('0x49')](_0x250e('0x55'),_0x376956);return respondWithRpcPromise(_0x250e('0x4e'),_0x250e('0x1e'),{'module':_0x250e('0x4f')});}else{var _0x51352e=fs[_0x250e('0x43')](path['join'](config['root'],_0x250e('0x50')),_0x250e('0x47'));var _0x112a68=ejs[_0x250e('0x48')](_0x51352e,{'networks':_0x123407||[]});fs[_0x250e('0x49')](util['format'](_0x250e('0x52'),_0x188c06[_0x250e('0x27')][_0x250e('0x53')]()),_0x112a68);return respondWithRpcPromise(_0x250e('0x4e'),_0x250e('0x1e'),{'module':_0x250e('0x54')});}})[_0x250e('0x13')](handleError(_0x48147f,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 6edf2b9..cc64421 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 _0x0a12=['util','bluebird','path','rimraf','../../config/environment','./network.attributes','exports','network'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0a12,0xb8));var _0x20a1=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x0a12[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require('lodash');var util=require(_0x20a1('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x20a1('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a1('0x2'));var rimraf=require(_0x20a1('0x3'));var config=require(_0x20a1('0x4'));var attributes=require(_0x20a1('0x5'));module[_0x20a1('0x6')]=function(_0x2e0ad3,_0x1fedd2){return _0x2e0ad3['define']('Network',attributes,{'tableName':_0x20a1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7794=['moment','request-promise','path','../../config/environment','define','network','util','../../config/logger','api'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x7794,0x7b));var _0x4779=function(_0x4aada5,_0x565010){_0x4aada5=_0x4aada5-0x0;var _0x57e70f=_0x7794[_0x4aada5];return _0x57e70f;};'use strict';var _=require('lodash');var util=require(_0x4779('0x0'));var logger=require(_0x4779('0x1'))(_0x4779('0x2'));var moment=require(_0x4779('0x3'));var BPromise=require('bluebird');var rp=require(_0x4779('0x4'));var fs=require('fs');var path=require(_0x4779('0x5'));var rimraf=require('rimraf');var config=require(_0x4779('0x6'));var attributes=require('./network.attributes');module['exports']=function(_0x53fd58,_0x45cd71){return _0x53fd58[_0x4779('0x7')]('Network',attributes,{'tableName':_0x4779('0x8'),'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 be2d4d6..1837a7d 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x37a500,_0x3c87b7){var _0x2d517e=function(_0x5ce056){while(--_0x5ce056){_0x37a500['push'](_0x37a500['shift']());}};_0x2d517e(++_0x3c87b7);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x2f6285,_0x1264de){_0x2f6285=_0x2f6285-0x0;var _0x59c97a=_0x7a54[_0x2f6285];return _0x59c97a;};'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 c976484..087482f 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 _0xa30c=['/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put'];(function(_0x5123fc,_0x267a54){var _0x3fb76c=function(_0x1e3864){while(--_0x1e3864){_0x5123fc['push'](_0x5123fc['shift']());}};_0x3fb76c(++_0x267a54);}(_0xa30c,0xcb));var _0xca30=function(_0x3e206a,_0x86ed5b){_0x3e206a=_0x3e206a-0x0;var _0x28e95f=_0xa30c[_0x3e206a];return _0x28e95f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xca30('0x0'));var timeout=require(_0xca30('0x1'));var express=require(_0xca30('0x2'));var router=express[_0xca30('0x3')]();var fs_extra=require(_0xca30('0x4'));var auth=require(_0xca30('0x5'));var interaction=require(_0xca30('0x6'));var config=require(_0xca30('0x7'));var controller=require(_0xca30('0x8'));router['get']('/',auth[_0xca30('0x9')](),controller[_0xca30('0xa')]);router[_0xca30('0xb')]('/describe',auth[_0xca30('0x9')](),controller[_0xca30('0xc')]);router[_0xca30('0xb')]('/:id',auth[_0xca30('0x9')](),controller['show']);router['get'](_0xca30('0xd'),auth[_0xca30('0x9')](),controller[_0xca30('0xe')]);router['get'](_0xca30('0xf'),auth['isAuthenticated'](),controller[_0xca30('0x10')]);router['get'](_0xca30('0x11'),auth[_0xca30('0x9')](),controller['getApplications']);router[_0xca30('0xb')](_0xca30('0x12'),auth['isAuthenticated'](),controller[_0xca30('0x13')]);router['get'](_0xca30('0x14'),auth['isAuthenticated'](),controller[_0xca30('0x15')]);router['post']('/',auth[_0xca30('0x9')](),controller['create']);router[_0xca30('0x16')](_0xca30('0xd'),auth['isAuthenticated'](),controller[_0xca30('0x17')]);router[_0xca30('0x16')]('/:id/canned_answers',auth[_0xca30('0x9')](),controller[_0xca30('0x18')]);router[_0xca30('0x16')](_0xca30('0x19'),controller[_0xca30('0x1a')]);router['post'](_0xca30('0x11'),auth[_0xca30('0x9')](),controller[_0xca30('0x1b')]);router['post'](_0xca30('0x14'),auth[_0xca30('0x9')](),controller['addAgents']);router[_0xca30('0x16')](_0xca30('0x1c'),auth[_0xca30('0x9')](),controller[_0xca30('0x1d')]);router[_0xca30('0x1e')](_0xca30('0x1f'),auth[_0xca30('0x9')](),controller[_0xca30('0x20')]);router['delete'](_0xca30('0x1f'),auth[_0xca30('0x9')](),controller[_0xca30('0x21')]);router[_0xca30('0x22')](_0xca30('0xd'),auth[_0xca30('0x9')](),controller[_0xca30('0x23')]);router[_0xca30('0x22')](_0xca30('0xf'),auth['isAuthenticated'](),controller[_0xca30('0x24')]);router[_0xca30('0x22')](_0xca30('0x14'),auth[_0xca30('0x9')](),controller[_0xca30('0x25')]);module[_0xca30('0x26')]=router; \ No newline at end of file +var _0x440d=['./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','put','update','destroy','delete','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x37296b,_0x2e9820){var _0x561567=function(_0x18d20a){while(--_0x18d20a){_0x37296b['push'](_0x37296b['shift']());}};_0x561567(++_0x2e9820);}(_0x440d,0xbf));var _0xd440=function(_0x53b67d,_0x251707){_0x53b67d=_0x53b67d-0x0;var _0xff73e7=_0x440d[_0x53b67d];return _0xff73e7;};'use strict';var multer=require(_0xd440('0x0'));var util=require('util');var path=require(_0xd440('0x1'));var timeout=require(_0xd440('0x2'));var express=require(_0xd440('0x3'));var router=express[_0xd440('0x4')]();var fs_extra=require(_0xd440('0x5'));var auth=require(_0xd440('0x6'));var interaction=require(_0xd440('0x7'));var config=require(_0xd440('0x8'));var controller=require(_0xd440('0x9'));router[_0xd440('0xa')]('/',auth[_0xd440('0xb')](),controller[_0xd440('0xc')]);router[_0xd440('0xa')](_0xd440('0xd'),auth[_0xd440('0xb')](),controller[_0xd440('0xe')]);router[_0xd440('0xa')](_0xd440('0xf'),auth['isAuthenticated'](),controller[_0xd440('0x10')]);router['get'](_0xd440('0x11'),auth[_0xd440('0xb')](),controller[_0xd440('0x12')]);router[_0xd440('0xa')](_0xd440('0x13'),auth[_0xd440('0xb')](),controller[_0xd440('0x14')]);router['get']('/:id/applications',auth[_0xd440('0xb')](),controller['getApplications']);router[_0xd440('0xa')]('/:id/interactions',auth[_0xd440('0xb')](),controller['getInteractions']);router[_0xd440('0xa')]('/:id/users',auth[_0xd440('0xb')](),controller[_0xd440('0x15')]);router[_0xd440('0x16')]('/',auth[_0xd440('0xb')](),controller['create']);router['post'](_0xd440('0x11'),auth['isAuthenticated'](),controller[_0xd440('0x17')]);router[_0xd440('0x16')](_0xd440('0x13'),auth[_0xd440('0xb')](),controller[_0xd440('0x18')]);router['post'](_0xd440('0x19'),controller[_0xd440('0x1a')]);router['post'](_0xd440('0x1b'),auth[_0xd440('0xb')](),controller[_0xd440('0x1c')]);router[_0xd440('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xd440('0x1d')]);router[_0xd440('0x16')](_0xd440('0x1e'),auth[_0xd440('0xb')](),controller['send']);router[_0xd440('0x1f')]('/:id',auth[_0xd440('0xb')](),controller[_0xd440('0x20')]);router['delete'](_0xd440('0xf'),auth[_0xd440('0xb')](),controller[_0xd440('0x21')]);router[_0xd440('0x22')](_0xd440('0x11'),auth[_0xd440('0xb')](),controller[_0xd440('0x23')]);router[_0xd440('0x22')](_0xd440('0x13'),auth[_0xd440('0xb')](),controller[_0xd440('0x24')]);router[_0xd440('0x22')](_0xd440('0x25'),auth['isAuthenticated'](),controller[_0xd440('0x26')]);module[_0xd440('0x27')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 09fbe5f..7d948a4 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 _0x2448=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','BOOLEAN','INTEGER','setDataValue'];(function(_0x309504,_0x50286e){var _0x41ff1e=function(_0x5e92e1){while(--_0x5e92e1){_0x309504['push'](_0x309504['shift']());}};_0x41ff1e(++_0x50286e);}(_0x2448,0x13a));var _0x8244=function(_0x4d2791,_0x4cec43){_0x4d2791=_0x4d2791-0x0;var _0x3ec06d=_0x2448[_0x4d2791];return _0x3ec06d;};'use strict';var Sequelize=require(_0x8244('0x0'));var rs=require(_0x8244('0x1'));module[_0x8244('0x2')]={'name':{'type':Sequelize[_0x8244('0x3')],'unique':_0x8244('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x8244('0x3')],'defaultValue':function(){return rs[_0x8244('0x5')]();}},'replyUri':{'type':Sequelize[_0x8244('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x8244('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8244('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8244('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x8244('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8244('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8244('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8244('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8244('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4fd404){if(!_0x4fd404)this[_0x8244('0x9')](_0x8244('0xa'),null);this[_0x8244('0x9')](_0x8244('0xb'),_0x4fd404);}}}; \ No newline at end of file +var _0xb153=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING'];(function(_0xab599b,_0x399edb){var _0x2fd99d=function(_0x4f7f4f){while(--_0x4f7f4f){_0xab599b['push'](_0xab599b['shift']());}};_0x2fd99d(++_0x399edb);}(_0xb153,0x84));var _0x3b15=function(_0x199e69,_0x444567){_0x199e69=_0x199e69-0x0;var _0x4dbd91=_0xb153[_0x199e69];return _0x4dbd91;};'use strict';var Sequelize=require(_0x3b15('0x0'));var rs=require('randomstring');module[_0x3b15('0x1')]={'name':{'type':Sequelize[_0x3b15('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x3b15('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x3b15('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3b15('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x3b15('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3b15('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3b15('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3b15('0x2')]},'queueTransfer':{'type':Sequelize[_0x3b15('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3b15('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3b15('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3b15('0x5')},'mandatoryDisposition':{'type':Sequelize[_0x3b15('0x3')],'defaultValue':![],'comment':_0x3b15('0x6'),'set':function(_0x392044){if(!_0x392044)this[_0x3b15('0x7')]('mandatoryDispositionPauseId',null);this[_0x3b15('0x7')](_0x3b15('0x8'),_0x392044);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 87baa7a..eddc0c0 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 _0x2b38=['getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','Pause','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','describe','Disposition','getDispositions','findOne','nolimit','OpenchannelAccountId','findAll','rows','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','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','List','Contacts','DESC','Applications','account','applications','list','orderBy','priority','asc','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','created','interaction','autoclose','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','waitForTheAssignedQueue','Start','EventManager','addApplications','transaction','READ_COMMITTED','OpenchannelApplication','bulkCreate','findAndCountAll','finally'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x2b38,0x19f));var _0x82b3=function(_0x43be4d,_0x374dc2){_0x43be4d=_0x43be4d-0x0;var _0xc6b0cf=_0x2b38[_0x43be4d];return _0xc6b0cf;};'use strict';var emlformat=require(_0x82b3('0x0'));var rimraf=require(_0x82b3('0x1'));var zipdir=require(_0x82b3('0x2'));var jsonpatch=require(_0x82b3('0x3'));var rp=require(_0x82b3('0x4'));var moment=require(_0x82b3('0x5'));var BPromise=require(_0x82b3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x82b3('0x7'));var csv=require('to-csv');var ejs=require(_0x82b3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82b3('0x9'));var squel=require('squel');var crypto=require(_0x82b3('0xa'));var jsforce=require(_0x82b3('0xb'));var deskjs=require(_0x82b3('0xc'));var toCsv=require(_0x82b3('0xd'));var querystring=require(_0x82b3('0xe'));var Papa=require(_0x82b3('0xf'));var Redis=require(_0x82b3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x82b3('0x11'));var as=require(_0x82b3('0x12'));var hardwareService=require(_0x82b3('0x13'));var logger=require(_0x82b3('0x14'))(_0x82b3('0x15'));var utils=require(_0x82b3('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x82b3('0x17'))['db'];config[_0x82b3('0x18')]=_[_0x82b3('0x19')](config[_0x82b3('0x18')],{'host':_0x82b3('0x1a'),'port':0x18eb});var socket=require(_0x82b3('0x1b'))(new Redis(config[_0x82b3('0x18')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x82b3('0x1c'));var client=jayson['client'][_0x82b3('0x1d')]({'port':0x232c});var client9002=jayson[_0x82b3('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cae75,_0x4e815b,_0x5b3e67,_0x45c728){return new BPromise(function(_0x3f5149,_0x542e99){var _0x2db983=_0x45c728||client;return _0x2db983[_0x82b3('0x1f')](_0x2cae75,_0x5b3e67)[_0x82b3('0x20')](function(_0xefeab3){logger[_0x82b3('0x21')](_0x82b3('0x22'),_0x4e815b,_0x82b3('0x23'));logger[_0x82b3('0x24')](_0x82b3('0x25'),_0x4e815b,_0x82b3('0x23'),JSON[_0x82b3('0x26')](_0xefeab3));if(_0xefeab3[_0x82b3('0x27')]){if(_0xefeab3[_0x82b3('0x27')]['code']===0x1f4){logger['error'](_0x82b3('0x22'),_0x4e815b,_0xefeab3[_0x82b3('0x27')][_0x82b3('0x28')]);return _0x542e99(_0xefeab3['error'][_0x82b3('0x28')]);}logger[_0x82b3('0x27')](_0x82b3('0x22'),_0x4e815b,_0xefeab3[_0x82b3('0x27')][_0x82b3('0x28')]);return _0x3f5149(_0xefeab3[_0x82b3('0x27')]['message']);}else{logger['info'](_0x82b3('0x22'),_0x4e815b,_0x82b3('0x23'));_0x3f5149(_0xefeab3[_0x82b3('0x29')][_0x82b3('0x28')]);}})['catch'](function(_0x396d03){logger[_0x82b3('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x4e815b,_0x396d03);_0x542e99(_0x396d03);});});}function respondWithStatusCode(_0x4a4249,_0xc3a2b6){_0xc3a2b6=_0xc3a2b6||0xcc;return function(_0x113b7d){if(_0x113b7d){return _0x4a4249['sendStatus'](_0xc3a2b6);}return _0x4a4249[_0x82b3('0x2a')](_0xc3a2b6)[_0x82b3('0x2b')]();};}function respondWithResult(_0x70ca26,_0x5a6198){_0x5a6198=_0x5a6198||0xc8;return function(_0x3c748a){if(_0x3c748a){return _0x70ca26[_0x82b3('0x2a')](_0x5a6198)[_0x82b3('0x2c')](_0x3c748a);}};}function respondWithFilteredResult(_0x1828b2,_0x19a98e){return function(_0x166b03){if(_0x166b03){var _0x5b67c2=typeof _0x19a98e[_0x82b3('0x2d')]===_0x82b3('0x2e')&&typeof _0x19a98e[_0x82b3('0x2f')]===_0x82b3('0x2e');var _0x38797c=_0x166b03[_0x82b3('0x30')];var _0x44a342=_0x5b67c2?0x0:_0x19a98e[_0x82b3('0x2d')];var _0x2466e4=_0x5b67c2?_0x166b03[_0x82b3('0x30')]:_0x19a98e[_0x82b3('0x2d')]+_0x19a98e[_0x82b3('0x2f')];var _0x181695;if(_0x2466e4>=_0x38797c){_0x2466e4=_0x38797c;_0x181695=0xc8;}else{_0x181695=0xce;}_0x1828b2['status'](_0x181695);return _0x1828b2[_0x82b3('0x31')](_0x82b3('0x32'),_0x44a342+'-'+_0x2466e4+'/'+_0x38797c)['json'](_0x166b03);}return null;};}function patchUpdates(_0x1d7836){return function(_0x43462b){try{jsonpatch[_0x82b3('0x33')](_0x43462b,_0x1d7836,!![]);}catch(_0x2dc8b0){return BPromise[_0x82b3('0x34')](_0x2dc8b0);}return _0x43462b[_0x82b3('0x35')]();};}function saveUpdates(_0x27d4b7,_0x1d1381){return function(_0x3e6a35){if(_0x3e6a35){return _0x3e6a35[_0x82b3('0x36')](_0x27d4b7)['then'](function(_0x5eab36){return _0x5eab36;});}return null;};}function removeEntity(_0x3354b9,_0x4bcd4c){return function(_0x1db462){if(_0x1db462){return _0x1db462[_0x82b3('0x37')]()[_0x82b3('0x20')](function(){var _0x348976=_0x1db462[_0x82b3('0x38')]({'plain':!![]});var _0x5f11be='OpenchannelAccounts';return db[_0x82b3('0x39')][_0x82b3('0x37')]({'where':{'type':_0x5f11be,'resourceId':_0x348976['id']}})['then'](function(){return _0x1db462;});})['then'](function(){_0x3354b9[_0x82b3('0x2a')](0xcc)[_0x82b3('0x2b')]();});}};}function handleEntityNotFound(_0x32fde0,_0x11fe8d){return function(_0x212752){if(!_0x212752){_0x32fde0[_0x82b3('0x3a')](0x194);}return _0x212752;};}function handleError(_0x3e0653,_0x3f11e0){_0x3f11e0=_0x3f11e0||0x1f4;return function(_0x317d81){logger[_0x82b3('0x27')](_0x317d81[_0x82b3('0x3b')]);if(_0x317d81['name']){delete _0x317d81[_0x82b3('0x3c')];}_0x3e0653[_0x82b3('0x2a')](_0x3f11e0)[_0x82b3('0x3d')](_0x317d81);};}exports[_0x82b3('0x3e')]=function(_0x593bf9,_0x17184f){var _0x5a6bd9={'include':[{'model':db['Pause'],'as':_0x82b3('0x3f')}]},_0x4b4251={},_0x410503={'count':0x0,'rows':[]};var _0x413e24=_[_0x82b3('0x40')](db[_0x82b3('0x41')][_0x82b3('0x42')],function(_0x35e46d){return{'name':_0x35e46d[_0x82b3('0x43')],'type':_0x35e46d[_0x82b3('0x44')][_0x82b3('0x45')]};});_0x4b4251[_0x82b3('0x46')]=_[_0x82b3('0x40')](_0x413e24,_0x82b3('0x3c'));_0x4b4251[_0x82b3('0x47')]=_[_0x82b3('0x48')](_0x593bf9[_0x82b3('0x47')]);_0x4b4251[_0x82b3('0x49')]=_['intersection'](_0x4b4251[_0x82b3('0x46')],_0x4b4251[_0x82b3('0x47')]);_0x5a6bd9[_0x82b3('0x4a')]=_['intersection'](_0x4b4251['model'],qs[_0x82b3('0x4b')](_0x593bf9[_0x82b3('0x47')]['fields']));_0x5a6bd9['attributes']=_0x5a6bd9[_0x82b3('0x4a')][_0x82b3('0x4c')]?_0x5a6bd9['attributes']:_0x4b4251['model'];if(!_0x593bf9[_0x82b3('0x47')][_0x82b3('0x4d')]('nolimit')){_0x5a6bd9[_0x82b3('0x2f')]=qs['limit'](_0x593bf9[_0x82b3('0x47')][_0x82b3('0x2f')]);_0x5a6bd9[_0x82b3('0x2d')]=qs[_0x82b3('0x2d')](_0x593bf9[_0x82b3('0x47')][_0x82b3('0x2d')]);}_0x5a6bd9[_0x82b3('0x4e')]=qs['sort'](_0x593bf9[_0x82b3('0x47')][_0x82b3('0x4f')]);_0x5a6bd9[_0x82b3('0x50')]=qs[_0x82b3('0x49')](_[_0x82b3('0x51')](_0x593bf9[_0x82b3('0x47')],_0x4b4251[_0x82b3('0x49')]),_0x413e24);if(_0x593bf9['query'][_0x82b3('0x52')]){_0x5a6bd9[_0x82b3('0x50')]=_['merge'](_0x5a6bd9['where'],{'$or':_[_0x82b3('0x40')](_0x413e24,function(_0x2cc965){if(_0x2cc965[_0x82b3('0x44')]!=='VIRTUAL'){var _0x448201={};_0x448201[_0x2cc965[_0x82b3('0x3c')]]={'$like':'%'+_0x593bf9[_0x82b3('0x47')][_0x82b3('0x52')]+'%'};return _0x448201;}})});}_0x5a6bd9=_[_0x82b3('0x53')]({},_0x5a6bd9,_0x593bf9[_0x82b3('0x54')]);var _0x1494e7={'where':_0x5a6bd9[_0x82b3('0x50')]};return db[_0x82b3('0x41')][_0x82b3('0x30')](_0x1494e7)['then'](function(_0x5cb628){_0x410503[_0x82b3('0x30')]=_0x5cb628;if(_0x593bf9[_0x82b3('0x47')][_0x82b3('0x55')]){_0x5a6bd9[_0x82b3('0x56')]=[{'all':!![]}];}return db[_0x82b3('0x41')]['findAll'](_0x5a6bd9);})[_0x82b3('0x20')](function(_0xdd81f1){_0x410503['rows']=_0xdd81f1;return _0x410503;})[_0x82b3('0x20')](respondWithFilteredResult(_0x17184f,_0x5a6bd9))[_0x82b3('0x57')](handleError(_0x17184f,null));};exports[_0x82b3('0x58')]=function(_0x1c20b4,_0x1732cd){var _0x2c6ded={'raw':![],'where':{'id':_0x1c20b4[_0x82b3('0x59')]['id']},'include':[{'model':db[_0x82b3('0x5a')],'as':'mandatoryDispositionPause'}]},_0x10a027={};_0x10a027[_0x82b3('0x46')]=_[_0x82b3('0x48')](db[_0x82b3('0x41')]['rawAttributes']);_0x10a027[_0x82b3('0x47')]=_[_0x82b3('0x48')](_0x1c20b4[_0x82b3('0x47')]);_0x10a027[_0x82b3('0x49')]=_[_0x82b3('0x5b')](_0x10a027[_0x82b3('0x46')],_0x10a027[_0x82b3('0x47')]);_0x2c6ded[_0x82b3('0x4a')]=_[_0x82b3('0x5b')](_0x10a027[_0x82b3('0x46')],qs['fields'](_0x1c20b4[_0x82b3('0x47')][_0x82b3('0x4b')]));_0x2c6ded[_0x82b3('0x4a')]=_0x2c6ded[_0x82b3('0x4a')][_0x82b3('0x4c')]?_0x2c6ded[_0x82b3('0x4a')]:_0x10a027[_0x82b3('0x46')];if(_0x1c20b4['query'][_0x82b3('0x55')]){_0x2c6ded['include']=[{'all':!![]}];}_0x2c6ded=_[_0x82b3('0x53')]({},_0x2c6ded,_0x1c20b4['options']);return db[_0x82b3('0x41')][_0x82b3('0x5c')](_0x2c6ded)[_0x82b3('0x20')](handleEntityNotFound(_0x1732cd,null))['then'](respondWithResult(_0x1732cd,null))[_0x82b3('0x57')](handleError(_0x1732cd,null));};exports[_0x82b3('0x5d')]=function(_0xd6876a,_0x437c0d){return db[_0x82b3('0x41')]['create'](_0xd6876a[_0x82b3('0x5e')],{})[_0x82b3('0x20')](function(_0x494fee){var _0x448c47=_0xd6876a[_0x82b3('0x5f')][_0x82b3('0x38')]({'plain':!![]});if(!_0x448c47)throw new Error(_0x82b3('0x60'));if(_0x448c47[_0x82b3('0x61')]===_0x82b3('0x5f')){var _0x44e6bb=_0x494fee[_0x82b3('0x38')]({'plain':!![]});var _0x368a05=_0x82b3('0x62');return db[_0x82b3('0x63')][_0x82b3('0x5c')]({'where':{'name':_0x368a05,'userProfileId':_0x448c47[_0x82b3('0x64')]},'raw':!![]})['then'](function(_0x4658e5){if(_0x4658e5&&_0x4658e5['autoAssociation']===0x0){return db[_0x82b3('0x39')][_0x82b3('0x5d')]({'name':_0x44e6bb[_0x82b3('0x3c')],'resourceId':_0x44e6bb['id'],'type':_0x4658e5[_0x82b3('0x3c')],'sectionId':_0x4658e5['id']},{})['then'](function(){return _0x494fee;});}else{return _0x494fee;}})[_0x82b3('0x57')](function(_0x6d36ef){logger[_0x82b3('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6d36ef);throw _0x6d36ef;});}return _0x494fee;})[_0x82b3('0x20')](respondWithResult(_0x437c0d,0xc9))['catch'](handleError(_0x437c0d,null));};exports['update']=function(_0x358658,_0x535306){if(_0x358658['body']['id']){delete _0x358658[_0x82b3('0x5e')]['id'];}return db['OpenchannelAccount'][_0x82b3('0x5c')]({'where':{'id':_0x358658[_0x82b3('0x59')]['id']},'include':[{'model':db[_0x82b3('0x5a')],'as':_0x82b3('0x3f')}]})[_0x82b3('0x20')](handleEntityNotFound(_0x535306,null))[_0x82b3('0x20')](saveUpdates(_0x358658[_0x82b3('0x5e')],null))['then'](respondWithResult(_0x535306,null))[_0x82b3('0x57')](handleError(_0x535306,null));};exports[_0x82b3('0x37')]=function(_0x186e66,_0x50dbba){return db[_0x82b3('0x41')]['find']({'where':{'id':_0x186e66['params']['id']}})[_0x82b3('0x20')](handleEntityNotFound(_0x50dbba,null))[_0x82b3('0x20')](removeEntity(_0x50dbba,null))[_0x82b3('0x57')](handleError(_0x50dbba,null));};exports['describe']=function(_0x3debb7,_0xde680){return db[_0x82b3('0x41')][_0x82b3('0x65')]()[_0x82b3('0x20')](respondWithResult(_0xde680,null))['catch'](handleError(_0xde680,null));};exports['addDisposition']=function(_0x5e62b6,_0x3f7954,_0x46dc43){if(_0x5e62b6[_0x82b3('0x5e')]['id']){delete _0x5e62b6[_0x82b3('0x5e')]['id'];}return db[_0x82b3('0x41')][_0x82b3('0x5c')]({'where':{'id':_0x5e62b6[_0x82b3('0x59')]['id']}})[_0x82b3('0x20')](handleEntityNotFound(_0x3f7954,null))[_0x82b3('0x20')](function(_0x4390ba){if(_0x4390ba){_0x5e62b6[_0x82b3('0x5e')]['OpenchannelAccountId']=_0x4390ba['id'];return db[_0x82b3('0x66')]['create'](_0x5e62b6[_0x82b3('0x5e')]);}})[_0x82b3('0x20')](respondWithResult(_0x3f7954,null))[_0x82b3('0x57')](handleError(_0x3f7954,null));};exports[_0x82b3('0x67')]=function(_0x45dd91,_0xff3130,_0x2028c6){var _0x6efab4={'raw':![],'where':{}};var _0x183c36={};var _0x3f939e={'count':0x0,'rows':[]};return db[_0x82b3('0x41')][_0x82b3('0x68')]({'where':{'id':_0x45dd91['params']['id']}})['then'](handleEntityNotFound(_0xff3130,null))['then'](function(_0x30c23c){if(_0x30c23c){_0x183c36['model']=_[_0x82b3('0x48')](db[_0x82b3('0x66')][_0x82b3('0x42')]);_0x183c36[_0x82b3('0x47')]=_[_0x82b3('0x48')](_0x45dd91[_0x82b3('0x47')]);_0x183c36['filters']=_['intersection'](_0x183c36['model'],_0x183c36[_0x82b3('0x47')]);_0x6efab4['attributes']=_['intersection'](_0x183c36[_0x82b3('0x46')],qs[_0x82b3('0x4b')](_0x45dd91[_0x82b3('0x47')][_0x82b3('0x4b')]));_0x6efab4['attributes']=_0x6efab4[_0x82b3('0x4a')][_0x82b3('0x4c')]?_0x6efab4['attributes']:_0x183c36['model'];if(!_0x45dd91[_0x82b3('0x47')][_0x82b3('0x4d')](_0x82b3('0x69'))){_0x6efab4[_0x82b3('0x2f')]=qs[_0x82b3('0x2f')](_0x45dd91[_0x82b3('0x47')][_0x82b3('0x2f')]);_0x6efab4['offset']=qs[_0x82b3('0x2d')](_0x45dd91[_0x82b3('0x47')][_0x82b3('0x2d')]);}_0x6efab4[_0x82b3('0x4e')]=qs['sort'](_0x45dd91[_0x82b3('0x47')][_0x82b3('0x4f')]);_0x6efab4['where']=qs[_0x82b3('0x49')](_['pick'](_0x45dd91[_0x82b3('0x47')],_0x183c36[_0x82b3('0x49')]));_0x6efab4[_0x82b3('0x50')][_0x82b3('0x6a')]=_0x30c23c['id'];if(_0x45dd91[_0x82b3('0x47')][_0x82b3('0x52')]){_0x6efab4[_0x82b3('0x50')]=_['merge'](_0x6efab4['where'],{'$or':_[_0x82b3('0x40')](_0x6efab4['attributes'],function(_0x4ba772){var _0x1392bd={};_0x1392bd[_0x4ba772]={'$like':'%'+_0x45dd91[_0x82b3('0x47')]['filter']+'%'};return _0x1392bd;})});}_0x6efab4=_[_0x82b3('0x53')]({},_0x6efab4,_0x45dd91[_0x82b3('0x54')]);return db['Disposition'][_0x82b3('0x30')]({'where':_0x6efab4[_0x82b3('0x50')]})[_0x82b3('0x20')](function(_0x2951c2){_0x3f939e[_0x82b3('0x30')]=_0x2951c2;if(_0x45dd91[_0x82b3('0x47')][_0x82b3('0x55')]){_0x6efab4[_0x82b3('0x56')]=[{'all':!![]}];}return db[_0x82b3('0x66')][_0x82b3('0x6b')](_0x6efab4);})['then'](function(_0x50930d){_0x3f939e[_0x82b3('0x6c')]=_0x50930d;return _0x3f939e;});}})[_0x82b3('0x20')](respondWithFilteredResult(_0xff3130,_0x6efab4))['catch'](handleError(_0xff3130,null));};exports['removeDispositions']=function(_0x38de4c,_0x20d3a3,_0x4d9bf6){return db[_0x82b3('0x41')][_0x82b3('0x5c')]({'where':{'id':_0x38de4c[_0x82b3('0x59')]['id']}})[_0x82b3('0x20')](handleEntityNotFound(_0x20d3a3,null))[_0x82b3('0x20')](function(_0x444e49){if(_0x444e49){return _0x444e49['removeDispositions'](_0x38de4c[_0x82b3('0x47')][_0x82b3('0x6d')]);}})[_0x82b3('0x20')](respondWithStatusCode(_0x20d3a3,null))[_0x82b3('0x57')](handleError(_0x20d3a3,null));};exports[_0x82b3('0x6e')]=function(_0x18654b,_0x4eae2a,_0x2049ee){if(_0x18654b[_0x82b3('0x5e')]['id']){delete _0x18654b['body']['id'];}return db[_0x82b3('0x41')]['find']({'where':{'id':_0x18654b['params']['id']}})[_0x82b3('0x20')](handleEntityNotFound(_0x4eae2a,null))[_0x82b3('0x20')](function(_0x17ac92){if(_0x17ac92){_0x18654b[_0x82b3('0x5e')][_0x82b3('0x6a')]=_0x17ac92['id'];return db[_0x82b3('0x6f')][_0x82b3('0x5d')](_0x18654b[_0x82b3('0x5e')]);}})['then'](respondWithResult(_0x4eae2a,null))[_0x82b3('0x57')](handleError(_0x4eae2a,null));};exports[_0x82b3('0x70')]=function(_0x1f06f5,_0xb5cc2c,_0x15b79e){var _0x52cf3b={'raw':![],'where':{}};var _0x565841={};var _0x361da0={'count':0x0,'rows':[]};return db[_0x82b3('0x41')][_0x82b3('0x68')]({'where':{'id':_0x1f06f5[_0x82b3('0x59')]['id']}})[_0x82b3('0x20')](handleEntityNotFound(_0xb5cc2c,null))[_0x82b3('0x20')](function(_0x33c80e){if(_0x33c80e){_0x565841['model']=_[_0x82b3('0x48')](db[_0x82b3('0x6f')][_0x82b3('0x42')]);_0x565841[_0x82b3('0x47')]=_[_0x82b3('0x48')](_0x1f06f5[_0x82b3('0x47')]);_0x565841['filters']=_[_0x82b3('0x5b')](_0x565841[_0x82b3('0x46')],_0x565841[_0x82b3('0x47')]);_0x52cf3b['attributes']=_[_0x82b3('0x5b')](_0x565841[_0x82b3('0x46')],qs[_0x82b3('0x4b')](_0x1f06f5[_0x82b3('0x47')][_0x82b3('0x4b')]));_0x52cf3b['attributes']=_0x52cf3b[_0x82b3('0x4a')][_0x82b3('0x4c')]?_0x52cf3b['attributes']:_0x565841[_0x82b3('0x46')];if(!_0x1f06f5[_0x82b3('0x47')]['hasOwnProperty'](_0x82b3('0x69'))){_0x52cf3b[_0x82b3('0x2f')]=qs['limit'](_0x1f06f5[_0x82b3('0x47')][_0x82b3('0x2f')]);_0x52cf3b[_0x82b3('0x2d')]=qs[_0x82b3('0x2d')](_0x1f06f5[_0x82b3('0x47')]['offset']);}_0x52cf3b[_0x82b3('0x4e')]=qs[_0x82b3('0x4f')](_0x1f06f5['query'][_0x82b3('0x4f')]);_0x52cf3b[_0x82b3('0x50')]=qs[_0x82b3('0x49')](_[_0x82b3('0x51')](_0x1f06f5[_0x82b3('0x47')],_0x565841[_0x82b3('0x49')]));_0x52cf3b[_0x82b3('0x50')][_0x82b3('0x6a')]=_0x33c80e['id'];if(_0x1f06f5['query'][_0x82b3('0x52')]){_0x52cf3b[_0x82b3('0x50')]=_[_0x82b3('0x53')](_0x52cf3b[_0x82b3('0x50')],{'$or':_[_0x82b3('0x40')](_0x52cf3b[_0x82b3('0x4a')],function(_0x5b5911){var _0x24911c={};_0x24911c[_0x5b5911]={'$like':'%'+_0x1f06f5[_0x82b3('0x47')]['filter']+'%'};return _0x24911c;})});}_0x52cf3b=_['merge']({},_0x52cf3b,_0x1f06f5[_0x82b3('0x54')]);return db[_0x82b3('0x6f')]['count']({'where':_0x52cf3b['where']})[_0x82b3('0x20')](function(_0x58069a){_0x361da0[_0x82b3('0x30')]=_0x58069a;if(_0x1f06f5[_0x82b3('0x47')][_0x82b3('0x55')]){_0x52cf3b['include']=[{'all':!![]}];}return db[_0x82b3('0x6f')]['findAll'](_0x52cf3b);})[_0x82b3('0x20')](function(_0x1fd7ec){_0x361da0[_0x82b3('0x6c')]=_0x1fd7ec;return _0x361da0;});}})[_0x82b3('0x20')](respondWithFilteredResult(_0xb5cc2c,_0x52cf3b))[_0x82b3('0x57')](handleError(_0xb5cc2c,null));};exports[_0x82b3('0x71')]=function(_0x302d44,_0x3c74bf,_0x24e160){return db[_0x82b3('0x41')]['find']({'where':{'id':_0x302d44[_0x82b3('0x59')]['id']}})[_0x82b3('0x20')](handleEntityNotFound(_0x3c74bf,null))[_0x82b3('0x20')](function(_0x4efa9f){if(_0x4efa9f){return _0x4efa9f[_0x82b3('0x71')](_0x302d44[_0x82b3('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x3c74bf,null))[_0x82b3('0x57')](handleError(_0x3c74bf,null));};exports[_0x82b3('0x72')]=function(_0x1082c7,_0x2b6584,_0x126eec){var _0x232580={'body':_0x1082c7[_0x82b3('0x5e')],'channel':_0x82b3('0x73')};var _0x4de445=[];var _0x2130e8=[];var _0x49f9bc={};var _0x460bb0=![];return db[_0x82b3('0x74')]['describe']()[_0x82b3('0x20')](function(_0x3f7b8e){if(!_0x3f7b8e){throw new db[(_0x82b3('0x75'))][(_0x82b3('0x76'))](_0x82b3('0x77'));}_0x4de445=_[_0x82b3('0x78')](_[_0x82b3('0x48')](_0x3f7b8e),['createdAt',_0x82b3('0x79')]);_0x2130e8=_['difference'](_[_0x82b3('0x48')](_0x3f7b8e),[_0x82b3('0x7a'),_0x82b3('0x79'),_0x82b3('0x7b'),_0x82b3('0x7c')]);if(_0x1082c7[_0x82b3('0x5e')]['id']){delete _0x1082c7[_0x82b3('0x5e')]['id'];}if(_['isNil'](_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x7d')])){throw new db['Sequelize'][(_0x82b3('0x76'))]('from\x20is\x20mandatory');}if(_[_0x82b3('0x7e')](_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x5e')])||_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x5e')]===''){throw new db[(_0x82b3('0x75'))]['ValidationError'](_0x82b3('0x7f'));}if(_[_0x82b3('0x7e')](_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x80')])){throw new db[(_0x82b3('0x75'))][(_0x82b3('0x76'))](_0x82b3('0x81')+_0x2130e8);}if(!_[_0x82b3('0x82')](_0x2130e8,_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x80')])){throw new db['Sequelize'][(_0x82b3('0x76'))](_0x82b3('0x83')+_0x2130e8);}_0x49f9bc[_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x80')]]=_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x7d')];})[_0x82b3('0x20')](function(){return db[_0x82b3('0x41')][_0x82b3('0x5c')]({'where':{'id':_0x1082c7[_0x82b3('0x59')]['id']},'include':[{'model':db[_0x82b3('0x84')],'as':_0x82b3('0x85'),'include':[{'model':db[_0x82b3('0x74')],'as':_0x82b3('0x86'),'where':_0x49f9bc,'limit':0x1,'order':[[_0x82b3('0x79'),_0x82b3('0x87')]]}]},{'model':db['OpenchannelApplication'],'as':_0x82b3('0x88')}]});})[_0x82b3('0x20')](handleEntityNotFound(_0x2b6584,null))['then'](function(_0x438709){if(_0x438709&&_0x438709['List']){_0x232580[_0x82b3('0x89')]=_0x438709;_0x232580[_0x82b3('0x8a')]=_0x438709[_0x82b3('0x88')];_0x232580[_0x82b3('0x8b')]=_0x438709['List'];_0x232580[_0x82b3('0x8a')]=_[_0x82b3('0x8c')](_0x232580[_0x82b3('0x8a')],[_0x82b3('0x8d')],[_0x82b3('0x8e')]);if(_0x232580['account'][_0x82b3('0x88')]){delete _0x232580[_0x82b3('0x89')][_0x82b3('0x88')];}if(_0x232580[_0x82b3('0x89')][_0x82b3('0x85')]&&_0x232580[_0x82b3('0x89')][_0x82b3('0x85')][_0x82b3('0x86')]['length']){return _0x232580[_0x82b3('0x89')][_0x82b3('0x85')][_0x82b3('0x86')][0x0];}var _0xfad75d=_['defaults'](_0x1082c7[_0x82b3('0x5e')],{'firstName':_0x1082c7[_0x82b3('0x5e')]['from'],'ListId':_0x438709[_0x82b3('0x7c')]});_0xfad75d[_0x1082c7['body'][_0x82b3('0x80')]]=_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x7d')];return db['CmContact'][_0x82b3('0x5d')](_0xfad75d,{'fields':_0x4de445,'raw':!![]});}})[_0x82b3('0x20')](handleEntityNotFound(_0x2b6584,null))[_0x82b3('0x20')](function(_0x576bc3){_0x232580['contact']=_0x576bc3;if(_0x576bc3){var _0x5ea153={'ContactId':_0x576bc3['id'],'OpenchannelAccountId':_0x1082c7['params']['id'],'from':(_0x576bc3[_0x82b3('0x8f')]||'')+'\x20'+(_0x576bc3[_0x82b3('0x90')]||'')};var _0x3aad3f={'OpenchannelAccountId':_0x1082c7[_0x82b3('0x59')]['id'],'closed':![]};if(_0x1082c7['body'][_0x82b3('0x91')]){_0x3aad3f[_0x82b3('0x91')]=_0x1082c7[_0x82b3('0x5e')]['threadId'];return db[_0x82b3('0x92')][_0x82b3('0x5c')]({'where':_0x3aad3f})[_0x82b3('0x20')](function(_0x1dbb1b){if(_0x1dbb1b){return[_0x1dbb1b,![]];}_0x5ea153[_0x82b3('0x91')]=_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x91')];_0x5ea153[_0x82b3('0x93')]=_0x1082c7[_0x82b3('0x5e')]['externalUrl'];return db[_0x82b3('0x92')][_0x82b3('0x5d')](_0x5ea153)['then'](function(_0x5115ef){return[_0x5115ef,!![]];});});}else{_0x3aad3f[_0x82b3('0x91')]=null;}_0x3aad3f[_0x82b3('0x94')]=_0x576bc3['id'];return db[_0x82b3('0x92')][_0x82b3('0x5c')]({'where':_0x3aad3f})[_0x82b3('0x20')](function(_0x5b48a8){if(_0x5b48a8){return[_0x5b48a8,![]];}return db['OpenchannelInteraction'][_0x82b3('0x5d')](_0x5ea153)[_0x82b3('0x20')](function(_0x384b63){return[_0x384b63,!![]];});});}})[_0x82b3('0x95')](function(_0x228f2b,_0x2539c6){if(_0x228f2b){_0x460bb0=_0x2539c6;if(!_0x2539c6){var _0x284f42={'from':(_0x232580[_0x82b3('0x96')][_0x82b3('0x8f')]||'')+'\x20'+(_0x232580[_0x82b3('0x96')][_0x82b3('0x90')]||'')};if(_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x91')]&&_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x97')]&&_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x91')]!=_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x97')]){_0x284f42[_0x82b3('0x91')]=_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x97')];}return _0x228f2b[_0x82b3('0x36')](_0x284f42);}else{return _0x228f2b;}}})[_0x82b3('0x20')](function(_0x2a8e3a){_0x232580['interaction']=_0x2a8e3a[_0x82b3('0x38')]({'plain':!![]});_0x232580['interaction'][_0x82b3('0x98')]=_0x460bb0;if(_0x232580[_0x82b3('0x99')][_0x82b3('0x98')]){if(_0x232580[_0x82b3('0x89')][_0x82b3('0x9a')]){_0x232580[_0x82b3('0x8a')]['push']({'id':0x0,'priority':_0x232580[_0x82b3('0x8a')][_0x82b3('0x4c')]+0x1,'app':'close','appdata':_0x82b3('0x9b'),'interval':_0x82b3('0x9c')});}}return db[_0x82b3('0x9d')][_0x82b3('0x5d')]({'body':_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x5e')],'OpenchannelAccountId':_0x1082c7[_0x82b3('0x59')]['id'],'OpenchannelInteractionId':_0x2a8e3a['id'],'direction':'in','ContactId':_0x232580[_0x82b3('0x96')]['id'],'AttachmentId':_0x1082c7[_0x82b3('0x5e')][_0x82b3('0x9e')]});})[_0x82b3('0x20')](function(_0x286fe6){_0x232580[_0x82b3('0x28')]=_0x286fe6;if(!_0x232580[_0x82b3('0x99')]['UserId'])return;return db[_0x82b3('0x9f')][_0x82b3('0x5c')]({'attributes':['id',_0x82b3('0x3c')],'where':{'id':_0x232580[_0x82b3('0x99')][_0x82b3('0xa0')]}});})[_0x82b3('0x20')](function(_0x3abad8){if(_0x3abad8){_0x232580[_0x82b3('0x8a')][_0x82b3('0xa1')]({'id':0x0,'priority':0x0,'app':_0x82b3('0xa2'),'appdata':_0x3abad8[_0x82b3('0x3c')]+','+(_0x232580[_0x82b3('0x89')][_0x82b3('0xa3')]||0xa),'interval':'*,*,*,*'});}if(!_0x232580[_0x82b3('0x99')][_0x82b3('0xa4')])return;return db[_0x82b3('0xa5')][_0x82b3('0x5c')]({'attributes':['id',_0x82b3('0x3c')],'where':{'id':_0x232580[_0x82b3('0x99')][_0x82b3('0xa4')]}});})[_0x82b3('0x20')](function(_0x26aa46){if(_0x26aa46){_0x232580[_0x82b3('0x8a')][_0x82b3('0xa1')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x26aa46[_0x82b3('0x3c')]+','+(_0x232580[_0x82b3('0x89')][_0x82b3('0xa6')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x82b3('0xa7'),'startRouting',_0x232580);})['then'](function(_0x1447cc){respondWithRpcPromise(_0x82b3('0xa8'),_0x82b3('0xa8'),{'event':_0x82b3('0x72'),'message':_0x1447cc},client9002);return _0x1447cc;})['then'](respondWithResult(_0x2b6584,null))[_0x82b3('0x57')](handleError(_0x2b6584,null));};exports[_0x82b3('0xa9')]=function(_0x20ab65,_0x2a85f8){var _0x39cbd1=_0x20ab65[_0x82b3('0x59')]['id'];var _0x36115b=_0x20ab65[_0x82b3('0x5e')];var _0x131bab=0xc8;var _0x4d8ef8=null;return db['sequelize'][_0x82b3('0xaa')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x82b3('0xab')]},function(_0x3aceb0){return db[_0x82b3('0x41')][_0x82b3('0x68')]({'where':{'id':_0x39cbd1},'transaction':_0x3aceb0})[_0x82b3('0x20')](function(_0x38c8b8){if(_0x38c8b8){return db['OpenchannelApplication'][_0x82b3('0x37')]({'where':{'OpenchannelAccountId':_0x39cbd1},'transaction':_0x3aceb0})[_0x82b3('0x20')](function(){var _0x17cbf0=_[_0x82b3('0x40')](_0x36115b,function(_0x97aee6){_0x97aee6['OpenchannelAccountId']=_0x39cbd1;return _0x97aee6;});return db[_0x82b3('0xac')][_0x82b3('0xad')](_0x17cbf0,{'transaction':_0x3aceb0});});}else{_0x131bab=0x194;_0x4d8ef8=[];}});})['then'](function(){if(_0x131bab!==0x194){return db[_0x82b3('0xac')][_0x82b3('0xae')]({'where':{'OpenchannelAccountId':_0x39cbd1},'order':_0x82b3('0x8d')})[_0x82b3('0x20')](function(_0x49d227){_0x4d8ef8=_0x49d227;});}})[_0x82b3('0x57')](function(_0x334cdb){_0x131bab=0x1f4;logger[_0x82b3('0x27')](_0x334cdb['stack']);if(_0x334cdb[_0x82b3('0x3c')]){delete _0x334cdb[_0x82b3('0x3c')];}_0x4d8ef8=_0x334cdb;})[_0x82b3('0xaf')](function(){if(_0x4d8ef8===null){_0x2a85f8[_0x82b3('0x3a')](_0x131bab);}else{if(_0x131bab===0x1f4){_0x2a85f8[_0x82b3('0x2a')](_0x131bab)[_0x82b3('0x3d')](_0x4d8ef8);}else{_0x2a85f8[_0x82b3('0x2a')](_0x131bab)[_0x82b3('0x2c')](_0x4d8ef8);}}});};exports[_0x82b3('0xb0')]=function(_0x47b3fe,_0x334ff5,_0x955970){var _0x33abbd={};var _0x436f30={};var _0x16585d;var _0x10706d;return db[_0x82b3('0x41')][_0x82b3('0x68')]({'where':{'id':_0x47b3fe[_0x82b3('0x59')]['id']}})['then'](handleEntityNotFound(_0x334ff5,null))[_0x82b3('0x20')](function(_0x56d092){if(_0x56d092){_0x16585d=_0x56d092;_0x436f30[_0x82b3('0x46')]=_[_0x82b3('0x48')](db['OpenchannelApplication'][_0x82b3('0x42')]);_0x436f30['query']=_[_0x82b3('0x48')](_0x47b3fe[_0x82b3('0x47')]);_0x436f30[_0x82b3('0x49')]=_[_0x82b3('0x5b')](_0x436f30[_0x82b3('0x46')],_0x436f30[_0x82b3('0x47')]);_0x33abbd[_0x82b3('0x4a')]=_[_0x82b3('0x5b')](_0x436f30[_0x82b3('0x46')],qs[_0x82b3('0x4b')](_0x47b3fe['query'][_0x82b3('0x4b')]));_0x33abbd[_0x82b3('0x4a')]=_0x33abbd[_0x82b3('0x4a')][_0x82b3('0x4c')]?_0x33abbd[_0x82b3('0x4a')]:_0x436f30['model'];_0x33abbd[_0x82b3('0x4e')]=qs['sort'](_0x47b3fe['query'][_0x82b3('0x4f')]);_0x33abbd[_0x82b3('0x50')]=qs[_0x82b3('0x49')](_['pick'](_0x47b3fe['query'],_0x436f30[_0x82b3('0x49')]));if(_0x47b3fe[_0x82b3('0x47')]['filter']){_0x33abbd[_0x82b3('0x50')]=_[_0x82b3('0x53')](_0x33abbd['where'],{'$or':_[_0x82b3('0x40')](_0x33abbd[_0x82b3('0x4a')],function(_0x36329a){var _0x347624={};_0x347624[_0x36329a]={'$like':'%'+_0x47b3fe[_0x82b3('0x47')][_0x82b3('0x52')]+'%'};return _0x347624;})});}_0x33abbd=_[_0x82b3('0x53')]({},_0x33abbd,_0x47b3fe[_0x82b3('0x54')]);return _0x16585d[_0x82b3('0xb0')](_0x33abbd);}})[_0x82b3('0x20')](function(_0x4c3e82){if(_0x4c3e82){_0x10706d=_0x4c3e82[_0x82b3('0x4c')];if(!_0x47b3fe['query'][_0x82b3('0x4d')](_0x82b3('0x69'))){_0x33abbd[_0x82b3('0x2f')]=qs[_0x82b3('0x2f')](_0x47b3fe[_0x82b3('0x47')][_0x82b3('0x2f')]);_0x33abbd[_0x82b3('0x2d')]=qs['offset'](_0x47b3fe['query'][_0x82b3('0x2d')]);}return _0x16585d[_0x82b3('0xb0')](_0x33abbd);}})[_0x82b3('0x20')](function(_0x17246e){if(_0x17246e){return _0x17246e?{'count':_0x10706d,'rows':_0x17246e}:null;}})['then'](respondWithResult(_0x334ff5,null))[_0x82b3('0x57')](handleError(_0x334ff5,null));};exports[_0x82b3('0xb1')]=function(_0x405436,_0x58bcda,_0x35a522){var _0x5a6d5e={'raw':![],'where':{}};var _0x4c2b7e={};var _0x16c2b5={'count':0x0,'rows':[]};return db[_0x82b3('0x41')]['findOne']({'where':{'id':_0x405436[_0x82b3('0x59')]['id']}})[_0x82b3('0x20')](handleEntityNotFound(_0x58bcda,null))[_0x82b3('0x20')](function(_0x16bd90){if(_0x16bd90){_0x4c2b7e[_0x82b3('0x46')]=_[_0x82b3('0x48')](db[_0x82b3('0x92')][_0x82b3('0x42')]);_0x4c2b7e[_0x82b3('0x47')]=_[_0x82b3('0x48')](_0x405436[_0x82b3('0x47')]);_0x4c2b7e['filters']=_[_0x82b3('0x5b')](_0x4c2b7e[_0x82b3('0x46')],_0x4c2b7e['query']);_0x5a6d5e[_0x82b3('0x4a')]=_[_0x82b3('0x5b')](_0x4c2b7e[_0x82b3('0x46')],qs[_0x82b3('0x4b')](_0x405436[_0x82b3('0x47')][_0x82b3('0x4b')]));_0x5a6d5e[_0x82b3('0x4a')]=_0x5a6d5e['attributes'][_0x82b3('0x4c')]?_0x5a6d5e[_0x82b3('0x4a')]:_0x4c2b7e['model'];if(!_0x405436[_0x82b3('0x47')][_0x82b3('0x4d')](_0x82b3('0x69'))){_0x5a6d5e[_0x82b3('0x2f')]=qs['limit'](_0x405436['query'][_0x82b3('0x2f')]);_0x5a6d5e[_0x82b3('0x2d')]=qs[_0x82b3('0x2d')](_0x405436[_0x82b3('0x47')][_0x82b3('0x2d')]);}_0x5a6d5e[_0x82b3('0x4e')]=qs['sort'](_0x405436['query'][_0x82b3('0x4f')]);_0x5a6d5e[_0x82b3('0x50')]=qs[_0x82b3('0x49')](_[_0x82b3('0x51')](_0x405436[_0x82b3('0x47')],_0x4c2b7e['filters']));_0x5a6d5e[_0x82b3('0x50')][_0x82b3('0x6a')]=_0x16bd90['id'];if(_0x405436[_0x82b3('0x47')]['filter']){_0x5a6d5e[_0x82b3('0x50')]=_['merge'](_0x5a6d5e[_0x82b3('0x50')],{'$or':_[_0x82b3('0x40')](_0x5a6d5e[_0x82b3('0x4a')],function(_0x3d8974){var _0x19b5ee={};_0x19b5ee[_0x3d8974]={'$like':'%'+_0x405436[_0x82b3('0x47')][_0x82b3('0x52')]+'%'};return _0x19b5ee;})});}_0x5a6d5e=_[_0x82b3('0x53')]({},_0x5a6d5e,_0x405436[_0x82b3('0x54')]);return db[_0x82b3('0x92')][_0x82b3('0x30')]({'where':_0x5a6d5e[_0x82b3('0x50')]})['then'](function(_0x1d6e6a){_0x16c2b5['count']=_0x1d6e6a;if(_0x405436[_0x82b3('0x47')][_0x82b3('0x55')]){_0x5a6d5e[_0x82b3('0x56')]=[{'model':db[_0x82b3('0x74')],'as':_0x82b3('0xb2'),'required':![]},{'model':db[_0x82b3('0x9f')],'as':_0x82b3('0xb3'),'attributes':[_0x82b3('0x3c'),_0x82b3('0xb4'),_0x82b3('0xb5')],'required':![]},{'model':db[_0x82b3('0xb6')],'as':_0x82b3('0xb7'),'attributes':['id',_0x82b3('0x3c'),'color'],'where':_0x405436[_0x82b3('0x47')]['tag']?{'id':_0x405436[_0x82b3('0x47')][_0x82b3('0xb8')]}:undefined,'required':_0x405436[_0x82b3('0x47')][_0x82b3('0xb8')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x5a6d5e);})['then'](function(_0x3d6e50){_0x16c2b5[_0x82b3('0x6c')]=_0x3d6e50;return _0x16c2b5;});}})[_0x82b3('0x20')](respondWithFilteredResult(_0x58bcda,_0x5a6d5e))[_0x82b3('0x57')](handleError(_0x58bcda,null));};exports[_0x82b3('0xb9')]=function(_0x131fb3,_0x2b8e4b,_0x37963c){return db[_0x82b3('0x41')][_0x82b3('0x5c')]({'where':{'id':_0x131fb3[_0x82b3('0x59')]['id']}})[_0x82b3('0x20')](handleEntityNotFound(_0x2b8e4b,null))['then'](function(_0x456537){if(_0x456537){return _0x456537['addAgents'](_0x131fb3[_0x82b3('0x5e')]['ids'],_[_0x82b3('0xba')](_0x131fb3['body'],[_0x82b3('0x6d'),'id'])||{})[_0x82b3('0x95')](function(_0x93f7bf){for(var _0x22c73a=0x0;_0x22c73a<_0x131fb3[_0x82b3('0x5e')][_0x82b3('0x6d')][_0x82b3('0x4c')];_0x22c73a+=0x1){socket[_0x82b3('0xbb')](_0x82b3('0xbc'),{'UserId':Number(_0x131fb3[_0x82b3('0x5e')][_0x82b3('0x6d')][_0x22c73a]),'OpenchannelAccountId':Number(_0x131fb3[_0x82b3('0x59')]['id'])});}return _0x93f7bf;});}})[_0x82b3('0x20')](respondWithResult(_0x2b8e4b,null))[_0x82b3('0x57')](handleError(_0x2b8e4b,null));};exports[_0x82b3('0xbd')]=function(_0x351dfc,_0x146b9c,_0x36a353){return db[_0x82b3('0x41')][_0x82b3('0x5c')]({'where':{'id':_0x351dfc[_0x82b3('0x59')]['id']}})[_0x82b3('0x20')](handleEntityNotFound(_0x146b9c,null))[_0x82b3('0x20')](function(_0x26c8ef){if(_0x26c8ef){return _0x26c8ef[_0x82b3('0xbd')](_0x351dfc['query'][_0x82b3('0x6d')])[_0x82b3('0x20')](function(){if(_[_0x82b3('0xbe')](_0x351dfc[_0x82b3('0x47')][_0x82b3('0x6d')])){for(var _0x9c1f97=0x0;_0x9c1f97<_0x351dfc['query'][_0x82b3('0x6d')][_0x82b3('0x4c')];_0x9c1f97+=0x1){socket['emit'](_0x82b3('0xbf'),{'UserId':Number(_0x351dfc['query'][_0x82b3('0x6d')][_0x9c1f97]),'OpenchannelAccountId':Number(_0x351dfc[_0x82b3('0x59')]['id'])});}}else{socket['emit'](_0x82b3('0xbf'),{'UserId':Number(_0x351dfc[_0x82b3('0x47')][_0x82b3('0x6d')]),'OpenchannelAccountId':Number(_0x351dfc[_0x82b3('0x59')]['id'])});}});}})[_0x82b3('0x20')](respondWithStatusCode(_0x146b9c,null))['catch'](handleError(_0x146b9c,null));};exports[_0x82b3('0xc0')]=function(_0x536d1e,_0x4e31a5,_0x3b480b){var _0x39dc22={};var _0x2ae8ed={};var _0x1b3c8d;var _0x54308e;return db[_0x82b3('0x41')]['findOne']({'where':{'id':_0x536d1e[_0x82b3('0x59')]['id']}})[_0x82b3('0x20')](handleEntityNotFound(_0x4e31a5,null))[_0x82b3('0x20')](function(_0x380a3b){if(_0x380a3b){_0x1b3c8d=_0x380a3b;_0x2ae8ed['model']=_[_0x82b3('0x48')](db[_0x82b3('0x9f')][_0x82b3('0x42')]);_0x2ae8ed[_0x82b3('0x47')]=_[_0x82b3('0x48')](_0x536d1e[_0x82b3('0x47')]);_0x2ae8ed[_0x82b3('0x49')]=_[_0x82b3('0x5b')](_0x2ae8ed['model'],_0x2ae8ed[_0x82b3('0x47')]);_0x39dc22['attributes']=_[_0x82b3('0x5b')](_0x2ae8ed[_0x82b3('0x46')],qs[_0x82b3('0x4b')](_0x536d1e[_0x82b3('0x47')][_0x82b3('0x4b')]));_0x39dc22[_0x82b3('0x4a')]=_0x39dc22[_0x82b3('0x4a')]['length']?_0x39dc22['attributes']:_0x2ae8ed[_0x82b3('0x46')];_0x39dc22[_0x82b3('0x4e')]=qs[_0x82b3('0x4f')](_0x536d1e[_0x82b3('0x47')][_0x82b3('0x4f')]);_0x39dc22['where']=qs['filters'](_[_0x82b3('0x51')](_0x536d1e[_0x82b3('0x47')],_0x2ae8ed[_0x82b3('0x49')]));if(_0x536d1e['query'][_0x82b3('0x52')]){_0x39dc22[_0x82b3('0x50')]=_[_0x82b3('0x53')](_0x39dc22['where'],{'$or':_['map'](_0x39dc22['attributes'],function(_0x205589){var _0x438ae7={};_0x438ae7[_0x205589]={'$like':'%'+_0x536d1e['query'][_0x82b3('0x52')]+'%'};return _0x438ae7;})});}_0x39dc22=_[_0x82b3('0x53')]({},_0x39dc22,_0x536d1e['options']);return _0x1b3c8d[_0x82b3('0xc0')](_0x39dc22);}})['then'](function(_0x40302f){if(_0x40302f){_0x54308e=_0x40302f[_0x82b3('0x4c')];if(!_0x536d1e[_0x82b3('0x47')][_0x82b3('0x4d')](_0x82b3('0x69'))){_0x39dc22[_0x82b3('0x2f')]=qs[_0x82b3('0x2f')](_0x536d1e[_0x82b3('0x47')][_0x82b3('0x2f')]);_0x39dc22[_0x82b3('0x2d')]=qs[_0x82b3('0x2d')](_0x536d1e[_0x82b3('0x47')][_0x82b3('0x2d')]);}return _0x1b3c8d['getAgents'](_0x39dc22);}})['then'](function(_0x54afe1){if(_0x54afe1){return _0x54afe1?{'count':_0x54308e,'rows':_0x54afe1}:null;}})[_0x82b3('0x20')](respondWithResult(_0x4e31a5,null))[_0x82b3('0x57')](handleError(_0x4e31a5,null));};exports[_0x82b3('0x3d')]=function(_0x14aa30,_0x78b946,_0x175ae3){var _0x1873d3,_0x5a1edf,_0x5267b5;if(_['isNil'](_0x14aa30[_0x82b3('0x5e')][_0x82b3('0x5e')])||_0x14aa30[_0x82b3('0x5e')]['body']===''){throw new db[(_0x82b3('0x75'))]['ValidationError'](_0x82b3('0x7f'));}if(_[_0x82b3('0x7e')](_0x14aa30[_0x82b3('0x5e')]['to'])){}_0x1873d3=_0x14aa30[_0x82b3('0x5e')]['to'];return db[_0x82b3('0x41')]['findOne']({'where':{'id':_0x14aa30['params']['id']}})[_0x82b3('0x20')](handleEntityNotFound(_0x78b946,null))['then'](function(_0x3c2b20){if(_0x3c2b20){return db['OpenchannelAccount'][_0x82b3('0x5c')]({'where':{'id':_0x3c2b20['id']},'include':[{'model':db[_0x82b3('0x84')],'as':_0x82b3('0x85'),'include':[{'model':db[_0x82b3('0x74')],'as':_0x82b3('0x86'),'where':{[_0x3c2b20['mapKey']]:_0x1873d3},'limit':0x1,'order':[[_0x82b3('0x79'),_0x82b3('0x87')]]}]}]})[_0x82b3('0x20')](handleEntityNotFound(_0x78b946,null))[_0x82b3('0x20')](function(_0x4444ff){if(_0x4444ff&&_0x4444ff[_0x82b3('0x85')]){_0x5a1edf=_0x4444ff['get']({'plain':!![]});if(_0x5a1edf[_0x82b3('0x85')]&&_0x5a1edf[_0x82b3('0x85')][_0x82b3('0x86')][_0x82b3('0x4c')]){return _0x5a1edf['List'][_0x82b3('0x86')][0x0];}return db['CmContact'][_0x82b3('0x5d')](_[_0x82b3('0x19')](_0x14aa30[_0x82b3('0x5e')],{'firstName':_0x1873d3,[_0x4444ff[_0x82b3('0x80')]]:_0x1873d3,'phone':_0x1873d3,'ListId':_0x5a1edf[_0x82b3('0x7c')]}));}})['then'](handleEntityNotFound(_0x78b946,null))['then'](function(_0x25e8b6){if(_0x25e8b6){_0x5267b5=_0x25e8b6;return db[_0x82b3('0x92')][_0x82b3('0x5c')]({'where':{'ContactId':_0x5267b5['id'],'closed':![],'OpenchannelAccountId':_0x5a1edf['id']}})[_0x82b3('0x20')](function(_0x259d6c){if(_0x259d6c){return[_0x259d6c,![]];}return db['OpenchannelInteraction'][_0x82b3('0x5d')]({'UserId':_0x14aa30[_0x82b3('0x5f')]['id'],'ContactId':_0x5267b5['id'],'OpenchannelAccountId':_0x5a1edf['id'],'lastMsgDirection':_0x82b3('0xc1'),'firstMsgDirection':_0x82b3('0xc1'),'Messages':[_[_0x82b3('0x53')](_0x14aa30[_0x82b3('0x5e')],{'read':![],'body':_0x14aa30[_0x82b3('0x5e')][_0x82b3('0x5e')],'OpenchannelAccountId':_0x5a1edf['id'],'UserId':_0x14aa30[_0x82b3('0x5f')]['id'],'ContactId':_0x5267b5['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x82b3('0xc2')}]})[_0x82b3('0x20')](function(_0x436c57){return[_0x436c57,!![]];});});}})[_0x82b3('0x95')](function(_0x284356,_0x332674){if(_0x332674){return _0x284356;}return db[_0x82b3('0x9d')][_0x82b3('0x5d')](_[_0x82b3('0x53')](_0x14aa30[_0x82b3('0x5e')],{'read':![],'body':_0x14aa30[_0x82b3('0x5e')][_0x82b3('0x5e')],'OpenchannelAccountId':_0x5a1edf['id'],'OpenchannelInteractionId':_0x284356['id'],'UserId':_0x14aa30[_0x82b3('0x5f')]['id'],'ContactId':_0x5267b5['id']}))[_0x82b3('0x20')](function(_0x49b5f4){_0x284356[_0x82b3('0xc3')][_0x82b3('0xc2')]=[];_0x284356[_0x82b3('0xc3')][_0x82b3('0xc2')][_0x82b3('0xc4')](_0x49b5f4[_0x82b3('0xc3')]);return _0x284356;});});}})[_0x82b3('0x20')](respondWithResult(_0x78b946,null))[_0x82b3('0x57')](handleError(_0x78b946,null));}; \ No newline at end of file +var _0xe353=['priority','finally','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./openchannelAccount.socket','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','OpenchannelAccount','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','map','VIRTUAL','merge','options','include','findAll','rows','show','params','mandatoryDispositionPause','keys','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','order','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','difference','createdAt','updatedAt','ListId','isNil','from','ValidationError','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','OpenchannelApplication','Applications','List','account','applications','list','orderBy','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','OpenchannelQueue','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate'];(function(_0x2d103e,_0x5ce2e4){var _0x4ac7c9=function(_0x989d02){while(--_0x989d02){_0x2d103e['push'](_0x2d103e['shift']());}};_0x4ac7c9(++_0x5ce2e4);}(_0xe353,0xdc));var _0x3e35=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xe353[_0x122096];return _0x3d1966;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e35('0x0'));var zipdir=require(_0x3e35('0x1'));var jsonpatch=require(_0x3e35('0x2'));var rp=require(_0x3e35('0x3'));var moment=require(_0x3e35('0x4'));var BPromise=require(_0x3e35('0x5'));var Mustache=require(_0x3e35('0x6'));var util=require(_0x3e35('0x7'));var path=require(_0x3e35('0x8'));var sox=require(_0x3e35('0x9'));var csv=require(_0x3e35('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e35('0xb'));var _=require(_0x3e35('0xc'));var squel=require(_0x3e35('0xd'));var crypto=require('crypto');var jsforce=require(_0x3e35('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3e35('0xa'));var querystring=require(_0x3e35('0xf'));var Papa=require(_0x3e35('0x10'));var Redis=require(_0x3e35('0x11'));var authService=require(_0x3e35('0x12'));var qs=require(_0x3e35('0x13'));var as=require(_0x3e35('0x14'));var hardwareService=require(_0x3e35('0x15'));var logger=require(_0x3e35('0x16'))('api');var utils=require(_0x3e35('0x17'));var config=require(_0x3e35('0x18'));var licenseUtil=require(_0x3e35('0x19'));var db=require(_0x3e35('0x1a'))['db'];config['redis']=_[_0x3e35('0x1b')](config[_0x3e35('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3e35('0x1c')]));require(_0x3e35('0x1d'))[_0x3e35('0x1e')](socket);var jayson=require(_0x3e35('0x1f'));var client=jayson[_0x3e35('0x20')][_0x3e35('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x3e35('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5ab566,_0x171970,_0x50af2d,_0x419c92){return new BPromise(function(_0x296938,_0x261e73){var _0x2b098a=_0x419c92||client;return _0x2b098a[_0x3e35('0x22')](_0x5ab566,_0x50af2d)['then'](function(_0x167531){logger[_0x3e35('0x23')](_0x3e35('0x24'),_0x171970,_0x3e35('0x25'));logger['debug'](_0x3e35('0x26'),_0x171970,'request\x20sent',JSON[_0x3e35('0x27')](_0x167531));if(_0x167531[_0x3e35('0x28')]){if(_0x167531[_0x3e35('0x28')][_0x3e35('0x29')]===0x1f4){logger['error'](_0x3e35('0x24'),_0x171970,_0x167531[_0x3e35('0x28')]['message']);return _0x261e73(_0x167531[_0x3e35('0x28')]['message']);}logger[_0x3e35('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x171970,_0x167531['error'][_0x3e35('0x2a')]);return _0x296938(_0x167531[_0x3e35('0x28')][_0x3e35('0x2a')]);}else{logger[_0x3e35('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x171970,_0x3e35('0x25'));_0x296938(_0x167531['result'][_0x3e35('0x2a')]);}})[_0x3e35('0x2b')](function(_0xdf7d26){logger[_0x3e35('0x28')](_0x3e35('0x24'),_0x171970,_0xdf7d26);_0x261e73(_0xdf7d26);});});}function respondWithStatusCode(_0x3c72e9,_0xe3d663){_0xe3d663=_0xe3d663||0xcc;return function(_0x396c00){if(_0x396c00){return _0x3c72e9[_0x3e35('0x2c')](_0xe3d663);}return _0x3c72e9['status'](_0xe3d663)[_0x3e35('0x2d')]();};}function respondWithResult(_0xbbe636,_0x2b4d25){_0x2b4d25=_0x2b4d25||0xc8;return function(_0x3101fb){if(_0x3101fb){return _0xbbe636[_0x3e35('0x2e')](_0x2b4d25)['json'](_0x3101fb);}};}function respondWithFilteredResult(_0x2ab680,_0x138ee3){return function(_0x2139b7){if(_0x2139b7){var _0x3e2581=typeof _0x138ee3[_0x3e35('0x2f')]===_0x3e35('0x30')&&typeof _0x138ee3[_0x3e35('0x31')]==='undefined';var _0x2e19ce=_0x2139b7[_0x3e35('0x32')];var _0x23dc0c=_0x3e2581?0x0:_0x138ee3['offset'];var _0x4097e5=_0x3e2581?_0x2139b7[_0x3e35('0x32')]:_0x138ee3['offset']+_0x138ee3[_0x3e35('0x31')];var _0x3948e0;if(_0x4097e5>=_0x2e19ce){_0x4097e5=_0x2e19ce;_0x3948e0=0xc8;}else{_0x3948e0=0xce;}_0x2ab680['status'](_0x3948e0);return _0x2ab680['set']('Content-Range',_0x23dc0c+'-'+_0x4097e5+'/'+_0x2e19ce)[_0x3e35('0x33')](_0x2139b7);}return null;};}function patchUpdates(_0x48e55e){return function(_0x10a705){try{jsonpatch[_0x3e35('0x34')](_0x10a705,_0x48e55e,!![]);}catch(_0x279b50){return BPromise[_0x3e35('0x35')](_0x279b50);}return _0x10a705[_0x3e35('0x36')]();};}function saveUpdates(_0x190b12,_0x260c58){return function(_0x46ec31){if(_0x46ec31){return _0x46ec31[_0x3e35('0x37')](_0x190b12)[_0x3e35('0x38')](function(_0x5d6afe){return _0x5d6afe;});}return null;};}function removeEntity(_0x853b2c,_0x24393c){return function(_0x16866f){if(_0x16866f){return _0x16866f[_0x3e35('0x39')]()[_0x3e35('0x38')](function(){var _0x43a084=_0x16866f['get']({'plain':!![]});var _0x500b43=_0x3e35('0x3a');return db[_0x3e35('0x3b')][_0x3e35('0x39')]({'where':{'type':_0x500b43,'resourceId':_0x43a084['id']}})[_0x3e35('0x38')](function(){return _0x16866f;});})['then'](function(){_0x853b2c[_0x3e35('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c1b88,_0x261160){return function(_0x2babe5){if(!_0x2babe5){_0x3c1b88[_0x3e35('0x2c')](0x194);}return _0x2babe5;};}function handleError(_0x4b602e,_0xe6b444){_0xe6b444=_0xe6b444||0x1f4;return function(_0x590e77){logger['error'](_0x590e77[_0x3e35('0x3c')]);if(_0x590e77[_0x3e35('0x3d')]){delete _0x590e77['name'];}_0x4b602e[_0x3e35('0x2e')](_0xe6b444)[_0x3e35('0x3e')](_0x590e77);};}exports[_0x3e35('0x3f')]=function(_0x3f99d9,_0x3a56a8){var _0x5de5d8={'include':[{'model':db[_0x3e35('0x40')],'as':'mandatoryDispositionPause'}]},_0x18c02a={},_0xb2d0ca={'count':0x0,'rows':[]};var _0x85b8=_['map'](db[_0x3e35('0x41')][_0x3e35('0x42')],function(_0xc31aea){return{'name':_0xc31aea['fieldName'],'type':_0xc31aea[_0x3e35('0x43')][_0x3e35('0x44')]};});_0x18c02a['model']=_['map'](_0x85b8,_0x3e35('0x3d'));_0x18c02a[_0x3e35('0x45')]=_['keys'](_0x3f99d9[_0x3e35('0x45')]);_0x18c02a[_0x3e35('0x46')]=_['intersection'](_0x18c02a[_0x3e35('0x47')],_0x18c02a['query']);_0x5de5d8[_0x3e35('0x48')]=_[_0x3e35('0x49')](_0x18c02a[_0x3e35('0x47')],qs['fields'](_0x3f99d9[_0x3e35('0x45')][_0x3e35('0x4a')]));_0x5de5d8[_0x3e35('0x48')]=_0x5de5d8[_0x3e35('0x48')][_0x3e35('0x4b')]?_0x5de5d8[_0x3e35('0x48')]:_0x18c02a[_0x3e35('0x47')];if(!_0x3f99d9[_0x3e35('0x45')][_0x3e35('0x4c')](_0x3e35('0x4d'))){_0x5de5d8[_0x3e35('0x31')]=qs['limit'](_0x3f99d9['query'][_0x3e35('0x31')]);_0x5de5d8[_0x3e35('0x2f')]=qs['offset'](_0x3f99d9[_0x3e35('0x45')][_0x3e35('0x2f')]);}_0x5de5d8['order']=qs[_0x3e35('0x4e')](_0x3f99d9[_0x3e35('0x45')]['sort']);_0x5de5d8[_0x3e35('0x4f')]=qs[_0x3e35('0x46')](_['pick'](_0x3f99d9[_0x3e35('0x45')],_0x18c02a[_0x3e35('0x46')]),_0x85b8);if(_0x3f99d9[_0x3e35('0x45')][_0x3e35('0x50')]){_0x5de5d8['where']=_['merge'](_0x5de5d8['where'],{'$or':_[_0x3e35('0x51')](_0x85b8,function(_0x330320){if(_0x330320[_0x3e35('0x43')]!==_0x3e35('0x52')){var _0x39a5d8={};_0x39a5d8[_0x330320[_0x3e35('0x3d')]]={'$like':'%'+_0x3f99d9[_0x3e35('0x45')][_0x3e35('0x50')]+'%'};return _0x39a5d8;}})});}_0x5de5d8=_[_0x3e35('0x53')]({},_0x5de5d8,_0x3f99d9[_0x3e35('0x54')]);var _0x1b714c={'where':_0x5de5d8['where']};return db[_0x3e35('0x41')][_0x3e35('0x32')](_0x1b714c)[_0x3e35('0x38')](function(_0x2d8159){_0xb2d0ca[_0x3e35('0x32')]=_0x2d8159;if(_0x3f99d9[_0x3e35('0x45')]['includeAll']){_0x5de5d8[_0x3e35('0x55')]=[{'all':!![]}];}return db[_0x3e35('0x41')][_0x3e35('0x56')](_0x5de5d8);})[_0x3e35('0x38')](function(_0x26d668){_0xb2d0ca[_0x3e35('0x57')]=_0x26d668;return _0xb2d0ca;})[_0x3e35('0x38')](respondWithFilteredResult(_0x3a56a8,_0x5de5d8))[_0x3e35('0x2b')](handleError(_0x3a56a8,null));};exports[_0x3e35('0x58')]=function(_0x5083eb,_0x43fd8e){var _0x149625={'raw':![],'where':{'id':_0x5083eb[_0x3e35('0x59')]['id']},'include':[{'model':db[_0x3e35('0x40')],'as':_0x3e35('0x5a')}]},_0x30a550={};_0x30a550['model']=_[_0x3e35('0x5b')](db[_0x3e35('0x41')][_0x3e35('0x42')]);_0x30a550[_0x3e35('0x45')]=_['keys'](_0x5083eb[_0x3e35('0x45')]);_0x30a550[_0x3e35('0x46')]=_['intersection'](_0x30a550[_0x3e35('0x47')],_0x30a550[_0x3e35('0x45')]);_0x149625[_0x3e35('0x48')]=_[_0x3e35('0x49')](_0x30a550[_0x3e35('0x47')],qs[_0x3e35('0x4a')](_0x5083eb[_0x3e35('0x45')][_0x3e35('0x4a')]));_0x149625[_0x3e35('0x48')]=_0x149625[_0x3e35('0x48')][_0x3e35('0x4b')]?_0x149625[_0x3e35('0x48')]:_0x30a550['model'];if(_0x5083eb[_0x3e35('0x45')][_0x3e35('0x5c')]){_0x149625[_0x3e35('0x55')]=[{'all':!![]}];}_0x149625=_[_0x3e35('0x53')]({},_0x149625,_0x5083eb[_0x3e35('0x54')]);return db[_0x3e35('0x41')]['find'](_0x149625)[_0x3e35('0x38')](handleEntityNotFound(_0x43fd8e,null))['then'](respondWithResult(_0x43fd8e,null))['catch'](handleError(_0x43fd8e,null));};exports[_0x3e35('0x5d')]=function(_0x2361f4,_0x48e7c5){return db['OpenchannelAccount'][_0x3e35('0x5d')](_0x2361f4[_0x3e35('0x5e')],{})['then'](function(_0xc91bae){var _0x56d72b=_0x2361f4['user'][_0x3e35('0x5f')]({'plain':!![]});if(!_0x56d72b)throw new Error(_0x3e35('0x60'));if(_0x56d72b[_0x3e35('0x61')]===_0x3e35('0x62')){var _0x4036dc=_0xc91bae[_0x3e35('0x5f')]({'plain':!![]});var _0x51b1cc='OpenchannelAccounts';return db[_0x3e35('0x63')][_0x3e35('0x64')]({'where':{'name':_0x51b1cc,'userProfileId':_0x56d72b['userProfileId']},'raw':!![]})[_0x3e35('0x38')](function(_0x50e0ec){if(_0x50e0ec&&_0x50e0ec[_0x3e35('0x65')]===0x0){return db['UserProfileResource']['create']({'name':_0x4036dc['name'],'resourceId':_0x4036dc['id'],'type':_0x50e0ec[_0x3e35('0x3d')],'sectionId':_0x50e0ec['id']},{})[_0x3e35('0x38')](function(){return _0xc91bae;});}else{return _0xc91bae;}})[_0x3e35('0x2b')](function(_0x5c51c2){logger[_0x3e35('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c51c2);throw _0x5c51c2;});}return _0xc91bae;})[_0x3e35('0x38')](respondWithResult(_0x48e7c5,0xc9))['catch'](handleError(_0x48e7c5,null));};exports[_0x3e35('0x37')]=function(_0x8300fb,_0x224a04){if(_0x8300fb[_0x3e35('0x5e')]['id']){delete _0x8300fb[_0x3e35('0x5e')]['id'];}return db[_0x3e35('0x41')][_0x3e35('0x64')]({'where':{'id':_0x8300fb['params']['id']},'include':[{'model':db['Pause'],'as':_0x3e35('0x5a')}]})[_0x3e35('0x38')](handleEntityNotFound(_0x224a04,null))['then'](saveUpdates(_0x8300fb[_0x3e35('0x5e')],null))[_0x3e35('0x38')](respondWithResult(_0x224a04,null))[_0x3e35('0x2b')](handleError(_0x224a04,null));};exports[_0x3e35('0x39')]=function(_0x43b8b5,_0x57ea22){return db[_0x3e35('0x41')][_0x3e35('0x64')]({'where':{'id':_0x43b8b5[_0x3e35('0x59')]['id']}})['then'](handleEntityNotFound(_0x57ea22,null))[_0x3e35('0x38')](removeEntity(_0x57ea22,null))['catch'](handleError(_0x57ea22,null));};exports[_0x3e35('0x66')]=function(_0xc90fbe,_0x4cbc04){return db[_0x3e35('0x41')]['describe']()[_0x3e35('0x38')](respondWithResult(_0x4cbc04,null))['catch'](handleError(_0x4cbc04,null));};exports['addDisposition']=function(_0x148b13,_0x46bb91,_0x59e613){if(_0x148b13[_0x3e35('0x5e')]['id']){delete _0x148b13[_0x3e35('0x5e')]['id'];}return db[_0x3e35('0x41')][_0x3e35('0x64')]({'where':{'id':_0x148b13[_0x3e35('0x59')]['id']}})['then'](handleEntityNotFound(_0x46bb91,null))['then'](function(_0x426530){if(_0x426530){_0x148b13[_0x3e35('0x5e')][_0x3e35('0x67')]=_0x426530['id'];return db[_0x3e35('0x68')][_0x3e35('0x5d')](_0x148b13['body']);}})[_0x3e35('0x38')](respondWithResult(_0x46bb91,null))['catch'](handleError(_0x46bb91,null));};exports[_0x3e35('0x69')]=function(_0x450daa,_0x572e6f,_0xd98b15){var _0x37e607={'raw':![],'where':{}};var _0x56443f={};var _0x2b4df0={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x3e35('0x6a')]({'where':{'id':_0x450daa[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0x572e6f,null))[_0x3e35('0x38')](function(_0x2599a4){if(_0x2599a4){_0x56443f[_0x3e35('0x47')]=_[_0x3e35('0x5b')](db[_0x3e35('0x68')][_0x3e35('0x42')]);_0x56443f[_0x3e35('0x45')]=_[_0x3e35('0x5b')](_0x450daa[_0x3e35('0x45')]);_0x56443f['filters']=_[_0x3e35('0x49')](_0x56443f[_0x3e35('0x47')],_0x56443f['query']);_0x37e607[_0x3e35('0x48')]=_['intersection'](_0x56443f[_0x3e35('0x47')],qs[_0x3e35('0x4a')](_0x450daa[_0x3e35('0x45')][_0x3e35('0x4a')]));_0x37e607[_0x3e35('0x48')]=_0x37e607[_0x3e35('0x48')][_0x3e35('0x4b')]?_0x37e607[_0x3e35('0x48')]:_0x56443f[_0x3e35('0x47')];if(!_0x450daa[_0x3e35('0x45')]['hasOwnProperty'](_0x3e35('0x4d'))){_0x37e607[_0x3e35('0x31')]=qs[_0x3e35('0x31')](_0x450daa[_0x3e35('0x45')]['limit']);_0x37e607['offset']=qs[_0x3e35('0x2f')](_0x450daa[_0x3e35('0x45')][_0x3e35('0x2f')]);}_0x37e607[_0x3e35('0x6b')]=qs[_0x3e35('0x4e')](_0x450daa['query']['sort']);_0x37e607[_0x3e35('0x4f')]=qs[_0x3e35('0x46')](_[_0x3e35('0x6c')](_0x450daa[_0x3e35('0x45')],_0x56443f[_0x3e35('0x46')]));_0x37e607['where'][_0x3e35('0x67')]=_0x2599a4['id'];if(_0x450daa[_0x3e35('0x45')][_0x3e35('0x50')]){_0x37e607[_0x3e35('0x4f')]=_[_0x3e35('0x53')](_0x37e607[_0x3e35('0x4f')],{'$or':_[_0x3e35('0x51')](_0x37e607[_0x3e35('0x48')],function(_0x4c13ff){var _0x4b23c6={};_0x4b23c6[_0x4c13ff]={'$like':'%'+_0x450daa[_0x3e35('0x45')][_0x3e35('0x50')]+'%'};return _0x4b23c6;})});}_0x37e607=_[_0x3e35('0x53')]({},_0x37e607,_0x450daa[_0x3e35('0x54')]);return db[_0x3e35('0x68')][_0x3e35('0x32')]({'where':_0x37e607[_0x3e35('0x4f')]})[_0x3e35('0x38')](function(_0x32237a){_0x2b4df0[_0x3e35('0x32')]=_0x32237a;if(_0x450daa['query'][_0x3e35('0x5c')]){_0x37e607[_0x3e35('0x55')]=[{'all':!![]}];}return db[_0x3e35('0x68')][_0x3e35('0x56')](_0x37e607);})[_0x3e35('0x38')](function(_0x2d132a){_0x2b4df0[_0x3e35('0x57')]=_0x2d132a;return _0x2b4df0;});}})['then'](respondWithFilteredResult(_0x572e6f,_0x37e607))[_0x3e35('0x2b')](handleError(_0x572e6f,null));};exports[_0x3e35('0x6d')]=function(_0x375e51,_0x4b4d72,_0xe5915b){return db[_0x3e35('0x41')][_0x3e35('0x64')]({'where':{'id':_0x375e51[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0x4b4d72,null))[_0x3e35('0x38')](function(_0x34e733){if(_0x34e733){return _0x34e733[_0x3e35('0x6d')](_0x375e51[_0x3e35('0x45')][_0x3e35('0x6e')]);}})['then'](respondWithStatusCode(_0x4b4d72,null))[_0x3e35('0x2b')](handleError(_0x4b4d72,null));};exports[_0x3e35('0x6f')]=function(_0x5e3be8,_0x34714c,_0x23c665){if(_0x5e3be8[_0x3e35('0x5e')]['id']){delete _0x5e3be8['body']['id'];}return db[_0x3e35('0x41')]['find']({'where':{'id':_0x5e3be8[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0x34714c,null))[_0x3e35('0x38')](function(_0x54ad70){if(_0x54ad70){_0x5e3be8[_0x3e35('0x5e')]['OpenchannelAccountId']=_0x54ad70['id'];return db['CannedAnswer'][_0x3e35('0x5d')](_0x5e3be8['body']);}})[_0x3e35('0x38')](respondWithResult(_0x34714c,null))['catch'](handleError(_0x34714c,null));};exports[_0x3e35('0x70')]=function(_0x5abd87,_0x2379c2,_0x4ffd57){var _0x4da24f={'raw':![],'where':{}};var _0x5d99ff={};var _0x433e8c={'count':0x0,'rows':[]};return db[_0x3e35('0x41')]['findOne']({'where':{'id':_0x5abd87[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0x2379c2,null))[_0x3e35('0x38')](function(_0x5bf8a2){if(_0x5bf8a2){_0x5d99ff[_0x3e35('0x47')]=_[_0x3e35('0x5b')](db[_0x3e35('0x71')][_0x3e35('0x42')]);_0x5d99ff[_0x3e35('0x45')]=_['keys'](_0x5abd87['query']);_0x5d99ff[_0x3e35('0x46')]=_['intersection'](_0x5d99ff[_0x3e35('0x47')],_0x5d99ff['query']);_0x4da24f[_0x3e35('0x48')]=_[_0x3e35('0x49')](_0x5d99ff[_0x3e35('0x47')],qs[_0x3e35('0x4a')](_0x5abd87['query'][_0x3e35('0x4a')]));_0x4da24f[_0x3e35('0x48')]=_0x4da24f[_0x3e35('0x48')][_0x3e35('0x4b')]?_0x4da24f[_0x3e35('0x48')]:_0x5d99ff['model'];if(!_0x5abd87[_0x3e35('0x45')]['hasOwnProperty'](_0x3e35('0x4d'))){_0x4da24f['limit']=qs[_0x3e35('0x31')](_0x5abd87[_0x3e35('0x45')][_0x3e35('0x31')]);_0x4da24f[_0x3e35('0x2f')]=qs[_0x3e35('0x2f')](_0x5abd87['query'][_0x3e35('0x2f')]);}_0x4da24f[_0x3e35('0x6b')]=qs[_0x3e35('0x4e')](_0x5abd87[_0x3e35('0x45')][_0x3e35('0x4e')]);_0x4da24f['where']=qs[_0x3e35('0x46')](_[_0x3e35('0x6c')](_0x5abd87[_0x3e35('0x45')],_0x5d99ff[_0x3e35('0x46')]));_0x4da24f[_0x3e35('0x4f')][_0x3e35('0x67')]=_0x5bf8a2['id'];if(_0x5abd87[_0x3e35('0x45')]['filter']){_0x4da24f[_0x3e35('0x4f')]=_[_0x3e35('0x53')](_0x4da24f['where'],{'$or':_['map'](_0x4da24f[_0x3e35('0x48')],function(_0x1d760b){var _0xf6c5a1={};_0xf6c5a1[_0x1d760b]={'$like':'%'+_0x5abd87['query'][_0x3e35('0x50')]+'%'};return _0xf6c5a1;})});}_0x4da24f=_[_0x3e35('0x53')]({},_0x4da24f,_0x5abd87[_0x3e35('0x54')]);return db[_0x3e35('0x71')][_0x3e35('0x32')]({'where':_0x4da24f[_0x3e35('0x4f')]})['then'](function(_0x103ee6){_0x433e8c['count']=_0x103ee6;if(_0x5abd87[_0x3e35('0x45')][_0x3e35('0x5c')]){_0x4da24f[_0x3e35('0x55')]=[{'all':!![]}];}return db[_0x3e35('0x71')][_0x3e35('0x56')](_0x4da24f);})[_0x3e35('0x38')](function(_0x438707){_0x433e8c['rows']=_0x438707;return _0x433e8c;});}})[_0x3e35('0x38')](respondWithFilteredResult(_0x2379c2,_0x4da24f))['catch'](handleError(_0x2379c2,null));};exports[_0x3e35('0x72')]=function(_0x1c4372,_0x59894f,_0x35a14c){return db[_0x3e35('0x41')][_0x3e35('0x64')]({'where':{'id':_0x1c4372[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0x59894f,null))['then'](function(_0x496f10){if(_0x496f10){return _0x496f10['removeAnswers'](_0x1c4372['query']['ids']);}})[_0x3e35('0x38')](respondWithStatusCode(_0x59894f,null))[_0x3e35('0x2b')](handleError(_0x59894f,null));};exports[_0x3e35('0x73')]=function(_0x48dfb0,_0x530c3a,_0x16bac5){var _0x334d15={'body':_0x48dfb0[_0x3e35('0x5e')],'channel':'openchannel'};var _0x265ab9=[];var _0xbd04f3=[];var _0x5b4b72={};var _0x17670a=![];return db[_0x3e35('0x74')][_0x3e35('0x66')]()[_0x3e35('0x38')](function(_0x302737){if(!_0x302737){throw new db[(_0x3e35('0x75'))]['ValidationError']('no\x20available\x20attributes');}_0x265ab9=_[_0x3e35('0x76')](_[_0x3e35('0x5b')](_0x302737),[_0x3e35('0x77'),_0x3e35('0x78')]);_0xbd04f3=_[_0x3e35('0x76')](_[_0x3e35('0x5b')](_0x302737),[_0x3e35('0x77'),_0x3e35('0x78'),'CompanyId',_0x3e35('0x79')]);if(_0x48dfb0[_0x3e35('0x5e')]['id']){delete _0x48dfb0[_0x3e35('0x5e')]['id'];}if(_[_0x3e35('0x7a')](_0x48dfb0['body'][_0x3e35('0x7b')])){throw new db[(_0x3e35('0x75'))][(_0x3e35('0x7c'))]('from\x20is\x20mandatory');}if(_[_0x3e35('0x7a')](_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x5e')])||_0x48dfb0['body'][_0x3e35('0x5e')]===''){throw new db[(_0x3e35('0x75'))][(_0x3e35('0x7c'))](_0x3e35('0x7d'));}if(_['isNil'](_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x7e')])){throw new db[(_0x3e35('0x75'))]['ValidationError'](_0x3e35('0x7f')+_0xbd04f3);}if(!_[_0x3e35('0x80')](_0xbd04f3,_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x7e')])){throw new db[(_0x3e35('0x75'))][(_0x3e35('0x7c'))](_0x3e35('0x81')+_0xbd04f3);}_0x5b4b72[_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x7e')]]=_0x48dfb0[_0x3e35('0x5e')]['from'];})[_0x3e35('0x38')](function(){return db[_0x3e35('0x41')][_0x3e35('0x64')]({'where':{'id':_0x48dfb0[_0x3e35('0x59')]['id']},'include':[{'model':db[_0x3e35('0x82')],'as':'List','include':[{'model':db[_0x3e35('0x74')],'as':_0x3e35('0x83'),'where':_0x5b4b72,'limit':0x1,'order':[['updatedAt',_0x3e35('0x84')]]}]},{'model':db[_0x3e35('0x85')],'as':_0x3e35('0x86')}]});})[_0x3e35('0x38')](handleEntityNotFound(_0x530c3a,null))[_0x3e35('0x38')](function(_0x395fda){if(_0x395fda&&_0x395fda[_0x3e35('0x87')]){_0x334d15[_0x3e35('0x88')]=_0x395fda;_0x334d15[_0x3e35('0x89')]=_0x395fda['Applications'];_0x334d15[_0x3e35('0x8a')]=_0x395fda['List'];_0x334d15['applications']=_[_0x3e35('0x8b')](_0x334d15[_0x3e35('0x89')],['priority'],['asc']);if(_0x334d15[_0x3e35('0x88')][_0x3e35('0x86')]){delete _0x334d15[_0x3e35('0x88')][_0x3e35('0x86')];}if(_0x334d15[_0x3e35('0x88')][_0x3e35('0x87')]&&_0x334d15[_0x3e35('0x88')][_0x3e35('0x87')]['Contacts']['length']){return _0x334d15[_0x3e35('0x88')][_0x3e35('0x87')][_0x3e35('0x83')][0x0];}var _0x1e2f2a=_[_0x3e35('0x1b')](_0x48dfb0[_0x3e35('0x5e')],{'firstName':_0x48dfb0['body'][_0x3e35('0x7b')],'ListId':_0x395fda[_0x3e35('0x79')]});_0x1e2f2a[_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x7e')]]=_0x48dfb0['body'][_0x3e35('0x7b')];return db[_0x3e35('0x74')]['create'](_0x1e2f2a,{'fields':_0x265ab9,'raw':!![]});}})[_0x3e35('0x38')](handleEntityNotFound(_0x530c3a,null))['then'](function(_0x14339a){_0x334d15['contact']=_0x14339a;if(_0x14339a){var _0x4894bc={'ContactId':_0x14339a['id'],'OpenchannelAccountId':_0x48dfb0['params']['id'],'from':(_0x14339a[_0x3e35('0x8c')]||'')+'\x20'+(_0x14339a[_0x3e35('0x8d')]||'')};var _0x387f12={'OpenchannelAccountId':_0x48dfb0['params']['id'],'closed':![]};if(_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x8e')]){_0x387f12[_0x3e35('0x8e')]=_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x8e')];return db[_0x3e35('0x8f')][_0x3e35('0x64')]({'where':_0x387f12})[_0x3e35('0x38')](function(_0x54e58a){if(_0x54e58a){return[_0x54e58a,![]];}_0x4894bc[_0x3e35('0x8e')]=_0x48dfb0[_0x3e35('0x5e')]['threadId'];_0x4894bc[_0x3e35('0x90')]=_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x90')];return db['OpenchannelInteraction'][_0x3e35('0x5d')](_0x4894bc)['then'](function(_0x51bf3f){return[_0x51bf3f,!![]];});});}else{_0x387f12[_0x3e35('0x8e')]=null;}_0x387f12[_0x3e35('0x91')]=_0x14339a['id'];return db[_0x3e35('0x8f')][_0x3e35('0x64')]({'where':_0x387f12})[_0x3e35('0x38')](function(_0x1972fa){if(_0x1972fa){return[_0x1972fa,![]];}return db[_0x3e35('0x8f')][_0x3e35('0x5d')](_0x4894bc)[_0x3e35('0x38')](function(_0x487ea3){return[_0x487ea3,!![]];});});}})['spread'](function(_0x39d16b,_0xc270de){if(_0x39d16b){_0x17670a=_0xc270de;if(!_0xc270de){var _0x2a98c4={'from':(_0x334d15[_0x3e35('0x92')][_0x3e35('0x8c')]||'')+'\x20'+(_0x334d15[_0x3e35('0x92')][_0x3e35('0x8d')]||'')};if(_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x8e')]&&_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x93')]&&_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x8e')]!=_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x93')]){_0x2a98c4[_0x3e35('0x8e')]=_0x48dfb0[_0x3e35('0x5e')][_0x3e35('0x93')];}return _0x39d16b[_0x3e35('0x37')](_0x2a98c4);}else{return _0x39d16b;}}})[_0x3e35('0x38')](function(_0x23718c){_0x334d15['interaction']=_0x23718c[_0x3e35('0x5f')]({'plain':!![]});_0x334d15[_0x3e35('0x94')]['created']=_0x17670a;if(_0x334d15['interaction'][_0x3e35('0x95')]){if(_0x334d15[_0x3e35('0x88')][_0x3e35('0x96')]){_0x334d15[_0x3e35('0x89')][_0x3e35('0x97')]({'id':0x0,'priority':_0x334d15[_0x3e35('0x89')][_0x3e35('0x4b')]+0x1,'app':_0x3e35('0x98'),'appdata':_0x3e35('0x99'),'interval':_0x3e35('0x9a')});}}return db['OpenchannelMessage']['create']({'body':_0x48dfb0[_0x3e35('0x5e')]['body'],'OpenchannelAccountId':_0x48dfb0[_0x3e35('0x59')]['id'],'OpenchannelInteractionId':_0x23718c['id'],'direction':'in','ContactId':_0x334d15[_0x3e35('0x92')]['id'],'AttachmentId':_0x48dfb0['body'][_0x3e35('0x9b')]});})[_0x3e35('0x38')](function(_0x58a1d8){_0x334d15[_0x3e35('0x2a')]=_0x58a1d8;if(!_0x334d15[_0x3e35('0x94')][_0x3e35('0x9c')])return;return db[_0x3e35('0x9d')][_0x3e35('0x64')]({'attributes':['id',_0x3e35('0x3d')],'where':{'id':_0x334d15[_0x3e35('0x94')]['UserId']}});})[_0x3e35('0x38')](function(_0x4c6147){if(_0x4c6147){_0x334d15[_0x3e35('0x89')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3e35('0x9e'),'appdata':_0x4c6147[_0x3e35('0x3d')]+','+(_0x334d15[_0x3e35('0x88')][_0x3e35('0x9f')]||0xa),'interval':_0x3e35('0x9a')});}if(!_0x334d15[_0x3e35('0x94')]['queueId'])return;return db[_0x3e35('0xa0')]['find']({'attributes':['id',_0x3e35('0x3d')],'where':{'id':_0x334d15[_0x3e35('0x94')][_0x3e35('0xa1')]}});})['then'](function(_0x240168){if(_0x240168){_0x334d15[_0x3e35('0x89')][_0x3e35('0xa2')]({'id':0x0,'priority':0x1,'app':_0x3e35('0xa3'),'appdata':_0x240168[_0x3e35('0x3d')]+','+(_0x334d15['account'][_0x3e35('0xa4')]||0x12c),'interval':_0x3e35('0x9a')});}return respondWithRpcPromise(_0x3e35('0xa5'),_0x3e35('0xa6'),_0x334d15);})[_0x3e35('0x38')](function(_0x3103f9){respondWithRpcPromise(_0x3e35('0xa7'),'EventManager',{'event':'notify','message':_0x3103f9},client9002);return _0x3103f9;})['then'](respondWithResult(_0x530c3a,null))[_0x3e35('0x2b')](handleError(_0x530c3a,null));};exports[_0x3e35('0xa8')]=function(_0x1b2ea6,_0x1bc3e0){var _0x1b5832=_0x1b2ea6[_0x3e35('0x59')]['id'];var _0x19dc3c=_0x1b2ea6[_0x3e35('0x5e')];var _0x5aff82=0xc8;var _0x33ec66=null;return db[_0x3e35('0xa9')]['transaction']({'isolationLevel':db[_0x3e35('0xa9')][_0x3e35('0xaa')][_0x3e35('0xab')][_0x3e35('0xac')]},function(_0x52e56d){return db[_0x3e35('0x41')]['findOne']({'where':{'id':_0x1b5832},'transaction':_0x52e56d})[_0x3e35('0x38')](function(_0x120b03){if(_0x120b03){return db['OpenchannelApplication'][_0x3e35('0x39')]({'where':{'OpenchannelAccountId':_0x1b5832},'transaction':_0x52e56d})[_0x3e35('0x38')](function(){var _0x3175e2=_['map'](_0x19dc3c,function(_0x2b88b6){_0x2b88b6[_0x3e35('0x67')]=_0x1b5832;return _0x2b88b6;});return db[_0x3e35('0x85')][_0x3e35('0xad')](_0x3175e2,{'transaction':_0x52e56d});});}else{_0x5aff82=0x194;_0x33ec66=[];}});})[_0x3e35('0x38')](function(){if(_0x5aff82!==0x194){return db[_0x3e35('0x85')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x1b5832},'order':_0x3e35('0xae')})[_0x3e35('0x38')](function(_0x4894ad){_0x33ec66=_0x4894ad;});}})[_0x3e35('0x2b')](function(_0x143225){_0x5aff82=0x1f4;logger[_0x3e35('0x28')](_0x143225['stack']);if(_0x143225[_0x3e35('0x3d')]){delete _0x143225[_0x3e35('0x3d')];}_0x33ec66=_0x143225;})[_0x3e35('0xaf')](function(){if(_0x33ec66===null){_0x1bc3e0[_0x3e35('0x2c')](_0x5aff82);}else{if(_0x5aff82===0x1f4){_0x1bc3e0[_0x3e35('0x2e')](_0x5aff82)[_0x3e35('0x3e')](_0x33ec66);}else{_0x1bc3e0[_0x3e35('0x2e')](_0x5aff82)[_0x3e35('0x33')](_0x33ec66);}}});};exports[_0x3e35('0xb0')]=function(_0xe3eb7e,_0x3f39ab,_0x2691a2){var _0x2f17c5={};var _0x361567={};var _0x13d775;var _0x23f3a5;return db[_0x3e35('0x41')][_0x3e35('0x6a')]({'where':{'id':_0xe3eb7e[_0x3e35('0x59')]['id']}})['then'](handleEntityNotFound(_0x3f39ab,null))[_0x3e35('0x38')](function(_0x3499eb){if(_0x3499eb){_0x13d775=_0x3499eb;_0x361567['model']=_[_0x3e35('0x5b')](db[_0x3e35('0x85')]['rawAttributes']);_0x361567[_0x3e35('0x45')]=_[_0x3e35('0x5b')](_0xe3eb7e[_0x3e35('0x45')]);_0x361567[_0x3e35('0x46')]=_['intersection'](_0x361567['model'],_0x361567['query']);_0x2f17c5[_0x3e35('0x48')]=_[_0x3e35('0x49')](_0x361567[_0x3e35('0x47')],qs['fields'](_0xe3eb7e['query'][_0x3e35('0x4a')]));_0x2f17c5[_0x3e35('0x48')]=_0x2f17c5[_0x3e35('0x48')][_0x3e35('0x4b')]?_0x2f17c5[_0x3e35('0x48')]:_0x361567[_0x3e35('0x47')];_0x2f17c5[_0x3e35('0x6b')]=qs[_0x3e35('0x4e')](_0xe3eb7e['query'][_0x3e35('0x4e')]);_0x2f17c5[_0x3e35('0x4f')]=qs[_0x3e35('0x46')](_['pick'](_0xe3eb7e['query'],_0x361567[_0x3e35('0x46')]));if(_0xe3eb7e[_0x3e35('0x45')][_0x3e35('0x50')]){_0x2f17c5[_0x3e35('0x4f')]=_[_0x3e35('0x53')](_0x2f17c5[_0x3e35('0x4f')],{'$or':_[_0x3e35('0x51')](_0x2f17c5[_0x3e35('0x48')],function(_0xb27d39){var _0x4c86b0={};_0x4c86b0[_0xb27d39]={'$like':'%'+_0xe3eb7e['query'][_0x3e35('0x50')]+'%'};return _0x4c86b0;})});}_0x2f17c5=_[_0x3e35('0x53')]({},_0x2f17c5,_0xe3eb7e[_0x3e35('0x54')]);return _0x13d775[_0x3e35('0xb0')](_0x2f17c5);}})[_0x3e35('0x38')](function(_0x127068){if(_0x127068){_0x23f3a5=_0x127068[_0x3e35('0x4b')];if(!_0xe3eb7e['query'][_0x3e35('0x4c')](_0x3e35('0x4d'))){_0x2f17c5[_0x3e35('0x31')]=qs['limit'](_0xe3eb7e['query'][_0x3e35('0x31')]);_0x2f17c5[_0x3e35('0x2f')]=qs['offset'](_0xe3eb7e['query']['offset']);}return _0x13d775[_0x3e35('0xb0')](_0x2f17c5);}})['then'](function(_0x1a6c19){if(_0x1a6c19){return _0x1a6c19?{'count':_0x23f3a5,'rows':_0x1a6c19}:null;}})[_0x3e35('0x38')](respondWithResult(_0x3f39ab,null))[_0x3e35('0x2b')](handleError(_0x3f39ab,null));};exports['getInteractions']=function(_0x17a3fb,_0xb538fb,_0x4d7754){var _0x545359={'raw':![],'where':{}};var _0x16d2cf={};var _0x309d03={'count':0x0,'rows':[]};return db[_0x3e35('0x41')][_0x3e35('0x6a')]({'where':{'id':_0x17a3fb[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0xb538fb,null))[_0x3e35('0x38')](function(_0x277f1b){if(_0x277f1b){_0x16d2cf[_0x3e35('0x47')]=_[_0x3e35('0x5b')](db[_0x3e35('0x8f')][_0x3e35('0x42')]);_0x16d2cf[_0x3e35('0x45')]=_[_0x3e35('0x5b')](_0x17a3fb['query']);_0x16d2cf[_0x3e35('0x46')]=_['intersection'](_0x16d2cf[_0x3e35('0x47')],_0x16d2cf[_0x3e35('0x45')]);_0x545359[_0x3e35('0x48')]=_[_0x3e35('0x49')](_0x16d2cf[_0x3e35('0x47')],qs[_0x3e35('0x4a')](_0x17a3fb[_0x3e35('0x45')]['fields']));_0x545359[_0x3e35('0x48')]=_0x545359['attributes'][_0x3e35('0x4b')]?_0x545359['attributes']:_0x16d2cf[_0x3e35('0x47')];if(!_0x17a3fb[_0x3e35('0x45')][_0x3e35('0x4c')]('nolimit')){_0x545359[_0x3e35('0x31')]=qs[_0x3e35('0x31')](_0x17a3fb[_0x3e35('0x45')][_0x3e35('0x31')]);_0x545359[_0x3e35('0x2f')]=qs[_0x3e35('0x2f')](_0x17a3fb[_0x3e35('0x45')][_0x3e35('0x2f')]);}_0x545359['order']=qs[_0x3e35('0x4e')](_0x17a3fb[_0x3e35('0x45')][_0x3e35('0x4e')]);_0x545359[_0x3e35('0x4f')]=qs[_0x3e35('0x46')](_[_0x3e35('0x6c')](_0x17a3fb['query'],_0x16d2cf[_0x3e35('0x46')]));_0x545359['where'][_0x3e35('0x67')]=_0x277f1b['id'];if(_0x17a3fb['query'][_0x3e35('0x50')]){_0x545359[_0x3e35('0x4f')]=_['merge'](_0x545359[_0x3e35('0x4f')],{'$or':_[_0x3e35('0x51')](_0x545359[_0x3e35('0x48')],function(_0x40c81a){var _0x24d758={};_0x24d758[_0x40c81a]={'$like':'%'+_0x17a3fb[_0x3e35('0x45')][_0x3e35('0x50')]+'%'};return _0x24d758;})});}_0x545359=_[_0x3e35('0x53')]({},_0x545359,_0x17a3fb[_0x3e35('0x54')]);return db['OpenchannelInteraction'][_0x3e35('0x32')]({'where':_0x545359[_0x3e35('0x4f')]})[_0x3e35('0x38')](function(_0x52746d){_0x309d03[_0x3e35('0x32')]=_0x52746d;if(_0x17a3fb[_0x3e35('0x45')][_0x3e35('0x5c')]){_0x545359[_0x3e35('0x55')]=[{'model':db[_0x3e35('0x74')],'as':_0x3e35('0xb1'),'required':![]},{'model':db['User'],'as':_0x3e35('0xb2'),'attributes':[_0x3e35('0x3d'),_0x3e35('0xb3'),_0x3e35('0xb4')],'required':![]},{'model':db[_0x3e35('0xb5')],'as':_0x3e35('0xb6'),'attributes':['id','name',_0x3e35('0xb7')],'where':_0x17a3fb[_0x3e35('0x45')][_0x3e35('0xb8')]?{'id':_0x17a3fb[_0x3e35('0x45')][_0x3e35('0xb8')]}:undefined,'required':_0x17a3fb[_0x3e35('0x45')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x3e35('0x56')](_0x545359);})[_0x3e35('0x38')](function(_0x2a675c){_0x309d03[_0x3e35('0x57')]=_0x2a675c;return _0x309d03;});}})[_0x3e35('0x38')](respondWithFilteredResult(_0xb538fb,_0x545359))[_0x3e35('0x2b')](handleError(_0xb538fb,null));};exports[_0x3e35('0xb9')]=function(_0x6cf676,_0x599fd2,_0xb2c8e6){return db['OpenchannelAccount'][_0x3e35('0x64')]({'where':{'id':_0x6cf676[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0x599fd2,null))[_0x3e35('0x38')](function(_0x289994){if(_0x289994){return _0x289994[_0x3e35('0xb9')](_0x6cf676[_0x3e35('0x5e')][_0x3e35('0x6e')],_[_0x3e35('0xba')](_0x6cf676[_0x3e35('0x5e')],[_0x3e35('0x6e'),'id'])||{})[_0x3e35('0xbb')](function(_0x3320fe){for(var _0x5a89f6=0x0;_0x5a89f6<_0x6cf676[_0x3e35('0x5e')][_0x3e35('0x6e')][_0x3e35('0x4b')];_0x5a89f6+=0x1){socket[_0x3e35('0xbc')](_0x3e35('0xbd'),{'UserId':Number(_0x6cf676[_0x3e35('0x5e')][_0x3e35('0x6e')][_0x5a89f6]),'OpenchannelAccountId':Number(_0x6cf676[_0x3e35('0x59')]['id'])});}return _0x3320fe;});}})['then'](respondWithResult(_0x599fd2,null))[_0x3e35('0x2b')](handleError(_0x599fd2,null));};exports[_0x3e35('0xbe')]=function(_0x647512,_0x7d586a,_0x354be8){return db[_0x3e35('0x41')][_0x3e35('0x64')]({'where':{'id':_0x647512[_0x3e35('0x59')]['id']}})[_0x3e35('0x38')](handleEntityNotFound(_0x7d586a,null))[_0x3e35('0x38')](function(_0x5eab0a){if(_0x5eab0a){return _0x5eab0a['removeAgents'](_0x647512[_0x3e35('0x45')][_0x3e35('0x6e')])[_0x3e35('0x38')](function(){if(_['isArray'](_0x647512['query'][_0x3e35('0x6e')])){for(var _0x16de86=0x0;_0x16de86<_0x647512[_0x3e35('0x45')][_0x3e35('0x6e')][_0x3e35('0x4b')];_0x16de86+=0x1){socket[_0x3e35('0xbc')](_0x3e35('0xbf'),{'UserId':Number(_0x647512[_0x3e35('0x45')]['ids'][_0x16de86]),'OpenchannelAccountId':Number(_0x647512[_0x3e35('0x59')]['id'])});}}else{socket[_0x3e35('0xbc')](_0x3e35('0xbf'),{'UserId':Number(_0x647512[_0x3e35('0x45')]['ids']),'OpenchannelAccountId':Number(_0x647512[_0x3e35('0x59')]['id'])});}});}})[_0x3e35('0x38')](respondWithStatusCode(_0x7d586a,null))['catch'](handleError(_0x7d586a,null));};exports[_0x3e35('0xc0')]=function(_0x54497f,_0x36c77d,_0x485058){var _0x33639a={};var _0x5e07d2={};var _0x4c8df5;var _0x567a79;return db[_0x3e35('0x41')][_0x3e35('0x6a')]({'where':{'id':_0x54497f['params']['id']}})['then'](handleEntityNotFound(_0x36c77d,null))[_0x3e35('0x38')](function(_0x2d4ba0){if(_0x2d4ba0){_0x4c8df5=_0x2d4ba0;_0x5e07d2[_0x3e35('0x47')]=_['keys'](db['User'][_0x3e35('0x42')]);_0x5e07d2[_0x3e35('0x45')]=_[_0x3e35('0x5b')](_0x54497f[_0x3e35('0x45')]);_0x5e07d2[_0x3e35('0x46')]=_['intersection'](_0x5e07d2[_0x3e35('0x47')],_0x5e07d2['query']);_0x33639a[_0x3e35('0x48')]=_[_0x3e35('0x49')](_0x5e07d2[_0x3e35('0x47')],qs['fields'](_0x54497f['query']['fields']));_0x33639a[_0x3e35('0x48')]=_0x33639a[_0x3e35('0x48')][_0x3e35('0x4b')]?_0x33639a[_0x3e35('0x48')]:_0x5e07d2[_0x3e35('0x47')];_0x33639a[_0x3e35('0x6b')]=qs[_0x3e35('0x4e')](_0x54497f[_0x3e35('0x45')][_0x3e35('0x4e')]);_0x33639a[_0x3e35('0x4f')]=qs['filters'](_[_0x3e35('0x6c')](_0x54497f[_0x3e35('0x45')],_0x5e07d2[_0x3e35('0x46')]));if(_0x54497f[_0x3e35('0x45')][_0x3e35('0x50')]){_0x33639a['where']=_[_0x3e35('0x53')](_0x33639a['where'],{'$or':_['map'](_0x33639a[_0x3e35('0x48')],function(_0x4ad611){var _0x32d7f7={};_0x32d7f7[_0x4ad611]={'$like':'%'+_0x54497f[_0x3e35('0x45')][_0x3e35('0x50')]+'%'};return _0x32d7f7;})});}_0x33639a=_[_0x3e35('0x53')]({},_0x33639a,_0x54497f[_0x3e35('0x54')]);return _0x4c8df5[_0x3e35('0xc0')](_0x33639a);}})['then'](function(_0x56a296){if(_0x56a296){_0x567a79=_0x56a296['length'];if(!_0x54497f['query']['hasOwnProperty']('nolimit')){_0x33639a[_0x3e35('0x31')]=qs[_0x3e35('0x31')](_0x54497f[_0x3e35('0x45')][_0x3e35('0x31')]);_0x33639a[_0x3e35('0x2f')]=qs['offset'](_0x54497f['query'][_0x3e35('0x2f')]);}return _0x4c8df5[_0x3e35('0xc0')](_0x33639a);}})['then'](function(_0x26bd34){if(_0x26bd34){return _0x26bd34?{'count':_0x567a79,'rows':_0x26bd34}:null;}})[_0x3e35('0x38')](respondWithResult(_0x36c77d,null))['catch'](handleError(_0x36c77d,null));};exports['send']=function(_0x41a3dd,_0x16bd9e,_0x598a9e){var _0x4c72ef,_0x5f0ff9,_0x4a920a;if(_[_0x3e35('0x7a')](_0x41a3dd['body'][_0x3e35('0x5e')])||_0x41a3dd[_0x3e35('0x5e')][_0x3e35('0x5e')]===''){throw new db[(_0x3e35('0x75'))][(_0x3e35('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3e35('0x7a')](_0x41a3dd[_0x3e35('0x5e')]['to'])){}_0x4c72ef=_0x41a3dd['body']['to'];return db[_0x3e35('0x41')]['findOne']({'where':{'id':_0x41a3dd[_0x3e35('0x59')]['id']}})['then'](handleEntityNotFound(_0x16bd9e,null))[_0x3e35('0x38')](function(_0x902e7a){if(_0x902e7a){return db[_0x3e35('0x41')]['find']({'where':{'id':_0x902e7a['id']},'include':[{'model':db[_0x3e35('0x82')],'as':_0x3e35('0x87'),'include':[{'model':db['CmContact'],'as':_0x3e35('0x83'),'where':{[_0x902e7a[_0x3e35('0x7e')]]:_0x4c72ef},'limit':0x1,'order':[[_0x3e35('0x78'),_0x3e35('0x84')]]}]}]})[_0x3e35('0x38')](handleEntityNotFound(_0x16bd9e,null))[_0x3e35('0x38')](function(_0x37bff5){if(_0x37bff5&&_0x37bff5[_0x3e35('0x87')]){_0x5f0ff9=_0x37bff5[_0x3e35('0x5f')]({'plain':!![]});if(_0x5f0ff9['List']&&_0x5f0ff9[_0x3e35('0x87')][_0x3e35('0x83')][_0x3e35('0x4b')]){return _0x5f0ff9[_0x3e35('0x87')][_0x3e35('0x83')][0x0];}return db['CmContact'][_0x3e35('0x5d')](_[_0x3e35('0x1b')](_0x41a3dd['body'],{'firstName':_0x4c72ef,[_0x37bff5[_0x3e35('0x7e')]]:_0x4c72ef,'phone':_0x4c72ef,'ListId':_0x5f0ff9['ListId']}));}})[_0x3e35('0x38')](handleEntityNotFound(_0x16bd9e,null))[_0x3e35('0x38')](function(_0x3746b9){if(_0x3746b9){_0x4a920a=_0x3746b9;return db[_0x3e35('0x8f')][_0x3e35('0x64')]({'where':{'ContactId':_0x4a920a['id'],'closed':![],'OpenchannelAccountId':_0x5f0ff9['id']}})[_0x3e35('0x38')](function(_0x2d2e13){if(_0x2d2e13){return[_0x2d2e13,![]];}return db[_0x3e35('0x8f')][_0x3e35('0x5d')]({'UserId':_0x41a3dd[_0x3e35('0x62')]['id'],'ContactId':_0x4a920a['id'],'OpenchannelAccountId':_0x5f0ff9['id'],'lastMsgDirection':_0x3e35('0xc1'),'firstMsgDirection':_0x3e35('0xc1'),'Messages':[_[_0x3e35('0x53')](_0x41a3dd[_0x3e35('0x5e')],{'read':![],'body':_0x41a3dd[_0x3e35('0x5e')][_0x3e35('0x5e')],'OpenchannelAccountId':_0x5f0ff9['id'],'UserId':_0x41a3dd['user']['id'],'ContactId':_0x4a920a['id']})]},{'include':[{'model':db[_0x3e35('0xc2')],'as':_0x3e35('0xc3')}]})[_0x3e35('0x38')](function(_0x42e918){return[_0x42e918,!![]];});});}})['spread'](function(_0x550788,_0x47817c){if(_0x47817c){return _0x550788;}return db[_0x3e35('0xc2')][_0x3e35('0x5d')](_['merge'](_0x41a3dd[_0x3e35('0x5e')],{'read':![],'body':_0x41a3dd['body'][_0x3e35('0x5e')],'OpenchannelAccountId':_0x5f0ff9['id'],'OpenchannelInteractionId':_0x550788['id'],'UserId':_0x41a3dd[_0x3e35('0x62')]['id'],'ContactId':_0x4a920a['id']}))[_0x3e35('0x38')](function(_0x140468){_0x550788[_0x3e35('0xc4')][_0x3e35('0xc3')]=[];_0x550788[_0x3e35('0xc4')][_0x3e35('0xc3')]['push'](_0x140468[_0x3e35('0xc4')]);return _0x550788;});});}})[_0x3e35('0x38')](respondWithResult(_0x16bd9e,null))['catch'](handleError(_0x16bd9e,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 1be7b98..f972013 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 _0xd8b0=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x503775,_0x984a68){var _0x3a3fd1=function(_0x4d9160){while(--_0x4d9160){_0x503775['push'](_0x503775['shift']());}};_0x3a3fd1(++_0x984a68);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x0d8b('0x0'));var OpenchannelAccount=require(_0x0d8b('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d8b('0x2'),'afterDestroy':_0x0d8b('0x3')};function emitEvent(_0x43bca1){return function(_0x364286,_0x8196ed,_0x577834){OpenchannelAccountEvents['emit'](_0x43bca1+':'+_0x364286['id'],_0x364286);OpenchannelAccountEvents[_0x0d8b('0x4')](_0x43bca1,_0x364286);_0x577834(null);};}for(var e in events){if(events[_0x0d8b('0x5')](e)){var event=events[e];OpenchannelAccount[_0x0d8b('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','OpenchannelAccount','setMaxListeners'];(function(_0xed13f6,_0x536086){var _0x44ad3c=function(_0x52f20d){while(--_0x52f20d){_0xed13f6['push'](_0xed13f6['shift']());}};_0x44ad3c(++_0x536086);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x49c4('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){OpenchannelAccountEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);OpenchannelAccountEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];OpenchannelAccount[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 8d39352..664a933 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(_0x4d0276,_0x5ca56e){var _0x2d7847=function(_0x24ba38){while(--_0x24ba38){_0x4d0276['push'](_0x4d0276['shift']());}};_0x2d7847(++_0x5ca56e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x3a9f59,_0x133571){var _0x182887=function(_0x5b3fa7){while(--_0x5b3fa7){_0x3a9f59['push'](_0x3a9f59['shift']());}};_0x182887(++_0x133571);}(_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 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 2be5124..98ed3ce 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 _0x153f=['localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x1312fc,_0x184d90){var _0xa358d5=function(_0x5b029b){while(--_0x5b029b){_0x1312fc['push'](_0x1312fc['shift']());}};_0xa358d5(++_0x184d90);}(_0x153f,0x15b));var _0xf153=function(_0x3bc2b5,_0x3606f6){_0x3bc2b5=_0x3bc2b5-0x0;var _0x67fecd=_0x153f[_0x3bc2b5];return _0x67fecd;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});config[_0xf153('0xc')]=_['defaults'](config[_0xf153('0xc')],{'host':_0xf153('0xd'),'port':0x18eb});var socket=require(_0xf153('0xe'))(new Redis(config[_0xf153('0xc')]));require(_0xf153('0xf'))[_0xf153('0x10')](socket);function respondWithRpcPromise(_0x44845c,_0x15a18b,_0x4f84b){return new BPromise(function(_0xeaccb0,_0x5c8ae9){return client[_0xf153('0x11')](_0x44845c,_0x4f84b)[_0xf153('0x12')](function(_0x2bea70){logger['info'](_0xf153('0x13'),_0x15a18b,_0xf153('0x14'));logger[_0xf153('0x15')](_0xf153('0x16'),_0x15a18b,_0xf153('0x14'),JSON[_0xf153('0x17')](_0x2bea70));if(_0x2bea70[_0xf153('0x18')]){if(_0x2bea70[_0xf153('0x18')][_0xf153('0x19')]===0x1f4){logger['error'](_0xf153('0x13'),_0x15a18b,_0x2bea70[_0xf153('0x18')][_0xf153('0x1a')]);return _0x5c8ae9(_0x2bea70[_0xf153('0x18')][_0xf153('0x1a')]);}logger[_0xf153('0x18')](_0xf153('0x13'),_0x15a18b,_0x2bea70[_0xf153('0x18')]['message']);return _0xeaccb0(_0x2bea70[_0xf153('0x18')]['message']);}else{logger[_0xf153('0x1b')](_0xf153('0x13'),_0x15a18b,_0xf153('0x14'));_0xeaccb0(_0x2bea70[_0xf153('0x1c')]['message']);}})[_0xf153('0x1d')](function(_0x19122e){logger[_0xf153('0x18')](_0xf153('0x13'),_0x15a18b,_0x19122e);_0x5c8ae9(_0x19122e);});});} \ No newline at end of file +var _0x7be1=['../../config/logger','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2ef8f1,_0x1280a3){var _0x17498d=function(_0xd20876){while(--_0xd20876){_0x2ef8f1['push'](_0x2ef8f1['shift']());}};_0x17498d(++_0x1280a3);}(_0x7be1,0x165));var _0x17be=function(_0x12f59c,_0x13d956){_0x12f59c=_0x12f59c-0x0;var _0x2db43e=_0x7be1[_0x12f59c];return _0x2db43e;};'use strict';var _=require(_0x17be('0x0'));var util=require(_0x17be('0x1'));var moment=require(_0x17be('0x2'));var BPromise=require('bluebird');var rs=require(_0x17be('0x3'));var fs=require('fs');var Redis=require(_0x17be('0x4'));var db=require(_0x17be('0x5'))['db'];var utils=require(_0x17be('0x6'));var logger=require(_0x17be('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x17be('0x8')][_0x17be('0x9')]({'port':0x232a});config['redis']=_[_0x17be('0xa')](config[_0x17be('0xb')],{'host':_0x17be('0xc'),'port':0x18eb});var socket=require(_0x17be('0xd'))(new Redis(config[_0x17be('0xb')]));require(_0x17be('0xe'))['register'](socket);function respondWithRpcPromise(_0x41e383,_0x589cdb,_0x3d23c3){return new BPromise(function(_0x2c276e,_0x520a49){return client[_0x17be('0xf')](_0x41e383,_0x3d23c3)[_0x17be('0x10')](function(_0x1ee322){logger[_0x17be('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x589cdb,_0x17be('0x12'));logger['debug'](_0x17be('0x13'),_0x589cdb,'request\x20sent',JSON[_0x17be('0x14')](_0x1ee322));if(_0x1ee322[_0x17be('0x15')]){if(_0x1ee322[_0x17be('0x15')][_0x17be('0x16')]===0x1f4){logger[_0x17be('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x589cdb,_0x1ee322[_0x17be('0x15')]['message']);return _0x520a49(_0x1ee322['error'][_0x17be('0x17')]);}logger['error'](_0x17be('0x18'),_0x589cdb,_0x1ee322['error'][_0x17be('0x17')]);return _0x2c276e(_0x1ee322[_0x17be('0x15')]['message']);}else{logger[_0x17be('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x589cdb,_0x17be('0x12'));_0x2c276e(_0x1ee322['result'][_0x17be('0x17')]);}})[_0x17be('0x19')](function(_0x416f81){logger[_0x17be('0x15')](_0x17be('0x18'),_0x589cdb,_0x416f81);_0x520a49(_0x416f81);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 27686d3..61c3984 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 _0xa8a8=['length','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x2c1cc1,_0x589809){var _0x2257ca=function(_0x4f07c4){while(--_0x4f07c4){_0x2c1cc1['push'](_0x2c1cc1['shift']());}};_0x2257ca(++_0x589809);}(_0xa8a8,0xec));var _0x8a8a=function(_0x58d52d,_0x5c7e13){_0x58d52d=_0x58d52d-0x0;var _0x489073=_0xa8a8[_0x58d52d];return _0x489073;};'use strict';var OpenchannelAccountEvents=require(_0x8a8a('0x0'));var events=[_0x8a8a('0x1'),_0x8a8a('0x2'),_0x8a8a('0x3')];function createListener(_0x5221bc,_0x2a2676){return function(_0x3296a6){_0x2a2676[_0x8a8a('0x4')](_0x5221bc,_0x3296a6);};}function removeListener(_0x3ed1de,_0x45515d){return function(){OpenchannelAccountEvents[_0x8a8a('0x5')](_0x3ed1de,_0x45515d);};}exports[_0x8a8a('0x6')]=function(_0x12db82){for(var _0x2e8193=0x0,_0x315fe9=events[_0x8a8a('0x7')];_0x2e8193<_0x315fe9;_0x2e8193++){var _0x8e7aa0=events[_0x2e8193];var _0x4225b9=createListener(_0x8a8a('0x8')+_0x8e7aa0,_0x12db82);OpenchannelAccountEvents['on'](_0x8e7aa0,_0x4225b9);}}; \ No newline at end of file +var _0xadec=['./openchannelAccount.events','save','remove','update','removeListener','length'];(function(_0x48ef95,_0x341a8a){var _0x40a225=function(_0x2aecb5){while(--_0x2aecb5){_0x48ef95['push'](_0x48ef95['shift']());}};_0x40a225(++_0x341a8a);}(_0xadec,0x156));var _0xcade=function(_0x22799d,_0x46b4bf){_0x22799d=_0x22799d-0x0;var _0x152e2c=_0xadec[_0x22799d];return _0x152e2c;};'use strict';var OpenchannelAccountEvents=require(_0xcade('0x0'));var events=[_0xcade('0x1'),_0xcade('0x2'),_0xcade('0x3')];function createListener(_0x35756e,_0x5b1f75){return function(_0x55ad3c){_0x5b1f75['emit'](_0x35756e,_0x55ad3c);};}function removeListener(_0x475533,_0x875b81){return function(){OpenchannelAccountEvents[_0xcade('0x4')](_0x475533,_0x875b81);};}exports['register']=function(_0x4da887){for(var _0x5c8b77=0x0,_0x51d665=events[_0xcade('0x5')];_0x5c8b77<_0x51d665;_0x5c8b77++){var _0x4c36e8=events[_0x5c8b77];var _0x625da7=createListener('openchannelAccount:'+_0x4c36e8,_0x4da887);OpenchannelAccountEvents['on'](_0x4c36e8,_0x625da7);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 6aea95e..092ff4a 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 _0x9a22=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','util'];(function(_0x152e7b,_0x3a8525){var _0x3ed968=function(_0x56ccee){while(--_0x56ccee){_0x152e7b['push'](_0x152e7b['shift']());}};_0x3ed968(++_0x3a8525);}(_0x9a22,0x1cd));var _0x29a2=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x9a22[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require('multer');var util=require(_0x29a2('0x0'));var path=require(_0x29a2('0x1'));var timeout=require(_0x29a2('0x2'));var express=require(_0x29a2('0x3'));var router=express[_0x29a2('0x4')]();var fs_extra=require(_0x29a2('0x5'));var auth=require(_0x29a2('0x6'));var interaction=require(_0x29a2('0x7'));var config=require(_0x29a2('0x8'));var controller=require(_0x29a2('0x9'));router[_0x29a2('0xa')]('/',auth[_0x29a2('0xb')](),controller[_0x29a2('0xc')]);router[_0x29a2('0xa')](_0x29a2('0xd'),auth[_0x29a2('0xb')](),controller[_0x29a2('0xe')]);router[_0x29a2('0xf')]('/',auth[_0x29a2('0xb')](),controller[_0x29a2('0x10')]);router['put'](_0x29a2('0xd'),auth[_0x29a2('0xb')](),controller[_0x29a2('0x11')]);router[_0x29a2('0x12')]('/:id',auth[_0x29a2('0xb')](),controller[_0x29a2('0x13')]);module[_0x29a2('0x14')]=router; \ No newline at end of file +var _0x836f=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','path'];(function(_0x4e0f5e,_0x3a8646){var _0x12c18b=function(_0xfc782e){while(--_0xfc782e){_0x4e0f5e['push'](_0x4e0f5e['shift']());}};_0x12c18b(++_0x3a8646);}(_0x836f,0x141));var _0xf836=function(_0x5cd73c,_0x5ec62c){_0x5cd73c=_0x5cd73c-0x0;var _0x696a36=_0x836f[_0x5cd73c];return _0x696a36;};'use strict';var multer=require(_0xf836('0x0'));var util=require('util');var path=require(_0xf836('0x1'));var timeout=require(_0xf836('0x2'));var express=require('express');var router=express[_0xf836('0x3')]();var fs_extra=require(_0xf836('0x4'));var auth=require(_0xf836('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf836('0x6'));var controller=require(_0xf836('0x7'));router[_0xf836('0x8')]('/',auth[_0xf836('0x9')](),controller[_0xf836('0xa')]);router[_0xf836('0x8')](_0xf836('0xb'),auth[_0xf836('0x9')](),controller[_0xf836('0xc')]);router[_0xf836('0xd')]('/',auth['isAuthenticated'](),controller[_0xf836('0xe')]);router[_0xf836('0xf')](_0xf836('0xb'),auth[_0xf836('0x9')](),controller[_0xf836('0x10')]);router['delete'](_0xf836('0xb'),auth['isAuthenticated'](),controller[_0xf836('0x11')]);module[_0xf836('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 2f16023..12cad7e 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 _0x0d9c=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x4d3187,_0x267c51){var _0x107906=function(_0x5d759d){while(--_0x5d759d){_0x4d3187['push'](_0x4d3187['shift']());}};_0x107906(++_0x267c51);}(_0x0d9c,0xa3));var _0xc0d9=function(_0x3cd451,_0x26e81a){_0x3cd451=_0x3cd451-0x0;var _0x571ce6=_0x0d9c[_0x3cd451];return _0x571ce6;};'use strict';var Sequelize=require(_0xc0d9('0x0'));module[_0xc0d9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc0d9('0x2')],'allowNull':![],'defaultValue':_0xc0d9('0x3')},'appdata':{'type':Sequelize[_0xc0d9('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc0d9('0x2')],'defaultValue':_0xc0d9('0x5')}}; \ No newline at end of file +var _0xe3b4=['TEXT','*,*,*,*','sequelize','STRING','noop'];(function(_0x11b55e,_0x47f1ff){var _0x268a13=function(_0x3dc694){while(--_0x3dc694){_0x11b55e['push'](_0x11b55e['shift']());}};_0x268a13(++_0x47f1ff);}(_0xe3b4,0x142));var _0x4e3b=function(_0x2c6429,_0x522155){_0x2c6429=_0x2c6429-0x0;var _0x526165=_0xe3b4[_0x2c6429];return _0x526165;};'use strict';var Sequelize=require(_0x4e3b('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x4e3b('0x1')],'allowNull':![],'defaultValue':_0x4e3b('0x2')},'appdata':{'type':Sequelize[_0x4e3b('0x3')]()},'description':{'type':Sequelize[_0x4e3b('0x1')]},'interval':{'type':Sequelize[_0x4e3b('0x1')],'defaultValue':_0x4e3b('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 7b95004..d8d62ba 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 _0xdd82=['util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','includeAll','findAll','rows','show','include','create','body','params','catch','find','eml-format','rimraf','fast-json-patch','moment','mustache'];(function(_0x4c5153,_0x1a5b63){var _0x5aab04=function(_0x82964f){while(--_0x82964f){_0x4c5153['push'](_0x4c5153['shift']());}};_0x5aab04(++_0x1a5b63);}(_0xdd82,0xca));var _0x2dd8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdd82[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x2dd8('0x0'));var rimraf=require(_0x2dd8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2dd8('0x2'));var rp=require('request-promise');var moment=require(_0x2dd8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2dd8('0x4'));var util=require(_0x2dd8('0x5'));var path=require(_0x2dd8('0x6'));var sox=require(_0x2dd8('0x7'));var csv=require(_0x2dd8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dd8('0x9'));var squel=require('squel');var crypto=require(_0x2dd8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2dd8('0xb'));var toCsv=require(_0x2dd8('0x8'));var querystring=require('querystring');var Papa=require(_0x2dd8('0xc'));var Redis=require(_0x2dd8('0xd'));var authService=require(_0x2dd8('0xe'));var qs=require(_0x2dd8('0xf'));var as=require(_0x2dd8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2dd8('0x11'));var config=require(_0x2dd8('0x12'));var licenseUtil=require(_0x2dd8('0x13'));var db=require(_0x2dd8('0x14'))['db'];function respondWithStatusCode(_0x5a6b26,_0x2f33a9){_0x2f33a9=_0x2f33a9||0xcc;return function(_0x56ef9f){if(_0x56ef9f){return _0x5a6b26[_0x2dd8('0x15')](_0x2f33a9);}return _0x5a6b26[_0x2dd8('0x16')](_0x2f33a9)[_0x2dd8('0x17')]();};}function respondWithResult(_0x25786c,_0x451ba9){_0x451ba9=_0x451ba9||0xc8;return function(_0x23e473){if(_0x23e473){return _0x25786c[_0x2dd8('0x16')](_0x451ba9)[_0x2dd8('0x18')](_0x23e473);}};}function respondWithFilteredResult(_0x4d5941,_0x279a18){return function(_0x571bbd){if(_0x571bbd){var _0x169881=typeof _0x279a18[_0x2dd8('0x19')]===_0x2dd8('0x1a')&&typeof _0x279a18['limit']===_0x2dd8('0x1a');var _0x22417c=_0x571bbd[_0x2dd8('0x1b')];var _0x574ef5=_0x169881?0x0:_0x279a18[_0x2dd8('0x19')];var _0x13eb54=_0x169881?_0x571bbd[_0x2dd8('0x1b')]:_0x279a18['offset']+_0x279a18[_0x2dd8('0x1c')];var _0x444722;if(_0x13eb54>=_0x22417c){_0x13eb54=_0x22417c;_0x444722=0xc8;}else{_0x444722=0xce;}_0x4d5941['status'](_0x444722);return _0x4d5941['set'](_0x2dd8('0x1d'),_0x574ef5+'-'+_0x13eb54+'/'+_0x22417c)[_0x2dd8('0x18')](_0x571bbd);}return null;};}function patchUpdates(_0x267354){return function(_0x2ad5e7){try{jsonpatch['apply'](_0x2ad5e7,_0x267354,!![]);}catch(_0x4e3ddd){return BPromise[_0x2dd8('0x1e')](_0x4e3ddd);}return _0x2ad5e7['save']();};}function saveUpdates(_0x1a71bf,_0x2904c5){return function(_0x259b0a){if(_0x259b0a){return _0x259b0a[_0x2dd8('0x1f')](_0x1a71bf)[_0x2dd8('0x20')](function(_0x4eee2a){return _0x4eee2a;});}return null;};}function removeEntity(_0x2d0c32,_0xcf0321){return function(_0x5b9de0){if(_0x5b9de0){return _0x5b9de0[_0x2dd8('0x21')]()[_0x2dd8('0x20')](function(){_0x2d0c32[_0x2dd8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e5ccb,_0x4987ed){return function(_0x34daec){if(!_0x34daec){_0x5e5ccb['sendStatus'](0x194);}return _0x34daec;};}function handleError(_0x1b5d68,_0x386f2e){_0x386f2e=_0x386f2e||0x1f4;return function(_0x3becdc){logger[_0x2dd8('0x22')](_0x3becdc[_0x2dd8('0x23')]);if(_0x3becdc[_0x2dd8('0x24')]){delete _0x3becdc['name'];}_0x1b5d68[_0x2dd8('0x16')](_0x386f2e)[_0x2dd8('0x25')](_0x3becdc);};}exports[_0x2dd8('0x26')]=function(_0x7ad216,_0x5968a3){var _0x2a623a={},_0x31c008={},_0x5b2954={'count':0x0,'rows':[]};var _0x139569=_[_0x2dd8('0x27')](db[_0x2dd8('0x28')][_0x2dd8('0x29')],function(_0x1f61c1){return{'name':_0x1f61c1['fieldName'],'type':_0x1f61c1[_0x2dd8('0x2a')]['key']};});_0x31c008['model']=_[_0x2dd8('0x27')](_0x139569,_0x2dd8('0x24'));_0x31c008[_0x2dd8('0x2b')]=_[_0x2dd8('0x2c')](_0x7ad216[_0x2dd8('0x2b')]);_0x31c008['filters']=_[_0x2dd8('0x2d')](_0x31c008[_0x2dd8('0x2e')],_0x31c008[_0x2dd8('0x2b')]);_0x2a623a[_0x2dd8('0x2f')]=_['intersection'](_0x31c008[_0x2dd8('0x2e')],qs[_0x2dd8('0x30')](_0x7ad216[_0x2dd8('0x2b')][_0x2dd8('0x30')]));_0x2a623a[_0x2dd8('0x2f')]=_0x2a623a[_0x2dd8('0x2f')][_0x2dd8('0x31')]?_0x2a623a['attributes']:_0x31c008[_0x2dd8('0x2e')];if(!_0x7ad216[_0x2dd8('0x2b')][_0x2dd8('0x32')](_0x2dd8('0x33'))){_0x2a623a[_0x2dd8('0x1c')]=qs[_0x2dd8('0x1c')](_0x7ad216[_0x2dd8('0x2b')]['limit']);_0x2a623a[_0x2dd8('0x19')]=qs[_0x2dd8('0x19')](_0x7ad216[_0x2dd8('0x2b')][_0x2dd8('0x19')]);}_0x2a623a['order']=qs[_0x2dd8('0x34')](_0x7ad216[_0x2dd8('0x2b')][_0x2dd8('0x34')]);_0x2a623a['where']=qs[_0x2dd8('0x35')](_[_0x2dd8('0x36')](_0x7ad216[_0x2dd8('0x2b')],_0x31c008[_0x2dd8('0x35')]),_0x139569);if(_0x7ad216[_0x2dd8('0x2b')][_0x2dd8('0x37')]){_0x2a623a[_0x2dd8('0x38')]=_[_0x2dd8('0x39')](_0x2a623a[_0x2dd8('0x38')],{'$or':_[_0x2dd8('0x27')](_0x139569,function(_0x30ccd6){if(_0x30ccd6['type']!=='VIRTUAL'){var _0x4923f1={};_0x4923f1[_0x30ccd6[_0x2dd8('0x24')]]={'$like':'%'+_0x7ad216[_0x2dd8('0x2b')][_0x2dd8('0x37')]+'%'};return _0x4923f1;}})});}_0x2a623a=_[_0x2dd8('0x39')]({},_0x2a623a,_0x7ad216[_0x2dd8('0x3a')]);var _0x2025e4={'where':_0x2a623a['where']};return db[_0x2dd8('0x28')]['count'](_0x2025e4)[_0x2dd8('0x20')](function(_0x3c42c3){_0x5b2954[_0x2dd8('0x1b')]=_0x3c42c3;if(_0x7ad216['query'][_0x2dd8('0x3b')]){_0x2a623a['include']=[{'all':!![]}];}return db[_0x2dd8('0x28')][_0x2dd8('0x3c')](_0x2a623a);})[_0x2dd8('0x20')](function(_0x3cf857){_0x5b2954[_0x2dd8('0x3d')]=_0x3cf857;return _0x5b2954;})[_0x2dd8('0x20')](respondWithFilteredResult(_0x5968a3,_0x2a623a))['catch'](handleError(_0x5968a3,null));};exports[_0x2dd8('0x3e')]=function(_0x487c00,_0x1aa661){var _0x54b1c1={'raw':!![],'where':{'id':_0x487c00['params']['id']}},_0x127742={};_0x127742[_0x2dd8('0x2e')]=_['keys'](db[_0x2dd8('0x28')][_0x2dd8('0x29')]);_0x127742[_0x2dd8('0x2b')]=_[_0x2dd8('0x2c')](_0x487c00[_0x2dd8('0x2b')]);_0x127742[_0x2dd8('0x35')]=_[_0x2dd8('0x2d')](_0x127742[_0x2dd8('0x2e')],_0x127742[_0x2dd8('0x2b')]);_0x54b1c1[_0x2dd8('0x2f')]=_[_0x2dd8('0x2d')](_0x127742[_0x2dd8('0x2e')],qs[_0x2dd8('0x30')](_0x487c00[_0x2dd8('0x2b')][_0x2dd8('0x30')]));_0x54b1c1[_0x2dd8('0x2f')]=_0x54b1c1[_0x2dd8('0x2f')][_0x2dd8('0x31')]?_0x54b1c1['attributes']:_0x127742[_0x2dd8('0x2e')];if(_0x487c00[_0x2dd8('0x2b')][_0x2dd8('0x3b')]){_0x54b1c1[_0x2dd8('0x3f')]=[{'all':!![]}];}_0x54b1c1=_[_0x2dd8('0x39')]({},_0x54b1c1,_0x487c00[_0x2dd8('0x3a')]);return db[_0x2dd8('0x28')]['find'](_0x54b1c1)[_0x2dd8('0x20')](handleEntityNotFound(_0x1aa661,null))[_0x2dd8('0x20')](respondWithResult(_0x1aa661,null))['catch'](handleError(_0x1aa661,null));};exports[_0x2dd8('0x40')]=function(_0x17d4e6,_0x40d211){return db[_0x2dd8('0x28')]['create'](_0x17d4e6[_0x2dd8('0x41')],{})['then'](respondWithResult(_0x40d211,0xc9))['catch'](handleError(_0x40d211,null));};exports['update']=function(_0x20ee39,_0x3f6c5a){if(_0x20ee39[_0x2dd8('0x41')]['id']){delete _0x20ee39[_0x2dd8('0x41')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x20ee39[_0x2dd8('0x42')]['id']}})[_0x2dd8('0x20')](handleEntityNotFound(_0x3f6c5a,null))['then'](saveUpdates(_0x20ee39[_0x2dd8('0x41')],null))[_0x2dd8('0x20')](respondWithResult(_0x3f6c5a,null))[_0x2dd8('0x43')](handleError(_0x3f6c5a,null));};exports[_0x2dd8('0x21')]=function(_0x577956,_0x188862){return db[_0x2dd8('0x28')][_0x2dd8('0x44')]({'where':{'id':_0x577956[_0x2dd8('0x42')]['id']}})[_0x2dd8('0x20')](handleEntityNotFound(_0x188862,null))['then'](removeEntity(_0x188862,null))[_0x2dd8('0x43')](handleError(_0x188862,null));}; \ No newline at end of file +var _0xccc8=['OpenchannelApplication','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','map'];(function(_0x2a0444,_0x243b7b){var _0x2ffd90=function(_0x562429){while(--_0x562429){_0x2a0444['push'](_0x2a0444['shift']());}};_0x2ffd90(++_0x243b7b);}(_0xccc8,0x147));var _0x8ccc=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0xccc8[_0x5712f8];return _0x14a364;};'use strict';var emlformat=require(_0x8ccc('0x0'));var rimraf=require(_0x8ccc('0x1'));var zipdir=require(_0x8ccc('0x2'));var jsonpatch=require(_0x8ccc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8ccc('0x4'));var util=require(_0x8ccc('0x5'));var path=require(_0x8ccc('0x6'));var sox=require(_0x8ccc('0x7'));var csv=require(_0x8ccc('0x8'));var ejs=require(_0x8ccc('0x9'));var fs=require('fs');var fs_extra=require(_0x8ccc('0xa'));var _=require(_0x8ccc('0xb'));var squel=require('squel');var crypto=require(_0x8ccc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8ccc('0xd'));var toCsv=require(_0x8ccc('0x8'));var querystring=require('querystring');var Papa=require(_0x8ccc('0xe'));var Redis=require(_0x8ccc('0xf'));var authService=require(_0x8ccc('0x10'));var qs=require(_0x8ccc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ccc('0x12'))(_0x8ccc('0x13'));var utils=require(_0x8ccc('0x14'));var config=require(_0x8ccc('0x15'));var licenseUtil=require(_0x8ccc('0x16'));var db=require(_0x8ccc('0x17'))['db'];function respondWithStatusCode(_0x4881de,_0x3dfcda){_0x3dfcda=_0x3dfcda||0xcc;return function(_0x568821){if(_0x568821){return _0x4881de[_0x8ccc('0x18')](_0x3dfcda);}return _0x4881de[_0x8ccc('0x19')](_0x3dfcda)['end']();};}function respondWithResult(_0x6f2abd,_0x575855){_0x575855=_0x575855||0xc8;return function(_0x1ebb85){if(_0x1ebb85){return _0x6f2abd[_0x8ccc('0x19')](_0x575855)['json'](_0x1ebb85);}};}function respondWithFilteredResult(_0x532887,_0x347bda){return function(_0x4e002d){if(_0x4e002d){var _0x46eed3=typeof _0x347bda[_0x8ccc('0x1a')]===_0x8ccc('0x1b')&&typeof _0x347bda[_0x8ccc('0x1c')]===_0x8ccc('0x1b');var _0x4071e4=_0x4e002d[_0x8ccc('0x1d')];var _0x598253=_0x46eed3?0x0:_0x347bda['offset'];var _0x416fce=_0x46eed3?_0x4e002d['count']:_0x347bda[_0x8ccc('0x1a')]+_0x347bda[_0x8ccc('0x1c')];var _0x3f5fc0;if(_0x416fce>=_0x4071e4){_0x416fce=_0x4071e4;_0x3f5fc0=0xc8;}else{_0x3f5fc0=0xce;}_0x532887[_0x8ccc('0x19')](_0x3f5fc0);return _0x532887[_0x8ccc('0x1e')](_0x8ccc('0x1f'),_0x598253+'-'+_0x416fce+'/'+_0x4071e4)['json'](_0x4e002d);}return null;};}function patchUpdates(_0x4f2577){return function(_0x3c6ff0){try{jsonpatch[_0x8ccc('0x20')](_0x3c6ff0,_0x4f2577,!![]);}catch(_0x161c5a){return BPromise['reject'](_0x161c5a);}return _0x3c6ff0[_0x8ccc('0x21')]();};}function saveUpdates(_0x1d0506,_0x3203d4){return function(_0x3a5e5b){if(_0x3a5e5b){return _0x3a5e5b[_0x8ccc('0x22')](_0x1d0506)[_0x8ccc('0x23')](function(_0x57a9ab){return _0x57a9ab;});}return null;};}function removeEntity(_0x58a7a3,_0x224363){return function(_0x4a080d){if(_0x4a080d){return _0x4a080d[_0x8ccc('0x24')]()['then'](function(){_0x58a7a3[_0x8ccc('0x19')](0xcc)[_0x8ccc('0x25')]();});}};}function handleEntityNotFound(_0x45819f,_0x39e100){return function(_0x227131){if(!_0x227131){_0x45819f[_0x8ccc('0x18')](0x194);}return _0x227131;};}function handleError(_0x4bbc99,_0x2e51e8){_0x2e51e8=_0x2e51e8||0x1f4;return function(_0x4d1a16){logger[_0x8ccc('0x26')](_0x4d1a16[_0x8ccc('0x27')]);if(_0x4d1a16[_0x8ccc('0x28')]){delete _0x4d1a16['name'];}_0x4bbc99['status'](_0x2e51e8)[_0x8ccc('0x29')](_0x4d1a16);};}exports['index']=function(_0x30b386,_0xb287c8){var _0x55f360={},_0x209dc5={},_0x22a08a={'count':0x0,'rows':[]};var _0x1a799e=_[_0x8ccc('0x2a')](db[_0x8ccc('0x2b')][_0x8ccc('0x2c')],function(_0x1b48bc){return{'name':_0x1b48bc[_0x8ccc('0x2d')],'type':_0x1b48bc[_0x8ccc('0x2e')]['key']};});_0x209dc5[_0x8ccc('0x2f')]=_[_0x8ccc('0x2a')](_0x1a799e,_0x8ccc('0x28'));_0x209dc5[_0x8ccc('0x30')]=_['keys'](_0x30b386['query']);_0x209dc5['filters']=_['intersection'](_0x209dc5['model'],_0x209dc5['query']);_0x55f360[_0x8ccc('0x31')]=_[_0x8ccc('0x32')](_0x209dc5[_0x8ccc('0x2f')],qs[_0x8ccc('0x33')](_0x30b386[_0x8ccc('0x30')]['fields']));_0x55f360['attributes']=_0x55f360[_0x8ccc('0x31')][_0x8ccc('0x34')]?_0x55f360[_0x8ccc('0x31')]:_0x209dc5[_0x8ccc('0x2f')];if(!_0x30b386[_0x8ccc('0x30')][_0x8ccc('0x35')](_0x8ccc('0x36'))){_0x55f360[_0x8ccc('0x1c')]=qs[_0x8ccc('0x1c')](_0x30b386[_0x8ccc('0x30')][_0x8ccc('0x1c')]);_0x55f360[_0x8ccc('0x1a')]=qs[_0x8ccc('0x1a')](_0x30b386[_0x8ccc('0x30')][_0x8ccc('0x1a')]);}_0x55f360[_0x8ccc('0x37')]=qs[_0x8ccc('0x38')](_0x30b386[_0x8ccc('0x30')]['sort']);_0x55f360['where']=qs[_0x8ccc('0x39')](_[_0x8ccc('0x3a')](_0x30b386[_0x8ccc('0x30')],_0x209dc5['filters']),_0x1a799e);if(_0x30b386[_0x8ccc('0x30')][_0x8ccc('0x3b')]){_0x55f360[_0x8ccc('0x3c')]=_['merge'](_0x55f360[_0x8ccc('0x3c')],{'$or':_[_0x8ccc('0x2a')](_0x1a799e,function(_0x4c11c9){if(_0x4c11c9['type']!==_0x8ccc('0x3d')){var _0xd55e45={};_0xd55e45[_0x4c11c9[_0x8ccc('0x28')]]={'$like':'%'+_0x30b386[_0x8ccc('0x30')]['filter']+'%'};return _0xd55e45;}})});}_0x55f360=_[_0x8ccc('0x3e')]({},_0x55f360,_0x30b386[_0x8ccc('0x3f')]);var _0xc8f47f={'where':_0x55f360[_0x8ccc('0x3c')]};return db[_0x8ccc('0x2b')]['count'](_0xc8f47f)[_0x8ccc('0x23')](function(_0x1fe7f3){_0x22a08a['count']=_0x1fe7f3;if(_0x30b386[_0x8ccc('0x30')][_0x8ccc('0x40')]){_0x55f360[_0x8ccc('0x41')]=[{'all':!![]}];}return db[_0x8ccc('0x2b')][_0x8ccc('0x42')](_0x55f360);})[_0x8ccc('0x23')](function(_0x1e216e){_0x22a08a['rows']=_0x1e216e;return _0x22a08a;})[_0x8ccc('0x23')](respondWithFilteredResult(_0xb287c8,_0x55f360))[_0x8ccc('0x43')](handleError(_0xb287c8,null));};exports[_0x8ccc('0x44')]=function(_0x32e061,_0x7d0660){var _0x4f40e1={'raw':!![],'where':{'id':_0x32e061[_0x8ccc('0x45')]['id']}},_0x1ba676={};_0x1ba676[_0x8ccc('0x2f')]=_[_0x8ccc('0x46')](db[_0x8ccc('0x2b')][_0x8ccc('0x2c')]);_0x1ba676[_0x8ccc('0x30')]=_[_0x8ccc('0x46')](_0x32e061[_0x8ccc('0x30')]);_0x1ba676[_0x8ccc('0x39')]=_[_0x8ccc('0x32')](_0x1ba676['model'],_0x1ba676[_0x8ccc('0x30')]);_0x4f40e1['attributes']=_[_0x8ccc('0x32')](_0x1ba676[_0x8ccc('0x2f')],qs['fields'](_0x32e061[_0x8ccc('0x30')][_0x8ccc('0x33')]));_0x4f40e1[_0x8ccc('0x31')]=_0x4f40e1[_0x8ccc('0x31')]['length']?_0x4f40e1[_0x8ccc('0x31')]:_0x1ba676[_0x8ccc('0x2f')];if(_0x32e061[_0x8ccc('0x30')][_0x8ccc('0x40')]){_0x4f40e1[_0x8ccc('0x41')]=[{'all':!![]}];}_0x4f40e1=_[_0x8ccc('0x3e')]({},_0x4f40e1,_0x32e061['options']);return db[_0x8ccc('0x2b')][_0x8ccc('0x47')](_0x4f40e1)[_0x8ccc('0x23')](handleEntityNotFound(_0x7d0660,null))[_0x8ccc('0x23')](respondWithResult(_0x7d0660,null))[_0x8ccc('0x43')](handleError(_0x7d0660,null));};exports['create']=function(_0x52f8f7,_0x182759){return db[_0x8ccc('0x2b')][_0x8ccc('0x48')](_0x52f8f7[_0x8ccc('0x49')],{})['then'](respondWithResult(_0x182759,0xc9))[_0x8ccc('0x43')](handleError(_0x182759,null));};exports['update']=function(_0xb4aa85,_0x15b21a){if(_0xb4aa85[_0x8ccc('0x49')]['id']){delete _0xb4aa85[_0x8ccc('0x49')]['id'];}return db[_0x8ccc('0x2b')][_0x8ccc('0x47')]({'where':{'id':_0xb4aa85[_0x8ccc('0x45')]['id']}})['then'](handleEntityNotFound(_0x15b21a,null))['then'](saveUpdates(_0xb4aa85['body'],null))[_0x8ccc('0x23')](respondWithResult(_0x15b21a,null))['catch'](handleError(_0x15b21a,null));};exports[_0x8ccc('0x24')]=function(_0x38be81,_0x5e5c43){return db[_0x8ccc('0x2b')][_0x8ccc('0x47')]({'where':{'id':_0x38be81[_0x8ccc('0x45')]['id']}})[_0x8ccc('0x23')](handleEntityNotFound(_0x5e5c43,null))['then'](removeEntity(_0x5e5c43,null))['catch'](handleError(_0x5e5c43,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 74bda45..4946e8d 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 _0x35ff=['define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','api','moment','bluebird','rimraf','./openchannelApplication.attributes','exports'];(function(_0x5ed63d,_0x4b7ea1){var _0x43192a=function(_0xbb6eaa){while(--_0xbb6eaa){_0x5ed63d['push'](_0x5ed63d['shift']());}};_0x43192a(++_0x4b7ea1);}(_0x35ff,0x1d0));var _0xf35f=function(_0x28fe30,_0x33e1aa){_0x28fe30=_0x28fe30-0x0;var _0x1119f4=_0x35ff[_0x28fe30];return _0x1119f4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf35f('0x0'));var moment=require(_0xf35f('0x1'));var BPromise=require(_0xf35f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf35f('0x3'));var config=require('../../config/environment');var attributes=require(_0xf35f('0x4'));module[_0xf35f('0x5')]=function(_0x4d0062,_0x5f8dff){return _0x4d0062[_0xf35f('0x6')](_0xf35f('0x7'),attributes,{'tableName':_0xf35f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf35f('0x9')});}; \ No newline at end of file +var _0x4f02=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications'];(function(_0x2a0a38,_0x4a6de5){var _0x4a200e=function(_0x2ef26b){while(--_0x2ef26b){_0x2a0a38['push'](_0x2a0a38['shift']());}};_0x4a200e(++_0x4a6de5);}(_0x4f02,0x11e));var _0x24f0=function(_0x4c5ef0,_0x5eb577){_0x4c5ef0=_0x4c5ef0-0x0;var _0xbdc14e=_0x4f02[_0x4c5ef0];return _0xbdc14e;};'use strict';var _=require(_0x24f0('0x0'));var util=require(_0x24f0('0x1'));var logger=require(_0x24f0('0x2'))(_0x24f0('0x3'));var moment=require(_0x24f0('0x4'));var BPromise=require('bluebird');var rp=require(_0x24f0('0x5'));var fs=require('fs');var path=require(_0x24f0('0x6'));var rimraf=require(_0x24f0('0x7'));var config=require(_0x24f0('0x8'));var attributes=require(_0x24f0('0x9'));module[_0x24f0('0xa')]=function(_0x23bf44,_0x24cf73){return _0x23bf44[_0x24f0('0xb')]('OpenchannelApplication',attributes,{'tableName':_0x24f0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 891fbdd..159323a 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 _0xb8a0=['stringify','error','code','message','request\x20sent','result','catch','OpenchannelApplication','update','body','options','raw','limit','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s'];(function(_0x2c73c6,_0x28332b){var _0x2e203c=function(_0x181ffa){while(--_0x181ffa){_0x2c73c6['push'](_0x2c73c6['shift']());}};_0x2e203c(++_0x28332b);}(_0xb8a0,0x92));var _0x0b8a=function(_0x2e4697,_0x3f8d97){_0x2e4697=_0x2e4697-0x0;var _0x173793=_0xb8a0[_0x2e4697];return _0x173793;};'use strict';var _=require(_0x0b8a('0x0'));var util=require(_0x0b8a('0x1'));var moment=require(_0x0b8a('0x2'));var BPromise=require(_0x0b8a('0x3'));var rs=require(_0x0b8a('0x4'));var fs=require('fs');var Redis=require(_0x0b8a('0x5'));var db=require(_0x0b8a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b8a('0x7'))(_0x0b8a('0x8'));var config=require(_0x0b8a('0x9'));var jayson=require(_0x0b8a('0xa'));var client=jayson[_0x0b8a('0xb')][_0x0b8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fdf80,_0x10b8a5,_0x12a5dd){return new BPromise(function(_0x6ad708,_0x588ce1){return client[_0x0b8a('0xd')](_0x4fdf80,_0x12a5dd)[_0x0b8a('0xe')](function(_0x10b8dd){logger[_0x0b8a('0xf')](_0x0b8a('0x10'),_0x10b8a5,'request\x20sent');logger[_0x0b8a('0x11')](_0x0b8a('0x12'),_0x10b8a5,'request\x20sent',JSON[_0x0b8a('0x13')](_0x10b8dd));if(_0x10b8dd[_0x0b8a('0x14')]){if(_0x10b8dd[_0x0b8a('0x14')][_0x0b8a('0x15')]===0x1f4){logger['error'](_0x0b8a('0x10'),_0x10b8a5,_0x10b8dd['error'][_0x0b8a('0x16')]);return _0x588ce1(_0x10b8dd[_0x0b8a('0x14')][_0x0b8a('0x16')]);}logger[_0x0b8a('0x14')]('OpenchannelApplication,\x20%s,\x20%s',_0x10b8a5,_0x10b8dd[_0x0b8a('0x14')][_0x0b8a('0x16')]);return _0x6ad708(_0x10b8dd[_0x0b8a('0x14')][_0x0b8a('0x16')]);}else{logger['info'](_0x0b8a('0x10'),_0x10b8a5,_0x0b8a('0x17'));_0x6ad708(_0x10b8dd[_0x0b8a('0x18')][_0x0b8a('0x16')]);}})[_0x0b8a('0x19')](function(_0x26239b){logger[_0x0b8a('0x14')](_0x0b8a('0x10'),_0x10b8a5,_0x26239b);_0x588ce1(_0x26239b);});});}exports['UpdateOpenchannelApplication']=function(_0xcb79bf){var _0x3cb818=this;return new Promise(function(_0x4eb572,_0x13ba9e){return db[_0x0b8a('0x1a')][_0x0b8a('0x1b')](_0xcb79bf[_0x0b8a('0x1c')],{'raw':_0xcb79bf[_0x0b8a('0x1d')]?_0xcb79bf[_0x0b8a('0x1d')][_0x0b8a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb79bf['options']?_0xcb79bf[_0x0b8a('0x1d')]['where']||null:null,'attributes':_0xcb79bf[_0x0b8a('0x1d')]?_0xcb79bf[_0x0b8a('0x1d')]['attributes']||null:null,'limit':_0xcb79bf[_0x0b8a('0x1d')]?_0xcb79bf[_0x0b8a('0x1d')][_0x0b8a('0x1f')]||null:null})[_0x0b8a('0xe')](function(_0x3a2202){logger[_0x0b8a('0xf')](_0x0b8a('0x20'),_0xcb79bf);logger[_0x0b8a('0x11')](_0x0b8a('0x20'),_0xcb79bf,JSON[_0x0b8a('0x13')](_0x3a2202));_0x4eb572(_0x3a2202);})[_0x0b8a('0x19')](function(_0x1485e7){logger[_0x0b8a('0x14')](_0x0b8a('0x20'),_0x1485e7[_0x0b8a('0x16')],_0xcb79bf);_0x13ba9e(_0x3cb818[_0x0b8a('0x14')](0x1f4,_0x1485e7[_0x0b8a('0x16')]));});});}; \ No newline at end of file +var _0x4b1d=['error','code','OpenchannelApplication,\x20%s,\x20%s','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1780ec,_0x42b2d9){var _0x105524=function(_0x256712){while(--_0x256712){_0x1780ec['push'](_0x1780ec['shift']());}};_0x105524(++_0x42b2d9);}(_0x4b1d,0x75));var _0xd4b1=function(_0x5464f0,_0x9565a6){_0x5464f0=_0x5464f0-0x0;var _0x55906b=_0x4b1d[_0x5464f0];return _0x55906b;};'use strict';var _=require(_0xd4b1('0x0'));var util=require(_0xd4b1('0x1'));var moment=require(_0xd4b1('0x2'));var BPromise=require(_0xd4b1('0x3'));var rs=require(_0xd4b1('0x4'));var fs=require('fs');var Redis=require(_0xd4b1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4b1('0x6'));var logger=require(_0xd4b1('0x7'))(_0xd4b1('0x8'));var config=require(_0xd4b1('0x9'));var jayson=require(_0xd4b1('0xa'));var client=jayson[_0xd4b1('0xb')][_0xd4b1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f6054,_0x30ee64,_0x573361){return new BPromise(function(_0x5422b1,_0x4d0eee){return client[_0xd4b1('0xd')](_0x2f6054,_0x573361)[_0xd4b1('0xe')](function(_0x276c7c){logger[_0xd4b1('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x30ee64,'request\x20sent');logger[_0xd4b1('0x10')](_0xd4b1('0x11'),_0x30ee64,'request\x20sent',JSON[_0xd4b1('0x12')](_0x276c7c));if(_0x276c7c[_0xd4b1('0x13')]){if(_0x276c7c[_0xd4b1('0x13')][_0xd4b1('0x14')]===0x1f4){logger[_0xd4b1('0x13')](_0xd4b1('0x15'),_0x30ee64,_0x276c7c[_0xd4b1('0x13')][_0xd4b1('0x16')]);return _0x4d0eee(_0x276c7c[_0xd4b1('0x13')]['message']);}logger['error'](_0xd4b1('0x15'),_0x30ee64,_0x276c7c['error']['message']);return _0x5422b1(_0x276c7c[_0xd4b1('0x13')][_0xd4b1('0x16')]);}else{logger[_0xd4b1('0xf')](_0xd4b1('0x15'),_0x30ee64,_0xd4b1('0x17'));_0x5422b1(_0x276c7c[_0xd4b1('0x18')][_0xd4b1('0x16')]);}})[_0xd4b1('0x19')](function(_0x3553a4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x30ee64,_0x3553a4);_0x4d0eee(_0x3553a4);});});}exports[_0xd4b1('0x1a')]=function(_0x5139e8){var _0x2f4816=this;return new Promise(function(_0x373322,_0x516443){return db[_0xd4b1('0x1b')][_0xd4b1('0x1c')](_0x5139e8[_0xd4b1('0x1d')],{'raw':_0x5139e8['options']?_0x5139e8[_0xd4b1('0x1e')][_0xd4b1('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5139e8[_0xd4b1('0x1e')]?_0x5139e8[_0xd4b1('0x1e')][_0xd4b1('0x20')]||null:null,'attributes':_0x5139e8['options']?_0x5139e8[_0xd4b1('0x1e')][_0xd4b1('0x21')]||null:null,'limit':_0x5139e8['options']?_0x5139e8[_0xd4b1('0x1e')]['limit']||null:null})['then'](function(_0x3cb001){logger[_0xd4b1('0xf')](_0xd4b1('0x1a'),_0x5139e8);logger[_0xd4b1('0x10')](_0xd4b1('0x1a'),_0x5139e8,JSON[_0xd4b1('0x12')](_0x3cb001));_0x373322(_0x3cb001);})[_0xd4b1('0x19')](function(_0xfcf0d2){logger[_0xd4b1('0x13')]('UpdateOpenchannelApplication',_0xfcf0d2[_0xd4b1('0x16')],_0x5139e8);_0x516443(_0x2f4816['error'](0x1f4,_0xfcf0d2[_0xd4b1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index a380c90..afa4dc8 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 _0x4cbb=['/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked','openchannel','addTags','openchannelinteraction:update','update','delete','removeTags','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','show','getMessages'];(function(_0xe6a113,_0x43ee01){var _0xdfb3c=function(_0x34bc86){while(--_0x34bc86){_0xe6a113['push'](_0xe6a113['shift']());}};_0xdfb3c(++_0x43ee01);}(_0x4cbb,0xc2));var _0xb4cb=function(_0x438459,_0x5a601f){_0x438459=_0x438459-0x0;var _0x15be84=_0x4cbb[_0x438459];return _0x15be84;};'use strict';var multer=require('multer');var util=require(_0xb4cb('0x0'));var path=require(_0xb4cb('0x1'));var timeout=require(_0xb4cb('0x2'));var express=require(_0xb4cb('0x3'));var router=express['Router']();var fs_extra=require(_0xb4cb('0x4'));var auth=require(_0xb4cb('0x5'));var interaction=require(_0xb4cb('0x6'));var config=require('../../config/environment');var controller=require(_0xb4cb('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb4cb('0x8')]);router[_0xb4cb('0x9')](_0xb4cb('0xa'),auth[_0xb4cb('0xb')](),controller[_0xb4cb('0xc')]);router[_0xb4cb('0x9')](_0xb4cb('0xd'),auth[_0xb4cb('0xb')](),controller[_0xb4cb('0xe')]);router[_0xb4cb('0x9')]('/:id/messages',auth[_0xb4cb('0xb')](),controller[_0xb4cb('0xf')]);router[_0xb4cb('0x9')](_0xb4cb('0x10'),auth['isAuthenticated'](),controller[_0xb4cb('0x11')]);router[_0xb4cb('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb4cb('0x12')](_0xb4cb('0x13'),auth[_0xb4cb('0xb')](),controller[_0xb4cb('0x14')]);router[_0xb4cb('0x12')](_0xb4cb('0x15'),auth['isAuthenticated'](),interaction[_0xb4cb('0x16')](_0xb4cb('0x17'),'openchannelinteraction:addtags'),controller[_0xb4cb('0x18')]);router['put'](_0xb4cb('0xd'),auth[_0xb4cb('0xb')](),interaction[_0xb4cb('0x16')](_0xb4cb('0x17'),_0xb4cb('0x19')),controller[_0xb4cb('0x1a')]);router[_0xb4cb('0x1b')](_0xb4cb('0xd'),auth[_0xb4cb('0xb')](),interaction[_0xb4cb('0x16')](_0xb4cb('0x17'),'openchannelinteraction:destroy'),controller['destroy']);router[_0xb4cb('0x1b')]('/:id/tags',auth[_0xb4cb('0xb')](),controller[_0xb4cb('0x1c')]);module[_0xb4cb('0x1d')]=router; \ No newline at end of file +var _0x069e=['openchannelinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','post','create','/:id/tags','tracked','addTags','put','/:id','openchannelinteraction:update','update','delete','openchannel'];(function(_0x1cb5f2,_0x1e7fb2){var _0x280533=function(_0x3820fd){while(--_0x3820fd){_0x1cb5f2['push'](_0x1cb5f2['shift']());}};_0x280533(++_0x1e7fb2);}(_0x069e,0xa4));var _0xe069=function(_0x2b63c9,_0x9b77ef){_0x2b63c9=_0x2b63c9-0x0;var _0x5928c6=_0x069e[_0x2b63c9];return _0x5928c6;};'use strict';var multer=require('multer');var util=require(_0xe069('0x0'));var path=require(_0xe069('0x1'));var timeout=require(_0xe069('0x2'));var express=require(_0xe069('0x3'));var router=express[_0xe069('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe069('0x5'));var interaction=require(_0xe069('0x6'));var config=require(_0xe069('0x7'));var controller=require(_0xe069('0x8'));router[_0xe069('0x9')]('/',auth[_0xe069('0xa')](),controller[_0xe069('0xb')]);router[_0xe069('0x9')](_0xe069('0xc'),auth[_0xe069('0xa')](),controller[_0xe069('0xd')]);router[_0xe069('0x9')]('/:id',auth[_0xe069('0xa')](),controller[_0xe069('0xe')]);router[_0xe069('0x9')](_0xe069('0xf'),auth[_0xe069('0xa')](),controller[_0xe069('0x10')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xe069('0x11')]('/',auth[_0xe069('0xa')](),controller[_0xe069('0x12')]);router[_0xe069('0x11')](_0xe069('0xf'),auth[_0xe069('0xa')](),controller['addMessage']);router['post'](_0xe069('0x13'),auth[_0xe069('0xa')](),interaction[_0xe069('0x14')]('openchannel','openchannelinteraction:addtags'),controller[_0xe069('0x15')]);router[_0xe069('0x16')](_0xe069('0x17'),auth[_0xe069('0xa')](),interaction['tracked']('openchannel',_0xe069('0x18')),controller[_0xe069('0x19')]);router[_0xe069('0x1a')]('/:id',auth[_0xe069('0xa')](),interaction[_0xe069('0x14')](_0xe069('0x1b'),_0xe069('0x1c')),controller[_0xe069('0x1d')]);router[_0xe069('0x1a')](_0xe069('0x13'),auth['isAuthenticated'](),controller[_0xe069('0x1e')]);module[_0xe069('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 444c23a..21a686e 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 _0xb627=['DATE','STRING','out','INTEGER','sequelize'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb627,0x144));var _0x7b62=function(_0x2899e4,_0x45a511){_0x2899e4=_0x2899e4-0x0;var _0x11d791=_0xb627[_0x2899e4];return _0x11d791;};'use strict';var Sequelize=require(_0x7b62('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7b62('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7b62('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b62('0x2')]},'note':{'type':Sequelize[_0x7b62('0x2')]},'read1stAt':{'type':Sequelize[_0x7b62('0x1')]},'threadId':{'type':Sequelize[_0x7b62('0x2')]},'externalUrl':{'type':Sequelize[_0x7b62('0x2')]},'lastMsgAt':{'type':Sequelize[_0x7b62('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7b62('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7b62('0x3')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7b62('0x2')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7b62('0x4')]}}; \ No newline at end of file +var _0xa5fa=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x1d8811,_0x57aaa6){var _0x2b2454=function(_0xb561a1){while(--_0xb561a1){_0x1d8811['push'](_0x1d8811['shift']());}};_0x2b2454(++_0x57aaa6);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x146dd7,_0x4d877d){_0x146dd7=_0x146dd7-0x0;var _0x2af0bb=_0xa5fa[_0x146dd7];return _0x2af0bb;};'use strict';var Sequelize=require('sequelize');module[_0xaa5f('0x0')]={'closed':{'type':Sequelize[_0xaa5f('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xaa5f('0x2')]},'disposition':{'type':Sequelize[_0xaa5f('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xaa5f('0x3')]},'note':{'type':Sequelize[_0xaa5f('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xaa5f('0x3')]},'externalUrl':{'type':Sequelize[_0xaa5f('0x3')]},'lastMsgAt':{'type':Sequelize[_0xaa5f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xaa5f('0x4')]('in',_0xaa5f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xaa5f('0x4')]('in',_0xaa5f('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xaa5f('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xaa5f('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xaa5f('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 71473f8..6776dc2 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 _0xeb95=['Owner','get','mkdirSync','Openchannel','N.A.','closedAt','disposition','threadId','Public','Private','createReadStream','pipe','out','basename','value','renderFile','views','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','status','end','offset','undefined','limit','count','set','Content-Range','json','then','sendStatus','stack','name','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','openchannel','user','catch','show','query','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','update','destroy','describe','ids','omit','getMessages','findOne','OpenchannelMessage','hasOwnProperty','nolimit','order','sort','pick','where','OpenchannelInteractionId','filter','merge','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','spread','Tag','color','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account'];(function(_0x4a4c77,_0x295462){var _0x5c74f6=function(_0x4e2c0c){while(--_0x4e2c0c){_0x4a4c77['push'](_0x4a4c77['shift']());}};_0x5c74f6(++_0x295462);}(_0xeb95,0x94));var _0x5eb9=function(_0x2fa3b0,_0x276f7e){_0x2fa3b0=_0x2fa3b0-0x0;var _0x5f4384=_0xeb95[_0x2fa3b0];return _0x5f4384;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x5eb9('0x0'));var moment=require(_0x5eb9('0x1'));var util=require('util');var path=require(_0x5eb9('0x2'));var ejs=require(_0x5eb9('0x3'));var fs=require('fs');var _=require(_0x5eb9('0x4'));var Redis=require(_0x5eb9('0x5'));var interaction=require(_0x5eb9('0x6'));var qs=require(_0x5eb9('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x5eb9('0x8'))('api');var config=require(_0x5eb9('0x9'));var db=require(_0x5eb9('0xa'))['db'];config[_0x5eb9('0xb')]=_[_0x5eb9('0xc')](config[_0x5eb9('0xb')],{'host':_0x5eb9('0xd'),'port':0x18eb});var socket=require(_0x5eb9('0xe'))(new Redis(config['redis']));require(_0x5eb9('0xf'))['register'](socket);function respondWithStatusCode(_0x5bad8a,_0x101fcc){_0x101fcc=_0x101fcc||0xcc;return function(_0x3d6b72){if(_0x3d6b72){return _0x5bad8a['sendStatus'](_0x101fcc);}return _0x5bad8a[_0x5eb9('0x10')](_0x101fcc)[_0x5eb9('0x11')]();};}function respondWithResult(_0x302c5f,_0x505f84){_0x505f84=_0x505f84||0xc8;return function(_0x3dfbe5){if(_0x3dfbe5){return _0x302c5f['status'](_0x505f84)['json'](_0x3dfbe5);}};}function respondWithFilteredResult(_0x3b5d46,_0x3fb05e){return function(_0x2c60ea){if(_0x2c60ea){var _0x5d0f45=typeof _0x3fb05e[_0x5eb9('0x12')]===_0x5eb9('0x13')&&typeof _0x3fb05e[_0x5eb9('0x14')]===_0x5eb9('0x13');var _0x231bb2=_0x2c60ea[_0x5eb9('0x15')];var _0x269c5b=_0x5d0f45?0x0:_0x3fb05e[_0x5eb9('0x12')];var _0x26381b=_0x5d0f45?_0x2c60ea['count']:_0x3fb05e['offset']+_0x3fb05e[_0x5eb9('0x14')];var _0x49dc1c;if(_0x26381b>=_0x231bb2){_0x26381b=_0x231bb2;_0x49dc1c=0xc8;}else{_0x49dc1c=0xce;}_0x3b5d46[_0x5eb9('0x10')](_0x49dc1c);return _0x3b5d46[_0x5eb9('0x16')](_0x5eb9('0x17'),_0x269c5b+'-'+_0x26381b+'/'+_0x231bb2)[_0x5eb9('0x18')](_0x2c60ea);}return null;};}function saveUpdates(_0x289153){return function(_0x175135){if(_0x175135){return _0x175135['update'](_0x289153)[_0x5eb9('0x19')](function(_0x325a9b){return _0x325a9b;});}return null;};}function removeEntity(_0x4bd1bb){return function(_0x5ddca7){if(_0x5ddca7){return _0x5ddca7['destroy']()[_0x5eb9('0x19')](function(){_0x4bd1bb[_0x5eb9('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bf042){return function(_0x46bc3b){if(!_0x46bc3b){_0x1bf042[_0x5eb9('0x1a')](0x194);}return _0x46bc3b;};}function handleError(_0x4d611e,_0x1866f6){_0x1866f6=_0x1866f6||0x1f4;return function(_0x1555e1){logger['error'](_0x1555e1[_0x5eb9('0x1b')]);if(_0x1555e1[_0x5eb9('0x1c')]){delete _0x1555e1[_0x5eb9('0x1c')];}_0x4d611e[_0x5eb9('0x10')](_0x1866f6)['send'](_0x1555e1);};}exports['index']=function(_0x152e18,_0x48ab96){var _0x2be352={};var _0x6c38f=_['map'](db[_0x5eb9('0x1d')][_0x5eb9('0x1e')],function(_0x9e23a3){return{'name':_0x9e23a3[_0x5eb9('0x1f')],'type':_0x9e23a3[_0x5eb9('0x20')][_0x5eb9('0x21')]};});_0x2be352=qs[_0x5eb9('0x22')](_0x6c38f,_0x152e18);return interaction['findAll'](_0x5eb9('0x23'),_0x152e18['query'],_0x152e18[_0x5eb9('0x24')],_0x2be352,_0x6c38f)['then'](respondWithFilteredResult(_0x48ab96,_0x2be352))[_0x5eb9('0x25')](handleError(_0x48ab96,null));};exports[_0x5eb9('0x26')]=function(_0x4b5b18,_0x75d9a5){var _0x533761={};if(_0x4b5b18[_0x5eb9('0x27')][_0x5eb9('0x20')]&&_0x4b5b18[_0x5eb9('0x27')][_0x5eb9('0x20')]===_0x5eb9('0x28')){_0x533761[_0x5eb9('0x28')]=_0x4b5b18[_0x5eb9('0x29')]['id'];}else{_0x533761['id']=_0x4b5b18['params']['id'];}var _0x1b4324={'raw':![],'where':_0x533761},_0x34bed1={};_0x34bed1[_0x5eb9('0x2a')]=_['keys'](db['OpenchannelInteraction'][_0x5eb9('0x1e')]);_0x34bed1[_0x5eb9('0x27')]=_[_0x5eb9('0x2b')](_0x4b5b18[_0x5eb9('0x27')]);_0x34bed1[_0x5eb9('0x2c')]=_[_0x5eb9('0x2d')](_0x34bed1[_0x5eb9('0x2a')],_0x34bed1[_0x5eb9('0x27')]);_0x1b4324[_0x5eb9('0x2e')]=_[_0x5eb9('0x2d')](_0x34bed1[_0x5eb9('0x2a')],qs[_0x5eb9('0x2f')](_0x4b5b18[_0x5eb9('0x27')][_0x5eb9('0x2f')]));_0x1b4324['attributes']=_0x1b4324[_0x5eb9('0x2e')][_0x5eb9('0x30')]?_0x1b4324[_0x5eb9('0x2e')]:_0x34bed1[_0x5eb9('0x2a')];if(_0x4b5b18[_0x5eb9('0x27')][_0x5eb9('0x31')]){_0x1b4324[_0x5eb9('0x32')]=[{'all':!![]}];}_0x1b4324=_['merge']({},_0x1b4324,_0x4b5b18[_0x5eb9('0x33')]);return db[_0x5eb9('0x1d')][_0x5eb9('0x34')](_0x1b4324)['then'](handleEntityNotFound(_0x75d9a5,null))[_0x5eb9('0x19')](respondWithResult(_0x75d9a5,null))['catch'](handleError(_0x75d9a5,null));};exports[_0x5eb9('0x35')]=function(_0x2b60f1,_0x49a429){return db[_0x5eb9('0x1d')][_0x5eb9('0x35')](_0x2b60f1[_0x5eb9('0x36')],{})[_0x5eb9('0x19')](respondWithResult(_0x49a429,0xc9))['catch'](handleError(_0x49a429,null));};exports[_0x5eb9('0x37')]=function(_0x3adbfc,_0x1bc578){if(_0x3adbfc['body']['id']){delete _0x3adbfc[_0x5eb9('0x36')]['id'];}return db['OpenchannelInteraction'][_0x5eb9('0x34')]({'where':{'id':_0x3adbfc[_0x5eb9('0x29')]['id']}})[_0x5eb9('0x19')](handleEntityNotFound(_0x1bc578,null))[_0x5eb9('0x19')](saveUpdates(_0x3adbfc['body'],null))[_0x5eb9('0x19')](respondWithResult(_0x1bc578,null))[_0x5eb9('0x25')](handleError(_0x1bc578,null));};exports[_0x5eb9('0x38')]=function(_0x256678,_0x162ac1){return db[_0x5eb9('0x1d')]['find']({'where':{'id':_0x256678['params']['id']}})[_0x5eb9('0x19')](handleEntityNotFound(_0x162ac1,null))[_0x5eb9('0x19')](removeEntity(_0x162ac1,null))[_0x5eb9('0x25')](handleError(_0x162ac1,null));};exports[_0x5eb9('0x39')]=function(_0x159aae,_0x3fe1f3){return db[_0x5eb9('0x1d')][_0x5eb9('0x39')]()[_0x5eb9('0x19')](respondWithResult(_0x3fe1f3,null))[_0x5eb9('0x25')](handleError(_0x3fe1f3,null));};exports['addMessage']=function(_0x1e6c11,_0x542d67){return db['OpenchannelMessage'][_0x5eb9('0x34')]({'where':{'id':_0x1e6c11[_0x5eb9('0x29')]['id']}})['then'](handleEntityNotFound(_0x542d67,null))[_0x5eb9('0x19')](function(_0x421607){if(_0x421607){return _0x421607['addMessage'](_0x1e6c11[_0x5eb9('0x36')][_0x5eb9('0x3a')],_[_0x5eb9('0x3b')](_0x1e6c11['body'],[_0x5eb9('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x542d67,null))[_0x5eb9('0x25')](handleError(_0x542d67,null));};exports[_0x5eb9('0x3c')]=function(_0x3f1449,_0xba2cec){var _0x4199e1={'raw':![],'where':{}};var _0x196228={};var _0x32c6c7={'count':0x0,'rows':[]};return db[_0x5eb9('0x1d')][_0x5eb9('0x3d')]({'where':{'id':_0x3f1449['params']['id']}})[_0x5eb9('0x19')](handleEntityNotFound(_0xba2cec,null))[_0x5eb9('0x19')](function(_0x3091f1){if(_0x3091f1){_0x196228['model']=_[_0x5eb9('0x2b')](db[_0x5eb9('0x3e')][_0x5eb9('0x1e')]);_0x196228[_0x5eb9('0x27')]=_[_0x5eb9('0x2b')](_0x3f1449[_0x5eb9('0x27')]);_0x196228['filters']=_['intersection'](_0x196228['model'],_0x196228[_0x5eb9('0x27')]);_0x4199e1[_0x5eb9('0x2e')]=_[_0x5eb9('0x2d')](_0x196228[_0x5eb9('0x2a')],qs[_0x5eb9('0x2f')](_0x3f1449[_0x5eb9('0x27')][_0x5eb9('0x2f')]));_0x4199e1[_0x5eb9('0x2e')]=_0x4199e1[_0x5eb9('0x2e')][_0x5eb9('0x30')]?_0x4199e1['attributes']:_0x196228[_0x5eb9('0x2a')];if(!_0x3f1449['query'][_0x5eb9('0x3f')](_0x5eb9('0x40'))){_0x4199e1[_0x5eb9('0x14')]=qs[_0x5eb9('0x14')](_0x3f1449[_0x5eb9('0x27')][_0x5eb9('0x14')]);_0x4199e1[_0x5eb9('0x12')]=qs[_0x5eb9('0x12')](_0x3f1449[_0x5eb9('0x27')][_0x5eb9('0x12')]);}_0x4199e1[_0x5eb9('0x41')]=qs[_0x5eb9('0x42')](_0x3f1449[_0x5eb9('0x27')][_0x5eb9('0x42')]);_0x4199e1['where']=qs[_0x5eb9('0x2c')](_[_0x5eb9('0x43')](_0x3f1449[_0x5eb9('0x27')],_0x196228[_0x5eb9('0x2c')]));_0x4199e1[_0x5eb9('0x44')][_0x5eb9('0x45')]=_0x3091f1['id'];if(_0x3f1449[_0x5eb9('0x27')][_0x5eb9('0x46')]){_0x4199e1[_0x5eb9('0x44')]=_[_0x5eb9('0x47')](_0x4199e1[_0x5eb9('0x44')],{'$or':_[_0x5eb9('0x48')](_0x4199e1['attributes'],function(_0x5e0898){var _0x1d9ee4={};_0x1d9ee4[_0x5e0898]={'$like':'%'+_0x3f1449['query']['filter']+'%'};return _0x1d9ee4;})});}if(_0x3f1449[_0x5eb9('0x27')]['$gte']){var _0x42ea64=_0x3f1449['query'][_0x5eb9('0x49')]['split'](',');var _0x530680={};_0x530680[_0x42ea64[0x0]]={'$gte':moment(_0x42ea64[0x1])[_0x5eb9('0x4a')](_0x5eb9('0x4b'))};_0x4199e1[_0x5eb9('0x44')]=_[_0x5eb9('0x47')](_0x4199e1['where'],_0x530680);}_0x4199e1=_[_0x5eb9('0x47')]({},_0x4199e1,_0x3f1449[_0x5eb9('0x33')]);return db[_0x5eb9('0x3e')][_0x5eb9('0x15')]({'where':_0x4199e1[_0x5eb9('0x44')]})[_0x5eb9('0x19')](function(_0x8639f5){_0x32c6c7[_0x5eb9('0x15')]=_0x8639f5;if(_0x3f1449[_0x5eb9('0x27')][_0x5eb9('0x31')]){_0x4199e1[_0x5eb9('0x32')]=[{'all':!![]}];}return db[_0x5eb9('0x3e')][_0x5eb9('0x4c')](_0x4199e1);})['then'](function(_0x1d1ffd){_0x32c6c7[_0x5eb9('0x4d')]=_0x1d1ffd;return _0x32c6c7;});}})[_0x5eb9('0x19')](respondWithFilteredResult(_0xba2cec,_0x4199e1))[_0x5eb9('0x25')](handleError(_0xba2cec,null));};exports[_0x5eb9('0x4e')]=function(_0xb7a270,_0x519cbe){return db[_0x5eb9('0x1d')][_0x5eb9('0x34')]({'where':{'id':_0xb7a270[_0x5eb9('0x29')]['id']}})['then'](handleEntityNotFound(_0x519cbe,null))[_0x5eb9('0x19')](function(_0x5374f2){if(_0x5374f2){return _0x5374f2['setTags'](_0xb7a270[_0x5eb9('0x36')][_0x5eb9('0x3a')],_[_0x5eb9('0x3b')](_0xb7a270[_0x5eb9('0x36')],['ids','id'])||{})[_0x5eb9('0x4f')](function(){return db[_0x5eb9('0x50')]['findAll']({'attributes':['id',_0x5eb9('0x1c'),_0x5eb9('0x51')],'where':{'id':_0xb7a270[_0x5eb9('0x36')][_0x5eb9('0x3a')]}});})['then'](function(_0x19f8e4){socket['emit'](_0x5eb9('0x52'),{'id':Number(_0xb7a270[_0x5eb9('0x29')]['id']),'tags':_0x19f8e4||[]});return{'id':Number(_0xb7a270[_0x5eb9('0x29')]['id']),'tags':_0x19f8e4||[]};});}})[_0x5eb9('0x19')](respondWithResult(_0x519cbe,null))[_0x5eb9('0x25')](handleError(_0x519cbe,null));};exports[_0x5eb9('0x53')]=function(_0x2e0b28,_0x3995b6){return db['OpenchannelInteraction'][_0x5eb9('0x34')]({'where':{'id':_0x2e0b28[_0x5eb9('0x29')]['id']}})['then'](handleEntityNotFound(_0x3995b6,null))[_0x5eb9('0x19')](function(_0x2f3eae){if(_0x2f3eae){return _0x2f3eae[_0x5eb9('0x53')](_0x2e0b28[_0x5eb9('0x27')]['ids']);}})['then'](respondWithStatusCode(_0x3995b6,null))[_0x5eb9('0x25')](handleError(_0x3995b6,null));};exports[_0x5eb9('0x54')]=function(_0x2252c5,_0x5c9fd6){var _0x31ec7c=moment()[_0x5eb9('0x55')]()[_0x5eb9('0x56')]();var _0x4376d4=path[_0x5eb9('0x57')](config[_0x5eb9('0x58')],_0x5eb9('0x59'),_0x5eb9('0x5a'),_0x5eb9('0x5b'));var _0x3acf9f=path[_0x5eb9('0x57')](config[_0x5eb9('0x58')],_0x5eb9('0x59'),_0x5eb9('0x5a'),_0x5eb9('0x5c'));var _0x13cdbb=path[_0x5eb9('0x57')](_0x4376d4,_0x31ec7c);var _0x21488a=util['format'](_0x5eb9('0x5d'),_0x2252c5[_0x5eb9('0x29')]['id'],_0x31ec7c);var _0xfa769e=path[_0x5eb9('0x57')](_0x4376d4,_0x21488a);var _0xac2cc0=[];_0xac2cc0['push']({'model':db[_0x5eb9('0x5e')],'as':_0x5eb9('0x5e'),'attributes':['id',_0x5eb9('0x5f')],'raw':!![]});_0xac2cc0[_0x5eb9('0x60')]({'model':db[_0x5eb9('0x61')],'as':_0x5eb9('0x62'),'attributes':['id',_0x5eb9('0x63'),_0x5eb9('0x64')],'raw':!![]});if(_0x2252c5[_0x5eb9('0x27')][_0x5eb9('0x5c')]){_0xac2cc0['push']({'model':db[_0x5eb9('0x65')],'as':_0x5eb9('0x65'),'raw':!![]});}var _0x3d638c=[{'model':db[_0x5eb9('0x3e')],'as':_0x5eb9('0x66'),'attributes':['id',_0x5eb9('0x36'),_0x5eb9('0x67'),_0x5eb9('0x68'),_0x5eb9('0x69'),'read'],'include':_0xac2cc0}];_0x3d638c['push']({'model':db[_0x5eb9('0x6a')],'as':_0x5eb9('0x6b'),'attributes':['id',_0x5eb9('0x1c')]});_0x3d638c['push']({'model':db[_0x5eb9('0x5e')],'as':_0x5eb9('0x6c'),'attributes':['id',_0x5eb9('0x5f')]});return db[_0x5eb9('0x1d')][_0x5eb9('0x34')]({'where':{'id':_0x2252c5[_0x5eb9('0x29')]['id']},'include':_0x3d638c})[_0x5eb9('0x19')](handleEntityNotFound(_0x5c9fd6,null))[_0x5eb9('0x19')](function(_0x2ee69d){if(_0x2ee69d){var _0x395530=_0x2ee69d[_0x5eb9('0x6d')]({'plain':!![]});fs[_0x5eb9('0x6e')](_0x13cdbb);var _0x2e3571={'channel':_0x5eb9('0x6f'),'account':_0x395530['Account'][_0x5eb9('0x1c')],'agent':_0x395530['Owner']?_0x395530[_0x5eb9('0x6c')]['fullname']:_0x5eb9('0x70'),'createdAt':moment(_0x395530[_0x5eb9('0x67')])[_0x5eb9('0x4a')](_0x5eb9('0x4b'))['toString'](),'closedAt':_0x395530['closed']?moment(_0x395530[_0x5eb9('0x71')])[_0x5eb9('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5eb9('0x56')]():'','disposition':_0x395530[_0x5eb9('0x72')],'visibility':_0x395530[_0x5eb9('0x73')]?_0x5eb9('0x74'):_0x5eb9('0x75'),'messages':_(_0x395530['Messages'])['filter']({'secret':![]})[_0x5eb9('0x48')](function(_0x3d8f22){if(_0x3d8f22['Attachment']){var _0x4fb48e=path[_0x5eb9('0x57')](_0x3acf9f,_0x3d8f22[_0x5eb9('0x65')]['basename']);if(fs['existsSync'](_0x4fb48e)){fs[_0x5eb9('0x76')](_0x4fb48e)[_0x5eb9('0x77')](fs['createWriteStream'](path[_0x5eb9('0x57')](_0x13cdbb,_0x3d8f22[_0x5eb9('0x65')]['basename'])));}}return{'date':moment(_0x3d8f22[_0x5eb9('0x67')])[_0x5eb9('0x4a')](_0x5eb9('0x4b'))[_0x5eb9('0x56')](),'sender':_0x3d8f22[_0x5eb9('0x68')]===_0x5eb9('0x78')?_0x3d8f22[_0x5eb9('0x5e')]?_0x3d8f22['User'][_0x5eb9('0x5f')]:'System':_0x3d8f22[_0x5eb9('0x62')][_0x5eb9('0x63')]+(_0x3d8f22[_0x5eb9('0x62')]['lastName']?'\x20'+_0x3d8f22[_0x5eb9('0x62')]['lastName']:''),'body':_0x3d8f22[_0x5eb9('0x65')]?_0x3d8f22[_0x5eb9('0x65')][_0x5eb9('0x79')]:_0x3d8f22[_0x5eb9('0x36')],'direction':_0x3d8f22['direction']==='out'?'A':'C','secret':_0x3d8f22[_0x5eb9('0x69')],'read':_0x3d8f22['read'],'attachment':_0x3d8f22[_0x5eb9('0x65')]};})[_0x5eb9('0x7a')]()};return ejs[_0x5eb9('0x7b')](path[_0x5eb9('0x57')](config['root'],'server',_0x5eb9('0x7c'),'downloadInteraction.ejs'),{'interaction':_0x2e3571})['then'](function(_0x2ff173){var _0x2a13fb=path['join'](_0x13cdbb,'transcript-'+_0x395530['id']+'-'+_0x31ec7c+_0x5eb9('0x7d'));var _0x25be8d={'path':_0x2a13fb,'channel':_0x5eb9('0x6f'),'interactionId':_0x395530['id']};return pdf[_0x5eb9('0x7e')](_0x2ff173,_0x25be8d);})[_0x5eb9('0x19')](function(){return new Promise(function(_0x4da8b6,_0x50937c){zipdir(_0x13cdbb,{'saveTo':_0xfa769e},function(_0x742f42,_0x370d98){if(_0x742f42)return _0x50937c(_0x742f42);return _0x4da8b6(_0x370d98);});})[_0x5eb9('0x19')](function(){return new Promise(function(_0x55a69c,_0x4f4852){rimraf(_0x13cdbb,function(_0x2fe9c1){if(_0x2fe9c1)_0x4f4852(_0x2fe9c1);return _0x55a69c();});});})[_0x5eb9('0x19')](function(){return _0x5c9fd6[_0x5eb9('0x54')](_0xfa769e,_0x21488a,function(_0x4e12d4){if(_0x4e12d4){logger['error'](_0x5eb9('0x7f'),_0x4e12d4);}else{fs['unlinkSync'](_0xfa769e);}});});});}else{return _0x5c9fd6[_0x5eb9('0x1a')](0xc8);}})[_0x5eb9('0x25')](handleError(_0x5c9fd6,null));}; \ No newline at end of file +var _0xba26=['rawAttributes','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','create','body','destroy','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','removeTags','unix','toString','join','root','server','attachments','push','User','Contact','firstName','lastName','Attachment','Messages','createdAt','OpenchannelAccount','Account','fullname','get','mkdirSync','Openchannel','Owner','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','secret','read','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','update','then','error','stack','name','send','index','map','OpenchannelInteraction','type','getOptions','findAll','openchannel','query','show','from','params','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba26,0x1d7));var _0x6ba2=function(_0x44b229,_0x49c02d){_0x44b229=_0x44b229-0x0;var _0xd942d0=_0xba26[_0x44b229];return _0xd942d0;};'use strict';var rimraf=require(_0x6ba2('0x0'));var zipdir=require(_0x6ba2('0x1'));var moment=require(_0x6ba2('0x2'));var util=require(_0x6ba2('0x3'));var path=require(_0x6ba2('0x4'));var ejs=require(_0x6ba2('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x6ba2('0x6'));var interaction=require(_0x6ba2('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x6ba2('0x8'));var logger=require(_0x6ba2('0x9'))('api');var config=require(_0x6ba2('0xa'));var db=require(_0x6ba2('0xb'))['db'];config[_0x6ba2('0xc')]=_[_0x6ba2('0xd')](config[_0x6ba2('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6ba2('0xe'))(new Redis(config[_0x6ba2('0xc')]));require(_0x6ba2('0xf'))[_0x6ba2('0x10')](socket);function respondWithStatusCode(_0x3553e1,_0x511d4f){_0x511d4f=_0x511d4f||0xcc;return function(_0x5a43e9){if(_0x5a43e9){return _0x3553e1[_0x6ba2('0x11')](_0x511d4f);}return _0x3553e1[_0x6ba2('0x12')](_0x511d4f)[_0x6ba2('0x13')]();};}function respondWithResult(_0x2ea09d,_0x494627){_0x494627=_0x494627||0xc8;return function(_0x4bda21){if(_0x4bda21){return _0x2ea09d['status'](_0x494627)['json'](_0x4bda21);}};}function respondWithFilteredResult(_0x33df2f,_0x329b54){return function(_0x328d1b){if(_0x328d1b){var _0x1703bc=typeof _0x329b54[_0x6ba2('0x14')]==='undefined'&&typeof _0x329b54[_0x6ba2('0x15')]===_0x6ba2('0x16');var _0x452b11=_0x328d1b[_0x6ba2('0x17')];var _0x57df2c=_0x1703bc?0x0:_0x329b54[_0x6ba2('0x14')];var _0x21027b=_0x1703bc?_0x328d1b['count']:_0x329b54[_0x6ba2('0x14')]+_0x329b54[_0x6ba2('0x15')];var _0x3899f8;if(_0x21027b>=_0x452b11){_0x21027b=_0x452b11;_0x3899f8=0xc8;}else{_0x3899f8=0xce;}_0x33df2f[_0x6ba2('0x12')](_0x3899f8);return _0x33df2f[_0x6ba2('0x18')](_0x6ba2('0x19'),_0x57df2c+'-'+_0x21027b+'/'+_0x452b11)[_0x6ba2('0x1a')](_0x328d1b);}return null;};}function saveUpdates(_0x39f2bd){return function(_0x4cdd9f){if(_0x4cdd9f){return _0x4cdd9f[_0x6ba2('0x1b')](_0x39f2bd)[_0x6ba2('0x1c')](function(_0x2c8d13){return _0x2c8d13;});}return null;};}function removeEntity(_0x4f55dc){return function(_0x1e4f73){if(_0x1e4f73){return _0x1e4f73['destroy']()[_0x6ba2('0x1c')](function(){_0x4f55dc[_0x6ba2('0x12')](0xcc)[_0x6ba2('0x13')]();});}};}function handleEntityNotFound(_0x3d0b9c){return function(_0x4ef383){if(!_0x4ef383){_0x3d0b9c[_0x6ba2('0x11')](0x194);}return _0x4ef383;};}function handleError(_0x4d6347,_0x28b039){_0x28b039=_0x28b039||0x1f4;return function(_0x3c0283){logger[_0x6ba2('0x1d')](_0x3c0283[_0x6ba2('0x1e')]);if(_0x3c0283[_0x6ba2('0x1f')]){delete _0x3c0283['name'];}_0x4d6347[_0x6ba2('0x12')](_0x28b039)[_0x6ba2('0x20')](_0x3c0283);};}exports[_0x6ba2('0x21')]=function(_0x97c0de,_0x1efb61){var _0x1bbbc4={};var _0x2eec5e=_[_0x6ba2('0x22')](db[_0x6ba2('0x23')]['rawAttributes'],function(_0x2d6207){return{'name':_0x2d6207['fieldName'],'type':_0x2d6207[_0x6ba2('0x24')]['key']};});_0x1bbbc4=qs[_0x6ba2('0x25')](_0x2eec5e,_0x97c0de);return interaction[_0x6ba2('0x26')](_0x6ba2('0x27'),_0x97c0de[_0x6ba2('0x28')],_0x97c0de['user'],_0x1bbbc4,_0x2eec5e)[_0x6ba2('0x1c')](respondWithFilteredResult(_0x1efb61,_0x1bbbc4))['catch'](handleError(_0x1efb61,null));};exports[_0x6ba2('0x29')]=function(_0x1527cb,_0x5a5c66){var _0x1ba74d={};if(_0x1527cb[_0x6ba2('0x28')][_0x6ba2('0x24')]&&_0x1527cb[_0x6ba2('0x28')][_0x6ba2('0x24')]===_0x6ba2('0x2a')){_0x1ba74d[_0x6ba2('0x2a')]=_0x1527cb['params']['id'];}else{_0x1ba74d['id']=_0x1527cb[_0x6ba2('0x2b')]['id'];}var _0x457ec4={'raw':![],'where':_0x1ba74d},_0x2c6a37={};_0x2c6a37['model']=_[_0x6ba2('0x2c')](db[_0x6ba2('0x23')][_0x6ba2('0x2d')]);_0x2c6a37['query']=_[_0x6ba2('0x2c')](_0x1527cb[_0x6ba2('0x28')]);_0x2c6a37[_0x6ba2('0x2e')]=_['intersection'](_0x2c6a37[_0x6ba2('0x2f')],_0x2c6a37[_0x6ba2('0x28')]);_0x457ec4[_0x6ba2('0x30')]=_[_0x6ba2('0x31')](_0x2c6a37['model'],qs[_0x6ba2('0x32')](_0x1527cb[_0x6ba2('0x28')][_0x6ba2('0x32')]));_0x457ec4[_0x6ba2('0x30')]=_0x457ec4[_0x6ba2('0x30')][_0x6ba2('0x33')]?_0x457ec4['attributes']:_0x2c6a37[_0x6ba2('0x2f')];if(_0x1527cb[_0x6ba2('0x28')][_0x6ba2('0x34')]){_0x457ec4[_0x6ba2('0x35')]=[{'all':!![]}];}_0x457ec4=_[_0x6ba2('0x36')]({},_0x457ec4,_0x1527cb[_0x6ba2('0x37')]);return db['OpenchannelInteraction'][_0x6ba2('0x38')](_0x457ec4)[_0x6ba2('0x1c')](handleEntityNotFound(_0x5a5c66,null))[_0x6ba2('0x1c')](respondWithResult(_0x5a5c66,null))[_0x6ba2('0x39')](handleError(_0x5a5c66,null));};exports[_0x6ba2('0x3a')]=function(_0x3d2df7,_0x1135ed){return db[_0x6ba2('0x23')][_0x6ba2('0x3a')](_0x3d2df7[_0x6ba2('0x3b')],{})[_0x6ba2('0x1c')](respondWithResult(_0x1135ed,0xc9))['catch'](handleError(_0x1135ed,null));};exports[_0x6ba2('0x1b')]=function(_0x463b89,_0x227fac){if(_0x463b89[_0x6ba2('0x3b')]['id']){delete _0x463b89[_0x6ba2('0x3b')]['id'];}return db[_0x6ba2('0x23')][_0x6ba2('0x38')]({'where':{'id':_0x463b89[_0x6ba2('0x2b')]['id']}})[_0x6ba2('0x1c')](handleEntityNotFound(_0x227fac,null))[_0x6ba2('0x1c')](saveUpdates(_0x463b89[_0x6ba2('0x3b')],null))[_0x6ba2('0x1c')](respondWithResult(_0x227fac,null))[_0x6ba2('0x39')](handleError(_0x227fac,null));};exports[_0x6ba2('0x3c')]=function(_0x4fbc6b,_0x43ef6b){return db['OpenchannelInteraction'][_0x6ba2('0x38')]({'where':{'id':_0x4fbc6b[_0x6ba2('0x2b')]['id']}})[_0x6ba2('0x1c')](handleEntityNotFound(_0x43ef6b,null))[_0x6ba2('0x1c')](removeEntity(_0x43ef6b,null))[_0x6ba2('0x39')](handleError(_0x43ef6b,null));};exports['describe']=function(_0x347e3d,_0x162edc){return db['OpenchannelInteraction'][_0x6ba2('0x3d')]()[_0x6ba2('0x1c')](respondWithResult(_0x162edc,null))[_0x6ba2('0x39')](handleError(_0x162edc,null));};exports['addMessage']=function(_0x517315,_0x9be580){return db['OpenchannelMessage'][_0x6ba2('0x38')]({'where':{'id':_0x517315[_0x6ba2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x9be580,null))[_0x6ba2('0x1c')](function(_0x282ce6){if(_0x282ce6){return _0x282ce6[_0x6ba2('0x3e')](_0x517315['body'][_0x6ba2('0x3f')],_[_0x6ba2('0x40')](_0x517315['body'],[_0x6ba2('0x3f'),'id'])||{});}})[_0x6ba2('0x1c')](respondWithResult(_0x9be580,null))[_0x6ba2('0x39')](handleError(_0x9be580,null));};exports[_0x6ba2('0x41')]=function(_0x548d9c,_0x1a517b){var _0x432e56={'raw':![],'where':{}};var _0xa35036={};var _0x5ac735={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x6ba2('0x42')]({'where':{'id':_0x548d9c[_0x6ba2('0x2b')]['id']}})[_0x6ba2('0x1c')](handleEntityNotFound(_0x1a517b,null))['then'](function(_0x5bea29){if(_0x5bea29){_0xa35036[_0x6ba2('0x2f')]=_[_0x6ba2('0x2c')](db[_0x6ba2('0x43')]['rawAttributes']);_0xa35036['query']=_['keys'](_0x548d9c[_0x6ba2('0x28')]);_0xa35036[_0x6ba2('0x2e')]=_['intersection'](_0xa35036[_0x6ba2('0x2f')],_0xa35036[_0x6ba2('0x28')]);_0x432e56[_0x6ba2('0x30')]=_[_0x6ba2('0x31')](_0xa35036['model'],qs[_0x6ba2('0x32')](_0x548d9c['query']['fields']));_0x432e56['attributes']=_0x432e56[_0x6ba2('0x30')][_0x6ba2('0x33')]?_0x432e56['attributes']:_0xa35036[_0x6ba2('0x2f')];if(!_0x548d9c[_0x6ba2('0x28')]['hasOwnProperty'](_0x6ba2('0x44'))){_0x432e56[_0x6ba2('0x15')]=qs[_0x6ba2('0x15')](_0x548d9c[_0x6ba2('0x28')][_0x6ba2('0x15')]);_0x432e56[_0x6ba2('0x14')]=qs['offset'](_0x548d9c[_0x6ba2('0x28')][_0x6ba2('0x14')]);}_0x432e56[_0x6ba2('0x45')]=qs[_0x6ba2('0x46')](_0x548d9c[_0x6ba2('0x28')][_0x6ba2('0x46')]);_0x432e56[_0x6ba2('0x47')]=qs[_0x6ba2('0x2e')](_[_0x6ba2('0x48')](_0x548d9c[_0x6ba2('0x28')],_0xa35036[_0x6ba2('0x2e')]));_0x432e56[_0x6ba2('0x47')][_0x6ba2('0x49')]=_0x5bea29['id'];if(_0x548d9c['query'][_0x6ba2('0x4a')]){_0x432e56[_0x6ba2('0x47')]=_[_0x6ba2('0x36')](_0x432e56[_0x6ba2('0x47')],{'$or':_[_0x6ba2('0x22')](_0x432e56[_0x6ba2('0x30')],function(_0x375f07){var _0x3f6f32={};_0x3f6f32[_0x375f07]={'$like':'%'+_0x548d9c['query'][_0x6ba2('0x4a')]+'%'};return _0x3f6f32;})});}if(_0x548d9c['query']['$gte']){var _0x120a76=_0x548d9c['query'][_0x6ba2('0x4b')]['split'](',');var _0x5d203f={};_0x5d203f[_0x120a76[0x0]]={'$gte':moment(_0x120a76[0x1])[_0x6ba2('0x4c')](_0x6ba2('0x4d'))};_0x432e56[_0x6ba2('0x47')]=_['merge'](_0x432e56[_0x6ba2('0x47')],_0x5d203f);}_0x432e56=_[_0x6ba2('0x36')]({},_0x432e56,_0x548d9c[_0x6ba2('0x37')]);return db['OpenchannelMessage'][_0x6ba2('0x17')]({'where':_0x432e56[_0x6ba2('0x47')]})[_0x6ba2('0x1c')](function(_0x533213){_0x5ac735[_0x6ba2('0x17')]=_0x533213;if(_0x548d9c[_0x6ba2('0x28')][_0x6ba2('0x34')]){_0x432e56['include']=[{'all':!![]}];}return db[_0x6ba2('0x43')]['findAll'](_0x432e56);})[_0x6ba2('0x1c')](function(_0x4cd35a){_0x5ac735[_0x6ba2('0x4e')]=_0x4cd35a;return _0x5ac735;});}})[_0x6ba2('0x1c')](respondWithFilteredResult(_0x1a517b,_0x432e56))['catch'](handleError(_0x1a517b,null));};exports[_0x6ba2('0x4f')]=function(_0x20a09b,_0x3bfffb){return db[_0x6ba2('0x23')][_0x6ba2('0x38')]({'where':{'id':_0x20a09b[_0x6ba2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3bfffb,null))['then'](function(_0x4ac50d){if(_0x4ac50d){return _0x4ac50d['setTags'](_0x20a09b['body'][_0x6ba2('0x3f')],_[_0x6ba2('0x40')](_0x20a09b[_0x6ba2('0x3b')],['ids','id'])||{})[_0x6ba2('0x50')](function(){return db[_0x6ba2('0x51')][_0x6ba2('0x26')]({'attributes':['id',_0x6ba2('0x1f'),_0x6ba2('0x52')],'where':{'id':_0x20a09b[_0x6ba2('0x3b')]['ids']}});})['then'](function(_0x972224){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x20a09b[_0x6ba2('0x2b')]['id']),'tags':_0x972224||[]});return{'id':Number(_0x20a09b['params']['id']),'tags':_0x972224||[]};});}})[_0x6ba2('0x1c')](respondWithResult(_0x3bfffb,null))[_0x6ba2('0x39')](handleError(_0x3bfffb,null));};exports[_0x6ba2('0x53')]=function(_0x11ab64,_0x13ca26){return db['OpenchannelInteraction'][_0x6ba2('0x38')]({'where':{'id':_0x11ab64[_0x6ba2('0x2b')]['id']}})[_0x6ba2('0x1c')](handleEntityNotFound(_0x13ca26,null))[_0x6ba2('0x1c')](function(_0xcd17c){if(_0xcd17c){return _0xcd17c[_0x6ba2('0x53')](_0x11ab64['query']['ids']);}})['then'](respondWithStatusCode(_0x13ca26,null))[_0x6ba2('0x39')](handleError(_0x13ca26,null));};exports['download']=function(_0x21ee3a,_0x31fda0){var _0x233b2c=moment()[_0x6ba2('0x54')]()[_0x6ba2('0x55')]();var _0x32174b=path[_0x6ba2('0x56')](config[_0x6ba2('0x57')],'server','files','tmp');var _0x77b057=path[_0x6ba2('0x56')](config[_0x6ba2('0x57')],_0x6ba2('0x58'),'files',_0x6ba2('0x59'));var _0x458891=path['join'](_0x32174b,_0x233b2c);var _0x17de62=util[_0x6ba2('0x4c')]('transcript-%d-%s.zip',_0x21ee3a[_0x6ba2('0x2b')]['id'],_0x233b2c);var _0x4d66ee=path[_0x6ba2('0x56')](_0x32174b,_0x17de62);var _0x23ffa8=[];_0x23ffa8[_0x6ba2('0x5a')]({'model':db[_0x6ba2('0x5b')],'as':_0x6ba2('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x23ffa8[_0x6ba2('0x5a')]({'model':db['CmContact'],'as':_0x6ba2('0x5c'),'attributes':['id',_0x6ba2('0x5d'),_0x6ba2('0x5e')],'raw':!![]});if(_0x21ee3a[_0x6ba2('0x28')][_0x6ba2('0x59')]){_0x23ffa8[_0x6ba2('0x5a')]({'model':db[_0x6ba2('0x5f')],'as':_0x6ba2('0x5f'),'raw':!![]});}var _0x4ac696=[{'model':db[_0x6ba2('0x43')],'as':_0x6ba2('0x60'),'attributes':['id',_0x6ba2('0x3b'),_0x6ba2('0x61'),'direction','secret','read'],'include':_0x23ffa8}];_0x4ac696['push']({'model':db[_0x6ba2('0x62')],'as':_0x6ba2('0x63'),'attributes':['id','name']});_0x4ac696[_0x6ba2('0x5a')]({'model':db[_0x6ba2('0x5b')],'as':'Owner','attributes':['id',_0x6ba2('0x64')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x21ee3a[_0x6ba2('0x2b')]['id']},'include':_0x4ac696})[_0x6ba2('0x1c')](handleEntityNotFound(_0x31fda0,null))[_0x6ba2('0x1c')](function(_0xbbca4c){if(_0xbbca4c){var _0x2c4418=_0xbbca4c[_0x6ba2('0x65')]({'plain':!![]});fs[_0x6ba2('0x66')](_0x458891);var _0x151e62={'channel':_0x6ba2('0x67'),'account':_0x2c4418[_0x6ba2('0x63')][_0x6ba2('0x1f')],'agent':_0x2c4418[_0x6ba2('0x68')]?_0x2c4418[_0x6ba2('0x68')][_0x6ba2('0x64')]:'N.A.','createdAt':moment(_0x2c4418['createdAt'])[_0x6ba2('0x4c')](_0x6ba2('0x4d'))[_0x6ba2('0x55')](),'closedAt':_0x2c4418[_0x6ba2('0x69')]?moment(_0x2c4418[_0x6ba2('0x6a')])[_0x6ba2('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x2c4418[_0x6ba2('0x6b')],'visibility':_0x2c4418[_0x6ba2('0x6c')]?_0x6ba2('0x6d'):_0x6ba2('0x6e'),'messages':_(_0x2c4418[_0x6ba2('0x60')])[_0x6ba2('0x4a')]({'secret':![]})['map'](function(_0x2f11b2){if(_0x2f11b2[_0x6ba2('0x5f')]){var _0x28834c=path[_0x6ba2('0x56')](_0x77b057,_0x2f11b2['Attachment'][_0x6ba2('0x6f')]);if(fs[_0x6ba2('0x70')](_0x28834c)){fs[_0x6ba2('0x71')](_0x28834c)[_0x6ba2('0x72')](fs[_0x6ba2('0x73')](path[_0x6ba2('0x56')](_0x458891,_0x2f11b2[_0x6ba2('0x5f')][_0x6ba2('0x6f')])));}}return{'date':moment(_0x2f11b2['createdAt'])[_0x6ba2('0x4c')](_0x6ba2('0x4d'))['toString'](),'sender':_0x2f11b2[_0x6ba2('0x74')]===_0x6ba2('0x75')?_0x2f11b2[_0x6ba2('0x5b')]?_0x2f11b2[_0x6ba2('0x5b')][_0x6ba2('0x64')]:_0x6ba2('0x76'):_0x2f11b2[_0x6ba2('0x5c')][_0x6ba2('0x5d')]+(_0x2f11b2[_0x6ba2('0x5c')][_0x6ba2('0x5e')]?'\x20'+_0x2f11b2[_0x6ba2('0x5c')][_0x6ba2('0x5e')]:''),'body':_0x2f11b2['Attachment']?_0x2f11b2[_0x6ba2('0x5f')][_0x6ba2('0x6f')]:_0x2f11b2['body'],'direction':_0x2f11b2[_0x6ba2('0x74')]===_0x6ba2('0x75')?'A':'C','secret':_0x2f11b2[_0x6ba2('0x77')],'read':_0x2f11b2[_0x6ba2('0x78')],'attachment':_0x2f11b2['Attachment']};})[_0x6ba2('0x79')]()};return ejs[_0x6ba2('0x7a')](path[_0x6ba2('0x56')](config[_0x6ba2('0x57')],_0x6ba2('0x58'),_0x6ba2('0x7b'),_0x6ba2('0x7c')),{'interaction':_0x151e62})[_0x6ba2('0x1c')](function(_0x14aeb7){var _0x3b425a=path['join'](_0x458891,_0x6ba2('0x7d')+_0x2c4418['id']+'-'+_0x233b2c+'.pdf');var _0x4fb4b5={'path':_0x3b425a,'channel':'Openchannel','interactionId':_0x2c4418['id']};return pdf[_0x6ba2('0x7e')](_0x14aeb7,_0x4fb4b5);})['then'](function(){return new Promise(function(_0xb8870f,_0x36074b){zipdir(_0x458891,{'saveTo':_0x4d66ee},function(_0x444b83,_0x376930){if(_0x444b83)return _0x36074b(_0x444b83);return _0xb8870f(_0x376930);});})[_0x6ba2('0x1c')](function(){return new Promise(function(_0x2fcbbc,_0x4b8f17){rimraf(_0x458891,function(_0x169a70){if(_0x169a70)_0x4b8f17(_0x169a70);return _0x2fcbbc();});});})[_0x6ba2('0x1c')](function(){return _0x31fda0[_0x6ba2('0x7f')](_0x4d66ee,_0x17de62,function(_0xa21248){if(_0xa21248){logger['error'](_0x6ba2('0x80'),_0xa21248);}else{fs['unlinkSync'](_0x4d66ee);}});});});}else{return _0x31fda0[_0x6ba2('0x11')](0xc8);}})['catch'](handleError(_0x31fda0,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 9b469b7..37e5239 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 _0xa318=['OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4bd18c,_0xb4a6b6){var _0x16ab64=function(_0x107bf5){while(--_0x107bf5){_0x4bd18c['push'](_0x4bd18c['shift']());}};_0x16ab64(++_0xb4a6b6);}(_0xa318,0x1d9));var _0x8a31=function(_0x1ea430,_0x3f47ea){_0x1ea430=_0x1ea430-0x0;var _0x4c147c=_0xa318[_0x1ea430];return _0x4c147c;};'use strict';var EventEmitter=require(_0x8a31('0x0'));var OpenchannelInteraction=require(_0x8a31('0x1'))['db'][_0x8a31('0x2')];var OpenchannelMessage=require(_0x8a31('0x1'))['db'][_0x8a31('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8a31('0x4')](0x0);var events={'afterCreate':_0x8a31('0x5'),'afterUpdate':_0x8a31('0x6'),'afterDestroy':_0x8a31('0x7')};function emitEvent(_0x37dc26){return function(_0x62394,_0xf05084,_0x4045ae){_0x62394[_0x8a31('0x8')]({'attributes':['id'],'raw':!![]})[_0x8a31('0x9')](function(_0x27d9de){_0x62394[_0x8a31('0xa')](_0x8a31('0xb'),_0x27d9de['map'](function(_0x38d1cb){return{'id':_0x38d1cb['id']};}));return OpenchannelMessage[_0x8a31('0xc')]({'where':{'OpenchannelInteractionId':_0x62394['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8a31('0x9')](function(_0x417461){_0x62394[_0x8a31('0xa')](_0x8a31('0xd'),_0x417461['length']);OpenchannelInteractionEvents[_0x8a31('0xe')](_0x37dc26+':'+_0x62394['id'],_0x62394);OpenchannelInteractionEvents[_0x8a31('0xe')](_0x37dc26,_0x62394);_0x4045ae(null);})[_0x8a31('0xf')](_0x4045ae(null));};}for(var e in events){if(events[_0x8a31('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x8a31('0x11')](e,emitEvent(event));}}module[_0x8a31('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc463=['findAll','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','remove','getUsers','then','setDataValue','Users','map'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xc463,0xba));var _0x3c46=function(_0x4e5e92,_0x4e657e){_0x4e5e92=_0x4e5e92-0x0;var _0x486c68=_0xc463[_0x4e5e92];return _0x486c68;};'use strict';var EventEmitter=require(_0x3c46('0x0'));var OpenchannelInteraction=require(_0x3c46('0x1'))['db'][_0x3c46('0x2')];var OpenchannelMessage=require(_0x3c46('0x1'))['db'][_0x3c46('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3c46('0x4'),'afterUpdate':_0x3c46('0x5'),'afterDestroy':_0x3c46('0x6')};function emitEvent(_0xad1fc8){return function(_0x566789,_0x58dd61,_0x267046){_0x566789[_0x3c46('0x7')]({'attributes':['id'],'raw':!![]})[_0x3c46('0x8')](function(_0x334ac8){_0x566789[_0x3c46('0x9')](_0x3c46('0xa'),_0x334ac8[_0x3c46('0xb')](function(_0x5f3886){return{'id':_0x5f3886['id']};}));return OpenchannelMessage[_0x3c46('0xc')]({'where':{'OpenchannelInteractionId':_0x566789['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3c46('0x8')](function(_0x934d2f){_0x566789[_0x3c46('0x9')]('unreadMessages',_0x934d2f['length']);OpenchannelInteractionEvents['emit'](_0xad1fc8+':'+_0x566789['id'],_0x566789);OpenchannelInteractionEvents[_0x3c46('0xd')](_0xad1fc8,_0x566789);_0x267046(null);})[_0x3c46('0xe')](_0x267046(null));};}for(var e in events){if(events[_0x3c46('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x3c46('0x10')](e,emitEvent(event));}}module[_0x3c46('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 21c38c6..fdb679f 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 _0xbbe2=['utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','utf8mb4'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbbe2,0x116));var _0x2bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2bbe('0x0'));var util=require(_0x2bbe('0x1'));var logger=require(_0x2bbe('0x2'))('api');var moment=require(_0x2bbe('0x3'));var BPromise=require('bluebird');var rp=require(_0x2bbe('0x4'));var fs=require('fs');var path=require(_0x2bbe('0x5'));var rimraf=require('rimraf');var config=require(_0x2bbe('0x6'));var attributes=require(_0x2bbe('0x7'));module[_0x2bbe('0x8')]=function(_0x8d81a7,_0x457109){return _0x8d81a7['define']('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2bbe('0x9'),'collate':_0x2bbe('0xa'),'hooks':{'beforeUpdate':function(_0x44151d,_0x11a488,_0x3cc4d0){if(_0x44151d[_0x2bbe('0xb')](_0x2bbe('0xc'))){_0x44151d[_0x2bbe('0xd')]=moment()[_0x2bbe('0xe')](_0x2bbe('0xf'));}_0x3cc4d0(null,_0x44151d);}}});}; \ No newline at end of file +var _0x8f61=['./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xcd5721,_0x112284){var _0x46e84a=function(_0x1b82ac){while(--_0x1b82ac){_0xcd5721['push'](_0xcd5721['shift']());}};_0x46e84a(++_0x112284);}(_0x8f61,0x13b));var _0x18f6=function(_0x194058,_0x5c6092){_0x194058=_0x194058-0x0;var _0x2c76a1=_0x8f61[_0x194058];return _0x2c76a1;};'use strict';var _=require('lodash');var util=require(_0x18f6('0x0'));var logger=require(_0x18f6('0x1'))(_0x18f6('0x2'));var moment=require(_0x18f6('0x3'));var BPromise=require(_0x18f6('0x4'));var rp=require(_0x18f6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18f6('0x6'));var config=require(_0x18f6('0x7'));var attributes=require(_0x18f6('0x8'));module[_0x18f6('0x9')]=function(_0x4f838c,_0x3c14d3){return _0x4f838c[_0x18f6('0xa')](_0x18f6('0xb'),attributes,{'tableName':_0x18f6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x18f6('0xd'),'collate':_0x18f6('0xe'),'hooks':{'beforeUpdate':function(_0x2e92ac,_0x54b78f,_0x5d3bff){if(_0x2e92ac[_0x18f6('0xf')]('closed')){_0x2e92ac[_0x18f6('0x10')]=moment()[_0x18f6('0x11')](_0x18f6('0x12'));}_0x5d3bff(null,_0x2e92ac);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 44ce3bb..7288da5 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 _0x1731=['redis','defaults','localhost','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','AddTags','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','client'];(function(_0x15ca40,_0x3fed78){var _0x5be3f1=function(_0x1e58d4){while(--_0x1e58d4){_0x15ca40['push'](_0x15ca40['shift']());}};_0x5be3f1(++_0x3fed78);}(_0x1731,0x109));var _0x1173=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1731[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1173('0x0'));var util=require(_0x1173('0x1'));var moment=require(_0x1173('0x2'));var BPromise=require(_0x1173('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1173('0x4'));var logger=require('../../config/logger')(_0x1173('0x5'));var config=require(_0x1173('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1173('0x7')]['http']({'port':0x232a});config[_0x1173('0x8')]=_[_0x1173('0x9')](config[_0x1173('0x8')],{'host':_0x1173('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1173('0x8')]));require(_0x1173('0xb'))['register'](socket);function respondWithRpcPromise(_0x8db470,_0x102282,_0x51bbf2){return new BPromise(function(_0x99a9cf,_0x372dbd){return client[_0x1173('0xc')](_0x8db470,_0x51bbf2)[_0x1173('0xd')](function(_0x5cc93c){logger[_0x1173('0xe')](_0x1173('0xf'),_0x102282,_0x1173('0x10'));logger[_0x1173('0x11')](_0x1173('0x12'),_0x102282,_0x1173('0x10'),JSON[_0x1173('0x13')](_0x5cc93c));if(_0x5cc93c[_0x1173('0x14')]){if(_0x5cc93c['error'][_0x1173('0x15')]===0x1f4){logger[_0x1173('0x14')](_0x1173('0xf'),_0x102282,_0x5cc93c[_0x1173('0x14')][_0x1173('0x16')]);return _0x372dbd(_0x5cc93c[_0x1173('0x14')]['message']);}logger[_0x1173('0x14')](_0x1173('0xf'),_0x102282,_0x5cc93c['error'][_0x1173('0x16')]);return _0x99a9cf(_0x5cc93c[_0x1173('0x14')]['message']);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x102282,_0x1173('0x10'));_0x99a9cf(_0x5cc93c[_0x1173('0x17')][_0x1173('0x16')]);}})['catch'](function(_0x12689b){logger['error'](_0x1173('0xf'),_0x102282,_0x12689b);_0x372dbd(_0x12689b);});});}exports['UpdateOpenchannelInteraction']=function(_0x21a939){var _0x2a9d2f=this;return new Promise(function(_0x455b3e,_0x364898){return db[_0x1173('0x18')][_0x1173('0x19')](_0x21a939[_0x1173('0x1a')],{'raw':_0x21a939[_0x1173('0x1b')]?_0x21a939[_0x1173('0x1b')][_0x1173('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21a939[_0x1173('0x1b')]?_0x21a939[_0x1173('0x1b')][_0x1173('0x1d')]||null:null,'attributes':_0x21a939[_0x1173('0x1b')]?_0x21a939['options'][_0x1173('0x1e')]||null:null,'limit':_0x21a939[_0x1173('0x1b')]?_0x21a939[_0x1173('0x1b')][_0x1173('0x1f')]||null:null})[_0x1173('0xd')](function(_0x510ed0){logger[_0x1173('0xe')](_0x1173('0x20'),_0x21a939);logger[_0x1173('0x11')](_0x1173('0x20'),_0x21a939,JSON['stringify'](_0x510ed0));_0x455b3e(_0x510ed0);})[_0x1173('0x21')](function(_0x4dac76){logger[_0x1173('0x14')](_0x1173('0x20'),_0x4dac76[_0x1173('0x16')],_0x21a939);_0x364898(_0x2a9d2f[_0x1173('0x14')](0x1f4,_0x4dac76[_0x1173('0x16')]));});});};exports[_0x1173('0x22')]=function(_0x562263){return new Promise(function(_0x45c436,_0x466de5){return db[_0x1173('0x18')][_0x1173('0x23')]({'where':_0x562263[_0x1173('0x1b')]?_0x562263[_0x1173('0x1b')][_0x1173('0x1d')]||null:null})[_0x1173('0xd')](function(_0x2b1a19){if(_0x2b1a19){return _0x2b1a19[_0x1173('0x24')](_0x562263['body'][_0x1173('0x25')],_['omit'](_0x562263[_0x1173('0x1a')],[_0x1173('0x25'),'id'])||{});}})['spread'](function(_0x196d43){logger[_0x1173('0xe')](_0x1173('0x26'),_0x562263);logger[_0x1173('0x11')](_0x1173('0x26'),_0x562263,JSON['stringify'](_0x196d43));_0x45c436(_0x196d43);})[_0x1173('0x21')](function(_0x3f7854){logger[_0x1173('0x14')](_0x1173('0x26'),_0x3f7854['message'],_0x562263);_0x466de5(_this['error'](0x1f4,_0x3f7854[_0x1173('0x16')]));});});}; \ No newline at end of file +var _0x18fa=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','find','addTags','omit','ids','spread','AddTags','lodash','util'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x18fa,0x9a));var _0xa18f=function(_0x1e2ffc,_0x4b608e){_0x1e2ffc=_0x1e2ffc-0x0;var _0x327df6=_0x18fa[_0x1e2ffc];return _0x327df6;};'use strict';var _=require(_0xa18f('0x0'));var util=require(_0xa18f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa18f('0x2'));var fs=require('fs');var Redis=require(_0xa18f('0x3'));var db=require(_0xa18f('0x4'))['db'];var utils=require(_0xa18f('0x5'));var logger=require(_0xa18f('0x6'))('rpc');var config=require(_0xa18f('0x7'));var jayson=require(_0xa18f('0x8'));var client=jayson[_0xa18f('0x9')][_0xa18f('0xa')]({'port':0x232a});config['redis']=_[_0xa18f('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa18f('0xc'))(new Redis(config['redis']));require(_0xa18f('0xd'))[_0xa18f('0xe')](socket);function respondWithRpcPromise(_0x4f14d0,_0x4c6083,_0x2e550a){return new BPromise(function(_0x3f74bd,_0x56f10a){return client[_0xa18f('0xf')](_0x4f14d0,_0x2e550a)[_0xa18f('0x10')](function(_0x37776c){logger[_0xa18f('0x11')](_0xa18f('0x12'),_0x4c6083,'request\x20sent');logger[_0xa18f('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x4c6083,'request\x20sent',JSON[_0xa18f('0x14')](_0x37776c));if(_0x37776c[_0xa18f('0x15')]){if(_0x37776c[_0xa18f('0x15')][_0xa18f('0x16')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4c6083,_0x37776c[_0xa18f('0x15')][_0xa18f('0x17')]);return _0x56f10a(_0x37776c[_0xa18f('0x15')][_0xa18f('0x17')]);}logger[_0xa18f('0x15')](_0xa18f('0x12'),_0x4c6083,_0x37776c['error'][_0xa18f('0x17')]);return _0x3f74bd(_0x37776c['error'][_0xa18f('0x17')]);}else{logger[_0xa18f('0x11')](_0xa18f('0x12'),_0x4c6083,_0xa18f('0x18'));_0x3f74bd(_0x37776c['result']['message']);}})[_0xa18f('0x19')](function(_0x50184e){logger[_0xa18f('0x15')](_0xa18f('0x12'),_0x4c6083,_0x50184e);_0x56f10a(_0x50184e);});});}exports[_0xa18f('0x1a')]=function(_0x23d18a){var _0x22689b=this;return new Promise(function(_0x52b7e6,_0x45c22b){return db[_0xa18f('0x1b')]['update'](_0x23d18a[_0xa18f('0x1c')],{'raw':_0x23d18a[_0xa18f('0x1d')]?_0x23d18a[_0xa18f('0x1d')][_0xa18f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23d18a[_0xa18f('0x1d')]?_0x23d18a[_0xa18f('0x1d')][_0xa18f('0x1f')]||null:null,'attributes':_0x23d18a['options']?_0x23d18a['options'][_0xa18f('0x20')]||null:null,'limit':_0x23d18a[_0xa18f('0x1d')]?_0x23d18a['options']['limit']||null:null})['then'](function(_0x260900){logger[_0xa18f('0x11')](_0xa18f('0x1a'),_0x23d18a);logger[_0xa18f('0x13')](_0xa18f('0x1a'),_0x23d18a,JSON['stringify'](_0x260900));_0x52b7e6(_0x260900);})[_0xa18f('0x19')](function(_0x2668be){logger[_0xa18f('0x15')](_0xa18f('0x1a'),_0x2668be[_0xa18f('0x17')],_0x23d18a);_0x45c22b(_0x22689b[_0xa18f('0x15')](0x1f4,_0x2668be[_0xa18f('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x4c480b){return new Promise(function(_0x39d9f0,_0x597e03){return db[_0xa18f('0x1b')][_0xa18f('0x21')]({'where':_0x4c480b['options']?_0x4c480b['options'][_0xa18f('0x1f')]||null:null})[_0xa18f('0x10')](function(_0x2b786b){if(_0x2b786b){return _0x2b786b[_0xa18f('0x22')](_0x4c480b[_0xa18f('0x1c')]['ids'],_[_0xa18f('0x23')](_0x4c480b[_0xa18f('0x1c')],[_0xa18f('0x24'),'id'])||{});}})[_0xa18f('0x25')](function(_0x4bcec1){logger['info'](_0xa18f('0x26'),_0x4c480b);logger[_0xa18f('0x13')](_0xa18f('0x26'),_0x4c480b,JSON[_0xa18f('0x14')](_0x4bcec1));_0x39d9f0(_0x4bcec1);})[_0xa18f('0x19')](function(_0x593ece){logger[_0xa18f('0x15')](_0xa18f('0x26'),_0x593ece[_0xa18f('0x17')],_0x4c480b);_0x597e03(_this[_0xa18f('0x15')](0x1f4,_0x593ece[_0xa18f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 98cb40d..f0da7af 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 _0xd5ae=['remove','register','openchannelInteraction:','save'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xd5ae,0x1a7));var _0xed5a=function(_0x15f95b,_0x37abf0){_0x15f95b=_0x15f95b-0x0;var _0x312806=_0xd5ae[_0x15f95b];return _0x312806;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xed5a('0x0'),_0xed5a('0x1'),'update'];function createListener(_0x164bc1,_0x3a8abc){return function(_0x3faf66){_0x3a8abc['emit'](_0x164bc1,_0x3faf66);};}function removeListener(_0x13ef65,_0x163517){return function(){OpenchannelInteractionEvents['removeListener'](_0x13ef65,_0x163517);};}exports[_0xed5a('0x2')]=function(_0x3832f4){for(var _0x473a9e=0x0,_0x444aa4=events['length'];_0x473a9e<_0x444aa4;_0x473a9e++){var _0x5b8ac0=events[_0x473a9e];var _0x7e68ed=createListener(_0xed5a('0x3')+_0x5b8ac0,_0x3832f4);OpenchannelInteractionEvents['on'](_0x5b8ac0,_0x7e68ed);}}; \ No newline at end of file +var _0x2375=['length','./openchannelInteraction.events','save','update','emit','register'];(function(_0x50117e,_0x236f8c){var _0x57990d=function(_0x57a0bd){while(--_0x57a0bd){_0x50117e['push'](_0x50117e['shift']());}};_0x57990d(++_0x236f8c);}(_0x2375,0xb5));var _0x5237=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x2375[_0x432fca];return _0x3adba4;};'use strict';var OpenchannelInteractionEvents=require(_0x5237('0x0'));var events=[_0x5237('0x1'),'remove',_0x5237('0x2')];function createListener(_0x388610,_0x220136){return function(_0x4b540a){_0x220136[_0x5237('0x3')](_0x388610,_0x4b540a);};}function removeListener(_0x76c5fb,_0x581bd2){return function(){OpenchannelInteractionEvents['removeListener'](_0x76c5fb,_0x581bd2);};}exports[_0x5237('0x4')]=function(_0x5ae3d1){for(var _0x20ad4a=0x0,_0x5e7cc1=events[_0x5237('0x5')];_0x20ad4a<_0x5e7cc1;_0x20ad4a++){var _0x4faf02=events[_0x20ad4a];var _0x503a56=createListener('openchannelInteraction:'+_0x4faf02,_0x5ae3d1);OpenchannelInteractionEvents['on'](_0x4faf02,_0x503a56);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index d335033..c63e85b 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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x5b8320,_0x2ab5e5){var _0x5239ff=function(_0x4a26bf){while(--_0x4a26bf){_0x5b8320['push'](_0x5b8320['shift']());}};_0x5239ff(++_0x2ab5e5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x13594e,_0x6f0ed0){_0x13594e=_0x13594e-0x0;var _0x1a4f42=_0xcb91[_0x13594e];return _0x1a4f42;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x3b0da2,_0x306d66){var _0x45a240=function(_0x557598){while(--_0x557598){_0x3b0da2['push'](_0x3b0da2['shift']());}};_0x45a240(++_0x306d66);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0xcb91[_0x5d8631];return _0x34c15e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 9fc62c4..f844afa 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 _0x0cfa=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x5d2be4,_0x16c38a){var _0x1b6cfc=function(_0x51242e){while(--_0x51242e){_0x5d2be4['push'](_0x5d2be4['shift']());}};_0x1b6cfc(++_0x16c38a);}(_0x0cfa,0x73));var _0xa0cf=function(_0x5070d8,_0x3210d5){_0x5070d8=_0x5070d8-0x0;var _0x67083d=_0x0cfa[_0x5070d8];return _0x67083d;};'use strict';var Sequelize=require(_0xa0cf('0x0'));module[_0xa0cf('0x1')]={'body':{'type':Sequelize[_0xa0cf('0x2')](_0xa0cf('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa0cf('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa0cf('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa0cf('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xa0cf('0x6')]},'providerName':{'type':Sequelize[_0xa0cf('0x7')]},'providerResponse':{'type':Sequelize[_0xa0cf('0x2')]}}; \ No newline at end of file +var _0x97c1=['exports','medium','ENUM','out','DATE','STRING','sequelize'];(function(_0xa3d178,_0x5a7e2d){var _0x23a994=function(_0x8e60ea){while(--_0x8e60ea){_0xa3d178['push'](_0xa3d178['shift']());}};_0x23a994(++_0x5a7e2d);}(_0x97c1,0xdf));var _0x197c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x97c1[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x197c('0x0'));module[_0x197c('0x1')]={'body':{'type':Sequelize['TEXT'](_0x197c('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x197c('0x3')]('in',_0x197c('0x4')),'defaultValue':_0x197c('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x197c('0x5')]},'providerName':{'type':Sequelize[_0x197c('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 103978d..0c0a7c4 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 _0x236e=['name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','rows','show','params','includeAll','find','create','body','describe','openchannel-interactions','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','isNil','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT','internal','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','jayson/promise','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','destroy'];(function(_0x3b9a94,_0x250931){var _0x15b0d5=function(_0xfec900){while(--_0xfec900){_0x3b9a94['push'](_0x3b9a94['shift']());}};_0x15b0d5(++_0x250931);}(_0x236e,0x148));var _0xe236=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x236e[_0x2f1762];return _0x8ab21;};'use strict';var emlformat=require(_0xe236('0x0'));var rimraf=require(_0xe236('0x1'));var zipdir=require(_0xe236('0x2'));var jsonpatch=require(_0xe236('0x3'));var rp=require('request-promise');var moment=require(_0xe236('0x4'));var BPromise=require(_0xe236('0x5'));var Mustache=require('mustache');var util=require(_0xe236('0x6'));var path=require(_0xe236('0x7'));var sox=require(_0xe236('0x8'));var csv=require(_0xe236('0x9'));var ejs=require(_0xe236('0xa'));var fs=require('fs');var fs_extra=require(_0xe236('0xb'));var _=require(_0xe236('0xc'));var squel=require(_0xe236('0xd'));var crypto=require(_0xe236('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe236('0xf'));var toCsv=require(_0xe236('0x9'));var querystring=require('querystring');var Papa=require(_0xe236('0x10'));var Redis=require(_0xe236('0x11'));var authService=require(_0xe236('0x12'));var qs=require(_0xe236('0x13'));var as=require(_0xe236('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe236('0x15'))(_0xe236('0x16'));var utils=require(_0xe236('0x17'));var config=require(_0xe236('0x18'));var licenseUtil=require(_0xe236('0x19'));var db=require(_0xe236('0x1a'))['db'];config[_0xe236('0x1b')]=_[_0xe236('0x1c')](config[_0xe236('0x1b')],{'host':_0xe236('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe236('0x1b')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0xe236('0x1e'));var client=jayson[_0xe236('0x1f')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26bce0,_0x458049,_0x40dcdf,_0x16cae9){return new BPromise(function(_0x5c480a,_0x5562cf){var _0x50c035=_0x16cae9||client;return _0x50c035[_0xe236('0x20')](_0x26bce0,_0x40dcdf)[_0xe236('0x21')](function(_0x5e7045){logger[_0xe236('0x22')](_0xe236('0x23'),_0x458049,'request\x20sent');logger['debug'](_0xe236('0x24'),_0x458049,_0xe236('0x25'),JSON['stringify'](_0x5e7045));if(_0x5e7045[_0xe236('0x26')]){if(_0x5e7045['error'][_0xe236('0x27')]===0x1f4){logger[_0xe236('0x26')](_0xe236('0x23'),_0x458049,_0x5e7045[_0xe236('0x26')][_0xe236('0x28')]);return _0x5562cf(_0x5e7045[_0xe236('0x26')][_0xe236('0x28')]);}logger[_0xe236('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x458049,_0x5e7045['error'][_0xe236('0x28')]);return _0x5c480a(_0x5e7045[_0xe236('0x26')]['message']);}else{logger['info'](_0xe236('0x23'),_0x458049,_0xe236('0x25'));_0x5c480a(_0x5e7045['result']['message']);}})[_0xe236('0x29')](function(_0x5a5683){logger[_0xe236('0x26')](_0xe236('0x23'),_0x458049,_0x5a5683);_0x5562cf(_0x5a5683);});});}function respondWithStatusCode(_0x5f50db,_0x46296a){_0x46296a=_0x46296a||0xcc;return function(_0x547e6c){if(_0x547e6c){return _0x5f50db[_0xe236('0x2a')](_0x46296a);}return _0x5f50db[_0xe236('0x2b')](_0x46296a)[_0xe236('0x2c')]();};}function respondWithResult(_0x4cc5fd,_0x3fe05a){_0x3fe05a=_0x3fe05a||0xc8;return function(_0x327c07){if(_0x327c07){return _0x4cc5fd['status'](_0x3fe05a)[_0xe236('0x2d')](_0x327c07);}};}function respondWithFilteredResult(_0x537fff,_0x20d15b){return function(_0x542666){if(_0x542666){var _0x1afbd6=typeof _0x20d15b['offset']===_0xe236('0x2e')&&typeof _0x20d15b[_0xe236('0x2f')]===_0xe236('0x2e');var _0x3b9db6=_0x542666['count'];var _0x4c5000=_0x1afbd6?0x0:_0x20d15b[_0xe236('0x30')];var _0x450350=_0x1afbd6?_0x542666[_0xe236('0x31')]:_0x20d15b['offset']+_0x20d15b['limit'];var _0x2a4e2d;if(_0x450350>=_0x3b9db6){_0x450350=_0x3b9db6;_0x2a4e2d=0xc8;}else{_0x2a4e2d=0xce;}_0x537fff[_0xe236('0x2b')](_0x2a4e2d);return _0x537fff[_0xe236('0x32')](_0xe236('0x33'),_0x4c5000+'-'+_0x450350+'/'+_0x3b9db6)[_0xe236('0x2d')](_0x542666);}return null;};}function patchUpdates(_0x173095){return function(_0xce7b50){try{jsonpatch[_0xe236('0x34')](_0xce7b50,_0x173095,!![]);}catch(_0x3ceba7){return BPromise[_0xe236('0x35')](_0x3ceba7);}return _0xce7b50['save']();};}function saveUpdates(_0x54c115,_0x2a51e9){return function(_0x45a4ec){if(_0x45a4ec){return _0x45a4ec[_0xe236('0x36')](_0x54c115)[_0xe236('0x21')](function(_0x39256a){return _0x39256a;});}return null;};}function removeEntity(_0x15cf1d,_0x3e3550){return function(_0x516003){if(_0x516003){return _0x516003[_0xe236('0x37')]()['then'](function(){_0x15cf1d[_0xe236('0x2b')](0xcc)[_0xe236('0x2c')]();});}};}function handleEntityNotFound(_0x3e0396,_0x24f5f7){return function(_0x49e6f0){if(!_0x49e6f0){_0x3e0396[_0xe236('0x2a')](0x194);}return _0x49e6f0;};}function handleError(_0x4df102,_0x5aa3fa){_0x5aa3fa=_0x5aa3fa||0x1f4;return function(_0x1bb4b9){logger[_0xe236('0x26')](_0x1bb4b9['stack']);if(_0x1bb4b9[_0xe236('0x38')]){delete _0x1bb4b9['name'];}_0x4df102[_0xe236('0x2b')](_0x5aa3fa)[_0xe236('0x39')](_0x1bb4b9);};}exports['index']=function(_0x33c364,_0x3d3142){var _0x1cde68={},_0x146359={},_0x269b97={'count':0x0,'rows':[]};var _0x4a67df=_[_0xe236('0x3a')](db[_0xe236('0x3b')][_0xe236('0x3c')],function(_0x47ff15){return{'name':_0x47ff15[_0xe236('0x3d')],'type':_0x47ff15[_0xe236('0x3e')][_0xe236('0x3f')]};});_0x146359[_0xe236('0x40')]=_[_0xe236('0x3a')](_0x4a67df,'name');_0x146359[_0xe236('0x41')]=_[_0xe236('0x42')](_0x33c364['query']);_0x146359[_0xe236('0x43')]=_[_0xe236('0x44')](_0x146359[_0xe236('0x40')],_0x146359[_0xe236('0x41')]);_0x1cde68[_0xe236('0x45')]=_[_0xe236('0x44')](_0x146359['model'],qs[_0xe236('0x46')](_0x33c364[_0xe236('0x41')][_0xe236('0x46')]));_0x1cde68[_0xe236('0x45')]=_0x1cde68[_0xe236('0x45')][_0xe236('0x47')]?_0x1cde68['attributes']:_0x146359[_0xe236('0x40')];if(!_0x33c364[_0xe236('0x41')]['hasOwnProperty'](_0xe236('0x48'))){_0x1cde68['limit']=qs[_0xe236('0x2f')](_0x33c364[_0xe236('0x41')][_0xe236('0x2f')]);_0x1cde68['offset']=qs[_0xe236('0x30')](_0x33c364[_0xe236('0x41')]['offset']);}_0x1cde68[_0xe236('0x49')]=qs[_0xe236('0x4a')](_0x33c364[_0xe236('0x41')][_0xe236('0x4a')]);_0x1cde68['where']=qs[_0xe236('0x43')](_[_0xe236('0x4b')](_0x33c364[_0xe236('0x41')],_0x146359[_0xe236('0x43')]),_0x4a67df);if(_0x33c364['query'][_0xe236('0x4c')]){_0x1cde68[_0xe236('0x4d')]=_['merge'](_0x1cde68[_0xe236('0x4d')],{'$or':_[_0xe236('0x3a')](_0x4a67df,function(_0x499b7f){if(_0x499b7f[_0xe236('0x3e')]!==_0xe236('0x4e')){var _0x112e86={};_0x112e86[_0x499b7f[_0xe236('0x38')]]={'$like':'%'+_0x33c364[_0xe236('0x41')][_0xe236('0x4c')]+'%'};return _0x112e86;}})});}_0x1cde68=_[_0xe236('0x4f')]({},_0x1cde68,_0x33c364[_0xe236('0x50')]);var _0x482530={'where':_0x1cde68[_0xe236('0x4d')]};return db[_0xe236('0x3b')][_0xe236('0x31')](_0x482530)[_0xe236('0x21')](function(_0x2dc048){_0x269b97[_0xe236('0x31')]=_0x2dc048;if(_0x33c364[_0xe236('0x41')]['includeAll']){_0x1cde68[_0xe236('0x51')]=[{'all':!![]}];}return db[_0xe236('0x3b')]['findAll'](_0x1cde68);})['then'](function(_0x206a5c){_0x269b97[_0xe236('0x52')]=_0x206a5c;return _0x269b97;})[_0xe236('0x21')](respondWithFilteredResult(_0x3d3142,_0x1cde68))[_0xe236('0x29')](handleError(_0x3d3142,null));};exports[_0xe236('0x53')]=function(_0xac403c,_0x3afc97){var _0x51a582={'raw':!![],'where':{'id':_0xac403c[_0xe236('0x54')]['id']}},_0x158dbb={};_0x158dbb[_0xe236('0x40')]=_['keys'](db[_0xe236('0x3b')]['rawAttributes']);_0x158dbb['query']=_['keys'](_0xac403c[_0xe236('0x41')]);_0x158dbb['filters']=_[_0xe236('0x44')](_0x158dbb[_0xe236('0x40')],_0x158dbb[_0xe236('0x41')]);_0x51a582[_0xe236('0x45')]=_[_0xe236('0x44')](_0x158dbb[_0xe236('0x40')],qs[_0xe236('0x46')](_0xac403c[_0xe236('0x41')]['fields']));_0x51a582[_0xe236('0x45')]=_0x51a582['attributes'][_0xe236('0x47')]?_0x51a582['attributes']:_0x158dbb[_0xe236('0x40')];if(_0xac403c[_0xe236('0x41')][_0xe236('0x55')]){_0x51a582[_0xe236('0x51')]=[{'all':!![]}];}_0x51a582=_[_0xe236('0x4f')]({},_0x51a582,_0xac403c[_0xe236('0x50')]);return db[_0xe236('0x3b')][_0xe236('0x56')](_0x51a582)['then'](handleEntityNotFound(_0x3afc97,null))[_0xe236('0x21')](respondWithResult(_0x3afc97,null))[_0xe236('0x29')](handleError(_0x3afc97,null));};exports['create']=function(_0x22d8a9,_0xdf51af){return db[_0xe236('0x3b')][_0xe236('0x57')](_0x22d8a9['body'],{})['then'](respondWithResult(_0xdf51af,0xc9))[_0xe236('0x29')](handleError(_0xdf51af,null));};exports['update']=function(_0x2e206a,_0xb97493){if(_0x2e206a[_0xe236('0x58')]['id']){delete _0x2e206a[_0xe236('0x58')]['id'];}return db[_0xe236('0x3b')]['find']({'where':{'id':_0x2e206a[_0xe236('0x54')]['id']}})[_0xe236('0x21')](handleEntityNotFound(_0xb97493,null))['then'](saveUpdates(_0x2e206a['body'],null))[_0xe236('0x21')](respondWithResult(_0xb97493,null))['catch'](handleError(_0xb97493,null));};exports['destroy']=function(_0x4cd5fd,_0x105a94){return db[_0xe236('0x3b')][_0xe236('0x56')]({'where':{'id':_0x4cd5fd['params']['id']}})[_0xe236('0x21')](handleEntityNotFound(_0x105a94,null))[_0xe236('0x21')](removeEntity(_0x105a94,null))[_0xe236('0x29')](handleError(_0x105a94,null));};exports['describe']=function(_0x4e2bfc,_0xc1aac7){return db['OpenchannelMessage'][_0xe236('0x59')]()['then'](respondWithResult(_0xc1aac7,null))['catch'](handleError(_0xc1aac7,null));};var interaction_log=require(_0xe236('0x15'))(_0xe236('0x5a'));exports[_0xe236('0x5b')]=function(_0x2de68b,_0xa07efc,_0x30712b){var _0x27d117={'agent':{},'channel':'openchannel'};if(_0x2de68b[_0xe236('0x58')]['id']){delete _0x2de68b[_0xe236('0x58')]['id'];}_0x2de68b[_0xe236('0x58')]['read']=!![];_0x2de68b[_0xe236('0x58')][_0xe236('0x5c')]=moment()['format'](_0xe236('0x5d'));_0x2de68b[_0xe236('0x58')][_0xe236('0x5e')]=_0x2de68b[_0xe236('0x58')]['UserId']||_0x2de68b[_0xe236('0x5f')]['id'];_0x27d117[_0xe236('0x60')]['id']=_0x2de68b['body']['UserId'];return db[_0xe236('0x3b')][_0xe236('0x56')]({'where':{'id':_0x2de68b[_0xe236('0x54')]['id'],'UserId':null}})[_0xe236('0x21')](handleEntityNotFound(_0xa07efc,null))[_0xe236('0x21')](saveUpdates(_0x2de68b[_0xe236('0x58')],null))[_0xe236('0x21')](function(_0x27e573){if(_0x27e573){_0x27d117[_0xe236('0x28')]=_0x27e573[_0xe236('0x61')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x27e573[_0xe236('0x62')]}});}return null;})['then'](handleEntityNotFound(_0xa07efc,null))[_0xe236('0x21')](function(_0x210c5b){if(_0x210c5b){return _0x210c5b[_0xe236('0x36')]({'UserId':_0x2de68b['body']['UserId'],'read1stAt':_[_0xe236('0x63')](_0x210c5b['read1stAt'])?moment()[_0xe236('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe236('0x21')](function(_0x573294){if(_0x573294){_0x27d117[_0xe236('0x65')]=_0x573294[_0xe236('0x61')]({'plain':!![]});interaction_log[_0xe236('0x22')](_0xe236('0x66'),_0x2de68b[_0xe236('0x5f')]['id'],_0x2de68b['user']['name'],_0x2de68b[_0xe236('0x5f')][_0xe236('0x67')],_0x27d117['interaction']['id'],_0x2de68b['body']?JSON[_0xe236('0x68')](_0x2de68b['body']):_0xe236('0x69'));return respondWithRpcPromise(_0xe236('0x6a'),_0xe236('0x6b'),_0x27d117);}return null;})[_0xe236('0x21')](function(_0x551bbc){var _0x3afc45=_0xe236('0x6c')+_0x551bbc[_0xe236('0x28')][_0xe236('0x6d')];return db[_0xe236('0x6e')][_0xe236('0x41')](_0x3afc45,{'type':db[_0xe236('0x6f')][_0xe236('0x70')]['SELECT'],'raw':!![]})[_0xe236('0x21')](function(_0x50b229){return _0x50b229;});})[_0xe236('0x21')](function(_0x5f164d){if(_0x5f164d){_0x27d117[_0xe236('0x28')]['contact']=_0x5f164d[0x0];if(!_0x2de68b[_0xe236('0x58')]['UserId'])return;return db[_0xe236('0x71')][_0xe236('0x56')]({'where':{'id':_0x2de68b[_0xe236('0x58')][_0xe236('0x5e')],'role':'agent'},'attributes':['id',_0xe236('0x38'),_0xe236('0x72'),_0xe236('0x73'),'internal'],'raw':!![]});}return null;})[_0xe236('0x21')](function(_0x3b1aac){if(!_0x3b1aac)return null;_0x27d117[_0xe236('0x28')]['agent']=_0x3b1aac;return _0x27d117;})['then'](function(_0x4b7fcd){if(_0x4b7fcd){if(_0x2de68b['body'][_0xe236('0x74')]){_0x27d117[_0xe236('0x28')][_0xe236('0x75')]=util['format'](_0xe236('0x76'),_0x2de68b[_0xe236('0x5f')][_0xe236('0x38')]);_0x27d117[_0xe236('0x28')][_0xe236('0x77')]=_0x27d117['channel'];_0x27d117[_0xe236('0x28')][_0xe236('0x78')]=_0x27d117[_0xe236('0x77')];_0x27d117[_0xe236('0x28')][_0xe236('0x79')]=_0xe236('0x5b');return respondWithRpcPromise(_0xe236('0x7a'),'EventManager',{'event':_0xe236('0x7b'),'message':_0x27d117[_0xe236('0x28')]},client9002)[_0xe236('0x21')](function(){return _0x27d117;});}return _0x27d117;}return null;})[_0xe236('0x21')](respondWithResult(_0xa07efc,null))[_0xe236('0x29')](handleError(_0xa07efc,null));};var interaction_log=require(_0xe236('0x15'))(_0xe236('0x5a'));exports[_0xe236('0x35')]=function(_0x1297d2,_0x524fdc,_0x4a3a58){var _0x4cd896={'agent':{},'channel':'openchannel'};if(_0x1297d2[_0xe236('0x58')]['id']){delete _0x1297d2['body']['id'];}_0x1297d2[_0xe236('0x58')][_0xe236('0x5e')]=_0x1297d2['body'][_0xe236('0x5e')]||_0x1297d2[_0xe236('0x5f')]['id'];_0x4cd896[_0xe236('0x60')]['id']=_0x1297d2[_0xe236('0x58')][_0xe236('0x5e')];return db[_0xe236('0x3b')][_0xe236('0x56')]({'where':{'id':_0x1297d2['params']['id'],'UserId':null}})[_0xe236('0x21')](handleEntityNotFound(_0x524fdc,null))[_0xe236('0x21')](function(_0x38bc34){if(_0x38bc34){_0x4cd896[_0xe236('0x28')]=_0x38bc34[_0xe236('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0xe236('0x56')]({'where':{'id':_0x38bc34[_0xe236('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x524fdc,null))['then'](function(_0x419fc9){if(_0x419fc9){_0x4cd896[_0xe236('0x65')]=_0x419fc9['get']({'plain':!![]});interaction_log[_0xe236('0x22')](_0xe236('0x7c'),_0x1297d2[_0xe236('0x5f')]['id'],_0x1297d2[_0xe236('0x5f')]['name'],_0x1297d2[_0xe236('0x5f')][_0xe236('0x67')],_0x4cd896['interaction']['id'],_0x1297d2[_0xe236('0x58')]?JSON[_0xe236('0x68')](_0x1297d2[_0xe236('0x58')]):_0xe236('0x69'));return respondWithRpcPromise(_0xe236('0x7d'),'rejectMessage',_0x4cd896);}return null;})[_0xe236('0x21')](function(_0x5a83a2){var _0xd9416c=_0xe236('0x6c')+_0x5a83a2[_0xe236('0x28')][_0xe236('0x6d')];return db['sequelize'][_0xe236('0x41')](_0xd9416c,{'type':db[_0xe236('0x6f')][_0xe236('0x70')][_0xe236('0x7e')],'raw':!![]})['then'](function(_0x2de309){return _0x2de309;});})['then'](function(_0x396e2c){if(_0x396e2c){_0x4cd896['message']['contact']=_0x396e2c[0x0];if(!_0x1297d2['body'][_0xe236('0x5e')])return;return db['User']['find']({'where':{'id':_0x1297d2[_0xe236('0x58')][_0xe236('0x5e')],'role':_0xe236('0x60')},'attributes':['id','name','fullname',_0xe236('0x73'),_0xe236('0x7f')],'raw':!![]});}return null;})['then'](function(_0x3912a0){if(!_0x3912a0)return null;_0x4cd896[_0xe236('0x28')][_0xe236('0x60')]=_0x3912a0;return _0x4cd896;})[_0xe236('0x21')](function(_0x4cabc6){if(_0x4cabc6){_0x4cabc6['message']['interface']=util[_0xe236('0x64')]('SIP/%s',_0x1297d2[_0xe236('0x5f')][_0xe236('0x38')]);_0x4cabc6['message'][_0xe236('0x77')]=_0x4cd896[_0xe236('0x77')];_0x4cabc6[_0xe236('0x28')][_0xe236('0x78')]=_0x4cd896[_0xe236('0x77')];_0x4cabc6['message'][_0xe236('0x79')]=_0xe236('0x35');respondWithRpcPromise(_0xe236('0x7a'),_0xe236('0x7a'),{'event':'rejectmessage','message':_0x4cabc6[_0xe236('0x28')]},client9002);return _0x4cd896;}return null;})[_0xe236('0x21')](respondWithResult(_0x524fdc,null))[_0xe236('0x29')](handleError(_0x524fdc,null));}; \ No newline at end of file +var _0x949a=['UserId','user','get','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','interface','channel','motionChannel','event','EventManager','../../config/logger','OpenchannelInteraction','OpenchannelInteractionId','RejectMessage','rejectMessage','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','redis','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save','update','stack','name','send','map','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelMessage','count','includeAll','include','findAll','rawAttributes','find','create','body','destroy','params','describe','openchannel-interactions','accept','openchannel','read','readAt','format'];(function(_0x5180f2,_0x4f173a){var _0x2019ef=function(_0x19d3b7){while(--_0x19d3b7){_0x5180f2['push'](_0x5180f2['shift']());}};_0x2019ef(++_0x4f173a);}(_0x949a,0x1a7));var _0xa949=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x949a[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xa949('0x0'));var rimraf=require(_0xa949('0x1'));var zipdir=require(_0xa949('0x2'));var jsonpatch=require(_0xa949('0x3'));var rp=require(_0xa949('0x4'));var moment=require(_0xa949('0x5'));var BPromise=require(_0xa949('0x6'));var Mustache=require(_0xa949('0x7'));var util=require(_0xa949('0x8'));var path=require(_0xa949('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa949('0xa'));var fs=require('fs');var fs_extra=require(_0xa949('0xb'));var _=require(_0xa949('0xc'));var squel=require(_0xa949('0xd'));var crypto=require('crypto');var jsforce=require(_0xa949('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa949('0xf'));var Papa=require(_0xa949('0x10'));var Redis=require(_0xa949('0x11'));var authService=require(_0xa949('0x12'));var qs=require(_0xa949('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa949('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa949('0x15'));var db=require(_0xa949('0x16'))['db'];config['redis']=_[_0xa949('0x17')](config['redis'],{'host':_0xa949('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa949('0x19')]));require(_0xa949('0x1a'))['register'](socket);var jayson=require(_0xa949('0x1b'));var client=jayson[_0xa949('0x1c')][_0xa949('0x1d')]({'port':0x232c});var client9002=jayson[_0xa949('0x1c')][_0xa949('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5ab230,_0x46d1e0,_0x457ea0,_0xa890eb){return new BPromise(function(_0x20ade2,_0x19e72e){var _0x37e873=_0xa890eb||client;return _0x37e873[_0xa949('0x1e')](_0x5ab230,_0x457ea0)[_0xa949('0x1f')](function(_0x1b3b60){logger[_0xa949('0x20')](_0xa949('0x21'),_0x46d1e0,_0xa949('0x22'));logger[_0xa949('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x46d1e0,_0xa949('0x22'),JSON[_0xa949('0x24')](_0x1b3b60));if(_0x1b3b60[_0xa949('0x25')]){if(_0x1b3b60['error'][_0xa949('0x26')]===0x1f4){logger['error'](_0xa949('0x21'),_0x46d1e0,_0x1b3b60[_0xa949('0x25')][_0xa949('0x27')]);return _0x19e72e(_0x1b3b60[_0xa949('0x25')][_0xa949('0x27')]);}logger['error'](_0xa949('0x21'),_0x46d1e0,_0x1b3b60[_0xa949('0x25')][_0xa949('0x27')]);return _0x20ade2(_0x1b3b60['error']['message']);}else{logger[_0xa949('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x46d1e0,_0xa949('0x22'));_0x20ade2(_0x1b3b60[_0xa949('0x28')][_0xa949('0x27')]);}})[_0xa949('0x29')](function(_0xe3fecf){logger[_0xa949('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x46d1e0,_0xe3fecf);_0x19e72e(_0xe3fecf);});});}function respondWithStatusCode(_0x5e9af7,_0x113c78){_0x113c78=_0x113c78||0xcc;return function(_0x33edeb){if(_0x33edeb){return _0x5e9af7[_0xa949('0x2a')](_0x113c78);}return _0x5e9af7[_0xa949('0x2b')](_0x113c78)[_0xa949('0x2c')]();};}function respondWithResult(_0x3acc6c,_0x235dc8){_0x235dc8=_0x235dc8||0xc8;return function(_0x1b0625){if(_0x1b0625){return _0x3acc6c['status'](_0x235dc8)[_0xa949('0x2d')](_0x1b0625);}};}function respondWithFilteredResult(_0x38a005,_0x25da3f){return function(_0x1a1bde){if(_0x1a1bde){var _0x364f62=typeof _0x25da3f['offset']==='undefined'&&typeof _0x25da3f[_0xa949('0x2e')]===_0xa949('0x2f');var _0x52674c=_0x1a1bde['count'];var _0x1080c0=_0x364f62?0x0:_0x25da3f['offset'];var _0x3b3cf3=_0x364f62?_0x1a1bde['count']:_0x25da3f[_0xa949('0x30')]+_0x25da3f[_0xa949('0x2e')];var _0x4adfde;if(_0x3b3cf3>=_0x52674c){_0x3b3cf3=_0x52674c;_0x4adfde=0xc8;}else{_0x4adfde=0xce;}_0x38a005[_0xa949('0x2b')](_0x4adfde);return _0x38a005[_0xa949('0x31')](_0xa949('0x32'),_0x1080c0+'-'+_0x3b3cf3+'/'+_0x52674c)[_0xa949('0x2d')](_0x1a1bde);}return null;};}function patchUpdates(_0x21b26c){return function(_0x22df26){try{jsonpatch[_0xa949('0x33')](_0x22df26,_0x21b26c,!![]);}catch(_0x210da8){return BPromise[_0xa949('0x34')](_0x210da8);}return _0x22df26[_0xa949('0x35')]();};}function saveUpdates(_0x268110,_0x513e56){return function(_0x348a19){if(_0x348a19){return _0x348a19[_0xa949('0x36')](_0x268110)[_0xa949('0x1f')](function(_0x409584){return _0x409584;});}return null;};}function removeEntity(_0x20078b,_0x2afb38){return function(_0x4791f0){if(_0x4791f0){return _0x4791f0['destroy']()[_0xa949('0x1f')](function(){_0x20078b['status'](0xcc)[_0xa949('0x2c')]();});}};}function handleEntityNotFound(_0xaf7a49,_0x311ee8){return function(_0x2373c0){if(!_0x2373c0){_0xaf7a49['sendStatus'](0x194);}return _0x2373c0;};}function handleError(_0x3526d0,_0x56d91d){_0x56d91d=_0x56d91d||0x1f4;return function(_0x37bc24){logger['error'](_0x37bc24[_0xa949('0x37')]);if(_0x37bc24[_0xa949('0x38')]){delete _0x37bc24['name'];}_0x3526d0[_0xa949('0x2b')](_0x56d91d)[_0xa949('0x39')](_0x37bc24);};}exports['index']=function(_0x52716c,_0x4d4ceb){var _0x2f894d={},_0x3e103b={},_0x262131={'count':0x0,'rows':[]};var _0x43c68a=_[_0xa949('0x3a')](db['OpenchannelMessage']['rawAttributes'],function(_0x6f923a){return{'name':_0x6f923a['fieldName'],'type':_0x6f923a[_0xa949('0x3b')][_0xa949('0x3c')]};});_0x3e103b['model']=_[_0xa949('0x3a')](_0x43c68a,_0xa949('0x38'));_0x3e103b['query']=_[_0xa949('0x3d')](_0x52716c['query']);_0x3e103b[_0xa949('0x3e')]=_[_0xa949('0x3f')](_0x3e103b[_0xa949('0x40')],_0x3e103b[_0xa949('0x41')]);_0x2f894d[_0xa949('0x42')]=_['intersection'](_0x3e103b[_0xa949('0x40')],qs[_0xa949('0x43')](_0x52716c[_0xa949('0x41')][_0xa949('0x43')]));_0x2f894d[_0xa949('0x42')]=_0x2f894d[_0xa949('0x42')][_0xa949('0x44')]?_0x2f894d[_0xa949('0x42')]:_0x3e103b[_0xa949('0x40')];if(!_0x52716c[_0xa949('0x41')][_0xa949('0x45')](_0xa949('0x46'))){_0x2f894d[_0xa949('0x2e')]=qs[_0xa949('0x2e')](_0x52716c[_0xa949('0x41')][_0xa949('0x2e')]);_0x2f894d[_0xa949('0x30')]=qs[_0xa949('0x30')](_0x52716c[_0xa949('0x41')][_0xa949('0x30')]);}_0x2f894d[_0xa949('0x47')]=qs[_0xa949('0x48')](_0x52716c['query']['sort']);_0x2f894d[_0xa949('0x49')]=qs['filters'](_[_0xa949('0x4a')](_0x52716c[_0xa949('0x41')],_0x3e103b[_0xa949('0x3e')]),_0x43c68a);if(_0x52716c['query'][_0xa949('0x4b')]){_0x2f894d[_0xa949('0x49')]=_[_0xa949('0x4c')](_0x2f894d[_0xa949('0x49')],{'$or':_['map'](_0x43c68a,function(_0x476903){if(_0x476903[_0xa949('0x3b')]!==_0xa949('0x4d')){var _0x5c88e0={};_0x5c88e0[_0x476903[_0xa949('0x38')]]={'$like':'%'+_0x52716c[_0xa949('0x41')][_0xa949('0x4b')]+'%'};return _0x5c88e0;}})});}_0x2f894d=_[_0xa949('0x4c')]({},_0x2f894d,_0x52716c[_0xa949('0x4e')]);var _0x507658={'where':_0x2f894d['where']};return db[_0xa949('0x4f')][_0xa949('0x50')](_0x507658)[_0xa949('0x1f')](function(_0xeeac9a){_0x262131['count']=_0xeeac9a;if(_0x52716c[_0xa949('0x41')][_0xa949('0x51')]){_0x2f894d[_0xa949('0x52')]=[{'all':!![]}];}return db[_0xa949('0x4f')][_0xa949('0x53')](_0x2f894d);})[_0xa949('0x1f')](function(_0x4e60ba){_0x262131['rows']=_0x4e60ba;return _0x262131;})[_0xa949('0x1f')](respondWithFilteredResult(_0x4d4ceb,_0x2f894d))['catch'](handleError(_0x4d4ceb,null));};exports['show']=function(_0x56a5cd,_0x11ff50){var _0x4e2f52={'raw':!![],'where':{'id':_0x56a5cd['params']['id']}},_0x1a6b21={};_0x1a6b21['model']=_['keys'](db['OpenchannelMessage'][_0xa949('0x54')]);_0x1a6b21[_0xa949('0x41')]=_[_0xa949('0x3d')](_0x56a5cd[_0xa949('0x41')]);_0x1a6b21[_0xa949('0x3e')]=_[_0xa949('0x3f')](_0x1a6b21[_0xa949('0x40')],_0x1a6b21[_0xa949('0x41')]);_0x4e2f52[_0xa949('0x42')]=_[_0xa949('0x3f')](_0x1a6b21[_0xa949('0x40')],qs['fields'](_0x56a5cd[_0xa949('0x41')][_0xa949('0x43')]));_0x4e2f52[_0xa949('0x42')]=_0x4e2f52[_0xa949('0x42')][_0xa949('0x44')]?_0x4e2f52[_0xa949('0x42')]:_0x1a6b21[_0xa949('0x40')];if(_0x56a5cd[_0xa949('0x41')][_0xa949('0x51')]){_0x4e2f52[_0xa949('0x52')]=[{'all':!![]}];}_0x4e2f52=_['merge']({},_0x4e2f52,_0x56a5cd[_0xa949('0x4e')]);return db['OpenchannelMessage'][_0xa949('0x55')](_0x4e2f52)[_0xa949('0x1f')](handleEntityNotFound(_0x11ff50,null))[_0xa949('0x1f')](respondWithResult(_0x11ff50,null))['catch'](handleError(_0x11ff50,null));};exports['create']=function(_0x504c07,_0x41c2a4){return db['OpenchannelMessage'][_0xa949('0x56')](_0x504c07[_0xa949('0x57')],{})[_0xa949('0x1f')](respondWithResult(_0x41c2a4,0xc9))[_0xa949('0x29')](handleError(_0x41c2a4,null));};exports['update']=function(_0xf6b268,_0x28d846){if(_0xf6b268[_0xa949('0x57')]['id']){delete _0xf6b268['body']['id'];}return db[_0xa949('0x4f')][_0xa949('0x55')]({'where':{'id':_0xf6b268['params']['id']}})[_0xa949('0x1f')](handleEntityNotFound(_0x28d846,null))[_0xa949('0x1f')](saveUpdates(_0xf6b268['body'],null))['then'](respondWithResult(_0x28d846,null))[_0xa949('0x29')](handleError(_0x28d846,null));};exports[_0xa949('0x58')]=function(_0x3fd4b2,_0x347809){return db[_0xa949('0x4f')]['find']({'where':{'id':_0x3fd4b2[_0xa949('0x59')]['id']}})[_0xa949('0x1f')](handleEntityNotFound(_0x347809,null))[_0xa949('0x1f')](removeEntity(_0x347809,null))['catch'](handleError(_0x347809,null));};exports[_0xa949('0x5a')]=function(_0x52e8ea,_0x420459){return db[_0xa949('0x4f')]['describe']()[_0xa949('0x1f')](respondWithResult(_0x420459,null))[_0xa949('0x29')](handleError(_0x420459,null));};var interaction_log=require('../../config/logger')(_0xa949('0x5b'));exports[_0xa949('0x5c')]=function(_0xf5f9cc,_0x3b35bc,_0x216908){var _0x21089c={'agent':{},'channel':_0xa949('0x5d')};if(_0xf5f9cc['body']['id']){delete _0xf5f9cc[_0xa949('0x57')]['id'];}_0xf5f9cc['body'][_0xa949('0x5e')]=!![];_0xf5f9cc[_0xa949('0x57')][_0xa949('0x5f')]=moment()[_0xa949('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0xf5f9cc[_0xa949('0x57')][_0xa949('0x61')]=_0xf5f9cc[_0xa949('0x57')][_0xa949('0x61')]||_0xf5f9cc[_0xa949('0x62')]['id'];_0x21089c['agent']['id']=_0xf5f9cc['body'][_0xa949('0x61')];return db[_0xa949('0x4f')][_0xa949('0x55')]({'where':{'id':_0xf5f9cc[_0xa949('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3b35bc,null))[_0xa949('0x1f')](saveUpdates(_0xf5f9cc[_0xa949('0x57')],null))[_0xa949('0x1f')](function(_0x314ff4){if(_0x314ff4){_0x21089c[_0xa949('0x27')]=_0x314ff4[_0xa949('0x63')]({'plain':!![]});return db['OpenchannelInteraction'][_0xa949('0x55')]({'where':{'id':_0x314ff4['OpenchannelInteractionId']}});}return null;})[_0xa949('0x1f')](handleEntityNotFound(_0x3b35bc,null))[_0xa949('0x1f')](function(_0x5bad98){if(_0x5bad98){return _0x5bad98[_0xa949('0x36')]({'UserId':_0xf5f9cc[_0xa949('0x57')][_0xa949('0x61')],'read1stAt':_[_0xa949('0x64')](_0x5bad98[_0xa949('0x65')])?moment()[_0xa949('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa949('0x1f')](function(_0x5911ad){if(_0x5911ad){_0x21089c[_0xa949('0x66')]=_0x5911ad['get']({'plain':!![]});interaction_log[_0xa949('0x20')](_0xa949('0x67'),_0xf5f9cc[_0xa949('0x62')]['id'],_0xf5f9cc[_0xa949('0x62')][_0xa949('0x38')],_0xf5f9cc[_0xa949('0x62')][_0xa949('0x68')],_0x21089c[_0xa949('0x66')]['id'],_0xf5f9cc['body']?JSON[_0xa949('0x24')](_0xf5f9cc[_0xa949('0x57')]):_0xa949('0x69'));return respondWithRpcPromise('AcceptMessage',_0xa949('0x6a'),_0x21089c);}return null;})[_0xa949('0x1f')](function(_0x2acba7){var _0x3e496d=_0xa949('0x6b')+_0x2acba7[_0xa949('0x27')][_0xa949('0x6c')];return db[_0xa949('0x6d')]['query'](_0x3e496d,{'type':db[_0xa949('0x6e')][_0xa949('0x6f')][_0xa949('0x70')],'raw':!![]})[_0xa949('0x1f')](function(_0x27287c){return _0x27287c;});})[_0xa949('0x1f')](function(_0x3fbd5c){if(_0x3fbd5c){_0x21089c['message'][_0xa949('0x71')]=_0x3fbd5c[0x0];if(!_0xf5f9cc['body'][_0xa949('0x61')])return;return db[_0xa949('0x72')][_0xa949('0x55')]({'where':{'id':_0xf5f9cc[_0xa949('0x57')][_0xa949('0x61')],'role':_0xa949('0x73')},'attributes':['id',_0xa949('0x38'),_0xa949('0x74'),'email',_0xa949('0x75')],'raw':!![]});}return null;})[_0xa949('0x1f')](function(_0x151647){if(!_0x151647)return null;_0x21089c[_0xa949('0x27')][_0xa949('0x73')]=_0x151647;return _0x21089c;})[_0xa949('0x1f')](function(_0x621605){if(_0x621605){if(_0xf5f9cc[_0xa949('0x57')]['manual']){_0x21089c[_0xa949('0x27')][_0xa949('0x76')]=util['format']('SIP/%s',_0xf5f9cc['user'][_0xa949('0x38')]);_0x21089c[_0xa949('0x27')][_0xa949('0x77')]=_0x21089c['channel'];_0x21089c[_0xa949('0x27')][_0xa949('0x78')]=_0x21089c[_0xa949('0x77')];_0x21089c[_0xa949('0x27')][_0xa949('0x79')]=_0xa949('0x5c');return respondWithRpcPromise(_0xa949('0x7a'),'EventManager',{'event':'acceptmessage','message':_0x21089c[_0xa949('0x27')]},client9002)[_0xa949('0x1f')](function(){return _0x21089c;});}return _0x21089c;}return null;})[_0xa949('0x1f')](respondWithResult(_0x3b35bc,null))[_0xa949('0x29')](handleError(_0x3b35bc,null));};var interaction_log=require(_0xa949('0x7b'))(_0xa949('0x5b'));exports[_0xa949('0x34')]=function(_0x217a8c,_0x706d8b,_0x5c4b01){var _0x553c8f={'agent':{},'channel':_0xa949('0x5d')};if(_0x217a8c[_0xa949('0x57')]['id']){delete _0x217a8c['body']['id'];}_0x217a8c['body']['UserId']=_0x217a8c[_0xa949('0x57')][_0xa949('0x61')]||_0x217a8c[_0xa949('0x62')]['id'];_0x553c8f['agent']['id']=_0x217a8c[_0xa949('0x57')]['UserId'];return db[_0xa949('0x4f')][_0xa949('0x55')]({'where':{'id':_0x217a8c[_0xa949('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x706d8b,null))[_0xa949('0x1f')](function(_0x3cc612){if(_0x3cc612){_0x553c8f['message']=_0x3cc612[_0xa949('0x63')]({'plain':!![]});return db[_0xa949('0x7c')][_0xa949('0x55')]({'where':{'id':_0x3cc612[_0xa949('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x706d8b,null))['then'](function(_0x492eaa){if(_0x492eaa){_0x553c8f[_0xa949('0x66')]=_0x492eaa[_0xa949('0x63')]({'plain':!![]});interaction_log[_0xa949('0x20')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x217a8c[_0xa949('0x62')]['id'],_0x217a8c['user']['name'],_0x217a8c[_0xa949('0x62')]['role'],_0x553c8f[_0xa949('0x66')]['id'],_0x217a8c['body']?JSON[_0xa949('0x24')](_0x217a8c[_0xa949('0x57')]):_0xa949('0x69'));return respondWithRpcPromise(_0xa949('0x7e'),_0xa949('0x7f'),_0x553c8f);}return null;})[_0xa949('0x1f')](function(_0x5949aa){var _0x307218=_0xa949('0x6b')+_0x5949aa['message'][_0xa949('0x6c')];return db['sequelize'][_0xa949('0x41')](_0x307218,{'type':db[_0xa949('0x6e')][_0xa949('0x6f')][_0xa949('0x70')],'raw':!![]})['then'](function(_0x45a871){return _0x45a871;});})[_0xa949('0x1f')](function(_0x26d733){if(_0x26d733){_0x553c8f[_0xa949('0x27')][_0xa949('0x71')]=_0x26d733[0x0];if(!_0x217a8c['body'][_0xa949('0x61')])return;return db[_0xa949('0x72')]['find']({'where':{'id':_0x217a8c[_0xa949('0x57')][_0xa949('0x61')],'role':_0xa949('0x73')},'attributes':['id',_0xa949('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})[_0xa949('0x1f')](function(_0x248594){if(!_0x248594)return null;_0x553c8f[_0xa949('0x27')]['agent']=_0x248594;return _0x553c8f;})[_0xa949('0x1f')](function(_0x48b2fa){if(_0x48b2fa){_0x48b2fa[_0xa949('0x27')][_0xa949('0x76')]=util['format'](_0xa949('0x80'),_0x217a8c[_0xa949('0x62')][_0xa949('0x38')]);_0x48b2fa[_0xa949('0x27')]['channel']=_0x553c8f[_0xa949('0x77')];_0x48b2fa[_0xa949('0x27')][_0xa949('0x78')]=_0x553c8f[_0xa949('0x77')];_0x48b2fa[_0xa949('0x27')]['event']='reject';respondWithRpcPromise(_0xa949('0x7a'),_0xa949('0x7a'),{'event':_0xa949('0x81'),'message':_0x48b2fa[_0xa949('0x27')]},client9002);return _0x553c8f;}return null;})[_0xa949('0x1f')](respondWithResult(_0x706d8b,null))['catch'](handleError(_0x706d8b,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index d9812f0..b12b431 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 _0x9411=['update','emit','hasOwnProperty','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x3faf85,_0x154931){var _0xcfa4fa=function(_0x339b5c){while(--_0x339b5c){_0x3faf85['push'](_0x3faf85['shift']());}};_0xcfa4fa(++_0x154931);}(_0x9411,0x1ae));var _0x1941=function(_0x1aed12,_0x3f31d3){_0x1aed12=_0x1aed12-0x0;var _0x24114a=_0x9411[_0x1aed12];return _0x24114a;};'use strict';var EventEmitter=require(_0x1941('0x0'));var OpenchannelMessage=require(_0x1941('0x1'))['db'][_0x1941('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x1941('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1941('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a17be){return function(_0xb6720b,_0x3e05bb,_0x499a84){OpenchannelMessageEvents[_0x1941('0x5')](_0x2a17be+':'+_0xb6720b['id'],_0xb6720b);OpenchannelMessageEvents['emit'](_0x2a17be,_0xb6720b);_0x499a84(null);};}for(var e in events){if(events[_0x1941('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xe6d3=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe6d3,0x10d));var _0x3e6d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xe6d3[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0x3e6d('0x0'));var OpenchannelMessage=require(_0x3e6d('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x3e6d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3e6d('0x3'),'afterDestroy':_0x3e6d('0x4')};function emitEvent(_0x2b83dc){return function(_0x14c37c,_0x44a63b,_0x3689f9){OpenchannelMessageEvents['emit'](_0x2b83dc+':'+_0x14c37c['id'],_0x14c37c);OpenchannelMessageEvents[_0x3e6d('0x5')](_0x2b83dc,_0x14c37c);_0x3689f9(null);};}for(var e in events){if(events[_0x3e6d('0x6')](e)){var event=events[e];OpenchannelMessage[_0x3e6d('0x7')](e,emitEvent(event));}}module[_0x3e6d('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index c3cdb98..4468da7 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 _0x39c8=['fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','out','CmContact','describe','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','Contact','POST','method','GET','body','info','afterCreate','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0x39c8,0x19c));var _0x839c=function(_0x45fe9c,_0x55e0d7){_0x45fe9c=_0x45fe9c-0x0;var _0x233d48=_0x39c8[_0x45fe9c];return _0x233d48;};'use strict';var _=require(_0x839c('0x0'));var util=require(_0x839c('0x1'));var logger=require(_0x839c('0x2'))(_0x839c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x839c('0x4'));var fs=require('fs');var path=require(_0x839c('0x5'));var rimraf=require(_0x839c('0x6'));var config=require(_0x839c('0x7'));var attributes=require(_0x839c('0x8'));module['exports']=function(_0x3095c4,_0x553d4b){return _0x3095c4[_0x839c('0x9')](_0x839c('0xa'),attributes,{'tableName':_0x839c('0xb'),'paranoid':![],'indexes':[{'name':_0x839c('0xc'),'fields':['body'],'type':_0x839c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10cedf,_0x455d6e,_0x27a1b1){var _0x47c9a4=_0x3095c4[_0x839c('0xe')];var _0x26458c=_0x10cedf[_0x839c('0xf')]({'plain':!![]});if(_0x26458c[_0x839c('0x10')][_0x839c('0x11')]()==='in'||_0x26458c[_0x839c('0x10')][_0x839c('0x11')]()==='out'&&!_0x26458c[_0x839c('0x12')]&&!_[_0x839c('0x13')](_0x26458c[_0x839c('0x14')])){_0x47c9a4['OpenchannelInteraction'][_0x839c('0x15')]({'where':{'id':_0x26458c['OpenchannelInteractionId']}})[_0x839c('0x16')](function(_0x1f8892){if(_0x1f8892){_0x1f8892[_0x839c('0x17')]({'lastMsgAt':_0x26458c[_0x839c('0x18')],'lastMsgDirection':_0x26458c['direction']['toLowerCase']()});}})[_0x839c('0x19')](function(_0x4991f6){console[_0x839c('0x1a')](_0x4991f6);});}if(_0x26458c[_0x839c('0x10')]===_0x839c('0x1b')&&!_0x26458c[_0x839c('0x12')]){var _0x475247;_0x47c9a4[_0x839c('0x1c')][_0x839c('0x1d')]()[_0x839c('0x16')](function(_0x5a7efd){return _0x47c9a4['OpenchannelAccount'][_0x839c('0x1e')]({'where':{'id':_0x26458c[_0x839c('0x1f')]},'include':[{'model':_0x47c9a4[_0x839c('0x20')],'as':_0x839c('0x21'),'where':{'id':_0x26458c['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x47c9a4[_0x839c('0x1c')],'as':'Contact','attributes':_[_0x839c('0x22')](_0x5a7efd)}]}]});})[_0x839c('0x16')](function(_0x1eafbb){_0x475247=_0x1eafbb[_0x839c('0xf')]({'plain':!![]});if(_0x475247&&_0x475247[_0x839c('0x23')]){logger['info'](_0x839c('0x24'),'afterCreate',util['format'](_0x839c('0x25'),_0x26458c['id'],_0x475247['replyUri']));if(_0x475247[_0x839c('0x21')]&&_0x475247[_0x839c('0x21')][_0x839c('0x26')]){_0x26458c[_0x839c('0x27')]=_['omit'](_0x475247[_0x839c('0x21')][0x0],_0x839c('0x28'));_0x26458c['Contact']=_0x475247[_0x839c('0x21')][0x0][_0x839c('0x28')];}var _0x455d6e={'method':_0x839c('0x29'),'uri':encodeURI(_0x475247['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x455d6e[_0x839c('0x2a')]){case _0x839c('0x2b'):_0x455d6e['qs']=_0x26458c;break;case _0x839c('0x29'):_0x455d6e[_0x839c('0x2c')]=_0x26458c;break;}return rp(_0x455d6e)['then'](function(_0x171c0d){logger[_0x839c('0x2d')](_0x839c('0x24'),_0x839c('0x2e'),util[_0x839c('0x2f')](_0x839c('0x30'),_0x26458c['id'],_0x475247[_0x839c('0x23')]));if(_0x171c0d[_0x839c('0x2c')][_0x839c('0x31')]&&_0x171c0d[_0x839c('0x2c')][_0x839c('0x31')]!=_0x26458c[_0x839c('0x27')][_0x839c('0x31')]){return _0x47c9a4[_0x839c('0x20')]['update']({'threadId':_0x171c0d[_0x839c('0x2c')]['threadId']},{'where':{'id':_0x26458c[_0x839c('0x27')]['id']}});}else{return;}})[_0x839c('0x16')](function(){return _0x10cedf[_0x839c('0x17')]({'read':!![]});})[_0x839c('0x19')](function(_0x172cd5){logger[_0x839c('0x1a')](_0x839c('0x24'),_0x839c('0x2e'),util[_0x839c('0x32')](_0x172cd5,{'showHidden':![],'depth':null}));_0x27a1b1();});}else{_0x27a1b1();}})[_0x839c('0x33')](function(){_0x27a1b1();});}else{_0x27a1b1();}}},'charset':_0x839c('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe2eb=['exports','define','OpenchannelMessage','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','describe','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteraction','Interactions','CmContact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','finally','utf8mb4_unicode_ci','lodash','api','moment','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes'];(function(_0x50a291,_0x280e1f){var _0x564ed8=function(_0x3306d6){while(--_0x3306d6){_0x50a291['push'](_0x50a291['shift']());}};_0x564ed8(++_0x280e1f);}(_0xe2eb,0x181));var _0xbe2e=function(_0x11675b,_0xfd4f8c){_0x11675b=_0x11675b-0x0;var _0x11b08c=_0xe2eb[_0x11675b];return _0x11b08c;};'use strict';var _=require(_0xbe2e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbe2e('0x1'));var moment=require(_0xbe2e('0x2'));var BPromise=require('bluebird');var rp=require(_0xbe2e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe2e('0x4'));var config=require(_0xbe2e('0x5'));var attributes=require(_0xbe2e('0x6'));module[_0xbe2e('0x7')]=function(_0x221233,_0x543ff0){return _0x221233[_0xbe2e('0x8')](_0xbe2e('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xbe2e('0xa')],'type':_0xbe2e('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x48b68a,_0x5afe5b,_0x4b5c32){var _0x1cbc37=_0x221233['models'];var _0x49c21d=_0x48b68a[_0xbe2e('0xc')]({'plain':!![]});if(_0x49c21d[_0xbe2e('0xd')]['toLowerCase']()==='in'||_0x49c21d[_0xbe2e('0xd')][_0xbe2e('0xe')]()===_0xbe2e('0xf')&&!_0x49c21d[_0xbe2e('0x10')]&&!_[_0xbe2e('0x11')](_0x49c21d[_0xbe2e('0x12')])){_0x1cbc37['OpenchannelInteraction'][_0xbe2e('0x13')]({'where':{'id':_0x49c21d['OpenchannelInteractionId']}})[_0xbe2e('0x14')](function(_0xce15c1){if(_0xce15c1){_0xce15c1[_0xbe2e('0x15')]({'lastMsgAt':_0x49c21d[_0xbe2e('0x16')],'lastMsgDirection':_0x49c21d['direction'][_0xbe2e('0xe')]()});}})[_0xbe2e('0x17')](function(_0x33d2bf){console['error'](_0x33d2bf);});}if(_0x49c21d[_0xbe2e('0xd')]===_0xbe2e('0xf')&&!_0x49c21d['secret']){var _0x4d0ba4;_0x1cbc37['CmContact'][_0xbe2e('0x18')]()[_0xbe2e('0x14')](function(_0x382f1c){return _0x1cbc37[_0xbe2e('0x19')]['find']({'where':{'id':_0x49c21d[_0xbe2e('0x1a')]},'include':[{'model':_0x1cbc37[_0xbe2e('0x1b')],'as':_0xbe2e('0x1c'),'where':{'id':_0x49c21d['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x1cbc37[_0xbe2e('0x1d')],'as':'Contact','attributes':_[_0xbe2e('0x1e')](_0x382f1c)}]}]});})[_0xbe2e('0x14')](function(_0x1a3fc7){_0x4d0ba4=_0x1a3fc7[_0xbe2e('0xc')]({'plain':!![]});if(_0x4d0ba4&&_0x4d0ba4[_0xbe2e('0x1f')]){logger['info'](_0xbe2e('0x20'),_0xbe2e('0x21'),util['format'](_0xbe2e('0x22'),_0x49c21d['id'],_0x4d0ba4['replyUri']));if(_0x4d0ba4[_0xbe2e('0x1c')]&&_0x4d0ba4[_0xbe2e('0x1c')][_0xbe2e('0x23')]){_0x49c21d[_0xbe2e('0x24')]=_[_0xbe2e('0x25')](_0x4d0ba4[_0xbe2e('0x1c')][0x0],_0xbe2e('0x26'));_0x49c21d['Contact']=_0x4d0ba4['Interactions'][0x0][_0xbe2e('0x26')];}var _0x5afe5b={'method':_0xbe2e('0x27'),'uri':encodeURI(_0x4d0ba4[_0xbe2e('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5afe5b[_0xbe2e('0x28')]){case _0xbe2e('0x29'):_0x5afe5b['qs']=_0x49c21d;break;case _0xbe2e('0x27'):_0x5afe5b['body']=_0x49c21d;break;}return rp(_0x5afe5b)['then'](function(_0x140f65){logger[_0xbe2e('0x2a')](_0xbe2e('0x20'),_0xbe2e('0x21'),util['format'](_0xbe2e('0x2b'),_0x49c21d['id'],_0x4d0ba4['replyUri']));if(_0x140f65[_0xbe2e('0xa')][_0xbe2e('0x2c')]&&_0x140f65[_0xbe2e('0xa')][_0xbe2e('0x2c')]!=_0x49c21d['Interaction']['threadId']){return _0x1cbc37[_0xbe2e('0x1b')][_0xbe2e('0x15')]({'threadId':_0x140f65['body']['threadId']},{'where':{'id':_0x49c21d[_0xbe2e('0x24')]['id']}});}else{return;}})[_0xbe2e('0x14')](function(){return _0x48b68a[_0xbe2e('0x15')]({'read':!![]});})[_0xbe2e('0x17')](function(_0x5cc5a1){logger[_0xbe2e('0x2d')](_0xbe2e('0x20'),_0xbe2e('0x21'),util[_0xbe2e('0x2e')](_0x5cc5a1,{'showHidden':![],'depth':null}));_0x4b5c32();});}else{_0x4b5c32();}})[_0xbe2e('0x2f')](function(){_0x4b5c32();});}else{_0x4b5c32();}}},'charset':'utf8mb4','collate':_0xbe2e('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index ee45423..dfb6a0c 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x509850,_0x2f4655){var _0xf2a663=function(_0x529117){while(--_0x529117){_0x509850['push'](_0x509850['shift']());}};_0xf2a663(++_0x2f4655);}(_0x1261,0x144));var _0x1126=function(_0x20b1ca,_0xcaa99b){_0x20b1ca=_0x20b1ca-0x0;var _0x13a457=_0x1261[_0x20b1ca];return _0x13a457;};'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});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x22f99b,_0x2fb513){var _0x176c18=function(_0x2c744c){while(--_0x2c744c){_0x22f99b['push'](_0x22f99b['shift']());}};_0x176c18(++_0x2fb513);}(_0x7a54,0x106));var _0x47a5=function(_0x4fd15e,_0x37431b){_0x4fd15e=_0x4fd15e-0x0;var _0x35a446=_0x7a54[_0x4fd15e];return _0x35a446;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 7e3b457..59a44c1 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 _0x705e=['remove','update','emit','removeListener','register','length','openchannelMessage:','save'];(function(_0x3d62fe,_0x85b05b){var _0x2e5c46=function(_0x3fea06){while(--_0x3fea06){_0x3d62fe['push'](_0x3d62fe['shift']());}};_0x2e5c46(++_0x85b05b);}(_0x705e,0x107));var _0xe705=function(_0x302b72,_0x483f35){_0x302b72=_0x302b72-0x0;var _0x48aa64=_0x705e[_0x302b72];return _0x48aa64;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xe705('0x0'),_0xe705('0x1'),_0xe705('0x2')];function createListener(_0x48bb1e,_0x552b97){return function(_0x4a4c06){_0x552b97[_0xe705('0x3')](_0x48bb1e,_0x4a4c06);};}function removeListener(_0x25938a,_0x104756){return function(){OpenchannelMessageEvents[_0xe705('0x4')](_0x25938a,_0x104756);};}exports[_0xe705('0x5')]=function(_0x22ccd5){for(var _0x806bcd=0x0,_0x2c725e=events[_0xe705('0x6')];_0x806bcd<_0x2c725e;_0x806bcd++){var _0x3c8b57=events[_0x806bcd];var _0x39c944=createListener(_0xe705('0x7')+_0x3c8b57,_0x22ccd5);OpenchannelMessageEvents['on'](_0x3c8b57,_0x39c944);}}; \ No newline at end of file +var _0x9622=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x11f048,_0x354699){var _0x1d6baa=function(_0x5cd15f){while(--_0x5cd15f){_0x11f048['push'](_0x11f048['shift']());}};_0x1d6baa(++_0x354699);}(_0x9622,0x8d));var _0x2962=function(_0x5b8a99,_0x2e0c12){_0x5b8a99=_0x5b8a99-0x0;var _0x31fa01=_0x9622[_0x5b8a99];return _0x31fa01;};'use strict';var OpenchannelMessageEvents=require(_0x2962('0x0'));var events=[_0x2962('0x1'),_0x2962('0x2'),'update'];function createListener(_0xbb1509,_0xe99a15){return function(_0x287a5b){_0xe99a15['emit'](_0xbb1509,_0x287a5b);};}function removeListener(_0x5ab38d,_0x59d192){return function(){OpenchannelMessageEvents['removeListener'](_0x5ab38d,_0x59d192);};}exports[_0x2962('0x3')]=function(_0x24fc5b){for(var _0x720485=0x0,_0x1581b9=events[_0x2962('0x4')];_0x720485<_0x1581b9;_0x720485++){var _0x199b86=events[_0x720485];var _0x51153c=createListener(_0x2962('0x5')+_0x199b86,_0x24fc5b);OpenchannelMessageEvents['on'](_0x199b86,_0x51153c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index e043cf0..4defc4e 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 _0x0920=['removeTeams','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','show','getMembers','/:id/teams','getTeams','create','addTeams','/:id/users','addAgents','delete','destroy'];(function(_0xea9320,_0x43ea8b){var _0x450d6b=function(_0x2827c1){while(--_0x2827c1){_0xea9320['push'](_0xea9320['shift']());}};_0x450d6b(++_0x43ea8b);}(_0x0920,0x12a));var _0x0092=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0x0920[_0x1b64dd];return _0xeb464c;};'use strict';var multer=require(_0x0092('0x0'));var util=require(_0x0092('0x1'));var path=require(_0x0092('0x2'));var timeout=require(_0x0092('0x3'));var express=require('express');var router=express[_0x0092('0x4')]();var fs_extra=require(_0x0092('0x5'));var auth=require(_0x0092('0x6'));var interaction=require(_0x0092('0x7'));var config=require(_0x0092('0x8'));var controller=require(_0x0092('0x9'));router[_0x0092('0xa')]('/',auth['isAuthenticated'](),controller[_0x0092('0xb')]);router['get'](_0x0092('0xc'),auth['isAuthenticated'](),controller[_0x0092('0xd')]);router[_0x0092('0xa')](_0x0092('0xe'),auth[_0x0092('0xf')](),controller[_0x0092('0x10')]);router[_0x0092('0xa')]('/:id/members',auth[_0x0092('0xf')](),controller[_0x0092('0x11')]);router[_0x0092('0xa')](_0x0092('0x12'),auth[_0x0092('0xf')](),controller[_0x0092('0x13')]);router[_0x0092('0xa')]('/:id/users',auth[_0x0092('0xf')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x0092('0x14')]);router['post'](_0x0092('0x12'),auth['isAuthenticated'](),controller[_0x0092('0x15')]);router['post'](_0x0092('0x16'),auth[_0x0092('0xf')](),controller[_0x0092('0x17')]);router['put'](_0x0092('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x0092('0x18')](_0x0092('0xe'),auth[_0x0092('0xf')](),controller[_0x0092('0x19')]);router[_0x0092('0x18')](_0x0092('0x12'),auth[_0x0092('0xf')](),controller[_0x0092('0x1a')]);router[_0x0092('0x18')](_0x0092('0x16'),auth[_0x0092('0xf')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x4d87=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','addAgents','put','/:id','delete','removeAgents','exports'];(function(_0x332174,_0x500661){var _0x391fa4=function(_0x380304){while(--_0x380304){_0x332174['push'](_0x332174['shift']());}};_0x391fa4(++_0x500661);}(_0x4d87,0x1a4));var _0x74d8=function(_0x23f83b,_0x4fd76e){_0x23f83b=_0x23f83b-0x0;var _0x36a1d3=_0x4d87[_0x23f83b];return _0x36a1d3;};'use strict';var multer=require(_0x74d8('0x0'));var util=require(_0x74d8('0x1'));var path=require(_0x74d8('0x2'));var timeout=require(_0x74d8('0x3'));var express=require(_0x74d8('0x4'));var router=express[_0x74d8('0x5')]();var fs_extra=require(_0x74d8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x74d8('0x7'));var config=require(_0x74d8('0x8'));var controller=require(_0x74d8('0x9'));router[_0x74d8('0xa')]('/',auth['isAuthenticated'](),controller[_0x74d8('0xb')]);router[_0x74d8('0xa')]('/describe',auth[_0x74d8('0xc')](),controller[_0x74d8('0xd')]);router[_0x74d8('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x74d8('0xe')]);router[_0x74d8('0xa')](_0x74d8('0xf'),auth[_0x74d8('0xc')](),controller[_0x74d8('0x10')]);router[_0x74d8('0xa')](_0x74d8('0x11'),auth[_0x74d8('0xc')](),controller[_0x74d8('0x12')]);router[_0x74d8('0xa')](_0x74d8('0x13'),auth[_0x74d8('0xc')](),controller[_0x74d8('0x14')]);router['post']('/',auth[_0x74d8('0xc')](),controller[_0x74d8('0x15')]);router['post'](_0x74d8('0x11'),auth['isAuthenticated'](),controller[_0x74d8('0x16')]);router[_0x74d8('0x17')](_0x74d8('0x13'),auth[_0x74d8('0xc')](),controller[_0x74d8('0x18')]);router[_0x74d8('0x19')](_0x74d8('0x1a'),auth[_0x74d8('0xc')](),controller['update']);router[_0x74d8('0x1b')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x74d8('0x1b')]('/:id/teams',auth[_0x74d8('0xc')](),controller['removeTeams']);router[_0x74d8('0x1b')](_0x74d8('0x13'),auth[_0x74d8('0xc')](),controller[_0x74d8('0x1c')]);module[_0x74d8('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 56e485b..de40bb5 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 _0x2720=['beepall','roundrobin','sequelize','exports','STRING','rrmemory'];(function(_0x1f7120,_0x53456a){var _0x512142=function(_0xae9761){while(--_0xae9761){_0x1f7120['push'](_0x1f7120['shift']());}};_0x512142(++_0x53456a);}(_0x2720,0xfe));var _0x0272=function(_0x57615d,_0x4ec9dc){_0x57615d=_0x57615d-0x0;var _0x4befec=_0x2720[_0x57615d];return _0x4befec;};'use strict';var Sequelize=require(_0x0272('0x0'));module[_0x0272('0x1')]={'name':{'type':Sequelize[_0x0272('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0272('0x3'),_0x0272('0x4'),_0x0272('0x5'))}}; \ No newline at end of file +var _0x2264=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x3780cb,_0x1f9f7f){var _0x457ad9=function(_0x722822){while(--_0x722822){_0x3780cb['push'](_0x3780cb['shift']());}};_0x457ad9(++_0x1f9f7f);}(_0x2264,0x1a6));var _0x4226=function(_0x28d345,_0x258c0a){_0x28d345=_0x28d345-0x0;var _0x412cd8=_0x2264[_0x28d345];return _0x412cd8;};'use strict';var Sequelize=require(_0x4226('0x0'));module[_0x4226('0x1')]={'name':{'type':Sequelize[_0x4226('0x2')],'unique':_0x4226('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4226('0x2')]},'timeout':{'type':Sequelize[_0x4226('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4226('0x5')](_0x4226('0x6'),'beepall',_0x4226('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 520e94f..6a41841 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 _0x05a1=['select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','OpenchannelQueues','UserProfileResource','error','name','send','index','map','OpenchannelQueue','rawAttributes','type','key','getOptions','query','findAll','catch','show','params','model','keys','filters','intersection','attributes','length','includeAll','merge','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','fields','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelQueueId','filter','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','addTeams','ids','User','Agents','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams'];(function(_0x268313,_0x4c5fb9){var _0x508666=function(_0x4e048f){while(--_0x4e048f){_0x268313['push'](_0x268313['shift']());}};_0x508666(++_0x4c5fb9);}(_0x05a1,0x195));var _0x105a=function(_0x3d678a,_0xeba3ec){_0x3d678a=_0x3d678a-0x0;var _0x3f2051=_0x05a1[_0x3d678a];return _0x3f2051;};'use strict';var BPromise=require(_0x105a('0x0'));var util=require(_0x105a('0x1'));var _=require(_0x105a('0x2'));var squel=require(_0x105a('0x3'));var Redis=require('ioredis');var qs=require(_0x105a('0x4'));var logger=require(_0x105a('0x5'))(_0x105a('0x6'));var config=require(_0x105a('0x7'));var db=require(_0x105a('0x8'))['db'];config[_0x105a('0x9')]=_['defaults'](config['redis'],{'host':_0x105a('0xa'),'port':0x18eb});var socket=require(_0x105a('0xb'))(new Redis(config[_0x105a('0x9')]));require('./openchannelQueue.socket')[_0x105a('0xc')](socket);function respondWithStatusCode(_0x1662dc,_0x3f3b73){_0x3f3b73=_0x3f3b73||0xcc;return function(_0x4c1f22){if(_0x4c1f22){return _0x1662dc[_0x105a('0xd')](_0x3f3b73);}return _0x1662dc['status'](_0x3f3b73)[_0x105a('0xe')]();};}function respondWithResult(_0x362c2c,_0x1bf03a){_0x1bf03a=_0x1bf03a||0xc8;return function(_0x315efa){if(_0x315efa){return _0x362c2c[_0x105a('0xf')](_0x1bf03a)[_0x105a('0x10')](_0x315efa);}};}function respondWithFilteredResult(_0x5a00f2,_0x4de975){return function(_0xd24da4){if(_0xd24da4){var _0x42e4bf=typeof _0x4de975[_0x105a('0x11')]===_0x105a('0x12')&&typeof _0x4de975[_0x105a('0x13')]===_0x105a('0x12');var _0x50e361=_0xd24da4['count'];var _0x204b1b=_0x42e4bf?0x0:_0x4de975['offset'];var _0x56f878=_0x42e4bf?_0xd24da4[_0x105a('0x14')]:_0x4de975[_0x105a('0x11')]+_0x4de975['limit'];var _0xafcdb0;if(_0x56f878>=_0x50e361){_0x56f878=_0x50e361;_0xafcdb0=0xc8;}else{_0xafcdb0=0xce;}_0x5a00f2[_0x105a('0xf')](_0xafcdb0);return _0x5a00f2[_0x105a('0x15')](_0x105a('0x16'),_0x204b1b+'-'+_0x56f878+'/'+_0x50e361)[_0x105a('0x10')](_0xd24da4);}return null;};}function saveUpdates(_0x2765e2){return function(_0x4d2dac){if(_0x4d2dac){return _0x4d2dac[_0x105a('0x17')](_0x2765e2)[_0x105a('0x18')](function(_0x1a723e){return _0x1a723e;});}return null;};}function removeEntity(_0x15c66f){return function(_0x1b5753){if(_0x1b5753){return _0x1b5753[_0x105a('0x19')]()[_0x105a('0x18')](function(){var _0x29c695=_0x1b5753['get']({'plain':!![]});var _0x1f879f=_0x105a('0x1a');return db[_0x105a('0x1b')]['destroy']({'where':{'type':_0x1f879f,'resourceId':_0x29c695['id']}})[_0x105a('0x18')](function(){return _0x1b5753;});})[_0x105a('0x18')](function(){_0x15c66f[_0x105a('0xf')](0xcc)[_0x105a('0xe')]();});}};}function handleEntityNotFound(_0x3a5200){return function(_0x356d00){if(!_0x356d00){_0x3a5200['sendStatus'](0x194);}return _0x356d00;};}function handleError(_0x1c58a4,_0x1f0b51){_0x1f0b51=_0x1f0b51||0x1f4;return function(_0x5cdb48){logger[_0x105a('0x1c')](_0x5cdb48['stack']);if(_0x5cdb48[_0x105a('0x1d')]){delete _0x5cdb48[_0x105a('0x1d')];}_0x1c58a4['status'](_0x1f0b51)[_0x105a('0x1e')](_0x5cdb48);};}exports[_0x105a('0x1f')]=function(_0x392e76,_0x57087b){var _0x1a411d={};var _0x1b15e8={'count':0x0,'rows':[]};var _0x16fab6=_[_0x105a('0x20')](db[_0x105a('0x21')][_0x105a('0x22')],function(_0x225c21){return{'name':_0x225c21['fieldName'],'type':_0x225c21[_0x105a('0x23')][_0x105a('0x24')]};});_0x1a411d=qs[_0x105a('0x25')](_0x16fab6,_0x392e76);var _0x32ebb7={'where':_0x1a411d['where']};return db[_0x105a('0x21')][_0x105a('0x14')](_0x32ebb7)['then'](function(_0x1bf43d){_0x1b15e8['count']=_0x1bf43d;_0x1a411d['include']=qs['include'](_0x392e76[_0x105a('0x26')]);return db[_0x105a('0x21')][_0x105a('0x27')](_0x1a411d);})[_0x105a('0x18')](function(_0x330c61){_0x1b15e8['rows']=_0x330c61;return _0x1b15e8;})[_0x105a('0x18')](respondWithFilteredResult(_0x57087b,_0x1a411d))[_0x105a('0x28')](handleError(_0x57087b,null));};exports[_0x105a('0x29')]=function(_0x27256b,_0x35e68c){var _0x5021f2={'raw':!![],'where':{'id':_0x27256b[_0x105a('0x2a')]['id']}},_0x58be2f={};_0x58be2f[_0x105a('0x2b')]=_[_0x105a('0x2c')](db[_0x105a('0x21')][_0x105a('0x22')]);_0x58be2f[_0x105a('0x26')]=_[_0x105a('0x2c')](_0x27256b[_0x105a('0x26')]);_0x58be2f[_0x105a('0x2d')]=_[_0x105a('0x2e')](_0x58be2f['model'],_0x58be2f['query']);_0x5021f2[_0x105a('0x2f')]=_[_0x105a('0x2e')](_0x58be2f['model'],qs['fields'](_0x27256b[_0x105a('0x26')]['fields']));_0x5021f2[_0x105a('0x2f')]=_0x5021f2[_0x105a('0x2f')][_0x105a('0x30')]?_0x5021f2[_0x105a('0x2f')]:_0x58be2f[_0x105a('0x2b')];if(_0x27256b[_0x105a('0x26')][_0x105a('0x31')]){_0x5021f2['include']=[{'all':!![]}];}_0x5021f2=_[_0x105a('0x32')]({},_0x5021f2,_0x27256b[_0x105a('0x33')]);return db['OpenchannelQueue'][_0x105a('0x34')](_0x5021f2)['then'](handleEntityNotFound(_0x35e68c,null))[_0x105a('0x18')](respondWithResult(_0x35e68c,null))[_0x105a('0x28')](handleError(_0x35e68c,null));};exports['create']=function(_0x18ac21,_0x5930bb){return db[_0x105a('0x21')][_0x105a('0x35')](_0x18ac21[_0x105a('0x36')],{})[_0x105a('0x18')](function(_0x5c4faf){var _0x478034=_0x18ac21['user'][_0x105a('0x37')]({'plain':!![]});if(!_0x478034)throw new Error(_0x105a('0x38'));if(_0x478034[_0x105a('0x39')]===_0x105a('0x3a')){var _0x431d19=_0x5c4faf['get']({'plain':!![]});var _0x3887d7=_0x105a('0x1a');return db[_0x105a('0x3b')]['find']({'where':{'name':_0x3887d7,'userProfileId':_0x478034[_0x105a('0x3c')]},'raw':!![]})[_0x105a('0x18')](function(_0x3b8120){if(_0x3b8120&&_0x3b8120[_0x105a('0x3d')]===0x0){return db['UserProfileResource']['create']({'name':_0x431d19[_0x105a('0x1d')],'resourceId':_0x431d19['id'],'type':_0x3b8120[_0x105a('0x1d')],'sectionId':_0x3b8120['id']},{})[_0x105a('0x18')](function(){return _0x5c4faf;});}else{return _0x5c4faf;}})[_0x105a('0x28')](function(_0x2a8bbc){logger['error'](_0x105a('0x3e'),_0x2a8bbc);throw _0x2a8bbc;});}return _0x5c4faf;})[_0x105a('0x18')](respondWithResult(_0x5930bb,0xc9))[_0x105a('0x28')](handleError(_0x5930bb,null));};exports[_0x105a('0x17')]=function(_0x33a9d4,_0x1e1368){if(_0x33a9d4['body']['id']){delete _0x33a9d4[_0x105a('0x36')]['id'];}return db[_0x105a('0x21')]['find']({'where':{'id':_0x33a9d4[_0x105a('0x2a')]['id']}})[_0x105a('0x18')](handleEntityNotFound(_0x1e1368,null))[_0x105a('0x18')](saveUpdates(_0x33a9d4[_0x105a('0x36')],null))[_0x105a('0x18')](respondWithResult(_0x1e1368,null))['catch'](handleError(_0x1e1368,null));};exports['destroy']=function(_0x407619,_0x4e6e9e){return db[_0x105a('0x21')][_0x105a('0x34')]({'where':{'id':_0x407619['params']['id']}})['then'](handleEntityNotFound(_0x4e6e9e,null))[_0x105a('0x18')](removeEntity(_0x4e6e9e,null))[_0x105a('0x28')](handleError(_0x4e6e9e,null));};exports[_0x105a('0x3f')]=function(_0x29823a,_0x33b140){return db[_0x105a('0x21')][_0x105a('0x3f')]()[_0x105a('0x18')](respondWithResult(_0x33b140,null))[_0x105a('0x28')](handleError(_0x33b140,null));};exports[_0x105a('0x40')]=function(_0x19de94,_0x1068db){var _0x5a7b2a={'raw':!![],'where':{}},_0x4c16aa={},_0x4b6657;return db[_0x105a('0x21')][_0x105a('0x41')]({'where':{'id':_0x19de94['params']['id']}})[_0x105a('0x18')](handleEntityNotFound(_0x1068db,null))[_0x105a('0x18')](function(_0x598d3a){if(_0x598d3a){_0x4b6657=_0x598d3a['get']({'plain':!![]});_0x4c16aa[_0x105a('0x2b')]=_[_0x105a('0x2c')](db[_0x105a('0x42')][_0x105a('0x22')]);_0x4c16aa['query']=_[_0x105a('0x2c')](_0x19de94[_0x105a('0x26')]);_0x4c16aa['filters']=_[_0x105a('0x2e')](_0x4c16aa[_0x105a('0x2b')],_0x4c16aa[_0x105a('0x26')]);_0x5a7b2a[_0x105a('0x2f')]=_['intersection'](_0x4c16aa[_0x105a('0x2b')],qs[_0x105a('0x43')](_0x19de94['query'][_0x105a('0x43')]));_0x5a7b2a[_0x105a('0x2f')]=_0x5a7b2a['attributes']['length']?_0x5a7b2a['attributes']:_0x4c16aa['model'];if(!_0x19de94[_0x105a('0x26')][_0x105a('0x44')](_0x105a('0x45'))){_0x5a7b2a[_0x105a('0x13')]=qs['limit'](_0x19de94[_0x105a('0x26')][_0x105a('0x13')]);_0x5a7b2a['offset']=qs[_0x105a('0x11')](_0x19de94[_0x105a('0x26')]['offset']);}_0x5a7b2a[_0x105a('0x46')]=qs[_0x105a('0x47')](_0x19de94[_0x105a('0x26')][_0x105a('0x47')]);_0x5a7b2a[_0x105a('0x48')]=qs[_0x105a('0x2d')](_[_0x105a('0x49')](_0x19de94[_0x105a('0x26')],_0x4c16aa[_0x105a('0x2d')]));_0x5a7b2a[_0x105a('0x48')][_0x105a('0x4a')]=_0x598d3a['id'];if(_0x19de94['query'][_0x105a('0x4b')]){_0x5a7b2a[_0x105a('0x48')]=_[_0x105a('0x32')](_0x5a7b2a[_0x105a('0x48')],{'$or':_[_0x105a('0x20')](_0x5a7b2a[_0x105a('0x2f')],function(_0x112fe4){var _0x4a2d81={};_0x4a2d81[_0x112fe4]={'$like':'%'+_0x19de94[_0x105a('0x26')][_0x105a('0x4b')]+'%'};return _0x4a2d81;})});}_0x5a7b2a=_[_0x105a('0x32')]({},_0x5a7b2a,_0x19de94[_0x105a('0x33')]);return db[_0x105a('0x42')][_0x105a('0x27')](_0x5a7b2a);}})[_0x105a('0x18')](function(_0x189d3a){if(_0x189d3a){return db['User'][_0x105a('0x4c')]({'where':{'id':_[_0x105a('0x20')](_0x189d3a,'UserId'),'role':_0x105a('0x4d')},'attributes':['id','name',_0x105a('0x4e'),_0x105a('0x4f'),_0x105a('0x50')]});}})[_0x105a('0x18')](function(_0x22c9bc){if(_0x22c9bc){return{'count':_0x22c9bc[_0x105a('0x14')],'rows':_[_0x105a('0x20')](_0x22c9bc[_0x105a('0x51')],function(_0x42f83b){return{'membername':_0x42f83b[_0x105a('0x1d')],'UserId':_0x42f83b['id'],'queue_name':_0x4b6657[_0x105a('0x1d')],'OpenchannelQueueId':_0x4b6657['id'],'interface':util[_0x105a('0x52')](_0x105a('0x53'),'SIP',_0x42f83b[_0x105a('0x1d')]),'penalty':0x0,'paused':_0x42f83b[_0x105a('0x4e')],'createdAt':_0x42f83b[_0x105a('0x50')],'updatedAt':_0x42f83b[_0x105a('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1068db,_0x5a7b2a))[_0x105a('0x28')](handleError(_0x1068db,null));};exports[_0x105a('0x54')]=function(_0x46a449,_0x250800){var _0x2f5313={};var _0x2e0e01={};var _0x3d69e3;var _0x381226;return db[_0x105a('0x21')][_0x105a('0x41')]({'where':{'id':_0x46a449['params']['id']}})[_0x105a('0x18')](handleEntityNotFound(_0x250800,null))['then'](function(_0x53151c){if(_0x53151c){_0x3d69e3=_0x53151c;_0x2e0e01['model']=_['keys'](db[_0x105a('0x55')][_0x105a('0x22')]);_0x2e0e01[_0x105a('0x26')]=_[_0x105a('0x2c')](_0x46a449[_0x105a('0x26')]);_0x2e0e01[_0x105a('0x2d')]=_[_0x105a('0x2e')](_0x2e0e01['model'],_0x2e0e01[_0x105a('0x26')]);_0x2f5313[_0x105a('0x2f')]=_[_0x105a('0x2e')](_0x2e0e01['model'],qs[_0x105a('0x43')](_0x46a449[_0x105a('0x26')][_0x105a('0x43')]));_0x2f5313[_0x105a('0x2f')]=_0x2f5313[_0x105a('0x2f')][_0x105a('0x30')]?_0x2f5313[_0x105a('0x2f')]:_0x2e0e01[_0x105a('0x2b')];_0x2f5313[_0x105a('0x46')]=qs['sort'](_0x46a449[_0x105a('0x26')][_0x105a('0x47')]);_0x2f5313[_0x105a('0x48')]=qs['filters'](_['pick'](_0x46a449[_0x105a('0x26')],_0x2e0e01['filters']));if(_0x46a449['query'][_0x105a('0x4b')]){_0x2f5313[_0x105a('0x48')]=_[_0x105a('0x32')](_0x2f5313[_0x105a('0x48')],{'$or':_[_0x105a('0x20')](_0x2f5313[_0x105a('0x2f')],function(_0x47d1cb){var _0x16515a={};_0x16515a[_0x47d1cb]={'$like':'%'+_0x46a449[_0x105a('0x26')][_0x105a('0x4b')]+'%'};return _0x16515a;})});}_0x2f5313=_[_0x105a('0x32')]({},_0x2f5313,_0x46a449[_0x105a('0x33')]);return _0x3d69e3[_0x105a('0x54')](_0x2f5313);}})['then'](function(_0x3ca0d1){if(_0x3ca0d1){_0x381226=_0x3ca0d1[_0x105a('0x30')];if(!_0x46a449[_0x105a('0x26')]['hasOwnProperty']('nolimit')){_0x2f5313[_0x105a('0x13')]=qs[_0x105a('0x13')](_0x46a449[_0x105a('0x26')][_0x105a('0x13')]);_0x2f5313[_0x105a('0x11')]=qs[_0x105a('0x11')](_0x46a449['query'][_0x105a('0x11')]);}return _0x3d69e3['getTeams'](_0x2f5313);}})[_0x105a('0x18')](function(_0x5af101){if(_0x5af101){return _0x5af101?{'count':_0x381226,'rows':_0x5af101}:null;}})[_0x105a('0x18')](respondWithResult(_0x250800,null))[_0x105a('0x28')](handleError(_0x250800,null));};exports[_0x105a('0x56')]=function(_0x18b2f5,_0x5b9d08){var _0x4d5188=_0x18b2f5['body'][_0x105a('0x57')];return db[_0x105a('0x55')][_0x105a('0x27')]({'where':{'id':_0x4d5188},'attributes':['id'],'include':[{'model':db[_0x105a('0x58')],'as':_0x105a('0x59'),'attributes':['id','name','online','voicePause',_0x105a('0x5a')],'raw':!![]}]})[_0x105a('0x18')](function(_0x2b58b2){if(_0x2b58b2){var _0x166955=_[_0x105a('0x5b')](_0x2b58b2,function(_0x1f723a){var _0x19c310=_0x1f723a['get']({'plain':!![]});return _0x19c310[_0x105a('0x59')];});return db[_0x105a('0x21')][_0x105a('0x34')]({'where':{'id':_0x18b2f5['params']['id']}})['then'](function(_0x46dabd){return db[_0x105a('0x5c')][_0x105a('0x5d')](function(_0x4f82e9){return _0x46dabd[_0x105a('0x56')](_0x4d5188,{'transaction':_0x4f82e9})['then'](function(){return BPromise['each'](_0x166955,function(_0x44634e){return db[_0x105a('0x42')][_0x105a('0x5e')]({'where':{'UserId':_0x44634e['id'],'OpenchannelQueueId':_0x18b2f5[_0x105a('0x2a')]['id']},'transaction':_0x4f82e9});});})[_0x105a('0x18')](function(){_0x166955[_0x105a('0x5f')](function(_0x4d65c3){socket[_0x105a('0x60')](_0x105a('0x61'),{'UserId':_0x4d65c3['id'],'OpenchannelQueueId':_0x46dabd['id']});});});});});}})[_0x105a('0x18')](respondWithStatusCode(_0x5b9d08,null))[_0x105a('0x28')](handleError(_0x5b9d08,null));};exports[_0x105a('0x62')]=function(_0x42e946,_0x1a840d){return db[_0x105a('0x55')][_0x105a('0x27')]({'where':{'id':_0x42e946[_0x105a('0x26')]['ids']},'attributes':['id'],'include':[{'model':db[_0x105a('0x58')],'as':_0x105a('0x59'),'attributes':['id'],'raw':!![]}]})[_0x105a('0x18')](handleEntityNotFound(_0x1a840d,null))['then'](function(_0x438a2a){var _0x488dca=_[_0x105a('0x20')](_0x438a2a,'id');var _0x4b0c9a=[];var _0x3d3c23=[];var _0x44364a=squel[_0x105a('0x63')]();_0x44364a[_0x105a('0x64')](_0x105a('0x65'))[_0x105a('0x66')](_0x105a('0x67'),'tq')[_0x105a('0x68')](_0x105a('0x69'),'ut',_0x105a('0x6a'))[_0x105a('0x48')]('OpenchannelQueueId\x20=\x20?',_0x42e946[_0x105a('0x2a')]['id']);for(var _0x1610db=0x0;_0x1610db<_0x438a2a[_0x105a('0x30')];_0x1610db+=0x1){let _0x301b93=_0x438a2a[_0x1610db];for(var _0x2cde4c=0x0;_0x2cde4c<_0x301b93[_0x105a('0x59')][_0x105a('0x30')];_0x2cde4c+=0x1){let _0x1e04c7=_0x301b93['Agents'][_0x2cde4c];var _0x569c95=_0x44364a[_0x105a('0x6b')]();_0x569c95[_0x105a('0x48')](_0x105a('0x6c'),_0x1e04c7['id']);_0x3d3c23[_0x105a('0x6d')](db[_0x105a('0x5c')][_0x105a('0x26')](_0x569c95[_0x105a('0x6e')](),{'type':db['sequelize'][_0x105a('0x6f')]['SELECT']})[_0x105a('0x18')](function(_0x551fdd){if(_0x551fdd['length']===0x1){return _0x1e04c7['id'];}else{var _0xb4abc2=_[_0x105a('0x70')](_[_0x105a('0x20')](_0x551fdd,_0x105a('0x71')),function(_0x3d9be0){return _[_0x105a('0x72')](_0x488dca,_0x3d9be0);});if(_0xb4abc2){return _0x1e04c7['id'];}}}));}}return BPromise[_0x105a('0x73')](_0x3d3c23)[_0x105a('0x18')](function(_0x12bfe3){_0x4b0c9a=_(_0x4b0c9a)[_0x105a('0x74')](_0x12bfe3)[_0x105a('0x75')]()[_0x105a('0x76')]();return db[_0x105a('0x21')]['find']({'where':{'id':_0x42e946[_0x105a('0x2a')]['id']}})[_0x105a('0x18')](function(_0x566e08){return db[_0x105a('0x5c')][_0x105a('0x5d')](function(_0x4f8c16){return _0x566e08[_0x105a('0x62')](_0x42e946['query'][_0x105a('0x57')],{'transaction':_0x4f8c16})[_0x105a('0x18')](function(){if(!_[_0x105a('0x77')](_0x4b0c9a)){return _0x566e08[_0x105a('0x78')](_0x4b0c9a,{'transaction':_0x4f8c16});}})[_0x105a('0x18')](function(){_0x4b0c9a[_0x105a('0x5f')](function(_0x45737e){socket[_0x105a('0x60')](_0x105a('0x79'),{'UserId':_0x45737e,'OpenchannelQueueId':_0x566e08['id']});});});});});});})['then'](respondWithStatusCode(_0x1a840d,null))[_0x105a('0x28')](handleError(_0x1a840d,null));};exports[_0x105a('0x7a')]=function(_0x1e43c6,_0x5b9146){return db[_0x105a('0x21')]['find']({'where':{'id':_0x1e43c6[_0x105a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b9146,null))[_0x105a('0x18')](function(_0xffd057){if(_0xffd057){return _0xffd057[_0x105a('0x7a')](_0x1e43c6[_0x105a('0x36')][_0x105a('0x57')],_['omit'](_0x1e43c6[_0x105a('0x36')],['ids','id'])||{})[_0x105a('0x7b')](function(_0x155975){for(var _0x2920ab=0x0;_0x2920ab<_0x1e43c6[_0x105a('0x36')][_0x105a('0x57')][_0x105a('0x30')];_0x2920ab+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x1e43c6[_0x105a('0x36')]['ids'][_0x2920ab]),'OpenchannelQueueId':Number(_0x1e43c6['params']['id'])});}return _0x155975;});}})['then'](respondWithResult(_0x5b9146,null))[_0x105a('0x28')](handleError(_0x5b9146,null));};exports[_0x105a('0x78')]=function(_0x30a7eb,_0x165ecb){return db[_0x105a('0x21')][_0x105a('0x34')]({'where':{'id':_0x30a7eb[_0x105a('0x2a')]['id']}})[_0x105a('0x18')](handleEntityNotFound(_0x165ecb,null))[_0x105a('0x18')](function(_0xf611d0){if(_0xf611d0){return _0xf611d0[_0x105a('0x78')](_0x30a7eb[_0x105a('0x26')][_0x105a('0x57')])[_0x105a('0x18')](function(){if(_[_0x105a('0x7c')](_0x30a7eb[_0x105a('0x26')][_0x105a('0x57')])){for(var _0x1a34be=0x0;_0x1a34be<_0x30a7eb[_0x105a('0x26')][_0x105a('0x57')]['length'];_0x1a34be+=0x1){socket[_0x105a('0x60')](_0x105a('0x79'),{'UserId':Number(_0x30a7eb[_0x105a('0x26')][_0x105a('0x57')][_0x1a34be]),'OpenchannelQueueId':Number(_0x30a7eb[_0x105a('0x2a')]['id'])});}}else{socket[_0x105a('0x60')](_0x105a('0x79'),{'UserId':Number(_0x30a7eb['query'][_0x105a('0x57')]),'OpenchannelQueueId':Number(_0x30a7eb[_0x105a('0x2a')]['id'])});}});}})[_0x105a('0x18')](respondWithStatusCode(_0x165ecb,null))[_0x105a('0x28')](handleError(_0x165ecb,null));};exports['getAgents']=function(_0x91bdf7,_0x3a7389){var _0x6d0b19={};var _0x3af007={};var _0x5d4c00;var _0x5b4609;return db[_0x105a('0x21')][_0x105a('0x41')]({'where':{'id':_0x91bdf7[_0x105a('0x2a')]['id']}})[_0x105a('0x18')](handleEntityNotFound(_0x3a7389,null))[_0x105a('0x18')](function(_0x39b4c9){if(_0x39b4c9){_0x5d4c00=_0x39b4c9;_0x3af007['model']=_['keys'](db[_0x105a('0x58')][_0x105a('0x22')]);_0x3af007[_0x105a('0x26')]=_[_0x105a('0x2c')](_0x91bdf7['query']);_0x3af007['filters']=_['intersection'](_0x3af007[_0x105a('0x2b')],_0x3af007[_0x105a('0x26')]);_0x6d0b19[_0x105a('0x2f')]=_[_0x105a('0x2e')](_0x3af007[_0x105a('0x2b')],qs['fields'](_0x91bdf7[_0x105a('0x26')][_0x105a('0x43')]));_0x6d0b19[_0x105a('0x2f')]=_0x6d0b19['attributes'][_0x105a('0x30')]?_0x6d0b19[_0x105a('0x2f')]:_0x3af007[_0x105a('0x2b')];_0x6d0b19[_0x105a('0x46')]=qs[_0x105a('0x47')](_0x91bdf7[_0x105a('0x26')]['sort']);_0x6d0b19[_0x105a('0x48')]=qs['filters'](_[_0x105a('0x49')](_0x91bdf7[_0x105a('0x26')],_0x3af007[_0x105a('0x2d')]));if(_0x91bdf7[_0x105a('0x26')][_0x105a('0x4b')]){_0x6d0b19[_0x105a('0x48')]=_[_0x105a('0x32')](_0x6d0b19['where'],{'$or':_[_0x105a('0x20')](_0x6d0b19[_0x105a('0x2f')],function(_0x3e6e09){var _0x54867b={};_0x54867b[_0x3e6e09]={'$like':'%'+_0x91bdf7[_0x105a('0x26')][_0x105a('0x4b')]+'%'};return _0x54867b;})});}_0x6d0b19=_[_0x105a('0x32')]({},_0x6d0b19,_0x91bdf7[_0x105a('0x33')]);return _0x5d4c00[_0x105a('0x7d')](_0x6d0b19);}})[_0x105a('0x18')](function(_0x40be2b){if(_0x40be2b){_0x5b4609=_0x40be2b[_0x105a('0x30')];if(!_0x91bdf7[_0x105a('0x26')][_0x105a('0x44')]('nolimit')){_0x6d0b19[_0x105a('0x13')]=qs[_0x105a('0x13')](_0x91bdf7[_0x105a('0x26')]['limit']);_0x6d0b19[_0x105a('0x11')]=qs[_0x105a('0x11')](_0x91bdf7[_0x105a('0x26')][_0x105a('0x11')]);}return _0x5d4c00[_0x105a('0x7d')](_0x6d0b19);}})[_0x105a('0x18')](function(_0x16805c){if(_0x16805c){return _0x16805c?{'count':_0x5b4609,'rows':_0x16805c}:null;}})[_0x105a('0x18')](respondWithResult(_0x3a7389,null))[_0x105a('0x28')](handleError(_0x3a7389,null));}; \ No newline at end of file +var _0x92f5=['nolimit','order','sort','where','pick','filter','merge','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','rows','format','SIP','getTeams','hasOwnProperty','addTeams','ids','Team','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Agents','select','from','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','omit','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','then','OpenchannelQueues','error','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','include','findAll','catch','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','options','find','create','body','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x92f5,0xa6));var _0x592f=function(_0xc051b2,_0x3d6d9d){_0xc051b2=_0xc051b2-0x0;var _0x599dc2=_0x92f5[_0xc051b2];return _0x599dc2;};'use strict';var BPromise=require(_0x592f('0x0'));var util=require(_0x592f('0x1'));var _=require(_0x592f('0x2'));var squel=require(_0x592f('0x3'));var Redis=require(_0x592f('0x4'));var qs=require(_0x592f('0x5'));var logger=require('../../config/logger')(_0x592f('0x6'));var config=require(_0x592f('0x7'));var db=require(_0x592f('0x8'))['db'];config[_0x592f('0x9')]=_[_0x592f('0xa')](config[_0x592f('0x9')],{'host':_0x592f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x592f('0x9')]));require(_0x592f('0xc'))[_0x592f('0xd')](socket);function respondWithStatusCode(_0x14ef3f,_0x49f303){_0x49f303=_0x49f303||0xcc;return function(_0x35cf4a){if(_0x35cf4a){return _0x14ef3f[_0x592f('0xe')](_0x49f303);}return _0x14ef3f[_0x592f('0xf')](_0x49f303)[_0x592f('0x10')]();};}function respondWithResult(_0x4be3d8,_0x3dd9d7){_0x3dd9d7=_0x3dd9d7||0xc8;return function(_0x40fd6){if(_0x40fd6){return _0x4be3d8[_0x592f('0xf')](_0x3dd9d7)[_0x592f('0x11')](_0x40fd6);}};}function respondWithFilteredResult(_0x4b2a8a,_0x7c43f3){return function(_0x364f3c){if(_0x364f3c){var _0x529bf0=typeof _0x7c43f3[_0x592f('0x12')]===_0x592f('0x13')&&typeof _0x7c43f3[_0x592f('0x14')]===_0x592f('0x13');var _0x4ca4ba=_0x364f3c[_0x592f('0x15')];var _0x22574e=_0x529bf0?0x0:_0x7c43f3[_0x592f('0x12')];var _0x3c0e8a=_0x529bf0?_0x364f3c['count']:_0x7c43f3[_0x592f('0x12')]+_0x7c43f3[_0x592f('0x14')];var _0xe8e6dd;if(_0x3c0e8a>=_0x4ca4ba){_0x3c0e8a=_0x4ca4ba;_0xe8e6dd=0xc8;}else{_0xe8e6dd=0xce;}_0x4b2a8a['status'](_0xe8e6dd);return _0x4b2a8a[_0x592f('0x16')]('Content-Range',_0x22574e+'-'+_0x3c0e8a+'/'+_0x4ca4ba)[_0x592f('0x11')](_0x364f3c);}return null;};}function saveUpdates(_0x4b9121){return function(_0x5ec784){if(_0x5ec784){return _0x5ec784[_0x592f('0x17')](_0x4b9121)['then'](function(_0x4b4fa7){return _0x4b4fa7;});}return null;};}function removeEntity(_0x4ce4b2){return function(_0x11d156){if(_0x11d156){return _0x11d156[_0x592f('0x18')]()[_0x592f('0x19')](function(){var _0x89cfed=_0x11d156['get']({'plain':!![]});var _0x2afffa=_0x592f('0x1a');return db['UserProfileResource']['destroy']({'where':{'type':_0x2afffa,'resourceId':_0x89cfed['id']}})[_0x592f('0x19')](function(){return _0x11d156;});})[_0x592f('0x19')](function(){_0x4ce4b2['status'](0xcc)[_0x592f('0x10')]();});}};}function handleEntityNotFound(_0x4cde10){return function(_0xdd16b6){if(!_0xdd16b6){_0x4cde10[_0x592f('0xe')](0x194);}return _0xdd16b6;};}function handleError(_0x241edc,_0x184cf2){_0x184cf2=_0x184cf2||0x1f4;return function(_0x1961f1){logger[_0x592f('0x1b')](_0x1961f1['stack']);if(_0x1961f1[_0x592f('0x1c')]){delete _0x1961f1[_0x592f('0x1c')];}_0x241edc['status'](_0x184cf2)[_0x592f('0x1d')](_0x1961f1);};}exports[_0x592f('0x1e')]=function(_0x2c3168,_0x243e97){var _0x334165={};var _0x1f7057={'count':0x0,'rows':[]};var _0x2a0710=_[_0x592f('0x1f')](db[_0x592f('0x20')][_0x592f('0x21')],function(_0x1dc966){return{'name':_0x1dc966[_0x592f('0x22')],'type':_0x1dc966[_0x592f('0x23')][_0x592f('0x24')]};});_0x334165=qs[_0x592f('0x25')](_0x2a0710,_0x2c3168);var _0xa32aed={'where':_0x334165['where']};return db[_0x592f('0x20')][_0x592f('0x15')](_0xa32aed)[_0x592f('0x19')](function(_0x36da45){_0x1f7057[_0x592f('0x15')]=_0x36da45;_0x334165[_0x592f('0x26')]=qs[_0x592f('0x26')](_0x2c3168['query']);return db['OpenchannelQueue'][_0x592f('0x27')](_0x334165);})['then'](function(_0x4b3666){_0x1f7057['rows']=_0x4b3666;return _0x1f7057;})[_0x592f('0x19')](respondWithFilteredResult(_0x243e97,_0x334165))[_0x592f('0x28')](handleError(_0x243e97,null));};exports['show']=function(_0x25977a,_0x2d440a){var _0x34d07c={'raw':!![],'where':{'id':_0x25977a[_0x592f('0x29')]['id']}},_0x1c1142={};_0x1c1142[_0x592f('0x2a')]=_[_0x592f('0x2b')](db[_0x592f('0x20')]['rawAttributes']);_0x1c1142[_0x592f('0x2c')]=_[_0x592f('0x2b')](_0x25977a['query']);_0x1c1142[_0x592f('0x2d')]=_[_0x592f('0x2e')](_0x1c1142[_0x592f('0x2a')],_0x1c1142['query']);_0x34d07c['attributes']=_[_0x592f('0x2e')](_0x1c1142[_0x592f('0x2a')],qs[_0x592f('0x2f')](_0x25977a[_0x592f('0x2c')][_0x592f('0x2f')]));_0x34d07c['attributes']=_0x34d07c[_0x592f('0x30')][_0x592f('0x31')]?_0x34d07c[_0x592f('0x30')]:_0x1c1142[_0x592f('0x2a')];if(_0x25977a[_0x592f('0x2c')][_0x592f('0x32')]){_0x34d07c[_0x592f('0x26')]=[{'all':!![]}];}_0x34d07c=_['merge']({},_0x34d07c,_0x25977a[_0x592f('0x33')]);return db[_0x592f('0x20')][_0x592f('0x34')](_0x34d07c)[_0x592f('0x19')](handleEntityNotFound(_0x2d440a,null))[_0x592f('0x19')](respondWithResult(_0x2d440a,null))[_0x592f('0x28')](handleError(_0x2d440a,null));};exports[_0x592f('0x35')]=function(_0x475c71,_0x3458d8){return db[_0x592f('0x20')][_0x592f('0x35')](_0x475c71[_0x592f('0x36')],{})[_0x592f('0x19')](function(_0x2c05d0){var _0x3f60e3=_0x475c71['user']['get']({'plain':!![]});if(!_0x3f60e3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f60e3['role']===_0x592f('0x37')){var _0x5c7583=_0x2c05d0[_0x592f('0x38')]({'plain':!![]});var _0x1c11c8=_0x592f('0x1a');return db[_0x592f('0x39')][_0x592f('0x34')]({'where':{'name':_0x1c11c8,'userProfileId':_0x3f60e3['userProfileId']},'raw':!![]})[_0x592f('0x19')](function(_0x2c3709){if(_0x2c3709&&_0x2c3709[_0x592f('0x3a')]===0x0){return db['UserProfileResource']['create']({'name':_0x5c7583['name'],'resourceId':_0x5c7583['id'],'type':_0x2c3709[_0x592f('0x1c')],'sectionId':_0x2c3709['id']},{})[_0x592f('0x19')](function(){return _0x2c05d0;});}else{return _0x2c05d0;}})[_0x592f('0x28')](function(_0x180013){logger[_0x592f('0x1b')](_0x592f('0x3b'),_0x180013);throw _0x180013;});}return _0x2c05d0;})[_0x592f('0x19')](respondWithResult(_0x3458d8,0xc9))['catch'](handleError(_0x3458d8,null));};exports['update']=function(_0x603ff2,_0x50c647){if(_0x603ff2[_0x592f('0x36')]['id']){delete _0x603ff2[_0x592f('0x36')]['id'];}return db['OpenchannelQueue'][_0x592f('0x34')]({'where':{'id':_0x603ff2['params']['id']}})[_0x592f('0x19')](handleEntityNotFound(_0x50c647,null))[_0x592f('0x19')](saveUpdates(_0x603ff2[_0x592f('0x36')],null))['then'](respondWithResult(_0x50c647,null))[_0x592f('0x28')](handleError(_0x50c647,null));};exports[_0x592f('0x18')]=function(_0xd08e00,_0x45e833){return db[_0x592f('0x20')][_0x592f('0x34')]({'where':{'id':_0xd08e00[_0x592f('0x29')]['id']}})[_0x592f('0x19')](handleEntityNotFound(_0x45e833,null))[_0x592f('0x19')](removeEntity(_0x45e833,null))[_0x592f('0x28')](handleError(_0x45e833,null));};exports['describe']=function(_0x42de8c,_0x1e8f6e){return db['OpenchannelQueue'][_0x592f('0x3c')]()[_0x592f('0x19')](respondWithResult(_0x1e8f6e,null))[_0x592f('0x28')](handleError(_0x1e8f6e,null));};exports[_0x592f('0x3d')]=function(_0x3f74b0,_0x3dd7a9){var _0x4bc1e={'raw':!![],'where':{}},_0x46557b={},_0x4d0be4;return db[_0x592f('0x20')][_0x592f('0x3e')]({'where':{'id':_0x3f74b0[_0x592f('0x29')]['id']}})[_0x592f('0x19')](handleEntityNotFound(_0x3dd7a9,null))['then'](function(_0x161ad3){if(_0x161ad3){_0x4d0be4=_0x161ad3[_0x592f('0x38')]({'plain':!![]});_0x46557b[_0x592f('0x2a')]=_[_0x592f('0x2b')](db[_0x592f('0x3f')][_0x592f('0x21')]);_0x46557b[_0x592f('0x2c')]=_['keys'](_0x3f74b0[_0x592f('0x2c')]);_0x46557b['filters']=_[_0x592f('0x2e')](_0x46557b[_0x592f('0x2a')],_0x46557b['query']);_0x4bc1e[_0x592f('0x30')]=_[_0x592f('0x2e')](_0x46557b['model'],qs[_0x592f('0x2f')](_0x3f74b0[_0x592f('0x2c')]['fields']));_0x4bc1e['attributes']=_0x4bc1e[_0x592f('0x30')][_0x592f('0x31')]?_0x4bc1e[_0x592f('0x30')]:_0x46557b[_0x592f('0x2a')];if(!_0x3f74b0[_0x592f('0x2c')]['hasOwnProperty'](_0x592f('0x40'))){_0x4bc1e['limit']=qs[_0x592f('0x14')](_0x3f74b0[_0x592f('0x2c')][_0x592f('0x14')]);_0x4bc1e[_0x592f('0x12')]=qs[_0x592f('0x12')](_0x3f74b0[_0x592f('0x2c')][_0x592f('0x12')]);}_0x4bc1e[_0x592f('0x41')]=qs[_0x592f('0x42')](_0x3f74b0[_0x592f('0x2c')][_0x592f('0x42')]);_0x4bc1e[_0x592f('0x43')]=qs[_0x592f('0x2d')](_[_0x592f('0x44')](_0x3f74b0[_0x592f('0x2c')],_0x46557b['filters']));_0x4bc1e[_0x592f('0x43')]['OpenchannelQueueId']=_0x161ad3['id'];if(_0x3f74b0['query'][_0x592f('0x45')]){_0x4bc1e[_0x592f('0x43')]=_[_0x592f('0x46')](_0x4bc1e[_0x592f('0x43')],{'$or':_[_0x592f('0x1f')](_0x4bc1e[_0x592f('0x30')],function(_0x5b0cd1){var _0x307d60={};_0x307d60[_0x5b0cd1]={'$like':'%'+_0x3f74b0[_0x592f('0x2c')][_0x592f('0x45')]+'%'};return _0x307d60;})});}_0x4bc1e=_[_0x592f('0x46')]({},_0x4bc1e,_0x3f74b0[_0x592f('0x33')]);return db[_0x592f('0x3f')][_0x592f('0x27')](_0x4bc1e);}})['then'](function(_0xeba10c){if(_0xeba10c){return db[_0x592f('0x47')][_0x592f('0x48')]({'where':{'id':_[_0x592f('0x1f')](_0xeba10c,'UserId'),'role':_0x592f('0x49')},'attributes':['id',_0x592f('0x1c'),_0x592f('0x4a'),_0x592f('0x4b'),_0x592f('0x4c')]});}})[_0x592f('0x19')](function(_0x51daa9){if(_0x51daa9){return{'count':_0x51daa9[_0x592f('0x15')],'rows':_[_0x592f('0x1f')](_0x51daa9[_0x592f('0x4d')],function(_0x54897b){return{'membername':_0x54897b[_0x592f('0x1c')],'UserId':_0x54897b['id'],'queue_name':_0x4d0be4[_0x592f('0x1c')],'OpenchannelQueueId':_0x4d0be4['id'],'interface':util[_0x592f('0x4e')]('%s/%s',_0x592f('0x4f'),_0x54897b[_0x592f('0x1c')]),'penalty':0x0,'paused':_0x54897b[_0x592f('0x4a')],'createdAt':_0x54897b[_0x592f('0x4c')],'updatedAt':_0x54897b[_0x592f('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x592f('0x19')](respondWithFilteredResult(_0x3dd7a9,_0x4bc1e))['catch'](handleError(_0x3dd7a9,null));};exports['getTeams']=function(_0x446275,_0x861792){var _0x1f6553={};var _0x1cc360={};var _0x2a7cef;var _0x3732a9;return db[_0x592f('0x20')][_0x592f('0x3e')]({'where':{'id':_0x446275['params']['id']}})[_0x592f('0x19')](handleEntityNotFound(_0x861792,null))[_0x592f('0x19')](function(_0x5640ab){if(_0x5640ab){_0x2a7cef=_0x5640ab;_0x1cc360[_0x592f('0x2a')]=_[_0x592f('0x2b')](db['Team'][_0x592f('0x21')]);_0x1cc360[_0x592f('0x2c')]=_['keys'](_0x446275[_0x592f('0x2c')]);_0x1cc360['filters']=_[_0x592f('0x2e')](_0x1cc360[_0x592f('0x2a')],_0x1cc360[_0x592f('0x2c')]);_0x1f6553['attributes']=_[_0x592f('0x2e')](_0x1cc360[_0x592f('0x2a')],qs['fields'](_0x446275[_0x592f('0x2c')][_0x592f('0x2f')]));_0x1f6553[_0x592f('0x30')]=_0x1f6553[_0x592f('0x30')]['length']?_0x1f6553['attributes']:_0x1cc360[_0x592f('0x2a')];_0x1f6553[_0x592f('0x41')]=qs[_0x592f('0x42')](_0x446275['query'][_0x592f('0x42')]);_0x1f6553[_0x592f('0x43')]=qs[_0x592f('0x2d')](_[_0x592f('0x44')](_0x446275[_0x592f('0x2c')],_0x1cc360['filters']));if(_0x446275[_0x592f('0x2c')][_0x592f('0x45')]){_0x1f6553[_0x592f('0x43')]=_[_0x592f('0x46')](_0x1f6553[_0x592f('0x43')],{'$or':_[_0x592f('0x1f')](_0x1f6553[_0x592f('0x30')],function(_0x1d6363){var _0xf94579={};_0xf94579[_0x1d6363]={'$like':'%'+_0x446275[_0x592f('0x2c')][_0x592f('0x45')]+'%'};return _0xf94579;})});}_0x1f6553=_[_0x592f('0x46')]({},_0x1f6553,_0x446275['options']);return _0x2a7cef[_0x592f('0x50')](_0x1f6553);}})[_0x592f('0x19')](function(_0xa485fa){if(_0xa485fa){_0x3732a9=_0xa485fa['length'];if(!_0x446275[_0x592f('0x2c')][_0x592f('0x51')]('nolimit')){_0x1f6553[_0x592f('0x14')]=qs[_0x592f('0x14')](_0x446275[_0x592f('0x2c')][_0x592f('0x14')]);_0x1f6553[_0x592f('0x12')]=qs[_0x592f('0x12')](_0x446275[_0x592f('0x2c')]['offset']);}return _0x2a7cef['getTeams'](_0x1f6553);}})['then'](function(_0x199a75){if(_0x199a75){return _0x199a75?{'count':_0x3732a9,'rows':_0x199a75}:null;}})[_0x592f('0x19')](respondWithResult(_0x861792,null))[_0x592f('0x28')](handleError(_0x861792,null));};exports[_0x592f('0x52')]=function(_0x121d6d,_0x3b5b4c){var _0x5b5071=_0x121d6d['body'][_0x592f('0x53')];return db[_0x592f('0x54')]['findAll']({'where':{'id':_0x5b5071},'attributes':['id'],'include':[{'model':db[_0x592f('0x47')],'as':'Agents','attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})['then'](function(_0x240323){if(_0x240323){var _0x19983d=_[_0x592f('0x55')](_0x240323,function(_0x625fa2){var _0x291cbc=_0x625fa2['get']({'plain':!![]});return _0x291cbc['Agents'];});return db[_0x592f('0x20')][_0x592f('0x34')]({'where':{'id':_0x121d6d['params']['id']}})[_0x592f('0x19')](function(_0x1b9a9b){return db[_0x592f('0x56')][_0x592f('0x57')](function(_0x26b0e0){return _0x1b9a9b[_0x592f('0x52')](_0x5b5071,{'transaction':_0x26b0e0})[_0x592f('0x19')](function(){return BPromise[_0x592f('0x58')](_0x19983d,function(_0x17509f){return db['UserOpenchannelQueue'][_0x592f('0x59')]({'where':{'UserId':_0x17509f['id'],'OpenchannelQueueId':_0x121d6d[_0x592f('0x29')]['id']},'transaction':_0x26b0e0});});})[_0x592f('0x19')](function(){_0x19983d[_0x592f('0x5a')](function(_0x513bce){socket[_0x592f('0x5b')](_0x592f('0x5c'),{'UserId':_0x513bce['id'],'OpenchannelQueueId':_0x1b9a9b['id']});});});});});}})[_0x592f('0x19')](respondWithStatusCode(_0x3b5b4c,null))[_0x592f('0x28')](handleError(_0x3b5b4c,null));};exports[_0x592f('0x5d')]=function(_0x1a81c8,_0x17eea8){return db[_0x592f('0x54')]['findAll']({'where':{'id':_0x1a81c8['query'][_0x592f('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x592f('0x5e'),'attributes':['id'],'raw':!![]}]})[_0x592f('0x19')](handleEntityNotFound(_0x17eea8,null))[_0x592f('0x19')](function(_0x14ca39){var _0x17f1d1=_['map'](_0x14ca39,'id');var _0x2d1f40=[];var _0x122cda=[];var _0x3b9cf4=squel[_0x592f('0x5f')]();_0x3b9cf4['field']('tq.TeamId')[_0x592f('0x60')](_0x592f('0x61'),'tq')['join'](_0x592f('0x62'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x592f('0x43')](_0x592f('0x63'),_0x1a81c8[_0x592f('0x29')]['id']);for(var _0x17de01=0x0;_0x17de01<_0x14ca39['length'];_0x17de01+=0x1){let _0x15071e=_0x14ca39[_0x17de01];for(var _0x1b94ec=0x0;_0x1b94ec<_0x15071e[_0x592f('0x5e')][_0x592f('0x31')];_0x1b94ec+=0x1){let _0x3f77b6=_0x15071e[_0x592f('0x5e')][_0x1b94ec];var _0x57a4ba=_0x3b9cf4['clone']();_0x57a4ba[_0x592f('0x43')]('ut.UserId\x20=\x20?',_0x3f77b6['id']);_0x122cda[_0x592f('0x64')](db[_0x592f('0x56')][_0x592f('0x2c')](_0x57a4ba[_0x592f('0x65')](),{'type':db['sequelize']['QueryTypes'][_0x592f('0x66')]})[_0x592f('0x19')](function(_0x10eb83){if(_0x10eb83['length']===0x1){return _0x3f77b6['id'];}else{var _0x534afc=_[_0x592f('0x67')](_['map'](_0x10eb83,_0x592f('0x68')),function(_0xcb29de){return _[_0x592f('0x69')](_0x17f1d1,_0xcb29de);});if(_0x534afc){return _0x3f77b6['id'];}}}));}}return BPromise[_0x592f('0x6a')](_0x122cda)[_0x592f('0x19')](function(_0x148c52){_0x2d1f40=_(_0x2d1f40)[_0x592f('0x6b')](_0x148c52)[_0x592f('0x6c')]()[_0x592f('0x6d')]();return db[_0x592f('0x20')][_0x592f('0x34')]({'where':{'id':_0x1a81c8['params']['id']}})[_0x592f('0x19')](function(_0x2fa547){return db[_0x592f('0x56')][_0x592f('0x57')](function(_0x3842b3){return _0x2fa547[_0x592f('0x5d')](_0x1a81c8[_0x592f('0x2c')][_0x592f('0x53')],{'transaction':_0x3842b3})[_0x592f('0x19')](function(){if(!_[_0x592f('0x6e')](_0x2d1f40)){return _0x2fa547[_0x592f('0x6f')](_0x2d1f40,{'transaction':_0x3842b3});}})['then'](function(){_0x2d1f40[_0x592f('0x5a')](function(_0x2cac33){socket[_0x592f('0x5b')](_0x592f('0x70'),{'UserId':_0x2cac33,'OpenchannelQueueId':_0x2fa547['id']});});});});});});})[_0x592f('0x19')](respondWithStatusCode(_0x17eea8,null))['catch'](handleError(_0x17eea8,null));};exports['addAgents']=function(_0x4608db,_0x3e69df){return db[_0x592f('0x20')][_0x592f('0x34')]({'where':{'id':_0x4608db[_0x592f('0x29')]['id']}})[_0x592f('0x19')](handleEntityNotFound(_0x3e69df,null))[_0x592f('0x19')](function(_0x42a12c){if(_0x42a12c){return _0x42a12c['addAgents'](_0x4608db[_0x592f('0x36')][_0x592f('0x53')],_[_0x592f('0x71')](_0x4608db[_0x592f('0x36')],[_0x592f('0x53'),'id'])||{})['spread'](function(_0x492f48){for(var _0x2f7b72=0x0;_0x2f7b72<_0x4608db[_0x592f('0x36')][_0x592f('0x53')][_0x592f('0x31')];_0x2f7b72+=0x1){socket[_0x592f('0x5b')](_0x592f('0x5c'),{'UserId':Number(_0x4608db[_0x592f('0x36')][_0x592f('0x53')][_0x2f7b72]),'OpenchannelQueueId':Number(_0x4608db[_0x592f('0x29')]['id'])});}return _0x492f48;});}})[_0x592f('0x19')](respondWithResult(_0x3e69df,null))[_0x592f('0x28')](handleError(_0x3e69df,null));};exports[_0x592f('0x6f')]=function(_0x252856,_0x85a5f3){return db[_0x592f('0x20')][_0x592f('0x34')]({'where':{'id':_0x252856['params']['id']}})[_0x592f('0x19')](handleEntityNotFound(_0x85a5f3,null))[_0x592f('0x19')](function(_0x5b0884){if(_0x5b0884){return _0x5b0884[_0x592f('0x6f')](_0x252856[_0x592f('0x2c')][_0x592f('0x53')])['then'](function(){if(_['isArray'](_0x252856[_0x592f('0x2c')][_0x592f('0x53')])){for(var _0x2fae2d=0x0;_0x2fae2d<_0x252856['query'][_0x592f('0x53')][_0x592f('0x31')];_0x2fae2d+=0x1){socket[_0x592f('0x5b')](_0x592f('0x70'),{'UserId':Number(_0x252856[_0x592f('0x2c')][_0x592f('0x53')][_0x2fae2d]),'OpenchannelQueueId':Number(_0x252856[_0x592f('0x29')]['id'])});}}else{socket[_0x592f('0x5b')]('userOpenchannelQueue:remove',{'UserId':Number(_0x252856[_0x592f('0x2c')][_0x592f('0x53')]),'OpenchannelQueueId':Number(_0x252856[_0x592f('0x29')]['id'])});}});}})[_0x592f('0x19')](respondWithStatusCode(_0x85a5f3,null))[_0x592f('0x28')](handleError(_0x85a5f3,null));};exports[_0x592f('0x72')]=function(_0x7fe1d9,_0x1cfc3f){var _0xc15445={};var _0x36381f={};var _0x50e51d;var _0x5c5414;return db[_0x592f('0x20')]['findOne']({'where':{'id':_0x7fe1d9[_0x592f('0x29')]['id']}})[_0x592f('0x19')](handleEntityNotFound(_0x1cfc3f,null))[_0x592f('0x19')](function(_0x2fc62a){if(_0x2fc62a){_0x50e51d=_0x2fc62a;_0x36381f[_0x592f('0x2a')]=_[_0x592f('0x2b')](db[_0x592f('0x47')][_0x592f('0x21')]);_0x36381f[_0x592f('0x2c')]=_[_0x592f('0x2b')](_0x7fe1d9[_0x592f('0x2c')]);_0x36381f[_0x592f('0x2d')]=_[_0x592f('0x2e')](_0x36381f['model'],_0x36381f[_0x592f('0x2c')]);_0xc15445[_0x592f('0x30')]=_[_0x592f('0x2e')](_0x36381f[_0x592f('0x2a')],qs[_0x592f('0x2f')](_0x7fe1d9['query'][_0x592f('0x2f')]));_0xc15445[_0x592f('0x30')]=_0xc15445['attributes'][_0x592f('0x31')]?_0xc15445['attributes']:_0x36381f[_0x592f('0x2a')];_0xc15445['order']=qs[_0x592f('0x42')](_0x7fe1d9[_0x592f('0x2c')][_0x592f('0x42')]);_0xc15445[_0x592f('0x43')]=qs[_0x592f('0x2d')](_[_0x592f('0x44')](_0x7fe1d9['query'],_0x36381f[_0x592f('0x2d')]));if(_0x7fe1d9[_0x592f('0x2c')]['filter']){_0xc15445[_0x592f('0x43')]=_['merge'](_0xc15445[_0x592f('0x43')],{'$or':_[_0x592f('0x1f')](_0xc15445[_0x592f('0x30')],function(_0x25c94f){var _0x37e103={};_0x37e103[_0x25c94f]={'$like':'%'+_0x7fe1d9[_0x592f('0x2c')][_0x592f('0x45')]+'%'};return _0x37e103;})});}_0xc15445=_['merge']({},_0xc15445,_0x7fe1d9[_0x592f('0x33')]);return _0x50e51d[_0x592f('0x72')](_0xc15445);}})[_0x592f('0x19')](function(_0x33ba51){if(_0x33ba51){_0x5c5414=_0x33ba51[_0x592f('0x31')];if(!_0x7fe1d9[_0x592f('0x2c')][_0x592f('0x51')]('nolimit')){_0xc15445[_0x592f('0x14')]=qs[_0x592f('0x14')](_0x7fe1d9[_0x592f('0x2c')][_0x592f('0x14')]);_0xc15445[_0x592f('0x12')]=qs[_0x592f('0x12')](_0x7fe1d9[_0x592f('0x2c')][_0x592f('0x12')]);}return _0x50e51d[_0x592f('0x72')](_0xc15445);}})['then'](function(_0xcb4c65){if(_0xcb4c65){return _0xcb4c65?{'count':_0x5c5414,'rows':_0xcb4c65}:null;}})[_0x592f('0x19')](respondWithResult(_0x1cfc3f,null))[_0x592f('0x28')](handleError(_0x1cfc3f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 527adcd..89a8e47 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 _0xef7f=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xef7f,0xcd));var _0xfef7=function(_0x442054,_0x2bff50){_0x442054=_0x442054-0x0;var _0x5e8a7d=_0xef7f[_0x442054];return _0x5e8a7d;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xfef7('0x0'))['db'][_0xfef7('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xfef7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfef7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x28a6cb){return function(_0x52bd35,_0x1f5822,_0x14bafc){OpenchannelQueueEvents[_0xfef7('0x4')](_0x28a6cb+':'+_0x52bd35['id'],_0x52bd35);OpenchannelQueueEvents[_0xfef7('0x4')](_0x28a6cb,_0x52bd35);_0x14bafc(null);};}for(var e in events){if(events[_0xfef7('0x5')](e)){var event=events[e];OpenchannelQueue[_0xfef7('0x6')](e,emitEvent(event));}}module[_0xfef7('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xfa07=['../../mysqldb','OpenchannelQueue','save','update','emit','hasOwnProperty','hook','events'];(function(_0x306d58,_0x4c64e4){var _0x24e44b=function(_0x3e61f8){while(--_0x3e61f8){_0x306d58['push'](_0x306d58['shift']());}};_0x24e44b(++_0x4c64e4);}(_0xfa07,0x177));var _0x7fa0=function(_0x5606a4,_0x4af49f){_0x5606a4=_0x5606a4-0x0;var _0x5e41d4=_0xfa07[_0x5606a4];return _0x5e41d4;};'use strict';var EventEmitter=require(_0x7fa0('0x0'));var OpenchannelQueue=require(_0x7fa0('0x1'))['db'][_0x7fa0('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7fa0('0x3'),'afterUpdate':_0x7fa0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x49c4fa){return function(_0x1ad4b0,_0x172ecb,_0x51fb31){OpenchannelQueueEvents[_0x7fa0('0x5')](_0x49c4fa+':'+_0x1ad4b0['id'],_0x1ad4b0);OpenchannelQueueEvents[_0x7fa0('0x5')](_0x49c4fa,_0x1ad4b0);_0x51fb31(null);};}for(var e in events){if(events[_0x7fa0('0x6')](e)){var event=events[e];OpenchannelQueue[_0x7fa0('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index bd8ee08..4a3a1d9 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 _0xba6d=['path','rimraf','OpenchannelQueue','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0xba6d,0xdb));var _0xdba6=function(_0x56ed6f,_0x24cdf7){_0x56ed6f=_0x56ed6f-0x0;var _0x2b29a7=_0xba6d[_0x56ed6f];return _0x2b29a7;};'use strict';var _=require(_0xdba6('0x0'));var util=require('util');var logger=require(_0xdba6('0x1'))(_0xdba6('0x2'));var moment=require(_0xdba6('0x3'));var BPromise=require(_0xdba6('0x4'));var rp=require(_0xdba6('0x5'));var fs=require('fs');var path=require(_0xdba6('0x6'));var rimraf=require(_0xdba6('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x2066c6,_0x727e5b){return _0x2066c6['define'](_0xdba6('0x8'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf93d=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xf93d,0xd7));var _0xdf93=function(_0x30c870,_0x346044){_0x30c870=_0x30c870-0x0;var _0x319b25=_0xf93d[_0x30c870];return _0x319b25;};'use strict';var _=require(_0xdf93('0x0'));var util=require(_0xdf93('0x1'));var logger=require(_0xdf93('0x2'))(_0xdf93('0x3'));var moment=require(_0xdf93('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf93('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf93('0x6'));var config=require(_0xdf93('0x7'));var attributes=require(_0xdf93('0x8'));module['exports']=function(_0x1f8811,_0x13dd09){return _0x1f8811[_0xdf93('0x9')](_0xdf93('0xa'),attributes,{'tableName':_0xdf93('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 27d6572..27c77e4 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 _0x7aa8=['code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','limit','include','map','attributes','model','ShowOpenchannelQueue','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0x7aa8,0x1c8));var _0x87aa=function(_0x2c3287,_0x1c2149){_0x2c3287=_0x2c3287-0x0;var _0x4dd244=_0x7aa8[_0x2c3287];return _0x4dd244;};'use strict';var _=require(_0x87aa('0x0'));var util=require(_0x87aa('0x1'));var moment=require('moment');var BPromise=require(_0x87aa('0x2'));var rs=require(_0x87aa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x87aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x87aa('0x5'));var config=require(_0x87aa('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x87aa('0x7')][_0x87aa('0x8')]({'port':0x232a});config['redis']=_[_0x87aa('0x9')](config[_0x87aa('0xa')],{'host':_0x87aa('0xb'),'port':0x18eb});var socket=require(_0x87aa('0xc'))(new Redis(config[_0x87aa('0xa')]));require(_0x87aa('0xd'))[_0x87aa('0xe')](socket);function respondWithRpcPromise(_0x37d6b5,_0x51dbcd,_0x5cf72d){return new BPromise(function(_0x18351b,_0x2588b8){return client[_0x87aa('0xf')](_0x37d6b5,_0x5cf72d)[_0x87aa('0x10')](function(_0x4d523d){logger[_0x87aa('0x11')](_0x87aa('0x12'),_0x51dbcd,_0x87aa('0x13'));logger[_0x87aa('0x14')](_0x87aa('0x15'),_0x51dbcd,'request\x20sent',JSON[_0x87aa('0x16')](_0x4d523d));if(_0x4d523d['error']){if(_0x4d523d[_0x87aa('0x17')][_0x87aa('0x18')]===0x1f4){logger[_0x87aa('0x17')](_0x87aa('0x12'),_0x51dbcd,_0x4d523d[_0x87aa('0x17')][_0x87aa('0x19')]);return _0x2588b8(_0x4d523d[_0x87aa('0x17')][_0x87aa('0x19')]);}logger['error'](_0x87aa('0x12'),_0x51dbcd,_0x4d523d[_0x87aa('0x17')][_0x87aa('0x19')]);return _0x18351b(_0x4d523d[_0x87aa('0x17')][_0x87aa('0x19')]);}else{logger[_0x87aa('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x51dbcd,_0x87aa('0x13'));_0x18351b(_0x4d523d[_0x87aa('0x1a')][_0x87aa('0x19')]);}})[_0x87aa('0x1b')](function(_0x5885bc){logger[_0x87aa('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x51dbcd,_0x5885bc);_0x2588b8(_0x5885bc);});});}exports[_0x87aa('0x1c')]=function(_0xab4242){var _0x26ae73=this;return new Promise(function(_0xcd9c9c,_0x532737){return db[_0x87aa('0x1d')][_0x87aa('0x1e')]({'raw':_0xab4242[_0x87aa('0x1f')]?_0xab4242[_0x87aa('0x1f')][_0x87aa('0x20')]===undefined?!![]:![]:!![],'where':_0xab4242[_0x87aa('0x1f')]?_0xab4242[_0x87aa('0x1f')][_0x87aa('0x21')]||null:null,'attributes':_0xab4242[_0x87aa('0x1f')]?_0xab4242[_0x87aa('0x1f')]['attributes']||null:null,'limit':_0xab4242['options']?_0xab4242[_0x87aa('0x1f')][_0x87aa('0x22')]||null:null,'include':_0xab4242[_0x87aa('0x1f')]?_0xab4242['options'][_0x87aa('0x23')]?_[_0x87aa('0x24')](_0xab4242[_0x87aa('0x1f')][_0x87aa('0x23')],function(_0x29ac0a){return{'model':db[_0x29ac0a['model']],'as':_0x29ac0a['as'],'attributes':_0x29ac0a['attributes'],'include':_0x29ac0a[_0x87aa('0x23')]?_['map'](_0x29ac0a[_0x87aa('0x23')],function(_0x34b8c9){return{'model':db[_0x34b8c9['model']],'as':_0x34b8c9['as'],'attributes':_0x34b8c9[_0x87aa('0x25')],'include':_0x34b8c9[_0x87aa('0x23')]?_[_0x87aa('0x24')](_0x34b8c9['include'],function(_0x5b4cbc){return{'model':db[_0x5b4cbc[_0x87aa('0x26')]],'as':_0x5b4cbc['as'],'attributes':_0x5b4cbc[_0x87aa('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19091){logger[_0x87aa('0x11')](_0x87aa('0x1c'),_0xab4242);logger[_0x87aa('0x14')](_0x87aa('0x1c'),_0xab4242,JSON[_0x87aa('0x16')](_0x19091));_0xcd9c9c(_0x19091);})[_0x87aa('0x1b')](function(_0x3cd9a2){logger[_0x87aa('0x17')](_0x87aa('0x1c'),_0x3cd9a2[_0x87aa('0x19')],_0xab4242);_0x532737(_0x26ae73['error'](0x1f4,_0x3cd9a2['message']));});});};exports[_0x87aa('0x27')]=function(_0x3a4d4e){var _0x9ad285=this;return new Promise(function(_0x3f1886,_0x4a9397){return db['OpenchannelQueue']['find']({'raw':_0x3a4d4e[_0x87aa('0x1f')]?_0x3a4d4e[_0x87aa('0x1f')][_0x87aa('0x20')]===undefined?!![]:![]:!![],'where':_0x3a4d4e[_0x87aa('0x1f')]?_0x3a4d4e[_0x87aa('0x1f')]['where']||null:null,'attributes':_0x3a4d4e['options']?_0x3a4d4e[_0x87aa('0x1f')][_0x87aa('0x25')]||null:null,'include':_0x3a4d4e[_0x87aa('0x1f')]?_0x3a4d4e[_0x87aa('0x1f')]['include']?_['map'](_0x3a4d4e[_0x87aa('0x1f')][_0x87aa('0x23')],function(_0x155b46){return{'model':db[_0x155b46['model']],'as':_0x155b46['as'],'attributes':_0x155b46[_0x87aa('0x25')],'include':_0x155b46[_0x87aa('0x23')]?_[_0x87aa('0x24')](_0x155b46[_0x87aa('0x23')],function(_0x1ec5bc){return{'model':db[_0x1ec5bc[_0x87aa('0x26')]],'as':_0x1ec5bc['as'],'attributes':_0x1ec5bc[_0x87aa('0x25')],'include':_0x1ec5bc[_0x87aa('0x23')]?_[_0x87aa('0x24')](_0x1ec5bc[_0x87aa('0x23')],function(_0x281afd){return{'model':db[_0x281afd[_0x87aa('0x26')]],'as':_0x281afd['as'],'attributes':_0x281afd[_0x87aa('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x413678){logger[_0x87aa('0x11')](_0x87aa('0x27'),_0x3a4d4e);logger[_0x87aa('0x14')](_0x87aa('0x27'),_0x3a4d4e,JSON[_0x87aa('0x16')](_0x413678));_0x3f1886(_0x413678);})['catch'](function(_0x5a3938){logger[_0x87aa('0x17')](_0x87aa('0x27'),_0x5a3938[_0x87aa('0x19')],_0x3a4d4e);_0x4a9397(_0x9ad285[_0x87aa('0x17')](0x1f4,_0x5a3938[_0x87aa('0x19')]));});});}; \ No newline at end of file +var _0xaf2f=['raw','where','include','map','model','attributes','ShowOpenchannelQueue','OpenchannelQueue','find','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetOpenchannelQueue','findAll','options'];(function(_0x7179c2,_0x23058b){var _0x4ed026=function(_0xfebb42){while(--_0xfebb42){_0x7179c2['push'](_0x7179c2['shift']());}};_0x4ed026(++_0x23058b);}(_0xaf2f,0x17b));var _0xfaf2=function(_0x1145de,_0x54d2f6){_0x1145de=_0x1145de-0x0;var _0x4863b4=_0xaf2f[_0x1145de];return _0x4863b4;};'use strict';var _=require(_0xfaf2('0x0'));var util=require('util');var moment=require(_0xfaf2('0x1'));var BPromise=require(_0xfaf2('0x2'));var rs=require(_0xfaf2('0x3'));var fs=require('fs');var Redis=require(_0xfaf2('0x4'));var db=require(_0xfaf2('0x5'))['db'];var utils=require(_0xfaf2('0x6'));var logger=require(_0xfaf2('0x7'))(_0xfaf2('0x8'));var config=require(_0xfaf2('0x9'));var jayson=require(_0xfaf2('0xa'));var client=jayson[_0xfaf2('0xb')][_0xfaf2('0xc')]({'port':0x232a});config[_0xfaf2('0xd')]=_[_0xfaf2('0xe')](config['redis'],{'host':_0xfaf2('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfaf2('0x10'))[_0xfaf2('0x11')](socket);function respondWithRpcPromise(_0x5e5107,_0x3b92a9,_0x15daf7){return new BPromise(function(_0x2a33b6,_0xc3e70a){return client[_0xfaf2('0x12')](_0x5e5107,_0x15daf7)[_0xfaf2('0x13')](function(_0x2a74be){logger['info'](_0xfaf2('0x14'),_0x3b92a9,_0xfaf2('0x15'));logger['debug'](_0xfaf2('0x16'),_0x3b92a9,_0xfaf2('0x15'),JSON[_0xfaf2('0x17')](_0x2a74be));if(_0x2a74be['error']){if(_0x2a74be[_0xfaf2('0x18')]['code']===0x1f4){logger[_0xfaf2('0x18')](_0xfaf2('0x14'),_0x3b92a9,_0x2a74be[_0xfaf2('0x18')]['message']);return _0xc3e70a(_0x2a74be[_0xfaf2('0x18')][_0xfaf2('0x19')]);}logger[_0xfaf2('0x18')](_0xfaf2('0x14'),_0x3b92a9,_0x2a74be[_0xfaf2('0x18')]['message']);return _0x2a33b6(_0x2a74be[_0xfaf2('0x18')][_0xfaf2('0x19')]);}else{logger[_0xfaf2('0x1a')](_0xfaf2('0x14'),_0x3b92a9,_0xfaf2('0x15'));_0x2a33b6(_0x2a74be['result'][_0xfaf2('0x19')]);}})[_0xfaf2('0x1b')](function(_0x59b9ba){logger['error'](_0xfaf2('0x14'),_0x3b92a9,_0x59b9ba);_0xc3e70a(_0x59b9ba);});});}exports[_0xfaf2('0x1c')]=function(_0x117e05){var _0x40472c=this;return new Promise(function(_0x22dd85,_0x1a441d){return db['OpenchannelQueue'][_0xfaf2('0x1d')]({'raw':_0x117e05[_0xfaf2('0x1e')]?_0x117e05[_0xfaf2('0x1e')][_0xfaf2('0x1f')]===undefined?!![]:![]:!![],'where':_0x117e05[_0xfaf2('0x1e')]?_0x117e05[_0xfaf2('0x1e')][_0xfaf2('0x20')]||null:null,'attributes':_0x117e05[_0xfaf2('0x1e')]?_0x117e05[_0xfaf2('0x1e')]['attributes']||null:null,'limit':_0x117e05[_0xfaf2('0x1e')]?_0x117e05[_0xfaf2('0x1e')]['limit']||null:null,'include':_0x117e05[_0xfaf2('0x1e')]?_0x117e05['options'][_0xfaf2('0x21')]?_[_0xfaf2('0x22')](_0x117e05[_0xfaf2('0x1e')][_0xfaf2('0x21')],function(_0x2c4a0c){return{'model':db[_0x2c4a0c[_0xfaf2('0x23')]],'as':_0x2c4a0c['as'],'attributes':_0x2c4a0c['attributes'],'include':_0x2c4a0c[_0xfaf2('0x21')]?_[_0xfaf2('0x22')](_0x2c4a0c['include'],function(_0x52cc36){return{'model':db[_0x52cc36[_0xfaf2('0x23')]],'as':_0x52cc36['as'],'attributes':_0x52cc36[_0xfaf2('0x24')],'include':_0x52cc36[_0xfaf2('0x21')]?_[_0xfaf2('0x22')](_0x52cc36[_0xfaf2('0x21')],function(_0x1e9bd4){return{'model':db[_0x1e9bd4[_0xfaf2('0x23')]],'as':_0x1e9bd4['as'],'attributes':_0x1e9bd4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a6e78){logger['info']('GetOpenchannelQueue',_0x117e05);logger['debug'](_0xfaf2('0x1c'),_0x117e05,JSON['stringify'](_0x3a6e78));_0x22dd85(_0x3a6e78);})[_0xfaf2('0x1b')](function(_0x63d8d3){logger['error'](_0xfaf2('0x1c'),_0x63d8d3['message'],_0x117e05);_0x1a441d(_0x40472c[_0xfaf2('0x18')](0x1f4,_0x63d8d3[_0xfaf2('0x19')]));});});};exports[_0xfaf2('0x25')]=function(_0x42d434){var _0x2166dc=this;return new Promise(function(_0xb73eea,_0x1b585f){return db[_0xfaf2('0x26')][_0xfaf2('0x27')]({'raw':_0x42d434[_0xfaf2('0x1e')]?_0x42d434[_0xfaf2('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x42d434['options']?_0x42d434['options'][_0xfaf2('0x20')]||null:null,'attributes':_0x42d434[_0xfaf2('0x1e')]?_0x42d434[_0xfaf2('0x1e')]['attributes']||null:null,'include':_0x42d434[_0xfaf2('0x1e')]?_0x42d434[_0xfaf2('0x1e')][_0xfaf2('0x21')]?_[_0xfaf2('0x22')](_0x42d434['options']['include'],function(_0x3e8c88){return{'model':db[_0x3e8c88['model']],'as':_0x3e8c88['as'],'attributes':_0x3e8c88[_0xfaf2('0x24')],'include':_0x3e8c88[_0xfaf2('0x21')]?_[_0xfaf2('0x22')](_0x3e8c88['include'],function(_0x1ab926){return{'model':db[_0x1ab926[_0xfaf2('0x23')]],'as':_0x1ab926['as'],'attributes':_0x1ab926[_0xfaf2('0x24')],'include':_0x1ab926[_0xfaf2('0x21')]?_['map'](_0x1ab926[_0xfaf2('0x21')],function(_0x3eb244){return{'model':db[_0x3eb244[_0xfaf2('0x23')]],'as':_0x3eb244['as'],'attributes':_0x3eb244[_0xfaf2('0x24')]};}):[]};}):[]};}):[]:[]})[_0xfaf2('0x13')](function(_0x2cee92){logger[_0xfaf2('0x1a')]('ShowOpenchannelQueue',_0x42d434);logger[_0xfaf2('0x28')]('ShowOpenchannelQueue',_0x42d434,JSON['stringify'](_0x2cee92));_0xb73eea(_0x2cee92);})[_0xfaf2('0x1b')](function(_0x5f229d){logger[_0xfaf2('0x18')](_0xfaf2('0x25'),_0x5f229d['message'],_0x42d434);_0x1b585f(_0x2166dc['error'](0x1f4,_0x5f229d[_0xfaf2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index f8382dc..b164b50 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 _0x3db5=['removeListener','register','length','remove','emit'];(function(_0x2644f8,_0x40977c){var _0x233fea=function(_0x308f49){while(--_0x308f49){_0x2644f8['push'](_0x2644f8['shift']());}};_0x233fea(++_0x40977c);}(_0x3db5,0x1cf));var _0x53db=function(_0x4db46b,_0xadcb1a){_0x4db46b=_0x4db46b-0x0;var _0x565be8=_0x3db5[_0x4db46b];return _0x565be8;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x53db('0x0'),'update'];function createListener(_0x1e4316,_0x555093){return function(_0x121487){_0x555093[_0x53db('0x1')](_0x1e4316,_0x121487);};}function removeListener(_0x577140,_0x56b356){return function(){OpenchannelQueueEvents[_0x53db('0x2')](_0x577140,_0x56b356);};}exports[_0x53db('0x3')]=function(_0x59df88){for(var _0x250ee1=0x0,_0x90793e=events[_0x53db('0x4')];_0x250ee1<_0x90793e;_0x250ee1++){var _0x4ca62b=events[_0x250ee1];var _0x434420=createListener('openchannelQueue:'+_0x4ca62b,_0x59df88);OpenchannelQueueEvents['on'](_0x4ca62b,_0x434420);}}; \ No newline at end of file +var _0xb3f2=['openchannelQueue:','./openchannelQueue.events','update','emit','removeListener','register'];(function(_0x465823,_0x14c09b){var _0x41ed37=function(_0x267380){while(--_0x267380){_0x465823['push'](_0x465823['shift']());}};_0x41ed37(++_0x14c09b);}(_0xb3f2,0x8b));var _0x2b3f=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb3f2[_0xc4001c];return _0x49f7bc;};'use strict';var OpenchannelQueueEvents=require(_0x2b3f('0x0'));var events=['save','remove',_0x2b3f('0x1')];function createListener(_0xc3088d,_0x293140){return function(_0x50826d){_0x293140[_0x2b3f('0x2')](_0xc3088d,_0x50826d);};}function removeListener(_0x36fab5,_0x2d9ebf){return function(){OpenchannelQueueEvents[_0x2b3f('0x3')](_0x36fab5,_0x2d9ebf);};}exports[_0x2b3f('0x4')]=function(_0x1b7802){for(var _0x25b9e1=0x0,_0x50cf07=events['length'];_0x25b9e1<_0x50cf07;_0x25b9e1++){var _0x2473f9=events[_0x25b9e1];var _0x44b1cd=createListener(_0x2b3f('0x5')+_0x2473f9,_0x1b7802);OpenchannelQueueEvents['on'](_0x2473f9,_0x44b1cd);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index f9e5d27..fc33b40 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 _0x9c13=['path','connect-timeout','Router','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x1d3b06,_0x8bf86b){var _0x45563c=function(_0x34ee50){while(--_0x34ee50){_0x1d3b06['push'](_0x1d3b06['shift']());}};_0x45563c(++_0x8bf86b);}(_0x9c13,0x1b6));var _0x39c1=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x9c13[_0x238671];return _0x474844;};'use strict';var multer=require(_0x39c1('0x0'));var util=require(_0x39c1('0x1'));var path=require(_0x39c1('0x2'));var timeout=require(_0x39c1('0x3'));var express=require('express');var router=express[_0x39c1('0x4')]();var fs_extra=require(_0x39c1('0x5'));var auth=require(_0x39c1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x39c1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x39c1('0x8')]);router['get'](_0x39c1('0x9'),auth[_0x39c1('0xa')](),controller['describe']);router['get'](_0x39c1('0xb'),auth['isAuthenticated'](),controller[_0x39c1('0xc')]);router[_0x39c1('0xd')]('/',auth[_0x39c1('0xa')](),controller[_0x39c1('0xe')]);router[_0x39c1('0xf')](_0x39c1('0xb'),auth[_0x39c1('0xa')](),controller[_0x39c1('0x10')]);router[_0x39c1('0x11')](_0x39c1('0xb'),auth['isAuthenticated'](),controller[_0x39c1('0x12')]);module[_0x39c1('0x13')]=router; \ No newline at end of file +var _0x8f75=['create','put','/:id','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2a2da5,_0x2d46fd){var _0x3e70a1=function(_0x401dca){while(--_0x401dca){_0x2a2da5['push'](_0x2a2da5['shift']());}};_0x3e70a1(++_0x2d46fd);}(_0x8f75,0x113));var _0x58f7=function(_0x98ce34,_0x30a2f6){_0x98ce34=_0x98ce34-0x0;var _0x571698=_0x8f75[_0x98ce34];return _0x571698;};'use strict';var multer=require(_0x58f7('0x0'));var util=require('util');var path=require(_0x58f7('0x1'));var timeout=require(_0x58f7('0x2'));var express=require('express');var router=express[_0x58f7('0x3')]();var fs_extra=require(_0x58f7('0x4'));var auth=require(_0x58f7('0x5'));var interaction=require(_0x58f7('0x6'));var config=require('../../config/environment');var controller=require(_0x58f7('0x7'));router[_0x58f7('0x8')]('/',auth[_0x58f7('0x9')](),controller[_0x58f7('0xa')]);router['get'](_0x58f7('0xb'),auth[_0x58f7('0x9')](),controller[_0x58f7('0xc')]);router[_0x58f7('0x8')]('/:id',auth[_0x58f7('0x9')](),controller['show']);router['post']('/',auth[_0x58f7('0x9')](),controller[_0x58f7('0xd')]);router[_0x58f7('0xe')](_0x58f7('0xf'),auth[_0x58f7('0x9')](),controller['update']);router['delete'](_0x58f7('0xf'),auth[_0x58f7('0x9')](),controller[_0x58f7('0x10')]);module[_0x58f7('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index c470263..140a9ce 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 _0x1d03=['STRING','DATE','moment','sequelize','exports'];(function(_0x2f9b63,_0x4e304a){var _0x2a4b6a=function(_0x230d98){while(--_0x230d98){_0x2f9b63['push'](_0x2f9b63['shift']());}};_0x2a4b6a(++_0x4e304a);}(_0x1d03,0x6b));var _0x31d0=function(_0x1c7d1a,_0x14f853){_0x1c7d1a=_0x1c7d1a-0x0;var _0x3ea54a=_0x1d03[_0x1c7d1a];return _0x3ea54a;};'use strict';var moment=require(_0x31d0('0x0'));var Sequelize=require(_0x31d0('0x1'));module[_0x31d0('0x2')]={'uniqueid':{'type':Sequelize[_0x31d0('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x31d0('0x3')]},'joinAt':{'type':Sequelize[_0x31d0('0x4')]},'leaveAt':{'type':Sequelize[_0x31d0('0x4')]},'acceptAt':{'type':Sequelize[_0x31d0('0x4')]},'exitAt':{'type':Sequelize[_0x31d0('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf613=['STRING','DATE','moment','sequelize','exports'];(function(_0x2f553e,_0x22a114){var _0x43dc2e=function(_0x58936b){while(--_0x58936b){_0x2f553e['push'](_0x2f553e['shift']());}};_0x43dc2e(++_0x22a114);}(_0xf613,0x70));var _0x3f61=function(_0x10603d,_0x5a0b7d){_0x10603d=_0x10603d-0x0;var _0x283020=_0xf613[_0x10603d];return _0x283020;};'use strict';var moment=require(_0x3f61('0x0'));var Sequelize=require(_0x3f61('0x1'));module[_0x3f61('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3f61('0x3')]},'joinAt':{'type':Sequelize[_0x3f61('0x4')]},'leaveAt':{'type':Sequelize[_0x3f61('0x4')]},'acceptAt':{'type':Sequelize[_0x3f61('0x4')]},'exitAt':{'type':Sequelize[_0x3f61('0x4')]},'reason':{'type':Sequelize[_0x3f61('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 6b3fb7a..ef2307d 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 _0x8677=['find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','update','then','destroy','error','stack','send','index','rawAttributes','fieldName','type','key','name','keys','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','map','options','OpenchannelQueueReport','include','findAll','catch','params'];(function(_0x34eb31,_0x8f0f70){var _0x254994=function(_0xbec9a3){while(--_0xbec9a3){_0x34eb31['push'](_0x34eb31['shift']());}};_0x254994(++_0x8f0f70);}(_0x8677,0x128));var _0x7867=function(_0x179288,_0x9f1c17){_0x179288=_0x179288-0x0;var _0x3aca70=_0x8677[_0x179288];return _0x3aca70;};'use strict';var emlformat=require(_0x7867('0x0'));var rimraf=require(_0x7867('0x1'));var zipdir=require(_0x7867('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7867('0x3'));var moment=require(_0x7867('0x4'));var BPromise=require(_0x7867('0x5'));var Mustache=require('mustache');var util=require(_0x7867('0x6'));var path=require(_0x7867('0x7'));var sox=require(_0x7867('0x8'));var csv=require(_0x7867('0x9'));var ejs=require(_0x7867('0xa'));var fs=require('fs');var fs_extra=require(_0x7867('0xb'));var _=require(_0x7867('0xc'));var squel=require('squel');var crypto=require(_0x7867('0xd'));var jsforce=require(_0x7867('0xe'));var deskjs=require(_0x7867('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7867('0x10'));var Papa=require(_0x7867('0x11'));var Redis=require(_0x7867('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7867('0x13'));var as=require(_0x7867('0x14'));var hardwareService=require(_0x7867('0x15'));var logger=require(_0x7867('0x16'))('api');var utils=require(_0x7867('0x17'));var config=require(_0x7867('0x18'));var licenseUtil=require(_0x7867('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x369149,_0x43170b){_0x43170b=_0x43170b||0xcc;return function(_0x34cd3c){if(_0x34cd3c){return _0x369149[_0x7867('0x1a')](_0x43170b);}return _0x369149[_0x7867('0x1b')](_0x43170b)[_0x7867('0x1c')]();};}function respondWithResult(_0x91dd33,_0x321224){_0x321224=_0x321224||0xc8;return function(_0x4b36be){if(_0x4b36be){return _0x91dd33[_0x7867('0x1b')](_0x321224)['json'](_0x4b36be);}};}function respondWithFilteredResult(_0xbbee54,_0x23ae28){return function(_0x3a5e65){if(_0x3a5e65){var _0x529719=typeof _0x23ae28['offset']===_0x7867('0x1d')&&typeof _0x23ae28[_0x7867('0x1e')]===_0x7867('0x1d');var _0x1538df=_0x3a5e65['count'];var _0x6c89a4=_0x529719?0x0:_0x23ae28[_0x7867('0x1f')];var _0x5220f7=_0x529719?_0x3a5e65[_0x7867('0x20')]:_0x23ae28[_0x7867('0x1f')]+_0x23ae28[_0x7867('0x1e')];var _0xe25bd;if(_0x5220f7>=_0x1538df){_0x5220f7=_0x1538df;_0xe25bd=0xc8;}else{_0xe25bd=0xce;}_0xbbee54[_0x7867('0x1b')](_0xe25bd);return _0xbbee54[_0x7867('0x21')](_0x7867('0x22'),_0x6c89a4+'-'+_0x5220f7+'/'+_0x1538df)[_0x7867('0x23')](_0x3a5e65);}return null;};}function patchUpdates(_0x72ade8){return function(_0x3178dd){try{jsonpatch['apply'](_0x3178dd,_0x72ade8,!![]);}catch(_0x472763){return BPromise['reject'](_0x472763);}return _0x3178dd['save']();};}function saveUpdates(_0x30f80b,_0x136b9a){return function(_0x4be5c0){if(_0x4be5c0){return _0x4be5c0[_0x7867('0x24')](_0x30f80b)[_0x7867('0x25')](function(_0x3fa475){return _0x3fa475;});}return null;};}function removeEntity(_0x5ea671,_0x545e92){return function(_0x44470c){if(_0x44470c){return _0x44470c[_0x7867('0x26')]()['then'](function(){_0x5ea671['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52cd40,_0x355c93){return function(_0x50bdf4){if(!_0x50bdf4){_0x52cd40[_0x7867('0x1a')](0x194);}return _0x50bdf4;};}function handleError(_0x1b77ad,_0xfb66a4){_0xfb66a4=_0xfb66a4||0x1f4;return function(_0x32af22){logger[_0x7867('0x27')](_0x32af22[_0x7867('0x28')]);if(_0x32af22['name']){delete _0x32af22['name'];}_0x1b77ad[_0x7867('0x1b')](_0xfb66a4)[_0x7867('0x29')](_0x32af22);};}exports[_0x7867('0x2a')]=function(_0xe25391,_0x177269){var _0xfa488b={},_0x5214cc={},_0x26d9df={'count':0x0,'rows':[]};var _0x564a91=_['map'](db['OpenchannelQueueReport'][_0x7867('0x2b')],function(_0xf25f2){return{'name':_0xf25f2[_0x7867('0x2c')],'type':_0xf25f2[_0x7867('0x2d')][_0x7867('0x2e')]};});_0x5214cc['model']=_['map'](_0x564a91,_0x7867('0x2f'));_0x5214cc['query']=_[_0x7867('0x30')](_0xe25391[_0x7867('0x31')]);_0x5214cc['filters']=_[_0x7867('0x32')](_0x5214cc['model'],_0x5214cc['query']);_0xfa488b[_0x7867('0x33')]=_[_0x7867('0x32')](_0x5214cc[_0x7867('0x34')],qs[_0x7867('0x35')](_0xe25391['query'][_0x7867('0x35')]));_0xfa488b[_0x7867('0x33')]=_0xfa488b['attributes']['length']?_0xfa488b['attributes']:_0x5214cc[_0x7867('0x34')];if(!_0xe25391['query'][_0x7867('0x36')](_0x7867('0x37'))){_0xfa488b[_0x7867('0x1e')]=qs[_0x7867('0x1e')](_0xe25391[_0x7867('0x31')][_0x7867('0x1e')]);_0xfa488b[_0x7867('0x1f')]=qs[_0x7867('0x1f')](_0xe25391[_0x7867('0x31')][_0x7867('0x1f')]);}_0xfa488b['order']=qs[_0x7867('0x38')](_0xe25391[_0x7867('0x31')][_0x7867('0x38')]);_0xfa488b['where']=qs[_0x7867('0x39')](_[_0x7867('0x3a')](_0xe25391[_0x7867('0x31')],_0x5214cc[_0x7867('0x39')]),_0x564a91);if(_0xe25391[_0x7867('0x31')][_0x7867('0x3b')]){_0xfa488b[_0x7867('0x3c')]=_[_0x7867('0x3d')](_0xfa488b[_0x7867('0x3c')],{'$or':_[_0x7867('0x3e')](_0x564a91,function(_0x5cef80){if(_0x5cef80['type']!=='VIRTUAL'){var _0x2072dd={};_0x2072dd[_0x5cef80[_0x7867('0x2f')]]={'$like':'%'+_0xe25391[_0x7867('0x31')][_0x7867('0x3b')]+'%'};return _0x2072dd;}})});}_0xfa488b=_[_0x7867('0x3d')]({},_0xfa488b,_0xe25391[_0x7867('0x3f')]);var _0x16a0a4={'where':_0xfa488b[_0x7867('0x3c')]};return db[_0x7867('0x40')]['count'](_0x16a0a4)[_0x7867('0x25')](function(_0x4187e7){_0x26d9df['count']=_0x4187e7;if(_0xe25391['query']['includeAll']){_0xfa488b[_0x7867('0x41')]=[{'all':!![]}];}return db[_0x7867('0x40')][_0x7867('0x42')](_0xfa488b);})[_0x7867('0x25')](function(_0x16bf80){_0x26d9df['rows']=_0x16bf80;return _0x26d9df;})[_0x7867('0x25')](respondWithFilteredResult(_0x177269,_0xfa488b))[_0x7867('0x43')](handleError(_0x177269,null));};exports['show']=function(_0x31dd65,_0x573fad){var _0x355106={'raw':!![],'where':{'id':_0x31dd65[_0x7867('0x44')]['id']}},_0x1dbb1e={};_0x1dbb1e[_0x7867('0x34')]=_['keys'](db['OpenchannelQueueReport']['rawAttributes']);_0x1dbb1e[_0x7867('0x31')]=_[_0x7867('0x30')](_0x31dd65[_0x7867('0x31')]);_0x1dbb1e[_0x7867('0x39')]=_[_0x7867('0x32')](_0x1dbb1e['model'],_0x1dbb1e[_0x7867('0x31')]);_0x355106[_0x7867('0x33')]=_['intersection'](_0x1dbb1e['model'],qs['fields'](_0x31dd65['query'][_0x7867('0x35')]));_0x355106[_0x7867('0x33')]=_0x355106[_0x7867('0x33')]['length']?_0x355106[_0x7867('0x33')]:_0x1dbb1e['model'];if(_0x31dd65[_0x7867('0x31')]['includeAll']){_0x355106['include']=[{'all':!![]}];}_0x355106=_[_0x7867('0x3d')]({},_0x355106,_0x31dd65['options']);return db[_0x7867('0x40')][_0x7867('0x45')](_0x355106)[_0x7867('0x25')](handleEntityNotFound(_0x573fad,null))[_0x7867('0x25')](respondWithResult(_0x573fad,null))['catch'](handleError(_0x573fad,null));};exports[_0x7867('0x46')]=function(_0x1e2727,_0x497171){return db['OpenchannelQueueReport'][_0x7867('0x46')](_0x1e2727[_0x7867('0x47')],{})[_0x7867('0x25')](respondWithResult(_0x497171,0xc9))[_0x7867('0x43')](handleError(_0x497171,null));};exports[_0x7867('0x24')]=function(_0x297332,_0x4494cb){if(_0x297332[_0x7867('0x47')]['id']){delete _0x297332['body']['id'];}return db[_0x7867('0x40')][_0x7867('0x45')]({'where':{'id':_0x297332[_0x7867('0x44')]['id']}})[_0x7867('0x25')](handleEntityNotFound(_0x4494cb,null))[_0x7867('0x25')](saveUpdates(_0x297332[_0x7867('0x47')],null))[_0x7867('0x25')](respondWithResult(_0x4494cb,null))[_0x7867('0x43')](handleError(_0x4494cb,null));};exports[_0x7867('0x26')]=function(_0x449c5a,_0x316aed){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x449c5a[_0x7867('0x44')]['id']}})[_0x7867('0x25')](handleEntityNotFound(_0x316aed,null))[_0x7867('0x25')](removeEntity(_0x316aed,null))['catch'](handleError(_0x316aed,null));};exports[_0x7867('0x48')]=function(_0x28070b,_0x5f5155){return db['OpenchannelQueueReport'][_0x7867('0x48')]()[_0x7867('0x25')](respondWithResult(_0x5f5155,null))['catch'](handleError(_0x5f5155,null));}; \ No newline at end of file +var _0xa4b2=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','Content-Range','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','find','catch','create','body','params','describe'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xa4b2,0xd2));var _0x2a4b=function(_0x4eda47,_0x546eec){_0x4eda47=_0x4eda47-0x0;var _0x484724=_0xa4b2[_0x4eda47];return _0x484724;};'use strict';var emlformat=require(_0x2a4b('0x0'));var rimraf=require(_0x2a4b('0x1'));var zipdir=require(_0x2a4b('0x2'));var jsonpatch=require(_0x2a4b('0x3'));var rp=require(_0x2a4b('0x4'));var moment=require('moment');var BPromise=require(_0x2a4b('0x5'));var Mustache=require(_0x2a4b('0x6'));var util=require(_0x2a4b('0x7'));var path=require(_0x2a4b('0x8'));var sox=require(_0x2a4b('0x9'));var csv=require(_0x2a4b('0xa'));var ejs=require(_0x2a4b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2a4b('0xc'));var crypto=require(_0x2a4b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a4b('0xa'));var querystring=require(_0x2a4b('0xe'));var Papa=require(_0x2a4b('0xf'));var Redis=require(_0x2a4b('0x10'));var authService=require(_0x2a4b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2a4b('0x12'));var hardwareService=require(_0x2a4b('0x13'));var logger=require('../../config/logger')(_0x2a4b('0x14'));var utils=require('../../config/utils');var config=require(_0x2a4b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd8c0c8,_0x5ba57a){_0x5ba57a=_0x5ba57a||0xcc;return function(_0x3e1615){if(_0x3e1615){return _0xd8c0c8[_0x2a4b('0x16')](_0x5ba57a);}return _0xd8c0c8['status'](_0x5ba57a)['end']();};}function respondWithResult(_0x1e8172,_0x11ad5d){_0x11ad5d=_0x11ad5d||0xc8;return function(_0x1c85ba){if(_0x1c85ba){return _0x1e8172[_0x2a4b('0x17')](_0x11ad5d)[_0x2a4b('0x18')](_0x1c85ba);}};}function respondWithFilteredResult(_0x2de0ed,_0x27378a){return function(_0x5c0b64){if(_0x5c0b64){var _0x4a4596=typeof _0x27378a['offset']===_0x2a4b('0x19')&&typeof _0x27378a[_0x2a4b('0x1a')]==='undefined';var _0x12a9b=_0x5c0b64[_0x2a4b('0x1b')];var _0x5b4d2b=_0x4a4596?0x0:_0x27378a[_0x2a4b('0x1c')];var _0x13de54=_0x4a4596?_0x5c0b64[_0x2a4b('0x1b')]:_0x27378a[_0x2a4b('0x1c')]+_0x27378a[_0x2a4b('0x1a')];var _0x4a005f;if(_0x13de54>=_0x12a9b){_0x13de54=_0x12a9b;_0x4a005f=0xc8;}else{_0x4a005f=0xce;}_0x2de0ed[_0x2a4b('0x17')](_0x4a005f);return _0x2de0ed['set'](_0x2a4b('0x1d'),_0x5b4d2b+'-'+_0x13de54+'/'+_0x12a9b)[_0x2a4b('0x18')](_0x5c0b64);}return null;};}function patchUpdates(_0x20c46b){return function(_0x1ada18){try{jsonpatch['apply'](_0x1ada18,_0x20c46b,!![]);}catch(_0x4fd8e6){return BPromise['reject'](_0x4fd8e6);}return _0x1ada18['save']();};}function saveUpdates(_0x4f336e,_0x1e4299){return function(_0x5e46e3){if(_0x5e46e3){return _0x5e46e3['update'](_0x4f336e)[_0x2a4b('0x1e')](function(_0x47b151){return _0x47b151;});}return null;};}function removeEntity(_0x15281b,_0x25f1f8){return function(_0x308098){if(_0x308098){return _0x308098[_0x2a4b('0x1f')]()[_0x2a4b('0x1e')](function(){_0x15281b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbebfc5,_0x576a19){return function(_0x5a93ac){if(!_0x5a93ac){_0xbebfc5[_0x2a4b('0x16')](0x194);}return _0x5a93ac;};}function handleError(_0x33eb8b,_0x406639){_0x406639=_0x406639||0x1f4;return function(_0x1d45e0){logger[_0x2a4b('0x20')](_0x1d45e0[_0x2a4b('0x21')]);if(_0x1d45e0[_0x2a4b('0x22')]){delete _0x1d45e0[_0x2a4b('0x22')];}_0x33eb8b[_0x2a4b('0x17')](_0x406639)[_0x2a4b('0x23')](_0x1d45e0);};}exports[_0x2a4b('0x24')]=function(_0x4b2475,_0x1ec218){var _0x46d35d={},_0x7879da={},_0x3a7aea={'count':0x0,'rows':[]};var _0x4b3f15=_[_0x2a4b('0x25')](db[_0x2a4b('0x26')][_0x2a4b('0x27')],function(_0x189895){return{'name':_0x189895[_0x2a4b('0x28')],'type':_0x189895[_0x2a4b('0x29')][_0x2a4b('0x2a')]};});_0x7879da[_0x2a4b('0x2b')]=_[_0x2a4b('0x25')](_0x4b3f15,_0x2a4b('0x22'));_0x7879da['query']=_[_0x2a4b('0x2c')](_0x4b2475[_0x2a4b('0x2d')]);_0x7879da[_0x2a4b('0x2e')]=_[_0x2a4b('0x2f')](_0x7879da[_0x2a4b('0x2b')],_0x7879da[_0x2a4b('0x2d')]);_0x46d35d[_0x2a4b('0x30')]=_[_0x2a4b('0x2f')](_0x7879da[_0x2a4b('0x2b')],qs[_0x2a4b('0x31')](_0x4b2475[_0x2a4b('0x2d')][_0x2a4b('0x31')]));_0x46d35d[_0x2a4b('0x30')]=_0x46d35d[_0x2a4b('0x30')][_0x2a4b('0x32')]?_0x46d35d[_0x2a4b('0x30')]:_0x7879da[_0x2a4b('0x2b')];if(!_0x4b2475[_0x2a4b('0x2d')]['hasOwnProperty'](_0x2a4b('0x33'))){_0x46d35d[_0x2a4b('0x1a')]=qs[_0x2a4b('0x1a')](_0x4b2475[_0x2a4b('0x2d')][_0x2a4b('0x1a')]);_0x46d35d[_0x2a4b('0x1c')]=qs[_0x2a4b('0x1c')](_0x4b2475[_0x2a4b('0x2d')][_0x2a4b('0x1c')]);}_0x46d35d['order']=qs[_0x2a4b('0x34')](_0x4b2475[_0x2a4b('0x2d')]['sort']);_0x46d35d[_0x2a4b('0x35')]=qs[_0x2a4b('0x2e')](_[_0x2a4b('0x36')](_0x4b2475[_0x2a4b('0x2d')],_0x7879da[_0x2a4b('0x2e')]),_0x4b3f15);if(_0x4b2475[_0x2a4b('0x2d')][_0x2a4b('0x37')]){_0x46d35d[_0x2a4b('0x35')]=_[_0x2a4b('0x38')](_0x46d35d['where'],{'$or':_[_0x2a4b('0x25')](_0x4b3f15,function(_0x55fb80){if(_0x55fb80['type']!==_0x2a4b('0x39')){var _0x3d0ec9={};_0x3d0ec9[_0x55fb80[_0x2a4b('0x22')]]={'$like':'%'+_0x4b2475['query'][_0x2a4b('0x37')]+'%'};return _0x3d0ec9;}})});}_0x46d35d=_['merge']({},_0x46d35d,_0x4b2475['options']);var _0x17116d={'where':_0x46d35d[_0x2a4b('0x35')]};return db['OpenchannelQueueReport'][_0x2a4b('0x1b')](_0x17116d)[_0x2a4b('0x1e')](function(_0x23c863){_0x3a7aea[_0x2a4b('0x1b')]=_0x23c863;if(_0x4b2475['query'][_0x2a4b('0x3a')]){_0x46d35d[_0x2a4b('0x3b')]=[{'all':!![]}];}return db[_0x2a4b('0x26')][_0x2a4b('0x3c')](_0x46d35d);})[_0x2a4b('0x1e')](function(_0x29d347){_0x3a7aea[_0x2a4b('0x3d')]=_0x29d347;return _0x3a7aea;})[_0x2a4b('0x1e')](respondWithFilteredResult(_0x1ec218,_0x46d35d))['catch'](handleError(_0x1ec218,null));};exports[_0x2a4b('0x3e')]=function(_0x190aff,_0x3870f0){var _0x56bb82={'raw':!![],'where':{'id':_0x190aff['params']['id']}},_0x44f3ed={};_0x44f3ed[_0x2a4b('0x2b')]=_[_0x2a4b('0x2c')](db[_0x2a4b('0x26')][_0x2a4b('0x27')]);_0x44f3ed[_0x2a4b('0x2d')]=_[_0x2a4b('0x2c')](_0x190aff[_0x2a4b('0x2d')]);_0x44f3ed['filters']=_['intersection'](_0x44f3ed['model'],_0x44f3ed[_0x2a4b('0x2d')]);_0x56bb82[_0x2a4b('0x30')]=_[_0x2a4b('0x2f')](_0x44f3ed[_0x2a4b('0x2b')],qs[_0x2a4b('0x31')](_0x190aff['query']['fields']));_0x56bb82[_0x2a4b('0x30')]=_0x56bb82[_0x2a4b('0x30')][_0x2a4b('0x32')]?_0x56bb82['attributes']:_0x44f3ed[_0x2a4b('0x2b')];if(_0x190aff[_0x2a4b('0x2d')][_0x2a4b('0x3a')]){_0x56bb82[_0x2a4b('0x3b')]=[{'all':!![]}];}_0x56bb82=_['merge']({},_0x56bb82,_0x190aff[_0x2a4b('0x3f')]);return db['OpenchannelQueueReport'][_0x2a4b('0x40')](_0x56bb82)[_0x2a4b('0x1e')](handleEntityNotFound(_0x3870f0,null))[_0x2a4b('0x1e')](respondWithResult(_0x3870f0,null))[_0x2a4b('0x41')](handleError(_0x3870f0,null));};exports[_0x2a4b('0x42')]=function(_0x5e47a2,_0x35ce2e){return db[_0x2a4b('0x26')][_0x2a4b('0x42')](_0x5e47a2[_0x2a4b('0x43')],{})[_0x2a4b('0x1e')](respondWithResult(_0x35ce2e,0xc9))[_0x2a4b('0x41')](handleError(_0x35ce2e,null));};exports['update']=function(_0x555d1e,_0x25198b){if(_0x555d1e[_0x2a4b('0x43')]['id']){delete _0x555d1e[_0x2a4b('0x43')]['id'];}return db[_0x2a4b('0x26')]['find']({'where':{'id':_0x555d1e[_0x2a4b('0x44')]['id']}})[_0x2a4b('0x1e')](handleEntityNotFound(_0x25198b,null))[_0x2a4b('0x1e')](saveUpdates(_0x555d1e['body'],null))[_0x2a4b('0x1e')](respondWithResult(_0x25198b,null))[_0x2a4b('0x41')](handleError(_0x25198b,null));};exports[_0x2a4b('0x1f')]=function(_0x33310f,_0x2174eb){return db[_0x2a4b('0x26')]['find']({'where':{'id':_0x33310f[_0x2a4b('0x44')]['id']}})[_0x2a4b('0x1e')](handleEntityNotFound(_0x2174eb,null))['then'](removeEntity(_0x2174eb,null))[_0x2a4b('0x41')](handleError(_0x2174eb,null));};exports[_0x2a4b('0x45')]=function(_0x21b7a1,_0x36d420){return db['OpenchannelQueueReport'][_0x2a4b('0x45')]()[_0x2a4b('0x1e')](respondWithResult(_0x36d420,null))[_0x2a4b('0x41')](handleError(_0x36d420,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index a010422..94071aa 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 _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x1cb1f7,_0x3b1212){var _0x1c1df6=function(_0x41d72a){while(--_0x41d72a){_0x1cb1f7['push'](_0x1cb1f7['shift']());}};_0x1c1df6(++_0x3b1212);}(_0xe14b,0x93));var _0xbe14=function(_0x3dd1a8,_0x1a929c){_0x3dd1a8=_0x3dd1a8-0x0;var _0x4ac4ae=_0xe14b[_0x3dd1a8];return _0x4ac4ae;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x139f6a,_0x2e6f1e){var _0x8f32c0=function(_0x18e274){while(--_0x18e274){_0x139f6a['push'](_0x139f6a['shift']());}};_0x8f32c0(++_0x2e6f1e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x5fc3[_0x2f71f6];return _0x2b23ea;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 9ed2489..3c5d5ce 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 _0x6cb4=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','OpenchannelQueueReport','create','body','options','raw','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','attributes','limit','lodash'];(function(_0x47fee6,_0x1c5e26){var _0x5f4efa=function(_0x52b86f){while(--_0x52b86f){_0x47fee6['push'](_0x47fee6['shift']());}};_0x5f4efa(++_0x1c5e26);}(_0x6cb4,0xff));var _0x46cb=function(_0x48a48d,_0x2fd733){_0x48a48d=_0x48a48d-0x0;var _0xafc2d2=_0x6cb4[_0x48a48d];return _0xafc2d2;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});}exports['CreateOpenchannelQueueReport']=function(_0x4e3454){var _0x1b6646=this;return new Promise(function(_0x1f2891,_0x4df1f0){return db[_0x46cb('0x15')][_0x46cb('0x16')](_0x4e3454[_0x46cb('0x17')],{'raw':_0x4e3454[_0x46cb('0x18')]?_0x4e3454[_0x46cb('0x18')][_0x46cb('0x19')]===undefined?!![]:![]:!![]})[_0x46cb('0x1a')](function(_0x149483){logger[_0x46cb('0xc')](_0x46cb('0x1b'),_0x4e3454);logger[_0x46cb('0xe')](_0x46cb('0x1b'),_0x4e3454,JSON[_0x46cb('0xf')](_0x149483));_0x1f2891(_0x149483);})[_0x46cb('0x14')](function(_0x1fb467){logger[_0x46cb('0x10')](_0x46cb('0x1b'),_0x1fb467[_0x46cb('0x12')],_0x4e3454);_0x4df1f0(_0x1b6646[_0x46cb('0x10')](0x1f4,_0x1fb467[_0x46cb('0x12')]));});});};exports[_0x46cb('0x1c')]=function(_0x40e0e5){var _0x5a1338=this;return new Promise(function(_0x4d663e,_0x6588f3){return db[_0x46cb('0x15')][_0x46cb('0x1d')](_0x40e0e5[_0x46cb('0x17')],{'raw':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5['options'][_0x46cb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40e0e5['options']?_0x40e0e5['options']['where']||null:null,'attributes':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5[_0x46cb('0x18')][_0x46cb('0x1e')]||null:null,'limit':_0x40e0e5[_0x46cb('0x18')]?_0x40e0e5[_0x46cb('0x18')][_0x46cb('0x1f')]||null:null})[_0x46cb('0x1a')](function(_0x8c65b2){logger[_0x46cb('0xc')](_0x46cb('0x1c'),_0x40e0e5);logger[_0x46cb('0xe')]('UpdateOpenchannelQueueReport',_0x40e0e5,JSON[_0x46cb('0xf')](_0x8c65b2));_0x4d663e(_0x8c65b2);})[_0x46cb('0x14')](function(_0x4c73bd){logger['error'](_0x46cb('0x1c'),_0x4c73bd['message'],_0x40e0e5);_0x6588f3(_0x5a1338[_0x46cb('0x10')](0x1f4,_0x4c73bd[_0x46cb('0x12')]));});});}; \ No newline at end of file +var _0x7334=['jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','CreateOpenchannelQueueReport','create','body','options','raw','catch','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1d04b3,_0x2dfd11){var _0x1cf900=function(_0x34a7d9){while(--_0x34a7d9){_0x1d04b3['push'](_0x1d04b3['shift']());}};_0x1cf900(++_0x2dfd11);}(_0x7334,0x184));var _0x4733=function(_0x4fb4f5,_0x199d1b){_0x4fb4f5=_0x4fb4f5-0x0;var _0x5faf2c=_0x7334[_0x4fb4f5];return _0x5faf2c;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x283754,_0x12cafa,_0x43d95c){return new BPromise(function(_0x8257cf,_0x3562b7){return client[_0x4733('0xb')](_0x283754,_0x43d95c)[_0x4733('0xc')](function(_0x2d5fde){logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,'request\x20sent');logger[_0x4733('0xf')](_0x4733('0x10'),_0x12cafa,'request\x20sent',JSON[_0x4733('0x11')](_0x2d5fde));if(_0x2d5fde['error']){if(_0x2d5fde[_0x4733('0x12')][_0x4733('0x13')]===0x1f4){logger[_0x4733('0x12')](_0x4733('0xe'),_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x3562b7(_0x2d5fde[_0x4733('0x12')]['message']);}logger[_0x4733('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x8257cf(_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);}else{logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,_0x4733('0x15'));_0x8257cf(_0x2d5fde[_0x4733('0x16')][_0x4733('0x14')]);}})['catch'](function(_0x2c0031){logger[_0x4733('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x12cafa,_0x2c0031);_0x3562b7(_0x2c0031);});});}exports[_0x4733('0x17')]=function(_0x1d2fb6){var _0x2aa223=this;return new Promise(function(_0x384e0c,_0x579f67){return db['OpenchannelQueueReport'][_0x4733('0x18')](_0x1d2fb6[_0x4733('0x19')],{'raw':_0x1d2fb6['options']?_0x1d2fb6[_0x4733('0x1a')][_0x4733('0x1b')]===undefined?!![]:![]:!![]})[_0x4733('0xc')](function(_0x7a4e0){logger['info'](_0x4733('0x17'),_0x1d2fb6);logger[_0x4733('0xf')]('CreateOpenchannelQueueReport',_0x1d2fb6,JSON[_0x4733('0x11')](_0x7a4e0));_0x384e0c(_0x7a4e0);})[_0x4733('0x1c')](function(_0x478e34){logger[_0x4733('0x12')](_0x4733('0x17'),_0x478e34[_0x4733('0x14')],_0x1d2fb6);_0x579f67(_0x2aa223[_0x4733('0x12')](0x1f4,_0x478e34[_0x4733('0x14')]));});});};exports[_0x4733('0x1d')]=function(_0x180049){var _0x2bb78f=this;return new Promise(function(_0x523697,_0x3e6976){return db[_0x4733('0x1e')][_0x4733('0x1f')](_0x180049[_0x4733('0x19')],{'raw':_0x180049[_0x4733('0x1a')]?_0x180049[_0x4733('0x1a')][_0x4733('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x180049[_0x4733('0x1a')]?_0x180049[_0x4733('0x1a')][_0x4733('0x20')]||null:null,'attributes':_0x180049['options']?_0x180049[_0x4733('0x1a')]['attributes']||null:null,'limit':_0x180049['options']?_0x180049[_0x4733('0x1a')]['limit']||null:null})[_0x4733('0xc')](function(_0x479989){logger['info']('UpdateOpenchannelQueueReport',_0x180049);logger[_0x4733('0xf')](_0x4733('0x1d'),_0x180049,JSON[_0x4733('0x11')](_0x479989));_0x523697(_0x479989);})[_0x4733('0x1c')](function(_0x4fee4a){logger['error']('UpdateOpenchannelQueueReport',_0x4fee4a[_0x4733('0x14')],_0x180049);_0x3e6976(_0x2bb78f['error'](0x1f4,_0x4fee4a['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index a2d9610..07e61b7 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 _0x5714=['/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x5bcfc9,_0x4c6061){var _0x2aeab6=function(_0x45e9e3){while(--_0x45e9e3){_0x5bcfc9['push'](_0x5bcfc9['shift']());}};_0x2aeab6(++_0x4c6061);}(_0x5714,0x9a));var _0x4571=function(_0x29114c,_0x15cbd9){_0x29114c=_0x29114c-0x0;var _0x2402ff=_0x5714[_0x29114c];return _0x2402ff;};'use strict';var multer=require(_0x4571('0x0'));var util=require(_0x4571('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4571('0x2'));var router=express['Router']();var fs_extra=require(_0x4571('0x3'));var auth=require(_0x4571('0x4'));var interaction=require(_0x4571('0x5'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router[_0x4571('0x6')]('/',auth[_0x4571('0x7')](),controller['index']);router[_0x4571('0x6')](_0x4571('0x8'),auth['isAuthenticated'](),controller[_0x4571('0x9')]);router[_0x4571('0x6')](_0x4571('0xa'),auth[_0x4571('0x7')](),controller[_0x4571('0xb')]);router[_0x4571('0xc')]('/',auth[_0x4571('0x7')](),controller[_0x4571('0xd')]);router['put'](_0x4571('0xa'),auth[_0x4571('0x7')](),controller[_0x4571('0xe')]);router[_0x4571('0xf')]('/:id',auth[_0x4571('0x7')](),controller[_0x4571('0x10')]);module[_0x4571('0x11')]=router; \ No newline at end of file +var _0x6b65=['/describe','/:id','isAuthenticated','create','put','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','index'];(function(_0x1a3f6b,_0x2c24f9){var _0x46b067=function(_0x2e92f6){while(--_0x2e92f6){_0x1a3f6b['push'](_0x1a3f6b['shift']());}};_0x46b067(++_0x2c24f9);}(_0x6b65,0x14c));var _0x56b6=function(_0x1651ca,_0x24e352){_0x1651ca=_0x1651ca-0x0;var _0x579fd2=_0x6b65[_0x1651ca];return _0x579fd2;};'use strict';var multer=require(_0x56b6('0x0'));var util=require('util');var path=require(_0x56b6('0x1'));var timeout=require('connect-timeout');var express=require(_0x56b6('0x2'));var router=express[_0x56b6('0x3')]();var fs_extra=require(_0x56b6('0x4'));var auth=require(_0x56b6('0x5'));var interaction=require(_0x56b6('0x6'));var config=require('../../config/environment');var controller=require(_0x56b6('0x7'));router[_0x56b6('0x8')]('/',auth['isAuthenticated'](),controller[_0x56b6('0x9')]);router[_0x56b6('0x8')](_0x56b6('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x56b6('0x8')](_0x56b6('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x56b6('0xc')](),controller[_0x56b6('0xd')]);router[_0x56b6('0xe')]('/:id',auth[_0x56b6('0xc')](),controller['update']);router[_0x56b6('0xf')](_0x56b6('0xb'),auth[_0x56b6('0xc')](),controller[_0x56b6('0x10')]);module[_0x56b6('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index e565ba5..0f8b580 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x325501,_0x5242f6){var _0x2c1626=function(_0x4270b2){while(--_0x4270b2){_0x325501['push'](_0x325501['shift']());}};_0x2c1626(++_0x5242f6);}(_0x9bde,0xe1));var _0xe9bd=function(_0x471421,_0x23b1a5){_0x471421=_0x471421-0x0;var _0x4443f3=_0x9bde[_0x471421];return _0x4443f3;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x1cd44f,_0x498c23){var _0x55765d=function(_0x5e585f){while(--_0x5e585f){_0x1cd44f['push'](_0x1cd44f['shift']());}};_0x55765d(++_0x498c23);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0xcb91[_0x5a2d3f];return _0x5c65d8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 06eaa4b..8f7ce0e 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 _0x97aa=['jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','then','name','send','OpenchannelTransferReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','create','update','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x16aaef,_0x410651){var _0x1c82ef=function(_0x3d802b){while(--_0x3d802b){_0x16aaef['push'](_0x16aaef['shift']());}};_0x1c82ef(++_0x410651);}(_0x97aa,0xbd));var _0xa97a=function(_0x36b1b3,_0x36b83c){_0x36b1b3=_0x36b1b3-0x0;var _0x39790e=_0x97aa[_0x36b1b3];return _0x39790e;};'use strict';var emlformat=require(_0xa97a('0x0'));var rimraf=require(_0xa97a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa97a('0x2'));var rp=require('request-promise');var moment=require(_0xa97a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa97a('0x4'));var util=require('util');var path=require(_0xa97a('0x5'));var sox=require(_0xa97a('0x6'));var csv=require(_0xa97a('0x7'));var ejs=require(_0xa97a('0x8'));var fs=require('fs');var fs_extra=require(_0xa97a('0x9'));var _=require(_0xa97a('0xa'));var squel=require(_0xa97a('0xb'));var crypto=require('crypto');var jsforce=require(_0xa97a('0xc'));var deskjs=require(_0xa97a('0xd'));var toCsv=require(_0xa97a('0x7'));var querystring=require('querystring');var Papa=require(_0xa97a('0xe'));var Redis=require(_0xa97a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa97a('0x10'));var as=require(_0xa97a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa97a('0x12'))('api');var utils=require(_0xa97a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa97a('0x14'));var db=require(_0xa97a('0x15'))['db'];function respondWithStatusCode(_0x47fac5,_0x28515c){_0x28515c=_0x28515c||0xcc;return function(_0x184c3d){if(_0x184c3d){return _0x47fac5[_0xa97a('0x16')](_0x28515c);}return _0x47fac5[_0xa97a('0x17')](_0x28515c)[_0xa97a('0x18')]();};}function respondWithResult(_0x35fb51,_0x3a5264){_0x3a5264=_0x3a5264||0xc8;return function(_0x31c09a){if(_0x31c09a){return _0x35fb51[_0xa97a('0x17')](_0x3a5264)[_0xa97a('0x19')](_0x31c09a);}};}function respondWithFilteredResult(_0x5a2be0,_0x4d29b1){return function(_0x224a3a){if(_0x224a3a){var _0x3e4372=typeof _0x4d29b1[_0xa97a('0x1a')]===_0xa97a('0x1b')&&typeof _0x4d29b1[_0xa97a('0x1c')]===_0xa97a('0x1b');var _0x47f80c=_0x224a3a[_0xa97a('0x1d')];var _0x27836e=_0x3e4372?0x0:_0x4d29b1['offset'];var _0x5f04a3=_0x3e4372?_0x224a3a['count']:_0x4d29b1[_0xa97a('0x1a')]+_0x4d29b1[_0xa97a('0x1c')];var _0x16c64c;if(_0x5f04a3>=_0x47f80c){_0x5f04a3=_0x47f80c;_0x16c64c=0xc8;}else{_0x16c64c=0xce;}_0x5a2be0[_0xa97a('0x17')](_0x16c64c);return _0x5a2be0[_0xa97a('0x1e')]('Content-Range',_0x27836e+'-'+_0x5f04a3+'/'+_0x47f80c)[_0xa97a('0x19')](_0x224a3a);}return null;};}function patchUpdates(_0x9af229){return function(_0x41aded){try{jsonpatch['apply'](_0x41aded,_0x9af229,!![]);}catch(_0x20c711){return BPromise['reject'](_0x20c711);}return _0x41aded['save']();};}function saveUpdates(_0x1a540d,_0x3d896f){return function(_0x2c308f){if(_0x2c308f){return _0x2c308f['update'](_0x1a540d)[_0xa97a('0x1f')](function(_0x585be8){return _0x585be8;});}return null;};}function removeEntity(_0x1fbfcb,_0x2b2805){return function(_0x50db7a){if(_0x50db7a){return _0x50db7a['destroy']()[_0xa97a('0x1f')](function(){_0x1fbfcb[_0xa97a('0x17')](0xcc)[_0xa97a('0x18')]();});}};}function handleEntityNotFound(_0x1919fd,_0x484a51){return function(_0x34403b){if(!_0x34403b){_0x1919fd[_0xa97a('0x16')](0x194);}return _0x34403b;};}function handleError(_0x395c92,_0x33ced1){_0x33ced1=_0x33ced1||0x1f4;return function(_0x58215f){logger['error'](_0x58215f['stack']);if(_0x58215f[_0xa97a('0x20')]){delete _0x58215f[_0xa97a('0x20')];}_0x395c92[_0xa97a('0x17')](_0x33ced1)[_0xa97a('0x21')](_0x58215f);};}exports['index']=function(_0x32ad1b,_0x7d7512){var _0x41d092={},_0x209fbf={},_0x1355d4={'count':0x0,'rows':[]};var _0x12dc1a=_['map'](db[_0xa97a('0x22')][_0xa97a('0x23')],function(_0x154718){return{'name':_0x154718['fieldName'],'type':_0x154718[_0xa97a('0x24')]['key']};});_0x209fbf[_0xa97a('0x25')]=_['map'](_0x12dc1a,'name');_0x209fbf['query']=_[_0xa97a('0x26')](_0x32ad1b[_0xa97a('0x27')]);_0x209fbf[_0xa97a('0x28')]=_[_0xa97a('0x29')](_0x209fbf[_0xa97a('0x25')],_0x209fbf[_0xa97a('0x27')]);_0x41d092[_0xa97a('0x2a')]=_[_0xa97a('0x29')](_0x209fbf[_0xa97a('0x25')],qs['fields'](_0x32ad1b[_0xa97a('0x27')][_0xa97a('0x2b')]));_0x41d092[_0xa97a('0x2a')]=_0x41d092[_0xa97a('0x2a')]['length']?_0x41d092[_0xa97a('0x2a')]:_0x209fbf[_0xa97a('0x25')];if(!_0x32ad1b['query'][_0xa97a('0x2c')]('nolimit')){_0x41d092[_0xa97a('0x1c')]=qs[_0xa97a('0x1c')](_0x32ad1b[_0xa97a('0x27')][_0xa97a('0x1c')]);_0x41d092['offset']=qs['offset'](_0x32ad1b[_0xa97a('0x27')][_0xa97a('0x1a')]);}_0x41d092[_0xa97a('0x2d')]=qs[_0xa97a('0x2e')](_0x32ad1b[_0xa97a('0x27')][_0xa97a('0x2e')]);_0x41d092[_0xa97a('0x2f')]=qs[_0xa97a('0x28')](_[_0xa97a('0x30')](_0x32ad1b['query'],_0x209fbf[_0xa97a('0x28')]),_0x12dc1a);if(_0x32ad1b[_0xa97a('0x27')][_0xa97a('0x31')]){_0x41d092[_0xa97a('0x2f')]=_[_0xa97a('0x32')](_0x41d092[_0xa97a('0x2f')],{'$or':_[_0xa97a('0x33')](_0x12dc1a,function(_0x5a1229){if(_0x5a1229[_0xa97a('0x24')]!==_0xa97a('0x34')){var _0x72fac5={};_0x72fac5[_0x5a1229['name']]={'$like':'%'+_0x32ad1b[_0xa97a('0x27')][_0xa97a('0x31')]+'%'};return _0x72fac5;}})});}_0x41d092=_['merge']({},_0x41d092,_0x32ad1b[_0xa97a('0x35')]);var _0x4682b8={'where':_0x41d092['where']};return db[_0xa97a('0x22')][_0xa97a('0x1d')](_0x4682b8)[_0xa97a('0x1f')](function(_0x5cde9c){_0x1355d4[_0xa97a('0x1d')]=_0x5cde9c;if(_0x32ad1b[_0xa97a('0x27')][_0xa97a('0x36')]){_0x41d092[_0xa97a('0x37')]=[{'all':!![]}];}return db[_0xa97a('0x22')]['findAll'](_0x41d092);})[_0xa97a('0x1f')](function(_0x3dd9b8){_0x1355d4[_0xa97a('0x38')]=_0x3dd9b8;return _0x1355d4;})[_0xa97a('0x1f')](respondWithFilteredResult(_0x7d7512,_0x41d092))[_0xa97a('0x39')](handleError(_0x7d7512,null));};exports[_0xa97a('0x3a')]=function(_0x3f8ca0,_0x27e838){var _0x29e700={'raw':!![],'where':{'id':_0x3f8ca0[_0xa97a('0x3b')]['id']}},_0x35a2b1={};_0x35a2b1[_0xa97a('0x25')]=_['keys'](db[_0xa97a('0x22')][_0xa97a('0x23')]);_0x35a2b1[_0xa97a('0x27')]=_[_0xa97a('0x26')](_0x3f8ca0[_0xa97a('0x27')]);_0x35a2b1[_0xa97a('0x28')]=_['intersection'](_0x35a2b1[_0xa97a('0x25')],_0x35a2b1['query']);_0x29e700[_0xa97a('0x2a')]=_[_0xa97a('0x29')](_0x35a2b1[_0xa97a('0x25')],qs[_0xa97a('0x2b')](_0x3f8ca0['query'][_0xa97a('0x2b')]));_0x29e700['attributes']=_0x29e700[_0xa97a('0x2a')][_0xa97a('0x3c')]?_0x29e700[_0xa97a('0x2a')]:_0x35a2b1[_0xa97a('0x25')];if(_0x3f8ca0[_0xa97a('0x27')][_0xa97a('0x36')]){_0x29e700['include']=[{'all':!![]}];}_0x29e700=_[_0xa97a('0x32')]({},_0x29e700,_0x3f8ca0[_0xa97a('0x35')]);return db[_0xa97a('0x22')]['find'](_0x29e700)[_0xa97a('0x1f')](handleEntityNotFound(_0x27e838,null))[_0xa97a('0x1f')](respondWithResult(_0x27e838,null))[_0xa97a('0x39')](handleError(_0x27e838,null));};exports[_0xa97a('0x3d')]=function(_0x4da9e8,_0x567cfa){return db[_0xa97a('0x22')][_0xa97a('0x3d')](_0x4da9e8['body'],{})[_0xa97a('0x1f')](respondWithResult(_0x567cfa,0xc9))['catch'](handleError(_0x567cfa,null));};exports[_0xa97a('0x3e')]=function(_0x1c8d60,_0x1e67e7){if(_0x1c8d60[_0xa97a('0x3f')]['id']){delete _0x1c8d60['body']['id'];}return db[_0xa97a('0x22')][_0xa97a('0x40')]({'where':{'id':_0x1c8d60['params']['id']}})[_0xa97a('0x1f')](handleEntityNotFound(_0x1e67e7,null))[_0xa97a('0x1f')](saveUpdates(_0x1c8d60[_0xa97a('0x3f')],null))[_0xa97a('0x1f')](respondWithResult(_0x1e67e7,null))[_0xa97a('0x39')](handleError(_0x1e67e7,null));};exports[_0xa97a('0x41')]=function(_0x158ed6,_0x9ffbad){return db[_0xa97a('0x22')]['find']({'where':{'id':_0x158ed6[_0xa97a('0x3b')]['id']}})[_0xa97a('0x1f')](handleEntityNotFound(_0x9ffbad,null))[_0xa97a('0x1f')](removeEntity(_0x9ffbad,null))[_0xa97a('0x39')](handleError(_0x9ffbad,null));};exports[_0xa97a('0x42')]=function(_0xa2dc5e,_0xae3b90){return db['OpenchannelTransferReport'][_0xa97a('0x42')]()[_0xa97a('0x1f')](respondWithResult(_0xae3b90,null))[_0xa97a('0x39')](handleError(_0xae3b90,null));}; \ No newline at end of file +var _0x3764=['bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','error','stack','name','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','OpenchannelTransferReport','then','include','findAll','rows','catch','show','params','create','body','find','destroy','eml-format','rimraf','zip-dir','moment'];(function(_0x52c32b,_0x3cb433){var _0x214963=function(_0x193bbd){while(--_0x193bbd){_0x52c32b['push'](_0x52c32b['shift']());}};_0x214963(++_0x3cb433);}(_0x3764,0x124));var _0x4376=function(_0x534221,_0xb623fd){_0x534221=_0x534221-0x0;var _0x14817b=_0x3764[_0x534221];return _0x14817b;};'use strict';var emlformat=require(_0x4376('0x0'));var rimraf=require(_0x4376('0x1'));var zipdir=require(_0x4376('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4376('0x3'));var BPromise=require(_0x4376('0x4'));var Mustache=require(_0x4376('0x5'));var util=require(_0x4376('0x6'));var path=require(_0x4376('0x7'));var sox=require(_0x4376('0x8'));var csv=require('to-csv');var ejs=require(_0x4376('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4376('0xa'));var squel=require('squel');var crypto=require(_0x4376('0xb'));var jsforce=require(_0x4376('0xc'));var deskjs=require(_0x4376('0xd'));var toCsv=require(_0x4376('0xe'));var querystring=require(_0x4376('0xf'));var Papa=require(_0x4376('0x10'));var Redis=require(_0x4376('0x11'));var authService=require(_0x4376('0x12'));var qs=require(_0x4376('0x13'));var as=require(_0x4376('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4376('0x15'))(_0x4376('0x16'));var utils=require('../../config/utils');var config=require(_0x4376('0x17'));var licenseUtil=require(_0x4376('0x18'));var db=require(_0x4376('0x19'))['db'];function respondWithStatusCode(_0x8097ab,_0x4e297b){_0x4e297b=_0x4e297b||0xcc;return function(_0x511b82){if(_0x511b82){return _0x8097ab[_0x4376('0x1a')](_0x4e297b);}return _0x8097ab[_0x4376('0x1b')](_0x4e297b)[_0x4376('0x1c')]();};}function respondWithResult(_0xec172b,_0x7a4b52){_0x7a4b52=_0x7a4b52||0xc8;return function(_0x28b53d){if(_0x28b53d){return _0xec172b['status'](_0x7a4b52)[_0x4376('0x1d')](_0x28b53d);}};}function respondWithFilteredResult(_0x4ed011,_0x6672af){return function(_0x51ae9f){if(_0x51ae9f){var _0x5557ca=typeof _0x6672af['offset']===_0x4376('0x1e')&&typeof _0x6672af[_0x4376('0x1f')]==='undefined';var _0xbdd78e=_0x51ae9f[_0x4376('0x20')];var _0x41966f=_0x5557ca?0x0:_0x6672af[_0x4376('0x21')];var _0x3088cb=_0x5557ca?_0x51ae9f[_0x4376('0x20')]:_0x6672af[_0x4376('0x21')]+_0x6672af[_0x4376('0x1f')];var _0x16bdc4;if(_0x3088cb>=_0xbdd78e){_0x3088cb=_0xbdd78e;_0x16bdc4=0xc8;}else{_0x16bdc4=0xce;}_0x4ed011['status'](_0x16bdc4);return _0x4ed011['set']('Content-Range',_0x41966f+'-'+_0x3088cb+'/'+_0xbdd78e)[_0x4376('0x1d')](_0x51ae9f);}return null;};}function patchUpdates(_0x28b823){return function(_0x26f894){try{jsonpatch[_0x4376('0x22')](_0x26f894,_0x28b823,!![]);}catch(_0x498c4a){return BPromise[_0x4376('0x23')](_0x498c4a);}return _0x26f894[_0x4376('0x24')]();};}function saveUpdates(_0x2900fd,_0x4e2af3){return function(_0x58b314){if(_0x58b314){return _0x58b314[_0x4376('0x25')](_0x2900fd)['then'](function(_0x5d3660){return _0x5d3660;});}return null;};}function removeEntity(_0x59a9c1,_0x21594e){return function(_0x4d38a5){if(_0x4d38a5){return _0x4d38a5['destroy']()['then'](function(){_0x59a9c1[_0x4376('0x1b')](0xcc)[_0x4376('0x1c')]();});}};}function handleEntityNotFound(_0x7c11e5,_0x1ef3e9){return function(_0x411647){if(!_0x411647){_0x7c11e5[_0x4376('0x1a')](0x194);}return _0x411647;};}function handleError(_0x14380a,_0x8836f5){_0x8836f5=_0x8836f5||0x1f4;return function(_0x3cdf9c){logger[_0x4376('0x26')](_0x3cdf9c[_0x4376('0x27')]);if(_0x3cdf9c['name']){delete _0x3cdf9c[_0x4376('0x28')];}_0x14380a[_0x4376('0x1b')](_0x8836f5)['send'](_0x3cdf9c);};}exports['index']=function(_0x167498,_0x1b80cf){var _0x543dcc={},_0x2c5ed2={},_0x4cd439={'count':0x0,'rows':[]};var _0x2ec025=_[_0x4376('0x29')](db['OpenchannelTransferReport'][_0x4376('0x2a')],function(_0x4e0987){return{'name':_0x4e0987['fieldName'],'type':_0x4e0987[_0x4376('0x2b')][_0x4376('0x2c')]};});_0x2c5ed2[_0x4376('0x2d')]=_[_0x4376('0x29')](_0x2ec025,_0x4376('0x28'));_0x2c5ed2[_0x4376('0x2e')]=_[_0x4376('0x2f')](_0x167498[_0x4376('0x2e')]);_0x2c5ed2[_0x4376('0x30')]=_['intersection'](_0x2c5ed2['model'],_0x2c5ed2[_0x4376('0x2e')]);_0x543dcc[_0x4376('0x31')]=_[_0x4376('0x32')](_0x2c5ed2[_0x4376('0x2d')],qs['fields'](_0x167498['query'][_0x4376('0x33')]));_0x543dcc[_0x4376('0x31')]=_0x543dcc[_0x4376('0x31')][_0x4376('0x34')]?_0x543dcc[_0x4376('0x31')]:_0x2c5ed2[_0x4376('0x2d')];if(!_0x167498[_0x4376('0x2e')][_0x4376('0x35')](_0x4376('0x36'))){_0x543dcc[_0x4376('0x1f')]=qs[_0x4376('0x1f')](_0x167498[_0x4376('0x2e')][_0x4376('0x1f')]);_0x543dcc['offset']=qs[_0x4376('0x21')](_0x167498[_0x4376('0x2e')][_0x4376('0x21')]);}_0x543dcc[_0x4376('0x37')]=qs[_0x4376('0x38')](_0x167498['query']['sort']);_0x543dcc['where']=qs[_0x4376('0x30')](_['pick'](_0x167498[_0x4376('0x2e')],_0x2c5ed2[_0x4376('0x30')]),_0x2ec025);if(_0x167498[_0x4376('0x2e')][_0x4376('0x39')]){_0x543dcc[_0x4376('0x3a')]=_[_0x4376('0x3b')](_0x543dcc['where'],{'$or':_[_0x4376('0x29')](_0x2ec025,function(_0x5c9082){if(_0x5c9082[_0x4376('0x2b')]!==_0x4376('0x3c')){var _0xba5183={};_0xba5183[_0x5c9082[_0x4376('0x28')]]={'$like':'%'+_0x167498[_0x4376('0x2e')][_0x4376('0x39')]+'%'};return _0xba5183;}})});}_0x543dcc=_[_0x4376('0x3b')]({},_0x543dcc,_0x167498[_0x4376('0x3d')]);var _0xe21762={'where':_0x543dcc[_0x4376('0x3a')]};return db[_0x4376('0x3e')][_0x4376('0x20')](_0xe21762)[_0x4376('0x3f')](function(_0x34952f){_0x4cd439[_0x4376('0x20')]=_0x34952f;if(_0x167498['query']['includeAll']){_0x543dcc[_0x4376('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x4376('0x41')](_0x543dcc);})[_0x4376('0x3f')](function(_0x25bf2d){_0x4cd439[_0x4376('0x42')]=_0x25bf2d;return _0x4cd439;})['then'](respondWithFilteredResult(_0x1b80cf,_0x543dcc))[_0x4376('0x43')](handleError(_0x1b80cf,null));};exports[_0x4376('0x44')]=function(_0x5ae22d,_0x441d21){var _0x33d9fd={'raw':!![],'where':{'id':_0x5ae22d[_0x4376('0x45')]['id']}},_0x403df0={};_0x403df0[_0x4376('0x2d')]=_[_0x4376('0x2f')](db[_0x4376('0x3e')][_0x4376('0x2a')]);_0x403df0[_0x4376('0x2e')]=_[_0x4376('0x2f')](_0x5ae22d[_0x4376('0x2e')]);_0x403df0['filters']=_[_0x4376('0x32')](_0x403df0[_0x4376('0x2d')],_0x403df0[_0x4376('0x2e')]);_0x33d9fd['attributes']=_['intersection'](_0x403df0['model'],qs['fields'](_0x5ae22d[_0x4376('0x2e')]['fields']));_0x33d9fd[_0x4376('0x31')]=_0x33d9fd['attributes'][_0x4376('0x34')]?_0x33d9fd['attributes']:_0x403df0[_0x4376('0x2d')];if(_0x5ae22d[_0x4376('0x2e')]['includeAll']){_0x33d9fd[_0x4376('0x40')]=[{'all':!![]}];}_0x33d9fd=_[_0x4376('0x3b')]({},_0x33d9fd,_0x5ae22d['options']);return db[_0x4376('0x3e')]['find'](_0x33d9fd)['then'](handleEntityNotFound(_0x441d21,null))['then'](respondWithResult(_0x441d21,null))['catch'](handleError(_0x441d21,null));};exports['create']=function(_0x50b084,_0x2384c8){return db[_0x4376('0x3e')][_0x4376('0x46')](_0x50b084[_0x4376('0x47')],{})[_0x4376('0x3f')](respondWithResult(_0x2384c8,0xc9))[_0x4376('0x43')](handleError(_0x2384c8,null));};exports[_0x4376('0x25')]=function(_0x20aa97,_0x135799){if(_0x20aa97[_0x4376('0x47')]['id']){delete _0x20aa97['body']['id'];}return db[_0x4376('0x3e')][_0x4376('0x48')]({'where':{'id':_0x20aa97[_0x4376('0x45')]['id']}})['then'](handleEntityNotFound(_0x135799,null))[_0x4376('0x3f')](saveUpdates(_0x20aa97[_0x4376('0x47')],null))['then'](respondWithResult(_0x135799,null))[_0x4376('0x43')](handleError(_0x135799,null));};exports[_0x4376('0x49')]=function(_0x5ce526,_0x5b2feb){return db[_0x4376('0x3e')]['find']({'where':{'id':_0x5ce526[_0x4376('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b2feb,null))['then'](removeEntity(_0x5b2feb,null))[_0x4376('0x43')](handleError(_0x5b2feb,null));};exports['describe']=function(_0x1c38ae,_0x7adfa4){return db[_0x4376('0x3e')]['describe']()[_0x4376('0x3f')](respondWithResult(_0x7adfa4,null))[_0x4376('0x43')](handleError(_0x7adfa4,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 9dd940d..7ce7cec 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 _0x4cc6=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0xbba191,_0xb90a02){var _0x4abbab=function(_0x180445){while(--_0x180445){_0xbba191['push'](_0xbba191['shift']());}};_0x4abbab(++_0xb90a02);}(_0x4cc6,0x1ec));var _0x64cc=function(_0x4ec9e3,_0x15fbf4){_0x4ec9e3=_0x4ec9e3-0x0;var _0x2883ce=_0x4cc6[_0x4ec9e3];return _0x2883ce;};'use strict';var _=require(_0x64cc('0x0'));var util=require(_0x64cc('0x1'));var logger=require(_0x64cc('0x2'))(_0x64cc('0x3'));var moment=require(_0x64cc('0x4'));var BPromise=require(_0x64cc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64cc('0x6'));var rimraf=require(_0x64cc('0x7'));var config=require(_0x64cc('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0x64cc('0x9')]=function(_0x24769a,_0x18102c){return _0x24769a[_0x64cc('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0x64cc('0xb'),'paranoid':![],'indexes':[{'name':_0x64cc('0xc'),'fields':[_0x64cc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x663a=['request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','lodash','util','../../config/logger','moment','bluebird'];(function(_0x452eef,_0x44ac48){var _0x362709=function(_0x9be0e9){while(--_0x9be0e9){_0x452eef['push'](_0x452eef['shift']());}};_0x362709(++_0x44ac48);}(_0x663a,0x1e9));var _0xa663=function(_0x27a159,_0x1fd3c9){_0x27a159=_0x27a159-0x0;var _0x1a8e9f=_0x663a[_0x27a159];return _0x1a8e9f;};'use strict';var _=require(_0xa663('0x0'));var util=require(_0xa663('0x1'));var logger=require(_0xa663('0x2'))('api');var moment=require(_0xa663('0x3'));var BPromise=require(_0xa663('0x4'));var rp=require(_0xa663('0x5'));var fs=require('fs');var path=require(_0xa663('0x6'));var rimraf=require(_0xa663('0x7'));var config=require('../../config/environment');var attributes=require(_0xa663('0x8'));module[_0xa663('0x9')]=function(_0x35740b,_0x2f5a2f){return _0x35740b[_0xa663('0xa')](_0xa663('0xb'),attributes,{'tableName':_0xa663('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 98828fb..47e8083 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 _0x6f47=['request\x20sent','debug','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0x6f47,0xc7));var _0x76f4=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x6f47[_0x9fd887];return _0x1a54ab;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var moment=require(_0x76f4('0x1'));var BPromise=require('bluebird');var rs=require(_0x76f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76f4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x76f4('0x4'))(_0x76f4('0x5'));var config=require(_0x76f4('0x6'));var jayson=require(_0x76f4('0x7'));var client=jayson['client'][_0x76f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfc2405,_0x2176a7,_0x497f99){return new BPromise(function(_0x1a3172,_0x25656d){return client[_0x76f4('0x9')](_0xfc2405,_0x497f99)[_0x76f4('0xa')](function(_0x101f55){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x2176a7,_0x76f4('0xb'));logger[_0x76f4('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2176a7,'request\x20sent',JSON[_0x76f4('0xd')](_0x101f55));if(_0x101f55[_0x76f4('0xe')]){if(_0x101f55[_0x76f4('0xe')][_0x76f4('0xf')]===0x1f4){logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x101f55[_0x76f4('0xe')][_0x76f4('0x11')]);return _0x25656d(_0x101f55[_0x76f4('0xe')]['message']);}logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x101f55['error']['message']);return _0x1a3172(_0x101f55['error'][_0x76f4('0x11')]);}else{logger[_0x76f4('0x12')](_0x76f4('0x10'),_0x2176a7,_0x76f4('0xb'));_0x1a3172(_0x101f55[_0x76f4('0x13')][_0x76f4('0x11')]);}})[_0x76f4('0x14')](function(_0x981a87){logger[_0x76f4('0xe')](_0x76f4('0x10'),_0x2176a7,_0x981a87);_0x25656d(_0x981a87);});});} \ No newline at end of file +var _0xeb5d=['then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xeb5d[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xdeb5('0x0'));var moment=require(_0xdeb5('0x1'));var BPromise=require(_0xdeb5('0x2'));var rs=require(_0xdeb5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdeb5('0x4'));var logger=require(_0xdeb5('0x5'))('rpc');var config=require(_0xdeb5('0x6'));var jayson=require(_0xdeb5('0x7'));var client=jayson[_0xdeb5('0x8')][_0xdeb5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x120329,_0x12484b,_0x328d6b){return new BPromise(function(_0x35c086,_0x2c8509){return client[_0xdeb5('0xa')](_0x120329,_0x328d6b)[_0xdeb5('0xb')](function(_0x2114ba){logger[_0xdeb5('0xc')](_0xdeb5('0xd'),_0x12484b,_0xdeb5('0xe'));logger[_0xdeb5('0xf')](_0xdeb5('0x10'),_0x12484b,'request\x20sent',JSON[_0xdeb5('0x11')](_0x2114ba));if(_0x2114ba[_0xdeb5('0x12')]){if(_0x2114ba[_0xdeb5('0x12')][_0xdeb5('0x13')]===0x1f4){logger[_0xdeb5('0x12')](_0xdeb5('0xd'),_0x12484b,_0x2114ba[_0xdeb5('0x12')][_0xdeb5('0x14')]);return _0x2c8509(_0x2114ba['error'][_0xdeb5('0x14')]);}logger['error'](_0xdeb5('0xd'),_0x12484b,_0x2114ba[_0xdeb5('0x12')][_0xdeb5('0x14')]);return _0x35c086(_0x2114ba[_0xdeb5('0x12')][_0xdeb5('0x14')]);}else{logger['info'](_0xdeb5('0xd'),_0x12484b,_0xdeb5('0xe'));_0x35c086(_0x2114ba['result'][_0xdeb5('0x14')]);}})[_0xdeb5('0x15')](function(_0x3521b2){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x12484b,_0x3521b2);_0x2c8509(_0x3521b2);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index c6bc8a7..f83801d 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 _0x569e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','create','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x5e6c43,_0x132a12){var _0x23d90e=function(_0x279b49){while(--_0x279b49){_0x5e6c43['push'](_0x5e6c43['shift']());}};_0x23d90e(++_0x132a12);}(_0x569e,0x199));var _0xe569=function(_0x5c43e1,_0x4c1705){_0x5c43e1=_0x5c43e1-0x0;var _0x397fa7=_0x569e[_0x5c43e1];return _0x397fa7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe569('0x0'));var timeout=require(_0xe569('0x1'));var express=require(_0xe569('0x2'));var router=express[_0xe569('0x3')]();var fs_extra=require(_0xe569('0x4'));var auth=require(_0xe569('0x5'));var interaction=require(_0xe569('0x6'));var config=require(_0xe569('0x7'));var controller=require('./pause.controller');router[_0xe569('0x8')]('/',auth['isAuthenticated'](),controller[_0xe569('0x9')]);router[_0xe569('0x8')]('/:id',auth[_0xe569('0xa')](),controller[_0xe569('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe569('0xc')]);router['put'](_0xe569('0xd'),auth[_0xe569('0xa')](),controller[_0xe569('0xe')]);router[_0xe569('0xf')](_0xe569('0xd'),auth[_0xe569('0xa')](),controller[_0xe569('0x10')]);module[_0xe569('0x11')]=router; \ No newline at end of file +var _0x9010=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show','put'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x9010,0xdf));var _0x0901=function(_0x3391cb,_0x9d79){_0x3391cb=_0x3391cb-0x0;var _0x363f39=_0x9010[_0x3391cb];return _0x363f39;};'use strict';var multer=require(_0x0901('0x0'));var util=require(_0x0901('0x1'));var path=require(_0x0901('0x2'));var timeout=require(_0x0901('0x3'));var express=require(_0x0901('0x4'));var router=express[_0x0901('0x5')]();var fs_extra=require(_0x0901('0x6'));var auth=require(_0x0901('0x7'));var interaction=require(_0x0901('0x8'));var config=require(_0x0901('0x9'));var controller=require(_0x0901('0xa'));router['get']('/',auth[_0x0901('0xb')](),controller[_0x0901('0xc')]);router[_0x0901('0xd')](_0x0901('0xe'),auth[_0x0901('0xb')](),controller[_0x0901('0xf')]);router['post']('/',auth[_0x0901('0xb')](),controller['create']);router[_0x0901('0x10')]('/:id',auth[_0x0901('0xb')](),controller[_0x0901('0x11')]);router[_0x0901('0x12')](_0x0901('0xe'),auth[_0x0901('0xb')](),controller[_0x0901('0x13')]);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 990abaa..df0c791 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 _0xb991=['STRING'];(function(_0x51add4,_0x378479){var _0x21be7c=function(_0x5b25c4){while(--_0x5b25c4){_0x51add4['push'](_0x51add4['shift']());}};_0x21be7c(++_0x378479);}(_0xb991,0x13e));var _0x1b99=function(_0x30abff,_0x5f2c5f){_0x30abff=_0x30abff-0x0;var _0x4c571e=_0xb991[_0x30abff];return _0x4c571e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x1b99('0x0')]}}; \ No newline at end of file +var _0xbf27=['exports','name','sequelize'];(function(_0x23a417,_0x56ff8e){var _0x3c1651=function(_0x3e2b19){while(--_0x3e2b19){_0x23a417['push'](_0x23a417['shift']());}};_0x3c1651(++_0x56ff8e);}(_0xbf27,0x71));var _0x7bf2=function(_0x15a205,_0x4b9022){_0x15a205=_0x15a205-0x0;var _0x51290a=_0xbf27[_0x15a205];return _0x51290a;};'use strict';var Sequelize=require(_0x7bf2('0x0'));module[_0x7bf2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7bf2('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 32a5f70..f001af7 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 _0x77bc=['sendStatus','end','json','offset','undefined','count','limit','status','set','apply','save','update','then','destroy','get','Pauses','UserProfileResource','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','Pause','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','moment','util','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x243122,_0x2073b2){var _0x3e7dab=function(_0x13c87e){while(--_0x13c87e){_0x243122['push'](_0x243122['shift']());}};_0x3e7dab(++_0x2073b2);}(_0x77bc,0x82));var _0xc77b=function(_0xe16f3c,_0x2ee8c4){_0xe16f3c=_0xe16f3c-0x0;var _0x7df2cb=_0x77bc[_0xe16f3c];return _0x7df2cb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc77b('0x0'));var jsonpatch=require(_0xc77b('0x1'));var rp=require('request-promise');var moment=require(_0xc77b('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc77b('0x3'));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(_0xc77b('0x4'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc77b('0x5'));var jsforce=require(_0xc77b('0x6'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc77b('0x7'));var Papa=require(_0xc77b('0x8'));var Redis=require('ioredis');var authService=require(_0xc77b('0x9'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc77b('0xa'));var logger=require('../../config/logger')('api');var utils=require(_0xc77b('0xb'));var config=require('../../config/environment');var licenseUtil=require(_0xc77b('0xc'));var db=require(_0xc77b('0xd'))['db'];function respondWithStatusCode(_0x55bca8,_0x46fe2b){_0x46fe2b=_0x46fe2b||0xcc;return function(_0x287801){if(_0x287801){return _0x55bca8[_0xc77b('0xe')](_0x46fe2b);}return _0x55bca8['status'](_0x46fe2b)[_0xc77b('0xf')]();};}function respondWithResult(_0x7643c6,_0x45f7d1){_0x45f7d1=_0x45f7d1||0xc8;return function(_0x3d7793){if(_0x3d7793){return _0x7643c6['status'](_0x45f7d1)[_0xc77b('0x10')](_0x3d7793);}};}function respondWithFilteredResult(_0x4077fb,_0x2ef242){return function(_0x43f3ec){if(_0x43f3ec){var _0x28e44a=typeof _0x2ef242[_0xc77b('0x11')]==='undefined'&&typeof _0x2ef242['limit']===_0xc77b('0x12');var _0x4d4f05=_0x43f3ec[_0xc77b('0x13')];var _0x3e481a=_0x28e44a?0x0:_0x2ef242['offset'];var _0x59ad82=_0x28e44a?_0x43f3ec[_0xc77b('0x13')]:_0x2ef242['offset']+_0x2ef242[_0xc77b('0x14')];var _0x4e1df5;if(_0x59ad82>=_0x4d4f05){_0x59ad82=_0x4d4f05;_0x4e1df5=0xc8;}else{_0x4e1df5=0xce;}_0x4077fb[_0xc77b('0x15')](_0x4e1df5);return _0x4077fb[_0xc77b('0x16')]('Content-Range',_0x3e481a+'-'+_0x59ad82+'/'+_0x4d4f05)[_0xc77b('0x10')](_0x43f3ec);}return null;};}function patchUpdates(_0x48d3e4){return function(_0x360a4c){try{jsonpatch[_0xc77b('0x17')](_0x360a4c,_0x48d3e4,!![]);}catch(_0x25d7d6){return BPromise['reject'](_0x25d7d6);}return _0x360a4c[_0xc77b('0x18')]();};}function saveUpdates(_0x1c1f83,_0x38c61b){return function(_0x4f35b1){if(_0x4f35b1){return _0x4f35b1[_0xc77b('0x19')](_0x1c1f83)[_0xc77b('0x1a')](function(_0x172600){return _0x172600;});}return null;};}function removeEntity(_0x23b233,_0x44ea9e){return function(_0x46c2bb){if(_0x46c2bb){return _0x46c2bb[_0xc77b('0x1b')]()[_0xc77b('0x1a')](function(){var _0x4aed50=_0x46c2bb[_0xc77b('0x1c')]({'plain':!![]});var _0x247699=_0xc77b('0x1d');return db[_0xc77b('0x1e')][_0xc77b('0x1b')]({'where':{'type':_0x247699,'resourceId':_0x4aed50['id']}})[_0xc77b('0x1a')](function(){return _0x46c2bb;});})[_0xc77b('0x1a')](function(){_0x23b233[_0xc77b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a0bf5,_0x35640d){return function(_0x5c90c3){if(!_0x5c90c3){_0x4a0bf5[_0xc77b('0xe')](0x194);}return _0x5c90c3;};}function handleError(_0x413613,_0x3cf3fe){_0x3cf3fe=_0x3cf3fe||0x1f4;return function(_0x51cab9){logger[_0xc77b('0x1f')](_0x51cab9['stack']);if(_0x51cab9[_0xc77b('0x20')]){delete _0x51cab9[_0xc77b('0x20')];}_0x413613[_0xc77b('0x15')](_0x3cf3fe)[_0xc77b('0x21')](_0x51cab9);};}exports[_0xc77b('0x22')]=function(_0x25527d,_0x556013){var _0xc88097={},_0x26b3cd={},_0xed13de={'count':0x0,'rows':[]};var _0xfe5134=_[_0xc77b('0x23')](db['Pause']['rawAttributes'],function(_0x28bbdc){return{'name':_0x28bbdc[_0xc77b('0x24')],'type':_0x28bbdc[_0xc77b('0x25')][_0xc77b('0x26')]};});_0x26b3cd[_0xc77b('0x27')]=_[_0xc77b('0x23')](_0xfe5134,_0xc77b('0x20'));_0x26b3cd[_0xc77b('0x28')]=_[_0xc77b('0x29')](_0x25527d[_0xc77b('0x28')]);_0x26b3cd[_0xc77b('0x2a')]=_[_0xc77b('0x2b')](_0x26b3cd[_0xc77b('0x27')],_0x26b3cd[_0xc77b('0x28')]);_0xc88097[_0xc77b('0x2c')]=_[_0xc77b('0x2b')](_0x26b3cd[_0xc77b('0x27')],qs['fields'](_0x25527d[_0xc77b('0x28')][_0xc77b('0x2d')]));_0xc88097[_0xc77b('0x2c')]=_0xc88097[_0xc77b('0x2c')][_0xc77b('0x2e')]?_0xc88097['attributes']:_0x26b3cd[_0xc77b('0x27')];if(!_0x25527d['query'][_0xc77b('0x2f')](_0xc77b('0x30'))){_0xc88097[_0xc77b('0x14')]=qs['limit'](_0x25527d[_0xc77b('0x28')]['limit']);_0xc88097[_0xc77b('0x11')]=qs[_0xc77b('0x11')](_0x25527d[_0xc77b('0x28')][_0xc77b('0x11')]);}_0xc88097['order']=qs[_0xc77b('0x31')](_0x25527d[_0xc77b('0x28')][_0xc77b('0x31')]);_0xc88097[_0xc77b('0x32')]=qs[_0xc77b('0x2a')](_[_0xc77b('0x33')](_0x25527d[_0xc77b('0x28')],_0x26b3cd['filters']),_0xfe5134);if(_0x25527d[_0xc77b('0x28')][_0xc77b('0x34')]){_0xc88097[_0xc77b('0x32')]=_[_0xc77b('0x35')](_0xc88097['where'],{'$or':_['map'](_0xfe5134,function(_0x490862){if(_0x490862[_0xc77b('0x25')]!=='VIRTUAL'){var _0x4bd2ca={};_0x4bd2ca[_0x490862[_0xc77b('0x20')]]={'$like':'%'+_0x25527d['query'][_0xc77b('0x34')]+'%'};return _0x4bd2ca;}})});}_0xc88097=_['merge']({},_0xc88097,_0x25527d['options']);var _0x567c3b={'where':_0xc88097['where']};return db[_0xc77b('0x36')][_0xc77b('0x13')](_0x567c3b)[_0xc77b('0x1a')](function(_0x49794a){_0xed13de[_0xc77b('0x13')]=_0x49794a;if(_0x25527d[_0xc77b('0x28')][_0xc77b('0x37')]){_0xc88097[_0xc77b('0x38')]=[{'all':!![]}];}return db['Pause'][_0xc77b('0x39')](_0xc88097);})['then'](function(_0x1201d9){_0xed13de[_0xc77b('0x3a')]=_0x1201d9;return _0xed13de;})[_0xc77b('0x1a')](respondWithFilteredResult(_0x556013,_0xc88097))[_0xc77b('0x3b')](handleError(_0x556013,null));};exports[_0xc77b('0x3c')]=function(_0x55db9a,_0x8b7418){var _0x3cc890={'raw':!![],'where':{'id':_0x55db9a[_0xc77b('0x3d')]['id']}},_0x1eb677={};_0x1eb677[_0xc77b('0x27')]=_[_0xc77b('0x29')](db[_0xc77b('0x36')][_0xc77b('0x3e')]);_0x1eb677[_0xc77b('0x28')]=_['keys'](_0x55db9a[_0xc77b('0x28')]);_0x1eb677[_0xc77b('0x2a')]=_[_0xc77b('0x2b')](_0x1eb677['model'],_0x1eb677['query']);_0x3cc890[_0xc77b('0x2c')]=_[_0xc77b('0x2b')](_0x1eb677[_0xc77b('0x27')],qs['fields'](_0x55db9a[_0xc77b('0x28')][_0xc77b('0x2d')]));_0x3cc890[_0xc77b('0x2c')]=_0x3cc890['attributes']['length']?_0x3cc890[_0xc77b('0x2c')]:_0x1eb677['model'];if(_0x55db9a[_0xc77b('0x28')]['includeAll']){_0x3cc890[_0xc77b('0x38')]=[{'all':!![]}];}_0x3cc890=_['merge']({},_0x3cc890,_0x55db9a[_0xc77b('0x3f')]);return db[_0xc77b('0x36')][_0xc77b('0x40')](_0x3cc890)[_0xc77b('0x1a')](handleEntityNotFound(_0x8b7418,null))[_0xc77b('0x1a')](respondWithResult(_0x8b7418,null))['catch'](handleError(_0x8b7418,null));};exports[_0xc77b('0x41')]=function(_0x12a40a,_0x13d3cd){return db[_0xc77b('0x36')][_0xc77b('0x41')](_0x12a40a[_0xc77b('0x42')],{})[_0xc77b('0x1a')](function(_0x41620b){var _0x4d52ab=_0x12a40a['user'][_0xc77b('0x1c')]({'plain':!![]});if(!_0x4d52ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d52ab['role']===_0xc77b('0x43')){var _0x45c633=_0x41620b['get']({'plain':!![]});var _0x1d018b=_0xc77b('0x1d');return db[_0xc77b('0x44')]['find']({'where':{'name':_0x1d018b,'userProfileId':_0x4d52ab[_0xc77b('0x45')]},'raw':!![]})['then'](function(_0x5d90bd){if(_0x5d90bd&&_0x5d90bd[_0xc77b('0x46')]===0x0){return db[_0xc77b('0x1e')][_0xc77b('0x41')]({'name':_0x45c633[_0xc77b('0x20')],'resourceId':_0x45c633['id'],'type':_0x5d90bd[_0xc77b('0x20')],'sectionId':_0x5d90bd['id']},{})[_0xc77b('0x1a')](function(){return _0x41620b;});}else{return _0x41620b;}})['catch'](function(_0x310179){logger[_0xc77b('0x1f')](_0xc77b('0x47'),_0x310179);throw _0x310179;});}return _0x41620b;})[_0xc77b('0x1a')](respondWithResult(_0x13d3cd,0xc9))['catch'](handleError(_0x13d3cd,null));};exports[_0xc77b('0x19')]=function(_0x444e2a,_0x37c44e){if(_0x444e2a[_0xc77b('0x42')]['id']){delete _0x444e2a[_0xc77b('0x42')]['id'];}return db['Pause'][_0xc77b('0x40')]({'where':{'id':_0x444e2a[_0xc77b('0x3d')]['id']}})[_0xc77b('0x1a')](handleEntityNotFound(_0x37c44e,null))[_0xc77b('0x1a')](saveUpdates(_0x444e2a[_0xc77b('0x42')],null))['then'](respondWithResult(_0x37c44e,null))[_0xc77b('0x3b')](handleError(_0x37c44e,null));};exports[_0xc77b('0x1b')]=function(_0x545635,_0x54a8e6){return db[_0xc77b('0x36')][_0xc77b('0x40')]({'where':{'id':_0x545635[_0xc77b('0x3d')]['id']}})[_0xc77b('0x1a')](handleEntityNotFound(_0x54a8e6,null))['then'](removeEntity(_0x54a8e6,null))[_0xc77b('0x3b')](handleError(_0x54a8e6,null));}; \ No newline at end of file +var _0x0c9a=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','name','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','merge','find','create','user','role','Pauses','UserProfileSection','userProfileId','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','get','error','send','index','Pause','type','key','model','map','query','keys','filters','attributes'];(function(_0xde625e,_0x5d34ae){var _0x45cb9b=function(_0x1bf845){while(--_0x1bf845){_0xde625e['push'](_0xde625e['shift']());}};_0x45cb9b(++_0x5d34ae);}(_0x0c9a,0x16c));var _0xa0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa0c9('0x0'));var zipdir=require(_0xa0c9('0x1'));var jsonpatch=require(_0xa0c9('0x2'));var rp=require(_0xa0c9('0x3'));var moment=require(_0xa0c9('0x4'));var BPromise=require(_0xa0c9('0x5'));var Mustache=require(_0xa0c9('0x6'));var util=require(_0xa0c9('0x7'));var path=require('path');var sox=require(_0xa0c9('0x8'));var csv=require('to-csv');var ejs=require(_0xa0c9('0x9'));var fs=require('fs');var fs_extra=require(_0xa0c9('0xa'));var _=require(_0xa0c9('0xb'));var squel=require(_0xa0c9('0xc'));var crypto=require(_0xa0c9('0xd'));var jsforce=require(_0xa0c9('0xe'));var deskjs=require(_0xa0c9('0xf'));var toCsv=require(_0xa0c9('0x10'));var querystring=require(_0xa0c9('0x11'));var Papa=require(_0xa0c9('0x12'));var Redis=require(_0xa0c9('0x13'));var authService=require(_0xa0c9('0x14'));var qs=require(_0xa0c9('0x15'));var as=require(_0xa0c9('0x16'));var hardwareService=require(_0xa0c9('0x17'));var logger=require('../../config/logger')(_0xa0c9('0x18'));var utils=require(_0xa0c9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xa0c9('0x1a'));var db=require(_0xa0c9('0x1b'))['db'];function respondWithStatusCode(_0x34dae1,_0x144c33){_0x144c33=_0x144c33||0xcc;return function(_0x40ce85){if(_0x40ce85){return _0x34dae1[_0xa0c9('0x1c')](_0x144c33);}return _0x34dae1['status'](_0x144c33)[_0xa0c9('0x1d')]();};}function respondWithResult(_0x301d33,_0x29783a){_0x29783a=_0x29783a||0xc8;return function(_0xf6965d){if(_0xf6965d){return _0x301d33[_0xa0c9('0x1e')](_0x29783a)[_0xa0c9('0x1f')](_0xf6965d);}};}function respondWithFilteredResult(_0x3ad833,_0x33e97a){return function(_0x1f7f8c){if(_0x1f7f8c){var _0x26673e=typeof _0x33e97a[_0xa0c9('0x20')]===_0xa0c9('0x21')&&typeof _0x33e97a['limit']===_0xa0c9('0x21');var _0xc79787=_0x1f7f8c[_0xa0c9('0x22')];var _0x4c5e73=_0x26673e?0x0:_0x33e97a[_0xa0c9('0x20')];var _0x140590=_0x26673e?_0x1f7f8c[_0xa0c9('0x22')]:_0x33e97a['offset']+_0x33e97a[_0xa0c9('0x23')];var _0x188917;if(_0x140590>=_0xc79787){_0x140590=_0xc79787;_0x188917=0xc8;}else{_0x188917=0xce;}_0x3ad833['status'](_0x188917);return _0x3ad833['set'](_0xa0c9('0x24'),_0x4c5e73+'-'+_0x140590+'/'+_0xc79787)[_0xa0c9('0x1f')](_0x1f7f8c);}return null;};}function patchUpdates(_0x3d16ae){return function(_0x462788){try{jsonpatch[_0xa0c9('0x25')](_0x462788,_0x3d16ae,!![]);}catch(_0x5884a5){return BPromise[_0xa0c9('0x26')](_0x5884a5);}return _0x462788[_0xa0c9('0x27')]();};}function saveUpdates(_0x197e1c,_0x40325a){return function(_0xdf46e1){if(_0xdf46e1){return _0xdf46e1[_0xa0c9('0x28')](_0x197e1c)['then'](function(_0x8f9b6d){return _0x8f9b6d;});}return null;};}function removeEntity(_0x3b8884,_0x3958d2){return function(_0x12a667){if(_0x12a667){return _0x12a667[_0xa0c9('0x29')]()[_0xa0c9('0x2a')](function(){var _0x4df0d1=_0x12a667[_0xa0c9('0x2b')]({'plain':!![]});var _0x3b9337='Pauses';return db['UserProfileResource'][_0xa0c9('0x29')]({'where':{'type':_0x3b9337,'resourceId':_0x4df0d1['id']}})[_0xa0c9('0x2a')](function(){return _0x12a667;});})['then'](function(){_0x3b8884[_0xa0c9('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb08a0c,_0x51aedb){return function(_0x4902d7){if(!_0x4902d7){_0xb08a0c[_0xa0c9('0x1c')](0x194);}return _0x4902d7;};}function handleError(_0x4c7c79,_0x243ed8){_0x243ed8=_0x243ed8||0x1f4;return function(_0x4cd43b){logger[_0xa0c9('0x2c')](_0x4cd43b['stack']);if(_0x4cd43b['name']){delete _0x4cd43b['name'];}_0x4c7c79['status'](_0x243ed8)[_0xa0c9('0x2d')](_0x4cd43b);};}exports[_0xa0c9('0x2e')]=function(_0x11c572,_0x5e1c6e){var _0x23ba0d={},_0x27324c={},_0x58ae8f={'count':0x0,'rows':[]};var _0x256b13=_['map'](db[_0xa0c9('0x2f')]['rawAttributes'],function(_0xade344){return{'name':_0xade344['fieldName'],'type':_0xade344[_0xa0c9('0x30')][_0xa0c9('0x31')]};});_0x27324c[_0xa0c9('0x32')]=_[_0xa0c9('0x33')](_0x256b13,'name');_0x27324c[_0xa0c9('0x34')]=_[_0xa0c9('0x35')](_0x11c572[_0xa0c9('0x34')]);_0x27324c[_0xa0c9('0x36')]=_['intersection'](_0x27324c[_0xa0c9('0x32')],_0x27324c[_0xa0c9('0x34')]);_0x23ba0d[_0xa0c9('0x37')]=_['intersection'](_0x27324c[_0xa0c9('0x32')],qs[_0xa0c9('0x38')](_0x11c572[_0xa0c9('0x34')][_0xa0c9('0x38')]));_0x23ba0d['attributes']=_0x23ba0d[_0xa0c9('0x37')][_0xa0c9('0x39')]?_0x23ba0d[_0xa0c9('0x37')]:_0x27324c['model'];if(!_0x11c572[_0xa0c9('0x34')][_0xa0c9('0x3a')](_0xa0c9('0x3b'))){_0x23ba0d['limit']=qs[_0xa0c9('0x23')](_0x11c572['query']['limit']);_0x23ba0d['offset']=qs[_0xa0c9('0x20')](_0x11c572[_0xa0c9('0x34')][_0xa0c9('0x20')]);}_0x23ba0d[_0xa0c9('0x3c')]=qs[_0xa0c9('0x3d')](_0x11c572['query'][_0xa0c9('0x3d')]);_0x23ba0d[_0xa0c9('0x3e')]=qs[_0xa0c9('0x36')](_[_0xa0c9('0x3f')](_0x11c572[_0xa0c9('0x34')],_0x27324c['filters']),_0x256b13);if(_0x11c572[_0xa0c9('0x34')][_0xa0c9('0x40')]){_0x23ba0d[_0xa0c9('0x3e')]=_['merge'](_0x23ba0d[_0xa0c9('0x3e')],{'$or':_[_0xa0c9('0x33')](_0x256b13,function(_0x4ee723){if(_0x4ee723[_0xa0c9('0x30')]!=='VIRTUAL'){var _0x2d3cc5={};_0x2d3cc5[_0x4ee723[_0xa0c9('0x41')]]={'$like':'%'+_0x11c572[_0xa0c9('0x34')][_0xa0c9('0x40')]+'%'};return _0x2d3cc5;}})});}_0x23ba0d=_['merge']({},_0x23ba0d,_0x11c572['options']);var _0x517c55={'where':_0x23ba0d['where']};return db['Pause'][_0xa0c9('0x22')](_0x517c55)['then'](function(_0x4f56d2){_0x58ae8f[_0xa0c9('0x22')]=_0x4f56d2;if(_0x11c572[_0xa0c9('0x34')][_0xa0c9('0x42')]){_0x23ba0d[_0xa0c9('0x43')]=[{'all':!![]}];}return db[_0xa0c9('0x2f')][_0xa0c9('0x44')](_0x23ba0d);})[_0xa0c9('0x2a')](function(_0x57d6b3){_0x58ae8f[_0xa0c9('0x45')]=_0x57d6b3;return _0x58ae8f;})[_0xa0c9('0x2a')](respondWithFilteredResult(_0x5e1c6e,_0x23ba0d))[_0xa0c9('0x46')](handleError(_0x5e1c6e,null));};exports[_0xa0c9('0x47')]=function(_0x59a836,_0x390cae){var _0x26fcc3={'raw':!![],'where':{'id':_0x59a836[_0xa0c9('0x48')]['id']}},_0x22589c={};_0x22589c['model']=_[_0xa0c9('0x35')](db['Pause'][_0xa0c9('0x49')]);_0x22589c[_0xa0c9('0x34')]=_[_0xa0c9('0x35')](_0x59a836[_0xa0c9('0x34')]);_0x22589c['filters']=_[_0xa0c9('0x4a')](_0x22589c[_0xa0c9('0x32')],_0x22589c[_0xa0c9('0x34')]);_0x26fcc3[_0xa0c9('0x37')]=_[_0xa0c9('0x4a')](_0x22589c[_0xa0c9('0x32')],qs[_0xa0c9('0x38')](_0x59a836[_0xa0c9('0x34')][_0xa0c9('0x38')]));_0x26fcc3[_0xa0c9('0x37')]=_0x26fcc3[_0xa0c9('0x37')]['length']?_0x26fcc3['attributes']:_0x22589c[_0xa0c9('0x32')];if(_0x59a836[_0xa0c9('0x34')]['includeAll']){_0x26fcc3[_0xa0c9('0x43')]=[{'all':!![]}];}_0x26fcc3=_[_0xa0c9('0x4b')]({},_0x26fcc3,_0x59a836['options']);return db[_0xa0c9('0x2f')][_0xa0c9('0x4c')](_0x26fcc3)['then'](handleEntityNotFound(_0x390cae,null))[_0xa0c9('0x2a')](respondWithResult(_0x390cae,null))[_0xa0c9('0x46')](handleError(_0x390cae,null));};exports['create']=function(_0x5632b9,_0x1d33fb){return db[_0xa0c9('0x2f')][_0xa0c9('0x4d')](_0x5632b9['body'],{})[_0xa0c9('0x2a')](function(_0x25021e){var _0x4a1db9=_0x5632b9[_0xa0c9('0x4e')][_0xa0c9('0x2b')]({'plain':!![]});if(!_0x4a1db9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a1db9[_0xa0c9('0x4f')]===_0xa0c9('0x4e')){var _0x2226ad=_0x25021e[_0xa0c9('0x2b')]({'plain':!![]});var _0x1c81a7=_0xa0c9('0x50');return db[_0xa0c9('0x51')]['find']({'where':{'name':_0x1c81a7,'userProfileId':_0x4a1db9[_0xa0c9('0x52')]},'raw':!![]})[_0xa0c9('0x2a')](function(_0x54e150){if(_0x54e150&&_0x54e150['autoAssociation']===0x0){return db['UserProfileResource'][_0xa0c9('0x4d')]({'name':_0x2226ad[_0xa0c9('0x41')],'resourceId':_0x2226ad['id'],'type':_0x54e150[_0xa0c9('0x41')],'sectionId':_0x54e150['id']},{})[_0xa0c9('0x2a')](function(){return _0x25021e;});}else{return _0x25021e;}})['catch'](function(_0xc34e09){logger[_0xa0c9('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc34e09);throw _0xc34e09;});}return _0x25021e;})[_0xa0c9('0x2a')](respondWithResult(_0x1d33fb,0xc9))[_0xa0c9('0x46')](handleError(_0x1d33fb,null));};exports[_0xa0c9('0x28')]=function(_0xaa8ba9,_0x279242){if(_0xaa8ba9[_0xa0c9('0x53')]['id']){delete _0xaa8ba9[_0xa0c9('0x53')]['id'];}return db[_0xa0c9('0x2f')][_0xa0c9('0x4c')]({'where':{'id':_0xaa8ba9[_0xa0c9('0x48')]['id']}})[_0xa0c9('0x2a')](handleEntityNotFound(_0x279242,null))[_0xa0c9('0x2a')](saveUpdates(_0xaa8ba9[_0xa0c9('0x53')],null))[_0xa0c9('0x2a')](respondWithResult(_0x279242,null))[_0xa0c9('0x46')](handleError(_0x279242,null));};exports[_0xa0c9('0x29')]=function(_0x54ca07,_0x575ed0){return db[_0xa0c9('0x2f')][_0xa0c9('0x4c')]({'where':{'id':_0x54ca07[_0xa0c9('0x48')]['id']}})[_0xa0c9('0x2a')](handleEntityNotFound(_0x575ed0,null))[_0xa0c9('0x2a')](removeEntity(_0x575ed0,null))[_0xa0c9('0x46')](handleError(_0x575ed0,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 1bed0b4..aa8d064 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(_0x1a66db,_0x19af51){var _0x480008=function(_0x4c171f){while(--_0x4c171f){_0x1a66db['push'](_0x1a66db['shift']());}};_0x480008(++_0x19af51);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5eb8d1,_0x63d88d){_0x5eb8d1=_0x5eb8d1-0x0;var _0x2f1158=_0x1cb9[_0x5eb8d1];return _0x2f1158;};'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 _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index bd03a8d..b166af2 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(_0x366d7b,_0x31a24d){var _0x14141c=function(_0x15e032){while(--_0x15e032){_0x366d7b['push'](_0x366d7b['shift']());}};_0x14141c(++_0x31a24d);}(_0xb10b,0x12a));var _0xbb10=function(_0x6dce05,_0x539eb6){_0x6dce05=_0x6dce05-0x0;var _0x7f486=_0xb10b[_0x6dce05];return _0x7f486;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x1579d4,_0x50df08){var _0x189bc7=function(_0x9df317){while(--_0x9df317){_0x1579d4['push'](_0x1579d4['shift']());}};_0x189bc7(++_0x50df08);}(_0x7a54,0x106));var _0x47a5=function(_0x341661,_0x146b3b){_0x341661=_0x341661-0x0;var _0x35f88a=_0x7a54[_0x341661];return _0x35f88a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d355d84..206d281 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 _0xc978=['isAuthenticated','index','/webhook','webhookGet','/:id','show','download','diskStorage','join','root','server/files/plugins','originalname','replace','%s-%s%s','now','extname','post','single','file','upload','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get'];(function(_0x5d5e94,_0x1cb2d4){var _0x3a2e71=function(_0x38085c){while(--_0x38085c){_0x5d5e94['push'](_0x5d5e94['shift']());}};_0x3a2e71(++_0x1cb2d4);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var path=require(_0x8c97('0x2'));var timeout=require(_0x8c97('0x3'));var express=require(_0x8c97('0x4'));var router=express[_0x8c97('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8c97('0x6'));var interaction=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var controller=require(_0x8c97('0x9'));router[_0x8c97('0xa')]('/',auth[_0x8c97('0xb')](),controller[_0x8c97('0xc')]);router['get'](_0x8c97('0xd'),controller[_0x8c97('0xe')]);router[_0x8c97('0xa')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x10')]);router[_0x8c97('0xa')]('/:id/download',auth[_0x8c97('0xb')](),controller[_0x8c97('0x11')]);var upload=multer({'storage':multer[_0x8c97('0x12')]({'destination':function(_0x3a34b2,_0x400eb6,_0x949a83){_0x949a83(null,path[_0x8c97('0x13')](config[_0x8c97('0x14')],_0x8c97('0x15')));},'filename':function(_0x5cf392,_0x44611a,_0x346274){_0x44611a['originalname']=_0x44611a[_0x8c97('0x16')][_0x8c97('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x346274(null,util['format'](_0x8c97('0x18'),path['basename'](_0x44611a['originalname'],path['extname'](_0x44611a[_0x8c97('0x16')])),Date[_0x8c97('0x19')](),path[_0x8c97('0x1a')](_0x44611a[_0x8c97('0x16')])));}})});router[_0x8c97('0x1b')]('/',upload[_0x8c97('0x1c')](_0x8c97('0x1d')),controller[_0x8c97('0x1e')]);router[_0x8c97('0x1b')]('/webhook',controller[_0x8c97('0x1f')]);router[_0x8c97('0x20')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x21')]);router[_0x8c97('0x22')](_0x8c97('0xf'),auth[_0x8c97('0xb')](),controller[_0x8c97('0x22')]);module[_0x8c97('0x23')]=router; \ No newline at end of file +var _0xa41a=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','webhookGet','get','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','extname','now','post','file','upload','/webhook','webhookPost','put','/:id','update','delete','exports','multer'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0xa41a,0x6b));var _0xaa41=function(_0x2620a0,_0x2cf0fd){_0x2620a0=_0x2620a0-0x0;var _0x203f87=_0xa41a[_0x2620a0];return _0x203f87;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var fs_extra=require(_0xaa41('0x5'));var auth=require(_0xaa41('0x6'));var interaction=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var controller=require(_0xaa41('0x9'));router['get']('/',auth[_0xaa41('0xa')](),controller[_0xaa41('0xb')]);router['get']('/webhook',controller[_0xaa41('0xc')]);router[_0xaa41('0xd')]('/:id',auth[_0xaa41('0xa')](),controller[_0xaa41('0xe')]);router[_0xaa41('0xd')](_0xaa41('0xf'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x10')]);var upload=multer({'storage':multer[_0xaa41('0x11')]({'destination':function(_0x423a19,_0x1c291e,_0x5c9fc7){_0x5c9fc7(null,path[_0xaa41('0x12')](config[_0xaa41('0x13')],'server/files/plugins'));},'filename':function(_0x54827c,_0x1d0a54,_0x518b5b){_0x1d0a54[_0xaa41('0x14')]=_0x1d0a54[_0xaa41('0x14')][_0xaa41('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x518b5b(null,util[_0xaa41('0x16')](_0xaa41('0x17'),path['basename'](_0x1d0a54[_0xaa41('0x14')],path[_0xaa41('0x18')](_0x1d0a54[_0xaa41('0x14')])),Date[_0xaa41('0x19')](),path[_0xaa41('0x18')](_0x1d0a54[_0xaa41('0x14')])));}})});router[_0xaa41('0x1a')]('/',upload['single'](_0xaa41('0x1b')),controller[_0xaa41('0x1c')]);router[_0xaa41('0x1a')](_0xaa41('0x1d'),controller[_0xaa41('0x1e')]);router[_0xaa41('0x1f')](_0xaa41('0x20'),auth[_0xaa41('0xa')](),controller[_0xaa41('0x21')]);router['delete']('/:id',auth[_0xaa41('0xa')](),controller[_0xaa41('0x22')]);module[_0xaa41('0x23')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 2f85aea..be50947 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 _0xd148=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','script'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd148,0x15c));var _0x8d14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd148[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x8d14('0x0')]={'name':{'type':Sequelize[_0x8d14('0x1')]},'type':{'type':Sequelize[_0x8d14('0x2')]('html',_0x8d14('0x3'))},'description':{'type':Sequelize[_0x8d14('0x4')]},'version':{'type':Sequelize[_0x8d14('0x4')]},'path':{'type':Sequelize[_0x8d14('0x1')],'comment':_0x8d14('0x5')},'active':{'type':Sequelize[_0x8d14('0x6')],'defaultValue':0x0,'comment':_0x8d14('0x7')},'sidebar':{'type':Sequelize[_0x8d14('0x2')](_0x8d14('0x8'),_0x8d14('0x9'),'always','never'),'defaultValue':'always','comment':_0x8d14('0xa')},'icon':{'type':Sequelize[_0x8d14('0x1')]},'adminUrl':{'type':Sequelize[_0x8d14('0x1')]},'agentUrl':{'type':Sequelize[_0x8d14('0x1')]},'scriptName':{'type':Sequelize[_0x8d14('0x1')]},'scriptPath':{'type':Sequelize[_0x8d14('0x1')]}}; \ No newline at end of file +var _0x66f8=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly'];(function(_0x57e467,_0x155fb3){var _0x3edd9d=function(_0x1153e7){while(--_0x1153e7){_0x57e467['push'](_0x57e467['shift']());}};_0x3edd9d(++_0x155fb3);}(_0x66f8,0x178));var _0x866f=function(_0x2e4493,_0x3971c4){_0x2e4493=_0x2e4493-0x0;var _0x55d50b=_0x66f8[_0x2e4493];return _0x55d50b;};'use strict';var Sequelize=require(_0x866f('0x0'));module['exports']={'name':{'type':Sequelize[_0x866f('0x1')]},'type':{'type':Sequelize[_0x866f('0x2')]('html',_0x866f('0x3'))},'description':{'type':Sequelize[_0x866f('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x866f('0x1')],'comment':_0x866f('0x5')},'active':{'type':Sequelize[_0x866f('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x866f('0x2')](_0x866f('0x7'),_0x866f('0x8'),_0x866f('0x9'),_0x866f('0xa')),'defaultValue':_0x866f('0x9'),'comment':_0x866f('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x866f('0x1')]},'agentUrl':{'type':Sequelize[_0x866f('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x866f('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index ff41b59..93cada1 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 _0xad34=['offset','undefined','count','set','Content-Range','apply','save','update','then','get','Plugins','UserProfileResource','name','send','index','map','Plugin','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','keys','options','find','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','admin','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','catch','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','destroy','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','headers','content-length','content-type','statusCode','webhookPost','resolve','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','json'];(function(_0x22f5e8,_0x531bff){var _0x3fa9c9=function(_0x4caf5e){while(--_0x4caf5e){_0x22f5e8['push'](_0x22f5e8['shift']());}};_0x3fa9c9(++_0x531bff);}(_0xad34,0x1db));var _0x4ad3=function(_0x5b5789,_0x29a557){_0x5b5789=_0x5b5789-0x0;var _0x548803=_0xad34[_0x5b5789];return _0x548803;};'use strict';var emlformat=require(_0x4ad3('0x0'));var rimraf=require(_0x4ad3('0x1'));var zipdir=require(_0x4ad3('0x2'));var jsonpatch=require(_0x4ad3('0x3'));var rp=require(_0x4ad3('0x4'));var moment=require(_0x4ad3('0x5'));var BPromise=require(_0x4ad3('0x6'));var Mustache=require('mustache');var util=require(_0x4ad3('0x7'));var path=require(_0x4ad3('0x8'));var sox=require(_0x4ad3('0x9'));var csv=require('to-csv');var ejs=require(_0x4ad3('0xa'));var fs=require('fs');var fs_extra=require(_0x4ad3('0xb'));var _=require(_0x4ad3('0xc'));var squel=require(_0x4ad3('0xd'));var crypto=require(_0x4ad3('0xe'));var jsforce=require(_0x4ad3('0xf'));var deskjs=require(_0x4ad3('0x10'));var toCsv=require(_0x4ad3('0x11'));var querystring=require(_0x4ad3('0x12'));var Papa=require(_0x4ad3('0x13'));var extract=require(_0x4ad3('0x14'));var rimraf=require(_0x4ad3('0x1'));var archiver=require('archiver');var Redis=require(_0x4ad3('0x15'));var authService=require(_0x4ad3('0x16'));var qs=require(_0x4ad3('0x17'));var as=require(_0x4ad3('0x18'));var hardwareService=require(_0x4ad3('0x19'));var logger=require(_0x4ad3('0x1a'))(_0x4ad3('0x1b'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4ad3('0x1c'));var db=require(_0x4ad3('0x1d'))['db'];config[_0x4ad3('0x1e')]=_[_0x4ad3('0x1f')](config[_0x4ad3('0x1e')],{'host':_0x4ad3('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4ad3('0x1e')]));require('./plugin.socket')[_0x4ad3('0x21')](socket);function respondWithStatusCode(_0x21946f,_0x31e051){_0x31e051=_0x31e051||0xcc;return function(_0x57e03d){if(_0x57e03d){return _0x21946f[_0x4ad3('0x22')](_0x31e051);}return _0x21946f['status'](_0x31e051)[_0x4ad3('0x23')]();};}function respondWithResult(_0x2238ce,_0x3538bc){_0x3538bc=_0x3538bc||0xc8;return function(_0x207e11){if(_0x207e11){return _0x2238ce[_0x4ad3('0x24')](_0x3538bc)[_0x4ad3('0x25')](_0x207e11);}};}function respondWithFilteredResult(_0x32ebaf,_0x34251c){return function(_0x52d611){if(_0x52d611){var _0x1862dc=typeof _0x34251c[_0x4ad3('0x26')]===_0x4ad3('0x27')&&typeof _0x34251c['limit']===_0x4ad3('0x27');var _0x392b53=_0x52d611[_0x4ad3('0x28')];var _0x5d0f31=_0x1862dc?0x0:_0x34251c['offset'];var _0x534a82=_0x1862dc?_0x52d611['count']:_0x34251c[_0x4ad3('0x26')]+_0x34251c['limit'];var _0x344cb0;if(_0x534a82>=_0x392b53){_0x534a82=_0x392b53;_0x344cb0=0xc8;}else{_0x344cb0=0xce;}_0x32ebaf[_0x4ad3('0x24')](_0x344cb0);return _0x32ebaf[_0x4ad3('0x29')](_0x4ad3('0x2a'),_0x5d0f31+'-'+_0x534a82+'/'+_0x392b53)[_0x4ad3('0x25')](_0x52d611);}return null;};}function patchUpdates(_0x32da8f){return function(_0x524d5e){try{jsonpatch[_0x4ad3('0x2b')](_0x524d5e,_0x32da8f,!![]);}catch(_0x2a6e00){return BPromise['reject'](_0x2a6e00);}return _0x524d5e[_0x4ad3('0x2c')]();};}function saveUpdates(_0x32e79a,_0x45ff56){return function(_0x2544bd){if(_0x2544bd){return _0x2544bd[_0x4ad3('0x2d')](_0x32e79a)[_0x4ad3('0x2e')](function(_0x55c260){return _0x55c260;});}return null;};}function removeEntity(_0x8e4b2e,_0x266bf3){return function(_0x4ba57f){if(_0x4ba57f){return _0x4ba57f['destroy']()[_0x4ad3('0x2e')](function(){var _0x3602ec=_0x4ba57f[_0x4ad3('0x2f')]({'plain':!![]});var _0x5a5a97=_0x4ad3('0x30');return db[_0x4ad3('0x31')]['destroy']({'where':{'type':_0x5a5a97,'resourceId':_0x3602ec['id']}})[_0x4ad3('0x2e')](function(){return _0x4ba57f;});})['then'](function(){_0x8e4b2e[_0x4ad3('0x24')](0xcc)[_0x4ad3('0x23')]();});}};}function handleEntityNotFound(_0x3ba735,_0x4fb4f5){return function(_0xedb400){if(!_0xedb400){_0x3ba735[_0x4ad3('0x22')](0x194);}return _0xedb400;};}function handleError(_0x144c41,_0x2f9411){_0x2f9411=_0x2f9411||0x1f4;return function(_0xc679f2){logger['error'](_0xc679f2['stack']);if(_0xc679f2[_0x4ad3('0x32')]){delete _0xc679f2[_0x4ad3('0x32')];}_0x144c41[_0x4ad3('0x24')](_0x2f9411)[_0x4ad3('0x33')](_0xc679f2);};}exports[_0x4ad3('0x34')]=function(_0x26b68b,_0x22425a){var _0x120a13={},_0x8c79ad={},_0x2f7bdc={'count':0x0,'rows':[]};var _0x1a0f5d=_[_0x4ad3('0x35')](db[_0x4ad3('0x36')][_0x4ad3('0x37')],function(_0x2ae0b2){return{'name':_0x2ae0b2['fieldName'],'type':_0x2ae0b2[_0x4ad3('0x38')][_0x4ad3('0x39')]};});_0x8c79ad[_0x4ad3('0x3a')]=_[_0x4ad3('0x35')](_0x1a0f5d,_0x4ad3('0x32'));_0x8c79ad[_0x4ad3('0x3b')]=_['keys'](_0x26b68b[_0x4ad3('0x3b')]);_0x8c79ad[_0x4ad3('0x3c')]=_[_0x4ad3('0x3d')](_0x8c79ad[_0x4ad3('0x3a')],_0x8c79ad['query']);_0x120a13['attributes']=_[_0x4ad3('0x3d')](_0x8c79ad[_0x4ad3('0x3a')],qs[_0x4ad3('0x3e')](_0x26b68b['query']['fields']));_0x120a13[_0x4ad3('0x3f')]=_0x120a13[_0x4ad3('0x3f')][_0x4ad3('0x40')]?_0x120a13[_0x4ad3('0x3f')]:_0x8c79ad[_0x4ad3('0x3a')];if(!_0x26b68b['query']['hasOwnProperty'](_0x4ad3('0x41'))){_0x120a13[_0x4ad3('0x42')]=qs[_0x4ad3('0x42')](_0x26b68b[_0x4ad3('0x3b')]['limit']);_0x120a13[_0x4ad3('0x26')]=qs[_0x4ad3('0x26')](_0x26b68b[_0x4ad3('0x3b')][_0x4ad3('0x26')]);}_0x120a13['order']=qs[_0x4ad3('0x43')](_0x26b68b[_0x4ad3('0x3b')][_0x4ad3('0x43')]);_0x120a13[_0x4ad3('0x44')]=qs[_0x4ad3('0x3c')](_[_0x4ad3('0x45')](_0x26b68b['query'],_0x8c79ad[_0x4ad3('0x3c')]),_0x1a0f5d);if(_0x26b68b[_0x4ad3('0x3b')][_0x4ad3('0x46')]){_0x120a13['where']=_[_0x4ad3('0x47')](_0x120a13['where'],{'$or':_[_0x4ad3('0x35')](_0x1a0f5d,function(_0x801b7b){if(_0x801b7b['type']!==_0x4ad3('0x48')){var _0x26ed34={};_0x26ed34[_0x801b7b[_0x4ad3('0x32')]]={'$like':'%'+_0x26b68b[_0x4ad3('0x3b')][_0x4ad3('0x46')]+'%'};return _0x26ed34;}})});}_0x120a13=_[_0x4ad3('0x47')]({},_0x120a13,_0x26b68b['options']);var _0x223969={'where':_0x120a13[_0x4ad3('0x44')]};return db[_0x4ad3('0x36')][_0x4ad3('0x28')](_0x223969)[_0x4ad3('0x2e')](function(_0x2bab2c){_0x2f7bdc[_0x4ad3('0x28')]=_0x2bab2c;if(_0x26b68b[_0x4ad3('0x3b')]['includeAll']){_0x120a13[_0x4ad3('0x49')]=[{'all':!![]}];}return db['Plugin'][_0x4ad3('0x4a')](_0x120a13);})[_0x4ad3('0x2e')](function(_0x1034be){_0x2f7bdc[_0x4ad3('0x4b')]=_0x1034be;return _0x2f7bdc;})['then'](respondWithFilteredResult(_0x22425a,_0x120a13))['catch'](handleError(_0x22425a,null));};exports[_0x4ad3('0x4c')]=function(_0x1e2a8d,_0x2aed54){var _0x9bad7e={'raw':!![],'where':{'id':_0x1e2a8d[_0x4ad3('0x4d')]['id']}},_0x579322={};_0x579322['model']=_['keys'](db[_0x4ad3('0x36')][_0x4ad3('0x37')]);_0x579322[_0x4ad3('0x3b')]=_[_0x4ad3('0x4e')](_0x1e2a8d[_0x4ad3('0x3b')]);_0x579322['filters']=_['intersection'](_0x579322['model'],_0x579322[_0x4ad3('0x3b')]);_0x9bad7e['attributes']=_[_0x4ad3('0x3d')](_0x579322[_0x4ad3('0x3a')],qs['fields'](_0x1e2a8d[_0x4ad3('0x3b')]['fields']));_0x9bad7e[_0x4ad3('0x3f')]=_0x9bad7e[_0x4ad3('0x3f')]['length']?_0x9bad7e[_0x4ad3('0x3f')]:_0x579322[_0x4ad3('0x3a')];if(_0x1e2a8d['query']['includeAll']){_0x9bad7e[_0x4ad3('0x49')]=[{'all':!![]}];}_0x9bad7e=_[_0x4ad3('0x47')]({},_0x9bad7e,_0x1e2a8d[_0x4ad3('0x4f')]);return db[_0x4ad3('0x36')][_0x4ad3('0x50')](_0x9bad7e)['then'](handleEntityNotFound(_0x2aed54,null))[_0x4ad3('0x2e')](respondWithResult(_0x2aed54,null))['catch'](handleError(_0x2aed54,null));};exports[_0x4ad3('0x51')]=function(_0x2e13d2,_0x18c8b0,_0x93f0ab){return db[_0x4ad3('0x36')][_0x4ad3('0x50')]({'where':{'id':_0x2e13d2[_0x4ad3('0x4d')]['id']},'attributes':[_0x4ad3('0x32'),'path'],'raw':!![]})[_0x4ad3('0x2e')](handleEntityNotFound(_0x18c8b0,null))[_0x4ad3('0x2e')](function(_0x727433){if(_0x727433){var _0x460dc6=path[_0x4ad3('0x52')](config[_0x4ad3('0x53')],_0x4ad3('0x54'),util[_0x4ad3('0x55')](_0x4ad3('0x56'),path[_0x4ad3('0x57')](_0x727433['path'])));var _0x59df11=fs[_0x4ad3('0x58')](_0x460dc6);var _0x46927d=archiver(_0x4ad3('0x59'),{'zlib':{'level':0x9}});_0x46927d['on'](_0x4ad3('0x5a'),function(_0x3d6146){if(_0x3d6146[_0x4ad3('0x5b')]==='ENOENT'){logger[_0x4ad3('0x5c')](_0x3d6146);}else{throw new db[(_0x4ad3('0x5d'))][(_0x4ad3('0x5e'))](_0x4ad3('0x5f'));}});_0x46927d['on'](_0x4ad3('0x5c'),function(_0x1c5e9c){throw new db[(_0x4ad3('0x5d'))]['Error'](_0x4ad3('0x5f'));});_0x46927d[_0x4ad3('0x60')](_0x59df11);_0x46927d[_0x4ad3('0x61')]('**/*',{'cwd':path[_0x4ad3('0x52')](config['root'],'server/files/plugins',path[_0x4ad3('0x62')](_0x727433[_0x4ad3('0x8')])),'ignore':[path[_0x4ad3('0x52')](path[_0x4ad3('0x57')](_0x727433[_0x4ad3('0x8')]),_0x4ad3('0x63')),path[_0x4ad3('0x52')](path[_0x4ad3('0x57')](_0x727433['path']),_0x4ad3('0x64'))],'nodir':!![]})[_0x4ad3('0x65')]();_0x59df11['on'](_0x4ad3('0x66'),function(){if(!fs[_0x4ad3('0x67')](_0x460dc6)){throw new db['Sequelize']['Error']('Plugin\x20not\x20found');}return _0x18c8b0[_0x4ad3('0x51')](_0x460dc6,util[_0x4ad3('0x55')](_0x4ad3('0x56'),path[_0x4ad3('0x57')](_0x727433[_0x4ad3('0x8')])),function(_0x348fcf){if(_0x348fcf){throw new db['Sequelize'][(_0x4ad3('0x5e'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x4ad3('0x68')](_0x460dc6);logger[_0x4ad3('0x69')](_0x4ad3('0x6a'));logger[_0x4ad3('0x69')](_0x4ad3('0x6b'));});});}return null;})['catch'](handleError(_0x18c8b0,null));};exports[_0x4ad3('0x6c')]=function(_0x1db04b,_0x400dc8,_0x39bc73){var _0x3ed846=path[_0x4ad3('0x57')](_0x1db04b[_0x4ad3('0x6d')]['filename'],path[_0x4ad3('0x6e')](_0x1db04b[_0x4ad3('0x6d')]['filename']));var _0x2cf0e7=path[_0x4ad3('0x52')](config[_0x4ad3('0x53')],'server/files/plugins',_0x1db04b[_0x4ad3('0x6d')]['filename']);var _0x439096=path['join'](config[_0x4ad3('0x53')],_0x4ad3('0x54'),_0x3ed846);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x2cf0e7);logger[_0x4ad3('0x69')](_0x4ad3('0x6f'),_0x439096);try{fs[_0x4ad3('0x70')](_0x2cf0e7,parseInt(_0x4ad3('0x71'),0x8));extract(_0x2cf0e7,{'dir':_0x439096},function(_0x4e447e){if(_0x4e447e){logger[_0x4ad3('0x5c')](_0x4e447e);handleError(_0x4e447e,!![]);};var _0x1160db=fs[_0x4ad3('0x72')](_0x439096);if(_0x1160db[_0x4ad3('0x40')]>0x1){removeReferences(_0x2cf0e7,_0x439096);logger[_0x4ad3('0x5c')](_0x4ad3('0x73'));return _0x39bc73(new Error(_0x4ad3('0x73')));}var _0x11d0d1=fs[_0x4ad3('0x74')](path[_0x4ad3('0x52')](_0x439096,_0x1160db[0x0]));if(_0x11d0d1[_0x4ad3('0x75')]()){removeReferences(_0x2cf0e7,_0x439096);logger[_0x4ad3('0x5c')](_0x4ad3('0x73'));return _0x39bc73(new Error(_0x4ad3('0x73')));}if(_0x11d0d1[_0x4ad3('0x76')]()){var _0x44681f=fs['readdirSync'](path['join'](_0x439096,_0x1160db[0x0]));if(_0x44681f[_0x4ad3('0x40')]===0x0){removeReferences(_0x2cf0e7,_0x439096);logger[_0x4ad3('0x5c')](_0x4ad3('0x73'));return _0x39bc73(new Error('Invalid\x20plugin\x20structure'));}var _0x4a1bb0=_0x44681f[_0x4ad3('0x77')](function(_0x5a7d13){return _0x5a7d13==='manifest.json';});if(!_0x4a1bb0){return _0x39bc73(new Error(_0x4ad3('0x78')));}var _0x25d02c=fs[_0x4ad3('0x79')](path[_0x4ad3('0x52')](_0x439096,_0x1160db[0x0],_0x4ad3('0x7a')));var _0x187fce=JSON[_0x4ad3('0x7b')](_0x25d02c);if(_0x4ad3('0x27')==typeof _0x187fce['name']){return _0x39bc73(new Error(_0x4ad3('0x7c')));}if(_0x4ad3('0x27')==typeof _0x187fce['type']){return _0x39bc73(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x4ad3('0x27')==typeof _0x187fce[_0x4ad3('0x7d')]){return _0x39bc73(new Error(_0x4ad3('0x7e')));}if('undefined'==typeof _0x187fce[_0x4ad3('0x7f')]){return _0x39bc73(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x187fce[_0x4ad3('0x38')]===_0x4ad3('0x80')){if(_0x4ad3('0x27')==typeof _0x187fce[_0x4ad3('0x7f')]['views']){return _0x39bc73(new Error(_0x4ad3('0x81')));}if(_0x4ad3('0x27')==typeof _0x187fce[_0x4ad3('0x7f')][_0x4ad3('0x82')]['admin']&&_0x4ad3('0x27')==typeof _0x187fce[_0x4ad3('0x7f')][_0x4ad3('0x82')][_0x4ad3('0x83')]){return _0x39bc73(new Error(_0x4ad3('0x84')));}}else if(_0x187fce[_0x4ad3('0x38')]===_0x4ad3('0x85')){if('undefined'==typeof _0x187fce[_0x4ad3('0x7f')][_0x4ad3('0x86')]){return _0x39bc73(new Error(_0x4ad3('0x87')));}if(_0x4ad3('0x27')==typeof _0x187fce[_0x4ad3('0x7f')][_0x4ad3('0x88')]){return _0x39bc73(new Error(_0x4ad3('0x89')));}}else{return _0x39bc73(new Error(_0x4ad3('0x8a')));}var _0x534f56=_0x187fce[_0x4ad3('0x32')];var _0x53a5a2=_0x187fce[_0x4ad3('0x8b')];var _0x14ff0d=_0x187fce[_0x4ad3('0x38')];var _0x54bd4f=_0x187fce[_0x4ad3('0x8c')]?_0x187fce[_0x4ad3('0x8c')]:'always';var _0x141cd5=_0x187fce[_0x4ad3('0x8d')]?_0x187fce[_0x4ad3('0x8d')]:_0x4ad3('0x8e');var _0x64829f='';var _0x47de97='';var _0xb711b='';var _0x1c30c7='';var _0x2fcb19=_0x187fce[_0x4ad3('0x7d')];if(_0x14ff0d===_0x4ad3('0x80')){if(_0x4ad3('0x27')!=typeof _0x187fce[_0x4ad3('0x7f')][_0x4ad3('0x82')][_0x4ad3('0x8f')]){var _0x277b6f=_0x187fce[_0x4ad3('0x7f')][_0x4ad3('0x82')][_0x4ad3('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x4ad3('0x90')](_0x277b6f)){_0x64829f=path[_0x4ad3('0x52')](_0x4ad3('0x91'),_0x3ed846,_0x1160db[0x0],_0x277b6f);}else{_0x64829f=_0x277b6f;}}else{logger[_0x4ad3('0x69')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x187fce['parameters'][_0x4ad3('0x82')]['agent']){var _0x3d54d4=_0x187fce['parameters'][_0x4ad3('0x82')][_0x4ad3('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x4ad3('0x90')](_0x3d54d4)){_0x47de97=path[_0x4ad3('0x52')](_0x4ad3('0x91'),_0x3ed846,_0x1160db[0x0],_0x3d54d4);}else{_0x47de97=_0x3d54d4;}}else{logger[_0x4ad3('0x69')](_0x4ad3('0x92'));}}else if(_0x14ff0d===_0x4ad3('0x85')){_0xb711b=_0x187fce[_0x4ad3('0x7f')]['scriptName'];_0x1c30c7=_0x187fce[_0x4ad3('0x7f')]['scriptPath'];if(_0x4ad3('0x27')!=typeof _0x187fce[_0x4ad3('0x7f')]['views']){if('undefined'!=typeof _0x187fce[_0x4ad3('0x7f')][_0x4ad3('0x82')][_0x4ad3('0x8f')]){var _0x277b6f=_0x187fce['parameters'][_0x4ad3('0x82')][_0x4ad3('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x4ad3('0x90')](_0x277b6f)){_0x64829f=path[_0x4ad3('0x52')](_0x4ad3('0x91'),_0x3ed846,_0x1160db[0x0],_0x277b6f);}else{_0x64829f=_0x277b6f;}}if('undefined'!=typeof _0x187fce['parameters']['views'][_0x4ad3('0x83')]){var _0x3d54d4=_0x187fce[_0x4ad3('0x7f')]['views'][_0x4ad3('0x83')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3d54d4)){_0x47de97=path['join'](_0x4ad3('0x91'),_0x3ed846,_0x1160db[0x0],_0x3d54d4);}else{_0x47de97=_0x3d54d4;}}}}var _0x4951bd={'name':_0x534f56,'description':_0x53a5a2,'path':path[_0x4ad3('0x52')](_0x3ed846,_0x1160db[0x0]),'type':_0x14ff0d,'sidebar':_0x54bd4f,'icon':_0x141cd5,'adminUrl':_0x64829f,'agentUrl':_0x47de97,'scriptName':_0xb711b,'scriptPath':_0x1c30c7,'version':_0x2fcb19};removeReferences(_0x2cf0e7,null);return db[_0x4ad3('0x36')]['create'](_0x4951bd)[_0x4ad3('0x2e')](function(_0x5157e3){var _0x465f2f={'role':_0x1db04b['body'][_0x4ad3('0x93')],'userProfileId':_0x1db04b[_0x4ad3('0x94')]['userProfileId']};if(!_0x465f2f)throw new Error(_0x4ad3('0x95'));if(_0x465f2f[_0x4ad3('0x93')]===_0x4ad3('0x96')){var _0x5ab1bd=_0x5157e3[_0x4ad3('0x2f')]({'plain':!![]});return db[_0x4ad3('0x97')][_0x4ad3('0x50')]({'where':{'name':'Plugins','userProfileId':_0x465f2f[_0x4ad3('0x98')]},'raw':!![]})[_0x4ad3('0x2e')](function(_0xdacc89){if(_0xdacc89&&_0xdacc89[_0x4ad3('0x99')]===0x0){return db[_0x4ad3('0x31')]['create']({'name':_0x5ab1bd[_0x4ad3('0x32')],'resourceId':_0x5ab1bd['id'],'type':_0xdacc89[_0x4ad3('0x32')],'sectionId':_0xdacc89['id']},{})[_0x4ad3('0x2e')](function(){return _0x5157e3;});}else{return _0x5157e3;}})[_0x4ad3('0x9a')](function(_0x3a1688){logger[_0x4ad3('0x5c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a1688);throw _0x3a1688;});}return _0x5157e3;})[_0x4ad3('0x2e')](respondWithResult(_0x400dc8,null))[_0x4ad3('0x9a')](handleError(_0x400dc8,null));}});}catch(_0x48c7bb){_0x400dc8[_0x4ad3('0x24')](0x1f4)[_0x4ad3('0x33')](_0x48c7bb);}};function removeReferences(_0x93040b,_0x3fe625){try{if(_0x93040b){fs[_0x4ad3('0x68')](_0x93040b);logger[_0x4ad3('0x69')](_0x4ad3('0x9b'));}if(_0x3fe625){rimraf(_0x3fe625,function(){});logger[_0x4ad3('0x69')](_0x4ad3('0x9c'));}}catch(_0x39a5af){logger[_0x4ad3('0x5c')](_0x39a5af);}}exports[_0x4ad3('0x2d')]=function(_0x1e5e97,_0x45cac1,_0x3b9cac){return db['Plugin'][_0x4ad3('0x50')]({'where':{'id':_0x1e5e97['params']['id']}})[_0x4ad3('0x2e')](handleEntityNotFound(_0x45cac1,null))[_0x4ad3('0x2e')](saveUpdates(_0x1e5e97['body'],null))[_0x4ad3('0x2e')](respondWithResult(_0x45cac1,null))[_0x4ad3('0x9a')](handleError(_0x45cac1,null));};exports['delete']=function(_0x436231,_0x4a7bad,_0x216088){return db[_0x4ad3('0x36')][_0x4ad3('0x50')]({'where':{'id':_0x436231[_0x4ad3('0x4d')]['id']}})[_0x4ad3('0x2e')](function(_0x5c69f5){if(_0x5c69f5){return _0x5c69f5[_0x4ad3('0x9d')]();}})[_0x4ad3('0x2e')](function(_0xdc0ea1){rimraf(path['join'](config[_0x4ad3('0x53')],_0x4ad3('0x54'),path[_0x4ad3('0x62')](_0xdc0ea1[_0x4ad3('0x8')])),function(){});return _0xdc0ea1;})[_0x4ad3('0x2e')](handleEntityNotFound(_0x4a7bad,null))[_0x4ad3('0x2e')](respondWithStatusCode(_0x4a7bad,null))[_0x4ad3('0x9a')](handleError(_0x4a7bad,null));};exports['webhookGet']=function(_0x5bdfcf,_0x561c88,_0x242b93){return BPromise['resolve']()[_0x4ad3('0x2e')](function(){if(!_0x5bdfcf[_0x4ad3('0x3b')][_0x4ad3('0x8')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5bdfcf[_0x4ad3('0x3b')]['port']){throw new Error(_0x4ad3('0x9e'));}var _0x4fbe8b=_0x5bdfcf[_0x4ad3('0x3b')]['hostname']?_0x5bdfcf[_0x4ad3('0x3b')][_0x4ad3('0x9f')]+':'+_0x5bdfcf[_0x4ad3('0x3b')][_0x4ad3('0xa0')]:_0x4ad3('0xa1')+_0x5bdfcf['query']['port'];var _0x1f123e=_0x5bdfcf[_0x4ad3('0x3b')][_0x4ad3('0x25')]?_0x5bdfcf['query'][_0x4ad3('0x25')]:!![];var _0x141261=_0x5bdfcf[_0x4ad3('0x3b')][_0x4ad3('0xa2')]?_0x5bdfcf[_0x4ad3('0x3b')]['encoding']:null;var _0xbfb45e={'method':_0x5bdfcf[_0x4ad3('0xa3')],'uri':util[_0x4ad3('0x55')]('%s%s',_0x4fbe8b,_0x5bdfcf[_0x4ad3('0x3b')][_0x4ad3('0x8')]),'json':_0x1f123e,'resolveWithFullResponse':!![],'encoding':_0x141261,'qs':_0x5bdfcf['query']};if(_0x5bdfcf[_0x4ad3('0xa4')]){_0xbfb45e[_0x4ad3('0xa4')]=_0x5bdfcf[_0x4ad3('0xa4')];if(_0xbfb45e[_0x4ad3('0xa4')][_0x4ad3('0xa5')]){delete _0xbfb45e[_0x4ad3('0xa4')][_0x4ad3('0xa5')];}}if(_0xbfb45e[_0x4ad3('0xa4')][_0x4ad3('0xa6')]){delete _0xbfb45e[_0x4ad3('0xa4')][_0x4ad3('0xa6')];}return rp(_0xbfb45e);})['then'](function(_0x463d7a){if(_0x463d7a){_0x561c88[_0x4ad3('0x29')](_0x463d7a['headers']);logger[_0x4ad3('0x69')](_0x463d7a[_0x4ad3('0x94')]);if(_['endsWith'](_0x5bdfcf[_0x4ad3('0x3b')][_0x4ad3('0x8')],_0x4ad3('0x51'))&&_0x463d7a[_0x4ad3('0xa7')]==0x1f4){return _0x561c88[_0x4ad3('0x22')](_0x463d7a[_0x4ad3('0xa7')]);}else{return _0x561c88[_0x4ad3('0x24')](_0x463d7a['statusCode'])[_0x4ad3('0x33')](_0x463d7a[_0x4ad3('0x94')]);}}else{return _0x561c88[_0x4ad3('0x22')](0xc8);}})[_0x4ad3('0x9a')](handleError(_0x561c88,null));};exports[_0x4ad3('0xa8')]=function(_0x488a0e,_0x11bf50,_0x5f8e1e){return BPromise[_0x4ad3('0xa9')]()[_0x4ad3('0x2e')](function(){if(!_0x488a0e[_0x4ad3('0x3b')][_0x4ad3('0x8')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x488a0e[_0x4ad3('0x3b')]['port']){throw new Error(_0x4ad3('0x9e'));}var _0x40d9a1=_0x488a0e[_0x4ad3('0x3b')][_0x4ad3('0x9f')]?_0x488a0e[_0x4ad3('0x3b')][_0x4ad3('0x9f')]+':'+_0x488a0e[_0x4ad3('0x3b')]['port']:_0x4ad3('0xa1')+_0x488a0e[_0x4ad3('0x3b')][_0x4ad3('0xa0')];var _0x53237b=_0x488a0e[_0x4ad3('0x3b')]['json']?_0x488a0e[_0x4ad3('0x3b')][_0x4ad3('0x25')]:!![];var _0x524f7b=_0x488a0e[_0x4ad3('0x3b')][_0x4ad3('0xa2')]?_0x488a0e[_0x4ad3('0x3b')][_0x4ad3('0xa2')]:null;var _0x174fd1={'method':_0x488a0e[_0x4ad3('0xa3')],'uri':util[_0x4ad3('0x55')](_0x4ad3('0xaa'),_0x40d9a1,_0x488a0e[_0x4ad3('0x3b')][_0x4ad3('0x8')]),'json':_0x53237b,'resolveWithFullResponse':!![],'encoding':_0x524f7b,'body':_0x488a0e[_0x4ad3('0x94')]};if(_0x488a0e[_0x4ad3('0xa4')]){_0x174fd1[_0x4ad3('0xa4')]=_0x488a0e[_0x4ad3('0xa4')];if(_0x174fd1[_0x4ad3('0xa4')][_0x4ad3('0xa5')]){delete _0x174fd1[_0x4ad3('0xa4')][_0x4ad3('0xa5')];}}if(_0x174fd1[_0x4ad3('0xa4')][_0x4ad3('0xa6')]){delete _0x174fd1[_0x4ad3('0xa4')]['content-type'];}return rp(_0x174fd1);})['then'](function(_0x41a1f0){if(_0x41a1f0){_0x11bf50[_0x4ad3('0x29')](_0x41a1f0['headers']);logger[_0x4ad3('0x69')](_0x41a1f0[_0x4ad3('0x94')]);return _0x11bf50[_0x4ad3('0x24')](_0x41a1f0[_0x4ad3('0xa7')])[_0x4ad3('0x33')](_0x41a1f0['body']);}else{return _0x11bf50[_0x4ad3('0x22')](0xc8);}})[_0x4ad3('0x9a')](handleError(_0x11bf50,null));}; \ No newline at end of file +var _0x7759=['options','includeAll','include','findAll','show','params','find','catch','join','server/files/plugins','format','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','dirname','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','download','%s.zip','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','root','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','test','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','body','endsWith','statusCode','webhookPost','method','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./plugin.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','Plugins','UserProfileResource','end','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7759,0x119));var _0x9775=function(_0x3616ac,_0x2d4902){_0x3616ac=_0x3616ac-0x0;var _0xe2f620=_0x7759[_0x3616ac];return _0xe2f620;};'use strict';var emlformat=require(_0x9775('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9775('0x1'));var jsonpatch=require(_0x9775('0x2'));var rp=require(_0x9775('0x3'));var moment=require('moment');var BPromise=require(_0x9775('0x4'));var Mustache=require('mustache');var util=require(_0x9775('0x5'));var path=require(_0x9775('0x6'));var sox=require(_0x9775('0x7'));var csv=require(_0x9775('0x8'));var ejs=require(_0x9775('0x9'));var fs=require('fs');var fs_extra=require(_0x9775('0xa'));var _=require('lodash');var squel=require(_0x9775('0xb'));var crypto=require(_0x9775('0xc'));var jsforce=require(_0x9775('0xd'));var deskjs=require(_0x9775('0xe'));var toCsv=require(_0x9775('0x8'));var querystring=require(_0x9775('0xf'));var Papa=require(_0x9775('0x10'));var extract=require(_0x9775('0x11'));var rimraf=require(_0x9775('0x12'));var archiver=require(_0x9775('0x13'));var Redis=require(_0x9775('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x9775('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9775('0x16'));var logger=require('../../config/logger')(_0x9775('0x17'));var utils=require(_0x9775('0x18'));var config=require(_0x9775('0x19'));var licenseUtil=require(_0x9775('0x1a'));var db=require(_0x9775('0x1b'))['db'];config[_0x9775('0x1c')]=_[_0x9775('0x1d')](config[_0x9775('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9775('0x1c')]));require(_0x9775('0x1e'))[_0x9775('0x1f')](socket);function respondWithStatusCode(_0x40abe8,_0x9cd004){_0x9cd004=_0x9cd004||0xcc;return function(_0x3828ad){if(_0x3828ad){return _0x40abe8[_0x9775('0x20')](_0x9cd004);}return _0x40abe8[_0x9775('0x21')](_0x9cd004)['end']();};}function respondWithResult(_0x362448,_0x445f91){_0x445f91=_0x445f91||0xc8;return function(_0x577434){if(_0x577434){return _0x362448[_0x9775('0x21')](_0x445f91)['json'](_0x577434);}};}function respondWithFilteredResult(_0x3cae2c,_0x197170){return function(_0x2169ea){if(_0x2169ea){var _0x5ee5d0=typeof _0x197170[_0x9775('0x22')]===_0x9775('0x23')&&typeof _0x197170[_0x9775('0x24')]===_0x9775('0x23');var _0x374966=_0x2169ea['count'];var _0x15d097=_0x5ee5d0?0x0:_0x197170[_0x9775('0x22')];var _0x706e68=_0x5ee5d0?_0x2169ea[_0x9775('0x25')]:_0x197170['offset']+_0x197170[_0x9775('0x24')];var _0x38a8be;if(_0x706e68>=_0x374966){_0x706e68=_0x374966;_0x38a8be=0xc8;}else{_0x38a8be=0xce;}_0x3cae2c['status'](_0x38a8be);return _0x3cae2c[_0x9775('0x26')](_0x9775('0x27'),_0x15d097+'-'+_0x706e68+'/'+_0x374966)[_0x9775('0x28')](_0x2169ea);}return null;};}function patchUpdates(_0x359017){return function(_0x44d1d0){try{jsonpatch[_0x9775('0x29')](_0x44d1d0,_0x359017,!![]);}catch(_0x2f53b6){return BPromise[_0x9775('0x2a')](_0x2f53b6);}return _0x44d1d0[_0x9775('0x2b')]();};}function saveUpdates(_0x28991c,_0x303aca){return function(_0x43c03e){if(_0x43c03e){return _0x43c03e[_0x9775('0x2c')](_0x28991c)[_0x9775('0x2d')](function(_0x428d7f){return _0x428d7f;});}return null;};}function removeEntity(_0x115149,_0x468c36){return function(_0x895cce){if(_0x895cce){return _0x895cce[_0x9775('0x2e')]()['then'](function(){var _0x5811a6=_0x895cce['get']({'plain':!![]});var _0x24a8b5=_0x9775('0x2f');return db[_0x9775('0x30')]['destroy']({'where':{'type':_0x24a8b5,'resourceId':_0x5811a6['id']}})[_0x9775('0x2d')](function(){return _0x895cce;});})[_0x9775('0x2d')](function(){_0x115149[_0x9775('0x21')](0xcc)[_0x9775('0x31')]();});}};}function handleEntityNotFound(_0xc1bb9b,_0x56f6e3){return function(_0x2902cf){if(!_0x2902cf){_0xc1bb9b[_0x9775('0x20')](0x194);}return _0x2902cf;};}function handleError(_0x10ab02,_0x4a5990){_0x4a5990=_0x4a5990||0x1f4;return function(_0xfdaa3c){logger[_0x9775('0x32')](_0xfdaa3c[_0x9775('0x33')]);if(_0xfdaa3c[_0x9775('0x34')]){delete _0xfdaa3c[_0x9775('0x34')];}_0x10ab02['status'](_0x4a5990)[_0x9775('0x35')](_0xfdaa3c);};}exports[_0x9775('0x36')]=function(_0x37701c,_0x133048){var _0x18295a={},_0x1680a4={},_0x71a1d={'count':0x0,'rows':[]};var _0x162244=_[_0x9775('0x37')](db[_0x9775('0x38')][_0x9775('0x39')],function(_0x15f5de){return{'name':_0x15f5de[_0x9775('0x3a')],'type':_0x15f5de[_0x9775('0x3b')][_0x9775('0x3c')]};});_0x1680a4['model']=_[_0x9775('0x37')](_0x162244,_0x9775('0x34'));_0x1680a4[_0x9775('0x3d')]=_[_0x9775('0x3e')](_0x37701c['query']);_0x1680a4['filters']=_['intersection'](_0x1680a4[_0x9775('0x3f')],_0x1680a4[_0x9775('0x3d')]);_0x18295a[_0x9775('0x40')]=_[_0x9775('0x41')](_0x1680a4[_0x9775('0x3f')],qs['fields'](_0x37701c[_0x9775('0x3d')][_0x9775('0x42')]));_0x18295a[_0x9775('0x40')]=_0x18295a[_0x9775('0x40')][_0x9775('0x43')]?_0x18295a[_0x9775('0x40')]:_0x1680a4[_0x9775('0x3f')];if(!_0x37701c['query'][_0x9775('0x44')](_0x9775('0x45'))){_0x18295a[_0x9775('0x24')]=qs[_0x9775('0x24')](_0x37701c[_0x9775('0x3d')][_0x9775('0x24')]);_0x18295a[_0x9775('0x22')]=qs[_0x9775('0x22')](_0x37701c['query']['offset']);}_0x18295a[_0x9775('0x46')]=qs['sort'](_0x37701c[_0x9775('0x3d')][_0x9775('0x47')]);_0x18295a[_0x9775('0x48')]=qs['filters'](_[_0x9775('0x49')](_0x37701c[_0x9775('0x3d')],_0x1680a4[_0x9775('0x4a')]),_0x162244);if(_0x37701c[_0x9775('0x3d')]['filter']){_0x18295a[_0x9775('0x48')]=_[_0x9775('0x4b')](_0x18295a['where'],{'$or':_[_0x9775('0x37')](_0x162244,function(_0x1beaac){if(_0x1beaac[_0x9775('0x3b')]!=='VIRTUAL'){var _0x476f6d={};_0x476f6d[_0x1beaac[_0x9775('0x34')]]={'$like':'%'+_0x37701c['query'][_0x9775('0x4c')]+'%'};return _0x476f6d;}})});}_0x18295a=_[_0x9775('0x4b')]({},_0x18295a,_0x37701c[_0x9775('0x4d')]);var _0x4e7c59={'where':_0x18295a[_0x9775('0x48')]};return db['Plugin'][_0x9775('0x25')](_0x4e7c59)[_0x9775('0x2d')](function(_0x5d533d){_0x71a1d['count']=_0x5d533d;if(_0x37701c[_0x9775('0x3d')][_0x9775('0x4e')]){_0x18295a[_0x9775('0x4f')]=[{'all':!![]}];}return db[_0x9775('0x38')][_0x9775('0x50')](_0x18295a);})[_0x9775('0x2d')](function(_0x33c336){_0x71a1d['rows']=_0x33c336;return _0x71a1d;})[_0x9775('0x2d')](respondWithFilteredResult(_0x133048,_0x18295a))['catch'](handleError(_0x133048,null));};exports[_0x9775('0x51')]=function(_0x54f4c4,_0x3f2cfd){var _0x5755f9={'raw':!![],'where':{'id':_0x54f4c4[_0x9775('0x52')]['id']}},_0x49135c={};_0x49135c[_0x9775('0x3f')]=_[_0x9775('0x3e')](db[_0x9775('0x38')]['rawAttributes']);_0x49135c[_0x9775('0x3d')]=_[_0x9775('0x3e')](_0x54f4c4[_0x9775('0x3d')]);_0x49135c[_0x9775('0x4a')]=_[_0x9775('0x41')](_0x49135c[_0x9775('0x3f')],_0x49135c[_0x9775('0x3d')]);_0x5755f9['attributes']=_['intersection'](_0x49135c['model'],qs[_0x9775('0x42')](_0x54f4c4[_0x9775('0x3d')]['fields']));_0x5755f9['attributes']=_0x5755f9[_0x9775('0x40')][_0x9775('0x43')]?_0x5755f9[_0x9775('0x40')]:_0x49135c[_0x9775('0x3f')];if(_0x54f4c4[_0x9775('0x3d')][_0x9775('0x4e')]){_0x5755f9['include']=[{'all':!![]}];}_0x5755f9=_['merge']({},_0x5755f9,_0x54f4c4[_0x9775('0x4d')]);return db[_0x9775('0x38')][_0x9775('0x53')](_0x5755f9)[_0x9775('0x2d')](handleEntityNotFound(_0x3f2cfd,null))[_0x9775('0x2d')](respondWithResult(_0x3f2cfd,null))[_0x9775('0x54')](handleError(_0x3f2cfd,null));};exports['download']=function(_0x357951,_0x206b59,_0x3dc7d7){return db[_0x9775('0x38')][_0x9775('0x53')]({'where':{'id':_0x357951['params']['id']},'attributes':['name',_0x9775('0x6')],'raw':!![]})[_0x9775('0x2d')](handleEntityNotFound(_0x206b59,null))[_0x9775('0x2d')](function(_0x12998d){if(_0x12998d){var _0x26e727=path[_0x9775('0x55')](config['root'],_0x9775('0x56'),util[_0x9775('0x57')]('%s.zip',path[_0x9775('0x58')](_0x12998d[_0x9775('0x6')])));var _0x48eced=fs[_0x9775('0x59')](_0x26e727);var _0x2e64ac=archiver(_0x9775('0x5a'),{'zlib':{'level':0x9}});_0x2e64ac['on']('warning',function(_0x272057){if(_0x272057[_0x9775('0x5b')]===_0x9775('0x5c')){logger['error'](_0x272057);}else{throw new db[(_0x9775('0x5d'))]['Error'](_0x9775('0x5e'));}});_0x2e64ac['on'](_0x9775('0x32'),function(_0x4481d4){throw new db[(_0x9775('0x5d'))][(_0x9775('0x5f'))](_0x9775('0x5e'));});_0x2e64ac['pipe'](_0x48eced);_0x2e64ac[_0x9775('0x60')](_0x9775('0x61'),{'cwd':path[_0x9775('0x55')](config['root'],'server/files/plugins',path[_0x9775('0x62')](_0x12998d[_0x9775('0x6')])),'ignore':[path[_0x9775('0x55')](path[_0x9775('0x58')](_0x12998d[_0x9775('0x6')]),_0x9775('0x63')),path['join'](path[_0x9775('0x58')](_0x12998d[_0x9775('0x6')]),'attachments/**/*')],'nodir':!![]})[_0x9775('0x64')]();_0x48eced['on']('close',function(){if(!fs[_0x9775('0x65')](_0x26e727)){throw new db['Sequelize'][(_0x9775('0x5f'))](_0x9775('0x66'));}return _0x206b59[_0x9775('0x67')](_0x26e727,util[_0x9775('0x57')](_0x9775('0x68'),path[_0x9775('0x58')](_0x12998d[_0x9775('0x6')])),function(_0x90649){if(_0x90649){throw new db[(_0x9775('0x5d'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x9775('0x69')](_0x26e727);logger['info'](_0x9775('0x6a'));logger[_0x9775('0x6b')](_0x9775('0x6c'));});});}return null;})[_0x9775('0x54')](handleError(_0x206b59,null));};exports[_0x9775('0x6d')]=function(_0x2d84d2,_0x3d345a,_0x4b19cf){var _0xc7224b=path[_0x9775('0x58')](_0x2d84d2[_0x9775('0x6e')][_0x9775('0x6f')],path['extname'](_0x2d84d2['file'][_0x9775('0x6f')]));var _0x178aab=path[_0x9775('0x55')](config['root'],'server/files/plugins',_0x2d84d2[_0x9775('0x6e')]['filename']);var _0x52b9c4=path[_0x9775('0x55')](config[_0x9775('0x70')],'server/files/plugins',_0xc7224b);logger[_0x9775('0x6b')]('Plugin\x20upload\x20filepath:\x20%s',_0x178aab);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x52b9c4);try{fs[_0x9775('0x71')](_0x178aab,parseInt(_0x9775('0x72'),0x8));extract(_0x178aab,{'dir':_0x52b9c4},function(_0x5263b2){if(_0x5263b2){logger[_0x9775('0x32')](_0x5263b2);handleError(_0x5263b2,!![]);};var _0x45686a=fs[_0x9775('0x73')](_0x52b9c4);if(_0x45686a[_0x9775('0x43')]>0x1){removeReferences(_0x178aab,_0x52b9c4);logger[_0x9775('0x32')](_0x9775('0x74'));return _0x4b19cf(new Error('Invalid\x20plugin\x20structure'));}var _0x195862=fs[_0x9775('0x75')](path[_0x9775('0x55')](_0x52b9c4,_0x45686a[0x0]));if(_0x195862[_0x9775('0x76')]()){removeReferences(_0x178aab,_0x52b9c4);logger[_0x9775('0x32')](_0x9775('0x74'));return _0x4b19cf(new Error('Invalid\x20plugin\x20structure'));}if(_0x195862[_0x9775('0x77')]()){var _0x1dc66f=fs[_0x9775('0x73')](path['join'](_0x52b9c4,_0x45686a[0x0]));if(_0x1dc66f['length']===0x0){removeReferences(_0x178aab,_0x52b9c4);logger[_0x9775('0x32')](_0x9775('0x74'));return _0x4b19cf(new Error(_0x9775('0x74')));}var _0x4fa0b2=_0x1dc66f[_0x9775('0x78')](function(_0x3406bb){return _0x3406bb===_0x9775('0x79');});if(!_0x4fa0b2){return _0x4b19cf(new Error(_0x9775('0x7a')));}var _0x1b2548=fs[_0x9775('0x7b')](path[_0x9775('0x55')](_0x52b9c4,_0x45686a[0x0],_0x9775('0x79')));var _0x4e14dc=JSON[_0x9775('0x7c')](_0x1b2548);if(_0x9775('0x23')==typeof _0x4e14dc[_0x9775('0x34')]){return _0x4b19cf(new Error(_0x9775('0x7d')));}if(_0x9775('0x23')==typeof _0x4e14dc['type']){return _0x4b19cf(new Error(_0x9775('0x7e')));}if('undefined'==typeof _0x4e14dc['version']){return _0x4b19cf(new Error(_0x9775('0x7f')));}if(_0x9775('0x23')==typeof _0x4e14dc['parameters']){return _0x4b19cf(new Error(_0x9775('0x80')));}if(_0x4e14dc[_0x9775('0x3b')]===_0x9775('0x81')){if('undefined'==typeof _0x4e14dc[_0x9775('0x82')][_0x9775('0x83')]){return _0x4b19cf(new Error(_0x9775('0x84')));}if('undefined'==typeof _0x4e14dc['parameters'][_0x9775('0x83')][_0x9775('0x85')]&&_0x9775('0x23')==typeof _0x4e14dc['parameters']['views'][_0x9775('0x86')]){return _0x4b19cf(new Error(_0x9775('0x87')));}}else if(_0x4e14dc['type']===_0x9775('0x88')){if(_0x9775('0x23')==typeof _0x4e14dc[_0x9775('0x82')][_0x9775('0x89')]){return _0x4b19cf(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x9775('0x23')==typeof _0x4e14dc[_0x9775('0x82')][_0x9775('0x8a')]){return _0x4b19cf(new Error(_0x9775('0x8b')));}}else{return _0x4b19cf(new Error(_0x9775('0x8c')));}var _0x4a32f3=_0x4e14dc[_0x9775('0x34')];var _0x483cd9=_0x4e14dc[_0x9775('0x8d')];var _0x581224=_0x4e14dc[_0x9775('0x3b')];var _0x21414d=_0x4e14dc[_0x9775('0x8e')]?_0x4e14dc['sidebar']:_0x9775('0x8f');var _0xe51125=_0x4e14dc[_0x9775('0x90')]?_0x4e14dc[_0x9775('0x90')]:_0x9775('0x91');var _0x38860f='';var _0x556dea='';var _0x404d13='';var _0x2137d1='';var _0x59c299=_0x4e14dc[_0x9775('0x92')];if(_0x581224===_0x9775('0x81')){if(_0x9775('0x23')!=typeof _0x4e14dc[_0x9775('0x82')][_0x9775('0x83')][_0x9775('0x85')]){var _0x3686ac=_0x4e14dc['parameters'][_0x9775('0x83')][_0x9775('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3686ac)){_0x38860f=path[_0x9775('0x55')](_0x9775('0x93'),_0xc7224b,_0x45686a[0x0],_0x3686ac);}else{_0x38860f=_0x3686ac;}}else{logger['info'](_0x9775('0x94'));}if('undefined'!=typeof _0x4e14dc[_0x9775('0x82')][_0x9775('0x83')]['agent']){var _0x44d8b8=_0x4e14dc[_0x9775('0x82')][_0x9775('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x44d8b8)){_0x556dea=path[_0x9775('0x55')](_0x9775('0x93'),_0xc7224b,_0x45686a[0x0],_0x44d8b8);}else{_0x556dea=_0x44d8b8;}}else{logger[_0x9775('0x6b')](_0x9775('0x95'));}}else if(_0x581224===_0x9775('0x88')){_0x404d13=_0x4e14dc['parameters'][_0x9775('0x89')];_0x2137d1=_0x4e14dc['parameters'][_0x9775('0x8a')];if('undefined'!=typeof _0x4e14dc['parameters']['views']){if('undefined'!=typeof _0x4e14dc[_0x9775('0x82')][_0x9775('0x83')]['admin']){var _0x3686ac=_0x4e14dc[_0x9775('0x82')][_0x9775('0x83')][_0x9775('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x9775('0x96')](_0x3686ac)){_0x38860f=path['join']('plugins',_0xc7224b,_0x45686a[0x0],_0x3686ac);}else{_0x38860f=_0x3686ac;}}if(_0x9775('0x23')!=typeof _0x4e14dc[_0x9775('0x82')][_0x9775('0x83')][_0x9775('0x86')]){var _0x44d8b8=_0x4e14dc[_0x9775('0x82')][_0x9775('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9775('0x96')](_0x44d8b8)){_0x556dea=path['join']('plugins',_0xc7224b,_0x45686a[0x0],_0x44d8b8);}else{_0x556dea=_0x44d8b8;}}}}var _0x5b2029={'name':_0x4a32f3,'description':_0x483cd9,'path':path[_0x9775('0x55')](_0xc7224b,_0x45686a[0x0]),'type':_0x581224,'sidebar':_0x21414d,'icon':_0xe51125,'adminUrl':_0x38860f,'agentUrl':_0x556dea,'scriptName':_0x404d13,'scriptPath':_0x2137d1,'version':_0x59c299};removeReferences(_0x178aab,null);return db[_0x9775('0x38')][_0x9775('0x97')](_0x5b2029)[_0x9775('0x2d')](function(_0x24ad6d){var _0x2fc6e7={'role':_0x2d84d2['body'][_0x9775('0x98')],'userProfileId':_0x2d84d2['body'][_0x9775('0x99')]};if(!_0x2fc6e7)throw new Error(_0x9775('0x9a'));if(_0x2fc6e7[_0x9775('0x98')]===_0x9775('0x9b')){var _0x26a6ec=_0x24ad6d[_0x9775('0x9c')]({'plain':!![]});return db[_0x9775('0x9d')][_0x9775('0x53')]({'where':{'name':_0x9775('0x2f'),'userProfileId':_0x2fc6e7[_0x9775('0x99')]},'raw':!![]})['then'](function(_0x33123b){if(_0x33123b&&_0x33123b[_0x9775('0x9e')]===0x0){return db['UserProfileResource']['create']({'name':_0x26a6ec[_0x9775('0x34')],'resourceId':_0x26a6ec['id'],'type':_0x33123b[_0x9775('0x34')],'sectionId':_0x33123b['id']},{})['then'](function(){return _0x24ad6d;});}else{return _0x24ad6d;}})['catch'](function(_0x92d01f){logger[_0x9775('0x32')](_0x9775('0x9f'),_0x92d01f);throw _0x92d01f;});}return _0x24ad6d;})[_0x9775('0x2d')](respondWithResult(_0x3d345a,null))['catch'](handleError(_0x3d345a,null));}});}catch(_0x3716f0){_0x3d345a[_0x9775('0x21')](0x1f4)[_0x9775('0x35')](_0x3716f0);}};function removeReferences(_0x40b7f3,_0x3b819d){try{if(_0x40b7f3){fs['unlinkSync'](_0x40b7f3);logger[_0x9775('0x6b')](_0x9775('0xa0'));}if(_0x3b819d){rimraf(_0x3b819d,function(){});logger[_0x9775('0x6b')](_0x9775('0xa1'));}}catch(_0x3397ee){logger[_0x9775('0x32')](_0x3397ee);}}exports[_0x9775('0x2c')]=function(_0x565ddb,_0x1fbc2e,_0x4848f6){return db['Plugin']['find']({'where':{'id':_0x565ddb[_0x9775('0x52')]['id']}})[_0x9775('0x2d')](handleEntityNotFound(_0x1fbc2e,null))[_0x9775('0x2d')](saveUpdates(_0x565ddb['body'],null))[_0x9775('0x2d')](respondWithResult(_0x1fbc2e,null))[_0x9775('0x54')](handleError(_0x1fbc2e,null));};exports['delete']=function(_0x1362a1,_0x4790ed,_0x455d32){return db['Plugin']['find']({'where':{'id':_0x1362a1['params']['id']}})[_0x9775('0x2d')](function(_0x4b769c){if(_0x4b769c){return _0x4b769c[_0x9775('0x2e')]();}})[_0x9775('0x2d')](function(_0x353fc9){rimraf(path[_0x9775('0x55')](config['root'],'server/files/plugins',path['dirname'](_0x353fc9[_0x9775('0x6')])),function(){});return _0x353fc9;})[_0x9775('0x2d')](handleEntityNotFound(_0x4790ed,null))[_0x9775('0x2d')](respondWithStatusCode(_0x4790ed,null))[_0x9775('0x54')](handleError(_0x4790ed,null));};exports[_0x9775('0xa2')]=function(_0x4332dd,_0xe23bd2,_0x47dd54){return BPromise[_0x9775('0xa3')]()[_0x9775('0x2d')](function(){if(!_0x4332dd[_0x9775('0x3d')][_0x9775('0x6')]){throw new Error(_0x9775('0xa4'));}if(!_0x4332dd[_0x9775('0x3d')][_0x9775('0xa5')]){throw new Error(_0x9775('0xa6'));}var _0x23824c=_0x4332dd[_0x9775('0x3d')][_0x9775('0xa7')]?_0x4332dd['query'][_0x9775('0xa7')]+':'+_0x4332dd[_0x9775('0x3d')][_0x9775('0xa5')]:_0x9775('0xa8')+_0x4332dd[_0x9775('0x3d')][_0x9775('0xa5')];var _0x3da84b=_0x4332dd['query'][_0x9775('0x28')]?_0x4332dd[_0x9775('0x3d')][_0x9775('0x28')]:!![];var _0xd59f59=_0x4332dd[_0x9775('0x3d')][_0x9775('0xa9')]?_0x4332dd[_0x9775('0x3d')][_0x9775('0xa9')]:null;var _0x6c1afb={'method':_0x4332dd['method'],'uri':util[_0x9775('0x57')](_0x9775('0xaa'),_0x23824c,_0x4332dd['query'][_0x9775('0x6')]),'json':_0x3da84b,'resolveWithFullResponse':!![],'encoding':_0xd59f59,'qs':_0x4332dd[_0x9775('0x3d')]};if(_0x4332dd[_0x9775('0xab')]){_0x6c1afb[_0x9775('0xab')]=_0x4332dd[_0x9775('0xab')];if(_0x6c1afb[_0x9775('0xab')]['content-length']){delete _0x6c1afb[_0x9775('0xab')][_0x9775('0xac')];}}if(_0x6c1afb[_0x9775('0xab')][_0x9775('0xad')]){delete _0x6c1afb['headers']['content-type'];}return rp(_0x6c1afb);})[_0x9775('0x2d')](function(_0x5e872f){if(_0x5e872f){_0xe23bd2[_0x9775('0x26')](_0x5e872f[_0x9775('0xab')]);logger[_0x9775('0x6b')](_0x5e872f[_0x9775('0xae')]);if(_[_0x9775('0xaf')](_0x4332dd[_0x9775('0x3d')][_0x9775('0x6')],'download')&&_0x5e872f['statusCode']==0x1f4){return _0xe23bd2[_0x9775('0x20')](_0x5e872f[_0x9775('0xb0')]);}else{return _0xe23bd2[_0x9775('0x21')](_0x5e872f['statusCode'])[_0x9775('0x35')](_0x5e872f['body']);}}else{return _0xe23bd2[_0x9775('0x20')](0xc8);}})['catch'](handleError(_0xe23bd2,null));};exports[_0x9775('0xb1')]=function(_0x17c6a8,_0x565120,_0x348b31){return BPromise[_0x9775('0xa3')]()[_0x9775('0x2d')](function(){if(!_0x17c6a8[_0x9775('0x3d')][_0x9775('0x6')]){throw new Error(_0x9775('0xa4'));}if(!_0x17c6a8['query'][_0x9775('0xa5')]){throw new Error(_0x9775('0xa6'));}var _0x4e24b9=_0x17c6a8['query'][_0x9775('0xa7')]?_0x17c6a8[_0x9775('0x3d')][_0x9775('0xa7')]+':'+_0x17c6a8[_0x9775('0x3d')][_0x9775('0xa5')]:_0x9775('0xa8')+_0x17c6a8[_0x9775('0x3d')][_0x9775('0xa5')];var _0x514081=_0x17c6a8['query'][_0x9775('0x28')]?_0x17c6a8['query'][_0x9775('0x28')]:!![];var _0x2115a4=_0x17c6a8['query'][_0x9775('0xa9')]?_0x17c6a8[_0x9775('0x3d')]['encoding']:null;var _0x24cddf={'method':_0x17c6a8[_0x9775('0xb2')],'uri':util[_0x9775('0x57')](_0x9775('0xaa'),_0x4e24b9,_0x17c6a8[_0x9775('0x3d')][_0x9775('0x6')]),'json':_0x514081,'resolveWithFullResponse':!![],'encoding':_0x2115a4,'body':_0x17c6a8['body']};if(_0x17c6a8[_0x9775('0xab')]){_0x24cddf['headers']=_0x17c6a8['headers'];if(_0x24cddf[_0x9775('0xab')][_0x9775('0xac')]){delete _0x24cddf[_0x9775('0xab')]['content-length'];}}if(_0x24cddf[_0x9775('0xab')][_0x9775('0xad')]){delete _0x24cddf[_0x9775('0xab')]['content-type'];}return rp(_0x24cddf);})[_0x9775('0x2d')](function(_0x1f39e6){if(_0x1f39e6){_0x565120[_0x9775('0x26')](_0x1f39e6['headers']);logger[_0x9775('0x6b')](_0x1f39e6[_0x9775('0xae')]);return _0x565120[_0x9775('0x21')](_0x1f39e6['statusCode'])[_0x9775('0x35')](_0x1f39e6[_0x9775('0xae')]);}else{return _0x565120[_0x9775('0x20')](0xc8);}})[_0x9775('0x54')](handleError(_0x565120,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 68d351d..af35b73 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 _0x908e=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x366207,_0x328c2e){var _0x2a74e6=function(_0x192f52){while(--_0x192f52){_0x366207['push'](_0x366207['shift']());}};_0x2a74e6(++_0x328c2e);}(_0x908e,0x182));var _0xe908=function(_0xb653f3,_0x5cccc0){_0xb653f3=_0xb653f3-0x0;var _0x5b5ed1=_0x908e[_0xb653f3];return _0x5b5ed1;};'use strict';var EventEmitter=require(_0xe908('0x0'));var Plugin=require(_0xe908('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe908('0x2'),'afterUpdate':_0xe908('0x3'),'afterDestroy':_0xe908('0x4')};function emitEvent(_0x189e81){return function(_0x4c2cdb,_0x46a00d,_0x4c8a70){PluginEvents['emit'](_0x189e81+':'+_0x4c2cdb['id'],_0x4c2cdb);PluginEvents[_0xe908('0x5')](_0x189e81,_0x4c2cdb);_0x4c8a70(null);};}for(var e in events){if(events[_0xe908('0x6')](e)){var event=events[e];Plugin[_0xe908('0x7')](e,emitEvent(event));}}module[_0xe908('0x8')]=PluginEvents; \ No newline at end of file +var _0x67d1=['remove','emit','hook','../../mysqldb','Plugin','save','update'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x67d1,0xf1));var _0x167d=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x67d1[_0x413feb];return _0x40ee88;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x167d('0x0'))['db'][_0x167d('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x167d('0x2'),'afterUpdate':_0x167d('0x3'),'afterDestroy':_0x167d('0x4')};function emitEvent(_0x140f63){return function(_0x4e6fba,_0x3ab690,_0x1d3b56){PluginEvents[_0x167d('0x5')](_0x140f63+':'+_0x4e6fba['id'],_0x4e6fba);PluginEvents[_0x167d('0x5')](_0x140f63,_0x4e6fba);_0x1d3b56(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x167d('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 0cf744f..174f288 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 _0xd8ad=['request-promise','path','../../config/environment','./plugin.attributes','exports','Plugin','lodash','util','api','moment','bluebird'];(function(_0x24c668,_0x261a4c){var _0x17b342=function(_0x4082ab){while(--_0x4082ab){_0x24c668['push'](_0x24c668['shift']());}};_0x17b342(++_0x261a4c);}(_0xd8ad,0x95));var _0xdd8a=function(_0x4605dc,_0x3f7ae5){_0x4605dc=_0x4605dc-0x0;var _0x5d3e81=_0xd8ad[_0x4605dc];return _0x5d3e81;};'use strict';var _=require(_0xdd8a('0x0'));var util=require(_0xdd8a('0x1'));var logger=require('../../config/logger')(_0xdd8a('0x2'));var moment=require(_0xdd8a('0x3'));var BPromise=require(_0xdd8a('0x4'));var rp=require(_0xdd8a('0x5'));var fs=require('fs');var path=require(_0xdd8a('0x6'));var rimraf=require('rimraf');var config=require(_0xdd8a('0x7'));var attributes=require(_0xdd8a('0x8'));module[_0xdd8a('0x9')]=function(_0x4b92fe,_0x18b4fb){return _0x4b92fe['define'](_0xdd8a('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdf6=['request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','lodash','util','api','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfdf6,0x97));var _0x6fdf=function(_0x103cdc,_0x1bdc05){_0x103cdc=_0x103cdc-0x0;var _0x29826b=_0xfdf6[_0x103cdc];return _0x29826b;};'use strict';var _=require(_0x6fdf('0x0'));var util=require(_0x6fdf('0x1'));var logger=require('../../config/logger')(_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(_0x6fdf('0x8'));var attributes=require(_0x6fdf('0x9'));module[_0x6fdf('0xa')]=function(_0xc455cb,_0xf20758){return _0xc455cb[_0x6fdf('0xb')](_0x6fdf('0xc'),attributes,{'tableName':'plugins','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 63aceb0..0f960ec 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 _0x3d81=['rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreatePlugin','Plugin','body','options','raw','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x1e17f3,_0x848b5e){var _0x550971=function(_0x1fd70d){while(--_0x1fd70d){_0x1e17f3['push'](_0x1e17f3['shift']());}};_0x550971(++_0x848b5e);}(_0x3d81,0xc5));var _0x13d8=function(_0x1b12cf,_0x503940){_0x1b12cf=_0x1b12cf-0x0;var _0x1e37ac=_0x3d81[_0x1b12cf];return _0x1e37ac;};'use strict';var _=require(_0x13d8('0x0'));var util=require(_0x13d8('0x1'));var moment=require(_0x13d8('0x2'));var BPromise=require(_0x13d8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13d8('0x4'));var db=require(_0x13d8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x13d8('0x6'))(_0x13d8('0x7'));var config=require(_0x13d8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x13d8('0x9')][_0x13d8('0xa')]({'port':0x232a});config[_0x13d8('0xb')]=_['defaults'](config[_0x13d8('0xb')],{'host':_0x13d8('0xc'),'port':0x18eb});var socket=require(_0x13d8('0xd'))(new Redis(config[_0x13d8('0xb')]));require(_0x13d8('0xe'))[_0x13d8('0xf')](socket);function respondWithRpcPromise(_0x219fdf,_0x47fbf8,_0x4acaed){return new BPromise(function(_0x284237,_0xb449ff){return client[_0x13d8('0x10')](_0x219fdf,_0x4acaed)[_0x13d8('0x11')](function(_0x25c6b2){logger[_0x13d8('0x12')](_0x13d8('0x13'),_0x47fbf8,'request\x20sent');logger['debug'](_0x13d8('0x14'),_0x47fbf8,_0x13d8('0x15'),JSON[_0x13d8('0x16')](_0x25c6b2));if(_0x25c6b2[_0x13d8('0x17')]){if(_0x25c6b2[_0x13d8('0x17')][_0x13d8('0x18')]===0x1f4){logger[_0x13d8('0x17')](_0x13d8('0x13'),_0x47fbf8,_0x25c6b2[_0x13d8('0x17')][_0x13d8('0x19')]);return _0xb449ff(_0x25c6b2[_0x13d8('0x17')][_0x13d8('0x19')]);}logger['error'](_0x13d8('0x13'),_0x47fbf8,_0x25c6b2[_0x13d8('0x17')][_0x13d8('0x19')]);return _0x284237(_0x25c6b2[_0x13d8('0x17')]['message']);}else{logger[_0x13d8('0x12')]('Plugin,\x20%s,\x20%s',_0x47fbf8,'request\x20sent');_0x284237(_0x25c6b2[_0x13d8('0x1a')][_0x13d8('0x19')]);}})[_0x13d8('0x1b')](function(_0x3e35b3){logger[_0x13d8('0x17')](_0x13d8('0x13'),_0x47fbf8,_0x3e35b3);_0xb449ff(_0x3e35b3);});});}exports[_0x13d8('0x1c')]=function(_0x19836b){var _0x244130=this;return new Promise(function(_0xd3206d,_0x41df4a){return db[_0x13d8('0x1d')]['create'](_0x19836b[_0x13d8('0x1e')],{'raw':_0x19836b['options']?_0x19836b[_0x13d8('0x1f')][_0x13d8('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x19f086){logger[_0x13d8('0x12')](_0x13d8('0x1c'),_0x19836b);logger[_0x13d8('0x21')](_0x13d8('0x1c'),_0x19836b,JSON[_0x13d8('0x16')](_0x19f086));_0xd3206d(_0x19f086);})[_0x13d8('0x1b')](function(_0x6a5146){logger['error'](_0x13d8('0x1c'),_0x6a5146['message'],_0x19836b);_0x41df4a(_0x244130['error'](0x1f4,_0x6a5146[_0x13d8('0x19')]));});});}; \ No newline at end of file +var _0x3c2b=['code','message','result','catch','CreatePlugin','create','body','raw','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x221637,_0x42a5e0){var _0x11bf9e=function(_0xbc416e){while(--_0xbc416e){_0x221637['push'](_0x221637['shift']());}};_0x11bf9e(++_0x42a5e0);}(_0x3c2b,0x117));var _0xb3c2=function(_0x19e16f,_0x4a9324){_0x19e16f=_0x19e16f-0x0;var _0x242c29=_0x3c2b[_0x19e16f];return _0x242c29;};'use strict';var _=require(_0xb3c2('0x0'));var util=require(_0xb3c2('0x1'));var moment=require(_0xb3c2('0x2'));var BPromise=require(_0xb3c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3c2('0x4'));var db=require(_0xb3c2('0x5'))['db'];var utils=require(_0xb3c2('0x6'));var logger=require(_0xb3c2('0x7'))(_0xb3c2('0x8'));var config=require('../../config/environment');var jayson=require(_0xb3c2('0x9'));var client=jayson['client'][_0xb3c2('0xa')]({'port':0x232a});config[_0xb3c2('0xb')]=_[_0xb3c2('0xc')](config[_0xb3c2('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb3c2('0xb')]));require('./plugin.socket')[_0xb3c2('0xd')](socket);function respondWithRpcPromise(_0x17baec,_0x13f6ae,_0xf5b8c6){return new BPromise(function(_0x3b7d80,_0x2d5815){return client[_0xb3c2('0xe')](_0x17baec,_0xf5b8c6)['then'](function(_0x2f0aed){logger[_0xb3c2('0xf')](_0xb3c2('0x10'),_0x13f6ae,_0xb3c2('0x11'));logger[_0xb3c2('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x13f6ae,'request\x20sent',JSON[_0xb3c2('0x13')](_0x2f0aed));if(_0x2f0aed[_0xb3c2('0x14')]){if(_0x2f0aed[_0xb3c2('0x14')][_0xb3c2('0x15')]===0x1f4){logger[_0xb3c2('0x14')]('Plugin,\x20%s,\x20%s',_0x13f6ae,_0x2f0aed[_0xb3c2('0x14')][_0xb3c2('0x16')]);return _0x2d5815(_0x2f0aed[_0xb3c2('0x14')][_0xb3c2('0x16')]);}logger[_0xb3c2('0x14')]('Plugin,\x20%s,\x20%s',_0x13f6ae,_0x2f0aed[_0xb3c2('0x14')][_0xb3c2('0x16')]);return _0x3b7d80(_0x2f0aed[_0xb3c2('0x14')][_0xb3c2('0x16')]);}else{logger['info'](_0xb3c2('0x10'),_0x13f6ae,'request\x20sent');_0x3b7d80(_0x2f0aed[_0xb3c2('0x17')][_0xb3c2('0x16')]);}})[_0xb3c2('0x18')](function(_0x40e0ff){logger[_0xb3c2('0x14')](_0xb3c2('0x10'),_0x13f6ae,_0x40e0ff);_0x2d5815(_0x40e0ff);});});}exports[_0xb3c2('0x19')]=function(_0x112663){var _0x45cf5a=this;return new Promise(function(_0x46db38,_0x57b926){return db['Plugin'][_0xb3c2('0x1a')](_0x112663[_0xb3c2('0x1b')],{'raw':_0x112663['options']?_0x112663['options'][_0xb3c2('0x1c')]===undefined?!![]:![]:!![]})[_0xb3c2('0x1d')](function(_0x490818){logger[_0xb3c2('0xf')]('CreatePlugin',_0x112663);logger[_0xb3c2('0x12')](_0xb3c2('0x19'),_0x112663,JSON['stringify'](_0x490818));_0x46db38(_0x490818);})[_0xb3c2('0x18')](function(_0x301bc3){logger[_0xb3c2('0x14')]('CreatePlugin',_0x301bc3['message'],_0x112663);_0x57b926(_0x45cf5a[_0xb3c2('0x14')](0x1f4,_0x301bc3[_0xb3c2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index c94a9d3..caebc28 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 _0xcf2e=['register','length','plugin:','save','remove','emit'];(function(_0x3e30aa,_0x1808da){var _0x56e2bd=function(_0x46d668){while(--_0x46d668){_0x3e30aa['push'](_0x3e30aa['shift']());}};_0x56e2bd(++_0x1808da);}(_0xcf2e,0x6f));var _0xecf2=function(_0x4cbde1,_0x5785ec){_0x4cbde1=_0x4cbde1-0x0;var _0x37d42=_0xcf2e[_0x4cbde1];return _0x37d42;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xecf2('0x0'),_0xecf2('0x1'),'update'];function createListener(_0x5b3c1a,_0x842ca4){return function(_0x4f60f8){_0x842ca4[_0xecf2('0x2')](_0x5b3c1a,_0x4f60f8);};}function removeListener(_0xbd7b9f,_0x440207){return function(){PluginEvents['removeListener'](_0xbd7b9f,_0x440207);};}exports[_0xecf2('0x3')]=function(_0x15ffae){for(var _0x5cc894=0x0,_0x7d718a=events[_0xecf2('0x4')];_0x5cc894<_0x7d718a;_0x5cc894++){var _0x5bfe0b=events[_0x5cc894];var _0x54223e=createListener(_0xecf2('0x5')+_0x5bfe0b,_0x15ffae);PluginEvents['on'](_0x5bfe0b,_0x54223e);}}; \ No newline at end of file +var _0x6ef9=['./plugin.events','remove','update','emit','register','length'];(function(_0x501401,_0x2d8737){var _0xfd0a47=function(_0x57decb){while(--_0x57decb){_0x501401['push'](_0x501401['shift']());}};_0xfd0a47(++_0x2d8737);}(_0x6ef9,0xba));var _0x96ef=function(_0x488ca1,_0xf6858e){_0x488ca1=_0x488ca1-0x0;var _0x4dd0a4=_0x6ef9[_0x488ca1];return _0x4dd0a4;};'use strict';var PluginEvents=require(_0x96ef('0x0'));var events=['save',_0x96ef('0x1'),_0x96ef('0x2')];function createListener(_0x2601b0,_0x84bb2){return function(_0xd40053){_0x84bb2[_0x96ef('0x3')](_0x2601b0,_0xd40053);};}function removeListener(_0x4f1f04,_0x55bea5){return function(){PluginEvents['removeListener'](_0x4f1f04,_0x55bea5);};}exports[_0x96ef('0x4')]=function(_0x46953f){for(var _0x22588d=0x0,_0x10c4cf=events[_0x96ef('0x5')];_0x22588d<_0x10c4cf;_0x22588d++){var _0x153821=events[_0x22588d];var _0x26d4f1=createListener('plugin:'+_0x153821,_0x46953f);PluginEvents['on'](_0x153821,_0x26d4f1);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 367f4d7..bc81064 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(_0x111d5f,_0x3695a1){var _0x10a317=function(_0x34e65a){while(--_0x34e65a){_0x111d5f['push'](_0x111d5f['shift']());}};_0x10a317(++_0x3695a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x4ab7d3,_0x4e5a5d){var _0x7877b6=function(_0x3b4e44){while(--_0x3b4e44){_0x4ab7d3['push'](_0x4ab7d3['shift']());}};_0x7877b6(++_0x4e5a5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 3dda4d7..b7bcee7 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 _0x7072=['update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','sendStatus','status','json','name','send','npm\x20install','info','error','list','then','reject','express','length','catch','show','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump'];(function(_0xa7e43,_0x3f0f88){var _0x5a7e0f=function(_0x3cc879){while(--_0x3cc879){_0xa7e43['push'](_0xa7e43['shift']());}};_0x5a7e0f(++_0x3f0f88);}(_0x7072,0x138));var _0x2707=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x7072[_0x166742];return _0xb7814a;};'use strict';var _=require('lodash');var pm2=require(_0x2707('0x0'));var logger=require(_0x2707('0x1'))(_0x2707('0x2'));var path=require(_0x2707('0x3'));var exec=require(_0x2707('0x4'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0xfdfa7a,_0x5f3c1c){return function(_0xd36287){if(!_0xd36287){_0xfdfa7a[_0x2707('0x5')](0x194);;}return _0xd36287;};}function respondWithResult(_0x1e86f2,_0x194132){_0x194132=_0x194132||0xc8;return function(_0x2fd8ff){if(_0x2fd8ff){return _0x1e86f2[_0x2707('0x6')](_0x194132)[_0x2707('0x7')](_0x2fd8ff);}return null;};}function handleError(_0x745cfd,_0x4062b6){_0x4062b6=_0x4062b6||0x1f4;return function(_0x2820ef){logger['error'](_0x2820ef['stack']);if(_0x2820ef[_0x2707('0x8')]){delete _0x2820ef[_0x2707('0x8')];}_0x745cfd[_0x2707('0x6')](_0x4062b6)[_0x2707('0x9')](_0x2820ef);};}function execChildProcess(){return new BPromise(function(_0x30090e,_0x2e1a46){exec(_0x2707('0xa'),function(_0x19881c,_0x115535,_0x478717){logger[_0x2707('0xb')](_0x115535);logger[_0x2707('0xb')](_0x478717);if(_0x19881c){logger[_0x2707('0xc')](_0x19881c);return _0x2e1a46(_0x19881c);}return _0x30090e(_0x115535);});});}exports['index']=function(_0x44c1d7,_0x590152){return pm2[_0x2707('0xd')]()[_0x2707('0xe')](function(_0xfe975c){if(_0xfe975c){var _0x3a67f2=_[_0x2707('0xf')](_0xfe975c,function(_0x4e52a3){return _0x4e52a3[_0x2707('0x8')]===_0x2707('0x10')||_0x4e52a3[_0x2707('0x8')]==='motion2';});return{'rows':_0x3a67f2,'count':_0x3a67f2[_0x2707('0x11')]};}return null;})[_0x2707('0xe')](respondWithResult(_0x590152,null))[_0x2707('0x12')](handleError(_0x590152,null));};exports[_0x2707('0x13')]=function(_0x7ed037,_0x27a3ea){return pm2['describe'](_0x7ed037[_0x2707('0x14')]['id'])[_0x2707('0xe')](respondWithResult(_0x27a3ea,null))[_0x2707('0xe')](handleEntityNotFound(_0x27a3ea,null))['catch'](handleError(_0x27a3ea,null));};exports['create']=function(_0x58a4ee,_0x1da4a6){if(_0x58a4ee[_0x2707('0x15')][_0x2707('0x8')]&&_0x58a4ee[_0x2707('0x15')][_0x2707('0x16')]){var _0x3c2935=path[_0x2707('0x17')](__dirname,_0x2707('0x18'),_0x58a4ee[_0x2707('0x15')][_0x2707('0x16')]);var _0x37c475=process[_0x2707('0x19')]();process[_0x2707('0x1a')](path[_0x2707('0x1b')](_0x3c2935));return execChildProcess()['then'](function(_0x1acf22){process[_0x2707('0x1a')](_0x37c475);return pm2[_0x2707('0x1c')]({'name':_0x58a4ee[_0x2707('0x15')][_0x2707('0x8')],'script':_0x3c2935});})[_0x2707('0xe')](function(_0x4831ed){pm2[_0x2707('0x1d')]();return _0x4831ed[0x0];})[_0x2707('0xe')](respondWithResult(_0x1da4a6,0xc9))[_0x2707('0x12')](handleError(_0x1da4a6,null));}else{return _0x1da4a6[_0x2707('0x6')](0x1f4)[_0x2707('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2707('0x1e')]=function(_0x4ca05d,_0x29dad2){if(_0x4ca05d[_0x2707('0x15')]['id']){delete _0x4ca05d[_0x2707('0x15')]['id'];}var _0x57da26={'online':_0x2707('0x1f'),'stopped':_0x2707('0x20')};if(_0x57da26[_0x2707('0x21')](_0x4ca05d['body'][_0x2707('0x6')])){return pm2[_0x57da26[_0x4ca05d[_0x2707('0x15')]['status']]](_0x4ca05d[_0x2707('0x14')]['id'])['then'](respondWithResult(_0x29dad2,0xc8))['catch'](handleError(_0x29dad2,null));}else{return _0x29dad2[_0x2707('0x6')](0x1f4)['send']({'message':_0x2707('0x22')});}};exports[_0x2707('0x23')]=function(_0x417a97,_0x36b2e9){if(_0x417a97['body']['id']){delete _0x417a97[_0x2707('0x15')]['id'];}if(_0x417a97[_0x2707('0x14')]['id']){return pm2[_0x2707('0x24')](_0x417a97[_0x2707('0x14')]['id'])[_0x2707('0xe')](function(_0x341e14){pm2[_0x2707('0x1d')]();return _0x341e14[0x0];})[_0x2707('0xe')](respondWithResult(_0x36b2e9,null))[_0x2707('0x12')](handleError(_0x36b2e9,null));}else{return _0x36b2e9['status'](0x1f4)[_0x2707('0x9')]({'message':_0x2707('0x25')});}}; \ 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(_0x4f2e4b,_0x2d084c){var _0x3afdbb=function(_0x14b574){while(--_0x14b574){_0x4f2e4b['push'](_0x4f2e4b['shift']());}};_0x3afdbb(++_0x2d084c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0xcb91[_0x3ba924];return _0x4cc1df;};'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 d5ecc02..a4fc353 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 _0x3e9f=['/agents','getAgents','/queues','isAuthenticated','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get'];(function(_0x224d14,_0x2c6530){var _0x2e9f20=function(_0x46d03){while(--_0x46d03){_0x224d14['push'](_0x224d14['shift']());}};_0x2e9f20(++_0x2c6530);}(_0x3e9f,0x10e));var _0xf3e9=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x3e9f[_0x18ab2a];return _0x16dcee;};'use strict';var express=require(_0xf3e9('0x0'));var router=express[_0xf3e9('0x1')]();var auth=require(_0xf3e9('0x2'));var controller=require(_0xf3e9('0x3'));router[_0xf3e9('0x4')](_0xf3e9('0x5'),auth['isAuthenticated'](),controller[_0xf3e9('0x6')]);router[_0xf3e9('0x4')](_0xf3e9('0x7'),auth[_0xf3e9('0x8')](),controller[_0xf3e9('0x9')]);module[_0xf3e9('0xa')]=router; \ No newline at end of file +var _0x2bce=['../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues'];(function(_0x58263f,_0x67699c){var _0x57790c=function(_0x13ca60){while(--_0x13ca60){_0x58263f['push'](_0x58263f['shift']());}};_0x57790c(++_0x67699c);}(_0x2bce,0xe7));var _0xe2bc=function(_0x4ca215,_0x114c54){_0x4ca215=_0x4ca215-0x0;var _0x563b1e=_0x2bce[_0x4ca215];return _0x563b1e;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xe2bc('0x0'));var controller=require(_0xe2bc('0x1'));router[_0xe2bc('0x2')](_0xe2bc('0x3'),auth[_0xe2bc('0x4')](),controller[_0xe2bc('0x5')]);router[_0xe2bc('0x2')](_0xe2bc('0x6'),auth['isAuthenticated'](),controller['getQueues']);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index cca01ec..e63dcbf 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 _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0xbef475,_0x25ddda){var _0x32fe31=function(_0xdfd6d0){while(--_0xdfd6d0){_0xbef475['push'](_0xbef475['shift']());}};_0x32fe31(++_0x25ddda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file +var _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x1c3b6c,_0x2407ac){var _0x5463e5=function(_0x125cc1){while(--_0x125cc1){_0x1c3b6c['push'](_0x1c3b6c['shift']());}};_0x5463e5(++_0x2407ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 42b3a9b..b6ad4ac 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x59ca3e,_0x1f0ee3){var _0x2f51d9=function(_0x4d18f4){while(--_0x4d18f4){_0x59ca3e['push'](_0x59ca3e['shift']());}};_0x2f51d9(++_0x1f0ee3);}(_0xedd9,0xfc));var _0x9edd=function(_0x100ad5,_0x318101){_0x100ad5=_0x100ad5-0x0;var _0x4eba13=_0xedd9[_0x100ad5];return _0x4eba13;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5bc440,_0x2b6060){var _0x422868=function(_0x49ef94){while(--_0x49ef94){_0x5bc440['push'](_0x5bc440['shift']());}};_0x422868(++_0x2b6060);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index a60f067..27893d3 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 _0x5294=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x489700,_0x1ea4c8){var _0xd84800=function(_0x1ba723){while(--_0x1ba723){_0x489700['push'](_0x489700['shift']());}};_0xd84800(++_0x1ea4c8);}(_0x5294,0x111));var _0x4529=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x5294[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0x4529('0x0'));module[_0x4529('0x1')]={'state':{'type':Sequelize[_0x4529('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x4529('0x3')]},'scheduledat':{'type':Sequelize[_0x4529('0x4')]},'uniqueid':{'type':Sequelize[_0x4529('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x4529('0x4')]},'ringtime':{'type':Sequelize[_0x4529('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4529('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4529('0x3')]}}; \ No newline at end of file +var _0x2bd8=['sequelize','INTEGER','STRING','DATE'];(function(_0x163038,_0x541512){var _0x41b32a=function(_0x3cd40c){while(--_0x3cd40c){_0x163038['push'](_0x163038['shift']());}};_0x41b32a(++_0x541512);}(_0x2bd8,0x130));var _0x82bd=function(_0x1c2ecf,_0x49be0d){_0x1c2ecf=_0x1c2ecf-0x0;var _0x27d1f5=_0x2bd8[_0x1c2ecf];return _0x27d1f5;};'use strict';var Sequelize=require(_0x82bd('0x0'));module['exports']={'state':{'type':Sequelize[_0x82bd('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x82bd('0x2')]},'scheduledat':{'type':Sequelize[_0x82bd('0x3')]},'uniqueid':{'type':Sequelize[_0x82bd('0x2')]},'starttime':{'type':Sequelize[_0x82bd('0x3')]},'responsetime':{'type':Sequelize[_0x82bd('0x3')]},'ringtime':{'type':Sequelize[_0x82bd('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x82bd('0x2')]},'membername':{'type':Sequelize[_0x82bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a3fcfd4..94970d7 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 _0x48b9=['../../config/environment','define','report_agent_preview','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x48b9,0xdf));var _0x948b=function(_0x8cd627,_0x1bf5ca){_0x8cd627=_0x8cd627-0x0;var _0x7e454=_0x48b9[_0x8cd627];return _0x7e454;};'use strict';var _=require(_0x948b('0x0'));var util=require(_0x948b('0x1'));var logger=require(_0x948b('0x2'))('api');var moment=require(_0x948b('0x3'));var BPromise=require('bluebird');var rp=require(_0x948b('0x4'));var fs=require('fs');var path=require(_0x948b('0x5'));var rimraf=require(_0x948b('0x6'));var config=require(_0x948b('0x7'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x5cfa43,_0x2a44e2){return _0x5cfa43[_0x948b('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x948b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e76=['moment','bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','lodash','util','../../config/logger','api'];(function(_0x1ed8d7,_0x53ff1f){var _0xbcdfc5=function(_0x58d9a5){while(--_0x58d9a5){_0x1ed8d7['push'](_0x1ed8d7['shift']());}};_0xbcdfc5(++_0x53ff1f);}(_0x5e76,0x18f));var _0x65e7=function(_0x9b9126,_0x2e7407){_0x9b9126=_0x9b9126-0x0;var _0x2aa64c=_0x5e76[_0x9b9126];return _0x2aa64c;};'use strict';var _=require(_0x65e7('0x0'));var util=require(_0x65e7('0x1'));var logger=require(_0x65e7('0x2'))(_0x65e7('0x3'));var moment=require(_0x65e7('0x4'));var BPromise=require(_0x65e7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x65e7('0x6'));var rimraf=require(_0x65e7('0x7'));var config=require(_0x65e7('0x8'));var attributes=require(_0x65e7('0x9'));module[_0x65e7('0xa')]=function(_0x352001,_0x5e6277){return _0x352001[_0x65e7('0xb')](_0x65e7('0xc'),attributes,{'tableName':'report_agent_preview','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 62d4476..b6d5c7a 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 _0x1fe6=['CreateReportAgentPreview','create','body','options','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x2a3cb2,_0x55280a){var _0x4120af=function(_0x2f470c){while(--_0x2f470c){_0x2a3cb2['push'](_0x2a3cb2['shift']());}};_0x4120af(++_0x55280a);}(_0x1fe6,0x13a));var _0x61fe=function(_0x5d307d,_0x1a6278){_0x5d307d=_0x5d307d-0x0;var _0x289120=_0x1fe6[_0x5d307d];return _0x289120;};'use strict';var _=require(_0x61fe('0x0'));var util=require(_0x61fe('0x1'));var moment=require(_0x61fe('0x2'));var BPromise=require(_0x61fe('0x3'));var rs=require(_0x61fe('0x4'));var fs=require('fs');var Redis=require(_0x61fe('0x5'));var db=require(_0x61fe('0x6'))['db'];var utils=require(_0x61fe('0x7'));var logger=require('../../config/logger')(_0x61fe('0x8'));var config=require(_0x61fe('0x9'));var jayson=require(_0x61fe('0xa'));var client=jayson[_0x61fe('0xb')][_0x61fe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23e069,_0x11d716,_0x58832c){return new BPromise(function(_0x5b253e,_0x36bd36){return client['request'](_0x23e069,_0x58832c)[_0x61fe('0xd')](function(_0x42a0f1){logger[_0x61fe('0xe')](_0x61fe('0xf'),_0x11d716,_0x61fe('0x10'));logger['debug'](_0x61fe('0x11'),_0x11d716,_0x61fe('0x10'),JSON[_0x61fe('0x12')](_0x42a0f1));if(_0x42a0f1[_0x61fe('0x13')]){if(_0x42a0f1[_0x61fe('0x13')]['code']===0x1f4){logger[_0x61fe('0x13')](_0x61fe('0xf'),_0x11d716,_0x42a0f1[_0x61fe('0x13')][_0x61fe('0x14')]);return _0x36bd36(_0x42a0f1[_0x61fe('0x13')][_0x61fe('0x14')]);}logger[_0x61fe('0x13')](_0x61fe('0xf'),_0x11d716,_0x42a0f1[_0x61fe('0x13')][_0x61fe('0x14')]);return _0x5b253e(_0x42a0f1[_0x61fe('0x13')]['message']);}else{logger[_0x61fe('0xe')](_0x61fe('0xf'),_0x11d716,_0x61fe('0x10'));_0x5b253e(_0x42a0f1[_0x61fe('0x15')]['message']);}})['catch'](function(_0x3fca59){logger[_0x61fe('0x13')](_0x61fe('0xf'),_0x11d716,_0x3fca59);_0x36bd36(_0x3fca59);});});}exports[_0x61fe('0x16')]=function(_0x2b831b){var _0xdcc1c=this;return new Promise(function(_0xd3c15,_0x11321e){return db['ReportAgentPreview'][_0x61fe('0x17')](_0x2b831b[_0x61fe('0x18')],{'raw':_0x2b831b[_0x61fe('0x19')]?_0x2b831b[_0x61fe('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x61fe('0xd')](function(_0x5dec86){logger[_0x61fe('0xe')](_0x61fe('0x16'),_0x2b831b);logger[_0x61fe('0x1a')](_0x61fe('0x16'),_0x2b831b,JSON[_0x61fe('0x12')](_0x5dec86));_0xd3c15(_0x5dec86);})[_0x61fe('0x1b')](function(_0x2177d9){logger['error'](_0x61fe('0x16'),_0x2177d9['message'],_0x2b831b);_0x11321e(_0xdcc1c[_0x61fe('0x13')](0x1f4,_0x2177d9[_0x61fe('0x14')]));});});}; \ No newline at end of file +var _0x68e3=['../../config/environment','jayson/promise','client','http','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x3892e4,_0x38bb84){var _0x4b3020=function(_0x449a22){while(--_0x449a22){_0x3892e4['push'](_0x3892e4['shift']());}};_0x4b3020(++_0x38bb84);}(_0x68e3,0x111));var _0x368e=function(_0x2a5db8,_0x1f3188){_0x2a5db8=_0x2a5db8-0x0;var _0x5ce985=_0x68e3[_0x2a5db8];return _0x5ce985;};'use strict';var _=require(_0x368e('0x0'));var util=require(_0x368e('0x1'));var moment=require(_0x368e('0x2'));var BPromise=require('bluebird');var rs=require(_0x368e('0x3'));var fs=require('fs');var Redis=require(_0x368e('0x4'));var db=require(_0x368e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x368e('0x6'));var config=require(_0x368e('0x7'));var jayson=require(_0x368e('0x8'));var client=jayson[_0x368e('0x9')][_0x368e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6eb21a,_0x111b76,_0x2256bd){return new BPromise(function(_0x49bbcd,_0x24399f){return client['request'](_0x6eb21a,_0x2256bd)[_0x368e('0xb')](function(_0x309ca4){logger['info'](_0x368e('0xc'),_0x111b76,_0x368e('0xd'));logger[_0x368e('0xe')](_0x368e('0xf'),_0x111b76,_0x368e('0xd'),JSON[_0x368e('0x10')](_0x309ca4));if(_0x309ca4[_0x368e('0x11')]){if(_0x309ca4[_0x368e('0x11')][_0x368e('0x12')]===0x1f4){logger[_0x368e('0x11')](_0x368e('0xc'),_0x111b76,_0x309ca4[_0x368e('0x11')][_0x368e('0x13')]);return _0x24399f(_0x309ca4[_0x368e('0x11')][_0x368e('0x13')]);}logger[_0x368e('0x11')](_0x368e('0xc'),_0x111b76,_0x309ca4[_0x368e('0x11')][_0x368e('0x13')]);return _0x49bbcd(_0x309ca4[_0x368e('0x11')]['message']);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x111b76,'request\x20sent');_0x49bbcd(_0x309ca4['result'][_0x368e('0x13')]);}})['catch'](function(_0x4bea6a){logger[_0x368e('0x11')](_0x368e('0xc'),_0x111b76,_0x4bea6a);_0x24399f(_0x4bea6a);});});}exports[_0x368e('0x14')]=function(_0x35f615){var _0x2475d8=this;return new Promise(function(_0x44d5be,_0x3e1a71){return db[_0x368e('0x15')][_0x368e('0x16')](_0x35f615[_0x368e('0x17')],{'raw':_0x35f615['options']?_0x35f615[_0x368e('0x18')][_0x368e('0x19')]===undefined?!![]:![]:!![]})[_0x368e('0xb')](function(_0x37b1b0){logger[_0x368e('0x1a')]('CreateReportAgentPreview',_0x35f615);logger[_0x368e('0xe')](_0x368e('0x14'),_0x35f615,JSON['stringify'](_0x37b1b0));_0x44d5be(_0x37b1b0);})[_0x368e('0x1b')](function(_0x3e7822){logger[_0x368e('0x11')]('CreateReportAgentPreview',_0x3e7822[_0x368e('0x13')],_0x35f615);_0x3e1a71(_0x2475d8['error'](0x1f4,_0x3e7822[_0x368e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 4a2bc5b..20e7c19 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 _0x51ac=['voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues'];(function(_0x4e898d,_0x572320){var _0x10f33b=function(_0x4ad0c9){while(--_0x4ad0c9){_0x4e898d['push'](_0x4e898d['shift']());}};_0x10f33b(++_0x572320);}(_0x51ac,0x178));var _0xc51a=function(_0x2451f1,_0x4b9338){_0x2451f1=_0x2451f1-0x0;var _0x5e41c3=_0x51ac[_0x2451f1];return _0x5e41c3;};'use strict';var multer=require(_0xc51a('0x0'));var util=require(_0xc51a('0x1'));var path=require(_0xc51a('0x2'));var express=require(_0xc51a('0x3'));var router=express[_0xc51a('0x4')]();var auth=require(_0xc51a('0x5'));var controller=require(_0xc51a('0x6'));router[_0xc51a('0x7')]('/voice/channels',auth[_0xc51a('0x8')](),controller['voiceChannels']);router[_0xc51a('0x7')](_0xc51a('0x9'),auth[_0xc51a('0x8')](),controller[_0xc51a('0xa')]);router[_0xc51a('0x7')](_0xc51a('0xb'),auth[_0xc51a('0x8')](),controller[_0xc51a('0xc')]);router[_0xc51a('0x7')](_0xc51a('0xd'),auth[_0xc51a('0x8')](),controller['voiceQueues']);router[_0xc51a('0x7')]('/chat/queues',auth[_0xc51a('0x8')](),controller[_0xc51a('0xe')]);router[_0xc51a('0x7')](_0xc51a('0xf'),auth['isAuthenticated'](),controller[_0xc51a('0x10')]);router['get'](_0xc51a('0x11'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x12')]);router[_0xc51a('0x7')]('/openchannel/queues',auth[_0xc51a('0x8')](),controller['openchannelQueues']);router[_0xc51a('0x7')](_0xc51a('0x13'),auth[_0xc51a('0x8')](),controller['smsQueues']);router[_0xc51a('0x7')](_0xc51a('0x14'),auth['isAuthenticated'](),controller[_0xc51a('0x15')]);router['get'](_0xc51a('0x16'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x17')]);router[_0xc51a('0x7')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0xc51a('0x18')]);router[_0xc51a('0x7')](_0xc51a('0x19'),auth['isAuthenticated'](),controller[_0xc51a('0x1a')]);router[_0xc51a('0x7')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller['voiceQueuesChannel']);router['get'](_0xc51a('0x1b'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x1c')]);router[_0xc51a('0x7')](_0xc51a('0x1d'),auth[_0xc51a('0x8')](),controller['voiceQueuesChannelRedirect']);router[_0xc51a('0x7')](_0xc51a('0x1e'),auth['isAuthenticated'](),controller[_0xc51a('0x1f')]);router[_0xc51a('0x20')](_0xc51a('0x1e'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x21')]);router[_0xc51a('0x7')](_0xc51a('0x22'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x23')]);router[_0xc51a('0x7')]('/outbound/channels',auth['isAuthenticated'](),controller[_0xc51a('0x24')]);router[_0xc51a('0x7')](_0xc51a('0x25'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x26')]);router[_0xc51a('0x20')](_0xc51a('0x27'),auth[_0xc51a('0x8')](),controller['agentCapacity']);router['get'](_0xc51a('0x28'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x29')]);router['get'](_0xc51a('0x2a'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x2b')]);router[_0xc51a('0x7')]('/campaigns',auth[_0xc51a('0x8')](),controller[_0xc51a('0x2c')]);router[_0xc51a('0x7')](_0xc51a('0x2d'),auth['isAuthenticated'](),controller[_0xc51a('0x2e')]);router[_0xc51a('0x7')](_0xc51a('0x2f'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x30')]);router[_0xc51a('0x7')]('/mail/queues/waitinginteractions',auth[_0xc51a('0x8')](),controller[_0xc51a('0x31')]);router[_0xc51a('0x7')]('/openchannel/queues/waitinginteractions',auth[_0xc51a('0x8')](),controller[_0xc51a('0x32')]);router[_0xc51a('0x7')](_0xc51a('0x33'),auth[_0xc51a('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xc51a('0x7')]('/sms/queues/waitinginteractions',auth[_0xc51a('0x8')](),controller[_0xc51a('0x34')]);router[_0xc51a('0x7')](_0xc51a('0x35'),auth[_0xc51a('0x8')](),controller['whatsappQueuesWaitingInteractions']);router[_0xc51a('0x7')](_0xc51a('0x36'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x37')]);router[_0xc51a('0x38')](_0xc51a('0x39'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x3a')](_0xc51a('0x3b')));router['get'](_0xc51a('0x3c'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x3d')]);router['post'](_0xc51a('0x3e'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x3a')](_0xc51a('0x3f')));router[_0xc51a('0x7')](_0xc51a('0x40'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x41')]);router[_0xc51a('0x38')](_0xc51a('0x42'),auth['isAuthenticated'](),controller[_0xc51a('0x3a')](_0xc51a('0x43')));router[_0xc51a('0x7')]('/fax/queues/:id',auth[_0xc51a('0x8')](),controller['showFaxQueues']);router[_0xc51a('0x38')](_0xc51a('0x44'),auth[_0xc51a('0x8')](),controller['queueNotify'](_0xc51a('0x45')));router[_0xc51a('0x7')](_0xc51a('0x46'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x47')]);router['post'](_0xc51a('0x48'),auth[_0xc51a('0x8')](),controller['queueNotify'](_0xc51a('0x49')));router[_0xc51a('0x38')](_0xc51a('0x4a'),auth[_0xc51a('0x8')](),controller[_0xc51a('0x3a')]('whatsapp'));router[_0xc51a('0x7')](_0xc51a('0x4b'),auth[_0xc51a('0x8')](),controller['showSmsQueues']);router[_0xc51a('0x7')](_0xc51a('0x4c'),auth['isAuthenticated'](),controller[_0xc51a('0x4d')]);router[_0xc51a('0x38')](_0xc51a('0x4e'),auth[_0xc51a('0x8')](),controller['agentNotify']);module[_0xc51a('0x4f')]=router; \ No newline at end of file +var _0x0ae7=['/telephones','/trunks','campaigns','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','post','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','get','/chat/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','/agents/:id/capacity','agentCapacity'];(function(_0x466608,_0x21f975){var _0x1968e9=function(_0x1c27c9){while(--_0x1c27c9){_0x466608['push'](_0x466608['shift']());}};_0x1968e9(++_0x21f975);}(_0x0ae7,0xae));var _0x70ae=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x0ae7[_0x4ae625];return _0x31accf;};'use strict';var multer=require('multer');var util=require(_0x70ae('0x0'));var path=require(_0x70ae('0x1'));var express=require(_0x70ae('0x2'));var router=express[_0x70ae('0x3')]();var auth=require(_0x70ae('0x4'));var controller=require(_0x70ae('0x5'));router['get'](_0x70ae('0x6'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x8')]);router['get'](_0x70ae('0x9'),auth[_0x70ae('0x7')](),controller[_0x70ae('0xa')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x70ae('0xb')]);router[_0x70ae('0xc')]('/voice/queues',auth[_0x70ae('0x7')](),controller['voiceQueues']);router[_0x70ae('0xc')](_0x70ae('0xd'),auth['isAuthenticated'](),controller['chatQueues']);router['get']('/mail/queues',auth['isAuthenticated'](),controller[_0x70ae('0xe')]);router['get'](_0x70ae('0xf'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x10')]);router[_0x70ae('0xc')]('/openchannel/queues',auth[_0x70ae('0x7')](),controller[_0x70ae('0x11')]);router[_0x70ae('0xc')](_0x70ae('0x12'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x13')]);router[_0x70ae('0xc')](_0x70ae('0x14'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x15')]);router[_0x70ae('0xc')](_0x70ae('0x16'),auth[_0x70ae('0x7')](),controller['faxQueues']);router[_0x70ae('0xc')](_0x70ae('0x17'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x18')]);router['get'](_0x70ae('0x19'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x1a')]);router[_0x70ae('0xc')]('/voice/queues/channels/:uniqueid',auth[_0x70ae('0x7')](),controller['voiceQueuesChannel']);router[_0x70ae('0xc')](_0x70ae('0x1b'),auth[_0x70ae('0x7')](),controller['voiceQueuesChannelHangup']);router[_0x70ae('0xc')](_0x70ae('0x1c'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x1d')]);router[_0x70ae('0xc')](_0x70ae('0x1e'),auth[_0x70ae('0x7')](),controller['showVoiceQueues']);router[_0x70ae('0x1f')](_0x70ae('0x1e'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x20')]);router[_0x70ae('0xc')](_0x70ae('0x21'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x22')]);router[_0x70ae('0xc')]('/outbound/channels',auth[_0x70ae('0x7')](),controller[_0x70ae('0x23')]);router[_0x70ae('0xc')](_0x70ae('0x24'),auth['isAuthenticated'](),controller['agents']);router['put'](_0x70ae('0x25'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x26')]);router[_0x70ae('0xc')](_0x70ae('0x27'),auth[_0x70ae('0x7')](),controller['telephones']);router[_0x70ae('0xc')](_0x70ae('0x28'),auth[_0x70ae('0x7')](),controller['trunks']);router[_0x70ae('0xc')]('/campaigns',auth['isAuthenticated'](),controller[_0x70ae('0x29')]);router[_0x70ae('0xc')]('/fax/accounts',auth[_0x70ae('0x7')](),controller['faxAccounts']);router[_0x70ae('0xc')]('/chat/queues/waitinginteractions',auth[_0x70ae('0x7')](),controller[_0x70ae('0x2a')]);router['get'](_0x70ae('0x2b'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x2c')]);router[_0x70ae('0xc')](_0x70ae('0x2d'),auth['isAuthenticated'](),controller[_0x70ae('0x2e')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x70ae('0x7')](),controller[_0x70ae('0x2f')]);router[_0x70ae('0xc')]('/sms/queues/waitinginteractions',auth[_0x70ae('0x7')](),controller[_0x70ae('0x30')]);router[_0x70ae('0xc')](_0x70ae('0x31'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x32')]);router[_0x70ae('0xc')]('/fax/queues/waitinginteractions',auth[_0x70ae('0x7')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x70ae('0x33'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x34')](_0x70ae('0x35')));router[_0x70ae('0xc')]('/mail/queues/:id',auth[_0x70ae('0x7')](),controller[_0x70ae('0x36')]);router[_0x70ae('0x37')](_0x70ae('0x38'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x34')]('chat'));router[_0x70ae('0xc')](_0x70ae('0x39'),auth['isAuthenticated'](),controller[_0x70ae('0x3a')]);router[_0x70ae('0x37')](_0x70ae('0x3b'),auth['isAuthenticated'](),controller[_0x70ae('0x34')]('fax'));router[_0x70ae('0xc')](_0x70ae('0x3c'),auth['isAuthenticated'](),controller[_0x70ae('0x3d')]);router[_0x70ae('0x37')]('/openchannel/queues/:id/notify',auth[_0x70ae('0x7')](),controller[_0x70ae('0x34')]('openchannel'));router[_0x70ae('0xc')]('/openchannel/queues/:id',auth[_0x70ae('0x7')](),controller['showOpenchannelQueues']);router['post'](_0x70ae('0x3e'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x34')](_0x70ae('0x3f')));router['post'](_0x70ae('0x40'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x34')](_0x70ae('0x41')));router[_0x70ae('0xc')]('/sms/queues/:id',auth[_0x70ae('0x7')](),controller[_0x70ae('0x42')]);router['get']('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x70ae('0x43')]);router[_0x70ae('0x37')](_0x70ae('0x44'),auth[_0x70ae('0x7')](),controller[_0x70ae('0x45')]);module[_0x70ae('0x46')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 53a3cbf..afda156 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 _0xe379=['rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','interaction','user','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','format','SIP/%s','agent','AgentCapacity','capacity','Telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','indexOf','queue_id','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','Website','User','Agent\x20not\x20found','MessageId','agentTransferTimeout','bluebird','util','../../config/logger','api','jayson/promise','http','client','request','error','message','catch','status','json','sendStatus','stack','name','send','isNil'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe379,0x1d2));var _0x9e37=function(_0x153735,_0x4dc202){_0x153735=_0x153735-0x0;var _0x5d1c88=_0xe379[_0x153735];return _0x5d1c88;};'use strict';var BPromise=require(_0x9e37('0x0'));var moment=require('moment');var _=require('lodash');var util=require(_0x9e37('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x9e37('0x2'))(_0x9e37('0x3'));var jayson=require(_0x9e37('0x4'));var amiClient=jayson['client'][_0x9e37('0x5')]({'port':0x232a});var mailClient=jayson[_0x9e37('0x6')]['http']({'port':0x232b});var routingClient=jayson['client'][_0x9e37('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x2833e8,_0xd607f9,_0xf6e7ed){return new BPromise(function(_0x3ad510,_0x26e116){var _0x7fb83a=_0xf6e7ed?_0xf6e7ed:amiClient;return _0x7fb83a[_0x9e37('0x7')](_0x2833e8,_0xd607f9)['then'](function(_0x198c7a){if(_0x198c7a[_0x9e37('0x8')]){if(_0x198c7a[_0x9e37('0x8')]['code']===0x1f4){return _0x26e116(_0x198c7a[_0x9e37('0x8')][_0x9e37('0x9')]);}return _0x3ad510(_0x198c7a['error'][_0x9e37('0x9')]);}else{_0x3ad510(_0x198c7a['result']);}})[_0x9e37('0xa')](function(_0x430346){_0x26e116(_0x430346);});});}function respondWithResult(_0x1813d4,_0xbb41c){_0xbb41c=_0xbb41c||0xc8;return function(_0x131648){if(_0x131648){return _0x1813d4[_0x9e37('0xb')](_0xbb41c)[_0x9e37('0xc')](_0x131648);}return _0x1813d4[_0x9e37('0xd')](0x194);};}function handleError(_0x27a34e,_0x42bea0){_0x42bea0=_0x42bea0||0x1f4;return function(_0x4dceaa){logger['error'](_0x4dceaa[_0x9e37('0xe')]);if(_0x4dceaa['name']){delete _0x4dceaa[_0x9e37('0xf')];}_0x27a34e[_0x9e37('0xb')](_0x42bea0)[_0x9e37('0x10')](_0x4dceaa);};}function findById(_0x2083d3){return function(_0x4062a9){if(!_[_0x9e37('0x11')](_0x2083d3)&&!_[_0x9e37('0x11')](_0x4062a9)&&!_[_0x9e37('0x11')](_0x4062a9[_0x9e37('0x12')])){return _[_0x9e37('0x13')](_0x4062a9[_0x9e37('0x12')],function(_0x1b8810){return _0x1b8810['id']==_0x2083d3;});}return null;};}exports[_0x9e37('0x14')]=function(_0x5307f3,_0x79f782){return respondWithRpcPromise(_0x9e37('0x15'),_0x5307f3[_0x9e37('0x16')])[_0x9e37('0x17')](respondWithResult(_0x79f782,null))[_0x9e37('0xa')](handleError(_0x79f782,null));};exports[_0x9e37('0x18')]=function(_0x488ad6,_0x3110f3){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x9e37('0x19')](_0x488ad6[_0x9e37('0x16')],_0x488ad6['params']))['then'](respondWithResult(_0x3110f3,null))[_0x9e37('0xa')](handleError(_0x3110f3,null));};exports[_0x9e37('0x1a')]=function(_0x153af0,_0x3950ce){return respondWithRpcPromise(_0x9e37('0x1b'),_[_0x9e37('0x19')](_0x153af0['query'],_0x153af0[_0x9e37('0x1c')]))['then'](respondWithResult(_0x3950ce,null))[_0x9e37('0xa')](handleError(_0x3950ce,null));};exports[_0x9e37('0x1d')]=function(_0x143883,_0x238b74){return respondWithRpcPromise(_0x9e37('0x1e'),_0x143883[_0x9e37('0x16')])[_0x9e37('0x17')](respondWithResult(_0x238b74,null))[_0x9e37('0xa')](handleError(_0x238b74,null));};exports['showVoiceQueues']=function(_0x33e106,_0x2e0a3e){return respondWithRpcPromise(_0x9e37('0x1e'),_0x33e106[_0x9e37('0x16')])[_0x9e37('0x17')](findById(_0x33e106['params']['id']))[_0x9e37('0x17')](respondWithResult(_0x2e0a3e,null))[_0x9e37('0xa')](handleError(_0x2e0a3e,null));};exports[_0x9e37('0x1f')]=function(_0x144f0c,_0x19fa0d){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x9e37('0x19')](_0x144f0c[_0x9e37('0x20')],_0x144f0c[_0x9e37('0x1c')]))[_0x9e37('0x17')](respondWithResult(_0x19fa0d,null))['catch'](handleError(_0x19fa0d,null));};exports[_0x9e37('0x21')]=function(_0x42ae50,_0x300814){return respondWithRpcPromise(_0x9e37('0x22'),_[_0x9e37('0x19')](_0x42ae50[_0x9e37('0x16')],_0x42ae50['params']))['then'](respondWithResult(_0x300814,null))['catch'](handleError(_0x300814,null));};exports['voiceQueuesChannels']=function(_0x1faefb,_0x5f4b84){return respondWithRpcPromise(_0x9e37('0x23'),_0x1faefb[_0x9e37('0x16')])[_0x9e37('0x17')](respondWithResult(_0x5f4b84,null))[_0x9e37('0xa')](handleError(_0x5f4b84,null));};exports['voiceQueuesChannel']=function(_0x4015b6,_0x55e965){return respondWithRpcPromise(_0x9e37('0x24'),_[_0x9e37('0x19')](_0x4015b6[_0x9e37('0x16')],_0x4015b6['params']))[_0x9e37('0x17')](respondWithResult(_0x55e965,null))[_0x9e37('0xa')](handleError(_0x55e965,null));};exports[_0x9e37('0x25')]=function(_0x23d764,_0x3605dc){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x9e37('0x19')](_0x23d764[_0x9e37('0x16')],_0x23d764[_0x9e37('0x1c')]))[_0x9e37('0x17')](respondWithResult(_0x3605dc,null))[_0x9e37('0xa')](handleError(_0x3605dc,null));};exports[_0x9e37('0x26')]=function(_0xd7608,_0x577d70){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x9e37('0x19')](_0xd7608[_0x9e37('0x16')],_0xd7608[_0x9e37('0x1c')]))[_0x9e37('0x17')](respondWithResult(_0x577d70,null))[_0x9e37('0xa')](handleError(_0x577d70,null));};exports[_0x9e37('0x27')]=function(_0x161a86,_0x1d59c3){return respondWithRpcPromise(_0x9e37('0x28'),_0x161a86['query'])['then'](respondWithResult(_0x1d59c3,null))['catch'](handleError(_0x1d59c3,null));};exports['outboundChannels']=function(_0x5a26ce,_0x41ce05){return respondWithRpcPromise(_0x9e37('0x29'),_0x5a26ce[_0x9e37('0x16')])[_0x9e37('0x17')](respondWithResult(_0x41ce05,null))[_0x9e37('0xa')](handleError(_0x41ce05,null));};exports[_0x9e37('0x2a')]=function(_0x19a9e2,_0xf4a7e4){var _0x21aab0;return respondWithRpcPromise('Agents',_0x19a9e2[_0x9e37('0x16')])[_0x9e37('0x17')](function(_0xce340f){_0x21aab0=_0xce340f;return respondWithRpcPromise(_0x9e37('0x2b'),_0x19a9e2[_0x9e37('0x16')],routingClient);})[_0x9e37('0x17')](function(_0x5170f2){return _[_0x9e37('0x19')]({},_0x5170f2,_0x21aab0);})[_0x9e37('0x17')](respondWithResult(_0xf4a7e4,null))[_0x9e37('0xa')](handleError(_0xf4a7e4,null));};exports[_0x9e37('0x2c')]=function(_0x1de147,_0x12bfa7){if(_0x1de147[_0x9e37('0x20')]&&_0x1de147[_0x9e37('0x20')][_0x9e37('0x2d')]&&_0x1de147['user']&&_0x1de147[_0x9e37('0x2e')][_0x9e37('0xf')]){for(var _0x5c0063 in _0x1de147['body']['interaction']){if(_0x1de147[_0x9e37('0x20')][_0x9e37('0x2d')]['hasOwnProperty'](_0x5c0063)){db[_0x9e37('0x2f')][_0x9e37('0x30')]({'where':{'channel':_0x5c0063,'membername':_0x1de147['user'][_0x9e37('0xf')],'type':_0x9e37('0x31'),'exitAt':null,'uniqueid':_0x1de147[_0x9e37('0x20')][_0x9e37('0x2d')][_0x5c0063]&&_0x1de147['body'][_0x9e37('0x2d')][_0x5c0063][_0x9e37('0x32')]?{'$notIn':_0x1de147[_0x9e37('0x20')][_0x9e37('0x2d')][_0x5c0063]}:{'$ne':null}}})[_0x9e37('0x17')](function(_0x4ca514){var _0x4a3604=moment()['format'](_0x9e37('0x33'));for(var _0xa11f5d=0x0,_0x435911=_0x4ca514[_0x9e37('0x32')];_0xa11f5d<_0x435911;_0xa11f5d+=0x1){_0x4ca514[_0xa11f5d][_0x9e37('0x34')]({'exitAt':_0x4a3604});}});for(var _0x2ad4c9=0x0;_0x2ad4c9<_0x1de147[_0x9e37('0x20')][_0x9e37('0x2d')][_0x5c0063][_0x9e37('0x32')];_0x2ad4c9+=0x1){db['MemberReport'][_0x9e37('0x35')]({'where':{'channel':_0x5c0063,'membername':_0x1de147['user'][_0x9e37('0xf')],'type':'INTERACTION','uniqueid':_0x1de147[_0x9e37('0x20')][_0x9e37('0x2d')][_0x5c0063][_0x2ad4c9],'exitAt':null},'defaults':{'channel':_0x5c0063,'membername':_0x1de147['user'][_0x9e37('0xf')],'interface':_['isNil'](_0x1de147['user'][_0x9e37('0x36')])?util[_0x9e37('0x37')](_0x9e37('0x38'),_0x1de147[_0x9e37('0x2e')][_0x9e37('0xf')]):_0x1de147[_0x9e37('0x2e')]['interface'],'type':'INTERACTION','enterAt':moment()[_0x9e37('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x9e37('0x39'),'internal':_0x1de147['user']['internal'],'uniqueid':_0x1de147[_0x9e37('0x20')]['interaction'][_0x5c0063][_0x2ad4c9]}});}}}}return respondWithRpcPromise(_0x9e37('0x3a'),{'id':_0x1de147['params']['id'],'capacity':_0x1de147[_0x9e37('0x20')][_0x9e37('0x3b')]},routingClient)['then'](respondWithResult(_0x12bfa7,null))[_0x9e37('0xa')](handleError(_0x12bfa7,null));};exports['telephones']=function(_0x5ecadd,_0x1af927){return respondWithRpcPromise(_0x9e37('0x3c'),_0x5ecadd[_0x9e37('0x16')])[_0x9e37('0x17')](respondWithResult(_0x1af927,null))['catch'](handleError(_0x1af927,null));};exports['trunks']=function(_0x26c9e8,_0x5ac656){return respondWithRpcPromise(_0x9e37('0x3d'),_0x26c9e8[_0x9e37('0x16')])[_0x9e37('0x17')](respondWithResult(_0x5ac656,null))['catch'](handleError(_0x5ac656,null));};exports[_0x9e37('0x3e')]=function(_0x5e6c47,_0x3f28c3){return respondWithRpcPromise(_0x9e37('0x3f'),_0x5e6c47[_0x9e37('0x16')])['then'](respondWithResult(_0x3f28c3,null))[_0x9e37('0xa')](handleError(_0x3f28c3,null));};exports[_0x9e37('0x40')]=function(_0x417204,_0x3f3ba6){return respondWithRpcPromise(_0x9e37('0x41'),_0x417204[_0x9e37('0x16')],routingClient)[_0x9e37('0x17')](respondWithResult(_0x3f3ba6,null))[_0x9e37('0xa')](handleError(_0x3f3ba6,null));};exports[_0x9e37('0x42')]=function(_0x1cf57f,_0xbbddfa){return respondWithRpcPromise('ChatQueues',_0x1cf57f['query'],routingClient)[_0x9e37('0x17')](findById(_0x1cf57f[_0x9e37('0x1c')]['id']))[_0x9e37('0x17')](respondWithResult(_0xbbddfa,null))[_0x9e37('0xa')](handleError(_0xbbddfa,null));};exports[_0x9e37('0x43')]=function(_0x734d12,_0x598812){return respondWithRpcPromise(_0x9e37('0x44'),_0x734d12[_0x9e37('0x16')],routingClient)[_0x9e37('0x17')](respondWithResult(_0x598812,null))[_0x9e37('0xa')](handleError(_0x598812,null));};exports['showMailQueues']=function(_0x5c1956,_0x13fb52){return respondWithRpcPromise('MailQueues',_0x5c1956[_0x9e37('0x16')],routingClient)[_0x9e37('0x17')](findById(_0x5c1956[_0x9e37('0x1c')]['id']))[_0x9e37('0x17')](respondWithResult(_0x13fb52,null))['catch'](handleError(_0x13fb52,null));};exports[_0x9e37('0x45')]=function(_0x484efc,_0x3494d8){return respondWithRpcPromise('MailAccounts',_0x484efc[_0x9e37('0x16')],mailClient)[_0x9e37('0x17')](respondWithResult(_0x3494d8,null))[_0x9e37('0xa')](handleError(_0x3494d8,null));};exports['openchannelQueues']=function(_0x27ca1d,_0x48db75){return respondWithRpcPromise(_0x9e37('0x46'),_0x27ca1d['query'],routingClient)[_0x9e37('0x17')](respondWithResult(_0x48db75,null))[_0x9e37('0xa')](handleError(_0x48db75,null));};exports[_0x9e37('0x47')]=function(_0x3aa6a0,_0x14f7e6){return respondWithRpcPromise(_0x9e37('0x46'),_0x3aa6a0['query'],routingClient)[_0x9e37('0x17')](findById(_0x3aa6a0['params']['id']))['then'](respondWithResult(_0x14f7e6,null))[_0x9e37('0xa')](handleError(_0x14f7e6,null));};exports[_0x9e37('0x48')]=function(_0x97153b,_0x56380f){return respondWithRpcPromise(_0x9e37('0x49'),_0x97153b[_0x9e37('0x16')],routingClient)[_0x9e37('0x17')](respondWithResult(_0x56380f,null))[_0x9e37('0xa')](handleError(_0x56380f,null));};exports[_0x9e37('0x4a')]=function(_0x36a2be,_0x5bf5bd){return respondWithRpcPromise('SmsQueues',_0x36a2be[_0x9e37('0x16')],routingClient)[_0x9e37('0x17')](findById(_0x36a2be[_0x9e37('0x1c')]['id']))[_0x9e37('0x17')](respondWithResult(_0x5bf5bd,null))[_0x9e37('0xa')](handleError(_0x5bf5bd,null));};exports['whatsappQueues']=function(_0xad24c6,_0x35932e){return respondWithRpcPromise(_0x9e37('0x4b'),_0xad24c6[_0x9e37('0x16')],routingClient)[_0x9e37('0x17')](respondWithResult(_0x35932e,null))[_0x9e37('0xa')](handleError(_0x35932e,null));};exports[_0x9e37('0x4c')]=function(_0x5af13a,_0x3d4227){return respondWithRpcPromise(_0x9e37('0x4b'),_0x5af13a[_0x9e37('0x16')],routingClient)[_0x9e37('0x17')](findById(_0x5af13a[_0x9e37('0x1c')]['id']))[_0x9e37('0x17')](respondWithResult(_0x3d4227,null))[_0x9e37('0xa')](handleError(_0x3d4227,null));};exports[_0x9e37('0x4d')]=function(_0x50be23,_0x2af5c5){return respondWithRpcPromise(_0x9e37('0x4e'),_0x50be23[_0x9e37('0x16')],routingClient)[_0x9e37('0x17')](respondWithResult(_0x2af5c5,null))[_0x9e37('0xa')](handleError(_0x2af5c5,null));};exports[_0x9e37('0x4f')]=function(_0x814c27,_0x3ef09e){return respondWithRpcPromise(_0x9e37('0x4e'),_0x814c27[_0x9e37('0x16')],routingClient)[_0x9e37('0x17')](findById(_0x814c27[_0x9e37('0x1c')]['id']))[_0x9e37('0x17')](respondWithResult(_0x3ef09e,null))[_0x9e37('0xa')](handleError(_0x3ef09e,null));};exports[_0x9e37('0x50')]=function(_0x32d2c4,_0x154c4b){return respondWithRpcPromise('FaxAccounts',_0x32d2c4[_0x9e37('0x16')])[_0x9e37('0x17')](respondWithResult(_0x154c4b,null))[_0x9e37('0xa')](handleError(_0x154c4b,null));};exports[_0x9e37('0x51')]=function(_0x5a64e8,_0x349942){return respondWithRpcPromise(_0x9e37('0x52'),_0x5a64e8[_0x9e37('0x16')],routingClient)['then'](respondWithResult(_0x349942,null))[_0x9e37('0xa')](handleError(_0x349942,null));};exports['mailQueuesWaitingInteractions']=function(_0x56842b,_0x266597){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x56842b[_0x9e37('0x16')],routingClient)[_0x9e37('0x17')](respondWithResult(_0x266597,null))[_0x9e37('0xa')](handleError(_0x266597,null));};exports[_0x9e37('0x53')]=function(_0x17e16a,_0x502f01){return respondWithRpcPromise(_0x9e37('0x54'),_0x17e16a[_0x9e37('0x16')],routingClient)[_0x9e37('0x17')](respondWithResult(_0x502f01,null))['catch'](handleError(_0x502f01,null));};exports[_0x9e37('0x55')]=function(_0x2425be,_0x457e54){return respondWithRpcPromise(_0x9e37('0x54'),_0x2425be[_0x9e37('0x16')],routingClient)[_0x9e37('0x17')](function(_0x5041af){if(_0x2425be[_0x9e37('0x16')]['type']!==undefined){var _0x8cb5ce=_(_0x5041af[_0x9e37('0x12')])['filter']([_0x2425be['query']['type'],_0x2425be['params']['id']])['map']('queue_id')['uniq']()['value']();return _0x5041af[_0x9e37('0x12')][_0x9e37('0x56')](function(_0x11822d){return _0x8cb5ce[_0x9e37('0x57')](_0x11822d[_0x9e37('0x58')])>-0x1;});}else{return _0x5041af['rows']['filter'](function(_0x116ba9){return _0x116ba9['queue_id']===parseInt(_0x2425be[_0x9e37('0x1c')]['id']);});}})[_0x9e37('0x17')](respondWithResult(_0x457e54,null))[_0x9e37('0xa')](handleError(_0x457e54,null));};exports['smsQueuesWaitingInteractions']=function(_0x423743,_0x443d7b){return respondWithRpcPromise(_0x9e37('0x59'),_0x423743[_0x9e37('0x16')],routingClient)[_0x9e37('0x17')](respondWithResult(_0x443d7b,null))['catch'](handleError(_0x443d7b,null));};exports[_0x9e37('0x5a')]=function(_0x4ef53b,_0x270481){return respondWithRpcPromise(_0x9e37('0x5b'),_0x4ef53b[_0x9e37('0x16')],routingClient)[_0x9e37('0x17')](respondWithResult(_0x270481,null))[_0x9e37('0xa')](handleError(_0x270481,null));};exports[_0x9e37('0x5c')]=function(_0xcefe2b,_0x1ba94f){return respondWithRpcPromise(_0x9e37('0x5d'),_0xcefe2b[_0x9e37('0x16')],routingClient)['then'](respondWithResult(_0x1ba94f,null))[_0x9e37('0xa')](handleError(_0x1ba94f,null));};exports[_0x9e37('0x5e')]=function(_0x1f291a){return function(_0x3a0275,_0xdb5df5){var _0x4a13f2,_0x106c16;var _0x480f35=_[_0x9e37('0x5f')](_0x1f291a);var _0x3dad10=_0x1f291a===_0x9e37('0x60')?'Website':_0x9e37('0x61');return db[_0x480f35+_0x9e37('0x62')][_0x9e37('0x63')]({'raw':!![],'where':{'id':_0x3a0275[_0x9e37('0x1c')]['id']}})[_0x9e37('0x17')](function(_0x79270){if(_[_0x9e37('0x11')](_0x79270)){throw new Error(_0x480f35+'\x20Queue\x20not\x20found');}_0x4a13f2=_0x79270;return db[_0x480f35+_0x9e37('0x64')]['findOne']({'where':{'id':_0x3a0275[_0x9e37('0x20')][_0x9e37('0x65')]},'include':[{'model':db[_0x480f35+_0x9e37('0x66')],'as':_0x9e37('0x66')},{'model':db[_0x480f35+_0x3dad10],'as':'Account'}]});})[_0x9e37('0x17')](function(_0x3ae640){if(_[_0x9e37('0x11')](_0x3ae640)){throw new Error(_0x480f35+_0x9e37('0x67'));}_0x106c16=_0x3ae640;return _0x3ae640[_0x9e37('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x9e37('0x17')](function(){var _0x1bee2a={'uniqueid':_0x1f291a+'.'+_0x106c16['id']+'.'+_0x106c16['Interaction']['id'],'FromUserId':_0x3a0275[_0x9e37('0x2e')]['id'],'type':_0x9e37('0x69')};_0x1bee2a[_0x480f35+'MessageId']=_0x106c16['id'];_0x1bee2a[_0x480f35+'InteractionId']=_0x106c16[_0x9e37('0x66')]['id'];_0x1bee2a[_0x9e37('0x6a')+_0x480f35+_0x3dad10+'Id']=_0x106c16[_0x9e37('0x61')]['id'];_0x1bee2a['To'+_0x480f35+_0x9e37('0x6b')]=_0x4a13f2['id'];return db[_0x480f35+_0x9e37('0x6c')][_0x9e37('0x6d')](_0x1bee2a);})['then'](function(){return respondWithRpcPromise(_0x9e37('0x6e'),{'channel':_0x1f291a,'interaction':_0x106c16[_0x9e37('0x66')],'message':_0x106c16,'account':_0x106c16[_0x9e37('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4a13f2[_0x9e37('0xf')]+','+(_0x106c16[_0x9e37('0x61')][_0x9e37('0x6f')]||0x12c),'interval':_0x9e37('0x70')}]},routingClient);})['then'](respondWithResult(_0xdb5df5,null))[_0x9e37('0xa')](handleError(_0xdb5df5,null));};};exports[_0x9e37('0x71')]=function(_0x2c8706,_0x22ee2b){var _0x5a48b4,_0x46ad29;if(_['isNil'](_0x2c8706['body']['channel'])){throw new Error(_0x9e37('0x72'));}var _0x1b8d89=_0x2c8706[_0x9e37('0x20')][_0x9e37('0x73')];var _0x97c9df=_[_0x9e37('0x5f')](_0x1b8d89);var _0x31ec21=_0x1b8d89===_0x9e37('0x60')?_0x9e37('0x74'):_0x9e37('0x61');return db[_0x9e37('0x75')]['findOne']({'raw':!![],'where':{'id':_0x2c8706['params']['id'],'role':_0x9e37('0x39')}})[_0x9e37('0x17')](function(_0x633783){if(_[_0x9e37('0x11')](_0x633783)){throw new Error(_0x9e37('0x76'));}_0x5a48b4=_0x633783;return db[_0x97c9df+_0x9e37('0x64')][_0x9e37('0x63')]({'where':{'id':_0x2c8706[_0x9e37('0x20')][_0x9e37('0x65')]},'include':[{'model':db[_0x97c9df+_0x9e37('0x66')],'as':_0x9e37('0x66')},{'model':db[_0x97c9df+_0x31ec21],'as':'Account'}]});})[_0x9e37('0x17')](function(_0x5c49d8){if(_[_0x9e37('0x11')](_0x5c49d8)){throw new Error(_0x97c9df+'\x20Message\x20not\x20found');}_0x46ad29=_0x5c49d8;return _0x5c49d8[_0x9e37('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x9e37('0x17')](function(){var _0x59a0f5={'uniqueid':_0x1b8d89+'.'+_0x46ad29['id']+'.'+_0x46ad29[_0x9e37('0x66')]['id'],'FromUserId':_0x2c8706[_0x9e37('0x2e')]['id'],'type':'agent','ToUserId':_0x5a48b4['id']};_0x59a0f5[_0x97c9df+_0x9e37('0x77')]=_0x46ad29['id'];_0x59a0f5[_0x97c9df+'InteractionId']=_0x46ad29[_0x9e37('0x66')]['id'];_0x59a0f5[_0x9e37('0x6a')+_0x97c9df+_0x31ec21+'Id']=_0x46ad29[_0x9e37('0x61')]['id'];return db[_0x97c9df+'TransferReport'][_0x9e37('0x6d')](_0x59a0f5);})[_0x9e37('0x17')](function(){return respondWithRpcPromise('Start',{'channel':_0x1b8d89,'interaction':_0x46ad29[_0x9e37('0x66')],'message':_0x46ad29,'account':_0x46ad29[_0x9e37('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':_0x9e37('0x39'),'appdata':_0x5a48b4[_0x9e37('0xf')]+','+(_0x46ad29[_0x9e37('0x61')][_0x9e37('0x78')]||0x12c),'interval':_0x9e37('0x70')}]},routingClient);})[_0x9e37('0x17')](respondWithResult(_0x22ee2b,null))[_0x9e37('0xa')](handleError(_0x22ee2b,null));}; \ No newline at end of file +var _0xbe83=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','value','indexOf','queue_id','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','QueueId','TransferReport','Start','agentNotify','channel','capitalize','User','update','create','agentTransferTimeout','*,*,*,*','moment','util','../../mysqldb','jayson/promise','client','http','request','then','error','code','message','result','catch','status','stack','name','isNil','rows','find','voiceChannels','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions'];(function(_0x430285,_0x4c8e7c){var _0x3e9815=function(_0x4ec7c6){while(--_0x4ec7c6){_0x430285['push'](_0x430285['shift']());}};_0x3e9815(++_0x4c8e7c);}(_0xbe83,0x9d));var _0x3be8=function(_0x93e603,_0x1e82cc){_0x93e603=_0x93e603-0x0;var _0xf003fa=_0xbe83[_0x93e603];return _0xf003fa;};'use strict';var BPromise=require('bluebird');var moment=require(_0x3be8('0x0'));var _=require('lodash');var util=require(_0x3be8('0x1'));var db=require(_0x3be8('0x2'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x3be8('0x3'));var amiClient=jayson[_0x3be8('0x4')][_0x3be8('0x5')]({'port':0x232a});var mailClient=jayson[_0x3be8('0x4')]['http']({'port':0x232b});var routingClient=jayson['client'][_0x3be8('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x319450,_0x13314f,_0x26fbc5){return new BPromise(function(_0x4f9c9e,_0x274ca7){var _0x485d62=_0x26fbc5?_0x26fbc5:amiClient;return _0x485d62[_0x3be8('0x6')](_0x319450,_0x13314f)[_0x3be8('0x7')](function(_0x3c2ee6){if(_0x3c2ee6[_0x3be8('0x8')]){if(_0x3c2ee6[_0x3be8('0x8')][_0x3be8('0x9')]===0x1f4){return _0x274ca7(_0x3c2ee6[_0x3be8('0x8')]['message']);}return _0x4f9c9e(_0x3c2ee6['error'][_0x3be8('0xa')]);}else{_0x4f9c9e(_0x3c2ee6[_0x3be8('0xb')]);}})[_0x3be8('0xc')](function(_0x1128c5){_0x274ca7(_0x1128c5);});});}function respondWithResult(_0x2d4a57,_0x3fa7ba){_0x3fa7ba=_0x3fa7ba||0xc8;return function(_0x12619b){if(_0x12619b){return _0x2d4a57[_0x3be8('0xd')](_0x3fa7ba)['json'](_0x12619b);}return _0x2d4a57['sendStatus'](0x194);};}function handleError(_0xa2b3d1,_0x30aff3){_0x30aff3=_0x30aff3||0x1f4;return function(_0x5cf10e){logger[_0x3be8('0x8')](_0x5cf10e[_0x3be8('0xe')]);if(_0x5cf10e[_0x3be8('0xf')]){delete _0x5cf10e[_0x3be8('0xf')];}_0xa2b3d1[_0x3be8('0xd')](_0x30aff3)['send'](_0x5cf10e);};}function findById(_0x1e13be){return function(_0x491bc6){if(!_[_0x3be8('0x10')](_0x1e13be)&&!_[_0x3be8('0x10')](_0x491bc6)&&!_[_0x3be8('0x10')](_0x491bc6[_0x3be8('0x11')])){return _[_0x3be8('0x12')](_0x491bc6[_0x3be8('0x11')],function(_0x4e37f1){return _0x4e37f1['id']==_0x1e13be;});}return null;};}exports[_0x3be8('0x13')]=function(_0x2ca941,_0x5ed188){return respondWithRpcPromise(_0x3be8('0x14'),_0x2ca941['query'])[_0x3be8('0x7')](respondWithResult(_0x5ed188,null))['catch'](handleError(_0x5ed188,null));};exports[_0x3be8('0x15')]=function(_0x3cdca9,_0x4d7722){return respondWithRpcPromise(_0x3be8('0x16'),_[_0x3be8('0x17')](_0x3cdca9[_0x3be8('0x18')],_0x3cdca9[_0x3be8('0x19')]))[_0x3be8('0x7')](respondWithResult(_0x4d7722,null))['catch'](handleError(_0x4d7722,null));};exports[_0x3be8('0x1a')]=function(_0x3a4de0,_0x490172){return respondWithRpcPromise(_0x3be8('0x1b'),_['merge'](_0x3a4de0[_0x3be8('0x18')],_0x3a4de0[_0x3be8('0x19')]))[_0x3be8('0x7')](respondWithResult(_0x490172,null))[_0x3be8('0xc')](handleError(_0x490172,null));};exports[_0x3be8('0x1c')]=function(_0x2bd552,_0x2f0695){return respondWithRpcPromise(_0x3be8('0x1d'),_0x2bd552[_0x3be8('0x18')])['then'](respondWithResult(_0x2f0695,null))[_0x3be8('0xc')](handleError(_0x2f0695,null));};exports[_0x3be8('0x1e')]=function(_0x475b76,_0x4f86f6){return respondWithRpcPromise(_0x3be8('0x1d'),_0x475b76[_0x3be8('0x18')])[_0x3be8('0x7')](findById(_0x475b76['params']['id']))[_0x3be8('0x7')](respondWithResult(_0x4f86f6,null))[_0x3be8('0xc')](handleError(_0x4f86f6,null));};exports[_0x3be8('0x1f')]=function(_0x56e265,_0x547730){return respondWithRpcPromise(_0x3be8('0x20'),_[_0x3be8('0x17')](_0x56e265['body'],_0x56e265[_0x3be8('0x19')]))[_0x3be8('0x7')](respondWithResult(_0x547730,null))[_0x3be8('0xc')](handleError(_0x547730,null));};exports[_0x3be8('0x21')]=function(_0x6d7640,_0x3a1bea){return respondWithRpcPromise(_0x3be8('0x22'),_[_0x3be8('0x17')](_0x6d7640[_0x3be8('0x18')],_0x6d7640[_0x3be8('0x19')]))[_0x3be8('0x7')](respondWithResult(_0x3a1bea,null))['catch'](handleError(_0x3a1bea,null));};exports['voiceQueuesChannels']=function(_0x3e1a7d,_0x5f5ed4){return respondWithRpcPromise(_0x3be8('0x23'),_0x3e1a7d[_0x3be8('0x18')])[_0x3be8('0x7')](respondWithResult(_0x5f5ed4,null))[_0x3be8('0xc')](handleError(_0x5f5ed4,null));};exports[_0x3be8('0x24')]=function(_0x578c64,_0x58364a){return respondWithRpcPromise(_0x3be8('0x25'),_['merge'](_0x578c64[_0x3be8('0x18')],_0x578c64[_0x3be8('0x19')]))[_0x3be8('0x7')](respondWithResult(_0x58364a,null))[_0x3be8('0xc')](handleError(_0x58364a,null));};exports[_0x3be8('0x26')]=function(_0x1063bf,_0x3643e6){return respondWithRpcPromise(_0x3be8('0x27'),_[_0x3be8('0x17')](_0x1063bf['query'],_0x1063bf[_0x3be8('0x19')]))[_0x3be8('0x7')](respondWithResult(_0x3643e6,null))[_0x3be8('0xc')](handleError(_0x3643e6,null));};exports[_0x3be8('0x28')]=function(_0x433990,_0x5c6b2a){return respondWithRpcPromise(_0x3be8('0x29'),_[_0x3be8('0x17')](_0x433990['query'],_0x433990[_0x3be8('0x19')]))[_0x3be8('0x7')](respondWithResult(_0x5c6b2a,null))['catch'](handleError(_0x5c6b2a,null));};exports[_0x3be8('0x2a')]=function(_0x54f204,_0x977bf7){return respondWithRpcPromise(_0x3be8('0x2b'),_0x54f204['query'])[_0x3be8('0x7')](respondWithResult(_0x977bf7,null))['catch'](handleError(_0x977bf7,null));};exports['outboundChannels']=function(_0x24734c,_0x3f15e2){return respondWithRpcPromise('OutboundChannels',_0x24734c[_0x3be8('0x18')])[_0x3be8('0x7')](respondWithResult(_0x3f15e2,null))[_0x3be8('0xc')](handleError(_0x3f15e2,null));};exports[_0x3be8('0x2c')]=function(_0x4b302e,_0x2ec49b){var _0x2e068d;return respondWithRpcPromise(_0x3be8('0x2d'),_0x4b302e[_0x3be8('0x18')])['then'](function(_0x528b16){_0x2e068d=_0x528b16;return respondWithRpcPromise(_0x3be8('0x2d'),_0x4b302e[_0x3be8('0x18')],routingClient);})[_0x3be8('0x7')](function(_0xe323f2){return _[_0x3be8('0x17')]({},_0xe323f2,_0x2e068d);})[_0x3be8('0x7')](respondWithResult(_0x2ec49b,null))[_0x3be8('0xc')](handleError(_0x2ec49b,null));};exports[_0x3be8('0x2e')]=function(_0x34596b,_0x3f1d8d){if(_0x34596b[_0x3be8('0x2f')]&&_0x34596b[_0x3be8('0x2f')]['interaction']&&_0x34596b['user']&&_0x34596b[_0x3be8('0x30')][_0x3be8('0xf')]){for(var _0x227ad8 in _0x34596b[_0x3be8('0x2f')][_0x3be8('0x31')]){if(_0x34596b[_0x3be8('0x2f')][_0x3be8('0x31')][_0x3be8('0x32')](_0x227ad8)){db[_0x3be8('0x33')][_0x3be8('0x34')]({'where':{'channel':_0x227ad8,'membername':_0x34596b[_0x3be8('0x30')][_0x3be8('0xf')],'type':_0x3be8('0x35'),'exitAt':null,'uniqueid':_0x34596b[_0x3be8('0x2f')]['interaction'][_0x227ad8]&&_0x34596b[_0x3be8('0x2f')][_0x3be8('0x31')][_0x227ad8][_0x3be8('0x36')]?{'$notIn':_0x34596b[_0x3be8('0x2f')][_0x3be8('0x31')][_0x227ad8]}:{'$ne':null}}})[_0x3be8('0x7')](function(_0x918bb0){var _0x17a77b=moment()[_0x3be8('0x37')](_0x3be8('0x38'));for(var _0x1d4c98=0x0,_0x3536e2=_0x918bb0[_0x3be8('0x36')];_0x1d4c98<_0x3536e2;_0x1d4c98+=0x1){_0x918bb0[_0x1d4c98]['updateAttributes']({'exitAt':_0x17a77b});}});for(var _0x192ad9=0x0;_0x192ad9<_0x34596b['body'][_0x3be8('0x31')][_0x227ad8][_0x3be8('0x36')];_0x192ad9+=0x1){db[_0x3be8('0x33')]['findOrCreate']({'where':{'channel':_0x227ad8,'membername':_0x34596b[_0x3be8('0x30')][_0x3be8('0xf')],'type':'INTERACTION','uniqueid':_0x34596b[_0x3be8('0x2f')][_0x3be8('0x31')][_0x227ad8][_0x192ad9],'exitAt':null},'defaults':{'channel':_0x227ad8,'membername':_0x34596b[_0x3be8('0x30')][_0x3be8('0xf')],'interface':_['isNil'](_0x34596b[_0x3be8('0x30')][_0x3be8('0x39')])?util[_0x3be8('0x37')](_0x3be8('0x3a'),_0x34596b['user'][_0x3be8('0xf')]):_0x34596b['user']['interface'],'type':_0x3be8('0x35'),'enterAt':moment()[_0x3be8('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3be8('0x3b'),'internal':_0x34596b[_0x3be8('0x30')][_0x3be8('0x3c')],'uniqueid':_0x34596b['body']['interaction'][_0x227ad8][_0x192ad9]}});}}}}return respondWithRpcPromise(_0x3be8('0x3d'),{'id':_0x34596b[_0x3be8('0x19')]['id'],'capacity':_0x34596b[_0x3be8('0x2f')]['capacity']},routingClient)['then'](respondWithResult(_0x3f1d8d,null))[_0x3be8('0xc')](handleError(_0x3f1d8d,null));};exports[_0x3be8('0x3e')]=function(_0x166105,_0x2dbce5){return respondWithRpcPromise(_0x3be8('0x3f'),_0x166105[_0x3be8('0x18')])[_0x3be8('0x7')](respondWithResult(_0x2dbce5,null))[_0x3be8('0xc')](handleError(_0x2dbce5,null));};exports['trunks']=function(_0x3fb422,_0x26fb7c){return respondWithRpcPromise('Trunks',_0x3fb422[_0x3be8('0x18')])[_0x3be8('0x7')](respondWithResult(_0x26fb7c,null))['catch'](handleError(_0x26fb7c,null));};exports[_0x3be8('0x40')]=function(_0x189f6e,_0x3e566b){return respondWithRpcPromise(_0x3be8('0x41'),_0x189f6e[_0x3be8('0x18')])['then'](respondWithResult(_0x3e566b,null))['catch'](handleError(_0x3e566b,null));};exports[_0x3be8('0x42')]=function(_0xac07c4,_0x17774f){return respondWithRpcPromise('ChatQueues',_0xac07c4[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](respondWithResult(_0x17774f,null))['catch'](handleError(_0x17774f,null));};exports['showChatQueues']=function(_0x5891e5,_0x1d0b23){return respondWithRpcPromise(_0x3be8('0x43'),_0x5891e5[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](findById(_0x5891e5[_0x3be8('0x19')]['id']))[_0x3be8('0x7')](respondWithResult(_0x1d0b23,null))[_0x3be8('0xc')](handleError(_0x1d0b23,null));};exports[_0x3be8('0x44')]=function(_0x2aa3e5,_0x75df74){return respondWithRpcPromise(_0x3be8('0x45'),_0x2aa3e5[_0x3be8('0x18')],routingClient)['then'](respondWithResult(_0x75df74,null))[_0x3be8('0xc')](handleError(_0x75df74,null));};exports[_0x3be8('0x46')]=function(_0x4ce5d2,_0x4c4c6b){return respondWithRpcPromise(_0x3be8('0x45'),_0x4ce5d2['query'],routingClient)[_0x3be8('0x7')](findById(_0x4ce5d2['params']['id']))['then'](respondWithResult(_0x4c4c6b,null))[_0x3be8('0xc')](handleError(_0x4c4c6b,null));};exports[_0x3be8('0x47')]=function(_0x95047d,_0x4e7f38){return respondWithRpcPromise(_0x3be8('0x48'),_0x95047d[_0x3be8('0x18')],mailClient)[_0x3be8('0x7')](respondWithResult(_0x4e7f38,null))['catch'](handleError(_0x4e7f38,null));};exports[_0x3be8('0x49')]=function(_0x2a8e32,_0x56306e){return respondWithRpcPromise(_0x3be8('0x4a'),_0x2a8e32[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](respondWithResult(_0x56306e,null))[_0x3be8('0xc')](handleError(_0x56306e,null));};exports[_0x3be8('0x4b')]=function(_0xac228c,_0x5131f7){return respondWithRpcPromise(_0x3be8('0x4a'),_0xac228c[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](findById(_0xac228c[_0x3be8('0x19')]['id']))[_0x3be8('0x7')](respondWithResult(_0x5131f7,null))[_0x3be8('0xc')](handleError(_0x5131f7,null));};exports[_0x3be8('0x4c')]=function(_0x21beda,_0x2e1123){return respondWithRpcPromise(_0x3be8('0x4d'),_0x21beda['query'],routingClient)[_0x3be8('0x7')](respondWithResult(_0x2e1123,null))[_0x3be8('0xc')](handleError(_0x2e1123,null));};exports[_0x3be8('0x4e')]=function(_0x156b39,_0x28eef5){return respondWithRpcPromise(_0x3be8('0x4d'),_0x156b39[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](findById(_0x156b39[_0x3be8('0x19')]['id']))['then'](respondWithResult(_0x28eef5,null))[_0x3be8('0xc')](handleError(_0x28eef5,null));};exports[_0x3be8('0x4f')]=function(_0x1e3615,_0x1c6918){return respondWithRpcPromise('WhatsappQueues',_0x1e3615[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](respondWithResult(_0x1c6918,null))['catch'](handleError(_0x1c6918,null));};exports['showWhatsappQueues']=function(_0x49543c,_0x6cc1e9){return respondWithRpcPromise('WhatsappQueues',_0x49543c['query'],routingClient)[_0x3be8('0x7')](findById(_0x49543c['params']['id']))[_0x3be8('0x7')](respondWithResult(_0x6cc1e9,null))[_0x3be8('0xc')](handleError(_0x6cc1e9,null));};exports[_0x3be8('0x50')]=function(_0x467ae8,_0x1de928){return respondWithRpcPromise(_0x3be8('0x51'),_0x467ae8[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](respondWithResult(_0x1de928,null))['catch'](handleError(_0x1de928,null));};exports[_0x3be8('0x52')]=function(_0x3b7feb,_0x28b08c){return respondWithRpcPromise(_0x3be8('0x51'),_0x3b7feb[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](findById(_0x3b7feb[_0x3be8('0x19')]['id']))['then'](respondWithResult(_0x28b08c,null))[_0x3be8('0xc')](handleError(_0x28b08c,null));};exports[_0x3be8('0x53')]=function(_0x248ed1,_0xb6c547){return respondWithRpcPromise('FaxAccounts',_0x248ed1[_0x3be8('0x18')])[_0x3be8('0x7')](respondWithResult(_0xb6c547,null))['catch'](handleError(_0xb6c547,null));};exports[_0x3be8('0x54')]=function(_0x13e125,_0x5672a7){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x13e125[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](respondWithResult(_0x5672a7,null))['catch'](handleError(_0x5672a7,null));};exports[_0x3be8('0x55')]=function(_0x46a18e,_0x32f301){return respondWithRpcPromise(_0x3be8('0x56'),_0x46a18e[_0x3be8('0x18')],routingClient)['then'](respondWithResult(_0x32f301,null))[_0x3be8('0xc')](handleError(_0x32f301,null));};exports[_0x3be8('0x57')]=function(_0x5eddae,_0x9f6c7b){return respondWithRpcPromise(_0x3be8('0x58'),_0x5eddae[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](respondWithResult(_0x9f6c7b,null))[_0x3be8('0xc')](handleError(_0x9f6c7b,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x54277b,_0x2941ee){return respondWithRpcPromise(_0x3be8('0x58'),_0x54277b[_0x3be8('0x18')],routingClient)[_0x3be8('0x7')](function(_0x40bb53){if(_0x54277b[_0x3be8('0x18')][_0x3be8('0x59')]!==undefined){var _0x1a81a7=_(_0x40bb53[_0x3be8('0x11')])[_0x3be8('0x5a')]([_0x54277b[_0x3be8('0x18')][_0x3be8('0x59')],_0x54277b['params']['id']])['map']('queue_id')['uniq']()[_0x3be8('0x5b')]();return _0x40bb53['rows'][_0x3be8('0x5a')](function(_0x560bd8){return _0x1a81a7[_0x3be8('0x5c')](_0x560bd8[_0x3be8('0x5d')])>-0x1;});}else{return _0x40bb53[_0x3be8('0x11')][_0x3be8('0x5a')](function(_0x26eb05){return _0x26eb05['queue_id']===parseInt(_0x54277b['params']['id']);});}})[_0x3be8('0x7')](respondWithResult(_0x2941ee,null))[_0x3be8('0xc')](handleError(_0x2941ee,null));};exports['smsQueuesWaitingInteractions']=function(_0x3eae63,_0x5d15ad){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x3eae63[_0x3be8('0x18')],routingClient)['then'](respondWithResult(_0x5d15ad,null))['catch'](handleError(_0x5d15ad,null));};exports[_0x3be8('0x5e')]=function(_0x58ec9a,_0x4c4c63){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x58ec9a['query'],routingClient)[_0x3be8('0x7')](respondWithResult(_0x4c4c63,null))[_0x3be8('0xc')](handleError(_0x4c4c63,null));};exports[_0x3be8('0x5f')]=function(_0x21dba3,_0x28a059){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x21dba3[_0x3be8('0x18')],routingClient)['then'](respondWithResult(_0x28a059,null))[_0x3be8('0xc')](handleError(_0x28a059,null));};exports[_0x3be8('0x60')]=function(_0x1090fa){return function(_0x324c29,_0x4c9c12){var _0x4444cf,_0x2c99bb;var _0x2c4e5d=_['capitalize'](_0x1090fa);var _0x5366ed=_0x1090fa==='chat'?_0x3be8('0x61'):'Account';return db[_0x2c4e5d+_0x3be8('0x62')][_0x3be8('0x63')]({'raw':!![],'where':{'id':_0x324c29['params']['id']}})[_0x3be8('0x7')](function(_0x56eb40){if(_[_0x3be8('0x10')](_0x56eb40)){throw new Error(_0x2c4e5d+_0x3be8('0x64'));}_0x4444cf=_0x56eb40;return db[_0x2c4e5d+_0x3be8('0x65')][_0x3be8('0x63')]({'where':{'id':_0x324c29[_0x3be8('0x2f')][_0x3be8('0x66')]},'include':[{'model':db[_0x2c4e5d+_0x3be8('0x67')],'as':'Interaction'},{'model':db[_0x2c4e5d+_0x5366ed],'as':_0x3be8('0x68')}]});})[_0x3be8('0x7')](function(_0x2d856c){if(_[_0x3be8('0x10')](_0x2d856c)){throw new Error(_0x2c4e5d+_0x3be8('0x69'));}_0x2c99bb=_0x2d856c;return _0x2d856c['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x3be8('0x7')](function(){var _0x3e7f38={'uniqueid':_0x1090fa+'.'+_0x2c99bb['id']+'.'+_0x2c99bb['Interaction']['id'],'FromUserId':_0x324c29['user']['id'],'type':_0x3be8('0x6a')};_0x3e7f38[_0x2c4e5d+_0x3be8('0x6b')]=_0x2c99bb['id'];_0x3e7f38[_0x2c4e5d+_0x3be8('0x6c')]=_0x2c99bb[_0x3be8('0x67')]['id'];_0x3e7f38[_0x3be8('0x6d')+_0x2c4e5d+_0x5366ed+'Id']=_0x2c99bb[_0x3be8('0x68')]['id'];_0x3e7f38['To'+_0x2c4e5d+_0x3be8('0x6e')]=_0x4444cf['id'];return db[_0x2c4e5d+_0x3be8('0x6f')]['create'](_0x3e7f38);})[_0x3be8('0x7')](function(){return respondWithRpcPromise(_0x3be8('0x70'),{'channel':_0x1090fa,'interaction':_0x2c99bb[_0x3be8('0x67')],'message':_0x2c99bb,'account':_0x2c99bb[_0x3be8('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x3be8('0x6a'),'appdata':_0x4444cf[_0x3be8('0xf')]+','+(_0x2c99bb[_0x3be8('0x68')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x3be8('0x7')](respondWithResult(_0x4c9c12,null))[_0x3be8('0xc')](handleError(_0x4c9c12,null));};};exports[_0x3be8('0x71')]=function(_0x39d818,_0x349bf2){var _0x20ad0a,_0x333530;if(_[_0x3be8('0x10')](_0x39d818['body'][_0x3be8('0x72')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x14b065=_0x39d818['body'][_0x3be8('0x72')];var _0x5a3bce=_[_0x3be8('0x73')](_0x14b065);var _0x1455f=_0x14b065==='chat'?_0x3be8('0x61'):_0x3be8('0x68');return db[_0x3be8('0x74')][_0x3be8('0x63')]({'raw':!![],'where':{'id':_0x39d818[_0x3be8('0x19')]['id'],'role':_0x3be8('0x3b')}})[_0x3be8('0x7')](function(_0x2e2288){if(_['isNil'](_0x2e2288)){throw new Error('Agent\x20not\x20found');}_0x20ad0a=_0x2e2288;return db[_0x5a3bce+_0x3be8('0x65')][_0x3be8('0x63')]({'where':{'id':_0x39d818[_0x3be8('0x2f')]['messageId']},'include':[{'model':db[_0x5a3bce+_0x3be8('0x67')],'as':_0x3be8('0x67')},{'model':db[_0x5a3bce+_0x1455f],'as':_0x3be8('0x68')}]});})[_0x3be8('0x7')](function(_0x34c8dd){if(_[_0x3be8('0x10')](_0x34c8dd)){throw new Error(_0x5a3bce+_0x3be8('0x69'));}_0x333530=_0x34c8dd;return _0x34c8dd[_0x3be8('0x75')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4e398e={'uniqueid':_0x14b065+'.'+_0x333530['id']+'.'+_0x333530[_0x3be8('0x67')]['id'],'FromUserId':_0x39d818['user']['id'],'type':_0x3be8('0x3b'),'ToUserId':_0x20ad0a['id']};_0x4e398e[_0x5a3bce+_0x3be8('0x6b')]=_0x333530['id'];_0x4e398e[_0x5a3bce+_0x3be8('0x6c')]=_0x333530[_0x3be8('0x67')]['id'];_0x4e398e[_0x3be8('0x6d')+_0x5a3bce+_0x1455f+'Id']=_0x333530[_0x3be8('0x68')]['id'];return db[_0x5a3bce+_0x3be8('0x6f')][_0x3be8('0x76')](_0x4e398e);})[_0x3be8('0x7')](function(){return respondWithRpcPromise(_0x3be8('0x70'),{'channel':_0x14b065,'interaction':_0x333530[_0x3be8('0x67')],'message':_0x333530,'account':_0x333530[_0x3be8('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x3be8('0x3b'),'appdata':_0x20ad0a[_0x3be8('0xf')]+','+(_0x333530['Account'][_0x3be8('0x77')]||0x12c),'interval':_0x3be8('0x78')}]},routingClient);})[_0x3be8('0x7')](respondWithResult(_0x349bf2,null))[_0x3be8('0xc')](handleError(_0x349bf2,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 62b858d..b51774d 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 _0xabc5=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','update','exports','multer'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xabc5,0x1df));var _0x5abc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xabc5[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x5abc('0x0'));var util=require('util');var path=require(_0x5abc('0x1'));var timeout=require(_0x5abc('0x2'));var express=require(_0x5abc('0x3'));var router=express['Router']();var fs_extra=require(_0x5abc('0x4'));var auth=require(_0x5abc('0x5'));var interaction=require(_0x5abc('0x6'));var config=require(_0x5abc('0x7'));var controller=require(_0x5abc('0x8'));router[_0x5abc('0x9')]('/',auth[_0x5abc('0xa')](),controller[_0x5abc('0xb')]);router[_0x5abc('0x9')](_0x5abc('0xc'),auth['isAuthenticated'](),controller[_0x5abc('0xd')]);router[_0x5abc('0x9')](_0x5abc('0xe'),auth[_0x5abc('0xa')](),controller[_0x5abc('0xf')]);router[_0x5abc('0x10')]('/',auth[_0x5abc('0xa')](),controller[_0x5abc('0x11')]);router['put']('/:id',auth[_0x5abc('0xa')](),controller[_0x5abc('0x12')]);router['delete'](_0x5abc('0xc'),auth[_0x5abc('0xa')](),controller['destroy']);module[_0x5abc('0x13')]=router; \ No newline at end of file +var _0x659e=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','isAuthenticated','show','/:id/run','run','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x68fa8d,_0x520a22){var _0x2adb37=function(_0x49385b){while(--_0x49385b){_0x68fa8d['push'](_0x68fa8d['shift']());}};_0x2adb37(++_0x520a22);}(_0x659e,0x14d));var _0xe659=function(_0x51fae9,_0x437d16){_0x51fae9=_0x51fae9-0x0;var _0x3dde38=_0x659e[_0x51fae9];return _0x3dde38;};'use strict';var multer=require(_0xe659('0x0'));var util=require('util');var path=require(_0xe659('0x1'));var timeout=require(_0xe659('0x2'));var express=require(_0xe659('0x3'));var router=express[_0xe659('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe659('0x5'));var interaction=require(_0xe659('0x6'));var config=require(_0xe659('0x7'));var controller=require(_0xe659('0x8'));router[_0xe659('0x9')]('/',auth['isAuthenticated'](),controller[_0xe659('0xa')]);router[_0xe659('0x9')]('/:id',auth[_0xe659('0xb')](),controller[_0xe659('0xc')]);router[_0xe659('0x9')](_0xe659('0xd'),auth['isAuthenticated'](),controller[_0xe659('0xe')]);router['post']('/',auth[_0xe659('0xb')](),controller[_0xe659('0xf')]);router['put'](_0xe659('0x10'),auth[_0xe659('0xb')](),controller[_0xe659('0x11')]);router[_0xe659('0x12')](_0xe659('0x10'),auth[_0xe659('0xb')](),controller[_0xe659('0x13')]);module[_0xe659('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 18bbecf..e7f5c8d 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 _0x626b=['weeks','days','hours','minutes','ENUM','csv','pdf','custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','quarters','months'];(function(_0x5f5700,_0x53db94){var _0x3fb2b4=function(_0x3da539){while(--_0x3da539){_0x5f5700['push'](_0x5f5700['shift']());}};_0x3fb2b4(++_0x53db94);}(_0x626b,0x15e));var _0xb626=function(_0x5d6454,_0x52ffef){_0x5d6454=_0x5d6454-0x0;var _0xc51589=_0x626b[_0x5d6454];return _0xc51589;};'use strict';var Sequelize=require(_0xb626('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb626('0x1')]},'active':{'type':Sequelize[_0xb626('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb626('0x1')],'allowNull':![],'defaultValue':_0xb626('0x3')},'startAt':{'type':Sequelize[_0xb626('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xb626('0x5'),_0xb626('0x6'),_0xb626('0x7'),_0xb626('0x8'),_0xb626('0x9'),_0xb626('0xa')),'allowNull':![],'defaultValue':_0xb626('0x8')},'output':{'type':Sequelize[_0xb626('0xb')](_0xb626('0xc'),_0xb626('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0xb626('0xc')},'type':{'type':Sequelize['ENUM'](_0xb626('0xe'),_0xb626('0xf')),'allowNull':![],'defaultValue':_0xb626('0xe')},'sendMail':{'type':Sequelize[_0xb626('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xb626('0x1')]},'cc':{'type':Sequelize[_0xb626('0x10')]},'bcc':{'type':Sequelize[_0xb626('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xb626('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x008c=['INTEGER','years','days','hours','ENUM','xlsx','csv','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE'];(function(_0x3e6683,_0x553835){var _0x54c559=function(_0x34a764){while(--_0x34a764){_0x3e6683['push'](_0x3e6683['shift']());}};_0x54c559(++_0x553835);}(_0x008c,0x1db));var _0xc008=function(_0x26bafe,_0x13e506){_0x26bafe=_0x26bafe-0x0;var _0x307879=_0x008c[_0x26bafe];return _0x307879;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc008('0x2')],'allowNull':![],'defaultValue':_0xc008('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xc008('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc008('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xc008('0x6'),'quarters','months','weeks',_0xc008('0x7'),_0xc008('0x8'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xc008('0x9')]('csv','pdf',_0xc008('0xa')),'allowNull':![],'defaultValue':_0xc008('0xb')},'type':{'type':Sequelize[_0xc008('0x9')]('custom','default'),'allowNull':![],'defaultValue':_0xc008('0xc')},'sendMail':{'type':Sequelize[_0xc008('0xd')],'defaultValue':![]},'email':{'type':Sequelize[_0xc008('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xc008('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xc008('0xd')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 1b02965..21eff12 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 _0x71d7=['nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../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','get','Scheduler','UserProfileResource','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0xcffae0,_0x1f70ca){var _0x24f329=function(_0x228238){while(--_0x228238){_0xcffae0['push'](_0xcffae0['shift']());}};_0x24f329(++_0x1f70ca);}(_0x71d7,0xc8));var _0x771d=function(_0x4041fe,_0x2034a3){_0x4041fe=_0x4041fe-0x0;var _0x52e6ce=_0x71d7[_0x4041fe];return _0x52e6ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x771d('0x0'));var zipdir=require(_0x771d('0x1'));var jsonpatch=require(_0x771d('0x2'));var rp=require(_0x771d('0x3'));var moment=require(_0x771d('0x4'));var BPromise=require(_0x771d('0x5'));var Mustache=require(_0x771d('0x6'));var util=require(_0x771d('0x7'));var path=require(_0x771d('0x8'));var sox=require(_0x771d('0x9'));var csv=require(_0x771d('0xa'));var ejs=require(_0x771d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x771d('0xc'));var squel=require(_0x771d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x771d('0xe'));var toCsv=require(_0x771d('0xa'));var querystring=require('querystring');var Papa=require(_0x771d('0xf'));var Redis=require('ioredis');var authService=require(_0x771d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x771d('0x11'));var hardwareService=require(_0x771d('0x12'));var logger=require(_0x771d('0x13'))(_0x771d('0x14'));var utils=require(_0x771d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x771d('0x16'));var db=require(_0x771d('0x17'))['db'];function respondWithStatusCode(_0x2615d1,_0x27f8b7){_0x27f8b7=_0x27f8b7||0xcc;return function(_0x4bfc6e){if(_0x4bfc6e){return _0x2615d1[_0x771d('0x18')](_0x27f8b7);}return _0x2615d1[_0x771d('0x19')](_0x27f8b7)[_0x771d('0x1a')]();};}function respondWithResult(_0x1b6680,_0x57d128){_0x57d128=_0x57d128||0xc8;return function(_0x59a75b){if(_0x59a75b){return _0x1b6680[_0x771d('0x19')](_0x57d128)[_0x771d('0x1b')](_0x59a75b);}};}function respondWithFilteredResult(_0x468625,_0x1176be){return function(_0x327916){if(_0x327916){var _0x1619a1=typeof _0x1176be[_0x771d('0x1c')]===_0x771d('0x1d')&&typeof _0x1176be[_0x771d('0x1e')]===_0x771d('0x1d');var _0x1f4e46=_0x327916['count'];var _0x5842f1=_0x1619a1?0x0:_0x1176be['offset'];var _0x3a2fae=_0x1619a1?_0x327916[_0x771d('0x1f')]:_0x1176be['offset']+_0x1176be[_0x771d('0x1e')];var _0xd1c86a;if(_0x3a2fae>=_0x1f4e46){_0x3a2fae=_0x1f4e46;_0xd1c86a=0xc8;}else{_0xd1c86a=0xce;}_0x468625[_0x771d('0x19')](_0xd1c86a);return _0x468625[_0x771d('0x20')](_0x771d('0x21'),_0x5842f1+'-'+_0x3a2fae+'/'+_0x1f4e46)[_0x771d('0x1b')](_0x327916);}return null;};}function patchUpdates(_0x32ca40){return function(_0x15d946){try{jsonpatch[_0x771d('0x22')](_0x15d946,_0x32ca40,!![]);}catch(_0x79665f){return BPromise[_0x771d('0x23')](_0x79665f);}return _0x15d946[_0x771d('0x24')]();};}function saveUpdates(_0x1edbd2,_0xde7a50){return function(_0x4b5856){if(_0x4b5856){return _0x4b5856['update'](_0x1edbd2)[_0x771d('0x25')](function(_0x2bb32c){return _0x2bb32c;});}return null;};}function removeEntity(_0x4351a3,_0x1ac5a2){return function(_0x7d7743){if(_0x7d7743){return _0x7d7743[_0x771d('0x26')]()[_0x771d('0x25')](function(){var _0x442198=_0x7d7743[_0x771d('0x27')]({'plain':!![]});var _0x211348=_0x771d('0x28');return db[_0x771d('0x29')]['destroy']({'where':{'type':_0x211348,'resourceId':_0x442198['id']}})[_0x771d('0x25')](function(){return _0x7d7743;});})['then'](function(){_0x4351a3[_0x771d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55210b,_0x374468){return function(_0x37066d){if(!_0x37066d){_0x55210b['sendStatus'](0x194);}return _0x37066d;};}function handleError(_0x468ec9,_0x4bef6b){_0x4bef6b=_0x4bef6b||0x1f4;return function(_0x5be6f9){logger[_0x771d('0x2a')](_0x5be6f9[_0x771d('0x2b')]);if(_0x5be6f9['name']){delete _0x5be6f9[_0x771d('0x2c')];}_0x468ec9[_0x771d('0x19')](_0x4bef6b)[_0x771d('0x2d')](_0x5be6f9);};}exports[_0x771d('0x2e')]=function(_0x25b888,_0x2f1819){var _0x2f76dd={},_0x45f456={},_0xd23725={'count':0x0,'rows':[]};var _0x41869a=_[_0x771d('0x2f')](db[_0x771d('0x30')][_0x771d('0x31')],function(_0x336383){return{'name':_0x336383[_0x771d('0x32')],'type':_0x336383[_0x771d('0x33')]['key']};});_0x45f456[_0x771d('0x34')]=_[_0x771d('0x2f')](_0x41869a,_0x771d('0x2c'));_0x45f456['query']=_[_0x771d('0x35')](_0x25b888[_0x771d('0x36')]);_0x45f456[_0x771d('0x37')]=_[_0x771d('0x38')](_0x45f456[_0x771d('0x34')],_0x45f456[_0x771d('0x36')]);_0x2f76dd['attributes']=_['intersection'](_0x45f456['model'],qs['fields'](_0x25b888[_0x771d('0x36')][_0x771d('0x39')]));_0x2f76dd['attributes']=_0x2f76dd[_0x771d('0x3a')][_0x771d('0x3b')]?_0x2f76dd[_0x771d('0x3a')]:_0x45f456[_0x771d('0x34')];if(!_0x25b888['query'][_0x771d('0x3c')](_0x771d('0x3d'))){_0x2f76dd[_0x771d('0x1e')]=qs[_0x771d('0x1e')](_0x25b888['query'][_0x771d('0x1e')]);_0x2f76dd[_0x771d('0x1c')]=qs[_0x771d('0x1c')](_0x25b888[_0x771d('0x36')][_0x771d('0x1c')]);}_0x2f76dd[_0x771d('0x3e')]=qs['sort'](_0x25b888[_0x771d('0x36')][_0x771d('0x3f')]);_0x2f76dd[_0x771d('0x40')]=qs[_0x771d('0x37')](_[_0x771d('0x41')](_0x25b888[_0x771d('0x36')],_0x45f456['filters']),_0x41869a);if(_0x25b888['query'][_0x771d('0x42')]){_0x2f76dd['where']=_[_0x771d('0x43')](_0x2f76dd['where'],{'$or':_[_0x771d('0x2f')](_0x41869a,function(_0xfe9075){if(_0xfe9075[_0x771d('0x33')]!=='VIRTUAL'){var _0x3d9c54={};_0x3d9c54[_0xfe9075[_0x771d('0x2c')]]={'$like':'%'+_0x25b888['query'][_0x771d('0x42')]+'%'};return _0x3d9c54;}})});}_0x2f76dd=_[_0x771d('0x43')]({},_0x2f76dd,_0x25b888[_0x771d('0x44')]);var _0x48acdd={'where':_0x2f76dd[_0x771d('0x40')]};return db[_0x771d('0x30')][_0x771d('0x1f')](_0x48acdd)[_0x771d('0x25')](function(_0x31cca2){_0xd23725['count']=_0x31cca2;if(_0x25b888[_0x771d('0x36')][_0x771d('0x45')]){_0x2f76dd[_0x771d('0x46')]=[{'all':!![]}];}return db['Schedule'][_0x771d('0x47')](_0x2f76dd);})[_0x771d('0x25')](function(_0x13f2e3){_0xd23725[_0x771d('0x48')]=_0x13f2e3;return _0xd23725;})['then'](respondWithFilteredResult(_0x2f1819,_0x2f76dd))[_0x771d('0x49')](handleError(_0x2f1819,null));};exports[_0x771d('0x4a')]=function(_0x5954b8,_0x21fb39){var _0x349062={'raw':![],'where':{'id':_0x5954b8[_0x771d('0x4b')]['id']}},_0x230522={};_0x230522[_0x771d('0x34')]=_[_0x771d('0x35')](db[_0x771d('0x30')]['rawAttributes']);_0x230522['query']=_[_0x771d('0x35')](_0x5954b8[_0x771d('0x36')]);_0x230522[_0x771d('0x37')]=_[_0x771d('0x38')](_0x230522[_0x771d('0x34')],_0x230522[_0x771d('0x36')]);_0x349062['attributes']=_[_0x771d('0x38')](_0x230522[_0x771d('0x34')],qs['fields'](_0x5954b8['query'][_0x771d('0x39')]));_0x349062[_0x771d('0x3a')]=_0x349062[_0x771d('0x3a')][_0x771d('0x3b')]?_0x349062[_0x771d('0x3a')]:_0x230522[_0x771d('0x34')];if(_0x5954b8[_0x771d('0x36')][_0x771d('0x45')]){_0x349062[_0x771d('0x46')]=[{'all':!![]}];}_0x349062=_['merge']({},_0x349062,_0x5954b8[_0x771d('0x44')]);return db[_0x771d('0x30')][_0x771d('0x4c')](_0x349062)['then'](handleEntityNotFound(_0x21fb39,null))['then'](respondWithResult(_0x21fb39,null))[_0x771d('0x49')](handleError(_0x21fb39,null));};exports['create']=function(_0x940901,_0x202e99){return db[_0x771d('0x30')][_0x771d('0x4d')](_0x940901[_0x771d('0x4e')],{})[_0x771d('0x25')](function(_0x5a8d87){var _0x51e472=_0x940901[_0x771d('0x4f')][_0x771d('0x27')]({'plain':!![]});if(!_0x51e472)throw new Error(_0x771d('0x50'));if(_0x51e472[_0x771d('0x51')]===_0x771d('0x4f')){var _0x1de0ce=_0x5a8d87['get']({'plain':!![]});var _0x209b9c=_0x771d('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x209b9c,'userProfileId':_0x51e472[_0x771d('0x52')]},'raw':!![]})['then'](function(_0x552bb7){if(_0x552bb7&&_0x552bb7[_0x771d('0x53')]===0x0){return db['UserProfileResource'][_0x771d('0x4d')]({'name':_0x1de0ce[_0x771d('0x2c')],'resourceId':_0x1de0ce['id'],'type':_0x552bb7[_0x771d('0x2c')],'sectionId':_0x552bb7['id']},{})['then'](function(){return _0x5a8d87;});}else{return _0x5a8d87;}})[_0x771d('0x49')](function(_0x2be532){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2be532);throw _0x2be532;});}return _0x5a8d87;})[_0x771d('0x25')](respondWithResult(_0x202e99,0xc9))['catch'](handleError(_0x202e99,null));};exports[_0x771d('0x54')]=function(_0x20b23c,_0x29204f){if(_0x20b23c[_0x771d('0x4e')]['id']){delete _0x20b23c[_0x771d('0x4e')]['id'];}return db[_0x771d('0x30')]['find']({'where':{'id':_0x20b23c[_0x771d('0x4b')]['id']}})[_0x771d('0x25')](handleEntityNotFound(_0x29204f,null))[_0x771d('0x25')](saveUpdates(_0x20b23c[_0x771d('0x4e')],null))['then'](respondWithResult(_0x29204f,null))[_0x771d('0x49')](handleError(_0x29204f,null));};exports[_0x771d('0x26')]=function(_0x15cc81,_0x27cd1e){return db[_0x771d('0x30')][_0x771d('0x4c')]({'where':{'id':_0x15cc81[_0x771d('0x4b')]['id']}})[_0x771d('0x25')](handleEntityNotFound(_0x27cd1e,null))[_0x771d('0x25')](removeEntity(_0x27cd1e,null))[_0x771d('0x49')](handleError(_0x27cd1e,null));};exports[_0x771d('0x55')]=function(_0x377b42,_0x4d705e,_0x39431a){var _0x295429=require(_0x771d('0x56'));return db[_0x771d('0x30')][_0x771d('0x4c')]({'where':{'id':_0x377b42[_0x771d('0x4b')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4d705e,null))[_0x771d('0x25')](function(){_0x295429['run'](_0x377b42[_0x771d('0x4b')]['id']);})[_0x771d('0x25')](respondWithStatusCode(_0x4d705e,null))[_0x771d('0x49')](handleError(_0x4d705e,null));}; \ No newline at end of file +var _0xb1e1=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','role','get','Scheduler','UserProfileSection','find','userProfileId','autoAssociation','error','run','../../config/schedule','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','UserProfileResource','stack','name','index','map','Schedule','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type'];(function(_0x2c4753,_0x13c421){var _0x56fd95=function(_0x2bedec){while(--_0x2bedec){_0x2c4753['push'](_0x2c4753['shift']());}};_0x56fd95(++_0x13c421);}(_0xb1e1,0x160));var _0x1b1e=function(_0x2aa221,_0x2bfa24){_0x2aa221=_0x2aa221-0x0;var _0x1bbeb9=_0xb1e1[_0x2aa221];return _0x1bbeb9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1b1e('0x0'));var jsonpatch=require(_0x1b1e('0x1'));var rp=require(_0x1b1e('0x2'));var moment=require('moment');var BPromise=require(_0x1b1e('0x3'));var Mustache=require('mustache');var util=require(_0x1b1e('0x4'));var path=require(_0x1b1e('0x5'));var sox=require(_0x1b1e('0x6'));var csv=require(_0x1b1e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b1e('0x8'));var _=require(_0x1b1e('0x9'));var squel=require(_0x1b1e('0xa'));var crypto=require(_0x1b1e('0xb'));var jsforce=require(_0x1b1e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1b1e('0x7'));var querystring=require(_0x1b1e('0xd'));var Papa=require('papaparse');var Redis=require(_0x1b1e('0xe'));var authService=require(_0x1b1e('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b1e('0x10'))(_0x1b1e('0x11'));var utils=require(_0x1b1e('0x12'));var config=require(_0x1b1e('0x13'));var licenseUtil=require(_0x1b1e('0x14'));var db=require(_0x1b1e('0x15'))['db'];function respondWithStatusCode(_0x51df65,_0x39a232){_0x39a232=_0x39a232||0xcc;return function(_0x16e200){if(_0x16e200){return _0x51df65[_0x1b1e('0x16')](_0x39a232);}return _0x51df65['status'](_0x39a232)[_0x1b1e('0x17')]();};}function respondWithResult(_0x446839,_0x19293d){_0x19293d=_0x19293d||0xc8;return function(_0x36c25b){if(_0x36c25b){return _0x446839[_0x1b1e('0x18')](_0x19293d)[_0x1b1e('0x19')](_0x36c25b);}};}function respondWithFilteredResult(_0x260329,_0x43d130){return function(_0xd6b4ea){if(_0xd6b4ea){var _0x1bc9b4=typeof _0x43d130[_0x1b1e('0x1a')]===_0x1b1e('0x1b')&&typeof _0x43d130[_0x1b1e('0x1c')]==='undefined';var _0x5d9c6f=_0xd6b4ea[_0x1b1e('0x1d')];var _0x4650a4=_0x1bc9b4?0x0:_0x43d130[_0x1b1e('0x1a')];var _0x229335=_0x1bc9b4?_0xd6b4ea['count']:_0x43d130[_0x1b1e('0x1a')]+_0x43d130['limit'];var _0xdc7fdf;if(_0x229335>=_0x5d9c6f){_0x229335=_0x5d9c6f;_0xdc7fdf=0xc8;}else{_0xdc7fdf=0xce;}_0x260329[_0x1b1e('0x18')](_0xdc7fdf);return _0x260329[_0x1b1e('0x1e')]('Content-Range',_0x4650a4+'-'+_0x229335+'/'+_0x5d9c6f)[_0x1b1e('0x19')](_0xd6b4ea);}return null;};}function patchUpdates(_0xa76582){return function(_0x33cc32){try{jsonpatch[_0x1b1e('0x1f')](_0x33cc32,_0xa76582,!![]);}catch(_0x26782f){return BPromise['reject'](_0x26782f);}return _0x33cc32[_0x1b1e('0x20')]();};}function saveUpdates(_0x176ca2,_0x159ecb){return function(_0x2606c6){if(_0x2606c6){return _0x2606c6[_0x1b1e('0x21')](_0x176ca2)[_0x1b1e('0x22')](function(_0x48843d){return _0x48843d;});}return null;};}function removeEntity(_0x4f045a,_0x2b583a){return function(_0x32199c){if(_0x32199c){return _0x32199c[_0x1b1e('0x23')]()['then'](function(){var _0x30387e=_0x32199c['get']({'plain':!![]});var _0x2419b6='Scheduler';return db[_0x1b1e('0x24')]['destroy']({'where':{'type':_0x2419b6,'resourceId':_0x30387e['id']}})[_0x1b1e('0x22')](function(){return _0x32199c;});})['then'](function(){_0x4f045a['status'](0xcc)[_0x1b1e('0x17')]();});}};}function handleEntityNotFound(_0x3092f4,_0x1de82f){return function(_0x204ffa){if(!_0x204ffa){_0x3092f4['sendStatus'](0x194);}return _0x204ffa;};}function handleError(_0x17aa60,_0x3e9c33){_0x3e9c33=_0x3e9c33||0x1f4;return function(_0x28c5f0){logger['error'](_0x28c5f0[_0x1b1e('0x25')]);if(_0x28c5f0[_0x1b1e('0x26')]){delete _0x28c5f0[_0x1b1e('0x26')];}_0x17aa60[_0x1b1e('0x18')](_0x3e9c33)['send'](_0x28c5f0);};}exports[_0x1b1e('0x27')]=function(_0x41edfb,_0x5272af){var _0xa366b6={},_0x322131={},_0xcab633={'count':0x0,'rows':[]};var _0x2dde58=_[_0x1b1e('0x28')](db[_0x1b1e('0x29')]['rawAttributes'],function(_0x4a46d1){return{'name':_0x4a46d1[_0x1b1e('0x2a')],'type':_0x4a46d1['type'][_0x1b1e('0x2b')]};});_0x322131[_0x1b1e('0x2c')]=_[_0x1b1e('0x28')](_0x2dde58,_0x1b1e('0x26'));_0x322131[_0x1b1e('0x2d')]=_[_0x1b1e('0x2e')](_0x41edfb['query']);_0x322131['filters']=_[_0x1b1e('0x2f')](_0x322131[_0x1b1e('0x2c')],_0x322131[_0x1b1e('0x2d')]);_0xa366b6['attributes']=_['intersection'](_0x322131['model'],qs[_0x1b1e('0x30')](_0x41edfb['query']['fields']));_0xa366b6[_0x1b1e('0x31')]=_0xa366b6[_0x1b1e('0x31')][_0x1b1e('0x32')]?_0xa366b6[_0x1b1e('0x31')]:_0x322131[_0x1b1e('0x2c')];if(!_0x41edfb['query'][_0x1b1e('0x33')](_0x1b1e('0x34'))){_0xa366b6[_0x1b1e('0x1c')]=qs[_0x1b1e('0x1c')](_0x41edfb[_0x1b1e('0x2d')]['limit']);_0xa366b6['offset']=qs['offset'](_0x41edfb[_0x1b1e('0x2d')][_0x1b1e('0x1a')]);}_0xa366b6['order']=qs[_0x1b1e('0x35')](_0x41edfb[_0x1b1e('0x2d')]['sort']);_0xa366b6[_0x1b1e('0x36')]=qs['filters'](_[_0x1b1e('0x37')](_0x41edfb[_0x1b1e('0x2d')],_0x322131['filters']),_0x2dde58);if(_0x41edfb[_0x1b1e('0x2d')]['filter']){_0xa366b6[_0x1b1e('0x36')]=_[_0x1b1e('0x38')](_0xa366b6[_0x1b1e('0x36')],{'$or':_['map'](_0x2dde58,function(_0xa88c0b){if(_0xa88c0b[_0x1b1e('0x39')]!==_0x1b1e('0x3a')){var _0x5c7bd4={};_0x5c7bd4[_0xa88c0b[_0x1b1e('0x26')]]={'$like':'%'+_0x41edfb['query'][_0x1b1e('0x3b')]+'%'};return _0x5c7bd4;}})});}_0xa366b6=_['merge']({},_0xa366b6,_0x41edfb[_0x1b1e('0x3c')]);var _0x2d3a3b={'where':_0xa366b6[_0x1b1e('0x36')]};return db[_0x1b1e('0x29')][_0x1b1e('0x1d')](_0x2d3a3b)[_0x1b1e('0x22')](function(_0x13ce17){_0xcab633[_0x1b1e('0x1d')]=_0x13ce17;if(_0x41edfb[_0x1b1e('0x2d')][_0x1b1e('0x3d')]){_0xa366b6[_0x1b1e('0x3e')]=[{'all':!![]}];}return db[_0x1b1e('0x29')][_0x1b1e('0x3f')](_0xa366b6);})[_0x1b1e('0x22')](function(_0x3648a6){_0xcab633[_0x1b1e('0x40')]=_0x3648a6;return _0xcab633;})[_0x1b1e('0x22')](respondWithFilteredResult(_0x5272af,_0xa366b6))[_0x1b1e('0x41')](handleError(_0x5272af,null));};exports[_0x1b1e('0x42')]=function(_0x129ff8,_0x3f4541){var _0x3c1d28={'raw':![],'where':{'id':_0x129ff8[_0x1b1e('0x43')]['id']}},_0x3c9b96={};_0x3c9b96['model']=_[_0x1b1e('0x2e')](db[_0x1b1e('0x29')][_0x1b1e('0x44')]);_0x3c9b96['query']=_[_0x1b1e('0x2e')](_0x129ff8[_0x1b1e('0x2d')]);_0x3c9b96['filters']=_['intersection'](_0x3c9b96[_0x1b1e('0x2c')],_0x3c9b96['query']);_0x3c1d28['attributes']=_[_0x1b1e('0x2f')](_0x3c9b96[_0x1b1e('0x2c')],qs[_0x1b1e('0x30')](_0x129ff8[_0x1b1e('0x2d')][_0x1b1e('0x30')]));_0x3c1d28['attributes']=_0x3c1d28[_0x1b1e('0x31')]['length']?_0x3c1d28[_0x1b1e('0x31')]:_0x3c9b96['model'];if(_0x129ff8['query'][_0x1b1e('0x3d')]){_0x3c1d28[_0x1b1e('0x3e')]=[{'all':!![]}];}_0x3c1d28=_['merge']({},_0x3c1d28,_0x129ff8[_0x1b1e('0x3c')]);return db[_0x1b1e('0x29')]['find'](_0x3c1d28)[_0x1b1e('0x22')](handleEntityNotFound(_0x3f4541,null))[_0x1b1e('0x22')](respondWithResult(_0x3f4541,null))[_0x1b1e('0x41')](handleError(_0x3f4541,null));};exports[_0x1b1e('0x45')]=function(_0x9e0f1b,_0x42adf3){return db[_0x1b1e('0x29')]['create'](_0x9e0f1b[_0x1b1e('0x46')],{})['then'](function(_0x44091b){var _0xf46491=_0x9e0f1b[_0x1b1e('0x47')]['get']({'plain':!![]});if(!_0xf46491)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf46491[_0x1b1e('0x48')]==='user'){var _0x5951b2=_0x44091b[_0x1b1e('0x49')]({'plain':!![]});var _0x418fc2=_0x1b1e('0x4a');return db[_0x1b1e('0x4b')][_0x1b1e('0x4c')]({'where':{'name':_0x418fc2,'userProfileId':_0xf46491[_0x1b1e('0x4d')]},'raw':!![]})[_0x1b1e('0x22')](function(_0x3e447a){if(_0x3e447a&&_0x3e447a[_0x1b1e('0x4e')]===0x0){return db[_0x1b1e('0x24')][_0x1b1e('0x45')]({'name':_0x5951b2['name'],'resourceId':_0x5951b2['id'],'type':_0x3e447a[_0x1b1e('0x26')],'sectionId':_0x3e447a['id']},{})[_0x1b1e('0x22')](function(){return _0x44091b;});}else{return _0x44091b;}})[_0x1b1e('0x41')](function(_0x2b4739){logger[_0x1b1e('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b4739);throw _0x2b4739;});}return _0x44091b;})[_0x1b1e('0x22')](respondWithResult(_0x42adf3,0xc9))['catch'](handleError(_0x42adf3,null));};exports[_0x1b1e('0x21')]=function(_0x50c927,_0x25d0a1){if(_0x50c927[_0x1b1e('0x46')]['id']){delete _0x50c927['body']['id'];}return db[_0x1b1e('0x29')]['find']({'where':{'id':_0x50c927[_0x1b1e('0x43')]['id']}})[_0x1b1e('0x22')](handleEntityNotFound(_0x25d0a1,null))[_0x1b1e('0x22')](saveUpdates(_0x50c927['body'],null))[_0x1b1e('0x22')](respondWithResult(_0x25d0a1,null))[_0x1b1e('0x41')](handleError(_0x25d0a1,null));};exports['destroy']=function(_0x2d6697,_0x306370){return db[_0x1b1e('0x29')][_0x1b1e('0x4c')]({'where':{'id':_0x2d6697[_0x1b1e('0x43')]['id']}})[_0x1b1e('0x22')](handleEntityNotFound(_0x306370,null))[_0x1b1e('0x22')](removeEntity(_0x306370,null))[_0x1b1e('0x41')](handleError(_0x306370,null));};exports[_0x1b1e('0x50')]=function(_0x31994e,_0x16c670,_0x5ea51f){var _0x40be34=require(_0x1b1e('0x51'));return db['Schedule'][_0x1b1e('0x4c')]({'where':{'id':_0x31994e['params']['id']},'raw':!![]})[_0x1b1e('0x22')](handleEntityNotFound(_0x16c670,null))[_0x1b1e('0x22')](function(){_0x40be34['run'](_0x31994e[_0x1b1e('0x43')]['id']);})[_0x1b1e('0x22')](respondWithStatusCode(_0x16c670,null))['catch'](handleError(_0x16c670,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index a8d4136..dbcceca 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 _0xb555=['moment','bluebird','request-promise','path','../../config/environment','./schedule.attributes','exports','tools_schedules','lodash','util','../../config/logger','api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb555,0x188));var _0x5b55=function(_0x1a06c4,_0x27226e){_0x1a06c4=_0x1a06c4-0x0;var _0x338c20=_0xb555[_0x1a06c4];return _0x338c20;};'use strict';var _=require(_0x5b55('0x0'));var util=require(_0x5b55('0x1'));var logger=require(_0x5b55('0x2'))(_0x5b55('0x3'));var moment=require(_0x5b55('0x4'));var BPromise=require(_0x5b55('0x5'));var rp=require(_0x5b55('0x6'));var fs=require('fs');var path=require(_0x5b55('0x7'));var rimraf=require('rimraf');var config=require(_0x5b55('0x8'));var attributes=require(_0x5b55('0x9'));module[_0x5b55('0xa')]=function(_0x154c17,_0x567c90){return _0x154c17['define']('Schedule',attributes,{'tableName':_0x5b55('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x585b=['path','rimraf','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2884f4,_0x4750f3){var _0x64b4ed=function(_0x565076){while(--_0x565076){_0x2884f4['push'](_0x2884f4['shift']());}};_0x64b4ed(++_0x4750f3);}(_0x585b,0x1db));var _0xb585=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x585b[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0xb585('0x0'));var util=require(_0xb585('0x1'));var logger=require(_0xb585('0x2'))('api');var moment=require(_0xb585('0x3'));var BPromise=require(_0xb585('0x4'));var rp=require(_0xb585('0x5'));var fs=require('fs');var path=require(_0xb585('0x6'));var rimraf=require(_0xb585('0x7'));var config=require('../../config/environment');var attributes=require(_0xb585('0x8'));module[_0xb585('0x9')]=function(_0x192154,_0x8cbb8c){return _0x192154[_0xb585('0xa')](_0xb585('0xb'),attributes,{'tableName':_0xb585('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 c84063d..16aab25 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 _0x54bc=['../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2e4177,_0x4fd5a9){var _0x3a3c66=function(_0x4bfd18){while(--_0x4bfd18){_0x2e4177['push'](_0x2e4177['shift']());}};_0x3a3c66(++_0x4fd5a9);}(_0x54bc,0x1de));var _0xc54b=function(_0x5213ad,_0x2295b5){_0x5213ad=_0x5213ad-0x0;var _0x235a7b=_0x54bc[_0x5213ad];return _0x235a7b;};'use strict';var _=require(_0xc54b('0x0'));var util=require(_0xc54b('0x1'));var moment=require(_0xc54b('0x2'));var BPromise=require('bluebird');var rs=require(_0xc54b('0x3'));var fs=require('fs');var Redis=require(_0xc54b('0x4'));var db=require(_0xc54b('0x5'))['db'];var utils=require(_0xc54b('0x6'));var logger=require(_0xc54b('0x7'))(_0xc54b('0x8'));var config=require(_0xc54b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc54b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14c3d4,_0x19a410,_0x33ecd8){return new BPromise(function(_0x39a414,_0x25e96b){return client['request'](_0x14c3d4,_0x33ecd8)[_0xc54b('0xb')](function(_0x15d5e4){logger[_0xc54b('0xc')](_0xc54b('0xd'),_0x19a410,_0xc54b('0xe'));logger[_0xc54b('0xf')](_0xc54b('0x10'),_0x19a410,_0xc54b('0xe'),JSON['stringify'](_0x15d5e4));if(_0x15d5e4[_0xc54b('0x11')]){if(_0x15d5e4[_0xc54b('0x11')][_0xc54b('0x12')]===0x1f4){logger[_0xc54b('0x11')](_0xc54b('0xd'),_0x19a410,_0x15d5e4[_0xc54b('0x11')][_0xc54b('0x13')]);return _0x25e96b(_0x15d5e4[_0xc54b('0x11')][_0xc54b('0x13')]);}logger[_0xc54b('0x11')](_0xc54b('0xd'),_0x19a410,_0x15d5e4[_0xc54b('0x11')][_0xc54b('0x13')]);return _0x39a414(_0x15d5e4[_0xc54b('0x11')][_0xc54b('0x13')]);}else{logger['info'](_0xc54b('0xd'),_0x19a410,'request\x20sent');_0x39a414(_0x15d5e4[_0xc54b('0x14')][_0xc54b('0x13')]);}})[_0xc54b('0x15')](function(_0x1b1b23){logger[_0xc54b('0x11')](_0xc54b('0xd'),_0x19a410,_0x1b1b23);_0x25e96b(_0x1b1b23);});});} \ No newline at end of file +var _0xad22=['Schedule,\x20%s,\x20%s,\x20%s','stringify','error','Schedule,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug'];(function(_0x1cb77b,_0x5897fa){var _0x16296a=function(_0x5b0ce3){while(--_0x5b0ce3){_0x1cb77b['push'](_0x1cb77b['shift']());}};_0x16296a(++_0x5897fa);}(_0xad22,0x7f));var _0x2ad2=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0xad22[_0x18d5d7];return _0x30a9ea;};'use strict';var _=require(_0x2ad2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2ad2('0x1'));var rs=require(_0x2ad2('0x2'));var fs=require('fs');var Redis=require(_0x2ad2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ad2('0x4'));var logger=require(_0x2ad2('0x5'))(_0x2ad2('0x6'));var config=require(_0x2ad2('0x7'));var jayson=require(_0x2ad2('0x8'));var client=jayson[_0x2ad2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1475b8,_0x5a96b5,_0x5cf402){return new BPromise(function(_0x9fad56,_0x58757d){return client['request'](_0x1475b8,_0x5cf402)['then'](function(_0x571147){logger[_0x2ad2('0xa')]('Schedule,\x20%s,\x20%s',_0x5a96b5,_0x2ad2('0xb'));logger[_0x2ad2('0xc')](_0x2ad2('0xd'),_0x5a96b5,_0x2ad2('0xb'),JSON[_0x2ad2('0xe')](_0x571147));if(_0x571147['error']){if(_0x571147[_0x2ad2('0xf')]['code']===0x1f4){logger[_0x2ad2('0xf')](_0x2ad2('0x10'),_0x5a96b5,_0x571147[_0x2ad2('0xf')]['message']);return _0x58757d(_0x571147[_0x2ad2('0xf')][_0x2ad2('0x11')]);}logger['error'](_0x2ad2('0x10'),_0x5a96b5,_0x571147[_0x2ad2('0xf')][_0x2ad2('0x11')]);return _0x9fad56(_0x571147[_0x2ad2('0xf')]['message']);}else{logger['info'](_0x2ad2('0x10'),_0x5a96b5,_0x2ad2('0xb'));_0x9fad56(_0x571147[_0x2ad2('0x12')][_0x2ad2('0x11')]);}})[_0x2ad2('0x13')](function(_0x4bc6c0){logger['error'](_0x2ad2('0x10'),_0x5a96b5,_0x4bc6c0);_0x58757d(_0x4bc6c0);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index a9a6cb6..ca5f6ea 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 _0x281e=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','create','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x281e,0xd3));var _0xe281=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x281e[_0x2642cb];return _0xe6e41;};'use strict';var multer=require(_0xe281('0x0'));var util=require('util');var path=require(_0xe281('0x1'));var timeout=require(_0xe281('0x2'));var express=require(_0xe281('0x3'));var router=express[_0xe281('0x4')]();var fs_extra=require(_0xe281('0x5'));var auth=require(_0xe281('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe281('0x7'));var controller=require(_0xe281('0x8'));router[_0xe281('0x9')]('/',auth[_0xe281('0xa')](),controller['index']);router['get'](_0xe281('0xb'),auth[_0xe281('0xa')](),controller[_0xe281('0xc')]);router[_0xe281('0x9')](_0xe281('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe281('0x9')](_0xe281('0xe'),auth['isAuthenticated'](),controller[_0xe281('0xf')]);router[_0xe281('0x10')]('/',auth[_0xe281('0xa')](),controller[_0xe281('0x11')]);router[_0xe281('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xe281('0x13')]);router[_0xe281('0x14')](_0xe281('0xd'),auth[_0xe281('0xa')](),controller[_0xe281('0x15')]);module[_0xe281('0x16')]=router; \ No newline at end of file +var _0x7afb=['/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','/describe','get','/:id/download','put'];(function(_0x5c8edb,_0x105253){var _0x5a1451=function(_0x5371f8){while(--_0x5371f8){_0x5c8edb['push'](_0x5c8edb['shift']());}};_0x5a1451(++_0x105253);}(_0x7afb,0x7c));var _0xb7af=function(_0x1f74be,_0x22747c){_0x1f74be=_0x1f74be-0x0;var _0x51c43f=_0x7afb[_0x1f74be];return _0x51c43f;};'use strict';var multer=require(_0xb7af('0x0'));var util=require(_0xb7af('0x1'));var path=require(_0xb7af('0x2'));var timeout=require(_0xb7af('0x3'));var express=require(_0xb7af('0x4'));var router=express[_0xb7af('0x5')]();var fs_extra=require(_0xb7af('0x6'));var auth=require(_0xb7af('0x7'));var interaction=require(_0xb7af('0x8'));var config=require(_0xb7af('0x9'));var controller=require(_0xb7af('0xa'));router['get']('/',auth[_0xb7af('0xb')](),controller['index']);router['get'](_0xb7af('0xc'),auth[_0xb7af('0xb')](),controller['describe']);router[_0xb7af('0xd')]('/:id',auth[_0xb7af('0xb')](),controller['show']);router['get'](_0xb7af('0xe'),auth[_0xb7af('0xb')](),controller['download']);router['post']('/',auth[_0xb7af('0xb')](),controller['create']);router[_0xb7af('0xf')](_0xb7af('0x10'),auth['isAuthenticated'](),controller[_0xb7af('0x11')]);router[_0xb7af('0x12')]('/:id',auth[_0xb7af('0xb')](),controller[_0xb7af('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 0eea8bd..2e812f4 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 _0x3a6d=['format','MM-DD-YYYY\x20HH:mm','createdAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','toString'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x3a6d,0x143));var _0xd3a6=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x3a6d[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require(_0xd3a6('0x0'));var moment=require(_0xd3a6('0x1'));var path=require('path');var config=require(_0xd3a6('0x2'));module[_0xd3a6('0x3')]={'format':{'type':Sequelize[_0xd3a6('0x4')],'get':function(){return this[_0xd3a6('0x5')](_0xd3a6('0x6'))?path['extname'](this[_0xd3a6('0x5')](_0xd3a6('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xd3a6('0x7')]},'channel':{'type':Sequelize[_0xd3a6('0x7')]},'value':{'type':Sequelize[_0xd3a6('0x7')],'set':function(_0x282cb1){var _0x58d83a=_0x282cb1[_0xd3a6('0x8')](/\\/g,'/');this[_0xd3a6('0x9')](_0xd3a6('0x6'),_0x58d83a);}},'rating':{'type':Sequelize[_0xd3a6('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xd3a6('0xa')],'set':function(_0xa67661){this[_0xd3a6('0x9')](_0xd3a6('0xb'),moment()[_0xd3a6('0xc')](_0xa67661,'ms'));this['setDataValue'](_0xd3a6('0xd'),moment());this[_0xd3a6('0x9')](_0xd3a6('0xe'),_0xa67661);}},'startedAt':{'type':Sequelize[_0xd3a6('0xf')],'get':function(){return moment(this[_0xd3a6('0x5')]('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0xd3a6('0x10')]();}},'closedAt':{'type':Sequelize[_0xd3a6('0xf')],'get':function(){return moment(this[_0xd3a6('0x5')](_0xd3a6('0xd')))[_0xd3a6('0x11')](_0xd3a6('0x12'))[_0xd3a6('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xd3a6('0x5')](_0xd3a6('0x13')))[_0xd3a6('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xd3a6('0x10')]();}},'updatedAt':{'type':Sequelize[_0xd3a6('0xf')],'get':function(){return moment(this[_0xd3a6('0x5')]('updatedAt'))[_0xd3a6('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0xaa56=['../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','moment','path'];(function(_0x2434de,_0x4d7bbf){var _0x443fb1=function(_0x301d85){while(--_0x301d85){_0x2434de['push'](_0x2434de['shift']());}};_0x443fb1(++_0x4d7bbf);}(_0xaa56,0xc6));var _0x6aa5=function(_0xa30912,_0x264219){_0xa30912=_0xa30912-0x0;var _0x488a23=_0xaa56[_0xa30912];return _0x488a23;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6aa5('0x0'));var path=require(_0x6aa5('0x1'));var config=require(_0x6aa5('0x2'));module['exports']={'format':{'type':Sequelize[_0x6aa5('0x3')],'get':function(){return this[_0x6aa5('0x4')](_0x6aa5('0x5'))?path[_0x6aa5('0x6')](this[_0x6aa5('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x6aa5('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x6aa5('0x7')],'set':function(_0x20f6ba){var _0x5764dc=_0x20f6ba[_0x6aa5('0x8')](/\\/g,'/');this[_0x6aa5('0x9')](_0x6aa5('0x5'),_0x5764dc);}},'rating':{'type':Sequelize[_0x6aa5('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x6aa5('0xa')],'set':function(_0x3d50a0){this[_0x6aa5('0x9')](_0x6aa5('0xb'),moment()[_0x6aa5('0xc')](_0x3d50a0,'ms'));this[_0x6aa5('0x9')](_0x6aa5('0xd'),moment());this[_0x6aa5('0x9')](_0x6aa5('0xe'),_0x3d50a0);}},'startedAt':{'type':Sequelize[_0x6aa5('0xf')],'get':function(){return moment(this['getDataValue'](_0x6aa5('0xb')))[_0x6aa5('0x10')](_0x6aa5('0x11'))[_0x6aa5('0x12')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x6aa5('0x10')](_0x6aa5('0x11'))[_0x6aa5('0x12')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x6aa5('0x4')](_0x6aa5('0x13')))['format'](_0x6aa5('0x11'))[_0x6aa5('0x12')]();}},'updatedAt':{'type':Sequelize[_0x6aa5('0xf')],'get':function(){return moment(this[_0x6aa5('0x4')]('updatedAt'))['format'](_0x6aa5('0x11'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 7a744d7..07ecc2a 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 _0x00bb=['json','undefined','limit','offset','apply','reject','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ScreenRecording','count','then','includeAll','include','rows','catch','show','params','length','options','find','body','createdAt','closedAt','value','describe','download','uniqueid','join','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status'];(function(_0x274662,_0xf97b62){var _0xca337e=function(_0x480385){while(--_0x480385){_0x274662['push'](_0x274662['shift']());}};_0xca337e(++_0xf97b62);}(_0x00bb,0x1d8));var _0xb00b=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x00bb[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){_0x2896d1[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();});}};}function handleEntityNotFound(_0x3c9500,_0x8caadf){return function(_0x520e55){if(!_0x520e55){_0x3c9500['sendStatus'](0x194);}return _0x520e55;};}function handleError(_0x3785e9,_0x490380){_0x490380=_0x490380||0x1f4;return function(_0x550587){logger['error'](_0x550587[_0xb00b('0x20')]);if(_0x550587[_0xb00b('0x21')]){delete _0x550587[_0xb00b('0x21')];}_0x3785e9[_0xb00b('0x16')](_0x490380)[_0xb00b('0x22')](_0x550587);};}exports[_0xb00b('0x23')]=function(_0x15d3b9,_0x4a8d2b){var _0x22c22d={},_0x503c9c={},_0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x24')](db['ScreenRecording'][_0xb00b('0x25')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x26')],'type':_0x280ed3[_0xb00b('0x27')][_0xb00b('0x28')]};});_0x503c9c[_0xb00b('0x29')]=_[_0xb00b('0x2a')](_[_0xb00b('0x24')](_0x348165,_0xb00b('0x21')),['format']);_0x503c9c[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x15d3b9['query']);_0x503c9c[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x503c9c['model'],_0x503c9c[_0xb00b('0x2b')]);_0x22c22d['attributes']=_[_0xb00b('0x2e')](_0x503c9c[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x22c22d[_0xb00b('0x30')]=_0x22c22d[_0xb00b('0x30')]['length']?_0x22c22d['attributes']:_0x503c9c['model'];if(!_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x22c22d[_0xb00b('0x19')]=qs['limit'](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x22c22d[_0xb00b('0x1a')]=qs[_0xb00b('0x1a')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x1a')]);}_0x22c22d[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x15d3b9['query']['sort']);_0x22c22d[_0xb00b('0x35')]=qs['filters'](_[_0xb00b('0x36')](_0x15d3b9[_0xb00b('0x2b')],_0x503c9c[_0xb00b('0x2d')]),_0x348165);if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x22c22d[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x22c22d['where'],{'$or':_[_0xb00b('0x24')](_0x348165,function(_0x25578e){if(_0x25578e[_0xb00b('0x27')]!==_0xb00b('0x39')){var _0x2496e2={};_0x2496e2[_0x25578e[_0xb00b('0x21')]]={'$like':'%'+_0x15d3b9['query'][_0xb00b('0x37')]+'%'};return _0x2496e2;}})});}_0x22c22d=_[_0xb00b('0x38')]({},_0x22c22d,_0x15d3b9['options']);var _0x17ff34={'where':_0x22c22d[_0xb00b('0x35')]};return db[_0xb00b('0x3a')][_0xb00b('0x3b')](_0x17ff34)[_0xb00b('0x3c')](function(_0x5636b1){_0x450129[_0xb00b('0x3b')]=_0x5636b1;if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x3d')]){_0x22c22d[_0xb00b('0x3e')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x22c22d);})[_0xb00b('0x3c')](function(_0xf6ae0c){_0x450129[_0xb00b('0x3f')]=_0xf6ae0c;return _0x450129;})[_0xb00b('0x3c')](respondWithFilteredResult(_0x4a8d2b,_0x22c22d))[_0xb00b('0x40')](handleError(_0x4a8d2b,null));};exports[_0xb00b('0x41')]=function(_0x275664,_0x493841){var _0x36200d={'raw':![],'where':{'id':_0x275664[_0xb00b('0x42')]['id']}},_0x3b72c4={};_0x3b72c4[_0xb00b('0x29')]=_[_0xb00b('0x2c')](db[_0xb00b('0x3a')][_0xb00b('0x25')]);_0x3b72c4[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x275664[_0xb00b('0x2b')]);_0x3b72c4[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x3b72c4['model'],_0x3b72c4[_0xb00b('0x2b')]);_0x36200d[_0xb00b('0x30')]=_[_0xb00b('0x2e')](_0x3b72c4[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x275664[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x36200d[_0xb00b('0x30')]=_0x36200d[_0xb00b('0x30')][_0xb00b('0x43')]?_0x36200d[_0xb00b('0x30')]:_0x3b72c4[_0xb00b('0x29')];if(_0x275664['query']['includeAll']){_0x36200d['include']=[{'all':!![]}];}_0x36200d=_[_0xb00b('0x38')]({},_0x36200d,_0x275664[_0xb00b('0x44')]);return db['ScreenRecording'][_0xb00b('0x45')](_0x36200d)[_0xb00b('0x3c')](handleEntityNotFound(_0x493841,null))[_0xb00b('0x3c')](respondWithResult(_0x493841,null))[_0xb00b('0x40')](handleError(_0x493841,null));};exports['create']=function(_0x58e9cb,_0x172729){return db[_0xb00b('0x3a')]['create'](_0x58e9cb['body'],{})[_0xb00b('0x3c')](respondWithResult(_0x172729,0xc9))[_0xb00b('0x40')](handleError(_0x172729,null));};exports['update']=function(_0x2228e9,_0x47a814){if(_0x2228e9['body']['id']){delete _0x2228e9['body']['id'];}delete _0x2228e9[_0xb00b('0x46')]['duration'];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x47')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x48')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x49')];return db['ScreenRecording']['find']({'where':{'id':_0x2228e9[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](handleEntityNotFound(_0x47a814,null))['then'](saveUpdates(_0x2228e9[_0xb00b('0x46')],null))[_0xb00b('0x3c')](respondWithResult(_0x47a814,null))['catch'](handleError(_0x47a814,null));};exports[_0xb00b('0x4a')]=function(_0x10e066,_0x3b5d82){return db['ScreenRecording']['describe']()[_0xb00b('0x3c')](respondWithResult(_0x3b5d82,null))[_0xb00b('0x40')](handleError(_0x3b5d82,null));};exports[_0xb00b('0x4b')]=function(_0xde3cc1,_0x489b49,_0x380acb){var _0x3f31e5=require('../../components/encryptor');var _0x4cd9fd=![];var _0x160965={};if(_0xde3cc1['query'][_0xb00b('0x27')]&&_0xde3cc1[_0xb00b('0x2b')][_0xb00b('0x27')]===_0xb00b('0x4c')){_0x160965[_0xb00b('0x4c')]=_0xde3cc1[_0xb00b('0x42')]['id'];}else{_0x160965['id']=_0xde3cc1['params']['id'];}return db[_0xb00b('0x3a')]['find']({'where':_0x160965,'attributes':['id',_0xb00b('0x49')],'raw':!![]})[_0xb00b('0x3c')](handleEntityNotFound(_0x489b49,null))[_0xb00b('0x3c')](function(_0x5ac79e){if(_0x5ac79e){var _0x248335=path[_0xb00b('0x4d')](config[_0xb00b('0x4e')],'server/files/screen_recordings',_0x5ac79e[_0xb00b('0x49')]);var _0x309ae6=util[_0xb00b('0x4f')](_0xb00b('0x50'),_0x248335);if(fs[_0xb00b('0x51')](_0x309ae6)){_0x4cd9fd=!![];return _0x3f31e5[_0xb00b('0x52')](_0x309ae6,_0x248335,config[_0xb00b('0x53')][_0xb00b('0x54')])['then'](function(){return _0x5ac79e;});}return _0x5ac79e;}})[_0xb00b('0x3c')](function(_0x2cbe80){if(_0x2cbe80){var _0x1b4860=path['join'](config[_0xb00b('0x4e')],_0xb00b('0x55'),_0x2cbe80[_0xb00b('0x49')]);if(!fs[_0xb00b('0x51')](_0x1b4860)){throw new db[(_0xb00b('0x56'))]['ValidationError'](_0xb00b('0x57'));}if(_0x2cbe80[_0xb00b('0x58')]){return _0x489b49[_0xb00b('0x4b')](_0x1b4860,_0x2cbe80[_0xb00b('0x58')]+path['extname'](_0x1b4860),function(){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}else{return _0x489b49[_0xb00b('0x4b')](_0x1b4860,function(_0x2c93db){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}}})[_0xb00b('0x40')](function(_0x1e5ed8){if(_0x1e5ed8[_0xb00b('0x5a')]==='ScreenRecording\x20not\x20found'){_0x489b49[_0xb00b('0x16')](0x194)['send'](_0xb00b('0x5b'));}else{return handleError(_0x489b49,null);}});};exports['destroy']=function(_0x3b3272,_0x530d4a){return db[_0xb00b('0x3a')]['find']({'where':{'id':_0x3b3272[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](function(_0x3bae02){if(_['isNil'](_0x3bae02)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3bae02;})['then'](function(_0x21a53d){var _0x3126be=path[_0xb00b('0x4d')](config['root'],_0xb00b('0x55'),_0x21a53d[_0xb00b('0x49')]);logger[_0xb00b('0x5c')](_0xb00b('0x5d'),_0x3126be);if(!_[_0xb00b('0x5e')](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')]('File:\x20\x22'+_0x3126be+_0xb00b('0x5f'));fs[_0xb00b('0x60')](_0x3126be);}_0x3126be=_0x3126be+_0xb00b('0x61');if(!_['isNil'](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')](_0xb00b('0x62')+_0x3126be+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3126be);}return _0x21a53d;})['then'](function(_0x5e9677){if(!_0x5e9677)throw new InternalError();return _0x5e9677[_0xb00b('0x1e')]();})['then'](function(){_0x530d4a[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();})['catch'](handleError(_0x530d4a,null));}; \ No newline at end of file +var _0x4c4e=['findAll','rows','catch','params','keys','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include'];(function(_0x489b87,_0xd51c93){var _0x1823b6=function(_0x451c70){while(--_0x451c70){_0x489b87['push'](_0x489b87['shift']());}};_0x1823b6(++_0xd51c93);}(_0x4c4e,0x152));var _0xe4c4=function(_0x394a99,_0x26cb6a){_0x394a99=_0x394a99-0x0;var _0x269d9c=_0x4c4e[_0x394a99];return _0x269d9c;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];function respondWithStatusCode(_0x50bfab,_0x262083){_0x262083=_0x262083||0xcc;return function(_0x115802){if(_0x115802){return _0x50bfab['sendStatus'](_0x262083);}return _0x50bfab[_0xe4c4('0x1a')](_0x262083)[_0xe4c4('0x1b')]();};}function respondWithResult(_0x5aa89b,_0x42ce9e){_0x42ce9e=_0x42ce9e||0xc8;return function(_0x29766a){if(_0x29766a){return _0x5aa89b['status'](_0x42ce9e)[_0xe4c4('0x1c')](_0x29766a);}};}function respondWithFilteredResult(_0x465c9b,_0x26ea05){return function(_0x40a36e){if(_0x40a36e){var _0x19e59b=typeof _0x26ea05[_0xe4c4('0x1d')]===_0xe4c4('0x1e')&&typeof _0x26ea05[_0xe4c4('0x1f')]===_0xe4c4('0x1e');var _0x36b10c=_0x40a36e[_0xe4c4('0x20')];var _0x42242c=_0x19e59b?0x0:_0x26ea05[_0xe4c4('0x1d')];var _0x43a9ce=_0x19e59b?_0x40a36e[_0xe4c4('0x20')]:_0x26ea05['offset']+_0x26ea05[_0xe4c4('0x1f')];var _0x24f946;if(_0x43a9ce>=_0x36b10c){_0x43a9ce=_0x36b10c;_0x24f946=0xc8;}else{_0x24f946=0xce;}_0x465c9b[_0xe4c4('0x1a')](_0x24f946);return _0x465c9b[_0xe4c4('0x21')]('Content-Range',_0x42242c+'-'+_0x43a9ce+'/'+_0x36b10c)[_0xe4c4('0x1c')](_0x40a36e);}return null;};}function patchUpdates(_0x1cad5d){return function(_0x1727eb){try{jsonpatch[_0xe4c4('0x22')](_0x1727eb,_0x1cad5d,!![]);}catch(_0x2c5aea){return BPromise[_0xe4c4('0x23')](_0x2c5aea);}return _0x1727eb[_0xe4c4('0x24')]();};}function saveUpdates(_0x393c96,_0x21bbb1){return function(_0x1a7690){if(_0x1a7690){return _0x1a7690[_0xe4c4('0x25')](_0x393c96)[_0xe4c4('0x26')](function(_0x138ead){return _0x138ead;});}return null;};}function removeEntity(_0x1db719,_0x15873e){return function(_0x59498e){if(_0x59498e){return _0x59498e['destroy']()[_0xe4c4('0x26')](function(){_0x1db719['status'](0xcc)[_0xe4c4('0x1b')]();});}};}function handleEntityNotFound(_0x5374fd,_0x3adfcb){return function(_0x5efc4c){if(!_0x5efc4c){_0x5374fd[_0xe4c4('0x27')](0x194);}return _0x5efc4c;};}function handleError(_0x583393,_0xba53ef){_0xba53ef=_0xba53ef||0x1f4;return function(_0x4a0199){logger['error'](_0x4a0199['stack']);if(_0x4a0199['name']){delete _0x4a0199[_0xe4c4('0x28')];}_0x583393['status'](_0xba53ef)['send'](_0x4a0199);};}exports[_0xe4c4('0x29')]=function(_0x11deab,_0x4bb911){var _0x57ba43={},_0x7428ad={},_0x33de43={'count':0x0,'rows':[]};var _0x4aa6c1=_[_0xe4c4('0x2a')](db[_0xe4c4('0x2b')][_0xe4c4('0x2c')],function(_0x48060e){return{'name':_0x48060e['fieldName'],'type':_0x48060e[_0xe4c4('0x2d')][_0xe4c4('0x2e')]};});_0x7428ad[_0xe4c4('0x2f')]=_[_0xe4c4('0x30')](_['map'](_0x4aa6c1,'name'),[_0xe4c4('0x31')]);_0x7428ad[_0xe4c4('0x32')]=_['keys'](_0x11deab[_0xe4c4('0x32')]);_0x7428ad[_0xe4c4('0x33')]=_[_0xe4c4('0x34')](_0x7428ad['model'],_0x7428ad[_0xe4c4('0x32')]);_0x57ba43['attributes']=_[_0xe4c4('0x34')](_0x7428ad[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0x57ba43[_0xe4c4('0x36')]=_0x57ba43[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0x57ba43[_0xe4c4('0x36')]:_0x7428ad[_0xe4c4('0x2f')];if(!_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x38')]('nolimit')){_0x57ba43[_0xe4c4('0x1f')]=qs[_0xe4c4('0x1f')](_0x11deab[_0xe4c4('0x32')]['limit']);_0x57ba43[_0xe4c4('0x1d')]=qs[_0xe4c4('0x1d')](_0x11deab[_0xe4c4('0x32')]['offset']);}_0x57ba43[_0xe4c4('0x39')]=qs[_0xe4c4('0x3a')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x3a')]);_0x57ba43[_0xe4c4('0x3b')]=qs[_0xe4c4('0x33')](_[_0xe4c4('0x3c')](_0x11deab[_0xe4c4('0x32')],_0x7428ad[_0xe4c4('0x33')]),_0x4aa6c1);if(_0x11deab[_0xe4c4('0x32')]['filter']){_0x57ba43[_0xe4c4('0x3b')]=_[_0xe4c4('0x3d')](_0x57ba43[_0xe4c4('0x3b')],{'$or':_[_0xe4c4('0x2a')](_0x4aa6c1,function(_0x4c5551){if(_0x4c5551[_0xe4c4('0x2d')]!==_0xe4c4('0x3e')){var _0x4e6bd9={};_0x4e6bd9[_0x4c5551[_0xe4c4('0x28')]]={'$like':'%'+_0x11deab[_0xe4c4('0x32')]['filter']+'%'};return _0x4e6bd9;}})});}_0x57ba43=_[_0xe4c4('0x3d')]({},_0x57ba43,_0x11deab[_0xe4c4('0x3f')]);var _0x127bcd={'where':_0x57ba43[_0xe4c4('0x3b')]};return db[_0xe4c4('0x2b')][_0xe4c4('0x20')](_0x127bcd)[_0xe4c4('0x26')](function(_0x43201e){_0x33de43[_0xe4c4('0x20')]=_0x43201e;if(_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x40')]){_0x57ba43[_0xe4c4('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xe4c4('0x42')](_0x57ba43);})[_0xe4c4('0x26')](function(_0x2b306d){_0x33de43[_0xe4c4('0x43')]=_0x2b306d;return _0x33de43;})[_0xe4c4('0x26')](respondWithFilteredResult(_0x4bb911,_0x57ba43))[_0xe4c4('0x44')](handleError(_0x4bb911,null));};exports['show']=function(_0x312a49,_0x526bef){var _0xca07dc={'raw':![],'where':{'id':_0x312a49[_0xe4c4('0x45')]['id']}},_0x3c067a={};_0x3c067a[_0xe4c4('0x2f')]=_[_0xe4c4('0x46')](db['ScreenRecording']['rawAttributes']);_0x3c067a[_0xe4c4('0x32')]=_[_0xe4c4('0x46')](_0x312a49[_0xe4c4('0x32')]);_0x3c067a['filters']=_[_0xe4c4('0x34')](_0x3c067a[_0xe4c4('0x2f')],_0x3c067a[_0xe4c4('0x32')]);_0xca07dc[_0xe4c4('0x36')]=_['intersection'](_0x3c067a[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x312a49[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0xca07dc[_0xe4c4('0x36')]=_0xca07dc[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0xca07dc[_0xe4c4('0x36')]:_0x3c067a[_0xe4c4('0x2f')];if(_0x312a49['query'][_0xe4c4('0x40')]){_0xca07dc['include']=[{'all':!![]}];}_0xca07dc=_[_0xe4c4('0x3d')]({},_0xca07dc,_0x312a49[_0xe4c4('0x3f')]);return db[_0xe4c4('0x2b')][_0xe4c4('0x47')](_0xca07dc)[_0xe4c4('0x26')](handleEntityNotFound(_0x526bef,null))[_0xe4c4('0x26')](respondWithResult(_0x526bef,null))[_0xe4c4('0x44')](handleError(_0x526bef,null));};exports[_0xe4c4('0x48')]=function(_0x36f8ad,_0x18fb82){return db[_0xe4c4('0x2b')][_0xe4c4('0x48')](_0x36f8ad[_0xe4c4('0x49')],{})[_0xe4c4('0x26')](respondWithResult(_0x18fb82,0xc9))['catch'](handleError(_0x18fb82,null));};exports['update']=function(_0xe0e351,_0x198961){if(_0xe0e351['body']['id']){delete _0xe0e351[_0xe4c4('0x49')]['id'];}delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4a')];delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4b')];delete _0xe0e351['body'][_0xe4c4('0x4c')];delete _0xe0e351[_0xe4c4('0x49')]['value'];return db[_0xe4c4('0x2b')][_0xe4c4('0x47')]({'where':{'id':_0xe0e351['params']['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x198961,null))['then'](saveUpdates(_0xe0e351[_0xe4c4('0x49')],null))[_0xe4c4('0x26')](respondWithResult(_0x198961,null))[_0xe4c4('0x44')](handleError(_0x198961,null));};exports[_0xe4c4('0x4d')]=function(_0x12eaed,_0x525534){return db[_0xe4c4('0x2b')][_0xe4c4('0x4d')]()[_0xe4c4('0x26')](respondWithResult(_0x525534,null))[_0xe4c4('0x44')](handleError(_0x525534,null));};exports[_0xe4c4('0x4e')]=function(_0x32a50e,_0x3ddcbe,_0x3aa205){var _0x1a96ba=require(_0xe4c4('0x4f'));var _0x1fe354=![];var _0x1940e3={};if(_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]&&_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]==='uniqueid'){_0x1940e3[_0xe4c4('0x50')]=_0x32a50e[_0xe4c4('0x45')]['id'];}else{_0x1940e3['id']=_0x32a50e[_0xe4c4('0x45')]['id'];}return db['ScreenRecording'][_0xe4c4('0x47')]({'where':_0x1940e3,'attributes':['id',_0xe4c4('0x51')],'raw':!![]})[_0xe4c4('0x26')](handleEntityNotFound(_0x3ddcbe,null))['then'](function(_0x45f959){if(_0x45f959){var _0x485c50=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x45f959['value']);var _0x479361=util[_0xe4c4('0x31')](_0xe4c4('0x55'),_0x485c50);if(fs[_0xe4c4('0x56')](_0x479361)){_0x1fe354=!![];return _0x1a96ba['decryptFile'](_0x479361,_0x485c50,config[_0xe4c4('0x57')]['recording'])['then'](function(){return _0x45f959;});}return _0x45f959;}})['then'](function(_0x4e08ec){if(_0x4e08ec){var _0x1ca931=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x4e08ec[_0xe4c4('0x51')]);if(!fs[_0xe4c4('0x56')](_0x1ca931)){throw new db['Sequelize'][(_0xe4c4('0x58'))](_0xe4c4('0x59'));}if(_0x4e08ec[_0xe4c4('0x5a')]){return _0x3ddcbe[_0xe4c4('0x4e')](_0x1ca931,_0x4e08ec[_0xe4c4('0x5a')]+path[_0xe4c4('0x5b')](_0x1ca931),function(){if(_0x1fe354){fs['unlink'](_0x1ca931);}});}else{return _0x3ddcbe['download'](_0x1ca931,function(_0x27599b){if(_0x1fe354){fs[_0xe4c4('0x5c')](_0x1ca931);}});}}})[_0xe4c4('0x44')](function(_0x3c8e44){if(_0x3c8e44[_0xe4c4('0x5d')]===_0xe4c4('0x59')){_0x3ddcbe[_0xe4c4('0x1a')](0x194)[_0xe4c4('0x5e')](_0xe4c4('0x5f'));}else{return handleError(_0x3ddcbe,null);}});};exports['destroy']=function(_0x59f033,_0x5a4138){return db['ScreenRecording'][_0xe4c4('0x47')]({'where':{'id':_0x59f033[_0xe4c4('0x45')]['id']}})[_0xe4c4('0x26')](function(_0x58f2dd){if(_[_0xe4c4('0x60')](_0x58f2dd)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58f2dd;})[_0xe4c4('0x26')](function(_0x56ead3){var _0x5d6c0a=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x56ead3['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5d6c0a);if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs['existsSync'](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}_0x5d6c0a=_0x5d6c0a+'.cypher';if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs[_0xe4c4('0x56')](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}return _0x56ead3;})[_0xe4c4('0x26')](function(_0x1bddd5){if(!_0x1bddd5)throw new InternalError();return _0x1bddd5[_0xe4c4('0x64')]();})['then'](function(){_0x5a4138[_0xe4c4('0x1a')](0xcc)[_0xe4c4('0x1b')]();})[_0xe4c4('0x44')](handleError(_0x5a4138,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index cbee65c..913f0fe 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 _0x2794=['define','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./screenRecording.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2794,0xe0));var _0x4279=function(_0x4e6c5b,_0x135c5b){_0x4e6c5b=_0x4e6c5b-0x0;var _0x128a2d=_0x2794[_0x4e6c5b];return _0x128a2d;};'use strict';var _=require(_0x4279('0x0'));var util=require(_0x4279('0x1'));var logger=require(_0x4279('0x2'))(_0x4279('0x3'));var moment=require(_0x4279('0x4'));var BPromise=require(_0x4279('0x5'));var rp=require(_0x4279('0x6'));var fs=require('fs');var path=require(_0x4279('0x7'));var rimraf=require(_0x4279('0x8'));var config=require('../../config/environment');var attributes=require(_0x4279('0x9'));module['exports']=function(_0x14fc2f,_0x1bea8f){return _0x14fc2f[_0x4279('0xa')]('ScreenRecording',attributes,{'tableName':_0x4279('0xb'),'paranoid':![],'indexes':[{'name':_0x4279('0xc'),'fields':[_0x4279('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ac6=['screen_recordings','interactionid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x4653d8,_0x122e74){var _0x3c67d9=function(_0x4b4c0c){while(--_0x4b4c0c){_0x4653d8['push'](_0x4653d8['shift']());}};_0x3c67d9(++_0x122e74);}(_0x0ac6,0x10c));var _0x60ac=function(_0x14935e,_0x2de650){_0x14935e=_0x14935e-0x0;var _0x15b3bc=_0x0ac6[_0x14935e];return _0x15b3bc;};'use strict';var _=require('lodash');var util=require(_0x60ac('0x0'));var logger=require(_0x60ac('0x1'))(_0x60ac('0x2'));var moment=require(_0x60ac('0x3'));var BPromise=require(_0x60ac('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x60ac('0x5'));var rimraf=require(_0x60ac('0x6'));var config=require(_0x60ac('0x7'));var attributes=require(_0x60ac('0x8'));module[_0x60ac('0x9')]=function(_0xe0a957,_0x5bc46e){return _0xe0a957[_0x60ac('0xa')](_0x60ac('0xb'),attributes,{'tableName':_0x60ac('0xc'),'paranoid':![],'indexes':[{'name':_0x60ac('0xd'),'fields':[_0x60ac('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index f0946ab..98fb8db 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 _0x04fb=['../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xae40c9,_0x36b4ec){var _0x5c638d=function(_0x320b20){while(--_0x320b20){_0xae40c9['push'](_0xae40c9['shift']());}};_0x5c638d(++_0x36b4ec);}(_0x04fb,0x198));var _0xb04f=function(_0x312c9f,_0x53525b){_0x312c9f=_0x312c9f-0x0;var _0x2eed62=_0x04fb[_0x312c9f];return _0x2eed62;};'use strict';var _=require('lodash');var util=require(_0xb04f('0x0'));var moment=require(_0xb04f('0x1'));var BPromise=require(_0xb04f('0x2'));var rs=require(_0xb04f('0x3'));var fs=require('fs');var Redis=require(_0xb04f('0x4'));var db=require(_0xb04f('0x5'))['db'];var utils=require(_0xb04f('0x6'));var logger=require(_0xb04f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb04f('0x8'));var client=jayson['client'][_0xb04f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x76764f,_0x3d79e0,_0x3b045f){return new BPromise(function(_0x14dec5,_0x34172c){return client[_0xb04f('0xa')](_0x76764f,_0x3b045f)[_0xb04f('0xb')](function(_0xcf3ae6){logger[_0xb04f('0xc')](_0xb04f('0xd'),_0x3d79e0,_0xb04f('0xe'));logger[_0xb04f('0xf')](_0xb04f('0x10'),_0x3d79e0,'request\x20sent',JSON[_0xb04f('0x11')](_0xcf3ae6));if(_0xcf3ae6['error']){if(_0xcf3ae6[_0xb04f('0x12')][_0xb04f('0x13')]===0x1f4){logger['error'](_0xb04f('0xd'),_0x3d79e0,_0xcf3ae6[_0xb04f('0x12')]['message']);return _0x34172c(_0xcf3ae6[_0xb04f('0x12')]['message']);}logger['error'](_0xb04f('0xd'),_0x3d79e0,_0xcf3ae6['error']['message']);return _0x14dec5(_0xcf3ae6[_0xb04f('0x12')][_0xb04f('0x14')]);}else{logger['info'](_0xb04f('0xd'),_0x3d79e0,_0xb04f('0xe'));_0x14dec5(_0xcf3ae6[_0xb04f('0x15')][_0xb04f('0x14')]);}})[_0xb04f('0x16')](function(_0x3ca6d8){logger[_0xb04f('0x12')](_0xb04f('0xd'),_0x3d79e0,_0x3ca6d8);_0x34172c(_0x3ca6d8);});});} \ No newline at end of file +var _0x1aa3=['http','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x2d1f6e,_0x13fdc7){var _0x421074=function(_0x521ea){while(--_0x521ea){_0x2d1f6e['push'](_0x2d1f6e['shift']());}};_0x421074(++_0x13fdc7);}(_0x1aa3,0x103));var _0x31aa=function(_0x51f99e,_0x70684d){_0x51f99e=_0x51f99e-0x0;var _0x5b12cd=_0x1aa3[_0x51f99e];return _0x5b12cd;};'use strict';var _=require('lodash');var util=require(_0x31aa('0x0'));var moment=require(_0x31aa('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31aa('0x2'))['db'];var utils=require(_0x31aa('0x3'));var logger=require(_0x31aa('0x4'))(_0x31aa('0x5'));var config=require('../../config/environment');var jayson=require(_0x31aa('0x6'));var client=jayson['client'][_0x31aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x209114,_0x30bfce,_0x42fcae){return new BPromise(function(_0x169aec,_0x250893){return client[_0x31aa('0x8')](_0x209114,_0x42fcae)[_0x31aa('0x9')](function(_0x2e25ce){logger[_0x31aa('0xa')](_0x31aa('0xb'),_0x30bfce,'request\x20sent');logger[_0x31aa('0xc')](_0x31aa('0xd'),_0x30bfce,'request\x20sent',JSON['stringify'](_0x2e25ce));if(_0x2e25ce['error']){if(_0x2e25ce['error'][_0x31aa('0xe')]===0x1f4){logger['error'](_0x31aa('0xb'),_0x30bfce,_0x2e25ce[_0x31aa('0xf')]['message']);return _0x250893(_0x2e25ce[_0x31aa('0xf')][_0x31aa('0x10')]);}logger[_0x31aa('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x30bfce,_0x2e25ce[_0x31aa('0xf')][_0x31aa('0x10')]);return _0x169aec(_0x2e25ce[_0x31aa('0xf')]['message']);}else{logger[_0x31aa('0xa')](_0x31aa('0xb'),_0x30bfce,'request\x20sent');_0x169aec(_0x2e25ce[_0x31aa('0x11')][_0x31aa('0x10')]);}})[_0x31aa('0x12')](function(_0x11f852){logger[_0x31aa('0xf')](_0x31aa('0xb'),_0x30bfce,_0x11f852);_0x250893(_0x11f852);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 4d96417..b4c6532 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 _0xeed9=['update','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','index','/now','getDate','/:id','show','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','diskStorage','logo','extname','originalname','/:id/logo','single','file','addLogo','join','server/files/images/logos/','format','%s%s','logologin','post','root','preferred','addPreferred','favicon','addFavicon'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xeed9,0x11a));var _0x9eed=function(_0x256684,_0x529c1e){_0x256684=_0x256684-0x0;var _0x37a0c9=_0xeed9[_0x256684];return _0x37a0c9;};'use strict';var multer=require(_0x9eed('0x0'));var util=require(_0x9eed('0x1'));var path=require(_0x9eed('0x2'));var timeout=require(_0x9eed('0x3'));var express=require(_0x9eed('0x4'));var router=express['Router']();var fs_extra=require(_0x9eed('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9eed('0x6'));var controller=require('./setting.controller');router[_0x9eed('0x7')]('/',auth['isAuthenticated'](),controller[_0x9eed('0x8')]);router[_0x9eed('0x7')](_0x9eed('0x9'),controller[_0x9eed('0xa')]);router['get'](_0x9eed('0xb'),controller[_0x9eed('0xc')]);router['get']('/:id/logo',controller[_0x9eed('0xd')]);router[_0x9eed('0x7')](_0x9eed('0xe'),controller['getLogoLogin']);router['get'](_0x9eed('0xf'),controller[_0x9eed('0x10')]);router[_0x9eed('0x7')](_0x9eed('0x11'),controller['getPreferred']);router['get'](_0x9eed('0x12'),controller['getFavicon']);var upload=multer({'storage':multer[_0x9eed('0x13')]({'destination':function(_0x29aab6,_0x38db21,_0x39f291){_0x39f291(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x2bdf09,_0x1b70fb,_0x1e3f8b){_0x1e3f8b(null,util['format']('%s%s',_0x9eed('0x14'),path[_0x9eed('0x15')](_0x1b70fb[_0x9eed('0x16')])));}})});router['post'](_0x9eed('0x17'),upload[_0x9eed('0x18')](_0x9eed('0x19')),controller[_0x9eed('0x1a')]);var upload=multer({'storage':multer[_0x9eed('0x13')]({'destination':function(_0xb00c4,_0x3b1d93,_0x49e66a){_0x49e66a(null,path[_0x9eed('0x1b')](config['root'],_0x9eed('0x1c')));},'filename':function(_0xd25933,_0x3a650e,_0x349234){_0x349234(null,util[_0x9eed('0x1d')](_0x9eed('0x1e'),_0x9eed('0x1f'),path[_0x9eed('0x15')](_0x3a650e['originalname'])));}})});router[_0x9eed('0x20')]('/:id/logo_login',upload[_0x9eed('0x18')](_0x9eed('0x19')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x9eed('0x13')]({'destination':function(_0x35318e,_0x304f55,_0x4320dd){_0x4320dd(null,path[_0x9eed('0x1b')](config[_0x9eed('0x21')],_0x9eed('0x1c')));},'filename':function(_0x7722e5,_0x417d99,_0x310290){_0x310290(null,util[_0x9eed('0x1d')](_0x9eed('0x1e'),_0x9eed('0x22'),path[_0x9eed('0x15')](_0x417d99[_0x9eed('0x16')])));}})});router[_0x9eed('0x20')](_0x9eed('0x11'),upload['single'](_0x9eed('0x19')),controller[_0x9eed('0x23')]);var upload=multer({'storage':multer[_0x9eed('0x13')]({'destination':function(_0x57bb07,_0x1521e5,_0x34f17a){_0x34f17a(null,path[_0x9eed('0x1b')](config[_0x9eed('0x21')],'server/files/images/logos/'));},'filename':function(_0xb54b0f,_0x5a7ce6,_0x912421){_0x912421(null,util[_0x9eed('0x1d')](_0x9eed('0x1e'),_0x9eed('0x24'),path['extname'](_0x5a7ce6['originalname'])));}})});router[_0x9eed('0x20')](_0x9eed('0x12'),upload[_0x9eed('0x18')]('file'),controller[_0x9eed('0x25')]);router['put'](_0x9eed('0xb'),auth['isAuthenticated'](),controller[_0x9eed('0x26')]);module[_0x9eed('0x27')]=router; \ No newline at end of file +var _0xb549=['update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','getDate','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','post','/:id/logo','single','file','addLogo','root','%s%s','extname','originalname','format','favicon','addFavicon','put','/:id','isAuthenticated'];(function(_0x379fc9,_0x4f747b){var _0x3e6a74=function(_0x151511){while(--_0x151511){_0x379fc9['push'](_0x379fc9['shift']());}};_0x3e6a74(++_0x4f747b);}(_0xb549,0x7d));var _0x9b54=function(_0xfb03ae,_0x517e03){_0xfb03ae=_0xfb03ae-0x0;var _0x5cd87f=_0xb549[_0xfb03ae];return _0x5cd87f;};'use strict';var multer=require(_0x9b54('0x0'));var util=require('util');var path=require(_0x9b54('0x1'));var timeout=require(_0x9b54('0x2'));var express=require(_0x9b54('0x3'));var router=express[_0x9b54('0x4')]();var fs_extra=require(_0x9b54('0x5'));var auth=require(_0x9b54('0x6'));var interaction=require(_0x9b54('0x7'));var config=require(_0x9b54('0x8'));var controller=require('./setting.controller');router[_0x9b54('0x9')]('/',auth['isAuthenticated'](),controller[_0x9b54('0xa')]);router[_0x9b54('0x9')]('/now',controller[_0x9b54('0xb')]);router[_0x9b54('0x9')]('/:id',controller['show']);router[_0x9b54('0x9')]('/:id/logo',controller[_0x9b54('0xc')]);router[_0x9b54('0x9')](_0x9b54('0xd'),controller[_0x9b54('0xe')]);router[_0x9b54('0x9')](_0x9b54('0xf'),controller[_0x9b54('0x10')]);router[_0x9b54('0x9')](_0x9b54('0x11'),controller[_0x9b54('0x12')]);router[_0x9b54('0x9')](_0x9b54('0x13'),controller[_0x9b54('0x14')]);var upload=multer({'storage':multer[_0x9b54('0x15')]({'destination':function(_0x45e9d5,_0x50b1e8,_0xc8b2fc){_0xc8b2fc(null,path[_0x9b54('0x16')](config['root'],_0x9b54('0x17')));},'filename':function(_0x32843b,_0xefcd55,_0x309755){_0x309755(null,util['format']('%s%s','logo',path['extname'](_0xefcd55['originalname'])));}})});router[_0x9b54('0x18')](_0x9b54('0x19'),upload[_0x9b54('0x1a')](_0x9b54('0x1b')),controller[_0x9b54('0x1c')]);var upload=multer({'storage':multer[_0x9b54('0x15')]({'destination':function(_0x1af6be,_0x388edd,_0x1faa03){_0x1faa03(null,path[_0x9b54('0x16')](config[_0x9b54('0x1d')],_0x9b54('0x17')));},'filename':function(_0x25638d,_0x51b7b4,_0xd03917){_0xd03917(null,util['format'](_0x9b54('0x1e'),'logologin',path[_0x9b54('0x1f')](_0x51b7b4[_0x9b54('0x20')])));}})});router[_0x9b54('0x18')](_0x9b54('0xd'),upload['single'](_0x9b54('0x1b')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x9b54('0x15')]({'destination':function(_0x53360a,_0x18c2d4,_0x415a7e){_0x415a7e(null,path[_0x9b54('0x16')](config['root'],_0x9b54('0x17')));},'filename':function(_0x1a2823,_0x22e1ce,_0x3914ac){_0x3914ac(null,util[_0x9b54('0x21')](_0x9b54('0x1e'),'preferred',path[_0x9b54('0x1f')](_0x22e1ce['originalname'])));}})});router[_0x9b54('0x18')](_0x9b54('0x11'),upload[_0x9b54('0x1a')](_0x9b54('0x1b')),controller['addPreferred']);var upload=multer({'storage':multer[_0x9b54('0x15')]({'destination':function(_0x1791df,_0x33198d,_0x20501d){_0x20501d(null,path[_0x9b54('0x16')](config[_0x9b54('0x1d')],_0x9b54('0x17')));},'filename':function(_0x2b0a41,_0x4f0b8c,_0x13e471){_0x13e471(null,util[_0x9b54('0x21')]('%s%s',_0x9b54('0x22'),path[_0x9b54('0x1f')](_0x4f0b8c[_0x9b54('0x20')])));}})});router[_0x9b54('0x18')](_0x9b54('0x13'),upload[_0x9b54('0x1a')](_0x9b54('0x1b')),controller[_0x9b54('0x23')]);router[_0x9b54('0x24')](_0x9b54('0x25'),auth[_0x9b54('0x26')](),controller[_0x9b54('0x27')]);module[_0x9b54('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index ed3623c..8a1119d 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(_0x160528,_0xa1153c){var _0x5e7823=function(_0xc38f55){while(--_0xc38f55){_0x160528['push'](_0x160528['shift']());}};_0x5e7823(++_0xa1153c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x2ec7c1,_0x5ab32b){var _0x5d5ef1=function(_0x12812b){while(--_0x12812b){_0x2ec7c1['push'](_0x2ec7c1['shift']());}};_0x5d5ef1(++_0x5ab32b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 7185257..952c77e 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 _0xbaa9=['defaultLogo','default_loginLogo.svg','default','download','gdpr','securePassword','getPreferred','defaultFavicon','default_preferred.png','ValidationError','addFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','name','send','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','Setting','includeAll','include','findAll','rows','catch','show','params','body','find','addLogo','filename','logo','addLogoLogin','file','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','defaultLoginLogo','defaultPreferred','existsSync','root','toLower','join','upperFirst','custom','default_logo.svg','Sequelize','\x20not\x20found','getLogoLogin','favicon'];(function(_0x47752b,_0x8955da){var _0x1e64e7=function(_0x763f67){while(--_0x763f67){_0x47752b['push'](_0x47752b['shift']());}};_0x1e64e7(++_0x8955da);}(_0xbaa9,0x188));var _0x9baa=function(_0x554248,_0x568596){_0x554248=_0x554248-0x0;var _0x1a787e=_0xbaa9[_0x554248];return _0x1a787e;};'use strict';var emlformat=require(_0x9baa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9baa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9baa('0x2'));var BPromise=require(_0x9baa('0x3'));var Mustache=require(_0x9baa('0x4'));var util=require(_0x9baa('0x5'));var path=require(_0x9baa('0x6'));var sox=require(_0x9baa('0x7'));var csv=require('to-csv');var ejs=require(_0x9baa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9baa('0x9'));var squel=require(_0x9baa('0xa'));var crypto=require(_0x9baa('0xb'));var jsforce=require(_0x9baa('0xc'));var deskjs=require(_0x9baa('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9baa('0xe'));var Papa=require(_0x9baa('0xf'));var Redis=require(_0x9baa('0x10'));var authService=require(_0x9baa('0x11'));var qs=require(_0x9baa('0x12'));var as=require(_0x9baa('0x13'));var hardwareService=require(_0x9baa('0x14'));var logger=require(_0x9baa('0x15'))('api');var utils=require(_0x9baa('0x16'));var config=require(_0x9baa('0x17'));var licenseUtil=require(_0x9baa('0x18'));var db=require(_0x9baa('0x19'))['db'];var jayson=require(_0x9baa('0x1a'));var client=jayson[_0x9baa('0x1b')][_0x9baa('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xe0d8f1,_0x400d8a,_0x21d392,_0x328aed){return new BPromise(function(_0x3ce189,_0x4800fe){var _0x285099=_0x328aed||client;return _0x285099[_0x9baa('0x1d')](_0xe0d8f1,_0x21d392)[_0x9baa('0x1e')](function(_0x42e0c6){logger[_0x9baa('0x1f')](_0x9baa('0x20'),_0x400d8a,'request\x20sent');logger['debug'](_0x9baa('0x21'),_0x400d8a,_0x9baa('0x22'),JSON[_0x9baa('0x23')](_0x42e0c6));if(_0x42e0c6[_0x9baa('0x24')]){if(_0x42e0c6[_0x9baa('0x24')]['code']===0x1f4){logger['error'](_0x9baa('0x20'),_0x400d8a,_0x42e0c6[_0x9baa('0x24')][_0x9baa('0x25')]);return _0x4800fe(_0x42e0c6[_0x9baa('0x24')][_0x9baa('0x25')]);}logger[_0x9baa('0x24')](_0x9baa('0x20'),_0x400d8a,_0x42e0c6[_0x9baa('0x24')][_0x9baa('0x25')]);return _0x3ce189(_0x42e0c6[_0x9baa('0x24')][_0x9baa('0x25')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x400d8a,'request\x20sent');_0x3ce189(_0x42e0c6['result'][_0x9baa('0x25')]);}})['catch'](function(_0x50bd07){logger[_0x9baa('0x24')](_0x9baa('0x20'),_0x400d8a,_0x50bd07);_0x4800fe(_0x50bd07);});});}function respondWithStatusCode(_0x12772f,_0x1478ac){_0x1478ac=_0x1478ac||0xcc;return function(_0x42a0b8){if(_0x42a0b8){return _0x12772f[_0x9baa('0x26')](_0x1478ac);}return _0x12772f[_0x9baa('0x27')](_0x1478ac)['end']();};}function respondWithResult(_0x1e27f1,_0x4efa7d){_0x4efa7d=_0x4efa7d||0xc8;return function(_0x245b0e){if(_0x245b0e){return _0x1e27f1['status'](_0x4efa7d)[_0x9baa('0x28')](_0x245b0e);}};}function respondWithFilteredResult(_0x14adde,_0x561253){return function(_0x59ceb9){if(_0x59ceb9){var _0x42dea1=typeof _0x561253[_0x9baa('0x29')]===_0x9baa('0x2a')&&typeof _0x561253[_0x9baa('0x2b')]===_0x9baa('0x2a');var _0x23ceaa=_0x59ceb9[_0x9baa('0x2c')];var _0x296151=_0x42dea1?0x0:_0x561253[_0x9baa('0x29')];var _0x41154a=_0x42dea1?_0x59ceb9['count']:_0x561253[_0x9baa('0x29')]+_0x561253['limit'];var _0x52999e;if(_0x41154a>=_0x23ceaa){_0x41154a=_0x23ceaa;_0x52999e=0xc8;}else{_0x52999e=0xce;}_0x14adde[_0x9baa('0x27')](_0x52999e);return _0x14adde[_0x9baa('0x2d')](_0x9baa('0x2e'),_0x296151+'-'+_0x41154a+'/'+_0x23ceaa)[_0x9baa('0x28')](_0x59ceb9);}return null;};}function patchUpdates(_0x36ea90){return function(_0x223653){try{jsonpatch[_0x9baa('0x2f')](_0x223653,_0x36ea90,!![]);}catch(_0x12c804){return BPromise[_0x9baa('0x30')](_0x12c804);}return _0x223653[_0x9baa('0x31')]();};}function saveUpdates(_0x7e1452,_0x518d80){return function(_0x294582){if(_0x294582){return _0x294582[_0x9baa('0x32')](_0x7e1452)[_0x9baa('0x1e')](function(_0xf32244){return _0xf32244;});}return null;};}function removeEntity(_0x30a4e1,_0x56254b){return function(_0x1c5404){if(_0x1c5404){return _0x1c5404[_0x9baa('0x33')]()[_0x9baa('0x1e')](function(){_0x30a4e1['status'](0xcc)[_0x9baa('0x34')]();});}};}function handleEntityNotFound(_0x1c999f,_0x313bec){return function(_0x1a11da){if(!_0x1a11da){_0x1c999f['sendStatus'](0x194);}return _0x1a11da;};}function handleError(_0x1c2081,_0x4f537a){_0x4f537a=_0x4f537a||0x1f4;return function(_0x126ec1){logger[_0x9baa('0x24')](_0x126ec1['stack']);if(_0x126ec1[_0x9baa('0x35')]){delete _0x126ec1[_0x9baa('0x35')];}_0x1c2081[_0x9baa('0x27')](_0x4f537a)[_0x9baa('0x36')](_0x126ec1);};}exports['index']=function(_0x2b7d7b,_0x125832){var _0x54d8b8={},_0x3a10a5={},_0x15e416={'count':0x0,'rows':[]};var _0x2b6d57=_['map'](db['Setting'][_0x9baa('0x37')],function(_0x21a02b){return{'name':_0x21a02b[_0x9baa('0x38')],'type':_0x21a02b[_0x9baa('0x39')][_0x9baa('0x3a')]};});_0x3a10a5[_0x9baa('0x3b')]=_[_0x9baa('0x3c')](_0x2b6d57,_0x9baa('0x35'));_0x3a10a5['query']=_[_0x9baa('0x3d')](_0x2b7d7b[_0x9baa('0x3e')]);_0x3a10a5[_0x9baa('0x3f')]=_[_0x9baa('0x40')](_0x3a10a5[_0x9baa('0x3b')],_0x3a10a5[_0x9baa('0x3e')]);_0x54d8b8[_0x9baa('0x41')]=_[_0x9baa('0x40')](_0x3a10a5[_0x9baa('0x3b')],qs['fields'](_0x2b7d7b[_0x9baa('0x3e')][_0x9baa('0x42')]));_0x54d8b8[_0x9baa('0x41')]=_0x54d8b8[_0x9baa('0x41')][_0x9baa('0x43')]?_0x54d8b8['attributes']:_0x3a10a5[_0x9baa('0x3b')];if(!_0x2b7d7b['query']['hasOwnProperty']('nolimit')){_0x54d8b8[_0x9baa('0x2b')]=qs[_0x9baa('0x2b')](_0x2b7d7b[_0x9baa('0x3e')][_0x9baa('0x2b')]);_0x54d8b8[_0x9baa('0x29')]=qs['offset'](_0x2b7d7b[_0x9baa('0x3e')][_0x9baa('0x29')]);}_0x54d8b8['order']=qs['sort'](_0x2b7d7b['query'][_0x9baa('0x44')]);_0x54d8b8[_0x9baa('0x45')]=qs['filters'](_[_0x9baa('0x46')](_0x2b7d7b['query'],_0x3a10a5['filters']),_0x2b6d57);if(_0x2b7d7b[_0x9baa('0x3e')][_0x9baa('0x47')]){_0x54d8b8['where']=_[_0x9baa('0x48')](_0x54d8b8[_0x9baa('0x45')],{'$or':_['map'](_0x2b6d57,function(_0x55d3f0){if(_0x55d3f0[_0x9baa('0x39')]!==_0x9baa('0x49')){var _0xfcf54e={};_0xfcf54e[_0x55d3f0[_0x9baa('0x35')]]={'$like':'%'+_0x2b7d7b[_0x9baa('0x3e')][_0x9baa('0x47')]+'%'};return _0xfcf54e;}})});}_0x54d8b8=_[_0x9baa('0x48')]({},_0x54d8b8,_0x2b7d7b[_0x9baa('0x4a')]);var _0xdcf12={'where':_0x54d8b8[_0x9baa('0x45')]};return db[_0x9baa('0x4b')][_0x9baa('0x2c')](_0xdcf12)[_0x9baa('0x1e')](function(_0x4f28a3){_0x15e416[_0x9baa('0x2c')]=_0x4f28a3;if(_0x2b7d7b[_0x9baa('0x3e')][_0x9baa('0x4c')]){_0x54d8b8[_0x9baa('0x4d')]=[{'all':!![]}];}return db[_0x9baa('0x4b')][_0x9baa('0x4e')](_0x54d8b8);})[_0x9baa('0x1e')](function(_0x8b08ea){_0x15e416[_0x9baa('0x4f')]=_0x8b08ea;return _0x15e416;})[_0x9baa('0x1e')](respondWithFilteredResult(_0x125832,_0x54d8b8))[_0x9baa('0x50')](handleError(_0x125832,null));};exports[_0x9baa('0x51')]=function(_0x176376,_0x6e056c){var _0x19bb77={'raw':![],'where':{'id':_0x176376[_0x9baa('0x52')]['id']}},_0x56528d={};_0x56528d[_0x9baa('0x3b')]=_['keys'](db[_0x9baa('0x4b')]['rawAttributes']);_0x56528d['query']=_[_0x9baa('0x3d')](_0x176376[_0x9baa('0x3e')]);_0x56528d[_0x9baa('0x3f')]=_[_0x9baa('0x40')](_0x56528d[_0x9baa('0x3b')],_0x56528d[_0x9baa('0x3e')]);_0x19bb77[_0x9baa('0x41')]=_['intersection'](_0x56528d[_0x9baa('0x3b')],qs[_0x9baa('0x42')](_0x176376[_0x9baa('0x3e')][_0x9baa('0x42')]));_0x19bb77[_0x9baa('0x41')]=_0x19bb77['attributes'][_0x9baa('0x43')]?_0x19bb77['attributes']:_0x56528d[_0x9baa('0x3b')];if(_0x176376[_0x9baa('0x3e')][_0x9baa('0x4c')]){_0x19bb77['include']=[{'all':!![]}];}_0x19bb77=_[_0x9baa('0x48')]({},_0x19bb77,_0x176376['options']);return db[_0x9baa('0x4b')]['find'](_0x19bb77)[_0x9baa('0x1e')](handleEntityNotFound(_0x6e056c,null))['then'](respondWithResult(_0x6e056c,null))[_0x9baa('0x50')](handleError(_0x6e056c,null));};exports['update']=function(_0x3fd0d2,_0x8df0f4){if(_0x3fd0d2[_0x9baa('0x53')]['id']){delete _0x3fd0d2[_0x9baa('0x53')]['id'];}return db[_0x9baa('0x4b')][_0x9baa('0x54')]({'where':{'id':_0x3fd0d2[_0x9baa('0x52')]['id']}})[_0x9baa('0x1e')](handleEntityNotFound(_0x8df0f4,null))['then'](saveUpdates(_0x3fd0d2[_0x9baa('0x53')],null))[_0x9baa('0x1e')](respondWithResult(_0x8df0f4,null))[_0x9baa('0x50')](handleError(_0x8df0f4,null));};exports[_0x9baa('0x55')]=function(_0x33a293,_0x52d8cf,_0x41aaa8){if(_0x33a293['file']&&_0x33a293['file'][_0x9baa('0x56')]){_0x33a293[_0x9baa('0x53')][_0x9baa('0x57')]=_0x33a293['file'][_0x9baa('0x56')];}return db[_0x9baa('0x4b')]['find']({'where':{'id':_0x33a293[_0x9baa('0x52')]['id']}})[_0x9baa('0x1e')](handleEntityNotFound(_0x52d8cf,null))['then'](saveUpdates(_0x33a293[_0x9baa('0x53')],null))[_0x9baa('0x1e')](respondWithResult(_0x52d8cf,null))[_0x9baa('0x50')](handleError(_0x52d8cf,null));};exports[_0x9baa('0x58')]=function(_0x3cec94,_0x2e8b97,_0x31a8a9){if(_0x3cec94[_0x9baa('0x59')]&&_0x3cec94[_0x9baa('0x59')][_0x9baa('0x56')]){_0x3cec94[_0x9baa('0x53')][_0x9baa('0x5a')]=_0x3cec94[_0x9baa('0x59')]['filename'];}return db[_0x9baa('0x4b')][_0x9baa('0x54')]({'where':{'id':_0x3cec94[_0x9baa('0x52')]['id']}})['then'](handleEntityNotFound(_0x2e8b97,null))[_0x9baa('0x1e')](saveUpdates(_0x3cec94[_0x9baa('0x53')],null))[_0x9baa('0x1e')](respondWithResult(_0x2e8b97,null))[_0x9baa('0x50')](handleError(_0x2e8b97,null));};var utilLicense=require(_0x9baa('0x18'));exports[_0x9baa('0x5b')]=function(_0x2c9b34,_0x2750c1,_0xaf0f52){var _0x162304=_0x9baa('0x5c');var _0x28b313={'custom':![]};return utilLicense[_0x9baa('0x5d')]()[_0x9baa('0x1e')](function(_0x259721){if(_0x259721){_0x28b313=_0x259721;}return db['Setting'][_0x9baa('0x54')]({'where':{'id':_0x2c9b34[_0x9baa('0x52')]['id']},'attributes':[_0x9baa('0x57'),_0x9baa('0x5a'),_0x9baa('0x5e'),'favicon','defaultLogo',_0x9baa('0x5f'),_0x9baa('0x60'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x2750c1,null))[_0x9baa('0x1e')](function(_0x156c9b){if(_0x156c9b){var _0x408873=_0x156c9b[_0x9baa('0x57')]&&fs[_0x9baa('0x61')](path['join'](config[_0x9baa('0x62')],_0x162304,_[_0x9baa('0x63')](_0x156c9b['logo'])))?path['join'](config[_0x9baa('0x62')],_0x162304,_[_0x9baa('0x63')](_0x156c9b[_0x9baa('0x57')])):path[_0x9baa('0x64')](config[_0x9baa('0x62')],_0x162304,_[_0x9baa('0x63')]('default_logo.svg'));var _0x57436e='default'+_[_0x9baa('0x65')](_0x9baa('0x57'));if(_0x156c9b[_0x57436e]||!_0x28b313[_0x9baa('0x66')]){_0x408873=path['join'](config['root'],_0x162304,_[_0x9baa('0x63')](_0x9baa('0x67')));}if(!fs[_0x9baa('0x61')](_0x408873)){throw new db[(_0x9baa('0x68'))]['ValidationError'](_['upperFirst'](_0x9baa('0x57'))+_0x9baa('0x69'));}return _0x2750c1['download'](_0x408873);}})[_0x9baa('0x50')](handleError(_0x2750c1,null));};var utilLicense=require('../../config/license/util');exports[_0x9baa('0x6a')]=function(_0x6d42ed,_0x1ea7fb,_0x3056d5){var _0x43992d=_0x9baa('0x5c');var _0x4f736b={'custom':![]};return utilLicense['getLicense']()[_0x9baa('0x1e')](function(_0xe771dd){if(_0xe771dd){_0x4f736b=_0xe771dd;}return db[_0x9baa('0x4b')][_0x9baa('0x54')]({'where':{'id':_0x6d42ed['params']['id']},'attributes':[_0x9baa('0x57'),_0x9baa('0x5a'),_0x9baa('0x5e'),_0x9baa('0x6b'),_0x9baa('0x6c'),'defaultLoginLogo',_0x9baa('0x60'),'defaultFavicon'],'raw':!![]});})[_0x9baa('0x1e')](handleEntityNotFound(_0x1ea7fb,null))[_0x9baa('0x1e')](function(_0x1e14af){if(_0x1e14af){var _0x428838=_0x1e14af['loginLogo']&&fs[_0x9baa('0x61')](path[_0x9baa('0x64')](config[_0x9baa('0x62')],_0x43992d,_['toLower'](_0x1e14af[_0x9baa('0x5a')])))?path[_0x9baa('0x64')](config['root'],_0x43992d,_[_0x9baa('0x63')](_0x1e14af[_0x9baa('0x5a')])):path[_0x9baa('0x64')](config['root'],_0x43992d,_[_0x9baa('0x63')](_0x9baa('0x6d')));var _0x28fc5e=_0x9baa('0x6e')+_[_0x9baa('0x65')](_0x9baa('0x5a'));if(_0x1e14af[_0x28fc5e]||!_0x4f736b[_0x9baa('0x66')]){_0x428838=path[_0x9baa('0x64')](config[_0x9baa('0x62')],_0x43992d,_[_0x9baa('0x63')](_0x9baa('0x6d')));}if(!fs['existsSync'](_0x428838)){throw new db[(_0x9baa('0x68'))]['ValidationError'](_[_0x9baa('0x65')]('loginLogo')+_0x9baa('0x69'));}return _0x1ea7fb[_0x9baa('0x6f')](_0x428838);}})[_0x9baa('0x50')](handleError(_0x1ea7fb,null));};exports[_0x9baa('0x70')]=function(_0x3a9bf4,_0x12c1d6){return db[_0x9baa('0x4b')][_0x9baa('0x54')]({'where':{'id':_0x3a9bf4['params']['id']},'attributes':[_0x9baa('0x71')]})[_0x9baa('0x1e')](respondWithResult(_0x12c1d6,null))[_0x9baa('0x50')](handleError(_0x12c1d6,null));};exports['addPreferred']=function(_0x432a69,_0x5ec6d7,_0x59f824){if(_0x432a69[_0x9baa('0x59')]&&_0x432a69[_0x9baa('0x59')][_0x9baa('0x56')]){_0x432a69[_0x9baa('0x53')][_0x9baa('0x5e')]=_0x432a69[_0x9baa('0x59')][_0x9baa('0x56')];}return db[_0x9baa('0x4b')]['find']({'where':{'id':_0x432a69[_0x9baa('0x52')]['id']}})[_0x9baa('0x1e')](handleEntityNotFound(_0x5ec6d7,null))[_0x9baa('0x1e')](saveUpdates(_0x432a69[_0x9baa('0x53')],null))['then'](respondWithResult(_0x5ec6d7,null))['catch'](handleError(_0x5ec6d7,null));};var utilLicense=require(_0x9baa('0x18'));exports[_0x9baa('0x72')]=function(_0x47ea4c,_0x4402fc,_0x21e146){var _0x65a383=_0x9baa('0x5c');var _0x12e087={'custom':![]};return utilLicense[_0x9baa('0x5d')]()[_0x9baa('0x1e')](function(_0x517f57){if(_0x517f57){_0x12e087=_0x517f57;}return db[_0x9baa('0x4b')][_0x9baa('0x54')]({'where':{'id':_0x47ea4c[_0x9baa('0x52')]['id']},'attributes':[_0x9baa('0x57'),_0x9baa('0x5a'),_0x9baa('0x5e'),_0x9baa('0x6b'),_0x9baa('0x6c'),_0x9baa('0x5f'),_0x9baa('0x60'),_0x9baa('0x73')],'raw':!![]});})[_0x9baa('0x1e')](handleEntityNotFound(_0x4402fc,null))['then'](function(_0x560ec1){if(_0x560ec1){var _0x3429af=_0x560ec1['preferred']&&fs['existsSync'](path[_0x9baa('0x64')](config['root'],_0x65a383,_[_0x9baa('0x63')](_0x560ec1[_0x9baa('0x5e')])))?path[_0x9baa('0x64')](config[_0x9baa('0x62')],_0x65a383,_['toLower'](_0x560ec1['preferred'])):path[_0x9baa('0x64')](config[_0x9baa('0x62')],_0x65a383,_[_0x9baa('0x63')](_0x9baa('0x74')));var _0x1d51ef=_0x9baa('0x6e')+_['upperFirst'](_0x9baa('0x5e'));if(_0x560ec1[_0x1d51ef]||!_0x12e087[_0x9baa('0x66')]||!_0x12e087[_0x9baa('0x5e')]){_0x3429af=path[_0x9baa('0x64')](config[_0x9baa('0x62')],_0x65a383,_[_0x9baa('0x63')](_0x9baa('0x74')));}if(!fs[_0x9baa('0x61')](_0x3429af)){throw new db[(_0x9baa('0x68'))][(_0x9baa('0x75'))](_['upperFirst'](_0x9baa('0x5e'))+_0x9baa('0x69'));}return _0x4402fc['download'](_0x3429af);}})[_0x9baa('0x50')](handleError(_0x4402fc,null));};exports[_0x9baa('0x76')]=function(_0x213f0c,_0x5065aa,_0x18fa44){if(_0x213f0c[_0x9baa('0x59')]&&_0x213f0c[_0x9baa('0x59')][_0x9baa('0x56')]){_0x213f0c[_0x9baa('0x53')]['favicon']=_0x213f0c[_0x9baa('0x59')][_0x9baa('0x56')];}return db[_0x9baa('0x4b')][_0x9baa('0x54')]({'where':{'id':_0x213f0c[_0x9baa('0x52')]['id']}})[_0x9baa('0x1e')](handleEntityNotFound(_0x5065aa,null))[_0x9baa('0x1e')](saveUpdates(_0x213f0c[_0x9baa('0x53')],null))['then'](respondWithResult(_0x5065aa,null))['catch'](handleError(_0x5065aa,null));};var utilLicense=require(_0x9baa('0x18'));exports['getFavicon']=function(_0x5d1b53,_0x19a212,_0x895ca2){var _0x42670c=_0x9baa('0x5c');var _0x3c1bff={'custom':![]};return utilLicense[_0x9baa('0x5d')]()['then'](function(_0x41c48c){if(_0x41c48c){_0x3c1bff=_0x41c48c;}return db[_0x9baa('0x4b')][_0x9baa('0x54')]({'where':{'id':_0x5d1b53[_0x9baa('0x52')]['id']},'attributes':[_0x9baa('0x57'),_0x9baa('0x5a'),_0x9baa('0x5e'),_0x9baa('0x6b'),_0x9baa('0x6c'),'defaultLoginLogo',_0x9baa('0x60'),'defaultFavicon'],'raw':!![]});})[_0x9baa('0x1e')](handleEntityNotFound(_0x19a212,null))[_0x9baa('0x1e')](function(_0x3eb091){if(_0x3eb091){var _0xf552a8=_0x3eb091['favicon']&&fs['existsSync'](path[_0x9baa('0x64')](config[_0x9baa('0x62')],_0x42670c,_[_0x9baa('0x63')](_0x3eb091[_0x9baa('0x6b')])))?path[_0x9baa('0x64')](config[_0x9baa('0x62')],_0x42670c,_[_0x9baa('0x63')](_0x3eb091['favicon'])):path[_0x9baa('0x64')](config['root'],_0x42670c,_[_0x9baa('0x63')](_0x9baa('0x77')));var _0xe3d6bf=_0x9baa('0x6e')+_[_0x9baa('0x65')]('favicon');if(_0x3eb091[_0xe3d6bf]||!_0x3c1bff[_0x9baa('0x66')]){_0xf552a8=path[_0x9baa('0x64')](config[_0x9baa('0x62')],_0x42670c,_[_0x9baa('0x63')]('default_favicon.ico'));}if(!fs[_0x9baa('0x61')](_0xf552a8)){throw new db['Sequelize'][(_0x9baa('0x75'))](_[_0x9baa('0x65')](_0x9baa('0x6b'))+_0x9baa('0x69'));}return _0x19a212[_0x9baa('0x6f')](_0xf552a8);}})[_0x9baa('0x50')](handleError(_0x19a212,null));};exports[_0x9baa('0x78')]=function(_0x35baba,_0x2b0a5e){var _0x122972={'offset':moment()['utcOffset']()};_0x122972[_0x9baa('0x79')]=moment()[_0x9baa('0x7a')](_0x122972[_0x9baa('0x29')])[_0x9baa('0x7b')](_0x9baa('0x7c'));return _0x2b0a5e['status'](0xc8)[_0x9baa('0x36')](_0x122972);}; \ No newline at end of file +var _0xe8a4=['bluebird','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/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','end','json','undefined','limit','count','offset','save','destroy','status','stack','name','map','Setting','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','filter','where','merge','options','findAll','rows','catch','params','fields','includeAll','include','body','find','file','filename','loginLogo','getLogo','server/files/images/logos','logo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','favicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','getLicense','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','zip-dir','request-promise','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe8a4,0x158));var _0x4e8a=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xe8a4[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0x4e8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e8a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e8a('0x2'));var moment=require(_0x4e8a('0x3'));var BPromise=require(_0x4e8a('0x4'));var Mustache=require('mustache');var util=require(_0x4e8a('0x5'));var path=require(_0x4e8a('0x6'));var sox=require('sox');var csv=require(_0x4e8a('0x7'));var ejs=require(_0x4e8a('0x8'));var fs=require('fs');var fs_extra=require(_0x4e8a('0x9'));var _=require(_0x4e8a('0xa'));var squel=require(_0x4e8a('0xb'));var crypto=require(_0x4e8a('0xc'));var jsforce=require(_0x4e8a('0xd'));var deskjs=require(_0x4e8a('0xe'));var toCsv=require(_0x4e8a('0x7'));var querystring=require(_0x4e8a('0xf'));var Papa=require('papaparse');var Redis=require(_0x4e8a('0x10'));var authService=require(_0x4e8a('0x11'));var qs=require(_0x4e8a('0x12'));var as=require(_0x4e8a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e8a('0x14'))(_0x4e8a('0x15'));var utils=require('../../config/utils');var config=require(_0x4e8a('0x16'));var licenseUtil=require(_0x4e8a('0x17'));var db=require(_0x4e8a('0x18'))['db'];var jayson=require(_0x4e8a('0x19'));var client=jayson['client'][_0x4e8a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4f04d5,_0x39be1d,_0x25a431,_0x4270fb){return new BPromise(function(_0x4e5e38,_0x6e7291){var _0x4d342c=_0x4270fb||client;return _0x4d342c[_0x4e8a('0x1b')](_0x4f04d5,_0x25a431)[_0x4e8a('0x1c')](function(_0x61acb9){logger['info'](_0x4e8a('0x1d'),_0x39be1d,_0x4e8a('0x1e'));logger[_0x4e8a('0x1f')](_0x4e8a('0x20'),_0x39be1d,'request\x20sent',JSON[_0x4e8a('0x21')](_0x61acb9));if(_0x61acb9['error']){if(_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x23')]===0x1f4){logger[_0x4e8a('0x22')](_0x4e8a('0x1d'),_0x39be1d,_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x24')]);return _0x6e7291(_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x24')]);}logger[_0x4e8a('0x22')]('Setting,\x20%s,\x20%s',_0x39be1d,_0x61acb9['error']['message']);return _0x4e5e38(_0x61acb9[_0x4e8a('0x22')][_0x4e8a('0x24')]);}else{logger[_0x4e8a('0x25')](_0x4e8a('0x1d'),_0x39be1d,_0x4e8a('0x1e'));_0x4e5e38(_0x61acb9['result']['message']);}})['catch'](function(_0x4955f9){logger[_0x4e8a('0x22')](_0x4e8a('0x1d'),_0x39be1d,_0x4955f9);_0x6e7291(_0x4955f9);});});}function respondWithStatusCode(_0x2a8948,_0x590b58){_0x590b58=_0x590b58||0xcc;return function(_0x1c2ce7){if(_0x1c2ce7){return _0x2a8948[_0x4e8a('0x26')](_0x590b58);}return _0x2a8948['status'](_0x590b58)[_0x4e8a('0x27')]();};}function respondWithResult(_0x3c80de,_0x50a80a){_0x50a80a=_0x50a80a||0xc8;return function(_0x1c6598){if(_0x1c6598){return _0x3c80de['status'](_0x50a80a)[_0x4e8a('0x28')](_0x1c6598);}};}function respondWithFilteredResult(_0x34b531,_0x3a9d32){return function(_0x690b4f){if(_0x690b4f){var _0x4a664f=typeof _0x3a9d32['offset']===_0x4e8a('0x29')&&typeof _0x3a9d32[_0x4e8a('0x2a')]==='undefined';var _0x3339ee=_0x690b4f['count'];var _0x1d22d5=_0x4a664f?0x0:_0x3a9d32['offset'];var _0x2d1e63=_0x4a664f?_0x690b4f[_0x4e8a('0x2b')]:_0x3a9d32[_0x4e8a('0x2c')]+_0x3a9d32[_0x4e8a('0x2a')];var _0x47190d;if(_0x2d1e63>=_0x3339ee){_0x2d1e63=_0x3339ee;_0x47190d=0xc8;}else{_0x47190d=0xce;}_0x34b531['status'](_0x47190d);return _0x34b531['set']('Content-Range',_0x1d22d5+'-'+_0x2d1e63+'/'+_0x3339ee)[_0x4e8a('0x28')](_0x690b4f);}return null;};}function patchUpdates(_0x2473b5){return function(_0x2a3703){try{jsonpatch['apply'](_0x2a3703,_0x2473b5,!![]);}catch(_0x3ebc0c){return BPromise['reject'](_0x3ebc0c);}return _0x2a3703[_0x4e8a('0x2d')]();};}function saveUpdates(_0x539b96,_0x4f8161){return function(_0x4c4c22){if(_0x4c4c22){return _0x4c4c22['update'](_0x539b96)[_0x4e8a('0x1c')](function(_0x3647df){return _0x3647df;});}return null;};}function removeEntity(_0x2177ed,_0x9331dd){return function(_0x2337ae){if(_0x2337ae){return _0x2337ae[_0x4e8a('0x2e')]()[_0x4e8a('0x1c')](function(){_0x2177ed[_0x4e8a('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x409fc8,_0x4b5f1e){return function(_0x3d9dd2){if(!_0x3d9dd2){_0x409fc8[_0x4e8a('0x26')](0x194);}return _0x3d9dd2;};}function handleError(_0x52ef06,_0x3fd5b9){_0x3fd5b9=_0x3fd5b9||0x1f4;return function(_0x5168b2){logger[_0x4e8a('0x22')](_0x5168b2[_0x4e8a('0x30')]);if(_0x5168b2[_0x4e8a('0x31')]){delete _0x5168b2[_0x4e8a('0x31')];}_0x52ef06['status'](_0x3fd5b9)['send'](_0x5168b2);};}exports['index']=function(_0x17340f,_0x5e79ea){var _0x4693ac={},_0xc4e355={},_0x37ca6e={'count':0x0,'rows':[]};var _0x5564df=_[_0x4e8a('0x32')](db[_0x4e8a('0x33')][_0x4e8a('0x34')],function(_0x297dfb){return{'name':_0x297dfb[_0x4e8a('0x35')],'type':_0x297dfb[_0x4e8a('0x36')]['key']};});_0xc4e355['model']=_['map'](_0x5564df,_0x4e8a('0x31'));_0xc4e355[_0x4e8a('0x37')]=_[_0x4e8a('0x38')](_0x17340f[_0x4e8a('0x37')]);_0xc4e355[_0x4e8a('0x39')]=_[_0x4e8a('0x3a')](_0xc4e355[_0x4e8a('0x3b')],_0xc4e355[_0x4e8a('0x37')]);_0x4693ac['attributes']=_['intersection'](_0xc4e355['model'],qs['fields'](_0x17340f[_0x4e8a('0x37')]['fields']));_0x4693ac[_0x4e8a('0x3c')]=_0x4693ac[_0x4e8a('0x3c')][_0x4e8a('0x3d')]?_0x4693ac['attributes']:_0xc4e355[_0x4e8a('0x3b')];if(!_0x17340f[_0x4e8a('0x37')]['hasOwnProperty'](_0x4e8a('0x3e'))){_0x4693ac[_0x4e8a('0x2a')]=qs['limit'](_0x17340f['query'][_0x4e8a('0x2a')]);_0x4693ac[_0x4e8a('0x2c')]=qs['offset'](_0x17340f[_0x4e8a('0x37')][_0x4e8a('0x2c')]);}_0x4693ac[_0x4e8a('0x3f')]=qs[_0x4e8a('0x40')](_0x17340f[_0x4e8a('0x37')][_0x4e8a('0x40')]);_0x4693ac['where']=qs[_0x4e8a('0x39')](_['pick'](_0x17340f[_0x4e8a('0x37')],_0xc4e355[_0x4e8a('0x39')]),_0x5564df);if(_0x17340f['query'][_0x4e8a('0x41')]){_0x4693ac[_0x4e8a('0x42')]=_[_0x4e8a('0x43')](_0x4693ac[_0x4e8a('0x42')],{'$or':_[_0x4e8a('0x32')](_0x5564df,function(_0x58916c){if(_0x58916c[_0x4e8a('0x36')]!=='VIRTUAL'){var _0x1309bd={};_0x1309bd[_0x58916c['name']]={'$like':'%'+_0x17340f[_0x4e8a('0x37')]['filter']+'%'};return _0x1309bd;}})});}_0x4693ac=_[_0x4e8a('0x43')]({},_0x4693ac,_0x17340f[_0x4e8a('0x44')]);var _0x1d92bb={'where':_0x4693ac['where']};return db[_0x4e8a('0x33')]['count'](_0x1d92bb)['then'](function(_0x3c700c){_0x37ca6e[_0x4e8a('0x2b')]=_0x3c700c;if(_0x17340f['query']['includeAll']){_0x4693ac['include']=[{'all':!![]}];}return db[_0x4e8a('0x33')][_0x4e8a('0x45')](_0x4693ac);})[_0x4e8a('0x1c')](function(_0x3a4f2b){_0x37ca6e[_0x4e8a('0x46')]=_0x3a4f2b;return _0x37ca6e;})['then'](respondWithFilteredResult(_0x5e79ea,_0x4693ac))[_0x4e8a('0x47')](handleError(_0x5e79ea,null));};exports['show']=function(_0x4c2c1b,_0xc0c96b){var _0xfeb06a={'raw':![],'where':{'id':_0x4c2c1b[_0x4e8a('0x48')]['id']}},_0x40b53f={};_0x40b53f[_0x4e8a('0x3b')]=_[_0x4e8a('0x38')](db[_0x4e8a('0x33')][_0x4e8a('0x34')]);_0x40b53f[_0x4e8a('0x37')]=_[_0x4e8a('0x38')](_0x4c2c1b[_0x4e8a('0x37')]);_0x40b53f[_0x4e8a('0x39')]=_['intersection'](_0x40b53f[_0x4e8a('0x3b')],_0x40b53f[_0x4e8a('0x37')]);_0xfeb06a['attributes']=_[_0x4e8a('0x3a')](_0x40b53f[_0x4e8a('0x3b')],qs[_0x4e8a('0x49')](_0x4c2c1b['query'][_0x4e8a('0x49')]));_0xfeb06a[_0x4e8a('0x3c')]=_0xfeb06a[_0x4e8a('0x3c')][_0x4e8a('0x3d')]?_0xfeb06a[_0x4e8a('0x3c')]:_0x40b53f['model'];if(_0x4c2c1b[_0x4e8a('0x37')][_0x4e8a('0x4a')]){_0xfeb06a[_0x4e8a('0x4b')]=[{'all':!![]}];}_0xfeb06a=_[_0x4e8a('0x43')]({},_0xfeb06a,_0x4c2c1b[_0x4e8a('0x44')]);return db[_0x4e8a('0x33')]['find'](_0xfeb06a)[_0x4e8a('0x1c')](handleEntityNotFound(_0xc0c96b,null))[_0x4e8a('0x1c')](respondWithResult(_0xc0c96b,null))[_0x4e8a('0x47')](handleError(_0xc0c96b,null));};exports['update']=function(_0x11ca60,_0x4515f5){if(_0x11ca60[_0x4e8a('0x4c')]['id']){delete _0x11ca60[_0x4e8a('0x4c')]['id'];}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0x11ca60[_0x4e8a('0x48')]['id']}})['then'](handleEntityNotFound(_0x4515f5,null))[_0x4e8a('0x1c')](saveUpdates(_0x11ca60[_0x4e8a('0x4c')],null))[_0x4e8a('0x1c')](respondWithResult(_0x4515f5,null))['catch'](handleError(_0x4515f5,null));};exports['addLogo']=function(_0x571ad7,_0x1ab43a,_0x1caa6d){if(_0x571ad7[_0x4e8a('0x4e')]&&_0x571ad7['file']['filename']){_0x571ad7[_0x4e8a('0x4c')]['logo']=_0x571ad7['file'][_0x4e8a('0x4f')];}return db[_0x4e8a('0x33')]['find']({'where':{'id':_0x571ad7[_0x4e8a('0x48')]['id']}})[_0x4e8a('0x1c')](handleEntityNotFound(_0x1ab43a,null))[_0x4e8a('0x1c')](saveUpdates(_0x571ad7[_0x4e8a('0x4c')],null))[_0x4e8a('0x1c')](respondWithResult(_0x1ab43a,null))[_0x4e8a('0x47')](handleError(_0x1ab43a,null));};exports['addLogoLogin']=function(_0x3d3a51,_0x234efe,_0xe91845){if(_0x3d3a51['file']&&_0x3d3a51['file'][_0x4e8a('0x4f')]){_0x3d3a51[_0x4e8a('0x4c')][_0x4e8a('0x50')]=_0x3d3a51[_0x4e8a('0x4e')][_0x4e8a('0x4f')];}return db[_0x4e8a('0x33')]['find']({'where':{'id':_0x3d3a51[_0x4e8a('0x48')]['id']}})['then'](handleEntityNotFound(_0x234efe,null))[_0x4e8a('0x1c')](saveUpdates(_0x3d3a51[_0x4e8a('0x4c')],null))[_0x4e8a('0x1c')](respondWithResult(_0x234efe,null))['catch'](handleError(_0x234efe,null));};var utilLicense=require('../../config/license/util');exports[_0x4e8a('0x51')]=function(_0x3b3f87,_0x5c1c44,_0x20fb1c){var _0x47857e=_0x4e8a('0x52');var _0x4b418b={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x4aed87){if(_0x4aed87){_0x4b418b=_0x4aed87;}return db['Setting']['find']({'where':{'id':_0x3b3f87[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x53'),_0x4e8a('0x50'),_0x4e8a('0x54'),'favicon',_0x4e8a('0x55'),_0x4e8a('0x56'),_0x4e8a('0x57'),_0x4e8a('0x58')],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0x5c1c44,null))[_0x4e8a('0x1c')](function(_0x1a807a){if(_0x1a807a){var _0x182c57=_0x1a807a['logo']&&fs[_0x4e8a('0x59')](path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x47857e,_[_0x4e8a('0x5c')](_0x1a807a[_0x4e8a('0x53')])))?path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x47857e,_['toLower'](_0x1a807a[_0x4e8a('0x53')])):path['join'](config['root'],_0x47857e,_[_0x4e8a('0x5c')]('default_logo.svg'));var _0x48be64=_0x4e8a('0x5d')+_[_0x4e8a('0x5e')](_0x4e8a('0x53'));if(_0x1a807a[_0x48be64]||!_0x4b418b[_0x4e8a('0x5f')]){_0x182c57=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x47857e,_[_0x4e8a('0x5c')]('default_logo.svg'));}if(!fs[_0x4e8a('0x59')](_0x182c57)){throw new db[(_0x4e8a('0x60'))][(_0x4e8a('0x61'))](_[_0x4e8a('0x5e')](_0x4e8a('0x53'))+_0x4e8a('0x62'));}return _0x5c1c44[_0x4e8a('0x63')](_0x182c57);}})[_0x4e8a('0x47')](handleError(_0x5c1c44,null));};var utilLicense=require(_0x4e8a('0x17'));exports[_0x4e8a('0x64')]=function(_0x269e2f,_0x4d87ea,_0xd64425){var _0x5085d7='server/files/images/logos';var _0x272c72={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x24d1cd){if(_0x24d1cd){_0x272c72=_0x24d1cd;}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0x269e2f['params']['id']},'attributes':[_0x4e8a('0x53'),'loginLogo',_0x4e8a('0x54'),_0x4e8a('0x65'),_0x4e8a('0x55'),'defaultLoginLogo',_0x4e8a('0x57'),_0x4e8a('0x58')],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0x4d87ea,null))[_0x4e8a('0x1c')](function(_0x5cdda){if(_0x5cdda){var _0x11db8f=_0x5cdda[_0x4e8a('0x50')]&&fs['existsSync'](path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x5085d7,_[_0x4e8a('0x5c')](_0x5cdda[_0x4e8a('0x50')])))?path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x5085d7,_['toLower'](_0x5cdda['loginLogo'])):path[_0x4e8a('0x5a')](config['root'],_0x5085d7,_[_0x4e8a('0x5c')](_0x4e8a('0x66')));var _0x3fd6e2=_0x4e8a('0x5d')+_[_0x4e8a('0x5e')]('loginLogo');if(_0x5cdda[_0x3fd6e2]||!_0x272c72[_0x4e8a('0x5f')]){_0x11db8f=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x5085d7,_[_0x4e8a('0x5c')](_0x4e8a('0x66')));}if(!fs[_0x4e8a('0x59')](_0x11db8f)){throw new db['Sequelize'][(_0x4e8a('0x61'))](_[_0x4e8a('0x5e')](_0x4e8a('0x50'))+'\x20not\x20found');}return _0x4d87ea[_0x4e8a('0x63')](_0x11db8f);}})[_0x4e8a('0x47')](handleError(_0x4d87ea,null));};exports[_0x4e8a('0x67')]=function(_0x2a1bee,_0x36124d){return db[_0x4e8a('0x33')]['find']({'where':{'id':_0x2a1bee[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x68')]})[_0x4e8a('0x1c')](respondWithResult(_0x36124d,null))[_0x4e8a('0x47')](handleError(_0x36124d,null));};exports[_0x4e8a('0x69')]=function(_0x4ea640,_0x340f39,_0x59c499){if(_0x4ea640[_0x4e8a('0x4e')]&&_0x4ea640[_0x4e8a('0x4e')][_0x4e8a('0x4f')]){_0x4ea640[_0x4e8a('0x4c')]['preferred']=_0x4ea640[_0x4e8a('0x4e')][_0x4e8a('0x4f')];}return db['Setting'][_0x4e8a('0x4d')]({'where':{'id':_0x4ea640[_0x4e8a('0x48')]['id']}})['then'](handleEntityNotFound(_0x340f39,null))[_0x4e8a('0x1c')](saveUpdates(_0x4ea640[_0x4e8a('0x4c')],null))['then'](respondWithResult(_0x340f39,null))[_0x4e8a('0x47')](handleError(_0x340f39,null));};var utilLicense=require(_0x4e8a('0x17'));exports[_0x4e8a('0x6a')]=function(_0x3a1902,_0xf8d79,_0x2047da){var _0x2b4220=_0x4e8a('0x52');var _0x52ef93={'custom':![]};return utilLicense[_0x4e8a('0x6b')]()['then'](function(_0x4feedd){if(_0x4feedd){_0x52ef93=_0x4feedd;}return db['Setting']['find']({'where':{'id':_0x3a1902[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x53'),_0x4e8a('0x50'),_0x4e8a('0x54'),_0x4e8a('0x65'),'defaultLogo',_0x4e8a('0x56'),_0x4e8a('0x57'),_0x4e8a('0x58')],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0xf8d79,null))['then'](function(_0x20503a){if(_0x20503a){var _0x1f7929=_0x20503a[_0x4e8a('0x54')]&&fs[_0x4e8a('0x59')](path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_[_0x4e8a('0x5c')](_0x20503a['preferred'])))?path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_['toLower'](_0x20503a['preferred'])):path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_[_0x4e8a('0x5c')](_0x4e8a('0x6c')));var _0x1fbfcb=_0x4e8a('0x5d')+_[_0x4e8a('0x5e')](_0x4e8a('0x54'));if(_0x20503a[_0x1fbfcb]||!_0x52ef93[_0x4e8a('0x5f')]||!_0x52ef93[_0x4e8a('0x54')]){_0x1f7929=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x2b4220,_[_0x4e8a('0x5c')]('default_preferred.png'));}if(!fs['existsSync'](_0x1f7929)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0x4e8a('0x54'))+_0x4e8a('0x62'));}return _0xf8d79[_0x4e8a('0x63')](_0x1f7929);}})[_0x4e8a('0x47')](handleError(_0xf8d79,null));};exports[_0x4e8a('0x6d')]=function(_0xbc556b,_0x3f7720,_0x2f73e3){if(_0xbc556b[_0x4e8a('0x4e')]&&_0xbc556b['file']['filename']){_0xbc556b[_0x4e8a('0x4c')][_0x4e8a('0x65')]=_0xbc556b[_0x4e8a('0x4e')][_0x4e8a('0x4f')];}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0xbc556b[_0x4e8a('0x48')]['id']}})[_0x4e8a('0x1c')](handleEntityNotFound(_0x3f7720,null))[_0x4e8a('0x1c')](saveUpdates(_0xbc556b['body'],null))[_0x4e8a('0x1c')](respondWithResult(_0x3f7720,null))[_0x4e8a('0x47')](handleError(_0x3f7720,null));};var utilLicense=require(_0x4e8a('0x17'));exports[_0x4e8a('0x6e')]=function(_0x3fd30d,_0x10c80f,_0x2aaf19){var _0x36366e=_0x4e8a('0x52');var _0x19cd89={'custom':![]};return utilLicense[_0x4e8a('0x6b')]()[_0x4e8a('0x1c')](function(_0xd095e7){if(_0xd095e7){_0x19cd89=_0xd095e7;}return db[_0x4e8a('0x33')][_0x4e8a('0x4d')]({'where':{'id':_0x3fd30d[_0x4e8a('0x48')]['id']},'attributes':[_0x4e8a('0x53'),_0x4e8a('0x50'),_0x4e8a('0x54'),'favicon','defaultLogo',_0x4e8a('0x56'),_0x4e8a('0x57'),'defaultFavicon'],'raw':!![]});})[_0x4e8a('0x1c')](handleEntityNotFound(_0x10c80f,null))[_0x4e8a('0x1c')](function(_0x35a8bd){if(_0x35a8bd){var _0x63d11a=_0x35a8bd[_0x4e8a('0x65')]&&fs[_0x4e8a('0x59')](path[_0x4e8a('0x5a')](config['root'],_0x36366e,_['toLower'](_0x35a8bd[_0x4e8a('0x65')])))?path[_0x4e8a('0x5a')](config['root'],_0x36366e,_[_0x4e8a('0x5c')](_0x35a8bd['favicon'])):path['join'](config[_0x4e8a('0x5b')],_0x36366e,_['toLower'](_0x4e8a('0x6f')));var _0x5eeb9d=_0x4e8a('0x5d')+_['upperFirst'](_0x4e8a('0x65'));if(_0x35a8bd[_0x5eeb9d]||!_0x19cd89['custom']){_0x63d11a=path[_0x4e8a('0x5a')](config[_0x4e8a('0x5b')],_0x36366e,_[_0x4e8a('0x5c')](_0x4e8a('0x6f')));}if(!fs[_0x4e8a('0x59')](_0x63d11a)){throw new db[(_0x4e8a('0x60'))][(_0x4e8a('0x61'))](_['upperFirst'](_0x4e8a('0x65'))+_0x4e8a('0x62'));}return _0x10c80f[_0x4e8a('0x63')](_0x63d11a);}})['catch'](handleError(_0x10c80f,null));};exports[_0x4e8a('0x70')]=function(_0x4122e8,_0x18248e){var _0x1a245={'offset':moment()[_0x4e8a('0x71')]()};_0x1a245['now']=moment()['utcOffset'](_0x1a245[_0x4e8a('0x2c')])['format'](_0x4e8a('0x72'));return _0x18248e['status'](0xc8)[_0x4e8a('0x73')](_0x1a245);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a969c10..d7dd3c6 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4c3070,_0xc2fb4c){var _0x536a44=function(_0x1412a5){while(--_0x1412a5){_0x4c3070['push'](_0x4c3070['shift']());}};_0x536a44(++_0xc2fb4c);}(_0x7217,0x19e));var _0x7721=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x7217[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x335ede,_0x4b6031){var _0x1366aa=function(_0x5a3552){while(--_0x5a3552){_0x335ede['push'](_0x335ede['shift']());}};_0x1366aa(++_0x4b6031);}(_0xedd9,0xfc));var _0x9edd=function(_0x4278f2,_0x35a90a){_0x4278f2=_0x4278f2-0x0;var _0x51f6fd=_0xedd9[_0x4278f2];return _0x51f6fd;};'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':'settings','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 289068f..d1fff5d 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 _0xa991=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','ShowSetting','Setting','find','options','where','include','map','model','attributes','stringify','catch','lodash','util'];(function(_0x542bcf,_0x151b92){var _0x6f169a=function(_0x44b1a3){while(--_0x44b1a3){_0x542bcf['push'](_0x542bcf['shift']());}};_0x6f169a(++_0x151b92);}(_0xa991,0x12a));var _0x1a99=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xa991[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x1a99('0x0'));var util=require(_0x1a99('0x1'));var moment=require('moment');var BPromise=require(_0x1a99('0x2'));var rs=require(_0x1a99('0x3'));var fs=require('fs');var Redis=require(_0x1a99('0x4'));var db=require(_0x1a99('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a99('0x6'))('rpc');var config=require(_0x1a99('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1a99('0x8')][_0x1a99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x168a26,_0x32d803,_0x3e29d1){return new BPromise(function(_0x2f91ab,_0x4a2f75){return client['request'](_0x168a26,_0x3e29d1)[_0x1a99('0xa')](function(_0x8bed05){logger[_0x1a99('0xb')](_0x1a99('0xc'),_0x32d803,'request\x20sent');logger[_0x1a99('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x32d803,_0x1a99('0xe'),JSON['stringify'](_0x8bed05));if(_0x8bed05[_0x1a99('0xf')]){if(_0x8bed05[_0x1a99('0xf')][_0x1a99('0x10')]===0x1f4){logger[_0x1a99('0xf')](_0x1a99('0xc'),_0x32d803,_0x8bed05[_0x1a99('0xf')][_0x1a99('0x11')]);return _0x4a2f75(_0x8bed05['error'][_0x1a99('0x11')]);}logger[_0x1a99('0xf')](_0x1a99('0xc'),_0x32d803,_0x8bed05[_0x1a99('0xf')][_0x1a99('0x11')]);return _0x2f91ab(_0x8bed05[_0x1a99('0xf')][_0x1a99('0x11')]);}else{logger[_0x1a99('0xb')]('Setting,\x20%s,\x20%s',_0x32d803,_0x1a99('0xe'));_0x2f91ab(_0x8bed05[_0x1a99('0x12')][_0x1a99('0x11')]);}})['catch'](function(_0x24fb9c){logger[_0x1a99('0xf')](_0x1a99('0xc'),_0x32d803,_0x24fb9c);_0x4a2f75(_0x24fb9c);});});}exports[_0x1a99('0x13')]=function(_0x41e4ac){var _0x5b4404=this;return new Promise(function(_0x2c8512,_0xc32940){return db[_0x1a99('0x14')][_0x1a99('0x15')]({'raw':_0x41e4ac[_0x1a99('0x16')]?_0x41e4ac[_0x1a99('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x41e4ac['options']?_0x41e4ac[_0x1a99('0x16')][_0x1a99('0x17')]||null:null,'attributes':_0x41e4ac[_0x1a99('0x16')]?_0x41e4ac[_0x1a99('0x16')]['attributes']||null:null,'include':_0x41e4ac[_0x1a99('0x16')]?_0x41e4ac[_0x1a99('0x16')][_0x1a99('0x18')]?_[_0x1a99('0x19')](_0x41e4ac['options'][_0x1a99('0x18')],function(_0xa92459){return{'model':db[_0xa92459['model']],'as':_0xa92459['as'],'attributes':_0xa92459['attributes'],'include':_0xa92459[_0x1a99('0x18')]?_[_0x1a99('0x19')](_0xa92459[_0x1a99('0x18')],function(_0x55e953){return{'model':db[_0x55e953[_0x1a99('0x1a')]],'as':_0x55e953['as'],'attributes':_0x55e953[_0x1a99('0x1b')],'include':_0x55e953[_0x1a99('0x18')]?_['map'](_0x55e953['include'],function(_0x4620e5){return{'model':db[_0x4620e5[_0x1a99('0x1a')]],'as':_0x4620e5['as'],'attributes':_0x4620e5[_0x1a99('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1a99('0xa')](function(_0x39e5af){logger[_0x1a99('0xb')]('ShowSetting',_0x41e4ac);logger[_0x1a99('0xd')](_0x1a99('0x13'),_0x41e4ac,JSON[_0x1a99('0x1c')](_0x39e5af));_0x2c8512(_0x39e5af);})[_0x1a99('0x1d')](function(_0x273845){logger[_0x1a99('0xf')](_0x1a99('0x13'),_0x273845[_0x1a99('0x11')],_0x41e4ac);_0xc32940(_0x5b4404[_0x1a99('0xf')](0x1f4,_0x273845['message']));});});}; \ No newline at end of file +var _0x94d1=['client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSetting','Setting','options','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1f5ab3,_0x2d2473){var _0x2bd0d7=function(_0x41c41b){while(--_0x41c41b){_0x1f5ab3['push'](_0x1f5ab3['shift']());}};_0x2bd0d7(++_0x2d2473);}(_0x94d1,0x1e3));var _0x194d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94d1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x194d('0x0'));var util=require(_0x194d('0x1'));var moment=require(_0x194d('0x2'));var BPromise=require(_0x194d('0x3'));var rs=require(_0x194d('0x4'));var fs=require('fs');var Redis=require(_0x194d('0x5'));var db=require(_0x194d('0x6'))['db'];var utils=require(_0x194d('0x7'));var logger=require(_0x194d('0x8'))(_0x194d('0x9'));var config=require(_0x194d('0xa'));var jayson=require(_0x194d('0xb'));var client=jayson[_0x194d('0xc')][_0x194d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2914ee,_0x4f0948,_0x33bf3e){return new BPromise(function(_0xf3ea4c,_0x1683ed){return client['request'](_0x2914ee,_0x33bf3e)[_0x194d('0xe')](function(_0x405a3e){logger[_0x194d('0xf')](_0x194d('0x10'),_0x4f0948,_0x194d('0x11'));logger[_0x194d('0x12')](_0x194d('0x13'),_0x4f0948,'request\x20sent',JSON['stringify'](_0x405a3e));if(_0x405a3e[_0x194d('0x14')]){if(_0x405a3e[_0x194d('0x14')][_0x194d('0x15')]===0x1f4){logger[_0x194d('0x14')](_0x194d('0x10'),_0x4f0948,_0x405a3e[_0x194d('0x14')]['message']);return _0x1683ed(_0x405a3e['error'][_0x194d('0x16')]);}logger[_0x194d('0x14')](_0x194d('0x10'),_0x4f0948,_0x405a3e[_0x194d('0x14')][_0x194d('0x16')]);return _0xf3ea4c(_0x405a3e[_0x194d('0x14')][_0x194d('0x16')]);}else{logger[_0x194d('0xf')](_0x194d('0x10'),_0x4f0948,'request\x20sent');_0xf3ea4c(_0x405a3e[_0x194d('0x17')]['message']);}})[_0x194d('0x18')](function(_0xcf891a){logger['error']('Setting,\x20%s,\x20%s',_0x4f0948,_0xcf891a);_0x1683ed(_0xcf891a);});});}exports[_0x194d('0x19')]=function(_0x34d7a0){var _0x512150=this;return new Promise(function(_0x487aaa,_0xb23652){return db[_0x194d('0x1a')]['find']({'raw':_0x34d7a0[_0x194d('0x1b')]?_0x34d7a0[_0x194d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x34d7a0[_0x194d('0x1b')]?_0x34d7a0[_0x194d('0x1b')][_0x194d('0x1c')]||null:null,'attributes':_0x34d7a0[_0x194d('0x1b')]?_0x34d7a0[_0x194d('0x1b')][_0x194d('0x1d')]||null:null,'include':_0x34d7a0[_0x194d('0x1b')]?_0x34d7a0[_0x194d('0x1b')]['include']?_[_0x194d('0x1e')](_0x34d7a0[_0x194d('0x1b')][_0x194d('0x1f')],function(_0x57d1c0){return{'model':db[_0x57d1c0[_0x194d('0x20')]],'as':_0x57d1c0['as'],'attributes':_0x57d1c0[_0x194d('0x1d')],'include':_0x57d1c0[_0x194d('0x1f')]?_[_0x194d('0x1e')](_0x57d1c0[_0x194d('0x1f')],function(_0x252c7d){return{'model':db[_0x252c7d[_0x194d('0x20')]],'as':_0x252c7d['as'],'attributes':_0x252c7d[_0x194d('0x1d')],'include':_0x252c7d['include']?_['map'](_0x252c7d[_0x194d('0x1f')],function(_0x9ec5b4){return{'model':db[_0x9ec5b4[_0x194d('0x20')]],'as':_0x9ec5b4['as'],'attributes':_0x9ec5b4['attributes']};}):[]};}):[]};}):[]:[]})[_0x194d('0xe')](function(_0x2292d0){logger[_0x194d('0xf')]('ShowSetting',_0x34d7a0);logger[_0x194d('0x12')]('ShowSetting',_0x34d7a0,JSON['stringify'](_0x2292d0));_0x487aaa(_0x2292d0);})[_0x194d('0x18')](function(_0x41d086){logger[_0x194d('0x14')]('ShowSetting',_0x41d086['message'],_0x34d7a0);_0xb23652(_0x512150[_0x194d('0x14')](0x1f4,_0x41d086[_0x194d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d82657d..0781245 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 _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x26e6a3,_0x429ced){var _0x35dcb2=function(_0x5035ca){while(--_0x5035ca){_0x26e6a3['push'](_0x26e6a3['shift']());}};_0x35dcb2(++_0x429ced);}(_0x7a54,0x106));var _0x47a5=function(_0x3aa8eb,_0xdd6897){_0x3aa8eb=_0x3aa8eb-0x0;var _0x1becf2=_0x7a54[_0x3aa8eb];return _0x1becf2;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x98f01d,_0x30d607){var _0x509a4a=function(_0x3210dc){while(--_0x3210dc){_0x98f01d['push'](_0x98f01d['shift']());}};_0x509a4a(++_0x30d607);}(_0x7a54,0x106));var _0x47a5=function(_0x5bfd38,_0x15e2d2){_0x5bfd38=_0x5bfd38-0x0;var _0x5c61e0=_0x7a54[_0x5bfd38];return _0x5c61e0;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('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 c87d7f3..a42aca9 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 _0x6696=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','twilio','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','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'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0x6696,0x1a6));var _0x6669=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x6696[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0x6669('0x0'));var rs=require('randomstring');module[_0x6669('0x1')]={'name':{'type':Sequelize[_0x6669('0x2')],'unique':_0x6669('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x6669('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x6669('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x6669('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x6669('0x2')]},'type':{'type':Sequelize[_0x6669('0x4')](_0x6669('0x5'),'skebby','connectel',_0x6669('0x6'),_0x6669('0x7'),_0x6669('0x8'),_0x6669('0x9'),_0x6669('0xa'),_0x6669('0xb'),_0x6669('0xc'))},'accountSid':{'type':Sequelize[_0x6669('0x2')]},'authId':{'type':Sequelize[_0x6669('0x2')]},'authToken':{'type':Sequelize[_0x6669('0x2')]},'smsMethod':{'type':Sequelize[_0x6669('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x6669('0x2')]},'apiKey':{'type':Sequelize[_0x6669('0x2')]},'applicationId':{'type':Sequelize[_0x6669('0x2')]},'accountId':{'type':Sequelize[_0x6669('0x2')]},'senderString':{'type':Sequelize[_0x6669('0x2')]},'deliveryReport':{'type':Sequelize[_0x6669('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6669('0xe');}},'notificationSound':{'type':Sequelize[_0x6669('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6669('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6669('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6669('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6669('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6669('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x6669('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6669('0xf')],'comment':_0x6669('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x6669('0xd')],'defaultValue':![],'comment':_0x6669('0x11'),'set':function(_0x51c9ad){if(!_0x51c9ad)this[_0x6669('0x12')](_0x6669('0x13'),null);this['setDataValue'](_0x6669('0x14'),_0x51c9ad);}}}; \ No newline at end of file +var _0xff74=['exports','STRING','name','generate','ENUM','skebby','connectel','clicksend','plivo','clickatell','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','sequelize','randomstring'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xff74,0x1a0));var _0x4ff7=function(_0x14cc99,_0x2388ac){_0x14cc99=_0x14cc99-0x0;var _0x1cba02=_0xff74[_0x14cc99];return _0x1cba02;};'use strict';var Sequelize=require(_0x4ff7('0x0'));var rs=require(_0x4ff7('0x1'));module[_0x4ff7('0x2')]={'name':{'type':Sequelize[_0x4ff7('0x3')],'unique':_0x4ff7('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x4ff7('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x4ff7('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x4ff7('0x3')],'defaultValue':function(){return rs[_0x4ff7('0x5')]();}},'phone':{'type':Sequelize[_0x4ff7('0x3')]},'type':{'type':Sequelize[_0x4ff7('0x6')]('twilio',_0x4ff7('0x7'),_0x4ff7('0x8'),_0x4ff7('0x9'),_0x4ff7('0xa'),_0x4ff7('0xb'),'bandwidth','csc',_0x4ff7('0xc'),_0x4ff7('0xd'))},'accountSid':{'type':Sequelize[_0x4ff7('0x3')]},'authId':{'type':Sequelize[_0x4ff7('0x3')]},'authToken':{'type':Sequelize[_0x4ff7('0x3')]},'smsMethod':{'type':Sequelize[_0x4ff7('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x4ff7('0x3')]},'password':{'type':Sequelize[_0x4ff7('0x3')]},'apiKey':{'type':Sequelize[_0x4ff7('0x3')]},'applicationId':{'type':Sequelize[_0x4ff7('0x3')]},'accountId':{'type':Sequelize[_0x4ff7('0x3')]},'senderString':{'type':Sequelize[_0x4ff7('0x3')]},'deliveryReport':{'type':Sequelize[_0x4ff7('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x4ff7('0x3')]},'notificationTemplate':{'type':Sequelize[_0x4ff7('0xf')],'defaultValue':function(){return _0x4ff7('0x10');}},'notificationSound':{'type':Sequelize[_0x4ff7('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4ff7('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4ff7('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4ff7('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4ff7('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4ff7('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4ff7('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x4ff7('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4ff7('0x11')],'comment':_0x4ff7('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4ff7('0x13'),'set':function(_0x375c03){if(!_0x375c03)this[_0x4ff7('0x14')](_0x4ff7('0x15'),null);this[_0x4ff7('0x14')]('mandatoryDisposition',_0x375c03);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 5a74afa..3e9cf07 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 _0x82d4=['asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','sender','text','clicksend','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','created','autoclose','push','applications','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','json','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','tag','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby','skebby_dispatch_id','connectel','requestid','statusInt','message_id','status_code','groupName','redif','DELIVERED','inspect','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','apply','save','update','destroy','get','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','length','SmsAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','priority'];(function(_0x1b5358,_0x27aecc){var _0x241519=function(_0x36163e){while(--_0x36163e){_0x1b5358['push'](_0x1b5358['shift']());}};_0x241519(++_0x27aecc);}(_0x82d4,0x15b));var _0x482d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x82d4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x482d('0x0'));var rimraf=require(_0x482d('0x1'));var zipdir=require(_0x482d('0x2'));var jsonpatch=require(_0x482d('0x3'));var rp=require('request-promise');var moment=require(_0x482d('0x4'));var BPromise=require(_0x482d('0x5'));var Mustache=require(_0x482d('0x6'));var util=require(_0x482d('0x7'));var path=require(_0x482d('0x8'));var sox=require(_0x482d('0x9'));var csv=require(_0x482d('0xa'));var ejs=require(_0x482d('0xb'));var fs=require('fs');var fs_extra=require(_0x482d('0xc'));var _=require(_0x482d('0xd'));var squel=require(_0x482d('0xe'));var crypto=require(_0x482d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x482d('0x10'));var toCsv=require(_0x482d('0xa'));var querystring=require(_0x482d('0x11'));var Papa=require(_0x482d('0x12'));var Redis=require(_0x482d('0x13'));var authService=require(_0x482d('0x14'));var qs=require(_0x482d('0x15'));var as=require(_0x482d('0x16'));var hardwareService=require(_0x482d('0x17'));var logger=require('../../config/logger')(_0x482d('0x18'));var utils=require(_0x482d('0x19'));var config=require(_0x482d('0x1a'));var licenseUtil=require(_0x482d('0x1b'));var db=require(_0x482d('0x1c'))['db'];config[_0x482d('0x1d')]=_[_0x482d('0x1e')](config['redis'],{'host':_0x482d('0x1f'),'port':0x18eb});var socket=require(_0x482d('0x20'))(new Redis(config[_0x482d('0x1d')]));require(_0x482d('0x21'))['register'](socket);var jayson=require(_0x482d('0x22'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3b6046,_0x3b6f45,_0x2b6d54,_0x53ffa2){return new BPromise(function(_0x4b7d64,_0x27f2dc){var _0x208347=_0x53ffa2||client;return _0x208347['request'](_0x3b6046,_0x2b6d54)[_0x482d('0x23')](function(_0x515771){logger[_0x482d('0x24')](_0x482d('0x25'),_0x3b6f45,_0x482d('0x26'));logger['debug'](_0x482d('0x27'),_0x3b6f45,_0x482d('0x26'),JSON[_0x482d('0x28')](_0x515771));if(_0x515771[_0x482d('0x29')]){if(_0x515771[_0x482d('0x29')]['code']===0x1f4){logger['error'](_0x482d('0x25'),_0x3b6f45,_0x515771[_0x482d('0x29')][_0x482d('0x2a')]);return _0x27f2dc(_0x515771[_0x482d('0x29')][_0x482d('0x2a')]);}logger['error'](_0x482d('0x25'),_0x3b6f45,_0x515771[_0x482d('0x29')][_0x482d('0x2a')]);return _0x4b7d64(_0x515771[_0x482d('0x29')][_0x482d('0x2a')]);}else{logger[_0x482d('0x24')](_0x482d('0x25'),_0x3b6f45,'request\x20sent');_0x4b7d64(_0x515771[_0x482d('0x2b')][_0x482d('0x2a')]);}})[_0x482d('0x2c')](function(_0x24ea37){logger[_0x482d('0x29')]('SmsAccount,\x20%s,\x20%s',_0x3b6f45,_0x24ea37);_0x27f2dc(_0x24ea37);});});}function respondWithStatusCode(_0x1b19fe,_0xcabaa0){_0xcabaa0=_0xcabaa0||0xcc;return function(_0x285e37){if(_0x285e37){return _0x1b19fe[_0x482d('0x2d')](_0xcabaa0);}return _0x1b19fe['status'](_0xcabaa0)[_0x482d('0x2e')]();};}function respondWithResult(_0x360fa2,_0x239095){_0x239095=_0x239095||0xc8;return function(_0x5cdcf5){if(_0x5cdcf5){return _0x360fa2[_0x482d('0x2f')](_0x239095)['json'](_0x5cdcf5);}};}function respondWithFilteredResult(_0x5c1cfe,_0xf9544f){return function(_0x149c6c){if(_0x149c6c){var _0x565250=typeof _0xf9544f['offset']===_0x482d('0x30')&&typeof _0xf9544f['limit']==='undefined';var _0x5a0aa1=_0x149c6c[_0x482d('0x31')];var _0x2fb30d=_0x565250?0x0:_0xf9544f['offset'];var _0x690238=_0x565250?_0x149c6c[_0x482d('0x31')]:_0xf9544f[_0x482d('0x32')]+_0xf9544f[_0x482d('0x33')];var _0x3827e9;if(_0x690238>=_0x5a0aa1){_0x690238=_0x5a0aa1;_0x3827e9=0xc8;}else{_0x3827e9=0xce;}_0x5c1cfe['status'](_0x3827e9);return _0x5c1cfe[_0x482d('0x34')](_0x482d('0x35'),_0x2fb30d+'-'+_0x690238+'/'+_0x5a0aa1)['json'](_0x149c6c);}return null;};}function patchUpdates(_0xa81d71){return function(_0x4f7965){try{jsonpatch[_0x482d('0x36')](_0x4f7965,_0xa81d71,!![]);}catch(_0x272d15){return BPromise['reject'](_0x272d15);}return _0x4f7965[_0x482d('0x37')]();};}function saveUpdates(_0x20cc02,_0x1a09d4){return function(_0x2c6aaf){if(_0x2c6aaf){return _0x2c6aaf[_0x482d('0x38')](_0x20cc02)[_0x482d('0x23')](function(_0x2076e2){return _0x2076e2;});}return null;};}function removeEntity(_0xf8221f,_0x469f35){return function(_0x2fff40){if(_0x2fff40){return _0x2fff40[_0x482d('0x39')]()[_0x482d('0x23')](function(){var _0x346897=_0x2fff40[_0x482d('0x3a')]({'plain':!![]});var _0x342b27=_0x482d('0x3b');return db['UserProfileResource'][_0x482d('0x39')]({'where':{'type':_0x342b27,'resourceId':_0x346897['id']}})['then'](function(){return _0x2fff40;});})[_0x482d('0x23')](function(){_0xf8221f[_0x482d('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xceb02f,_0x2c8b1b){return function(_0x4aa1f1){if(!_0x4aa1f1){_0xceb02f[_0x482d('0x2d')](0x194);}return _0x4aa1f1;};}function handleError(_0x33a333,_0x5bc2a3){_0x5bc2a3=_0x5bc2a3||0x1f4;return function(_0x16c08f){logger['error'](_0x16c08f[_0x482d('0x3c')]);if(_0x16c08f[_0x482d('0x3d')]){delete _0x16c08f[_0x482d('0x3d')];}_0x33a333[_0x482d('0x2f')](_0x5bc2a3)[_0x482d('0x3e')](_0x16c08f);};}exports[_0x482d('0x3f')]=function(_0x2e244f,_0x334247){var _0x1c14fa={'include':[{'model':db[_0x482d('0x40')],'as':_0x482d('0x41')}]},_0x22fe06={},_0x139c66={'count':0x0,'rows':[]};var _0x562dd7=_[_0x482d('0x42')](db[_0x482d('0x43')][_0x482d('0x44')],function(_0x826808){return{'name':_0x826808[_0x482d('0x45')],'type':_0x826808[_0x482d('0x46')]['key']};});_0x22fe06[_0x482d('0x47')]=_[_0x482d('0x42')](_0x562dd7,'name');_0x22fe06['query']=_[_0x482d('0x48')](_0x2e244f[_0x482d('0x49')]);_0x22fe06['filters']=_[_0x482d('0x4a')](_0x22fe06[_0x482d('0x47')],_0x22fe06[_0x482d('0x49')]);_0x1c14fa[_0x482d('0x4b')]=_[_0x482d('0x4a')](_0x22fe06['model'],qs['fields'](_0x2e244f[_0x482d('0x49')]['fields']));_0x1c14fa[_0x482d('0x4b')]=_0x1c14fa[_0x482d('0x4b')]['length']?_0x1c14fa[_0x482d('0x4b')]:_0x22fe06[_0x482d('0x47')];if(!_0x2e244f['query'][_0x482d('0x4c')](_0x482d('0x4d'))){_0x1c14fa[_0x482d('0x33')]=qs[_0x482d('0x33')](_0x2e244f[_0x482d('0x49')][_0x482d('0x33')]);_0x1c14fa[_0x482d('0x32')]=qs[_0x482d('0x32')](_0x2e244f[_0x482d('0x49')][_0x482d('0x32')]);}_0x1c14fa[_0x482d('0x4e')]=qs[_0x482d('0x4f')](_0x2e244f[_0x482d('0x49')][_0x482d('0x4f')]);_0x1c14fa[_0x482d('0x50')]=qs['filters'](_[_0x482d('0x51')](_0x2e244f[_0x482d('0x49')],_0x22fe06[_0x482d('0x52')]),_0x562dd7);if(_0x2e244f[_0x482d('0x49')][_0x482d('0x53')]){_0x1c14fa[_0x482d('0x50')]=_[_0x482d('0x54')](_0x1c14fa['where'],{'$or':_[_0x482d('0x42')](_0x562dd7,function(_0x4b8789){if(_0x4b8789['type']!=='VIRTUAL'){var _0x5aded4={};_0x5aded4[_0x4b8789[_0x482d('0x3d')]]={'$like':'%'+_0x2e244f[_0x482d('0x49')][_0x482d('0x53')]+'%'};return _0x5aded4;}})});}_0x1c14fa=_['merge']({},_0x1c14fa,_0x2e244f[_0x482d('0x55')]);var _0x3876dd={'where':_0x1c14fa[_0x482d('0x50')]};return db[_0x482d('0x43')]['count'](_0x3876dd)['then'](function(_0x203abb){_0x139c66[_0x482d('0x31')]=_0x203abb;if(_0x2e244f['query'][_0x482d('0x56')]){_0x1c14fa[_0x482d('0x57')]=[{'all':!![]}];}return db['SmsAccount'][_0x482d('0x58')](_0x1c14fa);})[_0x482d('0x23')](function(_0x3be9c6){_0x139c66[_0x482d('0x59')]=_0x3be9c6;return _0x139c66;})[_0x482d('0x23')](respondWithFilteredResult(_0x334247,_0x1c14fa))['catch'](handleError(_0x334247,null));};exports['show']=function(_0x3c04f2,_0x32f23b){var _0x5c10e1={'raw':![],'where':{'id':_0x3c04f2[_0x482d('0x5a')]['id']},'include':[{'model':db[_0x482d('0x40')],'as':_0x482d('0x41')}]},_0xf0a9d0={};_0xf0a9d0[_0x482d('0x47')]=_[_0x482d('0x48')](db[_0x482d('0x43')][_0x482d('0x44')]);_0xf0a9d0[_0x482d('0x49')]=_[_0x482d('0x48')](_0x3c04f2[_0x482d('0x49')]);_0xf0a9d0[_0x482d('0x52')]=_[_0x482d('0x4a')](_0xf0a9d0[_0x482d('0x47')],_0xf0a9d0['query']);_0x5c10e1[_0x482d('0x4b')]=_[_0x482d('0x4a')](_0xf0a9d0[_0x482d('0x47')],qs[_0x482d('0x5b')](_0x3c04f2['query'][_0x482d('0x5b')]));_0x5c10e1[_0x482d('0x4b')]=_0x5c10e1[_0x482d('0x4b')]['length']?_0x5c10e1[_0x482d('0x4b')]:_0xf0a9d0['model'];if(_0x3c04f2[_0x482d('0x49')][_0x482d('0x56')]){_0x5c10e1['include']=[{'all':!![]}];}_0x5c10e1=_[_0x482d('0x54')]({},_0x5c10e1,_0x3c04f2[_0x482d('0x55')]);return db[_0x482d('0x43')][_0x482d('0x5c')](_0x5c10e1)[_0x482d('0x23')](handleEntityNotFound(_0x32f23b,null))['then'](respondWithResult(_0x32f23b,null))[_0x482d('0x2c')](handleError(_0x32f23b,null));};exports[_0x482d('0x5d')]=function(_0x52d4e6,_0x265bca){return db[_0x482d('0x43')][_0x482d('0x5d')](_0x52d4e6[_0x482d('0x5e')],{})[_0x482d('0x23')](function(_0x3184a9){var _0x1526ba=_0x52d4e6[_0x482d('0x5f')][_0x482d('0x3a')]({'plain':!![]});if(!_0x1526ba)throw new Error(_0x482d('0x60'));if(_0x1526ba[_0x482d('0x61')]===_0x482d('0x5f')){var _0x197a52=_0x3184a9[_0x482d('0x3a')]({'plain':!![]});var _0x1d423d=_0x482d('0x3b');return db[_0x482d('0x62')][_0x482d('0x5c')]({'where':{'name':_0x1d423d,'userProfileId':_0x1526ba['userProfileId']},'raw':!![]})[_0x482d('0x23')](function(_0x31835c){if(_0x31835c&&_0x31835c[_0x482d('0x63')]===0x0){return db[_0x482d('0x64')][_0x482d('0x5d')]({'name':_0x197a52[_0x482d('0x3d')],'resourceId':_0x197a52['id'],'type':_0x31835c[_0x482d('0x3d')],'sectionId':_0x31835c['id']},{})['then'](function(){return _0x3184a9;});}else{return _0x3184a9;}})[_0x482d('0x2c')](function(_0x5b990f){logger['error'](_0x482d('0x65'),_0x5b990f);throw _0x5b990f;});}return _0x3184a9;})[_0x482d('0x23')](respondWithResult(_0x265bca,0xc9))[_0x482d('0x2c')](handleError(_0x265bca,null));};exports[_0x482d('0x38')]=function(_0x1be567,_0x4d11e8){if(_0x1be567[_0x482d('0x5e')]['id']){delete _0x1be567[_0x482d('0x5e')]['id'];}return db[_0x482d('0x43')]['find']({'where':{'id':_0x1be567[_0x482d('0x5a')]['id']},'include':[{'model':db[_0x482d('0x40')],'as':_0x482d('0x41')}]})['then'](handleEntityNotFound(_0x4d11e8,null))[_0x482d('0x23')](saveUpdates(_0x1be567['body'],null))[_0x482d('0x23')](respondWithResult(_0x4d11e8,null))['catch'](handleError(_0x4d11e8,null));};exports[_0x482d('0x39')]=function(_0xe6b2fc,_0x5beb2f){return db[_0x482d('0x43')][_0x482d('0x5c')]({'where':{'id':_0xe6b2fc['params']['id']}})[_0x482d('0x23')](handleEntityNotFound(_0x5beb2f,null))[_0x482d('0x23')](removeEntity(_0x5beb2f,null))[_0x482d('0x2c')](handleError(_0x5beb2f,null));};exports[_0x482d('0x66')]=function(_0x959bb2,_0x45f680){return db[_0x482d('0x43')][_0x482d('0x66')]()['then'](respondWithResult(_0x45f680,null))[_0x482d('0x2c')](handleError(_0x45f680,null));};exports[_0x482d('0x67')]=function(_0x3ace47,_0x147ccd,_0x3a8017){if(_0x3ace47[_0x482d('0x5e')]['id']){delete _0x3ace47[_0x482d('0x5e')]['id'];}return db[_0x482d('0x43')][_0x482d('0x5c')]({'where':{'id':_0x3ace47[_0x482d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x147ccd,null))[_0x482d('0x23')](function(_0x41b7d8){if(_0x41b7d8){_0x3ace47['body']['SmsAccountId']=_0x41b7d8['id'];return db[_0x482d('0x68')][_0x482d('0x5d')](_0x3ace47[_0x482d('0x5e')]);}})[_0x482d('0x23')](respondWithResult(_0x147ccd,null))[_0x482d('0x2c')](handleError(_0x147ccd,null));};exports[_0x482d('0x69')]=function(_0x585e7f,_0x29c5bb,_0xb8c46f){var _0x56ce88={'raw':![],'where':{}};var _0x2a73b3={};var _0x1ada25={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x585e7f[_0x482d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x29c5bb,null))['then'](function(_0x35b87a){if(_0x35b87a){_0x2a73b3['model']=_[_0x482d('0x48')](db[_0x482d('0x68')]['rawAttributes']);_0x2a73b3[_0x482d('0x49')]=_[_0x482d('0x48')](_0x585e7f['query']);_0x2a73b3[_0x482d('0x52')]=_[_0x482d('0x4a')](_0x2a73b3['model'],_0x2a73b3['query']);_0x56ce88[_0x482d('0x4b')]=_[_0x482d('0x4a')](_0x2a73b3['model'],qs['fields'](_0x585e7f[_0x482d('0x49')][_0x482d('0x5b')]));_0x56ce88[_0x482d('0x4b')]=_0x56ce88[_0x482d('0x4b')][_0x482d('0x6a')]?_0x56ce88[_0x482d('0x4b')]:_0x2a73b3[_0x482d('0x47')];if(!_0x585e7f['query']['hasOwnProperty'](_0x482d('0x4d'))){_0x56ce88['limit']=qs['limit'](_0x585e7f[_0x482d('0x49')][_0x482d('0x33')]);_0x56ce88[_0x482d('0x32')]=qs['offset'](_0x585e7f['query'][_0x482d('0x32')]);}_0x56ce88[_0x482d('0x4e')]=qs[_0x482d('0x4f')](_0x585e7f[_0x482d('0x49')][_0x482d('0x4f')]);_0x56ce88[_0x482d('0x50')]=qs[_0x482d('0x52')](_[_0x482d('0x51')](_0x585e7f[_0x482d('0x49')],_0x2a73b3[_0x482d('0x52')]));_0x56ce88['where'][_0x482d('0x6b')]=_0x35b87a['id'];if(_0x585e7f[_0x482d('0x49')][_0x482d('0x53')]){_0x56ce88[_0x482d('0x50')]=_[_0x482d('0x54')](_0x56ce88[_0x482d('0x50')],{'$or':_[_0x482d('0x42')](_0x56ce88[_0x482d('0x4b')],function(_0x127f63){var _0xf9d648={};_0xf9d648[_0x127f63]={'$like':'%'+_0x585e7f[_0x482d('0x49')]['filter']+'%'};return _0xf9d648;})});}_0x56ce88=_['merge']({},_0x56ce88,_0x585e7f['options']);return db['Disposition']['count']({'where':_0x56ce88[_0x482d('0x50')]})[_0x482d('0x23')](function(_0x16a721){_0x1ada25['count']=_0x16a721;if(_0x585e7f[_0x482d('0x49')][_0x482d('0x56')]){_0x56ce88['include']=[{'all':!![]}];}return db[_0x482d('0x68')][_0x482d('0x58')](_0x56ce88);})[_0x482d('0x23')](function(_0xb34a15){_0x1ada25[_0x482d('0x59')]=_0xb34a15;return _0x1ada25;});}})[_0x482d('0x23')](respondWithFilteredResult(_0x29c5bb,_0x56ce88))[_0x482d('0x2c')](handleError(_0x29c5bb,null));};exports[_0x482d('0x6c')]=function(_0x488585,_0x2f7dd1,_0x34e176){return db[_0x482d('0x43')][_0x482d('0x5c')]({'where':{'id':_0x488585['params']['id']}})[_0x482d('0x23')](handleEntityNotFound(_0x2f7dd1,null))['then'](function(_0x43c42c){if(_0x43c42c){return _0x43c42c[_0x482d('0x6c')](_0x488585[_0x482d('0x49')]['ids']);}})[_0x482d('0x23')](respondWithStatusCode(_0x2f7dd1,null))['catch'](handleError(_0x2f7dd1,null));};exports[_0x482d('0x6d')]=function(_0x5d012a,_0x3c8eab,_0x48e050){if(_0x5d012a[_0x482d('0x5e')]['id']){delete _0x5d012a[_0x482d('0x5e')]['id'];}return db[_0x482d('0x43')][_0x482d('0x5c')]({'where':{'id':_0x5d012a[_0x482d('0x5a')]['id']}})[_0x482d('0x23')](handleEntityNotFound(_0x3c8eab,null))['then'](function(_0xedb17e){if(_0xedb17e){_0x5d012a[_0x482d('0x5e')][_0x482d('0x6b')]=_0xedb17e['id'];return db[_0x482d('0x6e')][_0x482d('0x5d')](_0x5d012a['body']);}})[_0x482d('0x23')](respondWithResult(_0x3c8eab,null))[_0x482d('0x2c')](handleError(_0x3c8eab,null));};exports[_0x482d('0x6f')]=function(_0x5dc558,_0x1d0132,_0x4fb29e){var _0x15a662={'raw':![],'where':{}};var _0x463a0c={};var _0x291e0f={'count':0x0,'rows':[]};return db[_0x482d('0x43')][_0x482d('0x70')]({'where':{'id':_0x5dc558['params']['id']}})[_0x482d('0x23')](handleEntityNotFound(_0x1d0132,null))[_0x482d('0x23')](function(_0x26f755){if(_0x26f755){_0x463a0c[_0x482d('0x47')]=_[_0x482d('0x48')](db[_0x482d('0x6e')][_0x482d('0x44')]);_0x463a0c[_0x482d('0x49')]=_[_0x482d('0x48')](_0x5dc558[_0x482d('0x49')]);_0x463a0c[_0x482d('0x52')]=_[_0x482d('0x4a')](_0x463a0c['model'],_0x463a0c[_0x482d('0x49')]);_0x15a662[_0x482d('0x4b')]=_[_0x482d('0x4a')](_0x463a0c['model'],qs[_0x482d('0x5b')](_0x5dc558['query'][_0x482d('0x5b')]));_0x15a662['attributes']=_0x15a662[_0x482d('0x4b')][_0x482d('0x6a')]?_0x15a662[_0x482d('0x4b')]:_0x463a0c[_0x482d('0x47')];if(!_0x5dc558[_0x482d('0x49')]['hasOwnProperty'](_0x482d('0x4d'))){_0x15a662[_0x482d('0x33')]=qs[_0x482d('0x33')](_0x5dc558[_0x482d('0x49')][_0x482d('0x33')]);_0x15a662[_0x482d('0x32')]=qs[_0x482d('0x32')](_0x5dc558[_0x482d('0x49')][_0x482d('0x32')]);}_0x15a662['order']=qs[_0x482d('0x4f')](_0x5dc558[_0x482d('0x49')][_0x482d('0x4f')]);_0x15a662[_0x482d('0x50')]=qs[_0x482d('0x52')](_['pick'](_0x5dc558[_0x482d('0x49')],_0x463a0c[_0x482d('0x52')]));_0x15a662['where'][_0x482d('0x6b')]=_0x26f755['id'];if(_0x5dc558['query'][_0x482d('0x53')]){_0x15a662['where']=_[_0x482d('0x54')](_0x15a662[_0x482d('0x50')],{'$or':_[_0x482d('0x42')](_0x15a662[_0x482d('0x4b')],function(_0x4382e2){var _0x2596e8={};_0x2596e8[_0x4382e2]={'$like':'%'+_0x5dc558[_0x482d('0x49')][_0x482d('0x53')]+'%'};return _0x2596e8;})});}_0x15a662=_[_0x482d('0x54')]({},_0x15a662,_0x5dc558['options']);return db[_0x482d('0x6e')][_0x482d('0x31')]({'where':_0x15a662['where']})[_0x482d('0x23')](function(_0x4884e7){_0x291e0f['count']=_0x4884e7;if(_0x5dc558[_0x482d('0x49')][_0x482d('0x56')]){_0x15a662[_0x482d('0x57')]=[{'all':!![]}];}return db[_0x482d('0x6e')][_0x482d('0x58')](_0x15a662);})[_0x482d('0x23')](function(_0x71e1cc){_0x291e0f[_0x482d('0x59')]=_0x71e1cc;return _0x291e0f;});}})[_0x482d('0x23')](respondWithFilteredResult(_0x1d0132,_0x15a662))[_0x482d('0x2c')](handleError(_0x1d0132,null));};exports[_0x482d('0x71')]=function(_0x223f9e,_0x507796,_0x19b4f6){return db[_0x482d('0x43')][_0x482d('0x5c')]({'where':{'id':_0x223f9e[_0x482d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x507796,null))[_0x482d('0x23')](function(_0x138b90){if(_0x138b90){return _0x138b90['removeAnswers'](_0x223f9e[_0x482d('0x49')][_0x482d('0x72')]);}})[_0x482d('0x23')](respondWithStatusCode(_0x507796,null))[_0x482d('0x2c')](handleError(_0x507796,null));};exports[_0x482d('0x73')]=function(_0x346d1e,_0x4786e5,_0x1795b6){var _0x5d6e6c={'channel':_0x482d('0x74')};var _0x57c2b4=[];var _0x580592=[];var _0x1f9dbd={};return db[_0x482d('0x43')][_0x482d('0x5c')]({'where':{'id':_0x346d1e[_0x482d('0x5a')]['id']},'include':[{'model':db[_0x482d('0x75')],'as':_0x482d('0x76')}]})[_0x482d('0x23')](handleEntityNotFound(_0x4786e5,null))[_0x482d('0x23')](function(_0x415ecc){_0x5d6e6c[_0x482d('0x77')]=_0x415ecc;_0x5d6e6c['applications']=_['orderBy'](_0x415ecc[_0x482d('0x76')],[_0x482d('0x78')],[_0x482d('0x79')]);if(_0x5d6e6c[_0x482d('0x77')]['Applications']){delete _0x5d6e6c[_0x482d('0x77')][_0x482d('0x76')];}return db[_0x482d('0x7a')][_0x482d('0x66')]();})['then'](function(_0x3293e6){if(!_0x3293e6){throw new db[(_0x482d('0x7b'))][(_0x482d('0x7c'))](_0x482d('0x7d'));}_0x57c2b4=_['difference'](_[_0x482d('0x48')](_0x3293e6),['createdAt',_0x482d('0x7e')]);_0x580592=_[_0x482d('0x7f')](_[_0x482d('0x48')](_0x3293e6),['createdAt',_0x482d('0x7e'),_0x482d('0x80'),_0x482d('0x81')]);_0x5d6e6c[_0x482d('0x5e')]={'mapKey':_0x482d('0x82')};if(_0x5d6e6c[_0x482d('0x77')][_0x482d('0x46')]){switch(_0x5d6e6c[_0x482d('0x77')][_0x482d('0x46')]){case'twilio':_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x83')]=_0x346d1e[_0x482d('0x5e')][_0x482d('0x84')];_0x5d6e6c[_0x482d('0x5e')]['body']=_0x346d1e['body'][_0x482d('0x85')];_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x86')]=_0x346d1e[_0x482d('0x5e')][_0x482d('0x87')];break;case'skebby':_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x83')]='+'+_0x346d1e[_0x482d('0x5e')][_0x482d('0x88')];_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x5e')]=_0x346d1e[_0x482d('0x5e')][_0x482d('0x89')];break;case'connectel':_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x83')]=_0x346d1e['body'][_0x482d('0x83')];_0x5d6e6c['body'][_0x482d('0x5e')]=_0x346d1e[_0x482d('0x5e')][_0x482d('0x2a')];break;case _0x482d('0x8a'):_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x83')]=_0x346d1e['body'][_0x482d('0x83')];_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x5e')]=_0x346d1e[_0x482d('0x5e')][_0x482d('0x5e')];_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x86')]=_0x346d1e[_0x482d('0x5e')]['message_id'];break;case'plivo':_0x5d6e6c[_0x482d('0x5e')]['from']=_0x346d1e[_0x482d('0x5e')][_0x482d('0x84')];_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x5e')]=_0x346d1e[_0x482d('0x5e')]['Text'];_0x5d6e6c[_0x482d('0x5e')]['messageId']=_0x346d1e[_0x482d('0x5e')][_0x482d('0x8b')];break;case _0x482d('0x8c'):_0x5d6e6c[_0x482d('0x5e')]['from']='+'+_0x346d1e[_0x482d('0x5e')][_0x482d('0x8d')][0x0][_0x482d('0x83')];_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x5e')]=_0x346d1e[_0x482d('0x5e')][_0x482d('0x8d')][0x0][_0x482d('0x89')];_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x86')]=_0x346d1e[_0x482d('0x5e')]['results'][0x0][_0x482d('0x86')];break;case _0x482d('0x8e'):_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x83')]=_0x346d1e[_0x482d('0x5e')][_0x482d('0x8f')];_0x5d6e6c[_0x482d('0x5e')]['body']=_0x346d1e[_0x482d('0x5e')][_0x482d('0x90')][_0x482d('0x2a')];break;case _0x482d('0x91'):_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x83')]=_0x346d1e['body']['fromNumber'];_0x5d6e6c[_0x482d('0x5e')]['body']=_0x346d1e[_0x482d('0x5e')][_0x482d('0x89')];_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x86')]=_0x346d1e['body']['replyMessageId'];break;case _0x482d('0x92'):_0x5d6e6c['body'][_0x482d('0x86')]=_0x346d1e[_0x482d('0x5e')][0x0][_0x482d('0x2a')]['id'];_0x5d6e6c[_0x482d('0x5e')]['from']=_0x346d1e['body'][0x0]['message']['from'];_0x5d6e6c['body']['body']=_0x346d1e[_0x482d('0x5e')][0x0][_0x482d('0x2a')]['text'];break;case _0x482d('0x93'):_0x5d6e6c['body'][_0x482d('0x83')]=_0x346d1e[_0x482d('0x5e')][_0x482d('0x83')];_0x5d6e6c[_0x482d('0x5e')]['body']=_0x346d1e[_0x482d('0x5e')][_0x482d('0x2a')];_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x86')]=_0x346d1e[_0x482d('0x5e')][_0x482d('0x94')];break;}}if(_0x5d6e6c[_0x482d('0x5e')]['id']){delete _0x5d6e6c[_0x482d('0x5e')]['id'];}if(_[_0x482d('0x95')](_0x5d6e6c[_0x482d('0x5e')]['from'])){throw new db[(_0x482d('0x7b'))][(_0x482d('0x7c'))](_0x482d('0x96'));}if(_[_0x482d('0x95')](_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x5e')])||_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x5e')]===''){throw new db[(_0x482d('0x7b'))][(_0x482d('0x7c'))](_0x482d('0x97'));}if(_[_0x482d('0x95')](_0x5d6e6c['body'][_0x482d('0x98')])){throw new db[(_0x482d('0x7b'))][(_0x482d('0x7c'))](_0x482d('0x99')+_0x580592);}if(!_['includes'](_0x580592,_0x5d6e6c['body']['mapKey'])){throw new db[(_0x482d('0x7b'))][(_0x482d('0x7c'))](_0x482d('0x9a')+_0x580592);}_0x1f9dbd[_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x98')]]=_0x5d6e6c[_0x482d('0x5e')]['from'];return db[_0x482d('0x9b')][_0x482d('0x5c')]({'where':{'id':_0x5d6e6c[_0x482d('0x77')][_0x482d('0x81')]},'include':[{'model':db[_0x482d('0x7a')],'as':_0x482d('0x9c'),'where':_0x1f9dbd,'limit':0x1,'order':[[_0x482d('0x7e'),_0x482d('0x9d')]]}]});})[_0x482d('0x23')](handleEntityNotFound(_0x4786e5,null))[_0x482d('0x23')](function(_0x237322){if(_0x237322){_0x5d6e6c[_0x482d('0x9e')]=_['omit'](_0x237322,['Contacts']);if(_0x237322['Contacts'][_0x482d('0x6a')]){return _0x237322[_0x482d('0x9c')][0x0];}var _0x4697ff=_[_0x482d('0x1e')](_0x5d6e6c[_0x482d('0x5e')],{'firstName':_0x5d6e6c[_0x482d('0x5e')]['from'],'ListId':_0x237322['id']});_0x4697ff[_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x98')]]=_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x83')];return db[_0x482d('0x7a')]['create'](_0x4697ff,{'fields':_0x57c2b4,'raw':!![]});}})[_0x482d('0x23')](handleEntityNotFound(_0x4786e5,null))[_0x482d('0x23')](function(_0x1cd847){if(_0x1cd847){_0x5d6e6c[_0x482d('0x9f')]=_0x1cd847;var _0x4e72dc={'ContactId':_0x1cd847['id'],'phone':_0x5d6e6c[_0x482d('0x5e')][_0x482d('0x83')],'SmsAccountId':_0x346d1e['params']['id']};var _0x331b40={'ContactId':_0x1cd847['id'],'SmsAccountId':_0x346d1e[_0x482d('0x5a')]['id'],'closed':![]};return db[_0x482d('0xa0')][_0x482d('0x5c')]({'where':_0x331b40})[_0x482d('0x23')](function(_0x1d1893){if(_0x1d1893){return[_0x1d1893,![]];}return db[_0x482d('0xa0')][_0x482d('0x5d')](_0x4e72dc)[_0x482d('0x23')](function(_0x7c978){return[_0x7c978,!![]];});});}})[_0x482d('0xa1')](function(_0x411052,_0x431c48){_0x5d6e6c[_0x482d('0xa2')]=_0x411052[_0x482d('0x3a')]({'plain':!![]});_0x5d6e6c[_0x482d('0xa2')][_0x482d('0xa3')]=![];if(_0x431c48){if(_0x5d6e6c[_0x482d('0x77')][_0x482d('0xa4')]){_0x5d6e6c['applications'][_0x482d('0xa5')]({'id':0x0,'priority':_0x5d6e6c[_0x482d('0xa6')][_0x482d('0x6a')]+0x1,'app':_0x482d('0xa7'),'appdata':'unmanaged','interval':_0x482d('0xa8')});}_0x5d6e6c[_0x482d('0xa2')]['created']=!![];}return db[_0x482d('0xa9')]['create']({'phone':_0x5d6e6c['body'][_0x482d('0x83')],'messageId':_0x5d6e6c[_0x482d('0x5e')]['messageId'],'body':_0x5d6e6c['body'][_0x482d('0x5e')],'SmsAccountId':_0x346d1e[_0x482d('0x5a')]['id'],'SmsInteractionId':_0x411052['id'],'direction':'in','ContactId':_0x411052[_0x482d('0xaa')],'AttachmentId':_0x5d6e6c[_0x482d('0x5e')][_0x482d('0xab')]});})['then'](function(_0xbeb0e0){_0x5d6e6c[_0x482d('0x2a')]=_0xbeb0e0;if(!_0x5d6e6c[_0x482d('0xa2')][_0x482d('0xac')])return;return db[_0x482d('0xad')]['find']({'attributes':['id',_0x482d('0x3d')],'where':{'id':_0x5d6e6c['interaction'][_0x482d('0xac')]}});})['then'](function(_0x2bf478){if(_0x2bf478){_0x5d6e6c[_0x482d('0xa6')][_0x482d('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2bf478[_0x482d('0x3d')]+','+(_0x5d6e6c[_0x482d('0x77')][_0x482d('0xaf')]||0xa),'interval':_0x482d('0xa8')});}if(!_0x5d6e6c[_0x482d('0xa2')]['queueId'])return;return db[_0x482d('0xb0')][_0x482d('0x5c')]({'attributes':['id',_0x482d('0x3d')],'where':{'id':_0x5d6e6c[_0x482d('0xa2')]['queueId']}});})['then'](function(_0x342a15){if(_0x342a15){_0x5d6e6c[_0x482d('0xa6')][_0x482d('0xae')]({'id':0x0,'priority':0x1,'app':_0x482d('0xb1'),'appdata':_0x342a15[_0x482d('0x3d')]+','+(_0x5d6e6c[_0x482d('0x77')][_0x482d('0xb2')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x482d('0xb3'),_0x482d('0xb4'),_0x5d6e6c);})['then'](function(_0x1f43e2){if(_0x1f43e2){var _0x1ccb8b=0xc8;var _0x4d07e7=_0x482d('0xb5');logger[_0x482d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4d07e7,_0x1ccb8b,'entity\x20found');logger[_0x482d('0xb6')](_0x482d('0xb7'),_0x4d07e7,_0x1ccb8b,'entity\x20found',JSON['stringify'](_0x1f43e2));if(_0x5d6e6c[_0x482d('0x77')]['type']===_0x482d('0xb8')){return _0x4786e5[_0x482d('0x2f')](_0x1ccb8b)[_0x482d('0x34')](_0x482d('0xb9'),'text/xml')[_0x482d('0x3e')](_0x482d('0xba'));}else{return _0x4786e5['status'](_0x1ccb8b)['json'](_0x1f43e2);}}})['catch'](handleError(_0x4786e5,null));};exports[_0x482d('0xbb')]=function(_0x4fec94,_0x25eb54){var _0x5e424e=_0x4fec94[_0x482d('0x5a')]['id'];var _0x5c7595=_0x4fec94[_0x482d('0x5e')];var _0x102fef=0xc8;var _0x59ee41=null;return db[_0x482d('0xbc')]['transaction']({'isolationLevel':db[_0x482d('0xbc')][_0x482d('0xbd')][_0x482d('0xbe')][_0x482d('0xbf')]},function(_0x30e07){return db['SmsAccount'][_0x482d('0x70')]({'where':{'id':_0x5e424e},'transaction':_0x30e07})['then'](function(_0x112a52){if(_0x112a52){return db[_0x482d('0x75')]['destroy']({'where':{'SmsAccountId':_0x5e424e},'transaction':_0x30e07})[_0x482d('0x23')](function(){var _0x39ad70=_[_0x482d('0x42')](_0x5c7595,function(_0x1182bf){_0x1182bf[_0x482d('0x6b')]=_0x5e424e;return _0x1182bf;});return db[_0x482d('0x75')][_0x482d('0xc0')](_0x39ad70,{'transaction':_0x30e07});});}else{_0x102fef=0x194;_0x59ee41=[];}});})[_0x482d('0x23')](function(){if(_0x102fef!==0x194){return db[_0x482d('0x75')][_0x482d('0xc1')]({'where':{'SmsAccountId':_0x5e424e},'order':_0x482d('0x78')})[_0x482d('0x23')](function(_0x538a31){_0x59ee41=_0x538a31;});}})['catch'](function(_0x133cae){_0x102fef=0x1f4;logger[_0x482d('0x29')](_0x133cae['stack']);if(_0x133cae['name']){delete _0x133cae[_0x482d('0x3d')];}_0x59ee41=_0x133cae;})[_0x482d('0xc2')](function(){if(_0x59ee41===null){_0x25eb54[_0x482d('0x2d')](_0x102fef);}else{if(_0x102fef===0x1f4){_0x25eb54[_0x482d('0x2f')](_0x102fef)[_0x482d('0x3e')](_0x59ee41);}else{_0x25eb54[_0x482d('0x2f')](_0x102fef)[_0x482d('0xc3')](_0x59ee41);}}});};exports[_0x482d('0xc4')]=function(_0x22de4f,_0x247e82,_0x1a2111){var _0x46538a={};var _0x2c4c79={};var _0x2f050c;var _0xfd3e3b;return db[_0x482d('0x43')][_0x482d('0x70')]({'where':{'id':_0x22de4f[_0x482d('0x5a')]['id']}})[_0x482d('0x23')](handleEntityNotFound(_0x247e82,null))[_0x482d('0x23')](function(_0x337942){if(_0x337942){_0x2f050c=_0x337942;_0x2c4c79['model']=_[_0x482d('0x48')](db[_0x482d('0x75')]['rawAttributes']);_0x2c4c79[_0x482d('0x49')]=_[_0x482d('0x48')](_0x22de4f[_0x482d('0x49')]);_0x2c4c79[_0x482d('0x52')]=_['intersection'](_0x2c4c79[_0x482d('0x47')],_0x2c4c79[_0x482d('0x49')]);_0x46538a['attributes']=_['intersection'](_0x2c4c79[_0x482d('0x47')],qs[_0x482d('0x5b')](_0x22de4f[_0x482d('0x49')][_0x482d('0x5b')]));_0x46538a[_0x482d('0x4b')]=_0x46538a[_0x482d('0x4b')]['length']?_0x46538a[_0x482d('0x4b')]:_0x2c4c79[_0x482d('0x47')];_0x46538a[_0x482d('0x4e')]=qs[_0x482d('0x4f')](_0x22de4f[_0x482d('0x49')]['sort']);_0x46538a[_0x482d('0x50')]=qs[_0x482d('0x52')](_[_0x482d('0x51')](_0x22de4f[_0x482d('0x49')],_0x2c4c79[_0x482d('0x52')]));if(_0x22de4f[_0x482d('0x49')][_0x482d('0x53')]){_0x46538a[_0x482d('0x50')]=_[_0x482d('0x54')](_0x46538a[_0x482d('0x50')],{'$or':_[_0x482d('0x42')](_0x46538a[_0x482d('0x4b')],function(_0x3b5422){var _0x35146c={};_0x35146c[_0x3b5422]={'$like':'%'+_0x22de4f[_0x482d('0x49')]['filter']+'%'};return _0x35146c;})});}_0x46538a=_[_0x482d('0x54')]({},_0x46538a,_0x22de4f['options']);return _0x2f050c[_0x482d('0xc4')](_0x46538a);}})[_0x482d('0x23')](function(_0x59e38e){if(_0x59e38e){_0xfd3e3b=_0x59e38e[_0x482d('0x6a')];if(!_0x22de4f[_0x482d('0x49')][_0x482d('0x4c')]('nolimit')){_0x46538a[_0x482d('0x33')]=qs['limit'](_0x22de4f['query'][_0x482d('0x33')]);_0x46538a[_0x482d('0x32')]=qs['offset'](_0x22de4f[_0x482d('0x49')][_0x482d('0x32')]);}return _0x2f050c[_0x482d('0xc4')](_0x46538a);}})[_0x482d('0x23')](function(_0x5966ab){if(_0x5966ab){return _0x5966ab?{'count':_0xfd3e3b,'rows':_0x5966ab}:null;}})[_0x482d('0x23')](respondWithResult(_0x247e82,null))[_0x482d('0x2c')](handleError(_0x247e82,null));};exports[_0x482d('0xc5')]=function(_0x33a262,_0xda168e,_0x114e80){var _0x17c5ed={'raw':![],'where':{}};var _0x18af54={};var _0x5e1a5c={'count':0x0,'rows':[]};return db[_0x482d('0x43')][_0x482d('0x70')]({'where':{'id':_0x33a262['params']['id']}})[_0x482d('0x23')](handleEntityNotFound(_0xda168e,null))[_0x482d('0x23')](function(_0x5d19d3){if(_0x5d19d3){_0x18af54[_0x482d('0x47')]=_['keys'](db[_0x482d('0xa0')]['rawAttributes']);_0x18af54['query']=_['keys'](_0x33a262[_0x482d('0x49')]);_0x18af54[_0x482d('0x52')]=_[_0x482d('0x4a')](_0x18af54[_0x482d('0x47')],_0x18af54[_0x482d('0x49')]);_0x17c5ed[_0x482d('0x4b')]=_[_0x482d('0x4a')](_0x18af54[_0x482d('0x47')],qs[_0x482d('0x5b')](_0x33a262[_0x482d('0x49')][_0x482d('0x5b')]));_0x17c5ed[_0x482d('0x4b')]=_0x17c5ed[_0x482d('0x4b')]['length']?_0x17c5ed['attributes']:_0x18af54[_0x482d('0x47')];if(!_0x33a262[_0x482d('0x49')]['hasOwnProperty']('nolimit')){_0x17c5ed[_0x482d('0x33')]=qs[_0x482d('0x33')](_0x33a262[_0x482d('0x49')][_0x482d('0x33')]);_0x17c5ed[_0x482d('0x32')]=qs[_0x482d('0x32')](_0x33a262[_0x482d('0x49')]['offset']);}_0x17c5ed[_0x482d('0x4e')]=qs[_0x482d('0x4f')](_0x33a262['query'][_0x482d('0x4f')]);_0x17c5ed[_0x482d('0x50')]=qs['filters'](_[_0x482d('0x51')](_0x33a262[_0x482d('0x49')],_0x18af54[_0x482d('0x52')]));_0x17c5ed['where'][_0x482d('0x6b')]=_0x5d19d3['id'];if(_0x33a262['query']['filter']){_0x17c5ed[_0x482d('0x50')]=_[_0x482d('0x54')](_0x17c5ed[_0x482d('0x50')],{'$or':_[_0x482d('0x42')](_0x17c5ed[_0x482d('0x4b')],function(_0xdd4599){var _0x1c4474={};_0x1c4474[_0xdd4599]={'$like':'%'+_0x33a262[_0x482d('0x49')]['filter']+'%'};return _0x1c4474;})});}_0x17c5ed=_[_0x482d('0x54')]({},_0x17c5ed,_0x33a262['options']);return db[_0x482d('0xa0')][_0x482d('0x31')]({'where':_0x17c5ed[_0x482d('0x50')]})[_0x482d('0x23')](function(_0x4d1744){_0x5e1a5c[_0x482d('0x31')]=_0x4d1744;if(_0x33a262['query'][_0x482d('0x56')]){_0x17c5ed[_0x482d('0x57')]=[{'model':db[_0x482d('0x7a')],'as':_0x482d('0xc6'),'required':![]},{'model':db[_0x482d('0xad')],'as':_0x482d('0xc7'),'attributes':[_0x482d('0x3d'),_0x482d('0xc8'),_0x482d('0xc9')],'required':![]},{'model':db['Tag'],'as':_0x482d('0xca'),'attributes':['id',_0x482d('0x3d'),'color'],'where':_0x33a262[_0x482d('0x49')]['tag']?{'id':_0x33a262['query'][_0x482d('0xcb')]}:undefined,'required':_0x33a262['query'][_0x482d('0xcb')]?!![]:![]}];}return db[_0x482d('0xa0')][_0x482d('0x58')](_0x17c5ed);})['then'](function(_0x8b817){_0x5e1a5c['rows']=_0x8b817;return _0x5e1a5c;});}})['then'](respondWithFilteredResult(_0xda168e,_0x17c5ed))['catch'](handleError(_0xda168e,null));};exports['send']=function(_0xc2982a,_0x43e07e,_0x2f23ea){var _0x4cac83,_0x367d61,_0x1f62f2;if(_['isNil'](_0xc2982a[_0x482d('0x5e')][_0x482d('0x5e')])||_0xc2982a[_0x482d('0x5e')][_0x482d('0x5e')]===''){throw new db[(_0x482d('0x7b'))]['ValidationError'](_0x482d('0x97'));}if(_['isNil'](_0xc2982a[_0x482d('0x5e')]['to'])){throw new db[(_0x482d('0x7b'))][(_0x482d('0x7c'))]('to\x20is\x20mandatory');}_0x4cac83=_0xc2982a[_0x482d('0x5e')]['to'];return db[_0x482d('0x43')][_0x482d('0x5c')]({'where':{'id':_0xc2982a[_0x482d('0x5a')]['id']},'include':[{'model':db[_0x482d('0x9b')],'as':'List','include':[{'model':db[_0x482d('0x7a')],'as':_0x482d('0x9c'),'where':{'mobile':_0x4cac83},'limit':0x1,'order':[[_0x482d('0x7e'),_0x482d('0x9d')]]}]}]})[_0x482d('0x23')](handleEntityNotFound(_0x43e07e,null))[_0x482d('0x23')](function(_0x236550){if(_0x236550&&_0x236550[_0x482d('0xcc')]){_0x367d61=_0x236550[_0x482d('0x3a')]({'plain':!![]});if(_0x367d61[_0x482d('0xcc')]&&_0x367d61['List']['Contacts'][_0x482d('0x6a')]){return _0x367d61['List'][_0x482d('0x9c')][0x0];}return db[_0x482d('0x7a')][_0x482d('0x5d')](_['defaults'](_0xc2982a[_0x482d('0x5e')],{'firstName':_0x4cac83,'mobile':_0x4cac83,'phone':_0x4cac83,'ListId':_0x367d61[_0x482d('0x81')]}));}})[_0x482d('0x23')](handleEntityNotFound(_0x43e07e,null))[_0x482d('0x23')](function(_0x4e43e8){if(_0x4e43e8){_0x1f62f2=_0x4e43e8;return db['SmsInteraction']['find']({'where':{'ContactId':_0x1f62f2['id'],'closed':![],'SmsAccountId':_0x367d61['id']}})['then'](function(_0x110336){if(_0x110336){return[_0x110336,![]];}return db[_0x482d('0xa0')][_0x482d('0x5d')]({'UserId':_0xc2982a['user']['id'],'ContactId':_0x1f62f2['id'],'SmsAccountId':_0x367d61['id'],'phone':_0x4cac83,'firstMsgDirection':_0x482d('0xcd'),'Messages':[_[_0x482d('0x54')](_0xc2982a['body'],{'read':![],'body':_0xc2982a['body'][_0x482d('0x5e')],'phone':_0x4cac83,'SmsAccountId':_0x367d61['id'],'UserId':_0xc2982a['user']['id'],'ContactId':_0x1f62f2['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x482d('0xce')}]})[_0x482d('0x23')](function(_0x49b698){return[_0x49b698,!![]];});});}})[_0x482d('0xa1')](function(_0x286c7d,_0x18be42){if(_0x18be42){return _0x286c7d;}return db[_0x482d('0xa9')][_0x482d('0x5d')](_[_0x482d('0x54')](_0xc2982a[_0x482d('0x5e')],{'read':![],'body':_0xc2982a['body']['body'],'phone':_0x4cac83,'SmsAccountId':_0x367d61['id'],'SmsInteractionId':_0x286c7d['id'],'UserId':_0xc2982a['user']['id'],'ContactId':_0x1f62f2['id']}))[_0x482d('0x23')](function(_0x284b93){_0x286c7d[_0x482d('0xcf')][_0x482d('0xce')]=[];_0x286c7d[_0x482d('0xcf')]['Messages']['push'](_0x284b93[_0x482d('0xcf')]);return _0x286c7d;});})[_0x482d('0x23')](respondWithResult(_0x43e07e,null))[_0x482d('0x2c')](handleError(_0x43e07e,null));};exports[_0x482d('0x2f')]=function(_0x2542e0,_0x30d31a,_0x3dfee8){if(_0x2542e0[_0x482d('0x5e')]['id']){delete _0x2542e0[_0x482d('0x5e')]['id'];}var _0x1baa31,_0x349444,_0x49e49e;return db[_0x482d('0x43')][_0x482d('0x5c')]({'where':{'id':_0x2542e0[_0x482d('0x5a')]['id']}})[_0x482d('0x23')](handleEntityNotFound(_0x30d31a,null))[_0x482d('0x23')](function(_0x234714){if(_0x234714){_0x49e49e=_0x234714;logger[_0x482d('0xb6')](_0x482d('0x27'),'status',_0x482d('0xd0'),_0x234714[_0x482d('0x46')],util['inspect'](_0x2542e0[_0x482d('0x5e')],{'showHidden':![],'depth':null}));switch(_0x234714[_0x482d('0x46')]){case _0x482d('0xd1'):if(_0x2542e0[_0x482d('0x5e')][_0x482d('0xd2')]&&_0x2542e0[_0x482d('0x5e')]['status']){_0x349444=_0x2542e0['body'][_0x482d('0x2f')];return db['SmsMessage'][_0x482d('0x5c')]({'where':{'messageId':_0x2542e0[_0x482d('0x5e')]['skebby_dispatch_id']}});}break;case _0x482d('0xd3'):if(_0x2542e0[_0x482d('0x5e')][_0x482d('0xd4')]&&_0x2542e0[_0x482d('0x5e')][_0x482d('0xd5')]){_0x349444=_0x2542e0['body'][_0x482d('0xd5')];return db['SmsMessage'][_0x482d('0x5c')]({'where':{'messageId':_0x2542e0[_0x482d('0x5e')][_0x482d('0xd4')]}});}break;case _0x482d('0x8a'):if(_0x2542e0[_0x482d('0x5e')][_0x482d('0xd6')]&&_0x2542e0[_0x482d('0x5e')]['status_code']){_0x349444=_0x2542e0[_0x482d('0x5e')][_0x482d('0xd7')];return db[_0x482d('0xa9')]['find']({'where':{'messageId':_0x2542e0[_0x482d('0x5e')][_0x482d('0xd6')]}});}break;case'infobip':var _0x34c997=_0x2542e0[_0x482d('0x5e')][_0x482d('0x8d')][0x0];if(_0x34c997[_0x482d('0x86')]&&_0x34c997[_0x482d('0x2f')]['groupName']==='DELIVERED'){_0x349444=_0x34c997[_0x482d('0x2f')][_0x482d('0xd8')];return db[_0x482d('0xa9')]['find']({'where':{'messageId':_0x34c997[_0x482d('0x86')]}});}break;case _0x482d('0x91'):if(_0x2542e0[_0x482d('0x5e')][_0x482d('0x86')]&&_0x2542e0['body']['status']){_0x349444=_0x2542e0[_0x482d('0x5e')]['status'];return db[_0x482d('0xa9')][_0x482d('0x5c')]({'where':{'messageId':_0x2542e0[_0x482d('0x5e')][_0x482d('0x86')]}});}break;case _0x482d('0x92'):if(_0x2542e0[_0x482d('0x5e')][0x0][_0x482d('0x2a')]['id']){_0x349444=_0x2542e0[_0x482d('0x5e')][0x0][_0x482d('0x46')];return db['SmsMessage'][_0x482d('0x5c')]({'where':{'messageId':_0x2542e0['body'][0x0][_0x482d('0x2a')]['id']}});}break;case _0x482d('0x93'):if(_0x2542e0['body'][_0x482d('0xd9')]&&_0x2542e0[_0x482d('0x5e')]['status']){_0x349444=_0x2542e0[_0x482d('0x5e')][_0x482d('0x2f')];return db[_0x482d('0xa9')]['find']({'where':{'messageId':_0x2542e0[_0x482d('0x5e')]['redif']}});}break;}}})[_0x482d('0x23')](handleEntityNotFound(_0x30d31a,null))[_0x482d('0x23')](function(_0x55f476){if(_0x55f476){_0x1baa31=_0x55f476;switch(_0x49e49e[_0x482d('0x46')]){case'skebby':if(_0x349444===_0x482d('0xda')){return _0x1baa31['update']({'read':!![]});}else{logger[_0x482d('0x29')](_0x482d('0x27'),_0x482d('0x2f'),'skebby',util[_0x482d('0xdb')](_0x2542e0['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x349444==='1'){return _0x1baa31[_0x482d('0x38')]({'read':!![]});}else{logger[_0x482d('0x29')](_0x482d('0x27'),'status',_0x482d('0xd1'),util['inspect'](_0x2542e0[_0x482d('0x5e')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x2542e0[_0x482d('0x5e')]['error_code']&&_0x349444>=0xc8&&_0x349444<=0xce){return _0x1baa31[_0x482d('0x38')]({'read':!![]});}else{logger[_0x482d('0x29')](_0x482d('0x27'),_0x482d('0x2f'),_0x482d('0x8a'),util['inspect'](_0x2542e0[_0x482d('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x482d('0x8c'):var _0x186354=_0x2542e0[_0x482d('0x5e')]['results'][0x0];if(_0x186354[_0x482d('0x2f')][_0x482d('0xd8')]===_0x482d('0xda')){return _0x1baa31[_0x482d('0x38')]({'read':!![]});}else{logger[_0x482d('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x482d('0x2f'),'infobip',util[_0x482d('0xdb')](_0x2542e0[_0x482d('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x482d('0x91'):if(_0x349444==_0x482d('0xdc')||_0x349444==_0x482d('0xdd')){return _0x1baa31[_0x482d('0x38')]({'read':!![]});}else{logger[_0x482d('0x29')](_0x482d('0x27'),_0x482d('0x2f'),_0x482d('0x91'),util[_0x482d('0xdb')](_0x2542e0[_0x482d('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x482d('0x92'):if(_0x349444==_0x482d('0xde')){return _0x1baa31[_0x482d('0x38')]({'read':!![]});}else{logger[_0x482d('0x29')](_0x482d('0x27'),_0x482d('0x2f'),_0x482d('0x92'),util[_0x482d('0xdb')](_0x2542e0[_0x482d('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x482d('0x93'):if(_0x349444===_0x482d('0xdf')||_0x349444===_0x482d('0xe0')){return _0x1baa31['update']({'read':!![]});}else{logger[_0x482d('0x29')](_0x482d('0x27'),_0x482d('0x2f'),_0x482d('0x93'),util[_0x482d('0xdb')](_0x2542e0[_0x482d('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x1baa31;}})['then'](respondWithResult(_0x30d31a,null))[_0x482d('0x2c')](handleError(_0x30d31a,null));};exports[_0x482d('0xe1')]=function(_0x5d263e,_0x277c2c,_0x3df47b){var _0xaa59f3,_0x4fa5e6,_0x44304d;return db[_0x482d('0x43')]['find']({'where':{'id':_0x5d263e[_0x482d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x277c2c,null))[_0x482d('0x23')](function(_0x14f935){if(_0x14f935){_0x44304d=_0x14f935;logger['debug'](_0x482d('0x27'),_0x482d('0x2f'),_0x482d('0xd0'),_0x14f935['type'],util[_0x482d('0xdb')](_0x5d263e['query'],{'showHidden':![],'depth':null}));switch(_0x14f935[_0x482d('0x46')]){case'csc':if(_0x5d263e['query'][_0x482d('0xe2')]&&_0x5d263e[_0x482d('0x49')][_0x482d('0xe3')]){_0x4fa5e6=_0x5d263e[_0x482d('0x49')][_0x482d('0xe3')];return db[_0x482d('0xa9')][_0x482d('0x5c')]({'where':{'messageId':_0x5d263e[_0x482d('0x49')][_0x482d('0xe2')]}});}break;}}})[_0x482d('0x23')](handleEntityNotFound(_0x277c2c,null))[_0x482d('0x23')](function(_0x24df56){if(_0x24df56){_0xaa59f3=_0x24df56;switch(_0x44304d[_0x482d('0x46')]){case _0x482d('0x8e'):if(_0x4fa5e6==='2'||_0x4fa5e6==='6'){return _0xaa59f3['update']({'read':!![]});}else{logger['error'](_0x482d('0x27'),_0x482d('0x2f'),_0x482d('0x8e'),util[_0x482d('0xdb')](_0x5d263e[_0x482d('0x49')],{'showHidden':![],'depth':null}));};break;}return _0xaa59f3;}})['then'](respondWithResult(_0x277c2c,null))[_0x482d('0x2c')](handleError(_0x277c2c,null));};exports[_0x482d('0xe4')]=function(_0x256ec4,_0x5efadd,_0x224046){return db['SmsAccount'][_0x482d('0x5c')]({'where':{'id':_0x256ec4[_0x482d('0x5a')]['id']}})[_0x482d('0x23')](handleEntityNotFound(_0x5efadd,null))[_0x482d('0x23')](function(_0x1c100f){if(_0x1c100f){return _0x1c100f[_0x482d('0xe4')](_0x256ec4[_0x482d('0x5e')][_0x482d('0x72')],_['omit'](_0x256ec4[_0x482d('0x5e')],[_0x482d('0x72'),'id'])||{})[_0x482d('0xa1')](function(_0x40fa8b){for(var _0x37afd7=0x0;_0x37afd7<_0x256ec4['body'][_0x482d('0x72')][_0x482d('0x6a')];_0x37afd7+=0x1){socket['emit'](_0x482d('0xe5'),{'UserId':Number(_0x256ec4['body'][_0x482d('0x72')][_0x37afd7]),'SmsAccountId':Number(_0x256ec4['params']['id'])});}return _0x40fa8b;});}})['then'](respondWithResult(_0x5efadd,null))['catch'](handleError(_0x5efadd,null));};exports[_0x482d('0xe6')]=function(_0x4b2e4e,_0x119088,_0x1d1ee2){return db['SmsAccount']['find']({'where':{'id':_0x4b2e4e[_0x482d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x119088,null))['then'](function(_0x13c2de){if(_0x13c2de){return _0x13c2de[_0x482d('0xe6')](_0x4b2e4e[_0x482d('0x49')]['ids'])['then'](function(){if(_[_0x482d('0xe7')](_0x4b2e4e[_0x482d('0x49')][_0x482d('0x72')])){for(var _0x4a92d7=0x0;_0x4a92d7<_0x4b2e4e[_0x482d('0x49')][_0x482d('0x72')][_0x482d('0x6a')];_0x4a92d7+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x4b2e4e['query'][_0x482d('0x72')][_0x4a92d7]),'SmsAccountId':Number(_0x4b2e4e[_0x482d('0x5a')]['id'])});}}else{socket[_0x482d('0xe8')]('userSmsAccount:remove',{'UserId':Number(_0x4b2e4e[_0x482d('0x49')][_0x482d('0x72')]),'SmsAccountId':Number(_0x4b2e4e[_0x482d('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x119088,null))['catch'](handleError(_0x119088,null));};exports[_0x482d('0xe9')]=function(_0x308f81,_0x3fd198,_0x13cb0d){var _0x58ea70={};var _0x1e3308={};var _0x23f493;var _0x2aced9;return db[_0x482d('0x43')]['findOne']({'where':{'id':_0x308f81[_0x482d('0x5a')]['id']}})[_0x482d('0x23')](handleEntityNotFound(_0x3fd198,null))[_0x482d('0x23')](function(_0x312989){if(_0x312989){_0x23f493=_0x312989;_0x1e3308[_0x482d('0x47')]=_[_0x482d('0x48')](db['User'][_0x482d('0x44')]);_0x1e3308[_0x482d('0x49')]=_[_0x482d('0x48')](_0x308f81[_0x482d('0x49')]);_0x1e3308[_0x482d('0x52')]=_[_0x482d('0x4a')](_0x1e3308['model'],_0x1e3308[_0x482d('0x49')]);_0x58ea70[_0x482d('0x4b')]=_['intersection'](_0x1e3308[_0x482d('0x47')],qs[_0x482d('0x5b')](_0x308f81[_0x482d('0x49')][_0x482d('0x5b')]));_0x58ea70[_0x482d('0x4b')]=_0x58ea70[_0x482d('0x4b')][_0x482d('0x6a')]?_0x58ea70[_0x482d('0x4b')]:_0x1e3308[_0x482d('0x47')];_0x58ea70[_0x482d('0x4e')]=qs['sort'](_0x308f81[_0x482d('0x49')][_0x482d('0x4f')]);_0x58ea70[_0x482d('0x50')]=qs[_0x482d('0x52')](_[_0x482d('0x51')](_0x308f81[_0x482d('0x49')],_0x1e3308[_0x482d('0x52')]));if(_0x308f81[_0x482d('0x49')][_0x482d('0x53')]){_0x58ea70[_0x482d('0x50')]=_[_0x482d('0x54')](_0x58ea70['where'],{'$or':_[_0x482d('0x42')](_0x58ea70[_0x482d('0x4b')],function(_0x26a51f){var _0xdc3420={};_0xdc3420[_0x26a51f]={'$like':'%'+_0x308f81[_0x482d('0x49')]['filter']+'%'};return _0xdc3420;})});}_0x58ea70=_[_0x482d('0x54')]({},_0x58ea70,_0x308f81[_0x482d('0x55')]);return _0x23f493[_0x482d('0xe9')](_0x58ea70);}})[_0x482d('0x23')](function(_0x8e03a7){if(_0x8e03a7){_0x2aced9=_0x8e03a7[_0x482d('0x6a')];if(!_0x308f81[_0x482d('0x49')][_0x482d('0x4c')](_0x482d('0x4d'))){_0x58ea70['limit']=qs[_0x482d('0x33')](_0x308f81[_0x482d('0x49')][_0x482d('0x33')]);_0x58ea70[_0x482d('0x32')]=qs[_0x482d('0x32')](_0x308f81[_0x482d('0x49')][_0x482d('0x32')]);}return _0x23f493['getAgents'](_0x58ea70);}})['then'](function(_0x3e318e){if(_0x3e318e){return _0x3e318e?{'count':_0x2aced9,'rows':_0x3e318e}:null;}})[_0x482d('0x23')](respondWithResult(_0x3fd198,null))[_0x482d('0x2c')](handleError(_0x3fd198,null));}; \ No newline at end of file +var _0xdf1d=['getDispositions','findOne','options','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','asc','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','twilio','from','From','Body','skebby','text','connectel','clicksend','messageId','plivo','Text','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','json','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','internal','Tag','Tags','color','tag','isNil','to\x20is\x20mandatory','List','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','SmsMessage','skebby_dispatch_id','requestid','statusInt','message_id','infobip','groupName','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','limit','undefined','count','Content-Range','update','destroy','get','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','show','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addDisposition','SmsAccountId','Disposition'];(function(_0x1b40c5,_0x5426e2){var _0x112fd8=function(_0x8e364){while(--_0x8e364){_0x1b40c5['push'](_0x1b40c5['shift']());}};_0x112fd8(++_0x5426e2);}(_0xdf1d,0x171));var _0xddf1=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xdf1d[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require(_0xddf1('0x0'));var rimraf=require(_0xddf1('0x1'));var zipdir=require(_0xddf1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddf1('0x3'));var moment=require(_0xddf1('0x4'));var BPromise=require(_0xddf1('0x5'));var Mustache=require(_0xddf1('0x6'));var util=require(_0xddf1('0x7'));var path=require(_0xddf1('0x8'));var sox=require('sox');var csv=require(_0xddf1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddf1('0xa'));var _=require(_0xddf1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xddf1('0xc'));var toCsv=require(_0xddf1('0x9'));var querystring=require('querystring');var Papa=require(_0xddf1('0xd'));var Redis=require(_0xddf1('0xe'));var authService=require(_0xddf1('0xf'));var qs=require(_0xddf1('0x10'));var as=require(_0xddf1('0x11'));var hardwareService=require(_0xddf1('0x12'));var logger=require(_0xddf1('0x13'))(_0xddf1('0x14'));var utils=require('../../config/utils');var config=require(_0xddf1('0x15'));var licenseUtil=require(_0xddf1('0x16'));var db=require(_0xddf1('0x17'))['db'];config[_0xddf1('0x18')]=_['defaults'](config[_0xddf1('0x18')],{'host':_0xddf1('0x19'),'port':0x18eb});var socket=require(_0xddf1('0x1a'))(new Redis(config[_0xddf1('0x18')]));require(_0xddf1('0x1b'))[_0xddf1('0x1c')](socket);var jayson=require(_0xddf1('0x1d'));var client=jayson[_0xddf1('0x1e')][_0xddf1('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x6d21ad,_0x31bae7,_0x529dc9,_0x20ec94){return new BPromise(function(_0x206818,_0x330b86){var _0x17e72e=_0x20ec94||client;return _0x17e72e['request'](_0x6d21ad,_0x529dc9)[_0xddf1('0x20')](function(_0x33b324){logger[_0xddf1('0x21')](_0xddf1('0x22'),_0x31bae7,_0xddf1('0x23'));logger[_0xddf1('0x24')](_0xddf1('0x25'),_0x31bae7,_0xddf1('0x23'),JSON[_0xddf1('0x26')](_0x33b324));if(_0x33b324[_0xddf1('0x27')]){if(_0x33b324[_0xddf1('0x27')][_0xddf1('0x28')]===0x1f4){logger[_0xddf1('0x27')]('SmsAccount,\x20%s,\x20%s',_0x31bae7,_0x33b324[_0xddf1('0x27')][_0xddf1('0x29')]);return _0x330b86(_0x33b324[_0xddf1('0x27')][_0xddf1('0x29')]);}logger[_0xddf1('0x27')](_0xddf1('0x22'),_0x31bae7,_0x33b324[_0xddf1('0x27')]['message']);return _0x206818(_0x33b324[_0xddf1('0x27')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x31bae7,_0xddf1('0x23'));_0x206818(_0x33b324['result'][_0xddf1('0x29')]);}})[_0xddf1('0x2a')](function(_0x451852){logger[_0xddf1('0x27')](_0xddf1('0x22'),_0x31bae7,_0x451852);_0x330b86(_0x451852);});});}function respondWithStatusCode(_0x462213,_0x1466cc){_0x1466cc=_0x1466cc||0xcc;return function(_0x149ad3){if(_0x149ad3){return _0x462213[_0xddf1('0x2b')](_0x1466cc);}return _0x462213[_0xddf1('0x2c')](_0x1466cc)[_0xddf1('0x2d')]();};}function respondWithResult(_0x291b26,_0x4b83b5){_0x4b83b5=_0x4b83b5||0xc8;return function(_0xe7ebe){if(_0xe7ebe){return _0x291b26[_0xddf1('0x2c')](_0x4b83b5)['json'](_0xe7ebe);}};}function respondWithFilteredResult(_0x498e36,_0x24a83f){return function(_0x45a74d){if(_0x45a74d){var _0x354335=typeof _0x24a83f[_0xddf1('0x2e')]==='undefined'&&typeof _0x24a83f[_0xddf1('0x2f')]===_0xddf1('0x30');var _0x2c05c4=_0x45a74d[_0xddf1('0x31')];var _0x44d70e=_0x354335?0x0:_0x24a83f[_0xddf1('0x2e')];var _0x21749b=_0x354335?_0x45a74d[_0xddf1('0x31')]:_0x24a83f[_0xddf1('0x2e')]+_0x24a83f['limit'];var _0x5ed2d4;if(_0x21749b>=_0x2c05c4){_0x21749b=_0x2c05c4;_0x5ed2d4=0xc8;}else{_0x5ed2d4=0xce;}_0x498e36[_0xddf1('0x2c')](_0x5ed2d4);return _0x498e36['set'](_0xddf1('0x32'),_0x44d70e+'-'+_0x21749b+'/'+_0x2c05c4)['json'](_0x45a74d);}return null;};}function patchUpdates(_0x1e6ef6){return function(_0x569cef){try{jsonpatch['apply'](_0x569cef,_0x1e6ef6,!![]);}catch(_0x2bbef1){return BPromise['reject'](_0x2bbef1);}return _0x569cef['save']();};}function saveUpdates(_0x4f0d07,_0x4b77e1){return function(_0x176be0){if(_0x176be0){return _0x176be0[_0xddf1('0x33')](_0x4f0d07)['then'](function(_0x36d548){return _0x36d548;});}return null;};}function removeEntity(_0x2ad1bb,_0xdde1ba){return function(_0x5b944c){if(_0x5b944c){return _0x5b944c[_0xddf1('0x34')]()['then'](function(){var _0x3dcc2d=_0x5b944c[_0xddf1('0x35')]({'plain':!![]});var _0x4d5973='SmsAccounts';return db[_0xddf1('0x36')][_0xddf1('0x34')]({'where':{'type':_0x4d5973,'resourceId':_0x3dcc2d['id']}})[_0xddf1('0x20')](function(){return _0x5b944c;});})[_0xddf1('0x20')](function(){_0x2ad1bb['status'](0xcc)[_0xddf1('0x2d')]();});}};}function handleEntityNotFound(_0x27a261,_0x5256c4){return function(_0x38d898){if(!_0x38d898){_0x27a261[_0xddf1('0x2b')](0x194);}return _0x38d898;};}function handleError(_0x2cde1e,_0x46bf49){_0x46bf49=_0x46bf49||0x1f4;return function(_0x144530){logger[_0xddf1('0x27')](_0x144530[_0xddf1('0x37')]);if(_0x144530[_0xddf1('0x38')]){delete _0x144530['name'];}_0x2cde1e[_0xddf1('0x2c')](_0x46bf49)[_0xddf1('0x39')](_0x144530);};}exports['index']=function(_0x6a6538,_0xdfbe87){var _0x913faf={'include':[{'model':db[_0xddf1('0x3a')],'as':_0xddf1('0x3b')}]},_0x5bee71={},_0x57582b={'count':0x0,'rows':[]};var _0x2a2632=_[_0xddf1('0x3c')](db[_0xddf1('0x3d')][_0xddf1('0x3e')],function(_0x13965d){return{'name':_0x13965d[_0xddf1('0x3f')],'type':_0x13965d[_0xddf1('0x40')]['key']};});_0x5bee71['model']=_[_0xddf1('0x3c')](_0x2a2632,'name');_0x5bee71[_0xddf1('0x41')]=_[_0xddf1('0x42')](_0x6a6538[_0xddf1('0x41')]);_0x5bee71['filters']=_[_0xddf1('0x43')](_0x5bee71[_0xddf1('0x44')],_0x5bee71[_0xddf1('0x41')]);_0x913faf[_0xddf1('0x45')]=_[_0xddf1('0x43')](_0x5bee71['model'],qs[_0xddf1('0x46')](_0x6a6538[_0xddf1('0x41')][_0xddf1('0x46')]));_0x913faf[_0xddf1('0x45')]=_0x913faf['attributes'][_0xddf1('0x47')]?_0x913faf['attributes']:_0x5bee71['model'];if(!_0x6a6538[_0xddf1('0x41')][_0xddf1('0x48')]('nolimit')){_0x913faf['limit']=qs['limit'](_0x6a6538[_0xddf1('0x41')][_0xddf1('0x2f')]);_0x913faf[_0xddf1('0x2e')]=qs[_0xddf1('0x2e')](_0x6a6538[_0xddf1('0x41')][_0xddf1('0x2e')]);}_0x913faf[_0xddf1('0x49')]=qs[_0xddf1('0x4a')](_0x6a6538['query'][_0xddf1('0x4a')]);_0x913faf['where']=qs[_0xddf1('0x4b')](_[_0xddf1('0x4c')](_0x6a6538['query'],_0x5bee71[_0xddf1('0x4b')]),_0x2a2632);if(_0x6a6538['query'][_0xddf1('0x4d')]){_0x913faf[_0xddf1('0x4e')]=_[_0xddf1('0x4f')](_0x913faf[_0xddf1('0x4e')],{'$or':_['map'](_0x2a2632,function(_0x3fc0bc){if(_0x3fc0bc[_0xddf1('0x40')]!==_0xddf1('0x50')){var _0x584f01={};_0x584f01[_0x3fc0bc[_0xddf1('0x38')]]={'$like':'%'+_0x6a6538[_0xddf1('0x41')][_0xddf1('0x4d')]+'%'};return _0x584f01;}})});}_0x913faf=_[_0xddf1('0x4f')]({},_0x913faf,_0x6a6538['options']);var _0x4924f7={'where':_0x913faf[_0xddf1('0x4e')]};return db[_0xddf1('0x3d')][_0xddf1('0x31')](_0x4924f7)['then'](function(_0x27c443){_0x57582b['count']=_0x27c443;if(_0x6a6538[_0xddf1('0x41')][_0xddf1('0x51')]){_0x913faf[_0xddf1('0x52')]=[{'all':!![]}];}return db[_0xddf1('0x3d')]['findAll'](_0x913faf);})['then'](function(_0x62d4b8){_0x57582b[_0xddf1('0x53')]=_0x62d4b8;return _0x57582b;})[_0xddf1('0x20')](respondWithFilteredResult(_0xdfbe87,_0x913faf))[_0xddf1('0x2a')](handleError(_0xdfbe87,null));};exports[_0xddf1('0x54')]=function(_0x1408a7,_0x5df3c4){var _0x19a0df={'raw':![],'where':{'id':_0x1408a7['params']['id']},'include':[{'model':db['Pause'],'as':_0xddf1('0x3b')}]},_0x578927={};_0x578927[_0xddf1('0x44')]=_['keys'](db[_0xddf1('0x3d')][_0xddf1('0x3e')]);_0x578927[_0xddf1('0x41')]=_[_0xddf1('0x42')](_0x1408a7[_0xddf1('0x41')]);_0x578927[_0xddf1('0x4b')]=_[_0xddf1('0x43')](_0x578927[_0xddf1('0x44')],_0x578927[_0xddf1('0x41')]);_0x19a0df['attributes']=_[_0xddf1('0x43')](_0x578927[_0xddf1('0x44')],qs[_0xddf1('0x46')](_0x1408a7['query'][_0xddf1('0x46')]));_0x19a0df[_0xddf1('0x45')]=_0x19a0df['attributes'][_0xddf1('0x47')]?_0x19a0df[_0xddf1('0x45')]:_0x578927[_0xddf1('0x44')];if(_0x1408a7['query'][_0xddf1('0x51')]){_0x19a0df['include']=[{'all':!![]}];}_0x19a0df=_[_0xddf1('0x4f')]({},_0x19a0df,_0x1408a7['options']);return db[_0xddf1('0x3d')][_0xddf1('0x55')](_0x19a0df)[_0xddf1('0x20')](handleEntityNotFound(_0x5df3c4,null))[_0xddf1('0x20')](respondWithResult(_0x5df3c4,null))[_0xddf1('0x2a')](handleError(_0x5df3c4,null));};exports[_0xddf1('0x56')]=function(_0x371d0a,_0x2ffff4){return db[_0xddf1('0x3d')][_0xddf1('0x56')](_0x371d0a['body'],{})[_0xddf1('0x20')](function(_0x363cff){var _0x96c095=_0x371d0a['user'][_0xddf1('0x35')]({'plain':!![]});if(!_0x96c095)throw new Error(_0xddf1('0x57'));if(_0x96c095[_0xddf1('0x58')]===_0xddf1('0x59')){var _0x5063f1=_0x363cff[_0xddf1('0x35')]({'plain':!![]});var _0x519e6e=_0xddf1('0x5a');return db['UserProfileSection']['find']({'where':{'name':_0x519e6e,'userProfileId':_0x96c095[_0xddf1('0x5b')]},'raw':!![]})[_0xddf1('0x20')](function(_0x2743e9){if(_0x2743e9&&_0x2743e9[_0xddf1('0x5c')]===0x0){return db[_0xddf1('0x36')][_0xddf1('0x56')]({'name':_0x5063f1[_0xddf1('0x38')],'resourceId':_0x5063f1['id'],'type':_0x2743e9[_0xddf1('0x38')],'sectionId':_0x2743e9['id']},{})[_0xddf1('0x20')](function(){return _0x363cff;});}else{return _0x363cff;}})[_0xddf1('0x2a')](function(_0x2a1ad6){logger[_0xddf1('0x27')](_0xddf1('0x5d'),_0x2a1ad6);throw _0x2a1ad6;});}return _0x363cff;})[_0xddf1('0x20')](respondWithResult(_0x2ffff4,0xc9))[_0xddf1('0x2a')](handleError(_0x2ffff4,null));};exports['update']=function(_0x455853,_0x161794){if(_0x455853[_0xddf1('0x5e')]['id']){delete _0x455853[_0xddf1('0x5e')]['id'];}return db[_0xddf1('0x3d')][_0xddf1('0x55')]({'where':{'id':_0x455853['params']['id']},'include':[{'model':db['Pause'],'as':_0xddf1('0x3b')}]})['then'](handleEntityNotFound(_0x161794,null))[_0xddf1('0x20')](saveUpdates(_0x455853[_0xddf1('0x5e')],null))['then'](respondWithResult(_0x161794,null))['catch'](handleError(_0x161794,null));};exports[_0xddf1('0x34')]=function(_0x17b382,_0x179727){return db[_0xddf1('0x3d')]['find']({'where':{'id':_0x17b382[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x179727,null))[_0xddf1('0x20')](removeEntity(_0x179727,null))['catch'](handleError(_0x179727,null));};exports['describe']=function(_0x3cf974,_0xe42ec3){return db[_0xddf1('0x3d')]['describe']()[_0xddf1('0x20')](respondWithResult(_0xe42ec3,null))[_0xddf1('0x2a')](handleError(_0xe42ec3,null));};exports[_0xddf1('0x60')]=function(_0x44879f,_0x41b561,_0x25c8de){if(_0x44879f[_0xddf1('0x5e')]['id']){delete _0x44879f[_0xddf1('0x5e')]['id'];}return db[_0xddf1('0x3d')][_0xddf1('0x55')]({'where':{'id':_0x44879f[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x41b561,null))[_0xddf1('0x20')](function(_0x2e22fa){if(_0x2e22fa){_0x44879f[_0xddf1('0x5e')][_0xddf1('0x61')]=_0x2e22fa['id'];return db[_0xddf1('0x62')]['create'](_0x44879f[_0xddf1('0x5e')]);}})['then'](respondWithResult(_0x41b561,null))['catch'](handleError(_0x41b561,null));};exports[_0xddf1('0x63')]=function(_0x301243,_0x1b3fe3,_0x856c85){var _0x5593fa={'raw':![],'where':{}};var _0x533a8b={};var _0x570ad6={'count':0x0,'rows':[]};return db[_0xddf1('0x3d')][_0xddf1('0x64')]({'where':{'id':_0x301243[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x1b3fe3,null))['then'](function(_0x1cea70){if(_0x1cea70){_0x533a8b['model']=_[_0xddf1('0x42')](db[_0xddf1('0x62')]['rawAttributes']);_0x533a8b['query']=_[_0xddf1('0x42')](_0x301243['query']);_0x533a8b['filters']=_[_0xddf1('0x43')](_0x533a8b[_0xddf1('0x44')],_0x533a8b[_0xddf1('0x41')]);_0x5593fa['attributes']=_['intersection'](_0x533a8b[_0xddf1('0x44')],qs[_0xddf1('0x46')](_0x301243[_0xddf1('0x41')][_0xddf1('0x46')]));_0x5593fa[_0xddf1('0x45')]=_0x5593fa[_0xddf1('0x45')][_0xddf1('0x47')]?_0x5593fa[_0xddf1('0x45')]:_0x533a8b[_0xddf1('0x44')];if(!_0x301243[_0xddf1('0x41')][_0xddf1('0x48')]('nolimit')){_0x5593fa[_0xddf1('0x2f')]=qs['limit'](_0x301243[_0xddf1('0x41')][_0xddf1('0x2f')]);_0x5593fa[_0xddf1('0x2e')]=qs[_0xddf1('0x2e')](_0x301243['query'][_0xddf1('0x2e')]);}_0x5593fa[_0xddf1('0x49')]=qs[_0xddf1('0x4a')](_0x301243[_0xddf1('0x41')][_0xddf1('0x4a')]);_0x5593fa[_0xddf1('0x4e')]=qs[_0xddf1('0x4b')](_[_0xddf1('0x4c')](_0x301243[_0xddf1('0x41')],_0x533a8b[_0xddf1('0x4b')]));_0x5593fa[_0xddf1('0x4e')][_0xddf1('0x61')]=_0x1cea70['id'];if(_0x301243['query'][_0xddf1('0x4d')]){_0x5593fa[_0xddf1('0x4e')]=_[_0xddf1('0x4f')](_0x5593fa[_0xddf1('0x4e')],{'$or':_[_0xddf1('0x3c')](_0x5593fa[_0xddf1('0x45')],function(_0x381811){var _0x2484bb={};_0x2484bb[_0x381811]={'$like':'%'+_0x301243[_0xddf1('0x41')][_0xddf1('0x4d')]+'%'};return _0x2484bb;})});}_0x5593fa=_[_0xddf1('0x4f')]({},_0x5593fa,_0x301243[_0xddf1('0x65')]);return db[_0xddf1('0x62')][_0xddf1('0x31')]({'where':_0x5593fa[_0xddf1('0x4e')]})[_0xddf1('0x20')](function(_0x1d4606){_0x570ad6[_0xddf1('0x31')]=_0x1d4606;if(_0x301243[_0xddf1('0x41')][_0xddf1('0x51')]){_0x5593fa[_0xddf1('0x52')]=[{'all':!![]}];}return db[_0xddf1('0x62')][_0xddf1('0x66')](_0x5593fa);})[_0xddf1('0x20')](function(_0x42a0c9){_0x570ad6['rows']=_0x42a0c9;return _0x570ad6;});}})[_0xddf1('0x20')](respondWithFilteredResult(_0x1b3fe3,_0x5593fa))['catch'](handleError(_0x1b3fe3,null));};exports[_0xddf1('0x67')]=function(_0x26a90e,_0x5c5219,_0x19ec6b){return db['SmsAccount'][_0xddf1('0x55')]({'where':{'id':_0x26a90e['params']['id']}})['then'](handleEntityNotFound(_0x5c5219,null))[_0xddf1('0x20')](function(_0x51a103){if(_0x51a103){return _0x51a103['removeDispositions'](_0x26a90e[_0xddf1('0x41')][_0xddf1('0x68')]);}})[_0xddf1('0x20')](respondWithStatusCode(_0x5c5219,null))['catch'](handleError(_0x5c5219,null));};exports[_0xddf1('0x69')]=function(_0x5da7ca,_0x567213,_0x13cb29){if(_0x5da7ca[_0xddf1('0x5e')]['id']){delete _0x5da7ca[_0xddf1('0x5e')]['id'];}return db[_0xddf1('0x3d')][_0xddf1('0x55')]({'where':{'id':_0x5da7ca[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x567213,null))[_0xddf1('0x20')](function(_0x13b4e4){if(_0x13b4e4){_0x5da7ca['body']['SmsAccountId']=_0x13b4e4['id'];return db[_0xddf1('0x6a')][_0xddf1('0x56')](_0x5da7ca['body']);}})[_0xddf1('0x20')](respondWithResult(_0x567213,null))[_0xddf1('0x2a')](handleError(_0x567213,null));};exports[_0xddf1('0x6b')]=function(_0x1b7833,_0x3df146,_0x1f827a){var _0x57cce6={'raw':![],'where':{}};var _0x3b2159={};var _0x33df40={'count':0x0,'rows':[]};return db[_0xddf1('0x3d')][_0xddf1('0x64')]({'where':{'id':_0x1b7833['params']['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x3df146,null))[_0xddf1('0x20')](function(_0x478b9d){if(_0x478b9d){_0x3b2159[_0xddf1('0x44')]=_['keys'](db[_0xddf1('0x6a')][_0xddf1('0x3e')]);_0x3b2159[_0xddf1('0x41')]=_[_0xddf1('0x42')](_0x1b7833['query']);_0x3b2159['filters']=_[_0xddf1('0x43')](_0x3b2159['model'],_0x3b2159[_0xddf1('0x41')]);_0x57cce6[_0xddf1('0x45')]=_[_0xddf1('0x43')](_0x3b2159['model'],qs[_0xddf1('0x46')](_0x1b7833[_0xddf1('0x41')][_0xddf1('0x46')]));_0x57cce6[_0xddf1('0x45')]=_0x57cce6[_0xddf1('0x45')][_0xddf1('0x47')]?_0x57cce6['attributes']:_0x3b2159['model'];if(!_0x1b7833[_0xddf1('0x41')][_0xddf1('0x48')](_0xddf1('0x6c'))){_0x57cce6['limit']=qs[_0xddf1('0x2f')](_0x1b7833[_0xddf1('0x41')][_0xddf1('0x2f')]);_0x57cce6[_0xddf1('0x2e')]=qs[_0xddf1('0x2e')](_0x1b7833[_0xddf1('0x41')][_0xddf1('0x2e')]);}_0x57cce6['order']=qs[_0xddf1('0x4a')](_0x1b7833[_0xddf1('0x41')][_0xddf1('0x4a')]);_0x57cce6[_0xddf1('0x4e')]=qs[_0xddf1('0x4b')](_[_0xddf1('0x4c')](_0x1b7833[_0xddf1('0x41')],_0x3b2159[_0xddf1('0x4b')]));_0x57cce6['where'][_0xddf1('0x61')]=_0x478b9d['id'];if(_0x1b7833[_0xddf1('0x41')]['filter']){_0x57cce6[_0xddf1('0x4e')]=_[_0xddf1('0x4f')](_0x57cce6[_0xddf1('0x4e')],{'$or':_['map'](_0x57cce6['attributes'],function(_0x32e486){var _0x1582ea={};_0x1582ea[_0x32e486]={'$like':'%'+_0x1b7833[_0xddf1('0x41')]['filter']+'%'};return _0x1582ea;})});}_0x57cce6=_[_0xddf1('0x4f')]({},_0x57cce6,_0x1b7833[_0xddf1('0x65')]);return db[_0xddf1('0x6a')][_0xddf1('0x31')]({'where':_0x57cce6[_0xddf1('0x4e')]})[_0xddf1('0x20')](function(_0x58bf6e){_0x33df40[_0xddf1('0x31')]=_0x58bf6e;if(_0x1b7833['query'][_0xddf1('0x51')]){_0x57cce6['include']=[{'all':!![]}];}return db[_0xddf1('0x6a')][_0xddf1('0x66')](_0x57cce6);})[_0xddf1('0x20')](function(_0x72dedb){_0x33df40[_0xddf1('0x53')]=_0x72dedb;return _0x33df40;});}})[_0xddf1('0x20')](respondWithFilteredResult(_0x3df146,_0x57cce6))[_0xddf1('0x2a')](handleError(_0x3df146,null));};exports[_0xddf1('0x6d')]=function(_0x3569f7,_0x563ec1,_0x4afaa7){return db[_0xddf1('0x3d')]['find']({'where':{'id':_0x3569f7[_0xddf1('0x5f')]['id']}})['then'](handleEntityNotFound(_0x563ec1,null))[_0xddf1('0x20')](function(_0x5a4e0c){if(_0x5a4e0c){return _0x5a4e0c[_0xddf1('0x6d')](_0x3569f7[_0xddf1('0x41')][_0xddf1('0x68')]);}})['then'](respondWithStatusCode(_0x563ec1,null))[_0xddf1('0x2a')](handleError(_0x563ec1,null));};exports[_0xddf1('0x6e')]=function(_0x174659,_0xb3918c,_0x111193){var _0x470d6e={'channel':_0xddf1('0x6f')};var _0x2f5a34=[];var _0x12844f=[];var _0x166f3f={};return db['SmsAccount'][_0xddf1('0x55')]({'where':{'id':_0x174659[_0xddf1('0x5f')]['id']},'include':[{'model':db[_0xddf1('0x70')],'as':_0xddf1('0x71')}]})[_0xddf1('0x20')](handleEntityNotFound(_0xb3918c,null))[_0xddf1('0x20')](function(_0x25f0d1){_0x470d6e[_0xddf1('0x72')]=_0x25f0d1;_0x470d6e[_0xddf1('0x73')]=_['orderBy'](_0x25f0d1[_0xddf1('0x71')],[_0xddf1('0x74')],[_0xddf1('0x75')]);if(_0x470d6e[_0xddf1('0x72')]['Applications']){delete _0x470d6e['account'][_0xddf1('0x71')];}return db[_0xddf1('0x76')][_0xddf1('0x77')]();})['then'](function(_0x3f8fb8){if(!_0x3f8fb8){throw new db[(_0xddf1('0x78'))][(_0xddf1('0x79'))](_0xddf1('0x7a'));}_0x2f5a34=_['difference'](_[_0xddf1('0x42')](_0x3f8fb8),[_0xddf1('0x7b'),'updatedAt']);_0x12844f=_[_0xddf1('0x7c')](_['keys'](_0x3f8fb8),[_0xddf1('0x7b'),_0xddf1('0x7d'),_0xddf1('0x7e'),_0xddf1('0x7f')]);_0x470d6e['body']={'mapKey':'mobile'};if(_0x470d6e[_0xddf1('0x72')]['type']){switch(_0x470d6e['account']['type']){case _0xddf1('0x80'):_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x81')]=_0x174659['body'][_0xddf1('0x82')];_0x470d6e['body'][_0xddf1('0x5e')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x83')];_0x470d6e['body']['messageId']=_0x174659[_0xddf1('0x5e')]['MessageSid'];break;case _0xddf1('0x84'):_0x470d6e[_0xddf1('0x5e')]['from']='+'+_0x174659[_0xddf1('0x5e')]['sender'];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x85')];break;case _0xddf1('0x86'):_0x470d6e[_0xddf1('0x5e')]['from']=_0x174659[_0xddf1('0x5e')][_0xddf1('0x81')];_0x470d6e['body'][_0xddf1('0x5e')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x29')];break;case _0xddf1('0x87'):_0x470d6e['body'][_0xddf1('0x81')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x81')];_0x470d6e['body'][_0xddf1('0x5e')]=_0x174659['body'][_0xddf1('0x5e')];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x88')]=_0x174659[_0xddf1('0x5e')]['message_id'];break;case _0xddf1('0x89'):_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x81')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x82')];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x8a')];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x88')]=_0x174659[_0xddf1('0x5e')]['MessageUUID'];break;case'infobip':_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x81')]='+'+_0x174659[_0xddf1('0x5e')][_0xddf1('0x8b')][0x0][_0xddf1('0x81')];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x8b')][0x0]['text'];_0x470d6e['body']['messageId']=_0x174659[_0xddf1('0x5e')][_0xddf1('0x8b')][0x0][_0xddf1('0x88')];break;case _0xddf1('0x8c'):_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x81')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x8d')];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x8e')][_0xddf1('0x29')];break;case _0xddf1('0x8f'):_0x470d6e['body'][_0xddf1('0x81')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x90')];_0x470d6e['body'][_0xddf1('0x5e')]=_0x174659['body'][_0xddf1('0x85')];_0x470d6e['body'][_0xddf1('0x88')]=_0x174659['body'][_0xddf1('0x91')];break;case _0xddf1('0x92'):_0x470d6e['body'][_0xddf1('0x88')]=_0x174659[_0xddf1('0x5e')][0x0][_0xddf1('0x29')]['id'];_0x470d6e['body']['from']=_0x174659['body'][0x0]['message']['from'];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')]=_0x174659['body'][0x0][_0xddf1('0x29')][_0xddf1('0x85')];break;case _0xddf1('0x93'):_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x81')]=_0x174659[_0xddf1('0x5e')][_0xddf1('0x81')];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')]=_0x174659['body'][_0xddf1('0x29')];_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x88')]=_0x174659['body']['refid'];break;}}if(_0x470d6e[_0xddf1('0x5e')]['id']){delete _0x470d6e[_0xddf1('0x5e')]['id'];}if(_['isNil'](_0x470d6e[_0xddf1('0x5e')]['from'])){throw new db['Sequelize']['ValidationError'](_0xddf1('0x94'));}if(_['isNil'](_0x470d6e['body'][_0xddf1('0x5e')])||_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')]===''){throw new db[(_0xddf1('0x78'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x95')])){throw new db[(_0xddf1('0x78'))][(_0xddf1('0x79'))](_0xddf1('0x96')+_0x12844f);}if(!_[_0xddf1('0x97')](_0x12844f,_0x470d6e['body']['mapKey'])){throw new db[(_0xddf1('0x78'))][(_0xddf1('0x79'))](_0xddf1('0x98')+_0x12844f);}_0x166f3f[_0x470d6e['body']['mapKey']]=_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x81')];return db[_0xddf1('0x99')]['find']({'where':{'id':_0x470d6e[_0xddf1('0x72')][_0xddf1('0x7f')]},'include':[{'model':db[_0xddf1('0x76')],'as':_0xddf1('0x9a'),'where':_0x166f3f,'limit':0x1,'order':[[_0xddf1('0x7d'),_0xddf1('0x9b')]]}]});})['then'](handleEntityNotFound(_0xb3918c,null))[_0xddf1('0x20')](function(_0x210412){if(_0x210412){_0x470d6e[_0xddf1('0x9c')]=_[_0xddf1('0x9d')](_0x210412,['Contacts']);if(_0x210412[_0xddf1('0x9a')]['length']){return _0x210412[_0xddf1('0x9a')][0x0];}var _0x3cf84e=_[_0xddf1('0x9e')](_0x470d6e[_0xddf1('0x5e')],{'firstName':_0x470d6e[_0xddf1('0x5e')]['from'],'ListId':_0x210412['id']});_0x3cf84e[_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x95')]]=_0x470d6e[_0xddf1('0x5e')]['from'];return db[_0xddf1('0x76')][_0xddf1('0x56')](_0x3cf84e,{'fields':_0x2f5a34,'raw':!![]});}})['then'](handleEntityNotFound(_0xb3918c,null))[_0xddf1('0x20')](function(_0xfdbd15){if(_0xfdbd15){_0x470d6e[_0xddf1('0x9f')]=_0xfdbd15;var _0x8d38f8={'ContactId':_0xfdbd15['id'],'phone':_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x81')],'SmsAccountId':_0x174659[_0xddf1('0x5f')]['id']};var _0x5a6da0={'ContactId':_0xfdbd15['id'],'SmsAccountId':_0x174659[_0xddf1('0x5f')]['id'],'closed':![]};return db['SmsInteraction'][_0xddf1('0x55')]({'where':_0x5a6da0})['then'](function(_0x3de86b){if(_0x3de86b){return[_0x3de86b,![]];}return db[_0xddf1('0xa0')][_0xddf1('0x56')](_0x8d38f8)[_0xddf1('0x20')](function(_0x781b25){return[_0x781b25,!![]];});});}})[_0xddf1('0xa1')](function(_0x5e35dc,_0x4e061e){_0x470d6e[_0xddf1('0xa2')]=_0x5e35dc[_0xddf1('0x35')]({'plain':!![]});_0x470d6e[_0xddf1('0xa2')][_0xddf1('0xa3')]=![];if(_0x4e061e){if(_0x470d6e['account'][_0xddf1('0xa4')]){_0x470d6e['applications'][_0xddf1('0xa5')]({'id':0x0,'priority':_0x470d6e[_0xddf1('0x73')]['length']+0x1,'app':_0xddf1('0xa6'),'appdata':_0xddf1('0xa7'),'interval':_0xddf1('0xa8')});}_0x470d6e[_0xddf1('0xa2')][_0xddf1('0xa3')]=!![];}return db['SmsMessage'][_0xddf1('0x56')]({'phone':_0x470d6e['body'][_0xddf1('0x81')],'messageId':_0x470d6e['body']['messageId'],'body':_0x470d6e[_0xddf1('0x5e')][_0xddf1('0x5e')],'SmsAccountId':_0x174659[_0xddf1('0x5f')]['id'],'SmsInteractionId':_0x5e35dc['id'],'direction':'in','ContactId':_0x5e35dc[_0xddf1('0xa9')],'AttachmentId':_0x470d6e[_0xddf1('0x5e')][_0xddf1('0xaa')]});})['then'](function(_0x1cae78){_0x470d6e['message']=_0x1cae78;if(!_0x470d6e[_0xddf1('0xa2')][_0xddf1('0xab')])return;return db[_0xddf1('0xac')]['find']({'attributes':['id',_0xddf1('0x38')],'where':{'id':_0x470d6e['interaction'][_0xddf1('0xab')]}});})[_0xddf1('0x20')](function(_0x198601){if(_0x198601){_0x470d6e[_0xddf1('0x73')][_0xddf1('0xad')]({'id':0x0,'priority':0x0,'app':_0xddf1('0xae'),'appdata':_0x198601[_0xddf1('0x38')]+','+(_0x470d6e['account'][_0xddf1('0xaf')]||0xa),'interval':_0xddf1('0xa8')});}if(!_0x470d6e[_0xddf1('0xa2')][_0xddf1('0xb0')])return;return db[_0xddf1('0xb1')][_0xddf1('0x55')]({'attributes':['id',_0xddf1('0x38')],'where':{'id':_0x470d6e[_0xddf1('0xa2')][_0xddf1('0xb0')]}});})[_0xddf1('0x20')](function(_0x5ea32e){if(_0x5ea32e){_0x470d6e['applications'][_0xddf1('0xad')]({'id':0x0,'priority':0x1,'app':_0xddf1('0xb2'),'appdata':_0x5ea32e[_0xddf1('0x38')]+','+(_0x470d6e[_0xddf1('0x72')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xddf1('0xb3'),_0xddf1('0xb4'),_0x470d6e);})[_0xddf1('0x20')](function(_0x3ccc48){if(_0x3ccc48){var _0x47f92c=0xc8;var _0x50aa46=_0xddf1('0xb5');logger[_0xddf1('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x50aa46,_0x47f92c,_0xddf1('0xb6'));logger['debug'](_0xddf1('0xb7'),_0x50aa46,_0x47f92c,_0xddf1('0xb6'),JSON[_0xddf1('0x26')](_0x3ccc48));if(_0x470d6e['account']['type']===_0xddf1('0x80')){return _0xb3918c[_0xddf1('0x2c')](_0x47f92c)['set']('Content-Type',_0xddf1('0xb8'))[_0xddf1('0x39')](_0xddf1('0xb9'));}else{return _0xb3918c[_0xddf1('0x2c')](_0x47f92c)[_0xddf1('0xba')](_0x3ccc48);}}})['catch'](handleError(_0xb3918c,null));};exports[_0xddf1('0xbb')]=function(_0x2c5cb4,_0x18a9ae){var _0x47413d=_0x2c5cb4[_0xddf1('0x5f')]['id'];var _0x56d4cc=_0x2c5cb4[_0xddf1('0x5e')];var _0x4be5be=0xc8;var _0xbb0e9d=null;return db[_0xddf1('0xbc')][_0xddf1('0xbd')]({'isolationLevel':db['sequelize'][_0xddf1('0xbe')][_0xddf1('0xbf')][_0xddf1('0xc0')]},function(_0x370107){return db[_0xddf1('0x3d')]['findOne']({'where':{'id':_0x47413d},'transaction':_0x370107})['then'](function(_0x25c5b0){if(_0x25c5b0){return db[_0xddf1('0x70')][_0xddf1('0x34')]({'where':{'SmsAccountId':_0x47413d},'transaction':_0x370107})[_0xddf1('0x20')](function(){var _0x1dc1cf=_[_0xddf1('0x3c')](_0x56d4cc,function(_0x39887a){_0x39887a[_0xddf1('0x61')]=_0x47413d;return _0x39887a;});return db[_0xddf1('0x70')][_0xddf1('0xc1')](_0x1dc1cf,{'transaction':_0x370107});});}else{_0x4be5be=0x194;_0xbb0e9d=[];}});})[_0xddf1('0x20')](function(){if(_0x4be5be!==0x194){return db[_0xddf1('0x70')][_0xddf1('0xc2')]({'where':{'SmsAccountId':_0x47413d},'order':_0xddf1('0x74')})[_0xddf1('0x20')](function(_0x3c59f6){_0xbb0e9d=_0x3c59f6;});}})[_0xddf1('0x2a')](function(_0x377953){_0x4be5be=0x1f4;logger[_0xddf1('0x27')](_0x377953[_0xddf1('0x37')]);if(_0x377953[_0xddf1('0x38')]){delete _0x377953[_0xddf1('0x38')];}_0xbb0e9d=_0x377953;})[_0xddf1('0xc3')](function(){if(_0xbb0e9d===null){_0x18a9ae[_0xddf1('0x2b')](_0x4be5be);}else{if(_0x4be5be===0x1f4){_0x18a9ae['status'](_0x4be5be)[_0xddf1('0x39')](_0xbb0e9d);}else{_0x18a9ae['status'](_0x4be5be)[_0xddf1('0xba')](_0xbb0e9d);}}});};exports['getApplications']=function(_0x5a7aca,_0x565463,_0x10c675){var _0xf10632={};var _0x3daf42={};var _0x4ce44b;var _0x554181;return db[_0xddf1('0x3d')][_0xddf1('0x64')]({'where':{'id':_0x5a7aca['params']['id']}})['then'](handleEntityNotFound(_0x565463,null))[_0xddf1('0x20')](function(_0x17ba32){if(_0x17ba32){_0x4ce44b=_0x17ba32;_0x3daf42[_0xddf1('0x44')]=_[_0xddf1('0x42')](db[_0xddf1('0x70')]['rawAttributes']);_0x3daf42['query']=_[_0xddf1('0x42')](_0x5a7aca[_0xddf1('0x41')]);_0x3daf42[_0xddf1('0x4b')]=_[_0xddf1('0x43')](_0x3daf42[_0xddf1('0x44')],_0x3daf42['query']);_0xf10632[_0xddf1('0x45')]=_[_0xddf1('0x43')](_0x3daf42[_0xddf1('0x44')],qs[_0xddf1('0x46')](_0x5a7aca['query'][_0xddf1('0x46')]));_0xf10632['attributes']=_0xf10632[_0xddf1('0x45')]['length']?_0xf10632[_0xddf1('0x45')]:_0x3daf42[_0xddf1('0x44')];_0xf10632['order']=qs[_0xddf1('0x4a')](_0x5a7aca['query'][_0xddf1('0x4a')]);_0xf10632['where']=qs['filters'](_[_0xddf1('0x4c')](_0x5a7aca['query'],_0x3daf42[_0xddf1('0x4b')]));if(_0x5a7aca[_0xddf1('0x41')][_0xddf1('0x4d')]){_0xf10632[_0xddf1('0x4e')]=_['merge'](_0xf10632['where'],{'$or':_[_0xddf1('0x3c')](_0xf10632[_0xddf1('0x45')],function(_0x3682ec){var _0x2c51f7={};_0x2c51f7[_0x3682ec]={'$like':'%'+_0x5a7aca['query'][_0xddf1('0x4d')]+'%'};return _0x2c51f7;})});}_0xf10632=_['merge']({},_0xf10632,_0x5a7aca['options']);return _0x4ce44b[_0xddf1('0xc4')](_0xf10632);}})['then'](function(_0x5bf808){if(_0x5bf808){_0x554181=_0x5bf808[_0xddf1('0x47')];if(!_0x5a7aca[_0xddf1('0x41')][_0xddf1('0x48')](_0xddf1('0x6c'))){_0xf10632['limit']=qs[_0xddf1('0x2f')](_0x5a7aca[_0xddf1('0x41')][_0xddf1('0x2f')]);_0xf10632[_0xddf1('0x2e')]=qs[_0xddf1('0x2e')](_0x5a7aca[_0xddf1('0x41')][_0xddf1('0x2e')]);}return _0x4ce44b[_0xddf1('0xc4')](_0xf10632);}})['then'](function(_0x3eb7b6){if(_0x3eb7b6){return _0x3eb7b6?{'count':_0x554181,'rows':_0x3eb7b6}:null;}})[_0xddf1('0x20')](respondWithResult(_0x565463,null))[_0xddf1('0x2a')](handleError(_0x565463,null));};exports[_0xddf1('0xc5')]=function(_0x213906,_0x571450,_0x4b99cf){var _0xb48f20={'raw':![],'where':{}};var _0x2c6b87={};var _0x250773={'count':0x0,'rows':[]};return db[_0xddf1('0x3d')][_0xddf1('0x64')]({'where':{'id':_0x213906[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x571450,null))[_0xddf1('0x20')](function(_0x335fe0){if(_0x335fe0){_0x2c6b87[_0xddf1('0x44')]=_['keys'](db[_0xddf1('0xa0')][_0xddf1('0x3e')]);_0x2c6b87[_0xddf1('0x41')]=_[_0xddf1('0x42')](_0x213906[_0xddf1('0x41')]);_0x2c6b87['filters']=_['intersection'](_0x2c6b87[_0xddf1('0x44')],_0x2c6b87[_0xddf1('0x41')]);_0xb48f20[_0xddf1('0x45')]=_['intersection'](_0x2c6b87[_0xddf1('0x44')],qs[_0xddf1('0x46')](_0x213906[_0xddf1('0x41')]['fields']));_0xb48f20[_0xddf1('0x45')]=_0xb48f20[_0xddf1('0x45')][_0xddf1('0x47')]?_0xb48f20[_0xddf1('0x45')]:_0x2c6b87[_0xddf1('0x44')];if(!_0x213906['query'][_0xddf1('0x48')](_0xddf1('0x6c'))){_0xb48f20['limit']=qs[_0xddf1('0x2f')](_0x213906[_0xddf1('0x41')][_0xddf1('0x2f')]);_0xb48f20['offset']=qs[_0xddf1('0x2e')](_0x213906['query'][_0xddf1('0x2e')]);}_0xb48f20[_0xddf1('0x49')]=qs[_0xddf1('0x4a')](_0x213906[_0xddf1('0x41')][_0xddf1('0x4a')]);_0xb48f20[_0xddf1('0x4e')]=qs[_0xddf1('0x4b')](_[_0xddf1('0x4c')](_0x213906[_0xddf1('0x41')],_0x2c6b87[_0xddf1('0x4b')]));_0xb48f20['where'][_0xddf1('0x61')]=_0x335fe0['id'];if(_0x213906[_0xddf1('0x41')][_0xddf1('0x4d')]){_0xb48f20[_0xddf1('0x4e')]=_[_0xddf1('0x4f')](_0xb48f20['where'],{'$or':_[_0xddf1('0x3c')](_0xb48f20[_0xddf1('0x45')],function(_0x1c7840){var _0x31a618={};_0x31a618[_0x1c7840]={'$like':'%'+_0x213906[_0xddf1('0x41')]['filter']+'%'};return _0x31a618;})});}_0xb48f20=_[_0xddf1('0x4f')]({},_0xb48f20,_0x213906[_0xddf1('0x65')]);return db['SmsInteraction'][_0xddf1('0x31')]({'where':_0xb48f20[_0xddf1('0x4e')]})[_0xddf1('0x20')](function(_0x19b0fc){_0x250773[_0xddf1('0x31')]=_0x19b0fc;if(_0x213906['query'][_0xddf1('0x51')]){_0xb48f20[_0xddf1('0x52')]=[{'model':db[_0xddf1('0x76')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xddf1('0xc6'),'attributes':['name','fullname',_0xddf1('0xc7')],'required':![]},{'model':db[_0xddf1('0xc8')],'as':_0xddf1('0xc9'),'attributes':['id','name',_0xddf1('0xca')],'where':_0x213906[_0xddf1('0x41')]['tag']?{'id':_0x213906[_0xddf1('0x41')][_0xddf1('0xcb')]}:undefined,'required':_0x213906['query'][_0xddf1('0xcb')]?!![]:![]}];}return db[_0xddf1('0xa0')][_0xddf1('0x66')](_0xb48f20);})[_0xddf1('0x20')](function(_0x32e8ad){_0x250773[_0xddf1('0x53')]=_0x32e8ad;return _0x250773;});}})[_0xddf1('0x20')](respondWithFilteredResult(_0x571450,_0xb48f20))['catch'](handleError(_0x571450,null));};exports[_0xddf1('0x39')]=function(_0x3b2f7c,_0x21eeed,_0x536bd7){var _0x3652ba,_0x26362c,_0x30753a;if(_[_0xddf1('0xcc')](_0x3b2f7c[_0xddf1('0x5e')][_0xddf1('0x5e')])||_0x3b2f7c[_0xddf1('0x5e')][_0xddf1('0x5e')]===''){throw new db[(_0xddf1('0x78'))][(_0xddf1('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3b2f7c['body']['to'])){throw new db[(_0xddf1('0x78'))][(_0xddf1('0x79'))](_0xddf1('0xcd'));}_0x3652ba=_0x3b2f7c[_0xddf1('0x5e')]['to'];return db[_0xddf1('0x3d')][_0xddf1('0x55')]({'where':{'id':_0x3b2f7c[_0xddf1('0x5f')]['id']},'include':[{'model':db[_0xddf1('0x99')],'as':_0xddf1('0xce'),'include':[{'model':db[_0xddf1('0x76')],'as':_0xddf1('0x9a'),'where':{'mobile':_0x3652ba},'limit':0x1,'order':[['updatedAt',_0xddf1('0x9b')]]}]}]})[_0xddf1('0x20')](handleEntityNotFound(_0x21eeed,null))['then'](function(_0x423ded){if(_0x423ded&&_0x423ded[_0xddf1('0xce')]){_0x26362c=_0x423ded[_0xddf1('0x35')]({'plain':!![]});if(_0x26362c[_0xddf1('0xce')]&&_0x26362c[_0xddf1('0xce')][_0xddf1('0x9a')][_0xddf1('0x47')]){return _0x26362c[_0xddf1('0xce')][_0xddf1('0x9a')][0x0];}return db[_0xddf1('0x76')]['create'](_[_0xddf1('0x9e')](_0x3b2f7c['body'],{'firstName':_0x3652ba,'mobile':_0x3652ba,'phone':_0x3652ba,'ListId':_0x26362c[_0xddf1('0x7f')]}));}})[_0xddf1('0x20')](handleEntityNotFound(_0x21eeed,null))[_0xddf1('0x20')](function(_0x2fad2b){if(_0x2fad2b){_0x30753a=_0x2fad2b;return db[_0xddf1('0xa0')]['find']({'where':{'ContactId':_0x30753a['id'],'closed':![],'SmsAccountId':_0x26362c['id']}})[_0xddf1('0x20')](function(_0x3da391){if(_0x3da391){return[_0x3da391,![]];}return db[_0xddf1('0xa0')][_0xddf1('0x56')]({'UserId':_0x3b2f7c[_0xddf1('0x59')]['id'],'ContactId':_0x30753a['id'],'SmsAccountId':_0x26362c['id'],'phone':_0x3652ba,'firstMsgDirection':'out','Messages':[_[_0xddf1('0x4f')](_0x3b2f7c[_0xddf1('0x5e')],{'read':![],'body':_0x3b2f7c[_0xddf1('0x5e')]['body'],'phone':_0x3652ba,'SmsAccountId':_0x26362c['id'],'UserId':_0x3b2f7c[_0xddf1('0x59')]['id'],'ContactId':_0x30753a['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0xddf1('0x20')](function(_0x48d338){return[_0x48d338,!![]];});});}})[_0xddf1('0xa1')](function(_0x13b132,_0xfec982){if(_0xfec982){return _0x13b132;}return db['SmsMessage']['create'](_[_0xddf1('0x4f')](_0x3b2f7c[_0xddf1('0x5e')],{'read':![],'body':_0x3b2f7c[_0xddf1('0x5e')][_0xddf1('0x5e')],'phone':_0x3652ba,'SmsAccountId':_0x26362c['id'],'SmsInteractionId':_0x13b132['id'],'UserId':_0x3b2f7c[_0xddf1('0x59')]['id'],'ContactId':_0x30753a['id']}))[_0xddf1('0x20')](function(_0x3c731b){_0x13b132[_0xddf1('0xcf')][_0xddf1('0xd0')]=[];_0x13b132[_0xddf1('0xcf')][_0xddf1('0xd0')][_0xddf1('0xa5')](_0x3c731b[_0xddf1('0xcf')]);return _0x13b132;});})[_0xddf1('0x20')](respondWithResult(_0x21eeed,null))[_0xddf1('0x2a')](handleError(_0x21eeed,null));};exports[_0xddf1('0x2c')]=function(_0x10e3c5,_0x34ba23,_0x150345){if(_0x10e3c5[_0xddf1('0x5e')]['id']){delete _0x10e3c5[_0xddf1('0x5e')]['id'];}var _0x90510c,_0x2e50c2,_0x1b3a1f;return db[_0xddf1('0x3d')][_0xddf1('0x55')]({'where':{'id':_0x10e3c5['params']['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x34ba23,null))['then'](function(_0x33296c){if(_0x33296c){_0x1b3a1f=_0x33296c;logger[_0xddf1('0x24')](_0xddf1('0x25'),_0xddf1('0x2c'),_0xddf1('0xd1'),_0x33296c['type'],util[_0xddf1('0xd2')](_0x10e3c5[_0xddf1('0x5e')],{'showHidden':![],'depth':null}));switch(_0x33296c[_0xddf1('0x40')]){case'skebby':if(_0x10e3c5[_0xddf1('0x5e')]['skebby_dispatch_id']&&_0x10e3c5['body']['status']){_0x2e50c2=_0x10e3c5[_0xddf1('0x5e')]['status'];return db[_0xddf1('0xd3')]['find']({'where':{'messageId':_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0xd4')]}});}break;case _0xddf1('0x86'):if(_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0xd5')]&&_0x10e3c5['body'][_0xddf1('0xd6')]){_0x2e50c2=_0x10e3c5['body']['statusInt'];return db[_0xddf1('0xd3')][_0xddf1('0x55')]({'where':{'messageId':_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0xd5')]}});}break;case _0xddf1('0x87'):if(_0x10e3c5[_0xddf1('0x5e')]['message_id']&&_0x10e3c5[_0xddf1('0x5e')]['status_code']){_0x2e50c2=_0x10e3c5['body']['status_code'];return db['SmsMessage'][_0xddf1('0x55')]({'where':{'messageId':_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0xd7')]}});}break;case _0xddf1('0xd8'):var _0x485023=_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0x8b')][0x0];if(_0x485023[_0xddf1('0x88')]&&_0x485023[_0xddf1('0x2c')][_0xddf1('0xd9')]==='DELIVERED'){_0x2e50c2=_0x485023[_0xddf1('0x2c')]['groupName'];return db[_0xddf1('0xd3')][_0xddf1('0x55')]({'where':{'messageId':_0x485023[_0xddf1('0x88')]}});}break;case _0xddf1('0x8f'):if(_0x10e3c5['body']['messageId']&&_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0x2c')]){_0x2e50c2=_0x10e3c5['body'][_0xddf1('0x2c')];return db['SmsMessage']['find']({'where':{'messageId':_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0x88')]}});}break;case _0xddf1('0x92'):if(_0x10e3c5['body'][0x0]['message']['id']){_0x2e50c2=_0x10e3c5[_0xddf1('0x5e')][0x0][_0xddf1('0x40')];return db[_0xddf1('0xd3')][_0xddf1('0x55')]({'where':{'messageId':_0x10e3c5[_0xddf1('0x5e')][0x0][_0xddf1('0x29')]['id']}});}break;case'intelepeer':if(_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0xda')]&&_0x10e3c5['body']['status']){_0x2e50c2=_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0x2c')];return db[_0xddf1('0xd3')][_0xddf1('0x55')]({'where':{'messageId':_0x10e3c5['body'][_0xddf1('0xda')]}});}break;}}})[_0xddf1('0x20')](handleEntityNotFound(_0x34ba23,null))[_0xddf1('0x20')](function(_0x232334){if(_0x232334){_0x90510c=_0x232334;switch(_0x1b3a1f[_0xddf1('0x40')]){case _0xddf1('0x84'):if(_0x2e50c2===_0xddf1('0xdb')){return _0x90510c[_0xddf1('0x33')]({'read':!![]});}else{logger[_0xddf1('0x27')](_0xddf1('0x25'),'status','skebby',util[_0xddf1('0xd2')](_0x10e3c5['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x2e50c2==='1'){return _0x90510c[_0xddf1('0x33')]({'read':!![]});}else{logger[_0xddf1('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0xddf1('0xd2')](_0x10e3c5[_0xddf1('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xddf1('0x87'):if(!_0x10e3c5[_0xddf1('0x5e')][_0xddf1('0xdc')]&&_0x2e50c2>=0xc8&&_0x2e50c2<=0xce){return _0x90510c[_0xddf1('0x33')]({'read':!![]});}else{logger[_0xddf1('0x27')](_0xddf1('0x25'),_0xddf1('0x2c'),'clicksend',util[_0xddf1('0xd2')](_0x10e3c5[_0xddf1('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xddf1('0xd8'):var _0x61db3e=_0x10e3c5['body'][_0xddf1('0x8b')][0x0];if(_0x61db3e['status'][_0xddf1('0xd9')]==='DELIVERED'){return _0x90510c[_0xddf1('0x33')]({'read':!![]});}else{logger[_0xddf1('0x27')](_0xddf1('0x25'),_0xddf1('0x2c'),'infobip',util[_0xddf1('0xd2')](_0x10e3c5[_0xddf1('0x5e')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x2e50c2==_0xddf1('0xdd')||_0x2e50c2=='RECEIVED_BY_RECIPIENT'){return _0x90510c[_0xddf1('0x33')]({'read':!![]});}else{logger['error'](_0xddf1('0x25'),_0xddf1('0x2c'),_0xddf1('0x8f'),util[_0xddf1('0xd2')](_0x10e3c5[_0xddf1('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xddf1('0x92'):if(_0x2e50c2=='message-delivered'){return _0x90510c['update']({'read':!![]});}else{logger[_0xddf1('0x27')](_0xddf1('0x25'),'status','bandwidth',util[_0xddf1('0xd2')](_0x10e3c5[_0xddf1('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xddf1('0x93'):if(_0x2e50c2===_0xddf1('0xde')||_0x2e50c2===_0xddf1('0xdf')){return _0x90510c[_0xddf1('0x33')]({'read':!![]});}else{logger[_0xddf1('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xddf1('0x2c'),_0xddf1('0x93'),util['inspect'](_0x10e3c5[_0xddf1('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x90510c;}})[_0xddf1('0x20')](respondWithResult(_0x34ba23,null))[_0xddf1('0x2a')](handleError(_0x34ba23,null));};exports[_0xddf1('0xe0')]=function(_0x533247,_0x41d322,_0x5b70c5){var _0x33e0bb,_0x3b28e0,_0x2efb6a;return db[_0xddf1('0x3d')]['find']({'where':{'id':_0x533247[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x41d322,null))[_0xddf1('0x20')](function(_0x45af80){if(_0x45af80){_0x2efb6a=_0x45af80;logger[_0xddf1('0x24')](_0xddf1('0x25'),_0xddf1('0x2c'),'received\x20delivery\x20report\x20from',_0x45af80[_0xddf1('0x40')],util[_0xddf1('0xd2')](_0x533247[_0xddf1('0x41')],{'showHidden':![],'depth':null}));switch(_0x45af80[_0xddf1('0x40')]){case'csc':if(_0x533247[_0xddf1('0x41')][_0xddf1('0xe1')]&&_0x533247[_0xddf1('0x41')][_0xddf1('0xe2')]){_0x3b28e0=_0x533247[_0xddf1('0x41')]['state'];return db[_0xddf1('0xd3')]['find']({'where':{'messageId':_0x533247[_0xddf1('0x41')][_0xddf1('0xe1')]}});}break;}}})[_0xddf1('0x20')](handleEntityNotFound(_0x41d322,null))[_0xddf1('0x20')](function(_0x535f31){if(_0x535f31){_0x33e0bb=_0x535f31;switch(_0x2efb6a[_0xddf1('0x40')]){case _0xddf1('0x8c'):if(_0x3b28e0==='2'||_0x3b28e0==='6'){return _0x33e0bb[_0xddf1('0x33')]({'read':!![]});}else{logger[_0xddf1('0x27')](_0xddf1('0x25'),_0xddf1('0x2c'),_0xddf1('0x8c'),util[_0xddf1('0xd2')](_0x533247[_0xddf1('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x33e0bb;}})[_0xddf1('0x20')](respondWithResult(_0x41d322,null))[_0xddf1('0x2a')](handleError(_0x41d322,null));};exports[_0xddf1('0xe3')]=function(_0x4946f4,_0xb9b2d5,_0x5951e9){return db[_0xddf1('0x3d')]['find']({'where':{'id':_0x4946f4[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0xb9b2d5,null))[_0xddf1('0x20')](function(_0x320758){if(_0x320758){return _0x320758[_0xddf1('0xe3')](_0x4946f4['body'][_0xddf1('0x68')],_[_0xddf1('0x9d')](_0x4946f4[_0xddf1('0x5e')],[_0xddf1('0x68'),'id'])||{})['spread'](function(_0x5db259){for(var _0xde5c3=0x0;_0xde5c3<_0x4946f4[_0xddf1('0x5e')][_0xddf1('0x68')]['length'];_0xde5c3+=0x1){socket[_0xddf1('0xe4')](_0xddf1('0xe5'),{'UserId':Number(_0x4946f4[_0xddf1('0x5e')]['ids'][_0xde5c3]),'SmsAccountId':Number(_0x4946f4[_0xddf1('0x5f')]['id'])});}return _0x5db259;});}})[_0xddf1('0x20')](respondWithResult(_0xb9b2d5,null))[_0xddf1('0x2a')](handleError(_0xb9b2d5,null));};exports[_0xddf1('0xe6')]=function(_0x5538f8,_0x42ada9,_0x181a9f){return db[_0xddf1('0x3d')][_0xddf1('0x55')]({'where':{'id':_0x5538f8[_0xddf1('0x5f')]['id']}})[_0xddf1('0x20')](handleEntityNotFound(_0x42ada9,null))[_0xddf1('0x20')](function(_0x23545b){if(_0x23545b){return _0x23545b[_0xddf1('0xe6')](_0x5538f8[_0xddf1('0x41')][_0xddf1('0x68')])[_0xddf1('0x20')](function(){if(_[_0xddf1('0xe7')](_0x5538f8[_0xddf1('0x41')][_0xddf1('0x68')])){for(var _0x434dcc=0x0;_0x434dcc<_0x5538f8[_0xddf1('0x41')][_0xddf1('0x68')]['length'];_0x434dcc+=0x1){socket[_0xddf1('0xe4')]('userSmsAccount:remove',{'UserId':Number(_0x5538f8['query'][_0xddf1('0x68')][_0x434dcc]),'SmsAccountId':Number(_0x5538f8['params']['id'])});}}else{socket[_0xddf1('0xe4')](_0xddf1('0xe8'),{'UserId':Number(_0x5538f8[_0xddf1('0x41')][_0xddf1('0x68')]),'SmsAccountId':Number(_0x5538f8[_0xddf1('0x5f')]['id'])});}});}})[_0xddf1('0x20')](respondWithStatusCode(_0x42ada9,null))[_0xddf1('0x2a')](handleError(_0x42ada9,null));};exports[_0xddf1('0xe9')]=function(_0x32ce43,_0x151140,_0x13f34c){var _0x582ee9={};var _0x6c5752={};var _0x2f6d9e;var _0x1b8224;return db[_0xddf1('0x3d')][_0xddf1('0x64')]({'where':{'id':_0x32ce43[_0xddf1('0x5f')]['id']}})['then'](handleEntityNotFound(_0x151140,null))[_0xddf1('0x20')](function(_0x36379b){if(_0x36379b){_0x2f6d9e=_0x36379b;_0x6c5752['model']=_[_0xddf1('0x42')](db[_0xddf1('0xac')]['rawAttributes']);_0x6c5752['query']=_[_0xddf1('0x42')](_0x32ce43[_0xddf1('0x41')]);_0x6c5752[_0xddf1('0x4b')]=_['intersection'](_0x6c5752['model'],_0x6c5752[_0xddf1('0x41')]);_0x582ee9['attributes']=_['intersection'](_0x6c5752[_0xddf1('0x44')],qs[_0xddf1('0x46')](_0x32ce43[_0xddf1('0x41')]['fields']));_0x582ee9[_0xddf1('0x45')]=_0x582ee9[_0xddf1('0x45')]['length']?_0x582ee9[_0xddf1('0x45')]:_0x6c5752[_0xddf1('0x44')];_0x582ee9[_0xddf1('0x49')]=qs[_0xddf1('0x4a')](_0x32ce43['query']['sort']);_0x582ee9[_0xddf1('0x4e')]=qs[_0xddf1('0x4b')](_[_0xddf1('0x4c')](_0x32ce43[_0xddf1('0x41')],_0x6c5752[_0xddf1('0x4b')]));if(_0x32ce43[_0xddf1('0x41')]['filter']){_0x582ee9[_0xddf1('0x4e')]=_[_0xddf1('0x4f')](_0x582ee9[_0xddf1('0x4e')],{'$or':_['map'](_0x582ee9['attributes'],function(_0xfac752){var _0x440b3f={};_0x440b3f[_0xfac752]={'$like':'%'+_0x32ce43[_0xddf1('0x41')][_0xddf1('0x4d')]+'%'};return _0x440b3f;})});}_0x582ee9=_[_0xddf1('0x4f')]({},_0x582ee9,_0x32ce43[_0xddf1('0x65')]);return _0x2f6d9e[_0xddf1('0xe9')](_0x582ee9);}})[_0xddf1('0x20')](function(_0x264c5d){if(_0x264c5d){_0x1b8224=_0x264c5d[_0xddf1('0x47')];if(!_0x32ce43[_0xddf1('0x41')][_0xddf1('0x48')](_0xddf1('0x6c'))){_0x582ee9['limit']=qs['limit'](_0x32ce43[_0xddf1('0x41')][_0xddf1('0x2f')]);_0x582ee9[_0xddf1('0x2e')]=qs[_0xddf1('0x2e')](_0x32ce43[_0xddf1('0x41')][_0xddf1('0x2e')]);}return _0x2f6d9e['getAgents'](_0x582ee9);}})[_0xddf1('0x20')](function(_0x229203){if(_0x229203){return _0x229203?{'count':_0x1b8224,'rows':_0x229203}:null;}})[_0xddf1('0x20')](respondWithResult(_0x151140,null))[_0xddf1('0x2a')](handleError(_0x151140,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 071a244..44734e8 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 _0x7cb7=['../../mysqldb','SmsAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x7ca9e4,_0x5cb6d2){var _0x320760=function(_0x307593){while(--_0x307593){_0x7ca9e4['push'](_0x7ca9e4['shift']());}};_0x320760(++_0x5cb6d2);}(_0x7cb7,0x1a3));var _0x77cb=function(_0x299c19,_0x598dcb){_0x299c19=_0x299c19-0x0;var _0x291e0e=_0x7cb7[_0x299c19];return _0x291e0e;};'use strict';var EventEmitter=require(_0x77cb('0x0'));var SmsAccount=require(_0x77cb('0x1'))['db'][_0x77cb('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x77cb('0x3'),'afterUpdate':_0x77cb('0x4'),'afterDestroy':_0x77cb('0x5')};function emitEvent(_0x13a7c9){return function(_0x45413c,_0x1a0a9d,_0x2a36c5){SmsAccountEvents[_0x77cb('0x6')](_0x13a7c9+':'+_0x45413c['id'],_0x45413c);SmsAccountEvents[_0x77cb('0x6')](_0x13a7c9,_0x45413c);_0x2a36c5(null);};}for(var e in events){if(events[_0x77cb('0x7')](e)){var event=events[e];SmsAccount[_0x77cb('0x8')](e,emitEvent(event));}}module[_0x77cb('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x7c94=['hook','exports','events','SmsAccount','setMaxListeners','update','remove'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7c94,0x1de));var _0x47c9=function(_0x37a59a,_0x24f4fd){_0x37a59a=_0x37a59a-0x0;var _0x490f97=_0x7c94[_0x37a59a];return _0x490f97;};'use strict';var EventEmitter=require(_0x47c9('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x47c9('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x47c9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47c9('0x3'),'afterDestroy':_0x47c9('0x4')};function emitEvent(_0x45b10b){return function(_0x38c33e,_0x32c7b1,_0x1e8277){SmsAccountEvents['emit'](_0x45b10b+':'+_0x38c33e['id'],_0x38c33e);SmsAccountEvents['emit'](_0x45b10b,_0x38c33e);_0x1e8277(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x47c9('0x5')](e,emitEvent(event));}}module[_0x47c9('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 4c5bb17..c1a2132 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 _0x51f9=['rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','util','api','moment','bluebird','path'];(function(_0x3d30b2,_0x25ccfe){var _0x4f7cec=function(_0x4dfdf1){while(--_0x4dfdf1){_0x3d30b2['push'](_0x3d30b2['shift']());}};_0x4f7cec(++_0x25ccfe);}(_0x51f9,0x132));var _0x951f=function(_0x37a9d7,_0x2b6fde){_0x37a9d7=_0x37a9d7-0x0;var _0x1343d3=_0x51f9[_0x37a9d7];return _0x1343d3;};'use strict';var _=require(_0x951f('0x0'));var util=require(_0x951f('0x1'));var logger=require('../../config/logger')(_0x951f('0x2'));var moment=require(_0x951f('0x3'));var BPromise=require(_0x951f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x951f('0x5'));var rimraf=require(_0x951f('0x6'));var config=require(_0x951f('0x7'));var attributes=require(_0x951f('0x8'));module[_0x951f('0x9')]=function(_0xd80e8a,_0x2ca4e0){return _0xd80e8a['define'](_0x951f('0xa'),attributes,{'tableName':_0x951f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc0d=['util','bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash'];(function(_0xed0e27,_0x3fc087){var _0x12a386=function(_0x2edb3e){while(--_0x2edb3e){_0xed0e27['push'](_0xed0e27['shift']());}};_0x12a386(++_0x3fc087);}(_0xbc0d,0x11d));var _0xdbc0=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0xbc0d[_0x4aa838];return _0x3abff0;};'use strict';var _=require(_0xdbc0('0x0'));var util=require(_0xdbc0('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdbc0('0x2'));var rp=require(_0xdbc0('0x3'));var fs=require('fs');var path=require(_0xdbc0('0x4'));var rimraf=require(_0xdbc0('0x5'));var config=require('../../config/environment');var attributes=require(_0xdbc0('0x6'));module[_0xdbc0('0x7')]=function(_0x1e3e89,_0xec5312){return _0x1e3e89[_0xdbc0('0x8')](_0xdbc0('0x9'),attributes,{'tableName':_0xdbc0('0xa'),'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 de98a9f..61280a8 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 _0xa702=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','map','model','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x16b962,_0x1e8b75){var _0x5b8877=function(_0x451ea6){while(--_0x451ea6){_0x16b962['push'](_0x16b962['shift']());}};_0x5b8877(++_0x1e8b75);}(_0xa702,0xbb));var _0x2a70=function(_0x3eaa61,_0xdcab00){_0x3eaa61=_0x3eaa61-0x0;var _0x54de23=_0xa702[_0x3eaa61];return _0x54de23;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2a70('0x0'));var BPromise=require('bluebird');var rs=require(_0x2a70('0x1'));var fs=require('fs');var Redis=require(_0x2a70('0x2'));var db=require(_0x2a70('0x3'))['db'];var utils=require(_0x2a70('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2a70('0x5'));var jayson=require(_0x2a70('0x6'));var client=jayson['client'][_0x2a70('0x7')]({'port':0x232a});config[_0x2a70('0x8')]=_[_0x2a70('0x9')](config['redis'],{'host':_0x2a70('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')[_0x2a70('0xb')](socket);function respondWithRpcPromise(_0x42cc58,_0x402e1b,_0xe71ee7){return new BPromise(function(_0x569154,_0x59c860){return client[_0x2a70('0xc')](_0x42cc58,_0xe71ee7)[_0x2a70('0xd')](function(_0x235ac7){logger[_0x2a70('0xe')](_0x2a70('0xf'),_0x402e1b,_0x2a70('0x10'));logger[_0x2a70('0x11')](_0x2a70('0x12'),_0x402e1b,_0x2a70('0x10'),JSON['stringify'](_0x235ac7));if(_0x235ac7[_0x2a70('0x13')]){if(_0x235ac7['error'][_0x2a70('0x14')]===0x1f4){logger[_0x2a70('0x13')](_0x2a70('0xf'),_0x402e1b,_0x235ac7[_0x2a70('0x13')][_0x2a70('0x15')]);return _0x59c860(_0x235ac7[_0x2a70('0x13')][_0x2a70('0x15')]);}logger[_0x2a70('0x13')](_0x2a70('0xf'),_0x402e1b,_0x235ac7['error']['message']);return _0x569154(_0x235ac7[_0x2a70('0x13')]['message']);}else{logger[_0x2a70('0xe')](_0x2a70('0xf'),_0x402e1b,_0x2a70('0x10'));_0x569154(_0x235ac7[_0x2a70('0x16')]['message']);}})[_0x2a70('0x17')](function(_0x498d18){logger[_0x2a70('0x13')](_0x2a70('0xf'),_0x402e1b,_0x498d18);_0x59c860(_0x498d18);});});}exports[_0x2a70('0x18')]=function(_0x4af1fd){var _0x5b7a1e=this;return new Promise(function(_0x1b15d9,_0x50daf3){return db[_0x2a70('0x19')][_0x2a70('0x1a')]({'raw':_0x4af1fd[_0x2a70('0x1b')]?_0x4af1fd[_0x2a70('0x1b')][_0x2a70('0x1c')]===undefined?!![]:![]:!![],'where':_0x4af1fd[_0x2a70('0x1b')]?_0x4af1fd[_0x2a70('0x1b')]['where']||null:null,'attributes':_0x4af1fd['options']?_0x4af1fd[_0x2a70('0x1b')][_0x2a70('0x1d')]||null:null,'include':_0x4af1fd[_0x2a70('0x1b')]?_0x4af1fd[_0x2a70('0x1b')][_0x2a70('0x1e')]?_[_0x2a70('0x1f')](_0x4af1fd[_0x2a70('0x1b')]['include'],function(_0x2a6583){return{'model':db[_0x2a6583[_0x2a70('0x20')]],'as':_0x2a6583['as'],'attributes':_0x2a6583['attributes'],'include':_0x2a6583[_0x2a70('0x1e')]?_[_0x2a70('0x1f')](_0x2a6583[_0x2a70('0x1e')],function(_0xb71381){return{'model':db[_0xb71381['model']],'as':_0xb71381['as'],'attributes':_0xb71381[_0x2a70('0x1d')],'include':_0xb71381[_0x2a70('0x1e')]?_['map'](_0xb71381[_0x2a70('0x1e')],function(_0x364f4b){return{'model':db[_0x364f4b['model']],'as':_0x364f4b['as'],'attributes':_0x364f4b[_0x2a70('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2a70('0xd')](function(_0x330321){logger['info'](_0x2a70('0x18'),_0x4af1fd);logger[_0x2a70('0x11')](_0x2a70('0x18'),_0x4af1fd,JSON[_0x2a70('0x21')](_0x330321));_0x1b15d9(_0x330321);})[_0x2a70('0x17')](function(_0x39eb5a){logger[_0x2a70('0x13')](_0x2a70('0x18'),_0x39eb5a[_0x2a70('0x15')],_0x4af1fd);_0x50daf3(_0x5b7a1e[_0x2a70('0x13')](0x1f4,_0x39eb5a[_0x2a70('0x15')]));});});}; \ No newline at end of file +var _0x6fa2=['error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','where','map','include','model','attributes','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3bd09f,_0x177165){var _0x4ecce9=function(_0x41a69d){while(--_0x41a69d){_0x3bd09f['push'](_0x3bd09f['shift']());}};_0x4ecce9(++_0x177165);}(_0x6fa2,0x7a));var _0x26fa=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x6fa2[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x26fa('0x0'));var util=require(_0x26fa('0x1'));var moment=require(_0x26fa('0x2'));var BPromise=require('bluebird');var rs=require(_0x26fa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26fa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x26fa('0x5'))(_0x26fa('0x6'));var config=require('../../config/environment');var jayson=require(_0x26fa('0x7'));var client=jayson[_0x26fa('0x8')][_0x26fa('0x9')]({'port':0x232a});config['redis']=_[_0x26fa('0xa')](config[_0x26fa('0xb')],{'host':_0x26fa('0xc'),'port':0x18eb});var socket=require(_0x26fa('0xd'))(new Redis(config[_0x26fa('0xb')]));require(_0x26fa('0xe'))[_0x26fa('0xf')](socket);function respondWithRpcPromise(_0x567218,_0x4bee88,_0x33d56b){return new BPromise(function(_0x28a57a,_0x22164d){return client[_0x26fa('0x10')](_0x567218,_0x33d56b)[_0x26fa('0x11')](function(_0x303921){logger[_0x26fa('0x12')](_0x26fa('0x13'),_0x4bee88,_0x26fa('0x14'));logger[_0x26fa('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4bee88,'request\x20sent',JSON['stringify'](_0x303921));if(_0x303921['error']){if(_0x303921[_0x26fa('0x16')][_0x26fa('0x17')]===0x1f4){logger['error'](_0x26fa('0x13'),_0x4bee88,_0x303921[_0x26fa('0x16')]['message']);return _0x22164d(_0x303921[_0x26fa('0x16')][_0x26fa('0x18')]);}logger[_0x26fa('0x16')](_0x26fa('0x13'),_0x4bee88,_0x303921['error'][_0x26fa('0x18')]);return _0x28a57a(_0x303921['error'][_0x26fa('0x18')]);}else{logger[_0x26fa('0x12')](_0x26fa('0x13'),_0x4bee88,_0x26fa('0x14'));_0x28a57a(_0x303921['result'][_0x26fa('0x18')]);}})[_0x26fa('0x19')](function(_0xba188){logger['error'](_0x26fa('0x13'),_0x4bee88,_0xba188);_0x22164d(_0xba188);});});}exports[_0x26fa('0x1a')]=function(_0x2b56da){var _0x40bffe=this;return new Promise(function(_0x791f72,_0x5bb8fd){return db[_0x26fa('0x1b')][_0x26fa('0x1c')]({'raw':_0x2b56da[_0x26fa('0x1d')]?_0x2b56da['options']['raw']===undefined?!![]:![]:!![],'where':_0x2b56da[_0x26fa('0x1d')]?_0x2b56da[_0x26fa('0x1d')][_0x26fa('0x1e')]||null:null,'attributes':_0x2b56da[_0x26fa('0x1d')]?_0x2b56da[_0x26fa('0x1d')]['attributes']||null:null,'include':_0x2b56da[_0x26fa('0x1d')]?_0x2b56da[_0x26fa('0x1d')]['include']?_[_0x26fa('0x1f')](_0x2b56da[_0x26fa('0x1d')][_0x26fa('0x20')],function(_0x315210){return{'model':db[_0x315210[_0x26fa('0x21')]],'as':_0x315210['as'],'attributes':_0x315210['attributes'],'include':_0x315210[_0x26fa('0x20')]?_['map'](_0x315210[_0x26fa('0x20')],function(_0x4eb324){return{'model':db[_0x4eb324[_0x26fa('0x21')]],'as':_0x4eb324['as'],'attributes':_0x4eb324[_0x26fa('0x22')],'include':_0x4eb324['include']?_[_0x26fa('0x1f')](_0x4eb324[_0x26fa('0x20')],function(_0x5f16c5){return{'model':db[_0x5f16c5['model']],'as':_0x5f16c5['as'],'attributes':_0x5f16c5[_0x26fa('0x22')]};}):[]};}):[]};}):[]:[]})[_0x26fa('0x11')](function(_0x1c4fd0){logger['info'](_0x26fa('0x1a'),_0x2b56da);logger[_0x26fa('0x15')](_0x26fa('0x1a'),_0x2b56da,JSON[_0x26fa('0x23')](_0x1c4fd0));_0x791f72(_0x1c4fd0);})[_0x26fa('0x19')](function(_0x70b220){logger[_0x26fa('0x16')](_0x26fa('0x1a'),_0x70b220[_0x26fa('0x18')],_0x2b56da);_0x5bb8fd(_0x40bffe[_0x26fa('0x16')](0x1f4,_0x70b220[_0x26fa('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index b0f0678..ef695f6 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(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 4358eca..5cb33a3 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(_0x33549c,_0x227ecb){var _0x5457f6=function(_0x40cb1e){while(--_0x40cb1e){_0x33549c['push'](_0x33549c['shift']());}};_0x5457f6(++_0x227ecb);}(_0x7217,0x19e));var _0x7721=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x7217[_0x173d7e];return _0x2220d6;};'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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x2c6686,_0x99bdef){var _0x147bc6=function(_0x736ca6){while(--_0x736ca6){_0x2c6686['push'](_0x2c6686['shift']());}};_0x147bc6(++_0x99bdef);}(_0x55ca,0x126));var _0xa55c=function(_0x61bb05,_0x47421f){_0x61bb05=_0x61bb05-0x0;var _0x3ceb3e=_0x55ca[_0x61bb05];return _0x3ceb3e;};'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['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 9754e4b..543124a 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 _0x3913=['STRING','TEXT','*,*,*,*','INTEGER'];(function(_0xffcba3,_0x44ea11){var _0x2403dc=function(_0x276fc2){while(--_0x276fc2){_0xffcba3['push'](_0xffcba3['shift']());}};_0x2403dc(++_0x44ea11);}(_0x3913,0xcb));var _0x3391=function(_0x483ed2,_0x2878b2){_0x483ed2=_0x483ed2-0x0;var _0xc78aed=_0x3913[_0x483ed2];return _0xc78aed;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x3391('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x3391('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3391('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3391('0x1')],'defaultValue':_0x3391('0x3')}}; \ No newline at end of file +var _0x4622=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x4622,0x84));var _0x2462=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x4622[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0x2462('0x0'));module[_0x2462('0x1')]={'priority':{'type':Sequelize[_0x2462('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2462('0x3')],'allowNull':![],'defaultValue':_0x2462('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2462('0x3')],'defaultValue':_0x2462('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index d50334b..36f77a3 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 _0x2c94=['path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','save','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','SmsApplication','include','findAll','then','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0x2c94,0x1af));var _0x42c9=function(_0x1db295,_0x212309){_0x1db295=_0x1db295-0x0;var _0x17759a=_0x2c94[_0x1db295];return _0x17759a;};'use strict';var emlformat=require(_0x42c9('0x0'));var rimraf=require(_0x42c9('0x1'));var zipdir=require(_0x42c9('0x2'));var jsonpatch=require(_0x42c9('0x3'));var rp=require(_0x42c9('0x4'));var moment=require('moment');var BPromise=require(_0x42c9('0x5'));var Mustache=require(_0x42c9('0x6'));var util=require('util');var path=require(_0x42c9('0x7'));var sox=require(_0x42c9('0x8'));var csv=require(_0x42c9('0x9'));var ejs=require(_0x42c9('0xa'));var fs=require('fs');var fs_extra=require(_0x42c9('0xb'));var _=require(_0x42c9('0xc'));var squel=require(_0x42c9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x42c9('0xe'));var toCsv=require(_0x42c9('0x9'));var querystring=require(_0x42c9('0xf'));var Papa=require(_0x42c9('0x10'));var Redis=require(_0x42c9('0x11'));var authService=require(_0x42c9('0x12'));var qs=require(_0x42c9('0x13'));var as=require(_0x42c9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x42c9('0x15'))(_0x42c9('0x16'));var utils=require('../../config/utils');var config=require(_0x42c9('0x17'));var licenseUtil=require(_0x42c9('0x18'));var db=require(_0x42c9('0x19'))['db'];function respondWithStatusCode(_0x1e310d,_0x7b07bb){_0x7b07bb=_0x7b07bb||0xcc;return function(_0x50e49d){if(_0x50e49d){return _0x1e310d['sendStatus'](_0x7b07bb);}return _0x1e310d[_0x42c9('0x1a')](_0x7b07bb)[_0x42c9('0x1b')]();};}function respondWithResult(_0x4a541b,_0x1cbc53){_0x1cbc53=_0x1cbc53||0xc8;return function(_0x5b8165){if(_0x5b8165){return _0x4a541b[_0x42c9('0x1a')](_0x1cbc53)[_0x42c9('0x1c')](_0x5b8165);}};}function respondWithFilteredResult(_0x26ec41,_0x1b6216){return function(_0x337549){if(_0x337549){var _0x43a217=typeof _0x1b6216[_0x42c9('0x1d')]===_0x42c9('0x1e')&&typeof _0x1b6216['limit']===_0x42c9('0x1e');var _0x316cd2=_0x337549['count'];var _0x52c0d0=_0x43a217?0x0:_0x1b6216[_0x42c9('0x1d')];var _0x594c7b=_0x43a217?_0x337549[_0x42c9('0x1f')]:_0x1b6216[_0x42c9('0x1d')]+_0x1b6216[_0x42c9('0x20')];var _0x5b8460;if(_0x594c7b>=_0x316cd2){_0x594c7b=_0x316cd2;_0x5b8460=0xc8;}else{_0x5b8460=0xce;}_0x26ec41['status'](_0x5b8460);return _0x26ec41['set'](_0x42c9('0x21'),_0x52c0d0+'-'+_0x594c7b+'/'+_0x316cd2)['json'](_0x337549);}return null;};}function patchUpdates(_0xdd920d){return function(_0x2e2ba8){try{jsonpatch['apply'](_0x2e2ba8,_0xdd920d,!![]);}catch(_0x49209f){return BPromise['reject'](_0x49209f);}return _0x2e2ba8[_0x42c9('0x22')]();};}function saveUpdates(_0x41ec9f,_0x536ab8){return function(_0x14a7c4){if(_0x14a7c4){return _0x14a7c4['update'](_0x41ec9f)['then'](function(_0x3c7a28){return _0x3c7a28;});}return null;};}function removeEntity(_0x23cca8,_0x2017f0){return function(_0x1d61df){if(_0x1d61df){return _0x1d61df[_0x42c9('0x23')]()['then'](function(){_0x23cca8[_0x42c9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f673a,_0x2d4528){return function(_0x2afb2c){if(!_0x2afb2c){_0x4f673a[_0x42c9('0x24')](0x194);}return _0x2afb2c;};}function handleError(_0x22180f,_0x516819){_0x516819=_0x516819||0x1f4;return function(_0xb067e1){logger[_0x42c9('0x25')](_0xb067e1[_0x42c9('0x26')]);if(_0xb067e1[_0x42c9('0x27')]){delete _0xb067e1[_0x42c9('0x27')];}_0x22180f[_0x42c9('0x1a')](_0x516819)[_0x42c9('0x28')](_0xb067e1);};}exports[_0x42c9('0x29')]=function(_0x2217c8,_0x4259c5){var _0x35e0ab={},_0x421992={},_0x570290={'count':0x0,'rows':[]};var _0x59b780=_[_0x42c9('0x2a')](db['SmsApplication'][_0x42c9('0x2b')],function(_0x236173){return{'name':_0x236173[_0x42c9('0x2c')],'type':_0x236173['type'][_0x42c9('0x2d')]};});_0x421992['model']=_[_0x42c9('0x2a')](_0x59b780,_0x42c9('0x27'));_0x421992[_0x42c9('0x2e')]=_[_0x42c9('0x2f')](_0x2217c8[_0x42c9('0x2e')]);_0x421992[_0x42c9('0x30')]=_['intersection'](_0x421992['model'],_0x421992['query']);_0x35e0ab[_0x42c9('0x31')]=_[_0x42c9('0x32')](_0x421992['model'],qs[_0x42c9('0x33')](_0x2217c8[_0x42c9('0x2e')][_0x42c9('0x33')]));_0x35e0ab['attributes']=_0x35e0ab['attributes'][_0x42c9('0x34')]?_0x35e0ab['attributes']:_0x421992[_0x42c9('0x35')];if(!_0x2217c8[_0x42c9('0x2e')][_0x42c9('0x36')](_0x42c9('0x37'))){_0x35e0ab[_0x42c9('0x20')]=qs[_0x42c9('0x20')](_0x2217c8[_0x42c9('0x2e')][_0x42c9('0x20')]);_0x35e0ab[_0x42c9('0x1d')]=qs[_0x42c9('0x1d')](_0x2217c8[_0x42c9('0x2e')][_0x42c9('0x1d')]);}_0x35e0ab['order']=qs[_0x42c9('0x38')](_0x2217c8['query'][_0x42c9('0x38')]);_0x35e0ab[_0x42c9('0x39')]=qs[_0x42c9('0x30')](_['pick'](_0x2217c8[_0x42c9('0x2e')],_0x421992['filters']),_0x59b780);if(_0x2217c8[_0x42c9('0x2e')][_0x42c9('0x3a')]){_0x35e0ab[_0x42c9('0x39')]=_[_0x42c9('0x3b')](_0x35e0ab[_0x42c9('0x39')],{'$or':_[_0x42c9('0x2a')](_0x59b780,function(_0x5b2c07){if(_0x5b2c07[_0x42c9('0x3c')]!==_0x42c9('0x3d')){var _0x400829={};_0x400829[_0x5b2c07[_0x42c9('0x27')]]={'$like':'%'+_0x2217c8['query'][_0x42c9('0x3a')]+'%'};return _0x400829;}})});}_0x35e0ab=_[_0x42c9('0x3b')]({},_0x35e0ab,_0x2217c8['options']);var _0x1c195e={'where':_0x35e0ab[_0x42c9('0x39')]};return db[_0x42c9('0x3e')][_0x42c9('0x1f')](_0x1c195e)['then'](function(_0xb2135f){_0x570290[_0x42c9('0x1f')]=_0xb2135f;if(_0x2217c8['query']['includeAll']){_0x35e0ab[_0x42c9('0x3f')]=[{'all':!![]}];}return db[_0x42c9('0x3e')][_0x42c9('0x40')](_0x35e0ab);})[_0x42c9('0x41')](function(_0x3fa438){_0x570290[_0x42c9('0x42')]=_0x3fa438;return _0x570290;})['then'](respondWithFilteredResult(_0x4259c5,_0x35e0ab))[_0x42c9('0x43')](handleError(_0x4259c5,null));};exports[_0x42c9('0x44')]=function(_0x4a4898,_0xe45c3a){var _0x3a22fa={'raw':!![],'where':{'id':_0x4a4898[_0x42c9('0x45')]['id']}},_0x19f2a2={};_0x19f2a2[_0x42c9('0x35')]=_[_0x42c9('0x2f')](db[_0x42c9('0x3e')][_0x42c9('0x2b')]);_0x19f2a2['query']=_[_0x42c9('0x2f')](_0x4a4898[_0x42c9('0x2e')]);_0x19f2a2[_0x42c9('0x30')]=_['intersection'](_0x19f2a2[_0x42c9('0x35')],_0x19f2a2[_0x42c9('0x2e')]);_0x3a22fa['attributes']=_[_0x42c9('0x32')](_0x19f2a2[_0x42c9('0x35')],qs[_0x42c9('0x33')](_0x4a4898['query'][_0x42c9('0x33')]));_0x3a22fa[_0x42c9('0x31')]=_0x3a22fa['attributes']['length']?_0x3a22fa['attributes']:_0x19f2a2[_0x42c9('0x35')];if(_0x4a4898[_0x42c9('0x2e')]['includeAll']){_0x3a22fa[_0x42c9('0x3f')]=[{'all':!![]}];}_0x3a22fa=_[_0x42c9('0x3b')]({},_0x3a22fa,_0x4a4898['options']);return db[_0x42c9('0x3e')][_0x42c9('0x46')](_0x3a22fa)[_0x42c9('0x41')](handleEntityNotFound(_0xe45c3a,null))[_0x42c9('0x41')](respondWithResult(_0xe45c3a,null))['catch'](handleError(_0xe45c3a,null));};exports['create']=function(_0x2b752c,_0x5237d4){return db[_0x42c9('0x3e')][_0x42c9('0x47')](_0x2b752c[_0x42c9('0x48')],{})[_0x42c9('0x41')](respondWithResult(_0x5237d4,0xc9))[_0x42c9('0x43')](handleError(_0x5237d4,null));};exports['update']=function(_0x3e27fb,_0x2957de){if(_0x3e27fb[_0x42c9('0x48')]['id']){delete _0x3e27fb[_0x42c9('0x48')]['id'];}return db[_0x42c9('0x3e')][_0x42c9('0x46')]({'where':{'id':_0x3e27fb[_0x42c9('0x45')]['id']}})[_0x42c9('0x41')](handleEntityNotFound(_0x2957de,null))[_0x42c9('0x41')](saveUpdates(_0x3e27fb[_0x42c9('0x48')],null))['then'](respondWithResult(_0x2957de,null))[_0x42c9('0x43')](handleError(_0x2957de,null));};exports[_0x42c9('0x23')]=function(_0x3d592a,_0x3afedd){return db[_0x42c9('0x3e')][_0x42c9('0x46')]({'where':{'id':_0x3d592a[_0x42c9('0x45')]['id']}})[_0x42c9('0x41')](handleEntityNotFound(_0x3afedd,null))[_0x42c9('0x41')](removeEntity(_0x3afedd,null))[_0x42c9('0x43')](handleError(_0x3afedd,null));}; \ No newline at end of file +var _0x44d4=['update','then','end','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0x44d4,0x1e0));var _0x444d=function(_0x254d93,_0x250b89){_0x254d93=_0x254d93-0x0;var _0x467a51=_0x44d4[_0x254d93];return _0x467a51;};'use strict';var emlformat=require(_0x444d('0x0'));var rimraf=require(_0x444d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x444d('0x2'));var BPromise=require(_0x444d('0x3'));var Mustache=require(_0x444d('0x4'));var util=require(_0x444d('0x5'));var path=require('path');var sox=require(_0x444d('0x6'));var csv=require(_0x444d('0x7'));var ejs=require(_0x444d('0x8'));var fs=require('fs');var fs_extra=require(_0x444d('0x9'));var _=require(_0x444d('0xa'));var squel=require(_0x444d('0xb'));var crypto=require(_0x444d('0xc'));var jsforce=require(_0x444d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x444d('0x7'));var querystring=require('querystring');var Papa=require(_0x444d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x444d('0xf'));var hardwareService=require(_0x444d('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x444d('0x11'));var licenseUtil=require(_0x444d('0x12'));var db=require(_0x444d('0x13'))['db'];function respondWithStatusCode(_0x492724,_0x2506f4){_0x2506f4=_0x2506f4||0xcc;return function(_0x547a6a){if(_0x547a6a){return _0x492724[_0x444d('0x14')](_0x2506f4);}return _0x492724[_0x444d('0x15')](_0x2506f4)['end']();};}function respondWithResult(_0x362298,_0x3f9472){_0x3f9472=_0x3f9472||0xc8;return function(_0x43b4b7){if(_0x43b4b7){return _0x362298[_0x444d('0x15')](_0x3f9472)[_0x444d('0x16')](_0x43b4b7);}};}function respondWithFilteredResult(_0x2636db,_0x315abb){return function(_0x4f6b7c){if(_0x4f6b7c){var _0x148a9f=typeof _0x315abb['offset']===_0x444d('0x17')&&typeof _0x315abb[_0x444d('0x18')]===_0x444d('0x17');var _0x3e3b8c=_0x4f6b7c[_0x444d('0x19')];var _0x40ad8e=_0x148a9f?0x0:_0x315abb['offset'];var _0x3aee3d=_0x148a9f?_0x4f6b7c[_0x444d('0x19')]:_0x315abb['offset']+_0x315abb[_0x444d('0x18')];var _0x17de9e;if(_0x3aee3d>=_0x3e3b8c){_0x3aee3d=_0x3e3b8c;_0x17de9e=0xc8;}else{_0x17de9e=0xce;}_0x2636db['status'](_0x17de9e);return _0x2636db[_0x444d('0x1a')](_0x444d('0x1b'),_0x40ad8e+'-'+_0x3aee3d+'/'+_0x3e3b8c)['json'](_0x4f6b7c);}return null;};}function patchUpdates(_0x14c198){return function(_0x24ab7a){try{jsonpatch[_0x444d('0x1c')](_0x24ab7a,_0x14c198,!![]);}catch(_0x297207){return BPromise[_0x444d('0x1d')](_0x297207);}return _0x24ab7a[_0x444d('0x1e')]();};}function saveUpdates(_0x21aea0,_0x1163de){return function(_0x543b20){if(_0x543b20){return _0x543b20[_0x444d('0x1f')](_0x21aea0)['then'](function(_0x18644a){return _0x18644a;});}return null;};}function removeEntity(_0x2e09a7,_0x97b725){return function(_0x236aaf){if(_0x236aaf){return _0x236aaf['destroy']()[_0x444d('0x20')](function(){_0x2e09a7[_0x444d('0x15')](0xcc)[_0x444d('0x21')]();});}};}function handleEntityNotFound(_0x338e3d,_0x439df2){return function(_0x32a5e8){if(!_0x32a5e8){_0x338e3d[_0x444d('0x14')](0x194);}return _0x32a5e8;};}function handleError(_0x1b7f02,_0x35a905){_0x35a905=_0x35a905||0x1f4;return function(_0x4d4514){logger[_0x444d('0x22')](_0x4d4514[_0x444d('0x23')]);if(_0x4d4514[_0x444d('0x24')]){delete _0x4d4514['name'];}_0x1b7f02['status'](_0x35a905)[_0x444d('0x25')](_0x4d4514);};}exports[_0x444d('0x26')]=function(_0x2db231,_0x58fc95){var _0x418cfd={},_0x811b05={},_0x1b6ab3={'count':0x0,'rows':[]};var _0x40f55e=_[_0x444d('0x27')](db[_0x444d('0x28')][_0x444d('0x29')],function(_0x16cef4){return{'name':_0x16cef4[_0x444d('0x2a')],'type':_0x16cef4[_0x444d('0x2b')]['key']};});_0x811b05['model']=_['map'](_0x40f55e,_0x444d('0x24'));_0x811b05[_0x444d('0x2c')]=_['keys'](_0x2db231[_0x444d('0x2c')]);_0x811b05['filters']=_[_0x444d('0x2d')](_0x811b05[_0x444d('0x2e')],_0x811b05[_0x444d('0x2c')]);_0x418cfd[_0x444d('0x2f')]=_[_0x444d('0x2d')](_0x811b05[_0x444d('0x2e')],qs[_0x444d('0x30')](_0x2db231[_0x444d('0x2c')][_0x444d('0x30')]));_0x418cfd[_0x444d('0x2f')]=_0x418cfd[_0x444d('0x2f')][_0x444d('0x31')]?_0x418cfd[_0x444d('0x2f')]:_0x811b05[_0x444d('0x2e')];if(!_0x2db231[_0x444d('0x2c')][_0x444d('0x32')](_0x444d('0x33'))){_0x418cfd['limit']=qs[_0x444d('0x18')](_0x2db231[_0x444d('0x2c')][_0x444d('0x18')]);_0x418cfd['offset']=qs[_0x444d('0x34')](_0x2db231[_0x444d('0x2c')][_0x444d('0x34')]);}_0x418cfd[_0x444d('0x35')]=qs[_0x444d('0x36')](_0x2db231[_0x444d('0x2c')][_0x444d('0x36')]);_0x418cfd[_0x444d('0x37')]=qs[_0x444d('0x38')](_[_0x444d('0x39')](_0x2db231[_0x444d('0x2c')],_0x811b05[_0x444d('0x38')]),_0x40f55e);if(_0x2db231[_0x444d('0x2c')][_0x444d('0x3a')]){_0x418cfd[_0x444d('0x37')]=_['merge'](_0x418cfd['where'],{'$or':_[_0x444d('0x27')](_0x40f55e,function(_0x3a8a65){if(_0x3a8a65['type']!==_0x444d('0x3b')){var _0x548e2d={};_0x548e2d[_0x3a8a65[_0x444d('0x24')]]={'$like':'%'+_0x2db231['query'][_0x444d('0x3a')]+'%'};return _0x548e2d;}})});}_0x418cfd=_[_0x444d('0x3c')]({},_0x418cfd,_0x2db231[_0x444d('0x3d')]);var _0x4f08fe={'where':_0x418cfd['where']};return db[_0x444d('0x28')][_0x444d('0x19')](_0x4f08fe)[_0x444d('0x20')](function(_0xd58522){_0x1b6ab3[_0x444d('0x19')]=_0xd58522;if(_0x2db231[_0x444d('0x2c')][_0x444d('0x3e')]){_0x418cfd['include']=[{'all':!![]}];}return db['SmsApplication'][_0x444d('0x3f')](_0x418cfd);})[_0x444d('0x20')](function(_0x2c9c64){_0x1b6ab3[_0x444d('0x40')]=_0x2c9c64;return _0x1b6ab3;})['then'](respondWithFilteredResult(_0x58fc95,_0x418cfd))[_0x444d('0x41')](handleError(_0x58fc95,null));};exports[_0x444d('0x42')]=function(_0x3e824d,_0x55b1f4){var _0x14228b={'raw':!![],'where':{'id':_0x3e824d[_0x444d('0x43')]['id']}},_0x412b09={};_0x412b09[_0x444d('0x2e')]=_['keys'](db[_0x444d('0x28')][_0x444d('0x29')]);_0x412b09['query']=_[_0x444d('0x44')](_0x3e824d[_0x444d('0x2c')]);_0x412b09['filters']=_[_0x444d('0x2d')](_0x412b09['model'],_0x412b09[_0x444d('0x2c')]);_0x14228b[_0x444d('0x2f')]=_['intersection'](_0x412b09['model'],qs[_0x444d('0x30')](_0x3e824d[_0x444d('0x2c')]['fields']));_0x14228b[_0x444d('0x2f')]=_0x14228b['attributes'][_0x444d('0x31')]?_0x14228b[_0x444d('0x2f')]:_0x412b09[_0x444d('0x2e')];if(_0x3e824d[_0x444d('0x2c')][_0x444d('0x3e')]){_0x14228b[_0x444d('0x45')]=[{'all':!![]}];}_0x14228b=_[_0x444d('0x3c')]({},_0x14228b,_0x3e824d['options']);return db['SmsApplication'][_0x444d('0x46')](_0x14228b)[_0x444d('0x20')](handleEntityNotFound(_0x55b1f4,null))[_0x444d('0x20')](respondWithResult(_0x55b1f4,null))['catch'](handleError(_0x55b1f4,null));};exports['create']=function(_0x238bc0,_0x3f2230){return db[_0x444d('0x28')][_0x444d('0x47')](_0x238bc0['body'],{})[_0x444d('0x20')](respondWithResult(_0x3f2230,0xc9))[_0x444d('0x41')](handleError(_0x3f2230,null));};exports['update']=function(_0x1cc534,_0x2054c5){if(_0x1cc534[_0x444d('0x48')]['id']){delete _0x1cc534[_0x444d('0x48')]['id'];}return db[_0x444d('0x28')][_0x444d('0x46')]({'where':{'id':_0x1cc534[_0x444d('0x43')]['id']}})[_0x444d('0x20')](handleEntityNotFound(_0x2054c5,null))[_0x444d('0x20')](saveUpdates(_0x1cc534[_0x444d('0x48')],null))[_0x444d('0x20')](respondWithResult(_0x2054c5,null))[_0x444d('0x41')](handleError(_0x2054c5,null));};exports['destroy']=function(_0xde1d0e,_0x2ed70e){return db[_0x444d('0x28')][_0x444d('0x46')]({'where':{'id':_0xde1d0e[_0x444d('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ed70e,null))['then'](removeEntity(_0x2ed70e,null))[_0x444d('0x41')](handleError(_0x2ed70e,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index e5c1a68..c38a43d 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 _0xa437=['SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','./smsApplication.attributes','define'];(function(_0x39307d,_0x1b4b45){var _0x5ebf5a=function(_0x3cf731){while(--_0x3cf731){_0x39307d['push'](_0x39307d['shift']());}};_0x5ebf5a(++_0x1b4b45);}(_0xa437,0x12f));var _0x7a43=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa437[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7a43('0x0'));var util=require(_0x7a43('0x1'));var logger=require(_0x7a43('0x2'))(_0x7a43('0x3'));var moment=require(_0x7a43('0x4'));var BPromise=require(_0x7a43('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a43('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7a43('0x7'));module['exports']=function(_0x3a7b0a,_0x383587){return _0x3a7b0a[_0x7a43('0x8')](_0x7a43('0x9'),attributes,{'tableName':_0x7a43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7a43('0xb'),'collate':_0x7a43('0xc')});}; \ No newline at end of file +var _0xcdbb=['path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x32be82,_0x21b592){var _0x35aa04=function(_0x3d59ca){while(--_0x3d59ca){_0x32be82['push'](_0x32be82['shift']());}};_0x35aa04(++_0x21b592);}(_0xcdbb,0x1f2));var _0xbcdb=function(_0x5c4c46,_0x12e564){_0x5c4c46=_0x5c4c46-0x0;var _0x318cb4=_0xcdbb[_0x5c4c46];return _0x318cb4;};'use strict';var _=require('lodash');var util=require(_0xbcdb('0x0'));var logger=require(_0xbcdb('0x1'))(_0xbcdb('0x2'));var moment=require(_0xbcdb('0x3'));var BPromise=require(_0xbcdb('0x4'));var rp=require(_0xbcdb('0x5'));var fs=require('fs');var path=require(_0xbcdb('0x6'));var rimraf=require(_0xbcdb('0x7'));var config=require(_0xbcdb('0x8'));var attributes=require(_0xbcdb('0x9'));module[_0xbcdb('0xa')]=function(_0x50c4b1,_0x5cd500){return _0x50c4b1[_0xbcdb('0xb')](_0xbcdb('0xc'),attributes,{'tableName':_0xbcdb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 506cd8b..b9d6ffd 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 _0x1280=['message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x452db5,_0x5bb2fa){var _0x29e8aa=function(_0x5807bf){while(--_0x5807bf){_0x452db5['push'](_0x452db5['shift']());}};_0x29e8aa(++_0x5bb2fa);}(_0x1280,0xac));var _0x0128=function(_0x3e478c,_0x152670){_0x3e478c=_0x3e478c-0x0;var _0x29ef89=_0x1280[_0x3e478c];return _0x29ef89;};'use strict';var _=require(_0x0128('0x0'));var util=require('util');var moment=require(_0x0128('0x1'));var BPromise=require(_0x0128('0x2'));var rs=require(_0x0128('0x3'));var fs=require('fs');var Redis=require(_0x0128('0x4'));var db=require(_0x0128('0x5'))['db'];var utils=require(_0x0128('0x6'));var logger=require('../../config/logger')(_0x0128('0x7'));var config=require(_0x0128('0x8'));var jayson=require(_0x0128('0x9'));var client=jayson[_0x0128('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e74fe,_0x1d647f,_0x134abd){return new BPromise(function(_0x2b8b86,_0x43a105){return client['request'](_0x4e74fe,_0x134abd)[_0x0128('0xb')](function(_0x2fa9cb){logger['info'](_0x0128('0xc'),_0x1d647f,_0x0128('0xd'));logger[_0x0128('0xe')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x1d647f,'request\x20sent',JSON[_0x0128('0xf')](_0x2fa9cb));if(_0x2fa9cb[_0x0128('0x10')]){if(_0x2fa9cb[_0x0128('0x10')]['code']===0x1f4){logger[_0x0128('0x10')]('SmsApplication,\x20%s,\x20%s',_0x1d647f,_0x2fa9cb[_0x0128('0x10')]['message']);return _0x43a105(_0x2fa9cb[_0x0128('0x10')]['message']);}logger[_0x0128('0x10')]('SmsApplication,\x20%s,\x20%s',_0x1d647f,_0x2fa9cb[_0x0128('0x10')][_0x0128('0x11')]);return _0x2b8b86(_0x2fa9cb[_0x0128('0x10')][_0x0128('0x11')]);}else{logger[_0x0128('0x12')](_0x0128('0xc'),_0x1d647f,'request\x20sent');_0x2b8b86(_0x2fa9cb[_0x0128('0x13')][_0x0128('0x11')]);}})[_0x0128('0x14')](function(_0x16a4b7){logger[_0x0128('0x10')](_0x0128('0xc'),_0x1d647f,_0x16a4b7);_0x43a105(_0x16a4b7);});});} \ No newline at end of file +var _0x677a=['message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x94399f,_0x2bbab2){var _0x5ef877=function(_0x16e247){while(--_0x16e247){_0x94399f['push'](_0x94399f['shift']());}};_0x5ef877(++_0x2bbab2);}(_0x677a,0xd6));var _0xa677=function(_0x14874c,_0x245bda){_0x14874c=_0x14874c-0x0;var _0x262d3a=_0x677a[_0x14874c];return _0x262d3a;};'use strict';var _=require(_0xa677('0x0'));var util=require('util');var moment=require(_0xa677('0x1'));var BPromise=require(_0xa677('0x2'));var rs=require(_0xa677('0x3'));var fs=require('fs');var Redis=require(_0xa677('0x4'));var db=require(_0xa677('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa677('0x6'))(_0xa677('0x7'));var config=require(_0xa677('0x8'));var jayson=require(_0xa677('0x9'));var client=jayson[_0xa677('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x303092,_0x1c997f,_0x130b66){return new BPromise(function(_0x10fb5e,_0x568910){return client['request'](_0x303092,_0x130b66)['then'](function(_0x43d392){logger['info'](_0xa677('0xb'),_0x1c997f,_0xa677('0xc'));logger['debug'](_0xa677('0xd'),_0x1c997f,_0xa677('0xc'),JSON[_0xa677('0xe')](_0x43d392));if(_0x43d392[_0xa677('0xf')]){if(_0x43d392['error'][_0xa677('0x10')]===0x1f4){logger[_0xa677('0xf')](_0xa677('0xb'),_0x1c997f,_0x43d392[_0xa677('0xf')]['message']);return _0x568910(_0x43d392[_0xa677('0xf')]['message']);}logger[_0xa677('0xf')](_0xa677('0xb'),_0x1c997f,_0x43d392[_0xa677('0xf')][_0xa677('0x11')]);return _0x10fb5e(_0x43d392[_0xa677('0xf')][_0xa677('0x11')]);}else{logger[_0xa677('0x12')](_0xa677('0xb'),_0x1c997f,_0xa677('0xc'));_0x10fb5e(_0x43d392[_0xa677('0x13')][_0xa677('0x11')]);}})[_0xa677('0x14')](function(_0x37316c){logger[_0xa677('0xf')]('SmsApplication,\x20%s,\x20%s',_0x1c997f,_0x37316c);_0x568910(_0x37316c);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index c243775..80af1dc 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 _0x9354=['/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x298863,_0x57b3cc){var _0xb4d1e8=function(_0x6097b3){while(--_0x6097b3){_0x298863['push'](_0x298863['shift']());}};_0xb4d1e8(++_0x57b3cc);}(_0x9354,0x96));var _0x4935=function(_0x567fff,_0xd8acd8){_0x567fff=_0x567fff-0x0;var _0x465a37=_0x9354[_0x567fff];return _0x465a37;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['get'](_0x4935('0xd'),auth['isAuthenticated'](),controller[_0x4935('0xe')]);router[_0x4935('0x8')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x10')]);router[_0x4935('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x4935('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4935('0x12')]);router[_0x4935('0x13')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x14')]);router[_0x4935('0x13')](_0x4935('0x15'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')](_0x4935('0x17'),_0x4935('0x18')),controller[_0x4935('0x19')]);router[_0x4935('0x1a')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1b')),controller[_0x4935('0x1c')]);router[_0x4935('0x1d')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1e')),controller[_0x4935('0x1f')]);router['delete'](_0x4935('0x15'),auth[_0x4935('0x9')](),controller[_0x4935('0x20')]);module['exports']=router; \ No newline at end of file +var _0x7708=['removeTags','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','addTags','put','delete'];(function(_0x46e3d4,_0x34069a){var _0x20a524=function(_0x18a7dc){while(--_0x18a7dc){_0x46e3d4['push'](_0x46e3d4['shift']());}};_0x20a524(++_0x34069a);}(_0x7708,0x188));var _0x8770=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x7708[_0x4bb66f];return _0xf2772f;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./smsInteraction.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['download']);router[_0x8770('0xf')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x10')]);router['post'](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0xf')](_0x8770('0x12'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:addtags'),controller[_0x8770('0x15')]);router[_0x8770('0x16')]('/:id',auth[_0x8770('0x8')](),interaction['tracked'](_0x8770('0x14'),'smsinteraction:update'),controller['update']);router['delete'](_0x8770('0xa'),auth[_0x8770('0x8')](),interaction[_0x8770('0x13')](_0x8770('0x14'),'smsinteraction:destroy'),controller['destroy']);router[_0x8770('0x17')](_0x8770('0x12'),auth[_0x8770('0x8')](),controller[_0x8770('0x18')]);module[_0x8770('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index ccfcd6c..0e4aaa2 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 _0xf29d=['STRING','ENUM','out','INTEGER','sequelize','moment','BOOLEAN','DATE'];(function(_0x4cfa2d,_0x4da340){var _0xde4e15=function(_0x20cc4c){while(--_0x20cc4c){_0x4cfa2d['push'](_0x4cfa2d['shift']());}};_0xde4e15(++_0x4da340);}(_0xf29d,0xc4));var _0xdf29=function(_0x3918e5,_0xdce013){_0x3918e5=_0x3918e5-0x0;var _0x21ef46=_0xf29d[_0x3918e5];return _0x21ef46;};'use strict';var Sequelize=require(_0xdf29('0x0'));var moment=require(_0xdf29('0x1'));module['exports']={'closed':{'type':Sequelize[_0xdf29('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdf29('0x3')]},'disposition':{'type':Sequelize[_0xdf29('0x4')]},'secondDisposition':{'type':Sequelize[_0xdf29('0x4')]},'thirdDisposition':{'type':Sequelize[_0xdf29('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xdf29('0x5')]('in',_0xdf29('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdf29('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xdf29('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xdf29('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xdf29('0x7')]}}; \ No newline at end of file +var _0xa3e8=['exports','DATE','STRING','out','ENUM','BOOLEAN','INTEGER','sequelize','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa3e8,0x127));var _0x8a3e=function(_0x5e676d,_0xb9f623){_0x5e676d=_0x5e676d-0x0;var _0x4de7dd=_0xa3e8[_0x5e676d];return _0x4de7dd;};'use strict';var Sequelize=require(_0x8a3e('0x0'));var moment=require(_0x8a3e('0x1'));module[_0x8a3e('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8a3e('0x3')]},'disposition':{'type':Sequelize[_0x8a3e('0x4')]},'secondDisposition':{'type':Sequelize[_0x8a3e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8a3e('0x4')]},'note':{'type':Sequelize[_0x8a3e('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8a3e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8a3e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8a3e('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8a3e('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8a3e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 7a7efb2..9aa6a2d 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 _0x7aee=['fields','includeAll','include','merge','options','find','create','body','destroy','describe','addMessage','SmsMessage','ids','getMessages','findOne','length','hasOwnProperty','nolimit','sort','where','pick','filters','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','toString','root','server','files','tmp','join','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Messages','createdAt','read','Account','get','mkdirSync','Sms','Owner','closed','closedAt','disposition','direction','out','System','firstName','secret','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','moment','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','json','end','error','stack','name','index','map','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','sms','query','user','then','catch','show','params','model','keys','intersection','attributes'];(function(_0x240cb0,_0x5e7397){var _0x39f6fc=function(_0x20656b){while(--_0x20656b){_0x240cb0['push'](_0x240cb0['shift']());}};_0x39f6fc(++_0x5e7397);}(_0x7aee,0x1c3));var _0xe7ae=function(_0xf3413a,_0xec4ca2){_0xf3413a=_0xf3413a-0x0;var _0xeeb21d=_0x7aee[_0xf3413a];return _0xeeb21d;};'use strict';var rimraf=require(_0xe7ae('0x0'));var zipdir=require('zip-dir');var moment=require(_0xe7ae('0x1'));var BPromise=require(_0xe7ae('0x2'));var util=require(_0xe7ae('0x3'));var path=require(_0xe7ae('0x4'));var ejs=require(_0xe7ae('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xe7ae('0x6'));var interaction=require(_0xe7ae('0x7'));var qs=require(_0xe7ae('0x8'));var pdf=require(_0xe7ae('0x9'));var logger=require(_0xe7ae('0xa'))(_0xe7ae('0xb'));var config=require(_0xe7ae('0xc'));var db=require(_0xe7ae('0xd'))['db'];config[_0xe7ae('0xe')]=_[_0xe7ae('0xf')](config[_0xe7ae('0xe')],{'host':_0xe7ae('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe7ae('0xe')]));require(_0xe7ae('0x11'))[_0xe7ae('0x12')](socket);function respondWithStatusCode(_0xd55df2,_0x440531){_0x440531=_0x440531||0xcc;return function(_0x136a01){if(_0x136a01){return _0xd55df2[_0xe7ae('0x13')](_0x440531);}return _0xd55df2[_0xe7ae('0x14')](_0x440531)['end']();};}function respondWithResult(_0x2a45bb,_0x2b0a45){_0x2b0a45=_0x2b0a45||0xc8;return function(_0x241acb){if(_0x241acb){return _0x2a45bb['status'](_0x2b0a45)['json'](_0x241acb);}};}function respondWithFilteredResult(_0xfcf475,_0x444546){return function(_0x281b67){if(_0x281b67){var _0x284b25=typeof _0x444546[_0xe7ae('0x15')]===_0xe7ae('0x16')&&typeof _0x444546[_0xe7ae('0x17')]===_0xe7ae('0x16');var _0x30430a=_0x281b67[_0xe7ae('0x18')];var _0x4466f8=_0x284b25?0x0:_0x444546[_0xe7ae('0x15')];var _0x446237=_0x284b25?_0x281b67[_0xe7ae('0x18')]:_0x444546[_0xe7ae('0x15')]+_0x444546[_0xe7ae('0x17')];var _0x268b37;if(_0x446237>=_0x30430a){_0x446237=_0x30430a;_0x268b37=0xc8;}else{_0x268b37=0xce;}_0xfcf475[_0xe7ae('0x14')](_0x268b37);return _0xfcf475['set']('Content-Range',_0x4466f8+'-'+_0x446237+'/'+_0x30430a)[_0xe7ae('0x19')](_0x281b67);}return null;};}function saveUpdates(_0x767e93){return function(_0x4e34c9){if(_0x4e34c9){return _0x4e34c9['update'](_0x767e93)['then'](function(_0x596130){return _0x596130;});}return null;};}function removeEntity(_0x31d495){return function(_0x52b194){if(_0x52b194){return _0x52b194['destroy']()['then'](function(){_0x31d495[_0xe7ae('0x14')](0xcc)[_0xe7ae('0x1a')]();});}};}function handleEntityNotFound(_0x565959){return function(_0x5c8f4){if(!_0x5c8f4){_0x565959['sendStatus'](0x194);}return _0x5c8f4;};}function handleError(_0x5145ab,_0x9baa48){_0x9baa48=_0x9baa48||0x1f4;return function(_0x138a16){logger[_0xe7ae('0x1b')](_0x138a16[_0xe7ae('0x1c')]);if(_0x138a16['name']){delete _0x138a16[_0xe7ae('0x1d')];}_0x5145ab[_0xe7ae('0x14')](_0x9baa48)['send'](_0x138a16);};}exports[_0xe7ae('0x1e')]=function(_0x5afad8,_0x3b08c7){var _0x220780={};var _0x228117=_[_0xe7ae('0x1f')](db[_0xe7ae('0x20')][_0xe7ae('0x21')],function(_0xb11734){return{'name':_0xb11734[_0xe7ae('0x22')],'type':_0xb11734[_0xe7ae('0x23')]['key']};});_0x220780=qs[_0xe7ae('0x24')](_0x228117,_0x5afad8);return interaction[_0xe7ae('0x25')](_0xe7ae('0x26'),_0x5afad8[_0xe7ae('0x27')],_0x5afad8[_0xe7ae('0x28')],_0x220780,_0x228117)[_0xe7ae('0x29')](respondWithFilteredResult(_0x3b08c7,_0x220780))[_0xe7ae('0x2a')](handleError(_0x3b08c7,null));};exports[_0xe7ae('0x2b')]=function(_0xe30b41,_0x2c7455){var _0x524e63={'raw':![],'where':{'id':_0xe30b41[_0xe7ae('0x2c')]['id']}},_0x3cca64={};_0x3cca64[_0xe7ae('0x2d')]=_[_0xe7ae('0x2e')](db[_0xe7ae('0x20')][_0xe7ae('0x21')]);_0x3cca64[_0xe7ae('0x27')]=_['keys'](_0xe30b41[_0xe7ae('0x27')]);_0x3cca64['filters']=_[_0xe7ae('0x2f')](_0x3cca64[_0xe7ae('0x2d')],_0x3cca64[_0xe7ae('0x27')]);_0x524e63[_0xe7ae('0x30')]=_[_0xe7ae('0x2f')](_0x3cca64[_0xe7ae('0x2d')],qs[_0xe7ae('0x31')](_0xe30b41[_0xe7ae('0x27')]['fields']));_0x524e63['attributes']=_0x524e63[_0xe7ae('0x30')]['length']?_0x524e63[_0xe7ae('0x30')]:_0x3cca64['model'];if(_0xe30b41[_0xe7ae('0x27')][_0xe7ae('0x32')]){_0x524e63[_0xe7ae('0x33')]=[{'all':!![]}];}_0x524e63=_[_0xe7ae('0x34')]({},_0x524e63,_0xe30b41[_0xe7ae('0x35')]);return db[_0xe7ae('0x20')][_0xe7ae('0x36')](_0x524e63)[_0xe7ae('0x29')](handleEntityNotFound(_0x2c7455,null))[_0xe7ae('0x29')](respondWithResult(_0x2c7455,null))['catch'](handleError(_0x2c7455,null));};exports[_0xe7ae('0x37')]=function(_0x5af13c,_0x15e2cf){return db[_0xe7ae('0x20')][_0xe7ae('0x37')](_0x5af13c[_0xe7ae('0x38')],{})['then'](respondWithResult(_0x15e2cf,0xc9))[_0xe7ae('0x2a')](handleError(_0x15e2cf,null));};exports['update']=function(_0x412814,_0xc095fb){if(_0x412814[_0xe7ae('0x38')]['id']){delete _0x412814[_0xe7ae('0x38')]['id'];}return db['SmsInteraction'][_0xe7ae('0x36')]({'where':{'id':_0x412814[_0xe7ae('0x2c')]['id']}})[_0xe7ae('0x29')](handleEntityNotFound(_0xc095fb,null))['then'](saveUpdates(_0x412814[_0xe7ae('0x38')],null))[_0xe7ae('0x29')](respondWithResult(_0xc095fb,null))[_0xe7ae('0x2a')](handleError(_0xc095fb,null));};exports[_0xe7ae('0x39')]=function(_0x347b9b,_0x4b0a60){return db[_0xe7ae('0x20')][_0xe7ae('0x36')]({'where':{'id':_0x347b9b[_0xe7ae('0x2c')]['id']}})[_0xe7ae('0x29')](handleEntityNotFound(_0x4b0a60,null))['then'](removeEntity(_0x4b0a60,null))[_0xe7ae('0x2a')](handleError(_0x4b0a60,null));};exports[_0xe7ae('0x3a')]=function(_0x531a53,_0x3c178a){return db[_0xe7ae('0x20')]['describe']()[_0xe7ae('0x29')](respondWithResult(_0x3c178a,null))['catch'](handleError(_0x3c178a,null));};exports[_0xe7ae('0x3b')]=function(_0x5f0ae2,_0x1e19d0){return db[_0xe7ae('0x3c')]['find']({'where':{'id':_0x5f0ae2[_0xe7ae('0x2c')]['id']}})[_0xe7ae('0x29')](handleEntityNotFound(_0x1e19d0,null))[_0xe7ae('0x29')](function(_0x24d675){if(_0x24d675){return _0x24d675[_0xe7ae('0x3b')](_0x5f0ae2[_0xe7ae('0x38')][_0xe7ae('0x3d')],_['omit'](_0x5f0ae2[_0xe7ae('0x38')],[_0xe7ae('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x1e19d0,null))['catch'](handleError(_0x1e19d0,null));};exports[_0xe7ae('0x3e')]=function(_0x597d9e,_0x37b0ed){var _0xa364e4={'raw':![],'where':{}};var _0x846f25={};var _0x3631c4={'count':0x0,'rows':[]};return db[_0xe7ae('0x20')][_0xe7ae('0x3f')]({'where':{'id':_0x597d9e[_0xe7ae('0x2c')]['id']}})[_0xe7ae('0x29')](handleEntityNotFound(_0x37b0ed,null))[_0xe7ae('0x29')](function(_0x2947e9){if(_0x2947e9){_0x846f25[_0xe7ae('0x2d')]=_[_0xe7ae('0x2e')](db[_0xe7ae('0x3c')][_0xe7ae('0x21')]);_0x846f25['query']=_['keys'](_0x597d9e[_0xe7ae('0x27')]);_0x846f25['filters']=_[_0xe7ae('0x2f')](_0x846f25[_0xe7ae('0x2d')],_0x846f25[_0xe7ae('0x27')]);_0xa364e4['attributes']=_['intersection'](_0x846f25[_0xe7ae('0x2d')],qs['fields'](_0x597d9e[_0xe7ae('0x27')][_0xe7ae('0x31')]));_0xa364e4[_0xe7ae('0x30')]=_0xa364e4[_0xe7ae('0x30')][_0xe7ae('0x40')]?_0xa364e4[_0xe7ae('0x30')]:_0x846f25[_0xe7ae('0x2d')];if(!_0x597d9e[_0xe7ae('0x27')][_0xe7ae('0x41')](_0xe7ae('0x42'))){_0xa364e4['limit']=qs[_0xe7ae('0x17')](_0x597d9e[_0xe7ae('0x27')][_0xe7ae('0x17')]);_0xa364e4[_0xe7ae('0x15')]=qs['offset'](_0x597d9e['query'][_0xe7ae('0x15')]);}_0xa364e4['order']=qs[_0xe7ae('0x43')](_0x597d9e['query'][_0xe7ae('0x43')]);_0xa364e4[_0xe7ae('0x44')]=qs['filters'](_[_0xe7ae('0x45')](_0x597d9e[_0xe7ae('0x27')],_0x846f25[_0xe7ae('0x46')]));_0xa364e4['where'][_0xe7ae('0x47')]=_0x2947e9['id'];if(_0x597d9e[_0xe7ae('0x27')][_0xe7ae('0x48')]){_0xa364e4[_0xe7ae('0x44')]=_['merge'](_0xa364e4[_0xe7ae('0x44')],{'$or':_['map'](_0xa364e4[_0xe7ae('0x30')],function(_0x3d016c){var _0x3a8d7f={};_0x3a8d7f[_0x3d016c]={'$like':'%'+_0x597d9e[_0xe7ae('0x27')][_0xe7ae('0x48')]+'%'};return _0x3a8d7f;})});}if(_0x597d9e[_0xe7ae('0x27')][_0xe7ae('0x49')]){var _0x2ceaeb=_0x597d9e[_0xe7ae('0x27')]['$gte'][_0xe7ae('0x4a')](',');var _0x373d24={};_0x373d24[_0x2ceaeb[0x0]]={'$gte':moment(_0x2ceaeb[0x1])[_0xe7ae('0x4b')](_0xe7ae('0x4c'))};_0xa364e4[_0xe7ae('0x44')]=_[_0xe7ae('0x34')](_0xa364e4['where'],_0x373d24);}_0xa364e4=_[_0xe7ae('0x34')]({},_0xa364e4,_0x597d9e['options']);return db[_0xe7ae('0x3c')][_0xe7ae('0x18')]({'where':_0xa364e4['where']})['then'](function(_0x52c2b6){_0x3631c4[_0xe7ae('0x18')]=_0x52c2b6;if(_0x597d9e[_0xe7ae('0x27')]['includeAll']){_0xa364e4[_0xe7ae('0x33')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0xa364e4);})[_0xe7ae('0x29')](function(_0x53cf34){_0x3631c4[_0xe7ae('0x4d')]=_0x53cf34;return _0x3631c4;});}})[_0xe7ae('0x29')](respondWithFilteredResult(_0x37b0ed,_0xa364e4))[_0xe7ae('0x2a')](handleError(_0x37b0ed,null));};exports[_0xe7ae('0x4e')]=function(_0xbc057a,_0x1c4ea8){return db[_0xe7ae('0x20')]['find']({'where':{'id':_0xbc057a['params']['id']}})[_0xe7ae('0x29')](handleEntityNotFound(_0x1c4ea8,null))[_0xe7ae('0x29')](function(_0x43da2b){if(_0x43da2b){return _0x43da2b[_0xe7ae('0x4f')](_0xbc057a[_0xe7ae('0x38')][_0xe7ae('0x3d')],_[_0xe7ae('0x50')](_0xbc057a[_0xe7ae('0x38')],[_0xe7ae('0x3d'),'id'])||{})[_0xe7ae('0x51')](function(){return db[_0xe7ae('0x52')][_0xe7ae('0x25')]({'attributes':['id','name',_0xe7ae('0x53')],'where':{'id':_0xbc057a[_0xe7ae('0x38')][_0xe7ae('0x3d')]}});})[_0xe7ae('0x29')](function(_0x14310f){socket[_0xe7ae('0x54')](_0xe7ae('0x55'),{'id':Number(_0xbc057a[_0xe7ae('0x2c')]['id']),'tags':_0x14310f||[]});return{'id':Number(_0xbc057a['params']['id']),'tags':_0x14310f||[]};});}})['then'](respondWithResult(_0x1c4ea8,null))[_0xe7ae('0x2a')](handleError(_0x1c4ea8,null));};exports['removeTags']=function(_0x49388d,_0xd75fe0){return db[_0xe7ae('0x20')]['find']({'where':{'id':_0x49388d['params']['id']}})[_0xe7ae('0x29')](handleEntityNotFound(_0xd75fe0,null))[_0xe7ae('0x29')](function(_0x429996){if(_0x429996){return _0x429996[_0xe7ae('0x56')](_0x49388d[_0xe7ae('0x27')][_0xe7ae('0x3d')]);}})['then'](respondWithStatusCode(_0xd75fe0,null))[_0xe7ae('0x2a')](handleError(_0xd75fe0,null));};exports[_0xe7ae('0x57')]=function(_0x21b67f,_0x144f1b){var _0x42273c=moment()['unix']()[_0xe7ae('0x58')]();var _0x2ff696=path['join'](config[_0xe7ae('0x59')],_0xe7ae('0x5a'),_0xe7ae('0x5b'),_0xe7ae('0x5c'));var _0x49d1f2=path[_0xe7ae('0x5d')](_0x2ff696,_0x42273c);var _0x16be68=util[_0xe7ae('0x4b')](_0xe7ae('0x5e'),_0x21b67f[_0xe7ae('0x2c')]['id'],_0x42273c);var _0x424c25=path[_0xe7ae('0x5d')](_0x2ff696,_0x16be68);var _0x272e9d=[];_0x272e9d[_0xe7ae('0x5f')]({'model':db['User'],'as':_0xe7ae('0x60'),'attributes':['id',_0xe7ae('0x61')],'raw':!![]});_0x272e9d[_0xe7ae('0x5f')]({'model':db[_0xe7ae('0x62')],'as':_0xe7ae('0x63'),'attributes':['id','firstName',_0xe7ae('0x64')],'raw':!![]});var _0xd52453=[{'model':db['SmsMessage'],'as':_0xe7ae('0x65'),'attributes':['id','body',_0xe7ae('0x66'),'direction','secret',_0xe7ae('0x67')],'include':_0x272e9d}];_0xd52453[_0xe7ae('0x5f')]({'model':db['SmsAccount'],'as':_0xe7ae('0x68'),'attributes':['id',_0xe7ae('0x1d')]});_0xd52453[_0xe7ae('0x5f')]({'model':db[_0xe7ae('0x60')],'as':'Owner','attributes':['id',_0xe7ae('0x61')]});return db[_0xe7ae('0x20')]['find']({'where':{'id':_0x21b67f['params']['id']},'include':_0xd52453})[_0xe7ae('0x29')](handleEntityNotFound(_0x144f1b,null))[_0xe7ae('0x29')](function(_0x56fb32){if(_0x56fb32){var _0x38d9a1=_0x56fb32[_0xe7ae('0x69')]({'plain':!![]});fs[_0xe7ae('0x6a')](_0x49d1f2);var _0x13aece={'channel':_0xe7ae('0x6b'),'account':_0x38d9a1[_0xe7ae('0x68')]['name'],'agent':_0x38d9a1[_0xe7ae('0x6c')]?_0x38d9a1[_0xe7ae('0x6c')]['fullname']:'N.A.','createdAt':moment(_0x38d9a1[_0xe7ae('0x66')])[_0xe7ae('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe7ae('0x58')](),'closedAt':_0x38d9a1[_0xe7ae('0x6d')]?moment(_0x38d9a1[_0xe7ae('0x6e')])[_0xe7ae('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x38d9a1[_0xe7ae('0x6f')],'messages':_(_0x38d9a1['Messages'])[_0xe7ae('0x48')]({'secret':![]})[_0xe7ae('0x1f')](function(_0x36d9e0){return{'date':moment(_0x36d9e0['createdAt'])[_0xe7ae('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe7ae('0x58')](),'sender':_0x36d9e0[_0xe7ae('0x70')]===_0xe7ae('0x71')?_0x36d9e0[_0xe7ae('0x60')]?_0x36d9e0[_0xe7ae('0x60')][_0xe7ae('0x61')]:_0xe7ae('0x72'):_0x36d9e0[_0xe7ae('0x63')][_0xe7ae('0x73')]+(_0x36d9e0[_0xe7ae('0x63')][_0xe7ae('0x64')]?'\x20'+_0x36d9e0[_0xe7ae('0x63')][_0xe7ae('0x64')]:''),'body':_0x36d9e0[_0xe7ae('0x38')],'direction':_0x36d9e0['direction']==='out'?'A':'C','secret':_0x36d9e0[_0xe7ae('0x74')],'read':_0x36d9e0[_0xe7ae('0x67')]};})[_0xe7ae('0x75')]()};return ejs[_0xe7ae('0x76')](path['join'](config[_0xe7ae('0x59')],'server',_0xe7ae('0x77'),_0xe7ae('0x78')),{'interaction':_0x13aece})[_0xe7ae('0x29')](function(_0x2442f6){var _0x4f7edd=path[_0xe7ae('0x5d')](_0x49d1f2,'transcript-'+_0x38d9a1['id']+'-'+_0x42273c+_0xe7ae('0x79'));var _0x448a79={'path':_0x4f7edd,'channel':_0xe7ae('0x6b'),'interactionId':_0x38d9a1['id']};return pdf[_0xe7ae('0x7a')](_0x2442f6,_0x448a79);})['then'](function(){return new BPromise(function(_0xc91b62,_0x159e4b){zipdir(_0x49d1f2,{'saveTo':_0x424c25},function(_0x104c26,_0x277967){if(_0x104c26)return _0x159e4b(_0x104c26);return _0xc91b62(_0x277967);});})[_0xe7ae('0x29')](function(){return new BPromise(function(_0x1f8371,_0x3a63cd){rimraf(_0x49d1f2,function(_0xcd0bd2){if(_0xcd0bd2)_0x3a63cd(_0xcd0bd2);return _0x1f8371();});});})[_0xe7ae('0x29')](function(){return _0x144f1b[_0xe7ae('0x57')](_0x424c25,_0x16be68,function(_0x472fe7){if(_0x472fe7){console[_0xe7ae('0x7b')]('err',_0x472fe7);}else{fs[_0xe7ae('0x7c')](_0x424c25);}});});});}else{return _0x144f1b[_0xe7ae('0x13')](0xc8);}})['catch'](handleError(_0x144f1b,null));}; \ No newline at end of file +var _0xd609=['join','User','fullname','push','CmContact','Contact','lastName','createdAt','direction','secret','SmsAccount','Owner','get','Sms','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','out','System','firstName','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','bluebird','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./smsInteraction.socket','register','sendStatus','offset','limit','count','status','set','Content-Range','json','update','then','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','body','destroy','describe','SmsMessage','addMessage','ids','getMessages','findOne','nolimit','order','sort','where','pick','filter','$gte','format','rows','addTags','setTags','spread','Tag','color','smsInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','transcript-%d-%s.zip'];(function(_0x27a550,_0x34f870){var _0x103438=function(_0x720be8){while(--_0x720be8){_0x27a550['push'](_0x27a550['shift']());}};_0x103438(++_0x34f870);}(_0xd609,0x184));var _0x9d60=function(_0x34b50a,_0x5eec80){_0x34b50a=_0x34b50a-0x0;var _0x1e692b=_0xd609[_0x34b50a];return _0x1e692b;};'use strict';var rimraf=require(_0x9d60('0x0'));var zipdir=require(_0x9d60('0x1'));var moment=require('moment');var BPromise=require(_0x9d60('0x2'));var util=require('util');var path=require('path');var ejs=require(_0x9d60('0x3'));var fs=require('fs');var _=require(_0x9d60('0x4'));var Redis=require(_0x9d60('0x5'));var interaction=require(_0x9d60('0x6'));var qs=require(_0x9d60('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x9d60('0x8'))(_0x9d60('0x9'));var config=require(_0x9d60('0xa'));var db=require(_0x9d60('0xb'))['db'];config[_0x9d60('0xc')]=_[_0x9d60('0xd')](config[_0x9d60('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d60('0xc')]));require(_0x9d60('0xe'))[_0x9d60('0xf')](socket);function respondWithStatusCode(_0x4b57af,_0x4b16a1){_0x4b16a1=_0x4b16a1||0xcc;return function(_0x2de4ea){if(_0x2de4ea){return _0x4b57af[_0x9d60('0x10')](_0x4b16a1);}return _0x4b57af['status'](_0x4b16a1)['end']();};}function respondWithResult(_0x5cc0e5,_0x5c9dd6){_0x5c9dd6=_0x5c9dd6||0xc8;return function(_0x1703ee){if(_0x1703ee){return _0x5cc0e5['status'](_0x5c9dd6)['json'](_0x1703ee);}};}function respondWithFilteredResult(_0x47bfc5,_0x2dc3b0){return function(_0x1f1ee9){if(_0x1f1ee9){var _0xba0d69=typeof _0x2dc3b0[_0x9d60('0x11')]==='undefined'&&typeof _0x2dc3b0[_0x9d60('0x12')]==='undefined';var _0x237067=_0x1f1ee9[_0x9d60('0x13')];var _0x1f157e=_0xba0d69?0x0:_0x2dc3b0['offset'];var _0x5041db=_0xba0d69?_0x1f1ee9[_0x9d60('0x13')]:_0x2dc3b0[_0x9d60('0x11')]+_0x2dc3b0['limit'];var _0x3787a3;if(_0x5041db>=_0x237067){_0x5041db=_0x237067;_0x3787a3=0xc8;}else{_0x3787a3=0xce;}_0x47bfc5[_0x9d60('0x14')](_0x3787a3);return _0x47bfc5[_0x9d60('0x15')](_0x9d60('0x16'),_0x1f157e+'-'+_0x5041db+'/'+_0x237067)[_0x9d60('0x17')](_0x1f1ee9);}return null;};}function saveUpdates(_0x5f2b1d){return function(_0x5c83e9){if(_0x5c83e9){return _0x5c83e9[_0x9d60('0x18')](_0x5f2b1d)[_0x9d60('0x19')](function(_0x3870dd){return _0x3870dd;});}return null;};}function removeEntity(_0x4e7a1c){return function(_0x144062){if(_0x144062){return _0x144062['destroy']()[_0x9d60('0x19')](function(){_0x4e7a1c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c5fc0){return function(_0x43de97){if(!_0x43de97){_0x4c5fc0['sendStatus'](0x194);}return _0x43de97;};}function handleError(_0x544918,_0x575e24){_0x575e24=_0x575e24||0x1f4;return function(_0x1d6b02){logger['error'](_0x1d6b02[_0x9d60('0x1a')]);if(_0x1d6b02['name']){delete _0x1d6b02[_0x9d60('0x1b')];}_0x544918[_0x9d60('0x14')](_0x575e24)[_0x9d60('0x1c')](_0x1d6b02);};}exports[_0x9d60('0x1d')]=function(_0x5cd7b6,_0x420580){var _0xcfe926={};var _0x5db34a=_[_0x9d60('0x1e')](db[_0x9d60('0x1f')][_0x9d60('0x20')],function(_0x4a92ae){return{'name':_0x4a92ae[_0x9d60('0x21')],'type':_0x4a92ae[_0x9d60('0x22')][_0x9d60('0x23')]};});_0xcfe926=qs[_0x9d60('0x24')](_0x5db34a,_0x5cd7b6);return interaction[_0x9d60('0x25')](_0x9d60('0x26'),_0x5cd7b6[_0x9d60('0x27')],_0x5cd7b6[_0x9d60('0x28')],_0xcfe926,_0x5db34a)[_0x9d60('0x19')](respondWithFilteredResult(_0x420580,_0xcfe926))[_0x9d60('0x29')](handleError(_0x420580,null));};exports[_0x9d60('0x2a')]=function(_0x2d6460,_0x5ce64a){var _0x493305={'raw':![],'where':{'id':_0x2d6460[_0x9d60('0x2b')]['id']}},_0x477050={};_0x477050[_0x9d60('0x2c')]=_[_0x9d60('0x2d')](db['SmsInteraction'][_0x9d60('0x20')]);_0x477050[_0x9d60('0x27')]=_['keys'](_0x2d6460[_0x9d60('0x27')]);_0x477050[_0x9d60('0x2e')]=_[_0x9d60('0x2f')](_0x477050[_0x9d60('0x2c')],_0x477050[_0x9d60('0x27')]);_0x493305[_0x9d60('0x30')]=_[_0x9d60('0x2f')](_0x477050[_0x9d60('0x2c')],qs[_0x9d60('0x31')](_0x2d6460['query'][_0x9d60('0x31')]));_0x493305[_0x9d60('0x30')]=_0x493305[_0x9d60('0x30')][_0x9d60('0x32')]?_0x493305[_0x9d60('0x30')]:_0x477050[_0x9d60('0x2c')];if(_0x2d6460['query'][_0x9d60('0x33')]){_0x493305[_0x9d60('0x34')]=[{'all':!![]}];}_0x493305=_[_0x9d60('0x35')]({},_0x493305,_0x2d6460[_0x9d60('0x36')]);return db[_0x9d60('0x1f')][_0x9d60('0x37')](_0x493305)['then'](handleEntityNotFound(_0x5ce64a,null))[_0x9d60('0x19')](respondWithResult(_0x5ce64a,null))[_0x9d60('0x29')](handleError(_0x5ce64a,null));};exports['create']=function(_0x34e28e,_0x21059e){return db['SmsInteraction']['create'](_0x34e28e[_0x9d60('0x38')],{})[_0x9d60('0x19')](respondWithResult(_0x21059e,0xc9))['catch'](handleError(_0x21059e,null));};exports[_0x9d60('0x18')]=function(_0x494bfb,_0x18e2b0){if(_0x494bfb['body']['id']){delete _0x494bfb[_0x9d60('0x38')]['id'];}return db[_0x9d60('0x1f')]['find']({'where':{'id':_0x494bfb['params']['id']}})[_0x9d60('0x19')](handleEntityNotFound(_0x18e2b0,null))[_0x9d60('0x19')](saveUpdates(_0x494bfb[_0x9d60('0x38')],null))[_0x9d60('0x19')](respondWithResult(_0x18e2b0,null))[_0x9d60('0x29')](handleError(_0x18e2b0,null));};exports[_0x9d60('0x39')]=function(_0x51ee8e,_0x3bb53d){return db[_0x9d60('0x1f')][_0x9d60('0x37')]({'where':{'id':_0x51ee8e['params']['id']}})['then'](handleEntityNotFound(_0x3bb53d,null))[_0x9d60('0x19')](removeEntity(_0x3bb53d,null))[_0x9d60('0x29')](handleError(_0x3bb53d,null));};exports[_0x9d60('0x3a')]=function(_0x247cfd,_0x5d211e){return db[_0x9d60('0x1f')]['describe']()[_0x9d60('0x19')](respondWithResult(_0x5d211e,null))[_0x9d60('0x29')](handleError(_0x5d211e,null));};exports['addMessage']=function(_0x598572,_0x498161){return db[_0x9d60('0x3b')][_0x9d60('0x37')]({'where':{'id':_0x598572[_0x9d60('0x2b')]['id']}})[_0x9d60('0x19')](handleEntityNotFound(_0x498161,null))[_0x9d60('0x19')](function(_0x42378f){if(_0x42378f){return _0x42378f[_0x9d60('0x3c')](_0x598572[_0x9d60('0x38')][_0x9d60('0x3d')],_['omit'](_0x598572[_0x9d60('0x38')],['ids','id'])||{});}})[_0x9d60('0x19')](respondWithResult(_0x498161,null))[_0x9d60('0x29')](handleError(_0x498161,null));};exports[_0x9d60('0x3e')]=function(_0x414d38,_0x512d58){var _0x29a2ab={'raw':![],'where':{}};var _0x2b782c={};var _0x2dfd72={'count':0x0,'rows':[]};return db[_0x9d60('0x1f')][_0x9d60('0x3f')]({'where':{'id':_0x414d38[_0x9d60('0x2b')]['id']}})[_0x9d60('0x19')](handleEntityNotFound(_0x512d58,null))[_0x9d60('0x19')](function(_0x288520){if(_0x288520){_0x2b782c['model']=_[_0x9d60('0x2d')](db[_0x9d60('0x3b')]['rawAttributes']);_0x2b782c[_0x9d60('0x27')]=_[_0x9d60('0x2d')](_0x414d38[_0x9d60('0x27')]);_0x2b782c['filters']=_[_0x9d60('0x2f')](_0x2b782c[_0x9d60('0x2c')],_0x2b782c['query']);_0x29a2ab[_0x9d60('0x30')]=_[_0x9d60('0x2f')](_0x2b782c[_0x9d60('0x2c')],qs[_0x9d60('0x31')](_0x414d38[_0x9d60('0x27')][_0x9d60('0x31')]));_0x29a2ab[_0x9d60('0x30')]=_0x29a2ab['attributes'][_0x9d60('0x32')]?_0x29a2ab['attributes']:_0x2b782c[_0x9d60('0x2c')];if(!_0x414d38['query']['hasOwnProperty'](_0x9d60('0x40'))){_0x29a2ab[_0x9d60('0x12')]=qs['limit'](_0x414d38['query'][_0x9d60('0x12')]);_0x29a2ab[_0x9d60('0x11')]=qs[_0x9d60('0x11')](_0x414d38[_0x9d60('0x27')]['offset']);}_0x29a2ab[_0x9d60('0x41')]=qs[_0x9d60('0x42')](_0x414d38[_0x9d60('0x27')][_0x9d60('0x42')]);_0x29a2ab[_0x9d60('0x43')]=qs[_0x9d60('0x2e')](_[_0x9d60('0x44')](_0x414d38[_0x9d60('0x27')],_0x2b782c['filters']));_0x29a2ab[_0x9d60('0x43')]['SmsInteractionId']=_0x288520['id'];if(_0x414d38[_0x9d60('0x27')][_0x9d60('0x45')]){_0x29a2ab[_0x9d60('0x43')]=_[_0x9d60('0x35')](_0x29a2ab[_0x9d60('0x43')],{'$or':_[_0x9d60('0x1e')](_0x29a2ab['attributes'],function(_0x4d0ca1){var _0x37ade6={};_0x37ade6[_0x4d0ca1]={'$like':'%'+_0x414d38[_0x9d60('0x27')][_0x9d60('0x45')]+'%'};return _0x37ade6;})});}if(_0x414d38[_0x9d60('0x27')][_0x9d60('0x46')]){var _0x109245=_0x414d38['query'][_0x9d60('0x46')]['split'](',');var _0x1b8a97={};_0x1b8a97[_0x109245[0x0]]={'$gte':moment(_0x109245[0x1])[_0x9d60('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x29a2ab[_0x9d60('0x43')]=_[_0x9d60('0x35')](_0x29a2ab[_0x9d60('0x43')],_0x1b8a97);}_0x29a2ab=_['merge']({},_0x29a2ab,_0x414d38['options']);return db[_0x9d60('0x3b')][_0x9d60('0x13')]({'where':_0x29a2ab[_0x9d60('0x43')]})[_0x9d60('0x19')](function(_0x210803){_0x2dfd72[_0x9d60('0x13')]=_0x210803;if(_0x414d38['query'][_0x9d60('0x33')]){_0x29a2ab[_0x9d60('0x34')]=[{'all':!![]}];}return db[_0x9d60('0x3b')][_0x9d60('0x25')](_0x29a2ab);})[_0x9d60('0x19')](function(_0x22bfb4){_0x2dfd72[_0x9d60('0x48')]=_0x22bfb4;return _0x2dfd72;});}})[_0x9d60('0x19')](respondWithFilteredResult(_0x512d58,_0x29a2ab))[_0x9d60('0x29')](handleError(_0x512d58,null));};exports[_0x9d60('0x49')]=function(_0x3dca1d,_0xb33bde){return db['SmsInteraction']['find']({'where':{'id':_0x3dca1d[_0x9d60('0x2b')]['id']}})[_0x9d60('0x19')](handleEntityNotFound(_0xb33bde,null))[_0x9d60('0x19')](function(_0x1e4f44){if(_0x1e4f44){return _0x1e4f44[_0x9d60('0x4a')](_0x3dca1d[_0x9d60('0x38')][_0x9d60('0x3d')],_['omit'](_0x3dca1d[_0x9d60('0x38')],[_0x9d60('0x3d'),'id'])||{})[_0x9d60('0x4b')](function(){return db[_0x9d60('0x4c')][_0x9d60('0x25')]({'attributes':['id',_0x9d60('0x1b'),_0x9d60('0x4d')],'where':{'id':_0x3dca1d[_0x9d60('0x38')][_0x9d60('0x3d')]}});})['then'](function(_0xaf3ccf){socket['emit'](_0x9d60('0x4e'),{'id':Number(_0x3dca1d['params']['id']),'tags':_0xaf3ccf||[]});return{'id':Number(_0x3dca1d[_0x9d60('0x2b')]['id']),'tags':_0xaf3ccf||[]};});}})['then'](respondWithResult(_0xb33bde,null))[_0x9d60('0x29')](handleError(_0xb33bde,null));};exports[_0x9d60('0x4f')]=function(_0x53d8ef,_0x169136){return db[_0x9d60('0x1f')][_0x9d60('0x37')]({'where':{'id':_0x53d8ef[_0x9d60('0x2b')]['id']}})[_0x9d60('0x19')](handleEntityNotFound(_0x169136,null))[_0x9d60('0x19')](function(_0x3537d2){if(_0x3537d2){return _0x3537d2['removeTags'](_0x53d8ef[_0x9d60('0x27')][_0x9d60('0x3d')]);}})[_0x9d60('0x19')](respondWithStatusCode(_0x169136,null))[_0x9d60('0x29')](handleError(_0x169136,null));};exports[_0x9d60('0x50')]=function(_0x5483ba,_0x54c23b){var _0x531da7=moment()[_0x9d60('0x51')]()[_0x9d60('0x52')]();var _0x3ecff7=path['join'](config[_0x9d60('0x53')],_0x9d60('0x54'),_0x9d60('0x55'),_0x9d60('0x56'));var _0x453f2c=path['join'](_0x3ecff7,_0x531da7);var _0x5cf6e6=util[_0x9d60('0x47')](_0x9d60('0x57'),_0x5483ba[_0x9d60('0x2b')]['id'],_0x531da7);var _0x535438=path[_0x9d60('0x58')](_0x3ecff7,_0x5cf6e6);var _0x252d85=[];_0x252d85['push']({'model':db[_0x9d60('0x59')],'as':_0x9d60('0x59'),'attributes':['id',_0x9d60('0x5a')],'raw':!![]});_0x252d85[_0x9d60('0x5b')]({'model':db[_0x9d60('0x5c')],'as':_0x9d60('0x5d'),'attributes':['id','firstName',_0x9d60('0x5e')],'raw':!![]});var _0x4d41df=[{'model':db[_0x9d60('0x3b')],'as':'Messages','attributes':['id',_0x9d60('0x38'),_0x9d60('0x5f'),_0x9d60('0x60'),_0x9d60('0x61'),'read'],'include':_0x252d85}];_0x4d41df[_0x9d60('0x5b')]({'model':db[_0x9d60('0x62')],'as':'Account','attributes':['id',_0x9d60('0x1b')]});_0x4d41df[_0x9d60('0x5b')]({'model':db[_0x9d60('0x59')],'as':_0x9d60('0x63'),'attributes':['id',_0x9d60('0x5a')]});return db[_0x9d60('0x1f')][_0x9d60('0x37')]({'where':{'id':_0x5483ba[_0x9d60('0x2b')]['id']},'include':_0x4d41df})['then'](handleEntityNotFound(_0x54c23b,null))['then'](function(_0xc9bcf4){if(_0xc9bcf4){var _0x7f4d55=_0xc9bcf4[_0x9d60('0x64')]({'plain':!![]});fs['mkdirSync'](_0x453f2c);var _0x3650ee={'channel':_0x9d60('0x65'),'account':_0x7f4d55[_0x9d60('0x66')][_0x9d60('0x1b')],'agent':_0x7f4d55[_0x9d60('0x63')]?_0x7f4d55[_0x9d60('0x63')][_0x9d60('0x5a')]:_0x9d60('0x67'),'createdAt':moment(_0x7f4d55[_0x9d60('0x5f')])[_0x9d60('0x47')](_0x9d60('0x68'))[_0x9d60('0x52')](),'closedAt':_0x7f4d55['closed']?moment(_0x7f4d55[_0x9d60('0x69')])[_0x9d60('0x47')](_0x9d60('0x68'))['toString']():'','disposition':_0x7f4d55[_0x9d60('0x6a')],'messages':_(_0x7f4d55[_0x9d60('0x6b')])[_0x9d60('0x45')]({'secret':![]})[_0x9d60('0x1e')](function(_0x44c19d){return{'date':moment(_0x44c19d[_0x9d60('0x5f')])[_0x9d60('0x47')](_0x9d60('0x68'))[_0x9d60('0x52')](),'sender':_0x44c19d[_0x9d60('0x60')]===_0x9d60('0x6c')?_0x44c19d[_0x9d60('0x59')]?_0x44c19d['User'][_0x9d60('0x5a')]:_0x9d60('0x6d'):_0x44c19d[_0x9d60('0x5d')][_0x9d60('0x6e')]+(_0x44c19d[_0x9d60('0x5d')][_0x9d60('0x5e')]?'\x20'+_0x44c19d['Contact'][_0x9d60('0x5e')]:''),'body':_0x44c19d[_0x9d60('0x38')],'direction':_0x44c19d['direction']===_0x9d60('0x6c')?'A':'C','secret':_0x44c19d[_0x9d60('0x61')],'read':_0x44c19d['read']};})[_0x9d60('0x6f')]()};return ejs[_0x9d60('0x70')](path[_0x9d60('0x58')](config[_0x9d60('0x53')],_0x9d60('0x54'),_0x9d60('0x71'),_0x9d60('0x72')),{'interaction':_0x3650ee})[_0x9d60('0x19')](function(_0x415df9){var _0x48b989=path[_0x9d60('0x58')](_0x453f2c,'transcript-'+_0x7f4d55['id']+'-'+_0x531da7+_0x9d60('0x73'));var _0x3a8159={'path':_0x48b989,'channel':_0x9d60('0x65'),'interactionId':_0x7f4d55['id']};return pdf[_0x9d60('0x74')](_0x415df9,_0x3a8159);})['then'](function(){return new BPromise(function(_0x50d54a,_0x563b72){zipdir(_0x453f2c,{'saveTo':_0x535438},function(_0x32abcc,_0x1adbf9){if(_0x32abcc)return _0x563b72(_0x32abcc);return _0x50d54a(_0x1adbf9);});})[_0x9d60('0x19')](function(){return new BPromise(function(_0x551580,_0x26bd36){rimraf(_0x453f2c,function(_0x557085){if(_0x557085)_0x26bd36(_0x557085);return _0x551580();});});})[_0x9d60('0x19')](function(){return _0x54c23b[_0x9d60('0x50')](_0x535438,_0x5cf6e6,function(_0x394497){if(_0x394497){console[_0x9d60('0x75')](_0x9d60('0x76'),_0x394497);}else{fs['unlinkSync'](_0x535438);}});});});}else{return _0x54c23b[_0x9d60('0x10')](0xc8);}})[_0x9d60('0x29')](handleError(_0x54c23b,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 1833b0d..52284d9 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 _0xe5af=['findAll','unreadMessages','emit','catch','hasOwnProperty','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','remove','setDataValue','Users','map'];(function(_0x52478e,_0x39a4af){var _0x594803=function(_0x1b4b9d){while(--_0x1b4b9d){_0x52478e['push'](_0x52478e['shift']());}};_0x594803(++_0x39a4af);}(_0xe5af,0x9c));var _0xfe5a=function(_0x2f5a56,_0x221e13){_0x2f5a56=_0x2f5a56-0x0;var _0x96bd89=_0xe5af[_0x2f5a56];return _0x96bd89;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xfe5a('0x0'))['db'][_0xfe5a('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0xfe5a('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfe5a('0x3')](0x0);var events={'afterCreate':_0xfe5a('0x4'),'afterUpdate':'update','afterDestroy':_0xfe5a('0x5')};function emitEvent(_0x48e3a7){return function(_0x526677,_0x37455d,_0x2039cd){_0x526677['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x356c69){_0x526677[_0xfe5a('0x6')](_0xfe5a('0x7'),_0x356c69[_0xfe5a('0x8')](function(_0x5cd100){return{'id':_0x5cd100['id']};}));return SmsMessage[_0xfe5a('0x9')]({'where':{'SmsInteractionId':_0x526677['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x51718e){_0x526677[_0xfe5a('0x6')](_0xfe5a('0xa'),_0x51718e['length']);SmsInteractionEvents[_0xfe5a('0xb')](_0x48e3a7+':'+_0x526677['id'],_0x526677);SmsInteractionEvents[_0xfe5a('0xb')](_0x48e3a7,_0x526677);_0x2039cd(null);})[_0xfe5a('0xc')](_0x2039cd(null));};}for(var e in events){if(events[_0xfe5a('0xd')](e)){var event=events[e];SmsInteraction[_0xfe5a('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x065e=['emit','catch','hasOwnProperty','events','SmsMessage','setMaxListeners','save','getUsers','then','setDataValue','map','findAll','unreadMessages','length'];(function(_0x47ee7b,_0x2e40d5){var _0x17a0c1=function(_0x4da29b){while(--_0x4da29b){_0x47ee7b['push'](_0x47ee7b['shift']());}};_0x17a0c1(++_0x2e40d5);}(_0x065e,0x1a7));var _0xe065=function(_0x53bcf9,_0xea72ef){_0x53bcf9=_0x53bcf9-0x0;var _0x1365a6=_0x065e[_0x53bcf9];return _0x1365a6;};'use strict';var EventEmitter=require(_0xe065('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xe065('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xe065('0x2')](0x0);var events={'afterCreate':_0xe065('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4610a3){return function(_0x2f90aa,_0x5b099e,_0x10b45f){_0x2f90aa[_0xe065('0x4')]({'attributes':['id'],'raw':!![]})[_0xe065('0x5')](function(_0x52403a){_0x2f90aa[_0xe065('0x6')]('Users',_0x52403a[_0xe065('0x7')](function(_0x2f072e){return{'id':_0x2f072e['id']};}));return SmsMessage[_0xe065('0x8')]({'where':{'SmsInteractionId':_0x2f90aa['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe065('0x5')](function(_0x85001e){_0x2f90aa['setDataValue'](_0xe065('0x9'),_0x85001e[_0xe065('0xa')]);SmsInteractionEvents[_0xe065('0xb')](_0x4610a3+':'+_0x2f90aa['id'],_0x2f90aa);SmsInteractionEvents[_0xe065('0xb')](_0x4610a3,_0x2f90aa);_0x10b45f(null);})[_0xe065('0xc')](_0x10b45f(null));};}for(var e in events){if(events[_0xe065('0xd')](e)){var event=events[e];SmsInteraction['hook'](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 252ab77..b4bda83 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 _0x4adc=['path','rimraf','exports','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x4adc,0xfa));var _0xc4ad=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4adc[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0xc4ad('0x0'));var logger=require(_0xc4ad('0x1'))('api');var moment=require(_0xc4ad('0x2'));var BPromise=require(_0xc4ad('0x3'));var rp=require(_0xc4ad('0x4'));var fs=require('fs');var path=require(_0xc4ad('0x5'));var rimraf=require(_0xc4ad('0x6'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0xc4ad('0x7')]=function(_0x2867cf,_0x19bdd0){return _0x2867cf[_0xc4ad('0x8')](_0xc4ad('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2eee7f,_0x4a0f76,_0x31b895){if(_0x2eee7f[_0xc4ad('0xa')](_0xc4ad('0xb'))){_0x2eee7f[_0xc4ad('0xc')]=moment()[_0xc4ad('0xd')](_0xc4ad('0xe'));}_0x31b895(null,_0x2eee7f);}}});}; \ No newline at end of file +var _0x1d1b=['define','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes'];(function(_0x1e39f6,_0x40a8e9){var _0x431259=function(_0xecce3a){while(--_0xecce3a){_0x1e39f6['push'](_0x1e39f6['shift']());}};_0x431259(++_0x40a8e9);}(_0x1d1b,0x141));var _0xb1d1=function(_0x56b90e,_0x1a71c8){_0x56b90e=_0x56b90e-0x0;var _0x1b42d6=_0x1d1b[_0x56b90e];return _0x1b42d6;};'use strict';var _=require(_0xb1d1('0x0'));var util=require(_0xb1d1('0x1'));var logger=require(_0xb1d1('0x2'))('api');var moment=require(_0xb1d1('0x3'));var BPromise=require(_0xb1d1('0x4'));var rp=require(_0xb1d1('0x5'));var fs=require('fs');var path=require(_0xb1d1('0x6'));var rimraf=require('rimraf');var config=require(_0xb1d1('0x7'));var attributes=require(_0xb1d1('0x8'));module['exports']=function(_0x503648,_0x12dffa){return _0x503648[_0xb1d1('0x9')]('SmsInteraction',attributes,{'tableName':_0xb1d1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x343ac3,_0x3f2aea,_0x4fef4d){if(_0x343ac3[_0xb1d1('0xb')]('closed')){_0x343ac3[_0xb1d1('0xc')]=moment()[_0xb1d1('0xd')](_0xb1d1('0xe'));}_0x4fef4d(null,_0x343ac3);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 3a3290e..2198fc2 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 _0x0b2d=['limit','find','where','addTags','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw'];(function(_0x5dbf8b,_0x3d6875){var _0x1b11c1=function(_0x31597b){while(--_0x31597b){_0x5dbf8b['push'](_0x5dbf8b['shift']());}};_0x1b11c1(++_0x3d6875);}(_0x0b2d,0x136));var _0xd0b2=function(_0x14ec8f,_0x244232){_0x14ec8f=_0x14ec8f-0x0;var _0x5ce938=_0x0b2d[_0x14ec8f];return _0x5ce938;};'use strict';var _=require(_0xd0b2('0x0'));var util=require(_0xd0b2('0x1'));var moment=require('moment');var BPromise=require(_0xd0b2('0x2'));var rs=require(_0xd0b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0b2('0x4'))['db'];var utils=require(_0xd0b2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd0b2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd0b2('0x7')][_0xd0b2('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd0b2('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xd0b2('0xa'))(new Redis(config[_0xd0b2('0x9')]));require(_0xd0b2('0xb'))[_0xd0b2('0xc')](socket);function respondWithRpcPromise(_0x4bf427,_0x451215,_0x1f32c2){return new BPromise(function(_0x3b2c42,_0xc33653){return client[_0xd0b2('0xd')](_0x4bf427,_0x1f32c2)[_0xd0b2('0xe')](function(_0x19fdf1){logger[_0xd0b2('0xf')](_0xd0b2('0x10'),_0x451215,_0xd0b2('0x11'));logger[_0xd0b2('0x12')](_0xd0b2('0x13'),_0x451215,_0xd0b2('0x11'),JSON[_0xd0b2('0x14')](_0x19fdf1));if(_0x19fdf1[_0xd0b2('0x15')]){if(_0x19fdf1[_0xd0b2('0x15')][_0xd0b2('0x16')]===0x1f4){logger[_0xd0b2('0x15')](_0xd0b2('0x10'),_0x451215,_0x19fdf1[_0xd0b2('0x15')][_0xd0b2('0x17')]);return _0xc33653(_0x19fdf1[_0xd0b2('0x15')][_0xd0b2('0x17')]);}logger[_0xd0b2('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x451215,_0x19fdf1[_0xd0b2('0x15')][_0xd0b2('0x17')]);return _0x3b2c42(_0x19fdf1[_0xd0b2('0x15')][_0xd0b2('0x17')]);}else{logger[_0xd0b2('0xf')](_0xd0b2('0x10'),_0x451215,_0xd0b2('0x11'));_0x3b2c42(_0x19fdf1[_0xd0b2('0x18')]['message']);}})[_0xd0b2('0x19')](function(_0x5097b6){logger[_0xd0b2('0x15')](_0xd0b2('0x10'),_0x451215,_0x5097b6);_0xc33653(_0x5097b6);});});}exports[_0xd0b2('0x1a')]=function(_0x36bcbd){var _0x253866=this;return new Promise(function(_0x49aedb,_0x533657){return db[_0xd0b2('0x1b')][_0xd0b2('0x1c')](_0x36bcbd[_0xd0b2('0x1d')],{'raw':_0x36bcbd[_0xd0b2('0x1e')]?_0x36bcbd[_0xd0b2('0x1e')][_0xd0b2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36bcbd['options']?_0x36bcbd[_0xd0b2('0x1e')]['where']||null:null,'attributes':_0x36bcbd['options']?_0x36bcbd[_0xd0b2('0x1e')]['attributes']||null:null,'limit':_0x36bcbd[_0xd0b2('0x1e')]?_0x36bcbd[_0xd0b2('0x1e')][_0xd0b2('0x20')]||null:null})[_0xd0b2('0xe')](function(_0x6e4a0){logger[_0xd0b2('0xf')](_0xd0b2('0x1a'),_0x36bcbd);logger['debug'](_0xd0b2('0x1a'),_0x36bcbd,JSON['stringify'](_0x6e4a0));_0x49aedb(_0x6e4a0);})[_0xd0b2('0x19')](function(_0x3d78b6){logger[_0xd0b2('0x15')](_0xd0b2('0x1a'),_0x3d78b6['message'],_0x36bcbd);_0x533657(_0x253866[_0xd0b2('0x15')](0x1f4,_0x3d78b6['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x3b29b9){return new Promise(function(_0x514cde,_0x21e9eb){return db[_0xd0b2('0x1b')][_0xd0b2('0x21')]({'where':_0x3b29b9['options']?_0x3b29b9[_0xd0b2('0x1e')][_0xd0b2('0x22')]||null:null})['then'](function(_0x4dcd98){if(_0x4dcd98){return _0x4dcd98[_0xd0b2('0x23')](_0x3b29b9[_0xd0b2('0x1d')]['ids'],_['omit'](_0x3b29b9[_0xd0b2('0x1d')],['ids','id'])||{});}})[_0xd0b2('0x24')](function(_0x53962b){logger[_0xd0b2('0xf')](_0xd0b2('0x25'),_0x3b29b9);logger[_0xd0b2('0x12')](_0xd0b2('0x25'),_0x3b29b9,JSON['stringify'](_0x53962b));_0x514cde(_0x53962b);})[_0xd0b2('0x19')](function(_0x27407f){logger['error']('AddTags',_0x27407f['message'],_0x3b29b9);_0x21e9eb(_this[_0xd0b2('0x15')](0x1f4,_0x27407f['message']));});});}; \ No newline at end of file +var _0x92fa=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','AddTagsToSmsInteraction','addTags','ids','omit','spread','AddTags','stringify'];(function(_0x19edef,_0x51f611){var _0x336c95=function(_0x4b92f3){while(--_0x4b92f3){_0x19edef['push'](_0x19edef['shift']());}};_0x336c95(++_0x51f611);}(_0x92fa,0x1ae));var _0xa92f=function(_0x36d086,_0x49a157){_0x36d086=_0x36d086-0x0;var _0x3f2c1f=_0x92fa[_0x36d086];return _0x3f2c1f;};'use strict';var _=require(_0xa92f('0x0'));var util=require(_0xa92f('0x1'));var moment=require('moment');var BPromise=require(_0xa92f('0x2'));var rs=require(_0xa92f('0x3'));var fs=require('fs');var Redis=require(_0xa92f('0x4'));var db=require(_0xa92f('0x5'))['db'];var utils=require(_0xa92f('0x6'));var logger=require(_0xa92f('0x7'))(_0xa92f('0x8'));var config=require(_0xa92f('0x9'));var jayson=require(_0xa92f('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xa92f('0xb')]=_[_0xa92f('0xc')](config[_0xa92f('0xb')],{'host':_0xa92f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa92f('0xb')]));require(_0xa92f('0xe'))[_0xa92f('0xf')](socket);function respondWithRpcPromise(_0x370b07,_0x468267,_0x239114){return new BPromise(function(_0x5f34f2,_0x5f6816){return client[_0xa92f('0x10')](_0x370b07,_0x239114)[_0xa92f('0x11')](function(_0x5d6289){logger[_0xa92f('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x468267,'request\x20sent');logger[_0xa92f('0x13')](_0xa92f('0x14'),_0x468267,_0xa92f('0x15'),JSON['stringify'](_0x5d6289));if(_0x5d6289['error']){if(_0x5d6289[_0xa92f('0x16')][_0xa92f('0x17')]===0x1f4){logger[_0xa92f('0x16')](_0xa92f('0x18'),_0x468267,_0x5d6289[_0xa92f('0x16')]['message']);return _0x5f6816(_0x5d6289[_0xa92f('0x16')][_0xa92f('0x19')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x468267,_0x5d6289[_0xa92f('0x16')][_0xa92f('0x19')]);return _0x5f34f2(_0x5d6289['error'][_0xa92f('0x19')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x468267,_0xa92f('0x15'));_0x5f34f2(_0x5d6289[_0xa92f('0x1a')][_0xa92f('0x19')]);}})[_0xa92f('0x1b')](function(_0x3f584e){logger[_0xa92f('0x16')](_0xa92f('0x18'),_0x468267,_0x3f584e);_0x5f6816(_0x3f584e);});});}exports[_0xa92f('0x1c')]=function(_0x5bd832){var _0x2ddb3f=this;return new Promise(function(_0x5273e0,_0x9909aa){return db[_0xa92f('0x1d')][_0xa92f('0x1e')](_0x5bd832[_0xa92f('0x1f')],{'raw':_0x5bd832['options']?_0x5bd832[_0xa92f('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bd832['options']?_0x5bd832[_0xa92f('0x20')][_0xa92f('0x21')]||null:null,'attributes':_0x5bd832[_0xa92f('0x20')]?_0x5bd832[_0xa92f('0x20')][_0xa92f('0x22')]||null:null,'limit':_0x5bd832[_0xa92f('0x20')]?_0x5bd832[_0xa92f('0x20')][_0xa92f('0x23')]||null:null})['then'](function(_0x3bb233){logger[_0xa92f('0x12')](_0xa92f('0x1c'),_0x5bd832);logger[_0xa92f('0x13')](_0xa92f('0x1c'),_0x5bd832,JSON['stringify'](_0x3bb233));_0x5273e0(_0x3bb233);})[_0xa92f('0x1b')](function(_0x451b73){logger['error'](_0xa92f('0x1c'),_0x451b73[_0xa92f('0x19')],_0x5bd832);_0x9909aa(_0x2ddb3f['error'](0x1f4,_0x451b73[_0xa92f('0x19')]));});});};exports[_0xa92f('0x24')]=function(_0x40dc95){return new Promise(function(_0x1d4a2c,_0x18e4e8){return db[_0xa92f('0x1d')]['find']({'where':_0x40dc95[_0xa92f('0x20')]?_0x40dc95[_0xa92f('0x20')][_0xa92f('0x21')]||null:null})[_0xa92f('0x11')](function(_0xe40ded){if(_0xe40ded){return _0xe40ded[_0xa92f('0x25')](_0x40dc95[_0xa92f('0x1f')][_0xa92f('0x26')],_[_0xa92f('0x27')](_0x40dc95['body'],[_0xa92f('0x26'),'id'])||{});}})[_0xa92f('0x28')](function(_0x2f5a17){logger['info']('AddTags',_0x40dc95);logger[_0xa92f('0x13')](_0xa92f('0x29'),_0x40dc95,JSON[_0xa92f('0x2a')](_0x2f5a17));_0x1d4a2c(_0x2f5a17);})[_0xa92f('0x1b')](function(_0x1efbf0){logger[_0xa92f('0x16')](_0xa92f('0x29'),_0x1efbf0[_0xa92f('0x19')],_0x40dc95);_0x18e4e8(_this[_0xa92f('0x16')](0x1f4,_0x1efbf0['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index ae93508..96cc100 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 _0xaebf=['remove','update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x4f36d8,_0x14870b){var _0x5eab66=function(_0x2412e1){while(--_0x2412e1){_0x4f36d8['push'](_0x4f36d8['shift']());}};_0x5eab66(++_0x14870b);}(_0xaebf,0x7c));var _0xfaeb=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xaebf[_0x725b8e];return _0x43ac45;};'use strict';var SmsInteractionEvents=require(_0xfaeb('0x0'));var events=[_0xfaeb('0x1'),_0xfaeb('0x2'),_0xfaeb('0x3')];function createListener(_0x486bd6,_0x102fc3){return function(_0x31655f){_0x102fc3[_0xfaeb('0x4')](_0x486bd6,_0x31655f);};}function removeListener(_0x4e877f,_0x23768c){return function(){SmsInteractionEvents[_0xfaeb('0x5')](_0x4e877f,_0x23768c);};}exports[_0xfaeb('0x6')]=function(_0x1242c8){for(var _0x5d1084=0x0,_0x369b2d=events[_0xfaeb('0x7')];_0x5d1084<_0x369b2d;_0x5d1084++){var _0x53390b=events[_0x5d1084];var _0x550140=createListener(_0xfaeb('0x8')+_0x53390b,_0x1242c8);SmsInteractionEvents['on'](_0x53390b,_0x550140);}}; \ No newline at end of file +var _0x3fc9=['removeListener','register','length','./smsInteraction.events','save','update'];(function(_0x57fd40,_0x9de24f){var _0x52bb76=function(_0x55f232){while(--_0x55f232){_0x57fd40['push'](_0x57fd40['shift']());}};_0x52bb76(++_0x9de24f);}(_0x3fc9,0x9f));var _0x93fc=function(_0x687ce7,_0x39db4f){_0x687ce7=_0x687ce7-0x0;var _0x8bb835=_0x3fc9[_0x687ce7];return _0x8bb835;};'use strict';var SmsInteractionEvents=require(_0x93fc('0x0'));var events=[_0x93fc('0x1'),'remove',_0x93fc('0x2')];function createListener(_0x2b708e,_0x1ae014){return function(_0x32b78c){_0x1ae014['emit'](_0x2b708e,_0x32b78c);};}function removeListener(_0x46d87c,_0x1ab774){return function(){SmsInteractionEvents[_0x93fc('0x3')](_0x46d87c,_0x1ab774);};}exports[_0x93fc('0x4')]=function(_0x35fb8b){for(var _0x34f599=0x0,_0x3e8ffb=events[_0x93fc('0x5')];_0x34f599<_0x3e8ffb;_0x34f599++){var _0x5d3d9c=events[_0x34f599];var _0x3719d9=createListener('smsInteraction:'+_0x5d3d9c,_0x35fb8b);SmsInteractionEvents['on'](_0x5d3d9c,_0x3719d9);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index f2d0266..54200be 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 _0x5d9d=['update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','show','sms','create','post','status','put','/:id'];(function(_0x2bf8fa,_0x511ab7){var _0x368b70=function(_0x9a45cd){while(--_0x9a45cd){_0x2bf8fa['push'](_0x2bf8fa['shift']());}};_0x368b70(++_0x511ab7);}(_0x5d9d,0xcc));var _0xd5d9=function(_0x509012,_0x4de0ef){_0x509012=_0x509012-0x0;var _0x1f02ed=_0x5d9d[_0x509012];return _0x1f02ed;};'use strict';var multer=require('multer');var util=require(_0xd5d9('0x0'));var path=require(_0xd5d9('0x1'));var timeout=require(_0xd5d9('0x2'));var express=require(_0xd5d9('0x3'));var router=express[_0xd5d9('0x4')]();var fs_extra=require(_0xd5d9('0x5'));var auth=require(_0xd5d9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd5d9('0x7'));router['get']('/',auth[_0xd5d9('0x8')](),controller[_0xd5d9('0x9')]);router[_0xd5d9('0xa')](_0xd5d9('0xb'),auth[_0xd5d9('0x8')](),controller[_0xd5d9('0xc')]);router[_0xd5d9('0xa')]('/:id',auth[_0xd5d9('0x8')](),controller[_0xd5d9('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xd5d9('0xe'),'smsmessage:create'),controller[_0xd5d9('0xf')]);router[_0xd5d9('0x10')]('/:id/status',controller[_0xd5d9('0x11')]);router[_0xd5d9('0x12')](_0xd5d9('0x13'),auth[_0xd5d9('0x8')](),controller[_0xd5d9('0x14')]);router[_0xd5d9('0x12')](_0xd5d9('0x15'),auth['isAuthenticated'](),controller[_0xd5d9('0x16')]);router[_0xd5d9('0x12')](_0xd5d9('0x17'),auth['isAuthenticated'](),controller[_0xd5d9('0x18')]);router[_0xd5d9('0x19')](_0xd5d9('0x13'),auth[_0xd5d9('0x8')](),controller[_0xd5d9('0x1a')]);module[_0xd5d9('0x1b')]=router; \ No newline at end of file +var _0xa8fd=['/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','tracked','sms','smsmessage:create','/:id/status','status','put','/:id/accept'];(function(_0x39c920,_0x70a7ee){var _0x585efe=function(_0x5b7ca6){while(--_0x5b7ca6){_0x39c920['push'](_0x39c920['shift']());}};_0x585efe(++_0x70a7ee);}(_0xa8fd,0x69));var _0xda8f=function(_0x11e6d5,_0x4f072b){_0x11e6d5=_0x11e6d5-0x0;var _0x44708f=_0xa8fd[_0x11e6d5];return _0x44708f;};'use strict';var multer=require('multer');var util=require(_0xda8f('0x0'));var path=require(_0xda8f('0x1'));var timeout=require(_0xda8f('0x2'));var express=require(_0xda8f('0x3'));var router=express[_0xda8f('0x4')]();var fs_extra=require(_0xda8f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xda8f('0x6'));var config=require(_0xda8f('0x7'));var controller=require('./smsMessage.controller');router[_0xda8f('0x8')]('/',auth[_0xda8f('0x9')](),controller[_0xda8f('0xa')]);router[_0xda8f('0x8')]('/describe',auth[_0xda8f('0x9')](),controller['describe']);router['get'](_0xda8f('0xb'),auth[_0xda8f('0x9')](),controller['show']);router[_0xda8f('0xc')]('/',auth[_0xda8f('0x9')](),interaction[_0xda8f('0xd')](_0xda8f('0xe'),_0xda8f('0xf')),controller['create']);router[_0xda8f('0xc')](_0xda8f('0x10'),controller[_0xda8f('0x11')]);router[_0xda8f('0x12')](_0xda8f('0xb'),auth[_0xda8f('0x9')](),controller['update']);router[_0xda8f('0x12')](_0xda8f('0x13'),auth[_0xda8f('0x9')](),controller['accept']);router[_0xda8f('0x12')](_0xda8f('0x14'),auth[_0xda8f('0x9')](),controller[_0xda8f('0x15')]);router[_0xda8f('0x16')](_0xda8f('0xb'),auth[_0xda8f('0x9')](),controller[_0xda8f('0x17')]);module[_0xda8f('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 72492eb..bc40e3c 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 _0x56a6=['STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium','out'];(function(_0x36da44,_0x8b7d9a){var _0x2fabb9=function(_0x6ba924){while(--_0x6ba924){_0x36da44['push'](_0x36da44['shift']());}};_0x2fabb9(++_0x8b7d9a);}(_0x56a6,0x17b));var _0x656a=function(_0x48c80a,_0x448629){_0x48c80a=_0x48c80a-0x0;var _0x33bb36=_0x56a6[_0x48c80a];return _0x33bb36;};'use strict';var Sequelize=require(_0x656a('0x0'));module[_0x656a('0x1')]={'body':{'type':Sequelize[_0x656a('0x2')](_0x656a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x656a('0x4')),'defaultValue':_0x656a('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x656a('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x656a('0x6')]},'secret':{'type':Sequelize[_0x656a('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x656a('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x255c=['DATE','sequelize','exports','BOOLEAN','ENUM','STRING'];(function(_0x17aa3e,_0x3a128b){var _0x124b1d=function(_0x43d94b){while(--_0x43d94b){_0x17aa3e['push'](_0x17aa3e['shift']());}};_0x124b1d(++_0x3a128b);}(_0x255c,0xfd));var _0xc255=function(_0xf9da0b,_0x2e3ee9){_0xf9da0b=_0xf9da0b-0x0;var _0xe5c7c7=_0x255c[_0xf9da0b];return _0xe5c7c7;};'use strict';var Sequelize=require(_0xc255('0x0'));module[_0xc255('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc255('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc255('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xc255('0x4')]},'readAt':{'type':Sequelize[_0xc255('0x5')]},'secret':{'type':Sequelize[_0xc255('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc255('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 9f02937..0bb144d 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 _0x28a6=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','params','describe','sms-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','SmsInteractionId','isNil','interaction','get','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT','format','EventManager','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','results','groupName','DELIVERED','infobip','rimraf','request-promise','bluebird','util','fs-extra','lodash','squel','crypto','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','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','status','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','end','sendStatus','stack','name','send','SmsMessage','rawAttributes','fieldName','type','model','map','query'];(function(_0x38b386,_0x308906){var _0x423c3f=function(_0x310e7e){while(--_0x310e7e){_0x38b386['push'](_0x38b386['shift']());}};_0x423c3f(++_0x308906);}(_0x28a6,0x166));var _0x628a=function(_0x403ca6,_0x24e284){_0x403ca6=_0x403ca6-0x0;var _0x4e0e05=_0x28a6[_0x403ca6];return _0x4e0e05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x628a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x628a('0x1'));var moment=require('moment');var BPromise=require(_0x628a('0x2'));var Mustache=require('mustache');var util=require(_0x628a('0x3'));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(_0x628a('0x4'));var _=require(_0x628a('0x5'));var squel=require(_0x628a('0x6'));var crypto=require(_0x628a('0x7'));var jsforce=require(_0x628a('0x8'));var deskjs=require(_0x628a('0x9'));var toCsv=require(_0x628a('0xa'));var querystring=require(_0x628a('0xb'));var Papa=require(_0x628a('0xc'));var Redis=require(_0x628a('0xd'));var authService=require(_0x628a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x628a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x628a('0x10'))(_0x628a('0x11'));var utils=require(_0x628a('0x12'));var config=require(_0x628a('0x13'));var licenseUtil=require(_0x628a('0x14'));var db=require(_0x628a('0x15'))['db'];config[_0x628a('0x16')]=_[_0x628a('0x17')](config[_0x628a('0x16')],{'host':_0x628a('0x18'),'port':0x18eb});var socket=require(_0x628a('0x19'))(new Redis(config['redis']));require(_0x628a('0x1a'))[_0x628a('0x1b')](socket);var jayson=require(_0x628a('0x1c'));var client=jayson[_0x628a('0x1d')][_0x628a('0x1e')]({'port':0x232c});var client9002=jayson[_0x628a('0x1d')][_0x628a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1d80d3,_0x206d2e,_0x448bf5,_0x484697){return new BPromise(function(_0x2fd9c8,_0x9bb72){var _0xf6b399=_0x484697||client;return _0xf6b399['request'](_0x1d80d3,_0x448bf5)[_0x628a('0x1f')](function(_0x3f709e){logger['info'](_0x628a('0x20'),_0x206d2e,'request\x20sent');logger[_0x628a('0x21')](_0x628a('0x22'),_0x206d2e,_0x628a('0x23'),JSON[_0x628a('0x24')](_0x3f709e));if(_0x3f709e[_0x628a('0x25')]){if(_0x3f709e[_0x628a('0x25')][_0x628a('0x26')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x206d2e,_0x3f709e['error'][_0x628a('0x27')]);return _0x9bb72(_0x3f709e['error'][_0x628a('0x27')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x206d2e,_0x3f709e[_0x628a('0x25')][_0x628a('0x27')]);return _0x2fd9c8(_0x3f709e[_0x628a('0x25')]['message']);}else{logger[_0x628a('0x28')](_0x628a('0x20'),_0x206d2e,'request\x20sent');_0x2fd9c8(_0x3f709e[_0x628a('0x29')][_0x628a('0x27')]);}})['catch'](function(_0x5004ad){logger[_0x628a('0x25')](_0x628a('0x20'),_0x206d2e,_0x5004ad);_0x9bb72(_0x5004ad);});});}function respondWithStatusCode(_0x58391b,_0x1637ae){_0x1637ae=_0x1637ae||0xcc;return function(_0x4c8024){if(_0x4c8024){return _0x58391b['sendStatus'](_0x1637ae);}return _0x58391b[_0x628a('0x2a')](_0x1637ae)['end']();};}function respondWithResult(_0x5cf9c4,_0x1d1419){_0x1d1419=_0x1d1419||0xc8;return function(_0x1dcfb0){if(_0x1dcfb0){return _0x5cf9c4[_0x628a('0x2a')](_0x1d1419)['json'](_0x1dcfb0);}};}function respondWithFilteredResult(_0x5a0564,_0x2a2ffc){return function(_0x13c155){if(_0x13c155){var _0x3200af=typeof _0x2a2ffc['offset']==='undefined'&&typeof _0x2a2ffc[_0x628a('0x2b')]==='undefined';var _0x81361a=_0x13c155[_0x628a('0x2c')];var _0x43931d=_0x3200af?0x0:_0x2a2ffc[_0x628a('0x2d')];var _0x48a2fa=_0x3200af?_0x13c155[_0x628a('0x2c')]:_0x2a2ffc[_0x628a('0x2d')]+_0x2a2ffc['limit'];var _0x45d324;if(_0x48a2fa>=_0x81361a){_0x48a2fa=_0x81361a;_0x45d324=0xc8;}else{_0x45d324=0xce;}_0x5a0564[_0x628a('0x2a')](_0x45d324);return _0x5a0564[_0x628a('0x2e')](_0x628a('0x2f'),_0x43931d+'-'+_0x48a2fa+'/'+_0x81361a)[_0x628a('0x30')](_0x13c155);}return null;};}function patchUpdates(_0x270de4){return function(_0x4020ff){try{jsonpatch[_0x628a('0x31')](_0x4020ff,_0x270de4,!![]);}catch(_0x3c1a55){return BPromise['reject'](_0x3c1a55);}return _0x4020ff[_0x628a('0x32')]();};}function saveUpdates(_0x16c7f2,_0x2d8828){return function(_0x5a974a){if(_0x5a974a){return _0x5a974a[_0x628a('0x33')](_0x16c7f2)[_0x628a('0x1f')](function(_0x2eae73){return _0x2eae73;});}return null;};}function removeEntity(_0x3c577d,_0x5381eb){return function(_0x2f2a42){if(_0x2f2a42){return _0x2f2a42[_0x628a('0x34')]()['then'](function(){_0x3c577d[_0x628a('0x2a')](0xcc)[_0x628a('0x35')]();});}};}function handleEntityNotFound(_0x33674b,_0x5290a9){return function(_0x3de992){if(!_0x3de992){_0x33674b[_0x628a('0x36')](0x194);}return _0x3de992;};}function handleError(_0x49b12b,_0x35f11f){_0x35f11f=_0x35f11f||0x1f4;return function(_0x8b0761){logger[_0x628a('0x25')](_0x8b0761[_0x628a('0x37')]);if(_0x8b0761[_0x628a('0x38')]){delete _0x8b0761[_0x628a('0x38')];}_0x49b12b[_0x628a('0x2a')](_0x35f11f)[_0x628a('0x39')](_0x8b0761);};}exports['index']=function(_0x2e2cc4,_0x2f3366){var _0x22b14e={},_0x49f0c1={},_0x455c13={'count':0x0,'rows':[]};var _0x17ebc1=_['map'](db[_0x628a('0x3a')][_0x628a('0x3b')],function(_0x20f412){return{'name':_0x20f412[_0x628a('0x3c')],'type':_0x20f412[_0x628a('0x3d')]['key']};});_0x49f0c1[_0x628a('0x3e')]=_[_0x628a('0x3f')](_0x17ebc1,'name');_0x49f0c1[_0x628a('0x40')]=_[_0x628a('0x41')](_0x2e2cc4['query']);_0x49f0c1[_0x628a('0x42')]=_[_0x628a('0x43')](_0x49f0c1[_0x628a('0x3e')],_0x49f0c1[_0x628a('0x40')]);_0x22b14e[_0x628a('0x44')]=_[_0x628a('0x43')](_0x49f0c1[_0x628a('0x3e')],qs[_0x628a('0x45')](_0x2e2cc4[_0x628a('0x40')]['fields']));_0x22b14e[_0x628a('0x44')]=_0x22b14e[_0x628a('0x44')][_0x628a('0x46')]?_0x22b14e[_0x628a('0x44')]:_0x49f0c1[_0x628a('0x3e')];if(!_0x2e2cc4[_0x628a('0x40')][_0x628a('0x47')]('nolimit')){_0x22b14e[_0x628a('0x2b')]=qs['limit'](_0x2e2cc4[_0x628a('0x40')][_0x628a('0x2b')]);_0x22b14e[_0x628a('0x2d')]=qs[_0x628a('0x2d')](_0x2e2cc4[_0x628a('0x40')]['offset']);}_0x22b14e['order']=qs['sort'](_0x2e2cc4[_0x628a('0x40')]['sort']);_0x22b14e[_0x628a('0x48')]=qs['filters'](_['pick'](_0x2e2cc4[_0x628a('0x40')],_0x49f0c1[_0x628a('0x42')]),_0x17ebc1);if(_0x2e2cc4[_0x628a('0x40')][_0x628a('0x49')]){_0x22b14e[_0x628a('0x48')]=_[_0x628a('0x4a')](_0x22b14e[_0x628a('0x48')],{'$or':_['map'](_0x17ebc1,function(_0x57448b){if(_0x57448b[_0x628a('0x3d')]!==_0x628a('0x4b')){var _0x51884e={};_0x51884e[_0x57448b[_0x628a('0x38')]]={'$like':'%'+_0x2e2cc4[_0x628a('0x40')]['filter']+'%'};return _0x51884e;}})});}_0x22b14e=_[_0x628a('0x4a')]({},_0x22b14e,_0x2e2cc4[_0x628a('0x4c')]);var _0x2f4b3f={'where':_0x22b14e['where']};return db['SmsMessage']['count'](_0x2f4b3f)[_0x628a('0x1f')](function(_0x2ecb75){_0x455c13[_0x628a('0x2c')]=_0x2ecb75;if(_0x2e2cc4[_0x628a('0x40')][_0x628a('0x4d')]){_0x22b14e[_0x628a('0x4e')]=[{'all':!![]}];}return db[_0x628a('0x3a')][_0x628a('0x4f')](_0x22b14e);})[_0x628a('0x1f')](function(_0x17adb3){_0x455c13[_0x628a('0x50')]=_0x17adb3;return _0x455c13;})[_0x628a('0x1f')](respondWithFilteredResult(_0x2f3366,_0x22b14e))[_0x628a('0x51')](handleError(_0x2f3366,null));};exports['show']=function(_0x508fd8,_0x3900b8){var _0x456f26={'raw':!![],'where':{'id':_0x508fd8['params']['id']}},_0x11cf26={};_0x11cf26['model']=_['keys'](db[_0x628a('0x3a')][_0x628a('0x3b')]);_0x11cf26['query']=_[_0x628a('0x41')](_0x508fd8['query']);_0x11cf26['filters']=_[_0x628a('0x43')](_0x11cf26[_0x628a('0x3e')],_0x11cf26[_0x628a('0x40')]);_0x456f26['attributes']=_[_0x628a('0x43')](_0x11cf26[_0x628a('0x3e')],qs[_0x628a('0x45')](_0x508fd8[_0x628a('0x40')][_0x628a('0x45')]));_0x456f26[_0x628a('0x44')]=_0x456f26[_0x628a('0x44')][_0x628a('0x46')]?_0x456f26['attributes']:_0x11cf26[_0x628a('0x3e')];if(_0x508fd8[_0x628a('0x40')][_0x628a('0x4d')]){_0x456f26[_0x628a('0x4e')]=[{'all':!![]}];}_0x456f26=_[_0x628a('0x4a')]({},_0x456f26,_0x508fd8[_0x628a('0x4c')]);return db[_0x628a('0x3a')][_0x628a('0x52')](_0x456f26)[_0x628a('0x1f')](handleEntityNotFound(_0x3900b8,null))[_0x628a('0x1f')](respondWithResult(_0x3900b8,null))[_0x628a('0x51')](handleError(_0x3900b8,null));};exports['create']=function(_0xbfe92c,_0x437361){return db[_0x628a('0x3a')][_0x628a('0x53')](_0xbfe92c[_0x628a('0x54')],{})['then'](respondWithResult(_0x437361,0xc9))[_0x628a('0x51')](handleError(_0x437361,null));};exports[_0x628a('0x33')]=function(_0x482b4b,_0x50c523){if(_0x482b4b[_0x628a('0x54')]['id']){delete _0x482b4b[_0x628a('0x54')]['id'];}return db[_0x628a('0x3a')][_0x628a('0x52')]({'where':{'id':_0x482b4b[_0x628a('0x55')]['id']}})[_0x628a('0x1f')](handleEntityNotFound(_0x50c523,null))[_0x628a('0x1f')](saveUpdates(_0x482b4b['body'],null))[_0x628a('0x1f')](respondWithResult(_0x50c523,null))[_0x628a('0x51')](handleError(_0x50c523,null));};exports[_0x628a('0x34')]=function(_0x5b86a8,_0x20b921){return db[_0x628a('0x3a')][_0x628a('0x52')]({'where':{'id':_0x5b86a8['params']['id']}})[_0x628a('0x1f')](handleEntityNotFound(_0x20b921,null))[_0x628a('0x1f')](removeEntity(_0x20b921,null))[_0x628a('0x51')](handleError(_0x20b921,null));};exports[_0x628a('0x56')]=function(_0x44ff3f,_0xcf0a65){return db[_0x628a('0x3a')][_0x628a('0x56')]()[_0x628a('0x1f')](respondWithResult(_0xcf0a65,null))[_0x628a('0x51')](handleError(_0xcf0a65,null));};var interaction_log=require('../../config/logger')(_0x628a('0x57'));exports[_0x628a('0x58')]=function(_0xd8cbbb,_0x5c8b39,_0x1bf3e5){var _0xe904ec={'agent':{},'channel':'sms'};if(_0xd8cbbb['body']['id']){delete _0xd8cbbb[_0x628a('0x54')]['id'];}_0xd8cbbb['body'][_0x628a('0x59')]=!![];_0xd8cbbb[_0x628a('0x54')][_0x628a('0x5a')]=moment()['format'](_0x628a('0x5b'));_0xd8cbbb['body'][_0x628a('0x5c')]=_0xd8cbbb[_0x628a('0x54')]['UserId']||_0xd8cbbb['user']['id'];_0xe904ec[_0x628a('0x5d')]['id']=_0xd8cbbb[_0x628a('0x54')][_0x628a('0x5c')];return db[_0x628a('0x3a')][_0x628a('0x52')]({'where':{'id':_0xd8cbbb[_0x628a('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5c8b39,null))['then'](saveUpdates(_0xd8cbbb[_0x628a('0x54')],null))['then'](function(_0x5a3d24){if(_0x5a3d24){_0xe904ec[_0x628a('0x27')]=_0x5a3d24['get']({'plain':!![]});return db['SmsInteraction'][_0x628a('0x52')]({'where':{'id':_0x5a3d24[_0x628a('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x5c8b39,null))[_0x628a('0x1f')](function(_0x480a83){if(_0x480a83){return _0x480a83[_0x628a('0x33')]({'UserId':_0xd8cbbb[_0x628a('0x54')][_0x628a('0x5c')],'read1stAt':_[_0x628a('0x5f')](_0x480a83['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x628a('0x1f')](function(_0x35c81b){if(_0x35c81b){_0xe904ec[_0x628a('0x60')]=_0x35c81b[_0x628a('0x61')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xd8cbbb[_0x628a('0x62')]['id'],_0xd8cbbb[_0x628a('0x62')][_0x628a('0x38')],_0xd8cbbb[_0x628a('0x62')][_0x628a('0x63')],_0xe904ec['interaction']['id'],_0xd8cbbb[_0x628a('0x54')]?JSON[_0x628a('0x24')](_0xd8cbbb[_0x628a('0x54')]):_0x628a('0x64'));return respondWithRpcPromise(_0x628a('0x65'),_0x628a('0x66'),_0xe904ec);}return null;})[_0x628a('0x1f')](function(_0x1d90ae){var _0x411f1d=_0x628a('0x67')+_0x1d90ae['message'][_0x628a('0x68')];return db['sequelize'][_0x628a('0x40')](_0x411f1d,{'type':db[_0x628a('0x69')][_0x628a('0x6a')]['SELECT'],'raw':!![]})[_0x628a('0x1f')](function(_0x5b667e){return _0x5b667e;});})[_0x628a('0x1f')](function(_0x3f36eb){if(_0x3f36eb){_0xe904ec[_0x628a('0x27')][_0x628a('0x6b')]=_0x3f36eb[0x0];if(!_0xd8cbbb['body']['UserId'])return;return db['User'][_0x628a('0x52')]({'where':{'id':_0xd8cbbb['body'][_0x628a('0x5c')],'role':_0x628a('0x5d')},'attributes':['id','name',_0x628a('0x6c'),_0x628a('0x6d'),_0x628a('0x6e')],'raw':!![]});}return null;})[_0x628a('0x1f')](function(_0x385d21){if(!_0x385d21)return null;_0xe904ec[_0x628a('0x27')][_0x628a('0x5d')]=_0x385d21;return _0xe904ec;})[_0x628a('0x1f')](function(_0x17767b){if(_0x17767b){if(_0xd8cbbb['body'][_0x628a('0x6f')]){_0xe904ec[_0x628a('0x27')][_0x628a('0x70')]=util['format'](_0x628a('0x71'),_0xd8cbbb[_0x628a('0x62')][_0x628a('0x38')]);_0xe904ec[_0x628a('0x27')][_0x628a('0x72')]=_0xe904ec[_0x628a('0x72')];_0xe904ec['message'][_0x628a('0x73')]=_0xe904ec[_0x628a('0x72')];_0xe904ec['message'][_0x628a('0x74')]=_0x628a('0x58');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0xe904ec[_0x628a('0x27')]},client9002)['then'](function(){return _0xe904ec;});}return _0xe904ec;}return null;})[_0x628a('0x1f')](respondWithResult(_0x5c8b39,null))[_0x628a('0x51')](handleError(_0x5c8b39,null));};var interaction_log=require(_0x628a('0x10'))(_0x628a('0x57'));exports[_0x628a('0x75')]=function(_0x21fc74,_0x323aff,_0x45b465){var _0x31a350={'agent':{},'channel':_0x628a('0x76')};if(_0x21fc74[_0x628a('0x54')]['id']){delete _0x21fc74['body']['id'];}_0x21fc74[_0x628a('0x54')][_0x628a('0x5c')]=_0x21fc74[_0x628a('0x54')][_0x628a('0x5c')]||_0x21fc74['user']['id'];_0x31a350['agent']['id']=_0x21fc74[_0x628a('0x54')][_0x628a('0x5c')];return db['SmsMessage'][_0x628a('0x52')]({'where':{'id':_0x21fc74[_0x628a('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x323aff,null))['then'](function(_0x2153fe){if(_0x2153fe){_0x31a350[_0x628a('0x27')]=_0x2153fe['get']({'plain':!![]});return db['SmsInteraction'][_0x628a('0x52')]({'where':{'id':_0x2153fe[_0x628a('0x5e')]}});}return null;})[_0x628a('0x1f')](handleEntityNotFound(_0x323aff,null))[_0x628a('0x1f')](function(_0x2d5219){if(_0x2d5219){_0x31a350[_0x628a('0x60')]=_0x2d5219[_0x628a('0x61')]({'plain':!![]});interaction_log[_0x628a('0x28')](_0x628a('0x77'),_0x21fc74['user']['id'],_0x21fc74[_0x628a('0x62')]['name'],_0x21fc74[_0x628a('0x62')][_0x628a('0x63')],_0x31a350[_0x628a('0x60')]['id'],_0x21fc74[_0x628a('0x54')]?JSON[_0x628a('0x24')](_0x21fc74[_0x628a('0x54')]):'null');return respondWithRpcPromise(_0x628a('0x78'),'rejectMessage',_0x31a350);}return null;})[_0x628a('0x1f')](function(_0x110e22){var _0x576232=_0x628a('0x67')+_0x110e22[_0x628a('0x27')][_0x628a('0x68')];return db['sequelize'][_0x628a('0x40')](_0x576232,{'type':db[_0x628a('0x69')]['QueryTypes'][_0x628a('0x79')],'raw':!![]})[_0x628a('0x1f')](function(_0x559956){return _0x559956;});})['then'](function(_0x28775c){if(_0x28775c){_0x31a350['message'][_0x628a('0x6b')]=_0x28775c[0x0];if(!_0x21fc74[_0x628a('0x54')][_0x628a('0x5c')])return;return db['User'][_0x628a('0x52')]({'where':{'id':_0x21fc74[_0x628a('0x54')]['UserId'],'role':'agent'},'attributes':['id',_0x628a('0x38'),_0x628a('0x6c'),_0x628a('0x6d'),_0x628a('0x6e')],'raw':!![]});}return null;})['then'](function(_0x50c97a){if(!_0x50c97a)return null;_0x31a350['message'][_0x628a('0x5d')]=_0x50c97a;return _0x31a350;})[_0x628a('0x1f')](function(_0xc77780){if(_0xc77780){_0xc77780['message']['interface']=util[_0x628a('0x7a')](_0x628a('0x71'),_0x21fc74['user'][_0x628a('0x38')]);_0xc77780[_0x628a('0x27')][_0x628a('0x72')]=_0x31a350[_0x628a('0x72')];_0xc77780[_0x628a('0x27')][_0x628a('0x73')]=_0x31a350['channel'];_0xc77780[_0x628a('0x27')]['event']=_0x628a('0x75');respondWithRpcPromise(_0x628a('0x7b'),_0x628a('0x7b'),{'event':'rejectmessage','message':_0xc77780[_0x628a('0x27')]},client9002);return _0x31a350;}return null;})[_0x628a('0x1f')](respondWithResult(_0x323aff,null))[_0x628a('0x51')](handleError(_0x323aff,null));};exports[_0x628a('0x2a')]=function(_0x3846db,_0x1e75e5,_0x50b5d2){if(_0x3846db[_0x628a('0x54')]['id']){delete _0x3846db[_0x628a('0x54')]['id'];}var _0x51018b;return db[_0x628a('0x3a')][_0x628a('0x52')]({'where':{'id':_0x3846db[_0x628a('0x55')]['id']}})[_0x628a('0x1f')](handleEntityNotFound(_0x1e75e5,null))['then'](function(_0x2ba75f){if(_0x2ba75f){_0x51018b=_0x2ba75f;return db['SmsAccount'][_0x628a('0x52')]({'where':{'id':_0x2ba75f[_0x628a('0x7c')]}});}})['then'](handleEntityNotFound(_0x1e75e5,null))['then'](function(_0x4922da){if(_0x4922da){logger[_0x628a('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x628a('0x2a'),_0x628a('0x7d'),_0x4922da[_0x628a('0x3d')],util[_0x628a('0x7e')](_0x3846db[_0x628a('0x54')],{'showHidden':![],'depth':null}));switch(_0x4922da['type']){case _0x628a('0x7f'):if(_0x3846db[_0x628a('0x54')][_0x628a('0x80')]&&_0x3846db[_0x628a('0x54')]['MessageSid']===_0x51018b[_0x628a('0x81')]){return _0x51018b[_0x628a('0x33')]({'read':!![]});}else{logger[_0x628a('0x25')](_0x628a('0x82'),_0x628a('0x2a'),_0x628a('0x7f'),util['inspect'](_0x3846db[_0x628a('0x54')],{'showHidden':![],'depth':null}));}break;case _0x628a('0x83'):if(_0x3846db['body']['MessageUUID']&&_0x3846db['body'][_0x628a('0x84')]===_0x51018b[_0x628a('0x81')]&&_[_0x628a('0x85')]([_0x628a('0x86'),_0x628a('0x87')],_0x3846db[_0x628a('0x54')][_0x628a('0x88')])>=0x0){return _0x51018b[_0x628a('0x33')]({'read':!![]});}else{logger['error'](_0x628a('0x82'),'status','plivio',util[_0x628a('0x7e')](_0x3846db[_0x628a('0x54')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x24c0f3=_0x3846db[_0x628a('0x54')][_0x628a('0x89')][0x0];if(_0x24c0f3[_0x628a('0x2a')][_0x628a('0x8a')]===_0x628a('0x8b')){return _0x51018b[_0x628a('0x33')]({'read':!![]});}else{logger[_0x628a('0x25')](_0x628a('0x82'),'status',_0x628a('0x8c'),util['inspect'](_0x3846db[_0x628a('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x51018b;}})[_0x628a('0x1f')](respondWithResult(_0x1e75e5,null))[_0x628a('0x51')](handleError(_0x1e75e5,null));}; \ No newline at end of file +var _0x6dc0=['Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','fullname','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','delivered','Status','inspect','infobip','results','groupName','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','localhost','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','include','find','catch','create','body','describe','sms-interactions','accept','sms','readAt','format','UserId','user','agent','params','get','SmsInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId'];(function(_0xe0cc29,_0x438420){var _0x3ca3e2=function(_0x2efca0){while(--_0x2efca0){_0xe0cc29['push'](_0xe0cc29['shift']());}};_0x3ca3e2(++_0x438420);}(_0x6dc0,0xb6));var _0x06dc=function(_0x5ac194,_0x22d75b){_0x5ac194=_0x5ac194-0x0;var _0xd7816c=_0x6dc0[_0x5ac194];return _0xd7816c;};'use strict';var emlformat=require(_0x06dc('0x0'));var rimraf=require(_0x06dc('0x1'));var zipdir=require(_0x06dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06dc('0x3'));var moment=require(_0x06dc('0x4'));var BPromise=require(_0x06dc('0x5'));var Mustache=require(_0x06dc('0x6'));var util=require('util');var path=require(_0x06dc('0x7'));var sox=require(_0x06dc('0x8'));var csv=require('to-csv');var ejs=require(_0x06dc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06dc('0xa'));var squel=require(_0x06dc('0xb'));var crypto=require(_0x06dc('0xc'));var jsforce=require(_0x06dc('0xd'));var deskjs=require(_0x06dc('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x06dc('0xf'));var authService=require(_0x06dc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x06dc('0x11'));var hardwareService=require(_0x06dc('0x12'));var logger=require(_0x06dc('0x13'))(_0x06dc('0x14'));var utils=require('../../config/utils');var config=require(_0x06dc('0x15'));var licenseUtil=require(_0x06dc('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x06dc('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')[_0x06dc('0x18')](socket);var jayson=require(_0x06dc('0x19'));var client=jayson[_0x06dc('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x06dc('0x1a')][_0x06dc('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x145a07,_0x3da2c5,_0x58dc33,_0x17411e){return new BPromise(function(_0x30c1c5,_0x1d5e6b){var _0x2478b9=_0x17411e||client;return _0x2478b9[_0x06dc('0x1c')](_0x145a07,_0x58dc33)['then'](function(_0x1daaa8){logger[_0x06dc('0x1d')](_0x06dc('0x1e'),_0x3da2c5,_0x06dc('0x1f'));logger[_0x06dc('0x20')](_0x06dc('0x21'),_0x3da2c5,'request\x20sent',JSON['stringify'](_0x1daaa8));if(_0x1daaa8[_0x06dc('0x22')]){if(_0x1daaa8['error'][_0x06dc('0x23')]===0x1f4){logger['error'](_0x06dc('0x1e'),_0x3da2c5,_0x1daaa8[_0x06dc('0x22')][_0x06dc('0x24')]);return _0x1d5e6b(_0x1daaa8[_0x06dc('0x22')][_0x06dc('0x24')]);}logger[_0x06dc('0x22')]('SmsMessage,\x20%s,\x20%s',_0x3da2c5,_0x1daaa8['error'][_0x06dc('0x24')]);return _0x30c1c5(_0x1daaa8[_0x06dc('0x22')]['message']);}else{logger[_0x06dc('0x1d')]('SmsMessage,\x20%s,\x20%s',_0x3da2c5,'request\x20sent');_0x30c1c5(_0x1daaa8['result']['message']);}})['catch'](function(_0xd3e42b){logger['error'](_0x06dc('0x1e'),_0x3da2c5,_0xd3e42b);_0x1d5e6b(_0xd3e42b);});});}function respondWithStatusCode(_0x56819b,_0x52afcf){_0x52afcf=_0x52afcf||0xcc;return function(_0xa85ffc){if(_0xa85ffc){return _0x56819b[_0x06dc('0x25')](_0x52afcf);}return _0x56819b['status'](_0x52afcf)['end']();};}function respondWithResult(_0x263b5c,_0x4e3362){_0x4e3362=_0x4e3362||0xc8;return function(_0x36c138){if(_0x36c138){return _0x263b5c[_0x06dc('0x26')](_0x4e3362)[_0x06dc('0x27')](_0x36c138);}};}function respondWithFilteredResult(_0xfd5611,_0x1d98b8){return function(_0x31f5cd){if(_0x31f5cd){var _0x164554=typeof _0x1d98b8[_0x06dc('0x28')]===_0x06dc('0x29')&&typeof _0x1d98b8[_0x06dc('0x2a')]===_0x06dc('0x29');var _0x285bb4=_0x31f5cd[_0x06dc('0x2b')];var _0x560d80=_0x164554?0x0:_0x1d98b8['offset'];var _0x138e6b=_0x164554?_0x31f5cd[_0x06dc('0x2b')]:_0x1d98b8[_0x06dc('0x28')]+_0x1d98b8[_0x06dc('0x2a')];var _0x289861;if(_0x138e6b>=_0x285bb4){_0x138e6b=_0x285bb4;_0x289861=0xc8;}else{_0x289861=0xce;}_0xfd5611[_0x06dc('0x26')](_0x289861);return _0xfd5611[_0x06dc('0x2c')](_0x06dc('0x2d'),_0x560d80+'-'+_0x138e6b+'/'+_0x285bb4)[_0x06dc('0x27')](_0x31f5cd);}return null;};}function patchUpdates(_0x389198){return function(_0x5eb996){try{jsonpatch[_0x06dc('0x2e')](_0x5eb996,_0x389198,!![]);}catch(_0x261c91){return BPromise[_0x06dc('0x2f')](_0x261c91);}return _0x5eb996[_0x06dc('0x30')]();};}function saveUpdates(_0x237d67,_0x4acc38){return function(_0x428a33){if(_0x428a33){return _0x428a33[_0x06dc('0x31')](_0x237d67)[_0x06dc('0x32')](function(_0x58ff88){return _0x58ff88;});}return null;};}function removeEntity(_0x363901,_0x123361){return function(_0x5ca682){if(_0x5ca682){return _0x5ca682[_0x06dc('0x33')]()[_0x06dc('0x32')](function(){_0x363901['status'](0xcc)[_0x06dc('0x34')]();});}};}function handleEntityNotFound(_0x361452,_0x15a02c){return function(_0x185e43){if(!_0x185e43){_0x361452[_0x06dc('0x25')](0x194);}return _0x185e43;};}function handleError(_0x400692,_0x44adce){_0x44adce=_0x44adce||0x1f4;return function(_0x47287b){logger[_0x06dc('0x22')](_0x47287b[_0x06dc('0x35')]);if(_0x47287b['name']){delete _0x47287b['name'];}_0x400692['status'](_0x44adce)[_0x06dc('0x36')](_0x47287b);};}exports[_0x06dc('0x37')]=function(_0x1bd2c9,_0xb03418){var _0x511ba9={},_0x51709b={},_0x525595={'count':0x0,'rows':[]};var _0x2580be=_[_0x06dc('0x38')](db[_0x06dc('0x39')][_0x06dc('0x3a')],function(_0xe65d69){return{'name':_0xe65d69[_0x06dc('0x3b')],'type':_0xe65d69[_0x06dc('0x3c')][_0x06dc('0x3d')]};});_0x51709b[_0x06dc('0x3e')]=_[_0x06dc('0x38')](_0x2580be,_0x06dc('0x3f'));_0x51709b[_0x06dc('0x40')]=_[_0x06dc('0x41')](_0x1bd2c9[_0x06dc('0x40')]);_0x51709b[_0x06dc('0x42')]=_[_0x06dc('0x43')](_0x51709b[_0x06dc('0x3e')],_0x51709b[_0x06dc('0x40')]);_0x511ba9[_0x06dc('0x44')]=_['intersection'](_0x51709b['model'],qs[_0x06dc('0x45')](_0x1bd2c9[_0x06dc('0x40')][_0x06dc('0x45')]));_0x511ba9[_0x06dc('0x44')]=_0x511ba9[_0x06dc('0x44')]['length']?_0x511ba9[_0x06dc('0x44')]:_0x51709b[_0x06dc('0x3e')];if(!_0x1bd2c9[_0x06dc('0x40')]['hasOwnProperty'](_0x06dc('0x46'))){_0x511ba9[_0x06dc('0x2a')]=qs['limit'](_0x1bd2c9[_0x06dc('0x40')][_0x06dc('0x2a')]);_0x511ba9[_0x06dc('0x28')]=qs[_0x06dc('0x28')](_0x1bd2c9['query']['offset']);}_0x511ba9[_0x06dc('0x47')]=qs[_0x06dc('0x48')](_0x1bd2c9[_0x06dc('0x40')]['sort']);_0x511ba9[_0x06dc('0x49')]=qs[_0x06dc('0x42')](_[_0x06dc('0x4a')](_0x1bd2c9[_0x06dc('0x40')],_0x51709b[_0x06dc('0x42')]),_0x2580be);if(_0x1bd2c9['query'][_0x06dc('0x4b')]){_0x511ba9['where']=_['merge'](_0x511ba9[_0x06dc('0x49')],{'$or':_[_0x06dc('0x38')](_0x2580be,function(_0x36dcfc){if(_0x36dcfc[_0x06dc('0x3c')]!==_0x06dc('0x4c')){var _0x4e316d={};_0x4e316d[_0x36dcfc[_0x06dc('0x3f')]]={'$like':'%'+_0x1bd2c9[_0x06dc('0x40')][_0x06dc('0x4b')]+'%'};return _0x4e316d;}})});}_0x511ba9=_[_0x06dc('0x4d')]({},_0x511ba9,_0x1bd2c9[_0x06dc('0x4e')]);var _0x1536d3={'where':_0x511ba9[_0x06dc('0x49')]};return db[_0x06dc('0x39')][_0x06dc('0x2b')](_0x1536d3)[_0x06dc('0x32')](function(_0x3680ad){_0x525595['count']=_0x3680ad;if(_0x1bd2c9[_0x06dc('0x40')][_0x06dc('0x4f')]){_0x511ba9['include']=[{'all':!![]}];}return db[_0x06dc('0x39')][_0x06dc('0x50')](_0x511ba9);})[_0x06dc('0x32')](function(_0x5a3d9d){_0x525595[_0x06dc('0x51')]=_0x5a3d9d;return _0x525595;})[_0x06dc('0x32')](respondWithFilteredResult(_0xb03418,_0x511ba9))['catch'](handleError(_0xb03418,null));};exports['show']=function(_0x5a7b20,_0x65fd04){var _0x401edc={'raw':!![],'where':{'id':_0x5a7b20['params']['id']}},_0x471d1e={};_0x471d1e['model']=_[_0x06dc('0x41')](db[_0x06dc('0x39')][_0x06dc('0x3a')]);_0x471d1e[_0x06dc('0x40')]=_[_0x06dc('0x41')](_0x5a7b20['query']);_0x471d1e[_0x06dc('0x42')]=_[_0x06dc('0x43')](_0x471d1e[_0x06dc('0x3e')],_0x471d1e['query']);_0x401edc[_0x06dc('0x44')]=_[_0x06dc('0x43')](_0x471d1e[_0x06dc('0x3e')],qs[_0x06dc('0x45')](_0x5a7b20[_0x06dc('0x40')][_0x06dc('0x45')]));_0x401edc[_0x06dc('0x44')]=_0x401edc[_0x06dc('0x44')]['length']?_0x401edc[_0x06dc('0x44')]:_0x471d1e['model'];if(_0x5a7b20[_0x06dc('0x40')]['includeAll']){_0x401edc[_0x06dc('0x52')]=[{'all':!![]}];}_0x401edc=_['merge']({},_0x401edc,_0x5a7b20[_0x06dc('0x4e')]);return db[_0x06dc('0x39')][_0x06dc('0x53')](_0x401edc)[_0x06dc('0x32')](handleEntityNotFound(_0x65fd04,null))[_0x06dc('0x32')](respondWithResult(_0x65fd04,null))[_0x06dc('0x54')](handleError(_0x65fd04,null));};exports[_0x06dc('0x55')]=function(_0x5545db,_0x2c692e){return db[_0x06dc('0x39')][_0x06dc('0x55')](_0x5545db['body'],{})['then'](respondWithResult(_0x2c692e,0xc9))[_0x06dc('0x54')](handleError(_0x2c692e,null));};exports[_0x06dc('0x31')]=function(_0x42fcbf,_0x4bebbc){if(_0x42fcbf[_0x06dc('0x56')]['id']){delete _0x42fcbf[_0x06dc('0x56')]['id'];}return db[_0x06dc('0x39')][_0x06dc('0x53')]({'where':{'id':_0x42fcbf['params']['id']}})[_0x06dc('0x32')](handleEntityNotFound(_0x4bebbc,null))[_0x06dc('0x32')](saveUpdates(_0x42fcbf[_0x06dc('0x56')],null))[_0x06dc('0x32')](respondWithResult(_0x4bebbc,null))[_0x06dc('0x54')](handleError(_0x4bebbc,null));};exports[_0x06dc('0x33')]=function(_0x31b371,_0x72c52f){return db[_0x06dc('0x39')][_0x06dc('0x53')]({'where':{'id':_0x31b371['params']['id']}})[_0x06dc('0x32')](handleEntityNotFound(_0x72c52f,null))[_0x06dc('0x32')](removeEntity(_0x72c52f,null))[_0x06dc('0x54')](handleError(_0x72c52f,null));};exports['describe']=function(_0x5336d2,_0x1cfacd){return db[_0x06dc('0x39')][_0x06dc('0x57')]()[_0x06dc('0x32')](respondWithResult(_0x1cfacd,null))[_0x06dc('0x54')](handleError(_0x1cfacd,null));};var interaction_log=require(_0x06dc('0x13'))(_0x06dc('0x58'));exports[_0x06dc('0x59')]=function(_0x1589dd,_0x45cf22,_0x155cfa){var _0x2fddb8={'agent':{},'channel':_0x06dc('0x5a')};if(_0x1589dd['body']['id']){delete _0x1589dd['body']['id'];}_0x1589dd[_0x06dc('0x56')]['read']=!![];_0x1589dd[_0x06dc('0x56')][_0x06dc('0x5b')]=moment()[_0x06dc('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x1589dd[_0x06dc('0x56')][_0x06dc('0x5d')]=_0x1589dd[_0x06dc('0x56')][_0x06dc('0x5d')]||_0x1589dd[_0x06dc('0x5e')]['id'];_0x2fddb8[_0x06dc('0x5f')]['id']=_0x1589dd[_0x06dc('0x56')]['UserId'];return db[_0x06dc('0x39')]['find']({'where':{'id':_0x1589dd[_0x06dc('0x60')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x45cf22,null))[_0x06dc('0x32')](saveUpdates(_0x1589dd[_0x06dc('0x56')],null))['then'](function(_0x2fb1ac){if(_0x2fb1ac){_0x2fddb8['message']=_0x2fb1ac[_0x06dc('0x61')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x2fb1ac[_0x06dc('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x45cf22,null))[_0x06dc('0x32')](function(_0x1a359b){if(_0x1a359b){return _0x1a359b[_0x06dc('0x31')]({'UserId':_0x1589dd[_0x06dc('0x56')][_0x06dc('0x5d')],'read1stAt':_['isNil'](_0x1a359b[_0x06dc('0x63')])?moment()[_0x06dc('0x5c')](_0x06dc('0x64')):undefined});}return null;})[_0x06dc('0x32')](function(_0x18b99c){if(_0x18b99c){_0x2fddb8[_0x06dc('0x65')]=_0x18b99c[_0x06dc('0x61')]({'plain':!![]});interaction_log['info'](_0x06dc('0x66'),_0x1589dd[_0x06dc('0x5e')]['id'],_0x1589dd[_0x06dc('0x5e')]['name'],_0x1589dd[_0x06dc('0x5e')][_0x06dc('0x67')],_0x2fddb8[_0x06dc('0x65')]['id'],_0x1589dd['body']?JSON[_0x06dc('0x68')](_0x1589dd['body']):_0x06dc('0x69'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2fddb8);}return null;})[_0x06dc('0x32')](function(_0x563eec){var _0x599c73=_0x06dc('0x6a')+_0x563eec['message'][_0x06dc('0x6b')];return db['sequelize']['query'](_0x599c73,{'type':db[_0x06dc('0x6c')][_0x06dc('0x6d')][_0x06dc('0x6e')],'raw':!![]})[_0x06dc('0x32')](function(_0x5046bb){return _0x5046bb;});})[_0x06dc('0x32')](function(_0x58d74a){if(_0x58d74a){_0x2fddb8[_0x06dc('0x24')][_0x06dc('0x6f')]=_0x58d74a[0x0];if(!_0x1589dd[_0x06dc('0x56')]['UserId'])return;return db[_0x06dc('0x70')]['find']({'where':{'id':_0x1589dd[_0x06dc('0x56')][_0x06dc('0x5d')],'role':_0x06dc('0x5f')},'attributes':['id',_0x06dc('0x3f'),'fullname',_0x06dc('0x71'),_0x06dc('0x72')],'raw':!![]});}return null;})[_0x06dc('0x32')](function(_0x4a040a){if(!_0x4a040a)return null;_0x2fddb8[_0x06dc('0x24')][_0x06dc('0x5f')]=_0x4a040a;return _0x2fddb8;})[_0x06dc('0x32')](function(_0x437776){if(_0x437776){if(_0x1589dd[_0x06dc('0x56')][_0x06dc('0x73')]){_0x2fddb8[_0x06dc('0x24')][_0x06dc('0x74')]=util[_0x06dc('0x5c')](_0x06dc('0x75'),_0x1589dd['user'][_0x06dc('0x3f')]);_0x2fddb8[_0x06dc('0x24')][_0x06dc('0x76')]=_0x2fddb8[_0x06dc('0x76')];_0x2fddb8[_0x06dc('0x24')][_0x06dc('0x77')]=_0x2fddb8[_0x06dc('0x76')];_0x2fddb8[_0x06dc('0x24')][_0x06dc('0x78')]=_0x06dc('0x59');return respondWithRpcPromise(_0x06dc('0x79'),_0x06dc('0x79'),{'event':_0x06dc('0x7a'),'message':_0x2fddb8[_0x06dc('0x24')]},client9002)[_0x06dc('0x32')](function(){return _0x2fddb8;});}return _0x2fddb8;}return null;})[_0x06dc('0x32')](respondWithResult(_0x45cf22,null))[_0x06dc('0x54')](handleError(_0x45cf22,null));};var interaction_log=require(_0x06dc('0x13'))(_0x06dc('0x58'));exports[_0x06dc('0x2f')]=function(_0x2b18a3,_0x41eb9c,_0x4e1cb0){var _0x51461f={'agent':{},'channel':'sms'};if(_0x2b18a3[_0x06dc('0x56')]['id']){delete _0x2b18a3[_0x06dc('0x56')]['id'];}_0x2b18a3[_0x06dc('0x56')]['UserId']=_0x2b18a3[_0x06dc('0x56')][_0x06dc('0x5d')]||_0x2b18a3[_0x06dc('0x5e')]['id'];_0x51461f[_0x06dc('0x5f')]['id']=_0x2b18a3[_0x06dc('0x56')]['UserId'];return db[_0x06dc('0x39')][_0x06dc('0x53')]({'where':{'id':_0x2b18a3[_0x06dc('0x60')]['id'],'UserId':null}})[_0x06dc('0x32')](handleEntityNotFound(_0x41eb9c,null))[_0x06dc('0x32')](function(_0x3ff649){if(_0x3ff649){_0x51461f[_0x06dc('0x24')]=_0x3ff649[_0x06dc('0x61')]({'plain':!![]});return db[_0x06dc('0x7b')][_0x06dc('0x53')]({'where':{'id':_0x3ff649[_0x06dc('0x62')]}});}return null;})[_0x06dc('0x32')](handleEntityNotFound(_0x41eb9c,null))['then'](function(_0x403780){if(_0x403780){_0x51461f['interaction']=_0x403780[_0x06dc('0x61')]({'plain':!![]});interaction_log[_0x06dc('0x1d')](_0x06dc('0x7c'),_0x2b18a3[_0x06dc('0x5e')]['id'],_0x2b18a3['user'][_0x06dc('0x3f')],_0x2b18a3[_0x06dc('0x5e')][_0x06dc('0x67')],_0x51461f['interaction']['id'],_0x2b18a3['body']?JSON[_0x06dc('0x68')](_0x2b18a3[_0x06dc('0x56')]):'null');return respondWithRpcPromise(_0x06dc('0x7d'),_0x06dc('0x7e'),_0x51461f);}return null;})[_0x06dc('0x32')](function(_0x510c34){var _0x1d0663='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x510c34[_0x06dc('0x24')][_0x06dc('0x6b')];return db[_0x06dc('0x7f')]['query'](_0x1d0663,{'type':db[_0x06dc('0x6c')][_0x06dc('0x6d')][_0x06dc('0x6e')],'raw':!![]})[_0x06dc('0x32')](function(_0xac40e0){return _0xac40e0;});})['then'](function(_0x291a5a){if(_0x291a5a){_0x51461f[_0x06dc('0x24')][_0x06dc('0x6f')]=_0x291a5a[0x0];if(!_0x2b18a3['body'][_0x06dc('0x5d')])return;return db[_0x06dc('0x70')][_0x06dc('0x53')]({'where':{'id':_0x2b18a3[_0x06dc('0x56')][_0x06dc('0x5d')],'role':_0x06dc('0x5f')},'attributes':['id',_0x06dc('0x3f'),_0x06dc('0x80'),_0x06dc('0x71'),_0x06dc('0x72')],'raw':!![]});}return null;})[_0x06dc('0x32')](function(_0x59ed3f){if(!_0x59ed3f)return null;_0x51461f['message']['agent']=_0x59ed3f;return _0x51461f;})[_0x06dc('0x32')](function(_0x2d93c9){if(_0x2d93c9){_0x2d93c9['message']['interface']=util[_0x06dc('0x5c')](_0x06dc('0x75'),_0x2b18a3[_0x06dc('0x5e')]['name']);_0x2d93c9['message'][_0x06dc('0x76')]=_0x51461f[_0x06dc('0x76')];_0x2d93c9[_0x06dc('0x24')]['motionChannel']=_0x51461f[_0x06dc('0x76')];_0x2d93c9[_0x06dc('0x24')][_0x06dc('0x78')]='reject';respondWithRpcPromise(_0x06dc('0x79'),_0x06dc('0x79'),{'event':_0x06dc('0x81'),'message':_0x2d93c9[_0x06dc('0x24')]},client9002);return _0x51461f;}return null;})[_0x06dc('0x32')](respondWithResult(_0x41eb9c,null))[_0x06dc('0x54')](handleError(_0x41eb9c,null));};exports[_0x06dc('0x26')]=function(_0x3a2e67,_0x4b179b,_0x2deacb){if(_0x3a2e67['body']['id']){delete _0x3a2e67[_0x06dc('0x56')]['id'];}var _0x13e808;return db['SmsMessage']['find']({'where':{'id':_0x3a2e67[_0x06dc('0x60')]['id']}})[_0x06dc('0x32')](handleEntityNotFound(_0x4b179b,null))[_0x06dc('0x32')](function(_0x1a83fc){if(_0x1a83fc){_0x13e808=_0x1a83fc;return db['SmsAccount'][_0x06dc('0x53')]({'where':{'id':_0x1a83fc[_0x06dc('0x82')]}});}})[_0x06dc('0x32')](handleEntityNotFound(_0x4b179b,null))['then'](function(_0xb04541){if(_0xb04541){logger['debug'](_0x06dc('0x21'),_0x06dc('0x26'),_0x06dc('0x83'),_0xb04541[_0x06dc('0x3c')],util['inspect'](_0x3a2e67[_0x06dc('0x56')],{'showHidden':![],'depth':null}));switch(_0xb04541['type']){case'twilio':if(_0x3a2e67['body']['MessageSid']&&_0x3a2e67[_0x06dc('0x56')][_0x06dc('0x84')]===_0x13e808[_0x06dc('0x85')]){return _0x13e808[_0x06dc('0x31')]({'read':!![]});}else{logger[_0x06dc('0x22')](_0x06dc('0x86'),_0x06dc('0x26'),_0x06dc('0x87'),util['inspect'](_0x3a2e67[_0x06dc('0x56')],{'showHidden':![],'depth':null}));}break;case _0x06dc('0x88'):if(_0x3a2e67['body'][_0x06dc('0x89')]&&_0x3a2e67[_0x06dc('0x56')]['MessageUUID']===_0x13e808['messageId']&&_[_0x06dc('0x8a')](['sent',_0x06dc('0x8b')],_0x3a2e67['body'][_0x06dc('0x8c')])>=0x0){return _0x13e808[_0x06dc('0x31')]({'read':!![]});}else{logger['error'](_0x06dc('0x86'),_0x06dc('0x26'),'plivio',util[_0x06dc('0x8d')](_0x3a2e67[_0x06dc('0x56')],{'showHidden':![],'depth':null}));}break;case _0x06dc('0x8e'):var _0x252aa4=_0x3a2e67[_0x06dc('0x56')][_0x06dc('0x8f')][0x0];if(_0x252aa4['status'][_0x06dc('0x90')]==='DELIVERED'){return _0x13e808[_0x06dc('0x31')]({'read':!![]});}else{logger[_0x06dc('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x06dc('0x26'),_0x06dc('0x8e'),util[_0x06dc('0x8d')](_0x3a2e67[_0x06dc('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x13e808;}})[_0x06dc('0x32')](respondWithResult(_0x4b179b,null))['catch'](handleError(_0x4b179b,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 5b1a655..d47c941 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 _0xbc0f=['update','remove','emit','hook','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x35d442,_0x25516a){var _0x4f6cd6=function(_0x9546ff){while(--_0x9546ff){_0x35d442['push'](_0x35d442['shift']());}};_0x4f6cd6(++_0x25516a);}(_0xbc0f,0x107));var _0xfbc0=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xbc0f[_0x46698a];return _0x356db0;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xfbc0('0x0'))['db'][_0xfbc0('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xfbc0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfbc0('0x3'),'afterDestroy':_0xfbc0('0x4')};function emitEvent(_0x490499){return function(_0x1864b9,_0x1467e3,_0x2c85ee){SmsMessageEvents[_0xfbc0('0x5')](_0x490499+':'+_0x1864b9['id'],_0x1864b9);SmsMessageEvents[_0xfbc0('0x5')](_0x490499,_0x1864b9);_0x2c85ee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xfbc0('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xc3b8=['setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x372057,_0x5d9ced){var _0x3e91e3=function(_0x13c8c7){while(--_0x13c8c7){_0x372057['push'](_0x372057['shift']());}};_0x3e91e3(++_0x5d9ced);}(_0xc3b8,0x14f));var _0x8c3b=function(_0x3358ae,_0x4a85d4){_0x3358ae=_0x3358ae-0x0;var _0x3514eb=_0xc3b8[_0x3358ae];return _0x3514eb;};'use strict';var EventEmitter=require(_0x8c3b('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8c3b('0x1')](0x0);var events={'afterCreate':_0x8c3b('0x2'),'afterUpdate':_0x8c3b('0x3'),'afterDestroy':_0x8c3b('0x4')};function emitEvent(_0x3f5a46){return function(_0x51cc8b,_0x5a2fd6,_0x5d3c18){SmsMessageEvents[_0x8c3b('0x5')](_0x3f5a46+':'+_0x51cc8b['id'],_0x51cc8b);SmsMessageEvents[_0x8c3b('0x5')](_0x3f5a46,_0x51cc8b);_0x5d3c18(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x8c3b('0x6')](e,emitEvent(event));}}module[_0x8c3b('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 06c46e8..72b40c1 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 _0xe802=['Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','POST','Basic\x20%s','toString','base64','http_code','data','queued_count','messages','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','login','text','keys','length','createHash','digest','hex','signature=','GET','baseUrl','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','apiKey','uuid','UTF-8','bandwidth','%s:%s','accountId','/messages','applicationId','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','body','phone','remote','/api/sms/messages/','/status?token=','token','sid','catch','error','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','password','sms','user_key','session_key','total_sent','internal_order_id','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','deliveryReport','read'];(function(_0x367616,_0x1756fb){var _0x591422=function(_0x3a8d0f){while(--_0x3a8d0f){_0x367616['push'](_0x367616['shift']());}};_0x591422(++_0x1756fb);}(_0xe802,0xb0));var _0x2e80=function(_0x1d3508,_0x23da97){_0x1d3508=_0x1d3508-0x0;var _0xe79c0f=_0xe802[_0x1d3508];return _0xe79c0f;};'use strict';var _=require(_0x2e80('0x0'));var util=require(_0x2e80('0x1'));var logger=require(_0x2e80('0x2'))(_0x2e80('0x3'));var moment=require('moment');var BPromise=require(_0x2e80('0x4'));var rp=require(_0x2e80('0x5'));var fs=require('fs');var path=require(_0x2e80('0x6'));var rimraf=require(_0x2e80('0x7'));var config=require(_0x2e80('0x8'));var attributes=require('./smsMessage.attributes');module[_0x2e80('0x9')]=function(_0x21bed7,_0x3e6388){return _0x21bed7[_0x2e80('0xa')](_0x2e80('0xb'),attributes,{'tableName':_0x2e80('0xc'),'paranoid':![],'indexes':[{'name':_0x2e80('0xd'),'fields':[_0x2e80('0xd')]},{'name':_0x2e80('0xe'),'fields':['body'],'type':_0x2e80('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xeb104c,_0x2e067f,_0x4f9386){var _0x50ea86=_0x21bed7['models'];var _0x5c182e=_0xeb104c['get']({'plain':!![]});if(_0x5c182e[_0x2e80('0x10')][_0x2e80('0x11')]()==='in'||_0x5c182e[_0x2e80('0x10')][_0x2e80('0x11')]()===_0x2e80('0x12')&&!_0x5c182e['secret']&&!_[_0x2e80('0x13')](_0x5c182e[_0x2e80('0x14')])&&!_[_0x2e80('0x13')](_0x5c182e[_0x2e80('0x15')])){_0x50ea86[_0x2e80('0x16')]['findOne']({'where':{'id':_0x5c182e[_0x2e80('0x15')]}})[_0x2e80('0x17')](function(_0x5e7d1a){if(_0x5e7d1a){_0x5e7d1a[_0x2e80('0x18')]({'lastMsgAt':_0x5c182e['createdAt'],'lastMsgDirection':_0x5c182e[_0x2e80('0x10')][_0x2e80('0x11')]()});}})['catch'](function(_0x8e0e60){console['error'](_0x8e0e60);});}if(_0x5c182e[_0x2e80('0x10')]===_0x2e80('0x12')&&!_0x5c182e[_0x2e80('0x19')]){var _0x385191;_0x50ea86[_0x2e80('0x1a')][_0x2e80('0x1b')]({'where':{'id':_0x5c182e[_0x2e80('0x1c')]},'raw':!![]})['then'](function(_0x13742a){_0x385191=_0x13742a;if(_0x385191&&_0x385191['type']){switch(_0x385191[_0x2e80('0x1d')]){case _0x2e80('0x1e'):var _0x3c2da2=require(_0x2e80('0x1e'));if(_0x385191[_0x2e80('0x1f')]&&_0x385191[_0x2e80('0x20')]&&_0x385191['phone']){var _0xf7c23a=new _0x3c2da2(_0x385191['accountSid'],_0x385191[_0x2e80('0x20')]);_0xf7c23a['messages']['create']({'body':_0x5c182e[_0x2e80('0x21')],'to':_0x5c182e[_0x2e80('0x22')],'from':_0x385191[_0x2e80('0x22')],'statusCallback':_0x385191[_0x2e80('0x23')]+_0x2e80('0x24')+_0x5c182e['id']+_0x2e80('0x25')+_0x385191[_0x2e80('0x26')]})['then'](function(_0x69b329){if(_0x69b329['sid']){return _0xeb104c['update']({'messageId':_0x69b329[_0x2e80('0x27')]});}})[_0x2e80('0x28')](function(_0x4423ef){logger[_0x2e80('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2e80('0x2a'),_0x2e80('0x1e'),util['inspect'](_0x4423ef,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2e80('0x2b'),_0x2e80('0x2a'),_0x2e80('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x2e80('0x2c'):var _0x56fe2e=_0x2e80('0x2d');if(_0x385191[_0x2e80('0x2e')]&&_0x385191['password']){var _0x42ed18={'recipient':[_0x5c182e[_0x2e80('0x22')]],'message':_0x5c182e[_0x2e80('0x21')],'message_type':_0x385191['smsMethod']};if(_0x385191[_0x2e80('0x2f')]&&_0x385191['smsMethod']!=='SI'){_0x42ed18[_0x2e80('0x30')]=_0x385191[_0x2e80('0x22')];}var _0x5326f1={'url':_0x56fe2e+_0x2e80('0x31')+_0x385191[_0x2e80('0x2e')]+_0x2e80('0x32')+_0x385191[_0x2e80('0x33')],'method':'GET'};rp(_0x5326f1)['then'](function(_0x257c4c){var _0x7ae8e2=_0x257c4c['split'](';');var _0x2476a4={'user_key':_0x7ae8e2[0x0],'session_key':_0x7ae8e2[0x1]};_0x5326f1={'url':_0x56fe2e+_0x2e80('0x34'),'method':'POST','headers':{'user_key':_0x2476a4[_0x2e80('0x35')],'Session_key':_0x2476a4[_0x2e80('0x36')]},'json':!![],'body':_0x42ed18};return rp(_0x5326f1);})['then'](function(_0x39de72){if(_0x39de72[_0x2e80('0x37')]>=0x1){var _0x2ab94f={'messageId':_0x39de72[_0x2e80('0x38')]};if(_0x385191[_0x2e80('0x2f')]!=='GP'||!_0x385191['deliveryReport']){_0x2ab94f['read']=!![];}return _0xeb104c['update'](_0x2ab94f);}else{return logger[_0x2e80('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2e80('0x2a'),_0x2e80('0x2c'),util[_0x2e80('0x39')](_0x39de72,{'showHidden':![],'depth':null}));}})[_0x2e80('0x28')](function(_0x1d3a19){return logger[_0x2e80('0x29')](_0x2e80('0x2b'),_0x2e80('0x2a'),_0x2e80('0x2c'),util[_0x2e80('0x39')](_0x1d3a19,{'showHidden':![],'depth':null}));});}else{logger[_0x2e80('0x29')](_0x2e80('0x2b'),_0x2e80('0x2a'),_0x2e80('0x2c'),_0x2e80('0x3a'));}break;case _0x2e80('0x3b'):if(_0x385191[_0x2e80('0x20')]){var _0x391be5={'recipient':_0x5c182e['phone'],'message':_0x5c182e[_0x2e80('0x21')],'sender':_0x385191[_0x2e80('0x3c')]||_0x385191[_0x2e80('0x22')],'authorization':_0x385191[_0x2e80('0x20')]};var _0x2e067f={'method':'POST','uri':_0x2e80('0x3d'),'body':_0x391be5,'json':!![]};rp(_0x2e067f)[_0x2e80('0x17')](function(_0x1f3dd1){var _0x4a0715={'messageId':_0x1f3dd1['requestid']};if(!_0x385191[_0x2e80('0x3e')]){_0x4a0715[_0x2e80('0x3f')]=!![];}return _0xeb104c[_0x2e80('0x18')](_0x4a0715);})[_0x2e80('0x28')](function(_0xba2af7){logger['error'](_0x2e80('0x2b'),_0x2e80('0x2a'),_0x2e80('0x3b'),util[_0x2e80('0x39')](_0xba2af7,{'showHidden':![],'depth':null}));});}else{logger[_0x2e80('0x29')](_0x2e80('0x2b'),'afterCreate',_0x2e80('0x3b'),_0x2e80('0x40'));}break;case _0x2e80('0x41'):if(_0x385191[_0x2e80('0x2e')]&&_0x385191[_0x2e80('0x33')]){var _0x391be5={'messages':[{'source':_0x2e80('0x42'),'to':_0x5c182e[_0x2e80('0x22')],'body':_0x5c182e['body'],'from':_0x385191['senderString']||_0x385191['phone']}]};var _0x3d1a65=util[_0x2e80('0x43')]('%s:%s',_0x385191[_0x2e80('0x2e')],_0x385191[_0x2e80('0x33')]);var _0x2e067f={'method':_0x2e80('0x44'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x391be5,'headers':{'Authorization':util[_0x2e80('0x43')](_0x2e80('0x45'),new Buffer(_0x3d1a65)[_0x2e80('0x46')](_0x2e80('0x47')))},'json':!![]};rp(_0x2e067f)[_0x2e80('0x17')](function(_0x15be07){if(_0x15be07['http_code']>=0xc8&&_0x15be07[_0x2e80('0x48')]<=0xce){if(_0x15be07[_0x2e80('0x49')]&&_0x15be07[_0x2e80('0x49')][_0x2e80('0x4a')]>0x0){var _0x5cd30d=_['head'](_0x15be07[_0x2e80('0x49')][_0x2e80('0x4b')]);var _0x58bc39={'messageId':_0x5cd30d[_0x2e80('0x4c')]};if(!_0x385191['deliveryReport']){_0x58bc39['read']=!![];}return _0xeb104c[_0x2e80('0x18')](_0x58bc39);}else{logger[_0x2e80('0x29')](_0x2e80('0x2b'),_0x2e80('0x2a'),_0x2e80('0x4d'),util[_0x2e80('0x39')](_0x15be07,{'showHidden':![],'depth':null}));}}else{logger[_0x2e80('0x29')](_0x2e80('0x2b'),'afterCreate',_0x2e80('0x4d'),util[_0x2e80('0x39')](_0x15be07,{'showHidden':![],'depth':null}));}})[_0x2e80('0x28')](function(_0x39cbcf){logger[_0x2e80('0x29')](_0x2e80('0x2b'),_0x2e80('0x2a'),'clickSend',util[_0x2e80('0x39')](_0x39cbcf,{'showHidden':![],'depth':null}));});}else{logger[_0x2e80('0x29')](_0x2e80('0x2b'),_0x2e80('0x2a'),_0x2e80('0x4d'),_0x2e80('0x3a'));}break;case _0x2e80('0x4e'):if(_0x385191[_0x2e80('0x4f')]&&_0x385191['authToken']){var _0x391be5={'dst':_0x5c182e[_0x2e80('0x22')],'text':_0x5c182e[_0x2e80('0x21')],'src':_0x385191[_0x2e80('0x3c')]||_0x385191['phone'],'url':_0x385191[_0x2e80('0x23')]+'/api/sms/messages/'+_0x5c182e['id']+_0x2e80('0x25')+_0x385191['token']};var _0x3d1a65=util['format']('%s:%s',_0x385191[_0x2e80('0x4f')],_0x385191['authToken']);var _0x2e067f={'method':_0x2e80('0x44'),'uri':util[_0x2e80('0x43')](_0x2e80('0x50'),_0x385191[_0x2e80('0x4f')]),'body':_0x391be5,'headers':{'Authorization':util[_0x2e80('0x43')]('Basic\x20%s',new Buffer(_0x3d1a65)[_0x2e80('0x46')](_0x2e80('0x47')))},'json':!![]};rp(_0x2e067f)['then'](function(_0x3bbbf3){var _0x2409e1={'messageId':_0x3bbbf3[_0x2e80('0x51')][0x0]};return _0xeb104c[_0x2e80('0x18')](_0x2409e1);})['catch'](function(_0x4976cb){logger[_0x2e80('0x29')](_0x2e80('0x2b'),_0x2e80('0x2a'),_0x2e80('0x4e'),util[_0x2e80('0x39')](_0x4976cb,{'showHidden':![],'depth':null}));});}else{logger[_0x2e80('0x29')](_0x2e80('0x2b'),_0x2e80('0x2a'),_0x2e80('0x4e'),_0x2e80('0x52'));}break;case'infobip':if(_0x385191[_0x2e80('0x2e')]&&_0x385191[_0x2e80('0x33')]){if(_0x385191['baseUrl']){var _0x50cee6={'method':_0x2e80('0x44'),'uri':_0x385191['baseUrl']+'/auth/1/session','body':{'username':_0x385191['username'],'password':_0x385191['password']},'json':!![]};return rp(_0x50cee6)[_0x2e80('0x17')](function(_0x4ccf73){var _0x811227={'method':_0x2e80('0x44'),'uri':_0x385191['baseUrl']+_0x2e80('0x53'),'body':{'messages':[{'from':_0x385191[_0x2e80('0x22')],'destinations':[{'to':_0x5c182e[_0x2e80('0x22')]}],'text':_0x5c182e[_0x2e80('0x21')],'notifyUrl':_0x385191['remote']+_0x2e80('0x24')+_0x5c182e['id']+'/status?token='+_0x385191[_0x2e80('0x26')],'notifyContentType':_0x2e80('0x54'),'callbackData':_0x385191[_0x2e80('0x22')]+';'+_0x5c182e['body']}]},'headers':{'Authorization':_0x2e80('0x55')+_0x4ccf73[_0x2e80('0x26')]},'json':!![]};return rp(_0x811227)[_0x2e80('0x17')](function(_0x531d95){if(_0x531d95['messages']){var _0x2d9cbe={'messageId':_0x531d95[_0x2e80('0x4b')][0x0]['messageId']};if(!_0x385191[_0x2e80('0x3e')]){_0x2d9cbe['read']=!![];}return _0xeb104c[_0x2e80('0x18')](_0x2d9cbe);}else{return logger[_0x2e80('0x29')](_0x2e80('0x2b'),_0x2e80('0x2a'),'infobip',util[_0x2e80('0x39')](_0x531d95,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x469c60){return logger[_0x2e80('0x29')](_0x2e80('0x2b'),_0x2e80('0x2a'),_0x2e80('0x56'),util[_0x2e80('0x39')](_0x469c60,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2e80('0x2a'),_0x2e80('0x56'),_0x2e80('0x57'));}}else{logger['error'](_0x2e80('0x2b'),'afterCreate',_0x2e80('0x56'),_0x2e80('0x3a'));}break;case _0x2e80('0x58'):var _0x3aaa98=require(_0x2e80('0x59'));if(_0x385191['apiKey']){var _0x57e3c1={};_0x57e3c1[_0x2e80('0x5a')]=_0x385191[_0x2e80('0x2e')];_0x57e3c1[_0x2e80('0x22')]=_0x5c182e[_0x2e80('0x22')];_0x57e3c1['sender']=_0x385191[_0x2e80('0x22')];_0x57e3c1[_0x2e80('0x5b')]=_0x5c182e['body'];_0x57e3c1['timestamp']=+new Date();var _0x5b4cbf='';var _0x35b161='';var _0x4f700b=Object[_0x2e80('0x5c')](_0x57e3c1);_0x4f700b['sort']();for(var _0x2ad2ad=0x0;_0x2ad2ad<_0x4f700b[_0x2e80('0x5d')];_0x2ad2ad++){if(_0x5b4cbf!=''){_0x5b4cbf+='&';}_0x5b4cbf+=_0x4f700b[_0x2ad2ad]+'='+encodeURIComponent(_0x57e3c1[_0x4f700b[_0x2ad2ad]]);_0x35b161+=_0x57e3c1[_0x4f700b[_0x2ad2ad]];}_0x35b161+=_0x385191['apiKey'];_0x35b161=_0x3aaa98[_0x2e80('0x5e')]('md5')[_0x2e80('0x18')](_0x35b161)[_0x2e80('0x5f')](_0x2e80('0x60'));if(_0x5b4cbf!==''){_0x5b4cbf+='&';}_0x5b4cbf+=_0x2e80('0x61')+_0x35b161;var _0x5326f1={'method':_0x2e80('0x62'),'uri':_0x385191[_0x2e80('0x63')]+_0x2e80('0x64')+_0x5b4cbf,'json':!![]};return rp(_0x5326f1)[_0x2e80('0x17')](function(_0x427696){var _0x37d2a3=Object[_0x2e80('0x5c')](_0x427696);if(_0x427696[_0x37d2a3[0x0]][_0x2e80('0x29')]&&parseInt(_0x427696[_0x37d2a3[0x0]][_0x2e80('0x29')])===0x0){var _0x4c228d={'messageId':_0x427696[_0x37d2a3[0x0]][_0x2e80('0x65')]};if(!_0x385191['deliveryReport']){_0x4c228d['read']=!![];}return _0xeb104c[_0x2e80('0x18')](_0x4c228d);}else{return logger[_0x2e80('0x29')](_0x2e80('0x2b'),_0x2e80('0x2a'),'csc',util[_0x2e80('0x39')](_0x427696['error'],{'showHidden':![],'depth':null}));}})[_0x2e80('0x28')](function(_0x1ea63b){return logger[_0x2e80('0x29')](_0x2e80('0x2b'),'afterCreate',_0x2e80('0x58'),util[_0x2e80('0x39')](_0x1ea63b,{'showHidden':![],'depth':null}));});}else{logger[_0x2e80('0x29')](_0x2e80('0x2b'),_0x2e80('0x2a'),_0x2e80('0x58'),_0x2e80('0x66'));}break;case _0x2e80('0x67'):if(_0x385191[_0x2e80('0x68')]){var _0x41ee65={'method':_0x2e80('0x44'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x385191['apiKey']},'body':{'content':_0x5c182e['body'],'to':[_0x5c182e[_0x2e80('0x22')]],'from':_0x385191['phone'],'binary':![],'clientMessageId':_0x2e80('0x69'),'charset':_0x2e80('0x6a')},'json':!![]};rp(_0x41ee65)[_0x2e80('0x17')](function(_0x433587){if(!_0x433587[_0x2e80('0x29')]){var _0x25e347={'messageId':_0x433587['messages'][0x0]['apiMessageId']};if(!_0x385191[_0x2e80('0x3e')]){_0x25e347[_0x2e80('0x3f')]=!![];}return _0xeb104c[_0x2e80('0x18')](_0x25e347);}else{return logger['error'](_0x2e80('0x2b'),'afterCreate',_0x2e80('0x67'),util[_0x2e80('0x39')](_0x433587[_0x2e80('0x29')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1eaf49){return logger['error'](_0x2e80('0x2b'),'afterCreate','clickatell',util[_0x2e80('0x39')](_0x1eaf49,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2e80('0x2b'),_0x2e80('0x2a'),_0x2e80('0x67'),_0x2e80('0x66'));}break;case _0x2e80('0x6b'):if(_0x385191[_0x2e80('0x2e')]&&_0x385191['password']){var _0x3d1a65=util[_0x2e80('0x43')](_0x2e80('0x6c'),_0x385191[_0x2e80('0x2e')],_0x385191[_0x2e80('0x33')]);var _0x2e067f={'method':_0x2e80('0x44'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x385191[_0x2e80('0x6d')]+_0x2e80('0x6e'),'body':{'to':[_0x5c182e[_0x2e80('0x22')]],'text':_0x5c182e[_0x2e80('0x21')],'from':_0x385191[_0x2e80('0x22')],'applicationId':_0x385191[_0x2e80('0x6f')]},'headers':{'Authorization':util[_0x2e80('0x43')](_0x2e80('0x45'),new Buffer(_0x3d1a65)[_0x2e80('0x46')]('base64'))},'json':!![]};rp(_0x2e067f)[_0x2e80('0x17')](function(_0x49d87c){if(_0x49d87c['id']){var _0x54e886={'messageId':_0x49d87c['id']};return _0xeb104c['update'](_0x54e886);}else{logger[_0x2e80('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2e80('0x2a'),_0x2e80('0x6b'),util[_0x2e80('0x39')](_0x49d87c,{'showHidden':![],'depth':null}));}})[_0x2e80('0x28')](function(_0x81879e){logger[_0x2e80('0x29')](_0x2e80('0x2b'),_0x2e80('0x2a'),'bandwidth',util[_0x2e80('0x39')](_0x81879e,{'showHidden':![],'depth':null}));});}else{logger[_0x2e80('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2e80('0x2a'),_0x2e80('0x6b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x2e80('0x70'):if(_0x385191[_0x2e80('0x68')]){var _0x26683d={};var _0x5326f1={'method':_0x2e80('0x44'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x2e80('0x71')+_0x385191['apiKey'],'Content-Type':_0x2e80('0x54')},'body':{'from':_0x385191[_0x2e80('0x22')],'to':_0x5c182e[_0x2e80('0x22')],'text':_0x5c182e[_0x2e80('0x21')]},'json':!![]};return rp(_0x5326f1)[_0x2e80('0x17')](function(_0x2f47d7){if(_0x2f47d7[_0x2e80('0x72')]==0xca){_0x26683d[_0x2e80('0x73')]=_0x2f47d7;var _0x17663c={'method':_0x2e80('0x44'),'uri':_0x2e80('0x74'),'headers':{'Authorization':_0x2e80('0x71')+_0x385191[_0x2e80('0x68')],'Content-Type':_0x2e80('0x54')},'body':{'refid':_0x26683d[_0x2e80('0x73')]['refid']},'json':!![]};return rp(_0x17663c)[_0x2e80('0x17')](function(_0x426860){_0x26683d[_0x2e80('0x75')]=_0x426860;var _0x4058e9={'messageId':_0x26683d[_0x2e80('0x73')]['refid'],'read':!![]};return _0xeb104c[_0x2e80('0x18')](_0x4058e9);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2e80('0x2a'),'intelepeer',util[_0x2e80('0x39')](_0x2f47d7,{'showHidden':![],'depth':null}));}})[_0x2e80('0x28')](function(_0x5d7f93){return logger[_0x2e80('0x29')](_0x2e80('0x2b'),_0x2e80('0x2a'),_0x2e80('0x70'),util[_0x2e80('0x39')](_0x5d7f93,{'showHidden':![],'depth':null}));});}else{return logger[_0x2e80('0x29')](_0x2e80('0x2b'),'afterCreate',_0x2e80('0x70'),'Token\x20not\x20received');}break;}}})['finally'](function(){_0x4f9386();});}else{_0x4f9386();}}},'charset':_0x2e80('0x76'),'collate':_0x2e80('0x77')});}; \ No newline at end of file +var _0xee26=['UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','toLowerCase','catch','SmsAccount','find','type','twilio','accountSid','phone','messages','create','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','smsMethod','sender','login?username=','password','GET','split','sms','POST','user_key','session_key','total_sent','read','Missing\x20parameters:\x20username,\x20password','connectel','authToken','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','deliveryReport','clickSend','plivo','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','text','keys','sort','length','apiKey','createHash','hex','id_sms','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','toString','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','status','refid','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','direction','out','isNil'];(function(_0x1554f2,_0x3cb0c7){var _0x55a958=function(_0x4b0aee){while(--_0x4b0aee){_0x1554f2['push'](_0x1554f2['shift']());}};_0x55a958(++_0x3cb0c7);}(_0xee26,0x67));var _0x6ee2=function(_0x160ee8,_0x60f2a5){_0x160ee8=_0x160ee8-0x0;var _0x3d4e80=_0xee26[_0x160ee8];return _0x3d4e80;};'use strict';var _=require(_0x6ee2('0x0'));var util=require('util');var logger=require(_0x6ee2('0x1'))(_0x6ee2('0x2'));var moment=require(_0x6ee2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ee2('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6ee2('0x5'));module[_0x6ee2('0x6')]=function(_0x2f637e,_0xe4b99a){return _0x2f637e[_0x6ee2('0x7')](_0x6ee2('0x8'),attributes,{'tableName':_0x6ee2('0x9'),'paranoid':![],'indexes':[{'name':_0x6ee2('0xa'),'fields':[_0x6ee2('0xa')]},{'name':_0x6ee2('0xb'),'fields':[_0x6ee2('0xc')],'type':_0x6ee2('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x449bdb,_0x3afd37,_0x1d3cce){var _0x52aa70=_0x2f637e['models'];var _0xcbbbda=_0x449bdb['get']({'plain':!![]});if(_0xcbbbda[_0x6ee2('0xe')]['toLowerCase']()==='in'||_0xcbbbda[_0x6ee2('0xe')]['toLowerCase']()===_0x6ee2('0xf')&&!_0xcbbbda['secret']&&!_[_0x6ee2('0x10')](_0xcbbbda[_0x6ee2('0x11')])&&!_[_0x6ee2('0x10')](_0xcbbbda['SmsInteractionId'])){_0x52aa70[_0x6ee2('0x12')][_0x6ee2('0x13')]({'where':{'id':_0xcbbbda[_0x6ee2('0x14')]}})[_0x6ee2('0x15')](function(_0x125d48){if(_0x125d48){_0x125d48[_0x6ee2('0x16')]({'lastMsgAt':_0xcbbbda[_0x6ee2('0x17')],'lastMsgDirection':_0xcbbbda[_0x6ee2('0xe')][_0x6ee2('0x18')]()});}})[_0x6ee2('0x19')](function(_0x10b421){console['error'](_0x10b421);});}if(_0xcbbbda[_0x6ee2('0xe')]===_0x6ee2('0xf')&&!_0xcbbbda['secret']){var _0x2f68fb;_0x52aa70[_0x6ee2('0x1a')][_0x6ee2('0x1b')]({'where':{'id':_0xcbbbda['SmsAccountId']},'raw':!![]})[_0x6ee2('0x15')](function(_0x3995c6){_0x2f68fb=_0x3995c6;if(_0x2f68fb&&_0x2f68fb[_0x6ee2('0x1c')]){switch(_0x2f68fb[_0x6ee2('0x1c')]){case _0x6ee2('0x1d'):var _0x51b0b4=require(_0x6ee2('0x1d'));if(_0x2f68fb[_0x6ee2('0x1e')]&&_0x2f68fb['authToken']&&_0x2f68fb[_0x6ee2('0x1f')]){var _0x3028f4=new _0x51b0b4(_0x2f68fb['accountSid'],_0x2f68fb['authToken']);_0x3028f4[_0x6ee2('0x20')][_0x6ee2('0x21')]({'body':_0xcbbbda[_0x6ee2('0xc')],'to':_0xcbbbda[_0x6ee2('0x1f')],'from':_0x2f68fb[_0x6ee2('0x1f')],'statusCallback':_0x2f68fb['remote']+_0x6ee2('0x22')+_0xcbbbda['id']+_0x6ee2('0x23')+_0x2f68fb[_0x6ee2('0x24')]})[_0x6ee2('0x15')](function(_0x3fe9bc){if(_0x3fe9bc[_0x6ee2('0x25')]){return _0x449bdb['update']({'messageId':_0x3fe9bc['sid']});}})[_0x6ee2('0x19')](function(_0x2d01d5){logger['error'](_0x6ee2('0x26'),_0x6ee2('0x27'),'twilio',util[_0x6ee2('0x28')](_0x2d01d5,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate',_0x6ee2('0x1d'),_0x6ee2('0x2a'));}break;case _0x6ee2('0x2b'):var _0x402db2='https://api.skebby.it/API/v1.0/REST/';if(_0x2f68fb[_0x6ee2('0x2c')]&&_0x2f68fb['password']){var _0x21d464={'recipient':[_0xcbbbda['phone']],'message':_0xcbbbda[_0x6ee2('0xc')],'message_type':_0x2f68fb[_0x6ee2('0x2d')]};if(_0x2f68fb['smsMethod']&&_0x2f68fb['smsMethod']!=='SI'){_0x21d464[_0x6ee2('0x2e')]=_0x2f68fb[_0x6ee2('0x1f')];}var _0x17722={'url':_0x402db2+_0x6ee2('0x2f')+_0x2f68fb['username']+'&password='+_0x2f68fb[_0x6ee2('0x30')],'method':_0x6ee2('0x31')};rp(_0x17722)[_0x6ee2('0x15')](function(_0x46813f){var _0x25903c=_0x46813f[_0x6ee2('0x32')](';');var _0x1d5ad2={'user_key':_0x25903c[0x0],'session_key':_0x25903c[0x1]};_0x17722={'url':_0x402db2+_0x6ee2('0x33'),'method':_0x6ee2('0x34'),'headers':{'user_key':_0x1d5ad2[_0x6ee2('0x35')],'Session_key':_0x1d5ad2[_0x6ee2('0x36')]},'json':!![],'body':_0x21d464};return rp(_0x17722);})['then'](function(_0x4122c0){if(_0x4122c0[_0x6ee2('0x37')]>=0x1){var _0x413d45={'messageId':_0x4122c0['internal_order_id']};if(_0x2f68fb[_0x6ee2('0x2d')]!=='GP'||!_0x2f68fb['deliveryReport']){_0x413d45[_0x6ee2('0x38')]=!![];}return _0x449bdb[_0x6ee2('0x16')](_0x413d45);}else{return logger['error'](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x2b'),util[_0x6ee2('0x28')](_0x4122c0,{'showHidden':![],'depth':null}));}})[_0x6ee2('0x19')](function(_0x27cf19){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ee2('0x27'),_0x6ee2('0x2b'),util[_0x6ee2('0x28')](_0x27cf19,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate',_0x6ee2('0x2b'),_0x6ee2('0x39'));}break;case _0x6ee2('0x3a'):if(_0x2f68fb[_0x6ee2('0x3b')]){var _0x485d75={'recipient':_0xcbbbda[_0x6ee2('0x1f')],'message':_0xcbbbda[_0x6ee2('0xc')],'sender':_0x2f68fb[_0x6ee2('0x3c')]||_0x2f68fb[_0x6ee2('0x1f')],'authorization':_0x2f68fb['authToken']};var _0x3afd37={'method':'POST','uri':_0x6ee2('0x3d'),'body':_0x485d75,'json':!![]};rp(_0x3afd37)[_0x6ee2('0x15')](function(_0x491f76){var _0x11c408={'messageId':_0x491f76[_0x6ee2('0x3e')]};if(!_0x2f68fb['deliveryReport']){_0x11c408[_0x6ee2('0x38')]=!![];}return _0x449bdb[_0x6ee2('0x16')](_0x11c408);})[_0x6ee2('0x19')](function(_0x55aaaf){logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate',_0x6ee2('0x3a'),util[_0x6ee2('0x28')](_0x55aaaf,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x3a'),'Missing\x20parameters:\x20authToken');}break;case _0x6ee2('0x3f'):if(_0x2f68fb[_0x6ee2('0x2c')]&&_0x2f68fb[_0x6ee2('0x30')]){var _0x485d75={'messages':[{'source':_0x6ee2('0x40'),'to':_0xcbbbda[_0x6ee2('0x1f')],'body':_0xcbbbda[_0x6ee2('0xc')],'from':_0x2f68fb[_0x6ee2('0x3c')]||_0x2f68fb[_0x6ee2('0x1f')]}]};var _0x12d42e=util[_0x6ee2('0x41')](_0x6ee2('0x42'),_0x2f68fb['username'],_0x2f68fb[_0x6ee2('0x30')]);var _0x3afd37={'method':_0x6ee2('0x34'),'uri':_0x6ee2('0x43'),'body':_0x485d75,'headers':{'Authorization':util['format'](_0x6ee2('0x44'),new Buffer(_0x12d42e)['toString'](_0x6ee2('0x45')))},'json':!![]};rp(_0x3afd37)['then'](function(_0x3fb0e2){if(_0x3fb0e2['http_code']>=0xc8&&_0x3fb0e2[_0x6ee2('0x46')]<=0xce){if(_0x3fb0e2[_0x6ee2('0x47')]&&_0x3fb0e2[_0x6ee2('0x47')][_0x6ee2('0x48')]>0x0){var _0x1515bc=_[_0x6ee2('0x49')](_0x3fb0e2[_0x6ee2('0x47')]['messages']);var _0x452842={'messageId':_0x1515bc[_0x6ee2('0x4a')]};if(!_0x2f68fb[_0x6ee2('0x4b')]){_0x452842['read']=!![];}return _0x449bdb[_0x6ee2('0x16')](_0x452842);}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate','clickSend',util['inspect'](_0x3fb0e2,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ee2('0x27'),'clickSend',util[_0x6ee2('0x28')](_0x3fb0e2,{'showHidden':![],'depth':null}));}})[_0x6ee2('0x19')](function(_0x1eaf09){logger[_0x6ee2('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ee2('0x27'),_0x6ee2('0x4c'),util['inspect'](_0x1eaf09,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate',_0x6ee2('0x4c'),_0x6ee2('0x39'));}break;case _0x6ee2('0x4d'):if(_0x2f68fb['authId']&&_0x2f68fb[_0x6ee2('0x3b')]){var _0x485d75={'dst':_0xcbbbda['phone'],'text':_0xcbbbda[_0x6ee2('0xc')],'src':_0x2f68fb[_0x6ee2('0x3c')]||_0x2f68fb[_0x6ee2('0x1f')],'url':_0x2f68fb['remote']+_0x6ee2('0x22')+_0xcbbbda['id']+'/status?token='+_0x2f68fb[_0x6ee2('0x24')]};var _0x12d42e=util[_0x6ee2('0x41')](_0x6ee2('0x42'),_0x2f68fb['authId'],_0x2f68fb[_0x6ee2('0x3b')]);var _0x3afd37={'method':'POST','uri':util[_0x6ee2('0x41')](_0x6ee2('0x4e'),_0x2f68fb['authId']),'body':_0x485d75,'headers':{'Authorization':util[_0x6ee2('0x41')](_0x6ee2('0x44'),new Buffer(_0x12d42e)['toString'](_0x6ee2('0x45')))},'json':!![]};rp(_0x3afd37)[_0x6ee2('0x15')](function(_0x128f72){var _0x544a43={'messageId':_0x128f72[_0x6ee2('0x4f')][0x0]};return _0x449bdb[_0x6ee2('0x16')](_0x544a43);})['catch'](function(_0x31f26f){logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x4d'),util[_0x6ee2('0x28')](_0x31f26f,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x4d'),_0x6ee2('0x50'));}break;case _0x6ee2('0x51'):if(_0x2f68fb[_0x6ee2('0x2c')]&&_0x2f68fb[_0x6ee2('0x30')]){if(_0x2f68fb['baseUrl']){var _0x129a87={'method':_0x6ee2('0x34'),'uri':_0x2f68fb[_0x6ee2('0x52')]+_0x6ee2('0x53'),'body':{'username':_0x2f68fb[_0x6ee2('0x2c')],'password':_0x2f68fb['password']},'json':!![]};return rp(_0x129a87)['then'](function(_0x46e7f0){var _0x540dca={'method':_0x6ee2('0x34'),'uri':_0x2f68fb[_0x6ee2('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x2f68fb[_0x6ee2('0x1f')],'destinations':[{'to':_0xcbbbda[_0x6ee2('0x1f')]}],'text':_0xcbbbda[_0x6ee2('0xc')],'notifyUrl':_0x2f68fb['remote']+_0x6ee2('0x22')+_0xcbbbda['id']+'/status?token='+_0x2f68fb[_0x6ee2('0x24')],'notifyContentType':_0x6ee2('0x54'),'callbackData':_0x2f68fb[_0x6ee2('0x1f')]+';'+_0xcbbbda[_0x6ee2('0xc')]}]},'headers':{'Authorization':_0x6ee2('0x55')+_0x46e7f0[_0x6ee2('0x24')]},'json':!![]};return rp(_0x540dca)['then'](function(_0x220eb4){if(_0x220eb4[_0x6ee2('0x20')]){var _0x28e51b={'messageId':_0x220eb4[_0x6ee2('0x20')][0x0]['messageId']};if(!_0x2f68fb[_0x6ee2('0x4b')]){_0x28e51b[_0x6ee2('0x38')]=!![];}return _0x449bdb[_0x6ee2('0x16')](_0x28e51b);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0x6ee2('0x28')](_0x220eb4,{'showHidden':![],'depth':null}));}});})[_0x6ee2('0x19')](function(_0x205a7f){return logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),'infobip',util['inspect'](_0x205a7f,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x51'),_0x6ee2('0x56'));}}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate',_0x6ee2('0x51'),_0x6ee2('0x39'));}break;case _0x6ee2('0x57'):var _0x6a5b9a=require(_0x6ee2('0x58'));if(_0x2f68fb['apiKey']){var _0x562689={};_0x562689[_0x6ee2('0x59')]=_0x2f68fb['username'];_0x562689[_0x6ee2('0x1f')]=_0xcbbbda[_0x6ee2('0x1f')];_0x562689[_0x6ee2('0x2e')]=_0x2f68fb[_0x6ee2('0x1f')];_0x562689[_0x6ee2('0x5a')]=_0xcbbbda[_0x6ee2('0xc')];_0x562689['timestamp']=+new Date();var _0x5544ce='';var _0x2e2b81='';var _0x594832=Object[_0x6ee2('0x5b')](_0x562689);_0x594832[_0x6ee2('0x5c')]();for(var _0x42652c=0x0;_0x42652c<_0x594832[_0x6ee2('0x5d')];_0x42652c++){if(_0x5544ce!=''){_0x5544ce+='&';}_0x5544ce+=_0x594832[_0x42652c]+'='+encodeURIComponent(_0x562689[_0x594832[_0x42652c]]);_0x2e2b81+=_0x562689[_0x594832[_0x42652c]];}_0x2e2b81+=_0x2f68fb[_0x6ee2('0x5e')];_0x2e2b81=_0x6a5b9a[_0x6ee2('0x5f')]('md5')[_0x6ee2('0x16')](_0x2e2b81)['digest'](_0x6ee2('0x60'));if(_0x5544ce!==''){_0x5544ce+='&';}_0x5544ce+='signature='+_0x2e2b81;var _0x17722={'method':_0x6ee2('0x31'),'uri':_0x2f68fb['baseUrl']+'/external/get/send.php?'+_0x5544ce,'json':!![]};return rp(_0x17722)[_0x6ee2('0x15')](function(_0x1bc431){var _0x41728e=Object[_0x6ee2('0x5b')](_0x1bc431);if(_0x1bc431[_0x41728e[0x0]][_0x6ee2('0x29')]&&parseInt(_0x1bc431[_0x41728e[0x0]][_0x6ee2('0x29')])===0x0){var _0x13ad07={'messageId':_0x1bc431[_0x41728e[0x0]][_0x6ee2('0x61')]};if(!_0x2f68fb['deliveryReport']){_0x13ad07['read']=!![];}return _0x449bdb[_0x6ee2('0x16')](_0x13ad07);}else{return logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate',_0x6ee2('0x57'),util[_0x6ee2('0x28')](_0x1bc431[_0x6ee2('0x29')],{'showHidden':![],'depth':null}));}})[_0x6ee2('0x19')](function(_0x42af39){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ee2('0x27'),'csc',util[_0x6ee2('0x28')](_0x42af39,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),'csc','Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x2f68fb[_0x6ee2('0x5e')]){var _0x5ca059={'method':_0x6ee2('0x34'),'uri':_0x6ee2('0x62'),'headers':{'Authorization':_0x2f68fb['apiKey']},'body':{'content':_0xcbbbda['body'],'to':[_0xcbbbda[_0x6ee2('0x1f')]],'from':_0x2f68fb[_0x6ee2('0x1f')],'binary':![],'clientMessageId':_0x6ee2('0x63'),'charset':_0x6ee2('0x64')},'json':!![]};rp(_0x5ca059)[_0x6ee2('0x15')](function(_0x59b1d3){if(!_0x59b1d3[_0x6ee2('0x29')]){var _0x230580={'messageId':_0x59b1d3[_0x6ee2('0x20')][0x0][_0x6ee2('0x65')]};if(!_0x2f68fb[_0x6ee2('0x4b')]){_0x230580['read']=!![];}return _0x449bdb[_0x6ee2('0x16')](_0x230580);}else{return logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate','clickatell',util[_0x6ee2('0x28')](_0x59b1d3[_0x6ee2('0x29')],{'showHidden':![],'depth':null}));}})[_0x6ee2('0x19')](function(_0x684b39){return logger[_0x6ee2('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6ee2('0x27'),_0x6ee2('0x66'),util[_0x6ee2('0x28')](_0x684b39,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),'clickatell',_0x6ee2('0x67'));}break;case'bandwidth':if(_0x2f68fb[_0x6ee2('0x2c')]&&_0x2f68fb['password']){var _0x12d42e=util[_0x6ee2('0x41')](_0x6ee2('0x42'),_0x2f68fb[_0x6ee2('0x2c')],_0x2f68fb[_0x6ee2('0x30')]);var _0x3afd37={'method':_0x6ee2('0x34'),'uri':_0x6ee2('0x68')+_0x2f68fb[_0x6ee2('0x69')]+_0x6ee2('0x6a'),'body':{'to':[_0xcbbbda[_0x6ee2('0x1f')]],'text':_0xcbbbda[_0x6ee2('0xc')],'from':_0x2f68fb[_0x6ee2('0x1f')],'applicationId':_0x2f68fb[_0x6ee2('0x6b')]},'headers':{'Authorization':util['format'](_0x6ee2('0x44'),new Buffer(_0x12d42e)[_0x6ee2('0x6c')]('base64'))},'json':!![]};rp(_0x3afd37)['then'](function(_0x1e090b){if(_0x1e090b['id']){var _0x5e69b4={'messageId':_0x1e090b['id']};return _0x449bdb['update'](_0x5e69b4);}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),'afterCreate',_0x6ee2('0x6d'),util['inspect'](_0x1e090b,{'showHidden':![],'depth':null}));}})[_0x6ee2('0x19')](function(_0x67d8c7){logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),'bandwidth',util[_0x6ee2('0x28')](_0x67d8c7,{'showHidden':![],'depth':null}));});}else{logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x6d'),_0x6ee2('0x39'));}break;case _0x6ee2('0x6e'):if(_0x2f68fb[_0x6ee2('0x5e')]){var _0x1d2ee5={};var _0x17722={'method':_0x6ee2('0x34'),'uri':_0x6ee2('0x6f'),'headers':{'Authorization':_0x6ee2('0x70')+_0x2f68fb[_0x6ee2('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x2f68fb[_0x6ee2('0x1f')],'to':_0xcbbbda[_0x6ee2('0x1f')],'text':_0xcbbbda[_0x6ee2('0xc')]},'json':!![]};return rp(_0x17722)[_0x6ee2('0x15')](function(_0x414d89){if(_0x414d89[_0x6ee2('0x71')]==0xca){_0x1d2ee5['message']=_0x414d89;var _0x5fb92d={'method':_0x6ee2('0x34'),'uri':_0x6ee2('0x72'),'headers':{'Authorization':'Bearer\x20'+_0x2f68fb['apiKey'],'Content-Type':_0x6ee2('0x54')},'body':{'refid':_0x1d2ee5[_0x6ee2('0x73')]['refid']},'json':!![]};return rp(_0x5fb92d)['then'](function(_0x5a70a9){_0x1d2ee5[_0x6ee2('0x74')]=_0x5a70a9;var _0x16484e={'messageId':_0x1d2ee5[_0x6ee2('0x73')][_0x6ee2('0x75')],'read':!![]};return _0x449bdb[_0x6ee2('0x16')](_0x16484e);});}else{return logger[_0x6ee2('0x29')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6ee2('0x6e'),util[_0x6ee2('0x28')](_0x414d89,{'showHidden':![],'depth':null}));}})[_0x6ee2('0x19')](function(_0xc55741){return logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x6e'),util['inspect'](_0xc55741,{'showHidden':![],'depth':null}));});}else{return logger[_0x6ee2('0x29')](_0x6ee2('0x26'),_0x6ee2('0x27'),_0x6ee2('0x6e'),'Token\x20not\x20received');}break;}}})[_0x6ee2('0x76')](function(){_0x1d3cce();});}else{_0x1d3cce();}}},'charset':'utf8mb4','collate':_0x6ee2('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 2d78c04..d721420 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 _0x6369=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create','body','options','CreateSmsMessage','util','moment','bluebird','randomstring'];(function(_0x9995bf,_0x480a08){var _0x571b8a=function(_0x4ecda4){while(--_0x4ecda4){_0x9995bf['push'](_0x9995bf['shift']());}};_0x571b8a(++_0x480a08);}(_0x6369,0xf4));var _0x9636=function(_0x11eb74,_0x15e5ac){_0x11eb74=_0x11eb74-0x0;var _0x3b1666=_0x6369[_0x11eb74];return _0x3b1666;};'use strict';var _=require('lodash');var util=require(_0x9636('0x0'));var moment=require(_0x9636('0x1'));var BPromise=require(_0x9636('0x2'));var rs=require(_0x9636('0x3'));var fs=require('fs');var Redis=require(_0x9636('0x4'));var db=require(_0x9636('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9636('0x6'))(_0x9636('0x7'));var config=require(_0x9636('0x8'));var jayson=require(_0x9636('0x9'));var client=jayson[_0x9636('0xa')][_0x9636('0xb')]({'port':0x232a});config[_0x9636('0xc')]=_[_0x9636('0xd')](config[_0x9636('0xc')],{'host':_0x9636('0xe'),'port':0x18eb});var socket=require(_0x9636('0xf'))(new Redis(config[_0x9636('0xc')]));require(_0x9636('0x10'))['register'](socket);function respondWithRpcPromise(_0x361ef3,_0xfbfb02,_0x14de00){return new BPromise(function(_0x58a0a4,_0x7fb74d){return client[_0x9636('0x11')](_0x361ef3,_0x14de00)['then'](function(_0xd862de){logger[_0x9636('0x12')](_0x9636('0x13'),_0xfbfb02,_0x9636('0x14'));logger['debug'](_0x9636('0x15'),_0xfbfb02,_0x9636('0x14'),JSON[_0x9636('0x16')](_0xd862de));if(_0xd862de[_0x9636('0x17')]){if(_0xd862de[_0x9636('0x17')][_0x9636('0x18')]===0x1f4){logger[_0x9636('0x17')](_0x9636('0x13'),_0xfbfb02,_0xd862de['error']['message']);return _0x7fb74d(_0xd862de[_0x9636('0x17')][_0x9636('0x19')]);}logger['error'](_0x9636('0x13'),_0xfbfb02,_0xd862de[_0x9636('0x17')][_0x9636('0x19')]);return _0x58a0a4(_0xd862de[_0x9636('0x17')][_0x9636('0x19')]);}else{logger[_0x9636('0x12')](_0x9636('0x13'),_0xfbfb02,_0x9636('0x14'));_0x58a0a4(_0xd862de[_0x9636('0x1a')]['message']);}})['catch'](function(_0x146f6c){logger['error'](_0x9636('0x13'),_0xfbfb02,_0x146f6c);_0x7fb74d(_0x146f6c);});});}exports['CreateSmsMessage']=function(_0x2a38da){var _0xabb7a8=this;return new Promise(function(_0x1c36ae,_0x3f3086){return db['SmsMessage'][_0x9636('0x1b')](_0x2a38da[_0x9636('0x1c')],{'raw':_0x2a38da[_0x9636('0x1d')]?_0x2a38da[_0x9636('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x453b17){logger[_0x9636('0x12')]('CreateSmsMessage',_0x2a38da);logger['debug'](_0x9636('0x1e'),_0x2a38da,JSON['stringify'](_0x453b17));_0x1c36ae(_0x453b17);})['catch'](function(_0x58b8f2){logger['error']('CreateSmsMessage',_0x58b8f2['message'],_0x2a38da);_0x3f3086(_0xabb7a8[_0x9636('0x17')](0x1f4,_0x58b8f2['message']));});});}; \ No newline at end of file +var _0x725c=['../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./smsMessage.socket','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsMessage','SmsMessage','body','options','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x18d63d,_0x3c7505){var _0x3fc4d3=function(_0x139485){while(--_0x139485){_0x18d63d['push'](_0x18d63d['shift']());}};_0x3fc4d3(++_0x3c7505);}(_0x725c,0x180));var _0xc725=function(_0x268fdd,_0x46b228){_0x268fdd=_0x268fdd-0x0;var _0x5ce50c=_0x725c[_0x268fdd];return _0x5ce50c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc725('0x0'));var BPromise=require(_0xc725('0x1'));var rs=require(_0xc725('0x2'));var fs=require('fs');var Redis=require(_0xc725('0x3'));var db=require(_0xc725('0x4'))['db'];var utils=require(_0xc725('0x5'));var logger=require(_0xc725('0x6'))(_0xc725('0x7'));var config=require(_0xc725('0x8'));var jayson=require(_0xc725('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xc725('0xa')]=_['defaults'](config['redis'],{'host':_0xc725('0xb'),'port':0x18eb});var socket=require(_0xc725('0xc'))(new Redis(config[_0xc725('0xa')]));require(_0xc725('0xd'))['register'](socket);function respondWithRpcPromise(_0x1aa02d,_0x102b93,_0x4c4ba1){return new BPromise(function(_0x3551d1,_0x292bd9){return client['request'](_0x1aa02d,_0x4c4ba1)[_0xc725('0xe')](function(_0x208a64){logger[_0xc725('0xf')](_0xc725('0x10'),_0x102b93,_0xc725('0x11'));logger[_0xc725('0x12')](_0xc725('0x13'),_0x102b93,_0xc725('0x11'),JSON[_0xc725('0x14')](_0x208a64));if(_0x208a64[_0xc725('0x15')]){if(_0x208a64['error'][_0xc725('0x16')]===0x1f4){logger[_0xc725('0x15')]('SmsMessage,\x20%s,\x20%s',_0x102b93,_0x208a64[_0xc725('0x15')][_0xc725('0x17')]);return _0x292bd9(_0x208a64[_0xc725('0x15')][_0xc725('0x17')]);}logger[_0xc725('0x15')](_0xc725('0x10'),_0x102b93,_0x208a64[_0xc725('0x15')][_0xc725('0x17')]);return _0x3551d1(_0x208a64[_0xc725('0x15')][_0xc725('0x17')]);}else{logger[_0xc725('0xf')](_0xc725('0x10'),_0x102b93,_0xc725('0x11'));_0x3551d1(_0x208a64['result'][_0xc725('0x17')]);}})[_0xc725('0x18')](function(_0x932377){logger[_0xc725('0x15')](_0xc725('0x10'),_0x102b93,_0x932377);_0x292bd9(_0x932377);});});}exports[_0xc725('0x19')]=function(_0x4d67bc){var _0x3ced07=this;return new Promise(function(_0x27ac4d,_0x1d826f){return db[_0xc725('0x1a')]['create'](_0x4d67bc[_0xc725('0x1b')],{'raw':_0x4d67bc['options']?_0x4d67bc[_0xc725('0x1c')][_0xc725('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2f45c9){logger['info'](_0xc725('0x19'),_0x4d67bc);logger[_0xc725('0x12')]('CreateSmsMessage',_0x4d67bc,JSON[_0xc725('0x14')](_0x2f45c9));_0x27ac4d(_0x2f45c9);})[_0xc725('0x18')](function(_0x147366){logger[_0xc725('0x15')](_0xc725('0x19'),_0x147366[_0xc725('0x17')],_0x4d67bc);_0x1d826f(_0x3ced07[_0xc725('0x15')](0x1f4,_0x147366[_0xc725('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 23a48ff..cd0cc34 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 _0xed3f=['./smsMessage.events','remove','update','emit','register'];(function(_0x1004d2,_0x1aab79){var _0x186cb9=function(_0x1c4129){while(--_0x1c4129){_0x1004d2['push'](_0x1004d2['shift']());}};_0x186cb9(++_0x1aab79);}(_0xed3f,0x1d1));var _0xfed3=function(_0x36153d,_0x4fed67){_0x36153d=_0x36153d-0x0;var _0xfdacff=_0xed3f[_0x36153d];return _0xfdacff;};'use strict';var SmsMessageEvents=require(_0xfed3('0x0'));var events=['save',_0xfed3('0x1'),_0xfed3('0x2')];function createListener(_0x3227ed,_0x169c51){return function(_0x3a1531){_0x169c51[_0xfed3('0x3')](_0x3227ed,_0x3a1531);};}function removeListener(_0x4b9e6a,_0x33a1d1){return function(){SmsMessageEvents['removeListener'](_0x4b9e6a,_0x33a1d1);};}exports[_0xfed3('0x4')]=function(_0x48176a){for(var _0xd1b215=0x0,_0x5f04c2=events['length'];_0xd1b215<_0x5f04c2;_0xd1b215++){var _0x71a40c=events[_0xd1b215];var _0x599a12=createListener('smsMessage:'+_0x71a40c,_0x48176a);SmsMessageEvents['on'](_0x71a40c,_0x599a12);}}; \ No newline at end of file +var _0xa366=['length','smsMessage:','./smsMessage.events','remove','emit','removeListener'];(function(_0x521f96,_0x2561cf){var _0x299995=function(_0x1299b5){while(--_0x1299b5){_0x521f96['push'](_0x521f96['shift']());}};_0x299995(++_0x2561cf);}(_0xa366,0x194));var _0x6a36=function(_0x379245,_0x32a201){_0x379245=_0x379245-0x0;var _0x4711b5=_0xa366[_0x379245];return _0x4711b5;};'use strict';var SmsMessageEvents=require(_0x6a36('0x0'));var events=['save',_0x6a36('0x1'),'update'];function createListener(_0x357353,_0x390f12){return function(_0x832ace){_0x390f12[_0x6a36('0x2')](_0x357353,_0x832ace);};}function removeListener(_0x57f505,_0x22434c){return function(){SmsMessageEvents[_0x6a36('0x3')](_0x57f505,_0x22434c);};}exports['register']=function(_0xbc641f){for(var _0x539e72=0x0,_0x3efdbd=events[_0x6a36('0x4')];_0x539e72<_0x3efdbd;_0x539e72++){var _0x38b806=events[_0x539e72];var _0x41fcb1=createListener(_0x6a36('0x5')+_0x38b806,_0xbc641f);SmsMessageEvents['on'](_0x38b806,_0x41fcb1);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index bc6a9c9..b2466f7 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 _0x0763=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addAgents','update','removeTeams','delete','exports','multer'];(function(_0x5c1309,_0x51f5fc){var _0x46d353=function(_0x2960a6){while(--_0x2960a6){_0x5c1309['push'](_0x5c1309['shift']());}};_0x46d353(++_0x51f5fc);}(_0x0763,0x12b));var _0x3076=function(_0x5adb18,_0x222326){_0x5adb18=_0x5adb18-0x0;var _0x420c98=_0x0763[_0x5adb18];return _0x420c98;};'use strict';var multer=require(_0x3076('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3076('0x1'));var express=require(_0x3076('0x2'));var router=express[_0x3076('0x3')]();var fs_extra=require(_0x3076('0x4'));var auth=require(_0x3076('0x5'));var interaction=require(_0x3076('0x6'));var config=require(_0x3076('0x7'));var controller=require('./smsQueue.controller');router[_0x3076('0x8')]('/',auth[_0x3076('0x9')](),controller[_0x3076('0xa')]);router[_0x3076('0x8')](_0x3076('0xb'),auth[_0x3076('0x9')](),controller['describe']);router[_0x3076('0x8')](_0x3076('0xc'),auth[_0x3076('0x9')](),controller[_0x3076('0xd')]);router[_0x3076('0x8')](_0x3076('0xe'),auth[_0x3076('0x9')](),controller[_0x3076('0xf')]);router['get'](_0x3076('0x10'),auth['isAuthenticated'](),controller[_0x3076('0x11')]);router[_0x3076('0x8')](_0x3076('0x12'),auth[_0x3076('0x9')](),controller['getAgents']);router[_0x3076('0x13')]('/',auth[_0x3076('0x9')](),controller['create']);router['post']('/:id/teams',auth[_0x3076('0x9')](),controller['addTeams']);router[_0x3076('0x13')](_0x3076('0x12'),auth[_0x3076('0x9')](),controller[_0x3076('0x14')]);router['put'](_0x3076('0xc'),auth[_0x3076('0x9')](),controller[_0x3076('0x15')]);router['delete'](_0x3076('0xc'),auth[_0x3076('0x9')](),controller['destroy']);router['delete'](_0x3076('0x10'),auth['isAuthenticated'](),controller[_0x3076('0x16')]);router[_0x3076('0x17')](_0x3076('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x3076('0x18')]=router; \ No newline at end of file +var _0x5a5c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x1df477,_0x283d12){var _0x1854bd=function(_0x465b68){while(--_0x465b68){_0x1df477['push'](_0x1df477['shift']());}};_0x1854bd(++_0x283d12);}(_0x5a5c,0xe0));var _0xc5a5=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x5a5c[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0xc5a5('0x0'));var util=require(_0xc5a5('0x1'));var path=require(_0xc5a5('0x2'));var timeout=require(_0xc5a5('0x3'));var express=require(_0xc5a5('0x4'));var router=express[_0xc5a5('0x5')]();var fs_extra=require(_0xc5a5('0x6'));var auth=require(_0xc5a5('0x7'));var interaction=require(_0xc5a5('0x8'));var config=require(_0xc5a5('0x9'));var controller=require(_0xc5a5('0xa'));router[_0xc5a5('0xb')]('/',auth['isAuthenticated'](),controller[_0xc5a5('0xc')]);router['get'](_0xc5a5('0xd'),auth[_0xc5a5('0xe')](),controller['describe']);router['get'](_0xc5a5('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xc5a5('0xb')](_0xc5a5('0x10'),auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x11')]);router[_0xc5a5('0xb')](_0xc5a5('0x12'),auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x13')]);router[_0xc5a5('0xb')](_0xc5a5('0x14'),auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x15')]);router[_0xc5a5('0x16')]('/',auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x17')]);router[_0xc5a5('0x16')](_0xc5a5('0x12'),auth[_0xc5a5('0xe')](),controller['addTeams']);router['post'](_0xc5a5('0x14'),auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x18')]);router[_0xc5a5('0x19')](_0xc5a5('0xf'),auth['isAuthenticated'](),controller[_0xc5a5('0x1a')]);router[_0xc5a5('0x1b')](_0xc5a5('0xf'),auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x1c')]);router[_0xc5a5('0x1b')](_0xc5a5('0x12'),auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x1d')]);router[_0xc5a5('0x1b')]('/:id/users',auth[_0xc5a5('0xe')](),controller[_0xc5a5('0x1e')]);module[_0xc5a5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 0d32753..73fa721 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 _0xf695=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x4d7df6,_0x3f6139){var _0x4c0d29=function(_0x12ae02){while(--_0x12ae02){_0x4d7df6['push'](_0x4d7df6['shift']());}};_0x4c0d29(++_0x3f6139);}(_0xf695,0x1ee));var _0x5f69=function(_0x25f02e,_0x4cc693){_0x25f02e=_0x25f02e-0x0;var _0x9842bb=_0xf695[_0x25f02e];return _0x9842bb;};'use strict';var Sequelize=require(_0x5f69('0x0'));module[_0x5f69('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5f69('0x2')]},'timeout':{'type':Sequelize[_0x5f69('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5f69('0x4')](_0x5f69('0x5'),_0x5f69('0x6'),_0x5f69('0x7'))}}; \ No newline at end of file +var _0x20c1=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4051be,_0x4e30dc){var _0x10d8e5=function(_0x1ae1c2){while(--_0x1ae1c2){_0x4051be['push'](_0x4051be['shift']());}};_0x10d8e5(++_0x4e30dc);}(_0x20c1,0xd7));var _0x120c=function(_0x16d1fa,_0x523fce){_0x16d1fa=_0x16d1fa-0x0;var _0x4e3d7f=_0x20c1[_0x16d1fa];return _0x4e3d7f;};'use strict';var Sequelize=require(_0x120c('0x0'));module[_0x120c('0x1')]={'name':{'type':Sequelize[_0x120c('0x2')],'unique':_0x120c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x120c('0x2')]},'timeout':{'type':Sequelize[_0x120c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x120c('0x5')](_0x120c('0x6'),_0x120c('0x7'),_0x120c('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 2568463..82ae689 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 _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x5d99ad,_0xfb8fc9){var _0x178f64=function(_0x3abb8b){while(--_0x3abb8b){_0x5d99ad['push'](_0x5d99ad['shift']());}};_0x178f64(++_0xfb8fc9);}(_0x2ef3,0xba));var _0x32ef=function(_0x5e88a0,_0x5b45b0){_0x5e88a0=_0x5e88a0-0x0;var _0x419a75=_0x2ef3[_0x5e88a0];return _0x419a75;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file +var _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x0b0e,0x187));var _0xe0b0=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0x0b0e[_0x280ae7];return _0x418b9e;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 5fa3a4a..e05465e 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 _0x4203=['exports','../../mysqldb','SmsQueue','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x22d195,_0x7c2407){var _0x3c5df5=function(_0x4ed91f){while(--_0x4ed91f){_0x22d195['push'](_0x22d195['shift']());}};_0x3c5df5(++_0x7c2407);}(_0x4203,0x179));var _0x3420=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x4203[_0x2cfb58];return _0xd99951;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x3420('0x0'))['db'][_0x3420('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3420('0x2')](0x0);var events={'afterCreate':_0x3420('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x9bd4bb){return function(_0x2ae069,_0x544272,_0x27b72d){SmsQueueEvents[_0x3420('0x4')](_0x9bd4bb+':'+_0x2ae069['id'],_0x2ae069);SmsQueueEvents[_0x3420('0x4')](_0x9bd4bb,_0x2ae069);_0x27b72d(null);};}for(var e in events){if(events[_0x3420('0x5')](e)){var event=events[e];SmsQueue[_0x3420('0x6')](e,emitEvent(event));}}module[_0x3420('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x082b=['events','../../mysqldb','SmsQueue','setMaxListeners','update','remove','emit','hook'];(function(_0xd197e2,_0x31e432){var _0x554589=function(_0x2c9884){while(--_0x2c9884){_0xd197e2['push'](_0xd197e2['shift']());}};_0x554589(++_0x31e432);}(_0x082b,0x78));var _0xb082=function(_0x48686d,_0x3e1a3f){_0x48686d=_0x48686d-0x0;var _0x1e696e=_0x082b[_0x48686d];return _0x1e696e;};'use strict';var EventEmitter=require(_0xb082('0x0'));var SmsQueue=require(_0xb082('0x1'))['db'][_0xb082('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb082('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb082('0x4'),'afterDestroy':_0xb082('0x5')};function emitEvent(_0x16b8c6){return function(_0x2a59a3,_0x266e01,_0x12ddf9){SmsQueueEvents[_0xb082('0x6')](_0x16b8c6+':'+_0x2a59a3['id'],_0x2a59a3);SmsQueueEvents[_0xb082('0x6')](_0x16b8c6,_0x2a59a3);_0x12ddf9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xb082('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index c221d6f..df29cea 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 _0x55ee=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash','util'];(function(_0x34b430,_0x5f3bc7){var _0xc4f820=function(_0x29fe49){while(--_0x29fe49){_0x34b430['push'](_0x34b430['shift']());}};_0xc4f820(++_0x5f3bc7);}(_0x55ee,0x15d));var _0xe55e=function(_0x45e58c,_0x42a7c9){_0x45e58c=_0x45e58c-0x0;var _0x2672f2=_0x55ee[_0x45e58c];return _0x2672f2;};'use strict';var _=require(_0xe55e('0x0'));var util=require(_0xe55e('0x1'));var logger=require('../../config/logger')(_0xe55e('0x2'));var moment=require(_0xe55e('0x3'));var BPromise=require(_0xe55e('0x4'));var rp=require(_0xe55e('0x5'));var fs=require('fs');var path=require(_0xe55e('0x6'));var rimraf=require(_0xe55e('0x7'));var config=require(_0xe55e('0x8'));var attributes=require(_0xe55e('0x9'));module[_0xe55e('0xa')]=function(_0x22ecac,_0xdc314d){return _0x22ecac[_0xe55e('0xb')](_0xe55e('0xc'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd421=['SmsQueue','sms_queues','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','define'];(function(_0x204967,_0x50bb66){var _0x31fca9=function(_0x1f2262){while(--_0x1f2262){_0x204967['push'](_0x204967['shift']());}};_0x31fca9(++_0x50bb66);}(_0xd421,0x10a));var _0x1d42=function(_0x6e5c53,_0x1212a4){_0x6e5c53=_0x6e5c53-0x0;var _0x49b50a=_0xd421[_0x6e5c53];return _0x49b50a;};'use strict';var _=require(_0x1d42('0x0'));var util=require(_0x1d42('0x1'));var logger=require('../../config/logger')(_0x1d42('0x2'));var moment=require(_0x1d42('0x3'));var BPromise=require(_0x1d42('0x4'));var rp=require(_0x1d42('0x5'));var fs=require('fs');var path=require(_0x1d42('0x6'));var rimraf=require('rimraf');var config=require(_0x1d42('0x7'));var attributes=require(_0x1d42('0x8'));module['exports']=function(_0x1a76dc,_0x1bfdcb){return _0x1a76dc[_0x1d42('0x9')](_0x1d42('0xa'),attributes,{'tableName':_0x1d42('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 eafbfe5..68c0c0a 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 _0xe397=['redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowSmsQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xe397,0x73));var _0x7e39=function(_0x1a5e09,_0x52bc08){_0x1a5e09=_0x1a5e09-0x0;var _0x586e67=_0xe397[_0x1a5e09];return _0x586e67;};'use strict';var _=require(_0x7e39('0x0'));var util=require(_0x7e39('0x1'));var moment=require(_0x7e39('0x2'));var BPromise=require('bluebird');var rs=require(_0x7e39('0x3'));var fs=require('fs');var Redis=require(_0x7e39('0x4'));var db=require(_0x7e39('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e39('0x6'))('rpc');var config=require(_0x7e39('0x7'));var jayson=require(_0x7e39('0x8'));var client=jayson[_0x7e39('0x9')][_0x7e39('0xa')]({'port':0x232a});config[_0x7e39('0xb')]=_[_0x7e39('0xc')](config[_0x7e39('0xb')],{'host':_0x7e39('0xd'),'port':0x18eb});var socket=require(_0x7e39('0xe'))(new Redis(config['redis']));require(_0x7e39('0xf'))[_0x7e39('0x10')](socket);function respondWithRpcPromise(_0x527ea5,_0x1b44f5,_0x5841f9){return new BPromise(function(_0x42b73f,_0x2f6eb7){return client[_0x7e39('0x11')](_0x527ea5,_0x5841f9)[_0x7e39('0x12')](function(_0x234285){logger[_0x7e39('0x13')](_0x7e39('0x14'),_0x1b44f5,_0x7e39('0x15'));logger[_0x7e39('0x16')](_0x7e39('0x17'),_0x1b44f5,_0x7e39('0x15'),JSON['stringify'](_0x234285));if(_0x234285['error']){if(_0x234285[_0x7e39('0x18')][_0x7e39('0x19')]===0x1f4){logger[_0x7e39('0x18')](_0x7e39('0x14'),_0x1b44f5,_0x234285[_0x7e39('0x18')]['message']);return _0x2f6eb7(_0x234285[_0x7e39('0x18')][_0x7e39('0x1a')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x1b44f5,_0x234285[_0x7e39('0x18')][_0x7e39('0x1a')]);return _0x42b73f(_0x234285['error'][_0x7e39('0x1a')]);}else{logger[_0x7e39('0x13')](_0x7e39('0x14'),_0x1b44f5,_0x7e39('0x15'));_0x42b73f(_0x234285['result'][_0x7e39('0x1a')]);}})[_0x7e39('0x1b')](function(_0x2f188a){logger[_0x7e39('0x18')](_0x7e39('0x14'),_0x1b44f5,_0x2f188a);_0x2f6eb7(_0x2f188a);});});}exports[_0x7e39('0x1c')]=function(_0x2f918f){var _0x17f40f=this;return new Promise(function(_0x49fc0c,_0x47e376){return db[_0x7e39('0x1d')][_0x7e39('0x1e')]({'raw':_0x2f918f[_0x7e39('0x1f')]?_0x2f918f['options'][_0x7e39('0x20')]===undefined?!![]:![]:!![],'where':_0x2f918f[_0x7e39('0x1f')]?_0x2f918f['options'][_0x7e39('0x21')]||null:null,'attributes':_0x2f918f['options']?_0x2f918f[_0x7e39('0x1f')][_0x7e39('0x22')]||null:null,'limit':_0x2f918f['options']?_0x2f918f['options'][_0x7e39('0x23')]||null:null,'include':_0x2f918f[_0x7e39('0x1f')]?_0x2f918f[_0x7e39('0x1f')][_0x7e39('0x24')]?_[_0x7e39('0x25')](_0x2f918f[_0x7e39('0x1f')][_0x7e39('0x24')],function(_0x495006){return{'model':db[_0x495006[_0x7e39('0x26')]],'as':_0x495006['as'],'attributes':_0x495006[_0x7e39('0x22')],'include':_0x495006[_0x7e39('0x24')]?_[_0x7e39('0x25')](_0x495006[_0x7e39('0x24')],function(_0x42fb1b){return{'model':db[_0x42fb1b['model']],'as':_0x42fb1b['as'],'attributes':_0x42fb1b[_0x7e39('0x22')],'include':_0x42fb1b['include']?_['map'](_0x42fb1b['include'],function(_0x3d4b30){return{'model':db[_0x3d4b30[_0x7e39('0x26')]],'as':_0x3d4b30['as'],'attributes':_0x3d4b30[_0x7e39('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7e39('0x12')](function(_0x59e826){logger[_0x7e39('0x13')](_0x7e39('0x1c'),_0x2f918f);logger['debug'](_0x7e39('0x1c'),_0x2f918f,JSON[_0x7e39('0x27')](_0x59e826));_0x49fc0c(_0x59e826);})[_0x7e39('0x1b')](function(_0x250637){logger[_0x7e39('0x18')](_0x7e39('0x1c'),_0x250637[_0x7e39('0x1a')],_0x2f918f);_0x47e376(_0x17f40f[_0x7e39('0x18')](0x1f4,_0x250637[_0x7e39('0x1a')]));});});};exports[_0x7e39('0x28')]=function(_0x56b437){var _0x5c800d=this;return new Promise(function(_0xccba8f,_0x1059ad){return db[_0x7e39('0x1d')][_0x7e39('0x29')]({'raw':_0x56b437[_0x7e39('0x1f')]?_0x56b437[_0x7e39('0x1f')][_0x7e39('0x20')]===undefined?!![]:![]:!![],'where':_0x56b437[_0x7e39('0x1f')]?_0x56b437[_0x7e39('0x1f')]['where']||null:null,'attributes':_0x56b437[_0x7e39('0x1f')]?_0x56b437[_0x7e39('0x1f')][_0x7e39('0x22')]||null:null,'include':_0x56b437['options']?_0x56b437['options'][_0x7e39('0x24')]?_['map'](_0x56b437[_0x7e39('0x1f')][_0x7e39('0x24')],function(_0x19339e){return{'model':db[_0x19339e[_0x7e39('0x26')]],'as':_0x19339e['as'],'attributes':_0x19339e[_0x7e39('0x22')],'include':_0x19339e['include']?_[_0x7e39('0x25')](_0x19339e[_0x7e39('0x24')],function(_0x4d9b40){return{'model':db[_0x4d9b40[_0x7e39('0x26')]],'as':_0x4d9b40['as'],'attributes':_0x4d9b40['attributes'],'include':_0x4d9b40[_0x7e39('0x24')]?_[_0x7e39('0x25')](_0x4d9b40[_0x7e39('0x24')],function(_0x54d94e){return{'model':db[_0x54d94e[_0x7e39('0x26')]],'as':_0x54d94e['as'],'attributes':_0x54d94e[_0x7e39('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x418597){logger['info']('ShowSmsQueue',_0x56b437);logger['debug'](_0x7e39('0x28'),_0x56b437,JSON[_0x7e39('0x27')](_0x418597));_0xccba8f(_0x418597);})[_0x7e39('0x1b')](function(_0x296dd4){logger[_0x7e39('0x18')](_0x7e39('0x28'),_0x296dd4[_0x7e39('0x1a')],_0x56b437);_0x1059ad(_0x5c800d[_0x7e39('0x18')](0x1f4,_0x296dd4[_0x7e39('0x1a')]));});});}; \ No newline at end of file +var _0x212a=['findAll','options','raw','attributes','limit','include','map','model','then','ShowSmsQueue','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue'];(function(_0x187e82,_0x5254eb){var _0x58625e=function(_0x59d14d){while(--_0x59d14d){_0x187e82['push'](_0x187e82['shift']());}};_0x58625e(++_0x5254eb);}(_0x212a,0x1a1));var _0xa212=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x212a[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xa212('0x0'));var util=require(_0xa212('0x1'));var moment=require('moment');var BPromise=require(_0xa212('0x2'));var rs=require(_0xa212('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa212('0x4'))['db'];var utils=require(_0xa212('0x5'));var logger=require(_0xa212('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa212('0x7'));var client=jayson['client'][_0xa212('0x8')]({'port':0x232a});config[_0xa212('0x9')]=_[_0xa212('0xa')](config['redis'],{'host':_0xa212('0xb'),'port':0x18eb});var socket=require(_0xa212('0xc'))(new Redis(config[_0xa212('0x9')]));require('./smsQueue.socket')[_0xa212('0xd')](socket);function respondWithRpcPromise(_0x2e0ac5,_0x11951e,_0x1dabb0){return new BPromise(function(_0x4a850e,_0x4f034d){return client[_0xa212('0xe')](_0x2e0ac5,_0x1dabb0)['then'](function(_0x1ea7ec){logger[_0xa212('0xf')](_0xa212('0x10'),_0x11951e,_0xa212('0x11'));logger[_0xa212('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x11951e,_0xa212('0x11'),JSON[_0xa212('0x13')](_0x1ea7ec));if(_0x1ea7ec[_0xa212('0x14')]){if(_0x1ea7ec[_0xa212('0x14')][_0xa212('0x15')]===0x1f4){logger[_0xa212('0x14')](_0xa212('0x10'),_0x11951e,_0x1ea7ec['error'][_0xa212('0x16')]);return _0x4f034d(_0x1ea7ec[_0xa212('0x14')][_0xa212('0x16')]);}logger[_0xa212('0x14')](_0xa212('0x10'),_0x11951e,_0x1ea7ec['error'][_0xa212('0x16')]);return _0x4a850e(_0x1ea7ec[_0xa212('0x14')][_0xa212('0x16')]);}else{logger[_0xa212('0xf')](_0xa212('0x10'),_0x11951e,_0xa212('0x11'));_0x4a850e(_0x1ea7ec[_0xa212('0x17')][_0xa212('0x16')]);}})[_0xa212('0x18')](function(_0x36942b){logger['error'](_0xa212('0x10'),_0x11951e,_0x36942b);_0x4f034d(_0x36942b);});});}exports[_0xa212('0x19')]=function(_0x337a64){var _0x3051e1=this;return new Promise(function(_0x2c7db6,_0x47429b){return db[_0xa212('0x1a')][_0xa212('0x1b')]({'raw':_0x337a64[_0xa212('0x1c')]?_0x337a64[_0xa212('0x1c')][_0xa212('0x1d')]===undefined?!![]:![]:!![],'where':_0x337a64['options']?_0x337a64[_0xa212('0x1c')]['where']||null:null,'attributes':_0x337a64[_0xa212('0x1c')]?_0x337a64[_0xa212('0x1c')][_0xa212('0x1e')]||null:null,'limit':_0x337a64[_0xa212('0x1c')]?_0x337a64['options'][_0xa212('0x1f')]||null:null,'include':_0x337a64['options']?_0x337a64[_0xa212('0x1c')][_0xa212('0x20')]?_[_0xa212('0x21')](_0x337a64[_0xa212('0x1c')][_0xa212('0x20')],function(_0x9bf3fe){return{'model':db[_0x9bf3fe[_0xa212('0x22')]],'as':_0x9bf3fe['as'],'attributes':_0x9bf3fe['attributes'],'include':_0x9bf3fe[_0xa212('0x20')]?_[_0xa212('0x21')](_0x9bf3fe[_0xa212('0x20')],function(_0x4bf2ab){return{'model':db[_0x4bf2ab[_0xa212('0x22')]],'as':_0x4bf2ab['as'],'attributes':_0x4bf2ab[_0xa212('0x1e')],'include':_0x4bf2ab[_0xa212('0x20')]?_[_0xa212('0x21')](_0x4bf2ab['include'],function(_0x38847b){return{'model':db[_0x38847b[_0xa212('0x22')]],'as':_0x38847b['as'],'attributes':_0x38847b[_0xa212('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa212('0x23')](function(_0x407758){logger['info'](_0xa212('0x19'),_0x337a64);logger[_0xa212('0x12')](_0xa212('0x19'),_0x337a64,JSON[_0xa212('0x13')](_0x407758));_0x2c7db6(_0x407758);})['catch'](function(_0xb7b7ae){logger['error'](_0xa212('0x19'),_0xb7b7ae['message'],_0x337a64);_0x47429b(_0x3051e1[_0xa212('0x14')](0x1f4,_0xb7b7ae[_0xa212('0x16')]));});});};exports['ShowSmsQueue']=function(_0x56afce){var _0x5c9fa5=this;return new Promise(function(_0x584b40,_0x54362b){return db[_0xa212('0x1a')]['find']({'raw':_0x56afce[_0xa212('0x1c')]?_0x56afce[_0xa212('0x1c')][_0xa212('0x1d')]===undefined?!![]:![]:!![],'where':_0x56afce['options']?_0x56afce[_0xa212('0x1c')]['where']||null:null,'attributes':_0x56afce[_0xa212('0x1c')]?_0x56afce[_0xa212('0x1c')]['attributes']||null:null,'include':_0x56afce[_0xa212('0x1c')]?_0x56afce[_0xa212('0x1c')][_0xa212('0x20')]?_['map'](_0x56afce['options'][_0xa212('0x20')],function(_0x5e432d){return{'model':db[_0x5e432d['model']],'as':_0x5e432d['as'],'attributes':_0x5e432d[_0xa212('0x1e')],'include':_0x5e432d[_0xa212('0x20')]?_[_0xa212('0x21')](_0x5e432d[_0xa212('0x20')],function(_0x6cf046){return{'model':db[_0x6cf046[_0xa212('0x22')]],'as':_0x6cf046['as'],'attributes':_0x6cf046[_0xa212('0x1e')],'include':_0x6cf046['include']?_[_0xa212('0x21')](_0x6cf046[_0xa212('0x20')],function(_0x412ed2){return{'model':db[_0x412ed2[_0xa212('0x22')]],'as':_0x412ed2['as'],'attributes':_0x412ed2['attributes']};}):[]};}):[]};}):[]:[]})[_0xa212('0x23')](function(_0x30281a){logger[_0xa212('0xf')](_0xa212('0x24'),_0x56afce);logger['debug'](_0xa212('0x24'),_0x56afce,JSON[_0xa212('0x13')](_0x30281a));_0x584b40(_0x30281a);})[_0xa212('0x18')](function(_0x3938a3){logger['error'](_0xa212('0x24'),_0x3938a3[_0xa212('0x16')],_0x56afce);_0x54362b(_0x5c9fa5[_0xa212('0x14')](0x1f4,_0x3938a3[_0xa212('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 7778cdc..0e48f24 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 _0x7898=['smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener','length'];(function(_0xf24049,_0x983435){var _0x5a7964=function(_0x4a4cab){while(--_0x4a4cab){_0xf24049['push'](_0xf24049['shift']());}};_0x5a7964(++_0x983435);}(_0x7898,0xa9));var _0x8789=function(_0x368726,_0x4a651d){_0x368726=_0x368726-0x0;var _0x3fc2e7=_0x7898[_0x368726];return _0x3fc2e7;};'use strict';var SmsQueueEvents=require(_0x8789('0x0'));var events=[_0x8789('0x1'),_0x8789('0x2'),_0x8789('0x3')];function createListener(_0x402692,_0x570952){return function(_0x27f678){_0x570952[_0x8789('0x4')](_0x402692,_0x27f678);};}function removeListener(_0x29f223,_0x223327){return function(){SmsQueueEvents[_0x8789('0x5')](_0x29f223,_0x223327);};}exports['register']=function(_0x18261b){for(var _0x16da13=0x0,_0x236c6c=events[_0x8789('0x6')];_0x16da13<_0x236c6c;_0x16da13++){var _0xe97723=events[_0x16da13];var _0x317004=createListener(_0x8789('0x7')+_0xe97723,_0x18261b);SmsQueueEvents['on'](_0xe97723,_0x317004);}}; \ No newline at end of file +var _0xf81d=['save','remove','update','emit','length','./smsQueue.events'];(function(_0xc54c54,_0x59053b){var _0x476786=function(_0x2d6a30){while(--_0x2d6a30){_0xc54c54['push'](_0xc54c54['shift']());}};_0x476786(++_0x59053b);}(_0xf81d,0xdd));var _0xdf81=function(_0x2b10c0,_0x59d077){_0x2b10c0=_0x2b10c0-0x0;var _0xbfb816=_0xf81d[_0x2b10c0];return _0xbfb816;};'use strict';var SmsQueueEvents=require(_0xdf81('0x0'));var events=[_0xdf81('0x1'),_0xdf81('0x2'),_0xdf81('0x3')];function createListener(_0xab7e99,_0x2e66f0){return function(_0x2ba194){_0x2e66f0[_0xdf81('0x4')](_0xab7e99,_0x2ba194);};}function removeListener(_0x5ba82f,_0x2f7659){return function(){SmsQueueEvents['removeListener'](_0x5ba82f,_0x2f7659);};}exports['register']=function(_0x45bc4b){for(var _0x2234dd=0x0,_0x47dbb2=events[_0xdf81('0x5')];_0x2234dd<_0x47dbb2;_0x2234dd++){var _0x3f33bb=events[_0x2234dd];var _0x1c17bf=createListener('smsQueue:'+_0x3f33bb,_0x45bc4b);SmsQueueEvents['on'](_0x3f33bb,_0x1c17bf);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 753c785..b5a166a 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 _0x277c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','show','post','create','update','delete','destroy','multer','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x277c,0x153));var _0xc277=function(_0x219dc7,_0x44aa38){_0x219dc7=_0x219dc7-0x0;var _0x439689=_0x277c[_0x219dc7];return _0x439689;};'use strict';var multer=require(_0xc277('0x0'));var util=require('util');var path=require(_0xc277('0x1'));var timeout=require(_0xc277('0x2'));var express=require(_0xc277('0x3'));var router=express[_0xc277('0x4')]();var fs_extra=require(_0xc277('0x5'));var auth=require(_0xc277('0x6'));var interaction=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0xc277('0x9')](),controller['index']);router[_0xc277('0xa')]('/describe',auth[_0xc277('0x9')](),controller[_0xc277('0xb')]);router['get'](_0xc277('0xc'),auth[_0xc277('0x9')](),controller[_0xc277('0xd')]);router[_0xc277('0xe')]('/',auth[_0xc277('0x9')](),controller[_0xc277('0xf')]);router['put']('/:id',auth[_0xc277('0x9')](),controller[_0xc277('0x10')]);router[_0xc277('0x11')](_0xc277('0xc'),auth['isAuthenticated'](),controller[_0xc277('0x12')]);module['exports']=router; \ No newline at end of file +var _0x971d=['describe','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x2d12b8,_0x29c46d){var _0x11a143=function(_0x449bbc){while(--_0x449bbc){_0x2d12b8['push'](_0x2d12b8['shift']());}};_0x11a143(++_0x29c46d);}(_0x971d,0xc5));var _0xd971=function(_0x319c52,_0x338316){_0x319c52=_0x319c52-0x0;var _0x164ab7=_0x971d[_0x319c52];return _0x164ab7;};'use strict';var multer=require(_0xd971('0x0'));var util=require(_0xd971('0x1'));var path=require(_0xd971('0x2'));var timeout=require(_0xd971('0x3'));var express=require('express');var router=express[_0xd971('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd971('0x5'));var interaction=require(_0xd971('0x6'));var config=require(_0xd971('0x7'));var controller=require(_0xd971('0x8'));router[_0xd971('0x9')]('/',auth[_0xd971('0xa')](),controller[_0xd971('0xb')]);router[_0xd971('0x9')](_0xd971('0xc'),auth[_0xd971('0xa')](),controller[_0xd971('0xd')]);router['get'](_0xd971('0xe'),auth[_0xd971('0xa')](),controller['show']);router[_0xd971('0xf')]('/',auth[_0xd971('0xa')](),controller[_0xd971('0x10')]);router[_0xd971('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd971('0x12')]);router[_0xd971('0x13')](_0xd971('0xe'),auth[_0xd971('0xa')](),controller['destroy']);module[_0xd971('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b02ea12..9e62a2d 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 _0x1561=['DATE','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1561,0x1bd));var _0x1156=function(_0x4a9bd5,_0x2824d3){_0x4a9bd5=_0x4a9bd5-0x0;var _0x3bf3b9=_0x1561[_0x4a9bd5];return _0x3bf3b9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1156('0x0')]={'uniqueid':{'type':Sequelize[_0x1156('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x1156('0x1')]},'joinAt':{'type':Sequelize[_0x1156('0x2')]},'leaveAt':{'type':Sequelize[_0x1156('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1156('0x2')]},'reason':{'type':Sequelize[_0x1156('0x1')]}}; \ No newline at end of file +var _0x6cd3=['sequelize','exports','DATE'];(function(_0x14a8d5,_0x17b15c){var _0x3a7c52=function(_0x2c1ec7){while(--_0x2c1ec7){_0x14a8d5['push'](_0x14a8d5['shift']());}};_0x3a7c52(++_0x17b15c);}(_0x6cd3,0x1a1));var _0x36cd=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x6cd3[_0xf51c06];return _0x1d5420;};'use strict';var moment=require('moment');var Sequelize=require(_0x36cd('0x0'));module[_0x36cd('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x36cd('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x36cd('0x2')]},'exitAt':{'type':Sequelize[_0x36cd('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 0978207..040ac90 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 _0x05ed=['ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','save','then','destroy','error','name','index','map','rawAttributes','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','SmsQueueReport','includeAll','findAll','show','params','filters','intersection','include','options','find','create','body','catch','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x05ed,0x113));var _0xd05e=function(_0x5a778b,_0x717daa){_0x5a778b=_0x5a778b-0x0;var _0x32f0da=_0x05ed[_0x5a778b];return _0x32f0da;};'use strict';var emlformat=require(_0xd05e('0x0'));var rimraf=require(_0xd05e('0x1'));var zipdir=require(_0xd05e('0x2'));var jsonpatch=require(_0xd05e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd05e('0x4'));var Mustache=require(_0xd05e('0x5'));var util=require('util');var path=require(_0xd05e('0x6'));var sox=require(_0xd05e('0x7'));var csv=require(_0xd05e('0x8'));var ejs=require(_0xd05e('0x9'));var fs=require('fs');var fs_extra=require(_0xd05e('0xa'));var _=require(_0xd05e('0xb'));var squel=require(_0xd05e('0xc'));var crypto=require(_0xd05e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd05e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd05e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd05e('0x10'));var qs=require(_0xd05e('0x11'));var as=require(_0xd05e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd05e('0x13'));var config=require(_0xd05e('0x14'));var licenseUtil=require(_0xd05e('0x15'));var db=require(_0xd05e('0x16'))['db'];function respondWithStatusCode(_0x3e56c5,_0x1ae4b5){_0x1ae4b5=_0x1ae4b5||0xcc;return function(_0x4254ed){if(_0x4254ed){return _0x3e56c5[_0xd05e('0x17')](_0x1ae4b5);}return _0x3e56c5[_0xd05e('0x18')](_0x1ae4b5)[_0xd05e('0x19')]();};}function respondWithResult(_0x224c88,_0x1b255a){_0x1b255a=_0x1b255a||0xc8;return function(_0xd6e084){if(_0xd6e084){return _0x224c88[_0xd05e('0x18')](_0x1b255a)['json'](_0xd6e084);}};}function respondWithFilteredResult(_0x25f1bf,_0x11598e){return function(_0x381bde){if(_0x381bde){var _0x10de27=typeof _0x11598e['offset']===_0xd05e('0x1a')&&typeof _0x11598e['limit']==='undefined';var _0xb0e3f3=_0x381bde[_0xd05e('0x1b')];var _0x203014=_0x10de27?0x0:_0x11598e[_0xd05e('0x1c')];var _0x113768=_0x10de27?_0x381bde[_0xd05e('0x1b')]:_0x11598e[_0xd05e('0x1c')]+_0x11598e[_0xd05e('0x1d')];var _0x1e6c26;if(_0x113768>=_0xb0e3f3){_0x113768=_0xb0e3f3;_0x1e6c26=0xc8;}else{_0x1e6c26=0xce;}_0x25f1bf['status'](_0x1e6c26);return _0x25f1bf['set'](_0xd05e('0x1e'),_0x203014+'-'+_0x113768+'/'+_0xb0e3f3)[_0xd05e('0x1f')](_0x381bde);}return null;};}function patchUpdates(_0x44bd2f){return function(_0x1c6ff0){try{jsonpatch['apply'](_0x1c6ff0,_0x44bd2f,!![]);}catch(_0x2aeaa8){return BPromise['reject'](_0x2aeaa8);}return _0x1c6ff0[_0xd05e('0x20')]();};}function saveUpdates(_0x2e2260,_0x2f3310){return function(_0x10c18d){if(_0x10c18d){return _0x10c18d['update'](_0x2e2260)[_0xd05e('0x21')](function(_0x4e07c1){return _0x4e07c1;});}return null;};}function removeEntity(_0x14b0a8,_0x3fcee5){return function(_0x4d4b98){if(_0x4d4b98){return _0x4d4b98[_0xd05e('0x22')]()[_0xd05e('0x21')](function(){_0x14b0a8[_0xd05e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19affc,_0x4d73e3){return function(_0x27061f){if(!_0x27061f){_0x19affc['sendStatus'](0x194);}return _0x27061f;};}function handleError(_0xb5c33a,_0x4dde17){_0x4dde17=_0x4dde17||0x1f4;return function(_0x3e2e16){logger[_0xd05e('0x23')](_0x3e2e16['stack']);if(_0x3e2e16[_0xd05e('0x24')]){delete _0x3e2e16['name'];}_0xb5c33a['status'](_0x4dde17)['send'](_0x3e2e16);};}exports[_0xd05e('0x25')]=function(_0x52e69a,_0x1b43d8){var _0x1955dd={},_0xba7abc={},_0x4a1273={'count':0x0,'rows':[]};var _0x2fe46a=_[_0xd05e('0x26')](db['SmsQueueReport'][_0xd05e('0x27')],function(_0x56bf79){return{'name':_0x56bf79['fieldName'],'type':_0x56bf79[_0xd05e('0x28')][_0xd05e('0x29')]};});_0xba7abc[_0xd05e('0x2a')]=_[_0xd05e('0x26')](_0x2fe46a,_0xd05e('0x24'));_0xba7abc[_0xd05e('0x2b')]=_[_0xd05e('0x2c')](_0x52e69a[_0xd05e('0x2b')]);_0xba7abc['filters']=_['intersection'](_0xba7abc['model'],_0xba7abc[_0xd05e('0x2b')]);_0x1955dd[_0xd05e('0x2d')]=_['intersection'](_0xba7abc['model'],qs[_0xd05e('0x2e')](_0x52e69a[_0xd05e('0x2b')][_0xd05e('0x2e')]));_0x1955dd[_0xd05e('0x2d')]=_0x1955dd[_0xd05e('0x2d')][_0xd05e('0x2f')]?_0x1955dd[_0xd05e('0x2d')]:_0xba7abc[_0xd05e('0x2a')];if(!_0x52e69a[_0xd05e('0x2b')][_0xd05e('0x30')](_0xd05e('0x31'))){_0x1955dd[_0xd05e('0x1d')]=qs[_0xd05e('0x1d')](_0x52e69a[_0xd05e('0x2b')][_0xd05e('0x1d')]);_0x1955dd[_0xd05e('0x1c')]=qs[_0xd05e('0x1c')](_0x52e69a[_0xd05e('0x2b')][_0xd05e('0x1c')]);}_0x1955dd[_0xd05e('0x32')]=qs[_0xd05e('0x33')](_0x52e69a[_0xd05e('0x2b')][_0xd05e('0x33')]);_0x1955dd['where']=qs['filters'](_[_0xd05e('0x34')](_0x52e69a['query'],_0xba7abc['filters']),_0x2fe46a);if(_0x52e69a[_0xd05e('0x2b')]['filter']){_0x1955dd[_0xd05e('0x35')]=_[_0xd05e('0x36')](_0x1955dd[_0xd05e('0x35')],{'$or':_[_0xd05e('0x26')](_0x2fe46a,function(_0x414462){if(_0x414462[_0xd05e('0x28')]!==_0xd05e('0x37')){var _0x24f6e9={};_0x24f6e9[_0x414462['name']]={'$like':'%'+_0x52e69a['query']['filter']+'%'};return _0x24f6e9;}})});}_0x1955dd=_[_0xd05e('0x36')]({},_0x1955dd,_0x52e69a['options']);var _0x1ebc8d={'where':_0x1955dd['where']};return db[_0xd05e('0x38')][_0xd05e('0x1b')](_0x1ebc8d)['then'](function(_0x16f065){_0x4a1273[_0xd05e('0x1b')]=_0x16f065;if(_0x52e69a['query'][_0xd05e('0x39')]){_0x1955dd['include']=[{'all':!![]}];}return db[_0xd05e('0x38')][_0xd05e('0x3a')](_0x1955dd);})[_0xd05e('0x21')](function(_0xa6dbaf){_0x4a1273['rows']=_0xa6dbaf;return _0x4a1273;})['then'](respondWithFilteredResult(_0x1b43d8,_0x1955dd))['catch'](handleError(_0x1b43d8,null));};exports[_0xd05e('0x3b')]=function(_0x117978,_0x3dc4e3){var _0x1c9afc={'raw':!![],'where':{'id':_0x117978[_0xd05e('0x3c')]['id']}},_0x1aede5={};_0x1aede5['model']=_[_0xd05e('0x2c')](db[_0xd05e('0x38')][_0xd05e('0x27')]);_0x1aede5[_0xd05e('0x2b')]=_[_0xd05e('0x2c')](_0x117978['query']);_0x1aede5[_0xd05e('0x3d')]=_[_0xd05e('0x3e')](_0x1aede5[_0xd05e('0x2a')],_0x1aede5['query']);_0x1c9afc[_0xd05e('0x2d')]=_[_0xd05e('0x3e')](_0x1aede5[_0xd05e('0x2a')],qs[_0xd05e('0x2e')](_0x117978['query'][_0xd05e('0x2e')]));_0x1c9afc[_0xd05e('0x2d')]=_0x1c9afc[_0xd05e('0x2d')]['length']?_0x1c9afc[_0xd05e('0x2d')]:_0x1aede5['model'];if(_0x117978['query'][_0xd05e('0x39')]){_0x1c9afc[_0xd05e('0x3f')]=[{'all':!![]}];}_0x1c9afc=_[_0xd05e('0x36')]({},_0x1c9afc,_0x117978[_0xd05e('0x40')]);return db[_0xd05e('0x38')][_0xd05e('0x41')](_0x1c9afc)[_0xd05e('0x21')](handleEntityNotFound(_0x3dc4e3,null))[_0xd05e('0x21')](respondWithResult(_0x3dc4e3,null))['catch'](handleError(_0x3dc4e3,null));};exports[_0xd05e('0x42')]=function(_0x360654,_0x549f42){return db['SmsQueueReport'][_0xd05e('0x42')](_0x360654[_0xd05e('0x43')],{})['then'](respondWithResult(_0x549f42,0xc9))[_0xd05e('0x44')](handleError(_0x549f42,null));};exports[_0xd05e('0x45')]=function(_0x23c5e5,_0x50b246){if(_0x23c5e5['body']['id']){delete _0x23c5e5[_0xd05e('0x43')]['id'];}return db[_0xd05e('0x38')][_0xd05e('0x41')]({'where':{'id':_0x23c5e5['params']['id']}})['then'](handleEntityNotFound(_0x50b246,null))[_0xd05e('0x21')](saveUpdates(_0x23c5e5[_0xd05e('0x43')],null))['then'](respondWithResult(_0x50b246,null))['catch'](handleError(_0x50b246,null));};exports['destroy']=function(_0x78d809,_0x522d13){return db[_0xd05e('0x38')][_0xd05e('0x41')]({'where':{'id':_0x78d809[_0xd05e('0x3c')]['id']}})[_0xd05e('0x21')](handleEntityNotFound(_0x522d13,null))['then'](removeEntity(_0x522d13,null))['catch'](handleError(_0x522d13,null));};exports['describe']=function(_0x4d8126,_0x42eac4){return db['SmsQueueReport'][_0xd05e('0x46')]()[_0xd05e('0x21')](respondWithResult(_0x42eac4,null))[_0xd05e('0x44')](handleError(_0x42eac4,null));}; \ No newline at end of file +var _0x890b=['reject','update','then','error','stack','name','send','index','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','SmsQueueReport','findAll','catch','show','params','rawAttributes','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0x890b,0x76));var _0xb890=function(_0x359c35,_0x4be680){_0x359c35=_0x359c35-0x0;var _0x816092=_0x890b[_0x359c35];return _0x816092;};'use strict';var emlformat=require(_0xb890('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb890('0x1'));var jsonpatch=require(_0xb890('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb890('0x3'));var Mustache=require('mustache');var util=require(_0xb890('0x4'));var path=require(_0xb890('0x5'));var sox=require('sox');var csv=require(_0xb890('0x6'));var ejs=require(_0xb890('0x7'));var fs=require('fs');var fs_extra=require(_0xb890('0x8'));var _=require(_0xb890('0x9'));var squel=require(_0xb890('0xa'));var crypto=require(_0xb890('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb890('0xc'));var toCsv=require(_0xb890('0x6'));var querystring=require(_0xb890('0xd'));var Papa=require(_0xb890('0xe'));var Redis=require(_0xb890('0xf'));var authService=require(_0xb890('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb890('0x11'));var hardwareService=require(_0xb890('0x12'));var logger=require(_0xb890('0x13'))(_0xb890('0x14'));var utils=require(_0xb890('0x15'));var config=require(_0xb890('0x16'));var licenseUtil=require(_0xb890('0x17'));var db=require(_0xb890('0x18'))['db'];function respondWithStatusCode(_0x1948e5,_0x401e47){_0x401e47=_0x401e47||0xcc;return function(_0x4ebcf0){if(_0x4ebcf0){return _0x1948e5[_0xb890('0x19')](_0x401e47);}return _0x1948e5[_0xb890('0x1a')](_0x401e47)['end']();};}function respondWithResult(_0x1187e6,_0x1dd730){_0x1dd730=_0x1dd730||0xc8;return function(_0x89ff77){if(_0x89ff77){return _0x1187e6[_0xb890('0x1a')](_0x1dd730)[_0xb890('0x1b')](_0x89ff77);}};}function respondWithFilteredResult(_0x4ce5ae,_0x361334){return function(_0x626036){if(_0x626036){var _0x141717=typeof _0x361334[_0xb890('0x1c')]===_0xb890('0x1d')&&typeof _0x361334[_0xb890('0x1e')]==='undefined';var _0x5478bf=_0x626036[_0xb890('0x1f')];var _0x39cccc=_0x141717?0x0:_0x361334[_0xb890('0x1c')];var _0x52ff6a=_0x141717?_0x626036[_0xb890('0x1f')]:_0x361334[_0xb890('0x1c')]+_0x361334[_0xb890('0x1e')];var _0x281df5;if(_0x52ff6a>=_0x5478bf){_0x52ff6a=_0x5478bf;_0x281df5=0xc8;}else{_0x281df5=0xce;}_0x4ce5ae[_0xb890('0x1a')](_0x281df5);return _0x4ce5ae['set'](_0xb890('0x20'),_0x39cccc+'-'+_0x52ff6a+'/'+_0x5478bf)[_0xb890('0x1b')](_0x626036);}return null;};}function patchUpdates(_0x57d3e8){return function(_0x5236a4){try{jsonpatch[_0xb890('0x21')](_0x5236a4,_0x57d3e8,!![]);}catch(_0x30b410){return BPromise[_0xb890('0x22')](_0x30b410);}return _0x5236a4['save']();};}function saveUpdates(_0x4a38aa,_0x399627){return function(_0x1f847b){if(_0x1f847b){return _0x1f847b[_0xb890('0x23')](_0x4a38aa)[_0xb890('0x24')](function(_0x32d986){return _0x32d986;});}return null;};}function removeEntity(_0x381521,_0x52273f){return function(_0x2a34bd){if(_0x2a34bd){return _0x2a34bd['destroy']()[_0xb890('0x24')](function(){_0x381521[_0xb890('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9412f,_0x4c8462){return function(_0x786321){if(!_0x786321){_0x9412f[_0xb890('0x19')](0x194);}return _0x786321;};}function handleError(_0x44fe45,_0xf10ce7){_0xf10ce7=_0xf10ce7||0x1f4;return function(_0x1abe66){logger[_0xb890('0x25')](_0x1abe66[_0xb890('0x26')]);if(_0x1abe66[_0xb890('0x27')]){delete _0x1abe66[_0xb890('0x27')];}_0x44fe45[_0xb890('0x1a')](_0xf10ce7)[_0xb890('0x28')](_0x1abe66);};}exports[_0xb890('0x29')]=function(_0x5db907,_0x354999){var _0x2f0981={},_0x52c951={},_0x33e056={'count':0x0,'rows':[]};var _0x91c488=_['map'](db['SmsQueueReport']['rawAttributes'],function(_0x3854fb){return{'name':_0x3854fb[_0xb890('0x2a')],'type':_0x3854fb[_0xb890('0x2b')][_0xb890('0x2c')]};});_0x52c951['model']=_[_0xb890('0x2d')](_0x91c488,_0xb890('0x27'));_0x52c951[_0xb890('0x2e')]=_[_0xb890('0x2f')](_0x5db907[_0xb890('0x2e')]);_0x52c951[_0xb890('0x30')]=_[_0xb890('0x31')](_0x52c951[_0xb890('0x32')],_0x52c951[_0xb890('0x2e')]);_0x2f0981['attributes']=_[_0xb890('0x31')](_0x52c951['model'],qs[_0xb890('0x33')](_0x5db907[_0xb890('0x2e')][_0xb890('0x33')]));_0x2f0981[_0xb890('0x34')]=_0x2f0981[_0xb890('0x34')][_0xb890('0x35')]?_0x2f0981[_0xb890('0x34')]:_0x52c951[_0xb890('0x32')];if(!_0x5db907[_0xb890('0x2e')][_0xb890('0x36')](_0xb890('0x37'))){_0x2f0981['limit']=qs[_0xb890('0x1e')](_0x5db907[_0xb890('0x2e')][_0xb890('0x1e')]);_0x2f0981[_0xb890('0x1c')]=qs['offset'](_0x5db907[_0xb890('0x2e')][_0xb890('0x1c')]);}_0x2f0981[_0xb890('0x38')]=qs[_0xb890('0x39')](_0x5db907[_0xb890('0x2e')][_0xb890('0x39')]);_0x2f0981['where']=qs[_0xb890('0x30')](_[_0xb890('0x3a')](_0x5db907[_0xb890('0x2e')],_0x52c951[_0xb890('0x30')]),_0x91c488);if(_0x5db907['query'][_0xb890('0x3b')]){_0x2f0981[_0xb890('0x3c')]=_[_0xb890('0x3d')](_0x2f0981[_0xb890('0x3c')],{'$or':_['map'](_0x91c488,function(_0x18aacc){if(_0x18aacc['type']!=='VIRTUAL'){var _0x430d63={};_0x430d63[_0x18aacc[_0xb890('0x27')]]={'$like':'%'+_0x5db907[_0xb890('0x2e')]['filter']+'%'};return _0x430d63;}})});}_0x2f0981=_[_0xb890('0x3d')]({},_0x2f0981,_0x5db907[_0xb890('0x3e')]);var _0x59cbcf={'where':_0x2f0981[_0xb890('0x3c')]};return db['SmsQueueReport']['count'](_0x59cbcf)[_0xb890('0x24')](function(_0x5e72ed){_0x33e056['count']=_0x5e72ed;if(_0x5db907['query'][_0xb890('0x3f')]){_0x2f0981[_0xb890('0x40')]=[{'all':!![]}];}return db[_0xb890('0x41')][_0xb890('0x42')](_0x2f0981);})[_0xb890('0x24')](function(_0x414b63){_0x33e056['rows']=_0x414b63;return _0x33e056;})['then'](respondWithFilteredResult(_0x354999,_0x2f0981))[_0xb890('0x43')](handleError(_0x354999,null));};exports[_0xb890('0x44')]=function(_0x6c906a,_0xa0dd4f){var _0x185c87={'raw':!![],'where':{'id':_0x6c906a[_0xb890('0x45')]['id']}},_0x28fce0={};_0x28fce0['model']=_[_0xb890('0x2f')](db[_0xb890('0x41')][_0xb890('0x46')]);_0x28fce0[_0xb890('0x2e')]=_[_0xb890('0x2f')](_0x6c906a[_0xb890('0x2e')]);_0x28fce0[_0xb890('0x30')]=_['intersection'](_0x28fce0[_0xb890('0x32')],_0x28fce0['query']);_0x185c87[_0xb890('0x34')]=_['intersection'](_0x28fce0[_0xb890('0x32')],qs[_0xb890('0x33')](_0x6c906a[_0xb890('0x2e')]['fields']));_0x185c87[_0xb890('0x34')]=_0x185c87[_0xb890('0x34')][_0xb890('0x35')]?_0x185c87[_0xb890('0x34')]:_0x28fce0[_0xb890('0x32')];if(_0x6c906a[_0xb890('0x2e')]['includeAll']){_0x185c87[_0xb890('0x40')]=[{'all':!![]}];}_0x185c87=_[_0xb890('0x3d')]({},_0x185c87,_0x6c906a[_0xb890('0x3e')]);return db[_0xb890('0x41')][_0xb890('0x47')](_0x185c87)['then'](handleEntityNotFound(_0xa0dd4f,null))['then'](respondWithResult(_0xa0dd4f,null))[_0xb890('0x43')](handleError(_0xa0dd4f,null));};exports[_0xb890('0x48')]=function(_0x479514,_0x18f093){return db['SmsQueueReport'][_0xb890('0x48')](_0x479514['body'],{})[_0xb890('0x24')](respondWithResult(_0x18f093,0xc9))[_0xb890('0x43')](handleError(_0x18f093,null));};exports[_0xb890('0x23')]=function(_0x17595a,_0x258ed4){if(_0x17595a['body']['id']){delete _0x17595a[_0xb890('0x49')]['id'];}return db[_0xb890('0x41')][_0xb890('0x47')]({'where':{'id':_0x17595a['params']['id']}})[_0xb890('0x24')](handleEntityNotFound(_0x258ed4,null))[_0xb890('0x24')](saveUpdates(_0x17595a[_0xb890('0x49')],null))[_0xb890('0x24')](respondWithResult(_0x258ed4,null))['catch'](handleError(_0x258ed4,null));};exports[_0xb890('0x4a')]=function(_0x5277ec,_0x354f28){return db[_0xb890('0x41')][_0xb890('0x47')]({'where':{'id':_0x5277ec[_0xb890('0x45')]['id']}})[_0xb890('0x24')](handleEntityNotFound(_0x354f28,null))[_0xb890('0x24')](removeEntity(_0x354f28,null))[_0xb890('0x43')](handleError(_0x354f28,null));};exports[_0xb890('0x4b')]=function(_0x43920b,_0x318f15){return db['SmsQueueReport'][_0xb890('0x4b')]()['then'](respondWithResult(_0x318f15,null))[_0xb890('0x43')](handleError(_0x318f15,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 2f597cf..9978ddb 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x438295,_0x3cb8b3){var _0x4a7201=function(_0x1d9855){while(--_0x1d9855){_0x438295['push'](_0x438295['shift']());}};_0x4a7201(++_0x3cb8b3);}(_0xb7e7,0x121));var _0x7b7e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb7e7[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 076a658..b24a84d 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 _0x16c5=['UpdateSmsQueueReport','update','where','attributes','limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw'];(function(_0x44d74f,_0x242886){var _0x10775f=function(_0x5435b0){while(--_0x5435b0){_0x44d74f['push'](_0x44d74f['shift']());}};_0x10775f(++_0x242886);}(_0x16c5,0xb3));var _0x516c=function(_0x3653ef,_0x32950f){_0x3653ef=_0x3653ef-0x0;var _0x598217=_0x16c5[_0x3653ef];return _0x598217;};'use strict';var _=require('lodash');var util=require(_0x516c('0x0'));var moment=require(_0x516c('0x1'));var BPromise=require('bluebird');var rs=require(_0x516c('0x2'));var fs=require('fs');var Redis=require(_0x516c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x516c('0x4'));var logger=require(_0x516c('0x5'))(_0x516c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x516c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xbb2204,_0x4b249b,_0x45483a){return new BPromise(function(_0x377fcb,_0x28d22d){return client['request'](_0xbb2204,_0x45483a)[_0x516c('0x8')](function(_0x42430f){logger[_0x516c('0x9')](_0x516c('0xa'),_0x4b249b,_0x516c('0xb'));logger[_0x516c('0xc')](_0x516c('0xd'),_0x4b249b,_0x516c('0xb'),JSON[_0x516c('0xe')](_0x42430f));if(_0x42430f[_0x516c('0xf')]){if(_0x42430f[_0x516c('0xf')][_0x516c('0x10')]===0x1f4){logger['error'](_0x516c('0xa'),_0x4b249b,_0x42430f[_0x516c('0xf')]['message']);return _0x28d22d(_0x42430f[_0x516c('0xf')][_0x516c('0x11')]);}logger[_0x516c('0xf')](_0x516c('0xa'),_0x4b249b,_0x42430f[_0x516c('0xf')][_0x516c('0x11')]);return _0x377fcb(_0x42430f[_0x516c('0xf')]['message']);}else{logger[_0x516c('0x9')](_0x516c('0xa'),_0x4b249b,_0x516c('0xb'));_0x377fcb(_0x42430f['result'][_0x516c('0x11')]);}})[_0x516c('0x12')](function(_0x46488f){logger[_0x516c('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x4b249b,_0x46488f);_0x28d22d(_0x46488f);});});}exports[_0x516c('0x13')]=function(_0x4b0b9e){var _0x1d33ec=this;return new Promise(function(_0x44cd46,_0x36dd1a){return db[_0x516c('0x14')][_0x516c('0x15')](_0x4b0b9e['body'],{'raw':_0x4b0b9e['options']?_0x4b0b9e[_0x516c('0x16')][_0x516c('0x17')]===undefined?!![]:![]:!![]})[_0x516c('0x8')](function(_0x1ec7dc){logger[_0x516c('0x9')](_0x516c('0x13'),_0x4b0b9e);logger[_0x516c('0xc')](_0x516c('0x13'),_0x4b0b9e,JSON[_0x516c('0xe')](_0x1ec7dc));_0x44cd46(_0x1ec7dc);})[_0x516c('0x12')](function(_0x20df26){logger['error']('CreateSmsQueueReport',_0x20df26[_0x516c('0x11')],_0x4b0b9e);_0x36dd1a(_0x1d33ec[_0x516c('0xf')](0x1f4,_0x20df26[_0x516c('0x11')]));});});};exports[_0x516c('0x18')]=function(_0x4c1a47){var _0x46caac=this;return new Promise(function(_0x5f94c0,_0x48dca8){return db[_0x516c('0x14')][_0x516c('0x19')](_0x4c1a47['body'],{'raw':_0x4c1a47[_0x516c('0x16')]?_0x4c1a47[_0x516c('0x16')][_0x516c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c1a47['options']?_0x4c1a47[_0x516c('0x16')][_0x516c('0x1a')]||null:null,'attributes':_0x4c1a47[_0x516c('0x16')]?_0x4c1a47[_0x516c('0x16')][_0x516c('0x1b')]||null:null,'limit':_0x4c1a47[_0x516c('0x16')]?_0x4c1a47[_0x516c('0x16')][_0x516c('0x1c')]||null:null})[_0x516c('0x8')](function(_0xead108){logger['info'](_0x516c('0x18'),_0x4c1a47);logger[_0x516c('0xc')](_0x516c('0x18'),_0x4c1a47,JSON[_0x516c('0xe')](_0xead108));_0x5f94c0(_0xead108);})[_0x516c('0x12')](function(_0x45f8d9){logger[_0x516c('0xf')](_0x516c('0x18'),_0x45f8d9[_0x516c('0x11')],_0x4c1a47);_0x48dca8(_0x46caac['error'](0x1f4,_0x45f8d9['message']));});});}; \ No newline at end of file +var _0x640f=['jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','stringify','UpdateSmsQueueReport','update','body','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3c4087,_0x5c764b){var _0x23ad1f=function(_0x39bf1c){while(--_0x39bf1c){_0x3c4087['push'](_0x3c4087['shift']());}};_0x23ad1f(++_0x5c764b);}(_0x640f,0x1ca));var _0xf640=function(_0x23290f,_0x26ef9d){_0x23290f=_0x23290f-0x0;var _0x2b340b=_0x640f[_0x23290f];return _0x2b340b;};'use strict';var _=require(_0xf640('0x0'));var util=require(_0xf640('0x1'));var moment=require(_0xf640('0x2'));var BPromise=require(_0xf640('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf640('0x4'));var db=require(_0xf640('0x5'))['db'];var utils=require(_0xf640('0x6'));var logger=require(_0xf640('0x7'))(_0xf640('0x8'));var config=require(_0xf640('0x9'));var jayson=require(_0xf640('0xa'));var client=jayson[_0xf640('0xb')][_0xf640('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x11b7f3,_0x13d287,_0x21a964){return new BPromise(function(_0x2fbf41,_0x51950){return client[_0xf640('0xd')](_0x11b7f3,_0x21a964)[_0xf640('0xe')](function(_0x419d2e){logger[_0xf640('0xf')](_0xf640('0x10'),_0x13d287,_0xf640('0x11'));logger[_0xf640('0x12')](_0xf640('0x13'),_0x13d287,_0xf640('0x11'),JSON['stringify'](_0x419d2e));if(_0x419d2e[_0xf640('0x14')]){if(_0x419d2e[_0xf640('0x14')][_0xf640('0x15')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x13d287,_0x419d2e[_0xf640('0x14')]['message']);return _0x51950(_0x419d2e[_0xf640('0x14')][_0xf640('0x16')]);}logger[_0xf640('0x14')](_0xf640('0x10'),_0x13d287,_0x419d2e[_0xf640('0x14')]['message']);return _0x2fbf41(_0x419d2e[_0xf640('0x14')][_0xf640('0x16')]);}else{logger[_0xf640('0xf')](_0xf640('0x10'),_0x13d287,_0xf640('0x11'));_0x2fbf41(_0x419d2e[_0xf640('0x17')][_0xf640('0x16')]);}})[_0xf640('0x18')](function(_0x59fd2c){logger['error'](_0xf640('0x10'),_0x13d287,_0x59fd2c);_0x51950(_0x59fd2c);});});}exports[_0xf640('0x19')]=function(_0x5d9d63){var _0xb5385f=this;return new Promise(function(_0xa403ab,_0x5b5195){return db[_0xf640('0x1a')][_0xf640('0x1b')](_0x5d9d63['body'],{'raw':_0x5d9d63[_0xf640('0x1c')]?_0x5d9d63[_0xf640('0x1c')][_0xf640('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2592d1){logger[_0xf640('0xf')](_0xf640('0x19'),_0x5d9d63);logger[_0xf640('0x12')](_0xf640('0x19'),_0x5d9d63,JSON[_0xf640('0x1e')](_0x2592d1));_0xa403ab(_0x2592d1);})[_0xf640('0x18')](function(_0x51e988){logger[_0xf640('0x14')](_0xf640('0x19'),_0x51e988[_0xf640('0x16')],_0x5d9d63);_0x5b5195(_0xb5385f[_0xf640('0x14')](0x1f4,_0x51e988[_0xf640('0x16')]));});});};exports[_0xf640('0x1f')]=function(_0x579bc7){var _0x47341d=this;return new Promise(function(_0x22a001,_0xbaabf5){return db[_0xf640('0x1a')][_0xf640('0x20')](_0x579bc7[_0xf640('0x21')],{'raw':_0x579bc7[_0xf640('0x1c')]?_0x579bc7[_0xf640('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x579bc7[_0xf640('0x1c')]?_0x579bc7[_0xf640('0x1c')][_0xf640('0x22')]||null:null,'attributes':_0x579bc7[_0xf640('0x1c')]?_0x579bc7[_0xf640('0x1c')][_0xf640('0x23')]||null:null,'limit':_0x579bc7[_0xf640('0x1c')]?_0x579bc7[_0xf640('0x1c')]['limit']||null:null})['then'](function(_0x40b32c){logger[_0xf640('0xf')](_0xf640('0x1f'),_0x579bc7);logger[_0xf640('0x12')](_0xf640('0x1f'),_0x579bc7,JSON[_0xf640('0x1e')](_0x40b32c));_0x22a001(_0x40b32c);})[_0xf640('0x18')](function(_0x5becb6){logger[_0xf640('0x14')](_0xf640('0x1f'),_0x5becb6['message'],_0x579bc7);_0xbaabf5(_0x47341d[_0xf640('0x14')](0x1f4,_0x5becb6[_0xf640('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c2e1bfb..b4c6d29 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 _0x99c9=['describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x1e9681,_0x7ba3be){var _0x4f75bc=function(_0x5544f7){while(--_0x5544f7){_0x1e9681['push'](_0x1e9681['shift']());}};_0x4f75bc(++_0x7ba3be);}(_0x99c9,0x13c));var _0x999c=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x99c9[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var path=require(_0x999c('0x2'));var timeout=require(_0x999c('0x3'));var express=require(_0x999c('0x4'));var router=express[_0x999c('0x5')]();var fs_extra=require(_0x999c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x999c('0x7'));var config=require(_0x999c('0x8'));var controller=require(_0x999c('0x9'));router[_0x999c('0xa')]('/',auth[_0x999c('0xb')](),controller[_0x999c('0xc')]);router[_0x999c('0xa')](_0x999c('0xd'),auth[_0x999c('0xb')](),controller[_0x999c('0xe')]);router[_0x999c('0xa')](_0x999c('0xf'),auth[_0x999c('0xb')](),controller[_0x999c('0x10')]);router['post']('/',auth[_0x999c('0xb')](),controller[_0x999c('0x11')]);router['put'](_0x999c('0xf'),auth[_0x999c('0xb')](),controller[_0x999c('0x12')]);router[_0x999c('0x13')](_0x999c('0xf'),auth[_0x999c('0xb')](),controller[_0x999c('0x14')]);module[_0x999c('0x15')]=router; \ No newline at end of file +var _0x9b67=['../../components/auth/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x2a4b13,_0x4b941b){var _0x3413d6=function(_0x4a0ea6){while(--_0x4a0ea6){_0x2a4b13['push'](_0x2a4b13['shift']());}};_0x3413d6(++_0x4b941b);}(_0x9b67,0xf6));var _0x79b6=function(_0x20fd50,_0xff60e2){_0x20fd50=_0x20fd50-0x0;var _0x370362=_0x9b67[_0x20fd50];return _0x370362;};'use strict';var multer=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var path=require(_0x79b6('0x2'));var timeout=require(_0x79b6('0x3'));var express=require(_0x79b6('0x4'));var router=express['Router']();var fs_extra=require(_0x79b6('0x5'));var auth=require(_0x79b6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x79b6('0x7'));router[_0x79b6('0x8')]('/',auth[_0x79b6('0x9')](),controller[_0x79b6('0xa')]);router[_0x79b6('0x8')](_0x79b6('0xb'),auth[_0x79b6('0x9')](),controller['describe']);router[_0x79b6('0x8')](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller[_0x79b6('0xd')]);router[_0x79b6('0xe')]('/',auth['isAuthenticated'](),controller[_0x79b6('0xf')]);router[_0x79b6('0x10')](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller['update']);router['delete'](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller[_0x79b6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index ccb714e..9f1fc3b 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x93c2d0,_0x2edbdb){var _0x2a3597=function(_0xf6567b){while(--_0xf6567b){_0x93c2d0['push'](_0x93c2d0['shift']());}};_0x2a3597(++_0x2edbdb);}(_0xe706,0xa3));var _0x6e70=function(_0x32a6b6,_0x5b4051){_0x32a6b6=_0x32a6b6-0x0;var _0x1f0d46=_0xe706[_0x32a6b6];return _0x1f0d46;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x237602,_0x4311af){var _0x2052cc=function(_0x5c7ee0){while(--_0x5c7ee0){_0x237602['push'](_0x237602['shift']());}};_0x2052cc(++_0x4311af);}(_0xaa88,0x137));var _0x8aa8=function(_0x53f37f,_0xfb0b18){_0x53f37f=_0x53f37f-0x0;var _0x2fe5f8=_0xaa88[_0x53f37f];return _0x2fe5f8;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index e37d9cb..bb967ef 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 _0x6309=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','index','map','SmsTransferReport','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x3632d9,_0x58b8fd){var _0x586b1d=function(_0x3d3737){while(--_0x3d3737){_0x3632d9['push'](_0x3632d9['shift']());}};_0x586b1d(++_0x58b8fd);}(_0x6309,0x1a2));var _0x9630=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x6309[_0x1e4a8e];return _0x5408f9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9630('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9630('0x1'));var moment=require(_0x9630('0x2'));var BPromise=require(_0x9630('0x3'));var Mustache=require('mustache');var util=require(_0x9630('0x4'));var path=require(_0x9630('0x5'));var sox=require('sox');var csv=require(_0x9630('0x6'));var ejs=require(_0x9630('0x7'));var fs=require('fs');var fs_extra=require(_0x9630('0x8'));var _=require(_0x9630('0x9'));var squel=require(_0x9630('0xa'));var crypto=require(_0x9630('0xb'));var jsforce=require(_0x9630('0xc'));var deskjs=require(_0x9630('0xd'));var toCsv=require(_0x9630('0x6'));var querystring=require(_0x9630('0xe'));var Papa=require(_0x9630('0xf'));var Redis=require(_0x9630('0x10'));var authService=require(_0x9630('0x11'));var qs=require(_0x9630('0x12'));var as=require(_0x9630('0x13'));var hardwareService=require(_0x9630('0x14'));var logger=require(_0x9630('0x15'))(_0x9630('0x16'));var utils=require(_0x9630('0x17'));var config=require(_0x9630('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9630('0x19'))['db'];function respondWithStatusCode(_0x44a56f,_0x439e5e){_0x439e5e=_0x439e5e||0xcc;return function(_0x28f2bc){if(_0x28f2bc){return _0x44a56f['sendStatus'](_0x439e5e);}return _0x44a56f[_0x9630('0x1a')](_0x439e5e)[_0x9630('0x1b')]();};}function respondWithResult(_0x3b6e7e,_0x3334ad){_0x3334ad=_0x3334ad||0xc8;return function(_0x276f33){if(_0x276f33){return _0x3b6e7e[_0x9630('0x1a')](_0x3334ad)[_0x9630('0x1c')](_0x276f33);}};}function respondWithFilteredResult(_0x5a3a10,_0x227174){return function(_0x5b32d6){if(_0x5b32d6){var _0x3bac8a=typeof _0x227174[_0x9630('0x1d')]===_0x9630('0x1e')&&typeof _0x227174[_0x9630('0x1f')]===_0x9630('0x1e');var _0x44e94d=_0x5b32d6[_0x9630('0x20')];var _0x1e0c13=_0x3bac8a?0x0:_0x227174[_0x9630('0x1d')];var _0x2893f6=_0x3bac8a?_0x5b32d6[_0x9630('0x20')]:_0x227174[_0x9630('0x1d')]+_0x227174[_0x9630('0x1f')];var _0x2c27c2;if(_0x2893f6>=_0x44e94d){_0x2893f6=_0x44e94d;_0x2c27c2=0xc8;}else{_0x2c27c2=0xce;}_0x5a3a10[_0x9630('0x1a')](_0x2c27c2);return _0x5a3a10['set'](_0x9630('0x21'),_0x1e0c13+'-'+_0x2893f6+'/'+_0x44e94d)['json'](_0x5b32d6);}return null;};}function patchUpdates(_0x465ac0){return function(_0x32981b){try{jsonpatch[_0x9630('0x22')](_0x32981b,_0x465ac0,!![]);}catch(_0x1bc236){return BPromise[_0x9630('0x23')](_0x1bc236);}return _0x32981b['save']();};}function saveUpdates(_0x3a5233,_0x4717f8){return function(_0x475e85){if(_0x475e85){return _0x475e85['update'](_0x3a5233)[_0x9630('0x24')](function(_0x39c2e1){return _0x39c2e1;});}return null;};}function removeEntity(_0x7a5c60,_0x34b8d7){return function(_0x5cedfc){if(_0x5cedfc){return _0x5cedfc[_0x9630('0x25')]()[_0x9630('0x24')](function(){_0x7a5c60[_0x9630('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8361de,_0x5442f2){return function(_0x2a30fa){if(!_0x2a30fa){_0x8361de[_0x9630('0x26')](0x194);}return _0x2a30fa;};}function handleError(_0x3f1875,_0x2d1c41){_0x2d1c41=_0x2d1c41||0x1f4;return function(_0x2cb4fb){logger[_0x9630('0x27')](_0x2cb4fb[_0x9630('0x28')]);if(_0x2cb4fb[_0x9630('0x29')]){delete _0x2cb4fb[_0x9630('0x29')];}_0x3f1875['status'](_0x2d1c41)['send'](_0x2cb4fb);};}exports[_0x9630('0x2a')]=function(_0x197ee6,_0x3075b9){var _0x5a9ace={},_0x22245d={},_0x2db261={'count':0x0,'rows':[]};var _0x42ff97=_[_0x9630('0x2b')](db[_0x9630('0x2c')][_0x9630('0x2d')],function(_0x1be19f){return{'name':_0x1be19f['fieldName'],'type':_0x1be19f[_0x9630('0x2e')][_0x9630('0x2f')]};});_0x22245d[_0x9630('0x30')]=_[_0x9630('0x2b')](_0x42ff97,_0x9630('0x29'));_0x22245d[_0x9630('0x31')]=_[_0x9630('0x32')](_0x197ee6[_0x9630('0x31')]);_0x22245d['filters']=_['intersection'](_0x22245d[_0x9630('0x30')],_0x22245d['query']);_0x5a9ace[_0x9630('0x33')]=_[_0x9630('0x34')](_0x22245d[_0x9630('0x30')],qs[_0x9630('0x35')](_0x197ee6['query'][_0x9630('0x35')]));_0x5a9ace[_0x9630('0x33')]=_0x5a9ace['attributes']['length']?_0x5a9ace['attributes']:_0x22245d['model'];if(!_0x197ee6[_0x9630('0x31')][_0x9630('0x36')]('nolimit')){_0x5a9ace[_0x9630('0x1f')]=qs[_0x9630('0x1f')](_0x197ee6[_0x9630('0x31')][_0x9630('0x1f')]);_0x5a9ace[_0x9630('0x1d')]=qs[_0x9630('0x1d')](_0x197ee6[_0x9630('0x31')]['offset']);}_0x5a9ace['order']=qs[_0x9630('0x37')](_0x197ee6['query'][_0x9630('0x37')]);_0x5a9ace[_0x9630('0x38')]=qs[_0x9630('0x39')](_['pick'](_0x197ee6[_0x9630('0x31')],_0x22245d['filters']),_0x42ff97);if(_0x197ee6[_0x9630('0x31')][_0x9630('0x3a')]){_0x5a9ace[_0x9630('0x38')]=_['merge'](_0x5a9ace['where'],{'$or':_[_0x9630('0x2b')](_0x42ff97,function(_0x419074){if(_0x419074[_0x9630('0x2e')]!==_0x9630('0x3b')){var _0x2d6199={};_0x2d6199[_0x419074[_0x9630('0x29')]]={'$like':'%'+_0x197ee6[_0x9630('0x31')][_0x9630('0x3a')]+'%'};return _0x2d6199;}})});}_0x5a9ace=_[_0x9630('0x3c')]({},_0x5a9ace,_0x197ee6[_0x9630('0x3d')]);var _0x5d795a={'where':_0x5a9ace[_0x9630('0x38')]};return db['SmsTransferReport'][_0x9630('0x20')](_0x5d795a)['then'](function(_0x5d13a0){_0x2db261[_0x9630('0x20')]=_0x5d13a0;if(_0x197ee6[_0x9630('0x31')]['includeAll']){_0x5a9ace[_0x9630('0x3e')]=[{'all':!![]}];}return db[_0x9630('0x2c')][_0x9630('0x3f')](_0x5a9ace);})[_0x9630('0x24')](function(_0x3acca5){_0x2db261[_0x9630('0x40')]=_0x3acca5;return _0x2db261;})['then'](respondWithFilteredResult(_0x3075b9,_0x5a9ace))[_0x9630('0x41')](handleError(_0x3075b9,null));};exports['show']=function(_0x23d262,_0x56ec09){var _0xc02d8f={'raw':!![],'where':{'id':_0x23d262[_0x9630('0x42')]['id']}},_0x2d58d4={};_0x2d58d4[_0x9630('0x30')]=_['keys'](db[_0x9630('0x2c')][_0x9630('0x2d')]);_0x2d58d4[_0x9630('0x31')]=_['keys'](_0x23d262[_0x9630('0x31')]);_0x2d58d4[_0x9630('0x39')]=_[_0x9630('0x34')](_0x2d58d4['model'],_0x2d58d4[_0x9630('0x31')]);_0xc02d8f[_0x9630('0x33')]=_['intersection'](_0x2d58d4[_0x9630('0x30')],qs[_0x9630('0x35')](_0x23d262[_0x9630('0x31')]['fields']));_0xc02d8f[_0x9630('0x33')]=_0xc02d8f[_0x9630('0x33')]['length']?_0xc02d8f[_0x9630('0x33')]:_0x2d58d4[_0x9630('0x30')];if(_0x23d262[_0x9630('0x31')][_0x9630('0x43')]){_0xc02d8f[_0x9630('0x3e')]=[{'all':!![]}];}_0xc02d8f=_[_0x9630('0x3c')]({},_0xc02d8f,_0x23d262['options']);return db['SmsTransferReport'][_0x9630('0x44')](_0xc02d8f)[_0x9630('0x24')](handleEntityNotFound(_0x56ec09,null))[_0x9630('0x24')](respondWithResult(_0x56ec09,null))['catch'](handleError(_0x56ec09,null));};exports[_0x9630('0x45')]=function(_0x4794fe,_0x57d294){return db[_0x9630('0x2c')][_0x9630('0x45')](_0x4794fe['body'],{})[_0x9630('0x24')](respondWithResult(_0x57d294,0xc9))[_0x9630('0x41')](handleError(_0x57d294,null));};exports['update']=function(_0x2d1a6c,_0x1b177f){if(_0x2d1a6c[_0x9630('0x46')]['id']){delete _0x2d1a6c['body']['id'];}return db[_0x9630('0x2c')][_0x9630('0x44')]({'where':{'id':_0x2d1a6c[_0x9630('0x42')]['id']}})[_0x9630('0x24')](handleEntityNotFound(_0x1b177f,null))[_0x9630('0x24')](saveUpdates(_0x2d1a6c[_0x9630('0x46')],null))[_0x9630('0x24')](respondWithResult(_0x1b177f,null))['catch'](handleError(_0x1b177f,null));};exports[_0x9630('0x25')]=function(_0x24a12e,_0x21467a){return db[_0x9630('0x2c')][_0x9630('0x44')]({'where':{'id':_0x24a12e['params']['id']}})['then'](handleEntityNotFound(_0x21467a,null))[_0x9630('0x24')](removeEntity(_0x21467a,null))[_0x9630('0x41')](handleError(_0x21467a,null));};exports[_0x9630('0x47')]=function(_0x4d3464,_0x224897){return db[_0x9630('0x2c')][_0x9630('0x47')]()['then'](respondWithResult(_0x224897,null))[_0x9630('0x41')](handleError(_0x224897,null));}; \ No newline at end of file +var _0xde16=['VIRTUAL','options','includeAll','findAll','params','keys','include','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','SmsTransferReport','rawAttributes','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x5185cf,_0x18e620){var _0x53a6b5=function(_0x414d58){while(--_0x414d58){_0x5185cf['push'](_0x5185cf['shift']());}};_0x53a6b5(++_0x18e620);}(_0xde16,0x12c));var _0x6de1=function(_0xbbb513,_0x8347d3){_0xbbb513=_0xbbb513-0x0;var _0x149446=_0xde16[_0xbbb513];return _0x149446;};'use strict';var emlformat=require(_0x6de1('0x0'));var rimraf=require(_0x6de1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6de1('0x2'));var rp=require(_0x6de1('0x3'));var moment=require(_0x6de1('0x4'));var BPromise=require(_0x6de1('0x5'));var Mustache=require('mustache');var util=require(_0x6de1('0x6'));var path=require(_0x6de1('0x7'));var sox=require('sox');var csv=require(_0x6de1('0x8'));var ejs=require(_0x6de1('0x9'));var fs=require('fs');var fs_extra=require(_0x6de1('0xa'));var _=require(_0x6de1('0xb'));var squel=require('squel');var crypto=require(_0x6de1('0xc'));var jsforce=require(_0x6de1('0xd'));var deskjs=require(_0x6de1('0xe'));var toCsv=require(_0x6de1('0x8'));var querystring=require(_0x6de1('0xf'));var Papa=require(_0x6de1('0x10'));var Redis=require(_0x6de1('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6de1('0x12'));var hardwareService=require(_0x6de1('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6de1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6de1('0x15'));var db=require(_0x6de1('0x16'))['db'];function respondWithStatusCode(_0x14960a,_0x304079){_0x304079=_0x304079||0xcc;return function(_0x108f43){if(_0x108f43){return _0x14960a[_0x6de1('0x17')](_0x304079);}return _0x14960a['status'](_0x304079)['end']();};}function respondWithResult(_0x24e90e,_0x59c545){_0x59c545=_0x59c545||0xc8;return function(_0x1d05a4){if(_0x1d05a4){return _0x24e90e[_0x6de1('0x18')](_0x59c545)[_0x6de1('0x19')](_0x1d05a4);}};}function respondWithFilteredResult(_0x413db1,_0x63a19d){return function(_0x1f31ff){if(_0x1f31ff){var _0x5eee4f=typeof _0x63a19d['offset']===_0x6de1('0x1a')&&typeof _0x63a19d['limit']===_0x6de1('0x1a');var _0x72d388=_0x1f31ff['count'];var _0x1a0fe0=_0x5eee4f?0x0:_0x63a19d[_0x6de1('0x1b')];var _0x1b5a21=_0x5eee4f?_0x1f31ff[_0x6de1('0x1c')]:_0x63a19d[_0x6de1('0x1b')]+_0x63a19d[_0x6de1('0x1d')];var _0x444edf;if(_0x1b5a21>=_0x72d388){_0x1b5a21=_0x72d388;_0x444edf=0xc8;}else{_0x444edf=0xce;}_0x413db1[_0x6de1('0x18')](_0x444edf);return _0x413db1['set'](_0x6de1('0x1e'),_0x1a0fe0+'-'+_0x1b5a21+'/'+_0x72d388)[_0x6de1('0x19')](_0x1f31ff);}return null;};}function patchUpdates(_0x36d010){return function(_0x3071c1){try{jsonpatch[_0x6de1('0x1f')](_0x3071c1,_0x36d010,!![]);}catch(_0x3ed6de){return BPromise[_0x6de1('0x20')](_0x3ed6de);}return _0x3071c1[_0x6de1('0x21')]();};}function saveUpdates(_0x5e13a3,_0xd68f29){return function(_0x305a49){if(_0x305a49){return _0x305a49[_0x6de1('0x22')](_0x5e13a3)[_0x6de1('0x23')](function(_0x47d19b){return _0x47d19b;});}return null;};}function removeEntity(_0x906b53,_0x3e03d3){return function(_0x288305){if(_0x288305){return _0x288305[_0x6de1('0x24')]()['then'](function(){_0x906b53[_0x6de1('0x18')](0xcc)[_0x6de1('0x25')]();});}};}function handleEntityNotFound(_0x5f2f8d,_0x318a35){return function(_0x5a4839){if(!_0x5a4839){_0x5f2f8d[_0x6de1('0x17')](0x194);}return _0x5a4839;};}function handleError(_0x33b17a,_0x764c14){_0x764c14=_0x764c14||0x1f4;return function(_0x596578){logger[_0x6de1('0x26')](_0x596578[_0x6de1('0x27')]);if(_0x596578[_0x6de1('0x28')]){delete _0x596578[_0x6de1('0x28')];}_0x33b17a[_0x6de1('0x18')](_0x764c14)['send'](_0x596578);};}exports[_0x6de1('0x29')]=function(_0xefe837,_0x139ccd){var _0x30ff86={},_0x4b34a={},_0x1e2fdc={'count':0x0,'rows':[]};var _0x3fe245=_[_0x6de1('0x2a')](db[_0x6de1('0x2b')][_0x6de1('0x2c')],function(_0x3b795d){return{'name':_0x3b795d['fieldName'],'type':_0x3b795d[_0x6de1('0x2d')]['key']};});_0x4b34a['model']=_['map'](_0x3fe245,_0x6de1('0x28'));_0x4b34a['query']=_['keys'](_0xefe837[_0x6de1('0x2e')]);_0x4b34a[_0x6de1('0x2f')]=_['intersection'](_0x4b34a[_0x6de1('0x30')],_0x4b34a[_0x6de1('0x2e')]);_0x30ff86[_0x6de1('0x31')]=_[_0x6de1('0x32')](_0x4b34a[_0x6de1('0x30')],qs[_0x6de1('0x33')](_0xefe837[_0x6de1('0x2e')][_0x6de1('0x33')]));_0x30ff86[_0x6de1('0x31')]=_0x30ff86[_0x6de1('0x31')][_0x6de1('0x34')]?_0x30ff86[_0x6de1('0x31')]:_0x4b34a[_0x6de1('0x30')];if(!_0xefe837['query'][_0x6de1('0x35')](_0x6de1('0x36'))){_0x30ff86[_0x6de1('0x1d')]=qs['limit'](_0xefe837[_0x6de1('0x2e')][_0x6de1('0x1d')]);_0x30ff86[_0x6de1('0x1b')]=qs[_0x6de1('0x1b')](_0xefe837['query'][_0x6de1('0x1b')]);}_0x30ff86['order']=qs[_0x6de1('0x37')](_0xefe837[_0x6de1('0x2e')]['sort']);_0x30ff86[_0x6de1('0x38')]=qs['filters'](_[_0x6de1('0x39')](_0xefe837[_0x6de1('0x2e')],_0x4b34a[_0x6de1('0x2f')]),_0x3fe245);if(_0xefe837[_0x6de1('0x2e')][_0x6de1('0x3a')]){_0x30ff86[_0x6de1('0x38')]=_[_0x6de1('0x3b')](_0x30ff86[_0x6de1('0x38')],{'$or':_[_0x6de1('0x2a')](_0x3fe245,function(_0x2a36f8){if(_0x2a36f8[_0x6de1('0x2d')]!==_0x6de1('0x3c')){var _0x347435={};_0x347435[_0x2a36f8[_0x6de1('0x28')]]={'$like':'%'+_0xefe837[_0x6de1('0x2e')][_0x6de1('0x3a')]+'%'};return _0x347435;}})});}_0x30ff86=_[_0x6de1('0x3b')]({},_0x30ff86,_0xefe837[_0x6de1('0x3d')]);var _0x5f1333={'where':_0x30ff86[_0x6de1('0x38')]};return db[_0x6de1('0x2b')][_0x6de1('0x1c')](_0x5f1333)[_0x6de1('0x23')](function(_0x1f06ff){_0x1e2fdc[_0x6de1('0x1c')]=_0x1f06ff;if(_0xefe837[_0x6de1('0x2e')][_0x6de1('0x3e')]){_0x30ff86['include']=[{'all':!![]}];}return db[_0x6de1('0x2b')][_0x6de1('0x3f')](_0x30ff86);})[_0x6de1('0x23')](function(_0x105a4e){_0x1e2fdc['rows']=_0x105a4e;return _0x1e2fdc;})[_0x6de1('0x23')](respondWithFilteredResult(_0x139ccd,_0x30ff86))['catch'](handleError(_0x139ccd,null));};exports['show']=function(_0x1152c2,_0x5eda87){var _0x234e59={'raw':!![],'where':{'id':_0x1152c2[_0x6de1('0x40')]['id']}},_0x163bf0={};_0x163bf0[_0x6de1('0x30')]=_['keys'](db['SmsTransferReport'][_0x6de1('0x2c')]);_0x163bf0[_0x6de1('0x2e')]=_[_0x6de1('0x41')](_0x1152c2[_0x6de1('0x2e')]);_0x163bf0['filters']=_[_0x6de1('0x32')](_0x163bf0[_0x6de1('0x30')],_0x163bf0[_0x6de1('0x2e')]);_0x234e59[_0x6de1('0x31')]=_['intersection'](_0x163bf0[_0x6de1('0x30')],qs[_0x6de1('0x33')](_0x1152c2[_0x6de1('0x2e')]['fields']));_0x234e59['attributes']=_0x234e59[_0x6de1('0x31')][_0x6de1('0x34')]?_0x234e59[_0x6de1('0x31')]:_0x163bf0[_0x6de1('0x30')];if(_0x1152c2[_0x6de1('0x2e')][_0x6de1('0x3e')]){_0x234e59[_0x6de1('0x42')]=[{'all':!![]}];}_0x234e59=_[_0x6de1('0x3b')]({},_0x234e59,_0x1152c2[_0x6de1('0x3d')]);return db[_0x6de1('0x2b')][_0x6de1('0x43')](_0x234e59)[_0x6de1('0x23')](handleEntityNotFound(_0x5eda87,null))['then'](respondWithResult(_0x5eda87,null))[_0x6de1('0x44')](handleError(_0x5eda87,null));};exports[_0x6de1('0x45')]=function(_0x3ef595,_0x5b515f){return db[_0x6de1('0x2b')]['create'](_0x3ef595['body'],{})['then'](respondWithResult(_0x5b515f,0xc9))['catch'](handleError(_0x5b515f,null));};exports[_0x6de1('0x22')]=function(_0x1035ec,_0x460515){if(_0x1035ec[_0x6de1('0x46')]['id']){delete _0x1035ec[_0x6de1('0x46')]['id'];}return db[_0x6de1('0x2b')][_0x6de1('0x43')]({'where':{'id':_0x1035ec[_0x6de1('0x40')]['id']}})[_0x6de1('0x23')](handleEntityNotFound(_0x460515,null))['then'](saveUpdates(_0x1035ec[_0x6de1('0x46')],null))[_0x6de1('0x23')](respondWithResult(_0x460515,null))[_0x6de1('0x44')](handleError(_0x460515,null));};exports[_0x6de1('0x24')]=function(_0x3cd6a1,_0x472995){return db[_0x6de1('0x2b')]['find']({'where':{'id':_0x3cd6a1[_0x6de1('0x40')]['id']}})[_0x6de1('0x23')](handleEntityNotFound(_0x472995,null))[_0x6de1('0x23')](removeEntity(_0x472995,null))[_0x6de1('0x44')](handleError(_0x472995,null));};exports[_0x6de1('0x47')]=function(_0x511bd4,_0x9d0e8d){return db[_0x6de1('0x2b')][_0x6de1('0x47')]()[_0x6de1('0x23')](respondWithResult(_0x9d0e8d,null))[_0x6de1('0x44')](handleError(_0x9d0e8d,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 4c7caec..915c468 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 _0xdbfe=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger'];(function(_0x4f2f12,_0x35f648){var _0x4ab15c=function(_0x5b046b){while(--_0x5b046b){_0x4f2f12['push'](_0x4f2f12['shift']());}};_0x4ab15c(++_0x35f648);}(_0xdbfe,0xd0));var _0xedbf=function(_0xc5e4fd,_0x6b30b2){_0xc5e4fd=_0xc5e4fd-0x0;var _0x2279e3=_0xdbfe[_0xc5e4fd];return _0x2279e3;};'use strict';var _=require('lodash');var util=require(_0xedbf('0x0'));var logger=require(_0xedbf('0x1'))(_0xedbf('0x2'));var moment=require(_0xedbf('0x3'));var BPromise=require(_0xedbf('0x4'));var rp=require(_0xedbf('0x5'));var fs=require('fs');var path=require(_0xedbf('0x6'));var rimraf=require(_0xedbf('0x7'));var config=require(_0xedbf('0x8'));var attributes=require(_0xedbf('0x9'));module[_0xedbf('0xa')]=function(_0x4a6c3b,_0x23b2cc){return _0x4a6c3b[_0xedbf('0xb')](_0xedbf('0xc'),attributes,{'tableName':_0xedbf('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xedbf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x10eb=['../../config/environment','define','SmsTransferReport','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10eb,0x71));var _0xb10e=function(_0x34a455,_0x46db0b){_0x34a455=_0x34a455-0x0;var _0x2a0834=_0x10eb[_0x34a455];return _0x2a0834;};'use strict';var _=require(_0xb10e('0x0'));var util=require('util');var logger=require(_0xb10e('0x1'))(_0xb10e('0x2'));var moment=require(_0xb10e('0x3'));var BPromise=require(_0xb10e('0x4'));var rp=require(_0xb10e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb10e('0x6'));var config=require(_0xb10e('0x7'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x2ffe69,_0x40decd){return _0x2ffe69[_0xb10e('0x8')](_0xb10e('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 0ca0201..4125430 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 _0x43f3=['request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x339e6e,_0x580ce3){var _0x50a6ad=function(_0x163646){while(--_0x163646){_0x339e6e['push'](_0x339e6e['shift']());}};_0x50a6ad(++_0x580ce3);}(_0x43f3,0xab));var _0x343f=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x43f3[_0x15c421];return _0x5e5ed5;};'use strict';var _=require('lodash');var util=require(_0x343f('0x0'));var moment=require(_0x343f('0x1'));var BPromise=require('bluebird');var rs=require(_0x343f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x343f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x343f('0x4'))(_0x343f('0x5'));var config=require(_0x343f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x343f('0x7')][_0x343f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28d670,_0x1ba815,_0x288ae7){return new BPromise(function(_0x2808b9,_0x2eb28a){return client[_0x343f('0x9')](_0x28d670,_0x288ae7)[_0x343f('0xa')](function(_0x481bdd){logger[_0x343f('0xb')](_0x343f('0xc'),_0x1ba815,_0x343f('0xd'));logger[_0x343f('0xe')](_0x343f('0xf'),_0x1ba815,_0x343f('0xd'),JSON[_0x343f('0x10')](_0x481bdd));if(_0x481bdd[_0x343f('0x11')]){if(_0x481bdd[_0x343f('0x11')]['code']===0x1f4){logger[_0x343f('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x1ba815,_0x481bdd['error'][_0x343f('0x12')]);return _0x2eb28a(_0x481bdd[_0x343f('0x11')]['message']);}logger['error'](_0x343f('0xc'),_0x1ba815,_0x481bdd['error'][_0x343f('0x12')]);return _0x2808b9(_0x481bdd['error'][_0x343f('0x12')]);}else{logger[_0x343f('0xb')](_0x343f('0xc'),_0x1ba815,_0x343f('0xd'));_0x2808b9(_0x481bdd[_0x343f('0x13')]['message']);}})['catch'](function(_0x21c19b){logger[_0x343f('0x11')](_0x343f('0xc'),_0x1ba815,_0x21c19b);_0x2eb28a(_0x21c19b);});});} \ No newline at end of file +var _0xe953=['error','code','message','result','catch','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3629d2,_0x1adfc1){var _0x1e6432=function(_0x1be3f9){while(--_0x1be3f9){_0x3629d2['push'](_0x3629d2['shift']());}};_0x1e6432(++_0x1adfc1);}(_0xe953,0x1d0));var _0x3e95=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe953[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e95('0x0'));var db=require(_0x3e95('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e95('0x2'))('rpc');var config=require(_0x3e95('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x3e95('0x4')][_0x3e95('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x45f703,_0x38968e,_0x421e13){return new BPromise(function(_0x5bb380,_0x38c27b){return client[_0x3e95('0x6')](_0x45f703,_0x421e13)[_0x3e95('0x7')](function(_0x5ae40a){logger[_0x3e95('0x8')](_0x3e95('0x9'),_0x38968e,_0x3e95('0xa'));logger[_0x3e95('0xb')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x38968e,_0x3e95('0xa'),JSON['stringify'](_0x5ae40a));if(_0x5ae40a[_0x3e95('0xc')]){if(_0x5ae40a[_0x3e95('0xc')][_0x3e95('0xd')]===0x1f4){logger[_0x3e95('0xc')](_0x3e95('0x9'),_0x38968e,_0x5ae40a[_0x3e95('0xc')]['message']);return _0x38c27b(_0x5ae40a[_0x3e95('0xc')][_0x3e95('0xe')]);}logger['error'](_0x3e95('0x9'),_0x38968e,_0x5ae40a[_0x3e95('0xc')][_0x3e95('0xe')]);return _0x5bb380(_0x5ae40a[_0x3e95('0xc')]['message']);}else{logger[_0x3e95('0x8')](_0x3e95('0x9'),_0x38968e,'request\x20sent');_0x5bb380(_0x5ae40a[_0x3e95('0xf')][_0x3e95('0xe')]);}})[_0x3e95('0x10')](function(_0xc3be41){logger['error'](_0x3e95('0x9'),_0x38968e,_0xc3be41);_0x38c27b(_0xc3be41);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 6b11ba5..c6609d2 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 _0x4d29=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','download','diskStorage','join','root','server/files/sounds/original/','format','%s-%s%s','originalname','now','extname','post','single','create','put','delete','exports','path','connect-timeout','express'];(function(_0x131a08,_0x19c2c3){var _0x1413fe=function(_0x4f1501){while(--_0x4f1501){_0x131a08['push'](_0x131a08['shift']());}};_0x1413fe(++_0x19c2c3);}(_0x4d29,0xc8));var _0x94d2=function(_0x4a99e3,_0x26f30e){_0x4a99e3=_0x4a99e3-0x0;var _0x5e956f=_0x4d29[_0x4a99e3];return _0x5e956f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x94d2('0x0'));var timeout=require(_0x94d2('0x1'));var express=require(_0x94d2('0x2'));var router=express[_0x94d2('0x3')]();var fs_extra=require(_0x94d2('0x4'));var auth=require(_0x94d2('0x5'));var interaction=require(_0x94d2('0x6'));var config=require(_0x94d2('0x7'));var controller=require(_0x94d2('0x8'));router['get']('/',auth[_0x94d2('0x9')](),controller[_0x94d2('0xa')]);router[_0x94d2('0xb')](_0x94d2('0xc'),auth[_0x94d2('0x9')](),controller['show']);router['get']('/:id/download',auth[_0x94d2('0x9')](),controller[_0x94d2('0xd')]);var upload=multer({'storage':multer[_0x94d2('0xe')]({'destination':function(_0x1eac0d,_0x371920,_0x5eea65){_0x5eea65(null,path[_0x94d2('0xf')](config[_0x94d2('0x10')],_0x94d2('0x11')));},'filename':function(_0x47cc82,_0x49c0d3,_0x1283c8){_0x49c0d3['originalname']=_0x49c0d3['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1283c8(null,util[_0x94d2('0x12')](_0x94d2('0x13'),path['basename'](_0x49c0d3[_0x94d2('0x14')],path['extname'](_0x49c0d3[_0x94d2('0x14')])),Date[_0x94d2('0x15')](),path[_0x94d2('0x16')](_0x49c0d3[_0x94d2('0x14')])));}})});router[_0x94d2('0x17')]('/',upload[_0x94d2('0x18')]('file'),controller[_0x94d2('0x19')]);router[_0x94d2('0x1a')](_0x94d2('0xc'),auth[_0x94d2('0x9')](),controller['update']);router[_0x94d2('0x1b')]('/:id',auth[_0x94d2('0x9')](),controller[_0x94d2('0x1b')]);module[_0x94d2('0x1c')]=router; \ No newline at end of file +var _0x4861=['basename','extname','now','post','file','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated','/:id/download','download','diskStorage','join','root','originalname','replace','%s-%s%s'];(function(_0x19ed69,_0x1e0e5f){var _0x5bc31d=function(_0x325b30){while(--_0x325b30){_0x19ed69['push'](_0x19ed69['shift']());}};_0x5bc31d(++_0x1e0e5f);}(_0x4861,0x135));var _0x1486=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4861[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x1486('0x0'));var util=require(_0x1486('0x1'));var path=require(_0x1486('0x2'));var timeout=require(_0x1486('0x3'));var express=require(_0x1486('0x4'));var router=express[_0x1486('0x5')]();var fs_extra=require(_0x1486('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1486('0x7'));var config=require('../../config/environment');var controller=require(_0x1486('0x8'));router[_0x1486('0x9')]('/',auth['isAuthenticated'](),controller[_0x1486('0xa')]);router[_0x1486('0x9')](_0x1486('0xb'),auth[_0x1486('0xc')](),controller['show']);router[_0x1486('0x9')](_0x1486('0xd'),auth[_0x1486('0xc')](),controller[_0x1486('0xe')]);var upload=multer({'storage':multer[_0x1486('0xf')]({'destination':function(_0x4d2038,_0x39cee1,_0x226a20){_0x226a20(null,path[_0x1486('0x10')](config[_0x1486('0x11')],'server/files/sounds/original/'));},'filename':function(_0x5c9bcd,_0x190dee,_0x3d7849){_0x190dee['originalname']=_0x190dee[_0x1486('0x12')][_0x1486('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3d7849(null,util['format'](_0x1486('0x14'),path[_0x1486('0x15')](_0x190dee['originalname'],path[_0x1486('0x16')](_0x190dee[_0x1486('0x12')])),Date[_0x1486('0x17')](),path[_0x1486('0x16')](_0x190dee[_0x1486('0x12')])));}})});router[_0x1486('0x18')]('/',upload['single'](_0x1486('0x19')),controller['create']);router[_0x1486('0x1a')](_0x1486('0xb'),auth[_0x1486('0xc')](),controller[_0x1486('0x1b')]);router[_0x1486('0x1c')](_0x1486('0xb'),auth['isAuthenticated'](),controller['delete']);module[_0x1486('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 1b04941..1d8b0f4 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 _0xe230=['FLOAT','sequelize','exports','STRING','name','BIGINT','INTEGER'];(function(_0x2f0d6a,_0x4d8e4f){var _0x3e5b49=function(_0x5240a8){while(--_0x5240a8){_0x2f0d6a['push'](_0x2f0d6a['shift']());}};_0x3e5b49(++_0x4d8e4f);}(_0xe230,0x1ba));var _0x0e23=function(_0x1ea1b7,_0x3c81a5){_0x1ea1b7=_0x1ea1b7-0x0;var _0x9f0875=_0xe230[_0x1ea1b7];return _0x9f0875;};'use strict';var Sequelize=require(_0x0e23('0x0'));module[_0x0e23('0x1')]={'name':{'type':Sequelize[_0x0e23('0x2')],'unique':_0x0e23('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x0e23('0x2')]},'display_name':{'type':Sequelize[_0x0e23('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x0e23('0x2')]},'original_format':{'type':Sequelize[_0x0e23('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x0e23('0x4')]},'original_channelCount':{'type':Sequelize[_0x0e23('0x5')]},'original_bitRate':{'type':Sequelize[_0x0e23('0x4')]},'original_sampleRate':{'type':Sequelize[_0x0e23('0x5')]},'converted_format':{'type':Sequelize[_0x0e23('0x2')]},'converted_duration':{'type':Sequelize[_0x0e23('0x6')]},'converted_sampleCount':{'type':Sequelize[_0x0e23('0x4')]},'converted_channelCount':{'type':Sequelize[_0x0e23('0x5')]},'converted_bitRate':{'type':Sequelize[_0x0e23('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x0e23('0x5')]}}; \ No newline at end of file +var _0xa333=['BIGINT','INTEGER','sequelize','STRING','name'];(function(_0x3b064e,_0x4afe3c){var _0x215c6e=function(_0x54e64b){while(--_0x54e64b){_0x3b064e['push'](_0x3b064e['shift']());}};_0x215c6e(++_0x4afe3c);}(_0xa333,0xac));var _0x3a33=function(_0x200ea5,_0x53c88f){_0x200ea5=_0x200ea5-0x0;var _0x441436=_0xa333[_0x200ea5];return _0x441436;};'use strict';var Sequelize=require(_0x3a33('0x0'));module['exports']={'name':{'type':Sequelize[_0x3a33('0x1')],'unique':_0x3a33('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x3a33('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x3a33('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x3a33('0x3')]},'original_channelCount':{'type':Sequelize[_0x3a33('0x4')]},'original_bitRate':{'type':Sequelize[_0x3a33('0x3')]},'original_sampleRate':{'type':Sequelize[_0x3a33('0x4')]},'converted_format':{'type':Sequelize[_0x3a33('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x3a33('0x3')]},'converted_channelCount':{'type':Sequelize[_0x3a33('0x4')]},'converted_bitRate':{'type':Sequelize[_0x3a33('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x3a33('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 202b397..1948a26 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 _0x2737=['../../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','undefined','limit','count','offset','reject','update','then','get','Sounds','destroy','end','error','send','map','Sound','rawAttributes','type','key','name','query','keys','filters','intersection','attributes','model','length','order','sort','where','filter','merge','VIRTUAL','options','findAll','catch','show','params','fields','includeAll','include','find','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','download','format','%s.%s','basename','originalname','file','filename','extname','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','start','description','original_format','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x17a96a,_0x29d38b){var _0x4d4ec9=function(_0xd66e96){while(--_0xd66e96){_0x17a96a['push'](_0x17a96a['shift']());}};_0x4d4ec9(++_0x29d38b);}(_0x2737,0xde));var _0x7273=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x2737[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x7273('0x0'));var rimraf=require(_0x7273('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7273('0x2'));var moment=require(_0x7273('0x3'));var BPromise=require(_0x7273('0x4'));var Mustache=require(_0x7273('0x5'));var util=require(_0x7273('0x6'));var path=require(_0x7273('0x7'));var sox=require(_0x7273('0x8'));var csv=require(_0x7273('0x9'));var ejs=require(_0x7273('0xa'));var fs=require('fs');var fs_extra=require(_0x7273('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7273('0xc'));var jsforce=require(_0x7273('0xd'));var deskjs=require(_0x7273('0xe'));var toCsv=require(_0x7273('0x9'));var querystring=require(_0x7273('0xf'));var Papa=require(_0x7273('0x10'));var Redis=require(_0x7273('0x11'));var authService=require(_0x7273('0x12'));var qs=require(_0x7273('0x13'));var as=require(_0x7273('0x14'));var hardwareService=require(_0x7273('0x15'));var logger=require(_0x7273('0x16'))(_0x7273('0x17'));var utils=require(_0x7273('0x18'));var config=require(_0x7273('0x19'));var licenseUtil=require(_0x7273('0x1a'));var db=require(_0x7273('0x1b'))['db'];function respondWithStatusCode(_0x4c4f66,_0x182bab){_0x182bab=_0x182bab||0xcc;return function(_0x1a2db3){if(_0x1a2db3){return _0x4c4f66['sendStatus'](_0x182bab);}return _0x4c4f66['status'](_0x182bab)['end']();};}function respondWithResult(_0x57ad79,_0x404dbc){_0x404dbc=_0x404dbc||0xc8;return function(_0x16a64c){if(_0x16a64c){return _0x57ad79[_0x7273('0x1c')](_0x404dbc)[_0x7273('0x1d')](_0x16a64c);}};}function respondWithFilteredResult(_0xef1090,_0x478ee1){return function(_0x524680){if(_0x524680){var _0x5d10e4=typeof _0x478ee1['offset']===_0x7273('0x1e')&&typeof _0x478ee1[_0x7273('0x1f')]===_0x7273('0x1e');var _0x30bd6b=_0x524680[_0x7273('0x20')];var _0x238df8=_0x5d10e4?0x0:_0x478ee1[_0x7273('0x21')];var _0x39efa0=_0x5d10e4?_0x524680[_0x7273('0x20')]:_0x478ee1[_0x7273('0x21')]+_0x478ee1[_0x7273('0x1f')];var _0x36c252;if(_0x39efa0>=_0x30bd6b){_0x39efa0=_0x30bd6b;_0x36c252=0xc8;}else{_0x36c252=0xce;}_0xef1090[_0x7273('0x1c')](_0x36c252);return _0xef1090['set']('Content-Range',_0x238df8+'-'+_0x39efa0+'/'+_0x30bd6b)[_0x7273('0x1d')](_0x524680);}return null;};}function patchUpdates(_0x451cf5){return function(_0x4fedbb){try{jsonpatch['apply'](_0x4fedbb,_0x451cf5,!![]);}catch(_0x4622e3){return BPromise[_0x7273('0x22')](_0x4622e3);}return _0x4fedbb['save']();};}function saveUpdates(_0x1638f8,_0xb4d2d1){return function(_0x41e8b9){if(_0x41e8b9){return _0x41e8b9[_0x7273('0x23')](_0x1638f8)[_0x7273('0x24')](function(_0x4b7aab){return _0x4b7aab;});}return null;};}function removeEntity(_0x3bc065,_0x1df946){return function(_0x4890df){if(_0x4890df){return _0x4890df['destroy']()[_0x7273('0x24')](function(){var _0x49a904=_0x4890df[_0x7273('0x25')]({'plain':!![]});var _0x5dac30=_0x7273('0x26');return db['UserProfileResource'][_0x7273('0x27')]({'where':{'type':_0x5dac30,'resourceId':_0x49a904['id']}})[_0x7273('0x24')](function(){return _0x4890df;});})[_0x7273('0x24')](function(){_0x3bc065[_0x7273('0x1c')](0xcc)[_0x7273('0x28')]();});}};}function handleEntityNotFound(_0x1b62d5,_0x139fed){return function(_0xce7092){if(!_0xce7092){_0x1b62d5['sendStatus'](0x194);}return _0xce7092;};}function handleError(_0xe341c2,_0x560922){_0x560922=_0x560922||0x1f4;return function(_0x3d3206){logger[_0x7273('0x29')](_0x3d3206['stack']);if(_0x3d3206['name']){delete _0x3d3206['name'];}_0xe341c2[_0x7273('0x1c')](_0x560922)[_0x7273('0x2a')](_0x3d3206);};}exports['index']=function(_0x489c50,_0x3d603d){var _0x301dcc={},_0x92b941={},_0x345c49={'count':0x0,'rows':[]};var _0x32c23c=_[_0x7273('0x2b')](db[_0x7273('0x2c')][_0x7273('0x2d')],function(_0x2ec3c5){return{'name':_0x2ec3c5['fieldName'],'type':_0x2ec3c5[_0x7273('0x2e')][_0x7273('0x2f')]};});_0x92b941['model']=_['map'](_0x32c23c,_0x7273('0x30'));_0x92b941[_0x7273('0x31')]=_[_0x7273('0x32')](_0x489c50[_0x7273('0x31')]);_0x92b941[_0x7273('0x33')]=_[_0x7273('0x34')](_0x92b941['model'],_0x92b941['query']);_0x301dcc[_0x7273('0x35')]=_['intersection'](_0x92b941[_0x7273('0x36')],qs['fields'](_0x489c50[_0x7273('0x31')]['fields']));_0x301dcc['attributes']=_0x301dcc[_0x7273('0x35')][_0x7273('0x37')]?_0x301dcc[_0x7273('0x35')]:_0x92b941[_0x7273('0x36')];if(!_0x489c50[_0x7273('0x31')]['hasOwnProperty']('nolimit')){_0x301dcc[_0x7273('0x1f')]=qs[_0x7273('0x1f')](_0x489c50[_0x7273('0x31')]['limit']);_0x301dcc[_0x7273('0x21')]=qs[_0x7273('0x21')](_0x489c50[_0x7273('0x31')][_0x7273('0x21')]);}_0x301dcc[_0x7273('0x38')]=qs[_0x7273('0x39')](_0x489c50[_0x7273('0x31')][_0x7273('0x39')]);_0x301dcc[_0x7273('0x3a')]=qs[_0x7273('0x33')](_['pick'](_0x489c50[_0x7273('0x31')],_0x92b941['filters']),_0x32c23c);if(_0x489c50['query'][_0x7273('0x3b')]){_0x301dcc['where']=_[_0x7273('0x3c')](_0x301dcc[_0x7273('0x3a')],{'$or':_[_0x7273('0x2b')](_0x32c23c,function(_0x13172f){if(_0x13172f[_0x7273('0x2e')]!==_0x7273('0x3d')){var _0x7276e8={};_0x7276e8[_0x13172f[_0x7273('0x30')]]={'$like':'%'+_0x489c50['query'][_0x7273('0x3b')]+'%'};return _0x7276e8;}})});}_0x301dcc=_[_0x7273('0x3c')]({},_0x301dcc,_0x489c50[_0x7273('0x3e')]);var _0x27fd10={'where':_0x301dcc[_0x7273('0x3a')]};return db[_0x7273('0x2c')]['count'](_0x27fd10)['then'](function(_0x52c14b){_0x345c49[_0x7273('0x20')]=_0x52c14b;if(_0x489c50['query']['includeAll']){_0x301dcc['include']=[{'all':!![]}];}return db[_0x7273('0x2c')][_0x7273('0x3f')](_0x301dcc);})[_0x7273('0x24')](function(_0x5a1e9c){_0x345c49['rows']=_0x5a1e9c;return _0x345c49;})[_0x7273('0x24')](respondWithFilteredResult(_0x3d603d,_0x301dcc))[_0x7273('0x40')](handleError(_0x3d603d,null));};exports[_0x7273('0x41')]=function(_0x5f4cf6,_0x222b0b){var _0x3c8248={'raw':!![],'where':{'id':_0x5f4cf6[_0x7273('0x42')]['id']}},_0x3c8f8d={};_0x3c8f8d[_0x7273('0x36')]=_[_0x7273('0x32')](db[_0x7273('0x2c')][_0x7273('0x2d')]);_0x3c8f8d['query']=_[_0x7273('0x32')](_0x5f4cf6[_0x7273('0x31')]);_0x3c8f8d[_0x7273('0x33')]=_[_0x7273('0x34')](_0x3c8f8d[_0x7273('0x36')],_0x3c8f8d[_0x7273('0x31')]);_0x3c8248['attributes']=_['intersection'](_0x3c8f8d[_0x7273('0x36')],qs[_0x7273('0x43')](_0x5f4cf6[_0x7273('0x31')][_0x7273('0x43')]));_0x3c8248[_0x7273('0x35')]=_0x3c8248[_0x7273('0x35')][_0x7273('0x37')]?_0x3c8248['attributes']:_0x3c8f8d[_0x7273('0x36')];if(_0x5f4cf6['query'][_0x7273('0x44')]){_0x3c8248[_0x7273('0x45')]=[{'all':!![]}];}_0x3c8248=_[_0x7273('0x3c')]({},_0x3c8248,_0x5f4cf6[_0x7273('0x3e')]);return db[_0x7273('0x2c')][_0x7273('0x46')](_0x3c8248)['then'](handleEntityNotFound(_0x222b0b,null))['then'](respondWithResult(_0x222b0b,null))[_0x7273('0x40')](handleError(_0x222b0b,null));};exports['download']=function(_0x4b4ba0,_0x4f0191,_0x3daa56){return db['Sound']['find']({'where':{'id':_0x4b4ba0['params']['id']},'attributes':['name',_0x7273('0x47'),_0x7273('0x48')],'raw':!![]})[_0x7273('0x24')](handleEntityNotFound(_0x4f0191,null))[_0x7273('0x24')](function(_0x2d2f5f){if(_0x2d2f5f){if(!fs['existsSync'](path[_0x7273('0x49')](config[_0x7273('0x4a')],_0x7273('0x4b'),_0x2d2f5f[_0x7273('0x47')]+'.'+_0x2d2f5f[_0x7273('0x48')]))){throw new db[(_0x7273('0x4c'))]['ValidationError']('Sound\x20not\x20found');}return _0x4f0191[_0x7273('0x4d')](path[_0x7273('0x49')](config[_0x7273('0x4a')],_0x7273('0x4b'),util[_0x7273('0x4e')]('%s.%s',_0x2d2f5f['save_name'],_0x2d2f5f[_0x7273('0x48')])),util[_0x7273('0x4e')](_0x7273('0x4f'),_0x2d2f5f[_0x7273('0x30')],_0x2d2f5f[_0x7273('0x48')]));}return null;})[_0x7273('0x40')](handleError(_0x4f0191,null));};exports['create']=function(_0x293751,_0x482752,_0x508a17){var _0x2255a7={'name':path[_0x7273('0x50')](_0x293751['file'][_0x7273('0x51')],path['extname'](_0x293751[_0x7273('0x52')]['originalname'])),'save_name':path[_0x7273('0x50')](_0x293751[_0x7273('0x52')][_0x7273('0x53')],path[_0x7273('0x54')](_0x293751[_0x7273('0x52')][_0x7273('0x53')])),'original_format':path[_0x7273('0x54')](_0x293751[_0x7273('0x52')][_0x7273('0x51')])['substring'](0x1),'converted_format':_0x7273('0x55')};var _0x1a5dc2=path[_0x7273('0x49')](config['root'],_0x7273('0x56'),_0x293751[_0x7273('0x52')][_0x7273('0x53')]);var _0x5ac693=path[_0x7273('0x49')](config[_0x7273('0x4a')],'server/files/sounds/converted',util[_0x7273('0x4e')](_0x7273('0x4f'),path[_0x7273('0x50')](_0x293751['file'][_0x7273('0x53')],path[_0x7273('0x54')](_0x293751[_0x7273('0x52')][_0x7273('0x53')])),_0x2255a7['converted_format']));logger[_0x7273('0x57')](_0x7273('0x58'),_0x1a5dc2);logger[_0x7273('0x57')](_0x7273('0x59'),_0x5ac693);try{fs[_0x7273('0x5a')](_0x1a5dc2,parseInt(_0x7273('0x5b'),0x8));var _0x164fa3=sox[_0x7273('0x5c')](_0x1a5dc2,_0x5ac693,{'sampleRate':0x1f40,'format':_0x7273('0x55'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x164fa3['on'](_0x7273('0x29'),function(_0x58e5e1){fs[_0x7273('0x5d')](_0x1a5dc2);_0x482752['status'](0x1f4)[_0x7273('0x2a')](_0x58e5e1);});_0x164fa3['on'](_0x7273('0x5e'),function(_0x5868c8){_0x2255a7[_0x7273('0x5f')]=isNaN(_0x5868c8[_0x7273('0x60')])?null:_0x5868c8['duration']*0x3e8;_0x2255a7[_0x7273('0x61')]=isNaN(_0x5868c8[_0x7273('0x62')])?null:_0x5868c8[_0x7273('0x62')];_0x2255a7[_0x7273('0x63')]=isNaN(_0x5868c8['channelCount'])?null:_0x5868c8[_0x7273('0x64')];_0x2255a7['original_bitRate']=isNaN(_0x5868c8[_0x7273('0x65')])?null:_0x5868c8[_0x7273('0x65')];_0x2255a7[_0x7273('0x66')]=isNaN(_0x5868c8[_0x7273('0x67')])?null:_0x5868c8[_0x7273('0x67')];});_0x164fa3['on'](_0x7273('0x68'),function(_0xbc82a1){_0x2255a7['converted_duration']=isNaN(_0xbc82a1[_0x7273('0x60')])?null:_0xbc82a1[_0x7273('0x60')]*0x3e8;_0x2255a7[_0x7273('0x69')]=isNaN(_0xbc82a1[_0x7273('0x62')])?null:_0xbc82a1[_0x7273('0x62')];_0x2255a7[_0x7273('0x6a')]=isNaN(_0xbc82a1[_0x7273('0x64')])?null:_0xbc82a1['channelCount'];_0x2255a7[_0x7273('0x6b')]=isNaN(_0xbc82a1[_0x7273('0x65')])?null:_0xbc82a1['bitRate'];_0x2255a7[_0x7273('0x6c')]=isNaN(_0xbc82a1[_0x7273('0x67')])?null:_0xbc82a1[_0x7273('0x67')];});_0x164fa3['on'](_0x7273('0x28'),function(){fs[_0x7273('0x5a')](_0x5ac693,parseInt(_0x7273('0x5b'),0x8));return db[_0x7273('0x2c')][_0x7273('0x6d')](_0x2255a7)['then'](function(_0x2b0fad){var _0x49ed31={'role':_0x293751['body'][_0x7273('0x6e')],'userProfileId':_0x293751['body'][_0x7273('0x6f')]};if(!_0x49ed31)throw new Error(_0x7273('0x70'));if(_0x49ed31['role']===_0x7273('0x71')){var _0xb6ddc8=_0x2b0fad[_0x7273('0x25')]({'plain':!![]});return db[_0x7273('0x72')]['find']({'where':{'name':_0x7273('0x26'),'userProfileId':_0x49ed31[_0x7273('0x6f')]},'raw':!![]})[_0x7273('0x24')](function(_0x4e2790){if(_0x4e2790&&_0x4e2790[_0x7273('0x73')]===0x0){return db[_0x7273('0x74')][_0x7273('0x6d')]({'name':_0xb6ddc8[_0x7273('0x30')],'resourceId':_0xb6ddc8['id'],'type':_0x4e2790[_0x7273('0x30')],'sectionId':_0x4e2790['id']},{})[_0x7273('0x24')](function(){return _0x2b0fad;});}else{return _0x2b0fad;}})[_0x7273('0x40')](function(_0x11749c){logger[_0x7273('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11749c);throw _0x11749c;});}return _0x2b0fad;})[_0x7273('0x24')](respondWithResult(_0x482752,null))[_0x7273('0x40')](handleError(_0x482752,null));});_0x164fa3[_0x7273('0x75')]();}catch(_0x45ad51){_0x482752[_0x7273('0x1c')](0x1f4)[_0x7273('0x2a')](_0x45ad51);}};exports[_0x7273('0x23')]=function(_0x17a74d,_0x235c02,_0x615131){return db[_0x7273('0x2c')][_0x7273('0x46')]({'where':{'id':_0x17a74d[_0x7273('0x42')]['id']}})['then'](handleEntityNotFound(_0x235c02,null))['then'](saveUpdates(_['pick'](_0x17a74d['body'],[_0x7273('0x30'),_0x7273('0x76')]),null))[_0x7273('0x24')](respondWithResult(_0x235c02,null))[_0x7273('0x40')](handleError(_0x235c02,null));};exports['delete']=function(_0x70d485,_0x1f9c66,_0x1945f3){return db[_0x7273('0x2c')][_0x7273('0x46')]({'where':{'id':_0x70d485[_0x7273('0x42')]['id']}})['then'](function(_0x4a9a65){if(_0x4a9a65){return _0x4a9a65[_0x7273('0x27')]();}})[_0x7273('0x24')](function(_0x174eff){var _0x5c76e6=path['join'](config[_0x7273('0x4a')],_0x7273('0x56'),util[_0x7273('0x4e')](_0x7273('0x4f'),_0x174eff['save_name'],_0x174eff[_0x7273('0x77')]));var _0xfd7585=path[_0x7273('0x49')](config[_0x7273('0x4a')],_0x7273('0x4b'),util['format'](_0x7273('0x4f'),_0x174eff[_0x7273('0x47')],_0x174eff[_0x7273('0x48')]));fs['unlinkSync'](_0x5c76e6);fs['unlinkSync'](_0xfd7585);return _0x174eff;})[_0x7273('0x24')](function(_0x84202f){if(_0x84202f){return _0x1f9c66[_0x7273('0x1c')](0xcc)[_0x7273('0x28')]();}})['then'](handleEntityNotFound(_0x1f9c66,null))[_0x7273('0x40')](handleError(_0x1f9c66,null));}; \ No newline at end of file +var _0x7aaf=['channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','Sound','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','find','catch','download','params','converted_format','join','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','extname','originalname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount'];(function(_0xf39b7d,_0x4a9dc2){var _0x29e7de=function(_0x5a5584){while(--_0x5a5584){_0xf39b7d['push'](_0xf39b7d['shift']());}};_0x29e7de(++_0x4a9dc2);}(_0x7aaf,0x17f));var _0xf7aa=function(_0x4eb932,_0x343763){_0x4eb932=_0x4eb932-0x0;var _0x1ae5f0=_0x7aaf[_0x4eb932];return _0x1ae5f0;};'use strict';var emlformat=require(_0xf7aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf7aa('0x1'));var jsonpatch=require(_0xf7aa('0x2'));var rp=require('request-promise');var moment=require(_0xf7aa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf7aa('0x4'));var util=require(_0xf7aa('0x5'));var path=require(_0xf7aa('0x6'));var sox=require(_0xf7aa('0x7'));var csv=require('to-csv');var ejs=require(_0xf7aa('0x8'));var fs=require('fs');var fs_extra=require(_0xf7aa('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf7aa('0xa'));var deskjs=require(_0xf7aa('0xb'));var toCsv=require(_0xf7aa('0xc'));var querystring=require(_0xf7aa('0xd'));var Papa=require(_0xf7aa('0xe'));var Redis=require(_0xf7aa('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf7aa('0x10'));var as=require(_0xf7aa('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf7aa('0x12'));var config=require(_0xf7aa('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xf7aa('0x14'))['db'];function respondWithStatusCode(_0x118206,_0x1b9f3c){_0x1b9f3c=_0x1b9f3c||0xcc;return function(_0x500584){if(_0x500584){return _0x118206['sendStatus'](_0x1b9f3c);}return _0x118206['status'](_0x1b9f3c)[_0xf7aa('0x15')]();};}function respondWithResult(_0x16b773,_0x5b4e21){_0x5b4e21=_0x5b4e21||0xc8;return function(_0x4361d6){if(_0x4361d6){return _0x16b773[_0xf7aa('0x16')](_0x5b4e21)[_0xf7aa('0x17')](_0x4361d6);}};}function respondWithFilteredResult(_0x17c17f,_0x4807fb){return function(_0x2adedd){if(_0x2adedd){var _0x148217=typeof _0x4807fb[_0xf7aa('0x18')]===_0xf7aa('0x19')&&typeof _0x4807fb['limit']===_0xf7aa('0x19');var _0x35c122=_0x2adedd[_0xf7aa('0x1a')];var _0x3154e2=_0x148217?0x0:_0x4807fb['offset'];var _0x160f45=_0x148217?_0x2adedd[_0xf7aa('0x1a')]:_0x4807fb[_0xf7aa('0x18')]+_0x4807fb[_0xf7aa('0x1b')];var _0x58a00f;if(_0x160f45>=_0x35c122){_0x160f45=_0x35c122;_0x58a00f=0xc8;}else{_0x58a00f=0xce;}_0x17c17f[_0xf7aa('0x16')](_0x58a00f);return _0x17c17f[_0xf7aa('0x1c')](_0xf7aa('0x1d'),_0x3154e2+'-'+_0x160f45+'/'+_0x35c122)[_0xf7aa('0x17')](_0x2adedd);}return null;};}function patchUpdates(_0x25278c){return function(_0x4cbb1f){try{jsonpatch['apply'](_0x4cbb1f,_0x25278c,!![]);}catch(_0xc6126a){return BPromise['reject'](_0xc6126a);}return _0x4cbb1f[_0xf7aa('0x1e')]();};}function saveUpdates(_0x31010e,_0x2b5f35){return function(_0x11ef32){if(_0x11ef32){return _0x11ef32[_0xf7aa('0x1f')](_0x31010e)[_0xf7aa('0x20')](function(_0x76ee07){return _0x76ee07;});}return null;};}function removeEntity(_0x291aff,_0x41b9c6){return function(_0x190a51){if(_0x190a51){return _0x190a51[_0xf7aa('0x21')]()[_0xf7aa('0x20')](function(){var _0x8518d5=_0x190a51[_0xf7aa('0x22')]({'plain':!![]});var _0x35e22a='Sounds';return db[_0xf7aa('0x23')][_0xf7aa('0x21')]({'where':{'type':_0x35e22a,'resourceId':_0x8518d5['id']}})[_0xf7aa('0x20')](function(){return _0x190a51;});})['then'](function(){_0x291aff[_0xf7aa('0x16')](0xcc)[_0xf7aa('0x15')]();});}};}function handleEntityNotFound(_0x19a20f,_0x26482b){return function(_0x2e7bce){if(!_0x2e7bce){_0x19a20f[_0xf7aa('0x24')](0x194);}return _0x2e7bce;};}function handleError(_0x14ecf6,_0x1f1738){_0x1f1738=_0x1f1738||0x1f4;return function(_0x5d1981){logger[_0xf7aa('0x25')](_0x5d1981[_0xf7aa('0x26')]);if(_0x5d1981[_0xf7aa('0x27')]){delete _0x5d1981[_0xf7aa('0x27')];}_0x14ecf6['status'](_0x1f1738)[_0xf7aa('0x28')](_0x5d1981);};}exports[_0xf7aa('0x29')]=function(_0x1c3d9d,_0x428621){var _0x1a6c70={},_0x3957c9={},_0x5b5d74={'count':0x0,'rows':[]};var _0xcf845b=_['map'](db[_0xf7aa('0x2a')]['rawAttributes'],function(_0x3dc5cd){return{'name':_0x3dc5cd[_0xf7aa('0x2b')],'type':_0x3dc5cd[_0xf7aa('0x2c')][_0xf7aa('0x2d')]};});_0x3957c9[_0xf7aa('0x2e')]=_[_0xf7aa('0x2f')](_0xcf845b,_0xf7aa('0x27'));_0x3957c9[_0xf7aa('0x30')]=_[_0xf7aa('0x31')](_0x1c3d9d[_0xf7aa('0x30')]);_0x3957c9[_0xf7aa('0x32')]=_[_0xf7aa('0x33')](_0x3957c9[_0xf7aa('0x2e')],_0x3957c9[_0xf7aa('0x30')]);_0x1a6c70[_0xf7aa('0x34')]=_[_0xf7aa('0x33')](_0x3957c9['model'],qs[_0xf7aa('0x35')](_0x1c3d9d[_0xf7aa('0x30')][_0xf7aa('0x35')]));_0x1a6c70['attributes']=_0x1a6c70[_0xf7aa('0x34')][_0xf7aa('0x36')]?_0x1a6c70[_0xf7aa('0x34')]:_0x3957c9['model'];if(!_0x1c3d9d[_0xf7aa('0x30')][_0xf7aa('0x37')](_0xf7aa('0x38'))){_0x1a6c70[_0xf7aa('0x1b')]=qs[_0xf7aa('0x1b')](_0x1c3d9d[_0xf7aa('0x30')][_0xf7aa('0x1b')]);_0x1a6c70[_0xf7aa('0x18')]=qs['offset'](_0x1c3d9d['query'][_0xf7aa('0x18')]);}_0x1a6c70[_0xf7aa('0x39')]=qs[_0xf7aa('0x3a')](_0x1c3d9d[_0xf7aa('0x30')][_0xf7aa('0x3a')]);_0x1a6c70['where']=qs[_0xf7aa('0x32')](_[_0xf7aa('0x3b')](_0x1c3d9d[_0xf7aa('0x30')],_0x3957c9[_0xf7aa('0x32')]),_0xcf845b);if(_0x1c3d9d[_0xf7aa('0x30')][_0xf7aa('0x3c')]){_0x1a6c70[_0xf7aa('0x3d')]=_[_0xf7aa('0x3e')](_0x1a6c70[_0xf7aa('0x3d')],{'$or':_[_0xf7aa('0x2f')](_0xcf845b,function(_0x17b759){if(_0x17b759[_0xf7aa('0x2c')]!==_0xf7aa('0x3f')){var _0x1e8344={};_0x1e8344[_0x17b759[_0xf7aa('0x27')]]={'$like':'%'+_0x1c3d9d[_0xf7aa('0x30')][_0xf7aa('0x3c')]+'%'};return _0x1e8344;}})});}_0x1a6c70=_[_0xf7aa('0x3e')]({},_0x1a6c70,_0x1c3d9d[_0xf7aa('0x40')]);var _0x18dc54={'where':_0x1a6c70['where']};return db[_0xf7aa('0x2a')]['count'](_0x18dc54)[_0xf7aa('0x20')](function(_0x3bec49){_0x5b5d74[_0xf7aa('0x1a')]=_0x3bec49;if(_0x1c3d9d['query'][_0xf7aa('0x41')]){_0x1a6c70['include']=[{'all':!![]}];}return db[_0xf7aa('0x2a')][_0xf7aa('0x42')](_0x1a6c70);})['then'](function(_0x34d7ce){_0x5b5d74[_0xf7aa('0x43')]=_0x34d7ce;return _0x5b5d74;})[_0xf7aa('0x20')](respondWithFilteredResult(_0x428621,_0x1a6c70))['catch'](handleError(_0x428621,null));};exports[_0xf7aa('0x44')]=function(_0x195d74,_0x563ccb){var _0x17bb19={'raw':!![],'where':{'id':_0x195d74['params']['id']}},_0x502d13={};_0x502d13[_0xf7aa('0x2e')]=_[_0xf7aa('0x31')](db[_0xf7aa('0x2a')]['rawAttributes']);_0x502d13[_0xf7aa('0x30')]=_[_0xf7aa('0x31')](_0x195d74[_0xf7aa('0x30')]);_0x502d13[_0xf7aa('0x32')]=_[_0xf7aa('0x33')](_0x502d13['model'],_0x502d13[_0xf7aa('0x30')]);_0x17bb19['attributes']=_[_0xf7aa('0x33')](_0x502d13[_0xf7aa('0x2e')],qs[_0xf7aa('0x35')](_0x195d74['query'][_0xf7aa('0x35')]));_0x17bb19[_0xf7aa('0x34')]=_0x17bb19['attributes'][_0xf7aa('0x36')]?_0x17bb19[_0xf7aa('0x34')]:_0x502d13['model'];if(_0x195d74[_0xf7aa('0x30')][_0xf7aa('0x41')]){_0x17bb19[_0xf7aa('0x45')]=[{'all':!![]}];}_0x17bb19=_[_0xf7aa('0x3e')]({},_0x17bb19,_0x195d74[_0xf7aa('0x40')]);return db[_0xf7aa('0x2a')][_0xf7aa('0x46')](_0x17bb19)[_0xf7aa('0x20')](handleEntityNotFound(_0x563ccb,null))['then'](respondWithResult(_0x563ccb,null))[_0xf7aa('0x47')](handleError(_0x563ccb,null));};exports[_0xf7aa('0x48')]=function(_0x48808f,_0x46a265,_0x3099c6){return db['Sound'][_0xf7aa('0x46')]({'where':{'id':_0x48808f[_0xf7aa('0x49')]['id']},'attributes':['name','save_name',_0xf7aa('0x4a')],'raw':!![]})[_0xf7aa('0x20')](handleEntityNotFound(_0x46a265,null))['then'](function(_0x4f45c7){if(_0x4f45c7){if(!fs['existsSync'](path[_0xf7aa('0x4b')](config['root'],_0xf7aa('0x4c'),_0x4f45c7[_0xf7aa('0x4d')]+'.'+_0x4f45c7[_0xf7aa('0x4a')]))){throw new db[(_0xf7aa('0x4e'))][(_0xf7aa('0x4f'))](_0xf7aa('0x50'));}return _0x46a265[_0xf7aa('0x48')](path['join'](config[_0xf7aa('0x51')],_0xf7aa('0x4c'),util[_0xf7aa('0x52')](_0xf7aa('0x53'),_0x4f45c7[_0xf7aa('0x4d')],_0x4f45c7[_0xf7aa('0x4a')])),util[_0xf7aa('0x52')](_0xf7aa('0x53'),_0x4f45c7[_0xf7aa('0x27')],_0x4f45c7[_0xf7aa('0x4a')]));}return null;})[_0xf7aa('0x47')](handleError(_0x46a265,null));};exports[_0xf7aa('0x54')]=function(_0x5084bb,_0xed34e5,_0xe450a6){var _0x2e1bae={'name':path[_0xf7aa('0x55')](_0x5084bb['file']['originalname'],path[_0xf7aa('0x56')](_0x5084bb['file'][_0xf7aa('0x57')])),'save_name':path[_0xf7aa('0x55')](_0x5084bb[_0xf7aa('0x58')][_0xf7aa('0x59')],path['extname'](_0x5084bb[_0xf7aa('0x58')]['filename'])),'original_format':path[_0xf7aa('0x56')](_0x5084bb[_0xf7aa('0x58')][_0xf7aa('0x57')])[_0xf7aa('0x5a')](0x1),'converted_format':_0xf7aa('0x5b')};var _0x1b7ca8=path[_0xf7aa('0x4b')](config[_0xf7aa('0x51')],_0xf7aa('0x5c'),_0x5084bb['file'][_0xf7aa('0x59')]);var _0x2f522c=path[_0xf7aa('0x4b')](config[_0xf7aa('0x51')],_0xf7aa('0x4c'),util[_0xf7aa('0x52')]('%s.%s',path[_0xf7aa('0x55')](_0x5084bb[_0xf7aa('0x58')]['filename'],path[_0xf7aa('0x56')](_0x5084bb['file'][_0xf7aa('0x59')])),_0x2e1bae[_0xf7aa('0x4a')]));logger[_0xf7aa('0x5d')](_0xf7aa('0x5e'),_0x1b7ca8);logger[_0xf7aa('0x5d')](_0xf7aa('0x5f'),_0x2f522c);try{fs['chmodSync'](_0x1b7ca8,parseInt(_0xf7aa('0x60'),0x8));var _0x409a59=sox[_0xf7aa('0x61')](_0x1b7ca8,_0x2f522c,{'sampleRate':0x1f40,'format':_0xf7aa('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x409a59['on'](_0xf7aa('0x25'),function(_0x28ee60){fs[_0xf7aa('0x62')](_0x1b7ca8);_0xed34e5[_0xf7aa('0x16')](0x1f4)[_0xf7aa('0x28')](_0x28ee60);});_0x409a59['on'](_0xf7aa('0x63'),function(_0x40ab62){_0x2e1bae[_0xf7aa('0x64')]=isNaN(_0x40ab62[_0xf7aa('0x65')])?null:_0x40ab62[_0xf7aa('0x65')]*0x3e8;_0x2e1bae[_0xf7aa('0x66')]=isNaN(_0x40ab62[_0xf7aa('0x67')])?null:_0x40ab62[_0xf7aa('0x67')];_0x2e1bae[_0xf7aa('0x68')]=isNaN(_0x40ab62[_0xf7aa('0x69')])?null:_0x40ab62['channelCount'];_0x2e1bae[_0xf7aa('0x6a')]=isNaN(_0x40ab62[_0xf7aa('0x6b')])?null:_0x40ab62[_0xf7aa('0x6b')];_0x2e1bae[_0xf7aa('0x6c')]=isNaN(_0x40ab62[_0xf7aa('0x6d')])?null:_0x40ab62[_0xf7aa('0x6d')];});_0x409a59['on'](_0xf7aa('0x6e'),function(_0x411601){_0x2e1bae['converted_duration']=isNaN(_0x411601[_0xf7aa('0x65')])?null:_0x411601['duration']*0x3e8;_0x2e1bae['converted_sampleCount']=isNaN(_0x411601[_0xf7aa('0x67')])?null:_0x411601['sampleCount'];_0x2e1bae['converted_channelCount']=isNaN(_0x411601[_0xf7aa('0x69')])?null:_0x411601[_0xf7aa('0x69')];_0x2e1bae['converted_bitRate']=isNaN(_0x411601[_0xf7aa('0x6b')])?null:_0x411601[_0xf7aa('0x6b')];_0x2e1bae[_0xf7aa('0x6f')]=isNaN(_0x411601[_0xf7aa('0x6d')])?null:_0x411601['sampleRate'];});_0x409a59['on']('end',function(){fs['chmodSync'](_0x2f522c,parseInt(_0xf7aa('0x60'),0x8));return db[_0xf7aa('0x2a')][_0xf7aa('0x54')](_0x2e1bae)[_0xf7aa('0x20')](function(_0x268607){var _0x5821db={'role':_0x5084bb['body'][_0xf7aa('0x70')],'userProfileId':_0x5084bb[_0xf7aa('0x71')][_0xf7aa('0x72')]};if(!_0x5821db)throw new Error(_0xf7aa('0x73'));if(_0x5821db['role']==='user'){var _0x1eb48e=_0x268607['get']({'plain':!![]});return db[_0xf7aa('0x74')]['find']({'where':{'name':'Sounds','userProfileId':_0x5821db['userProfileId']},'raw':!![]})[_0xf7aa('0x20')](function(_0xa648cb){if(_0xa648cb&&_0xa648cb['autoAssociation']===0x0){return db[_0xf7aa('0x23')][_0xf7aa('0x54')]({'name':_0x1eb48e[_0xf7aa('0x27')],'resourceId':_0x1eb48e['id'],'type':_0xa648cb[_0xf7aa('0x27')],'sectionId':_0xa648cb['id']},{})[_0xf7aa('0x20')](function(){return _0x268607;});}else{return _0x268607;}})[_0xf7aa('0x47')](function(_0x3cc87b){logger['error'](_0xf7aa('0x75'),_0x3cc87b);throw _0x3cc87b;});}return _0x268607;})['then'](respondWithResult(_0xed34e5,null))['catch'](handleError(_0xed34e5,null));});_0x409a59[_0xf7aa('0x76')]();}catch(_0x4d3452){_0xed34e5['status'](0x1f4)[_0xf7aa('0x28')](_0x4d3452);}};exports[_0xf7aa('0x1f')]=function(_0x45d427,_0xba3ce2,_0x56295d){return db['Sound'][_0xf7aa('0x46')]({'where':{'id':_0x45d427[_0xf7aa('0x49')]['id']}})['then'](handleEntityNotFound(_0xba3ce2,null))['then'](saveUpdates(_[_0xf7aa('0x3b')](_0x45d427[_0xf7aa('0x71')],[_0xf7aa('0x27'),_0xf7aa('0x77')]),null))[_0xf7aa('0x20')](respondWithResult(_0xba3ce2,null))[_0xf7aa('0x47')](handleError(_0xba3ce2,null));};exports[_0xf7aa('0x78')]=function(_0x3b4fb2,_0x5e8a42,_0x361d00){return db[_0xf7aa('0x2a')][_0xf7aa('0x46')]({'where':{'id':_0x3b4fb2[_0xf7aa('0x49')]['id']}})[_0xf7aa('0x20')](function(_0x666c59){if(_0x666c59){return _0x666c59[_0xf7aa('0x21')]();}})[_0xf7aa('0x20')](function(_0x19caee){var _0x2a73d1=path[_0xf7aa('0x4b')](config[_0xf7aa('0x51')],'server/files/sounds/original',util[_0xf7aa('0x52')](_0xf7aa('0x53'),_0x19caee['save_name'],_0x19caee[_0xf7aa('0x79')]));var _0x5d5206=path[_0xf7aa('0x4b')](config[_0xf7aa('0x51')],'server/files/sounds/converted',util[_0xf7aa('0x52')](_0xf7aa('0x53'),_0x19caee[_0xf7aa('0x4d')],_0x19caee['converted_format']));fs['unlinkSync'](_0x2a73d1);fs[_0xf7aa('0x62')](_0x5d5206);return _0x19caee;})[_0xf7aa('0x20')](function(_0x5456f4){if(_0x5456f4){return _0x5e8a42[_0xf7aa('0x16')](0xcc)[_0xf7aa('0x15')]();}})[_0xf7aa('0x20')](handleEntityNotFound(_0x5e8a42,null))[_0xf7aa('0x47')](handleError(_0x5e8a42,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 896426b..0269528 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 _0xe24a=['../../config/logger','api','moment','bluebird','path','rimraf','exports','define','tools_sounds','util'];(function(_0x26e877,_0x2ea634){var _0x2d390=function(_0x59c851){while(--_0x59c851){_0x26e877['push'](_0x26e877['shift']());}};_0x2d390(++_0x2ea634);}(_0xe24a,0xc7));var _0xae24=function(_0x4b388f,_0x20e19c){_0x4b388f=_0x4b388f-0x0;var _0x4d70f7=_0xe24a[_0x4b388f];return _0x4d70f7;};'use strict';var _=require('lodash');var util=require(_0xae24('0x0'));var logger=require(_0xae24('0x1'))(_0xae24('0x2'));var moment=require(_0xae24('0x3'));var BPromise=require(_0xae24('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae24('0x5'));var rimraf=require(_0xae24('0x6'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0xae24('0x7')]=function(_0x54fcea,_0x3502d5){return _0x54fcea[_0xae24('0x8')]('Sound',attributes,{'tableName':_0xae24('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f40=['tools_sounds','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x5f40,0x1e2));var _0x05f4=function(_0x2aca13,_0xfa6316){_0x2aca13=_0x2aca13-0x0;var _0x391311=_0x5f40[_0x2aca13];return _0x391311;};'use strict';var _=require('lodash');var util=require(_0x05f4('0x0'));var logger=require(_0x05f4('0x1'))(_0x05f4('0x2'));var moment=require('moment');var BPromise=require(_0x05f4('0x3'));var rp=require(_0x05f4('0x4'));var fs=require('fs');var path=require(_0x05f4('0x5'));var rimraf=require(_0x05f4('0x6'));var config=require(_0x05f4('0x7'));var attributes=require(_0x05f4('0x8'));module[_0x05f4('0x9')]=function(_0x30b992,_0x6f90d5){return _0x30b992[_0x05f4('0xa')](_0x05f4('0xb'),attributes,{'tableName':_0x05f4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 439f982..3639aac 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 _0xec19=['Sound,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowSound','find','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x12af72,_0x16c27e){var _0x393472=function(_0x2009c3){while(--_0x2009c3){_0x12af72['push'](_0x12af72['shift']());}};_0x393472(++_0x16c27e);}(_0xec19,0x93));var _0x9ec1=function(_0x17b1d8,_0x3beccd){_0x17b1d8=_0x17b1d8-0x0;var _0x32572d=_0xec19[_0x17b1d8];return _0x32572d;};'use strict';var _=require(_0x9ec1('0x0'));var util=require(_0x9ec1('0x1'));var moment=require(_0x9ec1('0x2'));var BPromise=require(_0x9ec1('0x3'));var rs=require(_0x9ec1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ec1('0x5'))['db'];var utils=require(_0x9ec1('0x6'));var logger=require(_0x9ec1('0x7'))(_0x9ec1('0x8'));var config=require(_0x9ec1('0x9'));var jayson=require(_0x9ec1('0xa'));var client=jayson[_0x9ec1('0xb')][_0x9ec1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x285878,_0x53913d,_0x289a8a){return new BPromise(function(_0x15e382,_0x79243){return client['request'](_0x285878,_0x289a8a)[_0x9ec1('0xd')](function(_0x17e15b){logger[_0x9ec1('0xe')](_0x9ec1('0xf'),_0x53913d,_0x9ec1('0x10'));logger[_0x9ec1('0x11')](_0x9ec1('0x12'),_0x53913d,'request\x20sent',JSON[_0x9ec1('0x13')](_0x17e15b));if(_0x17e15b['error']){if(_0x17e15b['error'][_0x9ec1('0x14')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x53913d,_0x17e15b[_0x9ec1('0x15')]['message']);return _0x79243(_0x17e15b['error']['message']);}logger[_0x9ec1('0x15')](_0x9ec1('0xf'),_0x53913d,_0x17e15b[_0x9ec1('0x15')][_0x9ec1('0x16')]);return _0x15e382(_0x17e15b[_0x9ec1('0x15')]['message']);}else{logger[_0x9ec1('0xe')](_0x9ec1('0xf'),_0x53913d,'request\x20sent');_0x15e382(_0x17e15b[_0x9ec1('0x17')][_0x9ec1('0x16')]);}})[_0x9ec1('0x18')](function(_0x2420d2){logger[_0x9ec1('0x15')](_0x9ec1('0xf'),_0x53913d,_0x2420d2);_0x79243(_0x2420d2);});});}exports[_0x9ec1('0x19')]=function(_0x39fc1f){var _0x556160=this;return new Promise(function(_0x4ae208,_0x404a77){return db['Sound'][_0x9ec1('0x1a')]({'raw':_0x39fc1f['options']?_0x39fc1f[_0x9ec1('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x39fc1f[_0x9ec1('0x1b')]?_0x39fc1f[_0x9ec1('0x1b')][_0x9ec1('0x1c')]||null:null,'attributes':_0x39fc1f[_0x9ec1('0x1b')]?_0x39fc1f[_0x9ec1('0x1b')][_0x9ec1('0x1d')]||null:null,'include':_0x39fc1f[_0x9ec1('0x1b')]?_0x39fc1f[_0x9ec1('0x1b')][_0x9ec1('0x1e')]?_[_0x9ec1('0x1f')](_0x39fc1f[_0x9ec1('0x1b')]['include'],function(_0x25fa80){return{'model':db[_0x25fa80['model']],'as':_0x25fa80['as'],'attributes':_0x25fa80[_0x9ec1('0x1d')],'include':_0x25fa80[_0x9ec1('0x1e')]?_[_0x9ec1('0x1f')](_0x25fa80[_0x9ec1('0x1e')],function(_0x487f99){return{'model':db[_0x487f99[_0x9ec1('0x20')]],'as':_0x487f99['as'],'attributes':_0x487f99[_0x9ec1('0x1d')],'include':_0x487f99['include']?_['map'](_0x487f99[_0x9ec1('0x1e')],function(_0x50f656){return{'model':db[_0x50f656[_0x9ec1('0x20')]],'as':_0x50f656['as'],'attributes':_0x50f656[_0x9ec1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9ec1('0xd')](function(_0x47092f){logger[_0x9ec1('0xe')](_0x9ec1('0x19'),_0x39fc1f);logger[_0x9ec1('0x11')]('ShowSound',_0x39fc1f,JSON['stringify'](_0x47092f));_0x4ae208(_0x47092f);})[_0x9ec1('0x18')](function(_0x1ac2c0){logger[_0x9ec1('0x15')]('ShowSound',_0x1ac2c0[_0x9ec1('0x16')],_0x39fc1f);_0x404a77(_0x556160[_0x9ec1('0x15')](0x1f4,_0x1ac2c0[_0x9ec1('0x16')]));});});}; \ No newline at end of file +var _0x029a=['find','options','where','include','map','attributes','model','then','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','Sound,\x20%s,\x20%s','message','result','ShowSound'];(function(_0x41dfa4,_0x1947ae){var _0x30f737=function(_0x268c36){while(--_0x268c36){_0x41dfa4['push'](_0x41dfa4['shift']());}};_0x30f737(++_0x1947ae);}(_0x029a,0x7d));var _0xa029=function(_0x9c91b4,_0x444e64){_0x9c91b4=_0x9c91b4-0x0;var _0x4be2ab=_0x029a[_0x9c91b4];return _0x4be2ab;};'use strict';var _=require(_0xa029('0x0'));var util=require(_0xa029('0x1'));var moment=require(_0xa029('0x2'));var BPromise=require(_0xa029('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa029('0x4'));var db=require(_0xa029('0x5'))['db'];var utils=require(_0xa029('0x6'));var logger=require('../../config/logger')(_0xa029('0x7'));var config=require('../../config/environment');var jayson=require(_0xa029('0x8'));var client=jayson[_0xa029('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a1654,_0x26780e,_0x54bb68){return new BPromise(function(_0x39c83e,_0x157c6c){return client[_0xa029('0xa')](_0x2a1654,_0x54bb68)['then'](function(_0x376191){logger[_0xa029('0xb')]('Sound,\x20%s,\x20%s',_0x26780e,_0xa029('0xc'));logger[_0xa029('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x26780e,_0xa029('0xc'),JSON[_0xa029('0xe')](_0x376191));if(_0x376191[_0xa029('0xf')]){if(_0x376191[_0xa029('0xf')]['code']===0x1f4){logger[_0xa029('0xf')](_0xa029('0x10'),_0x26780e,_0x376191[_0xa029('0xf')][_0xa029('0x11')]);return _0x157c6c(_0x376191[_0xa029('0xf')][_0xa029('0x11')]);}logger[_0xa029('0xf')]('Sound,\x20%s,\x20%s',_0x26780e,_0x376191[_0xa029('0xf')]['message']);return _0x39c83e(_0x376191[_0xa029('0xf')][_0xa029('0x11')]);}else{logger[_0xa029('0xb')]('Sound,\x20%s,\x20%s',_0x26780e,_0xa029('0xc'));_0x39c83e(_0x376191[_0xa029('0x12')][_0xa029('0x11')]);}})['catch'](function(_0x5e30bc){logger['error'](_0xa029('0x10'),_0x26780e,_0x5e30bc);_0x157c6c(_0x5e30bc);});});}exports[_0xa029('0x13')]=function(_0x5ae691){var _0x58d82b=this;return new Promise(function(_0x2109db,_0x60cb35){return db['Sound'][_0xa029('0x14')]({'raw':_0x5ae691['options']?_0x5ae691[_0xa029('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5ae691['options']?_0x5ae691[_0xa029('0x15')][_0xa029('0x16')]||null:null,'attributes':_0x5ae691['options']?_0x5ae691[_0xa029('0x15')]['attributes']||null:null,'include':_0x5ae691[_0xa029('0x15')]?_0x5ae691[_0xa029('0x15')][_0xa029('0x17')]?_[_0xa029('0x18')](_0x5ae691[_0xa029('0x15')][_0xa029('0x17')],function(_0x2b3c1f){return{'model':db[_0x2b3c1f['model']],'as':_0x2b3c1f['as'],'attributes':_0x2b3c1f[_0xa029('0x19')],'include':_0x2b3c1f['include']?_[_0xa029('0x18')](_0x2b3c1f[_0xa029('0x17')],function(_0x583849){return{'model':db[_0x583849[_0xa029('0x1a')]],'as':_0x583849['as'],'attributes':_0x583849[_0xa029('0x19')],'include':_0x583849['include']?_['map'](_0x583849['include'],function(_0x57ca79){return{'model':db[_0x57ca79[_0xa029('0x1a')]],'as':_0x57ca79['as'],'attributes':_0x57ca79[_0xa029('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa029('0x1b')](function(_0x2cbb14){logger['info'](_0xa029('0x13'),_0x5ae691);logger['debug'](_0xa029('0x13'),_0x5ae691,JSON[_0xa029('0xe')](_0x2cbb14));_0x2109db(_0x2cbb14);})[_0xa029('0x1c')](function(_0x1e739d){logger[_0xa029('0xf')](_0xa029('0x13'),_0x1e739d[_0xa029('0x11')],_0x5ae691);_0x60cb35(_0x58d82b[_0xa029('0xf')](0x1f4,_0x1e739d[_0xa029('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 5414d47..d0b5d9f 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 _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x321e39,_0x2f99c8){var _0x2e5be2=function(_0x14fa6a){while(--_0x14fa6a){_0x321e39['push'](_0x321e39['shift']());}};_0x2e5be2(++_0x2f99c8);}(_0x14a0,0x8e));var _0x014a=function(_0x2c925a,_0x3a1140){_0x2c925a=_0x2c925a-0x0;var _0x1edfea=_0x14a0[_0x2c925a];return _0x1edfea;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x2acd8b,_0x3184b3){var _0x35d63f=function(_0xf54d4){while(--_0xf54d4){_0x2acd8b['push'](_0x2acd8b['shift']());}};_0x35d63f(++_0x3184b3);}(_0x2032,0xd9));var _0x2203=function(_0x3371ff,_0x53b9a7){_0x3371ff=_0x3371ff-0x0;var _0x3894f5=_0x2032[_0x3371ff];return _0x3894f5;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 9504708..fffd4d4 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 _0x04fc=['exports','STRING','TEXT','ENUM','out','sequelize'];(function(_0xee1e9e,_0xa20e6b){var _0x17c9ce=function(_0x2dd675){while(--_0x2dd675){_0xee1e9e['push'](_0xee1e9e['shift']());}};_0x17c9ce(++_0xa20e6b);}(_0x04fc,0x65));var _0xc04f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x04fc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc04f('0x0'));module[_0xc04f('0x1')]={'uniqueid':{'type':Sequelize[_0xc04f('0x2')]},'body':{'type':Sequelize[_0xc04f('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xc04f('0x4')]('in',_0xc04f('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc04f('0x3')]}}; \ No newline at end of file +var _0x46d0=['ENUM','out','sequelize','STRING','TEXT','medium'];(function(_0x3b50f4,_0x3de17b){var _0xe2acb0=function(_0x3e127f){while(--_0x3e127f){_0x3b50f4['push'](_0x3b50f4['shift']());}};_0xe2acb0(++_0x3de17b);}(_0x46d0,0x110));var _0x046d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x46d0[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x046d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x046d('0x1')]},'body':{'type':Sequelize[_0x046d('0x2')](_0x046d('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x046d('0x4')]('in','out'),'defaultValue':_0x046d('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x046d('0x1')]},'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 37b41fe..7acd05c 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 _0xaa7c=['VIRTUAL','includeAll','include','SquareMessage','findAll','rows','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','filter','where','merge'];(function(_0x13de5d,_0x50b337){var _0x11d382=function(_0x372d2e){while(--_0x372d2e){_0x13de5d['push'](_0x13de5d['shift']());}};_0x11d382(++_0x50b337);}(_0xaa7c,0x18e));var _0xcaa7=function(_0x47915,_0x589b6b){_0x47915=_0x47915-0x0;var _0x20f5b8=_0xaa7c[_0x47915];return _0x20f5b8;};'use strict';var emlformat=require(_0xcaa7('0x0'));var rimraf=require(_0xcaa7('0x1'));var zipdir=require(_0xcaa7('0x2'));var jsonpatch=require(_0xcaa7('0x3'));var rp=require(_0xcaa7('0x4'));var moment=require('moment');var BPromise=require(_0xcaa7('0x5'));var Mustache=require(_0xcaa7('0x6'));var util=require(_0xcaa7('0x7'));var path=require(_0xcaa7('0x8'));var sox=require(_0xcaa7('0x9'));var csv=require(_0xcaa7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcaa7('0xb'));var _=require('lodash');var squel=require(_0xcaa7('0xc'));var crypto=require(_0xcaa7('0xd'));var jsforce=require(_0xcaa7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcaa7('0xa'));var querystring=require(_0xcaa7('0xf'));var Papa=require(_0xcaa7('0x10'));var Redis=require(_0xcaa7('0x11'));var authService=require(_0xcaa7('0x12'));var qs=require(_0xcaa7('0x13'));var as=require(_0xcaa7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcaa7('0x15'))(_0xcaa7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcaa7('0x17'));var db=require(_0xcaa7('0x18'))['db'];function respondWithStatusCode(_0x1cb51f,_0x4c8abe){_0x4c8abe=_0x4c8abe||0xcc;return function(_0x1d456a){if(_0x1d456a){return _0x1cb51f['sendStatus'](_0x4c8abe);}return _0x1cb51f['status'](_0x4c8abe)['end']();};}function respondWithResult(_0x47b51c,_0x1e2275){_0x1e2275=_0x1e2275||0xc8;return function(_0x5c4590){if(_0x5c4590){return _0x47b51c[_0xcaa7('0x19')](_0x1e2275)[_0xcaa7('0x1a')](_0x5c4590);}};}function respondWithFilteredResult(_0x15e41d,_0x5b08c3){return function(_0x221c68){if(_0x221c68){var _0x15d730=typeof _0x5b08c3['offset']===_0xcaa7('0x1b')&&typeof _0x5b08c3[_0xcaa7('0x1c')]===_0xcaa7('0x1b');var _0x2f69e8=_0x221c68[_0xcaa7('0x1d')];var _0x1b482c=_0x15d730?0x0:_0x5b08c3['offset'];var _0xdb154d=_0x15d730?_0x221c68[_0xcaa7('0x1d')]:_0x5b08c3[_0xcaa7('0x1e')]+_0x5b08c3[_0xcaa7('0x1c')];var _0x43bd9e;if(_0xdb154d>=_0x2f69e8){_0xdb154d=_0x2f69e8;_0x43bd9e=0xc8;}else{_0x43bd9e=0xce;}_0x15e41d[_0xcaa7('0x19')](_0x43bd9e);return _0x15e41d[_0xcaa7('0x1f')](_0xcaa7('0x20'),_0x1b482c+'-'+_0xdb154d+'/'+_0x2f69e8)['json'](_0x221c68);}return null;};}function patchUpdates(_0x123ef4){return function(_0x500b6f){try{jsonpatch[_0xcaa7('0x21')](_0x500b6f,_0x123ef4,!![]);}catch(_0x16437c){return BPromise[_0xcaa7('0x22')](_0x16437c);}return _0x500b6f[_0xcaa7('0x23')]();};}function saveUpdates(_0x59f6c6,_0x3751f6){return function(_0x229f2f){if(_0x229f2f){return _0x229f2f[_0xcaa7('0x24')](_0x59f6c6)[_0xcaa7('0x25')](function(_0x48f766){return _0x48f766;});}return null;};}function removeEntity(_0x33965d,_0x129fa9){return function(_0x45aacb){if(_0x45aacb){return _0x45aacb[_0xcaa7('0x26')]()[_0xcaa7('0x25')](function(){_0x33965d[_0xcaa7('0x19')](0xcc)[_0xcaa7('0x27')]();});}};}function handleEntityNotFound(_0x438047,_0xac97bf){return function(_0x4ba754){if(!_0x4ba754){_0x438047[_0xcaa7('0x28')](0x194);}return _0x4ba754;};}function handleError(_0x2c2667,_0x31ccf6){_0x31ccf6=_0x31ccf6||0x1f4;return function(_0x312a7f){logger[_0xcaa7('0x29')](_0x312a7f[_0xcaa7('0x2a')]);if(_0x312a7f[_0xcaa7('0x2b')]){delete _0x312a7f[_0xcaa7('0x2b')];}_0x2c2667[_0xcaa7('0x19')](_0x31ccf6)[_0xcaa7('0x2c')](_0x312a7f);};}exports[_0xcaa7('0x2d')]=function(_0x56e9c4,_0x17558a){var _0x453c4d={},_0x31be4a={},_0x523270={'count':0x0,'rows':[]};var _0x4daafc=_[_0xcaa7('0x2e')](db['SquareMessage'][_0xcaa7('0x2f')],function(_0x414c38){return{'name':_0x414c38[_0xcaa7('0x30')],'type':_0x414c38[_0xcaa7('0x31')][_0xcaa7('0x32')]};});_0x31be4a[_0xcaa7('0x33')]=_[_0xcaa7('0x2e')](_0x4daafc,_0xcaa7('0x2b'));_0x31be4a[_0xcaa7('0x34')]=_[_0xcaa7('0x35')](_0x56e9c4[_0xcaa7('0x34')]);_0x31be4a[_0xcaa7('0x36')]=_[_0xcaa7('0x37')](_0x31be4a[_0xcaa7('0x33')],_0x31be4a['query']);_0x453c4d['attributes']=_[_0xcaa7('0x37')](_0x31be4a[_0xcaa7('0x33')],qs['fields'](_0x56e9c4['query'][_0xcaa7('0x38')]));_0x453c4d['attributes']=_0x453c4d[_0xcaa7('0x39')][_0xcaa7('0x3a')]?_0x453c4d['attributes']:_0x31be4a['model'];if(!_0x56e9c4[_0xcaa7('0x34')]['hasOwnProperty'](_0xcaa7('0x3b'))){_0x453c4d[_0xcaa7('0x1c')]=qs[_0xcaa7('0x1c')](_0x56e9c4[_0xcaa7('0x34')][_0xcaa7('0x1c')]);_0x453c4d['offset']=qs[_0xcaa7('0x1e')](_0x56e9c4[_0xcaa7('0x34')][_0xcaa7('0x1e')]);}_0x453c4d['order']=qs[_0xcaa7('0x3c')](_0x56e9c4['query'][_0xcaa7('0x3c')]);_0x453c4d['where']=qs['filters'](_['pick'](_0x56e9c4[_0xcaa7('0x34')],_0x31be4a[_0xcaa7('0x36')]),_0x4daafc);if(_0x56e9c4['query'][_0xcaa7('0x3d')]){_0x453c4d[_0xcaa7('0x3e')]=_[_0xcaa7('0x3f')](_0x453c4d[_0xcaa7('0x3e')],{'$or':_['map'](_0x4daafc,function(_0x3d539d){if(_0x3d539d[_0xcaa7('0x31')]!==_0xcaa7('0x40')){var _0x35fdc8={};_0x35fdc8[_0x3d539d[_0xcaa7('0x2b')]]={'$like':'%'+_0x56e9c4['query'][_0xcaa7('0x3d')]+'%'};return _0x35fdc8;}})});}_0x453c4d=_[_0xcaa7('0x3f')]({},_0x453c4d,_0x56e9c4['options']);var _0x35b989={'where':_0x453c4d[_0xcaa7('0x3e')]};return db['SquareMessage'][_0xcaa7('0x1d')](_0x35b989)[_0xcaa7('0x25')](function(_0x25395c){_0x523270[_0xcaa7('0x1d')]=_0x25395c;if(_0x56e9c4[_0xcaa7('0x34')][_0xcaa7('0x41')]){_0x453c4d[_0xcaa7('0x42')]=[{'all':!![]}];}return db[_0xcaa7('0x43')][_0xcaa7('0x44')](_0x453c4d);})[_0xcaa7('0x25')](function(_0x5307ea){_0x523270[_0xcaa7('0x45')]=_0x5307ea;return _0x523270;})[_0xcaa7('0x25')](respondWithFilteredResult(_0x17558a,_0x453c4d))[_0xcaa7('0x46')](handleError(_0x17558a,null));};exports[_0xcaa7('0x47')]=function(_0x3b527c,_0x1e227f){var _0x40b7ae={'raw':!![],'where':{'id':_0x3b527c['params']['id']}},_0x4ab424={};_0x4ab424[_0xcaa7('0x33')]=_[_0xcaa7('0x35')](db[_0xcaa7('0x43')][_0xcaa7('0x2f')]);_0x4ab424[_0xcaa7('0x34')]=_[_0xcaa7('0x35')](_0x3b527c[_0xcaa7('0x34')]);_0x4ab424[_0xcaa7('0x36')]=_[_0xcaa7('0x37')](_0x4ab424[_0xcaa7('0x33')],_0x4ab424[_0xcaa7('0x34')]);_0x40b7ae[_0xcaa7('0x39')]=_[_0xcaa7('0x37')](_0x4ab424[_0xcaa7('0x33')],qs[_0xcaa7('0x38')](_0x3b527c[_0xcaa7('0x34')][_0xcaa7('0x38')]));_0x40b7ae['attributes']=_0x40b7ae[_0xcaa7('0x39')]['length']?_0x40b7ae[_0xcaa7('0x39')]:_0x4ab424['model'];if(_0x3b527c[_0xcaa7('0x34')][_0xcaa7('0x41')]){_0x40b7ae[_0xcaa7('0x42')]=[{'all':!![]}];}_0x40b7ae=_['merge']({},_0x40b7ae,_0x3b527c[_0xcaa7('0x48')]);return db[_0xcaa7('0x43')][_0xcaa7('0x49')](_0x40b7ae)['then'](handleEntityNotFound(_0x1e227f,null))[_0xcaa7('0x25')](respondWithResult(_0x1e227f,null))[_0xcaa7('0x46')](handleError(_0x1e227f,null));};exports[_0xcaa7('0x4a')]=function(_0x3ecd6b,_0x5cf22d){return db['SquareMessage'][_0xcaa7('0x4a')](_0x3ecd6b[_0xcaa7('0x4b')],{})['then'](respondWithResult(_0x5cf22d,0xc9))[_0xcaa7('0x46')](handleError(_0x5cf22d,null));};exports[_0xcaa7('0x24')]=function(_0x154ecc,_0xb6900f){if(_0x154ecc[_0xcaa7('0x4b')]['id']){delete _0x154ecc[_0xcaa7('0x4b')]['id'];}return db[_0xcaa7('0x43')][_0xcaa7('0x49')]({'where':{'id':_0x154ecc[_0xcaa7('0x4c')]['id']}})['then'](handleEntityNotFound(_0xb6900f,null))['then'](saveUpdates(_0x154ecc[_0xcaa7('0x4b')],null))[_0xcaa7('0x25')](respondWithResult(_0xb6900f,null))['catch'](handleError(_0xb6900f,null));};exports[_0xcaa7('0x26')]=function(_0x3b2df9,_0x4d42a0){return db['SquareMessage'][_0xcaa7('0x49')]({'where':{'id':_0x3b2df9[_0xcaa7('0x4c')]['id']}})[_0xcaa7('0x25')](handleEntityNotFound(_0x4d42a0,null))[_0xcaa7('0x25')](removeEntity(_0x4d42a0,null))[_0xcaa7('0x46')](handleError(_0x4d42a0,null));}; \ No newline at end of file +var _0x32b6=['sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x32b6,0x1d1));var _0x632b=function(_0xd00880,_0x5e0fa1){_0xd00880=_0xd00880-0x0;var _0x5887d7=_0x32b6[_0xd00880];return _0x5887d7;};'use strict';var emlformat=require(_0x632b('0x0'));var rimraf=require(_0x632b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x632b('0x2'));var rp=require(_0x632b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x632b('0x4'));var util=require(_0x632b('0x5'));var path=require(_0x632b('0x6'));var sox=require(_0x632b('0x7'));var csv=require(_0x632b('0x8'));var ejs=require(_0x632b('0x9'));var fs=require('fs');var fs_extra=require(_0x632b('0xa'));var _=require(_0x632b('0xb'));var squel=require(_0x632b('0xc'));var crypto=require(_0x632b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x632b('0xe'));var toCsv=require(_0x632b('0x8'));var querystring=require(_0x632b('0xf'));var Papa=require(_0x632b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x632b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x632b('0x12'))(_0x632b('0x13'));var utils=require(_0x632b('0x14'));var config=require(_0x632b('0x15'));var licenseUtil=require(_0x632b('0x16'));var db=require(_0x632b('0x17'))['db'];function respondWithStatusCode(_0xe81378,_0x3d8bed){_0x3d8bed=_0x3d8bed||0xcc;return function(_0x22c182){if(_0x22c182){return _0xe81378['sendStatus'](_0x3d8bed);}return _0xe81378[_0x632b('0x18')](_0x3d8bed)[_0x632b('0x19')]();};}function respondWithResult(_0x9246a6,_0x5a97da){_0x5a97da=_0x5a97da||0xc8;return function(_0x721883){if(_0x721883){return _0x9246a6[_0x632b('0x18')](_0x5a97da)[_0x632b('0x1a')](_0x721883);}};}function respondWithFilteredResult(_0x17ff9b,_0x40d410){return function(_0x21cdd3){if(_0x21cdd3){var _0x4efe39=typeof _0x40d410[_0x632b('0x1b')]==='undefined'&&typeof _0x40d410['limit']===_0x632b('0x1c');var _0x5afa1e=_0x21cdd3[_0x632b('0x1d')];var _0x3bb27f=_0x4efe39?0x0:_0x40d410[_0x632b('0x1b')];var _0x51c894=_0x4efe39?_0x21cdd3[_0x632b('0x1d')]:_0x40d410[_0x632b('0x1b')]+_0x40d410[_0x632b('0x1e')];var _0x3683e4;if(_0x51c894>=_0x5afa1e){_0x51c894=_0x5afa1e;_0x3683e4=0xc8;}else{_0x3683e4=0xce;}_0x17ff9b['status'](_0x3683e4);return _0x17ff9b[_0x632b('0x1f')](_0x632b('0x20'),_0x3bb27f+'-'+_0x51c894+'/'+_0x5afa1e)['json'](_0x21cdd3);}return null;};}function patchUpdates(_0x116f62){return function(_0x50b930){try{jsonpatch['apply'](_0x50b930,_0x116f62,!![]);}catch(_0x1b1092){return BPromise['reject'](_0x1b1092);}return _0x50b930[_0x632b('0x21')]();};}function saveUpdates(_0x1c4530,_0x2a6833){return function(_0x540bfb){if(_0x540bfb){return _0x540bfb[_0x632b('0x22')](_0x1c4530)[_0x632b('0x23')](function(_0x59d83a){return _0x59d83a;});}return null;};}function removeEntity(_0x1db8f5,_0x379dc2){return function(_0x30ffb9){if(_0x30ffb9){return _0x30ffb9[_0x632b('0x24')]()[_0x632b('0x23')](function(){_0x1db8f5[_0x632b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7b20,_0x11fe61){return function(_0x4d3a70){if(!_0x4d3a70){_0x5e7b20[_0x632b('0x25')](0x194);}return _0x4d3a70;};}function handleError(_0x954fa0,_0x5d6855){_0x5d6855=_0x5d6855||0x1f4;return function(_0x273e89){logger[_0x632b('0x26')](_0x273e89[_0x632b('0x27')]);if(_0x273e89[_0x632b('0x28')]){delete _0x273e89[_0x632b('0x28')];}_0x954fa0[_0x632b('0x18')](_0x5d6855)[_0x632b('0x29')](_0x273e89);};}exports[_0x632b('0x2a')]=function(_0x33a625,_0x4f8410){var _0x1bb484={},_0x35348e={},_0x1819fa={'count':0x0,'rows':[]};var _0x3999aa=_[_0x632b('0x2b')](db[_0x632b('0x2c')][_0x632b('0x2d')],function(_0x417d62){return{'name':_0x417d62[_0x632b('0x2e')],'type':_0x417d62[_0x632b('0x2f')][_0x632b('0x30')]};});_0x35348e[_0x632b('0x31')]=_[_0x632b('0x2b')](_0x3999aa,_0x632b('0x28'));_0x35348e[_0x632b('0x32')]=_[_0x632b('0x33')](_0x33a625[_0x632b('0x32')]);_0x35348e[_0x632b('0x34')]=_[_0x632b('0x35')](_0x35348e[_0x632b('0x31')],_0x35348e['query']);_0x1bb484[_0x632b('0x36')]=_[_0x632b('0x35')](_0x35348e[_0x632b('0x31')],qs[_0x632b('0x37')](_0x33a625['query'][_0x632b('0x37')]));_0x1bb484['attributes']=_0x1bb484[_0x632b('0x36')][_0x632b('0x38')]?_0x1bb484['attributes']:_0x35348e[_0x632b('0x31')];if(!_0x33a625[_0x632b('0x32')][_0x632b('0x39')](_0x632b('0x3a'))){_0x1bb484[_0x632b('0x1e')]=qs[_0x632b('0x1e')](_0x33a625[_0x632b('0x32')][_0x632b('0x1e')]);_0x1bb484['offset']=qs['offset'](_0x33a625[_0x632b('0x32')][_0x632b('0x1b')]);}_0x1bb484[_0x632b('0x3b')]=qs[_0x632b('0x3c')](_0x33a625[_0x632b('0x32')][_0x632b('0x3c')]);_0x1bb484[_0x632b('0x3d')]=qs[_0x632b('0x34')](_['pick'](_0x33a625['query'],_0x35348e[_0x632b('0x34')]),_0x3999aa);if(_0x33a625['query'][_0x632b('0x3e')]){_0x1bb484[_0x632b('0x3d')]=_[_0x632b('0x3f')](_0x1bb484[_0x632b('0x3d')],{'$or':_[_0x632b('0x2b')](_0x3999aa,function(_0x38266c){if(_0x38266c[_0x632b('0x2f')]!==_0x632b('0x40')){var _0x2730c2={};_0x2730c2[_0x38266c[_0x632b('0x28')]]={'$like':'%'+_0x33a625[_0x632b('0x32')][_0x632b('0x3e')]+'%'};return _0x2730c2;}})});}_0x1bb484=_[_0x632b('0x3f')]({},_0x1bb484,_0x33a625[_0x632b('0x41')]);var _0x13beaa={'where':_0x1bb484[_0x632b('0x3d')]};return db[_0x632b('0x2c')]['count'](_0x13beaa)['then'](function(_0x58e3cc){_0x1819fa['count']=_0x58e3cc;if(_0x33a625['query'][_0x632b('0x42')]){_0x1bb484['include']=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x1bb484);})[_0x632b('0x23')](function(_0x4490d4){_0x1819fa[_0x632b('0x43')]=_0x4490d4;return _0x1819fa;})[_0x632b('0x23')](respondWithFilteredResult(_0x4f8410,_0x1bb484))['catch'](handleError(_0x4f8410,null));};exports[_0x632b('0x44')]=function(_0x238297,_0x387fce){var _0x4dbe4b={'raw':!![],'where':{'id':_0x238297[_0x632b('0x45')]['id']}},_0x15bb30={};_0x15bb30[_0x632b('0x31')]=_[_0x632b('0x33')](db[_0x632b('0x2c')][_0x632b('0x2d')]);_0x15bb30['query']=_[_0x632b('0x33')](_0x238297[_0x632b('0x32')]);_0x15bb30[_0x632b('0x34')]=_[_0x632b('0x35')](_0x15bb30['model'],_0x15bb30['query']);_0x4dbe4b[_0x632b('0x36')]=_[_0x632b('0x35')](_0x15bb30[_0x632b('0x31')],qs[_0x632b('0x37')](_0x238297[_0x632b('0x32')][_0x632b('0x37')]));_0x4dbe4b['attributes']=_0x4dbe4b[_0x632b('0x36')][_0x632b('0x38')]?_0x4dbe4b[_0x632b('0x36')]:_0x15bb30[_0x632b('0x31')];if(_0x238297[_0x632b('0x32')][_0x632b('0x42')]){_0x4dbe4b[_0x632b('0x46')]=[{'all':!![]}];}_0x4dbe4b=_[_0x632b('0x3f')]({},_0x4dbe4b,_0x238297['options']);return db[_0x632b('0x2c')]['find'](_0x4dbe4b)[_0x632b('0x23')](handleEntityNotFound(_0x387fce,null))['then'](respondWithResult(_0x387fce,null))[_0x632b('0x47')](handleError(_0x387fce,null));};exports[_0x632b('0x48')]=function(_0x16dfc7,_0x2c4561){return db[_0x632b('0x2c')]['create'](_0x16dfc7[_0x632b('0x49')],{})[_0x632b('0x23')](respondWithResult(_0x2c4561,0xc9))[_0x632b('0x47')](handleError(_0x2c4561,null));};exports['update']=function(_0x253aec,_0x16eb80){if(_0x253aec[_0x632b('0x49')]['id']){delete _0x253aec[_0x632b('0x49')]['id'];}return db[_0x632b('0x2c')]['find']({'where':{'id':_0x253aec[_0x632b('0x45')]['id']}})['then'](handleEntityNotFound(_0x16eb80,null))[_0x632b('0x23')](saveUpdates(_0x253aec[_0x632b('0x49')],null))[_0x632b('0x23')](respondWithResult(_0x16eb80,null))[_0x632b('0x47')](handleError(_0x16eb80,null));};exports[_0x632b('0x24')]=function(_0x52785a,_0x4c9b4e){return db[_0x632b('0x2c')][_0x632b('0x4a')]({'where':{'id':_0x52785a[_0x632b('0x45')]['id']}})[_0x632b('0x23')](handleEntityNotFound(_0x4c9b4e,null))[_0x632b('0x23')](removeEntity(_0x4c9b4e,null))[_0x632b('0x47')](handleError(_0x4c9b4e,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index dc0fe83..ef7dd8f 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 _0x80d1=['square_messages','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x80d1,0xb7));var _0x180d=function(_0x2256e2,_0xa99bd1){_0x2256e2=_0x2256e2-0x0;var _0x4c09d3=_0x80d1[_0x2256e2];return _0x4c09d3;};'use strict';var _=require(_0x180d('0x0'));var util=require('util');var logger=require(_0x180d('0x1'))(_0x180d('0x2'));var moment=require('moment');var BPromise=require(_0x180d('0x3'));var rp=require(_0x180d('0x4'));var fs=require('fs');var path=require(_0x180d('0x5'));var rimraf=require(_0x180d('0x6'));var config=require(_0x180d('0x7'));var attributes=require(_0x180d('0x8'));module[_0x180d('0x9')]=function(_0x3604af,_0x33bf43){return _0x3604af[_0x180d('0xa')](_0x180d('0xb'),attributes,{'tableName':_0x180d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b43=['square_messages','util','../../config/logger','moment','request-promise','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage'];(function(_0x10b8cc,_0x1c33ee){var _0x247fe6=function(_0x21c190){while(--_0x21c190){_0x10b8cc['push'](_0x10b8cc['shift']());}};_0x247fe6(++_0x1c33ee);}(_0x4b43,0xab));var _0x34b4=function(_0x400481,_0x3101d5){_0x400481=_0x400481-0x0;var _0x262b3c=_0x4b43[_0x400481];return _0x262b3c;};'use strict';var _=require('lodash');var util=require(_0x34b4('0x0'));var logger=require(_0x34b4('0x1'))('api');var moment=require(_0x34b4('0x2'));var BPromise=require('bluebird');var rp=require(_0x34b4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x34b4('0x4'));var attributes=require(_0x34b4('0x5'));module[_0x34b4('0x6')]=function(_0x5bef7d,_0x3d86a6){return _0x5bef7d[_0x34b4('0x7')](_0x34b4('0x8'),attributes,{'tableName':_0x34b4('0x9'),'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 96ce2b4..f57f078 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 _0xad12=['debug','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','info','result','CreateSquareMessage','create','body','raw','then','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request\x20sent'];(function(_0x421f33,_0x5d60cf){var _0x4492f7=function(_0x1a9f3a){while(--_0x1a9f3a){_0x421f33['push'](_0x421f33['shift']());}};_0x4492f7(++_0x5d60cf);}(_0xad12,0x16c));var _0x2ad1=function(_0x133833,_0x1efbd9){_0x133833=_0x133833-0x0;var _0x492d42=_0xad12[_0x133833];return _0x492d42;};'use strict';var _=require(_0x2ad1('0x0'));var util=require('util');var moment=require(_0x2ad1('0x1'));var BPromise=require(_0x2ad1('0x2'));var rs=require(_0x2ad1('0x3'));var fs=require('fs');var Redis=require(_0x2ad1('0x4'));var db=require(_0x2ad1('0x5'))['db'];var utils=require(_0x2ad1('0x6'));var logger=require(_0x2ad1('0x7'))(_0x2ad1('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2ad1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17ee96,_0x45966c,_0x5e470f){return new BPromise(function(_0x3c4f3f,_0x83f825){return client['request'](_0x17ee96,_0x5e470f)['then'](function(_0x2c0ace){logger['info']('SquareMessage,\x20%s,\x20%s',_0x45966c,_0x2ad1('0xa'));logger[_0x2ad1('0xb')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x45966c,'request\x20sent',JSON[_0x2ad1('0xc')](_0x2c0ace));if(_0x2c0ace[_0x2ad1('0xd')]){if(_0x2c0ace[_0x2ad1('0xd')][_0x2ad1('0xe')]===0x1f4){logger['error'](_0x2ad1('0xf'),_0x45966c,_0x2c0ace[_0x2ad1('0xd')][_0x2ad1('0x10')]);return _0x83f825(_0x2c0ace[_0x2ad1('0xd')]['message']);}logger[_0x2ad1('0xd')]('SquareMessage,\x20%s,\x20%s',_0x45966c,_0x2c0ace[_0x2ad1('0xd')][_0x2ad1('0x10')]);return _0x3c4f3f(_0x2c0ace[_0x2ad1('0xd')][_0x2ad1('0x10')]);}else{logger[_0x2ad1('0x11')](_0x2ad1('0xf'),_0x45966c,_0x2ad1('0xa'));_0x3c4f3f(_0x2c0ace[_0x2ad1('0x12')][_0x2ad1('0x10')]);}})['catch'](function(_0x4bd78a){logger[_0x2ad1('0xd')]('SquareMessage,\x20%s,\x20%s',_0x45966c,_0x4bd78a);_0x83f825(_0x4bd78a);});});}exports[_0x2ad1('0x13')]=function(_0x321727){var _0x15765b=this;return new Promise(function(_0x525721,_0x2cd6b9){return db['SquareMessage'][_0x2ad1('0x14')](_0x321727[_0x2ad1('0x15')],{'raw':_0x321727['options']?_0x321727['options'][_0x2ad1('0x16')]===undefined?!![]:![]:!![]})[_0x2ad1('0x17')](function(_0x32ce89){logger[_0x2ad1('0x11')](_0x2ad1('0x13'),_0x321727);logger[_0x2ad1('0xb')]('CreateSquareMessage',_0x321727,JSON[_0x2ad1('0xc')](_0x32ce89));_0x525721(_0x32ce89);})[_0x2ad1('0x18')](function(_0xcd7bcf){logger[_0x2ad1('0xd')](_0x2ad1('0x13'),_0xcd7bcf['message'],_0x321727);_0x2cd6b9(_0x15765b['error'](0x1f4,_0xcd7bcf[_0x2ad1('0x10')]));});});}; \ No newline at end of file +var _0x0e1e=['debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareMessage','SquareMessage','create','body','options'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0e1e,0x10f));var _0xe0e1=function(_0x3a96ca,_0x599d1b){_0x3a96ca=_0x3a96ca-0x0;var _0x52f475=_0x0e1e[_0x3a96ca];return _0x52f475;};'use strict';var _=require(_0xe0e1('0x0'));var util=require(_0xe0e1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe0e1('0x2'));var fs=require('fs');var Redis=require(_0xe0e1('0x3'));var db=require(_0xe0e1('0x4'))['db'];var utils=require(_0xe0e1('0x5'));var logger=require(_0xe0e1('0x6'))(_0xe0e1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe0e1('0x8')][_0xe0e1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x366fda,_0x300ff4,_0x467603){return new BPromise(function(_0x41a926,_0x12cc6a){return client[_0xe0e1('0xa')](_0x366fda,_0x467603)[_0xe0e1('0xb')](function(_0x2c9fd6){logger[_0xe0e1('0xc')](_0xe0e1('0xd'),_0x300ff4,_0xe0e1('0xe'));logger['debug'](_0xe0e1('0xf'),_0x300ff4,_0xe0e1('0xe'),JSON[_0xe0e1('0x10')](_0x2c9fd6));if(_0x2c9fd6[_0xe0e1('0x11')]){if(_0x2c9fd6['error'][_0xe0e1('0x12')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x300ff4,_0x2c9fd6[_0xe0e1('0x11')][_0xe0e1('0x13')]);return _0x12cc6a(_0x2c9fd6[_0xe0e1('0x11')][_0xe0e1('0x13')]);}logger['error'](_0xe0e1('0xd'),_0x300ff4,_0x2c9fd6[_0xe0e1('0x11')][_0xe0e1('0x13')]);return _0x41a926(_0x2c9fd6['error'][_0xe0e1('0x13')]);}else{logger['info'](_0xe0e1('0xd'),_0x300ff4,_0xe0e1('0xe'));_0x41a926(_0x2c9fd6['result']['message']);}})[_0xe0e1('0x14')](function(_0x3f29fe){logger[_0xe0e1('0x11')](_0xe0e1('0xd'),_0x300ff4,_0x3f29fe);_0x12cc6a(_0x3f29fe);});});}exports[_0xe0e1('0x15')]=function(_0x5ea93c){var _0x43cc4c=this;return new Promise(function(_0x4a5683,_0x93d5ef){return db[_0xe0e1('0x16')][_0xe0e1('0x17')](_0x5ea93c[_0xe0e1('0x18')],{'raw':_0x5ea93c[_0xe0e1('0x19')]?_0x5ea93c[_0xe0e1('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xe0e1('0xb')](function(_0x4a3a64){logger[_0xe0e1('0xc')]('CreateSquareMessage',_0x5ea93c);logger[_0xe0e1('0x1a')](_0xe0e1('0x15'),_0x5ea93c,JSON[_0xe0e1('0x10')](_0x4a3a64));_0x4a5683(_0x4a3a64);})[_0xe0e1('0x14')](function(_0xa64e20){logger['error'](_0xe0e1('0x15'),_0xa64e20[_0xe0e1('0x13')],_0x5ea93c);_0x93d5ef(_0x43cc4c[_0xe0e1('0x11')](0x1f4,_0xa64e20['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index de264dd..1b986fe 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 _0x7c1d=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/test','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x27a88e,_0x31d5a1){var _0x325e23=function(_0x10d932){while(--_0x10d932){_0x27a88e['push'](_0x27a88e['shift']());}};_0x325e23(++_0x31d5a1);}(_0x7c1d,0xe5));var _0xd7c1=function(_0x25f156,_0x534bb6){_0x25f156=_0x25f156-0x0;var _0x3fdf65=_0x7c1d[_0x25f156];return _0x3fdf65;};'use strict';var multer=require(_0xd7c1('0x0'));var util=require(_0xd7c1('0x1'));var path=require(_0xd7c1('0x2'));var timeout=require(_0xd7c1('0x3'));var express=require(_0xd7c1('0x4'));var router=express[_0xd7c1('0x5')]();var fs_extra=require(_0xd7c1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd7c1('0x7'));var config=require(_0xd7c1('0x8'));var controller=require('./squareOdbc.controller');router[_0xd7c1('0x9')]('/',auth[_0xd7c1('0xa')](),controller[_0xd7c1('0xb')]);router[_0xd7c1('0x9')](_0xd7c1('0xc'),auth[_0xd7c1('0xa')](),controller['show']);router[_0xd7c1('0x9')](_0xd7c1('0xd'),auth[_0xd7c1('0xa')](),timeout('15s'),controller['test']);router[_0xd7c1('0xe')]('/',auth[_0xd7c1('0xa')](),controller[_0xd7c1('0xf')]);router[_0xd7c1('0x10')](_0xd7c1('0xc'),auth[_0xd7c1('0xa')](),controller[_0xd7c1('0x11')]);router[_0xd7c1('0x12')](_0xd7c1('0xc'),auth[_0xd7c1('0xa')](),controller[_0xd7c1('0x13')]);module[_0xd7c1('0x14')]=router; \ No newline at end of file +var _0x69f1=['isAuthenticated','index','/:id','show','/:id/test','15s','test','post','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0x69f1,0x1c3));var _0x169f=function(_0x34ab95,_0x2ac862){_0x34ab95=_0x34ab95-0x0;var _0x2eaccd=_0x69f1[_0x34ab95];return _0x2eaccd;};'use strict';var multer=require(_0x169f('0x0'));var util=require(_0x169f('0x1'));var path=require(_0x169f('0x2'));var timeout=require(_0x169f('0x3'));var express=require('express');var router=express[_0x169f('0x4')]();var fs_extra=require(_0x169f('0x5'));var auth=require(_0x169f('0x6'));var interaction=require(_0x169f('0x7'));var config=require(_0x169f('0x8'));var controller=require(_0x169f('0x9'));router[_0x169f('0xa')]('/',auth[_0x169f('0xb')](),controller[_0x169f('0xc')]);router[_0x169f('0xa')](_0x169f('0xd'),auth[_0x169f('0xb')](),controller[_0x169f('0xe')]);router[_0x169f('0xa')](_0x169f('0xf'),auth[_0x169f('0xb')](),timeout(_0x169f('0x10')),controller[_0x169f('0x11')]);router[_0x169f('0x12')]('/',auth[_0x169f('0xb')](),controller['create']);router['put'](_0x169f('0xd'),auth[_0x169f('0xb')](),controller['update']);router[_0x169f('0x13')](_0x169f('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x169f('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 1b7a116..172314a 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 _0x1953=['STRING','sequelize','name'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x1953,0x190));var _0x3195=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1953[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x3195('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3195('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x3195('0x2')]},'description':{'type':Sequelize[_0x3195('0x2')]}}; \ No newline at end of file +var _0xf049=['exports','name','STRING','sequelize'];(function(_0x4d3222,_0x32f709){var _0x3aba50=function(_0xb9ed3b){while(--_0xb9ed3b){_0x4d3222['push'](_0x4d3222['shift']());}};_0x3aba50(++_0x32f709);}(_0xf049,0xa7));var _0x9f04=function(_0x27ba56,_0x46f4f1){_0x27ba56=_0x27ba56-0x0;var _0x1be04e=_0xf049[_0x27ba56];return _0x1be04e;};'use strict';var Sequelize=require(_0x9f04('0x0'));module[_0x9f04('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9f04('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9f04('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index ebce39d..eb557b3 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 _0xb80f=['undefined','limit','count','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','SquareOdbc','rawAttributes','fieldName','query','keys','filters','model','intersection','attributes','nolimit','order','sort','where','filter','map','type','VIRTUAL','merge','includeAll','include','rows','catch','show','fields','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','dsn','odbc','openSync','eml-format','rimraf','request-promise','util','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb80f,0x17c));var _0xfb80=function(_0x5218d9,_0x25d7d5){_0x5218d9=_0x5218d9-0x0;var _0x1b76da=_0xb80f[_0x5218d9];return _0x1b76da;};'use strict';var emlformat=require(_0xfb80('0x0'));var rimraf=require(_0xfb80('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfb80('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfb80('0x3'));var path=require('path');var sox=require(_0xfb80('0x4'));var csv=require(_0xfb80('0x5'));var ejs=require(_0xfb80('0x6'));var fs=require('fs');var fs_extra=require(_0xfb80('0x7'));var _=require(_0xfb80('0x8'));var squel=require('squel');var crypto=require(_0xfb80('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfb80('0x5'));var querystring=require('querystring');var Papa=require(_0xfb80('0xa'));var Redis=require(_0xfb80('0xb'));var authService=require(_0xfb80('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xfb80('0xd'));var hardwareService=require(_0xfb80('0xe'));var logger=require('../../config/logger')(_0xfb80('0xf'));var utils=require(_0xfb80('0x10'));var config=require(_0xfb80('0x11'));var licenseUtil=require(_0xfb80('0x12'));var db=require(_0xfb80('0x13'))['db'];function respondWithStatusCode(_0x2fdb3d,_0xe0e928){_0xe0e928=_0xe0e928||0xcc;return function(_0x891a4c){if(_0x891a4c){return _0x2fdb3d[_0xfb80('0x14')](_0xe0e928);}return _0x2fdb3d[_0xfb80('0x15')](_0xe0e928)[_0xfb80('0x16')]();};}function respondWithResult(_0x18ef1c,_0x2c3dc3){_0x2c3dc3=_0x2c3dc3||0xc8;return function(_0x3ee587){if(_0x3ee587){return _0x18ef1c[_0xfb80('0x15')](_0x2c3dc3)[_0xfb80('0x17')](_0x3ee587);}};}function respondWithFilteredResult(_0x48bcc6,_0x2a494a){return function(_0x1bafd0){if(_0x1bafd0){var _0x230d3f=typeof _0x2a494a[_0xfb80('0x18')]===_0xfb80('0x19')&&typeof _0x2a494a[_0xfb80('0x1a')]===_0xfb80('0x19');var _0x329145=_0x1bafd0[_0xfb80('0x1b')];var _0x4ad6bf=_0x230d3f?0x0:_0x2a494a[_0xfb80('0x18')];var _0x10f11a=_0x230d3f?_0x1bafd0[_0xfb80('0x1b')]:_0x2a494a[_0xfb80('0x18')]+_0x2a494a['limit'];var _0x1aa75a;if(_0x10f11a>=_0x329145){_0x10f11a=_0x329145;_0x1aa75a=0xc8;}else{_0x1aa75a=0xce;}_0x48bcc6['status'](_0x1aa75a);return _0x48bcc6[_0xfb80('0x1c')](_0xfb80('0x1d'),_0x4ad6bf+'-'+_0x10f11a+'/'+_0x329145)[_0xfb80('0x17')](_0x1bafd0);}return null;};}function patchUpdates(_0x3e4236){return function(_0x139299){try{jsonpatch['apply'](_0x139299,_0x3e4236,!![]);}catch(_0x4ca408){return BPromise[_0xfb80('0x1e')](_0x4ca408);}return _0x139299[_0xfb80('0x1f')]();};}function saveUpdates(_0x42c936,_0x3c8c2d){return function(_0x106b38){if(_0x106b38){return _0x106b38[_0xfb80('0x20')](_0x42c936)['then'](function(_0x5cf740){return _0x5cf740;});}return null;};}function removeEntity(_0x5ccb3a,_0x568041){return function(_0x195698){if(_0x195698){return _0x195698['destroy']()[_0xfb80('0x21')](function(){var _0xc7eeeb=_0x195698[_0xfb80('0x22')]({'plain':!![]});var _0x174f26='ODBC';return db[_0xfb80('0x23')][_0xfb80('0x24')]({'where':{'type':_0x174f26,'resourceId':_0xc7eeeb['id']}})[_0xfb80('0x21')](function(){return _0x195698;});})['then'](function(){_0x5ccb3a[_0xfb80('0x15')](0xcc)[_0xfb80('0x16')]();});}};}function handleEntityNotFound(_0x18eeb8,_0x14c7bc){return function(_0x9c10c9){if(!_0x9c10c9){_0x18eeb8[_0xfb80('0x14')](0x194);}return _0x9c10c9;};}function handleError(_0x5eb9bb,_0x4b9bac){_0x4b9bac=_0x4b9bac||0x1f4;return function(_0x3b0e69){logger[_0xfb80('0x25')](_0x3b0e69[_0xfb80('0x26')]);if(_0x3b0e69['name']){delete _0x3b0e69[_0xfb80('0x27')];}_0x5eb9bb['status'](_0x4b9bac)[_0xfb80('0x28')](_0x3b0e69);};}exports[_0xfb80('0x29')]=function(_0x128393,_0x3c3fcc){var _0x25c9e2={},_0x2c32c6={},_0x281fcf={'count':0x0,'rows':[]};var _0x3a2c20=_['map'](db[_0xfb80('0x2a')][_0xfb80('0x2b')],function(_0xb18657){return{'name':_0xb18657[_0xfb80('0x2c')],'type':_0xb18657['type']['key']};});_0x2c32c6['model']=_['map'](_0x3a2c20,_0xfb80('0x27'));_0x2c32c6[_0xfb80('0x2d')]=_[_0xfb80('0x2e')](_0x128393['query']);_0x2c32c6[_0xfb80('0x2f')]=_['intersection'](_0x2c32c6[_0xfb80('0x30')],_0x2c32c6[_0xfb80('0x2d')]);_0x25c9e2['attributes']=_[_0xfb80('0x31')](_0x2c32c6[_0xfb80('0x30')],qs['fields'](_0x128393[_0xfb80('0x2d')]['fields']));_0x25c9e2[_0xfb80('0x32')]=_0x25c9e2[_0xfb80('0x32')]['length']?_0x25c9e2[_0xfb80('0x32')]:_0x2c32c6[_0xfb80('0x30')];if(!_0x128393[_0xfb80('0x2d')]['hasOwnProperty'](_0xfb80('0x33'))){_0x25c9e2[_0xfb80('0x1a')]=qs['limit'](_0x128393[_0xfb80('0x2d')]['limit']);_0x25c9e2[_0xfb80('0x18')]=qs['offset'](_0x128393[_0xfb80('0x2d')][_0xfb80('0x18')]);}_0x25c9e2[_0xfb80('0x34')]=qs[_0xfb80('0x35')](_0x128393[_0xfb80('0x2d')][_0xfb80('0x35')]);_0x25c9e2[_0xfb80('0x36')]=qs[_0xfb80('0x2f')](_['pick'](_0x128393[_0xfb80('0x2d')],_0x2c32c6[_0xfb80('0x2f')]),_0x3a2c20);if(_0x128393[_0xfb80('0x2d')][_0xfb80('0x37')]){_0x25c9e2[_0xfb80('0x36')]=_['merge'](_0x25c9e2[_0xfb80('0x36')],{'$or':_[_0xfb80('0x38')](_0x3a2c20,function(_0x26e6df){if(_0x26e6df[_0xfb80('0x39')]!==_0xfb80('0x3a')){var _0xd8970e={};_0xd8970e[_0x26e6df[_0xfb80('0x27')]]={'$like':'%'+_0x128393[_0xfb80('0x2d')][_0xfb80('0x37')]+'%'};return _0xd8970e;}})});}_0x25c9e2=_[_0xfb80('0x3b')]({},_0x25c9e2,_0x128393['options']);var _0x6bff01={'where':_0x25c9e2['where']};return db['SquareOdbc'][_0xfb80('0x1b')](_0x6bff01)[_0xfb80('0x21')](function(_0x2bad1e){_0x281fcf['count']=_0x2bad1e;if(_0x128393['query'][_0xfb80('0x3c')]){_0x25c9e2[_0xfb80('0x3d')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x25c9e2);})['then'](function(_0x189c99){_0x281fcf[_0xfb80('0x3e')]=_0x189c99;return _0x281fcf;})[_0xfb80('0x21')](respondWithFilteredResult(_0x3c3fcc,_0x25c9e2))[_0xfb80('0x3f')](handleError(_0x3c3fcc,null));};exports[_0xfb80('0x40')]=function(_0x3b2b5c,_0x5deb71){var _0x215802={'raw':!![],'where':{'id':_0x3b2b5c['params']['id']}},_0x383dea={};_0x383dea[_0xfb80('0x30')]=_[_0xfb80('0x2e')](db[_0xfb80('0x2a')][_0xfb80('0x2b')]);_0x383dea[_0xfb80('0x2d')]=_[_0xfb80('0x2e')](_0x3b2b5c[_0xfb80('0x2d')]);_0x383dea[_0xfb80('0x2f')]=_[_0xfb80('0x31')](_0x383dea[_0xfb80('0x30')],_0x383dea[_0xfb80('0x2d')]);_0x215802['attributes']=_[_0xfb80('0x31')](_0x383dea[_0xfb80('0x30')],qs[_0xfb80('0x41')](_0x3b2b5c[_0xfb80('0x2d')]['fields']));_0x215802[_0xfb80('0x32')]=_0x215802['attributes']['length']?_0x215802['attributes']:_0x383dea[_0xfb80('0x30')];if(_0x3b2b5c['query'][_0xfb80('0x3c')]){_0x215802[_0xfb80('0x3d')]=[{'all':!![]}];}_0x215802=_[_0xfb80('0x3b')]({},_0x215802,_0x3b2b5c[_0xfb80('0x42')]);return db[_0xfb80('0x2a')][_0xfb80('0x43')](_0x215802)['then'](handleEntityNotFound(_0x5deb71,null))[_0xfb80('0x21')](respondWithResult(_0x5deb71,null))['catch'](handleError(_0x5deb71,null));};exports[_0xfb80('0x44')]=function(_0x1a11b3,_0x3f779d){return db[_0xfb80('0x2a')][_0xfb80('0x44')](_0x1a11b3[_0xfb80('0x45')],{})[_0xfb80('0x21')](function(_0x3ec36e){var _0x21933f=_0x1a11b3[_0xfb80('0x46')]['get']({'plain':!![]});if(!_0x21933f)throw new Error(_0xfb80('0x47'));if(_0x21933f[_0xfb80('0x48')]===_0xfb80('0x46')){var _0x10b7fd=_0x3ec36e[_0xfb80('0x22')]({'plain':!![]});var _0x696b1c=_0xfb80('0x49');return db[_0xfb80('0x4a')][_0xfb80('0x43')]({'where':{'name':_0x696b1c,'userProfileId':_0x21933f['userProfileId']},'raw':!![]})[_0xfb80('0x21')](function(_0x33a6d1){if(_0x33a6d1&&_0x33a6d1[_0xfb80('0x4b')]===0x0){return db[_0xfb80('0x23')][_0xfb80('0x44')]({'name':_0x10b7fd[_0xfb80('0x27')],'resourceId':_0x10b7fd['id'],'type':_0x33a6d1['name'],'sectionId':_0x33a6d1['id']},{})[_0xfb80('0x21')](function(){return _0x3ec36e;});}else{return _0x3ec36e;}})[_0xfb80('0x3f')](function(_0x1ab22a){logger['error'](_0xfb80('0x4c'),_0x1ab22a);throw _0x1ab22a;});}return _0x3ec36e;})[_0xfb80('0x21')](respondWithResult(_0x3f779d,0xc9))[_0xfb80('0x3f')](handleError(_0x3f779d,null));};exports['update']=function(_0x22655b,_0x52cc46){if(_0x22655b[_0xfb80('0x45')]['id']){delete _0x22655b[_0xfb80('0x45')]['id'];}return db[_0xfb80('0x2a')][_0xfb80('0x43')]({'where':{'id':_0x22655b['params']['id']}})['then'](handleEntityNotFound(_0x52cc46,null))[_0xfb80('0x21')](saveUpdates(_0x22655b[_0xfb80('0x45')],null))[_0xfb80('0x21')](respondWithResult(_0x52cc46,null))[_0xfb80('0x3f')](handleError(_0x52cc46,null));};exports['destroy']=function(_0x5d7a5b,_0x3496ee){return db[_0xfb80('0x2a')][_0xfb80('0x43')]({'where':{'id':_0x5d7a5b[_0xfb80('0x4d')]['id']}})[_0xfb80('0x21')](handleEntityNotFound(_0x3496ee,null))[_0xfb80('0x21')](removeEntity(_0x3496ee,null))[_0xfb80('0x3f')](handleError(_0x3496ee,null));};exports['test']=function(_0x201699,_0x1aeaa1,_0x107666){var _0x3fe058;return db[_0xfb80('0x2a')][_0xfb80('0x43')]({'where':{'id':_0x201699[_0xfb80('0x4d')]['id']},'attributes':['id',_0xfb80('0x4e')]})[_0xfb80('0x21')](handleEntityNotFound(_0x1aeaa1,null))[_0xfb80('0x21')](function(_0x6ff80b){if(_0x6ff80b){var _0x50804c=require(_0xfb80('0x4f'))();_0x50804c[_0xfb80('0x50')](_0x6ff80b[_0xfb80('0x4e')]);_0x50804c['closeSync']();return _0x6ff80b;}})['then'](respondWithResult(_0x1aeaa1,null))['catch'](handleError(_0x1aeaa1,null));}; \ No newline at end of file +var _0x8640=['index','map','SquareOdbc','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','show','params','keys','rawAttributes','length','includeAll','find','create','body','user','get','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','test','dsn','odbc','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','ODBC','error','stack','name','send'];(function(_0xff6cdf,_0x2c0585){var _0x125037=function(_0x15c39e){while(--_0x15c39e){_0xff6cdf['push'](_0xff6cdf['shift']());}};_0x125037(++_0x2c0585);}(_0x8640,0x1c9));var _0x0864=function(_0xcaf3bf,_0x213580){_0xcaf3bf=_0xcaf3bf-0x0;var _0x45c7f2=_0x8640[_0xcaf3bf];return _0x45c7f2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0864('0x0'));var jsonpatch=require(_0x0864('0x1'));var rp=require(_0x0864('0x2'));var moment=require(_0x0864('0x3'));var BPromise=require(_0x0864('0x4'));var Mustache=require(_0x0864('0x5'));var util=require(_0x0864('0x6'));var path=require(_0x0864('0x7'));var sox=require(_0x0864('0x8'));var csv=require(_0x0864('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0864('0xa'));var _=require(_0x0864('0xb'));var squel=require(_0x0864('0xc'));var crypto=require(_0x0864('0xd'));var jsforce=require(_0x0864('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0864('0x9'));var querystring=require('querystring');var Papa=require(_0x0864('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0864('0x10'));var as=require(_0x0864('0x11'));var hardwareService=require(_0x0864('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0864('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0864('0x14'));var db=require(_0x0864('0x15'))['db'];function respondWithStatusCode(_0xde3343,_0x4ea35e){_0x4ea35e=_0x4ea35e||0xcc;return function(_0x14a19d){if(_0x14a19d){return _0xde3343['sendStatus'](_0x4ea35e);}return _0xde3343[_0x0864('0x16')](_0x4ea35e)[_0x0864('0x17')]();};}function respondWithResult(_0x509368,_0x2be0cd){_0x2be0cd=_0x2be0cd||0xc8;return function(_0x17aeea){if(_0x17aeea){return _0x509368[_0x0864('0x16')](_0x2be0cd)[_0x0864('0x18')](_0x17aeea);}};}function respondWithFilteredResult(_0x415f67,_0x1b1e2d){return function(_0x8b17c6){if(_0x8b17c6){var _0x60ca1d=typeof _0x1b1e2d['offset']===_0x0864('0x19')&&typeof _0x1b1e2d[_0x0864('0x1a')]===_0x0864('0x19');var _0x5c3626=_0x8b17c6[_0x0864('0x1b')];var _0xa205f5=_0x60ca1d?0x0:_0x1b1e2d[_0x0864('0x1c')];var _0x4107cf=_0x60ca1d?_0x8b17c6['count']:_0x1b1e2d[_0x0864('0x1c')]+_0x1b1e2d['limit'];var _0x42fc55;if(_0x4107cf>=_0x5c3626){_0x4107cf=_0x5c3626;_0x42fc55=0xc8;}else{_0x42fc55=0xce;}_0x415f67[_0x0864('0x16')](_0x42fc55);return _0x415f67['set'](_0x0864('0x1d'),_0xa205f5+'-'+_0x4107cf+'/'+_0x5c3626)[_0x0864('0x18')](_0x8b17c6);}return null;};}function patchUpdates(_0x26b4f8){return function(_0x48f544){try{jsonpatch[_0x0864('0x1e')](_0x48f544,_0x26b4f8,!![]);}catch(_0x5ed823){return BPromise[_0x0864('0x1f')](_0x5ed823);}return _0x48f544[_0x0864('0x20')]();};}function saveUpdates(_0x581bc3,_0x450b97){return function(_0x54ab7b){if(_0x54ab7b){return _0x54ab7b[_0x0864('0x21')](_0x581bc3)[_0x0864('0x22')](function(_0x44e5a0){return _0x44e5a0;});}return null;};}function removeEntity(_0x190f57,_0x361ad2){return function(_0x5abfa5){if(_0x5abfa5){return _0x5abfa5[_0x0864('0x23')]()[_0x0864('0x22')](function(){var _0x27bd8a=_0x5abfa5['get']({'plain':!![]});var _0x30a3fa=_0x0864('0x24');return db['UserProfileResource'][_0x0864('0x23')]({'where':{'type':_0x30a3fa,'resourceId':_0x27bd8a['id']}})['then'](function(){return _0x5abfa5;});})['then'](function(){_0x190f57[_0x0864('0x16')](0xcc)[_0x0864('0x17')]();});}};}function handleEntityNotFound(_0x2948eb,_0x3ef70f){return function(_0x3134f6){if(!_0x3134f6){_0x2948eb['sendStatus'](0x194);}return _0x3134f6;};}function handleError(_0x70fa81,_0x4ae8cc){_0x4ae8cc=_0x4ae8cc||0x1f4;return function(_0xdac18e){logger[_0x0864('0x25')](_0xdac18e[_0x0864('0x26')]);if(_0xdac18e['name']){delete _0xdac18e[_0x0864('0x27')];}_0x70fa81[_0x0864('0x16')](_0x4ae8cc)[_0x0864('0x28')](_0xdac18e);};}exports[_0x0864('0x29')]=function(_0x23a78e,_0x8674ed){var _0x50569a={},_0x2322ed={},_0x44c18d={'count':0x0,'rows':[]};var _0x52f677=_[_0x0864('0x2a')](db[_0x0864('0x2b')]['rawAttributes'],function(_0xc3dd12){return{'name':_0xc3dd12[_0x0864('0x2c')],'type':_0xc3dd12[_0x0864('0x2d')][_0x0864('0x2e')]};});_0x2322ed[_0x0864('0x2f')]=_['map'](_0x52f677,_0x0864('0x27'));_0x2322ed[_0x0864('0x30')]=_['keys'](_0x23a78e[_0x0864('0x30')]);_0x2322ed[_0x0864('0x31')]=_[_0x0864('0x32')](_0x2322ed['model'],_0x2322ed[_0x0864('0x30')]);_0x50569a['attributes']=_[_0x0864('0x32')](_0x2322ed[_0x0864('0x2f')],qs[_0x0864('0x33')](_0x23a78e['query'][_0x0864('0x33')]));_0x50569a[_0x0864('0x34')]=_0x50569a[_0x0864('0x34')]['length']?_0x50569a[_0x0864('0x34')]:_0x2322ed[_0x0864('0x2f')];if(!_0x23a78e['query']['hasOwnProperty'](_0x0864('0x35'))){_0x50569a[_0x0864('0x1a')]=qs['limit'](_0x23a78e[_0x0864('0x30')][_0x0864('0x1a')]);_0x50569a[_0x0864('0x1c')]=qs[_0x0864('0x1c')](_0x23a78e[_0x0864('0x30')][_0x0864('0x1c')]);}_0x50569a[_0x0864('0x36')]=qs[_0x0864('0x37')](_0x23a78e['query'][_0x0864('0x37')]);_0x50569a['where']=qs[_0x0864('0x31')](_[_0x0864('0x38')](_0x23a78e['query'],_0x2322ed[_0x0864('0x31')]),_0x52f677);if(_0x23a78e[_0x0864('0x30')][_0x0864('0x39')]){_0x50569a['where']=_[_0x0864('0x3a')](_0x50569a[_0x0864('0x3b')],{'$or':_[_0x0864('0x2a')](_0x52f677,function(_0x26c1c7){if(_0x26c1c7[_0x0864('0x2d')]!==_0x0864('0x3c')){var _0x406e43={};_0x406e43[_0x26c1c7['name']]={'$like':'%'+_0x23a78e[_0x0864('0x30')][_0x0864('0x39')]+'%'};return _0x406e43;}})});}_0x50569a=_[_0x0864('0x3a')]({},_0x50569a,_0x23a78e[_0x0864('0x3d')]);var _0x4870f6={'where':_0x50569a['where']};return db[_0x0864('0x2b')][_0x0864('0x1b')](_0x4870f6)[_0x0864('0x22')](function(_0x4d7a01){_0x44c18d[_0x0864('0x1b')]=_0x4d7a01;if(_0x23a78e[_0x0864('0x30')]['includeAll']){_0x50569a[_0x0864('0x3e')]=[{'all':!![]}];}return db[_0x0864('0x2b')][_0x0864('0x3f')](_0x50569a);})[_0x0864('0x22')](function(_0x421611){_0x44c18d['rows']=_0x421611;return _0x44c18d;})['then'](respondWithFilteredResult(_0x8674ed,_0x50569a))['catch'](handleError(_0x8674ed,null));};exports[_0x0864('0x40')]=function(_0x9794be,_0x23d379){var _0x5b2f97={'raw':!![],'where':{'id':_0x9794be[_0x0864('0x41')]['id']}},_0x199eae={};_0x199eae[_0x0864('0x2f')]=_[_0x0864('0x42')](db[_0x0864('0x2b')][_0x0864('0x43')]);_0x199eae[_0x0864('0x30')]=_['keys'](_0x9794be[_0x0864('0x30')]);_0x199eae[_0x0864('0x31')]=_['intersection'](_0x199eae[_0x0864('0x2f')],_0x199eae[_0x0864('0x30')]);_0x5b2f97[_0x0864('0x34')]=_['intersection'](_0x199eae[_0x0864('0x2f')],qs[_0x0864('0x33')](_0x9794be['query']['fields']));_0x5b2f97[_0x0864('0x34')]=_0x5b2f97['attributes'][_0x0864('0x44')]?_0x5b2f97[_0x0864('0x34')]:_0x199eae['model'];if(_0x9794be['query'][_0x0864('0x45')]){_0x5b2f97[_0x0864('0x3e')]=[{'all':!![]}];}_0x5b2f97=_[_0x0864('0x3a')]({},_0x5b2f97,_0x9794be[_0x0864('0x3d')]);return db[_0x0864('0x2b')][_0x0864('0x46')](_0x5b2f97)[_0x0864('0x22')](handleEntityNotFound(_0x23d379,null))['then'](respondWithResult(_0x23d379,null))['catch'](handleError(_0x23d379,null));};exports[_0x0864('0x47')]=function(_0x30daa0,_0x1e92b5){return db['SquareOdbc']['create'](_0x30daa0[_0x0864('0x48')],{})['then'](function(_0x3c7a80){var _0x2df8b6=_0x30daa0[_0x0864('0x49')][_0x0864('0x4a')]({'plain':!![]});if(!_0x2df8b6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2df8b6[_0x0864('0x4b')]==='user'){var _0x32ae48=_0x3c7a80[_0x0864('0x4a')]({'plain':!![]});var _0x59b25e=_0x0864('0x24');return db[_0x0864('0x4c')][_0x0864('0x46')]({'where':{'name':_0x59b25e,'userProfileId':_0x2df8b6['userProfileId']},'raw':!![]})[_0x0864('0x22')](function(_0x536fde){if(_0x536fde&&_0x536fde['autoAssociation']===0x0){return db[_0x0864('0x4d')]['create']({'name':_0x32ae48[_0x0864('0x27')],'resourceId':_0x32ae48['id'],'type':_0x536fde[_0x0864('0x27')],'sectionId':_0x536fde['id']},{})[_0x0864('0x22')](function(){return _0x3c7a80;});}else{return _0x3c7a80;}})['catch'](function(_0x6d497d){logger[_0x0864('0x25')](_0x0864('0x4e'),_0x6d497d);throw _0x6d497d;});}return _0x3c7a80;})[_0x0864('0x22')](respondWithResult(_0x1e92b5,0xc9))['catch'](handleError(_0x1e92b5,null));};exports[_0x0864('0x21')]=function(_0x1c4bd4,_0x31ee1d){if(_0x1c4bd4[_0x0864('0x48')]['id']){delete _0x1c4bd4[_0x0864('0x48')]['id'];}return db[_0x0864('0x2b')]['find']({'where':{'id':_0x1c4bd4['params']['id']}})[_0x0864('0x22')](handleEntityNotFound(_0x31ee1d,null))[_0x0864('0x22')](saveUpdates(_0x1c4bd4[_0x0864('0x48')],null))[_0x0864('0x22')](respondWithResult(_0x31ee1d,null))[_0x0864('0x4f')](handleError(_0x31ee1d,null));};exports[_0x0864('0x23')]=function(_0x119810,_0x24dc4b){return db['SquareOdbc']['find']({'where':{'id':_0x119810[_0x0864('0x41')]['id']}})[_0x0864('0x22')](handleEntityNotFound(_0x24dc4b,null))[_0x0864('0x22')](removeEntity(_0x24dc4b,null))['catch'](handleError(_0x24dc4b,null));};exports[_0x0864('0x50')]=function(_0x29d530,_0x3b6fc5,_0x47d6b9){var _0x5a2741;return db[_0x0864('0x2b')][_0x0864('0x46')]({'where':{'id':_0x29d530['params']['id']},'attributes':['id',_0x0864('0x51')]})['then'](handleEntityNotFound(_0x3b6fc5,null))['then'](function(_0x1f3f12){if(_0x1f3f12){var _0x3e19c3=require(_0x0864('0x52'))();_0x3e19c3['openSync'](_0x1f3f12[_0x0864('0x51')]);_0x3e19c3['closeSync']();return _0x1f3f12;}})[_0x0864('0x22')](respondWithResult(_0x3b6fc5,null))[_0x0864('0x4f')](handleError(_0x3b6fc5,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 0d5f2cc..2611df8 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 _0xa49e=['SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x1fb542,_0x45462d){var _0x3c762c=function(_0x1d1bad){while(--_0x1d1bad){_0x1fb542['push'](_0x1fb542['shift']());}};_0x3c762c(++_0x45462d);}(_0xa49e,0x1de));var _0xea49=function(_0xe429f8,_0xb5ddb4){_0xe429f8=_0xe429f8-0x0;var _0x439723=_0xa49e[_0xe429f8];return _0x439723;};'use strict';var _=require(_0xea49('0x0'));var util=require(_0xea49('0x1'));var logger=require(_0xea49('0x2'))(_0xea49('0x3'));var moment=require(_0xea49('0x4'));var BPromise=require(_0xea49('0x5'));var rp=require(_0xea49('0x6'));var fs=require('fs');var path=require(_0xea49('0x7'));var rimraf=require('rimraf');var config=require(_0xea49('0x8'));var attributes=require(_0xea49('0x9'));module[_0xea49('0xa')]=function(_0x56a45a,_0x1b831c){return _0x56a45a[_0xea49('0xb')](_0xea49('0xc'),attributes,{'tableName':_0xea49('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7507=['request-promise','path','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash','util','moment','bluebird'];(function(_0x273f50,_0x5aba63){var _0x57a338=function(_0x2df8ae){while(--_0x2df8ae){_0x273f50['push'](_0x273f50['shift']());}};_0x57a338(++_0x5aba63);}(_0x7507,0x13b));var _0x7750=function(_0x36eb2a,_0x44924c){_0x36eb2a=_0x36eb2a-0x0;var _0x564ace=_0x7507[_0x36eb2a];return _0x564ace;};'use strict';var _=require(_0x7750('0x0'));var util=require(_0x7750('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7750('0x2'));var BPromise=require(_0x7750('0x3'));var rp=require(_0x7750('0x4'));var fs=require('fs');var path=require(_0x7750('0x5'));var rimraf=require('rimraf');var config=require(_0x7750('0x6'));var attributes=require(_0x7750('0x7'));module['exports']=function(_0x46f784,_0x3334cb){return _0x46f784[_0x7750('0x8')](_0x7750('0x9'),attributes,{'tableName':_0x7750('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 c32c165..621cd2a 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 _0x6aa5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','include','map','model','attributes','lodash','moment'];(function(_0x2717f2,_0x2cc21e){var _0x47cbee=function(_0x2a4be2){while(--_0x2a4be2){_0x2717f2['push'](_0x2717f2['shift']());}};_0x47cbee(++_0x2cc21e);}(_0x6aa5,0xd0));var _0x56aa=function(_0x324332,_0x28e324){_0x324332=_0x324332-0x0;var _0x22582d=_0x6aa5[_0x324332];return _0x22582d;};'use strict';var _=require(_0x56aa('0x0'));var util=require('util');var moment=require(_0x56aa('0x1'));var BPromise=require(_0x56aa('0x2'));var rs=require(_0x56aa('0x3'));var fs=require('fs');var Redis=require(_0x56aa('0x4'));var db=require(_0x56aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x56aa('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x56aa('0x7')][_0x56aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d7cdf,_0x23eebf,_0x30ad3e){return new BPromise(function(_0x3b0232,_0x36374f){return client[_0x56aa('0x9')](_0x3d7cdf,_0x30ad3e)[_0x56aa('0xa')](function(_0x4ac4b8){logger[_0x56aa('0xb')](_0x56aa('0xc'),_0x23eebf,_0x56aa('0xd'));logger[_0x56aa('0xe')](_0x56aa('0xf'),_0x23eebf,_0x56aa('0xd'),JSON[_0x56aa('0x10')](_0x4ac4b8));if(_0x4ac4b8[_0x56aa('0x11')]){if(_0x4ac4b8[_0x56aa('0x11')][_0x56aa('0x12')]===0x1f4){logger[_0x56aa('0x11')](_0x56aa('0xc'),_0x23eebf,_0x4ac4b8[_0x56aa('0x11')]['message']);return _0x36374f(_0x4ac4b8[_0x56aa('0x11')][_0x56aa('0x13')]);}logger[_0x56aa('0x11')](_0x56aa('0xc'),_0x23eebf,_0x4ac4b8['error'][_0x56aa('0x13')]);return _0x3b0232(_0x4ac4b8['error'][_0x56aa('0x13')]);}else{logger[_0x56aa('0xb')](_0x56aa('0xc'),_0x23eebf,_0x56aa('0xd'));_0x3b0232(_0x4ac4b8['result'][_0x56aa('0x13')]);}})[_0x56aa('0x14')](function(_0x4e7c6d){logger[_0x56aa('0x11')](_0x56aa('0xc'),_0x23eebf,_0x4e7c6d);_0x36374f(_0x4e7c6d);});});}exports[_0x56aa('0x15')]=function(_0x4d6301){var _0x54dea4=this;return new Promise(function(_0xa2ca59,_0x144a60){return db[_0x56aa('0x16')]['find']({'raw':_0x4d6301[_0x56aa('0x17')]?_0x4d6301[_0x56aa('0x17')][_0x56aa('0x18')]===undefined?!![]:![]:!![],'where':_0x4d6301['options']?_0x4d6301[_0x56aa('0x17')][_0x56aa('0x19')]||null:null,'attributes':_0x4d6301[_0x56aa('0x17')]?_0x4d6301[_0x56aa('0x17')]['attributes']||null:null,'include':_0x4d6301['options']?_0x4d6301['options'][_0x56aa('0x1a')]?_[_0x56aa('0x1b')](_0x4d6301[_0x56aa('0x17')][_0x56aa('0x1a')],function(_0x338d2c){return{'model':db[_0x338d2c[_0x56aa('0x1c')]],'as':_0x338d2c['as'],'attributes':_0x338d2c['attributes'],'include':_0x338d2c[_0x56aa('0x1a')]?_['map'](_0x338d2c[_0x56aa('0x1a')],function(_0x4ba127){return{'model':db[_0x4ba127['model']],'as':_0x4ba127['as'],'attributes':_0x4ba127[_0x56aa('0x1d')],'include':_0x4ba127[_0x56aa('0x1a')]?_[_0x56aa('0x1b')](_0x4ba127[_0x56aa('0x1a')],function(_0x24a5fe){return{'model':db[_0x24a5fe[_0x56aa('0x1c')]],'as':_0x24a5fe['as'],'attributes':_0x24a5fe[_0x56aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x56aa('0xa')](function(_0x25ab26){logger[_0x56aa('0xb')](_0x56aa('0x15'),_0x4d6301);logger[_0x56aa('0xe')](_0x56aa('0x15'),_0x4d6301,JSON[_0x56aa('0x10')](_0x25ab26));_0xa2ca59(_0x25ab26);})['catch'](function(_0x30ea20){logger[_0x56aa('0x11')](_0x56aa('0x15'),_0x30ea20[_0x56aa('0x13')],_0x4d6301);_0x144a60(_0x54dea4[_0x56aa('0x11')](0x1f4,_0x30ea20[_0x56aa('0x13')]));});});}; \ No newline at end of file +var _0x7b55=['code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x2e8779,_0xe1bba0){var _0x544c67=function(_0x6e4a23){while(--_0x6e4a23){_0x2e8779['push'](_0x2e8779['shift']());}};_0x544c67(++_0xe1bba0);}(_0x7b55,0x18e));var _0x57b5=function(_0x1ea927,_0x363b63){_0x1ea927=_0x1ea927-0x0;var _0x1ed72f=_0x7b55[_0x1ea927];return _0x1ed72f;};'use strict';var _=require(_0x57b5('0x0'));var util=require(_0x57b5('0x1'));var moment=require(_0x57b5('0x2'));var BPromise=require(_0x57b5('0x3'));var rs=require(_0x57b5('0x4'));var fs=require('fs');var Redis=require(_0x57b5('0x5'));var db=require(_0x57b5('0x6'))['db'];var utils=require(_0x57b5('0x7'));var logger=require(_0x57b5('0x8'))(_0x57b5('0x9'));var config=require(_0x57b5('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x530e8e,_0x3d8895,_0x51b4af){return new BPromise(function(_0x564643,_0x2391ea){return client[_0x57b5('0xb')](_0x530e8e,_0x51b4af)[_0x57b5('0xc')](function(_0x1a5ef9){logger['info'](_0x57b5('0xd'),_0x3d8895,_0x57b5('0xe'));logger[_0x57b5('0xf')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x3d8895,'request\x20sent',JSON[_0x57b5('0x10')](_0x1a5ef9));if(_0x1a5ef9['error']){if(_0x1a5ef9[_0x57b5('0x11')][_0x57b5('0x12')]===0x1f4){logger[_0x57b5('0x11')](_0x57b5('0xd'),_0x3d8895,_0x1a5ef9[_0x57b5('0x11')]['message']);return _0x2391ea(_0x1a5ef9[_0x57b5('0x11')][_0x57b5('0x13')]);}logger[_0x57b5('0x11')](_0x57b5('0xd'),_0x3d8895,_0x1a5ef9[_0x57b5('0x11')][_0x57b5('0x13')]);return _0x564643(_0x1a5ef9[_0x57b5('0x11')][_0x57b5('0x13')]);}else{logger[_0x57b5('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x3d8895,_0x57b5('0xe'));_0x564643(_0x1a5ef9[_0x57b5('0x15')]['message']);}})[_0x57b5('0x16')](function(_0x726845){logger['error'](_0x57b5('0xd'),_0x3d8895,_0x726845);_0x2391ea(_0x726845);});});}exports[_0x57b5('0x17')]=function(_0x1545d1){var _0x4003a7=this;return new Promise(function(_0x437dd5,_0x536860){return db[_0x57b5('0x18')][_0x57b5('0x19')]({'raw':_0x1545d1[_0x57b5('0x1a')]?_0x1545d1['options']['raw']===undefined?!![]:![]:!![],'where':_0x1545d1[_0x57b5('0x1a')]?_0x1545d1['options'][_0x57b5('0x1b')]||null:null,'attributes':_0x1545d1[_0x57b5('0x1a')]?_0x1545d1[_0x57b5('0x1a')][_0x57b5('0x1c')]||null:null,'include':_0x1545d1[_0x57b5('0x1a')]?_0x1545d1[_0x57b5('0x1a')]['include']?_[_0x57b5('0x1d')](_0x1545d1['options'][_0x57b5('0x1e')],function(_0x49f8be){return{'model':db[_0x49f8be[_0x57b5('0x1f')]],'as':_0x49f8be['as'],'attributes':_0x49f8be[_0x57b5('0x1c')],'include':_0x49f8be[_0x57b5('0x1e')]?_['map'](_0x49f8be[_0x57b5('0x1e')],function(_0x4af31d){return{'model':db[_0x4af31d['model']],'as':_0x4af31d['as'],'attributes':_0x4af31d[_0x57b5('0x1c')],'include':_0x4af31d['include']?_[_0x57b5('0x1d')](_0x4af31d['include'],function(_0x5353e1){return{'model':db[_0x5353e1[_0x57b5('0x1f')]],'as':_0x5353e1['as'],'attributes':_0x5353e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x57b5('0xc')](function(_0x18070a){logger[_0x57b5('0x14')](_0x57b5('0x17'),_0x1545d1);logger['debug'](_0x57b5('0x17'),_0x1545d1,JSON[_0x57b5('0x10')](_0x18070a));_0x437dd5(_0x18070a);})['catch'](function(_0x16c83b){logger['error'](_0x57b5('0x17'),_0x16c83b[_0x57b5('0x13')],_0x1545d1);_0x536860(_0x4003a7[_0x57b5('0x11')](0x1f4,_0x16c83b[_0x57b5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 7d005fe..a6718ef 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 _0x90a8=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2641d3,_0x490d50){var _0x597a0a=function(_0x55c0d4){while(--_0x55c0d4){_0x2641d3['push'](_0x2641d3['shift']());}};_0x597a0a(++_0x490d50);}(_0x90a8,0x19f));var _0x890a=function(_0x19371b,_0x50eedf){_0x19371b=_0x19371b-0x0;var _0x4c0944=_0x90a8[_0x19371b];return _0x4c0944;};'use strict';var multer=require(_0x890a('0x0'));var util=require(_0x890a('0x1'));var path=require(_0x890a('0x2'));var timeout=require(_0x890a('0x3'));var express=require(_0x890a('0x4'));var router=express[_0x890a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x890a('0x6'));var interaction=require(_0x890a('0x7'));var config=require(_0x890a('0x8'));var controller=require(_0x890a('0x9'));router[_0x890a('0xa')]('/',auth[_0x890a('0xb')](),controller[_0x890a('0xc')]);router['get'](_0x890a('0xd'),auth[_0x890a('0xb')](),controller[_0x890a('0xe')]);router[_0x890a('0xf')]('/',auth[_0x890a('0xb')](),controller[_0x890a('0x10')]);router[_0x890a('0x11')](_0x890a('0xd'),auth['isAuthenticated'](),controller[_0x890a('0x12')]);router[_0x890a('0x13')](_0x890a('0xd'),auth[_0x890a('0xb')](),controller[_0x890a('0x14')]);module[_0x890a('0x15')]=router; \ No newline at end of file +var _0x03c9=['Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','express'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0x03c9,0x1ec));var _0x903c=function(_0x4e13fb,_0x54d644){_0x4e13fb=_0x4e13fb-0x0;var _0xf7b9e7=_0x03c9[_0x4e13fb];return _0xf7b9e7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x903c('0x0'));var router=express[_0x903c('0x1')]();var fs_extra=require(_0x903c('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x903c('0x3'));var config=require(_0x903c('0x4'));var controller=require(_0x903c('0x5'));router['get']('/',auth[_0x903c('0x6')](),controller[_0x903c('0x7')]);router[_0x903c('0x8')](_0x903c('0x9'),auth[_0x903c('0x6')](),controller[_0x903c('0xa')]);router[_0x903c('0xb')]('/',auth[_0x903c('0x6')](),controller[_0x903c('0xc')]);router[_0x903c('0xd')](_0x903c('0x9'),auth[_0x903c('0x6')](),controller[_0x903c('0xe')]);router[_0x903c('0xf')](_0x903c('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x903c('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 3f3bec8..911c8f7 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 _0x6df4=['STRING','name','long','preproduction','utf8','BLOB','getDataValue','production','toString','DATE','sequelize'];(function(_0x167324,_0xb51700){var _0x1fde81=function(_0x3b40e4){while(--_0x3b40e4){_0x167324['push'](_0x167324['shift']());}};_0x1fde81(++_0xb51700);}(_0x6df4,0x78));var _0x46df=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0x6df4[_0x1559a5];return _0x17a783;};'use strict';var Sequelize=require(_0x46df('0x0'));module['exports']={'name':{'type':Sequelize[_0x46df('0x1')],'unique':_0x46df('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x46df('0x3')),'get':function(){if(this['getDataValue']('preproduction')){return this['getDataValue'](_0x46df('0x4'))['toString'](_0x46df('0x5'));}}},'production':{'type':Sequelize[_0x46df('0x6')]('long'),'get':function(){if(this[_0x46df('0x7')](_0x46df('0x8'))){return this[_0x46df('0x7')](_0x46df('0x8'))[_0x46df('0x9')]('utf8');}}},'savedAt':{'type':Sequelize[_0x46df('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xf1c6=['production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','getDataValue','preproduction','long'];(function(_0x127d71,_0x4df9d6){var _0x134f1b=function(_0x31f397){while(--_0x31f397){_0x127d71['push'](_0x127d71['shift']());}};_0x134f1b(++_0x4df9d6);}(_0xf1c6,0xf4));var _0x6f1c=function(_0xede5dc,_0x45f3ee){_0xede5dc=_0xede5dc-0x0;var _0x29c46e=_0xf1c6[_0xede5dc];return _0x29c46e;};'use strict';var Sequelize=require(_0x6f1c('0x0'));module[_0x6f1c('0x1')]={'name':{'type':Sequelize[_0x6f1c('0x2')],'unique':_0x6f1c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6f1c('0x2')]},'notes':{'type':Sequelize[_0x6f1c('0x4')]},'preproduction':{'type':Sequelize[_0x6f1c('0x5')]('long'),'get':function(){if(this[_0x6f1c('0x6')](_0x6f1c('0x7'))){return this[_0x6f1c('0x6')](_0x6f1c('0x7'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x6f1c('0x5')](_0x6f1c('0x8')),'get':function(){if(this[_0x6f1c('0x6')](_0x6f1c('0x9'))){return this[_0x6f1c('0x6')](_0x6f1c('0x9'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0x6f1c('0xa')]},'publishedAt':{'type':Sequelize[_0x6f1c('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 91203a8..d38fc40 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 _0xe10d=['api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','json','offset','undefined','limit','count','status','set','Content-Range','then','get','SquareProjects','destroy','agi','stringify','stack','index','map','SquareProject','rawAttributes','fieldName','type','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','pick','production','params','lodash','../../config/logger'];(function(_0x2f0c6e,_0x58e55f){var _0x3e5d42=function(_0x3dba0c){while(--_0x3dba0c){_0x2f0c6e['push'](_0x2f0c6e['shift']());}};_0x3e5d42(++_0x58e55f);}(_0xe10d,0x10a));var _0xde10=function(_0x4f7f62,_0x3a12c8){_0x4f7f62=_0x4f7f62-0x0;var _0x4da683=_0xe10d[_0x4f7f62];return _0x4da683;};'use strict';var _=require(_0xde10('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xde10('0x1'))(_0xde10('0x2'));var config=require(_0xde10('0x3'));var db=require(_0xde10('0x4'))['db'];config[_0xde10('0x5')]=_[_0xde10('0x6')](config[_0xde10('0x5')],{'host':_0xde10('0x7'),'port':0x18eb});var socket=require(_0xde10('0x8'))(new Redis(config[_0xde10('0x5')]));require(_0xde10('0x9'))[_0xde10('0xa')](socket);function respondWithResult(_0x3393bb,_0x3733d7){_0x3733d7=_0x3733d7||0xc8;return function(_0x4a8088){if(_0x4a8088){return _0x3393bb['status'](_0x3733d7)[_0xde10('0xb')](_0x4a8088);}};}function respondWithFilteredResult(_0x1d572d,_0x2e2a24){return function(_0xb9d7f2){if(_0xb9d7f2){var _0x4247c3=typeof _0x2e2a24[_0xde10('0xc')]===_0xde10('0xd')&&typeof _0x2e2a24[_0xde10('0xe')]===_0xde10('0xd');var _0x273a68=_0xb9d7f2[_0xde10('0xf')];var _0x6fde95=_0x4247c3?0x0:_0x2e2a24[_0xde10('0xc')];var _0x19f565=_0x4247c3?_0xb9d7f2[_0xde10('0xf')]:_0x2e2a24[_0xde10('0xc')]+_0x2e2a24[_0xde10('0xe')];var _0x201bf2;if(_0x19f565>=_0x273a68){_0x19f565=_0x273a68;_0x201bf2=0xc8;}else{_0x201bf2=0xce;}_0x1d572d[_0xde10('0x10')](_0x201bf2);return _0x1d572d[_0xde10('0x11')](_0xde10('0x12'),_0x6fde95+'-'+_0x19f565+'/'+_0x273a68)[_0xde10('0xb')](_0xb9d7f2);}return null;};}function saveUpdates(_0x2e56eb){return function(_0x976cff){if(_0x976cff){return _0x976cff['update'](_0x2e56eb)[_0xde10('0x13')](function(_0x59d833){return _0x59d833;});}return null;};}function removeEntity(_0x5e90f8){return function(_0x59ab4b){if(_0x59ab4b){return _0x59ab4b['destroy']()[_0xde10('0x13')](function(){var _0x256890=_0x59ab4b[_0xde10('0x14')]({'plain':!![]});var _0x3dce27=_0xde10('0x15');return db['UserProfileResource'][_0xde10('0x16')]({'where':{'type':_0x3dce27,'resourceId':_0x256890['id']}})[_0xde10('0x13')](function(){return _0x59ab4b;});})[_0xde10('0x13')](function(){var _0x20bca0=new Redis(config['redis']);_0x20bca0['publish'](_0xde10('0x17'),JSON[_0xde10('0x18')]({'id':_0x59ab4b['id'],'deleted':!![]}));})['then'](function(){_0x5e90f8[_0xde10('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f1425){return function(_0x3ee018){if(!_0x3ee018){_0x3f1425['sendStatus'](0x194);}return _0x3ee018;};}function handleError(_0x25aa9e,_0xfb0564){_0xfb0564=_0xfb0564||0x1f4;return function(_0x713fb0){logger['error'](_0x713fb0[_0xde10('0x19')]);if(_0x713fb0['name']){delete _0x713fb0['name'];}_0x25aa9e[_0xde10('0x10')](_0xfb0564)['send'](_0x713fb0);};}exports[_0xde10('0x1a')]=function(_0x210a7a,_0x57592c){var _0x2a73c0={},_0x5935a7={},_0x4471a7={'count':0x0,'rows':[]};var _0x4b948f=_[_0xde10('0x1b')](db[_0xde10('0x1c')][_0xde10('0x1d')],function(_0x599380){return{'name':_0x599380[_0xde10('0x1e')],'type':_0x599380[_0xde10('0x1f')]['key']};});_0x5935a7[_0xde10('0x20')]=_[_0xde10('0x1b')](_0x4b948f,_0xde10('0x21'));_0x5935a7[_0xde10('0x22')]=_['keys'](_0x210a7a[_0xde10('0x22')]);_0x5935a7[_0xde10('0x23')]=_['intersection'](_0x5935a7[_0xde10('0x20')],_0x5935a7[_0xde10('0x22')]);_0x2a73c0[_0xde10('0x24')]=_[_0xde10('0x25')](_0x5935a7['model'],qs['fields'](_0x210a7a[_0xde10('0x22')][_0xde10('0x26')]));_0x2a73c0[_0xde10('0x24')]=_0x2a73c0['attributes'][_0xde10('0x27')]?_0x2a73c0[_0xde10('0x24')]:_0x5935a7[_0xde10('0x20')];if(!_0x210a7a['query'][_0xde10('0x28')](_0xde10('0x29'))){_0x2a73c0[_0xde10('0xe')]=qs['limit'](_0x210a7a[_0xde10('0x22')][_0xde10('0xe')]);_0x2a73c0['offset']=qs['offset'](_0x210a7a[_0xde10('0x22')][_0xde10('0xc')]);}_0x2a73c0[_0xde10('0x2a')]=qs[_0xde10('0x2b')](_0x210a7a[_0xde10('0x22')][_0xde10('0x2b')]);_0x2a73c0[_0xde10('0x2c')]=qs[_0xde10('0x23')](_['pick'](_0x210a7a[_0xde10('0x22')],_0x5935a7[_0xde10('0x23')]),_0x4b948f);if(_0x210a7a[_0xde10('0x22')][_0xde10('0x2d')]){_0x2a73c0[_0xde10('0x2c')]=_['merge'](_0x2a73c0[_0xde10('0x2c')],{'$or':_['map'](_0x4b948f,function(_0x5aed0c){if(_0x5aed0c[_0xde10('0x1f')]!==_0xde10('0x2e')){var _0x1f5b15={};_0x1f5b15[_0x5aed0c[_0xde10('0x21')]]={'$like':'%'+_0x210a7a[_0xde10('0x22')][_0xde10('0x2d')]+'%'};return _0x1f5b15;}})});}_0x2a73c0=_['merge']({},_0x2a73c0,_0x210a7a[_0xde10('0x2f')]);var _0x32b403={'where':_0x2a73c0['where']};return db[_0xde10('0x1c')][_0xde10('0xf')](_0x32b403)[_0xde10('0x13')](function(_0x160bef){_0x4471a7[_0xde10('0xf')]=_0x160bef;if(_0x210a7a[_0xde10('0x22')][_0xde10('0x30')]){_0x2a73c0[_0xde10('0x31')]=[{'all':!![]}];}return db['SquareProject'][_0xde10('0x32')](_0x2a73c0);})[_0xde10('0x13')](function(_0x58fb0a){_0x4471a7[_0xde10('0x33')]=_0x58fb0a;return _0x4471a7;})['then'](respondWithFilteredResult(_0x57592c,_0x2a73c0))['catch'](handleError(_0x57592c,null));};exports[_0xde10('0x34')]=function(_0x30d70d,_0x487a77){var _0x406299={'raw':![],'where':{'id':_0x30d70d['params']['id']}},_0x14384b={};_0x14384b[_0xde10('0x20')]=_['keys'](db[_0xde10('0x1c')]['rawAttributes']);_0x14384b[_0xde10('0x22')]=_['keys'](_0x30d70d[_0xde10('0x22')]);_0x14384b['filters']=_['intersection'](_0x14384b[_0xde10('0x20')],_0x14384b['query']);_0x406299[_0xde10('0x24')]=_[_0xde10('0x25')](_0x14384b[_0xde10('0x20')],qs[_0xde10('0x26')](_0x30d70d['query'][_0xde10('0x26')]));_0x406299[_0xde10('0x24')]=_0x406299['attributes'][_0xde10('0x27')]?_0x406299['attributes']:_0x14384b['model'];if(_0x30d70d[_0xde10('0x22')][_0xde10('0x30')]){_0x406299[_0xde10('0x31')]=[{'all':!![]}];}_0x406299=_['merge']({},_0x406299,_0x30d70d[_0xde10('0x2f')]);return db['SquareProject'][_0xde10('0x35')](_0x406299)[_0xde10('0x13')](handleEntityNotFound(_0x487a77,null))[_0xde10('0x13')](respondWithResult(_0x487a77,null))['catch'](handleError(_0x487a77,null));};exports[_0xde10('0x36')]=function(_0x2a6e5f,_0x1104ae){return db[_0xde10('0x1c')]['create'](_0x2a6e5f['body'],{})[_0xde10('0x13')](function(_0x1f6d9c){var _0x2aa5d1=_0x2a6e5f[_0xde10('0x37')][_0xde10('0x14')]({'plain':!![]});if(!_0x2aa5d1)throw new Error(_0xde10('0x38'));if(_0x2aa5d1[_0xde10('0x39')]==='user'){var _0x667c2a=_0x1f6d9c[_0xde10('0x14')]({'plain':!![]});var _0x470aaf=_0xde10('0x15');return db[_0xde10('0x3a')]['find']({'where':{'name':_0x470aaf,'userProfileId':_0x2aa5d1['userProfileId']},'raw':!![]})[_0xde10('0x13')](function(_0x3d76b6){if(_0x3d76b6&&_0x3d76b6['autoAssociation']===0x0){return db[_0xde10('0x3b')]['create']({'name':_0x667c2a[_0xde10('0x21')],'resourceId':_0x667c2a['id'],'type':_0x3d76b6[_0xde10('0x21')],'sectionId':_0x3d76b6['id']},{})[_0xde10('0x13')](function(){return _0x1f6d9c;});}else{return _0x1f6d9c;}})[_0xde10('0x3c')](function(_0x1f498d){logger[_0xde10('0x3d')](_0xde10('0x3e'),_0x1f498d);throw _0x1f498d;});}return _0x1f6d9c;})[_0xde10('0x13')](respondWithResult(_0x1104ae,0xc9))[_0xde10('0x3c')](handleError(_0x1104ae,null));};exports['update']=function(_0x910a56,_0x2b62f4){if(_0x910a56['body']['id']){delete _0x910a56[_0xde10('0x3f')]['id'];}return db[_0xde10('0x1c')][_0xde10('0x35')]({'where':{'id':_0x910a56['params']['id']}})['then'](handleEntityNotFound(_0x2b62f4,null))[_0xde10('0x13')](saveUpdates(_0x910a56[_0xde10('0x3f')],null))['then'](function(_0x20ae09){if(!_0x20ae09)return;var _0x5f0e5d=_0x20ae09[_0xde10('0x14')]({'plain':!![]});return _0x5f0e5d;})[_0xde10('0x13')](function(_0x35ff9f){var _0x55b53f=new Redis(config[_0xde10('0x5')]);_0x55b53f['publish'](_0xde10('0x17'),JSON[_0xde10('0x18')](_[_0xde10('0x40')](_0x35ff9f,['id',_0xde10('0x21'),_0xde10('0x41')])));return _0x35ff9f;})[_0xde10('0x13')](respondWithResult(_0x2b62f4,null))[_0xde10('0x3c')](handleError(_0x2b62f4,null));};exports[_0xde10('0x16')]=function(_0x42a1b8,_0x2e258b){return db[_0xde10('0x1c')][_0xde10('0x35')]({'where':{'id':_0x42a1b8[_0xde10('0x42')]['id']}})[_0xde10('0x13')](handleEntityNotFound(_0x2e258b,null))['then'](removeEntity(_0x2e258b,null))[_0xde10('0x3c')](handleError(_0x2e258b,null));}; \ No newline at end of file +var _0x154d=['agi','stringify','destroy','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','json','offset','limit','undefined','count','status','Content-Range','then','get','SquareProjects','UserProfileResource','publish','end','stack','send','index','map','SquareProject','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','user','role','UserProfileSection','autoAssociation','error','update','body'];(function(_0x215eaa,_0xd7abf6){var _0x4de0d2=function(_0x2fdc03){while(--_0x2fdc03){_0x215eaa['push'](_0x215eaa['shift']());}};_0x4de0d2(++_0xd7abf6);}(_0x154d,0x11b));var _0xd154=function(_0x9a2e76,_0x361e3b){_0x9a2e76=_0x9a2e76-0x0;var _0xe0fb41=_0x154d[_0x9a2e76];return _0xe0fb41;};'use strict';var _=require(_0xd154('0x0'));var Redis=require(_0xd154('0x1'));var qs=require(_0xd154('0x2'));var logger=require(_0xd154('0x3'))(_0xd154('0x4'));var config=require(_0xd154('0x5'));var db=require('../../mysqldb')['db'];config[_0xd154('0x6')]=_[_0xd154('0x7')](config['redis'],{'host':_0xd154('0x8'),'port':0x18eb});var socket=require(_0xd154('0x9'))(new Redis(config[_0xd154('0x6')]));require('./squareProject.socket')[_0xd154('0xa')](socket);function respondWithResult(_0x291df5,_0x1b209b){_0x1b209b=_0x1b209b||0xc8;return function(_0x21a24c){if(_0x21a24c){return _0x291df5['status'](_0x1b209b)[_0xd154('0xb')](_0x21a24c);}};}function respondWithFilteredResult(_0x3e5c50,_0x26500c){return function(_0x1aeaad){if(_0x1aeaad){var _0x2d2930=typeof _0x26500c[_0xd154('0xc')]==='undefined'&&typeof _0x26500c[_0xd154('0xd')]===_0xd154('0xe');var _0x32d57e=_0x1aeaad[_0xd154('0xf')];var _0x5eddf3=_0x2d2930?0x0:_0x26500c['offset'];var _0x1c4b8a=_0x2d2930?_0x1aeaad[_0xd154('0xf')]:_0x26500c[_0xd154('0xc')]+_0x26500c[_0xd154('0xd')];var _0x3d94f5;if(_0x1c4b8a>=_0x32d57e){_0x1c4b8a=_0x32d57e;_0x3d94f5=0xc8;}else{_0x3d94f5=0xce;}_0x3e5c50[_0xd154('0x10')](_0x3d94f5);return _0x3e5c50['set'](_0xd154('0x11'),_0x5eddf3+'-'+_0x1c4b8a+'/'+_0x32d57e)['json'](_0x1aeaad);}return null;};}function saveUpdates(_0x3d69fd){return function(_0x56a69a){if(_0x56a69a){return _0x56a69a['update'](_0x3d69fd)[_0xd154('0x12')](function(_0x5d8d64){return _0x5d8d64;});}return null;};}function removeEntity(_0x23d4da){return function(_0x3c68b2){if(_0x3c68b2){return _0x3c68b2['destroy']()['then'](function(){var _0x5ec596=_0x3c68b2[_0xd154('0x13')]({'plain':!![]});var _0x9f96b1=_0xd154('0x14');return db[_0xd154('0x15')]['destroy']({'where':{'type':_0x9f96b1,'resourceId':_0x5ec596['id']}})[_0xd154('0x12')](function(){return _0x3c68b2;});})['then'](function(){var _0x3e381c=new Redis(config[_0xd154('0x6')]);_0x3e381c[_0xd154('0x16')]('agi',JSON['stringify']({'id':_0x3c68b2['id'],'deleted':!![]}));})[_0xd154('0x12')](function(){_0x23d4da[_0xd154('0x10')](0xcc)[_0xd154('0x17')]();});}};}function handleEntityNotFound(_0x58553b){return function(_0x418009){if(!_0x418009){_0x58553b['sendStatus'](0x194);}return _0x418009;};}function handleError(_0x3ea899,_0xf22047){_0xf22047=_0xf22047||0x1f4;return function(_0x5f19b0){logger['error'](_0x5f19b0[_0xd154('0x18')]);if(_0x5f19b0['name']){delete _0x5f19b0['name'];}_0x3ea899['status'](_0xf22047)[_0xd154('0x19')](_0x5f19b0);};}exports[_0xd154('0x1a')]=function(_0x39ae1d,_0x5b0ae6){var _0x4b93a8={},_0x3df052={},_0xc7df0f={'count':0x0,'rows':[]};var _0x4e6b22=_[_0xd154('0x1b')](db[_0xd154('0x1c')]['rawAttributes'],function(_0x2d0ee2){return{'name':_0x2d0ee2['fieldName'],'type':_0x2d0ee2[_0xd154('0x1d')][_0xd154('0x1e')]};});_0x3df052[_0xd154('0x1f')]=_[_0xd154('0x1b')](_0x4e6b22,_0xd154('0x20'));_0x3df052[_0xd154('0x21')]=_[_0xd154('0x22')](_0x39ae1d['query']);_0x3df052[_0xd154('0x23')]=_[_0xd154('0x24')](_0x3df052[_0xd154('0x1f')],_0x3df052[_0xd154('0x21')]);_0x4b93a8['attributes']=_['intersection'](_0x3df052[_0xd154('0x1f')],qs[_0xd154('0x25')](_0x39ae1d['query'][_0xd154('0x25')]));_0x4b93a8['attributes']=_0x4b93a8[_0xd154('0x26')][_0xd154('0x27')]?_0x4b93a8[_0xd154('0x26')]:_0x3df052[_0xd154('0x1f')];if(!_0x39ae1d[_0xd154('0x21')][_0xd154('0x28')](_0xd154('0x29'))){_0x4b93a8[_0xd154('0xd')]=qs['limit'](_0x39ae1d[_0xd154('0x21')][_0xd154('0xd')]);_0x4b93a8['offset']=qs[_0xd154('0xc')](_0x39ae1d[_0xd154('0x21')][_0xd154('0xc')]);}_0x4b93a8[_0xd154('0x2a')]=qs['sort'](_0x39ae1d[_0xd154('0x21')][_0xd154('0x2b')]);_0x4b93a8['where']=qs[_0xd154('0x23')](_[_0xd154('0x2c')](_0x39ae1d[_0xd154('0x21')],_0x3df052[_0xd154('0x23')]),_0x4e6b22);if(_0x39ae1d[_0xd154('0x21')][_0xd154('0x2d')]){_0x4b93a8['where']=_[_0xd154('0x2e')](_0x4b93a8[_0xd154('0x2f')],{'$or':_[_0xd154('0x1b')](_0x4e6b22,function(_0x2435dd){if(_0x2435dd[_0xd154('0x1d')]!==_0xd154('0x30')){var _0x143416={};_0x143416[_0x2435dd[_0xd154('0x20')]]={'$like':'%'+_0x39ae1d[_0xd154('0x21')][_0xd154('0x2d')]+'%'};return _0x143416;}})});}_0x4b93a8=_[_0xd154('0x2e')]({},_0x4b93a8,_0x39ae1d[_0xd154('0x31')]);var _0x17d41c={'where':_0x4b93a8[_0xd154('0x2f')]};return db[_0xd154('0x1c')][_0xd154('0xf')](_0x17d41c)[_0xd154('0x12')](function(_0x196a6e){_0xc7df0f[_0xd154('0xf')]=_0x196a6e;if(_0x39ae1d[_0xd154('0x21')][_0xd154('0x32')]){_0x4b93a8['include']=[{'all':!![]}];}return db[_0xd154('0x1c')][_0xd154('0x33')](_0x4b93a8);})[_0xd154('0x12')](function(_0x3def04){_0xc7df0f[_0xd154('0x34')]=_0x3def04;return _0xc7df0f;})[_0xd154('0x12')](respondWithFilteredResult(_0x5b0ae6,_0x4b93a8))[_0xd154('0x35')](handleError(_0x5b0ae6,null));};exports[_0xd154('0x36')]=function(_0xa8fc3f,_0x113523){var _0x5b70a6={'raw':![],'where':{'id':_0xa8fc3f[_0xd154('0x37')]['id']}},_0x8266d3={};_0x8266d3[_0xd154('0x1f')]=_['keys'](db['SquareProject'][_0xd154('0x38')]);_0x8266d3[_0xd154('0x21')]=_[_0xd154('0x22')](_0xa8fc3f[_0xd154('0x21')]);_0x8266d3['filters']=_[_0xd154('0x24')](_0x8266d3[_0xd154('0x1f')],_0x8266d3[_0xd154('0x21')]);_0x5b70a6[_0xd154('0x26')]=_['intersection'](_0x8266d3[_0xd154('0x1f')],qs['fields'](_0xa8fc3f[_0xd154('0x21')][_0xd154('0x25')]));_0x5b70a6[_0xd154('0x26')]=_0x5b70a6[_0xd154('0x26')][_0xd154('0x27')]?_0x5b70a6['attributes']:_0x8266d3[_0xd154('0x1f')];if(_0xa8fc3f[_0xd154('0x21')]['includeAll']){_0x5b70a6[_0xd154('0x39')]=[{'all':!![]}];}_0x5b70a6=_['merge']({},_0x5b70a6,_0xa8fc3f[_0xd154('0x31')]);return db['SquareProject'][_0xd154('0x3a')](_0x5b70a6)['then'](handleEntityNotFound(_0x113523,null))[_0xd154('0x12')](respondWithResult(_0x113523,null))['catch'](handleError(_0x113523,null));};exports[_0xd154('0x3b')]=function(_0x46a9b4,_0x2512f6){return db[_0xd154('0x1c')][_0xd154('0x3b')](_0x46a9b4['body'],{})['then'](function(_0x4db98f){var _0x56bdf8=_0x46a9b4[_0xd154('0x3c')][_0xd154('0x13')]({'plain':!![]});if(!_0x56bdf8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56bdf8[_0xd154('0x3d')]===_0xd154('0x3c')){var _0x54bcbe=_0x4db98f[_0xd154('0x13')]({'plain':!![]});var _0x307485=_0xd154('0x14');return db[_0xd154('0x3e')]['find']({'where':{'name':_0x307485,'userProfileId':_0x56bdf8['userProfileId']},'raw':!![]})[_0xd154('0x12')](function(_0x5caef8){if(_0x5caef8&&_0x5caef8[_0xd154('0x3f')]===0x0){return db[_0xd154('0x15')][_0xd154('0x3b')]({'name':_0x54bcbe[_0xd154('0x20')],'resourceId':_0x54bcbe['id'],'type':_0x5caef8['name'],'sectionId':_0x5caef8['id']},{})[_0xd154('0x12')](function(){return _0x4db98f;});}else{return _0x4db98f;}})[_0xd154('0x35')](function(_0x11830d){logger[_0xd154('0x40')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11830d);throw _0x11830d;});}return _0x4db98f;})[_0xd154('0x12')](respondWithResult(_0x2512f6,0xc9))['catch'](handleError(_0x2512f6,null));};exports[_0xd154('0x41')]=function(_0x3403d9,_0x27a858){if(_0x3403d9[_0xd154('0x42')]['id']){delete _0x3403d9[_0xd154('0x42')]['id'];}return db[_0xd154('0x1c')][_0xd154('0x3a')]({'where':{'id':_0x3403d9[_0xd154('0x37')]['id']}})[_0xd154('0x12')](handleEntityNotFound(_0x27a858,null))[_0xd154('0x12')](saveUpdates(_0x3403d9['body'],null))[_0xd154('0x12')](function(_0xe804ec){if(!_0xe804ec)return;var _0x4e7113=_0xe804ec[_0xd154('0x13')]({'plain':!![]});return _0x4e7113;})[_0xd154('0x12')](function(_0x1c592e){var _0x468827=new Redis(config['redis']);_0x468827[_0xd154('0x16')](_0xd154('0x43'),JSON[_0xd154('0x44')](_[_0xd154('0x2c')](_0x1c592e,['id','name','production'])));return _0x1c592e;})[_0xd154('0x12')](respondWithResult(_0x27a858,null))['catch'](handleError(_0x27a858,null));};exports[_0xd154('0x45')]=function(_0x98430e,_0x3c3482){return db[_0xd154('0x1c')][_0xd154('0x3a')]({'where':{'id':_0x98430e[_0xd154('0x37')]['id']}})[_0xd154('0x12')](handleEntityNotFound(_0x3c3482,null))[_0xd154('0x12')](removeEntity(_0x3c3482,null))[_0xd154('0x35')](handleError(_0x3c3482,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 19162f9..13293d5 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 _0xe401=['hasOwnProperty','hook','events','../../mysqldb','SquareProject','save','update','remove','emit'];(function(_0x58b127,_0x528578){var _0x2b7d7d=function(_0x57cf64){while(--_0x57cf64){_0x58b127['push'](_0x58b127['shift']());}};_0x2b7d7d(++_0x528578);}(_0xe401,0x14f));var _0x1e40=function(_0x1d8e02,_0x43c58e){_0x1d8e02=_0x1d8e02-0x0;var _0x4d72b7=_0xe401[_0x1d8e02];return _0x4d72b7;};'use strict';var EventEmitter=require(_0x1e40('0x0'));var SquareProject=require(_0x1e40('0x1'))['db'][_0x1e40('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1e40('0x3'),'afterUpdate':_0x1e40('0x4'),'afterDestroy':_0x1e40('0x5')};function emitEvent(_0x23bd89){return function(_0x45fd9a,_0x382d53,_0x21edaa){SquareProjectEvents[_0x1e40('0x6')](_0x23bd89+':'+_0x45fd9a['id'],_0x45fd9a);SquareProjectEvents[_0x1e40('0x6')](_0x23bd89,_0x45fd9a);_0x21edaa(null);};}for(var e in events){if(events[_0x1e40('0x7')](e)){var event=events[e];SquareProject[_0x1e40('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x295a=['emit','hook','exports','setMaxListeners','save','update','remove'];(function(_0x41b2df,_0x3e26b4){var _0x433e30=function(_0x17265c){while(--_0x17265c){_0x41b2df['push'](_0x41b2df['shift']());}};_0x433e30(++_0x3e26b4);}(_0x295a,0xe3));var _0xa295=function(_0x6e3db4,_0x816fef){_0x6e3db4=_0x6e3db4-0x0;var _0xdbc59e=_0x295a[_0x6e3db4];return _0xdbc59e;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa295('0x0')](0x0);var events={'afterCreate':_0xa295('0x1'),'afterUpdate':_0xa295('0x2'),'afterDestroy':_0xa295('0x3')};function emitEvent(_0x238ae5){return function(_0x2c360e,_0x1891ec,_0x6d3a9b){SquareProjectEvents[_0xa295('0x4')](_0x238ae5+':'+_0x2c360e['id'],_0x2c360e);SquareProjectEvents['emit'](_0x238ae5,_0x2c360e);_0x6d3a9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xa295('0x5')](e,emitEvent(event));}}module[_0xa295('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 231cd50..9773f7e 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 _0x6a44=['../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','bluebird','request-promise','path','rimraf'];(function(_0x4cd102,_0x2f1297){var _0x4c2fe4=function(_0x537db6){while(--_0x537db6){_0x4cd102['push'](_0x4cd102['shift']());}};_0x4c2fe4(++_0x2f1297);}(_0x6a44,0x150));var _0x46a4=function(_0x1c2efd,_0x551531){_0x1c2efd=_0x1c2efd-0x0;var _0x15a358=_0x6a44[_0x1c2efd];return _0x15a358;};'use strict';var _=require('lodash');var util=require(_0x46a4('0x0'));var logger=require('../../config/logger')(_0x46a4('0x1'));var moment=require('moment');var BPromise=require(_0x46a4('0x2'));var rp=require(_0x46a4('0x3'));var fs=require('fs');var path=require(_0x46a4('0x4'));var rimraf=require(_0x46a4('0x5'));var config=require(_0x46a4('0x6'));var attributes=require(_0x46a4('0x7'));module[_0x46a4('0x8')]=function(_0xecac7,_0x500992){return _0xecac7[_0x46a4('0x9')](_0x46a4('0xa'),attributes,{'tableName':_0x46a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a89de,_0x94dc4,_0x576a62){if(_0x1a89de[_0x46a4('0xc')](_0x46a4('0xd'))){_0x1a89de[_0x46a4('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1a89de[_0x46a4('0xc')]('production')){_0x1a89de[_0x46a4('0xf')]=moment()[_0x46a4('0x10')](_0x46a4('0x11'));}_0x576a62(null,_0x1a89de);}}});}; \ No newline at end of file +var _0x5184=['YYYY-MM-DD\x20HH:mm:ss','changed','production','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','preproduction','savedAt','format'];(function(_0x2a8cb2,_0x39300a){var _0x4eb6d8=function(_0xacb732){while(--_0xacb732){_0x2a8cb2['push'](_0x2a8cb2['shift']());}};_0x4eb6d8(++_0x39300a);}(_0x5184,0xc3));var _0x4518=function(_0x102adf,_0x7e18fe){_0x102adf=_0x102adf-0x0;var _0x3f5508=_0x5184[_0x102adf];return _0x3f5508;};'use strict';var _=require(_0x4518('0x0'));var util=require('util');var logger=require(_0x4518('0x1'))('api');var moment=require(_0x4518('0x2'));var BPromise=require(_0x4518('0x3'));var rp=require(_0x4518('0x4'));var fs=require('fs');var path=require(_0x4518('0x5'));var rimraf=require(_0x4518('0x6'));var config=require(_0x4518('0x7'));var attributes=require(_0x4518('0x8'));module['exports']=function(_0x380884,_0xb8c2d7){return _0x380884[_0x4518('0x9')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ab8a5,_0x5133a7,_0x4db91d){if(_0x4ab8a5['changed'](_0x4518('0xa'))){_0x4ab8a5[_0x4518('0xb')]=moment()[_0x4518('0xc')](_0x4518('0xd'));}if(_0x4ab8a5[_0x4518('0xe')](_0x4518('0xf'))){_0x4ab8a5['publishedAt']=moment()[_0x4518('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4db91d(null,_0x4ab8a5);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 87692f7..01527bf 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 _0xd321=['stringify','catch','message','error','raw','info','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects','SquareProject','options','where','attributes','limit','include','map','model','then'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xd321,0x1e3));var _0x1d32=function(_0x22e8cd,_0xcc3606){_0x22e8cd=_0x22e8cd-0x0;var _0x14ce5d=_0xd321[_0x22e8cd];return _0x14ce5d;};'use strict';var _=require(_0x1d32('0x0'));var Redis=require(_0x1d32('0x1'));var db=require(_0x1d32('0x2'))['db'];var logger=require(_0x1d32('0x3'))(_0x1d32('0x4'));var config=require(_0x1d32('0x5'));config[_0x1d32('0x6')]=_[_0x1d32('0x7')](config[_0x1d32('0x6')],{'host':_0x1d32('0x8'),'port':0x18eb});var socket=require(_0x1d32('0x9'))(new Redis(config[_0x1d32('0x6')]));require(_0x1d32('0xa'))['register'](socket);exports[_0x1d32('0xb')]=function(_0x7c488b){var _0x4f1671=this;return new Promise(function(_0x536edb,_0x5d21b1){return db[_0x1d32('0xc')]['findAll']({'raw':_0x7c488b[_0x1d32('0xd')]?_0x7c488b[_0x1d32('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x7c488b[_0x1d32('0xd')]?_0x7c488b[_0x1d32('0xd')][_0x1d32('0xe')]||null:null,'attributes':_0x7c488b['options']?_0x7c488b[_0x1d32('0xd')][_0x1d32('0xf')]||null:null,'limit':_0x7c488b[_0x1d32('0xd')]?_0x7c488b[_0x1d32('0xd')][_0x1d32('0x10')]||null:null,'include':_0x7c488b[_0x1d32('0xd')]?_0x7c488b['options'][_0x1d32('0x11')]?_[_0x1d32('0x12')](_0x7c488b['options'][_0x1d32('0x11')],function(_0x4b5133){return{'model':db[_0x4b5133[_0x1d32('0x13')]],'as':_0x4b5133['as'],'attributes':_0x4b5133[_0x1d32('0xf')],'include':_0x4b5133['include']?_['map'](_0x4b5133[_0x1d32('0x11')],function(_0x54cdd0){return{'model':db[_0x54cdd0[_0x1d32('0x13')]],'as':_0x54cdd0['as'],'attributes':_0x54cdd0[_0x1d32('0xf')],'include':_0x54cdd0['include']?_[_0x1d32('0x12')](_0x54cdd0[_0x1d32('0x11')],function(_0x21a16f){return{'model':db[_0x21a16f[_0x1d32('0x13')]],'as':_0x21a16f['as'],'attributes':_0x21a16f['attributes']};}):[]};}):[]};}):[]:[]})[_0x1d32('0x14')](function(_0xd90c16){logger['info']('GetSquareProjects',_0x7c488b);logger['debug'](_0x1d32('0xb'),_0x7c488b,JSON[_0x1d32('0x15')](_0xd90c16));_0x536edb(_0xd90c16);})[_0x1d32('0x16')](function(_0x2fb604){logger['error']('GetSquareProjects',_0x2fb604[_0x1d32('0x17')],_0x7c488b);_0x5d21b1(_0x4f1671[_0x1d32('0x18')](0x1f4,_0x2fb604[_0x1d32('0x17')]));});});};exports['ShowSquareProject']=function(_0x3e6bb3){var _0x319f25=this;return new Promise(function(_0x3c547c,_0x2174fc){return db[_0x1d32('0xc')]['find']({'raw':_0x3e6bb3[_0x1d32('0xd')]?_0x3e6bb3[_0x1d32('0xd')][_0x1d32('0x19')]===undefined?!![]:![]:!![],'where':_0x3e6bb3[_0x1d32('0xd')]?_0x3e6bb3[_0x1d32('0xd')][_0x1d32('0xe')]||null:null,'attributes':_0x3e6bb3[_0x1d32('0xd')]?_0x3e6bb3[_0x1d32('0xd')][_0x1d32('0xf')]||null:null,'include':_0x3e6bb3[_0x1d32('0xd')]?_0x3e6bb3[_0x1d32('0xd')][_0x1d32('0x11')]?_[_0x1d32('0x12')](_0x3e6bb3['options'][_0x1d32('0x11')],function(_0x54495c){return{'model':db[_0x54495c[_0x1d32('0x13')]],'as':_0x54495c['as'],'attributes':_0x54495c[_0x1d32('0xf')],'include':_0x54495c[_0x1d32('0x11')]?_[_0x1d32('0x12')](_0x54495c[_0x1d32('0x11')],function(_0x2c9db9){return{'model':db[_0x2c9db9[_0x1d32('0x13')]],'as':_0x2c9db9['as'],'attributes':_0x2c9db9[_0x1d32('0xf')],'include':_0x2c9db9[_0x1d32('0x11')]?_[_0x1d32('0x12')](_0x2c9db9[_0x1d32('0x11')],function(_0x40b03b){return{'model':db[_0x40b03b[_0x1d32('0x13')]],'as':_0x40b03b['as'],'attributes':_0x40b03b[_0x1d32('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd3755c){logger[_0x1d32('0x1a')](_0x1d32('0x1b'),_0x3e6bb3);logger['debug'](_0x1d32('0x1b'),_0x3e6bb3,JSON[_0x1d32('0x15')](_0xd3755c));_0x3c547c(_0xd3755c);})[_0x1d32('0x16')](function(_0x477dfa){logger[_0x1d32('0x18')](_0x1d32('0x1b'),_0x477dfa[_0x1d32('0x17')],_0x3e6bb3);_0x2174fc(_0x319f25[_0x1d32('0x18')](0x1f4,_0x477dfa[_0x1d32('0x17')]));});});}; \ No newline at end of file +var _0x8efb=['socket.io-emitter','register','GetSquareProjects','findAll','options','raw','attributes','limit','map','model','include','then','info','catch','error','message','ShowSquareProject','SquareProject','find','where','stringify','lodash','ioredis','../../config/logger','../../config/environment','redis','defaults'];(function(_0x8ee4d,_0x47f1ca){var _0x1ff628=function(_0x2a8b87){while(--_0x2a8b87){_0x8ee4d['push'](_0x8ee4d['shift']());}};_0x1ff628(++_0x47f1ca);}(_0x8efb,0xed));var _0xb8ef=function(_0x30246e,_0x34e087){_0x30246e=_0x30246e-0x0;var _0x482cd4=_0x8efb[_0x30246e];return _0x482cd4;};'use strict';var _=require(_0xb8ef('0x0'));var Redis=require(_0xb8ef('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xb8ef('0x2'))('rpc');var config=require(_0xb8ef('0x3'));config[_0xb8ef('0x4')]=_[_0xb8ef('0x5')](config[_0xb8ef('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0xb8ef('0x6'))(new Redis(config[_0xb8ef('0x4')]));require('./squareProject.socket')[_0xb8ef('0x7')](socket);exports[_0xb8ef('0x8')]=function(_0x52230a){var _0x532509=this;return new Promise(function(_0x18a0c8,_0x15be5b){return db['SquareProject'][_0xb8ef('0x9')]({'raw':_0x52230a['options']?_0x52230a[_0xb8ef('0xa')][_0xb8ef('0xb')]===undefined?!![]:![]:!![],'where':_0x52230a[_0xb8ef('0xa')]?_0x52230a['options']['where']||null:null,'attributes':_0x52230a[_0xb8ef('0xa')]?_0x52230a['options'][_0xb8ef('0xc')]||null:null,'limit':_0x52230a[_0xb8ef('0xa')]?_0x52230a['options'][_0xb8ef('0xd')]||null:null,'include':_0x52230a[_0xb8ef('0xa')]?_0x52230a[_0xb8ef('0xa')]['include']?_[_0xb8ef('0xe')](_0x52230a[_0xb8ef('0xa')]['include'],function(_0x57c52a){return{'model':db[_0x57c52a[_0xb8ef('0xf')]],'as':_0x57c52a['as'],'attributes':_0x57c52a[_0xb8ef('0xc')],'include':_0x57c52a[_0xb8ef('0x10')]?_[_0xb8ef('0xe')](_0x57c52a['include'],function(_0x4c1c24){return{'model':db[_0x4c1c24[_0xb8ef('0xf')]],'as':_0x4c1c24['as'],'attributes':_0x4c1c24['attributes'],'include':_0x4c1c24['include']?_[_0xb8ef('0xe')](_0x4c1c24[_0xb8ef('0x10')],function(_0x485dc6){return{'model':db[_0x485dc6[_0xb8ef('0xf')]],'as':_0x485dc6['as'],'attributes':_0x485dc6['attributes']};}):[]};}):[]};}):[]:[]})[_0xb8ef('0x11')](function(_0x109fd3){logger[_0xb8ef('0x12')](_0xb8ef('0x8'),_0x52230a);logger['debug'](_0xb8ef('0x8'),_0x52230a,JSON['stringify'](_0x109fd3));_0x18a0c8(_0x109fd3);})[_0xb8ef('0x13')](function(_0x2fb3fe){logger[_0xb8ef('0x14')](_0xb8ef('0x8'),_0x2fb3fe[_0xb8ef('0x15')],_0x52230a);_0x15be5b(_0x532509[_0xb8ef('0x14')](0x1f4,_0x2fb3fe[_0xb8ef('0x15')]));});});};exports[_0xb8ef('0x16')]=function(_0x484e70){var _0x1db100=this;return new Promise(function(_0x1205dc,_0x2b194f){return db[_0xb8ef('0x17')][_0xb8ef('0x18')]({'raw':_0x484e70[_0xb8ef('0xa')]?_0x484e70['options'][_0xb8ef('0xb')]===undefined?!![]:![]:!![],'where':_0x484e70[_0xb8ef('0xa')]?_0x484e70[_0xb8ef('0xa')][_0xb8ef('0x19')]||null:null,'attributes':_0x484e70[_0xb8ef('0xa')]?_0x484e70[_0xb8ef('0xa')]['attributes']||null:null,'include':_0x484e70['options']?_0x484e70[_0xb8ef('0xa')]['include']?_[_0xb8ef('0xe')](_0x484e70[_0xb8ef('0xa')]['include'],function(_0x5ad021){return{'model':db[_0x5ad021[_0xb8ef('0xf')]],'as':_0x5ad021['as'],'attributes':_0x5ad021[_0xb8ef('0xc')],'include':_0x5ad021['include']?_[_0xb8ef('0xe')](_0x5ad021[_0xb8ef('0x10')],function(_0x2431be){return{'model':db[_0x2431be[_0xb8ef('0xf')]],'as':_0x2431be['as'],'attributes':_0x2431be[_0xb8ef('0xc')],'include':_0x2431be[_0xb8ef('0x10')]?_['map'](_0x2431be[_0xb8ef('0x10')],function(_0x158e65){return{'model':db[_0x158e65[_0xb8ef('0xf')]],'as':_0x158e65['as'],'attributes':_0x158e65['attributes']};}):[]};}):[]};}):[]:[]})[_0xb8ef('0x11')](function(_0x1a726d){logger[_0xb8ef('0x12')]('ShowSquareProject',_0x484e70);logger['debug'](_0xb8ef('0x16'),_0x484e70,JSON[_0xb8ef('0x1a')](_0x1a726d));_0x1205dc(_0x1a726d);})[_0xb8ef('0x13')](function(_0x4cbbf5){logger[_0xb8ef('0x14')](_0xb8ef('0x16'),_0x4cbbf5[_0xb8ef('0x15')],_0x484e70);_0x2b194f(_0x1db100[_0xb8ef('0x14')](0x1f4,_0x4cbbf5[_0xb8ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index eb35bad..d58bed9 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 _0x5247=['save','emit','removeListener','length','./squareProject.events'];(function(_0x4dbe5c,_0x36ed26){var _0x57bd05=function(_0x2ad3e2){while(--_0x2ad3e2){_0x4dbe5c['push'](_0x4dbe5c['shift']());}};_0x57bd05(++_0x36ed26);}(_0x5247,0x153));var _0x7524=function(_0x5a46ac,_0x4443b4){_0x5a46ac=_0x5a46ac-0x0;var _0x4d32b7=_0x5247[_0x5a46ac];return _0x4d32b7;};'use strict';var SquareProjectEvents=require(_0x7524('0x0'));var events=[_0x7524('0x1'),'remove','update'];function createListener(_0x118cda,_0x28fbf3){return function(_0x13f9fd){_0x28fbf3[_0x7524('0x2')](_0x118cda,_0x13f9fd);};}function removeListener(_0x25df27,_0x34dc25){return function(){SquareProjectEvents[_0x7524('0x3')](_0x25df27,_0x34dc25);};}exports['register']=function(_0x395d35){for(var _0x129204=0x0,_0x8e36c0=events[_0x7524('0x4')];_0x129204<_0x8e36c0;_0x129204++){var _0x1e9618=events[_0x129204];var _0x1d5745=createListener('squareProject:'+_0x1e9618,_0x395d35);SquareProjectEvents['on'](_0x1e9618,_0x1d5745);}}; \ No newline at end of file +var _0xd528=['emit','removeListener','register','save','remove','update'];(function(_0x27ebe0,_0x3e2f13){var _0x23d72c=function(_0x444948){while(--_0x444948){_0x27ebe0['push'](_0x27ebe0['shift']());}};_0x23d72c(++_0x3e2f13);}(_0xd528,0xc3));var _0x8d52=function(_0x471c5e,_0x20aa5d){_0x471c5e=_0x471c5e-0x0;var _0x30c43a=_0xd528[_0x471c5e];return _0x30c43a;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x8d52('0x0'),_0x8d52('0x1'),_0x8d52('0x2')];function createListener(_0x5f2830,_0x535957){return function(_0x49e1bf){_0x535957[_0x8d52('0x3')](_0x5f2830,_0x49e1bf);};}function removeListener(_0x4ec8df,_0x3ea63e){return function(){SquareProjectEvents[_0x8d52('0x4')](_0x4ec8df,_0x3ea63e);};}exports[_0x8d52('0x5')]=function(_0xcd040){for(var _0x189391=0x0,_0x3e3541=events['length'];_0x189391<_0x3e3541;_0x189391++){var _0x1b5c70=events[_0x189391];var _0x246eb3=createListener('squareProject:'+_0x1b5c70,_0xcd040);SquareProjectEvents['on'](_0x1b5c70,_0x246eb3);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index d8be611..11ae804 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 _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x5bd654,_0x4897e1){var _0x508cda=function(_0x3852c5){while(--_0x3852c5){_0x5bd654['push'](_0x5bd654['shift']());}};_0x508cda(++_0x4897e1);}(_0x53ec,0x192));var _0xc53e=function(_0x280e38,_0x53f78d){_0x280e38=_0x280e38-0x0;var _0x45e18b=_0x53ec[_0x280e38];return _0x45e18b;};'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')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +var _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x4b2b96,_0x3e322b){var _0xcd766a=function(_0x579b03){while(--_0x579b03){_0x4b2b96['push'](_0x4b2b96['shift']());}};_0xcd766a(++_0x3e322b);}(_0x1261,0x144));var _0x1126=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0x1261[_0x28c939];return _0x527fe9;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index f9d134d..ea6a9f1 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 _0x24ca=['sequelize','STRING','VIRTUAL','savePath','substring','lastIndexOf'];(function(_0x53e0cf,_0x13a26a){var _0x6e4836=function(_0x28984d){while(--_0x28984d){_0x53e0cf['push'](_0x53e0cf['shift']());}};_0x6e4836(++_0x13a26a);}(_0x24ca,0x1bc));var _0xa24c=function(_0x204ad4,_0x502841){_0x204ad4=_0x204ad4-0x0;var _0x50675f=_0x24ca[_0x204ad4];return _0x50675f;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'callerid':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'dnid':{'type':Sequelize[_0xa24c('0x1')]},'projectName':{'type':Sequelize[_0xa24c('0x1')]},'saveName':{'type':Sequelize[_0xa24c('0x1')]},'filename':{'type':Sequelize[_0xa24c('0x1')]},'savePath':{'type':Sequelize[_0xa24c('0x1')]},'format':{'type':Sequelize[_0xa24c('0x2')],'get':function(){var _0x257264='';var _0x9a5013=this['getDataValue'](_0xa24c('0x3'));if(_0x9a5013){_0x257264=_0x9a5013[_0xa24c('0x4')](_0x9a5013[_0xa24c('0x5')]('.'));}return _0x257264;}}}; \ No newline at end of file +var _0xb458=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x24f827,_0x562d19){var _0x2ae659=function(_0x281702){while(--_0x281702){_0x24f827['push'](_0x24f827['shift']());}};_0x2ae659(++_0x562d19);}(_0xb458,0x103));var _0x8b45=function(_0x5b834d,_0x41719b){_0x5b834d=_0x5b834d-0x0;var _0x5af488=_0xb458[_0x5b834d];return _0x5af488;};'use strict';var Sequelize=require(_0x8b45('0x0'));module[_0x8b45('0x1')]={'uniqueid':{'type':Sequelize[_0x8b45('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8b45('0x2')]},'extension':{'type':Sequelize[_0x8b45('0x2')]},'priority':{'type':Sequelize[_0x8b45('0x2')]},'accountcode':{'type':Sequelize[_0x8b45('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x8b45('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x8b45('0x2')]},'format':{'type':Sequelize[_0x8b45('0x3')],'get':function(){var _0x2daa9a='';var _0x3a8ccb=this[_0x8b45('0x4')]('savePath');if(_0x3a8ccb){_0x2daa9a=_0x3a8ccb[_0x8b45('0x5')](_0x3a8ccb[_0x8b45('0x6')]('.'));}return _0x2daa9a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index fe9f79d..4e4841a 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 _0x1846=['SquareRecording\x20not\x20found','download','extname','unlink','message','send','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','savePath','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','end','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','sendStatus','stack','name','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','find','../../components/encryptor','uniqueid','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize'];(function(_0x972399,_0x528207){var _0x2a00bd=function(_0x2faf4b){while(--_0x2faf4b){_0x972399['push'](_0x972399['shift']());}};_0x2a00bd(++_0x528207);}(_0x1846,0x71));var _0x6184=function(_0x33f685,_0x4e971f){_0x33f685=_0x33f685-0x0;var _0x150be3=_0x1846[_0x33f685];return _0x150be3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6184('0x0'));var zipdir=require(_0x6184('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6184('0x2'));var moment=require('moment');var BPromise=require(_0x6184('0x3'));var Mustache=require(_0x6184('0x4'));var util=require(_0x6184('0x5'));var path=require(_0x6184('0x6'));var sox=require(_0x6184('0x7'));var csv=require(_0x6184('0x8'));var ejs=require(_0x6184('0x9'));var fs=require('fs');var fs_extra=require(_0x6184('0xa'));var _=require(_0x6184('0xb'));var squel=require('squel');var crypto=require(_0x6184('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6184('0xd'));var toCsv=require(_0x6184('0x8'));var querystring=require(_0x6184('0xe'));var Papa=require(_0x6184('0xf'));var Redis=require(_0x6184('0x10'));var authService=require(_0x6184('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6184('0x12'));var hardwareService=require(_0x6184('0x13'));var logger=require(_0x6184('0x14'))(_0x6184('0x15'));var utils=require(_0x6184('0x16'));var config=require(_0x6184('0x17'));var licenseUtil=require(_0x6184('0x18'));var db=require(_0x6184('0x19'))['db'];function respondWithStatusCode(_0x24c5b4,_0x501b26){_0x501b26=_0x501b26||0xcc;return function(_0xed9160){if(_0xed9160){return _0x24c5b4['sendStatus'](_0x501b26);}return _0x24c5b4[_0x6184('0x1a')](_0x501b26)['end']();};}function respondWithResult(_0x5ca8d6,_0x507a8d){_0x507a8d=_0x507a8d||0xc8;return function(_0x1b06b4){if(_0x1b06b4){return _0x5ca8d6[_0x6184('0x1a')](_0x507a8d)[_0x6184('0x1b')](_0x1b06b4);}};}function respondWithFilteredResult(_0x558345,_0x3e7de2){return function(_0x5755d6){if(_0x5755d6){var _0x1d70ce=typeof _0x3e7de2[_0x6184('0x1c')]===_0x6184('0x1d')&&typeof _0x3e7de2[_0x6184('0x1e')]===_0x6184('0x1d');var _0x378802=_0x5755d6[_0x6184('0x1f')];var _0x574583=_0x1d70ce?0x0:_0x3e7de2[_0x6184('0x1c')];var _0xac3398=_0x1d70ce?_0x5755d6[_0x6184('0x1f')]:_0x3e7de2[_0x6184('0x1c')]+_0x3e7de2[_0x6184('0x1e')];var _0x364a1d;if(_0xac3398>=_0x378802){_0xac3398=_0x378802;_0x364a1d=0xc8;}else{_0x364a1d=0xce;}_0x558345[_0x6184('0x1a')](_0x364a1d);return _0x558345[_0x6184('0x20')](_0x6184('0x21'),_0x574583+'-'+_0xac3398+'/'+_0x378802)['json'](_0x5755d6);}return null;};}function patchUpdates(_0xef70c){return function(_0x56fc17){try{jsonpatch[_0x6184('0x22')](_0x56fc17,_0xef70c,!![]);}catch(_0x5229d0){return BPromise['reject'](_0x5229d0);}return _0x56fc17[_0x6184('0x23')]();};}function saveUpdates(_0x3cc4ed,_0xbd695a){return function(_0x596bdc){if(_0x596bdc){return _0x596bdc[_0x6184('0x24')](_0x3cc4ed)[_0x6184('0x25')](function(_0x4c511d){return _0x4c511d;});}return null;};}function removeEntity(_0x3c105e,_0x1c6eaf){return function(_0x23f306){if(_0x23f306){return _0x23f306['destroy']()[_0x6184('0x25')](function(){_0x3c105e[_0x6184('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7bac,_0x57db01){return function(_0x4e4f5f){if(!_0x4e4f5f){_0x4a7bac[_0x6184('0x26')](0x194);}return _0x4e4f5f;};}function handleError(_0x1257bb,_0x3da8fc){_0x3da8fc=_0x3da8fc||0x1f4;return function(_0x3159af){logger['error'](_0x3159af[_0x6184('0x27')]);if(_0x3159af[_0x6184('0x28')]){delete _0x3159af[_0x6184('0x28')];}_0x1257bb[_0x6184('0x1a')](_0x3da8fc)['send'](_0x3159af);};}exports['index']=function(_0x39938e,_0x4280fa){var _0x4cf32b={},_0x58872d={},_0x60b2dd={'count':0x0,'rows':[]};var _0x19e79d=_['map'](db[_0x6184('0x29')][_0x6184('0x2a')],function(_0x5db6cb){return{'name':_0x5db6cb[_0x6184('0x2b')],'type':_0x5db6cb[_0x6184('0x2c')][_0x6184('0x2d')]};});_0x58872d[_0x6184('0x2e')]=_[_0x6184('0x2f')](_0x19e79d,_0x6184('0x28'));_0x58872d[_0x6184('0x30')]=_['keys'](_0x39938e[_0x6184('0x30')]);_0x58872d[_0x6184('0x31')]=_[_0x6184('0x32')](_0x58872d[_0x6184('0x2e')],_0x58872d[_0x6184('0x30')]);_0x4cf32b[_0x6184('0x33')]=_[_0x6184('0x32')](_0x58872d[_0x6184('0x2e')],qs[_0x6184('0x34')](_0x39938e[_0x6184('0x30')][_0x6184('0x34')]));_0x4cf32b[_0x6184('0x33')]=_0x4cf32b[_0x6184('0x33')][_0x6184('0x35')]?_0x4cf32b[_0x6184('0x33')]:_0x58872d[_0x6184('0x2e')];if(!_0x39938e['query'][_0x6184('0x36')]('nolimit')){_0x4cf32b[_0x6184('0x1e')]=qs[_0x6184('0x1e')](_0x39938e[_0x6184('0x30')][_0x6184('0x1e')]);_0x4cf32b['offset']=qs[_0x6184('0x1c')](_0x39938e[_0x6184('0x30')][_0x6184('0x1c')]);}_0x4cf32b[_0x6184('0x37')]=qs[_0x6184('0x38')](_0x39938e['query']['sort']);_0x4cf32b[_0x6184('0x39')]=qs[_0x6184('0x31')](_[_0x6184('0x3a')](_0x39938e[_0x6184('0x30')],_0x58872d[_0x6184('0x31')]),_0x19e79d);if(_0x39938e[_0x6184('0x30')]['filter']){_0x4cf32b[_0x6184('0x39')]=_['merge'](_0x4cf32b['where'],{'$or':_[_0x6184('0x2f')](_0x19e79d,function(_0x1670d4){if(_0x1670d4['type']!==_0x6184('0x3b')){var _0xfe0700={};_0xfe0700[_0x1670d4[_0x6184('0x28')]]={'$like':'%'+_0x39938e[_0x6184('0x30')]['filter']+'%'};return _0xfe0700;}})});}_0x4cf32b=_[_0x6184('0x3c')]({},_0x4cf32b,_0x39938e[_0x6184('0x3d')]);var _0x274f1b={'where':_0x4cf32b[_0x6184('0x39')]};return db[_0x6184('0x29')][_0x6184('0x1f')](_0x274f1b)[_0x6184('0x25')](function(_0x3e1c10){_0x60b2dd[_0x6184('0x1f')]=_0x3e1c10;if(_0x39938e['query'][_0x6184('0x3e')]){_0x4cf32b['include']=[{'all':!![]}];}return db[_0x6184('0x29')][_0x6184('0x3f')](_0x4cf32b);})[_0x6184('0x25')](function(_0x2d72af){_0x60b2dd[_0x6184('0x40')]=_0x2d72af;return _0x60b2dd;})['then'](respondWithFilteredResult(_0x4280fa,_0x4cf32b))[_0x6184('0x41')](handleError(_0x4280fa,null));};exports[_0x6184('0x42')]=function(_0x515581,_0x23882e){var _0x402eaf={'raw':!![],'where':{'id':_0x515581[_0x6184('0x43')]['id']}},_0x52bbe2={};_0x52bbe2[_0x6184('0x2e')]=_[_0x6184('0x44')](db[_0x6184('0x29')]['rawAttributes']);_0x52bbe2['query']=_[_0x6184('0x44')](_0x515581[_0x6184('0x30')]);_0x52bbe2[_0x6184('0x31')]=_[_0x6184('0x32')](_0x52bbe2[_0x6184('0x2e')],_0x52bbe2[_0x6184('0x30')]);_0x402eaf[_0x6184('0x33')]=_[_0x6184('0x32')](_0x52bbe2[_0x6184('0x2e')],qs[_0x6184('0x34')](_0x515581['query'][_0x6184('0x34')]));_0x402eaf[_0x6184('0x33')]=_0x402eaf['attributes']['length']?_0x402eaf[_0x6184('0x33')]:_0x52bbe2[_0x6184('0x2e')];if(_0x515581[_0x6184('0x30')][_0x6184('0x3e')]){_0x402eaf[_0x6184('0x45')]=[{'all':!![]}];}_0x402eaf=_['merge']({},_0x402eaf,_0x515581[_0x6184('0x3d')]);return db[_0x6184('0x29')]['find'](_0x402eaf)[_0x6184('0x25')](handleEntityNotFound(_0x23882e,null))['then'](respondWithResult(_0x23882e,null))[_0x6184('0x41')](handleError(_0x23882e,null));};exports[_0x6184('0x46')]=function(_0x4d3b87,_0xa64294){return db[_0x6184('0x29')][_0x6184('0x46')](_0x4d3b87[_0x6184('0x47')],{})[_0x6184('0x25')](respondWithResult(_0xa64294,0xc9))[_0x6184('0x41')](handleError(_0xa64294,null));};exports[_0x6184('0x24')]=function(_0xa97b8f,_0x5e6f06){if(_0xa97b8f['body']['id']){delete _0xa97b8f[_0x6184('0x47')]['id'];}return db[_0x6184('0x29')][_0x6184('0x48')]({'where':{'id':_0xa97b8f[_0x6184('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e6f06,null))[_0x6184('0x25')](saveUpdates(_0xa97b8f[_0x6184('0x47')],null))[_0x6184('0x25')](respondWithResult(_0x5e6f06,null))[_0x6184('0x41')](handleError(_0x5e6f06,null));};exports['download']=function(_0x14def5,_0x4d532b,_0x434a92){var _0x34a371=require(_0x6184('0x49'));var _0x18b28f=![];var _0x20de8e={};if(_0x14def5['query']['type']&&_0x14def5[_0x6184('0x30')][_0x6184('0x2c')]==='uniqueid'){_0x20de8e[_0x6184('0x4a')]=_0x14def5[_0x6184('0x43')]['id'];}else{_0x20de8e['id']=_0x14def5['params']['id'];}return db[_0x6184('0x29')][_0x6184('0x48')]({'where':_0x20de8e,'attributes':['id','savePath',_0x6184('0x4b')],'raw':!![]})[_0x6184('0x25')](handleEntityNotFound(_0x4d532b,null))['then'](function(_0x204ef8){if(_0x204ef8){var _0x57da7d=_0x204ef8['savePath'];var _0x1c5e01=util[_0x6184('0x4c')](_0x6184('0x4d'),_0x57da7d);if(fs[_0x6184('0x4e')](_0x1c5e01)){_0x18b28f=!![];return _0x34a371[_0x6184('0x4f')](_0x1c5e01,_0x57da7d,config[_0x6184('0x50')][_0x6184('0x51')])[_0x6184('0x25')](function(){return _0x204ef8;});}return _0x204ef8;}})['then'](function(_0x32a8c2){if(_0x32a8c2){var _0x13c20c=_0x32a8c2['savePath'];if(!fs[_0x6184('0x4e')](_0x13c20c)){throw new db[(_0x6184('0x52'))]['ValidationError'](_0x6184('0x53'));}if(_0x32a8c2['filename']){return _0x4d532b[_0x6184('0x54')](_0x13c20c,_0x32a8c2['filename']+path[_0x6184('0x55')](_0x13c20c),function(){if(_0x18b28f){fs[_0x6184('0x56')](_0x13c20c);}});}else{return _0x4d532b['download'](_0x13c20c,function(_0x2f0978){if(_0x18b28f){fs[_0x6184('0x56')](_0x13c20c);}});}}})[_0x6184('0x41')](function(_0x3a4bc8){if(_0x3a4bc8[_0x6184('0x57')]===_0x6184('0x53')){_0x4d532b[_0x6184('0x1a')](0x194)[_0x6184('0x58')]('Not\x20found');}else{return handleError(_0x4d532b,null);}});};exports['destroy']=function(_0x47a92c,_0x16453c){return db[_0x6184('0x29')][_0x6184('0x48')]({'where':{'id':_0x47a92c[_0x6184('0x43')]['id']}})[_0x6184('0x25')](function(_0x55cec1){if(_['isNil'](_0x55cec1)){throw new ReferenceError(_0x6184('0x59'));}return _0x55cec1;})[_0x6184('0x25')](function(_0x280d79){var _0x2eed4f=_0x280d79['savePath'];logger[_0x6184('0x5a')](_0x6184('0x5b'),_0x2eed4f);if(!_[_0x6184('0x5c')](_0x280d79['savePath'])&&fs[_0x6184('0x4e')](_0x2eed4f)){logger['info'](_0x6184('0x5d')+_0x2eed4f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6184('0x5e')](_0x2eed4f);}_0x2eed4f=_0x2eed4f+'.cypher';if(!_[_0x6184('0x5c')](_0x280d79[_0x6184('0x5f')])&&fs['existsSync'](_0x2eed4f)){logger[_0x6184('0x5a')](_0x6184('0x5d')+_0x2eed4f+_0x6184('0x60'));fs['unlinkSync'](_0x2eed4f);}return _0x280d79;})[_0x6184('0x25')](function(_0x4643ee){if(!_0x4643ee)throw new InternalError();return _0x4643ee['destroy']();})[_0x6184('0x25')](function(){_0x16453c['status'](0xcc)[_0x6184('0x61')]();})[_0x6184('0x41')](handleError(_0x16453c,null));}; \ No newline at end of file +var _0x9543=['options','SquareRecording','includeAll','findAll','params','find','catch','create','body','../../components/encryptor','uniqueid','format','existsSync','secrets','recording','savePath','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','end','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','model','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','query','order','sort','where','filters','filter','merge','map','VIRTUAL'];(function(_0x576319,_0x5471f9){var _0x34afc3=function(_0x192df8){while(--_0x192df8){_0x576319['push'](_0x576319['shift']());}};_0x34afc3(++_0x5471f9);}(_0x9543,0xe1));var _0x3954=function(_0x52ce2c,_0x51d527){_0x52ce2c=_0x52ce2c-0x0;var _0x292ab7=_0x9543[_0x52ce2c];return _0x292ab7;};'use strict';var emlformat=require(_0x3954('0x0'));var rimraf=require(_0x3954('0x1'));var zipdir=require(_0x3954('0x2'));var jsonpatch=require(_0x3954('0x3'));var rp=require(_0x3954('0x4'));var moment=require(_0x3954('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3954('0x6'));var util=require(_0x3954('0x7'));var path=require(_0x3954('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3954('0x9'));var _=require('lodash');var squel=require(_0x3954('0xa'));var crypto=require(_0x3954('0xb'));var jsforce=require(_0x3954('0xc'));var deskjs=require(_0x3954('0xd'));var toCsv=require(_0x3954('0xe'));var querystring=require(_0x3954('0xf'));var Papa=require(_0x3954('0x10'));var Redis=require(_0x3954('0x11'));var authService=require(_0x3954('0x12'));var qs=require(_0x3954('0x13'));var as=require(_0x3954('0x14'));var hardwareService=require(_0x3954('0x15'));var logger=require(_0x3954('0x16'))(_0x3954('0x17'));var utils=require(_0x3954('0x18'));var config=require(_0x3954('0x19'));var licenseUtil=require(_0x3954('0x1a'));var db=require(_0x3954('0x1b'))['db'];function respondWithStatusCode(_0x2d2971,_0x4c0b00){_0x4c0b00=_0x4c0b00||0xcc;return function(_0x4f0e66){if(_0x4f0e66){return _0x2d2971[_0x3954('0x1c')](_0x4c0b00);}return _0x2d2971[_0x3954('0x1d')](_0x4c0b00)['end']();};}function respondWithResult(_0x33077c,_0x300ef4){_0x300ef4=_0x300ef4||0xc8;return function(_0x2b52eb){if(_0x2b52eb){return _0x33077c[_0x3954('0x1d')](_0x300ef4)[_0x3954('0x1e')](_0x2b52eb);}};}function respondWithFilteredResult(_0xc6208d,_0x1f8a2b){return function(_0x42a6e1){if(_0x42a6e1){var _0x500704=typeof _0x1f8a2b[_0x3954('0x1f')]===_0x3954('0x20')&&typeof _0x1f8a2b[_0x3954('0x21')]===_0x3954('0x20');var _0x5a6cf9=_0x42a6e1[_0x3954('0x22')];var _0x1b8128=_0x500704?0x0:_0x1f8a2b['offset'];var _0x27745e=_0x500704?_0x42a6e1[_0x3954('0x22')]:_0x1f8a2b[_0x3954('0x1f')]+_0x1f8a2b['limit'];var _0x5c2e3b;if(_0x27745e>=_0x5a6cf9){_0x27745e=_0x5a6cf9;_0x5c2e3b=0xc8;}else{_0x5c2e3b=0xce;}_0xc6208d['status'](_0x5c2e3b);return _0xc6208d['set']('Content-Range',_0x1b8128+'-'+_0x27745e+'/'+_0x5a6cf9)[_0x3954('0x1e')](_0x42a6e1);}return null;};}function patchUpdates(_0x490aec){return function(_0x15b6c9){try{jsonpatch['apply'](_0x15b6c9,_0x490aec,!![]);}catch(_0x475590){return BPromise['reject'](_0x475590);}return _0x15b6c9[_0x3954('0x23')]();};}function saveUpdates(_0x4e7f6b,_0x2867e7){return function(_0x224bbb){if(_0x224bbb){return _0x224bbb[_0x3954('0x24')](_0x4e7f6b)[_0x3954('0x25')](function(_0x16892d){return _0x16892d;});}return null;};}function removeEntity(_0x55dcd3,_0x3700c5){return function(_0x2ef3c5){if(_0x2ef3c5){return _0x2ef3c5[_0x3954('0x26')]()['then'](function(){_0x55dcd3[_0x3954('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d0776,_0x5a6be3){return function(_0x42aaec){if(!_0x42aaec){_0x2d0776[_0x3954('0x1c')](0x194);}return _0x42aaec;};}function handleError(_0x12601f,_0x3d365a){_0x3d365a=_0x3d365a||0x1f4;return function(_0x3595f2){logger[_0x3954('0x27')](_0x3595f2[_0x3954('0x28')]);if(_0x3595f2['name']){delete _0x3595f2[_0x3954('0x29')];}_0x12601f[_0x3954('0x1d')](_0x3d365a)[_0x3954('0x2a')](_0x3595f2);};}exports[_0x3954('0x2b')]=function(_0x313228,_0x462cb6){var _0x31f66b={},_0x16eeb6={},_0x5622e8={'count':0x0,'rows':[]};var _0x7a173b=_['map'](db['SquareRecording'][_0x3954('0x2c')],function(_0x878cec){return{'name':_0x878cec['fieldName'],'type':_0x878cec[_0x3954('0x2d')]['key']};});_0x16eeb6[_0x3954('0x2e')]=_['map'](_0x7a173b,_0x3954('0x29'));_0x16eeb6['query']=_[_0x3954('0x2f')](_0x313228['query']);_0x16eeb6['filters']=_[_0x3954('0x30')](_0x16eeb6['model'],_0x16eeb6['query']);_0x31f66b['attributes']=_[_0x3954('0x30')](_0x16eeb6[_0x3954('0x2e')],qs['fields'](_0x313228['query'][_0x3954('0x31')]));_0x31f66b[_0x3954('0x32')]=_0x31f66b[_0x3954('0x32')][_0x3954('0x33')]?_0x31f66b['attributes']:_0x16eeb6['model'];if(!_0x313228['query'][_0x3954('0x34')](_0x3954('0x35'))){_0x31f66b[_0x3954('0x21')]=qs['limit'](_0x313228['query'][_0x3954('0x21')]);_0x31f66b[_0x3954('0x1f')]=qs[_0x3954('0x1f')](_0x313228[_0x3954('0x36')][_0x3954('0x1f')]);}_0x31f66b[_0x3954('0x37')]=qs[_0x3954('0x38')](_0x313228[_0x3954('0x36')]['sort']);_0x31f66b[_0x3954('0x39')]=qs[_0x3954('0x3a')](_['pick'](_0x313228['query'],_0x16eeb6[_0x3954('0x3a')]),_0x7a173b);if(_0x313228['query'][_0x3954('0x3b')]){_0x31f66b[_0x3954('0x39')]=_[_0x3954('0x3c')](_0x31f66b[_0x3954('0x39')],{'$or':_[_0x3954('0x3d')](_0x7a173b,function(_0x257904){if(_0x257904[_0x3954('0x2d')]!==_0x3954('0x3e')){var _0x408b19={};_0x408b19[_0x257904[_0x3954('0x29')]]={'$like':'%'+_0x313228[_0x3954('0x36')][_0x3954('0x3b')]+'%'};return _0x408b19;}})});}_0x31f66b=_[_0x3954('0x3c')]({},_0x31f66b,_0x313228[_0x3954('0x3f')]);var _0x1c06a9={'where':_0x31f66b[_0x3954('0x39')]};return db[_0x3954('0x40')][_0x3954('0x22')](_0x1c06a9)[_0x3954('0x25')](function(_0x200a29){_0x5622e8[_0x3954('0x22')]=_0x200a29;if(_0x313228[_0x3954('0x36')][_0x3954('0x41')]){_0x31f66b['include']=[{'all':!![]}];}return db[_0x3954('0x40')][_0x3954('0x42')](_0x31f66b);})[_0x3954('0x25')](function(_0x20b73f){_0x5622e8['rows']=_0x20b73f;return _0x5622e8;})[_0x3954('0x25')](respondWithFilteredResult(_0x462cb6,_0x31f66b))['catch'](handleError(_0x462cb6,null));};exports['show']=function(_0x342842,_0x516699){var _0xfb8810={'raw':!![],'where':{'id':_0x342842[_0x3954('0x43')]['id']}},_0x17c9db={};_0x17c9db['model']=_[_0x3954('0x2f')](db['SquareRecording'][_0x3954('0x2c')]);_0x17c9db[_0x3954('0x36')]=_[_0x3954('0x2f')](_0x342842[_0x3954('0x36')]);_0x17c9db[_0x3954('0x3a')]=_['intersection'](_0x17c9db[_0x3954('0x2e')],_0x17c9db[_0x3954('0x36')]);_0xfb8810[_0x3954('0x32')]=_[_0x3954('0x30')](_0x17c9db[_0x3954('0x2e')],qs[_0x3954('0x31')](_0x342842['query'][_0x3954('0x31')]));_0xfb8810['attributes']=_0xfb8810['attributes']['length']?_0xfb8810[_0x3954('0x32')]:_0x17c9db['model'];if(_0x342842[_0x3954('0x36')][_0x3954('0x41')]){_0xfb8810['include']=[{'all':!![]}];}_0xfb8810=_[_0x3954('0x3c')]({},_0xfb8810,_0x342842['options']);return db[_0x3954('0x40')][_0x3954('0x44')](_0xfb8810)[_0x3954('0x25')](handleEntityNotFound(_0x516699,null))[_0x3954('0x25')](respondWithResult(_0x516699,null))[_0x3954('0x45')](handleError(_0x516699,null));};exports[_0x3954('0x46')]=function(_0x40654f,_0x38d678){return db['SquareRecording'][_0x3954('0x46')](_0x40654f[_0x3954('0x47')],{})[_0x3954('0x25')](respondWithResult(_0x38d678,0xc9))[_0x3954('0x45')](handleError(_0x38d678,null));};exports[_0x3954('0x24')]=function(_0x28b9a9,_0x47de23){if(_0x28b9a9['body']['id']){delete _0x28b9a9[_0x3954('0x47')]['id'];}return db['SquareRecording'][_0x3954('0x44')]({'where':{'id':_0x28b9a9['params']['id']}})['then'](handleEntityNotFound(_0x47de23,null))[_0x3954('0x25')](saveUpdates(_0x28b9a9[_0x3954('0x47')],null))[_0x3954('0x25')](respondWithResult(_0x47de23,null))[_0x3954('0x45')](handleError(_0x47de23,null));};exports['download']=function(_0x1eda28,_0x3569ec,_0x48e917){var _0xb46343=require(_0x3954('0x48'));var _0x15a2a2=![];var _0x202618={};if(_0x1eda28['query']['type']&&_0x1eda28['query'][_0x3954('0x2d')]===_0x3954('0x49')){_0x202618['uniqueid']=_0x1eda28['params']['id'];}else{_0x202618['id']=_0x1eda28[_0x3954('0x43')]['id'];}return db[_0x3954('0x40')][_0x3954('0x44')]({'where':_0x202618,'attributes':['id','savePath','filename'],'raw':!![]})[_0x3954('0x25')](handleEntityNotFound(_0x3569ec,null))[_0x3954('0x25')](function(_0x342a56){if(_0x342a56){var _0x59abd9=_0x342a56['savePath'];var _0x2bce3b=util[_0x3954('0x4a')]('%s.cypher',_0x59abd9);if(fs[_0x3954('0x4b')](_0x2bce3b)){_0x15a2a2=!![];return _0xb46343['decryptFile'](_0x2bce3b,_0x59abd9,config[_0x3954('0x4c')][_0x3954('0x4d')])['then'](function(){return _0x342a56;});}return _0x342a56;}})['then'](function(_0x45b3e4){if(_0x45b3e4){var _0x46701b=_0x45b3e4[_0x3954('0x4e')];if(!fs[_0x3954('0x4b')](_0x46701b)){throw new db[(_0x3954('0x4f'))][(_0x3954('0x50'))](_0x3954('0x51'));}if(_0x45b3e4[_0x3954('0x52')]){return _0x3569ec['download'](_0x46701b,_0x45b3e4[_0x3954('0x52')]+path[_0x3954('0x53')](_0x46701b),function(){if(_0x15a2a2){fs[_0x3954('0x54')](_0x46701b);}});}else{return _0x3569ec[_0x3954('0x55')](_0x46701b,function(_0x42387e){if(_0x15a2a2){fs['unlink'](_0x46701b);}});}}})['catch'](function(_0x5a6eec){if(_0x5a6eec[_0x3954('0x56')]==='SquareRecording\x20not\x20found'){_0x3569ec[_0x3954('0x1d')](0x194)[_0x3954('0x2a')](_0x3954('0x57'));}else{return handleError(_0x3569ec,null);}});};exports[_0x3954('0x26')]=function(_0x2d1acc,_0x26237c){return db[_0x3954('0x40')][_0x3954('0x44')]({'where':{'id':_0x2d1acc[_0x3954('0x43')]['id']}})[_0x3954('0x25')](function(_0x423b1d){if(_[_0x3954('0x58')](_0x423b1d)){throw new ReferenceError(_0x3954('0x59'));}return _0x423b1d;})[_0x3954('0x25')](function(_0x4503db){var _0x337559=_0x4503db[_0x3954('0x4e')];logger[_0x3954('0x5a')](_0x3954('0x5b'),_0x337559);if(!_['isNil'](_0x4503db[_0x3954('0x4e')])&&fs['existsSync'](_0x337559)){logger['info'](_0x3954('0x5c')+_0x337559+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3954('0x5d')](_0x337559);}_0x337559=_0x337559+_0x3954('0x5e');if(!_[_0x3954('0x58')](_0x4503db[_0x3954('0x4e')])&&fs[_0x3954('0x4b')](_0x337559)){logger['info'](_0x3954('0x5c')+_0x337559+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3954('0x5d')](_0x337559);}return _0x4503db;})[_0x3954('0x25')](function(_0x5eabdf){if(!_0x5eabdf)throw new InternalError();return _0x5eabdf['destroy']();})[_0x3954('0x25')](function(){_0x26237c[_0x3954('0x1d')](0xcc)[_0x3954('0x5f')]();})[_0x3954('0x45')](handleError(_0x26237c,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 19a9ab1..f9656f5 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 _0x9af6=['square_recordings','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./squareRecording.attributes','define','SquareRecording'];(function(_0xfe4ee0,_0x44df2f){var _0x519cd7=function(_0x197579){while(--_0x197579){_0xfe4ee0['push'](_0xfe4ee0['shift']());}};_0x519cd7(++_0x44df2f);}(_0x9af6,0x1d7));var _0x69af=function(_0x33c049,_0x3bc812){_0x33c049=_0x33c049-0x0;var _0x405eb2=_0x9af6[_0x33c049];return _0x405eb2;};'use strict';var _=require(_0x69af('0x0'));var util=require(_0x69af('0x1'));var logger=require(_0x69af('0x2'))('api');var moment=require('moment');var BPromise=require(_0x69af('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x69af('0x4'));var config=require(_0x69af('0x5'));var attributes=require(_0x69af('0x6'));module['exports']=function(_0x3848c6,_0x54e2f1){return _0x3848c6[_0x69af('0x7')](_0x69af('0x8'),attributes,{'tableName':_0x69af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2015=['api','moment','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2015,0x193));var _0x5201=function(_0x21b9d1,_0x3b55f7){_0x21b9d1=_0x21b9d1-0x0;var _0x26362e=_0x2015[_0x21b9d1];return _0x26362e;};'use strict';var _=require(_0x5201('0x0'));var util=require(_0x5201('0x1'));var logger=require(_0x5201('0x2'))(_0x5201('0x3'));var moment=require(_0x5201('0x4'));var BPromise=require(_0x5201('0x5'));var rp=require(_0x5201('0x6'));var fs=require('fs');var path=require(_0x5201('0x7'));var rimraf=require('rimraf');var config=require(_0x5201('0x8'));var attributes=require(_0x5201('0x9'));module[_0x5201('0xa')]=function(_0x10e33b,_0xf013a){return _0x10e33b[_0x5201('0xb')](_0x5201('0xc'),attributes,{'tableName':_0x5201('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 d6158a4..b0a1c3d 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 _0x9cb7=['result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','then','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info'];(function(_0x1d664a,_0x149a34){var _0x335345=function(_0x461fac){while(--_0x461fac){_0x1d664a['push'](_0x1d664a['shift']());}};_0x335345(++_0x149a34);}(_0x9cb7,0x166));var _0x79cb=function(_0x14ff3f,_0x468ed5){_0x14ff3f=_0x14ff3f-0x0;var _0x1dba72=_0x9cb7[_0x14ff3f];return _0x1dba72;};'use strict';var _=require(_0x79cb('0x0'));var util=require('util');var moment=require(_0x79cb('0x1'));var BPromise=require(_0x79cb('0x2'));var rs=require(_0x79cb('0x3'));var fs=require('fs');var Redis=require(_0x79cb('0x4'));var db=require(_0x79cb('0x5'))['db'];var utils=require(_0x79cb('0x6'));var logger=require('../../config/logger')(_0x79cb('0x7'));var config=require(_0x79cb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x79cb('0x9')][_0x79cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x322e30,_0xe75071,_0x498a1a){return new BPromise(function(_0x1f70ea,_0x1649d8){return client[_0x79cb('0xb')](_0x322e30,_0x498a1a)['then'](function(_0x259239){logger['info'](_0x79cb('0xc'),_0xe75071,_0x79cb('0xd'));logger[_0x79cb('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0xe75071,_0x79cb('0xd'),JSON['stringify'](_0x259239));if(_0x259239[_0x79cb('0xf')]){if(_0x259239[_0x79cb('0xf')][_0x79cb('0x10')]===0x1f4){logger[_0x79cb('0xf')](_0x79cb('0xc'),_0xe75071,_0x259239[_0x79cb('0xf')]['message']);return _0x1649d8(_0x259239[_0x79cb('0xf')][_0x79cb('0x11')]);}logger[_0x79cb('0xf')](_0x79cb('0xc'),_0xe75071,_0x259239[_0x79cb('0xf')][_0x79cb('0x11')]);return _0x1f70ea(_0x259239[_0x79cb('0xf')][_0x79cb('0x11')]);}else{logger[_0x79cb('0x12')](_0x79cb('0xc'),_0xe75071,_0x79cb('0xd'));_0x1f70ea(_0x259239[_0x79cb('0x13')][_0x79cb('0x11')]);}})[_0x79cb('0x14')](function(_0x5e4e2a){logger[_0x79cb('0xf')](_0x79cb('0xc'),_0xe75071,_0x5e4e2a);_0x1649d8(_0x5e4e2a);});});}exports[_0x79cb('0x15')]=function(_0x52e475){var _0x27a842=this;return new Promise(function(_0x479fd7,_0x504a5c){return db[_0x79cb('0x16')][_0x79cb('0x17')](_0x52e475[_0x79cb('0x18')],{'raw':_0x52e475[_0x79cb('0x19')]?_0x52e475['options'][_0x79cb('0x1a')]===undefined?!![]:![]:!![]})[_0x79cb('0x1b')](function(_0x52cc72){logger[_0x79cb('0x12')](_0x79cb('0x15'),_0x52e475);logger['debug'](_0x79cb('0x15'),_0x52e475,JSON[_0x79cb('0x1c')](_0x52cc72));_0x479fd7(_0x52cc72);})[_0x79cb('0x14')](function(_0x53e498){logger[_0x79cb('0xf')](_0x79cb('0x15'),_0x53e498['message'],_0x52e475);_0x504a5c(_0x27a842[_0x79cb('0xf')](0x1f4,_0x53e498[_0x79cb('0x11')]));});});}; \ No newline at end of file +var _0xc98b=['request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SquareRecording','create','options','CreateSquareRecording','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x4fa63d,_0x4d5bca){var _0x4bd8bb=function(_0x37a2c9){while(--_0x37a2c9){_0x4fa63d['push'](_0x4fa63d['shift']());}};_0x4bd8bb(++_0x4d5bca);}(_0xc98b,0x1a6));var _0xbc98=function(_0x3e530f,_0x7ab0e3){_0x3e530f=_0x3e530f-0x0;var _0x58385e=_0xc98b[_0x3e530f];return _0x58385e;};'use strict';var _=require('lodash');var util=require(_0xbc98('0x0'));var moment=require(_0xbc98('0x1'));var BPromise=require(_0xbc98('0x2'));var rs=require(_0xbc98('0x3'));var fs=require('fs');var Redis=require(_0xbc98('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc98('0x5'));var logger=require(_0xbc98('0x6'))(_0xbc98('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbc98('0x8')][_0xbc98('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20b32a,_0x396b47,_0x174340){return new BPromise(function(_0x1fd46c,_0x4c8d11){return client[_0xbc98('0xa')](_0x20b32a,_0x174340)[_0xbc98('0xb')](function(_0x1bcf24){logger[_0xbc98('0xc')](_0xbc98('0xd'),_0x396b47,_0xbc98('0xe'));logger['debug'](_0xbc98('0xf'),_0x396b47,'request\x20sent',JSON['stringify'](_0x1bcf24));if(_0x1bcf24['error']){if(_0x1bcf24[_0xbc98('0x10')][_0xbc98('0x11')]===0x1f4){logger[_0xbc98('0x10')](_0xbc98('0xd'),_0x396b47,_0x1bcf24[_0xbc98('0x10')]['message']);return _0x4c8d11(_0x1bcf24[_0xbc98('0x10')][_0xbc98('0x12')]);}logger[_0xbc98('0x10')](_0xbc98('0xd'),_0x396b47,_0x1bcf24['error'][_0xbc98('0x12')]);return _0x1fd46c(_0x1bcf24[_0xbc98('0x10')][_0xbc98('0x12')]);}else{logger[_0xbc98('0xc')]('SquareRecording,\x20%s,\x20%s',_0x396b47,_0xbc98('0xe'));_0x1fd46c(_0x1bcf24[_0xbc98('0x13')]['message']);}})[_0xbc98('0x14')](function(_0x445eba){logger[_0xbc98('0x10')](_0xbc98('0xd'),_0x396b47,_0x445eba);_0x4c8d11(_0x445eba);});});}exports['CreateSquareRecording']=function(_0x2dc3ae){var _0x195f5e=this;return new Promise(function(_0x357a75,_0x52c7bc){return db[_0xbc98('0x15')][_0xbc98('0x16')](_0x2dc3ae['body'],{'raw':_0x2dc3ae[_0xbc98('0x17')]?_0x2dc3ae[_0xbc98('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xbc98('0xb')](function(_0x2216a3){logger['info'](_0xbc98('0x18'),_0x2dc3ae);logger[_0xbc98('0x19')](_0xbc98('0x18'),_0x2dc3ae,JSON[_0xbc98('0x1a')](_0x2216a3));_0x357a75(_0x2216a3);})[_0xbc98('0x14')](function(_0x26ed9b){logger[_0xbc98('0x10')](_0xbc98('0x18'),_0x26ed9b[_0xbc98('0x12')],_0x2dc3ae);_0x52c7bc(_0x195f5e['error'](0x1f4,_0x26ed9b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 42a313b..4fa7f0d 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(_0x56562a,_0x256c6b){var _0x3a8880=function(_0x2d588b){while(--_0x2d588b){_0x56562a['push'](_0x56562a['shift']());}};_0x3a8880(++_0x256c6b);}(_0xe706,0xa3));var _0x6e70=function(_0x35dfe6,_0x4244fa){_0x35dfe6=_0x35dfe6-0x0;var _0x59651c=_0xe706[_0x35dfe6];return _0x59651c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1c1169,_0x12dd0a){var _0x3f1b35=function(_0x360868){while(--_0x360868){_0x1c1169['push'](_0x1c1169['shift']());}};_0x3f1b35(++_0x12dd0a);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b6fd3,_0x4af8d4){_0x5b6fd3=_0x5b6fd3-0x0;var _0x75ef1e=_0xb10b[_0x5b6fd3];return _0x75ef1e;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index e8fe2b5..cc69fdd 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 _0x981c=['STRING','DATE','BOOLEAN','exports'];(function(_0x248ed0,_0x369d30){var _0x3091b0=function(_0x123703){while(--_0x123703){_0x248ed0['push'](_0x248ed0['shift']());}};_0x3091b0(++_0x369d30);}(_0x981c,0x16b));var _0xc981=function(_0x4e3376,_0x1f8b1c){_0x4e3376=_0x4e3376-0x0;var _0x5a8e16=_0x981c[_0x4e3376];return _0x5a8e16;};'use strict';var Sequelize=require('sequelize');module[_0xc981('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xc981('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc981('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc981('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xc981('0x1')]},'callerid':{'type':Sequelize[_0xc981('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xc981('0x1')]},'callington':{'type':Sequelize[_0xc981('0x1')]},'callingtns':{'type':Sequelize[_0xc981('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xc981('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xc981('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xc981('0x1')]},'accountcode':{'type':Sequelize[_0xc981('0x1')]},'threadid':{'type':Sequelize[_0xc981('0x1')]},'project_name':{'type':Sequelize[_0xc981('0x1')]},'joinAt':{'type':Sequelize[_0xc981('0x2')]},'leaveAt':{'type':Sequelize[_0xc981('0x2')]},'bot':{'type':Sequelize[_0xc981('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x56b1=['exports','STRING','DATE'];(function(_0x4cedb1,_0x20505d){var _0x1199e5=function(_0xc13726){while(--_0xc13726){_0x4cedb1['push'](_0x4cedb1['shift']());}};_0x1199e5(++_0x20505d);}(_0x56b1,0x8a));var _0x156b=function(_0x1eb2ac,_0x54e08c){_0x1eb2ac=_0x1eb2ac-0x0;var _0x95fda0=_0x56b1[_0x1eb2ac];return _0x95fda0;};'use strict';var Sequelize=require('sequelize');module[_0x156b('0x0')]={'network':{'type':Sequelize[_0x156b('0x1')]},'network_script':{'type':Sequelize[_0x156b('0x1')]},'request':{'type':Sequelize[_0x156b('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x156b('0x1')]},'uniqueid':{'type':Sequelize[_0x156b('0x1')]},'version':{'type':Sequelize[_0x156b('0x1')]},'callerid':{'type':Sequelize[_0x156b('0x1')]},'calleridname':{'type':Sequelize[_0x156b('0x1')]},'callingpres':{'type':Sequelize[_0x156b('0x1')]},'callingani2':{'type':Sequelize[_0x156b('0x1')]},'callington':{'type':Sequelize[_0x156b('0x1')]},'callingtns':{'type':Sequelize[_0x156b('0x1')]},'dnid':{'type':Sequelize[_0x156b('0x1')]},'rdnis':{'type':Sequelize[_0x156b('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x156b('0x1')]},'priority':{'type':Sequelize[_0x156b('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x156b('0x1')]},'threadid':{'type':Sequelize[_0x156b('0x1')]},'project_name':{'type':Sequelize[_0x156b('0x1')]},'joinAt':{'type':Sequelize[_0x156b('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 1de1a0c..cb47567 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 _0xb047=['util','path','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SquareReport','includeAll','findAll','rows','show','params','find','body','catch','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1e3286,_0x29bd72){var _0x4f2d9c=function(_0x17a1b1){while(--_0x17a1b1){_0x1e3286['push'](_0x1e3286['shift']());}};_0x4f2d9c(++_0x29bd72);}(_0xb047,0x11e));var _0x7b04=function(_0x39c760,_0x4daa3d){_0x39c760=_0x39c760-0x0;var _0x472eb3=_0xb047[_0x39c760];return _0x472eb3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b04('0x0'));var zipdir=require(_0x7b04('0x1'));var jsonpatch=require(_0x7b04('0x2'));var rp=require(_0x7b04('0x3'));var moment=require(_0x7b04('0x4'));var BPromise=require(_0x7b04('0x5'));var Mustache=require('mustache');var util=require(_0x7b04('0x6'));var path=require(_0x7b04('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b04('0x8'));var _=require('lodash');var squel=require(_0x7b04('0x9'));var crypto=require(_0x7b04('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7b04('0xb'));var toCsv=require(_0x7b04('0xc'));var querystring=require(_0x7b04('0xd'));var Papa=require(_0x7b04('0xe'));var Redis=require(_0x7b04('0xf'));var authService=require(_0x7b04('0x10'));var qs=require(_0x7b04('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b04('0x12'));var logger=require(_0x7b04('0x13'))(_0x7b04('0x14'));var utils=require('../../config/utils');var config=require(_0x7b04('0x15'));var licenseUtil=require(_0x7b04('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5664c6,_0x15bb33){_0x15bb33=_0x15bb33||0xcc;return function(_0x178df7){if(_0x178df7){return _0x5664c6['sendStatus'](_0x15bb33);}return _0x5664c6[_0x7b04('0x17')](_0x15bb33)['end']();};}function respondWithResult(_0x5f02dc,_0xc1a1dd){_0xc1a1dd=_0xc1a1dd||0xc8;return function(_0x3d30a6){if(_0x3d30a6){return _0x5f02dc[_0x7b04('0x17')](_0xc1a1dd)[_0x7b04('0x18')](_0x3d30a6);}};}function respondWithFilteredResult(_0x19f18c,_0x308ce1){return function(_0x17a50e){if(_0x17a50e){var _0xbd8641=typeof _0x308ce1[_0x7b04('0x19')]===_0x7b04('0x1a')&&typeof _0x308ce1[_0x7b04('0x1b')]==='undefined';var _0xd43c61=_0x17a50e[_0x7b04('0x1c')];var _0x467736=_0xbd8641?0x0:_0x308ce1[_0x7b04('0x19')];var _0x437bfa=_0xbd8641?_0x17a50e['count']:_0x308ce1['offset']+_0x308ce1['limit'];var _0x10d535;if(_0x437bfa>=_0xd43c61){_0x437bfa=_0xd43c61;_0x10d535=0xc8;}else{_0x10d535=0xce;}_0x19f18c[_0x7b04('0x17')](_0x10d535);return _0x19f18c[_0x7b04('0x1d')](_0x7b04('0x1e'),_0x467736+'-'+_0x437bfa+'/'+_0xd43c61)[_0x7b04('0x18')](_0x17a50e);}return null;};}function patchUpdates(_0x4f8b1c){return function(_0x58c821){try{jsonpatch[_0x7b04('0x1f')](_0x58c821,_0x4f8b1c,!![]);}catch(_0x433235){return BPromise[_0x7b04('0x20')](_0x433235);}return _0x58c821['save']();};}function saveUpdates(_0x2eccaa,_0x188a29){return function(_0xfaac62){if(_0xfaac62){return _0xfaac62['update'](_0x2eccaa)[_0x7b04('0x21')](function(_0x53755d){return _0x53755d;});}return null;};}function removeEntity(_0x212fcd,_0x39346b){return function(_0x43dbdb){if(_0x43dbdb){return _0x43dbdb[_0x7b04('0x22')]()[_0x7b04('0x21')](function(){_0x212fcd['status'](0xcc)[_0x7b04('0x23')]();});}};}function handleEntityNotFound(_0x20deb8,_0x4d99e4){return function(_0x2f0060){if(!_0x2f0060){_0x20deb8['sendStatus'](0x194);}return _0x2f0060;};}function handleError(_0x5f3f98,_0x45218a){_0x45218a=_0x45218a||0x1f4;return function(_0x2b764b){logger[_0x7b04('0x24')](_0x2b764b[_0x7b04('0x25')]);if(_0x2b764b[_0x7b04('0x26')]){delete _0x2b764b[_0x7b04('0x26')];}_0x5f3f98[_0x7b04('0x17')](_0x45218a)[_0x7b04('0x27')](_0x2b764b);};}exports[_0x7b04('0x28')]=function(_0x11ea19,_0x264989){var _0x5de254={},_0x26e92c={},_0x3b6128={'count':0x0,'rows':[]};var _0x11ac45=_['map'](db['SquareReport'][_0x7b04('0x29')],function(_0x319a76){return{'name':_0x319a76[_0x7b04('0x2a')],'type':_0x319a76[_0x7b04('0x2b')][_0x7b04('0x2c')]};});_0x26e92c[_0x7b04('0x2d')]=_[_0x7b04('0x2e')](_0x11ac45,_0x7b04('0x26'));_0x26e92c[_0x7b04('0x2f')]=_[_0x7b04('0x30')](_0x11ea19[_0x7b04('0x2f')]);_0x26e92c[_0x7b04('0x31')]=_[_0x7b04('0x32')](_0x26e92c['model'],_0x26e92c[_0x7b04('0x2f')]);_0x5de254[_0x7b04('0x33')]=_[_0x7b04('0x32')](_0x26e92c['model'],qs[_0x7b04('0x34')](_0x11ea19[_0x7b04('0x2f')][_0x7b04('0x34')]));_0x5de254[_0x7b04('0x33')]=_0x5de254[_0x7b04('0x33')][_0x7b04('0x35')]?_0x5de254[_0x7b04('0x33')]:_0x26e92c['model'];if(!_0x11ea19[_0x7b04('0x2f')]['hasOwnProperty'](_0x7b04('0x36'))){_0x5de254[_0x7b04('0x1b')]=qs['limit'](_0x11ea19[_0x7b04('0x2f')][_0x7b04('0x1b')]);_0x5de254['offset']=qs[_0x7b04('0x19')](_0x11ea19[_0x7b04('0x2f')][_0x7b04('0x19')]);}_0x5de254['order']=qs[_0x7b04('0x37')](_0x11ea19[_0x7b04('0x2f')][_0x7b04('0x37')]);_0x5de254[_0x7b04('0x38')]=qs[_0x7b04('0x31')](_[_0x7b04('0x39')](_0x11ea19[_0x7b04('0x2f')],_0x26e92c[_0x7b04('0x31')]),_0x11ac45);if(_0x11ea19[_0x7b04('0x2f')][_0x7b04('0x3a')]){_0x5de254[_0x7b04('0x38')]=_[_0x7b04('0x3b')](_0x5de254[_0x7b04('0x38')],{'$or':_[_0x7b04('0x2e')](_0x11ac45,function(_0x41af19){if(_0x41af19[_0x7b04('0x2b')]!==_0x7b04('0x3c')){var _0x879b70={};_0x879b70[_0x41af19[_0x7b04('0x26')]]={'$like':'%'+_0x11ea19[_0x7b04('0x2f')][_0x7b04('0x3a')]+'%'};return _0x879b70;}})});}_0x5de254=_[_0x7b04('0x3b')]({},_0x5de254,_0x11ea19[_0x7b04('0x3d')]);var _0x8ad221={'where':_0x5de254[_0x7b04('0x38')]};return db[_0x7b04('0x3e')]['count'](_0x8ad221)[_0x7b04('0x21')](function(_0x2e5447){_0x3b6128[_0x7b04('0x1c')]=_0x2e5447;if(_0x11ea19[_0x7b04('0x2f')][_0x7b04('0x3f')]){_0x5de254['include']=[{'all':!![]}];}return db[_0x7b04('0x3e')][_0x7b04('0x40')](_0x5de254);})['then'](function(_0x4ceded){_0x3b6128[_0x7b04('0x41')]=_0x4ceded;return _0x3b6128;})[_0x7b04('0x21')](respondWithFilteredResult(_0x264989,_0x5de254))['catch'](handleError(_0x264989,null));};exports[_0x7b04('0x42')]=function(_0x58ee52,_0x48713e){var _0x27e89b={'raw':!![],'where':{'id':_0x58ee52[_0x7b04('0x43')]['id']}},_0x285ce1={};_0x285ce1['model']=_['keys'](db[_0x7b04('0x3e')][_0x7b04('0x29')]);_0x285ce1[_0x7b04('0x2f')]=_[_0x7b04('0x30')](_0x58ee52[_0x7b04('0x2f')]);_0x285ce1[_0x7b04('0x31')]=_[_0x7b04('0x32')](_0x285ce1[_0x7b04('0x2d')],_0x285ce1['query']);_0x27e89b[_0x7b04('0x33')]=_['intersection'](_0x285ce1[_0x7b04('0x2d')],qs['fields'](_0x58ee52[_0x7b04('0x2f')][_0x7b04('0x34')]));_0x27e89b[_0x7b04('0x33')]=_0x27e89b[_0x7b04('0x33')][_0x7b04('0x35')]?_0x27e89b[_0x7b04('0x33')]:_0x285ce1[_0x7b04('0x2d')];if(_0x58ee52[_0x7b04('0x2f')][_0x7b04('0x3f')]){_0x27e89b['include']=[{'all':!![]}];}_0x27e89b=_['merge']({},_0x27e89b,_0x58ee52['options']);return db['SquareReport'][_0x7b04('0x44')](_0x27e89b)[_0x7b04('0x21')](handleEntityNotFound(_0x48713e,null))['then'](respondWithResult(_0x48713e,null))['catch'](handleError(_0x48713e,null));};exports['create']=function(_0x4d8201,_0x2be31b){return db[_0x7b04('0x3e')]['create'](_0x4d8201[_0x7b04('0x45')],{})['then'](respondWithResult(_0x2be31b,0xc9))[_0x7b04('0x46')](handleError(_0x2be31b,null));};exports[_0x7b04('0x47')]=function(_0x2b8c27,_0x454526){if(_0x2b8c27[_0x7b04('0x45')]['id']){delete _0x2b8c27[_0x7b04('0x45')]['id'];}return db[_0x7b04('0x3e')][_0x7b04('0x44')]({'where':{'id':_0x2b8c27[_0x7b04('0x43')]['id']}})[_0x7b04('0x21')](handleEntityNotFound(_0x454526,null))[_0x7b04('0x21')](saveUpdates(_0x2b8c27[_0x7b04('0x45')],null))[_0x7b04('0x21')](respondWithResult(_0x454526,null))[_0x7b04('0x46')](handleError(_0x454526,null));};exports[_0x7b04('0x22')]=function(_0x36c3d1,_0x2a95eb){return db[_0x7b04('0x3e')][_0x7b04('0x44')]({'where':{'id':_0x36c3d1[_0x7b04('0x43')]['id']}})[_0x7b04('0x21')](handleEntityNotFound(_0x2a95eb,null))[_0x7b04('0x21')](removeEntity(_0x2a95eb,null))[_0x7b04('0x46')](handleError(_0x2a95eb,null));};exports[_0x7b04('0x48')]=function(_0x430447,_0x2d4907){return db[_0x7b04('0x3e')][_0x7b04('0x48')]()['then'](respondWithResult(_0x2d4907,null))[_0x7b04('0x46')](handleError(_0x2d4907,null));}; \ No newline at end of file +var _0x22c7=['options','find','create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SquareReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x22c7,0x1d5));var _0x722c=function(_0xf8216,_0x161f73){_0xf8216=_0xf8216-0x0;var _0x21a513=_0x22c7[_0xf8216];return _0x21a513;};'use strict';var emlformat=require(_0x722c('0x0'));var rimraf=require(_0x722c('0x1'));var zipdir=require(_0x722c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x722c('0x3'));var moment=require(_0x722c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x722c('0x5'));var util=require(_0x722c('0x6'));var path=require(_0x722c('0x7'));var sox=require('sox');var csv=require(_0x722c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x722c('0x9'));var _=require(_0x722c('0xa'));var squel=require(_0x722c('0xb'));var crypto=require(_0x722c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x722c('0xd'));var toCsv=require(_0x722c('0x8'));var querystring=require(_0x722c('0xe'));var Papa=require(_0x722c('0xf'));var Redis=require(_0x722c('0x10'));var authService=require(_0x722c('0x11'));var qs=require(_0x722c('0x12'));var as=require(_0x722c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x722c('0x14'))(_0x722c('0x15'));var utils=require(_0x722c('0x16'));var config=require(_0x722c('0x17'));var licenseUtil=require(_0x722c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x561991,_0xc85de9){_0xc85de9=_0xc85de9||0xcc;return function(_0xe95eb5){if(_0xe95eb5){return _0x561991[_0x722c('0x19')](_0xc85de9);}return _0x561991['status'](_0xc85de9)[_0x722c('0x1a')]();};}function respondWithResult(_0x41e562,_0x5cb550){_0x5cb550=_0x5cb550||0xc8;return function(_0x39b38a){if(_0x39b38a){return _0x41e562[_0x722c('0x1b')](_0x5cb550)[_0x722c('0x1c')](_0x39b38a);}};}function respondWithFilteredResult(_0x3b1c3d,_0x1e818b){return function(_0xd31743){if(_0xd31743){var _0x2b35d6=typeof _0x1e818b[_0x722c('0x1d')]===_0x722c('0x1e')&&typeof _0x1e818b[_0x722c('0x1f')]===_0x722c('0x1e');var _0x116be0=_0xd31743['count'];var _0x439b86=_0x2b35d6?0x0:_0x1e818b[_0x722c('0x1d')];var _0x14e7ee=_0x2b35d6?_0xd31743[_0x722c('0x20')]:_0x1e818b[_0x722c('0x1d')]+_0x1e818b['limit'];var _0x2403c7;if(_0x14e7ee>=_0x116be0){_0x14e7ee=_0x116be0;_0x2403c7=0xc8;}else{_0x2403c7=0xce;}_0x3b1c3d[_0x722c('0x1b')](_0x2403c7);return _0x3b1c3d[_0x722c('0x21')](_0x722c('0x22'),_0x439b86+'-'+_0x14e7ee+'/'+_0x116be0)[_0x722c('0x1c')](_0xd31743);}return null;};}function patchUpdates(_0x1a82ae){return function(_0x3233f4){try{jsonpatch[_0x722c('0x23')](_0x3233f4,_0x1a82ae,!![]);}catch(_0x6f649c){return BPromise[_0x722c('0x24')](_0x6f649c);}return _0x3233f4[_0x722c('0x25')]();};}function saveUpdates(_0x36c17d,_0x25783d){return function(_0x2df959){if(_0x2df959){return _0x2df959[_0x722c('0x26')](_0x36c17d)['then'](function(_0x181de7){return _0x181de7;});}return null;};}function removeEntity(_0x298868,_0x38809a){return function(_0x3bf22c){if(_0x3bf22c){return _0x3bf22c['destroy']()[_0x722c('0x27')](function(){_0x298868[_0x722c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19d584,_0x2f197f){return function(_0x2cc495){if(!_0x2cc495){_0x19d584['sendStatus'](0x194);}return _0x2cc495;};}function handleError(_0x3e9ff8,_0x5435ce){_0x5435ce=_0x5435ce||0x1f4;return function(_0x1c0475){logger[_0x722c('0x28')](_0x1c0475[_0x722c('0x29')]);if(_0x1c0475[_0x722c('0x2a')]){delete _0x1c0475['name'];}_0x3e9ff8['status'](_0x5435ce)[_0x722c('0x2b')](_0x1c0475);};}exports[_0x722c('0x2c')]=function(_0x3e29cd,_0x5bcf30){var _0x562411={},_0xec3ea5={},_0x5719b0={'count':0x0,'rows':[]};var _0xf0efff=_[_0x722c('0x2d')](db[_0x722c('0x2e')][_0x722c('0x2f')],function(_0x413d5a){return{'name':_0x413d5a['fieldName'],'type':_0x413d5a[_0x722c('0x30')]['key']};});_0xec3ea5[_0x722c('0x31')]=_[_0x722c('0x2d')](_0xf0efff,_0x722c('0x2a'));_0xec3ea5[_0x722c('0x32')]=_[_0x722c('0x33')](_0x3e29cd['query']);_0xec3ea5[_0x722c('0x34')]=_[_0x722c('0x35')](_0xec3ea5[_0x722c('0x31')],_0xec3ea5['query']);_0x562411[_0x722c('0x36')]=_[_0x722c('0x35')](_0xec3ea5['model'],qs[_0x722c('0x37')](_0x3e29cd[_0x722c('0x32')][_0x722c('0x37')]));_0x562411[_0x722c('0x36')]=_0x562411[_0x722c('0x36')]['length']?_0x562411[_0x722c('0x36')]:_0xec3ea5['model'];if(!_0x3e29cd[_0x722c('0x32')]['hasOwnProperty'](_0x722c('0x38'))){_0x562411[_0x722c('0x1f')]=qs[_0x722c('0x1f')](_0x3e29cd[_0x722c('0x32')][_0x722c('0x1f')]);_0x562411['offset']=qs[_0x722c('0x1d')](_0x3e29cd[_0x722c('0x32')][_0x722c('0x1d')]);}_0x562411[_0x722c('0x39')]=qs[_0x722c('0x3a')](_0x3e29cd[_0x722c('0x32')][_0x722c('0x3a')]);_0x562411[_0x722c('0x3b')]=qs[_0x722c('0x34')](_[_0x722c('0x3c')](_0x3e29cd[_0x722c('0x32')],_0xec3ea5[_0x722c('0x34')]),_0xf0efff);if(_0x3e29cd[_0x722c('0x32')][_0x722c('0x3d')]){_0x562411[_0x722c('0x3b')]=_[_0x722c('0x3e')](_0x562411[_0x722c('0x3b')],{'$or':_[_0x722c('0x2d')](_0xf0efff,function(_0x2d11d1){if(_0x2d11d1[_0x722c('0x30')]!==_0x722c('0x3f')){var _0x2f9e3d={};_0x2f9e3d[_0x2d11d1['name']]={'$like':'%'+_0x3e29cd['query'][_0x722c('0x3d')]+'%'};return _0x2f9e3d;}})});}_0x562411=_[_0x722c('0x3e')]({},_0x562411,_0x3e29cd['options']);var _0x4afc06={'where':_0x562411[_0x722c('0x3b')]};return db['SquareReport'][_0x722c('0x20')](_0x4afc06)['then'](function(_0x3c8839){_0x5719b0[_0x722c('0x20')]=_0x3c8839;if(_0x3e29cd[_0x722c('0x32')][_0x722c('0x40')]){_0x562411[_0x722c('0x41')]=[{'all':!![]}];}return db[_0x722c('0x2e')][_0x722c('0x42')](_0x562411);})['then'](function(_0x599dfd){_0x5719b0[_0x722c('0x43')]=_0x599dfd;return _0x5719b0;})[_0x722c('0x27')](respondWithFilteredResult(_0x5bcf30,_0x562411))['catch'](handleError(_0x5bcf30,null));};exports[_0x722c('0x44')]=function(_0x24ece4,_0x41b49d){var _0x21af48={'raw':!![],'where':{'id':_0x24ece4[_0x722c('0x45')]['id']}},_0x25191c={};_0x25191c[_0x722c('0x31')]=_[_0x722c('0x33')](db['SquareReport']['rawAttributes']);_0x25191c['query']=_['keys'](_0x24ece4[_0x722c('0x32')]);_0x25191c[_0x722c('0x34')]=_[_0x722c('0x35')](_0x25191c[_0x722c('0x31')],_0x25191c[_0x722c('0x32')]);_0x21af48[_0x722c('0x36')]=_[_0x722c('0x35')](_0x25191c[_0x722c('0x31')],qs[_0x722c('0x37')](_0x24ece4[_0x722c('0x32')][_0x722c('0x37')]));_0x21af48[_0x722c('0x36')]=_0x21af48['attributes']['length']?_0x21af48['attributes']:_0x25191c[_0x722c('0x31')];if(_0x24ece4[_0x722c('0x32')][_0x722c('0x40')]){_0x21af48[_0x722c('0x41')]=[{'all':!![]}];}_0x21af48=_[_0x722c('0x3e')]({},_0x21af48,_0x24ece4[_0x722c('0x46')]);return db[_0x722c('0x2e')][_0x722c('0x47')](_0x21af48)[_0x722c('0x27')](handleEntityNotFound(_0x41b49d,null))[_0x722c('0x27')](respondWithResult(_0x41b49d,null))['catch'](handleError(_0x41b49d,null));};exports[_0x722c('0x48')]=function(_0x46bd55,_0x3a2118){return db[_0x722c('0x2e')][_0x722c('0x48')](_0x46bd55[_0x722c('0x49')],{})[_0x722c('0x27')](respondWithResult(_0x3a2118,0xc9))[_0x722c('0x4a')](handleError(_0x3a2118,null));};exports['update']=function(_0x3ae75a,_0x328614){if(_0x3ae75a[_0x722c('0x49')]['id']){delete _0x3ae75a[_0x722c('0x49')]['id'];}return db[_0x722c('0x2e')][_0x722c('0x47')]({'where':{'id':_0x3ae75a[_0x722c('0x45')]['id']}})['then'](handleEntityNotFound(_0x328614,null))[_0x722c('0x27')](saveUpdates(_0x3ae75a[_0x722c('0x49')],null))[_0x722c('0x27')](respondWithResult(_0x328614,null))[_0x722c('0x4a')](handleError(_0x328614,null));};exports[_0x722c('0x4b')]=function(_0x5e7d12,_0x20c07a){return db[_0x722c('0x2e')][_0x722c('0x47')]({'where':{'id':_0x5e7d12['params']['id']}})[_0x722c('0x27')](handleEntityNotFound(_0x20c07a,null))[_0x722c('0x27')](removeEntity(_0x20c07a,null))[_0x722c('0x4a')](handleError(_0x20c07a,null));};exports[_0x722c('0x4c')]=function(_0x28e96a,_0x4c7c2f){return db[_0x722c('0x2e')][_0x722c('0x4c')]()[_0x722c('0x27')](respondWithResult(_0x4c7c2f,null))[_0x722c('0x4a')](handleError(_0x4c7c2f,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 6679e81..f406f2e 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 _0xb9ad=['uniqueid','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname'];(function(_0x3b3ce5,_0x2bf435){var _0x226e73=function(_0x210126){while(--_0x210126){_0x3b3ce5['push'](_0x3b3ce5['shift']());}};_0x226e73(++_0x2bf435);}(_0xb9ad,0x8a));var _0xdb9a=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xb9ad[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xdb9a('0x0'));var util=require(_0xdb9a('0x1'));var logger=require(_0xdb9a('0x2'))(_0xdb9a('0x3'));var moment=require(_0xdb9a('0x4'));var BPromise=require(_0xdb9a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb9a('0x6'));var rimraf=require(_0xdb9a('0x7'));var config=require(_0xdb9a('0x8'));var attributes=require(_0xdb9a('0x9'));module[_0xdb9a('0xa')]=function(_0x211b0f,_0x2d6675){return _0x211b0f[_0xdb9a('0xb')](_0xdb9a('0xc'),attributes,{'tableName':_0xdb9a('0xd'),'paranoid':![],'indexes':[{'name':_0xdb9a('0xe'),'fields':[_0xdb9a('0xf'),'project_name']},{'name':_0xdb9a('0x10'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6634=['rimraf','../../config/environment','exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6634,0xc9));var _0x4663=function(_0x17b3a0,_0x24e743){_0x17b3a0=_0x17b3a0-0x0;var _0x3bb234=_0x6634[_0x17b3a0];return _0x3bb234;};'use strict';var _=require(_0x4663('0x0'));var util=require(_0x4663('0x1'));var logger=require(_0x4663('0x2'))(_0x4663('0x3'));var moment=require(_0x4663('0x4'));var BPromise=require(_0x4663('0x5'));var rp=require(_0x4663('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4663('0x7'));var config=require(_0x4663('0x8'));var attributes=require('./squareReport.attributes');module[_0x4663('0x9')]=function(_0x50441f,_0x16914a){return _0x50441f[_0x4663('0xa')]('SquareReport',attributes,{'tableName':_0x4663('0xb'),'paranoid':![],'indexes':[{'name':_0x4663('0xc'),'fields':[_0x4663('0xd'),_0x4663('0xe')]},{'name':_0x4663('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index a8b7eb9..6466f60 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 _0x2c42=['update','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','raw','then','debug','UpdateSquareReport'];(function(_0x1e8461,_0x5e1500){var _0x528f4d=function(_0x217227){while(--_0x217227){_0x1e8461['push'](_0x1e8461['shift']());}};_0x528f4d(++_0x5e1500);}(_0x2c42,0xf8));var _0x22c4=function(_0x19cf8a,_0x1897c2){_0x19cf8a=_0x19cf8a-0x0;var _0xd068fb=_0x2c42[_0x19cf8a];return _0xd068fb;};'use strict';var _=require(_0x22c4('0x0'));var util=require(_0x22c4('0x1'));var moment=require(_0x22c4('0x2'));var BPromise=require(_0x22c4('0x3'));var rs=require(_0x22c4('0x4'));var fs=require('fs');var Redis=require(_0x22c4('0x5'));var db=require(_0x22c4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x22c4('0x7'))(_0x22c4('0x8'));var config=require(_0x22c4('0x9'));var jayson=require(_0x22c4('0xa'));var client=jayson[_0x22c4('0xb')][_0x22c4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32c4d6,_0x5821f5,_0x2e6026){return new BPromise(function(_0x597e47,_0x233951){return client[_0x22c4('0xd')](_0x32c4d6,_0x2e6026)['then'](function(_0x10c04d){logger[_0x22c4('0xe')](_0x22c4('0xf'),_0x5821f5,_0x22c4('0x10'));logger['debug'](_0x22c4('0x11'),_0x5821f5,_0x22c4('0x10'),JSON[_0x22c4('0x12')](_0x10c04d));if(_0x10c04d[_0x22c4('0x13')]){if(_0x10c04d[_0x22c4('0x13')][_0x22c4('0x14')]===0x1f4){logger[_0x22c4('0x13')]('SquareReport,\x20%s,\x20%s',_0x5821f5,_0x10c04d[_0x22c4('0x13')]['message']);return _0x233951(_0x10c04d[_0x22c4('0x13')][_0x22c4('0x15')]);}logger['error'](_0x22c4('0xf'),_0x5821f5,_0x10c04d['error'][_0x22c4('0x15')]);return _0x597e47(_0x10c04d[_0x22c4('0x13')][_0x22c4('0x15')]);}else{logger['info'](_0x22c4('0xf'),_0x5821f5,'request\x20sent');_0x597e47(_0x10c04d[_0x22c4('0x16')][_0x22c4('0x15')]);}})['catch'](function(_0x44ba79){logger[_0x22c4('0x13')](_0x22c4('0xf'),_0x5821f5,_0x44ba79);_0x233951(_0x44ba79);});});}exports[_0x22c4('0x17')]=function(_0x544ce0){var _0x5780a9=this;return new Promise(function(_0x5ad280,_0x2d1167){return db[_0x22c4('0x18')][_0x22c4('0x19')](_0x544ce0[_0x22c4('0x1a')],{'raw':_0x544ce0[_0x22c4('0x1b')]?_0x544ce0['options'][_0x22c4('0x1c')]===undefined?!![]:![]:!![]})[_0x22c4('0x1d')](function(_0x172ef2){logger[_0x22c4('0xe')](_0x22c4('0x17'),_0x544ce0);logger[_0x22c4('0x1e')](_0x22c4('0x17'),_0x544ce0,JSON[_0x22c4('0x12')](_0x172ef2));_0x5ad280(_0x172ef2);})['catch'](function(_0xe63ad4){logger['error'](_0x22c4('0x17'),_0xe63ad4[_0x22c4('0x15')],_0x544ce0);_0x2d1167(_0x5780a9['error'](0x1f4,_0xe63ad4[_0x22c4('0x15')]));});});};exports[_0x22c4('0x1f')]=function(_0x1498e5){var _0xb396b1=this;return new Promise(function(_0x5cbc02,_0x510463){return db[_0x22c4('0x18')][_0x22c4('0x20')](_0x1498e5[_0x22c4('0x1a')],{'raw':_0x1498e5[_0x22c4('0x1b')]?_0x1498e5[_0x22c4('0x1b')][_0x22c4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1498e5['options']?_0x1498e5[_0x22c4('0x1b')]['where']||null:null,'attributes':_0x1498e5[_0x22c4('0x1b')]?_0x1498e5['options'][_0x22c4('0x21')]||null:null,'limit':_0x1498e5[_0x22c4('0x1b')]?_0x1498e5[_0x22c4('0x1b')]['limit']||null:null})[_0x22c4('0x1d')](function(_0xa48358){logger['info'](_0x22c4('0x1f'),_0x1498e5);logger[_0x22c4('0x1e')](_0x22c4('0x1f'),_0x1498e5,JSON[_0x22c4('0x12')](_0xa48358));_0x5cbc02(_0xa48358);})[_0x22c4('0x22')](function(_0x14dbe3){logger[_0x22c4('0x13')](_0x22c4('0x1f'),_0x14dbe3[_0x22c4('0x15')],_0x1498e5);_0x510463(_0xb396b1[_0x22c4('0x13')](0x1f4,_0x14dbe3[_0x22c4('0x15')]));});});}; \ No newline at end of file +var _0xcc20=['CreateSquareReport','SquareReport','create','options','raw','then','catch','update','where','limit','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xcc20,0xeb));var _0x0cc2=function(_0x17f697,_0x3feea9){_0x17f697=_0x17f697-0x0;var _0x85fa16=_0xcc20[_0x17f697];return _0x85fa16;};'use strict';var _=require(_0x0cc2('0x0'));var util=require(_0x0cc2('0x1'));var moment=require(_0x0cc2('0x2'));var BPromise=require(_0x0cc2('0x3'));var rs=require(_0x0cc2('0x4'));var fs=require('fs');var Redis=require(_0x0cc2('0x5'));var db=require(_0x0cc2('0x6'))['db'];var utils=require(_0x0cc2('0x7'));var logger=require(_0x0cc2('0x8'))(_0x0cc2('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0cc2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43b122,_0x156aaf,_0x8e753){return new BPromise(function(_0x4889d9,_0x4bca97){return client[_0x0cc2('0xb')](_0x43b122,_0x8e753)['then'](function(_0x503a97){logger['info'](_0x0cc2('0xc'),_0x156aaf,_0x0cc2('0xd'));logger[_0x0cc2('0xe')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x156aaf,_0x0cc2('0xd'),JSON[_0x0cc2('0xf')](_0x503a97));if(_0x503a97[_0x0cc2('0x10')]){if(_0x503a97['error'][_0x0cc2('0x11')]===0x1f4){logger[_0x0cc2('0x10')](_0x0cc2('0xc'),_0x156aaf,_0x503a97[_0x0cc2('0x10')][_0x0cc2('0x12')]);return _0x4bca97(_0x503a97[_0x0cc2('0x10')]['message']);}logger[_0x0cc2('0x10')](_0x0cc2('0xc'),_0x156aaf,_0x503a97['error']['message']);return _0x4889d9(_0x503a97[_0x0cc2('0x10')][_0x0cc2('0x12')]);}else{logger[_0x0cc2('0x13')]('SquareReport,\x20%s,\x20%s',_0x156aaf,_0x0cc2('0xd'));_0x4889d9(_0x503a97[_0x0cc2('0x14')]['message']);}})['catch'](function(_0x20ba04){logger['error'](_0x0cc2('0xc'),_0x156aaf,_0x20ba04);_0x4bca97(_0x20ba04);});});}exports[_0x0cc2('0x15')]=function(_0x5ea1b1){var _0x2463a3=this;return new Promise(function(_0x4f5e52,_0x147a69){return db[_0x0cc2('0x16')][_0x0cc2('0x17')](_0x5ea1b1['body'],{'raw':_0x5ea1b1[_0x0cc2('0x18')]?_0x5ea1b1['options'][_0x0cc2('0x19')]===undefined?!![]:![]:!![]})[_0x0cc2('0x1a')](function(_0x104c1e){logger['info'](_0x0cc2('0x15'),_0x5ea1b1);logger['debug'](_0x0cc2('0x15'),_0x5ea1b1,JSON[_0x0cc2('0xf')](_0x104c1e));_0x4f5e52(_0x104c1e);})[_0x0cc2('0x1b')](function(_0x534ddb){logger[_0x0cc2('0x10')](_0x0cc2('0x15'),_0x534ddb['message'],_0x5ea1b1);_0x147a69(_0x2463a3['error'](0x1f4,_0x534ddb[_0x0cc2('0x12')]));});});};exports['UpdateSquareReport']=function(_0x4b8614){var _0x53ce2e=this;return new Promise(function(_0xc3c1ff,_0x1bbb56){return db[_0x0cc2('0x16')][_0x0cc2('0x1c')](_0x4b8614['body'],{'raw':_0x4b8614[_0x0cc2('0x18')]?_0x4b8614[_0x0cc2('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b8614['options']?_0x4b8614[_0x0cc2('0x18')][_0x0cc2('0x1d')]||null:null,'attributes':_0x4b8614[_0x0cc2('0x18')]?_0x4b8614[_0x0cc2('0x18')]['attributes']||null:null,'limit':_0x4b8614[_0x0cc2('0x18')]?_0x4b8614['options'][_0x0cc2('0x1e')]||null:null})[_0x0cc2('0x1a')](function(_0x47ee29){logger['info']('UpdateSquareReport',_0x4b8614);logger[_0x0cc2('0xe')](_0x0cc2('0x1f'),_0x4b8614,JSON[_0x0cc2('0xf')](_0x47ee29));_0xc3c1ff(_0x47ee29);})[_0x0cc2('0x1b')](function(_0x405bab){logger[_0x0cc2('0x10')](_0x0cc2('0x1f'),_0x405bab[_0x0cc2('0x12')],_0x4b8614);_0x1bbb56(_0x53ce2e[_0x0cc2('0x10')](0x1f4,_0x405bab['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index aa19e40..cc106d4 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 _0xd9b0=['../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x320aa9,_0x3bdc94){var _0x4a2093=function(_0x1f6cdb){while(--_0x1f6cdb){_0x320aa9['push'](_0x320aa9['shift']());}};_0x4a2093(++_0x3bdc94);}(_0xd9b0,0x1f2));var _0x0d9b=function(_0x4071c6,_0x94bd41){_0x4071c6=_0x4071c6-0x0;var _0x3f55c2=_0xd9b0[_0x4071c6];return _0x3f55c2;};'use strict';var multer=require(_0x0d9b('0x0'));var util=require(_0x0d9b('0x1'));var path=require(_0x0d9b('0x2'));var timeout=require(_0x0d9b('0x3'));var express=require(_0x0d9b('0x4'));var router=express['Router']();var fs_extra=require(_0x0d9b('0x5'));var auth=require(_0x0d9b('0x6'));var interaction=require(_0x0d9b('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x0d9b('0x8')](),controller[_0x0d9b('0x9')]);router[_0x0d9b('0xa')](_0x0d9b('0xb'),auth['isAuthenticated'](),controller[_0x0d9b('0xc')]);router[_0x0d9b('0xa')](_0x0d9b('0xd'),auth[_0x0d9b('0x8')](),controller[_0x0d9b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0d9b('0xf')]);router[_0x0d9b('0x10')](_0x0d9b('0xd'),auth[_0x0d9b('0x8')](),controller[_0x0d9b('0x11')]);router[_0x0d9b('0x12')]('/:id',auth[_0x0d9b('0x8')](),controller[_0x0d9b('0x13')]);module[_0x0d9b('0x14')]=router; \ No newline at end of file +var _0xec06=['update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x33ac75,_0x4953e3){var _0x34d5f2=function(_0x4c2b4a){while(--_0x4c2b4a){_0x33ac75['push'](_0x33ac75['shift']());}};_0x34d5f2(++_0x4953e3);}(_0xec06,0x191));var _0x6ec0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec06[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6ec0('0x0'));var util=require(_0x6ec0('0x1'));var path=require(_0x6ec0('0x2'));var timeout=require(_0x6ec0('0x3'));var express=require(_0x6ec0('0x4'));var router=express[_0x6ec0('0x5')]();var fs_extra=require(_0x6ec0('0x6'));var auth=require(_0x6ec0('0x7'));var interaction=require(_0x6ec0('0x8'));var config=require(_0x6ec0('0x9'));var controller=require(_0x6ec0('0xa'));router[_0x6ec0('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6ec0('0xb')]('/describe',auth[_0x6ec0('0xc')](),controller[_0x6ec0('0xd')]);router[_0x6ec0('0xb')](_0x6ec0('0xe'),auth[_0x6ec0('0xc')](),controller[_0x6ec0('0xf')]);router[_0x6ec0('0x10')]('/',auth[_0x6ec0('0xc')](),controller[_0x6ec0('0x11')]);router[_0x6ec0('0x12')](_0x6ec0('0xe'),auth[_0x6ec0('0xc')](),controller[_0x6ec0('0x13')]);router['delete']('/:id',auth[_0x6ec0('0xc')](),controller[_0x6ec0('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 4e8473a..96ae054 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 _0x4d52=['STRING','TEXT','exports'];(function(_0x4bdcd8,_0x5b4cd6){var _0x2bf60=function(_0x526da7){while(--_0x526da7){_0x4bdcd8['push'](_0x4bdcd8['shift']());}};_0x2bf60(++_0x5b4cd6);}(_0x4d52,0x137));var _0x24d5=function(_0x4e5ec4,_0x50dd7f){_0x4e5ec4=_0x4e5ec4-0x0;var _0x2a7a4f=_0x4d52[_0x4e5ec4];return _0x2a7a4f;};'use strict';var Sequelize=require('sequelize');module[_0x24d5('0x0')]={'uniqueid':{'type':Sequelize[_0x24d5('0x1')]},'node':{'type':Sequelize[_0x24d5('0x1')]},'application':{'type':Sequelize[_0x24d5('0x1')]},'data':{'type':Sequelize[_0x24d5('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x24d5('0x1')]}}; \ No newline at end of file +var _0xc548=['exports','STRING','TEXT','sequelize'];(function(_0x1765c7,_0x22ceef){var _0x4c3e15=function(_0x1fb824){while(--_0x1fb824){_0x1765c7['push'](_0x1765c7['shift']());}};_0x4c3e15(++_0x22ceef);}(_0xc548,0x97));var _0x8c54=function(_0x399378,_0x4fad17){_0x399378=_0x399378-0x0;var _0x4a6561=_0xc548[_0x399378];return _0x4a6561;};'use strict';var Sequelize=require(_0x8c54('0x0'));module[_0x8c54('0x1')]={'uniqueid':{'type':Sequelize[_0x8c54('0x2')]},'node':{'type':Sequelize[_0x8c54('0x2')]},'application':{'type':Sequelize[_0x8c54('0x2')]},'data':{'type':Sequelize[_0x8c54('0x3')]},'project_name':{'type':Sequelize[_0x8c54('0x2')]},'callerid':{'type':Sequelize[_0x8c54('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 66f01e9..39d747a 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 _0x2a75=['intersection','attributes','fields','length','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','rawAttributes','find','catch','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','count','set','Content-Range','json','reject','save','then','destroy','sendStatus','error','stack','name','map','SquareDetailsReport','fieldName','type','model','query','keys','filters'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0x2a75,0x189));var _0x52a7=function(_0x314f06,_0x340f76){_0x314f06=_0x314f06-0x0;var _0x38d3ef=_0x2a75[_0x314f06];return _0x38d3ef;};'use strict';var emlformat=require(_0x52a7('0x0'));var rimraf=require(_0x52a7('0x1'));var zipdir=require(_0x52a7('0x2'));var jsonpatch=require(_0x52a7('0x3'));var rp=require(_0x52a7('0x4'));var moment=require(_0x52a7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x52a7('0x6'));var util=require(_0x52a7('0x7'));var path=require(_0x52a7('0x8'));var sox=require('sox');var csv=require(_0x52a7('0x9'));var ejs=require(_0x52a7('0xa'));var fs=require('fs');var fs_extra=require(_0x52a7('0xb'));var _=require(_0x52a7('0xc'));var squel=require(_0x52a7('0xd'));var crypto=require('crypto');var jsforce=require(_0x52a7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x52a7('0x9'));var querystring=require(_0x52a7('0xf'));var Papa=require(_0x52a7('0x10'));var Redis=require(_0x52a7('0x11'));var authService=require(_0x52a7('0x12'));var qs=require(_0x52a7('0x13'));var as=require(_0x52a7('0x14'));var hardwareService=require(_0x52a7('0x15'));var logger=require(_0x52a7('0x16'))(_0x52a7('0x17'));var utils=require('../../config/utils');var config=require(_0x52a7('0x18'));var licenseUtil=require(_0x52a7('0x19'));var db=require(_0x52a7('0x1a'))['db'];function respondWithStatusCode(_0x527803,_0x295136){_0x295136=_0x295136||0xcc;return function(_0x117849){if(_0x117849){return _0x527803['sendStatus'](_0x295136);}return _0x527803[_0x52a7('0x1b')](_0x295136)[_0x52a7('0x1c')]();};}function respondWithResult(_0x1554dc,_0x5beb30){_0x5beb30=_0x5beb30||0xc8;return function(_0x25b93c){if(_0x25b93c){return _0x1554dc[_0x52a7('0x1b')](_0x5beb30)['json'](_0x25b93c);}};}function respondWithFilteredResult(_0x47d602,_0x3b71a1){return function(_0x15fc59){if(_0x15fc59){var _0x5d021d=typeof _0x3b71a1[_0x52a7('0x1d')]==='undefined'&&typeof _0x3b71a1[_0x52a7('0x1e')]==='undefined';var _0x15ea62=_0x15fc59[_0x52a7('0x1f')];var _0xb401c0=_0x5d021d?0x0:_0x3b71a1[_0x52a7('0x1d')];var _0x3d89d1=_0x5d021d?_0x15fc59[_0x52a7('0x1f')]:_0x3b71a1[_0x52a7('0x1d')]+_0x3b71a1[_0x52a7('0x1e')];var _0x50557d;if(_0x3d89d1>=_0x15ea62){_0x3d89d1=_0x15ea62;_0x50557d=0xc8;}else{_0x50557d=0xce;}_0x47d602[_0x52a7('0x1b')](_0x50557d);return _0x47d602[_0x52a7('0x20')](_0x52a7('0x21'),_0xb401c0+'-'+_0x3d89d1+'/'+_0x15ea62)[_0x52a7('0x22')](_0x15fc59);}return null;};}function patchUpdates(_0x580947){return function(_0x23ca8a){try{jsonpatch['apply'](_0x23ca8a,_0x580947,!![]);}catch(_0x1c01ee){return BPromise[_0x52a7('0x23')](_0x1c01ee);}return _0x23ca8a[_0x52a7('0x24')]();};}function saveUpdates(_0x38aefa,_0x17ab9f){return function(_0xebb122){if(_0xebb122){return _0xebb122['update'](_0x38aefa)[_0x52a7('0x25')](function(_0x39a80b){return _0x39a80b;});}return null;};}function removeEntity(_0x10bfb3,_0x4c61bc){return function(_0x24a8ba){if(_0x24a8ba){return _0x24a8ba[_0x52a7('0x26')]()['then'](function(){_0x10bfb3[_0x52a7('0x1b')](0xcc)[_0x52a7('0x1c')]();});}};}function handleEntityNotFound(_0xe262e9,_0x5b033f){return function(_0xced296){if(!_0xced296){_0xe262e9[_0x52a7('0x27')](0x194);}return _0xced296;};}function handleError(_0x23a836,_0x2dd5ef){_0x2dd5ef=_0x2dd5ef||0x1f4;return function(_0x35ebcc){logger[_0x52a7('0x28')](_0x35ebcc[_0x52a7('0x29')]);if(_0x35ebcc[_0x52a7('0x2a')]){delete _0x35ebcc[_0x52a7('0x2a')];}_0x23a836['status'](_0x2dd5ef)['send'](_0x35ebcc);};}exports['index']=function(_0x3f8b09,_0x5eb810){var _0x141787={},_0x1183a1={},_0x5548b7={'count':0x0,'rows':[]};var _0x33b713=_[_0x52a7('0x2b')](db[_0x52a7('0x2c')]['rawAttributes'],function(_0x19d87f){return{'name':_0x19d87f[_0x52a7('0x2d')],'type':_0x19d87f[_0x52a7('0x2e')]['key']};});_0x1183a1[_0x52a7('0x2f')]=_[_0x52a7('0x2b')](_0x33b713,_0x52a7('0x2a'));_0x1183a1[_0x52a7('0x30')]=_[_0x52a7('0x31')](_0x3f8b09[_0x52a7('0x30')]);_0x1183a1[_0x52a7('0x32')]=_[_0x52a7('0x33')](_0x1183a1['model'],_0x1183a1['query']);_0x141787[_0x52a7('0x34')]=_['intersection'](_0x1183a1[_0x52a7('0x2f')],qs[_0x52a7('0x35')](_0x3f8b09[_0x52a7('0x30')]['fields']));_0x141787['attributes']=_0x141787[_0x52a7('0x34')][_0x52a7('0x36')]?_0x141787[_0x52a7('0x34')]:_0x1183a1[_0x52a7('0x2f')];if(!_0x3f8b09['query']['hasOwnProperty']('nolimit')){_0x141787[_0x52a7('0x1e')]=qs[_0x52a7('0x1e')](_0x3f8b09[_0x52a7('0x30')][_0x52a7('0x1e')]);_0x141787[_0x52a7('0x1d')]=qs['offset'](_0x3f8b09[_0x52a7('0x30')][_0x52a7('0x1d')]);}_0x141787['order']=qs['sort'](_0x3f8b09[_0x52a7('0x30')][_0x52a7('0x37')]);_0x141787[_0x52a7('0x38')]=qs['filters'](_[_0x52a7('0x39')](_0x3f8b09[_0x52a7('0x30')],_0x1183a1[_0x52a7('0x32')]),_0x33b713);if(_0x3f8b09[_0x52a7('0x30')][_0x52a7('0x3a')]){_0x141787[_0x52a7('0x38')]=_['merge'](_0x141787[_0x52a7('0x38')],{'$or':_['map'](_0x33b713,function(_0x530bd4){if(_0x530bd4['type']!==_0x52a7('0x3b')){var _0x20d9ac={};_0x20d9ac[_0x530bd4[_0x52a7('0x2a')]]={'$like':'%'+_0x3f8b09[_0x52a7('0x30')][_0x52a7('0x3a')]+'%'};return _0x20d9ac;}})});}_0x141787=_[_0x52a7('0x3c')]({},_0x141787,_0x3f8b09[_0x52a7('0x3d')]);var _0x5aa327={'where':_0x141787[_0x52a7('0x38')]};return db[_0x52a7('0x2c')][_0x52a7('0x1f')](_0x5aa327)[_0x52a7('0x25')](function(_0x4c6644){_0x5548b7['count']=_0x4c6644;if(_0x3f8b09[_0x52a7('0x30')][_0x52a7('0x3e')]){_0x141787[_0x52a7('0x3f')]=[{'all':!![]}];}return db[_0x52a7('0x2c')][_0x52a7('0x40')](_0x141787);})[_0x52a7('0x25')](function(_0x44b2c6){_0x5548b7['rows']=_0x44b2c6;return _0x5548b7;})[_0x52a7('0x25')](respondWithFilteredResult(_0x5eb810,_0x141787))['catch'](handleError(_0x5eb810,null));};exports[_0x52a7('0x41')]=function(_0x3aff80,_0x23bf0f){var _0x5f16a5={'raw':!![],'where':{'id':_0x3aff80['params']['id']}},_0x5b4f5e={};_0x5b4f5e[_0x52a7('0x2f')]=_[_0x52a7('0x31')](db['SquareDetailsReport'][_0x52a7('0x42')]);_0x5b4f5e[_0x52a7('0x30')]=_[_0x52a7('0x31')](_0x3aff80[_0x52a7('0x30')]);_0x5b4f5e[_0x52a7('0x32')]=_[_0x52a7('0x33')](_0x5b4f5e['model'],_0x5b4f5e['query']);_0x5f16a5[_0x52a7('0x34')]=_[_0x52a7('0x33')](_0x5b4f5e[_0x52a7('0x2f')],qs[_0x52a7('0x35')](_0x3aff80[_0x52a7('0x30')][_0x52a7('0x35')]));_0x5f16a5[_0x52a7('0x34')]=_0x5f16a5[_0x52a7('0x34')]['length']?_0x5f16a5[_0x52a7('0x34')]:_0x5b4f5e[_0x52a7('0x2f')];if(_0x3aff80[_0x52a7('0x30')][_0x52a7('0x3e')]){_0x5f16a5[_0x52a7('0x3f')]=[{'all':!![]}];}_0x5f16a5=_[_0x52a7('0x3c')]({},_0x5f16a5,_0x3aff80[_0x52a7('0x3d')]);return db[_0x52a7('0x2c')][_0x52a7('0x43')](_0x5f16a5)['then'](handleEntityNotFound(_0x23bf0f,null))[_0x52a7('0x25')](respondWithResult(_0x23bf0f,null))[_0x52a7('0x44')](handleError(_0x23bf0f,null));};exports[_0x52a7('0x45')]=function(_0x387fd7,_0x2cbc71){return db[_0x52a7('0x2c')][_0x52a7('0x45')](_0x387fd7['body'],{})[_0x52a7('0x25')](respondWithResult(_0x2cbc71,0xc9))[_0x52a7('0x44')](handleError(_0x2cbc71,null));};exports[_0x52a7('0x46')]=function(_0x426597,_0x1c524e){if(_0x426597[_0x52a7('0x47')]['id']){delete _0x426597[_0x52a7('0x47')]['id'];}return db[_0x52a7('0x2c')]['find']({'where':{'id':_0x426597[_0x52a7('0x48')]['id']}})['then'](handleEntityNotFound(_0x1c524e,null))['then'](saveUpdates(_0x426597[_0x52a7('0x47')],null))[_0x52a7('0x25')](respondWithResult(_0x1c524e,null))[_0x52a7('0x44')](handleError(_0x1c524e,null));};exports[_0x52a7('0x26')]=function(_0x330c86,_0x13b3de){return db[_0x52a7('0x2c')][_0x52a7('0x43')]({'where':{'id':_0x330c86[_0x52a7('0x48')]['id']}})[_0x52a7('0x25')](handleEntityNotFound(_0x13b3de,null))[_0x52a7('0x25')](removeEntity(_0x13b3de,null))['catch'](handleError(_0x13b3de,null));};exports[_0x52a7('0x49')]=function(_0x105857,_0x5f4356){return db[_0x52a7('0x2c')][_0x52a7('0x49')]()[_0x52a7('0x25')](respondWithResult(_0x5f4356,null))[_0x52a7('0x44')](handleError(_0x5f4356,null));}; \ No newline at end of file +var _0x21fe=['destroy','error','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0x55d358,_0x1f1a17){var _0xe191ff=function(_0x2bfeed){while(--_0x2bfeed){_0x55d358['push'](_0x55d358['shift']());}};_0xe191ff(++_0x1f1a17);}(_0x21fe,0x109));var _0xe21f=function(_0x9dadea,_0x2f4878){_0x9dadea=_0x9dadea-0x0;var _0x2700e9=_0x21fe[_0x9dadea];return _0x2700e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe21f('0x0'));var zipdir=require(_0xe21f('0x1'));var jsonpatch=require(_0xe21f('0x2'));var rp=require(_0xe21f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe21f('0x4'));var util=require(_0xe21f('0x5'));var path=require(_0xe21f('0x6'));var sox=require(_0xe21f('0x7'));var csv=require('to-csv');var ejs=require(_0xe21f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe21f('0x9'));var squel=require(_0xe21f('0xa'));var crypto=require('crypto');var jsforce=require(_0xe21f('0xb'));var deskjs=require(_0xe21f('0xc'));var toCsv=require(_0xe21f('0xd'));var querystring=require(_0xe21f('0xe'));var Papa=require(_0xe21f('0xf'));var Redis=require(_0xe21f('0x10'));var authService=require(_0xe21f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe21f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe21f('0x13'))(_0xe21f('0x14'));var utils=require(_0xe21f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe21f('0x16'));var db=require(_0xe21f('0x17'))['db'];function respondWithStatusCode(_0x20dc7b,_0x3ba0eb){_0x3ba0eb=_0x3ba0eb||0xcc;return function(_0x532425){if(_0x532425){return _0x20dc7b[_0xe21f('0x18')](_0x3ba0eb);}return _0x20dc7b[_0xe21f('0x19')](_0x3ba0eb)[_0xe21f('0x1a')]();};}function respondWithResult(_0x93a63d,_0x29ef09){_0x29ef09=_0x29ef09||0xc8;return function(_0x591085){if(_0x591085){return _0x93a63d[_0xe21f('0x19')](_0x29ef09)[_0xe21f('0x1b')](_0x591085);}};}function respondWithFilteredResult(_0x3fc896,_0x3ba183){return function(_0x29b0c2){if(_0x29b0c2){var _0x26fe37=typeof _0x3ba183['offset']===_0xe21f('0x1c')&&typeof _0x3ba183[_0xe21f('0x1d')]===_0xe21f('0x1c');var _0xf0ad55=_0x29b0c2[_0xe21f('0x1e')];var _0x3e0576=_0x26fe37?0x0:_0x3ba183[_0xe21f('0x1f')];var _0x122a24=_0x26fe37?_0x29b0c2[_0xe21f('0x1e')]:_0x3ba183['offset']+_0x3ba183[_0xe21f('0x1d')];var _0x2b3679;if(_0x122a24>=_0xf0ad55){_0x122a24=_0xf0ad55;_0x2b3679=0xc8;}else{_0x2b3679=0xce;}_0x3fc896[_0xe21f('0x19')](_0x2b3679);return _0x3fc896[_0xe21f('0x20')](_0xe21f('0x21'),_0x3e0576+'-'+_0x122a24+'/'+_0xf0ad55)['json'](_0x29b0c2);}return null;};}function patchUpdates(_0x24747b){return function(_0x4efa18){try{jsonpatch[_0xe21f('0x22')](_0x4efa18,_0x24747b,!![]);}catch(_0x523d83){return BPromise[_0xe21f('0x23')](_0x523d83);}return _0x4efa18[_0xe21f('0x24')]();};}function saveUpdates(_0x1b877c,_0x391ef7){return function(_0x4f1bfe){if(_0x4f1bfe){return _0x4f1bfe[_0xe21f('0x25')](_0x1b877c)[_0xe21f('0x26')](function(_0x31e32a){return _0x31e32a;});}return null;};}function removeEntity(_0x4c7645,_0x16e2d4){return function(_0x17814d){if(_0x17814d){return _0x17814d[_0xe21f('0x27')]()[_0xe21f('0x26')](function(){_0x4c7645[_0xe21f('0x19')](0xcc)[_0xe21f('0x1a')]();});}};}function handleEntityNotFound(_0x592978,_0x253d7b){return function(_0x2aa251){if(!_0x2aa251){_0x592978[_0xe21f('0x18')](0x194);}return _0x2aa251;};}function handleError(_0x4a0618,_0x2d96b1){_0x2d96b1=_0x2d96b1||0x1f4;return function(_0x4a5dd1){logger[_0xe21f('0x28')](_0x4a5dd1['stack']);if(_0x4a5dd1[_0xe21f('0x29')]){delete _0x4a5dd1['name'];}_0x4a0618[_0xe21f('0x19')](_0x2d96b1)[_0xe21f('0x2a')](_0x4a5dd1);};}exports[_0xe21f('0x2b')]=function(_0x3caf40,_0x3a1b5a){var _0x45c078={},_0x670799={},_0x53e731={'count':0x0,'rows':[]};var _0x5f4f31=_[_0xe21f('0x2c')](db[_0xe21f('0x2d')][_0xe21f('0x2e')],function(_0x25a946){return{'name':_0x25a946['fieldName'],'type':_0x25a946[_0xe21f('0x2f')][_0xe21f('0x30')]};});_0x670799['model']=_['map'](_0x5f4f31,_0xe21f('0x29'));_0x670799['query']=_[_0xe21f('0x31')](_0x3caf40[_0xe21f('0x32')]);_0x670799[_0xe21f('0x33')]=_[_0xe21f('0x34')](_0x670799['model'],_0x670799[_0xe21f('0x32')]);_0x45c078['attributes']=_[_0xe21f('0x34')](_0x670799[_0xe21f('0x35')],qs[_0xe21f('0x36')](_0x3caf40[_0xe21f('0x32')][_0xe21f('0x36')]));_0x45c078[_0xe21f('0x37')]=_0x45c078[_0xe21f('0x37')][_0xe21f('0x38')]?_0x45c078[_0xe21f('0x37')]:_0x670799[_0xe21f('0x35')];if(!_0x3caf40[_0xe21f('0x32')][_0xe21f('0x39')](_0xe21f('0x3a'))){_0x45c078[_0xe21f('0x1d')]=qs[_0xe21f('0x1d')](_0x3caf40[_0xe21f('0x32')]['limit']);_0x45c078[_0xe21f('0x1f')]=qs[_0xe21f('0x1f')](_0x3caf40[_0xe21f('0x32')][_0xe21f('0x1f')]);}_0x45c078[_0xe21f('0x3b')]=qs[_0xe21f('0x3c')](_0x3caf40['query'][_0xe21f('0x3c')]);_0x45c078[_0xe21f('0x3d')]=qs['filters'](_['pick'](_0x3caf40[_0xe21f('0x32')],_0x670799['filters']),_0x5f4f31);if(_0x3caf40[_0xe21f('0x32')]['filter']){_0x45c078['where']=_[_0xe21f('0x3e')](_0x45c078[_0xe21f('0x3d')],{'$or':_[_0xe21f('0x2c')](_0x5f4f31,function(_0x2b1ef1){if(_0x2b1ef1[_0xe21f('0x2f')]!=='VIRTUAL'){var _0x331c68={};_0x331c68[_0x2b1ef1[_0xe21f('0x29')]]={'$like':'%'+_0x3caf40[_0xe21f('0x32')][_0xe21f('0x3f')]+'%'};return _0x331c68;}})});}_0x45c078=_[_0xe21f('0x3e')]({},_0x45c078,_0x3caf40['options']);var _0x5e6367={'where':_0x45c078[_0xe21f('0x3d')]};return db['SquareDetailsReport'][_0xe21f('0x1e')](_0x5e6367)['then'](function(_0xd95ded){_0x53e731[_0xe21f('0x1e')]=_0xd95ded;if(_0x3caf40[_0xe21f('0x32')]['includeAll']){_0x45c078[_0xe21f('0x40')]=[{'all':!![]}];}return db[_0xe21f('0x2d')][_0xe21f('0x41')](_0x45c078);})[_0xe21f('0x26')](function(_0x1a4595){_0x53e731[_0xe21f('0x42')]=_0x1a4595;return _0x53e731;})['then'](respondWithFilteredResult(_0x3a1b5a,_0x45c078))['catch'](handleError(_0x3a1b5a,null));};exports[_0xe21f('0x43')]=function(_0x988549,_0xf2a3bf){var _0x1b211d={'raw':!![],'where':{'id':_0x988549[_0xe21f('0x44')]['id']}},_0x27f3f2={};_0x27f3f2[_0xe21f('0x35')]=_[_0xe21f('0x31')](db[_0xe21f('0x2d')][_0xe21f('0x2e')]);_0x27f3f2[_0xe21f('0x32')]=_[_0xe21f('0x31')](_0x988549[_0xe21f('0x32')]);_0x27f3f2[_0xe21f('0x33')]=_[_0xe21f('0x34')](_0x27f3f2['model'],_0x27f3f2[_0xe21f('0x32')]);_0x1b211d[_0xe21f('0x37')]=_['intersection'](_0x27f3f2['model'],qs[_0xe21f('0x36')](_0x988549[_0xe21f('0x32')][_0xe21f('0x36')]));_0x1b211d[_0xe21f('0x37')]=_0x1b211d[_0xe21f('0x37')][_0xe21f('0x38')]?_0x1b211d['attributes']:_0x27f3f2[_0xe21f('0x35')];if(_0x988549[_0xe21f('0x32')][_0xe21f('0x45')]){_0x1b211d[_0xe21f('0x40')]=[{'all':!![]}];}_0x1b211d=_[_0xe21f('0x3e')]({},_0x1b211d,_0x988549[_0xe21f('0x46')]);return db[_0xe21f('0x2d')][_0xe21f('0x47')](_0x1b211d)[_0xe21f('0x26')](handleEntityNotFound(_0xf2a3bf,null))['then'](respondWithResult(_0xf2a3bf,null))[_0xe21f('0x48')](handleError(_0xf2a3bf,null));};exports['create']=function(_0x2765c0,_0x14d408){return db['SquareDetailsReport'][_0xe21f('0x49')](_0x2765c0[_0xe21f('0x4a')],{})[_0xe21f('0x26')](respondWithResult(_0x14d408,0xc9))[_0xe21f('0x48')](handleError(_0x14d408,null));};exports[_0xe21f('0x25')]=function(_0x150d92,_0x11c97c){if(_0x150d92[_0xe21f('0x4a')]['id']){delete _0x150d92[_0xe21f('0x4a')]['id'];}return db[_0xe21f('0x2d')][_0xe21f('0x47')]({'where':{'id':_0x150d92['params']['id']}})[_0xe21f('0x26')](handleEntityNotFound(_0x11c97c,null))[_0xe21f('0x26')](saveUpdates(_0x150d92['body'],null))['then'](respondWithResult(_0x11c97c,null))[_0xe21f('0x48')](handleError(_0x11c97c,null));};exports[_0xe21f('0x27')]=function(_0x479627,_0x6a9cb9){return db[_0xe21f('0x2d')]['find']({'where':{'id':_0x479627[_0xe21f('0x44')]['id']}})[_0xe21f('0x26')](handleEntityNotFound(_0x6a9cb9,null))[_0xe21f('0x26')](removeEntity(_0x6a9cb9,null))['catch'](handleError(_0x6a9cb9,null));};exports[_0xe21f('0x4b')]=function(_0x41f9ac,_0x47ecbd){return db[_0xe21f('0x2d')][_0xe21f('0x4b')]()[_0xe21f('0x26')](respondWithResult(_0x47ecbd,null))[_0xe21f('0x48')](handleError(_0x47ecbd,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d52e5fc..d883df8 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 _0xe22d=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x215285,_0x214b09){var _0x32cb15=function(_0x50475c){while(--_0x50475c){_0x215285['push'](_0x215285['shift']());}};_0x32cb15(++_0x214b09);}(_0xe22d,0xb2));var _0xde22=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe22d[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xde22('0x0'));var util=require(_0xde22('0x1'));var logger=require(_0xde22('0x2'))(_0xde22('0x3'));var moment=require(_0xde22('0x4'));var BPromise=require('bluebird');var rp=require(_0xde22('0x5'));var fs=require('fs');var path=require(_0xde22('0x6'));var rimraf=require(_0xde22('0x7'));var config=require(_0xde22('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0xde22('0x9')]=function(_0x12252f,_0x346183){return _0x12252f['define'](_0xde22('0xa'),attributes,{'tableName':_0xde22('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc463=['bluebird','request-promise','path','rimraf','define','lodash','util','../../config/logger','api','moment'];(function(_0x43cbe1,_0x4fc6d0){var _0x4ab06d=function(_0x520cc2){while(--_0x520cc2){_0x43cbe1['push'](_0x43cbe1['shift']());}};_0x4ab06d(++_0x4fc6d0);}(_0xc463,0x87));var _0x3c46=function(_0x5c92f7,_0x17381f){_0x5c92f7=_0x5c92f7-0x0;var _0x452cc1=_0xc463[_0x5c92f7];return _0x452cc1;};'use strict';var _=require(_0x3c46('0x0'));var util=require(_0x3c46('0x1'));var logger=require(_0x3c46('0x2'))(_0x3c46('0x3'));var moment=require(_0x3c46('0x4'));var BPromise=require(_0x3c46('0x5'));var rp=require(_0x3c46('0x6'));var fs=require('fs');var path=require(_0x3c46('0x7'));var rimraf=require(_0x3c46('0x8'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x2f9953,_0x3eb4c2){return _0x2f9953[_0x3c46('0x9')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 71ffab3..ad36c32 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 _0x1b0e=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareDetailsReport','create','options','raw','stringify','lodash','util'];(function(_0x20973a,_0x349826){var _0x5d68cd=function(_0x378587){while(--_0x378587){_0x20973a['push'](_0x20973a['shift']());}};_0x5d68cd(++_0x349826);}(_0x1b0e,0x132));var _0xe1b0=function(_0x392883,_0x496fac){_0x392883=_0x392883-0x0;var _0x5a0012=_0x1b0e[_0x392883];return _0x5a0012;};'use strict';var _=require(_0xe1b0('0x0'));var util=require(_0xe1b0('0x1'));var moment=require(_0xe1b0('0x2'));var BPromise=require(_0xe1b0('0x3'));var rs=require(_0xe1b0('0x4'));var fs=require('fs');var Redis=require(_0xe1b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe1b0('0x6'))(_0xe1b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xe1b0('0x8'));var client=jayson[_0xe1b0('0x9')][_0xe1b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e806,_0x36f5cd,_0x1eef2a){return new BPromise(function(_0x5aacc2,_0x123268){return client[_0xe1b0('0xb')](_0x52e806,_0x1eef2a)[_0xe1b0('0xc')](function(_0x400eee){logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));logger[_0xe1b0('0x10')](_0xe1b0('0x11'),_0x36f5cd,_0xe1b0('0xf'),JSON['stringify'](_0x400eee));if(_0x400eee[_0xe1b0('0x12')]){if(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x13')]===0x1f4){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x123268(_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);}logger['error'](_0xe1b0('0xe'),_0x36f5cd,_0x400eee[_0xe1b0('0x12')][_0xe1b0('0x14')]);return _0x5aacc2(_0x400eee['error']['message']);}else{logger[_0xe1b0('0xd')](_0xe1b0('0xe'),_0x36f5cd,_0xe1b0('0xf'));_0x5aacc2(_0x400eee[_0xe1b0('0x15')][_0xe1b0('0x14')]);}})[_0xe1b0('0x16')](function(_0x5dfd78){logger[_0xe1b0('0x12')](_0xe1b0('0xe'),_0x36f5cd,_0x5dfd78);_0x123268(_0x5dfd78);});});}exports[_0xe1b0('0x17')]=function(_0x2928b6){var _0x349f90=this;return new Promise(function(_0x5c195f,_0x5b300e){return db['SquareDetailsReport'][_0xe1b0('0x18')](_0x2928b6['body'],{'raw':_0x2928b6[_0xe1b0('0x19')]?_0x2928b6[_0xe1b0('0x19')][_0xe1b0('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3e0a89){logger[_0xe1b0('0xd')]('CreateSquareDetailsReport',_0x2928b6);logger[_0xe1b0('0x10')](_0xe1b0('0x17'),_0x2928b6,JSON[_0xe1b0('0x1b')](_0x3e0a89));_0x5c195f(_0x3e0a89);})['catch'](function(_0x3c0824){logger['error']('CreateSquareDetailsReport',_0x3c0824['message'],_0x2928b6);_0x5b300e(_0x349f90['error'](0x1f4,_0x3c0824[_0xe1b0('0x14')]));});});}; \ No newline at end of file +var _0x5204=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','lodash'];(function(_0x57f27f,_0x2c6d8e){var _0x5f5ad0=function(_0x4dec5d){while(--_0x4dec5d){_0x57f27f['push'](_0x57f27f['shift']());}};_0x5f5ad0(++_0x2c6d8e);}(_0x5204,0xdf));var _0x4520=function(_0x57cbfb,_0x2de760){_0x57cbfb=_0x57cbfb-0x0;var _0x4cb933=_0x5204[_0x57cbfb];return _0x4cb933;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')](_0x2e00f4[_0x4520('0x1a')],{'raw':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c46c5){logger[_0x4520('0xc')]('CreateSquareDetailsReport',_0x2e00f4);logger[_0x4520('0xf')](_0x4520('0x17'),_0x2e00f4,JSON[_0x4520('0x11')](_0x4c46c5));_0x4ba69f(_0x4c46c5);})['catch'](function(_0x3199a9){logger[_0x4520('0x12')](_0x4520('0x17'),_0x3199a9['message'],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x3199a9[_0x4520('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index ec8bc30..ba0b8ef 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 _0xbf67=['exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess'];(function(_0x3b2369,_0x4c68b9){var _0x5a1367=function(_0x58ddcf){while(--_0x58ddcf){_0x3b2369['push'](_0x3b2369['shift']());}};_0x5a1367(++_0x4c68b9);}(_0xbf67,0xe7));var _0x7bf6=function(_0x446f61,_0x5c2430){_0x446f61=_0x446f61-0x0;var _0x5ef902=_0xbf67[_0x446f61];return _0x5ef902;};'use strict';var express=require(_0x7bf6('0x0'));var router=express[_0x7bf6('0x1')]();var auth=require(_0x7bf6('0x2'));var controller=require(_0x7bf6('0x3'));router[_0x7bf6('0x4')]('/',auth[_0x7bf6('0x5')](),controller[_0x7bf6('0x6')]);router['get'](_0x7bf6('0x7'),auth[_0x7bf6('0x5')](),controller[_0x7bf6('0x8')]);module[_0x7bf6('0x9')]=router; \ No newline at end of file +var _0x1465=['killProcess','exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill'];(function(_0x21f88c,_0x3cc533){var _0x232aa6=function(_0x42de8a){while(--_0x42de8a){_0x21f88c['push'](_0x21f88c['shift']());}};_0x232aa6(++_0x3cc533);}(_0x1465,0x13d));var _0x5146=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x1465[_0x2d34d6];return _0x1d3d12;};'use strict';var express=require(_0x5146('0x0'));var router=express[_0x5146('0x1')]();var auth=require(_0x5146('0x2'));var controller=require(_0x5146('0x3'));router[_0x5146('0x4')]('/',auth[_0x5146('0x5')](),controller['index']);router[_0x5146('0x4')](_0x5146('0x6'),auth[_0x5146('0x5')](),controller[_0x5146('0x7')]);module[_0x5146('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 94a2064..bb7f325 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 _0xa2d1=['format','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','getAllData','then','json','catch','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf'];(function(_0x5563aa,_0x9b1949){var _0x2b3802=function(_0x1b4167){while(--_0x1b4167){_0x5563aa['push'](_0x5563aa['shift']());}};_0x2b3802(++_0x9b1949);}(_0xa2d1,0x19f));var _0x1a2d=function(_0xf0f9ae,_0x3b02ef){_0xf0f9ae=_0xf0f9ae-0x0;var _0x46b898=_0xa2d1[_0xf0f9ae];return _0x46b898;};'use strict';var info=require('systeminformation');var exec=require('child_process')['exec'];var logger=require('../../config/logger')(_0x1a2d('0x0'));var util=require(_0x1a2d('0x1'));var BPromise=require(_0x1a2d('0x2'));var _=require(_0x1a2d('0x3'));function handleError(_0x1e749a,_0x4a0ca0,_0x4a6e70){_0x4a0ca0=_0x4a0ca0||0x1f4;return function(_0x5be27e){logger['error'](_0x1a2d('0x4'),_0x4a6e70,_0x4a0ca0,util[_0x1a2d('0x5')](_0x5be27e,{'showHidden':![],'depth':null}));delete _0x5be27e['name'];_0x1e749a[_0x1a2d('0x6')](_0x4a0ca0)[_0x1a2d('0x7')](_0x5be27e);};}exports['index']=function(_0x3be363,_0x43b7f1){return info[_0x1a2d('0x8')]()[_0x1a2d('0x9')](function(_0x48261e){return _0x43b7f1[_0x1a2d('0x6')](0xc8)[_0x1a2d('0xa')](_0x48261e);})[_0x1a2d('0xb')](function(_0x4b5ed0){return _0x43b7f1[_0x1a2d('0x6')](0x1f4)[_0x1a2d('0xa')](_0x4b5ed0);});};exports['killProcess']=function(_0x5a4fb8,_0x26f92d){var _0x312e51=['components/import/cm'];return new BPromise(function(_0x3c2ba2,_0x71f9c1){return exec(util['format'](_0x1a2d('0xc'),_0x5a4fb8['params'][_0x1a2d('0xd')]),function(_0x3ca95e,_0x4fb67f,_0x432284){if(_0x3ca95e){return _0x71f9c1(_0x3ca95e);}return _0x3c2ba2(_0x4fb67f);});})[_0x1a2d('0x9')](function(_0x197406){var _0x25651e=![];var _0x3e8052=_0x197406[_0x1a2d('0xe')](/\n/);for(var _0xda110c=0x0,_0x456cbb=_0x312e51[_0x1a2d('0xf')];_0xda110c<_0x456cbb,_0x25651e===![];_0xda110c+=0x1){if(_0x197406[_0x1a2d('0x10')](_0x312e51[_0xda110c])>=0x0){_0x25651e=!![];}}if(!_0x25651e){throw new Error(util[_0x1a2d('0x11')](_0x1a2d('0x12'),_0x5a4fb8[_0x1a2d('0x13')][_0x1a2d('0xd')]));}process[_0x1a2d('0x14')](_0x5a4fb8[_0x1a2d('0x13')]['pid'],_0x1a2d('0x15'));return _0x26f92d[_0x1a2d('0x6')](0xc8)['json']({'message':util[_0x1a2d('0x11')](_0x1a2d('0x16'),_0x5a4fb8[_0x1a2d('0x13')][_0x1a2d('0xd')])});})['catch'](handleError(_0x26f92d,null,_0x1a2d('0x17')));}; \ No newline at end of file +var _0xbeb5=['Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','../../config/logger','api','bluebird','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','index','getAllData','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','then','split','indexOf'];(function(_0xa3354c,_0x4474ff){var _0x87333e=function(_0x52c8a0){while(--_0x52c8a0){_0xa3354c['push'](_0xa3354c['shift']());}};_0x87333e(++_0x4474ff);}(_0xbeb5,0x7d));var _0x5beb=function(_0x14d9b2,_0x5a34dd){_0x14d9b2=_0x14d9b2-0x0;var _0x17e8c7=_0xbeb5[_0x14d9b2];return _0x17e8c7;};'use strict';var info=require(_0x5beb('0x0'));var exec=require(_0x5beb('0x1'))['exec'];var logger=require(_0x5beb('0x2'))(_0x5beb('0x3'));var util=require('util');var BPromise=require(_0x5beb('0x4'));var _=require('lodash');function handleError(_0x2f88ed,_0x422e00,_0x132e48){_0x422e00=_0x422e00||0x1f4;return function(_0xcb4f79){logger['error'](_0x5beb('0x5'),_0x132e48,_0x422e00,util['inspect'](_0xcb4f79,{'showHidden':![],'depth':null}));delete _0xcb4f79['name'];_0x2f88ed[_0x5beb('0x6')](_0x422e00)[_0x5beb('0x7')](_0xcb4f79);};}exports[_0x5beb('0x8')]=function(_0x23f753,_0x2c86f9){return info[_0x5beb('0x9')]()['then'](function(_0x3792f1){return _0x2c86f9['status'](0xc8)[_0x5beb('0xa')](_0x3792f1);})[_0x5beb('0xb')](function(_0x432589){return _0x2c86f9['status'](0x1f4)[_0x5beb('0xa')](_0x432589);});};exports['killProcess']=function(_0x481e1f,_0x5a88f7){var _0x189b9c=[_0x5beb('0xc')];return new BPromise(function(_0x3afa10,_0x32a77d){return exec(util[_0x5beb('0xd')](_0x5beb('0xe'),_0x481e1f[_0x5beb('0xf')]['pid']),function(_0x17a7b5,_0x16a20b,_0x7e6046){if(_0x17a7b5){return _0x32a77d(_0x17a7b5);}return _0x3afa10(_0x16a20b);});})[_0x5beb('0x10')](function(_0x18cd37){var _0x2a10bf=![];var _0x319229=_0x18cd37[_0x5beb('0x11')](/\n/);for(var _0x6ab83e=0x0,_0x494d56=_0x189b9c['length'];_0x6ab83e<_0x494d56,_0x2a10bf===![];_0x6ab83e+=0x1){if(_0x18cd37[_0x5beb('0x12')](_0x189b9c[_0x6ab83e])>=0x0){_0x2a10bf=!![];}}if(!_0x2a10bf){throw new Error(util[_0x5beb('0xd')](_0x5beb('0x13'),_0x481e1f[_0x5beb('0xf')][_0x5beb('0x14')]));}process[_0x5beb('0x15')](_0x481e1f[_0x5beb('0xf')][_0x5beb('0x14')],'SIGINT');return _0x5a88f7['status'](0xc8)['json']({'message':util[_0x5beb('0xd')](_0x5beb('0x16'),_0x481e1f[_0x5beb('0xf')][_0x5beb('0x14')])});})[_0x5beb('0xb')](handleError(_0x5a88f7,null,_0x5beb('0x17')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 65555f5..3184306 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 _0xb7db=['../../components/interaction/service','./tag.controller','get','index','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5e33f1,_0x38bd28){var _0xf994c0=function(_0x4c7f2d){while(--_0x4c7f2d){_0x5e33f1['push'](_0x5e33f1['shift']());}};_0xf994c0(++_0x38bd28);}(_0xb7db,0x1e7));var _0xbb7d=function(_0xc86750,_0xf2f69a){_0xc86750=_0xc86750-0x0;var _0x5c0a2e=_0xb7db[_0xc86750];return _0x5c0a2e;};'use strict';var multer=require(_0xbb7d('0x0'));var util=require(_0xbb7d('0x1'));var path=require(_0xbb7d('0x2'));var timeout=require(_0xbb7d('0x3'));var express=require('express');var router=express[_0xbb7d('0x4')]();var fs_extra=require(_0xbb7d('0x5'));var auth=require(_0xbb7d('0x6'));var interaction=require(_0xbb7d('0x7'));var config=require('../../config/environment');var controller=require(_0xbb7d('0x8'));router[_0xbb7d('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb7d('0xa')]);router[_0xbb7d('0x9')](_0xbb7d('0xb'),auth[_0xbb7d('0xc')](),controller[_0xbb7d('0xd')]);router[_0xbb7d('0xe')]('/',auth[_0xbb7d('0xc')](),controller['create']);router[_0xbb7d('0xf')]('/:id',auth[_0xbb7d('0xc')](),controller['update']);router[_0xbb7d('0x10')](_0xbb7d('0xb'),auth[_0xbb7d('0xc')](),controller[_0xbb7d('0x11')]);module[_0xbb7d('0x12')]=router; \ No newline at end of file +var _0x1730=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x47f8d2,_0x4e6e1d){var _0x13557a=function(_0x85d906){while(--_0x85d906){_0x47f8d2['push'](_0x47f8d2['shift']());}};_0x13557a(++_0x4e6e1d);}(_0x1730,0x97));var _0x0173=function(_0x46e1a2,_0x461117){_0x46e1a2=_0x46e1a2-0x0;var _0x1f8a85=_0x1730[_0x46e1a2];return _0x1f8a85;};'use strict';var multer=require('multer');var util=require(_0x0173('0x0'));var path=require('path');var timeout=require(_0x0173('0x1'));var express=require('express');var router=express[_0x0173('0x2')]();var fs_extra=require(_0x0173('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0173('0x4'));var config=require(_0x0173('0x5'));var controller=require(_0x0173('0x6'));router[_0x0173('0x7')]('/',auth['isAuthenticated'](),controller[_0x0173('0x8')]);router[_0x0173('0x7')](_0x0173('0x9'),auth['isAuthenticated'](),controller[_0x0173('0xa')]);router[_0x0173('0xb')]('/',auth[_0x0173('0xc')](),controller[_0x0173('0xd')]);router[_0x0173('0xe')](_0x0173('0x9'),auth[_0x0173('0xc')](),controller[_0x0173('0xf')]);router[_0x0173('0x10')](_0x0173('0x9'),auth[_0x0173('0xc')](),controller[_0x0173('0x11')]);module[_0x0173('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index c2ddd91..f96fea5 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 _0x68a5=['sequelize','STRING','name','#0091EA'];(function(_0x247e4e,_0x1e73d8){var _0x259673=function(_0x47d2e3){while(--_0x47d2e3){_0x247e4e['push'](_0x247e4e['shift']());}};_0x259673(++_0x1e73d8);}(_0x68a5,0xfc));var _0x568a=function(_0x304486,_0x496459){_0x304486=_0x304486-0x0;var _0x136188=_0x68a5[_0x304486];return _0x136188;};'use strict';var Sequelize=require(_0x568a('0x0'));module['exports']={'name':{'type':Sequelize[_0x568a('0x1')],'unique':_0x568a('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x568a('0x3')},'description':{'type':Sequelize[_0x568a('0x1')]}}; \ No newline at end of file +var _0x9861=['STRING','#0091EA','sequelize','name'];(function(_0x194303,_0x50e0ce){var _0x5f1198=function(_0xf369cf){while(--_0xf369cf){_0x194303['push'](_0x194303['shift']());}};_0x5f1198(++_0x50e0ce);}(_0x9861,0x176));var _0x1986=function(_0x554826,_0x196d2e){_0x554826=_0x554826-0x0;var _0x2528f7=_0x9861[_0x554826];return _0x2528f7;};'use strict';var Sequelize=require(_0x1986('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1986('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x1986('0x2')],'defaultValue':_0x1986('0x3')},'description':{'type':Sequelize[_0x1986('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 82dc53b..3763f4b 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 _0x3e5c=['crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','Tag','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','rows','catch','show','params','includeAll','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x2d56cd,_0x1db346){var _0x4bc5db=function(_0x5bfd07){while(--_0x5bfd07){_0x2d56cd['push'](_0x2d56cd['shift']());}};_0x4bc5db(++_0x1db346);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x11e14f,_0x33625b){_0x11e14f=_0x11e14f-0x0;var _0x5e3795=_0x3e5c[_0x11e14f];return _0x5e3795;};'use strict';var emlformat=require(_0xc3e5('0x0'));var rimraf=require(_0xc3e5('0x1'));var zipdir=require(_0xc3e5('0x2'));var jsonpatch=require(_0xc3e5('0x3'));var rp=require('request-promise');var moment=require(_0xc3e5('0x4'));var BPromise=require(_0xc3e5('0x5'));var Mustache=require(_0xc3e5('0x6'));var util=require(_0xc3e5('0x7'));var path=require(_0xc3e5('0x8'));var sox=require(_0xc3e5('0x9'));var csv=require('to-csv');var ejs=require(_0xc3e5('0xa'));var fs=require('fs');var fs_extra=require(_0xc3e5('0xb'));var _=require(_0xc3e5('0xc'));var squel=require(_0xc3e5('0xd'));var crypto=require(_0xc3e5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc3e5('0xf'));var toCsv=require(_0xc3e5('0x10'));var querystring=require(_0xc3e5('0x11'));var Papa=require(_0xc3e5('0x12'));var Redis=require(_0xc3e5('0x13'));var authService=require(_0xc3e5('0x14'));var qs=require(_0xc3e5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3e5('0x16'));var logger=require(_0xc3e5('0x17'))(_0xc3e5('0x18'));var utils=require(_0xc3e5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc3e5('0x1a'));var db=require(_0xc3e5('0x1b'))['db'];function respondWithStatusCode(_0x36193e,_0x3f0395){_0x3f0395=_0x3f0395||0xcc;return function(_0x3b7441){if(_0x3b7441){return _0x36193e[_0xc3e5('0x1c')](_0x3f0395);}return _0x36193e['status'](_0x3f0395)['end']();};}function respondWithResult(_0x52cca7,_0x27c226){_0x27c226=_0x27c226||0xc8;return function(_0x5a52f1){if(_0x5a52f1){return _0x52cca7[_0xc3e5('0x1d')](_0x27c226)[_0xc3e5('0x1e')](_0x5a52f1);}};}function respondWithFilteredResult(_0x4d1ad9,_0x353dc0){return function(_0x3e3eaa){if(_0x3e3eaa){var _0x2cc476=typeof _0x353dc0[_0xc3e5('0x1f')]===_0xc3e5('0x20')&&typeof _0x353dc0['limit']===_0xc3e5('0x20');var _0x277063=_0x3e3eaa[_0xc3e5('0x21')];var _0xa33d84=_0x2cc476?0x0:_0x353dc0[_0xc3e5('0x1f')];var _0x1e1eea=_0x2cc476?_0x3e3eaa['count']:_0x353dc0[_0xc3e5('0x1f')]+_0x353dc0[_0xc3e5('0x22')];var _0x4a1d86;if(_0x1e1eea>=_0x277063){_0x1e1eea=_0x277063;_0x4a1d86=0xc8;}else{_0x4a1d86=0xce;}_0x4d1ad9[_0xc3e5('0x1d')](_0x4a1d86);return _0x4d1ad9['set'](_0xc3e5('0x23'),_0xa33d84+'-'+_0x1e1eea+'/'+_0x277063)[_0xc3e5('0x1e')](_0x3e3eaa);}return null;};}function patchUpdates(_0x2d551b){return function(_0xebf6dc){try{jsonpatch[_0xc3e5('0x24')](_0xebf6dc,_0x2d551b,!![]);}catch(_0x4a7806){return BPromise[_0xc3e5('0x25')](_0x4a7806);}return _0xebf6dc[_0xc3e5('0x26')]();};}function saveUpdates(_0x2d8c6f,_0x3eb513){return function(_0x414ba9){if(_0x414ba9){return _0x414ba9[_0xc3e5('0x27')](_0x2d8c6f)[_0xc3e5('0x28')](function(_0x47f344){return _0x47f344;});}return null;};}function removeEntity(_0x3a2800,_0x430cb4){return function(_0x43d01e){if(_0x43d01e){return _0x43d01e[_0xc3e5('0x29')]()[_0xc3e5('0x28')](function(){var _0x28b858=_0x43d01e[_0xc3e5('0x2a')]({'plain':!![]});var _0x45556e='Tags';return db[_0xc3e5('0x2b')]['destroy']({'where':{'type':_0x45556e,'resourceId':_0x28b858['id']}})['then'](function(){return _0x43d01e;});})[_0xc3e5('0x28')](function(){_0x3a2800[_0xc3e5('0x1d')](0xcc)[_0xc3e5('0x2c')]();});}};}function handleEntityNotFound(_0x59dcff,_0x31f49b){return function(_0x38a961){if(!_0x38a961){_0x59dcff[_0xc3e5('0x1c')](0x194);}return _0x38a961;};}function handleError(_0x3ad580,_0x591262){_0x591262=_0x591262||0x1f4;return function(_0xa6766d){logger['error'](_0xa6766d[_0xc3e5('0x2d')]);if(_0xa6766d[_0xc3e5('0x2e')]){delete _0xa6766d[_0xc3e5('0x2e')];}_0x3ad580['status'](_0x591262)['send'](_0xa6766d);};}exports['index']=function(_0x1dcc51,_0x45cd9c){var _0x144172={},_0x2f023e={},_0xeea535={'count':0x0,'rows':[]};var _0x65bb96=_['map'](db[_0xc3e5('0x2f')][_0xc3e5('0x30')],function(_0x440617){return{'name':_0x440617[_0xc3e5('0x31')],'type':_0x440617[_0xc3e5('0x32')][_0xc3e5('0x33')]};});_0x2f023e[_0xc3e5('0x34')]=_[_0xc3e5('0x35')](_0x65bb96,_0xc3e5('0x2e'));_0x2f023e[_0xc3e5('0x36')]=_[_0xc3e5('0x37')](_0x1dcc51['query']);_0x2f023e[_0xc3e5('0x38')]=_['intersection'](_0x2f023e[_0xc3e5('0x34')],_0x2f023e[_0xc3e5('0x36')]);_0x144172[_0xc3e5('0x39')]=_[_0xc3e5('0x3a')](_0x2f023e['model'],qs[_0xc3e5('0x3b')](_0x1dcc51['query']['fields']));_0x144172[_0xc3e5('0x39')]=_0x144172['attributes'][_0xc3e5('0x3c')]?_0x144172[_0xc3e5('0x39')]:_0x2f023e[_0xc3e5('0x34')];if(!_0x1dcc51[_0xc3e5('0x36')][_0xc3e5('0x3d')]('nolimit')){_0x144172[_0xc3e5('0x22')]=qs[_0xc3e5('0x22')](_0x1dcc51[_0xc3e5('0x36')][_0xc3e5('0x22')]);_0x144172[_0xc3e5('0x1f')]=qs['offset'](_0x1dcc51[_0xc3e5('0x36')]['offset']);}_0x144172[_0xc3e5('0x3e')]=qs[_0xc3e5('0x3f')](_0x1dcc51['query'][_0xc3e5('0x3f')]);_0x144172['where']=qs[_0xc3e5('0x38')](_[_0xc3e5('0x40')](_0x1dcc51[_0xc3e5('0x36')],_0x2f023e['filters']),_0x65bb96);if(_0x1dcc51[_0xc3e5('0x36')][_0xc3e5('0x41')]){_0x144172[_0xc3e5('0x42')]=_[_0xc3e5('0x43')](_0x144172[_0xc3e5('0x42')],{'$or':_['map'](_0x65bb96,function(_0x4bf98e){if(_0x4bf98e['type']!==_0xc3e5('0x44')){var _0x383ced={};_0x383ced[_0x4bf98e['name']]={'$like':'%'+_0x1dcc51[_0xc3e5('0x36')]['filter']+'%'};return _0x383ced;}})});}_0x144172=_[_0xc3e5('0x43')]({},_0x144172,_0x1dcc51['options']);var _0x239c7f={'where':_0x144172['where']};return db[_0xc3e5('0x2f')][_0xc3e5('0x21')](_0x239c7f)[_0xc3e5('0x28')](function(_0x1c5177){_0xeea535[_0xc3e5('0x21')]=_0x1c5177;if(_0x1dcc51[_0xc3e5('0x36')]['includeAll']){_0x144172['include']=[{'all':!![]}];}return db[_0xc3e5('0x2f')]['findAll'](_0x144172);})[_0xc3e5('0x28')](function(_0x27354c){_0xeea535[_0xc3e5('0x45')]=_0x27354c;return _0xeea535;})[_0xc3e5('0x28')](respondWithFilteredResult(_0x45cd9c,_0x144172))[_0xc3e5('0x46')](handleError(_0x45cd9c,null));};exports[_0xc3e5('0x47')]=function(_0x49b123,_0x1bed92){var _0x2433d6={'raw':!![],'where':{'id':_0x49b123[_0xc3e5('0x48')]['id']}},_0xbbfcad={};_0xbbfcad[_0xc3e5('0x34')]=_[_0xc3e5('0x37')](db[_0xc3e5('0x2f')][_0xc3e5('0x30')]);_0xbbfcad[_0xc3e5('0x36')]=_[_0xc3e5('0x37')](_0x49b123['query']);_0xbbfcad['filters']=_['intersection'](_0xbbfcad[_0xc3e5('0x34')],_0xbbfcad['query']);_0x2433d6[_0xc3e5('0x39')]=_[_0xc3e5('0x3a')](_0xbbfcad[_0xc3e5('0x34')],qs[_0xc3e5('0x3b')](_0x49b123['query'][_0xc3e5('0x3b')]));_0x2433d6[_0xc3e5('0x39')]=_0x2433d6[_0xc3e5('0x39')][_0xc3e5('0x3c')]?_0x2433d6['attributes']:_0xbbfcad['model'];if(_0x49b123[_0xc3e5('0x36')][_0xc3e5('0x49')]){_0x2433d6['include']=[{'all':!![]}];}_0x2433d6=_[_0xc3e5('0x43')]({},_0x2433d6,_0x49b123['options']);return db[_0xc3e5('0x2f')]['find'](_0x2433d6)[_0xc3e5('0x28')](handleEntityNotFound(_0x1bed92,null))['then'](respondWithResult(_0x1bed92,null))['catch'](handleError(_0x1bed92,null));};exports['create']=function(_0x87855d,_0x11da7e){return db[_0xc3e5('0x2f')]['create'](_0x87855d['body'],{})[_0xc3e5('0x28')](function(_0x512ed8){var _0x1e585b=_0x87855d[_0xc3e5('0x4a')][_0xc3e5('0x2a')]({'plain':!![]});if(!_0x1e585b)throw new Error(_0xc3e5('0x4b'));if(_0x1e585b[_0xc3e5('0x4c')]===_0xc3e5('0x4a')){var _0x5cd31c=_0x512ed8[_0xc3e5('0x2a')]({'plain':!![]});var _0x4c1e8c='Tags';return db[_0xc3e5('0x4d')]['find']({'where':{'name':_0x4c1e8c,'userProfileId':_0x1e585b[_0xc3e5('0x4e')]},'raw':!![]})['then'](function(_0x4eb2e1){if(_0x4eb2e1&&_0x4eb2e1[_0xc3e5('0x4f')]===0x0){return db[_0xc3e5('0x2b')]['create']({'name':_0x5cd31c['name'],'resourceId':_0x5cd31c['id'],'type':_0x4eb2e1[_0xc3e5('0x2e')],'sectionId':_0x4eb2e1['id']},{})[_0xc3e5('0x28')](function(){return _0x512ed8;});}else{return _0x512ed8;}})['catch'](function(_0x45687f){logger[_0xc3e5('0x50')](_0xc3e5('0x51'),_0x45687f);throw _0x45687f;});}return _0x512ed8;})[_0xc3e5('0x28')](respondWithResult(_0x11da7e,0xc9))[_0xc3e5('0x46')](handleError(_0x11da7e,null));};exports[_0xc3e5('0x27')]=function(_0x10a04c,_0x4abeb5){if(_0x10a04c[_0xc3e5('0x52')]['id']){delete _0x10a04c[_0xc3e5('0x52')]['id'];}return db['Tag']['find']({'where':{'id':_0x10a04c[_0xc3e5('0x48')]['id']}})[_0xc3e5('0x28')](handleEntityNotFound(_0x4abeb5,null))['then'](saveUpdates(_0x10a04c['body'],null))['then'](respondWithResult(_0x4abeb5,null))['catch'](handleError(_0x4abeb5,null));};exports[_0xc3e5('0x29')]=function(_0x232e57,_0x474891){return db[_0xc3e5('0x2f')][_0xc3e5('0x53')]({'where':{'id':_0x232e57['params']['id']}})[_0xc3e5('0x28')](handleEntityNotFound(_0x474891,null))[_0xc3e5('0x28')](removeEntity(_0x474891,null))[_0xc3e5('0x46')](handleError(_0x474891,null));}; \ No newline at end of file +var _0xee24=['VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','create','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','apply','reject','save','then','destroy','get','UserProfileResource','stack','name','send','Tag','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0xee24,0x1a6));var _0x4ee2=function(_0xe63ca1,_0x38dbee){_0xe63ca1=_0xe63ca1-0x0;var _0x3a2983=_0xee24[_0xe63ca1];return _0x3a2983;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ee2('0x0'));var zipdir=require(_0x4ee2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ee2('0x2'));var moment=require(_0x4ee2('0x3'));var BPromise=require(_0x4ee2('0x4'));var Mustache=require(_0x4ee2('0x5'));var util=require('util');var path=require(_0x4ee2('0x6'));var sox=require(_0x4ee2('0x7'));var csv=require(_0x4ee2('0x8'));var ejs=require(_0x4ee2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee2('0xa'));var squel=require(_0x4ee2('0xb'));var crypto=require(_0x4ee2('0xc'));var jsforce=require(_0x4ee2('0xd'));var deskjs=require(_0x4ee2('0xe'));var toCsv=require(_0x4ee2('0x8'));var querystring=require(_0x4ee2('0xf'));var Papa=require(_0x4ee2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4ee2('0x11'));var as=require(_0x4ee2('0x12'));var hardwareService=require(_0x4ee2('0x13'));var logger=require(_0x4ee2('0x14'))(_0x4ee2('0x15'));var utils=require('../../config/utils');var config=require(_0x4ee2('0x16'));var licenseUtil=require(_0x4ee2('0x17'));var db=require(_0x4ee2('0x18'))['db'];function respondWithStatusCode(_0x322780,_0x51f09d){_0x51f09d=_0x51f09d||0xcc;return function(_0x1f7125){if(_0x1f7125){return _0x322780[_0x4ee2('0x19')](_0x51f09d);}return _0x322780[_0x4ee2('0x1a')](_0x51f09d)[_0x4ee2('0x1b')]();};}function respondWithResult(_0x4f41cb,_0x481181){_0x481181=_0x481181||0xc8;return function(_0x2357c5){if(_0x2357c5){return _0x4f41cb[_0x4ee2('0x1a')](_0x481181)['json'](_0x2357c5);}};}function respondWithFilteredResult(_0x34dacb,_0x231d5){return function(_0x3c4279){if(_0x3c4279){var _0x1b95c5=typeof _0x231d5[_0x4ee2('0x1c')]===_0x4ee2('0x1d')&&typeof _0x231d5['limit']===_0x4ee2('0x1d');var _0xde92d=_0x3c4279[_0x4ee2('0x1e')];var _0x4aba2b=_0x1b95c5?0x0:_0x231d5[_0x4ee2('0x1c')];var _0xb8e027=_0x1b95c5?_0x3c4279[_0x4ee2('0x1e')]:_0x231d5[_0x4ee2('0x1c')]+_0x231d5[_0x4ee2('0x1f')];var _0x341ca3;if(_0xb8e027>=_0xde92d){_0xb8e027=_0xde92d;_0x341ca3=0xc8;}else{_0x341ca3=0xce;}_0x34dacb[_0x4ee2('0x1a')](_0x341ca3);return _0x34dacb[_0x4ee2('0x20')]('Content-Range',_0x4aba2b+'-'+_0xb8e027+'/'+_0xde92d)['json'](_0x3c4279);}return null;};}function patchUpdates(_0x33e66e){return function(_0x4901ff){try{jsonpatch[_0x4ee2('0x21')](_0x4901ff,_0x33e66e,!![]);}catch(_0x1d29bf){return BPromise[_0x4ee2('0x22')](_0x1d29bf);}return _0x4901ff[_0x4ee2('0x23')]();};}function saveUpdates(_0x4507d6,_0x53f246){return function(_0x1d5037){if(_0x1d5037){return _0x1d5037['update'](_0x4507d6)[_0x4ee2('0x24')](function(_0x3e6344){return _0x3e6344;});}return null;};}function removeEntity(_0x2560fe,_0x1f4f90){return function(_0x1ca982){if(_0x1ca982){return _0x1ca982[_0x4ee2('0x25')]()[_0x4ee2('0x24')](function(){var _0x581c75=_0x1ca982[_0x4ee2('0x26')]({'plain':!![]});var _0x5127b8='Tags';return db[_0x4ee2('0x27')][_0x4ee2('0x25')]({'where':{'type':_0x5127b8,'resourceId':_0x581c75['id']}})[_0x4ee2('0x24')](function(){return _0x1ca982;});})[_0x4ee2('0x24')](function(){_0x2560fe[_0x4ee2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50005e,_0x404fba){return function(_0x2a078f){if(!_0x2a078f){_0x50005e['sendStatus'](0x194);}return _0x2a078f;};}function handleError(_0x2fe02a,_0x5a052b){_0x5a052b=_0x5a052b||0x1f4;return function(_0x49b1be){logger['error'](_0x49b1be[_0x4ee2('0x28')]);if(_0x49b1be[_0x4ee2('0x29')]){delete _0x49b1be['name'];}_0x2fe02a[_0x4ee2('0x1a')](_0x5a052b)[_0x4ee2('0x2a')](_0x49b1be);};}exports['index']=function(_0xc7df80,_0x4bf072){var _0x239ab7={},_0x3a0881={},_0x1fea65={'count':0x0,'rows':[]};var _0x4da154=_['map'](db[_0x4ee2('0x2b')][_0x4ee2('0x2c')],function(_0x3ab2a1){return{'name':_0x3ab2a1['fieldName'],'type':_0x3ab2a1[_0x4ee2('0x2d')][_0x4ee2('0x2e')]};});_0x3a0881[_0x4ee2('0x2f')]=_[_0x4ee2('0x30')](_0x4da154,_0x4ee2('0x29'));_0x3a0881[_0x4ee2('0x31')]=_[_0x4ee2('0x32')](_0xc7df80[_0x4ee2('0x31')]);_0x3a0881[_0x4ee2('0x33')]=_[_0x4ee2('0x34')](_0x3a0881[_0x4ee2('0x2f')],_0x3a0881[_0x4ee2('0x31')]);_0x239ab7['attributes']=_[_0x4ee2('0x34')](_0x3a0881[_0x4ee2('0x2f')],qs['fields'](_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x35')]));_0x239ab7[_0x4ee2('0x36')]=_0x239ab7[_0x4ee2('0x36')][_0x4ee2('0x37')]?_0x239ab7[_0x4ee2('0x36')]:_0x3a0881[_0x4ee2('0x2f')];if(!_0xc7df80['query'][_0x4ee2('0x38')](_0x4ee2('0x39'))){_0x239ab7[_0x4ee2('0x1f')]=qs['limit'](_0xc7df80[_0x4ee2('0x31')]['limit']);_0x239ab7[_0x4ee2('0x1c')]=qs[_0x4ee2('0x1c')](_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x1c')]);}_0x239ab7[_0x4ee2('0x3a')]=qs[_0x4ee2('0x3b')](_0xc7df80['query']['sort']);_0x239ab7[_0x4ee2('0x3c')]=qs[_0x4ee2('0x33')](_[_0x4ee2('0x3d')](_0xc7df80[_0x4ee2('0x31')],_0x3a0881[_0x4ee2('0x33')]),_0x4da154);if(_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x3e')]){_0x239ab7[_0x4ee2('0x3c')]=_[_0x4ee2('0x3f')](_0x239ab7[_0x4ee2('0x3c')],{'$or':_['map'](_0x4da154,function(_0x492595){if(_0x492595[_0x4ee2('0x2d')]!==_0x4ee2('0x40')){var _0x1255ff={};_0x1255ff[_0x492595['name']]={'$like':'%'+_0xc7df80[_0x4ee2('0x31')][_0x4ee2('0x3e')]+'%'};return _0x1255ff;}})});}_0x239ab7=_[_0x4ee2('0x3f')]({},_0x239ab7,_0xc7df80[_0x4ee2('0x41')]);var _0x31901e={'where':_0x239ab7[_0x4ee2('0x3c')]};return db[_0x4ee2('0x2b')][_0x4ee2('0x1e')](_0x31901e)[_0x4ee2('0x24')](function(_0x2b099b){_0x1fea65['count']=_0x2b099b;if(_0xc7df80['query'][_0x4ee2('0x42')]){_0x239ab7[_0x4ee2('0x43')]=[{'all':!![]}];}return db[_0x4ee2('0x2b')]['findAll'](_0x239ab7);})[_0x4ee2('0x24')](function(_0x56fd09){_0x1fea65[_0x4ee2('0x44')]=_0x56fd09;return _0x1fea65;})['then'](respondWithFilteredResult(_0x4bf072,_0x239ab7))[_0x4ee2('0x45')](handleError(_0x4bf072,null));};exports[_0x4ee2('0x46')]=function(_0x41607a,_0x5bc5f3){var _0x58a5de={'raw':!![],'where':{'id':_0x41607a[_0x4ee2('0x47')]['id']}},_0x4e7a92={};_0x4e7a92[_0x4ee2('0x2f')]=_[_0x4ee2('0x32')](db[_0x4ee2('0x2b')]['rawAttributes']);_0x4e7a92[_0x4ee2('0x31')]=_[_0x4ee2('0x32')](_0x41607a['query']);_0x4e7a92[_0x4ee2('0x33')]=_['intersection'](_0x4e7a92['model'],_0x4e7a92[_0x4ee2('0x31')]);_0x58a5de['attributes']=_[_0x4ee2('0x34')](_0x4e7a92['model'],qs[_0x4ee2('0x35')](_0x41607a[_0x4ee2('0x31')][_0x4ee2('0x35')]));_0x58a5de['attributes']=_0x58a5de[_0x4ee2('0x36')][_0x4ee2('0x37')]?_0x58a5de[_0x4ee2('0x36')]:_0x4e7a92[_0x4ee2('0x2f')];if(_0x41607a[_0x4ee2('0x31')]['includeAll']){_0x58a5de[_0x4ee2('0x43')]=[{'all':!![]}];}_0x58a5de=_[_0x4ee2('0x3f')]({},_0x58a5de,_0x41607a['options']);return db['Tag'][_0x4ee2('0x48')](_0x58a5de)['then'](handleEntityNotFound(_0x5bc5f3,null))[_0x4ee2('0x24')](respondWithResult(_0x5bc5f3,null))[_0x4ee2('0x45')](handleError(_0x5bc5f3,null));};exports['create']=function(_0x43ca98,_0x2bf21a){return db[_0x4ee2('0x2b')]['create'](_0x43ca98[_0x4ee2('0x49')],{})[_0x4ee2('0x24')](function(_0x4f3fa6){var _0x5204b0=_0x43ca98['user']['get']({'plain':!![]});if(!_0x5204b0)throw new Error(_0x4ee2('0x4a'));if(_0x5204b0[_0x4ee2('0x4b')]==='user'){var _0x1379c0=_0x4f3fa6[_0x4ee2('0x26')]({'plain':!![]});var _0x391424=_0x4ee2('0x4c');return db[_0x4ee2('0x4d')][_0x4ee2('0x48')]({'where':{'name':_0x391424,'userProfileId':_0x5204b0[_0x4ee2('0x4e')]},'raw':!![]})['then'](function(_0x4498af){if(_0x4498af&&_0x4498af['autoAssociation']===0x0){return db[_0x4ee2('0x27')][_0x4ee2('0x4f')]({'name':_0x1379c0[_0x4ee2('0x29')],'resourceId':_0x1379c0['id'],'type':_0x4498af['name'],'sectionId':_0x4498af['id']},{})[_0x4ee2('0x24')](function(){return _0x4f3fa6;});}else{return _0x4f3fa6;}})[_0x4ee2('0x45')](function(_0x304d64){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x304d64);throw _0x304d64;});}return _0x4f3fa6;})[_0x4ee2('0x24')](respondWithResult(_0x2bf21a,0xc9))[_0x4ee2('0x45')](handleError(_0x2bf21a,null));};exports[_0x4ee2('0x50')]=function(_0x3df5b3,_0x5ee68c){if(_0x3df5b3[_0x4ee2('0x49')]['id']){delete _0x3df5b3[_0x4ee2('0x49')]['id'];}return db[_0x4ee2('0x2b')][_0x4ee2('0x48')]({'where':{'id':_0x3df5b3[_0x4ee2('0x47')]['id']}})[_0x4ee2('0x24')](handleEntityNotFound(_0x5ee68c,null))[_0x4ee2('0x24')](saveUpdates(_0x3df5b3[_0x4ee2('0x49')],null))[_0x4ee2('0x24')](respondWithResult(_0x5ee68c,null))[_0x4ee2('0x45')](handleError(_0x5ee68c,null));};exports[_0x4ee2('0x25')]=function(_0x1a1021,_0x58dac3){return db['Tag'][_0x4ee2('0x48')]({'where':{'id':_0x1a1021[_0x4ee2('0x47')]['id']}})[_0x4ee2('0x24')](handleEntityNotFound(_0x58dac3,null))['then'](removeEntity(_0x58dac3,null))['catch'](handleError(_0x58dac3,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 53d82fb..a35fcb6 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 _0x32ce=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x32ce,0xc3));var _0xe32c=function(_0x5a04fb,_0xbfdcd3){_0x5a04fb=_0x5a04fb-0x0;var _0x237b20=_0x32ce[_0x5a04fb];return _0x237b20;};'use strict';var _=require(_0xe32c('0x0'));var util=require(_0xe32c('0x1'));var logger=require(_0xe32c('0x2'))(_0xe32c('0x3'));var moment=require(_0xe32c('0x4'));var BPromise=require(_0xe32c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe32c('0x6'));var rimraf=require(_0xe32c('0x7'));var config=require(_0xe32c('0x8'));var attributes=require(_0xe32c('0x9'));module[_0xe32c('0xa')]=function(_0x2eb47b,_0x3e44f8){return _0x2eb47b[_0xe32c('0xb')](_0xe32c('0xc'),attributes,{'tableName':_0xe32c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3bf=['bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','util','../../config/logger','moment'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0xb3bf,0x135));var _0xfb3b=function(_0x57c9c7,_0xb70a91){_0x57c9c7=_0x57c9c7-0x0;var _0x48ad8b=_0xb3bf[_0x57c9c7];return _0x48ad8b;};'use strict';var _=require('lodash');var util=require(_0xfb3b('0x0'));var logger=require(_0xfb3b('0x1'))('api');var moment=require(_0xfb3b('0x2'));var BPromise=require(_0xfb3b('0x3'));var rp=require(_0xfb3b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb3b('0x5'));var config=require(_0xfb3b('0x6'));var attributes=require(_0xfb3b('0x7'));module[_0xfb3b('0x8')]=function(_0x1046e8,_0x18cded){return _0x1046e8[_0xfb3b('0x9')](_0xfb3b('0xa'),attributes,{'tableName':_0xfb3b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index b2bf6d5..bb515b8 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 _0x826a=['debug','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x826a,0x1aa));var _0xa826=function(_0x49a2df,_0x46546a){_0x49a2df=_0x49a2df-0x0;var _0x193454=_0x826a[_0x49a2df];return _0x193454;};'use strict';var _=require('lodash');var util=require(_0xa826('0x0'));var moment=require('moment');var BPromise=require(_0xa826('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa826('0x2'));var db=require(_0xa826('0x3'))['db'];var utils=require(_0xa826('0x4'));var logger=require(_0xa826('0x5'))('rpc');var config=require(_0xa826('0x6'));var jayson=require(_0xa826('0x7'));var client=jayson[_0xa826('0x8')][_0xa826('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45154f,_0x4124f5,_0x4339f9){return new BPromise(function(_0x14c2ba,_0xc348d2){return client[_0xa826('0xa')](_0x45154f,_0x4339f9)[_0xa826('0xb')](function(_0x1005e6){logger[_0xa826('0xc')](_0xa826('0xd'),_0x4124f5,_0xa826('0xe'));logger[_0xa826('0xf')]('Tag,\x20%s,\x20%s,\x20%s',_0x4124f5,_0xa826('0xe'),JSON['stringify'](_0x1005e6));if(_0x1005e6[_0xa826('0x10')]){if(_0x1005e6[_0xa826('0x10')][_0xa826('0x11')]===0x1f4){logger[_0xa826('0x10')](_0xa826('0xd'),_0x4124f5,_0x1005e6[_0xa826('0x10')][_0xa826('0x12')]);return _0xc348d2(_0x1005e6['error'][_0xa826('0x12')]);}logger['error'](_0xa826('0xd'),_0x4124f5,_0x1005e6[_0xa826('0x10')]['message']);return _0x14c2ba(_0x1005e6['error']['message']);}else{logger[_0xa826('0xc')]('Tag,\x20%s,\x20%s',_0x4124f5,'request\x20sent');_0x14c2ba(_0x1005e6[_0xa826('0x13')][_0xa826('0x12')]);}})[_0xa826('0x14')](function(_0x5832b9){logger[_0xa826('0x10')](_0xa826('0xd'),_0x4124f5,_0x5832b9);_0xc348d2(_0x5832b9);});});} \ 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(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x6f7f,0x177));var _0xf6f7=function(_0x1f5f53,_0x550746){_0x1f5f53=_0x1f5f53-0x0;var _0x5a382f=_0x6f7f[_0x1f5f53];return _0x5a382f;};'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 ceab08e..70c8bf3 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 82e6304..491b451 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0xb7e7,0x121));var _0x7b7e=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xb7e7[_0x46d0c9];return _0x174506;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x161dd8,_0x46b6bd){var _0x3c0857=function(_0xe23956){while(--_0xe23956){_0x161dd8['push'](_0x161dd8['shift']());}};_0x3c0857(++_0x46b6bd);}(_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/team/team.controller.js b/server/api/team/team.controller.js index b5e6fc6..df4d983 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 _0x58f5=['pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','destroy','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','sequelize','VoiceQueueId','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','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','isValidChannel','ValidationError','Unknown\x20channel','capitalize','channel','toLowerCase','order','addQueues','add','ids','removeQueues','remove','Queues','addAgents','isArray','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','through','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','SIP/%s','penalty','all','spread','removeAgents','Chat','Queue:remove','getAgents','rimraf','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x3eebf6,_0x512b70){var _0x5632ad=function(_0x599ba5){while(--_0x599ba5){_0x3eebf6['push'](_0x3eebf6['shift']());}};_0x5632ad(++_0x512b70);}(_0x58f5,0xfa));var _0x558f=function(_0x3c1b16,_0x59c016){_0x3c1b16=_0x3c1b16-0x0;var _0x5dc8d6=_0x58f5[_0x3c1b16];return _0x5dc8d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x558f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x558f('0x1'));var moment=require(_0x558f('0x2'));var BPromise=require(_0x558f('0x3'));var Mustache=require('mustache');var util=require(_0x558f('0x4'));var path=require('path');var sox=require(_0x558f('0x5'));var csv=require(_0x558f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x558f('0x7'));var _=require(_0x558f('0x8'));var squel=require('squel');var crypto=require(_0x558f('0x9'));var jsforce=require(_0x558f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x558f('0x6'));var querystring=require('querystring');var Papa=require(_0x558f('0xb'));var Redis=require(_0x558f('0xc'));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(_0x558f('0xd'))('api');var utils=require(_0x558f('0xe'));var config=require(_0x558f('0xf'));var licenseUtil=require(_0x558f('0x10'));var db=require(_0x558f('0x11'))['db'];config['redis']=_[_0x558f('0x12')](config[_0x558f('0x13')],{'host':_0x558f('0x14'),'port':0x18eb});var socket=require(_0x558f('0x15'))(new Redis(config['redis']));require(_0x558f('0x16'))['register'](socket);function respondWithStatusCode(_0x435b1d,_0xee9025){_0xee9025=_0xee9025||0xcc;return function(_0x497397){if(_0x497397){return _0x435b1d[_0x558f('0x17')](_0xee9025);}return _0x435b1d['status'](_0xee9025)[_0x558f('0x18')]();};}function respondWithResult(_0x549cb3,_0x3cb26a){_0x3cb26a=_0x3cb26a||0xc8;return function(_0x44c6f5){if(_0x44c6f5){return _0x549cb3[_0x558f('0x19')](_0x3cb26a)[_0x558f('0x1a')](_0x44c6f5);}};}function respondWithFilteredResult(_0x5a5e5c,_0x3f3924){return function(_0xb409){if(_0xb409){var _0x3529cf=typeof _0x3f3924['offset']==='undefined'&&typeof _0x3f3924[_0x558f('0x1b')]===_0x558f('0x1c');var _0x2518f1=_0xb409[_0x558f('0x1d')];var _0x51bf89=_0x3529cf?0x0:_0x3f3924[_0x558f('0x1e')];var _0x4ab484=_0x3529cf?_0xb409['count']:_0x3f3924[_0x558f('0x1e')]+_0x3f3924[_0x558f('0x1b')];var _0x43c876;if(_0x4ab484>=_0x2518f1){_0x4ab484=_0x2518f1;_0x43c876=0xc8;}else{_0x43c876=0xce;}_0x5a5e5c[_0x558f('0x19')](_0x43c876);return _0x5a5e5c[_0x558f('0x1f')](_0x558f('0x20'),_0x51bf89+'-'+_0x4ab484+'/'+_0x2518f1)[_0x558f('0x1a')](_0xb409);}return null;};}function patchUpdates(_0x3267de){return function(_0x2a0306){try{jsonpatch['apply'](_0x2a0306,_0x3267de,!![]);}catch(_0x2e911b){return BPromise[_0x558f('0x21')](_0x2e911b);}return _0x2a0306[_0x558f('0x22')]();};}function saveUpdates(_0x4f60e0,_0xc9255f){return function(_0x47d2c5){if(_0x47d2c5){return _0x47d2c5[_0x558f('0x23')](_0x4f60e0)[_0x558f('0x24')](function(_0x181b94){return _0x181b94;});}return null;};}function handleEntityNotFound(_0x4db3ac,_0x5b0b08){return function(_0x59f0a9){if(!_0x59f0a9){_0x4db3ac[_0x558f('0x17')](0x194);}return _0x59f0a9;};}function handleError(_0x347c24,_0x2efdcd){_0x2efdcd=_0x2efdcd||0x1f4;return function(_0x4ed576){logger[_0x558f('0x25')](_0x4ed576[_0x558f('0x26')]);if(_0x4ed576[_0x558f('0x27')]){delete _0x4ed576[_0x558f('0x27')];}_0x347c24[_0x558f('0x19')](_0x2efdcd)[_0x558f('0x28')](_0x4ed576);};}exports[_0x558f('0x29')]=function(_0x401c08,_0x250b3c){var _0x1160ad={},_0x1e6cac={},_0x35b9a9={'count':0x0,'rows':[]};var _0xe99ee1=_[_0x558f('0x2a')](db[_0x558f('0x2b')][_0x558f('0x2c')],function(_0x9c2901){return{'name':_0x9c2901[_0x558f('0x2d')],'type':_0x9c2901[_0x558f('0x2e')][_0x558f('0x2f')]};});_0x1e6cac[_0x558f('0x30')]=_['map'](_0xe99ee1,_0x558f('0x27'));_0x1e6cac[_0x558f('0x31')]=_[_0x558f('0x32')](_0x401c08[_0x558f('0x31')]);_0x1e6cac[_0x558f('0x33')]=_['intersection'](_0x1e6cac[_0x558f('0x30')],_0x1e6cac[_0x558f('0x31')]);_0x1160ad[_0x558f('0x34')]=_[_0x558f('0x35')](_0x1e6cac[_0x558f('0x30')],qs[_0x558f('0x36')](_0x401c08[_0x558f('0x31')][_0x558f('0x36')]));_0x1160ad[_0x558f('0x34')]=_0x1160ad[_0x558f('0x34')][_0x558f('0x37')]?_0x1160ad[_0x558f('0x34')]:_0x1e6cac['model'];if(!_0x401c08[_0x558f('0x31')][_0x558f('0x38')](_0x558f('0x39'))){_0x1160ad[_0x558f('0x1b')]=qs[_0x558f('0x1b')](_0x401c08['query']['limit']);_0x1160ad[_0x558f('0x1e')]=qs[_0x558f('0x1e')](_0x401c08['query']['offset']);}_0x1160ad['order']=qs[_0x558f('0x3a')](_0x401c08[_0x558f('0x31')][_0x558f('0x3a')]);_0x1160ad[_0x558f('0x3b')]=qs[_0x558f('0x33')](_[_0x558f('0x3c')](_0x401c08['query'],_0x1e6cac[_0x558f('0x33')]),_0xe99ee1);if(_0x401c08[_0x558f('0x31')][_0x558f('0x3d')]){_0x1160ad[_0x558f('0x3b')]=_['merge'](_0x1160ad[_0x558f('0x3b')],{'$or':_['map'](_0xe99ee1,function(_0x32c9bf){if(_0x32c9bf[_0x558f('0x2e')]!==_0x558f('0x3e')){var _0x4a1485={};_0x4a1485[_0x32c9bf['name']]={'$like':'%'+_0x401c08[_0x558f('0x31')][_0x558f('0x3d')]+'%'};return _0x4a1485;}})});}_0x1160ad=_[_0x558f('0x3f')]({},_0x1160ad,_0x401c08[_0x558f('0x40')]);var _0xe33a17={'where':_0x1160ad['where']};return db[_0x558f('0x2b')][_0x558f('0x1d')](_0xe33a17)['then'](function(_0x1d953f){_0x35b9a9[_0x558f('0x1d')]=_0x1d953f;if(_0x401c08[_0x558f('0x31')][_0x558f('0x41')]){_0x1160ad[_0x558f('0x42')]=[{'all':!![]}];}return db[_0x558f('0x2b')][_0x558f('0x43')](_0x1160ad);})['then'](function(_0x43b963){_0x35b9a9[_0x558f('0x44')]=_0x43b963;return _0x35b9a9;})[_0x558f('0x24')](respondWithFilteredResult(_0x250b3c,_0x1160ad))['catch'](handleError(_0x250b3c,null));};exports['show']=function(_0x1d5f25,_0x2d1cde){var _0x115d84={'raw':![],'where':{'id':_0x1d5f25['params']['id']}},_0x1d9a6b={};_0x1d9a6b[_0x558f('0x30')]=_[_0x558f('0x32')](db[_0x558f('0x2b')][_0x558f('0x2c')]);_0x1d9a6b[_0x558f('0x31')]=_['keys'](_0x1d5f25['query']);_0x1d9a6b[_0x558f('0x33')]=_[_0x558f('0x35')](_0x1d9a6b['model'],_0x1d9a6b[_0x558f('0x31')]);_0x115d84[_0x558f('0x34')]=_['intersection'](_0x1d9a6b[_0x558f('0x30')],qs['fields'](_0x1d5f25[_0x558f('0x31')][_0x558f('0x36')]));_0x115d84[_0x558f('0x34')]=_0x115d84[_0x558f('0x34')][_0x558f('0x37')]?_0x115d84[_0x558f('0x34')]:_0x1d9a6b[_0x558f('0x30')];if(_0x1d5f25[_0x558f('0x31')][_0x558f('0x41')]){_0x115d84[_0x558f('0x42')]=[{'all':!![]}];}_0x115d84=_['merge']({},_0x115d84,_0x1d5f25[_0x558f('0x40')]);return db[_0x558f('0x2b')][_0x558f('0x45')](_0x115d84)[_0x558f('0x24')](handleEntityNotFound(_0x2d1cde,null))[_0x558f('0x24')](respondWithResult(_0x2d1cde,null))['catch'](handleError(_0x2d1cde,null));};exports[_0x558f('0x46')]=function(_0x52e4b8,_0x733063){return db[_0x558f('0x2b')][_0x558f('0x46')](_0x52e4b8['body'],{})[_0x558f('0x24')](function(_0x2f44a7){var _0x5b4fd6=_0x52e4b8[_0x558f('0x47')][_0x558f('0x48')]({'plain':!![]});if(!_0x5b4fd6)throw new Error(_0x558f('0x49'));if(_0x5b4fd6[_0x558f('0x4a')]==='user'){var _0x170d6e=_0x2f44a7[_0x558f('0x48')]({'plain':!![]});var _0x3cda44=_0x558f('0x4b');return db[_0x558f('0x4c')]['find']({'where':{'name':_0x3cda44,'userProfileId':_0x5b4fd6[_0x558f('0x4d')]},'raw':!![]})[_0x558f('0x24')](function(_0x46d49e){if(_0x46d49e&&_0x46d49e[_0x558f('0x4e')]===0x0){return db[_0x558f('0x4f')][_0x558f('0x46')]({'name':_0x170d6e[_0x558f('0x27')],'resourceId':_0x170d6e['id'],'type':_0x46d49e[_0x558f('0x27')],'sectionId':_0x46d49e['id']},{})[_0x558f('0x24')](function(){return _0x2f44a7;});}else{return _0x2f44a7;}})[_0x558f('0x50')](function(_0x308f31){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x308f31);throw _0x308f31;});}return _0x2f44a7;})[_0x558f('0x24')](respondWithResult(_0x733063,0xc9))['catch'](handleError(_0x733063,null));};exports[_0x558f('0x23')]=function(_0x2406cf,_0x1f2479){if(_0x2406cf[_0x558f('0x51')]['id']){delete _0x2406cf['body']['id'];}return db[_0x558f('0x2b')][_0x558f('0x45')]({'where':{'id':_0x2406cf[_0x558f('0x52')]['id']}})[_0x558f('0x24')](handleEntityNotFound(_0x1f2479,null))['then'](saveUpdates(_0x2406cf[_0x558f('0x51')],null))['then'](respondWithResult(_0x1f2479,null))['catch'](handleError(_0x1f2479,null));};exports[_0x558f('0x53')]=function(_0x15a71b,_0x56648b){var _0x2c45ea=_0x15a71b[_0x558f('0x52')]['id'];var _0x20adbb=[];return db['sequelize']['transaction'](function(_0xb6617){var _0x55d97e=_0x558f('0x54')+_0x2c45ea;return db['sequelize'][_0x558f('0x31')](_0x55d97e,{'type':db[_0x558f('0x55')][_0x558f('0x56')][_0x558f('0x57')],'raw':!![],'transaction':_0xb6617})[_0x558f('0x24')](function(_0x65ea98){_0x20adbb=_['map'](_0x65ea98,function(_0x2c26f6){return Number(_0x2c26f6[_0x558f('0x58')]);});})[_0x558f('0x24')](function(){var _0x1d8f61='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2c45ea;return db[_0x558f('0x59')][_0x558f('0x31')](_0x1d8f61,{'type':db[_0x558f('0x55')]['QueryTypes'][_0x558f('0x57')],'raw':!![],'transaction':_0xb6617});})[_0x558f('0x24')](function(_0x72eb92){var _0x30411b=_['map'](_0x72eb92,function(_0x4c1365){return Number(_0x4c1365[_0x558f('0x5a')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x20adbb},'VoiceQueueId':{'$in':_0x30411b}},'transaction':_0xb6617});})[_0x558f('0x24')](function(){var _0x9d8c34=_0x558f('0x5b')+_0x2c45ea;return db[_0x558f('0x59')][_0x558f('0x31')](_0x9d8c34,{'type':db['Sequelize'][_0x558f('0x56')][_0x558f('0x57')],'raw':!![],'transaction':_0xb6617});})[_0x558f('0x24')](function(_0x435387){var _0x1c2180=_[_0x558f('0x2a')](_0x435387,function(_0x45b21e){return Number(_0x45b21e[_0x558f('0x5c')]);});return db[_0x558f('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x20adbb},'MailQueueId':{'$in':_0x1c2180}},'transaction':_0xb6617});})[_0x558f('0x24')](function(){var _0x58f68d=_0x558f('0x5e')+_0x2c45ea;return db['sequelize'][_0x558f('0x31')](_0x58f68d,{'type':db[_0x558f('0x55')][_0x558f('0x56')][_0x558f('0x57')],'raw':!![],'transaction':_0xb6617});})[_0x558f('0x24')](function(_0xd91a84){var _0x4a35e2=_[_0x558f('0x2a')](_0xd91a84,function(_0x326f31){return Number(_0x326f31[_0x558f('0x5f')]);});return db[_0x558f('0x60')]['destroy']({'where':{'UserId':{'$in':_0x20adbb},'SmsQueueId':{'$in':_0x4a35e2}},'transaction':_0xb6617});})['then'](function(){var _0x57ce55='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2c45ea;return db[_0x558f('0x59')][_0x558f('0x31')](_0x57ce55,{'type':db[_0x558f('0x55')][_0x558f('0x56')][_0x558f('0x57')],'raw':!![],'transaction':_0xb6617});})['then'](function(_0x195acc){var _0x30182e=_[_0x558f('0x2a')](_0x195acc,function(_0x42d9a6){return Number(_0x42d9a6[_0x558f('0x61')]);});return db['UserChatQueue'][_0x558f('0x53')]({'where':{'UserId':{'$in':_0x20adbb},'ChatQueueId':{'$in':_0x30182e}},'transaction':_0xb6617});})['then'](function(){var _0xf9eb2=_0x558f('0x62')+_0x2c45ea;return db[_0x558f('0x59')][_0x558f('0x31')](_0xf9eb2,{'type':db['Sequelize'][_0x558f('0x56')][_0x558f('0x57')],'raw':!![],'transaction':_0xb6617});})['then'](function(_0x433507){var _0x5ce121=_[_0x558f('0x2a')](_0x433507,function(_0x369e8f){return Number(_0x369e8f[_0x558f('0x63')]);});return db[_0x558f('0x64')][_0x558f('0x53')]({'where':{'UserId':{'$in':_0x20adbb},'FaxQueueId':{'$in':_0x5ce121}},'transaction':_0xb6617});})['then'](function(){var _0x2e79c9=_0x558f('0x65')+_0x2c45ea;return db['sequelize'][_0x558f('0x31')](_0x2e79c9,{'type':db[_0x558f('0x55')][_0x558f('0x56')][_0x558f('0x57')],'raw':!![],'transaction':_0xb6617});})[_0x558f('0x24')](function(_0x4031df){var _0x169787=_['map'](_0x4031df,function(_0x56d5f9){return Number(_0x56d5f9[_0x558f('0x66')]);});return db[_0x558f('0x67')][_0x558f('0x53')]({'where':{'UserId':{'$in':_0x20adbb},'OpenchannelQueueId':{'$in':_0x169787}},'transaction':_0xb6617});})[_0x558f('0x24')](function(){var _0x460d82=_0x558f('0x68')+_0x2c45ea;return db[_0x558f('0x59')][_0x558f('0x31')](_0x460d82,{'type':db[_0x558f('0x55')][_0x558f('0x56')][_0x558f('0x57')],'raw':!![],'transaction':_0xb6617});})[_0x558f('0x24')](function(_0x338698){var _0x3d7aa6=_[_0x558f('0x2a')](_0x338698,function(_0x4a7d2f){return Number(_0x4a7d2f[_0x558f('0x69')]);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x20adbb},'WhatsappQueueId':{'$in':_0x3d7aa6}},'transaction':_0xb6617});})['then'](function(){return db[_0x558f('0x6a')]['find']({'where':{'TeamId':_0x2c45ea}});})[_0x558f('0x24')](function(_0x36f37b){if(_0x36f37b===null){return;}return db[_0x558f('0x6b')][_0x558f('0x53')]({'where':{'UserId':{'$in':_0x20adbb},'VoicePrefixId':_0x36f37b[_0x558f('0x6c')]},'transaction':_0xb6617});})[_0x558f('0x24')](function(){return db[_0x558f('0x2b')][_0x558f('0x53')]({'where':{'id':_0x2c45ea},'cascade':!![],'transaction':_0xb6617});})[_0x558f('0x24')](function(_0xa1e431){if(_0xa1e431===0x0){_0x56648b[_0x558f('0x17')](0x194);}else{return db[_0x558f('0x4f')]['destroy']({'where':{'type':_0x558f('0x4b'),'resourceId':_0x2c45ea},'cascade':!![],'transaction':_0xb6617})[_0x558f('0x24')](function(){_0x56648b[_0x558f('0x19')](0xcc)['end']();});}})[_0x558f('0x50')](function(_0xe0b9f4){_0x56648b[_0x558f('0x19')](0x1f4)[_0x558f('0x28')](_0xe0b9f4);});});};exports[_0x558f('0x6d')]=function(_0x2deaf6,_0x391c6f,_0x2cae8e){return db[_0x558f('0x2b')][_0x558f('0x6e')]({'where':{'id':_0x2deaf6['params']['id']}})[_0x558f('0x24')](handleEntityNotFound(_0x391c6f,null))['then'](function(_0x7a5f7d){if(!_0x2deaf6['query']['channel']||!utils[_0x558f('0x6f')](_0x2deaf6[_0x558f('0x31')]['channel'])){throw new db[(_0x558f('0x55'))][(_0x558f('0x70'))](_0x558f('0x71'));}var _0x31a7e1={};var _0x2ac8ee={};_0x2ac8ee[_0x558f('0x30')]=_['keys'](db[_[_0x558f('0x72')](_0x2deaf6['query'][_0x558f('0x73')][_0x558f('0x74')]())+'Queue'][_0x558f('0x2c')]);_0x2ac8ee[_0x558f('0x31')]=_[_0x558f('0x32')](_0x2deaf6[_0x558f('0x31')]);_0x2ac8ee[_0x558f('0x33')]=_[_0x558f('0x35')](_0x2ac8ee[_0x558f('0x30')],_0x2ac8ee[_0x558f('0x31')]);_0x31a7e1[_0x558f('0x34')]=_['intersection'](_0x2ac8ee[_0x558f('0x30')],qs[_0x558f('0x36')](_0x2deaf6['query'][_0x558f('0x36')]));_0x31a7e1[_0x558f('0x34')]=_0x31a7e1['attributes']['length']?_0x31a7e1[_0x558f('0x34')]:_0x2ac8ee[_0x558f('0x30')];_0x31a7e1[_0x558f('0x1b')]=qs['limit'](_0x2deaf6[_0x558f('0x31')]['limit']);_0x31a7e1[_0x558f('0x1e')]=qs[_0x558f('0x1e')](_0x2deaf6['query'][_0x558f('0x1e')]);_0x31a7e1[_0x558f('0x75')]=qs[_0x558f('0x3a')](_0x2deaf6[_0x558f('0x31')]['sort']);_0x31a7e1[_0x558f('0x3b')]=qs[_0x558f('0x33')](_[_0x558f('0x3c')](_0x2deaf6[_0x558f('0x31')],_0x2ac8ee['filters']));_0x31a7e1=_[_0x558f('0x3f')]({},_0x31a7e1,_0x2deaf6[_0x558f('0x40')]);return _0x7a5f7d[_0x558f('0x48')+_[_0x558f('0x72')](_0x2deaf6[_0x558f('0x31')]['channel'][_0x558f('0x74')]())+'Queues'](_0x31a7e1);})['then'](respondWithResult(_0x391c6f,null))[_0x558f('0x50')](handleError(_0x391c6f,null));};exports[_0x558f('0x76')]=function(_0x3082c7,_0x2270d8,_0x5f4819){return db[_0x558f('0x2b')][_0x558f('0x6e')]({'where':{'id':_0x3082c7[_0x558f('0x52')]['id']}})[_0x558f('0x24')](function(_0x1fbcfb){if(_0x1fbcfb){if(!_0x3082c7[_0x558f('0x51')][_0x558f('0x73')]||!utils[_0x558f('0x6f')](_0x3082c7[_0x558f('0x51')][_0x558f('0x73')])){throw new db[(_0x558f('0x55'))][(_0x558f('0x70'))](_0x558f('0x71'));}return _0x1fbcfb[_0x558f('0x77')+_['capitalize'](_0x3082c7['body'][_0x558f('0x73')][_0x558f('0x74')]())+'Queues'](_0x3082c7[_0x558f('0x51')][_0x558f('0x78')]);}return null;})[_0x558f('0x24')](handleEntityNotFound(_0x2270d8,null))[_0x558f('0x24')](respondWithStatusCode(_0x2270d8,null))[_0x558f('0x50')](handleError(_0x2270d8,null));};exports[_0x558f('0x79')]=function(_0x2d519e,_0x64a168,_0x2ece84){return db[_0x558f('0x2b')][_0x558f('0x6e')]({'where':{'id':_0x2d519e[_0x558f('0x52')]['id']}})['then'](function(_0xf13164){if(_0xf13164){if(!_0x2d519e[_0x558f('0x31')][_0x558f('0x73')]||!utils[_0x558f('0x6f')](_0x2d519e[_0x558f('0x31')]['channel'])){throw new db[(_0x558f('0x55'))]['ValidationError'](_0x558f('0x71'));}return _0xf13164[_0x558f('0x7a')+_['capitalize'](_0x2d519e['query'][_0x558f('0x73')][_0x558f('0x74')]())+_0x558f('0x7b')](_0x2d519e[_0x558f('0x31')][_0x558f('0x78')]);}return null;})[_0x558f('0x24')](handleEntityNotFound(_0x64a168,null))[_0x558f('0x24')](respondWithStatusCode(_0x64a168,null))['catch'](handleError(_0x64a168,null));};exports[_0x558f('0x7c')]=function(_0xbe3537,_0x50e1ac){var _0x41b4c1=_[_0x558f('0x7d')](_0xbe3537['body'][_0x558f('0x78')])?_0xbe3537['body']['ids']:[_0xbe3537[_0x558f('0x51')][_0x558f('0x78')]];var _0x1c7a28=_0xbe3537['params']['id'];return db[_0x558f('0x2b')][_0x558f('0x45')]({'where':{'id':_0x1c7a28}})[_0x558f('0x24')](handleEntityNotFound(_0x50e1ac,null))[_0x558f('0x24')](function(_0x2f5b86){if(_0x2f5b86){var _0xc15d20=[_0x558f('0x7e'),'Chat',_0x558f('0x7f'),_0x558f('0x80'),_0x558f('0x81'),_0x558f('0x82'),_0x558f('0x83')];return db['sequelize'][_0x558f('0x84')](function(_0xbb9f6e){var _0x54212f=_['map'](_0xc15d20,function(_0x25b36a){var _0x4d2eb3={'attributes':['id',_0x558f('0x27')]};if(_0x25b36a===_0x558f('0x7e')){_0x4d2eb3[_0x558f('0x85')]={'attributes':['penalty']};}return _0x2f5b86[_0x558f('0x48')+_0x25b36a+'Queues'](_0x4d2eb3)[_0x558f('0x24')](function(_0x26f9f6){var _0x19a601=_['map'](_0x26f9f6,function(_0x52841c){var _0xac5373=_['map'](_0x41b4c1,function(_0x4d147f){var _0x3e08a7={'where':{'UserId':_0x4d147f,[_0x25b36a+_0x558f('0x86')]:_0x52841c['id']},'transaction':_0xbb9f6e};if(_0x25b36a===_0x558f('0x7e')){_0x3e08a7[_0x558f('0x12')]={'penalty':_0x52841c[_0x558f('0x87')]['penalty']};}return db[_0x558f('0x88')+_0x25b36a+_0x558f('0x89')][_0x558f('0x8a')](_0x3e08a7)[_0x558f('0x24')](function(){socket[_0x558f('0x8b')](_0x558f('0x47')+_0x25b36a+_0x558f('0x8c'),{'UserId':_0x4d147f,[_0x25b36a+_0x558f('0x86')]:_0x52841c['id']});if(_0x25b36a!==_0x558f('0x7e')){return;}return db[_0x558f('0x88')]['findAll']({'where':{'id':_0x41b4c1,'online':0x1},'attributes':['id',_0x558f('0x27'),_0x558f('0x8d'),_0x558f('0x8e'),'interface'],'raw':!![]})[_0x558f('0x24')](function(_0x1a2025){var _0x141b2b=_[_0x558f('0x2a')](_0x1a2025,function(_0x38a272){return db[_0x558f('0x8f')][_0x558f('0x90')]({'membername':_0x38a272[_0x558f('0x27')],'UserId':_0x38a272['id'],'queue_name':_0x52841c[_0x558f('0x27')],'VoiceQueueId':_0x52841c['id'],'interface':_[_0x558f('0x91')](_0x38a272[_0x558f('0x92')])?util['format'](_0x558f('0x93'),_0x38a272[_0x558f('0x27')]):_0x38a272['interface'],'paused':_0x38a272[_0x558f('0x8e')]||![],'penalty':_0x52841c['TeamVoiceQueue'][_0x558f('0x94')]},{'transaction':_0xbb9f6e});});return Promise['all'](_0x141b2b);});});});return Promise[_0x558f('0x95')](_0xac5373);});return Promise['all'](_0x19a601);})['then'](function(){return db[_0x558f('0x6a')][_0x558f('0x6e')]({'where':{'teamId':_0x1c7a28}})[_0x558f('0x24')](function(_0x438690){if(_0x438690){var _0x5f0937=_[_0x558f('0x2a')](_0x41b4c1,function(_0x36e56f){db[_0x558f('0x6b')][_0x558f('0x90')]({'UserId':_0x36e56f,'VoicePrefixId':_0x438690[_0x558f('0x6c')]});});return Promise[_0x558f('0x95')](_0x5f0937);}});});});return Promise[_0x558f('0x95')](_0x54212f)[_0x558f('0x24')](function(){return _0x2f5b86['addAgents'](_0x41b4c1,{'transaction':_0xbb9f6e})[_0x558f('0x96')](function(_0x27fad0){return _0x27fad0;});});});}})['then'](respondWithResult(_0x50e1ac,null))[_0x558f('0x50')](handleError(_0x50e1ac,null));};exports[_0x558f('0x97')]=function(_0xb6ae45,_0x1e1c1e){var _0x1060f8=_[_0x558f('0x7d')](_0xb6ae45[_0x558f('0x31')]['ids'])?_0xb6ae45[_0x558f('0x31')][_0x558f('0x78')]:[_0xb6ae45[_0x558f('0x31')][_0x558f('0x78')]];var _0x1ed5ed=_0xb6ae45['params']['id'];return db[_0x558f('0x2b')]['find']({'where':{'id':_0x1ed5ed}})['then'](handleEntityNotFound(_0x1e1c1e,null))[_0x558f('0x24')](function(_0x47699c){if(_0x47699c){var _0x50d6cc=[_0x558f('0x7e'),_0x558f('0x98'),'Mail','Sms',_0x558f('0x81'),_0x558f('0x82'),_0x558f('0x83')];return db[_0x558f('0x59')][_0x558f('0x84')](function(_0x130b05){var _0x27a9d4=_['map'](_0x50d6cc,function(_0x430a00){var _0x3c05b5={'attributes':['id',_0x558f('0x27')]};return _0x47699c[_0x558f('0x48')+_0x430a00+_0x558f('0x7b')](_0x3c05b5)['then'](function(_0x1b3706){var _0x3f91ad=_[_0x558f('0x2a')](_0x1b3706,function(_0x2f8c2a){return _0x2f8c2a['removeAgents'](_0x1060f8,{'transaction':_0x130b05})[_0x558f('0x24')](function(){var _0x4dd563=_[_0x558f('0x2a')](_0x1060f8,function(_0x45318e){socket[_0x558f('0x8b')](_0x558f('0x47')+_0x430a00+_0x558f('0x99'),{'UserId':Number(_0x45318e),[_0x430a00+_0x558f('0x86')]:_0x2f8c2a['id']});if(_0x430a00!==_0x558f('0x7e')){return;}return db['UserVoiceQueueRt'][_0x558f('0x53')]({'where':{'VoiceQueueId':_0x2f8c2a['id'],'UserId':_0x45318e},'transaction':_0x130b05});});return Promise[_0x558f('0x95')](_0x4dd563);});});return Promise[_0x558f('0x95')](_0x3f91ad);});});return Promise[_0x558f('0x95')](_0x27a9d4)['then'](function(){return _0x47699c[_0x558f('0x97')](_0x1060f8,{'transaction':_0x130b05});})[_0x558f('0x24')](function(){return db[_0x558f('0x6a')][_0x558f('0x6e')]({'where':{'teamId':_0x1ed5ed}})[_0x558f('0x24')](function(_0x567779){if(_0x567779){var _0x115955=_[_0x558f('0x2a')](_0x1060f8,function(_0x3b2551){db[_0x558f('0x6b')][_0x558f('0x53')]({'where':{'UserId':_0x3b2551,'VoicePrefixId':_0x567779[_0x558f('0x6c')]}});});return Promise[_0x558f('0x95')](_0x115955);}});});});}})[_0x558f('0x24')](respondWithStatusCode(_0x1e1c1e,null))[_0x558f('0x50')](handleError(_0x1e1c1e,null));};exports[_0x558f('0x9a')]=function(_0x58f657,_0x3083cd,_0x2725ca){var _0x38438c={};var _0x1a02d8={};var _0x94d15f;var _0xaae0f0;return db[_0x558f('0x2b')]['findOne']({'where':{'id':_0x58f657[_0x558f('0x52')]['id']}})['then'](handleEntityNotFound(_0x3083cd,null))['then'](function(_0x1e1182){if(_0x1e1182){_0x94d15f=_0x1e1182;_0x1a02d8[_0x558f('0x30')]=_['keys'](db[_0x558f('0x88')][_0x558f('0x2c')]);_0x1a02d8['query']=_['keys'](_0x58f657[_0x558f('0x31')]);_0x1a02d8[_0x558f('0x33')]=_['intersection'](_0x1a02d8['model'],_0x1a02d8['query']);_0x38438c[_0x558f('0x34')]=_['intersection'](_0x1a02d8[_0x558f('0x30')],qs[_0x558f('0x36')](_0x58f657[_0x558f('0x31')][_0x558f('0x36')]));_0x38438c[_0x558f('0x34')]=_0x38438c[_0x558f('0x34')][_0x558f('0x37')]?_0x38438c['attributes']:_0x1a02d8[_0x558f('0x30')];_0x38438c[_0x558f('0x75')]=qs[_0x558f('0x3a')](_0x58f657[_0x558f('0x31')][_0x558f('0x3a')]);_0x38438c[_0x558f('0x3b')]=qs['filters'](_[_0x558f('0x3c')](_0x58f657[_0x558f('0x31')],_0x1a02d8[_0x558f('0x33')]));if(_0x58f657[_0x558f('0x31')][_0x558f('0x3d')]){_0x38438c[_0x558f('0x3b')]=_['merge'](_0x38438c['where'],{'$or':_[_0x558f('0x2a')](_0x38438c[_0x558f('0x34')],function(_0x1c0f5a){var _0x41af2a={};_0x41af2a[_0x1c0f5a]={'$like':'%'+_0x58f657[_0x558f('0x31')][_0x558f('0x3d')]+'%'};return _0x41af2a;})});}_0x38438c=_['merge']({},_0x38438c,_0x58f657['options']);return _0x94d15f[_0x558f('0x9a')](_0x38438c);}})[_0x558f('0x24')](function(_0x1bbda9){if(_0x1bbda9){_0xaae0f0=_0x1bbda9['length'];if(!_0x58f657[_0x558f('0x31')][_0x558f('0x38')](_0x558f('0x39'))){_0x38438c['limit']=qs[_0x558f('0x1b')](_0x58f657[_0x558f('0x31')][_0x558f('0x1b')]);_0x38438c[_0x558f('0x1e')]=qs['offset'](_0x58f657[_0x558f('0x31')][_0x558f('0x1e')]);}return _0x94d15f['getAgents'](_0x38438c);}})[_0x558f('0x24')](function(_0x56a75b){if(_0x56a75b){return _0x56a75b?{'count':_0xaae0f0,'rows':_0x56a75b}:null;}})[_0x558f('0x24')](respondWithResult(_0x3083cd,null))[_0x558f('0x50')](handleError(_0x3083cd,null));}; \ No newline at end of file +var _0x99eb=['request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','options','Team','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','userProfileId','autoAssociation','UserProfileResource','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','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','UserVoicePrefix','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queue','pick','Queues','addQueues','Unknown\x20channel','add','ids','addAgents','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','all','TeamVoicePrefix','spread','removeAgents','isArray','getAgents','eml-format','zip-dir'];(function(_0x5beda5,_0x18199a){var _0x3d79ee=function(_0x4bfd5d){while(--_0x4bfd5d){_0x5beda5['push'](_0x5beda5['shift']());}};_0x3d79ee(++_0x18199a);}(_0x99eb,0x1d2));var _0xb99e=function(_0x1405e9,_0x23d988){_0x1405e9=_0x1405e9-0x0;var _0x124ed4=_0x99eb[_0x1405e9];return _0x124ed4;};'use strict';var emlformat=require(_0xb99e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb99e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb99e('0x2'));var moment=require('moment');var BPromise=require(_0xb99e('0x3'));var Mustache=require(_0xb99e('0x4'));var util=require(_0xb99e('0x5'));var path=require(_0xb99e('0x6'));var sox=require(_0xb99e('0x7'));var csv=require('to-csv');var ejs=require(_0xb99e('0x8'));var fs=require('fs');var fs_extra=require(_0xb99e('0x9'));var _=require(_0xb99e('0xa'));var squel=require('squel');var crypto=require(_0xb99e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb99e('0xc'));var toCsv=require(_0xb99e('0xd'));var querystring=require(_0xb99e('0xe'));var Papa=require('papaparse');var Redis=require(_0xb99e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb99e('0x10'));var as=require(_0xb99e('0x11'));var hardwareService=require(_0xb99e('0x12'));var logger=require(_0xb99e('0x13'))(_0xb99e('0x14'));var utils=require(_0xb99e('0x15'));var config=require(_0xb99e('0x16'));var licenseUtil=require(_0xb99e('0x17'));var db=require(_0xb99e('0x18'))['db'];config[_0xb99e('0x19')]=_[_0xb99e('0x1a')](config['redis'],{'host':_0xb99e('0x1b'),'port':0x18eb});var socket=require(_0xb99e('0x1c'))(new Redis(config[_0xb99e('0x19')]));require(_0xb99e('0x1d'))[_0xb99e('0x1e')](socket);function respondWithStatusCode(_0x5e3966,_0x26a947){_0x26a947=_0x26a947||0xcc;return function(_0x37ab90){if(_0x37ab90){return _0x5e3966[_0xb99e('0x1f')](_0x26a947);}return _0x5e3966[_0xb99e('0x20')](_0x26a947)[_0xb99e('0x21')]();};}function respondWithResult(_0x2dff24,_0x121cfd){_0x121cfd=_0x121cfd||0xc8;return function(_0x5219e4){if(_0x5219e4){return _0x2dff24[_0xb99e('0x20')](_0x121cfd)[_0xb99e('0x22')](_0x5219e4);}};}function respondWithFilteredResult(_0x1dadbe,_0x1c8964){return function(_0x41cdf4){if(_0x41cdf4){var _0x144ca4=typeof _0x1c8964[_0xb99e('0x23')]===_0xb99e('0x24')&&typeof _0x1c8964['limit']===_0xb99e('0x24');var _0x2c6f9b=_0x41cdf4[_0xb99e('0x25')];var _0x2a9ab4=_0x144ca4?0x0:_0x1c8964[_0xb99e('0x23')];var _0x1b05be=_0x144ca4?_0x41cdf4[_0xb99e('0x25')]:_0x1c8964[_0xb99e('0x23')]+_0x1c8964[_0xb99e('0x26')];var _0x2149cc;if(_0x1b05be>=_0x2c6f9b){_0x1b05be=_0x2c6f9b;_0x2149cc=0xc8;}else{_0x2149cc=0xce;}_0x1dadbe[_0xb99e('0x20')](_0x2149cc);return _0x1dadbe['set'](_0xb99e('0x27'),_0x2a9ab4+'-'+_0x1b05be+'/'+_0x2c6f9b)[_0xb99e('0x22')](_0x41cdf4);}return null;};}function patchUpdates(_0x40295e){return function(_0x2ad9cd){try{jsonpatch[_0xb99e('0x28')](_0x2ad9cd,_0x40295e,!![]);}catch(_0x5293fc){return BPromise[_0xb99e('0x29')](_0x5293fc);}return _0x2ad9cd[_0xb99e('0x2a')]();};}function saveUpdates(_0x50aed1,_0x5f04e4){return function(_0x242827){if(_0x242827){return _0x242827[_0xb99e('0x2b')](_0x50aed1)[_0xb99e('0x2c')](function(_0x595a69){return _0x595a69;});}return null;};}function handleEntityNotFound(_0x449ffd,_0x467efd){return function(_0x1abc8e){if(!_0x1abc8e){_0x449ffd[_0xb99e('0x1f')](0x194);}return _0x1abc8e;};}function handleError(_0x2cefc4,_0x18001b){_0x18001b=_0x18001b||0x1f4;return function(_0x2a27a4){logger[_0xb99e('0x2d')](_0x2a27a4[_0xb99e('0x2e')]);if(_0x2a27a4['name']){delete _0x2a27a4[_0xb99e('0x2f')];}_0x2cefc4['status'](_0x18001b)[_0xb99e('0x30')](_0x2a27a4);};}exports[_0xb99e('0x31')]=function(_0x31e1fc,_0x45e440){var _0xd3f741={},_0x4b6449={},_0x395d77={'count':0x0,'rows':[]};var _0x2c5a42=_['map'](db['Team'][_0xb99e('0x32')],function(_0x4af254){return{'name':_0x4af254['fieldName'],'type':_0x4af254[_0xb99e('0x33')][_0xb99e('0x34')]};});_0x4b6449['model']=_['map'](_0x2c5a42,_0xb99e('0x2f'));_0x4b6449[_0xb99e('0x35')]=_[_0xb99e('0x36')](_0x31e1fc[_0xb99e('0x35')]);_0x4b6449[_0xb99e('0x37')]=_['intersection'](_0x4b6449['model'],_0x4b6449['query']);_0xd3f741[_0xb99e('0x38')]=_[_0xb99e('0x39')](_0x4b6449[_0xb99e('0x3a')],qs[_0xb99e('0x3b')](_0x31e1fc[_0xb99e('0x35')][_0xb99e('0x3b')]));_0xd3f741[_0xb99e('0x38')]=_0xd3f741[_0xb99e('0x38')][_0xb99e('0x3c')]?_0xd3f741[_0xb99e('0x38')]:_0x4b6449[_0xb99e('0x3a')];if(!_0x31e1fc[_0xb99e('0x35')][_0xb99e('0x3d')]('nolimit')){_0xd3f741[_0xb99e('0x26')]=qs[_0xb99e('0x26')](_0x31e1fc[_0xb99e('0x35')][_0xb99e('0x26')]);_0xd3f741[_0xb99e('0x23')]=qs[_0xb99e('0x23')](_0x31e1fc[_0xb99e('0x35')]['offset']);}_0xd3f741[_0xb99e('0x3e')]=qs[_0xb99e('0x3f')](_0x31e1fc[_0xb99e('0x35')][_0xb99e('0x3f')]);_0xd3f741[_0xb99e('0x40')]=qs[_0xb99e('0x37')](_['pick'](_0x31e1fc[_0xb99e('0x35')],_0x4b6449[_0xb99e('0x37')]),_0x2c5a42);if(_0x31e1fc[_0xb99e('0x35')]['filter']){_0xd3f741[_0xb99e('0x40')]=_[_0xb99e('0x41')](_0xd3f741[_0xb99e('0x40')],{'$or':_[_0xb99e('0x42')](_0x2c5a42,function(_0x4b73a5){if(_0x4b73a5[_0xb99e('0x33')]!==_0xb99e('0x43')){var _0x54d480={};_0x54d480[_0x4b73a5['name']]={'$like':'%'+_0x31e1fc[_0xb99e('0x35')]['filter']+'%'};return _0x54d480;}})});}_0xd3f741=_['merge']({},_0xd3f741,_0x31e1fc[_0xb99e('0x44')]);var _0x1666b1={'where':_0xd3f741[_0xb99e('0x40')]};return db[_0xb99e('0x45')][_0xb99e('0x25')](_0x1666b1)[_0xb99e('0x2c')](function(_0x178b91){_0x395d77[_0xb99e('0x25')]=_0x178b91;if(_0x31e1fc['query'][_0xb99e('0x46')]){_0xd3f741[_0xb99e('0x47')]=[{'all':!![]}];}return db[_0xb99e('0x45')][_0xb99e('0x48')](_0xd3f741);})[_0xb99e('0x2c')](function(_0x4ec646){_0x395d77[_0xb99e('0x49')]=_0x4ec646;return _0x395d77;})['then'](respondWithFilteredResult(_0x45e440,_0xd3f741))[_0xb99e('0x4a')](handleError(_0x45e440,null));};exports[_0xb99e('0x4b')]=function(_0x12a2ad,_0x5609f8){var _0x2b43e0={'raw':![],'where':{'id':_0x12a2ad[_0xb99e('0x4c')]['id']}},_0x2c0369={};_0x2c0369['model']=_['keys'](db['Team'][_0xb99e('0x32')]);_0x2c0369[_0xb99e('0x35')]=_[_0xb99e('0x36')](_0x12a2ad[_0xb99e('0x35')]);_0x2c0369[_0xb99e('0x37')]=_[_0xb99e('0x39')](_0x2c0369[_0xb99e('0x3a')],_0x2c0369[_0xb99e('0x35')]);_0x2b43e0[_0xb99e('0x38')]=_[_0xb99e('0x39')](_0x2c0369[_0xb99e('0x3a')],qs[_0xb99e('0x3b')](_0x12a2ad['query'][_0xb99e('0x3b')]));_0x2b43e0['attributes']=_0x2b43e0[_0xb99e('0x38')]['length']?_0x2b43e0[_0xb99e('0x38')]:_0x2c0369[_0xb99e('0x3a')];if(_0x12a2ad[_0xb99e('0x35')][_0xb99e('0x46')]){_0x2b43e0[_0xb99e('0x47')]=[{'all':!![]}];}_0x2b43e0=_[_0xb99e('0x41')]({},_0x2b43e0,_0x12a2ad[_0xb99e('0x44')]);return db[_0xb99e('0x45')][_0xb99e('0x4d')](_0x2b43e0)['then'](handleEntityNotFound(_0x5609f8,null))[_0xb99e('0x2c')](respondWithResult(_0x5609f8,null))[_0xb99e('0x4a')](handleError(_0x5609f8,null));};exports['create']=function(_0x375893,_0x57374c){return db['Team'][_0xb99e('0x4e')](_0x375893[_0xb99e('0x4f')],{})[_0xb99e('0x2c')](function(_0x2b3325){var _0x433caf=_0x375893[_0xb99e('0x50')][_0xb99e('0x51')]({'plain':!![]});if(!_0x433caf)throw new Error(_0xb99e('0x52'));if(_0x433caf[_0xb99e('0x53')]==='user'){var _0x17f652=_0x2b3325[_0xb99e('0x51')]({'plain':!![]});var _0x250fba=_0xb99e('0x54');return db['UserProfileSection']['find']({'where':{'name':_0x250fba,'userProfileId':_0x433caf[_0xb99e('0x55')]},'raw':!![]})[_0xb99e('0x2c')](function(_0x10b67c){if(_0x10b67c&&_0x10b67c[_0xb99e('0x56')]===0x0){return db[_0xb99e('0x57')][_0xb99e('0x4e')]({'name':_0x17f652[_0xb99e('0x2f')],'resourceId':_0x17f652['id'],'type':_0x10b67c['name'],'sectionId':_0x10b67c['id']},{})[_0xb99e('0x2c')](function(){return _0x2b3325;});}else{return _0x2b3325;}})[_0xb99e('0x4a')](function(_0x351ac6){logger[_0xb99e('0x2d')](_0xb99e('0x58'),_0x351ac6);throw _0x351ac6;});}return _0x2b3325;})['then'](respondWithResult(_0x57374c,0xc9))[_0xb99e('0x4a')](handleError(_0x57374c,null));};exports[_0xb99e('0x2b')]=function(_0x4df6ed,_0xafebfc){if(_0x4df6ed[_0xb99e('0x4f')]['id']){delete _0x4df6ed['body']['id'];}return db[_0xb99e('0x45')]['find']({'where':{'id':_0x4df6ed[_0xb99e('0x4c')]['id']}})[_0xb99e('0x2c')](handleEntityNotFound(_0xafebfc,null))[_0xb99e('0x2c')](saveUpdates(_0x4df6ed[_0xb99e('0x4f')],null))['then'](respondWithResult(_0xafebfc,null))['catch'](handleError(_0xafebfc,null));};exports[_0xb99e('0x59')]=function(_0x17eb6e,_0x2eed3c){var _0x55a323=_0x17eb6e['params']['id'];var _0x10aebe=[];return db[_0xb99e('0x5a')][_0xb99e('0x5b')](function(_0x2d1c42){var _0x416127=_0xb99e('0x5c')+_0x55a323;return db[_0xb99e('0x5a')]['query'](_0x416127,{'type':db[_0xb99e('0x5d')][_0xb99e('0x5e')][_0xb99e('0x5f')],'raw':!![],'transaction':_0x2d1c42})[_0xb99e('0x2c')](function(_0x49931c){_0x10aebe=_[_0xb99e('0x42')](_0x49931c,function(_0x30da45){return Number(_0x30da45[_0xb99e('0x60')]);});})[_0xb99e('0x2c')](function(){var _0x512948=_0xb99e('0x61')+_0x55a323;return db['sequelize']['query'](_0x512948,{'type':db[_0xb99e('0x5d')][_0xb99e('0x5e')][_0xb99e('0x5f')],'raw':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x1156d7){var _0x407b6b=_[_0xb99e('0x42')](_0x1156d7,function(_0x2e3361){return Number(_0x2e3361[_0xb99e('0x62')]);});return db[_0xb99e('0x63')]['destroy']({'where':{'UserId':{'$in':_0x10aebe},'VoiceQueueId':{'$in':_0x407b6b}},'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(){var _0x1a2767=_0xb99e('0x64')+_0x55a323;return db[_0xb99e('0x5a')]['query'](_0x1a2767,{'type':db[_0xb99e('0x5d')][_0xb99e('0x5e')]['SELECT'],'raw':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x399238){var _0x580619=_['map'](_0x399238,function(_0x26a05a){return Number(_0x26a05a[_0xb99e('0x65')]);});return db[_0xb99e('0x66')][_0xb99e('0x59')]({'where':{'UserId':{'$in':_0x10aebe},'MailQueueId':{'$in':_0x580619}},'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(){var _0x35ae46=_0xb99e('0x67')+_0x55a323;return db[_0xb99e('0x5a')]['query'](_0x35ae46,{'type':db['Sequelize'][_0xb99e('0x5e')][_0xb99e('0x5f')],'raw':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x3ad59b){var _0x519ad4=_[_0xb99e('0x42')](_0x3ad59b,function(_0x4c2d0b){return Number(_0x4c2d0b[_0xb99e('0x68')]);});return db[_0xb99e('0x69')]['destroy']({'where':{'UserId':{'$in':_0x10aebe},'SmsQueueId':{'$in':_0x519ad4}},'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(){var _0x4b4694=_0xb99e('0x6a')+_0x55a323;return db[_0xb99e('0x5a')][_0xb99e('0x35')](_0x4b4694,{'type':db[_0xb99e('0x5d')][_0xb99e('0x5e')]['SELECT'],'raw':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x3e4775){var _0x2775c9=_['map'](_0x3e4775,function(_0x1bf3e2){return Number(_0x1bf3e2['ChatQueueId']);});return db[_0xb99e('0x6b')][_0xb99e('0x59')]({'where':{'UserId':{'$in':_0x10aebe},'ChatQueueId':{'$in':_0x2775c9}},'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(){var _0x21accd=_0xb99e('0x6c')+_0x55a323;return db['sequelize'][_0xb99e('0x35')](_0x21accd,{'type':db[_0xb99e('0x5d')][_0xb99e('0x5e')][_0xb99e('0x5f')],'raw':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x652f0e){var _0x2889ed=_[_0xb99e('0x42')](_0x652f0e,function(_0x2669c4){return Number(_0x2669c4['FaxQueueId']);});return db[_0xb99e('0x6d')][_0xb99e('0x59')]({'where':{'UserId':{'$in':_0x10aebe},'FaxQueueId':{'$in':_0x2889ed}},'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(){var _0xc1f687=_0xb99e('0x6e')+_0x55a323;return db[_0xb99e('0x5a')][_0xb99e('0x35')](_0xc1f687,{'type':db[_0xb99e('0x5d')][_0xb99e('0x5e')][_0xb99e('0x5f')],'raw':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x2c7c19){var _0x3f36dd=_[_0xb99e('0x42')](_0x2c7c19,function(_0x432887){return Number(_0x432887['OpenchannelQueueId']);});return db[_0xb99e('0x6f')][_0xb99e('0x59')]({'where':{'UserId':{'$in':_0x10aebe},'OpenchannelQueueId':{'$in':_0x3f36dd}},'transaction':_0x2d1c42});})['then'](function(){var _0x451a80=_0xb99e('0x70')+_0x55a323;return db[_0xb99e('0x5a')][_0xb99e('0x35')](_0x451a80,{'type':db[_0xb99e('0x5d')][_0xb99e('0x5e')][_0xb99e('0x5f')],'raw':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x111e90){var _0x1d6bc4=_['map'](_0x111e90,function(_0x13cf24){return Number(_0x13cf24['WhatsappQueueId']);});return db[_0xb99e('0x71')][_0xb99e('0x59')]({'where':{'UserId':{'$in':_0x10aebe},'WhatsappQueueId':{'$in':_0x1d6bc4}},'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(){return db['TeamVoicePrefix'][_0xb99e('0x4d')]({'where':{'TeamId':_0x55a323}});})[_0xb99e('0x2c')](function(_0x2fb31b){if(_0x2fb31b===null){return;}return db[_0xb99e('0x72')][_0xb99e('0x59')]({'where':{'UserId':{'$in':_0x10aebe},'VoicePrefixId':_0x2fb31b['VoicePrefixId']},'transaction':_0x2d1c42});})['then'](function(){return db[_0xb99e('0x45')]['destroy']({'where':{'id':_0x55a323},'cascade':!![],'transaction':_0x2d1c42});})[_0xb99e('0x2c')](function(_0x41bb24){if(_0x41bb24===0x0){_0x2eed3c[_0xb99e('0x1f')](0x194);}else{return db['UserProfileResource'][_0xb99e('0x59')]({'where':{'type':_0xb99e('0x54'),'resourceId':_0x55a323},'cascade':!![],'transaction':_0x2d1c42})[_0xb99e('0x2c')](function(){_0x2eed3c[_0xb99e('0x20')](0xcc)['end']();});}})[_0xb99e('0x4a')](function(_0x2f1cdf){_0x2eed3c['status'](0x1f4)[_0xb99e('0x30')](_0x2f1cdf);});});};exports[_0xb99e('0x73')]=function(_0x433e52,_0x4d54eb,_0x529ad6){return db[_0xb99e('0x45')][_0xb99e('0x74')]({'where':{'id':_0x433e52[_0xb99e('0x4c')]['id']}})[_0xb99e('0x2c')](handleEntityNotFound(_0x4d54eb,null))[_0xb99e('0x2c')](function(_0x2c3d91){if(!_0x433e52[_0xb99e('0x35')][_0xb99e('0x75')]||!utils[_0xb99e('0x76')](_0x433e52['query']['channel'])){throw new db[(_0xb99e('0x5d'))][(_0xb99e('0x77'))]('Unknown\x20channel');}var _0x581dba={};var _0x152add={};_0x152add['model']=_['keys'](db[_[_0xb99e('0x78')](_0x433e52[_0xb99e('0x35')]['channel'][_0xb99e('0x79')]())+_0xb99e('0x7a')]['rawAttributes']);_0x152add['query']=_[_0xb99e('0x36')](_0x433e52[_0xb99e('0x35')]);_0x152add['filters']=_[_0xb99e('0x39')](_0x152add[_0xb99e('0x3a')],_0x152add[_0xb99e('0x35')]);_0x581dba[_0xb99e('0x38')]=_[_0xb99e('0x39')](_0x152add['model'],qs[_0xb99e('0x3b')](_0x433e52[_0xb99e('0x35')]['fields']));_0x581dba['attributes']=_0x581dba[_0xb99e('0x38')][_0xb99e('0x3c')]?_0x581dba['attributes']:_0x152add['model'];_0x581dba[_0xb99e('0x26')]=qs[_0xb99e('0x26')](_0x433e52[_0xb99e('0x35')][_0xb99e('0x26')]);_0x581dba[_0xb99e('0x23')]=qs['offset'](_0x433e52[_0xb99e('0x35')]['offset']);_0x581dba[_0xb99e('0x3e')]=qs[_0xb99e('0x3f')](_0x433e52['query'][_0xb99e('0x3f')]);_0x581dba['where']=qs[_0xb99e('0x37')](_[_0xb99e('0x7b')](_0x433e52[_0xb99e('0x35')],_0x152add[_0xb99e('0x37')]));_0x581dba=_[_0xb99e('0x41')]({},_0x581dba,_0x433e52[_0xb99e('0x44')]);return _0x2c3d91[_0xb99e('0x51')+_[_0xb99e('0x78')](_0x433e52['query'][_0xb99e('0x75')][_0xb99e('0x79')]())+_0xb99e('0x7c')](_0x581dba);})[_0xb99e('0x2c')](respondWithResult(_0x4d54eb,null))['catch'](handleError(_0x4d54eb,null));};exports[_0xb99e('0x7d')]=function(_0x1d46f1,_0x33f20b,_0x280488){return db[_0xb99e('0x45')]['findOne']({'where':{'id':_0x1d46f1[_0xb99e('0x4c')]['id']}})[_0xb99e('0x2c')](function(_0xd8e3fd){if(_0xd8e3fd){if(!_0x1d46f1['body'][_0xb99e('0x75')]||!utils[_0xb99e('0x76')](_0x1d46f1[_0xb99e('0x4f')][_0xb99e('0x75')])){throw new db[(_0xb99e('0x5d'))][(_0xb99e('0x77'))](_0xb99e('0x7e'));}return _0xd8e3fd[_0xb99e('0x7f')+_[_0xb99e('0x78')](_0x1d46f1['body'][_0xb99e('0x75')][_0xb99e('0x79')]())+_0xb99e('0x7c')](_0x1d46f1[_0xb99e('0x4f')][_0xb99e('0x80')]);}return null;})[_0xb99e('0x2c')](handleEntityNotFound(_0x33f20b,null))[_0xb99e('0x2c')](respondWithStatusCode(_0x33f20b,null))[_0xb99e('0x4a')](handleError(_0x33f20b,null));};exports['removeQueues']=function(_0x4aaa6a,_0x242dda,_0x2d1a67){return db[_0xb99e('0x45')]['findOne']({'where':{'id':_0x4aaa6a[_0xb99e('0x4c')]['id']}})[_0xb99e('0x2c')](function(_0x58601e){if(_0x58601e){if(!_0x4aaa6a[_0xb99e('0x35')][_0xb99e('0x75')]||!utils[_0xb99e('0x76')](_0x4aaa6a['query'][_0xb99e('0x75')])){throw new db[(_0xb99e('0x5d'))]['ValidationError'](_0xb99e('0x7e'));}return _0x58601e['remove'+_[_0xb99e('0x78')](_0x4aaa6a['query'][_0xb99e('0x75')]['toLowerCase']())+_0xb99e('0x7c')](_0x4aaa6a[_0xb99e('0x35')][_0xb99e('0x80')]);}return null;})[_0xb99e('0x2c')](handleEntityNotFound(_0x242dda,null))[_0xb99e('0x2c')](respondWithStatusCode(_0x242dda,null))[_0xb99e('0x4a')](handleError(_0x242dda,null));};exports[_0xb99e('0x81')]=function(_0x4a6cbb,_0x110a01){var _0x324231=_['isArray'](_0x4a6cbb[_0xb99e('0x4f')]['ids'])?_0x4a6cbb[_0xb99e('0x4f')][_0xb99e('0x80')]:[_0x4a6cbb[_0xb99e('0x4f')][_0xb99e('0x80')]];var _0x523337=_0x4a6cbb[_0xb99e('0x4c')]['id'];return db[_0xb99e('0x45')][_0xb99e('0x4d')]({'where':{'id':_0x523337}})[_0xb99e('0x2c')](handleEntityNotFound(_0x110a01,null))[_0xb99e('0x2c')](function(_0x2ea99e){if(_0x2ea99e){var _0x2d66d6=[_0xb99e('0x82'),'Chat',_0xb99e('0x83'),_0xb99e('0x84'),_0xb99e('0x85'),_0xb99e('0x86'),_0xb99e('0x87')];return db[_0xb99e('0x5a')][_0xb99e('0x5b')](function(_0x3eeb3c){var _0x2e64d5=_[_0xb99e('0x42')](_0x2d66d6,function(_0x3c68b3){var _0x3a644e={'attributes':['id',_0xb99e('0x2f')]};if(_0x3c68b3==='Voice'){_0x3a644e['through']={'attributes':[_0xb99e('0x88')]};}return _0x2ea99e[_0xb99e('0x51')+_0x3c68b3+_0xb99e('0x7c')](_0x3a644e)[_0xb99e('0x2c')](function(_0x172ea9){var _0x35b16e=_[_0xb99e('0x42')](_0x172ea9,function(_0x42cd66){var _0x43a123=_[_0xb99e('0x42')](_0x324231,function(_0x85ef89){var _0x24eb74={'where':{'UserId':_0x85ef89,[_0x3c68b3+_0xb99e('0x89')]:_0x42cd66['id']},'transaction':_0x3eeb3c};if(_0x3c68b3===_0xb99e('0x82')){_0x24eb74[_0xb99e('0x1a')]={'penalty':_0x42cd66[_0xb99e('0x8a')][_0xb99e('0x88')]};}return db[_0xb99e('0x8b')+_0x3c68b3+_0xb99e('0x7a')][_0xb99e('0x8c')](_0x24eb74)[_0xb99e('0x2c')](function(){socket[_0xb99e('0x8d')](_0xb99e('0x50')+_0x3c68b3+_0xb99e('0x8e'),{'UserId':_0x85ef89,[_0x3c68b3+_0xb99e('0x89')]:_0x42cd66['id']});if(_0x3c68b3!==_0xb99e('0x82')){return;}return db[_0xb99e('0x8b')][_0xb99e('0x48')]({'where':{'id':_0x324231,'online':0x1},'attributes':['id',_0xb99e('0x2f'),_0xb99e('0x8f'),_0xb99e('0x90'),_0xb99e('0x91')],'raw':!![]})['then'](function(_0x2b0dc1){var _0x42313f=_[_0xb99e('0x42')](_0x2b0dc1,function(_0x209785){return db[_0xb99e('0x92')][_0xb99e('0x93')]({'membername':_0x209785[_0xb99e('0x2f')],'UserId':_0x209785['id'],'queue_name':_0x42cd66[_0xb99e('0x2f')],'VoiceQueueId':_0x42cd66['id'],'interface':_[_0xb99e('0x94')](_0x209785[_0xb99e('0x91')])?util['format'](_0xb99e('0x95'),_0x209785[_0xb99e('0x2f')]):_0x209785['interface'],'paused':_0x209785[_0xb99e('0x90')]||![],'penalty':_0x42cd66[_0xb99e('0x8a')][_0xb99e('0x88')]},{'transaction':_0x3eeb3c});});return Promise[_0xb99e('0x96')](_0x42313f);});});});return Promise['all'](_0x43a123);});return Promise['all'](_0x35b16e);})[_0xb99e('0x2c')](function(){return db[_0xb99e('0x97')][_0xb99e('0x74')]({'where':{'teamId':_0x523337}})['then'](function(_0x42395f){if(_0x42395f){var _0x4af5f3=_['map'](_0x324231,function(_0x4ef808){db['UserVoicePrefix']['upsert']({'UserId':_0x4ef808,'VoicePrefixId':_0x42395f['VoicePrefixId']});});return Promise[_0xb99e('0x96')](_0x4af5f3);}});});});return Promise[_0xb99e('0x96')](_0x2e64d5)['then'](function(){return _0x2ea99e['addAgents'](_0x324231,{'transaction':_0x3eeb3c})[_0xb99e('0x98')](function(_0x16b5ef){return _0x16b5ef;});});});}})[_0xb99e('0x2c')](respondWithResult(_0x110a01,null))['catch'](handleError(_0x110a01,null));};exports[_0xb99e('0x99')]=function(_0x24e30b,_0x175e1e){var _0x4efb5b=_[_0xb99e('0x9a')](_0x24e30b[_0xb99e('0x35')][_0xb99e('0x80')])?_0x24e30b[_0xb99e('0x35')][_0xb99e('0x80')]:[_0x24e30b[_0xb99e('0x35')][_0xb99e('0x80')]];var _0x1f3e6c=_0x24e30b[_0xb99e('0x4c')]['id'];return db['Team'][_0xb99e('0x4d')]({'where':{'id':_0x1f3e6c}})[_0xb99e('0x2c')](handleEntityNotFound(_0x175e1e,null))['then'](function(_0x36cb7d){if(_0x36cb7d){var _0x17e717=['Voice','Chat',_0xb99e('0x83'),_0xb99e('0x84'),_0xb99e('0x85'),_0xb99e('0x86'),'Whatsapp'];return db['sequelize']['transaction'](function(_0xee62a8){var _0x54e5b6=_['map'](_0x17e717,function(_0x23a27e){var _0x16773a={'attributes':['id','name']};return _0x36cb7d[_0xb99e('0x51')+_0x23a27e+'Queues'](_0x16773a)[_0xb99e('0x2c')](function(_0x5e004e){var _0x3a2966=_[_0xb99e('0x42')](_0x5e004e,function(_0x215903){return _0x215903[_0xb99e('0x99')](_0x4efb5b,{'transaction':_0xee62a8})[_0xb99e('0x2c')](function(){var _0x255340=_[_0xb99e('0x42')](_0x4efb5b,function(_0x5a113c){socket[_0xb99e('0x8d')](_0xb99e('0x50')+_0x23a27e+'Queue:remove',{'UserId':Number(_0x5a113c),[_0x23a27e+_0xb99e('0x89')]:_0x215903['id']});if(_0x23a27e!==_0xb99e('0x82')){return;}return db[_0xb99e('0x92')][_0xb99e('0x59')]({'where':{'VoiceQueueId':_0x215903['id'],'UserId':_0x5a113c},'transaction':_0xee62a8});});return Promise[_0xb99e('0x96')](_0x255340);});});return Promise[_0xb99e('0x96')](_0x3a2966);});});return Promise['all'](_0x54e5b6)[_0xb99e('0x2c')](function(){return _0x36cb7d['removeAgents'](_0x4efb5b,{'transaction':_0xee62a8});})[_0xb99e('0x2c')](function(){return db[_0xb99e('0x97')][_0xb99e('0x74')]({'where':{'teamId':_0x1f3e6c}})[_0xb99e('0x2c')](function(_0x230113){if(_0x230113){var _0x3d392e=_[_0xb99e('0x42')](_0x4efb5b,function(_0x43e031){db[_0xb99e('0x72')]['destroy']({'where':{'UserId':_0x43e031,'VoicePrefixId':_0x230113['VoicePrefixId']}});});return Promise[_0xb99e('0x96')](_0x3d392e);}});});});}})[_0xb99e('0x2c')](respondWithStatusCode(_0x175e1e,null))[_0xb99e('0x4a')](handleError(_0x175e1e,null));};exports[_0xb99e('0x9b')]=function(_0x20386b,_0x4abe6b,_0x257ebc){var _0x3c6a08={};var _0x499309={};var _0x1bfe9c;var _0x11f34a;return db['Team']['findOne']({'where':{'id':_0x20386b[_0xb99e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4abe6b,null))[_0xb99e('0x2c')](function(_0x10d533){if(_0x10d533){_0x1bfe9c=_0x10d533;_0x499309[_0xb99e('0x3a')]=_['keys'](db[_0xb99e('0x8b')][_0xb99e('0x32')]);_0x499309[_0xb99e('0x35')]=_[_0xb99e('0x36')](_0x20386b[_0xb99e('0x35')]);_0x499309['filters']=_[_0xb99e('0x39')](_0x499309[_0xb99e('0x3a')],_0x499309['query']);_0x3c6a08[_0xb99e('0x38')]=_[_0xb99e('0x39')](_0x499309[_0xb99e('0x3a')],qs[_0xb99e('0x3b')](_0x20386b[_0xb99e('0x35')]['fields']));_0x3c6a08[_0xb99e('0x38')]=_0x3c6a08[_0xb99e('0x38')][_0xb99e('0x3c')]?_0x3c6a08['attributes']:_0x499309['model'];_0x3c6a08[_0xb99e('0x3e')]=qs[_0xb99e('0x3f')](_0x20386b[_0xb99e('0x35')][_0xb99e('0x3f')]);_0x3c6a08[_0xb99e('0x40')]=qs[_0xb99e('0x37')](_[_0xb99e('0x7b')](_0x20386b[_0xb99e('0x35')],_0x499309[_0xb99e('0x37')]));if(_0x20386b[_0xb99e('0x35')]['filter']){_0x3c6a08[_0xb99e('0x40')]=_[_0xb99e('0x41')](_0x3c6a08[_0xb99e('0x40')],{'$or':_[_0xb99e('0x42')](_0x3c6a08[_0xb99e('0x38')],function(_0x9c6269){var _0x260572={};_0x260572[_0x9c6269]={'$like':'%'+_0x20386b['query']['filter']+'%'};return _0x260572;})});}_0x3c6a08=_[_0xb99e('0x41')]({},_0x3c6a08,_0x20386b[_0xb99e('0x44')]);return _0x1bfe9c[_0xb99e('0x9b')](_0x3c6a08);}})[_0xb99e('0x2c')](function(_0x1bf2aa){if(_0x1bf2aa){_0x11f34a=_0x1bf2aa[_0xb99e('0x3c')];if(!_0x20386b[_0xb99e('0x35')]['hasOwnProperty']('nolimit')){_0x3c6a08['limit']=qs[_0xb99e('0x26')](_0x20386b[_0xb99e('0x35')][_0xb99e('0x26')]);_0x3c6a08[_0xb99e('0x23')]=qs[_0xb99e('0x23')](_0x20386b[_0xb99e('0x35')][_0xb99e('0x23')]);}return _0x1bfe9c[_0xb99e('0x9b')](_0x3c6a08);}})[_0xb99e('0x2c')](function(_0x41b59e){if(_0x41b59e){return _0x41b59e?{'count':_0x11f34a,'rows':_0x41b59e}:null;}})[_0xb99e('0x2c')](respondWithResult(_0x4abe6b,null))[_0xb99e('0x4a')](handleError(_0x4abe6b,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index c4df17c..78b4e07 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 _0xa72d=['exports','events','../../mysqldb','Team','setMaxListeners','save','remove','hook'];(function(_0x1fede1,_0x5ee0d2){var _0x46c25a=function(_0x12979f){while(--_0x12979f){_0x1fede1['push'](_0x1fede1['shift']());}};_0x46c25a(++_0x5ee0d2);}(_0xa72d,0xc9));var _0xda72=function(_0x3353dd,_0x49fbd5){_0x3353dd=_0x3353dd-0x0;var _0xb4d998=_0xa72d[_0x3353dd];return _0xb4d998;};'use strict';var EventEmitter=require(_0xda72('0x0'));var Team=require(_0xda72('0x1'))['db'][_0xda72('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xda72('0x3')](0x0);var events={'afterCreate':_0xda72('0x4'),'afterUpdate':'update','afterDestroy':_0xda72('0x5')};function emitEvent(_0x15e938){return function(_0x303b2f,_0x44cc8a,_0x47030d){TeamEvents['emit'](_0x15e938+':'+_0x303b2f['id'],_0x303b2f);TeamEvents['emit'](_0x15e938,_0x303b2f);_0x47030d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xda72('0x6')](e,emitEvent(event));}}module[_0xda72('0x7')]=TeamEvents; \ No newline at end of file +var _0xd633=['Team','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5d7696,_0x185685){var _0x39297c=function(_0x3bfb53){while(--_0x3bfb53){_0x5d7696['push'](_0x5d7696['shift']());}};_0x39297c(++_0x185685);}(_0xd633,0xb2));var _0x3d63=function(_0x241dca,_0x397ba1){_0x241dca=_0x241dca-0x0;var _0xb7bb8b=_0xd633[_0x241dca];return _0xb7bb8b;};'use strict';var EventEmitter=require(_0x3d63('0x0'));var Team=require(_0x3d63('0x1'))['db'][_0x3d63('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3d63('0x3'),'afterUpdate':'update','afterDestroy':_0x3d63('0x4')};function emitEvent(_0x1880c3){return function(_0x571a1f,_0x32096a,_0x2b3eb8){TeamEvents[_0x3d63('0x5')](_0x1880c3+':'+_0x571a1f['id'],_0x571a1f);TeamEvents['emit'](_0x1880c3,_0x571a1f);_0x2b3eb8(null);};}for(var e in events){if(events[_0x3d63('0x6')](e)){var event=events[e];Team[_0x3d63('0x7')](e,emitEvent(event));}}module[_0x3d63('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index c98a130..cdc4365 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 _0xa329=['resolve','then','./team.attributes','get','Queues','map','setDataValue','channel','catch','exports','define','Team','teams','Chat','Fax','Mail','Sms','Whatsapp'];(function(_0x5ef892,_0x4a75ec){var _0xa61a5d=function(_0x4e5cd0){while(--_0x4e5cd0){_0x5ef892['push'](_0x5ef892['shift']());}};_0xa61a5d(++_0x4a75ec);}(_0xa329,0x122));var _0x9a32=function(_0x57cac1,_0x4d9703){_0x57cac1=_0x57cac1-0x0;var _0x28d12e=_0xa329[_0x57cac1];return _0x28d12e;};'use strict';var _=require('lodash');var attributes=require(_0x9a32('0x0'));function getQueuesByChannel(_0xd7c4ab,_0x65d30a){var _0x146d49=_0x9a32('0x1')+_0x65d30a+_0x9a32('0x2');return _0xd7c4ab[_0x146d49]()['then'](function(_0x30436b){return _[_0x9a32('0x3')](_0x30436b,function(_0x9382ad){_0x9382ad[_0x9a32('0x4')](_0x9a32('0x5'),_0x65d30a);return _0x9382ad;});})[_0x9a32('0x6')](function(_0xe3954){throw _0xe3954;});}module[_0x9a32('0x7')]=function(_0x515e20){return _0x515e20[_0x9a32('0x8')](_0x9a32('0x9'),attributes,{'tableName':_0x9a32('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x59f1db=this;var _0x4cc4fb=[_0x9a32('0xb'),_0x9a32('0xc'),_0x9a32('0xd'),'Openchannel',_0x9a32('0xe'),'Voice',_0x9a32('0xf')];return Promise[_0x9a32('0x10')]()[_0x9a32('0x11')](function(){var _0xcc169a=_[_0x9a32('0x3')](_0x4cc4fb,function(_0xfc66a6){return getQueuesByChannel(_0x59f1db,_0xfc66a6);});return Promise['all'](_0xcc169a);})[_0x9a32('0x6')](function(_0x52ca62){throw _0x52ca62;});}}});}; \ No newline at end of file +var _0x7ee4=['resolve','then','lodash','./team.attributes','get','map','setDataValue','channel','catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Voice','Whatsapp'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x7ee4,0x87));var _0x47ee=function(_0xd9ab80,_0x1f1968){_0xd9ab80=_0xd9ab80-0x0;var _0x559fc7=_0x7ee4[_0xd9ab80];return _0x559fc7;};'use strict';var _=require(_0x47ee('0x0'));var attributes=require(_0x47ee('0x1'));function getQueuesByChannel(_0x9a4c6c,_0x2d3a97){var _0x763629=_0x47ee('0x2')+_0x2d3a97+'Queues';return _0x9a4c6c[_0x763629]()['then'](function(_0x55d3ae){return _[_0x47ee('0x3')](_0x55d3ae,function(_0x506434){_0x506434[_0x47ee('0x4')](_0x47ee('0x5'),_0x2d3a97);return _0x506434;});})[_0x47ee('0x6')](function(_0x5dcfca){throw _0x5dcfca;});}module[_0x47ee('0x7')]=function(_0x4cb6e8){return _0x4cb6e8[_0x47ee('0x8')](_0x47ee('0x9'),attributes,{'tableName':_0x47ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x57268c=this;var _0x383cc3=[_0x47ee('0xb'),_0x47ee('0xc'),_0x47ee('0xd'),_0x47ee('0xe'),'Sms',_0x47ee('0xf'),_0x47ee('0x10')];return Promise[_0x47ee('0x11')]()[_0x47ee('0x12')](function(){var _0x1d4187=_['map'](_0x383cc3,function(_0x9a4b09){return getQueuesByChannel(_0x57268c,_0x9a4b09);});return Promise['all'](_0x1d4187);})['catch'](function(_0x567a62){throw _0x567a62;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 3c85a35..c228a95 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 _0xe0a6=['localhost','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x50e665,_0x2e38b8){var _0x49157d=function(_0x3dbed3){while(--_0x3dbed3){_0x50e665['push'](_0x50e665['shift']());}};_0x49157d(++_0x2e38b8);}(_0xe0a6,0xf6));var _0x6e0a=function(_0x583c9f,_0x3486f0){_0x583c9f=_0x583c9f-0x0;var _0x323dbb=_0xe0a6[_0x583c9f];return _0x323dbb;};'use strict';var _=require(_0x6e0a('0x0'));var util=require(_0x6e0a('0x1'));var moment=require(_0x6e0a('0x2'));var BPromise=require(_0x6e0a('0x3'));var rs=require(_0x6e0a('0x4'));var fs=require('fs');var Redis=require(_0x6e0a('0x5'));var db=require(_0x6e0a('0x6'))['db'];var utils=require(_0x6e0a('0x7'));var logger=require(_0x6e0a('0x8'))('rpc');var config=require(_0x6e0a('0x9'));var jayson=require(_0x6e0a('0xa'));var client=jayson[_0x6e0a('0xb')][_0x6e0a('0xc')]({'port':0x232a});config[_0x6e0a('0xd')]=_['defaults'](config[_0x6e0a('0xd')],{'host':_0x6e0a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6e0a('0xd')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x13aea8,_0x22400a,_0x325211){return new BPromise(function(_0x89753b,_0x24c356){return client[_0x6e0a('0xf')](_0x13aea8,_0x325211)[_0x6e0a('0x10')](function(_0x459fd2){logger[_0x6e0a('0x11')](_0x6e0a('0x12'),_0x22400a,_0x6e0a('0x13'));logger[_0x6e0a('0x14')](_0x6e0a('0x15'),_0x22400a,_0x6e0a('0x13'),JSON['stringify'](_0x459fd2));if(_0x459fd2[_0x6e0a('0x16')]){if(_0x459fd2[_0x6e0a('0x16')][_0x6e0a('0x17')]===0x1f4){logger[_0x6e0a('0x16')]('Team,\x20%s,\x20%s',_0x22400a,_0x459fd2[_0x6e0a('0x16')][_0x6e0a('0x18')]);return _0x24c356(_0x459fd2[_0x6e0a('0x16')][_0x6e0a('0x18')]);}logger[_0x6e0a('0x16')](_0x6e0a('0x12'),_0x22400a,_0x459fd2[_0x6e0a('0x16')][_0x6e0a('0x18')]);return _0x89753b(_0x459fd2['error'][_0x6e0a('0x18')]);}else{logger[_0x6e0a('0x11')](_0x6e0a('0x12'),_0x22400a,_0x6e0a('0x13'));_0x89753b(_0x459fd2[_0x6e0a('0x19')][_0x6e0a('0x18')]);}})['catch'](function(_0x27c66a){logger[_0x6e0a('0x16')]('Team,\x20%s,\x20%s',_0x22400a,_0x27c66a);_0x24c356(_0x27c66a);});});} \ No newline at end of file +var _0x01a5=['message','request\x20sent','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x32e477,_0x4843d0){var _0x4e2533=function(_0x52d3fe){while(--_0x52d3fe){_0x32e477['push'](_0x32e477['shift']());}};_0x4e2533(++_0x4843d0);}(_0x01a5,0x162));var _0x501a=function(_0x83649,_0x2fc6fe){_0x83649=_0x83649-0x0;var _0x1db702=_0x01a5[_0x83649];return _0x1db702;};'use strict';var _=require(_0x501a('0x0'));var util=require(_0x501a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x501a('0x2'));var fs=require('fs');var Redis=require(_0x501a('0x3'));var db=require(_0x501a('0x4'))['db'];var utils=require(_0x501a('0x5'));var logger=require(_0x501a('0x6'))(_0x501a('0x7'));var config=require(_0x501a('0x8'));var jayson=require(_0x501a('0x9'));var client=jayson['client'][_0x501a('0xa')]({'port':0x232a});config[_0x501a('0xb')]=_[_0x501a('0xc')](config['redis'],{'host':_0x501a('0xd'),'port':0x18eb});var socket=require(_0x501a('0xe'))(new Redis(config[_0x501a('0xb')]));require(_0x501a('0xf'))['register'](socket);function respondWithRpcPromise(_0xf73914,_0x28c154,_0x1a058a){return new BPromise(function(_0x507a46,_0x117a72){return client[_0x501a('0x10')](_0xf73914,_0x1a058a)[_0x501a('0x11')](function(_0x883def){logger[_0x501a('0x12')](_0x501a('0x13'),_0x28c154,'request\x20sent');logger[_0x501a('0x14')](_0x501a('0x15'),_0x28c154,'request\x20sent',JSON['stringify'](_0x883def));if(_0x883def[_0x501a('0x16')]){if(_0x883def[_0x501a('0x16')][_0x501a('0x17')]===0x1f4){logger[_0x501a('0x16')](_0x501a('0x13'),_0x28c154,_0x883def['error'][_0x501a('0x18')]);return _0x117a72(_0x883def[_0x501a('0x16')][_0x501a('0x18')]);}logger['error']('Team,\x20%s,\x20%s',_0x28c154,_0x883def['error']['message']);return _0x507a46(_0x883def[_0x501a('0x16')][_0x501a('0x18')]);}else{logger[_0x501a('0x12')](_0x501a('0x13'),_0x28c154,_0x501a('0x19'));_0x507a46(_0x883def['result']['message']);}})[_0x501a('0x1a')](function(_0x526617){logger[_0x501a('0x16')](_0x501a('0x13'),_0x28c154,_0x526617);_0x117a72(_0x526617);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index a2faa4f..32dcd06 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 _0x4ba0=['remove','emit','length','team:','./team.events'];(function(_0x576e92,_0x165314){var _0x24c32e=function(_0x1648b1){while(--_0x1648b1){_0x576e92['push'](_0x576e92['shift']());}};_0x24c32e(++_0x165314);}(_0x4ba0,0xe0));var _0x04ba=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x4ba0[_0x411017];return _0x2adeea;};'use strict';var TeamEvents=require(_0x04ba('0x0'));var events=['save',_0x04ba('0x1'),'update'];function createListener(_0x2353a5,_0x1cf1e2){return function(_0x133126){_0x1cf1e2[_0x04ba('0x2')](_0x2353a5,_0x133126);};}function removeListener(_0x5c87c2,_0x438657){return function(){TeamEvents['removeListener'](_0x5c87c2,_0x438657);};}exports['register']=function(_0x17959f){for(var _0x5b7994=0x0,_0x1ae533=events[_0x04ba('0x3')];_0x5b7994<_0x1ae533;_0x5b7994++){var _0x1e9dc8=events[_0x5b7994];var _0x37821a=createListener(_0x04ba('0x4')+_0x1e9dc8,_0x17959f);TeamEvents['on'](_0x1e9dc8,_0x37821a);}}; \ No newline at end of file +var _0x4205=['update','emit','removeListener','./team.events','remove'];(function(_0x37a074,_0x21a59f){var _0x4591ae=function(_0x4bbb48){while(--_0x4bbb48){_0x37a074['push'](_0x37a074['shift']());}};_0x4591ae(++_0x21a59f);}(_0x4205,0x1b6));var _0x5420=function(_0x713265,_0x504761){_0x713265=_0x713265-0x0;var _0x5b1687=_0x4205[_0x713265];return _0x5b1687;};'use strict';var TeamEvents=require(_0x5420('0x0'));var events=['save',_0x5420('0x1'),_0x5420('0x2')];function createListener(_0x2b7654,_0x1aebe5){return function(_0x4356a4){_0x1aebe5[_0x5420('0x3')](_0x2b7654,_0x4356a4);};}function removeListener(_0x470129,_0x4ae7c0){return function(){TeamEvents[_0x5420('0x4')](_0x470129,_0x4ae7c0);};}exports['register']=function(_0x3427be){for(var _0x1a850d=0x0,_0x376771=events['length'];_0x1a850d<_0x376771;_0x1a850d++){var _0x198c6a=events[_0x1a850d];var _0x3bd58e=createListener('team:'+_0x198c6a,_0x3427be);TeamEvents['on'](_0x198c6a,_0x3bd58e);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 0043f49..de8dd50 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 _0x5cbc=['INTEGER','sequelize'];(function(_0x47f263,_0x213ab8){var _0x2075ae=function(_0x2e0c67){while(--_0x2e0c67){_0x47f263['push'](_0x47f263['shift']());}};_0x2075ae(++_0x213ab8);}(_0x5cbc,0xfb));var _0xc5cb=function(_0x5b2f6c,_0x12efe9){_0x5b2f6c=_0x5b2f6c-0x0;var _0x4e6252=_0x5cbc[_0x5b2f6c];return _0x4e6252;};'use strict';var Sequelize=require(_0xc5cb('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xc5cb('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xc5cb('0x1')]}}; \ No newline at end of file +var _0x8ca7=['sequelize'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x8ca7,0x9b));var _0x78ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ca7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x78ca('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index cac93ff..c7b51df 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 _0x6f3e=['exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x6f3e,0x9f));var _0xe6f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6f3e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe6f3('0x0'));var util=require(_0xe6f3('0x1'));var logger=require(_0xe6f3('0x2'))(_0xe6f3('0x3'));var moment=require(_0xe6f3('0x4'));var BPromise=require(_0xe6f3('0x5'));var rp=require(_0xe6f3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6f3('0x7'));var config=require(_0xe6f3('0x8'));var attributes=require('./teamVoicePrefix.attributes');module[_0xe6f3('0x9')]=function(_0x46e7ef,_0x2723be){return _0x46e7ef['define'](_0xe6f3('0xa'),attributes,{'tableName':_0xe6f3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e8c=['request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger','api','moment','bluebird'];(function(_0x512ecf,_0x4d0b40){var _0x5f43bf=function(_0x1ddec0){while(--_0x1ddec0){_0x512ecf['push'](_0x512ecf['shift']());}};_0x5f43bf(++_0x4d0b40);}(_0x1e8c,0xd3));var _0xc1e8=function(_0x461c18,_0x5605b9){_0x461c18=_0x461c18-0x0;var _0x35501c=_0x1e8c[_0x461c18];return _0x35501c;};'use strict';var _=require('lodash');var util=require(_0xc1e8('0x0'));var logger=require(_0xc1e8('0x1'))(_0xc1e8('0x2'));var moment=require(_0xc1e8('0x3'));var BPromise=require(_0xc1e8('0x4'));var rp=require(_0xc1e8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1e8('0x6'));var config=require(_0xc1e8('0x7'));var attributes=require(_0xc1e8('0x8'));module[_0xc1e8('0x9')]=function(_0x2547e3,_0x18613e){return _0x2547e3['define'](_0xc1e8('0xa'),attributes,{'tableName':_0xc1e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 4a9fdd1..045db6b 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4b1fb4,_0x36f2e0){var _0x1617cc=function(_0x49a5ad){while(--_0x49a5ad){_0x4b1fb4['push'](_0x4b1fb4['shift']());}};_0x1617cc(++_0x36f2e0);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'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(_0x6c79a9,_0x3218e7){var _0x1f80a9=function(_0x487fc6){while(--_0x487fc6){_0x6c79a9['push'](_0x6c79a9['shift']());}};_0x1f80a9(++_0x3218e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 04feda1..780081b 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 _0x0e39=['sequelize','exports','INTEGER'];(function(_0x221e88,_0x5f2448){var _0x14de36=function(_0x409a86){while(--_0x409a86){_0x221e88['push'](_0x221e88['shift']());}};_0x14de36(++_0x5f2448);}(_0x0e39,0x11a));var _0x90e3=function(_0x3c5e45,_0x5a9916){_0x3c5e45=_0x3c5e45-0x0;var _0x2cecea=_0x0e39[_0x3c5e45];return _0x2cecea;};'use strict';var Sequelize=require(_0x90e3('0x0'));module[_0x90e3('0x1')]={'penalty':{'type':Sequelize[_0x90e3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x544f=['exports','INTEGER','sequelize'];(function(_0x429d05,_0x1a0422){var _0x3044e6=function(_0x4c0c19){while(--_0x4c0c19){_0x429d05['push'](_0x429d05['shift']());}};_0x3044e6(++_0x1a0422);}(_0x544f,0xbc));var _0xf544=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x544f[_0x1b70e3];return _0x1452ab;};'use strict';var Sequelize=require(_0xf544('0x0'));module[_0xf544('0x1')]={'penalty':{'type':Sequelize[_0xf544('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 66701a0..9d34188 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 _0xc368=['TeamVoiceQueue','team_has_voice_queues','util','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','exports'];(function(_0x383cc4,_0x86cbe7){var _0x63cd15=function(_0x3e68f0){while(--_0x3e68f0){_0x383cc4['push'](_0x383cc4['shift']());}};_0x63cd15(++_0x86cbe7);}(_0xc368,0x7b));var _0x8c36=function(_0x2b3038,_0x28ce83){_0x2b3038=_0x2b3038-0x0;var _0x285e1b=_0xc368[_0x2b3038];return _0x285e1b;};'use strict';var _=require('lodash');var util=require(_0x8c36('0x0'));var logger=require('../../config/logger')(_0x8c36('0x1'));var moment=require(_0x8c36('0x2'));var BPromise=require(_0x8c36('0x3'));var rp=require(_0x8c36('0x4'));var fs=require('fs');var path=require(_0x8c36('0x5'));var rimraf=require('rimraf');var config=require(_0x8c36('0x6'));var attributes=require(_0x8c36('0x7'));module[_0x8c36('0x8')]=function(_0x1d3660,_0x5ebfc1){return _0x1d3660['define'](_0x8c36('0x9'),attributes,{'tableName':_0x8c36('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6726=['../../config/logger','moment','bluebird','path','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','util'];(function(_0x40c7,_0x25b2c2){var _0xa0733f=function(_0x5aa983){while(--_0x5aa983){_0x40c7['push'](_0x40c7['shift']());}};_0xa0733f(++_0x25b2c2);}(_0x6726,0xdb));var _0x6672=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0x6726[_0x9d1e6b];return _0x2b3070;};'use strict';var _=require('lodash');var util=require(_0x6672('0x0'));var logger=require(_0x6672('0x1'))('api');var moment=require(_0x6672('0x2'));var BPromise=require(_0x6672('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6672('0x4'));var rimraf=require('rimraf');var config=require(_0x6672('0x5'));var attributes=require(_0x6672('0x6'));module[_0x6672('0x7')]=function(_0x40ba7e,_0x5701b9){return _0x40ba7e[_0x6672('0x8')](_0x6672('0x9'),attributes,{'tableName':_0x6672('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index e6d32e3..33aeb1d 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 _0xd7c4=['http','request','then','info','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4eaa9c,_0x3a879a){var _0x46b796=function(_0x41f4bc){while(--_0x41f4bc){_0x4eaa9c['push'](_0x4eaa9c['shift']());}};_0x46b796(++_0x3a879a);}(_0xd7c4,0x1ae));var _0x4d7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd7c4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4d7c('0x0'));var util=require(_0x4d7c('0x1'));var moment=require(_0x4d7c('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d7c('0x3'));var fs=require('fs');var Redis=require(_0x4d7c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d7c('0x5'));var logger=require(_0x4d7c('0x6'))(_0x4d7c('0x7'));var config=require(_0x4d7c('0x8'));var jayson=require(_0x4d7c('0x9'));var client=jayson['client'][_0x4d7c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3794f4,_0x3ca770,_0x2283ab){return new BPromise(function(_0x1a886d,_0x5a9d8a){return client[_0x4d7c('0xb')](_0x3794f4,_0x2283ab)[_0x4d7c('0xc')](function(_0x4301ac){logger[_0x4d7c('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3ca770,_0x4d7c('0xe'));logger['debug'](_0x4d7c('0xf'),_0x3ca770,_0x4d7c('0xe'),JSON['stringify'](_0x4301ac));if(_0x4301ac['error']){if(_0x4301ac[_0x4d7c('0x10')][_0x4d7c('0x11')]===0x1f4){logger[_0x4d7c('0x10')](_0x4d7c('0x12'),_0x3ca770,_0x4301ac[_0x4d7c('0x10')][_0x4d7c('0x13')]);return _0x5a9d8a(_0x4301ac[_0x4d7c('0x10')]['message']);}logger[_0x4d7c('0x10')](_0x4d7c('0x12'),_0x3ca770,_0x4301ac[_0x4d7c('0x10')]['message']);return _0x1a886d(_0x4301ac['error']['message']);}else{logger[_0x4d7c('0xd')](_0x4d7c('0x12'),_0x3ca770,_0x4d7c('0xe'));_0x1a886d(_0x4301ac[_0x4d7c('0x14')][_0x4d7c('0x13')]);}})[_0x4d7c('0x15')](function(_0x1bf3c7){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x3ca770,_0x1bf3c7);_0x5a9d8a(_0x1bf3c7);});});} \ No newline at end of file +var _0x20b4=['http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x211ae7,_0x44a5dc){var _0x394899=function(_0x55cae7){while(--_0x55cae7){_0x211ae7['push'](_0x211ae7['shift']());}};_0x394899(++_0x44a5dc);}(_0x20b4,0x146));var _0x420b=function(_0x42b030,_0x252cb6){_0x42b030=_0x42b030-0x0;var _0x112303=_0x20b4[_0x42b030];return _0x112303;};'use strict';var _=require(_0x420b('0x0'));var util=require(_0x420b('0x1'));var moment=require(_0x420b('0x2'));var BPromise=require(_0x420b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x420b('0x4'));var db=require(_0x420b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x420b('0x6'))(_0x420b('0x7'));var config=require('../../config/environment');var jayson=require(_0x420b('0x8'));var client=jayson[_0x420b('0x9')][_0x420b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x226510,_0x2d4d4c,_0x2fe151){return new BPromise(function(_0x5e7b0d,_0x3d2241){return client[_0x420b('0xb')](_0x226510,_0x2fe151)[_0x420b('0xc')](function(_0x5c9b33){logger[_0x420b('0xd')](_0x420b('0xe'),_0x2d4d4c,_0x420b('0xf'));logger[_0x420b('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2d4d4c,_0x420b('0xf'),JSON[_0x420b('0x11')](_0x5c9b33));if(_0x5c9b33[_0x420b('0x12')]){if(_0x5c9b33[_0x420b('0x12')][_0x420b('0x13')]===0x1f4){logger[_0x420b('0x12')](_0x420b('0xe'),_0x2d4d4c,_0x5c9b33[_0x420b('0x12')][_0x420b('0x14')]);return _0x3d2241(_0x5c9b33[_0x420b('0x12')][_0x420b('0x14')]);}logger[_0x420b('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2d4d4c,_0x5c9b33[_0x420b('0x12')][_0x420b('0x14')]);return _0x5e7b0d(_0x5c9b33[_0x420b('0x12')][_0x420b('0x14')]);}else{logger['info'](_0x420b('0xe'),_0x2d4d4c,'request\x20sent');_0x5e7b0d(_0x5c9b33['result'][_0x420b('0x14')]);}})['catch'](function(_0x131976){logger['error'](_0x420b('0xe'),_0x2d4d4c,_0x131976);_0x3d2241(_0x131976);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 268b945..47770e8 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 _0xef0a=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy'];(function(_0x6f5472,_0x41fdff){var _0x2ddb27=function(_0x220063){while(--_0x220063){_0x6f5472['push'](_0x6f5472['shift']());}};_0x2ddb27(++_0x41fdff);}(_0xef0a,0xdd));var _0xaef0=function(_0x378663,_0x419dab){_0x378663=_0x378663-0x0;var _0x55aba9=_0xef0a[_0x378663];return _0x55aba9;};'use strict';var multer=require(_0xaef0('0x0'));var util=require(_0xaef0('0x1'));var path=require(_0xaef0('0x2'));var timeout=require(_0xaef0('0x3'));var express=require(_0xaef0('0x4'));var router=express[_0xaef0('0x5')]();var fs_extra=require(_0xaef0('0x6'));var auth=require(_0xaef0('0x7'));var interaction=require(_0xaef0('0x8'));var config=require(_0xaef0('0x9'));var controller=require(_0xaef0('0xa'));router['get']('/',auth[_0xaef0('0xb')](),controller[_0xaef0('0xc')]);router[_0xaef0('0xd')](_0xaef0('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xaef0('0xf')]('/',auth[_0xaef0('0xb')](),controller[_0xaef0('0x10')]);router[_0xaef0('0x11')](_0xaef0('0xe'),auth[_0xaef0('0xb')](),controller[_0xaef0('0x12')]);router[_0xaef0('0x13')](_0xaef0('0xe'),auth['isAuthenticated'](),controller[_0xaef0('0x14')]);module[_0xaef0('0x15')]=router; \ No newline at end of file +var _0xd663=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','show','post','isAuthenticated','create','put','/:id','delete','exports'];(function(_0x1545bc,_0x39ddbe){var _0x4d1858=function(_0x522e9b){while(--_0x522e9b){_0x1545bc['push'](_0x1545bc['shift']());}};_0x4d1858(++_0x39ddbe);}(_0xd663,0x1ed));var _0x3d66=function(_0x266c49,_0x2ccaec){_0x266c49=_0x266c49-0x0;var _0x299706=_0xd663[_0x266c49];return _0x299706;};'use strict';var multer=require(_0x3d66('0x0'));var util=require(_0x3d66('0x1'));var path=require('path');var timeout=require(_0x3d66('0x2'));var express=require(_0x3d66('0x3'));var router=express[_0x3d66('0x4')]();var fs_extra=require(_0x3d66('0x5'));var auth=require(_0x3d66('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3d66('0x7'));var controller=require('./template.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3d66('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3d66('0x9')]);router[_0x3d66('0xa')]('/',auth[_0x3d66('0xb')](),controller[_0x3d66('0xc')]);router[_0x3d66('0xd')](_0x3d66('0xe'),auth[_0x3d66('0xb')](),controller['update']);router[_0x3d66('0xf')](_0x3d66('0xe'),auth[_0x3d66('0xb')](),controller['destroy']);module[_0x3d66('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index e21889b..b321c93 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 _0x26ab=['sequelize','exports','TEXT'];(function(_0x3ba27f,_0x308ae4){var _0x3511d9=function(_0xa1f427){while(--_0xa1f427){_0x3ba27f['push'](_0x3ba27f['shift']());}};_0x3511d9(++_0x308ae4);}(_0x26ab,0x16e));var _0xb26a=function(_0x3e7e99,_0x307f70){_0x3e7e99=_0x3e7e99-0x0;var _0x320794=_0x26ab[_0x3e7e99];return _0x320794;};'use strict';var Sequelize=require(_0xb26a('0x0'));module[_0xb26a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xb26a('0x2')]}}; \ No newline at end of file +var _0x0802=['exports','STRING','TEXT','sequelize'];(function(_0x253774,_0xc043ff){var _0x57b598=function(_0x5d1e12){while(--_0x5d1e12){_0x253774['push'](_0x253774['shift']());}};_0x57b598(++_0xc043ff);}(_0x0802,0x1af));var _0x2080=function(_0x56d793,_0x319830){_0x56d793=_0x56d793-0x0;var _0x16d972=_0x0802[_0x56d793];return _0x16d972;};'use strict';var Sequelize=require(_0x2080('0x0'));module[_0x2080('0x1')]={'name':{'type':Sequelize[_0x2080('0x2')]},'description':{'type':Sequelize[_0x2080('0x2')]},'html':{'type':Sequelize[_0x2080('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 8e2540e..2105a32 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 _0xf30b=['where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','error','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x51b9da,_0x1f279c){var _0x37405a=function(_0x5855bc){while(--_0x5855bc){_0x51b9da['push'](_0x51b9da['shift']());}};_0x37405a(++_0x1f279c);}(_0xf30b,0x15d));var _0xbf30=function(_0x14647d,_0x20a244){_0x14647d=_0x14647d-0x0;var _0x3a0cae=_0xf30b[_0x14647d];return _0x3a0cae;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbf30('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf30('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xbf30('0x2'));var util=require('util');var path=require(_0xbf30('0x3'));var sox=require(_0xbf30('0x4'));var csv=require(_0xbf30('0x5'));var ejs=require(_0xbf30('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf30('0x7'));var squel=require(_0xbf30('0x8'));var crypto=require(_0xbf30('0x9'));var jsforce=require(_0xbf30('0xa'));var deskjs=require(_0xbf30('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbf30('0xc'));var Papa=require(_0xbf30('0xd'));var Redis=require(_0xbf30('0xe'));var authService=require(_0xbf30('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbf30('0x10'));var hardwareService=require(_0xbf30('0x11'));var logger=require(_0xbf30('0x12'))(_0xbf30('0x13'));var utils=require(_0xbf30('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbf30('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2789de,_0x510dc2){_0x510dc2=_0x510dc2||0xcc;return function(_0xe81150){if(_0xe81150){return _0x2789de[_0xbf30('0x16')](_0x510dc2);}return _0x2789de[_0xbf30('0x17')](_0x510dc2)[_0xbf30('0x18')]();};}function respondWithResult(_0x2a284c,_0x55ab5a){_0x55ab5a=_0x55ab5a||0xc8;return function(_0x187c6e){if(_0x187c6e){return _0x2a284c[_0xbf30('0x17')](_0x55ab5a)['json'](_0x187c6e);}};}function respondWithFilteredResult(_0x4098e8,_0x55186c){return function(_0x88aae9){if(_0x88aae9){var _0xfff65c=typeof _0x55186c[_0xbf30('0x19')]==='undefined'&&typeof _0x55186c[_0xbf30('0x1a')]===_0xbf30('0x1b');var _0x3fe82d=_0x88aae9[_0xbf30('0x1c')];var _0x249600=_0xfff65c?0x0:_0x55186c[_0xbf30('0x19')];var _0x361946=_0xfff65c?_0x88aae9[_0xbf30('0x1c')]:_0x55186c[_0xbf30('0x19')]+_0x55186c['limit'];var _0x236c20;if(_0x361946>=_0x3fe82d){_0x361946=_0x3fe82d;_0x236c20=0xc8;}else{_0x236c20=0xce;}_0x4098e8[_0xbf30('0x17')](_0x236c20);return _0x4098e8[_0xbf30('0x1d')]('Content-Range',_0x249600+'-'+_0x361946+'/'+_0x3fe82d)[_0xbf30('0x1e')](_0x88aae9);}return null;};}function patchUpdates(_0x10fb1a){return function(_0x507637){try{jsonpatch[_0xbf30('0x1f')](_0x507637,_0x10fb1a,!![]);}catch(_0xe3eaa0){return BPromise[_0xbf30('0x20')](_0xe3eaa0);}return _0x507637[_0xbf30('0x21')]();};}function saveUpdates(_0x19b67f,_0x21839d){return function(_0x5b771b){if(_0x5b771b){return _0x5b771b[_0xbf30('0x22')](_0x19b67f)[_0xbf30('0x23')](function(_0x1cca80){return _0x1cca80;});}return null;};}function removeEntity(_0x2020b6,_0xd2dd38){return function(_0x1b5b14){if(_0x1b5b14){return _0x1b5b14['destroy']()[_0xbf30('0x23')](function(){var _0x16df9a=_0x1b5b14[_0xbf30('0x24')]({'plain':!![]});var _0x3594fa=_0xbf30('0x25');return db[_0xbf30('0x26')][_0xbf30('0x27')]({'where':{'type':_0x3594fa,'resourceId':_0x16df9a['id']}})[_0xbf30('0x23')](function(){return _0x1b5b14;});})[_0xbf30('0x23')](function(){_0x2020b6[_0xbf30('0x17')](0xcc)[_0xbf30('0x18')]();});}};}function handleEntityNotFound(_0x2bbdd1,_0x38af8f){return function(_0xc9cb2){if(!_0xc9cb2){_0x2bbdd1[_0xbf30('0x16')](0x194);}return _0xc9cb2;};}function handleError(_0x4ff6b8,_0x2e8735){_0x2e8735=_0x2e8735||0x1f4;return function(_0x3827bf){logger[_0xbf30('0x28')](_0x3827bf['stack']);if(_0x3827bf[_0xbf30('0x29')]){delete _0x3827bf[_0xbf30('0x29')];}_0x4ff6b8[_0xbf30('0x17')](_0x2e8735)[_0xbf30('0x2a')](_0x3827bf);};}exports[_0xbf30('0x2b')]=function(_0xcaef97,_0x1c818f){var _0x3e878c={},_0x39fdcc={},_0x4785ab={'count':0x0,'rows':[]};var _0x547a33=_[_0xbf30('0x2c')](db[_0xbf30('0x2d')][_0xbf30('0x2e')],function(_0x3db924){return{'name':_0x3db924[_0xbf30('0x2f')],'type':_0x3db924[_0xbf30('0x30')][_0xbf30('0x31')]};});_0x39fdcc[_0xbf30('0x32')]=_[_0xbf30('0x2c')](_0x547a33,_0xbf30('0x29'));_0x39fdcc[_0xbf30('0x33')]=_[_0xbf30('0x34')](_0xcaef97[_0xbf30('0x33')]);_0x39fdcc[_0xbf30('0x35')]=_[_0xbf30('0x36')](_0x39fdcc['model'],_0x39fdcc['query']);_0x3e878c[_0xbf30('0x37')]=_[_0xbf30('0x36')](_0x39fdcc[_0xbf30('0x32')],qs[_0xbf30('0x38')](_0xcaef97[_0xbf30('0x33')]['fields']));_0x3e878c[_0xbf30('0x37')]=_0x3e878c[_0xbf30('0x37')][_0xbf30('0x39')]?_0x3e878c[_0xbf30('0x37')]:_0x39fdcc[_0xbf30('0x32')];if(!_0xcaef97[_0xbf30('0x33')][_0xbf30('0x3a')](_0xbf30('0x3b'))){_0x3e878c[_0xbf30('0x1a')]=qs['limit'](_0xcaef97[_0xbf30('0x33')][_0xbf30('0x1a')]);_0x3e878c[_0xbf30('0x19')]=qs[_0xbf30('0x19')](_0xcaef97[_0xbf30('0x33')]['offset']);}_0x3e878c['order']=qs[_0xbf30('0x3c')](_0xcaef97[_0xbf30('0x33')]['sort']);_0x3e878c[_0xbf30('0x3d')]=qs[_0xbf30('0x35')](_[_0xbf30('0x3e')](_0xcaef97['query'],_0x39fdcc[_0xbf30('0x35')]),_0x547a33);if(_0xcaef97['query'][_0xbf30('0x3f')]){_0x3e878c[_0xbf30('0x3d')]=_['merge'](_0x3e878c[_0xbf30('0x3d')],{'$or':_[_0xbf30('0x2c')](_0x547a33,function(_0x59ee0d){if(_0x59ee0d['type']!==_0xbf30('0x40')){var _0x258eab={};_0x258eab[_0x59ee0d[_0xbf30('0x29')]]={'$like':'%'+_0xcaef97[_0xbf30('0x33')][_0xbf30('0x3f')]+'%'};return _0x258eab;}})});}_0x3e878c=_[_0xbf30('0x41')]({},_0x3e878c,_0xcaef97[_0xbf30('0x42')]);var _0x292846={'where':_0x3e878c['where']};return db[_0xbf30('0x2d')][_0xbf30('0x1c')](_0x292846)[_0xbf30('0x23')](function(_0x28ebbc){_0x4785ab[_0xbf30('0x1c')]=_0x28ebbc;if(_0xcaef97[_0xbf30('0x33')][_0xbf30('0x43')]){_0x3e878c[_0xbf30('0x44')]=[{'all':!![]}];}return db['Template']['findAll'](_0x3e878c);})[_0xbf30('0x23')](function(_0x4d425e){_0x4785ab[_0xbf30('0x45')]=_0x4d425e;return _0x4785ab;})['then'](respondWithFilteredResult(_0x1c818f,_0x3e878c))[_0xbf30('0x46')](handleError(_0x1c818f,null));};exports['show']=function(_0x2cce1e,_0x43bd88){var _0x462ec9={'raw':!![],'where':{'id':_0x2cce1e[_0xbf30('0x47')]['id']}},_0x3b2036={};_0x3b2036[_0xbf30('0x32')]=_[_0xbf30('0x34')](db['Template'][_0xbf30('0x2e')]);_0x3b2036['query']=_[_0xbf30('0x34')](_0x2cce1e[_0xbf30('0x33')]);_0x3b2036[_0xbf30('0x35')]=_[_0xbf30('0x36')](_0x3b2036['model'],_0x3b2036['query']);_0x462ec9[_0xbf30('0x37')]=_[_0xbf30('0x36')](_0x3b2036[_0xbf30('0x32')],qs[_0xbf30('0x38')](_0x2cce1e['query'][_0xbf30('0x38')]));_0x462ec9[_0xbf30('0x37')]=_0x462ec9[_0xbf30('0x37')][_0xbf30('0x39')]?_0x462ec9[_0xbf30('0x37')]:_0x3b2036[_0xbf30('0x32')];if(_0x2cce1e['query']['includeAll']){_0x462ec9[_0xbf30('0x44')]=[{'all':!![]}];}_0x462ec9=_[_0xbf30('0x41')]({},_0x462ec9,_0x2cce1e[_0xbf30('0x42')]);return db['Template'][_0xbf30('0x48')](_0x462ec9)[_0xbf30('0x23')](handleEntityNotFound(_0x43bd88,null))[_0xbf30('0x23')](respondWithResult(_0x43bd88,null))[_0xbf30('0x46')](handleError(_0x43bd88,null));};exports[_0xbf30('0x49')]=function(_0x2fb3f0,_0x2c3671){return db['Template'][_0xbf30('0x49')](_0x2fb3f0['body'],{})[_0xbf30('0x23')](function(_0x5235f6){var _0x193ab4=_0x2fb3f0['user'][_0xbf30('0x24')]({'plain':!![]});if(!_0x193ab4)throw new Error(_0xbf30('0x4a'));if(_0x193ab4[_0xbf30('0x4b')]===_0xbf30('0x4c')){var _0x3573c3=_0x5235f6[_0xbf30('0x24')]({'plain':!![]});var _0x4146b4=_0xbf30('0x25');return db[_0xbf30('0x4d')][_0xbf30('0x48')]({'where':{'name':_0x4146b4,'userProfileId':_0x193ab4[_0xbf30('0x4e')]},'raw':!![]})['then'](function(_0x322e79){if(_0x322e79&&_0x322e79[_0xbf30('0x4f')]===0x0){return db[_0xbf30('0x26')][_0xbf30('0x49')]({'name':_0x3573c3[_0xbf30('0x29')],'resourceId':_0x3573c3['id'],'type':_0x322e79[_0xbf30('0x29')],'sectionId':_0x322e79['id']},{})[_0xbf30('0x23')](function(){return _0x5235f6;});}else{return _0x5235f6;}})[_0xbf30('0x46')](function(_0xb6f185){logger['error'](_0xbf30('0x50'),_0xb6f185);throw _0xb6f185;});}return _0x5235f6;})[_0xbf30('0x23')](respondWithResult(_0x2c3671,0xc9))[_0xbf30('0x46')](handleError(_0x2c3671,null));};exports[_0xbf30('0x22')]=function(_0x2075a1,_0x46e0b2){if(_0x2075a1['body']['id']){delete _0x2075a1[_0xbf30('0x51')]['id'];}return db[_0xbf30('0x2d')][_0xbf30('0x48')]({'where':{'id':_0x2075a1[_0xbf30('0x47')]['id']}})[_0xbf30('0x23')](handleEntityNotFound(_0x46e0b2,null))['then'](saveUpdates(_0x2075a1['body'],null))[_0xbf30('0x23')](respondWithResult(_0x46e0b2,null))['catch'](handleError(_0x46e0b2,null));};exports[_0xbf30('0x27')]=function(_0x2d6746,_0x1d2479){return db[_0xbf30('0x2d')][_0xbf30('0x48')]({'where':{'id':_0x2d6746[_0xbf30('0x47')]['id']}})[_0xbf30('0x23')](handleEntityNotFound(_0x1d2479,null))[_0xbf30('0x23')](removeEntity(_0x1d2479,null))[_0xbf30('0x46')](handleError(_0x1d2479,null));}; \ No newline at end of file +var _0x9ed4=['catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','destroy','Templates','then','sendStatus','error','name','send','index','map','Template','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','include','find'];(function(_0x54edb1,_0x407378){var _0x53dedc=function(_0xb92772){while(--_0xb92772){_0x54edb1['push'](_0x54edb1['shift']());}};_0x53dedc(++_0x407378);}(_0x9ed4,0x152));var _0x49ed=function(_0x1016eb,_0x1429f9){_0x1016eb=_0x1016eb-0x0;var _0x5db53c=_0x9ed4[_0x1016eb];return _0x5db53c;};'use strict';var emlformat=require(_0x49ed('0x0'));var rimraf=require(_0x49ed('0x1'));var zipdir=require(_0x49ed('0x2'));var jsonpatch=require(_0x49ed('0x3'));var rp=require(_0x49ed('0x4'));var moment=require('moment');var BPromise=require(_0x49ed('0x5'));var Mustache=require(_0x49ed('0x6'));var util=require(_0x49ed('0x7'));var path=require(_0x49ed('0x8'));var sox=require(_0x49ed('0x9'));var csv=require(_0x49ed('0xa'));var ejs=require(_0x49ed('0xb'));var fs=require('fs');var fs_extra=require(_0x49ed('0xc'));var _=require(_0x49ed('0xd'));var squel=require(_0x49ed('0xe'));var crypto=require('crypto');var jsforce=require(_0x49ed('0xf'));var deskjs=require(_0x49ed('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x49ed('0x11'));var Redis=require(_0x49ed('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x49ed('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x49ed('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49ed('0x15'));var db=require(_0x49ed('0x16'))['db'];function respondWithStatusCode(_0x36a375,_0x257345){_0x257345=_0x257345||0xcc;return function(_0x4010b9){if(_0x4010b9){return _0x36a375['sendStatus'](_0x257345);}return _0x36a375['status'](_0x257345)['end']();};}function respondWithResult(_0x211f52,_0x460a62){_0x460a62=_0x460a62||0xc8;return function(_0xd1d738){if(_0xd1d738){return _0x211f52[_0x49ed('0x17')](_0x460a62)['json'](_0xd1d738);}};}function respondWithFilteredResult(_0xd5669d,_0x56e394){return function(_0x132eef){if(_0x132eef){var _0x1285e7=typeof _0x56e394['offset']===_0x49ed('0x18')&&typeof _0x56e394[_0x49ed('0x19')]===_0x49ed('0x18');var _0x5e4302=_0x132eef[_0x49ed('0x1a')];var _0x57ce70=_0x1285e7?0x0:_0x56e394['offset'];var _0x15e037=_0x1285e7?_0x132eef['count']:_0x56e394[_0x49ed('0x1b')]+_0x56e394[_0x49ed('0x19')];var _0x42b583;if(_0x15e037>=_0x5e4302){_0x15e037=_0x5e4302;_0x42b583=0xc8;}else{_0x42b583=0xce;}_0xd5669d[_0x49ed('0x17')](_0x42b583);return _0xd5669d['set'](_0x49ed('0x1c'),_0x57ce70+'-'+_0x15e037+'/'+_0x5e4302)[_0x49ed('0x1d')](_0x132eef);}return null;};}function patchUpdates(_0x1707a3){return function(_0x3ddd0b){try{jsonpatch[_0x49ed('0x1e')](_0x3ddd0b,_0x1707a3,!![]);}catch(_0x4af24e){return BPromise[_0x49ed('0x1f')](_0x4af24e);}return _0x3ddd0b[_0x49ed('0x20')]();};}function saveUpdates(_0x259734,_0x588581){return function(_0x531761){if(_0x531761){return _0x531761[_0x49ed('0x21')](_0x259734)['then'](function(_0x535731){return _0x535731;});}return null;};}function removeEntity(_0x55d2df,_0x52fa4b){return function(_0x17dc31){if(_0x17dc31){return _0x17dc31[_0x49ed('0x22')]()['then'](function(){var _0xf7d966=_0x17dc31['get']({'plain':!![]});var _0x1e722d=_0x49ed('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x1e722d,'resourceId':_0xf7d966['id']}})['then'](function(){return _0x17dc31;});})[_0x49ed('0x24')](function(){_0x55d2df['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a755a,_0x693bcf){return function(_0x407f46){if(!_0x407f46){_0x2a755a[_0x49ed('0x25')](0x194);}return _0x407f46;};}function handleError(_0x337027,_0x534de1){_0x534de1=_0x534de1||0x1f4;return function(_0x2fe34a){logger[_0x49ed('0x26')](_0x2fe34a['stack']);if(_0x2fe34a[_0x49ed('0x27')]){delete _0x2fe34a[_0x49ed('0x27')];}_0x337027[_0x49ed('0x17')](_0x534de1)[_0x49ed('0x28')](_0x2fe34a);};}exports[_0x49ed('0x29')]=function(_0x33ef22,_0x4a8604){var _0xa385b3={},_0x50d7b9={},_0x384893={'count':0x0,'rows':[]};var _0x44c37a=_[_0x49ed('0x2a')](db[_0x49ed('0x2b')]['rawAttributes'],function(_0x1fcd2e){return{'name':_0x1fcd2e[_0x49ed('0x2c')],'type':_0x1fcd2e['type'][_0x49ed('0x2d')]};});_0x50d7b9[_0x49ed('0x2e')]=_[_0x49ed('0x2a')](_0x44c37a,_0x49ed('0x27'));_0x50d7b9[_0x49ed('0x2f')]=_[_0x49ed('0x30')](_0x33ef22[_0x49ed('0x2f')]);_0x50d7b9[_0x49ed('0x31')]=_[_0x49ed('0x32')](_0x50d7b9[_0x49ed('0x2e')],_0x50d7b9['query']);_0xa385b3[_0x49ed('0x33')]=_[_0x49ed('0x32')](_0x50d7b9[_0x49ed('0x2e')],qs[_0x49ed('0x34')](_0x33ef22['query'][_0x49ed('0x34')]));_0xa385b3[_0x49ed('0x33')]=_0xa385b3[_0x49ed('0x33')][_0x49ed('0x35')]?_0xa385b3['attributes']:_0x50d7b9[_0x49ed('0x2e')];if(!_0x33ef22[_0x49ed('0x2f')][_0x49ed('0x36')](_0x49ed('0x37'))){_0xa385b3[_0x49ed('0x19')]=qs[_0x49ed('0x19')](_0x33ef22[_0x49ed('0x2f')]['limit']);_0xa385b3[_0x49ed('0x1b')]=qs[_0x49ed('0x1b')](_0x33ef22[_0x49ed('0x2f')]['offset']);}_0xa385b3[_0x49ed('0x38')]=qs['sort'](_0x33ef22[_0x49ed('0x2f')][_0x49ed('0x39')]);_0xa385b3[_0x49ed('0x3a')]=qs[_0x49ed('0x31')](_[_0x49ed('0x3b')](_0x33ef22[_0x49ed('0x2f')],_0x50d7b9[_0x49ed('0x31')]),_0x44c37a);if(_0x33ef22[_0x49ed('0x2f')][_0x49ed('0x3c')]){_0xa385b3[_0x49ed('0x3a')]=_[_0x49ed('0x3d')](_0xa385b3[_0x49ed('0x3a')],{'$or':_[_0x49ed('0x2a')](_0x44c37a,function(_0x52135b){if(_0x52135b[_0x49ed('0x3e')]!==_0x49ed('0x3f')){var _0x47bceb={};_0x47bceb[_0x52135b['name']]={'$like':'%'+_0x33ef22[_0x49ed('0x2f')][_0x49ed('0x3c')]+'%'};return _0x47bceb;}})});}_0xa385b3=_[_0x49ed('0x3d')]({},_0xa385b3,_0x33ef22[_0x49ed('0x40')]);var _0xc4a5b3={'where':_0xa385b3[_0x49ed('0x3a')]};return db['Template'][_0x49ed('0x1a')](_0xc4a5b3)[_0x49ed('0x24')](function(_0x5a641e){_0x384893[_0x49ed('0x1a')]=_0x5a641e;if(_0x33ef22[_0x49ed('0x2f')][_0x49ed('0x41')]){_0xa385b3['include']=[{'all':!![]}];}return db[_0x49ed('0x2b')][_0x49ed('0x42')](_0xa385b3);})[_0x49ed('0x24')](function(_0x39042f){_0x384893['rows']=_0x39042f;return _0x384893;})[_0x49ed('0x24')](respondWithFilteredResult(_0x4a8604,_0xa385b3))['catch'](handleError(_0x4a8604,null));};exports[_0x49ed('0x43')]=function(_0x519183,_0x259db2){var _0x3885ce={'raw':!![],'where':{'id':_0x519183[_0x49ed('0x44')]['id']}},_0x2e495d={};_0x2e495d[_0x49ed('0x2e')]=_[_0x49ed('0x30')](db[_0x49ed('0x2b')][_0x49ed('0x45')]);_0x2e495d[_0x49ed('0x2f')]=_[_0x49ed('0x30')](_0x519183[_0x49ed('0x2f')]);_0x2e495d['filters']=_[_0x49ed('0x32')](_0x2e495d[_0x49ed('0x2e')],_0x2e495d[_0x49ed('0x2f')]);_0x3885ce[_0x49ed('0x33')]=_[_0x49ed('0x32')](_0x2e495d[_0x49ed('0x2e')],qs[_0x49ed('0x34')](_0x519183['query']['fields']));_0x3885ce['attributes']=_0x3885ce['attributes']['length']?_0x3885ce[_0x49ed('0x33')]:_0x2e495d['model'];if(_0x519183[_0x49ed('0x2f')][_0x49ed('0x41')]){_0x3885ce[_0x49ed('0x46')]=[{'all':!![]}];}_0x3885ce=_[_0x49ed('0x3d')]({},_0x3885ce,_0x519183[_0x49ed('0x40')]);return db[_0x49ed('0x2b')][_0x49ed('0x47')](_0x3885ce)[_0x49ed('0x24')](handleEntityNotFound(_0x259db2,null))[_0x49ed('0x24')](respondWithResult(_0x259db2,null))[_0x49ed('0x48')](handleError(_0x259db2,null));};exports[_0x49ed('0x49')]=function(_0x3b5624,_0x2ea8c7){return db[_0x49ed('0x2b')][_0x49ed('0x49')](_0x3b5624['body'],{})[_0x49ed('0x24')](function(_0x545d89){var _0x4771f4=_0x3b5624[_0x49ed('0x4a')]['get']({'plain':!![]});if(!_0x4771f4)throw new Error(_0x49ed('0x4b'));if(_0x4771f4[_0x49ed('0x4c')]===_0x49ed('0x4a')){var _0x26b63a=_0x545d89[_0x49ed('0x4d')]({'plain':!![]});var _0x189c97='Templates';return db[_0x49ed('0x4e')][_0x49ed('0x47')]({'where':{'name':_0x189c97,'userProfileId':_0x4771f4['userProfileId']},'raw':!![]})[_0x49ed('0x24')](function(_0x4dc080){if(_0x4dc080&&_0x4dc080['autoAssociation']===0x0){return db[_0x49ed('0x4f')][_0x49ed('0x49')]({'name':_0x26b63a[_0x49ed('0x27')],'resourceId':_0x26b63a['id'],'type':_0x4dc080['name'],'sectionId':_0x4dc080['id']},{})[_0x49ed('0x24')](function(){return _0x545d89;});}else{return _0x545d89;}})[_0x49ed('0x48')](function(_0x2b6096){logger[_0x49ed('0x26')](_0x49ed('0x50'),_0x2b6096);throw _0x2b6096;});}return _0x545d89;})[_0x49ed('0x24')](respondWithResult(_0x2ea8c7,0xc9))[_0x49ed('0x48')](handleError(_0x2ea8c7,null));};exports[_0x49ed('0x21')]=function(_0x4b8ca5,_0x2b4067){if(_0x4b8ca5[_0x49ed('0x51')]['id']){delete _0x4b8ca5[_0x49ed('0x51')]['id'];}return db[_0x49ed('0x2b')][_0x49ed('0x47')]({'where':{'id':_0x4b8ca5[_0x49ed('0x44')]['id']}})[_0x49ed('0x24')](handleEntityNotFound(_0x2b4067,null))['then'](saveUpdates(_0x4b8ca5[_0x49ed('0x51')],null))[_0x49ed('0x24')](respondWithResult(_0x2b4067,null))[_0x49ed('0x48')](handleError(_0x2b4067,null));};exports['destroy']=function(_0x2f69e4,_0x28f710){return db[_0x49ed('0x2b')][_0x49ed('0x47')]({'where':{'id':_0x2f69e4[_0x49ed('0x44')]['id']}})[_0x49ed('0x24')](handleEntityNotFound(_0x28f710,null))[_0x49ed('0x24')](removeEntity(_0x28f710,null))[_0x49ed('0x48')](handleError(_0x28f710,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 7f7a85b..8cb8bcf 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 _0x9adc=['bluebird','request-promise','path','rimraf','./template.attributes','exports','lodash','api','moment'];(function(_0x820f9f,_0x4fbcac){var _0x12e11d=function(_0x4c8dfb){while(--_0x4c8dfb){_0x820f9f['push'](_0x820f9f['shift']());}};_0x12e11d(++_0x4fbcac);}(_0x9adc,0x14a));var _0xc9ad=function(_0x512bf2,_0x59015b){_0x512bf2=_0x512bf2-0x0;var _0x236306=_0x9adc[_0x512bf2];return _0x236306;};'use strict';var _=require(_0xc9ad('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc9ad('0x1'));var moment=require(_0xc9ad('0x2'));var BPromise=require(_0xc9ad('0x3'));var rp=require(_0xc9ad('0x4'));var fs=require('fs');var path=require(_0xc9ad('0x5'));var rimraf=require(_0xc9ad('0x6'));var config=require('../../config/environment');var attributes=require(_0xc9ad('0x7'));module[_0xc9ad('0x8')]=function(_0x1fa3b5,_0x140b5f){return _0x1fa3b5['define']('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x147f=['./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x201d8e,_0x46f74b){var _0x403d73=function(_0x3dc76a){while(--_0x3dc76a){_0x201d8e['push'](_0x201d8e['shift']());}};_0x403d73(++_0x46f74b);}(_0x147f,0x19a));var _0xf147=function(_0xc4c7eb,_0x5768e1){_0xc4c7eb=_0xc4c7eb-0x0;var _0xcf775e=_0x147f[_0xc4c7eb];return _0xcf775e;};'use strict';var _=require(_0xf147('0x0'));var util=require(_0xf147('0x1'));var logger=require(_0xf147('0x2'))(_0xf147('0x3'));var moment=require(_0xf147('0x4'));var BPromise=require(_0xf147('0x5'));var rp=require(_0xf147('0x6'));var fs=require('fs');var path=require(_0xf147('0x7'));var rimraf=require(_0xf147('0x8'));var config=require(_0xf147('0x9'));var attributes=require(_0xf147('0xa'));module[_0xf147('0xb')]=function(_0x4920a2,_0x3f6259){return _0x4920a2[_0xf147('0xc')](_0xf147('0xd'),attributes,{'tableName':_0xf147('0xe'),'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 4b20797..52088a5 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 _0xa940=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','options','raw','attributes','include','map','model','lodash','util','moment','bluebird'];(function(_0x5f2168,_0x31adeb){var _0x379183=function(_0x723ccb){while(--_0x723ccb){_0x5f2168['push'](_0x5f2168['shift']());}};_0x379183(++_0x31adeb);}(_0xa940,0x113));var _0x0a94=function(_0x4af4e3,_0x3164ad){_0x4af4e3=_0x4af4e3-0x0;var _0x555293=_0xa940[_0x4af4e3];return _0x555293;};'use strict';var _=require(_0x0a94('0x0'));var util=require(_0x0a94('0x1'));var moment=require(_0x0a94('0x2'));var BPromise=require(_0x0a94('0x3'));var rs=require(_0x0a94('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0a94('0x5'));var logger=require(_0x0a94('0x6'))(_0x0a94('0x7'));var config=require(_0x0a94('0x8'));var jayson=require(_0x0a94('0x9'));var client=jayson[_0x0a94('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a05cc,_0x481b8c,_0x5e0888){return new BPromise(function(_0x2f24fa,_0x795d77){return client['request'](_0x3a05cc,_0x5e0888)[_0x0a94('0xb')](function(_0x163814){logger[_0x0a94('0xc')](_0x0a94('0xd'),_0x481b8c,_0x0a94('0xe'));logger[_0x0a94('0xf')](_0x0a94('0x10'),_0x481b8c,_0x0a94('0xe'),JSON[_0x0a94('0x11')](_0x163814));if(_0x163814[_0x0a94('0x12')]){if(_0x163814['error'][_0x0a94('0x13')]===0x1f4){logger['error'](_0x0a94('0xd'),_0x481b8c,_0x163814[_0x0a94('0x12')][_0x0a94('0x14')]);return _0x795d77(_0x163814[_0x0a94('0x12')]['message']);}logger[_0x0a94('0x12')](_0x0a94('0xd'),_0x481b8c,_0x163814[_0x0a94('0x12')][_0x0a94('0x14')]);return _0x2f24fa(_0x163814[_0x0a94('0x12')][_0x0a94('0x14')]);}else{logger[_0x0a94('0xc')](_0x0a94('0xd'),_0x481b8c,'request\x20sent');_0x2f24fa(_0x163814[_0x0a94('0x15')][_0x0a94('0x14')]);}})[_0x0a94('0x16')](function(_0x4d3799){logger[_0x0a94('0x12')](_0x0a94('0xd'),_0x481b8c,_0x4d3799);_0x795d77(_0x4d3799);});});}exports[_0x0a94('0x17')]=function(_0x24417d){var _0x5b82ee=this;return new Promise(function(_0x4efa25,_0x57697e){return db[_0x0a94('0x18')]['findAll']({'raw':_0x24417d[_0x0a94('0x19')]?_0x24417d[_0x0a94('0x19')][_0x0a94('0x1a')]===undefined?!![]:![]:!![],'where':_0x24417d[_0x0a94('0x19')]?_0x24417d[_0x0a94('0x19')]['where']||null:null,'attributes':_0x24417d[_0x0a94('0x19')]?_0x24417d[_0x0a94('0x19')][_0x0a94('0x1b')]||null:null,'limit':_0x24417d[_0x0a94('0x19')]?_0x24417d['options']['limit']||null:null,'include':_0x24417d[_0x0a94('0x19')]?_0x24417d['options'][_0x0a94('0x1c')]?_[_0x0a94('0x1d')](_0x24417d[_0x0a94('0x19')][_0x0a94('0x1c')],function(_0x100fd2){return{'model':db[_0x100fd2[_0x0a94('0x1e')]],'as':_0x100fd2['as'],'attributes':_0x100fd2[_0x0a94('0x1b')],'include':_0x100fd2[_0x0a94('0x1c')]?_[_0x0a94('0x1d')](_0x100fd2[_0x0a94('0x1c')],function(_0xb2d3f){return{'model':db[_0xb2d3f[_0x0a94('0x1e')]],'as':_0xb2d3f['as'],'attributes':_0xb2d3f[_0x0a94('0x1b')],'include':_0xb2d3f[_0x0a94('0x1c')]?_['map'](_0xb2d3f['include'],function(_0x3f9bb0){return{'model':db[_0x3f9bb0[_0x0a94('0x1e')]],'as':_0x3f9bb0['as'],'attributes':_0x3f9bb0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfeddb4){logger[_0x0a94('0xc')](_0x0a94('0x17'),_0x24417d);logger[_0x0a94('0xf')](_0x0a94('0x17'),_0x24417d,JSON[_0x0a94('0x11')](_0xfeddb4));_0x4efa25(_0xfeddb4);})[_0x0a94('0x16')](function(_0x197911){logger['error'](_0x0a94('0x17'),_0x197911[_0x0a94('0x14')],_0x24417d);_0x57697e(_0x5b82ee[_0x0a94('0x12')](0x1f4,_0x197911[_0x0a94('0x14')]));});});}; \ No newline at end of file +var _0x871e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','stringify','lodash','util','bluebird','randomstring'];(function(_0x5c1e8e,_0x17f1ae){var _0x38d545=function(_0x48d1a9){while(--_0x48d1a9){_0x5c1e8e['push'](_0x5c1e8e['shift']());}};_0x38d545(++_0x17f1ae);}(_0x871e,0x65));var _0xe871=function(_0xabb8c0,_0x2bb6f2){_0xabb8c0=_0xabb8c0-0x0;var _0x244e48=_0x871e[_0xabb8c0];return _0x244e48;};'use strict';var _=require(_0xe871('0x0'));var util=require(_0xe871('0x1'));var moment=require('moment');var BPromise=require(_0xe871('0x2'));var rs=require(_0xe871('0x3'));var fs=require('fs');var Redis=require(_0xe871('0x4'));var db=require(_0xe871('0x5'))['db'];var utils=require(_0xe871('0x6'));var logger=require(_0xe871('0x7'))(_0xe871('0x8'));var config=require(_0xe871('0x9'));var jayson=require(_0xe871('0xa'));var client=jayson['client'][_0xe871('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d2af4,_0x403e5b,_0x2fef70){return new BPromise(function(_0x4c4c52,_0x3b67b5){return client[_0xe871('0xc')](_0x1d2af4,_0x2fef70)[_0xe871('0xd')](function(_0x54787d){logger[_0xe871('0xe')](_0xe871('0xf'),_0x403e5b,_0xe871('0x10'));logger[_0xe871('0x11')](_0xe871('0x12'),_0x403e5b,_0xe871('0x10'),JSON['stringify'](_0x54787d));if(_0x54787d[_0xe871('0x13')]){if(_0x54787d['error']['code']===0x1f4){logger[_0xe871('0x13')](_0xe871('0xf'),_0x403e5b,_0x54787d['error'][_0xe871('0x14')]);return _0x3b67b5(_0x54787d[_0xe871('0x13')]['message']);}logger[_0xe871('0x13')](_0xe871('0xf'),_0x403e5b,_0x54787d[_0xe871('0x13')][_0xe871('0x14')]);return _0x4c4c52(_0x54787d['error']['message']);}else{logger[_0xe871('0xe')](_0xe871('0xf'),_0x403e5b,_0xe871('0x10'));_0x4c4c52(_0x54787d[_0xe871('0x15')][_0xe871('0x14')]);}})[_0xe871('0x16')](function(_0x21466d){logger['error'](_0xe871('0xf'),_0x403e5b,_0x21466d);_0x3b67b5(_0x21466d);});});}exports[_0xe871('0x17')]=function(_0x4c3f3b){var _0x310aa2=this;return new Promise(function(_0x24b0c3,_0x43d25d){return db[_0xe871('0x18')][_0xe871('0x19')]({'raw':_0x4c3f3b[_0xe871('0x1a')]?_0x4c3f3b[_0xe871('0x1a')][_0xe871('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c3f3b['options']?_0x4c3f3b[_0xe871('0x1a')][_0xe871('0x1c')]||null:null,'attributes':_0x4c3f3b[_0xe871('0x1a')]?_0x4c3f3b['options'][_0xe871('0x1d')]||null:null,'limit':_0x4c3f3b[_0xe871('0x1a')]?_0x4c3f3b[_0xe871('0x1a')][_0xe871('0x1e')]||null:null,'include':_0x4c3f3b[_0xe871('0x1a')]?_0x4c3f3b['options'][_0xe871('0x1f')]?_[_0xe871('0x20')](_0x4c3f3b['options']['include'],function(_0x3d0bae){return{'model':db[_0x3d0bae[_0xe871('0x21')]],'as':_0x3d0bae['as'],'attributes':_0x3d0bae[_0xe871('0x1d')],'include':_0x3d0bae[_0xe871('0x1f')]?_[_0xe871('0x20')](_0x3d0bae['include'],function(_0x4e3015){return{'model':db[_0x4e3015[_0xe871('0x21')]],'as':_0x4e3015['as'],'attributes':_0x4e3015[_0xe871('0x1d')],'include':_0x4e3015['include']?_['map'](_0x4e3015[_0xe871('0x1f')],function(_0xf8ee0a){return{'model':db[_0xf8ee0a[_0xe871('0x21')]],'as':_0xf8ee0a['as'],'attributes':_0xf8ee0a[_0xe871('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe871('0xd')](function(_0x400762){logger['info'](_0xe871('0x17'),_0x4c3f3b);logger[_0xe871('0x11')]('GetTemplate',_0x4c3f3b,JSON[_0xe871('0x22')](_0x400762));_0x24b0c3(_0x400762);})[_0xe871('0x16')](function(_0x56a676){logger['error'](_0xe871('0x17'),_0x56a676[_0xe871('0x14')],_0x4c3f3b);_0x43d25d(_0x310aa2[_0xe871('0x13')](0x1f4,_0x56a676['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 22b525f..ac3ff3e 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 _0x334f=['index','get','/:id','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAnyCondition','addAction','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x178307,_0x57a662){var _0x47d971=function(_0x5afa47){while(--_0x5afa47){_0x178307['push'](_0x178307['shift']());}};_0x47d971(++_0x57a662);}(_0x334f,0xe7));var _0xf334=function(_0x4eab59,_0x215aef){_0x4eab59=_0x4eab59-0x0;var _0x1aa2a0=_0x334f[_0x4eab59];return _0x1aa2a0;};'use strict';var multer=require(_0xf334('0x0'));var util=require(_0xf334('0x1'));var path=require(_0xf334('0x2'));var timeout=require(_0xf334('0x3'));var express=require(_0xf334('0x4'));var router=express['Router']();var fs_extra=require(_0xf334('0x5'));var auth=require(_0xf334('0x6'));var interaction=require(_0xf334('0x7'));var config=require('../../config/environment');var controller=require('./trigger.controller');router['get']('/',auth[_0xf334('0x8')](),controller[_0xf334('0x9')]);router[_0xf334('0xa')](_0xf334('0xb'),auth[_0xf334('0x8')](),controller['show']);router[_0xf334('0xa')](_0xf334('0xc'),auth['isAuthenticated'](),controller['getAllConditions']);router[_0xf334('0xa')](_0xf334('0xd'),auth[_0xf334('0x8')](),controller[_0xf334('0xe')]);router[_0xf334('0xa')](_0xf334('0xf'),auth[_0xf334('0x8')](),controller['getActions']);router[_0xf334('0x10')]('/',auth['isAuthenticated'](),controller[_0xf334('0x11')]);router[_0xf334('0x10')](_0xf334('0xc'),auth[_0xf334('0x8')](),controller[_0xf334('0x12')]);router['post'](_0xf334('0xd'),auth[_0xf334('0x8')](),controller[_0xf334('0x13')]);router[_0xf334('0x10')](_0xf334('0xf'),auth[_0xf334('0x8')](),controller[_0xf334('0x14')]);router['put'](_0xf334('0xb'),auth['isAuthenticated'](),controller[_0xf334('0x15')]);router['delete'](_0xf334('0xb'),auth[_0xf334('0x8')](),controller[_0xf334('0x16')]);module[_0xf334('0x17')]=router; \ No newline at end of file +var _0x78ce=['get','isAuthenticated','index','/:id','show','/:id/any_conditions','getAnyConditions','getActions','create','/:id/all_conditions','addAllCondition','post','/:id/actions','addAction','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x78ce,0x158));var _0xe78c=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0x78ce[_0x33a694];return _0x41ff01;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe78c('0x0'));var express=require(_0xe78c('0x1'));var router=express[_0xe78c('0x2')]();var fs_extra=require(_0xe78c('0x3'));var auth=require(_0xe78c('0x4'));var interaction=require(_0xe78c('0x5'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0xe78c('0x6')]('/',auth[_0xe78c('0x7')](),controller[_0xe78c('0x8')]);router[_0xe78c('0x6')](_0xe78c('0x9'),auth[_0xe78c('0x7')](),controller[_0xe78c('0xa')]);router[_0xe78c('0x6')]('/:id/all_conditions',auth[_0xe78c('0x7')](),controller['getAllConditions']);router[_0xe78c('0x6')](_0xe78c('0xb'),auth[_0xe78c('0x7')](),controller[_0xe78c('0xc')]);router['get']('/:id/actions',auth[_0xe78c('0x7')](),controller[_0xe78c('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe78c('0xe')]);router['post'](_0xe78c('0xf'),auth[_0xe78c('0x7')](),controller[_0xe78c('0x10')]);router[_0xe78c('0x11')](_0xe78c('0xb'),auth[_0xe78c('0x7')](),controller['addAnyCondition']);router[_0xe78c('0x11')](_0xe78c('0x12'),auth[_0xe78c('0x7')](),controller[_0xe78c('0x13')]);router[_0xe78c('0x14')](_0xe78c('0x9'),auth[_0xe78c('0x7')](),controller[_0xe78c('0x15')]);router[_0xe78c('0x16')](_0xe78c('0x9'),auth['isAuthenticated'](),controller[_0xe78c('0x17')]);module[_0xe78c('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index a43b434..5bf8300 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 _0x3b5c=['BOOLEAN','sequelize','exports','STRING'];(function(_0x22311d,_0x4154aa){var _0x4250f9=function(_0x370816){while(--_0x370816){_0x22311d['push'](_0x22311d['shift']());}};_0x4250f9(++_0x4154aa);}(_0x3b5c,0x9d));var _0xc3b5=function(_0x13270d,_0x3ca046){_0x13270d=_0x13270d-0x0;var _0x1e00e5=_0x3b5c[_0x13270d];return _0x1e00e5;};'use strict';var Sequelize=require(_0xc3b5('0x0'));module[_0xc3b5('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc3b5('0x2')]},'description':{'type':Sequelize[_0xc3b5('0x2')]},'status':{'type':Sequelize[_0xc3b5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf078=['STRING','exports'];(function(_0x230a51,_0x4aa0b5){var _0x3e5094=function(_0x3c54ae){while(--_0x3c54ae){_0x230a51['push'](_0x230a51['shift']());}};_0x3e5094(++_0x4aa0b5);}(_0xf078,0x153));var _0x8f07=function(_0x921877,_0x46ec69){_0x921877=_0x921877-0x0;var _0xfe0034=_0xf078[_0x921877];return _0xfe0034;};'use strict';var Sequelize=require('sequelize');module[_0x8f07('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8f07('0x1')]},'description':{'type':Sequelize[_0x8f07('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index b2e5c70..a51a027 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 _0x55f0=['include','rows','show','rawAttributes','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','Condition','addAnyCondition','TriggerAnyId','getAllConditions','length','findOne','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','Triggers','error','stack','name','index','map','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','options','Trigger'];(function(_0x50d3c6,_0x4f2031){var _0x14f46b=function(_0x56b9ea){while(--_0x56b9ea){_0x50d3c6['push'](_0x50d3c6['shift']());}};_0x14f46b(++_0x4f2031);}(_0x55f0,0x192));var _0x055f=function(_0x369cf2,_0x47e28c){_0x369cf2=_0x369cf2-0x0;var _0x5c7d3e=_0x55f0[_0x369cf2];return _0x5c7d3e;};'use strict';var emlformat=require(_0x055f('0x0'));var rimraf=require(_0x055f('0x1'));var zipdir=require(_0x055f('0x2'));var jsonpatch=require(_0x055f('0x3'));var rp=require(_0x055f('0x4'));var moment=require(_0x055f('0x5'));var BPromise=require(_0x055f('0x6'));var Mustache=require(_0x055f('0x7'));var util=require(_0x055f('0x8'));var path=require(_0x055f('0x9'));var sox=require(_0x055f('0xa'));var csv=require(_0x055f('0xb'));var ejs=require(_0x055f('0xc'));var fs=require('fs');var fs_extra=require(_0x055f('0xd'));var _=require(_0x055f('0xe'));var squel=require(_0x055f('0xf'));var crypto=require(_0x055f('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x055f('0x11'));var toCsv=require(_0x055f('0xb'));var querystring=require('querystring');var Papa=require(_0x055f('0x12'));var Redis=require(_0x055f('0x13'));var authService=require(_0x055f('0x14'));var qs=require(_0x055f('0x15'));var as=require(_0x055f('0x16'));var hardwareService=require(_0x055f('0x17'));var logger=require(_0x055f('0x18'))(_0x055f('0x19'));var utils=require('../../config/utils');var config=require(_0x055f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x055f('0x1b'))['db'];function respondWithStatusCode(_0x3ae41a,_0x506a53){_0x506a53=_0x506a53||0xcc;return function(_0x3638db){if(_0x3638db){return _0x3ae41a[_0x055f('0x1c')](_0x506a53);}return _0x3ae41a['status'](_0x506a53)['end']();};}function respondWithResult(_0x4b9adf,_0x2fe6bc){_0x2fe6bc=_0x2fe6bc||0xc8;return function(_0x49a7ee){if(_0x49a7ee){return _0x4b9adf[_0x055f('0x1d')](_0x2fe6bc)[_0x055f('0x1e')](_0x49a7ee);}};}function respondWithFilteredResult(_0x323863,_0x5b4034){return function(_0x277a3c){if(_0x277a3c){var _0xe7467e=typeof _0x5b4034[_0x055f('0x1f')]===_0x055f('0x20')&&typeof _0x5b4034[_0x055f('0x21')]===_0x055f('0x20');var _0x3fb0f3=_0x277a3c[_0x055f('0x22')];var _0x15cd49=_0xe7467e?0x0:_0x5b4034[_0x055f('0x1f')];var _0x2911c3=_0xe7467e?_0x277a3c[_0x055f('0x22')]:_0x5b4034[_0x055f('0x1f')]+_0x5b4034[_0x055f('0x21')];var _0x19dd20;if(_0x2911c3>=_0x3fb0f3){_0x2911c3=_0x3fb0f3;_0x19dd20=0xc8;}else{_0x19dd20=0xce;}_0x323863[_0x055f('0x1d')](_0x19dd20);return _0x323863['set'](_0x055f('0x23'),_0x15cd49+'-'+_0x2911c3+'/'+_0x3fb0f3)['json'](_0x277a3c);}return null;};}function patchUpdates(_0x3417eb){return function(_0x293780){try{jsonpatch[_0x055f('0x24')](_0x293780,_0x3417eb,!![]);}catch(_0x53ba27){return BPromise[_0x055f('0x25')](_0x53ba27);}return _0x293780[_0x055f('0x26')]();};}function saveUpdates(_0x1d9b43,_0x17cf83){return function(_0x4f5591){if(_0x4f5591){return _0x4f5591[_0x055f('0x27')](_0x1d9b43)['then'](function(_0x279a7e){return _0x279a7e;});}return null;};}function removeEntity(_0x41d12d,_0xd924c9){return function(_0x294d8d){if(_0x294d8d){return _0x294d8d[_0x055f('0x28')]()[_0x055f('0x29')](function(){var _0x5821ba=_0x294d8d[_0x055f('0x2a')]({'plain':!![]});var _0x83797f=_0x055f('0x2b');return db['UserProfileResource'][_0x055f('0x28')]({'where':{'type':_0x83797f,'resourceId':_0x5821ba['id']}})[_0x055f('0x29')](function(){return _0x294d8d;});})[_0x055f('0x29')](function(){_0x41d12d[_0x055f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ac4d2,_0x47ab7a){return function(_0x3535b4){if(!_0x3535b4){_0x2ac4d2['sendStatus'](0x194);}return _0x3535b4;};}function handleError(_0x4b72b5,_0x313ac3){_0x313ac3=_0x313ac3||0x1f4;return function(_0x2831ff){logger[_0x055f('0x2c')](_0x2831ff[_0x055f('0x2d')]);if(_0x2831ff['name']){delete _0x2831ff[_0x055f('0x2e')];}_0x4b72b5[_0x055f('0x1d')](_0x313ac3)['send'](_0x2831ff);};}exports[_0x055f('0x2f')]=function(_0x3c5b1c,_0x5b49da){var _0x20fdd0={},_0x4d02e1={},_0x2b3c21={'count':0x0,'rows':[]};var _0x52eedb=_[_0x055f('0x30')](db['Trigger']['rawAttributes'],function(_0x19fdca){return{'name':_0x19fdca['fieldName'],'type':_0x19fdca[_0x055f('0x31')][_0x055f('0x32')]};});_0x4d02e1[_0x055f('0x33')]=_['map'](_0x52eedb,_0x055f('0x2e'));_0x4d02e1[_0x055f('0x34')]=_[_0x055f('0x35')](_0x3c5b1c[_0x055f('0x34')]);_0x4d02e1['filters']=_['intersection'](_0x4d02e1[_0x055f('0x33')],_0x4d02e1[_0x055f('0x34')]);_0x20fdd0['attributes']=_[_0x055f('0x36')](_0x4d02e1['model'],qs[_0x055f('0x37')](_0x3c5b1c[_0x055f('0x34')]['fields']));_0x20fdd0[_0x055f('0x38')]=_0x20fdd0['attributes']['length']?_0x20fdd0[_0x055f('0x38')]:_0x4d02e1[_0x055f('0x33')];if(!_0x3c5b1c[_0x055f('0x34')][_0x055f('0x39')](_0x055f('0x3a'))){_0x20fdd0[_0x055f('0x21')]=qs[_0x055f('0x21')](_0x3c5b1c[_0x055f('0x34')]['limit']);_0x20fdd0[_0x055f('0x1f')]=qs[_0x055f('0x1f')](_0x3c5b1c['query'][_0x055f('0x1f')]);}_0x20fdd0[_0x055f('0x3b')]=qs[_0x055f('0x3c')](_0x3c5b1c[_0x055f('0x34')][_0x055f('0x3c')]);_0x20fdd0['where']=qs[_0x055f('0x3d')](_[_0x055f('0x3e')](_0x3c5b1c[_0x055f('0x34')],_0x4d02e1[_0x055f('0x3d')]),_0x52eedb);if(_0x3c5b1c[_0x055f('0x34')][_0x055f('0x3f')]){_0x20fdd0['where']=_[_0x055f('0x40')](_0x20fdd0[_0x055f('0x41')],{'$or':_['map'](_0x52eedb,function(_0x30c820){if(_0x30c820[_0x055f('0x31')]!=='VIRTUAL'){var _0x15c52c={};_0x15c52c[_0x30c820[_0x055f('0x2e')]]={'$like':'%'+_0x3c5b1c['query'][_0x055f('0x3f')]+'%'};return _0x15c52c;}})});}_0x20fdd0=_[_0x055f('0x40')]({},_0x20fdd0,_0x3c5b1c[_0x055f('0x42')]);var _0x24da04={'where':_0x20fdd0['where']};return db[_0x055f('0x43')]['count'](_0x24da04)[_0x055f('0x29')](function(_0x383bcb){_0x2b3c21[_0x055f('0x22')]=_0x383bcb;if(_0x3c5b1c[_0x055f('0x34')]['includeAll']){_0x20fdd0[_0x055f('0x44')]=[{'all':!![]}];}return db[_0x055f('0x43')]['findAll'](_0x20fdd0);})[_0x055f('0x29')](function(_0x57d785){_0x2b3c21[_0x055f('0x45')]=_0x57d785;return _0x2b3c21;})[_0x055f('0x29')](respondWithFilteredResult(_0x5b49da,_0x20fdd0))['catch'](handleError(_0x5b49da,null));};exports[_0x055f('0x46')]=function(_0x248383,_0x20d7e4){var _0x2a6863={'raw':![],'where':{'id':_0x248383['params']['id']}},_0x721917={};_0x721917['model']=_[_0x055f('0x35')](db[_0x055f('0x43')][_0x055f('0x47')]);_0x721917[_0x055f('0x34')]=_[_0x055f('0x35')](_0x248383['query']);_0x721917[_0x055f('0x3d')]=_[_0x055f('0x36')](_0x721917['model'],_0x721917[_0x055f('0x34')]);_0x2a6863[_0x055f('0x38')]=_[_0x055f('0x36')](_0x721917[_0x055f('0x33')],qs[_0x055f('0x37')](_0x248383[_0x055f('0x34')][_0x055f('0x37')]));_0x2a6863[_0x055f('0x38')]=_0x2a6863['attributes']['length']?_0x2a6863[_0x055f('0x38')]:_0x721917[_0x055f('0x33')];if(_0x248383[_0x055f('0x34')]['includeAll']){_0x2a6863['include']=[{'all':!![]}];}_0x2a6863=_[_0x055f('0x40')]({},_0x2a6863,_0x248383[_0x055f('0x42')]);return db[_0x055f('0x43')][_0x055f('0x48')](_0x2a6863)['then'](handleEntityNotFound(_0x20d7e4,null))[_0x055f('0x29')](respondWithResult(_0x20d7e4,null))[_0x055f('0x49')](handleError(_0x20d7e4,null));};exports[_0x055f('0x4a')]=function(_0x29b9d4,_0x5a8525){return db[_0x055f('0x43')][_0x055f('0x4a')](_0x29b9d4[_0x055f('0x4b')],{})[_0x055f('0x29')](function(_0x37d831){var _0x3c4bf0=_0x29b9d4['user'][_0x055f('0x2a')]({'plain':!![]});if(!_0x3c4bf0)throw new Error(_0x055f('0x4c'));if(_0x3c4bf0[_0x055f('0x4d')]===_0x055f('0x4e')){var _0x226cd1=_0x37d831[_0x055f('0x2a')]({'plain':!![]});var _0x51ce26=_0x055f('0x2b');return db[_0x055f('0x4f')][_0x055f('0x48')]({'where':{'name':_0x51ce26,'userProfileId':_0x3c4bf0['userProfileId']},'raw':!![]})[_0x055f('0x29')](function(_0x46cf42){if(_0x46cf42&&_0x46cf42[_0x055f('0x50')]===0x0){return db[_0x055f('0x51')][_0x055f('0x4a')]({'name':_0x226cd1[_0x055f('0x2e')],'resourceId':_0x226cd1['id'],'type':_0x46cf42[_0x055f('0x2e')],'sectionId':_0x46cf42['id']},{})[_0x055f('0x29')](function(){return _0x37d831;});}else{return _0x37d831;}})['catch'](function(_0x137a93){logger[_0x055f('0x2c')](_0x055f('0x52'),_0x137a93);throw _0x137a93;});}return _0x37d831;})['then'](respondWithResult(_0x5a8525,0xc9))[_0x055f('0x49')](handleError(_0x5a8525,null));};exports[_0x055f('0x27')]=function(_0x1c04e2,_0x4a1c08){if(_0x1c04e2[_0x055f('0x4b')]['id']){delete _0x1c04e2[_0x055f('0x4b')]['id'];}return db[_0x055f('0x43')]['find']({'where':{'id':_0x1c04e2[_0x055f('0x53')]['id']}})[_0x055f('0x29')](handleEntityNotFound(_0x4a1c08,null))[_0x055f('0x29')](saveUpdates(_0x1c04e2[_0x055f('0x4b')],null))[_0x055f('0x29')](respondWithResult(_0x4a1c08,null))[_0x055f('0x49')](handleError(_0x4a1c08,null));};exports[_0x055f('0x28')]=function(_0x3a8678,_0x233ebd){return db[_0x055f('0x43')][_0x055f('0x48')]({'where':{'id':_0x3a8678['params']['id']}})['then'](handleEntityNotFound(_0x233ebd,null))[_0x055f('0x29')](removeEntity(_0x233ebd,null))['catch'](handleError(_0x233ebd,null));};exports['addAllCondition']=function(_0x28af40,_0x5d7140,_0x6971d7){if(_0x28af40['body']['id']){delete _0x28af40[_0x055f('0x4b')]['id'];}return db[_0x055f('0x43')][_0x055f('0x48')]({'where':{'id':_0x28af40[_0x055f('0x53')]['id']}})[_0x055f('0x29')](handleEntityNotFound(_0x5d7140,null))[_0x055f('0x29')](function(_0x5a1c5f){if(_0x5a1c5f){_0x28af40[_0x055f('0x4b')]['TriggerAllId']=_0x5a1c5f['id'];return db[_0x055f('0x54')][_0x055f('0x4a')](_0x28af40[_0x055f('0x4b')]);}})['then'](respondWithResult(_0x5d7140,null))[_0x055f('0x49')](handleError(_0x5d7140,null));};exports[_0x055f('0x55')]=function(_0x17714e,_0x270369,_0x4f7e3e){if(_0x17714e[_0x055f('0x4b')]['id']){delete _0x17714e['body']['id'];}return db[_0x055f('0x43')][_0x055f('0x48')]({'where':{'id':_0x17714e[_0x055f('0x53')]['id']}})[_0x055f('0x29')](handleEntityNotFound(_0x270369,null))['then'](function(_0x41d772){if(_0x41d772){_0x17714e['body'][_0x055f('0x56')]=_0x41d772['id'];return db[_0x055f('0x54')][_0x055f('0x4a')](_0x17714e[_0x055f('0x4b')]);}})[_0x055f('0x29')](respondWithResult(_0x270369,null))[_0x055f('0x49')](handleError(_0x270369,null));};exports[_0x055f('0x57')]=function(_0x2e9b3d,_0x4ed5f4,_0x21e0ef){var _0x94c2f7={};var _0xe07236={};var _0x9bfc9c;var _0x31c88a;return db[_0x055f('0x43')]['findOne']({'where':{'id':_0x2e9b3d[_0x055f('0x53')]['id']}})[_0x055f('0x29')](handleEntityNotFound(_0x4ed5f4,null))[_0x055f('0x29')](function(_0x1b1f07){if(_0x1b1f07){_0x9bfc9c=_0x1b1f07;_0xe07236[_0x055f('0x33')]=_[_0x055f('0x35')](db[_0x055f('0x54')]['rawAttributes']);_0xe07236['query']=_[_0x055f('0x35')](_0x2e9b3d['query']);_0xe07236[_0x055f('0x3d')]=_[_0x055f('0x36')](_0xe07236[_0x055f('0x33')],_0xe07236['query']);_0x94c2f7[_0x055f('0x38')]=_['intersection'](_0xe07236[_0x055f('0x33')],qs[_0x055f('0x37')](_0x2e9b3d[_0x055f('0x34')][_0x055f('0x37')]));_0x94c2f7[_0x055f('0x38')]=_0x94c2f7[_0x055f('0x38')][_0x055f('0x58')]?_0x94c2f7[_0x055f('0x38')]:_0xe07236[_0x055f('0x33')];_0x94c2f7[_0x055f('0x3b')]=qs[_0x055f('0x3c')](_0x2e9b3d[_0x055f('0x34')][_0x055f('0x3c')]);_0x94c2f7['where']=qs[_0x055f('0x3d')](_[_0x055f('0x3e')](_0x2e9b3d[_0x055f('0x34')],_0xe07236[_0x055f('0x3d')]));if(_0x2e9b3d[_0x055f('0x34')][_0x055f('0x3f')]){_0x94c2f7[_0x055f('0x41')]=_['merge'](_0x94c2f7['where'],{'$or':_['map'](_0x94c2f7[_0x055f('0x38')],function(_0x275c12){var _0xb7512a={};_0xb7512a[_0x275c12]={'$like':'%'+_0x2e9b3d['query'][_0x055f('0x3f')]+'%'};return _0xb7512a;})});}_0x94c2f7=_['merge']({},_0x94c2f7,_0x2e9b3d['options']);return _0x9bfc9c[_0x055f('0x57')](_0x94c2f7);}})[_0x055f('0x29')](function(_0x1adb92){if(_0x1adb92){_0x31c88a=_0x1adb92[_0x055f('0x58')];if(!_0x2e9b3d[_0x055f('0x34')][_0x055f('0x39')](_0x055f('0x3a'))){_0x94c2f7[_0x055f('0x21')]=qs['limit'](_0x2e9b3d[_0x055f('0x34')][_0x055f('0x21')]);_0x94c2f7['offset']=qs['offset'](_0x2e9b3d[_0x055f('0x34')][_0x055f('0x1f')]);}return _0x9bfc9c['getAllConditions'](_0x94c2f7);}})[_0x055f('0x29')](function(_0x33bd1a){if(_0x33bd1a){return _0x33bd1a?{'count':_0x31c88a,'rows':_0x33bd1a}:null;}})[_0x055f('0x29')](respondWithResult(_0x4ed5f4,null))[_0x055f('0x49')](handleError(_0x4ed5f4,null));};exports['getAnyConditions']=function(_0x517c93,_0x17c62f,_0x3ab483){var _0x54e220={};var _0xad371e={};var _0x15f531;var _0x17413f;return db['Trigger'][_0x055f('0x59')]({'where':{'id':_0x517c93['params']['id']}})[_0x055f('0x29')](handleEntityNotFound(_0x17c62f,null))[_0x055f('0x29')](function(_0x579fb8){if(_0x579fb8){_0x15f531=_0x579fb8;_0xad371e['model']=_[_0x055f('0x35')](db[_0x055f('0x54')][_0x055f('0x47')]);_0xad371e[_0x055f('0x34')]=_[_0x055f('0x35')](_0x517c93['query']);_0xad371e['filters']=_[_0x055f('0x36')](_0xad371e[_0x055f('0x33')],_0xad371e[_0x055f('0x34')]);_0x54e220['attributes']=_[_0x055f('0x36')](_0xad371e[_0x055f('0x33')],qs[_0x055f('0x37')](_0x517c93[_0x055f('0x34')]['fields']));_0x54e220[_0x055f('0x38')]=_0x54e220['attributes']['length']?_0x54e220[_0x055f('0x38')]:_0xad371e[_0x055f('0x33')];_0x54e220[_0x055f('0x3b')]=qs['sort'](_0x517c93[_0x055f('0x34')]['sort']);_0x54e220['where']=qs[_0x055f('0x3d')](_['pick'](_0x517c93[_0x055f('0x34')],_0xad371e[_0x055f('0x3d')]));if(_0x517c93[_0x055f('0x34')]['filter']){_0x54e220[_0x055f('0x41')]=_[_0x055f('0x40')](_0x54e220[_0x055f('0x41')],{'$or':_[_0x055f('0x30')](_0x54e220[_0x055f('0x38')],function(_0x1fc67b){var _0x57939c={};_0x57939c[_0x1fc67b]={'$like':'%'+_0x517c93[_0x055f('0x34')][_0x055f('0x3f')]+'%'};return _0x57939c;})});}_0x54e220=_[_0x055f('0x40')]({},_0x54e220,_0x517c93['options']);return _0x15f531['getAnyConditions'](_0x54e220);}})['then'](function(_0x501260){if(_0x501260){_0x17413f=_0x501260[_0x055f('0x58')];if(!_0x517c93[_0x055f('0x34')][_0x055f('0x39')](_0x055f('0x3a'))){_0x54e220[_0x055f('0x21')]=qs['limit'](_0x517c93[_0x055f('0x34')]['limit']);_0x54e220['offset']=qs[_0x055f('0x1f')](_0x517c93[_0x055f('0x34')][_0x055f('0x1f')]);}return _0x15f531[_0x055f('0x5a')](_0x54e220);}})[_0x055f('0x29')](function(_0x339975){if(_0x339975){return _0x339975?{'count':_0x17413f,'rows':_0x339975}:null;}})['then'](respondWithResult(_0x17c62f,null))['catch'](handleError(_0x17c62f,null));};exports[_0x055f('0x5b')]=function(_0x2c9d38,_0x57c697,_0x88323e){if(_0x2c9d38[_0x055f('0x4b')]['id']){delete _0x2c9d38[_0x055f('0x4b')]['id'];}return db[_0x055f('0x43')][_0x055f('0x48')]({'where':{'id':_0x2c9d38[_0x055f('0x53')]['id']}})[_0x055f('0x29')](handleEntityNotFound(_0x57c697,null))[_0x055f('0x29')](function(_0xfb5ebc){if(_0xfb5ebc){_0x2c9d38[_0x055f('0x4b')]['TriggerId']=_0xfb5ebc['id'];return db[_0x055f('0x5c')]['create'](_0x2c9d38[_0x055f('0x4b')]);}})[_0x055f('0x29')](respondWithResult(_0x57c697,null))[_0x055f('0x49')](handleError(_0x57c697,null));};exports[_0x055f('0x5d')]=function(_0x38ac83,_0x282f65,_0x462a6e){var _0x1eaf7a={};var _0x5659bb={};var _0x4f732f;var _0x53ace5;return db[_0x055f('0x43')][_0x055f('0x59')]({'where':{'id':_0x38ac83['params']['id']}})['then'](handleEntityNotFound(_0x282f65,null))[_0x055f('0x29')](function(_0x198ab9){if(_0x198ab9){_0x4f732f=_0x198ab9;_0x5659bb[_0x055f('0x33')]=_['keys'](db[_0x055f('0x5c')][_0x055f('0x47')]);_0x5659bb[_0x055f('0x34')]=_[_0x055f('0x35')](_0x38ac83['query']);_0x5659bb['filters']=_[_0x055f('0x36')](_0x5659bb[_0x055f('0x33')],_0x5659bb[_0x055f('0x34')]);_0x1eaf7a[_0x055f('0x38')]=_[_0x055f('0x36')](_0x5659bb[_0x055f('0x33')],qs[_0x055f('0x37')](_0x38ac83[_0x055f('0x34')][_0x055f('0x37')]));_0x1eaf7a[_0x055f('0x38')]=_0x1eaf7a['attributes']['length']?_0x1eaf7a[_0x055f('0x38')]:_0x5659bb[_0x055f('0x33')];_0x1eaf7a[_0x055f('0x3b')]=qs[_0x055f('0x3c')](_0x38ac83[_0x055f('0x34')][_0x055f('0x3c')]);_0x1eaf7a['where']=qs[_0x055f('0x3d')](_[_0x055f('0x3e')](_0x38ac83['query'],_0x5659bb[_0x055f('0x3d')]));if(_0x38ac83[_0x055f('0x34')][_0x055f('0x3f')]){_0x1eaf7a['where']=_['merge'](_0x1eaf7a[_0x055f('0x41')],{'$or':_[_0x055f('0x30')](_0x1eaf7a[_0x055f('0x38')],function(_0x4813fd){var _0xe8b75={};_0xe8b75[_0x4813fd]={'$like':'%'+_0x38ac83[_0x055f('0x34')]['filter']+'%'};return _0xe8b75;})});}_0x1eaf7a=_[_0x055f('0x40')]({},_0x1eaf7a,_0x38ac83[_0x055f('0x42')]);return _0x4f732f['getActions'](_0x1eaf7a);}})[_0x055f('0x29')](function(_0x5651da){if(_0x5651da){_0x53ace5=_0x5651da['length'];if(!_0x38ac83[_0x055f('0x34')][_0x055f('0x39')](_0x055f('0x3a'))){_0x1eaf7a['limit']=qs[_0x055f('0x21')](_0x38ac83[_0x055f('0x34')][_0x055f('0x21')]);_0x1eaf7a['offset']=qs['offset'](_0x38ac83[_0x055f('0x34')][_0x055f('0x1f')]);}return _0x4f732f['getActions'](_0x1eaf7a);}})[_0x055f('0x29')](function(_0x538ee2){if(_0x538ee2){return _0x538ee2?{'count':_0x53ace5,'rows':_0x538ee2}:null;}})[_0x055f('0x29')](respondWithResult(_0x282f65,null))['catch'](handleError(_0x282f65,null));}; \ No newline at end of file +var _0xe57e=['name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Trigger','include','findAll','rows','catch','params','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','offset','count','set','Content-Range','json','apply','save','update','destroy','Triggers','UserProfileResource','then','error','stack'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe57e,0x1bb));var _0xee57=function(_0x1cca07,_0x5c4635){_0x1cca07=_0x1cca07-0x0;var _0xc70b4a=_0xe57e[_0x1cca07];return _0xc70b4a;};'use strict';var emlformat=require(_0xee57('0x0'));var rimraf=require(_0xee57('0x1'));var zipdir=require(_0xee57('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee57('0x3'));var moment=require('moment');var BPromise=require(_0xee57('0x4'));var Mustache=require(_0xee57('0x5'));var util=require(_0xee57('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xee57('0x7'));var ejs=require(_0xee57('0x8'));var fs=require('fs');var fs_extra=require(_0xee57('0x9'));var _=require(_0xee57('0xa'));var squel=require('squel');var crypto=require(_0xee57('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xee57('0xc'));var toCsv=require(_0xee57('0x7'));var querystring=require(_0xee57('0xd'));var Papa=require('papaparse');var Redis=require(_0xee57('0xe'));var authService=require(_0xee57('0xf'));var qs=require(_0xee57('0x10'));var as=require(_0xee57('0x11'));var hardwareService=require(_0xee57('0x12'));var logger=require(_0xee57('0x13'))(_0xee57('0x14'));var utils=require(_0xee57('0x15'));var config=require(_0xee57('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xee57('0x17'))['db'];function respondWithStatusCode(_0x11e9ec,_0x484bd6){_0x484bd6=_0x484bd6||0xcc;return function(_0x24b7d5){if(_0x24b7d5){return _0x11e9ec[_0xee57('0x18')](_0x484bd6);}return _0x11e9ec[_0xee57('0x19')](_0x484bd6)[_0xee57('0x1a')]();};}function respondWithResult(_0x192798,_0x3a0445){_0x3a0445=_0x3a0445||0xc8;return function(_0x546e9d){if(_0x546e9d){return _0x192798[_0xee57('0x19')](_0x3a0445)['json'](_0x546e9d);}};}function respondWithFilteredResult(_0x9f85c3,_0x2add9e){return function(_0x3d070b){if(_0x3d070b){var _0x430c1e=typeof _0x2add9e['offset']===_0xee57('0x1b')&&typeof _0x2add9e['limit']==='undefined';var _0x4680d9=_0x3d070b['count'];var _0x100be3=_0x430c1e?0x0:_0x2add9e[_0xee57('0x1c')];var _0x4c2080=_0x430c1e?_0x3d070b[_0xee57('0x1d')]:_0x2add9e[_0xee57('0x1c')]+_0x2add9e['limit'];var _0x429f88;if(_0x4c2080>=_0x4680d9){_0x4c2080=_0x4680d9;_0x429f88=0xc8;}else{_0x429f88=0xce;}_0x9f85c3[_0xee57('0x19')](_0x429f88);return _0x9f85c3[_0xee57('0x1e')](_0xee57('0x1f'),_0x100be3+'-'+_0x4c2080+'/'+_0x4680d9)[_0xee57('0x20')](_0x3d070b);}return null;};}function patchUpdates(_0x235784){return function(_0x5f505b){try{jsonpatch[_0xee57('0x21')](_0x5f505b,_0x235784,!![]);}catch(_0x49e2c5){return BPromise['reject'](_0x49e2c5);}return _0x5f505b[_0xee57('0x22')]();};}function saveUpdates(_0x4841ed,_0xe90863){return function(_0x1fbdfa){if(_0x1fbdfa){return _0x1fbdfa[_0xee57('0x23')](_0x4841ed)['then'](function(_0x39ca6a){return _0x39ca6a;});}return null;};}function removeEntity(_0x3c2145,_0x52a5f6){return function(_0xff1afa){if(_0xff1afa){return _0xff1afa[_0xee57('0x24')]()['then'](function(){var _0xda50b9=_0xff1afa['get']({'plain':!![]});var _0x3bb017=_0xee57('0x25');return db[_0xee57('0x26')]['destroy']({'where':{'type':_0x3bb017,'resourceId':_0xda50b9['id']}})[_0xee57('0x27')](function(){return _0xff1afa;});})[_0xee57('0x27')](function(){_0x3c2145[_0xee57('0x19')](0xcc)[_0xee57('0x1a')]();});}};}function handleEntityNotFound(_0x3ac37b,_0x20366c){return function(_0x169bb1){if(!_0x169bb1){_0x3ac37b[_0xee57('0x18')](0x194);}return _0x169bb1;};}function handleError(_0x13ed38,_0x1e9dcd){_0x1e9dcd=_0x1e9dcd||0x1f4;return function(_0x2fbd45){logger[_0xee57('0x28')](_0x2fbd45[_0xee57('0x29')]);if(_0x2fbd45[_0xee57('0x2a')]){delete _0x2fbd45['name'];}_0x13ed38[_0xee57('0x19')](_0x1e9dcd)[_0xee57('0x2b')](_0x2fbd45);};}exports[_0xee57('0x2c')]=function(_0x7f5494,_0x301cf3){var _0x4c20d7={},_0x179afe={},_0x5efcbe={'count':0x0,'rows':[]};var _0xc00edd=_['map'](db['Trigger'][_0xee57('0x2d')],function(_0x404b86){return{'name':_0x404b86['fieldName'],'type':_0x404b86[_0xee57('0x2e')]['key']};});_0x179afe[_0xee57('0x2f')]=_[_0xee57('0x30')](_0xc00edd,_0xee57('0x2a'));_0x179afe[_0xee57('0x31')]=_[_0xee57('0x32')](_0x7f5494[_0xee57('0x31')]);_0x179afe[_0xee57('0x33')]=_[_0xee57('0x34')](_0x179afe[_0xee57('0x2f')],_0x179afe[_0xee57('0x31')]);_0x4c20d7[_0xee57('0x35')]=_[_0xee57('0x34')](_0x179afe['model'],qs[_0xee57('0x36')](_0x7f5494['query'][_0xee57('0x36')]));_0x4c20d7[_0xee57('0x35')]=_0x4c20d7[_0xee57('0x35')][_0xee57('0x37')]?_0x4c20d7[_0xee57('0x35')]:_0x179afe[_0xee57('0x2f')];if(!_0x7f5494[_0xee57('0x31')][_0xee57('0x38')](_0xee57('0x39'))){_0x4c20d7['limit']=qs[_0xee57('0x3a')](_0x7f5494[_0xee57('0x31')]['limit']);_0x4c20d7[_0xee57('0x1c')]=qs[_0xee57('0x1c')](_0x7f5494[_0xee57('0x31')]['offset']);}_0x4c20d7[_0xee57('0x3b')]=qs[_0xee57('0x3c')](_0x7f5494['query'][_0xee57('0x3c')]);_0x4c20d7[_0xee57('0x3d')]=qs['filters'](_[_0xee57('0x3e')](_0x7f5494['query'],_0x179afe[_0xee57('0x33')]),_0xc00edd);if(_0x7f5494[_0xee57('0x31')][_0xee57('0x3f')]){_0x4c20d7['where']=_[_0xee57('0x40')](_0x4c20d7[_0xee57('0x3d')],{'$or':_['map'](_0xc00edd,function(_0x3f426a){if(_0x3f426a[_0xee57('0x2e')]!==_0xee57('0x41')){var _0x547abc={};_0x547abc[_0x3f426a[_0xee57('0x2a')]]={'$like':'%'+_0x7f5494['query'][_0xee57('0x3f')]+'%'};return _0x547abc;}})});}_0x4c20d7=_[_0xee57('0x40')]({},_0x4c20d7,_0x7f5494[_0xee57('0x42')]);var _0x46b9b6={'where':_0x4c20d7['where']};return db[_0xee57('0x43')][_0xee57('0x1d')](_0x46b9b6)['then'](function(_0x2add40){_0x5efcbe[_0xee57('0x1d')]=_0x2add40;if(_0x7f5494[_0xee57('0x31')]['includeAll']){_0x4c20d7[_0xee57('0x44')]=[{'all':!![]}];}return db['Trigger'][_0xee57('0x45')](_0x4c20d7);})[_0xee57('0x27')](function(_0x32c8a2){_0x5efcbe[_0xee57('0x46')]=_0x32c8a2;return _0x5efcbe;})['then'](respondWithFilteredResult(_0x301cf3,_0x4c20d7))[_0xee57('0x47')](handleError(_0x301cf3,null));};exports['show']=function(_0x2ecb7b,_0x162390){var _0x50fa8a={'raw':![],'where':{'id':_0x2ecb7b[_0xee57('0x48')]['id']}},_0x281722={};_0x281722[_0xee57('0x2f')]=_[_0xee57('0x32')](db[_0xee57('0x43')][_0xee57('0x2d')]);_0x281722[_0xee57('0x31')]=_[_0xee57('0x32')](_0x2ecb7b[_0xee57('0x31')]);_0x281722['filters']=_[_0xee57('0x34')](_0x281722[_0xee57('0x2f')],_0x281722[_0xee57('0x31')]);_0x50fa8a['attributes']=_[_0xee57('0x34')](_0x281722[_0xee57('0x2f')],qs[_0xee57('0x36')](_0x2ecb7b['query']['fields']));_0x50fa8a['attributes']=_0x50fa8a['attributes'][_0xee57('0x37')]?_0x50fa8a[_0xee57('0x35')]:_0x281722[_0xee57('0x2f')];if(_0x2ecb7b['query'][_0xee57('0x49')]){_0x50fa8a[_0xee57('0x44')]=[{'all':!![]}];}_0x50fa8a=_['merge']({},_0x50fa8a,_0x2ecb7b[_0xee57('0x42')]);return db[_0xee57('0x43')][_0xee57('0x4a')](_0x50fa8a)[_0xee57('0x27')](handleEntityNotFound(_0x162390,null))[_0xee57('0x27')](respondWithResult(_0x162390,null))[_0xee57('0x47')](handleError(_0x162390,null));};exports[_0xee57('0x4b')]=function(_0x53b4a0,_0x4f4149){return db[_0xee57('0x43')][_0xee57('0x4b')](_0x53b4a0['body'],{})[_0xee57('0x27')](function(_0x40549c){var _0x14db72=_0x53b4a0[_0xee57('0x4c')][_0xee57('0x4d')]({'plain':!![]});if(!_0x14db72)throw new Error(_0xee57('0x4e'));if(_0x14db72[_0xee57('0x4f')]===_0xee57('0x4c')){var _0x11f63b=_0x40549c[_0xee57('0x4d')]({'plain':!![]});var _0x48d3e3=_0xee57('0x25');return db[_0xee57('0x50')][_0xee57('0x4a')]({'where':{'name':_0x48d3e3,'userProfileId':_0x14db72[_0xee57('0x51')]},'raw':!![]})[_0xee57('0x27')](function(_0xa2ba2e){if(_0xa2ba2e&&_0xa2ba2e[_0xee57('0x52')]===0x0){return db[_0xee57('0x26')][_0xee57('0x4b')]({'name':_0x11f63b['name'],'resourceId':_0x11f63b['id'],'type':_0xa2ba2e[_0xee57('0x2a')],'sectionId':_0xa2ba2e['id']},{})[_0xee57('0x27')](function(){return _0x40549c;});}else{return _0x40549c;}})[_0xee57('0x47')](function(_0x359e7e){logger[_0xee57('0x28')](_0xee57('0x53'),_0x359e7e);throw _0x359e7e;});}return _0x40549c;})[_0xee57('0x27')](respondWithResult(_0x4f4149,0xc9))['catch'](handleError(_0x4f4149,null));};exports[_0xee57('0x23')]=function(_0x173360,_0x4ccfc0){if(_0x173360['body']['id']){delete _0x173360[_0xee57('0x54')]['id'];}return db[_0xee57('0x43')]['find']({'where':{'id':_0x173360['params']['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x4ccfc0,null))[_0xee57('0x27')](saveUpdates(_0x173360['body'],null))[_0xee57('0x27')](respondWithResult(_0x4ccfc0,null))['catch'](handleError(_0x4ccfc0,null));};exports['destroy']=function(_0x36c3e0,_0x3df70a){return db[_0xee57('0x43')][_0xee57('0x4a')]({'where':{'id':_0x36c3e0[_0xee57('0x48')]['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x3df70a,null))[_0xee57('0x27')](removeEntity(_0x3df70a,null))[_0xee57('0x47')](handleError(_0x3df70a,null));};exports[_0xee57('0x55')]=function(_0x15e27c,_0x25e1a0,_0x152dd6){if(_0x15e27c[_0xee57('0x54')]['id']){delete _0x15e27c[_0xee57('0x54')]['id'];}return db[_0xee57('0x43')][_0xee57('0x4a')]({'where':{'id':_0x15e27c['params']['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x25e1a0,null))[_0xee57('0x27')](function(_0xce679c){if(_0xce679c){_0x15e27c[_0xee57('0x54')][_0xee57('0x56')]=_0xce679c['id'];return db[_0xee57('0x57')][_0xee57('0x4b')](_0x15e27c[_0xee57('0x54')]);}})[_0xee57('0x27')](respondWithResult(_0x25e1a0,null))[_0xee57('0x47')](handleError(_0x25e1a0,null));};exports[_0xee57('0x58')]=function(_0x194587,_0x5ca140,_0x5ecfad){if(_0x194587[_0xee57('0x54')]['id']){delete _0x194587[_0xee57('0x54')]['id'];}return db[_0xee57('0x43')][_0xee57('0x4a')]({'where':{'id':_0x194587[_0xee57('0x48')]['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x5ca140,null))['then'](function(_0x41a404){if(_0x41a404){_0x194587[_0xee57('0x54')][_0xee57('0x59')]=_0x41a404['id'];return db[_0xee57('0x57')][_0xee57('0x4b')](_0x194587[_0xee57('0x54')]);}})[_0xee57('0x27')](respondWithResult(_0x5ca140,null))[_0xee57('0x47')](handleError(_0x5ca140,null));};exports[_0xee57('0x5a')]=function(_0x297b4f,_0x1d209f,_0x256565){var _0x34e714={};var _0x58a6f0={};var _0x35ea81;var _0x594b66;return db[_0xee57('0x43')]['findOne']({'where':{'id':_0x297b4f[_0xee57('0x48')]['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x1d209f,null))[_0xee57('0x27')](function(_0x237df9){if(_0x237df9){_0x35ea81=_0x237df9;_0x58a6f0[_0xee57('0x2f')]=_[_0xee57('0x32')](db[_0xee57('0x57')][_0xee57('0x2d')]);_0x58a6f0[_0xee57('0x31')]=_['keys'](_0x297b4f[_0xee57('0x31')]);_0x58a6f0[_0xee57('0x33')]=_['intersection'](_0x58a6f0['model'],_0x58a6f0[_0xee57('0x31')]);_0x34e714[_0xee57('0x35')]=_[_0xee57('0x34')](_0x58a6f0[_0xee57('0x2f')],qs['fields'](_0x297b4f[_0xee57('0x31')][_0xee57('0x36')]));_0x34e714[_0xee57('0x35')]=_0x34e714[_0xee57('0x35')][_0xee57('0x37')]?_0x34e714[_0xee57('0x35')]:_0x58a6f0['model'];_0x34e714[_0xee57('0x3b')]=qs[_0xee57('0x3c')](_0x297b4f[_0xee57('0x31')][_0xee57('0x3c')]);_0x34e714[_0xee57('0x3d')]=qs['filters'](_[_0xee57('0x3e')](_0x297b4f[_0xee57('0x31')],_0x58a6f0[_0xee57('0x33')]));if(_0x297b4f[_0xee57('0x31')][_0xee57('0x3f')]){_0x34e714[_0xee57('0x3d')]=_[_0xee57('0x40')](_0x34e714[_0xee57('0x3d')],{'$or':_[_0xee57('0x30')](_0x34e714['attributes'],function(_0x379654){var _0x5972ca={};_0x5972ca[_0x379654]={'$like':'%'+_0x297b4f[_0xee57('0x31')][_0xee57('0x3f')]+'%'};return _0x5972ca;})});}_0x34e714=_['merge']({},_0x34e714,_0x297b4f[_0xee57('0x42')]);return _0x35ea81[_0xee57('0x5a')](_0x34e714);}})['then'](function(_0x20f530){if(_0x20f530){_0x594b66=_0x20f530[_0xee57('0x37')];if(!_0x297b4f[_0xee57('0x31')]['hasOwnProperty'](_0xee57('0x39'))){_0x34e714[_0xee57('0x3a')]=qs[_0xee57('0x3a')](_0x297b4f[_0xee57('0x31')][_0xee57('0x3a')]);_0x34e714[_0xee57('0x1c')]=qs[_0xee57('0x1c')](_0x297b4f[_0xee57('0x31')][_0xee57('0x1c')]);}return _0x35ea81[_0xee57('0x5a')](_0x34e714);}})[_0xee57('0x27')](function(_0x2131f5){if(_0x2131f5){return _0x2131f5?{'count':_0x594b66,'rows':_0x2131f5}:null;}})[_0xee57('0x27')](respondWithResult(_0x1d209f,null))['catch'](handleError(_0x1d209f,null));};exports[_0xee57('0x5b')]=function(_0x52b490,_0x410f5b,_0x3f46fd){var _0x22d9aa={};var _0x1a7e50={};var _0x3f027d;var _0x570de5;return db[_0xee57('0x43')][_0xee57('0x5c')]({'where':{'id':_0x52b490[_0xee57('0x48')]['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x410f5b,null))['then'](function(_0x18c4be){if(_0x18c4be){_0x3f027d=_0x18c4be;_0x1a7e50['model']=_['keys'](db[_0xee57('0x57')]['rawAttributes']);_0x1a7e50[_0xee57('0x31')]=_[_0xee57('0x32')](_0x52b490[_0xee57('0x31')]);_0x1a7e50[_0xee57('0x33')]=_[_0xee57('0x34')](_0x1a7e50['model'],_0x1a7e50[_0xee57('0x31')]);_0x22d9aa['attributes']=_['intersection'](_0x1a7e50['model'],qs['fields'](_0x52b490[_0xee57('0x31')][_0xee57('0x36')]));_0x22d9aa['attributes']=_0x22d9aa['attributes']['length']?_0x22d9aa[_0xee57('0x35')]:_0x1a7e50[_0xee57('0x2f')];_0x22d9aa[_0xee57('0x3b')]=qs[_0xee57('0x3c')](_0x52b490[_0xee57('0x31')]['sort']);_0x22d9aa[_0xee57('0x3d')]=qs['filters'](_[_0xee57('0x3e')](_0x52b490[_0xee57('0x31')],_0x1a7e50[_0xee57('0x33')]));if(_0x52b490[_0xee57('0x31')]['filter']){_0x22d9aa[_0xee57('0x3d')]=_[_0xee57('0x40')](_0x22d9aa[_0xee57('0x3d')],{'$or':_[_0xee57('0x30')](_0x22d9aa[_0xee57('0x35')],function(_0x5d0e16){var _0x3bf885={};_0x3bf885[_0x5d0e16]={'$like':'%'+_0x52b490[_0xee57('0x31')][_0xee57('0x3f')]+'%'};return _0x3bf885;})});}_0x22d9aa=_[_0xee57('0x40')]({},_0x22d9aa,_0x52b490['options']);return _0x3f027d[_0xee57('0x5b')](_0x22d9aa);}})[_0xee57('0x27')](function(_0x102480){if(_0x102480){_0x570de5=_0x102480['length'];if(!_0x52b490['query'][_0xee57('0x38')](_0xee57('0x39'))){_0x22d9aa['limit']=qs[_0xee57('0x3a')](_0x52b490[_0xee57('0x31')]['limit']);_0x22d9aa[_0xee57('0x1c')]=qs[_0xee57('0x1c')](_0x52b490[_0xee57('0x31')][_0xee57('0x1c')]);}return _0x3f027d[_0xee57('0x5b')](_0x22d9aa);}})[_0xee57('0x27')](function(_0x43a8c8){if(_0x43a8c8){return _0x43a8c8?{'count':_0x570de5,'rows':_0x43a8c8}:null;}})['then'](respondWithResult(_0x410f5b,null))[_0xee57('0x47')](handleError(_0x410f5b,null));};exports[_0xee57('0x5d')]=function(_0x22be85,_0x247b6a,_0x90ab83){if(_0x22be85[_0xee57('0x54')]['id']){delete _0x22be85['body']['id'];}return db[_0xee57('0x43')][_0xee57('0x4a')]({'where':{'id':_0x22be85[_0xee57('0x48')]['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x247b6a,null))[_0xee57('0x27')](function(_0x4253b1){if(_0x4253b1){_0x22be85[_0xee57('0x54')][_0xee57('0x5e')]=_0x4253b1['id'];return db[_0xee57('0x5f')][_0xee57('0x4b')](_0x22be85[_0xee57('0x54')]);}})[_0xee57('0x27')](respondWithResult(_0x247b6a,null))[_0xee57('0x47')](handleError(_0x247b6a,null));};exports[_0xee57('0x60')]=function(_0x1d6405,_0x129738,_0x41a290){var _0x8d92b4={};var _0x59018b={};var _0x2927f8;var _0x2bbd61;return db[_0xee57('0x43')][_0xee57('0x5c')]({'where':{'id':_0x1d6405[_0xee57('0x48')]['id']}})[_0xee57('0x27')](handleEntityNotFound(_0x129738,null))[_0xee57('0x27')](function(_0xf8a65e){if(_0xf8a65e){_0x2927f8=_0xf8a65e;_0x59018b[_0xee57('0x2f')]=_[_0xee57('0x32')](db[_0xee57('0x5f')][_0xee57('0x2d')]);_0x59018b['query']=_[_0xee57('0x32')](_0x1d6405['query']);_0x59018b[_0xee57('0x33')]=_[_0xee57('0x34')](_0x59018b[_0xee57('0x2f')],_0x59018b[_0xee57('0x31')]);_0x8d92b4['attributes']=_['intersection'](_0x59018b['model'],qs[_0xee57('0x36')](_0x1d6405['query'][_0xee57('0x36')]));_0x8d92b4[_0xee57('0x35')]=_0x8d92b4[_0xee57('0x35')]['length']?_0x8d92b4['attributes']:_0x59018b[_0xee57('0x2f')];_0x8d92b4[_0xee57('0x3b')]=qs[_0xee57('0x3c')](_0x1d6405[_0xee57('0x31')][_0xee57('0x3c')]);_0x8d92b4['where']=qs[_0xee57('0x33')](_[_0xee57('0x3e')](_0x1d6405[_0xee57('0x31')],_0x59018b[_0xee57('0x33')]));if(_0x1d6405[_0xee57('0x31')][_0xee57('0x3f')]){_0x8d92b4[_0xee57('0x3d')]=_[_0xee57('0x40')](_0x8d92b4['where'],{'$or':_[_0xee57('0x30')](_0x8d92b4['attributes'],function(_0xca0a82){var _0x1b7dc0={};_0x1b7dc0[_0xca0a82]={'$like':'%'+_0x1d6405[_0xee57('0x31')]['filter']+'%'};return _0x1b7dc0;})});}_0x8d92b4=_['merge']({},_0x8d92b4,_0x1d6405[_0xee57('0x42')]);return _0x2927f8[_0xee57('0x60')](_0x8d92b4);}})[_0xee57('0x27')](function(_0x3f895c){if(_0x3f895c){_0x2bbd61=_0x3f895c['length'];if(!_0x1d6405['query']['hasOwnProperty']('nolimit')){_0x8d92b4[_0xee57('0x3a')]=qs['limit'](_0x1d6405[_0xee57('0x31')][_0xee57('0x3a')]);_0x8d92b4[_0xee57('0x1c')]=qs[_0xee57('0x1c')](_0x1d6405[_0xee57('0x31')][_0xee57('0x1c')]);}return _0x2927f8[_0xee57('0x60')](_0x8d92b4);}})[_0xee57('0x27')](function(_0x58f27d){if(_0x58f27d){return _0x58f27d?{'count':_0x2bbd61,'rows':_0x58f27d}:null;}})['then'](respondWithResult(_0x129738,null))[_0xee57('0x47')](handleError(_0x129738,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 0ff79be..3e21ea2 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 _0xc831=['request-promise','path','rimraf','../../config/environment','./trigger.attributes','Trigger','tools_triggers','util','../../config/logger','api','moment','bluebird'];(function(_0x16a07c,_0x16c748){var _0x293e5e=function(_0x2259c0){while(--_0x2259c0){_0x16a07c['push'](_0x16a07c['shift']());}};_0x293e5e(++_0x16c748);}(_0xc831,0x103));var _0x1c83=function(_0x2d5d9f,_0x380af7){_0x2d5d9f=_0x2d5d9f-0x0;var _0x21ee29=_0xc831[_0x2d5d9f];return _0x21ee29;};'use strict';var _=require('lodash');var util=require(_0x1c83('0x0'));var logger=require(_0x1c83('0x1'))(_0x1c83('0x2'));var moment=require(_0x1c83('0x3'));var BPromise=require(_0x1c83('0x4'));var rp=require(_0x1c83('0x5'));var fs=require('fs');var path=require(_0x1c83('0x6'));var rimraf=require(_0x1c83('0x7'));var config=require(_0x1c83('0x8'));var attributes=require(_0x1c83('0x9'));module['exports']=function(_0x5682fb,_0x2f52ea){return _0x5682fb['define'](_0x1c83('0xa'),attributes,{'tableName':_0x1c83('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8135=['moment','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8135,0x99));var _0x5813=function(_0x46c688,_0x32ee64){_0x46c688=_0x46c688-0x0;var _0x17b5d3=_0x8135[_0x46c688];return _0x17b5d3;};'use strict';var _=require('lodash');var util=require(_0x5813('0x0'));var logger=require(_0x5813('0x1'))(_0x5813('0x2'));var moment=require(_0x5813('0x3'));var BPromise=require('bluebird');var rp=require(_0x5813('0x4'));var fs=require('fs');var path=require(_0x5813('0x5'));var rimraf=require(_0x5813('0x6'));var config=require(_0x5813('0x7'));var attributes=require(_0x5813('0x8'));module['exports']=function(_0x57ac38,_0x27599d){return _0x57ac38[_0x5813('0x9')](_0x5813('0xa'),attributes,{'tableName':_0x5813('0xb'),'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 a333338..de39935 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 _0x982a=['rpc','../../config/environment','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','where','attributes','limit','include','map','model','GetTrigger','catch','ShowTrigger','Trigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x982a,0xb5));var _0xa982=function(_0x232107,_0x1661f3){_0x232107=_0x232107-0x0;var _0x1d2dca=_0x982a[_0x232107];return _0x1d2dca;};'use strict';var _=require(_0xa982('0x0'));var util=require(_0xa982('0x1'));var moment=require(_0xa982('0x2'));var BPromise=require(_0xa982('0x3'));var rs=require(_0xa982('0x4'));var fs=require('fs');var Redis=require(_0xa982('0x5'));var db=require(_0xa982('0x6'))['db'];var utils=require(_0xa982('0x7'));var logger=require(_0xa982('0x8'))(_0xa982('0x9'));var config=require(_0xa982('0xa'));var jayson=require(_0xa982('0xb'));var client=jayson['client'][_0xa982('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x110fc9,_0x3ebae7,_0x5f25f3){return new BPromise(function(_0x25e59f,_0x118c47){return client[_0xa982('0xd')](_0x110fc9,_0x5f25f3)[_0xa982('0xe')](function(_0x2f3c78){logger[_0xa982('0xf')](_0xa982('0x10'),_0x3ebae7,_0xa982('0x11'));logger[_0xa982('0x12')](_0xa982('0x13'),_0x3ebae7,'request\x20sent',JSON[_0xa982('0x14')](_0x2f3c78));if(_0x2f3c78[_0xa982('0x15')]){if(_0x2f3c78[_0xa982('0x15')][_0xa982('0x16')]===0x1f4){logger[_0xa982('0x15')](_0xa982('0x10'),_0x3ebae7,_0x2f3c78[_0xa982('0x15')]['message']);return _0x118c47(_0x2f3c78['error'][_0xa982('0x17')]);}logger[_0xa982('0x15')]('Trigger,\x20%s,\x20%s',_0x3ebae7,_0x2f3c78[_0xa982('0x15')][_0xa982('0x17')]);return _0x25e59f(_0x2f3c78[_0xa982('0x15')][_0xa982('0x17')]);}else{logger[_0xa982('0xf')]('Trigger,\x20%s,\x20%s',_0x3ebae7,'request\x20sent');_0x25e59f(_0x2f3c78[_0xa982('0x18')]['message']);}})['catch'](function(_0x458864){logger[_0xa982('0x15')](_0xa982('0x10'),_0x3ebae7,_0x458864);_0x118c47(_0x458864);});});}exports['GetTrigger']=function(_0x37b133){var _0x58e7e1=this;return new Promise(function(_0xec8f61,_0x4633f7){return db['Trigger'][_0xa982('0x19')]({'raw':_0x37b133[_0xa982('0x1a')]?_0x37b133[_0xa982('0x1a')][_0xa982('0x1b')]===undefined?!![]:![]:!![],'where':_0x37b133[_0xa982('0x1a')]?_0x37b133['options'][_0xa982('0x1c')]||null:null,'attributes':_0x37b133[_0xa982('0x1a')]?_0x37b133['options'][_0xa982('0x1d')]||null:null,'limit':_0x37b133[_0xa982('0x1a')]?_0x37b133['options'][_0xa982('0x1e')]||null:null,'include':_0x37b133[_0xa982('0x1a')]?_0x37b133[_0xa982('0x1a')][_0xa982('0x1f')]?_[_0xa982('0x20')](_0x37b133[_0xa982('0x1a')][_0xa982('0x1f')],function(_0x1b0c23){return{'model':db[_0x1b0c23['model']],'as':_0x1b0c23['as'],'attributes':_0x1b0c23[_0xa982('0x1d')],'include':_0x1b0c23[_0xa982('0x1f')]?_[_0xa982('0x20')](_0x1b0c23[_0xa982('0x1f')],function(_0x351a8f){return{'model':db[_0x351a8f[_0xa982('0x21')]],'as':_0x351a8f['as'],'attributes':_0x351a8f[_0xa982('0x1d')],'include':_0x351a8f['include']?_[_0xa982('0x20')](_0x351a8f[_0xa982('0x1f')],function(_0x4ca2bc){return{'model':db[_0x4ca2bc[_0xa982('0x21')]],'as':_0x4ca2bc['as'],'attributes':_0x4ca2bc[_0xa982('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa982('0xe')](function(_0x95911e){logger[_0xa982('0xf')](_0xa982('0x22'),_0x37b133);logger[_0xa982('0x12')](_0xa982('0x22'),_0x37b133,JSON[_0xa982('0x14')](_0x95911e));_0xec8f61(_0x95911e);})[_0xa982('0x23')](function(_0xed115f){logger['error'](_0xa982('0x22'),_0xed115f[_0xa982('0x17')],_0x37b133);_0x4633f7(_0x58e7e1['error'](0x1f4,_0xed115f[_0xa982('0x17')]));});});};exports[_0xa982('0x24')]=function(_0x2e34b8){var _0x5acd04=this;return new Promise(function(_0x430d9e,_0x397f59){return db[_0xa982('0x25')]['find']({'raw':_0x2e34b8['options']?_0x2e34b8['options'][_0xa982('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e34b8[_0xa982('0x1a')]?_0x2e34b8[_0xa982('0x1a')][_0xa982('0x1c')]||null:null,'attributes':_0x2e34b8[_0xa982('0x1a')]?_0x2e34b8['options'][_0xa982('0x1d')]||null:null,'include':_0x2e34b8[_0xa982('0x1a')]?_0x2e34b8[_0xa982('0x1a')]['include']?_[_0xa982('0x20')](_0x2e34b8[_0xa982('0x1a')][_0xa982('0x1f')],function(_0x16673e){return{'model':db[_0x16673e[_0xa982('0x21')]],'as':_0x16673e['as'],'attributes':_0x16673e['attributes'],'include':_0x16673e[_0xa982('0x1f')]?_[_0xa982('0x20')](_0x16673e[_0xa982('0x1f')],function(_0x27ad5c){return{'model':db[_0x27ad5c['model']],'as':_0x27ad5c['as'],'attributes':_0x27ad5c[_0xa982('0x1d')],'include':_0x27ad5c[_0xa982('0x1f')]?_[_0xa982('0x20')](_0x27ad5c['include'],function(_0x53be7e){return{'model':db[_0x53be7e[_0xa982('0x21')]],'as':_0x53be7e['as'],'attributes':_0x53be7e[_0xa982('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa982('0xe')](function(_0x5e1ad1){logger['info'](_0xa982('0x24'),_0x2e34b8);logger['debug'](_0xa982('0x24'),_0x2e34b8,JSON[_0xa982('0x14')](_0x5e1ad1));_0x430d9e(_0x5e1ad1);})[_0xa982('0x23')](function(_0x31ec94){logger[_0xa982('0x15')]('ShowTrigger',_0x31ec94[_0xa982('0x17')],_0x2e34b8);_0x397f59(_0x5acd04['error'](0x1f4,_0x31ec94[_0xa982('0x17')]));});});}; \ No newline at end of file +var _0xc208=['error','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowTrigger','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x55e66e,_0x2413f7){var _0x19f51e=function(_0x4d8184){while(--_0x4d8184){_0x55e66e['push'](_0x55e66e['shift']());}};_0x19f51e(++_0x2413f7);}(_0xc208,0xa2));var _0x8c20=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc208[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x8c20('0x0'));var util=require(_0x8c20('0x1'));var moment=require('moment');var BPromise=require(_0x8c20('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c20('0x3'));var db=require(_0x8c20('0x4'))['db'];var utils=require(_0x8c20('0x5'));var logger=require(_0x8c20('0x6'))(_0x8c20('0x7'));var config=require(_0x8c20('0x8'));var jayson=require(_0x8c20('0x9'));var client=jayson['client'][_0x8c20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x133e4d,_0xab6920,_0x1f5fce){return new BPromise(function(_0xd33651,_0x10abea){return client[_0x8c20('0xb')](_0x133e4d,_0x1f5fce)['then'](function(_0x253ddd){logger[_0x8c20('0xc')](_0x8c20('0xd'),_0xab6920,'request\x20sent');logger[_0x8c20('0xe')](_0x8c20('0xf'),_0xab6920,_0x8c20('0x10'),JSON[_0x8c20('0x11')](_0x253ddd));if(_0x253ddd[_0x8c20('0x12')]){if(_0x253ddd[_0x8c20('0x12')]['code']===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0xab6920,_0x253ddd[_0x8c20('0x12')][_0x8c20('0x13')]);return _0x10abea(_0x253ddd[_0x8c20('0x12')][_0x8c20('0x13')]);}logger['error'](_0x8c20('0xd'),_0xab6920,_0x253ddd[_0x8c20('0x12')][_0x8c20('0x13')]);return _0xd33651(_0x253ddd['error'][_0x8c20('0x13')]);}else{logger[_0x8c20('0xc')]('Trigger,\x20%s,\x20%s',_0xab6920,_0x8c20('0x10'));_0xd33651(_0x253ddd[_0x8c20('0x14')][_0x8c20('0x13')]);}})[_0x8c20('0x15')](function(_0x539e71){logger[_0x8c20('0x12')](_0x8c20('0xd'),_0xab6920,_0x539e71);_0x10abea(_0x539e71);});});}exports[_0x8c20('0x16')]=function(_0x1c6c98){var _0x2c0808=this;return new Promise(function(_0x1d40f5,_0x1b661f){return db[_0x8c20('0x17')][_0x8c20('0x18')]({'raw':_0x1c6c98['options']?_0x1c6c98[_0x8c20('0x19')][_0x8c20('0x1a')]===undefined?!![]:![]:!![],'where':_0x1c6c98[_0x8c20('0x19')]?_0x1c6c98[_0x8c20('0x19')][_0x8c20('0x1b')]||null:null,'attributes':_0x1c6c98[_0x8c20('0x19')]?_0x1c6c98[_0x8c20('0x19')]['attributes']||null:null,'limit':_0x1c6c98['options']?_0x1c6c98['options'][_0x8c20('0x1c')]||null:null,'include':_0x1c6c98[_0x8c20('0x19')]?_0x1c6c98[_0x8c20('0x19')][_0x8c20('0x1d')]?_[_0x8c20('0x1e')](_0x1c6c98[_0x8c20('0x19')][_0x8c20('0x1d')],function(_0x3e92b9){return{'model':db[_0x3e92b9[_0x8c20('0x1f')]],'as':_0x3e92b9['as'],'attributes':_0x3e92b9[_0x8c20('0x20')],'include':_0x3e92b9[_0x8c20('0x1d')]?_[_0x8c20('0x1e')](_0x3e92b9[_0x8c20('0x1d')],function(_0x1fe58d){return{'model':db[_0x1fe58d[_0x8c20('0x1f')]],'as':_0x1fe58d['as'],'attributes':_0x1fe58d[_0x8c20('0x20')],'include':_0x1fe58d[_0x8c20('0x1d')]?_[_0x8c20('0x1e')](_0x1fe58d['include'],function(_0xc8d972){return{'model':db[_0xc8d972['model']],'as':_0xc8d972['as'],'attributes':_0xc8d972['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c20('0x21')](function(_0x2f2e99){logger[_0x8c20('0xc')](_0x8c20('0x16'),_0x1c6c98);logger[_0x8c20('0xe')](_0x8c20('0x16'),_0x1c6c98,JSON['stringify'](_0x2f2e99));_0x1d40f5(_0x2f2e99);})[_0x8c20('0x15')](function(_0x2d7b24){logger['error'](_0x8c20('0x16'),_0x2d7b24[_0x8c20('0x13')],_0x1c6c98);_0x1b661f(_0x2c0808[_0x8c20('0x12')](0x1f4,_0x2d7b24[_0x8c20('0x13')]));});});};exports[_0x8c20('0x22')]=function(_0x404d16){var _0x127dfe=this;return new Promise(function(_0xe259d5,_0x47cc5c){return db['Trigger'][_0x8c20('0x23')]({'raw':_0x404d16[_0x8c20('0x19')]?_0x404d16[_0x8c20('0x19')][_0x8c20('0x1a')]===undefined?!![]:![]:!![],'where':_0x404d16[_0x8c20('0x19')]?_0x404d16[_0x8c20('0x19')]['where']||null:null,'attributes':_0x404d16['options']?_0x404d16['options'][_0x8c20('0x20')]||null:null,'include':_0x404d16['options']?_0x404d16[_0x8c20('0x19')][_0x8c20('0x1d')]?_[_0x8c20('0x1e')](_0x404d16[_0x8c20('0x19')][_0x8c20('0x1d')],function(_0x4aeb61){return{'model':db[_0x4aeb61[_0x8c20('0x1f')]],'as':_0x4aeb61['as'],'attributes':_0x4aeb61[_0x8c20('0x20')],'include':_0x4aeb61[_0x8c20('0x1d')]?_[_0x8c20('0x1e')](_0x4aeb61[_0x8c20('0x1d')],function(_0x40a95e){return{'model':db[_0x40a95e[_0x8c20('0x1f')]],'as':_0x40a95e['as'],'attributes':_0x40a95e['attributes'],'include':_0x40a95e[_0x8c20('0x1d')]?_['map'](_0x40a95e[_0x8c20('0x1d')],function(_0x4a32f7){return{'model':db[_0x4a32f7['model']],'as':_0x4a32f7['as'],'attributes':_0x4a32f7[_0x8c20('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8c20('0x21')](function(_0x543b73){logger[_0x8c20('0xc')](_0x8c20('0x22'),_0x404d16);logger[_0x8c20('0xe')]('ShowTrigger',_0x404d16,JSON['stringify'](_0x543b73));_0xe259d5(_0x543b73);})[_0x8c20('0x15')](function(_0xbb6cff){logger[_0x8c20('0x12')]('ShowTrigger',_0xbb6cff[_0x8c20('0x13')],_0x404d16);_0x47cc5c(_0x127dfe[_0x8c20('0x12')](0x1f4,_0xbb6cff[_0x8c20('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 233e543..469715f 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 _0x78b9=['get','index','/:id','show','post','/:id/clone','clone','create','put','isAuthenticated','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller'];(function(_0x219bdc,_0x2db0d9){var _0x2abdb6=function(_0x409467){while(--_0x409467){_0x219bdc['push'](_0x219bdc['shift']());}};_0x2abdb6(++_0x2db0d9);}(_0x78b9,0x1f0));var _0x978b=function(_0x2f1ec1,_0x136a93){_0x2f1ec1=_0x2f1ec1-0x0;var _0x3664c3=_0x78b9[_0x2f1ec1];return _0x3664c3;};'use strict';var multer=require('multer');var util=require(_0x978b('0x0'));var path=require('path');var timeout=require(_0x978b('0x1'));var express=require(_0x978b('0x2'));var router=express[_0x978b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x978b('0x4'));var interaction=require(_0x978b('0x5'));var config=require(_0x978b('0x6'));var controller=require(_0x978b('0x7'));router[_0x978b('0x8')]('/',auth['isAuthenticated'](),controller[_0x978b('0x9')]);router[_0x978b('0x8')](_0x978b('0xa'),auth['isAuthenticated'](),controller[_0x978b('0xb')]);router[_0x978b('0xc')](_0x978b('0xd'),auth['isAuthenticated'](),controller[_0x978b('0xe')]);router[_0x978b('0xc')]('/',auth['isAuthenticated'](),controller[_0x978b('0xf')]);router[_0x978b('0x10')](_0x978b('0xa'),auth[_0x978b('0x11')](),controller[_0x978b('0x12')]);router[_0x978b('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x978b('0x14')]=router; \ No newline at end of file +var _0x66d6=['delete','destroy','exports','multer','path','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x66d6,0x153));var _0x666d=function(_0x5497d3,_0x193adf){_0x5497d3=_0x5497d3-0x0;var _0x42f1ef=_0x66d6[_0x5497d3];return _0x42f1ef;};'use strict';var multer=require(_0x666d('0x0'));var util=require('util');var path=require(_0x666d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x666d('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x666d('0x3'));var controller=require('./trunk.controller');router[_0x666d('0x4')]('/',auth[_0x666d('0x5')](),controller[_0x666d('0x6')]);router[_0x666d('0x4')](_0x666d('0x7'),auth[_0x666d('0x5')](),controller[_0x666d('0x8')]);router[_0x666d('0x9')](_0x666d('0xa'),auth[_0x666d('0x5')](),controller[_0x666d('0xb')]);router[_0x666d('0x9')]('/',auth['isAuthenticated'](),controller[_0x666d('0xc')]);router['put'](_0x666d('0x7'),auth[_0x666d('0x5')](),controller['update']);router[_0x666d('0xd')]('/:id',auth[_0x666d('0x5')](),controller[_0x666d('0xe')]);module[_0x666d('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 224f25e..9e35ce3 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 _0x3883=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','nonat','update','outgoing','yes','nat','join','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','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','dynamic','BOOLEAN','exports','STRING','name','user','peer','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','getDataValue'];(function(_0x128e58,_0x2cc4cf){var _0x5c4008=function(_0x53fce3){while(--_0x53fce3){_0x128e58['push'](_0x128e58['shift']());}};_0x5c4008(++_0x2cc4cf);}(_0x3883,0x1a9));var _0x3388=function(_0x1e0b99,_0x1ff12c){_0x1e0b99=_0x1e0b99-0x0;var _0xd451a6=_0x3883[_0x1e0b99];return _0xd451a6;};'use strict';var Sequelize=require('sequelize');module[_0x3388('0x0')]={'name':{'type':Sequelize[_0x3388('0x1')],'allowNull':![],'unique':_0x3388('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0x3388('0x3'),_0x3388('0x4')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x6'),'ALLOWED_PASSED_SCREEN',_0x3388('0x7'),_0x3388('0x8'),_0x3388('0x9'),_0x3388('0xa'),_0x3388('0xb'),_0x3388('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x3388('0x1')]},'secret':{'type':Sequelize[_0x3388('0x1')]},'md5secret':{'type':Sequelize[_0x3388('0x1')]},'remotesecret':{'type':Sequelize[_0x3388('0x1')]},'transport':{'type':Sequelize[_0x3388('0x1')],'defaultValue':'udp','set':function(_0x408043){this[_0x3388('0xd')](_0x3388('0xe'),_0x408043?_0x408043['join'](','):null);},'get':function(){return this[_0x3388('0xf')]('transport')?this[_0x3388('0xf')](_0x3388('0xe'))[_0x3388('0x10')](','):null;},'comment':_0x3388('0x11')},'dtmfmode':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x12'),_0x3388('0x13'),_0x3388('0x14'),'inband',_0x3388('0x15')),'defaultValue':_0x3388('0x12')},'directmedia':{'type':Sequelize[_0x3388('0x5')]('yes','no',_0x3388('0x16'),_0x3388('0x17'),_0x3388('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3388('0x1')]},'directmediadeny':{'type':Sequelize[_0x3388('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x59c07c){this[_0x3388('0xd')](_0x3388('0x1a'),_0x59c07c?_0x59c07c[_0x3388('0x1b')](','):null);},'get':function(){return this[_0x3388('0xf')](_0x3388('0x1a'))?this[_0x3388('0xf')]('nat')[_0x3388('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x3388('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x3388('0x1')]},'language':{'type':Sequelize[_0x3388('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3388('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3388('0x1')],'defaultValue':_0x3388('0x1c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x392f6d){this['setDataValue'](_0x3388('0x1d'),_0x392f6d?_0x392f6d[_0x3388('0x1b')](';'):_0x3388('0x1e'));},'get':function(){return this['getDataValue'](_0x3388('0x1d'))?this[_0x3388('0xf')](_0x3388('0x1d'))[_0x3388('0x10')](';'):null;},'comment':_0x3388('0x1f')},'autoframing':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x3388('0x20'),'set':function(_0x389b39){this[_0x3388('0xd')](_0x3388('0x21'),_0x389b39?_0x389b39[_0x3388('0x1b')](','):null);},'get':function(){return this[_0x3388('0xf')](_0x3388('0x21'))?this[_0x3388('0xf')](_0x3388('0x21'))[_0x3388('0x10')](','):null;},'comment':_0x3388('0x22')},'trustrpid':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x3388('0x19'),'no',_0x3388('0x23'))},'promiscredir':{'type':Sequelize['ENUM'](_0x3388('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x19'),'no')},'accountcode':{'type':Sequelize[_0x3388('0x24')](0xb)},'setvar':{'type':Sequelize[_0x3388('0x1')]},'callerid':{'type':Sequelize[_0x3388('0x1')],'defaultValue':_0x3388('0x25')},'amaflags':{'type':Sequelize[_0x3388('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x3388('0x19'),'no'),'defaultValue':_0x3388('0x19')},'busylevel':{'type':Sequelize[_0x3388('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x3388('0x5')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x3388('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x3388('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x19'),'no',_0x3388('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3388('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x19'),'no')},'mailbox':{'type':Sequelize[_0x3388('0x1')]},'session_timers':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x27'),_0x3388('0x28'),_0x3388('0x29'))},'session_expires':{'type':Sequelize[_0x3388('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x3388('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x2a'),_0x3388('0x2b')),'defaultValue':_0x3388('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x3388('0x1')]},'regexten':{'type':Sequelize[_0x3388('0x1')]},'fromdomain':{'type':Sequelize[_0x3388('0x1')]},'fromuser':{'type':Sequelize[_0x3388('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x3388('0x1')]},'rtptimeout':{'type':Sequelize[_0x3388('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3388('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x3388('0x19'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3388('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x3388('0x24')](0xb)},'timerb':{'type':Sequelize[_0x3388('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3388('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x3388('0x1')]},'contactdeny':{'type':Sequelize[_0x3388('0x1')]},'contactacl':{'type':Sequelize[_0x3388('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x3388('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x3388('0x24')](0xb)},'encryption':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x19'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x3388('0x19'),'no')},'icesupport':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x3388('0x5')](_0x3388('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x3388('0x5')]('yes','no','fingerprint',_0x3388('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x3388('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3388('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x3388('0x1')]},'dtlscafile':{'type':Sequelize[_0x3388('0x1')]},'dtlscapath':{'type':Sequelize[_0x3388('0x1')]},'dtlssetup':{'type':Sequelize[_0x3388('0x5')]('active',_0x3388('0x2d'),_0x3388('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3388('0x1')]},'usereqphone':{'type':Sequelize[_0x3388('0x5')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3388('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3388('0x5')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x3388('0x19'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x3388('0x1')]},'mohsuggest':{'type':Sequelize[_0x3388('0x1')]},'parkinglot':{'type':Sequelize[_0x3388('0x1')]},'description':{'type':Sequelize[_0x3388('0x1')]},'host':{'type':Sequelize[_0x3388('0x1')],'defaultValue':_0x3388('0x2f')},'canreinvite':{'type':Sequelize[_0x3388('0x5')]('yes','no',_0x3388('0x16'),_0x3388('0x17'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3388('0x1')]},'otherFields':{'type':Sequelize[_0x3388('0x1')]},'active':{'type':Sequelize[_0x3388('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x9b55=['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','INTEGER','\x22\x22\x20<>','always','originate','uac','uas','pai','passive','nonat','update,nonat','sequelize','exports','STRING','name','ENUM','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','auto','rfc2833','yes','update','outgoing','force_rport,comedia','setDataValue','nat'];(function(_0x7f9224,_0x186851){var _0x3bc305=function(_0x35c046){while(--_0x35c046){_0x7f9224['push'](_0x7f9224['shift']());}};_0x3bc305(++_0x186851);}(_0x9b55,0x155));var _0x59b5=function(_0x33fa0b,_0x5d48b6){_0x33fa0b=_0x33fa0b-0x0;var _0x4e17a8=_0x9b55[_0x33fa0b];return _0x4e17a8;};'use strict';var Sequelize=require(_0x59b5('0x0'));module[_0x59b5('0x1')]={'name':{'type':Sequelize[_0x59b5('0x2')],'allowNull':![],'unique':_0x59b5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x59b5('0x4')]('friend','user',_0x59b5('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x59b5('0x2')],'allowNull':![],'defaultValue':_0x59b5('0x6')},'callingpres':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x7'),_0x59b5('0x8'),_0x59b5('0x9'),'ALLOWED',_0x59b5('0xa'),'PROHIB_PASSED_SCREEN',_0x59b5('0xb'),_0x59b5('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x59b5('0x2')]},'secret':{'type':Sequelize[_0x59b5('0x2')]},'md5secret':{'type':Sequelize[_0x59b5('0x2')]},'remotesecret':{'type':Sequelize[_0x59b5('0x2')]},'transport':{'type':Sequelize[_0x59b5('0x2')],'defaultValue':'udp','set':function(_0xddffad){this['setDataValue'](_0x59b5('0xd'),_0xddffad?_0xddffad[_0x59b5('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x59b5('0xd'))?this[_0x59b5('0xf')](_0x59b5('0xd'))[_0x59b5('0x10')](','):null;},'comment':_0x59b5('0x11')},'dtmfmode':{'type':Sequelize[_0x59b5('0x4')]('rfc2833',_0x59b5('0x12'),'shortinfo','inband',_0x59b5('0x13')),'defaultValue':_0x59b5('0x14')},'directmedia':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no','nonat',_0x59b5('0x16'),_0x59b5('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x59b5('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x59b5('0x2')]},'nat':{'type':Sequelize[_0x59b5('0x2')],'defaultValue':_0x59b5('0x18'),'set':function(_0x1b6525){this[_0x59b5('0x19')](_0x59b5('0x1a'),_0x1b6525?_0x1b6525[_0x59b5('0xe')](','):null);},'get':function(){return this[_0x59b5('0xf')]('nat')?this['getDataValue'](_0x59b5('0x1a'))[_0x59b5('0x10')](','):null;},'comment':_0x59b5('0x1b')},'callgroup':{'type':Sequelize[_0x59b5('0x2')]},'namedcallgroup':{'type':Sequelize[_0x59b5('0x2')]},'pickupgroup':{'type':Sequelize[_0x59b5('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x59b5('0x2')]},'language':{'type':Sequelize[_0x59b5('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x59b5('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x59b5('0x2')],'defaultValue':_0x59b5('0x1c')},'allow':{'type':Sequelize[_0x59b5('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xd8facb){this[_0x59b5('0x19')](_0x59b5('0x1d'),_0xd8facb?_0xd8facb[_0x59b5('0xe')](';'):_0x59b5('0x1e'));},'get':function(){return this[_0x59b5('0xf')](_0x59b5('0x1d'))?this['getDataValue'](_0x59b5('0x1d'))[_0x59b5('0x10')](';'):null;},'comment':_0x59b5('0x1f')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0x59b5('0x2')],'defaultValue':_0x59b5('0x20'),'set':function(_0x2a2a21){this['setDataValue'](_0x59b5('0x21'),_0x2a2a21?_0x2a2a21[_0x59b5('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x59b5('0x21'))?this[_0x59b5('0xf')](_0x59b5('0x21'))['split'](','):null;},'comment':_0x59b5('0x22')},'trustrpid':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x59b5('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no',_0x59b5('0x23'))},'promiscredir':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no')},'useclientcode':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no')},'accountcode':{'type':Sequelize[_0x59b5('0x24')](0xb)},'setvar':{'type':Sequelize[_0x59b5('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x59b5('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no'),'defaultValue':_0x59b5('0x15')},'busylevel':{'type':Sequelize[_0x59b5('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x59b5('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x59b5('0x15'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x59b5('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0x59b5('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x59b5('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x59b5('0x4')]('yes','no',_0x59b5('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x59b5('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x59b5('0x15'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM']('accept','refuse',_0x59b5('0x27'))},'session_expires':{'type':Sequelize[_0x59b5('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x59b5('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x28'),_0x59b5('0x29')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x59b5('0x2')]},'fromdomain':{'type':Sequelize[_0x59b5('0x2')]},'fromuser':{'type':Sequelize[_0x59b5('0x2')]},'port':{'type':Sequelize[_0x59b5('0x24')](0x5)},'qualify':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no'),'defaultValue':_0x59b5('0x15')},'keepalive':{'type':Sequelize[_0x59b5('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x59b5('0x2')]},'defaultuser':{'type':Sequelize[_0x59b5('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x59b5('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x59b5('0x4')]('yes','no',_0x59b5('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x59b5('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x59b5('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x59b5('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x59b5('0x2')]},'contactdeny':{'type':Sequelize[_0x59b5('0x2')]},'contactacl':{'type':Sequelize[_0x59b5('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x59b5('0x2')]},'use_q850_reason':{'type':Sequelize[_0x59b5('0x2')]},'maxforwards':{'type':Sequelize[_0x59b5('0x24')](0xb)},'encryption':{'type':Sequelize[_0x59b5('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x59b5('0x15'),'no')},'icesupport':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x59b5('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x59b5('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x59b5('0x2')]},'dtlscipher':{'type':Sequelize[_0x59b5('0x2')]},'dtlscafile':{'type':Sequelize[_0x59b5('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x59b5('0x4')]('active',_0x59b5('0x2b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x59b5('0x2')]},'usereqphone':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x59b5('0x2')]},'recordofffeature':{'type':Sequelize[_0x59b5('0x2')]},'call_limit':{'type':Sequelize[_0x59b5('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x59b5('0x15'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x59b5('0x15'),'no')},'vmexten':{'type':Sequelize[_0x59b5('0x2')]},'mohinterpret':{'type':Sequelize[_0x59b5('0x2')]},'mohsuggest':{'type':Sequelize[_0x59b5('0x2')]},'parkinglot':{'type':Sequelize[_0x59b5('0x2')]},'description':{'type':Sequelize[_0x59b5('0x2')]},'host':{'type':Sequelize[_0x59b5('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x59b5('0x4')](_0x59b5('0x15'),'no',_0x59b5('0x2c'),_0x59b5('0x16'),_0x59b5('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x59b5('0x2')]},'otherFields':{'type':Sequelize['STRING']},'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 799adb2..c0e5800 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 _0x9f62=['updatedAt','body','create','user','role','UserProfileSection','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','render','/etc/asterisk/sip_xcally_trunks.conf','Reload','server/files/templates/registry.ejs','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Trunk','findAll','rows','show','params','clone','find','omit','createdAt'];(function(_0xd98ca3,_0x38fbd9){var _0x35960d=function(_0x52e8ee){while(--_0x52e8ee){_0xd98ca3['push'](_0xd98ca3['shift']());}};_0x35960d(++_0x38fbd9);}(_0x9f62,0x154));var _0x29f6=function(_0x30f417,_0x17fa63){_0x30f417=_0x30f417-0x0;var _0x503660=_0x9f62[_0x30f417];return _0x503660;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x29f6('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x55cf4,_0x189344,_0x11a1fd,_0x17de6e){return new BPromise(function(_0x156c96,_0x35d2e2){var _0x2418ee=_0x17de6e||client;return _0x2418ee[_0x29f6('0x14')](_0x55cf4,_0x11a1fd)[_0x29f6('0x15')](function(_0x28d314){logger[_0x29f6('0x16')](_0x29f6('0x17'),_0x189344,_0x29f6('0x18'));logger[_0x29f6('0x19')](_0x29f6('0x1a'),_0x189344,_0x29f6('0x18'),JSON['stringify'](_0x28d314));if(_0x28d314['error']){if(_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger[_0x29f6('0x1b')]('Trunk,\x20%s,\x20%s',_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x35d2e2(_0x28d314['error'][_0x29f6('0x1d')]);}logger[_0x29f6('0x1b')](_0x29f6('0x17'),_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x156c96(_0x28d314[_0x29f6('0x1b')]['message']);}else{logger[_0x29f6('0x16')]('Trunk,\x20%s,\x20%s',_0x189344,'request\x20sent');_0x156c96(_0x28d314[_0x29f6('0x1e')][_0x29f6('0x1d')]);}})[_0x29f6('0x1f')](function(_0xafb5dd){logger['error'](_0x29f6('0x17'),_0x189344,_0xafb5dd);_0x35d2e2(_0xafb5dd);});});}function respondWithStatusCode(_0x49f67d,_0xd4179c){_0xd4179c=_0xd4179c||0xcc;return function(_0xcce041){if(_0xcce041){return _0x49f67d[_0x29f6('0x20')](_0xd4179c);}return _0x49f67d[_0x29f6('0x21')](_0xd4179c)['end']();};}function respondWithResult(_0x4290a2,_0x4d494f){_0x4d494f=_0x4d494f||0xc8;return function(_0x47c385){if(_0x47c385){return _0x4290a2[_0x29f6('0x21')](_0x4d494f)[_0x29f6('0x22')](_0x47c385);}};}function respondWithFilteredResult(_0x2519ac,_0x342038){return function(_0x84ccb7){if(_0x84ccb7){var _0x4333bc=typeof _0x342038[_0x29f6('0x23')]==='undefined'&&typeof _0x342038[_0x29f6('0x24')]===_0x29f6('0x25');var _0x1ab8d8=_0x84ccb7[_0x29f6('0x26')];var _0xda0a63=_0x4333bc?0x0:_0x342038[_0x29f6('0x23')];var _0x3790f5=_0x4333bc?_0x84ccb7[_0x29f6('0x26')]:_0x342038[_0x29f6('0x23')]+_0x342038[_0x29f6('0x24')];var _0x2915bc;if(_0x3790f5>=_0x1ab8d8){_0x3790f5=_0x1ab8d8;_0x2915bc=0xc8;}else{_0x2915bc=0xce;}_0x2519ac[_0x29f6('0x21')](_0x2915bc);return _0x2519ac[_0x29f6('0x27')](_0x29f6('0x28'),_0xda0a63+'-'+_0x3790f5+'/'+_0x1ab8d8)[_0x29f6('0x22')](_0x84ccb7);}return null;};}function patchUpdates(_0x218931){return function(_0x3a7249){try{jsonpatch['apply'](_0x3a7249,_0x218931,!![]);}catch(_0x5582d3){return BPromise[_0x29f6('0x29')](_0x5582d3);}return _0x3a7249['save']();};}function saveUpdates(_0x341071,_0xc8d2c5){return function(_0x1e1bb6){if(_0x1e1bb6){return _0x1e1bb6[_0x29f6('0x2a')](_0x341071)['then'](function(_0x53e11f){return _0x53e11f;});}return null;};}function removeEntity(_0x1bde69,_0xa6377c){return function(_0x2edc2e){if(_0x2edc2e){return _0x2edc2e[_0x29f6('0x2b')]()[_0x29f6('0x15')](function(){var _0x20bc5e=_0x2edc2e[_0x29f6('0x2c')]({'plain':!![]});var _0x1c3f0f=_0x29f6('0x2d');return db[_0x29f6('0x2e')][_0x29f6('0x2b')]({'where':{'type':_0x1c3f0f,'resourceId':_0x20bc5e['id']}})[_0x29f6('0x15')](function(){return _0x2edc2e;});})[_0x29f6('0x15')](function(){_0x1bde69[_0x29f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e31dd,_0x206beb){return function(_0x44cf19){if(!_0x44cf19){_0x5e31dd[_0x29f6('0x20')](0x194);}return _0x44cf19;};}function handleError(_0x5416dc,_0x3e1e25){_0x3e1e25=_0x3e1e25||0x1f4;return function(_0x749b9d){logger[_0x29f6('0x1b')](_0x749b9d[_0x29f6('0x2f')]);if(_0x749b9d[_0x29f6('0x30')]){delete _0x749b9d['name'];}_0x5416dc[_0x29f6('0x21')](_0x3e1e25)[_0x29f6('0x31')](_0x749b9d);};}exports[_0x29f6('0x32')]=function(_0x1b51cc,_0x4f5fe1){var _0x30d747={},_0x2a09e8={},_0x14b392={'count':0x0,'rows':[]};var _0x105557=_['map'](db['Trunk'][_0x29f6('0x33')],function(_0x4bfc80){return{'name':_0x4bfc80[_0x29f6('0x34')],'type':_0x4bfc80['type'][_0x29f6('0x35')]};});_0x2a09e8['model']=_[_0x29f6('0x36')](_0x105557,_0x29f6('0x30'));_0x2a09e8['query']=_[_0x29f6('0x37')](_0x1b51cc['query']);_0x2a09e8[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x2a09e8['model'],_0x2a09e8[_0x29f6('0x3a')]);_0x30d747[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2a09e8[_0x29f6('0x3c')],qs['fields'](_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x3d')]));_0x30d747[_0x29f6('0x3b')]=_0x30d747[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x30d747['attributes']:_0x2a09e8[_0x29f6('0x3c')];if(!_0x1b51cc['query'][_0x29f6('0x3f')]('nolimit')){_0x30d747[_0x29f6('0x24')]=qs[_0x29f6('0x24')](_0x1b51cc['query'][_0x29f6('0x24')]);_0x30d747[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x1b51cc[_0x29f6('0x3a')]['offset']);}_0x30d747[_0x29f6('0x40')]=qs[_0x29f6('0x41')](_0x1b51cc[_0x29f6('0x3a')]['sort']);_0x30d747[_0x29f6('0x42')]=qs['filters'](_[_0x29f6('0x43')](_0x1b51cc['query'],_0x2a09e8['filters']),_0x105557);if(_0x1b51cc['query'][_0x29f6('0x44')]){_0x30d747[_0x29f6('0x42')]=_[_0x29f6('0x45')](_0x30d747[_0x29f6('0x42')],{'$or':_[_0x29f6('0x36')](_0x105557,function(_0x270842){if(_0x270842[_0x29f6('0x46')]!==_0x29f6('0x47')){var _0x352119={};_0x352119[_0x270842[_0x29f6('0x30')]]={'$like':'%'+_0x1b51cc['query']['filter']+'%'};return _0x352119;}})});}_0x30d747=_[_0x29f6('0x45')]({},_0x30d747,_0x1b51cc[_0x29f6('0x48')]);var _0x7a65c0={'where':_0x30d747[_0x29f6('0x42')]};return db['Trunk'][_0x29f6('0x26')](_0x7a65c0)[_0x29f6('0x15')](function(_0x532df5){_0x14b392[_0x29f6('0x26')]=_0x532df5;if(_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x30d747[_0x29f6('0x4a')]=[{'all':!![]}];}return db[_0x29f6('0x4b')][_0x29f6('0x4c')](_0x30d747);})[_0x29f6('0x15')](function(_0x1f03b6){_0x14b392[_0x29f6('0x4d')]=_0x1f03b6;return _0x14b392;})[_0x29f6('0x15')](respondWithFilteredResult(_0x4f5fe1,_0x30d747))[_0x29f6('0x1f')](handleError(_0x4f5fe1,null));};exports[_0x29f6('0x4e')]=function(_0x58ea69,_0x416c24){var _0x463551={'raw':![],'where':{'id':_0x58ea69[_0x29f6('0x4f')]['id']}},_0x335ec1={};_0x335ec1[_0x29f6('0x3c')]=_['keys'](db[_0x29f6('0x4b')]['rawAttributes']);_0x335ec1['query']=_[_0x29f6('0x37')](_0x58ea69[_0x29f6('0x3a')]);_0x335ec1[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x335ec1[_0x29f6('0x3c')],_0x335ec1['query']);_0x463551[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x335ec1['model'],qs[_0x29f6('0x3d')](_0x58ea69['query'][_0x29f6('0x3d')]));_0x463551[_0x29f6('0x3b')]=_0x463551[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x463551['attributes']:_0x335ec1[_0x29f6('0x3c')];if(_0x58ea69[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x463551[_0x29f6('0x4a')]=[{'all':!![]}];}_0x463551=_[_0x29f6('0x45')]({},_0x463551,_0x58ea69[_0x29f6('0x48')]);return db[_0x29f6('0x4b')]['find'](_0x463551)[_0x29f6('0x15')](handleEntityNotFound(_0x416c24,null))[_0x29f6('0x15')](respondWithResult(_0x416c24,null))[_0x29f6('0x1f')](handleError(_0x416c24,null));};exports[_0x29f6('0x50')]=function(_0x36e52c,_0x1ac20d){var _0x37c3c1={'where':{'id':_0x36e52c[_0x29f6('0x4f')]['id']}},_0x2f356d={};_0x2f356d[_0x29f6('0x3c')]=_['keys'](db['Trunk'][_0x29f6('0x33')]);_0x37c3c1[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2f356d['model'],qs[_0x29f6('0x3d')](_0x36e52c['query']['fields']));_0x37c3c1[_0x29f6('0x3b')]=_0x37c3c1[_0x29f6('0x3b')]['length']?_0x37c3c1['attributes']:_0x2f356d[_0x29f6('0x3c')];if(_0x36e52c[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x37c3c1['include']=[{'all':!![]}];}_0x37c3c1=_[_0x29f6('0x45')]({},_0x37c3c1,_0x36e52c[_0x29f6('0x48')]);return db[_0x29f6('0x4b')][_0x29f6('0x51')](_0x37c3c1)[_0x29f6('0x15')](handleEntityNotFound(_0x1ac20d,null))[_0x29f6('0x15')](function(_0x7700da){if(_0x7700da){var _0x33b1d7=_0x7700da[_0x29f6('0x2c')]({'plain':!![]});_0x33b1d7=qs[_0x29f6('0x52')](_0x33b1d7,['id',_0x29f6('0x53'),_0x29f6('0x54')]);_0x36e52c[_0x29f6('0x55')]=_['omit'](_0x36e52c['body'],['id',_0x29f6('0x53'),'updatedAt']);return db[_0x29f6('0x4b')][_0x29f6('0x56')](_[_0x29f6('0x45')](_0x33b1d7,_0x36e52c[_0x29f6('0x55')]),{'include':_0x36e52c[_0x29f6('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x29f6('0x15')](function(_0x38d684){var _0x2f694e=_0x36e52c[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x2f694e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f694e[_0x29f6('0x58')]==='user'){var _0x51b9dc=_0x38d684[_0x29f6('0x2c')]({'plain':!![]});var _0x336b8e='Trunks';return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':_0x336b8e,'userProfileId':_0x2f694e['userProfileId']},'raw':!![]})[_0x29f6('0x15')](function(_0x2ba44c){if(_0x2ba44c&&_0x2ba44c[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')][_0x29f6('0x56')]({'name':_0x51b9dc[_0x29f6('0x30')],'resourceId':_0x51b9dc['id'],'type':_0x2ba44c[_0x29f6('0x30')],'sectionId':_0x2ba44c['id']},{})['then'](function(){return _0x38d684;});}else{return _0x38d684;}})[_0x29f6('0x1f')](function(_0x50ddd6){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ddd6);throw _0x50ddd6;});}return _0x38d684;});}})['then'](respondWithResult(_0x1ac20d,0xc9))[_0x29f6('0x1f')](handleError(_0x1ac20d,null));};exports[_0x29f6('0x56')]=function(_0x195887,_0x536b0c,_0x6ae738){var _0x373cf6;return db[_0x29f6('0x4b')]['create'](_0x195887[_0x29f6('0x55')],{'raw':!![]})[_0x29f6('0x15')](function(_0x66a7bb){_0x373cf6=_0x66a7bb;return db[_0x29f6('0x4b')][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x6587f3){var _0x41c1b9=fs['readFileSync'](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x1636f1=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],'server/files/templates/registry.ejs'),_0x29f6('0x5e'));var _0x1ca187=ejs['render'](_0x41c1b9,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ca187);if(_0x373cf6[_0x29f6('0x61')]){var _0x5a383f=ejs['render'](_0x1636f1,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x5a383f);}})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x29f6('0x63')});})[_0x29f6('0x15')](function(){var _0x144c76=_0x195887[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x144c76)throw new Error(_0x29f6('0x64'));if(_0x144c76[_0x29f6('0x58')]==='user'){var _0x11ef85=_0x373cf6[_0x29f6('0x2c')]({'plain':!![]});return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':'Trunks','userProfileId':_0x144c76[_0x29f6('0x65')]},'raw':!![]})[_0x29f6('0x15')](function(_0x32a862){if(_0x32a862&&_0x32a862[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')]['create']({'name':_0x11ef85[_0x29f6('0x30')],'resourceId':_0x11ef85['id'],'type':_0x32a862[_0x29f6('0x30')],'sectionId':_0x32a862['id']},{})[_0x29f6('0x15')](function(){return _0x373cf6;});}else{return _0x373cf6;}})[_0x29f6('0x1f')](function(_0x4273a3){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4273a3);throw _0x4273a3;});}return _0x373cf6;})[_0x29f6('0x15')](respondWithResult(_0x536b0c,0xc9))['catch'](handleError(_0x536b0c,null));};exports['update']=function(_0x4f9907,_0x842ae3,_0x5bcf90){var _0x425da2;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x4f9907[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x842ae3,null))[_0x29f6('0x15')](saveUpdates(_0x4f9907[_0x29f6('0x55')],null))['then'](function(_0x3a23f3){if(_0x3a23f3){_0x425da2=_0x3a23f3;return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});}})[_0x29f6('0x15')](function(_0x32fa77){if(_0x32fa77){var _0x1d6e32=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0xe14459=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0xa31c7d=ejs[_0x29f6('0x66')](_0x1d6e32,{'trunks':_0x32fa77||[]});fs['writeFileSync'](_0x29f6('0x67'),_0xa31c7d);var _0x57b9fb=ejs[_0x29f6('0x66')](_0xe14459,{'trunks':_0x32fa77||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x57b9fb);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2a'),{'module':_0x29f6('0x63')});}return null;})[_0x29f6('0x15')](function(_0x4203f1){if(_0x4203f1){return _0x425da2;}})[_0x29f6('0x15')](respondWithResult(_0x842ae3,null))[_0x29f6('0x1f')](handleError(_0x842ae3,null));};exports['destroy']=function(_0x1d61ff,_0x4c0acc,_0x16bb3c){var _0x144d8c;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x1d61ff[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x4c0acc,null))[_0x29f6('0x15')](removeEntity(_0x4c0acc,null))[_0x29f6('0x15')](function(){return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x4e185f){var _0x4bb53f=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x906098=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x69')),_0x29f6('0x5e'));var _0x3f51fa=ejs['render'](_0x4bb53f,{'trunks':_0x4e185f});var _0x4b9631=ejs[_0x29f6('0x66')](_0x906098,{'trunks':_0x4e185f});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3f51fa);fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x4b9631);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2b'),{'module':_0x29f6('0x63')});})[_0x29f6('0x1f')](handleError(_0x4c0acc,null));}; \ No newline at end of file +var _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x310152,_0x5d25e1){var _0x2bc39e=function(_0x430a8f){while(--_0x430a8f){_0x310152['push'](_0x310152['shift']());}};_0x2bc39e(++_0x5d25e1);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4be8ba,_0x5d10ba){_0x4be8ba=_0x4be8ba-0x0;var _0x1af822=_0x24ca[_0x4be8ba];return _0x1af822;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 61cc366..972df27 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 _0x5819=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./trunk.attributes','define','Trunk','lodash'];(function(_0x44ac7d,_0x20e364){var _0x33cd07=function(_0x94832){while(--_0x94832){_0x44ac7d['push'](_0x44ac7d['shift']());}};_0x33cd07(++_0x20e364);}(_0x5819,0x1f3));var _0x9581=function(_0x10b545,_0x2da4ef){_0x10b545=_0x10b545-0x0;var _0x15c086=_0x5819[_0x10b545];return _0x15c086;};'use strict';var _=require(_0x9581('0x0'));var util=require('util');var logger=require(_0x9581('0x1'))(_0x9581('0x2'));var moment=require(_0x9581('0x3'));var BPromise=require(_0x9581('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9581('0x5'));var config=require(_0x9581('0x6'));var attributes=require(_0x9581('0x7'));module['exports']=function(_0x4d2574,_0x1c917d){return _0x4d2574[_0x9581('0x8')](_0x9581('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf77=['lodash','util','../../config/logger','moment','bluebird','../../config/environment','./trunk.attributes','exports','define','tools_trunks'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xdf77,0xd2));var _0x7df7=function(_0x2dd520,_0x243568){_0x2dd520=_0x2dd520-0x0;var _0x36ff68=_0xdf77[_0x2dd520];return _0x36ff68;};'use strict';var _=require(_0x7df7('0x0'));var util=require(_0x7df7('0x1'));var logger=require(_0x7df7('0x2'))('api');var moment=require(_0x7df7('0x3'));var BPromise=require(_0x7df7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7df7('0x5'));var attributes=require(_0x7df7('0x6'));module[_0x7df7('0x7')]=function(_0x3590d8,_0x2c85f6){return _0x3590d8[_0x7df7('0x8')]('Trunk',attributes,{'tableName':_0x7df7('0x9'),'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 b1783f5..a6905ed 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 _0xb19a=['options','raw','where','include','map','model','attributes','catch','ShowTrunk','find','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','GetTrunk','Trunk','findAll'];(function(_0x3aff91,_0x213e37){var _0x11394d=function(_0xc19b7d){while(--_0xc19b7d){_0x3aff91['push'](_0x3aff91['shift']());}};_0x11394d(++_0x213e37);}(_0xb19a,0x122));var _0xab19=function(_0x424285,_0xbfdc02){_0x424285=_0x424285-0x0;var _0x48208b=_0xb19a[_0x424285];return _0x48208b;};'use strict';var _=require(_0xab19('0x0'));var util=require(_0xab19('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xab19('0x2'));var fs=require('fs');var Redis=require(_0xab19('0x3'));var db=require(_0xab19('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xab19('0x5'));var config=require(_0xab19('0x6'));var jayson=require(_0xab19('0x7'));var client=jayson[_0xab19('0x8')][_0xab19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54e384,_0x413fa3,_0x1998c7){return new BPromise(function(_0x2bc1b9,_0x136eb4){return client[_0xab19('0xa')](_0x54e384,_0x1998c7)[_0xab19('0xb')](function(_0x4cbf55){logger[_0xab19('0xc')]('Trunk,\x20%s,\x20%s',_0x413fa3,'request\x20sent');logger[_0xab19('0xd')](_0xab19('0xe'),_0x413fa3,_0xab19('0xf'),JSON[_0xab19('0x10')](_0x4cbf55));if(_0x4cbf55[_0xab19('0x11')]){if(_0x4cbf55[_0xab19('0x11')][_0xab19('0x12')]===0x1f4){logger['error'](_0xab19('0x13'),_0x413fa3,_0x4cbf55[_0xab19('0x11')][_0xab19('0x14')]);return _0x136eb4(_0x4cbf55[_0xab19('0x11')][_0xab19('0x14')]);}logger[_0xab19('0x11')](_0xab19('0x13'),_0x413fa3,_0x4cbf55[_0xab19('0x11')][_0xab19('0x14')]);return _0x2bc1b9(_0x4cbf55[_0xab19('0x11')][_0xab19('0x14')]);}else{logger['info'](_0xab19('0x13'),_0x413fa3,'request\x20sent');_0x2bc1b9(_0x4cbf55[_0xab19('0x15')][_0xab19('0x14')]);}})['catch'](function(_0xf7f2e2){logger[_0xab19('0x11')](_0xab19('0x13'),_0x413fa3,_0xf7f2e2);_0x136eb4(_0xf7f2e2);});});}exports[_0xab19('0x16')]=function(_0x3e2d58){var _0x2e6843=this;return new Promise(function(_0x1dc33e,_0x4acbec){return db[_0xab19('0x17')][_0xab19('0x18')]({'raw':_0x3e2d58['options']?_0x3e2d58[_0xab19('0x19')][_0xab19('0x1a')]===undefined?!![]:![]:!![],'where':_0x3e2d58['options']?_0x3e2d58[_0xab19('0x19')][_0xab19('0x1b')]||null:null,'attributes':_0x3e2d58[_0xab19('0x19')]?_0x3e2d58[_0xab19('0x19')]['attributes']||null:null,'limit':_0x3e2d58[_0xab19('0x19')]?_0x3e2d58[_0xab19('0x19')]['limit']||null:null,'include':_0x3e2d58[_0xab19('0x19')]?_0x3e2d58[_0xab19('0x19')][_0xab19('0x1c')]?_[_0xab19('0x1d')](_0x3e2d58[_0xab19('0x19')][_0xab19('0x1c')],function(_0x5c8807){return{'model':db[_0x5c8807[_0xab19('0x1e')]],'as':_0x5c8807['as'],'attributes':_0x5c8807[_0xab19('0x1f')],'include':_0x5c8807[_0xab19('0x1c')]?_[_0xab19('0x1d')](_0x5c8807['include'],function(_0xd291a0){return{'model':db[_0xd291a0[_0xab19('0x1e')]],'as':_0xd291a0['as'],'attributes':_0xd291a0[_0xab19('0x1f')],'include':_0xd291a0[_0xab19('0x1c')]?_['map'](_0xd291a0[_0xab19('0x1c')],function(_0x17431a){return{'model':db[_0x17431a[_0xab19('0x1e')]],'as':_0x17431a['as'],'attributes':_0x17431a[_0xab19('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xab19('0xb')](function(_0x57616e){logger[_0xab19('0xc')](_0xab19('0x16'),_0x3e2d58);logger[_0xab19('0xd')](_0xab19('0x16'),_0x3e2d58,JSON[_0xab19('0x10')](_0x57616e));_0x1dc33e(_0x57616e);})[_0xab19('0x20')](function(_0x5aa7dc){logger[_0xab19('0x11')](_0xab19('0x16'),_0x5aa7dc[_0xab19('0x14')],_0x3e2d58);_0x4acbec(_0x2e6843[_0xab19('0x11')](0x1f4,_0x5aa7dc['message']));});});};exports[_0xab19('0x21')]=function(_0x68ac41){var _0x4b6edf=this;return new Promise(function(_0x1383a9,_0x43c1da){return db[_0xab19('0x17')][_0xab19('0x22')]({'raw':_0x68ac41[_0xab19('0x19')]?_0x68ac41[_0xab19('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x68ac41[_0xab19('0x19')]?_0x68ac41[_0xab19('0x19')][_0xab19('0x1b')]||null:null,'attributes':_0x68ac41['options']?_0x68ac41[_0xab19('0x19')][_0xab19('0x1f')]||null:null,'include':_0x68ac41[_0xab19('0x19')]?_0x68ac41[_0xab19('0x19')][_0xab19('0x1c')]?_[_0xab19('0x1d')](_0x68ac41[_0xab19('0x19')][_0xab19('0x1c')],function(_0x200e91){return{'model':db[_0x200e91[_0xab19('0x1e')]],'as':_0x200e91['as'],'attributes':_0x200e91[_0xab19('0x1f')],'include':_0x200e91[_0xab19('0x1c')]?_[_0xab19('0x1d')](_0x200e91[_0xab19('0x1c')],function(_0x4a0f7f){return{'model':db[_0x4a0f7f['model']],'as':_0x4a0f7f['as'],'attributes':_0x4a0f7f[_0xab19('0x1f')],'include':_0x4a0f7f['include']?_['map'](_0x4a0f7f[_0xab19('0x1c')],function(_0x5918ae){return{'model':db[_0x5918ae['model']],'as':_0x5918ae['as'],'attributes':_0x5918ae['attributes']};}):[]};}):[]};}):[]:[]})[_0xab19('0xb')](function(_0x2036ad){logger[_0xab19('0xc')](_0xab19('0x21'),_0x68ac41);logger[_0xab19('0xd')]('ShowTrunk',_0x68ac41,JSON['stringify'](_0x2036ad));_0x1383a9(_0x2036ad);})[_0xab19('0x20')](function(_0x3fe1bd){logger['error'](_0xab19('0x21'),_0x3fe1bd[_0xab19('0x14')],_0x68ac41);_0x43c1da(_0x4b6edf[_0xab19('0x11')](0x1f4,_0x3fe1bd[_0xab19('0x14')]));});});}; \ No newline at end of file +var _0xbe0d=['rpc','../../config/environment','jayson/promise','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetTrunk','Trunk','options','attributes','limit','include','map','model','debug','ShowTrunk','find','raw','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x46c00f,_0xe4335f){var _0x14a172=function(_0x54e92b){while(--_0x54e92b){_0x46c00f['push'](_0x46c00f['shift']());}};_0x14a172(++_0xe4335f);}(_0xbe0d,0x88));var _0xdbe0=function(_0x3feef9,_0x1df14e){_0x3feef9=_0x3feef9-0x0;var _0x3b7fee=_0xbe0d[_0x3feef9];return _0x3b7fee;};'use strict';var _=require(_0xdbe0('0x0'));var util=require('util');var moment=require(_0xdbe0('0x1'));var BPromise=require(_0xdbe0('0x2'));var rs=require(_0xdbe0('0x3'));var fs=require('fs');var Redis=require(_0xdbe0('0x4'));var db=require(_0xdbe0('0x5'))['db'];var utils=require(_0xdbe0('0x6'));var logger=require(_0xdbe0('0x7'))(_0xdbe0('0x8'));var config=require(_0xdbe0('0x9'));var jayson=require(_0xdbe0('0xa'));var client=jayson[_0xdbe0('0xb')][_0xdbe0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51346f,_0x21e39e,_0x536c85){return new BPromise(function(_0x12e73e,_0x3ecbc8){return client['request'](_0x51346f,_0x536c85)[_0xdbe0('0xd')](function(_0x15b748){logger['info'](_0xdbe0('0xe'),_0x21e39e,'request\x20sent');logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x21e39e,_0xdbe0('0xf'),JSON[_0xdbe0('0x10')](_0x15b748));if(_0x15b748['error']){if(_0x15b748[_0xdbe0('0x11')][_0xdbe0('0x12')]===0x1f4){logger['error'](_0xdbe0('0xe'),_0x21e39e,_0x15b748['error'][_0xdbe0('0x13')]);return _0x3ecbc8(_0x15b748['error'][_0xdbe0('0x13')]);}logger[_0xdbe0('0x11')](_0xdbe0('0xe'),_0x21e39e,_0x15b748[_0xdbe0('0x11')][_0xdbe0('0x13')]);return _0x12e73e(_0x15b748['error'][_0xdbe0('0x13')]);}else{logger[_0xdbe0('0x14')](_0xdbe0('0xe'),_0x21e39e,_0xdbe0('0xf'));_0x12e73e(_0x15b748[_0xdbe0('0x15')][_0xdbe0('0x13')]);}})[_0xdbe0('0x16')](function(_0xf3284d){logger[_0xdbe0('0x11')](_0xdbe0('0xe'),_0x21e39e,_0xf3284d);_0x3ecbc8(_0xf3284d);});});}exports[_0xdbe0('0x17')]=function(_0x27c97d){var _0x8311dd=this;return new Promise(function(_0x238549,_0x58c3ed){return db[_0xdbe0('0x18')]['findAll']({'raw':_0x27c97d['options']?_0x27c97d[_0xdbe0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x27c97d[_0xdbe0('0x19')]?_0x27c97d[_0xdbe0('0x19')]['where']||null:null,'attributes':_0x27c97d['options']?_0x27c97d['options'][_0xdbe0('0x1a')]||null:null,'limit':_0x27c97d['options']?_0x27c97d[_0xdbe0('0x19')][_0xdbe0('0x1b')]||null:null,'include':_0x27c97d[_0xdbe0('0x19')]?_0x27c97d[_0xdbe0('0x19')][_0xdbe0('0x1c')]?_[_0xdbe0('0x1d')](_0x27c97d[_0xdbe0('0x19')]['include'],function(_0x6ee277){return{'model':db[_0x6ee277['model']],'as':_0x6ee277['as'],'attributes':_0x6ee277[_0xdbe0('0x1a')],'include':_0x6ee277[_0xdbe0('0x1c')]?_[_0xdbe0('0x1d')](_0x6ee277[_0xdbe0('0x1c')],function(_0x52b88b){return{'model':db[_0x52b88b['model']],'as':_0x52b88b['as'],'attributes':_0x52b88b[_0xdbe0('0x1a')],'include':_0x52b88b[_0xdbe0('0x1c')]?_['map'](_0x52b88b[_0xdbe0('0x1c')],function(_0x173eed){return{'model':db[_0x173eed[_0xdbe0('0x1e')]],'as':_0x173eed['as'],'attributes':_0x173eed[_0xdbe0('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f5d9e){logger[_0xdbe0('0x14')](_0xdbe0('0x17'),_0x27c97d);logger[_0xdbe0('0x1f')](_0xdbe0('0x17'),_0x27c97d,JSON[_0xdbe0('0x10')](_0x1f5d9e));_0x238549(_0x1f5d9e);})[_0xdbe0('0x16')](function(_0xdbc1b9){logger[_0xdbe0('0x11')](_0xdbe0('0x17'),_0xdbc1b9[_0xdbe0('0x13')],_0x27c97d);_0x58c3ed(_0x8311dd['error'](0x1f4,_0xdbc1b9[_0xdbe0('0x13')]));});});};exports[_0xdbe0('0x20')]=function(_0x29cc5d){var _0x32ce71=this;return new Promise(function(_0x27eb6c,_0x1dcf7c){return db[_0xdbe0('0x18')][_0xdbe0('0x21')]({'raw':_0x29cc5d['options']?_0x29cc5d[_0xdbe0('0x19')][_0xdbe0('0x22')]===undefined?!![]:![]:!![],'where':_0x29cc5d[_0xdbe0('0x19')]?_0x29cc5d[_0xdbe0('0x19')][_0xdbe0('0x23')]||null:null,'attributes':_0x29cc5d[_0xdbe0('0x19')]?_0x29cc5d['options']['attributes']||null:null,'include':_0x29cc5d[_0xdbe0('0x19')]?_0x29cc5d['options'][_0xdbe0('0x1c')]?_['map'](_0x29cc5d[_0xdbe0('0x19')][_0xdbe0('0x1c')],function(_0x1a87c9){return{'model':db[_0x1a87c9['model']],'as':_0x1a87c9['as'],'attributes':_0x1a87c9[_0xdbe0('0x1a')],'include':_0x1a87c9[_0xdbe0('0x1c')]?_[_0xdbe0('0x1d')](_0x1a87c9[_0xdbe0('0x1c')],function(_0x5699f6){return{'model':db[_0x5699f6['model']],'as':_0x5699f6['as'],'attributes':_0x5699f6[_0xdbe0('0x1a')],'include':_0x5699f6[_0xdbe0('0x1c')]?_[_0xdbe0('0x1d')](_0x5699f6[_0xdbe0('0x1c')],function(_0x4c996a){return{'model':db[_0x4c996a[_0xdbe0('0x1e')]],'as':_0x4c996a['as'],'attributes':_0x4c996a[_0xdbe0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdbe0('0xd')](function(_0x2a97ed){logger[_0xdbe0('0x14')](_0xdbe0('0x20'),_0x29cc5d);logger[_0xdbe0('0x1f')](_0xdbe0('0x20'),_0x29cc5d,JSON[_0xdbe0('0x10')](_0x2a97ed));_0x27eb6c(_0x2a97ed);})['catch'](function(_0x42dccc){logger[_0xdbe0('0x11')](_0xdbe0('0x20'),_0x42dccc['message'],_0x29cc5d);_0x1dcf7c(_0x32ce71['error'](0x1f4,_0x42dccc[_0xdbe0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 6314175..bd878e3 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 _0x9816=['/:id','update','express','Router','../../components/auth/service'];(function(_0x1e5c1e,_0x59bf9f){var _0xa7b143=function(_0x4e97de){while(--_0x4e97de){_0x1e5c1e['push'](_0x1e5c1e['shift']());}};_0xa7b143(++_0x59bf9f);}(_0x9816,0x1e7));var _0x6981=function(_0x36684b,_0x58b2f8){_0x36684b=_0x36684b-0x0;var _0x5e3604=_0x9816[_0x36684b];return _0x5e3604;};'use strict';var express=require(_0x6981('0x0'));var router=express[_0x6981('0x1')]();var auth=require(_0x6981('0x2'));var controller=require('./user-setting.controller');router['put'](_0x6981('0x3'),auth['isAuthenticated'](),controller[_0x6981('0x4')]);module['exports']=router; \ No newline at end of file +var _0x2865=['./user-setting.controller','put','isAuthenticated','update','exports','express','Router'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0x2865,0x75));var _0x5286=function(_0x566b08,_0x17a853){_0x566b08=_0x566b08-0x0;var _0x503af5=_0x2865[_0x566b08];return _0x503af5;};'use strict';var express=require(_0x5286('0x0'));var router=express[_0x5286('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5286('0x2'));router[_0x5286('0x3')]('/:id',auth[_0x5286('0x4')](),controller[_0x5286('0x5')]);module[_0x5286('0x6')]=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 95fa9fc..aa3ba4c 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 _0x972a=['warning','info','debug','exports','INTEGER','sequelize','error'];(function(_0x2932d6,_0x29c947){var _0x28e938=function(_0x11175f){while(--_0x11175f){_0x2932d6['push'](_0x2932d6['shift']());}};_0x28e938(++_0x29c947);}(_0x972a,0xfa));var _0xa972=function(_0x528fa3,_0x3c8282){_0x528fa3=_0x528fa3-0x0;var _0x5a3760=_0x972a[_0x528fa3];return _0x5a3760;};'use strict';var Sequelize=require(_0xa972('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xa972('0x1'),_0xa972('0x2'),_0xa972('0x3'),_0xa972('0x4')];module[_0xa972('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xa972('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xa972('0x6')],'unique':'UserId'}}; \ No newline at end of file +var _0x3525=['exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error','info','debug'];(function(_0x34f8ca,_0x14290b){var _0x306fe5=function(_0x5734fd){while(--_0x5734fd){_0x34f8ca['push'](_0x34f8ca['shift']());}};_0x306fe5(++_0x14290b);}(_0x3525,0x1bf));var _0x5352=function(_0x2ee772,_0x4619a3){_0x2ee772=_0x2ee772-0x0;var _0x52af49=_0x3525[_0x2ee772];return _0x52af49;};'use strict';var Sequelize=require(_0x5352('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x5352('0x1'),'warning',_0x5352('0x2'),_0x5352('0x3')];module[_0x5352('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x5352('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x5352('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x5352('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x5352('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x5352('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x5352('0x9')],'unique':_0x5352('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 a4f5db1..d6746ff 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 _0xcdd0=['name','role','Invalid\x20user\x20setting\x20id','find','params','body','catch','lodash','ioredis','../../config/logger','api','../../mysqldb','./user-setting.socket','redis','defaults','status','json','update','then','sendStatus','stack'];(function(_0x2f7b44,_0xd3de0a){var _0x2da9a=function(_0x1390e1){while(--_0x1390e1){_0x2f7b44['push'](_0x2f7b44['shift']());}};_0x2da9a(++_0xd3de0a);}(_0xcdd0,0xd9));var _0x0cdd=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xcdd0[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x0cdd('0x0'));var Redis=require(_0x0cdd('0x1'));var logger=require(_0x0cdd('0x2'))(_0x0cdd('0x3'));var config=require('../../config/environment');var db=require(_0x0cdd('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0cdd('0x5'))['register'](socket);config[_0x0cdd('0x6')]=_[_0x0cdd('0x7')](config[_0x0cdd('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x27126f,_0x1615ae){_0x1615ae=_0x1615ae||0xc8;return function(_0xd69bd8){if(_0xd69bd8){return _0x27126f[_0x0cdd('0x8')](_0x1615ae)[_0x0cdd('0x9')](_0xd69bd8);}};}function saveUpdates(_0x41a9e9){return function(_0x2f7bed){if(_0x2f7bed){return _0x2f7bed[_0x0cdd('0xa')](_0x41a9e9)[_0x0cdd('0xb')](function(_0x25f1fb){return _0x25f1fb;});}return null;};}function handleEntityNotFound(_0x2e2187){return function(_0x246486){if(!_0x246486){_0x2e2187[_0x0cdd('0xc')](0x194);}return _0x246486;};}function handleError(_0x494cd3,_0x2a2304){_0x2a2304=_0x2a2304||0x1f4;return function(_0x359813){logger['error'](_0x359813[_0x0cdd('0xd')]);if(_0x359813[_0x0cdd('0xe')]){delete _0x359813['name'];}_0x494cd3[_0x0cdd('0x8')](_0x2a2304)['send'](_0x359813);};}exports[_0x0cdd('0xa')]=function(_0x233ac7,_0x55f692){if(_0x233ac7['user'][_0x0cdd('0xf')]!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x233ac7['params']['id'])))throw new Error(_0x0cdd('0x10'));return db['UserSetting'][_0x0cdd('0x11')]({'where':{'id':_0x233ac7[_0x0cdd('0x12')]['id']}})[_0x0cdd('0xb')](handleEntityNotFound(_0x55f692,null))['then'](saveUpdates(_0x233ac7[_0x0cdd('0x13')],null))['then'](respondWithResult(_0x55f692,null))[_0x0cdd('0x14')](handleError(_0x55f692,null));}; \ No newline at end of file +var _0xea1a=['./user-setting.socket','register','defaults','json','then','sendStatus','error','name','status','send','update','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','api','../../mysqldb','socket.io-emitter','redis'];(function(_0x2a4cc6,_0x3ed438){var _0x381547=function(_0x44daba){while(--_0x44daba){_0x2a4cc6['push'](_0x2a4cc6['shift']());}};_0x381547(++_0x3ed438);}(_0xea1a,0x158));var _0xaea1=function(_0x48dce4,_0xef3da1){_0x48dce4=_0x48dce4-0x0;var _0x286cbd=_0xea1a[_0x48dce4];return _0x286cbd;};'use strict';var _=require(_0xaea1('0x0'));var Redis=require(_0xaea1('0x1'));var logger=require(_0xaea1('0x2'))(_0xaea1('0x3'));var config=require('../../config/environment');var db=require(_0xaea1('0x4'))['db'];var socket=require(_0xaea1('0x5'))(new Redis(config[_0xaea1('0x6')]));require(_0xaea1('0x7'))[_0xaea1('0x8')](socket);config[_0xaea1('0x6')]=_[_0xaea1('0x9')](config[_0xaea1('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x884233,_0x8883ab){_0x8883ab=_0x8883ab||0xc8;return function(_0x3359a9){if(_0x3359a9){return _0x884233['status'](_0x8883ab)[_0xaea1('0xa')](_0x3359a9);}};}function saveUpdates(_0x553b92){return function(_0x39d980){if(_0x39d980){return _0x39d980['update'](_0x553b92)[_0xaea1('0xb')](function(_0x4de4c1){return _0x4de4c1;});}return null;};}function handleEntityNotFound(_0x5663f9){return function(_0x541e58){if(!_0x541e58){_0x5663f9[_0xaea1('0xc')](0x194);}return _0x541e58;};}function handleError(_0x4eb13f,_0x577709){_0x577709=_0x577709||0x1f4;return function(_0x18a725){logger[_0xaea1('0xd')](_0x18a725['stack']);if(_0x18a725[_0xaea1('0xe')]){delete _0x18a725[_0xaea1('0xe')];}_0x4eb13f[_0xaea1('0xf')](_0x577709)[_0xaea1('0x10')](_0x18a725);};}exports[_0xaea1('0x11')]=function(_0x7ad061,_0x376cc9){if(_0x7ad061['user'][_0xaea1('0x12')]!==_0xaea1('0x13'))throw new Error(_0xaea1('0x14'));if(isNaN(Number(_0x7ad061[_0xaea1('0x15')]['id'])))throw new Error(_0xaea1('0x16'));return db[_0xaea1('0x17')][_0xaea1('0x18')]({'where':{'id':_0x7ad061[_0xaea1('0x15')]['id']}})[_0xaea1('0xb')](handleEntityNotFound(_0x376cc9,null))[_0xaea1('0xb')](saveUpdates(_0x7ad061[_0xaea1('0x19')],null))[_0xaea1('0xb')](respondWithResult(_0x376cc9,null))[_0xaea1('0x1a')](handleError(_0x376cc9,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 993fc09..757c279 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 _0xca2a=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserSetting','setMaxListeners','save'];(function(_0xfc5de,_0x210af9){var _0x25ece8=function(_0x584144){while(--_0x584144){_0xfc5de['push'](_0xfc5de['shift']());}};_0x25ece8(++_0x210af9);}(_0xca2a,0xc2));var _0xaca2=function(_0x2beff0,_0x70b6a9){_0x2beff0=_0x2beff0-0x0;var _0x5c22f0=_0xca2a[_0x2beff0];return _0x5c22f0;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xaca2('0x0'))['db'][_0xaca2('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xaca2('0x2')](0x0);var events={'afterCreate':_0xaca2('0x3'),'afterUpdate':'update','afterDestroy':_0xaca2('0x4')};function emitEvent(_0x53071f){return function(_0x10ecdb,_0x1737f7,_0x21765a){UserSettingEvents[_0xaca2('0x5')](_0x53071f+':'+_0x10ecdb['id'],_0x10ecdb);UserSettingEvents['emit'](_0x53071f,_0x10ecdb);_0x21765a(null);};}for(var e in events){if(events[_0xaca2('0x6')](e)){var event=events[e];UserSetting[_0xaca2('0x7')](e,emitEvent(event));}}module[_0xaca2('0x8')]=UserSettingEvents; \ No newline at end of file +var _0xf02b=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','UserSetting','setMaxListeners'];(function(_0x30ce32,_0x45c445){var _0xf3cfdf=function(_0xe30aeb){while(--_0xe30aeb){_0x30ce32['push'](_0x30ce32['shift']());}};_0xf3cfdf(++_0x45c445);}(_0xf02b,0x177));var _0xbf02=function(_0x4b55e8,_0x41ba7e){_0x4b55e8=_0x4b55e8-0x0;var _0x46e844=_0xf02b[_0x4b55e8];return _0x46e844;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xbf02('0x0'))['db'][_0xbf02('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xbf02('0x2')](0x0);var events={'afterCreate':_0xbf02('0x3'),'afterUpdate':_0xbf02('0x4'),'afterDestroy':_0xbf02('0x5')};function emitEvent(_0x33c62d){return function(_0x41278b,_0x4b6f44,_0x42b5c8){UserSettingEvents[_0xbf02('0x6')](_0x33c62d+':'+_0x41278b['id'],_0x41278b);UserSettingEvents[_0xbf02('0x6')](_0x33c62d,_0x41278b);_0x42b5c8(null);};}for(var e in events){if(events[_0xbf02('0x7')](e)){var event=events[e];UserSetting[_0xbf02('0x8')](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 9e420b9..53bcc9a 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 _0x4af8=['clientSideLoggingEnabledSince','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x5b1506,_0x14bf4f){var _0x28f251=function(_0x41edca){while(--_0x41edca){_0x5b1506['push'](_0x5b1506['shift']());}};_0x28f251(++_0x14bf4f);}(_0x4af8,0x1ad));var _0x84af=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x4af8[_0x550d12];return _0x12103d;};'use strict';var attributes=require('./user-setting.attributes');module['exports']=function(_0x5792b9){return _0x5792b9['define'](_0x84af('0x0'),attributes,{'tableName':_0x84af('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1b876a){if(!_0x1b876a[_0x84af('0x2')])_0x1b876a['clientSideLoggingEnabledSince']=null;else if(_0x1b876a[_0x84af('0x3')]===null)_0x1b876a[_0x84af('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x97c1=['define','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x3a4216,_0x3455ae){var _0x6a13d2=function(_0x181ed2){while(--_0x181ed2){_0x3a4216['push'](_0x3a4216['shift']());}};_0x6a13d2(++_0x3455ae);}(_0x97c1,0xdf));var _0x197c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x97c1[_0x122ef9];return _0x42fba0;};'use strict';var attributes=require(_0x197c('0x0'));module[_0x197c('0x1')]=function(_0x55b95a){return _0x55b95a[_0x197c('0x2')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x788d63){if(!_0x788d63[_0x197c('0x3')])_0x788d63[_0x197c('0x4')]=null;else if(_0x788d63[_0x197c('0x4')]===null)_0x788d63[_0x197c('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 637a345..804fa46 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 _0x2a4e=['remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events'];(function(_0x54a878,_0x36cb69){var _0x490a33=function(_0x4571a5){while(--_0x4571a5){_0x54a878['push'](_0x54a878['shift']());}};_0x490a33(++_0x36cb69);}(_0x2a4e,0x1df));var _0xe2a4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2a4e[_0x321bb2];return _0x9c12ed;};'use strict';var UserSettingEvents=require(_0xe2a4('0x0'));var events=['save',_0xe2a4('0x1'),_0xe2a4('0x2')];function createListener(_0x1d0e22,_0x2c3239){return function(_0x45b508){_0x2c3239[_0xe2a4('0x3')](_0x1d0e22,_0x45b508);if(_0x1d0e22===_0xe2a4('0x4')){_0x2c3239[_0xe2a4('0x3')](_0xe2a4('0x5')+_0x45b508[_0xe2a4('0x6')],_0x45b508);}};}exports[_0xe2a4('0x7')]=function(_0x345e44){for(var _0x2f43de=0x0,_0x4705b0=events[_0xe2a4('0x8')];_0x2f43de<_0x4705b0;_0x2f43de++){var _0x10773f=events[_0x2f43de];var _0x306f07=createListener(_0xe2a4('0x9')+_0x10773f,_0x345e44);UserSettingEvents['on'](_0x10773f,_0x306f07);}}; \ No newline at end of file +var _0xe240=['update','emit','user-setting:update','user-setting:update:user-','UserId','register','length','./user-setting.events','save'];(function(_0x4939cf,_0x100791){var _0xd70cae=function(_0x3c5d85){while(--_0x3c5d85){_0x4939cf['push'](_0x4939cf['shift']());}};_0xd70cae(++_0x100791);}(_0xe240,0x16f));var _0x0e24=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xe240[_0x32f7d7];return _0x133d09;};'use strict';var UserSettingEvents=require(_0x0e24('0x0'));var events=[_0x0e24('0x1'),'remove',_0x0e24('0x2')];function createListener(_0x58cae3,_0x536558){return function(_0x70b5bd){_0x536558[_0x0e24('0x3')](_0x58cae3,_0x70b5bd);if(_0x58cae3===_0x0e24('0x4')){_0x536558[_0x0e24('0x3')](_0x0e24('0x5')+_0x70b5bd[_0x0e24('0x6')],_0x70b5bd);}};}exports[_0x0e24('0x7')]=function(_0xded089){for(var _0x2d0546=0x0,_0x44c41e=events[_0x0e24('0x8')];_0x2d0546<_0x44c41e;_0x2d0546++){var _0x33f101=events[_0x2d0546];var _0x4743bc=createListener('user-setting:'+_0x33f101,_0xded089);UserSettingEvents['on'](_0x33f101,_0x4743bc);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index d96a56a..c27bfd9 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 _0x87bc=['/:id/lists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','/create_many','bulkCreate','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','put','/:id','update','/:id/password','removeQueues','delete','destroy','/:id/chat_interactions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/whoami','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams'];(function(_0x3faaf8,_0x16d9ae){var _0x1a3527=function(_0x450a8f){while(--_0x450a8f){_0x3faaf8['push'](_0x3faaf8['shift']());}};_0x1a3527(++_0x16d9ae);}(_0x87bc,0x189));var _0xc87b=function(_0xd9e234,_0x5c9ba9){_0xd9e234=_0xd9e234-0x0;var _0x360929=_0x87bc[_0xd9e234];return _0x360929;};'use strict';var multer=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var path=require('path');var timeout=require(_0xc87b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc87b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc87b('0x4'));var config=require('../../config/environment');var controller=require('./user.controller');router['get']('/',auth[_0xc87b('0x5')](),controller[_0xc87b('0x6')]);router[_0xc87b('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc87b('0x7')](_0xc87b('0x8'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x9')]);router[_0xc87b('0x7')](_0xc87b('0xa'),auth[_0xc87b('0x5')](),controller[_0xc87b('0xb')]);router[_0xc87b('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xc87b('0xc')]);router['get'](_0xc87b('0xd'),controller[_0xc87b('0xe')]);router[_0xc87b('0x7')](_0xc87b('0xf'),auth['isAuthenticated'](),controller[_0xc87b('0x10')]);router['get'](_0xc87b('0x11'),auth[_0xc87b('0x5')](),controller['getContacts']);router[_0xc87b('0x7')](_0xc87b('0x12'),auth['isAuthenticated'](),controller[_0xc87b('0x13')]);router[_0xc87b('0x7')](_0xc87b('0x14'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x15')]);router[_0xc87b('0x7')](_0xc87b('0x16'),auth[_0xc87b('0x5')](),controller['getGroups']);router[_0xc87b('0x7')]('/:id/recordings',auth[_0xc87b('0x5')](),controller[_0xc87b('0x17')]);router['get'](_0xc87b('0x18'),auth[_0xc87b('0x5')](),controller['getScreenRecordings']);router[_0xc87b('0x7')]('/:id/chat/interactions',auth[_0xc87b('0x5')](),controller[_0xc87b('0x19')]);router[_0xc87b('0x7')](_0xc87b('0x1a'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x1b')]);router[_0xc87b('0x7')](_0xc87b('0x1c'),auth[_0xc87b('0x5')](),controller['getMailInteractions']);router[_0xc87b('0x7')]('/:id/sms/interactions',auth[_0xc87b('0x5')](),controller[_0xc87b('0x1d')]);router[_0xc87b('0x7')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0xc87b('0x1e')]);router[_0xc87b('0x7')](_0xc87b('0x1f'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x20')]);router['get'](_0xc87b('0x21'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x22')]);router[_0xc87b('0x7')](_0xc87b('0x23'),auth['isAuthenticated'](),controller['getLists']);router['get'](_0xc87b('0x24'),auth[_0xc87b('0x5')](),controller['getAgents']);router['get'](_0xc87b('0x25'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x26')]);router['get'](_0xc87b('0x27'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x28')]);router['get'](_0xc87b('0x29'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x2a')]);router[_0xc87b('0x7')](_0xc87b('0x2b'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x2c')]);router[_0xc87b('0x7')](_0xc87b('0x2d'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x2e')]);router[_0xc87b('0x7')]('/:id/chat_websites',auth[_0xc87b('0x5')](),controller[_0xc87b('0x2f')]);router['get'](_0xc87b('0x30'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x31')]);router['get'](_0xc87b('0x32'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x33')]);router[_0xc87b('0x7')](_0xc87b('0x34'),auth['isAuthenticated'](),controller['getApiKey']);router[_0xc87b('0x35')]('/:id/contacts',auth[_0xc87b('0x5')](),controller[_0xc87b('0x36')]);router[_0xc87b('0x35')]('/',auth[_0xc87b('0x5')](),controller['create']);router[_0xc87b('0x35')](_0xc87b('0x37'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x38')]);router[_0xc87b('0x35')](_0xc87b('0x12'),auth[_0xc87b('0x5')](),controller['addQueues']);var upload=multer({'storage':multer[_0xc87b('0x39')]({'destination':function(_0x585efd,_0x5e0efd,_0x426458){_0x426458(null,path[_0xc87b('0x3a')](config[_0xc87b('0x3b')],_0xc87b('0x3c')));},'filename':function(_0x1ed947,_0x8b9a6e,_0x4c7d01){_0x4c7d01(null,util[_0xc87b('0x3d')](_0xc87b('0x3e'),Date[_0xc87b('0x3f')](),_0x8b9a6e[_0xc87b('0x40')]));}})});router['post'](_0xc87b('0xd'),upload[_0xc87b('0x41')](_0xc87b('0x42')),controller[_0xc87b('0x43')]);router['post']('/:id/login',auth['isAuthenticated'](),controller[_0xc87b('0x44')]);router[_0xc87b('0x35')]('/:id/logout',auth[_0xc87b('0x5')](),controller[_0xc87b('0x45')]);router[_0xc87b('0x35')](_0xc87b('0x46'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x47')]);router[_0xc87b('0x35')](_0xc87b('0x48'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x49')]);router[_0xc87b('0x35')](_0xc87b('0x21'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x4a')]);router[_0xc87b('0x35')]('/:id/chat_interactions',auth[_0xc87b('0x5')](),controller[_0xc87b('0x4b')]);router[_0xc87b('0x35')](_0xc87b('0x4c'),auth[_0xc87b('0x5')](),controller['addMailInteractions']);router['post'](_0xc87b('0x4d'),auth[_0xc87b('0x5')](),controller['addFaxInteractions']);router[_0xc87b('0x35')](_0xc87b('0x4e'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x4f')]);router[_0xc87b('0x35')](_0xc87b('0x50'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0xc87b('0x35')](_0xc87b('0x51'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x52')]);router[_0xc87b('0x35')](_0xc87b('0x27'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x53')]);router[_0xc87b('0x35')](_0xc87b('0x29'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x54')]);router[_0xc87b('0x35')]('/:id/openchannel_accounts',auth[_0xc87b('0x5')](),controller[_0xc87b('0x55')]);router['post'](_0xc87b('0x2d'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x56')]);router[_0xc87b('0x35')](_0xc87b('0x57'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x58')]);router['post']('/:id/whatsapp_accounts',auth[_0xc87b('0x5')](),controller['addWhatsappAccounts']);router[_0xc87b('0x35')](_0xc87b('0x34'),auth[_0xc87b('0x5')](),controller['createApiKey']);router[_0xc87b('0x59')](_0xc87b('0x5a'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x5b')]);router[_0xc87b('0x59')](_0xc87b('0x5c'),auth[_0xc87b('0x5')](),controller['changePassword']);router['delete'](_0xc87b('0x12'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x5d')]);router[_0xc87b('0x5e')](_0xc87b('0x21'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xc87b('0x5e')](_0xc87b('0x5a'),auth['isAuthenticated'](),controller[_0xc87b('0x5f')]);router[_0xc87b('0x5e')](_0xc87b('0x60'),auth[_0xc87b('0x5')](),controller['removeChatInteractions']);router[_0xc87b('0x5e')](_0xc87b('0x4c'),auth[_0xc87b('0x5')](),controller['removeMailInteractions']);router[_0xc87b('0x5e')](_0xc87b('0x4d'),auth['isAuthenticated'](),controller[_0xc87b('0x61')]);router[_0xc87b('0x5e')](_0xc87b('0x4e'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x62')]);router[_0xc87b('0x5e')](_0xc87b('0x50'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0xc87b('0x5e')](_0xc87b('0x51'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x63')]);router[_0xc87b('0x5e')](_0xc87b('0x27'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0xc87b('0x5e')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xc87b('0x64')]);router[_0xc87b('0x5e')](_0xc87b('0x2b'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x65')]);router[_0xc87b('0x5e')](_0xc87b('0x2d'),auth['isAuthenticated'](),controller[_0xc87b('0x66')]);router[_0xc87b('0x5e')](_0xc87b('0x57'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x67')]);router[_0xc87b('0x5e')](_0xc87b('0x30'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x68')]);router['delete'](_0xc87b('0x34'),auth[_0xc87b('0x5')](),controller[_0xc87b('0x69')]);router[_0xc87b('0x35')]('/:id/messengerSoundNotification',auth[_0xc87b('0x5')](),controller['messengerSoundNotification']);module[_0xc87b('0x6a')]=router; \ No newline at end of file +var _0x2eeb=['destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','addQueues','diskStorage','join','server/files/images/','format','now','originalname','single','file','addAvatar','login','/:id/logout','logout','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addFaxAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id','update','/:id/password','changePassword','delete','removeTeams'];(function(_0x5be41a,_0x1050a8){var _0xc6b19a=function(_0x43f25c){while(--_0x43f25c){_0x5be41a['push'](_0x5be41a['shift']());}};_0xc6b19a(++_0x1050a8);}(_0x2eeb,0x80));var _0xb2ee=function(_0x51ac7c,_0x8696f2){_0x51ac7c=_0x51ac7c-0x0;var _0x380ee7=_0x2eeb[_0x51ac7c];return _0x380ee7;};'use strict';var multer=require(_0xb2ee('0x0'));var util=require(_0xb2ee('0x1'));var path=require('path');var timeout=require(_0xb2ee('0x2'));var express=require(_0xb2ee('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb2ee('0x4'));var interaction=require(_0xb2ee('0x5'));var config=require(_0xb2ee('0x6'));var controller=require(_0xb2ee('0x7'));router[_0xb2ee('0x8')]('/',auth[_0xb2ee('0x9')](),controller['index']);router['get'](_0xb2ee('0xa'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0xb')]);router['get']('/whoami',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0xc')]);router[_0xb2ee('0x8')](_0xb2ee('0xd'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0xe')]);router[_0xb2ee('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb2ee('0xf')]);router[_0xb2ee('0x8')](_0xb2ee('0x10'),controller[_0xb2ee('0x11')]);router[_0xb2ee('0x8')](_0xb2ee('0x12'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x13')]);router['get'](_0xb2ee('0x14'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x15')]);router['get'](_0xb2ee('0x16'),auth['isAuthenticated'](),controller[_0xb2ee('0x17')]);router[_0xb2ee('0x8')](_0xb2ee('0x18'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x19')]);router[_0xb2ee('0x8')](_0xb2ee('0x1a'),auth[_0xb2ee('0x9')](),controller['getGroups']);router[_0xb2ee('0x8')]('/:id/recordings',auth['isAuthenticated'](),controller[_0xb2ee('0x1b')]);router['get'](_0xb2ee('0x1c'),auth[_0xb2ee('0x9')](),controller['getScreenRecordings']);router[_0xb2ee('0x8')](_0xb2ee('0x1d'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x1e')]);router[_0xb2ee('0x8')](_0xb2ee('0x1f'),auth['isAuthenticated'](),controller[_0xb2ee('0x20')]);router[_0xb2ee('0x8')](_0xb2ee('0x21'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x22')]);router[_0xb2ee('0x8')](_0xb2ee('0x23'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x24')]);router[_0xb2ee('0x8')](_0xb2ee('0x25'),auth['isAuthenticated'](),controller[_0xb2ee('0x26')]);router[_0xb2ee('0x8')](_0xb2ee('0x27'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x28')]);router[_0xb2ee('0x8')](_0xb2ee('0x29'),auth['isAuthenticated'](),controller[_0xb2ee('0x2a')]);router[_0xb2ee('0x8')](_0xb2ee('0x2b'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x2c')]);router[_0xb2ee('0x8')]('/:id/agents',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x2d')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0xb2ee('0x2e')]);router['get'](_0xb2ee('0x2f'),auth[_0xb2ee('0x9')](),controller['getFaxAccounts']);router['get'](_0xb2ee('0x30'),auth['isAuthenticated'](),controller[_0xb2ee('0x31')]);router[_0xb2ee('0x8')](_0xb2ee('0x32'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x33')]);router[_0xb2ee('0x8')](_0xb2ee('0x34'),auth[_0xb2ee('0x9')](),controller['getSmsAccounts']);router[_0xb2ee('0x8')](_0xb2ee('0x35'),auth[_0xb2ee('0x9')](),controller['getChatWebsites']);router[_0xb2ee('0x8')]('/:id/whatsapp_accounts',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x36')]);router[_0xb2ee('0x8')](_0xb2ee('0x37'),auth[_0xb2ee('0x9')](),controller['getScheduledCalls']);router[_0xb2ee('0x8')](_0xb2ee('0x38'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x39')]);router[_0xb2ee('0x3a')](_0xb2ee('0x14'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x3b')]);router[_0xb2ee('0x3a')]('/',auth[_0xb2ee('0x9')](),controller['create']);router['post'](_0xb2ee('0x3c'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x3d')]);router['post'](_0xb2ee('0x16'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x3e')]);var upload=multer({'storage':multer[_0xb2ee('0x3f')]({'destination':function(_0x520bf9,_0x12ae65,_0x51e6df){_0x51e6df(null,path[_0xb2ee('0x40')](config['root'],_0xb2ee('0x41')));},'filename':function(_0x38089e,_0x55b72d,_0x52a98a){_0x52a98a(null,util[_0xb2ee('0x42')]('%s-%s',Date[_0xb2ee('0x43')](),_0x55b72d[_0xb2ee('0x44')]));}})});router[_0xb2ee('0x3a')](_0xb2ee('0x10'),upload[_0xb2ee('0x45')](_0xb2ee('0x46')),controller[_0xb2ee('0x47')]);router['post']('/:id/login',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x48')]);router[_0xb2ee('0x3a')](_0xb2ee('0x49'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x4a')]);router['post']('/:id/pause',auth[_0xb2ee('0x9')](),controller['pause']);router['post'](_0xb2ee('0x4b'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x4c')]);router[_0xb2ee('0x3a')]('/:id/teams',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x4d')]);router[_0xb2ee('0x3a')](_0xb2ee('0x4e'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x4f')]);router[_0xb2ee('0x3a')](_0xb2ee('0x50'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x51')]);router[_0xb2ee('0x3a')](_0xb2ee('0x52'),auth[_0xb2ee('0x9')](),controller['addFaxInteractions']);router[_0xb2ee('0x3a')](_0xb2ee('0x53'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x54')]);router[_0xb2ee('0x3a')](_0xb2ee('0x55'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0xb2ee('0x3a')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['addWhatsappInteractions']);router['post'](_0xb2ee('0x2f'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x56')]);router[_0xb2ee('0x3a')](_0xb2ee('0x30'),auth[_0xb2ee('0x9')](),controller['addMailAccounts']);router['post'](_0xb2ee('0x32'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0xb2ee('0x3a')](_0xb2ee('0x34'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0xb2ee('0x3a')](_0xb2ee('0x35'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x57')]);router[_0xb2ee('0x3a')](_0xb2ee('0x58'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x59')]);router[_0xb2ee('0x3a')](_0xb2ee('0x38'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x5a')]);router[_0xb2ee('0x5b')](_0xb2ee('0x5c'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x5d')]);router['put'](_0xb2ee('0x5e'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x5f')]);router[_0xb2ee('0x60')](_0xb2ee('0x16'),auth[_0xb2ee('0x9')](),controller['removeQueues']);router['delete'](_0xb2ee('0x29'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x61')]);router[_0xb2ee('0x60')]('/:id',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x62')]);router[_0xb2ee('0x60')](_0xb2ee('0x4e'),auth['isAuthenticated'](),controller[_0xb2ee('0x63')]);router[_0xb2ee('0x60')](_0xb2ee('0x50'),auth[_0xb2ee('0x9')](),controller['removeMailInteractions']);router[_0xb2ee('0x60')](_0xb2ee('0x52'),auth['isAuthenticated'](),controller[_0xb2ee('0x64')]);router[_0xb2ee('0x60')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xb2ee('0x65')]);router[_0xb2ee('0x60')](_0xb2ee('0x55'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x66')]);router[_0xb2ee('0x60')](_0xb2ee('0x67'),auth[_0xb2ee('0x9')](),controller['removeWhatsappInteractions']);router[_0xb2ee('0x60')]('/:id/fax_accounts',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x68')]);router[_0xb2ee('0x60')]('/:id/mail_accounts',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x69')]);router['delete'](_0xb2ee('0x32'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x6a')]);router[_0xb2ee('0x60')](_0xb2ee('0x34'),auth['isAuthenticated'](),controller[_0xb2ee('0x6b')]);router[_0xb2ee('0x60')]('/:id/chat_websites',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x6c')]);router[_0xb2ee('0x60')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xb2ee('0x6d')]);router[_0xb2ee('0x60')](_0xb2ee('0x38'),auth['isAuthenticated'](),controller['removeApiKey']);router[_0xb2ee('0x3a')](_0xb2ee('0x6e'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0x6f')]);module[_0xb2ee('0x70')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 822e6f4..b8869c6 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 _0x3189=['screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','\x22%s\x22\x20<%s>','getDataValue','internal','STRING','email','ENUM','admin','user','telephone','local','callerid','BOOLEAN','DATE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','always','accept','refuse','originate','uas','fingerprint','certificate','active','passive','actpass','TEXT','showWebBar','get','isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3189,0x113));var _0x9318=function(_0x2ebd34,_0x218c0b){_0x2ebd34=_0x2ebd34-0x0;var _0x152db3=_0x3189[_0x2ebd34];return _0x152db3;};'use strict';var Sequelize=require(_0x9318('0x0'));var moment=require('moment');var util=require('util');var _=require(_0x9318('0x1'));module[_0x9318('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9318('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x23072a){this[_0x9318('0x4')]('name',_0x23072a);this[_0x9318('0x4')](_0x9318('0x5'),_0x23072a);},'comment':_0x9318('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xee4321){this[_0x9318('0x4')](_0x9318('0x7'),_0xee4321);this['setDataValue']('callerid',util['format'](_0x9318('0x8'),_0xee4321,this[_0x9318('0x9')](_0x9318('0xa'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9318('0xb')],'allowNull':![],'unique':_0x9318('0xc'),'validate':{'isEmail':!![]},'set':function(_0x54fa95){if(_0x54fa95){this[_0x9318('0x4')](_0x9318('0xc'),_0x54fa95['toLowerCase']());}}},'role':{'type':Sequelize[_0x9318('0xd')](_0x9318('0xe'),_0x9318('0xf'),'agent',_0x9318('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x9318('0xb')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9318('0xb')],'defaultValue':_0x9318('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x9318('0xa'),'set':function(_0x4c25dd){this['setDataValue'](_0x9318('0xa'),_0x4c25dd);this['setDataValue']('accountcode',_0x4c25dd);this['setDataValue'](_0x9318('0x12'),util['format'](_0x9318('0x8'),this[_0x9318('0x9')](_0x9318('0x7')),_0x4c25dd));}},'salt':{'type':Sequelize[_0x9318('0xb')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x9318('0xb')]},'zipcode':{'type':Sequelize[_0x9318('0xb')]},'userpic':{'type':Sequelize[_0x9318('0xb')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9318('0xb')]},'online':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x9318('0x14')]},'chatCapacity':{'type':Sequelize[_0x9318('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9318('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x9318('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x9318('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9318('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9318('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9318('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9318('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'host':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![],'defaultValue':_0x9318('0x16')},'ipaddr':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'port':{'type':Sequelize[_0x9318('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9318('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9318('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x17'),'user',_0x9318('0x18')),'allowNull':!![],'defaultValue':_0x9318('0x17')},'context':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![],'defaultValue':_0x9318('0x19')},'callingpres':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x1a'),_0x9318('0x1b'),_0x9318('0x1c'),'ALLOWED',_0x9318('0x1d'),'PROHIB_PASSED_SCREEN',_0x9318('0x1e'),_0x9318('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a54a1){this[_0x9318('0x4')](_0x9318('0x20'),_0x3a54a1?_0x3a54a1[_0x9318('0x21')](','):null);},'get':function(){return this[_0x9318('0x9')](_0x9318('0x20'))?this[_0x9318('0x9')]('transport')[_0x9318('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x23'),_0x9318('0x24'),_0x9318('0x25'),_0x9318('0x26'),_0x9318('0x27')),'allowNull':!![],'defaultValue':_0x9318('0x23')},'directmedia':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no',_0x9318('0x29'),_0x9318('0x2a'),_0x9318('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![],'defaultValue':_0x9318('0x2c'),'set':function(_0x319b7f){this[_0x9318('0x4')](_0x9318('0x2d'),_0x319b7f?_0x319b7f[_0x9318('0x21')](','):null);},'get':function(){return this['getDataValue'](_0x9318('0x2d'))?this['getDataValue'](_0x9318('0x2d'))[_0x9318('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x9318('0xb')]},'namedcallgroup':{'type':Sequelize[_0x9318('0xb')]},'pickupgroup':{'type':Sequelize[_0x9318('0xb')]},'namedpickupgroup':{'type':Sequelize[_0x9318('0xb')]},'language':{'type':Sequelize[_0x9318('0xb')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9318('0xb')]},'disallow':{'type':Sequelize[_0x9318('0xb')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9318('0x2e'),'set':function(_0xc53c47){this[_0x9318('0x4')](_0x9318('0x2f'),_0xc53c47?_0xc53c47['join'](';'):_0x9318('0x2e'));},'get':function(){return this[_0x9318('0x9')](_0x9318('0x2f'))?this[_0x9318('0x9')](_0x9318('0x2f'))[_0x9318('0x22')](';'):null;},'comment':_0x9318('0x30')},'autoframing':{'type':Sequelize[_0x9318('0xd')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![],'set':function(_0x2255ae){this[_0x9318('0x4')](_0x9318('0x31'),_0x2255ae?_0x2255ae[_0x9318('0x21')](','):null);},'get':function(){return this[_0x9318('0x9')](_0x9318('0x31'))?this['getDataValue'](_0x9318('0x31'))[_0x9318('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x9318('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9318('0xd')]('yes','no',_0x9318('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9318('0xd')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9318('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no'),'allowNull':!![],'defaultValue':_0x9318('0x28')},'busylevel':{'type':Sequelize[_0x9318('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x9318('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'template':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no',_0x9318('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9318('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x34'),_0x9318('0x35'),_0x9318('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9318('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9318('0xd')]('uac','uas'),'allowNull':!![],'defaultValue':_0x9318('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x9318('0x28'),'no'),'allowNull':!![],'defaultValue':_0x9318('0x28')},'keepalive':{'type':Sequelize[_0x9318('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9318('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9318('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9318('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x9318('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9318('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x9318('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x9318('0xd')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no',_0x9318('0x38'),_0x9318('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9318('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x3a'),_0x9318('0x3b'),_0x9318('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9318('0xd')](_0x9318('0x28'),'no',_0x9318('0x29'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x9318('0x14')]},'passwordResetAt':{'type':Sequelize[_0x9318('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x9318('0x3d')]},'showWebBar':{'type':Sequelize[_0x9318('0x15')],'defaultValue':0x0,'set':function(_0x282af5){this[_0x9318('0x4')](_0x9318('0x3e'),_0x282af5);var _0x6c15b6=this[_0x9318('0x3f')]({'plain':!![]});switch(_0x282af5){case 0x0:case 0x1:var _0x2d16fd=_0x6c15b6[_0x9318('0x20')]?_[_0x9318('0x40')](_0x6c15b6[_0x9318('0x20')])?_0x6c15b6['transport'][_0x9318('0x21')]():_0x6c15b6[_0x9318('0x20')]:_0x9318('0x41');if(_0x2d16fd===_0x9318('0x42')){_0x2d16fd=_0x9318('0x41');}this['setDataValue']('transport',_0x2d16fd);this['setDataValue'](_0x9318('0x43'),'no');this[_0x9318('0x4')](_0x9318('0x44'),null);this[_0x9318('0x4')](_0x9318('0x45'),null);this[_0x9318('0x4')](_0x9318('0x46'),null);this[_0x9318('0x4')](_0x9318('0x47'),null);this[_0x9318('0x4')](_0x9318('0x48'),null);this[_0x9318('0x4')]('dtlssetup',null);this[_0x9318('0x4')](_0x9318('0x49'),null);this[_0x9318('0x4')](_0x9318('0x4a'),null);this['setDataValue'](_0x9318('0x4b'),'no');break;case 0x2:this['setDataValue'](_0x9318('0x20'),_0x9318('0x42'));this[_0x9318('0x4')]('encryption',_0x9318('0x28'));this['setDataValue'](_0x9318('0x44'),_0x9318('0x28'));this['setDataValue']('force_avp',_0x9318('0x28'));this[_0x9318('0x4')]('icesupport',_0x9318('0x28'));this[_0x9318('0x4')](_0x9318('0x47'),_0x9318('0x28'));this[_0x9318('0x4')](_0x9318('0x48'),'no');this[_0x9318('0x4')]('dtlssetup',_0x9318('0x3c'));this['setDataValue'](_0x9318('0x49'),_0x6c15b6[_0x9318('0x49')]||_0x9318('0x4c'));this[_0x9318('0x4')]('dtlsprivatekey',_0x6c15b6[_0x9318('0x4a')]||_0x9318('0x4d'));this[_0x9318('0x4')](_0x9318('0x4b'),_0x9318('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x9318('0x3d')],'set':function(_0x29d245){this[_0x9318('0x4')](_0x9318('0x4e'),_0x29d245?_0x29d245[_0x9318('0x21')](','):[]);},'get':function(){return this[_0x9318('0x9')](_0x9318('0x4e'))?_[_0x9318('0x4f')](this['getDataValue'](_0x9318('0x4e'))[_0x9318('0x22')](','),function(_0xa18192){return parseInt(_0xa18192,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x9318('0xb')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x9318('0xb')]},'phoneBarBusyNumber':{'type':Sequelize[_0x9318('0xb')]},'phoneBarUnconditional':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x9318('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9318('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x9318('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x9318('0xb')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x9318('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9318('0xd')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9318('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9318('0x50')],'get':function(){return this[_0x9318('0x9')](_0x9318('0x51'))?this['getDataValue'](_0x9318('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9318('0xb')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![],'set':function(_0x2c6175){if(typeof _0x2c6175===_0x9318('0x52')){var _0x3914e1=_0x2c6175==='1'?!![]:_0x2c6175==='0'?![]:_0x2c6175===_0x9318('0x53')?!![]:_0x2c6175===_0x9318('0x54')?![]:![];this[_0x9318('0x4')](_0x9318('0x55'),_0x3914e1);}else{this['setDataValue'](_0x9318('0x55'),_0x2c6175);}}},'blocked':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![],'set':function(_0xcbf38a){this[_0x9318('0x4')](_0x9318('0x56'),_0xcbf38a);if(_0xcbf38a===!![]){this['setDataValue']('blockedAt',moment());this[_0x9318('0x4')](_0x9318('0x57'),0x0);}else{this[_0x9318('0x4')](_0x9318('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x9318('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9318('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x9318('0x15')](0x5)[_0x9318('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x9318('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9318('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9318('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x9318('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x9318('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x9318('0x15')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x9318('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x9318('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x74a7=['PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','update','outgoing','force_rport,comedia','nat','join','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]','yes','never','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','nonat','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','fullname','BOOLEAN','DATE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x3703d0,_0x21996c){var _0x20ea6d=function(_0x3934c9){while(--_0x3934c9){_0x3703d0['push'](_0x3703d0['shift']());}};_0x20ea6d(++_0x21996c);}(_0x74a7,0x1a5));var _0x774a=function(_0x38e0f5,_0x6fcf7b){_0x38e0f5=_0x38e0f5-0x0;var _0x5d37a=_0x74a7[_0x38e0f5];return _0x5d37a;};'use strict';var Sequelize=require(_0x774a('0x0'));var moment=require(_0x774a('0x1'));var util=require(_0x774a('0x2'));var _=require(_0x774a('0x3'));module[_0x774a('0x4')]={'name':{'type':Sequelize[_0x774a('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x446c33){this[_0x774a('0x6')]('name',_0x446c33);this[_0x774a('0x6')](_0x774a('0x7'),_0x446c33);},'comment':_0x774a('0x8')},'fullname':{'type':Sequelize[_0x774a('0x5')],'allowNull':![],'set':function(_0x1ef30d){this[_0x774a('0x6')]('fullname',_0x1ef30d);this[_0x774a('0x6')]('callerid',util['format'](_0x774a('0x9'),_0x1ef30d,this[_0x774a('0xa')](_0x774a('0xb'))));}},'alias':{'type':Sequelize[_0x774a('0x5')]},'email':{'type':Sequelize[_0x774a('0x5')],'allowNull':![],'unique':_0x774a('0xc'),'validate':{'isEmail':!![]},'set':function(_0x2aa218){if(_0x2aa218){this[_0x774a('0x6')](_0x774a('0xc'),_0x2aa218[_0x774a('0xd')]());}}},'role':{'type':Sequelize[_0x774a('0xe')](_0x774a('0xf'),_0x774a('0x10'),_0x774a('0x11'),_0x774a('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x774a('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x774a('0x13')},'internal':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':![],'unique':_0x774a('0xb'),'set':function(_0x928265){this[_0x774a('0x6')](_0x774a('0xb'),_0x928265);this[_0x774a('0x6')](_0x774a('0x15'),_0x928265);this[_0x774a('0x6')]('callerid',util['format'](_0x774a('0x9'),this[_0x774a('0xa')](_0x774a('0x16')),_0x928265));}},'salt':{'type':Sequelize[_0x774a('0x5')]},'phone':{'type':Sequelize[_0x774a('0x5')]},'mobile':{'type':Sequelize[_0x774a('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x774a('0x5')]},'country':{'type':Sequelize[_0x774a('0x5')]},'online':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x774a('0x18')]},'voicePause':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x774a('0x5')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x774a('0x18')]},'chatCapacity':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x774a('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x774a('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x774a('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![],'defaultValue':_0x774a('0x19')},'ipaddr':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x774a('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x1a'),_0x774a('0x10'),_0x774a('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x774a('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x774a('0x1d'),_0x774a('0x1e'),_0x774a('0x1f'),'ALLOWED',_0x774a('0x20'),_0x774a('0x21'),_0x774a('0x22'),_0x774a('0x23')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![],'defaultValue':_0x774a('0x24'),'set':function(_0xd5d115){this[_0x774a('0x6')]('transport',_0xd5d115?_0xd5d115['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x774a('0xa')](_0x774a('0x25'))[_0x774a('0x26')](','):null;},'comment':_0x774a('0x27')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x774a('0x28'),_0x774a('0x29'),'inband','auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x774a('0xe')]('yes','no','nonat',_0x774a('0x2a'),_0x774a('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x774a('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![],'defaultValue':_0x774a('0x2c'),'set':function(_0x2b55b1){this['setDataValue'](_0x774a('0x2d'),_0x2b55b1?_0x2b55b1[_0x774a('0x2e')](','):null);},'get':function(){return this[_0x774a('0xa')](_0x774a('0x2d'))?this[_0x774a('0xa')](_0x774a('0x2d'))[_0x774a('0x26')](','):null;},'comment':_0x774a('0x2f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x774a('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x774a('0x5')]},'language':{'type':Sequelize[_0x774a('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x774a('0x5')]},'disallow':{'type':Sequelize[_0x774a('0x5')],'allowNull':![],'defaultValue':_0x774a('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x774a('0x31'),'set':function(_0x128c17){this['setDataValue'](_0x774a('0x32'),_0x128c17?_0x128c17['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x774a('0xa')]('allow')?this[_0x774a('0xa')](_0x774a('0x32'))['split'](';'):null;},'comment':_0x774a('0x33')},'autoframing':{'type':Sequelize[_0x774a('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![],'set':function(_0x5d79d9){this[_0x774a('0x6')](_0x774a('0x34'),_0x5d79d9?_0x5d79d9[_0x774a('0x2e')](','):null);},'get':function(){return this[_0x774a('0xa')](_0x774a('0x34'))?this['getDataValue'](_0x774a('0x34'))[_0x774a('0x26')](','):null;},'comment':_0x774a('0x35')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x774a('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no',_0x774a('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x774a('0x36'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x774a('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no',_0x774a('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x39'),_0x774a('0x3a'),_0x774a('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x3c'),_0x774a('0x3d')),'allowNull':!![],'defaultValue':_0x774a('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x774a('0x36'),'no'),'allowNull':!![],'defaultValue':_0x774a('0x36')},'keepalive':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x774a('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no',_0x774a('0x3e'),_0x774a('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x774a('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x40'),_0x774a('0x41'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x774a('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x774a('0x36'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x774a('0xe')](_0x774a('0x36'),'no',_0x774a('0x42'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x774a('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x774a('0x18')]},'passwordResetAt':{'type':Sequelize[_0x774a('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0,'set':function(_0x319ab3){this['setDataValue']('showWebBar',_0x319ab3);var _0x499491=this[_0x774a('0x43')]({'plain':!![]});switch(_0x319ab3){case 0x0:case 0x1:var _0x792326=_0x499491[_0x774a('0x25')]?_[_0x774a('0x44')](_0x499491[_0x774a('0x25')])?_0x499491['transport'][_0x774a('0x2e')]():_0x499491[_0x774a('0x25')]:_0x774a('0x24');if(_0x792326===_0x774a('0x45')){_0x792326=_0x774a('0x24');}this[_0x774a('0x6')](_0x774a('0x25'),_0x792326);this[_0x774a('0x6')](_0x774a('0x46'),'no');this['setDataValue'](_0x774a('0x47'),null);this[_0x774a('0x6')](_0x774a('0x48'),null);this[_0x774a('0x6')](_0x774a('0x49'),null);this[_0x774a('0x6')](_0x774a('0x4a'),null);this[_0x774a('0x6')](_0x774a('0x4b'),null);this[_0x774a('0x6')](_0x774a('0x4c'),null);this[_0x774a('0x6')](_0x774a('0x4d'),null);this['setDataValue'](_0x774a('0x4e'),null);this['setDataValue'](_0x774a('0x4f'),'no');break;case 0x2:this[_0x774a('0x6')]('transport','wss');this[_0x774a('0x6')](_0x774a('0x46'),_0x774a('0x36'));this[_0x774a('0x6')](_0x774a('0x47'),_0x774a('0x36'));this['setDataValue'](_0x774a('0x48'),_0x774a('0x36'));this['setDataValue'](_0x774a('0x49'),_0x774a('0x36'));this['setDataValue'](_0x774a('0x4a'),_0x774a('0x36'));this[_0x774a('0x6')](_0x774a('0x4b'),'no');this[_0x774a('0x6')](_0x774a('0x4c'),_0x774a('0x50'));this['setDataValue'](_0x774a('0x4d'),_0x499491['dtlscertfile']||_0x774a('0x51'));this['setDataValue'](_0x774a('0x4e'),_0x499491[_0x774a('0x4e')]||_0x774a('0x52'));this[_0x774a('0x6')](_0x774a('0x4f'),_0x774a('0x36'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x5304c4){this[_0x774a('0x6')](_0x774a('0x53'),_0x5304c4?_0x5304c4['join'](','):[]);},'get':function(){return this[_0x774a('0xa')](_0x774a('0x53'))?_['map'](this['getDataValue'](_0x774a('0x53'))[_0x774a('0x26')](','),function(_0x4553ac){return parseInt(_0x4553ac,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x774a('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x774a('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x774a('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x774a('0x36'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x774a('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x774a('0x54')],'get':function(){return this['getDataValue'](_0x774a('0x55'))?this[_0x774a('0xa')](_0x774a('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x774a('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x774a('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![],'set':function(_0x29ed04){if(typeof _0x29ed04===_0x774a('0x56')){var _0x3b83e0=_0x29ed04==='1'?!![]:_0x29ed04==='0'?![]:_0x29ed04===_0x774a('0x57')?!![]:_0x29ed04==='false'?![]:![];this[_0x774a('0x6')]('screenrecording',_0x3b83e0);}else{this[_0x774a('0x6')]('screenrecording',_0x29ed04);}}},'blocked':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![],'set':function(_0x36587d){this[_0x774a('0x6')]('blocked',_0x36587d);if(_0x36587d===!![]){this[_0x774a('0x6')](_0x774a('0x58'),moment());this[_0x774a('0x6')](_0x774a('0x59'),0x0);}else{this['setDataValue'](_0x774a('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x774a('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x774a('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x774a('0x14')](0x5)[_0x774a('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x774a('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x774a('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x774a('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x774a('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index b106550..35eabf6 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 _0x42da=['$notIn','$like','$notLike','$iLike','$contains','$contained','$any','CmHopper','firstName','lastName','CmContact','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','ringing','teams','queues','inbound','flatten','toString','lower','asc','desc','substring','orderBy','getRealtimeAgents','voiceStatus','unavailable','charAt','toUpperCase','slice','select','field','ui.','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','moment','path','squel','ioredis','../../components/auth/service','../../components/contacts','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','end','status','offset','limit','undefined','count','set','json','update','then','agent','emit','userNotification:recalc:','destroy','get','admin','Users','user','Agents','Telephones','telephone','ignore','map','value','includes','role','name','UserProfileResource','sendStatus','error','stack','send','rawAttributes','fieldName','type','filter','password','salt','previousPasswords','resetPasswordToken','md5secret','index','getOptions','where','User','includeAll','include','query','userSetting','UserSetting','attributes','push','findAll','rows','openTabs','true','length','chat','dataValues','sms','mail','openchannel','whatsapp','all','catch','show','params','options','find','fax','body','describe','addContacts','ids','omit','internal','Setting','validatePasswordPattern','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','102','103','113','104','106','107','100','111','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Unauthorized','some','compact','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','ValidationError','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','addQueues','channel','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','voice','online','format','SIP/%s','upsert','removeQueues','Queue:remove','addAvatar','file','filename','root','server/files/images/logos/default_profile.png','userpic','download','join','server/files/images/','getOpenTabs','CHAT','createdAt','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','getContacts','findOne','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','List','Tag','Tags','color','tag','getQueues','model','keys','Queue','filters','intersection','fields','order','sort','pick','merge','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','headers','x-forwarded-for','remoteAddress','connection','socket','UserVoiceQueueRt','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','concat','isMiddleware','resolve','logout','DEFAULT\x20PAUSE','bulkCreate','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','pauseType','lastPauseAt','getTeams','Team','Body\x20parameter\x20\x27ids\x27\x20is\x20required','addTeams','getAssociatedQueues','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Query\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','removeTeams','flattenDeep','getLists','CmList','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','getScheduledCalls','$and','$gt','$gte','$lt','$lte','$ne','$eq','$between','$in'];(function(_0x276357,_0x4a4691){var _0x4395b2=function(_0x1c5dc9){while(--_0x1c5dc9){_0x276357['push'](_0x276357['shift']());}};_0x4395b2(++_0x4a4691);}(_0x42da,0x1b9));var _0xa42d=function(_0x53fcd9,_0x435157){_0x53fcd9=_0x53fcd9-0x0;var _0x50e7ff=_0x42da[_0x53fcd9];return _0x50e7ff;};'use strict';var moment=require(_0xa42d('0x0'));var util=require('util');var path=require(_0xa42d('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa42d('0x2'));var Redis=require(_0xa42d('0x3'));var authService=require(_0xa42d('0x4'));var contacts=require(_0xa42d('0x5'));var qs=require('../../components/parsers/qs');var rta=require(_0xa42d('0x6'));var logger=require(_0xa42d('0x7'))(_0xa42d('0x8'));var utils=require(_0xa42d('0x9'));var config=require(_0xa42d('0xa'));var licenseUtil=require(_0xa42d('0xb'));var APIBadRequestError=require(_0xa42d('0xc'))[_0xa42d('0xd')];var APINotFoundError=require(_0xa42d('0xc'))['APINotFoundError'];var APIHandleError=require(_0xa42d('0xc'))[_0xa42d('0xe')];var db=require(_0xa42d('0xf'))['db'];var socket=require(_0xa42d('0x10'))(new Redis(config[_0xa42d('0x11')]));require(_0xa42d('0x12'))[_0xa42d('0x13')](socket);config['redis']=_[_0xa42d('0x14')](config[_0xa42d('0x11')],{'host':'localhost','port':0x18eb});var values;function respondWithStatusCode(_0x8137e4,_0x5ac626){_0x5ac626=_0x5ac626||0xcc;return function(_0x111b56){if(_0x111b56){return _0x8137e4['sendStatus'](_0x5ac626);}return _0x8137e4['status'](_0x5ac626)[_0xa42d('0x15')]();};}function respondWithResult(_0x223113,_0x3dd7b7){_0x3dd7b7=_0x3dd7b7||0xc8;return function(_0x2e95d1){if(_0x2e95d1){return _0x223113[_0xa42d('0x16')](_0x3dd7b7)['json'](_0x2e95d1);}};}function respondWithFilteredResult(_0x546832,_0x419c98){return function(_0x17d77c){if(_0x17d77c){var _0x4c3886=typeof _0x419c98[_0xa42d('0x17')]==='undefined'&&typeof _0x419c98[_0xa42d('0x18')]===_0xa42d('0x19');var _0x4014b4=_0x17d77c[_0xa42d('0x1a')];var _0x51b31a=_0x4c3886?0x0:_0x419c98[_0xa42d('0x17')];var _0x55d3cd=_0x4c3886?_0x17d77c[_0xa42d('0x1a')]:_0x419c98['offset']+_0x419c98[_0xa42d('0x18')];var _0x4f5782;if(_0x55d3cd>=_0x4014b4){_0x55d3cd=_0x4014b4;_0x4f5782=0xc8;}else{_0x4f5782=0xce;}_0x546832['status'](_0x4f5782);return _0x546832[_0xa42d('0x1b')]('Content-Range',_0x51b31a+'-'+_0x55d3cd+'/'+_0x4014b4)[_0xa42d('0x1c')](_0x17d77c);}return null;};}function saveUpdates(_0xbdd874){return function(_0x2ad12e){if(_0x2ad12e){return _0x2ad12e[_0xa42d('0x1d')](_0xbdd874)[_0xa42d('0x1e')](function(_0x186056){if(_0x186056['role']===_0xa42d('0x1f')){socket[_0xa42d('0x20')](_0xa42d('0x21')+_0x186056['id'],_0x186056);}return _0x186056;});}return null;};}function removeEntity(_0x3a20f7){return function(_0x411401){if(_0x411401){return _0x411401[_0xa42d('0x22')]()[_0xa42d('0x1e')](function(){var _0x43c495=_0x411401[_0xa42d('0x23')]({'plain':!![]});if(_0x43c495['role']===_0xa42d('0x24'))return;var _0x5ee171=[{'name':_0xa42d('0x25'),'value':_0xa42d('0x26'),'ignore':!![]},{'name':_0xa42d('0x27'),'value':_0xa42d('0x1f'),'ignore':![]},{'name':_0xa42d('0x28'),'value':_0xa42d('0x29'),'ignore':![]}];var _0x19627a=_(_0x5ee171)['filter'](_0xa42d('0x2a'))[_0xa42d('0x2b')]('value')[_0xa42d('0x2c')]();if(_[_0xa42d('0x2d')](_0x19627a,_0x43c495[_0xa42d('0x2e')])){return;}var _0x4ccbe6=_['find'](_0x5ee171,[_0xa42d('0x2c'),_0x43c495[_0xa42d('0x2e')]])[_0xa42d('0x2f')];return db[_0xa42d('0x30')][_0xa42d('0x22')]({'where':{'type':_0x4ccbe6,'resourceId':_0x43c495['id']}})['then'](function(){return _0x411401;});})[_0xa42d('0x1e')](function(){_0x3a20f7[_0xa42d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeb5dbf){return function(_0x348eac){if(!_0x348eac){_0xeb5dbf[_0xa42d('0x31')](0x194);}return _0x348eac;};}function handleError(_0x1c2a2b,_0x37f9d0){_0x37f9d0=_0x37f9d0||0x1f4;return function(_0x10a3bc){logger[_0xa42d('0x32')](_0x10a3bc[_0xa42d('0x33')]);if(_0x10a3bc[_0xa42d('0x2f')]){delete _0x10a3bc[_0xa42d('0x2f')];}_0x1c2a2b[_0xa42d('0x16')](_0x37f9d0)[_0xa42d('0x34')](_0x10a3bc);};}function getUserAttributes(){return _(db['User'][_0xa42d('0x35')])['map'](function(_0x26d8de){return{'name':_0x26d8de[_0xa42d('0x36')],'type':_0x26d8de[_0xa42d('0x37')]['key']};})[_0xa42d('0x38')](function(_0x2e5fe6){return![_0xa42d('0x39'),_0xa42d('0x3a'),_0xa42d('0x3b'),_0xa42d('0x3c'),'resetPasswordExpires',_0xa42d('0x3d')][_0xa42d('0x2d')](_0x2e5fe6[_0xa42d('0x2f')]);})[_0xa42d('0x2c')]();}exports[_0xa42d('0x3e')]=function(_0x2d2df5,_0x8a7e75){var _0x97af53={},_0x462f1b={'count':0x0,'rows':[]};var _0x5476d7=getUserAttributes();_0x97af53=qs[_0xa42d('0x3f')](_0x5476d7,_0x2d2df5);var _0x1db02a={'where':_0x97af53[_0xa42d('0x40')]};return db[_0xa42d('0x41')]['count'](_0x1db02a)[_0xa42d('0x1e')](function(_0xaf9d25){_0x462f1b[_0xa42d('0x1a')]=_0xaf9d25;if(_0x2d2df5['query'][_0xa42d('0x42')]){_0x97af53[_0xa42d('0x43')]=[{'all':!![]}];}if(_0x2d2df5[_0xa42d('0x44')][_0xa42d('0x45')]==='true'){_0x97af53[_0xa42d('0x43')]=[{'model':db[_0xa42d('0x46')],'as':'userSetting'}];}if(!_[_0xa42d('0x2d')](_0x97af53[_0xa42d('0x47')],'id')){_0x97af53['attributes'][_0xa42d('0x48')]('id');}return db[_0xa42d('0x41')][_0xa42d('0x49')](_0x97af53);})[_0xa42d('0x1e')](function(_0x225f2e){_0x462f1b[_0xa42d('0x4a')]=_0x225f2e;if(_0x2d2df5[_0xa42d('0x44')][_0xa42d('0x4b')]===_0xa42d('0x4c')){var _0x451aba=[];for(var _0x5d8579=0x0;_0x5d8579<_0x462f1b[_0xa42d('0x4a')][_0xa42d('0x4d')];_0x5d8579++){_0x451aba[_0xa42d('0x48')](get_open_tabs(_0xa42d('0x4e'),_0x462f1b['rows'][_0x5d8579][_0xa42d('0x4f')]));_0x451aba[_0xa42d('0x48')](get_open_tabs(_0xa42d('0x50'),_0x462f1b['rows'][_0x5d8579][_0xa42d('0x4f')]));_0x451aba[_0xa42d('0x48')](get_open_tabs('fax',_0x462f1b[_0xa42d('0x4a')][_0x5d8579][_0xa42d('0x4f')]));_0x451aba[_0xa42d('0x48')](get_open_tabs(_0xa42d('0x51'),_0x462f1b['rows'][_0x5d8579][_0xa42d('0x4f')]));_0x451aba[_0xa42d('0x48')](get_open_tabs(_0xa42d('0x52'),_0x462f1b[_0xa42d('0x4a')][_0x5d8579][_0xa42d('0x4f')]));_0x451aba[_0xa42d('0x48')](get_open_tabs(_0xa42d('0x53'),_0x462f1b[_0xa42d('0x4a')][_0x5d8579]['dataValues']));}return Promise[_0xa42d('0x54')](_0x451aba)[_0xa42d('0x1e')](function(){return _0x462f1b;});}else{return _0x462f1b;}})[_0xa42d('0x1e')](respondWithFilteredResult(_0x8a7e75,_0x97af53))[_0xa42d('0x55')](handleError(_0x8a7e75,null));};exports[_0xa42d('0x56')]=function(_0x5469ca,_0x497e1b){var _0x3ffd71=getUserAttributes();_0x5469ca[_0xa42d('0x44')]['id']=_0x5469ca[_0xa42d('0x57')]['id'];var _0x4b46b0=qs['getOptions'](_0x3ffd71,_0x5469ca);if(_0x5469ca[_0xa42d('0x44')][_0xa42d('0x42')]){_0x4b46b0[_0xa42d('0x43')]=[{'all':!![]}];}if(_0x5469ca[_0xa42d('0x44')][_0xa42d('0x45')]===_0xa42d('0x4c')){_0x4b46b0[_0xa42d('0x43')]=[{'model':db[_0xa42d('0x46')],'as':_0xa42d('0x45')}];}_0x4b46b0=_['merge']({},_0x4b46b0,_0x5469ca[_0xa42d('0x58')]);if(!_[_0xa42d('0x2d')](_0x4b46b0[_0xa42d('0x47')],'id')){_0x4b46b0[_0xa42d('0x47')][_0xa42d('0x48')]('id');}return db[_0xa42d('0x41')][_0xa42d('0x59')](_0x4b46b0)[_0xa42d('0x1e')](handleEntityNotFound(_0x497e1b,null))[_0xa42d('0x1e')](function(_0x4e64ed){var _0x2bccc1=[];values=_0x4e64ed;if(_0x5469ca['query'][_0xa42d('0x4b')]===_0xa42d('0x4c')){_0x2bccc1[_0xa42d('0x48')](get_open_tabs('chat',_0x4e64ed[_0xa42d('0x4f')]));_0x2bccc1[_0xa42d('0x48')](get_open_tabs('sms',_0x4e64ed[_0xa42d('0x4f')]));_0x2bccc1[_0xa42d('0x48')](get_open_tabs(_0xa42d('0x52'),_0x4e64ed[_0xa42d('0x4f')]));_0x2bccc1[_0xa42d('0x48')](get_open_tabs(_0xa42d('0x53'),_0x4e64ed[_0xa42d('0x4f')]));_0x2bccc1['push'](get_open_tabs(_0xa42d('0x5a'),_0x4e64ed[_0xa42d('0x4f')]));_0x2bccc1[_0xa42d('0x48')](get_open_tabs(_0xa42d('0x51'),_0x4e64ed[_0xa42d('0x4f')]));return Promise['all'](_0x2bccc1);}else{return values;}})[_0xa42d('0x1e')](function(){return values;})['then'](respondWithResult(_0x497e1b,null))['catch'](handleError(_0x497e1b,null));};exports['update']=function(_0x36cd73,_0x24dd56){if(_0x36cd73[_0xa42d('0x5b')]['id']){delete _0x36cd73['body']['id'];}delete _0x36cd73[_0xa42d('0x5b')][_0xa42d('0x2e')];return db[_0xa42d('0x41')][_0xa42d('0x59')]({'where':{'id':_0x36cd73[_0xa42d('0x57')]['id']}})[_0xa42d('0x1e')](handleEntityNotFound(_0x24dd56,null))['then'](saveUpdates(_0x36cd73[_0xa42d('0x5b')],null))['then'](respondWithResult(_0x24dd56,null))[_0xa42d('0x55')](handleError(_0x24dd56,null));};exports[_0xa42d('0x5c')]=function(_0x44e574,_0x3b0f5e){return db[_0xa42d('0x41')]['describe']()[_0xa42d('0x1e')](respondWithResult(_0x3b0f5e,null))['catch'](handleError(_0x3b0f5e,null));};exports[_0xa42d('0x5d')]=function(_0x573213,_0xc006ed){return db[_0xa42d('0x41')][_0xa42d('0x59')]({'where':{'id':_0x573213[_0xa42d('0x57')]['id']}})[_0xa42d('0x1e')](handleEntityNotFound(_0xc006ed,null))['then'](function(_0x2043ea){if(_0x2043ea){return _0x2043ea[_0xa42d('0x5d')](_0x573213[_0xa42d('0x5b')][_0xa42d('0x5e')],_[_0xa42d('0x5f')](_0x573213[_0xa42d('0x5b')],[_0xa42d('0x5e'),'id'])||{});}})[_0xa42d('0x1e')](respondWithResult(_0xc006ed,null))[_0xa42d('0x55')](handleError(_0xc006ed,null));};function validateUser(_0x486cb8){return new Promise(function(_0x242dac,_0x1bda65){if(_0x486cb8[_0xa42d('0x60')])return _0x242dac(_0x486cb8);return db[_0xa42d('0x61')]['findById'](0x1)[_0xa42d('0x1e')](function(_0x1580dd){if(_0x1580dd['securePassword'])authService[_0xa42d('0x62')](_0x486cb8[_0xa42d('0x39')]);db['User']['max'](_0xa42d('0x60'))[_0xa42d('0x1e')](function(_0x16d067){if(_[_0xa42d('0x63')](_0x16d067)){_0x486cb8[_0xa42d('0x60')]=_0x1580dd[_0xa42d('0x64')]||0x1;return;}if(_['isNil'](_0x1580dd['min_internal'])||_0x1580dd['min_internal']===_0x16d067){_0x486cb8[_0xa42d('0x60')]=_0x16d067+0x1;return;}if(_0x1580dd[_0xa42d('0x64')]>_0x16d067){_0x486cb8['internal']=_0x1580dd[_0xa42d('0x64')];return;}return db[_0xa42d('0x65')][_0xa42d('0x44')](_0xa42d('0x66'),{'type':db[_0xa42d('0x65')]['QueryTypes'][_0xa42d('0x67')]})['then'](function(_0x3a197f){if(_0x3a197f&&_0x3a197f[_0xa42d('0x4d')]){for(var _0x5d09d9=0x0,_0x421c93=_0x3a197f[_0xa42d('0x4d')];_0x5d09d9<_0x421c93&&_[_0xa42d('0x63')](_0x486cb8[_0xa42d('0x60')]);_0x5d09d9++){if(_0x1580dd[_0xa42d('0x64')]<=_0x3a197f[_0x5d09d9][_0xa42d('0x68')]){_0x486cb8[_0xa42d('0x60')]=_0x3a197f[_0x5d09d9][_0xa42d('0x68')];}else if(_0x1580dd['min_internal']>_0x3a197f[_0x5d09d9][_0xa42d('0x68')]&&_0x1580dd[_0xa42d('0x64')]<=_0x3a197f[_0x5d09d9]['to']){_0x486cb8[_0xa42d('0x60')]=_0x1580dd['min_internal'];}}}if(_[_0xa42d('0x63')](_0x486cb8['internal'])){_0x486cb8[_0xa42d('0x60')]=_0x16d067+0x1;}return _0x242dac(_0x486cb8);});});})['catch'](function(_0x1203ea){_0x1bda65(_0x1203ea);});});}function updateUser(_0x3a3e51){return new Promise(function(_0x33b962,_0x5879a9){try{if(_0x3a3e51[_0xa42d('0x69')]){_0x3a3e51[_0xa42d('0x6a')]=_0x3a3e51[_0xa42d('0x60')];_0x3a3e51[_0xa42d('0x6b')]={'mailbox':_0x3a3e51[_0xa42d('0x60')],'password':_0x3a3e51[_0xa42d('0x39')],'fullname':_0x3a3e51[_0xa42d('0x6c')],'email':_0x3a3e51[_0xa42d('0x6d')]};}if(_0x3a3e51[_0xa42d('0x2e')]===_0xa42d('0x1f')){if(!_0x3a3e51[_0xa42d('0x6e')])_0x3a3e51['permissions']=['101',_0xa42d('0x6f'),_0xa42d('0x70'),_0xa42d('0x71'),'110',_0xa42d('0x72'),'105',_0xa42d('0x73'),_0xa42d('0x74'),'108','109',_0xa42d('0x75'),_0xa42d('0x76'),_0xa42d('0x77'),_0xa42d('0x78')];}_0x33b962(_0x3a3e51);}catch(_0x1fc35f){_0x5879a9(_0x1fc35f);}});}exports[_0xa42d('0x79')]=function(_0x318dcd,_0x442949){if(_0x318dcd[_0xa42d('0x26')][_0xa42d('0x2e')]===_0xa42d('0x1f'))throw new Error('Unauthorized');if(_0x318dcd[_0xa42d('0x5b')][_0xa42d('0x2e')]===_0xa42d('0x26')&&_0x318dcd['user']['role']!==_0xa42d('0x24')){throw new Error(_0xa42d('0x7a'));}if(_0x318dcd[_0xa42d('0x5b')][_0xa42d('0x2e')]===_0xa42d('0x24')&&_0x318dcd['user'][_0xa42d('0x2e')]!==_0xa42d('0x24')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x318dcd[_0xa42d('0x5b')]])[_0xa42d('0x1e')](function(){return validateUser(_0x318dcd[_0xa42d('0x5b')]);})['then'](function(_0x453b7d){return updateUser(_0x453b7d)['then'](function(_0x4f4a91){if(_0x4f4a91[_0xa42d('0x2e')]===_0xa42d('0x24')){_0x4f4a91[_0xa42d('0x7b')]=_0x318dcd['user'][_0xa42d('0x7b')];delete _0x4f4a91[_0xa42d('0x7c')];}return _0x4f4a91;});})['then'](function(_0x1e67fb){return db[_0xa42d('0x41')][_0xa42d('0x79')](_0x1e67fb,{'include':[{'model':db[_0xa42d('0x6b')],'as':'VoiceMail'}]});})[_0xa42d('0x1e')](function(_0x565b7a){if(_0x318dcd['body'][_0xa42d('0x2e')]===_0xa42d('0x26'))return _0x565b7a;if(_0x318dcd[_0xa42d('0x26')][_0xa42d('0x2e')]!==_0xa42d('0x26'))return _0x565b7a;return db[_0xa42d('0x7d')][_0xa42d('0x59')]({'where':{'name':_0x565b7a[_0xa42d('0x2e')]===_0xa42d('0x1f')?_0xa42d('0x27'):'Telephones','userProfileId':_0x318dcd['user']['userProfileId']},'raw':!![]})[_0xa42d('0x1e')](function(_0x16e98f){if(!_0x16e98f||_0x16e98f[_0xa42d('0x7e')]!=0x0)return _0x565b7a;return db[_0xa42d('0x30')][_0xa42d('0x79')]({'name':_0x565b7a[_0xa42d('0x2f')],'resourceId':_0x565b7a['id'],'type':_0x16e98f['name'],'sectionId':_0x16e98f['id']},{})['then'](function(){return _0x565b7a;});})[_0xa42d('0x55')](function(_0x3af33a){logger[_0xa42d('0x32')](_0xa42d('0x7f'),_0x3af33a);throw _0x3af33a;});})['then'](respondWithResult(_0x442949,0xc9))[_0xa42d('0x55')](handleError(_0x442949,null));};exports['bulkCreate']=function(_0x2fa6ee,_0x375798){var _0x568560=_0x2fa6ee[_0xa42d('0x5b')];var _0x188c23=[];if(_0x2fa6ee[_0xa42d('0x26')][_0xa42d('0x2e')]==='agent')throw new Error(_0xa42d('0x80'));if(_[_0xa42d('0x81')](_0x568560,[_0xa42d('0x2e'),'user'])&&_0x2fa6ee[_0xa42d('0x26')]['role']!==_0xa42d('0x24')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x568560,[_0xa42d('0x2e'),_0xa42d('0x24')])&&_0x2fa6ee[_0xa42d('0x26')][_0xa42d('0x2e')]!==_0xa42d('0x24')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x568560)['then'](function(){return validateUser(_0x568560[0x0]);})[_0xa42d('0x1e')](function(){for(var _0x19c22d=0x1;_0x19c22d<_0x568560[_0xa42d('0x4d')];_0x19c22d++){var _0x35dba3=_0x568560[_0x19c22d-0x1][_0xa42d('0x60')];if(!_0x568560[_0x19c22d]['internal'])_0x568560[_0x19c22d][_0xa42d('0x60')]=_0x35dba3+0x1;_0x188c23[_0xa42d('0x48')](validateUser(_0x568560[_0x19c22d]));}return Promise[_0xa42d('0x54')](_0x188c23);})[_0xa42d('0x1e')](function(){_0x188c23=[];for(var _0x2a9f37=0x0;_0x2a9f37<_0x568560[_0xa42d('0x4d')];_0x2a9f37++){_0x188c23[_0xa42d('0x48')](updateUser(_0x568560[_0x2a9f37]));}return Promise[_0xa42d('0x54')](_0x188c23);})['then'](function(){_0x188c23=_0x568560[_0xa42d('0x2b')](function(_0x130f53){return db[_0xa42d('0x41')][_0xa42d('0x79')](_0x130f53,{'include':[{'model':db[_0xa42d('0x6b')],'as':'VoiceMail'}]})[_0xa42d('0x1e')](function(_0x34e1a4){_0x130f53['id']=_0x34e1a4['id'];return _0x130f53;});});return Promise[_0xa42d('0x54')](_0x188c23);})['then'](function(_0x3f08eb){if(_0x2fa6ee[_0xa42d('0x5b')][_0xa42d('0x2e')]==='user')return _0x3f08eb;if(_0x2fa6ee[_0xa42d('0x26')][_0xa42d('0x2e')]!=='user')return _0x3f08eb;var _0x4be94e=_[_0xa42d('0x81')](_0x3f08eb,function(_0x30e22e){return _0x30e22e[_0xa42d('0x2e')]===_0xa42d('0x1f')||_0x30e22e[_0xa42d('0x2e')]===_0xa42d('0x29');});if(!_0x4be94e)return _0x3f08eb;return db[_0xa42d('0x7d')]['findAll']({'where':{'name':{'$or':[_0xa42d('0x27'),'Telephones']},'userProfileId':_0x2fa6ee[_0xa42d('0x26')][_0xa42d('0x7c')]},'raw':!![]})[_0xa42d('0x1e')](function(_0x3ac739){if(_['isEmpty'](_0x3ac739)||!_[_0xa42d('0x81')](_0x3ac739,[_0xa42d('0x7e'),0x0]))return _0x3f08eb;_0x188c23=[];var _0x3a92cc=_(_0x3ac739)[_0xa42d('0x2b')](function(_0x536857){if(_0x536857[_0xa42d('0x7e')]===0x1)return;return _0x536857[_0xa42d('0x2f')]===_0xa42d('0x27')?'agent':_0xa42d('0x29');})[_0xa42d('0x82')]()[_0xa42d('0x2c')]();for(var _0x4c52b9=0x0;_0x4c52b9<_0x3f08eb['length'];_0x4c52b9++){if(!_['includes'](_0x3a92cc,_0x3f08eb[_0x4c52b9][_0xa42d('0x2e')]))return;var _0x27c1b8=_0x3f08eb[_0x4c52b9][_0xa42d('0x2e')]===_0xa42d('0x1f')?_0xa42d('0x27'):_0xa42d('0x28');_0x188c23[_0xa42d('0x48')](db[_0xa42d('0x30')][_0xa42d('0x79')]({'name':_0x3f08eb[_0x4c52b9][_0xa42d('0x2f')],'resourceId':_0x3f08eb[_0x4c52b9]['id'],'type':_0x27c1b8,'sectionId':_[_0xa42d('0x59')](_0x3ac739,['name',_0x27c1b8])['id']},{}));}return Promise[_0xa42d('0x54')](_0x188c23);});})[_0xa42d('0x1e')](respondWithResult(_0x375798,0xc9))[_0xa42d('0x55')](handleError(_0x375798,null));};exports[_0xa42d('0x83')]=function(_0x10ecc0,_0x5c8ea2){if(_0x10ecc0[_0xa42d('0x5b')]['id']){delete _0x10ecc0['body']['id'];}return db['User'][_0xa42d('0x59')]({'where':{'id':_0x10ecc0['params']['id']}})[_0xa42d('0x1e')](function(_0x17891f){if(!_0x17891f)return null;if(_0x17891f['id']===_0x10ecc0[_0xa42d('0x26')]['id']){if(!_0x10ecc0[_0xa42d('0x5b')][_0xa42d('0x84')]||!_0x10ecc0['body'][_0xa42d('0x85')]){throw new db[(_0xa42d('0x86'))]['ValidationError'](_0xa42d('0x87'));}if(!_0x17891f[_0xa42d('0x88')](_0x10ecc0[_0xa42d('0x5b')][_0xa42d('0x84')])){throw new db[(_0xa42d('0x86'))]['ValidationError'](_0xa42d('0x89'));}if(_0x10ecc0[_0xa42d('0x5b')][_0xa42d('0x84')]===_0x10ecc0['body'][_0xa42d('0x85')]){throw new db[(_0xa42d('0x86'))][(_0xa42d('0x8a'))](_0xa42d('0x8b'));}}else if(_0x10ecc0[_0xa42d('0x26')][_0xa42d('0x2e')]===_0xa42d('0x24')){if(!_0x10ecc0[_0xa42d('0x5b')][_0xa42d('0x85')]){throw new db['Sequelize'][(_0xa42d('0x8a'))](_0xa42d('0x8c'));}}else if(_0x10ecc0[_0xa42d('0x26')][_0xa42d('0x2e')]===_0xa42d('0x26')){if(!_0x10ecc0[_0xa42d('0x5b')][_0xa42d('0x85')]){throw new db[(_0xa42d('0x86'))][(_0xa42d('0x8a'))](_0xa42d('0x8c'));}if(_0x17891f[_0xa42d('0x2e')]!==_0xa42d('0x1f')){throw new db[(_0xa42d('0x86'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0xa42d('0x86'))][(_0xa42d('0x8a'))](_0xa42d('0x80'));}return _0x17891f;})[_0xa42d('0x1e')](handleEntityNotFound(_0x5c8ea2,null))['then'](function(_0x3bc205){return db[_0xa42d('0x61')]['findOne']({'attributes':['id',_0xa42d('0x8d'),_0xa42d('0x8e'),_0xa42d('0x8f')]})[_0xa42d('0x1e')](function(_0x4060bd){if(_0x4060bd[_0xa42d('0x8d')])authService[_0xa42d('0x62')](_0x10ecc0[_0xa42d('0x5b')]['newPassword']);if(!_0x4060bd[_0xa42d('0x8e')]||!_0x3bc205[_0xa42d('0x3b')])return _0x3bc205;authService[_0xa42d('0x90')](_0x10ecc0[_0xa42d('0x5b')][_0xa42d('0x85')],_0x3bc205[_0xa42d('0x3b')],_0x4060bd['passwordHistoryLimit']);return _0x3bc205;})[_0xa42d('0x1e')](saveUpdates({'password':_0x10ecc0[_0xa42d('0x5b')][_0xa42d('0x85')],'passwordResetAt':_0x10ecc0['user']['id']==_0x10ecc0[_0xa42d('0x57')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x10ecc0[_0xa42d('0x5b')]['newPassword'],_0x3bc205[_0xa42d('0x3b')])},null));})[_0xa42d('0x1e')](respondWithResult(_0x5c8ea2,null))[_0xa42d('0x55')](handleError(_0x5c8ea2,null));};exports[_0xa42d('0x91')]=function(_0x17cd02,_0x453023){var _0x1c6e73=_0x17cd02[_0xa42d('0x5b')][_0xa42d('0x92')];return db['User'][_0xa42d('0x59')]({'where':{'id':_0x17cd02['params']['id']},'attributes':['id',_0xa42d('0x2f'),'role','online',_0xa42d('0x93'),_0xa42d('0x94'),_0xa42d('0x95')]})[_0xa42d('0x1e')](handleEntityNotFound(_0x453023,null))[_0xa42d('0x1e')](function(_0x188d50){if(_0x188d50){if(!utils[_0xa42d('0x96')](_0x1c6e73)){throw new db[(_0xa42d('0x86'))][(_0xa42d('0x8a'))](_0xa42d('0x97'));}return _0x188d50[_0xa42d('0x98')+_[_0xa42d('0x99')](_0x1c6e73[_0xa42d('0x9a')]())+_0xa42d('0x9b')](_0x17cd02[_0xa42d('0x5b')][_0xa42d('0x5e')],{'penalty':_0x17cd02[_0xa42d('0x5b')][_0xa42d('0x9c')]||0x0})[_0xa42d('0x9d')](function(_0x3f1d5d){for(var _0x2a7475=0x0;_0x2a7475<_0x17cd02[_0xa42d('0x5b')][_0xa42d('0x5e')][_0xa42d('0x4d')];_0x2a7475+=0x1){var _0x121480={'UserId':Number(_0x17cd02[_0xa42d('0x57')]['id'])};_0x121480[_[_0xa42d('0x99')](_0x1c6e73[_0xa42d('0x9a')]())+_0xa42d('0x9e')]=Number(_0x17cd02[_0xa42d('0x5b')][_0xa42d('0x5e')][_0x2a7475]);socket[_0xa42d('0x20')](_0xa42d('0x26')+_[_0xa42d('0x99')](_0x1c6e73[_0xa42d('0x9a')]())+_0xa42d('0x9f'),_0x121480);}return _0x3f1d5d;})['then'](function(){if(_0x1c6e73===_0xa42d('0xa0')){return db['VoiceQueue'][_0xa42d('0x49')]({'where':{'id':_0x17cd02[_0xa42d('0x5b')][_0xa42d('0x5e')]||[]},'raw':!![],'attributes':['id',_0xa42d('0x2f')]});}})[_0xa42d('0x1e')](function(_0x231822){var _0x73dddc=_0x188d50[_0xa42d('0x23')]({'plain':!![]});var _0x3b91a=[];if(_0x1c6e73===_0xa42d('0xa0')&&_0x73dddc[_0xa42d('0x2e')]==='agent'&&_0x73dddc[_0xa42d('0xa1')]){for(let _0x1870b9=0x0;_0x1870b9<_0x231822[_0xa42d('0x4d')];_0x1870b9+=0x1){_0x3b91a[_0xa42d('0x48')]({'membername':_0x73dddc[_0xa42d('0x2f')],'UserId':_0x73dddc['id'],'queue_name':_0x231822[_0x1870b9]['name'],'VoiceQueueId':_0x231822[_0x1870b9]['id'],'interface':_[_0xa42d('0x63')](_0x73dddc[_0xa42d('0x95')])?util[_0xa42d('0xa2')](_0xa42d('0xa3'),_0x73dddc[_0xa42d('0x2f')]):_0x73dddc[_0xa42d('0x95')],'paused':_0x73dddc['voicePause']||![],'penalty':_0x17cd02[_0xa42d('0x5b')][_0xa42d('0x9c')]||0x0});}return Promise[_0xa42d('0x54')](_0x3b91a['map'](function(_0x5093a9){return db['UserVoiceQueueRt'][_0xa42d('0xa4')](_0x5093a9);}));}return _0x188d50;});}})[_0xa42d('0x1e')](respondWithStatusCode(_0x453023,null))['catch'](handleError(_0x453023,null));};exports[_0xa42d('0xa5')]=function(_0x5ebd95,_0x553a59){var _0x2b6d79,_0x295360;return db['User'][_0xa42d('0x59')]({'where':{'id':_0x5ebd95[_0xa42d('0x57')]['id']},'attributes':['id',_0xa42d('0x2f'),_0xa42d('0x2e')]})[_0xa42d('0x1e')](handleEntityNotFound(_0x553a59,null))[_0xa42d('0x1e')](function(_0x136a56){if(_0x136a56){_0x2b6d79=_0x136a56;if(!_0x5ebd95[_0xa42d('0x44')][_0xa42d('0x92')]||!utils[_0xa42d('0x96')](_0x5ebd95['query'][_0xa42d('0x92')])){throw new db[(_0xa42d('0x86'))]['ValidationError'](_0xa42d('0x97'));}return _0x136a56['remove'+_[_0xa42d('0x99')](_0x5ebd95[_0xa42d('0x44')]['channel'][_0xa42d('0x9a')]())+_0xa42d('0x9b')](_0x5ebd95[_0xa42d('0x44')]['ids']);}})[_0xa42d('0x1e')](function(_0x3cbe91){if(_['isArray'](_0x5ebd95[_0xa42d('0x44')][_0xa42d('0x5e')])){for(var _0x123276=0x0;_0x123276<_0x5ebd95[_0xa42d('0x44')]['ids'][_0xa42d('0x4d')];_0x123276+=0x1){_0x295360={'UserId':Number(_0x5ebd95[_0xa42d('0x57')]['id'])};_0x295360[_[_0xa42d('0x99')](_0x5ebd95[_0xa42d('0x44')]['channel'][_0xa42d('0x9a')]())+_0xa42d('0x9e')]=Number(_0x5ebd95[_0xa42d('0x44')]['ids'][_0x123276]);socket[_0xa42d('0x20')](_0xa42d('0x26')+_['capitalize'](_0x5ebd95['query']['channel'][_0xa42d('0x9a')]())+'Queue:remove',_0x295360);}}else{_0x295360={'UserId':Number(_0x5ebd95[_0xa42d('0x57')]['id'])};_0x295360[_[_0xa42d('0x99')](_0x5ebd95['query']['channel'][_0xa42d('0x9a')]())+_0xa42d('0x9e')]=Number(_0x5ebd95[_0xa42d('0x44')]['ids']);socket[_0xa42d('0x20')]('user'+_['capitalize'](_0x5ebd95['query'][_0xa42d('0x92')]['toLowerCase']())+_0xa42d('0xa6'),_0x295360);}return _0x3cbe91;})[_0xa42d('0x1e')](function(){if(_0x5ebd95[_0xa42d('0x44')][_0xa42d('0x92')]===_0xa42d('0xa0')){return db['UserVoiceQueueRt'][_0xa42d('0x22')]({'where':{'UserId':_0x5ebd95[_0xa42d('0x57')]['id'],'VoiceQueueId':_0x5ebd95[_0xa42d('0x44')][_0xa42d('0x5e')]},'individualHooks':!![]})['then'](function(){return _0x2b6d79;});}return _0x2b6d79;})[_0xa42d('0x1e')](respondWithStatusCode(_0x553a59,null))[_0xa42d('0x55')](handleError(_0x553a59,null));};exports[_0xa42d('0xa7')]=function(_0xdd654e,_0x26cbb7){_0xdd654e[_0xa42d('0x5b')]['userpic']=_0xdd654e[_0xa42d('0xa8')][_0xa42d('0xa9')];return db[_0xa42d('0x41')][_0xa42d('0x59')]({'where':{'id':_0xdd654e['params']['id']}})['then'](handleEntityNotFound(_0x26cbb7,null))['then'](saveUpdates(_0xdd654e[_0xa42d('0x5b')],null))[_0xa42d('0x1e')](respondWithResult(_0x26cbb7,null))[_0xa42d('0x55')](handleError(_0x26cbb7,null));};exports['getAvatar']=function(_0x5ac62a,_0x178aea){var _0x508252=path['join'](config[_0xa42d('0xaa')],_0xa42d('0xab'));return db[_0xa42d('0x41')][_0xa42d('0x59')]({'where':{'id':_0x5ac62a['params']['id']},'attributes':['id',_0xa42d('0xac')],'raw':!![]})['then'](handleEntityNotFound(_0x178aea,null))[_0xa42d('0x1e')](function(_0x328863){if(_0x328863){if(_[_0xa42d('0x63')](_0x328863['userpic'])){return _0x178aea[_0xa42d('0xad')](_0x508252);}else{if(!fs['existsSync'](path[_0xa42d('0xae')](config[_0xa42d('0xaa')],_0xa42d('0xaf'),_0x328863[_0xa42d('0xac')]))){return _0x178aea['download'](_0x508252);}return _0x178aea[_0xa42d('0xad')](path[_0xa42d('0xae')](config[_0xa42d('0xaa')],_0xa42d('0xaf'),_0x328863[_0xa42d('0xac')]));}}})[_0xa42d('0x55')](handleError(_0x178aea,null));};exports[_0xa42d('0xb0')]=function(_0x1ce8e3,_0x2e1751){return db[_0xa42d('0x41')][_0xa42d('0x59')]({'where':{'id':_0x1ce8e3[_0xa42d('0x57')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x2e1751,null))['then'](function(_0xf6432e){var _0x443d6d=[];values=_0xf6432e[_0xa42d('0x4f')];_0x443d6d['push'](get_open_tabs(_0xa42d('0x4e'),_0xf6432e[_0xa42d('0x4f')]));_0x443d6d['push'](get_open_tabs('sms',_0xf6432e[_0xa42d('0x4f')]));_0x443d6d['push'](get_open_tabs(_0xa42d('0x52'),_0xf6432e[_0xa42d('0x4f')]));_0x443d6d[_0xa42d('0x48')](get_open_tabs('whatsapp',_0xf6432e[_0xa42d('0x4f')]));_0x443d6d[_0xa42d('0x48')](get_open_tabs('fax',_0xf6432e[_0xa42d('0x4f')]));_0x443d6d[_0xa42d('0x48')](get_open_tabs(_0xa42d('0x51'),_0xf6432e[_0xa42d('0x4f')]));return Promise['all'](_0x443d6d);})[_0xa42d('0x1e')](function(_0x4b8b2a){if(_0x4b8b2a){var _0x414e0d=_[_0xa42d('0x2b')](values['ChatOpenTabs'],function(_0x3c4774){return{'channel':_0xa42d('0xb1'),'id':_0x3c4774['id'],'createdAt':_0x3c4774[_0xa42d('0xb2')]};});var _0x16c704=_[_0xa42d('0x2b')](values['FaxOpenTabs'],function(_0x111401){return{'channel':_0xa42d('0xb3'),'id':_0x111401['id'],'createdAt':_0x111401[_0xa42d('0xb2')]};});var _0x257f87=_[_0xa42d('0x2b')](values[_0xa42d('0xb4')],function(_0x2052c6){return{'channel':_0xa42d('0xb5'),'id':_0x2052c6['id'],'createdAt':_0x2052c6['createdAt']};});var _0x2e6e6e=_[_0xa42d('0x2b')](values[_0xa42d('0xb6')],function(_0x48c409){return{'channel':_0xa42d('0xb7'),'id':_0x48c409['id'],'createdAt':_0x48c409[_0xa42d('0xb2')]};});var _0x5a36b4=_[_0xa42d('0x2b')](values[_0xa42d('0xb8')],function(_0x5da7d1){return{'channel':'SMS','id':_0x5da7d1['id'],'createdAt':_0x5da7d1[_0xa42d('0xb2')]};});var _0xa6c83b=_[_0xa42d('0x2b')](values[_0xa42d('0xb9')],function(_0x37e45f){return{'channel':_0xa42d('0xba'),'id':_0x37e45f['id'],'createdAt':_0x37e45f[_0xa42d('0xb2')]};});var _0x133469=_['concat'](_0x414e0d,_0x16c704,_0x257f87,_0x2e6e6e,_0x5a36b4,_0xa6c83b);var _0x46f156={'count':_0x133469['length'],'rows':_0x133469};return _0x46f156;}else return null;})[_0xa42d('0x1e')](respondWithResult(_0x2e1751,null))[_0xa42d('0x55')](handleError(_0x2e1751,null));};exports[_0xa42d('0xbb')]=function(_0x140115,_0x128a0e){var _0x27ef2b={};return db['User'][_0xa42d('0xbc')]({'where':{'id':_0x140115[_0xa42d('0x57')]['id']}})['then'](function(_0x261a13){if(!_0x261a13){throw new APINotFoundError(util[_0xa42d('0xa2')](_0xa42d('0xbd'),_0x140115[_0xa42d('0x57')]['id']));}return contacts[_0xa42d('0x5c')]();})[_0xa42d('0x1e')](function(_0x4a5f5e){_0x140115['query'][_0xa42d('0x41')]=_0x140115[_0xa42d('0x57')]['id'];_0x27ef2b=qs[_0xa42d('0x3f')](_0x4a5f5e,_0x140115);if(_0x140115[_0xa42d('0x44')][_0xa42d('0xbe')](_0xa42d('0x42'))){_0x27ef2b[_0xa42d('0x43')]=[{'model':db['CmList'],'as':_0xa42d('0xbf'),'required':![]},{'model':db[_0xa42d('0xc0')],'as':_0xa42d('0xc1'),'attributes':['id',_0xa42d('0x2f'),_0xa42d('0xc2')],'where':_0x140115[_0xa42d('0x44')][_0xa42d('0xc3')]?{'id':_0x140115[_0xa42d('0x44')][_0xa42d('0xc3')]}:undefined,'required':_0x140115[_0xa42d('0x44')][_0xa42d('0xc3')]?!![]:![]}];}return contacts[_0xa42d('0x49')](_0x140115['query'],_0x140115['user'],_0x27ef2b,_0x4a5f5e);})[_0xa42d('0x1e')](respondWithFilteredResult(_0x128a0e,_0x27ef2b))[_0xa42d('0x55')](APIHandleError(_0x128a0e));};exports[_0xa42d('0xc4')]=function(_0x16d908,_0x48f3a3){var _0x2b9414;var _0x59e380={};var _0x486740;return db['User'][_0xa42d('0xbc')]({'where':{'id':_0x16d908[_0xa42d('0x57')]['id']},'attributes':['id',_0xa42d('0x2f'),_0xa42d('0x2e')]})[_0xa42d('0x1e')](handleEntityNotFound(_0x48f3a3,null))['then'](function(_0x57fc35){if(!utils['isValidChannel'](_0x16d908[_0xa42d('0x44')][_0xa42d('0x92')])){throw new db[(_0xa42d('0x86'))][(_0xa42d('0x8a'))](_0xa42d('0x97'));}_0x2b9414=_0x57fc35;var _0x2b73b1={};_0x2b73b1[_0xa42d('0xc5')]=_[_0xa42d('0xc6')](db[_[_0xa42d('0x99')](_0x16d908[_0xa42d('0x44')][_0xa42d('0x92')])+_0xa42d('0xc7')][_0xa42d('0x35')]);_0x2b73b1[_0xa42d('0x44')]=_[_0xa42d('0xc6')](_0x16d908['query']);_0x2b73b1[_0xa42d('0xc8')]=_[_0xa42d('0xc9')](_0x2b73b1[_0xa42d('0xc5')],_0x2b73b1['query']);_0x59e380[_0xa42d('0x47')]=_[_0xa42d('0xc9')](_0x2b73b1['model'],qs[_0xa42d('0xca')](_0x16d908[_0xa42d('0x44')]['fields']));_0x59e380[_0xa42d('0x47')]=_0x59e380[_0xa42d('0x47')][_0xa42d('0x4d')]?_0x59e380['attributes']:_0x2b73b1[_0xa42d('0xc5')];_0x59e380[_0xa42d('0xcb')]=qs['sort'](_0x16d908[_0xa42d('0x44')][_0xa42d('0xcc')]);_0x59e380[_0xa42d('0x40')]=qs[_0xa42d('0xc8')](_[_0xa42d('0xcd')](_0x16d908[_0xa42d('0x44')],_0x2b73b1[_0xa42d('0xc8')]));if(_0x16d908[_0xa42d('0x44')]['filter']){_0x59e380[_0xa42d('0x40')]=_['merge'](_0x59e380[_0xa42d('0x40')],{'$or':_[_0xa42d('0x2b')](_0x59e380[_0xa42d('0x47')],function(_0x106167){var _0x443453={};_0x443453[_0x106167]={'$like':'%'+_0x16d908[_0xa42d('0x44')][_0xa42d('0x38')]+'%'};return _0x443453;})});}_0x59e380=_[_0xa42d('0xce')]({},_0x59e380,_0x16d908['options']);switch(_0x2b9414['role']){case _0xa42d('0x24'):return db[_[_0xa42d('0x99')](_0x16d908[_0xa42d('0x44')][_0xa42d('0x92')])+'Queue'][_0xa42d('0x49')](_0x59e380);case _0xa42d('0x26'):case'agent':return _0x2b9414[_0xa42d('0x23')+_[_0xa42d('0x99')](_0x16d908[_0xa42d('0x44')][_0xa42d('0x92')])+_0xa42d('0x9b')](_0x59e380);default:throw new db[(_0xa42d('0x86'))]['ValidationError']('Unknown\x20role');}})[_0xa42d('0x1e')](function(_0x2ee127){_0x486740=_0x2ee127[_0xa42d('0x4d')];if(!_0x16d908[_0xa42d('0x44')][_0xa42d('0xbe')](_0xa42d('0xcf'))){_0x59e380['limit']=qs[_0xa42d('0x18')](_0x16d908[_0xa42d('0x44')][_0xa42d('0x18')]);_0x59e380['offset']=qs[_0xa42d('0x17')](_0x16d908[_0xa42d('0x44')][_0xa42d('0x17')]);}switch(_0x2b9414[_0xa42d('0x2e')]){case _0xa42d('0x24'):return db[_['capitalize'](_0x16d908['query'][_0xa42d('0x92')])+_0xa42d('0xc7')][_0xa42d('0x49')](_0x59e380);case _0xa42d('0x26'):case _0xa42d('0x1f'):return _0x2b9414[_0xa42d('0x23')+_[_0xa42d('0x99')](_0x16d908['query']['channel'])+'Queues'](_0x59e380);}})['then'](function(_0x30403b){return{'count':_0x486740,'rows':_0x30403b};})[_0xa42d('0x1e')](respondWithResult(_0x48f3a3,null))[_0xa42d('0x55')](handleError(_0x48f3a3,null));};exports[_0xa42d('0xd0')]=function(_0x5e37b2,_0x1b8d97){var _0x554833={};var _0x4c6c4b={};var _0x3baf9b;var _0x21129f;return db[_0xa42d('0x41')][_0xa42d('0xbc')]({'where':{'id':_0x5e37b2[_0xa42d('0x57')]['id']}})['then'](handleEntityNotFound(_0x1b8d97,null))['then'](function(_0x15fd51){if(_0x15fd51){_0x3baf9b=_0x15fd51;_0x4c6c4b[_0xa42d('0xc5')]=_[_0xa42d('0xc6')](db['UserVoiceQueueRt'][_0xa42d('0x35')]);_0x4c6c4b[_0xa42d('0x44')]=_[_0xa42d('0xc6')](_0x5e37b2[_0xa42d('0x44')]);_0x4c6c4b[_0xa42d('0xc8')]=_['intersection'](_0x4c6c4b[_0xa42d('0xc5')],_0x4c6c4b['query']);_0x554833[_0xa42d('0x47')]=_['intersection'](_0x4c6c4b[_0xa42d('0xc5')],qs['fields'](_0x5e37b2[_0xa42d('0x44')]['fields']));_0x554833[_0xa42d('0x47')]=_0x554833[_0xa42d('0x47')]['length']?_0x554833[_0xa42d('0x47')]:_0x4c6c4b[_0xa42d('0xc5')];_0x554833['order']=qs[_0xa42d('0xcc')](_0x5e37b2[_0xa42d('0x44')][_0xa42d('0xcc')]);_0x554833[_0xa42d('0x40')]=qs[_0xa42d('0xc8')](_[_0xa42d('0xcd')](_0x5e37b2[_0xa42d('0x44')],_0x4c6c4b[_0xa42d('0xc8')]));if(_0x5e37b2[_0xa42d('0x44')][_0xa42d('0x38')]){_0x554833[_0xa42d('0x40')]=_[_0xa42d('0xce')](_0x554833[_0xa42d('0x40')],{'$or':_[_0xa42d('0x2b')](_0x554833[_0xa42d('0x47')],function(_0xdcbf72){var _0x2ea8ee={};_0x2ea8ee[_0xdcbf72]={'$like':'%'+_0x5e37b2[_0xa42d('0x44')][_0xa42d('0x38')]+'%'};return _0x2ea8ee;})});}_0x554833=_['merge']({},_0x554833,_0x5e37b2['options']);return _0x3baf9b[_0xa42d('0xd0')](_0x554833);}})['then'](function(_0x796b19){if(_0x796b19){_0x21129f=_0x796b19[_0xa42d('0x4d')];if(!_0x5e37b2[_0xa42d('0x44')][_0xa42d('0xbe')]('nolimit')){_0x554833[_0xa42d('0x18')]=qs[_0xa42d('0x18')](_0x5e37b2['query'][_0xa42d('0x18')]);_0x554833[_0xa42d('0x17')]=qs[_0xa42d('0x17')](_0x5e37b2[_0xa42d('0x44')]['offset']);}return _0x3baf9b[_0xa42d('0xd0')](_0x554833);}})[_0xa42d('0x1e')](function(_0x24f0cc){if(_0x24f0cc){return _0x24f0cc?{'count':_0x21129f,'rows':_0x24f0cc}:null;}})[_0xa42d('0x1e')](respondWithResult(_0x1b8d97,null))[_0xa42d('0x55')](handleError(_0x1b8d97,null));};exports[_0xa42d('0xd1')]=function(_0x59fbc6,_0x2da4c8){var _0x546ce7={};var _0x1b1ab6={};var _0x400faa;var _0x581ffc;return db[_0xa42d('0x41')][_0xa42d('0xbc')]({'where':{'id':_0x59fbc6[_0xa42d('0x57')]['id']}})[_0xa42d('0x1e')](handleEntityNotFound(_0x2da4c8,null))[_0xa42d('0x1e')](function(_0x51269b){if(_0x51269b){_0x400faa=_0x51269b;_0x1b1ab6[_0xa42d('0xc5')]=_[_0xa42d('0xc6')](db[_0xa42d('0xd2')][_0xa42d('0x35')]);_0x1b1ab6[_0xa42d('0x44')]=_['keys'](_0x59fbc6[_0xa42d('0x44')]);_0x1b1ab6[_0xa42d('0xc8')]=_[_0xa42d('0xc9')](_0x1b1ab6[_0xa42d('0xc5')],_0x1b1ab6[_0xa42d('0x44')]);_0x546ce7['attributes']=_[_0xa42d('0xc9')](_0x1b1ab6[_0xa42d('0xc5')],qs[_0xa42d('0xca')](_0x59fbc6[_0xa42d('0x44')]['fields']));_0x546ce7[_0xa42d('0x47')]=_0x546ce7[_0xa42d('0x47')][_0xa42d('0x4d')]?_0x546ce7['attributes']:_0x1b1ab6[_0xa42d('0xc5')];_0x546ce7[_0xa42d('0xcb')]=qs['sort'](_0x59fbc6['query']['sort']);_0x546ce7[_0xa42d('0x40')]=qs['filters'](_[_0xa42d('0xcd')](_0x59fbc6['query'],_0x1b1ab6[_0xa42d('0xc8')]));if(_0x59fbc6['query'][_0xa42d('0x38')]){_0x546ce7[_0xa42d('0x40')]=_[_0xa42d('0xce')](_0x546ce7['where'],{'$or':_['map'](_0x546ce7[_0xa42d('0x47')],function(_0x1f18cb){var _0x559028={};_0x559028[_0x1f18cb]={'$like':'%'+_0x59fbc6[_0xa42d('0x44')][_0xa42d('0x38')]+'%'};return _0x559028;})});}_0x546ce7=_['merge']({},_0x546ce7,_0x59fbc6[_0xa42d('0x58')]);return _0x400faa[_0xa42d('0xd1')](_0x546ce7);}})['then'](function(_0x53fbf1){if(_0x53fbf1){_0x581ffc=_0x53fbf1[_0xa42d('0x4d')];if(!_0x59fbc6[_0xa42d('0x44')][_0xa42d('0xbe')](_0xa42d('0xcf'))){_0x546ce7['limit']=qs[_0xa42d('0x18')](_0x59fbc6[_0xa42d('0x44')][_0xa42d('0x18')]);_0x546ce7[_0xa42d('0x17')]=qs[_0xa42d('0x17')](_0x59fbc6[_0xa42d('0x44')]['offset']);}return _0x400faa[_0xa42d('0xd1')](_0x546ce7);}})[_0xa42d('0x1e')](function(_0x4996eb){if(_0x4996eb){return _0x4996eb?{'count':_0x581ffc,'rows':_0x4996eb}:null;}})[_0xa42d('0x1e')](respondWithResult(_0x2da4c8,null))[_0xa42d('0x55')](handleError(_0x2da4c8,null));};exports[_0xa42d('0xd3')]=function(_0x3b0635,_0xf45d83){var _0x59950c={'raw':!![],'where':{}};var _0xd216d8={};var _0x4e6829={'count':0x0,'rows':[]};return db[_0xa42d('0x41')]['findOne']({'where':{'id':_0x3b0635['params']['id']}})[_0xa42d('0x1e')](handleEntityNotFound(_0xf45d83,null))[_0xa42d('0x1e')](function(_0x2875e2){if(_0x2875e2){_0xd216d8[_0xa42d('0xc5')]=_[_0xa42d('0xc6')](db['VoiceRecording'][_0xa42d('0x35')]);_0xd216d8[_0xa42d('0x44')]=_['keys'](_0x3b0635[_0xa42d('0x44')]);_0xd216d8[_0xa42d('0xc8')]=_[_0xa42d('0xc9')](_0xd216d8[_0xa42d('0xc5')],_0xd216d8[_0xa42d('0x44')]);_0x59950c[_0xa42d('0x47')]=_[_0xa42d('0xc9')](_0xd216d8[_0xa42d('0xc5')],qs[_0xa42d('0xca')](_0x3b0635[_0xa42d('0x44')][_0xa42d('0xca')]));_0x59950c['attributes']=_0x59950c[_0xa42d('0x47')][_0xa42d('0x4d')]?_0x59950c[_0xa42d('0x47')]:_0xd216d8[_0xa42d('0xc5')];if(!_0x3b0635[_0xa42d('0x44')]['hasOwnProperty']('nolimit')){_0x59950c[_0xa42d('0x18')]=qs[_0xa42d('0x18')](_0x3b0635['query'][_0xa42d('0x18')]);_0x59950c[_0xa42d('0x17')]=qs[_0xa42d('0x17')](_0x3b0635['query'][_0xa42d('0x17')]);}_0x59950c[_0xa42d('0xcb')]=qs[_0xa42d('0xcc')](_0x3b0635['query'][_0xa42d('0xcc')]);_0x59950c[_0xa42d('0x40')]=qs[_0xa42d('0xc8')](_[_0xa42d('0xcd')](_0x3b0635[_0xa42d('0x44')],_0xd216d8[_0xa42d('0xc8')]));_0x59950c[_0xa42d('0x40')][_0xa42d('0xd4')]=_0x2875e2['id'];if(_0x3b0635[_0xa42d('0x44')]['filter']){_0x59950c[_0xa42d('0x40')]=_[_0xa42d('0xce')](_0x59950c[_0xa42d('0x40')],{'$or':_[_0xa42d('0x2b')](_0x59950c[_0xa42d('0x47')],function(_0xeab686){var _0x131a2a={};_0x131a2a[_0xeab686]={'$like':'%'+_0x3b0635[_0xa42d('0x44')]['filter']+'%'};return _0x131a2a;})});}_0x59950c=_[_0xa42d('0xce')]({},_0x59950c,_0x3b0635[_0xa42d('0x58')]);return db[_0xa42d('0xd5')][_0xa42d('0x1a')]({'where':_0x59950c['where']})[_0xa42d('0x1e')](function(_0x378de5){_0x4e6829[_0xa42d('0x1a')]=_0x378de5;if(_0x3b0635[_0xa42d('0x44')][_0xa42d('0x42')]){_0x59950c[_0xa42d('0x43')]=[{'all':!![]}];}return db[_0xa42d('0xd5')][_0xa42d('0x49')](_0x59950c);})['then'](function(_0x49f8a0){_0x4e6829[_0xa42d('0x4a')]=_0x49f8a0;return _0x4e6829;});}})[_0xa42d('0x1e')](respondWithFilteredResult(_0xf45d83,_0x59950c))[_0xa42d('0x55')](handleError(_0xf45d83,null));};exports['getScreenRecordings']=function(_0x204d3a,_0x5e6326){var _0x330e10={'raw':!![],'where':{}};var _0x44bd54={};var _0x2d4660={'count':0x0,'rows':[]};return db[_0xa42d('0x41')][_0xa42d('0xbc')]({'where':{'id':_0x204d3a['params']['id']}})[_0xa42d('0x1e')](handleEntityNotFound(_0x5e6326,null))['then'](function(_0x57bbe9){if(_0x57bbe9){_0x44bd54[_0xa42d('0xc5')]=_[_0xa42d('0xc6')](db['ScreenRecording'][_0xa42d('0x35')]);_0x44bd54['query']=_[_0xa42d('0xc6')](_0x204d3a['query']);_0x44bd54[_0xa42d('0xc8')]=_['intersection'](_0x44bd54[_0xa42d('0xc5')],_0x44bd54[_0xa42d('0x44')]);_0x330e10['attributes']=_['intersection'](_0x44bd54[_0xa42d('0xc5')],qs[_0xa42d('0xca')](_0x204d3a[_0xa42d('0x44')]['fields']));_0x330e10['attributes']=_0x330e10[_0xa42d('0x47')]['length']?_0x330e10[_0xa42d('0x47')]:_0x44bd54[_0xa42d('0xc5')];if(!_0x204d3a[_0xa42d('0x44')]['hasOwnProperty'](_0xa42d('0xcf'))){_0x330e10['limit']=qs[_0xa42d('0x18')](_0x204d3a[_0xa42d('0x44')]['limit']);_0x330e10[_0xa42d('0x17')]=qs[_0xa42d('0x17')](_0x204d3a[_0xa42d('0x44')]['offset']);}_0x330e10[_0xa42d('0xcb')]=qs[_0xa42d('0xcc')](_0x204d3a['query'][_0xa42d('0xcc')]);_0x330e10[_0xa42d('0x40')]=qs[_0xa42d('0xc8')](_[_0xa42d('0xcd')](_0x204d3a[_0xa42d('0x44')],_0x44bd54['filters']));_0x330e10[_0xa42d('0x40')][_0xa42d('0xd4')]=_0x57bbe9['id'];if(_0x204d3a[_0xa42d('0x44')]['filter']){_0x330e10[_0xa42d('0x40')]=_[_0xa42d('0xce')](_0x330e10[_0xa42d('0x40')],{'$or':_[_0xa42d('0x2b')](_0x330e10[_0xa42d('0x47')],function(_0x53a16f){var _0x3a51a={};_0x3a51a[_0x53a16f]={'$like':'%'+_0x204d3a[_0xa42d('0x44')]['filter']+'%'};return _0x3a51a;})});}_0x330e10=_[_0xa42d('0xce')]({},_0x330e10,_0x204d3a['options']);return db[_0xa42d('0xd6')][_0xa42d('0x1a')]({'where':_0x330e10['where']})['then'](function(_0x229184){_0x2d4660[_0xa42d('0x1a')]=_0x229184;if(_0x204d3a[_0xa42d('0x44')][_0xa42d('0x42')]){_0x330e10[_0xa42d('0x43')]=[{'all':!![]}];}return db[_0xa42d('0xd6')]['findAll'](_0x330e10);})[_0xa42d('0x1e')](function(_0x5b2621){_0x2d4660[_0xa42d('0x4a')]=_0x5b2621;return _0x2d4660;});}})[_0xa42d('0x1e')](respondWithFilteredResult(_0x5e6326,_0x330e10))[_0xa42d('0x55')](handleError(_0x5e6326,null));};exports[_0xa42d('0xd7')]=function(_0xca7466,_0x4e39c8){var _0x507140={};var _0x3e45d6={};var _0x1db3ac;var _0x6a3ff0;return db[_0xa42d('0x41')][_0xa42d('0xbc')]({'where':{'id':_0xca7466[_0xa42d('0x57')]['id']}})[_0xa42d('0x1e')](handleEntityNotFound(_0x4e39c8,null))[_0xa42d('0x1e')](function(_0x267ad4){if(_0x267ad4){_0x1db3ac=_0x267ad4;_0x3e45d6[_0xa42d('0xc5')]=_[_0xa42d('0xc6')](db[_0xa42d('0xd8')]['rawAttributes']);_0x3e45d6[_0xa42d('0x44')]=_[_0xa42d('0xc6')](_0xca7466[_0xa42d('0x44')]);_0x3e45d6['filters']=_[_0xa42d('0xc9')](_0x3e45d6[_0xa42d('0xc5')],_0x3e45d6[_0xa42d('0x44')]);_0x507140[_0xa42d('0x47')]=_[_0xa42d('0xc9')](_0x3e45d6['model'],qs['fields'](_0xca7466[_0xa42d('0x44')]['fields']));_0x507140[_0xa42d('0x47')]=_0x507140[_0xa42d('0x47')][_0xa42d('0x4d')]?_0x507140[_0xa42d('0x47')]:_0x3e45d6[_0xa42d('0xc5')];_0x507140['order']=qs[_0xa42d('0xcc')](_0xca7466[_0xa42d('0x44')][_0xa42d('0xcc')]);_0x507140['where']=qs['filters'](_[_0xa42d('0xcd')](_0xca7466[_0xa42d('0x44')],_0x3e45d6[_0xa42d('0xc8')]));if(_0xca7466[_0xa42d('0x44')][_0xa42d('0x38')]){_0x507140[_0xa42d('0x40')]=_[_0xa42d('0xce')](_0x507140['where'],{'$or':_[_0xa42d('0x2b')](_0x507140[_0xa42d('0x47')],function(_0x4de04c){var _0x1bdbfb={};_0x1bdbfb[_0x4de04c]={'$like':'%'+_0xca7466[_0xa42d('0x44')][_0xa42d('0x38')]+'%'};return _0x1bdbfb;})});}_0x507140=_[_0xa42d('0xce')]({},_0x507140,_0xca7466[_0xa42d('0x58')]);return _0x1db3ac[_0xa42d('0xd7')](_0x507140);}})['then'](function(_0x3c813a){if(_0x3c813a){_0x6a3ff0=_0x3c813a['length'];if(!_0xca7466['query'][_0xa42d('0xbe')](_0xa42d('0xcf'))){_0x507140[_0xa42d('0x18')]=qs[_0xa42d('0x18')](_0xca7466[_0xa42d('0x44')][_0xa42d('0x18')]);_0x507140['offset']=qs[_0xa42d('0x17')](_0xca7466['query'][_0xa42d('0x17')]);}return _0x1db3ac[_0xa42d('0xd7')](_0x507140);}})['then'](function(_0x1adc2b){if(_0x1adc2b){return _0x1adc2b?{'count':_0x6a3ff0,'rows':_0x1adc2b}:null;}})[_0xa42d('0x1e')](respondWithResult(_0x4e39c8,null))[_0xa42d('0x55')](handleError(_0x4e39c8,null));};exports[_0xa42d('0xd9')]=function(_0x1d74ea,_0x1f5306){var _0x2881e7={};var _0x210c14={};var _0x28a401;var _0x25d6d7;return db[_0xa42d('0x41')][_0xa42d('0xbc')]({'where':{'id':_0x1d74ea['params']['id']}})['then'](handleEntityNotFound(_0x1f5306,null))[_0xa42d('0x1e')](function(_0x2ef545){if(_0x2ef545){_0x28a401=_0x2ef545;_0x210c14[_0xa42d('0xc5')]=_[_0xa42d('0xc6')](db[_0xa42d('0xda')][_0xa42d('0x35')]);_0x210c14['query']=_[_0xa42d('0xc6')](_0x1d74ea[_0xa42d('0x44')]);_0x210c14[_0xa42d('0xc8')]=_[_0xa42d('0xc9')](_0x210c14['model'],_0x210c14[_0xa42d('0x44')]);_0x2881e7[_0xa42d('0x47')]=_['intersection'](_0x210c14['model'],qs['fields'](_0x1d74ea['query']['fields']));_0x2881e7[_0xa42d('0x47')]=_0x2881e7['attributes'][_0xa42d('0x4d')]?_0x2881e7[_0xa42d('0x47')]:_0x210c14[_0xa42d('0xc5')];_0x2881e7[_0xa42d('0xcb')]=qs[_0xa42d('0xcc')](_0x1d74ea[_0xa42d('0x44')][_0xa42d('0xcc')]);_0x2881e7[_0xa42d('0x40')]=qs[_0xa42d('0xc8')](_['pick'](_0x1d74ea[_0xa42d('0x44')],_0x210c14[_0xa42d('0xc8')]));if(_0x1d74ea[_0xa42d('0x44')][_0xa42d('0x38')]){_0x2881e7[_0xa42d('0x40')]=_['merge'](_0x2881e7['where'],{'$or':_['map'](_0x2881e7[_0xa42d('0x47')],function(_0x4d3e0f){var _0x2e0a24={};_0x2e0a24[_0x4d3e0f]={'$like':'%'+_0x1d74ea[_0xa42d('0x44')][_0xa42d('0x38')]+'%'};return _0x2e0a24;})});}_0x2881e7=_[_0xa42d('0xce')]({},_0x2881e7,_0x1d74ea[_0xa42d('0x58')]);return _0x28a401[_0xa42d('0xd9')](_0x2881e7);}})[_0xa42d('0x1e')](function(_0x3c80a5){if(_0x3c80a5){_0x25d6d7=_0x3c80a5[_0xa42d('0x4d')];if(!_0x1d74ea['query']['hasOwnProperty']('nolimit')){_0x2881e7[_0xa42d('0x18')]=qs[_0xa42d('0x18')](_0x1d74ea[_0xa42d('0x44')][_0xa42d('0x18')]);_0x2881e7[_0xa42d('0x17')]=qs[_0xa42d('0x17')](_0x1d74ea[_0xa42d('0x44')][_0xa42d('0x17')]);}return _0x28a401['getOpenchannelInteractions'](_0x2881e7);}})[_0xa42d('0x1e')](function(_0x1bfe9e){if(_0x1bfe9e){return _0x1bfe9e?{'count':_0x25d6d7,'rows':_0x1bfe9e}:null;}})['then'](respondWithResult(_0x1f5306,null))[_0xa42d('0x55')](handleError(_0x1f5306,null));};exports[_0xa42d('0xdb')]=function(_0x4d7622,_0x52cc1d){var _0x33d1a0={'raw':!![],'where':{}};var _0x4328d3={};var _0x2f7b3f={'count':0x0,'rows':[]};return db[_0xa42d('0x41')][_0xa42d('0xbc')]({'where':{'id':_0x4d7622['params']['id']}})[_0xa42d('0x1e')](handleEntityNotFound(_0x52cc1d,null))[_0xa42d('0x1e')](function(_0x510556){if(_0x510556){_0x4328d3[_0xa42d('0xc5')]=_[_0xa42d('0xc6')](db[_0xa42d('0xdc')]['rawAttributes']);_0x4328d3['query']=_[_0xa42d('0xc6')](_0x4d7622[_0xa42d('0x44')]);_0x4328d3['filters']=_[_0xa42d('0xc9')](_0x4328d3['model'],_0x4328d3[_0xa42d('0x44')]);_0x33d1a0['attributes']=_[_0xa42d('0xc9')](_0x4328d3[_0xa42d('0xc5')],qs['fields'](_0x4d7622[_0xa42d('0x44')]['fields']));_0x33d1a0[_0xa42d('0x47')]=_0x33d1a0[_0xa42d('0x47')][_0xa42d('0x4d')]?_0x33d1a0[_0xa42d('0x47')]:_0x4328d3['model'];if(!_0x4d7622[_0xa42d('0x44')]['hasOwnProperty'](_0xa42d('0xcf'))){_0x33d1a0[_0xa42d('0x18')]=qs[_0xa42d('0x18')](_0x4d7622['query'][_0xa42d('0x18')]);_0x33d1a0['offset']=qs[_0xa42d('0x17')](_0x4d7622[_0xa42d('0x44')][_0xa42d('0x17')]);}_0x33d1a0[_0xa42d('0xcb')]=qs['sort'](_0x4d7622[_0xa42d('0x44')][_0xa42d('0xcc')]);_0x33d1a0[_0xa42d('0x40')]=qs[_0xa42d('0xc8')](_[_0xa42d('0xcd')](_0x4d7622[_0xa42d('0x44')],_0x4328d3['filters']));_0x33d1a0[_0xa42d('0x40')][_0xa42d('0xd4')]=_0x510556['id'];if(_0x4d7622['query'][_0xa42d('0x38')]){_0x33d1a0[_0xa42d('0x40')]=_['merge'](_0x33d1a0['where'],{'$or':_['map'](_0x33d1a0[_0xa42d('0x47')],function(_0x2cdf52){var _0x58f5bd={};_0x58f5bd[_0x2cdf52]={'$like':'%'+_0x4d7622[_0xa42d('0x44')]['filter']+'%'};return _0x58f5bd;})});}_0x33d1a0=_['merge']({},_0x33d1a0,_0x4d7622[_0xa42d('0x58')]);return db[_0xa42d('0xdc')]['count']({'where':_0x33d1a0[_0xa42d('0x40')]})['then'](function(_0xe7d9e0){_0x2f7b3f[_0xa42d('0x1a')]=_0xe7d9e0;if(_0x4d7622[_0xa42d('0x44')][_0xa42d('0x42')]){_0x33d1a0[_0xa42d('0x43')]=[{'all':!![]}];}return db[_0xa42d('0xdc')][_0xa42d('0x49')](_0x33d1a0);})[_0xa42d('0x1e')](function(_0x166f51){_0x2f7b3f['rows']=_0x166f51;return _0x2f7b3f;});}})[_0xa42d('0x1e')](respondWithFilteredResult(_0x52cc1d,_0x33d1a0))[_0xa42d('0x55')](handleError(_0x52cc1d,null));};exports[_0xa42d('0xdd')]=function(_0x19cc9d,_0x5a757a){var _0x1e27cf={};var _0x21b64e={};var _0x34964a;var _0x446fb3;return db[_0xa42d('0x41')][_0xa42d('0xbc')]({'where':{'id':_0x19cc9d[_0xa42d('0x57')]['id']}})[_0xa42d('0x1e')](handleEntityNotFound(_0x5a757a,null))[_0xa42d('0x1e')](function(_0x5d964d){if(_0x5d964d){_0x34964a=_0x5d964d;_0x21b64e[_0xa42d('0xc5')]=_[_0xa42d('0xc6')](db['SmsInteraction'][_0xa42d('0x35')]);_0x21b64e[_0xa42d('0x44')]=_['keys'](_0x19cc9d[_0xa42d('0x44')]);_0x21b64e[_0xa42d('0xc8')]=_[_0xa42d('0xc9')](_0x21b64e['model'],_0x21b64e[_0xa42d('0x44')]);_0x1e27cf[_0xa42d('0x47')]=_[_0xa42d('0xc9')](_0x21b64e['model'],qs[_0xa42d('0xca')](_0x19cc9d[_0xa42d('0x44')][_0xa42d('0xca')]));_0x1e27cf[_0xa42d('0x47')]=_0x1e27cf[_0xa42d('0x47')]['length']?_0x1e27cf['attributes']:_0x21b64e[_0xa42d('0xc5')];_0x1e27cf['order']=qs['sort'](_0x19cc9d[_0xa42d('0x44')][_0xa42d('0xcc')]);_0x1e27cf[_0xa42d('0x40')]=qs[_0xa42d('0xc8')](_['pick'](_0x19cc9d['query'],_0x21b64e['filters']));if(_0x19cc9d[_0xa42d('0x44')][_0xa42d('0x38')]){_0x1e27cf[_0xa42d('0x40')]=_[_0xa42d('0xce')](_0x1e27cf[_0xa42d('0x40')],{'$or':_[_0xa42d('0x2b')](_0x1e27cf[_0xa42d('0x47')],function(_0x57eef9){var _0x1809d3={};_0x1809d3[_0x57eef9]={'$like':'%'+_0x19cc9d[_0xa42d('0x44')][_0xa42d('0x38')]+'%'};return _0x1809d3;})});}_0x1e27cf=_[_0xa42d('0xce')]({},_0x1e27cf,_0x19cc9d[_0xa42d('0x58')]);return _0x34964a[_0xa42d('0xdd')](_0x1e27cf);}})[_0xa42d('0x1e')](function(_0x3f9fe9){if(_0x3f9fe9){_0x446fb3=_0x3f9fe9[_0xa42d('0x4d')];if(!_0x19cc9d[_0xa42d('0x44')]['hasOwnProperty'](_0xa42d('0xcf'))){_0x1e27cf['limit']=qs[_0xa42d('0x18')](_0x19cc9d[_0xa42d('0x44')]['limit']);_0x1e27cf[_0xa42d('0x17')]=qs[_0xa42d('0x17')](_0x19cc9d[_0xa42d('0x44')][_0xa42d('0x17')]);}return _0x34964a['getSmsInteractions'](_0x1e27cf);}})['then'](function(_0x51f505){if(_0x51f505){return _0x51f505?{'count':_0x446fb3,'rows':_0x51f505}:null;}})['then'](respondWithResult(_0x5a757a,null))[_0xa42d('0x55')](handleError(_0x5a757a,null));};exports[_0xa42d('0xde')]=function(_0x31cf6e,_0x11c37b){var _0x2d1175={};var _0x1ceb1e={};var _0x431ee0;var _0xd331dc;return db[_0xa42d('0x41')][_0xa42d('0xbc')]({'where':{'id':_0x31cf6e[_0xa42d('0x57')]['id']}})['then'](handleEntityNotFound(_0x11c37b,null))[_0xa42d('0x1e')](function(_0x4b0c7e){if(_0x4b0c7e){_0x431ee0=_0x4b0c7e;_0x1ceb1e[_0xa42d('0xc5')]=_[_0xa42d('0xc6')](db[_0xa42d('0xdf')][_0xa42d('0x35')]);_0x1ceb1e[_0xa42d('0x44')]=_[_0xa42d('0xc6')](_0x31cf6e[_0xa42d('0x44')]);_0x1ceb1e[_0xa42d('0xc8')]=_[_0xa42d('0xc9')](_0x1ceb1e['model'],_0x1ceb1e[_0xa42d('0x44')]);_0x2d1175[_0xa42d('0x47')]=_[_0xa42d('0xc9')](_0x1ceb1e['model'],qs[_0xa42d('0xca')](_0x31cf6e[_0xa42d('0x44')][_0xa42d('0xca')]));_0x2d1175[_0xa42d('0x47')]=_0x2d1175[_0xa42d('0x47')]['length']?_0x2d1175[_0xa42d('0x47')]:_0x1ceb1e[_0xa42d('0xc5')];_0x2d1175[_0xa42d('0xcb')]=qs[_0xa42d('0xcc')](_0x31cf6e[_0xa42d('0x44')][_0xa42d('0xcc')]);_0x2d1175['where']=qs['filters'](_[_0xa42d('0xcd')](_0x31cf6e[_0xa42d('0x44')],_0x1ceb1e[_0xa42d('0xc8')]));if(_0x31cf6e[_0xa42d('0x44')][_0xa42d('0x38')]){_0x2d1175[_0xa42d('0x40')]=_[_0xa42d('0xce')](_0x2d1175['where'],{'$or':_[_0xa42d('0x2b')](_0x2d1175[_0xa42d('0x47')],function(_0x1c53f8){var _0x52cc13={};_0x52cc13[_0x1c53f8]={'$like':'%'+_0x31cf6e[_0xa42d('0x44')][_0xa42d('0x38')]+'%'};return _0x52cc13;})});}_0x2d1175=_[_0xa42d('0xce')]({},_0x2d1175,_0x31cf6e[_0xa42d('0x58')]);return _0x431ee0[_0xa42d('0xde')](_0x2d1175);}})['then'](function(_0xda61b7){if(_0xda61b7){_0xd331dc=_0xda61b7[_0xa42d('0x4d')];if(!_0x31cf6e['query'][_0xa42d('0xbe')](_0xa42d('0xcf'))){_0x2d1175[_0xa42d('0x18')]=qs['limit'](_0x31cf6e[_0xa42d('0x44')][_0xa42d('0x18')]);_0x2d1175[_0xa42d('0x17')]=qs['offset'](_0x31cf6e['query'][_0xa42d('0x17')]);}return _0x431ee0['getFaxInteractions'](_0x2d1175);}})['then'](function(_0x3e8792){if(_0x3e8792){return _0x3e8792?{'count':_0xd331dc,'rows':_0x3e8792}:null;}})[_0xa42d('0x1e')](respondWithResult(_0x11c37b,null))[_0xa42d('0x55')](handleError(_0x11c37b,null));};exports[_0xa42d('0xe0')]=function(_0x50fe01,_0x4a8b69){var _0x7a6ed0={};var _0x574099={};var _0x2c0183;var _0x1aeae6;return db[_0xa42d('0x41')]['findOne']({'where':{'id':_0x50fe01[_0xa42d('0x57')]['id']}})['then'](handleEntityNotFound(_0x4a8b69,null))['then'](function(_0x2b5b7a){if(_0x2b5b7a){_0x2c0183=_0x2b5b7a;_0x574099[_0xa42d('0xc5')]=_[_0xa42d('0xc6')](db[_0xa42d('0xe1')][_0xa42d('0x35')]);_0x574099[_0xa42d('0x44')]=_['keys'](_0x50fe01[_0xa42d('0x44')]);_0x574099[_0xa42d('0xc8')]=_[_0xa42d('0xc9')](_0x574099[_0xa42d('0xc5')],_0x574099[_0xa42d('0x44')]);_0x7a6ed0[_0xa42d('0x47')]=_[_0xa42d('0xc9')](_0x574099[_0xa42d('0xc5')],qs[_0xa42d('0xca')](_0x50fe01[_0xa42d('0x44')]['fields']));_0x7a6ed0[_0xa42d('0x47')]=_0x7a6ed0[_0xa42d('0x47')][_0xa42d('0x4d')]?_0x7a6ed0[_0xa42d('0x47')]:_0x574099[_0xa42d('0xc5')];_0x7a6ed0[_0xa42d('0xcb')]=qs[_0xa42d('0xcc')](_0x50fe01['query'][_0xa42d('0xcc')]);_0x7a6ed0[_0xa42d('0x40')]=qs[_0xa42d('0xc8')](_[_0xa42d('0xcd')](_0x50fe01['query'],_0x574099['filters']));if(_0x50fe01['query'][_0xa42d('0x38')]){_0x7a6ed0[_0xa42d('0x40')]=_[_0xa42d('0xce')](_0x7a6ed0[_0xa42d('0x40')],{'$or':_[_0xa42d('0x2b')](_0x7a6ed0[_0xa42d('0x47')],function(_0x12ad7c){var _0x1021b6={};_0x1021b6[_0x12ad7c]={'$like':'%'+_0x50fe01[_0xa42d('0x44')][_0xa42d('0x38')]+'%'};return _0x1021b6;})});}_0x7a6ed0=_[_0xa42d('0xce')]({},_0x7a6ed0,_0x50fe01[_0xa42d('0x58')]);return _0x2c0183[_0xa42d('0xe0')](_0x7a6ed0);}})[_0xa42d('0x1e')](function(_0x917b6c){if(_0x917b6c){_0x1aeae6=_0x917b6c[_0xa42d('0x4d')];if(!_0x50fe01[_0xa42d('0x44')][_0xa42d('0xbe')](_0xa42d('0xcf'))){_0x7a6ed0['limit']=qs[_0xa42d('0x18')](_0x50fe01[_0xa42d('0x44')][_0xa42d('0x18')]);_0x7a6ed0[_0xa42d('0x17')]=qs[_0xa42d('0x17')](_0x50fe01['query'][_0xa42d('0x17')]);}return _0x2c0183[_0xa42d('0xe0')](_0x7a6ed0);}})[_0xa42d('0x1e')](function(_0x1997af){if(_0x1997af){return _0x1997af?{'count':_0x1aeae6,'rows':_0x1997af}:null;}})['then'](respondWithResult(_0x4a8b69,null))[_0xa42d('0x55')](handleError(_0x4a8b69,null));};exports['login']=function(_0xa330ef,_0x36cf20,_0x568685){var _0x317748;var _0x2c919d;var _0xac1e46;var _0xd69e48=!_[_0xa42d('0x63')](_0xa330ef['params']['id'])?_0xa330ef[_0xa42d('0x57')]['id']:!_[_0xa42d('0x63')](_0xa330ef[_0xa42d('0x26')]['id'])?_0xa330ef['user']['id']:null;return db[_0xa42d('0x41')]['find']({'where':{'id':_0xd69e48,'role':{'$or':[_0xa42d('0x24'),_0xa42d('0x26'),_0xa42d('0x1f')]}},'attributes':['id',_0xa42d('0x2f'),_0xa42d('0xe2'),_0xa42d('0xe3'),_0xa42d('0x2e'),_0xa42d('0x60'),_0xa42d('0x93')]})['then'](function(_0x5b348d){if(_0x5b348d){if(_0x5b348d['role']===_0xa42d('0x1f')){_0x317748=_0x5b348d;if(_0xa330ef[_0xa42d('0x5b')][_0xa42d('0x95')]){_0xac1e46=util[_0xa42d('0xa2')](_0xa42d('0xe4'),_0x317748[_0xa330ef[_0xa42d('0x5b')][_0xa42d('0x95')]]);}else if(_0xa330ef[_0xa42d('0x5b')][_0xa42d('0xe5')]){_0xac1e46=util[_0xa42d('0xa2')]('SIP/%s',_0xa330ef['body'][_0xa42d('0xe5')]);}else{_0xac1e46=util[_0xa42d('0xa2')](_0xa42d('0xa3'),_0x317748[_0xa42d('0x2f')]);}socket['to'](util['format'](_0xa42d('0xe6'),_0x317748['name']))[_0xa42d('0x20')]('user:forcelogout',{'user':{'id':_0x317748['id'],'name':_0x317748[_0xa42d('0x2f')]},'ip':_0xa330ef[_0xa42d('0xe7')][_0xa42d('0xe8')]||_0xa330ef['connection'][_0xa42d('0xe9')]||_0xa330ef['socket']['remoteAddress']||_0xa330ef[_0xa42d('0xea')][_0xa42d('0xeb')][_0xa42d('0xe9')]});return db[_0xa42d('0xec')][_0xa42d('0x22')]({'where':{'membername':_0x317748[_0xa42d('0x2f')]},'individualHooks':!![]});}}else{throw new db[(_0xa42d('0x86'))][(_0xa42d('0x8a'))](_0xa42d('0xed'));}})['then'](function(){if(_0x317748){return _0x317748[_0xa42d('0xee')]({'raw':!![]});}})[_0xa42d('0x1e')](function(_0x441d9e){if(_0x317748){if(_0x441d9e){_0x2c919d=_0x441d9e;if(_0x2c919d[_0xa42d('0x4d')]){var _0xe5da75=_0x2c919d[_0xa42d('0x2b')](function(_0x12b4d2){var _0x5806f4={'membername':_0x317748[_0xa42d('0x2f')],'UserId':_0x317748['id'],'queue_name':_0x12b4d2['name'],'VoiceQueueId':_0x12b4d2['id'],'interface':_0xac1e46,'paused':_0x317748['loginInPause']||![],'penalty':_0x12b4d2[_0xa42d('0xef')]||0x0};return db['UserVoiceQueueRt']['upsert'](_0x5806f4);});return Promise[_0xa42d('0x54')](_0xe5da75);}}}})['then'](function(){if(_0x317748){return db['MemberReport']['findAll']({'where':{'membername':_0x317748[_0xa42d('0x2f')],'exitAt':null}});}})['then'](function(_0x299c96){if(_0x317748){var _0x208aff=[];_0x299c96[_0xa42d('0xf0')](function(_0x4450d2){_0x208aff[_0xa42d('0x48')](_0x4450d2[_0xa42d('0x1d')]({'exitAt':moment()[_0xa42d('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x208aff);}})[_0xa42d('0x1e')](function(){if(_0x317748){var _0x52f68e=[];var _0x7a082=[];var _0x26f193=utils[_0xa42d('0xf1')]();var _0x3d5ef7={'membername':_0x317748[_0xa42d('0x2f')],'interface':_0xac1e46,'enterAt':moment()[_0xa42d('0xa2')](_0xa42d('0xf2')),'role':_0x317748[_0xa42d('0x2e')],'internal':_0x317748[_0xa42d('0x60')]};_0x26f193[_0xa42d('0xf0')](function(_0x566b94){_0x52f68e[_0xa42d('0x48')](_['merge']({'channel':_0x566b94,'type':_0xa42d('0xf3'),'data1':_0xa330ef[_0xa42d('0x5b')][_0xa42d('0xf4')],'data2':_0xac1e46},_0x3d5ef7));if(_0x317748[_0xa42d('0x93')]){_0x7a082[_0xa42d('0x48')](_[_0xa42d('0xce')]({'channel':_0x566b94,'type':_0xa42d('0xf5'),'data1':_0xa42d('0xf6')},_0x3d5ef7));}});return db[_0xa42d('0xf7')]['bulkCreate'](_0x52f68e[_0xa42d('0xf8')](_0x7a082),{'individualHooks':!![]});}})[_0xa42d('0x1e')](function(){if(_0x317748){return _0x317748[_0xa42d('0x1d')]({'online':!![],'lastLoginAt':moment()[_0xa42d('0xa2')](_0xa42d('0xf2')),'voicePause':_0x317748[_0xa42d('0x93')]||![],'mailPause':_0x317748[_0xa42d('0x93')]||![],'chatPause':_0x317748[_0xa42d('0x93')]||![],'faxPause':_0x317748[_0xa42d('0x93')]||![],'smsPause':_0x317748['loginInPause']||![],'openchannelPause':_0x317748[_0xa42d('0x93')]||![],'whatsappPause':_0x317748[_0xa42d('0x93')]||![],'pauseType':_0x317748[_0xa42d('0x93')]?_0xa42d('0xf6'):null,'interface':_0xac1e46,'lastPauseAt':moment()[_0xa42d('0xa2')](_0xa42d('0xf2'))});}})['then'](function(_0x592b5a){if(_0xa330ef[_0xa42d('0xf9')]){return _0x568685();}else{return Promise[_0xa42d('0xfa')](_0x592b5a)[_0xa42d('0x1e')](respondWithResult(_0x36cf20,null));}})['catch'](handleError(_0x36cf20,null));};exports[_0xa42d('0xfb')]=function(_0x15dbef,_0x21c0d8){var _0x2483b5;return db['User']['find']({'where':{'id':_0x15dbef[_0xa42d('0x57')]['id'],'role':_0xa42d('0x1f')},'attributes':['id',_0xa42d('0x2f'),_0xa42d('0x2e')]})[_0xa42d('0x1e')](handleEntityNotFound(_0x21c0d8,null))[_0xa42d('0x1e')](function(_0x3a7003){if(_0x3a7003){_0x2483b5=_0x3a7003;return db[_0xa42d('0xec')][_0xa42d('0x22')]({'where':{'membername':_0x2483b5[_0xa42d('0x2f')]},'individualHooks':!![]});}})[_0xa42d('0x1e')](function(){return db[_0xa42d('0xf7')][_0xa42d('0x49')]({'where':{'membername':_0x2483b5[_0xa42d('0x2f')],'exitAt':null}});})['then'](function(_0x426fd2){var _0xc3c073=[];_0x426fd2[_0xa42d('0xf0')](function(_0x4e0389){_0xc3c073['push'](_0x4e0389[_0xa42d('0x1d')]({'exitAt':moment()['format'](_0xa42d('0xf2'))}));});return Promise[_0xa42d('0x54')](_0xc3c073);})[_0xa42d('0x1e')](function(){return _0x2483b5[_0xa42d('0x1d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa42d('0x1e')](respondWithResult(_0x21c0d8,null))[_0xa42d('0x55')](handleError(_0x21c0d8,null));};exports['pause']=function(_0x4bc605,_0x28d145){var _0x11fbca;return db[_0xa42d('0xec')][_0xa42d('0x1d')]({'paused':0x1},{'where':{'UserId':_0x4bc605[_0xa42d('0x57')]['id']},'individualHooks':!![]})[_0xa42d('0x1e')](function(){return db[_0xa42d('0x41')][_0xa42d('0x59')]({'where':{'id':_0x4bc605[_0xa42d('0x57')]['id'],'role':'agent'},'attributes':['id',_0xa42d('0x2f'),_0xa42d('0x2e'),_0xa42d('0x60'),_0xa42d('0x95'),_0xa42d('0xa1')]});})[_0xa42d('0x1e')](handleEntityNotFound(_0x28d145,null))['then'](function(_0x5804d5){if(_0x5804d5){_0x11fbca=_0x5804d5;return db['MemberReport'][_0xa42d('0x49')]({'where':{'membername':_0x11fbca['name'],'type':_0xa42d('0xf5'),'exitAt':null}});}})[_0xa42d('0x1e')](function(_0x2e1c08){if(_0x2e1c08[_0xa42d('0x4d')]){var _0x55e48c=moment()[_0xa42d('0xa2')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x12a6ea=0x0,_0x2dd785=_0x2e1c08[_0xa42d('0x4d')];_0x12a6ea<_0x2dd785;_0x12a6ea++){_0x2e1c08[_0x12a6ea]['updateAttributes']({'exitAt':_0x55e48c});}}})[_0xa42d('0x1e')](function(){var _0x194ce4=[];var _0x1b180b=utils[_0xa42d('0xf1')]();_0x1b180b[_0xa42d('0xf0')](function(_0x46bd3c){_0x194ce4['push']({'channel':_0x46bd3c,'membername':_0x11fbca[_0xa42d('0x2f')],'interface':_[_0xa42d('0x63')](_0x11fbca['interface'])?util[_0xa42d('0xa2')](_0xa42d('0xa3'),_0x11fbca[_0xa42d('0x2f')]):_0x11fbca[_0xa42d('0x95')],'type':_0xa42d('0xf5'),'enterAt':moment()[_0xa42d('0xa2')](_0xa42d('0xf2')),'data1':_0x4bc605[_0xa42d('0x5b')][_0xa42d('0x37')]||_0xa42d('0xfc'),'role':_0x11fbca['role'],'internal':_0x11fbca[_0xa42d('0x60')]});});return db[_0xa42d('0xf7')][_0xa42d('0xfd')](_0x194ce4,{'individualHooks':!![]});})[_0xa42d('0x1e')](function(){return _0x11fbca[_0xa42d('0x1d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4bc605[_0xa42d('0x5b')][_0xa42d('0x37')]||_0xa42d('0xfc'),'lastPauseAt':moment()['format'](_0xa42d('0xf2'))});})['then'](respondWithResult(_0x28d145,null))[_0xa42d('0x55')](handleError(_0x28d145,null));};exports[_0xa42d('0xfe')]=function(_0x2e40e6,_0x1c0dd5){if(_0x2e40e6[_0xa42d('0x5b')]['channel']&&!utils[_0xa42d('0x96')](_0x2e40e6[_0xa42d('0x5b')][_0xa42d('0x92')])){throw new APIBadRequestError(util['format'](_0xa42d('0xff'),_0x2e40e6[_0xa42d('0x5b')]['channel']));}return db[_0xa42d('0x41')][_0xa42d('0x59')]({'where':{'id':_0x2e40e6['params']['id']},'attributes':['id',_0xa42d('0x2f'),_0xa42d('0x2e'),_0xa42d('0x60'),'interface',_0xa42d('0xa1'),_0xa42d('0x94'),_0xa42d('0x100'),_0xa42d('0x101'),_0xa42d('0x102'),_0xa42d('0x103'),'smsPause','whatsappPause',_0xa42d('0x104'),_0xa42d('0x105')]})[_0xa42d('0x1e')](function(_0x21daac){if(!_0x21daac){throw new APINotFoundError(util['format'](_0xa42d('0xbd'),_0x2e40e6[_0xa42d('0x57')]['id']));}return _0x21daac[_0xa42d('0xfe')](_0x2e40e6[_0xa42d('0x5b')][_0xa42d('0x92')]);})[_0xa42d('0x1e')](respondWithResult(_0x1c0dd5,null))['catch'](APIHandleError(_0x1c0dd5));};exports[_0xa42d('0x106')]=function(_0x5d7cac,_0x3e7c05){var _0x2f9f79={};var _0x31e271={};var _0x33007f;var _0x2d0d7e;return db[_0xa42d('0x41')][_0xa42d('0xbc')]({'where':{'id':_0x5d7cac[_0xa42d('0x57')]['id']}})['then'](handleEntityNotFound(_0x3e7c05,null))['then'](function(_0x49dae8){if(_0x49dae8){_0x33007f=_0x49dae8;_0x31e271[_0xa42d('0xc5')]=_['keys'](db[_0xa42d('0x107')][_0xa42d('0x35')]);_0x31e271[_0xa42d('0x44')]=_[_0xa42d('0xc6')](_0x5d7cac[_0xa42d('0x44')]);_0x31e271[_0xa42d('0xc8')]=_['intersection'](_0x31e271[_0xa42d('0xc5')],_0x31e271[_0xa42d('0x44')]);_0x2f9f79['attributes']=_[_0xa42d('0xc9')](_0x31e271[_0xa42d('0xc5')],qs[_0xa42d('0xca')](_0x5d7cac[_0xa42d('0x44')]['fields']));_0x2f9f79[_0xa42d('0x47')]=_0x2f9f79['attributes'][_0xa42d('0x4d')]?_0x2f9f79[_0xa42d('0x47')]:_0x31e271[_0xa42d('0xc5')];_0x2f9f79['order']=qs[_0xa42d('0xcc')](_0x5d7cac[_0xa42d('0x44')]['sort']);_0x2f9f79[_0xa42d('0x40')]=qs[_0xa42d('0xc8')](_[_0xa42d('0xcd')](_0x5d7cac['query'],_0x31e271[_0xa42d('0xc8')]));if(_0x5d7cac[_0xa42d('0x44')][_0xa42d('0x38')]){_0x2f9f79[_0xa42d('0x40')]=_[_0xa42d('0xce')](_0x2f9f79[_0xa42d('0x40')],{'$or':_['map'](_0x2f9f79[_0xa42d('0x47')],function(_0x73a496){var _0x475d26={};_0x475d26[_0x73a496]={'$like':'%'+_0x5d7cac[_0xa42d('0x44')]['filter']+'%'};return _0x475d26;})});}_0x2f9f79=_[_0xa42d('0xce')]({},_0x2f9f79,_0x5d7cac['options']);return _0x33007f['getTeams'](_0x2f9f79);}})[_0xa42d('0x1e')](function(_0x134000){if(_0x134000){_0x2d0d7e=_0x134000['length'];if(!_0x5d7cac[_0xa42d('0x44')]['hasOwnProperty'](_0xa42d('0xcf'))){_0x2f9f79['limit']=qs[_0xa42d('0x18')](_0x5d7cac[_0xa42d('0x44')][_0xa42d('0x18')]);_0x2f9f79[_0xa42d('0x17')]=qs[_0xa42d('0x17')](_0x5d7cac[_0xa42d('0x44')][_0xa42d('0x17')]);}return _0x33007f[_0xa42d('0x106')](_0x2f9f79);}})[_0xa42d('0x1e')](function(_0x508df1){if(_0x508df1){return _0x508df1?{'count':_0x2d0d7e,'rows':_0x508df1}:null;}})[_0xa42d('0x1e')](respondWithResult(_0x3e7c05,null))[_0xa42d('0x55')](handleError(_0x3e7c05,null));};exports['addTeams']=function(_0x1f2eca,_0x59751f){var _0x48a3b7=_0x1f2eca['params']['id'];var _0x5ec31e=_0x1f2eca[_0xa42d('0x5b')]?_0x1f2eca[_0xa42d('0x5b')][_0xa42d('0x5e')]:null;var _0x1ee3ab=[];return Promise[_0xa42d('0xfa')]()[_0xa42d('0x1e')](function(){if(!_0x5ec31e)throw new APIBadRequestError(_0xa42d('0x108'));})[_0xa42d('0x1e')](function(){return db[_0xa42d('0x41')][_0xa42d('0xbc')]({'where':{'id':_0x48a3b7}});})[_0xa42d('0x1e')](function(_0x425192){if(!_0x425192)throw new APINotFoundError(util[_0xa42d('0xa2')](_0xa42d('0xbd'),_0x1f2eca[_0xa42d('0x57')]['id']));return db[_0xa42d('0x65')]['transaction'](function(_0x700da1){return _0x425192[_0xa42d('0x109')](_0x5ec31e,{'transaction':_0x700da1})[_0xa42d('0x1e')](function(){return db[_0xa42d('0x107')][_0xa42d('0x49')]({'where':{'id':{'$in':_0x5ec31e}}});})[_0xa42d('0x1e')](function(_0x40af5e){var _0x30871b=_[_0xa42d('0x2b')](_0x40af5e,function(_0x12e2d4){return _0x12e2d4[_0xa42d('0x10a')]();});return Promise['all'](_0x30871b);})[_0xa42d('0x1e')](function(_0x1cfa8d){_0x1ee3ab=_['flattenDeep'](_0x1cfa8d);var _0x32e8ee=_[_0xa42d('0x2b')](_0x1ee3ab,function(_0x109fe3){return _0x109fe3['addAgent'](_0x425192['id'],{'transaction':_0x700da1});});return Promise[_0xa42d('0x54')](_0x32e8ee);})[_0xa42d('0x1e')](function(){if(!_0x425192[_0xa42d('0xa1')])return;var _0x3bbb23=_['filter'](_0x1ee3ab,function(_0x181a17){return _0x181a17[_0xa42d('0x10b')](_0xa42d('0x92'))===_0xa42d('0x10c');});var _0x558910=_[_0xa42d('0x2b')](_0x3bbb23,function(_0x1d59fa){return db[_0xa42d('0xec')][_0xa42d('0xa4')]({'membername':_0x425192['name'],'UserId':_0x425192['id'],'queue_name':_0x1d59fa[_0xa42d('0x2f')],'VoiceQueueId':_0x1d59fa['id'],'interface':_['isNil'](_0x425192[_0xa42d('0x95')])?util['format'](_0xa42d('0xa3'),_0x425192[_0xa42d('0x2f')]):_0x425192[_0xa42d('0x95')],'paused':_0x425192[_0xa42d('0x94')]||![],'penalty':_0x425192['penalty']},{'transaction':_0x700da1});});return Promise[_0xa42d('0x54')](_0x558910);})[_0xa42d('0x1e')](function(){return db[_0xa42d('0x10d')][_0xa42d('0x49')]({'where':{'teamId':{'$in':_0x5ec31e}}});})['then'](function(_0xf83ce3){var _0x1b5b97=_[_0xa42d('0x2b')](_0xf83ce3,function(_0x3d49fd){return db[_0xa42d('0x10e')][_0xa42d('0x79')]({'UserId':_0x425192['id'],'VoicePrefixId':_0x3d49fd[_0xa42d('0x10f')]},{'transaction':_0x700da1});});return Promise[_0xa42d('0x54')](_0x1b5b97);});});})['then'](function(){for(var _0x334d2e=0x0;_0x334d2e<_0x1ee3ab[_0xa42d('0x4d')];_0x334d2e++){var _0x29cb2b=_0x1ee3ab[_0x334d2e][_0xa42d('0x10b')](_0xa42d('0x92'));var _0x407794=_0x29cb2b+_0xa42d('0x9e');socket['emit'](_0xa42d('0x26')+_0x29cb2b+'Queue:save',{'UserId':_0x48a3b7,['queueField']:_0x1ee3ab[_0x334d2e]['id']});}})['then'](respondWithStatusCode(_0x59751f,null))[_0xa42d('0x55')](APIHandleError(_0x59751f));};exports['removeTeams']=function(_0x1f57a3,_0x40fa67){var _0x1f777e=_0x1f57a3['params']['id'];var _0x878cb7=null;if(_0x1f57a3[_0xa42d('0x44')]['ids']){_0x878cb7=_['isArray'](_0x1f57a3[_0xa42d('0x44')][_0xa42d('0x5e')])?_0x1f57a3[_0xa42d('0x44')][_0xa42d('0x5e')]:[_0x1f57a3[_0xa42d('0x44')][_0xa42d('0x5e')]];}var _0x2de00a=[];return Promise[_0xa42d('0xfa')]()[_0xa42d('0x1e')](function(){if(!_0x878cb7)throw new APIBadRequestError(_0xa42d('0x110'));})['then'](function(){return db[_0xa42d('0x41')][_0xa42d('0xbc')]({'where':{'id':_0x1f777e}});})[_0xa42d('0x1e')](function(_0x19e1a0){if(!_0x19e1a0)throw new APINotFoundError(util[_0xa42d('0xa2')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1f57a3[_0xa42d('0x57')]['id']));return db[_0xa42d('0x65')][_0xa42d('0x111')](function(_0xd67ec9){return _0x19e1a0[_0xa42d('0x112')](_0x878cb7,{'transaction':_0xd67ec9})[_0xa42d('0x1e')](function(){return db['Team'][_0xa42d('0x49')]({'where':{'id':{'$in':_0x878cb7}}});})[_0xa42d('0x1e')](function(_0x13b2af){var _0x845f=_[_0xa42d('0x2b')](_0x13b2af,function(_0x1d3a99){return _0x1d3a99[_0xa42d('0x10a')]();});return Promise['all'](_0x845f);})['then'](function(_0x352ccc){_0x2de00a=_[_0xa42d('0x113')](_0x352ccc);var _0x3e8548=_['map'](_0x2de00a,function(_0x4a435a){return _0x4a435a['removeAgent'](_0x19e1a0['id'],{'transaction':_0xd67ec9});});return Promise[_0xa42d('0x54')](_0x3e8548);})[_0xa42d('0x1e')](function(){if(!_0x19e1a0[_0xa42d('0xa1')])return;var _0x2d50ad=_[_0xa42d('0x38')](_0x2de00a,function(_0x40bab6){return _0x40bab6[_0xa42d('0x10b')](_0xa42d('0x92'))===_0xa42d('0x10c');});var _0x3ce481=_[_0xa42d('0x2b')](_0x2d50ad,function(_0x5e8a05){return db[_0xa42d('0xec')]['destroy']({'where':{'VoiceQueueId':_0x5e8a05['id'],'UserId':_0x19e1a0['id']},'transaction':_0xd67ec9});});return Promise[_0xa42d('0x54')](_0x3ce481);})[_0xa42d('0x1e')](function(){return db[_0xa42d('0x10d')][_0xa42d('0x49')]({'where':{'teamId':{'$in':_0x878cb7}}});})[_0xa42d('0x1e')](function(_0x3421a6){var _0x1e49fb=_[_0xa42d('0x2b')](_0x3421a6,function(_0x27d2b){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x19e1a0['id'],'VoicePrefixId':_0x27d2b[_0xa42d('0x10f')]}},{'transaction':_0xd67ec9});});return Promise[_0xa42d('0x54')](_0x1e49fb);});});})[_0xa42d('0x1e')](function(){for(var _0x2ff38b=0x0;_0x2ff38b<_0x2de00a[_0xa42d('0x4d')];_0x2ff38b++){var _0x435ed9=_0x2de00a[_0x2ff38b][_0xa42d('0x10b')](_0xa42d('0x92'));var _0x44d41c=_0x435ed9+'QueueId';socket[_0xa42d('0x20')]('user'+_0x435ed9+'Queue:remove',{'UserId':_0x1f777e,['queueField']:_0x2de00a[_0x2ff38b]['id']});}})[_0xa42d('0x1e')](respondWithStatusCode(_0x40fa67,null))[_0xa42d('0x55')](APIHandleError(_0x40fa67));};exports[_0xa42d('0x114')]=function(_0x2d7262,_0x1a100b){var _0x3aa2f3={};var _0x1ce1f0={};var _0x3bfc68;var _0x500d23;return db[_0xa42d('0x41')][_0xa42d('0xbc')]({'where':{'id':_0x2d7262['params']['id']}})['then'](handleEntityNotFound(_0x1a100b,null))[_0xa42d('0x1e')](function(_0x15caa1){if(_0x15caa1){_0x3bfc68=_0x15caa1;_0x1ce1f0[_0xa42d('0xc5')]=_[_0xa42d('0xc6')](db[_0xa42d('0x115')][_0xa42d('0x35')]);_0x1ce1f0[_0xa42d('0x44')]=_['keys'](_0x2d7262[_0xa42d('0x44')]);_0x1ce1f0[_0xa42d('0xc8')]=_[_0xa42d('0xc9')](_0x1ce1f0[_0xa42d('0xc5')],_0x1ce1f0[_0xa42d('0x44')]);_0x3aa2f3[_0xa42d('0x47')]=_[_0xa42d('0xc9')](_0x1ce1f0[_0xa42d('0xc5')],qs[_0xa42d('0xca')](_0x2d7262[_0xa42d('0x44')][_0xa42d('0xca')]));_0x3aa2f3['attributes']=_0x3aa2f3[_0xa42d('0x47')]['length']?_0x3aa2f3['attributes']:_0x1ce1f0[_0xa42d('0xc5')];_0x3aa2f3['order']=qs[_0xa42d('0xcc')](_0x2d7262[_0xa42d('0x44')][_0xa42d('0xcc')]);_0x3aa2f3[_0xa42d('0x40')]=qs[_0xa42d('0xc8')](_['pick'](_0x2d7262['query'],_0x1ce1f0[_0xa42d('0xc8')]));if(_0x2d7262[_0xa42d('0x44')][_0xa42d('0x38')]){_0x3aa2f3[_0xa42d('0x40')]=_[_0xa42d('0xce')](_0x3aa2f3[_0xa42d('0x40')],{'$or':_['map'](_0x3aa2f3['attributes'],function(_0x1f9997){var _0x587c38={};_0x587c38[_0x1f9997]={'$like':'%'+_0x2d7262['query'][_0xa42d('0x38')]+'%'};return _0x587c38;})});}_0x3aa2f3=_['merge']({},_0x3aa2f3,_0x2d7262[_0xa42d('0x58')]);return _0x3bfc68[_0xa42d('0x114')](_0x3aa2f3);}})[_0xa42d('0x1e')](function(_0x16df61){if(_0x16df61){_0x500d23=_0x16df61[_0xa42d('0x4d')];if(!_0x2d7262[_0xa42d('0x44')][_0xa42d('0xbe')](_0xa42d('0xcf'))){_0x3aa2f3['limit']=qs[_0xa42d('0x18')](_0x2d7262['query'][_0xa42d('0x18')]);_0x3aa2f3[_0xa42d('0x17')]=qs[_0xa42d('0x17')](_0x2d7262[_0xa42d('0x44')]['offset']);}return _0x3bfc68[_0xa42d('0x114')](_0x3aa2f3);}})[_0xa42d('0x1e')](function(_0x45fa5f){if(_0x45fa5f){return _0x45fa5f?{'count':_0x500d23,'rows':_0x45fa5f}:null;}})[_0xa42d('0x1e')](respondWithResult(_0x1a100b,null))['catch'](handleError(_0x1a100b,null));};exports[_0xa42d('0x116')]=function(_0x5c4000,_0x1701fa){var _0x2f6663={};var _0xccfac8={};var _0x462d7b;return db[_0xa42d('0x41')][_0xa42d('0xbc')]({'where':{'id':_0x5c4000[_0xa42d('0x57')]['id']}})['then'](handleEntityNotFound(_0x1701fa,null))[_0xa42d('0x1e')](function(_0x1c79ff){if(_0x1c79ff){_0x462d7b=_0x1c79ff;_0xccfac8[_0xa42d('0xc5')]=_[_0xa42d('0xc6')](db[_0xa42d('0x41')]['rawAttributes']);_0xccfac8['query']=_[_0xa42d('0xc6')](_0x5c4000[_0xa42d('0x44')]);_0xccfac8[_0xa42d('0xc8')]=_['intersection'](_0xccfac8[_0xa42d('0xc5')],_0xccfac8['query']);_0x2f6663[_0xa42d('0x47')]=_['intersection'](_0xccfac8[_0xa42d('0xc5')],qs[_0xa42d('0xca')](_0x5c4000[_0xa42d('0x44')]['fields']));_0x2f6663[_0xa42d('0x47')]=_0x2f6663[_0xa42d('0x47')][_0xa42d('0x4d')]?_0x2f6663[_0xa42d('0x47')]:_0xccfac8[_0xa42d('0xc5')];_0x2f6663[_0xa42d('0xcb')]=qs[_0xa42d('0xcc')](_0x5c4000[_0xa42d('0x44')][_0xa42d('0xcc')]);_0x2f6663[_0xa42d('0x40')]=qs['filters'](_[_0xa42d('0xcd')](_0x5c4000['query'],_0xccfac8[_0xa42d('0xc8')]));if(_0x5c4000[_0xa42d('0x44')][_0xa42d('0x38')]){_0x2f6663[_0xa42d('0x40')]=_[_0xa42d('0xce')](_0x2f6663[_0xa42d('0x40')],{'$or':_[_0xa42d('0x2b')](_0x2f6663[_0xa42d('0x47')],function(_0x21e6f7){var _0x4515cd={};_0x4515cd[_0x21e6f7]={'$like':'%'+_0x5c4000[_0xa42d('0x44')]['filter']+'%'};return _0x4515cd;})});}_0x2f6663[_0xa42d('0xc5')]=db[_0xa42d('0x41')];_0x2f6663['as']=_0xa42d('0x27');_0x2f6663=_['merge']({},_0x2f6663,_0x5c4000[_0xa42d('0x58')]);return _0x462d7b[_0xa42d('0xee')]({'include':[_0x2f6663]});}})[_0xa42d('0x1e')](function(_0x3528fa){if(_0x3528fa){var _0x1b5a57={},_0x177038=[];for(var _0x25b58c=0x0;_0x25b58c<_0x3528fa['length'];_0x25b58c+=0x1){for(var _0x35805f=0x0,_0x273369;_0x35805f<_0x3528fa[_0x25b58c][_0xa42d('0x27')][_0xa42d('0x4d')];_0x35805f+=0x1){_0x273369=_0x3528fa[_0x25b58c][_0xa42d('0x27')][_0x35805f][_0xa42d('0x23')]({'plain':!![]});_0x1b5a57[_0x273369['id']]=_0x273369;}}_0x1b5a57=_[_0xa42d('0x117')](_0x1b5a57);for(var _0xa6f2dd=qs[_0xa42d('0x17')](_0x5c4000[_0xa42d('0x44')][_0xa42d('0x17')]);_0xa6f2dd<_0x1b5a57[_0xa42d('0x4d')]&&_0x177038[_0xa42d('0x4d')]=_0x4470f8){_0x49d3ba=_0x4470f8;_0x3267cc=0xc8;}else{_0x3267cc=0xce;}_0x3a7766[_0x2ea6('0x15')](_0x3267cc);return _0x3a7766['set'](_0x2ea6('0x1a'),_0x2fa453+'-'+_0x49d3ba+'/'+_0x4470f8)[_0x2ea6('0x17')](_0x2c93a5);}return null;};}function saveUpdates(_0x3e11d8){return function(_0x5f2756){if(_0x5f2756){return _0x5f2756['update'](_0x3e11d8)['then'](function(_0x110021){if(_0x110021[_0x2ea6('0x1b')]===_0x2ea6('0x1c')){socket['emit']('userNotification:recalc:'+_0x110021['id'],_0x110021);}return _0x110021;});}return null;};}function removeEntity(_0x4b86f5){return function(_0x54a2f0){if(_0x54a2f0){return _0x54a2f0[_0x2ea6('0x1d')]()[_0x2ea6('0x1e')](function(){var _0x4c43c4=_0x54a2f0['get']({'plain':!![]});if(_0x4c43c4[_0x2ea6('0x1b')]===_0x2ea6('0x1f'))return;var _0x55bd8f=[{'name':_0x2ea6('0x20'),'value':_0x2ea6('0x21'),'ignore':!![]},{'name':_0x2ea6('0x22'),'value':_0x2ea6('0x1c'),'ignore':![]},{'name':_0x2ea6('0x23'),'value':_0x2ea6('0x24'),'ignore':![]}];var _0x5edd87=_(_0x55bd8f)['filter'](_0x2ea6('0x25'))[_0x2ea6('0x26')]('value')[_0x2ea6('0x27')]();if(_['includes'](_0x5edd87,_0x4c43c4[_0x2ea6('0x1b')])){return;}var _0x2115de=_[_0x2ea6('0x28')](_0x55bd8f,[_0x2ea6('0x27'),_0x4c43c4[_0x2ea6('0x1b')]])[_0x2ea6('0x29')];return db[_0x2ea6('0x2a')][_0x2ea6('0x1d')]({'where':{'type':_0x2115de,'resourceId':_0x4c43c4['id']}})[_0x2ea6('0x1e')](function(){return _0x54a2f0;});})[_0x2ea6('0x1e')](function(){_0x4b86f5['status'](0xcc)[_0x2ea6('0x16')]();});}};}function handleEntityNotFound(_0x3da913){return function(_0x473981){if(!_0x473981){_0x3da913[_0x2ea6('0x2b')](0x194);}return _0x473981;};}function handleError(_0x1b2cb0,_0x3aa6c4){_0x3aa6c4=_0x3aa6c4||0x1f4;return function(_0x804a7b){logger[_0x2ea6('0x2c')](_0x804a7b[_0x2ea6('0x2d')]);if(_0x804a7b[_0x2ea6('0x29')]){delete _0x804a7b['name'];}_0x1b2cb0[_0x2ea6('0x15')](_0x3aa6c4)[_0x2ea6('0x2e')](_0x804a7b);};}function getUserAttributes(){return _(db[_0x2ea6('0x2f')][_0x2ea6('0x30')])[_0x2ea6('0x26')](function(_0x1ec8ec){return{'name':_0x1ec8ec[_0x2ea6('0x31')],'type':_0x1ec8ec[_0x2ea6('0x32')][_0x2ea6('0x33')]};})[_0x2ea6('0x34')](function(_0x1750d1){return![_0x2ea6('0x35'),'salt',_0x2ea6('0x36'),_0x2ea6('0x37'),_0x2ea6('0x38'),_0x2ea6('0x39')][_0x2ea6('0x3a')](_0x1750d1[_0x2ea6('0x29')]);})[_0x2ea6('0x27')]();}exports[_0x2ea6('0x3b')]=function(_0x326a78,_0x316566){var _0x24e6ef={},_0x148f93={'count':0x0,'rows':[]};var _0xcd916a=getUserAttributes();_0x24e6ef=qs[_0x2ea6('0x3c')](_0xcd916a,_0x326a78);var _0x2cd8e7={'where':_0x24e6ef[_0x2ea6('0x3d')]};return db[_0x2ea6('0x2f')]['count'](_0x2cd8e7)[_0x2ea6('0x1e')](function(_0x39bdc3){_0x148f93[_0x2ea6('0x19')]=_0x39bdc3;if(_0x326a78['query'][_0x2ea6('0x3e')]){_0x24e6ef['include']=[{'all':!![]}];}if(_0x326a78[_0x2ea6('0x3f')][_0x2ea6('0x40')]===_0x2ea6('0x41')){_0x24e6ef[_0x2ea6('0x42')]=[{'model':db[_0x2ea6('0x43')],'as':'userSetting'}];}if(!_[_0x2ea6('0x3a')](_0x24e6ef['attributes'],'id')){_0x24e6ef[_0x2ea6('0x44')][_0x2ea6('0x45')]('id');}return db['User'][_0x2ea6('0x46')](_0x24e6ef);})[_0x2ea6('0x1e')](function(_0x2f4296){_0x148f93['rows']=_0x2f4296;if(_0x326a78[_0x2ea6('0x3f')][_0x2ea6('0x47')]===_0x2ea6('0x41')){var _0x4db0d3=[];for(var _0x27c374=0x0;_0x27c374<_0x148f93['rows'][_0x2ea6('0x48')];_0x27c374++){_0x4db0d3[_0x2ea6('0x45')](get_open_tabs('chat',_0x148f93[_0x2ea6('0x49')][_0x27c374][_0x2ea6('0x4a')]));_0x4db0d3[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4b'),_0x148f93[_0x2ea6('0x49')][_0x27c374][_0x2ea6('0x4a')]));_0x4db0d3[_0x2ea6('0x45')](get_open_tabs('fax',_0x148f93[_0x2ea6('0x49')][_0x27c374][_0x2ea6('0x4a')]));_0x4db0d3[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4c'),_0x148f93[_0x2ea6('0x49')][_0x27c374]['dataValues']));_0x4db0d3[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4d'),_0x148f93['rows'][_0x27c374][_0x2ea6('0x4a')]));_0x4db0d3[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4e'),_0x148f93[_0x2ea6('0x49')][_0x27c374][_0x2ea6('0x4a')]));}return Promise['all'](_0x4db0d3)['then'](function(){return _0x148f93;});}else{return _0x148f93;}})[_0x2ea6('0x1e')](respondWithFilteredResult(_0x316566,_0x24e6ef))[_0x2ea6('0x4f')](handleError(_0x316566,null));};exports[_0x2ea6('0x50')]=function(_0x6edcbd,_0xaad63a){var _0x180690=getUserAttributes();_0x6edcbd[_0x2ea6('0x3f')]['id']=_0x6edcbd['params']['id'];var _0x201149=qs[_0x2ea6('0x3c')](_0x180690,_0x6edcbd);if(_0x6edcbd[_0x2ea6('0x3f')][_0x2ea6('0x3e')]){_0x201149[_0x2ea6('0x42')]=[{'all':!![]}];}if(_0x6edcbd['query'][_0x2ea6('0x40')]===_0x2ea6('0x41')){_0x201149[_0x2ea6('0x42')]=[{'model':db['UserSetting'],'as':_0x2ea6('0x40')}];}_0x201149=_[_0x2ea6('0x51')]({},_0x201149,_0x6edcbd[_0x2ea6('0x52')]);if(!_[_0x2ea6('0x3a')](_0x201149[_0x2ea6('0x44')],'id')){_0x201149[_0x2ea6('0x44')][_0x2ea6('0x45')]('id');}return db[_0x2ea6('0x2f')][_0x2ea6('0x28')](_0x201149)[_0x2ea6('0x1e')](handleEntityNotFound(_0xaad63a,null))[_0x2ea6('0x1e')](function(_0x4cffa5){var _0x40adc1=[];values=_0x4cffa5;if(_0x6edcbd['query'][_0x2ea6('0x47')]===_0x2ea6('0x41')){_0x40adc1[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x53'),_0x4cffa5[_0x2ea6('0x4a')]));_0x40adc1[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4b'),_0x4cffa5[_0x2ea6('0x4a')]));_0x40adc1[_0x2ea6('0x45')](get_open_tabs('openchannel',_0x4cffa5[_0x2ea6('0x4a')]));_0x40adc1[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4e'),_0x4cffa5[_0x2ea6('0x4a')]));_0x40adc1[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x54'),_0x4cffa5['dataValues']));_0x40adc1[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4c'),_0x4cffa5['dataValues']));return Promise[_0x2ea6('0x55')](_0x40adc1);}else{return values;}})[_0x2ea6('0x1e')](function(){return values;})[_0x2ea6('0x1e')](respondWithResult(_0xaad63a,null))[_0x2ea6('0x4f')](handleError(_0xaad63a,null));};exports[_0x2ea6('0x56')]=function(_0x26d6d5,_0x5545fe){if(_0x26d6d5[_0x2ea6('0x57')]['id']){delete _0x26d6d5[_0x2ea6('0x57')]['id'];}delete _0x26d6d5[_0x2ea6('0x57')]['role'];return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x26d6d5['params']['id']}})['then'](handleEntityNotFound(_0x5545fe,null))[_0x2ea6('0x1e')](saveUpdates(_0x26d6d5[_0x2ea6('0x57')],null))['then'](respondWithResult(_0x5545fe,null))['catch'](handleError(_0x5545fe,null));};exports[_0x2ea6('0x58')]=function(_0x1c10a,_0x5dc187){return db[_0x2ea6('0x2f')]['describe']()[_0x2ea6('0x1e')](respondWithResult(_0x5dc187,null))[_0x2ea6('0x4f')](handleError(_0x5dc187,null));};exports[_0x2ea6('0x59')]=function(_0x338fd8,_0x1961a2){return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x338fd8[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x1961a2,null))[_0x2ea6('0x1e')](function(_0xc8990e){if(_0xc8990e){return _0xc8990e[_0x2ea6('0x59')](_0x338fd8['body'][_0x2ea6('0x5b')],_[_0x2ea6('0x5c')](_0x338fd8[_0x2ea6('0x57')],[_0x2ea6('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x1961a2,null))[_0x2ea6('0x4f')](handleError(_0x1961a2,null));};function validateUser(_0x3a49fe){return new Promise(function(_0x4694fc,_0x4b7990){if(_0x3a49fe[_0x2ea6('0x5d')])return _0x4694fc(_0x3a49fe);return db['Setting']['findById'](0x1)[_0x2ea6('0x1e')](function(_0x2573c1){if(_0x2573c1[_0x2ea6('0x5e')])authService[_0x2ea6('0x5f')](_0x3a49fe[_0x2ea6('0x35')]);db[_0x2ea6('0x2f')][_0x2ea6('0x60')](_0x2ea6('0x5d'))[_0x2ea6('0x1e')](function(_0x3e2cc3){if(_['isNil'](_0x3e2cc3)){_0x3a49fe['internal']=_0x2573c1[_0x2ea6('0x61')]||0x1;return;}if(_[_0x2ea6('0x62')](_0x2573c1[_0x2ea6('0x61')])||_0x2573c1['min_internal']===_0x3e2cc3){_0x3a49fe[_0x2ea6('0x5d')]=_0x3e2cc3+0x1;return;}if(_0x2573c1['min_internal']>_0x3e2cc3){_0x3a49fe[_0x2ea6('0x5d')]=_0x2573c1['min_internal'];return;}return db['sequelize']['query'](_0x2ea6('0x63'),{'type':db[_0x2ea6('0x64')][_0x2ea6('0x65')][_0x2ea6('0x66')]})['then'](function(_0x3b9ab3){if(_0x3b9ab3&&_0x3b9ab3[_0x2ea6('0x48')]){for(var _0x43d2d1=0x0,_0x18e7cd=_0x3b9ab3[_0x2ea6('0x48')];_0x43d2d1<_0x18e7cd&&_['isNil'](_0x3a49fe[_0x2ea6('0x5d')]);_0x43d2d1++){if(_0x2573c1['min_internal']<=_0x3b9ab3[_0x43d2d1][_0x2ea6('0x67')]){_0x3a49fe[_0x2ea6('0x5d')]=_0x3b9ab3[_0x43d2d1][_0x2ea6('0x67')];}else if(_0x2573c1[_0x2ea6('0x61')]>_0x3b9ab3[_0x43d2d1]['from']&&_0x2573c1['min_internal']<=_0x3b9ab3[_0x43d2d1]['to']){_0x3a49fe[_0x2ea6('0x5d')]=_0x2573c1['min_internal'];}}}if(_[_0x2ea6('0x62')](_0x3a49fe[_0x2ea6('0x5d')])){_0x3a49fe[_0x2ea6('0x5d')]=_0x3e2cc3+0x1;}return _0x4694fc(_0x3a49fe);});});})[_0x2ea6('0x4f')](function(_0x35c5ff){_0x4b7990(_0x35c5ff);});});}function updateUser(_0x56a58c){return new Promise(function(_0x316f4a,_0x37312a){try{if(_0x56a58c['voicemail']){_0x56a58c[_0x2ea6('0x68')]=_0x56a58c[_0x2ea6('0x5d')];_0x56a58c['VoiceMail']={'mailbox':_0x56a58c[_0x2ea6('0x5d')],'password':_0x56a58c['password'],'fullname':_0x56a58c['fullname'],'email':_0x56a58c[_0x2ea6('0x69')]};}if(_0x56a58c[_0x2ea6('0x1b')]===_0x2ea6('0x1c')){if(!_0x56a58c[_0x2ea6('0x6a')])_0x56a58c[_0x2ea6('0x6a')]=[_0x2ea6('0x6b'),'102',_0x2ea6('0x6c'),_0x2ea6('0x6d'),'110',_0x2ea6('0x6e'),'105',_0x2ea6('0x6f'),_0x2ea6('0x70'),'108',_0x2ea6('0x71'),_0x2ea6('0x72'),_0x2ea6('0x73'),_0x2ea6('0x74'),'115'];}_0x316f4a(_0x56a58c);}catch(_0x3f3e6d){_0x37312a(_0x3f3e6d);}});}exports[_0x2ea6('0x75')]=function(_0x1ad880,_0x1b73c){if(_0x1ad880[_0x2ea6('0x21')][_0x2ea6('0x1b')]===_0x2ea6('0x1c'))throw new Error(_0x2ea6('0x76'));if(_0x1ad880['body']['role']===_0x2ea6('0x21')&&_0x1ad880['user'][_0x2ea6('0x1b')]!==_0x2ea6('0x1f')){throw new Error(_0x2ea6('0x77'));}if(_0x1ad880['body'][_0x2ea6('0x1b')]==='admin'&&_0x1ad880['user'][_0x2ea6('0x1b')]!=='admin'){throw new Error(_0x2ea6('0x78'));}return licenseUtil['checkUserLimits']([_0x1ad880[_0x2ea6('0x57')]])['then'](function(){return validateUser(_0x1ad880[_0x2ea6('0x57')]);})[_0x2ea6('0x1e')](function(_0x1762fe){return updateUser(_0x1762fe)[_0x2ea6('0x1e')](function(_0x13fb0e){if(_0x13fb0e[_0x2ea6('0x1b')]===_0x2ea6('0x1f')){_0x13fb0e[_0x2ea6('0x79')]=_0x1ad880[_0x2ea6('0x21')][_0x2ea6('0x79')];delete _0x13fb0e[_0x2ea6('0x7a')];}return _0x13fb0e;});})[_0x2ea6('0x1e')](function(_0x412554){return db['User']['create'](_0x412554,{'include':[{'model':db[_0x2ea6('0x7b')],'as':'VoiceMail'}]});})[_0x2ea6('0x1e')](function(_0x3fad72){if(_0x1ad880[_0x2ea6('0x57')][_0x2ea6('0x1b')]===_0x2ea6('0x21'))return _0x3fad72;if(_0x1ad880[_0x2ea6('0x21')][_0x2ea6('0x1b')]!==_0x2ea6('0x21'))return _0x3fad72;return db[_0x2ea6('0x7c')][_0x2ea6('0x28')]({'where':{'name':_0x3fad72['role']==='agent'?_0x2ea6('0x22'):'Telephones','userProfileId':_0x1ad880[_0x2ea6('0x21')][_0x2ea6('0x7a')]},'raw':!![]})[_0x2ea6('0x1e')](function(_0x220b6f){if(!_0x220b6f||_0x220b6f['autoAssociation']!=0x0)return _0x3fad72;return db[_0x2ea6('0x2a')][_0x2ea6('0x75')]({'name':_0x3fad72[_0x2ea6('0x29')],'resourceId':_0x3fad72['id'],'type':_0x220b6f[_0x2ea6('0x29')],'sectionId':_0x220b6f['id']},{})[_0x2ea6('0x1e')](function(){return _0x3fad72;});})['catch'](function(_0xcbcb0c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcbcb0c);throw _0xcbcb0c;});})[_0x2ea6('0x1e')](respondWithResult(_0x1b73c,0xc9))[_0x2ea6('0x4f')](handleError(_0x1b73c,null));};exports['bulkCreate']=function(_0x384dba,_0x4860d8){var _0x1b29d0=_0x384dba[_0x2ea6('0x57')];var _0xf88a02=[];if(_0x384dba[_0x2ea6('0x21')][_0x2ea6('0x1b')]==='agent')throw new Error(_0x2ea6('0x76'));if(_['some'](_0x1b29d0,[_0x2ea6('0x1b'),_0x2ea6('0x21')])&&_0x384dba[_0x2ea6('0x21')][_0x2ea6('0x1b')]!==_0x2ea6('0x1f')){throw new Error(_0x2ea6('0x77'));}if(_[_0x2ea6('0x7d')](_0x1b29d0,[_0x2ea6('0x1b'),'admin'])&&_0x384dba[_0x2ea6('0x21')][_0x2ea6('0x1b')]!=='admin'){throw new Error(_0x2ea6('0x7e'));}return licenseUtil['checkUserLimits'](_0x1b29d0)[_0x2ea6('0x1e')](function(){return validateUser(_0x1b29d0[0x0]);})[_0x2ea6('0x1e')](function(){for(var _0x4c6eaa=0x1;_0x4c6eaa<_0x1b29d0['length'];_0x4c6eaa++){var _0x1dce6d=_0x1b29d0[_0x4c6eaa-0x1][_0x2ea6('0x5d')];if(!_0x1b29d0[_0x4c6eaa][_0x2ea6('0x5d')])_0x1b29d0[_0x4c6eaa][_0x2ea6('0x5d')]=_0x1dce6d+0x1;_0xf88a02[_0x2ea6('0x45')](validateUser(_0x1b29d0[_0x4c6eaa]));}return Promise[_0x2ea6('0x55')](_0xf88a02);})[_0x2ea6('0x1e')](function(){_0xf88a02=[];for(var _0x5b5596=0x0;_0x5b5596<_0x1b29d0['length'];_0x5b5596++){_0xf88a02[_0x2ea6('0x45')](updateUser(_0x1b29d0[_0x5b5596]));}return Promise[_0x2ea6('0x55')](_0xf88a02);})['then'](function(){_0xf88a02=_0x1b29d0[_0x2ea6('0x26')](function(_0x1ddb74){return db[_0x2ea6('0x2f')]['create'](_0x1ddb74,{'include':[{'model':db['VoiceMail'],'as':_0x2ea6('0x7b')}]})[_0x2ea6('0x1e')](function(_0x1efae0){_0x1ddb74['id']=_0x1efae0['id'];return _0x1ddb74;});});return Promise[_0x2ea6('0x55')](_0xf88a02);})[_0x2ea6('0x1e')](function(_0x38f8b2){if(_0x384dba['body'][_0x2ea6('0x1b')]==='user')return _0x38f8b2;if(_0x384dba['user'][_0x2ea6('0x1b')]!==_0x2ea6('0x21'))return _0x38f8b2;var _0x5a88eb=_[_0x2ea6('0x7d')](_0x38f8b2,function(_0x3e3bf2){return _0x3e3bf2['role']===_0x2ea6('0x1c')||_0x3e3bf2[_0x2ea6('0x1b')]===_0x2ea6('0x24');});if(!_0x5a88eb)return _0x38f8b2;return db[_0x2ea6('0x7c')][_0x2ea6('0x46')]({'where':{'name':{'$or':[_0x2ea6('0x22'),'Telephones']},'userProfileId':_0x384dba[_0x2ea6('0x21')][_0x2ea6('0x7a')]},'raw':!![]})[_0x2ea6('0x1e')](function(_0x1bebe5){if(_[_0x2ea6('0x7f')](_0x1bebe5)||!_[_0x2ea6('0x7d')](_0x1bebe5,['autoAssociation',0x0]))return _0x38f8b2;_0xf88a02=[];var _0x453d3c=_(_0x1bebe5)[_0x2ea6('0x26')](function(_0x72f30e){if(_0x72f30e['autoAssociation']===0x1)return;return _0x72f30e['name']==='Agents'?_0x2ea6('0x1c'):_0x2ea6('0x24');})[_0x2ea6('0x80')]()['value']();for(var _0x18c646=0x0;_0x18c646<_0x38f8b2['length'];_0x18c646++){if(!_[_0x2ea6('0x3a')](_0x453d3c,_0x38f8b2[_0x18c646][_0x2ea6('0x1b')]))return;var _0x11eac0=_0x38f8b2[_0x18c646][_0x2ea6('0x1b')]===_0x2ea6('0x1c')?'Agents':'Telephones';_0xf88a02['push'](db['UserProfileResource'][_0x2ea6('0x75')]({'name':_0x38f8b2[_0x18c646][_0x2ea6('0x29')],'resourceId':_0x38f8b2[_0x18c646]['id'],'type':_0x11eac0,'sectionId':_[_0x2ea6('0x28')](_0x1bebe5,[_0x2ea6('0x29'),_0x11eac0])['id']},{}));}return Promise['all'](_0xf88a02);});})['then'](respondWithResult(_0x4860d8,0xc9))[_0x2ea6('0x4f')](handleError(_0x4860d8,null));};exports[_0x2ea6('0x81')]=function(_0x137a7e,_0x5f3c3e){if(_0x137a7e['body']['id']){delete _0x137a7e[_0x2ea6('0x57')]['id'];}return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x137a7e['params']['id']}})[_0x2ea6('0x1e')](function(_0x515f0a){if(!_0x515f0a)return null;if(_0x515f0a['id']===_0x137a7e['user']['id']){if(!_0x137a7e['body'][_0x2ea6('0x82')]||!_0x137a7e[_0x2ea6('0x57')][_0x2ea6('0x83')]){throw new db[(_0x2ea6('0x84'))][(_0x2ea6('0x85'))](_0x2ea6('0x86'));}if(!_0x515f0a[_0x2ea6('0x87')](_0x137a7e[_0x2ea6('0x57')][_0x2ea6('0x82')])){throw new db[(_0x2ea6('0x84'))][(_0x2ea6('0x85'))](_0x2ea6('0x88'));}if(_0x137a7e[_0x2ea6('0x57')]['oldPassword']===_0x137a7e[_0x2ea6('0x57')][_0x2ea6('0x83')]){throw new db[(_0x2ea6('0x84'))][(_0x2ea6('0x85'))](_0x2ea6('0x89'));}}else if(_0x137a7e['user']['role']===_0x2ea6('0x1f')){if(!_0x137a7e[_0x2ea6('0x57')][_0x2ea6('0x83')]){throw new db[(_0x2ea6('0x84'))][(_0x2ea6('0x85'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x137a7e[_0x2ea6('0x21')][_0x2ea6('0x1b')]==='user'){if(!_0x137a7e['body']['newPassword']){throw new db['Sequelize'][(_0x2ea6('0x85'))](_0x2ea6('0x8a'));}if(_0x515f0a[_0x2ea6('0x1b')]!==_0x2ea6('0x1c')){throw new db[(_0x2ea6('0x84'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0x2ea6('0x84'))]['ValidationError'](_0x2ea6('0x76'));}return _0x515f0a;})[_0x2ea6('0x1e')](handleEntityNotFound(_0x5f3c3e,null))['then'](function(_0x2a1858){return db[_0x2ea6('0x8b')][_0x2ea6('0x8c')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x2ea6('0x8d')]})[_0x2ea6('0x1e')](function(_0x26f350){if(_0x26f350[_0x2ea6('0x5e')])authService['validatePasswordPattern'](_0x137a7e[_0x2ea6('0x57')][_0x2ea6('0x83')]);if(!_0x26f350['enforcePasswordHistory']||!_0x2a1858[_0x2ea6('0x36')])return _0x2a1858;authService[_0x2ea6('0x8e')](_0x137a7e[_0x2ea6('0x57')][_0x2ea6('0x83')],_0x2a1858[_0x2ea6('0x36')],_0x26f350[_0x2ea6('0x8d')]);return _0x2a1858;})[_0x2ea6('0x1e')](saveUpdates({'password':_0x137a7e[_0x2ea6('0x57')][_0x2ea6('0x83')],'passwordResetAt':_0x137a7e[_0x2ea6('0x21')]['id']==_0x137a7e['params']['id']?moment():null,'previousPasswords':authService[_0x2ea6('0x8f')](_0x137a7e[_0x2ea6('0x57')]['newPassword'],_0x2a1858[_0x2ea6('0x36')])},null));})['then'](respondWithResult(_0x5f3c3e,null))[_0x2ea6('0x4f')](handleError(_0x5f3c3e,null));};exports[_0x2ea6('0x90')]=function(_0x85968d,_0x195bab){var _0x494454=_0x85968d['body'][_0x2ea6('0x91')];return db[_0x2ea6('0x2f')]['find']({'where':{'id':_0x85968d[_0x2ea6('0x5a')]['id']},'attributes':['id',_0x2ea6('0x29'),_0x2ea6('0x1b'),_0x2ea6('0x92'),_0x2ea6('0x93'),_0x2ea6('0x94'),_0x2ea6('0x95')]})['then'](handleEntityNotFound(_0x195bab,null))['then'](function(_0x57f33d){if(_0x57f33d){if(!utils['isValidChannel'](_0x494454)){throw new db[(_0x2ea6('0x84'))][(_0x2ea6('0x85'))](_0x2ea6('0x96'));}return _0x57f33d[_0x2ea6('0x97')+_[_0x2ea6('0x98')](_0x494454[_0x2ea6('0x99')]())+'Queues'](_0x85968d['body'][_0x2ea6('0x5b')],{'penalty':_0x85968d[_0x2ea6('0x57')][_0x2ea6('0x9a')]||0x0})[_0x2ea6('0x9b')](function(_0x49f5ea){for(var _0x36559a=0x0;_0x36559a<_0x85968d[_0x2ea6('0x57')][_0x2ea6('0x5b')][_0x2ea6('0x48')];_0x36559a+=0x1){var _0x6e5bf1={'UserId':Number(_0x85968d['params']['id'])};_0x6e5bf1[_[_0x2ea6('0x98')](_0x494454[_0x2ea6('0x99')]())+_0x2ea6('0x9c')]=Number(_0x85968d[_0x2ea6('0x57')][_0x2ea6('0x5b')][_0x36559a]);socket[_0x2ea6('0x9d')]('user'+_[_0x2ea6('0x98')](_0x494454[_0x2ea6('0x99')]())+_0x2ea6('0x9e'),_0x6e5bf1);}return _0x49f5ea;})[_0x2ea6('0x1e')](function(){if(_0x494454===_0x2ea6('0x9f')){return db[_0x2ea6('0xa0')][_0x2ea6('0x46')]({'where':{'id':_0x85968d[_0x2ea6('0x57')]['ids']||[]},'raw':!![],'attributes':['id',_0x2ea6('0x29')]});}})[_0x2ea6('0x1e')](function(_0x19133f){var _0x4003ea=_0x57f33d[_0x2ea6('0xa1')]({'plain':!![]});var _0x315b54=[];if(_0x494454===_0x2ea6('0x9f')&&_0x4003ea[_0x2ea6('0x1b')]===_0x2ea6('0x1c')&&_0x4003ea[_0x2ea6('0x92')]){for(let _0x49d1a5=0x0;_0x49d1a5<_0x19133f[_0x2ea6('0x48')];_0x49d1a5+=0x1){_0x315b54[_0x2ea6('0x45')]({'membername':_0x4003ea['name'],'UserId':_0x4003ea['id'],'queue_name':_0x19133f[_0x49d1a5][_0x2ea6('0x29')],'VoiceQueueId':_0x19133f[_0x49d1a5]['id'],'interface':_[_0x2ea6('0x62')](_0x4003ea[_0x2ea6('0x95')])?util[_0x2ea6('0xa2')](_0x2ea6('0xa3'),_0x4003ea[_0x2ea6('0x29')]):_0x4003ea[_0x2ea6('0x95')],'paused':_0x4003ea[_0x2ea6('0x94')]||![],'penalty':_0x85968d[_0x2ea6('0x57')][_0x2ea6('0x9a')]||0x0});}return Promise[_0x2ea6('0x55')](_0x315b54['map'](function(_0x57b669){return db[_0x2ea6('0xa4')][_0x2ea6('0xa5')](_0x57b669);}));}return _0x57f33d;});}})[_0x2ea6('0x1e')](respondWithStatusCode(_0x195bab,null))['catch'](handleError(_0x195bab,null));};exports['removeQueues']=function(_0x1d2ac6,_0x42952c){var _0x57c6f7,_0x359207;return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x1d2ac6[_0x2ea6('0x5a')]['id']},'attributes':['id','name',_0x2ea6('0x1b')]})['then'](handleEntityNotFound(_0x42952c,null))['then'](function(_0x1c8e35){if(_0x1c8e35){_0x57c6f7=_0x1c8e35;if(!_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x91')]||!utils[_0x2ea6('0xa6')](_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x91')])){throw new db[(_0x2ea6('0x84'))]['ValidationError'](_0x2ea6('0x96'));}return _0x1c8e35[_0x2ea6('0xa7')+_[_0x2ea6('0x98')](_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x91')][_0x2ea6('0x99')]())+_0x2ea6('0xa8')](_0x1d2ac6['query'][_0x2ea6('0x5b')]);}})[_0x2ea6('0x1e')](function(_0x2b99d6){if(_[_0x2ea6('0xa9')](_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x5b')])){for(var _0x30ad6a=0x0;_0x30ad6a<_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x5b')][_0x2ea6('0x48')];_0x30ad6a+=0x1){_0x359207={'UserId':Number(_0x1d2ac6[_0x2ea6('0x5a')]['id'])};_0x359207[_['capitalize'](_0x1d2ac6['query']['channel'][_0x2ea6('0x99')]())+_0x2ea6('0x9c')]=Number(_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x5b')][_0x30ad6a]);socket[_0x2ea6('0x9d')](_0x2ea6('0x21')+_['capitalize'](_0x1d2ac6['query'][_0x2ea6('0x91')][_0x2ea6('0x99')]())+_0x2ea6('0xaa'),_0x359207);}}else{_0x359207={'UserId':Number(_0x1d2ac6['params']['id'])};_0x359207[_[_0x2ea6('0x98')](_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x91')]['toLowerCase']())+'QueueId']=Number(_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x5b')]);socket[_0x2ea6('0x9d')](_0x2ea6('0x21')+_['capitalize'](_0x1d2ac6[_0x2ea6('0x3f')]['channel'][_0x2ea6('0x99')]())+_0x2ea6('0xaa'),_0x359207);}return _0x2b99d6;})['then'](function(){if(_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x91')]==='voice'){return db['UserVoiceQueueRt'][_0x2ea6('0x1d')]({'where':{'UserId':_0x1d2ac6[_0x2ea6('0x5a')]['id'],'VoiceQueueId':_0x1d2ac6[_0x2ea6('0x3f')][_0x2ea6('0x5b')]},'individualHooks':!![]})['then'](function(){return _0x57c6f7;});}return _0x57c6f7;})[_0x2ea6('0x1e')](respondWithStatusCode(_0x42952c,null))['catch'](handleError(_0x42952c,null));};exports[_0x2ea6('0xab')]=function(_0x54eea8,_0x213be6){_0x54eea8['body'][_0x2ea6('0xac')]=_0x54eea8[_0x2ea6('0xad')][_0x2ea6('0xae')];return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x54eea8[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x213be6,null))[_0x2ea6('0x1e')](saveUpdates(_0x54eea8['body'],null))[_0x2ea6('0x1e')](respondWithResult(_0x213be6,null))['catch'](handleError(_0x213be6,null));};exports['getAvatar']=function(_0x184ff3,_0x41b530){var _0x4f1b45=path[_0x2ea6('0xaf')](config[_0x2ea6('0xb0')],_0x2ea6('0xb1'));return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x184ff3[_0x2ea6('0x5a')]['id']},'attributes':['id',_0x2ea6('0xac')],'raw':!![]})[_0x2ea6('0x1e')](handleEntityNotFound(_0x41b530,null))[_0x2ea6('0x1e')](function(_0xbbb12){if(_0xbbb12){if(_[_0x2ea6('0x62')](_0xbbb12['userpic'])){return _0x41b530[_0x2ea6('0xb2')](_0x4f1b45);}else{if(!fs[_0x2ea6('0xb3')](path[_0x2ea6('0xaf')](config['root'],'server/files/images/',_0xbbb12[_0x2ea6('0xac')]))){return _0x41b530[_0x2ea6('0xb2')](_0x4f1b45);}return _0x41b530['download'](path[_0x2ea6('0xaf')](config[_0x2ea6('0xb0')],_0x2ea6('0xb4'),_0xbbb12[_0x2ea6('0xac')]));}}})['catch'](handleError(_0x41b530,null));};exports[_0x2ea6('0xb5')]=function(_0x570463,_0xd4b057){return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x570463['params']['id']},'attributes':['id']})[_0x2ea6('0x1e')](handleEntityNotFound(_0xd4b057,null))[_0x2ea6('0x1e')](function(_0x2555b9){var _0x571d31=[];values=_0x2555b9[_0x2ea6('0x4a')];_0x571d31[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x53'),_0x2555b9[_0x2ea6('0x4a')]));_0x571d31[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4b'),_0x2555b9[_0x2ea6('0x4a')]));_0x571d31[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x4d'),_0x2555b9[_0x2ea6('0x4a')]));_0x571d31['push'](get_open_tabs(_0x2ea6('0x4e'),_0x2555b9[_0x2ea6('0x4a')]));_0x571d31[_0x2ea6('0x45')](get_open_tabs(_0x2ea6('0x54'),_0x2555b9[_0x2ea6('0x4a')]));_0x571d31['push'](get_open_tabs('mail',_0x2555b9[_0x2ea6('0x4a')]));return Promise['all'](_0x571d31);})[_0x2ea6('0x1e')](function(_0xfd5a63){if(_0xfd5a63){var _0x7a2823=_[_0x2ea6('0x26')](values[_0x2ea6('0xb6')],function(_0x38d1c3){return{'channel':'CHAT','id':_0x38d1c3['id'],'createdAt':_0x38d1c3[_0x2ea6('0xb7')]};});var _0x570e38=_[_0x2ea6('0x26')](values[_0x2ea6('0xb8')],function(_0x2c4437){return{'channel':_0x2ea6('0xb9'),'id':_0x2c4437['id'],'createdAt':_0x2c4437[_0x2ea6('0xb7')]};});var _0x541a96=_[_0x2ea6('0x26')](values[_0x2ea6('0xba')],function(_0x1d8038){return{'channel':_0x2ea6('0xbb'),'id':_0x1d8038['id'],'createdAt':_0x1d8038['createdAt']};});var _0x5dae95=_[_0x2ea6('0x26')](values[_0x2ea6('0xbc')],function(_0x48dab1){return{'channel':_0x2ea6('0xbd'),'id':_0x48dab1['id'],'createdAt':_0x48dab1[_0x2ea6('0xb7')]};});var _0xeb2740=_[_0x2ea6('0x26')](values[_0x2ea6('0xbe')],function(_0x380382){return{'channel':'SMS','id':_0x380382['id'],'createdAt':_0x380382[_0x2ea6('0xb7')]};});var _0x5f3ea3=_[_0x2ea6('0x26')](values['WhatsappOpenTabs'],function(_0xcb12ce){return{'channel':_0x2ea6('0xbf'),'id':_0xcb12ce['id'],'createdAt':_0xcb12ce[_0x2ea6('0xb7')]};});var _0x65cde8=_[_0x2ea6('0xc0')](_0x7a2823,_0x570e38,_0x541a96,_0x5dae95,_0xeb2740,_0x5f3ea3);var _0x3e421f={'count':_0x65cde8[_0x2ea6('0x48')],'rows':_0x65cde8};return _0x3e421f;}else return null;})['then'](respondWithResult(_0xd4b057,null))['catch'](handleError(_0xd4b057,null));};exports[_0x2ea6('0xc1')]=function(_0x57ae5f,_0x3109ce){var _0x845317={};return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x57ae5f[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](function(_0x5d25de){if(!_0x5d25de){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x57ae5f[_0x2ea6('0x5a')]['id']));}return contacts[_0x2ea6('0x58')]();})['then'](function(_0x5b83bb){_0x57ae5f[_0x2ea6('0x3f')][_0x2ea6('0x2f')]=_0x57ae5f[_0x2ea6('0x5a')]['id'];_0x845317=qs['getOptions'](_0x5b83bb,_0x57ae5f);if(_0x57ae5f[_0x2ea6('0x3f')]['hasOwnProperty'](_0x2ea6('0x3e'))){_0x845317['include']=[{'model':db['CmList'],'as':_0x2ea6('0xc2'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x2ea6('0x29'),_0x2ea6('0xc3')],'where':_0x57ae5f['query']['tag']?{'id':_0x57ae5f[_0x2ea6('0x3f')][_0x2ea6('0xc4')]}:undefined,'required':_0x57ae5f[_0x2ea6('0x3f')][_0x2ea6('0xc4')]?!![]:![]}];}return contacts[_0x2ea6('0x46')](_0x57ae5f[_0x2ea6('0x3f')],_0x57ae5f[_0x2ea6('0x21')],_0x845317,_0x5b83bb);})['then'](respondWithFilteredResult(_0x3109ce,_0x845317))[_0x2ea6('0x4f')](APIHandleError(_0x3109ce));};exports[_0x2ea6('0xc5')]=function(_0x2f00b4,_0x2a06bd){var _0x24601f;var _0x1ea61a={};var _0x1e5345;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x2f00b4['params']['id']},'attributes':['id',_0x2ea6('0x29'),_0x2ea6('0x1b')]})[_0x2ea6('0x1e')](handleEntityNotFound(_0x2a06bd,null))[_0x2ea6('0x1e')](function(_0x1a953e){if(!utils['isValidChannel'](_0x2f00b4[_0x2ea6('0x3f')]['channel'])){throw new db[(_0x2ea6('0x84'))][(_0x2ea6('0x85'))](_0x2ea6('0x96'));}_0x24601f=_0x1a953e;var _0xed3ae7={};_0xed3ae7['model']=_[_0x2ea6('0xc6')](db[_[_0x2ea6('0x98')](_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0x91')])+_0x2ea6('0xc7')]['rawAttributes']);_0xed3ae7[_0x2ea6('0x3f')]=_['keys'](_0x2f00b4[_0x2ea6('0x3f')]);_0xed3ae7[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0xed3ae7[_0x2ea6('0xca')],_0xed3ae7[_0x2ea6('0x3f')]);_0x1ea61a[_0x2ea6('0x44')]=_['intersection'](_0xed3ae7['model'],qs[_0x2ea6('0xcb')](_0x2f00b4[_0x2ea6('0x3f')]['fields']));_0x1ea61a[_0x2ea6('0x44')]=_0x1ea61a['attributes'][_0x2ea6('0x48')]?_0x1ea61a[_0x2ea6('0x44')]:_0xed3ae7[_0x2ea6('0xca')];_0x1ea61a[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0xcd')]);_0x1ea61a['where']=qs[_0x2ea6('0xc8')](_['pick'](_0x2f00b4['query'],_0xed3ae7[_0x2ea6('0xc8')]));if(_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0x34')]){_0x1ea61a['where']=_[_0x2ea6('0x51')](_0x1ea61a[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0x1ea61a['attributes'],function(_0x21356e){var _0x4e3c5b={};_0x4e3c5b[_0x21356e]={'$like':'%'+_0x2f00b4['query'][_0x2ea6('0x34')]+'%'};return _0x4e3c5b;})});}_0x1ea61a=_[_0x2ea6('0x51')]({},_0x1ea61a,_0x2f00b4['options']);switch(_0x24601f[_0x2ea6('0x1b')]){case _0x2ea6('0x1f'):return db[_[_0x2ea6('0x98')](_0x2f00b4['query'][_0x2ea6('0x91')])+'Queue']['findAll'](_0x1ea61a);case _0x2ea6('0x21'):case _0x2ea6('0x1c'):return _0x24601f['get'+_[_0x2ea6('0x98')](_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0x91')])+'Queues'](_0x1ea61a);default:throw new db[(_0x2ea6('0x84'))]['ValidationError']('Unknown\x20role');}})[_0x2ea6('0x1e')](function(_0x524249){_0x1e5345=_0x524249[_0x2ea6('0x48')];if(!_0x2f00b4[_0x2ea6('0x3f')]['hasOwnProperty'](_0x2ea6('0xce'))){_0x1ea61a[_0x2ea6('0xcf')]=qs['limit'](_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0x1ea61a[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}switch(_0x24601f[_0x2ea6('0x1b')]){case _0x2ea6('0x1f'):return db[_[_0x2ea6('0x98')](_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0x91')])+_0x2ea6('0xc7')]['findAll'](_0x1ea61a);case _0x2ea6('0x21'):case _0x2ea6('0x1c'):return _0x24601f[_0x2ea6('0xa1')+_[_0x2ea6('0x98')](_0x2f00b4[_0x2ea6('0x3f')][_0x2ea6('0x91')])+_0x2ea6('0xa8')](_0x1ea61a);}})['then'](function(_0x479729){return{'count':_0x1e5345,'rows':_0x479729};})[_0x2ea6('0x1e')](respondWithResult(_0x2a06bd,null))['catch'](handleError(_0x2a06bd,null));};exports[_0x2ea6('0xd0')]=function(_0x34b10b,_0x2a061c){var _0x54a6a5={};var _0x4191a1={};var _0x5bc2a3;var _0x59e946;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x34b10b[_0x2ea6('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2a061c,null))['then'](function(_0x1e89a5){if(_0x1e89a5){_0x5bc2a3=_0x1e89a5;_0x4191a1[_0x2ea6('0xca')]=_['keys'](db[_0x2ea6('0xa4')][_0x2ea6('0x30')]);_0x4191a1['query']=_[_0x2ea6('0xc6')](_0x34b10b[_0x2ea6('0x3f')]);_0x4191a1[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x4191a1['model'],_0x4191a1[_0x2ea6('0x3f')]);_0x54a6a5[_0x2ea6('0x44')]=_['intersection'](_0x4191a1['model'],qs[_0x2ea6('0xcb')](_0x34b10b[_0x2ea6('0x3f')][_0x2ea6('0xcb')]));_0x54a6a5[_0x2ea6('0x44')]=_0x54a6a5[_0x2ea6('0x44')]['length']?_0x54a6a5['attributes']:_0x4191a1[_0x2ea6('0xca')];_0x54a6a5['order']=qs[_0x2ea6('0xcd')](_0x34b10b[_0x2ea6('0x3f')][_0x2ea6('0xcd')]);_0x54a6a5[_0x2ea6('0x3d')]=qs['filters'](_[_0x2ea6('0xd1')](_0x34b10b[_0x2ea6('0x3f')],_0x4191a1[_0x2ea6('0xc8')]));if(_0x34b10b['query'][_0x2ea6('0x34')]){_0x54a6a5[_0x2ea6('0x3d')]=_[_0x2ea6('0x51')](_0x54a6a5[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0x54a6a5['attributes'],function(_0x7ae6b9){var _0x4941b1={};_0x4941b1[_0x7ae6b9]={'$like':'%'+_0x34b10b['query']['filter']+'%'};return _0x4941b1;})});}_0x54a6a5=_[_0x2ea6('0x51')]({},_0x54a6a5,_0x34b10b['options']);return _0x5bc2a3[_0x2ea6('0xd0')](_0x54a6a5);}})['then'](function(_0x367b77){if(_0x367b77){_0x59e946=_0x367b77[_0x2ea6('0x48')];if(!_0x34b10b[_0x2ea6('0x3f')][_0x2ea6('0xd2')](_0x2ea6('0xce'))){_0x54a6a5[_0x2ea6('0xcf')]=qs[_0x2ea6('0xcf')](_0x34b10b[_0x2ea6('0x3f')]['limit']);_0x54a6a5[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x34b10b[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}return _0x5bc2a3[_0x2ea6('0xd0')](_0x54a6a5);}})[_0x2ea6('0x1e')](function(_0x475091){if(_0x475091){return _0x475091?{'count':_0x59e946,'rows':_0x475091}:null;}})[_0x2ea6('0x1e')](respondWithResult(_0x2a061c,null))[_0x2ea6('0x4f')](handleError(_0x2a061c,null));};exports[_0x2ea6('0xd3')]=function(_0x1cfee3,_0xe80a4){var _0x401192={};var _0xe751b2={};var _0x3759ba;var _0x2c499f;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x1cfee3[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0xe80a4,null))[_0x2ea6('0x1e')](function(_0x1d37e8){if(_0x1d37e8){_0x3759ba=_0x1d37e8;_0xe751b2[_0x2ea6('0xca')]=_[_0x2ea6('0xc6')](db['ChatGroup'][_0x2ea6('0x30')]);_0xe751b2[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x1cfee3[_0x2ea6('0x3f')]);_0xe751b2[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0xe751b2['model'],_0xe751b2[_0x2ea6('0x3f')]);_0x401192[_0x2ea6('0x44')]=_[_0x2ea6('0xc9')](_0xe751b2['model'],qs['fields'](_0x1cfee3[_0x2ea6('0x3f')][_0x2ea6('0xcb')]));_0x401192[_0x2ea6('0x44')]=_0x401192['attributes'][_0x2ea6('0x48')]?_0x401192[_0x2ea6('0x44')]:_0xe751b2[_0x2ea6('0xca')];_0x401192['order']=qs[_0x2ea6('0xcd')](_0x1cfee3[_0x2ea6('0x3f')][_0x2ea6('0xcd')]);_0x401192[_0x2ea6('0x3d')]=qs['filters'](_[_0x2ea6('0xd1')](_0x1cfee3['query'],_0xe751b2[_0x2ea6('0xc8')]));if(_0x1cfee3[_0x2ea6('0x3f')][_0x2ea6('0x34')]){_0x401192[_0x2ea6('0x3d')]=_['merge'](_0x401192[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0x401192[_0x2ea6('0x44')],function(_0x181aa2){var _0x574027={};_0x574027[_0x181aa2]={'$like':'%'+_0x1cfee3[_0x2ea6('0x3f')][_0x2ea6('0x34')]+'%'};return _0x574027;})});}_0x401192=_[_0x2ea6('0x51')]({},_0x401192,_0x1cfee3[_0x2ea6('0x52')]);return _0x3759ba[_0x2ea6('0xd3')](_0x401192);}})['then'](function(_0x120002){if(_0x120002){_0x2c499f=_0x120002[_0x2ea6('0x48')];if(!_0x1cfee3[_0x2ea6('0x3f')]['hasOwnProperty']('nolimit')){_0x401192[_0x2ea6('0xcf')]=qs['limit'](_0x1cfee3[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0x401192[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x1cfee3[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}return _0x3759ba[_0x2ea6('0xd3')](_0x401192);}})['then'](function(_0x53e6e5){if(_0x53e6e5){return _0x53e6e5?{'count':_0x2c499f,'rows':_0x53e6e5}:null;}})[_0x2ea6('0x1e')](respondWithResult(_0xe80a4,null))[_0x2ea6('0x4f')](handleError(_0xe80a4,null));};exports[_0x2ea6('0xd4')]=function(_0x5038b8,_0xc3a524){var _0x557c3b={'raw':!![],'where':{}};var _0x261ac7={};var _0x6414b={'count':0x0,'rows':[]};return db['User'][_0x2ea6('0x8c')]({'where':{'id':_0x5038b8[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0xc3a524,null))[_0x2ea6('0x1e')](function(_0x2b8c4a){if(_0x2b8c4a){_0x261ac7[_0x2ea6('0xca')]=_['keys'](db[_0x2ea6('0xd5')][_0x2ea6('0x30')]);_0x261ac7['query']=_[_0x2ea6('0xc6')](_0x5038b8[_0x2ea6('0x3f')]);_0x261ac7[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x261ac7[_0x2ea6('0xca')],_0x261ac7[_0x2ea6('0x3f')]);_0x557c3b[_0x2ea6('0x44')]=_['intersection'](_0x261ac7[_0x2ea6('0xca')],qs[_0x2ea6('0xcb')](_0x5038b8[_0x2ea6('0x3f')][_0x2ea6('0xcb')]));_0x557c3b[_0x2ea6('0x44')]=_0x557c3b[_0x2ea6('0x44')][_0x2ea6('0x48')]?_0x557c3b[_0x2ea6('0x44')]:_0x261ac7[_0x2ea6('0xca')];if(!_0x5038b8[_0x2ea6('0x3f')][_0x2ea6('0xd2')](_0x2ea6('0xce'))){_0x557c3b[_0x2ea6('0xcf')]=qs[_0x2ea6('0xcf')](_0x5038b8[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0x557c3b['offset']=qs['offset'](_0x5038b8['query'][_0x2ea6('0x18')]);}_0x557c3b[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x5038b8['query'][_0x2ea6('0xcd')]);_0x557c3b['where']=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x5038b8['query'],_0x261ac7[_0x2ea6('0xc8')]));_0x557c3b['where'][_0x2ea6('0xd6')]=_0x2b8c4a['id'];if(_0x5038b8[_0x2ea6('0x3f')][_0x2ea6('0x34')]){_0x557c3b[_0x2ea6('0x3d')]=_[_0x2ea6('0x51')](_0x557c3b['where'],{'$or':_['map'](_0x557c3b['attributes'],function(_0x27657f){var _0x15fb45={};_0x15fb45[_0x27657f]={'$like':'%'+_0x5038b8[_0x2ea6('0x3f')][_0x2ea6('0x34')]+'%'};return _0x15fb45;})});}_0x557c3b=_['merge']({},_0x557c3b,_0x5038b8[_0x2ea6('0x52')]);return db[_0x2ea6('0xd5')]['count']({'where':_0x557c3b[_0x2ea6('0x3d')]})['then'](function(_0x5d8724){_0x6414b[_0x2ea6('0x19')]=_0x5d8724;if(_0x5038b8['query'][_0x2ea6('0x3e')]){_0x557c3b[_0x2ea6('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0x2ea6('0x46')](_0x557c3b);})[_0x2ea6('0x1e')](function(_0x240c28){_0x6414b[_0x2ea6('0x49')]=_0x240c28;return _0x6414b;});}})['then'](respondWithFilteredResult(_0xc3a524,_0x557c3b))[_0x2ea6('0x4f')](handleError(_0xc3a524,null));};exports[_0x2ea6('0xd7')]=function(_0x1b801f,_0x2fec08){var _0xca4004={'raw':!![],'where':{}};var _0x5c0ba3={};var _0xd630ee={'count':0x0,'rows':[]};return db['User'][_0x2ea6('0x8c')]({'where':{'id':_0x1b801f['params']['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x2fec08,null))['then'](function(_0x70c036){if(_0x70c036){_0x5c0ba3[_0x2ea6('0xca')]=_['keys'](db[_0x2ea6('0xd8')][_0x2ea6('0x30')]);_0x5c0ba3[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x1b801f[_0x2ea6('0x3f')]);_0x5c0ba3[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x5c0ba3[_0x2ea6('0xca')],_0x5c0ba3[_0x2ea6('0x3f')]);_0xca4004[_0x2ea6('0x44')]=_['intersection'](_0x5c0ba3[_0x2ea6('0xca')],qs[_0x2ea6('0xcb')](_0x1b801f['query'][_0x2ea6('0xcb')]));_0xca4004[_0x2ea6('0x44')]=_0xca4004[_0x2ea6('0x44')][_0x2ea6('0x48')]?_0xca4004[_0x2ea6('0x44')]:_0x5c0ba3[_0x2ea6('0xca')];if(!_0x1b801f[_0x2ea6('0x3f')][_0x2ea6('0xd2')](_0x2ea6('0xce'))){_0xca4004['limit']=qs[_0x2ea6('0xcf')](_0x1b801f[_0x2ea6('0x3f')]['limit']);_0xca4004[_0x2ea6('0x18')]=qs['offset'](_0x1b801f[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}_0xca4004[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x1b801f['query'][_0x2ea6('0xcd')]);_0xca4004[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x1b801f[_0x2ea6('0x3f')],_0x5c0ba3[_0x2ea6('0xc8')]));_0xca4004[_0x2ea6('0x3d')][_0x2ea6('0xd6')]=_0x70c036['id'];if(_0x1b801f['query'][_0x2ea6('0x34')]){_0xca4004[_0x2ea6('0x3d')]=_[_0x2ea6('0x51')](_0xca4004[_0x2ea6('0x3d')],{'$or':_['map'](_0xca4004['attributes'],function(_0x2b5620){var _0x1b4be2={};_0x1b4be2[_0x2b5620]={'$like':'%'+_0x1b801f['query'][_0x2ea6('0x34')]+'%'};return _0x1b4be2;})});}_0xca4004=_[_0x2ea6('0x51')]({},_0xca4004,_0x1b801f['options']);return db[_0x2ea6('0xd8')]['count']({'where':_0xca4004[_0x2ea6('0x3d')]})[_0x2ea6('0x1e')](function(_0x94b5a9){_0xd630ee[_0x2ea6('0x19')]=_0x94b5a9;if(_0x1b801f['query'][_0x2ea6('0x3e')]){_0xca4004[_0x2ea6('0x42')]=[{'all':!![]}];}return db[_0x2ea6('0xd8')][_0x2ea6('0x46')](_0xca4004);})['then'](function(_0x17f0fa){_0xd630ee[_0x2ea6('0x49')]=_0x17f0fa;return _0xd630ee;});}})[_0x2ea6('0x1e')](respondWithFilteredResult(_0x2fec08,_0xca4004))[_0x2ea6('0x4f')](handleError(_0x2fec08,null));};exports[_0x2ea6('0xd9')]=function(_0x4a4d40,_0x1445c6){var _0x7bb9be={};var _0x4bedc3={};var _0x5ddd53;var _0x51333d;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x4a4d40['params']['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x1445c6,null))['then'](function(_0x497eb0){if(_0x497eb0){_0x5ddd53=_0x497eb0;_0x4bedc3[_0x2ea6('0xca')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0x4bedc3[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x4a4d40[_0x2ea6('0x3f')]);_0x4bedc3[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x4bedc3['model'],_0x4bedc3[_0x2ea6('0x3f')]);_0x7bb9be[_0x2ea6('0x44')]=_[_0x2ea6('0xc9')](_0x4bedc3[_0x2ea6('0xca')],qs['fields'](_0x4a4d40['query']['fields']));_0x7bb9be['attributes']=_0x7bb9be[_0x2ea6('0x44')][_0x2ea6('0x48')]?_0x7bb9be['attributes']:_0x4bedc3[_0x2ea6('0xca')];_0x7bb9be['order']=qs[_0x2ea6('0xcd')](_0x4a4d40[_0x2ea6('0x3f')]['sort']);_0x7bb9be['where']=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x4a4d40['query'],_0x4bedc3[_0x2ea6('0xc8')]));if(_0x4a4d40['query']['filter']){_0x7bb9be[_0x2ea6('0x3d')]=_[_0x2ea6('0x51')](_0x7bb9be['where'],{'$or':_[_0x2ea6('0x26')](_0x7bb9be[_0x2ea6('0x44')],function(_0x51e886){var _0x2d8da7={};_0x2d8da7[_0x51e886]={'$like':'%'+_0x4a4d40['query']['filter']+'%'};return _0x2d8da7;})});}_0x7bb9be=_['merge']({},_0x7bb9be,_0x4a4d40[_0x2ea6('0x52')]);return _0x5ddd53['getChatInteractions'](_0x7bb9be);}})[_0x2ea6('0x1e')](function(_0x5306a0){if(_0x5306a0){_0x51333d=_0x5306a0['length'];if(!_0x4a4d40['query'][_0x2ea6('0xd2')](_0x2ea6('0xce'))){_0x7bb9be[_0x2ea6('0xcf')]=qs[_0x2ea6('0xcf')](_0x4a4d40[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0x7bb9be[_0x2ea6('0x18')]=qs['offset'](_0x4a4d40['query']['offset']);}return _0x5ddd53[_0x2ea6('0xd9')](_0x7bb9be);}})[_0x2ea6('0x1e')](function(_0x3325e2){if(_0x3325e2){return _0x3325e2?{'count':_0x51333d,'rows':_0x3325e2}:null;}})['then'](respondWithResult(_0x1445c6,null))['catch'](handleError(_0x1445c6,null));};exports[_0x2ea6('0xda')]=function(_0x303606,_0x2eb403){var _0x539c6b={};var _0x3f1e9a={};var _0x2ba10b;var _0xee33d5;return db['User'][_0x2ea6('0x8c')]({'where':{'id':_0x303606[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x2eb403,null))[_0x2ea6('0x1e')](function(_0x3e59fe){if(_0x3e59fe){_0x2ba10b=_0x3e59fe;_0x3f1e9a['model']=_[_0x2ea6('0xc6')](db['OpenchannelInteraction'][_0x2ea6('0x30')]);_0x3f1e9a[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x303606[_0x2ea6('0x3f')]);_0x3f1e9a[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x3f1e9a[_0x2ea6('0xca')],_0x3f1e9a['query']);_0x539c6b[_0x2ea6('0x44')]=_[_0x2ea6('0xc9')](_0x3f1e9a[_0x2ea6('0xca')],qs['fields'](_0x303606[_0x2ea6('0x3f')][_0x2ea6('0xcb')]));_0x539c6b[_0x2ea6('0x44')]=_0x539c6b[_0x2ea6('0x44')][_0x2ea6('0x48')]?_0x539c6b[_0x2ea6('0x44')]:_0x3f1e9a[_0x2ea6('0xca')];_0x539c6b[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x303606[_0x2ea6('0x3f')][_0x2ea6('0xcd')]);_0x539c6b[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x303606[_0x2ea6('0x3f')],_0x3f1e9a['filters']));if(_0x303606[_0x2ea6('0x3f')][_0x2ea6('0x34')]){_0x539c6b[_0x2ea6('0x3d')]=_['merge'](_0x539c6b[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0x539c6b[_0x2ea6('0x44')],function(_0x1e6072){var _0x17f15f={};_0x17f15f[_0x1e6072]={'$like':'%'+_0x303606[_0x2ea6('0x3f')][_0x2ea6('0x34')]+'%'};return _0x17f15f;})});}_0x539c6b=_[_0x2ea6('0x51')]({},_0x539c6b,_0x303606['options']);return _0x2ba10b[_0x2ea6('0xda')](_0x539c6b);}})[_0x2ea6('0x1e')](function(_0x1c5ab7){if(_0x1c5ab7){_0xee33d5=_0x1c5ab7['length'];if(!_0x303606[_0x2ea6('0x3f')][_0x2ea6('0xd2')](_0x2ea6('0xce'))){_0x539c6b[_0x2ea6('0xcf')]=qs['limit'](_0x303606[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0x539c6b[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x303606[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}return _0x2ba10b[_0x2ea6('0xda')](_0x539c6b);}})[_0x2ea6('0x1e')](function(_0x5e5f47){if(_0x5e5f47){return _0x5e5f47?{'count':_0xee33d5,'rows':_0x5e5f47}:null;}})[_0x2ea6('0x1e')](respondWithResult(_0x2eb403,null))[_0x2ea6('0x4f')](handleError(_0x2eb403,null));};exports['getMailInteractions']=function(_0x50fe42,_0x4e9418){var _0x4e2a94={'raw':!![],'where':{}};var _0x433919={};var _0x334d18={'count':0x0,'rows':[]};return db[_0x2ea6('0x2f')]['findOne']({'where':{'id':_0x50fe42[_0x2ea6('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4e9418,null))[_0x2ea6('0x1e')](function(_0x388eb8){if(_0x388eb8){_0x433919[_0x2ea6('0xca')]=_[_0x2ea6('0xc6')](db[_0x2ea6('0xdb')][_0x2ea6('0x30')]);_0x433919[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x50fe42[_0x2ea6('0x3f')]);_0x433919[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x433919[_0x2ea6('0xca')],_0x433919[_0x2ea6('0x3f')]);_0x4e2a94['attributes']=_[_0x2ea6('0xc9')](_0x433919[_0x2ea6('0xca')],qs[_0x2ea6('0xcb')](_0x50fe42[_0x2ea6('0x3f')][_0x2ea6('0xcb')]));_0x4e2a94[_0x2ea6('0x44')]=_0x4e2a94['attributes'][_0x2ea6('0x48')]?_0x4e2a94[_0x2ea6('0x44')]:_0x433919['model'];if(!_0x50fe42[_0x2ea6('0x3f')]['hasOwnProperty']('nolimit')){_0x4e2a94['limit']=qs[_0x2ea6('0xcf')](_0x50fe42[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0x4e2a94[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x50fe42[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}_0x4e2a94[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x50fe42[_0x2ea6('0x3f')]['sort']);_0x4e2a94[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x50fe42[_0x2ea6('0x3f')],_0x433919['filters']));_0x4e2a94[_0x2ea6('0x3d')][_0x2ea6('0xd6')]=_0x388eb8['id'];if(_0x50fe42['query']['filter']){_0x4e2a94['where']=_[_0x2ea6('0x51')](_0x4e2a94[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0x4e2a94['attributes'],function(_0x4c58cc){var _0x180cc4={};_0x180cc4[_0x4c58cc]={'$like':'%'+_0x50fe42['query']['filter']+'%'};return _0x180cc4;})});}_0x4e2a94=_[_0x2ea6('0x51')]({},_0x4e2a94,_0x50fe42[_0x2ea6('0x52')]);return db[_0x2ea6('0xdb')][_0x2ea6('0x19')]({'where':_0x4e2a94['where']})[_0x2ea6('0x1e')](function(_0x5cb1ae){_0x334d18['count']=_0x5cb1ae;if(_0x50fe42[_0x2ea6('0x3f')]['includeAll']){_0x4e2a94[_0x2ea6('0x42')]=[{'all':!![]}];}return db[_0x2ea6('0xdb')][_0x2ea6('0x46')](_0x4e2a94);})[_0x2ea6('0x1e')](function(_0x1f9773){_0x334d18[_0x2ea6('0x49')]=_0x1f9773;return _0x334d18;});}})['then'](respondWithFilteredResult(_0x4e9418,_0x4e2a94))[_0x2ea6('0x4f')](handleError(_0x4e9418,null));};exports[_0x2ea6('0xdc')]=function(_0x3614ad,_0x376d54){var _0x2b4e97={};var _0x2153c9={};var _0x2d9300;var _0x56065f;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x3614ad['params']['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x376d54,null))[_0x2ea6('0x1e')](function(_0x59ecc2){if(_0x59ecc2){_0x2d9300=_0x59ecc2;_0x2153c9['model']=_[_0x2ea6('0xc6')](db[_0x2ea6('0xdd')]['rawAttributes']);_0x2153c9[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x3614ad[_0x2ea6('0x3f')]);_0x2153c9[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x2153c9[_0x2ea6('0xca')],_0x2153c9['query']);_0x2b4e97[_0x2ea6('0x44')]=_[_0x2ea6('0xc9')](_0x2153c9[_0x2ea6('0xca')],qs[_0x2ea6('0xcb')](_0x3614ad['query'][_0x2ea6('0xcb')]));_0x2b4e97[_0x2ea6('0x44')]=_0x2b4e97[_0x2ea6('0x44')][_0x2ea6('0x48')]?_0x2b4e97[_0x2ea6('0x44')]:_0x2153c9[_0x2ea6('0xca')];_0x2b4e97['order']=qs['sort'](_0x3614ad[_0x2ea6('0x3f')]['sort']);_0x2b4e97[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x3614ad[_0x2ea6('0x3f')],_0x2153c9[_0x2ea6('0xc8')]));if(_0x3614ad[_0x2ea6('0x3f')][_0x2ea6('0x34')]){_0x2b4e97[_0x2ea6('0x3d')]=_[_0x2ea6('0x51')](_0x2b4e97['where'],{'$or':_[_0x2ea6('0x26')](_0x2b4e97['attributes'],function(_0x55c4e9){var _0x25c79d={};_0x25c79d[_0x55c4e9]={'$like':'%'+_0x3614ad['query']['filter']+'%'};return _0x25c79d;})});}_0x2b4e97=_[_0x2ea6('0x51')]({},_0x2b4e97,_0x3614ad['options']);return _0x2d9300[_0x2ea6('0xdc')](_0x2b4e97);}})['then'](function(_0x17bc8a){if(_0x17bc8a){_0x56065f=_0x17bc8a['length'];if(!_0x3614ad['query']['hasOwnProperty']('nolimit')){_0x2b4e97[_0x2ea6('0xcf')]=qs['limit'](_0x3614ad[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0x2b4e97[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x3614ad['query'][_0x2ea6('0x18')]);}return _0x2d9300[_0x2ea6('0xdc')](_0x2b4e97);}})[_0x2ea6('0x1e')](function(_0x110cd1){if(_0x110cd1){return _0x110cd1?{'count':_0x56065f,'rows':_0x110cd1}:null;}})['then'](respondWithResult(_0x376d54,null))[_0x2ea6('0x4f')](handleError(_0x376d54,null));};exports['getFaxInteractions']=function(_0x3ee9cc,_0x51448c){var _0x35c814={};var _0x4a0b85={};var _0x3057b9;var _0x8331bd;return db['User']['findOne']({'where':{'id':_0x3ee9cc['params']['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x51448c,null))[_0x2ea6('0x1e')](function(_0x18eb08){if(_0x18eb08){_0x3057b9=_0x18eb08;_0x4a0b85[_0x2ea6('0xca')]=_[_0x2ea6('0xc6')](db['FaxInteraction'][_0x2ea6('0x30')]);_0x4a0b85['query']=_['keys'](_0x3ee9cc[_0x2ea6('0x3f')]);_0x4a0b85['filters']=_[_0x2ea6('0xc9')](_0x4a0b85[_0x2ea6('0xca')],_0x4a0b85[_0x2ea6('0x3f')]);_0x35c814[_0x2ea6('0x44')]=_[_0x2ea6('0xc9')](_0x4a0b85[_0x2ea6('0xca')],qs[_0x2ea6('0xcb')](_0x3ee9cc['query'][_0x2ea6('0xcb')]));_0x35c814['attributes']=_0x35c814[_0x2ea6('0x44')]['length']?_0x35c814[_0x2ea6('0x44')]:_0x4a0b85[_0x2ea6('0xca')];_0x35c814[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x3ee9cc['query']['sort']);_0x35c814[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x3ee9cc[_0x2ea6('0x3f')],_0x4a0b85[_0x2ea6('0xc8')]));if(_0x3ee9cc[_0x2ea6('0x3f')][_0x2ea6('0x34')]){_0x35c814[_0x2ea6('0x3d')]=_['merge'](_0x35c814[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0x35c814[_0x2ea6('0x44')],function(_0x2cc9fb){var _0x4c1787={};_0x4c1787[_0x2cc9fb]={'$like':'%'+_0x3ee9cc[_0x2ea6('0x3f')][_0x2ea6('0x34')]+'%'};return _0x4c1787;})});}_0x35c814=_[_0x2ea6('0x51')]({},_0x35c814,_0x3ee9cc[_0x2ea6('0x52')]);return _0x3057b9[_0x2ea6('0xde')](_0x35c814);}})[_0x2ea6('0x1e')](function(_0x878234){if(_0x878234){_0x8331bd=_0x878234[_0x2ea6('0x48')];if(!_0x3ee9cc[_0x2ea6('0x3f')]['hasOwnProperty'](_0x2ea6('0xce'))){_0x35c814[_0x2ea6('0xcf')]=qs['limit'](_0x3ee9cc['query'][_0x2ea6('0xcf')]);_0x35c814['offset']=qs[_0x2ea6('0x18')](_0x3ee9cc[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}return _0x3057b9[_0x2ea6('0xde')](_0x35c814);}})['then'](function(_0x7e3806){if(_0x7e3806){return _0x7e3806?{'count':_0x8331bd,'rows':_0x7e3806}:null;}})[_0x2ea6('0x1e')](respondWithResult(_0x51448c,null))[_0x2ea6('0x4f')](handleError(_0x51448c,null));};exports['getWhatsappInteractions']=function(_0x102114,_0x19ae8b){var _0x15cb20={};var _0x4d0cfe={};var _0x176d0b;var _0x471a31;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x102114[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x19ae8b,null))[_0x2ea6('0x1e')](function(_0x17b50a){if(_0x17b50a){_0x176d0b=_0x17b50a;_0x4d0cfe[_0x2ea6('0xca')]=_[_0x2ea6('0xc6')](db[_0x2ea6('0xdf')][_0x2ea6('0x30')]);_0x4d0cfe[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x102114['query']);_0x4d0cfe[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x4d0cfe['model'],_0x4d0cfe[_0x2ea6('0x3f')]);_0x15cb20[_0x2ea6('0x44')]=_['intersection'](_0x4d0cfe['model'],qs[_0x2ea6('0xcb')](_0x102114['query'][_0x2ea6('0xcb')]));_0x15cb20[_0x2ea6('0x44')]=_0x15cb20[_0x2ea6('0x44')][_0x2ea6('0x48')]?_0x15cb20[_0x2ea6('0x44')]:_0x4d0cfe[_0x2ea6('0xca')];_0x15cb20[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x102114[_0x2ea6('0x3f')][_0x2ea6('0xcd')]);_0x15cb20[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x102114[_0x2ea6('0x3f')],_0x4d0cfe[_0x2ea6('0xc8')]));if(_0x102114['query'][_0x2ea6('0x34')]){_0x15cb20[_0x2ea6('0x3d')]=_[_0x2ea6('0x51')](_0x15cb20['where'],{'$or':_['map'](_0x15cb20['attributes'],function(_0x3bb980){var _0x2a9c1c={};_0x2a9c1c[_0x3bb980]={'$like':'%'+_0x102114[_0x2ea6('0x3f')][_0x2ea6('0x34')]+'%'};return _0x2a9c1c;})});}_0x15cb20=_[_0x2ea6('0x51')]({},_0x15cb20,_0x102114[_0x2ea6('0x52')]);return _0x176d0b[_0x2ea6('0xe0')](_0x15cb20);}})['then'](function(_0x39526f){if(_0x39526f){_0x471a31=_0x39526f['length'];if(!_0x102114[_0x2ea6('0x3f')][_0x2ea6('0xd2')](_0x2ea6('0xce'))){_0x15cb20[_0x2ea6('0xcf')]=qs[_0x2ea6('0xcf')](_0x102114[_0x2ea6('0x3f')]['limit']);_0x15cb20[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x102114[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}return _0x176d0b[_0x2ea6('0xe0')](_0x15cb20);}})['then'](function(_0x57b757){if(_0x57b757){return _0x57b757?{'count':_0x471a31,'rows':_0x57b757}:null;}})[_0x2ea6('0x1e')](respondWithResult(_0x19ae8b,null))[_0x2ea6('0x4f')](handleError(_0x19ae8b,null));};exports[_0x2ea6('0xe1')]=function(_0x397b29,_0x5dad63,_0x1cf186){var _0x4a8576;var _0xaa1ee0;var _0x2e90c1;var _0xf7eece=!_['isNil'](_0x397b29[_0x2ea6('0x5a')]['id'])?_0x397b29[_0x2ea6('0x5a')]['id']:!_[_0x2ea6('0x62')](_0x397b29[_0x2ea6('0x21')]['id'])?_0x397b29[_0x2ea6('0x21')]['id']:null;return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0xf7eece,'role':{'$or':[_0x2ea6('0x1f'),_0x2ea6('0x21'),_0x2ea6('0x1c')]}},'attributes':['id',_0x2ea6('0x29'),_0x2ea6('0xe2'),_0x2ea6('0xe3'),_0x2ea6('0x1b'),_0x2ea6('0x5d'),_0x2ea6('0x93')]})[_0x2ea6('0x1e')](function(_0x57d539){if(_0x57d539){if(_0x57d539[_0x2ea6('0x1b')]==='agent'){_0x4a8576=_0x57d539;if(_0x397b29[_0x2ea6('0x57')][_0x2ea6('0x95')]){_0x2e90c1=util[_0x2ea6('0xa2')]('LOCAL/%s@from-sip/n',_0x4a8576[_0x397b29[_0x2ea6('0x57')]['interface']]);}else if(_0x397b29[_0x2ea6('0x57')][_0x2ea6('0xe4')]){_0x2e90c1=util[_0x2ea6('0xa2')](_0x2ea6('0xa3'),_0x397b29[_0x2ea6('0x57')][_0x2ea6('0xe4')]);}else{_0x2e90c1=util[_0x2ea6('0xa2')]('SIP/%s',_0x4a8576[_0x2ea6('0x29')]);}socket['to'](util[_0x2ea6('0xa2')](_0x2ea6('0xe5'),_0x4a8576[_0x2ea6('0x29')]))[_0x2ea6('0x9d')](_0x2ea6('0xe6'),{'user':{'id':_0x4a8576['id'],'name':_0x4a8576[_0x2ea6('0x29')]},'ip':_0x397b29[_0x2ea6('0xe7')]['x-forwarded-for']||_0x397b29[_0x2ea6('0xe8')][_0x2ea6('0xe9')]||_0x397b29[_0x2ea6('0xea')][_0x2ea6('0xe9')]||_0x397b29[_0x2ea6('0xe8')]['socket'][_0x2ea6('0xe9')]});return db[_0x2ea6('0xa4')][_0x2ea6('0x1d')]({'where':{'membername':_0x4a8576[_0x2ea6('0x29')]},'individualHooks':!![]});}}else{throw new db[(_0x2ea6('0x84'))][(_0x2ea6('0x85'))](_0x2ea6('0xeb'));}})['then'](function(){if(_0x4a8576){return _0x4a8576['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x223e2d){if(_0x4a8576){if(_0x223e2d){_0xaa1ee0=_0x223e2d;if(_0xaa1ee0[_0x2ea6('0x48')]){var _0x575de1=_0xaa1ee0['map'](function(_0x5cc89d){var _0x1b83ae={'membername':_0x4a8576[_0x2ea6('0x29')],'UserId':_0x4a8576['id'],'queue_name':_0x5cc89d[_0x2ea6('0x29')],'VoiceQueueId':_0x5cc89d['id'],'interface':_0x2e90c1,'paused':_0x4a8576['loginInPause']||![],'penalty':_0x5cc89d[_0x2ea6('0xec')]||0x0};return db[_0x2ea6('0xa4')][_0x2ea6('0xa5')](_0x1b83ae);});return Promise['all'](_0x575de1);}}}})[_0x2ea6('0x1e')](function(){if(_0x4a8576){return db[_0x2ea6('0xed')][_0x2ea6('0x46')]({'where':{'membername':_0x4a8576[_0x2ea6('0x29')],'exitAt':null}});}})[_0x2ea6('0x1e')](function(_0x13aeea){if(_0x4a8576){var _0x1b5369=[];_0x13aeea[_0x2ea6('0xee')](function(_0x16a708){_0x1b5369[_0x2ea6('0x45')](_0x16a708['update']({'exitAt':moment()[_0x2ea6('0xa2')](_0x2ea6('0xef'))}));});return Promise[_0x2ea6('0x55')](_0x1b5369);}})[_0x2ea6('0x1e')](function(){if(_0x4a8576){var _0x490d71=[];var _0x4cafed=[];var _0x240f5e=utils[_0x2ea6('0xf0')]();var _0x360640={'membername':_0x4a8576[_0x2ea6('0x29')],'interface':_0x2e90c1,'enterAt':moment()[_0x2ea6('0xa2')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4a8576[_0x2ea6('0x1b')],'internal':_0x4a8576[_0x2ea6('0x5d')]};_0x240f5e[_0x2ea6('0xee')](function(_0x53dc96){_0x490d71[_0x2ea6('0x45')](_[_0x2ea6('0x51')]({'channel':_0x53dc96,'type':_0x2ea6('0xf1'),'data1':_0x397b29[_0x2ea6('0x57')]['device'],'data2':_0x2e90c1},_0x360640));if(_0x4a8576['loginInPause']){_0x4cafed[_0x2ea6('0x45')](_[_0x2ea6('0x51')]({'channel':_0x53dc96,'type':_0x2ea6('0xf2'),'data1':_0x2ea6('0xf3')},_0x360640));}});return db['MemberReport'][_0x2ea6('0xf4')](_0x490d71[_0x2ea6('0xc0')](_0x4cafed),{'individualHooks':!![]});}})[_0x2ea6('0x1e')](function(){if(_0x4a8576){return _0x4a8576[_0x2ea6('0x56')]({'online':!![],'lastLoginAt':moment()[_0x2ea6('0xa2')](_0x2ea6('0xef')),'voicePause':_0x4a8576[_0x2ea6('0x93')]||![],'mailPause':_0x4a8576[_0x2ea6('0x93')]||![],'chatPause':_0x4a8576[_0x2ea6('0x93')]||![],'faxPause':_0x4a8576[_0x2ea6('0x93')]||![],'smsPause':_0x4a8576[_0x2ea6('0x93')]||![],'openchannelPause':_0x4a8576['loginInPause']||![],'whatsappPause':_0x4a8576['loginInPause']||![],'pauseType':_0x4a8576[_0x2ea6('0x93')]?_0x2ea6('0xf3'):null,'interface':_0x2e90c1,'lastPauseAt':moment()[_0x2ea6('0xa2')](_0x2ea6('0xef'))});}})[_0x2ea6('0x1e')](function(_0x51b062){if(_0x397b29[_0x2ea6('0xf5')]){return _0x1cf186();}else{return Promise[_0x2ea6('0xf6')](_0x51b062)[_0x2ea6('0x1e')](respondWithResult(_0x5dad63,null));}})[_0x2ea6('0x4f')](handleError(_0x5dad63,null));};exports[_0x2ea6('0xf7')]=function(_0x5b3f60,_0x1931b1){var _0x2de1e2;return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x5b3f60[_0x2ea6('0x5a')]['id'],'role':_0x2ea6('0x1c')},'attributes':['id',_0x2ea6('0x29'),_0x2ea6('0x1b')]})[_0x2ea6('0x1e')](handleEntityNotFound(_0x1931b1,null))['then'](function(_0x337f42){if(_0x337f42){_0x2de1e2=_0x337f42;return db[_0x2ea6('0xa4')]['destroy']({'where':{'membername':_0x2de1e2[_0x2ea6('0x29')]},'individualHooks':!![]});}})[_0x2ea6('0x1e')](function(){return db[_0x2ea6('0xed')][_0x2ea6('0x46')]({'where':{'membername':_0x2de1e2[_0x2ea6('0x29')],'exitAt':null}});})['then'](function(_0x1b68b9){var _0x2b8b03=[];_0x1b68b9[_0x2ea6('0xee')](function(_0x53c8fa){_0x2b8b03[_0x2ea6('0x45')](_0x53c8fa[_0x2ea6('0x56')]({'exitAt':moment()[_0x2ea6('0xa2')](_0x2ea6('0xef'))}));});return Promise[_0x2ea6('0x55')](_0x2b8b03);})['then'](function(){return _0x2de1e2['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x1931b1,null))[_0x2ea6('0x4f')](handleError(_0x1931b1,null));};exports[_0x2ea6('0xf8')]=function(_0x345dd0,_0xff14fb){var _0xd70113;return db[_0x2ea6('0xa4')][_0x2ea6('0x56')]({'paused':0x1},{'where':{'UserId':_0x345dd0[_0x2ea6('0x5a')]['id']},'individualHooks':!![]})[_0x2ea6('0x1e')](function(){return db[_0x2ea6('0x2f')][_0x2ea6('0x28')]({'where':{'id':_0x345dd0['params']['id'],'role':'agent'},'attributes':['id',_0x2ea6('0x29'),_0x2ea6('0x1b'),_0x2ea6('0x5d'),_0x2ea6('0x95'),_0x2ea6('0x92')]});})['then'](handleEntityNotFound(_0xff14fb,null))['then'](function(_0x45b757){if(_0x45b757){_0xd70113=_0x45b757;return db[_0x2ea6('0xed')]['findAll']({'where':{'membername':_0xd70113[_0x2ea6('0x29')],'type':_0x2ea6('0xf2'),'exitAt':null}});}})['then'](function(_0x478b00){if(_0x478b00[_0x2ea6('0x48')]){var _0x44c5fa=moment()[_0x2ea6('0xa2')](_0x2ea6('0xef'));for(var _0x21bee7=0x0,_0x3c5268=_0x478b00[_0x2ea6('0x48')];_0x21bee7<_0x3c5268;_0x21bee7++){_0x478b00[_0x21bee7][_0x2ea6('0xf9')]({'exitAt':_0x44c5fa});}}})['then'](function(){var _0x265d16=[];var _0x50b2d0=utils['getChannels']();_0x50b2d0[_0x2ea6('0xee')](function(_0x1d64db){_0x265d16[_0x2ea6('0x45')]({'channel':_0x1d64db,'membername':_0xd70113[_0x2ea6('0x29')],'interface':_['isNil'](_0xd70113[_0x2ea6('0x95')])?util[_0x2ea6('0xa2')](_0x2ea6('0xa3'),_0xd70113[_0x2ea6('0x29')]):_0xd70113[_0x2ea6('0x95')],'type':'PAUSE','enterAt':moment()[_0x2ea6('0xa2')](_0x2ea6('0xef')),'data1':_0x345dd0[_0x2ea6('0x57')][_0x2ea6('0x32')]||_0x2ea6('0xfa'),'role':_0xd70113['role'],'internal':_0xd70113['internal']});});return db[_0x2ea6('0xed')][_0x2ea6('0xf4')](_0x265d16,{'individualHooks':!![]});})['then'](function(){return _0xd70113[_0x2ea6('0x56')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x345dd0['body'][_0x2ea6('0x32')]||_0x2ea6('0xfa'),'lastPauseAt':moment()[_0x2ea6('0xa2')](_0x2ea6('0xef'))});})[_0x2ea6('0x1e')](respondWithResult(_0xff14fb,null))['catch'](handleError(_0xff14fb,null));};exports['unpause']=function(_0x4b461a,_0x232ac3){if(_0x4b461a['body']['channel']&&!utils[_0x2ea6('0xa6')](_0x4b461a[_0x2ea6('0x57')][_0x2ea6('0x91')])){throw new APIBadRequestError(util[_0x2ea6('0xa2')](_0x2ea6('0xfb'),_0x4b461a[_0x2ea6('0x57')][_0x2ea6('0x91')]));}return db['User'][_0x2ea6('0x28')]({'where':{'id':_0x4b461a[_0x2ea6('0x5a')]['id']},'attributes':['id','name',_0x2ea6('0x1b'),_0x2ea6('0x5d'),_0x2ea6('0x95'),_0x2ea6('0x92'),_0x2ea6('0x94'),_0x2ea6('0xfc'),_0x2ea6('0xfd'),_0x2ea6('0xfe'),'openchannelPause',_0x2ea6('0xff'),_0x2ea6('0x100'),'pauseType',_0x2ea6('0x101')]})[_0x2ea6('0x1e')](function(_0x137312){if(!_0x137312){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x4b461a[_0x2ea6('0x5a')]['id']));}return _0x137312[_0x2ea6('0x102')](_0x4b461a['body'][_0x2ea6('0x91')]);})[_0x2ea6('0x1e')](respondWithResult(_0x232ac3,null))[_0x2ea6('0x4f')](APIHandleError(_0x232ac3));};exports[_0x2ea6('0x103')]=function(_0x897c62,_0x1b7dad){var _0xbeb5cf={};var _0x390569={};var _0x34d7a0;var _0x30b0c2;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x897c62['params']['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x1b7dad,null))[_0x2ea6('0x1e')](function(_0x4204b2){if(_0x4204b2){_0x34d7a0=_0x4204b2;_0x390569[_0x2ea6('0xca')]=_[_0x2ea6('0xc6')](db[_0x2ea6('0x104')][_0x2ea6('0x30')]);_0x390569[_0x2ea6('0x3f')]=_['keys'](_0x897c62[_0x2ea6('0x3f')]);_0x390569[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x390569[_0x2ea6('0xca')],_0x390569[_0x2ea6('0x3f')]);_0xbeb5cf[_0x2ea6('0x44')]=_['intersection'](_0x390569[_0x2ea6('0xca')],qs[_0x2ea6('0xcb')](_0x897c62['query'][_0x2ea6('0xcb')]));_0xbeb5cf[_0x2ea6('0x44')]=_0xbeb5cf[_0x2ea6('0x44')][_0x2ea6('0x48')]?_0xbeb5cf['attributes']:_0x390569[_0x2ea6('0xca')];_0xbeb5cf[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x897c62[_0x2ea6('0x3f')][_0x2ea6('0xcd')]);_0xbeb5cf[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x897c62[_0x2ea6('0x3f')],_0x390569['filters']));if(_0x897c62[_0x2ea6('0x3f')][_0x2ea6('0x34')]){_0xbeb5cf[_0x2ea6('0x3d')]=_['merge'](_0xbeb5cf[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0xbeb5cf['attributes'],function(_0x5528fd){var _0xf4170={};_0xf4170[_0x5528fd]={'$like':'%'+_0x897c62[_0x2ea6('0x3f')][_0x2ea6('0x34')]+'%'};return _0xf4170;})});}_0xbeb5cf=_[_0x2ea6('0x51')]({},_0xbeb5cf,_0x897c62['options']);return _0x34d7a0[_0x2ea6('0x103')](_0xbeb5cf);}})['then'](function(_0x3d9f89){if(_0x3d9f89){_0x30b0c2=_0x3d9f89[_0x2ea6('0x48')];if(!_0x897c62['query'][_0x2ea6('0xd2')]('nolimit')){_0xbeb5cf[_0x2ea6('0xcf')]=qs['limit'](_0x897c62[_0x2ea6('0x3f')][_0x2ea6('0xcf')]);_0xbeb5cf[_0x2ea6('0x18')]=qs['offset'](_0x897c62[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}return _0x34d7a0[_0x2ea6('0x103')](_0xbeb5cf);}})[_0x2ea6('0x1e')](function(_0x3bac32){if(_0x3bac32){return _0x3bac32?{'count':_0x30b0c2,'rows':_0x3bac32}:null;}})['then'](respondWithResult(_0x1b7dad,null))[_0x2ea6('0x4f')](handleError(_0x1b7dad,null));};exports[_0x2ea6('0x105')]=function(_0x103949,_0x25a182){var _0x13d165=_0x103949[_0x2ea6('0x5a')]['id'];var _0x42b0ec=_0x103949[_0x2ea6('0x57')]?_0x103949[_0x2ea6('0x57')][_0x2ea6('0x5b')]:null;var _0x27a76d=[];return Promise[_0x2ea6('0xf6')]()['then'](function(){if(!_0x42b0ec)throw new APIBadRequestError(_0x2ea6('0x106'));})[_0x2ea6('0x1e')](function(){return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x13d165}});})[_0x2ea6('0x1e')](function(_0x20cd90){if(!_0x20cd90)throw new APINotFoundError(util['format'](_0x2ea6('0x107'),_0x103949[_0x2ea6('0x5a')]['id']));return db[_0x2ea6('0x64')][_0x2ea6('0x108')](function(_0xcde378){return _0x20cd90[_0x2ea6('0x105')](_0x42b0ec,{'transaction':_0xcde378})[_0x2ea6('0x1e')](function(){return db[_0x2ea6('0x104')][_0x2ea6('0x46')]({'where':{'id':{'$in':_0x42b0ec}}});})[_0x2ea6('0x1e')](function(_0x57dac5){var _0x5c0a05=_[_0x2ea6('0x26')](_0x57dac5,function(_0x2d248f){return _0x2d248f[_0x2ea6('0x109')]();});return Promise['all'](_0x5c0a05);})[_0x2ea6('0x1e')](function(_0x1efb69){_0x27a76d=_[_0x2ea6('0x10a')](_0x1efb69);var _0x27d48f=_[_0x2ea6('0x26')](_0x27a76d,function(_0x46456b){return _0x46456b[_0x2ea6('0x10b')](_0x20cd90['id'],{'transaction':_0xcde378});});return Promise['all'](_0x27d48f);})[_0x2ea6('0x1e')](function(){if(!_0x20cd90['online'])return;var _0x329c66=_[_0x2ea6('0x34')](_0x27a76d,function(_0x48108d){return _0x48108d[_0x2ea6('0x10c')](_0x2ea6('0x91'))===_0x2ea6('0x10d');});var _0x20bc9c=_['map'](_0x329c66,function(_0x3eddeb){return db[_0x2ea6('0xa4')][_0x2ea6('0xa5')]({'membername':_0x20cd90[_0x2ea6('0x29')],'UserId':_0x20cd90['id'],'queue_name':_0x3eddeb[_0x2ea6('0x29')],'VoiceQueueId':_0x3eddeb['id'],'interface':_['isNil'](_0x20cd90[_0x2ea6('0x95')])?util['format'](_0x2ea6('0xa3'),_0x20cd90[_0x2ea6('0x29')]):_0x20cd90[_0x2ea6('0x95')],'paused':_0x20cd90[_0x2ea6('0x94')]||![],'penalty':_0x20cd90[_0x2ea6('0x9a')]},{'transaction':_0xcde378});});return Promise['all'](_0x20bc9c);})[_0x2ea6('0x1e')](function(){return db[_0x2ea6('0x10e')][_0x2ea6('0x46')]({'where':{'teamId':{'$in':_0x42b0ec}}});})[_0x2ea6('0x1e')](function(_0x3e3fff){var _0xbcc541=_['map'](_0x3e3fff,function(_0x18841d){return db['UserVoicePrefix'][_0x2ea6('0x75')]({'UserId':_0x20cd90['id'],'VoicePrefixId':_0x18841d[_0x2ea6('0x10f')]},{'transaction':_0xcde378});});return Promise[_0x2ea6('0x55')](_0xbcc541);});});})[_0x2ea6('0x1e')](function(){for(var _0x169606=0x0;_0x169606<_0x27a76d[_0x2ea6('0x48')];_0x169606++){var _0x5ee496=_0x27a76d[_0x169606]['getDataValue'](_0x2ea6('0x91'));var _0x57af8d=_0x5ee496+_0x2ea6('0x9c');socket[_0x2ea6('0x9d')]('user'+_0x5ee496+'Queue:save',{'UserId':_0x13d165,['queueField']:_0x27a76d[_0x169606]['id']});}})[_0x2ea6('0x1e')](respondWithStatusCode(_0x25a182,null))['catch'](APIHandleError(_0x25a182));};exports[_0x2ea6('0x110')]=function(_0x2579c5,_0x2d70e4){var _0xb665e7=_0x2579c5['params']['id'];var _0x432f37=null;if(_0x2579c5[_0x2ea6('0x3f')][_0x2ea6('0x5b')]){_0x432f37=_[_0x2ea6('0xa9')](_0x2579c5[_0x2ea6('0x3f')]['ids'])?_0x2579c5[_0x2ea6('0x3f')][_0x2ea6('0x5b')]:[_0x2579c5[_0x2ea6('0x3f')][_0x2ea6('0x5b')]];}var _0x315e74=[];return Promise[_0x2ea6('0xf6')]()[_0x2ea6('0x1e')](function(){if(!_0x432f37)throw new APIBadRequestError(_0x2ea6('0x111'));})['then'](function(){return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0xb665e7}});})[_0x2ea6('0x1e')](function(_0x3b6718){if(!_0x3b6718)throw new APINotFoundError(util[_0x2ea6('0xa2')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2579c5[_0x2ea6('0x5a')]['id']));return db[_0x2ea6('0x64')][_0x2ea6('0x108')](function(_0x509858){return _0x3b6718[_0x2ea6('0x110')](_0x432f37,{'transaction':_0x509858})[_0x2ea6('0x1e')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x432f37}}});})[_0x2ea6('0x1e')](function(_0x52ea29){var _0x403257=_[_0x2ea6('0x26')](_0x52ea29,function(_0x3da04d){return _0x3da04d[_0x2ea6('0x109')]();});return Promise[_0x2ea6('0x55')](_0x403257);})['then'](function(_0x3d0f5d){_0x315e74=_['flattenDeep'](_0x3d0f5d);var _0x569ffa=_[_0x2ea6('0x26')](_0x315e74,function(_0x318e3d){return _0x318e3d[_0x2ea6('0x112')](_0x3b6718['id'],{'transaction':_0x509858});});return Promise['all'](_0x569ffa);})['then'](function(){if(!_0x3b6718['online'])return;var _0x4a3f7f=_['filter'](_0x315e74,function(_0x5e995b){return _0x5e995b[_0x2ea6('0x10c')](_0x2ea6('0x91'))===_0x2ea6('0x10d');});var _0x10570f=_[_0x2ea6('0x26')](_0x4a3f7f,function(_0x3b6ef){return db[_0x2ea6('0xa4')][_0x2ea6('0x1d')]({'where':{'VoiceQueueId':_0x3b6ef['id'],'UserId':_0x3b6718['id']},'transaction':_0x509858});});return Promise[_0x2ea6('0x55')](_0x10570f);})[_0x2ea6('0x1e')](function(){return db[_0x2ea6('0x10e')][_0x2ea6('0x46')]({'where':{'teamId':{'$in':_0x432f37}}});})['then'](function(_0x3eea91){var _0x3afc8c=_['map'](_0x3eea91,function(_0x26abd7){return db[_0x2ea6('0x113')][_0x2ea6('0x1d')]({'where':{'UserId':_0x3b6718['id'],'VoicePrefixId':_0x26abd7[_0x2ea6('0x10f')]}},{'transaction':_0x509858});});return Promise['all'](_0x3afc8c);});});})['then'](function(){for(var _0x31cc37=0x0;_0x31cc37<_0x315e74[_0x2ea6('0x48')];_0x31cc37++){var _0x5a16e5=_0x315e74[_0x31cc37][_0x2ea6('0x10c')](_0x2ea6('0x91'));var _0x37bcbf=_0x5a16e5+'QueueId';socket['emit'](_0x2ea6('0x21')+_0x5a16e5+_0x2ea6('0xaa'),{'UserId':_0xb665e7,['queueField']:_0x315e74[_0x31cc37]['id']});}})[_0x2ea6('0x1e')](respondWithStatusCode(_0x2d70e4,null))[_0x2ea6('0x4f')](APIHandleError(_0x2d70e4));};exports[_0x2ea6('0x114')]=function(_0x3a59b4,_0x122fd8){var _0x58cc70={};var _0xbb5680={};var _0x3beccf;var _0x53db1f;return db[_0x2ea6('0x2f')][_0x2ea6('0x8c')]({'where':{'id':_0x3a59b4[_0x2ea6('0x5a')]['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x122fd8,null))[_0x2ea6('0x1e')](function(_0x8471fc){if(_0x8471fc){_0x3beccf=_0x8471fc;_0xbb5680['model']=_[_0x2ea6('0xc6')](db[_0x2ea6('0x115')][_0x2ea6('0x30')]);_0xbb5680[_0x2ea6('0x3f')]=_[_0x2ea6('0xc6')](_0x3a59b4['query']);_0xbb5680[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0xbb5680[_0x2ea6('0xca')],_0xbb5680['query']);_0x58cc70[_0x2ea6('0x44')]=_[_0x2ea6('0xc9')](_0xbb5680['model'],qs[_0x2ea6('0xcb')](_0x3a59b4[_0x2ea6('0x3f')]['fields']));_0x58cc70[_0x2ea6('0x44')]=_0x58cc70['attributes'][_0x2ea6('0x48')]?_0x58cc70['attributes']:_0xbb5680['model'];_0x58cc70[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x3a59b4[_0x2ea6('0x3f')][_0x2ea6('0xcd')]);_0x58cc70['where']=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x3a59b4['query'],_0xbb5680[_0x2ea6('0xc8')]));if(_0x3a59b4['query']['filter']){_0x58cc70[_0x2ea6('0x3d')]=_['merge'](_0x58cc70[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0x58cc70[_0x2ea6('0x44')],function(_0x11c813){var _0x28027b={};_0x28027b[_0x11c813]={'$like':'%'+_0x3a59b4[_0x2ea6('0x3f')]['filter']+'%'};return _0x28027b;})});}_0x58cc70=_[_0x2ea6('0x51')]({},_0x58cc70,_0x3a59b4[_0x2ea6('0x52')]);return _0x3beccf[_0x2ea6('0x114')](_0x58cc70);}})['then'](function(_0x54b225){if(_0x54b225){_0x53db1f=_0x54b225[_0x2ea6('0x48')];if(!_0x3a59b4[_0x2ea6('0x3f')][_0x2ea6('0xd2')](_0x2ea6('0xce'))){_0x58cc70[_0x2ea6('0xcf')]=qs[_0x2ea6('0xcf')](_0x3a59b4[_0x2ea6('0x3f')]['limit']);_0x58cc70[_0x2ea6('0x18')]=qs[_0x2ea6('0x18')](_0x3a59b4[_0x2ea6('0x3f')][_0x2ea6('0x18')]);}return _0x3beccf[_0x2ea6('0x114')](_0x58cc70);}})[_0x2ea6('0x1e')](function(_0x22d57c){if(_0x22d57c){return _0x22d57c?{'count':_0x53db1f,'rows':_0x22d57c}:null;}})['then'](respondWithResult(_0x122fd8,null))['catch'](handleError(_0x122fd8,null));};exports[_0x2ea6('0x116')]=function(_0x4bb672,_0x24a16b){var _0xc4be83={};var _0x21d9b1={};var _0x2766fc;return db[_0x2ea6('0x2f')]['findOne']({'where':{'id':_0x4bb672['params']['id']}})[_0x2ea6('0x1e')](handleEntityNotFound(_0x24a16b,null))[_0x2ea6('0x1e')](function(_0x58e74c){if(_0x58e74c){_0x2766fc=_0x58e74c;_0x21d9b1[_0x2ea6('0xca')]=_[_0x2ea6('0xc6')](db[_0x2ea6('0x2f')][_0x2ea6('0x30')]);_0x21d9b1[_0x2ea6('0x3f')]=_['keys'](_0x4bb672[_0x2ea6('0x3f')]);_0x21d9b1[_0x2ea6('0xc8')]=_[_0x2ea6('0xc9')](_0x21d9b1[_0x2ea6('0xca')],_0x21d9b1[_0x2ea6('0x3f')]);_0xc4be83[_0x2ea6('0x44')]=_['intersection'](_0x21d9b1[_0x2ea6('0xca')],qs[_0x2ea6('0xcb')](_0x4bb672[_0x2ea6('0x3f')][_0x2ea6('0xcb')]));_0xc4be83[_0x2ea6('0x44')]=_0xc4be83[_0x2ea6('0x44')]['length']?_0xc4be83[_0x2ea6('0x44')]:_0x21d9b1[_0x2ea6('0xca')];_0xc4be83[_0x2ea6('0xcc')]=qs[_0x2ea6('0xcd')](_0x4bb672['query']['sort']);_0xc4be83[_0x2ea6('0x3d')]=qs[_0x2ea6('0xc8')](_[_0x2ea6('0xd1')](_0x4bb672[_0x2ea6('0x3f')],_0x21d9b1['filters']));if(_0x4bb672[_0x2ea6('0x3f')]['filter']){_0xc4be83[_0x2ea6('0x3d')]=_['merge'](_0xc4be83[_0x2ea6('0x3d')],{'$or':_[_0x2ea6('0x26')](_0xc4be83[_0x2ea6('0x44')],function(_0x3675bc){var _0x224939={};_0x224939[_0x3675bc]={'$like':'%'+_0x4bb672['query'][_0x2ea6('0x34')]+'%'};return _0x224939;})});}_0xc4be83[_0x2ea6('0xca')]=db[_0x2ea6('0x2f')];_0xc4be83['as']=_0x2ea6('0x22');_0xc4be83=_[_0x2ea6('0x51')]({},_0xc4be83,_0x4bb672[_0x2ea6('0x52')]);return _0x2766fc[_0x2ea6('0x117')]({'include':[_0xc4be83]});}})['then'](function(_0x69a76a){if(_0x69a76a){var _0x556b53={},_0x28de99=[];for(var _0x3f5d4b=0x0;_0x3f5d4b<_0x69a76a[_0x2ea6('0x48')];_0x3f5d4b+=0x1){for(var _0x489ca3=0x0,_0xc7fbbc;_0x489ca3<_0x69a76a[_0x3f5d4b][_0x2ea6('0x22')][_0x2ea6('0x48')];_0x489ca3+=0x1){_0xc7fbbc=_0x69a76a[_0x3f5d4b]['Agents'][_0x489ca3][_0x2ea6('0xa1')]({'plain':!![]});_0x556b53[_0xc7fbbc['id']]=_0xc7fbbc;}}_0x556b53=_[_0x2ea6('0x118')](_0x556b53);for(var _0x2f0752=qs[_0x2ea6('0x18')](_0x4bb672[_0x2ea6('0x3f')][_0x2ea6('0x18')]);_0x2f0752<_0x556b53[_0x2ea6('0x48')]&&_0x28de99['length']=_0x5b4ca0['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x5c3623){return db[_0xd91b('0x48')][_0xd91b('0x50')]({'where':{'membername':_0x5c3623[_0xd91b('0x21')]},'individualHooks':!![]});}})[_0xd91b('0x1e')](function(){if(_0x5c3623){return _0x5c3623[_0xd91b('0x51')]({'raw':!![]});}})[_0xd91b('0x1e')](function(_0x4f5656){if(_0x5c3623){if(_0x4f5656){var _0x56d0d9=[];_0x185402=_0x4f5656;if(_0x185402['length']){for(var _0x2625ff=0x0;_0x2625ff<_0x185402['length'];_0x2625ff++){_0x56d0d9[_0xd91b('0x2f')](db[_0xd91b('0x48')][_0xd91b('0x52')]({'membername':_0x5c3623[_0xd91b('0x21')],'UserId':_0x5c3623['id'],'queue_name':_0x185402[_0x2625ff]['name'],'VoiceQueueId':_0x185402[_0x2625ff]['id'],'interface':_0x54934a,'paused':_0x5c3623['loginInPause']||![],'penalty':_0x185402[_0x2625ff][_0xd91b('0x53')]||0x0}));}return BPromise[_0xd91b('0x49')](_0x56d0d9);}}}})[_0xd91b('0x1e')](function(){if(_0x5c3623){return db[_0xd91b('0x29')][_0xd91b('0xd')]({'where':{'membername':_0x5c3623['name'],'exitAt':null}});}})[_0xd91b('0x1e')](function(_0x4d1452){if(_0x5c3623){if(_0x4d1452&&_0x4d1452[_0xd91b('0x2b')]){var _0x5303ff=[];_0x4d1452[_0xd91b('0x2e')](function(_0x2e98db){_0x5303ff[_0xd91b('0x2f')](_0x2e98db['update']({'exitAt':moment()[_0xd91b('0x25')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x5303ff);}}})['then'](function(){if(_0x5c3623){var _0x1ca8a9=[];var _0x3ab997=[];var _0x1aa924=utils[_0xd91b('0x2d')]();var _0xe86d2f={'membername':_0x5c3623['name'],'interface':_0x54934a,'enterAt':moment()[_0xd91b('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5c3623['role'],'internal':_0x5c3623[_0xd91b('0x23')]};_0x1aa924[_0xd91b('0x2e')](function(_0xc2220e){_0x1ca8a9['push'](_[_0xd91b('0x54')]({'channel':_0xc2220e,'type':'LOGIN','data1':_0xd91b('0x55'),'data2':_0x54934a},_0xe86d2f));if(_0x5c3623[_0xd91b('0x4d')]){_0x3ab997[_0xd91b('0x2f')](_[_0xd91b('0x54')]({'channel':_0xc2220e,'type':'PAUSE','data1':_0xd91b('0x56')},_0xe86d2f));}});return db[_0xd91b('0x29')][_0xd91b('0x36')](_0x1ca8a9['concat'](_0x3ab997),{'individualHooks':!![]});}})['then'](function(){if(_0x5c3623){return _0x5c3623['update']({'online':!![],'lastLoginAt':moment()[_0xd91b('0x25')](_0xd91b('0x37')),'voicePause':_0x5c3623['loginInPause']||![],'mailPause':_0x5c3623[_0xd91b('0x4d')]||![],'chatPause':_0x5c3623['loginInPause']||![],'faxPause':_0x5c3623[_0xd91b('0x4d')]||![],'smsPause':_0x5c3623[_0xd91b('0x4d')]||![],'openchannelPause':_0x5c3623[_0xd91b('0x4d')]||![],'pauseType':_0x5c3623[_0xd91b('0x4d')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0xd91b('0x37')),'interface':_0x54934a});}})[_0xd91b('0x1e')](function(_0x3cff00){_0x3a2db2(_0x3cff00);})[_0xd91b('0x1a')](function(_0x443e85){_0x491879(_0xaf12cb[_0xd91b('0x1b')](0x1f4,_0x443e85[_0xd91b('0x1c')]));});});}; \ No newline at end of file +var _0xd72f=['defaults','localhost','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','where','attributes','limit','model','include','then','info','debug','stringify','catch','error','message','ShowUser','map','find','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','bulkCreate','type','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','online','voicePause','mailPause','chatPause','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','system','LogoutUser','findOne','destroy','all','LoginUser','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis'];(function(_0x32e644,_0x1a94e7){var _0x4344c0=function(_0x33ae10){while(--_0x33ae10){_0x32e644['push'](_0x32e644['shift']());}};_0x4344c0(++_0x1a94e7);}(_0xd72f,0x109));var _0xfd72=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xd72f[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfd72('0x0'));var BPromise=require(_0xfd72('0x1'));var Redis=require(_0xfd72('0x2'));var db=require(_0xfd72('0x3'))['db'];var utils=require(_0xfd72('0x4'));var logger=require(_0xfd72('0x5'))('rpc');var config=require(_0xfd72('0x6'));config[_0xfd72('0x7')]=_[_0xfd72('0x8')](config[_0xfd72('0x7')],{'host':_0xfd72('0x9'),'port':0x18eb});var socket=require(_0xfd72('0xa'))(new Redis(config[_0xfd72('0x7')]));require(_0xfd72('0xb'))[_0xfd72('0xc')](socket);exports[_0xfd72('0xd')]=function(_0x51d57c){var _0x5177bc=this;return new Promise(function(_0x20f0ef,_0x2c87ad){return db[_0xfd72('0xe')][_0xfd72('0xf')]({'raw':_0x51d57c['options']?_0x51d57c[_0xfd72('0x10')]['raw']===undefined?!![]:![]:!![],'where':_0x51d57c[_0xfd72('0x10')]?_0x51d57c[_0xfd72('0x10')][_0xfd72('0x11')]||null:null,'attributes':_0x51d57c[_0xfd72('0x10')]?_0x51d57c['options'][_0xfd72('0x12')]||null:null,'limit':_0x51d57c[_0xfd72('0x10')]?_0x51d57c[_0xfd72('0x10')][_0xfd72('0x13')]||null:null,'include':_0x51d57c[_0xfd72('0x10')]?_0x51d57c[_0xfd72('0x10')]['include']?_['map'](_0x51d57c[_0xfd72('0x10')]['include'],function(_0x3b88d5){return{'model':db[_0x3b88d5[_0xfd72('0x14')]],'as':_0x3b88d5['as'],'attributes':_0x3b88d5[_0xfd72('0x12')],'include':_0x3b88d5[_0xfd72('0x15')]?_['map'](_0x3b88d5[_0xfd72('0x15')],function(_0x17c5ea){return{'model':db[_0x17c5ea[_0xfd72('0x14')]],'as':_0x17c5ea['as'],'attributes':_0x17c5ea[_0xfd72('0x12')],'include':_0x17c5ea[_0xfd72('0x15')]?_['map'](_0x17c5ea['include'],function(_0xf690f9){return{'model':db[_0xf690f9[_0xfd72('0x14')]],'as':_0xf690f9['as'],'attributes':_0xf690f9['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd72('0x16')](function(_0x147167){logger[_0xfd72('0x17')](_0xfd72('0xd'),_0x51d57c);logger[_0xfd72('0x18')](_0xfd72('0xd'),_0x51d57c,JSON[_0xfd72('0x19')](_0x147167));_0x20f0ef(_0x147167);})[_0xfd72('0x1a')](function(_0x2651b9){logger[_0xfd72('0x1b')](_0xfd72('0xd'),_0x2651b9[_0xfd72('0x1c')],_0x51d57c);_0x2c87ad(_0x5177bc[_0xfd72('0x1b')](0x1f4,_0x2651b9[_0xfd72('0x1c')]));});});};exports[_0xfd72('0x1d')]=function(_0x102f39){var _0x342ad9=this;return new Promise(function(_0x478b05,_0x44fbff){return db[_0xfd72('0xe')]['find']({'raw':_0x102f39[_0xfd72('0x10')]?_0x102f39['options']['raw']===undefined?!![]:![]:!![],'where':_0x102f39[_0xfd72('0x10')]?_0x102f39[_0xfd72('0x10')][_0xfd72('0x11')]||null:null,'attributes':_0x102f39['options']?_0x102f39[_0xfd72('0x10')][_0xfd72('0x12')]||null:null,'include':_0x102f39[_0xfd72('0x10')]?_0x102f39[_0xfd72('0x10')][_0xfd72('0x15')]?_[_0xfd72('0x1e')](_0x102f39[_0xfd72('0x10')][_0xfd72('0x15')],function(_0x12429d){return{'model':db[_0x12429d['model']],'as':_0x12429d['as'],'attributes':_0x12429d[_0xfd72('0x12')],'include':_0x12429d['include']?_['map'](_0x12429d[_0xfd72('0x15')],function(_0x5a04dc){return{'model':db[_0x5a04dc[_0xfd72('0x14')]],'as':_0x5a04dc['as'],'attributes':_0x5a04dc[_0xfd72('0x12')],'include':_0x5a04dc[_0xfd72('0x15')]?_[_0xfd72('0x1e')](_0x5a04dc['include'],function(_0x337ea1){return{'model':db[_0x337ea1[_0xfd72('0x14')]],'as':_0x337ea1['as'],'attributes':_0x337ea1[_0xfd72('0x12')]};}):[]};}):[]};}):[]:[]})[_0xfd72('0x16')](function(_0x3f719c){logger[_0xfd72('0x17')](_0xfd72('0x1d'),_0x102f39);logger[_0xfd72('0x18')]('ShowUser',_0x102f39,JSON['stringify'](_0x3f719c));_0x478b05(_0x3f719c);})[_0xfd72('0x1a')](function(_0x32187c){logger['error']('ShowUser',_0x32187c[_0xfd72('0x1c')],_0x102f39);_0x44fbff(_0x342ad9[_0xfd72('0x1b')](0x1f4,_0x32187c[_0xfd72('0x1c')]));});});};exports['PauseUser']=function(_0x3d4ffd){var _0x2bc428;return db['User'][_0xfd72('0x1f')]({'where':_0x3d4ffd[_0xfd72('0x10')]['where']||{},'attributes':['id',_0xfd72('0x20'),_0xfd72('0x21'),_0xfd72('0x22'),_0xfd72('0x23')]})[_0xfd72('0x16')](function(_0x2b1e02){if(!_0x2b1e02){throw new Error(util[_0xfd72('0x24')](_0xfd72('0x25'),_0x3d4ffd[_0xfd72('0x26')]['id']));}_0x2bc428=_0x2b1e02;return db[_0xfd72('0x27')][_0xfd72('0x28')]({'paused':0x1},{'where':{'UserId':_0x2bc428['id']},'individualHooks':!![]});})[_0xfd72('0x16')](function(){return db[_0xfd72('0x29')][_0xfd72('0xf')]({'where':{'membername':_0x2bc428['name'],'type':_0xfd72('0x2a'),'exitAt':null}});})[_0xfd72('0x16')](function(_0x4d8050){if(_0x4d8050&&_0x4d8050[_0xfd72('0x2b')]){var _0x235599=moment()['format'](_0xfd72('0x2c'));for(var _0x5e9e26=0x0,_0x2247f2=_0x4d8050['length'];_0x5e9e26<_0x2247f2;_0x5e9e26++){_0x4d8050[_0x5e9e26][_0xfd72('0x2d')]({'exitAt':_0x235599});}}})[_0xfd72('0x16')](function(){var _0x28b8fc=[];var _0x25446f=utils[_0xfd72('0x2e')]();_0x25446f[_0xfd72('0x2f')](function(_0x34b49d){_0x28b8fc[_0xfd72('0x30')]({'channel':_0x34b49d,'membername':_0x2bc428[_0xfd72('0x20')],'interface':_[_0xfd72('0x31')](_0x2bc428[_0xfd72('0x23')])?util[_0xfd72('0x24')](_0xfd72('0x32'),_0x2bc428[_0xfd72('0x20')]):_0x2bc428[_0xfd72('0x23')],'type':_0xfd72('0x2a'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x3d4ffd[_0xfd72('0x33')]['type']||_0xfd72('0x34'),'role':_0x2bc428['role'],'internal':_0x2bc428['internal'],'uniqueid':_0x3d4ffd[_0xfd72('0x33')][_0xfd72('0x35')]||null});});return db[_0xfd72('0x29')][_0xfd72('0x36')](_0x28b8fc,{'individualHooks':!![]});})[_0xfd72('0x16')](function(){return _0x2bc428[_0xfd72('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3d4ffd[_0xfd72('0x33')][_0xfd72('0x37')]||_0xfd72('0x34'),'lastPauseAt':moment()[_0xfd72('0x24')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x1f8f27){throw _0x1f8f27;});};exports[_0xfd72('0x38')]=function(_0x542489){return Promise[_0xfd72('0x39')]()[_0xfd72('0x16')](function(){if(_0x542489[_0xfd72('0x33')][_0xfd72('0x3a')]&&!utils[_0xfd72('0x3b')](_0x542489[_0xfd72('0x33')][_0xfd72('0x3a')])){throw new Error(util[_0xfd72('0x24')](_0xfd72('0x3c'),_0x542489[_0xfd72('0x33')][_0xfd72('0x3a')]));}return db['User']['findOne']({'where':_0x542489[_0xfd72('0x10')][_0xfd72('0x11')]||{},'attributes':['id',_0xfd72('0x20'),_0xfd72('0x21'),_0xfd72('0x22'),_0xfd72('0x23'),_0xfd72('0x3d'),_0xfd72('0x3e'),_0xfd72('0x3f'),_0xfd72('0x40'),_0xfd72('0x41'),'openchannelPause',_0xfd72('0x42'),_0xfd72('0x43'),_0xfd72('0x44'),_0xfd72('0x45')]});})['then'](function(_0x4d08e4){if(!_0x4d08e4){throw new Error(util[_0xfd72('0x24')](_0xfd72('0x25'),_0x542489[_0xfd72('0x26')]['id']));}return _0x4d08e4[_0xfd72('0x46')](_0x542489[_0xfd72('0x33')][_0xfd72('0x3a')],_0xfd72('0x47'));})[_0xfd72('0x1a')](function(_0x49910c){throw _0x49910c;});};exports[_0xfd72('0x48')]=function(_0x45bef4){var _0x3fa279=this;return new Promise(function(_0x5d1aa6,_0x124318){var _0x5df5b3;return db['User'][_0xfd72('0x49')]({'where':_0x45bef4[_0xfd72('0x10')]['where']||{},'attributes':['id',_0xfd72('0x20')]})['then'](function(_0x4964ca){if(_0x4964ca){_0x5df5b3=_0x4964ca;return db[_0xfd72('0x27')][_0xfd72('0x4a')]({'where':{'membername':_0x5df5b3['name']},'individualHooks':!![]});}})['then'](function(){if(_0x5df5b3){return db['MemberReport']['findAll']({'where':{'membername':_0x5df5b3[_0xfd72('0x20')],'exitAt':null}});}})[_0xfd72('0x16')](function(_0x7d2f83){if(_0x5df5b3){if(_0x7d2f83&&_0x7d2f83[_0xfd72('0x2b')]){var _0x3b7365=[];_0x7d2f83[_0xfd72('0x2f')](function(_0x441043){_0x3b7365[_0xfd72('0x30')](_0x441043[_0xfd72('0x28')]({'exitAt':moment()[_0xfd72('0x24')](_0xfd72('0x2c'))}));});return BPromise[_0xfd72('0x4b')](_0x3b7365);}}})['then'](function(){if(_0x5df5b3){return _0x5df5b3['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x3cb48b){_0x5d1aa6(_0x3cb48b);})['catch'](function(_0x2636b5){_0x124318(_0x3fa279['error'](0x1f4,_0x2636b5['message']));});});};exports[_0xfd72('0x4c')]=function(_0x144232){var _0x2a389d=this;return new Promise(function(_0x5c03b8,_0xb4d333){var _0x323aaf;var _0x155839;var _0x22ac05;var _0x98c89;return db['User']['findOne']({'where':_0x144232[_0xfd72('0x10')][_0xfd72('0x11')]||{},'attributes':['id',_0xfd72('0x20'),_0xfd72('0x21'),'mobile','phone',_0xfd72('0x22'),_0xfd72('0x4d'),_0xfd72('0x23')]})[_0xfd72('0x16')](function(_0x4b7b0b){if(_0x4b7b0b){_0x323aaf=_0x4b7b0b;_0x98c89=_0x144232['body'][_0xfd72('0x23')]?_0x144232[_0xfd72('0x33')][_0xfd72('0x23')]:util[_0xfd72('0x24')](_0xfd72('0x32'),_0x323aaf['name']);return db[_0xfd72('0xe')][_0xfd72('0x4e')]({'where':{'role':_0xfd72('0x4f'),'online':!![],'id':{'$ne':_0x323aaf['id']}}});}})[_0xfd72('0x16')](function(_0x45d604){if(_0x45d604){_0x22ac05=_0x45d604;return require(_0xfd72('0x50'))[_0xfd72('0x51')]();}})['then'](function(_0x2d01e2){if(_0x2d01e2&&_0x2d01e2[_0xfd72('0x52')]&&_0x22ac05>=_0x2d01e2['agents']){throw new Error(_0xfd72('0x53'));}})[_0xfd72('0x16')](function(){if(_0x323aaf){return db[_0xfd72('0x27')][_0xfd72('0x4a')]({'where':{'membername':_0x323aaf[_0xfd72('0x20')]},'individualHooks':!![]});}})[_0xfd72('0x16')](function(){if(_0x323aaf){return _0x323aaf[_0xfd72('0x54')]({'raw':!![]});}})[_0xfd72('0x16')](function(_0x5a720d){if(_0x323aaf){if(_0x5a720d){var _0x6793a9=[];_0x155839=_0x5a720d;if(_0x155839[_0xfd72('0x2b')]){for(var _0x2d96ce=0x0;_0x2d96ce<_0x155839['length'];_0x2d96ce++){_0x6793a9[_0xfd72('0x30')](db[_0xfd72('0x27')][_0xfd72('0x55')]({'membername':_0x323aaf[_0xfd72('0x20')],'UserId':_0x323aaf['id'],'queue_name':_0x155839[_0x2d96ce]['name'],'VoiceQueueId':_0x155839[_0x2d96ce]['id'],'interface':_0x98c89,'paused':_0x323aaf['loginInPause']||![],'penalty':_0x155839[_0x2d96ce][_0xfd72('0x56')]||0x0}));}return BPromise['all'](_0x6793a9);}}}})['then'](function(){if(_0x323aaf){return db[_0xfd72('0x29')][_0xfd72('0xf')]({'where':{'membername':_0x323aaf[_0xfd72('0x20')],'exitAt':null}});}})[_0xfd72('0x16')](function(_0x12695e){if(_0x323aaf){if(_0x12695e&&_0x12695e['length']){var _0x4a4716=[];_0x12695e['forEach'](function(_0x464503){_0x4a4716[_0xfd72('0x30')](_0x464503[_0xfd72('0x28')]({'exitAt':moment()[_0xfd72('0x24')](_0xfd72('0x2c'))}));});return BPromise['all'](_0x4a4716);}}})[_0xfd72('0x16')](function(){if(_0x323aaf){var _0x4cb180=[];var _0x13f2c0=[];var _0x5abd34=utils['getChannels']();var _0x40f686={'membername':_0x323aaf[_0xfd72('0x20')],'interface':_0x98c89,'enterAt':moment()[_0xfd72('0x24')](_0xfd72('0x2c')),'role':_0x323aaf[_0xfd72('0x21')],'internal':_0x323aaf['internal']};_0x5abd34[_0xfd72('0x2f')](function(_0x5071bb){_0x4cb180[_0xfd72('0x30')](_[_0xfd72('0x57')]({'channel':_0x5071bb,'type':_0xfd72('0x58'),'data1':_0xfd72('0x59'),'data2':_0x98c89},_0x40f686));if(_0x323aaf[_0xfd72('0x4d')]){_0x13f2c0[_0xfd72('0x30')](_['merge']({'channel':_0x5071bb,'type':_0xfd72('0x2a'),'data1':'LOGININPAUSE'},_0x40f686));}});return db[_0xfd72('0x29')][_0xfd72('0x36')](_0x4cb180['concat'](_0x13f2c0),{'individualHooks':!![]});}})[_0xfd72('0x16')](function(){if(_0x323aaf){return _0x323aaf[_0xfd72('0x28')]({'online':!![],'lastLoginAt':moment()[_0xfd72('0x24')](_0xfd72('0x2c')),'voicePause':_0x323aaf[_0xfd72('0x4d')]||![],'mailPause':_0x323aaf[_0xfd72('0x4d')]||![],'chatPause':_0x323aaf[_0xfd72('0x4d')]||![],'faxPause':_0x323aaf[_0xfd72('0x4d')]||![],'smsPause':_0x323aaf[_0xfd72('0x4d')]||![],'openchannelPause':_0x323aaf[_0xfd72('0x4d')]||![],'pauseType':_0x323aaf['loginInPause']?_0xfd72('0x5a'):null,'lastPauseAt':moment()[_0xfd72('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x98c89});}})['then'](function(_0x38beb5){_0x5c03b8(_0x38beb5);})[_0xfd72('0x1a')](function(_0x4d91c1){_0xb4d333(_0x2a389d[_0xfd72('0x1b')](0x1f4,_0x4d91c1[_0xfd72('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 0ad528d..66efbdb 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 _0xbd37=['emit','register','length','user:','./user.events','save','remove','update'];(function(_0x153c6a,_0x2a217a){var _0xce898f=function(_0x84c97c){while(--_0x84c97c){_0x153c6a['push'](_0x153c6a['shift']());}};_0xce898f(++_0x2a217a);}(_0xbd37,0x1d4));var _0x7bd3=function(_0x1d8407,_0xec2418){_0x1d8407=_0x1d8407-0x0;var _0x598b7d=_0xbd37[_0x1d8407];return _0x598b7d;};'use strict';var UserEvents=require(_0x7bd3('0x0'));var events=[_0x7bd3('0x1'),_0x7bd3('0x2'),_0x7bd3('0x3')];function createListener(_0x637691,_0x36de96){return function(_0x53f200){_0x36de96[_0x7bd3('0x4')](_0x637691,_0x53f200);};}function removeListener(_0x4d01c2,_0x2a7c6a){return function(){UserEvents['removeListener'](_0x4d01c2,_0x2a7c6a);};}exports[_0x7bd3('0x5')]=function(_0x485a11){for(var _0xbeb0c=0x0,_0x48b5cc=events[_0x7bd3('0x6')];_0xbeb0c<_0x48b5cc;_0xbeb0c++){var _0x16613f=events[_0xbeb0c];var _0x99772=createListener(_0x7bd3('0x7')+_0x16613f,_0x485a11);UserEvents['on'](_0x16613f,_0x99772);}}; \ No newline at end of file +var _0xe85a=['./user.events','save','remove','update','emit','removeListener','length','user:'];(function(_0x24e24e,_0x3d82a3){var _0x2a68b8=function(_0x426283){while(--_0x426283){_0x24e24e['push'](_0x24e24e['shift']());}};_0x2a68b8(++_0x3d82a3);}(_0xe85a,0x1b0));var _0xae85=function(_0x47264b,_0x26c1b6){_0x47264b=_0x47264b-0x0;var _0x5d2153=_0xe85a[_0x47264b];return _0x5d2153;};'use strict';var UserEvents=require(_0xae85('0x0'));var events=[_0xae85('0x1'),_0xae85('0x2'),_0xae85('0x3')];function createListener(_0x188c1d,_0x1a2086){return function(_0x28e60e){_0x1a2086[_0xae85('0x4')](_0x188c1d,_0x28e60e);};}function removeListener(_0x138752,_0x4990d8){return function(){UserEvents[_0xae85('0x5')](_0x138752,_0x4990d8);};}exports['register']=function(_0x462a31){for(var _0xda6d45=0x0,_0x15d59c=events[_0xae85('0x6')];_0xda6d45<_0x15d59c;_0xda6d45++){var _0x14410b=events[_0xda6d45];var _0x3f9a39=createListener(_0xae85('0x7')+_0x14410b,_0x462a31);UserEvents['on'](_0x14410b,_0x3f9a39);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 6c35cae..9c33fe1 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x404901,_0xb62e54){var _0x393e0e=function(_0x76963b){while(--_0x76963b){_0x404901['push'](_0x404901['shift']());}};_0x393e0e(++_0xb62e54);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4a82ac,_0x1fb931){_0x4a82ac=_0x4a82ac-0x0;var _0x58ee97=_0xcb91[_0x4a82ac];return _0x58ee97;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3451cf,_0x432594){var _0x485e36=function(_0x5d6120){while(--_0x5d6120){_0x3451cf['push'](_0x3451cf['shift']());}};_0x485e36(++_0x432594);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ab38a6a..f13871a 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 _0x3647=['INTEGER'];(function(_0x11cf2a,_0x2207ea){var _0x3d6377=function(_0x3c41e2){while(--_0x3c41e2){_0x11cf2a['push'](_0x11cf2a['shift']());}};_0x3d6377(++_0x2207ea);}(_0x3647,0x161));var _0x7364=function(_0x19276f,_0x2b3b58){_0x19276f=_0x19276f-0x0;var _0xbbca72=_0x3647[_0x19276f];return _0xbbca72;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x7364('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x952a=['exports','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x952a,0x175));var _0xa952=function(_0x273c74,_0x4893fb){_0x273c74=_0x273c74-0x0;var _0x2275cf=_0x952a[_0x273c74];return _0x2275cf;};'use strict';var Sequelize=require(_0xa952('0x0'));module[_0xa952('0x1')]={'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 f33d3b8..f6a95f8 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 _0x3803=['lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue'];(function(_0xfd27d0,_0x5800ae){var _0x4623e3=function(_0x2cac78){while(--_0x2cac78){_0xfd27d0['push'](_0xfd27d0['shift']());}};_0x4623e3(++_0x5800ae);}(_0x3803,0x1c3));var _0x3380=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x3803[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x3380('0x0'));var util=require('util');var logger=require(_0x3380('0x1'))(_0x3380('0x2'));var moment=require(_0x3380('0x3'));var BPromise=require(_0x3380('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3380('0x5'));var rimraf=require('rimraf');var config=require(_0x3380('0x6'));var attributes=require(_0x3380('0x7'));module[_0x3380('0x8')]=function(_0x1135ca,_0x513303){return _0x1135ca[_0x3380('0x9')](_0x3380('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3aeb=['user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue'];(function(_0xcc5a3f,_0x4a5b35){var _0xe3c6f=function(_0x2261f2){while(--_0x2261f2){_0xcc5a3f['push'](_0xcc5a3f['shift']());}};_0xe3c6f(++_0x4a5b35);}(_0x3aeb,0x16d));var _0xb3ae=function(_0x2effbb,_0x1f6e8e){_0x2effbb=_0x2effbb-0x0;var _0x1d23d3=_0x3aeb[_0x2effbb];return _0x1d23d3;};'use strict';var _=require(_0xb3ae('0x0'));var util=require(_0xb3ae('0x1'));var logger=require(_0xb3ae('0x2'))(_0xb3ae('0x3'));var moment=require(_0xb3ae('0x4'));var BPromise=require(_0xb3ae('0x5'));var rp=require(_0xb3ae('0x6'));var fs=require('fs');var path=require(_0xb3ae('0x7'));var rimraf=require(_0xb3ae('0x8'));var config=require(_0xb3ae('0x9'));var attributes=require(_0xb3ae('0xa'));module['exports']=function(_0x469aa1,_0x285b84){return _0x469aa1['define'](_0xb3ae('0xb'),attributes,{'tableName':_0xb3ae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 0adbfd1..93aa84e 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 _0x4b93=['error','code','message','info','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2f0fde,_0x4a2600){var _0x3db999=function(_0x2108b0){while(--_0x2108b0){_0x2f0fde['push'](_0x2f0fde['shift']());}};_0x3db999(++_0x4a2600);}(_0x4b93,0x1e9));var _0x34b9=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4b93[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0x34b9('0x0'));var moment=require(_0x34b9('0x1'));var BPromise=require('bluebird');var rs=require(_0x34b9('0x2'));var fs=require('fs');var Redis=require(_0x34b9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x34b9('0x4'));var logger=require(_0x34b9('0x5'))(_0x34b9('0x6'));var config=require(_0x34b9('0x7'));var jayson=require(_0x34b9('0x8'));var client=jayson['client'][_0x34b9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32e37b,_0x2aa284,_0xf9af97){return new BPromise(function(_0xb08b6d,_0x48b44f){return client[_0x34b9('0xa')](_0x32e37b,_0xf9af97)[_0x34b9('0xb')](function(_0x5972ac){logger['info'](_0x34b9('0xc'),_0x2aa284,_0x34b9('0xd'));logger[_0x34b9('0xe')](_0x34b9('0xf'),_0x2aa284,_0x34b9('0xd'),JSON[_0x34b9('0x10')](_0x5972ac));if(_0x5972ac['error']){if(_0x5972ac[_0x34b9('0x11')][_0x34b9('0x12')]===0x1f4){logger['error'](_0x34b9('0xc'),_0x2aa284,_0x5972ac[_0x34b9('0x11')][_0x34b9('0x13')]);return _0x48b44f(_0x5972ac[_0x34b9('0x11')]['message']);}logger[_0x34b9('0x11')](_0x34b9('0xc'),_0x2aa284,_0x5972ac[_0x34b9('0x11')]['message']);return _0xb08b6d(_0x5972ac[_0x34b9('0x11')][_0x34b9('0x13')]);}else{logger[_0x34b9('0x14')](_0x34b9('0xc'),_0x2aa284,_0x34b9('0xd'));_0xb08b6d(_0x5972ac['result'][_0x34b9('0x13')]);}})[_0x34b9('0x15')](function(_0x479619){logger['error'](_0x34b9('0xc'),_0x2aa284,_0x479619);_0x48b44f(_0x479619);});});} \ No newline at end of file +var _0xa62a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','moment'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xa62a,0xf0));var _0xaa62=function(_0x3d5798,_0x11a5a4){_0x3d5798=_0x3d5798-0x0;var _0x2f9b86=_0xa62a[_0x3d5798];return _0x2f9b86;};'use strict';var _=require(_0xaa62('0x0'));var util=require('util');var moment=require(_0xaa62('0x1'));var BPromise=require(_0xaa62('0x2'));var rs=require(_0xaa62('0x3'));var fs=require('fs');var Redis=require(_0xaa62('0x4'));var db=require(_0xaa62('0x5'))['db'];var utils=require(_0xaa62('0x6'));var logger=require(_0xaa62('0x7'))(_0xaa62('0x8'));var config=require('../../config/environment');var jayson=require(_0xaa62('0x9'));var client=jayson[_0xaa62('0xa')][_0xaa62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x413ac1,_0x1aa42b,_0x32e960){return new BPromise(function(_0x1feb3b,_0x5066eb){return client[_0xaa62('0xc')](_0x413ac1,_0x32e960)[_0xaa62('0xd')](function(_0x3b9eec){logger[_0xaa62('0xe')](_0xaa62('0xf'),_0x1aa42b,'request\x20sent');logger[_0xaa62('0x10')](_0xaa62('0x11'),_0x1aa42b,_0xaa62('0x12'),JSON['stringify'](_0x3b9eec));if(_0x3b9eec['error']){if(_0x3b9eec[_0xaa62('0x13')][_0xaa62('0x14')]===0x1f4){logger[_0xaa62('0x13')](_0xaa62('0xf'),_0x1aa42b,_0x3b9eec[_0xaa62('0x13')]['message']);return _0x5066eb(_0x3b9eec[_0xaa62('0x13')][_0xaa62('0x15')]);}logger[_0xaa62('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x1aa42b,_0x3b9eec['error']['message']);return _0x1feb3b(_0x3b9eec[_0xaa62('0x13')][_0xaa62('0x15')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x1aa42b,_0xaa62('0x12'));_0x1feb3b(_0x3b9eec['result'][_0xaa62('0x15')]);}})['catch'](function(_0x5a21c6){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x1aa42b,_0x5a21c6);_0x5066eb(_0x5a21c6);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 64620c9..276d16e 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(_0x74dc69,_0x188e6d){var _0x58a342=function(_0x1c1555){while(--_0x1c1555){_0x74dc69['push'](_0x74dc69['shift']());}};_0x58a342(++_0x188e6d);}(_0x70e0,0x17b));var _0x070e=function(_0x202106,_0x3d8c95){_0x202106=_0x202106-0x0;var _0x3d92b1=_0x70e0[_0x202106];return _0x3d92b1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4a12fc,_0x449a9e){var _0x4c0b0d=function(_0x57ae6b){while(--_0x57ae6b){_0x4a12fc['push'](_0x4a12fc['shift']());}};_0x4c0b0d(++_0x449a9e);}(_0xe706,0xa3));var _0x6e70=function(_0xcb56d2,_0x18c194){_0xcb56d2=_0xcb56d2-0x0;var _0x57bed4=_0xe706[_0xcb56d2];return _0x57bed4;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index a6eac52..2151793 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 _0x4f63=['exports','INTEGER'];(function(_0x6e3035,_0x2b0be3){var _0x3a4710=function(_0x4635c0){while(--_0x4635c0){_0x6e3035['push'](_0x6e3035['shift']());}};_0x3a4710(++_0x2b0be3);}(_0x4f63,0x1b2));var _0x34f6=function(_0x383fac,_0xeda6b6){_0x383fac=_0x383fac-0x0;var _0x38d3b6=_0x4f63[_0x383fac];return _0x38d3b6;};'use strict';var Sequelize=require('sequelize');module[_0x34f6('0x0')]={'penalty':{'type':Sequelize[_0x34f6('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5362=['exports','INTEGER','STRING'];(function(_0x39edf1,_0x3616a9){var _0x348891=function(_0x2fd7d9){while(--_0x2fd7d9){_0x39edf1['push'](_0x39edf1['shift']());}};_0x348891(++_0x3616a9);}(_0x5362,0xc9));var _0x2536=function(_0x27db1b,_0x3417df){_0x27db1b=_0x27db1b-0x0;var _0x304e3d=_0x5362[_0x27db1b];return _0x304e3d;};'use strict';var Sequelize=require('sequelize');module[_0x2536('0x0')]={'penalty':{'type':Sequelize[_0x2536('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2536('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x2536('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index f5ac4d1..7903aa2 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 _0x9eee=['path','rimraf','../../config/environment','exports','user_has_fax_queues','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9eee,0x164));var _0xe9ee=function(_0x4ab406,_0x1891b9){_0x4ab406=_0x4ab406-0x0;var _0x45baff=_0x9eee[_0x4ab406];return _0x45baff;};'use strict';var _=require('lodash');var util=require(_0xe9ee('0x0'));var logger=require(_0xe9ee('0x1'))('api');var moment=require(_0xe9ee('0x2'));var BPromise=require(_0xe9ee('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9ee('0x4'));var rimraf=require(_0xe9ee('0x5'));var config=require(_0xe9ee('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0xe9ee('0x7')]=function(_0x1a57be,_0x232208){return _0x1a57be['define']('UserFaxQueue',attributes,{'tableName':_0xe9ee('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd16c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','UserFaxQueue','user_has_fax_queues'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xd16c,0xa8));var _0xcd16=function(_0x419f6e,_0x214f83){_0x419f6e=_0x419f6e-0x0;var _0x28c71d=_0xd16c[_0x419f6e];return _0x28c71d;};'use strict';var _=require('lodash');var util=require(_0xcd16('0x0'));var logger=require(_0xcd16('0x1'))(_0xcd16('0x2'));var moment=require(_0xcd16('0x3'));var BPromise=require(_0xcd16('0x4'));var rp=require(_0xcd16('0x5'));var fs=require('fs');var path=require(_0xcd16('0x6'));var rimraf=require(_0xcd16('0x7'));var config=require(_0xcd16('0x8'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x3f07fa,_0x176b15){return _0x3f07fa[_0xcd16('0x9')](_0xcd16('0xa'),attributes,{'tableName':_0xcd16('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 6bfa9a3..6a5654d 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 _0xb740=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x122d2b,_0x70044d){var _0x55ac23=function(_0x1a954b){while(--_0x1a954b){_0x122d2b['push'](_0x122d2b['shift']());}};_0x55ac23(++_0x70044d);}(_0xb740,0x134));var _0x0b74=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb740[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0b74('0x0'));var util=require('util');var moment=require(_0x0b74('0x1'));var BPromise=require(_0x0b74('0x2'));var rs=require(_0x0b74('0x3'));var fs=require('fs');var Redis=require(_0x0b74('0x4'));var db=require(_0x0b74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b74('0x6'))(_0x0b74('0x7'));var config=require(_0x0b74('0x8'));var jayson=require(_0x0b74('0x9'));var client=jayson[_0x0b74('0xa')][_0x0b74('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100115,_0x47c346,_0x475ca4){return new BPromise(function(_0x478d7d,_0x35a569){return client['request'](_0x100115,_0x475ca4)[_0x0b74('0xc')](function(_0x27c959){logger[_0x0b74('0xd')](_0x0b74('0xe'),_0x47c346,_0x0b74('0xf'));logger[_0x0b74('0x10')](_0x0b74('0x11'),_0x47c346,'request\x20sent',JSON[_0x0b74('0x12')](_0x27c959));if(_0x27c959[_0x0b74('0x13')]){if(_0x27c959[_0x0b74('0x13')][_0x0b74('0x14')]===0x1f4){logger['error'](_0x0b74('0xe'),_0x47c346,_0x27c959[_0x0b74('0x13')]['message']);return _0x35a569(_0x27c959[_0x0b74('0x13')][_0x0b74('0x15')]);}logger[_0x0b74('0x13')](_0x0b74('0xe'),_0x47c346,_0x27c959[_0x0b74('0x13')][_0x0b74('0x15')]);return _0x478d7d(_0x27c959[_0x0b74('0x13')][_0x0b74('0x15')]);}else{logger[_0x0b74('0xd')](_0x0b74('0xe'),_0x47c346,'request\x20sent');_0x478d7d(_0x27c959[_0x0b74('0x16')][_0x0b74('0x15')]);}})[_0x0b74('0x17')](function(_0x3519ad){logger[_0x0b74('0x13')](_0x0b74('0xe'),_0x47c346,_0x3519ad);_0x35a569(_0x3519ad);});});} \ No newline at end of file +var _0x2921=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x2921,0x163));var _0x1292=function(_0xc838bf,_0x5b8b62){_0xc838bf=_0xc838bf-0x0;var _0x50afa5=_0x2921[_0xc838bf];return _0x50afa5;};'use strict';var _=require(_0x1292('0x0'));var util=require('util');var moment=require(_0x1292('0x1'));var BPromise=require(_0x1292('0x2'));var rs=require(_0x1292('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1292('0x4'))['db'];var utils=require(_0x1292('0x5'));var logger=require('../../config/logger')(_0x1292('0x6'));var config=require('../../config/environment');var jayson=require(_0x1292('0x7'));var client=jayson[_0x1292('0x8')][_0x1292('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fa0cd,_0x40e9bc,_0x308768){return new BPromise(function(_0x23b593,_0x12a857){return client[_0x1292('0xa')](_0x4fa0cd,_0x308768)[_0x1292('0xb')](function(_0x173c52){logger[_0x1292('0xc')](_0x1292('0xd'),_0x40e9bc,_0x1292('0xe'));logger[_0x1292('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x40e9bc,_0x1292('0xe'),JSON[_0x1292('0x10')](_0x173c52));if(_0x173c52[_0x1292('0x11')]){if(_0x173c52[_0x1292('0x11')][_0x1292('0x12')]===0x1f4){logger[_0x1292('0x11')](_0x1292('0xd'),_0x40e9bc,_0x173c52['error'][_0x1292('0x13')]);return _0x12a857(_0x173c52[_0x1292('0x11')]['message']);}logger[_0x1292('0x11')](_0x1292('0xd'),_0x40e9bc,_0x173c52[_0x1292('0x11')][_0x1292('0x13')]);return _0x23b593(_0x173c52['error']['message']);}else{logger[_0x1292('0xc')](_0x1292('0xd'),_0x40e9bc,_0x1292('0xe'));_0x23b593(_0x173c52[_0x1292('0x14')]['message']);}})[_0x1292('0x15')](function(_0x463721){logger[_0x1292('0x11')](_0x1292('0xd'),_0x40e9bc,_0x463721);_0x12a857(_0x463721);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 24a3db8..dfa129d 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2534f4,_0x5ab78c){var _0x1c6684=function(_0x36a486){while(--_0x36a486){_0x2534f4['push'](_0x2534f4['shift']());}};_0x1c6684(++_0x5ab78c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4bbe00,_0x1d2f14){var _0x3999d2=function(_0x4390fa){while(--_0x4390fa){_0x4bbe00['push'](_0x4bbe00['shift']());}};_0x3999d2(++_0x1d2f14);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 9006424..89c4a82 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe776=['INTEGER','sequelize','exports'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xe776,0xc4));var _0x6e77=function(_0x34ff1e,_0x3bfbfb){_0x34ff1e=_0x34ff1e-0x0;var _0x110bcb=_0xe776[_0x34ff1e];return _0x110bcb;};'use strict';var Sequelize=require(_0x6e77('0x0'));module[_0x6e77('0x1')]={'penalty':{'type':Sequelize[_0x6e77('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 2aee2f1..a1a498a 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 _0x5d24=['bluebird','rimraf','../../config/environment','exports','UserMailQueue','user_has_mail_queues','lodash','../../config/logger','api','moment'];(function(_0x5d25b5,_0x3c6bb0){var _0x1a3117=function(_0x37b198){while(--_0x37b198){_0x5d25b5['push'](_0x5d25b5['shift']());}};_0x1a3117(++_0x3c6bb0);}(_0x5d24,0xf6));var _0x45d2=function(_0x255a16,_0x5bc386){_0x255a16=_0x255a16-0x0;var _0x251f79=_0x5d24[_0x255a16];return _0x251f79;};'use strict';var _=require(_0x45d2('0x0'));var util=require('util');var logger=require(_0x45d2('0x1'))(_0x45d2('0x2'));var moment=require(_0x45d2('0x3'));var BPromise=require(_0x45d2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x45d2('0x5'));var config=require(_0x45d2('0x6'));var attributes=require('./userMailQueue.attributes');module[_0x45d2('0x7')]=function(_0x112d3c,_0xfd3186){return _0x112d3c['define'](_0x45d2('0x8'),attributes,{'tableName':_0x45d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e81=['./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment'];(function(_0x58ee19,_0xdf0765){var _0x49af25=function(_0x109b5e){while(--_0x109b5e){_0x58ee19['push'](_0x58ee19['shift']());}};_0x49af25(++_0xdf0765);}(_0x5e81,0x13a));var _0x15e8=function(_0x3bba82,_0x5463fb){_0x3bba82=_0x3bba82-0x0;var _0x3f47f0=_0x5e81[_0x3bba82];return _0x3f47f0;};'use strict';var _=require(_0x15e8('0x0'));var util=require(_0x15e8('0x1'));var logger=require(_0x15e8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x15e8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x15e8('0x4'));var config=require(_0x15e8('0x5'));var attributes=require(_0x15e8('0x6'));module['exports']=function(_0xbe2681,_0x15a5ad){return _0xbe2681[_0x15e8('0x7')](_0x15e8('0x8'),attributes,{'tableName':_0x15e8('0x9'),'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 c770ee2..41b4101 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x3b03f1,_0x120315){var _0x4c36a3=function(_0x246cd2){while(--_0x246cd2){_0x3b03f1['push'](_0x3b03f1['shift']());}};_0x4c36a3(++_0x120315);}(_0x4b84,0x1cc));var _0x44b8=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0x4b84[_0x6173fc];return _0x965fbe;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x341751,_0x501bd4){var _0x2c8f0b=function(_0x3d6af7){while(--_0x3d6af7){_0x341751['push'](_0x341751['shift']());}};_0x2c8f0b(++_0x501bd4);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 1abbd7b..38a7a2c 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 _0xa2a5=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3bd364,_0x31fe80){var _0x3e3a4e=function(_0x5d8a70){while(--_0x5d8a70){_0x3bd364['push'](_0x3bd364['shift']());}};_0x3e3a4e(++_0x31fe80);}(_0xa2a5,0x1ce));var _0x5a2a=function(_0x11ec97,_0x392d0a){_0x11ec97=_0x11ec97-0x0;var _0x269477=_0xa2a5[_0x11ec97];return _0x269477;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5a2a('0x0'));var timeout=require(_0x5a2a('0x1'));var express=require(_0x5a2a('0x2'));var router=express[_0x5a2a('0x3')]();var fs_extra=require(_0x5a2a('0x4'));var auth=require(_0x5a2a('0x5'));var interaction=require(_0x5a2a('0x6'));var config=require(_0x5a2a('0x7'));var controller=require(_0x5a2a('0x8'));router[_0x5a2a('0x9')]('/',auth[_0x5a2a('0xa')](),controller[_0x5a2a('0xb')]);module[_0x5a2a('0xc')]=router; \ No newline at end of file +var _0xa976=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','util','connect-timeout','express','Router'];(function(_0xbf1a25,_0x3514cc){var _0x3b0f85=function(_0x1af81b){while(--_0x1af81b){_0xbf1a25['push'](_0xbf1a25['shift']());}};_0x3b0f85(++_0x3514cc);}(_0xa976,0x74));var _0x6a97=function(_0xfacc27,_0x76f9e3){_0xfacc27=_0xfacc27-0x0;var _0x2fbff8=_0xa976[_0xfacc27];return _0x2fbff8;};'use strict';var multer=require('multer');var util=require(_0x6a97('0x0'));var path=require('path');var timeout=require(_0x6a97('0x1'));var express=require(_0x6a97('0x2'));var router=express[_0x6a97('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6a97('0x4'));var config=require(_0x6a97('0x5'));var controller=require(_0x6a97('0x6'));router[_0x6a97('0x7')]('/',auth[_0x6a97('0x8')](),controller[_0x6a97('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 62ec2bd..3ae5cc2 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 _0xb77a=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x5f02c9,_0x100ff4){var _0x269749=function(_0x151430){while(--_0x151430){_0x5f02c9['push'](_0x5f02c9['shift']());}};_0x269749(++_0x100ff4);}(_0xb77a,0xa3));var _0xab77=function(_0x6b3014,_0x34e2f3){_0x6b3014=_0x6b3014-0x0;var _0x36bef7=_0xb77a[_0x6b3014];return _0x36bef7;};'use strict';var Sequelize=require(_0xab77('0x0'));module[_0xab77('0x1')]={'body':{'type':Sequelize[_0xab77('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xab77('0x2')]},'recipientsDescription':{'type':Sequelize[_0xab77('0x3')]},'beep':{'type':Sequelize[_0xab77('0x4')]}}; \ No newline at end of file +var _0xe74c=['TEXT','STRING','sequelize','exports'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xe74c,0x17e));var _0xce74=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xe74c[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0xce74('0x0'));module[_0xce74('0x1')]={'body':{'type':Sequelize[_0xce74('0x2')]},'senderName':{'type':Sequelize[_0xce74('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xce74('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 1be1256..44457fd 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 _0xb44a=['fullname','recipientsDescription','isEmpty','beep','SenderId','user','sequelize','UserNotification','create','recipient','userNotification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','startCase','User','union','ids','queue','replace','Queue','push','all','catch','map','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','limit','undefined','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','view','Sequelize','recipients','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','openchannelqueue','smsqueue','voicequeue','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName'];(function(_0x3a305a,_0x534cd5){var _0xbb4d1=function(_0x572288){while(--_0x572288){_0x3a305a['push'](_0x3a305a['shift']());}};_0xbb4d1(++_0x534cd5);}(_0xb44a,0x7a));var _0xab44=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0xb44a[_0x1b4002];return _0x1716f3;};'use strict';var emlformat=require(_0xab44('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xab44('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab44('0x2'));var moment=require(_0xab44('0x3'));var BPromise=require(_0xab44('0x4'));var Mustache=require(_0xab44('0x5'));var util=require('util');var path=require('path');var sox=require(_0xab44('0x6'));var csv=require('to-csv');var ejs=require(_0xab44('0x7'));var fs=require('fs');var fs_extra=require(_0xab44('0x8'));var _=require(_0xab44('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xab44('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xab44('0xb'));var Papa=require('papaparse');var Redis=require(_0xab44('0xc'));var authService=require(_0xab44('0xd'));var qs=require(_0xab44('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab44('0xf'));var logger=require(_0xab44('0x10'))(_0xab44('0x11'));var utils=require('../../config/utils');var config=require(_0xab44('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xab44('0x13'))['db'];config[_0xab44('0x14')]=_[_0xab44('0x15')](config['redis'],{'host':_0xab44('0x16'),'port':0x18eb});var socket=require(_0xab44('0x17'))(new Redis(config[_0xab44('0x14')]));require(_0xab44('0x18'))[_0xab44('0x19')](socket);function respondWithStatusCode(_0x33d47d,_0x2401ae){_0x2401ae=_0x2401ae||0xcc;return function(_0x435ff2){if(_0x435ff2){return _0x33d47d['sendStatus'](_0x2401ae);}return _0x33d47d[_0xab44('0x1a')](_0x2401ae)['end']();};}function respondWithResult(_0x5e9939,_0x5ddc67){_0x5ddc67=_0x5ddc67||0xc8;return function(_0x489d62){if(_0x489d62){return _0x5e9939[_0xab44('0x1a')](_0x5ddc67)['json'](_0x489d62);}};}function respondWithFilteredResult(_0x44ae7d,_0x1d3f45){return function(_0x20736c){if(_0x20736c){var _0x2b697e=typeof _0x1d3f45['offset']==='undefined'&&typeof _0x1d3f45[_0xab44('0x1b')]===_0xab44('0x1c');var _0x47dc8e=_0x20736c[_0xab44('0x1d')];var _0x46e4f1=_0x2b697e?0x0:_0x1d3f45[_0xab44('0x1e')];var _0x3c1c3f=_0x2b697e?_0x20736c[_0xab44('0x1d')]:_0x1d3f45[_0xab44('0x1e')]+_0x1d3f45[_0xab44('0x1b')];var _0x44697b;if(_0x3c1c3f>=_0x47dc8e){_0x3c1c3f=_0x47dc8e;_0x44697b=0xc8;}else{_0x44697b=0xce;}_0x44ae7d[_0xab44('0x1a')](_0x44697b);return _0x44ae7d['set'](_0xab44('0x1f'),_0x46e4f1+'-'+_0x3c1c3f+'/'+_0x47dc8e)[_0xab44('0x20')](_0x20736c);}return null;};}function patchUpdates(_0x1514e7){return function(_0x20615f){try{jsonpatch[_0xab44('0x21')](_0x20615f,_0x1514e7,!![]);}catch(_0xa7034){return BPromise[_0xab44('0x22')](_0xa7034);}return _0x20615f[_0xab44('0x23')]();};}function saveUpdates(_0xae29a8,_0x3017a9){return function(_0x51ed92){if(_0x51ed92){return _0x51ed92[_0xab44('0x24')](_0xae29a8)[_0xab44('0x25')](function(_0x2ba024){return _0x2ba024;});}return null;};}function removeEntity(_0x43a470,_0x56235e){return function(_0x31e09){if(_0x31e09){return _0x31e09[_0xab44('0x26')]()[_0xab44('0x25')](function(){_0x43a470[_0xab44('0x1a')](0xcc)[_0xab44('0x27')]();});}};}function handleEntityNotFound(_0x2feea7,_0x101680){return function(_0x293676){if(!_0x293676){_0x2feea7[_0xab44('0x28')](0x194);}return _0x293676;};}function handleError(_0x497889,_0x4fc871){_0x4fc871=_0x4fc871||0x1f4;return function(_0x2311f2){logger[_0xab44('0x29')](_0x2311f2[_0xab44('0x2a')]);if(_0x2311f2['name']){delete _0x2311f2[_0xab44('0x2b')];}_0x497889[_0xab44('0x1a')](_0x4fc871)[_0xab44('0x2c')](_0x2311f2);};}exports[_0xab44('0x2d')]=function(_0x579805,_0x35f552,_0x82ae8){if(!_0x579805[_0xab44('0x2e')][_0xab44('0x2f')](_0xab44('0x30'))&&!_0x579805['body'][_0xab44('0x2f')](_0xab44('0x31'))){throw new db['Sequelize'][(_0xab44('0x32'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x579805[_0xab44('0x2e')][_0xab44('0x2f')](_0xab44('0x31'))&&!_0x579805[_0xab44('0x2e')][_0xab44('0x2f')](_0xab44('0x33'))){throw new db[(_0xab44('0x34'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x579805[_0xab44('0x2e')][_0xab44('0x2f')](_0xab44('0x35'))){throw new db['Sequelize']['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x5b92db=JSON[_0xab44('0x36')](_0x579805[_0xab44('0x2e')][_0xab44('0x35')]);}catch(_0x175852){logger[_0xab44('0x29')](_0x175852);throw new db['Sequelize'][(_0xab44('0x32'))](_0xab44('0x37'));}var _0x5d65a2=['chatqueue',_0xab44('0x38'),'mailqueue',_0xab44('0x39'),_0xab44('0x3a'),_0xab44('0x3b'),'whatsappqueue','team','user'];if(_[_0xab44('0x3c')](_0x5b92db,function(_0x16659){return!_[_0xab44('0x3d')](_0x5d65a2,_0x16659[_0xab44('0x3e')][_0xab44('0x3f')]());})){throw new db[(_0xab44('0x34'))][(_0xab44('0x32'))](_0xab44('0x40'));}}}var _0x47f917={};_0x47f917[_0xab44('0x41')]=_0x579805[_0xab44('0x2e')]['hasOwnProperty'](_0xab44('0x41'))?_0x579805[_0xab44('0x2e')][_0xab44('0x41')]:_0x579805['user'][_0xab44('0x42')];_0x47f917[_0xab44('0x43')]=_[_0xab44('0x44')](_0x579805[_0xab44('0x2e')]['recipientsDescription'])?null:_0x579805[_0xab44('0x2e')][_0xab44('0x43')];_0x47f917[_0xab44('0x45')]=_0x579805[_0xab44('0x2e')][_0xab44('0x45')]||![];_0x47f917[_0xab44('0x46')]=_0x579805[_0xab44('0x47')]['id'];return getContent(_0x579805[_0xab44('0x2e')])['then'](function(_0x18dba7){_0x47f917[_0xab44('0x2e')]=_0x18dba7;return getRecipients(_0x5b92db);})['then'](function(_0x856cce){_0x47f917['recipientsId']=_['sortBy'](_0x856cce)['join'](',');return db[_0xab44('0x48')]['transaction'](function(_0x154d5d){return db[_0xab44('0x49')][_0xab44('0x4a')](_0x47f917,{'raw':!![],'transaction':_0x154d5d})['then'](function(_0x113cf3){var _0x4dbdc5={'sender':_0x47f917[_0xab44('0x41')],'description':_0x47f917[_0xab44('0x43')],'content':_0x47f917['body'],'beep':_0x47f917[_0xab44('0x45')]};_0x856cce['forEach'](function(_0x870a43){_0x4dbdc5[_0xab44('0x4b')]=_0x870a43;socket['emit'](_0xab44('0x4c'),_0x4dbdc5);});return _0x113cf3;});});})['then'](respondWithResult(_0x35f552,0xc9))['catch'](handleError(_0x35f552,null));};function getContent(_0xfa1873){return new BPromise(function(_0x4916f7,_0x4a052b){if(_0xfa1873[_0xab44('0x30')]){_0x4916f7(_0xfa1873[_0xab44('0x30')]);return;}return db[_0xab44('0x4d')][_0xab44('0x4e')]({'attributes':[_0xab44('0x4f')],'where':{'id':_0xfa1873[_0xab44('0x31')]},'raw':!![]})[_0xab44('0x25')](function(_0x5ade40){if(!_0x5ade40)throw new db[(_0xab44('0x34'))][(_0xab44('0x32'))](_0xab44('0x50'));var _0x3c5fd2=Mustache[_0xab44('0x51')](_0x5ade40[_0xab44('0x4f')],_0xfa1873[_0xab44('0x33')]);_0x4916f7(_0x3c5fd2);})['catch'](function(_0xfacf74){_0x4a052b(_0xfacf74);});});}function getRecipients(_0x5c0945){return new BPromise(function(_0x2e442f,_0x150108){var _0x8afa2b=[];var _0x3f9b32=[];_0x5c0945[_0xab44('0x52')](function(_0x9605a7){var _0x19d685=_[_0xab44('0x53')](_0x9605a7[_0xab44('0x3e')][_0xab44('0x3f')]());if(_0x19d685===_0xab44('0x54')){_0x8afa2b=_[_0xab44('0x55')](_0x8afa2b,_0x9605a7[_0xab44('0x56')]);}else{if(_[_0xab44('0x3d')](_0x19d685,_0xab44('0x57')))_0x19d685=_0x19d685[_0xab44('0x58')](_0xab44('0x57'),_0xab44('0x59'));_0x9605a7[_0xab44('0x56')][_0xab44('0x52')](function(_0xe1f731){_0x3f9b32[_0xab44('0x5a')](getAgents(_0x19d685,_0xe1f731));});}});return BPromise[_0xab44('0x5b')](_0x3f9b32)['then'](function(_0x538e46){_0x8afa2b=_[_0xab44('0x55')](_0x8afa2b,_['flatten'](_0x538e46));_0x2e442f(_0x8afa2b);})[_0xab44('0x5c')](function(_0x4867da){_0x150108(_0x4867da);});});}function getAgents(_0x44c2a4,_0x55a7ae){return new BPromise(function(_0x1c60e9,_0x5dadfc){return db[_0x44c2a4]['findOne']({'where':{'id':_0x55a7ae}})[_0xab44('0x25')](function(_0xb92871){return _0xb92871['getAgents']({'attributes':['id'],'raw':!![]})[_0xab44('0x25')](function(_0x4c4b5e){var _0x53bd71=_[_0xab44('0x5d')](_0x4c4b5e,'id');_0x1c60e9(_0x53bd71);});})[_0xab44('0x5c')](function(_0x224cad){_0x5dadfc(_0x224cad);});});} \ No newline at end of file +var _0xbbb9=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','sequelize','transaction','UserNotification','forEach','recipient','emit','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','ids','queue','replace','Queue','push','all','union','flatten','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','lodash','squel','crypto','jsforce'];(function(_0x842f30,_0x5a3981){var _0x24caa8=function(_0x167d3e){while(--_0x167d3e){_0x842f30['push'](_0x842f30['shift']());}};_0x24caa8(++_0x5a3981);}(_0xbbb9,0x187));var _0x9bbb=function(_0x1590e6,_0x5cb128){_0x1590e6=_0x1590e6-0x0;var _0x42b188=_0xbbb9[_0x1590e6];return _0x42b188;};'use strict';var emlformat=require(_0x9bbb('0x0'));var rimraf=require(_0x9bbb('0x1'));var zipdir=require(_0x9bbb('0x2'));var jsonpatch=require(_0x9bbb('0x3'));var rp=require(_0x9bbb('0x4'));var moment=require(_0x9bbb('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9bbb('0x6'));var path=require(_0x9bbb('0x7'));var sox=require('sox');var csv=require(_0x9bbb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bbb('0x9'));var squel=require(_0x9bbb('0xa'));var crypto=require(_0x9bbb('0xb'));var jsforce=require(_0x9bbb('0xc'));var deskjs=require(_0x9bbb('0xd'));var toCsv=require(_0x9bbb('0x8'));var querystring=require(_0x9bbb('0xe'));var Papa=require(_0x9bbb('0xf'));var Redis=require(_0x9bbb('0x10'));var authService=require(_0x9bbb('0x11'));var qs=require(_0x9bbb('0x12'));var as=require(_0x9bbb('0x13'));var hardwareService=require(_0x9bbb('0x14'));var logger=require(_0x9bbb('0x15'))(_0x9bbb('0x16'));var utils=require(_0x9bbb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9bbb('0x18'));var db=require('../../mysqldb')['db'];config[_0x9bbb('0x19')]=_[_0x9bbb('0x1a')](config[_0x9bbb('0x19')],{'host':_0x9bbb('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9bbb('0x19')]));require(_0x9bbb('0x1c'))[_0x9bbb('0x1d')](socket);function respondWithStatusCode(_0x16173c,_0x3e0370){_0x3e0370=_0x3e0370||0xcc;return function(_0x2df99e){if(_0x2df99e){return _0x16173c[_0x9bbb('0x1e')](_0x3e0370);}return _0x16173c[_0x9bbb('0x1f')](_0x3e0370)[_0x9bbb('0x20')]();};}function respondWithResult(_0x2ae354,_0x10e4bb){_0x10e4bb=_0x10e4bb||0xc8;return function(_0xe2b82){if(_0xe2b82){return _0x2ae354['status'](_0x10e4bb)[_0x9bbb('0x21')](_0xe2b82);}};}function respondWithFilteredResult(_0x2b89db,_0x1a22bb){return function(_0x417fb9){if(_0x417fb9){var _0x37bb8b=typeof _0x1a22bb[_0x9bbb('0x22')]==='undefined'&&typeof _0x1a22bb[_0x9bbb('0x23')]===_0x9bbb('0x24');var _0x3a6e29=_0x417fb9['count'];var _0x58dd10=_0x37bb8b?0x0:_0x1a22bb['offset'];var _0x37d4f9=_0x37bb8b?_0x417fb9[_0x9bbb('0x25')]:_0x1a22bb[_0x9bbb('0x22')]+_0x1a22bb[_0x9bbb('0x23')];var _0x1d4889;if(_0x37d4f9>=_0x3a6e29){_0x37d4f9=_0x3a6e29;_0x1d4889=0xc8;}else{_0x1d4889=0xce;}_0x2b89db[_0x9bbb('0x1f')](_0x1d4889);return _0x2b89db[_0x9bbb('0x26')](_0x9bbb('0x27'),_0x58dd10+'-'+_0x37d4f9+'/'+_0x3a6e29)['json'](_0x417fb9);}return null;};}function patchUpdates(_0x47f4a4){return function(_0x2e73fb){try{jsonpatch[_0x9bbb('0x28')](_0x2e73fb,_0x47f4a4,!![]);}catch(_0x394b07){return BPromise[_0x9bbb('0x29')](_0x394b07);}return _0x2e73fb[_0x9bbb('0x2a')]();};}function saveUpdates(_0x2d6544,_0x41cb41){return function(_0x466bdf){if(_0x466bdf){return _0x466bdf['update'](_0x2d6544)[_0x9bbb('0x2b')](function(_0x1de4b6){return _0x1de4b6;});}return null;};}function removeEntity(_0xd5adfe,_0x1996c7){return function(_0x4676ff){if(_0x4676ff){return _0x4676ff[_0x9bbb('0x2c')]()[_0x9bbb('0x2b')](function(){_0xd5adfe[_0x9bbb('0x1f')](0xcc)[_0x9bbb('0x20')]();});}};}function handleEntityNotFound(_0x6058b7,_0x2b0b7e){return function(_0x3edffa){if(!_0x3edffa){_0x6058b7[_0x9bbb('0x1e')](0x194);}return _0x3edffa;};}function handleError(_0x412261,_0x4471b4){_0x4471b4=_0x4471b4||0x1f4;return function(_0x53325b){logger[_0x9bbb('0x2d')](_0x53325b[_0x9bbb('0x2e')]);if(_0x53325b[_0x9bbb('0x2f')]){delete _0x53325b['name'];}_0x412261[_0x9bbb('0x1f')](_0x4471b4)[_0x9bbb('0x30')](_0x53325b);};}exports[_0x9bbb('0x31')]=function(_0x251845,_0x299311,_0x4efaf6){if(!_0x251845[_0x9bbb('0x32')][_0x9bbb('0x33')](_0x9bbb('0x34'))&&!_0x251845[_0x9bbb('0x32')][_0x9bbb('0x33')](_0x9bbb('0x35'))){throw new db[(_0x9bbb('0x36'))][(_0x9bbb('0x37'))](_0x9bbb('0x38'));}else{if(_0x251845[_0x9bbb('0x32')][_0x9bbb('0x33')]('TemplateId')&&!_0x251845[_0x9bbb('0x32')][_0x9bbb('0x33')](_0x9bbb('0x39'))){throw new db[(_0x9bbb('0x36'))][(_0x9bbb('0x37'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x251845[_0x9bbb('0x32')][_0x9bbb('0x33')](_0x9bbb('0x3a'))){throw new db[(_0x9bbb('0x36'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x27929e=JSON['parse'](_0x251845['body']['recipients']);}catch(_0x57f096){logger[_0x9bbb('0x2d')](_0x57f096);throw new db[(_0x9bbb('0x36'))][(_0x9bbb('0x37'))](_0x9bbb('0x3b'));}var _0x39446f=[_0x9bbb('0x3c'),_0x9bbb('0x3d'),'mailqueue',_0x9bbb('0x3e'),'smsqueue',_0x9bbb('0x3f'),_0x9bbb('0x40'),_0x9bbb('0x41'),_0x9bbb('0x42')];if(_[_0x9bbb('0x43')](_0x27929e,function(_0x341333){return!_[_0x9bbb('0x44')](_0x39446f,_0x341333[_0x9bbb('0x45')][_0x9bbb('0x46')]());})){throw new db['Sequelize']['ValidationError'](_0x9bbb('0x47'));}}}var _0x46d3ca={};_0x46d3ca['senderName']=_0x251845[_0x9bbb('0x32')][_0x9bbb('0x33')](_0x9bbb('0x48'))?_0x251845[_0x9bbb('0x32')][_0x9bbb('0x48')]:_0x251845[_0x9bbb('0x42')][_0x9bbb('0x49')];_0x46d3ca[_0x9bbb('0x4a')]=_[_0x9bbb('0x4b')](_0x251845[_0x9bbb('0x32')][_0x9bbb('0x4a')])?null:_0x251845[_0x9bbb('0x32')][_0x9bbb('0x4a')];_0x46d3ca[_0x9bbb('0x4c')]=_0x251845[_0x9bbb('0x32')]['beep']||![];_0x46d3ca[_0x9bbb('0x4d')]=_0x251845['user']['id'];return getContent(_0x251845[_0x9bbb('0x32')])[_0x9bbb('0x2b')](function(_0x231928){_0x46d3ca[_0x9bbb('0x32')]=_0x231928;return getRecipients(_0x27929e);})[_0x9bbb('0x2b')](function(_0x20858e){_0x46d3ca['recipientsId']=_[_0x9bbb('0x4e')](_0x20858e)['join'](',');return db[_0x9bbb('0x4f')][_0x9bbb('0x50')](function(_0x2b312d){return db[_0x9bbb('0x51')]['create'](_0x46d3ca,{'raw':!![],'transaction':_0x2b312d})[_0x9bbb('0x2b')](function(_0x163002){var _0x25d69a={'sender':_0x46d3ca['senderName'],'description':_0x46d3ca[_0x9bbb('0x4a')],'content':_0x46d3ca['body'],'beep':_0x46d3ca[_0x9bbb('0x4c')]};_0x20858e[_0x9bbb('0x52')](function(_0x50995a){_0x25d69a[_0x9bbb('0x53')]=_0x50995a;socket[_0x9bbb('0x54')]('userNotification:send',_0x25d69a);});return _0x163002;});});})['then'](respondWithResult(_0x299311,0xc9))[_0x9bbb('0x55')](handleError(_0x299311,null));};function getContent(_0x57e42b){return new BPromise(function(_0x48a18b,_0x101653){if(_0x57e42b['text']){_0x48a18b(_0x57e42b['text']);return;}return db['Template'][_0x9bbb('0x56')]({'attributes':[_0x9bbb('0x57')],'where':{'id':_0x57e42b['TemplateId']},'raw':!![]})[_0x9bbb('0x2b')](function(_0x38b87e){if(!_0x38b87e)throw new db[(_0x9bbb('0x36'))][(_0x9bbb('0x37'))](_0x9bbb('0x58'));var _0x432a24=Mustache[_0x9bbb('0x59')](_0x38b87e[_0x9bbb('0x57')],_0x57e42b['view']);_0x48a18b(_0x432a24);})[_0x9bbb('0x55')](function(_0x4a8a7f){_0x101653(_0x4a8a7f);});});}function getRecipients(_0x4b8ccb){return new BPromise(function(_0x41d4a2,_0x554cc1){var _0x19a97a=[];var _0x1f772d=[];_0x4b8ccb[_0x9bbb('0x52')](function(_0x945a24){var _0x4f0246=_[_0x9bbb('0x5a')](_0x945a24[_0x9bbb('0x45')][_0x9bbb('0x46')]());if(_0x4f0246===_0x9bbb('0x5b')){_0x19a97a=_['union'](_0x19a97a,_0x945a24[_0x9bbb('0x5c')]);}else{if(_['includes'](_0x4f0246,_0x9bbb('0x5d')))_0x4f0246=_0x4f0246[_0x9bbb('0x5e')](_0x9bbb('0x5d'),_0x9bbb('0x5f'));_0x945a24[_0x9bbb('0x5c')][_0x9bbb('0x52')](function(_0x340bd6){_0x1f772d[_0x9bbb('0x60')](getAgents(_0x4f0246,_0x340bd6));});}});return BPromise[_0x9bbb('0x61')](_0x1f772d)[_0x9bbb('0x2b')](function(_0x23dee4){_0x19a97a=_[_0x9bbb('0x62')](_0x19a97a,_[_0x9bbb('0x63')](_0x23dee4));_0x41d4a2(_0x19a97a);})[_0x9bbb('0x55')](function(_0x4c1c7f){_0x554cc1(_0x4c1c7f);});});}function getAgents(_0x470786,_0x4c4e0a){return new BPromise(function(_0x1624b1,_0x37c4dc){return db[_0x470786][_0x9bbb('0x56')]({'where':{'id':_0x4c4e0a}})[_0x9bbb('0x2b')](function(_0x4518b7){return _0x4518b7[_0x9bbb('0x64')]({'attributes':['id'],'raw':!![]})[_0x9bbb('0x2b')](function(_0x745215){var _0x348c11=_['map'](_0x745215,'id');_0x1624b1(_0x348c11);});})[_0x9bbb('0x55')](function(_0x14b5fd){_0x37c4dc(_0x14b5fd);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index da61367..dc3c578 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 _0x0a76=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x4d1e51,_0x54ee9e){var _0x5d131a=function(_0x42644d){while(--_0x42644d){_0x4d1e51['push'](_0x4d1e51['shift']());}};_0x5d131a(++_0x54ee9e);}(_0x0a76,0x12e));var _0x60a7=function(_0x18d525,_0x4bbd5){_0x18d525=_0x18d525-0x0;var _0x16ef09=_0x0a76[_0x18d525];return _0x16ef09;};'use strict';var EventEmitter=require(_0x60a7('0x0'));var UserNotification=require(_0x60a7('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x60a7('0x2')](0x0);var events={'afterCreate':_0x60a7('0x3'),'afterUpdate':'update','afterDestroy':_0x60a7('0x4')};function emitEvent(_0x13085e){return function(_0x57898a,_0x5dbd28,_0x40d96f){UserNotificationEvents['emit'](_0x13085e+':'+_0x57898a['id'],_0x57898a);UserNotificationEvents[_0x60a7('0x5')](_0x13085e,_0x57898a);_0x40d96f(null);};}for(var e in events){if(events[_0x60a7('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x60a7('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x0c61=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove'];(function(_0xbf8abb,_0x51b616){var _0x329859=function(_0x55acda){while(--_0x55acda){_0xbf8abb['push'](_0xbf8abb['shift']());}};_0x329859(++_0x51b616);}(_0x0c61,0x1c7));var _0x10c6=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0x0c61[_0x1b02bb];return _0x131245;};'use strict';var EventEmitter=require(_0x10c6('0x0'));var UserNotification=require(_0x10c6('0x1'))['db'][_0x10c6('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x10c6('0x3')](0x0);var events={'afterCreate':_0x10c6('0x4'),'afterUpdate':_0x10c6('0x5'),'afterDestroy':_0x10c6('0x6')};function emitEvent(_0xb382b7){return function(_0x1b7f8a,_0x1b9904,_0x2a42bd){UserNotificationEvents[_0x10c6('0x7')](_0xb382b7+':'+_0x1b7f8a['id'],_0x1b7f8a);UserNotificationEvents['emit'](_0xb382b7,_0x1b7f8a);_0x2a42bd(null);};}for(var e in events){if(events[_0x10c6('0x8')](e)){var event=events[e];UserNotification[_0x10c6('0x9')](e,emitEvent(event));}}module[_0x10c6('0xa')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 1f319e0..96f97f7 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 _0x6313=['define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x47971e,_0x4ede2e){var _0x221f8f=function(_0x55b994){while(--_0x55b994){_0x47971e['push'](_0x47971e['shift']());}};_0x221f8f(++_0x4ede2e);}(_0x6313,0x89));var _0x3631=function(_0x5e7b6c,_0x4916d0){_0x5e7b6c=_0x5e7b6c-0x0;var _0x3afdbd=_0x6313[_0x5e7b6c];return _0x3afdbd;};'use strict';var _=require('lodash');var util=require(_0x3631('0x0'));var logger=require(_0x3631('0x1'))(_0x3631('0x2'));var moment=require(_0x3631('0x3'));var BPromise=require(_0x3631('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3631('0x5'));var rimraf=require(_0x3631('0x6'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module['exports']=function(_0x463910,_0xaf2811){return _0x463910[_0x3631('0x7')](_0x3631('0x8'),attributes,{'tableName':_0x3631('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3631('0xa'),'collate':_0x3631('0xb')});}; \ No newline at end of file +var _0xf609=['userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userNotification.attributes','exports','define','UserNotification'];(function(_0x53fab6,_0x4ef76a){var _0x29e9c4=function(_0x154c75){while(--_0x154c75){_0x53fab6['push'](_0x53fab6['shift']());}};_0x29e9c4(++_0x4ef76a);}(_0xf609,0x18b));var _0x9f60=function(_0x46ce76,_0x392d9e){_0x46ce76=_0x46ce76-0x0;var _0x2263b6=_0xf609[_0x46ce76];return _0x2263b6;};'use strict';var _=require('lodash');var util=require(_0x9f60('0x0'));var logger=require(_0x9f60('0x1'))(_0x9f60('0x2'));var moment=require(_0x9f60('0x3'));var BPromise=require(_0x9f60('0x4'));var rp=require(_0x9f60('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9f60('0x6'));var attributes=require(_0x9f60('0x7'));module[_0x9f60('0x8')]=function(_0x462e54,_0x12972a){return _0x462e54[_0x9f60('0x9')](_0x9f60('0xa'),attributes,{'tableName':_0x9f60('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9f60('0xc'),'collate':_0x9f60('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index d89db23..a3276ea 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 _0x24e4=['redis','localhost','socket.io-emitter','./userNotification.socket','register','request','debug','stringify','error','UserNotification,\x20%s,\x20%s','message','info','result','catch','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','defaults'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x24e4,0x19a));var _0x424e=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0x24e4[_0x234ae1];return _0x227ba0;};'use strict';var _=require(_0x424e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x424e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x424e('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x424e('0x3'))(_0x424e('0x4'));var config=require(_0x424e('0x5'));var jayson=require(_0x424e('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x424e('0x7')](config[_0x424e('0x8')],{'host':_0x424e('0x9'),'port':0x18eb});var socket=require(_0x424e('0xa'))(new Redis(config[_0x424e('0x8')]));require(_0x424e('0xb'))[_0x424e('0xc')](socket);function respondWithRpcPromise(_0x2d5390,_0x49f0a8,_0x5ecc83){return new BPromise(function(_0x47bcc8,_0x4d61fb){return client[_0x424e('0xd')](_0x2d5390,_0x5ecc83)['then'](function(_0x202e6a){logger['info']('UserNotification,\x20%s,\x20%s',_0x49f0a8,'request\x20sent');logger[_0x424e('0xe')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x49f0a8,'request\x20sent',JSON[_0x424e('0xf')](_0x202e6a));if(_0x202e6a[_0x424e('0x10')]){if(_0x202e6a[_0x424e('0x10')]['code']===0x1f4){logger[_0x424e('0x10')](_0x424e('0x11'),_0x49f0a8,_0x202e6a[_0x424e('0x10')][_0x424e('0x12')]);return _0x4d61fb(_0x202e6a['error'][_0x424e('0x12')]);}logger[_0x424e('0x10')](_0x424e('0x11'),_0x49f0a8,_0x202e6a['error']['message']);return _0x47bcc8(_0x202e6a[_0x424e('0x10')][_0x424e('0x12')]);}else{logger[_0x424e('0x13')]('UserNotification,\x20%s,\x20%s',_0x49f0a8,'request\x20sent');_0x47bcc8(_0x202e6a[_0x424e('0x14')][_0x424e('0x12')]);}})[_0x424e('0x15')](function(_0x47b4a0){logger['error'](_0x424e('0x11'),_0x49f0a8,_0x47b4a0);_0x4d61fb(_0x47b4a0);});});} \ No newline at end of file +var _0xfdb1=['localhost','socket.io-emitter','register','request','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdb1,0x8f));var _0x1fdb=function(_0x2c4da5,_0x450cd6){_0x2c4da5=_0x2c4da5-0x0;var _0x32f96e=_0xfdb1[_0x2c4da5];return _0x32f96e;};'use strict';var _=require('lodash');var util=require(_0x1fdb('0x0'));var moment=require(_0x1fdb('0x1'));var BPromise=require(_0x1fdb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fdb('0x3'));var db=require(_0x1fdb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fdb('0x5'))(_0x1fdb('0x6'));var config=require(_0x1fdb('0x7'));var jayson=require(_0x1fdb('0x8'));var client=jayson[_0x1fdb('0x9')][_0x1fdb('0xa')]({'port':0x232a});config['redis']=_[_0x1fdb('0xb')](config[_0x1fdb('0xc')],{'host':_0x1fdb('0xd'),'port':0x18eb});var socket=require(_0x1fdb('0xe'))(new Redis(config[_0x1fdb('0xc')]));require('./userNotification.socket')[_0x1fdb('0xf')](socket);function respondWithRpcPromise(_0x30a723,_0xc75b03,_0x378f43){return new BPromise(function(_0x2a4064,_0x181cda){return client[_0x1fdb('0x10')](_0x30a723,_0x378f43)['then'](function(_0x4b8aa5){logger['info'](_0x1fdb('0x11'),_0xc75b03,'request\x20sent');logger[_0x1fdb('0x12')](_0x1fdb('0x13'),_0xc75b03,'request\x20sent',JSON[_0x1fdb('0x14')](_0x4b8aa5));if(_0x4b8aa5[_0x1fdb('0x15')]){if(_0x4b8aa5[_0x1fdb('0x15')][_0x1fdb('0x16')]===0x1f4){logger[_0x1fdb('0x15')](_0x1fdb('0x11'),_0xc75b03,_0x4b8aa5[_0x1fdb('0x15')][_0x1fdb('0x17')]);return _0x181cda(_0x4b8aa5[_0x1fdb('0x15')][_0x1fdb('0x17')]);}logger[_0x1fdb('0x15')](_0x1fdb('0x11'),_0xc75b03,_0x4b8aa5[_0x1fdb('0x15')][_0x1fdb('0x17')]);return _0x2a4064(_0x4b8aa5[_0x1fdb('0x15')][_0x1fdb('0x17')]);}else{logger['info'](_0x1fdb('0x11'),_0xc75b03,_0x1fdb('0x18'));_0x2a4064(_0x4b8aa5[_0x1fdb('0x19')][_0x1fdb('0x17')]);}})['catch'](function(_0x18e682){logger[_0x1fdb('0x15')]('UserNotification,\x20%s,\x20%s',_0xc75b03,_0x18e682);_0x181cda(_0x18e682);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 556bcb2..6fc2d10 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 _0x8836=['save','remove','emit','register','length','userNotification:','./userNotification.events'];(function(_0x4dd20f,_0x29a4ca){var _0xb9fb47=function(_0x312db6){while(--_0x312db6){_0x4dd20f['push'](_0x4dd20f['shift']());}};_0xb9fb47(++_0x29a4ca);}(_0x8836,0xed));var _0x6883=function(_0x25cb13,_0x179b2f){_0x25cb13=_0x25cb13-0x0;var _0x1a3f6a=_0x8836[_0x25cb13];return _0x1a3f6a;};'use strict';var UserNotificationEvents=require(_0x6883('0x0'));var events=[_0x6883('0x1'),_0x6883('0x2'),'update'];function createListener(_0x389ece,_0x28d259){return function(_0x3e0f3e){_0x28d259[_0x6883('0x3')](_0x389ece,_0x3e0f3e);};}function removeListener(_0x2b5ec0,_0xa4756d){return function(){UserNotificationEvents['removeListener'](_0x2b5ec0,_0xa4756d);};}exports[_0x6883('0x4')]=function(_0x157121){for(var _0x398552=0x0,_0x175d4d=events[_0x6883('0x5')];_0x398552<_0x175d4d;_0x398552++){var _0x538dc8=events[_0x398552];var _0x2be348=createListener(_0x6883('0x6')+_0x538dc8,_0x157121);UserNotificationEvents['on'](_0x538dc8,_0x2be348);}}; \ No newline at end of file +var _0xef0c=['removeListener','register','length','userNotification:','./userNotification.events','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xef0c,0x1f0));var _0xcef0=function(_0x1a93f6,_0x50fd86){_0x1a93f6=_0x1a93f6-0x0;var _0x41be6a=_0xef0c[_0x1a93f6];return _0x41be6a;};'use strict';var UserNotificationEvents=require(_0xcef0('0x0'));var events=['save','remove','update'];function createListener(_0x206c36,_0x2608fc){return function(_0x3a1e36){_0x2608fc[_0xcef0('0x1')](_0x206c36,_0x3a1e36);};}function removeListener(_0x1a12de,_0x1ce36d){return function(){UserNotificationEvents[_0xcef0('0x2')](_0x1a12de,_0x1ce36d);};}exports[_0xcef0('0x3')]=function(_0x5ac88b){for(var _0x17c08d=0x0,_0x5df3ca=events[_0xcef0('0x4')];_0x17c08d<_0x5df3ca;_0x17c08d++){var _0x9db185=events[_0x17c08d];var _0x1b7402=createListener(_0xcef0('0x5')+_0x9db185,_0x5ac88b);UserNotificationEvents['on'](_0x9db185,_0x1b7402);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index e53ae9f..9a0f654 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x18c236,_0x4fe074){var _0xd3b60f=function(_0x277c00){while(--_0x277c00){_0x18c236['push'](_0x18c236['shift']());}};_0xd3b60f(++_0x4fe074);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2a4095,_0x13f4f0){_0x2a4095=_0x2a4095-0x0;var _0x52eeab=_0xcb91[_0x2a4095];return _0x52eeab;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1148db,_0xcc859){var _0x17b465=function(_0x5ddeca){while(--_0x5ddeca){_0x1148db['push'](_0x1148db['shift']());}};_0x17b465(++_0xcc859);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 48afcef..e0d0aef 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 _0x02d1=['sequelize','INTEGER'];(function(_0x39964d,_0x170531){var _0x47e1cc=function(_0x418f9e){while(--_0x418f9e){_0x39964d['push'](_0x39964d['shift']());}};_0x47e1cc(++_0x170531);}(_0x02d1,0xa8));var _0x102d=function(_0x409e38,_0x117f8e){_0x409e38=_0x409e38-0x0;var _0x416d54=_0x02d1[_0x409e38];return _0x416d54;};'use strict';var Sequelize=require(_0x102d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x102d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9d9d=['INTEGER','exports'];(function(_0x3822d9,_0x599bd6){var _0x288194=function(_0x57a733){while(--_0x57a733){_0x3822d9['push'](_0x3822d9['shift']());}};_0x288194(++_0x599bd6);}(_0x9d9d,0x129));var _0xd9d9=function(_0x10f0f5,_0x38cfca){_0x10f0f5=_0x10f0f5-0x0;var _0x27e75f=_0x9d9d[_0x10f0f5];return _0x27e75f;};'use strict';var Sequelize=require('sequelize');module[_0xd9d9('0x0')]={'penalty':{'type':Sequelize[_0xd9d9('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index f306f52..95dda0c 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 _0x8c40=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','lodash'];(function(_0x56562d,_0x578183){var _0xdafef9=function(_0x27453e){while(--_0x27453e){_0x56562d['push'](_0x56562d['shift']());}};_0xdafef9(++_0x578183);}(_0x8c40,0x9f));var _0x08c4=function(_0x383839,_0x399442){_0x383839=_0x383839-0x0;var _0x1a3e3d=_0x8c40[_0x383839];return _0x1a3e3d;};'use strict';var _=require(_0x08c4('0x0'));var util=require(_0x08c4('0x1'));var logger=require(_0x08c4('0x2'))(_0x08c4('0x3'));var moment=require(_0x08c4('0x4'));var BPromise=require(_0x08c4('0x5'));var rp=require(_0x08c4('0x6'));var fs=require('fs');var path=require(_0x08c4('0x7'));var rimraf=require(_0x08c4('0x8'));var config=require('../../config/environment');var attributes=require(_0x08c4('0x9'));module['exports']=function(_0x2c2a0a,_0x1d2acd){return _0x2c2a0a['define']('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5254=['bluebird','request-promise','../../config/environment','./userOpenchannelQueue.attributes','exports','define','lodash','util','api','moment'];(function(_0x43e134,_0x20b467){var _0x43c922=function(_0x378fcd){while(--_0x378fcd){_0x43e134['push'](_0x43e134['shift']());}};_0x43c922(++_0x20b467);}(_0x5254,0x100));var _0x4525=function(_0x449845,_0xf46898){_0x449845=_0x449845-0x0;var _0xa009ed=_0x5254[_0x449845];return _0xa009ed;};'use strict';var _=require(_0x4525('0x0'));var util=require(_0x4525('0x1'));var logger=require('../../config/logger')(_0x4525('0x2'));var moment=require(_0x4525('0x3'));var BPromise=require(_0x4525('0x4'));var rp=require(_0x4525('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4525('0x6'));var attributes=require(_0x4525('0x7'));module[_0x4525('0x8')]=function(_0x3d1de9,_0x477460){return _0x3d1de9[_0x4525('0x9')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','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 bcc7a69..a0031cf 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 _0x32aa=['UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x54ea7a,_0x19df9b){var _0x65a10d=function(_0x1bf936){while(--_0x1bf936){_0x54ea7a['push'](_0x54ea7a['shift']());}};_0x65a10d(++_0x19df9b);}(_0x32aa,0x82));var _0xa32a=function(_0x4f153b,_0x39818f){_0x4f153b=_0x4f153b-0x0;var _0x4e0cf8=_0x32aa[_0x4f153b];return _0x4e0cf8;};'use strict';var _=require(_0xa32a('0x0'));var util=require(_0xa32a('0x1'));var moment=require('moment');var BPromise=require(_0xa32a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa32a('0x3'));var db=require(_0xa32a('0x4'))['db'];var utils=require(_0xa32a('0x5'));var logger=require(_0xa32a('0x6'))(_0xa32a('0x7'));var config=require(_0xa32a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa32a('0x9')][_0xa32a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1624fc,_0x47f5bc,_0x541a24){return new BPromise(function(_0x1c2dcb,_0x110ab2){return client[_0xa32a('0xb')](_0x1624fc,_0x541a24)[_0xa32a('0xc')](function(_0x1194db){logger[_0xa32a('0xd')](_0xa32a('0xe'),_0x47f5bc,_0xa32a('0xf'));logger[_0xa32a('0x10')](_0xa32a('0x11'),_0x47f5bc,_0xa32a('0xf'),JSON[_0xa32a('0x12')](_0x1194db));if(_0x1194db[_0xa32a('0x13')]){if(_0x1194db['error'][_0xa32a('0x14')]===0x1f4){logger['error'](_0xa32a('0xe'),_0x47f5bc,_0x1194db['error']['message']);return _0x110ab2(_0x1194db[_0xa32a('0x13')][_0xa32a('0x15')]);}logger[_0xa32a('0x13')](_0xa32a('0xe'),_0x47f5bc,_0x1194db[_0xa32a('0x13')][_0xa32a('0x15')]);return _0x1c2dcb(_0x1194db['error'][_0xa32a('0x15')]);}else{logger['info'](_0xa32a('0xe'),_0x47f5bc,'request\x20sent');_0x1c2dcb(_0x1194db[_0xa32a('0x16')][_0xa32a('0x15')]);}})[_0xa32a('0x17')](function(_0x21ce6d){logger[_0xa32a('0x13')](_0xa32a('0xe'),_0x47f5bc,_0x21ce6d);_0x110ab2(_0x21ce6d);});});} \ No newline at end of file +var _0x1c77=['jayson/promise','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x1c77,0x13a));var _0x71c7=function(_0x11d95f,_0x34f442){_0x11d95f=_0x11d95f-0x0;var _0x2b1a14=_0x1c77[_0x11d95f];return _0x2b1a14;};'use strict';var _=require(_0x71c7('0x0'));var util=require('util');var moment=require(_0x71c7('0x1'));var BPromise=require(_0x71c7('0x2'));var rs=require(_0x71c7('0x3'));var fs=require('fs');var Redis=require(_0x71c7('0x4'));var db=require(_0x71c7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x71c7('0x6'))('rpc');var config=require(_0x71c7('0x7'));var jayson=require(_0x71c7('0x8'));var client=jayson['client'][_0x71c7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14da1d,_0x590ebf,_0x4a0724){return new BPromise(function(_0x554fa2,_0x112903){return client[_0x71c7('0xa')](_0x14da1d,_0x4a0724)[_0x71c7('0xb')](function(_0x3f35f6){logger['info'](_0x71c7('0xc'),_0x590ebf,_0x71c7('0xd'));logger[_0x71c7('0xe')](_0x71c7('0xf'),_0x590ebf,_0x71c7('0xd'),JSON[_0x71c7('0x10')](_0x3f35f6));if(_0x3f35f6['error']){if(_0x3f35f6[_0x71c7('0x11')][_0x71c7('0x12')]===0x1f4){logger[_0x71c7('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x590ebf,_0x3f35f6[_0x71c7('0x11')][_0x71c7('0x13')]);return _0x112903(_0x3f35f6['error'][_0x71c7('0x13')]);}logger['error'](_0x71c7('0xc'),_0x590ebf,_0x3f35f6[_0x71c7('0x11')][_0x71c7('0x13')]);return _0x554fa2(_0x3f35f6[_0x71c7('0x11')][_0x71c7('0x13')]);}else{logger[_0x71c7('0x14')](_0x71c7('0xc'),_0x590ebf,'request\x20sent');_0x554fa2(_0x3f35f6[_0x71c7('0x15')]['message']);}})[_0x71c7('0x16')](function(_0x4d4784){logger[_0x71c7('0x11')](_0x71c7('0xc'),_0x590ebf,_0x4d4784);_0x112903(_0x4d4784);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index abfc302..0b17714 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 _0x8878=['Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addResources','put','update','delete','destroy','removeResources','exports','multer','connect-timeout'];(function(_0x46a381,_0xbbb87f){var _0x4d693b=function(_0x133486){while(--_0x133486){_0x46a381['push'](_0x46a381['shift']());}};_0x4d693b(++_0xbbb87f);}(_0x8878,0x8a));var _0x8887=function(_0xc5c9ac,_0x57c492){_0xc5c9ac=_0xc5c9ac-0x0;var _0x3f4606=_0x8878[_0xc5c9ac];return _0x3f4606;};'use strict';var multer=require(_0x8887('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8887('0x1'));var express=require('express');var router=express[_0x8887('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8887('0x3'));var interaction=require(_0x8887('0x4'));var config=require('../../config/environment');var controller=require(_0x8887('0x5'));router[_0x8887('0x6')]('/',auth[_0x8887('0x7')](),controller[_0x8887('0x8')]);router[_0x8887('0x6')](_0x8887('0x9'),auth['isAuthenticated'](),controller[_0x8887('0xa')]);router[_0x8887('0x6')](_0x8887('0xb'),auth['isAuthenticated'](),controller[_0x8887('0xc')]);router[_0x8887('0x6')](_0x8887('0xd'),auth['isAuthenticated'](),controller[_0x8887('0xe')]);router[_0x8887('0x6')](_0x8887('0xf'),auth[_0x8887('0x7')](),controller[_0x8887('0x10')]);router[_0x8887('0x11')]('/',auth['isAuthenticated'](),controller[_0x8887('0x12')]);router[_0x8887('0x11')](_0x8887('0x13'),auth[_0x8887('0x7')](),controller[_0x8887('0x14')]);router['post'](_0x8887('0xd'),auth[_0x8887('0x7')](),controller['addSections']);router[_0x8887('0x11')](_0x8887('0xf'),auth['isAuthenticated'](),controller[_0x8887('0x15')]);router[_0x8887('0x16')]('/:id',auth[_0x8887('0x7')](),controller[_0x8887('0x17')]);router[_0x8887('0x18')]('/:id',auth[_0x8887('0x7')](),controller[_0x8887('0x19')]);router[_0x8887('0x18')](_0x8887('0xd'),auth[_0x8887('0x7')](),controller['removeSections']);router[_0x8887('0x18')](_0x8887('0xf'),auth[_0x8887('0x7')](),controller[_0x8887('0x1a')]);module[_0x8887('0x1b')]=router; \ No newline at end of file +var _0xf4b2=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','put','delete','removeSections','exports','multer'];(function(_0x4fd8ea,_0x1df584){var _0x2cc935=function(_0x44eafc){while(--_0x44eafc){_0x4fd8ea['push'](_0x4fd8ea['shift']());}};_0x2cc935(++_0x1df584);}(_0xf4b2,0x67));var _0x2f4b=function(_0x33ca4e,_0x316ccb){_0x33ca4e=_0x33ca4e-0x0;var _0x289be6=_0xf4b2[_0x33ca4e];return _0x289be6;};'use strict';var multer=require(_0x2f4b('0x0'));var util=require('util');var path=require(_0x2f4b('0x1'));var timeout=require(_0x2f4b('0x2'));var express=require(_0x2f4b('0x3'));var router=express[_0x2f4b('0x4')]();var fs_extra=require(_0x2f4b('0x5'));var auth=require(_0x2f4b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2f4b('0x7'));var controller=require(_0x2f4b('0x8'));router[_0x2f4b('0x9')]('/',auth[_0x2f4b('0xa')](),controller['index']);router['get']('/describe',auth[_0x2f4b('0xa')](),controller[_0x2f4b('0xb')]);router['get'](_0x2f4b('0xc'),auth[_0x2f4b('0xa')](),controller[_0x2f4b('0xd')]);router[_0x2f4b('0x9')](_0x2f4b('0xe'),auth[_0x2f4b('0xa')](),controller[_0x2f4b('0xf')]);router[_0x2f4b('0x9')](_0x2f4b('0x10'),auth[_0x2f4b('0xa')](),controller[_0x2f4b('0x11')]);router[_0x2f4b('0x12')]('/',auth[_0x2f4b('0xa')](),controller[_0x2f4b('0x13')]);router[_0x2f4b('0x12')](_0x2f4b('0x14'),auth[_0x2f4b('0xa')](),controller[_0x2f4b('0x15')]);router[_0x2f4b('0x12')](_0x2f4b('0xe'),auth[_0x2f4b('0xa')](),controller['addSections']);router[_0x2f4b('0x12')](_0x2f4b('0x10'),auth[_0x2f4b('0xa')](),controller['addResources']);router[_0x2f4b('0x16')](_0x2f4b('0xc'),auth[_0x2f4b('0xa')](),controller['update']);router[_0x2f4b('0x17')](_0x2f4b('0xc'),auth[_0x2f4b('0xa')](),controller['destroy']);router['delete'](_0x2f4b('0xe'),auth[_0x2f4b('0xa')](),controller[_0x2f4b('0x18')]);router[_0x2f4b('0x17')](_0x2f4b('0x10'),auth[_0x2f4b('0xa')](),controller['removeResources']);module[_0x2f4b('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index bd50956..4a9470b 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 _0x8466=['exports','name','STRING','setDataValue','crudPermissions','join','split','BOOLEAN','sequelize'];(function(_0x278af8,_0x32561e){var _0x2f24d5=function(_0x586a59){while(--_0x586a59){_0x278af8['push'](_0x278af8['shift']());}};_0x2f24d5(++_0x32561e);}(_0x8466,0x15e));var _0x6846=function(_0x3398d8,_0x1853c7){_0x3398d8=_0x3398d8-0x0;var _0x553da0=_0x8466[_0x3398d8];return _0x553da0;};'use strict';var Sequelize=require(_0x6846('0x0'));module[_0x6846('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6846('0x2')},'crudPermissions':{'type':Sequelize[_0x6846('0x3')],'set':function(_0x245245){this[_0x6846('0x4')](_0x6846('0x5'),_0x245245?_0x245245[_0x6846('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x6846('0x5'))?this['getDataValue'](_0x6846('0x5'))[_0x6846('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x6846('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x6846('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x6846('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x6846('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x6846('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x6846('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6846('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x6846('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6846('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3a0e=['exports','name','STRING','setDataValue','crudPermissions','join','getDataValue','BOOLEAN','sequelize'];(function(_0x46a38b,_0x16ffb5){var _0x346e75=function(_0x34f8d0){while(--_0x34f8d0){_0x46a38b['push'](_0x46a38b['shift']());}};_0x346e75(++_0x16ffb5);}(_0x3a0e,0x6b));var _0xe3a0=function(_0x8b7fd,_0x19500b){_0x8b7fd=_0x8b7fd-0x0;var _0x78e20d=_0x3a0e[_0x8b7fd];return _0x78e20d;};'use strict';var Sequelize=require(_0xe3a0('0x0'));module[_0xe3a0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe3a0('0x2')},'crudPermissions':{'type':Sequelize[_0xe3a0('0x3')],'set':function(_0x4ca615){this[_0xe3a0('0x4')](_0xe3a0('0x5'),_0x4ca615?_0x4ca615[_0xe3a0('0x6')](''):[]);},'get':function(){return this[_0xe3a0('0x7')](_0xe3a0('0x5'))?this['getDataValue'](_0xe3a0('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xe3a0('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xe3a0('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xe3a0('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xe3a0('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xe3a0('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xe3a0('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe3a0('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xe3a0('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 9658da1..7a7f1cb 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 _0x0d0b=['findOne','Dashboard','forEach','Plugin','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./userProfile.socket','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','index','UserProfile','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','get','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','update','describe','addSections','sequelize','map','each','Resources','removeSections','enabled','isEmpty','includes','subsections','concat','push'];(function(_0x5dac0f,_0x432a75){var _0x2e34d5=function(_0x7b89ee){while(--_0x7b89ee){_0x5dac0f['push'](_0x5dac0f['shift']());}};_0x2e34d5(++_0x432a75);}(_0x0d0b,0x79));var _0xb0d0=function(_0x2db2c6,_0x8f8db4){_0x2db2c6=_0x2db2c6-0x0;var _0x4128af=_0x0d0b[_0x2db2c6];return _0x4128af;};'use strict';var emlformat=require(_0xb0d0('0x0'));var rimraf=require(_0xb0d0('0x1'));var zipdir=require(_0xb0d0('0x2'));var jsonpatch=require(_0xb0d0('0x3'));var rp=require(_0xb0d0('0x4'));var moment=require(_0xb0d0('0x5'));var BPromise=require(_0xb0d0('0x6'));var Mustache=require('mustache');var util=require(_0xb0d0('0x7'));var path=require(_0xb0d0('0x8'));var sox=require(_0xb0d0('0x9'));var csv=require(_0xb0d0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb0d0('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb0d0('0xa'));var querystring=require(_0xb0d0('0xc'));var Papa=require(_0xb0d0('0xd'));var Redis=require(_0xb0d0('0xe'));var authService=require(_0xb0d0('0xf'));var qs=require(_0xb0d0('0x10'));var as=require(_0xb0d0('0x11'));var hardwareService=require(_0xb0d0('0x12'));var logger=require(_0xb0d0('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb0d0('0x14'));var licenseUtil=require(_0xb0d0('0x15'));var db=require(_0xb0d0('0x16'))['db'];config[_0xb0d0('0x17')]=_[_0xb0d0('0x18')](config[_0xb0d0('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb0d0('0x17')]));require(_0xb0d0('0x19'))['register'](socket);function respondWithStatusCode(_0x3269f0,_0x37f792){_0x37f792=_0x37f792||0xcc;return function(_0xa60573){if(_0xa60573){return _0x3269f0['sendStatus'](_0x37f792);}return _0x3269f0['status'](_0x37f792)['end']();};}function respondWithResult(_0x8ebcae,_0x5bf489){_0x5bf489=_0x5bf489||0xc8;return function(_0x2faf4b){if(_0x2faf4b){return _0x8ebcae[_0xb0d0('0x1a')](_0x5bf489)[_0xb0d0('0x1b')](_0x2faf4b);}};}function respondWithFilteredResult(_0x5a0516,_0x518552){return function(_0x15a4ef){if(_0x15a4ef){var _0x4df5e1=typeof _0x518552['offset']===_0xb0d0('0x1c')&&typeof _0x518552[_0xb0d0('0x1d')]===_0xb0d0('0x1c');var _0x18e4ca=_0x15a4ef['count'];var _0x146db5=_0x4df5e1?0x0:_0x518552[_0xb0d0('0x1e')];var _0x50de03=_0x4df5e1?_0x15a4ef[_0xb0d0('0x1f')]:_0x518552['offset']+_0x518552[_0xb0d0('0x1d')];var _0x3a3a6e;if(_0x50de03>=_0x18e4ca){_0x50de03=_0x18e4ca;_0x3a3a6e=0xc8;}else{_0x3a3a6e=0xce;}_0x5a0516['status'](_0x3a3a6e);return _0x5a0516['set'](_0xb0d0('0x20'),_0x146db5+'-'+_0x50de03+'/'+_0x18e4ca)[_0xb0d0('0x1b')](_0x15a4ef);}return null;};}function patchUpdates(_0x24e55c){return function(_0x15073d){try{jsonpatch[_0xb0d0('0x21')](_0x15073d,_0x24e55c,!![]);}catch(_0x391d4b){return BPromise[_0xb0d0('0x22')](_0x391d4b);}return _0x15073d[_0xb0d0('0x23')]();};}function saveUpdates(_0xf74f58,_0x3f3d8e){return function(_0x150d31){if(_0x150d31){return _0x150d31['update'](_0xf74f58)[_0xb0d0('0x24')](function(_0x12208c){return _0x12208c;});}return null;};}function removeEntity(_0x2a2c71,_0x460dc5){return function(_0x410d6a){if(_0x410d6a){return _0x410d6a[_0xb0d0('0x25')]()[_0xb0d0('0x24')](function(){_0x2a2c71[_0xb0d0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dfea5,_0x52e698){return function(_0x14b4c0){if(!_0x14b4c0){_0x3dfea5[_0xb0d0('0x26')](0x194);}return _0x14b4c0;};}function handleError(_0x29556c,_0x36a3a5){_0x36a3a5=_0x36a3a5||0x1f4;return function(_0x485169){logger[_0xb0d0('0x27')](_0x485169['stack']);if(_0x485169['name']){delete _0x485169[_0xb0d0('0x28')];}_0x29556c[_0xb0d0('0x1a')](_0x36a3a5)['send'](_0x485169);};}exports[_0xb0d0('0x29')]=function(_0x53084b,_0x5d21cc){var _0x27a473={},_0x348076={},_0x5ccf23={'count':0x0,'rows':[]};var _0x4ac6b5=_['map'](db[_0xb0d0('0x2a')]['rawAttributes'],function(_0x1b05e8){return{'name':_0x1b05e8[_0xb0d0('0x2b')],'type':_0x1b05e8['type'][_0xb0d0('0x2c')]};});_0x348076[_0xb0d0('0x2d')]=_['map'](_0x4ac6b5,_0xb0d0('0x28'));_0x348076[_0xb0d0('0x2e')]=_[_0xb0d0('0x2f')](_0x53084b[_0xb0d0('0x2e')]);_0x348076[_0xb0d0('0x30')]=_[_0xb0d0('0x31')](_0x348076[_0xb0d0('0x2d')],_0x348076['query']);_0x27a473[_0xb0d0('0x32')]=_['intersection'](_0x348076['model'],qs['fields'](_0x53084b[_0xb0d0('0x2e')][_0xb0d0('0x33')]));_0x27a473[_0xb0d0('0x32')]=_0x27a473['attributes']['length']?_0x27a473[_0xb0d0('0x32')]:_0x348076[_0xb0d0('0x2d')];if(!_0x53084b[_0xb0d0('0x2e')][_0xb0d0('0x34')](_0xb0d0('0x35'))){_0x27a473['limit']=qs['limit'](_0x53084b[_0xb0d0('0x2e')][_0xb0d0('0x1d')]);_0x27a473['offset']=qs[_0xb0d0('0x1e')](_0x53084b[_0xb0d0('0x2e')][_0xb0d0('0x1e')]);}_0x27a473['order']=qs[_0xb0d0('0x36')](_0x53084b[_0xb0d0('0x2e')][_0xb0d0('0x36')]);_0x27a473[_0xb0d0('0x37')]=qs[_0xb0d0('0x30')](_[_0xb0d0('0x38')](_0x53084b[_0xb0d0('0x2e')],_0x348076['filters']),_0x4ac6b5);if(_0x53084b['query']['filter']){_0x27a473[_0xb0d0('0x37')]=_[_0xb0d0('0x39')](_0x27a473['where'],{'$or':_['map'](_0x4ac6b5,function(_0x3867eb){if(_0x3867eb[_0xb0d0('0x3a')]!==_0xb0d0('0x3b')){var _0x38eea7={};_0x38eea7[_0x3867eb[_0xb0d0('0x28')]]={'$like':'%'+_0x53084b[_0xb0d0('0x2e')][_0xb0d0('0x3c')]+'%'};return _0x38eea7;}})});}_0x27a473=_[_0xb0d0('0x39')]({},_0x27a473,_0x53084b[_0xb0d0('0x3d')]);var _0x4f6e68={'where':_0x27a473[_0xb0d0('0x37')]};return db[_0xb0d0('0x2a')][_0xb0d0('0x1f')](_0x4f6e68)[_0xb0d0('0x24')](function(_0x530ae6){_0x5ccf23[_0xb0d0('0x1f')]=_0x530ae6;if(_0x53084b['query'][_0xb0d0('0x3e')]){_0x27a473['include']=[{'all':!![]}];}return db[_0xb0d0('0x2a')][_0xb0d0('0x3f')](_0x27a473);})[_0xb0d0('0x24')](function(_0x18da34){_0x5ccf23[_0xb0d0('0x40')]=_0x18da34;return _0x5ccf23;})[_0xb0d0('0x24')](respondWithFilteredResult(_0x5d21cc,_0x27a473))[_0xb0d0('0x41')](handleError(_0x5d21cc,null));};exports[_0xb0d0('0x42')]=function(_0xa17055,_0x2764cb){var _0xcc287a={'raw':![],'where':{'id':_0xa17055[_0xb0d0('0x43')]['id']}},_0x208906={};_0x208906['model']=_[_0xb0d0('0x2f')](db[_0xb0d0('0x2a')][_0xb0d0('0x44')]);_0x208906[_0xb0d0('0x2e')]=_[_0xb0d0('0x2f')](_0xa17055[_0xb0d0('0x2e')]);_0x208906[_0xb0d0('0x30')]=_[_0xb0d0('0x31')](_0x208906[_0xb0d0('0x2d')],_0x208906[_0xb0d0('0x2e')]);_0xcc287a[_0xb0d0('0x32')]=_[_0xb0d0('0x31')](_0x208906[_0xb0d0('0x2d')],qs[_0xb0d0('0x33')](_0xa17055[_0xb0d0('0x2e')][_0xb0d0('0x33')]));_0xcc287a['attributes']=_0xcc287a['attributes'][_0xb0d0('0x45')]?_0xcc287a[_0xb0d0('0x32')]:_0x208906[_0xb0d0('0x2d')];if(_0xa17055[_0xb0d0('0x2e')]['includeAll']){_0xcc287a[_0xb0d0('0x46')]=[{'all':!![]}];}_0xcc287a=_[_0xb0d0('0x39')]({},_0xcc287a,_0xa17055[_0xb0d0('0x3d')]);return db[_0xb0d0('0x2a')][_0xb0d0('0x47')](_0xcc287a)['then'](handleEntityNotFound(_0x2764cb,null))[_0xb0d0('0x24')](respondWithResult(_0x2764cb,null))[_0xb0d0('0x41')](handleError(_0x2764cb,null));};exports[_0xb0d0('0x48')]=function(_0x14f59f,_0x4922df){return db['UserProfile'][_0xb0d0('0x48')](_0x14f59f[_0xb0d0('0x49')],{})[_0xb0d0('0x24')](respondWithResult(_0x4922df,0xc9))[_0xb0d0('0x41')](handleError(_0x4922df,null));};exports['clone']=function(_0x450106,_0x5c3905){var _0x3a72c7={'where':{'id':_0x450106[_0xb0d0('0x43')]['id']}},_0x2b1ba6={};_0x2b1ba6[_0xb0d0('0x2d')]=_[_0xb0d0('0x2f')](db[_0xb0d0('0x2a')][_0xb0d0('0x44')]);_0x3a72c7['attributes']=_['intersection'](_0x2b1ba6[_0xb0d0('0x2d')],qs[_0xb0d0('0x33')](_0x450106[_0xb0d0('0x2e')][_0xb0d0('0x33')]));_0x3a72c7['attributes']=_0x3a72c7[_0xb0d0('0x32')][_0xb0d0('0x45')]?_0x3a72c7[_0xb0d0('0x32')]:_0x2b1ba6[_0xb0d0('0x2d')];if(_0x450106[_0xb0d0('0x2e')]['includeAll']){_0x3a72c7['include']=[{'all':!![]}];}_0x3a72c7=_['merge']({},_0x3a72c7,_0x450106[_0xb0d0('0x3d')]);return db[_0xb0d0('0x2a')][_0xb0d0('0x47')](_0x3a72c7)[_0xb0d0('0x24')](handleEntityNotFound(_0x5c3905,null))[_0xb0d0('0x24')](function(_0x255fd5){if(_0x255fd5){var _0x16047e=_0x255fd5[_0xb0d0('0x4a')]({'plain':!![]});_0x16047e=qs[_0xb0d0('0x4b')](_0x16047e,['id','createdAt',_0xb0d0('0x4c'),_0xb0d0('0x4d')]);_0x450106[_0xb0d0('0x49')]=_[_0xb0d0('0x4b')](_0x450106['body'],['id',_0xb0d0('0x4e'),'updatedAt']);return db['sequelize'][_0xb0d0('0x4f')](function(_0x3ffd26){return db['UserProfile'][_0xb0d0('0x48')](_[_0xb0d0('0x39')](_0x16047e,_0x450106[_0xb0d0('0x49')]),{'include':_0x450106[_0xb0d0('0x2e')][_0xb0d0('0x3e')]?[{'all':!![]}]:undefined,'transaction':_0x3ffd26})[_0xb0d0('0x24')](function(_0x4aa09d){var _0x549276=_0x4aa09d['get']({'plain':!![]});return db[_0xb0d0('0x50')][_0xb0d0('0x3f')]({'where':{'userProfileId':_0x450106[_0xb0d0('0x43')]['id']},'raw':!![]})[_0xb0d0('0x24')](function(_0x5c5c23){if(_0x5c5c23){return BPromise['each'](_0x5c5c23,function(_0x21d7b7){return new BPromise(function(_0x2a3943,_0x37fa7f){if(_0x21d7b7['autoAssociation']===null||_0x21d7b7[_0xb0d0('0x51')]===0x1)_0x2a3943(null);return db[_0xb0d0('0x52')][_0xb0d0('0x3f')]({'where':{'sectionId':_0x21d7b7['id']},'raw':!![]})[_0xb0d0('0x24')](function(_0x11c2b5){var _0x4b4ca8=_['map'](_0x11c2b5,function(_0x1b72e5){return qs[_0xb0d0('0x4b')](_0x1b72e5,['id','createdAt',_0xb0d0('0x4c'),_0xb0d0('0x53')]);});_0x2a3943(_0x4b4ca8);})[_0xb0d0('0x41')](function(_0x3c3e9f){_0x37fa7f(_0x3c3e9f);});})[_0xb0d0('0x24')](function(_0x4a8b97){var _0x4410a9=qs[_0xb0d0('0x4b')](_0x21d7b7,['id',_0xb0d0('0x4e'),'updatedAt']);_0x4410a9[_0xb0d0('0x54')]=_0x549276['id'];if(_0x4a8b97)_0x4410a9['Resources']=_0x4a8b97;return _0x4410a9;})['then'](function(_0x269945){return db[_0xb0d0('0x50')][_0xb0d0('0x48')](_0x269945,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x3ffd26});});})[_0xb0d0('0x24')](function(){return _0x549276;});}});});});}})[_0xb0d0('0x24')](respondWithResult(_0x5c3905,0xc9))['catch'](handleError(_0x5c3905,null));};exports[_0xb0d0('0x55')]=function(_0x149940,_0x3be5bb){if(_0x149940['body']['id']){delete _0x149940[_0xb0d0('0x49')]['id'];}return db[_0xb0d0('0x2a')][_0xb0d0('0x47')]({'where':{'id':_0x149940[_0xb0d0('0x43')]['id']}})[_0xb0d0('0x24')](handleEntityNotFound(_0x3be5bb,null))['then'](saveUpdates(_0x149940[_0xb0d0('0x49')],null))[_0xb0d0('0x24')](respondWithResult(_0x3be5bb,null))[_0xb0d0('0x41')](handleError(_0x3be5bb,null));};exports['destroy']=function(_0x43f65f,_0x235900){return db[_0xb0d0('0x2a')][_0xb0d0('0x47')]({'where':{'id':_0x43f65f[_0xb0d0('0x43')]['id']}})[_0xb0d0('0x24')](handleEntityNotFound(_0x235900,null))[_0xb0d0('0x24')](removeEntity(_0x235900,null))[_0xb0d0('0x41')](handleError(_0x235900,null));};exports[_0xb0d0('0x56')]=function(_0xd371e1,_0x5037ec){return db[_0xb0d0('0x2a')]['describe']()[_0xb0d0('0x24')](respondWithResult(_0x5037ec,null))[_0xb0d0('0x41')](handleError(_0x5037ec,null));};exports[_0xb0d0('0x57')]=function(_0x15754c,_0xf4b45b){var _0x1c55c4=_0x15754c['body'];return db[_0xb0d0('0x2a')][_0xb0d0('0x47')]({'where':{'id':_0x15754c[_0xb0d0('0x43')]['id']}})[_0xb0d0('0x24')](handleEntityNotFound(_0xf4b45b,null))['then'](function(_0x36c641){if(_0x36c641){return db[_0xb0d0('0x58')]['transaction'](function(_0x5c2944){return db[_0xb0d0('0x50')][_0xb0d0('0x25')]({'where':{'userProfileId':_0x15754c['params']['id'],'sectionId':_['map'](_0x1c55c4,function(_0x513157){return _0x513157['sectionId'];})},'transaction':_0x5c2944})[_0xb0d0('0x24')](function(){var _0x5d9ae9=_[_0xb0d0('0x59')](_0x1c55c4,function(_0x382e82){_0x382e82[_0xb0d0('0x54')]=_0x15754c[_0xb0d0('0x43')]['id'];return _0x382e82;});var _0x25d65e=[];return BPromise[_0xb0d0('0x5a')](_0x5d9ae9,function(_0x5c71c7){return db['UserProfileSection'][_0xb0d0('0x48')](_0x5c71c7,{'include':[{'model':db[_0xb0d0('0x52')],'as':_0xb0d0('0x5b')}],'raw':!![],'transaction':_0x5c2944})['then'](function(_0x5c664c){_0x25d65e['push'](_0x5c664c[_0xb0d0('0x4a')]({'plain':!![]}));});})[_0xb0d0('0x24')](function(){return _0x25d65e;});});});}})['then'](function(_0x3c2aaa){return _0x3c2aaa;})[_0xb0d0('0x24')](respondWithResult(_0xf4b45b,null))[_0xb0d0('0x41')](handleError(_0xf4b45b,null));};exports[_0xb0d0('0x5c')]=function(_0x396427,_0x3eeec4){var _0x3fd52c;return db[_0xb0d0('0x2a')][_0xb0d0('0x47')]({'where':{'id':_0x396427[_0xb0d0('0x43')]['id']},'attributes':['id',_0xb0d0('0x28')]})['then'](handleEntityNotFound(_0x3eeec4,null))[_0xb0d0('0x24')](function(_0x563969){if(_0x563969){_0x3fd52c=_0x563969;return db[_0xb0d0('0x50')][_0xb0d0('0x25')]({'where':{'userProfileId':_0x396427['params']['id'],'sectionId':_0x396427[_0xb0d0('0x2e')]['ids']}});}})[_0xb0d0('0x24')](function(){return _0x3fd52c;})[_0xb0d0('0x24')](respondWithStatusCode(_0x3eeec4,null))[_0xb0d0('0x41')](handleError(_0x3eeec4,null));};exports['getSections']=function(_0x1d6939,_0x2a32f1){var _0x56ba79=[];var _0x322689=[];return db[_0xb0d0('0x50')]['findAll']({'where':{'userProfileId':_0x1d6939[_0xb0d0('0x43')]['id']},'raw':!![]})['then'](function(_0x2b843f){_0x56ba79=_[_0xb0d0('0x3c')](_0x2b843f,function(_0xca6b74){return _0xca6b74[_0xb0d0('0x5d')]===0x1||_['includes']([0x3eb,0x709],_0xca6b74[_0xb0d0('0x53')]);});if(!_[_0xb0d0('0x5e')](_0x56ba79)){return _[_0xb0d0('0x59')](_0x56ba79,function(_0xd0d3bc){return _0xd0d3bc['sectionId'];});}else{return;}})[_0xb0d0('0x24')](function(_0x5d88b7){if(_0x5d88b7)_0x322689=_0x5d88b7;if(_[_0xb0d0('0x5f')](_0x322689,0x64)){var _0x289aff=_['find'](_0x56ba79,{'sectionId':0x64});return hasDefaultDashboard(_0x289aff)[_0xb0d0('0x24')](function(_0x2e1795){return _['map'](_0x56ba79,function(_0x1fdd43){if(_0x1fdd43['sectionId']===0x64){_0x1fdd43[_0xb0d0('0x60')]=_0x2e1795;}return _0x1fdd43;});});}else{return;}})[_0xb0d0('0x24')](function(_0x30f8e5){if(_0x30f8e5)_0x56ba79=_0x30f8e5;if(_[_0xb0d0('0x5f')](_0x322689,0x3eb)){var _0x11e5af=_[_0xb0d0('0x47')](_0x56ba79,{'sectionId':0x3eb});return getCustomDashboards(_0x11e5af)[_0xb0d0('0x24')](function(_0x513bd7){return _[_0xb0d0('0x59')](_0x56ba79,function(_0x4f5c5f){if(_0x11e5af[_0xb0d0('0x5d')]){if(_0x4f5c5f[_0xb0d0('0x53')]===0x3eb){_0x4f5c5f[_0xb0d0('0x60')]=_0x513bd7;}}else{if(_0x4f5c5f['sectionId']===0x64){if(!_0x4f5c5f['subsections']){_0x4f5c5f[_0xb0d0('0x60')]=[];}_0x4f5c5f['subsections']=_0x4f5c5f[_0xb0d0('0x60')][_0xb0d0('0x61')](_0x513bd7);}}return _0x4f5c5f;});});}else{return;}})['then'](function(_0x275579){if(_0x275579)_0x56ba79=_0x275579;if(_['includes'](_0x322689,0x709)){var _0x6ad239=_['find'](_0x56ba79,{'sectionId':0x709});return getPlugins(_0x6ad239)[_0xb0d0('0x24')](function(_0xfa2c80){if(_0x6ad239[_0xb0d0('0x5d')]){return _['map'](_0x56ba79,function(_0x4cabb0){if(_0x4cabb0[_0xb0d0('0x53')]===0x709){_0x4cabb0[_0xb0d0('0x60')]=_0xfa2c80;}return _0x4cabb0;});}else{var _0x425ed7={'sectionId':0x76c,'enabled':0x1,'subsections':_0xfa2c80};var _0x51e413=_[_0xb0d0('0x59')](_0x56ba79);_0x51e413[_0xb0d0('0x62')](_0x425ed7);return _0x51e413;}});}else{return;}})[_0xb0d0('0x24')](function(_0x151d1a){if(_0x151d1a)_0x56ba79=_0x151d1a;return _[_0xb0d0('0x3c')](_0x56ba79,['enabled',0x1]);})[_0xb0d0('0x24')](respondWithResult(_0x2a32f1,null))[_0xb0d0('0x41')](handleError(_0x2a32f1,null));};function hasDefaultDashboard(_0x33e37c){var _0x4deecb=[0x65];return new BPromise(function(_0x355c03,_0x416a90){try{if(_0x33e37c['autoAssociation']){_0x355c03(_0x4deecb);}else{return db[_0xb0d0('0x52')][_0xb0d0('0x63')]({'where':{'sectionId':_0x33e37c['id']},'raw':!![]})[_0xb0d0('0x24')](function(_0x43d3a9){_0x43d3a9?_0x355c03(_0x4deecb):_0x355c03();});}}catch(_0x4bc5d9){_0x416a90(_0x4bc5d9);}});}function getCustomDashboards(_0x1fb6c5){var _0x4c948c=[];return new BPromise(function(_0x483277,_0x107dcf){try{if(_0x1fb6c5[_0xb0d0('0x51')]){return db[_0xb0d0('0x64')][_0xb0d0('0x3f')]({'raw':!![]})['then'](function(_0x483a23){_0x483a23[_0xb0d0('0x65')](function(_0x49f51e){_0x4c948c[_0xb0d0('0x62')](_0x49f51e['id']+0x1869f);});_0x483277(_0x4c948c);});}else{return db[_0xb0d0('0x52')]['findAll']({'where':{'sectionId':_0x1fb6c5['id']},'raw':!![]})['then'](function(_0x31be56){_0x31be56[_0xb0d0('0x65')](function(_0x3a4192){_0x4c948c['push'](_0x3a4192['resourceId']+0x1869f);});_0x483277(_0x4c948c);});}}catch(_0x5b0fd0){_0x107dcf(_0x5b0fd0);}});}function getPlugins(_0x2c9ffa){var _0x46f9c3=[];return new BPromise(function(_0x440bda,_0x1b3f72){try{if(_0x2c9ffa['autoAssociation']){return db[_0xb0d0('0x66')][_0xb0d0('0x3f')]({'raw':!![]})[_0xb0d0('0x24')](function(_0xdc2ed5){_0xdc2ed5['forEach'](function(_0x4f5cff){_0x46f9c3[_0xb0d0('0x62')](_0x4f5cff['id']+0x15b38);});_0x440bda(_0x46f9c3);});}else{return db[_0xb0d0('0x52')]['findAll']({'where':{'sectionId':_0x2c9ffa['id']},'raw':!![]})['then'](function(_0x11560a){_0x11560a['forEach'](function(_0x569e75){_0x46f9c3[_0xb0d0('0x62')](_0x569e75['resourceId']+0x15b38);});_0x440bda(_0x46f9c3);});}}catch(_0x1d56c0){_0x1b3f72(_0x1d56c0);}});}exports['addResources']=function(_0x140832,_0x117c24){return db[_0xb0d0('0x2a')][_0xb0d0('0x47')]({'where':{'id':_0x140832[_0xb0d0('0x43')]['id']}})[_0xb0d0('0x24')](handleEntityNotFound(_0x117c24,null))[_0xb0d0('0x24')](function(_0x571528){if(_0x571528){return db[_0xb0d0('0x58')][_0xb0d0('0x4f')](function(_0x28c904){return db[_0xb0d0('0x50')][_0xb0d0('0x3f')]({'where':{'userProfileId':_0x140832['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x411364){if(_0x411364){return db[_0xb0d0('0x50')]['destroy']({'where':{'userProfileId':_0x140832['params']['id'],'id':_[_0xb0d0('0x59')](_0x411364,function(_0x5146d5){return _0x5146d5['id'];})},'transaction':_0x28c904});}})[_0xb0d0('0x24')](function(_0x3736b0){var _0x38af76=_['map'](_0x140832[_0xb0d0('0x49')],function(_0x26ffb4){_0x26ffb4[_0xb0d0('0x54')]=_0x140832['params']['id'];return _0x26ffb4;});return db[_0xb0d0('0x50')]['bulkCreate'](_0x38af76,{'raw':!![],'transaction':_0x28c904});})[_0xb0d0('0x24')](function(_0x374304){var _0x11903d=_['filter'](_['map'](_0x374304,function(_0x5886f3){return _0x5886f3['get']({'plain':!![]});}),{'includeAll':![]});if(_0x11903d){return db[_0xb0d0('0x50')][_0xb0d0('0x3f')]({'where':{'userProfileId':_0x140832[_0xb0d0('0x43')]['id'],'sectionId':_['map'](_0x11903d,function(_0x3f1f3d){return _0x3f1f3d[_0xb0d0('0x53')];})},'attributes':['id',_0xb0d0('0x53')],'raw':!![]})[_0xb0d0('0x24')](function(_0x1f65c8){var _0xf730a8=_[_0xb0d0('0x59')](_0x140832[_0xb0d0('0x49')],function(_0x46b18b){_0x46b18b[_0xb0d0('0x54')]=_0x140832[_0xb0d0('0x43')]['id'];return _0x46b18b;});return db[_0xb0d0('0x52')][_0xb0d0('0x67')](_0xf730a8,{'raw':!![],'transaction':_0x28c904});});}})['catch'](handleError(_0x117c24,null));});}})['then'](function(_0x1e26d5){var _0x1f629a=_[_0xb0d0('0x59')](_0x1e26d5,function(_0x2aabe3){return _0x2aabe3[_0xb0d0('0x4a')]({'plain':!![]});});})[_0xb0d0('0x24')](respondWithResult(_0x117c24,null))[_0xb0d0('0x41')](handleError(_0x117c24,null));};exports[_0xb0d0('0x68')]=function(_0x294fc3,_0x3dbc45,_0x3c3e84){return db[_0xb0d0('0x2a')][_0xb0d0('0x47')]({'where':{'id':_0x294fc3[_0xb0d0('0x43')]['id']}})['then'](handleEntityNotFound(_0x3dbc45,null))[_0xb0d0('0x24')](function(_0x16c6ed){if(_0x16c6ed){return _0x16c6ed[_0xb0d0('0x68')](_0x294fc3[_0xb0d0('0x2e')][_0xb0d0('0x69')]);}})[_0xb0d0('0x24')](respondWithStatusCode(_0x3dbc45,null))[_0xb0d0('0x41')](handleError(_0x3dbc45,null));};exports[_0xb0d0('0x6a')]=function(_0x73449d,_0x4d1d13){var _0x25d45d={};if(!_0x73449d[_0xb0d0('0x2e')][_0xb0d0('0x6b')])throw new Error(_0xb0d0('0x6c'));if(!_0x73449d[_0xb0d0('0x2e')]['hasOwnProperty'](_0xb0d0('0x35'))){_0x25d45d[_0xb0d0('0x1d')]=qs[_0xb0d0('0x1d')](_0x73449d[_0xb0d0('0x2e')]['limit']);_0x25d45d[_0xb0d0('0x1e')]=qs[_0xb0d0('0x1e')](_0x73449d['query'][_0xb0d0('0x1e')]);}return db[_0xb0d0('0x2a')][_0xb0d0('0x47')]({'where':{'id':_0x73449d[_0xb0d0('0x43')]['id']}})[_0xb0d0('0x24')](function(_0x2f71e3){if(!_0x2f71e3)throw new Error(_0xb0d0('0x6d')+_0x73449d[_0xb0d0('0x43')]['id']);return db[_0xb0d0('0x2a')][_0xb0d0('0x6a')](_0x73449d);})[_0xb0d0('0x24')](respondWithFilteredResult(_0x4d1d13,_0x25d45d))[_0xb0d0('0x41')](handleError(_0x4d1d13,null));}; \ No newline at end of file +var _0xe86e=['subsections','concat','push','findOne','Dashboard','forEach','addResources','bulkCreate','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','catch','show','params','length','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','each','autoAssociation','UserProfileResource','findAll','sectionId','userProfileId','Resources','describe','UserProfileSection','ids','getSections','enabled','includes','isEmpty'];(function(_0x558a39,_0x2dd4e1){var _0x2280dc=function(_0x12097f){while(--_0x12097f){_0x558a39['push'](_0x558a39['shift']());}};_0x2280dc(++_0x2dd4e1);}(_0xe86e,0xe8));var _0xee86=function(_0x41669a,_0x56a70f){_0x41669a=_0x41669a-0x0;var _0x427693=_0xe86e[_0x41669a];return _0x427693;};'use strict';var emlformat=require(_0xee86('0x0'));var rimraf=require(_0xee86('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee86('0x2'));var rp=require('request-promise');var moment=require(_0xee86('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xee86('0x4'));var util=require('util');var path=require(_0xee86('0x5'));var sox=require('sox');var csv=require(_0xee86('0x6'));var ejs=require(_0xee86('0x7'));var fs=require('fs');var fs_extra=require(_0xee86('0x8'));var _=require(_0xee86('0x9'));var squel=require(_0xee86('0xa'));var crypto=require(_0xee86('0xb'));var jsforce=require(_0xee86('0xc'));var deskjs=require(_0xee86('0xd'));var toCsv=require(_0xee86('0x6'));var querystring=require(_0xee86('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xee86('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xee86('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee86('0x11'))(_0xee86('0x12'));var utils=require(_0xee86('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xee86('0x14'));var db=require(_0xee86('0x15'))['db'];config['redis']=_[_0xee86('0x16')](config[_0xee86('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xee86('0x18'))(new Redis(config[_0xee86('0x17')]));require('./userProfile.socket')[_0xee86('0x19')](socket);function respondWithStatusCode(_0x6f59e9,_0x49b9e6){_0x49b9e6=_0x49b9e6||0xcc;return function(_0x2ce536){if(_0x2ce536){return _0x6f59e9[_0xee86('0x1a')](_0x49b9e6);}return _0x6f59e9[_0xee86('0x1b')](_0x49b9e6)[_0xee86('0x1c')]();};}function respondWithResult(_0x428bb9,_0x163164){_0x163164=_0x163164||0xc8;return function(_0x31186a){if(_0x31186a){return _0x428bb9[_0xee86('0x1b')](_0x163164)['json'](_0x31186a);}};}function respondWithFilteredResult(_0x577c6e,_0x478fdd){return function(_0x240ce5){if(_0x240ce5){var _0x20561b=typeof _0x478fdd[_0xee86('0x1d')]===_0xee86('0x1e')&&typeof _0x478fdd['limit']===_0xee86('0x1e');var _0x3035c4=_0x240ce5['count'];var _0x449f2c=_0x20561b?0x0:_0x478fdd[_0xee86('0x1d')];var _0x376f52=_0x20561b?_0x240ce5[_0xee86('0x1f')]:_0x478fdd[_0xee86('0x1d')]+_0x478fdd[_0xee86('0x20')];var _0x1974e8;if(_0x376f52>=_0x3035c4){_0x376f52=_0x3035c4;_0x1974e8=0xc8;}else{_0x1974e8=0xce;}_0x577c6e[_0xee86('0x1b')](_0x1974e8);return _0x577c6e[_0xee86('0x21')](_0xee86('0x22'),_0x449f2c+'-'+_0x376f52+'/'+_0x3035c4)['json'](_0x240ce5);}return null;};}function patchUpdates(_0xa235f2){return function(_0x1c4340){try{jsonpatch[_0xee86('0x23')](_0x1c4340,_0xa235f2,!![]);}catch(_0x1e0af1){return BPromise[_0xee86('0x24')](_0x1e0af1);}return _0x1c4340[_0xee86('0x25')]();};}function saveUpdates(_0x576ec7,_0x371a7d){return function(_0x41958d){if(_0x41958d){return _0x41958d[_0xee86('0x26')](_0x576ec7)[_0xee86('0x27')](function(_0x1c711b){return _0x1c711b;});}return null;};}function removeEntity(_0x4dd9d1,_0x39e327){return function(_0x2a8304){if(_0x2a8304){return _0x2a8304[_0xee86('0x28')]()[_0xee86('0x27')](function(){_0x4dd9d1[_0xee86('0x1b')](0xcc)[_0xee86('0x1c')]();});}};}function handleEntityNotFound(_0x14bf86,_0x3b1889){return function(_0x26d2b2){if(!_0x26d2b2){_0x14bf86[_0xee86('0x1a')](0x194);}return _0x26d2b2;};}function handleError(_0x238e8d,_0x4a555c){_0x4a555c=_0x4a555c||0x1f4;return function(_0x10cc2d){logger['error'](_0x10cc2d[_0xee86('0x29')]);if(_0x10cc2d[_0xee86('0x2a')]){delete _0x10cc2d[_0xee86('0x2a')];}_0x238e8d[_0xee86('0x1b')](_0x4a555c)[_0xee86('0x2b')](_0x10cc2d);};}exports[_0xee86('0x2c')]=function(_0x31a8dc,_0x55cd20){var _0x3cb55d={},_0x12d6fe={},_0x3082c4={'count':0x0,'rows':[]};var _0x47a550=_[_0xee86('0x2d')](db[_0xee86('0x2e')][_0xee86('0x2f')],function(_0x3d7d3f){return{'name':_0x3d7d3f[_0xee86('0x30')],'type':_0x3d7d3f['type'][_0xee86('0x31')]};});_0x12d6fe[_0xee86('0x32')]=_[_0xee86('0x2d')](_0x47a550,_0xee86('0x2a'));_0x12d6fe['query']=_[_0xee86('0x33')](_0x31a8dc[_0xee86('0x34')]);_0x12d6fe[_0xee86('0x35')]=_[_0xee86('0x36')](_0x12d6fe[_0xee86('0x32')],_0x12d6fe[_0xee86('0x34')]);_0x3cb55d['attributes']=_[_0xee86('0x36')](_0x12d6fe['model'],qs[_0xee86('0x37')](_0x31a8dc['query'][_0xee86('0x37')]));_0x3cb55d[_0xee86('0x38')]=_0x3cb55d[_0xee86('0x38')]['length']?_0x3cb55d[_0xee86('0x38')]:_0x12d6fe[_0xee86('0x32')];if(!_0x31a8dc[_0xee86('0x34')][_0xee86('0x39')](_0xee86('0x3a'))){_0x3cb55d[_0xee86('0x20')]=qs['limit'](_0x31a8dc[_0xee86('0x34')]['limit']);_0x3cb55d[_0xee86('0x1d')]=qs[_0xee86('0x1d')](_0x31a8dc['query'][_0xee86('0x1d')]);}_0x3cb55d[_0xee86('0x3b')]=qs[_0xee86('0x3c')](_0x31a8dc['query'][_0xee86('0x3c')]);_0x3cb55d[_0xee86('0x3d')]=qs['filters'](_[_0xee86('0x3e')](_0x31a8dc['query'],_0x12d6fe[_0xee86('0x35')]),_0x47a550);if(_0x31a8dc[_0xee86('0x34')][_0xee86('0x3f')]){_0x3cb55d[_0xee86('0x3d')]=_[_0xee86('0x40')](_0x3cb55d[_0xee86('0x3d')],{'$or':_[_0xee86('0x2d')](_0x47a550,function(_0x3a91d0){if(_0x3a91d0[_0xee86('0x41')]!=='VIRTUAL'){var _0x40b25b={};_0x40b25b[_0x3a91d0[_0xee86('0x2a')]]={'$like':'%'+_0x31a8dc[_0xee86('0x34')][_0xee86('0x3f')]+'%'};return _0x40b25b;}})});}_0x3cb55d=_['merge']({},_0x3cb55d,_0x31a8dc[_0xee86('0x42')]);var _0x19691e={'where':_0x3cb55d[_0xee86('0x3d')]};return db[_0xee86('0x2e')][_0xee86('0x1f')](_0x19691e)['then'](function(_0x22db18){_0x3082c4[_0xee86('0x1f')]=_0x22db18;if(_0x31a8dc[_0xee86('0x34')][_0xee86('0x43')]){_0x3cb55d[_0xee86('0x44')]=[{'all':!![]}];}return db[_0xee86('0x2e')]['findAll'](_0x3cb55d);})[_0xee86('0x27')](function(_0x4de516){_0x3082c4['rows']=_0x4de516;return _0x3082c4;})['then'](respondWithFilteredResult(_0x55cd20,_0x3cb55d))[_0xee86('0x45')](handleError(_0x55cd20,null));};exports[_0xee86('0x46')]=function(_0x1365bf,_0x3c1d3c){var _0x1f427f={'raw':![],'where':{'id':_0x1365bf[_0xee86('0x47')]['id']}},_0x26bc9c={};_0x26bc9c[_0xee86('0x32')]=_[_0xee86('0x33')](db[_0xee86('0x2e')][_0xee86('0x2f')]);_0x26bc9c[_0xee86('0x34')]=_[_0xee86('0x33')](_0x1365bf[_0xee86('0x34')]);_0x26bc9c[_0xee86('0x35')]=_['intersection'](_0x26bc9c[_0xee86('0x32')],_0x26bc9c['query']);_0x1f427f[_0xee86('0x38')]=_[_0xee86('0x36')](_0x26bc9c[_0xee86('0x32')],qs['fields'](_0x1365bf[_0xee86('0x34')][_0xee86('0x37')]));_0x1f427f[_0xee86('0x38')]=_0x1f427f[_0xee86('0x38')][_0xee86('0x48')]?_0x1f427f[_0xee86('0x38')]:_0x26bc9c[_0xee86('0x32')];if(_0x1365bf['query'][_0xee86('0x43')]){_0x1f427f[_0xee86('0x44')]=[{'all':!![]}];}_0x1f427f=_[_0xee86('0x40')]({},_0x1f427f,_0x1365bf[_0xee86('0x42')]);return db['UserProfile'][_0xee86('0x49')](_0x1f427f)[_0xee86('0x27')](handleEntityNotFound(_0x3c1d3c,null))[_0xee86('0x27')](respondWithResult(_0x3c1d3c,null))['catch'](handleError(_0x3c1d3c,null));};exports[_0xee86('0x4a')]=function(_0x14f551,_0x4aee8d){return db[_0xee86('0x2e')]['create'](_0x14f551[_0xee86('0x4b')],{})[_0xee86('0x27')](respondWithResult(_0x4aee8d,0xc9))[_0xee86('0x45')](handleError(_0x4aee8d,null));};exports[_0xee86('0x4c')]=function(_0x57d0e3,_0xc5e826){var _0x873e25={'where':{'id':_0x57d0e3[_0xee86('0x47')]['id']}},_0xa6cd67={};_0xa6cd67[_0xee86('0x32')]=_['keys'](db[_0xee86('0x2e')][_0xee86('0x2f')]);_0x873e25[_0xee86('0x38')]=_[_0xee86('0x36')](_0xa6cd67[_0xee86('0x32')],qs[_0xee86('0x37')](_0x57d0e3[_0xee86('0x34')][_0xee86('0x37')]));_0x873e25[_0xee86('0x38')]=_0x873e25[_0xee86('0x38')]['length']?_0x873e25[_0xee86('0x38')]:_0xa6cd67[_0xee86('0x32')];if(_0x57d0e3[_0xee86('0x34')]['includeAll']){_0x873e25[_0xee86('0x44')]=[{'all':!![]}];}_0x873e25=_[_0xee86('0x40')]({},_0x873e25,_0x57d0e3[_0xee86('0x42')]);return db[_0xee86('0x2e')]['find'](_0x873e25)[_0xee86('0x27')](handleEntityNotFound(_0xc5e826,null))[_0xee86('0x27')](function(_0x35197a){if(_0x35197a){var _0x45adfa=_0x35197a[_0xee86('0x4d')]({'plain':!![]});_0x45adfa=qs[_0xee86('0x4e')](_0x45adfa,['id',_0xee86('0x4f'),_0xee86('0x50'),_0xee86('0x51')]);_0x57d0e3[_0xee86('0x4b')]=_[_0xee86('0x4e')](_0x57d0e3['body'],['id',_0xee86('0x4f'),_0xee86('0x50')]);return db[_0xee86('0x52')][_0xee86('0x53')](function(_0x3e3de2){return db[_0xee86('0x2e')][_0xee86('0x4a')](_[_0xee86('0x40')](_0x45adfa,_0x57d0e3[_0xee86('0x4b')]),{'include':_0x57d0e3['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x3e3de2})[_0xee86('0x27')](function(_0x1fd78c){var _0x4ce670=_0x1fd78c[_0xee86('0x4d')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x57d0e3[_0xee86('0x47')]['id']},'raw':!![]})['then'](function(_0x27223d){if(_0x27223d){return BPromise[_0xee86('0x54')](_0x27223d,function(_0x25b080){return new BPromise(function(_0x119f6b,_0x59ae44){if(_0x25b080['autoAssociation']===null||_0x25b080[_0xee86('0x55')]===0x1)_0x119f6b(null);return db[_0xee86('0x56')][_0xee86('0x57')]({'where':{'sectionId':_0x25b080['id']},'raw':!![]})[_0xee86('0x27')](function(_0x38532f){var _0x4a94bd=_['map'](_0x38532f,function(_0x4988f9){return qs[_0xee86('0x4e')](_0x4988f9,['id',_0xee86('0x4f'),_0xee86('0x50'),_0xee86('0x58')]);});_0x119f6b(_0x4a94bd);})['catch'](function(_0x3efdfa){_0x59ae44(_0x3efdfa);});})['then'](function(_0x534250){var _0x31a6aa=qs[_0xee86('0x4e')](_0x25b080,['id','createdAt',_0xee86('0x50')]);_0x31a6aa[_0xee86('0x59')]=_0x4ce670['id'];if(_0x534250)_0x31a6aa[_0xee86('0x5a')]=_0x534250;return _0x31a6aa;})[_0xee86('0x27')](function(_0x40e647){return db['UserProfileSection'][_0xee86('0x4a')](_0x40e647,{'include':[{'model':db[_0xee86('0x56')],'as':_0xee86('0x5a')}],'raw':!![],'transaction':_0x3e3de2});});})[_0xee86('0x27')](function(){return _0x4ce670;});}});});});}})[_0xee86('0x27')](respondWithResult(_0xc5e826,0xc9))[_0xee86('0x45')](handleError(_0xc5e826,null));};exports[_0xee86('0x26')]=function(_0x156932,_0x31097a){if(_0x156932[_0xee86('0x4b')]['id']){delete _0x156932[_0xee86('0x4b')]['id'];}return db[_0xee86('0x2e')][_0xee86('0x49')]({'where':{'id':_0x156932[_0xee86('0x47')]['id']}})[_0xee86('0x27')](handleEntityNotFound(_0x31097a,null))[_0xee86('0x27')](saveUpdates(_0x156932[_0xee86('0x4b')],null))['then'](respondWithResult(_0x31097a,null))[_0xee86('0x45')](handleError(_0x31097a,null));};exports[_0xee86('0x28')]=function(_0x545541,_0x2b73b4){return db[_0xee86('0x2e')][_0xee86('0x49')]({'where':{'id':_0x545541[_0xee86('0x47')]['id']}})[_0xee86('0x27')](handleEntityNotFound(_0x2b73b4,null))['then'](removeEntity(_0x2b73b4,null))[_0xee86('0x45')](handleError(_0x2b73b4,null));};exports[_0xee86('0x5b')]=function(_0x34b411,_0x28b9c3){return db['UserProfile'][_0xee86('0x5b')]()[_0xee86('0x27')](respondWithResult(_0x28b9c3,null))[_0xee86('0x45')](handleError(_0x28b9c3,null));};exports['addSections']=function(_0x4e21ba,_0x551624){var _0x56c736=_0x4e21ba[_0xee86('0x4b')];return db[_0xee86('0x2e')][_0xee86('0x49')]({'where':{'id':_0x4e21ba['params']['id']}})[_0xee86('0x27')](handleEntityNotFound(_0x551624,null))[_0xee86('0x27')](function(_0x506592){if(_0x506592){return db['sequelize'][_0xee86('0x53')](function(_0x4be50e){return db[_0xee86('0x5c')][_0xee86('0x28')]({'where':{'userProfileId':_0x4e21ba[_0xee86('0x47')]['id'],'sectionId':_[_0xee86('0x2d')](_0x56c736,function(_0x34b206){return _0x34b206[_0xee86('0x58')];})},'transaction':_0x4be50e})[_0xee86('0x27')](function(){var _0x1cab51=_[_0xee86('0x2d')](_0x56c736,function(_0x5ac058){_0x5ac058[_0xee86('0x59')]=_0x4e21ba[_0xee86('0x47')]['id'];return _0x5ac058;});var _0x57883e=[];return BPromise[_0xee86('0x54')](_0x1cab51,function(_0x352550){return db[_0xee86('0x5c')]['create'](_0x352550,{'include':[{'model':db[_0xee86('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x4be50e})[_0xee86('0x27')](function(_0x3f235e){_0x57883e['push'](_0x3f235e[_0xee86('0x4d')]({'plain':!![]}));});})['then'](function(){return _0x57883e;});});});}})[_0xee86('0x27')](function(_0x2b0fa6){return _0x2b0fa6;})[_0xee86('0x27')](respondWithResult(_0x551624,null))[_0xee86('0x45')](handleError(_0x551624,null));};exports['removeSections']=function(_0x4960e5,_0x4ebae4){var _0x76f541;return db['UserProfile'][_0xee86('0x49')]({'where':{'id':_0x4960e5[_0xee86('0x47')]['id']},'attributes':['id','name']})[_0xee86('0x27')](handleEntityNotFound(_0x4ebae4,null))['then'](function(_0x814947){if(_0x814947){_0x76f541=_0x814947;return db[_0xee86('0x5c')]['destroy']({'where':{'userProfileId':_0x4960e5[_0xee86('0x47')]['id'],'sectionId':_0x4960e5[_0xee86('0x34')][_0xee86('0x5d')]}});}})[_0xee86('0x27')](function(){return _0x76f541;})[_0xee86('0x27')](respondWithStatusCode(_0x4ebae4,null))[_0xee86('0x45')](handleError(_0x4ebae4,null));};exports[_0xee86('0x5e')]=function(_0x5e1254,_0x195bdd){var _0x33284b=[];var _0xe08894=[];return db[_0xee86('0x5c')][_0xee86('0x57')]({'where':{'userProfileId':_0x5e1254[_0xee86('0x47')]['id']},'raw':!![]})[_0xee86('0x27')](function(_0x28c4af){_0x33284b=_['filter'](_0x28c4af,function(_0x570cb8){return _0x570cb8[_0xee86('0x5f')]===0x1||_[_0xee86('0x60')]([0x3eb,0x709],_0x570cb8[_0xee86('0x58')]);});if(!_[_0xee86('0x61')](_0x33284b)){return _[_0xee86('0x2d')](_0x33284b,function(_0x1f459a){return _0x1f459a[_0xee86('0x58')];});}else{return;}})[_0xee86('0x27')](function(_0x2b4462){if(_0x2b4462)_0xe08894=_0x2b4462;if(_['includes'](_0xe08894,0x64)){var _0x10b091=_[_0xee86('0x49')](_0x33284b,{'sectionId':0x64});return hasDefaultDashboard(_0x10b091)[_0xee86('0x27')](function(_0x464633){return _[_0xee86('0x2d')](_0x33284b,function(_0x42f9f3){if(_0x42f9f3['sectionId']===0x64){_0x42f9f3[_0xee86('0x62')]=_0x464633;}return _0x42f9f3;});});}else{return;}})[_0xee86('0x27')](function(_0x32a7d1){if(_0x32a7d1)_0x33284b=_0x32a7d1;if(_[_0xee86('0x60')](_0xe08894,0x3eb)){var _0x487a9a=_[_0xee86('0x49')](_0x33284b,{'sectionId':0x3eb});return getCustomDashboards(_0x487a9a)['then'](function(_0x17b248){return _[_0xee86('0x2d')](_0x33284b,function(_0x15edc3){if(_0x487a9a[_0xee86('0x5f')]){if(_0x15edc3[_0xee86('0x58')]===0x3eb){_0x15edc3[_0xee86('0x62')]=_0x17b248;}}else{if(_0x15edc3['sectionId']===0x64){if(!_0x15edc3[_0xee86('0x62')]){_0x15edc3[_0xee86('0x62')]=[];}_0x15edc3[_0xee86('0x62')]=_0x15edc3[_0xee86('0x62')][_0xee86('0x63')](_0x17b248);}}return _0x15edc3;});});}else{return;}})['then'](function(_0x5370a4){if(_0x5370a4)_0x33284b=_0x5370a4;if(_['includes'](_0xe08894,0x709)){var _0x7baaae=_[_0xee86('0x49')](_0x33284b,{'sectionId':0x709});return getPlugins(_0x7baaae)['then'](function(_0x3df464){if(_0x7baaae[_0xee86('0x5f')]){return _[_0xee86('0x2d')](_0x33284b,function(_0x6a9eb7){if(_0x6a9eb7[_0xee86('0x58')]===0x709){_0x6a9eb7[_0xee86('0x62')]=_0x3df464;}return _0x6a9eb7;});}else{var _0x48f378={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3df464};var _0x5e9b32=_[_0xee86('0x2d')](_0x33284b);_0x5e9b32[_0xee86('0x64')](_0x48f378);return _0x5e9b32;}});}else{return;}})[_0xee86('0x27')](function(_0x2b16f8){if(_0x2b16f8)_0x33284b=_0x2b16f8;return _[_0xee86('0x3f')](_0x33284b,['enabled',0x1]);})[_0xee86('0x27')](respondWithResult(_0x195bdd,null))[_0xee86('0x45')](handleError(_0x195bdd,null));};function hasDefaultDashboard(_0x349558){var _0x18ef58=[0x65];return new BPromise(function(_0x48e9d9,_0x42d5c9){try{if(_0x349558[_0xee86('0x55')]){_0x48e9d9(_0x18ef58);}else{return db[_0xee86('0x56')][_0xee86('0x65')]({'where':{'sectionId':_0x349558['id']},'raw':!![]})[_0xee86('0x27')](function(_0x34be32){_0x34be32?_0x48e9d9(_0x18ef58):_0x48e9d9();});}}catch(_0xd84b0f){_0x42d5c9(_0xd84b0f);}});}function getCustomDashboards(_0x3c2773){var _0x287e64=[];return new BPromise(function(_0x332ec0,_0x58f902){try{if(_0x3c2773[_0xee86('0x55')]){return db[_0xee86('0x66')]['findAll']({'raw':!![]})[_0xee86('0x27')](function(_0x5fb348){_0x5fb348[_0xee86('0x67')](function(_0x3c8864){_0x287e64[_0xee86('0x64')](_0x3c8864['id']+0x1869f);});_0x332ec0(_0x287e64);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x3c2773['id']},'raw':!![]})['then'](function(_0x2068b5){_0x2068b5['forEach'](function(_0x8ff72f){_0x287e64['push'](_0x8ff72f['resourceId']+0x1869f);});_0x332ec0(_0x287e64);});}}catch(_0x313b07){_0x58f902(_0x313b07);}});}function getPlugins(_0x10b57a){var _0x152dda=[];return new BPromise(function(_0x3566e8,_0x3ca12a){try{if(_0x10b57a[_0xee86('0x55')]){return db['Plugin'][_0xee86('0x57')]({'raw':!![]})[_0xee86('0x27')](function(_0x3a081c){_0x3a081c['forEach'](function(_0x4ae413){_0x152dda[_0xee86('0x64')](_0x4ae413['id']+0x15b38);});_0x3566e8(_0x152dda);});}else{return db[_0xee86('0x56')][_0xee86('0x57')]({'where':{'sectionId':_0x10b57a['id']},'raw':!![]})['then'](function(_0x3c7450){_0x3c7450['forEach'](function(_0x38c5a7){_0x152dda[_0xee86('0x64')](_0x38c5a7['resourceId']+0x15b38);});_0x3566e8(_0x152dda);});}}catch(_0x43cf5f){_0x3ca12a(_0x43cf5f);}});}exports[_0xee86('0x68')]=function(_0x52a924,_0x44df6e){return db['UserProfile']['find']({'where':{'id':_0x52a924[_0xee86('0x47')]['id']}})[_0xee86('0x27')](handleEntityNotFound(_0x44df6e,null))[_0xee86('0x27')](function(_0x9091f6){if(_0x9091f6){return db['sequelize'][_0xee86('0x53')](function(_0x103ea5){return db[_0xee86('0x5c')][_0xee86('0x57')]({'where':{'userProfileId':_0x52a924[_0xee86('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0xee86('0x27')](function(_0x42703d){if(_0x42703d){return db[_0xee86('0x5c')]['destroy']({'where':{'userProfileId':_0x52a924['params']['id'],'id':_['map'](_0x42703d,function(_0x70bc4a){return _0x70bc4a['id'];})},'transaction':_0x103ea5});}})[_0xee86('0x27')](function(_0x26e699){var _0x2e79ba=_[_0xee86('0x2d')](_0x52a924[_0xee86('0x4b')],function(_0x272a96){_0x272a96[_0xee86('0x59')]=_0x52a924[_0xee86('0x47')]['id'];return _0x272a96;});return db[_0xee86('0x5c')][_0xee86('0x69')](_0x2e79ba,{'raw':!![],'transaction':_0x103ea5});})[_0xee86('0x27')](function(_0x2ad02e){var _0x399397=_['filter'](_[_0xee86('0x2d')](_0x2ad02e,function(_0x2774d3){return _0x2774d3[_0xee86('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x399397){return db[_0xee86('0x5c')][_0xee86('0x57')]({'where':{'userProfileId':_0x52a924[_0xee86('0x47')]['id'],'sectionId':_[_0xee86('0x2d')](_0x399397,function(_0x10b70c){return _0x10b70c['sectionId'];})},'attributes':['id',_0xee86('0x58')],'raw':!![]})['then'](function(_0x8d3579){var _0x201cf7=_[_0xee86('0x2d')](_0x52a924[_0xee86('0x4b')],function(_0xf45c9a){_0xf45c9a[_0xee86('0x59')]=_0x52a924['params']['id'];return _0xf45c9a;});return db[_0xee86('0x56')]['bulkCreate'](_0x201cf7,{'raw':!![],'transaction':_0x103ea5});});}})[_0xee86('0x45')](handleError(_0x44df6e,null));});}})['then'](function(_0x43893c){var _0x1c7686=_[_0xee86('0x2d')](_0x43893c,function(_0x1209fb){return _0x1209fb[_0xee86('0x4d')]({'plain':!![]});});})[_0xee86('0x27')](respondWithResult(_0x44df6e,null))[_0xee86('0x45')](handleError(_0x44df6e,null));};exports['removeResources']=function(_0x432912,_0x5a1d8b,_0x49c47a){return db[_0xee86('0x2e')][_0xee86('0x49')]({'where':{'id':_0x432912['params']['id']}})['then'](handleEntityNotFound(_0x5a1d8b,null))[_0xee86('0x27')](function(_0x153dea){if(_0x153dea){return _0x153dea['removeResources'](_0x432912[_0xee86('0x34')]['ids']);}})['then'](respondWithStatusCode(_0x5a1d8b,null))[_0xee86('0x45')](handleError(_0x5a1d8b,null));};exports[_0xee86('0x6a')]=function(_0x40d58a,_0xdfaae9){var _0xf4af08={};if(!_0x40d58a[_0xee86('0x34')][_0xee86('0x6b')])throw new Error(_0xee86('0x6c'));if(!_0x40d58a[_0xee86('0x34')][_0xee86('0x39')](_0xee86('0x3a'))){_0xf4af08[_0xee86('0x20')]=qs[_0xee86('0x20')](_0x40d58a[_0xee86('0x34')][_0xee86('0x20')]);_0xf4af08[_0xee86('0x1d')]=qs['offset'](_0x40d58a[_0xee86('0x34')][_0xee86('0x1d')]);}return db[_0xee86('0x2e')]['find']({'where':{'id':_0x40d58a['params']['id']}})['then'](function(_0x24fd71){if(!_0x24fd71)throw new Error(_0xee86('0x6d')+_0x40d58a['params']['id']);return db['UserProfile'][_0xee86('0x6a')](_0x40d58a);})[_0xee86('0x27')](respondWithFilteredResult(_0xdfaae9,_0xf4af08))['catch'](handleError(_0xdfaae9,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index c992e37..7d2145a 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 _0x8921=['exports','events','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2f9bea,_0x2b2699){var _0x2fbae2=function(_0x234321){while(--_0x234321){_0x2f9bea['push'](_0x2f9bea['shift']());}};_0x2fbae2(++_0x2b2699);}(_0x8921,0x9a));var _0x1892=function(_0xf2d23,_0x4ea66e){_0xf2d23=_0xf2d23-0x0;var _0x38ccb4=_0x8921[_0xf2d23];return _0x38ccb4;};'use strict';var EventEmitter=require(_0x1892('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x1892('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1892('0x2')](0x0);var events={'afterCreate':_0x1892('0x3'),'afterUpdate':_0x1892('0x4'),'afterDestroy':_0x1892('0x5')};function emitEvent(_0x110b75){return function(_0x28a89b,_0x15aa1b,_0x2790a1){UserProfileEvents[_0x1892('0x6')](_0x110b75+':'+_0x28a89b['id'],_0x28a89b);UserProfileEvents[_0x1892('0x6')](_0x110b75,_0x28a89b);_0x2790a1(null);};}for(var e in events){if(events[_0x1892('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x1892('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x71ab=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x193372,_0x10ecce){var _0x9c8117=function(_0x25d504){while(--_0x25d504){_0x193372['push'](_0x193372['shift']());}};_0x9c8117(++_0x10ecce);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xb71a('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb71a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb71a('0x2'),'afterDestroy':_0xb71a('0x3')};function emitEvent(_0x20fd9c){return function(_0x4094b2,_0x37ce74,_0x3c6438){UserProfileEvents[_0xb71a('0x4')](_0x20fd9c+':'+_0x4094b2['id'],_0x4094b2);UserProfileEvents[_0xb71a('0x4')](_0x20fd9c,_0x4094b2);_0x3c6438(null);};}for(var e in events){if(events[_0xb71a('0x5')](e)){var event=events[e];UserProfile[_0xb71a('0x6')](e,emitEvent(event));}}module[_0xb71a('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 08fa79b..4e3d32d 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 _0x24e5=['MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','pauses','Pause','sounds','Sound','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','user_profiles','../../components/parsers/qs','query','raw','mergeResources','isEmpty','length','UserProfileSection','params','ignore','union','find','push','autoAssociation','all','rawAttributes','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','pick','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','reportType','reportId','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','true','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','models','filter','field','then','map','value','model','findAll','associatedResources','resolve','AnalyticExtractedReport','resourceId','type','catch','toLowerCase','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','companies','globalcustomfields','CmCustomField','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','name','User','role','agent','membername','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses'];(function(_0x428310,_0x16977c){var _0x4eae4f=function(_0x444bb9){while(--_0x444bb9){_0x428310['push'](_0x428310['shift']());}};_0x4eae4f(++_0x16977c);}(_0x24e5,0x82));var _0x524e=function(_0x71653f,_0x31b316){_0x71653f=_0x71653f-0x0;var _0x3b83b1=_0x24e5[_0x71653f];return _0x3b83b1;};'use strict';var _=require(_0x524e('0x0'));var attributes=require(_0x524e('0x1'));var squel=require('squel');module['exports']=function(_0x4981d7){var _0x4ded0c=_0x4981d7[_0x524e('0x2')];function _0x3c38ee(_0xb75881,_0x3d3dee){return new Promise(function(_0x391834,_0x3651d6){if(!_0x3d3dee)return _0x391834(null);var _0x5510c7=_0x3d3dee[_0x524e('0x3')]?{[_0x3d3dee['filter'][_0x524e('0x4')]]:_0x3d3dee[_0x524e('0x3')]['value']}:undefined;return _0x4ded0c[_0xb75881]['findAll']({'where':_0x5510c7,'raw':!![]})[_0x524e('0x5')](function(_0x115f66){_0x3d3dee['associatedResources']=_[_0x524e('0x6')](_0x115f66,'id');_0x391834(_0x3d3dee);})['catch'](function(_0x109810){_0x3651d6(_0x109810);});});}function _0x305b13(_0x4063e4,_0x1ef84b){return new Promise(function(_0x2d48c9,_0x3336ad){var _0x356b2d=_0x4063e4[_0x524e('0x3')]?{[_0x4063e4[_0x524e('0x3')]['field']]:_0x4063e4['filter'][_0x524e('0x7')]}:undefined;return _0x4ded0c[_0x4063e4[_0x524e('0x8')]][_0x524e('0x9')]({'where':_0x356b2d,'raw':!![]})[_0x524e('0x5')](function(_0xd3ab97){_0x1ef84b[_0x524e('0xa')]=_[_0x524e('0x6')](_0xd3ab97,function(_0x4b335c){return _0x4b335c['name'];});_0x2d48c9(_0x1ef84b);})['catch'](function(_0xeba2a1){_0x3336ad(_0xeba2a1);});});}function _0x33af38(_0x262205,_0x47726b,_0x1a4808){if(!_0x47726b)return Promise[_0x524e('0xb')](null);return new Promise(function(_0x4c14e4,_0x4724e4){return _0x4ded0c['UserProfileResource'][_0x524e('0x9')]({'where':{'sectionId':_0x47726b['id']},'raw':!![]})[_0x524e('0x5')](function(_0x3a73d6){if(_0x262205['field']&&_0x262205['field']!=='id'){_0x47726b[_0x524e('0xa')]=_['map'](_0x3a73d6,function(_0x355830){return _0x355830[_0x262205[_0x524e('0x4')]];});}else{if(_0x1a4808===_0x524e('0xc')){_0x47726b[_0x524e('0xa')]=_[_0x524e('0x6')](_0x3a73d6,function(_0xceb265){return{'id':_0xceb265[_0x524e('0xd')],'type':_0xceb265[_0x524e('0xe')]};});}else{_0x47726b[_0x524e('0xa')]=_[_0x524e('0x6')](_0x3a73d6,function(_0x2c77c6){return _0x2c77c6[_0x524e('0xd')];});}}_0x4c14e4(_0x47726b);})[_0x524e('0xf')](function(_0x36f2d7){_0x4724e4(_0x36f2d7);});});}function _0x142ea1(_0x22e194,_0x4ddede){var _0x4e6491={'parentSections':[]};switch(_0x22e194[_0x524e('0x10')]()){case'squareprojects':_0x4e6491[_0x524e('0x11')]='SquareProject';break;case _0x524e('0x12'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x13');break;case _0x524e('0x14'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x15');_0x4e6491[_0x524e('0x16')]=[{'name':'SquareProjects','field':'name','foreignKey':_0x524e('0x17')}];break;case _0x524e('0x18'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x19');break;case _0x524e('0x1a'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x1b');_0x4e6491[_0x524e('0x16')]=[{'name':_0x524e('0x1c'),'field':'id','foreignKey':_0x524e('0x1d')}];break;case'lists':_0x4e6491['childModel']='CmList';break;case _0x524e('0x1e'):_0x4e6491[_0x524e('0x11')]='CmCompany';break;case _0x524e('0x1f'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x20');break;case'chatqueues':_0x4e6491[_0x524e('0x11')]='ChatQueue';break;case _0x524e('0x21'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x22');break;case _0x524e('0x23'):_0x4e6491['childModel']=_0x524e('0x24');break;case _0x524e('0x25'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x26');break;case'inboundroutes':case'internalroutes':case _0x524e('0x27'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x28');break;case _0x524e('0x29'):_0x4e6491[_0x524e('0x11')]='VoiceContext';break;case _0x524e('0x2a'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x2b');break;case _0x524e('0x2c'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x2d');_0x4e6491[_0x524e('0x16')]=[{'name':'Agents','field':_0x524e('0x2e'),'foreignKey':'membername','model':_0x524e('0x2f'),'filter':{'field':_0x524e('0x30'),'value':[_0x524e('0x31')]}},{'name':'Telephones','field':_0x524e('0x2e'),'foreignKey':_0x524e('0x32'),'model':'User','filter':{'field':_0x524e('0x30'),'value':[_0x524e('0x33')]}},{'name':_0x524e('0x34'),'field':_0x524e('0x2e'),'foreignKey':_0x524e('0x35'),'model':_0x524e('0x36'),'filter':{'field':'type','value':[_0x524e('0x37')]}},{'name':_0x524e('0x38'),'field':_0x524e('0x2e'),'foreignKey':_0x524e('0x35'),'model':_0x524e('0x36'),'filter':{'field':_0x524e('0xe'),'value':['outbound']}}];break;case'musiconholds':_0x4e6491[_0x524e('0x11')]=_0x524e('0x39');break;case _0x524e('0x3a'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x3b');break;case'voiceprefixes':_0x4e6491['childModel']=_0x524e('0x3c');break;case _0x524e('0x3d'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x3e');break;case _0x524e('0x3f'):_0x4e6491[_0x524e('0x11')]='MailQueue';break;case _0x524e('0x40'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x41');break;case _0x524e('0x42'):_0x4e6491['childModel']=_0x524e('0x43');break;case _0x524e('0x44'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x45');break;case _0x524e('0x46'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x47');break;case'smsqueues':_0x4e6491['childModel']=_0x524e('0x48');break;case'smsaccounts':_0x4e6491[_0x524e('0x11')]=_0x524e('0x49');break;case _0x524e('0x4a'):_0x4e6491['childModel']=_0x524e('0x4b');break;case _0x524e('0x4c'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x4d');break;case _0x524e('0x4e'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x4f');break;case _0x524e('0x50'):case _0x524e('0x51'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x36');if(_0x4ddede){_0x4e6491[_0x524e('0x16')]=[{'name':'VoiceQueues'},{'name':_0x524e('0x38')}];}break;case _0x524e('0x52'):case'agents':case _0x524e('0x53'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x2f');if(_0x4ddede){_0x4e6491['parentSections']=[{'name':_0x524e('0x54'),'filter':{'field':_0x524e('0x30'),'value':[_0x524e('0x55'),_0x524e('0x56')]},'ignore':!![]},{'name':'Agents'},{'name':_0x524e('0x57')}];}break;case _0x524e('0x58'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x59');break;case _0x524e('0x5a'):_0x4e6491['childModel']=_0x524e('0x5b');break;case _0x524e('0x5c'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x5d');break;case _0x524e('0x5e'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x5f');break;case'deskaccounts':_0x4e6491[_0x524e('0x11')]=_0x524e('0x60');break;case _0x524e('0x61'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x62');break;case'vtigeraccounts':_0x4e6491['childModel']='User';break;case _0x524e('0x63'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x64');break;case _0x524e('0x65'):_0x4e6491[_0x524e('0x11')]='Disposition';break;case _0x524e('0x66'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x67');break;case _0x524e('0x68'):_0x4e6491[_0x524e('0x11')]='Interval';break;case _0x524e('0x69'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x6a');break;case'scheduler':_0x4e6491[_0x524e('0x11')]='Schedule';break;case _0x524e('0x6b'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x6c');break;case'tags':_0x4e6491[_0x524e('0x11')]=_0x524e('0x6d');break;case _0x524e('0x6e'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x6f');break;case _0x524e('0x70'):_0x4e6491['childModel']=_0x524e('0x71');break;case _0x524e('0x72'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x73');break;case _0x524e('0x74'):_0x4e6491['childModel']=_0x524e('0x75');break;case _0x524e('0x76'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x77');break;case _0x524e('0x78'):_0x4e6491['childModel']=_0x524e('0xc');_0x4e6491['parentSections']=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x524e('0x79'):_0x4e6491[_0x524e('0x11')]=_0x524e('0x7a');break;}return _0x4e6491;}function _0xbd7f01(_0x54892e,_0x1d2c8d){var _0x183361=_0x54892e[_0x524e('0x7b')](0x0)[_0x524e('0x7c')]()+_0x54892e[_0x524e('0x7d')](0x1);var _0x5a24b2={'type':_0x4ded0c['Sequelize'][_0x524e('0x7e')][_0x524e('0x7f')],'raw':!![]};return new Promise(function(_0x5e8a55,_0xb10b87){var _0x14e64f=squel[_0x524e('0x80')]()[_0x524e('0x4')](_0x524e('0x81')+_0x183361+_0x524e('0x82'),'id')[_0x524e('0x4')](_0x524e('0x83'))[_0x524e('0x84')](_0x524e('0x85')+_0x54892e+_0x524e('0x86'),'ui')['where'](_0x524e('0x87'),_0x1d2c8d['id']);return _0x4ded0c[_0x524e('0x88')]['query'](_0x14e64f[_0x524e('0x89')](),_0x5a24b2)[_0x524e('0x5')](function(_0x215055){_0x1d2c8d[_0x183361+_0x524e('0x8a')]=_0x215055;_0x5e8a55(_0x215055);})[_0x524e('0xf')](function(_0x349b25){_0xb10b87(_0x349b25);});});}return _0x4981d7[_0x524e('0x8b')]('UserProfile',attributes,{'tableName':_0x524e('0x8c'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3a6db5){var _0x462de0=require(_0x524e('0x8d'));var _0x2ee362={'raw':_0x3a6db5[_0x524e('0x8e')][_0x524e('0x8f')],'where':{}};var _0x3b418c={};var _0x3ab882={'count':0x0,'rows':[]};var _0x2ed160=_0x3a6db5[_0x524e('0x8e')]['section'];var _0x1a9b0d=_0x3a6db5[_0x524e('0x8e')][_0x524e('0x90')]||![];var _0x3fc199=_0x142ea1(_0x2ed160,_0x1a9b0d);if(!_0x3fc199[_0x524e('0x11')])throw new Error('Invalid\x20section\x20\x27'+_0x2ed160+'\x27');var _0x2de45a=[{'name':_0x2ed160}];if(!_[_0x524e('0x91')](_0x3fc199[_0x524e('0x16')]))_0x2de45a=_0x3fc199[_0x524e('0x16')];var _0x5438c7=[];for(var _0x2f08a2=0x0;_0x2f08a2<_0x2de45a[_0x524e('0x92')];_0x2f08a2++){_0x5438c7['push'](_0x4ded0c[_0x524e('0x93')]['find']({'where':{'userProfileId':_0x3a6db5[_0x524e('0x94')]['id'],'name':_0x2de45a[_0x2f08a2]['name']},'raw':!![]}));}return Promise['all'](_0x5438c7)['then'](function(_0x43053c){var _0x6389f=_[_0x524e('0x3')](_0x43053c,function(_0x4028d5){return _0x4028d5?_0x4028d5:undefined;});var _0x25b813=_[_0x524e('0x3')](_0x2de45a,[_0x524e('0x95'),!![]]);var _0x45c108=_[_0x524e('0x91')](_0x6389f)&&_[_0x524e('0x91')](_0x25b813)?null:_[_0x524e('0x96')](_0x25b813,_0x6389f);if(!_0x45c108)return null;var _0x5c0d18=[];for(var _0xd843fc=0x0;_0xd843fc<_0x45c108[_0x524e('0x92')];_0xd843fc++){var _0x4071c7=_[_0x524e('0x97')](_0x2de45a,function(_0x5edf57){return _0x45c108[_0xd843fc]?_0x5edf57[_0x524e('0x2e')]===_0x45c108[_0xd843fc][_0x524e('0x2e')]:null;});if(_0x4071c7){if(_0x45c108[_0xd843fc][_0x524e('0x95')]){_0x5c0d18[_0x524e('0x98')](_0x3c38ee(_0x3fc199[_0x524e('0x11')],_0x45c108[_0xd843fc]));}else{if(!_0x45c108[_0xd843fc][_0x524e('0x99')]){_0x5c0d18[_0x524e('0x98')](_0x33af38(_0x4071c7,_0x45c108[_0xd843fc],_0x3fc199[_0x524e('0x11')]));}else{if(_0x4071c7[_0x524e('0x8')]){_0x5c0d18[_0x524e('0x98')](_0x305b13(_0x4071c7,_0x45c108[_0xd843fc]));}}}}}return Promise[_0x524e('0x9a')](_0x5c0d18);})[_0x524e('0x5')](function(_0x5a65e7){var _0x3abf92=_0x5a65e7;var _0x2512ea=null;if(_0x3abf92){_0x2512ea=_0x3abf92['length']===0x1?_0x3abf92[0x0]:null;}if(!_0x2512ea&&!_0x3abf92)return _0x3ab882;var _0x52cf7a=_0x4ded0c[_0x3fc199[_0x524e('0x11')]][_0x524e('0x9b')];_0x3b418c[_0x524e('0x8')]=_[_0x524e('0x9c')](_0x52cf7a);_0x3b418c[_0x524e('0x8e')]=_[_0x524e('0x9c')](_0x3a6db5[_0x524e('0x8e')]);_0x3b418c['filters']=_['intersection'](_0x3b418c[_0x524e('0x8')],_0x3b418c[_0x524e('0x8e')]);_0x2ee362[_0x524e('0x9d')]=_[_0x524e('0x9e')](_0x3b418c['model'],_0x462de0[_0x524e('0x9f')](_0x3a6db5[_0x524e('0x8e')][_0x524e('0x9f')]));_0x2ee362['attributes']=_0x2ee362[_0x524e('0x9d')]['length']?_0x2ee362[_0x524e('0x9d')]:_0x3b418c[_0x524e('0x8')];if(!_0x3a6db5['query'][_0x524e('0xa0')](_0x524e('0xa1'))){_0x2ee362[_0x524e('0xa2')]=_0x462de0[_0x524e('0xa2')](_0x3a6db5['query']['limit']);_0x2ee362[_0x524e('0xa3')]=_0x462de0['offset'](_0x3a6db5[_0x524e('0x8e')][_0x524e('0xa3')]);}_0x2ee362[_0x524e('0xa4')]=_0x462de0[_0x524e('0xa5')](_0x3a6db5[_0x524e('0x8e')][_0x524e('0xa5')]);_0x2ee362[_0x524e('0xa6')]=_0x462de0[_0x524e('0xa7')](_[_0x524e('0xa8')](_0x3a6db5['query'],_0x3b418c['filters']));if(_0x3a6db5[_0x524e('0x8e')][_0x524e('0x3')]){_0x2ee362[_0x524e('0xa6')]=_['merge'](_0x2ee362[_0x524e('0xa6')],{'$or':_[_0x524e('0x6')](_0x52cf7a,function(_0x3a294d){if(_0x3a294d[_0x524e('0xe')][_0x524e('0xa9')]!==_0x524e('0xaa')){var _0x4e65c0={};_0x4e65c0[_0x3a294d[_0x524e('0x4')]]={'$like':'%'+_0x3a6db5[_0x524e('0x8e')][_0x524e('0x3')]+'%'};return _0x4e65c0;}})});}var _0x436c75=[];var _0x400969=null;var _0x248deb={};if(_0x2512ea){_0x400969=_[_0x524e('0x97')](_0x2de45a,[_0x524e('0x2e'),_0x2512ea['name']]);if(_0x400969[_0x524e('0x4')]){_0x248deb={};if(_0x3fc199['childModel']===_0x524e('0xc')){_0x248deb[_0x400969[_0x524e('0xab')]]=_[_0x524e('0x6')](_0x2512ea[_0x524e('0xa')],'id');}else{_0x248deb[_0x400969[_0x524e('0xab')]]=_0x2512ea['associatedResources'];}_0x436c75[_0x524e('0x98')](_0x248deb);}else{_0x2ee362['where']['id']=_0x2512ea['associatedResources'];}}else{for(var _0x335ec1=0x0;_0x335ec1<_0x3abf92[_0x524e('0x92')];_0x335ec1++){_0x400969=_[_0x524e('0x97')](_0x2de45a,[_0x524e('0x2e'),_0x3abf92[_0x335ec1][_0x524e('0x2e')]]);if(_0x400969[_0x524e('0x4')]){_0x248deb={};_0x248deb[_0x400969[_0x524e('0xab')]]=_0x3abf92[_0x335ec1][_0x524e('0xa')];_0x436c75[_0x524e('0x98')](_0x248deb);}else{if(!_0x2ee362[_0x524e('0xa6')]['id'])_0x2ee362['where']['id']=[];_0x3abf92[_0x335ec1][_0x524e('0xa')][_0x524e('0xac')](function(_0x406f29){_0x2ee362[_0x524e('0xa6')]['id'][_0x524e('0x98')](_0x406f29);});}}}if(!_[_0x524e('0x91')](_0x436c75)){_0x2ee362[_0x524e('0xa6')]=_['merge'](_0x2ee362[_0x524e('0xa6')],{'$and':{'$or':_0x436c75}});}_0x2ee362=_[_0x524e('0xad')]({},_0x2ee362,_0x3a6db5[_0x524e('0xae')]);if(_0x2512ea&&!_0x2512ea['autoAssociation']&&_0x3fc199['childModel']==='AnalyticExtractedReport'){if(_0x3a6db5[_0x524e('0x8e')][_0x524e('0xaf')]){_0x2ee362['include']=[{'all':!![]}];}return _0x4ded0c[_0x3fc199['childModel']][_0x524e('0x9')](_0x2ee362)[_0x524e('0x5')](function(_0x50be2c){var _0x301681=[];_0x50be2c['forEach'](function(_0x338635){var _0x5aed52;switch(_0x338635[_0x524e('0xb0')]){case'default':_0x5aed52=_[_0x524e('0x97')](_0x2512ea[_0x524e('0xa')],function(_0x572138){return _0x572138['id']===_0x338635[_0x524e('0xb1')]&&_0x572138[_0x524e('0xe')]===_0x524e('0xb2');});break;case _0x524e('0xb3'):_0x5aed52=_[_0x524e('0x97')](_0x2512ea[_0x524e('0xa')],function(_0x5bdd47){return _0x5bdd47['id']===_0x338635[_0x524e('0xb1')]&&_0x5bdd47['type']===_0x524e('0xb4');});break;}if(_0x5aed52)_0x301681[_0x524e('0x98')](_0x338635);});_0x3ab882[_0x524e('0xb5')]=_0x301681['length'];_0x3ab882[_0x524e('0xb6')]=_0x301681;return _0x3ab882;});}else{if(!_[_0x524e('0x91')](_0x3a6db5[_0x524e('0x8e')][_0x524e('0xb7')])){_0x2ee362[_0x524e('0xa6')]['id']=_0x2ee362['where']['id']?_[_0x524e('0x9e')](_0x2ee362[_0x524e('0xa6')]['id'],_0x3a6db5[_0x524e('0x8e')][_0x524e('0xb7')]):_0x3a6db5[_0x524e('0x8e')][_0x524e('0xb7')];if(_0x3a6db5['query'][_0x524e('0xb8')]){_0x2ee362[_0x524e('0xa4')]=_0x3a6db5['query']['customSorting'];}}if(_0x3a6db5['query']['extraQueryConditions']){_0x2ee362[_0x524e('0xa6')]=_[_0x524e('0xad')](_0x2ee362[_0x524e('0xa6')],{'$and':_0x3a6db5[_0x524e('0x8e')][_0x524e('0xb9')]});}return _0x4ded0c[_0x3fc199[_0x524e('0x11')]][_0x524e('0xb5')]({'where':_0x2ee362[_0x524e('0xa6')]})[_0x524e('0x5')](function(_0x1ee728){_0x3ab882[_0x524e('0xb5')]=_0x1ee728;if(_0x3a6db5[_0x524e('0x8e')][_0x524e('0xaf')]){if(_0x3fc199['childModel']===_0x524e('0x1b')){_0x2ee362['include']=[{'model':_0x4ded0c[_0x524e('0x6d')],'as':_0x524e('0xba'),'attributes':['id','name',_0x524e('0xbb')],'required':_0x3a6db5[_0x524e('0x8e')][_0x524e('0xbc')]?!![]:![]},{'model':_0x4ded0c[_0x524e('0x6d')],'as':_0x524e('0xbd'),'attributes':['id',_0x524e('0x2e'),_0x524e('0xbb')],'through':_0x3a6db5[_0x524e('0x8e')][_0x524e('0xbc')]?{'attributes':[],'where':{'TagId':_0x3a6db5['query'][_0x524e('0xbc')]||undefined}}:{},'required':_0x3a6db5[_0x524e('0x8e')][_0x524e('0xbc')]?!![]:![]}];}else{_0x2ee362['include']=[{'all':!![]}];}}return _0x4ded0c[_0x3fc199[_0x524e('0x11')]][_0x524e('0x9')](_0x2ee362);})[_0x524e('0x5')](function(_0x198cc6){_0x3ab882[_0x524e('0xb6')]=_0x198cc6;if(_0x2ed160==='Agents'&&_0x3a6db5[_0x524e('0x8e')][_0x524e('0xbe')]===_0x524e('0xbf')){var _0x1296ed=[];for(var _0x7e610c=0x0;_0x7e610c<_0x3ab882[_0x524e('0xb6')][_0x524e('0x92')];_0x7e610c++){_0x1296ed[_0x524e('0x98')](_0xbd7f01('chat',_0x3ab882[_0x524e('0xb6')][_0x7e610c][_0x524e('0xc0')]));_0x1296ed[_0x524e('0x98')](_0xbd7f01(_0x524e('0xc1'),_0x3ab882[_0x524e('0xb6')][_0x7e610c][_0x524e('0xc0')]));_0x1296ed['push'](_0xbd7f01(_0x524e('0xc2'),_0x3ab882[_0x524e('0xb6')][_0x7e610c][_0x524e('0xc0')]));_0x1296ed[_0x524e('0x98')](_0xbd7f01(_0x524e('0xc3'),_0x3ab882['rows'][_0x7e610c]['dataValues']));_0x1296ed[_0x524e('0x98')](_0xbd7f01('openchannel',_0x3ab882[_0x524e('0xb6')][_0x7e610c]['dataValues']));_0x1296ed[_0x524e('0x98')](_0xbd7f01(_0x524e('0xc4'),_0x3ab882[_0x524e('0xb6')][_0x7e610c]['dataValues']));}return Promise['all'](_0x1296ed)[_0x524e('0x5')](function(){return _0x3ab882;});}return _0x3ab882;});}});}}});}; \ No newline at end of file +var _0x87f8=['SquareOdbc','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','parentSections','membername','User','role','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsaccounts','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','CannedAnswer','Disposition','customdashboards','Dashboard','pauses','Pause','Schedule','sounds','Sound','tags','Tag','Template','Trigger','trunks','Trunk','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','slice','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','toString','define','user_profiles','../../components/parsers/qs','query','raw','section','mergeResources','Invalid\x20section\x20\x27','push','UserProfileSection','find','params','all','ignore','isEmpty','union','length','autoAssociation','model','keys','intersection','attributes','fields','nolimit','limit','offset','order','sort','filters','pick','merge','where','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','chat','sms','fax','dataValues','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','filter','findAll','then','map','catch','field','value','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','odbc','childModel'];(function(_0x460d0d,_0x194ec4){var _0xac83b4=function(_0x4f8478){while(--_0x4f8478){_0x460d0d['push'](_0x460d0d['shift']());}};_0xac83b4(++_0x194ec4);}(_0x87f8,0x165));var _0x887f=function(_0x4092a8,_0xa16a23){_0x4092a8=_0x4092a8-0x0;var _0x5f22ab=_0x87f8[_0x4092a8];return _0x5f22ab;};'use strict';var _=require(_0x887f('0x0'));var attributes=require(_0x887f('0x1'));var squel=require(_0x887f('0x2'));module[_0x887f('0x3')]=function(_0x79d16c){var _0xb89f50=_0x79d16c['models'];function _0x58ad39(_0x491a44,_0x58590d){return new Promise(function(_0x3d35a8,_0x4e15af){if(!_0x58590d)return _0x3d35a8(null);var _0x438d0c=_0x58590d[_0x887f('0x4')]?{[_0x58590d[_0x887f('0x4')]['field']]:_0x58590d[_0x887f('0x4')]['value']}:undefined;return _0xb89f50[_0x491a44][_0x887f('0x5')]({'where':_0x438d0c,'raw':!![]})[_0x887f('0x6')](function(_0x5d54fe){_0x58590d['associatedResources']=_[_0x887f('0x7')](_0x5d54fe,'id');_0x3d35a8(_0x58590d);})[_0x887f('0x8')](function(_0x3a0a3c){_0x4e15af(_0x3a0a3c);});});}function _0x51a07d(_0x33346d,_0x397903){return new Promise(function(_0x5679c4,_0x4af724){var _0x4fc107=_0x33346d['filter']?{[_0x33346d[_0x887f('0x4')][_0x887f('0x9')]]:_0x33346d[_0x887f('0x4')][_0x887f('0xa')]}:undefined;return _0xb89f50[_0x33346d['model']][_0x887f('0x5')]({'where':_0x4fc107,'raw':!![]})[_0x887f('0x6')](function(_0x45f238){_0x397903[_0x887f('0xb')]=_[_0x887f('0x7')](_0x45f238,function(_0xe8c6f9){return _0xe8c6f9[_0x887f('0xc')];});_0x5679c4(_0x397903);})[_0x887f('0x8')](function(_0x350cda){_0x4af724(_0x350cda);});});}function _0x240a29(_0x54e865,_0x26378a,_0x206bcf){if(!_0x26378a)return Promise[_0x887f('0xd')](null);return new Promise(function(_0x44ba36,_0x2ae2d1){return _0xb89f50[_0x887f('0xe')][_0x887f('0x5')]({'where':{'sectionId':_0x26378a['id']},'raw':!![]})['then'](function(_0x231c76){if(_0x54e865['field']&&_0x54e865[_0x887f('0x9')]!=='id'){_0x26378a['associatedResources']=_[_0x887f('0x7')](_0x231c76,function(_0x9261e2){return _0x9261e2[_0x54e865[_0x887f('0x9')]];});}else{if(_0x206bcf===_0x887f('0xf')){_0x26378a['associatedResources']=_['map'](_0x231c76,function(_0x847df9){return{'id':_0x847df9[_0x887f('0x10')],'type':_0x847df9[_0x887f('0x11')]};});}else{_0x26378a[_0x887f('0xb')]=_[_0x887f('0x7')](_0x231c76,function(_0x19f2dc){return _0x19f2dc[_0x887f('0x10')];});}}_0x44ba36(_0x26378a);})[_0x887f('0x8')](function(_0x2b545b){_0x2ae2d1(_0x2b545b);});});}function _0x277c72(_0x3e54bd,_0x8b7a83){var _0x255477={'parentSections':[]};switch(_0x3e54bd[_0x887f('0x12')]()){case'squareprojects':_0x255477['childModel']='SquareProject';break;case _0x887f('0x13'):_0x255477[_0x887f('0x14')]=_0x887f('0x15');break;case'squarerecordings':_0x255477[_0x887f('0x14')]='SquareRecording';_0x255477['parentSections']=[{'name':_0x887f('0x16'),'field':_0x887f('0xc'),'foreignKey':_0x887f('0x17')}];break;case _0x887f('0x18'):_0x255477[_0x887f('0x14')]=_0x887f('0x19');break;case _0x887f('0x1a'):_0x255477[_0x887f('0x14')]='CmContact';_0x255477['parentSections']=[{'name':_0x887f('0x1b'),'field':'id','foreignKey':'ListId'}];break;case _0x887f('0x1c'):_0x255477['childModel']=_0x887f('0x1d');break;case _0x887f('0x1e'):_0x255477[_0x887f('0x14')]=_0x887f('0x1f');break;case _0x887f('0x20'):_0x255477['childModel']=_0x887f('0x21');break;case _0x887f('0x22'):_0x255477[_0x887f('0x14')]=_0x887f('0x23');break;case'chatwebsites':_0x255477[_0x887f('0x14')]='ChatWebsite';break;case'faxqueues':_0x255477[_0x887f('0x14')]=_0x887f('0x24');break;case _0x887f('0x25'):_0x255477[_0x887f('0x14')]=_0x887f('0x26');break;case _0x887f('0x27'):case'internalroutes':case _0x887f('0x28'):_0x255477[_0x887f('0x14')]=_0x887f('0x29');break;case _0x887f('0x2a'):_0x255477[_0x887f('0x14')]=_0x887f('0x2b');break;case _0x887f('0x2c'):_0x255477[_0x887f('0x14')]='VoiceMail';break;case _0x887f('0x2d'):_0x255477[_0x887f('0x14')]=_0x887f('0x2e');_0x255477[_0x887f('0x2f')]=[{'name':'Agents','field':_0x887f('0xc'),'foreignKey':_0x887f('0x30'),'model':_0x887f('0x31'),'filter':{'field':_0x887f('0x32'),'value':['agent']}},{'name':'Telephones','field':_0x887f('0xc'),'foreignKey':_0x887f('0x30'),'model':_0x887f('0x31'),'filter':{'field':_0x887f('0x32'),'value':[_0x887f('0x33')]}},{'name':_0x887f('0x34'),'field':_0x887f('0xc'),'foreignKey':'queue','model':_0x887f('0x35'),'filter':{'field':_0x887f('0x11'),'value':[_0x887f('0x36')]}},{'name':_0x887f('0x37'),'field':_0x887f('0xc'),'foreignKey':'queue','model':_0x887f('0x35'),'filter':{'field':_0x887f('0x11'),'value':[_0x887f('0x38')]}}];break;case _0x887f('0x39'):_0x255477[_0x887f('0x14')]=_0x887f('0x3a');break;case _0x887f('0x3b'):_0x255477[_0x887f('0x14')]=_0x887f('0x3c');break;case _0x887f('0x3d'):_0x255477[_0x887f('0x14')]='VoicePrefix';break;case _0x887f('0x3e'):_0x255477['childModel']='Campaign';break;case _0x887f('0x3f'):_0x255477[_0x887f('0x14')]='MailQueue';break;case'mailaccounts':_0x255477[_0x887f('0x14')]=_0x887f('0x40');break;case _0x887f('0x41'):_0x255477[_0x887f('0x14')]=_0x887f('0x42');break;case _0x887f('0x43'):_0x255477['childModel']=_0x887f('0x44');break;case _0x887f('0x45'):_0x255477[_0x887f('0x14')]=_0x887f('0x46');break;case'smsqueues':_0x255477[_0x887f('0x14')]='SmsQueue';break;case _0x887f('0x47'):_0x255477[_0x887f('0x14')]='SmsAccount';break;case _0x887f('0x48'):_0x255477[_0x887f('0x14')]=_0x887f('0x49');break;case'whatsappaccounts':_0x255477[_0x887f('0x14')]=_0x887f('0x4a');break;case _0x887f('0x4b'):_0x255477['childModel']=_0x887f('0x4c');break;case _0x887f('0x4d'):case _0x887f('0x4e'):_0x255477[_0x887f('0x14')]='VoiceQueue';if(_0x8b7a83){_0x255477[_0x887f('0x2f')]=[{'name':_0x887f('0x34')},{'name':_0x887f('0x37')}];}break;case _0x887f('0x4f'):case _0x887f('0x50'):case'telephones':_0x255477['childModel']=_0x887f('0x31');if(_0x8b7a83){_0x255477[_0x887f('0x2f')]=[{'name':'Users','filter':{'field':_0x887f('0x32'),'value':[_0x887f('0x51'),_0x887f('0x52')]},'ignore':!![]},{'name':'Agents'},{'name':_0x887f('0x53')}];}break;case _0x887f('0x54'):_0x255477['childModel']=_0x887f('0x55');break;case _0x887f('0x56'):_0x255477[_0x887f('0x14')]=_0x887f('0x57');break;case _0x887f('0x58'):_0x255477[_0x887f('0x14')]=_0x887f('0x59');break;case _0x887f('0x5a'):_0x255477['childModel']=_0x887f('0x5b');break;case _0x887f('0x5c'):_0x255477[_0x887f('0x14')]=_0x887f('0x5d');break;case'zohoaccounts':_0x255477['childModel']=_0x887f('0x5e');break;case _0x887f('0x5f'):_0x255477[_0x887f('0x14')]='User';break;case'cannedanswers':_0x255477[_0x887f('0x14')]=_0x887f('0x60');break;case'dispositions':_0x255477[_0x887f('0x14')]=_0x887f('0x61');break;case _0x887f('0x62'):_0x255477[_0x887f('0x14')]=_0x887f('0x63');break;case'intervals':_0x255477['childModel']='Interval';break;case _0x887f('0x64'):_0x255477['childModel']=_0x887f('0x65');break;case'scheduler':_0x255477[_0x887f('0x14')]=_0x887f('0x66');break;case _0x887f('0x67'):_0x255477[_0x887f('0x14')]=_0x887f('0x68');break;case _0x887f('0x69'):_0x255477[_0x887f('0x14')]=_0x887f('0x6a');break;case'templates':_0x255477['childModel']=_0x887f('0x6b');break;case'triggers':_0x255477[_0x887f('0x14')]=_0x887f('0x6c');break;case _0x887f('0x6d'):_0x255477[_0x887f('0x14')]=_0x887f('0x6e');break;case'variables':_0x255477[_0x887f('0x14')]='Variable';break;case _0x887f('0x6f'):_0x255477[_0x887f('0x14')]=_0x887f('0x70');break;case _0x887f('0x71'):_0x255477[_0x887f('0x14')]='AnalyticExtractedReport';_0x255477[_0x887f('0x2f')]=[{'name':_0x887f('0x72'),'field':'id','foreignKey':_0x887f('0x73')}];break;case _0x887f('0x74'):_0x255477['childModel']=_0x887f('0x75');break;}return _0x255477;}function _0x3c371a(_0x174978,_0x2abf3f){var _0x471265=_0x174978[_0x887f('0x76')](0x0)['toUpperCase']()+_0x174978[_0x887f('0x77')](0x1);var _0x4b11bc={'type':_0xb89f50['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x5236f4,_0x11111d){var _0x9efbcc=squel[_0x887f('0x78')]()['field'](_0x887f('0x79')+_0x471265+_0x887f('0x7a'),'id')[_0x887f('0x9')](_0x887f('0x7b'))[_0x887f('0x7c')](_0x887f('0x7d')+_0x174978+_0x887f('0x7e'),'ui')['where'](_0x887f('0x7f'),_0x2abf3f['id']);return _0xb89f50[_0x887f('0x80')]['query'](_0x9efbcc[_0x887f('0x81')](),_0x4b11bc)[_0x887f('0x6')](function(_0xf412ce){_0x2abf3f[_0x471265+'OpenTabs']=_0xf412ce;_0x5236f4(_0xf412ce);})[_0x887f('0x8')](function(_0x1d3384){_0x11111d(_0x1d3384);});});}return _0x79d16c[_0x887f('0x82')]('UserProfile',attributes,{'tableName':_0x887f('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4b7c33){var _0x568aa8=require(_0x887f('0x84'));var _0x5a9edd={'raw':_0x4b7c33[_0x887f('0x85')][_0x887f('0x86')],'where':{}};var _0x2a5074={};var _0x19b9e9={'count':0x0,'rows':[]};var _0x23a1eb=_0x4b7c33['query'][_0x887f('0x87')];var _0x5af130=_0x4b7c33['query'][_0x887f('0x88')]||![];var _0x5e15f3=_0x277c72(_0x23a1eb,_0x5af130);if(!_0x5e15f3['childModel'])throw new Error(_0x887f('0x89')+_0x23a1eb+'\x27');var _0x52f73e=[{'name':_0x23a1eb}];if(!_['isEmpty'](_0x5e15f3[_0x887f('0x2f')]))_0x52f73e=_0x5e15f3[_0x887f('0x2f')];var _0x127e39=[];for(var _0x3a2302=0x0;_0x3a2302<_0x52f73e['length'];_0x3a2302++){_0x127e39[_0x887f('0x8a')](_0xb89f50[_0x887f('0x8b')][_0x887f('0x8c')]({'where':{'userProfileId':_0x4b7c33[_0x887f('0x8d')]['id'],'name':_0x52f73e[_0x3a2302][_0x887f('0xc')]},'raw':!![]}));}return Promise[_0x887f('0x8e')](_0x127e39)[_0x887f('0x6')](function(_0xedafb6){var _0x5de1ae=_[_0x887f('0x4')](_0xedafb6,function(_0x27ba10){return _0x27ba10?_0x27ba10:undefined;});var _0x5a0caf=_[_0x887f('0x4')](_0x52f73e,[_0x887f('0x8f'),!![]]);var _0x14d930=_[_0x887f('0x90')](_0x5de1ae)&&_[_0x887f('0x90')](_0x5a0caf)?null:_[_0x887f('0x91')](_0x5a0caf,_0x5de1ae);if(!_0x14d930)return null;var _0x276fab=[];for(var _0xd32db0=0x0;_0xd32db0<_0x14d930[_0x887f('0x92')];_0xd32db0++){var _0x3bb5a4=_[_0x887f('0x8c')](_0x52f73e,function(_0x47730b){return _0x14d930[_0xd32db0]?_0x47730b[_0x887f('0xc')]===_0x14d930[_0xd32db0][_0x887f('0xc')]:null;});if(_0x3bb5a4){if(_0x14d930[_0xd32db0][_0x887f('0x8f')]){_0x276fab[_0x887f('0x8a')](_0x58ad39(_0x5e15f3['childModel'],_0x14d930[_0xd32db0]));}else{if(!_0x14d930[_0xd32db0][_0x887f('0x93')]){_0x276fab[_0x887f('0x8a')](_0x240a29(_0x3bb5a4,_0x14d930[_0xd32db0],_0x5e15f3[_0x887f('0x14')]));}else{if(_0x3bb5a4[_0x887f('0x94')]){_0x276fab[_0x887f('0x8a')](_0x51a07d(_0x3bb5a4,_0x14d930[_0xd32db0]));}}}}}return Promise[_0x887f('0x8e')](_0x276fab);})['then'](function(_0x16e942){var _0x482f94=_0x16e942;var _0x31361b=null;if(_0x482f94){_0x31361b=_0x482f94[_0x887f('0x92')]===0x1?_0x482f94[0x0]:null;}if(!_0x31361b&&!_0x482f94)return _0x19b9e9;var _0x17816c=_0xb89f50[_0x5e15f3[_0x887f('0x14')]]['rawAttributes'];_0x2a5074[_0x887f('0x94')]=_[_0x887f('0x95')](_0x17816c);_0x2a5074['query']=_[_0x887f('0x95')](_0x4b7c33[_0x887f('0x85')]);_0x2a5074['filters']=_[_0x887f('0x96')](_0x2a5074[_0x887f('0x94')],_0x2a5074[_0x887f('0x85')]);_0x5a9edd[_0x887f('0x97')]=_['intersection'](_0x2a5074['model'],_0x568aa8[_0x887f('0x98')](_0x4b7c33[_0x887f('0x85')]['fields']));_0x5a9edd[_0x887f('0x97')]=_0x5a9edd['attributes'][_0x887f('0x92')]?_0x5a9edd[_0x887f('0x97')]:_0x2a5074['model'];if(!_0x4b7c33[_0x887f('0x85')]['hasOwnProperty'](_0x887f('0x99'))){_0x5a9edd['limit']=_0x568aa8['limit'](_0x4b7c33[_0x887f('0x85')][_0x887f('0x9a')]);_0x5a9edd[_0x887f('0x9b')]=_0x568aa8[_0x887f('0x9b')](_0x4b7c33[_0x887f('0x85')]['offset']);}_0x5a9edd[_0x887f('0x9c')]=_0x568aa8['sort'](_0x4b7c33[_0x887f('0x85')][_0x887f('0x9d')]);_0x5a9edd['where']=_0x568aa8[_0x887f('0x9e')](_[_0x887f('0x9f')](_0x4b7c33[_0x887f('0x85')],_0x2a5074['filters']));if(_0x4b7c33[_0x887f('0x85')][_0x887f('0x4')]){_0x5a9edd['where']=_[_0x887f('0xa0')](_0x5a9edd[_0x887f('0xa1')],{'$or':_[_0x887f('0x7')](_0x17816c,function(_0x33b107){if(_0x33b107[_0x887f('0x11')][_0x887f('0xa2')]!==_0x887f('0xa3')){var _0x17a4b8={};_0x17a4b8[_0x33b107[_0x887f('0x9')]]={'$like':'%'+_0x4b7c33[_0x887f('0x85')]['filter']+'%'};return _0x17a4b8;}})});}var _0x4622eb=[];var _0x12d99b=null;var _0x42e2a4={};if(_0x31361b){_0x12d99b=_[_0x887f('0x8c')](_0x52f73e,['name',_0x31361b[_0x887f('0xc')]]);if(_0x12d99b[_0x887f('0x9')]){_0x42e2a4={};if(_0x5e15f3[_0x887f('0x14')]==='AnalyticExtractedReport'){_0x42e2a4[_0x12d99b['foreignKey']]=_[_0x887f('0x7')](_0x31361b['associatedResources'],'id');}else{_0x42e2a4[_0x12d99b[_0x887f('0xa4')]]=_0x31361b['associatedResources'];}_0x4622eb[_0x887f('0x8a')](_0x42e2a4);}else{_0x5a9edd[_0x887f('0xa1')]['id']=_0x31361b[_0x887f('0xb')];}}else{for(var _0x5a6f2=0x0;_0x5a6f2<_0x482f94['length'];_0x5a6f2++){_0x12d99b=_['find'](_0x52f73e,[_0x887f('0xc'),_0x482f94[_0x5a6f2][_0x887f('0xc')]]);if(_0x12d99b['field']){_0x42e2a4={};_0x42e2a4[_0x12d99b[_0x887f('0xa4')]]=_0x482f94[_0x5a6f2][_0x887f('0xb')];_0x4622eb[_0x887f('0x8a')](_0x42e2a4);}else{if(!_0x5a9edd[_0x887f('0xa1')]['id'])_0x5a9edd[_0x887f('0xa1')]['id']=[];_0x482f94[_0x5a6f2][_0x887f('0xb')][_0x887f('0xa5')](function(_0x3cf41d){_0x5a9edd['where']['id']['push'](_0x3cf41d);});}}}if(!_['isEmpty'](_0x4622eb)){_0x5a9edd[_0x887f('0xa1')]=_[_0x887f('0xa0')](_0x5a9edd[_0x887f('0xa1')],{'$and':{'$or':_0x4622eb}});}_0x5a9edd=_[_0x887f('0xa0')]({},_0x5a9edd,_0x4b7c33[_0x887f('0xa6')]);if(_0x31361b&&!_0x31361b[_0x887f('0x93')]&&_0x5e15f3[_0x887f('0x14')]===_0x887f('0xf')){if(_0x4b7c33['query'][_0x887f('0xa7')]){_0x5a9edd[_0x887f('0xa8')]=[{'all':!![]}];}return _0xb89f50[_0x5e15f3[_0x887f('0x14')]][_0x887f('0x5')](_0x5a9edd)[_0x887f('0x6')](function(_0x23c311){var _0x4d7785=[];_0x23c311[_0x887f('0xa5')](function(_0x2f0e23){var _0x3f9bf4;switch(_0x2f0e23['reportType']){case'default':_0x3f9bf4=_[_0x887f('0x8c')](_0x31361b[_0x887f('0xb')],function(_0x3922cf){return _0x3922cf['id']===_0x2f0e23[_0x887f('0x73')]&&_0x3922cf[_0x887f('0x11')]===_0x887f('0xa9');});break;case _0x887f('0xaa'):_0x3f9bf4=_[_0x887f('0x8c')](_0x31361b[_0x887f('0xb')],function(_0x27ce6c){return _0x27ce6c['id']===_0x2f0e23[_0x887f('0x73')]&&_0x27ce6c[_0x887f('0x11')]===_0x887f('0xab');});break;}if(_0x3f9bf4)_0x4d7785[_0x887f('0x8a')](_0x2f0e23);});_0x19b9e9[_0x887f('0xac')]=_0x4d7785['length'];_0x19b9e9[_0x887f('0xad')]=_0x4d7785;return _0x19b9e9;});}else{if(!_[_0x887f('0x90')](_0x4b7c33[_0x887f('0x85')][_0x887f('0xae')])){_0x5a9edd[_0x887f('0xa1')]['id']=_0x5a9edd[_0x887f('0xa1')]['id']?_[_0x887f('0x96')](_0x5a9edd['where']['id'],_0x4b7c33[_0x887f('0x85')][_0x887f('0xae')]):_0x4b7c33['query']['ids'];if(_0x4b7c33['query']['customSorting']){_0x5a9edd[_0x887f('0x9c')]=_0x4b7c33[_0x887f('0x85')][_0x887f('0xaf')];}}if(_0x4b7c33[_0x887f('0x85')][_0x887f('0xb0')]){_0x5a9edd['where']=_[_0x887f('0xa0')](_0x5a9edd[_0x887f('0xa1')],{'$and':_0x4b7c33['query'][_0x887f('0xb0')]});}return _0xb89f50[_0x5e15f3[_0x887f('0x14')]][_0x887f('0xac')]({'where':_0x5a9edd['where']})['then'](function(_0x3a6b36){_0x19b9e9[_0x887f('0xac')]=_0x3a6b36;if(_0x4b7c33[_0x887f('0x85')][_0x887f('0xa7')]){if(_0x5e15f3[_0x887f('0x14')]==='CmContact'){_0x5a9edd[_0x887f('0xa8')]=[{'model':_0xb89f50[_0x887f('0x6a')],'as':_0x887f('0xb1'),'attributes':['id',_0x887f('0xc'),_0x887f('0xb2')],'required':_0x4b7c33[_0x887f('0x85')][_0x887f('0xb3')]?!![]:![]},{'model':_0xb89f50[_0x887f('0x6a')],'as':_0x887f('0xb4'),'attributes':['id',_0x887f('0xc'),_0x887f('0xb2')],'through':_0x4b7c33[_0x887f('0x85')]['tag']?{'attributes':[],'where':{'TagId':_0x4b7c33[_0x887f('0x85')][_0x887f('0xb3')]||undefined}}:{},'required':_0x4b7c33[_0x887f('0x85')][_0x887f('0xb3')]?!![]:![]}];}else{_0x5a9edd[_0x887f('0xa8')]=[{'all':!![]}];}}return _0xb89f50[_0x5e15f3['childModel']][_0x887f('0x5')](_0x5a9edd);})[_0x887f('0x6')](function(_0x4f09a8){_0x19b9e9[_0x887f('0xad')]=_0x4f09a8;if(_0x23a1eb==='Agents'&&_0x4b7c33['query'][_0x887f('0xb5')]==='true'){var _0x4e5535=[];for(var _0x5ad18e=0x0;_0x5ad18e<_0x19b9e9[_0x887f('0xad')][_0x887f('0x92')];_0x5ad18e++){_0x4e5535[_0x887f('0x8a')](_0x3c371a(_0x887f('0xb6'),_0x19b9e9[_0x887f('0xad')][_0x5ad18e]['dataValues']));_0x4e5535['push'](_0x3c371a(_0x887f('0xb7'),_0x19b9e9['rows'][_0x5ad18e]['dataValues']));_0x4e5535[_0x887f('0x8a')](_0x3c371a(_0x887f('0xb8'),_0x19b9e9['rows'][_0x5ad18e][_0x887f('0xb9')]));_0x4e5535[_0x887f('0x8a')](_0x3c371a(_0x887f('0xba'),_0x19b9e9['rows'][_0x5ad18e]['dataValues']));_0x4e5535['push'](_0x3c371a(_0x887f('0xbb'),_0x19b9e9[_0x887f('0xad')][_0x5ad18e][_0x887f('0xb9')]));_0x4e5535[_0x887f('0x8a')](_0x3c371a(_0x887f('0xbc'),_0x19b9e9['rows'][_0x5ad18e][_0x887f('0xb9')]));}return Promise[_0x887f('0x8e')](_0x4e5535)[_0x887f('0x6')](function(){return _0x19b9e9;});}return _0x19b9e9;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 96d0fa3..7a1ee80 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 _0xbb61=['code','UserProfile,\x20%s,\x20%s','message','info','request\x20sent','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./userProfile.socket','register','then','debug','UserProfile,\x20%s,\x20%s,\x20%s','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb61,0x131));var _0x1bb6=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xbb61[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0x1bb6('0x0'));var util=require('util');var moment=require(_0x1bb6('0x1'));var BPromise=require(_0x1bb6('0x2'));var rs=require(_0x1bb6('0x3'));var fs=require('fs');var Redis=require(_0x1bb6('0x4'));var db=require(_0x1bb6('0x5'))['db'];var utils=require(_0x1bb6('0x6'));var logger=require(_0x1bb6('0x7'))('rpc');var config=require(_0x1bb6('0x8'));var jayson=require(_0x1bb6('0x9'));var client=jayson[_0x1bb6('0xa')]['http']({'port':0x232a});config[_0x1bb6('0xb')]=_[_0x1bb6('0xc')](config[_0x1bb6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1bb6('0xd'))(new Redis(config[_0x1bb6('0xb')]));require(_0x1bb6('0xe'))[_0x1bb6('0xf')](socket);function respondWithRpcPromise(_0x1a18bf,_0x359a49,_0x5c8d00){return new BPromise(function(_0xe24210,_0x29ee41){return client['request'](_0x1a18bf,_0x5c8d00)[_0x1bb6('0x10')](function(_0x5988f4){logger['info']('UserProfile,\x20%s,\x20%s',_0x359a49,'request\x20sent');logger[_0x1bb6('0x11')](_0x1bb6('0x12'),_0x359a49,'request\x20sent',JSON['stringify'](_0x5988f4));if(_0x5988f4[_0x1bb6('0x13')]){if(_0x5988f4[_0x1bb6('0x13')][_0x1bb6('0x14')]===0x1f4){logger[_0x1bb6('0x13')](_0x1bb6('0x15'),_0x359a49,_0x5988f4[_0x1bb6('0x13')][_0x1bb6('0x16')]);return _0x29ee41(_0x5988f4[_0x1bb6('0x13')]['message']);}logger[_0x1bb6('0x13')](_0x1bb6('0x15'),_0x359a49,_0x5988f4[_0x1bb6('0x13')][_0x1bb6('0x16')]);return _0xe24210(_0x5988f4[_0x1bb6('0x13')]['message']);}else{logger[_0x1bb6('0x17')](_0x1bb6('0x15'),_0x359a49,_0x1bb6('0x18'));_0xe24210(_0x5988f4['result'][_0x1bb6('0x16')]);}})['catch'](function(_0x203f2b){logger['error'](_0x1bb6('0x15'),_0x359a49,_0x203f2b);_0x29ee41(_0x203f2b);});});} \ No newline at end of file +var _0xf3fe=['./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter'];(function(_0x401d67,_0xeb1592){var _0x25076b=function(_0x233577){while(--_0x233577){_0x401d67['push'](_0x401d67['shift']());}};_0x25076b(++_0xeb1592);}(_0xf3fe,0x1cd));var _0xef3f=function(_0x39c516,_0x256a15){_0x39c516=_0x39c516-0x0;var _0x20bdd9=_0xf3fe[_0x39c516];return _0x20bdd9;};'use strict';var _=require('lodash');var util=require(_0xef3f('0x0'));var moment=require(_0xef3f('0x1'));var BPromise=require(_0xef3f('0x2'));var rs=require(_0xef3f('0x3'));var fs=require('fs');var Redis=require(_0xef3f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xef3f('0x5'));var logger=require(_0xef3f('0x6'))(_0xef3f('0x7'));var config=require(_0xef3f('0x8'));var jayson=require(_0xef3f('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xef3f('0xa')]=_[_0xef3f('0xb')](config[_0xef3f('0xa')],{'host':_0xef3f('0xc'),'port':0x18eb});var socket=require(_0xef3f('0xd'))(new Redis(config[_0xef3f('0xa')]));require(_0xef3f('0xe'))[_0xef3f('0xf')](socket);function respondWithRpcPromise(_0x386022,_0x5e558c,_0x3eb85b){return new BPromise(function(_0x48818b,_0x3f47b7){return client[_0xef3f('0x10')](_0x386022,_0x3eb85b)[_0xef3f('0x11')](function(_0x33e66f){logger['info'](_0xef3f('0x12'),_0x5e558c,_0xef3f('0x13'));logger['debug'](_0xef3f('0x14'),_0x5e558c,'request\x20sent',JSON[_0xef3f('0x15')](_0x33e66f));if(_0x33e66f['error']){if(_0x33e66f[_0xef3f('0x16')][_0xef3f('0x17')]===0x1f4){logger[_0xef3f('0x16')](_0xef3f('0x12'),_0x5e558c,_0x33e66f[_0xef3f('0x16')][_0xef3f('0x18')]);return _0x3f47b7(_0x33e66f[_0xef3f('0x16')][_0xef3f('0x18')]);}logger[_0xef3f('0x16')](_0xef3f('0x12'),_0x5e558c,_0x33e66f[_0xef3f('0x16')]['message']);return _0x48818b(_0x33e66f[_0xef3f('0x16')][_0xef3f('0x18')]);}else{logger['info'](_0xef3f('0x12'),_0x5e558c,_0xef3f('0x13'));_0x48818b(_0x33e66f['result']['message']);}})['catch'](function(_0x4909b9){logger[_0xef3f('0x16')](_0xef3f('0x12'),_0x5e558c,_0x4909b9);_0x3f47b7(_0x4909b9);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 1e9803a..fb7eb6d 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 _0xc4ba=['remove','update','emit','removeListener','length','userProfile:','./userProfile.events','save'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0xc4ba,0x1c6));var _0xac4b=function(_0x3a194f,_0x4964bf){_0x3a194f=_0x3a194f-0x0;var _0x43c8de=_0xc4ba[_0x3a194f];return _0x43c8de;};'use strict';var UserProfileEvents=require(_0xac4b('0x0'));var events=[_0xac4b('0x1'),_0xac4b('0x2'),_0xac4b('0x3')];function createListener(_0x1845bd,_0x4edadd){return function(_0x55b874){_0x4edadd[_0xac4b('0x4')](_0x1845bd,_0x55b874);};}function removeListener(_0x216498,_0x29ca11){return function(){UserProfileEvents[_0xac4b('0x5')](_0x216498,_0x29ca11);};}exports['register']=function(_0x5ca401){for(var _0x324d13=0x0,_0x40917f=events[_0xac4b('0x6')];_0x324d13<_0x40917f;_0x324d13++){var _0x11791a=events[_0x324d13];var _0x5b7af5=createListener(_0xac4b('0x7')+_0x11791a,_0x5ca401);UserProfileEvents['on'](_0x11791a,_0x5b7af5);}}; \ No newline at end of file +var _0xa885=['./userProfile.events','save','update','removeListener','register','userProfile:'];(function(_0x5d1b95,_0x5d1c9a){var _0x126bb=function(_0x79c375){while(--_0x79c375){_0x5d1b95['push'](_0x5d1b95['shift']());}};_0x126bb(++_0x5d1c9a);}(_0xa885,0x1da));var _0x5a88=function(_0x5717fa,_0x420e1a){_0x5717fa=_0x5717fa-0x0;var _0x1d5a30=_0xa885[_0x5717fa];return _0x1d5a30;};'use strict';var UserProfileEvents=require(_0x5a88('0x0'));var events=[_0x5a88('0x1'),'remove',_0x5a88('0x2')];function createListener(_0x28486e,_0x4686a0){return function(_0x2f11c9){_0x4686a0['emit'](_0x28486e,_0x2f11c9);};}function removeListener(_0x3cdd44,_0x59a0db){return function(){UserProfileEvents[_0x5a88('0x3')](_0x3cdd44,_0x59a0db);};}exports[_0x5a88('0x4')]=function(_0x5adb48){for(var _0x3868bf=0x0,_0x5517dd=events['length'];_0x3868bf<_0x5517dd;_0x3868bf++){var _0x450b8d=events[_0x3868bf];var _0x1b3b6e=createListener(_0x5a88('0x5')+_0x450b8d,_0x5adb48);UserProfileEvents['on'](_0x450b8d,_0x1b3b6e);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 12892d1..f777585 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 _0xe474=['../../config/environment','get','index','/describe','isAuthenticated','/:id','show','create','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe474,0x1f2));var _0x4e47=function(_0x53773a,_0x48c6e0){_0x53773a=_0x53773a-0x0;var _0x543846=_0xe474[_0x53773a];return _0x543846;};'use strict';var multer=require(_0x4e47('0x0'));var util=require(_0x4e47('0x1'));var path=require(_0x4e47('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4e47('0x3')]();var fs_extra=require(_0x4e47('0x4'));var auth=require(_0x4e47('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4e47('0x6'));var controller=require('./userProfileResource.controller');router[_0x4e47('0x7')]('/',auth['isAuthenticated'](),controller[_0x4e47('0x8')]);router[_0x4e47('0x7')](_0x4e47('0x9'),auth[_0x4e47('0xa')](),controller['describe']);router[_0x4e47('0x7')](_0x4e47('0xb'),auth[_0x4e47('0xa')](),controller[_0x4e47('0xc')]);router['post']('/',auth[_0x4e47('0xa')](),controller[_0x4e47('0xd')]);router['put']('/:id',auth[_0x4e47('0xa')](),controller[_0x4e47('0xe')]);router[_0x4e47('0xf')](_0x4e47('0xb'),auth[_0x4e47('0xa')](),controller[_0x4e47('0x10')]);module[_0x4e47('0x11')]=router; \ No newline at end of file +var _0xda01=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','create','update','delete','exports','multer'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xda01,0x155));var _0x1da0=function(_0xcf8113,_0x132733){_0xcf8113=_0xcf8113-0x0;var _0x5b354f=_0xda01[_0xcf8113];return _0x5b354f;};'use strict';var multer=require(_0x1da0('0x0'));var util=require(_0x1da0('0x1'));var path=require(_0x1da0('0x2'));var timeout=require(_0x1da0('0x3'));var express=require('express');var router=express[_0x1da0('0x4')]();var fs_extra=require(_0x1da0('0x5'));var auth=require(_0x1da0('0x6'));var interaction=require(_0x1da0('0x7'));var config=require(_0x1da0('0x8'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0x1da0('0x9')](),controller[_0x1da0('0xa')]);router[_0x1da0('0xb')]('/describe',auth[_0x1da0('0x9')](),controller[_0x1da0('0xc')]);router[_0x1da0('0xb')](_0x1da0('0xd'),auth[_0x1da0('0x9')](),controller[_0x1da0('0xe')]);router['post']('/',auth[_0x1da0('0x9')](),controller[_0x1da0('0xf')]);router['put'](_0x1da0('0xd'),auth[_0x1da0('0x9')](),controller[_0x1da0('0x10')]);router[_0x1da0('0x11')](_0x1da0('0xd'),auth[_0x1da0('0x9')](),controller['destroy']);module[_0x1da0('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 1b15607..3fa7102 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 _0x57a3=['sequelize','STRING','INTEGER'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x57a3,0x66));var _0x357a=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x57a3[_0x874cf1];return _0x233579;};'use strict';var Sequelize=require(_0x357a('0x0'));module['exports']={'name':{'type':Sequelize[_0x357a('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x357a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x357a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x4e63=['STRING','INTEGER','exports'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0x4e63,0x149));var _0x34e6=function(_0x543883,_0x445787){_0x543883=_0x543883-0x0;var _0x258678=_0x4e63[_0x543883];return _0x258678;};'use strict';var Sequelize=require('sequelize');module[_0x34e6('0x0')]={'name':{'type':Sequelize[_0x34e6('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x34e6('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 94cbecd..3062d26 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacf4=['findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include'];(function(_0x40df5f,_0x8fd59f){var _0x1573f1=function(_0x57b8b8){while(--_0x57b8b8){_0x40df5f['push'](_0x40df5f['shift']());}};_0x1573f1(++_0x8fd59f);}(_0xacf4,0xe7));var _0x4acf=function(_0x42e82b,_0x167c34){_0x42e82b=_0x42e82b-0x0;var _0x299b06=_0xacf4[_0x42e82b];return _0x299b06;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['UserProfileResource'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['UserProfileResource']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));};exports[_0x4acf('0x48')]=function(_0x2b62bc,_0x113425){return db[_0x4acf('0x29')]['describe']()[_0x4acf('0x21')](respondWithResult(_0x113425,null))[_0x4acf('0x3f')](handleError(_0x113425,null));}; \ No newline at end of file +var _0x7096=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','UserProfileResource','find','catch','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set'];(function(_0x189dbd,_0x1d3cad){var _0x7861fb=function(_0x1a8738){while(--_0x1a8738){_0x189dbd['push'](_0x189dbd['shift']());}};_0x7861fb(++_0x1d3cad);}(_0x7096,0x10c));var _0x6709=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x7096[_0x4e9628];return _0x27bc8c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['UserProfileResource'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['UserProfileResource'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['UserProfileResource'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['UserProfileResource']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['UserProfileResource'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));};exports[_0x6709('0x4a')]=function(_0x1015e0,_0x55188c){return db['UserProfileResource'][_0x6709('0x4a')]()['then'](respondWithResult(_0x55188c,null))['catch'](handleError(_0x55188c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index c1c9a59..65494e5 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 _0x9d8c=['../../config/environment','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0xa81466,_0x7380a5){var _0x45e9bd=function(_0x16fb02){while(--_0x16fb02){_0xa81466['push'](_0xa81466['shift']());}};_0x45e9bd(++_0x7380a5);}(_0x9d8c,0x124));var _0xc9d8=function(_0x189ec8,_0x52202f){_0x189ec8=_0x189ec8-0x0;var _0x5f00d7=_0x9d8c[_0x189ec8];return _0x5f00d7;};'use strict';var _=require(_0xc9d8('0x0'));var util=require(_0xc9d8('0x1'));var logger=require(_0xc9d8('0x2'))(_0xc9d8('0x3'));var moment=require(_0xc9d8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9d8('0x5'));var rimraf=require(_0xc9d8('0x6'));var config=require(_0xc9d8('0x7'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x5ea3f1,_0x264722){return _0x5ea3f1[_0xc9d8('0x8')](_0xc9d8('0x9'),attributes,{'tableName':_0xc9d8('0xa'),'paranoid':![],'indexes':[{'name':_0xc9d8('0xb'),'fields':[_0xc9d8('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x327b=['moment','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api'];(function(_0x35cf60,_0x228d12){var _0x443cf8=function(_0x391c0f){while(--_0x391c0f){_0x35cf60['push'](_0x35cf60['shift']());}};_0x443cf8(++_0x228d12);}(_0x327b,0xfb));var _0xb327=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x327b[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xb327('0x0'));var util=require(_0xb327('0x1'));var logger=require(_0xb327('0x2'))(_0xb327('0x3'));var moment=require(_0xb327('0x4'));var BPromise=require('bluebird');var rp=require(_0xb327('0x5'));var fs=require('fs');var path=require(_0xb327('0x6'));var rimraf=require(_0xb327('0x7'));var config=require(_0xb327('0x8'));var attributes=require(_0xb327('0x9'));module[_0xb327('0xa')]=function(_0x52d77d,_0x14e6b2){return _0x52d77d[_0xb327('0xb')](_0xb327('0xc'),attributes,{'tableName':_0xb327('0xd'),'paranoid':![],'indexes':[{'name':_0xb327('0xe'),'fields':[_0xb327('0xf'),_0xb327('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 330cdb5..fa58587 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 _0x58a8=['http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x310417,_0x5bcfc8){var _0x4e6711=function(_0x5206b3){while(--_0x5206b3){_0x310417['push'](_0x310417['shift']());}};_0x4e6711(++_0x5bcfc8);}(_0x58a8,0x13a));var _0x858a=function(_0x4a0158,_0x1ce3ae){_0x4a0158=_0x4a0158-0x0;var _0x7cdda7=_0x58a8[_0x4a0158];return _0x7cdda7;};'use strict';var _=require(_0x858a('0x0'));var util=require(_0x858a('0x1'));var moment=require(_0x858a('0x2'));var BPromise=require(_0x858a('0x3'));var rs=require(_0x858a('0x4'));var fs=require('fs');var Redis=require(_0x858a('0x5'));var db=require(_0x858a('0x6'))['db'];var utils=require(_0x858a('0x7'));var logger=require(_0x858a('0x8'))(_0x858a('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x858a('0xa')][_0x858a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfff94a,_0x218af9,_0x5d710f){return new BPromise(function(_0x4ebe47,_0x898a08){return client[_0x858a('0xc')](_0xfff94a,_0x5d710f)[_0x858a('0xd')](function(_0x47fa10){logger[_0x858a('0xe')](_0x858a('0xf'),_0x218af9,_0x858a('0x10'));logger[_0x858a('0x11')](_0x858a('0x12'),_0x218af9,_0x858a('0x10'),JSON[_0x858a('0x13')](_0x47fa10));if(_0x47fa10['error']){if(_0x47fa10[_0x858a('0x14')][_0x858a('0x15')]===0x1f4){logger[_0x858a('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x218af9,_0x47fa10['error'][_0x858a('0x16')]);return _0x898a08(_0x47fa10[_0x858a('0x14')][_0x858a('0x16')]);}logger['error'](_0x858a('0xf'),_0x218af9,_0x47fa10[_0x858a('0x14')][_0x858a('0x16')]);return _0x4ebe47(_0x47fa10[_0x858a('0x14')][_0x858a('0x16')]);}else{logger[_0x858a('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x218af9,'request\x20sent');_0x4ebe47(_0x47fa10[_0x858a('0x17')]['message']);}})[_0x858a('0x18')](function(_0x32920b){logger[_0x858a('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x218af9,_0x32920b);_0x898a08(_0x32920b);});});} \ No newline at end of file +var _0xbda9=['request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','rpc','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbda9,0xe4));var _0x9bda=function(_0x15b5d2,_0x2f76a7){_0x15b5d2=_0x15b5d2-0x0;var _0x3ca950=_0xbda9[_0x15b5d2];return _0x3ca950;};'use strict';var _=require(_0x9bda('0x0'));var util=require(_0x9bda('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9bda('0x2'));var fs=require('fs');var Redis=require(_0x9bda('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9bda('0x4'));var logger=require('../../config/logger')(_0x9bda('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9bda('0x6')][_0x9bda('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x467c4d,_0x231b4a,_0x390c28){return new BPromise(function(_0x519401,_0x1fc31d){return client[_0x9bda('0x8')](_0x467c4d,_0x390c28)[_0x9bda('0x9')](function(_0x35b979){logger[_0x9bda('0xa')](_0x9bda('0xb'),_0x231b4a,_0x9bda('0xc'));logger['debug'](_0x9bda('0xd'),_0x231b4a,_0x9bda('0xc'),JSON[_0x9bda('0xe')](_0x35b979));if(_0x35b979[_0x9bda('0xf')]){if(_0x35b979[_0x9bda('0xf')][_0x9bda('0x10')]===0x1f4){logger[_0x9bda('0xf')](_0x9bda('0xb'),_0x231b4a,_0x35b979[_0x9bda('0xf')]['message']);return _0x1fc31d(_0x35b979[_0x9bda('0xf')][_0x9bda('0x11')]);}logger[_0x9bda('0xf')](_0x9bda('0xb'),_0x231b4a,_0x35b979[_0x9bda('0xf')][_0x9bda('0x11')]);return _0x519401(_0x35b979['error'][_0x9bda('0x11')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x231b4a,_0x9bda('0xc'));_0x519401(_0x35b979[_0x9bda('0x12')][_0x9bda('0x11')]);}})[_0x9bda('0x13')](function(_0x57d531){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x231b4a,_0x57d531);_0x1fc31d(_0x57d531);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 0c9f3d2..0050137 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 _0xb483=['put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1c74f5,_0x2b3264){var _0x54c13c=function(_0x4948a6){while(--_0x4948a6){_0x1c74f5['push'](_0x1c74f5['shift']());}};_0x54c13c(++_0x2b3264);}(_0xb483,0xf5));var _0x3b48=function(_0x1a0caa,_0x48505e){_0x1a0caa=_0x1a0caa-0x0;var _0x2239e4=_0xb483[_0x1a0caa];return _0x2239e4;};'use strict';var multer=require(_0x3b48('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3b48('0x1'));var express=require(_0x3b48('0x2'));var router=express[_0x3b48('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3b48('0x4'));var interaction=require(_0x3b48('0x5'));var config=require(_0x3b48('0x6'));var controller=require('./userProfileSection.controller');router[_0x3b48('0x7')]('/',auth[_0x3b48('0x8')](),controller[_0x3b48('0x9')]);router[_0x3b48('0x7')](_0x3b48('0xa'),auth[_0x3b48('0x8')](),controller[_0x3b48('0xb')]);router[_0x3b48('0x7')](_0x3b48('0xc'),auth[_0x3b48('0x8')](),controller[_0x3b48('0xd')]);router[_0x3b48('0xe')]('/',auth[_0x3b48('0x8')](),controller['create']);router[_0x3b48('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3b48('0x10')]);router[_0x3b48('0x11')](_0x3b48('0xc'),auth[_0x3b48('0x8')](),controller[_0x3b48('0x12')]);module[_0x3b48('0x13')]=router; \ No newline at end of file +var _0xdd27=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','destroy','multer'];(function(_0x53dba6,_0x31ad28){var _0x4f7d58=function(_0xf30dcd){while(--_0xf30dcd){_0x53dba6['push'](_0x53dba6['shift']());}};_0x4f7d58(++_0x31ad28);}(_0xdd27,0xfb));var _0x7dd2=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0xdd27[_0x29ce14];return _0x48f289;};'use strict';var multer=require(_0x7dd2('0x0'));var util=require('util');var path=require(_0x7dd2('0x1'));var timeout=require(_0x7dd2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7dd2('0x3'));var auth=require(_0x7dd2('0x4'));var interaction=require(_0x7dd2('0x5'));var config=require(_0x7dd2('0x6'));var controller=require('./userProfileSection.controller');router['get']('/',auth[_0x7dd2('0x7')](),controller[_0x7dd2('0x8')]);router[_0x7dd2('0x9')](_0x7dd2('0xa'),auth[_0x7dd2('0x7')](),controller[_0x7dd2('0xb')]);router[_0x7dd2('0x9')](_0x7dd2('0xc'),auth[_0x7dd2('0x7')](),controller[_0x7dd2('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7dd2('0xe')]);router[_0x7dd2('0xf')](_0x7dd2('0xc'),auth[_0x7dd2('0x7')](),controller[_0x7dd2('0x10')]);router['delete'](_0x7dd2('0xc'),auth[_0x7dd2('0x7')](),controller[_0x7dd2('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index d848030..e8832ce 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 _0xb9a7=['getDataValue','split','exports','BOOLEAN','STRING','setDataValue','crudPermissions','join'];(function(_0x5acad0,_0x47641){var _0x1fa1cf=function(_0x1414eb){while(--_0x1414eb){_0x5acad0['push'](_0x5acad0['shift']());}};_0x1fa1cf(++_0x47641);}(_0xb9a7,0x112));var _0x7b9a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xb9a7[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x7b9a('0x1')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x7b9a('0x2')],'set':function(_0x40ef7d){this[_0x7b9a('0x3')](_0x7b9a('0x4'),_0x40ef7d?_0x40ef7d[_0x7b9a('0x5')](''):[]);},'get':function(){return this[_0x7b9a('0x6')](_0x7b9a('0x4'))?this[_0x7b9a('0x6')](_0x7b9a('0x4'))[_0x7b9a('0x7')](''):[];}}}; \ No newline at end of file +var _0xefda=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','STRING','INTEGER'];(function(_0x30cbc8,_0x396a89){var _0x2c45ba=function(_0x32196a){while(--_0x32196a){_0x30cbc8['push'](_0x30cbc8['shift']());}};_0x2c45ba(++_0x396a89);}(_0xefda,0x96));var _0xaefd=function(_0x167121,_0x422596){_0x167121=_0x167121-0x0;var _0xb68d3b=_0xefda[_0x167121];return _0xb68d3b;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xaefd('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaefd('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaefd('0x1')],'set':function(_0x2ade44){this[_0xaefd('0x4')](_0xaefd('0x5'),_0x2ade44?_0x2ade44[_0xaefd('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xaefd('0x5'))?this[_0xaefd('0x7')](_0xaefd('0x5'))[_0xaefd('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 07fa02f..4a71f6b 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 _0x3568=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','reject','save','then','end','error','name','send','index','map','UserProfileSection','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','params','keys','rawAttributes','includeAll','include','find','create','body','update','destroy','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','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x5729ef,_0x184dfc){var _0x4d03fb=function(_0x42620c){while(--_0x42620c){_0x5729ef['push'](_0x5729ef['shift']());}};_0x4d03fb(++_0x184dfc);}(_0x3568,0x11a));var _0x8356=function(_0x50451e,_0x124670){_0x50451e=_0x50451e-0x0;var _0x30524d=_0x3568[_0x50451e];return _0x30524d;};'use strict';var emlformat=require(_0x8356('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8356('0x1'));var jsonpatch=require(_0x8356('0x2'));var rp=require(_0x8356('0x3'));var moment=require('moment');var BPromise=require(_0x8356('0x4'));var Mustache=require(_0x8356('0x5'));var util=require(_0x8356('0x6'));var path=require(_0x8356('0x7'));var sox=require(_0x8356('0x8'));var csv=require(_0x8356('0x9'));var ejs=require(_0x8356('0xa'));var fs=require('fs');var fs_extra=require(_0x8356('0xb'));var _=require(_0x8356('0xc'));var squel=require(_0x8356('0xd'));var crypto=require(_0x8356('0xe'));var jsforce=require(_0x8356('0xf'));var deskjs=require(_0x8356('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8356('0x11'));var Papa=require(_0x8356('0x12'));var Redis=require('ioredis');var authService=require(_0x8356('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8356('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8356('0x15'))('api');var utils=require(_0x8356('0x16'));var config=require(_0x8356('0x17'));var licenseUtil=require(_0x8356('0x18'));var db=require(_0x8356('0x19'))['db'];function respondWithStatusCode(_0x371201,_0x445dea){_0x445dea=_0x445dea||0xcc;return function(_0x18f1b8){if(_0x18f1b8){return _0x371201[_0x8356('0x1a')](_0x445dea);}return _0x371201[_0x8356('0x1b')](_0x445dea)['end']();};}function respondWithResult(_0x4bfd9f,_0x49a151){_0x49a151=_0x49a151||0xc8;return function(_0x4b1543){if(_0x4b1543){return _0x4bfd9f['status'](_0x49a151)['json'](_0x4b1543);}};}function respondWithFilteredResult(_0x26f43c,_0x3406dc){return function(_0x56158e){if(_0x56158e){var _0x5b2efc=typeof _0x3406dc[_0x8356('0x1c')]===_0x8356('0x1d')&&typeof _0x3406dc['limit']==='undefined';var _0x3b1303=_0x56158e[_0x8356('0x1e')];var _0x567dd0=_0x5b2efc?0x0:_0x3406dc['offset'];var _0x133fff=_0x5b2efc?_0x56158e[_0x8356('0x1e')]:_0x3406dc[_0x8356('0x1c')]+_0x3406dc[_0x8356('0x1f')];var _0xdca375;if(_0x133fff>=_0x3b1303){_0x133fff=_0x3b1303;_0xdca375=0xc8;}else{_0xdca375=0xce;}_0x26f43c[_0x8356('0x1b')](_0xdca375);return _0x26f43c[_0x8356('0x20')]('Content-Range',_0x567dd0+'-'+_0x133fff+'/'+_0x3b1303)[_0x8356('0x21')](_0x56158e);}return null;};}function patchUpdates(_0x83c0e4){return function(_0x3f1166){try{jsonpatch['apply'](_0x3f1166,_0x83c0e4,!![]);}catch(_0x2d08ba){return BPromise[_0x8356('0x22')](_0x2d08ba);}return _0x3f1166[_0x8356('0x23')]();};}function saveUpdates(_0x15ffb5,_0x8d5e59){return function(_0x45b70f){if(_0x45b70f){return _0x45b70f['update'](_0x15ffb5)[_0x8356('0x24')](function(_0x398c0e){return _0x398c0e;});}return null;};}function removeEntity(_0x12f041,_0x323335){return function(_0x4fd21f){if(_0x4fd21f){return _0x4fd21f['destroy']()[_0x8356('0x24')](function(){_0x12f041['status'](0xcc)[_0x8356('0x25')]();});}};}function handleEntityNotFound(_0x3c8eb0,_0x3eae8e){return function(_0x26d5ff){if(!_0x26d5ff){_0x3c8eb0[_0x8356('0x1a')](0x194);}return _0x26d5ff;};}function handleError(_0x1f3572,_0x59cb20){_0x59cb20=_0x59cb20||0x1f4;return function(_0x13d06a){logger[_0x8356('0x26')](_0x13d06a['stack']);if(_0x13d06a['name']){delete _0x13d06a[_0x8356('0x27')];}_0x1f3572[_0x8356('0x1b')](_0x59cb20)[_0x8356('0x28')](_0x13d06a);};}exports[_0x8356('0x29')]=function(_0x54fbe5,_0x232cb8){var _0x20fc75={},_0x11dd2b={},_0x458b35={'count':0x0,'rows':[]};var _0x1f996c=_[_0x8356('0x2a')](db[_0x8356('0x2b')]['rawAttributes'],function(_0x231c20){return{'name':_0x231c20[_0x8356('0x2c')],'type':_0x231c20[_0x8356('0x2d')][_0x8356('0x2e')]};});_0x11dd2b[_0x8356('0x2f')]=_['map'](_0x1f996c,_0x8356('0x27'));_0x11dd2b[_0x8356('0x30')]=_['keys'](_0x54fbe5['query']);_0x11dd2b[_0x8356('0x31')]=_[_0x8356('0x32')](_0x11dd2b[_0x8356('0x2f')],_0x11dd2b[_0x8356('0x30')]);_0x20fc75['attributes']=_[_0x8356('0x32')](_0x11dd2b['model'],qs[_0x8356('0x33')](_0x54fbe5[_0x8356('0x30')]['fields']));_0x20fc75['attributes']=_0x20fc75[_0x8356('0x34')][_0x8356('0x35')]?_0x20fc75[_0x8356('0x34')]:_0x11dd2b[_0x8356('0x2f')];if(!_0x54fbe5[_0x8356('0x30')][_0x8356('0x36')](_0x8356('0x37'))){_0x20fc75[_0x8356('0x1f')]=qs['limit'](_0x54fbe5[_0x8356('0x30')][_0x8356('0x1f')]);_0x20fc75['offset']=qs[_0x8356('0x1c')](_0x54fbe5[_0x8356('0x30')][_0x8356('0x1c')]);}_0x20fc75[_0x8356('0x38')]=qs[_0x8356('0x39')](_0x54fbe5[_0x8356('0x30')][_0x8356('0x39')]);_0x20fc75[_0x8356('0x3a')]=qs[_0x8356('0x31')](_[_0x8356('0x3b')](_0x54fbe5['query'],_0x11dd2b[_0x8356('0x31')]),_0x1f996c);if(_0x54fbe5[_0x8356('0x30')][_0x8356('0x3c')]){_0x20fc75[_0x8356('0x3a')]=_[_0x8356('0x3d')](_0x20fc75['where'],{'$or':_[_0x8356('0x2a')](_0x1f996c,function(_0x2e63fd){if(_0x2e63fd[_0x8356('0x2d')]!=='VIRTUAL'){var _0x8e3152={};_0x8e3152[_0x2e63fd[_0x8356('0x27')]]={'$like':'%'+_0x54fbe5[_0x8356('0x30')][_0x8356('0x3c')]+'%'};return _0x8e3152;}})});}_0x20fc75=_[_0x8356('0x3d')]({},_0x20fc75,_0x54fbe5[_0x8356('0x3e')]);var _0x3fdf8d={'where':_0x20fc75['where']};return db[_0x8356('0x2b')][_0x8356('0x1e')](_0x3fdf8d)[_0x8356('0x24')](function(_0x3a3a1b){_0x458b35[_0x8356('0x1e')]=_0x3a3a1b;if(_0x54fbe5[_0x8356('0x30')]['includeAll']){_0x20fc75['include']=[{'all':!![]}];}return db[_0x8356('0x2b')][_0x8356('0x3f')](_0x20fc75);})[_0x8356('0x24')](function(_0x17d832){_0x458b35[_0x8356('0x40')]=_0x17d832;return _0x458b35;})[_0x8356('0x24')](respondWithFilteredResult(_0x232cb8,_0x20fc75))[_0x8356('0x41')](handleError(_0x232cb8,null));};exports['show']=function(_0x1e68be,_0x2e517d){var _0x34befc={'raw':![],'where':{'id':_0x1e68be[_0x8356('0x42')]['id']}},_0x41fe3b={};_0x41fe3b['model']=_[_0x8356('0x43')](db[_0x8356('0x2b')][_0x8356('0x44')]);_0x41fe3b[_0x8356('0x30')]=_[_0x8356('0x43')](_0x1e68be['query']);_0x41fe3b[_0x8356('0x31')]=_[_0x8356('0x32')](_0x41fe3b['model'],_0x41fe3b[_0x8356('0x30')]);_0x34befc['attributes']=_[_0x8356('0x32')](_0x41fe3b[_0x8356('0x2f')],qs['fields'](_0x1e68be[_0x8356('0x30')][_0x8356('0x33')]));_0x34befc['attributes']=_0x34befc['attributes'][_0x8356('0x35')]?_0x34befc[_0x8356('0x34')]:_0x41fe3b[_0x8356('0x2f')];if(_0x1e68be[_0x8356('0x30')][_0x8356('0x45')]){_0x34befc[_0x8356('0x46')]=[{'all':!![]}];}_0x34befc=_[_0x8356('0x3d')]({},_0x34befc,_0x1e68be[_0x8356('0x3e')]);return db['UserProfileSection'][_0x8356('0x47')](_0x34befc)['then'](handleEntityNotFound(_0x2e517d,null))[_0x8356('0x24')](respondWithResult(_0x2e517d,null))[_0x8356('0x41')](handleError(_0x2e517d,null));};exports[_0x8356('0x48')]=function(_0x57b974,_0x4335d3){return db[_0x8356('0x2b')][_0x8356('0x48')](_0x57b974[_0x8356('0x49')],{})[_0x8356('0x24')](respondWithResult(_0x4335d3,0xc9))[_0x8356('0x41')](handleError(_0x4335d3,null));};exports[_0x8356('0x4a')]=function(_0x3ae0c1,_0xac77d9){if(_0x3ae0c1[_0x8356('0x49')]['id']){delete _0x3ae0c1[_0x8356('0x49')]['id'];}return db[_0x8356('0x2b')][_0x8356('0x47')]({'where':{'id':_0x3ae0c1[_0x8356('0x42')]['id']}})[_0x8356('0x24')](handleEntityNotFound(_0xac77d9,null))[_0x8356('0x24')](saveUpdates(_0x3ae0c1[_0x8356('0x49')],null))['then'](respondWithResult(_0xac77d9,null))[_0x8356('0x41')](handleError(_0xac77d9,null));};exports[_0x8356('0x4b')]=function(_0x290386,_0x2456b3){return db[_0x8356('0x2b')]['find']({'where':{'id':_0x290386['params']['id']}})[_0x8356('0x24')](handleEntityNotFound(_0x2456b3,null))[_0x8356('0x24')](removeEntity(_0x2456b3,null))[_0x8356('0x41')](handleError(_0x2456b3,null));};exports['describe']=function(_0x6ff483,_0x399273){return db[_0x8356('0x2b')]['describe']()[_0x8356('0x24')](respondWithResult(_0x399273,null))[_0x8356('0x41')](handleError(_0x399273,null));}; \ No newline at end of file +var _0x9ebd=['rawAttributes','fieldName','model','map','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','find','create','update','body','eml-format','rimraf','zip-dir','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','UserProfileSection'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0x9ebd,0x103));var _0xd9eb=function(_0x59a5a7,_0x346721){_0x59a5a7=_0x59a5a7-0x0;var _0xdc1e8a=_0x9ebd[_0x59a5a7];return _0xdc1e8a;};'use strict';var emlformat=require(_0xd9eb('0x0'));var rimraf=require(_0xd9eb('0x1'));var zipdir=require(_0xd9eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd9eb('0x3'));var Mustache=require('mustache');var util=require(_0xd9eb('0x4'));var path=require(_0xd9eb('0x5'));var sox=require(_0xd9eb('0x6'));var csv=require(_0xd9eb('0x7'));var ejs=require(_0xd9eb('0x8'));var fs=require('fs');var fs_extra=require(_0xd9eb('0x9'));var _=require(_0xd9eb('0xa'));var squel=require(_0xd9eb('0xb'));var crypto=require('crypto');var jsforce=require(_0xd9eb('0xc'));var deskjs=require(_0xd9eb('0xd'));var toCsv=require(_0xd9eb('0x7'));var querystring=require(_0xd9eb('0xe'));var Papa=require(_0xd9eb('0xf'));var Redis=require(_0xd9eb('0x10'));var authService=require(_0xd9eb('0x11'));var qs=require(_0xd9eb('0x12'));var as=require(_0xd9eb('0x13'));var hardwareService=require(_0xd9eb('0x14'));var logger=require(_0xd9eb('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd9eb('0x16'));var licenseUtil=require(_0xd9eb('0x17'));var db=require(_0xd9eb('0x18'))['db'];function respondWithStatusCode(_0x2f1408,_0x1c9521){_0x1c9521=_0x1c9521||0xcc;return function(_0x68dda2){if(_0x68dda2){return _0x2f1408[_0xd9eb('0x19')](_0x1c9521);}return _0x2f1408['status'](_0x1c9521)[_0xd9eb('0x1a')]();};}function respondWithResult(_0x2ef72b,_0x104110){_0x104110=_0x104110||0xc8;return function(_0xf7cd90){if(_0xf7cd90){return _0x2ef72b[_0xd9eb('0x1b')](_0x104110)[_0xd9eb('0x1c')](_0xf7cd90);}};}function respondWithFilteredResult(_0x41806e,_0x3aa30f){return function(_0xe1a97){if(_0xe1a97){var _0x4ff15a=typeof _0x3aa30f[_0xd9eb('0x1d')]===_0xd9eb('0x1e')&&typeof _0x3aa30f[_0xd9eb('0x1f')]===_0xd9eb('0x1e');var _0xb6acd6=_0xe1a97[_0xd9eb('0x20')];var _0x4af608=_0x4ff15a?0x0:_0x3aa30f[_0xd9eb('0x1d')];var _0x2ff5cd=_0x4ff15a?_0xe1a97[_0xd9eb('0x20')]:_0x3aa30f['offset']+_0x3aa30f[_0xd9eb('0x1f')];var _0x2bd0b6;if(_0x2ff5cd>=_0xb6acd6){_0x2ff5cd=_0xb6acd6;_0x2bd0b6=0xc8;}else{_0x2bd0b6=0xce;}_0x41806e[_0xd9eb('0x1b')](_0x2bd0b6);return _0x41806e[_0xd9eb('0x21')](_0xd9eb('0x22'),_0x4af608+'-'+_0x2ff5cd+'/'+_0xb6acd6)[_0xd9eb('0x1c')](_0xe1a97);}return null;};}function patchUpdates(_0x535ab4){return function(_0x41d7ad){try{jsonpatch[_0xd9eb('0x23')](_0x41d7ad,_0x535ab4,!![]);}catch(_0x830a46){return BPromise[_0xd9eb('0x24')](_0x830a46);}return _0x41d7ad[_0xd9eb('0x25')]();};}function saveUpdates(_0x3b4144,_0x1f2aaf){return function(_0x31310b){if(_0x31310b){return _0x31310b['update'](_0x3b4144)[_0xd9eb('0x26')](function(_0x49df80){return _0x49df80;});}return null;};}function removeEntity(_0x408514,_0x575407){return function(_0x48fe8d){if(_0x48fe8d){return _0x48fe8d[_0xd9eb('0x27')]()['then'](function(){_0x408514['status'](0xcc)[_0xd9eb('0x1a')]();});}};}function handleEntityNotFound(_0x3c3c92,_0x50216f){return function(_0x43154e){if(!_0x43154e){_0x3c3c92['sendStatus'](0x194);}return _0x43154e;};}function handleError(_0x3e9659,_0x139b05){_0x139b05=_0x139b05||0x1f4;return function(_0x277ced){logger['error'](_0x277ced[_0xd9eb('0x28')]);if(_0x277ced['name']){delete _0x277ced[_0xd9eb('0x29')];}_0x3e9659[_0xd9eb('0x1b')](_0x139b05)[_0xd9eb('0x2a')](_0x277ced);};}exports[_0xd9eb('0x2b')]=function(_0x216436,_0x4baeae){var _0x2172e7={},_0x39a4f5={},_0x4a1768={'count':0x0,'rows':[]};var _0x5135e2=_['map'](db[_0xd9eb('0x2c')][_0xd9eb('0x2d')],function(_0x4eb113){return{'name':_0x4eb113[_0xd9eb('0x2e')],'type':_0x4eb113['type']['key']};});_0x39a4f5[_0xd9eb('0x2f')]=_[_0xd9eb('0x30')](_0x5135e2,'name');_0x39a4f5[_0xd9eb('0x31')]=_[_0xd9eb('0x32')](_0x216436[_0xd9eb('0x31')]);_0x39a4f5[_0xd9eb('0x33')]=_['intersection'](_0x39a4f5['model'],_0x39a4f5[_0xd9eb('0x31')]);_0x2172e7['attributes']=_['intersection'](_0x39a4f5[_0xd9eb('0x2f')],qs['fields'](_0x216436[_0xd9eb('0x31')][_0xd9eb('0x34')]));_0x2172e7[_0xd9eb('0x35')]=_0x2172e7[_0xd9eb('0x35')]['length']?_0x2172e7[_0xd9eb('0x35')]:_0x39a4f5[_0xd9eb('0x2f')];if(!_0x216436[_0xd9eb('0x31')]['hasOwnProperty'](_0xd9eb('0x36'))){_0x2172e7[_0xd9eb('0x1f')]=qs['limit'](_0x216436['query']['limit']);_0x2172e7['offset']=qs[_0xd9eb('0x1d')](_0x216436[_0xd9eb('0x31')][_0xd9eb('0x1d')]);}_0x2172e7[_0xd9eb('0x37')]=qs[_0xd9eb('0x38')](_0x216436[_0xd9eb('0x31')]['sort']);_0x2172e7[_0xd9eb('0x39')]=qs['filters'](_[_0xd9eb('0x3a')](_0x216436[_0xd9eb('0x31')],_0x39a4f5[_0xd9eb('0x33')]),_0x5135e2);if(_0x216436[_0xd9eb('0x31')]['filter']){_0x2172e7['where']=_[_0xd9eb('0x3b')](_0x2172e7[_0xd9eb('0x39')],{'$or':_['map'](_0x5135e2,function(_0x37aa41){if(_0x37aa41[_0xd9eb('0x3c')]!==_0xd9eb('0x3d')){var _0x2fc63d={};_0x2fc63d[_0x37aa41['name']]={'$like':'%'+_0x216436['query']['filter']+'%'};return _0x2fc63d;}})});}_0x2172e7=_['merge']({},_0x2172e7,_0x216436[_0xd9eb('0x3e')]);var _0x4f363d={'where':_0x2172e7[_0xd9eb('0x39')]};return db[_0xd9eb('0x2c')][_0xd9eb('0x20')](_0x4f363d)[_0xd9eb('0x26')](function(_0x3b62bc){_0x4a1768[_0xd9eb('0x20')]=_0x3b62bc;if(_0x216436[_0xd9eb('0x31')][_0xd9eb('0x3f')]){_0x2172e7[_0xd9eb('0x40')]=[{'all':!![]}];}return db[_0xd9eb('0x2c')][_0xd9eb('0x41')](_0x2172e7);})['then'](function(_0x24d804){_0x4a1768[_0xd9eb('0x42')]=_0x24d804;return _0x4a1768;})['then'](respondWithFilteredResult(_0x4baeae,_0x2172e7))[_0xd9eb('0x43')](handleError(_0x4baeae,null));};exports[_0xd9eb('0x44')]=function(_0x13324a,_0x4addd6){var _0x4da03b={'raw':![],'where':{'id':_0x13324a[_0xd9eb('0x45')]['id']}},_0x597b39={};_0x597b39['model']=_[_0xd9eb('0x32')](db[_0xd9eb('0x2c')][_0xd9eb('0x2d')]);_0x597b39[_0xd9eb('0x31')]=_[_0xd9eb('0x32')](_0x13324a[_0xd9eb('0x31')]);_0x597b39[_0xd9eb('0x33')]=_[_0xd9eb('0x46')](_0x597b39[_0xd9eb('0x2f')],_0x597b39[_0xd9eb('0x31')]);_0x4da03b['attributes']=_['intersection'](_0x597b39['model'],qs[_0xd9eb('0x34')](_0x13324a[_0xd9eb('0x31')]['fields']));_0x4da03b[_0xd9eb('0x35')]=_0x4da03b[_0xd9eb('0x35')][_0xd9eb('0x47')]?_0x4da03b['attributes']:_0x597b39[_0xd9eb('0x2f')];if(_0x13324a[_0xd9eb('0x31')][_0xd9eb('0x3f')]){_0x4da03b[_0xd9eb('0x40')]=[{'all':!![]}];}_0x4da03b=_[_0xd9eb('0x3b')]({},_0x4da03b,_0x13324a[_0xd9eb('0x3e')]);return db['UserProfileSection'][_0xd9eb('0x48')](_0x4da03b)['then'](handleEntityNotFound(_0x4addd6,null))[_0xd9eb('0x26')](respondWithResult(_0x4addd6,null))[_0xd9eb('0x43')](handleError(_0x4addd6,null));};exports[_0xd9eb('0x49')]=function(_0x459005,_0x3c16ed){return db[_0xd9eb('0x2c')][_0xd9eb('0x49')](_0x459005['body'],{})['then'](respondWithResult(_0x3c16ed,0xc9))[_0xd9eb('0x43')](handleError(_0x3c16ed,null));};exports[_0xd9eb('0x4a')]=function(_0xa78799,_0x412ffa){if(_0xa78799[_0xd9eb('0x4b')]['id']){delete _0xa78799['body']['id'];}return db[_0xd9eb('0x2c')]['find']({'where':{'id':_0xa78799[_0xd9eb('0x45')]['id']}})[_0xd9eb('0x26')](handleEntityNotFound(_0x412ffa,null))[_0xd9eb('0x26')](saveUpdates(_0xa78799['body'],null))[_0xd9eb('0x26')](respondWithResult(_0x412ffa,null))['catch'](handleError(_0x412ffa,null));};exports[_0xd9eb('0x27')]=function(_0x585c52,_0x515ff2){return db[_0xd9eb('0x2c')][_0xd9eb('0x48')]({'where':{'id':_0x585c52[_0xd9eb('0x45')]['id']}})[_0xd9eb('0x26')](handleEntityNotFound(_0x515ff2,null))['then'](removeEntity(_0x515ff2,null))['catch'](handleError(_0x515ff2,null));};exports['describe']=function(_0x4bfa46,_0x2ae928){return db['UserProfileSection']['describe']()['then'](respondWithResult(_0x2ae928,null))[_0xd9eb('0x43')](handleError(_0x2ae928,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index dbb5dd8..4b8e331 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 _0x4970=['define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0x57a33f,_0x1206ea){var _0x372feb=function(_0x206806){while(--_0x206806){_0x57a33f['push'](_0x57a33f['shift']());}};_0x372feb(++_0x1206ea);}(_0x4970,0xbb));var _0x0497=function(_0x52453b,_0x8b259b){_0x52453b=_0x52453b-0x0;var _0xa97239=_0x4970[_0x52453b];return _0xa97239;};'use strict';var _=require('lodash');var util=require(_0x0497('0x0'));var logger=require(_0x0497('0x1'))(_0x0497('0x2'));var moment=require(_0x0497('0x3'));var BPromise=require(_0x0497('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0497('0x5'));var config=require(_0x0497('0x6'));var attributes=require(_0x0497('0x7'));module['exports']=function(_0x207a36,_0xe7a720){return _0x207a36[_0x0497('0x8')](_0x0497('0x9'),attributes,{'tableName':_0x0497('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x0497('0xb'),_0x0497('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3eed=['./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5c9074,_0x343d8b){var _0x48276e=function(_0x38416d){while(--_0x38416d){_0x5c9074['push'](_0x5c9074['shift']());}};_0x48276e(++_0x343d8b);}(_0x3eed,0x18c));var _0xd3ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3eed[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd3ee('0x0'));var util=require(_0xd3ee('0x1'));var logger=require(_0xd3ee('0x2'))('api');var moment=require(_0xd3ee('0x3'));var BPromise=require(_0xd3ee('0x4'));var rp=require(_0xd3ee('0x5'));var fs=require('fs');var path=require(_0xd3ee('0x6'));var rimraf=require(_0xd3ee('0x7'));var config=require(_0xd3ee('0x8'));var attributes=require(_0xd3ee('0x9'));module[_0xd3ee('0xa')]=function(_0x5caf2c,_0x55b702){return _0x5caf2c[_0xd3ee('0xb')](_0xd3ee('0xc'),attributes,{'tableName':_0xd3ee('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xd3ee('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index dd7af45..84213c8 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 _0x5ecf=['request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2f2606,_0x2bf0ed){var _0x561d6c=function(_0x41a5cd){while(--_0x41a5cd){_0x2f2606['push'](_0x2f2606['shift']());}};_0x561d6c(++_0x2bf0ed);}(_0x5ecf,0x1c3));var _0xf5ec=function(_0x52fb8f,_0x10e2fe){_0x52fb8f=_0x52fb8f-0x0;var _0x5ce7a4=_0x5ecf[_0x52fb8f];return _0x5ce7a4;};'use strict';var _=require(_0xf5ec('0x0'));var util=require(_0xf5ec('0x1'));var moment=require(_0xf5ec('0x2'));var BPromise=require(_0xf5ec('0x3'));var rs=require(_0xf5ec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf5ec('0x5'));var logger=require(_0xf5ec('0x6'))(_0xf5ec('0x7'));var config=require(_0xf5ec('0x8'));var jayson=require(_0xf5ec('0x9'));var client=jayson['client'][_0xf5ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb7fd98,_0x2551c0,_0x14d70a){return new BPromise(function(_0x23be45,_0xd93492){return client[_0xf5ec('0xb')](_0xb7fd98,_0x14d70a)[_0xf5ec('0xc')](function(_0x27b866){logger[_0xf5ec('0xd')](_0xf5ec('0xe'),_0x2551c0,_0xf5ec('0xf'));logger[_0xf5ec('0x10')](_0xf5ec('0x11'),_0x2551c0,_0xf5ec('0xf'),JSON[_0xf5ec('0x12')](_0x27b866));if(_0x27b866['error']){if(_0x27b866[_0xf5ec('0x13')]['code']===0x1f4){logger[_0xf5ec('0x13')](_0xf5ec('0xe'),_0x2551c0,_0x27b866[_0xf5ec('0x13')]['message']);return _0xd93492(_0x27b866[_0xf5ec('0x13')]['message']);}logger[_0xf5ec('0x13')](_0xf5ec('0xe'),_0x2551c0,_0x27b866[_0xf5ec('0x13')][_0xf5ec('0x14')]);return _0x23be45(_0x27b866[_0xf5ec('0x13')][_0xf5ec('0x14')]);}else{logger[_0xf5ec('0xd')](_0xf5ec('0xe'),_0x2551c0,_0xf5ec('0xf'));_0x23be45(_0x27b866[_0xf5ec('0x15')][_0xf5ec('0x14')]);}})['catch'](function(_0x43561a){logger[_0xf5ec('0x13')](_0xf5ec('0xe'),_0x2551c0,_0x43561a);_0xd93492(_0x43561a);});});} \ No newline at end of file +var _0x0ecc=['error','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0x0ecc,0x17d));var _0xc0ec=function(_0x58c595,_0x3f2d81){_0x58c595=_0x58c595-0x0;var _0x2438fe=_0x0ecc[_0x58c595];return _0x2438fe;};'use strict';var _=require('lodash');var util=require(_0xc0ec('0x0'));var moment=require('moment');var BPromise=require(_0xc0ec('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0ec('0x2'));var db=require(_0xc0ec('0x3'))['db'];var utils=require(_0xc0ec('0x4'));var logger=require(_0xc0ec('0x5'))(_0xc0ec('0x6'));var config=require(_0xc0ec('0x7'));var jayson=require(_0xc0ec('0x8'));var client=jayson[_0xc0ec('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42c90c,_0x4f8288,_0x1334d0){return new BPromise(function(_0x31edcb,_0x1afa3c){return client[_0xc0ec('0xa')](_0x42c90c,_0x1334d0)[_0xc0ec('0xb')](function(_0x2ed5da){logger[_0xc0ec('0xc')](_0xc0ec('0xd'),_0x4f8288,_0xc0ec('0xe'));logger[_0xc0ec('0xf')](_0xc0ec('0x10'),_0x4f8288,_0xc0ec('0xe'),JSON[_0xc0ec('0x11')](_0x2ed5da));if(_0x2ed5da['error']){if(_0x2ed5da[_0xc0ec('0x12')]['code']===0x1f4){logger[_0xc0ec('0x12')](_0xc0ec('0xd'),_0x4f8288,_0x2ed5da[_0xc0ec('0x12')][_0xc0ec('0x13')]);return _0x1afa3c(_0x2ed5da['error'][_0xc0ec('0x13')]);}logger['error'](_0xc0ec('0xd'),_0x4f8288,_0x2ed5da[_0xc0ec('0x12')][_0xc0ec('0x13')]);return _0x31edcb(_0x2ed5da[_0xc0ec('0x12')][_0xc0ec('0x13')]);}else{logger[_0xc0ec('0xc')](_0xc0ec('0xd'),_0x4f8288,_0xc0ec('0xe'));_0x31edcb(_0x2ed5da['result'][_0xc0ec('0x13')]);}})[_0xc0ec('0x14')](function(_0x5f2c41){logger[_0xc0ec('0x12')](_0xc0ec('0xd'),_0x4f8288,_0x5f2c41);_0x1afa3c(_0x5f2c41);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 8683ed7..d1287cd 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(_0xc731bb,_0x5891d4){var _0xfe197d=function(_0x2cd6a7){while(--_0x2cd6a7){_0xc731bb['push'](_0xc731bb['shift']());}};_0xfe197d(++_0x5891d4);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1e5a59,_0x22d345){var _0x4ca834=function(_0x2b2968){while(--_0x2b2968){_0x1e5a59['push'](_0x1e5a59['shift']());}};_0x4ca834(++_0x22d345);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 46c2178..092dcfe 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 _0x02d8=['INTEGER','sequelize','exports'];(function(_0x3eb94a,_0x27d309){var _0x54b919=function(_0x201230){while(--_0x201230){_0x3eb94a['push'](_0x3eb94a['shift']());}};_0x54b919(++_0x27d309);}(_0x02d8,0x1e4));var _0x802d=function(_0x12e3d2,_0x77a0e0){_0x12e3d2=_0x12e3d2-0x0;var _0x2e632c=_0x02d8[_0x12e3d2];return _0x2e632c;};'use strict';var Sequelize=require(_0x802d('0x0'));module[_0x802d('0x1')]={'penalty':{'type':Sequelize[_0x802d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4b64=['exports','INTEGER'];(function(_0x379b26,_0x47a99b){var _0x31d013=function(_0x3ca55e){while(--_0x3ca55e){_0x379b26['push'](_0x379b26['shift']());}};_0x31d013(++_0x47a99b);}(_0x4b64,0x18a));var _0x44b6=function(_0x50e67a,_0x1784b8){_0x50e67a=_0x50e67a-0x0;var _0x34ff8d=_0x4b64[_0x50e67a];return _0x34ff8d;};'use strict';var Sequelize=require('sequelize');module[_0x44b6('0x0')]={'penalty':{'type':Sequelize[_0x44b6('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index bb06eb9..ca82744 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 _0xcaf2=['rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xcaf2,0x8a));var _0x2caf=function(_0x2e8b77,_0x5d473c){_0x2e8b77=_0x2e8b77-0x0;var _0xe01d2b=_0xcaf2[_0x2e8b77];return _0xe01d2b;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var logger=require(_0x2caf('0x1'))(_0x2caf('0x2'));var moment=require('moment');var BPromise=require(_0x2caf('0x3'));var rp=require(_0x2caf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2caf('0x5'));var config=require('../../config/environment');var attributes=require(_0x2caf('0x6'));module[_0x2caf('0x7')]=function(_0x249a4b,_0x599ce7){return _0x249a4b[_0x2caf('0x8')](_0x2caf('0x9'),attributes,{'tableName':_0x2caf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a6d=['util','api','moment','bluebird','request-promise','path','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x3a6d,0x143));var _0xd3a6=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3a6d[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var logger=require('../../config/logger')(_0xd3a6('0x2'));var moment=require(_0xd3a6('0x3'));var BPromise=require(_0xd3a6('0x4'));var rp=require(_0xd3a6('0x5'));var fs=require('fs');var path=require(_0xd3a6('0x6'));var rimraf=require('rimraf');var config=require(_0xd3a6('0x7'));var attributes=require(_0xd3a6('0x8'));module[_0xd3a6('0x9')]=function(_0x1fc450,_0x25b042){return _0x1fc450[_0xd3a6('0xa')]('UserSmsQueue',attributes,{'tableName':_0xd3a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index d107870..c289da4 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 _0x8bfe=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0x8bfe,0xa8));var _0xe8bf=function(_0x5ba549,_0x425afd){_0x5ba549=_0x5ba549-0x0;var _0x36e3a1=_0x8bfe[_0x5ba549];return _0x36e3a1;};'use strict';var _=require(_0xe8bf('0x0'));var util=require(_0xe8bf('0x1'));var moment=require(_0xe8bf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe8bf('0x3'));var logger=require(_0xe8bf('0x4'))(_0xe8bf('0x5'));var config=require(_0xe8bf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe8bf('0x7')][_0xe8bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25d890,_0x4e78df,_0x1c33f2){return new BPromise(function(_0x2b6abc,_0x4e258f){return client[_0xe8bf('0x9')](_0x25d890,_0x1c33f2)[_0xe8bf('0xa')](function(_0x5c9704){logger[_0xe8bf('0xb')](_0xe8bf('0xc'),_0x4e78df,_0xe8bf('0xd'));logger[_0xe8bf('0xe')](_0xe8bf('0xf'),_0x4e78df,'request\x20sent',JSON[_0xe8bf('0x10')](_0x5c9704));if(_0x5c9704[_0xe8bf('0x11')]){if(_0x5c9704[_0xe8bf('0x11')]['code']===0x1f4){logger[_0xe8bf('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x4e78df,_0x5c9704['error'][_0xe8bf('0x12')]);return _0x4e258f(_0x5c9704[_0xe8bf('0x11')]['message']);}logger[_0xe8bf('0x11')](_0xe8bf('0xc'),_0x4e78df,_0x5c9704[_0xe8bf('0x11')][_0xe8bf('0x12')]);return _0x2b6abc(_0x5c9704[_0xe8bf('0x11')][_0xe8bf('0x12')]);}else{logger[_0xe8bf('0xb')](_0xe8bf('0xc'),_0x4e78df,'request\x20sent');_0x2b6abc(_0x5c9704['result'][_0xe8bf('0x12')]);}})['catch'](function(_0x147d75){logger[_0xe8bf('0x11')](_0xe8bf('0xc'),_0x4e78df,_0x147d75);_0x4e258f(_0x147d75);});});} \ No newline at end of file +var _0xf53f=['rpc','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x208d39,_0x5de94f){var _0x3f96cb=function(_0x23d510){while(--_0x23d510){_0x208d39['push'](_0x208d39['shift']());}};_0x3f96cb(++_0x5de94f);}(_0xf53f,0x175));var _0xff53=function(_0x38d425,_0x535e23){_0x38d425=_0x38d425-0x0;var _0x2cca8d=_0xf53f[_0x38d425];return _0x2cca8d;};'use strict';var _=require('lodash');var util=require(_0xff53('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff53('0x1'));var db=require(_0xff53('0x2'))['db'];var utils=require(_0xff53('0x3'));var logger=require(_0xff53('0x4'))(_0xff53('0x5'));var config=require('../../config/environment');var jayson=require(_0xff53('0x6'));var client=jayson[_0xff53('0x7')][_0xff53('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a1608,_0x47cf3c,_0x14b4db){return new BPromise(function(_0x3adf89,_0x238c90){return client[_0xff53('0x9')](_0x3a1608,_0x14b4db)[_0xff53('0xa')](function(_0x498a1f){logger['info'](_0xff53('0xb'),_0x47cf3c,_0xff53('0xc'));logger['debug'](_0xff53('0xd'),_0x47cf3c,_0xff53('0xc'),JSON[_0xff53('0xe')](_0x498a1f));if(_0x498a1f[_0xff53('0xf')]){if(_0x498a1f[_0xff53('0xf')]['code']===0x1f4){logger[_0xff53('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x47cf3c,_0x498a1f[_0xff53('0xf')][_0xff53('0x10')]);return _0x238c90(_0x498a1f[_0xff53('0xf')][_0xff53('0x10')]);}logger[_0xff53('0xf')](_0xff53('0xb'),_0x47cf3c,_0x498a1f[_0xff53('0xf')][_0xff53('0x10')]);return _0x3adf89(_0x498a1f[_0xff53('0xf')][_0xff53('0x10')]);}else{logger['info'](_0xff53('0xb'),_0x47cf3c,'request\x20sent');_0x3adf89(_0x498a1f[_0xff53('0x11')]['message']);}})['catch'](function(_0x24bd62){logger[_0xff53('0xf')](_0xff53('0xb'),_0x47cf3c,_0x24bd62);_0x238c90(_0x24bd62);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index d62038d..b3c6283 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 _0x4f39=['sequelize','INTEGER'];(function(_0xe7164f,_0x4ca7a5){var _0x4d234f=function(_0x2d6e55){while(--_0x2d6e55){_0xe7164f['push'](_0xe7164f['shift']());}};_0x4d234f(++_0x4ca7a5);}(_0x4f39,0x15e));var _0x94f3=function(_0x298c93,_0x58a871){_0x298c93=_0x298c93-0x0;var _0x338c6b=_0x4f39[_0x298c93];return _0x338c6b;};'use strict';var Sequelize=require(_0x94f3('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x94f3('0x1')]}}; \ No newline at end of file +var _0x51d7=['sequelize','INTEGER'];(function(_0x109970,_0x530000){var _0x44558e=function(_0x19dae0){while(--_0x19dae0){_0x109970['push'](_0x109970['shift']());}};_0x44558e(++_0x530000);}(_0x51d7,0x192));var _0x751d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x51d7[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x751d('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x751d('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x751d('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index f50f5de..bfab33d 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(_0x3bfe22,_0x57f5dc){var _0x2272af=function(_0x500420){while(--_0x500420){_0x3bfe22['push'](_0x3bfe22['shift']());}};_0x2272af(++_0x57f5dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x126ed2,_0x1721df){var _0xdab418=function(_0x4268a4){while(--_0x4268a4){_0x126ed2['push'](_0x126ed2['shift']());}};_0xdab418(++_0x1721df);}(_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 cb8307a..9952f78 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5374eb,_0x4e5e18){var _0x406a25=function(_0x3dfa42){while(--_0x3dfa42){_0x5374eb['push'](_0x5374eb['shift']());}};_0x406a25(++_0x4e5e18);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5609d9,_0x1ddb0e){var _0x287b84=function(_0x39c3d4){while(--_0x39c3d4){_0x5609d9['push'](_0x5609d9['shift']());}};_0x287b84(++_0x1ddb0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 1e15deb..ee466bd 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 _0x5384=['INTEGER','sequelize'];(function(_0xae3668,_0x2f667d){var _0x429625=function(_0xd050db){while(--_0xd050db){_0xae3668['push'](_0xae3668['shift']());}};_0x429625(++_0x2f667d);}(_0x5384,0x159));var _0x4538=function(_0x33cfca,_0x3058d1){_0x33cfca=_0x33cfca-0x0;var _0x68d722=_0x5384[_0x33cfca];return _0x68d722;};'use strict';var Sequelize=require(_0x4538('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4538('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4a87=['INTEGER','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4a87,0x165));var _0x74a8=function(_0x4a9a50,_0x5568f6){_0x4a9a50=_0x4a9a50-0x0;var _0x182e4b=_0x4a87[_0x4a9a50];return _0x182e4b;};'use strict';var Sequelize=require('sequelize');module[_0x74a8('0x0')]={'penalty':{'type':Sequelize[_0x74a8('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 3eb0461..0e908b3 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 _0xe3fc=['moment','bluebird','request-promise','path','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util','api'];(function(_0x3ac064,_0x278b44){var _0x57a926=function(_0x5349cf){while(--_0x5349cf){_0x3ac064['push'](_0x3ac064['shift']());}};_0x57a926(++_0x278b44);}(_0xe3fc,0x168));var _0xce3f=function(_0x1a89ca,_0x27394b){_0x1a89ca=_0x1a89ca-0x0;var _0x29cbb2=_0xe3fc[_0x1a89ca];return _0x29cbb2;};'use strict';var _=require(_0xce3f('0x0'));var util=require(_0xce3f('0x1'));var logger=require('../../config/logger')(_0xce3f('0x2'));var moment=require(_0xce3f('0x3'));var BPromise=require(_0xce3f('0x4'));var rp=require(_0xce3f('0x5'));var fs=require('fs');var path=require(_0xce3f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xce3f('0x7'));module[_0xce3f('0x8')]=function(_0xa8fc3f,_0x234089){return _0xa8fc3f[_0xce3f('0x9')]('UserVoiceQueue',attributes,{'tableName':_0xce3f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef35=['request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','util','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef35,0x146));var _0x5ef3=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0xef35[_0xfcbcb8];return _0x1b1f97;};'use strict';var _=require('lodash');var util=require(_0x5ef3('0x0'));var logger=require('../../config/logger')(_0x5ef3('0x1'));var moment=require(_0x5ef3('0x2'));var BPromise=require(_0x5ef3('0x3'));var rp=require(_0x5ef3('0x4'));var fs=require('fs');var path=require(_0x5ef3('0x5'));var rimraf=require(_0x5ef3('0x6'));var config=require(_0x5ef3('0x7'));var attributes=require(_0x5ef3('0x8'));module[_0x5ef3('0x9')]=function(_0x361828,_0x2f32a2){return _0x361828['define'](_0x5ef3('0xa'),attributes,{'tableName':'user_has_voice_queues','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 f0fc155..9bc62f0 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 _0x4010=['result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0xc264d4,_0x1e0005){var _0x2c8a94=function(_0x514a52){while(--_0x514a52){_0xc264d4['push'](_0xc264d4['shift']());}};_0x2c8a94(++_0x1e0005);}(_0x4010,0x157));var _0x0401=function(_0x57e4e1,_0x2f75da){_0x57e4e1=_0x57e4e1-0x0;var _0x2b1dce=_0x4010[_0x57e4e1];return _0x2b1dce;};'use strict';var _=require('lodash');var util=require(_0x0401('0x0'));var moment=require(_0x0401('0x1'));var BPromise=require(_0x0401('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0401('0x3'));var db=require(_0x0401('0x4'))['db'];var utils=require(_0x0401('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0401('0x6'));var jayson=require(_0x0401('0x7'));var client=jayson['client'][_0x0401('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e32e1,_0x5ca046,_0x375e37){return new BPromise(function(_0x390e89,_0x580d75){return client['request'](_0x5e32e1,_0x375e37)['then'](function(_0x196672){logger[_0x0401('0x9')](_0x0401('0xa'),_0x5ca046,_0x0401('0xb'));logger[_0x0401('0xc')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5ca046,_0x0401('0xb'),JSON[_0x0401('0xd')](_0x196672));if(_0x196672[_0x0401('0xe')]){if(_0x196672[_0x0401('0xe')][_0x0401('0xf')]===0x1f4){logger['error'](_0x0401('0xa'),_0x5ca046,_0x196672[_0x0401('0xe')][_0x0401('0x10')]);return _0x580d75(_0x196672[_0x0401('0xe')][_0x0401('0x10')]);}logger[_0x0401('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x5ca046,_0x196672[_0x0401('0xe')][_0x0401('0x10')]);return _0x390e89(_0x196672['error'][_0x0401('0x10')]);}else{logger[_0x0401('0x9')]('UserVoiceQueue,\x20%s,\x20%s',_0x5ca046,_0x0401('0xb'));_0x390e89(_0x196672[_0x0401('0x11')][_0x0401('0x10')]);}})['catch'](function(_0x3c5580){logger[_0x0401('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x5ca046,_0x3c5580);_0x580d75(_0x3c5580);});});} \ No newline at end of file +var _0x6dca=['request','UserVoiceQueue,\x20%s,\x20%s','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','client','http'];(function(_0x517d20,_0x4238d9){var _0x312482=function(_0x209252){while(--_0x209252){_0x517d20['push'](_0x517d20['shift']());}};_0x312482(++_0x4238d9);}(_0x6dca,0x1d4));var _0xa6dc=function(_0x5c370e,_0x4566e0){_0x5c370e=_0x5c370e-0x0;var _0x4c7b11=_0x6dca[_0x5c370e];return _0x4c7b11;};'use strict';var _=require('lodash');var util=require(_0xa6dc('0x0'));var moment=require(_0xa6dc('0x1'));var BPromise=require('bluebird');var rs=require(_0xa6dc('0x2'));var fs=require('fs');var Redis=require(_0xa6dc('0x3'));var db=require(_0xa6dc('0x4'))['db'];var utils=require(_0xa6dc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa6dc('0x6')][_0xa6dc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4d17d7,_0x587175,_0x3e5b80){return new BPromise(function(_0x10e9cb,_0x5d01f3){return client[_0xa6dc('0x8')](_0x4d17d7,_0x3e5b80)['then'](function(_0x2a258f){logger['info'](_0xa6dc('0x9'),_0x587175,'request\x20sent');logger['debug'](_0xa6dc('0xa'),_0x587175,'request\x20sent',JSON['stringify'](_0x2a258f));if(_0x2a258f[_0xa6dc('0xb')]){if(_0x2a258f['error'][_0xa6dc('0xc')]===0x1f4){logger[_0xa6dc('0xb')](_0xa6dc('0x9'),_0x587175,_0x2a258f['error'][_0xa6dc('0xd')]);return _0x5d01f3(_0x2a258f[_0xa6dc('0xb')]['message']);}logger[_0xa6dc('0xb')](_0xa6dc('0x9'),_0x587175,_0x2a258f['error'][_0xa6dc('0xd')]);return _0x10e9cb(_0x2a258f[_0xa6dc('0xb')][_0xa6dc('0xd')]);}else{logger[_0xa6dc('0xe')](_0xa6dc('0x9'),_0x587175,'request\x20sent');_0x10e9cb(_0x2a258f[_0xa6dc('0xf')][_0xa6dc('0xd')]);}})[_0xa6dc('0x10')](function(_0x412f64){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x587175,_0x412f64);_0x5d01f3(_0x412f64);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 668549b..dae8122 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x31bad1,_0x163160){var _0x30c64e=function(_0x1c0df5){while(--_0x1c0df5){_0x31bad1['push'](_0x31bad1['shift']());}};_0x30c64e(++_0x163160);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x2f1625,_0x2ca198){var _0x5b5b01=function(_0x5b5c80){while(--_0x5b5c80){_0x2f1625['push'](_0x2f1625['shift']());}};_0x5b5b01(++_0x2ca198);}(_0x70e0,0x17b));var _0x070e=function(_0x20cebb,_0x3a950d){_0x20cebb=_0x20cebb-0x0;var _0x44e08d=_0x70e0[_0x20cebb];return _0x44e08d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index d2d66e8..4f3bdb5 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 _0xe6e2=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x403ade,_0x45455a){var _0x7036f1=function(_0x322441){while(--_0x322441){_0x403ade['push'](_0x403ade['shift']());}};_0x7036f1(++_0x45455a);}(_0xe6e2,0x137));var _0x2e6e=function(_0x1a0959,_0xf043c){_0x1a0959=_0x1a0959-0x0;var _0x21ac5c=_0xe6e2[_0x1a0959];return _0x21ac5c;};'use strict';var Sequelize=require(_0x2e6e('0x0'));module[_0x2e6e('0x1')]={'uniqueid':{'type':Sequelize[_0x2e6e('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2e6e('0x3')},'membername':{'type':Sequelize[_0x2e6e('0x4')],'allowNull':![],'comment':_0x2e6e('0x3')},'UserId':{'type':Sequelize[_0x2e6e('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x2e6e('0x3')},'VoiceQueueId':{'type':Sequelize[_0x2e6e('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x2e6e('0x4')],'allowNull':![],'unique':_0x2e6e('0x5'),'comment':_0x2e6e('0x3')},'penalty':{'type':Sequelize[_0x2e6e('0x2')](0xb),'defaultValue':0x0,'comment':_0x2e6e('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x2e6e('0x3')}}; \ No newline at end of file +var _0xad91=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x52b494,_0x144998){var _0x295940=function(_0x2ee8eb){while(--_0x2ee8eb){_0x52b494['push'](_0x52b494['shift']());}};_0x295940(++_0x144998);}(_0xad91,0xd0));var _0x1ad9=function(_0x17d69e,_0x27717d){_0x17d69e=_0x17d69e-0x0;var _0x4b153f=_0xad91[_0x17d69e];return _0x4b153f;};'use strict';var Sequelize=require(_0x1ad9('0x0'));module[_0x1ad9('0x1')]={'uniqueid':{'type':Sequelize[_0x1ad9('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1ad9('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x1ad9('0x3')},'UserId':{'type':Sequelize[_0x1ad9('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1ad9('0x4')],'allowNull':![],'unique':_0x1ad9('0x5'),'comment':_0x1ad9('0x3')},'VoiceQueueId':{'type':Sequelize[_0x1ad9('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x1ad9('0x4')],'allowNull':![],'unique':_0x1ad9('0x5'),'comment':_0x1ad9('0x3')},'penalty':{'type':Sequelize[_0x1ad9('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 7a6d8da..47cf309 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 _0xccd1=['hook','exports','events','UserVoiceQueueRt','update','remove','emit','hasOwnProperty'];(function(_0x968dc3,_0x5a7b5e){var _0x4f53bc=function(_0x4c38df){while(--_0x4c38df){_0x968dc3['push'](_0x968dc3['shift']());}};_0x4f53bc(++_0x5a7b5e);}(_0xccd1,0x16a));var _0x1ccd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccd1[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x1ccd('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x1ccd('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1ccd('0x2'),'afterDestroy':_0x1ccd('0x3')};function emitEvent(_0x4dd8af){return function(_0x54329c,_0x16e40d,_0x13d830){UserVoiceQueueRtEvents[_0x1ccd('0x4')](_0x4dd8af+':'+_0x54329c['id'],_0x54329c);UserVoiceQueueRtEvents[_0x1ccd('0x4')](_0x4dd8af,_0x54329c);_0x13d830(null);};}for(var e in events){if(events[_0x1ccd('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x1ccd('0x6')](e,emitEvent(event));}}module[_0x1ccd('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x03ea=['UserVoiceQueueRt','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2711ba,_0x28c0ff){var _0x34ed68=function(_0x3f9686){while(--_0x3f9686){_0x2711ba['push'](_0x2711ba['shift']());}};_0x34ed68(++_0x28c0ff);}(_0x03ea,0x182));var _0xa03e=function(_0x54117b,_0x10872c){_0x54117b=_0x54117b-0x0;var _0x15452f=_0x03ea[_0x54117b];return _0x15452f;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xa03e('0x0'))['db'][_0xa03e('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa03e('0x2')](0x0);var events={'afterCreate':_0xa03e('0x3'),'afterUpdate':_0xa03e('0x4'),'afterDestroy':_0xa03e('0x5')};function emitEvent(_0x513160){return function(_0x515fdd,_0x503262,_0x243348){UserVoiceQueueRtEvents['emit'](_0x513160+':'+_0x515fdd['id'],_0x515fdd);UserVoiceQueueRtEvents['emit'](_0x513160,_0x515fdd);_0x243348(null);};}for(var e in events){if(events[_0xa03e('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xa03e('0x7')](e,emitEvent(event));}}module[_0xa03e('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 0698fd2..8999ed2 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 _0xb7fa=['./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3752d2,_0x4ee605){var _0x236452=function(_0x485885){while(--_0x485885){_0x3752d2['push'](_0x3752d2['shift']());}};_0x236452(++_0x4ee605);}(_0xb7fa,0x10b));var _0xab7f=function(_0x383158,_0x415e43){_0x383158=_0x383158-0x0;var _0x507985=_0xb7fa[_0x383158];return _0x507985;};'use strict';var _=require(_0xab7f('0x0'));var util=require(_0xab7f('0x1'));var logger=require(_0xab7f('0x2'))(_0xab7f('0x3'));var moment=require(_0xab7f('0x4'));var BPromise=require(_0xab7f('0x5'));var rp=require(_0xab7f('0x6'));var fs=require('fs');var path=require(_0xab7f('0x7'));var rimraf=require('rimraf');var config=require(_0xab7f('0x8'));var attributes=require(_0xab7f('0x9'));module[_0xab7f('0xa')]=function(_0x347fa8,_0x9e735f){return _0x347fa8['define'](_0xab7f('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6517=['define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','path','rimraf','./userVoiceQueueRt.attributes','exports'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x6517,0x193));var _0x7651=function(_0x4d2169,_0x1861ba){_0x4d2169=_0x4d2169-0x0;var _0x30d3dd=_0x6517[_0x4d2169];return _0x30d3dd;};'use strict';var _=require(_0x7651('0x0'));var util=require(_0x7651('0x1'));var logger=require('../../config/logger')(_0x7651('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7651('0x3'));var rimraf=require(_0x7651('0x4'));var config=require('../../config/environment');var attributes=require(_0x7651('0x5'));module[_0x7651('0x6')]=function(_0x23cca0,_0x2d9954){return _0x23cca0[_0x7651('0x7')](_0x7651('0x8'),attributes,{'tableName':_0x7651('0x9'),'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 bc64ed4..36e7c66 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 _0x59bf=['raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x59bf,0xe5));var _0xf59b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x59bf[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xf59b('0x0'));var util=require(_0xf59b('0x1'));var moment=require(_0xf59b('0x2'));var BPromise=require(_0xf59b('0x3'));var rs=require(_0xf59b('0x4'));var fs=require('fs');var Redis=require(_0xf59b('0x5'));var db=require(_0xf59b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf59b('0x7'));var config=require(_0xf59b('0x8'));var jayson=require(_0xf59b('0x9'));var client=jayson['client'][_0xf59b('0xa')]({'port':0x232a});config[_0xf59b('0xb')]=_['defaults'](config['redis'],{'host':_0xf59b('0xc'),'port':0x18eb});var socket=require(_0xf59b('0xd'))(new Redis(config['redis']));require(_0xf59b('0xe'))['register'](socket);function respondWithRpcPromise(_0x11f95b,_0x1c0cd7,_0x330b4a){return new BPromise(function(_0x3f280d,_0x29136d){return client[_0xf59b('0xf')](_0x11f95b,_0x330b4a)[_0xf59b('0x10')](function(_0x212217){logger[_0xf59b('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1c0cd7,_0xf59b('0x12'));logger[_0xf59b('0x13')](_0xf59b('0x14'),_0x1c0cd7,_0xf59b('0x12'),JSON['stringify'](_0x212217));if(_0x212217['error']){if(_0x212217[_0xf59b('0x15')][_0xf59b('0x16')]===0x1f4){logger[_0xf59b('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1c0cd7,_0x212217[_0xf59b('0x15')]['message']);return _0x29136d(_0x212217[_0xf59b('0x15')][_0xf59b('0x17')]);}logger[_0xf59b('0x15')](_0xf59b('0x18'),_0x1c0cd7,_0x212217['error']['message']);return _0x3f280d(_0x212217[_0xf59b('0x15')][_0xf59b('0x17')]);}else{logger[_0xf59b('0x11')](_0xf59b('0x18'),_0x1c0cd7,_0xf59b('0x12'));_0x3f280d(_0x212217['result'][_0xf59b('0x17')]);}})[_0xf59b('0x19')](function(_0x53e401){logger[_0xf59b('0x15')](_0xf59b('0x18'),_0x1c0cd7,_0x53e401);_0x29136d(_0x53e401);});});}exports[_0xf59b('0x1a')]=function(_0x1769e5){var _0x23f1a1=this;return new Promise(function(_0x35f1cb,_0x52aade){return db[_0xf59b('0x1b')][_0xf59b('0x1c')]({'raw':_0x1769e5['options']?_0x1769e5[_0xf59b('0x1d')][_0xf59b('0x1e')]===undefined?!![]:![]:!![],'where':_0x1769e5[_0xf59b('0x1d')]?_0x1769e5[_0xf59b('0x1d')][_0xf59b('0x1f')]||null:null,'attributes':[[db[_0xf59b('0x20')]['fn'](_0xf59b('0x21'),db[_0xf59b('0x20')]['fn']('IF',db[_0xf59b('0x20')][_0xf59b('0x22')](_0xf59b('0x23')))),'outboundQueuePauses']]})[_0xf59b('0x10')](function(_0x5ec914){logger[_0xf59b('0x11')]('GetVoiceQueueRtPauses',_0x1769e5);logger[_0xf59b('0x13')]('GetVoiceQueueRtPauses',_0x1769e5,JSON[_0xf59b('0x24')](_0x5ec914));_0x35f1cb(_0x5ec914);})[_0xf59b('0x19')](function(_0x40329f){logger['error'](_0xf59b('0x1a'),_0x40329f[_0xf59b('0x17')],_0x1769e5);_0x52aade(_0x23f1a1[_0xf59b('0x15')](0x1f4,_0x40329f[_0xf59b('0x17')]));});});}; \ No newline at end of file +var _0xe419=['COUNT','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','message','UserVoiceQueueRt,\x20%s,\x20%s','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','sequelize'];(function(_0x2b5df7,_0x15d49c){var _0x38f4e8=function(_0x4409f2){while(--_0x4409f2){_0x2b5df7['push'](_0x2b5df7['shift']());}};_0x38f4e8(++_0x15d49c);}(_0xe419,0x97));var _0x9e41=function(_0x5d8803,_0x14bc1f){_0x5d8803=_0x5d8803-0x0;var _0x578de3=_0xe419[_0x5d8803];return _0x578de3;};'use strict';var _=require(_0x9e41('0x0'));var util=require(_0x9e41('0x1'));var moment=require(_0x9e41('0x2'));var BPromise=require(_0x9e41('0x3'));var rs=require(_0x9e41('0x4'));var fs=require('fs');var Redis=require(_0x9e41('0x5'));var db=require(_0x9e41('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e41('0x7'))(_0x9e41('0x8'));var config=require(_0x9e41('0x9'));var jayson=require(_0x9e41('0xa'));var client=jayson[_0x9e41('0xb')][_0x9e41('0xc')]({'port':0x232a});config[_0x9e41('0xd')]=_[_0x9e41('0xe')](config[_0x9e41('0xd')],{'host':_0x9e41('0xf'),'port':0x18eb});var socket=require(_0x9e41('0x10'))(new Redis(config[_0x9e41('0xd')]));require('./userVoiceQueueRt.socket')[_0x9e41('0x11')](socket);function respondWithRpcPromise(_0x466897,_0x361021,_0xd90ac){return new BPromise(function(_0x5b4b9a,_0x37a7dd){return client[_0x9e41('0x12')](_0x466897,_0xd90ac)[_0x9e41('0x13')](function(_0x35176f){logger[_0x9e41('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x361021,_0x9e41('0x15'));logger[_0x9e41('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x361021,_0x9e41('0x15'),JSON[_0x9e41('0x17')](_0x35176f));if(_0x35176f[_0x9e41('0x18')]){if(_0x35176f[_0x9e41('0x18')]['code']===0x1f4){logger[_0x9e41('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x361021,_0x35176f[_0x9e41('0x18')][_0x9e41('0x19')]);return _0x37a7dd(_0x35176f[_0x9e41('0x18')][_0x9e41('0x19')]);}logger['error'](_0x9e41('0x1a'),_0x361021,_0x35176f[_0x9e41('0x18')][_0x9e41('0x19')]);return _0x5b4b9a(_0x35176f[_0x9e41('0x18')]['message']);}else{logger[_0x9e41('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x361021,_0x9e41('0x15'));_0x5b4b9a(_0x35176f[_0x9e41('0x1b')]['message']);}})[_0x9e41('0x1c')](function(_0x31efaa){logger[_0x9e41('0x18')](_0x9e41('0x1a'),_0x361021,_0x31efaa);_0x37a7dd(_0x31efaa);});});}exports[_0x9e41('0x1d')]=function(_0x3e3885){var _0x2e5a9e=this;return new Promise(function(_0x2df2dd,_0x5695e5){return db['UserVoiceQueueRt'][_0x9e41('0x1e')]({'raw':_0x3e3885[_0x9e41('0x1f')]?_0x3e3885[_0x9e41('0x1f')][_0x9e41('0x20')]===undefined?!![]:![]:!![],'where':_0x3e3885['options']?_0x3e3885[_0x9e41('0x1f')]['where']||null:null,'attributes':[[db[_0x9e41('0x21')]['fn'](_0x9e41('0x22'),db[_0x9e41('0x21')]['fn']('IF',db[_0x9e41('0x21')][_0x9e41('0x23')](_0x9e41('0x24')))),'outboundQueuePauses']]})[_0x9e41('0x13')](function(_0x3424b0){logger[_0x9e41('0x14')]('GetVoiceQueueRtPauses',_0x3e3885);logger[_0x9e41('0x16')](_0x9e41('0x1d'),_0x3e3885,JSON[_0x9e41('0x17')](_0x3424b0));_0x2df2dd(_0x3424b0);})[_0x9e41('0x1c')](function(_0x72b5e5){logger[_0x9e41('0x18')]('GetVoiceQueueRtPauses',_0x72b5e5[_0x9e41('0x19')],_0x3e3885);_0x5695e5(_0x2e5a9e['error'](0x1f4,_0x72b5e5['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 2e79f57..fbaf888 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 _0x8411=['emit','removeListener','length','userVoiceQueueRt:','remove','update'];(function(_0x294f30,_0x4cdb4c){var _0x39cd8b=function(_0xd61d6){while(--_0xd61d6){_0x294f30['push'](_0x294f30['shift']());}};_0x39cd8b(++_0x4cdb4c);}(_0x8411,0x118));var _0x1841=function(_0x4ecff4,_0x345dde){_0x4ecff4=_0x4ecff4-0x0;var _0x5b3104=_0x8411[_0x4ecff4];return _0x5b3104;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x1841('0x0'),_0x1841('0x1')];function createListener(_0x4e0ff9,_0x596436){return function(_0x112b9a){_0x596436[_0x1841('0x2')](_0x4e0ff9,_0x112b9a);};}function removeListener(_0x2e07e5,_0x29c8aa){return function(){UserVoiceQueueRtEvents[_0x1841('0x3')](_0x2e07e5,_0x29c8aa);};}exports['register']=function(_0x3432f2){for(var _0x54a581=0x0,_0x4224eb=events[_0x1841('0x4')];_0x54a581<_0x4224eb;_0x54a581++){var _0x2c77df=events[_0x54a581];var _0xa774c1=createListener(_0x1841('0x5')+_0x2c77df,_0x3432f2);UserVoiceQueueRtEvents['on'](_0x2c77df,_0xa774c1);}}; \ No newline at end of file +var _0x68f5=['register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','emit','removeListener'];(function(_0x292f40,_0x1049ec){var _0x39ab8d=function(_0x119e3d){while(--_0x119e3d){_0x292f40['push'](_0x292f40['shift']());}};_0x39ab8d(++_0x1049ec);}(_0x68f5,0x11a));var _0x568f=function(_0x44d997,_0x50ccba){_0x44d997=_0x44d997-0x0;var _0x36710b=_0x68f5[_0x44d997];return _0x36710b;};'use strict';var UserVoiceQueueRtEvents=require(_0x568f('0x0'));var events=[_0x568f('0x1'),_0x568f('0x2'),'update'];function createListener(_0x25a405,_0x44b6ad){return function(_0x23bd5b){_0x44b6ad[_0x568f('0x3')](_0x25a405,_0x23bd5b);};}function removeListener(_0x425217,_0x5de1c0){return function(){UserVoiceQueueRtEvents[_0x568f('0x4')](_0x425217,_0x5de1c0);};}exports[_0x568f('0x5')]=function(_0x31444b){for(var _0x3181fd=0x0,_0x4ca62c=events['length'];_0x3181fd<_0x4ca62c;_0x3181fd++){var _0x953f02=events[_0x3181fd];var _0x3568a0=createListener(_0x568f('0x6')+_0x953f02,_0x31444b);UserVoiceQueueRtEvents['on'](_0x953f02,_0x3568a0);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 7526626..8be203f 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(_0x2af917,_0x153134){var _0x40409d=function(_0x2d45d0){while(--_0x2d45d0){_0x2af917['push'](_0x2af917['shift']());}};_0x40409d(++_0x153134);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0xcb91[_0x386525];return _0x14d015;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5207a2,_0x316913){var _0x314716=function(_0x2ca663){while(--_0x2ca663){_0x5207a2['push'](_0x5207a2['shift']());}};_0x314716(++_0x316913);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('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 10d864a..0e7677f 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 _0x9d92=['sequelize'];(function(_0x4054c9,_0x533f45){var _0x25cb32=function(_0x250f1f){while(--_0x250f1f){_0x4054c9['push'](_0x4054c9['shift']());}};_0x25cb32(++_0x533f45);}(_0x9d92,0xdf));var _0x29d9=function(_0x2f227c,_0x360c3a){_0x2f227c=_0x2f227c-0x0;var _0x5032bc=_0x9d92[_0x2f227c];return _0x5032bc;};'use strict';var Sequelize=require(_0x29d9('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x39b4=['INTEGER','sequelize','exports'];(function(_0x2eed72,_0x21c5ec){var _0x42320c=function(_0x3c401f){while(--_0x3c401f){_0x2eed72['push'](_0x2eed72['shift']());}};_0x42320c(++_0x21c5ec);}(_0x39b4,0xd3));var _0x439b=function(_0xb4ef16,_0x49d374){_0xb4ef16=_0xb4ef16-0x0;var _0x46ed61=_0x39b4[_0xb4ef16];return _0x46ed61;};'use strict';var Sequelize=require(_0x439b('0x0'));module[_0x439b('0x1')]={'penalty':{'type':Sequelize[_0x439b('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 31e580f..6845b50 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 _0x52b3=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue'];(function(_0x16bfc5,_0x4f9dc3){var _0x43b820=function(_0x363ced){while(--_0x363ced){_0x16bfc5['push'](_0x16bfc5['shift']());}};_0x43b820(++_0x4f9dc3);}(_0x52b3,0xa0));var _0x352b=function(_0x3b62f9,_0x3a90d3){_0x3b62f9=_0x3b62f9-0x0;var _0x443e2b=_0x52b3[_0x3b62f9];return _0x443e2b;};'use strict';var _=require(_0x352b('0x0'));var util=require(_0x352b('0x1'));var logger=require(_0x352b('0x2'))('api');var moment=require(_0x352b('0x3'));var BPromise=require('bluebird');var rp=require(_0x352b('0x4'));var fs=require('fs');var path=require(_0x352b('0x5'));var rimraf=require('rimraf');var config=require(_0x352b('0x6'));var attributes=require(_0x352b('0x7'));module['exports']=function(_0x5183cf,_0x5c3416){return _0x5183cf[_0x352b('0x8')](_0x352b('0x9'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c3b=['UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','bluebird','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define'];(function(_0x29ab8e,_0x67c0c1){var _0xc602a3=function(_0x2782b5){while(--_0x2782b5){_0x29ab8e['push'](_0x29ab8e['shift']());}};_0xc602a3(++_0x67c0c1);}(_0x3c3b,0xac));var _0xb3c3=function(_0x4833ff,_0x445cd7){_0x4833ff=_0x4833ff-0x0;var _0xc15ab2=_0x3c3b[_0x4833ff];return _0xc15ab2;};'use strict';var _=require('lodash');var util=require(_0xb3c3('0x0'));var logger=require(_0xb3c3('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb3c3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb3c3('0x3'));var config=require(_0xb3c3('0x4'));var attributes=require(_0xb3c3('0x5'));module[_0xb3c3('0x6')]=function(_0x483fe7,_0x4e9d68){return _0x483fe7[_0xb3c3('0x7')](_0xb3c3('0x8'),attributes,{'tableName':_0xb3c3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index c047f9d..a92fa2c 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 _0xf586=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','catch'];(function(_0x38dd14,_0x58f823){var _0x15a195=function(_0x3cf243){while(--_0x3cf243){_0x38dd14['push'](_0x38dd14['shift']());}};_0x15a195(++_0x58f823);}(_0xf586,0x72));var _0x6f58=function(_0x4a7b64,_0x16733c){_0x4a7b64=_0x4a7b64-0x0;var _0x500da6=_0xf586[_0x4a7b64];return _0x500da6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6f58('0x0'));var rs=require(_0x6f58('0x1'));var fs=require('fs');var Redis=require(_0x6f58('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f58('0x3'));var logger=require(_0x6f58('0x4'))(_0x6f58('0x5'));var config=require(_0x6f58('0x6'));var jayson=require(_0x6f58('0x7'));var client=jayson[_0x6f58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c3708,_0x194e43,_0x7c9f3b){return new BPromise(function(_0x367136,_0x37033b){return client[_0x6f58('0x9')](_0x1c3708,_0x7c9f3b)[_0x6f58('0xa')](function(_0x279f0e){logger[_0x6f58('0xb')](_0x6f58('0xc'),_0x194e43,_0x6f58('0xd'));logger[_0x6f58('0xe')](_0x6f58('0xf'),_0x194e43,'request\x20sent',JSON['stringify'](_0x279f0e));if(_0x279f0e[_0x6f58('0x10')]){if(_0x279f0e[_0x6f58('0x10')]['code']===0x1f4){logger[_0x6f58('0x10')](_0x6f58('0xc'),_0x194e43,_0x279f0e[_0x6f58('0x10')]['message']);return _0x37033b(_0x279f0e[_0x6f58('0x10')][_0x6f58('0x11')]);}logger[_0x6f58('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x194e43,_0x279f0e[_0x6f58('0x10')]['message']);return _0x367136(_0x279f0e['error']['message']);}else{logger[_0x6f58('0xb')](_0x6f58('0xc'),_0x194e43,_0x6f58('0xd'));_0x367136(_0x279f0e['result'][_0x6f58('0x11')]);}})[_0x6f58('0x12')](function(_0x26fef9){logger[_0x6f58('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x194e43,_0x26fef9);_0x37033b(_0x26fef9);});});} \ No newline at end of file +var _0x1b48=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3bacde,_0x89163){var _0x3ebd10=function(_0x9851b9){while(--_0x9851b9){_0x3bacde['push'](_0x3bacde['shift']());}};_0x3ebd10(++_0x89163);}(_0x1b48,0x73));var _0x81b4=function(_0x4fb3c7,_0x5ec3e9){_0x4fb3c7=_0x4fb3c7-0x0;var _0xffa736=_0x1b48[_0x4fb3c7];return _0xffa736;};'use strict';var _=require(_0x81b4('0x0'));var util=require(_0x81b4('0x1'));var moment=require(_0x81b4('0x2'));var BPromise=require(_0x81b4('0x3'));var rs=require(_0x81b4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81b4('0x5'))['db'];var utils=require(_0x81b4('0x6'));var logger=require(_0x81b4('0x7'))(_0x81b4('0x8'));var config=require('../../config/environment');var jayson=require(_0x81b4('0x9'));var client=jayson[_0x81b4('0xa')][_0x81b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ba6ab,_0x3d425f,_0x5411b1){return new BPromise(function(_0x470059,_0x2266db){return client[_0x81b4('0xc')](_0x5ba6ab,_0x5411b1)[_0x81b4('0xd')](function(_0x46ccaa){logger[_0x81b4('0xe')](_0x81b4('0xf'),_0x3d425f,_0x81b4('0x10'));logger[_0x81b4('0x11')](_0x81b4('0x12'),_0x3d425f,'request\x20sent',JSON['stringify'](_0x46ccaa));if(_0x46ccaa['error']){if(_0x46ccaa[_0x81b4('0x13')][_0x81b4('0x14')]===0x1f4){logger[_0x81b4('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3d425f,_0x46ccaa[_0x81b4('0x13')][_0x81b4('0x15')]);return _0x2266db(_0x46ccaa['error'][_0x81b4('0x15')]);}logger[_0x81b4('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3d425f,_0x46ccaa[_0x81b4('0x13')]['message']);return _0x470059(_0x46ccaa['error']['message']);}else{logger['info'](_0x81b4('0xf'),_0x3d425f,_0x81b4('0x10'));_0x470059(_0x46ccaa[_0x81b4('0x16')]['message']);}})['catch'](function(_0x76f127){logger[_0x81b4('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3d425f,_0x76f127);_0x2266db(_0x76f127);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 81ee9e3..97d3e9e 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 _0xa261=['./variable.controller','get','isAuthenticated','index','post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0xe52657,_0x374354){var _0x4f14ea=function(_0x413ee4){while(--_0x413ee4){_0xe52657['push'](_0xe52657['shift']());}};_0x4f14ea(++_0x374354);}(_0xa261,0x1a3));var _0x1a26=function(_0x545ef5,_0x3b4927){_0x545ef5=_0x545ef5-0x0;var _0x3c3ef4=_0xa261[_0x545ef5];return _0x3c3ef4;};'use strict';var multer=require(_0x1a26('0x0'));var util=require('util');var path=require(_0x1a26('0x1'));var timeout=require(_0x1a26('0x2'));var express=require(_0x1a26('0x3'));var router=express[_0x1a26('0x4')]();var fs_extra=require(_0x1a26('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a26('0x6'));router[_0x1a26('0x7')]('/',auth[_0x1a26('0x8')](),controller[_0x1a26('0x9')]);router[_0x1a26('0x7')]('/:id',auth[_0x1a26('0x8')](),controller['show']);router[_0x1a26('0xa')]('/',auth[_0x1a26('0x8')](),controller[_0x1a26('0xb')]);router['put'](_0x1a26('0xc'),auth[_0x1a26('0x8')](),controller[_0x1a26('0xd')]);router[_0x1a26('0xe')](_0x1a26('0xc'),auth['isAuthenticated'](),controller[_0x1a26('0xf')]);module[_0x1a26('0x10')]=router; \ No newline at end of file +var _0x2121=['put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','isAuthenticated','index','get','/:id','show','create'];(function(_0x566155,_0x275b7a){var _0x326b28=function(_0x5b41e0){while(--_0x5b41e0){_0x566155['push'](_0x566155['shift']());}};_0x326b28(++_0x275b7a);}(_0x2121,0x1b4));var _0x1212=function(_0xa5a054,_0x367fbc){_0xa5a054=_0xa5a054-0x0;var _0x11febb=_0x2121[_0xa5a054];return _0x11febb;};'use strict';var multer=require(_0x1212('0x0'));var util=require(_0x1212('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1212('0x2'));var router=express[_0x1212('0x3')]();var fs_extra=require(_0x1212('0x4'));var auth=require(_0x1212('0x5'));var interaction=require(_0x1212('0x6'));var config=require('../../config/environment');var controller=require(_0x1212('0x7'));router['get']('/',auth[_0x1212('0x8')](),controller[_0x1212('0x9')]);router[_0x1212('0xa')](_0x1212('0xb'),auth[_0x1212('0x8')](),controller[_0x1212('0xc')]);router['post']('/',auth[_0x1212('0x8')](),controller[_0x1212('0xd')]);router[_0x1212('0xe')](_0x1212('0xb'),auth[_0x1212('0x8')](),controller[_0x1212('0xf')]);router['delete']('/:id',auth[_0x1212('0x8')](),controller[_0x1212('0x10')]);module[_0x1212('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index f208775..3098441 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 _0xc04c=['name','sequelize','exports','STRING'];(function(_0x4769a7,_0xa2228f){var _0x580bf9=function(_0x1a84dc){while(--_0x1a84dc){_0x4769a7['push'](_0x4769a7['shift']());}};_0x580bf9(++_0xa2228f);}(_0xc04c,0x11d));var _0xcc04=function(_0x42fe6c,_0x59b04e){_0x42fe6c=_0x42fe6c-0x0;var _0x1ac380=_0xc04c[_0x42fe6c];return _0x1ac380;};'use strict';var Sequelize=require(_0xcc04('0x0'));module[_0xcc04('0x1')]={'name':{'type':Sequelize[_0xcc04('0x2')],'unique':_0xcc04('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcc04('0x2')]}}; \ No newline at end of file +var _0xfa41=['STRING','name','exports'];(function(_0x45616f,_0xddc0dd){var _0xa3f0f8=function(_0x170c10){while(--_0x170c10){_0x45616f['push'](_0x45616f['shift']());}};_0xa3f0f8(++_0xddc0dd);}(_0xfa41,0xd1));var _0x1fa4=function(_0x46adcd,_0x15c37b){_0x46adcd=_0x46adcd-0x0;var _0x2f9454=_0xfa41[_0x46adcd];return _0x2f9454;};'use strict';var Sequelize=require('sequelize');module[_0x1fa4('0x0')]={'name':{'type':Sequelize[_0x1fa4('0x1')],'unique':_0x1fa4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index b9a9a23..7578d22 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 _0xaa04=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','Variables','end','sendStatus','error','stack','name','index','Variable','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0xaa04,0x18c));var _0x4aa0=function(_0x4972d0,_0x4fd9a1){_0x4972d0=_0x4972d0-0x0;var _0x3905e6=_0xaa04[_0x4972d0];return _0x3905e6;};'use strict';var emlformat=require(_0x4aa0('0x0'));var rimraf=require(_0x4aa0('0x1'));var zipdir=require(_0x4aa0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4aa0('0x3'));var moment=require('moment');var BPromise=require(_0x4aa0('0x4'));var Mustache=require(_0x4aa0('0x5'));var util=require('util');var path=require(_0x4aa0('0x6'));var sox=require(_0x4aa0('0x7'));var csv=require(_0x4aa0('0x8'));var ejs=require(_0x4aa0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4aa0('0xa'));var squel=require('squel');var crypto=require(_0x4aa0('0xb'));var jsforce=require(_0x4aa0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4aa0('0x8'));var querystring=require(_0x4aa0('0xd'));var Papa=require(_0x4aa0('0xe'));var Redis=require('ioredis');var authService=require(_0x4aa0('0xf'));var qs=require(_0x4aa0('0x10'));var as=require(_0x4aa0('0x11'));var hardwareService=require(_0x4aa0('0x12'));var logger=require(_0x4aa0('0x13'))(_0x4aa0('0x14'));var utils=require(_0x4aa0('0x15'));var config=require(_0x4aa0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4aa0('0x17'))['db'];function respondWithStatusCode(_0xefdf06,_0x418139){_0x418139=_0x418139||0xcc;return function(_0x56390f){if(_0x56390f){return _0xefdf06['sendStatus'](_0x418139);}return _0xefdf06[_0x4aa0('0x18')](_0x418139)['end']();};}function respondWithResult(_0x21df06,_0x2ed0e1){_0x2ed0e1=_0x2ed0e1||0xc8;return function(_0x285282){if(_0x285282){return _0x21df06['status'](_0x2ed0e1)[_0x4aa0('0x19')](_0x285282);}};}function respondWithFilteredResult(_0x5ecad5,_0x5c4923){return function(_0x2a0880){if(_0x2a0880){var _0x4ad324=typeof _0x5c4923[_0x4aa0('0x1a')]==='undefined'&&typeof _0x5c4923[_0x4aa0('0x1b')]===_0x4aa0('0x1c');var _0x222f1b=_0x2a0880[_0x4aa0('0x1d')];var _0x5c853b=_0x4ad324?0x0:_0x5c4923[_0x4aa0('0x1a')];var _0x51d79b=_0x4ad324?_0x2a0880[_0x4aa0('0x1d')]:_0x5c4923[_0x4aa0('0x1a')]+_0x5c4923[_0x4aa0('0x1b')];var _0x398865;if(_0x51d79b>=_0x222f1b){_0x51d79b=_0x222f1b;_0x398865=0xc8;}else{_0x398865=0xce;}_0x5ecad5[_0x4aa0('0x18')](_0x398865);return _0x5ecad5[_0x4aa0('0x1e')](_0x4aa0('0x1f'),_0x5c853b+'-'+_0x51d79b+'/'+_0x222f1b)[_0x4aa0('0x19')](_0x2a0880);}return null;};}function patchUpdates(_0x39b27b){return function(_0x58b62a){try{jsonpatch[_0x4aa0('0x20')](_0x58b62a,_0x39b27b,!![]);}catch(_0x3688b1){return BPromise[_0x4aa0('0x21')](_0x3688b1);}return _0x58b62a['save']();};}function saveUpdates(_0x5b6f20,_0x594416){return function(_0xe2ab99){if(_0xe2ab99){return _0xe2ab99[_0x4aa0('0x22')](_0x5b6f20)[_0x4aa0('0x23')](function(_0x4d6cbc){return _0x4d6cbc;});}return null;};}function removeEntity(_0x18abfb,_0x136cec){return function(_0x3ae1ad){if(_0x3ae1ad){return _0x3ae1ad[_0x4aa0('0x24')]()[_0x4aa0('0x23')](function(){var _0x3e8b83=_0x3ae1ad[_0x4aa0('0x25')]({'plain':!![]});var _0x31fb57=_0x4aa0('0x26');return db['UserProfileResource'][_0x4aa0('0x24')]({'where':{'type':_0x31fb57,'resourceId':_0x3e8b83['id']}})['then'](function(){return _0x3ae1ad;});})[_0x4aa0('0x23')](function(){_0x18abfb[_0x4aa0('0x18')](0xcc)[_0x4aa0('0x27')]();});}};}function handleEntityNotFound(_0x2f80bb,_0x16608a){return function(_0x28922f){if(!_0x28922f){_0x2f80bb[_0x4aa0('0x28')](0x194);}return _0x28922f;};}function handleError(_0x341fc9,_0x2e3fff){_0x2e3fff=_0x2e3fff||0x1f4;return function(_0x119a55){logger[_0x4aa0('0x29')](_0x119a55[_0x4aa0('0x2a')]);if(_0x119a55[_0x4aa0('0x2b')]){delete _0x119a55[_0x4aa0('0x2b')];}_0x341fc9[_0x4aa0('0x18')](_0x2e3fff)['send'](_0x119a55);};}exports[_0x4aa0('0x2c')]=function(_0x2aa862,_0x7a0a47){var _0x3683cc={},_0x56b133={},_0x17e03b={'count':0x0,'rows':[]};var _0x4fb399=_['map'](db[_0x4aa0('0x2d')][_0x4aa0('0x2e')],function(_0x588938){return{'name':_0x588938['fieldName'],'type':_0x588938[_0x4aa0('0x2f')][_0x4aa0('0x30')]};});_0x56b133[_0x4aa0('0x31')]=_['map'](_0x4fb399,'name');_0x56b133[_0x4aa0('0x32')]=_[_0x4aa0('0x33')](_0x2aa862[_0x4aa0('0x32')]);_0x56b133['filters']=_[_0x4aa0('0x34')](_0x56b133['model'],_0x56b133[_0x4aa0('0x32')]);_0x3683cc['attributes']=_[_0x4aa0('0x34')](_0x56b133[_0x4aa0('0x31')],qs['fields'](_0x2aa862['query']['fields']));_0x3683cc[_0x4aa0('0x35')]=_0x3683cc[_0x4aa0('0x35')][_0x4aa0('0x36')]?_0x3683cc['attributes']:_0x56b133[_0x4aa0('0x31')];if(!_0x2aa862[_0x4aa0('0x32')][_0x4aa0('0x37')](_0x4aa0('0x38'))){_0x3683cc['limit']=qs[_0x4aa0('0x1b')](_0x2aa862[_0x4aa0('0x32')][_0x4aa0('0x1b')]);_0x3683cc[_0x4aa0('0x1a')]=qs[_0x4aa0('0x1a')](_0x2aa862[_0x4aa0('0x32')][_0x4aa0('0x1a')]);}_0x3683cc['order']=qs[_0x4aa0('0x39')](_0x2aa862['query']['sort']);_0x3683cc[_0x4aa0('0x3a')]=qs['filters'](_[_0x4aa0('0x3b')](_0x2aa862[_0x4aa0('0x32')],_0x56b133[_0x4aa0('0x3c')]),_0x4fb399);if(_0x2aa862['query'][_0x4aa0('0x3d')]){_0x3683cc[_0x4aa0('0x3a')]=_[_0x4aa0('0x3e')](_0x3683cc['where'],{'$or':_['map'](_0x4fb399,function(_0x13fcf8){if(_0x13fcf8['type']!=='VIRTUAL'){var _0x567e27={};_0x567e27[_0x13fcf8[_0x4aa0('0x2b')]]={'$like':'%'+_0x2aa862['query'][_0x4aa0('0x3d')]+'%'};return _0x567e27;}})});}_0x3683cc=_[_0x4aa0('0x3e')]({},_0x3683cc,_0x2aa862[_0x4aa0('0x3f')]);var _0x1fdc5f={'where':_0x3683cc[_0x4aa0('0x3a')]};return db[_0x4aa0('0x2d')][_0x4aa0('0x1d')](_0x1fdc5f)['then'](function(_0x339434){_0x17e03b[_0x4aa0('0x1d')]=_0x339434;if(_0x2aa862[_0x4aa0('0x32')][_0x4aa0('0x40')]){_0x3683cc[_0x4aa0('0x41')]=[{'all':!![]}];}return db[_0x4aa0('0x2d')][_0x4aa0('0x42')](_0x3683cc);})[_0x4aa0('0x23')](function(_0x50b2c2){_0x17e03b[_0x4aa0('0x43')]=_0x50b2c2;return _0x17e03b;})[_0x4aa0('0x23')](respondWithFilteredResult(_0x7a0a47,_0x3683cc))['catch'](handleError(_0x7a0a47,null));};exports[_0x4aa0('0x44')]=function(_0x524c81,_0x39fb3c){var _0x485ad4={'raw':!![],'where':{'id':_0x524c81[_0x4aa0('0x45')]['id']}},_0x262b22={};_0x262b22[_0x4aa0('0x31')]=_[_0x4aa0('0x33')](db[_0x4aa0('0x2d')][_0x4aa0('0x2e')]);_0x262b22[_0x4aa0('0x32')]=_[_0x4aa0('0x33')](_0x524c81['query']);_0x262b22[_0x4aa0('0x3c')]=_['intersection'](_0x262b22[_0x4aa0('0x31')],_0x262b22[_0x4aa0('0x32')]);_0x485ad4[_0x4aa0('0x35')]=_[_0x4aa0('0x34')](_0x262b22[_0x4aa0('0x31')],qs['fields'](_0x524c81['query'][_0x4aa0('0x46')]));_0x485ad4[_0x4aa0('0x35')]=_0x485ad4[_0x4aa0('0x35')]['length']?_0x485ad4['attributes']:_0x262b22[_0x4aa0('0x31')];if(_0x524c81[_0x4aa0('0x32')][_0x4aa0('0x40')]){_0x485ad4['include']=[{'all':!![]}];}_0x485ad4=_['merge']({},_0x485ad4,_0x524c81[_0x4aa0('0x3f')]);return db[_0x4aa0('0x2d')][_0x4aa0('0x47')](_0x485ad4)['then'](handleEntityNotFound(_0x39fb3c,null))[_0x4aa0('0x23')](respondWithResult(_0x39fb3c,null))[_0x4aa0('0x48')](handleError(_0x39fb3c,null));};exports[_0x4aa0('0x49')]=function(_0x446d99,_0x5734f9){return db[_0x4aa0('0x2d')][_0x4aa0('0x49')](_0x446d99[_0x4aa0('0x4a')],{})['then'](function(_0x95a9ad){var _0x3adeb1=_0x446d99[_0x4aa0('0x4b')][_0x4aa0('0x25')]({'plain':!![]});if(!_0x3adeb1)throw new Error(_0x4aa0('0x4c'));if(_0x3adeb1['role']===_0x4aa0('0x4b')){var _0x545e11=_0x95a9ad[_0x4aa0('0x25')]({'plain':!![]});var _0x1e9e95='Variables';return db['UserProfileSection'][_0x4aa0('0x47')]({'where':{'name':_0x1e9e95,'userProfileId':_0x3adeb1['userProfileId']},'raw':!![]})[_0x4aa0('0x23')](function(_0x3f3fc2){if(_0x3f3fc2&&_0x3f3fc2['autoAssociation']===0x0){return db[_0x4aa0('0x4d')]['create']({'name':_0x545e11[_0x4aa0('0x2b')],'resourceId':_0x545e11['id'],'type':_0x3f3fc2['name'],'sectionId':_0x3f3fc2['id']},{})[_0x4aa0('0x23')](function(){return _0x95a9ad;});}else{return _0x95a9ad;}})[_0x4aa0('0x48')](function(_0x53aa93){logger[_0x4aa0('0x29')](_0x4aa0('0x4e'),_0x53aa93);throw _0x53aa93;});}return _0x95a9ad;})[_0x4aa0('0x23')](respondWithResult(_0x5734f9,0xc9))[_0x4aa0('0x48')](handleError(_0x5734f9,null));};exports[_0x4aa0('0x22')]=function(_0x527cb5,_0x372dd0){if(_0x527cb5[_0x4aa0('0x4a')]['id']){delete _0x527cb5[_0x4aa0('0x4a')]['id'];}return db[_0x4aa0('0x2d')][_0x4aa0('0x47')]({'where':{'id':_0x527cb5[_0x4aa0('0x45')]['id']}})[_0x4aa0('0x23')](handleEntityNotFound(_0x372dd0,null))[_0x4aa0('0x23')](saveUpdates(_0x527cb5[_0x4aa0('0x4a')],null))[_0x4aa0('0x23')](respondWithResult(_0x372dd0,null))[_0x4aa0('0x48')](handleError(_0x372dd0,null));};exports[_0x4aa0('0x24')]=function(_0x5dc944,_0x278cec){return db[_0x4aa0('0x2d')][_0x4aa0('0x47')]({'where':{'id':_0x5dc944['params']['id']}})[_0x4aa0('0x23')](handleEntityNotFound(_0x278cec,null))[_0x4aa0('0x23')](removeEntity(_0x278cec,null))[_0x4aa0('0x48')](handleError(_0x278cec,null));}; \ No newline at end of file +var _0xc5de=['fields','length','hasOwnProperty','offset','order','where','pick','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','set','Content-Range','reject','save','update','get','Variables','UserProfileResource','destroy','then','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x10dbab,_0x2e8174){var _0x408bfe=function(_0x4bca15){while(--_0x4bca15){_0x10dbab['push'](_0x10dbab['shift']());}};_0x408bfe(++_0x2e8174);}(_0xc5de,0x1c1));var _0xec5d=function(_0x30df3b,_0x90abb5){_0x30df3b=_0x30df3b-0x0;var _0xe1b865=_0xc5de[_0x30df3b];return _0xe1b865;};'use strict';var emlformat=require(_0xec5d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec5d('0x1'));var jsonpatch=require(_0xec5d('0x2'));var rp=require(_0xec5d('0x3'));var moment=require(_0xec5d('0x4'));var BPromise=require(_0xec5d('0x5'));var Mustache=require(_0xec5d('0x6'));var util=require(_0xec5d('0x7'));var path=require(_0xec5d('0x8'));var sox=require(_0xec5d('0x9'));var csv=require(_0xec5d('0xa'));var ejs=require(_0xec5d('0xb'));var fs=require('fs');var fs_extra=require(_0xec5d('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xec5d('0xd'));var deskjs=require(_0xec5d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xec5d('0xf'));var Papa=require(_0xec5d('0x10'));var Redis=require(_0xec5d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xec5d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec5d('0x13'));var logger=require(_0xec5d('0x14'))('api');var utils=require(_0xec5d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xec5d('0x16'));var db=require(_0xec5d('0x17'))['db'];function respondWithStatusCode(_0x585363,_0x5b3b7f){_0x5b3b7f=_0x5b3b7f||0xcc;return function(_0x4b7dc5){if(_0x4b7dc5){return _0x585363[_0xec5d('0x18')](_0x5b3b7f);}return _0x585363[_0xec5d('0x19')](_0x5b3b7f)[_0xec5d('0x1a')]();};}function respondWithResult(_0x16e945,_0x4ddc27){_0x4ddc27=_0x4ddc27||0xc8;return function(_0x3ac7b0){if(_0x3ac7b0){return _0x16e945[_0xec5d('0x19')](_0x4ddc27)[_0xec5d('0x1b')](_0x3ac7b0);}};}function respondWithFilteredResult(_0x414bde,_0x150175){return function(_0x2fc1a8){if(_0x2fc1a8){var _0x4cbcaf=typeof _0x150175['offset']===_0xec5d('0x1c')&&typeof _0x150175[_0xec5d('0x1d')]===_0xec5d('0x1c');var _0x2a9798=_0x2fc1a8['count'];var _0x519a89=_0x4cbcaf?0x0:_0x150175['offset'];var _0x458161=_0x4cbcaf?_0x2fc1a8['count']:_0x150175['offset']+_0x150175[_0xec5d('0x1d')];var _0x5497af;if(_0x458161>=_0x2a9798){_0x458161=_0x2a9798;_0x5497af=0xc8;}else{_0x5497af=0xce;}_0x414bde[_0xec5d('0x19')](_0x5497af);return _0x414bde[_0xec5d('0x1e')](_0xec5d('0x1f'),_0x519a89+'-'+_0x458161+'/'+_0x2a9798)['json'](_0x2fc1a8);}return null;};}function patchUpdates(_0x4f3eb0){return function(_0x3302e4){try{jsonpatch['apply'](_0x3302e4,_0x4f3eb0,!![]);}catch(_0x5c5bb4){return BPromise[_0xec5d('0x20')](_0x5c5bb4);}return _0x3302e4[_0xec5d('0x21')]();};}function saveUpdates(_0xe85803,_0x19029c){return function(_0x160983){if(_0x160983){return _0x160983[_0xec5d('0x22')](_0xe85803)['then'](function(_0x101d41){return _0x101d41;});}return null;};}function removeEntity(_0x33cceb,_0x3afa4d){return function(_0xea9d3c){if(_0xea9d3c){return _0xea9d3c['destroy']()['then'](function(){var _0x6d6814=_0xea9d3c[_0xec5d('0x23')]({'plain':!![]});var _0x4a14d7=_0xec5d('0x24');return db[_0xec5d('0x25')][_0xec5d('0x26')]({'where':{'type':_0x4a14d7,'resourceId':_0x6d6814['id']}})[_0xec5d('0x27')](function(){return _0xea9d3c;});})[_0xec5d('0x27')](function(){_0x33cceb[_0xec5d('0x19')](0xcc)[_0xec5d('0x1a')]();});}};}function handleEntityNotFound(_0x2a6b0a,_0xefdfbb){return function(_0x13cd4c){if(!_0x13cd4c){_0x2a6b0a[_0xec5d('0x18')](0x194);}return _0x13cd4c;};}function handleError(_0xbeee4f,_0x362a10){_0x362a10=_0x362a10||0x1f4;return function(_0x2a6758){logger['error'](_0x2a6758[_0xec5d('0x28')]);if(_0x2a6758['name']){delete _0x2a6758[_0xec5d('0x29')];}_0xbeee4f[_0xec5d('0x19')](_0x362a10)[_0xec5d('0x2a')](_0x2a6758);};}exports[_0xec5d('0x2b')]=function(_0x4eadad,_0x68c7d3){var _0x2fda3b={},_0x19021c={},_0x55bbed={'count':0x0,'rows':[]};var _0x36b157=_[_0xec5d('0x2c')](db[_0xec5d('0x2d')][_0xec5d('0x2e')],function(_0x542965){return{'name':_0x542965[_0xec5d('0x2f')],'type':_0x542965[_0xec5d('0x30')][_0xec5d('0x31')]};});_0x19021c[_0xec5d('0x32')]=_[_0xec5d('0x2c')](_0x36b157,_0xec5d('0x29'));_0x19021c[_0xec5d('0x33')]=_['keys'](_0x4eadad['query']);_0x19021c[_0xec5d('0x34')]=_[_0xec5d('0x35')](_0x19021c[_0xec5d('0x32')],_0x19021c[_0xec5d('0x33')]);_0x2fda3b[_0xec5d('0x36')]=_[_0xec5d('0x35')](_0x19021c[_0xec5d('0x32')],qs[_0xec5d('0x37')](_0x4eadad[_0xec5d('0x33')][_0xec5d('0x37')]));_0x2fda3b['attributes']=_0x2fda3b['attributes'][_0xec5d('0x38')]?_0x2fda3b[_0xec5d('0x36')]:_0x19021c[_0xec5d('0x32')];if(!_0x4eadad[_0xec5d('0x33')][_0xec5d('0x39')]('nolimit')){_0x2fda3b[_0xec5d('0x1d')]=qs[_0xec5d('0x1d')](_0x4eadad[_0xec5d('0x33')][_0xec5d('0x1d')]);_0x2fda3b[_0xec5d('0x3a')]=qs[_0xec5d('0x3a')](_0x4eadad['query'][_0xec5d('0x3a')]);}_0x2fda3b[_0xec5d('0x3b')]=qs['sort'](_0x4eadad[_0xec5d('0x33')]['sort']);_0x2fda3b[_0xec5d('0x3c')]=qs[_0xec5d('0x34')](_[_0xec5d('0x3d')](_0x4eadad['query'],_0x19021c[_0xec5d('0x34')]),_0x36b157);if(_0x4eadad['query']['filter']){_0x2fda3b['where']=_['merge'](_0x2fda3b[_0xec5d('0x3c')],{'$or':_[_0xec5d('0x2c')](_0x36b157,function(_0x120f4d){if(_0x120f4d[_0xec5d('0x30')]!==_0xec5d('0x3e')){var _0x133579={};_0x133579[_0x120f4d[_0xec5d('0x29')]]={'$like':'%'+_0x4eadad[_0xec5d('0x33')][_0xec5d('0x3f')]+'%'};return _0x133579;}})});}_0x2fda3b=_[_0xec5d('0x40')]({},_0x2fda3b,_0x4eadad[_0xec5d('0x41')]);var _0x562f7e={'where':_0x2fda3b[_0xec5d('0x3c')]};return db[_0xec5d('0x2d')][_0xec5d('0x42')](_0x562f7e)[_0xec5d('0x27')](function(_0x22f040){_0x55bbed[_0xec5d('0x42')]=_0x22f040;if(_0x4eadad[_0xec5d('0x33')][_0xec5d('0x43')]){_0x2fda3b[_0xec5d('0x44')]=[{'all':!![]}];}return db[_0xec5d('0x2d')][_0xec5d('0x45')](_0x2fda3b);})[_0xec5d('0x27')](function(_0x46802b){_0x55bbed[_0xec5d('0x46')]=_0x46802b;return _0x55bbed;})[_0xec5d('0x27')](respondWithFilteredResult(_0x68c7d3,_0x2fda3b))[_0xec5d('0x47')](handleError(_0x68c7d3,null));};exports[_0xec5d('0x48')]=function(_0x2d8b6b,_0x5cd388){var _0x4e3181={'raw':!![],'where':{'id':_0x2d8b6b[_0xec5d('0x49')]['id']}},_0xadb6cb={};_0xadb6cb[_0xec5d('0x32')]=_[_0xec5d('0x4a')](db[_0xec5d('0x2d')][_0xec5d('0x2e')]);_0xadb6cb[_0xec5d('0x33')]=_[_0xec5d('0x4a')](_0x2d8b6b['query']);_0xadb6cb[_0xec5d('0x34')]=_[_0xec5d('0x35')](_0xadb6cb[_0xec5d('0x32')],_0xadb6cb[_0xec5d('0x33')]);_0x4e3181[_0xec5d('0x36')]=_[_0xec5d('0x35')](_0xadb6cb[_0xec5d('0x32')],qs[_0xec5d('0x37')](_0x2d8b6b[_0xec5d('0x33')][_0xec5d('0x37')]));_0x4e3181['attributes']=_0x4e3181[_0xec5d('0x36')][_0xec5d('0x38')]?_0x4e3181['attributes']:_0xadb6cb[_0xec5d('0x32')];if(_0x2d8b6b[_0xec5d('0x33')][_0xec5d('0x43')]){_0x4e3181[_0xec5d('0x44')]=[{'all':!![]}];}_0x4e3181=_[_0xec5d('0x40')]({},_0x4e3181,_0x2d8b6b['options']);return db[_0xec5d('0x2d')][_0xec5d('0x4b')](_0x4e3181)[_0xec5d('0x27')](handleEntityNotFound(_0x5cd388,null))[_0xec5d('0x27')](respondWithResult(_0x5cd388,null))['catch'](handleError(_0x5cd388,null));};exports[_0xec5d('0x4c')]=function(_0x287c35,_0x335b8){return db[_0xec5d('0x2d')][_0xec5d('0x4c')](_0x287c35[_0xec5d('0x4d')],{})['then'](function(_0xf87c53){var _0x247437=_0x287c35['user']['get']({'plain':!![]});if(!_0x247437)throw new Error(_0xec5d('0x4e'));if(_0x247437[_0xec5d('0x4f')]==='user'){var _0x2a04fe=_0xf87c53[_0xec5d('0x23')]({'plain':!![]});var _0x111f41=_0xec5d('0x24');return db['UserProfileSection'][_0xec5d('0x4b')]({'where':{'name':_0x111f41,'userProfileId':_0x247437[_0xec5d('0x50')]},'raw':!![]})['then'](function(_0x61f990){if(_0x61f990&&_0x61f990[_0xec5d('0x51')]===0x0){return db['UserProfileResource'][_0xec5d('0x4c')]({'name':_0x2a04fe[_0xec5d('0x29')],'resourceId':_0x2a04fe['id'],'type':_0x61f990[_0xec5d('0x29')],'sectionId':_0x61f990['id']},{})['then'](function(){return _0xf87c53;});}else{return _0xf87c53;}})['catch'](function(_0xecb3bd){logger[_0xec5d('0x52')](_0xec5d('0x53'),_0xecb3bd);throw _0xecb3bd;});}return _0xf87c53;})['then'](respondWithResult(_0x335b8,0xc9))[_0xec5d('0x47')](handleError(_0x335b8,null));};exports[_0xec5d('0x22')]=function(_0x438879,_0x207e81){if(_0x438879[_0xec5d('0x4d')]['id']){delete _0x438879[_0xec5d('0x4d')]['id'];}return db[_0xec5d('0x2d')][_0xec5d('0x4b')]({'where':{'id':_0x438879[_0xec5d('0x49')]['id']}})[_0xec5d('0x27')](handleEntityNotFound(_0x207e81,null))['then'](saveUpdates(_0x438879['body'],null))['then'](respondWithResult(_0x207e81,null))['catch'](handleError(_0x207e81,null));};exports[_0xec5d('0x26')]=function(_0x5e1a30,_0x17f870){return db[_0xec5d('0x2d')][_0xec5d('0x4b')]({'where':{'id':_0x5e1a30[_0xec5d('0x49')]['id']}})[_0xec5d('0x27')](handleEntityNotFound(_0x17f870,null))[_0xec5d('0x27')](removeEntity(_0x17f870,null))[_0xec5d('0x47')](handleError(_0x17f870,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index b47a18c..a165609 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 _0xc477=['../../config/environment','./variable.attributes','exports','tools_variables','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x3d5de1,_0x546d00){var _0x53d390=function(_0x5be2aa){while(--_0x5be2aa){_0x3d5de1['push'](_0x3d5de1['shift']());}};_0x53d390(++_0x546d00);}(_0xc477,0x9a));var _0x7c47=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0xc477[_0x14a0a0];return _0x56b651;};'use strict';var _=require('lodash');var util=require(_0x7c47('0x0'));var logger=require(_0x7c47('0x1'))('api');var moment=require(_0x7c47('0x2'));var BPromise=require(_0x7c47('0x3'));var rp=require(_0x7c47('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c47('0x5'));var config=require(_0x7c47('0x6'));var attributes=require(_0x7c47('0x7'));module[_0x7c47('0x8')]=function(_0x3e18cc,_0x4d9876){return _0x3e18cc['define']('Variable',attributes,{'tableName':_0x7c47('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x925c=['tools_variables','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','define','Variable'];(function(_0x34bd34,_0x1444f7){var _0x4e36d6=function(_0x20ed8e){while(--_0x20ed8e){_0x34bd34['push'](_0x34bd34['shift']());}};_0x4e36d6(++_0x1444f7);}(_0x925c,0xf8));var _0xc925=function(_0x2b7f51,_0x11ce49){_0x2b7f51=_0x2b7f51-0x0;var _0x1a0fba=_0x925c[_0x2b7f51];return _0x1a0fba;};'use strict';var _=require(_0xc925('0x0'));var util=require('util');var logger=require(_0xc925('0x1'))(_0xc925('0x2'));var moment=require(_0xc925('0x3'));var BPromise=require(_0xc925('0x4'));var rp=require(_0xc925('0x5'));var fs=require('fs');var path=require(_0xc925('0x6'));var rimraf=require(_0xc925('0x7'));var config=require(_0xc925('0x8'));var attributes=require(_0xc925('0x9'));module['exports']=function(_0x4bd7b4,_0x35e8c6){return _0x4bd7b4[_0xc925('0xa')](_0xc925('0xb'),attributes,{'tableName':_0xc925('0xc'),'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 6981cda..b28f6c3 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 _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1d69ba,_0x4090c9){var _0x8bab8c=function(_0x33ce38){while(--_0x33ce38){_0x1d69ba['push'](_0x1d69ba['shift']());}};_0x8bab8c(++_0x4090c9);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2eec6c,_0x214a77){_0x2eec6c=_0x2eec6c-0x0;var _0x2f0f8f=_0x8ef6[_0x2eec6c];return _0x2f0f8f;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file +var _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x423dd4,_0x287532){var _0xb29406=function(_0x577c6f){while(--_0x577c6f){_0x423dd4['push'](_0x423dd4['shift']());}};_0xb29406(++_0x287532);}(_0x8ef6,0xf2));var _0x68ef=function(_0x9016d8,_0x2b8d7b){_0x9016d8=_0x9016d8-0x0;var _0x106999=_0x8ef6[_0x9016d8];return _0x106999;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 5c0b9c1..88f0648 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 _0xe2e1=['exports','express','Router','../../components/auth/service','./version.controller','index','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','/restart','restart','/migrations','migrations'];(function(_0x4d9acc,_0x219f16){var _0x139531=function(_0x5ac26c){while(--_0x5ac26c){_0x4d9acc['push'](_0x4d9acc['shift']());}};_0x139531(++_0x219f16);}(_0xe2e1,0x7f));var _0x1e2e=function(_0x3cc075,_0x2ffbc5){_0x3cc075=_0x3cc075-0x0;var _0x54a72d=_0xe2e1[_0x3cc075];return _0x54a72d;};'use strict';var express=require(_0x1e2e('0x0'));var router=express[_0x1e2e('0x1')]();var auth=require(_0x1e2e('0x2'));var controller=require(_0x1e2e('0x3'));router['get']('/',controller[_0x1e2e('0x4')]);router[_0x1e2e('0x5')](_0x1e2e('0x6'),auth[_0x1e2e('0x7')](),auth[_0x1e2e('0x8')](),controller[_0x1e2e('0x9')]);router[_0x1e2e('0x5')](_0x1e2e('0xa'),auth[_0x1e2e('0x7')](),auth[_0x1e2e('0x8')](),controller[_0x1e2e('0xb')]);router[_0x1e2e('0x5')](_0x1e2e('0xc'),auth[_0x1e2e('0x7')](),auth[_0x1e2e('0x8')](),controller['pull']);router['get'](_0x1e2e('0xd'),auth[_0x1e2e('0x7')](),controller[_0x1e2e('0xe')]);router[_0x1e2e('0x5')](_0x1e2e('0xf'),controller[_0x1e2e('0x10')]);module[_0x1e2e('0x11')]=router; \ No newline at end of file +var _0xfefd=['reset','/pull','pull','/restart','restart','/migrations','exports','express','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset'];(function(_0x2b3b08,_0x1e51ad){var _0x3d0447=function(_0x658935){while(--_0x658935){_0x2b3b08['push'](_0x2b3b08['shift']());}};_0x3d0447(++_0x1e51ad);}(_0xfefd,0x157));var _0xdfef=function(_0x533381,_0x8a69fa){_0x533381=_0x533381-0x0;var _0x2877ed=_0xfefd[_0x533381];return _0x2877ed;};'use strict';var express=require(_0xdfef('0x0'));var router=express['Router']();var auth=require(_0xdfef('0x1'));var controller=require('./version.controller');router[_0xdfef('0x2')]('/',controller[_0xdfef('0x3')]);router[_0xdfef('0x2')](_0xdfef('0x4'),auth[_0xdfef('0x5')](),auth[_0xdfef('0x6')](),controller[_0xdfef('0x7')]);router['get'](_0xdfef('0x8'),auth[_0xdfef('0x5')](),auth[_0xdfef('0x6')](),controller[_0xdfef('0x9')]);router[_0xdfef('0x2')](_0xdfef('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xdfef('0xb')]);router[_0xdfef('0x2')](_0xdfef('0xc'),auth[_0xdfef('0x5')](),controller[_0xdfef('0xd')]);router[_0xdfef('0x2')](_0xdfef('0xe'),controller['migrations']);module[_0xdfef('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index b9034c6..4c2106f 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 _0x3344=['Migration','getQueryInterface','constructor','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','sequelize','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard','pull','npm\x20install\x20--production','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','length','replace','.js','version','sort'];(function(_0x323fca,_0x369c53){var _0x2f4122=function(_0x8d8818){while(--_0x8d8818){_0x323fca['push'](_0x323fca['shift']());}};_0x2f4122(++_0x369c53);}(_0x3344,0xa9));var _0x4334=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3344[_0x20a584];return _0x4b41a8;};'use strict';var Umzug=require(_0x4334('0x0'));var path=require(_0x4334('0x1'));var fs=require('fs');var _=require(_0x4334('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x4334('0x3'));var exec=require(_0x4334('0x4'))[_0x4334('0x5')];var db=require(_0x4334('0x6'))['db'];var config=require(_0x4334('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x4334('0x8'))(_0x4334('0x9'));var git=require(_0x4334('0xa'))(config['root']);exports['index']=function(_0x422da8,_0x347898){var _0x1ea05a={'current':module[_0x4334('0xb')]['version'],'phonebar':0x2};if(_0x422da8[_0x4334('0xc')]&&_0x422da8[_0x4334('0xc')][_0x4334('0xd')]){return git[_0x4334('0xe')]()[_0x4334('0xf')](function(_0x242f84,_0x20de95){_0x1ea05a[_0x4334('0xd')]=(_0x242f84?module[_0x4334('0xb')]['version']:_0x20de95['latest'])||_0x4334('0x10');return _0x347898[_0x4334('0x11')](0xc8)[_0x4334('0x12')](_0x1ea05a);});}else{return _0x347898[_0x4334('0x11')](0xc8)[_0x4334('0x12')](_0x1ea05a);}};exports[_0x4334('0xe')]=function(_0x696bb8,_0x13c364){return git[_0x4334('0xe')]([_0x4334('0x13'),_0x4334('0x14')],function(_0x154bd8){if(_0x154bd8){logger[_0x4334('0x15')](_0x154bd8);return _0x13c364[_0x4334('0x11')](0x1f4)[_0x4334('0x12')](_0x154bd8);}logger['info'](_0x4334('0x16'));return _0x13c364[_0x4334('0x11')](0xc8)[_0x4334('0x12')]({'output':_0x4334('0x17')});});};exports[_0x4334('0x18')]=function(_0x43d473,_0x2e009a){return git[_0x4334('0x18')]([_0x4334('0x19'),_0x4334('0x1a')],function(_0x42b1f7){if(_0x42b1f7){logger['error'](_0x42b1f7);return _0x2e009a[_0x4334('0x11')](0x1f4)[_0x4334('0x12')](_0x42b1f7);}logger[_0x4334('0x1b')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x2e009a[_0x4334('0x11')](0xc8)[_0x4334('0x12')]({'output':_0x4334('0x1c')});});};exports[_0x4334('0x1d')]=function(_0x2e6f90,_0x32c995){exec(_0x4334('0x1e'),function(_0x44cb7c,_0x205c39,_0x239207){logger['info'](_0x205c39);logger[_0x4334('0x1b')](_0x239207);if(_0x44cb7c){logger[_0x4334('0x15')](_0x44cb7c);return _0x32c995[_0x4334('0x11')](0x1f4)[_0x4334('0x12')](_0x44cb7c);}return _0x32c995[_0x4334('0x11')](0xc8)[_0x4334('0x12')]({'output':_0x205c39});});};exports['restart']=function(_0x4b9ae0,_0x4d725e){return pm2['restart']('motion2')[_0x4334('0x1f')](function(_0x178098){logger['info']('pm2\x20restart\x20motion\x20%s',_0x178098);return _0x4d725e[_0x4334('0x11')](0xc8)['json']({'output':_0x4334('0x20')});})[_0x4334('0x21')](function(_0x2ffdb9){logger[_0x4334('0x15')](_0x2ffdb9);return _0x4d725e[_0x4334('0x11')](0x1f4)[_0x4334('0x12')](_0x2ffdb9);});};exports[_0x4334('0x22')]=function(_0x369c26,_0x1f5732){var _0xe2d878=fs[_0x4334('0x23')](path[_0x4334('0x24')](config[_0x4334('0x25')],'server',_0x4334('0x22')));var _0x3269c8=[];for(var _0x1dfd3d=0x0;_0x1dfd3d<_0xe2d878[_0x4334('0x26')];_0x1dfd3d++){var _0x55b6c9=_0xe2d878[_0x1dfd3d][_0x4334('0x27')](_0x4334('0x28'),'');if(compareVersions(module[_0x4334('0xb')][_0x4334('0x29')],_0x55b6c9)===-0x1){_0x3269c8['push'](_0x55b6c9);}}if(_0x3269c8[_0x4334('0x26')]){var _0x33ec13=_0x3269c8[_0x4334('0x2a')](compareVersions);var _0x32683e=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x4334('0x2b')],'modelName':_0x4334('0x2b'),'columnName':_0x4334('0x29')},'migrations':{'params':[db['sequelize'][_0x4334('0x2c')](),db['sequelize'][_0x4334('0x2d')],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['join'](config[_0x4334('0x25')],_0x4334('0x2e'),_0x4334('0x22')),'pattern':/\.js$/}});_0x32683e['up']({'migrations':_[_0x4334('0x2f')](_0x33ec13,function(_0x4a743d){return _0x4a743d+_0x4334('0x28');})})[_0x4334('0x1f')](function(){return _0x1f5732[_0x4334('0x11')](0xc8)[_0x4334('0x12')]({'output':_0x4334('0x30')+module[_0x4334('0xb')][_0x4334('0x29')]+_0x4334('0x31')+_[_0x4334('0x32')](_0x33ec13),'migrations':_[_0x4334('0x24')](_0x33ec13)});})[_0x4334('0x21')](function(_0x48e467){if(_0x48e467 instanceof db[_0x4334('0x33')]['UniqueConstraintError']){return _0x1f5732[_0x4334('0x11')](0xc8)[_0x4334('0x12')]({'output':_0x4334('0x34')});}else{return _0x1f5732[_0x4334('0x11')](0x1f4)['json'](_0x48e467);}});}else{return _0x1f5732[_0x4334('0x11')](0xc8)[_0x4334('0x12')]({'output':_0x4334('0x34')});}}; \ No newline at end of file +var _0x6ac6=['getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','replace','.js','length','sequelize','Migration'];(function(_0x83b8e6,_0x3a4b65){var _0x4b6433=function(_0xa4fe13){while(--_0xa4fe13){_0x83b8e6['push'](_0x83b8e6['shift']());}};_0x4b6433(++_0x3a4b65);}(_0x6ac6,0x172));var _0x66ac=function(_0x1e0e3e,_0x7bc6a5){_0x1e0e3e=_0x1e0e3e-0x0;var _0x2a5561=_0x6ac6[_0x1e0e3e];return _0x2a5561;};'use strict';var Umzug=require(_0x66ac('0x0'));var path=require(_0x66ac('0x1'));var fs=require('fs');var _=require(_0x66ac('0x2'));var pkginfo=require(_0x66ac('0x3'))(module,_0x66ac('0x4'));var compareVersions=require(_0x66ac('0x5'));var exec=require(_0x66ac('0x6'))[_0x66ac('0x7')];var db=require('../../mysqldb')['db'];var config=require(_0x66ac('0x8'));var pm2=require(_0x66ac('0x9'));var logger=require(_0x66ac('0xa'))(_0x66ac('0xb'));var git=require(_0x66ac('0xc'))(config['root']);exports[_0x66ac('0xd')]=function(_0x4cd1ba,_0x17ffea){var _0x4ac3bd={'current':module[_0x66ac('0xe')][_0x66ac('0x4')],'phonebar':0x2};if(_0x4cd1ba[_0x66ac('0xf')]&&_0x4cd1ba['query'][_0x66ac('0x10')]){return git[_0x66ac('0x11')]()[_0x66ac('0x12')](function(_0x1750ee,_0x34a961){_0x4ac3bd[_0x66ac('0x10')]=(_0x1750ee?module['exports']['version']:_0x34a961[_0x66ac('0x10')])||_0x66ac('0x13');return _0x17ffea[_0x66ac('0x14')](0xc8)[_0x66ac('0x15')](_0x4ac3bd);});}else{return _0x17ffea['status'](0xc8)[_0x66ac('0x15')](_0x4ac3bd);}};exports['fetch']=function(_0x1b4d85,_0x1c4a88){return git[_0x66ac('0x11')](['origin','master'],function(_0x185eff){if(_0x185eff){logger[_0x66ac('0x16')](_0x185eff);return _0x1c4a88[_0x66ac('0x14')](0x1f4)[_0x66ac('0x15')](_0x185eff);}logger[_0x66ac('0x17')](_0x66ac('0x18'));return _0x1c4a88[_0x66ac('0x14')](0xc8)[_0x66ac('0x15')]({'output':_0x66ac('0x19')});});};exports[_0x66ac('0x1a')]=function(_0x183d63,_0x11b985){return git[_0x66ac('0x1a')]([_0x66ac('0x1b'),_0x66ac('0x1c')],function(_0x5000bd){if(_0x5000bd){logger[_0x66ac('0x16')](_0x5000bd);return _0x11b985[_0x66ac('0x14')](0x1f4)['json'](_0x5000bd);}logger['info'](_0x66ac('0x1d'));return _0x11b985[_0x66ac('0x14')](0xc8)[_0x66ac('0x15')]({'output':_0x66ac('0x1e')});});};exports['pull']=function(_0xac49ec,_0x2db1b3){exec(_0x66ac('0x1f'),function(_0x907503,_0x1a501d,_0x4340ca){logger['info'](_0x1a501d);logger[_0x66ac('0x17')](_0x4340ca);if(_0x907503){logger['error'](_0x907503);return _0x2db1b3[_0x66ac('0x14')](0x1f4)[_0x66ac('0x15')](_0x907503);}return _0x2db1b3[_0x66ac('0x14')](0xc8)[_0x66ac('0x15')]({'output':_0x1a501d});});};exports[_0x66ac('0x20')]=function(_0x433a23,_0x20a9b4){return pm2[_0x66ac('0x20')]('motion2')[_0x66ac('0x21')](function(_0x337e12){logger[_0x66ac('0x17')]('pm2\x20restart\x20motion\x20%s',_0x337e12);return _0x20a9b4['status'](0xc8)['json']({'output':_0x66ac('0x22')});})[_0x66ac('0x23')](function(_0x12d73b){logger[_0x66ac('0x16')](_0x12d73b);return _0x20a9b4[_0x66ac('0x14')](0x1f4)['json'](_0x12d73b);});};exports[_0x66ac('0x24')]=function(_0x358f83,_0x15c71f){var _0x2ade75=fs[_0x66ac('0x25')](path[_0x66ac('0x26')](config[_0x66ac('0x27')],_0x66ac('0x28'),'migrations'));var _0x4c0ef7=[];for(var _0x49c6c1=0x0;_0x49c6c1<_0x2ade75['length'];_0x49c6c1++){var _0x21ffb8=_0x2ade75[_0x49c6c1][_0x66ac('0x29')](_0x66ac('0x2a'),'');if(compareVersions(module[_0x66ac('0xe')][_0x66ac('0x4')],_0x21ffb8)===-0x1){_0x4c0ef7['push'](_0x21ffb8);}}if(_0x4c0ef7[_0x66ac('0x2b')]){var _0x59d777=_0x4c0ef7['sort'](compareVersions);var _0xcbcb4b=new Umzug({'storage':_0x66ac('0x2c'),'storageOptions':{'model':db[_0x66ac('0x2d')],'modelName':_0x66ac('0x2d'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0x66ac('0x2e')](),db['sequelize']['constructor'],function(){throw new Error(_0x66ac('0x2f'));}],'path':path['join'](config['root'],'server',_0x66ac('0x24')),'pattern':/\.js$/}});_0xcbcb4b['up']({'migrations':_['map'](_0x59d777,function(_0x144b6f){return _0x144b6f+_0x66ac('0x2a');})})[_0x66ac('0x21')](function(){return _0x15c71f[_0x66ac('0x14')](0xc8)[_0x66ac('0x15')]({'output':_0x66ac('0x30')+module[_0x66ac('0xe')][_0x66ac('0x4')]+_0x66ac('0x31')+_[_0x66ac('0x32')](_0x59d777),'migrations':_[_0x66ac('0x26')](_0x59d777)});})[_0x66ac('0x23')](function(_0x4a3547){if(_0x4a3547 instanceof db[_0x66ac('0x2c')]['UniqueConstraintError']){return _0x15c71f[_0x66ac('0x14')](0xc8)['json']({'output':_0x66ac('0x33')});}else{return _0x15c71f['status'](0x1f4)[_0x66ac('0x15')](_0x4a3547);}});}else{return _0x15c71f[_0x66ac('0x14')](0xc8)['json']({'output':_0x66ac('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index db438c1..d3d907d 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 _0x2150=['describe','/:id','show','post','put','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0x154727,_0x3cdc4a){var _0x1198b3=function(_0x34e891){while(--_0x34e891){_0x154727['push'](_0x154727['shift']());}};_0x1198b3(++_0x3cdc4a);}(_0x2150,0x124));var _0x0215=function(_0x4da4ea,_0x2875d3){_0x4da4ea=_0x4da4ea-0x0;var _0x3cc102=_0x2150[_0x4da4ea];return _0x3cc102;};'use strict';var multer=require('multer');var util=require(_0x0215('0x0'));var path=require(_0x0215('0x1'));var timeout=require(_0x0215('0x2'));var express=require(_0x0215('0x3'));var router=express[_0x0215('0x4')]();var fs_extra=require(_0x0215('0x5'));var auth=require(_0x0215('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0215('0x7'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth[_0x0215('0x8')](),controller[_0x0215('0x9')]);router[_0x0215('0xa')](_0x0215('0xb'),auth[_0x0215('0x8')](),controller[_0x0215('0xc')]);router[_0x0215('0xa')](_0x0215('0xd'),auth['isAuthenticated'](),controller[_0x0215('0xe')]);router[_0x0215('0xf')]('/',auth[_0x0215('0x8')](),controller['create']);router[_0x0215('0x10')](_0x0215('0xd'),auth[_0x0215('0x8')](),controller[_0x0215('0x11')]);router['delete'](_0x0215('0xd'),auth[_0x0215('0x8')](),controller[_0x0215('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5d25=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2d2b66,_0x4f52b1){var _0x23bdcf=function(_0x48f05a){while(--_0x48f05a){_0x2d2b66['push'](_0x2d2b66['shift']());}};_0x23bdcf(++_0x4f52b1);}(_0x5d25,0x103));var _0x55d2=function(_0x5aad4e,_0x219c65){_0x5aad4e=_0x5aad4e-0x0;var _0x4276c1=_0x5d25[_0x5aad4e];return _0x4276c1;};'use strict';var multer=require('multer');var util=require(_0x55d2('0x0'));var path=require('path');var timeout=require(_0x55d2('0x1'));var express=require(_0x55d2('0x2'));var router=express[_0x55d2('0x3')]();var fs_extra=require(_0x55d2('0x4'));var auth=require(_0x55d2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x55d2('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x55d2('0x7')]('/',auth[_0x55d2('0x8')](),controller[_0x55d2('0x9')]);router[_0x55d2('0x7')](_0x55d2('0xa'),auth[_0x55d2('0x8')](),controller[_0x55d2('0xb')]);router[_0x55d2('0x7')](_0x55d2('0xc'),auth[_0x55d2('0x8')](),controller[_0x55d2('0xd')]);router['post']('/',auth[_0x55d2('0x8')](),controller[_0x55d2('0xe')]);router[_0x55d2('0xf')]('/:id',auth[_0x55d2('0x8')](),controller[_0x55d2('0x10')]);router[_0x55d2('0x11')]('/:id',auth[_0x55d2('0x8')](),controller['destroy']);module[_0x55d2('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 5b10d77..5628c8e 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 _0xa5c9=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x1ef4ee,_0xd87a11){var _0xabf86f=function(_0x20a11a){while(--_0x20a11a){_0x1ef4ee['push'](_0x1ef4ee['shift']());}};_0xabf86f(++_0xd87a11);}(_0xa5c9,0x143));var _0x9a5c=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xa5c9[_0x44bcb0];return _0xfaf881;};'use strict';var Sequelize=require(_0x9a5c('0x0'));module[_0x9a5c('0x1')]={'type':{'type':Sequelize[_0x9a5c('0x2')]},'uniqueid':{'type':Sequelize[_0x9a5c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9a5c('0x2')]},'interface':{'type':Sequelize[_0x9a5c('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x9a5c('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x9a5c('0x3')]},'agentdumpAt':{'type':Sequelize[_0x9a5c('0x3')]},'holdtime':{'type':Sequelize[_0x9a5c('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x9a5c('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x9a5c('0x4')]},'agentacw':{'type':Sequelize[_0x9a5c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x9a5c('0x2')]},'lastevent':{'type':Sequelize[_0x9a5c('0x2')]},'channel':{'type':Sequelize[_0x9a5c('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x9a5c('0x2')]},'connectedlinename':{'type':Sequelize[_0x9a5c('0x2')]},'language':{'type':Sequelize[_0x9a5c('0x2')]},'accountcode':{'type':Sequelize[_0x9a5c('0x2')]},'context':{'type':Sequelize[_0x9a5c('0x2')]},'exten':{'type':Sequelize[_0x9a5c('0x2')]},'priority':{'type':Sequelize[_0x9a5c('0x2')]},'destchannel':{'type':Sequelize[_0x9a5c('0x2')]},'destchannelstate':{'type':Sequelize[_0x9a5c('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x9a5c('0x2')]},'destcalleridnum':{'type':Sequelize[_0x9a5c('0x2')]},'destcalleridname':{'type':Sequelize[_0x9a5c('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x9a5c('0x2')]},'destlanguage':{'type':Sequelize[_0x9a5c('0x2')]},'destaccountcode':{'type':Sequelize[_0x9a5c('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9a5c('0x2')]},'destpriority':{'type':Sequelize[_0x9a5c('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x9a5c('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x9a5c('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x9a5c('0x6')},'transferexten':{'type':Sequelize[_0x9a5c('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x9a5c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0e56=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x31b62a,_0x4de822){var _0x3f68d2=function(_0x57e1a6){while(--_0x57e1a6){_0x31b62a['push'](_0x31b62a['shift']());}};_0x3f68d2(++_0x4de822);}(_0x0e56,0xf5));var _0x60e5=function(_0x2867d8,_0xef3ee0){_0x2867d8=_0x2867d8-0x0;var _0x3b8176=_0x0e56[_0x2867d8];return _0x3b8176;};'use strict';var Sequelize=require(_0x60e5('0x0'));module[_0x60e5('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x60e5('0x2')]},'calleridnum':{'type':Sequelize[_0x60e5('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x60e5('0x2')]},'interface':{'type':Sequelize[_0x60e5('0x2')]},'membername':{'type':Sequelize[_0x60e5('0x2')]},'agentcalledAt':{'type':Sequelize[_0x60e5('0x3')]},'agentconnectAt':{'type':Sequelize[_0x60e5('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x60e5('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x60e5('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x60e5('0x4')]},'agentcomplete':{'type':Sequelize[_0x60e5('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x60e5('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x60e5('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x60e5('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x60e5('0x4')]},'reason':{'type':Sequelize[_0x60e5('0x2')]},'lastevent':{'type':Sequelize[_0x60e5('0x2')]},'channel':{'type':Sequelize[_0x60e5('0x2')]},'channelstate':{'type':Sequelize[_0x60e5('0x4')]},'channelstatedesc':{'type':Sequelize[_0x60e5('0x2')]},'connectedlinenum':{'type':Sequelize[_0x60e5('0x2')]},'connectedlinename':{'type':Sequelize[_0x60e5('0x2')]},'language':{'type':Sequelize[_0x60e5('0x2')]},'accountcode':{'type':Sequelize[_0x60e5('0x2')]},'context':{'type':Sequelize[_0x60e5('0x2')]},'exten':{'type':Sequelize[_0x60e5('0x2')]},'priority':{'type':Sequelize[_0x60e5('0x2')]},'destchannel':{'type':Sequelize[_0x60e5('0x2')]},'destchannelstate':{'type':Sequelize[_0x60e5('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x60e5('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x60e5('0x2')]},'destlanguage':{'type':Sequelize[_0x60e5('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x60e5('0x2')]},'destexten':{'type':Sequelize[_0x60e5('0x2')]},'destpriority':{'type':Sequelize[_0x60e5('0x2')]},'destuniqueid':{'type':Sequelize[_0x60e5('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x60e5('0x2')]},'transfer':{'type':Sequelize[_0x60e5('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x60e5('0x2')],'comment':_0x60e5('0x6')},'transferexten':{'type':Sequelize[_0x60e5('0x2')]},'transferuniqueid':{'type':Sequelize[_0x60e5('0x2')]},'agententerreason':{'type':Sequelize[_0x60e5('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 2e70d17..4e91efa 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(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 cbed8ac..399693f 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 _0xca8d=['report_agent','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x12adc,_0x1bb467){var _0x547ee0=function(_0x31af14){while(--_0x31af14){_0x12adc['push'](_0x12adc['shift']());}};_0x547ee0(++_0x1bb467);}(_0xca8d,0x172));var _0xdca8=function(_0x2e1af3,_0x2a077b){_0x2e1af3=_0x2e1af3-0x0;var _0x4150cd=_0xca8d[_0x2e1af3];return _0x4150cd;};'use strict';var _=require(_0xdca8('0x0'));var util=require(_0xdca8('0x1'));var logger=require(_0xdca8('0x2'))(_0xdca8('0x3'));var moment=require(_0xdca8('0x4'));var BPromise=require(_0xdca8('0x5'));var rp=require(_0xdca8('0x6'));var fs=require('fs');var path=require(_0xdca8('0x7'));var rimraf=require(_0xdca8('0x8'));var config=require(_0xdca8('0x9'));var attributes=require(_0xdca8('0xa'));module[_0xdca8('0xb')]=function(_0x4d6383,_0x3366d5){return _0x4d6383[_0xdca8('0xc')](_0xdca8('0xd'),attributes,{'tableName':_0xdca8('0xe'),'paranoid':![],'indexes':[{'fields':[_0xdca8('0xf'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2fed=['path','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xf0dcdb,_0x476d0a){var _0x486d28=function(_0x3a580b){while(--_0x3a580b){_0xf0dcdb['push'](_0xf0dcdb['shift']());}};_0x486d28(++_0x476d0a);}(_0x2fed,0x7c));var _0xd2fe=function(_0x2876ee,_0x430597){_0x2876ee=_0x2876ee-0x0;var _0x2eeb4e=_0x2fed[_0x2876ee];return _0x2eeb4e;};'use strict';var _=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var logger=require(_0xd2fe('0x2'))(_0xd2fe('0x3'));var moment=require(_0xd2fe('0x4'));var BPromise=require('bluebird');var rp=require(_0xd2fe('0x5'));var fs=require('fs');var path=require(_0xd2fe('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd2fe('0x7'));module[_0xd2fe('0x8')]=function(_0xd85f89,_0x5be4d3){return _0xd85f89[_0xd2fe('0x9')](_0xd2fe('0xa'),attributes,{'tableName':_0xd2fe('0xb'),'paranoid':![],'indexes':[{'fields':[_0xd2fe('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index c03d253..0c4e198 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 _0x2353=['info','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','raw','stringify','options','where','attributes','limit','UpdateVoiceAgentReport','catch','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceAgentReport,\x20%s,\x20%s'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x2353,0x8a));var _0x3235=function(_0x33d4ac,_0x282192){_0x33d4ac=_0x33d4ac-0x0;var _0x4015e1=_0x2353[_0x33d4ac];return _0x4015e1;};'use strict';var _=require('lodash');var util=require(_0x3235('0x0'));var moment=require(_0x3235('0x1'));var BPromise=require(_0x3235('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(_0x3235('0x3'))(_0x3235('0x4'));var config=require(_0x3235('0x5'));var jayson=require(_0x3235('0x6'));var client=jayson['client'][_0x3235('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4db164,_0x4eb0f1,_0x1eee12){return new BPromise(function(_0x11259d,_0x51cceb){return client[_0x3235('0x8')](_0x4db164,_0x1eee12)[_0x3235('0x9')](function(_0x52a9a0){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x4eb0f1,_0x3235('0xa'));logger[_0x3235('0xb')](_0x3235('0xc'),_0x4eb0f1,'request\x20sent',JSON['stringify'](_0x52a9a0));if(_0x52a9a0[_0x3235('0xd')]){if(_0x52a9a0[_0x3235('0xd')][_0x3235('0xe')]===0x1f4){logger[_0x3235('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x4eb0f1,_0x52a9a0['error'][_0x3235('0xf')]);return _0x51cceb(_0x52a9a0[_0x3235('0xd')][_0x3235('0xf')]);}logger[_0x3235('0xd')](_0x3235('0x10'),_0x4eb0f1,_0x52a9a0[_0x3235('0xd')]['message']);return _0x11259d(_0x52a9a0['error']['message']);}else{logger[_0x3235('0x11')](_0x3235('0x10'),_0x4eb0f1,_0x3235('0xa'));_0x11259d(_0x52a9a0[_0x3235('0x12')][_0x3235('0xf')]);}})['catch'](function(_0x194b99){logger[_0x3235('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x4eb0f1,_0x194b99);_0x51cceb(_0x194b99);});});}exports[_0x3235('0x13')]=function(_0x4bf1d9){var _0x275354=this;return new Promise(function(_0x167969,_0x473274){return db[_0x3235('0x14')][_0x3235('0x15')](_0x4bf1d9[_0x3235('0x16')],{'raw':_0x4bf1d9['options']?_0x4bf1d9['options'][_0x3235('0x17')]===undefined?!![]:![]:!![]})[_0x3235('0x9')](function(_0x43965b){logger[_0x3235('0x11')](_0x3235('0x13'),_0x4bf1d9);logger[_0x3235('0xb')](_0x3235('0x13'),_0x4bf1d9,JSON[_0x3235('0x18')](_0x43965b));_0x167969(_0x43965b);})['catch'](function(_0x3bde4e){logger['error'](_0x3235('0x13'),_0x3bde4e['message'],_0x4bf1d9);_0x473274(_0x275354['error'](0x1f4,_0x3bde4e[_0x3235('0xf')]));});});};exports['UpdateVoiceAgentReport']=function(_0xc6e269){var _0x4c0677=this;return new Promise(function(_0x2b3939,_0x20cf25){return db['VoiceAgentReport']['update'](_0xc6e269['body'],{'raw':_0xc6e269[_0x3235('0x19')]?_0xc6e269[_0x3235('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc6e269['options']?_0xc6e269[_0x3235('0x19')][_0x3235('0x1a')]||null:null,'attributes':_0xc6e269[_0x3235('0x19')]?_0xc6e269[_0x3235('0x19')][_0x3235('0x1b')]||null:null,'limit':_0xc6e269[_0x3235('0x19')]?_0xc6e269[_0x3235('0x19')][_0x3235('0x1c')]||null:null})['then'](function(_0x1ad88a){logger[_0x3235('0x11')](_0x3235('0x1d'),_0xc6e269);logger['debug'](_0x3235('0x1d'),_0xc6e269,JSON[_0x3235('0x18')](_0x1ad88a));_0x2b3939(_0x1ad88a);})[_0x3235('0x1e')](function(_0x41cda2){logger[_0x3235('0xd')](_0x3235('0x1d'),_0x41cda2[_0x3235('0xf')],_0xc6e269);_0x20cf25(_0x4c0677[_0x3235('0xd')](0x1f4,_0x41cda2[_0x3235('0xf')]));});});}; \ No newline at end of file +var _0x03fe=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','UpdateVoiceAgentReport','update','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x16b4d9,_0x5eb8a9){var _0x43dcf2=function(_0x216ede){while(--_0x216ede){_0x16b4d9['push'](_0x16b4d9['shift']());}};_0x43dcf2(++_0x5eb8a9);}(_0x03fe,0x1c6));var _0xe03f=function(_0x4dd35e,_0x5ed0c2){_0x4dd35e=_0x4dd35e-0x0;var _0x4dfbc7=_0x03fe[_0x4dd35e];return _0x4dfbc7;};'use strict';var _=require(_0xe03f('0x0'));var util=require(_0xe03f('0x1'));var moment=require(_0xe03f('0x2'));var BPromise=require(_0xe03f('0x3'));var rs=require(_0xe03f('0x4'));var fs=require('fs');var Redis=require(_0xe03f('0x5'));var db=require(_0xe03f('0x6'))['db'];var utils=require(_0xe03f('0x7'));var logger=require(_0xe03f('0x8'))(_0xe03f('0x9'));var config=require(_0xe03f('0xa'));var jayson=require(_0xe03f('0xb'));var client=jayson['client'][_0xe03f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23e694,_0x4cd619,_0x309520){return new BPromise(function(_0x3ad34f,_0x556d29){return client['request'](_0x23e694,_0x309520)[_0xe03f('0xd')](function(_0x5c0297){logger[_0xe03f('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x4cd619,_0xe03f('0xf'));logger['debug'](_0xe03f('0x10'),_0x4cd619,_0xe03f('0xf'),JSON[_0xe03f('0x11')](_0x5c0297));if(_0x5c0297[_0xe03f('0x12')]){if(_0x5c0297[_0xe03f('0x12')][_0xe03f('0x13')]===0x1f4){logger[_0xe03f('0x12')](_0xe03f('0x14'),_0x4cd619,_0x5c0297[_0xe03f('0x12')][_0xe03f('0x15')]);return _0x556d29(_0x5c0297[_0xe03f('0x12')][_0xe03f('0x15')]);}logger['error'](_0xe03f('0x14'),_0x4cd619,_0x5c0297['error']['message']);return _0x3ad34f(_0x5c0297[_0xe03f('0x12')][_0xe03f('0x15')]);}else{logger['info'](_0xe03f('0x14'),_0x4cd619,_0xe03f('0xf'));_0x3ad34f(_0x5c0297['result']['message']);}})[_0xe03f('0x16')](function(_0x5cbe6a){logger[_0xe03f('0x12')](_0xe03f('0x14'),_0x4cd619,_0x5cbe6a);_0x556d29(_0x5cbe6a);});});}exports[_0xe03f('0x17')]=function(_0x1c8591){var _0x27eaef=this;return new Promise(function(_0x2ae8f6,_0x39531d){return db[_0xe03f('0x18')]['create'](_0x1c8591[_0xe03f('0x19')],{'raw':_0x1c8591[_0xe03f('0x1a')]?_0x1c8591[_0xe03f('0x1a')][_0xe03f('0x1b')]===undefined?!![]:![]:!![]})[_0xe03f('0xd')](function(_0x199d39){logger['info']('CreateVoiceAgentReport',_0x1c8591);logger['debug']('CreateVoiceAgentReport',_0x1c8591,JSON[_0xe03f('0x11')](_0x199d39));_0x2ae8f6(_0x199d39);})[_0xe03f('0x16')](function(_0x2684c6){logger['error'](_0xe03f('0x17'),_0x2684c6['message'],_0x1c8591);_0x39531d(_0x27eaef[_0xe03f('0x12')](0x1f4,_0x2684c6[_0xe03f('0x15')]));});});};exports[_0xe03f('0x1c')]=function(_0x3ae1bc){var _0x3d7b24=this;return new Promise(function(_0x46aa2e,_0x57e911){return db['VoiceAgentReport'][_0xe03f('0x1d')](_0x3ae1bc[_0xe03f('0x19')],{'raw':_0x3ae1bc['options']?_0x3ae1bc[_0xe03f('0x1a')][_0xe03f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ae1bc[_0xe03f('0x1a')]?_0x3ae1bc[_0xe03f('0x1a')]['where']||null:null,'attributes':_0x3ae1bc['options']?_0x3ae1bc[_0xe03f('0x1a')][_0xe03f('0x1e')]||null:null,'limit':_0x3ae1bc[_0xe03f('0x1a')]?_0x3ae1bc[_0xe03f('0x1a')][_0xe03f('0x1f')]||null:null})[_0xe03f('0xd')](function(_0x50619c){logger[_0xe03f('0xe')]('UpdateVoiceAgentReport',_0x3ae1bc);logger[_0xe03f('0x20')](_0xe03f('0x1c'),_0x3ae1bc,JSON[_0xe03f('0x11')](_0x50619c));_0x46aa2e(_0x50619c);})[_0xe03f('0x16')](function(_0x389cb5){logger[_0xe03f('0x12')](_0xe03f('0x1c'),_0x389cb5['message'],_0x3ae1bc);_0x57e911(_0x3d7b24[_0xe03f('0x12')](0x1f4,_0x389cb5[_0xe03f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index f654be4..789f268 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 _0xae24=['./voiceCallReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','delete','exports','multer','path','express','Router','../../components/interaction/service'];(function(_0x3caeb5,_0x219363){var _0x5eca7e=function(_0x4cae6b){while(--_0x4cae6b){_0x3caeb5['push'](_0x3caeb5['shift']());}};_0x5eca7e(++_0x219363);}(_0xae24,0x182));var _0x4ae2=function(_0x3b86b6,_0x8c5cd2){_0x3b86b6=_0x3b86b6-0x0;var _0x2d189e=_0xae24[_0x3b86b6];return _0x2d189e;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ae2('0x4'));var config=require('../../config/environment');var controller=require(_0x4ae2('0x5'));router[_0x4ae2('0x6')]('/',auth[_0x4ae2('0x7')](),controller[_0x4ae2('0x8')]);router[_0x4ae2('0x6')](_0x4ae2('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x4ae2('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x4ae2('0xa')]);router[_0x4ae2('0xb')]('/',auth['isAuthenticated'](),controller[_0x4ae2('0xc')]);router[_0x4ae2('0xd')](_0x4ae2('0xe'),auth[_0x4ae2('0x7')](),controller['update']);router[_0x4ae2('0xf')](_0x4ae2('0xe'),auth[_0x4ae2('0x7')](),controller['destroy']);module[_0x4ae2('0x10')]=router; \ No newline at end of file +var _0x80d9=['get','/:id','show','post','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','index','isAuthenticated','describe'];(function(_0x1417d5,_0x2a7207){var _0x28a744=function(_0x31a1ce){while(--_0x31a1ce){_0x1417d5['push'](_0x1417d5['shift']());}};_0x28a744(++_0x2a7207);}(_0x80d9,0x15c));var _0x980d=function(_0x2892e0,_0x558255){_0x2892e0=_0x2892e0-0x0;var _0x54af71=_0x80d9[_0x2892e0];return _0x54af71;};'use strict';var multer=require(_0x980d('0x0'));var util=require('util');var path=require(_0x980d('0x1'));var timeout=require(_0x980d('0x2'));var express=require(_0x980d('0x3'));var router=express['Router']();var fs_extra=require(_0x980d('0x4'));var auth=require(_0x980d('0x5'));var interaction=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var controller=require(_0x980d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x980d('0x9')]);router['get']('/describe',auth[_0x980d('0xa')](),controller[_0x980d('0xb')]);router[_0x980d('0xc')](_0x980d('0xd'),auth[_0x980d('0xa')](),controller[_0x980d('0xe')]);router[_0x980d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x980d('0xd'),auth[_0x980d('0xa')](),controller['update']);router[_0x980d('0x10')]('/:id',auth[_0x980d('0xa')](),controller['destroy']);module[_0x980d('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 6d3f12f..cd85310 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 _0xe3cf=['outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING'];(function(_0x2d3e79,_0x8f88a1){var _0x3ceeb6=function(_0x42bea9){while(--_0x42bea9){_0x2d3e79['push'](_0x2d3e79['shift']());}};_0x3ceeb6(++_0x8f88a1);}(_0xe3cf,0x16f));var _0xfe3c=function(_0x491adc,_0x1aa81a){_0x491adc=_0x491adc-0x0;var _0x47f7d1=_0xe3cf[_0x491adc];return _0x47f7d1;};'use strict';var Sequelize=require(_0xfe3c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xfe3c('0x1')]},'type':{'type':Sequelize['ENUM']('inbound','internal',_0xfe3c('0x2'),_0xfe3c('0x3'),_0xfe3c('0x4'),_0xfe3c('0x5'))},'tag':{'type':Sequelize[_0xfe3c('0x1')]},'accountcode':{'type':Sequelize[_0xfe3c('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xfe3c('0x1')]},'destinationcontext':{'type':Sequelize[_0xfe3c('0x1')]},'callerid':{'type':Sequelize[_0xfe3c('0x1')]},'channel':{'type':Sequelize[_0xfe3c('0x1')]},'destinationchannel':{'type':Sequelize[_0xfe3c('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xfe3c('0x6')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xfe3c('0x7')]},'answertime':{'type':Sequelize[_0xfe3c('0x7')]},'endtime':{'type':Sequelize[_0xfe3c('0x7')]},'duration':{'type':Sequelize[_0xfe3c('0x8')]},'billableseconds':{'type':Sequelize[_0xfe3c('0x8')]},'mohtime':{'type':Sequelize[_0xfe3c('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xfe3c('0x1')]},'userfield':{'type':Sequelize[_0xfe3c('0x1')]},'userDisposition':{'type':Sequelize[_0xfe3c('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfe3c('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xfe3c('0x8')]},'sipcallid':{'type':Sequelize[_0xfe3c('0x1')]}}; \ No newline at end of file +var _0x5b2e=['DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0x5a27b4,_0x4155b8){var _0x5396b7=function(_0x2e63c3){while(--_0x2e63c3){_0x5a27b4['push'](_0x5a27b4['shift']());}};_0x5396b7(++_0x4155b8);}(_0x5b2e,0x147));var _0xe5b2=function(_0x241e44,_0x174a0e){_0x241e44=_0x241e44-0x0;var _0x586463=_0x5b2e[_0x241e44];return _0x586463;};'use strict';var Sequelize=require(_0xe5b2('0x0'));module[_0xe5b2('0x1')]={'uniqueid':{'type':Sequelize[_0xe5b2('0x2')]},'type':{'type':Sequelize[_0xe5b2('0x3')](_0xe5b2('0x4'),_0xe5b2('0x5'),_0xe5b2('0x6'),_0xe5b2('0x7'),_0xe5b2('0x8'),_0xe5b2('0x9'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe5b2('0x2')]},'source':{'type':Sequelize[_0xe5b2('0x2')]},'destination':{'type':Sequelize[_0xe5b2('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe5b2('0x2')]},'channel':{'type':Sequelize[_0xe5b2('0x2')]},'destinationchannel':{'type':Sequelize[_0xe5b2('0x2')]},'lastapplication':{'type':Sequelize[_0xe5b2('0x2')]},'lastdata':{'type':Sequelize[_0xe5b2('0xa')]},'starttime':{'type':Sequelize[_0xe5b2('0xb')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe5b2('0xb')]},'endtime':{'type':Sequelize[_0xe5b2('0xb')]},'duration':{'type':Sequelize[_0xe5b2('0xc')]},'billableseconds':{'type':Sequelize[_0xe5b2('0xc')]},'mohtime':{'type':Sequelize[_0xe5b2('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe5b2('0x2')]},'amaflags':{'type':Sequelize[_0xe5b2('0x2')]},'userfield':{'type':Sequelize[_0xe5b2('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xe5b2('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xe5b2('0x2')]},'note':{'type':Sequelize[_0xe5b2('0x2')]},'prefix':{'type':Sequelize[_0xe5b2('0x2')]},'routeid':{'type':Sequelize[_0xe5b2('0xc')]},'sipcallid':{'type':Sequelize[_0xe5b2('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index e6ac8ca..37ea21c 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x5e2c51,_0x6eb503){var _0x34bf2a=function(_0x4527c7){while(--_0x4527c7){_0x5e2c51['push'](_0x5e2c51['shift']());}};_0x34bf2a(++_0x6eb503);}(_0xdb28,0x106));var _0x8db2=function(_0x2970da,_0x405aa6){_0x2970da=_0x2970da-0x0;var _0x5f0d7d=_0xdb28[_0x2970da];return _0x5f0d7d;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 54ec68a..cb0293f 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 _0xb6b5=['./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0xb6b5,0xaf));var _0x5b6b=function(_0x58d9c5,_0x575cb7){_0x58d9c5=_0x58d9c5-0x0;var _0x4ade69=_0xb6b5[_0x58d9c5];return _0x4ade69;};'use strict';var _=require(_0x5b6b('0x0'));var util=require('util');var logger=require(_0x5b6b('0x1'))(_0x5b6b('0x2'));var moment=require('moment');var BPromise=require(_0x5b6b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b6b('0x4'));var rimraf=require(_0x5b6b('0x5'));var config=require(_0x5b6b('0x6'));var attributes=require(_0x5b6b('0x7'));module[_0x5b6b('0x8')]=function(_0x2c6f08,_0x10d213){return _0x2c6f08[_0x5b6b('0x9')](_0x5b6b('0xa'),attributes,{'tableName':_0x5b6b('0xb'),'paranoid':![],'indexes':[{'fields':[_0x5b6b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6be5=['exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','api','moment','request-promise','./voiceCallReport.attributes'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x6be5,0x144));var _0x56be=function(_0x2f265f,_0x20599c){_0x2f265f=_0x2f265f-0x0;var _0x43350d=_0x6be5[_0x2f265f];return _0x43350d;};'use strict';var _=require(_0x56be('0x0'));var util=require('util');var logger=require(_0x56be('0x1'))(_0x56be('0x2'));var moment=require(_0x56be('0x3'));var BPromise=require('bluebird');var rp=require(_0x56be('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x56be('0x5'));module[_0x56be('0x6')]=function(_0x2a18a3,_0x5b8efc){return _0x2a18a3[_0x56be('0x7')](_0x56be('0x8'),attributes,{'tableName':_0x56be('0x9'),'paranoid':![],'indexes':[{'fields':[_0x56be('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index fb5c027..e970d6d 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 _0xbbe8=['VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','attributes','limit','include','map','model','CreateVoiceCallReport','body','raw','UpdateVoiceCallReport','update','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xbbe8,0x84));var _0x8bbe=function(_0x4846fd,_0x37a6ba){_0x4846fd=_0x4846fd-0x0;var _0x5d7fba=_0xbbe8[_0x4846fd];return _0x5d7fba;};'use strict';var _=require(_0x8bbe('0x0'));var util=require('util');var moment=require(_0x8bbe('0x1'));var BPromise=require(_0x8bbe('0x2'));var rs=require(_0x8bbe('0x3'));var fs=require('fs');var Redis=require(_0x8bbe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8bbe('0x5'));var logger=require(_0x8bbe('0x6'))('rpc');var config=require(_0x8bbe('0x7'));var jayson=require(_0x8bbe('0x8'));var client=jayson[_0x8bbe('0x9')][_0x8bbe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f890,_0xd99369,_0x22a1bd){return new BPromise(function(_0x18ade6,_0x348589){return client[_0x8bbe('0xb')](_0xe5f890,_0x22a1bd)[_0x8bbe('0xc')](function(_0x2c7d79){logger[_0x8bbe('0xd')](_0x8bbe('0xe'),_0xd99369,'request\x20sent');logger[_0x8bbe('0xf')](_0x8bbe('0x10'),_0xd99369,_0x8bbe('0x11'),JSON[_0x8bbe('0x12')](_0x2c7d79));if(_0x2c7d79[_0x8bbe('0x13')]){if(_0x2c7d79[_0x8bbe('0x13')][_0x8bbe('0x14')]===0x1f4){logger[_0x8bbe('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0xd99369,_0x2c7d79[_0x8bbe('0x13')][_0x8bbe('0x15')]);return _0x348589(_0x2c7d79['error'][_0x8bbe('0x15')]);}logger['error'](_0x8bbe('0xe'),_0xd99369,_0x2c7d79[_0x8bbe('0x13')][_0x8bbe('0x15')]);return _0x18ade6(_0x2c7d79['error'][_0x8bbe('0x15')]);}else{logger[_0x8bbe('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0xd99369,_0x8bbe('0x11'));_0x18ade6(_0x2c7d79['result'][_0x8bbe('0x15')]);}})[_0x8bbe('0x16')](function(_0x200f3a){logger[_0x8bbe('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0xd99369,_0x200f3a);_0x348589(_0x200f3a);});});}exports[_0x8bbe('0x17')]=function(_0x4b8e34){var _0x345324=this;return new Promise(function(_0x1e1576,_0x3c63dc){return db[_0x8bbe('0x18')][_0x8bbe('0x19')]({'raw':_0x4b8e34['options']?_0x4b8e34[_0x8bbe('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4b8e34[_0x8bbe('0x1a')]?_0x4b8e34[_0x8bbe('0x1a')]['where']||null:null,'attributes':_0x4b8e34['options']?_0x4b8e34[_0x8bbe('0x1a')][_0x8bbe('0x1b')]||null:null,'limit':_0x4b8e34[_0x8bbe('0x1a')]?_0x4b8e34['options'][_0x8bbe('0x1c')]||null:null,'include':_0x4b8e34[_0x8bbe('0x1a')]?_0x4b8e34[_0x8bbe('0x1a')][_0x8bbe('0x1d')]?_[_0x8bbe('0x1e')](_0x4b8e34[_0x8bbe('0x1a')]['include'],function(_0x5e3c90){return{'model':db[_0x5e3c90['model']],'as':_0x5e3c90['as'],'attributes':_0x5e3c90[_0x8bbe('0x1b')],'include':_0x5e3c90[_0x8bbe('0x1d')]?_[_0x8bbe('0x1e')](_0x5e3c90[_0x8bbe('0x1d')],function(_0x459a37){return{'model':db[_0x459a37[_0x8bbe('0x1f')]],'as':_0x459a37['as'],'attributes':_0x459a37[_0x8bbe('0x1b')],'include':_0x459a37['include']?_[_0x8bbe('0x1e')](_0x459a37[_0x8bbe('0x1d')],function(_0xbe69e1){return{'model':db[_0xbe69e1[_0x8bbe('0x1f')]],'as':_0xbe69e1['as'],'attributes':_0xbe69e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x8bbe('0xc')](function(_0x3b8424){logger['info'](_0x8bbe('0x17'),_0x4b8e34);logger[_0x8bbe('0xf')](_0x8bbe('0x17'),_0x4b8e34,JSON[_0x8bbe('0x12')](_0x3b8424));_0x1e1576(_0x3b8424);})['catch'](function(_0x26e384){logger[_0x8bbe('0x13')](_0x8bbe('0x17'),_0x26e384[_0x8bbe('0x15')],_0x4b8e34);_0x3c63dc(_0x345324[_0x8bbe('0x13')](0x1f4,_0x26e384['message']));});});};exports[_0x8bbe('0x20')]=function(_0x1a504b){var _0x51aec3=this;return new Promise(function(_0x2ed740,_0x566935){return db['VoiceCallReport']['create'](_0x1a504b[_0x8bbe('0x21')],{'raw':_0x1a504b[_0x8bbe('0x1a')]?_0x1a504b[_0x8bbe('0x1a')][_0x8bbe('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x1c9bcc){logger[_0x8bbe('0xd')](_0x8bbe('0x20'),_0x1a504b);logger[_0x8bbe('0xf')](_0x8bbe('0x20'),_0x1a504b,JSON[_0x8bbe('0x12')](_0x1c9bcc));_0x2ed740(_0x1c9bcc);})[_0x8bbe('0x16')](function(_0x40eb7e){logger[_0x8bbe('0x13')](_0x8bbe('0x20'),_0x40eb7e[_0x8bbe('0x15')],_0x1a504b);_0x566935(_0x51aec3['error'](0x1f4,_0x40eb7e[_0x8bbe('0x15')]));});});};exports[_0x8bbe('0x23')]=function(_0x319dc6){var _0x3485bc=this;return new Promise(function(_0x54ea3b,_0x2754e1){return db[_0x8bbe('0x18')][_0x8bbe('0x24')](_0x319dc6[_0x8bbe('0x21')],{'raw':_0x319dc6['options']?_0x319dc6['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x319dc6[_0x8bbe('0x1a')]?_0x319dc6[_0x8bbe('0x1a')]['where']||null:null,'attributes':_0x319dc6[_0x8bbe('0x1a')]?_0x319dc6[_0x8bbe('0x1a')]['attributes']||null:null,'limit':_0x319dc6['options']?_0x319dc6[_0x8bbe('0x1a')]['limit']||null:null})[_0x8bbe('0xc')](function(_0x12fe20){logger['info'](_0x8bbe('0x23'),_0x319dc6);logger[_0x8bbe('0xf')](_0x8bbe('0x23'),_0x319dc6,JSON['stringify'](_0x12fe20));_0x54ea3b(_0x12fe20);})[_0x8bbe('0x16')](function(_0x341590){logger[_0x8bbe('0x13')]('UpdateVoiceCallReport',_0x341590[_0x8bbe('0x15')],_0x319dc6);_0x2754e1(_0x3485bc[_0x8bbe('0x13')](0x1f4,_0x341590['message']));});});}; \ No newline at end of file +var _0x7dda=['create','body','debug','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x277f27,_0x53d3d4){var _0x370639=function(_0x345cd6){while(--_0x345cd6){_0x277f27['push'](_0x277f27['shift']());}};_0x370639(++_0x53d3d4);}(_0x7dda,0x109));var _0xa7dd=function(_0x7bc22e,_0x322835){_0x7bc22e=_0x7bc22e-0x0;var _0x49c098=_0x7dda[_0x7bc22e];return _0x49c098;};'use strict';var _=require(_0xa7dd('0x0'));var util=require('util');var moment=require(_0xa7dd('0x1'));var BPromise=require('bluebird');var rs=require(_0xa7dd('0x2'));var fs=require('fs');var Redis=require(_0xa7dd('0x3'));var db=require(_0xa7dd('0x4'))['db'];var utils=require(_0xa7dd('0x5'));var logger=require(_0xa7dd('0x6'))(_0xa7dd('0x7'));var config=require(_0xa7dd('0x8'));var jayson=require(_0xa7dd('0x9'));var client=jayson[_0xa7dd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4112de,_0x31d4b9,_0x1a62c2){return new BPromise(function(_0x2427e0,_0x409759){return client['request'](_0x4112de,_0x1a62c2)[_0xa7dd('0xb')](function(_0x3b9f8a){logger[_0xa7dd('0xc')](_0xa7dd('0xd'),_0x31d4b9,_0xa7dd('0xe'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x31d4b9,_0xa7dd('0xe'),JSON[_0xa7dd('0xf')](_0x3b9f8a));if(_0x3b9f8a[_0xa7dd('0x10')]){if(_0x3b9f8a[_0xa7dd('0x10')]['code']===0x1f4){logger[_0xa7dd('0x10')](_0xa7dd('0xd'),_0x31d4b9,_0x3b9f8a[_0xa7dd('0x10')][_0xa7dd('0x11')]);return _0x409759(_0x3b9f8a['error'][_0xa7dd('0x11')]);}logger[_0xa7dd('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x31d4b9,_0x3b9f8a[_0xa7dd('0x10')][_0xa7dd('0x11')]);return _0x2427e0(_0x3b9f8a[_0xa7dd('0x10')]['message']);}else{logger[_0xa7dd('0xc')](_0xa7dd('0xd'),_0x31d4b9,'request\x20sent');_0x2427e0(_0x3b9f8a[_0xa7dd('0x12')][_0xa7dd('0x11')]);}})[_0xa7dd('0x13')](function(_0x433669){logger[_0xa7dd('0x10')](_0xa7dd('0xd'),_0x31d4b9,_0x433669);_0x409759(_0x433669);});});}exports[_0xa7dd('0x14')]=function(_0x27f2e8){var _0x892795=this;return new Promise(function(_0x227f50,_0x2df48a){return db[_0xa7dd('0x15')][_0xa7dd('0x16')]({'raw':_0x27f2e8[_0xa7dd('0x17')]?_0x27f2e8['options'][_0xa7dd('0x18')]===undefined?!![]:![]:!![],'where':_0x27f2e8[_0xa7dd('0x17')]?_0x27f2e8['options'][_0xa7dd('0x19')]||null:null,'attributes':_0x27f2e8[_0xa7dd('0x17')]?_0x27f2e8[_0xa7dd('0x17')][_0xa7dd('0x1a')]||null:null,'limit':_0x27f2e8[_0xa7dd('0x17')]?_0x27f2e8[_0xa7dd('0x17')][_0xa7dd('0x1b')]||null:null,'include':_0x27f2e8[_0xa7dd('0x17')]?_0x27f2e8[_0xa7dd('0x17')][_0xa7dd('0x1c')]?_[_0xa7dd('0x1d')](_0x27f2e8[_0xa7dd('0x17')][_0xa7dd('0x1c')],function(_0x588246){return{'model':db[_0x588246[_0xa7dd('0x1e')]],'as':_0x588246['as'],'attributes':_0x588246[_0xa7dd('0x1a')],'include':_0x588246[_0xa7dd('0x1c')]?_['map'](_0x588246['include'],function(_0x55023d){return{'model':db[_0x55023d[_0xa7dd('0x1e')]],'as':_0x55023d['as'],'attributes':_0x55023d['attributes'],'include':_0x55023d['include']?_[_0xa7dd('0x1d')](_0x55023d[_0xa7dd('0x1c')],function(_0x10ba03){return{'model':db[_0x10ba03['model']],'as':_0x10ba03['as'],'attributes':_0x10ba03[_0xa7dd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa7dd('0xb')](function(_0xe8384e){logger[_0xa7dd('0xc')](_0xa7dd('0x14'),_0x27f2e8);logger['debug']('GetVoiceCallReport',_0x27f2e8,JSON[_0xa7dd('0xf')](_0xe8384e));_0x227f50(_0xe8384e);})[_0xa7dd('0x13')](function(_0x2dc675){logger[_0xa7dd('0x10')]('GetVoiceCallReport',_0x2dc675[_0xa7dd('0x11')],_0x27f2e8);_0x2df48a(_0x892795[_0xa7dd('0x10')](0x1f4,_0x2dc675[_0xa7dd('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x368d5c){var _0x2884ee=this;return new Promise(function(_0x3f6070,_0x5d1bf2){return db[_0xa7dd('0x15')][_0xa7dd('0x1f')](_0x368d5c[_0xa7dd('0x20')],{'raw':_0x368d5c[_0xa7dd('0x17')]?_0x368d5c[_0xa7dd('0x17')][_0xa7dd('0x18')]===undefined?!![]:![]:!![]})[_0xa7dd('0xb')](function(_0x4ffabc){logger[_0xa7dd('0xc')]('CreateVoiceCallReport',_0x368d5c);logger[_0xa7dd('0x21')]('CreateVoiceCallReport',_0x368d5c,JSON[_0xa7dd('0xf')](_0x4ffabc));_0x3f6070(_0x4ffabc);})[_0xa7dd('0x13')](function(_0x50a3ce){logger[_0xa7dd('0x10')](_0xa7dd('0x22'),_0x50a3ce[_0xa7dd('0x11')],_0x368d5c);_0x5d1bf2(_0x2884ee[_0xa7dd('0x10')](0x1f4,_0x50a3ce[_0xa7dd('0x11')]));});});};exports[_0xa7dd('0x23')]=function(_0x513b39){var _0xc994d2=this;return new Promise(function(_0x229c39,_0x5b7c1e){return db[_0xa7dd('0x15')][_0xa7dd('0x24')](_0x513b39[_0xa7dd('0x20')],{'raw':_0x513b39[_0xa7dd('0x17')]?_0x513b39[_0xa7dd('0x17')][_0xa7dd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513b39[_0xa7dd('0x17')]?_0x513b39[_0xa7dd('0x17')][_0xa7dd('0x19')]||null:null,'attributes':_0x513b39['options']?_0x513b39[_0xa7dd('0x17')][_0xa7dd('0x1a')]||null:null,'limit':_0x513b39[_0xa7dd('0x17')]?_0x513b39[_0xa7dd('0x17')][_0xa7dd('0x1b')]||null:null})[_0xa7dd('0xb')](function(_0x25ece8){logger[_0xa7dd('0xc')](_0xa7dd('0x23'),_0x513b39);logger[_0xa7dd('0x21')](_0xa7dd('0x23'),_0x513b39,JSON['stringify'](_0x25ece8));_0x229c39(_0x25ece8);})[_0xa7dd('0x13')](function(_0x47fc2d){logger['error'](_0xa7dd('0x23'),_0x47fc2d['message'],_0x513b39);_0x5b7c1e(_0xc994d2['error'](0x1f4,_0x47fc2d[_0xa7dd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 7285b00..31a8e0e 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 _0xcf68=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0xd12f07,_0x3fa5fc){var _0x1b0f8b=function(_0x2c53b4){while(--_0x2c53b4){_0xd12f07['push'](_0xd12f07['shift']());}};_0x1b0f8b(++_0x3fa5fc);}(_0xcf68,0x14e));var _0x8cf6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xcf68[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x8cf6('0x0'));var util=require('util');var path=require(_0x8cf6('0x1'));var timeout=require(_0x8cf6('0x2'));var express=require(_0x8cf6('0x3'));var router=express[_0x8cf6('0x4')]();var fs_extra=require(_0x8cf6('0x5'));var auth=require(_0x8cf6('0x6'));var interaction=require(_0x8cf6('0x7'));var config=require(_0x8cf6('0x8'));var controller=require(_0x8cf6('0x9'));router[_0x8cf6('0xa')]('/',auth[_0x8cf6('0xb')](),controller[_0x8cf6('0xc')]);router[_0x8cf6('0xa')](_0x8cf6('0xd'),auth[_0x8cf6('0xb')](),controller[_0x8cf6('0xe')]);router[_0x8cf6('0xf')]('/',auth[_0x8cf6('0xb')](),controller[_0x8cf6('0x10')]);router[_0x8cf6('0x11')](_0x8cf6('0xd'),auth[_0x8cf6('0xb')](),controller[_0x8cf6('0x12')]);router[_0x8cf6('0x13')]('/:id',auth[_0x8cf6('0xb')](),controller[_0x8cf6('0x14')]);module[_0x8cf6('0x15')]=router; \ No newline at end of file +var _0xdaf7=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','connect-timeout'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xdaf7,0x11e));var _0x7daf=function(_0x32d0b7,_0x49316f){_0x32d0b7=_0x32d0b7-0x0;var _0xbfd124=_0xdaf7[_0x32d0b7];return _0xbfd124;};'use strict';var multer=require(_0x7daf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7daf('0x1'));var express=require('express');var router=express[_0x7daf('0x2')]();var fs_extra=require(_0x7daf('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7daf('0x4'));var config=require(_0x7daf('0x5'));var controller=require('./voiceChanSpy.controller');router[_0x7daf('0x6')]('/',auth[_0x7daf('0x7')](),controller[_0x7daf('0x8')]);router[_0x7daf('0x6')](_0x7daf('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x7daf('0xa')]('/',auth[_0x7daf('0x7')](),controller[_0x7daf('0xb')]);router[_0x7daf('0xc')](_0x7daf('0x9'),auth[_0x7daf('0x7')](),controller[_0x7daf('0xd')]);router['delete'](_0x7daf('0x9'),auth[_0x7daf('0x7')](),controller[_0x7daf('0xe')]);module[_0x7daf('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index e79b6c1..b3d1b20 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 _0x09f2=['exports','STRING','name','setDataValue','join','getDataValue','options','split','sequelize'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x09f2,0x86));var _0x209f=function(_0x3b8fa6,_0x3d4dd7){_0x3b8fa6=_0x3b8fa6-0x0;var _0x11f5c4=_0x09f2[_0x3b8fa6];return _0x11f5c4;};'use strict';var Sequelize=require(_0x209f('0x0'));module[_0x209f('0x1')]={'name':{'type':Sequelize[_0x209f('0x2')]},'prefix':{'type':Sequelize[_0x209f('0x2')],'unique':_0x209f('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0xdc6b02){this[_0x209f('0x4')]('options',_0xdc6b02?_0xdc6b02[_0x209f('0x5')](''):[]);},'get':function(){return this[_0x209f('0x6')](_0x209f('0x7'))?this[_0x209f('0x6')]('options')[_0x209f('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x209f('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x209f('0x2')]},'description':{'type':Sequelize[_0x209f('0x2')]}}; \ No newline at end of file +var _0x752e=['exports','STRING','name','setDataValue','options','getDataValue','split','sequelize'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x752e,0x1bf));var _0xe752=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x752e[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0xe752('0x0'));module[_0xe752('0x1')]={'name':{'type':Sequelize[_0xe752('0x2')]},'prefix':{'type':Sequelize[_0xe752('0x2')],'unique':_0xe752('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xe752('0x2')],'set':function(_0x260e19){this[_0xe752('0x4')](_0xe752('0x5'),_0x260e19?_0x260e19['join'](''):[]);},'get':function(){return this[_0xe752('0x6')](_0xe752('0x5'))?this['getDataValue'](_0xe752('0x5'))[_0xe752('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xe752('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe752('0x2')]},'description':{'type':Sequelize[_0xe752('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 2a8647b..1d2e619 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 _0x915a=['querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','get','ChanSpies','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','VoiceChanSpy','rawAttributes','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x915a,0x1d2));var _0xa915=function(_0x43a2c,_0x267e5d){_0x43a2c=_0x43a2c-0x0;var _0x5a53c2=_0x915a[_0x43a2c];return _0x5a53c2;};'use strict';var emlformat=require(_0xa915('0x0'));var rimraf=require(_0xa915('0x1'));var zipdir=require(_0xa915('0x2'));var jsonpatch=require(_0xa915('0x3'));var rp=require(_0xa915('0x4'));var moment=require('moment');var BPromise=require(_0xa915('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa915('0x6'));var sox=require(_0xa915('0x7'));var csv=require(_0xa915('0x8'));var ejs=require(_0xa915('0x9'));var fs=require('fs');var fs_extra=require(_0xa915('0xa'));var _=require(_0xa915('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa915('0xc'));var deskjs=require(_0xa915('0xd'));var toCsv=require(_0xa915('0x8'));var querystring=require(_0xa915('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa915('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa915('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa915('0x11'))(_0xa915('0x12'));var utils=require(_0xa915('0x13'));var config=require(_0xa915('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3edd93,_0x5d7c09){_0x5d7c09=_0x5d7c09||0xcc;return function(_0x274f4d){if(_0x274f4d){return _0x3edd93['sendStatus'](_0x5d7c09);}return _0x3edd93[_0xa915('0x15')](_0x5d7c09)[_0xa915('0x16')]();};}function respondWithResult(_0x22b588,_0x21d782){_0x21d782=_0x21d782||0xc8;return function(_0x3ecf23){if(_0x3ecf23){return _0x22b588[_0xa915('0x15')](_0x21d782)['json'](_0x3ecf23);}};}function respondWithFilteredResult(_0x23ecd8,_0x19889d){return function(_0xf9f02c){if(_0xf9f02c){var _0x590be6=typeof _0x19889d[_0xa915('0x17')]===_0xa915('0x18')&&typeof _0x19889d[_0xa915('0x19')]===_0xa915('0x18');var _0x3f5aff=_0xf9f02c[_0xa915('0x1a')];var _0x23d0df=_0x590be6?0x0:_0x19889d[_0xa915('0x17')];var _0x339335=_0x590be6?_0xf9f02c[_0xa915('0x1a')]:_0x19889d[_0xa915('0x17')]+_0x19889d['limit'];var _0x24af34;if(_0x339335>=_0x3f5aff){_0x339335=_0x3f5aff;_0x24af34=0xc8;}else{_0x24af34=0xce;}_0x23ecd8['status'](_0x24af34);return _0x23ecd8[_0xa915('0x1b')](_0xa915('0x1c'),_0x23d0df+'-'+_0x339335+'/'+_0x3f5aff)[_0xa915('0x1d')](_0xf9f02c);}return null;};}function patchUpdates(_0x414d36){return function(_0x15c3e0){try{jsonpatch['apply'](_0x15c3e0,_0x414d36,!![]);}catch(_0xa93602){return BPromise[_0xa915('0x1e')](_0xa93602);}return _0x15c3e0[_0xa915('0x1f')]();};}function saveUpdates(_0x3d94d1,_0x12c054){return function(_0x226c30){if(_0x226c30){return _0x226c30['update'](_0x3d94d1)[_0xa915('0x20')](function(_0x3e4726){return _0x3e4726;});}return null;};}function removeEntity(_0x220d66,_0x23515d){return function(_0x5a3eac){if(_0x5a3eac){return _0x5a3eac['destroy']()[_0xa915('0x20')](function(){var _0x58eb14=_0x5a3eac[_0xa915('0x21')]({'plain':!![]});var _0x3b8cbb=_0xa915('0x22');return db[_0xa915('0x23')][_0xa915('0x24')]({'where':{'type':_0x3b8cbb,'resourceId':_0x58eb14['id']}})[_0xa915('0x20')](function(){return _0x5a3eac;});})[_0xa915('0x20')](function(){_0x220d66['status'](0xcc)[_0xa915('0x16')]();});}};}function handleEntityNotFound(_0x1bb9e4,_0x5cd3f2){return function(_0x1bee59){if(!_0x1bee59){_0x1bb9e4[_0xa915('0x25')](0x194);}return _0x1bee59;};}function handleError(_0x3d7251,_0x30bfe2){_0x30bfe2=_0x30bfe2||0x1f4;return function(_0x5a62c0){logger[_0xa915('0x26')](_0x5a62c0[_0xa915('0x27')]);if(_0x5a62c0['name']){delete _0x5a62c0[_0xa915('0x28')];}_0x3d7251[_0xa915('0x15')](_0x30bfe2)[_0xa915('0x29')](_0x5a62c0);};}exports[_0xa915('0x2a')]=function(_0x30f7dc,_0x1a0276){var _0x47ab9f={},_0x43359a={},_0x319238={'count':0x0,'rows':[]};var _0x119d36=_['map'](db[_0xa915('0x2b')][_0xa915('0x2c')],function(_0x430fa6){return{'name':_0x430fa6['fieldName'],'type':_0x430fa6[_0xa915('0x2d')][_0xa915('0x2e')]};});_0x43359a[_0xa915('0x2f')]=_[_0xa915('0x30')](_0x119d36,'name');_0x43359a['query']=_[_0xa915('0x31')](_0x30f7dc[_0xa915('0x32')]);_0x43359a[_0xa915('0x33')]=_['intersection'](_0x43359a[_0xa915('0x2f')],_0x43359a['query']);_0x47ab9f[_0xa915('0x34')]=_[_0xa915('0x35')](_0x43359a[_0xa915('0x2f')],qs[_0xa915('0x36')](_0x30f7dc[_0xa915('0x32')][_0xa915('0x36')]));_0x47ab9f[_0xa915('0x34')]=_0x47ab9f['attributes'][_0xa915('0x37')]?_0x47ab9f[_0xa915('0x34')]:_0x43359a[_0xa915('0x2f')];if(!_0x30f7dc[_0xa915('0x32')][_0xa915('0x38')](_0xa915('0x39'))){_0x47ab9f['limit']=qs[_0xa915('0x19')](_0x30f7dc[_0xa915('0x32')][_0xa915('0x19')]);_0x47ab9f[_0xa915('0x17')]=qs[_0xa915('0x17')](_0x30f7dc[_0xa915('0x32')][_0xa915('0x17')]);}_0x47ab9f['order']=qs['sort'](_0x30f7dc['query'][_0xa915('0x3a')]);_0x47ab9f[_0xa915('0x3b')]=qs[_0xa915('0x33')](_[_0xa915('0x3c')](_0x30f7dc[_0xa915('0x32')],_0x43359a[_0xa915('0x33')]),_0x119d36);if(_0x30f7dc[_0xa915('0x32')][_0xa915('0x3d')]){_0x47ab9f[_0xa915('0x3b')]=_[_0xa915('0x3e')](_0x47ab9f[_0xa915('0x3b')],{'$or':_[_0xa915('0x30')](_0x119d36,function(_0x25c9a9){if(_0x25c9a9[_0xa915('0x2d')]!==_0xa915('0x3f')){var _0x5852d9={};_0x5852d9[_0x25c9a9[_0xa915('0x28')]]={'$like':'%'+_0x30f7dc[_0xa915('0x32')][_0xa915('0x3d')]+'%'};return _0x5852d9;}})});}_0x47ab9f=_[_0xa915('0x3e')]({},_0x47ab9f,_0x30f7dc[_0xa915('0x40')]);var _0x56674d={'where':_0x47ab9f[_0xa915('0x3b')]};return db[_0xa915('0x2b')][_0xa915('0x1a')](_0x56674d)[_0xa915('0x20')](function(_0x5e435a){_0x319238[_0xa915('0x1a')]=_0x5e435a;if(_0x30f7dc[_0xa915('0x32')][_0xa915('0x41')]){_0x47ab9f[_0xa915('0x42')]=[{'all':!![]}];}return db[_0xa915('0x2b')][_0xa915('0x43')](_0x47ab9f);})[_0xa915('0x20')](function(_0x44ac8b){_0x319238['rows']=_0x44ac8b;return _0x319238;})[_0xa915('0x20')](respondWithFilteredResult(_0x1a0276,_0x47ab9f))[_0xa915('0x44')](handleError(_0x1a0276,null));};exports[_0xa915('0x45')]=function(_0x452310,_0x5d16a1){var _0x145466={'raw':![],'where':{'id':_0x452310[_0xa915('0x46')]['id']}},_0x4d2554={};_0x4d2554[_0xa915('0x2f')]=_['keys'](db[_0xa915('0x2b')]['rawAttributes']);_0x4d2554['query']=_[_0xa915('0x31')](_0x452310[_0xa915('0x32')]);_0x4d2554[_0xa915('0x33')]=_[_0xa915('0x35')](_0x4d2554[_0xa915('0x2f')],_0x4d2554[_0xa915('0x32')]);_0x145466['attributes']=_[_0xa915('0x35')](_0x4d2554[_0xa915('0x2f')],qs[_0xa915('0x36')](_0x452310[_0xa915('0x32')][_0xa915('0x36')]));_0x145466[_0xa915('0x34')]=_0x145466[_0xa915('0x34')][_0xa915('0x37')]?_0x145466['attributes']:_0x4d2554['model'];if(_0x452310[_0xa915('0x32')][_0xa915('0x41')]){_0x145466[_0xa915('0x42')]=[{'all':!![]}];}_0x145466=_[_0xa915('0x3e')]({},_0x145466,_0x452310[_0xa915('0x40')]);return db[_0xa915('0x2b')]['find'](_0x145466)[_0xa915('0x20')](handleEntityNotFound(_0x5d16a1,null))[_0xa915('0x20')](respondWithResult(_0x5d16a1,null))[_0xa915('0x44')](handleError(_0x5d16a1,null));};exports[_0xa915('0x47')]=function(_0x285313,_0x3e1b81){return db[_0xa915('0x2b')][_0xa915('0x47')](_0x285313['body'],{})[_0xa915('0x20')](function(_0x185c5c){var _0x4744ef=_0x285313[_0xa915('0x48')][_0xa915('0x21')]({'plain':!![]});if(!_0x4744ef)throw new Error(_0xa915('0x49'));if(_0x4744ef[_0xa915('0x4a')]===_0xa915('0x48')){var _0x2a8f00=_0x185c5c[_0xa915('0x21')]({'plain':!![]});var _0x580619='ChanSpies';return db['UserProfileSection'][_0xa915('0x4b')]({'where':{'name':_0x580619,'userProfileId':_0x4744ef[_0xa915('0x4c')]},'raw':!![]})[_0xa915('0x20')](function(_0xea3257){if(_0xea3257&&_0xea3257['autoAssociation']===0x0){return db[_0xa915('0x23')][_0xa915('0x47')]({'name':_0x2a8f00[_0xa915('0x28')],'resourceId':_0x2a8f00['id'],'type':_0xea3257[_0xa915('0x28')],'sectionId':_0xea3257['id']},{})[_0xa915('0x20')](function(){return _0x185c5c;});}else{return _0x185c5c;}})[_0xa915('0x44')](function(_0x1fb931){logger['error'](_0xa915('0x4d'),_0x1fb931);throw _0x1fb931;});}return _0x185c5c;})[_0xa915('0x20')](respondWithResult(_0x3e1b81,0xc9))[_0xa915('0x44')](handleError(_0x3e1b81,null));};exports[_0xa915('0x4e')]=function(_0x341d9f,_0x53284f){if(_0x341d9f[_0xa915('0x4f')]['id']){delete _0x341d9f['body']['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x341d9f[_0xa915('0x46')]['id']}})[_0xa915('0x20')](handleEntityNotFound(_0x53284f,null))[_0xa915('0x20')](saveUpdates(_0x341d9f[_0xa915('0x4f')],null))['then'](respondWithResult(_0x53284f,null))[_0xa915('0x44')](handleError(_0x53284f,null));};exports[_0xa915('0x24')]=function(_0x19259b,_0x22b868){return db[_0xa915('0x2b')][_0xa915('0x4b')]({'where':{'id':_0x19259b[_0xa915('0x46')]['id']}})[_0xa915('0x20')](handleEntityNotFound(_0x22b868,null))[_0xa915('0x20')](removeEntity(_0x22b868,null))[_0xa915('0x44')](handleError(_0x22b868,null));}; \ No newline at end of file +var _0x976a=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','ChanSpies','UserProfileResource','error','stack','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash'];(function(_0x325ee2,_0xaf1371){var _0x7f2741=function(_0x15569a){while(--_0x15569a){_0x325ee2['push'](_0x325ee2['shift']());}};_0x7f2741(++_0xaf1371);}(_0x976a,0xf4));var _0xa976=function(_0x56e1f1,_0x433412){_0x56e1f1=_0x56e1f1-0x0;var _0x5a7b9d=_0x976a[_0x56e1f1];return _0x5a7b9d;};'use strict';var emlformat=require(_0xa976('0x0'));var rimraf=require(_0xa976('0x1'));var zipdir=require(_0xa976('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa976('0x3'));var moment=require(_0xa976('0x4'));var BPromise=require(_0xa976('0x5'));var Mustache=require(_0xa976('0x6'));var util=require(_0xa976('0x7'));var path=require(_0xa976('0x8'));var sox=require(_0xa976('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa976('0xa'));var squel=require(_0xa976('0xb'));var crypto=require(_0xa976('0xc'));var jsforce=require(_0xa976('0xd'));var deskjs=require(_0xa976('0xe'));var toCsv=require(_0xa976('0xf'));var querystring=require(_0xa976('0x10'));var Papa=require(_0xa976('0x11'));var Redis=require(_0xa976('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa976('0x13'));var logger=require(_0xa976('0x14'))(_0xa976('0x15'));var utils=require(_0xa976('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa976('0x17'));var db=require(_0xa976('0x18'))['db'];function respondWithStatusCode(_0xb2fcff,_0x1fac1a){_0x1fac1a=_0x1fac1a||0xcc;return function(_0x251346){if(_0x251346){return _0xb2fcff[_0xa976('0x19')](_0x1fac1a);}return _0xb2fcff['status'](_0x1fac1a)[_0xa976('0x1a')]();};}function respondWithResult(_0x2288ff,_0x178520){_0x178520=_0x178520||0xc8;return function(_0x23aea8){if(_0x23aea8){return _0x2288ff[_0xa976('0x1b')](_0x178520)[_0xa976('0x1c')](_0x23aea8);}};}function respondWithFilteredResult(_0x1bac95,_0xe74e4e){return function(_0xd48708){if(_0xd48708){var _0x39ccc6=typeof _0xe74e4e[_0xa976('0x1d')]==='undefined'&&typeof _0xe74e4e[_0xa976('0x1e')]===_0xa976('0x1f');var _0x3405ed=_0xd48708['count'];var _0x4848d8=_0x39ccc6?0x0:_0xe74e4e[_0xa976('0x1d')];var _0x36b47a=_0x39ccc6?_0xd48708[_0xa976('0x20')]:_0xe74e4e[_0xa976('0x1d')]+_0xe74e4e[_0xa976('0x1e')];var _0x5ef373;if(_0x36b47a>=_0x3405ed){_0x36b47a=_0x3405ed;_0x5ef373=0xc8;}else{_0x5ef373=0xce;}_0x1bac95[_0xa976('0x1b')](_0x5ef373);return _0x1bac95[_0xa976('0x21')](_0xa976('0x22'),_0x4848d8+'-'+_0x36b47a+'/'+_0x3405ed)[_0xa976('0x1c')](_0xd48708);}return null;};}function patchUpdates(_0x44f7d4){return function(_0x4c8203){try{jsonpatch['apply'](_0x4c8203,_0x44f7d4,!![]);}catch(_0xf6c4df){return BPromise[_0xa976('0x23')](_0xf6c4df);}return _0x4c8203['save']();};}function saveUpdates(_0x3013c8,_0x4f60ff){return function(_0x4f5c6e){if(_0x4f5c6e){return _0x4f5c6e[_0xa976('0x24')](_0x3013c8)[_0xa976('0x25')](function(_0x7bdce2){return _0x7bdce2;});}return null;};}function removeEntity(_0x3ae9ae,_0x1f0487){return function(_0xe572fe){if(_0xe572fe){return _0xe572fe[_0xa976('0x26')]()['then'](function(){var _0x5a2f6f=_0xe572fe['get']({'plain':!![]});var _0x1be29a=_0xa976('0x27');return db[_0xa976('0x28')]['destroy']({'where':{'type':_0x1be29a,'resourceId':_0x5a2f6f['id']}})['then'](function(){return _0xe572fe;});})[_0xa976('0x25')](function(){_0x3ae9ae[_0xa976('0x1b')](0xcc)[_0xa976('0x1a')]();});}};}function handleEntityNotFound(_0x1b887a,_0x1d71ac){return function(_0x188f9d){if(!_0x188f9d){_0x1b887a[_0xa976('0x19')](0x194);}return _0x188f9d;};}function handleError(_0x3072ec,_0x55d3c5){_0x55d3c5=_0x55d3c5||0x1f4;return function(_0x5b7b2d){logger[_0xa976('0x29')](_0x5b7b2d[_0xa976('0x2a')]);if(_0x5b7b2d['name']){delete _0x5b7b2d['name'];}_0x3072ec[_0xa976('0x1b')](_0x55d3c5)['send'](_0x5b7b2d);};}exports[_0xa976('0x2b')]=function(_0x100a24,_0x9cbf1a){var _0x5d251e={},_0x556140={},_0x576c45={'count':0x0,'rows':[]};var _0x8b4336=_['map'](db[_0xa976('0x2c')][_0xa976('0x2d')],function(_0x22807a){return{'name':_0x22807a[_0xa976('0x2e')],'type':_0x22807a[_0xa976('0x2f')][_0xa976('0x30')]};});_0x556140[_0xa976('0x31')]=_[_0xa976('0x32')](_0x8b4336,_0xa976('0x33'));_0x556140[_0xa976('0x34')]=_[_0xa976('0x35')](_0x100a24[_0xa976('0x34')]);_0x556140[_0xa976('0x36')]=_[_0xa976('0x37')](_0x556140['model'],_0x556140[_0xa976('0x34')]);_0x5d251e['attributes']=_[_0xa976('0x37')](_0x556140[_0xa976('0x31')],qs[_0xa976('0x38')](_0x100a24[_0xa976('0x34')][_0xa976('0x38')]));_0x5d251e[_0xa976('0x39')]=_0x5d251e[_0xa976('0x39')][_0xa976('0x3a')]?_0x5d251e[_0xa976('0x39')]:_0x556140[_0xa976('0x31')];if(!_0x100a24[_0xa976('0x34')][_0xa976('0x3b')](_0xa976('0x3c'))){_0x5d251e['limit']=qs[_0xa976('0x1e')](_0x100a24[_0xa976('0x34')][_0xa976('0x1e')]);_0x5d251e['offset']=qs[_0xa976('0x1d')](_0x100a24[_0xa976('0x34')][_0xa976('0x1d')]);}_0x5d251e[_0xa976('0x3d')]=qs[_0xa976('0x3e')](_0x100a24['query'][_0xa976('0x3e')]);_0x5d251e['where']=qs[_0xa976('0x36')](_[_0xa976('0x3f')](_0x100a24['query'],_0x556140[_0xa976('0x36')]),_0x8b4336);if(_0x100a24[_0xa976('0x34')]['filter']){_0x5d251e[_0xa976('0x40')]=_[_0xa976('0x41')](_0x5d251e['where'],{'$or':_[_0xa976('0x32')](_0x8b4336,function(_0x5a1013){if(_0x5a1013[_0xa976('0x2f')]!==_0xa976('0x42')){var _0x4ca748={};_0x4ca748[_0x5a1013['name']]={'$like':'%'+_0x100a24[_0xa976('0x34')][_0xa976('0x43')]+'%'};return _0x4ca748;}})});}_0x5d251e=_[_0xa976('0x41')]({},_0x5d251e,_0x100a24[_0xa976('0x44')]);var _0x315c23={'where':_0x5d251e[_0xa976('0x40')]};return db[_0xa976('0x2c')][_0xa976('0x20')](_0x315c23)[_0xa976('0x25')](function(_0x11f88f){_0x576c45[_0xa976('0x20')]=_0x11f88f;if(_0x100a24[_0xa976('0x34')][_0xa976('0x45')]){_0x5d251e[_0xa976('0x46')]=[{'all':!![]}];}return db[_0xa976('0x2c')][_0xa976('0x47')](_0x5d251e);})[_0xa976('0x25')](function(_0x1d219d){_0x576c45['rows']=_0x1d219d;return _0x576c45;})[_0xa976('0x25')](respondWithFilteredResult(_0x9cbf1a,_0x5d251e))[_0xa976('0x48')](handleError(_0x9cbf1a,null));};exports[_0xa976('0x49')]=function(_0x206076,_0x1d5181){var _0x22f17d={'raw':![],'where':{'id':_0x206076['params']['id']}},_0x2123e4={};_0x2123e4['model']=_['keys'](db[_0xa976('0x2c')][_0xa976('0x2d')]);_0x2123e4['query']=_[_0xa976('0x35')](_0x206076[_0xa976('0x34')]);_0x2123e4[_0xa976('0x36')]=_[_0xa976('0x37')](_0x2123e4[_0xa976('0x31')],_0x2123e4[_0xa976('0x34')]);_0x22f17d[_0xa976('0x39')]=_['intersection'](_0x2123e4['model'],qs[_0xa976('0x38')](_0x206076[_0xa976('0x34')][_0xa976('0x38')]));_0x22f17d['attributes']=_0x22f17d[_0xa976('0x39')][_0xa976('0x3a')]?_0x22f17d[_0xa976('0x39')]:_0x2123e4[_0xa976('0x31')];if(_0x206076['query'][_0xa976('0x45')]){_0x22f17d[_0xa976('0x46')]=[{'all':!![]}];}_0x22f17d=_['merge']({},_0x22f17d,_0x206076[_0xa976('0x44')]);return db['VoiceChanSpy'][_0xa976('0x4a')](_0x22f17d)[_0xa976('0x25')](handleEntityNotFound(_0x1d5181,null))[_0xa976('0x25')](respondWithResult(_0x1d5181,null))[_0xa976('0x48')](handleError(_0x1d5181,null));};exports['create']=function(_0x1ded72,_0x6ff46e){return db[_0xa976('0x2c')][_0xa976('0x4b')](_0x1ded72['body'],{})[_0xa976('0x25')](function(_0x54c256){var _0x9dced9=_0x1ded72[_0xa976('0x4c')][_0xa976('0x4d')]({'plain':!![]});if(!_0x9dced9)throw new Error(_0xa976('0x4e'));if(_0x9dced9[_0xa976('0x4f')]===_0xa976('0x4c')){var _0x39901d=_0x54c256[_0xa976('0x4d')]({'plain':!![]});var _0x296fd8=_0xa976('0x27');return db[_0xa976('0x50')][_0xa976('0x4a')]({'where':{'name':_0x296fd8,'userProfileId':_0x9dced9[_0xa976('0x51')]},'raw':!![]})[_0xa976('0x25')](function(_0x3840e2){if(_0x3840e2&&_0x3840e2[_0xa976('0x52')]===0x0){return db[_0xa976('0x28')][_0xa976('0x4b')]({'name':_0x39901d['name'],'resourceId':_0x39901d['id'],'type':_0x3840e2[_0xa976('0x33')],'sectionId':_0x3840e2['id']},{})[_0xa976('0x25')](function(){return _0x54c256;});}else{return _0x54c256;}})[_0xa976('0x48')](function(_0x9b72a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9b72a);throw _0x9b72a;});}return _0x54c256;})['then'](respondWithResult(_0x6ff46e,0xc9))['catch'](handleError(_0x6ff46e,null));};exports[_0xa976('0x24')]=function(_0x384340,_0x1fdf63){if(_0x384340['body']['id']){delete _0x384340[_0xa976('0x53')]['id'];}return db['VoiceChanSpy'][_0xa976('0x4a')]({'where':{'id':_0x384340[_0xa976('0x54')]['id']}})[_0xa976('0x25')](handleEntityNotFound(_0x1fdf63,null))[_0xa976('0x25')](saveUpdates(_0x384340['body'],null))[_0xa976('0x25')](respondWithResult(_0x1fdf63,null))[_0xa976('0x48')](handleError(_0x1fdf63,null));};exports[_0xa976('0x26')]=function(_0x143d4b,_0x2f59c9){return db[_0xa976('0x2c')]['find']({'where':{'id':_0x143d4b[_0xa976('0x54')]['id']}})[_0xa976('0x25')](handleEntityNotFound(_0x2f59c9,null))[_0xa976('0x25')](removeEntity(_0x2f59c9,null))['catch'](handleError(_0x2f59c9,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 203f0b1..e417fd6 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 _0x4297=['ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','findAll','agent','exports','models','define','VoiceChanSpy','then','VoiceExtension','bulkCreate','catch','destroy','lodash','bluebird','context','format','prefix','system','merge','Set','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password'];(function(_0x13e758,_0x317d23){var _0x5b53c3=function(_0x103e80){while(--_0x103e80){_0x13e758['push'](_0x13e758['shift']());}};_0x5b53c3(++_0x317d23);}(_0x4297,0x8a));var _0x7429=function(_0x57ca7f,_0x4e94f3){_0x57ca7f=_0x57ca7f-0x0;var _0x417383=_0x4297[_0x57ca7f];return _0x417383;};'use strict';var _=require(_0x7429('0x0'));var util=require('util');var BPromise=require(_0x7429('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x4be6e6,_0x348715,_0x4af6f4){var _0x1297f4=0x1;var _0x3a340d=[];var _0x47fcd1={'context':_0x348715[_0x7429('0x2')]||'from-sip','exten':util[_0x7429('0x3')]('%s%s',_0x4be6e6[_0x7429('0x4')],_0x4af6f4),'type':_0x7429('0x5'),'isApp':![],'ChanSpyId':_0x4be6e6['id'],'UserId':_0x348715['id']};_0x3a340d['push'](_[_0x7429('0x6')]({'app':_0x7429('0x7'),'appdata':util[_0x7429('0x3')](_0x7429('0x8'),_0x7429('0x9')),'priority':_0x1297f4++},_0x47fcd1));if(_0x4be6e6[_0x7429('0xa')]){_0x3a340d[_0x7429('0xb')](_[_0x7429('0x6')]({'app':_0x7429('0xc'),'appdata':util[_0x7429('0x3')](_0x7429('0xd'),_0x4be6e6[_0x7429('0xe')]),'priority':_0x1297f4++},_0x47fcd1));}if(_0x4be6e6[_0x7429('0xf')]){_0x3a340d['push'](_[_0x7429('0x6')]({'app':_0x7429('0x10'),'appdata':_0x4be6e6[_0x7429('0x11')],'priority':_0x1297f4++},_0x47fcd1));}_0x3a340d[_0x7429('0xb')](_[_0x7429('0x6')]({'app':_0x7429('0x12'),'appdata':util[_0x7429('0x3')](_0x7429('0x13'),_0x348715['name'],_0x4be6e6[_0x7429('0x14')]?_0x4be6e6[_0x7429('0x14')][_0x7429('0x15')](''):''),'priority':_0x1297f4++},_0x47fcd1));if(_0x4be6e6['record']){_0x3a340d[_0x7429('0xb')](_[_0x7429('0x6')]({'app':_0x7429('0x16'),'priority':_0x1297f4++},_0x47fcd1));}return _0x3a340d;};var getChanSpyApplications=function(_0x3801fe,_0x954536){var _0x5024c4=[];for(var _0x2318d7=0x0,_0x29e4d9=0x1;_0x2318d7<_0x954536[_0x7429('0x17')];_0x2318d7++,_0x29e4d9=0x1){_0x5024c4=_0x5024c4[_0x7429('0x18')](getUserApplications(_0x3801fe,_0x954536[_0x2318d7],_0x954536[_0x2318d7][_0x7429('0x19')]));if(_0x954536[_0x2318d7][_0x7429('0x19')]!=_0x954536[_0x2318d7][_0x7429('0x1a')]){_0x5024c4=_0x5024c4[_0x7429('0x18')](getUserApplications(_0x3801fe,_0x954536[_0x2318d7],_0x954536[_0x2318d7]['name']));}}return _0x5024c4;};var getChanSpyPromise=function(_0x56bbb3,_0xbd5b27){return new BPromise(function(_0x8bbbf3,_0x169bd5){return _0x56bbb3[_0x7429('0x1b')][_0x7429('0x1c')]({'attributes':['id','name',_0x7429('0x19')],'where':{'role':_0x7429('0x1d'),'chanspy':!![]},'raw':!![]})['then'](function(_0x4002f9){if(_0x4002f9){return _0x8bbbf3(getChanSpyApplications(_0xbd5b27,_0x4002f9));}return _0x8bbbf3([]);})['catch'](function(_0xdef29e){_0x169bd5(_0xdef29e);});});};module[_0x7429('0x1e')]=function(_0x256e2a,_0x552e21){var _0x1657e9=_0x256e2a[_0x7429('0x1f')];return _0x256e2a[_0x7429('0x20')](_0x7429('0x21'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x548c97,_0x5e2172,_0x2c958d){return getChanSpyPromise(_0x1657e9,_0x548c97)[_0x7429('0x22')](function(_0x33b8e6){if(_0x33b8e6&&_0x33b8e6['length']){return _0x1657e9[_0x7429('0x23')][_0x7429('0x24')](_0x33b8e6);}})[_0x7429('0x22')](function(){_0x2c958d();})['catch'](function(_0x11d91e){_0x2c958d(_0x11d91e);});},'afterUpdate':function(_0x2d8a0a,_0x548f14,_0x2761ad){return _0x1657e9[_0x7429('0x23')]['destroy']({'where':{'ChanSpyId':_0x2d8a0a['id']}})[_0x7429('0x22')](function(){return getChanSpyPromise(_0x1657e9,_0x2d8a0a);})[_0x7429('0x22')](function(_0x53ce66){if(_0x53ce66&&_0x53ce66[_0x7429('0x17')]){return _0x1657e9[_0x7429('0x23')][_0x7429('0x24')](_0x53ce66);}})['then'](function(){_0x2761ad();})[_0x7429('0x25')](function(_0x3d67b5){_0x2761ad(_0x3d67b5);});},'afterDestroy':function(_0x324215,_0x287dc8,_0x979d3d){return _0x1657e9['VoiceExtension'][_0x7429('0x26')]({'where':{'ChanSpyId':_0x324215['id']}})['then'](function(){_0x979d3d();})[_0x7429('0x25')](function(_0xf272d2){_0x979d3d(_0xf272d2);});}}});}; \ No newline at end of file +var _0x35d4=['concat','internal','name','findAll','agent','then','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','catch','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','%s%s','prefix','push','merge','Set','format','record','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','options','join','StopMixMonitor','length'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x35d4,0x125));var _0x435d=function(_0x486ca4,_0x3b2528){_0x486ca4=_0x486ca4-0x0;var _0x1de7b6=_0x35d4[_0x486ca4];return _0x1de7b6;};'use strict';var _=require(_0x435d('0x0'));var util=require(_0x435d('0x1'));var BPromise=require(_0x435d('0x2'));var attributes=require(_0x435d('0x3'));var getUserApplications=function(_0x5b3097,_0x590bb5,_0xce862b){var _0x3ee786=0x1;var _0x290025=[];var _0x12751f={'context':_0x590bb5[_0x435d('0x4')]||'from-sip','exten':util['format'](_0x435d('0x5'),_0x5b3097[_0x435d('0x6')],_0xce862b),'type':'system','isApp':![],'ChanSpyId':_0x5b3097['id'],'UserId':_0x590bb5['id']};_0x290025[_0x435d('0x7')](_[_0x435d('0x8')]({'app':_0x435d('0x9'),'appdata':util[_0x435d('0xa')]('CDR(type)=%s','chanspy'),'priority':_0x3ee786++},_0x12751f));if(_0x5b3097[_0x435d('0xb')]){_0x290025['push'](_['merge']({'app':_0x435d('0xc'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x5b3097[_0x435d('0xd')]),'priority':_0x3ee786++},_0x12751f));}if(_0x5b3097[_0x435d('0xe')]){_0x290025[_0x435d('0x7')](_['merge']({'app':_0x435d('0xf'),'appdata':_0x5b3097[_0x435d('0x10')],'priority':_0x3ee786++},_0x12751f));}_0x290025['push'](_[_0x435d('0x8')]({'app':_0x435d('0x11'),'appdata':util[_0x435d('0xa')]('SIP/%s,%s',_0x590bb5['name'],_0x5b3097[_0x435d('0x12')]?_0x5b3097[_0x435d('0x12')][_0x435d('0x13')](''):''),'priority':_0x3ee786++},_0x12751f));if(_0x5b3097[_0x435d('0xb')]){_0x290025[_0x435d('0x7')](_[_0x435d('0x8')]({'app':_0x435d('0x14'),'priority':_0x3ee786++},_0x12751f));}return _0x290025;};var getChanSpyApplications=function(_0x2bab34,_0x17c9ad){var _0x364bb6=[];for(var _0x3d1f53=0x0,_0x21bd40=0x1;_0x3d1f53<_0x17c9ad[_0x435d('0x15')];_0x3d1f53++,_0x21bd40=0x1){_0x364bb6=_0x364bb6[_0x435d('0x16')](getUserApplications(_0x2bab34,_0x17c9ad[_0x3d1f53],_0x17c9ad[_0x3d1f53][_0x435d('0x17')]));if(_0x17c9ad[_0x3d1f53][_0x435d('0x17')]!=_0x17c9ad[_0x3d1f53][_0x435d('0x18')]){_0x364bb6=_0x364bb6[_0x435d('0x16')](getUserApplications(_0x2bab34,_0x17c9ad[_0x3d1f53],_0x17c9ad[_0x3d1f53][_0x435d('0x18')]));}}return _0x364bb6;};var getChanSpyPromise=function(_0x3e8903,_0x28612d){return new BPromise(function(_0x3cf704,_0x2c4e92){return _0x3e8903['User'][_0x435d('0x19')]({'attributes':['id',_0x435d('0x18'),'internal'],'where':{'role':_0x435d('0x1a'),'chanspy':!![]},'raw':!![]})[_0x435d('0x1b')](function(_0x327563){if(_0x327563){return _0x3cf704(getChanSpyApplications(_0x28612d,_0x327563));}return _0x3cf704([]);})['catch'](function(_0x55db4f){_0x2c4e92(_0x55db4f);});});};module[_0x435d('0x1c')]=function(_0x46d922,_0x501ea1){var _0x3b958a=_0x46d922['models'];return _0x46d922[_0x435d('0x1d')](_0x435d('0x1e'),attributes,{'tableName':_0x435d('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x37d15e,_0x2dc1fc,_0x524898){return getChanSpyPromise(_0x3b958a,_0x37d15e)[_0x435d('0x1b')](function(_0x311526){if(_0x311526&&_0x311526[_0x435d('0x15')]){return _0x3b958a[_0x435d('0x20')]['bulkCreate'](_0x311526);}})[_0x435d('0x1b')](function(){_0x524898();})[_0x435d('0x21')](function(_0x3c7e11){_0x524898(_0x3c7e11);});},'afterUpdate':function(_0x3a0db7,_0x41d7ee,_0x5c9a33){return _0x3b958a[_0x435d('0x20')][_0x435d('0x22')]({'where':{'ChanSpyId':_0x3a0db7['id']}})[_0x435d('0x1b')](function(){return getChanSpyPromise(_0x3b958a,_0x3a0db7);})[_0x435d('0x1b')](function(_0x281109){if(_0x281109&&_0x281109[_0x435d('0x15')]){return _0x3b958a['VoiceExtension']['bulkCreate'](_0x281109);}})[_0x435d('0x1b')](function(){_0x5c9a33();})[_0x435d('0x21')](function(_0x9307d6){_0x5c9a33(_0x9307d6);});},'afterDestroy':function(_0x33a4da,_0x3bcb81,_0x53e9a1){return _0x3b958a[_0x435d('0x20')][_0x435d('0x22')]({'where':{'ChanSpyId':_0x33a4da['id']}})[_0x435d('0x1b')](function(){_0x53e9a1();})[_0x435d('0x21')](function(_0x104d6f){_0x53e9a1(_0x104d6f);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index f948f45..52f80a4 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 _0x6282=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1113fc,_0xe440ba){var _0x3c7aa6=function(_0x25ca24){while(--_0x25ca24){_0x1113fc['push'](_0x1113fc['shift']());}};_0x3c7aa6(++_0xe440ba);}(_0x6282,0x76));var _0x2628=function(_0x3825a8,_0x2ce1a2){_0x3825a8=_0x3825a8-0x0;var _0xabc9bc=_0x6282[_0x3825a8];return _0xabc9bc;};'use strict';var _=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var moment=require(_0x2628('0x2'));var BPromise=require(_0x2628('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2628('0x4'))['db'];var utils=require(_0x2628('0x5'));var logger=require('../../config/logger')(_0x2628('0x6'));var config=require(_0x2628('0x7'));var jayson=require(_0x2628('0x8'));var client=jayson[_0x2628('0x9')][_0x2628('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50412a,_0xb6b945,_0x144ae8){return new BPromise(function(_0x2170a7,_0xbae7c3){return client[_0x2628('0xb')](_0x50412a,_0x144ae8)[_0x2628('0xc')](function(_0x403569){logger[_0x2628('0xd')](_0x2628('0xe'),_0xb6b945,_0x2628('0xf'));logger[_0x2628('0x10')](_0x2628('0x11'),_0xb6b945,_0x2628('0xf'),JSON[_0x2628('0x12')](_0x403569));if(_0x403569[_0x2628('0x13')]){if(_0x403569['error']['code']===0x1f4){logger[_0x2628('0x13')](_0x2628('0xe'),_0xb6b945,_0x403569[_0x2628('0x13')][_0x2628('0x14')]);return _0xbae7c3(_0x403569['error']['message']);}logger[_0x2628('0x13')](_0x2628('0xe'),_0xb6b945,_0x403569[_0x2628('0x13')][_0x2628('0x14')]);return _0x2170a7(_0x403569[_0x2628('0x13')]['message']);}else{logger[_0x2628('0xd')](_0x2628('0xe'),_0xb6b945,_0x2628('0xf'));_0x2170a7(_0x403569['result'][_0x2628('0x14')]);}})[_0x2628('0x15')](function(_0x51df16){logger[_0x2628('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0xb6b945,_0x51df16);_0xbae7c3(_0x51df16);});});} \ No newline at end of file +var _0xec56=['http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xec56,0x1bd));var _0x6ec5=function(_0x2dd485,_0x596404){_0x2dd485=_0x2dd485-0x0;var _0xce053=_0xec56[_0x2dd485];return _0xce053;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ec5('0x1'));var rs=require(_0x6ec5('0x2'));var fs=require('fs');var Redis=require(_0x6ec5('0x3'));var db=require(_0x6ec5('0x4'))['db'];var utils=require(_0x6ec5('0x5'));var logger=require(_0x6ec5('0x6'))(_0x6ec5('0x7'));var config=require(_0x6ec5('0x8'));var jayson=require(_0x6ec5('0x9'));var client=jayson[_0x6ec5('0xa')][_0x6ec5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb683,_0x35be4e,_0x1f59cd){return new BPromise(function(_0x3dd891,_0x225d2f){return client[_0x6ec5('0xc')](_0x3bb683,_0x1f59cd)[_0x6ec5('0xd')](function(_0x3ff17c){logger['info'](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));logger[_0x6ec5('0x10')](_0x6ec5('0x11'),_0x35be4e,_0x6ec5('0xf'),JSON[_0x6ec5('0x12')](_0x3ff17c));if(_0x3ff17c[_0x6ec5('0x13')]){if(_0x3ff17c['error'][_0x6ec5('0x14')]===0x1f4){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);return _0x225d2f(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}logger[_0x6ec5('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x35be4e,_0x3ff17c[_0x6ec5('0x13')]['message']);return _0x3dd891(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}else{logger[_0x6ec5('0x16')](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));_0x3dd891(_0x3ff17c['result'][_0x6ec5('0x15')]);}})[_0x6ec5('0x17')](function(_0x125ae6){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x125ae6);_0x225d2f(_0x125ae6);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 4759cd1..46d816c 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 _0x7e3c=['get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller'];(function(_0x36e4f0,_0x3367d9){var _0x2a3730=function(_0x5818e1){while(--_0x5818e1){_0x36e4f0['push'](_0x36e4f0['shift']());}};_0x2a3730(++_0x3367d9);}(_0x7e3c,0x1c0));var _0xc7e3=function(_0x430b0f,_0x4321d0){_0x430b0f=_0x430b0f-0x0;var _0x2b5d97=_0x7e3c[_0x430b0f];return _0x2b5d97;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc7e3('0x0'));var express=require(_0xc7e3('0x1'));var router=express[_0xc7e3('0x2')]();var fs_extra=require(_0xc7e3('0x3'));var auth=require(_0xc7e3('0x4'));var interaction=require(_0xc7e3('0x5'));var config=require(_0xc7e3('0x6'));var controller=require(_0xc7e3('0x7'));router[_0xc7e3('0x8')]('/',auth[_0xc7e3('0x9')](),controller['index']);router[_0xc7e3('0x8')](_0xc7e3('0xa'),auth[_0xc7e3('0x9')](),controller[_0xc7e3('0xb')]);router[_0xc7e3('0xc')]('/',auth[_0xc7e3('0x9')](),controller[_0xc7e3('0xd')]);router[_0xc7e3('0xe')](_0xc7e3('0xa'),auth[_0xc7e3('0x9')](),controller[_0xc7e3('0xf')]);router[_0xc7e3('0x10')](_0xc7e3('0xa'),auth[_0xc7e3('0x9')](),controller[_0xc7e3('0x11')]);module[_0xc7e3('0x12')]=router; \ No newline at end of file +var _0x239c=['/:id','update','delete','destroy','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put'];(function(_0x24065b,_0x1775ba){var _0x88b0b7=function(_0x1143fc){while(--_0x1143fc){_0x24065b['push'](_0x24065b['shift']());}};_0x88b0b7(++_0x1775ba);}(_0x239c,0x71));var _0xc239=function(_0x13268d,_0x1cbb5c){_0x13268d=_0x13268d-0x0;var _0x565bb9=_0x239c[_0x13268d];return _0x565bb9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc239('0x0'));var express=require(_0xc239('0x1'));var router=express['Router']();var fs_extra=require(_0xc239('0x2'));var auth=require(_0xc239('0x3'));var interaction=require(_0xc239('0x4'));var config=require(_0xc239('0x5'));var controller=require('./voiceContext.controller');router[_0xc239('0x6')]('/',auth[_0xc239('0x7')](),controller[_0xc239('0x8')]);router['get']('/:id',auth[_0xc239('0x7')](),controller[_0xc239('0x9')]);router[_0xc239('0xa')]('/',auth[_0xc239('0x7')](),controller[_0xc239('0xb')]);router[_0xc239('0xc')](_0xc239('0xd'),auth[_0xc239('0x7')](),controller[_0xc239('0xe')]);router[_0xc239('0xf')]('/:id',auth[_0xc239('0x7')](),controller[_0xc239('0x10')]);module[_0xc239('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index a452f82..df861e8 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 _0xfa68=['STRING','BOOLEAN','sequelize','exports'];(function(_0x40ca8d,_0x2095ab){var _0x25fa04=function(_0x4238bf){while(--_0x4238bf){_0x40ca8d['push'](_0x40ca8d['shift']());}};_0x25fa04(++_0x2095ab);}(_0xfa68,0x86));var _0x8fa6=function(_0x5cd920,_0x3ffe7a){_0x5cd920=_0x5cd920-0x0;var _0x29dd3c=_0xfa68[_0x5cd920];return _0x29dd3c;};'use strict';var Sequelize=require(_0x8fa6('0x0'));module[_0x8fa6('0x1')]={'name':{'type':Sequelize[_0x8fa6('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x8fa6('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x8fa6('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5737=['STRING','name','BOOLEAN','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5737,0xc7));var _0x7573=function(_0x3d66f0,_0x3f4e63){_0x3d66f0=_0x3d66f0-0x0;var _0x4164f3=_0x5737[_0x3d66f0];return _0x4164f3;};'use strict';var Sequelize=require('sequelize');module[_0x7573('0x0')]={'name':{'type':Sequelize[_0x7573('0x1')],'unique':_0x7573('0x2')},'description':{'type':Sequelize[_0x7573('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7573('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index f890004..635e3e1 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 _0xe893=['to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','stack','name','send','index','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','VoiceContext','include','findAll','rows','show','params','keys','includeAll','create','body','readFileSync','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','role','UserProfileSection','find','Contexts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','utf8','chan_sip.so','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x4e170e,_0x207e58){var _0x338291=function(_0x4cb198){while(--_0x4cb198){_0x4e170e['push'](_0x4e170e['shift']());}};_0x338291(++_0x207e58);}(_0xe893,0xbe));var _0x3e89=function(_0x5eae84,_0x193d5e){_0x5eae84=_0x5eae84-0x0;var _0x5b44cc=_0xe893[_0x5eae84];return _0x5b44cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e89('0x0'));var zipdir=require(_0x3e89('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e89('0x2'));var moment=require(_0x3e89('0x3'));var BPromise=require(_0x3e89('0x4'));var Mustache=require(_0x3e89('0x5'));var util=require(_0x3e89('0x6'));var path=require('path');var sox=require(_0x3e89('0x7'));var csv=require(_0x3e89('0x8'));var ejs=require(_0x3e89('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e89('0xa'));var squel=require(_0x3e89('0xb'));var crypto=require(_0x3e89('0xc'));var jsforce=require(_0x3e89('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3e89('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3e89('0xe'));var qs=require(_0x3e89('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e89('0x10'))('api');var utils=require(_0x3e89('0x11'));var config=require(_0x3e89('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e89('0x13'))['db'];var jayson=require(_0x3e89('0x14'));var client=jayson[_0x3e89('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ed415,_0x207d8b,_0xd58e2e,_0x4137e8){return new BPromise(function(_0x33ccb7,_0x25248e){var _0x453d15=_0x4137e8||client;return _0x453d15['request'](_0x3ed415,_0xd58e2e)[_0x3e89('0x16')](function(_0x4ce423){logger['info'](_0x3e89('0x17'),_0x207d8b,_0x3e89('0x18'));logger[_0x3e89('0x19')](_0x3e89('0x1a'),_0x207d8b,_0x3e89('0x18'),JSON[_0x3e89('0x1b')](_0x4ce423));if(_0x4ce423[_0x3e89('0x1c')]){if(_0x4ce423[_0x3e89('0x1c')][_0x3e89('0x1d')]===0x1f4){logger[_0x3e89('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x207d8b,_0x4ce423[_0x3e89('0x1c')]['message']);return _0x25248e(_0x4ce423[_0x3e89('0x1c')][_0x3e89('0x1e')]);}logger[_0x3e89('0x1c')](_0x3e89('0x17'),_0x207d8b,_0x4ce423[_0x3e89('0x1c')][_0x3e89('0x1e')]);return _0x33ccb7(_0x4ce423[_0x3e89('0x1c')][_0x3e89('0x1e')]);}else{logger[_0x3e89('0x1f')](_0x3e89('0x17'),_0x207d8b,_0x3e89('0x18'));_0x33ccb7(_0x4ce423[_0x3e89('0x20')][_0x3e89('0x1e')]);}})[_0x3e89('0x21')](function(_0x56d8f7){logger[_0x3e89('0x1c')](_0x3e89('0x17'),_0x207d8b,_0x56d8f7);_0x25248e(_0x56d8f7);});});}function respondWithStatusCode(_0x40e694,_0x1dc423){_0x1dc423=_0x1dc423||0xcc;return function(_0x5ce81c){if(_0x5ce81c){return _0x40e694[_0x3e89('0x22')](_0x1dc423);}return _0x40e694[_0x3e89('0x23')](_0x1dc423)[_0x3e89('0x24')]();};}function respondWithResult(_0x121da1,_0xab6b6c){_0xab6b6c=_0xab6b6c||0xc8;return function(_0x20fafd){if(_0x20fafd){return _0x121da1['status'](_0xab6b6c)[_0x3e89('0x25')](_0x20fafd);}};}function respondWithFilteredResult(_0x2accde,_0x4120bd){return function(_0x3d123f){if(_0x3d123f){var _0x3d12c0=typeof _0x4120bd[_0x3e89('0x26')]===_0x3e89('0x27')&&typeof _0x4120bd[_0x3e89('0x28')]===_0x3e89('0x27');var _0x2c5ee4=_0x3d123f[_0x3e89('0x29')];var _0xf68c8=_0x3d12c0?0x0:_0x4120bd['offset'];var _0x2512a0=_0x3d12c0?_0x3d123f[_0x3e89('0x29')]:_0x4120bd[_0x3e89('0x26')]+_0x4120bd[_0x3e89('0x28')];var _0x26ccb8;if(_0x2512a0>=_0x2c5ee4){_0x2512a0=_0x2c5ee4;_0x26ccb8=0xc8;}else{_0x26ccb8=0xce;}_0x2accde[_0x3e89('0x23')](_0x26ccb8);return _0x2accde[_0x3e89('0x2a')](_0x3e89('0x2b'),_0xf68c8+'-'+_0x2512a0+'/'+_0x2c5ee4)[_0x3e89('0x25')](_0x3d123f);}return null;};}function patchUpdates(_0x1912ae){return function(_0x33474d){try{jsonpatch[_0x3e89('0x2c')](_0x33474d,_0x1912ae,!![]);}catch(_0x1c5939){return BPromise[_0x3e89('0x2d')](_0x1c5939);}return _0x33474d['save']();};}function saveUpdates(_0x59af9c,_0x1b74cf){return function(_0x2a91cc){if(_0x2a91cc){return _0x2a91cc[_0x3e89('0x2e')](_0x59af9c)['then'](function(_0x371b56){return _0x371b56;});}return null;};}function removeEntity(_0x4e45de,_0x422c1e){return function(_0x4d7375){if(_0x4d7375){return _0x4d7375[_0x3e89('0x2f')]()[_0x3e89('0x16')](function(){var _0x548700=_0x4d7375[_0x3e89('0x30')]({'plain':!![]});var _0x274313='Contexts';return db[_0x3e89('0x31')][_0x3e89('0x2f')]({'where':{'type':_0x274313,'resourceId':_0x548700['id']}})[_0x3e89('0x16')](function(){return _0x4d7375;});})[_0x3e89('0x16')](function(){_0x4e45de[_0x3e89('0x23')](0xcc)[_0x3e89('0x24')]();});}};}function handleEntityNotFound(_0x2d70e6,_0x1bffc5){return function(_0x2d424a){if(!_0x2d424a){_0x2d70e6[_0x3e89('0x22')](0x194);}return _0x2d424a;};}function handleError(_0x63c10e,_0xc787d7){_0xc787d7=_0xc787d7||0x1f4;return function(_0x267cb2){logger['error'](_0x267cb2[_0x3e89('0x32')]);if(_0x267cb2[_0x3e89('0x33')]){delete _0x267cb2[_0x3e89('0x33')];}_0x63c10e[_0x3e89('0x23')](_0xc787d7)[_0x3e89('0x34')](_0x267cb2);};}exports[_0x3e89('0x35')]=function(_0x599d1a,_0xdf18fc){var _0x4c5968={},_0x11d37a={},_0x49544a={'count':0x0,'rows':[]};var _0x500c90=_['map'](db['VoiceContext'][_0x3e89('0x36')],function(_0x352f80){return{'name':_0x352f80['fieldName'],'type':_0x352f80[_0x3e89('0x37')][_0x3e89('0x38')]};});_0x11d37a['model']=_['map'](_0x500c90,_0x3e89('0x33'));_0x11d37a[_0x3e89('0x39')]=_['keys'](_0x599d1a[_0x3e89('0x39')]);_0x11d37a[_0x3e89('0x3a')]=_[_0x3e89('0x3b')](_0x11d37a[_0x3e89('0x3c')],_0x11d37a[_0x3e89('0x39')]);_0x4c5968['attributes']=_[_0x3e89('0x3b')](_0x11d37a[_0x3e89('0x3c')],qs['fields'](_0x599d1a['query'][_0x3e89('0x3d')]));_0x4c5968[_0x3e89('0x3e')]=_0x4c5968[_0x3e89('0x3e')][_0x3e89('0x3f')]?_0x4c5968[_0x3e89('0x3e')]:_0x11d37a[_0x3e89('0x3c')];if(!_0x599d1a[_0x3e89('0x39')]['hasOwnProperty'](_0x3e89('0x40'))){_0x4c5968[_0x3e89('0x28')]=qs[_0x3e89('0x28')](_0x599d1a[_0x3e89('0x39')][_0x3e89('0x28')]);_0x4c5968['offset']=qs[_0x3e89('0x26')](_0x599d1a[_0x3e89('0x39')]['offset']);}_0x4c5968[_0x3e89('0x41')]=qs[_0x3e89('0x42')](_0x599d1a[_0x3e89('0x39')]['sort']);_0x4c5968['where']=qs[_0x3e89('0x3a')](_[_0x3e89('0x43')](_0x599d1a[_0x3e89('0x39')],_0x11d37a[_0x3e89('0x3a')]),_0x500c90);if(_0x599d1a[_0x3e89('0x39')][_0x3e89('0x44')]){_0x4c5968[_0x3e89('0x45')]=_[_0x3e89('0x46')](_0x4c5968[_0x3e89('0x45')],{'$or':_['map'](_0x500c90,function(_0x4bd8fc){if(_0x4bd8fc['type']!=='VIRTUAL'){var _0x82a44e={};_0x82a44e[_0x4bd8fc['name']]={'$like':'%'+_0x599d1a[_0x3e89('0x39')][_0x3e89('0x44')]+'%'};return _0x82a44e;}})});}_0x4c5968=_[_0x3e89('0x46')]({},_0x4c5968,_0x599d1a[_0x3e89('0x47')]);var _0x437bfb={'where':_0x4c5968['where']};return db[_0x3e89('0x48')]['count'](_0x437bfb)[_0x3e89('0x16')](function(_0x488954){_0x49544a[_0x3e89('0x29')]=_0x488954;if(_0x599d1a['query']['includeAll']){_0x4c5968[_0x3e89('0x49')]=[{'all':!![]}];}return db[_0x3e89('0x48')][_0x3e89('0x4a')](_0x4c5968);})['then'](function(_0x1a14b9){_0x49544a[_0x3e89('0x4b')]=_0x1a14b9;return _0x49544a;})[_0x3e89('0x16')](respondWithFilteredResult(_0xdf18fc,_0x4c5968))[_0x3e89('0x21')](handleError(_0xdf18fc,null));};exports[_0x3e89('0x4c')]=function(_0x244f14,_0x4975f6){var _0x4db88f={'raw':![],'where':{'id':_0x244f14[_0x3e89('0x4d')]['id']}},_0x20cf2c={};_0x20cf2c[_0x3e89('0x3c')]=_[_0x3e89('0x4e')](db['VoiceContext'][_0x3e89('0x36')]);_0x20cf2c[_0x3e89('0x39')]=_[_0x3e89('0x4e')](_0x244f14[_0x3e89('0x39')]);_0x20cf2c[_0x3e89('0x3a')]=_[_0x3e89('0x3b')](_0x20cf2c['model'],_0x20cf2c['query']);_0x4db88f[_0x3e89('0x3e')]=_[_0x3e89('0x3b')](_0x20cf2c[_0x3e89('0x3c')],qs[_0x3e89('0x3d')](_0x244f14['query'][_0x3e89('0x3d')]));_0x4db88f[_0x3e89('0x3e')]=_0x4db88f[_0x3e89('0x3e')][_0x3e89('0x3f')]?_0x4db88f['attributes']:_0x20cf2c['model'];if(_0x244f14[_0x3e89('0x39')][_0x3e89('0x4f')]){_0x4db88f['include']=[{'all':!![]}];}_0x4db88f=_[_0x3e89('0x46')]({},_0x4db88f,_0x244f14[_0x3e89('0x47')]);return db[_0x3e89('0x48')]['find'](_0x4db88f)[_0x3e89('0x16')](handleEntityNotFound(_0x4975f6,null))[_0x3e89('0x16')](respondWithResult(_0x4975f6,null))['catch'](handleError(_0x4975f6,null));};exports[_0x3e89('0x50')]=function(_0x19bd19,_0x25e98,_0x4e46e9){var _0x1c74e7;return db['VoiceContext'][_0x3e89('0x50')](_0x19bd19[_0x3e89('0x51')],{'raw':!![]})['then'](function(_0x148cf6){_0x1c74e7=_0x148cf6;return db['VoiceContext'][_0x3e89('0x4a')]({'raw':!![]});})['then'](function(_0x293b5a){var _0x4bad4d=fs[_0x3e89('0x52')](path['join'](config[_0x3e89('0x53')],_0x3e89('0x54')),'utf8');var _0x6b49e5=ejs[_0x3e89('0x55')](_0x4bad4d,{'contexts':_0x293b5a||[]});fs[_0x3e89('0x56')](_0x3e89('0x57'),_0x6b49e5);})[_0x3e89('0x16')](function(){return respondWithRpcPromise(_0x3e89('0x58'),_0x3e89('0x50'),{'module':'chan_sip.so'});})[_0x3e89('0x16')](function(){var _0x3615da=_0x19bd19[_0x3e89('0x59')][_0x3e89('0x30')]({'plain':!![]});if(!_0x3615da)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3615da[_0x3e89('0x5a')]===_0x3e89('0x59')){var _0x1bb28f=_0x1c74e7[_0x3e89('0x30')]({'plain':!![]});return db[_0x3e89('0x5b')][_0x3e89('0x5c')]({'where':{'name':_0x3e89('0x5d'),'userProfileId':_0x3615da['userProfileId']},'raw':!![]})[_0x3e89('0x16')](function(_0x4e13ca){if(_0x4e13ca&&_0x4e13ca[_0x3e89('0x5e')]===0x0){return db[_0x3e89('0x31')]['create']({'name':_0x1bb28f[_0x3e89('0x33')],'resourceId':_0x1bb28f['id'],'type':_0x4e13ca[_0x3e89('0x33')],'sectionId':_0x4e13ca['id']},{})[_0x3e89('0x16')](function(){return _0x1c74e7;});}else{return _0x1c74e7;}})['catch'](function(_0x4db753){logger['error'](_0x3e89('0x5f'),_0x4db753);throw _0x4db753;});}return _0x1c74e7;})[_0x3e89('0x16')](respondWithResult(_0x25e98,0xc9))['catch'](handleError(_0x25e98,null));};exports[_0x3e89('0x2e')]=function(_0x2d6408,_0x221387,_0x3b67e6){var _0x54a4c5;return db['VoiceContext']['find']({'where':{'id':_0x2d6408['params']['id']}})[_0x3e89('0x16')](handleEntityNotFound(_0x221387,null))[_0x3e89('0x16')](saveUpdates(_0x2d6408[_0x3e89('0x51')],null))['then'](function(_0xaa454e){if(_0xaa454e){_0x54a4c5=_0xaa454e;return db[_0x3e89('0x48')][_0x3e89('0x4a')]({'raw':!![]});}})[_0x3e89('0x16')](function(_0x291d76){var _0x1d86b0=fs[_0x3e89('0x52')](path[_0x3e89('0x60')](config[_0x3e89('0x53')],'server/files/templates/context.ejs'),'utf8');var _0x13e4a8=ejs[_0x3e89('0x55')](_0x1d86b0,{'contexts':_0x291d76||[]});fs[_0x3e89('0x56')](_0x3e89('0x57'),_0x13e4a8);})['then'](function(){return respondWithRpcPromise(_0x3e89('0x58'),'update',{'module':'chan_sip.so'});})[_0x3e89('0x16')](function(){return _0x54a4c5;})[_0x3e89('0x16')](respondWithResult(_0x221387,null))[_0x3e89('0x21')](handleError(_0x221387,null));};exports['destroy']=function(_0x5cd6f7,_0xea7ef4,_0x217262){var _0x4ba37b;return db[_0x3e89('0x48')][_0x3e89('0x5c')]({'where':{'id':_0x5cd6f7[_0x3e89('0x4d')]['id']}})[_0x3e89('0x16')](handleEntityNotFound(_0xea7ef4,null))[_0x3e89('0x16')](removeEntity(_0xea7ef4,null))['then'](function(){return db[_0x3e89('0x48')][_0x3e89('0x4a')]({'raw':!![]});})[_0x3e89('0x16')](function(_0x532f09){var _0x1b7c5b=fs['readFileSync'](path[_0x3e89('0x60')](config['root'],_0x3e89('0x54')),_0x3e89('0x61'));var _0x5981e7=ejs[_0x3e89('0x55')](_0x1b7c5b,{'contexts':_0x532f09});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x5981e7);return respondWithRpcPromise(_0x3e89('0x58'),'destroy',{'module':_0x3e89('0x62')});})[_0x3e89('0x21')](handleError(_0xea7ef4,null));}; \ No newline at end of file +var _0x6960=['root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','render','Reload','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','count','limit','set','apply','reject','save','update','destroy','get','Contexts','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','show','params','includeAll','find','create','body','readFileSync'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x6960,0x148));var _0x0696=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x6960[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0x0696('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0696('0x1'));var jsonpatch=require(_0x0696('0x2'));var rp=require(_0x0696('0x3'));var moment=require('moment');var BPromise=require(_0x0696('0x4'));var Mustache=require(_0x0696('0x5'));var util=require(_0x0696('0x6'));var path=require(_0x0696('0x7'));var sox=require(_0x0696('0x8'));var csv=require(_0x0696('0x9'));var ejs=require(_0x0696('0xa'));var fs=require('fs');var fs_extra=require(_0x0696('0xb'));var _=require(_0x0696('0xc'));var squel=require('squel');var crypto=require(_0x0696('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0696('0xe'));var toCsv=require(_0x0696('0x9'));var querystring=require(_0x0696('0xf'));var Papa=require(_0x0696('0x10'));var Redis=require(_0x0696('0x11'));var authService=require(_0x0696('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0696('0x13'));var hardwareService=require(_0x0696('0x14'));var logger=require('../../config/logger')(_0x0696('0x15'));var utils=require(_0x0696('0x16'));var config=require(_0x0696('0x17'));var licenseUtil=require(_0x0696('0x18'));var db=require(_0x0696('0x19'))['db'];var jayson=require(_0x0696('0x1a'));var client=jayson['client'][_0x0696('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x250a30,_0xb62064,_0x5852f5,_0x448d59){return new BPromise(function(_0x4e6ab5,_0xb3c0c2){var _0x1b9a9a=_0x448d59||client;return _0x1b9a9a[_0x0696('0x1c')](_0x250a30,_0x5852f5)[_0x0696('0x1d')](function(_0x3ebad9){logger[_0x0696('0x1e')]('VoiceContext,\x20%s,\x20%s',_0xb62064,_0x0696('0x1f'));logger['debug'](_0x0696('0x20'),_0xb62064,_0x0696('0x1f'),JSON[_0x0696('0x21')](_0x3ebad9));if(_0x3ebad9[_0x0696('0x22')]){if(_0x3ebad9['error'][_0x0696('0x23')]===0x1f4){logger['error'](_0x0696('0x24'),_0xb62064,_0x3ebad9[_0x0696('0x22')][_0x0696('0x25')]);return _0xb3c0c2(_0x3ebad9[_0x0696('0x22')][_0x0696('0x25')]);}logger[_0x0696('0x22')](_0x0696('0x24'),_0xb62064,_0x3ebad9['error'][_0x0696('0x25')]);return _0x4e6ab5(_0x3ebad9[_0x0696('0x22')][_0x0696('0x25')]);}else{logger[_0x0696('0x1e')](_0x0696('0x24'),_0xb62064,_0x0696('0x1f'));_0x4e6ab5(_0x3ebad9['result'][_0x0696('0x25')]);}})[_0x0696('0x26')](function(_0x4c3d06){logger[_0x0696('0x22')](_0x0696('0x24'),_0xb62064,_0x4c3d06);_0xb3c0c2(_0x4c3d06);});});}function respondWithStatusCode(_0x4e15a7,_0x476a01){_0x476a01=_0x476a01||0xcc;return function(_0x405690){if(_0x405690){return _0x4e15a7[_0x0696('0x27')](_0x476a01);}return _0x4e15a7[_0x0696('0x28')](_0x476a01)[_0x0696('0x29')]();};}function respondWithResult(_0x7e6c29,_0x359d90){_0x359d90=_0x359d90||0xc8;return function(_0x186c4c){if(_0x186c4c){return _0x7e6c29[_0x0696('0x28')](_0x359d90)[_0x0696('0x2a')](_0x186c4c);}};}function respondWithFilteredResult(_0x4bc439,_0x290aaf){return function(_0x4a45d0){if(_0x4a45d0){var _0x2db54f=typeof _0x290aaf[_0x0696('0x2b')]==='undefined'&&typeof _0x290aaf['limit']==='undefined';var _0x2da770=_0x4a45d0[_0x0696('0x2c')];var _0x3aca5d=_0x2db54f?0x0:_0x290aaf[_0x0696('0x2b')];var _0xccf201=_0x2db54f?_0x4a45d0['count']:_0x290aaf[_0x0696('0x2b')]+_0x290aaf[_0x0696('0x2d')];var _0x325b54;if(_0xccf201>=_0x2da770){_0xccf201=_0x2da770;_0x325b54=0xc8;}else{_0x325b54=0xce;}_0x4bc439[_0x0696('0x28')](_0x325b54);return _0x4bc439[_0x0696('0x2e')]('Content-Range',_0x3aca5d+'-'+_0xccf201+'/'+_0x2da770)[_0x0696('0x2a')](_0x4a45d0);}return null;};}function patchUpdates(_0x5ab526){return function(_0x3241bc){try{jsonpatch[_0x0696('0x2f')](_0x3241bc,_0x5ab526,!![]);}catch(_0x504027){return BPromise[_0x0696('0x30')](_0x504027);}return _0x3241bc[_0x0696('0x31')]();};}function saveUpdates(_0x1e645a,_0xaa3623){return function(_0x1d45b8){if(_0x1d45b8){return _0x1d45b8[_0x0696('0x32')](_0x1e645a)[_0x0696('0x1d')](function(_0x186355){return _0x186355;});}return null;};}function removeEntity(_0x2b40f5,_0x5b9c20){return function(_0x2285a6){if(_0x2285a6){return _0x2285a6[_0x0696('0x33')]()[_0x0696('0x1d')](function(){var _0x3724b4=_0x2285a6[_0x0696('0x34')]({'plain':!![]});var _0x2dd7e3=_0x0696('0x35');return db['UserProfileResource'][_0x0696('0x33')]({'where':{'type':_0x2dd7e3,'resourceId':_0x3724b4['id']}})[_0x0696('0x1d')](function(){return _0x2285a6;});})[_0x0696('0x1d')](function(){_0x2b40f5[_0x0696('0x28')](0xcc)[_0x0696('0x29')]();});}};}function handleEntityNotFound(_0x4bfb8a,_0x3f4978){return function(_0xe3944c){if(!_0xe3944c){_0x4bfb8a[_0x0696('0x27')](0x194);}return _0xe3944c;};}function handleError(_0x59da99,_0x21f0d4){_0x21f0d4=_0x21f0d4||0x1f4;return function(_0x36129f){logger[_0x0696('0x22')](_0x36129f[_0x0696('0x36')]);if(_0x36129f[_0x0696('0x37')]){delete _0x36129f['name'];}_0x59da99[_0x0696('0x28')](_0x21f0d4)['send'](_0x36129f);};}exports[_0x0696('0x38')]=function(_0x717712,_0x34a840){var _0x4cb7ed={},_0x391f0b={},_0x13a665={'count':0x0,'rows':[]};var _0x229887=_[_0x0696('0x39')](db[_0x0696('0x3a')][_0x0696('0x3b')],function(_0x9cfe99){return{'name':_0x9cfe99[_0x0696('0x3c')],'type':_0x9cfe99[_0x0696('0x3d')]['key']};});_0x391f0b['model']=_[_0x0696('0x39')](_0x229887,_0x0696('0x37'));_0x391f0b[_0x0696('0x3e')]=_[_0x0696('0x3f')](_0x717712['query']);_0x391f0b[_0x0696('0x40')]=_['intersection'](_0x391f0b[_0x0696('0x41')],_0x391f0b['query']);_0x4cb7ed[_0x0696('0x42')]=_[_0x0696('0x43')](_0x391f0b[_0x0696('0x41')],qs[_0x0696('0x44')](_0x717712['query'][_0x0696('0x44')]));_0x4cb7ed[_0x0696('0x42')]=_0x4cb7ed['attributes'][_0x0696('0x45')]?_0x4cb7ed[_0x0696('0x42')]:_0x391f0b['model'];if(!_0x717712[_0x0696('0x3e')][_0x0696('0x46')](_0x0696('0x47'))){_0x4cb7ed['limit']=qs[_0x0696('0x2d')](_0x717712['query'][_0x0696('0x2d')]);_0x4cb7ed[_0x0696('0x2b')]=qs['offset'](_0x717712[_0x0696('0x3e')][_0x0696('0x2b')]);}_0x4cb7ed['order']=qs['sort'](_0x717712[_0x0696('0x3e')][_0x0696('0x48')]);_0x4cb7ed['where']=qs[_0x0696('0x40')](_[_0x0696('0x49')](_0x717712[_0x0696('0x3e')],_0x391f0b[_0x0696('0x40')]),_0x229887);if(_0x717712[_0x0696('0x3e')][_0x0696('0x4a')]){_0x4cb7ed['where']=_[_0x0696('0x4b')](_0x4cb7ed[_0x0696('0x4c')],{'$or':_[_0x0696('0x39')](_0x229887,function(_0x1f1d1c){if(_0x1f1d1c[_0x0696('0x3d')]!==_0x0696('0x4d')){var _0xfacc3e={};_0xfacc3e[_0x1f1d1c[_0x0696('0x37')]]={'$like':'%'+_0x717712['query']['filter']+'%'};return _0xfacc3e;}})});}_0x4cb7ed=_[_0x0696('0x4b')]({},_0x4cb7ed,_0x717712[_0x0696('0x4e')]);var _0x30fa3f={'where':_0x4cb7ed[_0x0696('0x4c')]};return db[_0x0696('0x3a')][_0x0696('0x2c')](_0x30fa3f)['then'](function(_0x1034eb){_0x13a665[_0x0696('0x2c')]=_0x1034eb;if(_0x717712[_0x0696('0x3e')]['includeAll']){_0x4cb7ed[_0x0696('0x4f')]=[{'all':!![]}];}return db[_0x0696('0x3a')][_0x0696('0x50')](_0x4cb7ed);})['then'](function(_0xce54f0){_0x13a665['rows']=_0xce54f0;return _0x13a665;})[_0x0696('0x1d')](respondWithFilteredResult(_0x34a840,_0x4cb7ed))[_0x0696('0x26')](handleError(_0x34a840,null));};exports[_0x0696('0x51')]=function(_0x52a6bb,_0x6c3da1){var _0x3dffb6={'raw':![],'where':{'id':_0x52a6bb[_0x0696('0x52')]['id']}},_0x3e49b7={};_0x3e49b7[_0x0696('0x41')]=_[_0x0696('0x3f')](db[_0x0696('0x3a')][_0x0696('0x3b')]);_0x3e49b7[_0x0696('0x3e')]=_[_0x0696('0x3f')](_0x52a6bb[_0x0696('0x3e')]);_0x3e49b7['filters']=_[_0x0696('0x43')](_0x3e49b7['model'],_0x3e49b7[_0x0696('0x3e')]);_0x3dffb6[_0x0696('0x42')]=_[_0x0696('0x43')](_0x3e49b7[_0x0696('0x41')],qs[_0x0696('0x44')](_0x52a6bb[_0x0696('0x3e')]['fields']));_0x3dffb6[_0x0696('0x42')]=_0x3dffb6[_0x0696('0x42')]['length']?_0x3dffb6[_0x0696('0x42')]:_0x3e49b7['model'];if(_0x52a6bb[_0x0696('0x3e')][_0x0696('0x53')]){_0x3dffb6[_0x0696('0x4f')]=[{'all':!![]}];}_0x3dffb6=_[_0x0696('0x4b')]({},_0x3dffb6,_0x52a6bb['options']);return db[_0x0696('0x3a')][_0x0696('0x54')](_0x3dffb6)[_0x0696('0x1d')](handleEntityNotFound(_0x6c3da1,null))['then'](respondWithResult(_0x6c3da1,null))[_0x0696('0x26')](handleError(_0x6c3da1,null));};exports[_0x0696('0x55')]=function(_0x3c7031,_0x118b45,_0x55ac50){var _0x49c240;return db['VoiceContext'][_0x0696('0x55')](_0x3c7031[_0x0696('0x56')],{'raw':!![]})[_0x0696('0x1d')](function(_0x5d1038){_0x49c240=_0x5d1038;return db['VoiceContext'][_0x0696('0x50')]({'raw':!![]});})[_0x0696('0x1d')](function(_0x471e4b){var _0xaadaa9=fs[_0x0696('0x57')](path['join'](config[_0x0696('0x58')],_0x0696('0x59')),_0x0696('0x5a'));var _0x4560c7=ejs['render'](_0xaadaa9,{'contexts':_0x471e4b||[]});fs[_0x0696('0x5b')](_0x0696('0x5c'),_0x4560c7);})[_0x0696('0x1d')](function(){return respondWithRpcPromise('Reload',_0x0696('0x55'),{'module':_0x0696('0x5d')});})[_0x0696('0x1d')](function(){var _0x38b63d=_0x3c7031[_0x0696('0x5e')][_0x0696('0x34')]({'plain':!![]});if(!_0x38b63d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38b63d[_0x0696('0x5f')]===_0x0696('0x5e')){var _0x19f34b=_0x49c240[_0x0696('0x34')]({'plain':!![]});return db[_0x0696('0x60')][_0x0696('0x54')]({'where':{'name':'Contexts','userProfileId':_0x38b63d[_0x0696('0x61')]},'raw':!![]})['then'](function(_0x22ecfa){if(_0x22ecfa&&_0x22ecfa[_0x0696('0x62')]===0x0){return db[_0x0696('0x63')][_0x0696('0x55')]({'name':_0x19f34b[_0x0696('0x37')],'resourceId':_0x19f34b['id'],'type':_0x22ecfa[_0x0696('0x37')],'sectionId':_0x22ecfa['id']},{})[_0x0696('0x1d')](function(){return _0x49c240;});}else{return _0x49c240;}})[_0x0696('0x26')](function(_0x1251b8){logger[_0x0696('0x22')](_0x0696('0x64'),_0x1251b8);throw _0x1251b8;});}return _0x49c240;})[_0x0696('0x1d')](respondWithResult(_0x118b45,0xc9))['catch'](handleError(_0x118b45,null));};exports[_0x0696('0x32')]=function(_0x5f459d,_0x3e60c4,_0x121570){var _0x3f311c;return db[_0x0696('0x3a')]['find']({'where':{'id':_0x5f459d[_0x0696('0x52')]['id']}})[_0x0696('0x1d')](handleEntityNotFound(_0x3e60c4,null))['then'](saveUpdates(_0x5f459d[_0x0696('0x56')],null))[_0x0696('0x1d')](function(_0xd2435){if(_0xd2435){_0x3f311c=_0xd2435;return db['VoiceContext'][_0x0696('0x50')]({'raw':!![]});}})[_0x0696('0x1d')](function(_0x114c05){var _0x1b7584=fs['readFileSync'](path[_0x0696('0x65')](config[_0x0696('0x58')],'server/files/templates/context.ejs'),_0x0696('0x5a'));var _0x18e811=ejs[_0x0696('0x66')](_0x1b7584,{'contexts':_0x114c05||[]});fs[_0x0696('0x5b')](_0x0696('0x5c'),_0x18e811);})[_0x0696('0x1d')](function(){return respondWithRpcPromise(_0x0696('0x67'),'update',{'module':_0x0696('0x5d')});})[_0x0696('0x1d')](function(){return _0x3f311c;})[_0x0696('0x1d')](respondWithResult(_0x3e60c4,null))[_0x0696('0x26')](handleError(_0x3e60c4,null));};exports[_0x0696('0x33')]=function(_0x1e1f87,_0x18ca1a,_0x52aabf){var _0x3c51f;return db[_0x0696('0x3a')][_0x0696('0x54')]({'where':{'id':_0x1e1f87['params']['id']}})['then'](handleEntityNotFound(_0x18ca1a,null))[_0x0696('0x1d')](removeEntity(_0x18ca1a,null))[_0x0696('0x1d')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x0696('0x1d')](function(_0x2774da){var _0x232c42=fs['readFileSync'](path['join'](config[_0x0696('0x58')],_0x0696('0x59')),'utf8');var _0x47b844=ejs[_0x0696('0x66')](_0x232c42,{'contexts':_0x2774da});fs[_0x0696('0x5b')](_0x0696('0x5c'),_0x47b844);return respondWithRpcPromise(_0x0696('0x67'),'destroy',{'module':_0x0696('0x5d')});})[_0x0696('0x26')](handleError(_0x18ca1a,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 4514482..a0eb817 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 _0x9900=['bluebird','request-promise','path','rimraf','./voiceContext.attributes','define','VoiceContext','voice_contexts','util','../../config/logger','api'];(function(_0x18e1eb,_0x3a4a41){var _0xc0667c=function(_0xff8251){while(--_0xff8251){_0x18e1eb['push'](_0x18e1eb['shift']());}};_0xc0667c(++_0x3a4a41);}(_0x9900,0x19f));var _0x0990=function(_0x5813c1,_0x22ae23){_0x5813c1=_0x5813c1-0x0;var _0x4f343f=_0x9900[_0x5813c1];return _0x4f343f;};'use strict';var _=require('lodash');var util=require(_0x0990('0x0'));var logger=require(_0x0990('0x1'))(_0x0990('0x2'));var moment=require('moment');var BPromise=require(_0x0990('0x3'));var rp=require(_0x0990('0x4'));var fs=require('fs');var path=require(_0x0990('0x5'));var rimraf=require(_0x0990('0x6'));var config=require('../../config/environment');var attributes=require(_0x0990('0x7'));module['exports']=function(_0x46de3d,_0x1949e6){return _0x46de3d[_0x0990('0x8')](_0x0990('0x9'),attributes,{'tableName':_0x0990('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa37a=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','util'];(function(_0x2ad502,_0x2b6085){var _0x24fdfc=function(_0x5821ec){while(--_0x5821ec){_0x2ad502['push'](_0x2ad502['shift']());}};_0x24fdfc(++_0x2b6085);}(_0xa37a,0x135));var _0xaa37=function(_0x5d8661,_0x138fa8){_0x5d8661=_0x5d8661-0x0;var _0x4c3da7=_0xa37a[_0x5d8661];return _0x4c3da7;};'use strict';var _=require('lodash');var util=require(_0xaa37('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xaa37('0x1'));var rp=require(_0xaa37('0x2'));var fs=require('fs');var path=require(_0xaa37('0x3'));var rimraf=require(_0xaa37('0x4'));var config=require(_0xaa37('0x5'));var attributes=require(_0xaa37('0x6'));module[_0xaa37('0x7')]=function(_0x2fa31a,_0x247706){return _0x2fa31a['define'](_0xaa37('0x8'),attributes,{'tableName':_0xaa37('0x9'),'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 4e7f04a..12154a2 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 _0xd1d3=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x44387d,_0x25e5a0){var _0x3a5242=function(_0xe31bfb){while(--_0xe31bfb){_0x44387d['push'](_0x44387d['shift']());}};_0x3a5242(++_0x25e5a0);}(_0xd1d3,0xd7));var _0x3d1d=function(_0x43caf5,_0x3d33f8){_0x43caf5=_0x43caf5-0x0;var _0x3d6acc=_0xd1d3[_0x43caf5];return _0x3d6acc;};'use strict';var _=require(_0x3d1d('0x0'));var util=require('util');var moment=require(_0x3d1d('0x1'));var BPromise=require('bluebird');var rs=require(_0x3d1d('0x2'));var fs=require('fs');var Redis=require(_0x3d1d('0x3'));var db=require(_0x3d1d('0x4'))['db'];var utils=require(_0x3d1d('0x5'));var logger=require(_0x3d1d('0x6'))('rpc');var config=require(_0x3d1d('0x7'));var jayson=require(_0x3d1d('0x8'));var client=jayson['client'][_0x3d1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4431f6,_0x57d7db,_0x160c87){return new BPromise(function(_0x70ca94,_0x7ba595){return client[_0x3d1d('0xa')](_0x4431f6,_0x160c87)[_0x3d1d('0xb')](function(_0x41e786){logger[_0x3d1d('0xc')](_0x3d1d('0xd'),_0x57d7db,_0x3d1d('0xe'));logger[_0x3d1d('0xf')](_0x3d1d('0x10'),_0x57d7db,_0x3d1d('0xe'),JSON[_0x3d1d('0x11')](_0x41e786));if(_0x41e786[_0x3d1d('0x12')]){if(_0x41e786[_0x3d1d('0x12')][_0x3d1d('0x13')]===0x1f4){logger[_0x3d1d('0x12')](_0x3d1d('0xd'),_0x57d7db,_0x41e786[_0x3d1d('0x12')]['message']);return _0x7ba595(_0x41e786[_0x3d1d('0x12')][_0x3d1d('0x14')]);}logger[_0x3d1d('0x12')](_0x3d1d('0xd'),_0x57d7db,_0x41e786[_0x3d1d('0x12')][_0x3d1d('0x14')]);return _0x70ca94(_0x41e786[_0x3d1d('0x12')][_0x3d1d('0x14')]);}else{logger['info'](_0x3d1d('0xd'),_0x57d7db,_0x3d1d('0xe'));_0x70ca94(_0x41e786['result']['message']);}})[_0x3d1d('0x15')](function(_0x2c9c51){logger[_0x3d1d('0x12')](_0x3d1d('0xd'),_0x57d7db,_0x2c9c51);_0x7ba595(_0x2c9c51);});});} \ No newline at end of file +var _0x1a4d=['message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3ebdaf,_0x39ee83){var _0x3bc141=function(_0x1d0fa8){while(--_0x1d0fa8){_0x3ebdaf['push'](_0x3ebdaf['shift']());}};_0x3bc141(++_0x39ee83);}(_0x1a4d,0x189));var _0xd1a4=function(_0x2bec0e,_0x2d06b3){_0x2bec0e=_0x2bec0e-0x0;var _0x439982=_0x1a4d[_0x2bec0e];return _0x439982;};'use strict';var _=require(_0xd1a4('0x0'));var util=require(_0xd1a4('0x1'));var moment=require('moment');var BPromise=require(_0xd1a4('0x2'));var rs=require(_0xd1a4('0x3'));var fs=require('fs');var Redis=require(_0xd1a4('0x4'));var db=require(_0xd1a4('0x5'))['db'];var utils=require(_0xd1a4('0x6'));var logger=require(_0xd1a4('0x7'))(_0xd1a4('0x8'));var config=require(_0xd1a4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd1a4('0xa')][_0xd1a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29010f,_0x37f83c,_0x238061){return new BPromise(function(_0x86c4e4,_0xb89e6){return client[_0xd1a4('0xc')](_0x29010f,_0x238061)[_0xd1a4('0xd')](function(_0x1c6c5d){logger['info'](_0xd1a4('0xe'),_0x37f83c,'request\x20sent');logger[_0xd1a4('0xf')](_0xd1a4('0x10'),_0x37f83c,_0xd1a4('0x11'),JSON[_0xd1a4('0x12')](_0x1c6c5d));if(_0x1c6c5d[_0xd1a4('0x13')]){if(_0x1c6c5d[_0xd1a4('0x13')][_0xd1a4('0x14')]===0x1f4){logger[_0xd1a4('0x13')](_0xd1a4('0xe'),_0x37f83c,_0x1c6c5d[_0xd1a4('0x13')]['message']);return _0xb89e6(_0x1c6c5d[_0xd1a4('0x13')]['message']);}logger[_0xd1a4('0x13')](_0xd1a4('0xe'),_0x37f83c,_0x1c6c5d[_0xd1a4('0x13')]['message']);return _0x86c4e4(_0x1c6c5d[_0xd1a4('0x13')][_0xd1a4('0x15')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x37f83c,_0xd1a4('0x11'));_0x86c4e4(_0x1c6c5d['result']['message']);}})[_0xd1a4('0x16')](function(_0x426a47){logger['error'](_0xd1a4('0xe'),_0x37f83c,_0x426a47);_0xb89e6(_0x426a47);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 9d7ccd7..aaba074 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 _0xcf9d=['index','get','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller','isAuthenticated'];(function(_0xedc9ed,_0x18870a){var _0x174596=function(_0x80fd13){while(--_0x80fd13){_0xedc9ed['push'](_0xedc9ed['shift']());}};_0x174596(++_0x18870a);}(_0xcf9d,0x147));var _0xdcf9=function(_0x329cac,_0x1bef3c){_0x329cac=_0x329cac-0x0;var _0x59e34e=_0xcf9d[_0x329cac];return _0x59e34e;};'use strict';var multer=require('multer');var util=require(_0xdcf9('0x0'));var path=require(_0xdcf9('0x1'));var timeout=require(_0xdcf9('0x2'));var express=require(_0xdcf9('0x3'));var router=express[_0xdcf9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdcf9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdcf9('0x6'));var controller=require(_0xdcf9('0x7'));router['get']('/',auth[_0xdcf9('0x8')](),controller[_0xdcf9('0x9')]);router[_0xdcf9('0xa')](_0xdcf9('0xb'),auth[_0xdcf9('0x8')](),controller[_0xdcf9('0xc')]);router[_0xdcf9('0xa')](_0xdcf9('0xd'),auth[_0xdcf9('0x8')](),controller[_0xdcf9('0xe')]);router[_0xdcf9('0xf')]('/',auth[_0xdcf9('0x8')](),controller[_0xdcf9('0x10')]);router[_0xdcf9('0x11')](_0xdcf9('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xdcf9('0x12')](_0xdcf9('0xd'),auth[_0xdcf9('0x8')](),controller[_0xdcf9('0x13')]);module[_0xdcf9('0x14')]=router; \ No newline at end of file +var _0x05cd=['create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','show'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x05cd,0x65));var _0xd05c=function(_0x6ab1f,_0x168847){_0x6ab1f=_0x6ab1f-0x0;var _0x52b066=_0x05cd[_0x6ab1f];return _0x52b066;};'use strict';var multer=require(_0xd05c('0x0'));var util=require(_0xd05c('0x1'));var path=require(_0xd05c('0x2'));var timeout=require(_0xd05c('0x3'));var express=require(_0xd05c('0x4'));var router=express[_0xd05c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd05c('0x6'));var interaction=require(_0xd05c('0x7'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0xd05c('0x8')]('/',auth['isAuthenticated'](),controller[_0xd05c('0x9')]);router['get'](_0xd05c('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xd05c('0x8')]('/:id',auth[_0xd05c('0xb')](),controller[_0xd05c('0xc')]);router['post']('/',auth[_0xd05c('0xb')](),controller[_0xd05c('0xd')]);router[_0xd05c('0xe')](_0xd05c('0xf'),auth[_0xd05c('0xb')](),controller[_0xd05c('0x10')]);router['delete'](_0xd05c('0xf'),auth[_0xd05c('0xb')](),controller[_0xd05c('0x11')]);module[_0xd05c('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index ea5fb38..dd674ef 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x5a97cd,_0x55bf33){var _0x107ae4=function(_0x82e1a8){while(--_0x82e1a8){_0x5a97cd['push'](_0x5a97cd['shift']());}};_0x107ae4(++_0x55bf33);}(_0x6aa7,0x178));var _0x76aa=function(_0x426283,_0x408488){_0x426283=_0x426283-0x0;var _0x152833=_0x6aa7[_0x426283];return _0x152833;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'channelstate':{'type':Sequelize[_0x76aa('0x2')]},'channelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x76aa('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x2')]},'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'linkedid':{'type':Sequelize[_0x76aa('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x76aa('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'destlanguage':{'type':Sequelize[_0x76aa('0x1')]},'destaccountcode':{'type':Sequelize[_0x76aa('0x1')]},'destcontext':{'type':Sequelize[_0x76aa('0x1')]},'destexten':{'type':Sequelize[_0x76aa('0x1')]},'destpriority':{'type':Sequelize[_0x76aa('0x2')]},'destuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'destlinkedid':{'type':Sequelize[_0x76aa('0x1')]},'dialstring':{'type':Sequelize[_0x76aa('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x76aa('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x76aa('0x3')]},'lastevent':{'type':Sequelize[_0x76aa('0x1')],'comment':_0x76aa('0x4')},'routeId':{'type':Sequelize[_0x76aa('0x2')]},'duration':{'type':Sequelize[_0x76aa('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x54ef=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x54ef,0x112));var _0xf54e=function(_0x212eb2,_0xd810f4){_0x212eb2=_0x212eb2-0x0;var _0x1a4565=_0x54ef[_0x212eb2];return _0x1a4565;};'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 91e091f..e638d4e 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 _0x4047=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','create','body','params','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x4047,0x12b));var _0x7404=function(_0x310c56,_0x355e7e){_0x310c56=_0x310c56-0x0;var _0x2dad8c=_0x4047[_0x310c56];return _0x2dad8c;};'use strict';var emlformat=require(_0x7404('0x0'));var rimraf=require(_0x7404('0x1'));var zipdir=require(_0x7404('0x2'));var jsonpatch=require(_0x7404('0x3'));var rp=require(_0x7404('0x4'));var moment=require(_0x7404('0x5'));var BPromise=require(_0x7404('0x6'));var Mustache=require(_0x7404('0x7'));var util=require(_0x7404('0x8'));var path=require(_0x7404('0x9'));var sox=require(_0x7404('0xa'));var csv=require(_0x7404('0xb'));var ejs=require(_0x7404('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7404('0xd'));var squel=require(_0x7404('0xe'));var crypto=require(_0x7404('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7404('0xb'));var querystring=require(_0x7404('0x10'));var Papa=require(_0x7404('0x11'));var Redis=require(_0x7404('0x12'));var authService=require(_0x7404('0x13'));var qs=require(_0x7404('0x14'));var as=require(_0x7404('0x15'));var hardwareService=require(_0x7404('0x16'));var logger=require(_0x7404('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x7404('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dabd8,_0x2831df){_0x2831df=_0x2831df||0xcc;return function(_0x40746c){if(_0x40746c){return _0x5dabd8[_0x7404('0x19')](_0x2831df);}return _0x5dabd8['status'](_0x2831df)[_0x7404('0x1a')]();};}function respondWithResult(_0x2200e9,_0x4b94a7){_0x4b94a7=_0x4b94a7||0xc8;return function(_0xbdb992){if(_0xbdb992){return _0x2200e9[_0x7404('0x1b')](_0x4b94a7)['json'](_0xbdb992);}};}function respondWithFilteredResult(_0x42e673,_0x596145){return function(_0x87dedc){if(_0x87dedc){var _0x426033=typeof _0x596145[_0x7404('0x1c')]===_0x7404('0x1d')&&typeof _0x596145[_0x7404('0x1e')]===_0x7404('0x1d');var _0x27eb5c=_0x87dedc[_0x7404('0x1f')];var _0x5241b2=_0x426033?0x0:_0x596145[_0x7404('0x1c')];var _0x40bcb4=_0x426033?_0x87dedc['count']:_0x596145['offset']+_0x596145[_0x7404('0x1e')];var _0x503ee9;if(_0x40bcb4>=_0x27eb5c){_0x40bcb4=_0x27eb5c;_0x503ee9=0xc8;}else{_0x503ee9=0xce;}_0x42e673[_0x7404('0x1b')](_0x503ee9);return _0x42e673['set']('Content-Range',_0x5241b2+'-'+_0x40bcb4+'/'+_0x27eb5c)[_0x7404('0x20')](_0x87dedc);}return null;};}function patchUpdates(_0x3b34dd){return function(_0x347197){try{jsonpatch[_0x7404('0x21')](_0x347197,_0x3b34dd,!![]);}catch(_0x3b97cc){return BPromise[_0x7404('0x22')](_0x3b97cc);}return _0x347197['save']();};}function saveUpdates(_0x556d8f,_0xcfc623){return function(_0x31eee6){if(_0x31eee6){return _0x31eee6[_0x7404('0x23')](_0x556d8f)[_0x7404('0x24')](function(_0x50b346){return _0x50b346;});}return null;};}function removeEntity(_0x2a82e6,_0x4d1715){return function(_0x4f4e4d){if(_0x4f4e4d){return _0x4f4e4d[_0x7404('0x25')]()['then'](function(){_0x2a82e6[_0x7404('0x1b')](0xcc)[_0x7404('0x1a')]();});}};}function handleEntityNotFound(_0x22d23d,_0x2ce787){return function(_0x48980c){if(!_0x48980c){_0x22d23d[_0x7404('0x19')](0x194);}return _0x48980c;};}function handleError(_0x4b97ea,_0x1c6f2f){_0x1c6f2f=_0x1c6f2f||0x1f4;return function(_0x49ddea){logger[_0x7404('0x26')](_0x49ddea[_0x7404('0x27')]);if(_0x49ddea[_0x7404('0x28')]){delete _0x49ddea[_0x7404('0x28')];}_0x4b97ea[_0x7404('0x1b')](_0x1c6f2f)[_0x7404('0x29')](_0x49ddea);};}exports[_0x7404('0x2a')]=function(_0x1dec08,_0x1c73f3){var _0x1ba12e={},_0x1d1eb0={},_0x41e851={'count':0x0,'rows':[]};var _0x36bb0b=_[_0x7404('0x2b')](db[_0x7404('0x2c')][_0x7404('0x2d')],function(_0x42a8a8){return{'name':_0x42a8a8[_0x7404('0x2e')],'type':_0x42a8a8[_0x7404('0x2f')][_0x7404('0x30')]};});_0x1d1eb0[_0x7404('0x31')]=_[_0x7404('0x2b')](_0x36bb0b,_0x7404('0x28'));_0x1d1eb0[_0x7404('0x32')]=_[_0x7404('0x33')](_0x1dec08[_0x7404('0x32')]);_0x1d1eb0[_0x7404('0x34')]=_[_0x7404('0x35')](_0x1d1eb0[_0x7404('0x31')],_0x1d1eb0[_0x7404('0x32')]);_0x1ba12e[_0x7404('0x36')]=_[_0x7404('0x35')](_0x1d1eb0[_0x7404('0x31')],qs[_0x7404('0x37')](_0x1dec08[_0x7404('0x32')][_0x7404('0x37')]));_0x1ba12e[_0x7404('0x36')]=_0x1ba12e[_0x7404('0x36')][_0x7404('0x38')]?_0x1ba12e[_0x7404('0x36')]:_0x1d1eb0['model'];if(!_0x1dec08[_0x7404('0x32')][_0x7404('0x39')]('nolimit')){_0x1ba12e[_0x7404('0x1e')]=qs[_0x7404('0x1e')](_0x1dec08[_0x7404('0x32')][_0x7404('0x1e')]);_0x1ba12e['offset']=qs[_0x7404('0x1c')](_0x1dec08[_0x7404('0x32')][_0x7404('0x1c')]);}_0x1ba12e[_0x7404('0x3a')]=qs[_0x7404('0x3b')](_0x1dec08['query'][_0x7404('0x3b')]);_0x1ba12e[_0x7404('0x3c')]=qs[_0x7404('0x34')](_[_0x7404('0x3d')](_0x1dec08[_0x7404('0x32')],_0x1d1eb0[_0x7404('0x34')]),_0x36bb0b);if(_0x1dec08[_0x7404('0x32')][_0x7404('0x3e')]){_0x1ba12e[_0x7404('0x3c')]=_['merge'](_0x1ba12e[_0x7404('0x3c')],{'$or':_[_0x7404('0x2b')](_0x36bb0b,function(_0x1edad2){if(_0x1edad2[_0x7404('0x2f')]!==_0x7404('0x3f')){var _0x28ffde={};_0x28ffde[_0x1edad2['name']]={'$like':'%'+_0x1dec08[_0x7404('0x32')][_0x7404('0x3e')]+'%'};return _0x28ffde;}})});}_0x1ba12e=_[_0x7404('0x40')]({},_0x1ba12e,_0x1dec08[_0x7404('0x41')]);var _0x816ac0={'where':_0x1ba12e[_0x7404('0x3c')]};return db[_0x7404('0x2c')][_0x7404('0x1f')](_0x816ac0)[_0x7404('0x24')](function(_0x444553){_0x41e851[_0x7404('0x1f')]=_0x444553;if(_0x1dec08[_0x7404('0x32')][_0x7404('0x42')]){_0x1ba12e['include']=[{'all':!![]}];}return db[_0x7404('0x2c')][_0x7404('0x43')](_0x1ba12e);})[_0x7404('0x24')](function(_0x3472c9){_0x41e851[_0x7404('0x44')]=_0x3472c9;return _0x41e851;})[_0x7404('0x24')](respondWithFilteredResult(_0x1c73f3,_0x1ba12e))[_0x7404('0x45')](handleError(_0x1c73f3,null));};exports[_0x7404('0x46')]=function(_0x420aa9,_0x295edc){var _0xe8acf5={'raw':!![],'where':{'id':_0x420aa9['params']['id']}},_0x246977={};_0x246977[_0x7404('0x31')]=_[_0x7404('0x33')](db[_0x7404('0x2c')][_0x7404('0x2d')]);_0x246977[_0x7404('0x32')]=_['keys'](_0x420aa9[_0x7404('0x32')]);_0x246977[_0x7404('0x34')]=_['intersection'](_0x246977[_0x7404('0x31')],_0x246977[_0x7404('0x32')]);_0xe8acf5[_0x7404('0x36')]=_[_0x7404('0x35')](_0x246977[_0x7404('0x31')],qs[_0x7404('0x37')](_0x420aa9[_0x7404('0x32')]['fields']));_0xe8acf5[_0x7404('0x36')]=_0xe8acf5['attributes']['length']?_0xe8acf5[_0x7404('0x36')]:_0x246977['model'];if(_0x420aa9[_0x7404('0x32')][_0x7404('0x42')]){_0xe8acf5['include']=[{'all':!![]}];}_0xe8acf5=_[_0x7404('0x40')]({},_0xe8acf5,_0x420aa9['options']);return db[_0x7404('0x2c')]['find'](_0xe8acf5)[_0x7404('0x24')](handleEntityNotFound(_0x295edc,null))[_0x7404('0x24')](respondWithResult(_0x295edc,null))[_0x7404('0x45')](handleError(_0x295edc,null));};exports['create']=function(_0x5a8f50,_0x5d5d80){return db['VoiceDialReport'][_0x7404('0x47')](_0x5a8f50[_0x7404('0x48')],{})[_0x7404('0x24')](respondWithResult(_0x5d5d80,0xc9))[_0x7404('0x45')](handleError(_0x5d5d80,null));};exports[_0x7404('0x23')]=function(_0x8409c9,_0x1997fb){if(_0x8409c9[_0x7404('0x48')]['id']){delete _0x8409c9[_0x7404('0x48')]['id'];}return db[_0x7404('0x2c')]['find']({'where':{'id':_0x8409c9[_0x7404('0x49')]['id']}})[_0x7404('0x24')](handleEntityNotFound(_0x1997fb,null))[_0x7404('0x24')](saveUpdates(_0x8409c9[_0x7404('0x48')],null))[_0x7404('0x24')](respondWithResult(_0x1997fb,null))[_0x7404('0x45')](handleError(_0x1997fb,null));};exports['destroy']=function(_0x25a2e3,_0xff648b){return db[_0x7404('0x2c')][_0x7404('0x4a')]({'where':{'id':_0x25a2e3[_0x7404('0x49')]['id']}})[_0x7404('0x24')](handleEntityNotFound(_0xff648b,null))[_0x7404('0x24')](removeEntity(_0xff648b,null))['catch'](handleError(_0xff648b,null));};exports[_0x7404('0x4b')]=function(_0xdc837c,_0xedb69){return db['VoiceDialReport'][_0x7404('0x4b')]()[_0x7404('0x24')](respondWithResult(_0xedb69,null))['catch'](handleError(_0xedb69,null));}; \ No newline at end of file +var _0x10ec=['reject','update','then','destroy','end','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','key','keys','query','intersection','length','attributes','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','model','fields','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','Content-Range','apply'];(function(_0x5370b0,_0x328e3b){var _0x431856=function(_0x4410c8){while(--_0x4410c8){_0x5370b0['push'](_0x5370b0['shift']());}};_0x431856(++_0x328e3b);}(_0x10ec,0x1eb));var _0xc10e=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x10ec[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0xc10e('0x0'));var rimraf=require(_0xc10e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc10e('0x2'));var rp=require(_0xc10e('0x3'));var moment=require('moment');var BPromise=require(_0xc10e('0x4'));var Mustache=require('mustache');var util=require(_0xc10e('0x5'));var path=require(_0xc10e('0x6'));var sox=require(_0xc10e('0x7'));var csv=require(_0xc10e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc10e('0x9'));var _=require(_0xc10e('0xa'));var squel=require(_0xc10e('0xb'));var crypto=require(_0xc10e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc10e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc10e('0xe'));var Papa=require(_0xc10e('0xf'));var Redis=require(_0xc10e('0x10'));var authService=require(_0xc10e('0x11'));var qs=require(_0xc10e('0x12'));var as=require(_0xc10e('0x13'));var hardwareService=require(_0xc10e('0x14'));var logger=require(_0xc10e('0x15'))(_0xc10e('0x16'));var utils=require(_0xc10e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc10e('0x18'));var db=require(_0xc10e('0x19'))['db'];function respondWithStatusCode(_0x7f70f2,_0x57e0bd){_0x57e0bd=_0x57e0bd||0xcc;return function(_0x2e2c7c){if(_0x2e2c7c){return _0x7f70f2[_0xc10e('0x1a')](_0x57e0bd);}return _0x7f70f2[_0xc10e('0x1b')](_0x57e0bd)['end']();};}function respondWithResult(_0x4c1224,_0x197d31){_0x197d31=_0x197d31||0xc8;return function(_0x2b053e){if(_0x2b053e){return _0x4c1224[_0xc10e('0x1b')](_0x197d31)[_0xc10e('0x1c')](_0x2b053e);}};}function respondWithFilteredResult(_0x125fd4,_0x57f5d1){return function(_0x293b86){if(_0x293b86){var _0x1e7c0e=typeof _0x57f5d1[_0xc10e('0x1d')]==='undefined'&&typeof _0x57f5d1['limit']==='undefined';var _0x3dbc63=_0x293b86['count'];var _0x46357b=_0x1e7c0e?0x0:_0x57f5d1[_0xc10e('0x1d')];var _0x39b23b=_0x1e7c0e?_0x293b86[_0xc10e('0x1e')]:_0x57f5d1[_0xc10e('0x1d')]+_0x57f5d1[_0xc10e('0x1f')];var _0x331238;if(_0x39b23b>=_0x3dbc63){_0x39b23b=_0x3dbc63;_0x331238=0xc8;}else{_0x331238=0xce;}_0x125fd4[_0xc10e('0x1b')](_0x331238);return _0x125fd4['set'](_0xc10e('0x20'),_0x46357b+'-'+_0x39b23b+'/'+_0x3dbc63)[_0xc10e('0x1c')](_0x293b86);}return null;};}function patchUpdates(_0x5577ef){return function(_0x4f1eb3){try{jsonpatch[_0xc10e('0x21')](_0x4f1eb3,_0x5577ef,!![]);}catch(_0x546c4a){return BPromise[_0xc10e('0x22')](_0x546c4a);}return _0x4f1eb3['save']();};}function saveUpdates(_0x3f38ef,_0x25429c){return function(_0x29602){if(_0x29602){return _0x29602[_0xc10e('0x23')](_0x3f38ef)[_0xc10e('0x24')](function(_0x2f7cf2){return _0x2f7cf2;});}return null;};}function removeEntity(_0x1433c6,_0x466125){return function(_0x57cb75){if(_0x57cb75){return _0x57cb75[_0xc10e('0x25')]()[_0xc10e('0x24')](function(){_0x1433c6[_0xc10e('0x1b')](0xcc)[_0xc10e('0x26')]();});}};}function handleEntityNotFound(_0x20139d,_0x10fc73){return function(_0x523f6d){if(!_0x523f6d){_0x20139d['sendStatus'](0x194);}return _0x523f6d;};}function handleError(_0xbfebf4,_0x5bb0ed){_0x5bb0ed=_0x5bb0ed||0x1f4;return function(_0x5bad87){logger['error'](_0x5bad87[_0xc10e('0x27')]);if(_0x5bad87['name']){delete _0x5bad87[_0xc10e('0x28')];}_0xbfebf4['status'](_0x5bb0ed)[_0xc10e('0x29')](_0x5bad87);};}exports['index']=function(_0x27eb8e,_0x580b40){var _0x5c9568={},_0x383f18={},_0x3960e5={'count':0x0,'rows':[]};var _0x4b81e1=_[_0xc10e('0x2a')](db[_0xc10e('0x2b')][_0xc10e('0x2c')],function(_0x562fc8){return{'name':_0x562fc8[_0xc10e('0x2d')],'type':_0x562fc8['type'][_0xc10e('0x2e')]};});_0x383f18['model']=_[_0xc10e('0x2a')](_0x4b81e1,_0xc10e('0x28'));_0x383f18['query']=_[_0xc10e('0x2f')](_0x27eb8e[_0xc10e('0x30')]);_0x383f18['filters']=_[_0xc10e('0x31')](_0x383f18['model'],_0x383f18[_0xc10e('0x30')]);_0x5c9568['attributes']=_[_0xc10e('0x31')](_0x383f18['model'],qs['fields'](_0x27eb8e['query']['fields']));_0x5c9568['attributes']=_0x5c9568['attributes'][_0xc10e('0x32')]?_0x5c9568[_0xc10e('0x33')]:_0x383f18['model'];if(!_0x27eb8e[_0xc10e('0x30')]['hasOwnProperty'](_0xc10e('0x34'))){_0x5c9568[_0xc10e('0x1f')]=qs[_0xc10e('0x1f')](_0x27eb8e['query'][_0xc10e('0x1f')]);_0x5c9568[_0xc10e('0x1d')]=qs[_0xc10e('0x1d')](_0x27eb8e[_0xc10e('0x30')][_0xc10e('0x1d')]);}_0x5c9568[_0xc10e('0x35')]=qs[_0xc10e('0x36')](_0x27eb8e[_0xc10e('0x30')][_0xc10e('0x36')]);_0x5c9568[_0xc10e('0x37')]=qs[_0xc10e('0x38')](_[_0xc10e('0x39')](_0x27eb8e['query'],_0x383f18['filters']),_0x4b81e1);if(_0x27eb8e[_0xc10e('0x30')][_0xc10e('0x3a')]){_0x5c9568['where']=_[_0xc10e('0x3b')](_0x5c9568[_0xc10e('0x37')],{'$or':_[_0xc10e('0x2a')](_0x4b81e1,function(_0x54ff40){if(_0x54ff40[_0xc10e('0x3c')]!==_0xc10e('0x3d')){var _0x4a0f00={};_0x4a0f00[_0x54ff40[_0xc10e('0x28')]]={'$like':'%'+_0x27eb8e[_0xc10e('0x30')]['filter']+'%'};return _0x4a0f00;}})});}_0x5c9568=_[_0xc10e('0x3b')]({},_0x5c9568,_0x27eb8e[_0xc10e('0x3e')]);var _0x237882={'where':_0x5c9568[_0xc10e('0x37')]};return db[_0xc10e('0x2b')]['count'](_0x237882)[_0xc10e('0x24')](function(_0x2922f2){_0x3960e5[_0xc10e('0x1e')]=_0x2922f2;if(_0x27eb8e[_0xc10e('0x30')][_0xc10e('0x3f')]){_0x5c9568[_0xc10e('0x40')]=[{'all':!![]}];}return db[_0xc10e('0x2b')][_0xc10e('0x41')](_0x5c9568);})[_0xc10e('0x24')](function(_0xb4d856){_0x3960e5['rows']=_0xb4d856;return _0x3960e5;})[_0xc10e('0x24')](respondWithFilteredResult(_0x580b40,_0x5c9568))[_0xc10e('0x42')](handleError(_0x580b40,null));};exports[_0xc10e('0x43')]=function(_0x2a7a38,_0x6855f0){var _0x4ed40f={'raw':!![],'where':{'id':_0x2a7a38[_0xc10e('0x44')]['id']}},_0xc6b6e8={};_0xc6b6e8[_0xc10e('0x45')]=_[_0xc10e('0x2f')](db['VoiceDialReport'][_0xc10e('0x2c')]);_0xc6b6e8[_0xc10e('0x30')]=_[_0xc10e('0x2f')](_0x2a7a38[_0xc10e('0x30')]);_0xc6b6e8[_0xc10e('0x38')]=_[_0xc10e('0x31')](_0xc6b6e8['model'],_0xc6b6e8['query']);_0x4ed40f[_0xc10e('0x33')]=_[_0xc10e('0x31')](_0xc6b6e8[_0xc10e('0x45')],qs[_0xc10e('0x46')](_0x2a7a38[_0xc10e('0x30')][_0xc10e('0x46')]));_0x4ed40f[_0xc10e('0x33')]=_0x4ed40f[_0xc10e('0x33')]['length']?_0x4ed40f[_0xc10e('0x33')]:_0xc6b6e8[_0xc10e('0x45')];if(_0x2a7a38[_0xc10e('0x30')]['includeAll']){_0x4ed40f[_0xc10e('0x40')]=[{'all':!![]}];}_0x4ed40f=_['merge']({},_0x4ed40f,_0x2a7a38[_0xc10e('0x3e')]);return db[_0xc10e('0x2b')]['find'](_0x4ed40f)[_0xc10e('0x24')](handleEntityNotFound(_0x6855f0,null))['then'](respondWithResult(_0x6855f0,null))['catch'](handleError(_0x6855f0,null));};exports[_0xc10e('0x47')]=function(_0x295458,_0x14eab9){return db[_0xc10e('0x2b')][_0xc10e('0x47')](_0x295458[_0xc10e('0x48')],{})[_0xc10e('0x24')](respondWithResult(_0x14eab9,0xc9))[_0xc10e('0x42')](handleError(_0x14eab9,null));};exports[_0xc10e('0x23')]=function(_0x295fdb,_0x279caf){if(_0x295fdb[_0xc10e('0x48')]['id']){delete _0x295fdb['body']['id'];}return db[_0xc10e('0x2b')][_0xc10e('0x49')]({'where':{'id':_0x295fdb[_0xc10e('0x44')]['id']}})[_0xc10e('0x24')](handleEntityNotFound(_0x279caf,null))['then'](saveUpdates(_0x295fdb[_0xc10e('0x48')],null))[_0xc10e('0x24')](respondWithResult(_0x279caf,null))[_0xc10e('0x42')](handleError(_0x279caf,null));};exports[_0xc10e('0x25')]=function(_0x565de9,_0x588569){return db['VoiceDialReport'][_0xc10e('0x49')]({'where':{'id':_0x565de9['params']['id']}})[_0xc10e('0x24')](handleEntityNotFound(_0x588569,null))[_0xc10e('0x24')](removeEntity(_0x588569,null))[_0xc10e('0x42')](handleError(_0x588569,null));};exports[_0xc10e('0x4a')]=function(_0x28e20b,_0x5214fe){return db[_0xc10e('0x2b')][_0xc10e('0x4a')]()[_0xc10e('0x24')](respondWithResult(_0x5214fe,null))[_0xc10e('0x42')](handleError(_0x5214fe,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ea981a6..a4d3f08 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 _0x95d9=['request-promise','path','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x3eecda,_0x211bac){var _0x1980d8=function(_0x57f98c){while(--_0x57f98c){_0x3eecda['push'](_0x3eecda['shift']());}};_0x1980d8(++_0x211bac);}(_0x95d9,0x97));var _0x995d=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x95d9[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x995d('0x0'));var util=require(_0x995d('0x1'));var logger=require(_0x995d('0x2'))(_0x995d('0x3'));var moment=require('moment');var BPromise=require(_0x995d('0x4'));var rp=require(_0x995d('0x5'));var fs=require('fs');var path=require(_0x995d('0x6'));var rimraf=require('rimraf');var config=require(_0x995d('0x7'));var attributes=require(_0x995d('0x8'));module[_0x995d('0x9')]=function(_0x226250,_0xe6d244){return _0x226250['define'](_0x995d('0xa'),attributes,{'tableName':_0x995d('0xb'),'paranoid':![],'indexes':[{'fields':[_0x995d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1156=['rimraf','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x3efc91,_0x2f1ce4){var _0x24ef7c=function(_0x49fd09){while(--_0x49fd09){_0x3efc91['push'](_0x3efc91['shift']());}};_0x24ef7c(++_0x2f1ce4);}(_0x1156,0x1a8));var _0x6115=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x1156[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x6115('0x0'));var util=require('util');var logger=require(_0x6115('0x1'))(_0x6115('0x2'));var moment=require(_0x6115('0x3'));var BPromise=require(_0x6115('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6115('0x5'));var rimraf=require(_0x6115('0x6'));var config=require(_0x6115('0x7'));var attributes=require(_0x6115('0x8'));module['exports']=function(_0x520dd9,_0x58f8a2){return _0x520dd9['define'](_0x6115('0x9'),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 99dc93d..a50504c 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 _0x32c9=['result','VoiceDialReport','create','body','options','CreateVoiceDialReport','catch','UpdateVoiceDialReport','attributes','limit','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','VoiceDialReport,\x20%s,\x20%s','message'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0x32c9,0xc5));var _0x932c=function(_0x4387a0,_0x1650ac){_0x4387a0=_0x4387a0-0x0;var _0x1184af=_0x32c9[_0x4387a0];return _0x1184af;};'use strict';var _=require('lodash');var util=require(_0x932c('0x0'));var moment=require(_0x932c('0x1'));var BPromise=require(_0x932c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x932c('0x3'));var db=require(_0x932c('0x4'))['db'];var utils=require(_0x932c('0x5'));var logger=require(_0x932c('0x6'))(_0x932c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x932c('0x8')][_0x932c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f485c,_0x4ad980,_0x2f1d46){return new BPromise(function(_0x1fc312,_0x5b04c4){return client[_0x932c('0xa')](_0x4f485c,_0x2f1d46)[_0x932c('0xb')](function(_0x10f897){logger[_0x932c('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x4ad980,_0x932c('0xd'));logger[_0x932c('0xe')](_0x932c('0xf'),_0x4ad980,'request\x20sent',JSON['stringify'](_0x10f897));if(_0x10f897[_0x932c('0x10')]){if(_0x10f897['error'][_0x932c('0x11')]===0x1f4){logger[_0x932c('0x10')](_0x932c('0x12'),_0x4ad980,_0x10f897[_0x932c('0x10')][_0x932c('0x13')]);return _0x5b04c4(_0x10f897[_0x932c('0x10')][_0x932c('0x13')]);}logger[_0x932c('0x10')](_0x932c('0x12'),_0x4ad980,_0x10f897[_0x932c('0x10')][_0x932c('0x13')]);return _0x1fc312(_0x10f897['error']['message']);}else{logger['info'](_0x932c('0x12'),_0x4ad980,_0x932c('0xd'));_0x1fc312(_0x10f897[_0x932c('0x14')][_0x932c('0x13')]);}})['catch'](function(_0x342371){logger['error'](_0x932c('0x12'),_0x4ad980,_0x342371);_0x5b04c4(_0x342371);});});}exports['CreateVoiceDialReport']=function(_0x37309b){var _0x247d04=this;return new Promise(function(_0x6964ce,_0x312199){return db[_0x932c('0x15')][_0x932c('0x16')](_0x37309b[_0x932c('0x17')],{'raw':_0x37309b[_0x932c('0x18')]?_0x37309b[_0x932c('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x553148){logger[_0x932c('0xc')](_0x932c('0x19'),_0x37309b);logger[_0x932c('0xe')](_0x932c('0x19'),_0x37309b,JSON['stringify'](_0x553148));_0x6964ce(_0x553148);})[_0x932c('0x1a')](function(_0x427060){logger[_0x932c('0x10')](_0x932c('0x19'),_0x427060[_0x932c('0x13')],_0x37309b);_0x312199(_0x247d04[_0x932c('0x10')](0x1f4,_0x427060[_0x932c('0x13')]));});});};exports[_0x932c('0x1b')]=function(_0x1d5ec3){var _0x483130=this;return new Promise(function(_0x1685f2,_0x253b87){return db['VoiceDialReport']['update'](_0x1d5ec3[_0x932c('0x17')],{'raw':_0x1d5ec3[_0x932c('0x18')]?_0x1d5ec3[_0x932c('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d5ec3[_0x932c('0x18')]?_0x1d5ec3['options']['where']||null:null,'attributes':_0x1d5ec3[_0x932c('0x18')]?_0x1d5ec3[_0x932c('0x18')][_0x932c('0x1c')]||null:null,'limit':_0x1d5ec3[_0x932c('0x18')]?_0x1d5ec3[_0x932c('0x18')][_0x932c('0x1d')]||null:null})[_0x932c('0xb')](function(_0x3730c4){logger['info'](_0x932c('0x1b'),_0x1d5ec3);logger[_0x932c('0xe')]('UpdateVoiceDialReport',_0x1d5ec3,JSON[_0x932c('0x1e')](_0x3730c4));_0x1685f2(_0x3730c4);})[_0x932c('0x1a')](function(_0x20f711){logger['error'](_0x932c('0x1b'),_0x20f711['message'],_0x1d5ec3);_0x253b87(_0x483130[_0x932c('0x10')](0x1f4,_0x20f711['message']));});});}; \ No newline at end of file +var _0xaafa=['request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateVoiceDialReport','body','options','raw','then','stringify','VoiceDialReport','update','where','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','VoiceDialReport,\x20%s,\x20%s'];(function(_0x5c8a32,_0x2197c6){var _0x338e7d=function(_0x255be6){while(--_0x255be6){_0x5c8a32['push'](_0x5c8a32['shift']());}};_0x338e7d(++_0x2197c6);}(_0xaafa,0x12a));var _0xaaaf=function(_0x3711e3,_0x40eedd){_0x3711e3=_0x3711e3-0x0;var _0x26e810=_0xaafa[_0x3711e3];return _0x26e810;};'use strict';var _=require(_0xaaaf('0x0'));var util=require(_0xaaaf('0x1'));var moment=require(_0xaaaf('0x2'));var BPromise=require(_0xaaaf('0x3'));var rs=require(_0xaaaf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaaaf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaaaf('0x6'))(_0xaaaf('0x7'));var config=require(_0xaaaf('0x8'));var jayson=require(_0xaaaf('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x577790,_0x50d3dd,_0x2fa6b3){return new BPromise(function(_0x1e3419,_0x4a9789){return client[_0xaaaf('0xa')](_0x577790,_0x2fa6b3)['then'](function(_0x11496b){logger['info'](_0xaaaf('0xb'),_0x50d3dd,_0xaaaf('0xc'));logger[_0xaaaf('0xd')](_0xaaaf('0xe'),_0x50d3dd,_0xaaaf('0xc'),JSON['stringify'](_0x11496b));if(_0x11496b[_0xaaaf('0xf')]){if(_0x11496b['error']['code']===0x1f4){logger['error'](_0xaaaf('0xb'),_0x50d3dd,_0x11496b['error']['message']);return _0x4a9789(_0x11496b[_0xaaaf('0xf')][_0xaaaf('0x10')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x50d3dd,_0x11496b['error']['message']);return _0x1e3419(_0x11496b['error'][_0xaaaf('0x10')]);}else{logger[_0xaaaf('0x11')](_0xaaaf('0xb'),_0x50d3dd,_0xaaaf('0xc'));_0x1e3419(_0x11496b[_0xaaaf('0x12')][_0xaaaf('0x10')]);}})[_0xaaaf('0x13')](function(_0x3b7c1f){logger[_0xaaaf('0xf')](_0xaaaf('0xb'),_0x50d3dd,_0x3b7c1f);_0x4a9789(_0x3b7c1f);});});}exports[_0xaaaf('0x14')]=function(_0x4b6fbe){var _0x4bcc06=this;return new Promise(function(_0x341228,_0x496934){return db['VoiceDialReport']['create'](_0x4b6fbe[_0xaaaf('0x15')],{'raw':_0x4b6fbe[_0xaaaf('0x16')]?_0x4b6fbe['options'][_0xaaaf('0x17')]===undefined?!![]:![]:!![]})[_0xaaaf('0x18')](function(_0x38b027){logger[_0xaaaf('0x11')](_0xaaaf('0x14'),_0x4b6fbe);logger[_0xaaaf('0xd')]('CreateVoiceDialReport',_0x4b6fbe,JSON[_0xaaaf('0x19')](_0x38b027));_0x341228(_0x38b027);})[_0xaaaf('0x13')](function(_0x87c49a){logger['error'](_0xaaaf('0x14'),_0x87c49a[_0xaaaf('0x10')],_0x4b6fbe);_0x496934(_0x4bcc06[_0xaaaf('0xf')](0x1f4,_0x87c49a[_0xaaaf('0x10')]));});});};exports['UpdateVoiceDialReport']=function(_0x39f63e){var _0xbdd8f1=this;return new Promise(function(_0x25fcbd,_0x47f9d5){return db[_0xaaaf('0x1a')][_0xaaaf('0x1b')](_0x39f63e['body'],{'raw':_0x39f63e['options']?_0x39f63e[_0xaaaf('0x16')][_0xaaaf('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39f63e['options']?_0x39f63e['options'][_0xaaaf('0x1c')]||null:null,'attributes':_0x39f63e[_0xaaaf('0x16')]?_0x39f63e[_0xaaaf('0x16')]['attributes']||null:null,'limit':_0x39f63e[_0xaaaf('0x16')]?_0x39f63e[_0xaaaf('0x16')][_0xaaaf('0x1d')]||null:null})['then'](function(_0x2b8c78){logger[_0xaaaf('0x11')](_0xaaaf('0x1e'),_0x39f63e);logger[_0xaaaf('0xd')]('UpdateVoiceDialReport',_0x39f63e,JSON[_0xaaaf('0x19')](_0x2b8c78));_0x25fcbd(_0x2b8c78);})['catch'](function(_0xc7f113){logger[_0xaaaf('0xf')](_0xaaaf('0x1e'),_0xc7f113[_0xaaaf('0x10')],_0x39f63e);_0x47f9d5(_0xbdd8f1['error'](0x1f4,_0xc7f113['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 1d16f86..3f86c82 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 _0xc994=['create','/:id/applications','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xc994,0x69));var _0x4c99=function(_0x53700e,_0xcfd4f1){_0x53700e=_0x53700e-0x0;var _0x38f11c=_0xc994[_0x53700e];return _0x38f11c;};'use strict';var multer=require(_0x4c99('0x0'));var util=require(_0x4c99('0x1'));var path=require(_0x4c99('0x2'));var timeout=require(_0x4c99('0x3'));var express=require('express');var router=express[_0x4c99('0x4')]();var fs_extra=require(_0x4c99('0x5'));var auth=require(_0x4c99('0x6'));var interaction=require(_0x4c99('0x7'));var config=require('../../config/environment');var controller=require(_0x4c99('0x8'));router['get']('/',auth[_0x4c99('0x9')](),controller[_0x4c99('0xa')]);router[_0x4c99('0xb')](_0x4c99('0xc'),auth[_0x4c99('0x9')](),controller[_0x4c99('0xd')]);router[_0x4c99('0xe')]('/',auth['isAuthenticated'](),controller[_0x4c99('0xf')]);router[_0x4c99('0xe')](_0x4c99('0x10'),auth[_0x4c99('0x9')](),controller['addApplications']);router[_0x4c99('0x11')](_0x4c99('0xc'),auth[_0x4c99('0x9')](),controller[_0x4c99('0x12')]);router['delete'](_0x4c99('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4c99('0x13')]=router; \ No newline at end of file +var _0xe0a9=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','post','create','/:id/applications','addApplications','put','update','delete'];(function(_0x1d453f,_0x5793a9){var _0x50996a=function(_0x59bdf3){while(--_0x59bdf3){_0x1d453f['push'](_0x1d453f['shift']());}};_0x50996a(++_0x5793a9);}(_0xe0a9,0xb2));var _0x9e0a=function(_0x11ac28,_0x228442){_0x11ac28=_0x11ac28-0x0;var _0x542b61=_0xe0a9[_0x11ac28];return _0x542b61;};'use strict';var multer=require(_0x9e0a('0x0'));var util=require('util');var path=require(_0x9e0a('0x1'));var timeout=require(_0x9e0a('0x2'));var express=require('express');var router=express[_0x9e0a('0x3')]();var fs_extra=require(_0x9e0a('0x4'));var auth=require(_0x9e0a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9e0a('0x6'));var controller=require(_0x9e0a('0x7'));router[_0x9e0a('0x8')]('/',auth['isAuthenticated'](),controller[_0x9e0a('0x9')]);router['get'](_0x9e0a('0xa'),auth[_0x9e0a('0xb')](),controller[_0x9e0a('0xc')]);router[_0x9e0a('0xd')]('/',auth['isAuthenticated'](),controller[_0x9e0a('0xe')]);router['post'](_0x9e0a('0xf'),auth['isAuthenticated'](),controller[_0x9e0a('0x10')]);router[_0x9e0a('0x11')](_0x9e0a('0xa'),auth[_0x9e0a('0xb')](),controller[_0x9e0a('0x12')]);router[_0x9e0a('0x13')](_0x9e0a('0xa'),auth[_0x9e0a('0xb')](),controller[_0x9e0a('0x14')]);module[_0x9e0a('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index a9e2324..6bab83d 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 _0x6fb6=['wav','getDataValue','exten','sequelize','exports','compositeIndex','STRING','NoOp','ENUM','outbound','internal','inbound-fax','system','any','BOOLEAN','INTEGER'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x6fb6,0x1b3));var _0x66fb=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x6fb6[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require(_0x66fb('0x0'));module[_0x66fb('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x66fb('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x66fb('0x3')],'allowNull':![],'unique':_0x66fb('0x2')},'priority':{'type':Sequelize[_0x66fb('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x66fb('0x2')},'tag':{'type':Sequelize[_0x66fb('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x66fb('0x3')],'allowNull':![],'defaultValue':_0x66fb('0x4')},'appdata':{'type':Sequelize[_0x66fb('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x66fb('0x5')]('inbound',_0x66fb('0x6'),_0x66fb('0x7'),_0x66fb('0x8'),'outbound-fax',_0x66fb('0x9'),_0x66fb('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x66fb('0x3')]},'interval':{'type':Sequelize[_0x66fb('0x3')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x66fb('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x66fb('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x66fb('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0x66fb('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x66fb('0xc')]},'recordingFormat':{'type':Sequelize[_0x66fb('0x3')],'defaultValue':_0x66fb('0xd')},'answer':{'type':Sequelize[_0x66fb('0xb')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1630ce){return this[_0x66fb('0xe')](_0x66fb('0xf'));}},'alias':{'type':Sequelize[_0x66fb('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0xaf0e=['*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','ENUM','inbound','internal','inbound-fax','outbound-fax','system','any'];(function(_0x4fcf54,_0x198472){var _0x316e21=function(_0x57e43e){while(--_0x57e43e){_0x4fcf54['push'](_0x4fcf54['shift']());}};_0x316e21(++_0x198472);}(_0xaf0e,0x97));var _0xeaf0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xaf0e[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xeaf0('0x0'));module[_0xeaf0('0x1')]={'context':{'type':Sequelize[_0xeaf0('0x2')],'allowNull':![],'unique':_0xeaf0('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xeaf0('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xeaf0('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xeaf0('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xeaf0('0x4')](_0xeaf0('0x5'),'outbound',_0xeaf0('0x6'),_0xeaf0('0x7'),_0xeaf0('0x8'),_0xeaf0('0x9'),_0xeaf0('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xeaf0('0x2')],'allowNull':![],'defaultValue':_0xeaf0('0xb')},'IntervalId':{'type':Sequelize[_0xeaf0('0xc')]},'isApp':{'type':Sequelize[_0xeaf0('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xeaf0('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xeaf0('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xeaf0('0xc')]},'recordingFormat':{'type':Sequelize[_0xeaf0('0x2')],'defaultValue':_0xeaf0('0xe')},'answer':{'type':Sequelize[_0xeaf0('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xeaf0('0xf')],'get':function(_0xeea554){return this[_0xeaf0('0x10')](_0xeaf0('0x11'));}},'alias':{'type':Sequelize[_0xeaf0('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 61dd9fa..a0391e1 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 _0xb3a7=['findAll','rows','catch','show','params','rawAttributes','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','recordingFormat','cutdigits','mandatoryDisposition','alias','context','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','createRouting','cast(priority\x20as\x20unsigned)','finally','send','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','type','find','name','UserProfileResource','error','stack','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','VoiceExtension','includeAll','include'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb3a7,0x130));var _0x7b3a=function(_0x50f113,_0xd1e006){_0x50f113=_0x50f113-0x0;var _0x21d7ef=_0xb3a7[_0x50f113];return _0x21d7ef;};'use strict';var _=require(_0x7b3a('0x0'));var Redis=require('ioredis');var qs=require(_0x7b3a('0x1'));var logger=require(_0x7b3a('0x2'))(_0x7b3a('0x3'));var config=require(_0x7b3a('0x4'));var db=require(_0x7b3a('0x5'))['db'];config[_0x7b3a('0x6')]=_[_0x7b3a('0x7')](config[_0x7b3a('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b3a('0x6')]));require(_0x7b3a('0x8'))[_0x7b3a('0x9')](socket);function respondWithStatusCode(_0xdd97d0,_0x506af9){_0x506af9=_0x506af9||0xcc;return function(_0x3ea16d){if(_0x3ea16d){return _0xdd97d0[_0x7b3a('0xa')](_0x506af9);}return _0xdd97d0[_0x7b3a('0xb')](_0x506af9)[_0x7b3a('0xc')]();};}function respondWithResult(_0x390e13,_0x4f63f4){_0x4f63f4=_0x4f63f4||0xc8;return function(_0x2abd7b){if(_0x2abd7b){return _0x390e13[_0x7b3a('0xb')](_0x4f63f4)[_0x7b3a('0xd')](_0x2abd7b);}};}function respondWithFilteredResult(_0x5d8864,_0x462674){return function(_0x324140){if(_0x324140){var _0x2b2a4b=typeof _0x462674[_0x7b3a('0xe')]===_0x7b3a('0xf')&&typeof _0x462674[_0x7b3a('0x10')]===_0x7b3a('0xf');var _0x444bc4=_0x324140[_0x7b3a('0x11')];var _0x43397f=_0x2b2a4b?0x0:_0x462674['offset'];var _0x4e3396=_0x2b2a4b?_0x324140[_0x7b3a('0x11')]:_0x462674[_0x7b3a('0xe')]+_0x462674[_0x7b3a('0x10')];var _0x3e8db6;if(_0x4e3396>=_0x444bc4){_0x4e3396=_0x444bc4;_0x3e8db6=0xc8;}else{_0x3e8db6=0xce;}_0x5d8864['status'](_0x3e8db6);return _0x5d8864['set'](_0x7b3a('0x12'),_0x43397f+'-'+_0x4e3396+'/'+_0x444bc4)['json'](_0x324140);}return null;};}function removeEntity(_0x32172e){return function(_0xc948a7){if(_0xc948a7){return _0xc948a7[_0x7b3a('0x13')]()[_0x7b3a('0x14')](function(){var _0x5a1b96=_0xc948a7[_0x7b3a('0x15')]({'plain':!![]});var _0x287c99=[{'name':_0x7b3a('0x16'),'value':_0x7b3a('0x17'),'ignore':![]},{'name':_0x7b3a('0x18'),'value':_0x7b3a('0x19'),'ignore':![]},{'name':_0x7b3a('0x1a'),'value':_0x7b3a('0x1b'),'ignore':![]}];var _0x5eeb3a=_(_0x287c99)[_0x7b3a('0x1c')](_0x7b3a('0x1d'))[_0x7b3a('0x1e')](_0x7b3a('0x1f'))[_0x7b3a('0x1f')]();if(_['includes'](_0x5eeb3a,_0x5a1b96[_0x7b3a('0x20')])){return;}var _0x34673b=_[_0x7b3a('0x21')](_0x287c99,[_0x7b3a('0x1f'),_0x5a1b96['type']])[_0x7b3a('0x22')];return db[_0x7b3a('0x23')]['destroy']({'where':{'type':_0x34673b,'resourceId':_0x5a1b96['id']}})['then'](function(){return _0xc948a7;});})['then'](function(){_0x32172e[_0x7b3a('0xb')](0xcc)[_0x7b3a('0xc')]();});}};}function handleEntityNotFound(_0x512c1d){return function(_0x476258){if(!_0x476258){_0x512c1d[_0x7b3a('0xa')](0x194);}return _0x476258;};}function handleError(_0x163a51,_0x4acbc4){_0x4acbc4=_0x4acbc4||0x1f4;return function(_0x5cf632){logger[_0x7b3a('0x24')](_0x5cf632[_0x7b3a('0x25')]);if(_0x5cf632[_0x7b3a('0x22')]){delete _0x5cf632['name'];}_0x163a51['status'](_0x4acbc4)['send'](_0x5cf632);};}exports['index']=function(_0x44eb93,_0x40e56d){var _0x480dbf={},_0x193ec4={},_0x555ae2={'count':0x0,'rows':[]};var _0x20184a=_[_0x7b3a('0x1e')](db['VoiceExtension']['rawAttributes'],function(_0x318a89){return{'name':_0x318a89['fieldName'],'type':_0x318a89[_0x7b3a('0x20')][_0x7b3a('0x26')]};});_0x193ec4['model']=_['map'](_0x20184a,'name');_0x193ec4['query']=_[_0x7b3a('0x27')](_0x44eb93[_0x7b3a('0x28')]);_0x193ec4['filters']=_[_0x7b3a('0x29')](_0x193ec4[_0x7b3a('0x2a')],_0x193ec4['query']);_0x480dbf[_0x7b3a('0x2b')]=_[_0x7b3a('0x29')](_0x193ec4[_0x7b3a('0x2a')],qs[_0x7b3a('0x2c')](_0x44eb93['query'][_0x7b3a('0x2c')]));_0x480dbf['attributes']=_0x480dbf['attributes'][_0x7b3a('0x2d')]?_0x480dbf[_0x7b3a('0x2b')]:_0x193ec4[_0x7b3a('0x2a')];if(!_0x44eb93[_0x7b3a('0x28')][_0x7b3a('0x2e')]('nolimit')){_0x480dbf['limit']=qs[_0x7b3a('0x10')](_0x44eb93[_0x7b3a('0x28')][_0x7b3a('0x10')]);_0x480dbf[_0x7b3a('0xe')]=qs[_0x7b3a('0xe')](_0x44eb93[_0x7b3a('0x28')][_0x7b3a('0xe')]);}_0x480dbf[_0x7b3a('0x2f')]=qs['sort'](_0x44eb93[_0x7b3a('0x28')][_0x7b3a('0x30')]);_0x480dbf[_0x7b3a('0x31')]=qs['filters'](_[_0x7b3a('0x32')](_0x44eb93[_0x7b3a('0x28')],_0x193ec4[_0x7b3a('0x33')]),_0x20184a);if(_0x44eb93['query']['filter']){_0x480dbf[_0x7b3a('0x31')]=_['merge'](_0x480dbf[_0x7b3a('0x31')],{'$or':_[_0x7b3a('0x1e')](_0x20184a,function(_0x3fe1d8){if(_0x3fe1d8[_0x7b3a('0x20')]!=='VIRTUAL'){var _0x5c6442={};_0x5c6442[_0x3fe1d8['name']]={'$like':'%'+_0x44eb93[_0x7b3a('0x28')][_0x7b3a('0x1c')]+'%'};return _0x5c6442;}})});}_0x480dbf=_[_0x7b3a('0x34')]({},_0x480dbf,_0x44eb93['options']);var _0x479e23={'where':_0x480dbf[_0x7b3a('0x31')]};return db[_0x7b3a('0x35')][_0x7b3a('0x11')](_0x479e23)['then'](function(_0x169d47){_0x555ae2[_0x7b3a('0x11')]=_0x169d47;if(_0x44eb93['query'][_0x7b3a('0x36')]){_0x480dbf[_0x7b3a('0x37')]=[{'all':!![]}];}return db['VoiceExtension'][_0x7b3a('0x38')](_0x480dbf);})[_0x7b3a('0x14')](function(_0x218f10){_0x555ae2[_0x7b3a('0x39')]=_0x218f10;return _0x555ae2;})[_0x7b3a('0x14')](respondWithFilteredResult(_0x40e56d,_0x480dbf))[_0x7b3a('0x3a')](handleError(_0x40e56d,null));};exports[_0x7b3a('0x3b')]=function(_0x2854d7,_0x2e866a){var _0x294ee9={'raw':![],'where':{'id':_0x2854d7[_0x7b3a('0x3c')]['id']}},_0x3bcccc={};_0x3bcccc[_0x7b3a('0x2a')]=_[_0x7b3a('0x27')](db[_0x7b3a('0x35')][_0x7b3a('0x3d')]);_0x3bcccc['query']=_[_0x7b3a('0x27')](_0x2854d7[_0x7b3a('0x28')]);_0x3bcccc[_0x7b3a('0x33')]=_[_0x7b3a('0x29')](_0x3bcccc[_0x7b3a('0x2a')],_0x3bcccc[_0x7b3a('0x28')]);_0x294ee9[_0x7b3a('0x2b')]=_[_0x7b3a('0x29')](_0x3bcccc['model'],qs[_0x7b3a('0x2c')](_0x2854d7['query'][_0x7b3a('0x2c')]));_0x294ee9['attributes']=_0x294ee9[_0x7b3a('0x2b')]['length']?_0x294ee9[_0x7b3a('0x2b')]:_0x3bcccc['model'];if(_0x2854d7[_0x7b3a('0x28')][_0x7b3a('0x36')]){_0x294ee9[_0x7b3a('0x37')]=[{'all':!![]}];}_0x294ee9=_[_0x7b3a('0x34')]({},_0x294ee9,_0x2854d7['options']);return db[_0x7b3a('0x35')][_0x7b3a('0x21')](_0x294ee9)['then'](handleEntityNotFound(_0x2e866a,null))[_0x7b3a('0x14')](respondWithResult(_0x2e866a,null))[_0x7b3a('0x3a')](handleError(_0x2e866a,null));};exports[_0x7b3a('0x13')]=function(_0x5a7e4b,_0x4a1d3c){return db[_0x7b3a('0x35')][_0x7b3a('0x21')]({'where':{'id':_0x5a7e4b[_0x7b3a('0x3c')]['id']}})[_0x7b3a('0x14')](handleEntityNotFound(_0x4a1d3c,null))[_0x7b3a('0x14')](removeEntity(_0x4a1d3c,null))[_0x7b3a('0x3a')](handleError(_0x4a1d3c,null));};exports[_0x7b3a('0x3e')]=function(_0x4b4175,_0x333072){if(_0x4b4175[_0x7b3a('0x3f')][_0x7b3a('0x20')]===_0x7b3a('0x19')&&!_[_0x7b3a('0x40')](_0x4b4175['body'][_0x7b3a('0x41')],'_')){_0x4b4175[_0x7b3a('0x3f')][_0x7b3a('0x41')]='_'[_0x7b3a('0x42')](_0x4b4175[_0x7b3a('0x3f')]['exten']);}return db[_0x7b3a('0x35')][_0x7b3a('0x3e')](_0x4b4175['body'],{'raw':![]})[_0x7b3a('0x14')](function(_0x311b0a){var _0x2bf8b5=_0x4b4175[_0x7b3a('0x43')]['get']({'plain':!![]});if(!_0x2bf8b5)throw new Error(_0x7b3a('0x44'));if(_0x2bf8b5[_0x7b3a('0x45')]===_0x7b3a('0x43')){var _0xa9611c=_0x311b0a[_0x7b3a('0x15')]({'plain':!![]});var _0x4d1d6b=[{'name':_0x7b3a('0x16'),'value':_0x7b3a('0x17')},{'name':_0x7b3a('0x18'),'value':_0x7b3a('0x19')},{'name':'InternalRoutes','value':_0x7b3a('0x1b')}];var _0x115e74=_[_0x7b3a('0x21')](_0x4d1d6b,[_0x7b3a('0x1f'),_0xa9611c[_0x7b3a('0x20')]])['name'];return db[_0x7b3a('0x46')][_0x7b3a('0x21')]({'where':{'name':_0x115e74,'userProfileId':_0x2bf8b5[_0x7b3a('0x47')]},'raw':!![]})[_0x7b3a('0x14')](function(_0x59c079){if(_0x59c079&&_0x59c079['autoAssociation']===0x0){return db[_0x7b3a('0x23')]['create']({'name':_0xa9611c['name'],'resourceId':_0xa9611c['id'],'type':_0x59c079[_0x7b3a('0x22')],'sectionId':_0x59c079['id']},{})[_0x7b3a('0x14')](function(){return _0x311b0a;});}else{return _0x311b0a;}})[_0x7b3a('0x3a')](function(_0x27ede1){logger['error'](_0x7b3a('0x48'),_0x27ede1);throw _0x27ede1;});}return _0x311b0a;})[_0x7b3a('0x14')](respondWithResult(_0x333072,0xc9))['catch'](handleError(_0x333072,null));};exports[_0x7b3a('0x49')]=function(_0x196e87,_0x2b1b4f){if(_0x196e87[_0x7b3a('0x3f')]['id']){delete _0x196e87[_0x7b3a('0x3f')]['id'];}return db[_0x7b3a('0x35')][_0x7b3a('0x21')]({'where':{'id':_0x196e87[_0x7b3a('0x3c')]['id']}})[_0x7b3a('0x14')](handleEntityNotFound(_0x2b1b4f,null))['then'](function(_0x5c92d0){if(_0x5c92d0){return db[_0x7b3a('0x35')][_0x7b3a('0x49')](_[_0x7b3a('0x32')](_0x196e87['body'],['exten','context','description',_0x7b3a('0x4a'),_0x7b3a('0x4b'),_0x7b3a('0x4c'),_0x7b3a('0x4d')]),{'where':{'context':_0x5c92d0[_0x7b3a('0x4e')],'exten':_0x5c92d0[_0x7b3a('0x41')]},'individualHooks':!![]})[_0x7b3a('0x14')](function(_0x38901a){return _0x38901a;});}return null;})[_0x7b3a('0x14')](respondWithStatusCode(_0x2b1b4f,null))['catch'](handleError(_0x2b1b4f,null));};exports['addApplications']=function(_0x828be0,_0x449b5c){var _0x545a91=_0x828be0[_0x7b3a('0x3c')]['id'];var _0x16abc3=_0x828be0[_0x7b3a('0x3f')];var _0x202a2d=0xc8;var _0x154df5=null;return db[_0x7b3a('0x4f')][_0x7b3a('0x50')]({'isolationLevel':db[_0x7b3a('0x4f')][_0x7b3a('0x51')][_0x7b3a('0x52')][_0x7b3a('0x53')]},function(_0x132251){return db[_0x7b3a('0x35')][_0x7b3a('0x54')]({'where':{'id':_0x545a91},'transaction':_0x132251})['then'](function(_0x469a96){if(_0x469a96){return db['VoiceExtension'][_0x7b3a('0x13')]({'where':{'VoiceExtensionId':_0x545a91},'transaction':_0x132251})[_0x7b3a('0x14')](function(){var _0x2da355=_[_0x7b3a('0x1e')](_0x16abc3,function(_0x496fd4){_0x496fd4['VoiceExtensionId']=_0x545a91;_0x496fd4[_0x7b3a('0x55')]=!![];return _0x496fd4;});return _0x469a96[_0x7b3a('0x56')](_0x2da355);})['then'](function(_0x3dba50){return db[_0x7b3a('0x35')]['bulkCreate'](_0x3dba50,{'transaction':_0x132251});});}else{_0x202a2d=0x194;_0x154df5=[];}});})[_0x7b3a('0x14')](function(){if(_0x202a2d!==0x194){return db[_0x7b3a('0x35')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x545a91},'order':_0x7b3a('0x57')})['then'](function(_0x1be084){_0x154df5=_0x1be084;});}})['catch'](function(_0x3f9307){_0x202a2d=0x1f4;logger[_0x7b3a('0x24')](_0x3f9307[_0x7b3a('0x25')]);if(_0x3f9307[_0x7b3a('0x22')]){delete _0x3f9307[_0x7b3a('0x22')];}_0x154df5=_0x3f9307;})[_0x7b3a('0x58')](function(){if(_0x154df5===null){_0x449b5c[_0x7b3a('0xa')](_0x202a2d);}else{if(_0x202a2d===0x1f4){_0x449b5c['status'](_0x202a2d)[_0x7b3a('0x59')](_0x154df5);}else{_0x449b5c[_0x7b3a('0xb')](_0x202a2d)[_0x7b3a('0xd')](_0x154df5);}}});}; \ No newline at end of file +var _0x6359=['error','update','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','type','find','value','name','destroy','end','stack','send','index','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','keys','VoiceExtension','include','params','create','startsWith','exten','body','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x8a22fd,_0x3f6c4e){var _0x3e12fe=function(_0x23f52e){while(--_0x23f52e){_0x8a22fd['push'](_0x8a22fd['shift']());}};_0x3e12fe(++_0x3f6c4e);}(_0x6359,0x1e9));var _0x9635=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6359[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9635('0x0'));var Redis=require(_0x9635('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x9635('0x2'));var config=require(_0x9635('0x3'));var db=require('../../mysqldb')['db'];config[_0x9635('0x4')]=_[_0x9635('0x5')](config[_0x9635('0x4')],{'host':_0x9635('0x6'),'port':0x18eb});var socket=require(_0x9635('0x7'))(new Redis(config[_0x9635('0x4')]));require(_0x9635('0x8'))[_0x9635('0x9')](socket);function respondWithStatusCode(_0x257559,_0x3c7c16){_0x3c7c16=_0x3c7c16||0xcc;return function(_0x44768f){if(_0x44768f){return _0x257559[_0x9635('0xa')](_0x3c7c16);}return _0x257559['status'](_0x3c7c16)['end']();};}function respondWithResult(_0xa07f1a,_0x37b1a2){_0x37b1a2=_0x37b1a2||0xc8;return function(_0x38a8cc){if(_0x38a8cc){return _0xa07f1a[_0x9635('0xb')](_0x37b1a2)[_0x9635('0xc')](_0x38a8cc);}};}function respondWithFilteredResult(_0x32bfb0,_0x1cb968){return function(_0x10ef9a){if(_0x10ef9a){var _0x18fb99=typeof _0x1cb968[_0x9635('0xd')]==='undefined'&&typeof _0x1cb968[_0x9635('0xe')]===_0x9635('0xf');var _0x4f50da=_0x10ef9a['count'];var _0x2a36c9=_0x18fb99?0x0:_0x1cb968[_0x9635('0xd')];var _0x182f7b=_0x18fb99?_0x10ef9a[_0x9635('0x10')]:_0x1cb968[_0x9635('0xd')]+_0x1cb968['limit'];var _0x2981b2;if(_0x182f7b>=_0x4f50da){_0x182f7b=_0x4f50da;_0x2981b2=0xc8;}else{_0x2981b2=0xce;}_0x32bfb0[_0x9635('0xb')](_0x2981b2);return _0x32bfb0[_0x9635('0x11')](_0x9635('0x12'),_0x2a36c9+'-'+_0x182f7b+'/'+_0x4f50da)[_0x9635('0xc')](_0x10ef9a);}return null;};}function removeEntity(_0x544dd8){return function(_0x7ceb81){if(_0x7ceb81){return _0x7ceb81['destroy']()[_0x9635('0x13')](function(){var _0x3a9221=_0x7ceb81['get']({'plain':!![]});var _0x5c6b36=[{'name':_0x9635('0x14'),'value':_0x9635('0x15'),'ignore':![]},{'name':_0x9635('0x16'),'value':_0x9635('0x17'),'ignore':![]},{'name':_0x9635('0x18'),'value':_0x9635('0x19'),'ignore':![]}];var _0x3e1334=_(_0x5c6b36)['filter'](_0x9635('0x1a'))[_0x9635('0x1b')]('value')['value']();if(_['includes'](_0x3e1334,_0x3a9221[_0x9635('0x1c')])){return;}var _0x5990e9=_[_0x9635('0x1d')](_0x5c6b36,[_0x9635('0x1e'),_0x3a9221[_0x9635('0x1c')]])[_0x9635('0x1f')];return db['UserProfileResource'][_0x9635('0x20')]({'where':{'type':_0x5990e9,'resourceId':_0x3a9221['id']}})['then'](function(){return _0x7ceb81;});})[_0x9635('0x13')](function(){_0x544dd8[_0x9635('0xb')](0xcc)[_0x9635('0x21')]();});}};}function handleEntityNotFound(_0x90d481){return function(_0x363834){if(!_0x363834){_0x90d481[_0x9635('0xa')](0x194);}return _0x363834;};}function handleError(_0x1ccdbd,_0x3df5d5){_0x3df5d5=_0x3df5d5||0x1f4;return function(_0x5c2d2e){logger['error'](_0x5c2d2e[_0x9635('0x22')]);if(_0x5c2d2e['name']){delete _0x5c2d2e[_0x9635('0x1f')];}_0x1ccdbd[_0x9635('0xb')](_0x3df5d5)[_0x9635('0x23')](_0x5c2d2e);};}exports[_0x9635('0x24')]=function(_0xc362b6,_0x428efc){var _0x59d6e5={},_0x14502b={},_0x21ee2d={'count':0x0,'rows':[]};var _0x51f2c8=_[_0x9635('0x1b')](db['VoiceExtension'][_0x9635('0x25')],function(_0x54ce9a){return{'name':_0x54ce9a[_0x9635('0x26')],'type':_0x54ce9a['type']['key']};});_0x14502b[_0x9635('0x27')]=_[_0x9635('0x1b')](_0x51f2c8,_0x9635('0x1f'));_0x14502b[_0x9635('0x28')]=_['keys'](_0xc362b6[_0x9635('0x28')]);_0x14502b[_0x9635('0x29')]=_['intersection'](_0x14502b['model'],_0x14502b[_0x9635('0x28')]);_0x59d6e5[_0x9635('0x2a')]=_[_0x9635('0x2b')](_0x14502b['model'],qs[_0x9635('0x2c')](_0xc362b6[_0x9635('0x28')]['fields']));_0x59d6e5['attributes']=_0x59d6e5[_0x9635('0x2a')][_0x9635('0x2d')]?_0x59d6e5['attributes']:_0x14502b['model'];if(!_0xc362b6[_0x9635('0x28')]['hasOwnProperty'](_0x9635('0x2e'))){_0x59d6e5[_0x9635('0xe')]=qs[_0x9635('0xe')](_0xc362b6['query']['limit']);_0x59d6e5[_0x9635('0xd')]=qs['offset'](_0xc362b6[_0x9635('0x28')]['offset']);}_0x59d6e5[_0x9635('0x2f')]=qs[_0x9635('0x30')](_0xc362b6['query'][_0x9635('0x30')]);_0x59d6e5[_0x9635('0x31')]=qs['filters'](_['pick'](_0xc362b6['query'],_0x14502b[_0x9635('0x29')]),_0x51f2c8);if(_0xc362b6[_0x9635('0x28')][_0x9635('0x32')]){_0x59d6e5[_0x9635('0x31')]=_[_0x9635('0x33')](_0x59d6e5[_0x9635('0x31')],{'$or':_[_0x9635('0x1b')](_0x51f2c8,function(_0x5d0a7c){if(_0x5d0a7c['type']!==_0x9635('0x34')){var _0x4a989d={};_0x4a989d[_0x5d0a7c[_0x9635('0x1f')]]={'$like':'%'+_0xc362b6[_0x9635('0x28')]['filter']+'%'};return _0x4a989d;}})});}_0x59d6e5=_['merge']({},_0x59d6e5,_0xc362b6[_0x9635('0x35')]);var _0x4db844={'where':_0x59d6e5[_0x9635('0x31')]};return db['VoiceExtension']['count'](_0x4db844)['then'](function(_0x4a5165){_0x21ee2d[_0x9635('0x10')]=_0x4a5165;if(_0xc362b6[_0x9635('0x28')][_0x9635('0x36')]){_0x59d6e5['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x9635('0x37')](_0x59d6e5);})['then'](function(_0x39d1b9){_0x21ee2d[_0x9635('0x38')]=_0x39d1b9;return _0x21ee2d;})[_0x9635('0x13')](respondWithFilteredResult(_0x428efc,_0x59d6e5))[_0x9635('0x39')](handleError(_0x428efc,null));};exports['show']=function(_0x17deb6,_0x50ca2f){var _0x3e7c04={'raw':![],'where':{'id':_0x17deb6['params']['id']}},_0x107bc1={};_0x107bc1['model']=_[_0x9635('0x3a')](db[_0x9635('0x3b')][_0x9635('0x25')]);_0x107bc1[_0x9635('0x28')]=_[_0x9635('0x3a')](_0x17deb6[_0x9635('0x28')]);_0x107bc1[_0x9635('0x29')]=_[_0x9635('0x2b')](_0x107bc1[_0x9635('0x27')],_0x107bc1['query']);_0x3e7c04[_0x9635('0x2a')]=_[_0x9635('0x2b')](_0x107bc1[_0x9635('0x27')],qs['fields'](_0x17deb6[_0x9635('0x28')][_0x9635('0x2c')]));_0x3e7c04[_0x9635('0x2a')]=_0x3e7c04['attributes']['length']?_0x3e7c04[_0x9635('0x2a')]:_0x107bc1[_0x9635('0x27')];if(_0x17deb6[_0x9635('0x28')][_0x9635('0x36')]){_0x3e7c04[_0x9635('0x3c')]=[{'all':!![]}];}_0x3e7c04=_['merge']({},_0x3e7c04,_0x17deb6[_0x9635('0x35')]);return db[_0x9635('0x3b')][_0x9635('0x1d')](_0x3e7c04)[_0x9635('0x13')](handleEntityNotFound(_0x50ca2f,null))[_0x9635('0x13')](respondWithResult(_0x50ca2f,null))[_0x9635('0x39')](handleError(_0x50ca2f,null));};exports[_0x9635('0x20')]=function(_0x460b36,_0x1e212b){return db['VoiceExtension'][_0x9635('0x1d')]({'where':{'id':_0x460b36[_0x9635('0x3d')]['id']}})[_0x9635('0x13')](handleEntityNotFound(_0x1e212b,null))[_0x9635('0x13')](removeEntity(_0x1e212b,null))[_0x9635('0x39')](handleError(_0x1e212b,null));};exports[_0x9635('0x3e')]=function(_0x10cf78,_0x5bf154){if(_0x10cf78['body']['type']==='outbound'&&!_[_0x9635('0x3f')](_0x10cf78['body'][_0x9635('0x40')],'_')){_0x10cf78[_0x9635('0x41')][_0x9635('0x40')]='_'[_0x9635('0x42')](_0x10cf78[_0x9635('0x41')]['exten']);}return db[_0x9635('0x3b')][_0x9635('0x3e')](_0x10cf78[_0x9635('0x41')],{'raw':![]})[_0x9635('0x13')](function(_0x1041f3){var _0xe56de3=_0x10cf78[_0x9635('0x43')][_0x9635('0x44')]({'plain':!![]});if(!_0xe56de3)throw new Error(_0x9635('0x45'));if(_0xe56de3[_0x9635('0x46')]===_0x9635('0x43')){var _0x2d5a3c=_0x1041f3[_0x9635('0x44')]({'plain':!![]});var _0x58fee8=[{'name':_0x9635('0x14'),'value':_0x9635('0x15')},{'name':_0x9635('0x16'),'value':_0x9635('0x17')},{'name':_0x9635('0x18'),'value':_0x9635('0x19')}];var _0x265be5=_[_0x9635('0x1d')](_0x58fee8,[_0x9635('0x1e'),_0x2d5a3c[_0x9635('0x1c')]])[_0x9635('0x1f')];return db[_0x9635('0x47')]['find']({'where':{'name':_0x265be5,'userProfileId':_0xe56de3[_0x9635('0x48')]},'raw':!![]})['then'](function(_0x248c41){if(_0x248c41&&_0x248c41[_0x9635('0x49')]===0x0){return db[_0x9635('0x4a')][_0x9635('0x3e')]({'name':_0x2d5a3c[_0x9635('0x1f')],'resourceId':_0x2d5a3c['id'],'type':_0x248c41[_0x9635('0x1f')],'sectionId':_0x248c41['id']},{})[_0x9635('0x13')](function(){return _0x1041f3;});}else{return _0x1041f3;}})[_0x9635('0x39')](function(_0x14d5bb){logger[_0x9635('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14d5bb);throw _0x14d5bb;});}return _0x1041f3;})[_0x9635('0x13')](respondWithResult(_0x5bf154,0xc9))[_0x9635('0x39')](handleError(_0x5bf154,null));};exports[_0x9635('0x4c')]=function(_0x15a6d0,_0x3fcb67){if(_0x15a6d0[_0x9635('0x41')]['id']){delete _0x15a6d0['body']['id'];}return db[_0x9635('0x3b')][_0x9635('0x1d')]({'where':{'id':_0x15a6d0[_0x9635('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3fcb67,null))[_0x9635('0x13')](function(_0x1b256d){if(_0x1b256d){return db['VoiceExtension'][_0x9635('0x4c')](_['pick'](_0x15a6d0[_0x9635('0x41')],[_0x9635('0x40'),_0x9635('0x4d'),_0x9635('0x4e'),_0x9635('0x4f'),'cutdigits',_0x9635('0x50'),_0x9635('0x51')]),{'where':{'context':_0x1b256d[_0x9635('0x4d')],'exten':_0x1b256d[_0x9635('0x40')]},'individualHooks':!![]})['then'](function(_0x33f82a){return _0x33f82a;});}return null;})[_0x9635('0x13')](respondWithStatusCode(_0x3fcb67,null))[_0x9635('0x39')](handleError(_0x3fcb67,null));};exports[_0x9635('0x52')]=function(_0x14069e,_0x53d72f){var _0x4fd333=_0x14069e['params']['id'];var _0x362d6e=_0x14069e['body'];var _0x443ede=0xc8;var _0x37e3b7=null;return db[_0x9635('0x53')][_0x9635('0x54')]({'isolationLevel':db[_0x9635('0x53')][_0x9635('0x55')][_0x9635('0x56')][_0x9635('0x57')]},function(_0x4aeb61){return db[_0x9635('0x3b')]['findOne']({'where':{'id':_0x4fd333},'transaction':_0x4aeb61})[_0x9635('0x13')](function(_0x4da921){if(_0x4da921){return db[_0x9635('0x3b')][_0x9635('0x20')]({'where':{'VoiceExtensionId':_0x4fd333},'transaction':_0x4aeb61})[_0x9635('0x13')](function(){var _0x562bfc=_[_0x9635('0x1b')](_0x362d6e,function(_0x3dc216){_0x3dc216['VoiceExtensionId']=_0x4fd333;_0x3dc216[_0x9635('0x58')]=!![];return _0x3dc216;});return _0x4da921[_0x9635('0x59')](_0x562bfc);})[_0x9635('0x13')](function(_0x5e97be){return db['VoiceExtension'][_0x9635('0x5a')](_0x5e97be,{'transaction':_0x4aeb61});});}else{_0x443ede=0x194;_0x37e3b7=[];}});})[_0x9635('0x13')](function(){if(_0x443ede!==0x194){return db['VoiceExtension'][_0x9635('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4fd333},'order':_0x9635('0x5c')})[_0x9635('0x13')](function(_0x5d5e4c){_0x37e3b7=_0x5d5e4c;});}})[_0x9635('0x39')](function(_0x1c9d37){_0x443ede=0x1f4;logger[_0x9635('0x4b')](_0x1c9d37[_0x9635('0x22')]);if(_0x1c9d37[_0x9635('0x1f')]){delete _0x1c9d37[_0x9635('0x1f')];}_0x37e3b7=_0x1c9d37;})[_0x9635('0x5d')](function(){if(_0x37e3b7===null){_0x53d72f[_0x9635('0xa')](_0x443ede);}else{if(_0x443ede===0x1f4){_0x53d72f[_0x9635('0xb')](_0x443ede)[_0x9635('0x23')](_0x37e3b7);}else{_0x53d72f[_0x9635('0xb')](_0x443ede)['json'](_0x37e3b7);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 723dc1c..538af56 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 _0x62b0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x5cbbb6,_0x21e5ef){var _0x464e58=function(_0x295566){while(--_0x295566){_0x5cbbb6['push'](_0x5cbbb6['shift']());}};_0x464e58(++_0x21e5ef);}(_0x62b0,0x1bb));var _0x062b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x62b0[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x062b('0x0'));var VoiceExtension=require(_0x062b('0x1'))['db'][_0x062b('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x062b('0x3')](0x0);var events={'afterCreate':_0x062b('0x4'),'afterUpdate':_0x062b('0x5'),'afterDestroy':_0x062b('0x6')};function emitEvent(_0x35759a){return function(_0xd6f720,_0x468da0,_0x4d54b5){VoiceExtensionEvents['emit'](_0x35759a+':'+_0xd6f720['id'],_0xd6f720);VoiceExtensionEvents[_0x062b('0x7')](_0x35759a,_0xd6f720);_0x4d54b5(null);};}for(var e in events){if(events[_0x062b('0x8')](e)){var event=events[e];VoiceExtension[_0x062b('0x9')](e,emitEvent(event));}}module[_0x062b('0xa')]=VoiceExtensionEvents; \ No newline at end of file +var _0xffb2=['emit','hook','events','VoiceExtension','save','remove'];(function(_0x209ba4,_0x11aee){var _0x336e86=function(_0x46b455){while(--_0x46b455){_0x209ba4['push'](_0x209ba4['shift']());}};_0x336e86(++_0x11aee);}(_0xffb2,0x1a0));var _0x2ffb=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0xffb2[_0x142020];return _0x40da8f;};'use strict';var EventEmitter=require(_0x2ffb('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x2ffb('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2ffb('0x2'),'afterUpdate':'update','afterDestroy':_0x2ffb('0x3')};function emitEvent(_0x566327){return function(_0x99211d,_0x10f630,_0xaf4bd2){VoiceExtensionEvents[_0x2ffb('0x4')](_0x566327+':'+_0x99211d['id'],_0x99211d);VoiceExtensionEvents[_0x2ffb('0x4')](_0x566327,_0x99211d);_0xaf4bd2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x2ffb('0x5')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index ae09d54..f9334f9 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 _0x5f58=['$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','define','voice_extensions','get','Hangup','lodash','exports','models','type','Set','CDR(type)=','alias','CDR(routeAlias)=','context','exten','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','trunk','timeout','url','split','name','param','phone','prefix','SIP','options','indexOf','replace','join','isEmpty','Interval','interval','then','length','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','includes','app','appType','custom'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0x5f58,0x1a6));var _0x85f5=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0x5f58[_0x48999d];return _0x1ad0d1;};'use strict';var _=require(_0x85f5('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x85f5('0x1')]=function(_0x2ce6f7){var _0x95673e=_0x2ce6f7[_0x85f5('0x2')];function _0x174e14(_0x352b72){var _0x5d6912=0x2;var _0xb62caa=[{'type':_0x352b72[_0x85f5('0x3')],'app':_0x85f5('0x4'),'appdata':_0x85f5('0x5')+_0x352b72[_0x85f5('0x3')],'context':_0x352b72['context'],'exten':_0x352b72['exten'],'priority':_0x5d6912++,'VoiceExtensionId':_0x352b72['id']},{'type':_0x352b72[_0x85f5('0x3')],'app':_0x352b72[_0x85f5('0x6')]?_0x85f5('0x4'):'NoOp','appdata':_0x352b72[_0x85f5('0x6')]?_0x85f5('0x7')+_0x352b72[_0x85f5('0x6')]:'No\x20alias\x20set','context':_0x352b72[_0x85f5('0x8')],'exten':_0x352b72[_0x85f5('0x9')],'priority':_0x5d6912++,'VoiceExtensionId':_0x352b72['id']}];if(_0x352b72[_0x85f5('0x3')]===_0x85f5('0xa')){_0xb62caa[_0x85f5('0xb')]({'type':_0x85f5('0xa'),'app':_0x85f5('0x4'),'appdata':'CDR(routeid)='+_0x352b72['id'],'context':_0x352b72['context'],'exten':_0x352b72['exten'],'priority':_0x5d6912++,'VoiceExtensionId':_0x352b72['id']});}_0xb62caa[_0x85f5('0xb')]({'type':_0x352b72[_0x85f5('0x3')],'app':_0x85f5('0x4'),'appdata':_0x85f5('0xc'),'context':_0x352b72['context'],'exten':_0x352b72['exten'],'priority':_0x5d6912++,'VoiceExtensionId':_0x352b72['id']},{'type':_0x352b72[_0x85f5('0x3')],'app':'Set','appdata':_0x85f5('0xd'),'context':_0x352b72[_0x85f5('0x8')],'exten':_0x352b72[_0x85f5('0x9')],'priority':_0x5d6912++,'VoiceExtensionId':_0x352b72['id']},{'type':_0x352b72[_0x85f5('0x3')],'app':_0x85f5('0x4'),'appdata':_0x85f5('0xe'),'context':_0x352b72[_0x85f5('0x8')],'exten':_0x352b72[_0x85f5('0x9')],'priority':_0x5d6912++,'VoiceExtensionId':_0x352b72['id']});return _0xb62caa;}function _0x599d47(_0x543e4b){var _0x563bf9=0x2;var _0x5e1a51=[{'type':_0x85f5('0xf'),'app':_0x85f5('0x4'),'appdata':_0x85f5('0x10'),'context':_0x543e4b[_0x85f5('0x8')],'exten':_0x543e4b[_0x85f5('0x9')],'priority':_0x563bf9++,'VoiceExtensionId':_0x543e4b['id']},{'type':_0x85f5('0xf'),'app':_0x543e4b[_0x85f5('0x6')]?'Set':'NoOp','appdata':_0x543e4b[_0x85f5('0x6')]?_0x85f5('0x7')+_0x543e4b[_0x85f5('0x6')]:_0x85f5('0x11'),'context':_0x543e4b['context'],'exten':_0x543e4b[_0x85f5('0x9')],'priority':_0x563bf9++,'VoiceExtensionId':_0x543e4b['id']},{'type':_0x85f5('0xf'),'app':'Set','appdata':_0x85f5('0x12')+(_0x543e4b[_0x85f5('0x13')]?'${EXTEN:'+_0x543e4b['cutdigits']+'}':_0x85f5('0x14')),'context':_0x543e4b[_0x85f5('0x8')],'exten':_0x543e4b[_0x85f5('0x9')],'priority':_0x563bf9++,'VoiceExtensionId':_0x543e4b['id']},{'type':_0x85f5('0xf'),'app':_0x85f5('0x4'),'appdata':'CDR(routeid)='+_0x543e4b['id'],'context':_0x543e4b[_0x85f5('0x8')],'exten':_0x543e4b['exten'],'priority':_0x563bf9++,'VoiceExtensionId':_0x543e4b['id']},{'type':_0x85f5('0xf'),'app':'ExecIf','appdata':_0x85f5('0x15')+(_0x563bf9+0x2)+_0x85f5('0x16')+(_0x563bf9+0x1)+')','context':_0x543e4b[_0x85f5('0x8')],'exten':_0x543e4b[_0x85f5('0x9')],'priority':_0x563bf9++,'VoiceExtensionId':_0x543e4b['id']},{'type':_0x85f5('0xf'),'app':'Set','appdata':_0x543e4b[_0x85f5('0x13')]?_0x85f5('0x17')+_0x543e4b['cutdigits']+'}':_0x85f5('0x18'),'context':_0x543e4b[_0x85f5('0x8')],'exten':_0x543e4b[_0x85f5('0x9')],'priority':_0x563bf9++,'VoiceExtensionId':_0x543e4b['id']},{'type':_0x85f5('0xf'),'app':_0x85f5('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x543e4b[_0x85f5('0x8')],'exten':_0x543e4b[_0x85f5('0x9')],'priority':_0x563bf9++,'VoiceExtensionId':_0x543e4b['id']},{'type':'outbound','app':_0x85f5('0x4'),'appdata':_0x85f5('0xd'),'context':_0x543e4b[_0x85f5('0x8')],'exten':_0x543e4b['exten'],'priority':_0x563bf9++,'VoiceExtensionId':_0x543e4b['id']},{'type':_0x85f5('0xf'),'app':_0x85f5('0x4'),'appdata':_0x85f5('0xe'),'context':_0x543e4b[_0x85f5('0x8')],'exten':_0x543e4b[_0x85f5('0x9')],'priority':_0x563bf9++,'VoiceExtensionId':_0x543e4b['id']},{'type':_0x85f5('0xf'),'app':_0x85f5('0x4'),'appdata':'outboundrouteid='+_0x543e4b['id'],'context':_0x543e4b[_0x85f5('0x8')],'exten':_0x543e4b[_0x85f5('0x9')],'priority':_0x563bf9++,'VoiceExtensionId':_0x543e4b['id']}];if(_0x543e4b[_0x85f5('0x19')](_0x85f5('0x1a'))&&_0x543e4b['recordingFormat']!==_0x85f5('0x1b')){_0x5e1a51['push']({'type':_0x85f5('0xf'),'app':_0x85f5('0x4'),'appdata':_0x85f5('0x1c'),'context':_0x543e4b[_0x85f5('0x8')],'exten':_0x543e4b[_0x85f5('0x9')],'priority':_0x563bf9++,'VoiceExtensionId':_0x543e4b['id']},{'type':_0x85f5('0xf'),'app':_0x85f5('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x543e4b[_0x85f5('0x1a')]||'wav','context':_0x543e4b[_0x85f5('0x8')],'exten':_0x543e4b['exten'],'priority':_0x563bf9++,'VoiceExtensionId':_0x543e4b['id']});}return _0x5e1a51;}function _0x2cd32e(_0x18e208,_0x5d3bdd){var _0x551835=[{'name':_0x85f5('0x1d'),'param':0x0},{'name':_0x85f5('0x1e'),'param':0x1},{'name':'options','param':0x2},{'name':_0x85f5('0x1f'),'param':0x3}];var _0x5827f0={};var _0xefcab9=_0x5d3bdd[_0x85f5('0x20')](',');var _0x3de9e8=[];for(var _0x317f28=0x0;_0x317f28<_0x551835['length'];_0x317f28++){switch(_0x551835[_0x317f28][_0x85f5('0x21')]){case _0x85f5('0x1d'):_0x5827f0[_0x85f5('0x1d')]=_0xefcab9[_0x551835[_0x317f28][_0x85f5('0x22')]][_0x85f5('0x20')]('/')[0x1];_0x5827f0[_0x85f5('0x23')]=_0xefcab9[_0x551835[_0x317f28][_0x85f5('0x22')]]['split']('/')[0x2];_0x5827f0['prefix']=_0x5827f0[_0x85f5('0x23')]?_0x5827f0[_0x85f5('0x23')]['split']('$')[0x0]:undefined;_0x5827f0[_0x85f5('0x23')]=_0x18e208[_0x85f5('0x13')]?(_0x5827f0[_0x85f5('0x24')]||'')+'${EXTEN:'+_0x18e208[_0x85f5('0x13')]+'}':(_0x5827f0['prefix']||'')+_0x85f5('0x14');_0x3de9e8[_0x551835[_0x317f28]['param']]=[_0x85f5('0x25'),_0x5827f0[_0x85f5('0x1d')],_0x5827f0['phone']]['join']('/');break;case _0x85f5('0x26'):_0x5827f0[_0x85f5('0x26')]=_0xefcab9[_0x551835[_0x317f28]['param']];if(_0x18e208['recordingFormat']!==_0x85f5('0x1b')){if(_0x5827f0[_0x85f5('0x26')][_0x85f5('0x27')]('U(xcally-mixmonitor-context)')<0x0){_0x5827f0[_0x85f5('0x26')]+='U(xcally-mixmonitor-context)';}}else{_0x5827f0[_0x85f5('0x26')]=_0x5827f0[_0x85f5('0x26')][_0x85f5('0x28')]('U(xcally-mixmonitor-context)','');}_0x3de9e8[_0x551835[_0x317f28][_0x85f5('0x22')]]=_0x5827f0[_0x85f5('0x26')];break;default:_0x3de9e8[_0x551835[_0x317f28]['param']]=_0xefcab9[_0x551835[_0x317f28][_0x85f5('0x22')]];}}return _0x3de9e8[_0x85f5('0x29')](',');}function _0x37011c(_0x36b795,_0x287014,_0x3c3013){return new Promise(function(_0x26c106,_0x32ba09){var _0x2a0f1a=[];if(_[_0x85f5('0x2a')](_0x287014))return _0x26c106(_0x2a0f1a);_0x95673e[_0x85f5('0x2b')]['findAll']({'attributes':['id',_0x85f5('0x2c'),'IntervalId'],'raw':!![]})[_0x85f5('0x2d')](function(_0x5cd4aa){for(var _0x175f3e=0x0,_0x358f61=0x0;_0x175f3e<_0x287014[_0x85f5('0x2e')];_0x175f3e++,_0x358f61=0x0){var _0x16c60b=_0x287014[_0x175f3e];var _0x140b36=[];var _0x574db3=[];delete _0x16c60b['id'];if(_0x16c60b['interval']!==_0x85f5('0x2f')){_0x16c60b[_0x85f5('0x30')]=[_0x16c60b[_0x85f5('0x2c')]];}else{_0x16c60b[_0x85f5('0x30')]=_0x16c60b[_0x85f5('0x31')]?_[_0x85f5('0x32')](_[_0x85f5('0x33')](_0x5cd4aa,{'IntervalId':_0x16c60b[_0x85f5('0x31')]}),_0x85f5('0x2c')):[];}_0x16c60b[_0x85f5('0x8')]=_0x36b795[_0x85f5('0x8')];_0x16c60b[_0x85f5('0x9')]=_0x36b795[_0x85f5('0x9')];if(_0x16c60b['type'])_0x16c60b['type']=_0x16c60b['type'][_0x85f5('0x34')]();if(_0x36b795['type']==='outbound'){if(_0x16c60b[_0x85f5('0x19')]('tag')&&_0x16c60b[_0x85f5('0x35')]&&_0x16c60b[_0x85f5('0x35')]!=='--'){_0x140b36[_0x85f5('0xb')]({'type':_0x16c60b['type'][_0x85f5('0x34')](),'app':_0x85f5('0x4'),'appdata':'CDR(tag)='+_0x16c60b[_0x85f5('0x35')],'context':_0x36b795[_0x85f5('0x8')],'exten':_0x36b795['exten'],'priority':_0x16c60b[_0x85f5('0x30')][_0x85f5('0x2e')]+_0x3c3013+_0x358f61++,'VoiceExtensionId':_0x36b795['id']});}_0x140b36[_0x85f5('0xb')]({'type':_0x16c60b[_0x85f5('0x3')][_0x85f5('0x34')](),'app':_0x85f5('0x36'),'appdata':_0x85f5('0x37')+(_0x16c60b[_0x85f5('0x38')]?_0x85f5('0x39')+_0x16c60b['callerID']+')':_0x85f5('0x3a')),'context':_0x36b795[_0x85f5('0x8')],'exten':_0x36b795[_0x85f5('0x9')],'priority':_0x16c60b['intervals'][_0x85f5('0x2e')]+_0x3c3013+_0x358f61++,'VoiceExtensionId':_0x36b795['id']});}else{if(_0x16c60b[_0x85f5('0x19')](_0x85f5('0x3b'))){if(['queue','playback'][_0x85f5('0x3c')](_0x16c60b[_0x85f5('0x3d')][_0x85f5('0x34')]())&&_0x16c60b[_0x85f5('0x3e')]!==_0x85f5('0x3f')){if(_0x16c60b['answer']){_0x140b36['push']({'type':_0x16c60b[_0x85f5('0x3')][_0x85f5('0x34')](),'app':'ExecIf','appdata':_0x85f5('0x40'),'context':_0x36b795[_0x85f5('0x8')],'exten':_0x36b795[_0x85f5('0x9')],'priority':_0x16c60b[_0x85f5('0x30')][_0x85f5('0x2e')]+_0x3c3013+_0x358f61++,'VoiceExtensionId':_0x36b795['id']});_0x140b36[_0x85f5('0xb')]({'type':_0x16c60b[_0x85f5('0x3')]['toLowerCase'](),'app':_0x85f5('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x36b795[_0x85f5('0x8')],'exten':_0x36b795[_0x85f5('0x9')],'priority':_0x16c60b['intervals'][_0x85f5('0x2e')]+_0x3c3013+_0x358f61++,'VoiceExtensionId':_0x36b795['id']});}else{_0x140b36[_0x85f5('0xb')]({'type':_0x16c60b[_0x85f5('0x3')]['toLowerCase'](),'app':_0x85f5('0x36'),'appdata':_0x85f5('0x41'),'context':_0x36b795['context'],'exten':_0x36b795[_0x85f5('0x9')],'priority':_0x16c60b[_0x85f5('0x30')]['length']+_0x3c3013+_0x358f61++,'VoiceExtensionId':_0x36b795['id']});_0x140b36[_0x85f5('0xb')]({'type':_0x16c60b['type'][_0x85f5('0x34')](),'app':_0x85f5('0x4'),'appdata':_0x85f5('0x42'),'context':_0x36b795['context'],'exten':_0x36b795['exten'],'priority':_0x16c60b[_0x85f5('0x30')][_0x85f5('0x2e')]+_0x3c3013+_0x358f61++,'VoiceExtensionId':_0x36b795['id']});}}}}for(var _0x216a01=0x0;_0x216a01<_0x16c60b['intervals']['length'];_0x216a01++){var _0x4dddef=_0x3c3013+_0x16c60b[_0x85f5('0x30')]['length'];var _0x440148=_0x216a01===_0x16c60b['intervals'][_0x85f5('0x2e')]-0x1?_0x3c3013+_0x140b36[_0x85f5('0x2e')]+_0x574db3['length']+0x2:_0x3c3013+_0x216a01+0x1;_0x140b36[_0x85f5('0x43')](_0x216a01,0x0,{'type':_0x36b795['type'],'app':_0x85f5('0x44'),'appdata':_0x16c60b[_0x85f5('0x30')][_0x216a01]+'?'+_0x36b795[_0x85f5('0x8')]+_0x85f5('0x45')+_0x4dddef+':'+_0x36b795[_0x85f5('0x8')]+',${EXTEN},'+_0x440148,'exten':_0x36b795[_0x85f5('0x9')],'context':_0x36b795['context'],'priority':_0x3c3013+_0x216a01,'VoiceExtensionId':_0x36b795['id']});}if(_0x16c60b['appType']===_0x85f5('0x46')){_0x16c60b[_0x85f5('0x47')]=_0x2cd32e(_0x36b795,_0x16c60b['appdata']);}if(_0x16c60b['appType']===_0x85f5('0x48')){_0x140b36[_0x85f5('0xb')]({'type':_0x16c60b['type'][_0x85f5('0x34')](),'app':_0x85f5('0x4'),'appdata':_0x85f5('0x49'),'context':_0x36b795[_0x85f5('0x8')],'exten':_0x36b795[_0x85f5('0x9')],'priority':_0x16c60b[_0x85f5('0x30')]['length']+_0x3c3013+_0x358f61++,'VoiceExtensionId':_0x36b795['id']});}_0x16c60b[_0x85f5('0x4a')]=_0x140b36[_0x85f5('0x2e')]?_[_0x85f5('0x4b')](_0x140b36)[_0x85f5('0x4a')]+0x1:_0x3c3013;_0x2a0f1a=_[_0x85f5('0x4c')](_0x2a0f1a,_0x140b36,[_0x16c60b],_0x574db3);_0x3c3013=_['last'](_0x2a0f1a)[_0x85f5('0x4a')]+0x1;}return _0x26c106(_0x2a0f1a);})['catch'](function(_0x4279d7){_0x32ba09(_0x4279d7);});});}return _0x2ce6f7[_0x85f5('0x4d')]('VoiceExtension',attributes,{'tableName':_0x85f5('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x15a9f3){var _0x22505c=this[_0x85f5('0x4f')]({'plain':!![]});var _0x2dcb03=_0x22505c[_0x85f5('0x3')]===_0x85f5('0xf')?_0x599d47(_0x22505c):_0x174e14(_0x22505c);return _0x37011c(_0x22505c,_0x15a9f3,_['last'](_0x2dcb03)[_0x85f5('0x4a')]+0x1)['then'](function(_0x3cd42c){var _0x8531d0=_[_0x85f5('0x4c')](_0x2dcb03,_0x3cd42c);_0x8531d0[_0x85f5('0xb')]({'type':_0x22505c[_0x85f5('0x3')],'app':_0x85f5('0x50'),'exten':_0x22505c[_0x85f5('0x9')],'context':_0x22505c[_0x85f5('0x8')],'priority':_['last'](_0x8531d0)[_0x85f5('0x4a')]+0x1,'VoiceExtensionId':_0x22505c['id']});return _0x8531d0;});}}});}; \ No newline at end of file +var _0x596c=['cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','push','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','length','name','param','split','phone','prefix','${EXTEN:','SIP','none','indexOf','U(xcally-mixmonitor-context)','join','Interval','findAll','IntervalId','interval','intervals','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','define','VoiceExtension','voice_extensions','get','Hangup','Set','type','context','NoOp','CDR(routeAlias)=','alias','No\x20alias\x20set','exten','inbound','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)='];(function(_0x1be740,_0xf8c25f){var _0x45b59c=function(_0x6c5257){while(--_0x6c5257){_0x1be740['push'](_0x1be740['shift']());}};_0x45b59c(++_0xf8c25f);}(_0x596c,0x1cd));var _0xc596=function(_0x795363,_0x963373){_0x795363=_0x795363-0x0;var _0x25e73d=_0x596c[_0x795363];return _0x25e73d;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x4ad890){var _0xd55e73=_0x4ad890['models'];function _0x1ae4a8(_0x391398){var _0x5c2666=0x2;var _0x4d6abe=[{'type':_0x391398['type'],'app':_0xc596('0x0'),'appdata':'CDR(type)='+_0x391398[_0xc596('0x1')],'context':_0x391398[_0xc596('0x2')],'exten':_0x391398['exten'],'priority':_0x5c2666++,'VoiceExtensionId':_0x391398['id']},{'type':_0x391398[_0xc596('0x1')],'app':_0x391398['alias']?_0xc596('0x0'):_0xc596('0x3'),'appdata':_0x391398['alias']?_0xc596('0x4')+_0x391398[_0xc596('0x5')]:_0xc596('0x6'),'context':_0x391398['context'],'exten':_0x391398[_0xc596('0x7')],'priority':_0x5c2666++,'VoiceExtensionId':_0x391398['id']}];if(_0x391398['type']===_0xc596('0x8')){_0x4d6abe['push']({'type':_0xc596('0x8'),'app':'Set','appdata':'CDR(routeid)='+_0x391398['id'],'context':_0x391398[_0xc596('0x2')],'exten':_0x391398['exten'],'priority':_0x5c2666++,'VoiceExtensionId':_0x391398['id']});}_0x4d6abe['push']({'type':_0x391398[_0xc596('0x1')],'app':_0xc596('0x0'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x391398[_0xc596('0x2')],'exten':_0x391398[_0xc596('0x7')],'priority':_0x5c2666++,'VoiceExtensionId':_0x391398['id']},{'type':_0x391398[_0xc596('0x1')],'app':_0xc596('0x0'),'appdata':_0xc596('0x9'),'context':_0x391398[_0xc596('0x2')],'exten':_0x391398[_0xc596('0x7')],'priority':_0x5c2666++,'VoiceExtensionId':_0x391398['id']},{'type':_0x391398[_0xc596('0x1')],'app':_0xc596('0x0'),'appdata':'MONITOR_OPTIONS=ab','context':_0x391398[_0xc596('0x2')],'exten':_0x391398[_0xc596('0x7')],'priority':_0x5c2666++,'VoiceExtensionId':_0x391398['id']});return _0x4d6abe;}function _0x2c82f4(_0x41edcd){var _0x5aec08=0x2;var _0x5cffe5=[{'type':_0xc596('0xa'),'app':_0xc596('0x0'),'appdata':_0xc596('0xb'),'context':_0x41edcd['context'],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':_0x41edcd[_0xc596('0x5')]?_0xc596('0x0'):_0xc596('0x3'),'appdata':_0x41edcd[_0xc596('0x5')]?_0xc596('0x4')+_0x41edcd[_0xc596('0x5')]:_0xc596('0x6'),'context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd['exten'],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':_0xc596('0x0'),'appdata':_0xc596('0xc')+(_0x41edcd[_0xc596('0xd')]?'${EXTEN:'+_0x41edcd['cutdigits']+'}':_0xc596('0xe')),'context':_0x41edcd['context'],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':_0xc596('0x0'),'appdata':_0xc596('0xf')+_0x41edcd['id'],'context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':_0xc596('0x10'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5aec08+0x2)+_0xc596('0x11')+(_0x5aec08+0x1)+')','context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':_0xc596('0x0'),'appdata':_0x41edcd[_0xc596('0xd')]?_0xc596('0x12')+_0x41edcd[_0xc596('0xd')]+'}':_0xc596('0x13'),'context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd['exten'],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':_0xc596('0x0'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':'Set','appdata':_0xc596('0x9'),'context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd['exten'],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':'outbound','app':_0xc596('0x0'),'appdata':'MONITOR_OPTIONS=ab','context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':'Set','appdata':_0xc596('0x14')+_0x41edcd['id'],'context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']}];if(_0x41edcd[_0xc596('0x15')](_0xc596('0x16'))&&_0x41edcd[_0xc596('0x16')]!=='none'){_0x5cffe5[_0xc596('0x17')]({'type':'outbound','app':_0xc596('0x0'),'appdata':_0xc596('0x18'),'context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']},{'type':_0xc596('0xa'),'app':_0xc596('0x0'),'appdata':_0xc596('0x19')+_0x41edcd[_0xc596('0x16')]||'wav','context':_0x41edcd[_0xc596('0x2')],'exten':_0x41edcd[_0xc596('0x7')],'priority':_0x5aec08++,'VoiceExtensionId':_0x41edcd['id']});}return _0x5cffe5;}function _0x46675b(_0x297e3d,_0x5ba840){var _0x507d0b=[{'name':_0xc596('0x1a'),'param':0x0},{'name':_0xc596('0x1b'),'param':0x1},{'name':_0xc596('0x1c'),'param':0x2},{'name':_0xc596('0x1d'),'param':0x3}];var _0x3142b7={};var _0x124671=_0x5ba840['split'](',');var _0x3b824e=[];for(var _0x1ecdc4=0x0;_0x1ecdc4<_0x507d0b[_0xc596('0x1e')];_0x1ecdc4++){switch(_0x507d0b[_0x1ecdc4][_0xc596('0x1f')]){case'trunk':_0x3142b7[_0xc596('0x1a')]=_0x124671[_0x507d0b[_0x1ecdc4][_0xc596('0x20')]][_0xc596('0x21')]('/')[0x1];_0x3142b7[_0xc596('0x22')]=_0x124671[_0x507d0b[_0x1ecdc4]['param']][_0xc596('0x21')]('/')[0x2];_0x3142b7[_0xc596('0x23')]=_0x3142b7[_0xc596('0x22')]?_0x3142b7[_0xc596('0x22')][_0xc596('0x21')]('$')[0x0]:undefined;_0x3142b7[_0xc596('0x22')]=_0x297e3d[_0xc596('0xd')]?(_0x3142b7[_0xc596('0x23')]||'')+_0xc596('0x24')+_0x297e3d[_0xc596('0xd')]+'}':(_0x3142b7[_0xc596('0x23')]||'')+_0xc596('0xe');_0x3b824e[_0x507d0b[_0x1ecdc4][_0xc596('0x20')]]=[_0xc596('0x25'),_0x3142b7[_0xc596('0x1a')],_0x3142b7['phone']]['join']('/');break;case _0xc596('0x1c'):_0x3142b7[_0xc596('0x1c')]=_0x124671[_0x507d0b[_0x1ecdc4][_0xc596('0x20')]];if(_0x297e3d[_0xc596('0x16')]!==_0xc596('0x26')){if(_0x3142b7[_0xc596('0x1c')][_0xc596('0x27')]('U(xcally-mixmonitor-context)')<0x0){_0x3142b7['options']+='U(xcally-mixmonitor-context)';}}else{_0x3142b7[_0xc596('0x1c')]=_0x3142b7[_0xc596('0x1c')]['replace'](_0xc596('0x28'),'');}_0x3b824e[_0x507d0b[_0x1ecdc4][_0xc596('0x20')]]=_0x3142b7['options'];break;default:_0x3b824e[_0x507d0b[_0x1ecdc4][_0xc596('0x20')]]=_0x124671[_0x507d0b[_0x1ecdc4][_0xc596('0x20')]];}}return _0x3b824e[_0xc596('0x29')](',');}function _0x183d03(_0x480138,_0x2c69d1,_0x52c7a1){return new Promise(function(_0x39332a,_0xb6f0e7){var _0x49f7b3=[];if(_['isEmpty'](_0x2c69d1))return _0x39332a(_0x49f7b3);_0xd55e73[_0xc596('0x2a')][_0xc596('0x2b')]({'attributes':['id','interval',_0xc596('0x2c')],'raw':!![]})['then'](function(_0x3c8da6){for(var _0x1e4e45=0x0,_0x2de065=0x0;_0x1e4e45<_0x2c69d1[_0xc596('0x1e')];_0x1e4e45++,_0x2de065=0x0){var _0x4d4557=_0x2c69d1[_0x1e4e45];var _0x261af5=[];var _0x104b6a=[];delete _0x4d4557['id'];if(_0x4d4557[_0xc596('0x2d')]!=='*,*,*,*'){_0x4d4557[_0xc596('0x2e')]=[_0x4d4557[_0xc596('0x2d')]];}else{_0x4d4557['intervals']=_0x4d4557['IntervalId']?_[_0xc596('0x2f')](_[_0xc596('0x30')](_0x3c8da6,{'IntervalId':_0x4d4557['IntervalId']}),_0xc596('0x2d')):[];}_0x4d4557[_0xc596('0x2')]=_0x480138[_0xc596('0x2')];_0x4d4557[_0xc596('0x7')]=_0x480138['exten'];if(_0x4d4557[_0xc596('0x1')])_0x4d4557[_0xc596('0x1')]=_0x4d4557[_0xc596('0x1')][_0xc596('0x31')]();if(_0x480138[_0xc596('0x1')]==='outbound'){if(_0x4d4557['hasOwnProperty']('tag')&&_0x4d4557[_0xc596('0x32')]&&_0x4d4557[_0xc596('0x32')]!=='--'){_0x261af5[_0xc596('0x17')]({'type':_0x4d4557[_0xc596('0x1')][_0xc596('0x31')](),'app':'Set','appdata':'CDR(tag)='+_0x4d4557[_0xc596('0x32')],'context':_0x480138[_0xc596('0x2')],'exten':_0x480138[_0xc596('0x7')],'priority':_0x4d4557[_0xc596('0x2e')][_0xc596('0x1e')]+_0x52c7a1+_0x2de065++,'VoiceExtensionId':_0x480138['id']});}_0x261af5[_0xc596('0x17')]({'type':_0x4d4557[_0xc596('0x1')][_0xc596('0x31')](),'app':_0xc596('0x10'),'appdata':_0xc596('0x33')+(_0x4d4557[_0xc596('0x34')]?_0xc596('0x35')+_0x4d4557[_0xc596('0x34')]+')':_0xc596('0x36')),'context':_0x480138[_0xc596('0x2')],'exten':_0x480138[_0xc596('0x7')],'priority':_0x4d4557[_0xc596('0x2e')][_0xc596('0x1e')]+_0x52c7a1+_0x2de065++,'VoiceExtensionId':_0x480138['id']});}else{if(_0x4d4557[_0xc596('0x15')]('answer')){if([_0xc596('0x37'),_0xc596('0x38')][_0xc596('0x39')](_0x4d4557[_0xc596('0x3a')]['toLowerCase']())&&_0x4d4557[_0xc596('0x3b')]!==_0xc596('0x3c')){if(_0x4d4557[_0xc596('0x3d')]){_0x261af5['push']({'type':_0x4d4557[_0xc596('0x1')]['toLowerCase'](),'app':_0xc596('0x10'),'appdata':_0xc596('0x3e'),'context':_0x480138['context'],'exten':_0x480138[_0xc596('0x7')],'priority':_0x4d4557[_0xc596('0x2e')][_0xc596('0x1e')]+_0x52c7a1+_0x2de065++,'VoiceExtensionId':_0x480138['id']});_0x261af5[_0xc596('0x17')]({'type':_0x4d4557['type'][_0xc596('0x31')](),'app':'Set','appdata':_0xc596('0x3f'),'context':_0x480138[_0xc596('0x2')],'exten':_0x480138[_0xc596('0x7')],'priority':_0x4d4557[_0xc596('0x2e')][_0xc596('0x1e')]+_0x52c7a1+_0x2de065++,'VoiceExtensionId':_0x480138['id']});}else{_0x261af5[_0xc596('0x17')]({'type':_0x4d4557[_0xc596('0x1')][_0xc596('0x31')](),'app':_0xc596('0x10'),'appdata':_0xc596('0x40'),'context':_0x480138[_0xc596('0x2')],'exten':_0x480138[_0xc596('0x7')],'priority':_0x4d4557[_0xc596('0x2e')][_0xc596('0x1e')]+_0x52c7a1+_0x2de065++,'VoiceExtensionId':_0x480138['id']});_0x261af5[_0xc596('0x17')]({'type':_0x4d4557[_0xc596('0x1')][_0xc596('0x31')](),'app':'Set','appdata':_0xc596('0x41'),'context':_0x480138[_0xc596('0x2')],'exten':_0x480138[_0xc596('0x7')],'priority':_0x4d4557[_0xc596('0x2e')][_0xc596('0x1e')]+_0x52c7a1+_0x2de065++,'VoiceExtensionId':_0x480138['id']});}}}}for(var _0x263a95=0x0;_0x263a95<_0x4d4557['intervals']['length'];_0x263a95++){var _0xe8324a=_0x52c7a1+_0x4d4557[_0xc596('0x2e')]['length'];var _0x548eff=_0x263a95===_0x4d4557[_0xc596('0x2e')][_0xc596('0x1e')]-0x1?_0x52c7a1+_0x261af5['length']+_0x104b6a[_0xc596('0x1e')]+0x2:_0x52c7a1+_0x263a95+0x1;_0x261af5['splice'](_0x263a95,0x0,{'type':_0x480138[_0xc596('0x1')],'app':'GotoIfTime','appdata':_0x4d4557[_0xc596('0x2e')][_0x263a95]+'?'+_0x480138[_0xc596('0x2')]+_0xc596('0x42')+_0xe8324a+':'+_0x480138[_0xc596('0x2')]+',${EXTEN},'+_0x548eff,'exten':_0x480138[_0xc596('0x7')],'context':_0x480138[_0xc596('0x2')],'priority':_0x52c7a1+_0x263a95,'VoiceExtensionId':_0x480138['id']});}if(_0x4d4557[_0xc596('0x3b')]===_0xc596('0x43')){_0x4d4557[_0xc596('0x44')]=_0x46675b(_0x480138,_0x4d4557[_0xc596('0x44')]);}if(_0x4d4557[_0xc596('0x3b')]===_0xc596('0x45')){_0x261af5[_0xc596('0x17')]({'type':_0x4d4557['type'][_0xc596('0x31')](),'app':_0xc596('0x0'),'appdata':_0xc596('0x46'),'context':_0x480138[_0xc596('0x2')],'exten':_0x480138[_0xc596('0x7')],'priority':_0x4d4557['intervals'][_0xc596('0x1e')]+_0x52c7a1+_0x2de065++,'VoiceExtensionId':_0x480138['id']});}_0x4d4557[_0xc596('0x47')]=_0x261af5[_0xc596('0x1e')]?_[_0xc596('0x48')](_0x261af5)[_0xc596('0x47')]+0x1:_0x52c7a1;_0x49f7b3=_[_0xc596('0x49')](_0x49f7b3,_0x261af5,[_0x4d4557],_0x104b6a);_0x52c7a1=_[_0xc596('0x48')](_0x49f7b3)[_0xc596('0x47')]+0x1;}return _0x39332a(_0x49f7b3);})['catch'](function(_0x25f3fd){_0xb6f0e7(_0x25f3fd);});});}return _0x4ad890[_0xc596('0x4a')](_0xc596('0x4b'),attributes,{'tableName':_0xc596('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3f7e9c){var _0x1daf01=this[_0xc596('0x4d')]({'plain':!![]});var _0x467c04=_0x1daf01[_0xc596('0x1')]==='outbound'?_0x2c82f4(_0x1daf01):_0x1ae4a8(_0x1daf01);return _0x183d03(_0x1daf01,_0x3f7e9c,_[_0xc596('0x48')](_0x467c04)[_0xc596('0x47')]+0x1)['then'](function(_0x22202e){var _0x193ccb=_['concat'](_0x467c04,_0x22202e);_0x193ccb[_0xc596('0x17')]({'type':_0x1daf01['type'],'app':_0xc596('0x4e'),'exten':_0x1daf01[_0xc596('0x7')],'context':_0x1daf01[_0xc596('0x2')],'priority':_['last'](_0x193ccb)[_0xc596('0x47')]+0x1,'VoiceExtensionId':_0x1daf01['id']});return _0x193ccb;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 8034290..fa4ff15 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 _0x6bb4=['jayson/promise','client','defaults','redis','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','map','include','model','attributes','debug','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3f5174,_0x1a611c){var _0x540ef3=function(_0x1d1d1c){while(--_0x1d1d1c){_0x3f5174['push'](_0x3f5174['shift']());}};_0x540ef3(++_0x1a611c);}(_0x6bb4,0x1a7));var _0x46bb=function(_0x267bfd,_0x4d699a){_0x267bfd=_0x267bfd-0x0;var _0x4c8719=_0x6bb4[_0x267bfd];return _0x4c8719;};'use strict';var _=require(_0x46bb('0x0'));var util=require(_0x46bb('0x1'));var moment=require(_0x46bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x46bb('0x3'));var fs=require('fs');var Redis=require(_0x46bb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x46bb('0x5'));var logger=require(_0x46bb('0x6'))(_0x46bb('0x7'));var config=require(_0x46bb('0x8'));var jayson=require(_0x46bb('0x9'));var client=jayson[_0x46bb('0xa')]['http']({'port':0x232a});config['redis']=_[_0x46bb('0xb')](config[_0x46bb('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x46bb('0xd'))[_0x46bb('0xe')](socket);function respondWithRpcPromise(_0x542169,_0x33be6a,_0xd8e898){return new BPromise(function(_0x29bf9b,_0x4b7854){return client[_0x46bb('0xf')](_0x542169,_0xd8e898)[_0x46bb('0x10')](function(_0x499fdf){logger[_0x46bb('0x11')](_0x46bb('0x12'),_0x33be6a,_0x46bb('0x13'));logger['debug'](_0x46bb('0x14'),_0x33be6a,'request\x20sent',JSON['stringify'](_0x499fdf));if(_0x499fdf[_0x46bb('0x15')]){if(_0x499fdf['error'][_0x46bb('0x16')]===0x1f4){logger[_0x46bb('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x33be6a,_0x499fdf[_0x46bb('0x15')]['message']);return _0x4b7854(_0x499fdf[_0x46bb('0x15')]['message']);}logger[_0x46bb('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x33be6a,_0x499fdf['error'][_0x46bb('0x17')]);return _0x29bf9b(_0x499fdf[_0x46bb('0x15')]['message']);}else{logger[_0x46bb('0x11')](_0x46bb('0x12'),_0x33be6a,'request\x20sent');_0x29bf9b(_0x499fdf['result'][_0x46bb('0x17')]);}})[_0x46bb('0x18')](function(_0x414094){logger[_0x46bb('0x15')](_0x46bb('0x12'),_0x33be6a,_0x414094);_0x4b7854(_0x414094);});});}exports[_0x46bb('0x19')]=function(_0x2d8023){var _0x32fac0=this;return new Promise(function(_0x5b697c,_0x5ce203){return db[_0x46bb('0x1a')][_0x46bb('0x1b')]({'raw':_0x2d8023[_0x46bb('0x1c')]?_0x2d8023['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d8023['options']?_0x2d8023[_0x46bb('0x1c')][_0x46bb('0x1d')]||null:null,'attributes':_0x2d8023[_0x46bb('0x1c')]?_0x2d8023[_0x46bb('0x1c')]['attributes']||null:null,'limit':_0x2d8023['options']?_0x2d8023['options']['limit']||null:null,'include':_0x2d8023['options']?_0x2d8023[_0x46bb('0x1c')]['include']?_[_0x46bb('0x1e')](_0x2d8023[_0x46bb('0x1c')][_0x46bb('0x1f')],function(_0x1ee93a){return{'model':db[_0x1ee93a[_0x46bb('0x20')]],'as':_0x1ee93a['as'],'attributes':_0x1ee93a[_0x46bb('0x21')],'include':_0x1ee93a[_0x46bb('0x1f')]?_[_0x46bb('0x1e')](_0x1ee93a[_0x46bb('0x1f')],function(_0x4277c4){return{'model':db[_0x4277c4['model']],'as':_0x4277c4['as'],'attributes':_0x4277c4[_0x46bb('0x21')],'include':_0x4277c4[_0x46bb('0x1f')]?_['map'](_0x4277c4[_0x46bb('0x1f')],function(_0x3a9927){return{'model':db[_0x3a9927[_0x46bb('0x20')]],'as':_0x3a9927['as'],'attributes':_0x3a9927[_0x46bb('0x21')]};}):[]};}):[]};}):[]:[]})[_0x46bb('0x10')](function(_0x3707fb){logger[_0x46bb('0x11')](_0x46bb('0x19'),_0x2d8023);logger[_0x46bb('0x22')](_0x46bb('0x19'),_0x2d8023,JSON[_0x46bb('0x23')](_0x3707fb));_0x5b697c(_0x3707fb);})[_0x46bb('0x18')](function(_0x2d34d6){logger[_0x46bb('0x15')](_0x46bb('0x19'),_0x2d34d6[_0x46bb('0x17')],_0x2d8023);_0x5ce203(_0x32fac0[_0x46bb('0x15')](0x1f4,_0x2d34d6[_0x46bb('0x17')]));});});}; \ No newline at end of file +var _0x1a61=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','include','model','attributes','map','lodash','moment','randomstring','ioredis'];(function(_0x441a68,_0x5050e2){var _0x2aea31=function(_0x5af71e){while(--_0x5af71e){_0x441a68['push'](_0x441a68['shift']());}};_0x2aea31(++_0x5050e2);}(_0x1a61,0x1e6));var _0x11a6=function(_0x13ceba,_0x5cd8b0){_0x13ceba=_0x13ceba-0x0;var _0x102abd=_0x1a61[_0x13ceba];return _0x102abd;};'use strict';var _=require(_0x11a6('0x0'));var util=require('util');var moment=require(_0x11a6('0x1'));var BPromise=require('bluebird');var rs=require(_0x11a6('0x2'));var fs=require('fs');var Redis=require(_0x11a6('0x3'));var db=require(_0x11a6('0x4'))['db'];var utils=require(_0x11a6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x11a6('0x6'));var jayson=require(_0x11a6('0x7'));var client=jayson['client'][_0x11a6('0x8')]({'port':0x232a});config[_0x11a6('0x9')]=_[_0x11a6('0xa')](config[_0x11a6('0x9')],{'host':_0x11a6('0xb'),'port':0x18eb});var socket=require(_0x11a6('0xc'))(new Redis(config[_0x11a6('0x9')]));require(_0x11a6('0xd'))[_0x11a6('0xe')](socket);function respondWithRpcPromise(_0x4bb1d0,_0x59f611,_0x522315){return new BPromise(function(_0xf7f73d,_0x3cf410){return client['request'](_0x4bb1d0,_0x522315)[_0x11a6('0xf')](function(_0x91835f){logger[_0x11a6('0x10')](_0x11a6('0x11'),_0x59f611,_0x11a6('0x12'));logger[_0x11a6('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x59f611,'request\x20sent',JSON[_0x11a6('0x14')](_0x91835f));if(_0x91835f[_0x11a6('0x15')]){if(_0x91835f['error'][_0x11a6('0x16')]===0x1f4){logger[_0x11a6('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x59f611,_0x91835f[_0x11a6('0x15')][_0x11a6('0x17')]);return _0x3cf410(_0x91835f['error'][_0x11a6('0x17')]);}logger[_0x11a6('0x15')](_0x11a6('0x11'),_0x59f611,_0x91835f[_0x11a6('0x15')]['message']);return _0xf7f73d(_0x91835f[_0x11a6('0x15')][_0x11a6('0x17')]);}else{logger[_0x11a6('0x10')](_0x11a6('0x11'),_0x59f611,_0x11a6('0x12'));_0xf7f73d(_0x91835f[_0x11a6('0x18')][_0x11a6('0x17')]);}})[_0x11a6('0x19')](function(_0x312cc6){logger[_0x11a6('0x15')](_0x11a6('0x11'),_0x59f611,_0x312cc6);_0x3cf410(_0x312cc6);});});}exports[_0x11a6('0x1a')]=function(_0x25a4c5){var _0x1e8b38=this;return new Promise(function(_0x595d3c,_0x485a4f){return db[_0x11a6('0x1b')][_0x11a6('0x1c')]({'raw':_0x25a4c5[_0x11a6('0x1d')]?_0x25a4c5['options']['raw']===undefined?!![]:![]:!![],'where':_0x25a4c5[_0x11a6('0x1d')]?_0x25a4c5['options'][_0x11a6('0x1e')]||null:null,'attributes':_0x25a4c5['options']?_0x25a4c5['options']['attributes']||null:null,'limit':_0x25a4c5['options']?_0x25a4c5[_0x11a6('0x1d')]['limit']||null:null,'include':_0x25a4c5[_0x11a6('0x1d')]?_0x25a4c5[_0x11a6('0x1d')]['include']?_['map'](_0x25a4c5[_0x11a6('0x1d')][_0x11a6('0x1f')],function(_0x34e230){return{'model':db[_0x34e230[_0x11a6('0x20')]],'as':_0x34e230['as'],'attributes':_0x34e230[_0x11a6('0x21')],'include':_0x34e230[_0x11a6('0x1f')]?_[_0x11a6('0x22')](_0x34e230[_0x11a6('0x1f')],function(_0x111e74){return{'model':db[_0x111e74[_0x11a6('0x20')]],'as':_0x111e74['as'],'attributes':_0x111e74[_0x11a6('0x21')],'include':_0x111e74[_0x11a6('0x1f')]?_[_0x11a6('0x22')](_0x111e74[_0x11a6('0x1f')],function(_0x304ad8){return{'model':db[_0x304ad8[_0x11a6('0x20')]],'as':_0x304ad8['as'],'attributes':_0x304ad8[_0x11a6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x11a6('0xf')](function(_0x44c92d){logger[_0x11a6('0x10')](_0x11a6('0x1a'),_0x25a4c5);logger[_0x11a6('0x13')](_0x11a6('0x1a'),_0x25a4c5,JSON[_0x11a6('0x14')](_0x44c92d));_0x595d3c(_0x44c92d);})[_0x11a6('0x19')](function(_0x56f74d){logger[_0x11a6('0x15')]('GetVoiceExtension',_0x56f74d[_0x11a6('0x17')],_0x25a4c5);_0x485a4f(_0x1e8b38[_0x11a6('0x15')](0x1f4,_0x56f74d[_0x11a6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 4d5afb3..64c7641 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 _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x1e71fc,_0xa2a307){var _0xafc876=function(_0x2277b7){while(--_0x2277b7){_0x1e71fc['push'](_0x1e71fc['shift']());}};_0xafc876(++_0xa2a307);}(_0x326f,0xd1));var _0xf326=function(_0x2826a9,_0x2a11f2){_0x2826a9=_0x2826a9-0x0;var _0x405257=_0x326f[_0x2826a9];return _0x405257;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file +var _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0xa7418f,_0x1716ce){var _0x4629b6=function(_0x492043){while(--_0x492043){_0xa7418f['push'](_0xa7418f['shift']());}};_0x4629b6(++_0x1716ce);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xc4aa[_0x3b0731];return _0x4204d7;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 07ba94f..af3e152 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 _0x7096=['../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x203168,_0xa8d6be){var _0xde9a61=function(_0x31e8d7){while(--_0x31e8d7){_0x203168['push'](_0x203168['shift']());}};_0xde9a61(++_0xa8d6be);}(_0x7096,0x10c));var _0x6709=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7096[_0x618414];return _0x21c19a;};'use strict';var multer=require('multer');var util=require(_0x6709('0x0'));var path=require('path');var timeout=require(_0x6709('0x1'));var express=require('express');var router=express[_0x6709('0x2')]();var fs_extra=require(_0x6709('0x3'));var auth=require(_0x6709('0x4'));var interaction=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var controller=require(_0x6709('0x7'));router[_0x6709('0x8')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0xa')]);router[_0x6709('0x8')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller[_0x6709('0xc')]);router['get']('/:id/messages',auth[_0x6709('0x9')](),controller[_0x6709('0xd')]);router[_0x6709('0xe')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0xf')]);router[_0x6709('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6709('0x11')]);router[_0x6709('0x12')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller[_0x6709('0x13')]);module[_0x6709('0x14')]=router; \ No newline at end of file +var _0xafc4=['delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','/:id/messages','getMessages','post','update'];(function(_0x121814,_0xfef884){var _0x472dea=function(_0x3a0355){while(--_0x3a0355){_0x121814['push'](_0x121814['shift']());}};_0x472dea(++_0xfef884);}(_0xafc4,0x69));var _0x4afc=function(_0x414088,_0x453a09){_0x414088=_0x414088-0x0;var _0x3b0133=_0xafc4[_0x414088];return _0x3b0133;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var fs_extra=require(_0x4afc('0x4'));var auth=require(_0x4afc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x4afc('0x6')]('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0x8')]);router[_0x4afc('0x6')](_0x4afc('0x9'),auth[_0x4afc('0x7')](),controller['show']);router[_0x4afc('0x6')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),controller[_0x4afc('0xb')]);router[_0x4afc('0xc')]('/',auth[_0x4afc('0x7')](),controller['create']);router['put'](_0x4afc('0x9'),auth['isAuthenticated'](),controller[_0x4afc('0xd')]);router[_0x4afc('0xe')]('/:id',auth[_0x4afc('0x7')](),controller[_0x4afc('0xf')]);module[_0x4afc('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index fdd7091..e10e745 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 _0x5e4c=['from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','mailbox','sequelize','exports','STRING'];(function(_0x21222d,_0x51047b){var _0x2f8986=function(_0x546feb){while(--_0x546feb){_0x21222d['push'](_0x21222d['shift']());}};_0x2f8986(++_0x51047b);}(_0x5e4c,0xfd));var _0xc5e4=function(_0x5cc367,_0x4f9b82){_0x5cc367=_0x5cc367-0x0;var _0x2ea06a=_0x5e4c[_0x5cc367];return _0x2ea06a;};'use strict';var Sequelize=require(_0xc5e4('0x0'));module[_0xc5e4('0x1')]={'customer_id':{'type':Sequelize[_0xc5e4('0x2')]},'context':{'type':Sequelize[_0xc5e4('0x2')],'defaultValue':_0xc5e4('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xc5e4('0x2')],'defaultValue':'','allowNull':![],'unique':_0xc5e4('0x4')},'password':{'type':Sequelize[_0xc5e4('0x2')]},'fullname':{'type':Sequelize[_0xc5e4('0x2')]},'email':{'type':Sequelize[_0xc5e4('0x2')],'validate':{'isEmail':!![]},'set':function(_0x58125e){this[_0xc5e4('0x5')]('email',typeof _0x58125e===_0xc5e4('0x6')&&_0x58125e[_0xc5e4('0x7')]()?_0x58125e[_0xc5e4('0x7')]():null);}},'pager':{'type':Sequelize[_0xc5e4('0x2')]},'tz':{'type':Sequelize[_0xc5e4('0x2')],'defaultValue':_0xc5e4('0x8')},'attach':{'type':Sequelize[_0xc5e4('0x9')](_0xc5e4('0xa'),'no'),'defaultValue':_0xc5e4('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xc5e4('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xc5e4('0x2')]},'review':{'type':Sequelize['ENUM'](_0xc5e4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xc5e4('0x9')](_0xc5e4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xc5e4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc5e4('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc5e4('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xc5e4('0x9')](_0xc5e4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xc5e4('0x9')](_0xc5e4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc5e4('0x9')](_0xc5e4('0xa'),'no'),'defaultValue':_0xc5e4('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xc5e4('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc5e4('0x9')](_0xc5e4('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xc5e4('0x9')](_0xc5e4('0xa'),'no'),'defaultValue':_0xc5e4('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xc5e4('0x2')]},'emailbody':{'type':Sequelize[_0xc5e4('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc5e4('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xc5e4('0xd')],'get':function(){return this[_0xc5e4('0xe')]('fullname')+'\x20-\x20'+this[_0xc5e4('0xe')](_0xc5e4('0xf'));}}}; \ No newline at end of file +var _0xa56a=['TIMESTAMP','INTEGER','getDataValue','fullname','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x48be84,_0x719030){var _0x109210=function(_0x2073ec){while(--_0x2073ec){_0x48be84['push'](_0x48be84['shift']());}};_0x109210(++_0x719030);}(_0xa56a,0x1c5));var _0xaa56=function(_0x4ee546,_0x3a7d19){_0x4ee546=_0x4ee546-0x0;var _0x368f48=_0xa56a[_0x4ee546];return _0x368f48;};'use strict';var Sequelize=require(_0xaa56('0x0'));module[_0xaa56('0x1')]={'customer_id':{'type':Sequelize[_0xaa56('0x2')]},'context':{'type':Sequelize[_0xaa56('0x2')],'defaultValue':'from-voicemail','unique':_0xaa56('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xaa56('0x3')},'password':{'type':Sequelize[_0xaa56('0x2')]},'fullname':{'type':Sequelize[_0xaa56('0x2')]},'email':{'type':Sequelize[_0xaa56('0x2')],'validate':{'isEmail':!![]},'set':function(_0x54f12d){this[_0xaa56('0x4')]('email',typeof _0x54f12d===_0xaa56('0x5')&&_0x54f12d[_0xaa56('0x6')]()?_0x54f12d[_0xaa56('0x6')]():null);}},'pager':{'type':Sequelize[_0xaa56('0x2')]},'tz':{'type':Sequelize[_0xaa56('0x2')],'defaultValue':_0xaa56('0x7')},'attach':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xaa56('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xaa56('0x2')]},'callback':{'type':Sequelize[_0xaa56('0x2')]},'review':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xaa56('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xaa56('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xaa56('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xaa56('0x8')](_0xaa56('0x9'),'no'),'defaultValue':_0xaa56('0x9'),'allowNull':![]},'stamp':{'type':_0xaa56('0xb')},'emailsubject':{'type':Sequelize[_0xaa56('0x2')]},'emailbody':{'type':Sequelize[_0xaa56('0x2')]},'maxsecs':{'type':Sequelize[_0xaa56('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xaa56('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xaa56('0xd')](_0xaa56('0xe'))+'\x20-\x20'+this['getDataValue'](_0xaa56('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 0fcfcfd..ecdbeaf 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 _0x6f7a=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','Voicemails','destroy','then','sendStatus','error','stack','name','send','index','VoiceMail','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll'];(function(_0x55e0dd,_0x11b1ce){var _0x364116=function(_0x3736d8){while(--_0x3736d8){_0x55e0dd['push'](_0x55e0dd['shift']());}};_0x364116(++_0x11b1ce);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x924dcb,_0x50d248){_0x924dcb=_0x924dcb-0x0;var _0x14d300=_0x6f7a[_0x924dcb];return _0x14d300;};'use strict';var emlformat=require(_0xa6f7('0x0'));var rimraf=require(_0xa6f7('0x1'));var zipdir=require(_0xa6f7('0x2'));var jsonpatch=require(_0xa6f7('0x3'));var rp=require('request-promise');var moment=require(_0xa6f7('0x4'));var BPromise=require(_0xa6f7('0x5'));var Mustache=require(_0xa6f7('0x6'));var util=require(_0xa6f7('0x7'));var path=require(_0xa6f7('0x8'));var sox=require(_0xa6f7('0x9'));var csv=require(_0xa6f7('0xa'));var ejs=require(_0xa6f7('0xb'));var fs=require('fs');var fs_extra=require(_0xa6f7('0xc'));var _=require(_0xa6f7('0xd'));var squel=require(_0xa6f7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6f7('0xf'));var toCsv=require(_0xa6f7('0xa'));var querystring=require(_0xa6f7('0x10'));var Papa=require(_0xa6f7('0x11'));var Redis=require(_0xa6f7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa6f7('0x13'));var hardwareService=require(_0xa6f7('0x14'));var logger=require('../../config/logger')(_0xa6f7('0x15'));var utils=require('../../config/utils');var config=require(_0xa6f7('0x16'));var licenseUtil=require(_0xa6f7('0x17'));var db=require(_0xa6f7('0x18'))['db'];function respondWithStatusCode(_0xd5558b,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x3fc7f1){if(_0x3fc7f1){return _0xd5558b['sendStatus'](_0x5a3035);}return _0xd5558b[_0xa6f7('0x19')](_0x5a3035)[_0xa6f7('0x1a')]();};}function respondWithResult(_0x25c123,_0x4d3d59){_0x4d3d59=_0x4d3d59||0xc8;return function(_0x34c02d){if(_0x34c02d){return _0x25c123['status'](_0x4d3d59)[_0xa6f7('0x1b')](_0x34c02d);}};}function respondWithFilteredResult(_0x57308a,_0x17b814){return function(_0x17f9c5){if(_0x17f9c5){var _0x6efd38=typeof _0x17b814['offset']===_0xa6f7('0x1c')&&typeof _0x17b814[_0xa6f7('0x1d')]===_0xa6f7('0x1c');var _0x2401b9=_0x17f9c5['count'];var _0x4a8827=_0x6efd38?0x0:_0x17b814[_0xa6f7('0x1e')];var _0x5298ba=_0x6efd38?_0x17f9c5[_0xa6f7('0x1f')]:_0x17b814[_0xa6f7('0x1e')]+_0x17b814['limit'];var _0x18fc4a;if(_0x5298ba>=_0x2401b9){_0x5298ba=_0x2401b9;_0x18fc4a=0xc8;}else{_0x18fc4a=0xce;}_0x57308a[_0xa6f7('0x19')](_0x18fc4a);return _0x57308a[_0xa6f7('0x20')](_0xa6f7('0x21'),_0x4a8827+'-'+_0x5298ba+'/'+_0x2401b9)[_0xa6f7('0x1b')](_0x17f9c5);}return null;};}function patchUpdates(_0x1aa8dc){return function(_0x4887ad){try{jsonpatch[_0xa6f7('0x22')](_0x4887ad,_0x1aa8dc,!![]);}catch(_0x45d79e){return BPromise['reject'](_0x45d79e);}return _0x4887ad['save']();};}function saveUpdates(_0x5ddc8d,_0x1de6c9){return function(_0x119950){if(_0x119950){return _0x119950['update'](_0x5ddc8d)['then'](function(_0x50e2be){return _0x50e2be;});}return null;};}function removeEntity(_0x2b6a84,_0xc77e8e){return function(_0x28263e){if(_0x28263e){return _0x28263e['destroy']()['then'](function(){var _0x2f4907=_0x28263e['get']({'plain':!![]});var _0x47ef97=_0xa6f7('0x23');return db['UserProfileResource'][_0xa6f7('0x24')]({'where':{'type':_0x47ef97,'resourceId':_0x2f4907['id']}})[_0xa6f7('0x25')](function(){return _0x28263e;});})[_0xa6f7('0x25')](function(){_0x2b6a84[_0xa6f7('0x19')](0xcc)[_0xa6f7('0x1a')]();});}};}function handleEntityNotFound(_0x4b8d2b,_0x51db47){return function(_0x1c419b){if(!_0x1c419b){_0x4b8d2b[_0xa6f7('0x26')](0x194);}return _0x1c419b;};}function handleError(_0x55d45a,_0x267917){_0x267917=_0x267917||0x1f4;return function(_0x27babb){logger[_0xa6f7('0x27')](_0x27babb[_0xa6f7('0x28')]);if(_0x27babb[_0xa6f7('0x29')]){delete _0x27babb[_0xa6f7('0x29')];}_0x55d45a[_0xa6f7('0x19')](_0x267917)[_0xa6f7('0x2a')](_0x27babb);};}exports[_0xa6f7('0x2b')]=function(_0x3dee2e,_0x40b0f8){var _0x278bad={},_0x52f9c1={},_0x442ccf={'count':0x0,'rows':[]};var _0x42dc49=_['map'](db[_0xa6f7('0x2c')][_0xa6f7('0x2d')],function(_0x4d79d8){return{'name':_0x4d79d8['fieldName'],'type':_0x4d79d8[_0xa6f7('0x2e')][_0xa6f7('0x2f')]};});_0x52f9c1[_0xa6f7('0x30')]=_[_0xa6f7('0x31')](_0x42dc49,_0xa6f7('0x29'));_0x52f9c1['query']=_['keys'](_0x3dee2e[_0xa6f7('0x32')]);_0x52f9c1['filters']=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],_0x52f9c1[_0xa6f7('0x32')]);_0x278bad[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x52f9c1[_0xa6f7('0x30')],qs['fields'](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x35')]));_0x278bad[_0xa6f7('0x34')]=_0x278bad['attributes'][_0xa6f7('0x36')]?_0x278bad['attributes']:_0x52f9c1[_0xa6f7('0x30')];if(!_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x37')]('nolimit')){_0x278bad[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x1d')]);_0x278bad[_0xa6f7('0x1e')]=qs[_0xa6f7('0x1e')](_0x3dee2e['query'][_0xa6f7('0x1e')]);}_0x278bad[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x278bad[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x3dee2e['query'],_0x52f9c1[_0xa6f7('0x3b')]),_0x42dc49);if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x278bad['where']=_[_0xa6f7('0x3e')](_0x278bad[_0xa6f7('0x3a')],{'$or':_['map'](_0x42dc49,function(_0x39349a){if(_0x39349a[_0xa6f7('0x2e')]!==_0xa6f7('0x3f')){var _0x14d532={};_0x14d532[_0x39349a[_0xa6f7('0x29')]]={'$like':'%'+_0x3dee2e['query'][_0xa6f7('0x3d')]+'%'};return _0x14d532;}})});}_0x278bad=_[_0xa6f7('0x3e')]({},_0x278bad,_0x3dee2e[_0xa6f7('0x40')]);var _0x1b8bf3={'where':_0x278bad[_0xa6f7('0x3a')]};return db[_0xa6f7('0x2c')][_0xa6f7('0x1f')](_0x1b8bf3)[_0xa6f7('0x25')](function(_0x5646b9){_0x442ccf['count']=_0x5646b9;if(_0x3dee2e[_0xa6f7('0x32')][_0xa6f7('0x41')]){_0x278bad[_0xa6f7('0x42')]=[{'all':!![]}];}return db[_0xa6f7('0x2c')][_0xa6f7('0x43')](_0x278bad);})[_0xa6f7('0x25')](function(_0x21fdd7){_0x442ccf[_0xa6f7('0x44')]=_0x21fdd7;return _0x442ccf;})[_0xa6f7('0x25')](respondWithFilteredResult(_0x40b0f8,_0x278bad))[_0xa6f7('0x45')](handleError(_0x40b0f8,null));};exports['show']=function(_0x41917c,_0x30be3b){var _0x4d5846={'raw':!![],'where':{'id':_0x41917c[_0xa6f7('0x46')]['id']}},_0x22d500={};_0x22d500[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db['VoiceMail'][_0xa6f7('0x2d')]);_0x22d500['query']=_['keys'](_0x41917c[_0xa6f7('0x32')]);_0x22d500[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x22d500[_0xa6f7('0x30')],_0x22d500[_0xa6f7('0x32')]);_0x4d5846[_0xa6f7('0x34')]=_[_0xa6f7('0x33')](_0x22d500['model'],qs[_0xa6f7('0x35')](_0x41917c[_0xa6f7('0x32')]['fields']));_0x4d5846[_0xa6f7('0x34')]=_0x4d5846[_0xa6f7('0x34')][_0xa6f7('0x36')]?_0x4d5846['attributes']:_0x22d500[_0xa6f7('0x30')];if(_0x41917c['query'][_0xa6f7('0x41')]){_0x4d5846[_0xa6f7('0x42')]=[{'all':!![]}];}_0x4d5846=_[_0xa6f7('0x3e')]({},_0x4d5846,_0x41917c['options']);return db['VoiceMail'][_0xa6f7('0x48')](_0x4d5846)['then'](handleEntityNotFound(_0x30be3b,null))[_0xa6f7('0x25')](respondWithResult(_0x30be3b,null))['catch'](handleError(_0x30be3b,null));};exports['create']=function(_0x1e7089,_0x2e3a04){return db[_0xa6f7('0x2c')][_0xa6f7('0x49')](_0x1e7089[_0xa6f7('0x4a')],{})[_0xa6f7('0x25')](function(_0x5d9b6f){var _0x4032fc=_0x1e7089[_0xa6f7('0x4b')]['get']({'plain':!![]});if(!_0x4032fc)throw new Error(_0xa6f7('0x4c'));if(_0x4032fc['role']===_0xa6f7('0x4b')){var _0x59091a=_0x5d9b6f['get']({'plain':!![]});var _0x60eacc=_0xa6f7('0x23');return db[_0xa6f7('0x4d')][_0xa6f7('0x48')]({'where':{'name':_0x60eacc,'userProfileId':_0x4032fc[_0xa6f7('0x4e')]},'raw':!![]})['then'](function(_0x340d3f){if(_0x340d3f&&_0x340d3f[_0xa6f7('0x4f')]===0x0){return db['UserProfileResource'][_0xa6f7('0x49')]({'name':_0x59091a['name'],'resourceId':_0x59091a['id'],'type':_0x340d3f[_0xa6f7('0x29')],'sectionId':_0x340d3f['id']},{})[_0xa6f7('0x25')](function(){return _0x5d9b6f;});}else{return _0x5d9b6f;}})[_0xa6f7('0x45')](function(_0x55369a){logger[_0xa6f7('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55369a);throw _0x55369a;});}return _0x5d9b6f;})[_0xa6f7('0x25')](respondWithResult(_0x2e3a04,0xc9))[_0xa6f7('0x45')](handleError(_0x2e3a04,null));};exports[_0xa6f7('0x50')]=function(_0x1dcb45,_0xa6bff9){if(_0x1dcb45['body']['id']){delete _0x1dcb45['body']['id'];}return db[_0xa6f7('0x2c')][_0xa6f7('0x48')]({'where':{'id':_0x1dcb45[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0xa6bff9,null))['then'](saveUpdates(_0x1dcb45[_0xa6f7('0x4a')],null))[_0xa6f7('0x25')](respondWithResult(_0xa6bff9,null))[_0xa6f7('0x45')](handleError(_0xa6bff9,null));};exports[_0xa6f7('0x24')]=function(_0x1b33a5,_0x39538e){return db['VoiceMail'][_0xa6f7('0x48')]({'where':{'id':_0x1b33a5[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x39538e,null))['then'](removeEntity(_0x39538e,null))[_0xa6f7('0x45')](handleError(_0x39538e,null));};exports[_0xa6f7('0x51')]=function(_0x139192,_0x4496f1,_0x5908e3){return db['VoiceMail'][_0xa6f7('0x52')]({'where':{'id':_0x139192[_0xa6f7('0x46')]['id']}})[_0xa6f7('0x25')](handleEntityNotFound(_0x4496f1,null))[_0xa6f7('0x25')](function(_0x301327){var _0x269249;var _0x1fcb72={},_0x5efd49={};_0x5efd49[_0xa6f7('0x30')]=_[_0xa6f7('0x47')](db[_0xa6f7('0x53')][_0xa6f7('0x2d')]);_0x5efd49[_0xa6f7('0x32')]=_[_0xa6f7('0x47')](_0x139192[_0xa6f7('0x32')]);_0x5efd49[_0xa6f7('0x3b')]=_[_0xa6f7('0x33')](_0x5efd49[_0xa6f7('0x30')],_0x5efd49[_0xa6f7('0x32')]);_0x1fcb72['attributes']=_[_0xa6f7('0x33')](_0x5efd49['model'],qs[_0xa6f7('0x35')](_0x139192['query'][_0xa6f7('0x35')]));_0x1fcb72[_0xa6f7('0x34')]=_0x1fcb72['attributes'][_0xa6f7('0x36')]?_0x1fcb72[_0xa6f7('0x34')]:_0x5efd49[_0xa6f7('0x30')];if(!_0x139192['query'][_0xa6f7('0x37')]('nolimit')){_0x1fcb72[_0xa6f7('0x1d')]=qs[_0xa6f7('0x1d')](_0x139192['query'][_0xa6f7('0x1d')]);_0x1fcb72['offset']=qs[_0xa6f7('0x1e')](_0x139192['query'][_0xa6f7('0x1e')]);}_0x1fcb72[_0xa6f7('0x38')]=qs[_0xa6f7('0x39')](_0x139192[_0xa6f7('0x32')][_0xa6f7('0x39')]);_0x1fcb72[_0xa6f7('0x3a')]=qs[_0xa6f7('0x3b')](_[_0xa6f7('0x3c')](_0x139192[_0xa6f7('0x32')],_0x5efd49[_0xa6f7('0x3b')]));if(_0x139192[_0xa6f7('0x32')][_0xa6f7('0x3d')]){_0x1fcb72['where']=_[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')],{'$or':_[_0xa6f7('0x31')](_0x1fcb72[_0xa6f7('0x34')],function(_0x154c78){var _0x3a464e={};_0x3a464e[_0x154c78]={'$like':'%'+_0x139192[_0xa6f7('0x32')][_0xa6f7('0x3d')]+'%'};return _0x3a464e;})});}_0x1fcb72['where']=_[_0xa6f7('0x3e')](_0x1fcb72[_0xa6f7('0x3a')],{'mailboxuser':_0x301327[_0xa6f7('0x54')]});_0x1fcb72=_['merge']({},_0x1fcb72,_0x139192[_0xa6f7('0x40')]);return db[_0xa6f7('0x53')][_0xa6f7('0x55')](_0x1fcb72)[_0xa6f7('0x25')](respondWithFilteredResult(_0x4496f1,_0x1fcb72));})[_0xa6f7('0x45')](handleError(_0x4496f1,null));}; \ No newline at end of file +var _0x1775=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','params','includeAll','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','rawAttributes','mailbox','options','VoiceMailMessage','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','Voicemails','UserProfileResource','name','send','index','VoiceMail','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x399463,_0x1cb5fb){var _0x45cbd2=function(_0x1c8c2f){while(--_0x1c8c2f){_0x399463['push'](_0x399463['shift']());}};_0x45cbd2(++_0x1cb5fb);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];function respondWithStatusCode(_0xc613b9,_0x3c4ced){_0x3c4ced=_0x3c4ced||0xcc;return function(_0x111e99){if(_0x111e99){return _0xc613b9[_0x5177('0x1c')](_0x3c4ced);}return _0xc613b9[_0x5177('0x1d')](_0x3c4ced)[_0x5177('0x1e')]();};}function respondWithResult(_0x3e6224,_0x1eb9dd){_0x1eb9dd=_0x1eb9dd||0xc8;return function(_0x41bef4){if(_0x41bef4){return _0x3e6224[_0x5177('0x1d')](_0x1eb9dd)[_0x5177('0x1f')](_0x41bef4);}};}function respondWithFilteredResult(_0x31aff8,_0x1b32e6){return function(_0x175ca6){if(_0x175ca6){var _0x2ab5e5=typeof _0x1b32e6[_0x5177('0x20')]===_0x5177('0x21')&&typeof _0x1b32e6['limit']===_0x5177('0x21');var _0x41e687=_0x175ca6[_0x5177('0x22')];var _0x1b4102=_0x2ab5e5?0x0:_0x1b32e6['offset'];var _0x3e6944=_0x2ab5e5?_0x175ca6[_0x5177('0x22')]:_0x1b32e6[_0x5177('0x20')]+_0x1b32e6['limit'];var _0x86f5f8;if(_0x3e6944>=_0x41e687){_0x3e6944=_0x41e687;_0x86f5f8=0xc8;}else{_0x86f5f8=0xce;}_0x31aff8['status'](_0x86f5f8);return _0x31aff8[_0x5177('0x23')](_0x5177('0x24'),_0x1b4102+'-'+_0x3e6944+'/'+_0x41e687)[_0x5177('0x1f')](_0x175ca6);}return null;};}function patchUpdates(_0x27b732){return function(_0x451e5c){try{jsonpatch[_0x5177('0x25')](_0x451e5c,_0x27b732,!![]);}catch(_0x174c4f){return BPromise[_0x5177('0x26')](_0x174c4f);}return _0x451e5c[_0x5177('0x27')]();};}function saveUpdates(_0x2a95cc,_0x23dad2){return function(_0x3b0c37){if(_0x3b0c37){return _0x3b0c37['update'](_0x2a95cc)[_0x5177('0x28')](function(_0x556f96){return _0x556f96;});}return null;};}function removeEntity(_0x30b60f,_0x2c68d8){return function(_0x3b39b5){if(_0x3b39b5){return _0x3b39b5[_0x5177('0x29')]()['then'](function(){var _0x2503ef=_0x3b39b5['get']({'plain':!![]});var _0x564139=_0x5177('0x2a');return db[_0x5177('0x2b')]['destroy']({'where':{'type':_0x564139,'resourceId':_0x2503ef['id']}})[_0x5177('0x28')](function(){return _0x3b39b5;});})['then'](function(){_0x30b60f[_0x5177('0x1d')](0xcc)[_0x5177('0x1e')]();});}};}function handleEntityNotFound(_0x58846c,_0x3e021a){return function(_0x2554ec){if(!_0x2554ec){_0x58846c[_0x5177('0x1c')](0x194);}return _0x2554ec;};}function handleError(_0x7f86e,_0xe98ff1){_0xe98ff1=_0xe98ff1||0x1f4;return function(_0x1cef5d){logger['error'](_0x1cef5d['stack']);if(_0x1cef5d[_0x5177('0x2c')]){delete _0x1cef5d[_0x5177('0x2c')];}_0x7f86e[_0x5177('0x1d')](_0xe98ff1)[_0x5177('0x2d')](_0x1cef5d);};}exports[_0x5177('0x2e')]=function(_0x8134f9,_0x31eb9f){var _0x72dced={},_0x49f6f1={},_0x42e1db={'count':0x0,'rows':[]};var _0x2233a2=_['map'](db[_0x5177('0x2f')]['rawAttributes'],function(_0x172b36){return{'name':_0x172b36[_0x5177('0x30')],'type':_0x172b36[_0x5177('0x31')]['key']};});_0x49f6f1['model']=_[_0x5177('0x32')](_0x2233a2,_0x5177('0x2c'));_0x49f6f1[_0x5177('0x33')]=_[_0x5177('0x34')](_0x8134f9[_0x5177('0x33')]);_0x49f6f1[_0x5177('0x35')]=_[_0x5177('0x36')](_0x49f6f1[_0x5177('0x37')],_0x49f6f1['query']);_0x72dced[_0x5177('0x38')]=_[_0x5177('0x36')](_0x49f6f1['model'],qs[_0x5177('0x39')](_0x8134f9[_0x5177('0x33')][_0x5177('0x39')]));_0x72dced[_0x5177('0x38')]=_0x72dced[_0x5177('0x38')][_0x5177('0x3a')]?_0x72dced['attributes']:_0x49f6f1[_0x5177('0x37')];if(!_0x8134f9[_0x5177('0x33')][_0x5177('0x3b')](_0x5177('0x3c'))){_0x72dced[_0x5177('0x3d')]=qs[_0x5177('0x3d')](_0x8134f9[_0x5177('0x33')]['limit']);_0x72dced[_0x5177('0x20')]=qs[_0x5177('0x20')](_0x8134f9['query']['offset']);}_0x72dced[_0x5177('0x3e')]=qs[_0x5177('0x3f')](_0x8134f9[_0x5177('0x33')][_0x5177('0x3f')]);_0x72dced[_0x5177('0x40')]=qs[_0x5177('0x35')](_[_0x5177('0x41')](_0x8134f9[_0x5177('0x33')],_0x49f6f1[_0x5177('0x35')]),_0x2233a2);if(_0x8134f9[_0x5177('0x33')][_0x5177('0x42')]){_0x72dced[_0x5177('0x40')]=_[_0x5177('0x43')](_0x72dced['where'],{'$or':_[_0x5177('0x32')](_0x2233a2,function(_0x2a4db1){if(_0x2a4db1['type']!==_0x5177('0x44')){var _0x56f297={};_0x56f297[_0x2a4db1[_0x5177('0x2c')]]={'$like':'%'+_0x8134f9[_0x5177('0x33')][_0x5177('0x42')]+'%'};return _0x56f297;}})});}_0x72dced=_['merge']({},_0x72dced,_0x8134f9['options']);var _0x210510={'where':_0x72dced[_0x5177('0x40')]};return db[_0x5177('0x2f')][_0x5177('0x22')](_0x210510)[_0x5177('0x28')](function(_0x3e710d){_0x42e1db[_0x5177('0x22')]=_0x3e710d;if(_0x8134f9[_0x5177('0x33')]['includeAll']){_0x72dced[_0x5177('0x45')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x72dced);})[_0x5177('0x28')](function(_0x17dc98){_0x42e1db['rows']=_0x17dc98;return _0x42e1db;})[_0x5177('0x28')](respondWithFilteredResult(_0x31eb9f,_0x72dced))['catch'](handleError(_0x31eb9f,null));};exports['show']=function(_0x46c833,_0x1769cd){var _0x262c71={'raw':!![],'where':{'id':_0x46c833[_0x5177('0x46')]['id']}},_0x3776b8={};_0x3776b8[_0x5177('0x37')]=_[_0x5177('0x34')](db['VoiceMail']['rawAttributes']);_0x3776b8[_0x5177('0x33')]=_['keys'](_0x46c833[_0x5177('0x33')]);_0x3776b8[_0x5177('0x35')]=_[_0x5177('0x36')](_0x3776b8[_0x5177('0x37')],_0x3776b8['query']);_0x262c71[_0x5177('0x38')]=_[_0x5177('0x36')](_0x3776b8[_0x5177('0x37')],qs[_0x5177('0x39')](_0x46c833[_0x5177('0x33')][_0x5177('0x39')]));_0x262c71[_0x5177('0x38')]=_0x262c71[_0x5177('0x38')][_0x5177('0x3a')]?_0x262c71[_0x5177('0x38')]:_0x3776b8[_0x5177('0x37')];if(_0x46c833['query'][_0x5177('0x47')]){_0x262c71['include']=[{'all':!![]}];}_0x262c71=_['merge']({},_0x262c71,_0x46c833['options']);return db[_0x5177('0x2f')][_0x5177('0x48')](_0x262c71)['then'](handleEntityNotFound(_0x1769cd,null))[_0x5177('0x28')](respondWithResult(_0x1769cd,null))[_0x5177('0x49')](handleError(_0x1769cd,null));};exports[_0x5177('0x4a')]=function(_0x4891fe,_0x1d4ae4){return db['VoiceMail']['create'](_0x4891fe['body'],{})[_0x5177('0x28')](function(_0x37d5dd){var _0x1300d7=_0x4891fe['user']['get']({'plain':!![]});if(!_0x1300d7)throw new Error(_0x5177('0x4b'));if(_0x1300d7['role']===_0x5177('0x4c')){var _0x9dd7a2=_0x37d5dd[_0x5177('0x4d')]({'plain':!![]});var _0x31a6e1=_0x5177('0x2a');return db[_0x5177('0x4e')][_0x5177('0x48')]({'where':{'name':_0x31a6e1,'userProfileId':_0x1300d7[_0x5177('0x4f')]},'raw':!![]})[_0x5177('0x28')](function(_0x217aca){if(_0x217aca&&_0x217aca[_0x5177('0x50')]===0x0){return db[_0x5177('0x2b')][_0x5177('0x4a')]({'name':_0x9dd7a2['name'],'resourceId':_0x9dd7a2['id'],'type':_0x217aca['name'],'sectionId':_0x217aca['id']},{})[_0x5177('0x28')](function(){return _0x37d5dd;});}else{return _0x37d5dd;}})['catch'](function(_0x649c6f){logger['error'](_0x5177('0x51'),_0x649c6f);throw _0x649c6f;});}return _0x37d5dd;})[_0x5177('0x28')](respondWithResult(_0x1d4ae4,0xc9))[_0x5177('0x49')](handleError(_0x1d4ae4,null));};exports['update']=function(_0x5be224,_0x19884e){if(_0x5be224[_0x5177('0x52')]['id']){delete _0x5be224[_0x5177('0x52')]['id'];}return db[_0x5177('0x2f')]['find']({'where':{'id':_0x5be224['params']['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x19884e,null))[_0x5177('0x28')](saveUpdates(_0x5be224[_0x5177('0x52')],null))[_0x5177('0x28')](respondWithResult(_0x19884e,null))['catch'](handleError(_0x19884e,null));};exports[_0x5177('0x29')]=function(_0x143aff,_0x3a18ad){return db['VoiceMail'][_0x5177('0x48')]({'where':{'id':_0x143aff[_0x5177('0x46')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x3a18ad,null))['then'](removeEntity(_0x3a18ad,null))[_0x5177('0x49')](handleError(_0x3a18ad,null));};exports['getMessages']=function(_0x40dfd6,_0x39fb92,_0x3268bd){return db['VoiceMail'][_0x5177('0x53')]({'where':{'id':_0x40dfd6[_0x5177('0x46')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x39fb92,null))[_0x5177('0x28')](function(_0xc7a59e){var _0x74589e;var _0x37380c={},_0x267599={};_0x267599['model']=_['keys'](db['VoiceMailMessage'][_0x5177('0x54')]);_0x267599[_0x5177('0x33')]=_[_0x5177('0x34')](_0x40dfd6[_0x5177('0x33')]);_0x267599[_0x5177('0x35')]=_[_0x5177('0x36')](_0x267599['model'],_0x267599['query']);_0x37380c[_0x5177('0x38')]=_[_0x5177('0x36')](_0x267599[_0x5177('0x37')],qs[_0x5177('0x39')](_0x40dfd6[_0x5177('0x33')][_0x5177('0x39')]));_0x37380c[_0x5177('0x38')]=_0x37380c[_0x5177('0x38')][_0x5177('0x3a')]?_0x37380c['attributes']:_0x267599[_0x5177('0x37')];if(!_0x40dfd6[_0x5177('0x33')]['hasOwnProperty'](_0x5177('0x3c'))){_0x37380c[_0x5177('0x3d')]=qs['limit'](_0x40dfd6[_0x5177('0x33')][_0x5177('0x3d')]);_0x37380c[_0x5177('0x20')]=qs['offset'](_0x40dfd6[_0x5177('0x33')][_0x5177('0x20')]);}_0x37380c['order']=qs['sort'](_0x40dfd6[_0x5177('0x33')]['sort']);_0x37380c[_0x5177('0x40')]=qs['filters'](_[_0x5177('0x41')](_0x40dfd6[_0x5177('0x33')],_0x267599['filters']));if(_0x40dfd6[_0x5177('0x33')][_0x5177('0x42')]){_0x37380c[_0x5177('0x40')]=_[_0x5177('0x43')](_0x37380c[_0x5177('0x40')],{'$or':_[_0x5177('0x32')](_0x37380c[_0x5177('0x38')],function(_0x58ebdd){var _0x26b733={};_0x26b733[_0x58ebdd]={'$like':'%'+_0x40dfd6['query']['filter']+'%'};return _0x26b733;})});}_0x37380c[_0x5177('0x40')]=_[_0x5177('0x43')](_0x37380c['where'],{'mailboxuser':_0xc7a59e[_0x5177('0x55')]});_0x37380c=_[_0x5177('0x43')]({},_0x37380c,_0x40dfd6[_0x5177('0x56')]);return db[_0x5177('0x57')][_0x5177('0x58')](_0x37380c)[_0x5177('0x28')](respondWithFilteredResult(_0x39fb92,_0x37380c));})[_0x5177('0x49')](handleError(_0x39fb92,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 3d3a549..8f8a4fb 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 _0x9931=['mailbox','context','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0xdb0ce1,_0x1db757){var _0x24fa8b=function(_0x549fea){while(--_0x549fea){_0xdb0ce1['push'](_0xdb0ce1['shift']());}};_0x24fa8b(++_0x1db757);}(_0x9931,0x1b5));var _0x1993=function(_0x5a5b5a,_0x45d2c7){_0x5a5b5a=_0x5a5b5a-0x0;var _0x16dbc4=_0x9931[_0x5a5b5a];return _0x16dbc4;};'use strict';var _=require(_0x1993('0x0'));var util=require('util');var logger=require(_0x1993('0x1'))(_0x1993('0x2'));var moment=require(_0x1993('0x3'));var BPromise=require(_0x1993('0x4'));var rp=require(_0x1993('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1993('0x6'));var config=require(_0x1993('0x7'));var attributes=require('./voiceMail.attributes');module[_0x1993('0x8')]=function(_0x40d630,_0x33cd36){return _0x40d630[_0x1993('0x9')](_0x1993('0xa'),attributes,{'tableName':_0x1993('0xb'),'paranoid':![],'indexes':[{'name':_0x1993('0xc'),'fields':[_0x1993('0xd'),_0x1993('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdae2=['bluebird','request-promise','../../config/environment','VoiceMail','mailbox_context','mailbox','util','../../config/logger','api','moment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xdae2,0x16e));var _0x2dae=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xdae2[_0x26462c];return _0x509a42;};'use strict';var _=require('lodash');var util=require(_0x2dae('0x0'));var logger=require(_0x2dae('0x1'))(_0x2dae('0x2'));var moment=require(_0x2dae('0x3'));var BPromise=require(_0x2dae('0x4'));var rp=require(_0x2dae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2dae('0x6'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x43520a,_0x5eeb6c){return _0x43520a['define'](_0x2dae('0x7'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x2dae('0x8'),'fields':[_0x2dae('0x9'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 5f9352c..4652d40 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 _0x2002=['info','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2e17a7,_0x5b5efa){var _0x443505=function(_0x1bc24d){while(--_0x1bc24d){_0x2e17a7['push'](_0x2e17a7['shift']());}};_0x443505(++_0x5b5efa);}(_0x2002,0xa5));var _0x2200=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0x2002[_0xd0a847];return _0x2536ec;};'use strict';var _=require(_0x2200('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2200('0x1'));var fs=require('fs');var Redis=require(_0x2200('0x2'));var db=require(_0x2200('0x3'))['db'];var utils=require(_0x2200('0x4'));var logger=require('../../config/logger')(_0x2200('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2200('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a3cba,_0x350ca4,_0x4ac579){return new BPromise(function(_0x5875a3,_0x506954){return client[_0x2200('0x7')](_0x5a3cba,_0x4ac579)[_0x2200('0x8')](function(_0x33cd24){logger['info'](_0x2200('0x9'),_0x350ca4,_0x2200('0xa'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x350ca4,_0x2200('0xa'),JSON[_0x2200('0xb')](_0x33cd24));if(_0x33cd24[_0x2200('0xc')]){if(_0x33cd24[_0x2200('0xc')][_0x2200('0xd')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x350ca4,_0x33cd24['error'][_0x2200('0xe')]);return _0x506954(_0x33cd24[_0x2200('0xc')][_0x2200('0xe')]);}logger[_0x2200('0xc')](_0x2200('0x9'),_0x350ca4,_0x33cd24[_0x2200('0xc')][_0x2200('0xe')]);return _0x5875a3(_0x33cd24['error'][_0x2200('0xe')]);}else{logger[_0x2200('0xf')](_0x2200('0x9'),_0x350ca4,'request\x20sent');_0x5875a3(_0x33cd24[_0x2200('0x10')][_0x2200('0xe')]);}})[_0x2200('0x11')](function(_0x5affac){logger[_0x2200('0xc')]('VoiceMail,\x20%s,\x20%s',_0x350ca4,_0x5affac);_0x506954(_0x5affac);});});} \ No newline at end of file +var _0xc33b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','VoiceMail,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0xc33b,0x65));var _0xbc33=function(_0x1199ed,_0x386887){_0x1199ed=_0x1199ed-0x0;var _0x356067=_0xc33b[_0x1199ed];return _0x356067;};'use strict';var _=require(_0xbc33('0x0'));var util=require(_0xbc33('0x1'));var moment=require(_0xbc33('0x2'));var BPromise=require(_0xbc33('0x3'));var rs=require(_0xbc33('0x4'));var fs=require('fs');var Redis=require(_0xbc33('0x5'));var db=require(_0xbc33('0x6'))['db'];var utils=require(_0xbc33('0x7'));var logger=require(_0xbc33('0x8'))(_0xbc33('0x9'));var config=require('../../config/environment');var jayson=require(_0xbc33('0xa'));var client=jayson[_0xbc33('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbfba0c,_0x1896a1,_0x4bfda2){return new BPromise(function(_0x770e,_0x47e547){return client[_0xbc33('0xc')](_0xbfba0c,_0x4bfda2)['then'](function(_0x5bd476){logger[_0xbc33('0xd')]('VoiceMail,\x20%s,\x20%s',_0x1896a1,_0xbc33('0xe'));logger[_0xbc33('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x1896a1,_0xbc33('0xe'),JSON[_0xbc33('0x10')](_0x5bd476));if(_0x5bd476[_0xbc33('0x11')]){if(_0x5bd476[_0xbc33('0x11')]['code']===0x1f4){logger['error'](_0xbc33('0x12'),_0x1896a1,_0x5bd476[_0xbc33('0x11')][_0xbc33('0x13')]);return _0x47e547(_0x5bd476[_0xbc33('0x11')][_0xbc33('0x13')]);}logger[_0xbc33('0x11')](_0xbc33('0x12'),_0x1896a1,_0x5bd476['error'][_0xbc33('0x13')]);return _0x770e(_0x5bd476['error'][_0xbc33('0x13')]);}else{logger[_0xbc33('0xd')](_0xbc33('0x12'),_0x1896a1,_0xbc33('0xe'));_0x770e(_0x5bd476['result'][_0xbc33('0x13')]);}})[_0xbc33('0x14')](function(_0x10ebbb){logger[_0xbc33('0x11')](_0xbc33('0x12'),_0x1896a1,_0x10ebbb);_0x47e547(_0x10ebbb);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 3f73cbf..1a14d02 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 _0x49f5=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download'];(function(_0x1260bc,_0x44712d){var _0x3f717b=function(_0x117ddd){while(--_0x117ddd){_0x1260bc['push'](_0x1260bc['shift']());}};_0x3f717b(++_0x44712d);}(_0x49f5,0x102));var _0x549f=function(_0x272376,_0x18e088){_0x272376=_0x272376-0x0;var _0x10b72c=_0x49f5[_0x272376];return _0x10b72c;};'use strict';var multer=require(_0x549f('0x0'));var util=require(_0x549f('0x1'));var path=require(_0x549f('0x2'));var timeout=require(_0x549f('0x3'));var express=require(_0x549f('0x4'));var router=express[_0x549f('0x5')]();var fs_extra=require(_0x549f('0x6'));var auth=require(_0x549f('0x7'));var interaction=require(_0x549f('0x8'));var config=require(_0x549f('0x9'));var controller=require(_0x549f('0xa'));router[_0x549f('0xb')]('/',auth[_0x549f('0xc')](),controller[_0x549f('0xd')]);router[_0x549f('0xb')](_0x549f('0xe'),auth['isAuthenticated'](),controller[_0x549f('0xf')]);router[_0x549f('0xb')](_0x549f('0x10'),auth[_0x549f('0xc')](),controller[_0x549f('0x11')]);router[_0x549f('0x12')]('/',auth['isAuthenticated'](),controller[_0x549f('0x13')]);router['put']('/:id',auth[_0x549f('0xc')](),controller[_0x549f('0x14')]);router[_0x549f('0x15')](_0x549f('0xe'),auth[_0x549f('0xc')](),controller[_0x549f('0x16')]);module['exports']=router; \ No newline at end of file +var _0x9d30=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id/download','isAuthenticated','post','create','put','/:id','update','destroy','exports'];(function(_0x590794,_0x4e29b5){var _0x657a79=function(_0x2ffd0f){while(--_0x2ffd0f){_0x590794['push'](_0x590794['shift']());}};_0x657a79(++_0x4e29b5);}(_0x9d30,0xb4));var _0x09d3=function(_0x3c033a,_0x3556b6){_0x3c033a=_0x3c033a-0x0;var _0x5a7ae5=_0x9d30[_0x3c033a];return _0x5a7ae5;};'use strict';var multer=require(_0x09d3('0x0'));var util=require(_0x09d3('0x1'));var path=require('path');var timeout=require(_0x09d3('0x2'));var express=require(_0x09d3('0x3'));var router=express[_0x09d3('0x4')]();var fs_extra=require(_0x09d3('0x5'));var auth=require(_0x09d3('0x6'));var interaction=require(_0x09d3('0x7'));var config=require(_0x09d3('0x8'));var controller=require(_0x09d3('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x09d3('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x09d3('0xb'),auth[_0x09d3('0xc')](),controller['download']);router[_0x09d3('0xd')]('/',auth['isAuthenticated'](),controller[_0x09d3('0xe')]);router[_0x09d3('0xf')](_0x09d3('0x10'),auth[_0x09d3('0xc')](),controller[_0x09d3('0x11')]);router['delete'](_0x09d3('0x10'),auth[_0x09d3('0xc')](),controller[_0x09d3('0x12')]);module[_0x09d3('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index cdac58f..bfde75c 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 _0x2aae=['VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','sequelize','exports'];(function(_0x4f3464,_0x2bda73){var _0x4be0ba=function(_0x5938cb){while(--_0x5938cb){_0x4f3464['push'](_0x4f3464['shift']());}};_0x4be0ba(++_0x2bda73);}(_0x2aae,0x9e));var _0xe2aa=function(_0x1de767,_0x39902b){_0x1de767=_0x1de767-0x0;var _0x224e43=_0x2aae[_0x1de767];return _0x224e43;};'use strict';var Sequelize=require(_0xe2aa('0x0'));module[_0xe2aa('0x1')]={'name':{'type':Sequelize[_0xe2aa('0x2')],'get':function(_0x1728c4){return this[_0xe2aa('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xe2aa('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe2aa('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xe2aa('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xe2aa('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xe2aa('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xe2aa('0x6')](_0xe2aa('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xe2aa('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xe2aa('0x8'),'defaultValue':Sequelize[_0xe2aa('0x9')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x9cf9=['STRING','BLOB','TIMESTAMP','literal','sequelize','getDataValue'];(function(_0x102dfa,_0x83034b){var _0x211f22=function(_0x20e448){while(--_0x20e448){_0x102dfa['push'](_0x102dfa['shift']());}};_0x211f22(++_0x83034b);}(_0x9cf9,0xac));var _0x99cf=function(_0x1c24f0,_0x7fb25){_0x1c24f0=_0x1c24f0-0x0;var _0x121b29=_0x9cf9[_0x1c24f0];return _0x121b29;};'use strict';var Sequelize=require(_0x99cf('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x8ecebd){return this[_0x99cf('0x1')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x99cf('0x2')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x99cf('0x2')],'defaultValue':''},'callerid':{'type':Sequelize[_0x99cf('0x2')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x99cf('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x99cf('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x99cf('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x99cf('0x3')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x99cf('0x2')],'defaultValue':''},'stamp':{'type':_0x99cf('0x4'),'defaultValue':Sequelize[_0x99cf('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 639399a..0d343e8 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 _0x2b57=['order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','update','download','recording','msg_id','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','then','destroy','name','send','index','VoiceMailMessage','rawAttributes','type','model','differenceBy','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x2a70bf,_0xc34b11){var _0x81f199=function(_0x59ca41){while(--_0x59ca41){_0x2a70bf['push'](_0x2a70bf['shift']());}};_0x81f199(++_0xc34b11);}(_0x2b57,0xc6));var _0x72b5=function(_0x51d094,_0xbbd5f7){_0x51d094=_0x51d094-0x0;var _0x20c0fb=_0x2b57[_0x51d094];return _0x20c0fb;};'use strict';var emlformat=require(_0x72b5('0x0'));var rimraf=require(_0x72b5('0x1'));var zipdir=require(_0x72b5('0x2'));var jsonpatch=require(_0x72b5('0x3'));var rp=require(_0x72b5('0x4'));var moment=require('moment');var BPromise=require(_0x72b5('0x5'));var Mustache=require(_0x72b5('0x6'));var util=require(_0x72b5('0x7'));var path=require(_0x72b5('0x8'));var sox=require(_0x72b5('0x9'));var csv=require(_0x72b5('0xa'));var ejs=require(_0x72b5('0xb'));var fs=require('fs');var fs_extra=require(_0x72b5('0xc'));var _=require('lodash');var squel=require(_0x72b5('0xd'));var crypto=require(_0x72b5('0xe'));var jsforce=require(_0x72b5('0xf'));var deskjs=require(_0x72b5('0x10'));var toCsv=require('to-csv');var querystring=require(_0x72b5('0x11'));var Papa=require(_0x72b5('0x12'));var Redis=require(_0x72b5('0x13'));var authService=require(_0x72b5('0x14'));var qs=require(_0x72b5('0x15'));var as=require(_0x72b5('0x16'));var hardwareService=require(_0x72b5('0x17'));var logger=require('../../config/logger')(_0x72b5('0x18'));var utils=require(_0x72b5('0x19'));var config=require(_0x72b5('0x1a'));var licenseUtil=require(_0x72b5('0x1b'));var db=require(_0x72b5('0x1c'))['db'];function respondWithStatusCode(_0x236166,_0x414a65){_0x414a65=_0x414a65||0xcc;return function(_0x2fd305){if(_0x2fd305){return _0x236166[_0x72b5('0x1d')](_0x414a65);}return _0x236166[_0x72b5('0x1e')](_0x414a65)[_0x72b5('0x1f')]();};}function respondWithResult(_0x3f5227,_0x46e6f7){_0x46e6f7=_0x46e6f7||0xc8;return function(_0x3742fd){if(_0x3742fd){return _0x3f5227[_0x72b5('0x1e')](_0x46e6f7)[_0x72b5('0x20')](_0x3742fd);}};}function respondWithFilteredResult(_0x16ff33,_0x1f4b2f){return function(_0x8ae862){if(_0x8ae862){var _0x284499=typeof _0x1f4b2f[_0x72b5('0x21')]==='undefined'&&typeof _0x1f4b2f['limit']==='undefined';var _0x3b9064=_0x8ae862['count'];var _0x246aa7=_0x284499?0x0:_0x1f4b2f[_0x72b5('0x21')];var _0x131f75=_0x284499?_0x8ae862[_0x72b5('0x22')]:_0x1f4b2f['offset']+_0x1f4b2f[_0x72b5('0x23')];var _0x443692;if(_0x131f75>=_0x3b9064){_0x131f75=_0x3b9064;_0x443692=0xc8;}else{_0x443692=0xce;}_0x16ff33[_0x72b5('0x1e')](_0x443692);return _0x16ff33[_0x72b5('0x24')](_0x72b5('0x25'),_0x246aa7+'-'+_0x131f75+'/'+_0x3b9064)['json'](_0x8ae862);}return null;};}function patchUpdates(_0x34b488){return function(_0x496718){try{jsonpatch[_0x72b5('0x26')](_0x496718,_0x34b488,!![]);}catch(_0x53b6fd){return BPromise[_0x72b5('0x27')](_0x53b6fd);}return _0x496718[_0x72b5('0x28')]();};}function saveUpdates(_0x205f81,_0x1d40c1){return function(_0x43092d){if(_0x43092d){return _0x43092d['update'](_0x205f81)[_0x72b5('0x29')](function(_0x35e234){return _0x35e234;});}return null;};}function removeEntity(_0x4633cd,_0x12a85f){return function(_0x89ac71){if(_0x89ac71){return _0x89ac71[_0x72b5('0x2a')]()[_0x72b5('0x29')](function(){_0x4633cd['status'](0xcc)[_0x72b5('0x1f')]();});}};}function handleEntityNotFound(_0x4b7c58,_0x114c13){return function(_0x20f177){if(!_0x20f177){_0x4b7c58['sendStatus'](0x194);}return _0x20f177;};}function handleError(_0x10df1f,_0x4a43e3){_0x4a43e3=_0x4a43e3||0x1f4;return function(_0x4de075){logger['error'](_0x4de075['stack']);if(_0x4de075[_0x72b5('0x2b')]){delete _0x4de075[_0x72b5('0x2b')];}_0x10df1f[_0x72b5('0x1e')](_0x4a43e3)[_0x72b5('0x2c')](_0x4de075);};}exports[_0x72b5('0x2d')]=function(_0x49b45b,_0x3f0891){var _0x4ebb8c={},_0x28348e={},_0x3ea8f3={'count':0x0,'rows':[]};var _0x427508=_['map'](db[_0x72b5('0x2e')][_0x72b5('0x2f')],function(_0x1eb4d1){return{'name':_0x1eb4d1['fieldName'],'type':_0x1eb4d1[_0x72b5('0x30')]['key']};});_0x28348e[_0x72b5('0x31')]=_[_0x72b5('0x32')](_[_0x72b5('0x33')](_0x427508,_0x72b5('0x2b')),['name']);_0x28348e[_0x72b5('0x34')]=_[_0x72b5('0x35')](_0x49b45b['query']);_0x28348e[_0x72b5('0x36')]=_[_0x72b5('0x37')](_0x28348e[_0x72b5('0x31')],_0x28348e[_0x72b5('0x34')]);_0x4ebb8c['attributes']=_[_0x72b5('0x37')](_0x28348e['model'],qs[_0x72b5('0x38')](_0x49b45b['query'][_0x72b5('0x38')]));_0x4ebb8c[_0x72b5('0x39')]=_0x4ebb8c[_0x72b5('0x39')][_0x72b5('0x3a')]?_0x4ebb8c['attributes']:_0x28348e[_0x72b5('0x31')];if(!_0x49b45b[_0x72b5('0x34')][_0x72b5('0x3b')]('nolimit')){_0x4ebb8c[_0x72b5('0x23')]=qs['limit'](_0x49b45b['query'][_0x72b5('0x23')]);_0x4ebb8c[_0x72b5('0x21')]=qs[_0x72b5('0x21')](_0x49b45b[_0x72b5('0x34')][_0x72b5('0x21')]);}_0x4ebb8c[_0x72b5('0x3c')]=qs[_0x72b5('0x3d')](_0x49b45b['query'][_0x72b5('0x3d')]);_0x4ebb8c[_0x72b5('0x3e')]=qs[_0x72b5('0x36')](_[_0x72b5('0x3f')](_0x49b45b[_0x72b5('0x34')],_0x28348e[_0x72b5('0x36')]),_0x427508);if(_0x49b45b[_0x72b5('0x34')]['filter']){_0x4ebb8c['where']=_[_0x72b5('0x40')](_0x4ebb8c[_0x72b5('0x3e')],{'$or':_[_0x72b5('0x33')](_0x427508,function(_0x45e08d){if(_0x45e08d['type']!==_0x72b5('0x41')){var _0xa822f6={};_0xa822f6[_0x45e08d['name']]={'$like':'%'+_0x49b45b[_0x72b5('0x34')][_0x72b5('0x42')]+'%'};return _0xa822f6;}})});}_0x4ebb8c=_[_0x72b5('0x40')]({},_0x4ebb8c,_0x49b45b['options']);var _0x19ccbc={'where':_0x4ebb8c['where']};return db['VoiceMailMessage']['count'](_0x19ccbc)[_0x72b5('0x29')](function(_0xffa68d){_0x3ea8f3[_0x72b5('0x22')]=_0xffa68d;if(_0x49b45b[_0x72b5('0x34')]['includeAll']){_0x4ebb8c[_0x72b5('0x43')]=[{'all':!![]}];}return db[_0x72b5('0x2e')][_0x72b5('0x44')](_0x4ebb8c);})['then'](function(_0xa4353c){_0x3ea8f3[_0x72b5('0x45')]=_0xa4353c;return _0x3ea8f3;})[_0x72b5('0x29')](respondWithFilteredResult(_0x3f0891,_0x4ebb8c))[_0x72b5('0x46')](handleError(_0x3f0891,null));};exports[_0x72b5('0x47')]=function(_0x50e184,_0x11f0ff){var _0x26b5ae={'raw':!![],'where':{'id':_0x50e184[_0x72b5('0x48')]['id']}},_0x6c49af={};_0x6c49af[_0x72b5('0x31')]=_[_0x72b5('0x35')](db[_0x72b5('0x2e')][_0x72b5('0x2f')]);_0x6c49af[_0x72b5('0x34')]=_[_0x72b5('0x35')](_0x50e184['query']);_0x6c49af[_0x72b5('0x36')]=_['intersection'](_0x6c49af['model'],_0x6c49af[_0x72b5('0x34')]);_0x26b5ae['attributes']=_[_0x72b5('0x37')](_0x6c49af[_0x72b5('0x31')],qs['fields'](_0x50e184['query'][_0x72b5('0x38')]));_0x26b5ae[_0x72b5('0x39')]=_0x26b5ae[_0x72b5('0x39')][_0x72b5('0x3a')]?_0x26b5ae['attributes']:_0x6c49af['model'];if(_0x50e184[_0x72b5('0x34')][_0x72b5('0x49')]){_0x26b5ae[_0x72b5('0x43')]=[{'all':!![]}];}_0x26b5ae=_['merge']({},_0x26b5ae,_0x50e184[_0x72b5('0x4a')]);return db[_0x72b5('0x2e')][_0x72b5('0x4b')](_0x26b5ae)[_0x72b5('0x29')](handleEntityNotFound(_0x11f0ff,null))[_0x72b5('0x29')](respondWithResult(_0x11f0ff,null))[_0x72b5('0x46')](handleError(_0x11f0ff,null));};exports['create']=function(_0x2f3541,_0x43dd33){return db[_0x72b5('0x2e')][_0x72b5('0x4c')](_0x2f3541[_0x72b5('0x4d')],{})[_0x72b5('0x29')](respondWithResult(_0x43dd33,0xc9))['catch'](handleError(_0x43dd33,null));};exports[_0x72b5('0x4e')]=function(_0x16b4c8,_0x46b502){if(_0x16b4c8[_0x72b5('0x4d')]['id']){delete _0x16b4c8[_0x72b5('0x4d')]['id'];}return db['VoiceMailMessage'][_0x72b5('0x4b')]({'where':{'id':_0x16b4c8[_0x72b5('0x48')]['id']}})[_0x72b5('0x29')](handleEntityNotFound(_0x46b502,null))[_0x72b5('0x29')](saveUpdates(_0x16b4c8[_0x72b5('0x4d')],null))['then'](respondWithResult(_0x46b502,null))[_0x72b5('0x46')](handleError(_0x46b502,null));};exports[_0x72b5('0x2a')]=function(_0x2eee31,_0x404bf2){return db[_0x72b5('0x2e')][_0x72b5('0x4b')]({'where':{'id':_0x2eee31[_0x72b5('0x48')]['id']}})[_0x72b5('0x29')](handleEntityNotFound(_0x404bf2,null))[_0x72b5('0x29')](removeEntity(_0x404bf2,null))[_0x72b5('0x46')](handleError(_0x404bf2,null));};exports[_0x72b5('0x4f')]=function(_0x10fa6a,_0x555a39,_0x2b6ed8){return db['VoiceMailMessage'][_0x72b5('0x4b')]({'where':{'id':_0x10fa6a[_0x72b5('0x48')]['id']},'attributes':['id',_0x72b5('0x50'),_0x72b5('0x51')]})[_0x72b5('0x29')](handleEntityNotFound(_0x555a39,null))['then'](function(_0xaf5d68){if(_0xaf5d68){if(!_0xaf5d68[_0x72b5('0x50')]){throw new db['Sequelize']['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x18f7ce={'Content-Type':'audio/wav','Content-Disposition':_0x72b5('0x52')};if(_0xaf5d68[_0x72b5('0x51')]){_0x18f7ce[_0x72b5('0x53')]=_0x72b5('0x54')+_0xaf5d68[_0x72b5('0x51')]+_0x72b5('0x55');}_0x555a39[_0x72b5('0x24')](_0x18f7ce);return _0x555a39[_0x72b5('0x2c')](new Buffer(_0xaf5d68['recording']));}})['catch'](handleError(_0x555a39,null));}; \ No newline at end of file +var _0xc210=['findAll','show','find','catch','create','body','params','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','model','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x2ec72e,_0x27382e){var _0x1359ab=function(_0xf45abe){while(--_0xf45abe){_0x2ec72e['push'](_0x2ec72e['shift']());}};_0x1359ab(++_0x27382e);}(_0xc210,0x115));var _0x0c21=function(_0x197fde,_0x175d73){_0x197fde=_0x197fde-0x0;var _0x4fe854=_0xc210[_0x197fde];return _0x4fe854;};'use strict';var emlformat=require(_0x0c21('0x0'));var rimraf=require(_0x0c21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c21('0x2'));var rp=require(_0x0c21('0x3'));var moment=require(_0x0c21('0x4'));var BPromise=require(_0x0c21('0x5'));var Mustache=require(_0x0c21('0x6'));var util=require(_0x0c21('0x7'));var path=require('path');var sox=require(_0x0c21('0x8'));var csv=require(_0x0c21('0x9'));var ejs=require(_0x0c21('0xa'));var fs=require('fs');var fs_extra=require(_0x0c21('0xb'));var _=require(_0x0c21('0xc'));var squel=require(_0x0c21('0xd'));var crypto=require(_0x0c21('0xe'));var jsforce=require(_0x0c21('0xf'));var deskjs=require(_0x0c21('0x10'));var toCsv=require(_0x0c21('0x9'));var querystring=require(_0x0c21('0x11'));var Papa=require('papaparse');var Redis=require(_0x0c21('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0c21('0x13'));var hardwareService=require(_0x0c21('0x14'));var logger=require(_0x0c21('0x15'))(_0x0c21('0x16'));var utils=require(_0x0c21('0x17'));var config=require(_0x0c21('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c21('0x19'))['db'];function respondWithStatusCode(_0x386534,_0x40a45b){_0x40a45b=_0x40a45b||0xcc;return function(_0x4b9401){if(_0x4b9401){return _0x386534[_0x0c21('0x1a')](_0x40a45b);}return _0x386534[_0x0c21('0x1b')](_0x40a45b)[_0x0c21('0x1c')]();};}function respondWithResult(_0x56e1b8,_0x2ddf9e){_0x2ddf9e=_0x2ddf9e||0xc8;return function(_0x201a81){if(_0x201a81){return _0x56e1b8[_0x0c21('0x1b')](_0x2ddf9e)[_0x0c21('0x1d')](_0x201a81);}};}function respondWithFilteredResult(_0x26ec44,_0x761a0e){return function(_0x2bf67e){if(_0x2bf67e){var _0x586691=typeof _0x761a0e[_0x0c21('0x1e')]==='undefined'&&typeof _0x761a0e[_0x0c21('0x1f')]===_0x0c21('0x20');var _0x93eb4=_0x2bf67e['count'];var _0x2c3b05=_0x586691?0x0:_0x761a0e[_0x0c21('0x1e')];var _0x177acd=_0x586691?_0x2bf67e[_0x0c21('0x21')]:_0x761a0e[_0x0c21('0x1e')]+_0x761a0e[_0x0c21('0x1f')];var _0x440810;if(_0x177acd>=_0x93eb4){_0x177acd=_0x93eb4;_0x440810=0xc8;}else{_0x440810=0xce;}_0x26ec44[_0x0c21('0x1b')](_0x440810);return _0x26ec44[_0x0c21('0x22')](_0x0c21('0x23'),_0x2c3b05+'-'+_0x177acd+'/'+_0x93eb4)[_0x0c21('0x1d')](_0x2bf67e);}return null;};}function patchUpdates(_0x1b073e){return function(_0x5d96f2){try{jsonpatch[_0x0c21('0x24')](_0x5d96f2,_0x1b073e,!![]);}catch(_0x3a3d0a){return BPromise['reject'](_0x3a3d0a);}return _0x5d96f2['save']();};}function saveUpdates(_0x240900,_0x2260bb){return function(_0x3b989f){if(_0x3b989f){return _0x3b989f[_0x0c21('0x25')](_0x240900)[_0x0c21('0x26')](function(_0x163254){return _0x163254;});}return null;};}function removeEntity(_0xa66aa4,_0x3b5fbd){return function(_0x3bca90){if(_0x3bca90){return _0x3bca90[_0x0c21('0x27')]()[_0x0c21('0x26')](function(){_0xa66aa4[_0x0c21('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa6565f,_0x39ba45){return function(_0x104767){if(!_0x104767){_0xa6565f[_0x0c21('0x1a')](0x194);}return _0x104767;};}function handleError(_0x24a389,_0x3cf006){_0x3cf006=_0x3cf006||0x1f4;return function(_0x2199ca){logger[_0x0c21('0x28')](_0x2199ca[_0x0c21('0x29')]);if(_0x2199ca[_0x0c21('0x2a')]){delete _0x2199ca[_0x0c21('0x2a')];}_0x24a389[_0x0c21('0x1b')](_0x3cf006)[_0x0c21('0x2b')](_0x2199ca);};}exports[_0x0c21('0x2c')]=function(_0x282d97,_0x3a6a52){var _0x1ee1aa={},_0x5454c4={},_0x1cdec1={'count':0x0,'rows':[]};var _0x58f33e=_[_0x0c21('0x2d')](db[_0x0c21('0x2e')][_0x0c21('0x2f')],function(_0x53fd2b){return{'name':_0x53fd2b[_0x0c21('0x30')],'type':_0x53fd2b['type']['key']};});_0x5454c4[_0x0c21('0x31')]=_[_0x0c21('0x32')](_[_0x0c21('0x2d')](_0x58f33e,_0x0c21('0x2a')),['name']);_0x5454c4[_0x0c21('0x33')]=_[_0x0c21('0x34')](_0x282d97['query']);_0x5454c4['filters']=_[_0x0c21('0x35')](_0x5454c4[_0x0c21('0x31')],_0x5454c4['query']);_0x1ee1aa[_0x0c21('0x36')]=_[_0x0c21('0x35')](_0x5454c4[_0x0c21('0x31')],qs['fields'](_0x282d97[_0x0c21('0x33')][_0x0c21('0x37')]));_0x1ee1aa['attributes']=_0x1ee1aa[_0x0c21('0x36')][_0x0c21('0x38')]?_0x1ee1aa['attributes']:_0x5454c4[_0x0c21('0x31')];if(!_0x282d97[_0x0c21('0x33')][_0x0c21('0x39')](_0x0c21('0x3a'))){_0x1ee1aa[_0x0c21('0x1f')]=qs[_0x0c21('0x1f')](_0x282d97['query']['limit']);_0x1ee1aa[_0x0c21('0x1e')]=qs['offset'](_0x282d97[_0x0c21('0x33')][_0x0c21('0x1e')]);}_0x1ee1aa[_0x0c21('0x3b')]=qs[_0x0c21('0x3c')](_0x282d97[_0x0c21('0x33')][_0x0c21('0x3c')]);_0x1ee1aa[_0x0c21('0x3d')]=qs['filters'](_[_0x0c21('0x3e')](_0x282d97[_0x0c21('0x33')],_0x5454c4[_0x0c21('0x3f')]),_0x58f33e);if(_0x282d97[_0x0c21('0x33')][_0x0c21('0x40')]){_0x1ee1aa[_0x0c21('0x3d')]=_[_0x0c21('0x41')](_0x1ee1aa[_0x0c21('0x3d')],{'$or':_[_0x0c21('0x2d')](_0x58f33e,function(_0xd0727e){if(_0xd0727e[_0x0c21('0x42')]!==_0x0c21('0x43')){var _0xc738d4={};_0xc738d4[_0xd0727e[_0x0c21('0x2a')]]={'$like':'%'+_0x282d97[_0x0c21('0x33')]['filter']+'%'};return _0xc738d4;}})});}_0x1ee1aa=_[_0x0c21('0x41')]({},_0x1ee1aa,_0x282d97[_0x0c21('0x44')]);var _0x114c3b={'where':_0x1ee1aa[_0x0c21('0x3d')]};return db[_0x0c21('0x2e')][_0x0c21('0x21')](_0x114c3b)[_0x0c21('0x26')](function(_0x3e655d){_0x1cdec1[_0x0c21('0x21')]=_0x3e655d;if(_0x282d97['query'][_0x0c21('0x45')]){_0x1ee1aa[_0x0c21('0x46')]=[{'all':!![]}];}return db[_0x0c21('0x2e')][_0x0c21('0x47')](_0x1ee1aa);})[_0x0c21('0x26')](function(_0x40f5a8){_0x1cdec1['rows']=_0x40f5a8;return _0x1cdec1;})[_0x0c21('0x26')](respondWithFilteredResult(_0x3a6a52,_0x1ee1aa))['catch'](handleError(_0x3a6a52,null));};exports[_0x0c21('0x48')]=function(_0x48321d,_0x210168){var _0x4ee219={'raw':!![],'where':{'id':_0x48321d['params']['id']}},_0x3a3806={};_0x3a3806[_0x0c21('0x31')]=_[_0x0c21('0x34')](db[_0x0c21('0x2e')][_0x0c21('0x2f')]);_0x3a3806['query']=_['keys'](_0x48321d[_0x0c21('0x33')]);_0x3a3806['filters']=_[_0x0c21('0x35')](_0x3a3806['model'],_0x3a3806[_0x0c21('0x33')]);_0x4ee219[_0x0c21('0x36')]=_[_0x0c21('0x35')](_0x3a3806[_0x0c21('0x31')],qs[_0x0c21('0x37')](_0x48321d[_0x0c21('0x33')]['fields']));_0x4ee219[_0x0c21('0x36')]=_0x4ee219[_0x0c21('0x36')][_0x0c21('0x38')]?_0x4ee219[_0x0c21('0x36')]:_0x3a3806[_0x0c21('0x31')];if(_0x48321d['query'][_0x0c21('0x45')]){_0x4ee219[_0x0c21('0x46')]=[{'all':!![]}];}_0x4ee219=_[_0x0c21('0x41')]({},_0x4ee219,_0x48321d[_0x0c21('0x44')]);return db['VoiceMailMessage'][_0x0c21('0x49')](_0x4ee219)[_0x0c21('0x26')](handleEntityNotFound(_0x210168,null))['then'](respondWithResult(_0x210168,null))[_0x0c21('0x4a')](handleError(_0x210168,null));};exports[_0x0c21('0x4b')]=function(_0x5b6851,_0x3d2095){return db[_0x0c21('0x2e')]['create'](_0x5b6851[_0x0c21('0x4c')],{})[_0x0c21('0x26')](respondWithResult(_0x3d2095,0xc9))[_0x0c21('0x4a')](handleError(_0x3d2095,null));};exports[_0x0c21('0x25')]=function(_0x135b6e,_0x147bec){if(_0x135b6e[_0x0c21('0x4c')]['id']){delete _0x135b6e[_0x0c21('0x4c')]['id'];}return db[_0x0c21('0x2e')]['find']({'where':{'id':_0x135b6e[_0x0c21('0x4d')]['id']}})[_0x0c21('0x26')](handleEntityNotFound(_0x147bec,null))[_0x0c21('0x26')](saveUpdates(_0x135b6e[_0x0c21('0x4c')],null))[_0x0c21('0x26')](respondWithResult(_0x147bec,null))[_0x0c21('0x4a')](handleError(_0x147bec,null));};exports[_0x0c21('0x27')]=function(_0x3697fc,_0x4ac29d){return db[_0x0c21('0x2e')][_0x0c21('0x49')]({'where':{'id':_0x3697fc['params']['id']}})[_0x0c21('0x26')](handleEntityNotFound(_0x4ac29d,null))[_0x0c21('0x26')](removeEntity(_0x4ac29d,null))[_0x0c21('0x4a')](handleError(_0x4ac29d,null));};exports[_0x0c21('0x4e')]=function(_0x2d8f17,_0x555d9b,_0x55926d){return db[_0x0c21('0x2e')][_0x0c21('0x49')]({'where':{'id':_0x2d8f17[_0x0c21('0x4d')]['id']},'attributes':['id',_0x0c21('0x4f'),_0x0c21('0x50')]})[_0x0c21('0x26')](handleEntityNotFound(_0x555d9b,null))[_0x0c21('0x26')](function(_0x10c53a){if(_0x10c53a){if(!_0x10c53a[_0x0c21('0x4f')]){throw new db[(_0x0c21('0x51'))]['ValidationError'](_0x0c21('0x52'));}var _0x2ec826={'Content-Type':_0x0c21('0x53'),'Content-Disposition':'attachment'};if(_0x10c53a['msg_id']){_0x2ec826[_0x0c21('0x54')]=_0x0c21('0x55')+_0x10c53a['msg_id']+_0x0c21('0x56');}_0x555d9b[_0x0c21('0x22')](_0x2ec826);return _0x555d9b['send'](new Buffer(_0x10c53a[_0x0c21('0x4f')]));}})[_0x0c21('0x4a')](handleError(_0x555d9b,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 65b75df..43e00f6 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 _0x8dfd=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','moment'];(function(_0x9d1ef6,_0xa59b70){var _0x14bde5=function(_0x29b9cc){while(--_0x29b9cc){_0x9d1ef6['push'](_0x9d1ef6['shift']());}};_0x14bde5(++_0xa59b70);}(_0x8dfd,0x173));var _0xd8df=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0x8dfd[_0x3efe87];return _0x56a4cc;};'use strict';var _=require('lodash');var util=require(_0xd8df('0x0'));var logger=require(_0xd8df('0x1'))(_0xd8df('0x2'));var moment=require(_0xd8df('0x3'));var BPromise=require(_0xd8df('0x4'));var rp=require(_0xd8df('0x5'));var fs=require('fs');var path=require(_0xd8df('0x6'));var rimraf=require(_0xd8df('0x7'));var config=require(_0xd8df('0x8'));var attributes=require(_0xd8df('0x9'));module[_0xd8df('0xa')]=function(_0x3cdffe,_0x27be3d){return _0x3cdffe[_0xd8df('0xb')](_0xd8df('0xc'),attributes,{'tableName':_0xd8df('0xd'),'paranoid':![],'indexes':[{'name':_0xd8df('0xe'),'fields':[_0xd8df('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4a3e=['bluebird','request-promise','path','rimraf','exports','voice_voicemail_messages','dir','lodash','../../config/logger','api'];(function(_0x529ca2,_0x2d80c0){var _0x144360=function(_0x2e1d85){while(--_0x2e1d85){_0x529ca2['push'](_0x529ca2['shift']());}};_0x144360(++_0x2d80c0);}(_0x4a3e,0x1d3));var _0xe4a3=function(_0x2e572f,_0x2b1deb){_0x2e572f=_0x2e572f-0x0;var _0x54c897=_0x4a3e[_0x2e572f];return _0x54c897;};'use strict';var _=require(_0xe4a3('0x0'));var util=require('util');var logger=require(_0xe4a3('0x1'))(_0xe4a3('0x2'));var moment=require('moment');var BPromise=require(_0xe4a3('0x3'));var rp=require(_0xe4a3('0x4'));var fs=require('fs');var path=require(_0xe4a3('0x5'));var rimraf=require(_0xe4a3('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0xe4a3('0x7')]=function(_0x2cd406,_0x47ab74){return _0x2cd406['define']('VoiceMailMessage',attributes,{'tableName':_0xe4a3('0x8'),'paranoid':![],'indexes':[{'name':_0xe4a3('0x9'),'fields':[_0xe4a3('0x9')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 201d860..526aac1 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 _0x48cf=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x530df6,_0x5ed223){var _0x18387c=function(_0x30b5a0){while(--_0x30b5a0){_0x530df6['push'](_0x530df6['shift']());}};_0x18387c(++_0x5ed223);}(_0x48cf,0x6c));var _0xf48c=function(_0x403a08,_0x1358ad){_0x403a08=_0x403a08-0x0;var _0x5614e8=_0x48cf[_0x403a08];return _0x5614e8;};'use strict';var _=require(_0xf48c('0x0'));var util=require(_0xf48c('0x1'));var moment=require(_0xf48c('0x2'));var BPromise=require(_0xf48c('0x3'));var rs=require(_0xf48c('0x4'));var fs=require('fs');var Redis=require(_0xf48c('0x5'));var db=require(_0xf48c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf48c('0x7'))(_0xf48c('0x8'));var config=require(_0xf48c('0x9'));var jayson=require(_0xf48c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d1d9d,_0x396427,_0x1b18e5){return new BPromise(function(_0xa0be74,_0x33f183){return client[_0xf48c('0xb')](_0x1d1d9d,_0x1b18e5)[_0xf48c('0xc')](function(_0x3e7b68){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x396427,_0xf48c('0xd'));logger[_0xf48c('0xe')](_0xf48c('0xf'),_0x396427,_0xf48c('0xd'),JSON['stringify'](_0x3e7b68));if(_0x3e7b68[_0xf48c('0x10')]){if(_0x3e7b68[_0xf48c('0x10')][_0xf48c('0x11')]===0x1f4){logger['error'](_0xf48c('0x12'),_0x396427,_0x3e7b68[_0xf48c('0x10')][_0xf48c('0x13')]);return _0x33f183(_0x3e7b68[_0xf48c('0x10')][_0xf48c('0x13')]);}logger[_0xf48c('0x10')](_0xf48c('0x12'),_0x396427,_0x3e7b68[_0xf48c('0x10')][_0xf48c('0x13')]);return _0xa0be74(_0x3e7b68['error'][_0xf48c('0x13')]);}else{logger[_0xf48c('0x14')](_0xf48c('0x12'),_0x396427,_0xf48c('0xd'));_0xa0be74(_0x3e7b68[_0xf48c('0x15')][_0xf48c('0x13')]);}})[_0xf48c('0x16')](function(_0x341969){logger[_0xf48c('0x10')](_0xf48c('0x12'),_0x396427,_0x341969);_0x33f183(_0x341969);});});} \ No newline at end of file +var _0x6f5a=['request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3ba422,_0x53303c){var _0x20b5dd=function(_0x10b8a7){while(--_0x10b8a7){_0x3ba422['push'](_0x3ba422['shift']());}};_0x20b5dd(++_0x53303c);}(_0x6f5a,0x1d9));var _0xa6f5=function(_0x106f08,_0x4cdee2){_0x106f08=_0x106f08-0x0;var _0x2b2d23=_0x6f5a[_0x106f08];return _0x2b2d23;};'use strict';var _=require('lodash');var util=require(_0xa6f5('0x0'));var moment=require(_0xa6f5('0x1'));var BPromise=require('bluebird');var rs=require(_0xa6f5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6f5('0x3'))['db'];var utils=require(_0xa6f5('0x4'));var logger=require(_0xa6f5('0x5'))(_0xa6f5('0x6'));var config=require(_0xa6f5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa6f5('0x8')][_0xa6f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503639,_0x3a2037,_0x3d7660){return new BPromise(function(_0x5bdb91,_0x8c6752){return client[_0xa6f5('0xa')](_0x503639,_0x3d7660)[_0xa6f5('0xb')](function(_0x2b0345){logger[_0xa6f5('0xc')](_0xa6f5('0xd'),_0x3a2037,_0xa6f5('0xe'));logger[_0xa6f5('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x3a2037,_0xa6f5('0xe'),JSON[_0xa6f5('0x10')](_0x2b0345));if(_0x2b0345[_0xa6f5('0x11')]){if(_0x2b0345['error']['code']===0x1f4){logger['error'](_0xa6f5('0xd'),_0x3a2037,_0x2b0345['error'][_0xa6f5('0x12')]);return _0x8c6752(_0x2b0345[_0xa6f5('0x11')][_0xa6f5('0x12')]);}logger[_0xa6f5('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x3a2037,_0x2b0345[_0xa6f5('0x11')][_0xa6f5('0x12')]);return _0x5bdb91(_0x2b0345[_0xa6f5('0x11')][_0xa6f5('0x12')]);}else{logger[_0xa6f5('0xc')](_0xa6f5('0xd'),_0x3a2037,'request\x20sent');_0x5bdb91(_0x2b0345[_0xa6f5('0x13')][_0xa6f5('0x12')]);}})[_0xa6f5('0x14')](function(_0x2cd06f){logger[_0xa6f5('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x3a2037,_0x2cd06f);_0x8c6752(_0x2cd06f);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index c6a5765..1c379e6 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 _0x17ab=['get','/:id','show','create','post','/:id/sounds','put','update','delete','destroy','removeSound','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index'];(function(_0x545dab,_0x2a495c){var _0xc43448=function(_0x324662){while(--_0x324662){_0x545dab['push'](_0x545dab['shift']());}};_0xc43448(++_0x2a495c);}(_0x17ab,0x7a));var _0xb17a=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0x17ab[_0x350343];return _0x9afc1c;};'use strict';var multer=require('multer');var util=require(_0xb17a('0x0'));var path=require(_0xb17a('0x1'));var timeout=require(_0xb17a('0x2'));var express=require(_0xb17a('0x3'));var router=express[_0xb17a('0x4')]();var fs_extra=require(_0xb17a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb17a('0x6'));var controller=require(_0xb17a('0x7'));router['get']('/',auth[_0xb17a('0x8')](),controller[_0xb17a('0x9')]);router[_0xb17a('0xa')](_0xb17a('0xb'),auth['isAuthenticated'](),controller[_0xb17a('0xc')]);router['get']('/:id/sounds',auth[_0xb17a('0x8')](),controller['getSounds']);router['post']('/',auth[_0xb17a('0x8')](),controller[_0xb17a('0xd')]);router[_0xb17a('0xe')](_0xb17a('0xf'),auth[_0xb17a('0x8')](),controller['addSound']);router[_0xb17a('0x10')](_0xb17a('0xb'),auth['isAuthenticated'](),controller[_0xb17a('0x11')]);router[_0xb17a('0x12')](_0xb17a('0xb'),auth[_0xb17a('0x8')](),controller[_0xb17a('0x13')]);router[_0xb17a('0x12')]('/:id/sounds/:id2',auth[_0xb17a('0x8')](),controller[_0xb17a('0x14')]);module[_0xb17a('0x15')]=router; \ No newline at end of file +var _0x3ea5=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','get','/:id/sounds','getSounds','post','create','addSound','/:id','update','delete','destroy','/:id/sounds/:id2','exports','multer','util'];(function(_0x117aa8,_0x22c76c){var _0x236368=function(_0x4a0651){while(--_0x4a0651){_0x117aa8['push'](_0x117aa8['shift']());}};_0x236368(++_0x22c76c);}(_0x3ea5,0xee));var _0x53ea=function(_0x265e9b,_0x36baf7){_0x265e9b=_0x265e9b-0x0;var _0x4e4e30=_0x3ea5[_0x265e9b];return _0x4e4e30;};'use strict';var multer=require(_0x53ea('0x0'));var util=require(_0x53ea('0x1'));var path=require(_0x53ea('0x2'));var timeout=require(_0x53ea('0x3'));var express=require(_0x53ea('0x4'));var router=express[_0x53ea('0x5')]();var fs_extra=require(_0x53ea('0x6'));var auth=require(_0x53ea('0x7'));var interaction=require(_0x53ea('0x8'));var config=require(_0x53ea('0x9'));var controller=require(_0x53ea('0xa'));router['get']('/',auth[_0x53ea('0xb')](),controller['index']);router[_0x53ea('0xc')]('/:id',auth[_0x53ea('0xb')](),controller['show']);router['get'](_0x53ea('0xd'),auth['isAuthenticated'](),controller[_0x53ea('0xe')]);router[_0x53ea('0xf')]('/',auth[_0x53ea('0xb')](),controller[_0x53ea('0x10')]);router['post'](_0x53ea('0xd'),auth['isAuthenticated'](),controller[_0x53ea('0x11')]);router['put'](_0x53ea('0x12'),auth[_0x53ea('0xb')](),controller[_0x53ea('0x13')]);router[_0x53ea('0x14')](_0x53ea('0x12'),auth[_0x53ea('0xb')](),controller[_0x53ea('0x15')]);router[_0x53ea('0x14')](_0x53ea('0x16'),auth[_0x53ea('0xb')](),controller['removeSound']);module[_0x53ea('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index eb5ef15..ce82378 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 _0x69af=['TIMESTAMP','BOOLEAN','sequelize','STRING','ENUM','custom','files','quietmp3nb','quietmp3','alpha'];(function(_0x4c4279,_0x584df9){var _0x999641=function(_0x803378){while(--_0x803378){_0x4c4279['push'](_0x4c4279['shift']());}};_0x999641(++_0x584df9);}(_0x69af,0x1d8));var _0xf69a=function(_0x22767b,_0x2f7487){_0x22767b=_0x22767b-0x0;var _0x16aaf1=_0x69af[_0x22767b];return _0x16aaf1;};'use strict';var Sequelize=require(_0xf69a('0x0'));module['exports']={'name':{'type':Sequelize[_0xf69a('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xf69a('0x2')](_0xf69a('0x3'),_0xf69a('0x4'),'mp3nb',_0xf69a('0x5'),_0xf69a('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0xf69a('0x4')},'directory':{'type':Sequelize[_0xf69a('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xf69a('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xf69a('0x1')],'allowNull':!![],'defaultValue':_0xf69a('0x7')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xf69a('0x8')},'defaultEntry':{'type':Sequelize[_0xf69a('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7540=['files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','name','ENUM','custom'];(function(_0x41dd3a,_0x58afdc){var _0x1da368=function(_0x45bf4e){while(--_0x45bf4e){_0x41dd3a['push'](_0x41dd3a['shift']());}};_0x1da368(++_0x58afdc);}(_0x7540,0x1f3));var _0x0754=function(_0x12e6e5,_0x39855b){_0x12e6e5=_0x12e6e5-0x0;var _0x4ef6ce=_0x7540[_0x12e6e5];return _0x4ef6ce;};'use strict';var Sequelize=require('sequelize');module[_0x0754('0x0')]={'name':{'type':Sequelize[_0x0754('0x1')],'allowNull':![],'unique':_0x0754('0x2')},'mode':{'type':Sequelize[_0x0754('0x3')](_0x0754('0x4'),_0x0754('0x5'),'mp3nb',_0x0754('0x6'),_0x0754('0x7'),_0x0754('0x8')),'allowNull':!![],'defaultValue':_0x0754('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x0754('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x0754('0x1')],'allowNull':!![],'defaultValue':_0x0754('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x0754('0xa')},'defaultEntry':{'type':Sequelize[_0x0754('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 33b383e..7cf7104 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 _0xd618=['ValidationError','message','addSound','Sound','findOne','server/files/sounds/converted','format','%s.%s','extname','converted_format','symlinkSync','Sequelize','removeSound','id2','save_name','unlinkSync','getSounds','order','pick','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','get','MusicOnHolds','end','sendStatus','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','body','sequelize','transaction','mode','root','server/files/moh','create','files','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','join'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd618,0x169));var _0x8d61=function(_0x1316e9,_0x12c114){_0x1316e9=_0x1316e9-0x0;var _0x8ad23d=_0xd618[_0x1316e9];return _0x8ad23d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d61('0x0'));var zipdir=require(_0x8d61('0x1'));var jsonpatch=require(_0x8d61('0x2'));var rp=require(_0x8d61('0x3'));var moment=require(_0x8d61('0x4'));var BPromise=require(_0x8d61('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8d61('0x6'));var csv=require('to-csv');var ejs=require(_0x8d61('0x7'));var fs=require('fs');var fs_extra=require(_0x8d61('0x8'));var _=require('lodash');var squel=require(_0x8d61('0x9'));var crypto=require(_0x8d61('0xa'));var jsforce=require(_0x8d61('0xb'));var deskjs=require(_0x8d61('0xc'));var toCsv=require(_0x8d61('0xd'));var querystring=require(_0x8d61('0xe'));var Papa=require(_0x8d61('0xf'));var Redis=require(_0x8d61('0x10'));var authService=require(_0x8d61('0x11'));var qs=require(_0x8d61('0x12'));var as=require(_0x8d61('0x13'));var hardwareService=require(_0x8d61('0x14'));var logger=require(_0x8d61('0x15'))(_0x8d61('0x16'));var utils=require(_0x8d61('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8d61('0x18'));var db=require(_0x8d61('0x19'))['db'];function respondWithStatusCode(_0x2748c8,_0x103927){_0x103927=_0x103927||0xcc;return function(_0x26d10d){if(_0x26d10d){return _0x2748c8['sendStatus'](_0x103927);}return _0x2748c8[_0x8d61('0x1a')](_0x103927)['end']();};}function respondWithResult(_0x1b4e01,_0x6d25c6){_0x6d25c6=_0x6d25c6||0xc8;return function(_0x6c3e7a){if(_0x6c3e7a){return _0x1b4e01[_0x8d61('0x1a')](_0x6d25c6)['json'](_0x6c3e7a);}};}function respondWithFilteredResult(_0xf52dc6,_0x8a2f82){return function(_0x147dff){if(_0x147dff){var _0x2ccdd7=typeof _0x8a2f82[_0x8d61('0x1b')]===_0x8d61('0x1c')&&typeof _0x8a2f82['limit']===_0x8d61('0x1c');var _0x40d651=_0x147dff[_0x8d61('0x1d')];var _0x38cfcc=_0x2ccdd7?0x0:_0x8a2f82[_0x8d61('0x1b')];var _0x2f9d41=_0x2ccdd7?_0x147dff[_0x8d61('0x1d')]:_0x8a2f82[_0x8d61('0x1b')]+_0x8a2f82[_0x8d61('0x1e')];var _0x2082ce;if(_0x2f9d41>=_0x40d651){_0x2f9d41=_0x40d651;_0x2082ce=0xc8;}else{_0x2082ce=0xce;}_0xf52dc6[_0x8d61('0x1a')](_0x2082ce);return _0xf52dc6[_0x8d61('0x1f')]('Content-Range',_0x38cfcc+'-'+_0x2f9d41+'/'+_0x40d651)[_0x8d61('0x20')](_0x147dff);}return null;};}function patchUpdates(_0x2188f5){return function(_0x5a54e2){try{jsonpatch[_0x8d61('0x21')](_0x5a54e2,_0x2188f5,!![]);}catch(_0x3480e9){return BPromise[_0x8d61('0x22')](_0x3480e9);}return _0x5a54e2[_0x8d61('0x23')]();};}function saveUpdates(_0x1512c4,_0x2e1e06){return function(_0xc01818){if(_0xc01818){return _0xc01818[_0x8d61('0x24')](_0x1512c4)[_0x8d61('0x25')](function(_0x31be90){return _0x31be90;});}return null;};}function removeEntity(_0xbe96a7,_0x5c4b5b){return function(_0x303036){if(_0x303036){return _0x303036[_0x8d61('0x26')]()[_0x8d61('0x25')](function(){var _0x24ebb6=_0x303036[_0x8d61('0x27')]({'plain':!![]});var _0xf0f75a=_0x8d61('0x28');return db['UserProfileResource'][_0x8d61('0x26')]({'where':{'type':_0xf0f75a,'resourceId':_0x24ebb6['id']}})['then'](function(){return _0x303036;});})[_0x8d61('0x25')](function(){_0xbe96a7[_0x8d61('0x1a')](0xcc)[_0x8d61('0x29')]();});}};}function handleEntityNotFound(_0x549929,_0x54a7b9){return function(_0x47c4bc){if(!_0x47c4bc){_0x549929[_0x8d61('0x2a')](0x194);}return _0x47c4bc;};}function handleError(_0x5a3e6f,_0x337e33){_0x337e33=_0x337e33||0x1f4;return function(_0x197bd4){logger[_0x8d61('0x2b')](_0x197bd4['stack']);if(_0x197bd4[_0x8d61('0x2c')]){delete _0x197bd4[_0x8d61('0x2c')];}_0x5a3e6f[_0x8d61('0x1a')](_0x337e33)[_0x8d61('0x2d')](_0x197bd4);};}exports[_0x8d61('0x2e')]=function(_0x344050,_0x2718d6){var _0x5d54ec={},_0x1a0850={},_0x5a93c4={'count':0x0,'rows':[]};var _0x2463e3=_[_0x8d61('0x2f')](db[_0x8d61('0x30')][_0x8d61('0x31')],function(_0x1ca48d){return{'name':_0x1ca48d['fieldName'],'type':_0x1ca48d['type'][_0x8d61('0x32')]};});_0x1a0850[_0x8d61('0x33')]=_[_0x8d61('0x2f')](_0x2463e3,_0x8d61('0x2c'));_0x1a0850[_0x8d61('0x34')]=_[_0x8d61('0x35')](_0x344050['query']);_0x1a0850[_0x8d61('0x36')]=_[_0x8d61('0x37')](_0x1a0850[_0x8d61('0x33')],_0x1a0850['query']);_0x5d54ec[_0x8d61('0x38')]=_[_0x8d61('0x37')](_0x1a0850[_0x8d61('0x33')],qs[_0x8d61('0x39')](_0x344050[_0x8d61('0x34')][_0x8d61('0x39')]));_0x5d54ec[_0x8d61('0x38')]=_0x5d54ec[_0x8d61('0x38')][_0x8d61('0x3a')]?_0x5d54ec[_0x8d61('0x38')]:_0x1a0850[_0x8d61('0x33')];if(!_0x344050[_0x8d61('0x34')][_0x8d61('0x3b')](_0x8d61('0x3c'))){_0x5d54ec[_0x8d61('0x1e')]=qs[_0x8d61('0x1e')](_0x344050[_0x8d61('0x34')][_0x8d61('0x1e')]);_0x5d54ec[_0x8d61('0x1b')]=qs[_0x8d61('0x1b')](_0x344050[_0x8d61('0x34')][_0x8d61('0x1b')]);}_0x5d54ec['order']=qs[_0x8d61('0x3d')](_0x344050[_0x8d61('0x34')]['sort']);delete _0x344050[_0x8d61('0x34')][_0x8d61('0x3d')];_0x5d54ec['where']=qs['filters'](_['pick'](_0x344050['query'],_0x1a0850[_0x8d61('0x36')]),_0x2463e3);if(_0x344050[_0x8d61('0x34')][_0x8d61('0x3e')]){_0x5d54ec[_0x8d61('0x3f')]=_[_0x8d61('0x40')](_0x5d54ec[_0x8d61('0x3f')],{'$or':_['map'](_0x2463e3,function(_0x14f1f2){if(_0x14f1f2[_0x8d61('0x41')]!==_0x8d61('0x42')){var _0x552a4d={};_0x552a4d[_0x14f1f2['name']]={'$like':'%'+_0x344050[_0x8d61('0x34')][_0x8d61('0x3e')]+'%'};return _0x552a4d;}})});}_0x5d54ec=_['merge']({},_0x5d54ec,_0x344050[_0x8d61('0x43')]);var _0x4d3c37={'where':_0x5d54ec[_0x8d61('0x3f')]};return db[_0x8d61('0x30')]['count'](_0x4d3c37)[_0x8d61('0x25')](function(_0x1431bf){_0x5a93c4['count']=_0x1431bf;if(_0x344050['query'][_0x8d61('0x44')]){_0x5d54ec['include']=[{'all':!![]}];}return db[_0x8d61('0x30')]['findAll'](_0x5d54ec);})[_0x8d61('0x25')](function(_0x4bd05b){_0x5a93c4[_0x8d61('0x45')]=_0x4bd05b;return _0x5a93c4;})[_0x8d61('0x25')](respondWithFilteredResult(_0x2718d6,_0x5d54ec))[_0x8d61('0x46')](handleError(_0x2718d6,null));};exports[_0x8d61('0x47')]=function(_0x18c635,_0x592850){var _0x176b2b={'raw':![],'where':{'id':_0x18c635[_0x8d61('0x48')]['id']}},_0x2b1242={};_0x2b1242[_0x8d61('0x33')]=_[_0x8d61('0x35')](db[_0x8d61('0x30')][_0x8d61('0x31')]);_0x2b1242['query']=_['keys'](_0x18c635[_0x8d61('0x34')]);_0x2b1242['filters']=_[_0x8d61('0x37')](_0x2b1242[_0x8d61('0x33')],_0x2b1242[_0x8d61('0x34')]);_0x176b2b[_0x8d61('0x38')]=_[_0x8d61('0x37')](_0x2b1242[_0x8d61('0x33')],qs[_0x8d61('0x39')](_0x18c635[_0x8d61('0x34')][_0x8d61('0x39')]));_0x176b2b['attributes']=_0x176b2b['attributes']['length']?_0x176b2b[_0x8d61('0x38')]:_0x2b1242[_0x8d61('0x33')];if(_0x18c635[_0x8d61('0x34')][_0x8d61('0x44')]){_0x176b2b[_0x8d61('0x49')]=[{'all':!![]}];}_0x176b2b=_[_0x8d61('0x40')]({},_0x176b2b,_0x18c635['options']);return db['VoiceMusicOnHold'][_0x8d61('0x4a')](_0x176b2b)[_0x8d61('0x25')](handleEntityNotFound(_0x592850,null))[_0x8d61('0x25')](respondWithResult(_0x592850,null))[_0x8d61('0x46')](handleError(_0x592850,null));};exports[_0x8d61('0x24')]=function(_0x4f0279,_0x21359b){if(_0x4f0279['body']['id']){delete _0x4f0279[_0x8d61('0x4b')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x4f0279[_0x8d61('0x48')]['id']}})['then'](handleEntityNotFound(_0x21359b,null))[_0x8d61('0x25')](saveUpdates(_0x4f0279[_0x8d61('0x4b')],null))[_0x8d61('0x25')](respondWithResult(_0x21359b,null))[_0x8d61('0x46')](handleError(_0x21359b,null));};exports['create']=function(_0x8f9fbe,_0x3076c9,_0x4c17bf){return db[_0x8d61('0x4c')][_0x8d61('0x4d')](function(_0x55411b){if(_0x8f9fbe['body'][_0x8d61('0x4e')]==='files'){_0x8f9fbe['body']['directory']=path['join'](config[_0x8d61('0x4f')],_0x8d61('0x50'),_0x8f9fbe[_0x8d61('0x4b')]['name']);}return db['VoiceMusicOnHold'][_0x8d61('0x51')](_0x8f9fbe[_0x8d61('0x4b')],{'transaction':_0x55411b})[_0x8d61('0x25')](function(_0x46c1e2){if(_0x8f9fbe[_0x8d61('0x4b')][_0x8d61('0x4e')]===_0x8d61('0x52')){fs[_0x8d61('0x53')](_0x46c1e2[_0x8d61('0x54')],parseInt(_0x8d61('0x55'),0x8));}var _0x4dd63c=_0x8f9fbe[_0x8d61('0x56')][_0x8d61('0x27')]({'plain':!![]});if(!_0x4dd63c)throw new Error(_0x8d61('0x57'));if(_0x4dd63c[_0x8d61('0x58')]===_0x8d61('0x56')){var _0x22973=_0x46c1e2['get']({'plain':!![]});return db[_0x8d61('0x59')][_0x8d61('0x4a')]({'where':{'name':_0x8d61('0x28'),'userProfileId':_0x4dd63c[_0x8d61('0x5a')]},'raw':!![]})[_0x8d61('0x25')](function(_0x1f6ac1){if(_0x1f6ac1&&_0x1f6ac1['autoAssociation']===0x0){return db['UserProfileResource'][_0x8d61('0x51')]({'name':_0x22973[_0x8d61('0x2c')],'resourceId':_0x22973['id'],'type':_0x1f6ac1['name'],'sectionId':_0x1f6ac1['id']},{})[_0x8d61('0x25')](function(){return _0x46c1e2;});}else{return _0x46c1e2;}})[_0x8d61('0x46')](function(_0x5535bc){logger[_0x8d61('0x2b')](_0x8d61('0x5b'),_0x5535bc);});}return _0x46c1e2;});})[_0x8d61('0x25')](respondWithResult(_0x3076c9,0xc9))['catch'](handleError(_0x3076c9,null));};exports[_0x8d61('0x26')]=function(_0x1b75e8,_0x5b74e4,_0x20aa0c){var _0x159b28;return db[_0x8d61('0x30')][_0x8d61('0x4a')]({'where':{'id':_0x1b75e8['params']['id']}})['then'](function(_0x136e26){if(_0x136e26){return db[_0x8d61('0x4c')][_0x8d61('0x4d')](function(_0x14620b){return _0x136e26[_0x8d61('0x26')]({'transaction':_0x14620b,'raw':!![]})[_0x8d61('0x25')](function(_0x159c5f){if(_0x159c5f[_0x8d61('0x54')]){fs[_0x8d61('0x5c')](_0x159c5f[_0x8d61('0x54')])[_0x8d61('0x5d')](function(_0x592026){fs['unlinkSync'](path[_0x8d61('0x5e')](_0x159c5f[_0x8d61('0x54')],_0x592026));});fs['rmdirSync'](_0x159c5f[_0x8d61('0x54')]);}return _0x159c5f;});})[_0x8d61('0x46')](function(_0x5876b1){throw new db['Sequelize'][(_0x8d61('0x5f'))](_0x5876b1[_0x8d61('0x60')]);});}})[_0x8d61('0x25')](handleEntityNotFound(_0x5b74e4,null))[_0x8d61('0x25')](removeEntity(_0x5b74e4,null))[_0x8d61('0x46')](handleError(_0x5b74e4,null));};exports[_0x8d61('0x61')]=function(_0x2cb42c,_0x5e6ab1,_0x164da8){return db[_0x8d61('0x4c')]['transaction'](function(_0x4ac2d9){var _0x4fc1aa;return db[_0x8d61('0x30')][_0x8d61('0x4a')]({'where':{'id':_0x2cb42c[_0x8d61('0x48')]['id']}})[_0x8d61('0x25')](function(_0x24b959){if(_0x24b959){_0x4fc1aa=_0x24b959;return _0x24b959[_0x8d61('0x61')](_0x2cb42c[_0x8d61('0x4b')]['id'],{'transaction':_0x4ac2d9});}})['then'](function(_0x53b2a4){if(_0x53b2a4){return db[_0x8d61('0x62')][_0x8d61('0x63')]({'where':{'id':_0x2cb42c[_0x8d61('0x4b')]['id']},'attributes':['id',_0x8d61('0x2c'),'save_name','converted_format','createdAt'],'raw':!![]});}})[_0x8d61('0x25')](function(_0x30fb49){if(_0x30fb49){var _0x2b9166=path['join'](config['root'],_0x8d61('0x64'),util[_0x8d61('0x65')](_0x8d61('0x66'),path['basename'](_0x30fb49['save_name'],path[_0x8d61('0x67')](_0x30fb49['save_name'])),_0x30fb49[_0x8d61('0x68')]));var _0x4a2bf1=path['join'](config[_0x8d61('0x4f')],_0x8d61('0x50'),_0x4fc1aa[_0x8d61('0x2c')],util[_0x8d61('0x65')]('%s.%s',_0x30fb49[_0x8d61('0x2c')],_0x30fb49['converted_format']));fs[_0x8d61('0x69')](_0x2b9166,_0x4a2bf1);return _0x30fb49;}})[_0x8d61('0x46')](function(_0x20389d){throw new db[(_0x8d61('0x6a'))][(_0x8d61('0x5f'))](_0x20389d[_0x8d61('0x60')]);});})[_0x8d61('0x25')](handleEntityNotFound(_0x5e6ab1,null))['then'](respondWithResult(_0x5e6ab1,0xc9))['catch'](handleError(_0x5e6ab1,null));};exports[_0x8d61('0x6b')]=function(_0x1dd810,_0x5a83b7,_0x5d1683){return db[_0x8d61('0x4c')][_0x8d61('0x4d')](function(_0x22518e){var _0x2cdcdc;return db[_0x8d61('0x30')][_0x8d61('0x63')]({'where':{'id':_0x1dd810[_0x8d61('0x48')]['id']}})[_0x8d61('0x25')](handleEntityNotFound(_0x5a83b7,null))[_0x8d61('0x25')](function(_0x3b1b53){if(_0x3b1b53){_0x2cdcdc=_0x3b1b53;return _0x3b1b53[_0x8d61('0x6b')](_0x1dd810[_0x8d61('0x48')][_0x8d61('0x6c')]);}})[_0x8d61('0x25')](function(_0xaee5a0){if(_0xaee5a0){return db[_0x8d61('0x62')]['findOne']({'where':{'id':_0x1dd810[_0x8d61('0x48')][_0x8d61('0x6c')]},'attributes':['id',_0x8d61('0x2c'),_0x8d61('0x6d'),'converted_format','createdAt'],'raw':!![]});}})[_0x8d61('0x25')](function(_0x14880d){if(_0x14880d){fs[_0x8d61('0x6e')](path[_0x8d61('0x5e')](_0x2cdcdc[_0x8d61('0x54')],util['format'](_0x8d61('0x66'),_0x14880d['name'],_0x14880d[_0x8d61('0x68')])));return _0x14880d;}})[_0x8d61('0x46')](function(_0x1e4067){throw new db['Sequelize'][(_0x8d61('0x5f'))](_0x1e4067['message']);});})['then'](handleEntityNotFound(_0x5a83b7,null))[_0x8d61('0x25')](respondWithStatusCode(_0x5a83b7,0xcc))[_0x8d61('0x46')](handleError(_0x5a83b7,null));};exports[_0x8d61('0x6f')]=function(_0x54ac11,_0xe4389b,_0x31d0d1){var _0x6911ee={};var _0x5850e3={};var _0x417e0e;var _0x1da460;return db[_0x8d61('0x30')][_0x8d61('0x63')]({'where':{'id':_0x54ac11[_0x8d61('0x48')]['id']}})['then'](handleEntityNotFound(_0xe4389b,null))[_0x8d61('0x25')](function(_0x27cac2){if(_0x27cac2){_0x417e0e=_0x27cac2;_0x5850e3[_0x8d61('0x33')]=_['keys'](db[_0x8d61('0x62')][_0x8d61('0x31')]);_0x5850e3[_0x8d61('0x34')]=_[_0x8d61('0x35')](_0x54ac11[_0x8d61('0x34')]);_0x5850e3[_0x8d61('0x36')]=_[_0x8d61('0x37')](_0x5850e3[_0x8d61('0x33')],_0x5850e3[_0x8d61('0x34')]);_0x6911ee[_0x8d61('0x38')]=_[_0x8d61('0x37')](_0x5850e3[_0x8d61('0x33')],qs[_0x8d61('0x39')](_0x54ac11[_0x8d61('0x34')][_0x8d61('0x39')]));_0x6911ee['attributes']=_0x6911ee['attributes']['length']?_0x6911ee[_0x8d61('0x38')]:_0x5850e3['model'];_0x6911ee[_0x8d61('0x70')]=qs[_0x8d61('0x3d')](_0x54ac11[_0x8d61('0x34')][_0x8d61('0x3d')]);_0x6911ee[_0x8d61('0x3f')]=qs['filters'](_[_0x8d61('0x71')](_0x54ac11['query'],_0x5850e3[_0x8d61('0x36')]));if(_0x54ac11['query'][_0x8d61('0x3e')]){_0x6911ee[_0x8d61('0x3f')]=_['merge'](_0x6911ee[_0x8d61('0x3f')],{'$or':_[_0x8d61('0x2f')](_0x6911ee[_0x8d61('0x38')],function(_0x22eb41){var _0x283020={};_0x283020[_0x22eb41]={'$like':'%'+_0x54ac11['query'][_0x8d61('0x3e')]+'%'};return _0x283020;})});}_0x6911ee=_[_0x8d61('0x40')]({},_0x6911ee,_0x54ac11[_0x8d61('0x43')]);return _0x417e0e[_0x8d61('0x6f')](_0x6911ee);}})[_0x8d61('0x25')](function(_0x42b08b){if(_0x42b08b){_0x1da460=_0x42b08b['length'];if(!_0x54ac11[_0x8d61('0x34')][_0x8d61('0x3b')]('nolimit')){_0x6911ee[_0x8d61('0x1e')]=qs['limit'](_0x54ac11[_0x8d61('0x34')][_0x8d61('0x1e')]);_0x6911ee[_0x8d61('0x1b')]=qs[_0x8d61('0x1b')](_0x54ac11[_0x8d61('0x34')][_0x8d61('0x1b')]);}return _0x417e0e[_0x8d61('0x6f')](_0x6911ee);}})[_0x8d61('0x25')](function(_0x3efac9){if(_0x3efac9){return _0x3efac9?{'count':_0x1da460,'rows':_0x3efac9}:null;}})[_0x8d61('0x25')](respondWithResult(_0xe4389b,null))[_0x8d61('0x46')](handleError(_0xe4389b,null));}; \ No newline at end of file +var _0x473b=['removeSound','findOne','id2','unlinkSync','getSounds','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','MusicOnHolds','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','type','VIRTUAL','filter','merge','options','VoiceMusicOnHold','includeAll','findAll','rows','catch','show','body','find','params','create','transaction','directory','join','root','files','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','rmdirSync','Sequelize','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','server/files/moh','symlinkSync','ValidationError','message'];(function(_0x3dc94,_0x3c8a3a){var _0x8975e1=function(_0x585b79){while(--_0x585b79){_0x3dc94['push'](_0x3dc94['shift']());}};_0x8975e1(++_0x3c8a3a);}(_0x473b,0x1c9));var _0xb473=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x473b[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0xb473('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb473('0x1'));var jsonpatch=require(_0xb473('0x2'));var rp=require(_0xb473('0x3'));var moment=require(_0xb473('0x4'));var BPromise=require(_0xb473('0x5'));var Mustache=require('mustache');var util=require(_0xb473('0x6'));var path=require(_0xb473('0x7'));var sox=require(_0xb473('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb473('0x9'));var _=require('lodash');var squel=require(_0xb473('0xa'));var crypto=require('crypto');var jsforce=require(_0xb473('0xb'));var deskjs=require(_0xb473('0xc'));var toCsv=require(_0xb473('0xd'));var querystring=require('querystring');var Papa=require(_0xb473('0xe'));var Redis=require('ioredis');var authService=require(_0xb473('0xf'));var qs=require(_0xb473('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb473('0x11'));var logger=require('../../config/logger')(_0xb473('0x12'));var utils=require(_0xb473('0x13'));var config=require(_0xb473('0x14'));var licenseUtil=require(_0xb473('0x15'));var db=require(_0xb473('0x16'))['db'];function respondWithStatusCode(_0x37ed22,_0x268fbf){_0x268fbf=_0x268fbf||0xcc;return function(_0x2cf6c9){if(_0x2cf6c9){return _0x37ed22[_0xb473('0x17')](_0x268fbf);}return _0x37ed22[_0xb473('0x18')](_0x268fbf)[_0xb473('0x19')]();};}function respondWithResult(_0x58d6d1,_0x3667bb){_0x3667bb=_0x3667bb||0xc8;return function(_0x37e36a){if(_0x37e36a){return _0x58d6d1[_0xb473('0x18')](_0x3667bb)[_0xb473('0x1a')](_0x37e36a);}};}function respondWithFilteredResult(_0x5bbd35,_0x4df0a5){return function(_0x9ef934){if(_0x9ef934){var _0x1de9ed=typeof _0x4df0a5[_0xb473('0x1b')]===_0xb473('0x1c')&&typeof _0x4df0a5[_0xb473('0x1d')]===_0xb473('0x1c');var _0x216a45=_0x9ef934[_0xb473('0x1e')];var _0x259f9d=_0x1de9ed?0x0:_0x4df0a5[_0xb473('0x1b')];var _0x5823f7=_0x1de9ed?_0x9ef934[_0xb473('0x1e')]:_0x4df0a5[_0xb473('0x1b')]+_0x4df0a5['limit'];var _0x158fd3;if(_0x5823f7>=_0x216a45){_0x5823f7=_0x216a45;_0x158fd3=0xc8;}else{_0x158fd3=0xce;}_0x5bbd35[_0xb473('0x18')](_0x158fd3);return _0x5bbd35[_0xb473('0x1f')](_0xb473('0x20'),_0x259f9d+'-'+_0x5823f7+'/'+_0x216a45)[_0xb473('0x1a')](_0x9ef934);}return null;};}function patchUpdates(_0x5a3e28){return function(_0x25af85){try{jsonpatch[_0xb473('0x21')](_0x25af85,_0x5a3e28,!![]);}catch(_0x770d51){return BPromise[_0xb473('0x22')](_0x770d51);}return _0x25af85['save']();};}function saveUpdates(_0x39506f,_0x4fbc2c){return function(_0xef4bf){if(_0xef4bf){return _0xef4bf[_0xb473('0x23')](_0x39506f)[_0xb473('0x24')](function(_0xaafd47){return _0xaafd47;});}return null;};}function removeEntity(_0x45494c,_0x3fc647){return function(_0x1f9139){if(_0x1f9139){return _0x1f9139[_0xb473('0x25')]()[_0xb473('0x24')](function(){var _0x13534f=_0x1f9139[_0xb473('0x26')]({'plain':!![]});var _0x50a3aa=_0xb473('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x50a3aa,'resourceId':_0x13534f['id']}})[_0xb473('0x24')](function(){return _0x1f9139;});})[_0xb473('0x24')](function(){_0x45494c[_0xb473('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c3b06,_0x5163a7){return function(_0x211157){if(!_0x211157){_0x1c3b06[_0xb473('0x17')](0x194);}return _0x211157;};}function handleError(_0x28de94,_0x471583){_0x471583=_0x471583||0x1f4;return function(_0x5db1fe){logger[_0xb473('0x28')](_0x5db1fe[_0xb473('0x29')]);if(_0x5db1fe['name']){delete _0x5db1fe[_0xb473('0x2a')];}_0x28de94[_0xb473('0x18')](_0x471583)[_0xb473('0x2b')](_0x5db1fe);};}exports[_0xb473('0x2c')]=function(_0xb72a6,_0x478c43){var _0x8ad526={},_0x2e4fa4={},_0x522593={'count':0x0,'rows':[]};var _0x2d88e=_[_0xb473('0x2d')](db['VoiceMusicOnHold'][_0xb473('0x2e')],function(_0x333ff8){return{'name':_0x333ff8[_0xb473('0x2f')],'type':_0x333ff8['type'][_0xb473('0x30')]};});_0x2e4fa4[_0xb473('0x31')]=_[_0xb473('0x2d')](_0x2d88e,_0xb473('0x2a'));_0x2e4fa4['query']=_[_0xb473('0x32')](_0xb72a6[_0xb473('0x33')]);_0x2e4fa4['filters']=_[_0xb473('0x34')](_0x2e4fa4['model'],_0x2e4fa4[_0xb473('0x33')]);_0x8ad526[_0xb473('0x35')]=_[_0xb473('0x34')](_0x2e4fa4[_0xb473('0x31')],qs['fields'](_0xb72a6[_0xb473('0x33')][_0xb473('0x36')]));_0x8ad526[_0xb473('0x35')]=_0x8ad526[_0xb473('0x35')][_0xb473('0x37')]?_0x8ad526[_0xb473('0x35')]:_0x2e4fa4['model'];if(!_0xb72a6[_0xb473('0x33')][_0xb473('0x38')](_0xb473('0x39'))){_0x8ad526[_0xb473('0x1d')]=qs['limit'](_0xb72a6[_0xb473('0x33')][_0xb473('0x1d')]);_0x8ad526['offset']=qs[_0xb473('0x1b')](_0xb72a6['query'][_0xb473('0x1b')]);}_0x8ad526[_0xb473('0x3a')]=qs[_0xb473('0x3b')](_0xb72a6[_0xb473('0x33')]['sort']);delete _0xb72a6[_0xb473('0x33')]['sort'];_0x8ad526['where']=qs[_0xb473('0x3c')](_[_0xb473('0x3d')](_0xb72a6[_0xb473('0x33')],_0x2e4fa4['filters']),_0x2d88e);if(_0xb72a6[_0xb473('0x33')]['filter']){_0x8ad526[_0xb473('0x3e')]=_['merge'](_0x8ad526[_0xb473('0x3e')],{'$or':_['map'](_0x2d88e,function(_0x24fa87){if(_0x24fa87[_0xb473('0x3f')]!==_0xb473('0x40')){var _0x3093d3={};_0x3093d3[_0x24fa87[_0xb473('0x2a')]]={'$like':'%'+_0xb72a6[_0xb473('0x33')][_0xb473('0x41')]+'%'};return _0x3093d3;}})});}_0x8ad526=_[_0xb473('0x42')]({},_0x8ad526,_0xb72a6[_0xb473('0x43')]);var _0x560ace={'where':_0x8ad526['where']};return db[_0xb473('0x44')][_0xb473('0x1e')](_0x560ace)[_0xb473('0x24')](function(_0x50cc9d){_0x522593['count']=_0x50cc9d;if(_0xb72a6[_0xb473('0x33')][_0xb473('0x45')]){_0x8ad526['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xb473('0x46')](_0x8ad526);})[_0xb473('0x24')](function(_0x14dd5e){_0x522593[_0xb473('0x47')]=_0x14dd5e;return _0x522593;})[_0xb473('0x24')](respondWithFilteredResult(_0x478c43,_0x8ad526))[_0xb473('0x48')](handleError(_0x478c43,null));};exports[_0xb473('0x49')]=function(_0x3c5970,_0x137df8){var _0x59b192={'raw':![],'where':{'id':_0x3c5970['params']['id']}},_0xb9394f={};_0xb9394f[_0xb473('0x31')]=_[_0xb473('0x32')](db[_0xb473('0x44')][_0xb473('0x2e')]);_0xb9394f['query']=_[_0xb473('0x32')](_0x3c5970[_0xb473('0x33')]);_0xb9394f['filters']=_['intersection'](_0xb9394f[_0xb473('0x31')],_0xb9394f[_0xb473('0x33')]);_0x59b192['attributes']=_['intersection'](_0xb9394f[_0xb473('0x31')],qs[_0xb473('0x36')](_0x3c5970[_0xb473('0x33')][_0xb473('0x36')]));_0x59b192[_0xb473('0x35')]=_0x59b192[_0xb473('0x35')][_0xb473('0x37')]?_0x59b192['attributes']:_0xb9394f['model'];if(_0x3c5970[_0xb473('0x33')][_0xb473('0x45')]){_0x59b192['include']=[{'all':!![]}];}_0x59b192=_[_0xb473('0x42')]({},_0x59b192,_0x3c5970[_0xb473('0x43')]);return db['VoiceMusicOnHold']['find'](_0x59b192)[_0xb473('0x24')](handleEntityNotFound(_0x137df8,null))['then'](respondWithResult(_0x137df8,null))[_0xb473('0x48')](handleError(_0x137df8,null));};exports[_0xb473('0x23')]=function(_0x5654ea,_0x1c599f){if(_0x5654ea[_0xb473('0x4a')]['id']){delete _0x5654ea[_0xb473('0x4a')]['id'];}return db[_0xb473('0x44')][_0xb473('0x4b')]({'where':{'id':_0x5654ea[_0xb473('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1c599f,null))[_0xb473('0x24')](saveUpdates(_0x5654ea[_0xb473('0x4a')],null))[_0xb473('0x24')](respondWithResult(_0x1c599f,null))[_0xb473('0x48')](handleError(_0x1c599f,null));};exports[_0xb473('0x4d')]=function(_0x3fa96c,_0x1e2a03,_0x486251){return db['sequelize'][_0xb473('0x4e')](function(_0x1e751d){if(_0x3fa96c[_0xb473('0x4a')]['mode']==='files'){_0x3fa96c[_0xb473('0x4a')][_0xb473('0x4f')]=path[_0xb473('0x50')](config[_0xb473('0x51')],'server/files/moh',_0x3fa96c[_0xb473('0x4a')][_0xb473('0x2a')]);}return db['VoiceMusicOnHold']['create'](_0x3fa96c['body'],{'transaction':_0x1e751d})[_0xb473('0x24')](function(_0x1b5aba){if(_0x3fa96c[_0xb473('0x4a')]['mode']===_0xb473('0x52')){fs[_0xb473('0x53')](_0x1b5aba[_0xb473('0x4f')],parseInt(_0xb473('0x54'),0x8));}var _0x1a0d71=_0x3fa96c['user'][_0xb473('0x26')]({'plain':!![]});if(!_0x1a0d71)throw new Error(_0xb473('0x55'));if(_0x1a0d71['role']===_0xb473('0x56')){var _0x83d480=_0x1b5aba[_0xb473('0x26')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xb473('0x27'),'userProfileId':_0x1a0d71[_0xb473('0x57')]},'raw':!![]})[_0xb473('0x24')](function(_0x3db688){if(_0x3db688&&_0x3db688['autoAssociation']===0x0){return db[_0xb473('0x58')][_0xb473('0x4d')]({'name':_0x83d480[_0xb473('0x2a')],'resourceId':_0x83d480['id'],'type':_0x3db688['name'],'sectionId':_0x3db688['id']},{})[_0xb473('0x24')](function(){return _0x1b5aba;});}else{return _0x1b5aba;}})[_0xb473('0x48')](function(_0x213e78){logger[_0xb473('0x28')](_0xb473('0x59'),_0x213e78);});}return _0x1b5aba;});})[_0xb473('0x24')](respondWithResult(_0x1e2a03,0xc9))[_0xb473('0x48')](handleError(_0x1e2a03,null));};exports[_0xb473('0x25')]=function(_0x2867ee,_0x1e1a08,_0x2690b4){var _0xb5ee68;return db[_0xb473('0x44')]['find']({'where':{'id':_0x2867ee['params']['id']}})[_0xb473('0x24')](function(_0x35003c){if(_0x35003c){return db[_0xb473('0x5a')][_0xb473('0x4e')](function(_0x699b1){return _0x35003c[_0xb473('0x25')]({'transaction':_0x699b1,'raw':!![]})[_0xb473('0x24')](function(_0x14bed1){if(_0x14bed1[_0xb473('0x4f')]){fs[_0xb473('0x5b')](_0x14bed1['directory'])[_0xb473('0x5c')](function(_0x54daf4){fs['unlinkSync'](path[_0xb473('0x50')](_0x14bed1[_0xb473('0x4f')],_0x54daf4));});fs[_0xb473('0x5d')](_0x14bed1['directory']);}return _0x14bed1;});})['catch'](function(_0x498ba8){throw new db[(_0xb473('0x5e'))]['ValidationError'](_0x498ba8['message']);});}})[_0xb473('0x24')](handleEntityNotFound(_0x1e1a08,null))['then'](removeEntity(_0x1e1a08,null))['catch'](handleError(_0x1e1a08,null));};exports['addSound']=function(_0x267835,_0x91cb62,_0x5d2245){return db[_0xb473('0x5a')][_0xb473('0x4e')](function(_0x16b8a2){var _0x5b9e8d;return db['VoiceMusicOnHold'][_0xb473('0x4b')]({'where':{'id':_0x267835[_0xb473('0x4c')]['id']}})[_0xb473('0x24')](function(_0x321745){if(_0x321745){_0x5b9e8d=_0x321745;return _0x321745[_0xb473('0x5f')](_0x267835[_0xb473('0x4a')]['id'],{'transaction':_0x16b8a2});}})[_0xb473('0x24')](function(_0xb957b6){if(_0xb957b6){return db[_0xb473('0x60')]['findOne']({'where':{'id':_0x267835[_0xb473('0x4a')]['id']},'attributes':['id',_0xb473('0x2a'),_0xb473('0x61'),_0xb473('0x62'),_0xb473('0x63')],'raw':!![]});}})['then'](function(_0x5481d9){if(_0x5481d9){var _0x5cd5dd=path[_0xb473('0x50')](config[_0xb473('0x51')],_0xb473('0x64'),util[_0xb473('0x65')](_0xb473('0x66'),path['basename'](_0x5481d9[_0xb473('0x61')],path[_0xb473('0x67')](_0x5481d9[_0xb473('0x61')])),_0x5481d9[_0xb473('0x62')]));var _0x34624a=path[_0xb473('0x50')](config[_0xb473('0x51')],_0xb473('0x68'),_0x5b9e8d[_0xb473('0x2a')],util[_0xb473('0x65')](_0xb473('0x66'),_0x5481d9[_0xb473('0x2a')],_0x5481d9[_0xb473('0x62')]));fs[_0xb473('0x69')](_0x5cd5dd,_0x34624a);return _0x5481d9;}})[_0xb473('0x48')](function(_0x3213b6){throw new db['Sequelize'][(_0xb473('0x6a'))](_0x3213b6[_0xb473('0x6b')]);});})[_0xb473('0x24')](handleEntityNotFound(_0x91cb62,null))[_0xb473('0x24')](respondWithResult(_0x91cb62,0xc9))[_0xb473('0x48')](handleError(_0x91cb62,null));};exports[_0xb473('0x6c')]=function(_0x507e5a,_0x11dc81,_0x6b7a98){return db['sequelize'][_0xb473('0x4e')](function(_0x2687ae){var _0x373576;return db['VoiceMusicOnHold'][_0xb473('0x6d')]({'where':{'id':_0x507e5a[_0xb473('0x4c')]['id']}})[_0xb473('0x24')](handleEntityNotFound(_0x11dc81,null))[_0xb473('0x24')](function(_0x4b3857){if(_0x4b3857){_0x373576=_0x4b3857;return _0x4b3857[_0xb473('0x6c')](_0x507e5a[_0xb473('0x4c')][_0xb473('0x6e')]);}})[_0xb473('0x24')](function(_0x335bd2){if(_0x335bd2){return db[_0xb473('0x60')][_0xb473('0x6d')]({'where':{'id':_0x507e5a[_0xb473('0x4c')][_0xb473('0x6e')]},'attributes':['id',_0xb473('0x2a'),_0xb473('0x61'),_0xb473('0x62'),_0xb473('0x63')],'raw':!![]});}})['then'](function(_0x200cb7){if(_0x200cb7){fs[_0xb473('0x6f')](path[_0xb473('0x50')](_0x373576[_0xb473('0x4f')],util['format'](_0xb473('0x66'),_0x200cb7['name'],_0x200cb7[_0xb473('0x62')])));return _0x200cb7;}})[_0xb473('0x48')](function(_0x83a95b){throw new db['Sequelize'][(_0xb473('0x6a'))](_0x83a95b[_0xb473('0x6b')]);});})[_0xb473('0x24')](handleEntityNotFound(_0x11dc81,null))[_0xb473('0x24')](respondWithStatusCode(_0x11dc81,0xcc))[_0xb473('0x48')](handleError(_0x11dc81,null));};exports['getSounds']=function(_0x3d5702,_0x385a0b,_0x38f955){var _0x1a644d={};var _0x5b728c={};var _0x35efbd;var _0xc15d69;return db[_0xb473('0x44')][_0xb473('0x6d')]({'where':{'id':_0x3d5702[_0xb473('0x4c')]['id']}})['then'](handleEntityNotFound(_0x385a0b,null))[_0xb473('0x24')](function(_0x38f717){if(_0x38f717){_0x35efbd=_0x38f717;_0x5b728c[_0xb473('0x31')]=_[_0xb473('0x32')](db[_0xb473('0x60')][_0xb473('0x2e')]);_0x5b728c['query']=_[_0xb473('0x32')](_0x3d5702['query']);_0x5b728c[_0xb473('0x3c')]=_['intersection'](_0x5b728c[_0xb473('0x31')],_0x5b728c[_0xb473('0x33')]);_0x1a644d[_0xb473('0x35')]=_['intersection'](_0x5b728c['model'],qs['fields'](_0x3d5702[_0xb473('0x33')][_0xb473('0x36')]));_0x1a644d[_0xb473('0x35')]=_0x1a644d[_0xb473('0x35')][_0xb473('0x37')]?_0x1a644d[_0xb473('0x35')]:_0x5b728c['model'];_0x1a644d[_0xb473('0x3a')]=qs[_0xb473('0x3b')](_0x3d5702['query'][_0xb473('0x3b')]);_0x1a644d[_0xb473('0x3e')]=qs[_0xb473('0x3c')](_[_0xb473('0x3d')](_0x3d5702[_0xb473('0x33')],_0x5b728c[_0xb473('0x3c')]));if(_0x3d5702[_0xb473('0x33')][_0xb473('0x41')]){_0x1a644d['where']=_[_0xb473('0x42')](_0x1a644d[_0xb473('0x3e')],{'$or':_['map'](_0x1a644d[_0xb473('0x35')],function(_0x5b405c){var _0x22bfb5={};_0x22bfb5[_0x5b405c]={'$like':'%'+_0x3d5702['query']['filter']+'%'};return _0x22bfb5;})});}_0x1a644d=_[_0xb473('0x42')]({},_0x1a644d,_0x3d5702[_0xb473('0x43')]);return _0x35efbd[_0xb473('0x70')](_0x1a644d);}})['then'](function(_0x72de0b){if(_0x72de0b){_0xc15d69=_0x72de0b['length'];if(!_0x3d5702[_0xb473('0x33')][_0xb473('0x38')](_0xb473('0x39'))){_0x1a644d[_0xb473('0x1d')]=qs[_0xb473('0x1d')](_0x3d5702[_0xb473('0x33')][_0xb473('0x1d')]);_0x1a644d['offset']=qs[_0xb473('0x1b')](_0x3d5702['query'][_0xb473('0x1b')]);}return _0x35efbd['getSounds'](_0x1a644d);}})[_0xb473('0x24')](function(_0xced1b3){if(_0xced1b3){return _0xced1b3?{'count':_0xc15d69,'rows':_0xced1b3}:null;}})[_0xb473('0x24')](respondWithResult(_0x385a0b,null))['catch'](handleError(_0x385a0b,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index b59a7f9..7122d79 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 _0xa2b1=['bluebird','request-promise','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','util','../../config/logger','api'];(function(_0x35f15b,_0x387db3){var _0x262619=function(_0x4467b9){while(--_0x4467b9){_0x35f15b['push'](_0x35f15b['shift']());}};_0x262619(++_0x387db3);}(_0xa2b1,0x1ca));var _0x1a2b=function(_0xb40e41,_0x5d9e32){_0xb40e41=_0xb40e41-0x0;var _0x31aabe=_0xa2b1[_0xb40e41];return _0x31aabe;};'use strict';var _=require(_0x1a2b('0x0'));var util=require(_0x1a2b('0x1'));var logger=require(_0x1a2b('0x2'))(_0x1a2b('0x3'));var moment=require('moment');var BPromise=require(_0x1a2b('0x4'));var rp=require(_0x1a2b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a2b('0x6'));var attributes=require(_0x1a2b('0x7'));module[_0x1a2b('0x8')]=function(_0x5bb83f,_0x3fc1b1){return _0x5bb83f[_0x1a2b('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x1a2b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa035=['voice_musiconhold','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x591855,_0x2edc25){var _0x67cb2=function(_0x59df84){while(--_0x59df84){_0x591855['push'](_0x591855['shift']());}};_0x67cb2(++_0x2edc25);}(_0xa035,0x187));var _0x5a03=function(_0x28a2ad,_0x3c0d33){_0x28a2ad=_0x28a2ad-0x0;var _0x4565be=_0xa035[_0x28a2ad];return _0x4565be;};'use strict';var _=require(_0x5a03('0x0'));var util=require(_0x5a03('0x1'));var logger=require(_0x5a03('0x2'))(_0x5a03('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5a03('0x4'));var fs=require('fs');var path=require(_0x5a03('0x5'));var rimraf=require(_0x5a03('0x6'));var config=require(_0x5a03('0x7'));var attributes=require(_0x5a03('0x8'));module[_0x5a03('0x9')]=function(_0x1ec4a1,_0x339e65){return _0x1ec4a1[_0x5a03('0xa')](_0x5a03('0xb'),attributes,{'tableName':_0x5a03('0xc'),'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 abb44a6..85ceb0d 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 _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x581735,_0x3cc6d6){var _0x248754=function(_0x361191){while(--_0x361191){_0x581735['push'](_0x581735['shift']());}};_0x248754(++_0x3cc6d6);}(_0x70e0,0x17b));var _0x070e=function(_0x28f994,_0x4a3e7b){_0x28f994=_0x28f994-0x0;var _0x3cf387=_0x70e0[_0x28f994];return _0x3cf387;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x221b6f,_0x4871e2){var _0x4fa2a8=function(_0x1d9214){while(--_0x1d9214){_0x221b6f['push'](_0x221b6f['shift']());}};_0x4fa2a8(++_0x4871e2);}(_0x70e0,0x17b));var _0x070e=function(_0x2ab2d4,_0x532d55){_0x2ab2d4=_0x2ab2d4-0x0;var _0x4ef285=_0x70e0[_0x2ab2d4];return _0x4ef285;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3b41c47..9bc43ac 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 _0x3663=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','isAuthenticated','describe','show','getAgents','/:id/teams','getTeams','post','/:id/users','addAgents','put','update','delete','/:id','removeAgents','exports','multer','util','path','express','Router'];(function(_0x1c2a2d,_0x615303){var _0x49fe18=function(_0x2a4564){while(--_0x2a4564){_0x1c2a2d['push'](_0x1c2a2d['shift']());}};_0x49fe18(++_0x615303);}(_0x3663,0x1cf));var _0x3366=function(_0x32d536,_0x568fc4){_0x32d536=_0x32d536-0x0;var _0xa8c5e6=_0x3663[_0x32d536];return _0xa8c5e6;};'use strict';var multer=require(_0x3366('0x0'));var util=require(_0x3366('0x1'));var path=require(_0x3366('0x2'));var timeout=require('connect-timeout');var express=require(_0x3366('0x3'));var router=express[_0x3366('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3366('0x5'));var interaction=require(_0x3366('0x6'));var config=require(_0x3366('0x7'));var controller=require(_0x3366('0x8'));router[_0x3366('0x9')]('/',auth['isAuthenticated'](),controller[_0x3366('0xa')]);router[_0x3366('0x9')]('/describe',auth[_0x3366('0xb')](),controller[_0x3366('0xc')]);router[_0x3366('0x9')]('/:id',auth[_0x3366('0xb')](),controller[_0x3366('0xd')]);router[_0x3366('0x9')]('/:id/users',auth[_0x3366('0xb')](),controller[_0x3366('0xe')]);router[_0x3366('0x9')](_0x3366('0xf'),auth[_0x3366('0xb')](),controller[_0x3366('0x10')]);router[_0x3366('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3366('0x11')](_0x3366('0x12'),auth[_0x3366('0xb')](),controller[_0x3366('0x13')]);router[_0x3366('0x11')](_0x3366('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0x3366('0x14')]('/:id',auth[_0x3366('0xb')](),controller[_0x3366('0x15')]);router[_0x3366('0x16')](_0x3366('0x17'),auth[_0x3366('0xb')](),controller['destroy']);router[_0x3366('0x16')](_0x3366('0x12'),auth[_0x3366('0xb')](),controller[_0x3366('0x18')]);router[_0x3366('0x16')](_0x3366('0xf'),auth['isAuthenticated'](),controller['removeTeams']);module[_0x3366('0x19')]=router; \ No newline at end of file +var _0x061c=['delete','destroy','/:id/users','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update'];(function(_0x3d3a4f,_0x22263d){var _0x67f3c6=function(_0x52a5f2){while(--_0x52a5f2){_0x3d3a4f['push'](_0x3d3a4f['shift']());}};_0x67f3c6(++_0x22263d);}(_0x061c,0xc0));var _0xc061=function(_0x243370,_0x4cbce0){_0x243370=_0x243370-0x0;var _0x4345b3=_0x061c[_0x243370];return _0x4345b3;};'use strict';var multer=require(_0xc061('0x0'));var util=require(_0xc061('0x1'));var path=require(_0xc061('0x2'));var timeout=require(_0xc061('0x3'));var express=require(_0xc061('0x4'));var router=express[_0xc061('0x5')]();var fs_extra=require(_0xc061('0x6'));var auth=require(_0xc061('0x7'));var interaction=require(_0xc061('0x8'));var config=require('../../config/environment');var controller=require(_0xc061('0x9'));router['get']('/',auth[_0xc061('0xa')](),controller[_0xc061('0xb')]);router[_0xc061('0xc')](_0xc061('0xd'),auth[_0xc061('0xa')](),controller[_0xc061('0xe')]);router[_0xc061('0xc')](_0xc061('0xf'),auth[_0xc061('0xa')](),controller['show']);router['get']('/:id/users',auth[_0xc061('0xa')](),controller[_0xc061('0x10')]);router[_0xc061('0xc')](_0xc061('0x11'),auth['isAuthenticated'](),controller[_0xc061('0x12')]);router[_0xc061('0x13')]('/',auth[_0xc061('0xa')](),controller[_0xc061('0x14')]);router['post']('/:id/users',auth[_0xc061('0xa')](),controller[_0xc061('0x15')]);router[_0xc061('0x13')](_0xc061('0x11'),auth[_0xc061('0xa')](),controller[_0xc061('0x16')]);router[_0xc061('0x17')](_0xc061('0xf'),auth[_0xc061('0xa')](),controller[_0xc061('0x18')]);router[_0xc061('0x19')](_0xc061('0xf'),auth[_0xc061('0xa')](),controller[_0xc061('0x1a')]);router['delete'](_0xc061('0x1b'),auth[_0xc061('0xa')](),controller[_0xc061('0x1c')]);router[_0xc061('0x19')](_0xc061('0x11'),auth[_0xc061('0xa')](),controller[_0xc061('0x1d')]);module[_0xc061('0x1e')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 90f5997..c3b2a85 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 _0x2b7e=['exports','name','VIRTUAL','system-','STRING'];(function(_0x1b16cf,_0x220918){var _0x1ae2d8=function(_0x344a58){while(--_0x344a58){_0x1b16cf['push'](_0x1b16cf['shift']());}};_0x1ae2d8(++_0x220918);}(_0x2b7e,0xe1));var _0xe2b7=function(_0x1b5ee3,_0x3e1f47){_0x1b5ee3=_0x1b5ee3-0x0;var _0x5abe57=_0x2b7e[_0x1b5ee3];return _0x5abe57;};'use strict';var Sequelize=require('sequelize');module[_0xe2b7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe2b7('0x1')},'prefix':{'type':Sequelize[_0xe2b7('0x2')],'get':function(_0x3b3cf5){return _0xe2b7('0x3')+this['getDataValue'](_0xe2b7('0x1'))+'-';}},'description':{'type':Sequelize[_0xe2b7('0x4')]},'callerIdAll':{'type':Sequelize[_0xe2b7('0x4')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1125=['name','VIRTUAL','getDataValue','INTEGER','exports','STRING'];(function(_0x525d35,_0xe67489){var _0x4813d2=function(_0x4a6dc8){while(--_0x4a6dc8){_0x525d35['push'](_0x525d35['shift']());}};_0x4813d2(++_0xe67489);}(_0x1125,0x1ae));var _0x5112=function(_0x478829,_0x4ef2bb){_0x478829=_0x478829-0x0;var _0x59a14a=_0x1125[_0x478829];return _0x59a14a;};'use strict';var Sequelize=require('sequelize');module[_0x5112('0x0')]={'name':{'type':Sequelize[_0x5112('0x1')],'allowNull':![],'unique':_0x5112('0x2')},'prefix':{'type':Sequelize[_0x5112('0x3')],'get':function(_0x45ec8f){return'system-'+this[_0x5112('0x4')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x5112('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x5112('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5d6e1f6..57ff3c3 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 _0xb03e=['from','team_has_voice_prefixes','join','user_has_teams','clone','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','error','stack','index','VoicePrefix','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','keys','fields','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','Agents','online','flatMap','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId'];(function(_0x438511,_0x3c02b3){var _0x2ca3a5=function(_0x4c8a7d){while(--_0x4c8a7d){_0x438511['push'](_0x438511['shift']());}};_0x2ca3a5(++_0x3c02b3);}(_0xb03e,0x1eb));var _0xeb03=function(_0x41a4e5,_0x4d20c1){_0x41a4e5=_0x41a4e5-0x0;var _0x49960d=_0xb03e[_0x41a4e5];return _0x49960d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb03('0x0'));var zipdir=require(_0xeb03('0x1'));var jsonpatch=require(_0xeb03('0x2'));var rp=require(_0xeb03('0x3'));var moment=require(_0xeb03('0x4'));var BPromise=require(_0xeb03('0x5'));var Mustache=require(_0xeb03('0x6'));var util=require(_0xeb03('0x7'));var path=require(_0xeb03('0x8'));var sox=require(_0xeb03('0x9'));var csv=require(_0xeb03('0xa'));var ejs=require(_0xeb03('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb03('0xc'));var squel=require(_0xeb03('0xd'));var crypto=require(_0xeb03('0xe'));var jsforce=require(_0xeb03('0xf'));var deskjs=require(_0xeb03('0x10'));var toCsv=require(_0xeb03('0xa'));var querystring=require('querystring');var Papa=require(_0xeb03('0x11'));var Redis=require(_0xeb03('0x12'));var authService=require(_0xeb03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb03('0x15'))(_0xeb03('0x16'));var utils=require(_0xeb03('0x17'));var config=require(_0xeb03('0x18'));var licenseUtil=require(_0xeb03('0x19'));var db=require(_0xeb03('0x1a'))['db'];config[_0xeb03('0x1b')]=_[_0xeb03('0x1c')](config[_0xeb03('0x1b')],{'host':_0xeb03('0x1d'),'port':0x18eb});var socket=require(_0xeb03('0x1e'))(new Redis(config[_0xeb03('0x1b')]));require('./voicePrefix.socket')[_0xeb03('0x1f')](socket);function respondWithStatusCode(_0x100bef,_0x372c71){_0x372c71=_0x372c71||0xcc;return function(_0x33f9ba){if(_0x33f9ba){return _0x100bef['sendStatus'](_0x372c71);}return _0x100bef[_0xeb03('0x20')](_0x372c71)[_0xeb03('0x21')]();};}function respondWithResult(_0x3f26ef,_0x478989){_0x478989=_0x478989||0xc8;return function(_0x7ce874){if(_0x7ce874){return _0x3f26ef[_0xeb03('0x20')](_0x478989)[_0xeb03('0x22')](_0x7ce874);}};}function respondWithFilteredResult(_0x44716c,_0x42fa4e){return function(_0x1b4cbd){if(_0x1b4cbd){var _0x167a33=typeof _0x42fa4e[_0xeb03('0x23')]===_0xeb03('0x24')&&typeof _0x42fa4e[_0xeb03('0x25')]===_0xeb03('0x24');var _0x2c238d=_0x1b4cbd[_0xeb03('0x26')];var _0x19bddf=_0x167a33?0x0:_0x42fa4e['offset'];var _0x1bea3f=_0x167a33?_0x1b4cbd[_0xeb03('0x26')]:_0x42fa4e[_0xeb03('0x23')]+_0x42fa4e[_0xeb03('0x25')];var _0xe5a1c2;if(_0x1bea3f>=_0x2c238d){_0x1bea3f=_0x2c238d;_0xe5a1c2=0xc8;}else{_0xe5a1c2=0xce;}_0x44716c[_0xeb03('0x20')](_0xe5a1c2);return _0x44716c[_0xeb03('0x27')](_0xeb03('0x28'),_0x19bddf+'-'+_0x1bea3f+'/'+_0x2c238d)[_0xeb03('0x22')](_0x1b4cbd);}return null;};}function patchUpdates(_0x5a704b){return function(_0x712ac2){try{jsonpatch[_0xeb03('0x29')](_0x712ac2,_0x5a704b,!![]);}catch(_0x11ea85){return BPromise[_0xeb03('0x2a')](_0x11ea85);}return _0x712ac2[_0xeb03('0x2b')]();};}function saveUpdates(_0x5dcda3,_0x638353){return function(_0x406864){if(_0x406864){return _0x406864[_0xeb03('0x2c')](_0x5dcda3)[_0xeb03('0x2d')](function(_0x3f276a){return _0x3f276a;});}return null;};}function removeEntity(_0x119697,_0xb04f34){return function(_0x3f68f3){if(_0x3f68f3){return _0x3f68f3[_0xeb03('0x2e')]()['then'](function(){var _0x832372=_0x3f68f3[_0xeb03('0x2f')]({'plain':!![]});var _0x2683f9=_0xeb03('0x30');return db['UserProfileResource']['destroy']({'where':{'type':_0x2683f9,'resourceId':_0x832372['id']}})[_0xeb03('0x2d')](function(){return _0x3f68f3;});})['then'](function(){_0x119697[_0xeb03('0x20')](0xcc)[_0xeb03('0x21')]();});}};}function handleEntityNotFound(_0x160a37,_0x5db8bb){return function(_0xd4c8ec){if(!_0xd4c8ec){_0x160a37['sendStatus'](0x194);}return _0xd4c8ec;};}function handleError(_0x5cb729,_0x49e316){_0x49e316=_0x49e316||0x1f4;return function(_0x538d19){logger[_0xeb03('0x31')](_0x538d19[_0xeb03('0x32')]);if(_0x538d19['name']){delete _0x538d19['name'];}_0x5cb729['status'](_0x49e316)['send'](_0x538d19);};}exports[_0xeb03('0x33')]=function(_0x3655c3,_0x32aff7){var _0x2d2ddd={},_0x19fa35={},_0x5234dc={'count':0x0,'rows':[]};var _0x13efc6=_['map'](db[_0xeb03('0x34')][_0xeb03('0x35')],function(_0x19ceae){return{'name':_0x19ceae[_0xeb03('0x36')],'type':_0x19ceae[_0xeb03('0x37')][_0xeb03('0x38')]};});_0x19fa35[_0xeb03('0x39')]=_[_0xeb03('0x3a')](_0x13efc6,'name');_0x19fa35[_0xeb03('0x3b')]=_['keys'](_0x3655c3[_0xeb03('0x3b')]);_0x19fa35[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x19fa35[_0xeb03('0x39')],_0x19fa35[_0xeb03('0x3b')]);_0x2d2ddd[_0xeb03('0x3e')]=_['intersection'](_0x19fa35[_0xeb03('0x39')],qs['fields'](_0x3655c3['query']['fields']));_0x2d2ddd[_0xeb03('0x3e')]=_0x2d2ddd[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x2d2ddd[_0xeb03('0x3e')]:_0x19fa35[_0xeb03('0x39')];if(!_0x3655c3['query'][_0xeb03('0x40')](_0xeb03('0x41'))){_0x2d2ddd[_0xeb03('0x25')]=qs['limit'](_0x3655c3['query'][_0xeb03('0x25')]);_0x2d2ddd[_0xeb03('0x23')]=qs[_0xeb03('0x23')](_0x3655c3['query'][_0xeb03('0x23')]);}_0x2d2ddd[_0xeb03('0x42')]=qs['sort'](_0x3655c3['query'][_0xeb03('0x43')]);_0x2d2ddd[_0xeb03('0x44')]=qs['filters'](_[_0xeb03('0x45')](_0x3655c3[_0xeb03('0x3b')],_0x19fa35[_0xeb03('0x3c')]),_0x13efc6);if(_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x2d2ddd[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x2d2ddd[_0xeb03('0x44')],{'$or':_[_0xeb03('0x3a')](_0x13efc6,function(_0x286f48){if(_0x286f48[_0xeb03('0x37')]!==_0xeb03('0x48')){var _0x2a9348={};_0x2a9348[_0x286f48[_0xeb03('0x49')]]={'$like':'%'+_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x46')]+'%'};return _0x2a9348;}})});}_0x2d2ddd=_[_0xeb03('0x47')]({},_0x2d2ddd,_0x3655c3[_0xeb03('0x4a')]);var _0x35e53d={'where':_0x2d2ddd[_0xeb03('0x44')]};return db[_0xeb03('0x34')][_0xeb03('0x26')](_0x35e53d)[_0xeb03('0x2d')](function(_0x5bb7d9){_0x5234dc['count']=_0x5bb7d9;if(_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x4b')]){_0x2d2ddd[_0xeb03('0x4c')]=[{'all':!![]}];}return db[_0xeb03('0x34')][_0xeb03('0x4d')](_0x2d2ddd);})[_0xeb03('0x2d')](function(_0x103c78){_0x5234dc[_0xeb03('0x4e')]=_0x103c78;return _0x5234dc;})['then'](respondWithFilteredResult(_0x32aff7,_0x2d2ddd))[_0xeb03('0x4f')](handleError(_0x32aff7,null));};exports[_0xeb03('0x50')]=function(_0x275d4d,_0xe9dcb0){var _0x528c0f={'raw':![],'where':{'id':_0x275d4d['params']['id']}},_0x57f59e={};_0x57f59e[_0xeb03('0x39')]=_['keys'](db['VoicePrefix']['rawAttributes']);_0x57f59e[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x275d4d[_0xeb03('0x3b')]);_0x57f59e[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x57f59e[_0xeb03('0x39')],_0x57f59e['query']);_0x528c0f[_0xeb03('0x3e')]=_['intersection'](_0x57f59e['model'],qs[_0xeb03('0x52')](_0x275d4d[_0xeb03('0x3b')][_0xeb03('0x52')]));_0x528c0f['attributes']=_0x528c0f[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x528c0f[_0xeb03('0x3e')]:_0x57f59e[_0xeb03('0x39')];if(_0x275d4d[_0xeb03('0x3b')]['includeAll']){_0x528c0f[_0xeb03('0x4c')]=[{'all':!![]}];}_0x528c0f=_['merge']({},_0x528c0f,_0x275d4d[_0xeb03('0x4a')]);return db[_0xeb03('0x34')][_0xeb03('0x53')](_0x528c0f)[_0xeb03('0x2d')](handleEntityNotFound(_0xe9dcb0,null))[_0xeb03('0x2d')](respondWithResult(_0xe9dcb0,null))[_0xeb03('0x4f')](handleError(_0xe9dcb0,null));};exports[_0xeb03('0x2e')]=function(_0x292319,_0x38c993){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x292319[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x38c993,null))[_0xeb03('0x2d')](removeEntity(_0x38c993,null))[_0xeb03('0x4f')](handleError(_0x38c993,null));};exports[_0xeb03('0x55')]=function(_0xf5c1ab,_0x79b7c6){return db[_0xeb03('0x34')][_0xeb03('0x55')]()[_0xeb03('0x2d')](respondWithResult(_0x79b7c6,null))[_0xeb03('0x4f')](handleError(_0x79b7c6,null));};exports[_0xeb03('0x56')]=function(_0x365520,_0x509d79){var _0x17112e;return db[_0xeb03('0x57')][_0xeb03('0x58')](function(_0x5405b4){return db[_0xeb03('0x34')][_0xeb03('0x56')](_0x365520[_0xeb03('0x59')],{'transaction':_0x5405b4})[_0xeb03('0x2d')](function(_0x103da5){_0x17112e=_0x103da5[_0xeb03('0x2f')]({'plain':!![]});return db[_0xeb03('0x5a')][_0xeb03('0x53')]({'where':{'id':_0x17112e[_0xeb03('0x5b')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x46f52e){return createVoicePrefixExtensions(_0x17112e,_0x46f52e,_0x5405b4);});});})[_0xeb03('0x2d')](function(){var _0xf9beaf=_0x365520[_0xeb03('0x5c')]['get']({'plain':!![]});if(!_0xf9beaf)throw new Error(_0xeb03('0x5d'));if(_0xf9beaf[_0xeb03('0x5e')]===_0xeb03('0x5c')){var _0x259db7=_0x17112e;return db[_0xeb03('0x5f')][_0xeb03('0x53')]({'where':{'name':_0xeb03('0x30'),'userProfileId':_0xf9beaf[_0xeb03('0x60')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x23406a){if(_0x23406a&&_0x23406a['autoAssociation']===0x0){return db[_0xeb03('0x61')][_0xeb03('0x56')]({'name':_0x259db7[_0xeb03('0x49')],'resourceId':_0x259db7['id'],'type':_0x23406a[_0xeb03('0x49')],'sectionId':_0x23406a['id']},{})['then'](function(){return _0x17112e;});}else{return _0x17112e;}})[_0xeb03('0x4f')](function(_0x68e1b7){logger[_0xeb03('0x31')](_0xeb03('0x62'),_0x68e1b7);throw _0x68e1b7;});}return _0x17112e;})[_0xeb03('0x2d')](respondWithResult(_0x509d79,null))['catch'](handleError(_0x509d79,null));};function Extension(_0x43efc3,_0x10beeb,_0x28e488,_0x5e1361){this[_0xeb03('0x63')]=_0xeb03('0x64');this['exten']=_0x43efc3;this[_0xeb03('0x65')]=_0x28e488;this[_0xeb03('0x37')]=_0xeb03('0x66');this['description']=_0xeb03('0x67');this[_0xeb03('0x68')]=_0x10beeb;this['appdata']=_0x5e1361;}function createVoicePrefixExtensions(_0x3eb482,_0xfeb8e2,_0x1972fb){return new BPromise(function(_0x3ac2de,_0x3963a7){var _0x38618e=new Extension(formatPrefixName(_0x3eb482[_0xeb03('0x69')]),0x1,_0xeb03('0x6a'),'Voice\x20Prefix');_0x38618e[_0xeb03('0x6b')]=_0x3eb482['id'];return db['VoiceExtension'][_0xeb03('0x56')](_0x38618e,{'transaction':_0x1972fb})[_0xeb03('0x2d')](function(_0x3a9518){var _0x59d0c7=_0x3a9518[_0xeb03('0x2f')]({'plain':!![]});var _0x1508f6=_[_0xeb03('0x3a')](addVoicePrefixExtensions(_0x3eb482,_0xfeb8e2),function(_0x467a9d){_0x467a9d['VoiceExtensionId']=_0x59d0c7['id'];_0x467a9d[_0xeb03('0x6b')]=_0x3eb482['id'];return _0x467a9d;});return db[_0xeb03('0x5a')]['bulkCreate'](_0x1508f6,{'transaction':_0x1972fb})['then'](function(_0x583518){if(!_0x583518){return _0x3963a7(_0xeb03('0x6c'));}else{return _0x3ac2de(_0x583518);}})[_0xeb03('0x4f')](function(_0x9148a6){return _0x3963a7(_0x9148a6);});});;});};function addVoicePrefixExtensions(_0x16ad3a,_0x3da5f4){var _0x461777=[];var _0x443fc9=formatPrefixName(_0x16ad3a[_0xeb03('0x69')]);_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x2,'Set','CDR(prefix)='+_0x16ad3a[_0xeb03('0x49')]));if(_0x16ad3a[_0xeb03('0x6e')]){_0x461777['push'](new Extension(_0x443fc9,0x3,_0xeb03('0x6f'),_0xeb03('0x70')+_0x16ad3a[_0xeb03('0x6e')]));}else{_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x3,'NoOp','No\x20callerid\x20available'));}_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x4,_0xeb03('0x71'),_0x3da5f4[_0xeb03('0x63')]+','+_0xeb03('0x72')+(0x8+_0x16ad3a[_0xeb03('0x49')][_0xeb03('0x3f')])+'}'+','+0x1));return _0x461777;}function formatPrefixName(_0x1a8057){var _0x2ee5c1='_';for(var _0x2e67a4=0x0;_0x2e67a4<_0x1a8057[_0xeb03('0x3f')];_0x2e67a4++){if(_0x1a8057[_0xeb03('0x73')](_0x2e67a4)=='-'){_0x2ee5c1+=_0x1a8057['charAt'](_0x2e67a4);}else{_0x2ee5c1+='['+_0x1a8057['charAt'](_0x2e67a4)+']';}}_0x2ee5c1+='.';return _0x2ee5c1;}exports[_0xeb03('0x2c')]=function(_0x4e52a4,_0x1099ff,_0x4cf4f1){var _0x30623a=_0x4e52a4['body'];_0x30623a[_0xeb03('0x69')]=_0xeb03('0x74')+_0x30623a['name']+'-';return db[_0xeb03('0x57')]['transaction'](function(_0x45f0aa){return db['VoicePrefix'][_0xeb03('0x2c')](_0x30623a,{'where':{'id':_0x30623a['id']},'transaction':_0x45f0aa})['then'](function(){return db['VoiceExtension'][_0xeb03('0x2e')]({'where':{'VoicePrefixId':_0x30623a['id']},'transaction':_0x45f0aa})[_0xeb03('0x2d')](function(){return db[_0xeb03('0x5a')][_0xeb03('0x53')]({'where':{'id':_0x30623a[_0xeb03('0x5b')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x39c15d){return createVoicePrefixExtensions(_0x30623a,_0x39c15d,_0x45f0aa);});});});})['then'](function(){return db[_0xeb03('0x34')][_0xeb03('0x75')](_0x30623a['id']);})[_0xeb03('0x2d')](respondWithResult(_0x1099ff,null))[_0xeb03('0x4f')](handleError(_0x1099ff,null));};exports[_0xeb03('0x76')]=function(_0x126a7f,_0x137a98,_0x4fff6e){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x126a7f[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x137a98,null))[_0xeb03('0x2d')](function(_0xcd7ab1){if(_0xcd7ab1){return _0xcd7ab1[_0xeb03('0x76')](_0x126a7f[_0xeb03('0x59')]['ids'],_[_0xeb03('0x77')](_0x126a7f[_0xeb03('0x59')],[_0xeb03('0x78'),'id'])||{})[_0xeb03('0x79')](function(_0x17c010){for(var _0x5ace77=0x0;_0x5ace77<_0x126a7f[_0xeb03('0x59')][_0xeb03('0x78')][_0xeb03('0x3f')];_0x5ace77+=0x1){socket[_0xeb03('0x7a')](_0xeb03('0x7b'),{'UserId':Number(_0x126a7f[_0xeb03('0x59')][_0xeb03('0x78')][_0x5ace77]),'VoicePrefixId':Number(_0x126a7f['params']['id'])});}return _0x17c010;});}})[_0xeb03('0x2d')](respondWithResult(_0x137a98,null))[_0xeb03('0x4f')](handleError(_0x137a98,null));};exports[_0xeb03('0x7c')]=function(_0x21dfab,_0x396329,_0x48dc21){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x21dfab[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x396329,null))[_0xeb03('0x2d')](function(_0x215759){if(_0x215759){return _0x215759[_0xeb03('0x7c')](_0x21dfab['query'][_0xeb03('0x78')])[_0xeb03('0x2d')](function(){if(_[_0xeb03('0x7d')](_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')])){for(var _0x388fbd=0x0;_0x388fbd<_0x21dfab['query'][_0xeb03('0x78')][_0xeb03('0x3f')];_0x388fbd+=0x1){socket[_0xeb03('0x7a')]('userVoicePrefix:remove',{'UserId':Number(_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')][_0x388fbd]),'VoicePrefixId':Number(_0x21dfab[_0xeb03('0x54')]['id'])});}}else{socket[_0xeb03('0x7a')](_0xeb03('0x7e'),{'UserId':Number(_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')]),'VoicePrefixId':Number(_0x21dfab['params']['id'])});}});}})['then'](respondWithStatusCode(_0x396329,null))[_0xeb03('0x4f')](handleError(_0x396329,null));};exports[_0xeb03('0x7f')]=function(_0x3630a7,_0xe55200,_0x511e5a){var _0x8ba377={};var _0x42c477={};var _0x5b60a4;var _0x45fd83;return db[_0xeb03('0x34')][_0xeb03('0x80')]({'where':{'id':_0x3630a7[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0xe55200,null))[_0xeb03('0x2d')](function(_0x5ea593){if(_0x5ea593){_0x5b60a4=_0x5ea593;_0x42c477[_0xeb03('0x39')]=_[_0xeb03('0x51')](db[_0xeb03('0x81')][_0xeb03('0x35')]);_0x42c477[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x3630a7[_0xeb03('0x3b')]);_0x42c477[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x42c477[_0xeb03('0x39')],_0x42c477['query']);_0x8ba377[_0xeb03('0x3e')]=_[_0xeb03('0x3d')](_0x42c477['model'],qs[_0xeb03('0x52')](_0x3630a7[_0xeb03('0x3b')]['fields']));_0x8ba377[_0xeb03('0x3e')]=_0x8ba377[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x8ba377[_0xeb03('0x3e')]:_0x42c477[_0xeb03('0x39')];_0x8ba377['order']=qs['sort'](_0x3630a7['query'][_0xeb03('0x43')]);_0x8ba377['where']=qs[_0xeb03('0x3c')](_[_0xeb03('0x45')](_0x3630a7[_0xeb03('0x3b')],_0x42c477[_0xeb03('0x3c')]));if(_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x8ba377[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x8ba377[_0xeb03('0x44')],{'$or':_[_0xeb03('0x3a')](_0x8ba377[_0xeb03('0x3e')],function(_0x27a388){var _0x4ec45c={};_0x4ec45c[_0x27a388]={'$like':'%'+_0x3630a7['query'][_0xeb03('0x46')]+'%'};return _0x4ec45c;})});}_0x8ba377=_['merge']({},_0x8ba377,_0x3630a7['options']);return _0x5b60a4[_0xeb03('0x7f')](_0x8ba377);}})[_0xeb03('0x2d')](function(_0x502b25){if(_0x502b25){_0x45fd83=_0x502b25['length'];if(!_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x40')]('nolimit')){_0x8ba377[_0xeb03('0x25')]=qs[_0xeb03('0x25')](_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x25')]);_0x8ba377[_0xeb03('0x23')]=qs['offset'](_0x3630a7[_0xeb03('0x3b')]['offset']);}return _0x5b60a4['getAgents'](_0x8ba377);}})[_0xeb03('0x2d')](function(_0x2d12eb){if(_0x2d12eb){return _0x2d12eb?{'count':_0x45fd83,'rows':_0x2d12eb}:null;}})[_0xeb03('0x2d')](respondWithResult(_0xe55200,null))[_0xeb03('0x4f')](handleError(_0xe55200,null));};exports['getTeams']=function(_0x4b59f4,_0xf9f2d3,_0x847253){var _0x70343f={};var _0x2d6225={};var _0x388642;var _0x3dc483;return db[_0xeb03('0x34')][_0xeb03('0x80')]({'where':{'id':_0x4b59f4['params']['id']}})['then'](handleEntityNotFound(_0xf9f2d3,null))[_0xeb03('0x2d')](function(_0x5741d4){if(_0x5741d4){_0x388642=_0x5741d4;_0x2d6225[_0xeb03('0x39')]=_['keys'](db[_0xeb03('0x82')][_0xeb03('0x35')]);_0x2d6225[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x4b59f4[_0xeb03('0x3b')]);_0x2d6225[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x2d6225[_0xeb03('0x39')],_0x2d6225['query']);_0x70343f['attributes']=_[_0xeb03('0x3d')](_0x2d6225[_0xeb03('0x39')],qs[_0xeb03('0x52')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x52')]));_0x70343f['attributes']=_0x70343f[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x70343f['attributes']:_0x2d6225[_0xeb03('0x39')];_0x70343f[_0xeb03('0x42')]=qs[_0xeb03('0x43')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x43')]);_0x70343f[_0xeb03('0x44')]=qs[_0xeb03('0x3c')](_[_0xeb03('0x45')](_0x4b59f4[_0xeb03('0x3b')],_0x2d6225[_0xeb03('0x3c')]));if(_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x70343f[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x70343f['where'],{'$or':_[_0xeb03('0x3a')](_0x70343f[_0xeb03('0x3e')],function(_0x4c6b85){var _0x1f3ee1={};_0x1f3ee1[_0x4c6b85]={'$like':'%'+_0x4b59f4['query'][_0xeb03('0x46')]+'%'};return _0x1f3ee1;})});}_0x70343f=_['merge']({},_0x70343f,_0x4b59f4[_0xeb03('0x4a')]);return _0x388642[_0xeb03('0x83')](_0x70343f);}})[_0xeb03('0x2d')](function(_0x1df994){if(_0x1df994){_0x3dc483=_0x1df994[_0xeb03('0x3f')];if(!_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x40')](_0xeb03('0x41'))){_0x70343f['limit']=qs[_0xeb03('0x25')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x25')]);_0x70343f[_0xeb03('0x23')]=qs['offset'](_0x4b59f4[_0xeb03('0x3b')]['offset']);}return _0x388642[_0xeb03('0x83')](_0x70343f);}})[_0xeb03('0x2d')](function(_0x423ddd){if(_0x423ddd){return _0x423ddd?{'count':_0x3dc483,'rows':_0x423ddd}:null;}})[_0xeb03('0x2d')](respondWithResult(_0xf9f2d3,null))['catch'](handleError(_0xf9f2d3,null));};exports[_0xeb03('0x84')]=function(_0x473d63,_0x1fc15a,_0x45f4d3){var _0x5095a6=_0x473d63[_0xeb03('0x59')]['ids'];var _0x4e0fd8;return db['Team'][_0xeb03('0x4d')]({'where':{'id':_0x5095a6},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb03('0x85'),'attributes':['id',_0xeb03('0x49'),_0xeb03('0x86'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x50b2c5){if(_0x50b2c5){_0x4e0fd8=_0x50b2c5;var _0x5c7f6e=_[_0xeb03('0x87')](_0x50b2c5,function(_0x392aaa){var _0x117c5e=_0x392aaa[_0xeb03('0x2f')]({'plain':!![]});return _0x117c5e[_0xeb03('0x85')];});return db[_0xeb03('0x34')]['find']({'where':{'id':_0x473d63[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](function(_0x2d8bca){return db[_0xeb03('0x57')]['transaction'](function(_0x5c49c9){return _0x2d8bca[_0xeb03('0x84')](_0x5095a6,{'transaction':_0x5c49c9})[_0xeb03('0x2d')](function(){return BPromise['each'](_0x4e0fd8,function(_0xc7a504){return db[_0xeb03('0x88')][_0xeb03('0x89')]({'TeamId':_0xc7a504['id'],'VoicePrefixId':_0x473d63[_0xeb03('0x54')]['id']},{'transaction':_0x5c49c9});});})[_0xeb03('0x2d')](function(){return BPromise[_0xeb03('0x8a')](_0x5c7f6e,function(_0x11cc99){return db['UserVoicePrefix'][_0xeb03('0x8b')]({'where':{'UserId':_0x11cc99['id'],'VoicePrefixId':_0x473d63[_0xeb03('0x54')]['id']},'transaction':_0x5c49c9});});})[_0xeb03('0x2d')](function(){_0x5c7f6e[_0xeb03('0x8c')](function(_0x1f2ebe){socket[_0xeb03('0x7a')](_0xeb03('0x7b'),{'UserId':_0x1f2ebe['id'],'VoicePrefixId':_0x2d8bca['id']});});});});});}})[_0xeb03('0x2d')](respondWithStatusCode(_0x1fc15a,null))['catch'](handleError(_0x1fc15a,null));};exports[_0xeb03('0x8d')]=function(_0x5e0e2b,_0x497a5b,_0x188d39){return db[_0xeb03('0x82')]['findAll']({'where':{'id':_0x5e0e2b[_0xeb03('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xeb03('0x81')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xeb03('0x2d')](handleEntityNotFound(_0x497a5b,null))[_0xeb03('0x2d')](function(_0xd6f37b){var _0x1522d4=_[_0xeb03('0x3a')](_0xd6f37b,'id');var _0x47b648=[];var _0x15a726=[];var _0x226569=squel[_0xeb03('0x8e')]();_0x226569[_0xeb03('0x8f')](_0xeb03('0x90'))[_0xeb03('0x91')](_0xeb03('0x92'),'tq')[_0xeb03('0x93')](_0xeb03('0x94'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('VoicePrefixId\x20=\x20?',_0x5e0e2b[_0xeb03('0x54')]['id']);for(var _0x40a6ce=0x0;_0x40a6ce<_0xd6f37b[_0xeb03('0x3f')];_0x40a6ce+=0x1){let _0x2f640d=_0xd6f37b[_0x40a6ce];for(var _0x546ebe=0x0;_0x546ebe<_0x2f640d['Agents']['length'];_0x546ebe+=0x1){let _0x3d861f=_0x2f640d[_0xeb03('0x85')][_0x546ebe];var _0x2c89c4=_0x226569[_0xeb03('0x95')]();_0x2c89c4[_0xeb03('0x44')]('ut.UserId\x20=\x20?',_0x3d861f['id']);_0x15a726[_0xeb03('0x6d')](db[_0xeb03('0x57')]['query'](_0x2c89c4[_0xeb03('0x96')](),{'type':db['sequelize']['QueryTypes'][_0xeb03('0x97')]})[_0xeb03('0x2d')](function(_0x123742){if(_0x123742['length']===0x1){return _0x3d861f['id'];}else{var _0x243689=_[_0xeb03('0x98')](_['map'](_0x123742,_0xeb03('0x99')),function(_0x5eb15a){return _['includes'](_0x1522d4,_0x5eb15a);});if(_0x243689){return _0x3d861f['id'];}}}));}}return BPromise[_0xeb03('0x9a')](_0x15a726)[_0xeb03('0x2d')](function(_0x366054){_0x47b648=_(_0x47b648)[_0xeb03('0x9b')](_0x366054)[_0xeb03('0x9c')]()[_0xeb03('0x9d')]();return db['VoicePrefix'][_0xeb03('0x53')]({'where':{'id':_0x5e0e2b[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](function(_0x1f0387){return db[_0xeb03('0x57')][_0xeb03('0x58')](function(_0xf0d912){return _0x1f0387[_0xeb03('0x8d')](_0x5e0e2b[_0xeb03('0x3b')][_0xeb03('0x78')],{'transaction':_0xf0d912})[_0xeb03('0x2d')](function(){if(!_[_0xeb03('0x9e')](_0x47b648)){return _0x1f0387[_0xeb03('0x7c')](_0x47b648,{'transaction':_0xf0d912});}})[_0xeb03('0x2d')](function(){_0x47b648[_0xeb03('0x8c')](function(_0x1a0bb5){socket[_0xeb03('0x7a')](_0xeb03('0x7e'),{'UserId':_0x1a0bb5,'VoicePrefixId':_0x1f0387['id']});});});});});});})[_0xeb03('0x2d')](respondWithStatusCode(_0x497a5b,null))[_0xeb03('0x4f')](handleError(_0x497a5b,null));}; \ No newline at end of file +var _0x7d25=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','VoicePrefix','includeAll','findAll','catch','show','include','find','describe','transaction','create','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','context','app','system','description','appdata','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','NoOp','goto','${EXTEN:','charAt','system-','sequelize','findById','addAgents','params','omit','spread','ids','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','User','getTeams','findOne','addTeams','Agents','online','interface','each','upsert','forEach','removeTeams','Team','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1e2433,_0x91114c){var _0x282b1b=function(_0x27af78){while(--_0x27af78){_0x1e2433['push'](_0x1e2433['shift']());}};_0x282b1b(++_0x91114c);}(_0x7d25,0x8a));var _0x57d2=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x7d25[_0x4dc7b9];return _0x3ab114;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57d2('0x0'));var zipdir=require(_0x57d2('0x1'));var jsonpatch=require(_0x57d2('0x2'));var rp=require(_0x57d2('0x3'));var moment=require(_0x57d2('0x4'));var BPromise=require(_0x57d2('0x5'));var Mustache=require(_0x57d2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57d2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57d2('0x8'));var squel=require(_0x57d2('0x9'));var crypto=require(_0x57d2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57d2('0xb'));var querystring=require('querystring');var Papa=require(_0x57d2('0xc'));var Redis=require(_0x57d2('0xd'));var authService=require(_0x57d2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x57d2('0xf'));var hardwareService=require(_0x57d2('0x10'));var logger=require(_0x57d2('0x11'))(_0x57d2('0x12'));var utils=require(_0x57d2('0x13'));var config=require(_0x57d2('0x14'));var licenseUtil=require(_0x57d2('0x15'));var db=require(_0x57d2('0x16'))['db'];config[_0x57d2('0x17')]=_[_0x57d2('0x18')](config[_0x57d2('0x17')],{'host':_0x57d2('0x19'),'port':0x18eb});var socket=require(_0x57d2('0x1a'))(new Redis(config[_0x57d2('0x17')]));require(_0x57d2('0x1b'))[_0x57d2('0x1c')](socket);function respondWithStatusCode(_0x5382d9,_0x5b940e){_0x5b940e=_0x5b940e||0xcc;return function(_0x6fad35){if(_0x6fad35){return _0x5382d9[_0x57d2('0x1d')](_0x5b940e);}return _0x5382d9['status'](_0x5b940e)[_0x57d2('0x1e')]();};}function respondWithResult(_0x319489,_0x4bb8f7){_0x4bb8f7=_0x4bb8f7||0xc8;return function(_0x3e12c6){if(_0x3e12c6){return _0x319489['status'](_0x4bb8f7)[_0x57d2('0x1f')](_0x3e12c6);}};}function respondWithFilteredResult(_0x4b4fe0,_0x2ab5f0){return function(_0x7d4cf1){if(_0x7d4cf1){var _0x2ecfdf=typeof _0x2ab5f0['offset']==='undefined'&&typeof _0x2ab5f0[_0x57d2('0x20')]===_0x57d2('0x21');var _0x2662cd=_0x7d4cf1[_0x57d2('0x22')];var _0x5b1b9d=_0x2ecfdf?0x0:_0x2ab5f0[_0x57d2('0x23')];var _0xcf924f=_0x2ecfdf?_0x7d4cf1['count']:_0x2ab5f0['offset']+_0x2ab5f0[_0x57d2('0x20')];var _0x326d49;if(_0xcf924f>=_0x2662cd){_0xcf924f=_0x2662cd;_0x326d49=0xc8;}else{_0x326d49=0xce;}_0x4b4fe0[_0x57d2('0x24')](_0x326d49);return _0x4b4fe0[_0x57d2('0x25')](_0x57d2('0x26'),_0x5b1b9d+'-'+_0xcf924f+'/'+_0x2662cd)[_0x57d2('0x1f')](_0x7d4cf1);}return null;};}function patchUpdates(_0x32c7c8){return function(_0x31d2cf){try{jsonpatch[_0x57d2('0x27')](_0x31d2cf,_0x32c7c8,!![]);}catch(_0x26718e){return BPromise[_0x57d2('0x28')](_0x26718e);}return _0x31d2cf[_0x57d2('0x29')]();};}function saveUpdates(_0x12ff19,_0x473df2){return function(_0x5327ea){if(_0x5327ea){return _0x5327ea[_0x57d2('0x2a')](_0x12ff19)[_0x57d2('0x2b')](function(_0x3c7de8){return _0x3c7de8;});}return null;};}function removeEntity(_0x452d5e,_0x4363b3){return function(_0x5058be){if(_0x5058be){return _0x5058be[_0x57d2('0x2c')]()[_0x57d2('0x2b')](function(){var _0x995928=_0x5058be[_0x57d2('0x2d')]({'plain':!![]});var _0x18d500=_0x57d2('0x2e');return db[_0x57d2('0x2f')]['destroy']({'where':{'type':_0x18d500,'resourceId':_0x995928['id']}})[_0x57d2('0x2b')](function(){return _0x5058be;});})[_0x57d2('0x2b')](function(){_0x452d5e[_0x57d2('0x24')](0xcc)[_0x57d2('0x1e')]();});}};}function handleEntityNotFound(_0x1957a6,_0x7c33f3){return function(_0x1dd6cb){if(!_0x1dd6cb){_0x1957a6[_0x57d2('0x1d')](0x194);}return _0x1dd6cb;};}function handleError(_0x1d2bdb,_0x2cf9d9){_0x2cf9d9=_0x2cf9d9||0x1f4;return function(_0x574589){logger[_0x57d2('0x30')](_0x574589[_0x57d2('0x31')]);if(_0x574589[_0x57d2('0x32')]){delete _0x574589[_0x57d2('0x32')];}_0x1d2bdb['status'](_0x2cf9d9)[_0x57d2('0x33')](_0x574589);};}exports[_0x57d2('0x34')]=function(_0x21152e,_0x290c2d){var _0xb3051c={},_0x40f3f2={},_0x3cbc4b={'count':0x0,'rows':[]};var _0x36c0d7=_[_0x57d2('0x35')](db['VoicePrefix'][_0x57d2('0x36')],function(_0x213c99){return{'name':_0x213c99['fieldName'],'type':_0x213c99[_0x57d2('0x37')][_0x57d2('0x38')]};});_0x40f3f2['model']=_[_0x57d2('0x35')](_0x36c0d7,_0x57d2('0x32'));_0x40f3f2[_0x57d2('0x39')]=_[_0x57d2('0x3a')](_0x21152e[_0x57d2('0x39')]);_0x40f3f2['filters']=_['intersection'](_0x40f3f2['model'],_0x40f3f2['query']);_0xb3051c[_0x57d2('0x3b')]=_[_0x57d2('0x3c')](_0x40f3f2[_0x57d2('0x3d')],qs[_0x57d2('0x3e')](_0x21152e[_0x57d2('0x39')]['fields']));_0xb3051c[_0x57d2('0x3b')]=_0xb3051c['attributes'][_0x57d2('0x3f')]?_0xb3051c[_0x57d2('0x3b')]:_0x40f3f2[_0x57d2('0x3d')];if(!_0x21152e['query'][_0x57d2('0x40')](_0x57d2('0x41'))){_0xb3051c['limit']=qs[_0x57d2('0x20')](_0x21152e[_0x57d2('0x39')][_0x57d2('0x20')]);_0xb3051c[_0x57d2('0x23')]=qs[_0x57d2('0x23')](_0x21152e[_0x57d2('0x39')]['offset']);}_0xb3051c[_0x57d2('0x42')]=qs['sort'](_0x21152e[_0x57d2('0x39')][_0x57d2('0x43')]);_0xb3051c[_0x57d2('0x44')]=qs[_0x57d2('0x45')](_[_0x57d2('0x46')](_0x21152e['query'],_0x40f3f2[_0x57d2('0x45')]),_0x36c0d7);if(_0x21152e[_0x57d2('0x39')]['filter']){_0xb3051c[_0x57d2('0x44')]=_[_0x57d2('0x47')](_0xb3051c[_0x57d2('0x44')],{'$or':_['map'](_0x36c0d7,function(_0x226e56){if(_0x226e56[_0x57d2('0x37')]!==_0x57d2('0x48')){var _0x3281c9={};_0x3281c9[_0x226e56['name']]={'$like':'%'+_0x21152e['query'][_0x57d2('0x49')]+'%'};return _0x3281c9;}})});}_0xb3051c=_[_0x57d2('0x47')]({},_0xb3051c,_0x21152e[_0x57d2('0x4a')]);var _0x5795e7={'where':_0xb3051c['where']};return db[_0x57d2('0x4b')]['count'](_0x5795e7)[_0x57d2('0x2b')](function(_0x1bb8ad){_0x3cbc4b[_0x57d2('0x22')]=_0x1bb8ad;if(_0x21152e[_0x57d2('0x39')][_0x57d2('0x4c')]){_0xb3051c['include']=[{'all':!![]}];}return db[_0x57d2('0x4b')][_0x57d2('0x4d')](_0xb3051c);})['then'](function(_0x775f8c){_0x3cbc4b['rows']=_0x775f8c;return _0x3cbc4b;})[_0x57d2('0x2b')](respondWithFilteredResult(_0x290c2d,_0xb3051c))[_0x57d2('0x4e')](handleError(_0x290c2d,null));};exports[_0x57d2('0x4f')]=function(_0x323273,_0x58aa4e){var _0x541772={'raw':![],'where':{'id':_0x323273['params']['id']}},_0x3d8256={};_0x3d8256['model']=_[_0x57d2('0x3a')](db['VoicePrefix']['rawAttributes']);_0x3d8256[_0x57d2('0x39')]=_['keys'](_0x323273[_0x57d2('0x39')]);_0x3d8256['filters']=_[_0x57d2('0x3c')](_0x3d8256['model'],_0x3d8256['query']);_0x541772[_0x57d2('0x3b')]=_[_0x57d2('0x3c')](_0x3d8256[_0x57d2('0x3d')],qs[_0x57d2('0x3e')](_0x323273[_0x57d2('0x39')][_0x57d2('0x3e')]));_0x541772['attributes']=_0x541772[_0x57d2('0x3b')][_0x57d2('0x3f')]?_0x541772[_0x57d2('0x3b')]:_0x3d8256[_0x57d2('0x3d')];if(_0x323273[_0x57d2('0x39')][_0x57d2('0x4c')]){_0x541772[_0x57d2('0x50')]=[{'all':!![]}];}_0x541772=_[_0x57d2('0x47')]({},_0x541772,_0x323273['options']);return db[_0x57d2('0x4b')][_0x57d2('0x51')](_0x541772)['then'](handleEntityNotFound(_0x58aa4e,null))[_0x57d2('0x2b')](respondWithResult(_0x58aa4e,null))['catch'](handleError(_0x58aa4e,null));};exports['destroy']=function(_0x1a1dc7,_0x31f404){return db[_0x57d2('0x4b')][_0x57d2('0x51')]({'where':{'id':_0x1a1dc7['params']['id']}})[_0x57d2('0x2b')](handleEntityNotFound(_0x31f404,null))[_0x57d2('0x2b')](removeEntity(_0x31f404,null))['catch'](handleError(_0x31f404,null));};exports['describe']=function(_0xd7c79f,_0xb02f43){return db[_0x57d2('0x4b')][_0x57d2('0x52')]()[_0x57d2('0x2b')](respondWithResult(_0xb02f43,null))[_0x57d2('0x4e')](handleError(_0xb02f43,null));};exports['create']=function(_0x4b377f,_0x5a5edb){var _0x30482c;return db['sequelize'][_0x57d2('0x53')](function(_0x2ef710){return db['VoicePrefix'][_0x57d2('0x54')](_0x4b377f[_0x57d2('0x55')],{'transaction':_0x2ef710})[_0x57d2('0x2b')](function(_0x557f79){_0x30482c=_0x557f79[_0x57d2('0x2d')]({'plain':!![]});return db[_0x57d2('0x56')][_0x57d2('0x51')]({'where':{'id':_0x30482c[_0x57d2('0x57')]},'raw':!![]})[_0x57d2('0x2b')](function(_0x2e90eb){return createVoicePrefixExtensions(_0x30482c,_0x2e90eb,_0x2ef710);});});})[_0x57d2('0x2b')](function(){var _0x2b93c4=_0x4b377f[_0x57d2('0x58')]['get']({'plain':!![]});if(!_0x2b93c4)throw new Error(_0x57d2('0x59'));if(_0x2b93c4[_0x57d2('0x5a')]===_0x57d2('0x58')){var _0x5e3289=_0x30482c;return db[_0x57d2('0x5b')][_0x57d2('0x51')]({'where':{'name':_0x57d2('0x2e'),'userProfileId':_0x2b93c4['userProfileId']},'raw':!![]})['then'](function(_0x56ddfd){if(_0x56ddfd&&_0x56ddfd[_0x57d2('0x5c')]===0x0){return db['UserProfileResource'][_0x57d2('0x54')]({'name':_0x5e3289['name'],'resourceId':_0x5e3289['id'],'type':_0x56ddfd[_0x57d2('0x32')],'sectionId':_0x56ddfd['id']},{})['then'](function(){return _0x30482c;});}else{return _0x30482c;}})[_0x57d2('0x4e')](function(_0x430f85){logger[_0x57d2('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x430f85);throw _0x430f85;});}return _0x30482c;})['then'](respondWithResult(_0x5a5edb,null))[_0x57d2('0x4e')](handleError(_0x5a5edb,null));};function Extension(_0x2c1710,_0x3b57fa,_0x227a02,_0x3e5d71){this[_0x57d2('0x5d')]='from-sip';this['exten']=_0x2c1710;this[_0x57d2('0x5e')]=_0x227a02;this[_0x57d2('0x37')]=_0x57d2('0x5f');this[_0x57d2('0x60')]='Voice\x20Prefix\x20Extension';this['priority']=_0x3b57fa;this[_0x57d2('0x61')]=_0x3e5d71;}function createVoicePrefixExtensions(_0x301e43,_0x4f6b8a,_0xad397){return new BPromise(function(_0x28fcdb,_0x15e3b6){var _0x472e5d=new Extension(formatPrefixName(_0x301e43['prefix']),0x1,'NoOp','Voice\x20Prefix');_0x472e5d['VoicePrefixId']=_0x301e43['id'];return db[_0x57d2('0x56')][_0x57d2('0x54')](_0x472e5d,{'transaction':_0xad397})[_0x57d2('0x2b')](function(_0xa57b70){var _0xd13626=_0xa57b70[_0x57d2('0x2d')]({'plain':!![]});var _0x2737ab=_['map'](addVoicePrefixExtensions(_0x301e43,_0x4f6b8a),function(_0x35808a){_0x35808a['VoiceExtensionId']=_0xd13626['id'];_0x35808a[_0x57d2('0x62')]=_0x301e43['id'];return _0x35808a;});return db['VoiceExtension'][_0x57d2('0x63')](_0x2737ab,{'transaction':_0xad397})[_0x57d2('0x2b')](function(_0x453e6c){if(!_0x453e6c){return _0x15e3b6(_0x57d2('0x64'));}else{return _0x28fcdb(_0x453e6c);}})[_0x57d2('0x4e')](function(_0x145370){return _0x15e3b6(_0x145370);});});;});};function addVoicePrefixExtensions(_0x5e697c,_0x2a481c){var _0x24d3bf=[];var _0x27b27a=formatPrefixName(_0x5e697c[_0x57d2('0x65')]);_0x24d3bf[_0x57d2('0x66')](new Extension(_0x27b27a,0x2,_0x57d2('0x67'),_0x57d2('0x68')+_0x5e697c[_0x57d2('0x32')]));if(_0x5e697c[_0x57d2('0x69')]){_0x24d3bf['push'](new Extension(_0x27b27a,0x3,_0x57d2('0x67'),'PREFIX-CALLERIDALL='+_0x5e697c['callerIdAll']));}else{_0x24d3bf['push'](new Extension(_0x27b27a,0x3,_0x57d2('0x6a'),'No\x20callerid\x20available'));}_0x24d3bf[_0x57d2('0x66')](new Extension(_0x27b27a,0x4,_0x57d2('0x6b'),_0x2a481c['context']+','+_0x57d2('0x6c')+(0x8+_0x5e697c[_0x57d2('0x32')][_0x57d2('0x3f')])+'}'+','+0x1));return _0x24d3bf;}function formatPrefixName(_0x13741f){var _0x5eb7a3='_';for(var _0x3afeb9=0x0;_0x3afeb9<_0x13741f[_0x57d2('0x3f')];_0x3afeb9++){if(_0x13741f['charAt'](_0x3afeb9)=='-'){_0x5eb7a3+=_0x13741f['charAt'](_0x3afeb9);}else{_0x5eb7a3+='['+_0x13741f[_0x57d2('0x6d')](_0x3afeb9)+']';}}_0x5eb7a3+='.';return _0x5eb7a3;}exports[_0x57d2('0x2a')]=function(_0x481c6b,_0x46c7de,_0x5a1283){var _0x360ee0=_0x481c6b[_0x57d2('0x55')];_0x360ee0[_0x57d2('0x65')]=_0x57d2('0x6e')+_0x360ee0[_0x57d2('0x32')]+'-';return db[_0x57d2('0x6f')][_0x57d2('0x53')](function(_0x3bec6f){return db[_0x57d2('0x4b')][_0x57d2('0x2a')](_0x360ee0,{'where':{'id':_0x360ee0['id']},'transaction':_0x3bec6f})[_0x57d2('0x2b')](function(){return db['VoiceExtension'][_0x57d2('0x2c')]({'where':{'VoicePrefixId':_0x360ee0['id']},'transaction':_0x3bec6f})[_0x57d2('0x2b')](function(){return db[_0x57d2('0x56')][_0x57d2('0x51')]({'where':{'id':_0x360ee0[_0x57d2('0x57')]},'raw':!![]})[_0x57d2('0x2b')](function(_0x42666b){return createVoicePrefixExtensions(_0x360ee0,_0x42666b,_0x3bec6f);});});});})[_0x57d2('0x2b')](function(){return db[_0x57d2('0x4b')][_0x57d2('0x70')](_0x360ee0['id']);})[_0x57d2('0x2b')](respondWithResult(_0x46c7de,null))[_0x57d2('0x4e')](handleError(_0x46c7de,null));};exports[_0x57d2('0x71')]=function(_0x26da1b,_0x1bf74a,_0x144229){return db['VoicePrefix'][_0x57d2('0x51')]({'where':{'id':_0x26da1b[_0x57d2('0x72')]['id']}})['then'](handleEntityNotFound(_0x1bf74a,null))[_0x57d2('0x2b')](function(_0x17b3c1){if(_0x17b3c1){return _0x17b3c1[_0x57d2('0x71')](_0x26da1b[_0x57d2('0x55')]['ids'],_[_0x57d2('0x73')](_0x26da1b['body'],['ids','id'])||{})[_0x57d2('0x74')](function(_0x4f30e8){for(var _0x282457=0x0;_0x282457<_0x26da1b[_0x57d2('0x55')][_0x57d2('0x75')][_0x57d2('0x3f')];_0x282457+=0x1){socket['emit'](_0x57d2('0x76'),{'UserId':Number(_0x26da1b[_0x57d2('0x55')][_0x57d2('0x75')][_0x282457]),'VoicePrefixId':Number(_0x26da1b[_0x57d2('0x72')]['id'])});}return _0x4f30e8;});}})[_0x57d2('0x2b')](respondWithResult(_0x1bf74a,null))[_0x57d2('0x4e')](handleError(_0x1bf74a,null));};exports[_0x57d2('0x77')]=function(_0x41ca89,_0x1d147f,_0x261850){return db['VoicePrefix'][_0x57d2('0x51')]({'where':{'id':_0x41ca89[_0x57d2('0x72')]['id']}})[_0x57d2('0x2b')](handleEntityNotFound(_0x1d147f,null))[_0x57d2('0x2b')](function(_0x468990){if(_0x468990){return _0x468990[_0x57d2('0x77')](_0x41ca89[_0x57d2('0x39')][_0x57d2('0x75')])[_0x57d2('0x2b')](function(){if(_[_0x57d2('0x78')](_0x41ca89[_0x57d2('0x39')][_0x57d2('0x75')])){for(var _0x54edaf=0x0;_0x54edaf<_0x41ca89['query'][_0x57d2('0x75')][_0x57d2('0x3f')];_0x54edaf+=0x1){socket[_0x57d2('0x79')](_0x57d2('0x7a'),{'UserId':Number(_0x41ca89[_0x57d2('0x39')]['ids'][_0x54edaf]),'VoicePrefixId':Number(_0x41ca89['params']['id'])});}}else{socket[_0x57d2('0x79')](_0x57d2('0x7a'),{'UserId':Number(_0x41ca89[_0x57d2('0x39')][_0x57d2('0x75')]),'VoicePrefixId':Number(_0x41ca89[_0x57d2('0x72')]['id'])});}});}})[_0x57d2('0x2b')](respondWithStatusCode(_0x1d147f,null))['catch'](handleError(_0x1d147f,null));};exports[_0x57d2('0x7b')]=function(_0x2f5625,_0x5bb7cd,_0x4913c0){var _0x5ac6ee={};var _0x5b3cc6={};var _0xa557d6;var _0x4a7e00;return db[_0x57d2('0x4b')]['findOne']({'where':{'id':_0x2f5625[_0x57d2('0x72')]['id']}})[_0x57d2('0x2b')](handleEntityNotFound(_0x5bb7cd,null))[_0x57d2('0x2b')](function(_0x1dbe31){if(_0x1dbe31){_0xa557d6=_0x1dbe31;_0x5b3cc6[_0x57d2('0x3d')]=_['keys'](db[_0x57d2('0x7c')][_0x57d2('0x36')]);_0x5b3cc6[_0x57d2('0x39')]=_['keys'](_0x2f5625[_0x57d2('0x39')]);_0x5b3cc6[_0x57d2('0x45')]=_[_0x57d2('0x3c')](_0x5b3cc6[_0x57d2('0x3d')],_0x5b3cc6[_0x57d2('0x39')]);_0x5ac6ee[_0x57d2('0x3b')]=_[_0x57d2('0x3c')](_0x5b3cc6['model'],qs['fields'](_0x2f5625['query'][_0x57d2('0x3e')]));_0x5ac6ee[_0x57d2('0x3b')]=_0x5ac6ee[_0x57d2('0x3b')]['length']?_0x5ac6ee[_0x57d2('0x3b')]:_0x5b3cc6[_0x57d2('0x3d')];_0x5ac6ee[_0x57d2('0x42')]=qs[_0x57d2('0x43')](_0x2f5625[_0x57d2('0x39')][_0x57d2('0x43')]);_0x5ac6ee[_0x57d2('0x44')]=qs[_0x57d2('0x45')](_['pick'](_0x2f5625[_0x57d2('0x39')],_0x5b3cc6[_0x57d2('0x45')]));if(_0x2f5625[_0x57d2('0x39')][_0x57d2('0x49')]){_0x5ac6ee['where']=_['merge'](_0x5ac6ee[_0x57d2('0x44')],{'$or':_['map'](_0x5ac6ee[_0x57d2('0x3b')],function(_0x598d62){var _0x3a35d7={};_0x3a35d7[_0x598d62]={'$like':'%'+_0x2f5625[_0x57d2('0x39')][_0x57d2('0x49')]+'%'};return _0x3a35d7;})});}_0x5ac6ee=_['merge']({},_0x5ac6ee,_0x2f5625[_0x57d2('0x4a')]);return _0xa557d6['getAgents'](_0x5ac6ee);}})[_0x57d2('0x2b')](function(_0xe71357){if(_0xe71357){_0x4a7e00=_0xe71357[_0x57d2('0x3f')];if(!_0x2f5625[_0x57d2('0x39')][_0x57d2('0x40')](_0x57d2('0x41'))){_0x5ac6ee[_0x57d2('0x20')]=qs[_0x57d2('0x20')](_0x2f5625[_0x57d2('0x39')][_0x57d2('0x20')]);_0x5ac6ee[_0x57d2('0x23')]=qs[_0x57d2('0x23')](_0x2f5625[_0x57d2('0x39')][_0x57d2('0x23')]);}return _0xa557d6[_0x57d2('0x7b')](_0x5ac6ee);}})['then'](function(_0x3a7d89){if(_0x3a7d89){return _0x3a7d89?{'count':_0x4a7e00,'rows':_0x3a7d89}:null;}})[_0x57d2('0x2b')](respondWithResult(_0x5bb7cd,null))[_0x57d2('0x4e')](handleError(_0x5bb7cd,null));};exports[_0x57d2('0x7d')]=function(_0x4d83cf,_0x93bc52,_0x362b77){var _0x2728ba={};var _0x4f6585={};var _0x34f39a;var _0x1a90cb;return db[_0x57d2('0x4b')][_0x57d2('0x7e')]({'where':{'id':_0x4d83cf[_0x57d2('0x72')]['id']}})[_0x57d2('0x2b')](handleEntityNotFound(_0x93bc52,null))[_0x57d2('0x2b')](function(_0x1ba236){if(_0x1ba236){_0x34f39a=_0x1ba236;_0x4f6585[_0x57d2('0x3d')]=_[_0x57d2('0x3a')](db['Team']['rawAttributes']);_0x4f6585[_0x57d2('0x39')]=_[_0x57d2('0x3a')](_0x4d83cf[_0x57d2('0x39')]);_0x4f6585[_0x57d2('0x45')]=_['intersection'](_0x4f6585[_0x57d2('0x3d')],_0x4f6585[_0x57d2('0x39')]);_0x2728ba[_0x57d2('0x3b')]=_[_0x57d2('0x3c')](_0x4f6585[_0x57d2('0x3d')],qs['fields'](_0x4d83cf['query']['fields']));_0x2728ba['attributes']=_0x2728ba['attributes'][_0x57d2('0x3f')]?_0x2728ba['attributes']:_0x4f6585[_0x57d2('0x3d')];_0x2728ba[_0x57d2('0x42')]=qs['sort'](_0x4d83cf[_0x57d2('0x39')]['sort']);_0x2728ba[_0x57d2('0x44')]=qs[_0x57d2('0x45')](_[_0x57d2('0x46')](_0x4d83cf[_0x57d2('0x39')],_0x4f6585['filters']));if(_0x4d83cf[_0x57d2('0x39')]['filter']){_0x2728ba['where']=_[_0x57d2('0x47')](_0x2728ba[_0x57d2('0x44')],{'$or':_[_0x57d2('0x35')](_0x2728ba[_0x57d2('0x3b')],function(_0x127224){var _0x47ee55={};_0x47ee55[_0x127224]={'$like':'%'+_0x4d83cf[_0x57d2('0x39')][_0x57d2('0x49')]+'%'};return _0x47ee55;})});}_0x2728ba=_[_0x57d2('0x47')]({},_0x2728ba,_0x4d83cf[_0x57d2('0x4a')]);return _0x34f39a[_0x57d2('0x7d')](_0x2728ba);}})[_0x57d2('0x2b')](function(_0x4773a4){if(_0x4773a4){_0x1a90cb=_0x4773a4[_0x57d2('0x3f')];if(!_0x4d83cf['query']['hasOwnProperty'](_0x57d2('0x41'))){_0x2728ba['limit']=qs[_0x57d2('0x20')](_0x4d83cf[_0x57d2('0x39')][_0x57d2('0x20')]);_0x2728ba[_0x57d2('0x23')]=qs[_0x57d2('0x23')](_0x4d83cf['query'][_0x57d2('0x23')]);}return _0x34f39a['getTeams'](_0x2728ba);}})[_0x57d2('0x2b')](function(_0x888a75){if(_0x888a75){return _0x888a75?{'count':_0x1a90cb,'rows':_0x888a75}:null;}})[_0x57d2('0x2b')](respondWithResult(_0x93bc52,null))[_0x57d2('0x4e')](handleError(_0x93bc52,null));};exports[_0x57d2('0x7f')]=function(_0x37608b,_0x5cb4b6,_0xa4b4fd){var _0x3c9d18=_0x37608b[_0x57d2('0x55')][_0x57d2('0x75')];var _0x55f7df;return db['Team']['findAll']({'where':{'id':_0x3c9d18},'attributes':['id'],'include':[{'model':db[_0x57d2('0x7c')],'as':_0x57d2('0x80'),'attributes':['id',_0x57d2('0x32'),_0x57d2('0x81'),'voicePause',_0x57d2('0x82')],'raw':!![]}]})[_0x57d2('0x2b')](function(_0x178706){if(_0x178706){_0x55f7df=_0x178706;var _0xa92185=_['flatMap'](_0x178706,function(_0x3865c7){var _0x1d9c66=_0x3865c7[_0x57d2('0x2d')]({'plain':!![]});return _0x1d9c66[_0x57d2('0x80')];});return db['VoicePrefix'][_0x57d2('0x51')]({'where':{'id':_0x37608b['params']['id']}})['then'](function(_0x5a4689){return db[_0x57d2('0x6f')][_0x57d2('0x53')](function(_0x488dcd){return _0x5a4689['addTeams'](_0x3c9d18,{'transaction':_0x488dcd})[_0x57d2('0x2b')](function(){return BPromise[_0x57d2('0x83')](_0x55f7df,function(_0x23a448){return db['TeamVoicePrefix'][_0x57d2('0x84')]({'TeamId':_0x23a448['id'],'VoicePrefixId':_0x37608b[_0x57d2('0x72')]['id']},{'transaction':_0x488dcd});});})[_0x57d2('0x2b')](function(){return BPromise[_0x57d2('0x83')](_0xa92185,function(_0xa269b5){return db['UserVoicePrefix']['findOrCreate']({'where':{'UserId':_0xa269b5['id'],'VoicePrefixId':_0x37608b[_0x57d2('0x72')]['id']},'transaction':_0x488dcd});});})[_0x57d2('0x2b')](function(){_0xa92185[_0x57d2('0x85')](function(_0x434389){socket['emit'](_0x57d2('0x76'),{'UserId':_0x434389['id'],'VoicePrefixId':_0x5a4689['id']});});});});});}})[_0x57d2('0x2b')](respondWithStatusCode(_0x5cb4b6,null))['catch'](handleError(_0x5cb4b6,null));};exports[_0x57d2('0x86')]=function(_0x29b37c,_0x531b42,_0x120e28){return db[_0x57d2('0x87')][_0x57d2('0x4d')]({'where':{'id':_0x29b37c[_0x57d2('0x39')][_0x57d2('0x75')]},'attributes':['id'],'include':[{'model':db[_0x57d2('0x7c')],'as':_0x57d2('0x80'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x531b42,null))[_0x57d2('0x2b')](function(_0x2809c1){var _0x5444bf=_[_0x57d2('0x35')](_0x2809c1,'id');var _0x3da7ba=[];var _0x2fc3b5=[];var _0x41ba89=squel['select']();_0x41ba89[_0x57d2('0x88')]('tq.TeamId')[_0x57d2('0x89')](_0x57d2('0x8a'),'tq')[_0x57d2('0x8b')](_0x57d2('0x8c'),'ut',_0x57d2('0x8d'))[_0x57d2('0x44')](_0x57d2('0x8e'),_0x29b37c[_0x57d2('0x72')]['id']);for(var _0x112218=0x0;_0x112218<_0x2809c1[_0x57d2('0x3f')];_0x112218+=0x1){let _0x57314b=_0x2809c1[_0x112218];for(var _0x3acffd=0x0;_0x3acffd<_0x57314b[_0x57d2('0x80')]['length'];_0x3acffd+=0x1){let _0x447051=_0x57314b[_0x57d2('0x80')][_0x3acffd];var _0x511494=_0x41ba89[_0x57d2('0x8f')]();_0x511494[_0x57d2('0x44')](_0x57d2('0x90'),_0x447051['id']);_0x2fc3b5[_0x57d2('0x66')](db['sequelize'][_0x57d2('0x39')](_0x511494[_0x57d2('0x91')](),{'type':db['sequelize'][_0x57d2('0x92')][_0x57d2('0x93')]})[_0x57d2('0x2b')](function(_0x13aec4){if(_0x13aec4[_0x57d2('0x3f')]===0x1){return _0x447051['id'];}else{var _0x4e3497=_[_0x57d2('0x94')](_[_0x57d2('0x35')](_0x13aec4,'TeamId'),function(_0xb122b9){return _[_0x57d2('0x95')](_0x5444bf,_0xb122b9);});if(_0x4e3497){return _0x447051['id'];}}}));}}return BPromise[_0x57d2('0x96')](_0x2fc3b5)['then'](function(_0xdc5333){_0x3da7ba=_(_0x3da7ba)[_0x57d2('0x97')](_0xdc5333)['compact']()[_0x57d2('0x98')]();return db[_0x57d2('0x4b')][_0x57d2('0x51')]({'where':{'id':_0x29b37c[_0x57d2('0x72')]['id']}})[_0x57d2('0x2b')](function(_0x456ed3){return db['sequelize'][_0x57d2('0x53')](function(_0x376cea){return _0x456ed3[_0x57d2('0x86')](_0x29b37c[_0x57d2('0x39')][_0x57d2('0x75')],{'transaction':_0x376cea})[_0x57d2('0x2b')](function(){if(!_[_0x57d2('0x99')](_0x3da7ba)){return _0x456ed3[_0x57d2('0x77')](_0x3da7ba,{'transaction':_0x376cea});}})[_0x57d2('0x2b')](function(){_0x3da7ba['forEach'](function(_0x5b7f18){socket[_0x57d2('0x79')]('userVoicePrefix:remove',{'UserId':_0x5b7f18,'VoicePrefixId':_0x456ed3['id']});});});});});});})[_0x57d2('0x2b')](respondWithStatusCode(_0x531b42,null))['catch'](handleError(_0x531b42,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 1707032..cd13b57 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 _0x425e=['../../mysqldb','VoicePrefix','save','update','emit','hasOwnProperty','hook','events'];(function(_0x4e1837,_0x4e1fec){var _0x445648=function(_0x570f62){while(--_0x570f62){_0x4e1837['push'](_0x4e1837['shift']());}};_0x445648(++_0x4e1fec);}(_0x425e,0x67));var _0xe425=function(_0x17e520,_0x5684ff){_0x17e520=_0x17e520-0x0;var _0x2bce17=_0x425e[_0x17e520];return _0x2bce17;};'use strict';var EventEmitter=require(_0xe425('0x0'));var VoicePrefix=require(_0xe425('0x1'))['db'][_0xe425('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe425('0x3'),'afterUpdate':_0xe425('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2d85dd){return function(_0x1cb950,_0xfdb66d,_0x279c1f){VoicePrefixEvents['emit'](_0x2d85dd+':'+_0x1cb950['id'],_0x1cb950);VoicePrefixEvents[_0xe425('0x5')](_0x2d85dd,_0x1cb950);_0x279c1f(null);};}for(var e in events){if(events[_0xe425('0x6')](e)){var event=events[e];VoicePrefix[_0xe425('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x782d=['hook','exports','events','../../mysqldb','update','remove','emit'];(function(_0x409fb8,_0x5ab3d3){var _0x278270=function(_0x58849c){while(--_0x58849c){_0x409fb8['push'](_0x409fb8['shift']());}};_0x278270(++_0x5ab3d3);}(_0x782d,0xe2));var _0xd782=function(_0x375ad0,_0x5528b9){_0x375ad0=_0x375ad0-0x0;var _0x202aba=_0x782d[_0x375ad0];return _0x202aba;};'use strict';var EventEmitter=require(_0xd782('0x0'));var VoicePrefix=require(_0xd782('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd782('0x2'),'afterDestroy':_0xd782('0x3')};function emitEvent(_0x4b6924){return function(_0x5bf9e1,_0x5a3f78,_0x59bdc8){VoicePrefixEvents[_0xd782('0x4')](_0x4b6924+':'+_0x5bf9e1['id'],_0x5bf9e1);VoicePrefixEvents[_0xd782('0x4')](_0x4b6924,_0x5bf9e1);_0x59bdc8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xd782('0x5')](e,emitEvent(event));}}module[_0xd782('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 5fe16a9..70aebec 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 _0xf344=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix'];(function(_0xb18de5,_0x1b045c){var _0xc960d9=function(_0x36d9a7){while(--_0x36d9a7){_0xb18de5['push'](_0xb18de5['shift']());}};_0xc960d9(++_0x1b045c);}(_0xf344,0x16c));var _0x4f34=function(_0x21dfcd,_0x235f7d){_0x21dfcd=_0x21dfcd-0x0;var _0x401831=_0xf344[_0x21dfcd];return _0x401831;};'use strict';var _=require(_0x4f34('0x0'));var util=require(_0x4f34('0x1'));var logger=require(_0x4f34('0x2'))('api');var moment=require(_0x4f34('0x3'));var BPromise=require(_0x4f34('0x4'));var rp=require(_0x4f34('0x5'));var fs=require('fs');var path=require(_0x4f34('0x6'));var rimraf=require(_0x4f34('0x7'));var config=require(_0x4f34('0x8'));var attributes=require(_0x4f34('0x9'));module[_0x4f34('0xa')]=function(_0x2bc70f,_0x441bcd){return _0x2bc70f[_0x4f34('0xb')](_0x4f34('0xc'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd11b=['VoicePrefix','lodash','util','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd11b,0x196));var _0xbd11=function(_0x44f519,_0x293a72){_0x44f519=_0x44f519-0x0;var _0x1aa4af=_0xd11b[_0x44f519];return _0x1aa4af;};'use strict';var _=require(_0xbd11('0x0'));var util=require(_0xbd11('0x1'));var logger=require('../../config/logger')(_0xbd11('0x2'));var moment=require(_0xbd11('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd11('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd11('0x5'));var config=require(_0xbd11('0x6'));var attributes=require('./voicePrefix.attributes');module[_0xbd11('0x7')]=function(_0x3ccf53,_0x38ff23){return _0x3ccf53['define'](_0xbd11('0x8'),attributes,{'tableName':'voice_prefixes','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 1c5464c..9d14f64 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 _0xb242=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','./voicePrefix.socket','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb242,0x1f3));var _0x2b24=function(_0x4d180c,_0x45c68e){_0x4d180c=_0x4d180c-0x0;var _0x49b57e=_0xb242[_0x4d180c];return _0x49b57e;};'use strict';var _=require('lodash');var util=require(_0x2b24('0x0'));var moment=require(_0x2b24('0x1'));var BPromise=require(_0x2b24('0x2'));var rs=require(_0x2b24('0x3'));var fs=require('fs');var Redis=require(_0x2b24('0x4'));var db=require(_0x2b24('0x5'))['db'];var utils=require(_0x2b24('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2b24('0x7'));var jayson=require(_0x2b24('0x8'));var client=jayson['client'][_0x2b24('0x9')]({'port':0x232a});config[_0x2b24('0xa')]=_[_0x2b24('0xb')](config['redis'],{'host':_0x2b24('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b24('0xa')]));require(_0x2b24('0xd'))['register'](socket);function respondWithRpcPromise(_0x280030,_0x56dd79,_0x24efd2){return new BPromise(function(_0x12a5cb,_0x5e219d){return client['request'](_0x280030,_0x24efd2)[_0x2b24('0xe')](function(_0x4ab047){logger[_0x2b24('0xf')](_0x2b24('0x10'),_0x56dd79,_0x2b24('0x11'));logger[_0x2b24('0x12')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x56dd79,'request\x20sent',JSON[_0x2b24('0x13')](_0x4ab047));if(_0x4ab047[_0x2b24('0x14')]){if(_0x4ab047[_0x2b24('0x14')][_0x2b24('0x15')]===0x1f4){logger[_0x2b24('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x56dd79,_0x4ab047[_0x2b24('0x14')][_0x2b24('0x16')]);return _0x5e219d(_0x4ab047['error'][_0x2b24('0x16')]);}logger[_0x2b24('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x56dd79,_0x4ab047[_0x2b24('0x14')][_0x2b24('0x16')]);return _0x12a5cb(_0x4ab047[_0x2b24('0x14')][_0x2b24('0x16')]);}else{logger['info'](_0x2b24('0x10'),_0x56dd79,_0x2b24('0x11'));_0x12a5cb(_0x4ab047[_0x2b24('0x17')]['message']);}})[_0x2b24('0x18')](function(_0xa45843){logger[_0x2b24('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x56dd79,_0xa45843);_0x5e219d(_0xa45843);});});} \ No newline at end of file +var _0xce04=['request\x20sent','debug','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','VoicePrefix,\x20%s,\x20%s'];(function(_0x44b6f8,_0x302591){var _0x32b459=function(_0x4dc28a){while(--_0x4dc28a){_0x44b6f8['push'](_0x44b6f8['shift']());}};_0x32b459(++_0x302591);}(_0xce04,0xc0));var _0x4ce0=function(_0x2ba001,_0x2e05f5){_0x2ba001=_0x2ba001-0x0;var _0x2784fa=_0xce04[_0x2ba001];return _0x2784fa;};'use strict';var _=require(_0x4ce0('0x0'));var util=require('util');var moment=require(_0x4ce0('0x1'));var BPromise=require(_0x4ce0('0x2'));var rs=require(_0x4ce0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ce0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4ce0('0x5'));var jayson=require(_0x4ce0('0x6'));var client=jayson['client'][_0x4ce0('0x7')]({'port':0x232a});config[_0x4ce0('0x8')]=_['defaults'](config[_0x4ce0('0x8')],{'host':_0x4ce0('0x9'),'port':0x18eb});var socket=require(_0x4ce0('0xa'))(new Redis(config['redis']));require(_0x4ce0('0xb'))[_0x4ce0('0xc')](socket);function respondWithRpcPromise(_0x16a386,_0x3b803f,_0x140d74){return new BPromise(function(_0x237510,_0x53bc12){return client[_0x4ce0('0xd')](_0x16a386,_0x140d74)['then'](function(_0x5715d8){logger['info'](_0x4ce0('0xe'),_0x3b803f,_0x4ce0('0xf'));logger[_0x4ce0('0x10')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x3b803f,_0x4ce0('0xf'),JSON[_0x4ce0('0x11')](_0x5715d8));if(_0x5715d8['error']){if(_0x5715d8[_0x4ce0('0x12')]['code']===0x1f4){logger[_0x4ce0('0x12')](_0x4ce0('0xe'),_0x3b803f,_0x5715d8[_0x4ce0('0x12')]['message']);return _0x53bc12(_0x5715d8[_0x4ce0('0x12')][_0x4ce0('0x13')]);}logger[_0x4ce0('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x3b803f,_0x5715d8[_0x4ce0('0x12')]['message']);return _0x237510(_0x5715d8['error'][_0x4ce0('0x13')]);}else{logger[_0x4ce0('0x14')](_0x4ce0('0xe'),_0x3b803f,_0x4ce0('0xf'));_0x237510(_0x5715d8[_0x4ce0('0x15')][_0x4ce0('0x13')]);}})[_0x4ce0('0x16')](function(_0x5eeb11){logger[_0x4ce0('0x12')](_0x4ce0('0xe'),_0x3b803f,_0x5eeb11);_0x53bc12(_0x5eeb11);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 469a20f..1011bee 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 _0x9348=['update','emit','removeListener','register','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x609108,_0x496623){var _0x157776=function(_0x4e8a0a){while(--_0x4e8a0a){_0x609108['push'](_0x609108['shift']());}};_0x157776(++_0x496623);}(_0x9348,0x10d));var _0x8934=function(_0x27008f,_0x1d94af){_0x27008f=_0x27008f-0x0;var _0x1e60e1=_0x9348[_0x27008f];return _0x1e60e1;};'use strict';var VoicePrefixEvents=require(_0x8934('0x0'));var events=[_0x8934('0x1'),_0x8934('0x2'),_0x8934('0x3')];function createListener(_0x46a231,_0x4a2577){return function(_0x34d032){_0x4a2577[_0x8934('0x4')](_0x46a231,_0x34d032);};}function removeListener(_0x5f34d7,_0x34f94c){return function(){VoicePrefixEvents[_0x8934('0x5')](_0x5f34d7,_0x34f94c);};}exports[_0x8934('0x6')]=function(_0x2bce03){for(var _0x4c70d7=0x0,_0x3ee9b9=events['length'];_0x4c70d7<_0x3ee9b9;_0x4c70d7++){var _0x284a62=events[_0x4c70d7];var _0x3734c5=createListener(_0x8934('0x7')+_0x284a62,_0x2bce03);VoicePrefixEvents['on'](_0x284a62,_0x3734c5);}}; \ No newline at end of file +var _0xe630=['./voicePrefix.events','save','update','emit','register','length','voicePrefix:'];(function(_0x4b1c4d,_0xaa863e){var _0x23a8f9=function(_0x126508){while(--_0x126508){_0x4b1c4d['push'](_0x4b1c4d['shift']());}};_0x23a8f9(++_0xaa863e);}(_0xe630,0x149));var _0x0e63=function(_0x5bb0c0,_0x5dc885){_0x5bb0c0=_0x5bb0c0-0x0;var _0xd22ddf=_0xe630[_0x5bb0c0];return _0xd22ddf;};'use strict';var VoicePrefixEvents=require(_0x0e63('0x0'));var events=[_0x0e63('0x1'),'remove',_0x0e63('0x2')];function createListener(_0x294aee,_0x45c680){return function(_0x500458){_0x45c680[_0x0e63('0x3')](_0x294aee,_0x500458);};}function removeListener(_0x219cbe,_0x42c141){return function(){VoicePrefixEvents['removeListener'](_0x219cbe,_0x42c141);};}exports[_0x0e63('0x4')]=function(_0x308039){for(var _0x356abb=0x0,_0x3e461b=events[_0x0e63('0x5')];_0x356abb<_0x3e461b;_0x356abb++){var _0x563ad9=events[_0x356abb];var _0x35e304=createListener(_0x0e63('0x6')+_0x563ad9,_0x308039);VoicePrefixEvents['on'](_0x563ad9,_0x35e304);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index e136c17..8d949ab 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x5825d3,_0x4bcf0f){var _0x251c24=function(_0x4305f3){while(--_0x4305f3){_0x5825d3['push'](_0x5825d3['shift']());}};_0x251c24(++_0x4bcf0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _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(_0xe6365b,_0x4fc855){var _0x5e6fa9=function(_0x35ce4f){while(--_0x35ce4f){_0xe6365b['push'](_0xe6365b['shift']());}};_0x5e6fa9(++_0x4fc855);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 6d253e8..2a2f5a8 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 _0x7bf1=['STRING','name','inbound','outbound','default','ENUM','ringall','leastrecent','fewestcalls','random','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','booked','rrmemory','roundrobin','includes','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','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','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports'];(function(_0x2504c0,_0x29a79c){var _0x58334a=function(_0x12415e){while(--_0x12415e){_0x2504c0['push'](_0x2504c0['shift']());}};_0x58334a(++_0x29a79c);}(_0x7bf1,0x194));var _0x17bf=function(_0x316759,_0x182f89){_0x316759=_0x316759-0x0;var _0x1bfd1e=_0x7bf1[_0x316759];return _0x1bfd1e;};'use strict';var Sequelize=require('sequelize');module[_0x17bf('0x0')]={'name':{'type':Sequelize[_0x17bf('0x1')],'allowNull':![],'unique':_0x17bf('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x17bf('0x3'),_0x17bf('0x4')),'allowNull':![],'defaultValue':_0x17bf('0x3')},'musiconhold':{'type':Sequelize[_0x17bf('0x1')],'defaultValue':_0x17bf('0x5')},'announce':{'type':Sequelize[_0x17bf('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x17bf('0x6')]('rr',_0x17bf('0x7'),_0x17bf('0x8'),_0x17bf('0x9'),_0x17bf('0xa'),'rrmemory','linear',_0x17bf('0xb'),_0x17bf('0xc')),'allowNull':![],'defaultValue':_0x17bf('0x7'),'set':function(_0x72826c){this[_0x17bf('0xd')](_0x17bf('0xe'),_0x72826c?_0x72826c:'rrmemory');},'get':function(){var _0x2ca1ff=this[_0x17bf('0xf')]('type');var _0x70ae4f=this[_0x17bf('0xf')](_0x17bf('0x10'));var _0x2cac40=this['getDataValue'](_0x17bf('0xe'));if(_0x2ca1ff===_0x17bf('0x4')){if(_0x70ae4f==='preview'){return null;}if(_0x70ae4f===_0x17bf('0x11')&&![_0x17bf('0x12'),_0x17bf('0x13')][_0x17bf('0x14')](_0x2cac40)){this[_0x17bf('0xd')](_0x17bf('0xe'),_0x17bf('0x12'));}}return _0x2cac40;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x17bf('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x17bf('0x15')](0xb)},'timeout':{'type':Sequelize[_0x17bf('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x17bf('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x17bf('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x17bf('0x6')]('yes','no'),'defaultValue':_0x17bf('0x16')},'autopause':{'type':Sequelize['ENUM']('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x17bf('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x17bf('0x6')](_0x17bf('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x17bf('0x6')](_0x17bf('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x17bf('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x17bf('0x6')](_0x17bf('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x17bf('0x6')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x17bf('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x17bf('0x6')](_0x17bf('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x17bf('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x17bf('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x17bf('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x17bf('0x6')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x17bf('0x6')](_0x17bf('0x16'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x17bf('0x6')]('yes','no',_0x17bf('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x17bf('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0x17bf('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x17bf('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x17bf('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x17bf('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x17bf('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x17bf('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x17bf('0x1')]},'queue_quantity2':{'type':Sequelize[_0x17bf('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x17bf('0x1')]},'queue_less_than':{'type':Sequelize[_0x17bf('0x1')]},'periodic_announce':{'type':Sequelize[_0x17bf('0x18')],'set':function(_0x329b05){this['setDataValue'](_0x17bf('0x19'),_0x329b05?_0x329b05[_0x17bf('0x1a')](','):[]);},'get':function(){return this['getDataValue'](_0x17bf('0x19'))?this[_0x17bf('0xf')](_0x17bf('0x19'))[_0x17bf('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x17bf('0x1')],'defaultValue':_0x17bf('0x16'),'set':function(_0x5dd2b6){this['setDataValue'](_0x17bf('0x1c'),_0x5dd2b6?_0x5dd2b6[_0x17bf('0x1a')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0x17bf('0xf')](_0x17bf('0x1c'))[_0x17bf('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x17bf('0x1')],'defaultValue':'no','set':function(_0x56c554){this[_0x17bf('0xd')]('leavewhenempty',_0x56c554?_0x56c554[_0x17bf('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0x17bf('0x1d'))?this[_0x17bf('0xf')](_0x17bf('0x1d'))[_0x17bf('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x17bf('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x17bf('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x17bf('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x17bf('0x6')](_0x17bf('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x17bf('0x1')]},'acw':{'type':Sequelize[_0x17bf('0x1e')],'defaultValue':0x0,'set':function(_0x1424b3){this[_0x17bf('0xd')](_0x17bf('0x1f'),_0x1424b3);if(_0x1424b3){if(this[_0x17bf('0xf')](_0x17bf('0x20'))<0x2){this[_0x17bf('0xd')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x17bf('0x1e')],'defaultValue':0x0,'comment':_0x17bf('0x21')},'dialMethod':{'type':Sequelize[_0x17bf('0x6')](_0x17bf('0x22'),_0x17bf('0x23'),'power','predictive',_0x17bf('0x11')),'defaultValue':_0x17bf('0x23'),'comment':_0x17bf('0x24')},'dialLimitChannel':{'type':Sequelize[_0x17bf('0x15')](0x4)[_0x17bf('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x17bf('0x26')},'dialLimitQueue':{'type':Sequelize[_0x17bf('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x17bf('0x27')](0x2)[_0x17bf('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x17bf('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x17bf('0x6')](_0x17bf('0x29'),'dropRate'),'defaultValue':_0x17bf('0x2a'),'comment':_0x17bf('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x17bf('0x27')](0x2)[_0x17bf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x17bf('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x17bf('0x15')](0x3)[_0x17bf('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x17bf('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x17bf('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x17bf('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x17bf('0x15')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x17bf('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x17bf('0x1')],'defaultValue':'tTxX','comment':_0x17bf('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x17bf('0x15')](0x3)[_0x17bf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x17bf('0x1')],'comment':_0x17bf('0x30')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x17bf('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x17bf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x17bf('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0x17bf('0x15')](0x3)[_0x17bf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x17bf('0x33')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x17bf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x17bf('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x17bf('0x15')](0x3)[_0x17bf('0x25')],'defaultValue':0x3,'comment':_0x17bf('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x17bf('0x15')](0x5)[_0x17bf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x17bf('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0x17bf('0x15')](0x3)[_0x17bf('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x17bf('0x37')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x17bf('0x38')},'dialPrefix':{'type':Sequelize[_0x17bf('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x17bf('0x6')](_0x17bf('0x39'),'never','onlyIfOpen'),'defaultValue':_0x17bf('0x39')},'dialAMDActive':{'type':Sequelize[_0x17bf('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x17bf('0x15')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x17bf('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x17bf('0x15')](0x9)[_0x17bf('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x17bf('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x17bf('0x15')](0x9)[_0x17bf('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x17bf('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x17bf('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x17bf('0x15')](0x9)[_0x17bf('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x17bf('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x17bf('0x15')](0x9)[_0x17bf('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x17bf('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x17bf('0x15')](0x9)[_0x17bf('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x17bf('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x17bf('0x15')](0x5)[_0x17bf('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x17bf('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x17bf('0x15')](0x9)[_0x17bf('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x17bf('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x17bf('0x15')](0x5)[_0x17bf('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x17bf('0x42')},'dialRecallInQueue':{'type':Sequelize[_0x17bf('0x1e')],'defaultValue':0x0,'comment':_0x17bf('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x17bf('0x6')](_0x17bf('0x44'),'ASC'),'defaultValue':_0x17bf('0x44')},'dialQueueProject2':{'type':Sequelize[_0x17bf('0x1')],'comment':_0x17bf('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x17bf('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x17bf('0x15')](0x3)[_0x17bf('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x17bf('0x45')},'dialCutDigit':{'type':Sequelize[_0x17bf('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x17bf('0x15')](0x3)[_0x17bf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x17bf('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x17bf('0x15')](0x5)[_0x17bf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x17bf('0x15')](0x3)[_0x17bf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x17bf('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x17bf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x17bf('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x17bf('0x15')](0x5)[_0x17bf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x17bf('0x49')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x17bf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x17bf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x17bf('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x17bf('0x15')](0x3)[_0x17bf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x17bf('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x17bf('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x17bf('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x17bf('0x15')],'allowNull':!![],'comment':_0x17bf('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0x17bf('0x1e')],'defaultValue':![],'comment':_0x17bf('0x4e'),'set':function(_0x5838e1){if(!_0x5838e1)this[_0x17bf('0xd')](_0x17bf('0x4f'),null);this[_0x17bf('0xd')](_0x17bf('0x50'),_0x5838e1);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x17bf('0x15')](0x3)[_0x17bf('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x17bf('0x15')](0x3)[_0x17bf('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x17bf('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x17bf('0x15')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x17bf('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0x58c0=['dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\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\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','outbound','inbound','default','ENUM','ringall','fewestcalls','random','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','booked','rrmemory','roundrobin','includes','INTEGER','yes','once','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor'];(function(_0x4ac31f,_0x3bf843){var _0x1f1926=function(_0x362de5){while(--_0x362de5){_0x4ac31f['push'](_0x4ac31f['shift']());}};_0x1f1926(++_0x3bf843);}(_0x58c0,0x6e));var _0x058c=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x58c0[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x058c('0x0')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0x058c('0x1')),'allowNull':![],'defaultValue':_0x058c('0x2')},'musiconhold':{'type':Sequelize[_0x058c('0x0')],'defaultValue':_0x058c('0x3')},'announce':{'type':Sequelize[_0x058c('0x0')],'defaultValue':''},'strategy':{'type':Sequelize[_0x058c('0x4')]('rr',_0x058c('0x5'),'leastrecent',_0x058c('0x6'),_0x058c('0x7'),'rrmemory',_0x058c('0x8'),_0x058c('0x9'),_0x058c('0xa')),'allowNull':![],'defaultValue':_0x058c('0x5'),'set':function(_0x2a9fbc){this[_0x058c('0xb')](_0x058c('0xc'),_0x2a9fbc?_0x2a9fbc:'rrmemory');},'get':function(){var _0x882495=this[_0x058c('0xd')]('type');var _0x6608ef=this[_0x058c('0xd')](_0x058c('0xe'));var _0x1392f3=this[_0x058c('0xd')](_0x058c('0xc'));if(_0x882495===_0x058c('0x1')){if(_0x6608ef==='preview'){return null;}if(_0x6608ef===_0x058c('0xf')&&![_0x058c('0x10'),_0x058c('0x11')][_0x058c('0x12')](_0x1392f3)){this[_0x058c('0xb')](_0x058c('0xc'),'rrmemory');}}return _0x1392f3;}},'servicelevel':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x058c('0x0')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x058c('0x14')},'autopause':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x14'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x058c('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x058c('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x058c('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x058c('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x058c('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x058c('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x058c('0x0')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x058c('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x058c('0x14'),'no'),'defaultValue':_0x058c('0x14')},'announce_holdtime':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x14'),'no',_0x058c('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x058c('0x0')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x058c('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x058c('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x058c('0x0')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x058c('0x0')]},'queue_youarenext':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x058c('0x0')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x058c('0x0')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0xd07f1d){this[_0x058c('0xb')](_0x058c('0x16'),_0xd07f1d?_0xd07f1d[_0x058c('0x17')](','):[]);},'get':function(){return this[_0x058c('0xd')](_0x058c('0x16'))?this['getDataValue'](_0x058c('0x16'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x058c('0x0')],'defaultValue':_0x058c('0x14'),'set':function(_0x2852dd){this[_0x058c('0xb')](_0x058c('0x18'),_0x2852dd?_0x2852dd[_0x058c('0x17')](','):undefined);},'get':function(){return this[_0x058c('0xd')](_0x058c('0x18'))?this[_0x058c('0xd')](_0x058c('0x18'))[_0x058c('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x058c('0x0')],'defaultValue':'no','set':function(_0x241316){this[_0x058c('0xb')](_0x058c('0x1a'),_0x241316?_0x241316[_0x058c('0x17')](','):undefined);},'get':function(){return this[_0x058c('0xd')]('leavewhenempty')?this[_0x058c('0xd')](_0x058c('0x1a'))[_0x058c('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x058c('0x4')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x058c('0x0')]},'description':{'type':Sequelize[_0x058c('0x0')]},'acw':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':0x0,'set':function(_0x1498de){this[_0x058c('0xb')](_0x058c('0x1c'),_0x1498de);if(_0x1498de){if(this[_0x058c('0xd')](_0x058c('0x1d'))<0x2){this[_0x058c('0xb')](_0x058c('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x058c('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':0x0,'comment':_0x058c('0x1e')},'dialMethod':{'type':Sequelize['ENUM']('preview','progressive',_0x058c('0x1f'),_0x058c('0x20'),_0x058c('0xf')),'defaultValue':_0x058c('0x21'),'comment':_0x058c('0x22')},'dialLimitChannel':{'type':Sequelize[_0x058c('0x13')](0x4)[_0x058c('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x058c('0x24')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x058c('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x058c('0x25')},'dialPowerLevel':{'type':Sequelize[_0x058c('0x26')](0x2)[_0x058c('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x27'),'dropRate'),'defaultValue':_0x058c('0x28'),'comment':_0x058c('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x058c('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x058c('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x058c('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x058c('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x058c('0x13')](0x3)[_0x058c('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x058c('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x058c('0x0')],'defaultValue':_0x058c('0x2c'),'comment':_0x058c('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x058c('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x058c('0x2e')},'dialQueueProject':{'type':Sequelize[_0x058c('0x0')],'comment':_0x058c('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x058c('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x058c('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x058c('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x058c('0x13')](0x3)[_0x058c('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x058c('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x058c('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x058c('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x058c('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x058c('0x13')](0x3)[_0x058c('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x058c('0x32')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x058c('0x33')},'dialPrefix':{'type':Sequelize[_0x058c('0x0')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x34'),_0x058c('0x35'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':0x0,'comment':_0x058c('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x058c('0x13')](0x9)[_0x058c('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x058c('0x13')](0x9)[_0x058c('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x058c('0x37')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x058c('0x13')](0x9)[_0x058c('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x058c('0x13')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x058c('0x13')](0x9)[_0x058c('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x058c('0x38')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x058c('0x39')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x058c('0x13')](0x5)[_0x058c('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x058c('0x3a')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x058c('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x058c('0x3b')},'dialRecallMeTimeout':{'type':Sequelize[_0x058c('0x13')](0x5)[_0x058c('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':0x0,'comment':_0x058c('0x3c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x058c('0x4')](_0x058c('0x3d'),_0x058c('0x3e')),'defaultValue':_0x058c('0x3d')},'dialQueueProject2':{'type':Sequelize[_0x058c('0x0')],'comment':_0x058c('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x058c('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x058c('0x3f')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x058c('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x058c('0x13')](0x3)[_0x058c('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x058c('0x40')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x058c('0x13')](0x5)[_0x058c('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x058c('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x058c('0x41')},'dialDropRetryFrequency':{'type':Sequelize[_0x058c('0x13')](0x5)[_0x058c('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x058c('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x058c('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x058c('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x058c('0x13')](0x5)[_0x058c('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x058c('0x44')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x058c('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x058c('0x45')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x058c('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x058c('0x13')](0x3)[_0x058c('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x058c('0x46')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x058c('0x13')](0x5)[_0x058c('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x058c('0x13')],'allowNull':!![],'comment':_0x058c('0x47')},'mandatoryDisposition':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':![],'comment':_0x058c('0x48'),'set':function(_0x314c1e){if(!_0x314c1e)this[_0x058c('0xb')](_0x058c('0x49'),null);this[_0x058c('0xb')](_0x058c('0x4a'),_0x314c1e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x058c('0x13')](0x3)[_0x058c('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x058c('0x1b')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 90c6e54..9e91562 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 _0x5fc3=['redis','localhost','./voiceQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','UserProfileResource','destroy','stack','name','index','VoiceQueue','fieldName','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','intersection','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','rawAttributes','fields','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','emit','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','User','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x349722,_0x491ddc){var _0x2c71b4=function(_0x571766){while(--_0x571766){_0x349722['push'](_0x349722['shift']());}};_0x2c71b4(++_0x491ddc);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0x5fc3[_0x5ef905];return _0x367808;};'use strict';var moment=require(_0x35fc('0x0'));var BPromise=require(_0x35fc('0x1'));var util=require('util');var _=require(_0x35fc('0x2'));var squel=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var qs=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('api');var config=require(_0x35fc('0x7'));var db=require(_0x35fc('0x8'))['db'];config[_0x35fc('0x9')]=_['defaults'](config['redis'],{'host':_0x35fc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35fc('0x9')]));require(_0x35fc('0xb'))[_0x35fc('0xc')](socket);function respondWithStatusCode(_0x1e5f90,_0x34ff19){_0x34ff19=_0x34ff19||0xcc;return function(_0xf9d3a6){if(_0xf9d3a6){return _0x1e5f90[_0x35fc('0xd')](_0x34ff19);}return _0x1e5f90['status'](_0x34ff19)[_0x35fc('0xe')]();};}function respondWithResult(_0x2a1084,_0x4fdca1){_0x4fdca1=_0x4fdca1||0xc8;return function(_0x471549){if(_0x471549){return _0x2a1084[_0x35fc('0xf')](_0x4fdca1)['json'](_0x471549);}};}function respondWithFilteredResult(_0xda83fb,_0x1a9f2b){return function(_0x5469f5){if(_0x5469f5){var _0x4cbe74=typeof _0x1a9f2b[_0x35fc('0x10')]==='undefined'&&typeof _0x1a9f2b[_0x35fc('0x11')]===_0x35fc('0x12');var _0x2a6ad2=_0x5469f5[_0x35fc('0x13')];var _0x38d9f2=_0x4cbe74?0x0:_0x1a9f2b['offset'];var _0x59507a=_0x4cbe74?_0x5469f5['count']:_0x1a9f2b['offset']+_0x1a9f2b[_0x35fc('0x11')];var _0x229d56;if(_0x59507a>=_0x2a6ad2){_0x59507a=_0x2a6ad2;_0x229d56=0xc8;}else{_0x229d56=0xce;}_0xda83fb[_0x35fc('0xf')](_0x229d56);return _0xda83fb[_0x35fc('0x14')](_0x35fc('0x15'),_0x38d9f2+'-'+_0x59507a+'/'+_0x2a6ad2)[_0x35fc('0x16')](_0x5469f5);}return null;};}function saveUpdates(_0x480851){return function(_0x26ba54){if(_0x26ba54){return _0x26ba54[_0x35fc('0x17')](_0x480851)['then'](function(_0x41e165){return _0x41e165;});}return null;};}function removeEntity(_0x363e47){return function(_0x2e513b){if(_0x2e513b){return _0x2e513b['destroy']()[_0x35fc('0x18')](function(){var _0x3c58ea=_0x2e513b[_0x35fc('0x19')]({'plain':!![]});var _0x488234=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b'),'ignore':![]},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d'),'ignore':![]}];var _0x20ffde=_(_0x488234)[_0x35fc('0x1e')](_0x35fc('0x1f'))[_0x35fc('0x20')](_0x35fc('0x21'))[_0x35fc('0x21')]();if(_['includes'](_0x20ffde,_0x3c58ea[_0x35fc('0x22')])){return;}var _0xd5399f=_[_0x35fc('0x23')](_0x488234,[_0x35fc('0x21'),_0x3c58ea[_0x35fc('0x22')]])['name'];return db[_0x35fc('0x24')][_0x35fc('0x25')]({'where':{'type':_0xd5399f,'resourceId':_0x3c58ea['id']}})['then'](function(){return _0x2e513b;});})[_0x35fc('0x18')](function(){_0x363e47[_0x35fc('0xf')](0xcc)[_0x35fc('0xe')]();});}};}function handleEntityNotFound(_0x51cfec){return function(_0x4086e9){if(!_0x4086e9){_0x51cfec['sendStatus'](0x194);}return _0x4086e9;};}function handleError(_0x1bf180,_0xdfab9f){_0xdfab9f=_0xdfab9f||0x1f4;return function(_0x5cb986){logger['error'](_0x5cb986[_0x35fc('0x26')]);if(_0x5cb986['name']){delete _0x5cb986[_0x35fc('0x27')];}_0x1bf180[_0x35fc('0xf')](_0xdfab9f)['send'](_0x5cb986);};}exports[_0x35fc('0x28')]=function(_0x645eac,_0x383837){var _0x9f3c8a={};var _0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x20')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x22')]['key']};});_0x9f3c8a=qs[_0x35fc('0x2b')](_0x134dfa,_0x645eac);var _0x16f067={'where':_0x9f3c8a[_0x35fc('0x2c')]};return db[_0x35fc('0x29')][_0x35fc('0x13')](_0x16f067)[_0x35fc('0x18')](function(_0x222ddb){_0x3735da[_0x35fc('0x13')]=_0x222ddb;_0x9f3c8a[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x645eac['query']);return db['VoiceQueue'][_0x35fc('0x2e')](_0x9f3c8a);})['then'](function(_0x37b394){_0x3735da[_0x35fc('0x2f')]=_0x37b394;return _0x3735da;})[_0x35fc('0x18')](respondWithFilteredResult(_0x383837,_0x9f3c8a))[_0x35fc('0x30')](handleError(_0x383837,null));};exports[_0x35fc('0x31')]=function(_0x12e78f,_0x4e43b4){var _0x3fe193={'raw':![],'where':{'id':_0x12e78f[_0x35fc('0x32')]['id']}},_0x330a14={};_0x330a14[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x29')]['rawAttributes']);_0x330a14[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x12e78f[_0x35fc('0x35')]);_0x330a14['filters']=_[_0x35fc('0x36')](_0x330a14['model'],_0x330a14[_0x35fc('0x35')]);_0x3fe193[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x330a14[_0x35fc('0x33')],qs['fields'](_0x12e78f['query']['fields']));_0x3fe193[_0x35fc('0x37')]=_0x3fe193['attributes'][_0x35fc('0x38')]?_0x3fe193['attributes']:_0x330a14[_0x35fc('0x33')];if(_0x12e78f[_0x35fc('0x35')][_0x35fc('0x39')]){_0x3fe193[_0x35fc('0x2d')]=[{'all':!![]}];}_0x3fe193=_[_0x35fc('0x3a')]({},_0x3fe193,_0x12e78f[_0x35fc('0x3b')]);return db[_0x35fc('0x29')]['find'](_0x3fe193)[_0x35fc('0x18')](handleEntityNotFound(_0x4e43b4,null))[_0x35fc('0x18')](respondWithResult(_0x4e43b4,null))['catch'](handleError(_0x4e43b4,null));};exports[_0x35fc('0x3c')]=function(_0x1ccc41,_0x1aac67){return db[_0x35fc('0x29')][_0x35fc('0x3c')](_0x1ccc41[_0x35fc('0x3d')],{})['then'](function(_0x3f6480){var _0x267858=_0x1ccc41[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x267858)throw new Error(_0x35fc('0x3f'));if(_0x267858[_0x35fc('0x40')]==='user'){var _0x237548=_0x3f6480[_0x35fc('0x19')]({'plain':!![]});var _0x43b77c=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d')}];var _0x3ec51f=_['find'](_0x43b77c,['value',_0x237548[_0x35fc('0x22')]])[_0x35fc('0x27')];return db['UserProfileSection']['find']({'where':{'name':_0x3ec51f,'userProfileId':_0x267858['userProfileId']},'raw':!![]})[_0x35fc('0x18')](function(_0x10f98b){if(_0x10f98b&&_0x10f98b['autoAssociation']===0x0){return db[_0x35fc('0x24')][_0x35fc('0x3c')]({'name':_0x237548[_0x35fc('0x27')],'resourceId':_0x237548['id'],'type':_0x10f98b[_0x35fc('0x27')],'sectionId':_0x10f98b['id']},{})['then'](function(){return _0x3f6480;});}else{return _0x3f6480;}})['catch'](function(_0x5bf2f4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bf2f4);throw _0x5bf2f4;});}return _0x3f6480;})[_0x35fc('0x18')](respondWithResult(_0x1aac67,0xc9))[_0x35fc('0x30')](handleError(_0x1aac67,null));};exports['clone']=function(_0x119925,_0x56cf1f){var _0x13d16c={'where':{'id':_0x119925[_0x35fc('0x32')]['id']}},_0x40797d={};_0x40797d[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['VoiceQueue'][_0x35fc('0x41')]);_0x13d16c[_0x35fc('0x37')]=_['intersection'](_0x40797d[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x119925[_0x35fc('0x35')][_0x35fc('0x42')]));_0x13d16c['attributes']=_0x13d16c[_0x35fc('0x37')]['length']?_0x13d16c['attributes']:_0x40797d[_0x35fc('0x33')];if(_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]){_0x13d16c[_0x35fc('0x2d')]=[{'all':!![]}];}_0x13d16c=_[_0x35fc('0x3a')]({},_0x13d16c,_0x119925[_0x35fc('0x3b')]);return db[_0x35fc('0x29')][_0x35fc('0x23')](_0x13d16c)['then'](handleEntityNotFound(_0x56cf1f,null))[_0x35fc('0x18')](function(_0x91d7c0){if(_0x91d7c0){var _0xeca02e=_0x91d7c0[_0x35fc('0x19')]({'plain':!![]});_0xeca02e=qs[_0x35fc('0x43')](_0xeca02e,['id',_0x35fc('0x44'),_0x35fc('0x45')]);_0x119925[_0x35fc('0x3d')]=_[_0x35fc('0x43')](_0x119925[_0x35fc('0x3d')],['id',_0x35fc('0x44'),_0x35fc('0x45')]);return db[_0x35fc('0x29')][_0x35fc('0x3c')](_['merge'](_0xeca02e,_0x119925['body']),{'include':_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]?[{'all':!![]}]:undefined})[_0x35fc('0x18')](function(_0x2bf0b0){var _0x3ee296=_0x119925[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x3ee296)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ee296[_0x35fc('0x40')]===_0x35fc('0x3e')){var _0x395d63=_0x2bf0b0[_0x35fc('0x19')]({'plain':!![]});var _0x5b2595=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':'QueueCampaigns','value':_0x35fc('0x1d')}];var _0x2536d3=_['find'](_0x5b2595,[_0x35fc('0x21'),_0x395d63[_0x35fc('0x22')]])[_0x35fc('0x27')];return db[_0x35fc('0x46')]['find']({'where':{'name':_0x2536d3,'userProfileId':_0x3ee296['userProfileId']},'raw':!![]})['then'](function(_0x240338){if(_0x240338&&_0x240338[_0x35fc('0x47')]===0x0){return db['UserProfileResource'][_0x35fc('0x3c')]({'name':_0x395d63[_0x35fc('0x27')],'resourceId':_0x395d63['id'],'type':_0x240338[_0x35fc('0x27')],'sectionId':_0x240338['id']},{})[_0x35fc('0x18')](function(){return _0x2bf0b0;});}else{return _0x2bf0b0;}})[_0x35fc('0x30')](function(_0x538be0){logger[_0x35fc('0x48')](_0x35fc('0x49'),_0x538be0);throw _0x538be0;});}return _0x2bf0b0;});}})[_0x35fc('0x18')](respondWithResult(_0x56cf1f,0xc9))['catch'](handleError(_0x56cf1f,null));};exports[_0x35fc('0x17')]=function(_0x1dbf5a,_0x47fb1a){if(_0x1dbf5a[_0x35fc('0x3d')]['id']){delete _0x1dbf5a[_0x35fc('0x3d')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x1dbf5a[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x47fb1a,null))[_0x35fc('0x18')](saveUpdates(_0x1dbf5a[_0x35fc('0x3d')],null))['then'](respondWithResult(_0x47fb1a,null))[_0x35fc('0x30')](handleError(_0x47fb1a,null));};exports[_0x35fc('0x25')]=function(_0x303927,_0x4fabd4){return db[_0x35fc('0x29')]['find']({'where':{'id':_0x303927['params']['id']}})['then'](handleEntityNotFound(_0x4fabd4,null))[_0x35fc('0x18')](removeEntity(_0x4fabd4,null))[_0x35fc('0x30')](handleError(_0x4fabd4,null));};exports[_0x35fc('0x4a')]=function(_0x13901c,_0x3d06b8){var _0x4bbea0={'raw':![],'where':{}};var _0x579f5a={};var _0x5353ea={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x13901c[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3d06b8,null))[_0x35fc('0x18')](function(_0x3ef680){if(_0x3ef680){_0x579f5a['model']=_[_0x35fc('0x34')](db[_0x35fc('0x4b')][_0x35fc('0x41')]);_0x579f5a[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x13901c[_0x35fc('0x35')]);_0x579f5a[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x579f5a[_0x35fc('0x33')],_0x579f5a['query']);_0x4bbea0[_0x35fc('0x37')]=_['intersection'](_0x579f5a[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x13901c[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4bbea0['attributes']=_0x4bbea0[_0x35fc('0x37')]['length']?_0x4bbea0['attributes']:_0x579f5a['model'];if(!_0x13901c[_0x35fc('0x35')]['hasOwnProperty'](_0x35fc('0x4d'))){_0x4bbea0['limit']=qs[_0x35fc('0x11')](_0x13901c['query'][_0x35fc('0x11')]);_0x4bbea0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x13901c[_0x35fc('0x35')]['offset']);}_0x4bbea0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x13901c[_0x35fc('0x35')]['sort']);_0x4bbea0[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x13901c[_0x35fc('0x35')],_0x579f5a[_0x35fc('0x4c')]));_0x4bbea0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3ef680['id'];if(_0x13901c[_0x35fc('0x35')]['filter']){_0x4bbea0[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x4bbea0[_0x35fc('0x2c')],{'$or':_['map'](_0x4bbea0[_0x35fc('0x37')],function(_0x1b76f0){var _0x586729={};_0x586729[_0x1b76f0]={'$like':'%'+_0x13901c['query'][_0x35fc('0x1e')]+'%'};return _0x586729;})});}_0x4bbea0=_['merge']({},_0x4bbea0,_0x13901c[_0x35fc('0x3b')]);return db[_0x35fc('0x4b')][_0x35fc('0x13')]({'where':_0x4bbea0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x20ddc6){_0x5353ea[_0x35fc('0x13')]=_0x20ddc6;if(_0x13901c[_0x35fc('0x35')][_0x35fc('0x39')]){_0x4bbea0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x4b')][_0x35fc('0x2e')](_0x4bbea0);})[_0x35fc('0x18')](function(_0x9f034e){_0x5353ea[_0x35fc('0x2f')]=_0x9f034e;return _0x5353ea;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x3d06b8,_0x4bbea0))[_0x35fc('0x30')](handleError(_0x3d06b8,null));};exports[_0x35fc('0x52')]=function(_0x3b2160,_0x3f3f36){var _0x4ba1b0={'raw':!![],'where':{}};var _0x1797d0={};var _0x55cb69={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x3b2160[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3f3f36,null))[_0x35fc('0x18')](function(_0x3f56f4){if(_0x3f56f4){_0x1797d0[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x54')][_0x35fc('0x41')]);_0x1797d0[_0x35fc('0x35')]=_['keys'](_0x3b2160[_0x35fc('0x35')]);_0x1797d0[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1797d0[_0x35fc('0x33')],_0x1797d0[_0x35fc('0x35')]);_0x4ba1b0[_0x35fc('0x37')]=_['intersection'](_0x1797d0[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4ba1b0[_0x35fc('0x37')]=_0x4ba1b0[_0x35fc('0x37')][_0x35fc('0x38')]?_0x4ba1b0[_0x35fc('0x37')]:_0x1797d0[_0x35fc('0x33')];if(!_0x3b2160['query'][_0x35fc('0x55')]('nolimit')){_0x4ba1b0[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x3b2160['query'][_0x35fc('0x11')]);_0x4ba1b0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x4ba1b0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x4ba1b0['where']=qs['filters'](_['pick'](_0x3b2160['query'],_0x1797d0[_0x35fc('0x4c')]));_0x4ba1b0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3f56f4['id'];if(_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x4ba1b0['where']=_[_0x35fc('0x3a')](_0x4ba1b0[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x4ba1b0[_0x35fc('0x37')],function(_0x584a58){var _0x15e936={};_0x15e936[_0x584a58]={'$like':'%'+_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x15e936;})});}_0x4ba1b0=_['merge']({},_0x4ba1b0,_0x3b2160[_0x35fc('0x3b')]);return db[_0x35fc('0x54')][_0x35fc('0x13')]({'where':_0x4ba1b0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x31d276){_0x55cb69[_0x35fc('0x13')]=_0x31d276;if(_0x3b2160[_0x35fc('0x35')]['includeAll']){_0x4ba1b0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x54')][_0x35fc('0x2e')](_0x4ba1b0);})[_0x35fc('0x18')](function(_0x221c5b){_0x55cb69[_0x35fc('0x2f')]=_0x221c5b;return _0x55cb69;});}})['then'](respondWithFilteredResult(_0x3f3f36,_0x4ba1b0))[_0x35fc('0x30')](handleError(_0x3f3f36,null));};exports['getHopperFinals']=function(_0x4855ee,_0x1a2da0){var _0x597670={'raw':!![],'where':{}};var _0x1246c7={};var _0x233b7d={'count':0x0,'rows':[]};return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x4855ee[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x1a2da0,null))[_0x35fc('0x18')](function(_0x1beb46){if(_0x1beb46){_0x1246c7[_0x35fc('0x33')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x1246c7[_0x35fc('0x35')]=_['keys'](_0x4855ee[_0x35fc('0x35')]);_0x1246c7[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],_0x1246c7['query']);_0x597670[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],qs['fields'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x42')]));_0x597670[_0x35fc('0x37')]=_0x597670['attributes']['length']?_0x597670['attributes']:_0x1246c7[_0x35fc('0x33')];if(!_0x4855ee[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x597670['limit']=qs[_0x35fc('0x11')](_0x4855ee[_0x35fc('0x35')]['limit']);_0x597670['offset']=qs[_0x35fc('0x10')](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x597670['order']=qs['sort'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x597670['where']=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4855ee[_0x35fc('0x35')],_0x1246c7['filters']));_0x597670[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x1beb46['id'];if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x597670['where']=_[_0x35fc('0x3a')](_0x597670[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x597670['attributes'],function(_0x96dfc){var _0x26d242={};_0x26d242[_0x96dfc]={'$like':'%'+_0x4855ee[_0x35fc('0x35')]['filter']+'%'};return _0x26d242;})});}_0x597670=_[_0x35fc('0x3a')]({},_0x597670,_0x4855ee[_0x35fc('0x3b')]);return db['CmHopperFinal'][_0x35fc('0x13')]({'where':_0x597670[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x45eaae){_0x233b7d[_0x35fc('0x13')]=_0x45eaae;if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x39')]){_0x597670[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x56')]['findAll'](_0x597670);})[_0x35fc('0x18')](function(_0x3fc6cc){_0x233b7d[_0x35fc('0x2f')]=_0x3fc6cc;return _0x233b7d;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x1a2da0,_0x597670))['catch'](handleError(_0x1a2da0,null));};exports[_0x35fc('0x57')]=function(_0x1808a3,_0x209d7a){var _0x7b633a={'raw':!![],'where':{}};var _0x4684b6={};var _0x319998={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x1808a3['params']['id']}})['then'](handleEntityNotFound(_0x209d7a,null))[_0x35fc('0x18')](function(_0xafa771){if(_0xafa771){_0x4684b6[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x58')][_0x35fc('0x41')]);_0x4684b6[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x1808a3['query']);_0x4684b6['filters']=_[_0x35fc('0x36')](_0x4684b6['model'],_0x4684b6[_0x35fc('0x35')]);_0x7b633a[_0x35fc('0x37')]=_['intersection'](_0x4684b6['model'],qs[_0x35fc('0x42')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x42')]));_0x7b633a['attributes']=_0x7b633a[_0x35fc('0x37')][_0x35fc('0x38')]?_0x7b633a[_0x35fc('0x37')]:_0x4684b6['model'];if(!_0x1808a3[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x7b633a[_0x35fc('0x11')]=qs['limit'](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x11')]);_0x7b633a[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x7b633a['order']=qs[_0x35fc('0x4f')](_0x1808a3[_0x35fc('0x35')]['sort']);_0x7b633a[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_['pick'](_0x1808a3[_0x35fc('0x35')],_0x4684b6[_0x35fc('0x4c')]));_0x7b633a[_0x35fc('0x2c')][_0x35fc('0x51')]=_0xafa771['id'];if(_0x1808a3[_0x35fc('0x35')]['filter']){_0x7b633a[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x7b633a[_0x35fc('0x2c')],{'$or':_['map'](_0x7b633a[_0x35fc('0x37')],function(_0x5a8641){var _0x58d3d5={};_0x58d3d5[_0x5a8641]={'$like':'%'+_0x1808a3[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x58d3d5;})});}_0x7b633a=_[_0x35fc('0x3a')]({},_0x7b633a,_0x1808a3[_0x35fc('0x3b')]);return db[_0x35fc('0x58')]['count']({'where':_0x7b633a[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x44683e){_0x319998['count']=_0x44683e;if(_0x1808a3[_0x35fc('0x35')][_0x35fc('0x39')]){_0x7b633a[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x58')][_0x35fc('0x2e')](_0x7b633a);})['then'](function(_0x1a2d73){_0x319998[_0x35fc('0x2f')]=_0x1a2d73;return _0x319998;});}})['then'](respondWithFilteredResult(_0x209d7a,_0x7b633a))['catch'](handleError(_0x209d7a,null));};exports[_0x35fc('0x59')]=function(_0x44b356,_0x207336){var _0x2b16b2={};var _0x405a43={};var _0x2b2a87;var _0x8c80ca;return db['VoiceQueue']['findOne']({'where':{'id':_0x44b356[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x207336,null))[_0x35fc('0x18')](function(_0x1a92fa){if(_0x1a92fa){_0x2b2a87=_0x1a92fa;_0x405a43[_0x35fc('0x33')]=_['keys'](db['Team'][_0x35fc('0x41')]);_0x405a43[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x44b356[_0x35fc('0x35')]);_0x405a43['filters']=_['intersection'](_0x405a43[_0x35fc('0x33')],_0x405a43[_0x35fc('0x35')]);_0x2b16b2[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x405a43['model'],qs['fields'](_0x44b356[_0x35fc('0x35')][_0x35fc('0x42')]));_0x2b16b2['attributes']=_0x2b16b2[_0x35fc('0x37')][_0x35fc('0x38')]?_0x2b16b2[_0x35fc('0x37')]:_0x405a43[_0x35fc('0x33')];_0x2b16b2[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x44b356[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x2b16b2[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x44b356[_0x35fc('0x35')],_0x405a43[_0x35fc('0x4c')]));if(_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x2b16b2[_0x35fc('0x2c')]=_['merge'](_0x2b16b2[_0x35fc('0x2c')],{'$or':_['map'](_0x2b16b2[_0x35fc('0x37')],function(_0x5d677a){var _0x5aa072={};_0x5aa072[_0x5d677a]={'$like':'%'+_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x5aa072;})});}_0x2b16b2=_[_0x35fc('0x3a')]({},_0x2b16b2,_0x44b356['options']);return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})[_0x35fc('0x18')](function(_0xe9c7c2){if(_0xe9c7c2){_0x8c80ca=_0xe9c7c2[_0x35fc('0x38')];if(!_0x44b356[_0x35fc('0x35')][_0x35fc('0x55')]('nolimit')){_0x2b16b2['limit']=qs[_0x35fc('0x11')](_0x44b356['query']['limit']);_0x2b16b2[_0x35fc('0x10')]=qs['offset'](_0x44b356['query']['offset']);}return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})['then'](function(_0x355154){if(_0x355154){return _0x355154?{'count':_0x8c80ca,'rows':_0x355154}:null;}})[_0x35fc('0x18')](respondWithResult(_0x207336,null))[_0x35fc('0x30')](handleError(_0x207336,null));};exports[_0x35fc('0x5a')]=function(_0x392212,_0x201dfa){var _0x4ab6f9=_0x392212['body'][_0x35fc('0x5b')];var _0x5994ec=_[_0x35fc('0x20')](_0x4ab6f9,'id');return db[_0x35fc('0x5c')]['findAll']({'where':{'id':_0x5994ec},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]}]})[_0x35fc('0x18')](function(_0x28525f){if(_0x28525f){var _0x9116b1=_[_0x35fc('0x60')](_0x28525f,function(_0x4818ea){var _0x5436a3=_0x4818ea['get']({'plain':!![]});_0x5436a3['Agents'][_0x35fc('0x61')](function(_0x4c9c90){_0x4c9c90[_0x35fc('0x62')]=_['find'](_0x4ab6f9,{'id':_0x5436a3['id']})[_0x35fc('0x62')];});return _0x5436a3[_0x35fc('0x63')];});return db['VoiceQueue']['find']({'where':{'id':_0x392212[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x10ef95){return db[_0x35fc('0x64')][_0x35fc('0x65')](function(_0x4ff80c){return _0x10ef95['addTeams'](_0x5994ec,{'transaction':_0x4ff80c})[_0x35fc('0x18')](function(){return BPromise['each'](_0x4ab6f9,function(_0x15b6be){return db['TeamVoiceQueue'][_0x35fc('0x66')]({'TeamId':_0x15b6be['id'],'VoiceQueueId':_0x392212[_0x35fc('0x32')]['id'],'penalty':_0x15b6be[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_0x9116b1,function(_0x29a77a){return db['UserVoiceQueue'][_0x35fc('0x67')]({'where':{'UserId':_0x29a77a['id'],'VoiceQueueId':_0x392212['params']['id']},'defaults':{'penalty':_0x29a77a['penalty']},'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_[_0x35fc('0x1e')](_0x9116b1,{'online':!![]}),function(_0x2c8361){return db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x2c8361[_0x35fc('0x27')],'UserId':_0x2c8361['id'],'queue_name':_0x10ef95[_0x35fc('0x27')],'VoiceQueueId':_0x10ef95['id'],'interface':_[_0x35fc('0x69')](_0x2c8361[_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x2c8361[_0x35fc('0x27')]):_0x2c8361[_0x35fc('0x5f')],'paused':_0x2c8361[_0x35fc('0x5e')]||![],'penalty':_0x2c8361[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){_0x9116b1[_0x35fc('0x61')](function(_0x4020ae){socket[_0x35fc('0x6b')]('userVoiceQueue:save',{'UserId':_0x4020ae['id'],'VoiceQueueId':_0x10ef95['id']});});});});});}})['then'](respondWithStatusCode(_0x201dfa,null))['catch'](handleError(_0x201dfa,null));};exports['removeTeams']=function(_0x5c8419,_0x271087){return db[_0x35fc('0x5c')][_0x35fc('0x2e')]({'where':{'id':_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x35fc('0x63'),'attributes':['id'],'raw':!![]}]})[_0x35fc('0x18')](handleEntityNotFound(_0x271087,null))[_0x35fc('0x18')](function(_0x2f450e){var _0x370e99=_['map'](_0x2f450e,'id');var _0x195ca3=[];var _0x398359=[];var _0x4188bc=squel['select']();_0x4188bc[_0x35fc('0x6d')](_0x35fc('0x6e'))[_0x35fc('0x6f')](_0x35fc('0x70'),'tq')[_0x35fc('0x71')](_0x35fc('0x72'),'ut',_0x35fc('0x73'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0x5c8419[_0x35fc('0x32')]['id']);for(var _0x3aba1c=0x0;_0x3aba1c<_0x2f450e[_0x35fc('0x38')];_0x3aba1c+=0x1){let _0x225eb1=_0x2f450e[_0x3aba1c];for(var _0x206f0b=0x0;_0x206f0b<_0x225eb1[_0x35fc('0x63')]['length'];_0x206f0b+=0x1){let _0x4ae3d8=_0x225eb1[_0x35fc('0x63')][_0x206f0b];var _0x6a0c44=_0x4188bc[_0x35fc('0x75')]();_0x6a0c44[_0x35fc('0x2c')](_0x35fc('0x76'),_0x4ae3d8['id']);_0x398359[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x6a0c44[_0x35fc('0x78')](),{'type':db[_0x35fc('0x64')][_0x35fc('0x79')][_0x35fc('0x7a')]})[_0x35fc('0x18')](function(_0x336c4a){if(_0x336c4a[_0x35fc('0x38')]===0x1){return _0x4ae3d8['id'];}else{var _0x5824a0=_[_0x35fc('0x7b')](_[_0x35fc('0x20')](_0x336c4a,_0x35fc('0x7c')),function(_0x34e007){return _[_0x35fc('0x7d')](_0x370e99,_0x34e007);});if(_0x5824a0){return _0x4ae3d8['id'];}}}));}}return BPromise[_0x35fc('0x7e')](_0x398359)[_0x35fc('0x18')](function(_0xa4c51a){_0x195ca3=_(_0x195ca3)['union'](_0xa4c51a)['compact']()[_0x35fc('0x21')]();return db[_0x35fc('0x29')]['find']({'where':{'id':_0x5c8419[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x43a794){return db[_0x35fc('0x64')]['transaction'](function(_0x42912c){return _0x43a794[_0x35fc('0x7f')](_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')],{'transaction':_0x42912c})['then'](function(){if(!_[_0x35fc('0x80')](_0x195ca3)){return _0x43a794[_0x35fc('0x81')](_0x195ca3,{'transaction':_0x42912c})['then'](function(){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0x5c8419[_0x35fc('0x32')]['id'],'UserId':_0x195ca3},'transaction':_0x42912c});});}})['then'](function(){_0x195ca3[_0x35fc('0x61')](function(_0x4de072){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':_0x4de072,'VoiceQueueId':_0x43a794['id']});});});});});});})['then'](respondWithStatusCode(_0x271087,null))[_0x35fc('0x30')](handleError(_0x271087,null));};exports[_0x35fc('0x83')]=function(_0x139065,_0x25aedf){var _0x316d37,_0x3fd897;return db[_0x35fc('0x29')]['find']({'where':{'id':_0x139065['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x25aedf,null))[_0x35fc('0x18')](function(_0x2463dd){if(_0x2463dd){_0x3fd897=_0x2463dd;return _0x2463dd[_0x35fc('0x83')](_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x139065['body'],[_0x35fc('0x6c'),'id'])||{})[_0x35fc('0x84')](function(_0x46b9b6){for(var _0x4cdc31=0x0;_0x4cdc31<_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x35fc('0x38')];_0x4cdc31+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x85'),{'UserId':Number(_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x4cdc31]),'VoiceQueueId':Number(_0x139065[_0x35fc('0x32')]['id'])});}return _0x46b9b6;});}})[_0x35fc('0x18')](function(_0x14e414){_0x316d37=_0x14e414||[];if(_0x3fd897){return db[_0x35fc('0x86')][_0x35fc('0x2e')]({'where':{'id':_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')]},'attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]});}})[_0x35fc('0x18')](function(_0x4949ed){if(!_[_0x35fc('0x80')](_0x4949ed)){var _0x4f74ff=[];for(var _0x28cbc8=0x0;_0x28cbc8<_0x4949ed[_0x35fc('0x38')];_0x28cbc8++){if(_0x4949ed[_0x28cbc8]['online']){_0x4f74ff[_0x35fc('0x77')](db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x4949ed[_0x28cbc8][_0x35fc('0x27')],'UserId':_0x4949ed[_0x28cbc8]['id'],'queue_name':_0x3fd897[_0x35fc('0x27')],'VoiceQueueId':_0x3fd897['id'],'interface':_[_0x35fc('0x69')](_0x4949ed[_0x28cbc8][_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x4949ed[_0x28cbc8][_0x35fc('0x27')]):_0x4949ed[_0x28cbc8][_0x35fc('0x5f')],'paused':_0x4949ed[_0x28cbc8][_0x35fc('0x5e')]||![],'penalty':_0x139065[_0x35fc('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4f74ff);}})['then'](function(){return _0x316d37;})['then'](respondWithResult(_0x25aedf,null))[_0x35fc('0x30')](handleError(_0x25aedf,null));};exports['removeAgents']=function(_0xcbabdf,_0x2475d6){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0xcbabdf[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x2475d6,null))[_0x35fc('0x18')](function(_0x41cbaa){if(_0x41cbaa){return _0x41cbaa[_0x35fc('0x81')](_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')])[_0x35fc('0x18')](function(){if(_[_0x35fc('0x87')](_0xcbabdf['query'][_0x35fc('0x6c')])){for(var _0x3e8580=0x0;_0x3e8580<_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]['length'];_0x3e8580+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')][_0x3e8580]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}}else{socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}});}})[_0x35fc('0x18')](function(_0xa39c4c){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0xcbabdf[_0x35fc('0x32')]['id'],'UserId':_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]}})[_0x35fc('0x18')](function(){return _0xa39c4c;});})[_0x35fc('0x18')](respondWithStatusCode(_0x2475d6,null))[_0x35fc('0x30')](handleError(_0x2475d6,null));};exports[_0x35fc('0x88')]=function(_0x11d0f4,_0x4f150a){var _0x12238e={};var _0x16b52f={};var _0x238242;var _0x452f30;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x11d0f4[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x4f150a,null))[_0x35fc('0x18')](function(_0x156c24){if(_0x156c24){_0x238242=_0x156c24;_0x16b52f[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x86')][_0x35fc('0x41')]);_0x16b52f[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x11d0f4[_0x35fc('0x35')]);_0x16b52f[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],_0x16b52f[_0x35fc('0x35')]);_0x12238e[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x42')]));_0x12238e[_0x35fc('0x37')]=_0x12238e['attributes'][_0x35fc('0x38')]?_0x12238e[_0x35fc('0x37')]:_0x16b52f[_0x35fc('0x33')];_0x12238e['order']=qs[_0x35fc('0x4f')](_0x11d0f4[_0x35fc('0x35')]['sort']);_0x12238e['where']=qs['filters'](_[_0x35fc('0x50')](_0x11d0f4[_0x35fc('0x35')],_0x16b52f['filters']));if(_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x12238e[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x12238e[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x12238e['attributes'],function(_0x13534c){var _0x3be339={};_0x3be339[_0x13534c]={'$like':'%'+_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x3be339;})});}_0x12238e=_[_0x35fc('0x3a')]({},_0x12238e,_0x11d0f4['options']);return _0x238242[_0x35fc('0x88')](_0x12238e);}})[_0x35fc('0x18')](function(_0x52f355){if(_0x52f355){_0x452f30=_0x52f355[_0x35fc('0x38')];if(!_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x12238e[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x11')]);_0x12238e[_0x35fc('0x10')]=qs['offset'](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x238242['getAgents'](_0x12238e);}})[_0x35fc('0x18')](function(_0x4ffbf9){if(_0x4ffbf9){return _0x4ffbf9?{'count':_0x452f30,'rows':_0x4ffbf9}:null;}})[_0x35fc('0x18')](respondWithResult(_0x4f150a,null))[_0x35fc('0x30')](handleError(_0x4f150a,null));};exports[_0x35fc('0x89')]=function(_0x206491,_0x536837){var _0x3cfbd4={};var _0x3ac7fb={};var _0x3916e7;var _0x4bcc53;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x206491[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x536837,null))[_0x35fc('0x18')](function(_0x3da024){if(_0x3da024){_0x3916e7=_0x3da024;_0x3ac7fb[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x68')][_0x35fc('0x41')]);_0x3ac7fb[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x206491[_0x35fc('0x35')]);_0x3ac7fb[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],_0x3ac7fb[_0x35fc('0x35')]);_0x3cfbd4['attributes']=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x206491[_0x35fc('0x35')][_0x35fc('0x42')]));_0x3cfbd4[_0x35fc('0x37')]=_0x3cfbd4[_0x35fc('0x37')]['length']?_0x3cfbd4['attributes']:_0x3ac7fb['model'];_0x3cfbd4['order']=qs[_0x35fc('0x4f')](_0x206491['query'][_0x35fc('0x4f')]);_0x3cfbd4[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x206491[_0x35fc('0x35')],_0x3ac7fb[_0x35fc('0x4c')]));if(_0x206491['query'][_0x35fc('0x1e')]){_0x3cfbd4['where']=_[_0x35fc('0x3a')](_0x3cfbd4['where'],{'$or':_['map'](_0x3cfbd4[_0x35fc('0x37')],function(_0x472e13){var _0x2d0512={};_0x2d0512[_0x472e13]={'$like':'%'+_0x206491['query']['filter']+'%'};return _0x2d0512;})});}_0x3cfbd4=_['merge']({},_0x3cfbd4,_0x206491['options']);return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x131db6){if(_0x131db6){_0x4bcc53=_0x131db6[_0x35fc('0x38')];if(!_0x206491[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x3cfbd4[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x206491['query']['limit']);_0x3cfbd4[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x206491[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x4f4c68){return _0x4f4c68?{'count':_0x4bcc53,'rows':_0x4f4c68}:null;})[_0x35fc('0x18')](respondWithResult(_0x536837,null))[_0x35fc('0x30')](handleError(_0x536837,null));};exports[_0x35fc('0x8a')]=function(_0x4f9a00,_0x5c097d){var _0x11c117={};var _0x26b1cb={};var _0x84e749;var _0x4f9685;return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x4f9a00[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x5c097d,null))[_0x35fc('0x18')](function(_0x546d2e){if(_0x546d2e){_0x84e749=_0x546d2e;_0x26b1cb[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x8b')][_0x35fc('0x41')]);_0x26b1cb['query']=_[_0x35fc('0x34')](_0x4f9a00[_0x35fc('0x35')]);_0x26b1cb['filters']=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],_0x26b1cb[_0x35fc('0x35')]);_0x11c117[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],qs['fields'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x42')]));_0x11c117[_0x35fc('0x37')]=_0x11c117[_0x35fc('0x37')][_0x35fc('0x38')]?_0x11c117['attributes']:_0x26b1cb[_0x35fc('0x33')];_0x11c117[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x11c117[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4f9a00[_0x35fc('0x35')],_0x26b1cb['filters']));if(_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x11c117[_0x35fc('0x2c')]=_['merge'](_0x11c117[_0x35fc('0x2c')],{'$or':_['map'](_0x11c117[_0x35fc('0x37')],function(_0x413a4b){var _0x599121={};_0x599121[_0x413a4b]={'$like':'%'+_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x599121;})});}_0x11c117=_[_0x35fc('0x3a')]({},_0x11c117,_0x4f9a00[_0x35fc('0x3b')]);return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x411d09){if(_0x411d09){_0x4f9685=_0x411d09['length'];if(!_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x11c117['limit']=qs['limit'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x11')]);_0x11c117[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x214f01){if(_0x214f01){return _0x214f01?{'count':_0x4f9685,'rows':_0x214f01}:null;}})[_0x35fc('0x18')](respondWithResult(_0x5c097d,null))[_0x35fc('0x30')](handleError(_0x5c097d,null));};exports[_0x35fc('0x8c')]=function(_0xae43b4,_0x3c5524){var _0x2ceb04=moment()[_0x35fc('0x6a')](_0x35fc('0x8d'));var _0x605f3b,_0x43bb43;return db['VoiceQueue'][_0x35fc('0x23')]({'where':{'id':_0xae43b4['params']['id']}})['then'](handleEntityNotFound(_0x3c5524,null))[_0x35fc('0x18')](function(_0x1d7881){if(_0x1d7881){_0x43bb43=_0x1d7881;return _0x1d7881[_0x35fc('0x8c')](_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0xae43b4[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x3e0ebb){var _0x138fe5;_0x605f3b=_0x3e0ebb||[];var _0x3033a0=[];if(_0x3e0ebb){for(var _0x228bb9=0x0;_0x228bb9<_0x3e0ebb[_0x35fc('0x38')];_0x228bb9+=0x1){var _0x163afe=_0x3e0ebb[_0x228bb9][_0x35fc('0x19')]({'plain':!![]});_0x43bb43[_0x35fc('0x8e')]=_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x8e')]?_0xae43b4[_0x35fc('0x3d')]['dialCheckDuplicateType']:_0x43bb43[_0x35fc('0x8e')];switch(_0x43bb43[_0x35fc('0x8e')]){case _0x35fc('0x8f'):_0x138fe5=squel['insert']()[_0x35fc('0x90')](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','scheduledAt')['field']('id','ContactId')[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())['where'](_0x35fc('0x9b'))['where'](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x9e'))[_0x35fc('0x6f')](_0x35fc('0x9f'))['where']('VoiceQueueId\x20=\x20?',_0xae43b4['params']['id'][_0x35fc('0x78')]()))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel['select']()[_0x35fc('0x6d')](_0x35fc('0xa0'))[_0x35fc('0x6f')](_0x35fc('0x91'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;case _0x35fc('0xa1'):_0x138fe5=squel[_0x35fc('0xa2')]()['into'](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),'ListId','VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))['field']('id',_0x35fc('0x94'))[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))['field'](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))['from']('cm_contacts')[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')]('ListId\x20=\x20?',_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b'))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()['field']('COALESCE(phone,\x27\x27)')[_0x35fc('0x6f')](_0x35fc('0x91'))['where'](_0x35fc('0x74'),_0xae43b4['params']['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;default:_0x138fe5=squel[_0x35fc('0xa2')]()[_0x35fc('0x90')]('cm_hopper')[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))[_0x35fc('0x6d')]('id','ContactId')[_0x35fc('0x6d')](_0x163afe['CmListId']['toString'](),'ListId')[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))['where'](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b')))[_0x35fc('0x78')]();}_0x3033a0[_0x35fc('0x77')](db['sequelize'][_0x35fc('0x35')](_0x138fe5));}return BPromise['all'](_0x3033a0);}})[_0x35fc('0x18')](function(){var _0x477d70=[];var _0x28533f=squel['insert']()[_0x35fc('0x90')](_0x35fc('0xa3'))[_0x35fc('0x92')]([_0x35fc('0xa4'),_0x35fc('0x96'),_0x35fc('0xa5'),'createdAt',_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')]('h.id')['field'](_0x35fc('0xa6'))[_0x35fc('0x6d')]('ci.OrderBy+1')[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0xa7'),'ci')[_0x35fc('0x71')]('cm_hopper','h',_0x35fc('0xa8'))[_0x35fc('0x2c')](_0x35fc('0xa9'),_0x2ceb04)[_0x35fc('0x2c')](_0x35fc('0xaa'),_0x35fc('0xab')))[_0x35fc('0x78')]();_0x477d70[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x28533f));return BPromise[_0x35fc('0x7e')](_0x477d70);})[_0x35fc('0x18')](function(){return _0x605f3b;})[_0x35fc('0x18')](respondWithResult(_0x3c5524,null))[_0x35fc('0x30')](handleError(_0x3c5524,null));};exports['removeLists']=function(_0x57b3f1,_0x8fa3cf){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x8fa3cf,null))[_0x35fc('0x18')](function(_0x293c2d){if(_0x293c2d){return _0x293c2d[_0x35fc('0xac')](_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')]);}})['then'](function(_0x4860b4){if(_0x4860b4){return db[_0x35fc('0x4b')][_0x35fc('0x25')]({'where':{'ListId':_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')],'VoiceQueueId':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x4860b4;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x8fa3cf,null))[_0x35fc('0x30')](handleError(_0x8fa3cf,null));};exports[_0x35fc('0xad')]=function(_0x55d140,_0x488cea){var _0x1a5f12={};var _0x4c40e5={};var _0x3afdf3;var _0x3b64de;return db['VoiceQueue'][_0x35fc('0x53')]({'where':{'id':_0x55d140['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x488cea,null))[_0x35fc('0x18')](function(_0xa46452){if(_0xa46452){_0x3afdf3=_0xa46452;_0x4c40e5[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['CmList'][_0x35fc('0x41')]);_0x4c40e5[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x55d140['query']);_0x4c40e5[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],_0x4c40e5['query']);_0x1a5f12[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x42')]));_0x1a5f12[_0x35fc('0x37')]=_0x1a5f12[_0x35fc('0x37')][_0x35fc('0x38')]?_0x1a5f12[_0x35fc('0x37')]:_0x4c40e5[_0x35fc('0x33')];_0x1a5f12[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x1a5f12[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x55d140[_0x35fc('0x35')],_0x4c40e5[_0x35fc('0x4c')]));if(_0x55d140['query'][_0x35fc('0x1e')]){_0x1a5f12[_0x35fc('0x2c')]=_['merge'](_0x1a5f12[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x1a5f12[_0x35fc('0x37')],function(_0x55c126){var _0x9e7561={};_0x9e7561[_0x55c126]={'$like':'%'+_0x55d140[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x9e7561;})});}_0x1a5f12=_[_0x35fc('0x3a')]({},_0x1a5f12,_0x55d140[_0x35fc('0x3b')]);return _0x3afdf3[_0x35fc('0xad')](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x5545e9){if(_0x5545e9){_0x3b64de=_0x5545e9[_0x35fc('0x38')];if(!_0x55d140[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x1a5f12[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x11')]);_0x1a5f12['offset']=qs['offset'](_0x55d140[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3afdf3['getBlackLists'](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x2c1181){if(_0x2c1181){return _0x2c1181?{'count':_0x3b64de,'rows':_0x2c1181}:null;}})[_0x35fc('0x18')](respondWithResult(_0x488cea,null))[_0x35fc('0x30')](handleError(_0x488cea,null));};exports[_0x35fc('0xae')]=function(_0x3f7fd7,_0x5e16f1){var _0xa46ffd;return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x3f7fd7[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x5e16f1,null))[_0x35fc('0x18')](function(_0x4abeb5){if(_0x4abeb5){return _0x4abeb5[_0x35fc('0xae')](_0x3f7fd7[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x3f7fd7[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x4007f9){var _0x58d0b1;_0xa46ffd=_0x4007f9||[];var _0x4bf83e=[];if(_0x4007f9){for(var _0x1afe94=0x0;_0x1afe94<_0x4007f9[_0x35fc('0x38')];_0x1afe94+=0x1){var _0x108366=_0x4007f9[_0x1afe94][_0x35fc('0x19')]({'plain':!![]});_0x58d0b1=squel['insert']()[_0x35fc('0x90')]('cm_hopper_black')['fromQuery']([_0x35fc('0x96'),_0x35fc('0x94'),_0x35fc('0x95'),_0x35fc('0x51'),_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()['field'](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('id',_0x35fc('0x94'))['field'](_0x108366[_0x35fc('0x97')][_0x35fc('0x78')](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0x3f7fd7[_0x35fc('0x32')]['id']['toString'](),_0x35fc('0x51'))[_0x35fc('0x6d')](_0x35fc('0xaf'),_0x35fc('0x44'))[_0x35fc('0x6d')]('NOW()','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x108366[_0x35fc('0x97')]['toString']())[_0x35fc('0x2c')](_0x35fc('0x9b')))['toString']();_0x4bf83e[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x58d0b1));}return BPromise[_0x35fc('0x7e')](_0x4bf83e);}})[_0x35fc('0x18')](function(){return _0xa46ffd;})[_0x35fc('0x18')](respondWithResult(_0x5e16f1,null))[_0x35fc('0x30')](handleError(_0x5e16f1,null));};exports[_0x35fc('0xb0')]=function(_0x4fd3d4,_0x2dff64){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x4fd3d4['params']['id']}})['then'](handleEntityNotFound(_0x2dff64,null))[_0x35fc('0x18')](function(_0x409a32){if(_0x409a32){return _0x409a32['removeBlackLists'](_0x4fd3d4[_0x35fc('0x35')][_0x35fc('0x6c')]);}})[_0x35fc('0x18')](function(_0x2c0bf5){if(_0x2c0bf5){return db['CmHopperBlack'][_0x35fc('0x25')]({'where':{'ListId':_0x4fd3d4['query']['ids'],'VoiceQueueId':_0x4fd3d4[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x2c0bf5;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x2dff64,null))[_0x35fc('0x30')](handleError(_0x2dff64,null));}; \ No newline at end of file +var _0x4b84=['type','find','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','getHopperHistories','pick','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','forEach','penalty','transaction','TeamVoiceQueue','each','UserVoiceQueue','UserVoiceQueueRt','upsert','format','SIP/%s','emit','ids','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','TeamId','all','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:save','online','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','fromQuery','phone','scheduledAt','ContactId','ListId','select','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','into','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','NOW()','removeBlackLists','moment','bluebird','squel','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','undefined','count','offset','limit','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x4b84[_0x11ca63];return _0x41f1f6;};'use strict';var moment=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0x44b8('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x44b8('0x3'))(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x44b8('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x44b8('0x7'))(new Redis(config['redis']));require(_0x44b8('0x8'))['register'](socket);function respondWithStatusCode(_0x5034b6,_0x41d515){_0x41d515=_0x41d515||0xcc;return function(_0x42319d){if(_0x42319d){return _0x5034b6[_0x44b8('0x9')](_0x41d515);}return _0x5034b6['status'](_0x41d515)[_0x44b8('0xa')]();};}function respondWithResult(_0x2cc74b,_0x4315f6){_0x4315f6=_0x4315f6||0xc8;return function(_0x9b6048){if(_0x9b6048){return _0x2cc74b[_0x44b8('0xb')](_0x4315f6)[_0x44b8('0xc')](_0x9b6048);}};}function respondWithFilteredResult(_0xe9a025,_0x4ae8a1){return function(_0x147529){if(_0x147529){var _0x4301a6=typeof _0x4ae8a1['offset']===_0x44b8('0xd')&&typeof _0x4ae8a1['limit']===_0x44b8('0xd');var _0x18d642=_0x147529['count'];var _0x63e8f6=_0x4301a6?0x0:_0x4ae8a1['offset'];var _0x54fa95=_0x4301a6?_0x147529[_0x44b8('0xe')]:_0x4ae8a1[_0x44b8('0xf')]+_0x4ae8a1[_0x44b8('0x10')];var _0x41ab46;if(_0x54fa95>=_0x18d642){_0x54fa95=_0x18d642;_0x41ab46=0xc8;}else{_0x41ab46=0xce;}_0xe9a025['status'](_0x41ab46);return _0xe9a025['set']('Content-Range',_0x63e8f6+'-'+_0x54fa95+'/'+_0x18d642)[_0x44b8('0xc')](_0x147529);}return null;};}function saveUpdates(_0x5b7803){return function(_0x28ef36){if(_0x28ef36){return _0x28ef36[_0x44b8('0x11')](_0x5b7803)['then'](function(_0x36743e){return _0x36743e;});}return null;};}function removeEntity(_0xe3de8f){return function(_0x5103f5){if(_0x5103f5){return _0x5103f5[_0x44b8('0x12')]()[_0x44b8('0x13')](function(){var _0x4b600f=_0x5103f5[_0x44b8('0x14')]({'plain':!![]});var _0x8b4301=[{'name':_0x44b8('0x15'),'value':_0x44b8('0x16'),'ignore':![]},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18'),'ignore':![]}];var _0x452f2f=_(_0x8b4301)[_0x44b8('0x19')](_0x44b8('0x1a'))[_0x44b8('0x1b')](_0x44b8('0x1c'))[_0x44b8('0x1c')]();if(_['includes'](_0x452f2f,_0x4b600f[_0x44b8('0x1d')])){return;}var _0x3a8aa4=_[_0x44b8('0x1e')](_0x8b4301,[_0x44b8('0x1c'),_0x4b600f[_0x44b8('0x1d')]])['name'];return db[_0x44b8('0x1f')]['destroy']({'where':{'type':_0x3a8aa4,'resourceId':_0x4b600f['id']}})[_0x44b8('0x13')](function(){return _0x5103f5;});})[_0x44b8('0x13')](function(){_0xe3de8f[_0x44b8('0xb')](0xcc)[_0x44b8('0xa')]();});}};}function handleEntityNotFound(_0x230a3d){return function(_0x59acbc){if(!_0x59acbc){_0x230a3d[_0x44b8('0x9')](0x194);}return _0x59acbc;};}function handleError(_0x502acf,_0x41d673){_0x41d673=_0x41d673||0x1f4;return function(_0x350482){logger['error'](_0x350482[_0x44b8('0x20')]);if(_0x350482[_0x44b8('0x21')]){delete _0x350482[_0x44b8('0x21')];}_0x502acf['status'](_0x41d673)[_0x44b8('0x22')](_0x350482);};}exports[_0x44b8('0x23')]=function(_0x53d9c7,_0x2e0174){var _0x4a182d={};var _0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['VoiceQueue'][_0x44b8('0x24')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x25')],'type':_0x29b18d[_0x44b8('0x1d')][_0x44b8('0x26')]};});_0x4a182d=qs[_0x44b8('0x27')](_0x5a544c,_0x53d9c7);var _0x2cf205={'where':_0x4a182d[_0x44b8('0x28')]};return db[_0x44b8('0x29')][_0x44b8('0xe')](_0x2cf205)[_0x44b8('0x13')](function(_0x417d81){_0xfb0028[_0x44b8('0xe')]=_0x417d81;_0x4a182d['include']=qs[_0x44b8('0x2a')](_0x53d9c7['query']);return db[_0x44b8('0x29')][_0x44b8('0x2b')](_0x4a182d);})[_0x44b8('0x13')](function(_0xb64609){_0xfb0028[_0x44b8('0x2c')]=_0xb64609;return _0xfb0028;})['then'](respondWithFilteredResult(_0x2e0174,_0x4a182d))[_0x44b8('0x2d')](handleError(_0x2e0174,null));};exports[_0x44b8('0x2e')]=function(_0x26265f,_0x339f0f){var _0x46b008={'raw':![],'where':{'id':_0x26265f[_0x44b8('0x2f')]['id']}},_0x5f541d={};_0x5f541d[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0x5f541d[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x26265f[_0x44b8('0x32')]);_0x5f541d[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],_0x5f541d[_0x44b8('0x32')]);_0x46b008[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x26265f[_0x44b8('0x32')][_0x44b8('0x36')]));_0x46b008[_0x44b8('0x35')]=_0x46b008[_0x44b8('0x35')][_0x44b8('0x37')]?_0x46b008[_0x44b8('0x35')]:_0x5f541d['model'];if(_0x26265f[_0x44b8('0x32')][_0x44b8('0x38')]){_0x46b008['include']=[{'all':!![]}];}_0x46b008=_[_0x44b8('0x39')]({},_0x46b008,_0x26265f[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0x46b008)['then'](handleEntityNotFound(_0x339f0f,null))[_0x44b8('0x13')](respondWithResult(_0x339f0f,null))[_0x44b8('0x2d')](handleError(_0x339f0f,null));};exports[_0x44b8('0x3b')]=function(_0x1ee3cc,_0x9cb2a){return db[_0x44b8('0x29')][_0x44b8('0x3b')](_0x1ee3cc[_0x44b8('0x3c')],{})[_0x44b8('0x13')](function(_0x3d1be1){var _0x1c9983=_0x1ee3cc[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x1c9983)throw new Error(_0x44b8('0x3e'));if(_0x1c9983[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x57d8c4=_0x3d1be1[_0x44b8('0x14')]({'plain':!![]});var _0x43e43a=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x229cc9=_['find'](_0x43e43a,[_0x44b8('0x1c'),_0x57d8c4[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db[_0x44b8('0x40')][_0x44b8('0x1e')]({'where':{'name':_0x229cc9,'userProfileId':_0x1c9983['userProfileId']},'raw':!![]})['then'](function(_0x215f7b){if(_0x215f7b&&_0x215f7b[_0x44b8('0x41')]===0x0){return db[_0x44b8('0x1f')][_0x44b8('0x3b')]({'name':_0x57d8c4[_0x44b8('0x21')],'resourceId':_0x57d8c4['id'],'type':_0x215f7b[_0x44b8('0x21')],'sectionId':_0x215f7b['id']},{})[_0x44b8('0x13')](function(){return _0x3d1be1;});}else{return _0x3d1be1;}})[_0x44b8('0x2d')](function(_0x455fd6){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x455fd6);throw _0x455fd6;});}return _0x3d1be1;})[_0x44b8('0x13')](respondWithResult(_0x9cb2a,0xc9))[_0x44b8('0x2d')](handleError(_0x9cb2a,null));};exports[_0x44b8('0x44')]=function(_0x149731,_0x60eeb2){var _0xce06dc={'where':{'id':_0x149731[_0x44b8('0x2f')]['id']}},_0x3b3d5d={};_0x3b3d5d['model']=_['keys'](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0xce06dc[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x3b3d5d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x149731[_0x44b8('0x32')]['fields']));_0xce06dc[_0x44b8('0x35')]=_0xce06dc['attributes'][_0x44b8('0x37')]?_0xce06dc[_0x44b8('0x35')]:_0x3b3d5d[_0x44b8('0x30')];if(_0x149731[_0x44b8('0x32')][_0x44b8('0x38')]){_0xce06dc[_0x44b8('0x2a')]=[{'all':!![]}];}_0xce06dc=_['merge']({},_0xce06dc,_0x149731[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0xce06dc)[_0x44b8('0x13')](handleEntityNotFound(_0x60eeb2,null))['then'](function(_0x4e4ed1){if(_0x4e4ed1){var _0x2f549d=_0x4e4ed1[_0x44b8('0x14')]({'plain':!![]});_0x2f549d=qs[_0x44b8('0x45')](_0x2f549d,['id',_0x44b8('0x46'),_0x44b8('0x47')]);_0x149731['body']=_[_0x44b8('0x45')](_0x149731[_0x44b8('0x3c')],['id',_0x44b8('0x46'),_0x44b8('0x47')]);return db[_0x44b8('0x29')]['create'](_['merge'](_0x2f549d,_0x149731[_0x44b8('0x3c')]),{'include':_0x149731['query'][_0x44b8('0x38')]?[{'all':!![]}]:undefined})['then'](function(_0x40164d){var _0x434d6a=_0x149731[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x434d6a)throw new Error(_0x44b8('0x3e'));if(_0x434d6a[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x533967=_0x40164d[_0x44b8('0x14')]({'plain':!![]});var _0x37b2c2=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x45f9a0=_[_0x44b8('0x1e')](_0x37b2c2,['value',_0x533967[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db['UserProfileSection'][_0x44b8('0x1e')]({'where':{'name':_0x45f9a0,'userProfileId':_0x434d6a[_0x44b8('0x48')]},'raw':!![]})[_0x44b8('0x13')](function(_0x3df6aa){if(_0x3df6aa&&_0x3df6aa[_0x44b8('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x533967[_0x44b8('0x21')],'resourceId':_0x533967['id'],'type':_0x3df6aa[_0x44b8('0x21')],'sectionId':_0x3df6aa['id']},{})[_0x44b8('0x13')](function(){return _0x40164d;});}else{return _0x40164d;}})[_0x44b8('0x2d')](function(_0x765e45){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x765e45);throw _0x765e45;});}return _0x40164d;});}})[_0x44b8('0x13')](respondWithResult(_0x60eeb2,0xc9))[_0x44b8('0x2d')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x11')]=function(_0x16c628,_0x3f7576){if(_0x16c628['body']['id']){delete _0x16c628[_0x44b8('0x3c')]['id'];}return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x16c628[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3f7576,null))[_0x44b8('0x13')](saveUpdates(_0x16c628[_0x44b8('0x3c')],null))[_0x44b8('0x13')](respondWithResult(_0x3f7576,null))[_0x44b8('0x2d')](handleError(_0x3f7576,null));};exports[_0x44b8('0x12')]=function(_0x2ecff9,_0x15bcba){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2ecff9[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x15bcba,null))[_0x44b8('0x13')](removeEntity(_0x15bcba,null))[_0x44b8('0x2d')](handleError(_0x15bcba,null));};exports['getHoppers']=function(_0x1ec516,_0x3aac51){var _0x10e519={'raw':![],'where':{}};var _0x2b37e={};var _0x51f763={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x1ec516['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3aac51,null))[_0x44b8('0x13')](function(_0x5df821){if(_0x5df821){_0x2b37e[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopper'][_0x44b8('0x24')]);_0x2b37e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1ec516['query']);_0x2b37e[_0x44b8('0x33')]=_['intersection'](_0x2b37e[_0x44b8('0x30')],_0x2b37e['query']);_0x10e519[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2b37e[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x36')]));_0x10e519['attributes']=_0x10e519[_0x44b8('0x35')]['length']?_0x10e519[_0x44b8('0x35')]:_0x2b37e[_0x44b8('0x30')];if(!_0x1ec516['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x10e519[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x10')]);_0x10e519[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x10e519[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x1ec516['query'][_0x44b8('0x4d')]);_0x10e519[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_['pick'](_0x1ec516[_0x44b8('0x32')],_0x2b37e[_0x44b8('0x33')]));_0x10e519['where'][_0x44b8('0x4e')]=_0x5df821['id'];if(_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]){_0x10e519[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x10e519['where'],{'$or':_[_0x44b8('0x1b')](_0x10e519[_0x44b8('0x35')],function(_0x279753){var _0x270224={};_0x270224[_0x279753]={'$like':'%'+_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x270224;})});}_0x10e519=_[_0x44b8('0x39')]({},_0x10e519,_0x1ec516[_0x44b8('0x3a')]);return db['CmHopper'][_0x44b8('0xe')]({'where':_0x10e519[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x3ce76e){_0x51f763['count']=_0x3ce76e;if(_0x1ec516['query']['includeAll']){_0x10e519[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x4f')][_0x44b8('0x2b')](_0x10e519);})[_0x44b8('0x13')](function(_0x32e630){_0x51f763['rows']=_0x32e630;return _0x51f763;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x3aac51,_0x10e519))['catch'](handleError(_0x3aac51,null));};exports[_0x44b8('0x50')]=function(_0x155bcf,_0xea2c3e){var _0x5da034={'raw':!![],'where':{}};var _0x4cac12={};var _0xb4c6dc={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x155bcf['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xea2c3e,null))[_0x44b8('0x13')](function(_0x1258c2){if(_0x1258c2){_0x4cac12[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopperHistory'][_0x44b8('0x24')]);_0x4cac12[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x155bcf[_0x44b8('0x32')]);_0x4cac12[_0x44b8('0x33')]=_['intersection'](_0x4cac12[_0x44b8('0x30')],_0x4cac12[_0x44b8('0x32')]);_0x5da034[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x4cac12[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x155bcf[_0x44b8('0x32')]['fields']));_0x5da034[_0x44b8('0x35')]=_0x5da034[_0x44b8('0x35')]['length']?_0x5da034[_0x44b8('0x35')]:_0x4cac12[_0x44b8('0x30')];if(!_0x155bcf['query'][_0x44b8('0x4a')]('nolimit')){_0x5da034['limit']=qs[_0x44b8('0x10')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x10')]);_0x5da034['offset']=qs['offset'](_0x155bcf['query'][_0x44b8('0xf')]);}_0x5da034[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x5da034[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x155bcf['query'],_0x4cac12[_0x44b8('0x33')]));_0x5da034['where']['VoiceQueueId']=_0x1258c2['id'];if(_0x155bcf['query'][_0x44b8('0x19')]){_0x5da034['where']=_[_0x44b8('0x39')](_0x5da034[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x5da034[_0x44b8('0x35')],function(_0x3a9780){var _0x245ba3={};_0x245ba3[_0x3a9780]={'$like':'%'+_0x155bcf[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x245ba3;})});}_0x5da034=_['merge']({},_0x5da034,_0x155bcf[_0x44b8('0x3a')]);return db[_0x44b8('0x52')][_0x44b8('0xe')]({'where':_0x5da034[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0xee44b3){_0xb4c6dc[_0x44b8('0xe')]=_0xee44b3;if(_0x155bcf[_0x44b8('0x32')][_0x44b8('0x38')]){_0x5da034['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x44b8('0x2b')](_0x5da034);})['then'](function(_0x531d65){_0xb4c6dc[_0x44b8('0x2c')]=_0x531d65;return _0xb4c6dc;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0xea2c3e,_0x5da034))['catch'](handleError(_0xea2c3e,null));};exports['getHopperFinals']=function(_0x4b22e7,_0x2e0289){var _0x4860af={'raw':!![],'where':{}};var _0x353ff1={};var _0x2812da={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x4b22e7[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2e0289,null))[_0x44b8('0x13')](function(_0x3a7229){if(_0x3a7229){_0x353ff1[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x53')][_0x44b8('0x24')]);_0x353ff1[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x4b22e7['query']);_0x353ff1[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],_0x353ff1[_0x44b8('0x32')]);_0x4860af[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x36')]));_0x4860af[_0x44b8('0x35')]=_0x4860af[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4860af['attributes']:_0x353ff1[_0x44b8('0x30')];if(!_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4860af['limit']=qs[_0x44b8('0x10')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4860af['offset']=qs[_0x44b8('0xf')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x4860af[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4860af[_0x44b8('0x28')]=qs['filters'](_[_0x44b8('0x51')](_0x4b22e7[_0x44b8('0x32')],_0x353ff1[_0x44b8('0x33')]));_0x4860af[_0x44b8('0x28')][_0x44b8('0x4e')]=_0x3a7229['id'];if(_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4860af['where']=_['merge'](_0x4860af['where'],{'$or':_[_0x44b8('0x1b')](_0x4860af[_0x44b8('0x35')],function(_0x2d74ee){var _0x312f4c={};_0x312f4c[_0x2d74ee]={'$like':'%'+_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x312f4c;})});}_0x4860af=_[_0x44b8('0x39')]({},_0x4860af,_0x4b22e7[_0x44b8('0x3a')]);return db[_0x44b8('0x53')]['count']({'where':_0x4860af[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x4b8036){_0x2812da['count']=_0x4b8036;if(_0x4b22e7[_0x44b8('0x32')]['includeAll']){_0x4860af[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x53')][_0x44b8('0x2b')](_0x4860af);})['then'](function(_0x3f4a2a){_0x2812da[_0x44b8('0x2c')]=_0x3f4a2a;return _0x2812da;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x2e0289,_0x4860af))[_0x44b8('0x2d')](handleError(_0x2e0289,null));};exports['getHopperBlacks']=function(_0x216030,_0x584ae3){var _0x38c0c5={'raw':!![],'where':{}};var _0x2f2923={};var _0x2d9d62={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x216030[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x584ae3,null))['then'](function(_0x4d3b82){if(_0x4d3b82){_0x2f2923['model']=_[_0x44b8('0x31')](db[_0x44b8('0x54')][_0x44b8('0x24')]);_0x2f2923[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x216030[_0x44b8('0x32')]);_0x2f2923[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],_0x2f2923[_0x44b8('0x32')]);_0x38c0c5[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x216030[_0x44b8('0x32')][_0x44b8('0x36')]));_0x38c0c5[_0x44b8('0x35')]=_0x38c0c5[_0x44b8('0x35')]['length']?_0x38c0c5[_0x44b8('0x35')]:_0x2f2923['model'];if(!_0x216030[_0x44b8('0x32')]['hasOwnProperty']('nolimit')){_0x38c0c5[_0x44b8('0x10')]=qs['limit'](_0x216030['query']['limit']);_0x38c0c5['offset']=qs['offset'](_0x216030[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x38c0c5[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x216030['query'][_0x44b8('0x4d')]);_0x38c0c5[_0x44b8('0x28')]=qs['filters'](_['pick'](_0x216030[_0x44b8('0x32')],_0x2f2923[_0x44b8('0x33')]));_0x38c0c5[_0x44b8('0x28')]['VoiceQueueId']=_0x4d3b82['id'];if(_0x216030[_0x44b8('0x32')][_0x44b8('0x19')]){_0x38c0c5[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x38c0c5[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x38c0c5[_0x44b8('0x35')],function(_0x16344b){var _0x21057f={};_0x21057f[_0x16344b]={'$like':'%'+_0x216030['query'][_0x44b8('0x19')]+'%'};return _0x21057f;})});}_0x38c0c5=_[_0x44b8('0x39')]({},_0x38c0c5,_0x216030['options']);return db[_0x44b8('0x54')][_0x44b8('0xe')]({'where':_0x38c0c5[_0x44b8('0x28')]})['then'](function(_0x3a09e4){_0x2d9d62['count']=_0x3a09e4;if(_0x216030[_0x44b8('0x32')][_0x44b8('0x38')]){_0x38c0c5['include']=[{'all':!![]}];}return db[_0x44b8('0x54')][_0x44b8('0x2b')](_0x38c0c5);})[_0x44b8('0x13')](function(_0x37871e){_0x2d9d62['rows']=_0x37871e;return _0x2d9d62;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x584ae3,_0x38c0c5))[_0x44b8('0x2d')](handleError(_0x584ae3,null));};exports[_0x44b8('0x55')]=function(_0x35d46c,_0x2d4a8a){var _0x1d666e={};var _0x10a66a={};var _0x1e608f;var _0x470f90;return db['VoiceQueue']['findOne']({'where':{'id':_0x35d46c[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2d4a8a,null))[_0x44b8('0x13')](function(_0x3539f9){if(_0x3539f9){_0x1e608f=_0x3539f9;_0x10a66a[_0x44b8('0x30')]=_['keys'](db[_0x44b8('0x56')]['rawAttributes']);_0x10a66a[_0x44b8('0x32')]=_['keys'](_0x35d46c[_0x44b8('0x32')]);_0x10a66a[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],_0x10a66a[_0x44b8('0x32')]);_0x1d666e[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x35d46c['query'][_0x44b8('0x36')]));_0x1d666e[_0x44b8('0x35')]=_0x1d666e[_0x44b8('0x35')][_0x44b8('0x37')]?_0x1d666e['attributes']:_0x10a66a['model'];_0x1d666e['order']=qs[_0x44b8('0x4d')](_0x35d46c['query']['sort']);_0x1d666e[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x35d46c[_0x44b8('0x32')],_0x10a66a[_0x44b8('0x33')]));if(_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]){_0x1d666e[_0x44b8('0x28')]=_['merge'](_0x1d666e[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x1d666e[_0x44b8('0x35')],function(_0x2594bf){var _0x5f0c0c={};_0x5f0c0c[_0x2594bf]={'$like':'%'+_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x5f0c0c;})});}_0x1d666e=_[_0x44b8('0x39')]({},_0x1d666e,_0x35d46c['options']);return _0x1e608f['getTeams'](_0x1d666e);}})[_0x44b8('0x13')](function(_0xae9b10){if(_0xae9b10){_0x470f90=_0xae9b10[_0x44b8('0x37')];if(!_0x35d46c[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x1d666e[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x35d46c['query'][_0x44b8('0x10')]);_0x1d666e[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x35d46c[_0x44b8('0x32')]['offset']);}return _0x1e608f[_0x44b8('0x55')](_0x1d666e);}})['then'](function(_0x4464d3){if(_0x4464d3){return _0x4464d3?{'count':_0x470f90,'rows':_0x4464d3}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2d4a8a,null))[_0x44b8('0x2d')](handleError(_0x2d4a8a,null));};exports[_0x44b8('0x57')]=function(_0x45ff62,_0x343c5c){var _0x3cb290=_0x45ff62[_0x44b8('0x3c')]['teams'];var _0x2d27bf=_[_0x44b8('0x1b')](_0x3cb290,'id');return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x2d27bf},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id','name','online',_0x44b8('0x5a'),_0x44b8('0x5b')],'raw':!![]}]})['then'](function(_0x41f732){if(_0x41f732){var _0x16074e=_['flatMap'](_0x41f732,function(_0x1ec23e){var _0x3208b4=_0x1ec23e[_0x44b8('0x14')]({'plain':!![]});_0x3208b4[_0x44b8('0x59')][_0x44b8('0x5c')](function(_0x43f416){_0x43f416[_0x44b8('0x5d')]=_[_0x44b8('0x1e')](_0x3cb290,{'id':_0x3208b4['id']})[_0x44b8('0x5d')];});return _0x3208b4[_0x44b8('0x59')];});return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x45ff62[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x15365d){return db['sequelize'][_0x44b8('0x5e')](function(_0x3d92a9){return _0x15365d[_0x44b8('0x57')](_0x2d27bf,{'transaction':_0x3d92a9})[_0x44b8('0x13')](function(){return BPromise['each'](_0x3cb290,function(_0x611876){return db[_0x44b8('0x5f')]['upsert']({'TeamId':_0x611876['id'],'VoiceQueueId':_0x45ff62[_0x44b8('0x2f')]['id'],'penalty':_0x611876['penalty']},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise[_0x44b8('0x60')](_0x16074e,function(_0x5a508f){return db[_0x44b8('0x61')]['findOrCreate']({'where':{'UserId':_0x5a508f['id'],'VoiceQueueId':_0x45ff62['params']['id']},'defaults':{'penalty':_0x5a508f[_0x44b8('0x5d')]},'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise['each'](_['filter'](_0x16074e,{'online':!![]}),function(_0x52af57){return db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x52af57[_0x44b8('0x21')],'UserId':_0x52af57['id'],'queue_name':_0x15365d['name'],'VoiceQueueId':_0x15365d['id'],'interface':_['isNil'](_0x52af57[_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x52af57[_0x44b8('0x21')]):_0x52af57[_0x44b8('0x5b')],'paused':_0x52af57[_0x44b8('0x5a')]||![],'penalty':_0x52af57[_0x44b8('0x5d')]},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){_0x16074e[_0x44b8('0x5c')](function(_0x4ed62f){socket[_0x44b8('0x66')]('userVoiceQueue:save',{'UserId':_0x4ed62f['id'],'VoiceQueueId':_0x15365d['id']});});});});});}})[_0x44b8('0x13')](respondWithStatusCode(_0x343c5c,null))['catch'](handleError(_0x343c5c,null));};exports['removeTeams']=function(_0x1fb070,_0x224071){return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x1fb070[_0x44b8('0x32')][_0x44b8('0x67')]},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id'],'raw':!![]}]})[_0x44b8('0x13')](handleEntityNotFound(_0x224071,null))['then'](function(_0x1eb0a8){var _0x1e3b5f=_[_0x44b8('0x1b')](_0x1eb0a8,'id');var _0x536d1d=[];var _0x5bc747=[];var _0x3e44ea=squel['select']();_0x3e44ea[_0x44b8('0x68')]('tq.TeamId')[_0x44b8('0x69')]('team_has_voice_queues','tq')['join'](_0x44b8('0x6a'),'ut',_0x44b8('0x6b'))['where'](_0x44b8('0x6c'),_0x1fb070[_0x44b8('0x2f')]['id']);for(var _0x276dfc=0x0;_0x276dfc<_0x1eb0a8[_0x44b8('0x37')];_0x276dfc+=0x1){let _0x291617=_0x1eb0a8[_0x276dfc];for(var _0x57b73f=0x0;_0x57b73f<_0x291617[_0x44b8('0x59')]['length'];_0x57b73f+=0x1){let _0x595af5=_0x291617['Agents'][_0x57b73f];var _0x3015f9=_0x3e44ea[_0x44b8('0x44')]();_0x3015f9['where'](_0x44b8('0x6d'),_0x595af5['id']);_0x5bc747[_0x44b8('0x6e')](db['sequelize']['query'](_0x3015f9[_0x44b8('0x6f')](),{'type':db[_0x44b8('0x70')]['QueryTypes'][_0x44b8('0x71')]})[_0x44b8('0x13')](function(_0x5e2d3b){if(_0x5e2d3b[_0x44b8('0x37')]===0x1){return _0x595af5['id'];}else{var _0x97f4=_['every'](_[_0x44b8('0x1b')](_0x5e2d3b,_0x44b8('0x72')),function(_0xdb42f2){return _['includes'](_0x1e3b5f,_0xdb42f2);});if(_0x97f4){return _0x595af5['id'];}}}));}}return BPromise[_0x44b8('0x73')](_0x5bc747)['then'](function(_0x2ea49d){_0x536d1d=_(_0x536d1d)['union'](_0x2ea49d)['compact']()[_0x44b8('0x1c')]();return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x1fb070[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x1db2cf){return db[_0x44b8('0x70')][_0x44b8('0x5e')](function(_0x1b7826){return _0x1db2cf[_0x44b8('0x74')](_0x1fb070[_0x44b8('0x32')]['ids'],{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){if(!_[_0x44b8('0x75')](_0x536d1d)){return _0x1db2cf[_0x44b8('0x76')](_0x536d1d,{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){return db[_0x44b8('0x62')][_0x44b8('0x12')]({'where':{'VoiceQueueId':_0x1fb070[_0x44b8('0x2f')]['id'],'UserId':_0x536d1d},'transaction':_0x1b7826});});}})[_0x44b8('0x13')](function(){_0x536d1d['forEach'](function(_0x4234bc){socket[_0x44b8('0x66')]('userVoiceQueue:remove',{'UserId':_0x4234bc,'VoiceQueueId':_0x1db2cf['id']});});});});});});})[_0x44b8('0x13')](respondWithStatusCode(_0x224071,null))[_0x44b8('0x2d')](handleError(_0x224071,null));};exports[_0x44b8('0x77')]=function(_0x5596c0,_0x4b2b8f){var _0x18cd30,_0x133da8;return db['VoiceQueue']['find']({'where':{'id':_0x5596c0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x4b2b8f,null))[_0x44b8('0x13')](function(_0x2bccf9){if(_0x2bccf9){_0x133da8=_0x2bccf9;return _0x2bccf9[_0x44b8('0x77')](_0x5596c0['body'][_0x44b8('0x67')],_['omit'](_0x5596c0[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{})[_0x44b8('0x78')](function(_0x156a60){for(var _0x3cbec9=0x0;_0x3cbec9<_0x5596c0[_0x44b8('0x3c')]['ids'][_0x44b8('0x37')];_0x3cbec9+=0x1){socket['emit'](_0x44b8('0x79'),{'UserId':Number(_0x5596c0[_0x44b8('0x3c')]['ids'][_0x3cbec9]),'VoiceQueueId':Number(_0x5596c0[_0x44b8('0x2f')]['id'])});}return _0x156a60;});}})['then'](function(_0x42b0c9){_0x18cd30=_0x42b0c9||[];if(_0x133da8){return db[_0x44b8('0x58')][_0x44b8('0x2b')]({'where':{'id':_0x5596c0['body'][_0x44b8('0x67')]},'attributes':['id',_0x44b8('0x21'),'online',_0x44b8('0x5a'),'interface'],'raw':!![]});}})['then'](function(_0x4220b5){if(!_['isEmpty'](_0x4220b5)){var _0x336436=[];for(var _0x51add5=0x0;_0x51add5<_0x4220b5[_0x44b8('0x37')];_0x51add5++){if(_0x4220b5[_0x51add5][_0x44b8('0x7a')]){_0x336436['push'](db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x4220b5[_0x51add5]['name'],'UserId':_0x4220b5[_0x51add5]['id'],'queue_name':_0x133da8['name'],'VoiceQueueId':_0x133da8['id'],'interface':_[_0x44b8('0x7b')](_0x4220b5[_0x51add5][_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x4220b5[_0x51add5]['name']):_0x4220b5[_0x51add5][_0x44b8('0x5b')],'paused':_0x4220b5[_0x51add5][_0x44b8('0x5a')]||![],'penalty':_0x5596c0[_0x44b8('0x3c')][_0x44b8('0x5d')]||0x0}));}}return BPromise['all'](_0x336436);}})['then'](function(){return _0x18cd30;})[_0x44b8('0x13')](respondWithResult(_0x4b2b8f,null))[_0x44b8('0x2d')](handleError(_0x4b2b8f,null));};exports[_0x44b8('0x76')]=function(_0x4cf4a0,_0x1443bd){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4cf4a0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x1443bd,null))[_0x44b8('0x13')](function(_0x2cb698){if(_0x2cb698){return _0x2cb698[_0x44b8('0x76')](_0x4cf4a0[_0x44b8('0x32')]['ids'])['then'](function(){if(_[_0x44b8('0x7c')](_0x4cf4a0['query'][_0x44b8('0x67')])){for(var _0x4dc333=0x0;_0x4dc333<_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x44b8('0x37')];_0x4dc333+=0x1){socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x4dc333]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}}else{socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}});}})[_0x44b8('0x13')](function(_0x4026d7){return db[_0x44b8('0x62')]['destroy']({'where':{'VoiceQueueId':_0x4cf4a0[_0x44b8('0x2f')]['id'],'UserId':_0x4cf4a0['query'][_0x44b8('0x67')]}})[_0x44b8('0x13')](function(){return _0x4026d7;});})[_0x44b8('0x13')](respondWithStatusCode(_0x1443bd,null))[_0x44b8('0x2d')](handleError(_0x1443bd,null));};exports[_0x44b8('0x7e')]=function(_0x22e5ae,_0x2f3340){var _0x4d98de={};var _0x597139={};var _0x2fffd5;var _0x3c90c2;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x22e5ae[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2f3340,null))[_0x44b8('0x13')](function(_0x208c53){if(_0x208c53){_0x2fffd5=_0x208c53;_0x597139[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x58')][_0x44b8('0x24')]);_0x597139['query']=_[_0x44b8('0x31')](_0x22e5ae[_0x44b8('0x32')]);_0x597139[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],_0x597139['query']);_0x4d98de['attributes']=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],qs['fields'](_0x22e5ae['query'][_0x44b8('0x36')]));_0x4d98de['attributes']=_0x4d98de[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4d98de[_0x44b8('0x35')]:_0x597139[_0x44b8('0x30')];_0x4d98de[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4d98de['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x22e5ae[_0x44b8('0x32')],_0x597139['filters']));if(_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4d98de['where']=_['merge'](_0x4d98de['where'],{'$or':_['map'](_0x4d98de[_0x44b8('0x35')],function(_0x5e423c){var _0x48065d={};_0x48065d[_0x5e423c]={'$like':'%'+_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x48065d;})});}_0x4d98de=_[_0x44b8('0x39')]({},_0x4d98de,_0x22e5ae['options']);return _0x2fffd5[_0x44b8('0x7e')](_0x4d98de);}})['then'](function(_0x230407){if(_0x230407){_0x3c90c2=_0x230407[_0x44b8('0x37')];if(!_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4d98de[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4d98de['offset']=qs['offset'](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0x2fffd5['getAgents'](_0x4d98de);}})[_0x44b8('0x13')](function(_0x188744){if(_0x188744){return _0x188744?{'count':_0x3c90c2,'rows':_0x188744}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2f3340,null))[_0x44b8('0x2d')](handleError(_0x2f3340,null));};exports[_0x44b8('0x7f')]=function(_0x2da727,_0x319520){var _0x2f7550={};var _0x57d24f={};var _0x223e54;var _0x3e5fa8;return db[_0x44b8('0x29')]['findOne']({'where':{'id':_0x2da727[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x319520,null))[_0x44b8('0x13')](function(_0x5370a5){if(_0x5370a5){_0x223e54=_0x5370a5;_0x57d24f[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x62')][_0x44b8('0x24')]);_0x57d24f[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x2da727[_0x44b8('0x32')]);_0x57d24f[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x57d24f[_0x44b8('0x30')],_0x57d24f[_0x44b8('0x32')]);_0x2f7550[_0x44b8('0x35')]=_['intersection'](_0x57d24f[_0x44b8('0x30')],qs['fields'](_0x2da727[_0x44b8('0x32')]['fields']));_0x2f7550[_0x44b8('0x35')]=_0x2f7550[_0x44b8('0x35')][_0x44b8('0x37')]?_0x2f7550[_0x44b8('0x35')]:_0x57d24f[_0x44b8('0x30')];_0x2f7550[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x2da727['query'][_0x44b8('0x4d')]);_0x2f7550[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x2da727[_0x44b8('0x32')],_0x57d24f[_0x44b8('0x33')]));if(_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]){_0x2f7550[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x2f7550[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x2f7550[_0x44b8('0x35')],function(_0x4281a6){var _0x4bb399={};_0x4bb399[_0x4281a6]={'$like':'%'+_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x4bb399;})});}_0x2f7550=_['merge']({},_0x2f7550,_0x2da727[_0x44b8('0x3a')]);return _0x223e54[_0x44b8('0x7f')](_0x2f7550);}})[_0x44b8('0x13')](function(_0x1f389e){if(_0x1f389e){_0x3e5fa8=_0x1f389e[_0x44b8('0x37')];if(!_0x2da727['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x2f7550[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x2da727['query'][_0x44b8('0x10')]);_0x2f7550[_0x44b8('0xf')]=qs['offset'](_0x2da727['query']['offset']);}return _0x223e54['getMembers'](_0x2f7550);}})[_0x44b8('0x13')](function(_0x5824a8){return _0x5824a8?{'count':_0x3e5fa8,'rows':_0x5824a8}:null;})['then'](respondWithResult(_0x319520,null))[_0x44b8('0x2d')](handleError(_0x319520,null));};exports[_0x44b8('0x80')]=function(_0x87a38,_0x54adf9){var _0x44dc3d={};var _0x32dafb={};var _0x3c8e0c;var _0x21ea61;return db['VoiceQueue'][_0x44b8('0x49')]({'where':{'id':_0x87a38['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x54adf9,null))[_0x44b8('0x13')](function(_0x56cfa5){if(_0x56cfa5){_0x3c8e0c=_0x56cfa5;_0x32dafb[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x32dafb[_0x44b8('0x32')]=_['keys'](_0x87a38['query']);_0x32dafb[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],_0x32dafb[_0x44b8('0x32')]);_0x44dc3d[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x36')]));_0x44dc3d[_0x44b8('0x35')]=_0x44dc3d[_0x44b8('0x35')]['length']?_0x44dc3d['attributes']:_0x32dafb[_0x44b8('0x30')];_0x44dc3d['order']=qs[_0x44b8('0x4d')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x44dc3d['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x87a38[_0x44b8('0x32')],_0x32dafb[_0x44b8('0x33')]));if(_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]){_0x44dc3d['where']=_[_0x44b8('0x39')](_0x44dc3d[_0x44b8('0x28')],{'$or':_['map'](_0x44dc3d[_0x44b8('0x35')],function(_0x1ffa05){var _0x22edd7={};_0x22edd7[_0x1ffa05]={'$like':'%'+_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x22edd7;})});}_0x44dc3d=_['merge']({},_0x44dc3d,_0x87a38[_0x44b8('0x3a')]);return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})[_0x44b8('0x13')](function(_0x2fca1a){if(_0x2fca1a){_0x21ea61=_0x2fca1a[_0x44b8('0x37')];if(!_0x87a38[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x44dc3d[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x87a38['query'][_0x44b8('0x10')]);_0x44dc3d[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x87a38['query']['offset']);}return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})['then'](function(_0x9458fb){if(_0x9458fb){return _0x9458fb?{'count':_0x21ea61,'rows':_0x9458fb}:null;}})[_0x44b8('0x13')](respondWithResult(_0x54adf9,null))[_0x44b8('0x2d')](handleError(_0x54adf9,null));};exports[_0x44b8('0x82')]=function(_0x2eb6ce,_0x105ca0){var _0x25f364=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x77c009,_0x161362;return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2eb6ce[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x105ca0,null))['then'](function(_0x4d88a6){if(_0x4d88a6){_0x161362=_0x4d88a6;return _0x4d88a6[_0x44b8('0x82')](_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x67')],_[_0x44b8('0x45')](_0x2eb6ce[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x4b49df){var _0xbf96c1;_0x77c009=_0x4b49df||[];var _0x1f6244=[];if(_0x4b49df){for(var _0x96a3cd=0x0;_0x96a3cd<_0x4b49df['length'];_0x96a3cd+=0x1){var _0x16721d=_0x4b49df[_0x96a3cd][_0x44b8('0x14')]({'plain':!![]});_0x161362[_0x44b8('0x83')]=_0x2eb6ce[_0x44b8('0x3c')]['dialCheckDuplicateType']?_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x83')]:_0x161362[_0x44b8('0x83')];switch(_0x161362['dialCheckDuplicateType']){case'always':_0xbf96c1=squel['insert']()['into']('cm_hopper')[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x85'),'phone')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))[_0x44b8('0x68')](_0x16721d['CmListId'][_0x44b8('0x6f')](),'ListId')[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),'VoiceQueueId')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))['where'](_0x44b8('0x8b'))['where'](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e'))['where'](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x90'))[_0x44b8('0x69')](_0x44b8('0x91'))['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]()))[_0x44b8('0x28')]('phone\x20NOT\x20IN\x20(?)',squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x92'))[_0x44b8('0x69')](_0x44b8('0x93'))[_0x44b8('0x28')](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;case _0x44b8('0x94'):_0xbf96c1=squel[_0x44b8('0x95')]()['into'](_0x44b8('0x93'))[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),'ContactId',_0x44b8('0x88'),'VoiceQueueId',_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field'](_0x44b8('0x85'),_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id','ContactId')[_0x44b8('0x68')](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')]['toString']())['where'](_0x44b8('0x8e'))[_0x44b8('0x28')](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;default:_0xbf96c1=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper')[_0x44b8('0x84')](['phone',_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),'VoiceQueueId','createdAt',_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field']('phone',_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))['field'](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e')))[_0x44b8('0x6f')]();}_0x1f6244[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0xbf96c1));}return BPromise['all'](_0x1f6244);}})[_0x44b8('0x13')](function(){var _0x2ad4ab=[];var _0x196b4b=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper_additional_phones')[_0x44b8('0x84')]([_0x44b8('0x97'),_0x44b8('0x85'),_0x44b8('0x98'),_0x44b8('0x46'),_0x44b8('0x47')],squel['select']()[_0x44b8('0x68')](_0x44b8('0x99'))[_0x44b8('0x68')](_0x44b8('0x9a'))[_0x44b8('0x68')](_0x44b8('0x9b'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27','createdAt')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x9c'),'ci')['join'](_0x44b8('0x93'),'h','h.ContactId=ci.CmContactId')[_0x44b8('0x28')](_0x44b8('0x9d'),_0x25f364)[_0x44b8('0x28')](_0x44b8('0x9e'),'PHONE'))[_0x44b8('0x6f')]();_0x2ad4ab[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0x196b4b));return BPromise[_0x44b8('0x73')](_0x2ad4ab);})[_0x44b8('0x13')](function(){return _0x77c009;})[_0x44b8('0x13')](respondWithResult(_0x105ca0,null))[_0x44b8('0x2d')](handleError(_0x105ca0,null));};exports[_0x44b8('0x9f')]=function(_0x257702,_0x17560c){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x257702[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x17560c,null))[_0x44b8('0x13')](function(_0x4d11d5){if(_0x4d11d5){return _0x4d11d5[_0x44b8('0x9f')](_0x257702[_0x44b8('0x32')][_0x44b8('0x67')]);}})[_0x44b8('0x13')](function(_0xafca17){if(_0xafca17){return db['CmHopper']['destroy']({'where':{'ListId':_0x257702['query'][_0x44b8('0x67')],'VoiceQueueId':_0x257702[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(){return _0xafca17;});}})[_0x44b8('0x13')](respondWithStatusCode(_0x17560c,null))[_0x44b8('0x2d')](handleError(_0x17560c,null));};exports[_0x44b8('0xa0')]=function(_0x513302,_0xfdb408){var _0x119dda={};var _0x5834fe={};var _0xe5cc1e;var _0x4c55e6;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x513302['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xfdb408,null))[_0x44b8('0x13')](function(_0x537eab){if(_0x537eab){_0xe5cc1e=_0x537eab;_0x5834fe[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x5834fe['query']=_[_0x44b8('0x31')](_0x513302[_0x44b8('0x32')]);_0x5834fe[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5834fe[_0x44b8('0x30')],_0x5834fe[_0x44b8('0x32')]);_0x119dda[_0x44b8('0x35')]=_['intersection'](_0x5834fe[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x513302[_0x44b8('0x32')]['fields']));_0x119dda[_0x44b8('0x35')]=_0x119dda[_0x44b8('0x35')]['length']?_0x119dda[_0x44b8('0x35')]:_0x5834fe[_0x44b8('0x30')];_0x119dda[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x513302['query'][_0x44b8('0x4d')]);_0x119dda[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x513302[_0x44b8('0x32')],_0x5834fe['filters']));if(_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]){_0x119dda['where']=_[_0x44b8('0x39')](_0x119dda[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x119dda[_0x44b8('0x35')],function(_0x4e9376){var _0x25f31c={};_0x25f31c[_0x4e9376]={'$like':'%'+_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x25f31c;})});}_0x119dda=_[_0x44b8('0x39')]({},_0x119dda,_0x513302[_0x44b8('0x3a')]);return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x57e3c9){if(_0x57e3c9){_0x4c55e6=_0x57e3c9[_0x44b8('0x37')];if(!_0x513302[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x119dda['limit']=qs[_0x44b8('0x10')](_0x513302[_0x44b8('0x32')][_0x44b8('0x10')]);_0x119dda['offset']=qs['offset'](_0x513302[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x4a5916){if(_0x4a5916){return _0x4a5916?{'count':_0x4c55e6,'rows':_0x4a5916}:null;}})[_0x44b8('0x13')](respondWithResult(_0xfdb408,null))[_0x44b8('0x2d')](handleError(_0xfdb408,null));};exports['addBlackLists']=function(_0xd19a35,_0x2439f2){var _0x22a624;return db['VoiceQueue'][_0x44b8('0x1e')]({'where':{'id':_0xd19a35[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2439f2,null))[_0x44b8('0x13')](function(_0x14c021){if(_0x14c021){return _0x14c021['addBlackLists'](_0xd19a35[_0x44b8('0x3c')][_0x44b8('0x67')],_['omit'](_0xd19a35[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x3b9cd2){var _0xb6cadf;_0x22a624=_0x3b9cd2||[];var _0x2024eb=[];if(_0x3b9cd2){for(var _0x29af58=0x0;_0x29af58<_0x3b9cd2[_0x44b8('0x37')];_0x29af58+=0x1){var _0x3870a9=_0x3b9cd2[_0x29af58]['get']({'plain':!![]});_0xb6cadf=squel['insert']()['into']('cm_hopper_black')[_0x44b8('0x84')]([_0x44b8('0x85'),'ContactId',_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('phone',_0x44b8('0x85'))['field']('id','ContactId')[_0x44b8('0x68')](_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0xd19a35['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')](_0x44b8('0xa1'),_0x44b8('0x46'))[_0x44b8('0x68')](_0x44b8('0xa1'),'updatedAt')[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')]())[_0x44b8('0x28')](_0x44b8('0x8e')))[_0x44b8('0x6f')]();_0x2024eb[_0x44b8('0x6e')](db['sequelize'][_0x44b8('0x32')](_0xb6cadf));}return BPromise[_0x44b8('0x73')](_0x2024eb);}})[_0x44b8('0x13')](function(){return _0x22a624;})[_0x44b8('0x13')](respondWithResult(_0x2439f2,null))[_0x44b8('0x2d')](handleError(_0x2439f2,null));};exports[_0x44b8('0xa2')]=function(_0x4ec799,_0x3fa943){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4ec799[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3fa943,null))[_0x44b8('0x13')](function(_0x3b1643){if(_0x3b1643){return _0x3b1643['removeBlackLists'](_0x4ec799[_0x44b8('0x32')]['ids']);}})['then'](function(_0x9a5734){if(_0x9a5734){return db[_0x44b8('0x54')][_0x44b8('0x12')]({'where':{'ListId':_0x4ec799[_0x44b8('0x32')][_0x44b8('0x67')],'VoiceQueueId':_0x4ec799['params']['id']}})['then'](function(){return _0x9a5734;});}})['then'](respondWithStatusCode(_0x3fa943,null))[_0x44b8('0x2d')](handleError(_0x3fa943,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 81c236b..14836a5 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 _0x46c3=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','update','emit'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x46c3,0xa5));var _0x346c=function(_0x394e31,_0x299a75){_0x394e31=_0x394e31-0x0;var _0x486c7e=_0x46c3[_0x394e31];return _0x486c7e;};'use strict';var EventEmitter=require(_0x346c('0x0'));var VoiceQueue=require(_0x346c('0x1'))['db'][_0x346c('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x346c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x346c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x14fa54){return function(_0x29b57d,_0x43fcac,_0x1a8012){VoiceQueueEvents[_0x346c('0x5')](_0x14fa54+':'+_0x29b57d['id'],_0x29b57d);VoiceQueueEvents['emit'](_0x14fa54,_0x29b57d);_0x1a8012(null);};}for(var e in events){if(events[_0x346c('0x6')](e)){var event=events[e];VoiceQueue[_0x346c('0x7')](e,emitEvent(event));}}module[_0x346c('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xcab9=['hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x50f92b,_0x32fab3){var _0x5cedbc=function(_0x26a3a5){while(--_0x26a3a5){_0x50f92b['push'](_0x50f92b['shift']());}};_0x5cedbc(++_0x32fab3);}(_0xcab9,0x16d));var _0x9cab=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0xcab9[_0x3f88bc];return _0x4df1c4;};'use strict';var EventEmitter=require(_0x9cab('0x0'));var VoiceQueue=require(_0x9cab('0x1'))['db'][_0x9cab('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9cab('0x3')](0x0);var events={'afterCreate':_0x9cab('0x4'),'afterUpdate':_0x9cab('0x5'),'afterDestroy':_0x9cab('0x6')};function emitEvent(_0x43d2b7){return function(_0x50304e,_0x3af061,_0x36cadc){VoiceQueueEvents[_0x9cab('0x7')](_0x43d2b7+':'+_0x50304e['id'],_0x50304e);VoiceQueueEvents['emit'](_0x43d2b7,_0x50304e);_0x36cadc(null);};}for(var e in events){if(events[_0x9cab('0x8')](e)){var event=events[e];VoiceQueue[_0x9cab('0x9')](e,emitEvent(event));}}module[_0x9cab('0xa')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index b0e52ed..f93bcae 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 _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0x55ca,0x126));var _0xa55c=function(_0x460fd9,_0x4b4b97){_0x460fd9=_0x460fd9-0x0;var _0x424e18=_0x55ca[_0x460fd9];return _0x424e18;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x26c31e,_0xe3072a){var _0x469f89=function(_0x33f257){while(--_0x33f257){_0x26c31e['push'](_0x26c31e['shift']());}};_0x469f89(++_0xe3072a);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 00dc272..83b6705 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 _0x0239=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw','where','attributes','include','map','model','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0239,0x108));var _0x9023=function(_0x44fc22,_0x1f9c46){_0x44fc22=_0x44fc22-0x0;var _0x4f19ea=_0x0239[_0x44fc22];return _0x4f19ea;};'use strict';var _=require(_0x9023('0x0'));var util=require(_0x9023('0x1'));var moment=require(_0x9023('0x2'));var BPromise=require(_0x9023('0x3'));var rs=require(_0x9023('0x4'));var fs=require('fs');var Redis=require(_0x9023('0x5'));var db=require(_0x9023('0x6'))['db'];var utils=require(_0x9023('0x7'));var logger=require(_0x9023('0x8'))(_0x9023('0x9'));var config=require(_0x9023('0xa'));var jayson=require(_0x9023('0xb'));var client=jayson[_0x9023('0xc')]['http']({'port':0x232a});config[_0x9023('0xd')]=_[_0x9023('0xe')](config[_0x9023('0xd')],{'host':_0x9023('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9023('0xd')]));require(_0x9023('0x10'))[_0x9023('0x11')](socket);function respondWithRpcPromise(_0xe1f56d,_0x31ef94,_0x4a3240){return new BPromise(function(_0x164d43,_0x4ad494){return client['request'](_0xe1f56d,_0x4a3240)[_0x9023('0x12')](function(_0x4cc5a8){logger[_0x9023('0x13')](_0x9023('0x14'),_0x31ef94,_0x9023('0x15'));logger[_0x9023('0x16')](_0x9023('0x17'),_0x31ef94,_0x9023('0x15'),JSON[_0x9023('0x18')](_0x4cc5a8));if(_0x4cc5a8[_0x9023('0x19')]){if(_0x4cc5a8[_0x9023('0x19')]['code']===0x1f4){logger[_0x9023('0x19')](_0x9023('0x14'),_0x31ef94,_0x4cc5a8['error'][_0x9023('0x1a')]);return _0x4ad494(_0x4cc5a8[_0x9023('0x19')][_0x9023('0x1a')]);}logger[_0x9023('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x31ef94,_0x4cc5a8['error'][_0x9023('0x1a')]);return _0x164d43(_0x4cc5a8[_0x9023('0x19')][_0x9023('0x1a')]);}else{logger[_0x9023('0x13')](_0x9023('0x14'),_0x31ef94,_0x9023('0x15'));_0x164d43(_0x4cc5a8[_0x9023('0x1b')][_0x9023('0x1a')]);}})[_0x9023('0x1c')](function(_0x3f1b5c){logger[_0x9023('0x19')](_0x9023('0x14'),_0x31ef94,_0x3f1b5c);_0x4ad494(_0x3f1b5c);});});}exports['GetVoiceQueue']=function(_0x1e0ddf){var _0x1441c5=this;return new Promise(function(_0x5d8b89,_0x4e102e){return db['VoiceQueue'][_0x9023('0x1d')]({'raw':_0x1e0ddf[_0x9023('0x1e')]?_0x1e0ddf[_0x9023('0x1e')][_0x9023('0x1f')]===undefined?!![]:![]:!![],'where':_0x1e0ddf['options']?_0x1e0ddf[_0x9023('0x1e')][_0x9023('0x20')]||null:null,'attributes':_0x1e0ddf[_0x9023('0x1e')]?_0x1e0ddf[_0x9023('0x1e')][_0x9023('0x21')]||null:null,'limit':_0x1e0ddf[_0x9023('0x1e')]?_0x1e0ddf[_0x9023('0x1e')]['limit']||null:null,'include':_0x1e0ddf[_0x9023('0x1e')]?_0x1e0ddf['options'][_0x9023('0x22')]?_['map'](_0x1e0ddf[_0x9023('0x1e')][_0x9023('0x22')],function(_0x2cf7a9){return{'model':db[_0x2cf7a9['model']],'as':_0x2cf7a9['as'],'attributes':_0x2cf7a9[_0x9023('0x21')],'include':_0x2cf7a9[_0x9023('0x22')]?_[_0x9023('0x23')](_0x2cf7a9[_0x9023('0x22')],function(_0x2fb9d8){return{'model':db[_0x2fb9d8[_0x9023('0x24')]],'as':_0x2fb9d8['as'],'attributes':_0x2fb9d8[_0x9023('0x21')],'include':_0x2fb9d8[_0x9023('0x22')]?_[_0x9023('0x23')](_0x2fb9d8['include'],function(_0x47fd93){return{'model':db[_0x47fd93[_0x9023('0x24')]],'as':_0x47fd93['as'],'attributes':_0x47fd93[_0x9023('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x308b30){logger[_0x9023('0x13')]('GetVoiceQueue',_0x1e0ddf);logger[_0x9023('0x16')]('GetVoiceQueue',_0x1e0ddf,JSON[_0x9023('0x18')](_0x308b30));_0x5d8b89(_0x308b30);})[_0x9023('0x1c')](function(_0x457c78){logger[_0x9023('0x19')]('GetVoiceQueue',_0x457c78[_0x9023('0x1a')],_0x1e0ddf);_0x4e102e(_0x1441c5[_0x9023('0x19')](0x1f4,_0x457c78[_0x9023('0x1a')]));});});};exports[_0x9023('0x25')]=function(_0x5ba9f5){var _0x4a4331=this;return new Promise(function(_0x38a47f,_0x23cd0d){return db['VoiceQueue'][_0x9023('0x26')]({'raw':_0x5ba9f5[_0x9023('0x1e')]?_0x5ba9f5[_0x9023('0x1e')][_0x9023('0x1f')]===undefined?!![]:![]:!![],'where':_0x5ba9f5[_0x9023('0x1e')]?_0x5ba9f5[_0x9023('0x1e')]['where']||null:null,'attributes':_0x5ba9f5[_0x9023('0x1e')]?_0x5ba9f5['options'][_0x9023('0x21')]||null:null,'include':_0x5ba9f5[_0x9023('0x1e')]?_0x5ba9f5['options'][_0x9023('0x22')]?_[_0x9023('0x23')](_0x5ba9f5['options'][_0x9023('0x22')],function(_0x28ff12){return{'model':db[_0x28ff12['model']],'as':_0x28ff12['as'],'attributes':_0x28ff12['attributes'],'include':_0x28ff12[_0x9023('0x22')]?_['map'](_0x28ff12[_0x9023('0x22')],function(_0x50c050){return{'model':db[_0x50c050[_0x9023('0x24')]],'as':_0x50c050['as'],'attributes':_0x50c050['attributes'],'include':_0x50c050['include']?_[_0x9023('0x23')](_0x50c050[_0x9023('0x22')],function(_0x25c64c){return{'model':db[_0x25c64c[_0x9023('0x24')]],'as':_0x25c64c['as'],'attributes':_0x25c64c[_0x9023('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x142bfb){logger[_0x9023('0x13')](_0x9023('0x25'),_0x5ba9f5);logger[_0x9023('0x16')](_0x9023('0x25'),_0x5ba9f5,JSON[_0x9023('0x18')](_0x142bfb));_0x38a47f(_0x142bfb);})[_0x9023('0x1c')](function(_0x539c20){logger[_0x9023('0x19')]('ShowVoiceQueue',_0x539c20[_0x9023('0x1a')],_0x5ba9f5);_0x23cd0d(_0x4a4331[_0x9023('0x19')](0x1f4,_0x539c20[_0x9023('0x1a')]));});});}; \ No newline at end of file +var _0x5af2=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','include','map','model','stringify','catch','ShowVoiceQueue','find','where','util'];(function(_0x1ae106,_0x7b4fa5){var _0x472f8f=function(_0x236abf){while(--_0x236abf){_0x1ae106['push'](_0x1ae106['shift']());}};_0x472f8f(++_0x7b4fa5);}(_0x5af2,0x117));var _0x25af=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x5af2[_0x422905];return _0x33dc6c;};'use strict';var _=require('lodash');var util=require(_0x25af('0x0'));var moment=require(_0x25af('0x1'));var BPromise=require(_0x25af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25af('0x3'));var db=require(_0x25af('0x4'))['db'];var utils=require(_0x25af('0x5'));var logger=require(_0x25af('0x6'))(_0x25af('0x7'));var config=require('../../config/environment');var jayson=require(_0x25af('0x8'));var client=jayson['client'][_0x25af('0x9')]({'port':0x232a});config[_0x25af('0xa')]=_[_0x25af('0xb')](config[_0x25af('0xa')],{'host':_0x25af('0xc'),'port':0x18eb});var socket=require(_0x25af('0xd'))(new Redis(config['redis']));require(_0x25af('0xe'))[_0x25af('0xf')](socket);function respondWithRpcPromise(_0x196cb0,_0x11567e,_0x165261){return new BPromise(function(_0xdfb4ee,_0x4228dd){return client[_0x25af('0x10')](_0x196cb0,_0x165261)[_0x25af('0x11')](function(_0x637b36){logger[_0x25af('0x12')](_0x25af('0x13'),_0x11567e,_0x25af('0x14'));logger[_0x25af('0x15')](_0x25af('0x16'),_0x11567e,_0x25af('0x14'),JSON['stringify'](_0x637b36));if(_0x637b36[_0x25af('0x17')]){if(_0x637b36['error'][_0x25af('0x18')]===0x1f4){logger[_0x25af('0x17')](_0x25af('0x13'),_0x11567e,_0x637b36[_0x25af('0x17')][_0x25af('0x19')]);return _0x4228dd(_0x637b36[_0x25af('0x17')]['message']);}logger[_0x25af('0x17')](_0x25af('0x13'),_0x11567e,_0x637b36[_0x25af('0x17')][_0x25af('0x19')]);return _0xdfb4ee(_0x637b36['error'][_0x25af('0x19')]);}else{logger[_0x25af('0x12')](_0x25af('0x13'),_0x11567e,'request\x20sent');_0xdfb4ee(_0x637b36['result'][_0x25af('0x19')]);}})['catch'](function(_0x42b934){logger[_0x25af('0x17')](_0x25af('0x13'),_0x11567e,_0x42b934);_0x4228dd(_0x42b934);});});}exports[_0x25af('0x1a')]=function(_0x5e1e0d){var _0x148b65=this;return new Promise(function(_0x11437b,_0x4037f8){return db[_0x25af('0x1b')][_0x25af('0x1c')]({'raw':_0x5e1e0d[_0x25af('0x1d')]?_0x5e1e0d[_0x25af('0x1d')][_0x25af('0x1e')]===undefined?!![]:![]:!![],'where':_0x5e1e0d['options']?_0x5e1e0d[_0x25af('0x1d')]['where']||null:null,'attributes':_0x5e1e0d[_0x25af('0x1d')]?_0x5e1e0d[_0x25af('0x1d')][_0x25af('0x1f')]||null:null,'limit':_0x5e1e0d[_0x25af('0x1d')]?_0x5e1e0d[_0x25af('0x1d')]['limit']||null:null,'include':_0x5e1e0d[_0x25af('0x1d')]?_0x5e1e0d[_0x25af('0x1d')][_0x25af('0x20')]?_[_0x25af('0x21')](_0x5e1e0d[_0x25af('0x1d')]['include'],function(_0xc56036){return{'model':db[_0xc56036['model']],'as':_0xc56036['as'],'attributes':_0xc56036[_0x25af('0x1f')],'include':_0xc56036['include']?_[_0x25af('0x21')](_0xc56036[_0x25af('0x20')],function(_0x4d666a){return{'model':db[_0x4d666a[_0x25af('0x22')]],'as':_0x4d666a['as'],'attributes':_0x4d666a[_0x25af('0x1f')],'include':_0x4d666a['include']?_[_0x25af('0x21')](_0x4d666a[_0x25af('0x20')],function(_0xdefacc){return{'model':db[_0xdefacc['model']],'as':_0xdefacc['as'],'attributes':_0xdefacc[_0x25af('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14732c){logger[_0x25af('0x12')]('GetVoiceQueue',_0x5e1e0d);logger[_0x25af('0x15')](_0x25af('0x1a'),_0x5e1e0d,JSON[_0x25af('0x23')](_0x14732c));_0x11437b(_0x14732c);})[_0x25af('0x24')](function(_0x4cc00c){logger[_0x25af('0x17')](_0x25af('0x1a'),_0x4cc00c['message'],_0x5e1e0d);_0x4037f8(_0x148b65[_0x25af('0x17')](0x1f4,_0x4cc00c[_0x25af('0x19')]));});});};exports[_0x25af('0x25')]=function(_0x146357){var _0x26c047=this;return new Promise(function(_0x5f5c7b,_0x2b2d7e){return db[_0x25af('0x1b')][_0x25af('0x26')]({'raw':_0x146357[_0x25af('0x1d')]?_0x146357['options'][_0x25af('0x1e')]===undefined?!![]:![]:!![],'where':_0x146357[_0x25af('0x1d')]?_0x146357['options'][_0x25af('0x27')]||null:null,'attributes':_0x146357[_0x25af('0x1d')]?_0x146357['options'][_0x25af('0x1f')]||null:null,'include':_0x146357[_0x25af('0x1d')]?_0x146357['options']['include']?_['map'](_0x146357[_0x25af('0x1d')]['include'],function(_0x3fe49a){return{'model':db[_0x3fe49a['model']],'as':_0x3fe49a['as'],'attributes':_0x3fe49a['attributes'],'include':_0x3fe49a[_0x25af('0x20')]?_[_0x25af('0x21')](_0x3fe49a[_0x25af('0x20')],function(_0xe215d3){return{'model':db[_0xe215d3[_0x25af('0x22')]],'as':_0xe215d3['as'],'attributes':_0xe215d3[_0x25af('0x1f')],'include':_0xe215d3[_0x25af('0x20')]?_[_0x25af('0x21')](_0xe215d3[_0x25af('0x20')],function(_0x11227b){return{'model':db[_0x11227b[_0x25af('0x22')]],'as':_0x11227b['as'],'attributes':_0x11227b[_0x25af('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x25af('0x11')](function(_0x587edb){logger[_0x25af('0x12')]('ShowVoiceQueue',_0x146357);logger[_0x25af('0x15')](_0x25af('0x25'),_0x146357,JSON[_0x25af('0x23')](_0x587edb));_0x5f5c7b(_0x587edb);})['catch'](function(_0x3de83b){logger[_0x25af('0x17')]('ShowVoiceQueue',_0x3de83b[_0x25af('0x19')],_0x146357);_0x2b2d7e(_0x26c047[_0x25af('0x17')](0x1f4,_0x3de83b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7f10368..4e646b3 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 _0xb552=['voiceQueue:','save','remove','update','emit','removeListener','register','length'];(function(_0x4b1b9e,_0x503a70){var _0x8137ff=function(_0x501f1e){while(--_0x501f1e){_0x4b1b9e['push'](_0x4b1b9e['shift']());}};_0x8137ff(++_0x503a70);}(_0xb552,0x79));var _0x2b55=function(_0x2bd752,_0x3e0192){_0x2bd752=_0x2bd752-0x0;var _0x35ff3f=_0xb552[_0x2bd752];return _0x35ff3f;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x2b55('0x0'),_0x2b55('0x1'),_0x2b55('0x2')];function createListener(_0x30ce5a,_0x284c01){return function(_0x422ecd){_0x284c01[_0x2b55('0x3')](_0x30ce5a,_0x422ecd);};}function removeListener(_0x128103,_0x31136c){return function(){VoiceQueueEvents[_0x2b55('0x4')](_0x128103,_0x31136c);};}exports[_0x2b55('0x5')]=function(_0x268b7f){for(var _0x1b3a9f=0x0,_0x2088dd=events[_0x2b55('0x6')];_0x1b3a9f<_0x2088dd;_0x1b3a9f++){var _0x59af3f=events[_0x1b3a9f];var _0x571bf7=createListener(_0x2b55('0x7')+_0x59af3f,_0x268b7f);VoiceQueueEvents['on'](_0x59af3f,_0x571bf7);}}; \ No newline at end of file +var _0x02ed=['voiceQueue:','./voiceQueue.events','update','register','length'];(function(_0x3a303e,_0x29fe2c){var _0x4d62dd=function(_0x3fca6c){while(--_0x3fca6c){_0x3a303e['push'](_0x3a303e['shift']());}};_0x4d62dd(++_0x29fe2c);}(_0x02ed,0xec));var _0xd02e=function(_0x30df14,_0x5034f4){_0x30df14=_0x30df14-0x0;var _0x3795c0=_0x02ed[_0x30df14];return _0x3795c0;};'use strict';var VoiceQueueEvents=require(_0xd02e('0x0'));var events=['save','remove',_0xd02e('0x1')];function createListener(_0x170a3d,_0x13fdda){return function(_0x443bb1){_0x13fdda['emit'](_0x170a3d,_0x443bb1);};}function removeListener(_0x4ab89a,_0x1e92a6){return function(){VoiceQueueEvents['removeListener'](_0x4ab89a,_0x1e92a6);};}exports[_0xd02e('0x2')]=function(_0x124dcb){for(var _0x339dea=0x0,_0x5e08ed=events[_0xd02e('0x3')];_0x339dea<_0x5e08ed;_0x339dea++){var _0x1e20a3=events[_0x339dea];var _0x3591e5=createListener(_0xd02e('0x4')+_0x1e20a3,_0x124dcb);VoiceQueueEvents['on'](_0x1e20a3,_0x3591e5);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 40e76f3..ee178e3 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 _0xf502=['describe','/index','getVoiceQueuesReport','/:id','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0xf502,0x1ab));var _0x2f50=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0xf502[_0x3c6ae2];return _0x4edda;};'use strict';var multer=require('multer');var util=require(_0x2f50('0x0'));var path=require(_0x2f50('0x1'));var timeout=require(_0x2f50('0x2'));var express=require(_0x2f50('0x3'));var router=express[_0x2f50('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2f50('0x5'));var interaction=require(_0x2f50('0x6'));var config=require(_0x2f50('0x7'));var controller=require(_0x2f50('0x8'));router[_0x2f50('0x9')]('/',auth[_0x2f50('0xa')](),controller[_0x2f50('0xb')]);router[_0x2f50('0x9')](_0x2f50('0xc'),auth[_0x2f50('0xa')](),controller[_0x2f50('0xd')]);router[_0x2f50('0x9')](_0x2f50('0xe'),auth[_0x2f50('0xa')](),controller[_0x2f50('0xf')]);router[_0x2f50('0x9')](_0x2f50('0x10'),auth[_0x2f50('0xa')](),controller['show']);router['post']('/',auth[_0x2f50('0xa')](),controller[_0x2f50('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2f50('0x12')]);router[_0x2f50('0x13')](_0x2f50('0x10'),auth[_0x2f50('0xa')](),controller[_0x2f50('0x14')]);module[_0x2f50('0x15')]=router; \ No newline at end of file +var _0x30e7=['put','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceQueueReport.controller','get','isAuthenticated','index','describe','getVoiceQueuesReport','/:id','show','create'];(function(_0x547660,_0x41ce24){var _0x1421bb=function(_0x306aa7){while(--_0x306aa7){_0x547660['push'](_0x547660['shift']());}};_0x1421bb(++_0x41ce24);}(_0x30e7,0x1a2));var _0x730e=function(_0x1cc99c,_0x5516b4){_0x1cc99c=_0x1cc99c-0x0;var _0x25567b=_0x30e7[_0x1cc99c];return _0x25567b;};'use strict';var multer=require('multer');var util=require(_0x730e('0x0'));var path=require('path');var timeout=require(_0x730e('0x1'));var express=require('express');var router=express[_0x730e('0x2')]();var fs_extra=require(_0x730e('0x3'));var auth=require(_0x730e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x730e('0x5'));router[_0x730e('0x6')]('/',auth[_0x730e('0x7')](),controller[_0x730e('0x8')]);router['get']('/describe',auth[_0x730e('0x7')](),controller[_0x730e('0x9')]);router['get']('/index',auth[_0x730e('0x7')](),controller[_0x730e('0xa')]);router[_0x730e('0x6')](_0x730e('0xb'),auth[_0x730e('0x7')](),controller[_0x730e('0xc')]);router['post']('/',auth[_0x730e('0x7')](),controller[_0x730e('0xd')]);router[_0x730e('0xe')](_0x730e('0xb'),auth[_0x730e('0x7')](),controller[_0x730e('0xf')]);router[_0x730e('0x10')](_0x730e('0xb'),auth[_0x730e('0x7')](),controller[_0x730e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index a5fbd1b..afcebaf 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 _0x49c4=['holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','format','diff','seconds','setDataValue','queuecallerleaveAt'];(function(_0x79524f,_0x487aab){var _0x138652=function(_0x512daa){while(--_0x512daa){_0x79524f['push'](_0x79524f['shift']());}};_0x138652(++_0x487aab);}(_0x49c4,0x195));var _0x449c=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x49c4[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0x449c('0x0'));var moment=require(_0x449c('0x1'));module[_0x449c('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x449c('0x3')]},'calleridnum':{'type':Sequelize[_0x449c('0x3')]},'calleridname':{'type':Sequelize[_0x449c('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x449c('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x449c('0x4')],'set':function(_0x5a2318){var _0x3011e5=moment(_0x5a2318);var _0x38a81e=moment(this[_0x449c('0x5')]('queuecallerjoinAt'))[_0x449c('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x37f47c=_0x3011e5[_0x449c('0x7')](_0x38a81e,_0x449c('0x8'));this[_0x449c('0x9')](_0x449c('0xa'),_0x5a2318);this[_0x449c('0x9')](_0x449c('0xb'),_0x37f47c||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x449c('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x449c('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x449c('0x4')]},'queuecallerexit':{'type':Sequelize[_0x449c('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x449c('0x3')],'comment':_0x449c('0xd')},'originalposition':{'type':Sequelize[_0x449c('0xe')]},'channel':{'type':Sequelize[_0x449c('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x449c('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x449c('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x449c('0xe')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x449c('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x449c('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x449c('0x3')],'comment':_0x449c('0xf')},'transferexten':{'type':Sequelize[_0x449c('0x3')]},'transferuniqueid':{'type':Sequelize[_0x449c('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x449c('0x3')]},'thirdDisposition':{'type':Sequelize[_0x449c('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x449c('0x3')]}}; \ No newline at end of file +var _0x74be=['seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x74be,0x157));var _0xe74b=function(_0x514200,_0xd92707){_0x514200=_0x514200-0x0;var _0x8fba22=_0x74be[_0x514200];return _0x8fba22;};'use strict';var Sequelize=require(_0xe74b('0x0'));var moment=require(_0xe74b('0x1'));module[_0xe74b('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xe74b('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe74b('0x3')]},'queue':{'type':Sequelize[_0xe74b('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xe74b('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xe74b('0x4')],'set':function(_0x4e17a4){var _0x4bd48e=moment(_0x4e17a4);var _0x31a2f8=moment(this['getDataValue'](_0xe74b('0x5')))[_0xe74b('0x6')](_0xe74b('0x7'));var _0x5276f7=_0x4bd48e[_0xe74b('0x8')](_0x31a2f8,_0xe74b('0x9'));this['setDataValue'](_0xe74b('0xa'),_0x4e17a4);this[_0xe74b('0xb')](_0xe74b('0xc'),_0x5276f7||null);}},'position':{'type':Sequelize[_0xe74b('0xd')]},'count':{'type':Sequelize[_0xe74b('0xd')]},'queuecallerabandon':{'type':Sequelize[_0xe74b('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xe74b('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xe74b('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xe74b('0x4')]},'queuecallerexit':{'type':Sequelize[_0xe74b('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xe74b('0xd')]},'channel':{'type':Sequelize[_0xe74b('0x3')]},'connectedlinenum':{'type':Sequelize[_0xe74b('0x3')]},'connectedlinename':{'type':Sequelize[_0xe74b('0x3')]},'accountcode':{'type':Sequelize[_0xe74b('0x3')]},'context':{'type':Sequelize[_0xe74b('0x3')]},'exten':{'type':Sequelize[_0xe74b('0x3')]},'priority':{'type':Sequelize[_0xe74b('0x3')]},'holdtime':{'type':Sequelize[_0xe74b('0xd')]},'mohtime':{'type':Sequelize[_0xe74b('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xe74b('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe74b('0x3')],'comment':_0xe74b('0xf')},'transferexten':{'type':Sequelize[_0xe74b('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xe74b('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe74b('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xe74b('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0xe74b('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index a6c7916..d676290 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 _0xff32=['apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','VoiceQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','create','body','find','getVoiceQueuesReport','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/util','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','end','status','json','undefined','offset','limit','Content-Range'];(function(_0x5c44ae,_0x21ce91){var _0x5a1ba5=function(_0xcef148){while(--_0xcef148){_0x5c44ae['push'](_0x5c44ae['shift']());}};_0x5a1ba5(++_0x21ce91);}(_0xff32,0x1b9));var _0x2ff3=function(_0x5b1097,_0x3ed62f){_0x5b1097=_0x5b1097-0x0;var _0x57979c=_0xff32[_0x5b1097];return _0x57979c;};'use strict';var emlformat=require(_0x2ff3('0x0'));var rimraf=require(_0x2ff3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2ff3('0x2'));var moment=require(_0x2ff3('0x3'));var BPromise=require(_0x2ff3('0x4'));var Mustache=require(_0x2ff3('0x5'));var util=require(_0x2ff3('0x6'));var path=require(_0x2ff3('0x7'));var sox=require('sox');var csv=require(_0x2ff3('0x8'));var ejs=require(_0x2ff3('0x9'));var fs=require('fs');var fs_extra=require(_0x2ff3('0xa'));var _=require(_0x2ff3('0xb'));var squel=require(_0x2ff3('0xc'));var crypto=require(_0x2ff3('0xd'));var jsforce=require(_0x2ff3('0xe'));var deskjs=require(_0x2ff3('0xf'));var toCsv=require(_0x2ff3('0x8'));var querystring=require(_0x2ff3('0x10'));var Papa=require(_0x2ff3('0x11'));var Redis=require(_0x2ff3('0x12'));var authService=require(_0x2ff3('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2ff3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2ff3('0x15'));var db=require('../../mysqldb')['db'];config[_0x2ff3('0x16')]=_['defaults'](config[_0x2ff3('0x16')],{'host':_0x2ff3('0x17'),'port':0x18eb});var socket=require(_0x2ff3('0x18'))(new Redis(config[_0x2ff3('0x16')]));require(_0x2ff3('0x19'))['register'](socket);function respondWithStatusCode(_0x7dd50f,_0x2b4c27){_0x2b4c27=_0x2b4c27||0xcc;return function(_0x178d5c){if(_0x178d5c){return _0x7dd50f['sendStatus'](_0x2b4c27);}return _0x7dd50f['status'](_0x2b4c27)[_0x2ff3('0x1a')]();};}function respondWithResult(_0x5a427b,_0x5ee6de){_0x5ee6de=_0x5ee6de||0xc8;return function(_0x323706){if(_0x323706){return _0x5a427b[_0x2ff3('0x1b')](_0x5ee6de)[_0x2ff3('0x1c')](_0x323706);}};}function respondWithFilteredResult(_0x48401d,_0x170919){return function(_0x45fcce){if(_0x45fcce){var _0x364629=typeof _0x170919['offset']===_0x2ff3('0x1d')&&typeof _0x170919['limit']==='undefined';var _0xd21601=_0x45fcce['count'];var _0x3382a4=_0x364629?0x0:_0x170919['offset'];var _0x48e399=_0x364629?_0x45fcce['count']:_0x170919[_0x2ff3('0x1e')]+_0x170919[_0x2ff3('0x1f')];var _0x100c34;if(_0x48e399>=_0xd21601){_0x48e399=_0xd21601;_0x100c34=0xc8;}else{_0x100c34=0xce;}_0x48401d[_0x2ff3('0x1b')](_0x100c34);return _0x48401d['set'](_0x2ff3('0x20'),_0x3382a4+'-'+_0x48e399+'/'+_0xd21601)[_0x2ff3('0x1c')](_0x45fcce);}return null;};}function patchUpdates(_0x4ce513){return function(_0x1dd70b){try{jsonpatch[_0x2ff3('0x21')](_0x1dd70b,_0x4ce513,!![]);}catch(_0x1ac6e0){return BPromise[_0x2ff3('0x22')](_0x1ac6e0);}return _0x1dd70b[_0x2ff3('0x23')]();};}function saveUpdates(_0x5e518e,_0x4bf799){return function(_0x5b387b){if(_0x5b387b){return _0x5b387b[_0x2ff3('0x24')](_0x5e518e)['then'](function(_0x2f341d){return _0x2f341d;});}return null;};}function removeEntity(_0x562179,_0x2de1be){return function(_0x508ebb){if(_0x508ebb){return _0x508ebb[_0x2ff3('0x25')]()[_0x2ff3('0x26')](function(){_0x562179[_0x2ff3('0x1b')](0xcc)[_0x2ff3('0x1a')]();});}};}function handleEntityNotFound(_0x486b80,_0x25757f){return function(_0x394234){if(!_0x394234){_0x486b80[_0x2ff3('0x27')](0x194);}return _0x394234;};}function handleError(_0x172124,_0x28fb06){_0x28fb06=_0x28fb06||0x1f4;return function(_0x40fe98){logger[_0x2ff3('0x28')](_0x40fe98[_0x2ff3('0x29')]);if(_0x40fe98[_0x2ff3('0x2a')]){delete _0x40fe98[_0x2ff3('0x2a')];}_0x172124[_0x2ff3('0x1b')](_0x28fb06)['send'](_0x40fe98);};}exports[_0x2ff3('0x2b')]=function(_0x4ca23c,_0x2267da){var _0x4f25d5={},_0x5dfa86={},_0x3d1db3={'count':0x0,'rows':[]};var _0x4af82a=_['map'](db[_0x2ff3('0x2c')][_0x2ff3('0x2d')],function(_0x36e040){return{'name':_0x36e040[_0x2ff3('0x2e')],'type':_0x36e040[_0x2ff3('0x2f')]['key']};});_0x5dfa86[_0x2ff3('0x30')]=_[_0x2ff3('0x31')](_0x4af82a,'name');_0x5dfa86[_0x2ff3('0x32')]=_[_0x2ff3('0x33')](_0x4ca23c[_0x2ff3('0x32')]);_0x5dfa86[_0x2ff3('0x34')]=_[_0x2ff3('0x35')](_0x5dfa86[_0x2ff3('0x30')],_0x5dfa86[_0x2ff3('0x32')]);_0x4f25d5[_0x2ff3('0x36')]=_[_0x2ff3('0x35')](_0x5dfa86[_0x2ff3('0x30')],qs['fields'](_0x4ca23c[_0x2ff3('0x32')][_0x2ff3('0x37')]));_0x4f25d5[_0x2ff3('0x36')]=_0x4f25d5[_0x2ff3('0x36')][_0x2ff3('0x38')]?_0x4f25d5['attributes']:_0x5dfa86['model'];if(!_0x4ca23c['query'][_0x2ff3('0x39')](_0x2ff3('0x3a'))){_0x4f25d5['limit']=qs[_0x2ff3('0x1f')](_0x4ca23c['query'][_0x2ff3('0x1f')]);_0x4f25d5[_0x2ff3('0x1e')]=qs['offset'](_0x4ca23c['query']['offset']);}_0x4f25d5[_0x2ff3('0x3b')]=qs[_0x2ff3('0x3c')](_0x4ca23c[_0x2ff3('0x32')][_0x2ff3('0x3c')]);_0x4f25d5[_0x2ff3('0x3d')]=qs[_0x2ff3('0x34')](_[_0x2ff3('0x3e')](_0x4ca23c[_0x2ff3('0x32')],_0x5dfa86[_0x2ff3('0x34')]),_0x4af82a);if(_0x4ca23c['query'][_0x2ff3('0x3f')]){_0x4f25d5[_0x2ff3('0x3d')]=_[_0x2ff3('0x40')](_0x4f25d5[_0x2ff3('0x3d')],{'$or':_[_0x2ff3('0x31')](_0x4af82a,function(_0x4f35f3){if(_0x4f35f3[_0x2ff3('0x2f')]!==_0x2ff3('0x41')){var _0x2ff608={};_0x2ff608[_0x4f35f3[_0x2ff3('0x2a')]]={'$like':'%'+_0x4ca23c['query'][_0x2ff3('0x3f')]+'%'};return _0x2ff608;}})});}_0x4f25d5=_[_0x2ff3('0x40')]({},_0x4f25d5,_0x4ca23c[_0x2ff3('0x42')]);var _0x3a4e4e={'where':_0x4f25d5[_0x2ff3('0x3d')]};return db[_0x2ff3('0x2c')][_0x2ff3('0x43')](_0x3a4e4e)[_0x2ff3('0x26')](function(_0x3f4b2a){_0x3d1db3[_0x2ff3('0x43')]=_0x3f4b2a;if(_0x4ca23c[_0x2ff3('0x32')][_0x2ff3('0x44')]){_0x4f25d5['include']=[{'all':!![]}];}return db[_0x2ff3('0x2c')][_0x2ff3('0x45')](_0x4f25d5);})[_0x2ff3('0x26')](function(_0x53e40b){_0x3d1db3[_0x2ff3('0x46')]=_0x53e40b;return _0x3d1db3;})[_0x2ff3('0x26')](respondWithFilteredResult(_0x2267da,_0x4f25d5))[_0x2ff3('0x47')](handleError(_0x2267da,null));};exports[_0x2ff3('0x48')]=function(_0x5b52e1,_0x2e48da){var _0x41e5c5={'raw':![],'where':{'id':_0x5b52e1[_0x2ff3('0x49')]['id']}},_0x418e83={};_0x418e83[_0x2ff3('0x30')]=_[_0x2ff3('0x33')](db['VoiceQueueReport'][_0x2ff3('0x2d')]);_0x418e83['query']=_[_0x2ff3('0x33')](_0x5b52e1[_0x2ff3('0x32')]);_0x418e83[_0x2ff3('0x34')]=_[_0x2ff3('0x35')](_0x418e83[_0x2ff3('0x30')],_0x418e83[_0x2ff3('0x32')]);_0x41e5c5['attributes']=_[_0x2ff3('0x35')](_0x418e83[_0x2ff3('0x30')],qs['fields'](_0x5b52e1[_0x2ff3('0x32')][_0x2ff3('0x37')]));_0x41e5c5['attributes']=_0x41e5c5[_0x2ff3('0x36')][_0x2ff3('0x38')]?_0x41e5c5['attributes']:_0x418e83[_0x2ff3('0x30')];if(_0x5b52e1[_0x2ff3('0x32')][_0x2ff3('0x44')]){_0x41e5c5[_0x2ff3('0x4a')]=[{'all':!![]}];}_0x41e5c5=_[_0x2ff3('0x40')]({},_0x41e5c5,_0x5b52e1[_0x2ff3('0x42')]);return db[_0x2ff3('0x2c')]['find'](_0x41e5c5)[_0x2ff3('0x26')](handleEntityNotFound(_0x2e48da,null))[_0x2ff3('0x26')](respondWithResult(_0x2e48da,null))['catch'](handleError(_0x2e48da,null));};exports[_0x2ff3('0x4b')]=function(_0x32b048,_0x373b8d){return db['VoiceQueueReport'][_0x2ff3('0x4b')](_0x32b048['body'],{})['then'](respondWithResult(_0x373b8d,0xc9))[_0x2ff3('0x47')](handleError(_0x373b8d,null));};exports[_0x2ff3('0x24')]=function(_0x48364d,_0x26d62b){if(_0x48364d[_0x2ff3('0x4c')]['id']){delete _0x48364d[_0x2ff3('0x4c')]['id'];}return db[_0x2ff3('0x2c')][_0x2ff3('0x4d')]({'where':{'id':_0x48364d[_0x2ff3('0x49')]['id']}})[_0x2ff3('0x26')](handleEntityNotFound(_0x26d62b,null))[_0x2ff3('0x26')](saveUpdates(_0x48364d['body'],null))[_0x2ff3('0x26')](respondWithResult(_0x26d62b,null))[_0x2ff3('0x47')](handleError(_0x26d62b,null));};exports[_0x2ff3('0x25')]=function(_0x5203db,_0x2d4002){return db[_0x2ff3('0x2c')][_0x2ff3('0x4d')]({'where':{'id':_0x5203db[_0x2ff3('0x49')]['id']}})['then'](handleEntityNotFound(_0x2d4002,null))[_0x2ff3('0x26')](removeEntity(_0x2d4002,null))[_0x2ff3('0x47')](handleError(_0x2d4002,null));};exports['describe']=function(_0x2e698d,_0x457433){return db[_0x2ff3('0x2c')]['describe']()['then'](respondWithResult(_0x457433,null))['catch'](handleError(_0x457433,null));};exports[_0x2ff3('0x4e')]=function(_0x4fbe86,_0x3df181){var _0x376fb3={},_0x41a3ee={},_0x5aeae3={'count':0x0,'rows':[]};_0x41a3ee[_0x2ff3('0x30')]=_[_0x2ff3('0x33')](db['VoiceQueueReport'][_0x2ff3('0x2d')]);_0x41a3ee[_0x2ff3('0x32')]=_[_0x2ff3('0x33')](_0x4fbe86[_0x2ff3('0x32')]);_0x41a3ee['filters']=_['intersection'](_0x41a3ee[_0x2ff3('0x30')],_0x41a3ee[_0x2ff3('0x32')]);_0x376fb3[_0x2ff3('0x36')]=_[_0x2ff3('0x35')](_0x41a3ee[_0x2ff3('0x30')],qs[_0x2ff3('0x37')](_0x4fbe86[_0x2ff3('0x32')]['fields']));_0x376fb3[_0x2ff3('0x36')]=_0x376fb3[_0x2ff3('0x36')][_0x2ff3('0x38')]?_0x376fb3['attributes']:_0x41a3ee[_0x2ff3('0x30')];if(!_0x4fbe86['query'][_0x2ff3('0x39')](_0x2ff3('0x3a'))){_0x376fb3[_0x2ff3('0x1f')]=qs[_0x2ff3('0x1f')](_0x4fbe86['query']['limit']);_0x376fb3[_0x2ff3('0x1e')]=qs[_0x2ff3('0x1e')](_0x4fbe86[_0x2ff3('0x32')][_0x2ff3('0x1e')]);}_0x376fb3['order']=qs[_0x2ff3('0x3c')](_0x4fbe86[_0x2ff3('0x32')]['sort']);_0x376fb3['where']=qs[_0x2ff3('0x34')](_['pick'](_0x4fbe86['query'],_0x41a3ee[_0x2ff3('0x34')]));if(_0x4fbe86[_0x2ff3('0x32')][_0x2ff3('0x3f')]){_0x376fb3[_0x2ff3('0x3d')]=_[_0x2ff3('0x40')](_0x376fb3[_0x2ff3('0x3d')],{'$or':_[_0x2ff3('0x31')](_0x376fb3[_0x2ff3('0x36')],function(_0x2524c1){var _0x3e110b={};_0x3e110b[_0x2524c1]={'$like':'%'+_0x4fbe86[_0x2ff3('0x32')][_0x2ff3('0x3f')]+'%'};return _0x3e110b;})});}_0x376fb3=_[_0x2ff3('0x40')]({},_0x376fb3,_0x4fbe86[_0x2ff3('0x42')]);var _0x298424={'where':_0x376fb3[_0x2ff3('0x3d')]};return db[_0x2ff3('0x2c')][_0x2ff3('0x43')](_0x298424)[_0x2ff3('0x26')](function(_0x69c349){_0x5aeae3[_0x2ff3('0x43')]=_0x69c349;if(_0x4fbe86['query'][_0x2ff3('0x44')]){_0x376fb3['include']=[{'all':!![]}];}return db[_0x2ff3('0x2c')][_0x2ff3('0x45')](_0x376fb3);})[_0x2ff3('0x26')](function(_0x562704){_0x5aeae3[_0x2ff3('0x46')]=_0x562704;return _0x5aeae3;})[_0x2ff3('0x26')](respondWithFilteredResult(_0x3df181,_0x376fb3,_0x2ff3('0x4e')))[_0x2ff3('0x47')](handleError(_0x3df181,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x06fd=['VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','index'];(function(_0x330917,_0x327f78){var _0x2a9b51=function(_0x1ac192){while(--_0x1ac192){_0x330917['push'](_0x330917['shift']());}};_0x2a9b51(++_0x327f78);}(_0x06fd,0xcc));var _0xd06f=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0x06fd[_0x3b76f7];return _0x43984e;};'use strict';var emlformat=require(_0xd06f('0x0'));var rimraf=require(_0xd06f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd06f('0x2'));var rp=require(_0xd06f('0x3'));var moment=require(_0xd06f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd06f('0x5'));var path=require(_0xd06f('0x6'));var sox=require('sox');var csv=require(_0xd06f('0x7'));var ejs=require(_0xd06f('0x8'));var fs=require('fs');var fs_extra=require(_0xd06f('0x9'));var _=require(_0xd06f('0xa'));var squel=require(_0xd06f('0xb'));var crypto=require(_0xd06f('0xc'));var jsforce=require(_0xd06f('0xd'));var deskjs=require(_0xd06f('0xe'));var toCsv=require(_0xd06f('0x7'));var querystring=require(_0xd06f('0xf'));var Papa=require(_0xd06f('0x10'));var Redis=require(_0xd06f('0x11'));var authService=require(_0xd06f('0x12'));var qs=require(_0xd06f('0x13'));var as=require(_0xd06f('0x14'));var hardwareService=require(_0xd06f('0x15'));var logger=require(_0xd06f('0x16'))('api');var utils=require(_0xd06f('0x17'));var config=require(_0xd06f('0x18'));var licenseUtil=require(_0xd06f('0x19'));var db=require('../../mysqldb')['db'];config[_0xd06f('0x1a')]=_['defaults'](config[_0xd06f('0x1a')],{'host':_0xd06f('0x1b'),'port':0x18eb});var socket=require(_0xd06f('0x1c'))(new Redis(config[_0xd06f('0x1a')]));require(_0xd06f('0x1d'))[_0xd06f('0x1e')](socket);function respondWithStatusCode(_0xcd10c0,_0x294662){_0x294662=_0x294662||0xcc;return function(_0x4766e9){if(_0x4766e9){return _0xcd10c0[_0xd06f('0x1f')](_0x294662);}return _0xcd10c0[_0xd06f('0x20')](_0x294662)['end']();};}function respondWithResult(_0x23acab,_0x5d4d8f){_0x5d4d8f=_0x5d4d8f||0xc8;return function(_0x5c6f61){if(_0x5c6f61){return _0x23acab[_0xd06f('0x20')](_0x5d4d8f)[_0xd06f('0x21')](_0x5c6f61);}};}function respondWithFilteredResult(_0x468c02,_0x15cb08){return function(_0x103633){if(_0x103633){var _0xdc7bb5=typeof _0x15cb08[_0xd06f('0x22')]===_0xd06f('0x23')&&typeof _0x15cb08['limit']===_0xd06f('0x23');var _0x492fc1=_0x103633['count'];var _0x1234e0=_0xdc7bb5?0x0:_0x15cb08[_0xd06f('0x22')];var _0x5cba44=_0xdc7bb5?_0x103633[_0xd06f('0x24')]:_0x15cb08[_0xd06f('0x22')]+_0x15cb08[_0xd06f('0x25')];var _0x279f72;if(_0x5cba44>=_0x492fc1){_0x5cba44=_0x492fc1;_0x279f72=0xc8;}else{_0x279f72=0xce;}_0x468c02[_0xd06f('0x20')](_0x279f72);return _0x468c02[_0xd06f('0x26')](_0xd06f('0x27'),_0x1234e0+'-'+_0x5cba44+'/'+_0x492fc1)[_0xd06f('0x21')](_0x103633);}return null;};}function patchUpdates(_0x4cab51){return function(_0x46ea62){try{jsonpatch[_0xd06f('0x28')](_0x46ea62,_0x4cab51,!![]);}catch(_0x4e9621){return BPromise[_0xd06f('0x29')](_0x4e9621);}return _0x46ea62[_0xd06f('0x2a')]();};}function saveUpdates(_0x36b041,_0x20d3fa){return function(_0x5bde6b){if(_0x5bde6b){return _0x5bde6b[_0xd06f('0x2b')](_0x36b041)['then'](function(_0x2386ad){return _0x2386ad;});}return null;};}function removeEntity(_0xbacf01,_0x1d0360){return function(_0xe234f2){if(_0xe234f2){return _0xe234f2[_0xd06f('0x2c')]()[_0xd06f('0x2d')](function(){_0xbacf01[_0xd06f('0x20')](0xcc)[_0xd06f('0x2e')]();});}};}function handleEntityNotFound(_0x261f88,_0x21f371){return function(_0x58ee03){if(!_0x58ee03){_0x261f88[_0xd06f('0x1f')](0x194);}return _0x58ee03;};}function handleError(_0x2cc3f4,_0x206eb7){_0x206eb7=_0x206eb7||0x1f4;return function(_0x437e41){logger[_0xd06f('0x2f')](_0x437e41[_0xd06f('0x30')]);if(_0x437e41[_0xd06f('0x31')]){delete _0x437e41[_0xd06f('0x31')];}_0x2cc3f4['status'](_0x206eb7)['send'](_0x437e41);};}exports[_0xd06f('0x32')]=function(_0x214bed,_0x3b1799){var _0x311a9c={},_0x2a5238={},_0x1901e0={'count':0x0,'rows':[]};var _0x30357a=_['map'](db[_0xd06f('0x33')][_0xd06f('0x34')],function(_0x41153c){return{'name':_0x41153c[_0xd06f('0x35')],'type':_0x41153c[_0xd06f('0x36')][_0xd06f('0x37')]};});_0x2a5238[_0xd06f('0x38')]=_[_0xd06f('0x39')](_0x30357a,'name');_0x2a5238[_0xd06f('0x3a')]=_[_0xd06f('0x3b')](_0x214bed['query']);_0x2a5238['filters']=_[_0xd06f('0x3c')](_0x2a5238[_0xd06f('0x38')],_0x2a5238[_0xd06f('0x3a')]);_0x311a9c[_0xd06f('0x3d')]=_[_0xd06f('0x3c')](_0x2a5238['model'],qs[_0xd06f('0x3e')](_0x214bed[_0xd06f('0x3a')][_0xd06f('0x3e')]));_0x311a9c[_0xd06f('0x3d')]=_0x311a9c[_0xd06f('0x3d')][_0xd06f('0x3f')]?_0x311a9c[_0xd06f('0x3d')]:_0x2a5238['model'];if(!_0x214bed[_0xd06f('0x3a')][_0xd06f('0x40')](_0xd06f('0x41'))){_0x311a9c['limit']=qs[_0xd06f('0x25')](_0x214bed['query']['limit']);_0x311a9c[_0xd06f('0x22')]=qs[_0xd06f('0x22')](_0x214bed[_0xd06f('0x3a')][_0xd06f('0x22')]);}_0x311a9c[_0xd06f('0x42')]=qs['sort'](_0x214bed[_0xd06f('0x3a')]['sort']);_0x311a9c[_0xd06f('0x43')]=qs['filters'](_[_0xd06f('0x44')](_0x214bed[_0xd06f('0x3a')],_0x2a5238[_0xd06f('0x45')]),_0x30357a);if(_0x214bed[_0xd06f('0x3a')][_0xd06f('0x46')]){_0x311a9c[_0xd06f('0x43')]=_[_0xd06f('0x47')](_0x311a9c[_0xd06f('0x43')],{'$or':_[_0xd06f('0x39')](_0x30357a,function(_0x3e42ab){if(_0x3e42ab[_0xd06f('0x36')]!==_0xd06f('0x48')){var _0x2e6814={};_0x2e6814[_0x3e42ab['name']]={'$like':'%'+_0x214bed[_0xd06f('0x3a')]['filter']+'%'};return _0x2e6814;}})});}_0x311a9c=_[_0xd06f('0x47')]({},_0x311a9c,_0x214bed[_0xd06f('0x49')]);var _0x1ae1fa={'where':_0x311a9c[_0xd06f('0x43')]};return db['VoiceQueueReport']['count'](_0x1ae1fa)[_0xd06f('0x2d')](function(_0x18f709){_0x1901e0[_0xd06f('0x24')]=_0x18f709;if(_0x214bed[_0xd06f('0x3a')][_0xd06f('0x4a')]){_0x311a9c[_0xd06f('0x4b')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xd06f('0x4c')](_0x311a9c);})['then'](function(_0x3f3b01){_0x1901e0[_0xd06f('0x4d')]=_0x3f3b01;return _0x1901e0;})[_0xd06f('0x2d')](respondWithFilteredResult(_0x3b1799,_0x311a9c))[_0xd06f('0x4e')](handleError(_0x3b1799,null));};exports['show']=function(_0x43553c,_0x44876e){var _0x38be01={'raw':![],'where':{'id':_0x43553c[_0xd06f('0x4f')]['id']}},_0x14c2ed={};_0x14c2ed[_0xd06f('0x38')]=_[_0xd06f('0x3b')](db[_0xd06f('0x33')][_0xd06f('0x34')]);_0x14c2ed[_0xd06f('0x3a')]=_[_0xd06f('0x3b')](_0x43553c[_0xd06f('0x3a')]);_0x14c2ed[_0xd06f('0x45')]=_[_0xd06f('0x3c')](_0x14c2ed[_0xd06f('0x38')],_0x14c2ed[_0xd06f('0x3a')]);_0x38be01['attributes']=_[_0xd06f('0x3c')](_0x14c2ed[_0xd06f('0x38')],qs[_0xd06f('0x3e')](_0x43553c[_0xd06f('0x3a')][_0xd06f('0x3e')]));_0x38be01['attributes']=_0x38be01[_0xd06f('0x3d')]['length']?_0x38be01[_0xd06f('0x3d')]:_0x14c2ed[_0xd06f('0x38')];if(_0x43553c['query']['includeAll']){_0x38be01['include']=[{'all':!![]}];}_0x38be01=_[_0xd06f('0x47')]({},_0x38be01,_0x43553c[_0xd06f('0x49')]);return db[_0xd06f('0x33')][_0xd06f('0x50')](_0x38be01)['then'](handleEntityNotFound(_0x44876e,null))['then'](respondWithResult(_0x44876e,null))[_0xd06f('0x4e')](handleError(_0x44876e,null));};exports[_0xd06f('0x51')]=function(_0x5f06dd,_0x505029){return db[_0xd06f('0x33')][_0xd06f('0x51')](_0x5f06dd['body'],{})[_0xd06f('0x2d')](respondWithResult(_0x505029,0xc9))[_0xd06f('0x4e')](handleError(_0x505029,null));};exports['update']=function(_0x513afc,_0x58aae5){if(_0x513afc['body']['id']){delete _0x513afc[_0xd06f('0x52')]['id'];}return db[_0xd06f('0x33')]['find']({'where':{'id':_0x513afc['params']['id']}})[_0xd06f('0x2d')](handleEntityNotFound(_0x58aae5,null))[_0xd06f('0x2d')](saveUpdates(_0x513afc[_0xd06f('0x52')],null))[_0xd06f('0x2d')](respondWithResult(_0x58aae5,null))['catch'](handleError(_0x58aae5,null));};exports['destroy']=function(_0x402282,_0x4bd04c){return db[_0xd06f('0x33')]['find']({'where':{'id':_0x402282['params']['id']}})[_0xd06f('0x2d')](handleEntityNotFound(_0x4bd04c,null))[_0xd06f('0x2d')](removeEntity(_0x4bd04c,null))[_0xd06f('0x4e')](handleError(_0x4bd04c,null));};exports['describe']=function(_0xe8f0c6,_0x5e9bed){return db[_0xd06f('0x33')][_0xd06f('0x53')]()['then'](respondWithResult(_0x5e9bed,null))['catch'](handleError(_0x5e9bed,null));};exports[_0xd06f('0x54')]=function(_0x276986,_0x2c22bc){var _0x5da742={},_0x1ca32b={},_0x3e00f1={'count':0x0,'rows':[]};_0x1ca32b[_0xd06f('0x38')]=_[_0xd06f('0x3b')](db[_0xd06f('0x33')][_0xd06f('0x34')]);_0x1ca32b[_0xd06f('0x3a')]=_[_0xd06f('0x3b')](_0x276986[_0xd06f('0x3a')]);_0x1ca32b[_0xd06f('0x45')]=_['intersection'](_0x1ca32b[_0xd06f('0x38')],_0x1ca32b[_0xd06f('0x3a')]);_0x5da742[_0xd06f('0x3d')]=_[_0xd06f('0x3c')](_0x1ca32b[_0xd06f('0x38')],qs[_0xd06f('0x3e')](_0x276986['query'][_0xd06f('0x3e')]));_0x5da742[_0xd06f('0x3d')]=_0x5da742['attributes']['length']?_0x5da742[_0xd06f('0x3d')]:_0x1ca32b[_0xd06f('0x38')];if(!_0x276986[_0xd06f('0x3a')][_0xd06f('0x40')]('nolimit')){_0x5da742['limit']=qs[_0xd06f('0x25')](_0x276986[_0xd06f('0x3a')]['limit']);_0x5da742['offset']=qs['offset'](_0x276986['query'][_0xd06f('0x22')]);}_0x5da742[_0xd06f('0x42')]=qs['sort'](_0x276986[_0xd06f('0x3a')]['sort']);_0x5da742[_0xd06f('0x43')]=qs[_0xd06f('0x45')](_[_0xd06f('0x44')](_0x276986['query'],_0x1ca32b[_0xd06f('0x45')]));if(_0x276986[_0xd06f('0x3a')][_0xd06f('0x46')]){_0x5da742[_0xd06f('0x43')]=_[_0xd06f('0x47')](_0x5da742[_0xd06f('0x43')],{'$or':_[_0xd06f('0x39')](_0x5da742[_0xd06f('0x3d')],function(_0xcbac4c){var _0x5414b3={};_0x5414b3[_0xcbac4c]={'$like':'%'+_0x276986['query'][_0xd06f('0x46')]+'%'};return _0x5414b3;})});}_0x5da742=_['merge']({},_0x5da742,_0x276986[_0xd06f('0x49')]);var _0x10ef40={'where':_0x5da742['where']};return db[_0xd06f('0x33')]['count'](_0x10ef40)[_0xd06f('0x2d')](function(_0x2a2883){_0x3e00f1['count']=_0x2a2883;if(_0x276986[_0xd06f('0x3a')][_0xd06f('0x4a')]){_0x5da742[_0xd06f('0x4b')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x5da742);})['then'](function(_0x2ed628){_0x3e00f1[_0xd06f('0x4d')]=_0x2ed628;return _0x3e00f1;})[_0xd06f('0x2d')](respondWithFilteredResult(_0x2c22bc,_0x5da742,_0xd06f('0x54')))[_0xd06f('0x4e')](handleError(_0x2c22bc,null,_0xd06f('0x54')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 4f78b92..225a3ce 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 _0x0807=['hook','exports','events','VoiceQueueReport','save','remove','emit'];(function(_0x1b08d4,_0x8a710c){var _0x9aef3e=function(_0x4da607){while(--_0x4da607){_0x1b08d4['push'](_0x1b08d4['shift']());}};_0x9aef3e(++_0x8a710c);}(_0x0807,0x159));var _0x7080=function(_0x17c218,_0x4db32a){_0x17c218=_0x17c218-0x0;var _0x2b49ac=_0x0807[_0x17c218];return _0x2b49ac;};'use strict';var EventEmitter=require(_0x7080('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x7080('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7080('0x2'),'afterUpdate':'update','afterDestroy':_0x7080('0x3')};function emitEvent(_0xd1274a){return function(_0x2f6256,_0x375110,_0xe21207){VoiceQueueReportEvents[_0x7080('0x4')](_0xd1274a+':'+_0x2f6256['id'],_0x2f6256);VoiceQueueReportEvents[_0x7080('0x4')](_0xd1274a,_0x2f6256);_0xe21207(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x7080('0x5')](e,emitEvent(event));}}module[_0x7080('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xb8d6=['exports','events','../../mysqldb','VoiceQueueReport','save','update','remove','emit','hook'];(function(_0x3b3e99,_0x4fb1db){var _0x398558=function(_0x550693){while(--_0x550693){_0x3b3e99['push'](_0x3b3e99['shift']());}};_0x398558(++_0x4fb1db);}(_0xb8d6,0x196));var _0x6b8d=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xb8d6[_0x110c3d];return _0x226d67;};'use strict';var EventEmitter=require(_0x6b8d('0x0'));var VoiceQueueReport=require(_0x6b8d('0x1'))['db'][_0x6b8d('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b8d('0x3'),'afterUpdate':_0x6b8d('0x4'),'afterDestroy':_0x6b8d('0x5')};function emitEvent(_0x449f60){return function(_0x28e7b4,_0x5828af,_0x3121fb){VoiceQueueReportEvents[_0x6b8d('0x6')](_0x449f60+':'+_0x28e7b4['id'],_0x28e7b4);VoiceQueueReportEvents[_0x6b8d('0x6')](_0x449f60,_0x28e7b4);_0x3121fb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x6b8d('0x7')](e,emitEvent(event));}}module[_0x6b8d('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 6d27eeb..652acbf 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 _0x20a2=['rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','calleridnum','lodash','api','moment','bluebird','request-promise','path'];(function(_0x4f5d45,_0x194eef){var _0x5e7b6b=function(_0x3be38f){while(--_0x3be38f){_0x4f5d45['push'](_0x4f5d45['shift']());}};_0x5e7b6b(++_0x194eef);}(_0x20a2,0x102));var _0x220a=function(_0x3566ea,_0x50e87d){_0x3566ea=_0x3566ea-0x0;var _0x24c0b9=_0x20a2[_0x3566ea];return _0x24c0b9;};'use strict';var _=require(_0x220a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x220a('0x1'));var moment=require(_0x220a('0x2'));var BPromise=require(_0x220a('0x3'));var rp=require(_0x220a('0x4'));var fs=require('fs');var path=require(_0x220a('0x5'));var rimraf=require(_0x220a('0x6'));var config=require('../../config/environment');var attributes=require(_0x220a('0x7'));module[_0x220a('0x8')]=function(_0x1ccdf4,_0x1a69f8){return _0x1ccdf4[_0x220a('0x9')](_0x220a('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x220a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4e47=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','calleridnum'];(function(_0x456a4b,_0x51df8){var _0x42957c=function(_0x431de8){while(--_0x431de8){_0x456a4b['push'](_0x456a4b['shift']());}};_0x42957c(++_0x51df8);}(_0x4e47,0x12b));var _0x74e4=function(_0x28a636,_0x153ae1){_0x28a636=_0x28a636-0x0;var _0x149470=_0x4e47[_0x28a636];return _0x149470;};'use strict';var _=require(_0x74e4('0x0'));var util=require(_0x74e4('0x1'));var logger=require(_0x74e4('0x2'))('api');var moment=require(_0x74e4('0x3'));var BPromise=require('bluebird');var rp=require(_0x74e4('0x4'));var fs=require('fs');var path=require(_0x74e4('0x5'));var rimraf=require(_0x74e4('0x6'));var config=require(_0x74e4('0x7'));var attributes=require(_0x74e4('0x8'));module[_0x74e4('0x9')]=function(_0x4bf1b3,_0x4f33ae){return _0x4bf1b3['define'](_0x74e4('0xa'),attributes,{'tableName':_0x74e4('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x74e4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index fcc6294..c65e4a1 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 _0x6541=['limit','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','attributes','include','model','map','stringify','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','where'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x6541,0x169));var _0x1654=function(_0x1fbc26,_0x3ef8d4){_0x1fbc26=_0x1fbc26-0x0;var _0x1f9cf5=_0x6541[_0x1fbc26];return _0x1f9cf5;};'use strict';var _=require('lodash');var util=require(_0x1654('0x0'));var moment=require(_0x1654('0x1'));var BPromise=require(_0x1654('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1654('0x3'))['db'];var utils=require(_0x1654('0x4'));var logger=require(_0x1654('0x5'))('rpc');var config=require(_0x1654('0x6'));var jayson=require(_0x1654('0x7'));var client=jayson[_0x1654('0x8')][_0x1654('0x9')]({'port':0x232a});config[_0x1654('0xa')]=_[_0x1654('0xb')](config[_0x1654('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1654('0xc'))(new Redis(config['redis']));require(_0x1654('0xd'))[_0x1654('0xe')](socket);function respondWithRpcPromise(_0x1f9540,_0x5d5125,_0x50c88d){return new BPromise(function(_0x4fe77d,_0x40a839){return client[_0x1654('0xf')](_0x1f9540,_0x50c88d)[_0x1654('0x10')](function(_0x26f284){logger[_0x1654('0x11')](_0x1654('0x12'),_0x5d5125,_0x1654('0x13'));logger[_0x1654('0x14')](_0x1654('0x15'),_0x5d5125,_0x1654('0x13'),JSON['stringify'](_0x26f284));if(_0x26f284[_0x1654('0x16')]){if(_0x26f284[_0x1654('0x16')][_0x1654('0x17')]===0x1f4){logger[_0x1654('0x16')](_0x1654('0x12'),_0x5d5125,_0x26f284['error'][_0x1654('0x18')]);return _0x40a839(_0x26f284[_0x1654('0x16')][_0x1654('0x18')]);}logger[_0x1654('0x16')](_0x1654('0x12'),_0x5d5125,_0x26f284[_0x1654('0x16')][_0x1654('0x18')]);return _0x4fe77d(_0x26f284['error'][_0x1654('0x18')]);}else{logger[_0x1654('0x11')](_0x1654('0x12'),_0x5d5125,'request\x20sent');_0x4fe77d(_0x26f284['result'][_0x1654('0x18')]);}})[_0x1654('0x19')](function(_0xae182e){logger[_0x1654('0x16')](_0x1654('0x12'),_0x5d5125,_0xae182e);_0x40a839(_0xae182e);});});}exports[_0x1654('0x1a')]=function(_0x507558){var _0xbe1c8b=this;return new Promise(function(_0x44a277,_0x3658a4){return db[_0x1654('0x1b')]['findAll']({'raw':_0x507558[_0x1654('0x1c')]?_0x507558['options'][_0x1654('0x1d')]===undefined?!![]:![]:!![],'where':_0x507558[_0x1654('0x1c')]?_0x507558[_0x1654('0x1c')]['where']||null:null,'attributes':_0x507558[_0x1654('0x1c')]?_0x507558['options'][_0x1654('0x1e')]||null:null,'limit':_0x507558[_0x1654('0x1c')]?_0x507558['options']['limit']||null:null,'include':_0x507558['options']?_0x507558[_0x1654('0x1c')][_0x1654('0x1f')]?_['map'](_0x507558[_0x1654('0x1c')][_0x1654('0x1f')],function(_0x5c5f4c){return{'model':db[_0x5c5f4c[_0x1654('0x20')]],'as':_0x5c5f4c['as'],'attributes':_0x5c5f4c[_0x1654('0x1e')],'include':_0x5c5f4c[_0x1654('0x1f')]?_[_0x1654('0x21')](_0x5c5f4c[_0x1654('0x1f')],function(_0x9af683){return{'model':db[_0x9af683[_0x1654('0x20')]],'as':_0x9af683['as'],'attributes':_0x9af683[_0x1654('0x1e')],'include':_0x9af683[_0x1654('0x1f')]?_[_0x1654('0x21')](_0x9af683[_0x1654('0x1f')],function(_0x263c6d){return{'model':db[_0x263c6d[_0x1654('0x20')]],'as':_0x263c6d['as'],'attributes':_0x263c6d['attributes']};}):[]};}):[]};}):[]:[]})[_0x1654('0x10')](function(_0x1128f3){logger[_0x1654('0x11')](_0x1654('0x1a'),_0x507558);logger['debug'](_0x1654('0x1a'),_0x507558,JSON[_0x1654('0x22')](_0x1128f3));_0x44a277(_0x1128f3);})[_0x1654('0x19')](function(_0xa9f0fc){logger['error']('GetVoiceQueueReport',_0xa9f0fc[_0x1654('0x18')],_0x507558);_0x3658a4(_0xbe1c8b[_0x1654('0x16')](0x1f4,_0xa9f0fc[_0x1654('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x40804a){var _0x5b5047=this;return new Promise(function(_0x1698f6,_0x2f5a1b){return db[_0x1654('0x1b')]['create'](_0x40804a[_0x1654('0x23')],{'raw':_0x40804a[_0x1654('0x1c')]?_0x40804a['options']['raw']===undefined?!![]:![]:!![]})[_0x1654('0x10')](function(_0x20cf5b){logger[_0x1654('0x11')](_0x1654('0x24'),_0x40804a);logger['debug']('CreateVoiceQueueReport',_0x40804a,JSON[_0x1654('0x22')](_0x20cf5b));_0x1698f6(_0x20cf5b);})[_0x1654('0x19')](function(_0xb469b){logger[_0x1654('0x16')](_0x1654('0x24'),_0xb469b[_0x1654('0x18')],_0x40804a);_0x2f5a1b(_0x5b5047['error'](0x1f4,_0xb469b[_0x1654('0x18')]));});});};exports[_0x1654('0x25')]=function(_0x44106b){var _0x48745d=this;return new Promise(function(_0x5ca3a6,_0x1dfa6b){return db['VoiceQueueReport']['update'](_0x44106b[_0x1654('0x23')],{'raw':_0x44106b[_0x1654('0x1c')]?_0x44106b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44106b[_0x1654('0x1c')]?_0x44106b[_0x1654('0x1c')][_0x1654('0x26')]||null:null,'attributes':_0x44106b['options']?_0x44106b['options'][_0x1654('0x1e')]||null:null,'limit':_0x44106b['options']?_0x44106b['options'][_0x1654('0x27')]||null:null})[_0x1654('0x10')](function(_0x51dd7b){logger[_0x1654('0x11')](_0x1654('0x25'),_0x44106b);logger[_0x1654('0x14')](_0x1654('0x25'),_0x44106b,JSON[_0x1654('0x22')](_0x51dd7b));_0x5ca3a6(_0x51dd7b);})[_0x1654('0x19')](function(_0x9fdc39){logger['error'](_0x1654('0x25'),_0x9fdc39[_0x1654('0x18')],_0x44106b);_0x1dfa6b(_0x48745d[_0x1654('0x16')](0x1f4,_0x9fdc39['message']));});});}; \ No newline at end of file +var _0x34a8=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','info','request\x20sent','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch','VoiceQueueReport','options','raw','where','attributes','limit','include','map','model','then','debug','GetVoiceQueueReport','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','lodash','util'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x34a8,0x108));var _0x834a=function(_0x11b568,_0xfa5420){_0x11b568=_0x11b568-0x0;var _0x4f6f97=_0x34a8[_0x11b568];return _0x4f6f97;};'use strict';var _=require(_0x834a('0x0'));var util=require(_0x834a('0x1'));var moment=require('moment');var BPromise=require(_0x834a('0x2'));var rs=require(_0x834a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x834a('0x4'))['db'];var utils=require(_0x834a('0x5'));var logger=require(_0x834a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x834a('0x7')][_0x834a('0x8')]({'port':0x232a});config[_0x834a('0x9')]=_[_0x834a('0xa')](config[_0x834a('0x9')],{'host':_0x834a('0xb'),'port':0x18eb});var socket=require(_0x834a('0xc'))(new Redis(config['redis']));require(_0x834a('0xd'))[_0x834a('0xe')](socket);function respondWithRpcPromise(_0x53aa39,_0x17cb7e,_0xb25823){return new BPromise(function(_0x52cdee,_0xac91bc){return client['request'](_0x53aa39,_0xb25823)['then'](function(_0x1b17f5){logger[_0x834a('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x17cb7e,_0x834a('0x10'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x17cb7e,_0x834a('0x10'),JSON[_0x834a('0x11')](_0x1b17f5));if(_0x1b17f5[_0x834a('0x12')]){if(_0x1b17f5['error'][_0x834a('0x13')]===0x1f4){logger[_0x834a('0x12')](_0x834a('0x14'),_0x17cb7e,_0x1b17f5[_0x834a('0x12')]['message']);return _0xac91bc(_0x1b17f5['error'][_0x834a('0x15')]);}logger[_0x834a('0x12')](_0x834a('0x14'),_0x17cb7e,_0x1b17f5['error']['message']);return _0x52cdee(_0x1b17f5['error'][_0x834a('0x15')]);}else{logger[_0x834a('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x17cb7e,_0x834a('0x10'));_0x52cdee(_0x1b17f5['result'][_0x834a('0x15')]);}})[_0x834a('0x16')](function(_0xd0d339){logger[_0x834a('0x12')](_0x834a('0x14'),_0x17cb7e,_0xd0d339);_0xac91bc(_0xd0d339);});});}exports['GetVoiceQueueReport']=function(_0x2889b0){var _0x3c8303=this;return new Promise(function(_0x3313d8,_0x5ef4b3){return db[_0x834a('0x17')]['findAll']({'raw':_0x2889b0[_0x834a('0x18')]?_0x2889b0['options'][_0x834a('0x19')]===undefined?!![]:![]:!![],'where':_0x2889b0['options']?_0x2889b0['options'][_0x834a('0x1a')]||null:null,'attributes':_0x2889b0['options']?_0x2889b0[_0x834a('0x18')][_0x834a('0x1b')]||null:null,'limit':_0x2889b0[_0x834a('0x18')]?_0x2889b0[_0x834a('0x18')][_0x834a('0x1c')]||null:null,'include':_0x2889b0[_0x834a('0x18')]?_0x2889b0[_0x834a('0x18')][_0x834a('0x1d')]?_[_0x834a('0x1e')](_0x2889b0[_0x834a('0x18')]['include'],function(_0x46dff3){return{'model':db[_0x46dff3[_0x834a('0x1f')]],'as':_0x46dff3['as'],'attributes':_0x46dff3[_0x834a('0x1b')],'include':_0x46dff3['include']?_[_0x834a('0x1e')](_0x46dff3[_0x834a('0x1d')],function(_0x4593a5){return{'model':db[_0x4593a5[_0x834a('0x1f')]],'as':_0x4593a5['as'],'attributes':_0x4593a5[_0x834a('0x1b')],'include':_0x4593a5['include']?_[_0x834a('0x1e')](_0x4593a5['include'],function(_0x2a0655){return{'model':db[_0x2a0655['model']],'as':_0x2a0655['as'],'attributes':_0x2a0655['attributes']};}):[]};}):[]};}):[]:[]})[_0x834a('0x20')](function(_0x23ec06){logger[_0x834a('0xf')]('GetVoiceQueueReport',_0x2889b0);logger[_0x834a('0x21')](_0x834a('0x22'),_0x2889b0,JSON[_0x834a('0x11')](_0x23ec06));_0x3313d8(_0x23ec06);})[_0x834a('0x16')](function(_0x9c3e49){logger[_0x834a('0x12')](_0x834a('0x22'),_0x9c3e49['message'],_0x2889b0);_0x5ef4b3(_0x3c8303[_0x834a('0x12')](0x1f4,_0x9c3e49['message']));});});};exports['CreateVoiceQueueReport']=function(_0x3314bd){var _0x1e96da=this;return new Promise(function(_0xf06c7,_0x12c6f5){return db[_0x834a('0x17')]['create'](_0x3314bd[_0x834a('0x23')],{'raw':_0x3314bd[_0x834a('0x18')]?_0x3314bd[_0x834a('0x18')][_0x834a('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x166068){logger[_0x834a('0xf')](_0x834a('0x24'),_0x3314bd);logger[_0x834a('0x21')](_0x834a('0x24'),_0x3314bd,JSON[_0x834a('0x11')](_0x166068));_0xf06c7(_0x166068);})[_0x834a('0x16')](function(_0x209d99){logger[_0x834a('0x12')](_0x834a('0x24'),_0x209d99[_0x834a('0x15')],_0x3314bd);_0x12c6f5(_0x1e96da['error'](0x1f4,_0x209d99[_0x834a('0x15')]));});});};exports[_0x834a('0x25')]=function(_0x26b405){var _0x21632e=this;return new Promise(function(_0x13a1ab,_0x491a28){return db['VoiceQueueReport']['update'](_0x26b405['body'],{'raw':_0x26b405[_0x834a('0x18')]?_0x26b405[_0x834a('0x18')][_0x834a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26b405[_0x834a('0x18')]?_0x26b405[_0x834a('0x18')][_0x834a('0x1a')]||null:null,'attributes':_0x26b405[_0x834a('0x18')]?_0x26b405[_0x834a('0x18')]['attributes']||null:null,'limit':_0x26b405[_0x834a('0x18')]?_0x26b405[_0x834a('0x18')]['limit']||null:null})[_0x834a('0x20')](function(_0x4b907c){logger[_0x834a('0xf')]('UpdateVoiceQueueReport',_0x26b405);logger['debug']('UpdateVoiceQueueReport',_0x26b405,JSON[_0x834a('0x11')](_0x4b907c));_0x13a1ab(_0x4b907c);})['catch'](function(_0x7dcd1b){logger['error'](_0x834a('0x25'),_0x7dcd1b[_0x834a('0x15')],_0x26b405);_0x491a28(_0x21632e[_0x834a('0x12')](0x1f4,_0x7dcd1b[_0x834a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 94fda28..396daa4 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 _0xef1c=['removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save','update','emit'];(function(_0x453e24,_0xd4120a){var _0x403ea0=function(_0x38d305){while(--_0x38d305){_0x453e24['push'](_0x453e24['shift']());}};_0x403ea0(++_0xd4120a);}(_0xef1c,0x176));var _0xcef1=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xef1c[_0x618414];return _0x21c19a;};'use strict';var VoiceQueueReportEvents=require(_0xcef1('0x0'));var events=[_0xcef1('0x1'),'remove',_0xcef1('0x2')];function createListener(_0x234381,_0x149809){return function(_0x13b976){_0x149809[_0xcef1('0x3')](_0x234381,_0x13b976);};}function removeListener(_0x3872e2,_0x58f00c){return function(){VoiceQueueReportEvents[_0xcef1('0x4')](_0x3872e2,_0x58f00c);};}exports[_0xcef1('0x5')]=function(_0x24638a){for(var _0x484051=0x0,_0x6aca0e=events['length'];_0x484051<_0x6aca0e;_0x484051++){var _0x510da9=events[_0x484051];var _0x20b5e1=createListener(_0xcef1('0x6')+_0x510da9,_0x24638a);VoiceQueueReportEvents['on'](_0x510da9,_0x20b5e1);}}; \ No newline at end of file +var _0x6fad=['length','./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0x4721e9,_0x1b221f){var _0x2171e0=function(_0x4a8ee9){while(--_0x4a8ee9){_0x4721e9['push'](_0x4721e9['shift']());}};_0x2171e0(++_0x1b221f);}(_0x6fad,0x174));var _0xd6fa=function(_0x22cc36,_0x2c8292){_0x22cc36=_0x22cc36-0x0;var _0x7fc85=_0x6fad[_0x22cc36];return _0x7fc85;};'use strict';var VoiceQueueReportEvents=require(_0xd6fa('0x0'));var events=[_0xd6fa('0x1'),_0xd6fa('0x2'),_0xd6fa('0x3')];function createListener(_0x4f8a1c,_0x2f5f9b){return function(_0x4ae415){_0x2f5f9b[_0xd6fa('0x4')](_0x4f8a1c,_0x4ae415);};}function removeListener(_0x48f433,_0x3e76d0){return function(){VoiceQueueReportEvents[_0xd6fa('0x5')](_0x48f433,_0x3e76d0);};}exports['register']=function(_0x45dad4){for(var _0x329390=0x0,_0x291bd5=events[_0xd6fa('0x6')];_0x329390<_0x291bd5;_0x329390++){var _0x5a1bf0=events[_0x329390];var _0x1d2aaa=createListener('voiceQueueReport:'+_0x5a1bf0,_0x45dad4);VoiceQueueReportEvents['on'](_0x5a1bf0,_0x1d2aaa);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index bdab7e6..201aa45 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 _0xe852=['update','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x3e25ba,_0x4d5399){var _0x393fb8=function(_0x4fc023){while(--_0x4fc023){_0x3e25ba['push'](_0x3e25ba['shift']());}};_0x393fb8(++_0x4d5399);}(_0xe852,0x123));var _0x2e85=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xe852[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require('multer');var util=require(_0x2e85('0x0'));var path=require(_0x2e85('0x1'));var timeout=require(_0x2e85('0x2'));var express=require(_0x2e85('0x3'));var router=express[_0x2e85('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2e85('0x5'));var config=require(_0x2e85('0x6'));var controller=require(_0x2e85('0x7'));router[_0x2e85('0x8')]('/',auth[_0x2e85('0x9')](),controller[_0x2e85('0xa')]);router[_0x2e85('0x8')](_0x2e85('0xb'),auth['isAuthenticated'](),controller[_0x2e85('0xc')]);router[_0x2e85('0xd')]('/',auth[_0x2e85('0x9')](),controller['create']);router[_0x2e85('0xe')]('/:id',auth[_0x2e85('0x9')](),controller[_0x2e85('0xf')]);router[_0x2e85('0x10')](_0x2e85('0xb'),auth[_0x2e85('0x9')](),controller['destroy']);module[_0x2e85('0x11')]=router; \ No newline at end of file +var _0xbab3=['multer','path','connect-timeout','express','fs-extra','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','exports'];(function(_0x4d7a70,_0x2d3bfa){var _0x3aafbb=function(_0x43fbf2){while(--_0x43fbf2){_0x4d7a70['push'](_0x4d7a70['shift']());}};_0x3aafbb(++_0x2d3bfa);}(_0xbab3,0x130));var _0x3bab=function(_0x4c367b,_0x2f749e){_0x4c367b=_0x4c367b-0x0;var _0x122fcb=_0xbab3[_0x4c367b];return _0x122fcb;};'use strict';var multer=require(_0x3bab('0x0'));var util=require('util');var path=require(_0x3bab('0x1'));var timeout=require(_0x3bab('0x2'));var express=require(_0x3bab('0x3'));var router=express['Router']();var fs_extra=require(_0x3bab('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3bab('0x5'));router['get']('/',auth[_0x3bab('0x6')](),controller[_0x3bab('0x7')]);router[_0x3bab('0x8')](_0x3bab('0x9'),auth[_0x3bab('0x6')](),controller[_0x3bab('0xa')]);router[_0x3bab('0xb')]('/',auth[_0x3bab('0x6')](),controller[_0x3bab('0xc')]);router[_0x3bab('0xd')](_0x3bab('0x9'),auth['isAuthenticated'](),controller[_0x3bab('0xe')]);router['delete'](_0x3bab('0x9'),auth[_0x3bab('0x6')](),controller['destroy']);module[_0x3bab('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 8ec7fec..deb86a9 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 _0xa6df=['STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x142e16,_0x7942a5){var _0x24472c=function(_0x5cc1cf){while(--_0x5cc1cf){_0x142e16['push'](_0x142e16['shift']());}};_0x24472c(++_0x7942a5);}(_0xa6df,0xaf));var _0xfa6d=function(_0x3c94dd,_0xc986ec){_0x3c94dd=_0x3c94dd-0x0;var _0x445c03=_0xa6df[_0x3c94dd];return _0x445c03;};'use strict';var Sequelize=require(_0xfa6d('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xfa6d('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xfa6d('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xfa6d('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xfa6d('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xfa6d('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xfa6d('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xfa6d('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfa6d('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xfa6d('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xfa6d('0x2')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xfa6d('0x3'))}}; \ No newline at end of file +var _0xeb8a=['sequelize','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0xeb8a,0x1c8));var _0xaeb8=function(_0x4c7d5c,_0x36d719){_0x4c7d5c=_0x4c7d5c-0x0;var _0x1dea83=_0xeb8a[_0x4c7d5c];return _0x1dea83;};'use strict';var Sequelize=require(_0xaeb8('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xaeb8('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xaeb8('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xaeb8('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xaeb8('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xaeb8('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xaeb8('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xaeb8('0x2')],'allowNull':![],'defaultValue':Sequelize['literal'](_0xaeb8('0x3'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 617dece..39845b5 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 _0xdbaf=['type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filter','merge','where','VIRTUAL','options','VoiceQueuesLog','includeAll','rows','catch','show','params','keys','rawAttributes','create','body','find','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName'];(function(_0x1f6a60,_0x1465de){var _0x526310=function(_0x18fef2){while(--_0x18fef2){_0x1f6a60['push'](_0x1f6a60['shift']());}};_0x526310(++_0x1465de);}(_0xdbaf,0x1e1));var _0xfdba=function(_0x2fcad5,_0xe55a40){_0x2fcad5=_0x2fcad5-0x0;var _0x1f179e=_0xdbaf[_0x2fcad5];return _0x1f179e;};'use strict';var emlformat=require(_0xfdba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfdba('0x1'));var jsonpatch=require(_0xfdba('0x2'));var rp=require(_0xfdba('0x3'));var moment=require(_0xfdba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfdba('0x5'));var util=require(_0xfdba('0x6'));var path=require(_0xfdba('0x7'));var sox=require(_0xfdba('0x8'));var csv=require(_0xfdba('0x9'));var ejs=require(_0xfdba('0xa'));var fs=require('fs');var fs_extra=require(_0xfdba('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfdba('0xc'));var deskjs=require(_0xfdba('0xd'));var toCsv=require(_0xfdba('0x9'));var querystring=require(_0xfdba('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfdba('0xf'));var as=require(_0xfdba('0x10'));var hardwareService=require(_0xfdba('0x11'));var logger=require(_0xfdba('0x12'))(_0xfdba('0x13'));var utils=require(_0xfdba('0x14'));var config=require(_0xfdba('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xfdba('0x16'))['db'];function respondWithStatusCode(_0x10e2dc,_0x475e07){_0x475e07=_0x475e07||0xcc;return function(_0x38156d){if(_0x38156d){return _0x10e2dc[_0xfdba('0x17')](_0x475e07);}return _0x10e2dc['status'](_0x475e07)[_0xfdba('0x18')]();};}function respondWithResult(_0x47e9ac,_0x11c807){_0x11c807=_0x11c807||0xc8;return function(_0x44f3b9){if(_0x44f3b9){return _0x47e9ac[_0xfdba('0x19')](_0x11c807)['json'](_0x44f3b9);}};}function respondWithFilteredResult(_0x2e78dc,_0x189d41){return function(_0x2d810f){if(_0x2d810f){var _0x46e8cc=typeof _0x189d41[_0xfdba('0x1a')]===_0xfdba('0x1b')&&typeof _0x189d41['limit']===_0xfdba('0x1b');var _0x28cecc=_0x2d810f[_0xfdba('0x1c')];var _0x35aed8=_0x46e8cc?0x0:_0x189d41['offset'];var _0x2ab8ba=_0x46e8cc?_0x2d810f['count']:_0x189d41[_0xfdba('0x1a')]+_0x189d41['limit'];var _0x3bbe79;if(_0x2ab8ba>=_0x28cecc){_0x2ab8ba=_0x28cecc;_0x3bbe79=0xc8;}else{_0x3bbe79=0xce;}_0x2e78dc[_0xfdba('0x19')](_0x3bbe79);return _0x2e78dc[_0xfdba('0x1d')](_0xfdba('0x1e'),_0x35aed8+'-'+_0x2ab8ba+'/'+_0x28cecc)[_0xfdba('0x1f')](_0x2d810f);}return null;};}function patchUpdates(_0x155768){return function(_0x3aea47){try{jsonpatch[_0xfdba('0x20')](_0x3aea47,_0x155768,!![]);}catch(_0xb20871){return BPromise[_0xfdba('0x21')](_0xb20871);}return _0x3aea47[_0xfdba('0x22')]();};}function saveUpdates(_0x14f41e,_0x2bb7c4){return function(_0x56e13e){if(_0x56e13e){return _0x56e13e[_0xfdba('0x23')](_0x14f41e)[_0xfdba('0x24')](function(_0x350a62){return _0x350a62;});}return null;};}function removeEntity(_0x238db6,_0x49f831){return function(_0x857d4a){if(_0x857d4a){return _0x857d4a['destroy']()[_0xfdba('0x24')](function(){_0x238db6[_0xfdba('0x19')](0xcc)[_0xfdba('0x18')]();});}};}function handleEntityNotFound(_0x58be8b,_0x44d5a3){return function(_0x394714){if(!_0x394714){_0x58be8b[_0xfdba('0x17')](0x194);}return _0x394714;};}function handleError(_0x1397ef,_0x32e5bb){_0x32e5bb=_0x32e5bb||0x1f4;return function(_0x19ff47){logger[_0xfdba('0x25')](_0x19ff47[_0xfdba('0x26')]);if(_0x19ff47[_0xfdba('0x27')]){delete _0x19ff47[_0xfdba('0x27')];}_0x1397ef['status'](_0x32e5bb)[_0xfdba('0x28')](_0x19ff47);};}exports[_0xfdba('0x29')]=function(_0x415d6f,_0x5d2dcb){var _0x3e7eb4={},_0x587ab6={},_0x468503={'count':0x0,'rows':[]};var _0x3aad4d=_[_0xfdba('0x2a')](db['VoiceQueuesLog']['rawAttributes'],function(_0xd50fb0){return{'name':_0xd50fb0[_0xfdba('0x2b')],'type':_0xd50fb0[_0xfdba('0x2c')][_0xfdba('0x2d')]};});_0x587ab6[_0xfdba('0x2e')]=_['map'](_0x3aad4d,_0xfdba('0x27'));_0x587ab6['query']=_['keys'](_0x415d6f[_0xfdba('0x2f')]);_0x587ab6[_0xfdba('0x30')]=_[_0xfdba('0x31')](_0x587ab6[_0xfdba('0x2e')],_0x587ab6['query']);_0x3e7eb4['attributes']=_[_0xfdba('0x31')](_0x587ab6[_0xfdba('0x2e')],qs[_0xfdba('0x32')](_0x415d6f[_0xfdba('0x2f')]['fields']));_0x3e7eb4['attributes']=_0x3e7eb4[_0xfdba('0x33')][_0xfdba('0x34')]?_0x3e7eb4[_0xfdba('0x33')]:_0x587ab6['model'];if(!_0x415d6f['query'][_0xfdba('0x35')](_0xfdba('0x36'))){_0x3e7eb4[_0xfdba('0x37')]=qs[_0xfdba('0x37')](_0x415d6f[_0xfdba('0x2f')][_0xfdba('0x37')]);_0x3e7eb4[_0xfdba('0x1a')]=qs[_0xfdba('0x1a')](_0x415d6f[_0xfdba('0x2f')][_0xfdba('0x1a')]);}_0x3e7eb4[_0xfdba('0x38')]=qs['sort'](_0x415d6f['query'][_0xfdba('0x39')]);_0x3e7eb4['where']=qs[_0xfdba('0x30')](_['pick'](_0x415d6f[_0xfdba('0x2f')],_0x587ab6[_0xfdba('0x30')]),_0x3aad4d);if(_0x415d6f['query'][_0xfdba('0x3a')]){_0x3e7eb4['where']=_[_0xfdba('0x3b')](_0x3e7eb4[_0xfdba('0x3c')],{'$or':_['map'](_0x3aad4d,function(_0x13ed87){if(_0x13ed87[_0xfdba('0x2c')]!==_0xfdba('0x3d')){var _0x357ef4={};_0x357ef4[_0x13ed87[_0xfdba('0x27')]]={'$like':'%'+_0x415d6f[_0xfdba('0x2f')]['filter']+'%'};return _0x357ef4;}})});}_0x3e7eb4=_[_0xfdba('0x3b')]({},_0x3e7eb4,_0x415d6f[_0xfdba('0x3e')]);var _0x2f6cf4={'where':_0x3e7eb4[_0xfdba('0x3c')]};return db[_0xfdba('0x3f')]['count'](_0x2f6cf4)['then'](function(_0x4908a6){_0x468503[_0xfdba('0x1c')]=_0x4908a6;if(_0x415d6f[_0xfdba('0x2f')][_0xfdba('0x40')]){_0x3e7eb4['include']=[{'all':!![]}];}return db[_0xfdba('0x3f')]['findAll'](_0x3e7eb4);})[_0xfdba('0x24')](function(_0x5107b7){_0x468503[_0xfdba('0x41')]=_0x5107b7;return _0x468503;})['then'](respondWithFilteredResult(_0x5d2dcb,_0x3e7eb4))[_0xfdba('0x42')](handleError(_0x5d2dcb,null));};exports[_0xfdba('0x43')]=function(_0x1d2a8b,_0x21e289){var _0x2234d7={'raw':!![],'where':{'id':_0x1d2a8b[_0xfdba('0x44')]['id']}},_0x32e2e5={};_0x32e2e5[_0xfdba('0x2e')]=_[_0xfdba('0x45')](db[_0xfdba('0x3f')][_0xfdba('0x46')]);_0x32e2e5['query']=_[_0xfdba('0x45')](_0x1d2a8b['query']);_0x32e2e5[_0xfdba('0x30')]=_[_0xfdba('0x31')](_0x32e2e5[_0xfdba('0x2e')],_0x32e2e5[_0xfdba('0x2f')]);_0x2234d7[_0xfdba('0x33')]=_[_0xfdba('0x31')](_0x32e2e5[_0xfdba('0x2e')],qs[_0xfdba('0x32')](_0x1d2a8b[_0xfdba('0x2f')][_0xfdba('0x32')]));_0x2234d7[_0xfdba('0x33')]=_0x2234d7['attributes'][_0xfdba('0x34')]?_0x2234d7[_0xfdba('0x33')]:_0x32e2e5[_0xfdba('0x2e')];if(_0x1d2a8b[_0xfdba('0x2f')]['includeAll']){_0x2234d7['include']=[{'all':!![]}];}_0x2234d7=_[_0xfdba('0x3b')]({},_0x2234d7,_0x1d2a8b['options']);return db['VoiceQueuesLog']['find'](_0x2234d7)[_0xfdba('0x24')](handleEntityNotFound(_0x21e289,null))['then'](respondWithResult(_0x21e289,null))[_0xfdba('0x42')](handleError(_0x21e289,null));};exports['create']=function(_0x41846e,_0x42fda4){return db[_0xfdba('0x3f')][_0xfdba('0x47')](_0x41846e[_0xfdba('0x48')],{})['then'](respondWithResult(_0x42fda4,0xc9))[_0xfdba('0x42')](handleError(_0x42fda4,null));};exports[_0xfdba('0x23')]=function(_0x563537,_0xfcc7fc){if(_0x563537[_0xfdba('0x48')]['id']){delete _0x563537[_0xfdba('0x48')]['id'];}return db[_0xfdba('0x3f')][_0xfdba('0x49')]({'where':{'id':_0x563537[_0xfdba('0x44')]['id']}})[_0xfdba('0x24')](handleEntityNotFound(_0xfcc7fc,null))[_0xfdba('0x24')](saveUpdates(_0x563537[_0xfdba('0x48')],null))['then'](respondWithResult(_0xfcc7fc,null))[_0xfdba('0x42')](handleError(_0xfcc7fc,null));};exports[_0xfdba('0x4a')]=function(_0x172c21,_0x5e8cf8){return db[_0xfdba('0x3f')][_0xfdba('0x49')]({'where':{'id':_0x172c21[_0xfdba('0x44')]['id']}})[_0xfdba('0x24')](handleEntityNotFound(_0x5e8cf8,null))['then'](removeEntity(_0x5e8cf8,null))['catch'](handleError(_0x5e8cf8,null));}; \ No newline at end of file +var _0x562b=['rawAttributes','fieldName','key','model','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','length','includeAll','create','body','eml-format','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','VoiceQueuesLog'];(function(_0x454e36,_0x3add12){var _0x549fd0=function(_0x3e7b18){while(--_0x3e7b18){_0x454e36['push'](_0x454e36['shift']());}};_0x549fd0(++_0x3add12);}(_0x562b,0x1ce));var _0xb562=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x562b[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require(_0xb562('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb562('0x1'));var moment=require(_0xb562('0x2'));var BPromise=require(_0xb562('0x3'));var Mustache=require(_0xb562('0x4'));var util=require(_0xb562('0x5'));var path=require('path');var sox=require(_0xb562('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb562('0x7'));var _=require(_0xb562('0x8'));var squel=require(_0xb562('0x9'));var crypto=require(_0xb562('0xa'));var jsforce=require(_0xb562('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb562('0xc'));var querystring=require(_0xb562('0xd'));var Papa=require(_0xb562('0xe'));var Redis=require('ioredis');var authService=require(_0xb562('0xf'));var qs=require(_0xb562('0x10'));var as=require(_0xb562('0x11'));var hardwareService=require(_0xb562('0x12'));var logger=require('../../config/logger')(_0xb562('0x13'));var utils=require(_0xb562('0x14'));var config=require(_0xb562('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb562('0x16'))['db'];function respondWithStatusCode(_0x258634,_0x21b7a9){_0x21b7a9=_0x21b7a9||0xcc;return function(_0x3fea32){if(_0x3fea32){return _0x258634[_0xb562('0x17')](_0x21b7a9);}return _0x258634[_0xb562('0x18')](_0x21b7a9)[_0xb562('0x19')]();};}function respondWithResult(_0x47515c,_0x4dac38){_0x4dac38=_0x4dac38||0xc8;return function(_0x1f2983){if(_0x1f2983){return _0x47515c['status'](_0x4dac38)[_0xb562('0x1a')](_0x1f2983);}};}function respondWithFilteredResult(_0x2c004b,_0x20a372){return function(_0xbfc23c){if(_0xbfc23c){var _0x341430=typeof _0x20a372[_0xb562('0x1b')]==='undefined'&&typeof _0x20a372[_0xb562('0x1c')]==='undefined';var _0xfb9204=_0xbfc23c[_0xb562('0x1d')];var _0x3f111c=_0x341430?0x0:_0x20a372[_0xb562('0x1b')];var _0x470b5b=_0x341430?_0xbfc23c[_0xb562('0x1d')]:_0x20a372[_0xb562('0x1b')]+_0x20a372['limit'];var _0x3b869a;if(_0x470b5b>=_0xfb9204){_0x470b5b=_0xfb9204;_0x3b869a=0xc8;}else{_0x3b869a=0xce;}_0x2c004b[_0xb562('0x18')](_0x3b869a);return _0x2c004b[_0xb562('0x1e')]('Content-Range',_0x3f111c+'-'+_0x470b5b+'/'+_0xfb9204)[_0xb562('0x1a')](_0xbfc23c);}return null;};}function patchUpdates(_0x21d527){return function(_0xa9ac2c){try{jsonpatch[_0xb562('0x1f')](_0xa9ac2c,_0x21d527,!![]);}catch(_0x3a4f37){return BPromise[_0xb562('0x20')](_0x3a4f37);}return _0xa9ac2c[_0xb562('0x21')]();};}function saveUpdates(_0x3f5a5e,_0x3d4873){return function(_0x3412f0){if(_0x3412f0){return _0x3412f0[_0xb562('0x22')](_0x3f5a5e)[_0xb562('0x23')](function(_0x532c82){return _0x532c82;});}return null;};}function removeEntity(_0x5990a5,_0x5b8150){return function(_0x40206e){if(_0x40206e){return _0x40206e[_0xb562('0x24')]()[_0xb562('0x23')](function(){_0x5990a5['status'](0xcc)[_0xb562('0x19')]();});}};}function handleEntityNotFound(_0xd3aca3,_0x134737){return function(_0x41eeb4){if(!_0x41eeb4){_0xd3aca3[_0xb562('0x17')](0x194);}return _0x41eeb4;};}function handleError(_0x4424c5,_0x164cfc){_0x164cfc=_0x164cfc||0x1f4;return function(_0x28794f){logger[_0xb562('0x25')](_0x28794f[_0xb562('0x26')]);if(_0x28794f['name']){delete _0x28794f[_0xb562('0x27')];}_0x4424c5[_0xb562('0x18')](_0x164cfc)['send'](_0x28794f);};}exports[_0xb562('0x28')]=function(_0x247d15,_0x455c08){var _0x5b3b64={},_0x5b95b2={},_0x5c4b52={'count':0x0,'rows':[]};var _0x2928c8=_['map'](db[_0xb562('0x29')][_0xb562('0x2a')],function(_0xc3de31){return{'name':_0xc3de31[_0xb562('0x2b')],'type':_0xc3de31['type'][_0xb562('0x2c')]};});_0x5b95b2[_0xb562('0x2d')]=_['map'](_0x2928c8,_0xb562('0x27'));_0x5b95b2['query']=_['keys'](_0x247d15['query']);_0x5b95b2['filters']=_[_0xb562('0x2e')](_0x5b95b2[_0xb562('0x2d')],_0x5b95b2[_0xb562('0x2f')]);_0x5b3b64[_0xb562('0x30')]=_[_0xb562('0x2e')](_0x5b95b2['model'],qs[_0xb562('0x31')](_0x247d15['query'][_0xb562('0x31')]));_0x5b3b64[_0xb562('0x30')]=_0x5b3b64['attributes']['length']?_0x5b3b64[_0xb562('0x30')]:_0x5b95b2[_0xb562('0x2d')];if(!_0x247d15[_0xb562('0x2f')][_0xb562('0x32')](_0xb562('0x33'))){_0x5b3b64[_0xb562('0x1c')]=qs[_0xb562('0x1c')](_0x247d15[_0xb562('0x2f')][_0xb562('0x1c')]);_0x5b3b64[_0xb562('0x1b')]=qs[_0xb562('0x1b')](_0x247d15[_0xb562('0x2f')][_0xb562('0x1b')]);}_0x5b3b64[_0xb562('0x34')]=qs[_0xb562('0x35')](_0x247d15[_0xb562('0x2f')][_0xb562('0x35')]);_0x5b3b64[_0xb562('0x36')]=qs['filters'](_['pick'](_0x247d15[_0xb562('0x2f')],_0x5b95b2[_0xb562('0x37')]),_0x2928c8);if(_0x247d15[_0xb562('0x2f')][_0xb562('0x38')]){_0x5b3b64['where']=_[_0xb562('0x39')](_0x5b3b64[_0xb562('0x36')],{'$or':_['map'](_0x2928c8,function(_0x3b19ba){if(_0x3b19ba[_0xb562('0x3a')]!==_0xb562('0x3b')){var _0x2cf1bd={};_0x2cf1bd[_0x3b19ba[_0xb562('0x27')]]={'$like':'%'+_0x247d15[_0xb562('0x2f')]['filter']+'%'};return _0x2cf1bd;}})});}_0x5b3b64=_[_0xb562('0x39')]({},_0x5b3b64,_0x247d15[_0xb562('0x3c')]);var _0xaf6598={'where':_0x5b3b64[_0xb562('0x36')]};return db[_0xb562('0x29')][_0xb562('0x1d')](_0xaf6598)[_0xb562('0x23')](function(_0x362a3f){_0x5c4b52[_0xb562('0x1d')]=_0x362a3f;if(_0x247d15['query']['includeAll']){_0x5b3b64[_0xb562('0x3d')]=[{'all':!![]}];}return db[_0xb562('0x29')][_0xb562('0x3e')](_0x5b3b64);})[_0xb562('0x23')](function(_0x4bb78c){_0x5c4b52[_0xb562('0x3f')]=_0x4bb78c;return _0x5c4b52;})['then'](respondWithFilteredResult(_0x455c08,_0x5b3b64))[_0xb562('0x40')](handleError(_0x455c08,null));};exports[_0xb562('0x41')]=function(_0x5333c4,_0x55e4d8){var _0x4ec259={'raw':!![],'where':{'id':_0x5333c4[_0xb562('0x42')]['id']}},_0x206595={};_0x206595[_0xb562('0x2d')]=_[_0xb562('0x43')](db[_0xb562('0x29')][_0xb562('0x2a')]);_0x206595[_0xb562('0x2f')]=_['keys'](_0x5333c4[_0xb562('0x2f')]);_0x206595['filters']=_[_0xb562('0x2e')](_0x206595[_0xb562('0x2d')],_0x206595[_0xb562('0x2f')]);_0x4ec259[_0xb562('0x30')]=_[_0xb562('0x2e')](_0x206595['model'],qs[_0xb562('0x31')](_0x5333c4[_0xb562('0x2f')][_0xb562('0x31')]));_0x4ec259[_0xb562('0x30')]=_0x4ec259[_0xb562('0x30')][_0xb562('0x44')]?_0x4ec259[_0xb562('0x30')]:_0x206595[_0xb562('0x2d')];if(_0x5333c4['query'][_0xb562('0x45')]){_0x4ec259[_0xb562('0x3d')]=[{'all':!![]}];}_0x4ec259=_[_0xb562('0x39')]({},_0x4ec259,_0x5333c4['options']);return db[_0xb562('0x29')]['find'](_0x4ec259)['then'](handleEntityNotFound(_0x55e4d8,null))[_0xb562('0x23')](respondWithResult(_0x55e4d8,null))[_0xb562('0x40')](handleError(_0x55e4d8,null));};exports['create']=function(_0x4e533c,_0x26074b){return db['VoiceQueuesLog'][_0xb562('0x46')](_0x4e533c[_0xb562('0x47')],{})['then'](respondWithResult(_0x26074b,0xc9))[_0xb562('0x40')](handleError(_0x26074b,null));};exports[_0xb562('0x22')]=function(_0xc16406,_0x494bcf){if(_0xc16406[_0xb562('0x47')]['id']){delete _0xc16406[_0xb562('0x47')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0xc16406['params']['id']}})[_0xb562('0x23')](handleEntityNotFound(_0x494bcf,null))['then'](saveUpdates(_0xc16406[_0xb562('0x47')],null))[_0xb562('0x23')](respondWithResult(_0x494bcf,null))[_0xb562('0x40')](handleError(_0x494bcf,null));};exports[_0xb562('0x24')]=function(_0x4e562d,_0x4b8300){return db[_0xb562('0x29')]['find']({'where':{'id':_0x4e562d[_0xb562('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b8300,null))[_0xb562('0x23')](removeEntity(_0x4b8300,null))[_0xb562('0x40')](handleError(_0x4b8300,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index ef4d3cc..12fa82b 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 _0x4d7f=['dtm','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','define','voice_queues_log','event_dtm'];(function(_0x8f1205,_0x16aa35){var _0x4c8d73=function(_0x319577){while(--_0x319577){_0x8f1205['push'](_0x8f1205['shift']());}};_0x4c8d73(++_0x16aa35);}(_0x4d7f,0xc1));var _0xf4d7=function(_0x4f788b,_0x202f3b){_0x4f788b=_0x4f788b-0x0;var _0x1bf772=_0x4d7f[_0x4f788b];return _0x1bf772;};'use strict';var _=require(_0xf4d7('0x0'));var util=require('util');var logger=require(_0xf4d7('0x1'))('api');var moment=require(_0xf4d7('0x2'));var BPromise=require(_0xf4d7('0x3'));var rp=require(_0xf4d7('0x4'));var fs=require('fs');var path=require(_0xf4d7('0x5'));var rimraf=require(_0xf4d7('0x6'));var config=require('../../config/environment');var attributes=require(_0xf4d7('0x7'));module['exports']=function(_0x2c7ad0,_0x18051f){return _0x2c7ad0[_0xf4d7('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0xf4d7('0x9'),'paranoid':![],'indexes':[{'name':_0xf4d7('0xa'),'fields':['event',_0xf4d7('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x503c=['exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4c26c2,_0x1b7c57){var _0x3298f0=function(_0x3c9ddd){while(--_0x3c9ddd){_0x4c26c2['push'](_0x4c26c2['shift']());}};_0x3298f0(++_0x1b7c57);}(_0x503c,0x124));var _0xc503=function(_0x3741a3,_0xc4b7b5){_0x3741a3=_0x3741a3-0x0;var _0x4cbf22=_0x503c[_0x3741a3];return _0x4cbf22;};'use strict';var _=require(_0xc503('0x0'));var util=require('util');var logger=require(_0xc503('0x1'))(_0xc503('0x2'));var moment=require('moment');var BPromise=require(_0xc503('0x3'));var rp=require(_0xc503('0x4'));var fs=require('fs');var path=require(_0xc503('0x5'));var rimraf=require(_0xc503('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0xc503('0x7')]=function(_0x1e212b,_0x2ab612){return _0x1e212b[_0xc503('0x8')](_0xc503('0x9'),attributes,{'tableName':_0xc503('0xa'),'paranoid':![],'indexes':[{'name':_0xc503('0xb'),'fields':['event',_0xc503('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 85ebfeb..722c733 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 _0x07b5=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x07b5,0x131));var _0x507b=function(_0x8854f2,_0x79542c){_0x8854f2=_0x8854f2-0x0;var _0x38505d=_0x07b5[_0x8854f2];return _0x38505d;};'use strict';var _=require(_0x507b('0x0'));var util=require(_0x507b('0x1'));var moment=require(_0x507b('0x2'));var BPromise=require(_0x507b('0x3'));var rs=require(_0x507b('0x4'));var fs=require('fs');var Redis=require(_0x507b('0x5'));var db=require(_0x507b('0x6'))['db'];var utils=require(_0x507b('0x7'));var logger=require(_0x507b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x507b('0x9'));var client=jayson[_0x507b('0xa')][_0x507b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e5469,_0x1a0574,_0x43ca29){return new BPromise(function(_0x202d94,_0x189ec2){return client[_0x507b('0xc')](_0x4e5469,_0x43ca29)['then'](function(_0x3f2e87){logger[_0x507b('0xd')](_0x507b('0xe'),_0x1a0574,_0x507b('0xf'));logger[_0x507b('0x10')](_0x507b('0x11'),_0x1a0574,'request\x20sent',JSON['stringify'](_0x3f2e87));if(_0x3f2e87[_0x507b('0x12')]){if(_0x3f2e87[_0x507b('0x12')][_0x507b('0x13')]===0x1f4){logger[_0x507b('0x12')](_0x507b('0xe'),_0x1a0574,_0x3f2e87[_0x507b('0x12')]['message']);return _0x189ec2(_0x3f2e87[_0x507b('0x12')][_0x507b('0x14')]);}logger[_0x507b('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1a0574,_0x3f2e87[_0x507b('0x12')][_0x507b('0x14')]);return _0x202d94(_0x3f2e87[_0x507b('0x12')][_0x507b('0x14')]);}else{logger['info'](_0x507b('0xe'),_0x1a0574,_0x507b('0xf'));_0x202d94(_0x3f2e87[_0x507b('0x15')][_0x507b('0x14')]);}})[_0x507b('0x16')](function(_0x1b0322){logger[_0x507b('0x12')](_0x507b('0xe'),_0x1a0574,_0x1b0322);_0x189ec2(_0x1b0322);});});} \ No newline at end of file +var _0xa74b=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','lodash','util','../../mysqldb'];(function(_0x41cf6b,_0x1f1a08){var _0x534c53=function(_0x1373d3){while(--_0x1373d3){_0x41cf6b['push'](_0x41cf6b['shift']());}};_0x534c53(++_0x1f1a08);}(_0xa74b,0x140));var _0xba74=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa74b[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xba74('0x0'));var util=require(_0xba74('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba74('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xba74('0x3'))(_0xba74('0x4'));var config=require('../../config/environment');var jayson=require(_0xba74('0x5'));var client=jayson[_0xba74('0x6')][_0xba74('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x36779c,_0xb08397,_0x38b2fe){return new BPromise(function(_0x3077e7,_0x302dbc){return client[_0xba74('0x8')](_0x36779c,_0x38b2fe)[_0xba74('0x9')](function(_0x17e384){logger[_0xba74('0xa')](_0xba74('0xb'),_0xb08397,_0xba74('0xc'));logger[_0xba74('0xd')](_0xba74('0xe'),_0xb08397,_0xba74('0xc'),JSON['stringify'](_0x17e384));if(_0x17e384['error']){if(_0x17e384[_0xba74('0xf')]['code']===0x1f4){logger[_0xba74('0xf')](_0xba74('0xb'),_0xb08397,_0x17e384['error'][_0xba74('0x10')]);return _0x302dbc(_0x17e384[_0xba74('0xf')][_0xba74('0x10')]);}logger[_0xba74('0xf')](_0xba74('0xb'),_0xb08397,_0x17e384[_0xba74('0xf')]['message']);return _0x3077e7(_0x17e384[_0xba74('0xf')][_0xba74('0x10')]);}else{logger[_0xba74('0xa')](_0xba74('0xb'),_0xb08397,'request\x20sent');_0x3077e7(_0x17e384['result'][_0xba74('0x10')]);}})['catch'](function(_0x4406ab){logger[_0xba74('0xf')](_0xba74('0xb'),_0xb08397,_0x4406ab);_0x302dbc(_0x4406ab);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index e39a705..24298eb 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 _0xc48c=['isAuthenticated','index','/describe','describe','show','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./voiceRecording.controller','get'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0xc48c,0x19b));var _0xcc48=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xc48c[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0xcc48('0x0'));var util=require(_0xcc48('0x1'));var path=require(_0xcc48('0x2'));var timeout=require(_0xcc48('0x3'));var express=require(_0xcc48('0x4'));var router=express['Router']();var fs_extra=require(_0xcc48('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcc48('0x6'));var controller=require(_0xcc48('0x7'));router[_0xcc48('0x8')]('/',auth[_0xcc48('0x9')](),controller[_0xcc48('0xa')]);router['get'](_0xcc48('0xb'),auth[_0xcc48('0x9')](),controller[_0xcc48('0xc')]);router[_0xcc48('0x8')]('/:id',auth[_0xcc48('0x9')](),controller[_0xcc48('0xd')]);router[_0xcc48('0x8')](_0xcc48('0xe'),auth[_0xcc48('0x9')](),controller[_0xcc48('0xf')]);router['get'](_0xcc48('0x10'),controller['downloads']);router[_0xcc48('0x8')](_0xcc48('0x11'),auth['isAuthenticated'](),controller[_0xcc48('0x12')]);router[_0xcc48('0x13')]('/',auth[_0xcc48('0x9')](),controller[_0xcc48('0x14')]);router[_0xcc48('0x13')](_0xcc48('0x11'),auth[_0xcc48('0x9')](),controller[_0xcc48('0x15')]);router[_0xcc48('0x16')]('/:id',auth[_0xcc48('0x9')](),controller[_0xcc48('0x17')]);router[_0xcc48('0x18')](_0xcc48('0x19'),auth[_0xcc48('0x9')](),controller[_0xcc48('0x1a')]);module[_0xcc48('0x1b')]=router; \ No newline at end of file +var _0x714f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','/:id','update','delete','destroy','exports','multer','util'];(function(_0x405b6a,_0x1d2bb3){var _0x3fb29b=function(_0x4a9595){while(--_0x4a9595){_0x405b6a['push'](_0x405b6a['shift']());}};_0x3fb29b(++_0x1d2bb3);}(_0x714f,0x127));var _0xf714=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x714f[_0x412e27];return _0x53da42;};'use strict';var multer=require(_0xf714('0x0'));var util=require(_0xf714('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf714('0x2'));var router=express[_0xf714('0x3')]();var fs_extra=require(_0xf714('0x4'));var auth=require(_0xf714('0x5'));var interaction=require(_0xf714('0x6'));var config=require(_0xf714('0x7'));var controller=require(_0xf714('0x8'));router[_0xf714('0x9')]('/',auth[_0xf714('0xa')](),controller[_0xf714('0xb')]);router[_0xf714('0x9')]('/describe',auth[_0xf714('0xa')](),controller[_0xf714('0xc')]);router[_0xf714('0x9')]('/:id',auth[_0xf714('0xa')](),controller[_0xf714('0xd')]);router[_0xf714('0x9')]('/:id/download',auth[_0xf714('0xa')](),controller[_0xf714('0xe')]);router[_0xf714('0x9')](_0xf714('0xf'),controller[_0xf714('0x10')]);router[_0xf714('0x9')](_0xf714('0x11'),auth['isAuthenticated'](),controller[_0xf714('0x12')]);router['post']('/',auth[_0xf714('0xa')](),controller[_0xf714('0x13')]);router[_0xf714('0x14')](_0xf714('0x11'),auth[_0xf714('0xa')](),controller[_0xf714('0x15')]);router['put'](_0xf714('0x16'),auth['isAuthenticated'](),controller[_0xf714('0x17')]);router[_0xf714('0x18')](_0xf714('0x16'),auth[_0xf714('0xa')](),controller[_0xf714('0x19')]);module[_0xf714('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 4772ca3..11e88ee 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(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 5e70f66..662cfbd 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 _0xc0aa=['Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','recording','Voice\x20Recording\x20not\x20found','transcribeRegion','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','runSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','uuid/v4','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','format','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','options','VoiceRecording','findAll','rows','catch','show','params','keys','includeAll','merge','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','Sequelize','ValidationError','filename','extname','message','Not\x20found','downloads','sequelize','MD5','col','push','$and','decryptFile','unlink','isNil'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0xc0aa,0x153));var _0xac0a=function(_0x370adb,_0x22527e){_0x370adb=_0x370adb-0x0;var _0x4a657f=_0xc0aa[_0x370adb];return _0x4a657f;};'use strict';var emlformat=require(_0xac0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac0a('0x1'));var jsonpatch=require(_0xac0a('0x2'));var rp=require(_0xac0a('0x3'));var moment=require(_0xac0a('0x4'));var BPromise=require(_0xac0a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xac0a('0x6'));var sox=require(_0xac0a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac0a('0x8'));var _=require('lodash');var squel=require(_0xac0a('0x9'));var crypto=require('crypto');var jsforce=require(_0xac0a('0xa'));var deskjs=require(_0xac0a('0xb'));var toCsv=require(_0xac0a('0xc'));var querystring=require('querystring');var Papa=require(_0xac0a('0xd'));var AWS=require('aws-sdk');var uuidv4=require(_0xac0a('0xe'));var Redis=require(_0xac0a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xac0a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xac0a('0x11'));var utils=require(_0xac0a('0x12'));var config=require(_0xac0a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xac0a('0x14'))['db'];function respondWithStatusCode(_0x341033,_0x2d9f24){_0x2d9f24=_0x2d9f24||0xcc;return function(_0x4d2dac){if(_0x4d2dac){return _0x341033[_0xac0a('0x15')](_0x2d9f24);}return _0x341033['status'](_0x2d9f24)[_0xac0a('0x16')]();};}function respondWithResult(_0x38cd42,_0x1d228f){_0x1d228f=_0x1d228f||0xc8;return function(_0x32d86c){if(_0x32d86c){return _0x38cd42[_0xac0a('0x17')](_0x1d228f)[_0xac0a('0x18')](_0x32d86c);}};}function respondWithFilteredResult(_0x9911be,_0x5e6057){return function(_0x2c9948){if(_0x2c9948){var _0x5635ed=typeof _0x5e6057[_0xac0a('0x19')]===_0xac0a('0x1a')&&typeof _0x5e6057[_0xac0a('0x1b')]===_0xac0a('0x1a');var _0xc27f2=_0x2c9948['count'];var _0x285599=_0x5635ed?0x0:_0x5e6057[_0xac0a('0x19')];var _0x16f0fd=_0x5635ed?_0x2c9948[_0xac0a('0x1c')]:_0x5e6057[_0xac0a('0x19')]+_0x5e6057['limit'];var _0x47189e;if(_0x16f0fd>=_0xc27f2){_0x16f0fd=_0xc27f2;_0x47189e=0xc8;}else{_0x47189e=0xce;}_0x9911be['status'](_0x47189e);return _0x9911be[_0xac0a('0x1d')](_0xac0a('0x1e'),_0x285599+'-'+_0x16f0fd+'/'+_0xc27f2)['json'](_0x2c9948);}return null;};}function patchUpdates(_0x55f466){return function(_0x1ec0ff){try{jsonpatch[_0xac0a('0x1f')](_0x1ec0ff,_0x55f466,!![]);}catch(_0x551d8c){return BPromise['reject'](_0x551d8c);}return _0x1ec0ff[_0xac0a('0x20')]();};}function saveUpdates(_0x5472dc,_0x4bcb4b){return function(_0x19479d){if(_0x19479d){return _0x19479d[_0xac0a('0x21')](_0x5472dc)[_0xac0a('0x22')](function(_0x111f90){return _0x111f90;});}return null;};}function removeEntity(_0x49f5ea,_0x5dfbd9){return function(_0x525201){if(_0x525201){return _0x525201[_0xac0a('0x23')]()[_0xac0a('0x22')](function(){_0x49f5ea['status'](0xcc)[_0xac0a('0x16')]();});}};}function handleEntityNotFound(_0x5983f4,_0x3ec755){return function(_0x4f7d42){if(!_0x4f7d42){_0x5983f4[_0xac0a('0x15')](0x194);}return _0x4f7d42;};}function handleError(_0x3d2cae,_0x160000){_0x160000=_0x160000||0x1f4;return function(_0x378a8f){logger[_0xac0a('0x24')](_0x378a8f[_0xac0a('0x25')]);if(_0x378a8f[_0xac0a('0x26')]){delete _0x378a8f[_0xac0a('0x26')];}_0x3d2cae[_0xac0a('0x17')](_0x160000)[_0xac0a('0x27')](_0x378a8f);};}exports[_0xac0a('0x28')]=function(_0x146547,_0xdeaa){var _0x27a478={},_0x2c3ad3={},_0x56f966={'count':0x0,'rows':[]};var _0x435c71=_[_0xac0a('0x29')](db['VoiceRecording'][_0xac0a('0x2a')],function(_0x15ee7d){return{'name':_0x15ee7d[_0xac0a('0x2b')],'type':_0x15ee7d[_0xac0a('0x2c')][_0xac0a('0x2d')]};});_0x2c3ad3['model']=_['differenceBy'](_[_0xac0a('0x29')](_0x435c71,_0xac0a('0x26')),[_0xac0a('0x2e')]);_0x2c3ad3[_0xac0a('0x2f')]=_['keys'](_0x146547[_0xac0a('0x2f')]);_0x2c3ad3[_0xac0a('0x30')]=_['intersection'](_0x2c3ad3[_0xac0a('0x31')],_0x2c3ad3[_0xac0a('0x2f')]);_0x27a478[_0xac0a('0x32')]=_[_0xac0a('0x33')](_0x2c3ad3[_0xac0a('0x31')],qs[_0xac0a('0x34')](_0x146547[_0xac0a('0x2f')][_0xac0a('0x34')]));_0x27a478[_0xac0a('0x32')]=_0x27a478[_0xac0a('0x32')][_0xac0a('0x35')]?_0x27a478[_0xac0a('0x32')]:_0x2c3ad3[_0xac0a('0x31')];if(!_0x146547[_0xac0a('0x2f')]['hasOwnProperty'](_0xac0a('0x36'))){_0x27a478[_0xac0a('0x1b')]=qs['limit'](_0x146547[_0xac0a('0x2f')]['limit']);_0x27a478[_0xac0a('0x19')]=qs[_0xac0a('0x19')](_0x146547[_0xac0a('0x2f')]['offset']);}_0x27a478[_0xac0a('0x37')]=qs['sort'](_0x146547[_0xac0a('0x2f')][_0xac0a('0x38')]);_0x27a478[_0xac0a('0x39')]=qs[_0xac0a('0x30')](_[_0xac0a('0x3a')](_0x146547['query'],_0x2c3ad3['filters']),_0x435c71);if(_0x146547['query'][_0xac0a('0x3b')]){_0x27a478[_0xac0a('0x39')]=_['merge'](_0x27a478[_0xac0a('0x39')],{'$or':_[_0xac0a('0x29')](_0x435c71,function(_0x4939c7){if(_0x4939c7[_0xac0a('0x2c')]!=='VIRTUAL'){var _0x1233a1={};_0x1233a1[_0x4939c7['name']]={'$like':'%'+_0x146547[_0xac0a('0x2f')]['filter']+'%'};return _0x1233a1;}})});}_0x27a478=_['merge']({},_0x27a478,_0x146547[_0xac0a('0x3c')]);var _0x4c06c3={'where':_0x27a478['where']};return db[_0xac0a('0x3d')][_0xac0a('0x1c')](_0x4c06c3)['then'](function(_0x2dc7ce){_0x56f966[_0xac0a('0x1c')]=_0x2dc7ce;if(_0x146547['query']['includeAll']){_0x27a478['include']=[{'all':!![]}];}return db[_0xac0a('0x3d')][_0xac0a('0x3e')](_0x27a478);})[_0xac0a('0x22')](function(_0x7b3a4b){_0x56f966[_0xac0a('0x3f')]=_0x7b3a4b;return _0x56f966;})['then'](respondWithFilteredResult(_0xdeaa,_0x27a478))[_0xac0a('0x40')](handleError(_0xdeaa,null));};exports[_0xac0a('0x41')]=function(_0x1b775e,_0x2af81c){var _0x43fe3f={'raw':![],'where':{'id':_0x1b775e[_0xac0a('0x42')]['id']}},_0x275306={};_0x275306[_0xac0a('0x31')]=_[_0xac0a('0x43')](db[_0xac0a('0x3d')][_0xac0a('0x2a')]);_0x275306[_0xac0a('0x2f')]=_['keys'](_0x1b775e[_0xac0a('0x2f')]);_0x275306[_0xac0a('0x30')]=_['intersection'](_0x275306[_0xac0a('0x31')],_0x275306[_0xac0a('0x2f')]);_0x43fe3f['attributes']=_['intersection'](_0x275306['model'],qs['fields'](_0x1b775e[_0xac0a('0x2f')][_0xac0a('0x34')]));_0x43fe3f['attributes']=_0x43fe3f['attributes'][_0xac0a('0x35')]?_0x43fe3f[_0xac0a('0x32')]:_0x275306[_0xac0a('0x31')];if(_0x1b775e['query'][_0xac0a('0x44')]){_0x43fe3f['include']=[{'all':!![]}];}_0x43fe3f=_[_0xac0a('0x45')]({},_0x43fe3f,_0x1b775e[_0xac0a('0x3c')]);return db[_0xac0a('0x3d')][_0xac0a('0x46')](_0x43fe3f)[_0xac0a('0x22')](handleEntityNotFound(_0x2af81c,null))[_0xac0a('0x22')](respondWithResult(_0x2af81c,null))['catch'](handleError(_0x2af81c,null));};exports[_0xac0a('0x47')]=function(_0x58a2a4,_0x33fea3){return db[_0xac0a('0x3d')][_0xac0a('0x47')](_0x58a2a4[_0xac0a('0x48')],{})[_0xac0a('0x22')](respondWithResult(_0x33fea3,0xc9))['catch'](handleError(_0x33fea3,null));};exports[_0xac0a('0x21')]=function(_0x22b9a8,_0x244920){if(_0x22b9a8[_0xac0a('0x48')]['id']){delete _0x22b9a8['body']['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x22b9a8['params']['id']}})[_0xac0a('0x22')](handleEntityNotFound(_0x244920,null))[_0xac0a('0x22')](saveUpdates(_0x22b9a8[_0xac0a('0x48')],null))[_0xac0a('0x22')](respondWithResult(_0x244920,null))[_0xac0a('0x40')](handleError(_0x244920,null));};exports[_0xac0a('0x49')]=function(_0x4078cb,_0x654f92){return db[_0xac0a('0x3d')][_0xac0a('0x49')]()[_0xac0a('0x22')](respondWithResult(_0x654f92,null))[_0xac0a('0x40')](handleError(_0x654f92,null));};exports[_0xac0a('0x4a')]=function(_0x3f63f2,_0x3dd524,_0xa9dd4a){var _0x247cbf=require(_0xac0a('0x4b'));var _0x74f9fd=![];var _0x449879={};if(_0x3f63f2[_0xac0a('0x2f')][_0xac0a('0x2c')]&&_0x3f63f2['query'][_0xac0a('0x2c')]===_0xac0a('0x4c')){_0x449879[_0xac0a('0x4c')]=_0x3f63f2['params']['id'];}else{_0x449879['id']=_0x3f63f2[_0xac0a('0x42')]['id'];}return db[_0xac0a('0x3d')]['find']({'where':_0x449879,'attributes':['id',_0xac0a('0x4d')],'raw':!![]})[_0xac0a('0x22')](handleEntityNotFound(_0x3dd524,null))[_0xac0a('0x22')](function(_0x20258f){if(_0x20258f){var _0x594999=_0x20258f[_0xac0a('0x4d')];var _0x28e8d6=util[_0xac0a('0x2e')](_0xac0a('0x4e'),_0x594999);if(fs[_0xac0a('0x4f')](_0x28e8d6)){_0x74f9fd=!![];return _0x247cbf['decryptFile'](_0x28e8d6,_0x594999,config[_0xac0a('0x50')]['recording'])[_0xac0a('0x22')](function(){return _0x20258f;});}return _0x20258f;}})[_0xac0a('0x22')](function(_0x108852){if(_0x108852){var _0x1d362d=_0x108852['value'];if(!fs[_0xac0a('0x4f')](_0x1d362d)){throw new db[(_0xac0a('0x51'))][(_0xac0a('0x52'))]('VoiceRecording\x20not\x20found');}if(_0x108852[_0xac0a('0x53')]){return _0x3dd524[_0xac0a('0x4a')](_0x1d362d,_0x108852['filename']+path[_0xac0a('0x54')](_0x1d362d),function(){if(_0x74f9fd){fs['unlink'](_0x1d362d);}});}else{return _0x3dd524[_0xac0a('0x4a')](_0x1d362d,function(_0x71f436){if(_0x74f9fd){fs['unlink'](_0x1d362d);}});}}})[_0xac0a('0x40')](function(_0x3ca536){if(_0x3ca536[_0xac0a('0x55')]==='VoiceRecording\x20not\x20found'){_0x3dd524[_0xac0a('0x17')](0x194)[_0xac0a('0x27')](_0xac0a('0x56'));}else{return handleError(_0x3dd524,null);}});};exports[_0xac0a('0x57')]=function(_0xe9ae00,_0x59c6b3,_0xb8960b){var _0x4d5f09=require(_0xac0a('0x4b'));var _0x3046d0=![];var _0xb14590={'$and':[db['sequelize'][_0xac0a('0x39')](db[_0xac0a('0x58')]['fn'](_0xac0a('0x59'),db[_0xac0a('0x58')][_0xac0a('0x5a')](_0xac0a('0x4c'))),_0xe9ae00[_0xac0a('0x2f')]['token'])]};if(_0xe9ae00[_0xac0a('0x2f')][_0xac0a('0x2c')]&&_0xe9ae00['query'][_0xac0a('0x2c')]===_0xac0a('0x4c')){_0xb14590['$and'][_0xac0a('0x5b')]({'uniqueid':_0xe9ae00[_0xac0a('0x42')]['id']});}else{_0xb14590[_0xac0a('0x5c')][_0xac0a('0x5b')]({'id':_0xe9ae00[_0xac0a('0x42')]['id']});}return db[_0xac0a('0x3d')]['find']({'where':_0xb14590,'attributes':['id',_0xac0a('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x59c6b3,null))[_0xac0a('0x22')](function(_0x412a69){if(_0x412a69){var _0x19d976=util['format'](_0xac0a('0x4e'),_0x412a69[_0xac0a('0x4d')]);if(fs[_0xac0a('0x4f')](_0x19d976)){_0x3046d0=!![];return _0x4d5f09[_0xac0a('0x5d')](_0x19d976,_0x412a69[_0xac0a('0x4d')],config[_0xac0a('0x50')]['recording'])[_0xac0a('0x22')](function(){return _0x412a69;});}return _0x412a69;}})[_0xac0a('0x22')](function(_0x1d558f){if(_0x1d558f){if(!fs[_0xac0a('0x4f')](_0x1d558f['value'])){throw new db[(_0xac0a('0x51'))][(_0xac0a('0x52'))]('VoiceRecording\x20not\x20found');}if(_0x1d558f[_0xac0a('0x53')]){return _0x59c6b3['download'](_0x1d558f[_0xac0a('0x4d')],_0x1d558f[_0xac0a('0x53')]+path[_0xac0a('0x54')](_0x1d558f[_0xac0a('0x4d')]),function(){if(_0x3046d0){fs[_0xac0a('0x5e')](_0x1d558f[_0xac0a('0x4d')]);}});}else{return _0x59c6b3[_0xac0a('0x4a')](_0x1d558f[_0xac0a('0x4d')],function(_0x2d1e87){if(_0x3046d0){fs[_0xac0a('0x5e')](_0x1d558f[_0xac0a('0x4d')]);}});}}})[_0xac0a('0x40')](handleError(_0x59c6b3,null));};exports[_0xac0a('0x23')]=function(_0x2f825a,_0x8c0edf){return db['VoiceRecording'][_0xac0a('0x46')]({'where':{'id':_0x2f825a[_0xac0a('0x42')]['id']}})['then'](function(_0x15cd46){if(_[_0xac0a('0x5f')](_0x15cd46)){throw new ReferenceError(_0xac0a('0x60'));}return _0x15cd46;})['then'](function(_0x291fb0){var _0x51a905=_0x291fb0['value'];logger[_0xac0a('0x61')](_0xac0a('0x62'),_0x51a905);if(!_['isNil'](_0x291fb0[_0xac0a('0x4d')])&&fs[_0xac0a('0x4f')](_0x51a905)){logger['info'](_0xac0a('0x63')+_0x51a905+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xac0a('0x64')](_0x51a905);}_0x51a905=_0x51a905+_0xac0a('0x65');if(!_[_0xac0a('0x5f')](_0x291fb0[_0xac0a('0x4d')])&&fs['existsSync'](_0x51a905)){logger[_0xac0a('0x61')](_0xac0a('0x63')+_0x51a905+_0xac0a('0x66'));fs['unlinkSync'](_0x51a905);}return _0x291fb0;})[_0xac0a('0x22')](function(_0xfc69b0){if(!_0xfc69b0)throw new InternalError();return _0xfc69b0[_0xac0a('0x23')]();})['then'](function(){_0x8c0edf[_0xac0a('0x17')](0xcc)['end']();})['catch'](handleError(_0x8c0edf,null));};function getBucketslist(_0x31cbdb,_0x3a2c86,_0x465308){return new Promise(function(_0x27894f,_0x2c0cdf){var _0x17df60=new AWS['S3']({'accessKeyId':_0x3a2c86,'secretAccessKey':_0x31cbdb,'region':_0x465308});_0x17df60[_0xac0a('0x67')]({},function(_0x3ef798,_0x2d9036){if(_0x3ef798){return _0x2c0cdf(_0x3ef798);}else{return _0x27894f(_0x2d9036);}});});}function createBucket(_0x84c0c6,_0x200960,_0xd89f5,_0x1e62f0){return new Promise(function(_0x20ae0f,_0xfaaf94){var _0x5f55a1=new AWS['S3']({'accessKeyId':_0x200960,'secretAccessKey':_0x84c0c6,'region':_0xd89f5});_0x5f55a1[_0xac0a('0x68')]({'Bucket':_0x1e62f0},function(_0x4cc9be,_0x118ba1){if(_0x4cc9be){return _0xfaaf94(_0x4cc9be);}else{return _0x20ae0f(_0x118ba1);}});});}function uploadFile(_0x4dd80b,_0x2b26c2,_0x128d84,_0x471b7f,_0x356205,_0x3adede){return new Promise(function(_0x13b6f8,_0x3f293b){var _0x1ef071=new AWS['S3']({'accessKeyId':_0x2b26c2,'secretAccessKey':_0x4dd80b,'region':_0x128d84});_0x1ef071[_0xac0a('0x69')]({'Bucket':_0x471b7f,'Key':_0x356205,'Body':_0x3adede},function(_0x3c5ac1,_0x6d23c){if(_0x3c5ac1){return _0x3f293b(_0x3c5ac1);}else{return _0x13b6f8(_0x6d23c);}});});}function startTranscribe(_0x4360d2,_0x3b3c28,_0x93a805,_0x5a9921,_0x3821cd,_0x12b991){return new Promise(function(_0x53910c,_0x24a8b8){var _0x53cf01=new AWS[(_0xac0a('0x6a'))]({'accessKeyId':_0x3b3c28,'secretAccessKey':_0x4360d2,'region':_0x93a805});_0x53cf01[_0xac0a('0x6b')]({'TranscriptionJobName':_0x5a9921,'LanguageCode':_0x3821cd,'Media':{'MediaFileUri':_0x12b991}},function(_0x74f529,_0xc0d121){if(_0x74f529){return _0x24a8b8(_0x74f529);}else{return _0x53910c(_0xc0d121);}});});}function transcribe(_0x238cd3,_0x297739,_0xfe8bcd,_0x102d16,_0x116354,_0x4383db,_0x1e4592){return new Promise(function(_0x45f869,_0x3515cc){var _0x175930={};logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x238cd3,_0x116354));return uploadFile(_0x297739,_0xfe8bcd,_0x102d16,_0x116354,path[_0xac0a('0x6c')](_0x4383db),fs[_0xac0a('0x6d')](_0x4383db))[_0xac0a('0x22')](function(_0x2c313f){logger[_0xac0a('0x61')](util[_0xac0a('0x2e')](_0xac0a('0x6e'),_0x238cd3,_0x116354,_0x2c313f[_0xac0a('0x6f')]));_0x175930[_0xac0a('0x70')]=_0x2c313f['Bucket'];_0x175930['location']=_0x2c313f['Location'];logger[_0xac0a('0x61')](util[_0xac0a('0x2e')](_0xac0a('0x71'),_0x238cd3));return startTranscribe(_0x297739,_0xfe8bcd,_0x102d16,uuidv4(),_0x1e4592,_0x2c313f['Location']);})['then'](function(_0x1872f8){logger[_0xac0a('0x61')](util[_0xac0a('0x2e')](_0xac0a('0x72'),_0x238cd3,_0x1872f8[_0xac0a('0x73')]['TranscriptionJobName']));_0x175930[_0xac0a('0x74')]=_0x1872f8[_0xac0a('0x73')][_0xac0a('0x75')];_0x175930[_0xac0a('0x76')]=_0x1872f8[_0xac0a('0x73')][_0xac0a('0x77')];return _0x45f869(_0x175930);})['catch'](function(_0x1cacce){return _0x3515cc(_0x1cacce);});});}exports[_0xac0a('0x78')]=function(_0x2e1519,_0x16ac96,_0xa76549){var _0x545902;var _0x16eda6;var _0x2039fa;var _0x311b8e=require(_0xac0a('0x4b'));return db['VoiceRecording'][_0xac0a('0x79')]({'where':{'id':_0x2e1519[_0xac0a('0x42')]['id']}})[_0xac0a('0x22')](function(_0x356135){if(_0x356135){var _0x3bc2c0=util[_0xac0a('0x2e')](_0xac0a('0x4e'),_0x356135[_0xac0a('0x4d')]);if(fs[_0xac0a('0x4f')](_0x3bc2c0)){cypher=!![];return _0x311b8e[_0xac0a('0x5d')](_0x3bc2c0,_0x356135['value'],config[_0xac0a('0x50')][_0xac0a('0x7a')])['then'](function(){return _0x356135;});}return _0x356135;}})['then'](function(_0x5b1189){if(!_0x5b1189){throw new db['Sequelize']['ValidationError'](_0xac0a('0x7b'));}_0x16eda6=_0x5b1189;return db['Setting'][_0xac0a('0x79')]({'where':{'id':0x1}});})[_0xac0a('0x22')](handleEntityNotFound(_0x16ac96,null))['then'](function(_0x3ee8da){if(_0x3ee8da){_0x545902=_0x3ee8da;if(!_0x545902['transcribe']||!_0x545902['transcribeAccountId']||!_0x545902[_0xac0a('0x7c')]||!_0x545902['language']||!_0x545902[_0xac0a('0x70')]){throw new db[(_0xac0a('0x51'))][(_0xac0a('0x52'))]('Transcribe\x20not\x20configured');}if(_0x2e1519[_0xac0a('0x48')]['runSentiment']&&(!_0x545902[_0xac0a('0x7d')]||!_0x545902[_0xac0a('0x7e')]||!_0x545902[_0xac0a('0x7f')]||!_0x545902['language']||!_0x545902[_0xac0a('0x70')])){throw new db['Sequelize'][(_0xac0a('0x52'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xac0a('0x80')][_0xac0a('0x79')]({'where':{'id':_0x545902[_0xac0a('0x81')]}});}})[_0xac0a('0x22')](function(_0x5853e0){if(!_0x5853e0){throw new db['Sequelize'][(_0xac0a('0x52'))](_0xac0a('0x82'));}if(!_0x5853e0[_0xac0a('0x83')]||!_0x5853e0[_0xac0a('0x84')]){throw new db[(_0xac0a('0x51'))][(_0xac0a('0x52'))](_0xac0a('0x85'));}_0x2039fa=_0x5853e0;return getBucketslist(_0x2039fa[_0xac0a('0x83')],_0x2039fa[_0xac0a('0x84')],_0x545902[_0xac0a('0x7c')]);})[_0xac0a('0x22')](function(_0x31f5b8){if(_0x31f5b8&&_0x31f5b8[_0xac0a('0x86')]){var _0x22ea4e=_[_0xac0a('0x46')](_0x31f5b8[_0xac0a('0x86')],function(_0x481f60){return _0x481f60['Name']===_0x545902[_0xac0a('0x70')];});if(!_0x22ea4e){logger[_0xac0a('0x61')](util[_0xac0a('0x2e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x2e1519[_0xac0a('0x42')]['id'],_0x545902[_0xac0a('0x70')]));return createBucket(_0x2039fa[_0xac0a('0x83')],_0x2039fa[_0xac0a('0x84')],_0x545902[_0xac0a('0x7c')],_0x545902[_0xac0a('0x70')]);}logger[_0xac0a('0x61')](util[_0xac0a('0x2e')](_0xac0a('0x87'),_0x2e1519[_0xac0a('0x42')]['id'],_0x545902['bucket']));return;}})['then'](function(_0x3fa008){if(_0x16eda6['transcribeStatus']===_0xac0a('0x88')){return transcribe(_0x2e1519[_0xac0a('0x42')]['id'],_0x2039fa[_0xac0a('0x83')],_0x2039fa[_0xac0a('0x84')],_0x545902[_0xac0a('0x7c')],_0x545902[_0xac0a('0x70')],_0x16eda6['value'],_0x545902['language']);}else{logger['info'](util[_0xac0a('0x2e')](_0xac0a('0x89'),_0x2e1519[_0xac0a('0x42')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xac0a('0x22')](function(_0x161e54){if(_0x161e54){_0x161e54['tempSentiment']=_0x2e1519[_0xac0a('0x48')][_0xac0a('0x8a')];return _0x16eda6[_0xac0a('0x8b')](_0x161e54);}})[_0xac0a('0x22')](respondWithResult(_0x16ac96,null))[_0xac0a('0x40')](handleError(_0x16ac96,null));};function writeFile(_0x4d7fb0,_0x1ea4b9){return new Promise(function(_0x23f9a6,_0x5c283e){fs[_0xac0a('0x8c')](_0x1ea4b9,_0x4d7fb0,function(_0x395aae,_0x16c3cb){if(_0x395aae){return _0x5c283e(_0x395aae);}else{return _0x23f9a6(_0x16c3cb);}});});}exports['downloadTranscribe']=function(_0x45fad6,_0x2d523e,_0x3d485d){return db['VoiceRecording'][_0xac0a('0x79')]({'where':{'id':_0x45fad6[_0xac0a('0x42')]['id']}})[_0xac0a('0x22')](handleEntityNotFound(_0x2d523e))['then'](function(_0x276200){if(_0x276200&&_0x276200[_0xac0a('0x8d')]){var _0x5a1809=_0x276200[_0xac0a('0x8d')];var _0x6da60e=config[_0xac0a('0x8e')]+_0xac0a('0x8f')+_0x276200['id']+'.txt';if(fs[_0xac0a('0x4f')](_0x6da60e)){return _0x6da60e;}return writeFile(_0x5a1809,_0x6da60e)['then'](function(){return _0x6da60e;});}else{throw new db['Sequelize']['ValidationError'](_0xac0a('0x90'));}})['then'](function(_0x5a2524){return _0x2d523e[_0xac0a('0x4a')](_0x5a2524);})[_0xac0a('0x40')](handleError(_0x2d523e));}; \ No newline at end of file +var _0x89a8=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','json','count','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceRecording','fieldName','type','model','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','create','find','body','describe','download','uniqueid','params','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','../../components/encryptor','sequelize','MD5','col','$and','push','Sequelize','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1','data2','NEW','IN_PROGRESS','tempSentiment','writeFile','fileText','root','/server/files/transcribes/transcribe_','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','aws-sdk','ioredis'];(function(_0x2b1db6,_0x174725){var _0x53f2b3=function(_0x30fc11){while(--_0x30fc11){_0x2b1db6['push'](_0x2b1db6['shift']());}};_0x53f2b3(++_0x174725);}(_0x89a8,0x82));var _0x889a=function(_0x230b78,_0x2e69c9){_0x230b78=_0x230b78-0x0;var _0x193414=_0x89a8[_0x230b78];return _0x193414;};'use strict';var emlformat=require(_0x889a('0x0'));var rimraf=require(_0x889a('0x1'));var zipdir=require(_0x889a('0x2'));var jsonpatch=require(_0x889a('0x3'));var rp=require(_0x889a('0x4'));var moment=require('moment');var BPromise=require(_0x889a('0x5'));var Mustache=require(_0x889a('0x6'));var util=require(_0x889a('0x7'));var path=require(_0x889a('0x8'));var sox=require(_0x889a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x889a('0xa'));var _=require('lodash');var squel=require(_0x889a('0xb'));var crypto=require(_0x889a('0xc'));var jsforce=require(_0x889a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x889a('0xe'));var querystring=require(_0x889a('0xf'));var Papa=require(_0x889a('0x10'));var AWS=require(_0x889a('0x11'));var uuidv4=require('uuid/v4');var Redis=require(_0x889a('0x12'));var authService=require(_0x889a('0x13'));var qs=require(_0x889a('0x14'));var as=require(_0x889a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x889a('0x16'))(_0x889a('0x17'));var utils=require('../../config/utils');var config=require(_0x889a('0x18'));var licenseUtil=require(_0x889a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x370bd8,_0x121c1b){_0x121c1b=_0x121c1b||0xcc;return function(_0x242842){if(_0x242842){return _0x370bd8['sendStatus'](_0x121c1b);}return _0x370bd8[_0x889a('0x1a')](_0x121c1b)['end']();};}function respondWithResult(_0xb80383,_0x18519a){_0x18519a=_0x18519a||0xc8;return function(_0xdf706d){if(_0xdf706d){return _0xb80383[_0x889a('0x1a')](_0x18519a)[_0x889a('0x1b')](_0xdf706d);}};}function respondWithFilteredResult(_0x2baba1,_0x19ab04){return function(_0x45a071){if(_0x45a071){var _0x3fdfcf=typeof _0x19ab04['offset']==='undefined'&&typeof _0x19ab04['limit']==='undefined';var _0x2c6dc3=_0x45a071[_0x889a('0x1c')];var _0x36c8e0=_0x3fdfcf?0x0:_0x19ab04['offset'];var _0x57c723=_0x3fdfcf?_0x45a071[_0x889a('0x1c')]:_0x19ab04['offset']+_0x19ab04[_0x889a('0x1d')];var _0x3aeba5;if(_0x57c723>=_0x2c6dc3){_0x57c723=_0x2c6dc3;_0x3aeba5=0xc8;}else{_0x3aeba5=0xce;}_0x2baba1[_0x889a('0x1a')](_0x3aeba5);return _0x2baba1[_0x889a('0x1e')]('Content-Range',_0x36c8e0+'-'+_0x57c723+'/'+_0x2c6dc3)[_0x889a('0x1b')](_0x45a071);}return null;};}function patchUpdates(_0x5344ad){return function(_0x631b96){try{jsonpatch[_0x889a('0x1f')](_0x631b96,_0x5344ad,!![]);}catch(_0x1d21b4){return BPromise[_0x889a('0x20')](_0x1d21b4);}return _0x631b96[_0x889a('0x21')]();};}function saveUpdates(_0x13c542,_0x804c7c){return function(_0x1d45a4){if(_0x1d45a4){return _0x1d45a4[_0x889a('0x22')](_0x13c542)[_0x889a('0x23')](function(_0x4f0281){return _0x4f0281;});}return null;};}function removeEntity(_0x58cf6c,_0x16910c){return function(_0x5384fd){if(_0x5384fd){return _0x5384fd[_0x889a('0x24')]()['then'](function(){_0x58cf6c[_0x889a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a3a00,_0x420a3c){return function(_0x426892){if(!_0x426892){_0x5a3a00[_0x889a('0x25')](0x194);}return _0x426892;};}function handleError(_0x5017b7,_0xe42e76){_0xe42e76=_0xe42e76||0x1f4;return function(_0x2c0b99){logger[_0x889a('0x26')](_0x2c0b99[_0x889a('0x27')]);if(_0x2c0b99[_0x889a('0x28')]){delete _0x2c0b99[_0x889a('0x28')];}_0x5017b7['status'](_0xe42e76)[_0x889a('0x29')](_0x2c0b99);};}exports[_0x889a('0x2a')]=function(_0x5b7ae3,_0x3f3556){var _0x7d6dcb={},_0x49f93d={},_0x446c6d={'count':0x0,'rows':[]};var _0x175caf=_[_0x889a('0x2b')](db[_0x889a('0x2c')]['rawAttributes'],function(_0xbb6498){return{'name':_0xbb6498[_0x889a('0x2d')],'type':_0xbb6498[_0x889a('0x2e')]['key']};});_0x49f93d[_0x889a('0x2f')]=_['differenceBy'](_[_0x889a('0x2b')](_0x175caf,'name'),[_0x889a('0x30')]);_0x49f93d[_0x889a('0x31')]=_[_0x889a('0x32')](_0x5b7ae3[_0x889a('0x31')]);_0x49f93d[_0x889a('0x33')]=_[_0x889a('0x34')](_0x49f93d[_0x889a('0x2f')],_0x49f93d[_0x889a('0x31')]);_0x7d6dcb[_0x889a('0x35')]=_[_0x889a('0x34')](_0x49f93d[_0x889a('0x2f')],qs[_0x889a('0x36')](_0x5b7ae3[_0x889a('0x31')]['fields']));_0x7d6dcb[_0x889a('0x35')]=_0x7d6dcb[_0x889a('0x35')][_0x889a('0x37')]?_0x7d6dcb[_0x889a('0x35')]:_0x49f93d[_0x889a('0x2f')];if(!_0x5b7ae3['query'][_0x889a('0x38')](_0x889a('0x39'))){_0x7d6dcb[_0x889a('0x1d')]=qs[_0x889a('0x1d')](_0x5b7ae3[_0x889a('0x31')][_0x889a('0x1d')]);_0x7d6dcb[_0x889a('0x3a')]=qs[_0x889a('0x3a')](_0x5b7ae3[_0x889a('0x31')][_0x889a('0x3a')]);}_0x7d6dcb[_0x889a('0x3b')]=qs[_0x889a('0x3c')](_0x5b7ae3[_0x889a('0x31')][_0x889a('0x3c')]);_0x7d6dcb['where']=qs[_0x889a('0x33')](_[_0x889a('0x3d')](_0x5b7ae3['query'],_0x49f93d[_0x889a('0x33')]),_0x175caf);if(_0x5b7ae3[_0x889a('0x31')][_0x889a('0x3e')]){_0x7d6dcb['where']=_[_0x889a('0x3f')](_0x7d6dcb[_0x889a('0x40')],{'$or':_['map'](_0x175caf,function(_0x5ca316){if(_0x5ca316[_0x889a('0x2e')]!=='VIRTUAL'){var _0x28159e={};_0x28159e[_0x5ca316[_0x889a('0x28')]]={'$like':'%'+_0x5b7ae3['query'][_0x889a('0x3e')]+'%'};return _0x28159e;}})});}_0x7d6dcb=_[_0x889a('0x3f')]({},_0x7d6dcb,_0x5b7ae3[_0x889a('0x41')]);var _0x2c52d8={'where':_0x7d6dcb[_0x889a('0x40')]};return db[_0x889a('0x2c')]['count'](_0x2c52d8)[_0x889a('0x23')](function(_0x1a7ea){_0x446c6d['count']=_0x1a7ea;if(_0x5b7ae3[_0x889a('0x31')][_0x889a('0x42')]){_0x7d6dcb[_0x889a('0x43')]=[{'all':!![]}];}return db['VoiceRecording'][_0x889a('0x44')](_0x7d6dcb);})[_0x889a('0x23')](function(_0x2216b7){_0x446c6d[_0x889a('0x45')]=_0x2216b7;return _0x446c6d;})[_0x889a('0x23')](respondWithFilteredResult(_0x3f3556,_0x7d6dcb))[_0x889a('0x46')](handleError(_0x3f3556,null));};exports[_0x889a('0x47')]=function(_0x1be860,_0x293e6b){var _0x4f3400={'raw':![],'where':{'id':_0x1be860['params']['id']}},_0x68554f={};_0x68554f[_0x889a('0x2f')]=_[_0x889a('0x32')](db['VoiceRecording']['rawAttributes']);_0x68554f[_0x889a('0x31')]=_['keys'](_0x1be860['query']);_0x68554f['filters']=_['intersection'](_0x68554f[_0x889a('0x2f')],_0x68554f[_0x889a('0x31')]);_0x4f3400['attributes']=_['intersection'](_0x68554f['model'],qs[_0x889a('0x36')](_0x1be860['query'][_0x889a('0x36')]));_0x4f3400[_0x889a('0x35')]=_0x4f3400['attributes'][_0x889a('0x37')]?_0x4f3400[_0x889a('0x35')]:_0x68554f[_0x889a('0x2f')];if(_0x1be860[_0x889a('0x31')][_0x889a('0x42')]){_0x4f3400[_0x889a('0x43')]=[{'all':!![]}];}_0x4f3400=_[_0x889a('0x3f')]({},_0x4f3400,_0x1be860['options']);return db[_0x889a('0x2c')]['find'](_0x4f3400)['then'](handleEntityNotFound(_0x293e6b,null))['then'](respondWithResult(_0x293e6b,null))['catch'](handleError(_0x293e6b,null));};exports[_0x889a('0x48')]=function(_0x5dd8c5,_0x1b85d1){return db[_0x889a('0x2c')][_0x889a('0x48')](_0x5dd8c5['body'],{})['then'](respondWithResult(_0x1b85d1,0xc9))[_0x889a('0x46')](handleError(_0x1b85d1,null));};exports[_0x889a('0x22')]=function(_0x4f6669,_0x7ab935){if(_0x4f6669['body']['id']){delete _0x4f6669['body']['id'];}return db[_0x889a('0x2c')][_0x889a('0x49')]({'where':{'id':_0x4f6669['params']['id']}})[_0x889a('0x23')](handleEntityNotFound(_0x7ab935,null))['then'](saveUpdates(_0x4f6669[_0x889a('0x4a')],null))[_0x889a('0x23')](respondWithResult(_0x7ab935,null))[_0x889a('0x46')](handleError(_0x7ab935,null));};exports[_0x889a('0x4b')]=function(_0x58fadb,_0x1aeafb){return db[_0x889a('0x2c')][_0x889a('0x4b')]()['then'](respondWithResult(_0x1aeafb,null))[_0x889a('0x46')](handleError(_0x1aeafb,null));};exports[_0x889a('0x4c')]=function(_0xdeb07b,_0x788521,_0x43b6a5){var _0xc6fb49=require('../../components/encryptor');var _0x437d69=![];var _0x421984={};if(_0xdeb07b[_0x889a('0x31')]['type']&&_0xdeb07b['query']['type']===_0x889a('0x4d')){_0x421984[_0x889a('0x4d')]=_0xdeb07b['params']['id'];}else{_0x421984['id']=_0xdeb07b[_0x889a('0x4e')]['id'];}return db[_0x889a('0x2c')][_0x889a('0x49')]({'where':_0x421984,'attributes':['id','value'],'raw':!![]})[_0x889a('0x23')](handleEntityNotFound(_0x788521,null))[_0x889a('0x23')](function(_0x54d2dd){if(_0x54d2dd){var _0x510528=_0x54d2dd[_0x889a('0x4f')];var _0x486edc=util[_0x889a('0x30')](_0x889a('0x50'),_0x510528);if(fs[_0x889a('0x51')](_0x486edc)){_0x437d69=!![];return _0xc6fb49[_0x889a('0x52')](_0x486edc,_0x510528,config[_0x889a('0x53')][_0x889a('0x54')])[_0x889a('0x23')](function(){return _0x54d2dd;});}return _0x54d2dd;}})[_0x889a('0x23')](function(_0x35d77f){if(_0x35d77f){var _0x1bfaa0=_0x35d77f[_0x889a('0x4f')];if(!fs['existsSync'](_0x1bfaa0)){throw new db['Sequelize'][(_0x889a('0x55'))](_0x889a('0x56'));}if(_0x35d77f['filename']){return _0x788521[_0x889a('0x4c')](_0x1bfaa0,_0x35d77f[_0x889a('0x57')]+path[_0x889a('0x58')](_0x1bfaa0),function(){if(_0x437d69){fs[_0x889a('0x59')](_0x1bfaa0);}});}else{return _0x788521[_0x889a('0x4c')](_0x1bfaa0,function(_0x58d129){if(_0x437d69){fs[_0x889a('0x59')](_0x1bfaa0);}});}}})[_0x889a('0x46')](function(_0x4062e1){if(_0x4062e1[_0x889a('0x5a')]===_0x889a('0x56')){_0x788521['status'](0x194)[_0x889a('0x29')]('Not\x20found');}else{return handleError(_0x788521,null);}});};exports[_0x889a('0x5b')]=function(_0x3a5f07,_0x1e5455,_0x16bf38){var _0x5cf597=require(_0x889a('0x5c'));var _0x176b3f=![];var _0x4a6980={'$and':[db[_0x889a('0x5d')][_0x889a('0x40')](db['sequelize']['fn'](_0x889a('0x5e'),db['sequelize'][_0x889a('0x5f')](_0x889a('0x4d'))),_0x3a5f07[_0x889a('0x31')]['token'])]};if(_0x3a5f07['query'][_0x889a('0x2e')]&&_0x3a5f07['query'][_0x889a('0x2e')]==='uniqueid'){_0x4a6980[_0x889a('0x60')]['push']({'uniqueid':_0x3a5f07[_0x889a('0x4e')]['id']});}else{_0x4a6980[_0x889a('0x60')][_0x889a('0x61')]({'id':_0x3a5f07[_0x889a('0x4e')]['id']});}return db[_0x889a('0x2c')][_0x889a('0x49')]({'where':_0x4a6980,'attributes':['id',_0x889a('0x4f')],'raw':!![]})[_0x889a('0x23')](handleEntityNotFound(_0x1e5455,null))['then'](function(_0x1b0762){if(_0x1b0762){var _0x21e839=util[_0x889a('0x30')](_0x889a('0x50'),_0x1b0762[_0x889a('0x4f')]);if(fs[_0x889a('0x51')](_0x21e839)){_0x176b3f=!![];return _0x5cf597[_0x889a('0x52')](_0x21e839,_0x1b0762['value'],config[_0x889a('0x53')][_0x889a('0x54')])[_0x889a('0x23')](function(){return _0x1b0762;});}return _0x1b0762;}})['then'](function(_0x2c50b9){if(_0x2c50b9){if(!fs[_0x889a('0x51')](_0x2c50b9['value'])){throw new db[(_0x889a('0x62'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x2c50b9[_0x889a('0x57')]){return _0x1e5455['download'](_0x2c50b9[_0x889a('0x4f')],_0x2c50b9[_0x889a('0x57')]+path[_0x889a('0x58')](_0x2c50b9[_0x889a('0x4f')]),function(){if(_0x176b3f){fs[_0x889a('0x59')](_0x2c50b9['value']);}});}else{return _0x1e5455[_0x889a('0x4c')](_0x2c50b9[_0x889a('0x4f')],function(_0x4f1d9a){if(_0x176b3f){fs[_0x889a('0x59')](_0x2c50b9[_0x889a('0x4f')]);}});}}})[_0x889a('0x46')](handleError(_0x1e5455,null));};exports[_0x889a('0x24')]=function(_0xeef024,_0x123a1e){return db[_0x889a('0x2c')]['find']({'where':{'id':_0xeef024[_0x889a('0x4e')]['id']}})['then'](function(_0x49ed34){if(_['isNil'](_0x49ed34)){throw new ReferenceError(_0x889a('0x63'));}return _0x49ed34;})['then'](function(_0x143337){var _0x387639=_0x143337['value'];logger[_0x889a('0x64')](_0x889a('0x65'),_0x387639);if(!_[_0x889a('0x66')](_0x143337[_0x889a('0x4f')])&&fs['existsSync'](_0x387639)){logger['info'](_0x889a('0x67')+_0x387639+_0x889a('0x68'));fs['unlinkSync'](_0x387639);}_0x387639=_0x387639+_0x889a('0x69');if(!_[_0x889a('0x66')](_0x143337[_0x889a('0x4f')])&&fs['existsSync'](_0x387639)){logger['info'](_0x889a('0x67')+_0x387639+_0x889a('0x68'));fs[_0x889a('0x6a')](_0x387639);}return _0x143337;})['then'](function(_0x297087){if(!_0x297087)throw new InternalError();return _0x297087[_0x889a('0x24')]();})[_0x889a('0x23')](function(){_0x123a1e[_0x889a('0x1a')](0xcc)['end']();})[_0x889a('0x46')](handleError(_0x123a1e,null));};function getBucketslist(_0x4763c0,_0x3bb5d4,_0x2d09df){return new Promise(function(_0x406909,_0x27b02e){var _0x56be30=new AWS['S3']({'accessKeyId':_0x3bb5d4,'secretAccessKey':_0x4763c0,'region':_0x2d09df});_0x56be30[_0x889a('0x6b')]({},function(_0x7f6250,_0x5656ba){if(_0x7f6250){return _0x27b02e(_0x7f6250);}else{return _0x406909(_0x5656ba);}});});}function createBucket(_0x5defbe,_0x323f9b,_0x2d65fd,_0x2da681){return new Promise(function(_0x6204e6,_0x12becc){var _0x3e9665=new AWS['S3']({'accessKeyId':_0x323f9b,'secretAccessKey':_0x5defbe,'region':_0x2d65fd});_0x3e9665[_0x889a('0x6c')]({'Bucket':_0x2da681},function(_0x2f2957,_0x1e903b){if(_0x2f2957){return _0x12becc(_0x2f2957);}else{return _0x6204e6(_0x1e903b);}});});}function uploadFile(_0x21dc49,_0x231878,_0x1b6b3b,_0x2d2478,_0xf73d84,_0x16880a){return new Promise(function(_0x1de7dd,_0x496687){var _0x44d991=new AWS['S3']({'accessKeyId':_0x231878,'secretAccessKey':_0x21dc49,'region':_0x1b6b3b});_0x44d991[_0x889a('0x6d')]({'Bucket':_0x2d2478,'Key':_0xf73d84,'Body':_0x16880a},function(_0x42fb66,_0x373156){if(_0x42fb66){return _0x496687(_0x42fb66);}else{return _0x1de7dd(_0x373156);}});});}function startTranscribe(_0x30ffa2,_0x47003a,_0x1f53b8,_0x11c15b,_0x4e5688,_0xa04fef){return new Promise(function(_0x163463,_0x5d754d){var _0x375eb1=new AWS[(_0x889a('0x6e'))]({'accessKeyId':_0x47003a,'secretAccessKey':_0x30ffa2,'region':_0x1f53b8});_0x375eb1[_0x889a('0x6f')]({'TranscriptionJobName':_0x11c15b,'LanguageCode':_0x4e5688,'Media':{'MediaFileUri':_0xa04fef}},function(_0x96ddd,_0x5db95c){if(_0x96ddd){return _0x5d754d(_0x96ddd);}else{return _0x163463(_0x5db95c);}});});}function transcribe(_0x1fe90c,_0x549110,_0xfde47f,_0x38d4a4,_0x29fb9b,_0x5e6909,_0x2a149d){return new Promise(function(_0x2811f0,_0x194d8e){var _0x25ee85={};logger[_0x889a('0x64')](util[_0x889a('0x30')](_0x889a('0x70'),_0x1fe90c,_0x29fb9b));return uploadFile(_0x549110,_0xfde47f,_0x38d4a4,_0x29fb9b,path['basename'](_0x5e6909),fs[_0x889a('0x71')](_0x5e6909))[_0x889a('0x23')](function(_0x33df3c){logger[_0x889a('0x64')](util['format'](_0x889a('0x72'),_0x1fe90c,_0x29fb9b,_0x33df3c[_0x889a('0x73')]));_0x25ee85[_0x889a('0x74')]=_0x33df3c['Bucket'];_0x25ee85[_0x889a('0x75')]=_0x33df3c[_0x889a('0x73')];logger[_0x889a('0x64')](util[_0x889a('0x30')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x1fe90c));return startTranscribe(_0x549110,_0xfde47f,_0x38d4a4,uuidv4(),_0x2a149d,_0x33df3c['Location']);})[_0x889a('0x23')](function(_0x2ab138){logger[_0x889a('0x64')](util['format'](_0x889a('0x76'),_0x1fe90c,_0x2ab138[_0x889a('0x77')][_0x889a('0x78')]));_0x25ee85[_0x889a('0x79')]=_0x2ab138[_0x889a('0x77')]['TranscriptionJobName'];_0x25ee85[_0x889a('0x7a')]=_0x2ab138[_0x889a('0x77')]['TranscriptionJobStatus'];return _0x2811f0(_0x25ee85);})[_0x889a('0x46')](function(_0x350f77){return _0x194d8e(_0x350f77);});});}exports[_0x889a('0x7b')]=function(_0x22deaf,_0x34edcd,_0x1ab12c){var _0x3d26ef;var _0x107053;var _0x16af5b;var _0x2483d9=require(_0x889a('0x5c'));return db[_0x889a('0x2c')][_0x889a('0x7c')]({'where':{'id':_0x22deaf[_0x889a('0x4e')]['id']}})[_0x889a('0x23')](function(_0xc3ff05){if(_0xc3ff05){var _0x55f87f=util[_0x889a('0x30')](_0x889a('0x50'),_0xc3ff05[_0x889a('0x4f')]);if(fs[_0x889a('0x51')](_0x55f87f)){cypher=!![];return _0x2483d9[_0x889a('0x52')](_0x55f87f,_0xc3ff05[_0x889a('0x4f')],config[_0x889a('0x53')][_0x889a('0x54')])['then'](function(){return _0xc3ff05;});}return _0xc3ff05;}})['then'](function(_0x375034){if(!_0x375034){throw new db['Sequelize']['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x107053=_0x375034;return db[_0x889a('0x7d')][_0x889a('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x34edcd,null))[_0x889a('0x23')](function(_0x536149){if(_0x536149){_0x3d26ef=_0x536149;if(!_0x3d26ef[_0x889a('0x7e')]||!_0x3d26ef[_0x889a('0x7f')]||!_0x3d26ef[_0x889a('0x80')]||!_0x3d26ef[_0x889a('0x81')]||!_0x3d26ef['bucket']){throw new db[(_0x889a('0x62'))][(_0x889a('0x55'))](_0x889a('0x82'));}if(_0x22deaf[_0x889a('0x4a')][_0x889a('0x83')]&&(!_0x3d26ef[_0x889a('0x84')]||!_0x3d26ef[_0x889a('0x85')]||!_0x3d26ef['sentimentRegion']||!_0x3d26ef['language']||!_0x3d26ef[_0x889a('0x74')])){throw new db[(_0x889a('0x62'))][(_0x889a('0x55'))](_0x889a('0x86'));}return db[_0x889a('0x87')][_0x889a('0x7c')]({'where':{'id':_0x3d26ef[_0x889a('0x7f')]}});}})[_0x889a('0x23')](function(_0xce1abb){if(!_0xce1abb){throw new db[(_0x889a('0x62'))][(_0x889a('0x55'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xce1abb['data1']||!_0xce1abb['data2']){throw new db[(_0x889a('0x62'))][(_0x889a('0x55'))](_0x889a('0x88'));}_0x16af5b=_0xce1abb;return getBucketslist(_0x16af5b['data1'],_0x16af5b['data2'],_0x3d26ef[_0x889a('0x80')]);})[_0x889a('0x23')](function(_0xe5594c){if(_0xe5594c&&_0xe5594c['Buckets']){var _0x29625d=_[_0x889a('0x49')](_0xe5594c[_0x889a('0x89')],function(_0xfbaa5){return _0xfbaa5[_0x889a('0x8a')]===_0x3d26ef[_0x889a('0x74')];});if(!_0x29625d){logger[_0x889a('0x64')](util[_0x889a('0x30')](_0x889a('0x8b'),_0x22deaf[_0x889a('0x4e')]['id'],_0x3d26ef['bucket']));return createBucket(_0x16af5b[_0x889a('0x8c')],_0x16af5b[_0x889a('0x8d')],_0x3d26ef[_0x889a('0x80')],_0x3d26ef[_0x889a('0x74')]);}logger['info'](util[_0x889a('0x30')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x22deaf['params']['id'],_0x3d26ef[_0x889a('0x74')]));return;}})[_0x889a('0x23')](function(_0x315d20){if(_0x107053[_0x889a('0x7a')]===_0x889a('0x8e')){return transcribe(_0x22deaf['params']['id'],_0x16af5b['data1'],_0x16af5b[_0x889a('0x8d')],_0x3d26ef[_0x889a('0x80')],_0x3d26ef[_0x889a('0x74')],_0x107053['value'],_0x3d26ef['language']);}else{logger['info'](util[_0x889a('0x30')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x22deaf[_0x889a('0x4e')]['id']));return{'transcribeStatus':_0x889a('0x8f')};}})[_0x889a('0x23')](function(_0x243074){if(_0x243074){_0x243074[_0x889a('0x90')]=_0x22deaf[_0x889a('0x4a')][_0x889a('0x83')];return _0x107053['updateAttributes'](_0x243074);}})['then'](respondWithResult(_0x34edcd,null))[_0x889a('0x46')](handleError(_0x34edcd,null));};function writeFile(_0x392bf7,_0x471607){return new Promise(function(_0x6633c7,_0x5169cc){fs[_0x889a('0x91')](_0x471607,_0x392bf7,function(_0x49d345,_0x1f69b5){if(_0x49d345){return _0x5169cc(_0x49d345);}else{return _0x6633c7(_0x1f69b5);}});});}exports['downloadTranscribe']=function(_0x3dec72,_0x185776,_0x1ec8af){return db[_0x889a('0x2c')][_0x889a('0x7c')]({'where':{'id':_0x3dec72[_0x889a('0x4e')]['id']}})[_0x889a('0x23')](handleEntityNotFound(_0x185776))['then'](function(_0x4d2369){if(_0x4d2369&&_0x4d2369['fileText']){var _0x5ab82d=_0x4d2369[_0x889a('0x92')];var _0x37b0c9=config[_0x889a('0x93')]+_0x889a('0x94')+_0x4d2369['id']+'.txt';if(fs[_0x889a('0x51')](_0x37b0c9)){return _0x37b0c9;}return writeFile(_0x5ab82d,_0x37b0c9)['then'](function(){return _0x37b0c9;});}else{throw new db[(_0x889a('0x62'))][(_0x889a('0x55'))]('Transcript\x20not\x20available');}})[_0x889a('0x23')](function(_0x1acab2){return _0x185776['download'](_0x1acab2);})[_0x889a('0x46')](handleError(_0x185776));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 40b2b5e..7298410 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 _0xe13e=['uniqueid','transcribeStatus','define','VoiceRecording','voice_recordings'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0xe13e,0xde));var _0xee13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe13e[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x4df8d5,_0x355e7c){return _0x4df8d5[_0xee13('0x0')](_0xee13('0x1'),attributes,{'tableName':_0xee13('0x2'),'paranoid':![],'indexes':[{'name':_0xee13('0x3'),'fields':[_0xee13('0x3')]},{'name':_0xee13('0x4'),'fields':[_0xee13('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc8d=['uniqueid','transcribeStatus','exports','VoiceRecording','voice_recordings'];(function(_0x2469ae,_0x315025){var _0x59b683=function(_0x3e6b81){while(--_0x3e6b81){_0x2469ae['push'](_0x2469ae['shift']());}};_0x59b683(++_0x315025);}(_0xcc8d,0xbb));var _0xdcc8=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0xcc8d[_0x79cd47];return _0x3b9484;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0xdcc8('0x0')]=function(_0x14f011,_0x54464b){return _0x14f011['define'](_0xdcc8('0x1'),attributes,{'tableName':_0xdcc8('0x2'),'paranoid':![],'indexes':[{'name':_0xdcc8('0x3'),'fields':[_0xdcc8('0x3')]},{'name':_0xdcc8('0x4'),'fields':[_0xdcc8('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 14bc89c..ed74ab4 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 _0x0598=['catch','UpdateVoiceRecording','VoiceRecording','body','options','where','limit','then','CreateVoiceRecording','../../components/encryptor','callRecordingEncryption','value','format','%s.cypher','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x0598,0x92));var _0x8059=function(_0x58cd7a,_0x1a0d35){_0x58cd7a=_0x58cd7a-0x0;var _0x3aca3c=_0x0598[_0x58cd7a];return _0x3aca3c;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5996d7,_0x248273,_0x347f1b){return new BPromise(function(_0x4610d2,_0x116946){return client['request'](_0x5996d7,_0x347f1b)['then'](function(_0x89dda1){logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,_0x8059('0x9'));logger[_0x8059('0xa')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x248273,'request\x20sent',JSON[_0x8059('0xb')](_0x89dda1));if(_0x89dda1[_0x8059('0xc')]){if(_0x89dda1['error']['code']===0x1f4){logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);return _0x116946(_0x89dda1[_0x8059('0xc')][_0x8059('0xd')]);}logger['error'](_0x8059('0x8'),_0x248273,_0x89dda1['error'][_0x8059('0xd')]);return _0x4610d2(_0x89dda1['error'][_0x8059('0xd')]);}else{logger[_0x8059('0x7')](_0x8059('0x8'),_0x248273,'request\x20sent');_0x4610d2(_0x89dda1['result']['message']);}})[_0x8059('0xe')](function(_0x239195){logger[_0x8059('0xc')](_0x8059('0x8'),_0x248273,_0x239195);_0x116946(_0x239195);});});}exports[_0x8059('0xf')]=function(_0x4b6d55){var _0x10ad98=this;return new Promise(function(_0x2bb670,_0x37e926){return db[_0x8059('0x10')]['update'](_0x4b6d55[_0x8059('0x11')],{'raw':_0x4b6d55['options']?_0x4b6d55[_0x8059('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b6d55[_0x8059('0x12')]?_0x4b6d55['options'][_0x8059('0x13')]||null:null,'attributes':_0x4b6d55[_0x8059('0x12')]?_0x4b6d55[_0x8059('0x12')]['attributes']||null:null,'limit':_0x4b6d55['options']?_0x4b6d55[_0x8059('0x12')][_0x8059('0x14')]||null:null})[_0x8059('0x15')](function(_0x1585a3){logger['info'](_0x8059('0xf'),_0x4b6d55);logger[_0x8059('0xa')](_0x8059('0xf'),_0x4b6d55,JSON['stringify'](_0x1585a3));_0x2bb670(_0x1585a3);})[_0x8059('0xe')](function(_0x2256b1){logger[_0x8059('0xc')](_0x8059('0xf'),_0x2256b1['message'],_0x4b6d55);_0x37e926(_0x10ad98[_0x8059('0xc')](0x1f4,_0x2256b1[_0x8059('0xd')]));});});};exports[_0x8059('0x16')]=function(_0x3e2d2b){var _0x202b30=this;return new Promise(function(_0x54b88b,_0x387350){var _0x19b95a=require(_0x8059('0x17'));var _0x4a294f;return db['Setting']['findOne']({'attributes':['id',_0x8059('0x18')],'where':{'id':0x1},'raw':!![]})[_0x8059('0x15')](function(_0xc32b1f){_0x4a294f=_0xc32b1f;return db[_0x8059('0x10')]['create'](_0x3e2d2b[_0x8059('0x11')]);})['then'](function(_0x2f887c){if(_0x4a294f[_0x8059('0x18')]&&fs['existsSync'](_0x2f887c[_0x8059('0x19')])){var _0x1aead2=util[_0x8059('0x1a')](_0x8059('0x1b'),_0x2f887c[_0x8059('0x19')]);return _0x19b95a[_0x8059('0x1c')](_0x2f887c[_0x8059('0x19')],_0x1aead2,config[_0x8059('0x1d')]['recording'])[_0x8059('0x15')](function(){fs[_0x8059('0x1e')](_0x2f887c[_0x8059('0x19')]);logger[_0x8059('0x7')](_0x8059('0x1f'));return _0x2f887c;});}return _0x2f887c;})['then'](function(_0x39f1c4){logger[_0x8059('0x7')](_0x8059('0x16'),_0x3e2d2b);logger[_0x8059('0xa')](_0x8059('0x16'),_0x3e2d2b,JSON[_0x8059('0xb')](_0x39f1c4));_0x54b88b(_0x39f1c4);})[_0x8059('0xe')](function(_0x175d57){logger[_0x8059('0xc')](_0x8059('0x16'),_0x175d57['message'],_0x3e2d2b);_0x387350(_0x202b30[_0x8059('0xc')](0x1f4,_0x175d57['message']));});});}; \ No newline at end of file +var _0xfb11=['update','body','options','where','attributes','debug','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','recording','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateVoiceRecording','VoiceRecording'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xfb11[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fb1('0x4'));var logger=require('../../config/logger')(_0x1fb1('0x5'));var config=require(_0x1fb1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fb1('0x7')][_0x1fb1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c098d,_0x1859da,_0x2596c2){return new BPromise(function(_0x34e61a,_0x236b20){return client[_0x1fb1('0x9')](_0x4c098d,_0x2596c2)[_0x1fb1('0xa')](function(_0x438d15){logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,_0x1fb1('0xd'));logger['debug'](_0x1fb1('0xe'),_0x1859da,'request\x20sent',JSON[_0x1fb1('0xf')](_0x438d15));if(_0x438d15['error']){if(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x11')]===0x1f4){logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x236b20(_0x438d15['error'][_0x1fb1('0x12')]);}logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x34e61a(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);}else{logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,'request\x20sent');_0x34e61a(_0x438d15['result'][_0x1fb1('0x12')]);}})[_0x1fb1('0x13')](function(_0x3924ab){logger['error'](_0x1fb1('0xc'),_0x1859da,_0x3924ab);_0x236b20(_0x3924ab);});});}exports[_0x1fb1('0x14')]=function(_0x24d4df){var _0x34076b=this;return new Promise(function(_0x33c6b6,_0x27d71f){return db[_0x1fb1('0x15')][_0x1fb1('0x16')](_0x24d4df[_0x1fb1('0x17')],{'raw':_0x24d4df['options']?_0x24d4df[_0x1fb1('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24d4df['options']?_0x24d4df[_0x1fb1('0x18')][_0x1fb1('0x19')]||null:null,'attributes':_0x24d4df[_0x1fb1('0x18')]?_0x24d4df['options'][_0x1fb1('0x1a')]||null:null,'limit':_0x24d4df['options']?_0x24d4df['options']['limit']||null:null})[_0x1fb1('0xa')](function(_0x1f8e5a){logger[_0x1fb1('0xb')](_0x1fb1('0x14'),_0x24d4df);logger[_0x1fb1('0x1b')]('UpdateVoiceRecording',_0x24d4df,JSON[_0x1fb1('0xf')](_0x1f8e5a));_0x33c6b6(_0x1f8e5a);})[_0x1fb1('0x13')](function(_0x1dc03f){logger[_0x1fb1('0x10')](_0x1fb1('0x14'),_0x1dc03f[_0x1fb1('0x12')],_0x24d4df);_0x27d71f(_0x34076b[_0x1fb1('0x10')](0x1f4,_0x1dc03f[_0x1fb1('0x12')]));});});};exports['CreateVoiceRecording']=function(_0x1b25b3){var _0x1aac7d=this;return new Promise(function(_0x46ff60,_0xc5188b){var _0x1898e7=require(_0x1fb1('0x1c'));var _0x1a74c4;return db[_0x1fb1('0x1d')][_0x1fb1('0x1e')]({'attributes':['id',_0x1fb1('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x1fb1('0xa')](function(_0x497017){_0x1a74c4=_0x497017;return db[_0x1fb1('0x15')][_0x1fb1('0x20')](_0x1b25b3[_0x1fb1('0x17')]);})['then'](function(_0x106134){if(_0x1a74c4[_0x1fb1('0x1f')]&&fs[_0x1fb1('0x21')](_0x106134[_0x1fb1('0x22')])){var _0x5402e9=util[_0x1fb1('0x23')](_0x1fb1('0x24'),_0x106134['value']);return _0x1898e7[_0x1fb1('0x25')](_0x106134['value'],_0x5402e9,config['secrets'][_0x1fb1('0x26')])[_0x1fb1('0xa')](function(){fs['unlink'](_0x106134[_0x1fb1('0x22')]);logger[_0x1fb1('0xb')](_0x1fb1('0x27'));return _0x106134;});}return _0x106134;})[_0x1fb1('0xa')](function(_0x32d797){logger['info'](_0x1fb1('0x28'),_0x1b25b3);logger[_0x1fb1('0x1b')](_0x1fb1('0x28'),_0x1b25b3,JSON[_0x1fb1('0xf')](_0x32d797));_0x46ff60(_0x32d797);})[_0x1fb1('0x13')](function(_0x307700){logger[_0x1fb1('0x10')](_0x1fb1('0x28'),_0x307700[_0x1fb1('0x12')],_0x1b25b3);_0xc5188b(_0x1aac7d['error'](0x1f4,_0x307700[_0x1fb1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index c874454..2fc15a0 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 _0xd84d=['exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xd84d,0xa1));var _0xdd84=function(_0x40d432,_0x292fdb){_0x40d432=_0x40d432-0x0;var _0x2fcfc7=_0xd84d[_0x40d432];return _0x2fcfc7;};'use strict';var multer=require(_0xdd84('0x0'));var util=require('util');var path=require(_0xdd84('0x1'));var timeout=require(_0xdd84('0x2'));var express=require(_0xdd84('0x3'));var router=express['Router']();var fs_extra=require(_0xdd84('0x4'));var auth=require(_0xdd84('0x5'));var interaction=require(_0xdd84('0x6'));var config=require(_0xdd84('0x7'));var controller=require(_0xdd84('0x8'));router[_0xdd84('0x9')]('/',auth[_0xdd84('0xa')](),controller['index']);router[_0xdd84('0x9')]('/describe',auth[_0xdd84('0xa')](),controller[_0xdd84('0xb')]);router[_0xdd84('0x9')](_0xdd84('0xc'),auth[_0xdd84('0xa')](),controller[_0xdd84('0xd')]);router['post']('/',auth[_0xdd84('0xa')](),controller[_0xdd84('0xe')]);router[_0xdd84('0xf')](_0xdd84('0xc'),auth[_0xdd84('0xa')](),controller[_0xdd84('0x10')]);router[_0xdd84('0x11')](_0xdd84('0xc'),auth['isAuthenticated'](),controller[_0xdd84('0x12')]);module[_0xdd84('0x13')]=router; \ No newline at end of file +var _0x730f=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports','multer','util'];(function(_0x4047a1,_0x31be30){var _0x22c445=function(_0x11ee40){while(--_0x11ee40){_0x4047a1['push'](_0x4047a1['shift']());}};_0x22c445(++_0x31be30);}(_0x730f,0x10f));var _0xf730=function(_0x21eb9b,_0x5de982){_0x21eb9b=_0x21eb9b-0x0;var _0x40b464=_0x730f[_0x21eb9b];return _0x40b464;};'use strict';var multer=require(_0xf730('0x0'));var util=require(_0xf730('0x1'));var path=require(_0xf730('0x2'));var timeout=require(_0xf730('0x3'));var express=require(_0xf730('0x4'));var router=express[_0xf730('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf730('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf730('0x7'));var controller=require(_0xf730('0x8'));router[_0xf730('0x9')]('/',auth[_0xf730('0xa')](),controller[_0xf730('0xb')]);router[_0xf730('0x9')](_0xf730('0xc'),auth['isAuthenticated'](),controller[_0xf730('0xd')]);router[_0xf730('0x9')](_0xf730('0xe'),auth[_0xf730('0xa')](),controller[_0xf730('0xf')]);router[_0xf730('0x10')]('/',auth[_0xf730('0xa')](),controller[_0xf730('0x11')]);router[_0xf730('0x12')](_0xf730('0xe'),auth[_0xf730('0xa')](),controller['update']);router[_0xf730('0x13')]('/:id',auth[_0xf730('0xa')](),controller['destroy']);module[_0xf730('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 895043d..dc6fb24 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 _0x0dc4=['moment','exports','ENUM','blind','attended','STRING','Yes'];(function(_0x52c93b,_0x481d90){var _0x104f3c=function(_0xdc0508){while(--_0xdc0508){_0x52c93b['push'](_0x52c93b['shift']());}};_0x104f3c(++_0x481d90);}(_0x0dc4,0x157));var _0x40dc=function(_0xe47217,_0x3a35db){_0xe47217=_0xe47217-0x0;var _0x3dc84c=_0x0dc4[_0xe47217];return _0x3dc84c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x40dc('0x0'));module[_0x40dc('0x1')]={'type':{'type':Sequelize[_0x40dc('0x2')](_0x40dc('0x3'),_0x40dc('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x40dc('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x40dc('0x5')]},'transferercalleridname':{'type':Sequelize[_0x40dc('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x40dc('0x5')]},'transfererexten':{'type':Sequelize[_0x40dc('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x40dc('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x40dc('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x40dc('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x40dc('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x40dc('0x5')]},'transfereecontext':{'type':Sequelize[_0x40dc('0x5')]},'transfereeexten':{'type':Sequelize[_0x40dc('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x40dc('0x5')]},'isexternal':{'type':Sequelize[_0x40dc('0x2')](_0x40dc('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x40dc('0x5')]}}; \ No newline at end of file +var _0x669f=['moment','exports','blind','attended','STRING','ENUM','Yes'];(function(_0x310d2b,_0x18012c){var _0x4b9ee8=function(_0x7223e2){while(--_0x7223e2){_0x310d2b['push'](_0x310d2b['shift']());}};_0x4b9ee8(++_0x18012c);}(_0x669f,0xa8));var _0xf669=function(_0x408d22,_0x53eef9){_0x408d22=_0x408d22-0x0;var _0x58effd=_0x669f[_0x408d22];return _0x58effd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf669('0x0'));module[_0xf669('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf669('0x2'),_0xf669('0x3'))},'result':{'type':Sequelize[_0xf669('0x4')]},'transfererchannel':{'type':Sequelize[_0xf669('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xf669('0x4')]},'transferercalleridname':{'type':Sequelize[_0xf669('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf669('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xf669('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xf669('0x4')]},'transferercontext':{'type':Sequelize[_0xf669('0x4')]},'transfererexten':{'type':Sequelize[_0xf669('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xf669('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xf669('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xf669('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xf669('0x5')](_0xf669('0x6'),'No')},'context':{'type':Sequelize[_0xf669('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e9bef8e..1440ad5 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 _0x1fe7=['Content-Range','json','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','rows','show','params','length','include','find','create','catch','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set'];(function(_0xd7bfdc,_0x44377d){var _0x5a42f3=function(_0x310da0){while(--_0x310da0){_0xd7bfdc['push'](_0xd7bfdc['shift']());}};_0x5a42f3(++_0x44377d);}(_0x1fe7,0x76));var _0x71fe=function(_0x107c24,_0x309dba){_0x107c24=_0x107c24-0x0;var _0x585afa=_0x1fe7[_0x107c24];return _0x585afa;};'use strict';var emlformat=require(_0x71fe('0x0'));var rimraf=require(_0x71fe('0x1'));var zipdir=require(_0x71fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x71fe('0x3'));var moment=require(_0x71fe('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x71fe('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x71fe('0x6'));var ejs=require(_0x71fe('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71fe('0x8'));var squel=require(_0x71fe('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x71fe('0xa'));var toCsv=require(_0x71fe('0x6'));var querystring=require('querystring');var Papa=require(_0x71fe('0xb'));var Redis=require(_0x71fe('0xc'));var authService=require(_0x71fe('0xd'));var qs=require(_0x71fe('0xe'));var as=require(_0x71fe('0xf'));var hardwareService=require(_0x71fe('0x10'));var logger=require(_0x71fe('0x11'))(_0x71fe('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x71fe('0x13'));var db=require(_0x71fe('0x14'))['db'];function respondWithStatusCode(_0xb1f3a3,_0x166589){_0x166589=_0x166589||0xcc;return function(_0x1db568){if(_0x1db568){return _0xb1f3a3['sendStatus'](_0x166589);}return _0xb1f3a3[_0x71fe('0x15')](_0x166589)[_0x71fe('0x16')]();};}function respondWithResult(_0x1f4eb6,_0x5dafe1){_0x5dafe1=_0x5dafe1||0xc8;return function(_0x1d2fa4){if(_0x1d2fa4){return _0x1f4eb6[_0x71fe('0x15')](_0x5dafe1)['json'](_0x1d2fa4);}};}function respondWithFilteredResult(_0x5e5553,_0x2aa7f1){return function(_0x2244e6){if(_0x2244e6){var _0x3932b4=typeof _0x2aa7f1[_0x71fe('0x17')]===_0x71fe('0x18')&&typeof _0x2aa7f1[_0x71fe('0x19')]==='undefined';var _0x2eab22=_0x2244e6['count'];var _0x449e59=_0x3932b4?0x0:_0x2aa7f1[_0x71fe('0x17')];var _0x36ffb0=_0x3932b4?_0x2244e6[_0x71fe('0x1a')]:_0x2aa7f1[_0x71fe('0x17')]+_0x2aa7f1[_0x71fe('0x19')];var _0x58a8e4;if(_0x36ffb0>=_0x2eab22){_0x36ffb0=_0x2eab22;_0x58a8e4=0xc8;}else{_0x58a8e4=0xce;}_0x5e5553[_0x71fe('0x15')](_0x58a8e4);return _0x5e5553[_0x71fe('0x1b')](_0x71fe('0x1c'),_0x449e59+'-'+_0x36ffb0+'/'+_0x2eab22)[_0x71fe('0x1d')](_0x2244e6);}return null;};}function patchUpdates(_0x5e6c2d){return function(_0x40ad3c){try{jsonpatch[_0x71fe('0x1e')](_0x40ad3c,_0x5e6c2d,!![]);}catch(_0x345688){return BPromise[_0x71fe('0x1f')](_0x345688);}return _0x40ad3c['save']();};}function saveUpdates(_0x517901,_0x555127){return function(_0x218f03){if(_0x218f03){return _0x218f03[_0x71fe('0x20')](_0x517901)[_0x71fe('0x21')](function(_0x545fc5){return _0x545fc5;});}return null;};}function removeEntity(_0x315669,_0x33fe9f){return function(_0x14a8f9){if(_0x14a8f9){return _0x14a8f9[_0x71fe('0x22')]()[_0x71fe('0x21')](function(){_0x315669[_0x71fe('0x15')](0xcc)[_0x71fe('0x16')]();});}};}function handleEntityNotFound(_0x316b9e,_0x374ad5){return function(_0x2d2e13){if(!_0x2d2e13){_0x316b9e[_0x71fe('0x23')](0x194);}return _0x2d2e13;};}function handleError(_0x63adb4,_0x5a3537){_0x5a3537=_0x5a3537||0x1f4;return function(_0x1cb6bc){logger['error'](_0x1cb6bc[_0x71fe('0x24')]);if(_0x1cb6bc[_0x71fe('0x25')]){delete _0x1cb6bc[_0x71fe('0x25')];}_0x63adb4[_0x71fe('0x15')](_0x5a3537)[_0x71fe('0x26')](_0x1cb6bc);};}exports[_0x71fe('0x27')]=function(_0x5a0bd8,_0x1af8ae){var _0x276bd8={},_0x4d7d81={},_0x371785={'count':0x0,'rows':[]};var _0x4f8933=_[_0x71fe('0x28')](db[_0x71fe('0x29')][_0x71fe('0x2a')],function(_0x11da23){return{'name':_0x11da23[_0x71fe('0x2b')],'type':_0x11da23['type']['key']};});_0x4d7d81[_0x71fe('0x2c')]=_['map'](_0x4f8933,_0x71fe('0x25'));_0x4d7d81[_0x71fe('0x2d')]=_[_0x71fe('0x2e')](_0x5a0bd8['query']);_0x4d7d81[_0x71fe('0x2f')]=_['intersection'](_0x4d7d81[_0x71fe('0x2c')],_0x4d7d81[_0x71fe('0x2d')]);_0x276bd8[_0x71fe('0x30')]=_[_0x71fe('0x31')](_0x4d7d81['model'],qs[_0x71fe('0x32')](_0x5a0bd8[_0x71fe('0x2d')][_0x71fe('0x32')]));_0x276bd8['attributes']=_0x276bd8['attributes']['length']?_0x276bd8[_0x71fe('0x30')]:_0x4d7d81[_0x71fe('0x2c')];if(!_0x5a0bd8[_0x71fe('0x2d')][_0x71fe('0x33')](_0x71fe('0x34'))){_0x276bd8[_0x71fe('0x19')]=qs[_0x71fe('0x19')](_0x5a0bd8[_0x71fe('0x2d')][_0x71fe('0x19')]);_0x276bd8['offset']=qs[_0x71fe('0x17')](_0x5a0bd8['query'][_0x71fe('0x17')]);}_0x276bd8[_0x71fe('0x35')]=qs[_0x71fe('0x36')](_0x5a0bd8[_0x71fe('0x2d')][_0x71fe('0x36')]);_0x276bd8[_0x71fe('0x37')]=qs['filters'](_[_0x71fe('0x38')](_0x5a0bd8['query'],_0x4d7d81[_0x71fe('0x2f')]),_0x4f8933);if(_0x5a0bd8[_0x71fe('0x2d')]['filter']){_0x276bd8[_0x71fe('0x37')]=_['merge'](_0x276bd8[_0x71fe('0x37')],{'$or':_[_0x71fe('0x28')](_0x4f8933,function(_0x35f248){if(_0x35f248[_0x71fe('0x39')]!==_0x71fe('0x3a')){var _0x66a993={};_0x66a993[_0x35f248[_0x71fe('0x25')]]={'$like':'%'+_0x5a0bd8[_0x71fe('0x2d')][_0x71fe('0x3b')]+'%'};return _0x66a993;}})});}_0x276bd8=_[_0x71fe('0x3c')]({},_0x276bd8,_0x5a0bd8[_0x71fe('0x3d')]);var _0x47140d={'where':_0x276bd8['where']};return db['VoiceTransferReport'][_0x71fe('0x1a')](_0x47140d)[_0x71fe('0x21')](function(_0x15882d){_0x371785[_0x71fe('0x1a')]=_0x15882d;if(_0x5a0bd8[_0x71fe('0x2d')][_0x71fe('0x3e')]){_0x276bd8['include']=[{'all':!![]}];}return db[_0x71fe('0x29')]['findAll'](_0x276bd8);})[_0x71fe('0x21')](function(_0x1be2dc){_0x371785[_0x71fe('0x3f')]=_0x1be2dc;return _0x371785;})[_0x71fe('0x21')](respondWithFilteredResult(_0x1af8ae,_0x276bd8))['catch'](handleError(_0x1af8ae,null));};exports[_0x71fe('0x40')]=function(_0x19b59e,_0x4afe43){var _0x5983c1={'raw':!![],'where':{'id':_0x19b59e[_0x71fe('0x41')]['id']}},_0x3d8e8f={};_0x3d8e8f[_0x71fe('0x2c')]=_[_0x71fe('0x2e')](db[_0x71fe('0x29')]['rawAttributes']);_0x3d8e8f['query']=_[_0x71fe('0x2e')](_0x19b59e[_0x71fe('0x2d')]);_0x3d8e8f[_0x71fe('0x2f')]=_[_0x71fe('0x31')](_0x3d8e8f[_0x71fe('0x2c')],_0x3d8e8f[_0x71fe('0x2d')]);_0x5983c1[_0x71fe('0x30')]=_[_0x71fe('0x31')](_0x3d8e8f['model'],qs[_0x71fe('0x32')](_0x19b59e['query']['fields']));_0x5983c1['attributes']=_0x5983c1[_0x71fe('0x30')][_0x71fe('0x42')]?_0x5983c1['attributes']:_0x3d8e8f[_0x71fe('0x2c')];if(_0x19b59e[_0x71fe('0x2d')][_0x71fe('0x3e')]){_0x5983c1[_0x71fe('0x43')]=[{'all':!![]}];}_0x5983c1=_['merge']({},_0x5983c1,_0x19b59e['options']);return db['VoiceTransferReport'][_0x71fe('0x44')](_0x5983c1)[_0x71fe('0x21')](handleEntityNotFound(_0x4afe43,null))[_0x71fe('0x21')](respondWithResult(_0x4afe43,null))['catch'](handleError(_0x4afe43,null));};exports[_0x71fe('0x45')]=function(_0x3de269,_0x4bfa03){return db[_0x71fe('0x29')][_0x71fe('0x45')](_0x3de269['body'],{})[_0x71fe('0x21')](respondWithResult(_0x4bfa03,0xc9))[_0x71fe('0x46')](handleError(_0x4bfa03,null));};exports['update']=function(_0x4d53e8,_0x372f96){if(_0x4d53e8[_0x71fe('0x47')]['id']){delete _0x4d53e8[_0x71fe('0x47')]['id'];}return db[_0x71fe('0x29')][_0x71fe('0x44')]({'where':{'id':_0x4d53e8['params']['id']}})[_0x71fe('0x21')](handleEntityNotFound(_0x372f96,null))[_0x71fe('0x21')](saveUpdates(_0x4d53e8['body'],null))[_0x71fe('0x21')](respondWithResult(_0x372f96,null))['catch'](handleError(_0x372f96,null));};exports['destroy']=function(_0x11a8be,_0x4ea66e){return db['VoiceTransferReport'][_0x71fe('0x44')]({'where':{'id':_0x11a8be[_0x71fe('0x41')]['id']}})['then'](handleEntityNotFound(_0x4ea66e,null))[_0x71fe('0x21')](removeEntity(_0x4ea66e,null))[_0x71fe('0x46')](handleError(_0x4ea66e,null));};exports[_0x71fe('0x48')]=function(_0x578308,_0x2a031f){return db['VoiceTransferReport'][_0x71fe('0x48')]()['then'](respondWithResult(_0x2a031f,null))[_0x71fe('0x46')](handleError(_0x2a031f,null));}; \ No newline at end of file +var _0x20e9=['error','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName','key','map','query','keys','intersection','model','fields','attributes','length','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','show','params','filters','find','catch','create','update','body','destroy','describe','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x97cda9,_0x132af6){var _0x5a1679=function(_0x433501){while(--_0x433501){_0x97cda9['push'](_0x97cda9['shift']());}};_0x5a1679(++_0x132af6);}(_0x20e9,0x110));var _0x920e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x20e9[_0x9aada2];return _0x196dff;};'use strict';var emlformat=require(_0x920e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x920e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x920e('0x2'));var moment=require(_0x920e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x920e('0x4'));var util=require(_0x920e('0x5'));var path=require(_0x920e('0x6'));var sox=require(_0x920e('0x7'));var csv=require(_0x920e('0x8'));var ejs=require(_0x920e('0x9'));var fs=require('fs');var fs_extra=require(_0x920e('0xa'));var _=require(_0x920e('0xb'));var squel=require(_0x920e('0xc'));var crypto=require(_0x920e('0xd'));var jsforce=require(_0x920e('0xe'));var deskjs=require(_0x920e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x920e('0x10'));var Papa=require(_0x920e('0x11'));var Redis=require(_0x920e('0x12'));var authService=require(_0x920e('0x13'));var qs=require(_0x920e('0x14'));var as=require(_0x920e('0x15'));var hardwareService=require(_0x920e('0x16'));var logger=require(_0x920e('0x17'))(_0x920e('0x18'));var utils=require('../../config/utils');var config=require(_0x920e('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xee5029,_0x52c56b){_0x52c56b=_0x52c56b||0xcc;return function(_0x198c29){if(_0x198c29){return _0xee5029[_0x920e('0x1a')](_0x52c56b);}return _0xee5029[_0x920e('0x1b')](_0x52c56b)[_0x920e('0x1c')]();};}function respondWithResult(_0x2d6dc4,_0x11f1fe){_0x11f1fe=_0x11f1fe||0xc8;return function(_0x21ee6b){if(_0x21ee6b){return _0x2d6dc4[_0x920e('0x1b')](_0x11f1fe)[_0x920e('0x1d')](_0x21ee6b);}};}function respondWithFilteredResult(_0x4c54b8,_0x39a7c7){return function(_0x51afd5){if(_0x51afd5){var _0x417d7f=typeof _0x39a7c7[_0x920e('0x1e')]===_0x920e('0x1f')&&typeof _0x39a7c7[_0x920e('0x20')]===_0x920e('0x1f');var _0x35f2ef=_0x51afd5[_0x920e('0x21')];var _0x4e8e5b=_0x417d7f?0x0:_0x39a7c7[_0x920e('0x1e')];var _0x2a9bc2=_0x417d7f?_0x51afd5[_0x920e('0x21')]:_0x39a7c7[_0x920e('0x1e')]+_0x39a7c7[_0x920e('0x20')];var _0x1822c8;if(_0x2a9bc2>=_0x35f2ef){_0x2a9bc2=_0x35f2ef;_0x1822c8=0xc8;}else{_0x1822c8=0xce;}_0x4c54b8[_0x920e('0x1b')](_0x1822c8);return _0x4c54b8[_0x920e('0x22')](_0x920e('0x23'),_0x4e8e5b+'-'+_0x2a9bc2+'/'+_0x35f2ef)[_0x920e('0x1d')](_0x51afd5);}return null;};}function patchUpdates(_0x1eb733){return function(_0x1b0345){try{jsonpatch[_0x920e('0x24')](_0x1b0345,_0x1eb733,!![]);}catch(_0x592b8d){return BPromise[_0x920e('0x25')](_0x592b8d);}return _0x1b0345[_0x920e('0x26')]();};}function saveUpdates(_0x2a786d,_0x367e38){return function(_0x47b657){if(_0x47b657){return _0x47b657['update'](_0x2a786d)[_0x920e('0x27')](function(_0x3877cb){return _0x3877cb;});}return null;};}function removeEntity(_0x2a4bc4,_0x4c0cb4){return function(_0x15cfcf){if(_0x15cfcf){return _0x15cfcf['destroy']()[_0x920e('0x27')](function(){_0x2a4bc4[_0x920e('0x1b')](0xcc)[_0x920e('0x1c')]();});}};}function handleEntityNotFound(_0x5d97bc,_0x58dca8){return function(_0x28d7b5){if(!_0x28d7b5){_0x5d97bc[_0x920e('0x1a')](0x194);}return _0x28d7b5;};}function handleError(_0x3e9c76,_0x2d4976){_0x2d4976=_0x2d4976||0x1f4;return function(_0x112ce9){logger[_0x920e('0x28')](_0x112ce9[_0x920e('0x29')]);if(_0x112ce9[_0x920e('0x2a')]){delete _0x112ce9[_0x920e('0x2a')];}_0x3e9c76['status'](_0x2d4976)[_0x920e('0x2b')](_0x112ce9);};}exports[_0x920e('0x2c')]=function(_0xedaf2f,_0x266ece){var _0x1cf3f4={},_0x230304={},_0xcafa7b={'count':0x0,'rows':[]};var _0x38e053=_['map'](db[_0x920e('0x2d')][_0x920e('0x2e')],function(_0xbaa65e){return{'name':_0xbaa65e[_0x920e('0x2f')],'type':_0xbaa65e['type'][_0x920e('0x30')]};});_0x230304['model']=_[_0x920e('0x31')](_0x38e053,_0x920e('0x2a'));_0x230304[_0x920e('0x32')]=_[_0x920e('0x33')](_0xedaf2f[_0x920e('0x32')]);_0x230304['filters']=_[_0x920e('0x34')](_0x230304['model'],_0x230304[_0x920e('0x32')]);_0x1cf3f4['attributes']=_[_0x920e('0x34')](_0x230304[_0x920e('0x35')],qs['fields'](_0xedaf2f['query'][_0x920e('0x36')]));_0x1cf3f4[_0x920e('0x37')]=_0x1cf3f4['attributes'][_0x920e('0x38')]?_0x1cf3f4[_0x920e('0x37')]:_0x230304[_0x920e('0x35')];if(!_0xedaf2f[_0x920e('0x32')]['hasOwnProperty'](_0x920e('0x39'))){_0x1cf3f4[_0x920e('0x20')]=qs['limit'](_0xedaf2f[_0x920e('0x32')][_0x920e('0x20')]);_0x1cf3f4['offset']=qs['offset'](_0xedaf2f['query'][_0x920e('0x1e')]);}_0x1cf3f4[_0x920e('0x3a')]=qs['sort'](_0xedaf2f['query']['sort']);_0x1cf3f4[_0x920e('0x3b')]=qs['filters'](_[_0x920e('0x3c')](_0xedaf2f[_0x920e('0x32')],_0x230304['filters']),_0x38e053);if(_0xedaf2f[_0x920e('0x32')][_0x920e('0x3d')]){_0x1cf3f4['where']=_[_0x920e('0x3e')](_0x1cf3f4[_0x920e('0x3b')],{'$or':_['map'](_0x38e053,function(_0x1b8187){if(_0x1b8187[_0x920e('0x3f')]!==_0x920e('0x40')){var _0x29e639={};_0x29e639[_0x1b8187[_0x920e('0x2a')]]={'$like':'%'+_0xedaf2f['query']['filter']+'%'};return _0x29e639;}})});}_0x1cf3f4=_['merge']({},_0x1cf3f4,_0xedaf2f[_0x920e('0x41')]);var _0x57116b={'where':_0x1cf3f4['where']};return db[_0x920e('0x2d')][_0x920e('0x21')](_0x57116b)['then'](function(_0x1dd792){_0xcafa7b['count']=_0x1dd792;if(_0xedaf2f[_0x920e('0x32')]['includeAll']){_0x1cf3f4[_0x920e('0x42')]=[{'all':!![]}];}return db[_0x920e('0x2d')][_0x920e('0x43')](_0x1cf3f4);})['then'](function(_0x5e2104){_0xcafa7b['rows']=_0x5e2104;return _0xcafa7b;})[_0x920e('0x27')](respondWithFilteredResult(_0x266ece,_0x1cf3f4))['catch'](handleError(_0x266ece,null));};exports[_0x920e('0x44')]=function(_0xf2ca26,_0x5ae25c){var _0x5b6ca4={'raw':!![],'where':{'id':_0xf2ca26[_0x920e('0x45')]['id']}},_0x463d4d={};_0x463d4d[_0x920e('0x35')]=_[_0x920e('0x33')](db['VoiceTransferReport']['rawAttributes']);_0x463d4d[_0x920e('0x32')]=_[_0x920e('0x33')](_0xf2ca26['query']);_0x463d4d[_0x920e('0x46')]=_[_0x920e('0x34')](_0x463d4d[_0x920e('0x35')],_0x463d4d['query']);_0x5b6ca4[_0x920e('0x37')]=_[_0x920e('0x34')](_0x463d4d[_0x920e('0x35')],qs[_0x920e('0x36')](_0xf2ca26[_0x920e('0x32')][_0x920e('0x36')]));_0x5b6ca4[_0x920e('0x37')]=_0x5b6ca4['attributes'][_0x920e('0x38')]?_0x5b6ca4[_0x920e('0x37')]:_0x463d4d[_0x920e('0x35')];if(_0xf2ca26[_0x920e('0x32')]['includeAll']){_0x5b6ca4[_0x920e('0x42')]=[{'all':!![]}];}_0x5b6ca4=_[_0x920e('0x3e')]({},_0x5b6ca4,_0xf2ca26[_0x920e('0x41')]);return db[_0x920e('0x2d')][_0x920e('0x47')](_0x5b6ca4)[_0x920e('0x27')](handleEntityNotFound(_0x5ae25c,null))[_0x920e('0x27')](respondWithResult(_0x5ae25c,null))[_0x920e('0x48')](handleError(_0x5ae25c,null));};exports['create']=function(_0x16f31f,_0x5a741a){return db[_0x920e('0x2d')][_0x920e('0x49')](_0x16f31f['body'],{})[_0x920e('0x27')](respondWithResult(_0x5a741a,0xc9))[_0x920e('0x48')](handleError(_0x5a741a,null));};exports[_0x920e('0x4a')]=function(_0x68be66,_0x454b1f){if(_0x68be66[_0x920e('0x4b')]['id']){delete _0x68be66[_0x920e('0x4b')]['id'];}return db['VoiceTransferReport'][_0x920e('0x47')]({'where':{'id':_0x68be66['params']['id']}})[_0x920e('0x27')](handleEntityNotFound(_0x454b1f,null))[_0x920e('0x27')](saveUpdates(_0x68be66[_0x920e('0x4b')],null))[_0x920e('0x27')](respondWithResult(_0x454b1f,null))[_0x920e('0x48')](handleError(_0x454b1f,null));};exports[_0x920e('0x4c')]=function(_0xb5829c,_0x468c15){return db[_0x920e('0x2d')]['find']({'where':{'id':_0xb5829c[_0x920e('0x45')]['id']}})[_0x920e('0x27')](handleEntityNotFound(_0x468c15,null))['then'](removeEntity(_0x468c15,null))['catch'](handleError(_0x468c15,null));};exports[_0x920e('0x4d')]=function(_0xdac475,_0x3b9b2d){return db['VoiceTransferReport']['describe']()[_0x920e('0x27')](respondWithResult(_0x3b9b2d,null))[_0x920e('0x48')](handleError(_0x3b9b2d,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index bce78e1..ed94eed 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 _0xac93=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger'];(function(_0x1aeed7,_0x2137b4){var _0x5c11c4=function(_0x391724){while(--_0x391724){_0x1aeed7['push'](_0x1aeed7['shift']());}};_0x5c11c4(++_0x2137b4);}(_0xac93,0x72));var _0x3ac9=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xac93[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x3ac9('0x0'));var util=require(_0x3ac9('0x1'));var logger=require(_0x3ac9('0x2'))(_0x3ac9('0x3'));var moment=require(_0x3ac9('0x4'));var BPromise=require(_0x3ac9('0x5'));var rp=require(_0x3ac9('0x6'));var fs=require('fs');var path=require(_0x3ac9('0x7'));var rimraf=require(_0x3ac9('0x8'));var config=require(_0x3ac9('0x9'));var attributes=require('./voiceTransferReport.attributes');module[_0x3ac9('0xa')]=function(_0x3b3a23,_0xd294b6){return _0x3b3a23['define'](_0x3ac9('0xb'),attributes,{'tableName':_0x3ac9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d17=['../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x3d17,0x1b6));var _0x73d1=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0x3d17[_0x4d8a8f];return _0xfc4adc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x73d1('0x0'))('api');var moment=require(_0x73d1('0x1'));var BPromise=require(_0x73d1('0x2'));var rp=require(_0x73d1('0x3'));var fs=require('fs');var path=require(_0x73d1('0x4'));var rimraf=require(_0x73d1('0x5'));var config=require(_0x73d1('0x6'));var attributes=require(_0x73d1('0x7'));module[_0x73d1('0x8')]=function(_0x527d20,_0xb58729){return _0x527d20[_0x73d1('0x9')](_0x73d1('0xa'),attributes,{'tableName':_0x73d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 7ed348e..6adabbc 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 _0x0f74=['randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','stringify','lodash','bluebird'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x0f74,0x166));var _0x40f7=function(_0x57bbe1,_0x53b78d){_0x57bbe1=_0x57bbe1-0x0;var _0x420334=_0x0f74[_0x57bbe1];return _0x420334;};'use strict';var _=require(_0x40f7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x40f7('0x1'));var rs=require(_0x40f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40f7('0x3'))['db'];var utils=require(_0x40f7('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x40f7('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x40f7('0x6')][_0x40f7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2a0438,_0x33ad33,_0xae94b7){return new BPromise(function(_0x540a62,_0x5b64d5){return client[_0x40f7('0x8')](_0x2a0438,_0xae94b7)[_0x40f7('0x9')](function(_0x1bba6d){logger[_0x40f7('0xa')](_0x40f7('0xb'),_0x33ad33,'request\x20sent');logger[_0x40f7('0xc')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x33ad33,_0x40f7('0xd'),JSON['stringify'](_0x1bba6d));if(_0x1bba6d[_0x40f7('0xe')]){if(_0x1bba6d['error'][_0x40f7('0xf')]===0x1f4){logger[_0x40f7('0xe')](_0x40f7('0xb'),_0x33ad33,_0x1bba6d[_0x40f7('0xe')][_0x40f7('0x10')]);return _0x5b64d5(_0x1bba6d[_0x40f7('0xe')][_0x40f7('0x10')]);}logger[_0x40f7('0xe')](_0x40f7('0xb'),_0x33ad33,_0x1bba6d[_0x40f7('0xe')][_0x40f7('0x10')]);return _0x540a62(_0x1bba6d[_0x40f7('0xe')]['message']);}else{logger['info'](_0x40f7('0xb'),_0x33ad33,_0x40f7('0xd'));_0x540a62(_0x1bba6d[_0x40f7('0x11')][_0x40f7('0x10')]);}})[_0x40f7('0x12')](function(_0x1b876d){logger[_0x40f7('0xe')](_0x40f7('0xb'),_0x33ad33,_0x1b876d);_0x5b64d5(_0x1b876d);});});}exports[_0x40f7('0x13')]=function(_0x3f9562){var _0x18e4b2=this;return new Promise(function(_0x5860b2,_0x3b50d6){return db[_0x40f7('0x14')][_0x40f7('0x15')](_0x3f9562['body'],{'raw':_0x3f9562[_0x40f7('0x16')]?_0x3f9562[_0x40f7('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x40f7('0x9')](function(_0x4db32f){logger[_0x40f7('0xa')](_0x40f7('0x13'),_0x3f9562);logger[_0x40f7('0xc')](_0x40f7('0x13'),_0x3f9562,JSON[_0x40f7('0x17')](_0x4db32f));_0x5860b2(_0x4db32f);})['catch'](function(_0x521d7f){logger[_0x40f7('0xe')](_0x40f7('0x13'),_0x521d7f[_0x40f7('0x10')],_0x3f9562);_0x3b50d6(_0x18e4b2[_0x40f7('0xe')](0x1f4,_0x521d7f[_0x40f7('0x10')]));});});}; \ No newline at end of file +var _0x3191=['rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','then','debug','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x37a37b,_0x5d486b){var _0x48174c=function(_0x46035d){while(--_0x46035d){_0x37a37b['push'](_0x37a37b['shift']());}};_0x48174c(++_0x5d486b);}(_0x3191,0x1d4));var _0x1319=function(_0x351747,_0x1a7971){_0x351747=_0x351747-0x0;var _0x2618cf=_0x3191[_0x351747];return _0x2618cf;};'use strict';var _=require(_0x1319('0x0'));var util=require(_0x1319('0x1'));var moment=require(_0x1319('0x2'));var BPromise=require('bluebird');var rs=require(_0x1319('0x3'));var fs=require('fs');var Redis=require(_0x1319('0x4'));var db=require(_0x1319('0x5'))['db'];var utils=require(_0x1319('0x6'));var logger=require(_0x1319('0x7'))(_0x1319('0x8'));var config=require(_0x1319('0x9'));var jayson=require(_0x1319('0xa'));var client=jayson[_0x1319('0xb')][_0x1319('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x16327d,_0x3b875b,_0x487329){return new BPromise(function(_0x30fdab,_0x133c04){return client[_0x1319('0xd')](_0x16327d,_0x487329)['then'](function(_0x1979e2){logger[_0x1319('0xe')](_0x1319('0xf'),_0x3b875b,_0x1319('0x10'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x3b875b,_0x1319('0x10'),JSON['stringify'](_0x1979e2));if(_0x1979e2['error']){if(_0x1979e2['error']['code']===0x1f4){logger['error'](_0x1319('0xf'),_0x3b875b,_0x1979e2[_0x1319('0x11')][_0x1319('0x12')]);return _0x133c04(_0x1979e2[_0x1319('0x11')][_0x1319('0x12')]);}logger[_0x1319('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x3b875b,_0x1979e2[_0x1319('0x11')][_0x1319('0x12')]);return _0x30fdab(_0x1979e2[_0x1319('0x11')][_0x1319('0x12')]);}else{logger['info'](_0x1319('0xf'),_0x3b875b,_0x1319('0x10'));_0x30fdab(_0x1979e2[_0x1319('0x13')][_0x1319('0x12')]);}})[_0x1319('0x14')](function(_0x2823cf){logger[_0x1319('0x11')](_0x1319('0xf'),_0x3b875b,_0x2823cf);_0x133c04(_0x2823cf);});});}exports[_0x1319('0x15')]=function(_0x45fdfd){var _0x53a16f=this;return new Promise(function(_0x5d26ca,_0x887662){return db[_0x1319('0x16')]['create'](_0x45fdfd[_0x1319('0x17')],{'raw':_0x45fdfd[_0x1319('0x18')]?_0x45fdfd['options']['raw']===undefined?!![]:![]:!![]})[_0x1319('0x19')](function(_0x13bb38){logger[_0x1319('0xe')](_0x1319('0x15'),_0x45fdfd);logger[_0x1319('0x1a')](_0x1319('0x15'),_0x45fdfd,JSON[_0x1319('0x1b')](_0x13bb38));_0x5d26ca(_0x13bb38);})[_0x1319('0x14')](function(_0x4b4cd3){logger[_0x1319('0x11')]('CreateVoiceTransferReport',_0x4b4cd3['message'],_0x45fdfd);_0x887662(_0x53a16f[_0x1319('0x11')](0x1f4,_0x4b4cd3[_0x1319('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 5fca53b..f163276 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 _0xa9e0=['/transfer','transfer','exports','express','Router','../../components/auth/service','/originate','isWebrtcLicence','originate','post','/hangup','isAuthenticated','hangup','/answer','answer','hold','/unhold','calls'];(function(_0x489caf,_0x425a9b){var _0x621c2f=function(_0x282cd4){while(--_0x282cd4){_0x489caf['push'](_0x489caf['shift']());}};_0x621c2f(++_0x425a9b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./webbar.controller');router['post'](_0x0a9e('0x3'),auth['isAuthenticated'](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0x5')]);router[_0x0a9e('0x6')](_0x0a9e('0x7'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x6')](_0x0a9e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x0a9e('0xb')]);router['post']('/hold',auth[_0x0a9e('0x8')](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x6')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller['unhold']);router['post']('/calls',auth[_0x0a9e('0x8')](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x6')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller[_0x0a9e('0x10')]);module[_0x0a9e('0x11')]=router; \ No newline at end of file +var _0x9f62=['/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','hold','/calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','originate'];(function(_0x45dc24,_0x59f93d){var _0x56d8ba=function(_0x19eca0){while(--_0x19eca0){_0x45dc24['push'](_0x45dc24['shift']());}};_0x56d8ba(++_0x59f93d);}(_0x9f62,0x154));var _0x29f6=function(_0x305b6b,_0x59b94c){_0x305b6b=_0x305b6b-0x0;var _0x4e6084=_0x9f62[_0x305b6b];return _0x4e6084;};'use strict';var express=require('express');var router=express[_0x29f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x29f6('0x1'));router[_0x29f6('0x2')](_0x29f6('0x3'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x29f6('0x4')]);router[_0x29f6('0x2')](_0x29f6('0x5'),auth[_0x29f6('0x6')](),auth['isWebrtcLicence'](),controller[_0x29f6('0x7')]);router[_0x29f6('0x2')](_0x29f6('0x8'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['answer']);router['post']('/hold',auth['isAuthenticated'](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xa')]);router['post']('/unhold',auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['unhold']);router[_0x29f6('0x2')](_0x29f6('0xb'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['calls']);router['post'](_0x29f6('0xc'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xd')]);module[_0x29f6('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 46d226f..89923a8 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 _0xb43b=['localhost','socket.io-emitter','redis','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','emit','handleError:','stack','name','send','status','request','error','code','result','catch','User','findOne','agent','VoiceChannels','all','then','filter','rows','sessionId','originate','info','originate\x20fired:','body','length','json','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','userId','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','UserId','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','defaults'];(function(_0x3d3b58,_0x49aa39){var _0x5be537=function(_0x32b01c){while(--_0x32b01c){_0x3d3b58['push'](_0x3d3b58['shift']());}};_0x5be537(++_0x49aa39);}(_0xb43b,0x1b2));var _0xbb43=function(_0x47bbbd,_0x3db48a){_0x47bbbd=_0x47bbbd-0x0;var _0x4bb0f4=_0xb43b[_0x47bbbd];return _0x4bb0f4;};'use strict';var path=require(_0xbb43('0x0'));var fs=require('fs');var _=require(_0xbb43('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xbb43('0x2'));var util=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xbb43('0x5')][_0xbb43('0x6')]({'port':0x232a});var logger=require(_0xbb43('0x7'))(_0xbb43('0x8'));var Redis=require('ioredis');config['redis']=_[_0xbb43('0x9')](config['redis'],{'host':_0xbb43('0xa'),'port':0x18eb});var io=require(_0xbb43('0xb'))(new Redis(config[_0xbb43('0xc')]));var Schema=require(_0xbb43('0xd'));var originateValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xbb43('0xf'),'required':[!![],_0xbb43('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xbb43('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],_0xbb43('0x11')]},'sessionId':{'type':_0xbb43('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],_0xbb43('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],_0xbb43('0x11')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xbb43('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xbb43('0x11')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],_0xbb43('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],_0xbb43('0x11')]}});function emit(_0x57bd1d,_0x526330,_0x202980){logger['info'](_0x57bd1d,_0x526330,JSON['stringify'](_0x202980));io['to'](_0x57bd1d)[_0xbb43('0x12')](_0x526330,_0x202980);}function handleError(_0x8242ab){return function(_0x2e3b43){console['log'](_0xbb43('0x13'),_0x2e3b43,_0x2e3b43 instanceof RangeError);logger['error'](_0x2e3b43[_0xbb43('0x14')]);if(_0x2e3b43 instanceof RangeError){if(_0x2e3b43[_0xbb43('0x15')]){delete _0x2e3b43['name'];}_0x8242ab['status'](0x194)[_0xbb43('0x16')](_0x2e3b43);}else{if(_0x2e3b43[_0xbb43('0x15')]){delete _0x2e3b43[_0xbb43('0x15')];}_0x8242ab[_0xbb43('0x17')](0x1f4)['send'](_0x2e3b43);}};}function checkError(){return function(_0x40a650){if(!_0x40a650){throw new RangeError('NotFound');}return _0x40a650;};}function respondWithRpcPromise(_0x3a257d,_0x4bfaca){return new BPromise(function(_0x2f5e31,_0x565256){var _0x3f323e=amiClient;return _0x3f323e[_0xbb43('0x18')](_0x3a257d,_0x4bfaca)['then'](function(_0x1d0768){if(_0x1d0768['error']){if(_0x1d0768[_0xbb43('0x19')][_0xbb43('0x1a')]===0x1f4){return _0x565256(_0x1d0768[_0xbb43('0x19')]['message']);}return _0x2f5e31(_0x1d0768['error']['message']);}else{_0x2f5e31(_0x1d0768[_0xbb43('0x1b')]);}})[_0xbb43('0x1c')](function(_0x5d8310){_0x565256(_0x5d8310);});});}function getAgent(_0x3b3083){return db[_0xbb43('0x1d')][_0xbb43('0x1e')]({'where':{'id':_0x3b3083,'role':_0xbb43('0x1f')}})['then'](checkError());}function getAgentCheckSession(_0x4b5342,_0x27fd7a){return new BPromise(function(_0x42800f,_0xa88db0){var _0x8b3205=respondWithRpcPromise(_0xbb43('0x20'));var _0x40b04b=getAgent(_0x4b5342);Promise[_0xbb43('0x21')]([_0x8b3205,_0x40b04b])[_0xbb43('0x22')](function(_0x539730){var _0x2ad6da=_0x539730[0x0];var _0x56fe33=_0x539730[0x1];var _0x31fbc8=_[_0xbb43('0x23')](_0x2ad6da[_0xbb43('0x24')],function(_0x1880cd){return _0x1880cd['UserId']==_0x56fe33['id']&&_0x1880cd[_0xbb43('0x25')]==_0x27fd7a;});if(_0x31fbc8['length']==0x1){_0x42800f(_0x56fe33);}else{_0xa88db0(new RangeError('sessionId\x20'+_0x27fd7a+'\x20not\x20found!'));}});});}exports[_0xbb43('0x26')]=function(_0x573a05,_0xa7e144){logger[_0xbb43('0x27')](_0xbb43('0x28'),_0x573a05['body']);var _0x205011=originateValidation[_0xbb43('0xd')](_0x573a05[_0xbb43('0x29')]);if(_0x205011[_0xbb43('0x2a')]>0x0){return _0xa7e144[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x205011);}var _0x3de482=_0x573a05[_0xbb43('0x29')]['userId'];var _0x2109aa=_0x573a05[_0xbb43('0x29')][_0xbb43('0x2c')];var _0x244d66=_0x573a05[_0xbb43('0x29')][_0xbb43('0x2d')];var _0x1eae09=_0x573a05[_0xbb43('0x29')][_0xbb43('0x2e')];return getAgent(_0x3de482)[_0xbb43('0x22')](function(_0x21346a){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x21346a[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')](_0xbb43('0x31'),_0x21346a['name']),_0xbb43('0x32'),{'callNumber':_0x2109aa,'callerId':_0x244d66,'callbackUrl':_0x1eae09});return _0xa7e144[_0xbb43('0x17')](0xc8)['json']({'error':![],'message':_0xbb43('0x33')});})[_0xbb43('0x1c')](handleError(_0xa7e144));};exports[_0xbb43('0x34')]=function(_0x5374a2,_0x5f4601){logger['info'](_0xbb43('0x35'),_0x5374a2[_0xbb43('0x29')]);var _0x4a95c3=hangupValidation['validate'](_0x5374a2[_0xbb43('0x29')]);if(_0x4a95c3[_0xbb43('0x2a')]>0x0){return _0x5f4601[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x4a95c3);}var _0x3f9e7f=_0x5374a2['body'][_0xbb43('0x36')];var _0x526cb8=_0x5374a2[_0xbb43('0x29')][_0xbb43('0x25')];return getAgent(_0x3f9e7f)[_0xbb43('0x22')](function(_0x531d96){logger[_0xbb43('0x27')]('entityFound:',_0x531d96[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')]('user:%s',_0x531d96[_0xbb43('0x15')]),'webbar:hangup',{'sessionId':_0x526cb8});return _0x5f4601[_0xbb43('0x17')](0xc8)[_0xbb43('0x2b')]({'error':![],'message':_0xbb43('0x37')});})[_0xbb43('0x1c')](handleError(_0x5f4601));};exports['answer']=function(_0x3e0871,_0x136bd4){logger['info'](_0xbb43('0x38'),_0x3e0871['body']);var _0x42b965=answerValidation[_0xbb43('0xd')](_0x3e0871[_0xbb43('0x29')]);if(_0x42b965[_0xbb43('0x2a')]>0x0){return _0x136bd4[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x42b965);}var _0x4bf8ed=_0x3e0871[_0xbb43('0x29')]['userId'];var _0x307f1e=_0x3e0871[_0xbb43('0x29')][_0xbb43('0x25')];return getAgent(_0x4bf8ed)[_0xbb43('0x22')](function(_0x4970fb){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x4970fb[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')](_0xbb43('0x31'),_0x4970fb[_0xbb43('0x15')]),_0xbb43('0x39'),{'sessionId':_0x307f1e});return _0x136bd4[_0xbb43('0x17')](0xc8)['json']({'error':![],'message':_0xbb43('0x3a')});})[_0xbb43('0x1c')](handleError(_0x136bd4));};exports['hold']=function(_0x1a66f0,_0x5d4c19){logger['info']('hold\x20fired:',_0x1a66f0['body']);var _0x1c3482=holdValidation['validate'](_0x1a66f0[_0xbb43('0x29')]);if(_0x1c3482['length']>0x0){return _0x5d4c19[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x1c3482);}var _0x1f3fb4=_0x1a66f0['body'][_0xbb43('0x36')];var _0x4d9f18=_0x1a66f0[_0xbb43('0x29')][_0xbb43('0x25')];return getAgent(_0x1f3fb4)[_0xbb43('0x22')](function(_0x29840e){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x29840e[_0xbb43('0x15')]);emit(util['format'](_0xbb43('0x31'),_0x29840e[_0xbb43('0x15')]),_0xbb43('0x3b'),{'sessionId':_0x4d9f18});return _0x5d4c19[_0xbb43('0x17')](0xc8)['json']({'error':![],'message':_0xbb43('0x3c')});})[_0xbb43('0x1c')](handleError(_0x5d4c19));};exports[_0xbb43('0x3d')]=function(_0xb1883e,_0x4b7712){logger[_0xbb43('0x27')](_0xbb43('0x3e'),_0xb1883e[_0xbb43('0x29')]);var _0x4e1959=unholdValidation[_0xbb43('0xd')](_0xb1883e[_0xbb43('0x29')]);if(_0x4e1959[_0xbb43('0x2a')]>0x0){return _0x4b7712[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x4e1959);}var _0x59c805=_0xb1883e['body'][_0xbb43('0x36')];var _0x5c75ba=_0xb1883e[_0xbb43('0x29')][_0xbb43('0x25')];return getAgent(_0x59c805)['then'](function(_0x29aea0){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x29aea0[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')]('user:%s',_0x29aea0[_0xbb43('0x15')]),'webbar:unhold',{'sessionId':_0x5c75ba});return _0x4b7712['status'](0xc8)[_0xbb43('0x2b')]({'error':![],'message':_0xbb43('0x3f')});})[_0xbb43('0x1c')](handleError(_0x4b7712));};exports[_0xbb43('0x40')]=function(_0x129ee6,_0x5db053){logger['info'](_0xbb43('0x41'),_0x5db053[_0xbb43('0x29')]);var _0x3a84ad=callsValidation[_0xbb43('0xd')](_0x129ee6[_0xbb43('0x29')]);if(_0x3a84ad[_0xbb43('0x2a')]>0x0){return _0x5db053[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x3a84ad);}var _0x1a3f98=_0x129ee6['body'][_0xbb43('0x36')];var _0xb996d7=respondWithRpcPromise(_0xbb43('0x20'));var _0x3675d9=getAgent(_0x1a3f98);return Promise[_0xbb43('0x21')]([_0xb996d7,_0x3675d9])[_0xbb43('0x22')](function(_0x3f7262){var _0x3589fd=_0x3f7262[0x0];var _0x3e01e4=_0x3f7262[0x1];var _0x49a54e=_['filter'](_0x3589fd[_0xbb43('0x24')],function(_0x2b72ae){return _0x2b72ae[_0xbb43('0x42')]==_0x3e01e4['id'];});return _0x5db053[_0xbb43('0x17')](0xc8)[_0xbb43('0x2b')]({'count':_0x49a54e[_0xbb43('0x2a')],'rows':_0x49a54e});})[_0xbb43('0x1c')](handleError(_0x5db053));};exports['conference']=function(_0x3bda63,_0x599eec){logger['info'](_0xbb43('0x43'),_0x3bda63[_0xbb43('0x29')]);var _0x3cccea=conferenceValidation[_0xbb43('0xd')](_0x3bda63[_0xbb43('0x29')]);if(_0x3cccea[_0xbb43('0x2a')]>0x0){return _0x599eec[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x3cccea);}var _0x51b076=_0x3bda63['body'][_0xbb43('0x36')];return getAgent(_0x51b076)[_0xbb43('0x22')](function(_0x137e75){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x137e75[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')](_0xbb43('0x31'),_0x137e75[_0xbb43('0x15')]),'webbar:conference');return _0x599eec[_0xbb43('0x17')](0xc8)[_0xbb43('0x2b')]({'error':![],'message':_0xbb43('0x44')});})[_0xbb43('0x1c')](handleError(_0x599eec));};exports[_0xbb43('0x45')]=function(_0x33a4db,_0x5745eb){logger[_0xbb43('0x27')](_0xbb43('0x46'),_0x33a4db[_0xbb43('0x29')]);var _0x6d3bb1=transferValidation[_0xbb43('0xd')](_0x33a4db['body']);if(_0x6d3bb1[_0xbb43('0x2a')]>0x0){return _0x5745eb[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x6d3bb1);}var _0x231b11=_0x33a4db[_0xbb43('0x29')][_0xbb43('0x36')];var _0x2bd30e=_0x33a4db[_0xbb43('0x29')][_0xbb43('0x25')];var _0x3ab906=_0x33a4db['body'][_0xbb43('0x47')];return getAgent(_0x231b11)['then'](function(_0x2b9e5d){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x2b9e5d[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')]('user:%s',_0x2b9e5d['name']),_0xbb43('0x48'),{'sessionId':_0x2bd30e,'transferNumber':_0x3ab906});return _0x5745eb[_0xbb43('0x17')](0xc8)['json']({'error':![],'message':_0xbb43('0x49')});})[_0xbb43('0x1c')](handleError(_0x5745eb));}; \ No newline at end of file +var _0x54ef=['callerId','format','user:%s','webbar:originate','originate\x20executed!','hangup','validate','userId','entityFound:','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','filter','conference','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','defaults','redis','localhost','number','userId\x20is\x20required','callNumber\x20is\x20required','string','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','body','json','callNumber'];(function(_0x1c5dea,_0x38234d){var _0x5e9f62=function(_0x574733){while(--_0x574733){_0x1c5dea['push'](_0x1c5dea['shift']());}};_0x5e9f62(++_0x38234d);}(_0x54ef,0x112));var _0xf54e=function(_0x4b777f,_0x518cb0){_0x4b777f=_0x4b777f-0x0;var _0x4bd7d3=_0x54ef[_0x4b777f];return _0x4bd7d3;};'use strict';var path=require(_0xf54e('0x0'));var fs=require('fs');var _=require(_0xf54e('0x1'));var db=require(_0xf54e('0x2'))['db'];var config=require('../../config/environment');var util=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var jayson=require(_0xf54e('0x5'));var amiClient=jayson[_0xf54e('0x6')][_0xf54e('0x7')]({'port':0x232a});var logger=require(_0xf54e('0x8'))(_0xf54e('0x9'));var Redis=require('ioredis');config['redis']=_[_0xf54e('0xa')](config[_0xf54e('0xb')],{'host':_0xf54e('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf54e('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],_0xf54e('0xe')]},'callNumber':{'type':'string','required':[!![],_0xf54e('0xf')]},'callerId':{'type':_0xf54e('0x10')},'callbackUrl':{'type':_0xf54e('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf54e('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],_0xf54e('0xe')]},'sessionId':{'type':_0xf54e('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf54e('0xe')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xf54e('0x10'),'required':[!![],_0xf54e('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],_0xf54e('0xe')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],_0xf54e('0xe')]},'sessionId':{'type':_0xf54e('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xf54e('0xd'),'required':[!![],_0xf54e('0xe')]}});function emit(_0x3eb415,_0x5c5d00,_0x4af633){logger[_0xf54e('0x12')](_0x3eb415,_0x5c5d00,JSON[_0xf54e('0x13')](_0x4af633));io['to'](_0x3eb415)[_0xf54e('0x14')](_0x5c5d00,_0x4af633);}function handleError(_0x9647f){return function(_0x15cc48){console[_0xf54e('0x15')](_0xf54e('0x16'),_0x15cc48,_0x15cc48 instanceof RangeError);logger[_0xf54e('0x17')](_0x15cc48[_0xf54e('0x18')]);if(_0x15cc48 instanceof RangeError){if(_0x15cc48[_0xf54e('0x19')]){delete _0x15cc48[_0xf54e('0x19')];}_0x9647f['status'](0x194)['send'](_0x15cc48);}else{if(_0x15cc48[_0xf54e('0x19')]){delete _0x15cc48['name'];}_0x9647f[_0xf54e('0x1a')](0x1f4)[_0xf54e('0x1b')](_0x15cc48);}};}function checkError(){return function(_0x106362){if(!_0x106362){throw new RangeError(_0xf54e('0x1c'));}return _0x106362;};}function respondWithRpcPromise(_0xf64f12,_0x3887b0){return new BPromise(function(_0x388aa0,_0x11985e){var _0x3c0169=amiClient;return _0x3c0169[_0xf54e('0x1d')](_0xf64f12,_0x3887b0)[_0xf54e('0x1e')](function(_0x5b83df){if(_0x5b83df[_0xf54e('0x17')]){if(_0x5b83df['error'][_0xf54e('0x1f')]===0x1f4){return _0x11985e(_0x5b83df[_0xf54e('0x17')][_0xf54e('0x20')]);}return _0x388aa0(_0x5b83df[_0xf54e('0x17')][_0xf54e('0x20')]);}else{_0x388aa0(_0x5b83df[_0xf54e('0x21')]);}})[_0xf54e('0x22')](function(_0x43488d){_0x11985e(_0x43488d);});});}function getAgent(_0x2342a9){return db[_0xf54e('0x23')][_0xf54e('0x24')]({'where':{'id':_0x2342a9,'role':_0xf54e('0x25')}})[_0xf54e('0x1e')](checkError());}function getAgentCheckSession(_0x5390b8,_0xb3706e){return new BPromise(function(_0x4cbf7c,_0x282c63){var _0x5e63f4=respondWithRpcPromise(_0xf54e('0x26'));var _0x269f47=getAgent(_0x5390b8);Promise[_0xf54e('0x27')]([_0x5e63f4,_0x269f47])[_0xf54e('0x1e')](function(_0x25b643){var _0x3993e4=_0x25b643[0x0];var _0x36f985=_0x25b643[0x1];var _0x54bd8f=_['filter'](_0x3993e4[_0xf54e('0x28')],function(_0x258d29){return _0x258d29[_0xf54e('0x29')]==_0x36f985['id']&&_0x258d29[_0xf54e('0x2a')]==_0xb3706e;});if(_0x54bd8f[_0xf54e('0x2b')]==0x1){_0x4cbf7c(_0x36f985);}else{_0x282c63(new RangeError(_0xf54e('0x2c')+_0xb3706e+_0xf54e('0x2d')));}});});}exports[_0xf54e('0x2e')]=function(_0x3ae704,_0x12edc3){logger['info']('originate\x20fired:',_0x3ae704[_0xf54e('0x2f')]);var _0x3169dd=originateValidation['validate'](_0x3ae704[_0xf54e('0x2f')]);if(_0x3169dd[_0xf54e('0x2b')]>0x0){return _0x12edc3[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x3169dd);}var _0x576b46=_0x3ae704['body']['userId'];var _0x3c0cca=_0x3ae704[_0xf54e('0x2f')][_0xf54e('0x31')];var _0x399e68=_0x3ae704[_0xf54e('0x2f')][_0xf54e('0x32')];var _0x49ba1c=_0x3ae704['body']['callbackUrl'];return getAgent(_0x576b46)[_0xf54e('0x1e')](function(_0x734187){logger['info']('entityFound:',_0x734187[_0xf54e('0x19')]);emit(util[_0xf54e('0x33')](_0xf54e('0x34'),_0x734187['name']),_0xf54e('0x35'),{'callNumber':_0x3c0cca,'callerId':_0x399e68,'callbackUrl':_0x49ba1c});return _0x12edc3[_0xf54e('0x1a')](0xc8)['json']({'error':![],'message':_0xf54e('0x36')});})[_0xf54e('0x22')](handleError(_0x12edc3));};exports[_0xf54e('0x37')]=function(_0x1eeeb4,_0x12ef97){logger[_0xf54e('0x12')]('hangup\x20fired:',_0x1eeeb4['body']);var _0x3d5a68=hangupValidation[_0xf54e('0x38')](_0x1eeeb4[_0xf54e('0x2f')]);if(_0x3d5a68['length']>0x0){return _0x12ef97[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x3d5a68);}var _0x448054=_0x1eeeb4[_0xf54e('0x2f')][_0xf54e('0x39')];var _0x23f297=_0x1eeeb4[_0xf54e('0x2f')][_0xf54e('0x2a')];return getAgent(_0x448054)[_0xf54e('0x1e')](function(_0x2087b3){logger[_0xf54e('0x12')](_0xf54e('0x3a'),_0x2087b3[_0xf54e('0x19')]);emit(util[_0xf54e('0x33')](_0xf54e('0x34'),_0x2087b3['name']),'webbar:hangup',{'sessionId':_0x23f297});return _0x12ef97['status'](0xc8)[_0xf54e('0x30')]({'error':![],'message':_0xf54e('0x3b')});})['catch'](handleError(_0x12ef97));};exports[_0xf54e('0x3c')]=function(_0x311ce1,_0x381c03){logger['info'](_0xf54e('0x3d'),_0x311ce1[_0xf54e('0x2f')]);var _0x1e016e=answerValidation[_0xf54e('0x38')](_0x311ce1[_0xf54e('0x2f')]);if(_0x1e016e[_0xf54e('0x2b')]>0x0){return _0x381c03[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x1e016e);}var _0x5b4ea1=_0x311ce1['body'][_0xf54e('0x39')];var _0x3447fd=_0x311ce1[_0xf54e('0x2f')][_0xf54e('0x2a')];return getAgent(_0x5b4ea1)[_0xf54e('0x1e')](function(_0x2fce4f){logger['info'](_0xf54e('0x3a'),_0x2fce4f['name']);emit(util[_0xf54e('0x33')]('user:%s',_0x2fce4f[_0xf54e('0x19')]),_0xf54e('0x3e'),{'sessionId':_0x3447fd});return _0x381c03[_0xf54e('0x1a')](0xc8)['json']({'error':![],'message':_0xf54e('0x3f')});})[_0xf54e('0x22')](handleError(_0x381c03));};exports[_0xf54e('0x40')]=function(_0x32fb46,_0x3a5a87){logger['info'](_0xf54e('0x41'),_0x32fb46[_0xf54e('0x2f')]);var _0x346bb4=holdValidation[_0xf54e('0x38')](_0x32fb46['body']);if(_0x346bb4[_0xf54e('0x2b')]>0x0){return _0x3a5a87[_0xf54e('0x1a')](0x190)['json'](_0x346bb4);}var _0x22c842=_0x32fb46[_0xf54e('0x2f')][_0xf54e('0x39')];var _0xca0141=_0x32fb46['body'][_0xf54e('0x2a')];return getAgent(_0x22c842)[_0xf54e('0x1e')](function(_0x2527f6){logger[_0xf54e('0x12')](_0xf54e('0x3a'),_0x2527f6[_0xf54e('0x19')]);emit(util[_0xf54e('0x33')](_0xf54e('0x34'),_0x2527f6[_0xf54e('0x19')]),_0xf54e('0x42'),{'sessionId':_0xca0141});return _0x3a5a87[_0xf54e('0x1a')](0xc8)[_0xf54e('0x30')]({'error':![],'message':_0xf54e('0x43')});})[_0xf54e('0x22')](handleError(_0x3a5a87));};exports[_0xf54e('0x44')]=function(_0xa6c305,_0x40d8ab){logger[_0xf54e('0x12')](_0xf54e('0x45'),_0xa6c305[_0xf54e('0x2f')]);var _0x4e25e4=unholdValidation['validate'](_0xa6c305[_0xf54e('0x2f')]);if(_0x4e25e4[_0xf54e('0x2b')]>0x0){return _0x40d8ab[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x4e25e4);}var _0xba297c=_0xa6c305[_0xf54e('0x2f')][_0xf54e('0x39')];var _0x149d0b=_0xa6c305[_0xf54e('0x2f')][_0xf54e('0x2a')];return getAgent(_0xba297c)[_0xf54e('0x1e')](function(_0x59c313){logger[_0xf54e('0x12')](_0xf54e('0x3a'),_0x59c313[_0xf54e('0x19')]);emit(util[_0xf54e('0x33')](_0xf54e('0x34'),_0x59c313[_0xf54e('0x19')]),_0xf54e('0x46'),{'sessionId':_0x149d0b});return _0x40d8ab['status'](0xc8)[_0xf54e('0x30')]({'error':![],'message':_0xf54e('0x47')});})[_0xf54e('0x22')](handleError(_0x40d8ab));};exports['calls']=function(_0x3ce832,_0x54ac1a){logger[_0xf54e('0x12')](_0xf54e('0x48'),_0x54ac1a[_0xf54e('0x2f')]);var _0x5b882f=callsValidation[_0xf54e('0x38')](_0x3ce832[_0xf54e('0x2f')]);if(_0x5b882f[_0xf54e('0x2b')]>0x0){return _0x54ac1a[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x5b882f);}var _0x2ec72a=_0x3ce832[_0xf54e('0x2f')]['userId'];var _0x55de5c=respondWithRpcPromise(_0xf54e('0x26'));var _0x9ab4c4=getAgent(_0x2ec72a);return Promise['all']([_0x55de5c,_0x9ab4c4])[_0xf54e('0x1e')](function(_0x49fd97){var _0xf39552=_0x49fd97[0x0];var _0x528a64=_0x49fd97[0x1];var _0x324167=_[_0xf54e('0x49')](_0xf39552[_0xf54e('0x28')],function(_0x241198){return _0x241198[_0xf54e('0x29')]==_0x528a64['id'];});return _0x54ac1a[_0xf54e('0x1a')](0xc8)['json']({'count':_0x324167['length'],'rows':_0x324167});})[_0xf54e('0x22')](handleError(_0x54ac1a));};exports[_0xf54e('0x4a')]=function(_0x493011,_0x57a48e){logger[_0xf54e('0x12')]('conference\x20fired:',_0x493011[_0xf54e('0x2f')]);var _0x43f9bf=conferenceValidation[_0xf54e('0x38')](_0x493011[_0xf54e('0x2f')]);if(_0x43f9bf[_0xf54e('0x2b')]>0x0){return _0x57a48e[_0xf54e('0x1a')](0x190)[_0xf54e('0x30')](_0x43f9bf);}var _0x3d706a=_0x493011[_0xf54e('0x2f')][_0xf54e('0x39')];return getAgent(_0x3d706a)[_0xf54e('0x1e')](function(_0x2c6d0e){logger[_0xf54e('0x12')](_0xf54e('0x3a'),_0x2c6d0e['name']);emit(util[_0xf54e('0x33')](_0xf54e('0x34'),_0x2c6d0e[_0xf54e('0x19')]),_0xf54e('0x4b'));return _0x57a48e[_0xf54e('0x1a')](0xc8)['json']({'error':![],'message':_0xf54e('0x4c')});})[_0xf54e('0x22')](handleError(_0x57a48e));};exports['transfer']=function(_0x51ec35,_0x2818cf){logger['info'](_0xf54e('0x4d'),_0x51ec35[_0xf54e('0x2f')]);var _0x105cf4=transferValidation[_0xf54e('0x38')](_0x51ec35['body']);if(_0x105cf4[_0xf54e('0x2b')]>0x0){return _0x2818cf['status'](0x190)[_0xf54e('0x30')](_0x105cf4);}var _0x3759d4=_0x51ec35[_0xf54e('0x2f')]['userId'];var _0x2d04db=_0x51ec35['body'][_0xf54e('0x2a')];var _0x3e2101=_0x51ec35['body'][_0xf54e('0x4e')];return getAgent(_0x3759d4)['then'](function(_0x3aa7e5){logger[_0xf54e('0x12')](_0xf54e('0x3a'),_0x3aa7e5[_0xf54e('0x19')]);emit(util[_0xf54e('0x33')]('user:%s',_0x3aa7e5[_0xf54e('0x19')]),_0xf54e('0x4f'),{'sessionId':_0x2d04db,'transferNumber':_0x3e2101});return _0x2818cf['status'](0xc8)[_0xf54e('0x30')]({'error':![],'message':_0xf54e('0x50')});})['catch'](handleError(_0x2818cf));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 59e818a..8952611 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 _0x1ba9=['post','addAnswer','addAgents','addApplications','/:id/notify','/:id/send','send','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications'];(function(_0x430459,_0x58519c){var _0x3a2439=function(_0x27a0b3){while(--_0x27a0b3){_0x430459['push'](_0x430459['shift']());}};_0x3a2439(++_0x58519c);}(_0x1ba9,0x190));var _0x91ba=function(_0x3ebc3b,_0x2b2394){_0x3ebc3b=_0x3ebc3b-0x0;var _0x4498fc=_0x1ba9[_0x3ebc3b];return _0x4498fc;};'use strict';var multer=require(_0x91ba('0x0'));var util=require(_0x91ba('0x1'));var path=require(_0x91ba('0x2'));var timeout=require('connect-timeout');var express=require(_0x91ba('0x3'));var router=express['Router']();var fs_extra=require(_0x91ba('0x4'));var auth=require(_0x91ba('0x5'));var interaction=require(_0x91ba('0x6'));var config=require('../../config/environment');var controller=require(_0x91ba('0x7'));router[_0x91ba('0x8')]('/',auth[_0x91ba('0x9')](),controller[_0x91ba('0xa')]);router['get']('/describe',auth[_0x91ba('0x9')](),controller[_0x91ba('0xb')]);router[_0x91ba('0x8')](_0x91ba('0xc'),auth[_0x91ba('0x9')](),controller[_0x91ba('0xd')]);router[_0x91ba('0x8')]('/:id/dispositions',auth[_0x91ba('0x9')](),controller[_0x91ba('0xe')]);router[_0x91ba('0x8')](_0x91ba('0xf'),auth[_0x91ba('0x9')](),controller[_0x91ba('0x10')]);router[_0x91ba('0x8')](_0x91ba('0x11'),auth['isAuthenticated'](),controller['getAgents']);router[_0x91ba('0x8')](_0x91ba('0x12'),auth[_0x91ba('0x9')](),controller[_0x91ba('0x13')]);router[_0x91ba('0x14')]('/',auth[_0x91ba('0x9')](),controller['create']);router[_0x91ba('0x14')]('/:id/dispositions',auth[_0x91ba('0x9')](),controller['addDisposition']);router['post'](_0x91ba('0xf'),auth[_0x91ba('0x9')](),controller[_0x91ba('0x15')]);router[_0x91ba('0x14')](_0x91ba('0x11'),auth['isAuthenticated'](),controller[_0x91ba('0x16')]);router['post'](_0x91ba('0x12'),auth[_0x91ba('0x9')](),controller[_0x91ba('0x17')]);router['post'](_0x91ba('0x18'),controller['notify']);router[_0x91ba('0x14')](_0x91ba('0x19'),auth['isAuthenticated'](),controller[_0x91ba('0x1a')]);router['put'](_0x91ba('0xc'),auth[_0x91ba('0x9')](),controller[_0x91ba('0x1b')]);router[_0x91ba('0x1c')](_0x91ba('0xc'),auth[_0x91ba('0x9')](),controller[_0x91ba('0x1d')]);router[_0x91ba('0x1c')](_0x91ba('0x1e'),auth[_0x91ba('0x9')](),controller[_0x91ba('0x1f')]);router[_0x91ba('0x1c')](_0x91ba('0xf'),auth[_0x91ba('0x9')](),controller[_0x91ba('0x20')]);router[_0x91ba('0x1c')](_0x91ba('0x11'),auth[_0x91ba('0x9')](),controller[_0x91ba('0x21')]);module[_0x91ba('0x22')]=router; \ No newline at end of file +var _0xf343=['notify','/:id/send','send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','create','addAnswer','/:id/users','addAgents','addApplications','/:id/notify'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xf343,0x171));var _0x3f34=function(_0x482ca8,_0x4a68cd){_0x482ca8=_0x482ca8-0x0;var _0x24f233=_0xf343[_0x482ca8];return _0x24f233;};'use strict';var multer=require(_0x3f34('0x0'));var util=require(_0x3f34('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3f34('0x2')]();var fs_extra=require(_0x3f34('0x3'));var auth=require(_0x3f34('0x4'));var interaction=require(_0x3f34('0x5'));var config=require('../../config/environment');var controller=require(_0x3f34('0x6'));router[_0x3f34('0x7')]('/',auth[_0x3f34('0x8')](),controller['index']);router[_0x3f34('0x7')](_0x3f34('0x9'),auth[_0x3f34('0x8')](),controller[_0x3f34('0xa')]);router[_0x3f34('0x7')](_0x3f34('0xb'),auth[_0x3f34('0x8')](),controller[_0x3f34('0xc')]);router[_0x3f34('0x7')](_0x3f34('0xd'),auth[_0x3f34('0x8')](),controller[_0x3f34('0xe')]);router[_0x3f34('0x7')](_0x3f34('0xf'),auth[_0x3f34('0x8')](),controller[_0x3f34('0x10')]);router[_0x3f34('0x7')]('/:id/users',auth[_0x3f34('0x8')](),controller[_0x3f34('0x11')]);router[_0x3f34('0x7')](_0x3f34('0x12'),auth[_0x3f34('0x8')](),controller[_0x3f34('0x13')]);router[_0x3f34('0x14')]('/',auth[_0x3f34('0x8')](),controller[_0x3f34('0x15')]);router[_0x3f34('0x14')](_0x3f34('0xd'),auth[_0x3f34('0x8')](),controller['addDisposition']);router[_0x3f34('0x14')](_0x3f34('0xf'),auth[_0x3f34('0x8')](),controller[_0x3f34('0x16')]);router[_0x3f34('0x14')](_0x3f34('0x17'),auth['isAuthenticated'](),controller[_0x3f34('0x18')]);router[_0x3f34('0x14')](_0x3f34('0x12'),auth[_0x3f34('0x8')](),controller[_0x3f34('0x19')]);router['post'](_0x3f34('0x1a'),controller[_0x3f34('0x1b')]);router[_0x3f34('0x14')](_0x3f34('0x1c'),auth['isAuthenticated'](),controller[_0x3f34('0x1d')]);router['put'](_0x3f34('0xb'),auth[_0x3f34('0x8')](),controller[_0x3f34('0x1e')]);router[_0x3f34('0x1f')](_0x3f34('0xb'),auth[_0x3f34('0x8')](),controller[_0x3f34('0x20')]);router['delete'](_0x3f34('0xd'),auth[_0x3f34('0x8')](),controller[_0x3f34('0x21')]);router[_0x3f34('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3f34('0x22')]);router[_0x3f34('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x3f34('0x23')]);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 5695b36..b54588c 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 _0x50ee=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','generate','ENUM','twilio','sinch','TEXT'];(function(_0x3fbf3d,_0x3a80f4){var _0x2ff7a8=function(_0x285f94){while(--_0x285f94){_0x3fbf3d['push'](_0x3fbf3d['shift']());}};_0x2ff7a8(++_0x3a80f4);}(_0x50ee,0xe6));var _0xe50e=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0x50ee[_0x546aaf];return _0x1cbf6d;};'use strict';var Sequelize=require(_0xe50e('0x0'));var rs=require(_0xe50e('0x1'));module['exports']={'name':{'type':Sequelize[_0xe50e('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xe50e('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xe50e('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xe50e('0x2')],'defaultValue':function(){return rs[_0xe50e('0x3')]();}},'phone':{'type':Sequelize[_0xe50e('0x2')]},'type':{'type':Sequelize[_0xe50e('0x4')](_0xe50e('0x5'),_0xe50e('0x6'))},'accountSid':{'type':Sequelize[_0xe50e('0x2')]},'baseUrl':{'type':Sequelize[_0xe50e('0x2')]},'authToken':{'type':Sequelize[_0xe50e('0x2')]},'notificationTemplate':{'type':Sequelize[_0xe50e('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe50e('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xe50e('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe50e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe50e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe50e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe50e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe50e('0x9')],'comment':_0xe50e('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4ce069){if(!_0x4ce069){this['setDataValue'](_0xe50e('0xb'),null);}this[_0xe50e('0xc')](_0xe50e('0xd'),_0x4ce069);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9979=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','TEXT'];(function(_0x3f5bbb,_0x217812){var _0x3b67c8=function(_0x39e308){while(--_0x39e308){_0x3f5bbb['push'](_0x3f5bbb['shift']());}};_0x3b67c8(++_0x217812);}(_0x9979,0x166));var _0x9997=function(_0x3f807d,_0x32a3b1){_0x3f807d=_0x3f807d-0x0;var _0x45ad62=_0x9979[_0x3f807d];return _0x45ad62;};'use strict';var Sequelize=require(_0x9997('0x0'));var rs=require(_0x9997('0x1'));module[_0x9997('0x2')]={'name':{'type':Sequelize[_0x9997('0x3')],'unique':_0x9997('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x9997('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x9997('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x9997('0x3')]},'type':{'type':Sequelize['ENUM']('twilio','sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x9997('0x3')]},'authToken':{'type':Sequelize[_0x9997('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9997('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9997('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9997('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9997('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9997('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9997('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9997('0x7')],'comment':_0x9997('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x9997('0x6')],'defaultValue':![],'comment':_0x9997('0x9'),'set':function(_0x4bb08b){if(!_0x4bb08b){this[_0x9997('0xa')](_0x9997('0xb'),null);}this[_0x9997('0xa')](_0x9997('0xc'),_0x4bb08b);}},'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 4d601c5..250615e 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 _0x4fad=['out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','get','UserProfileResource','destroy','then','stack','name','send','mandatoryDispositionPause','map','WhatsappAccount','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','findAll','rows','catch','show','params','Pause','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','userProfileId','update','describe','addDisposition','getDispositions','findOne','Disposition','filter','options','removeDispositions','addAnswer','WhatsappAccountId','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','getApplications','whatsapp','Applications','account','sinch','statuses','read','WhatsappMessage','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','DESC','Contacts','contact','WhatsappInteraction','interaction','created','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','List','ListId'];(function(_0x2d7def,_0x4afd93){var _0x3ee2d9=function(_0x3ebff9){while(--_0x3ebff9){_0x2d7def['push'](_0x2d7def['shift']());}};_0x3ee2d9(++_0x4afd93);}(_0x4fad,0xcb));var _0xd4fa=function(_0x46b021,_0x1c8533){_0x46b021=_0x46b021-0x0;var _0x45597a=_0x4fad[_0x46b021];return _0x45597a;};'use strict';var emlformat=require(_0xd4fa('0x0'));var rimraf=require(_0xd4fa('0x1'));var zipdir=require(_0xd4fa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd4fa('0x3'));var moment=require(_0xd4fa('0x4'));var BPromise=require(_0xd4fa('0x5'));var Mustache=require(_0xd4fa('0x6'));var util=require(_0xd4fa('0x7'));var path=require(_0xd4fa('0x8'));var sox=require(_0xd4fa('0x9'));var csv=require(_0xd4fa('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4fa('0xb'));var _=require('lodash');var squel=require(_0xd4fa('0xc'));var crypto=require(_0xd4fa('0xd'));var jsforce=require(_0xd4fa('0xe'));var deskjs=require(_0xd4fa('0xf'));var toCsv=require(_0xd4fa('0xa'));var querystring=require('querystring');var Papa=require(_0xd4fa('0x10'));var Redis=require(_0xd4fa('0x11'));var authService=require(_0xd4fa('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd4fa('0x13'));var hardwareService=require(_0xd4fa('0x14'));var logger=require(_0xd4fa('0x15'))(_0xd4fa('0x16'));var utils=require('../../config/utils');var config=require(_0xd4fa('0x17'));var licenseUtil=require(_0xd4fa('0x18'));var db=require(_0xd4fa('0x19'))['db'];config['redis']=_[_0xd4fa('0x1a')](config[_0xd4fa('0x1b')],{'host':_0xd4fa('0x1c'),'port':0x18eb});var socket=require(_0xd4fa('0x1d'))(new Redis(config[_0xd4fa('0x1b')]));require(_0xd4fa('0x1e'))['register'](socket);var jayson=require(_0xd4fa('0x1f'));var client=jayson[_0xd4fa('0x20')][_0xd4fa('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x2e267a,_0x42af5a,_0x28c589,_0xa8bb45){return new BPromise(function(_0x49c0c6,_0x37bc80){var _0x3a3b8c=_0xa8bb45||client;return _0x3a3b8c[_0xd4fa('0x22')](_0x2e267a,_0x28c589)['then'](function(_0x5f48d5){logger[_0xd4fa('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x42af5a,'request\x20sent');logger[_0xd4fa('0x24')](_0xd4fa('0x25'),_0x42af5a,_0xd4fa('0x26'),JSON[_0xd4fa('0x27')](_0x5f48d5));if(_0x5f48d5['error']){if(_0x5f48d5[_0xd4fa('0x28')][_0xd4fa('0x29')]===0x1f4){logger['error'](_0xd4fa('0x2a'),_0x42af5a,_0x5f48d5['error']['message']);return _0x37bc80(_0x5f48d5[_0xd4fa('0x28')][_0xd4fa('0x2b')]);}logger[_0xd4fa('0x28')](_0xd4fa('0x2a'),_0x42af5a,_0x5f48d5['error'][_0xd4fa('0x2b')]);return _0x49c0c6(_0x5f48d5[_0xd4fa('0x28')][_0xd4fa('0x2b')]);}else{logger[_0xd4fa('0x23')](_0xd4fa('0x2a'),_0x42af5a,'request\x20sent');_0x49c0c6(_0x5f48d5[_0xd4fa('0x2c')][_0xd4fa('0x2b')]);}})['catch'](function(_0x162459){logger[_0xd4fa('0x28')](_0xd4fa('0x2a'),_0x42af5a,_0x162459);_0x37bc80(_0x162459);});});}function respondWithStatusCode(_0x1f7b50,_0x2d68ca){_0x2d68ca=_0x2d68ca||0xcc;return function(_0x393ff9){if(_0x393ff9){return _0x1f7b50[_0xd4fa('0x2d')](_0x2d68ca);}return _0x1f7b50[_0xd4fa('0x2e')](_0x2d68ca)[_0xd4fa('0x2f')]();};}function respondWithResult(_0x5538e0,_0x17bdbf){_0x17bdbf=_0x17bdbf||0xc8;return function(_0x499eda){if(_0x499eda){return _0x5538e0[_0xd4fa('0x2e')](_0x17bdbf)[_0xd4fa('0x30')](_0x499eda);}};}function respondWithFilteredResult(_0x59446d,_0x35c4bd){return function(_0x41aa35){if(_0x41aa35){var _0x1b16ba=typeof _0x35c4bd['offset']===_0xd4fa('0x31')&&typeof _0x35c4bd[_0xd4fa('0x32')]==='undefined';var _0x182406=_0x41aa35[_0xd4fa('0x33')];var _0x5455a2=_0x1b16ba?0x0:_0x35c4bd[_0xd4fa('0x34')];var _0x21a96b=_0x1b16ba?_0x41aa35[_0xd4fa('0x33')]:_0x35c4bd[_0xd4fa('0x34')]+_0x35c4bd[_0xd4fa('0x32')];var _0x32bfb5;if(_0x21a96b>=_0x182406){_0x21a96b=_0x182406;_0x32bfb5=0xc8;}else{_0x32bfb5=0xce;}_0x59446d[_0xd4fa('0x2e')](_0x32bfb5);return _0x59446d[_0xd4fa('0x35')]('Content-Range',_0x5455a2+'-'+_0x21a96b+'/'+_0x182406)[_0xd4fa('0x30')](_0x41aa35);}return null;};}function patchUpdates(_0x1ba5a8){return function(_0x3f136e){try{jsonpatch[_0xd4fa('0x36')](_0x3f136e,_0x1ba5a8,!![]);}catch(_0x5a5782){return BPromise[_0xd4fa('0x37')](_0x5a5782);}return _0x3f136e[_0xd4fa('0x38')]();};}function saveUpdates(_0xca68d7,_0x3ac2a7){return function(_0x55471d){if(_0x55471d){return _0x55471d['update'](_0xca68d7)['then'](function(_0x5de7eb){return _0x5de7eb;});}return null;};}function removeEntity(_0x11fce1,_0x433b17){return function(_0x5a7912){if(_0x5a7912){return _0x5a7912['destroy']()['then'](function(){var _0x50c804=_0x5a7912[_0xd4fa('0x39')]({'plain':!![]});var _0x375125='WhatsappAccounts';return db[_0xd4fa('0x3a')][_0xd4fa('0x3b')]({'where':{'type':_0x375125,'resourceId':_0x50c804['id']}})['then'](function(){return _0x5a7912;});})[_0xd4fa('0x3c')](function(){_0x11fce1['status'](0xcc)[_0xd4fa('0x2f')]();});}};}function handleEntityNotFound(_0x4c6e1a,_0x10e4fc){return function(_0x85ba6b){if(!_0x85ba6b){_0x4c6e1a[_0xd4fa('0x2d')](0x194);}return _0x85ba6b;};}function handleError(_0x35b45c,_0x2bd9f0){_0x2bd9f0=_0x2bd9f0||0x1f4;return function(_0x54612c){logger[_0xd4fa('0x28')](_0x54612c[_0xd4fa('0x3d')]);if(_0x54612c[_0xd4fa('0x3e')]){delete _0x54612c[_0xd4fa('0x3e')];}_0x35b45c[_0xd4fa('0x2e')](_0x2bd9f0)[_0xd4fa('0x3f')](_0x54612c);};}exports['index']=function(_0x30e083,_0x9d5b3f){var _0x36f485={'include':[{'model':db['Pause'],'as':_0xd4fa('0x40')}]},_0x2766ca={},_0x40fb31={'count':0x0,'rows':[]};var _0x4a039e=_[_0xd4fa('0x41')](db[_0xd4fa('0x42')]['rawAttributes'],function(_0x550f4f){return{'name':_0x550f4f['fieldName'],'type':_0x550f4f[_0xd4fa('0x43')][_0xd4fa('0x44')]};});_0x2766ca[_0xd4fa('0x45')]=_['map'](_0x4a039e,_0xd4fa('0x3e'));_0x2766ca[_0xd4fa('0x46')]=_[_0xd4fa('0x47')](_0x30e083[_0xd4fa('0x46')]);_0x2766ca['filters']=_['intersection'](_0x2766ca[_0xd4fa('0x45')],_0x2766ca[_0xd4fa('0x46')]);_0x36f485[_0xd4fa('0x48')]=_[_0xd4fa('0x49')](_0x2766ca[_0xd4fa('0x45')],qs['fields'](_0x30e083[_0xd4fa('0x46')][_0xd4fa('0x4a')]));_0x36f485[_0xd4fa('0x48')]=_0x36f485[_0xd4fa('0x48')][_0xd4fa('0x4b')]?_0x36f485[_0xd4fa('0x48')]:_0x2766ca[_0xd4fa('0x45')];if(!_0x30e083['query'][_0xd4fa('0x4c')](_0xd4fa('0x4d'))){_0x36f485[_0xd4fa('0x32')]=qs[_0xd4fa('0x32')](_0x30e083['query'][_0xd4fa('0x32')]);_0x36f485[_0xd4fa('0x34')]=qs[_0xd4fa('0x34')](_0x30e083[_0xd4fa('0x46')][_0xd4fa('0x34')]);}_0x36f485[_0xd4fa('0x4e')]=qs[_0xd4fa('0x4f')](_0x30e083[_0xd4fa('0x46')][_0xd4fa('0x4f')]);_0x36f485[_0xd4fa('0x50')]=qs[_0xd4fa('0x51')](_[_0xd4fa('0x52')](_0x30e083[_0xd4fa('0x46')],_0x2766ca[_0xd4fa('0x51')]),_0x4a039e);if(_0x30e083[_0xd4fa('0x46')]['filter']){_0x36f485[_0xd4fa('0x50')]=_[_0xd4fa('0x53')](_0x36f485[_0xd4fa('0x50')],{'$or':_['map'](_0x4a039e,function(_0x1bf551){if(_0x1bf551[_0xd4fa('0x43')]!==_0xd4fa('0x54')){var _0x48fdca={};_0x48fdca[_0x1bf551['name']]={'$like':'%'+_0x30e083[_0xd4fa('0x46')]['filter']+'%'};return _0x48fdca;}})});}_0x36f485=_[_0xd4fa('0x53')]({},_0x36f485,_0x30e083['options']);var _0x105120={'where':_0x36f485['where']};return db[_0xd4fa('0x42')][_0xd4fa('0x33')](_0x105120)[_0xd4fa('0x3c')](function(_0x30773e){_0x40fb31[_0xd4fa('0x33')]=_0x30773e;if(_0x30e083[_0xd4fa('0x46')]['includeAll']){_0x36f485['include']=[{'all':!![]}];}return db[_0xd4fa('0x42')][_0xd4fa('0x55')](_0x36f485);})[_0xd4fa('0x3c')](function(_0x220c81){_0x40fb31[_0xd4fa('0x56')]=_0x220c81;return _0x40fb31;})[_0xd4fa('0x3c')](respondWithFilteredResult(_0x9d5b3f,_0x36f485))[_0xd4fa('0x57')](handleError(_0x9d5b3f,null));};exports[_0xd4fa('0x58')]=function(_0x59da9b,_0x1dfe77){var _0x3ac60b={'raw':![],'where':{'id':_0x59da9b[_0xd4fa('0x59')]['id']},'include':[{'model':db[_0xd4fa('0x5a')],'as':_0xd4fa('0x40')}]},_0x44c028={};_0x44c028[_0xd4fa('0x45')]=_[_0xd4fa('0x47')](db[_0xd4fa('0x42')][_0xd4fa('0x5b')]);_0x44c028['query']=_['keys'](_0x59da9b[_0xd4fa('0x46')]);_0x44c028[_0xd4fa('0x51')]=_['intersection'](_0x44c028[_0xd4fa('0x45')],_0x44c028[_0xd4fa('0x46')]);_0x3ac60b[_0xd4fa('0x48')]=_['intersection'](_0x44c028['model'],qs[_0xd4fa('0x4a')](_0x59da9b[_0xd4fa('0x46')][_0xd4fa('0x4a')]));_0x3ac60b[_0xd4fa('0x48')]=_0x3ac60b[_0xd4fa('0x48')][_0xd4fa('0x4b')]?_0x3ac60b[_0xd4fa('0x48')]:_0x44c028['model'];if(_0x59da9b[_0xd4fa('0x46')][_0xd4fa('0x5c')]){_0x3ac60b[_0xd4fa('0x5d')]=[{'all':!![]}];}_0x3ac60b=_[_0xd4fa('0x53')]({},_0x3ac60b,_0x59da9b['options']);return db[_0xd4fa('0x42')][_0xd4fa('0x5e')](_0x3ac60b)[_0xd4fa('0x3c')](handleEntityNotFound(_0x1dfe77,null))[_0xd4fa('0x3c')](respondWithResult(_0x1dfe77,null))[_0xd4fa('0x57')](handleError(_0x1dfe77,null));};exports[_0xd4fa('0x5f')]=function(_0x1c8c5d,_0x20c705){return db['WhatsappAccount']['create'](_0x1c8c5d[_0xd4fa('0x60')],{})[_0xd4fa('0x3c')](function(_0x2d79cb){var _0x3f4f97=_0x1c8c5d[_0xd4fa('0x61')][_0xd4fa('0x39')]({'plain':!![]});if(!_0x3f4f97)throw new Error(_0xd4fa('0x62'));if(_0x3f4f97[_0xd4fa('0x63')]===_0xd4fa('0x61')){var _0x2ee6e5=_0x2d79cb[_0xd4fa('0x39')]({'plain':!![]});var _0x2225cf=_0xd4fa('0x64');return db['UserProfileSection']['find']({'where':{'name':_0x2225cf,'userProfileId':_0x3f4f97[_0xd4fa('0x65')]},'raw':!![]})['then'](function(_0x3317b3){if(_0x3317b3&&_0x3317b3['autoAssociation']===0x0){return db[_0xd4fa('0x3a')][_0xd4fa('0x5f')]({'name':_0x2ee6e5[_0xd4fa('0x3e')],'resourceId':_0x2ee6e5['id'],'type':_0x3317b3['name'],'sectionId':_0x3317b3['id']},{})[_0xd4fa('0x3c')](function(){return _0x2d79cb;});}else{return _0x2d79cb;}})[_0xd4fa('0x57')](function(_0x415d2f){logger[_0xd4fa('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x415d2f);throw _0x415d2f;});}return _0x2d79cb;})[_0xd4fa('0x3c')](respondWithResult(_0x20c705,0xc9))['catch'](handleError(_0x20c705,null));};exports[_0xd4fa('0x66')]=function(_0x42bd69,_0x4454c7){if(_0x42bd69[_0xd4fa('0x60')]['id']){delete _0x42bd69[_0xd4fa('0x60')]['id'];}return db[_0xd4fa('0x42')][_0xd4fa('0x5e')]({'where':{'id':_0x42bd69['params']['id']},'include':[{'model':db[_0xd4fa('0x5a')],'as':_0xd4fa('0x40')}]})['then'](handleEntityNotFound(_0x4454c7,null))[_0xd4fa('0x3c')](saveUpdates(_0x42bd69['body'],null))[_0xd4fa('0x3c')](respondWithResult(_0x4454c7,null))['catch'](handleError(_0x4454c7,null));};exports[_0xd4fa('0x3b')]=function(_0x21e57f,_0x3d098a){return db[_0xd4fa('0x42')][_0xd4fa('0x5e')]({'where':{'id':_0x21e57f['params']['id']}})[_0xd4fa('0x3c')](handleEntityNotFound(_0x3d098a,null))[_0xd4fa('0x3c')](removeEntity(_0x3d098a,null))[_0xd4fa('0x57')](handleError(_0x3d098a,null));};exports[_0xd4fa('0x67')]=function(_0x56dae7,_0x917628){return db[_0xd4fa('0x42')][_0xd4fa('0x67')]()[_0xd4fa('0x3c')](respondWithResult(_0x917628,null))[_0xd4fa('0x57')](handleError(_0x917628,null));};exports[_0xd4fa('0x68')]=function(_0x213be3,_0x446986,_0x2d7a9b){if(_0x213be3[_0xd4fa('0x60')]['id']){delete _0x213be3[_0xd4fa('0x60')]['id'];}return db[_0xd4fa('0x42')]['find']({'where':{'id':_0x213be3['params']['id']}})[_0xd4fa('0x3c')](handleEntityNotFound(_0x446986,null))[_0xd4fa('0x3c')](function(_0x50fbc0){if(_0x50fbc0){_0x213be3[_0xd4fa('0x60')]['WhatsappAccountId']=_0x50fbc0['id'];return db['Disposition'][_0xd4fa('0x5f')](_0x213be3['body']);}})[_0xd4fa('0x3c')](respondWithResult(_0x446986,null))[_0xd4fa('0x57')](handleError(_0x446986,null));};exports[_0xd4fa('0x69')]=function(_0x19ff9e,_0x2eb2f7,_0x2e7907){var _0xa13dc9={'raw':![],'where':{}};var _0xbc3afa={};var _0x475882={'count':0x0,'rows':[]};return db[_0xd4fa('0x42')][_0xd4fa('0x6a')]({'where':{'id':_0x19ff9e[_0xd4fa('0x59')]['id']}})[_0xd4fa('0x3c')](handleEntityNotFound(_0x2eb2f7,null))[_0xd4fa('0x3c')](function(_0x1e1296){if(_0x1e1296){_0xbc3afa[_0xd4fa('0x45')]=_['keys'](db[_0xd4fa('0x6b')]['rawAttributes']);_0xbc3afa[_0xd4fa('0x46')]=_['keys'](_0x19ff9e['query']);_0xbc3afa[_0xd4fa('0x51')]=_[_0xd4fa('0x49')](_0xbc3afa[_0xd4fa('0x45')],_0xbc3afa[_0xd4fa('0x46')]);_0xa13dc9[_0xd4fa('0x48')]=_[_0xd4fa('0x49')](_0xbc3afa[_0xd4fa('0x45')],qs[_0xd4fa('0x4a')](_0x19ff9e[_0xd4fa('0x46')][_0xd4fa('0x4a')]));_0xa13dc9[_0xd4fa('0x48')]=_0xa13dc9[_0xd4fa('0x48')][_0xd4fa('0x4b')]?_0xa13dc9[_0xd4fa('0x48')]:_0xbc3afa[_0xd4fa('0x45')];if(!_0x19ff9e[_0xd4fa('0x46')][_0xd4fa('0x4c')](_0xd4fa('0x4d'))){_0xa13dc9[_0xd4fa('0x32')]=qs[_0xd4fa('0x32')](_0x19ff9e[_0xd4fa('0x46')]['limit']);_0xa13dc9['offset']=qs[_0xd4fa('0x34')](_0x19ff9e['query'][_0xd4fa('0x34')]);}_0xa13dc9['order']=qs[_0xd4fa('0x4f')](_0x19ff9e[_0xd4fa('0x46')][_0xd4fa('0x4f')]);_0xa13dc9[_0xd4fa('0x50')]=qs['filters'](_['pick'](_0x19ff9e[_0xd4fa('0x46')],_0xbc3afa[_0xd4fa('0x51')]));_0xa13dc9['where']['WhatsappAccountId']=_0x1e1296['id'];if(_0x19ff9e[_0xd4fa('0x46')]['filter']){_0xa13dc9[_0xd4fa('0x50')]=_[_0xd4fa('0x53')](_0xa13dc9[_0xd4fa('0x50')],{'$or':_[_0xd4fa('0x41')](_0xa13dc9[_0xd4fa('0x48')],function(_0x591965){var _0x4fe91a={};_0x4fe91a[_0x591965]={'$like':'%'+_0x19ff9e[_0xd4fa('0x46')][_0xd4fa('0x6c')]+'%'};return _0x4fe91a;})});}_0xa13dc9=_[_0xd4fa('0x53')]({},_0xa13dc9,_0x19ff9e[_0xd4fa('0x6d')]);return db['Disposition'][_0xd4fa('0x33')]({'where':_0xa13dc9[_0xd4fa('0x50')]})['then'](function(_0x47bc81){_0x475882[_0xd4fa('0x33')]=_0x47bc81;if(_0x19ff9e['query'][_0xd4fa('0x5c')]){_0xa13dc9[_0xd4fa('0x5d')]=[{'all':!![]}];}return db[_0xd4fa('0x6b')][_0xd4fa('0x55')](_0xa13dc9);})[_0xd4fa('0x3c')](function(_0x1daf92){_0x475882[_0xd4fa('0x56')]=_0x1daf92;return _0x475882;});}})['then'](respondWithFilteredResult(_0x2eb2f7,_0xa13dc9))['catch'](handleError(_0x2eb2f7,null));};exports['removeDispositions']=function(_0x2308c4,_0x1a2c67,_0x111c2d){return db[_0xd4fa('0x42')][_0xd4fa('0x5e')]({'where':{'id':_0x2308c4[_0xd4fa('0x59')]['id']}})['then'](handleEntityNotFound(_0x1a2c67,null))[_0xd4fa('0x3c')](function(_0x15cab5){if(_0x15cab5){return _0x15cab5[_0xd4fa('0x6e')](_0x2308c4[_0xd4fa('0x46')]['ids']);}})[_0xd4fa('0x3c')](respondWithStatusCode(_0x1a2c67,null))[_0xd4fa('0x57')](handleError(_0x1a2c67,null));};exports[_0xd4fa('0x6f')]=function(_0x26c775,_0x14e0b2,_0x462a34){if(_0x26c775[_0xd4fa('0x60')]['id']){delete _0x26c775['body']['id'];}return db[_0xd4fa('0x42')][_0xd4fa('0x5e')]({'where':{'id':_0x26c775[_0xd4fa('0x59')]['id']}})[_0xd4fa('0x3c')](handleEntityNotFound(_0x14e0b2,null))[_0xd4fa('0x3c')](function(_0x34e0ee){if(_0x34e0ee){_0x26c775[_0xd4fa('0x60')][_0xd4fa('0x70')]=_0x34e0ee['id'];return db[_0xd4fa('0x71')]['create'](_0x26c775['body']);}})[_0xd4fa('0x3c')](respondWithResult(_0x14e0b2,null))[_0xd4fa('0x57')](handleError(_0x14e0b2,null));};exports[_0xd4fa('0x72')]=function(_0x16fc8c,_0x2d7580,_0x270ad5){var _0x2e5580={'raw':![],'where':{}};var _0x8736c3={};var _0x5e3a7a={'count':0x0,'rows':[]};return db[_0xd4fa('0x42')][_0xd4fa('0x6a')]({'where':{'id':_0x16fc8c[_0xd4fa('0x59')]['id']}})['then'](handleEntityNotFound(_0x2d7580,null))[_0xd4fa('0x3c')](function(_0x56d83d){if(_0x56d83d){_0x8736c3[_0xd4fa('0x45')]=_[_0xd4fa('0x47')](db[_0xd4fa('0x71')][_0xd4fa('0x5b')]);_0x8736c3['query']=_['keys'](_0x16fc8c[_0xd4fa('0x46')]);_0x8736c3[_0xd4fa('0x51')]=_['intersection'](_0x8736c3[_0xd4fa('0x45')],_0x8736c3[_0xd4fa('0x46')]);_0x2e5580[_0xd4fa('0x48')]=_[_0xd4fa('0x49')](_0x8736c3['model'],qs[_0xd4fa('0x4a')](_0x16fc8c[_0xd4fa('0x46')][_0xd4fa('0x4a')]));_0x2e5580[_0xd4fa('0x48')]=_0x2e5580[_0xd4fa('0x48')]['length']?_0x2e5580['attributes']:_0x8736c3[_0xd4fa('0x45')];if(!_0x16fc8c[_0xd4fa('0x46')][_0xd4fa('0x4c')](_0xd4fa('0x4d'))){_0x2e5580[_0xd4fa('0x32')]=qs['limit'](_0x16fc8c['query']['limit']);_0x2e5580[_0xd4fa('0x34')]=qs[_0xd4fa('0x34')](_0x16fc8c[_0xd4fa('0x46')][_0xd4fa('0x34')]);}_0x2e5580[_0xd4fa('0x4e')]=qs['sort'](_0x16fc8c[_0xd4fa('0x46')][_0xd4fa('0x4f')]);_0x2e5580['where']=qs['filters'](_['pick'](_0x16fc8c['query'],_0x8736c3[_0xd4fa('0x51')]));_0x2e5580['where'][_0xd4fa('0x70')]=_0x56d83d['id'];if(_0x16fc8c[_0xd4fa('0x46')][_0xd4fa('0x6c')]){_0x2e5580[_0xd4fa('0x50')]=_['merge'](_0x2e5580['where'],{'$or':_[_0xd4fa('0x41')](_0x2e5580[_0xd4fa('0x48')],function(_0x432738){var _0x4c397c={};_0x4c397c[_0x432738]={'$like':'%'+_0x16fc8c['query']['filter']+'%'};return _0x4c397c;})});}_0x2e5580=_[_0xd4fa('0x53')]({},_0x2e5580,_0x16fc8c[_0xd4fa('0x6d')]);return db[_0xd4fa('0x71')]['count']({'where':_0x2e5580[_0xd4fa('0x50')]})[_0xd4fa('0x3c')](function(_0x5c6b1d){_0x5e3a7a[_0xd4fa('0x33')]=_0x5c6b1d;if(_0x16fc8c['query'][_0xd4fa('0x5c')]){_0x2e5580[_0xd4fa('0x5d')]=[{'all':!![]}];}return db[_0xd4fa('0x71')][_0xd4fa('0x55')](_0x2e5580);})[_0xd4fa('0x3c')](function(_0xf210a5){_0x5e3a7a[_0xd4fa('0x56')]=_0xf210a5;return _0x5e3a7a;});}})[_0xd4fa('0x3c')](respondWithFilteredResult(_0x2d7580,_0x2e5580))[_0xd4fa('0x57')](handleError(_0x2d7580,null));};exports[_0xd4fa('0x73')]=function(_0x4095ab,_0x4674d5,_0x51af3f){return db['WhatsappAccount'][_0xd4fa('0x5e')]({'where':{'id':_0x4095ab[_0xd4fa('0x59')]['id']}})['then'](handleEntityNotFound(_0x4674d5,null))[_0xd4fa('0x3c')](function(_0x39d584){if(_0x39d584){return _0x39d584[_0xd4fa('0x73')](_0x4095ab[_0xd4fa('0x46')][_0xd4fa('0x74')]);}})[_0xd4fa('0x3c')](respondWithStatusCode(_0x4674d5,null))['catch'](handleError(_0x4674d5,null));};exports[_0xd4fa('0x75')]=function(_0x311282,_0x489306,_0x514913){return db[_0xd4fa('0x42')][_0xd4fa('0x5e')]({'where':{'id':_0x311282['params']['id']}})[_0xd4fa('0x3c')](handleEntityNotFound(_0x489306,null))['then'](function(_0x1366aa){if(_0x1366aa){return _0x1366aa[_0xd4fa('0x75')](_0x311282[_0xd4fa('0x60')][_0xd4fa('0x74')],_[_0xd4fa('0x76')](_0x311282[_0xd4fa('0x60')],['ids','id'])||{})[_0xd4fa('0x77')](function(_0x3e88eb){for(var _0x5bc171=0x0;_0x5bc171<_0x311282[_0xd4fa('0x60')]['ids'][_0xd4fa('0x4b')];_0x5bc171+=0x1){socket[_0xd4fa('0x78')]('userWhatsappAccount:save',{'UserId':Number(_0x311282[_0xd4fa('0x60')][_0xd4fa('0x74')][_0x5bc171]),'WhatsappAccountId':Number(_0x311282['params']['id'])});}return _0x3e88eb;});}})[_0xd4fa('0x3c')](respondWithResult(_0x489306,null))['catch'](handleError(_0x489306,null));};exports[_0xd4fa('0x79')]=function(_0x17aede,_0x1f74b6,_0x579898){return db[_0xd4fa('0x42')][_0xd4fa('0x5e')]({'where':{'id':_0x17aede[_0xd4fa('0x59')]['id']}})['then'](handleEntityNotFound(_0x1f74b6,null))[_0xd4fa('0x3c')](function(_0x145f38){if(_0x145f38){return _0x145f38[_0xd4fa('0x79')](_0x17aede[_0xd4fa('0x46')][_0xd4fa('0x74')])[_0xd4fa('0x3c')](function(){if(_[_0xd4fa('0x7a')](_0x17aede['query'][_0xd4fa('0x74')])){for(var _0x400edd=0x0;_0x400edd<_0x17aede['query'][_0xd4fa('0x74')][_0xd4fa('0x4b')];_0x400edd+=0x1){socket[_0xd4fa('0x78')]('userWhatsappAccount:remove',{'UserId':Number(_0x17aede[_0xd4fa('0x46')][_0xd4fa('0x74')][_0x400edd]),'WhatsappAccountId':Number(_0x17aede[_0xd4fa('0x59')]['id'])});}}else{socket[_0xd4fa('0x78')](_0xd4fa('0x7b'),{'UserId':Number(_0x17aede[_0xd4fa('0x46')][_0xd4fa('0x74')]),'WhatsappAccountId':Number(_0x17aede[_0xd4fa('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x1f74b6,null))[_0xd4fa('0x57')](handleError(_0x1f74b6,null));};exports[_0xd4fa('0x7c')]=function(_0x2cc302,_0x1049d7,_0x59d638){var _0x765f0d={};var _0x30fe5d={};var _0x4a4d0d;var _0x4d9451;return db[_0xd4fa('0x42')][_0xd4fa('0x6a')]({'where':{'id':_0x2cc302[_0xd4fa('0x59')]['id']}})[_0xd4fa('0x3c')](handleEntityNotFound(_0x1049d7,null))[_0xd4fa('0x3c')](function(_0xd4e138){if(_0xd4e138){_0x4a4d0d=_0xd4e138;_0x30fe5d[_0xd4fa('0x45')]=_[_0xd4fa('0x47')](db[_0xd4fa('0x7d')][_0xd4fa('0x5b')]);_0x30fe5d['query']=_[_0xd4fa('0x47')](_0x2cc302[_0xd4fa('0x46')]);_0x30fe5d['filters']=_[_0xd4fa('0x49')](_0x30fe5d[_0xd4fa('0x45')],_0x30fe5d[_0xd4fa('0x46')]);_0x765f0d[_0xd4fa('0x48')]=_[_0xd4fa('0x49')](_0x30fe5d[_0xd4fa('0x45')],qs[_0xd4fa('0x4a')](_0x2cc302[_0xd4fa('0x46')][_0xd4fa('0x4a')]));_0x765f0d[_0xd4fa('0x48')]=_0x765f0d[_0xd4fa('0x48')][_0xd4fa('0x4b')]?_0x765f0d[_0xd4fa('0x48')]:_0x30fe5d['model'];_0x765f0d[_0xd4fa('0x4e')]=qs[_0xd4fa('0x4f')](_0x2cc302['query'][_0xd4fa('0x4f')]);_0x765f0d[_0xd4fa('0x50')]=qs['filters'](_[_0xd4fa('0x52')](_0x2cc302[_0xd4fa('0x46')],_0x30fe5d[_0xd4fa('0x51')]));if(_0x2cc302[_0xd4fa('0x46')]['filter']){_0x765f0d[_0xd4fa('0x50')]=_[_0xd4fa('0x53')](_0x765f0d[_0xd4fa('0x50')],{'$or':_[_0xd4fa('0x41')](_0x765f0d['attributes'],function(_0x2abcaa){var _0x304729={};_0x304729[_0x2abcaa]={'$like':'%'+_0x2cc302[_0xd4fa('0x46')][_0xd4fa('0x6c')]+'%'};return _0x304729;})});}_0x765f0d=_['merge']({},_0x765f0d,_0x2cc302['options']);return _0x4a4d0d[_0xd4fa('0x7c')](_0x765f0d);}})['then'](function(_0x96448a){if(_0x96448a){_0x4d9451=_0x96448a['length'];if(!_0x2cc302[_0xd4fa('0x46')][_0xd4fa('0x4c')](_0xd4fa('0x4d'))){_0x765f0d[_0xd4fa('0x32')]=qs['limit'](_0x2cc302[_0xd4fa('0x46')][_0xd4fa('0x32')]);_0x765f0d[_0xd4fa('0x34')]=qs[_0xd4fa('0x34')](_0x2cc302[_0xd4fa('0x46')][_0xd4fa('0x34')]);}return _0x4a4d0d['getAgents'](_0x765f0d);}})[_0xd4fa('0x3c')](function(_0x3aec7f){if(_0x3aec7f){return _0x3aec7f?{'count':_0x4d9451,'rows':_0x3aec7f}:null;}})[_0xd4fa('0x3c')](respondWithResult(_0x1049d7,null))[_0xd4fa('0x57')](handleError(_0x1049d7,null));};exports[_0xd4fa('0x7e')]=function(_0x254389,_0x55bbeb){var _0x582648=_0x254389['params']['id'];var _0x159908=_0x254389[_0xd4fa('0x60')];var _0x44e170=0xc8;var _0x3203df=null;return db[_0xd4fa('0x7f')][_0xd4fa('0x80')]({'isolationLevel':db['sequelize']['Transaction'][_0xd4fa('0x81')][_0xd4fa('0x82')]},function(_0x46bfac){return db[_0xd4fa('0x42')]['findOne']({'where':{'id':_0x582648},'transaction':_0x46bfac})['then'](function(_0x34a84a){if(_0x34a84a){return db[_0xd4fa('0x83')][_0xd4fa('0x3b')]({'where':{'WhatsappAccountId':_0x582648},'transaction':_0x46bfac})[_0xd4fa('0x3c')](function(){var _0x15afb3=_[_0xd4fa('0x41')](_0x159908,function(_0x20e7aa){_0x20e7aa[_0xd4fa('0x70')]=_0x582648;return _0x20e7aa;});return db[_0xd4fa('0x83')][_0xd4fa('0x84')](_0x15afb3,{'transaction':_0x46bfac});});}else{_0x44e170=0x194;_0x3203df=[];}});})[_0xd4fa('0x3c')](function(){if(_0x44e170!==0x194){return db[_0xd4fa('0x83')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x582648},'order':_0xd4fa('0x85')})[_0xd4fa('0x3c')](function(_0x5e2b75){_0x3203df=_0x5e2b75;});}})['catch'](function(_0x303bd5){_0x44e170=0x1f4;logger[_0xd4fa('0x28')](_0x303bd5[_0xd4fa('0x3d')]);if(_0x303bd5[_0xd4fa('0x3e')]){delete _0x303bd5[_0xd4fa('0x3e')];}_0x3203df=_0x303bd5;})['finally'](function(){if(_0x3203df===null){_0x55bbeb[_0xd4fa('0x2d')](_0x44e170);}else{if(_0x44e170===0x1f4){_0x55bbeb['status'](_0x44e170)['send'](_0x3203df);}else{_0x55bbeb[_0xd4fa('0x2e')](_0x44e170)[_0xd4fa('0x30')](_0x3203df);}}});};exports[_0xd4fa('0x86')]=function(_0x514eda,_0x2d05de,_0x502468){var _0x32df98={};var _0x3a8284={};var _0x277f07;var _0x36cfcf;return db[_0xd4fa('0x42')]['findOne']({'where':{'id':_0x514eda[_0xd4fa('0x59')]['id']}})[_0xd4fa('0x3c')](handleEntityNotFound(_0x2d05de,null))[_0xd4fa('0x3c')](function(_0x12398d){if(_0x12398d){_0x277f07=_0x12398d;_0x3a8284[_0xd4fa('0x45')]=_['keys'](db[_0xd4fa('0x83')][_0xd4fa('0x5b')]);_0x3a8284[_0xd4fa('0x46')]=_[_0xd4fa('0x47')](_0x514eda[_0xd4fa('0x46')]);_0x3a8284[_0xd4fa('0x51')]=_[_0xd4fa('0x49')](_0x3a8284[_0xd4fa('0x45')],_0x3a8284[_0xd4fa('0x46')]);_0x32df98['attributes']=_[_0xd4fa('0x49')](_0x3a8284[_0xd4fa('0x45')],qs[_0xd4fa('0x4a')](_0x514eda[_0xd4fa('0x46')][_0xd4fa('0x4a')]));_0x32df98['attributes']=_0x32df98['attributes']['length']?_0x32df98['attributes']:_0x3a8284['model'];_0x32df98['order']=qs['sort'](_0x514eda[_0xd4fa('0x46')][_0xd4fa('0x4f')]);_0x32df98[_0xd4fa('0x50')]=qs[_0xd4fa('0x51')](_['pick'](_0x514eda[_0xd4fa('0x46')],_0x3a8284['filters']));if(_0x514eda[_0xd4fa('0x46')][_0xd4fa('0x6c')]){_0x32df98[_0xd4fa('0x50')]=_['merge'](_0x32df98[_0xd4fa('0x50')],{'$or':_[_0xd4fa('0x41')](_0x32df98[_0xd4fa('0x48')],function(_0x480a2a){var _0x46da44={};_0x46da44[_0x480a2a]={'$like':'%'+_0x514eda[_0xd4fa('0x46')][_0xd4fa('0x6c')]+'%'};return _0x46da44;})});}_0x32df98=_[_0xd4fa('0x53')]({},_0x32df98,_0x514eda['options']);return _0x277f07[_0xd4fa('0x86')](_0x32df98);}})[_0xd4fa('0x3c')](function(_0x393aa1){if(_0x393aa1){_0x36cfcf=_0x393aa1[_0xd4fa('0x4b')];if(!_0x514eda[_0xd4fa('0x46')]['hasOwnProperty']('nolimit')){_0x32df98[_0xd4fa('0x32')]=qs[_0xd4fa('0x32')](_0x514eda['query'][_0xd4fa('0x32')]);_0x32df98[_0xd4fa('0x34')]=qs[_0xd4fa('0x34')](_0x514eda[_0xd4fa('0x46')][_0xd4fa('0x34')]);}return _0x277f07[_0xd4fa('0x86')](_0x32df98);}})[_0xd4fa('0x3c')](function(_0x58999b){if(_0x58999b){return _0x58999b?{'count':_0x36cfcf,'rows':_0x58999b}:null;}})[_0xd4fa('0x3c')](respondWithResult(_0x2d05de,null))[_0xd4fa('0x57')](handleError(_0x2d05de,null));};exports['notify']=function(_0x273e48,_0x42d320,_0x7b404d){var _0x5c53a9={'channel':_0xd4fa('0x87')};var _0x1c79d9=[];var _0x529965=[];var _0x4cb02d={};return db[_0xd4fa('0x42')][_0xd4fa('0x5e')]({'where':{'id':_0x273e48[_0xd4fa('0x59')]['id']},'include':[{'model':db[_0xd4fa('0x83')],'as':_0xd4fa('0x88')}]})[_0xd4fa('0x3c')](handleEntityNotFound(_0x42d320,null))[_0xd4fa('0x3c')](function(_0x42821f){_0x5c53a9[_0xd4fa('0x89')]=_0x42821f;if(_0x5c53a9['account']&&_0x5c53a9[_0xd4fa('0x89')][_0xd4fa('0x43')]===_0xd4fa('0x8a')&&_0x273e48[_0xd4fa('0x60')][_0xd4fa('0x8b')]){if(_0x273e48[_0xd4fa('0x60')][_0xd4fa('0x8b')][_0xd4fa('0x4b')]===0x0)return;if(_0x273e48[_0xd4fa('0x60')][_0xd4fa('0x8b')][0x0]['state']!==_0xd4fa('0x8c'))return;return db[_0xd4fa('0x8d')][_0xd4fa('0x66')]({'read':!![],'readAt':_0x273e48['body']['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x273e48[_0xd4fa('0x60')][_0xd4fa('0x8b')][0x0][_0xd4fa('0x8e')]},'individualHooks':!![]})[_0xd4fa('0x3c')](function(_0x63ff6e){return _0x42d320['status'](0xc8)['json'](_0x63ff6e);});}_0x5c53a9[_0xd4fa('0x8f')]=_[_0xd4fa('0x90')](_0x42821f[_0xd4fa('0x88')],[_0xd4fa('0x85')],[_0xd4fa('0x91')]);if(_0x5c53a9[_0xd4fa('0x89')][_0xd4fa('0x88')]){delete _0x5c53a9['account'][_0xd4fa('0x88')];}return db[_0xd4fa('0x92')]['describe']()[_0xd4fa('0x3c')](function(_0x386c64){if(!_0x386c64){throw new db[(_0xd4fa('0x93'))][(_0xd4fa('0x94'))]('no\x20available\x20attributes');}_0x1c79d9=_['difference'](_[_0xd4fa('0x47')](_0x386c64),[_0xd4fa('0x95'),'updatedAt']);_0x529965=_['difference'](_['keys'](_0x386c64),[_0xd4fa('0x95'),_0xd4fa('0x96'),_0xd4fa('0x97'),'ListId']);_0x5c53a9[_0xd4fa('0x60')]={'mapKey':_0xd4fa('0x98')};if(_0x5c53a9[_0xd4fa('0x89')]&&_0x5c53a9['account']['type']===_0xd4fa('0x99')){_0x5c53a9[_0xd4fa('0x60')][_0xd4fa('0x9a')]=_0x273e48[_0xd4fa('0x60')][_0xd4fa('0x9b')][_0xd4fa('0x9c')](_0xd4fa('0x9d'),'');_0x5c53a9['body']['body']=_0x273e48[_0xd4fa('0x60')][_0xd4fa('0x9e')];_0x5c53a9[_0xd4fa('0x60')][_0xd4fa('0x9f')]=_0x273e48[_0xd4fa('0x60')][_0xd4fa('0xa0')];}if(_0x5c53a9[_0xd4fa('0x89')]&&_0x5c53a9[_0xd4fa('0x89')][_0xd4fa('0x43')]===_0xd4fa('0x8a')){_0x5c53a9[_0xd4fa('0x60')]['from']=_0x273e48['body'][_0xd4fa('0xa1')][0x0][_0xd4fa('0x9a')];_0x5c53a9[_0xd4fa('0x60')]['body']=_0x273e48[_0xd4fa('0x60')][_0xd4fa('0xa1')][0x0][_0xd4fa('0x2b')]['body'];_0x5c53a9[_0xd4fa('0x60')][_0xd4fa('0x9f')]=_0x273e48[_0xd4fa('0x60')][_0xd4fa('0xa1')][0x0][_0xd4fa('0x8e')];}if(_0x5c53a9[_0xd4fa('0x60')]['id']){delete _0x5c53a9['body']['id'];}if(_[_0xd4fa('0xa2')](_0x5c53a9[_0xd4fa('0x60')]['from'])){throw new db[(_0xd4fa('0x93'))][(_0xd4fa('0x94'))](_0xd4fa('0xa3'));}if(_[_0xd4fa('0xa2')](_0x5c53a9[_0xd4fa('0x60')][_0xd4fa('0x60')])||_0x5c53a9[_0xd4fa('0x60')][_0xd4fa('0x60')]===''){throw new db[(_0xd4fa('0x93'))][(_0xd4fa('0x94'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd4fa('0xa2')](_0x5c53a9[_0xd4fa('0x60')]['mapKey'])){throw new db[(_0xd4fa('0x93'))]['ValidationError'](_0xd4fa('0xa4')+_0x529965);}if(!_[_0xd4fa('0xa5')](_0x529965,_0x5c53a9[_0xd4fa('0x60')]['mapKey'])){throw new db['Sequelize'][(_0xd4fa('0x94'))](_0xd4fa('0xa6')+_0x529965);}_0x4cb02d[_0x5c53a9[_0xd4fa('0x60')][_0xd4fa('0xa7')]]=_0x5c53a9[_0xd4fa('0x60')][_0xd4fa('0x9a')];return db[_0xd4fa('0xa8')][_0xd4fa('0x5e')]({'where':{'id':_0x5c53a9['account']['ListId']},'include':[{'model':db[_0xd4fa('0x92')],'as':'Contacts','where':_0x4cb02d,'limit':0x1,'order':[['updatedAt',_0xd4fa('0xa9')]]}]});})[_0xd4fa('0x3c')](handleEntityNotFound(_0x42d320,null))['then'](function(_0x503247){if(_0x503247){_0x5c53a9['list']=_[_0xd4fa('0x76')](_0x503247,['Contacts']);if(_0x503247[_0xd4fa('0xaa')]['length']){return _0x503247[_0xd4fa('0xaa')][0x0];}var _0x3abdbf=_['defaults'](_0x5c53a9[_0xd4fa('0x60')],{'firstName':_0x5c53a9['body']['from'],'ListId':_0x503247['id']});_0x3abdbf[_0x5c53a9[_0xd4fa('0x60')]['mapKey']]=_0x5c53a9[_0xd4fa('0x60')][_0xd4fa('0x9a')];return db[_0xd4fa('0x92')]['create'](_0x3abdbf,{'fields':_0x1c79d9,'raw':!![]});}})[_0xd4fa('0x3c')](handleEntityNotFound(_0x42d320,null))[_0xd4fa('0x3c')](function(_0x145b89){if(_0x145b89){_0x5c53a9[_0xd4fa('0xab')]=_0x145b89;var _0x1e231e={'ContactId':_0x145b89['id'],'phone':_0x5c53a9[_0xd4fa('0x60')][_0xd4fa('0x9a')],'WhatsappAccountId':_0x273e48[_0xd4fa('0x59')]['id']};var _0x68fe25={'ContactId':_0x145b89['id'],'WhatsappAccountId':_0x273e48[_0xd4fa('0x59')]['id'],'closed':![]};return db[_0xd4fa('0xac')][_0xd4fa('0x5e')]({'where':_0x68fe25})[_0xd4fa('0x3c')](function(_0x11cbc){if(_0x11cbc){return[_0x11cbc,![]];}return db[_0xd4fa('0xac')][_0xd4fa('0x5f')](_0x1e231e)[_0xd4fa('0x3c')](function(_0x159dbe){return[_0x159dbe,!![]];});});}})[_0xd4fa('0x77')](function(_0x1515da,_0x208563){_0x5c53a9[_0xd4fa('0xad')]=_0x1515da['get']({'plain':!![]});_0x5c53a9[_0xd4fa('0xad')][_0xd4fa('0xae')]=![];if(_0x208563){if(_0x5c53a9[_0xd4fa('0x89')]['autoclose']){_0x5c53a9[_0xd4fa('0x8f')][_0xd4fa('0xaf')]({'id':0x0,'priority':_0x5c53a9[_0xd4fa('0x8f')][_0xd4fa('0x4b')]+0x1,'app':'close','appdata':_0xd4fa('0xb0'),'interval':_0xd4fa('0xb1')});}_0x5c53a9[_0xd4fa('0xad')][_0xd4fa('0xae')]=!![];}return db['WhatsappMessage'][_0xd4fa('0x5f')]({'phone':_0x5c53a9['body']['from'],'messageId':_0x5c53a9[_0xd4fa('0x60')][_0xd4fa('0x9f')],'body':_0x5c53a9['body'][_0xd4fa('0x60')],'WhatsappAccountId':_0x273e48['params']['id'],'WhatsappInteractionId':_0x1515da['id'],'direction':'in','ContactId':_0x1515da[_0xd4fa('0xb2')],'AttachmentId':_0x5c53a9[_0xd4fa('0x60')][_0xd4fa('0xb3')]});})[_0xd4fa('0x3c')](function(_0x1482f6){_0x5c53a9['message']=_0x1482f6;if(!_0x5c53a9[_0xd4fa('0xad')][_0xd4fa('0xb4')])return;return db[_0xd4fa('0x7d')][_0xd4fa('0x5e')]({'attributes':['id',_0xd4fa('0x3e')],'where':{'id':_0x5c53a9['interaction'][_0xd4fa('0xb4')]}});})['then'](function(_0x42d786){if(_0x42d786){_0x5c53a9['applications'][_0xd4fa('0xb5')]({'id':0x0,'priority':0x0,'app':_0xd4fa('0xb6'),'appdata':_0x42d786[_0xd4fa('0x3e')]+','+(_0x5c53a9['account'][_0xd4fa('0xb7')]||0xa),'interval':_0xd4fa('0xb1')});}if(!_0x5c53a9[_0xd4fa('0xad')][_0xd4fa('0xb8')])return;return db[_0xd4fa('0xb9')][_0xd4fa('0x5e')]({'attributes':['id',_0xd4fa('0x3e')],'where':{'id':_0x5c53a9[_0xd4fa('0xad')]['queueId']}});})['then'](function(_0x17c1c4){if(_0x17c1c4){_0x5c53a9[_0xd4fa('0x8f')][_0xd4fa('0xb5')]({'id':0x0,'priority':0x1,'app':_0xd4fa('0xba'),'appdata':_0x17c1c4[_0xd4fa('0x3e')]+','+(_0x5c53a9[_0xd4fa('0x89')]['waitForTheAssignedQueue']||0x12c),'interval':_0xd4fa('0xb1')});}return respondWithRpcPromise(_0xd4fa('0xbb'),_0xd4fa('0xbc'),_0x5c53a9);})[_0xd4fa('0x3c')](function(_0x1e9469){if(_0x1e9469){var _0x146076=0xc8;var _0x54383e=_0xd4fa('0xbd');logger[_0xd4fa('0x23')](_0xd4fa('0x25'),_0x54383e,_0x146076,_0xd4fa('0xbe'));logger['debug'](_0xd4fa('0xbf'),_0x54383e,_0x146076,'entity\x20found',JSON[_0xd4fa('0x27')](_0x1e9469));if(_0x5c53a9['account'][_0xd4fa('0x43')]===_0xd4fa('0x99')){return _0x42d320[_0xd4fa('0x2e')](_0x146076)[_0xd4fa('0x35')](_0xd4fa('0xc0'),_0xd4fa('0xc1'))[_0xd4fa('0x3f')](_0xd4fa('0xc2'));}else{return _0x42d320[_0xd4fa('0x2e')](_0x146076)['json'](_0x1e9469);}}});})['catch'](handleError(_0x42d320,null));};exports[_0xd4fa('0x3f')]=function(_0x2f6ff4,_0x2e4419,_0x40036e){var _0x45ae38,_0x159965,_0x24f863;if(_[_0xd4fa('0xa2')](_0x2f6ff4['body'][_0xd4fa('0x60')])||_0x2f6ff4['body'][_0xd4fa('0x60')]===''){throw new db[(_0xd4fa('0x93'))][(_0xd4fa('0x94'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2f6ff4[_0xd4fa('0x60')]['to'])){throw new db[(_0xd4fa('0x93'))]['ValidationError']('to\x20is\x20mandatory');}_0x45ae38=_0x2f6ff4['body']['to'];return db['WhatsappAccount'][_0xd4fa('0x5e')]({'where':{'id':_0x2f6ff4['params']['id']},'include':[{'model':db[_0xd4fa('0xa8')],'as':_0xd4fa('0xc3'),'include':[{'model':db[_0xd4fa('0x92')],'as':_0xd4fa('0xaa'),'where':{'mobile':_0x45ae38},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xd4fa('0x3c')](handleEntityNotFound(_0x2e4419,null))['then'](function(_0x4bd673){if(_0x4bd673&&_0x4bd673['List']){_0x159965=_0x4bd673[_0xd4fa('0x39')]({'plain':!![]});if(_0x159965[_0xd4fa('0xc3')]&&_0x159965[_0xd4fa('0xc3')][_0xd4fa('0xaa')][_0xd4fa('0x4b')]){return _0x159965[_0xd4fa('0xc3')][_0xd4fa('0xaa')][0x0];}return db[_0xd4fa('0x92')]['create'](_[_0xd4fa('0x1a')](_0x2f6ff4[_0xd4fa('0x60')],{'firstName':_0x45ae38,'mobile':_0x45ae38,'phone':_0x45ae38,'ListId':_0x159965[_0xd4fa('0xc4')]}));}})[_0xd4fa('0x3c')](handleEntityNotFound(_0x2e4419,null))[_0xd4fa('0x3c')](function(_0x1be6e4){if(_0x1be6e4){_0x24f863=_0x1be6e4;return db[_0xd4fa('0xac')]['find']({'where':{'ContactId':_0x24f863['id'],'closed':![],'WhatsappAccountId':_0x159965['id']}})[_0xd4fa('0x3c')](function(_0x3f1ee8){if(_0x3f1ee8){return[_0x3f1ee8,![]];}return db['WhatsappInteraction'][_0xd4fa('0x5f')]({'UserId':_0x2f6ff4[_0xd4fa('0x61')]['id'],'ContactId':_0x24f863['id'],'WhatsappAccountId':_0x159965['id'],'phone':_0x45ae38,'firstMsgDirection':_0xd4fa('0xc5'),'Messages':[_[_0xd4fa('0x53')](_0x2f6ff4[_0xd4fa('0x60')],{'read':![],'body':_0x2f6ff4[_0xd4fa('0x60')][_0xd4fa('0x60')],'phone':_0x45ae38,'WhatsappAccountId':_0x159965['id'],'UserId':_0x2f6ff4[_0xd4fa('0x61')]['id'],'ContactId':_0x24f863['id']})]},{'include':[{'model':db[_0xd4fa('0x8d')],'as':_0xd4fa('0xc6')}]})[_0xd4fa('0x3c')](function(_0x3a7b0d){return[_0x3a7b0d,!![]];});});}})[_0xd4fa('0x77')](function(_0xb98477,_0x4419ee){if(_0x4419ee){return _0xb98477;}return db[_0xd4fa('0x8d')]['create'](_[_0xd4fa('0x53')](_0x2f6ff4[_0xd4fa('0x60')],{'read':![],'body':_0x2f6ff4[_0xd4fa('0x60')][_0xd4fa('0x60')],'phone':_0x45ae38,'WhatsappAccountId':_0x159965['id'],'WhatsappInteractionId':_0xb98477['id'],'UserId':_0x2f6ff4[_0xd4fa('0x61')]['id'],'ContactId':_0x24f863['id']}))[_0xd4fa('0x3c')](function(_0x520941){_0xb98477[_0xd4fa('0xc7')][_0xd4fa('0xc6')]=[];_0xb98477[_0xd4fa('0xc7')][_0xd4fa('0xc6')]['push'](_0x520941[_0xd4fa('0xc7')]);return _0xb98477;});})[_0xd4fa('0x3c')](respondWithResult(_0x2e4419,null))[_0xd4fa('0x57')](handleError(_0x2e4419,null));}; \ No newline at end of file +var _0xa30e=['bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','message_id','applications','orderBy','asc','CmContact','describe','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','notifications','messageId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','DESC','list','omit','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','*,*,*,*','queueId','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','findAll','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Disposition','getDispositions','findOne','WhatsappAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','ids','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication'];(function(_0x3d4ddb,_0x1c9228){var _0x46ea55=function(_0x5aea0d){while(--_0x5aea0d){_0x3d4ddb['push'](_0x3d4ddb['shift']());}};_0x46ea55(++_0x1c9228);}(_0xa30e,0x117));var _0xea30=function(_0x4b6847,_0x50c4d6){_0x4b6847=_0x4b6847-0x0;var _0x562863=_0xa30e[_0x4b6847];return _0x562863;};'use strict';var emlformat=require(_0xea30('0x0'));var rimraf=require(_0xea30('0x1'));var zipdir=require(_0xea30('0x2'));var jsonpatch=require(_0xea30('0x3'));var rp=require(_0xea30('0x4'));var moment=require(_0xea30('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xea30('0x6'));var sox=require(_0xea30('0x7'));var csv=require(_0xea30('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea30('0x9'));var _=require(_0xea30('0xa'));var squel=require(_0xea30('0xb'));var crypto=require(_0xea30('0xc'));var jsforce=require(_0xea30('0xd'));var deskjs=require(_0xea30('0xe'));var toCsv=require(_0xea30('0x8'));var querystring=require(_0xea30('0xf'));var Papa=require(_0xea30('0x10'));var Redis=require(_0xea30('0x11'));var authService=require(_0xea30('0x12'));var qs=require(_0xea30('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xea30('0x14'))(_0xea30('0x15'));var utils=require(_0xea30('0x16'));var config=require(_0xea30('0x17'));var licenseUtil=require(_0xea30('0x18'));var db=require(_0xea30('0x19'))['db'];config[_0xea30('0x1a')]=_[_0xea30('0x1b')](config[_0xea30('0x1a')],{'host':_0xea30('0x1c'),'port':0x18eb});var socket=require(_0xea30('0x1d'))(new Redis(config[_0xea30('0x1a')]));require(_0xea30('0x1e'))['register'](socket);var jayson=require(_0xea30('0x1f'));var client=jayson[_0xea30('0x20')][_0xea30('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x54235a,_0x27e663,_0x4151a6,_0x1e2c8f){return new BPromise(function(_0x37498d,_0x3a2824){var _0x36212e=_0x1e2c8f||client;return _0x36212e[_0xea30('0x22')](_0x54235a,_0x4151a6)[_0xea30('0x23')](function(_0xb37dc8){logger[_0xea30('0x24')](_0xea30('0x25'),_0x27e663,_0xea30('0x26'));logger[_0xea30('0x27')](_0xea30('0x28'),_0x27e663,'request\x20sent',JSON[_0xea30('0x29')](_0xb37dc8));if(_0xb37dc8[_0xea30('0x2a')]){if(_0xb37dc8[_0xea30('0x2a')][_0xea30('0x2b')]===0x1f4){logger[_0xea30('0x2a')](_0xea30('0x25'),_0x27e663,_0xb37dc8[_0xea30('0x2a')][_0xea30('0x2c')]);return _0x3a2824(_0xb37dc8['error'][_0xea30('0x2c')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x27e663,_0xb37dc8['error'][_0xea30('0x2c')]);return _0x37498d(_0xb37dc8[_0xea30('0x2a')][_0xea30('0x2c')]);}else{logger[_0xea30('0x24')](_0xea30('0x25'),_0x27e663,'request\x20sent');_0x37498d(_0xb37dc8[_0xea30('0x2d')][_0xea30('0x2c')]);}})[_0xea30('0x2e')](function(_0x2b7805){logger[_0xea30('0x2a')](_0xea30('0x25'),_0x27e663,_0x2b7805);_0x3a2824(_0x2b7805);});});}function respondWithStatusCode(_0x290986,_0x5adcb6){_0x5adcb6=_0x5adcb6||0xcc;return function(_0x49f6a9){if(_0x49f6a9){return _0x290986[_0xea30('0x2f')](_0x5adcb6);}return _0x290986[_0xea30('0x30')](_0x5adcb6)[_0xea30('0x31')]();};}function respondWithResult(_0x4e02df,_0x203554){_0x203554=_0x203554||0xc8;return function(_0x3c70dd){if(_0x3c70dd){return _0x4e02df[_0xea30('0x30')](_0x203554)[_0xea30('0x32')](_0x3c70dd);}};}function respondWithFilteredResult(_0x4a256e,_0x593e71){return function(_0x32d2f3){if(_0x32d2f3){var _0x144aaa=typeof _0x593e71[_0xea30('0x33')]===_0xea30('0x34')&&typeof _0x593e71[_0xea30('0x35')]===_0xea30('0x34');var _0x57d9bd=_0x32d2f3[_0xea30('0x36')];var _0xdcf47e=_0x144aaa?0x0:_0x593e71[_0xea30('0x33')];var _0x2e957a=_0x144aaa?_0x32d2f3[_0xea30('0x36')]:_0x593e71[_0xea30('0x33')]+_0x593e71[_0xea30('0x35')];var _0x9aecae;if(_0x2e957a>=_0x57d9bd){_0x2e957a=_0x57d9bd;_0x9aecae=0xc8;}else{_0x9aecae=0xce;}_0x4a256e[_0xea30('0x30')](_0x9aecae);return _0x4a256e['set']('Content-Range',_0xdcf47e+'-'+_0x2e957a+'/'+_0x57d9bd)[_0xea30('0x32')](_0x32d2f3);}return null;};}function patchUpdates(_0x45b77e){return function(_0x5a5b1f){try{jsonpatch['apply'](_0x5a5b1f,_0x45b77e,!![]);}catch(_0x171740){return BPromise[_0xea30('0x37')](_0x171740);}return _0x5a5b1f[_0xea30('0x38')]();};}function saveUpdates(_0x11bd4a,_0x3c881f){return function(_0x4fcc4d){if(_0x4fcc4d){return _0x4fcc4d[_0xea30('0x39')](_0x11bd4a)[_0xea30('0x23')](function(_0x2556e3){return _0x2556e3;});}return null;};}function removeEntity(_0x1d9007,_0x28bb4f){return function(_0x4adaa6){if(_0x4adaa6){return _0x4adaa6['destroy']()[_0xea30('0x23')](function(){var _0x454bb3=_0x4adaa6[_0xea30('0x3a')]({'plain':!![]});var _0x4474d2=_0xea30('0x3b');return db[_0xea30('0x3c')][_0xea30('0x3d')]({'where':{'type':_0x4474d2,'resourceId':_0x454bb3['id']}})[_0xea30('0x23')](function(){return _0x4adaa6;});})[_0xea30('0x23')](function(){_0x1d9007[_0xea30('0x30')](0xcc)[_0xea30('0x31')]();});}};}function handleEntityNotFound(_0x2fa047,_0x4aeb4d){return function(_0xabc0b3){if(!_0xabc0b3){_0x2fa047[_0xea30('0x2f')](0x194);}return _0xabc0b3;};}function handleError(_0x44f0c4,_0x496309){_0x496309=_0x496309||0x1f4;return function(_0x5795c6){logger[_0xea30('0x2a')](_0x5795c6[_0xea30('0x3e')]);if(_0x5795c6[_0xea30('0x3f')]){delete _0x5795c6[_0xea30('0x3f')];}_0x44f0c4[_0xea30('0x30')](_0x496309)[_0xea30('0x40')](_0x5795c6);};}exports['index']=function(_0x530790,_0x18c1d4){var _0x21881d={'include':[{'model':db[_0xea30('0x41')],'as':_0xea30('0x42')}]},_0x4ef63d={},_0x243f94={'count':0x0,'rows':[]};var _0x57326c=_[_0xea30('0x43')](db[_0xea30('0x44')][_0xea30('0x45')],function(_0x1dbd4e){return{'name':_0x1dbd4e[_0xea30('0x46')],'type':_0x1dbd4e[_0xea30('0x47')][_0xea30('0x48')]};});_0x4ef63d[_0xea30('0x49')]=_['map'](_0x57326c,_0xea30('0x3f'));_0x4ef63d[_0xea30('0x4a')]=_[_0xea30('0x4b')](_0x530790[_0xea30('0x4a')]);_0x4ef63d['filters']=_['intersection'](_0x4ef63d[_0xea30('0x49')],_0x4ef63d[_0xea30('0x4a')]);_0x21881d['attributes']=_[_0xea30('0x4c')](_0x4ef63d[_0xea30('0x49')],qs[_0xea30('0x4d')](_0x530790[_0xea30('0x4a')][_0xea30('0x4d')]));_0x21881d[_0xea30('0x4e')]=_0x21881d[_0xea30('0x4e')][_0xea30('0x4f')]?_0x21881d[_0xea30('0x4e')]:_0x4ef63d['model'];if(!_0x530790['query'][_0xea30('0x50')](_0xea30('0x51'))){_0x21881d['limit']=qs[_0xea30('0x35')](_0x530790[_0xea30('0x4a')][_0xea30('0x35')]);_0x21881d[_0xea30('0x33')]=qs[_0xea30('0x33')](_0x530790[_0xea30('0x4a')][_0xea30('0x33')]);}_0x21881d[_0xea30('0x52')]=qs[_0xea30('0x53')](_0x530790[_0xea30('0x4a')][_0xea30('0x53')]);_0x21881d[_0xea30('0x54')]=qs[_0xea30('0x55')](_[_0xea30('0x56')](_0x530790['query'],_0x4ef63d[_0xea30('0x55')]),_0x57326c);if(_0x530790['query']['filter']){_0x21881d[_0xea30('0x54')]=_['merge'](_0x21881d['where'],{'$or':_[_0xea30('0x43')](_0x57326c,function(_0x5500d6){if(_0x5500d6[_0xea30('0x47')]!==_0xea30('0x57')){var _0x22e665={};_0x22e665[_0x5500d6[_0xea30('0x3f')]]={'$like':'%'+_0x530790['query'][_0xea30('0x58')]+'%'};return _0x22e665;}})});}_0x21881d=_[_0xea30('0x59')]({},_0x21881d,_0x530790[_0xea30('0x5a')]);var _0x6945fa={'where':_0x21881d[_0xea30('0x54')]};return db[_0xea30('0x44')][_0xea30('0x36')](_0x6945fa)[_0xea30('0x23')](function(_0x35d17d){_0x243f94[_0xea30('0x36')]=_0x35d17d;if(_0x530790[_0xea30('0x4a')][_0xea30('0x5b')]){_0x21881d['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0xea30('0x5c')](_0x21881d);})[_0xea30('0x23')](function(_0xf140f){_0x243f94['rows']=_0xf140f;return _0x243f94;})[_0xea30('0x23')](respondWithFilteredResult(_0x18c1d4,_0x21881d))[_0xea30('0x2e')](handleError(_0x18c1d4,null));};exports[_0xea30('0x5d')]=function(_0x2111bf,_0x39b75f){var _0x199326={'raw':![],'where':{'id':_0x2111bf[_0xea30('0x5e')]['id']},'include':[{'model':db[_0xea30('0x41')],'as':_0xea30('0x42')}]},_0x2bc903={};_0x2bc903['model']=_[_0xea30('0x4b')](db['WhatsappAccount'][_0xea30('0x45')]);_0x2bc903[_0xea30('0x4a')]=_['keys'](_0x2111bf[_0xea30('0x4a')]);_0x2bc903[_0xea30('0x55')]=_[_0xea30('0x4c')](_0x2bc903['model'],_0x2bc903[_0xea30('0x4a')]);_0x199326[_0xea30('0x4e')]=_['intersection'](_0x2bc903[_0xea30('0x49')],qs[_0xea30('0x4d')](_0x2111bf[_0xea30('0x4a')][_0xea30('0x4d')]));_0x199326['attributes']=_0x199326[_0xea30('0x4e')][_0xea30('0x4f')]?_0x199326['attributes']:_0x2bc903['model'];if(_0x2111bf['query'][_0xea30('0x5b')]){_0x199326[_0xea30('0x5f')]=[{'all':!![]}];}_0x199326=_['merge']({},_0x199326,_0x2111bf[_0xea30('0x5a')]);return db[_0xea30('0x44')][_0xea30('0x60')](_0x199326)['then'](handleEntityNotFound(_0x39b75f,null))[_0xea30('0x23')](respondWithResult(_0x39b75f,null))[_0xea30('0x2e')](handleError(_0x39b75f,null));};exports[_0xea30('0x61')]=function(_0x408704,_0x484fdd){return db['WhatsappAccount'][_0xea30('0x61')](_0x408704['body'],{})[_0xea30('0x23')](function(_0x444447){var _0x50f505=_0x408704[_0xea30('0x62')][_0xea30('0x3a')]({'plain':!![]});if(!_0x50f505)throw new Error(_0xea30('0x63'));if(_0x50f505['role']===_0xea30('0x62')){var _0x106cf0=_0x444447[_0xea30('0x3a')]({'plain':!![]});var _0x12404c=_0xea30('0x3b');return db['UserProfileSection'][_0xea30('0x60')]({'where':{'name':_0x12404c,'userProfileId':_0x50f505['userProfileId']},'raw':!![]})[_0xea30('0x23')](function(_0x17b7c6){if(_0x17b7c6&&_0x17b7c6['autoAssociation']===0x0){return db[_0xea30('0x3c')][_0xea30('0x61')]({'name':_0x106cf0[_0xea30('0x3f')],'resourceId':_0x106cf0['id'],'type':_0x17b7c6['name'],'sectionId':_0x17b7c6['id']},{})[_0xea30('0x23')](function(){return _0x444447;});}else{return _0x444447;}})[_0xea30('0x2e')](function(_0x149e53){logger[_0xea30('0x2a')](_0xea30('0x64'),_0x149e53);throw _0x149e53;});}return _0x444447;})['then'](respondWithResult(_0x484fdd,0xc9))[_0xea30('0x2e')](handleError(_0x484fdd,null));};exports[_0xea30('0x39')]=function(_0xe72409,_0x1055f1){if(_0xe72409[_0xea30('0x65')]['id']){delete _0xe72409[_0xea30('0x65')]['id'];}return db[_0xea30('0x44')][_0xea30('0x60')]({'where':{'id':_0xe72409[_0xea30('0x5e')]['id']},'include':[{'model':db[_0xea30('0x41')],'as':_0xea30('0x42')}]})[_0xea30('0x23')](handleEntityNotFound(_0x1055f1,null))[_0xea30('0x23')](saveUpdates(_0xe72409['body'],null))[_0xea30('0x23')](respondWithResult(_0x1055f1,null))[_0xea30('0x2e')](handleError(_0x1055f1,null));};exports[_0xea30('0x3d')]=function(_0x4600f7,_0x5a2664){return db[_0xea30('0x44')]['find']({'where':{'id':_0x4600f7[_0xea30('0x5e')]['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x5a2664,null))[_0xea30('0x23')](removeEntity(_0x5a2664,null))[_0xea30('0x2e')](handleError(_0x5a2664,null));};exports['describe']=function(_0x428a9e,_0x10341a){return db[_0xea30('0x44')]['describe']()['then'](respondWithResult(_0x10341a,null))[_0xea30('0x2e')](handleError(_0x10341a,null));};exports['addDisposition']=function(_0x140473,_0x2cf976,_0xfc3c94){if(_0x140473[_0xea30('0x65')]['id']){delete _0x140473[_0xea30('0x65')]['id'];}return db['WhatsappAccount'][_0xea30('0x60')]({'where':{'id':_0x140473[_0xea30('0x5e')]['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x2cf976,null))[_0xea30('0x23')](function(_0x760633){if(_0x760633){_0x140473['body']['WhatsappAccountId']=_0x760633['id'];return db[_0xea30('0x66')]['create'](_0x140473['body']);}})[_0xea30('0x23')](respondWithResult(_0x2cf976,null))[_0xea30('0x2e')](handleError(_0x2cf976,null));};exports[_0xea30('0x67')]=function(_0x3b9534,_0x34df11,_0x5597fb){var _0x40e1c7={'raw':![],'where':{}};var _0x5f06f0={};var _0x1dc3a4={'count':0x0,'rows':[]};return db[_0xea30('0x44')][_0xea30('0x68')]({'where':{'id':_0x3b9534[_0xea30('0x5e')]['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x34df11,null))[_0xea30('0x23')](function(_0xac587){if(_0xac587){_0x5f06f0[_0xea30('0x49')]=_[_0xea30('0x4b')](db['Disposition'][_0xea30('0x45')]);_0x5f06f0[_0xea30('0x4a')]=_[_0xea30('0x4b')](_0x3b9534['query']);_0x5f06f0['filters']=_[_0xea30('0x4c')](_0x5f06f0[_0xea30('0x49')],_0x5f06f0['query']);_0x40e1c7['attributes']=_[_0xea30('0x4c')](_0x5f06f0[_0xea30('0x49')],qs[_0xea30('0x4d')](_0x3b9534['query']['fields']));_0x40e1c7[_0xea30('0x4e')]=_0x40e1c7[_0xea30('0x4e')][_0xea30('0x4f')]?_0x40e1c7['attributes']:_0x5f06f0['model'];if(!_0x3b9534[_0xea30('0x4a')]['hasOwnProperty'](_0xea30('0x51'))){_0x40e1c7['limit']=qs[_0xea30('0x35')](_0x3b9534[_0xea30('0x4a')][_0xea30('0x35')]);_0x40e1c7[_0xea30('0x33')]=qs[_0xea30('0x33')](_0x3b9534[_0xea30('0x4a')][_0xea30('0x33')]);}_0x40e1c7['order']=qs[_0xea30('0x53')](_0x3b9534[_0xea30('0x4a')]['sort']);_0x40e1c7[_0xea30('0x54')]=qs[_0xea30('0x55')](_[_0xea30('0x56')](_0x3b9534[_0xea30('0x4a')],_0x5f06f0[_0xea30('0x55')]));_0x40e1c7[_0xea30('0x54')][_0xea30('0x69')]=_0xac587['id'];if(_0x3b9534['query'][_0xea30('0x58')]){_0x40e1c7[_0xea30('0x54')]=_[_0xea30('0x59')](_0x40e1c7[_0xea30('0x54')],{'$or':_[_0xea30('0x43')](_0x40e1c7[_0xea30('0x4e')],function(_0x1c7ceb){var _0xcc52b={};_0xcc52b[_0x1c7ceb]={'$like':'%'+_0x3b9534[_0xea30('0x4a')][_0xea30('0x58')]+'%'};return _0xcc52b;})});}_0x40e1c7=_['merge']({},_0x40e1c7,_0x3b9534['options']);return db['Disposition'][_0xea30('0x36')]({'where':_0x40e1c7['where']})['then'](function(_0x11ce38){_0x1dc3a4[_0xea30('0x36')]=_0x11ce38;if(_0x3b9534[_0xea30('0x4a')]['includeAll']){_0x40e1c7[_0xea30('0x5f')]=[{'all':!![]}];}return db[_0xea30('0x66')][_0xea30('0x5c')](_0x40e1c7);})[_0xea30('0x23')](function(_0x285d43){_0x1dc3a4['rows']=_0x285d43;return _0x1dc3a4;});}})[_0xea30('0x23')](respondWithFilteredResult(_0x34df11,_0x40e1c7))[_0xea30('0x2e')](handleError(_0x34df11,null));};exports[_0xea30('0x6a')]=function(_0x1fc25d,_0x5868c9,_0x4fea14){return db[_0xea30('0x44')]['find']({'where':{'id':_0x1fc25d[_0xea30('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5868c9,null))[_0xea30('0x23')](function(_0x239e3a){if(_0x239e3a){return _0x239e3a[_0xea30('0x6a')](_0x1fc25d[_0xea30('0x4a')]['ids']);}})['then'](respondWithStatusCode(_0x5868c9,null))[_0xea30('0x2e')](handleError(_0x5868c9,null));};exports[_0xea30('0x6b')]=function(_0x1bda5d,_0x3cb43a,_0x4e69b9){if(_0x1bda5d[_0xea30('0x65')]['id']){delete _0x1bda5d[_0xea30('0x65')]['id'];}return db[_0xea30('0x44')][_0xea30('0x60')]({'where':{'id':_0x1bda5d[_0xea30('0x5e')]['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x3cb43a,null))[_0xea30('0x23')](function(_0x1f5f06){if(_0x1f5f06){_0x1bda5d[_0xea30('0x65')]['WhatsappAccountId']=_0x1f5f06['id'];return db[_0xea30('0x6c')][_0xea30('0x61')](_0x1bda5d['body']);}})['then'](respondWithResult(_0x3cb43a,null))[_0xea30('0x2e')](handleError(_0x3cb43a,null));};exports[_0xea30('0x6d')]=function(_0xc79d4c,_0x21dedf,_0x24c27a){var _0x43d758={'raw':![],'where':{}};var _0x47f98f={};var _0x15fe8d={'count':0x0,'rows':[]};return db[_0xea30('0x44')][_0xea30('0x68')]({'where':{'id':_0xc79d4c[_0xea30('0x5e')]['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x21dedf,null))[_0xea30('0x23')](function(_0x21661e){if(_0x21661e){_0x47f98f[_0xea30('0x49')]=_[_0xea30('0x4b')](db[_0xea30('0x6c')][_0xea30('0x45')]);_0x47f98f[_0xea30('0x4a')]=_[_0xea30('0x4b')](_0xc79d4c[_0xea30('0x4a')]);_0x47f98f[_0xea30('0x55')]=_[_0xea30('0x4c')](_0x47f98f['model'],_0x47f98f['query']);_0x43d758['attributes']=_[_0xea30('0x4c')](_0x47f98f['model'],qs[_0xea30('0x4d')](_0xc79d4c[_0xea30('0x4a')][_0xea30('0x4d')]));_0x43d758[_0xea30('0x4e')]=_0x43d758['attributes'][_0xea30('0x4f')]?_0x43d758[_0xea30('0x4e')]:_0x47f98f[_0xea30('0x49')];if(!_0xc79d4c[_0xea30('0x4a')][_0xea30('0x50')](_0xea30('0x51'))){_0x43d758[_0xea30('0x35')]=qs[_0xea30('0x35')](_0xc79d4c[_0xea30('0x4a')][_0xea30('0x35')]);_0x43d758[_0xea30('0x33')]=qs[_0xea30('0x33')](_0xc79d4c['query'][_0xea30('0x33')]);}_0x43d758[_0xea30('0x52')]=qs[_0xea30('0x53')](_0xc79d4c['query'][_0xea30('0x53')]);_0x43d758[_0xea30('0x54')]=qs[_0xea30('0x55')](_[_0xea30('0x56')](_0xc79d4c[_0xea30('0x4a')],_0x47f98f[_0xea30('0x55')]));_0x43d758['where'][_0xea30('0x69')]=_0x21661e['id'];if(_0xc79d4c['query'][_0xea30('0x58')]){_0x43d758[_0xea30('0x54')]=_[_0xea30('0x59')](_0x43d758['where'],{'$or':_[_0xea30('0x43')](_0x43d758['attributes'],function(_0x3825cd){var _0x477cde={};_0x477cde[_0x3825cd]={'$like':'%'+_0xc79d4c[_0xea30('0x4a')][_0xea30('0x58')]+'%'};return _0x477cde;})});}_0x43d758=_[_0xea30('0x59')]({},_0x43d758,_0xc79d4c[_0xea30('0x5a')]);return db['CannedAnswer']['count']({'where':_0x43d758['where']})[_0xea30('0x23')](function(_0x43bf92){_0x15fe8d[_0xea30('0x36')]=_0x43bf92;if(_0xc79d4c['query'][_0xea30('0x5b')]){_0x43d758[_0xea30('0x5f')]=[{'all':!![]}];}return db[_0xea30('0x6c')][_0xea30('0x5c')](_0x43d758);})['then'](function(_0x33c465){_0x15fe8d[_0xea30('0x6e')]=_0x33c465;return _0x15fe8d;});}})['then'](respondWithFilteredResult(_0x21dedf,_0x43d758))[_0xea30('0x2e')](handleError(_0x21dedf,null));};exports[_0xea30('0x6f')]=function(_0x120bdf,_0x5ebc80,_0x4277e7){return db[_0xea30('0x44')][_0xea30('0x60')]({'where':{'id':_0x120bdf['params']['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x5ebc80,null))[_0xea30('0x23')](function(_0x344f26){if(_0x344f26){return _0x344f26['removeAnswers'](_0x120bdf['query'][_0xea30('0x70')]);}})['then'](respondWithStatusCode(_0x5ebc80,null))['catch'](handleError(_0x5ebc80,null));};exports[_0xea30('0x71')]=function(_0x48363b,_0x5045a7,_0xba517f){return db[_0xea30('0x44')][_0xea30('0x60')]({'where':{'id':_0x48363b[_0xea30('0x5e')]['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x5045a7,null))['then'](function(_0x2e768c){if(_0x2e768c){return _0x2e768c[_0xea30('0x71')](_0x48363b[_0xea30('0x65')][_0xea30('0x70')],_['omit'](_0x48363b[_0xea30('0x65')],['ids','id'])||{})[_0xea30('0x72')](function(_0x23a939){for(var _0x507c7b=0x0;_0x507c7b<_0x48363b[_0xea30('0x65')][_0xea30('0x70')]['length'];_0x507c7b+=0x1){socket[_0xea30('0x73')](_0xea30('0x74'),{'UserId':Number(_0x48363b['body'][_0xea30('0x70')][_0x507c7b]),'WhatsappAccountId':Number(_0x48363b[_0xea30('0x5e')]['id'])});}return _0x23a939;});}})[_0xea30('0x23')](respondWithResult(_0x5045a7,null))[_0xea30('0x2e')](handleError(_0x5045a7,null));};exports[_0xea30('0x75')]=function(_0x3e3e8a,_0x3904e5,_0x22e372){return db[_0xea30('0x44')][_0xea30('0x60')]({'where':{'id':_0x3e3e8a['params']['id']}})['then'](handleEntityNotFound(_0x3904e5,null))['then'](function(_0x51b1fc){if(_0x51b1fc){return _0x51b1fc['removeAgents'](_0x3e3e8a[_0xea30('0x4a')][_0xea30('0x70')])['then'](function(){if(_[_0xea30('0x76')](_0x3e3e8a[_0xea30('0x4a')][_0xea30('0x70')])){for(var _0x361d35=0x0;_0x361d35<_0x3e3e8a['query'][_0xea30('0x70')]['length'];_0x361d35+=0x1){socket['emit'](_0xea30('0x77'),{'UserId':Number(_0x3e3e8a[_0xea30('0x4a')][_0xea30('0x70')][_0x361d35]),'WhatsappAccountId':Number(_0x3e3e8a[_0xea30('0x5e')]['id'])});}}else{socket[_0xea30('0x73')](_0xea30('0x77'),{'UserId':Number(_0x3e3e8a[_0xea30('0x4a')][_0xea30('0x70')]),'WhatsappAccountId':Number(_0x3e3e8a[_0xea30('0x5e')]['id'])});}});}})[_0xea30('0x23')](respondWithStatusCode(_0x3904e5,null))[_0xea30('0x2e')](handleError(_0x3904e5,null));};exports[_0xea30('0x78')]=function(_0x992636,_0x2d58bf,_0x5b702a){var _0x868fae={};var _0x47adab={};var _0x578f24;var _0xf5641e;return db['WhatsappAccount']['findOne']({'where':{'id':_0x992636[_0xea30('0x5e')]['id']}})[_0xea30('0x23')](handleEntityNotFound(_0x2d58bf,null))['then'](function(_0x2e9db4){if(_0x2e9db4){_0x578f24=_0x2e9db4;_0x47adab[_0xea30('0x49')]=_[_0xea30('0x4b')](db[_0xea30('0x79')][_0xea30('0x45')]);_0x47adab[_0xea30('0x4a')]=_[_0xea30('0x4b')](_0x992636[_0xea30('0x4a')]);_0x47adab[_0xea30('0x55')]=_[_0xea30('0x4c')](_0x47adab[_0xea30('0x49')],_0x47adab['query']);_0x868fae['attributes']=_[_0xea30('0x4c')](_0x47adab[_0xea30('0x49')],qs['fields'](_0x992636['query'][_0xea30('0x4d')]));_0x868fae[_0xea30('0x4e')]=_0x868fae[_0xea30('0x4e')][_0xea30('0x4f')]?_0x868fae[_0xea30('0x4e')]:_0x47adab['model'];_0x868fae[_0xea30('0x52')]=qs[_0xea30('0x53')](_0x992636[_0xea30('0x4a')][_0xea30('0x53')]);_0x868fae[_0xea30('0x54')]=qs[_0xea30('0x55')](_['pick'](_0x992636[_0xea30('0x4a')],_0x47adab['filters']));if(_0x992636['query'][_0xea30('0x58')]){_0x868fae['where']=_[_0xea30('0x59')](_0x868fae['where'],{'$or':_[_0xea30('0x43')](_0x868fae[_0xea30('0x4e')],function(_0xe06c9f){var _0x4bb373={};_0x4bb373[_0xe06c9f]={'$like':'%'+_0x992636[_0xea30('0x4a')][_0xea30('0x58')]+'%'};return _0x4bb373;})});}_0x868fae=_['merge']({},_0x868fae,_0x992636[_0xea30('0x5a')]);return _0x578f24[_0xea30('0x78')](_0x868fae);}})[_0xea30('0x23')](function(_0x3e9ce8){if(_0x3e9ce8){_0xf5641e=_0x3e9ce8[_0xea30('0x4f')];if(!_0x992636[_0xea30('0x4a')][_0xea30('0x50')](_0xea30('0x51'))){_0x868fae[_0xea30('0x35')]=qs[_0xea30('0x35')](_0x992636[_0xea30('0x4a')][_0xea30('0x35')]);_0x868fae[_0xea30('0x33')]=qs[_0xea30('0x33')](_0x992636[_0xea30('0x4a')][_0xea30('0x33')]);}return _0x578f24['getAgents'](_0x868fae);}})[_0xea30('0x23')](function(_0x3c4ed6){if(_0x3c4ed6){return _0x3c4ed6?{'count':_0xf5641e,'rows':_0x3c4ed6}:null;}})[_0xea30('0x23')](respondWithResult(_0x2d58bf,null))[_0xea30('0x2e')](handleError(_0x2d58bf,null));};exports[_0xea30('0x7a')]=function(_0x4a17db,_0xae4f7d){var _0x42d21b=_0x4a17db['params']['id'];var _0x43657a=_0x4a17db[_0xea30('0x65')];var _0x332748=0xc8;var _0x5c78b3=null;return db[_0xea30('0x7b')][_0xea30('0x7c')]({'isolationLevel':db['sequelize'][_0xea30('0x7d')][_0xea30('0x7e')][_0xea30('0x7f')]},function(_0x4a3bf0){return db[_0xea30('0x44')][_0xea30('0x68')]({'where':{'id':_0x42d21b},'transaction':_0x4a3bf0})[_0xea30('0x23')](function(_0x2de105){if(_0x2de105){return db[_0xea30('0x80')][_0xea30('0x3d')]({'where':{'WhatsappAccountId':_0x42d21b},'transaction':_0x4a3bf0})[_0xea30('0x23')](function(){var _0xb16e6e=_[_0xea30('0x43')](_0x43657a,function(_0x332945){_0x332945['WhatsappAccountId']=_0x42d21b;return _0x332945;});return db['WhatsappApplication'][_0xea30('0x81')](_0xb16e6e,{'transaction':_0x4a3bf0});});}else{_0x332748=0x194;_0x5c78b3=[];}});})['then'](function(){if(_0x332748!==0x194){return db[_0xea30('0x80')][_0xea30('0x82')]({'where':{'WhatsappAccountId':_0x42d21b},'order':_0xea30('0x83')})[_0xea30('0x23')](function(_0x5645aa){_0x5c78b3=_0x5645aa;});}})[_0xea30('0x2e')](function(_0x1497cb){_0x332748=0x1f4;logger[_0xea30('0x2a')](_0x1497cb[_0xea30('0x3e')]);if(_0x1497cb['name']){delete _0x1497cb[_0xea30('0x3f')];}_0x5c78b3=_0x1497cb;})[_0xea30('0x84')](function(){if(_0x5c78b3===null){_0xae4f7d[_0xea30('0x2f')](_0x332748);}else{if(_0x332748===0x1f4){_0xae4f7d[_0xea30('0x30')](_0x332748)[_0xea30('0x40')](_0x5c78b3);}else{_0xae4f7d[_0xea30('0x30')](_0x332748)[_0xea30('0x32')](_0x5c78b3);}}});};exports[_0xea30('0x85')]=function(_0x331274,_0x415350,_0x4533dd){var _0x2df8ff={};var _0x4b49ba={};var _0x46b6e5;var _0x1d5f40;return db[_0xea30('0x44')][_0xea30('0x68')]({'where':{'id':_0x331274[_0xea30('0x5e')]['id']}})['then'](handleEntityNotFound(_0x415350,null))['then'](function(_0x2e0473){if(_0x2e0473){_0x46b6e5=_0x2e0473;_0x4b49ba[_0xea30('0x49')]=_[_0xea30('0x4b')](db[_0xea30('0x80')][_0xea30('0x45')]);_0x4b49ba[_0xea30('0x4a')]=_[_0xea30('0x4b')](_0x331274[_0xea30('0x4a')]);_0x4b49ba[_0xea30('0x55')]=_[_0xea30('0x4c')](_0x4b49ba[_0xea30('0x49')],_0x4b49ba[_0xea30('0x4a')]);_0x2df8ff[_0xea30('0x4e')]=_[_0xea30('0x4c')](_0x4b49ba[_0xea30('0x49')],qs[_0xea30('0x4d')](_0x331274[_0xea30('0x4a')]['fields']));_0x2df8ff[_0xea30('0x4e')]=_0x2df8ff[_0xea30('0x4e')][_0xea30('0x4f')]?_0x2df8ff[_0xea30('0x4e')]:_0x4b49ba['model'];_0x2df8ff['order']=qs[_0xea30('0x53')](_0x331274[_0xea30('0x4a')][_0xea30('0x53')]);_0x2df8ff['where']=qs[_0xea30('0x55')](_['pick'](_0x331274[_0xea30('0x4a')],_0x4b49ba[_0xea30('0x55')]));if(_0x331274[_0xea30('0x4a')][_0xea30('0x58')]){_0x2df8ff[_0xea30('0x54')]=_[_0xea30('0x59')](_0x2df8ff[_0xea30('0x54')],{'$or':_[_0xea30('0x43')](_0x2df8ff[_0xea30('0x4e')],function(_0x1f3fbb){var _0x4345ee={};_0x4345ee[_0x1f3fbb]={'$like':'%'+_0x331274[_0xea30('0x4a')][_0xea30('0x58')]+'%'};return _0x4345ee;})});}_0x2df8ff=_['merge']({},_0x2df8ff,_0x331274['options']);return _0x46b6e5[_0xea30('0x85')](_0x2df8ff);}})[_0xea30('0x23')](function(_0x2fae9a){if(_0x2fae9a){_0x1d5f40=_0x2fae9a['length'];if(!_0x331274[_0xea30('0x4a')][_0xea30('0x50')](_0xea30('0x51'))){_0x2df8ff['limit']=qs[_0xea30('0x35')](_0x331274[_0xea30('0x4a')][_0xea30('0x35')]);_0x2df8ff[_0xea30('0x33')]=qs[_0xea30('0x33')](_0x331274[_0xea30('0x4a')][_0xea30('0x33')]);}return _0x46b6e5['getApplications'](_0x2df8ff);}})[_0xea30('0x23')](function(_0x2313f5){if(_0x2313f5){return _0x2313f5?{'count':_0x1d5f40,'rows':_0x2313f5}:null;}})[_0xea30('0x23')](respondWithResult(_0x415350,null))[_0xea30('0x2e')](handleError(_0x415350,null));};exports[_0xea30('0x86')]=function(_0x336010,_0x22d508,_0xa0890e){var _0x5a9436={'channel':_0xea30('0x87')};var _0x2df347=[];var _0x46f0a4=[];var _0x935032={};return db[_0xea30('0x44')]['find']({'where':{'id':_0x336010[_0xea30('0x5e')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xea30('0x88')}]})[_0xea30('0x23')](handleEntityNotFound(_0x22d508,null))[_0xea30('0x23')](function(_0x45092a){_0x5a9436[_0xea30('0x89')]=_0x45092a;if(_0x5a9436[_0xea30('0x89')]&&_0x5a9436['account'][_0xea30('0x47')]===_0xea30('0x8a')&&_0x336010['body']['statuses']){if(_0x336010[_0xea30('0x65')][_0xea30('0x8b')][_0xea30('0x4f')]===0x0)return;if(_0x336010[_0xea30('0x65')][_0xea30('0x8b')][0x0][_0xea30('0x8c')]!=='read')return;return db['WhatsappMessage'][_0xea30('0x39')]({'read':!![],'readAt':_0x336010[_0xea30('0x65')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x336010[_0xea30('0x65')][_0xea30('0x8b')][0x0][_0xea30('0x8d')]},'individualHooks':!![]})[_0xea30('0x23')](function(_0x3471bb){return _0x22d508['status'](0xc8)[_0xea30('0x32')](_0x3471bb);});}_0x5a9436[_0xea30('0x8e')]=_[_0xea30('0x8f')](_0x45092a[_0xea30('0x88')],[_0xea30('0x83')],[_0xea30('0x90')]);if(_0x5a9436[_0xea30('0x89')][_0xea30('0x88')]){delete _0x5a9436['account'][_0xea30('0x88')];}return db[_0xea30('0x91')][_0xea30('0x92')]()['then'](function(_0x2901e5){if(!_0x2901e5){throw new db[(_0xea30('0x93'))][(_0xea30('0x94'))]('no\x20available\x20attributes');}_0x2df347=_[_0xea30('0x95')](_[_0xea30('0x4b')](_0x2901e5),[_0xea30('0x96'),_0xea30('0x97')]);_0x46f0a4=_[_0xea30('0x95')](_[_0xea30('0x4b')](_0x2901e5),[_0xea30('0x96'),_0xea30('0x97'),_0xea30('0x98'),_0xea30('0x99')]);_0x5a9436[_0xea30('0x65')]={'mapKey':_0xea30('0x9a')};if(_0x5a9436[_0xea30('0x89')]&&_0x5a9436[_0xea30('0x89')]['type']===_0xea30('0x9b')){_0x5a9436[_0xea30('0x65')][_0xea30('0x9c')]=_0x336010[_0xea30('0x65')][_0xea30('0x9d')][_0xea30('0x9e')](_0xea30('0x9f'),'');_0x5a9436[_0xea30('0x65')][_0xea30('0x65')]=_0x336010[_0xea30('0x65')][_0xea30('0xa0')];_0x5a9436[_0xea30('0x65')]['messageId']=_0x336010['body'][_0xea30('0xa1')];}if(_0x5a9436[_0xea30('0x89')]&&_0x5a9436[_0xea30('0x89')]['type']==='sinch'){_0x5a9436[_0xea30('0x65')]['from']=_0x336010[_0xea30('0x65')][_0xea30('0xa2')][0x0]['from'];_0x5a9436['body'][_0xea30('0x65')]=_0x336010[_0xea30('0x65')][_0xea30('0xa2')][0x0]['message'][_0xea30('0x65')];_0x5a9436[_0xea30('0x65')][_0xea30('0xa3')]=_0x336010[_0xea30('0x65')][_0xea30('0xa2')][0x0][_0xea30('0x8d')];}if(_0x5a9436[_0xea30('0x65')]['id']){delete _0x5a9436[_0xea30('0x65')]['id'];}if(_['isNil'](_0x5a9436[_0xea30('0x65')][_0xea30('0x9c')])){throw new db[(_0xea30('0x93'))][(_0xea30('0x94'))](_0xea30('0xa4'));}if(_[_0xea30('0xa5')](_0x5a9436[_0xea30('0x65')]['body'])||_0x5a9436[_0xea30('0x65')]['body']===''){throw new db[(_0xea30('0x93'))][(_0xea30('0x94'))](_0xea30('0xa6'));}if(_['isNil'](_0x5a9436[_0xea30('0x65')][_0xea30('0xa7')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x46f0a4);}if(!_[_0xea30('0xa8')](_0x46f0a4,_0x5a9436['body'][_0xea30('0xa7')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x46f0a4);}_0x935032[_0x5a9436[_0xea30('0x65')]['mapKey']]=_0x5a9436[_0xea30('0x65')][_0xea30('0x9c')];return db[_0xea30('0xa9')][_0xea30('0x60')]({'where':{'id':_0x5a9436[_0xea30('0x89')][_0xea30('0x99')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x935032,'limit':0x1,'order':[[_0xea30('0x97'),_0xea30('0xaa')]]}]});})[_0xea30('0x23')](handleEntityNotFound(_0x22d508,null))[_0xea30('0x23')](function(_0x330fcd){if(_0x330fcd){_0x5a9436[_0xea30('0xab')]=_[_0xea30('0xac')](_0x330fcd,[_0xea30('0xad')]);if(_0x330fcd[_0xea30('0xad')]['length']){return _0x330fcd[_0xea30('0xad')][0x0];}var _0x176664=_[_0xea30('0x1b')](_0x5a9436[_0xea30('0x65')],{'firstName':_0x5a9436[_0xea30('0x65')][_0xea30('0x9c')],'ListId':_0x330fcd['id']});_0x176664[_0x5a9436[_0xea30('0x65')][_0xea30('0xa7')]]=_0x5a9436[_0xea30('0x65')]['from'];return db[_0xea30('0x91')]['create'](_0x176664,{'fields':_0x2df347,'raw':!![]});}})[_0xea30('0x23')](handleEntityNotFound(_0x22d508,null))['then'](function(_0xd9cd39){if(_0xd9cd39){_0x5a9436[_0xea30('0xae')]=_0xd9cd39;var _0x43d585={'ContactId':_0xd9cd39['id'],'phone':_0x5a9436[_0xea30('0x65')][_0xea30('0x9c')],'WhatsappAccountId':_0x336010[_0xea30('0x5e')]['id']};var _0x278169={'ContactId':_0xd9cd39['id'],'WhatsappAccountId':_0x336010['params']['id'],'closed':![]};return db[_0xea30('0xaf')]['find']({'where':_0x278169})[_0xea30('0x23')](function(_0xb45547){if(_0xb45547){return[_0xb45547,![]];}return db[_0xea30('0xaf')][_0xea30('0x61')](_0x43d585)[_0xea30('0x23')](function(_0x48892c){return[_0x48892c,!![]];});});}})[_0xea30('0x72')](function(_0x34ec53,_0x40cd96){_0x5a9436[_0xea30('0xb0')]=_0x34ec53[_0xea30('0x3a')]({'plain':!![]});_0x5a9436[_0xea30('0xb0')][_0xea30('0xb1')]=![];if(_0x40cd96){if(_0x5a9436['account'][_0xea30('0xb2')]){_0x5a9436[_0xea30('0x8e')]['push']({'id':0x0,'priority':_0x5a9436[_0xea30('0x8e')][_0xea30('0x4f')]+0x1,'app':_0xea30('0xb3'),'appdata':_0xea30('0xb4'),'interval':'*,*,*,*'});}_0x5a9436[_0xea30('0xb0')][_0xea30('0xb1')]=!![];}return db[_0xea30('0xb5')][_0xea30('0x61')]({'phone':_0x5a9436[_0xea30('0x65')]['from'],'messageId':_0x5a9436[_0xea30('0x65')][_0xea30('0xa3')],'body':_0x5a9436[_0xea30('0x65')][_0xea30('0x65')],'WhatsappAccountId':_0x336010[_0xea30('0x5e')]['id'],'WhatsappInteractionId':_0x34ec53['id'],'direction':'in','ContactId':_0x34ec53[_0xea30('0xb6')],'AttachmentId':_0x5a9436[_0xea30('0x65')][_0xea30('0xb7')]});})[_0xea30('0x23')](function(_0x14cee2){_0x5a9436[_0xea30('0x2c')]=_0x14cee2;if(!_0x5a9436[_0xea30('0xb0')][_0xea30('0xb8')])return;return db[_0xea30('0x79')][_0xea30('0x60')]({'attributes':['id','name'],'where':{'id':_0x5a9436['interaction'][_0xea30('0xb8')]}});})[_0xea30('0x23')](function(_0x50c1f1){if(_0x50c1f1){_0x5a9436[_0xea30('0x8e')][_0xea30('0xb9')]({'id':0x0,'priority':0x0,'app':_0xea30('0xba'),'appdata':_0x50c1f1[_0xea30('0x3f')]+','+(_0x5a9436[_0xea30('0x89')]['waitForTheAssignedAgent']||0xa),'interval':_0xea30('0xbb')});}if(!_0x5a9436[_0xea30('0xb0')]['queueId'])return;return db['WhatsappQueue'][_0xea30('0x60')]({'attributes':['id','name'],'where':{'id':_0x5a9436[_0xea30('0xb0')][_0xea30('0xbc')]}});})['then'](function(_0x4a88e7){if(_0x4a88e7){_0x5a9436[_0xea30('0x8e')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4a88e7[_0xea30('0x3f')]+','+(_0x5a9436['account'][_0xea30('0xbd')]||0x12c),'interval':_0xea30('0xbb')});}return respondWithRpcPromise(_0xea30('0xbe'),_0xea30('0xbf'),_0x5a9436);})[_0xea30('0x23')](function(_0x4f4a7f){if(_0x4f4a7f){var _0x218349=0xc8;var _0x4a4195=_0xea30('0xc0');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4a4195,_0x218349,_0xea30('0xc1'));logger['debug'](_0xea30('0xc2'),_0x4a4195,_0x218349,_0xea30('0xc1'),JSON[_0xea30('0x29')](_0x4f4a7f));if(_0x5a9436[_0xea30('0x89')][_0xea30('0x47')]===_0xea30('0x9b')){return _0x22d508[_0xea30('0x30')](_0x218349)[_0xea30('0xc3')](_0xea30('0xc4'),_0xea30('0xc5'))[_0xea30('0x40')](_0xea30('0xc6'));}else{return _0x22d508[_0xea30('0x30')](_0x218349)[_0xea30('0x32')](_0x4f4a7f);}}});})[_0xea30('0x2e')](handleError(_0x22d508,null));};exports[_0xea30('0x40')]=function(_0xe8ddd5,_0x2b9266,_0x206e19){var _0x34f23f,_0x15519d,_0x31e386;if(_[_0xea30('0xa5')](_0xe8ddd5[_0xea30('0x65')][_0xea30('0x65')])||_0xe8ddd5['body'][_0xea30('0x65')]===''){throw new db[(_0xea30('0x93'))][(_0xea30('0x94'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xea30('0xa5')](_0xe8ddd5[_0xea30('0x65')]['to'])){throw new db[(_0xea30('0x93'))][(_0xea30('0x94'))](_0xea30('0xc7'));}_0x34f23f=_0xe8ddd5[_0xea30('0x65')]['to'];return db[_0xea30('0x44')]['find']({'where':{'id':_0xe8ddd5[_0xea30('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0xea30('0xc8'),'include':[{'model':db[_0xea30('0x91')],'as':_0xea30('0xad'),'where':{'mobile':_0x34f23f},'limit':0x1,'order':[[_0xea30('0x97'),_0xea30('0xaa')]]}]}]})[_0xea30('0x23')](handleEntityNotFound(_0x2b9266,null))[_0xea30('0x23')](function(_0x35c435){if(_0x35c435&&_0x35c435[_0xea30('0xc8')]){_0x15519d=_0x35c435[_0xea30('0x3a')]({'plain':!![]});if(_0x15519d['List']&&_0x15519d[_0xea30('0xc8')][_0xea30('0xad')]['length']){return _0x15519d['List'][_0xea30('0xad')][0x0];}return db[_0xea30('0x91')]['create'](_[_0xea30('0x1b')](_0xe8ddd5[_0xea30('0x65')],{'firstName':_0x34f23f,'mobile':_0x34f23f,'phone':_0x34f23f,'ListId':_0x15519d['ListId']}));}})[_0xea30('0x23')](handleEntityNotFound(_0x2b9266,null))[_0xea30('0x23')](function(_0x41cf59){if(_0x41cf59){_0x31e386=_0x41cf59;return db[_0xea30('0xaf')][_0xea30('0x60')]({'where':{'ContactId':_0x31e386['id'],'closed':![],'WhatsappAccountId':_0x15519d['id']}})['then'](function(_0x1a825c){if(_0x1a825c){return[_0x1a825c,![]];}return db['WhatsappInteraction'][_0xea30('0x61')]({'UserId':_0xe8ddd5[_0xea30('0x62')]['id'],'ContactId':_0x31e386['id'],'WhatsappAccountId':_0x15519d['id'],'phone':_0x34f23f,'firstMsgDirection':'out','Messages':[_[_0xea30('0x59')](_0xe8ddd5['body'],{'read':![],'body':_0xe8ddd5['body'][_0xea30('0x65')],'phone':_0x34f23f,'WhatsappAccountId':_0x15519d['id'],'UserId':_0xe8ddd5['user']['id'],'ContactId':_0x31e386['id']})]},{'include':[{'model':db[_0xea30('0xb5')],'as':_0xea30('0xc9')}]})[_0xea30('0x23')](function(_0x576125){return[_0x576125,!![]];});});}})[_0xea30('0x72')](function(_0x372444,_0x4e3a65){if(_0x4e3a65){return _0x372444;}return db[_0xea30('0xb5')][_0xea30('0x61')](_[_0xea30('0x59')](_0xe8ddd5['body'],{'read':![],'body':_0xe8ddd5[_0xea30('0x65')][_0xea30('0x65')],'phone':_0x34f23f,'WhatsappAccountId':_0x15519d['id'],'WhatsappInteractionId':_0x372444['id'],'UserId':_0xe8ddd5[_0xea30('0x62')]['id'],'ContactId':_0x31e386['id']}))['then'](function(_0x43a69d){_0x372444[_0xea30('0xca')][_0xea30('0xc9')]=[];_0x372444[_0xea30('0xca')]['Messages'][_0xea30('0xcb')](_0x43a69d[_0xea30('0xca')]);return _0x372444;});})['then'](respondWithResult(_0x2b9266,null))[_0xea30('0x2e')](handleError(_0x2b9266,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index b2804ce..20f7f5d 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 _0x57a5=['WhatsappAccount','setMaxListeners','save','update','emit','exports','events','../../mysqldb'];(function(_0x363f1e,_0xc78534){var _0x188981=function(_0x31705b){while(--_0x31705b){_0x363f1e['push'](_0x363f1e['shift']());}};_0x188981(++_0xc78534);}(_0x57a5,0x9e));var _0x557a=function(_0x7e1796,_0x40c0d9){_0x7e1796=_0x7e1796-0x0;var _0x55288b=_0x57a5[_0x7e1796];return _0x55288b;};'use strict';var EventEmitter=require(_0x557a('0x0'));var WhatsappAccount=require(_0x557a('0x1'))['db'][_0x557a('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x557a('0x3')](0x0);var events={'afterCreate':_0x557a('0x4'),'afterUpdate':_0x557a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x545a55){return function(_0x4b7813,_0x705b74,_0x53c56c){WhatsappAccountEvents[_0x557a('0x6')](_0x545a55+':'+_0x4b7813['id'],_0x4b7813);WhatsappAccountEvents[_0x557a('0x6')](_0x545a55,_0x4b7813);_0x53c56c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x557a('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x1e5d=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x415ac5,_0x3c52ba){var _0xc14ef7=function(_0x2ad213){while(--_0x2ad213){_0x415ac5['push'](_0x415ac5['shift']());}};_0xc14ef7(++_0x3c52ba);}(_0x1e5d,0x19a));var _0xd1e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1e5d[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xd1e5('0x0'));var WhatsappAccount=require(_0xd1e5('0x1'))['db'][_0xd1e5('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd1e5('0x3')](0x0);var events={'afterCreate':_0xd1e5('0x4'),'afterUpdate':_0xd1e5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1aef66){return function(_0x238b85,_0x4e4a86,_0x7c1543){WhatsappAccountEvents[_0xd1e5('0x6')](_0x1aef66+':'+_0x238b85['id'],_0x238b85);WhatsappAccountEvents[_0xd1e5('0x6')](_0x1aef66,_0x238b85);_0x7c1543(null);};}for(var e in events){if(events[_0xd1e5('0x7')](e)){var event=events[e];WhatsappAccount[_0xd1e5('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index cdeb704..b45448b 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 _0xe757=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x5b8bdc,_0x44c7f9){var _0x3c3f4b=function(_0xc98480){while(--_0xc98480){_0x5b8bdc['push'](_0x5b8bdc['shift']());}};_0x3c3f4b(++_0x44c7f9);}(_0xe757,0x8f));var _0x7e75=function(_0x32e4de,_0x7da1c5){_0x32e4de=_0x32e4de-0x0;var _0x51ba2a=_0xe757[_0x32e4de];return _0x51ba2a;};'use strict';var _=require(_0x7e75('0x0'));var util=require(_0x7e75('0x1'));var logger=require(_0x7e75('0x2'))(_0x7e75('0x3'));var moment=require(_0x7e75('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e75('0x5'));var rimraf=require(_0x7e75('0x6'));var config=require(_0x7e75('0x7'));var attributes=require(_0x7e75('0x8'));module[_0x7e75('0x9')]=function(_0x2b2102,_0x240b25){return _0x2b2102[_0x7e75('0xa')](_0x7e75('0xb'),attributes,{'tableName':_0x7e75('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf085=['moment','request-promise','path','rimraf','./whatsappAccount.attributes','define','lodash','api'];(function(_0x402983,_0x5b1129){var _0x2dfa7e=function(_0x5d5757){while(--_0x5d5757){_0x402983['push'](_0x402983['shift']());}};_0x2dfa7e(++_0x5b1129);}(_0xf085,0x126));var _0x5f08=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0xf085[_0x9edfd5];return _0x330738;};'use strict';var _=require(_0x5f08('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5f08('0x1'));var moment=require(_0x5f08('0x2'));var BPromise=require('bluebird');var rp=require(_0x5f08('0x3'));var fs=require('fs');var path=require(_0x5f08('0x4'));var rimraf=require(_0x5f08('0x5'));var config=require('../../config/environment');var attributes=require(_0x5f08('0x6'));module['exports']=function(_0xbffbaf,_0x3736bc){return _0xbffbaf[_0x5f08('0x7')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','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 0fbde2b..267b348 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 _0xa968=['WhatsappAccount','options','where','attributes','include','map','model','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowWhatsappAccount'];(function(_0x581ab7,_0x24d129){var _0x5cf9b7=function(_0x1beb59){while(--_0x1beb59){_0x581ab7['push'](_0x581ab7['shift']());}};_0x5cf9b7(++_0x24d129);}(_0xa968,0x120));var _0x8a96=function(_0x171602,_0x48a6d6){_0x171602=_0x171602-0x0;var _0x4210aa=_0xa968[_0x171602];return _0x4210aa;};'use strict';var _=require(_0x8a96('0x0'));var util=require(_0x8a96('0x1'));var moment=require(_0x8a96('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a96('0x3'));var fs=require('fs');var Redis=require(_0x8a96('0x4'));var db=require(_0x8a96('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a96('0x6'))(_0x8a96('0x7'));var config=require(_0x8a96('0x8'));var jayson=require(_0x8a96('0x9'));var client=jayson[_0x8a96('0xa')][_0x8a96('0xb')]({'port':0x232a});config['redis']=_[_0x8a96('0xc')](config[_0x8a96('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8a96('0xd')]));require(_0x8a96('0xe'))[_0x8a96('0xf')](socket);function respondWithRpcPromise(_0x31dc5e,_0xc0944b,_0x4029da){return new BPromise(function(_0x206abd,_0x3b0422){return client['request'](_0x31dc5e,_0x4029da)[_0x8a96('0x10')](function(_0x3f9696){logger[_0x8a96('0x11')](_0x8a96('0x12'),_0xc0944b,_0x8a96('0x13'));logger[_0x8a96('0x14')](_0x8a96('0x15'),_0xc0944b,'request\x20sent',JSON['stringify'](_0x3f9696));if(_0x3f9696[_0x8a96('0x16')]){if(_0x3f9696['error'][_0x8a96('0x17')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0xc0944b,_0x3f9696[_0x8a96('0x16')]['message']);return _0x3b0422(_0x3f9696[_0x8a96('0x16')][_0x8a96('0x18')]);}logger[_0x8a96('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0xc0944b,_0x3f9696[_0x8a96('0x16')]['message']);return _0x206abd(_0x3f9696['error'][_0x8a96('0x18')]);}else{logger[_0x8a96('0x11')](_0x8a96('0x12'),_0xc0944b,_0x8a96('0x13'));_0x206abd(_0x3f9696['result'][_0x8a96('0x18')]);}})[_0x8a96('0x19')](function(_0x3f655d){logger[_0x8a96('0x16')](_0x8a96('0x12'),_0xc0944b,_0x3f655d);_0x3b0422(_0x3f655d);});});}exports[_0x8a96('0x1a')]=function(_0x4392dd){var _0x12fdc2=this;return new Promise(function(_0x2b9af6,_0x2373dd){return db[_0x8a96('0x1b')]['find']({'raw':_0x4392dd['options']?_0x4392dd['options']['raw']===undefined?!![]:![]:!![],'where':_0x4392dd[_0x8a96('0x1c')]?_0x4392dd[_0x8a96('0x1c')][_0x8a96('0x1d')]||null:null,'attributes':_0x4392dd[_0x8a96('0x1c')]?_0x4392dd['options'][_0x8a96('0x1e')]||null:null,'include':_0x4392dd[_0x8a96('0x1c')]?_0x4392dd[_0x8a96('0x1c')][_0x8a96('0x1f')]?_[_0x8a96('0x20')](_0x4392dd[_0x8a96('0x1c')]['include'],function(_0x569666){return{'model':db[_0x569666[_0x8a96('0x21')]],'as':_0x569666['as'],'attributes':_0x569666[_0x8a96('0x1e')],'include':_0x569666['include']?_[_0x8a96('0x20')](_0x569666[_0x8a96('0x1f')],function(_0x2562ec){return{'model':db[_0x2562ec[_0x8a96('0x21')]],'as':_0x2562ec['as'],'attributes':_0x2562ec[_0x8a96('0x1e')],'include':_0x2562ec[_0x8a96('0x1f')]?_[_0x8a96('0x20')](_0x2562ec[_0x8a96('0x1f')],function(_0x4d0a4a){return{'model':db[_0x4d0a4a[_0x8a96('0x21')]],'as':_0x4d0a4a['as'],'attributes':_0x4d0a4a[_0x8a96('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8a96('0x10')](function(_0x3cf203){logger[_0x8a96('0x11')]('ShowWhatsappAccount',_0x4392dd);logger[_0x8a96('0x14')]('ShowWhatsappAccount',_0x4392dd,JSON[_0x8a96('0x22')](_0x3cf203));_0x2b9af6(_0x3cf203);})[_0x8a96('0x19')](function(_0x188200){logger[_0x8a96('0x16')](_0x8a96('0x1a'),_0x188200[_0x8a96('0x18')],_0x4392dd);_0x2373dd(_0x12fdc2[_0x8a96('0x16')](0x1f4,_0x188200[_0x8a96('0x18')]));});});}; \ No newline at end of file +var _0x4fe5=['then','info','WhatsappAccount,\x20%s,\x20%s','debug','stringify','error','code','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','include','model','map','attributes','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request'];(function(_0x2e2253,_0x4dda6a){var _0x58488c=function(_0x5c9ec7){while(--_0x5c9ec7){_0x2e2253['push'](_0x2e2253['shift']());}};_0x58488c(++_0x4dda6a);}(_0x4fe5,0xbc));var _0x54fe=function(_0x4dda23,_0x5efb03){_0x4dda23=_0x4dda23-0x0;var _0x84b2ec=_0x4fe5[_0x4dda23];return _0x84b2ec;};'use strict';var _=require(_0x54fe('0x0'));var util=require('util');var moment=require(_0x54fe('0x1'));var BPromise=require(_0x54fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54fe('0x3'));var db=require(_0x54fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x54fe('0x5'));var config=require(_0x54fe('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x54fe('0x7')][_0x54fe('0x8')]({'port':0x232a});config[_0x54fe('0x9')]=_[_0x54fe('0xa')](config['redis'],{'host':_0x54fe('0xb'),'port':0x18eb});var socket=require(_0x54fe('0xc'))(new Redis(config['redis']));require(_0x54fe('0xd'))[_0x54fe('0xe')](socket);function respondWithRpcPromise(_0xf26262,_0x360e24,_0x393ded){return new BPromise(function(_0xe96b1f,_0x33a10d){return client[_0x54fe('0xf')](_0xf26262,_0x393ded)[_0x54fe('0x10')](function(_0x3c1cd3){logger[_0x54fe('0x11')](_0x54fe('0x12'),_0x360e24,'request\x20sent');logger[_0x54fe('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x360e24,'request\x20sent',JSON[_0x54fe('0x14')](_0x3c1cd3));if(_0x3c1cd3[_0x54fe('0x15')]){if(_0x3c1cd3['error'][_0x54fe('0x16')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x360e24,_0x3c1cd3[_0x54fe('0x15')][_0x54fe('0x17')]);return _0x33a10d(_0x3c1cd3[_0x54fe('0x15')][_0x54fe('0x17')]);}logger[_0x54fe('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x360e24,_0x3c1cd3[_0x54fe('0x15')][_0x54fe('0x17')]);return _0xe96b1f(_0x3c1cd3[_0x54fe('0x15')][_0x54fe('0x17')]);}else{logger[_0x54fe('0x11')](_0x54fe('0x12'),_0x360e24,'request\x20sent');_0xe96b1f(_0x3c1cd3[_0x54fe('0x18')][_0x54fe('0x17')]);}})['catch'](function(_0x2c2819){logger[_0x54fe('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x360e24,_0x2c2819);_0x33a10d(_0x2c2819);});});}exports[_0x54fe('0x19')]=function(_0x15fac5){var _0xa223c2=this;return new Promise(function(_0x178c3e,_0x305b26){return db[_0x54fe('0x1a')][_0x54fe('0x1b')]({'raw':_0x15fac5[_0x54fe('0x1c')]?_0x15fac5[_0x54fe('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x15fac5[_0x54fe('0x1c')]?_0x15fac5[_0x54fe('0x1c')]['where']||null:null,'attributes':_0x15fac5[_0x54fe('0x1c')]?_0x15fac5[_0x54fe('0x1c')]['attributes']||null:null,'include':_0x15fac5['options']?_0x15fac5[_0x54fe('0x1c')][_0x54fe('0x1d')]?_['map'](_0x15fac5[_0x54fe('0x1c')][_0x54fe('0x1d')],function(_0x4228b8){return{'model':db[_0x4228b8[_0x54fe('0x1e')]],'as':_0x4228b8['as'],'attributes':_0x4228b8['attributes'],'include':_0x4228b8[_0x54fe('0x1d')]?_[_0x54fe('0x1f')](_0x4228b8[_0x54fe('0x1d')],function(_0xf7739e){return{'model':db[_0xf7739e[_0x54fe('0x1e')]],'as':_0xf7739e['as'],'attributes':_0xf7739e[_0x54fe('0x20')],'include':_0xf7739e[_0x54fe('0x1d')]?_[_0x54fe('0x1f')](_0xf7739e['include'],function(_0x5aa96c){return{'model':db[_0x5aa96c[_0x54fe('0x1e')]],'as':_0x5aa96c['as'],'attributes':_0x5aa96c[_0x54fe('0x20')]};}):[]};}):[]};}):[]:[]})[_0x54fe('0x10')](function(_0x15aa15){logger[_0x54fe('0x11')](_0x54fe('0x19'),_0x15fac5);logger[_0x54fe('0x13')](_0x54fe('0x19'),_0x15fac5,JSON[_0x54fe('0x14')](_0x15aa15));_0x178c3e(_0x15aa15);})[_0x54fe('0x21')](function(_0x5322a6){logger[_0x54fe('0x15')](_0x54fe('0x19'),_0x5322a6['message'],_0x15fac5);_0x305b26(_0xa223c2[_0x54fe('0x15')](0x1f4,_0x5322a6[_0x54fe('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 6b60510..e3fb623 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 _0xf533=['whatsappAccount:','./whatsappAccount.events','save','update','removeListener','register','length'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf533,0xd3));var _0x3f53=function(_0x131e60,_0x5352ce){_0x131e60=_0x131e60-0x0;var _0x4bc497=_0xf533[_0x131e60];return _0x4bc497;};'use strict';var WhatsappAccountEvents=require(_0x3f53('0x0'));var events=[_0x3f53('0x1'),'remove',_0x3f53('0x2')];function createListener(_0x5cb340,_0xc2bd14){return function(_0x52532e){_0xc2bd14['emit'](_0x5cb340,_0x52532e);};}function removeListener(_0x3c2496,_0x1599d9){return function(){WhatsappAccountEvents[_0x3f53('0x3')](_0x3c2496,_0x1599d9);};}exports[_0x3f53('0x4')]=function(_0x477629){for(var _0x24c461=0x0,_0x3dbae7=events[_0x3f53('0x5')];_0x24c461<_0x3dbae7;_0x24c461++){var _0x416a75=events[_0x24c461];var _0x55fde1=createListener(_0x3f53('0x6')+_0x416a75,_0x477629);WhatsappAccountEvents['on'](_0x416a75,_0x55fde1);}}; \ No newline at end of file +var _0xcbc9=['./whatsappAccount.events','remove','emit','removeListener','register','length','whatsappAccount:'];(function(_0x23161f,_0x63403f){var _0x41093a=function(_0x1244f5){while(--_0x1244f5){_0x23161f['push'](_0x23161f['shift']());}};_0x41093a(++_0x63403f);}(_0xcbc9,0xa1));var _0x9cbc=function(_0xf973b7,_0x46699f){_0xf973b7=_0xf973b7-0x0;var _0x499087=_0xcbc9[_0xf973b7];return _0x499087;};'use strict';var WhatsappAccountEvents=require(_0x9cbc('0x0'));var events=['save',_0x9cbc('0x1'),'update'];function createListener(_0x29e49a,_0x5470bd){return function(_0xf64564){_0x5470bd[_0x9cbc('0x2')](_0x29e49a,_0xf64564);};}function removeListener(_0x50090e,_0x4cf2d3){return function(){WhatsappAccountEvents[_0x9cbc('0x3')](_0x50090e,_0x4cf2d3);};}exports[_0x9cbc('0x4')]=function(_0x57ae4b){for(var _0x2e6bee=0x0,_0x1f9fee=events[_0x9cbc('0x5')];_0x2e6bee<_0x1f9fee;_0x2e6bee++){var _0x1b1b1a=events[_0x2e6bee];var _0x2f0aa8=createListener(_0x9cbc('0x6')+_0x1b1b1a,_0x57ae4b);WhatsappAccountEvents['on'](_0x1b1b1a,_0x2f0aa8);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index e987886..5b7aef5 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 _0xae68=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0xae68,0x8a));var _0x8ae6=function(_0x3ef888,_0x2a01f3){_0x3ef888=_0x3ef888-0x0;var _0x14d858=_0xae68[_0x3ef888];return _0x14d858;};'use strict';var multer=require(_0x8ae6('0x0'));var util=require(_0x8ae6('0x1'));var path=require(_0x8ae6('0x2'));var timeout=require(_0x8ae6('0x3'));var express=require(_0x8ae6('0x4'));var router=express[_0x8ae6('0x5')]();var fs_extra=require(_0x8ae6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8ae6('0x7'));var config=require(_0x8ae6('0x8'));var controller=require(_0x8ae6('0x9'));router[_0x8ae6('0xa')]('/',auth[_0x8ae6('0xb')](),controller[_0x8ae6('0xc')]);router[_0x8ae6('0xa')](_0x8ae6('0xd'),auth['isAuthenticated'](),controller[_0x8ae6('0xe')]);router[_0x8ae6('0xf')]('/',auth[_0x8ae6('0xb')](),controller[_0x8ae6('0x10')]);router[_0x8ae6('0x11')](_0x8ae6('0xd'),auth[_0x8ae6('0xb')](),controller[_0x8ae6('0x12')]);router[_0x8ae6('0x13')](_0x8ae6('0xd'),auth[_0x8ae6('0xb')](),controller[_0x8ae6('0x14')]);module[_0x8ae6('0x15')]=router; \ No newline at end of file +var _0x7e16=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0x7e16,0x6b));var _0x67e1=function(_0x451369,_0x464043){_0x451369=_0x451369-0x0;var _0x3ceab4=_0x7e16[_0x451369];return _0x3ceab4;};'use strict';var multer=require(_0x67e1('0x0'));var util=require(_0x67e1('0x1'));var path=require(_0x67e1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x67e1('0x3')]();var fs_extra=require(_0x67e1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x67e1('0x5'));var config=require(_0x67e1('0x6'));var controller=require(_0x67e1('0x7'));router[_0x67e1('0x8')]('/',auth[_0x67e1('0x9')](),controller['index']);router['get'](_0x67e1('0xa'),auth[_0x67e1('0x9')](),controller[_0x67e1('0xb')]);router[_0x67e1('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x67e1('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x67e1('0xe')]);router[_0x67e1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x67e1('0x10')]);module[_0x67e1('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 98565a0..3d839e0 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 _0xbd67=['INTEGER','noop','TEXT','STRING','sequelize','exports'];(function(_0x1f52fb,_0x238ed9){var _0x9c7680=function(_0x533c1e){while(--_0x533c1e){_0x1f52fb['push'](_0x1f52fb['shift']());}};_0x9c7680(++_0x238ed9);}(_0xbd67,0x196));var _0x7bd6=function(_0x49bb91,_0x86ecf3){_0x49bb91=_0x49bb91-0x0;var _0x2b4339=_0xbd67[_0x49bb91];return _0x2b4339;};'use strict';var Sequelize=require(_0x7bd6('0x0'));module[_0x7bd6('0x1')]={'priority':{'type':Sequelize[_0x7bd6('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7bd6('0x3')},'appdata':{'type':Sequelize[_0x7bd6('0x4')]()},'description':{'type':Sequelize[_0x7bd6('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5094=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5094,0xf2));var _0x4509=function(_0x40288d,_0x1bad3c){_0x40288d=_0x40288d-0x0;var _0x23d77a=_0x5094[_0x40288d];return _0x23d77a;};'use strict';var Sequelize=require(_0x4509('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4509('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4509('0x2')],'allowNull':![],'defaultValue':_0x4509('0x3')},'appdata':{'type':Sequelize[_0x4509('0x4')]()},'description':{'type':Sequelize[_0x4509('0x2')]},'interval':{'type':Sequelize[_0x4509('0x2')],'defaultValue':_0x4509('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 9d8fae5..edaa9df 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 _0xcaef=['type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','map','VIRTUAL','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','jsforce','desk.js','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','limit','count','set','Content-Range','apply','reject','save','update','then','name','send','fieldName'];(function(_0x379893,_0x1c7161){var _0x39cd43=function(_0x48af76){while(--_0x48af76){_0x379893['push'](_0x379893['shift']());}};_0x39cd43(++_0x1c7161);}(_0xcaef,0x1c9));var _0xfcae=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xcaef[_0x5a95fa];return _0x1a61b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfcae('0x0'));var zipdir=require(_0xfcae('0x1'));var jsonpatch=require(_0xfcae('0x2'));var rp=require(_0xfcae('0x3'));var moment=require('moment');var BPromise=require(_0xfcae('0x4'));var Mustache=require('mustache');var util=require(_0xfcae('0x5'));var path=require(_0xfcae('0x6'));var sox=require('sox');var csv=require(_0xfcae('0x7'));var ejs=require(_0xfcae('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcae('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfcae('0xa'));var deskjs=require(_0xfcae('0xb'));var toCsv=require(_0xfcae('0x7'));var querystring=require('querystring');var Papa=require(_0xfcae('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfcae('0xd'));var as=require(_0xfcae('0xe'));var hardwareService=require(_0xfcae('0xf'));var logger=require(_0xfcae('0x10'))(_0xfcae('0x11'));var utils=require(_0xfcae('0x12'));var config=require(_0xfcae('0x13'));var licenseUtil=require(_0xfcae('0x14'));var db=require(_0xfcae('0x15'))['db'];function respondWithStatusCode(_0x56398a,_0x209f76){_0x209f76=_0x209f76||0xcc;return function(_0x2dfba0){if(_0x2dfba0){return _0x56398a[_0xfcae('0x16')](_0x209f76);}return _0x56398a[_0xfcae('0x17')](_0x209f76)[_0xfcae('0x18')]();};}function respondWithResult(_0x38e387,_0x19cf42){_0x19cf42=_0x19cf42||0xc8;return function(_0x386379){if(_0x386379){return _0x38e387['status'](_0x19cf42)[_0xfcae('0x19')](_0x386379);}};}function respondWithFilteredResult(_0x4a84aa,_0x145ee3){return function(_0x12a15e){if(_0x12a15e){var _0x1ab8f3=typeof _0x145ee3[_0xfcae('0x1a')]===_0xfcae('0x1b')&&typeof _0x145ee3[_0xfcae('0x1c')]===_0xfcae('0x1b');var _0x199b03=_0x12a15e[_0xfcae('0x1d')];var _0x4d2a5e=_0x1ab8f3?0x0:_0x145ee3[_0xfcae('0x1a')];var _0x5f4a8b=_0x1ab8f3?_0x12a15e[_0xfcae('0x1d')]:_0x145ee3[_0xfcae('0x1a')]+_0x145ee3[_0xfcae('0x1c')];var _0x347f7f;if(_0x5f4a8b>=_0x199b03){_0x5f4a8b=_0x199b03;_0x347f7f=0xc8;}else{_0x347f7f=0xce;}_0x4a84aa[_0xfcae('0x17')](_0x347f7f);return _0x4a84aa[_0xfcae('0x1e')](_0xfcae('0x1f'),_0x4d2a5e+'-'+_0x5f4a8b+'/'+_0x199b03)['json'](_0x12a15e);}return null;};}function patchUpdates(_0x53cb65){return function(_0x1f79cb){try{jsonpatch[_0xfcae('0x20')](_0x1f79cb,_0x53cb65,!![]);}catch(_0x3f7557){return BPromise[_0xfcae('0x21')](_0x3f7557);}return _0x1f79cb[_0xfcae('0x22')]();};}function saveUpdates(_0x35d5d7,_0xc2d0ed){return function(_0x7f50dd){if(_0x7f50dd){return _0x7f50dd[_0xfcae('0x23')](_0x35d5d7)['then'](function(_0x1284a0){return _0x1284a0;});}return null;};}function removeEntity(_0x4571a9,_0x57687e){return function(_0x49e534){if(_0x49e534){return _0x49e534['destroy']()[_0xfcae('0x24')](function(){_0x4571a9['status'](0xcc)[_0xfcae('0x18')]();});}};}function handleEntityNotFound(_0x2b0bde,_0x232695){return function(_0x569f32){if(!_0x569f32){_0x2b0bde[_0xfcae('0x16')](0x194);}return _0x569f32;};}function handleError(_0x94a9de,_0x3013c2){_0x3013c2=_0x3013c2||0x1f4;return function(_0x374c30){logger['error'](_0x374c30['stack']);if(_0x374c30['name']){delete _0x374c30[_0xfcae('0x25')];}_0x94a9de['status'](_0x3013c2)[_0xfcae('0x26')](_0x374c30);};}exports['index']=function(_0x5b9341,_0x409dd6){var _0xb3f001={},_0x2596a6={},_0x54213a={'count':0x0,'rows':[]};var _0x34540f=_['map'](db['WhatsappApplication']['rawAttributes'],function(_0x29a7d7){return{'name':_0x29a7d7[_0xfcae('0x27')],'type':_0x29a7d7[_0xfcae('0x28')][_0xfcae('0x29')]};});_0x2596a6['model']=_['map'](_0x34540f,'name');_0x2596a6[_0xfcae('0x2a')]=_[_0xfcae('0x2b')](_0x5b9341[_0xfcae('0x2a')]);_0x2596a6['filters']=_['intersection'](_0x2596a6[_0xfcae('0x2c')],_0x2596a6['query']);_0xb3f001[_0xfcae('0x2d')]=_[_0xfcae('0x2e')](_0x2596a6[_0xfcae('0x2c')],qs[_0xfcae('0x2f')](_0x5b9341[_0xfcae('0x2a')]['fields']));_0xb3f001[_0xfcae('0x2d')]=_0xb3f001[_0xfcae('0x2d')][_0xfcae('0x30')]?_0xb3f001['attributes']:_0x2596a6[_0xfcae('0x2c')];if(!_0x5b9341[_0xfcae('0x2a')][_0xfcae('0x31')](_0xfcae('0x32'))){_0xb3f001['limit']=qs[_0xfcae('0x1c')](_0x5b9341[_0xfcae('0x2a')][_0xfcae('0x1c')]);_0xb3f001['offset']=qs[_0xfcae('0x1a')](_0x5b9341[_0xfcae('0x2a')][_0xfcae('0x1a')]);}_0xb3f001[_0xfcae('0x33')]=qs['sort'](_0x5b9341['query']['sort']);_0xb3f001[_0xfcae('0x34')]=qs[_0xfcae('0x35')](_['pick'](_0x5b9341[_0xfcae('0x2a')],_0x2596a6['filters']),_0x34540f);if(_0x5b9341['query'][_0xfcae('0x36')]){_0xb3f001[_0xfcae('0x34')]=_[_0xfcae('0x37')](_0xb3f001[_0xfcae('0x34')],{'$or':_[_0xfcae('0x38')](_0x34540f,function(_0x40913f){if(_0x40913f[_0xfcae('0x28')]!==_0xfcae('0x39')){var _0x5e47b4={};_0x5e47b4[_0x40913f['name']]={'$like':'%'+_0x5b9341['query']['filter']+'%'};return _0x5e47b4;}})});}_0xb3f001=_[_0xfcae('0x37')]({},_0xb3f001,_0x5b9341[_0xfcae('0x3a')]);var _0x59cdcb={'where':_0xb3f001[_0xfcae('0x34')]};return db[_0xfcae('0x3b')][_0xfcae('0x1d')](_0x59cdcb)[_0xfcae('0x24')](function(_0x2cdb25){_0x54213a[_0xfcae('0x1d')]=_0x2cdb25;if(_0x5b9341[_0xfcae('0x2a')][_0xfcae('0x3c')]){_0xb3f001[_0xfcae('0x3d')]=[{'all':!![]}];}return db[_0xfcae('0x3b')][_0xfcae('0x3e')](_0xb3f001);})[_0xfcae('0x24')](function(_0x3f6d02){_0x54213a[_0xfcae('0x3f')]=_0x3f6d02;return _0x54213a;})[_0xfcae('0x24')](respondWithFilteredResult(_0x409dd6,_0xb3f001))[_0xfcae('0x40')](handleError(_0x409dd6,null));};exports[_0xfcae('0x41')]=function(_0x51a438,_0xa15bd3){var _0x47d282={'raw':!![],'where':{'id':_0x51a438[_0xfcae('0x42')]['id']}},_0x508710={};_0x508710[_0xfcae('0x2c')]=_[_0xfcae('0x2b')](db[_0xfcae('0x3b')][_0xfcae('0x43')]);_0x508710[_0xfcae('0x2a')]=_[_0xfcae('0x2b')](_0x51a438['query']);_0x508710[_0xfcae('0x35')]=_[_0xfcae('0x2e')](_0x508710['model'],_0x508710[_0xfcae('0x2a')]);_0x47d282[_0xfcae('0x2d')]=_[_0xfcae('0x2e')](_0x508710[_0xfcae('0x2c')],qs['fields'](_0x51a438['query']['fields']));_0x47d282[_0xfcae('0x2d')]=_0x47d282['attributes'][_0xfcae('0x30')]?_0x47d282['attributes']:_0x508710[_0xfcae('0x2c')];if(_0x51a438['query'][_0xfcae('0x3c')]){_0x47d282[_0xfcae('0x3d')]=[{'all':!![]}];}_0x47d282=_[_0xfcae('0x37')]({},_0x47d282,_0x51a438['options']);return db['WhatsappApplication']['find'](_0x47d282)['then'](handleEntityNotFound(_0xa15bd3,null))[_0xfcae('0x24')](respondWithResult(_0xa15bd3,null))['catch'](handleError(_0xa15bd3,null));};exports[_0xfcae('0x44')]=function(_0x103cdb,_0x25b433){return db[_0xfcae('0x3b')]['create'](_0x103cdb[_0xfcae('0x45')],{})[_0xfcae('0x24')](respondWithResult(_0x25b433,0xc9))['catch'](handleError(_0x25b433,null));};exports[_0xfcae('0x23')]=function(_0x2b579f,_0x543370){if(_0x2b579f['body']['id']){delete _0x2b579f[_0xfcae('0x45')]['id'];}return db['WhatsappApplication'][_0xfcae('0x46')]({'where':{'id':_0x2b579f[_0xfcae('0x42')]['id']}})[_0xfcae('0x24')](handleEntityNotFound(_0x543370,null))['then'](saveUpdates(_0x2b579f[_0xfcae('0x45')],null))[_0xfcae('0x24')](respondWithResult(_0x543370,null))[_0xfcae('0x40')](handleError(_0x543370,null));};exports['destroy']=function(_0x2a33de,_0x1682db){return db[_0xfcae('0x3b')][_0xfcae('0x46')]({'where':{'id':_0x2a33de[_0xfcae('0x42')]['id']}})[_0xfcae('0x24')](handleEntityNotFound(_0x1682db,null))['then'](removeEntity(_0x1682db,null))[_0xfcae('0x40')](handleError(_0x1682db,null));}; \ No newline at end of file +var _0x002d=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','name','send','index','map','WhatsappApplication','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','catch','create','body','find','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs'];(function(_0x2bcb4e,_0x453b69){var _0x881e05=function(_0x303756){while(--_0x303756){_0x2bcb4e['push'](_0x2bcb4e['shift']());}};_0x881e05(++_0x453b69);}(_0x002d,0xca));var _0xd002=function(_0x385f72,_0x5446e8){_0x385f72=_0x385f72-0x0;var _0x210766=_0x002d[_0x385f72];return _0x210766;};'use strict';var emlformat=require(_0xd002('0x0'));var rimraf=require(_0xd002('0x1'));var zipdir=require(_0xd002('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd002('0x3'));var BPromise=require(_0xd002('0x4'));var Mustache=require(_0xd002('0x5'));var util=require(_0xd002('0x6'));var path=require(_0xd002('0x7'));var sox=require(_0xd002('0x8'));var csv=require(_0xd002('0x9'));var ejs=require(_0xd002('0xa'));var fs=require('fs');var fs_extra=require(_0xd002('0xb'));var _=require(_0xd002('0xc'));var squel=require(_0xd002('0xd'));var crypto=require(_0xd002('0xe'));var jsforce=require(_0xd002('0xf'));var deskjs=require(_0xd002('0x10'));var toCsv=require(_0xd002('0x9'));var querystring=require(_0xd002('0x11'));var Papa=require(_0xd002('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd002('0x13'));var as=require(_0xd002('0x14'));var hardwareService=require(_0xd002('0x15'));var logger=require('../../config/logger')(_0xd002('0x16'));var utils=require(_0xd002('0x17'));var config=require(_0xd002('0x18'));var licenseUtil=require(_0xd002('0x19'));var db=require(_0xd002('0x1a'))['db'];function respondWithStatusCode(_0x1e6efa,_0x21a778){_0x21a778=_0x21a778||0xcc;return function(_0x28920f){if(_0x28920f){return _0x1e6efa[_0xd002('0x1b')](_0x21a778);}return _0x1e6efa[_0xd002('0x1c')](_0x21a778)[_0xd002('0x1d')]();};}function respondWithResult(_0x4de1c3,_0x3cbe14){_0x3cbe14=_0x3cbe14||0xc8;return function(_0x1e5c3b){if(_0x1e5c3b){return _0x4de1c3['status'](_0x3cbe14)['json'](_0x1e5c3b);}};}function respondWithFilteredResult(_0x5bc910,_0x460e7b){return function(_0x53cd4b){if(_0x53cd4b){var _0x13acd5=typeof _0x460e7b[_0xd002('0x1e')]===_0xd002('0x1f')&&typeof _0x460e7b[_0xd002('0x20')]===_0xd002('0x1f');var _0x124d97=_0x53cd4b[_0xd002('0x21')];var _0x5e1f31=_0x13acd5?0x0:_0x460e7b[_0xd002('0x1e')];var _0x4708f6=_0x13acd5?_0x53cd4b[_0xd002('0x21')]:_0x460e7b[_0xd002('0x1e')]+_0x460e7b[_0xd002('0x20')];var _0x4aa45d;if(_0x4708f6>=_0x124d97){_0x4708f6=_0x124d97;_0x4aa45d=0xc8;}else{_0x4aa45d=0xce;}_0x5bc910[_0xd002('0x1c')](_0x4aa45d);return _0x5bc910[_0xd002('0x22')](_0xd002('0x23'),_0x5e1f31+'-'+_0x4708f6+'/'+_0x124d97)[_0xd002('0x24')](_0x53cd4b);}return null;};}function patchUpdates(_0x5f3854){return function(_0x27c9c5){try{jsonpatch['apply'](_0x27c9c5,_0x5f3854,!![]);}catch(_0x490310){return BPromise[_0xd002('0x25')](_0x490310);}return _0x27c9c5[_0xd002('0x26')]();};}function saveUpdates(_0x1bfa76,_0x45cd2e){return function(_0x28cfb1){if(_0x28cfb1){return _0x28cfb1[_0xd002('0x27')](_0x1bfa76)[_0xd002('0x28')](function(_0x3a99ee){return _0x3a99ee;});}return null;};}function removeEntity(_0xe28024,_0x15ccfb){return function(_0x1a9884){if(_0x1a9884){return _0x1a9884[_0xd002('0x29')]()['then'](function(){_0xe28024[_0xd002('0x1c')](0xcc)[_0xd002('0x1d')]();});}};}function handleEntityNotFound(_0x55e3be,_0x32ac79){return function(_0x21fe25){if(!_0x21fe25){_0x55e3be[_0xd002('0x1b')](0x194);}return _0x21fe25;};}function handleError(_0x4df8db,_0x1c4b8a){_0x1c4b8a=_0x1c4b8a||0x1f4;return function(_0x4f58fa){logger['error'](_0x4f58fa['stack']);if(_0x4f58fa[_0xd002('0x2a')]){delete _0x4f58fa[_0xd002('0x2a')];}_0x4df8db[_0xd002('0x1c')](_0x1c4b8a)[_0xd002('0x2b')](_0x4f58fa);};}exports[_0xd002('0x2c')]=function(_0x24722d,_0x1648e1){var _0x3e0cc2={},_0x9999ea={},_0x70610d={'count':0x0,'rows':[]};var _0x5a79ba=_[_0xd002('0x2d')](db[_0xd002('0x2e')][_0xd002('0x2f')],function(_0x3b6653){return{'name':_0x3b6653['fieldName'],'type':_0x3b6653[_0xd002('0x30')]['key']};});_0x9999ea[_0xd002('0x31')]=_['map'](_0x5a79ba,_0xd002('0x2a'));_0x9999ea[_0xd002('0x32')]=_[_0xd002('0x33')](_0x24722d[_0xd002('0x32')]);_0x9999ea[_0xd002('0x34')]=_[_0xd002('0x35')](_0x9999ea[_0xd002('0x31')],_0x9999ea[_0xd002('0x32')]);_0x3e0cc2['attributes']=_[_0xd002('0x35')](_0x9999ea[_0xd002('0x31')],qs[_0xd002('0x36')](_0x24722d[_0xd002('0x32')][_0xd002('0x36')]));_0x3e0cc2[_0xd002('0x37')]=_0x3e0cc2['attributes']['length']?_0x3e0cc2['attributes']:_0x9999ea[_0xd002('0x31')];if(!_0x24722d['query'][_0xd002('0x38')](_0xd002('0x39'))){_0x3e0cc2[_0xd002('0x20')]=qs[_0xd002('0x20')](_0x24722d[_0xd002('0x32')][_0xd002('0x20')]);_0x3e0cc2[_0xd002('0x1e')]=qs[_0xd002('0x1e')](_0x24722d['query'][_0xd002('0x1e')]);}_0x3e0cc2[_0xd002('0x3a')]=qs['sort'](_0x24722d['query'][_0xd002('0x3b')]);_0x3e0cc2[_0xd002('0x3c')]=qs[_0xd002('0x34')](_[_0xd002('0x3d')](_0x24722d['query'],_0x9999ea[_0xd002('0x34')]),_0x5a79ba);if(_0x24722d['query'][_0xd002('0x3e')]){_0x3e0cc2[_0xd002('0x3c')]=_[_0xd002('0x3f')](_0x3e0cc2[_0xd002('0x3c')],{'$or':_[_0xd002('0x2d')](_0x5a79ba,function(_0x54c2ec){if(_0x54c2ec[_0xd002('0x30')]!==_0xd002('0x40')){var _0x23ad2e={};_0x23ad2e[_0x54c2ec[_0xd002('0x2a')]]={'$like':'%'+_0x24722d[_0xd002('0x32')][_0xd002('0x3e')]+'%'};return _0x23ad2e;}})});}_0x3e0cc2=_[_0xd002('0x3f')]({},_0x3e0cc2,_0x24722d[_0xd002('0x41')]);var _0x2693a9={'where':_0x3e0cc2[_0xd002('0x3c')]};return db[_0xd002('0x2e')][_0xd002('0x21')](_0x2693a9)[_0xd002('0x28')](function(_0x1509d0){_0x70610d[_0xd002('0x21')]=_0x1509d0;if(_0x24722d[_0xd002('0x32')]['includeAll']){_0x3e0cc2[_0xd002('0x42')]=[{'all':!![]}];}return db[_0xd002('0x2e')][_0xd002('0x43')](_0x3e0cc2);})[_0xd002('0x28')](function(_0x5339e3){_0x70610d[_0xd002('0x44')]=_0x5339e3;return _0x70610d;})[_0xd002('0x28')](respondWithFilteredResult(_0x1648e1,_0x3e0cc2))['catch'](handleError(_0x1648e1,null));};exports['show']=function(_0x3978a3,_0x382693){var _0x10ce62={'raw':!![],'where':{'id':_0x3978a3[_0xd002('0x45')]['id']}},_0x53e3ab={};_0x53e3ab['model']=_['keys'](db[_0xd002('0x2e')]['rawAttributes']);_0x53e3ab[_0xd002('0x32')]=_[_0xd002('0x33')](_0x3978a3['query']);_0x53e3ab[_0xd002('0x34')]=_[_0xd002('0x35')](_0x53e3ab[_0xd002('0x31')],_0x53e3ab[_0xd002('0x32')]);_0x10ce62[_0xd002('0x37')]=_['intersection'](_0x53e3ab['model'],qs[_0xd002('0x36')](_0x3978a3['query'][_0xd002('0x36')]));_0x10ce62[_0xd002('0x37')]=_0x10ce62['attributes']['length']?_0x10ce62[_0xd002('0x37')]:_0x53e3ab['model'];if(_0x3978a3[_0xd002('0x32')]['includeAll']){_0x10ce62[_0xd002('0x42')]=[{'all':!![]}];}_0x10ce62=_['merge']({},_0x10ce62,_0x3978a3[_0xd002('0x41')]);return db[_0xd002('0x2e')]['find'](_0x10ce62)[_0xd002('0x28')](handleEntityNotFound(_0x382693,null))[_0xd002('0x28')](respondWithResult(_0x382693,null))[_0xd002('0x46')](handleError(_0x382693,null));};exports[_0xd002('0x47')]=function(_0xe8893e,_0x246f9f){return db['WhatsappApplication'][_0xd002('0x47')](_0xe8893e[_0xd002('0x48')],{})[_0xd002('0x28')](respondWithResult(_0x246f9f,0xc9))[_0xd002('0x46')](handleError(_0x246f9f,null));};exports['update']=function(_0x1c5b7e,_0xf3edf0){if(_0x1c5b7e[_0xd002('0x48')]['id']){delete _0x1c5b7e[_0xd002('0x48')]['id'];}return db[_0xd002('0x2e')][_0xd002('0x49')]({'where':{'id':_0x1c5b7e['params']['id']}})[_0xd002('0x28')](handleEntityNotFound(_0xf3edf0,null))[_0xd002('0x28')](saveUpdates(_0x1c5b7e[_0xd002('0x48')],null))[_0xd002('0x28')](respondWithResult(_0xf3edf0,null))[_0xd002('0x46')](handleError(_0xf3edf0,null));};exports[_0xd002('0x29')]=function(_0x2f2c1f,_0x143060){return db[_0xd002('0x2e')][_0xd002('0x49')]({'where':{'id':_0x2f2c1f['params']['id']}})[_0xd002('0x28')](handleEntityNotFound(_0x143060,null))[_0xd002('0x28')](removeEntity(_0x143060,null))[_0xd002('0x46')](handleError(_0x143060,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 3c345f1..0cee207 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 _0xf1e1=['exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes'];(function(_0x72e297,_0x4ec504){var _0x37f261=function(_0x46eeac){while(--_0x46eeac){_0x72e297['push'](_0x72e297['shift']());}};_0x37f261(++_0x4ec504);}(_0xf1e1,0x102));var _0x1f1e=function(_0x3f994d,_0x249d72){_0x3f994d=_0x3f994d-0x0;var _0x5309b4=_0xf1e1[_0x3f994d];return _0x5309b4;};'use strict';var _=require(_0x1f1e('0x0'));var util=require('util');var logger=require(_0x1f1e('0x1'))('api');var moment=require(_0x1f1e('0x2'));var BPromise=require('bluebird');var rp=require(_0x1f1e('0x3'));var fs=require('fs');var path=require(_0x1f1e('0x4'));var rimraf=require(_0x1f1e('0x5'));var config=require(_0x1f1e('0x6'));var attributes=require(_0x1f1e('0x7'));module[_0x1f1e('0x8')]=function(_0x1bdcee,_0x3242af){return _0x1bdcee[_0x1f1e('0x9')](_0x1f1e('0xa'),attributes,{'tableName':_0x1f1e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1f1e('0xc'),'collate':_0x1f1e('0xd')});}; \ No newline at end of file +var _0x4b1f=['api','moment','bluebird','path','rimraf','../../config/environment','define','WhatsappApplication','whatsapp_applications','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4b1f,0x195));var _0xf4b1=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x4b1f[_0x344a3f];return _0x264712;};'use strict';var _=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var logger=require('../../config/logger')(_0xf4b1('0x2'));var moment=require(_0xf4b1('0x3'));var BPromise=require(_0xf4b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4b1('0x5'));var rimraf=require(_0xf4b1('0x6'));var config=require(_0xf4b1('0x7'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x1ab96b,_0x4b676){return _0x1ab96b[_0xf4b1('0x8')](_0xf4b1('0x9'),attributes,{'tableName':_0xf4b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index de4bb6e..b887ae9 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 _0xac31=['code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x13ebbe,_0x5e92b0){var _0x16f698=function(_0x5f102f){while(--_0x5f102f){_0x13ebbe['push'](_0x13ebbe['shift']());}};_0x16f698(++_0x5e92b0);}(_0xac31,0xca));var _0x1ac3=function(_0x2e915a,_0x3349a7){_0x2e915a=_0x2e915a-0x0;var _0x56418b=_0xac31[_0x2e915a];return _0x56418b;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bf9b1,_0x1be223,_0x157604){return new BPromise(function(_0x57893c,_0x2d17de){return client['request'](_0x2bf9b1,_0x157604)[_0x1ac3('0xb')](function(_0x40b64c){logger[_0x1ac3('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x1be223,_0x1ac3('0xd'));logger[_0x1ac3('0xe')](_0x1ac3('0xf'),_0x1be223,_0x1ac3('0xd'),JSON[_0x1ac3('0x10')](_0x40b64c));if(_0x40b64c[_0x1ac3('0x11')]){if(_0x40b64c['error'][_0x1ac3('0x12')]===0x1f4){logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c[_0x1ac3('0x11')]['message']);return _0x2d17de(_0x40b64c[_0x1ac3('0x11')][_0x1ac3('0x14')]);}logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c['error'][_0x1ac3('0x14')]);return _0x57893c(_0x40b64c[_0x1ac3('0x11')]['message']);}else{logger[_0x1ac3('0xc')](_0x1ac3('0x13'),_0x1be223,_0x1ac3('0xd'));_0x57893c(_0x40b64c['result'][_0x1ac3('0x14')]);}})[_0x1ac3('0x15')](function(_0x23e6e9){logger['error'](_0x1ac3('0x13'),_0x1be223,_0x23e6e9);_0x2d17de(_0x23e6e9);});});} \ No newline at end of file +var _0x4c4e=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2c16e8,_0x446971){var _0x348cf4=function(_0x33beee){while(--_0x33beee){_0x2c16e8['push'](_0x2c16e8['shift']());}};_0x348cf4(++_0x446971);}(_0x4c4e,0x152));var _0xe4c4=function(_0x4a2c87,_0x1fc043){_0x4a2c87=_0x4a2c87-0x0;var _0x10d121=_0x4c4e[_0x4a2c87];return _0x10d121;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262b64,_0xad105,_0x22085a){return new BPromise(function(_0x329d29,_0x28a42e){return client[_0xe4c4('0xa')](_0x262b64,_0x22085a)['then'](function(_0x589b2e){logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));logger[_0xe4c4('0xe')](_0xe4c4('0xf'),_0xad105,_0xe4c4('0xd'),JSON['stringify'](_0x589b2e));if(_0x589b2e[_0xe4c4('0x10')]){if(_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x11')]===0x1f4){logger[_0xe4c4('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x28a42e(_0x589b2e['error'][_0xe4c4('0x12')]);}logger[_0xe4c4('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x329d29(_0x589b2e['error'][_0xe4c4('0x12')]);}else{logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));_0x329d29(_0x589b2e[_0xe4c4('0x13')][_0xe4c4('0x12')]);}})[_0xe4c4('0x14')](function(_0x1038cb){logger[_0xe4c4('0x10')](_0xe4c4('0xc'),_0xad105,_0x1038cb);_0x28a42e(_0x1038cb);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index ef0c01f..de96997 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 _0x236d=['../../components/interaction/service','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2a7718,_0x4936ff){var _0x254e10=function(_0x3563c8){while(--_0x3563c8){_0x2a7718['push'](_0x2a7718['shift']());}};_0x254e10(++_0x4936ff);}(_0x236d,0x7e));var _0xd236=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x236d[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xd236('0x0'));var util=require(_0xd236('0x1'));var path=require('path');var timeout=require(_0xd236('0x2'));var express=require('express');var router=express[_0xd236('0x3')]();var fs_extra=require(_0xd236('0x4'));var auth=require(_0xd236('0x5'));var interaction=require(_0xd236('0x6'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0xd236('0x7')]('/',auth[_0xd236('0x8')](),controller[_0xd236('0x9')]);router[_0xd236('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xd236('0xa')]);router[_0xd236('0x7')]('/:id',auth[_0xd236('0x8')](),controller[_0xd236('0xb')]);router['get'](_0xd236('0xc'),auth[_0xd236('0x8')](),controller[_0xd236('0xd')]);router['get'](_0xd236('0xe'),auth[_0xd236('0x8')](),controller[_0xd236('0xf')]);router['post']('/',auth[_0xd236('0x8')](),controller[_0xd236('0x10')]);router[_0xd236('0x11')](_0xd236('0xc'),auth[_0xd236('0x8')](),controller[_0xd236('0x12')]);router[_0xd236('0x11')](_0xd236('0x13'),auth[_0xd236('0x8')](),interaction[_0xd236('0x14')](_0xd236('0x15'),_0xd236('0x16')),controller[_0xd236('0x17')]);router[_0xd236('0x18')](_0xd236('0x19'),auth[_0xd236('0x8')](),interaction[_0xd236('0x14')](_0xd236('0x15'),_0xd236('0x1a')),controller[_0xd236('0x1b')]);router['delete']('/:id',auth[_0xd236('0x8')](),interaction[_0xd236('0x14')]('whatsapp',_0xd236('0x1c')),controller[_0xd236('0x1d')]);router[_0xd236('0x1e')]('/:id/tags',auth[_0xd236('0x8')](),controller[_0xd236('0x1f')]);module[_0xd236('0x20')]=router; \ No newline at end of file +var _0xdb8b=['delete','whatsappinteraction:destroy','removeTags','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update'];(function(_0x1b7264,_0x4cceb8){var _0xfaa47e=function(_0x2be6d9){while(--_0x2be6d9){_0x1b7264['push'](_0x1b7264['shift']());}};_0xfaa47e(++_0x4cceb8);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x4d7e10,_0x5cd58f){_0x4d7e10=_0x4d7e10-0x0;var _0x1e7a8b=_0xdb8b[_0x4d7e10];return _0x1e7a8b;};'use strict';var multer=require('multer');var util=require(_0xbdb8('0x0'));var path=require(_0xbdb8('0x1'));var timeout=require(_0xbdb8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbdb8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbdb8('0x4'));var config=require(_0xbdb8('0x5'));var controller=require(_0xbdb8('0x6'));router[_0xbdb8('0x7')]('/',auth['isAuthenticated'](),controller[_0xbdb8('0x8')]);router['get'](_0xbdb8('0x9'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0xb')]);router[_0xbdb8('0x7')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),controller['show']);router[_0xbdb8('0x7')](_0xbdb8('0xd'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0xe')]);router[_0xbdb8('0x7')](_0xbdb8('0xf'),auth[_0xbdb8('0xa')](),controller['download']);router['post']('/',auth[_0xbdb8('0xa')](),controller['create']);router[_0xbdb8('0x10')]('/:id/messages',auth[_0xbdb8('0xa')](),controller['addMessage']);router[_0xbdb8('0x10')](_0xbdb8('0x11'),auth[_0xbdb8('0xa')](),interaction[_0xbdb8('0x12')](_0xbdb8('0x13'),_0xbdb8('0x14')),controller[_0xbdb8('0x15')]);router[_0xbdb8('0x16')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),interaction[_0xbdb8('0x12')](_0xbdb8('0x13'),_0xbdb8('0x17')),controller['update']);router[_0xbdb8('0x18')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),interaction['tracked']('whatsapp',_0xbdb8('0x19')),controller['destroy']);router[_0xbdb8('0x18')](_0xbdb8('0x11'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0x1a')]);module[_0xbdb8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index bbca479..88cab0a 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 _0x1d63=['out','INTEGER','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x9c403c,_0x3ae9c4){var _0x472d1b=function(_0x57d3bf){while(--_0x57d3bf){_0x9c403c['push'](_0x9c403c['shift']());}};_0x472d1b(++_0x3ae9c4);}(_0x1d63,0xa4));var _0x31d6=function(_0x4b8b4d,_0x1470de){_0x4b8b4d=_0x4b8b4d-0x0;var _0x205c53=_0x1d63[_0x4b8b4d];return _0x205c53;};'use strict';var Sequelize=require(_0x31d6('0x0'));var moment=require(_0x31d6('0x1'));module[_0x31d6('0x2')]={'closed':{'type':Sequelize[_0x31d6('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x31d6('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x31d6('0x5')]},'thirdDisposition':{'type':Sequelize[_0x31d6('0x5')]},'note':{'type':Sequelize[_0x31d6('0x5')]},'phone':{'type':Sequelize[_0x31d6('0x5')]},'read1stAt':{'type':Sequelize[_0x31d6('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x31d6('0x6')]('in',_0x31d6('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x31d6('0x6')]('in',_0x31d6('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x31d6('0x8')]}}; \ No newline at end of file +var _0xcefd=['DATE','STRING','ENUM','out','INTEGER','moment','exports','BOOLEAN'];(function(_0x3e7783,_0x2f3344){var _0x2dba61=function(_0x18785b){while(--_0x18785b){_0x3e7783['push'](_0x3e7783['shift']());}};_0x2dba61(++_0x2f3344);}(_0xcefd,0x1bd));var _0xdcef=function(_0x2197c3,_0x310b38){_0x2197c3=_0x2197c3-0x0;var _0x120c87=_0xcefd[_0x2197c3];return _0x120c87;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdcef('0x0'));module[_0xdcef('0x1')]={'closed':{'type':Sequelize[_0xdcef('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdcef('0x3')]},'disposition':{'type':Sequelize[_0xdcef('0x4')]},'secondDisposition':{'type':Sequelize[_0xdcef('0x4')]},'thirdDisposition':{'type':Sequelize[_0xdcef('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xdcef('0x4')]},'read1stAt':{'type':Sequelize[_0xdcef('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xdcef('0x5')]('in',_0xdcef('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdcef('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xdcef('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xdcef('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xdcef('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 9f1f4f3..747dd75 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 _0x1e00=['toString','join','root','files','tmp','attachments','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','secret','read','Account','mkdirSync','Whatsapp','Owner','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','basename','existsSync','pipe','direction','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','moment','bluebird','path','ejs','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','end','error','stack','name','send','map','WhatsappInteraction','fieldName','type','key','getOptions','whatsapp','query','user','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','describe','ids','omit','rawAttributes','filters','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappInteractionId','filter','$gte','format','options','WhatsappMessage','addTags','setTags','spread','Tag','findAll','emit','removeTags','download','unix'];(function(_0x14ca0d,_0x5781a4){var _0x5c4fb6=function(_0x23f292){while(--_0x23f292){_0x14ca0d['push'](_0x14ca0d['shift']());}};_0x5c4fb6(++_0x5781a4);}(_0x1e00,0xa3));var _0x01e0=function(_0x41bb75,_0x4b4b8a){_0x41bb75=_0x41bb75-0x0;var _0x4c63e4=_0x1e00[_0x41bb75];return _0x4c63e4;};'use strict';var rimraf=require(_0x01e0('0x0'));var zipdir=require('zip-dir');var moment=require(_0x01e0('0x1'));var BPromise=require(_0x01e0('0x2'));var util=require('util');var path=require(_0x01e0('0x3'));var ejs=require(_0x01e0('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x01e0('0x5'));var pdf=require(_0x01e0('0x6'));var logger=require(_0x01e0('0x7'))(_0x01e0('0x8'));var config=require(_0x01e0('0x9'));var db=require('../../mysqldb')['db'];config[_0x01e0('0xa')]=_[_0x01e0('0xb')](config[_0x01e0('0xa')],{'host':_0x01e0('0xc'),'port':0x18eb});var socket=require(_0x01e0('0xd'))(new Redis(config[_0x01e0('0xa')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x475884,_0x9e43a0){_0x9e43a0=_0x9e43a0||0xcc;return function(_0x53cb20){if(_0x53cb20){return _0x475884[_0x01e0('0xe')](_0x9e43a0);}return _0x475884['status'](_0x9e43a0)['end']();};}function respondWithResult(_0x41d747,_0x20a33f){_0x20a33f=_0x20a33f||0xc8;return function(_0x238e19){if(_0x238e19){return _0x41d747[_0x01e0('0xf')](_0x20a33f)[_0x01e0('0x10')](_0x238e19);}};}function respondWithFilteredResult(_0x272d86,_0x9c2fb3){return function(_0x4f6604){if(_0x4f6604){var _0x5e20e0=typeof _0x9c2fb3[_0x01e0('0x11')]===_0x01e0('0x12')&&typeof _0x9c2fb3[_0x01e0('0x13')]===_0x01e0('0x12');var _0x46de79=_0x4f6604[_0x01e0('0x14')];var _0x5e756d=_0x5e20e0?0x0:_0x9c2fb3[_0x01e0('0x11')];var _0x515a61=_0x5e20e0?_0x4f6604[_0x01e0('0x14')]:_0x9c2fb3[_0x01e0('0x11')]+_0x9c2fb3[_0x01e0('0x13')];var _0x537809;if(_0x515a61>=_0x46de79){_0x515a61=_0x46de79;_0x537809=0xc8;}else{_0x537809=0xce;}_0x272d86[_0x01e0('0xf')](_0x537809);return _0x272d86[_0x01e0('0x15')](_0x01e0('0x16'),_0x5e756d+'-'+_0x515a61+'/'+_0x46de79)['json'](_0x4f6604);}return null;};}function saveUpdates(_0x492025){return function(_0x278d39){if(_0x278d39){return _0x278d39[_0x01e0('0x17')](_0x492025)['then'](function(_0x3f3d7d){return _0x3f3d7d;});}return null;};}function removeEntity(_0x112362){return function(_0x417780){if(_0x417780){return _0x417780[_0x01e0('0x18')]()[_0x01e0('0x19')](function(){_0x112362[_0x01e0('0xf')](0xcc)[_0x01e0('0x1a')]();});}};}function handleEntityNotFound(_0x1bf639){return function(_0x36349a){if(!_0x36349a){_0x1bf639['sendStatus'](0x194);}return _0x36349a;};}function handleError(_0x52d299,_0x3c2c45){_0x3c2c45=_0x3c2c45||0x1f4;return function(_0x149618){logger[_0x01e0('0x1b')](_0x149618[_0x01e0('0x1c')]);if(_0x149618[_0x01e0('0x1d')]){delete _0x149618[_0x01e0('0x1d')];}_0x52d299['status'](_0x3c2c45)[_0x01e0('0x1e')](_0x149618);};}exports['index']=function(_0x122fef,_0x1e77dd){var _0x466e74={};var _0x30f783=_[_0x01e0('0x1f')](db[_0x01e0('0x20')]['rawAttributes'],function(_0x2cb869){return{'name':_0x2cb869[_0x01e0('0x21')],'type':_0x2cb869[_0x01e0('0x22')][_0x01e0('0x23')]};});_0x466e74=qs[_0x01e0('0x24')](_0x30f783,_0x122fef);return interaction['findAll'](_0x01e0('0x25'),_0x122fef[_0x01e0('0x26')],_0x122fef[_0x01e0('0x27')],_0x466e74,_0x30f783)['then'](respondWithFilteredResult(_0x1e77dd,_0x466e74))[_0x01e0('0x28')](handleError(_0x1e77dd,null));};exports[_0x01e0('0x29')]=function(_0xc2a716,_0x4c2b4f){var _0x6c3015={'raw':![],'where':{'id':_0xc2a716[_0x01e0('0x2a')]['id']}},_0x48eeb1={};_0x48eeb1[_0x01e0('0x2b')]=_[_0x01e0('0x2c')](db[_0x01e0('0x20')]['rawAttributes']);_0x48eeb1[_0x01e0('0x26')]=_['keys'](_0xc2a716[_0x01e0('0x26')]);_0x48eeb1['filters']=_[_0x01e0('0x2d')](_0x48eeb1[_0x01e0('0x2b')],_0x48eeb1[_0x01e0('0x26')]);_0x6c3015[_0x01e0('0x2e')]=_[_0x01e0('0x2d')](_0x48eeb1[_0x01e0('0x2b')],qs[_0x01e0('0x2f')](_0xc2a716['query'][_0x01e0('0x2f')]));_0x6c3015[_0x01e0('0x2e')]=_0x6c3015[_0x01e0('0x2e')][_0x01e0('0x30')]?_0x6c3015[_0x01e0('0x2e')]:_0x48eeb1['model'];if(_0xc2a716[_0x01e0('0x26')][_0x01e0('0x31')]){_0x6c3015[_0x01e0('0x32')]=[{'all':!![]}];}_0x6c3015=_[_0x01e0('0x33')]({},_0x6c3015,_0xc2a716['options']);return db[_0x01e0('0x20')][_0x01e0('0x34')](_0x6c3015)[_0x01e0('0x19')](handleEntityNotFound(_0x4c2b4f,null))[_0x01e0('0x19')](respondWithResult(_0x4c2b4f,null))[_0x01e0('0x28')](handleError(_0x4c2b4f,null));};exports[_0x01e0('0x35')]=function(_0x5e3ce5,_0x35c2f3){return db[_0x01e0('0x20')]['create'](_0x5e3ce5[_0x01e0('0x36')],{})[_0x01e0('0x19')](respondWithResult(_0x35c2f3,0xc9))[_0x01e0('0x28')](handleError(_0x35c2f3,null));};exports[_0x01e0('0x17')]=function(_0x341180,_0x361766){if(_0x341180[_0x01e0('0x36')]['id']){delete _0x341180[_0x01e0('0x36')]['id'];}return db[_0x01e0('0x20')][_0x01e0('0x34')]({'where':{'id':_0x341180[_0x01e0('0x2a')]['id']}})[_0x01e0('0x19')](handleEntityNotFound(_0x361766,null))[_0x01e0('0x19')](saveUpdates(_0x341180[_0x01e0('0x36')],null))[_0x01e0('0x19')](respondWithResult(_0x361766,null))[_0x01e0('0x28')](handleError(_0x361766,null));};exports[_0x01e0('0x18')]=function(_0x5cc11f,_0x6ddaf2){return db[_0x01e0('0x20')][_0x01e0('0x34')]({'where':{'id':_0x5cc11f[_0x01e0('0x2a')]['id']}})[_0x01e0('0x19')](handleEntityNotFound(_0x6ddaf2,null))['then'](removeEntity(_0x6ddaf2,null))[_0x01e0('0x28')](handleError(_0x6ddaf2,null));};exports[_0x01e0('0x37')]=function(_0x174f7d,_0x5a0ce5){return db['WhatsappInteraction']['describe']()[_0x01e0('0x19')](respondWithResult(_0x5a0ce5,null))[_0x01e0('0x28')](handleError(_0x5a0ce5,null));};exports['addMessage']=function(_0x5d521f,_0x4e0b97){return db['WhatsappMessage'][_0x01e0('0x34')]({'where':{'id':_0x5d521f[_0x01e0('0x2a')]['id']}})[_0x01e0('0x19')](handleEntityNotFound(_0x4e0b97,null))['then'](function(_0x9bc4b7){if(_0x9bc4b7){return _0x9bc4b7['addMessage'](_0x5d521f[_0x01e0('0x36')][_0x01e0('0x38')],_[_0x01e0('0x39')](_0x5d521f[_0x01e0('0x36')],[_0x01e0('0x38'),'id'])||{});}})[_0x01e0('0x19')](respondWithResult(_0x4e0b97,null))[_0x01e0('0x28')](handleError(_0x4e0b97,null));};exports['getMessages']=function(_0x49bc98,_0x54d4c7){var _0x5e6cd5={'raw':![],'where':{}};var _0x22923f={};var _0x390d2b={'count':0x0,'rows':[]};return db[_0x01e0('0x20')]['findOne']({'where':{'id':_0x49bc98[_0x01e0('0x2a')]['id']}})[_0x01e0('0x19')](handleEntityNotFound(_0x54d4c7,null))[_0x01e0('0x19')](function(_0x300f21){if(_0x300f21){_0x22923f[_0x01e0('0x2b')]=_['keys'](db['WhatsappMessage'][_0x01e0('0x3a')]);_0x22923f[_0x01e0('0x26')]=_[_0x01e0('0x2c')](_0x49bc98[_0x01e0('0x26')]);_0x22923f[_0x01e0('0x3b')]=_['intersection'](_0x22923f[_0x01e0('0x2b')],_0x22923f[_0x01e0('0x26')]);_0x5e6cd5[_0x01e0('0x2e')]=_['intersection'](_0x22923f['model'],qs[_0x01e0('0x2f')](_0x49bc98['query'][_0x01e0('0x2f')]));_0x5e6cd5[_0x01e0('0x2e')]=_0x5e6cd5[_0x01e0('0x2e')][_0x01e0('0x30')]?_0x5e6cd5['attributes']:_0x22923f[_0x01e0('0x2b')];if(!_0x49bc98[_0x01e0('0x26')][_0x01e0('0x3c')](_0x01e0('0x3d'))){_0x5e6cd5['limit']=qs[_0x01e0('0x13')](_0x49bc98[_0x01e0('0x26')]['limit']);_0x5e6cd5['offset']=qs[_0x01e0('0x11')](_0x49bc98[_0x01e0('0x26')]['offset']);}_0x5e6cd5[_0x01e0('0x3e')]=qs[_0x01e0('0x3f')](_0x49bc98['query'][_0x01e0('0x3f')]);_0x5e6cd5['where']=qs[_0x01e0('0x3b')](_[_0x01e0('0x40')](_0x49bc98[_0x01e0('0x26')],_0x22923f['filters']));_0x5e6cd5[_0x01e0('0x41')][_0x01e0('0x42')]=_0x300f21['id'];if(_0x49bc98[_0x01e0('0x26')][_0x01e0('0x43')]){_0x5e6cd5['where']=_[_0x01e0('0x33')](_0x5e6cd5[_0x01e0('0x41')],{'$or':_['map'](_0x5e6cd5[_0x01e0('0x2e')],function(_0x5a5288){var _0x250666={};_0x250666[_0x5a5288]={'$like':'%'+_0x49bc98[_0x01e0('0x26')][_0x01e0('0x43')]+'%'};return _0x250666;})});}if(_0x49bc98[_0x01e0('0x26')][_0x01e0('0x44')]){var _0x56e5bd=_0x49bc98['query'][_0x01e0('0x44')]['split'](',');var _0xc8862b={};_0xc8862b[_0x56e5bd[0x0]]={'$gte':moment(_0x56e5bd[0x1])[_0x01e0('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5e6cd5['where']=_[_0x01e0('0x33')](_0x5e6cd5[_0x01e0('0x41')],_0xc8862b);}_0x5e6cd5=_[_0x01e0('0x33')]({},_0x5e6cd5,_0x49bc98[_0x01e0('0x46')]);return db[_0x01e0('0x47')][_0x01e0('0x14')]({'where':_0x5e6cd5[_0x01e0('0x41')]})[_0x01e0('0x19')](function(_0x4dbe5d){_0x390d2b['count']=_0x4dbe5d;if(_0x49bc98['query'][_0x01e0('0x31')]){_0x5e6cd5[_0x01e0('0x32')]=[{'all':!![]}];}return db[_0x01e0('0x47')]['findAll'](_0x5e6cd5);})['then'](function(_0x547ad4){_0x390d2b['rows']=_0x547ad4;return _0x390d2b;});}})['then'](respondWithFilteredResult(_0x54d4c7,_0x5e6cd5))['catch'](handleError(_0x54d4c7,null));};exports[_0x01e0('0x48')]=function(_0x3d4a45,_0x20ef74){return db[_0x01e0('0x20')]['find']({'where':{'id':_0x3d4a45[_0x01e0('0x2a')]['id']}})[_0x01e0('0x19')](handleEntityNotFound(_0x20ef74,null))[_0x01e0('0x19')](function(_0x3bcb3e){if(_0x3bcb3e){return _0x3bcb3e[_0x01e0('0x49')](_0x3d4a45[_0x01e0('0x36')]['ids'],_[_0x01e0('0x39')](_0x3d4a45[_0x01e0('0x36')],[_0x01e0('0x38'),'id'])||{})[_0x01e0('0x4a')](function(){return db[_0x01e0('0x4b')][_0x01e0('0x4c')]({'attributes':['id','name','color'],'where':{'id':_0x3d4a45[_0x01e0('0x36')][_0x01e0('0x38')]}});})[_0x01e0('0x19')](function(_0x569ad2){socket[_0x01e0('0x4d')]('whatsappInteractionTags:save',{'id':Number(_0x3d4a45['params']['id']),'tags':_0x569ad2||[]});return{'id':Number(_0x3d4a45[_0x01e0('0x2a')]['id']),'tags':_0x569ad2||[]};});}})[_0x01e0('0x19')](respondWithResult(_0x20ef74,null))[_0x01e0('0x28')](handleError(_0x20ef74,null));};exports[_0x01e0('0x4e')]=function(_0x3b786d,_0x151ad5){return db[_0x01e0('0x20')]['find']({'where':{'id':_0x3b786d[_0x01e0('0x2a')]['id']}})[_0x01e0('0x19')](handleEntityNotFound(_0x151ad5,null))[_0x01e0('0x19')](function(_0x55cdaf){if(_0x55cdaf){return _0x55cdaf[_0x01e0('0x4e')](_0x3b786d[_0x01e0('0x26')][_0x01e0('0x38')]);}})[_0x01e0('0x19')](respondWithStatusCode(_0x151ad5,null))[_0x01e0('0x28')](handleError(_0x151ad5,null));};exports[_0x01e0('0x4f')]=function(_0xd8f070,_0xc02ca8){var _0x36d038=moment()[_0x01e0('0x50')]()[_0x01e0('0x51')]();var _0x2c80a0=path[_0x01e0('0x52')](config[_0x01e0('0x53')],'server',_0x01e0('0x54'),_0x01e0('0x55'));var _0x259e1d=path[_0x01e0('0x52')](config[_0x01e0('0x53')],'server','files',_0x01e0('0x56'));var _0x595810=path[_0x01e0('0x52')](_0x2c80a0,_0x36d038);var _0x313978=util[_0x01e0('0x45')]('transcript-%d-%s.zip',_0xd8f070['params']['id'],_0x36d038);var _0x2e3568=path[_0x01e0('0x52')](_0x2c80a0,_0x313978);var _0x15b4e3=[];_0x15b4e3[_0x01e0('0x57')]({'model':db[_0x01e0('0x58')],'as':_0x01e0('0x58'),'attributes':['id',_0x01e0('0x59')],'raw':!![]});_0x15b4e3[_0x01e0('0x57')]({'model':db[_0x01e0('0x5a')],'as':_0x01e0('0x5b'),'attributes':['id',_0x01e0('0x5c'),_0x01e0('0x5d')],'raw':!![]});if(_0xd8f070[_0x01e0('0x26')][_0x01e0('0x56')]){_0x15b4e3[_0x01e0('0x57')]({'model':db[_0x01e0('0x5e')],'as':_0x01e0('0x5e'),'raw':!![]});}var _0x25b749=[{'model':db[_0x01e0('0x47')],'as':_0x01e0('0x5f'),'attributes':['id',_0x01e0('0x36'),_0x01e0('0x60'),'direction',_0x01e0('0x61'),_0x01e0('0x62')],'include':_0x15b4e3}];_0x25b749[_0x01e0('0x57')]({'model':db['WhatsappAccount'],'as':_0x01e0('0x63'),'attributes':['id','name']});_0x25b749[_0x01e0('0x57')]({'model':db[_0x01e0('0x58')],'as':'Owner','attributes':['id',_0x01e0('0x59')]});return db['WhatsappInteraction'][_0x01e0('0x34')]({'where':{'id':_0xd8f070[_0x01e0('0x2a')]['id']},'include':_0x25b749})[_0x01e0('0x19')](handleEntityNotFound(_0xc02ca8,null))[_0x01e0('0x19')](function(_0x102a11){if(_0x102a11){var _0x3871b8=_0x102a11['get']({'plain':!![]});fs[_0x01e0('0x64')](_0x595810);var _0x2396bf={'channel':_0x01e0('0x65'),'account':_0x3871b8['Account']['name'],'agent':_0x3871b8['Owner']?_0x3871b8[_0x01e0('0x66')][_0x01e0('0x59')]:_0x01e0('0x67'),'createdAt':moment(_0x3871b8[_0x01e0('0x60')])[_0x01e0('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0x01e0('0x51')](),'closedAt':_0x3871b8[_0x01e0('0x68')]?moment(_0x3871b8[_0x01e0('0x69')])[_0x01e0('0x45')](_0x01e0('0x6a'))[_0x01e0('0x51')]():'','disposition':_0x3871b8[_0x01e0('0x6b')],'messages':_(_0x3871b8[_0x01e0('0x5f')])[_0x01e0('0x43')]({'secret':![]})[_0x01e0('0x1f')](function(_0x163818){if(_0x163818[_0x01e0('0x5e')]){var _0x1c359c=path[_0x01e0('0x52')](_0x259e1d,_0x163818[_0x01e0('0x5e')][_0x01e0('0x6c')]);if(fs[_0x01e0('0x6d')](_0x1c359c)){fs['createReadStream'](_0x1c359c)[_0x01e0('0x6e')](fs['createWriteStream'](path['join'](_0x595810,_0x163818[_0x01e0('0x5e')][_0x01e0('0x6c')])));}}return{'date':moment(_0x163818[_0x01e0('0x60')])[_0x01e0('0x45')](_0x01e0('0x6a'))[_0x01e0('0x51')](),'sender':_0x163818[_0x01e0('0x6f')]==='out'?_0x163818[_0x01e0('0x58')]?_0x163818[_0x01e0('0x58')][_0x01e0('0x59')]:'System':_0x163818[_0x01e0('0x5b')][_0x01e0('0x5c')]+(_0x163818[_0x01e0('0x5b')][_0x01e0('0x5d')]?'\x20'+_0x163818[_0x01e0('0x5b')][_0x01e0('0x5d')]:''),'body':_0x163818[_0x01e0('0x5e')]?_0x163818['Attachment']['basename']:_0x163818[_0x01e0('0x36')],'direction':_0x163818['direction']===_0x01e0('0x70')?'A':'C','secret':_0x163818[_0x01e0('0x61')],'read':_0x163818[_0x01e0('0x62')],'attachment':_0x163818[_0x01e0('0x5e')]};})[_0x01e0('0x71')]()};return ejs[_0x01e0('0x72')](path[_0x01e0('0x52')](config[_0x01e0('0x53')],'server',_0x01e0('0x73'),_0x01e0('0x74')),{'interaction':_0x2396bf})[_0x01e0('0x19')](function(_0x257622){var _0x374d06=path['join'](_0x595810,_0x01e0('0x75')+_0x3871b8['id']+'-'+_0x36d038+_0x01e0('0x76'));var _0x3fcc84={'path':_0x374d06,'channel':_0x01e0('0x65'),'interactionId':_0x3871b8['id']};return pdf[_0x01e0('0x77')](_0x257622,_0x3fcc84);})[_0x01e0('0x19')](function(){return new BPromise(function(_0x43bb77,_0x28cd8f){zipdir(_0x595810,{'saveTo':_0x2e3568},function(_0xefaa53,_0xeab7af){if(_0xefaa53)return _0x28cd8f(_0xefaa53);return _0x43bb77(_0xeab7af);});})[_0x01e0('0x19')](function(){return new BPromise(function(_0x331082,_0x5270a7){rimraf(_0x595810,function(_0x1e00eb){if(_0x1e00eb)_0x5270a7(_0x1e00eb);return _0x331082();});});})['then'](function(){return _0xc02ca8['download'](_0x2e3568,_0x313978,function(_0xd56c47){if(_0xd56c47){console['log'](_0x01e0('0x78'),_0xd56c47);}else{fs[_0x01e0('0x79')](_0x2e3568);}});});});}else{return _0xc02ca8[_0x01e0('0xe')](0xc8);}})[_0x01e0('0x28')](handleError(_0xc02ca8,null));}; \ No newline at end of file +var _0x332c=['firstName','lastName','Messages','createdAt','direction','read','WhatsappAccount','User','Owner','fullname','get','Whatsapp','Account','closed','closedAt','disposition','Attachment','existsSync','createReadStream','out','System','basename','secret','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/export/pdf','../../config/logger','../../config/environment','defaults','redis','localhost','./whatsappInteraction.socket','register','status','end','offset','limit','undefined','count','set','Content-Range','update','destroy','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','getOptions','findAll','whatsapp','query','user','params','model','keys','WhatsappInteraction','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','body','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','files','join','root','server','attachments','format','transcript-%d-%s.zip','push','CmContact','Contact'];(function(_0x29661f,_0x537b1e){var _0x31be8c=function(_0x5c5567){while(--_0x5c5567){_0x29661f['push'](_0x29661f['shift']());}};_0x31be8c(++_0x537b1e);}(_0x332c,0x11b));var _0xc332=function(_0x77df1,_0x291f5d){_0x77df1=_0x77df1-0x0;var _0x19e186=_0x332c[_0x77df1];return _0x19e186;};'use strict';var rimraf=require(_0xc332('0x0'));var zipdir=require(_0xc332('0x1'));var moment=require(_0xc332('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xc332('0x3'));var ejs=require(_0xc332('0x4'));var fs=require('fs');var _=require(_0xc332('0x5'));var Redis=require(_0xc332('0x6'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0xc332('0x7'));var logger=require(_0xc332('0x8'))('api');var config=require(_0xc332('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc332('0xa')](config[_0xc332('0xb')],{'host':_0xc332('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc332('0xb')]));require(_0xc332('0xd'))[_0xc332('0xe')](socket);function respondWithStatusCode(_0x433617,_0x196b6b){_0x196b6b=_0x196b6b||0xcc;return function(_0x478866){if(_0x478866){return _0x433617['sendStatus'](_0x196b6b);}return _0x433617[_0xc332('0xf')](_0x196b6b)[_0xc332('0x10')]();};}function respondWithResult(_0x41dce3,_0x5492f8){_0x5492f8=_0x5492f8||0xc8;return function(_0x584ab9){if(_0x584ab9){return _0x41dce3[_0xc332('0xf')](_0x5492f8)['json'](_0x584ab9);}};}function respondWithFilteredResult(_0x489df3,_0x2ab372){return function(_0x3299fc){if(_0x3299fc){var _0x146f64=typeof _0x2ab372[_0xc332('0x11')]==='undefined'&&typeof _0x2ab372[_0xc332('0x12')]===_0xc332('0x13');var _0x442dc4=_0x3299fc[_0xc332('0x14')];var _0x9b83e6=_0x146f64?0x0:_0x2ab372[_0xc332('0x11')];var _0x168ef4=_0x146f64?_0x3299fc[_0xc332('0x14')]:_0x2ab372['offset']+_0x2ab372['limit'];var _0x4204e8;if(_0x168ef4>=_0x442dc4){_0x168ef4=_0x442dc4;_0x4204e8=0xc8;}else{_0x4204e8=0xce;}_0x489df3[_0xc332('0xf')](_0x4204e8);return _0x489df3[_0xc332('0x15')](_0xc332('0x16'),_0x9b83e6+'-'+_0x168ef4+'/'+_0x442dc4)['json'](_0x3299fc);}return null;};}function saveUpdates(_0x1d64f9){return function(_0xf74d37){if(_0xf74d37){return _0xf74d37[_0xc332('0x17')](_0x1d64f9)['then'](function(_0x334d17){return _0x334d17;});}return null;};}function removeEntity(_0x3553c4){return function(_0x3ae519){if(_0x3ae519){return _0x3ae519[_0xc332('0x18')]()[_0xc332('0x19')](function(){_0x3553c4['status'](0xcc)[_0xc332('0x10')]();});}};}function handleEntityNotFound(_0x50ae2b){return function(_0x465165){if(!_0x465165){_0x50ae2b[_0xc332('0x1a')](0x194);}return _0x465165;};}function handleError(_0x5d4ffc,_0x2123e3){_0x2123e3=_0x2123e3||0x1f4;return function(_0x128cc3){logger[_0xc332('0x1b')](_0x128cc3[_0xc332('0x1c')]);if(_0x128cc3['name']){delete _0x128cc3[_0xc332('0x1d')];}_0x5d4ffc[_0xc332('0xf')](_0x2123e3)[_0xc332('0x1e')](_0x128cc3);};}exports[_0xc332('0x1f')]=function(_0x10ebeb,_0x241dbf){var _0xc3af6b={};var _0x5d6018=_['map'](db['WhatsappInteraction'][_0xc332('0x20')],function(_0x1b2bb2){return{'name':_0x1b2bb2[_0xc332('0x21')],'type':_0x1b2bb2[_0xc332('0x22')]['key']};});_0xc3af6b=qs[_0xc332('0x23')](_0x5d6018,_0x10ebeb);return interaction[_0xc332('0x24')](_0xc332('0x25'),_0x10ebeb[_0xc332('0x26')],_0x10ebeb[_0xc332('0x27')],_0xc3af6b,_0x5d6018)[_0xc332('0x19')](respondWithFilteredResult(_0x241dbf,_0xc3af6b))['catch'](handleError(_0x241dbf,null));};exports['show']=function(_0x140507,_0x685bef){var _0x28fba4={'raw':![],'where':{'id':_0x140507[_0xc332('0x28')]['id']}},_0x18d715={};_0x18d715[_0xc332('0x29')]=_[_0xc332('0x2a')](db[_0xc332('0x2b')][_0xc332('0x20')]);_0x18d715['query']=_['keys'](_0x140507[_0xc332('0x26')]);_0x18d715[_0xc332('0x2c')]=_[_0xc332('0x2d')](_0x18d715['model'],_0x18d715[_0xc332('0x26')]);_0x28fba4['attributes']=_['intersection'](_0x18d715[_0xc332('0x29')],qs[_0xc332('0x2e')](_0x140507[_0xc332('0x26')][_0xc332('0x2e')]));_0x28fba4['attributes']=_0x28fba4[_0xc332('0x2f')][_0xc332('0x30')]?_0x28fba4[_0xc332('0x2f')]:_0x18d715[_0xc332('0x29')];if(_0x140507[_0xc332('0x26')][_0xc332('0x31')]){_0x28fba4[_0xc332('0x32')]=[{'all':!![]}];}_0x28fba4=_[_0xc332('0x33')]({},_0x28fba4,_0x140507[_0xc332('0x34')]);return db[_0xc332('0x2b')][_0xc332('0x35')](_0x28fba4)[_0xc332('0x19')](handleEntityNotFound(_0x685bef,null))[_0xc332('0x19')](respondWithResult(_0x685bef,null))[_0xc332('0x36')](handleError(_0x685bef,null));};exports['create']=function(_0x2443ae,_0x20b8f2){return db[_0xc332('0x2b')]['create'](_0x2443ae[_0xc332('0x37')],{})[_0xc332('0x19')](respondWithResult(_0x20b8f2,0xc9))[_0xc332('0x36')](handleError(_0x20b8f2,null));};exports[_0xc332('0x17')]=function(_0x183099,_0x342643){if(_0x183099[_0xc332('0x37')]['id']){delete _0x183099['body']['id'];}return db[_0xc332('0x2b')]['find']({'where':{'id':_0x183099[_0xc332('0x28')]['id']}})['then'](handleEntityNotFound(_0x342643,null))[_0xc332('0x19')](saveUpdates(_0x183099[_0xc332('0x37')],null))[_0xc332('0x19')](respondWithResult(_0x342643,null))['catch'](handleError(_0x342643,null));};exports[_0xc332('0x18')]=function(_0x398c5a,_0x4f54cf){return db['WhatsappInteraction'][_0xc332('0x35')]({'where':{'id':_0x398c5a[_0xc332('0x28')]['id']}})[_0xc332('0x19')](handleEntityNotFound(_0x4f54cf,null))[_0xc332('0x19')](removeEntity(_0x4f54cf,null))[_0xc332('0x36')](handleError(_0x4f54cf,null));};exports[_0xc332('0x38')]=function(_0xecd1b5,_0x4eba95){return db[_0xc332('0x2b')]['describe']()[_0xc332('0x19')](respondWithResult(_0x4eba95,null))[_0xc332('0x36')](handleError(_0x4eba95,null));};exports[_0xc332('0x39')]=function(_0x158d25,_0x1b096c){return db[_0xc332('0x3a')]['find']({'where':{'id':_0x158d25[_0xc332('0x28')]['id']}})['then'](handleEntityNotFound(_0x1b096c,null))[_0xc332('0x19')](function(_0x5ecbb3){if(_0x5ecbb3){return _0x5ecbb3[_0xc332('0x39')](_0x158d25[_0xc332('0x37')][_0xc332('0x3b')],_['omit'](_0x158d25[_0xc332('0x37')],[_0xc332('0x3b'),'id'])||{});}})[_0xc332('0x19')](respondWithResult(_0x1b096c,null))[_0xc332('0x36')](handleError(_0x1b096c,null));};exports[_0xc332('0x3c')]=function(_0x5f01d4,_0x4deeda){var _0x8104e8={'raw':![],'where':{}};var _0x219634={};var _0x1b3e72={'count':0x0,'rows':[]};return db[_0xc332('0x2b')][_0xc332('0x3d')]({'where':{'id':_0x5f01d4[_0xc332('0x28')]['id']}})['then'](handleEntityNotFound(_0x4deeda,null))[_0xc332('0x19')](function(_0x11168b){if(_0x11168b){_0x219634[_0xc332('0x29')]=_[_0xc332('0x2a')](db[_0xc332('0x3a')]['rawAttributes']);_0x219634[_0xc332('0x26')]=_['keys'](_0x5f01d4['query']);_0x219634[_0xc332('0x2c')]=_[_0xc332('0x2d')](_0x219634[_0xc332('0x29')],_0x219634[_0xc332('0x26')]);_0x8104e8[_0xc332('0x2f')]=_[_0xc332('0x2d')](_0x219634[_0xc332('0x29')],qs[_0xc332('0x2e')](_0x5f01d4[_0xc332('0x26')][_0xc332('0x2e')]));_0x8104e8[_0xc332('0x2f')]=_0x8104e8[_0xc332('0x2f')][_0xc332('0x30')]?_0x8104e8[_0xc332('0x2f')]:_0x219634[_0xc332('0x29')];if(!_0x5f01d4[_0xc332('0x26')]['hasOwnProperty'](_0xc332('0x3e'))){_0x8104e8[_0xc332('0x12')]=qs[_0xc332('0x12')](_0x5f01d4[_0xc332('0x26')][_0xc332('0x12')]);_0x8104e8[_0xc332('0x11')]=qs[_0xc332('0x11')](_0x5f01d4[_0xc332('0x26')][_0xc332('0x11')]);}_0x8104e8[_0xc332('0x3f')]=qs['sort'](_0x5f01d4[_0xc332('0x26')][_0xc332('0x40')]);_0x8104e8[_0xc332('0x41')]=qs[_0xc332('0x2c')](_[_0xc332('0x42')](_0x5f01d4[_0xc332('0x26')],_0x219634['filters']));_0x8104e8[_0xc332('0x41')][_0xc332('0x43')]=_0x11168b['id'];if(_0x5f01d4['query'][_0xc332('0x44')]){_0x8104e8[_0xc332('0x41')]=_['merge'](_0x8104e8[_0xc332('0x41')],{'$or':_[_0xc332('0x45')](_0x8104e8[_0xc332('0x2f')],function(_0x5af2e7){var _0x193ad0={};_0x193ad0[_0x5af2e7]={'$like':'%'+_0x5f01d4['query'][_0xc332('0x44')]+'%'};return _0x193ad0;})});}if(_0x5f01d4[_0xc332('0x26')][_0xc332('0x46')]){var _0x4d20fa=_0x5f01d4[_0xc332('0x26')][_0xc332('0x46')][_0xc332('0x47')](',');var _0x2ddb19={};_0x2ddb19[_0x4d20fa[0x0]]={'$gte':moment(_0x4d20fa[0x1])['format'](_0xc332('0x48'))};_0x8104e8['where']=_[_0xc332('0x33')](_0x8104e8[_0xc332('0x41')],_0x2ddb19);}_0x8104e8=_[_0xc332('0x33')]({},_0x8104e8,_0x5f01d4[_0xc332('0x34')]);return db[_0xc332('0x3a')][_0xc332('0x14')]({'where':_0x8104e8[_0xc332('0x41')]})['then'](function(_0x159868){_0x1b3e72[_0xc332('0x14')]=_0x159868;if(_0x5f01d4[_0xc332('0x26')][_0xc332('0x31')]){_0x8104e8[_0xc332('0x32')]=[{'all':!![]}];}return db[_0xc332('0x3a')]['findAll'](_0x8104e8);})['then'](function(_0x45b63c){_0x1b3e72['rows']=_0x45b63c;return _0x1b3e72;});}})[_0xc332('0x19')](respondWithFilteredResult(_0x4deeda,_0x8104e8))['catch'](handleError(_0x4deeda,null));};exports[_0xc332('0x49')]=function(_0x5a6a23,_0x1378e9){return db[_0xc332('0x2b')][_0xc332('0x35')]({'where':{'id':_0x5a6a23[_0xc332('0x28')]['id']}})[_0xc332('0x19')](handleEntityNotFound(_0x1378e9,null))[_0xc332('0x19')](function(_0x97e57a){if(_0x97e57a){return _0x97e57a[_0xc332('0x4a')](_0x5a6a23['body'][_0xc332('0x3b')],_[_0xc332('0x4b')](_0x5a6a23[_0xc332('0x37')],[_0xc332('0x3b'),'id'])||{})[_0xc332('0x4c')](function(){return db[_0xc332('0x4d')]['findAll']({'attributes':['id',_0xc332('0x1d'),_0xc332('0x4e')],'where':{'id':_0x5a6a23[_0xc332('0x37')][_0xc332('0x3b')]}});})['then'](function(_0x18d34b){socket[_0xc332('0x4f')](_0xc332('0x50'),{'id':Number(_0x5a6a23[_0xc332('0x28')]['id']),'tags':_0x18d34b||[]});return{'id':Number(_0x5a6a23['params']['id']),'tags':_0x18d34b||[]};});}})[_0xc332('0x19')](respondWithResult(_0x1378e9,null))[_0xc332('0x36')](handleError(_0x1378e9,null));};exports[_0xc332('0x51')]=function(_0x1961df,_0x3cf732){return db[_0xc332('0x2b')][_0xc332('0x35')]({'where':{'id':_0x1961df[_0xc332('0x28')]['id']}})[_0xc332('0x19')](handleEntityNotFound(_0x3cf732,null))[_0xc332('0x19')](function(_0x5a0817){if(_0x5a0817){return _0x5a0817[_0xc332('0x51')](_0x1961df['query']['ids']);}})[_0xc332('0x19')](respondWithStatusCode(_0x3cf732,null))[_0xc332('0x36')](handleError(_0x3cf732,null));};exports[_0xc332('0x52')]=function(_0x53bb11,_0x3576be){var _0xe1b693=moment()[_0xc332('0x53')]()[_0xc332('0x54')]();var _0x2d8a14=path['join'](config['root'],'server',_0xc332('0x55'),'tmp');var _0x55f93a=path[_0xc332('0x56')](config[_0xc332('0x57')],_0xc332('0x58'),'files',_0xc332('0x59'));var _0x17b916=path['join'](_0x2d8a14,_0xe1b693);var _0x3d350f=util[_0xc332('0x5a')](_0xc332('0x5b'),_0x53bb11['params']['id'],_0xe1b693);var _0x266f30=path[_0xc332('0x56')](_0x2d8a14,_0x3d350f);var _0x44db22=[];_0x44db22['push']({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x44db22[_0xc332('0x5c')]({'model':db[_0xc332('0x5d')],'as':_0xc332('0x5e'),'attributes':['id',_0xc332('0x5f'),_0xc332('0x60')],'raw':!![]});if(_0x53bb11[_0xc332('0x26')][_0xc332('0x59')]){_0x44db22[_0xc332('0x5c')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x672ab1=[{'model':db['WhatsappMessage'],'as':_0xc332('0x61'),'attributes':['id',_0xc332('0x37'),_0xc332('0x62'),_0xc332('0x63'),'secret',_0xc332('0x64')],'include':_0x44db22}];_0x672ab1[_0xc332('0x5c')]({'model':db[_0xc332('0x65')],'as':'Account','attributes':['id',_0xc332('0x1d')]});_0x672ab1[_0xc332('0x5c')]({'model':db[_0xc332('0x66')],'as':_0xc332('0x67'),'attributes':['id',_0xc332('0x68')]});return db[_0xc332('0x2b')][_0xc332('0x35')]({'where':{'id':_0x53bb11[_0xc332('0x28')]['id']},'include':_0x672ab1})[_0xc332('0x19')](handleEntityNotFound(_0x3576be,null))['then'](function(_0x189035){if(_0x189035){var _0x5b0f09=_0x189035[_0xc332('0x69')]({'plain':!![]});fs['mkdirSync'](_0x17b916);var _0x18ae37={'channel':_0xc332('0x6a'),'account':_0x5b0f09[_0xc332('0x6b')]['name'],'agent':_0x5b0f09[_0xc332('0x67')]?_0x5b0f09['Owner'][_0xc332('0x68')]:'N.A.','createdAt':moment(_0x5b0f09['createdAt'])['format'](_0xc332('0x48'))[_0xc332('0x54')](),'closedAt':_0x5b0f09[_0xc332('0x6c')]?moment(_0x5b0f09[_0xc332('0x6d')])[_0xc332('0x5a')](_0xc332('0x48'))['toString']():'','disposition':_0x5b0f09[_0xc332('0x6e')],'messages':_(_0x5b0f09['Messages'])[_0xc332('0x44')]({'secret':![]})['map'](function(_0x4a51c9){if(_0x4a51c9[_0xc332('0x6f')]){var _0x40b489=path[_0xc332('0x56')](_0x55f93a,_0x4a51c9[_0xc332('0x6f')]['basename']);if(fs[_0xc332('0x70')](_0x40b489)){fs[_0xc332('0x71')](_0x40b489)['pipe'](fs['createWriteStream'](path[_0xc332('0x56')](_0x17b916,_0x4a51c9[_0xc332('0x6f')]['basename'])));}}return{'date':moment(_0x4a51c9[_0xc332('0x62')])[_0xc332('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc332('0x54')](),'sender':_0x4a51c9[_0xc332('0x63')]===_0xc332('0x72')?_0x4a51c9[_0xc332('0x66')]?_0x4a51c9[_0xc332('0x66')][_0xc332('0x68')]:_0xc332('0x73'):_0x4a51c9[_0xc332('0x5e')][_0xc332('0x5f')]+(_0x4a51c9['Contact'][_0xc332('0x60')]?'\x20'+_0x4a51c9[_0xc332('0x5e')][_0xc332('0x60')]:''),'body':_0x4a51c9[_0xc332('0x6f')]?_0x4a51c9[_0xc332('0x6f')][_0xc332('0x74')]:_0x4a51c9[_0xc332('0x37')],'direction':_0x4a51c9[_0xc332('0x63')]===_0xc332('0x72')?'A':'C','secret':_0x4a51c9[_0xc332('0x75')],'read':_0x4a51c9[_0xc332('0x64')],'attachment':_0x4a51c9['Attachment']};})[_0xc332('0x76')]()};return ejs[_0xc332('0x77')](path[_0xc332('0x56')](config[_0xc332('0x57')],_0xc332('0x58'),_0xc332('0x78'),_0xc332('0x79')),{'interaction':_0x18ae37})['then'](function(_0x5baab8){var _0x3b4fd6=path['join'](_0x17b916,_0xc332('0x7a')+_0x5b0f09['id']+'-'+_0xe1b693+'.pdf');var _0x5ee2f0={'path':_0x3b4fd6,'channel':'Whatsapp','interactionId':_0x5b0f09['id']};return pdf[_0xc332('0x7b')](_0x5baab8,_0x5ee2f0);})[_0xc332('0x19')](function(){return new BPromise(function(_0x5a220a,_0x39e25c){zipdir(_0x17b916,{'saveTo':_0x266f30},function(_0x5657dc,_0x14c0d3){if(_0x5657dc)return _0x39e25c(_0x5657dc);return _0x5a220a(_0x14c0d3);});})[_0xc332('0x19')](function(){return new BPromise(function(_0xb4a0e1,_0x49b691){rimraf(_0x17b916,function(_0x49d735){if(_0x49d735)_0x49b691(_0x49d735);return _0xb4a0e1();});});})[_0xc332('0x19')](function(){return _0x3576be[_0xc332('0x52')](_0x266f30,_0x3d350f,function(_0x5f1c46){if(_0x5f1c46){console['log'](_0xc332('0x7c'),_0x5f1c46);}else{fs[_0xc332('0x7d')](_0x266f30);}});});});}else{return _0x3576be[_0xc332('0x1a')](0xc8);}})[_0xc332('0x36')](handleError(_0x3576be,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index df515ec..2ac4751 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 _0x0439=['WhatsappMessage','setMaxListeners','save','remove','setDataValue','map','findAll','then','unreadMessages','length','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction'];(function(_0x430200,_0x544327){var _0x326626=function(_0x36f2fa){while(--_0x36f2fa){_0x430200['push'](_0x430200['shift']());}};_0x326626(++_0x544327);}(_0x0439,0xdd));var _0x9043=function(_0x5d98ae,_0x1b5de5){_0x5d98ae=_0x5d98ae-0x0;var _0x2dc998=_0x0439[_0x5d98ae];return _0x2dc998;};'use strict';var EventEmitter=require(_0x9043('0x0'));var WhatsappInteraction=require(_0x9043('0x1'))['db'][_0x9043('0x2')];var WhatsappMessage=require(_0x9043('0x1'))['db'][_0x9043('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9043('0x4')](0x0);var events={'afterCreate':_0x9043('0x5'),'afterUpdate':'update','afterDestroy':_0x9043('0x6')};function emitEvent(_0xb101f6){return function(_0x24eecf,_0x483bb5,_0x3a1c0e){_0x24eecf['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2fe4da){_0x24eecf[_0x9043('0x7')]('Users',_0x2fe4da[_0x9043('0x8')](function(_0x4b2c9b){return{'id':_0x4b2c9b['id']};}));return WhatsappMessage[_0x9043('0x9')]({'where':{'WhatsappInteractionId':_0x24eecf['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9043('0xa')](function(_0x5e106f){_0x24eecf[_0x9043('0x7')](_0x9043('0xb'),_0x5e106f[_0x9043('0xc')]);WhatsappInteractionEvents['emit'](_0xb101f6+':'+_0x24eecf['id'],_0x24eecf);WhatsappInteractionEvents['emit'](_0xb101f6,_0x24eecf);_0x3a1c0e(null);})[_0x9043('0xd')](_0x3a1c0e(null));};}for(var e in events){if(events[_0x9043('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x9043('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x7fce=['save','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0x7fce,0xdc));var _0xe7fc=function(_0x3a64c6,_0x43d985){_0x3a64c6=_0x3a64c6-0x0;var _0x5ef7c2=_0x7fce[_0x3a64c6];return _0x5ef7c2;};'use strict';var EventEmitter=require(_0xe7fc('0x0'));var WhatsappInteraction=require(_0xe7fc('0x1'))['db'][_0xe7fc('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0xe7fc('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe7fc('0x4'),'afterUpdate':'update','afterDestroy':_0xe7fc('0x5')};function emitEvent(_0x337972){return function(_0x5810de,_0x55392f,_0x223d07){_0x5810de['getUsers']({'attributes':['id'],'raw':!![]})[_0xe7fc('0x6')](function(_0x161dca){_0x5810de[_0xe7fc('0x7')](_0xe7fc('0x8'),_0x161dca[_0xe7fc('0x9')](function(_0x525bfd){return{'id':_0x525bfd['id']};}));return WhatsappMessage[_0xe7fc('0xa')]({'where':{'WhatsappInteractionId':_0x5810de['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xc98c5e){_0x5810de['setDataValue'](_0xe7fc('0xb'),_0xc98c5e[_0xe7fc('0xc')]);WhatsappInteractionEvents[_0xe7fc('0xd')](_0x337972+':'+_0x5810de['id'],_0x5810de);WhatsappInteractionEvents[_0xe7fc('0xd')](_0x337972,_0x5810de);_0x223d07(null);})['catch'](_0x223d07(null));};}for(var e in events){if(events[_0xe7fc('0xe')](e)){var event=events[e];WhatsappInteraction[_0xe7fc('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index ab3149c..f5431d6 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 _0x9f62=['WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports'];(function(_0x1c7232,_0x5bd8d2){var _0x580005=function(_0x931d01){while(--_0x931d01){_0x1c7232['push'](_0x1c7232['shift']());}};_0x580005(++_0x5bd8d2);}(_0x9f62,0x115));var _0x29f6=function(_0xa0114d,_0x2084d5){_0xa0114d=_0xa0114d-0x0;var _0x4cfab6=_0x9f62[_0xa0114d];return _0x4cfab6;};'use strict';var _=require(_0x29f6('0x0'));var util=require(_0x29f6('0x1'));var logger=require(_0x29f6('0x2'))(_0x29f6('0x3'));var moment=require(_0x29f6('0x4'));var BPromise=require(_0x29f6('0x5'));var rp=require(_0x29f6('0x6'));var fs=require('fs');var path=require(_0x29f6('0x7'));var rimraf=require(_0x29f6('0x8'));var config=require('../../config/environment');var attributes=require(_0x29f6('0x9'));module[_0x29f6('0xa')]=function(_0x5ba4fa,_0x4a8c94){return _0x5ba4fa['define'](_0x29f6('0xb'),attributes,{'tableName':_0x29f6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20463f,_0x292685,_0x57efc5){if(_0x20463f[_0x29f6('0xd')](_0x29f6('0xe'))){_0x20463f[_0x29f6('0xf')]=moment()[_0x29f6('0x10')](_0x29f6('0x11'));}_0x57efc5(null,_0x20463f);}}});}; \ No newline at end of file +var _0x032e=['bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment'];(function(_0x15a011,_0x3ba86e){var _0x552b21=function(_0x48ed47){while(--_0x48ed47){_0x15a011['push'](_0x15a011['shift']());}};_0x552b21(++_0x3ba86e);}(_0x032e,0x1cc));var _0xe032=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x032e[_0x2bf141];return _0x48277b;};'use strict';var _=require('lodash');var util=require(_0xe032('0x0'));var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require(_0xe032('0x3'));var BPromise=require(_0xe032('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe032('0x5'));var rimraf=require(_0xe032('0x6'));var config=require(_0xe032('0x7'));var attributes=require(_0xe032('0x8'));module[_0xe032('0x9')]=function(_0x43dc81,_0x20da91){return _0x43dc81['define'](_0xe032('0xa'),attributes,{'tableName':_0xe032('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x265677,_0xa36fe0,_0x1c06f0){if(_0x265677[_0xe032('0xc')]('closed')){_0x265677[_0xe032('0xd')]=moment()[_0xe032('0xe')](_0xe032('0xf'));}_0x1c06f0(null,_0x265677);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index fe50d22..241bc15 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 _0xa1d6=['attributes','then','catch','addTags','omit','body','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','options','raw','where'];(function(_0x4c4a8b,_0x402020){var _0x20fa14=function(_0xbe8c84){while(--_0xbe8c84){_0x4c4a8b['push'](_0x4c4a8b['shift']());}};_0x20fa14(++_0x402020);}(_0xa1d6,0xcc));var _0x6a1d=function(_0x1e971b,_0x483c5f){_0x1e971b=_0x1e971b-0x0;var _0x59adcb=_0xa1d6[_0x1e971b];return _0x59adcb;};'use strict';var _=require(_0x6a1d('0x0'));var util=require(_0x6a1d('0x1'));var moment=require(_0x6a1d('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a1d('0x3'));var fs=require('fs');var Redis=require(_0x6a1d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a1d('0x5'));var logger=require(_0x6a1d('0x6'))(_0x6a1d('0x7'));var config=require('../../config/environment');var jayson=require(_0x6a1d('0x8'));var client=jayson[_0x6a1d('0x9')][_0x6a1d('0xa')]({'port':0x232a});config[_0x6a1d('0xb')]=_[_0x6a1d('0xc')](config[_0x6a1d('0xb')],{'host':_0x6a1d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a1d('0xb')]));require('./whatsappInteraction.socket')[_0x6a1d('0xe')](socket);function respondWithRpcPromise(_0x1f870b,_0xe82d38,_0x3ead7e){return new BPromise(function(_0x32a23a,_0x1c5aae){return client['request'](_0x1f870b,_0x3ead7e)['then'](function(_0x46c505){logger[_0x6a1d('0xf')](_0x6a1d('0x10'),_0xe82d38,'request\x20sent');logger[_0x6a1d('0x11')](_0x6a1d('0x12'),_0xe82d38,_0x6a1d('0x13'),JSON[_0x6a1d('0x14')](_0x46c505));if(_0x46c505['error']){if(_0x46c505[_0x6a1d('0x15')][_0x6a1d('0x16')]===0x1f4){logger['error'](_0x6a1d('0x10'),_0xe82d38,_0x46c505['error'][_0x6a1d('0x17')]);return _0x1c5aae(_0x46c505['error'][_0x6a1d('0x17')]);}logger[_0x6a1d('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0xe82d38,_0x46c505[_0x6a1d('0x15')][_0x6a1d('0x17')]);return _0x32a23a(_0x46c505[_0x6a1d('0x15')][_0x6a1d('0x17')]);}else{logger[_0x6a1d('0xf')](_0x6a1d('0x10'),_0xe82d38,_0x6a1d('0x13'));_0x32a23a(_0x46c505[_0x6a1d('0x18')][_0x6a1d('0x17')]);}})['catch'](function(_0x56fe9f){logger[_0x6a1d('0x15')](_0x6a1d('0x10'),_0xe82d38,_0x56fe9f);_0x1c5aae(_0x56fe9f);});});}exports[_0x6a1d('0x19')]=function(_0x1e973d){var _0xd30d6d=this;return new Promise(function(_0x2473a0,_0x171298){return db[_0x6a1d('0x1a')]['update'](_0x1e973d['body'],{'raw':_0x1e973d['options']?_0x1e973d[_0x6a1d('0x1b')][_0x6a1d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e973d[_0x6a1d('0x1b')]?_0x1e973d[_0x6a1d('0x1b')][_0x6a1d('0x1d')]||null:null,'attributes':_0x1e973d[_0x6a1d('0x1b')]?_0x1e973d[_0x6a1d('0x1b')][_0x6a1d('0x1e')]||null:null,'limit':_0x1e973d[_0x6a1d('0x1b')]?_0x1e973d['options']['limit']||null:null})[_0x6a1d('0x1f')](function(_0x5a7c53){logger[_0x6a1d('0xf')]('UpdateWhatsappInteraction',_0x1e973d);logger[_0x6a1d('0x11')](_0x6a1d('0x19'),_0x1e973d,JSON[_0x6a1d('0x14')](_0x5a7c53));_0x2473a0(_0x5a7c53);})[_0x6a1d('0x20')](function(_0x18b443){logger[_0x6a1d('0x15')]('UpdateWhatsappInteraction',_0x18b443['message'],_0x1e973d);_0x171298(_0xd30d6d[_0x6a1d('0x15')](0x1f4,_0x18b443[_0x6a1d('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x422ed5){return new Promise(function(_0x2ca05c,_0x333a89){return db[_0x6a1d('0x1a')]['find']({'where':_0x422ed5[_0x6a1d('0x1b')]?_0x422ed5[_0x6a1d('0x1b')][_0x6a1d('0x1d')]||null:null})[_0x6a1d('0x1f')](function(_0x5e66e2){if(_0x5e66e2){return _0x5e66e2[_0x6a1d('0x21')](_0x422ed5['body']['ids'],_[_0x6a1d('0x22')](_0x422ed5[_0x6a1d('0x23')],[_0x6a1d('0x24'),'id'])||{});}})[_0x6a1d('0x25')](function(_0x5aa533){logger['info']('AddTags',_0x422ed5);logger[_0x6a1d('0x11')](_0x6a1d('0x26'),_0x422ed5,JSON[_0x6a1d('0x14')](_0x5aa533));_0x2ca05c(_0x5aa533);})[_0x6a1d('0x20')](function(_0x309ae2){logger['error'](_0x6a1d('0x26'),_0x309ae2['message'],_0x422ed5);_0x333a89(_this['error'](0x1f4,_0x309ae2[_0x6a1d('0x17')]));});});}; \ No newline at end of file +var _0x2d9b=['AddTagsToWhatsappInteraction','find','body','ids','omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappInteraction.socket','then','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','limit'];(function(_0x12f8f6,_0x3a3572){var _0x57f571=function(_0x2d9322){while(--_0x2d9322){_0x12f8f6['push'](_0x12f8f6['shift']());}};_0x57f571(++_0x3a3572);}(_0x2d9b,0xf7));var _0xb2d9=function(_0x54a242,_0x574ded){_0x54a242=_0x54a242-0x0;var _0x4d99d8=_0x2d9b[_0x54a242];return _0x4d99d8;};'use strict';var _=require('lodash');var util=require(_0xb2d9('0x0'));var moment=require('moment');var BPromise=require(_0xb2d9('0x1'));var rs=require(_0xb2d9('0x2'));var fs=require('fs');var Redis=require(_0xb2d9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb2d9('0x4'));var logger=require(_0xb2d9('0x5'))(_0xb2d9('0x6'));var config=require(_0xb2d9('0x7'));var jayson=require(_0xb2d9('0x8'));var client=jayson[_0xb2d9('0x9')][_0xb2d9('0xa')]({'port':0x232a});config[_0xb2d9('0xb')]=_['defaults'](config[_0xb2d9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb2d9('0xc'))(new Redis(config[_0xb2d9('0xb')]));require(_0xb2d9('0xd'))['register'](socket);function respondWithRpcPromise(_0x2d706a,_0x3470ed,_0x1410a5){return new BPromise(function(_0x2e42cc,_0x49a4c0){return client['request'](_0x2d706a,_0x1410a5)[_0xb2d9('0xe')](function(_0x45755d){logger[_0xb2d9('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x3470ed,'request\x20sent');logger[_0xb2d9('0x10')](_0xb2d9('0x11'),_0x3470ed,_0xb2d9('0x12'),JSON[_0xb2d9('0x13')](_0x45755d));if(_0x45755d['error']){if(_0x45755d['error'][_0xb2d9('0x14')]===0x1f4){logger[_0xb2d9('0x15')](_0xb2d9('0x16'),_0x3470ed,_0x45755d['error'][_0xb2d9('0x17')]);return _0x49a4c0(_0x45755d[_0xb2d9('0x15')][_0xb2d9('0x17')]);}logger['error'](_0xb2d9('0x16'),_0x3470ed,_0x45755d[_0xb2d9('0x15')][_0xb2d9('0x17')]);return _0x2e42cc(_0x45755d['error'][_0xb2d9('0x17')]);}else{logger[_0xb2d9('0xf')](_0xb2d9('0x16'),_0x3470ed,_0xb2d9('0x12'));_0x2e42cc(_0x45755d[_0xb2d9('0x18')]['message']);}})[_0xb2d9('0x19')](function(_0xdc6d3d){logger['error'](_0xb2d9('0x16'),_0x3470ed,_0xdc6d3d);_0x49a4c0(_0xdc6d3d);});});}exports[_0xb2d9('0x1a')]=function(_0x359f47){var _0x4a5d6a=this;return new Promise(function(_0x3f6629,_0x5b77d7){return db[_0xb2d9('0x1b')][_0xb2d9('0x1c')](_0x359f47['body'],{'raw':_0x359f47['options']?_0x359f47[_0xb2d9('0x1d')][_0xb2d9('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x359f47[_0xb2d9('0x1d')]?_0x359f47[_0xb2d9('0x1d')][_0xb2d9('0x1f')]||null:null,'attributes':_0x359f47[_0xb2d9('0x1d')]?_0x359f47['options']['attributes']||null:null,'limit':_0x359f47[_0xb2d9('0x1d')]?_0x359f47['options'][_0xb2d9('0x20')]||null:null})[_0xb2d9('0xe')](function(_0x1bdc4a){logger[_0xb2d9('0xf')](_0xb2d9('0x1a'),_0x359f47);logger['debug']('UpdateWhatsappInteraction',_0x359f47,JSON[_0xb2d9('0x13')](_0x1bdc4a));_0x3f6629(_0x1bdc4a);})[_0xb2d9('0x19')](function(_0x24519a){logger[_0xb2d9('0x15')](_0xb2d9('0x1a'),_0x24519a[_0xb2d9('0x17')],_0x359f47);_0x5b77d7(_0x4a5d6a[_0xb2d9('0x15')](0x1f4,_0x24519a[_0xb2d9('0x17')]));});});};exports[_0xb2d9('0x21')]=function(_0x392ca3){return new Promise(function(_0x5d4c91,_0x4eff1f){return db['WhatsappInteraction'][_0xb2d9('0x22')]({'where':_0x392ca3[_0xb2d9('0x1d')]?_0x392ca3[_0xb2d9('0x1d')][_0xb2d9('0x1f')]||null:null})[_0xb2d9('0xe')](function(_0x311397){if(_0x311397){return _0x311397['addTags'](_0x392ca3[_0xb2d9('0x23')][_0xb2d9('0x24')],_[_0xb2d9('0x25')](_0x392ca3[_0xb2d9('0x23')],[_0xb2d9('0x24'),'id'])||{});}})[_0xb2d9('0x26')](function(_0x2c4b57){logger[_0xb2d9('0xf')]('AddTags',_0x392ca3);logger[_0xb2d9('0x10')](_0xb2d9('0x27'),_0x392ca3,JSON[_0xb2d9('0x13')](_0x2c4b57));_0x5d4c91(_0x2c4b57);})['catch'](function(_0x43b67a){logger['error'](_0xb2d9('0x27'),_0x43b67a[_0xb2d9('0x17')],_0x392ca3);_0x4eff1f(_this['error'](0x1f4,_0x43b67a[_0xb2d9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 7e1b2af..3442fd1 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 _0xc6ee=['update','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc6ee,0x125));var _0xec6e=function(_0x437e8a,_0x44dfba){_0x437e8a=_0x437e8a-0x0;var _0x5e9910=_0xc6ee[_0x437e8a];return _0x5e9910;};'use strict';var WhatsappInteractionEvents=require(_0xec6e('0x0'));var events=['save','remove',_0xec6e('0x1')];function createListener(_0x9d8aea,_0x4f0e16){return function(_0x34b3c1){_0x4f0e16['emit'](_0x9d8aea,_0x34b3c1);};}function removeListener(_0x5eeacb,_0x5a9cc5){return function(){WhatsappInteractionEvents[_0xec6e('0x2')](_0x5eeacb,_0x5a9cc5);};}exports[_0xec6e('0x3')]=function(_0x574bee){for(var _0x12761f=0x0,_0x2f3fae=events[_0xec6e('0x4')];_0x12761f<_0x2f3fae;_0x12761f++){var _0x4a6d47=events[_0x12761f];var _0x1239e9=createListener(_0xec6e('0x5')+_0x4a6d47,_0x574bee);WhatsappInteractionEvents['on'](_0x4a6d47,_0x1239e9);}}; \ No newline at end of file +var _0x6721=['emit','removeListener','register','length','whatsappInteraction:','remove','update'];(function(_0x6d8aa,_0x4a04f0){var _0x47f8bb=function(_0x88a0a){while(--_0x88a0a){_0x6d8aa['push'](_0x6d8aa['shift']());}};_0x47f8bb(++_0x4a04f0);}(_0x6721,0x16a));var _0x1672=function(_0x269b89,_0x21103e){_0x269b89=_0x269b89-0x0;var _0x4aa80f=_0x6721[_0x269b89];return _0x4aa80f;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x1672('0x0'),_0x1672('0x1')];function createListener(_0x4c8471,_0x54206e){return function(_0xa09ed5){_0x54206e[_0x1672('0x2')](_0x4c8471,_0xa09ed5);};}function removeListener(_0x15ddf2,_0x48d26e){return function(){WhatsappInteractionEvents[_0x1672('0x3')](_0x15ddf2,_0x48d26e);};}exports[_0x1672('0x4')]=function(_0x117526){for(var _0x1a0d5d=0x0,_0x48fe87=events[_0x1672('0x5')];_0x1a0d5d<_0x48fe87;_0x1a0d5d++){var _0x4b3fab=events[_0x1a0d5d];var _0x16db1b=createListener(_0x1672('0x6')+_0x4b3fab,_0x117526);WhatsappInteractionEvents['on'](_0x4b3fab,_0x16db1b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 651a718..52f710a 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 _0xd60f=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','show','post','tracked','whatsappmessage:create','/:id/status','status','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util'];(function(_0x147b92,_0x263496){var _0x1fae74=function(_0x29f20a){while(--_0x29f20a){_0x147b92['push'](_0x147b92['shift']());}};_0x1fae74(++_0x263496);}(_0xd60f,0xa6));var _0xfd60=function(_0x230208,_0x299a3a){_0x230208=_0x230208-0x0;var _0x20ade3=_0xd60f[_0x230208];return _0x20ade3;};'use strict';var multer=require(_0xfd60('0x0'));var util=require(_0xfd60('0x1'));var path=require(_0xfd60('0x2'));var timeout=require(_0xfd60('0x3'));var express=require(_0xfd60('0x4'));var router=express[_0xfd60('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfd60('0x6'));var config=require(_0xfd60('0x7'));var controller=require(_0xfd60('0x8'));router[_0xfd60('0x9')]('/',auth[_0xfd60('0xa')](),controller[_0xfd60('0xb')]);router['get'](_0xfd60('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xfd60('0x9')]('/:id',auth[_0xfd60('0xa')](),controller[_0xfd60('0xd')]);router[_0xfd60('0xe')]('/',auth[_0xfd60('0xa')](),interaction[_0xfd60('0xf')]('whatsapp',_0xfd60('0x10')),controller['create']);router[_0xfd60('0xe')](_0xfd60('0x11'),controller[_0xfd60('0x12')]);router[_0xfd60('0x13')](_0xfd60('0x14'),auth[_0xfd60('0xa')](),controller['update']);router[_0xfd60('0x13')](_0xfd60('0x15'),auth['isAuthenticated'](),controller[_0xfd60('0x16')]);router['put'](_0xfd60('0x17'),auth['isAuthenticated'](),controller[_0xfd60('0x18')]);router[_0xfd60('0x19')](_0xfd60('0x14'),auth[_0xfd60('0xa')](),controller[_0xfd60('0x1a')]);module[_0xfd60('0x1b')]=router; \ No newline at end of file +var _0x2b69=['show','post','tracked','whatsappmessage:create','create','/:id/status','put','/:id/accept','accept','/:id/reject','reject','delete','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x599bda,_0x33c506){var _0x2c5d44=function(_0x3fae24){while(--_0x3fae24){_0x599bda['push'](_0x599bda['shift']());}};_0x2c5d44(++_0x33c506);}(_0x2b69,0x1ac));var _0x92b6=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x2b69[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0x92b6('0x0'));var util=require('util');var path=require(_0x92b6('0x1'));var timeout=require(_0x92b6('0x2'));var express=require(_0x92b6('0x3'));var router=express['Router']();var fs_extra=require(_0x92b6('0x4'));var auth=require(_0x92b6('0x5'));var interaction=require(_0x92b6('0x6'));var config=require(_0x92b6('0x7'));var controller=require(_0x92b6('0x8'));router[_0x92b6('0x9')]('/',auth[_0x92b6('0xa')](),controller['index']);router['get'](_0x92b6('0xb'),auth['isAuthenticated'](),controller[_0x92b6('0xc')]);router[_0x92b6('0x9')](_0x92b6('0xd'),auth[_0x92b6('0xa')](),controller[_0x92b6('0xe')]);router[_0x92b6('0xf')]('/',auth[_0x92b6('0xa')](),interaction[_0x92b6('0x10')]('whatsapp',_0x92b6('0x11')),controller[_0x92b6('0x12')]);router[_0x92b6('0xf')](_0x92b6('0x13'),controller['status']);router[_0x92b6('0x14')](_0x92b6('0xd'),auth[_0x92b6('0xa')](),controller['update']);router[_0x92b6('0x14')](_0x92b6('0x15'),auth['isAuthenticated'](),controller[_0x92b6('0x16')]);router[_0x92b6('0x14')](_0x92b6('0x17'),auth[_0x92b6('0xa')](),controller[_0x92b6('0x18')]);router[_0x92b6('0x19')](_0x92b6('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 830fb17..a0f2f97 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 _0x794b=['medium','ENUM','out','STRING','DATE','BOOLEAN','TEXT'];(function(_0x44427c,_0x1af9a8){var _0x46a563=function(_0x56cd22){while(--_0x56cd22){_0x44427c['push'](_0x44427c['shift']());}};_0x46a563(++_0x1af9a8);}(_0x794b,0xa7));var _0xb794=function(_0x2a82ae,_0x5e321c){_0x2a82ae=_0x2a82ae-0x0;var _0x1f0f5b=_0x794b[_0x2a82ae];return _0x1f0f5b;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xb794('0x0')](_0xb794('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb794('0x2')]('in','out'),'defaultValue':_0xb794('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb794('0x4')](0xbe)},'phone':{'type':Sequelize[_0xb794('0x4')]},'readAt':{'type':Sequelize[_0xb794('0x5')]},'secret':{'type':Sequelize[_0xb794('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x6eb833,_0x2bb5e5){_0x6eb833=_0x6eb833-0x0;var _0xdfc38c=_0x5fc3[_0x6eb833];return _0xdfc38c;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'body':{'type':Sequelize['TEXT'](_0x35fc('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x35fc('0x4')]('in',_0x35fc('0x5')),'defaultValue':_0x35fc('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x35fc('0x6')]},'readAt':{'type':Sequelize[_0x35fc('0x7')]},'secret':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'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 4774a9c..624de52 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 _0xe288=['user','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','agent','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','WhatsappInteractionId','null','RejectMessage','rejectMessage','ContactId','QueryTypes','User','interface','motionChannel','rejectmessage','WhatsappAccountId','inspect','twilio','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','http','client','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','name','index','map','WhatsappMessage','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','include','rows','show','params','rawAttributes','filters','includeAll','options','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId'];(function(_0x1f6e71,_0x19360b){var _0x2271aa=function(_0x2f0431){while(--_0x2f0431){_0x1f6e71['push'](_0x1f6e71['shift']());}};_0x2271aa(++_0x19360b);}(_0xe288,0x13d));var _0x8e28=function(_0x1028a7,_0x53ee9f){_0x1028a7=_0x1028a7-0x0;var _0x5046df=_0xe288[_0x1028a7];return _0x5046df;};'use strict';var emlformat=require(_0x8e28('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e28('0x1'));var jsonpatch=require(_0x8e28('0x2'));var rp=require(_0x8e28('0x3'));var moment=require(_0x8e28('0x4'));var BPromise=require(_0x8e28('0x5'));var Mustache=require(_0x8e28('0x6'));var util=require(_0x8e28('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8e28('0x8'));var ejs=require(_0x8e28('0x9'));var fs=require('fs');var fs_extra=require(_0x8e28('0xa'));var _=require(_0x8e28('0xb'));var squel=require(_0x8e28('0xc'));var crypto=require(_0x8e28('0xd'));var jsforce=require(_0x8e28('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8e28('0x8'));var querystring=require(_0x8e28('0xf'));var Papa=require(_0x8e28('0x10'));var Redis=require(_0x8e28('0x11'));var authService=require(_0x8e28('0x12'));var qs=require(_0x8e28('0x13'));var as=require(_0x8e28('0x14'));var hardwareService=require(_0x8e28('0x15'));var logger=require(_0x8e28('0x16'))('api');var utils=require(_0x8e28('0x17'));var config=require(_0x8e28('0x18'));var licenseUtil=require(_0x8e28('0x19'));var db=require(_0x8e28('0x1a'))['db'];config[_0x8e28('0x1b')]=_[_0x8e28('0x1c')](config[_0x8e28('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x8e28('0x1d'))(new Redis(config[_0x8e28('0x1b')]));require(_0x8e28('0x1e'))[_0x8e28('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8e28('0x20')]({'port':0x232c});var client9002=jayson[_0x8e28('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x408190,_0x4f1134,_0x1fa09c,_0x26791e){return new BPromise(function(_0x43cfd7,_0x95d05d){var _0x560aee=_0x26791e||client;return _0x560aee[_0x8e28('0x22')](_0x408190,_0x1fa09c)['then'](function(_0x165d13){logger['info'](_0x8e28('0x23'),_0x4f1134,_0x8e28('0x24'));logger[_0x8e28('0x25')](_0x8e28('0x26'),_0x4f1134,'request\x20sent',JSON[_0x8e28('0x27')](_0x165d13));if(_0x165d13['error']){if(_0x165d13['error'][_0x8e28('0x28')]===0x1f4){logger[_0x8e28('0x29')](_0x8e28('0x23'),_0x4f1134,_0x165d13[_0x8e28('0x29')][_0x8e28('0x2a')]);return _0x95d05d(_0x165d13['error']['message']);}logger[_0x8e28('0x29')](_0x8e28('0x23'),_0x4f1134,_0x165d13['error'][_0x8e28('0x2a')]);return _0x43cfd7(_0x165d13[_0x8e28('0x29')][_0x8e28('0x2a')]);}else{logger[_0x8e28('0x2b')](_0x8e28('0x23'),_0x4f1134,'request\x20sent');_0x43cfd7(_0x165d13['result']['message']);}})[_0x8e28('0x2c')](function(_0x1a9648){logger[_0x8e28('0x29')](_0x8e28('0x23'),_0x4f1134,_0x1a9648);_0x95d05d(_0x1a9648);});});}function respondWithStatusCode(_0x2c84d9,_0x316599){_0x316599=_0x316599||0xcc;return function(_0x4cd276){if(_0x4cd276){return _0x2c84d9[_0x8e28('0x2d')](_0x316599);}return _0x2c84d9['status'](_0x316599)[_0x8e28('0x2e')]();};}function respondWithResult(_0x19824d,_0x167739){_0x167739=_0x167739||0xc8;return function(_0x186cd2){if(_0x186cd2){return _0x19824d['status'](_0x167739)[_0x8e28('0x2f')](_0x186cd2);}};}function respondWithFilteredResult(_0x17fa31,_0x1b988d){return function(_0x57dd80){if(_0x57dd80){var _0x23c5d6=typeof _0x1b988d[_0x8e28('0x30')]===_0x8e28('0x31')&&typeof _0x1b988d[_0x8e28('0x32')]===_0x8e28('0x31');var _0x55d26f=_0x57dd80[_0x8e28('0x33')];var _0x1787b6=_0x23c5d6?0x0:_0x1b988d[_0x8e28('0x30')];var _0x4bd71c=_0x23c5d6?_0x57dd80['count']:_0x1b988d[_0x8e28('0x30')]+_0x1b988d[_0x8e28('0x32')];var _0x734e43;if(_0x4bd71c>=_0x55d26f){_0x4bd71c=_0x55d26f;_0x734e43=0xc8;}else{_0x734e43=0xce;}_0x17fa31[_0x8e28('0x34')](_0x734e43);return _0x17fa31[_0x8e28('0x35')](_0x8e28('0x36'),_0x1787b6+'-'+_0x4bd71c+'/'+_0x55d26f)[_0x8e28('0x2f')](_0x57dd80);}return null;};}function patchUpdates(_0x304fd0){return function(_0x1a9ad8){try{jsonpatch[_0x8e28('0x37')](_0x1a9ad8,_0x304fd0,!![]);}catch(_0x5afb9a){return BPromise[_0x8e28('0x38')](_0x5afb9a);}return _0x1a9ad8[_0x8e28('0x39')]();};}function saveUpdates(_0x285499,_0x13d3e9){return function(_0x347f77){if(_0x347f77){return _0x347f77[_0x8e28('0x3a')](_0x285499)[_0x8e28('0x3b')](function(_0x51c0e8){return _0x51c0e8;});}return null;};}function removeEntity(_0x46d93e,_0x450897){return function(_0x1a2c4b){if(_0x1a2c4b){return _0x1a2c4b['destroy']()[_0x8e28('0x3b')](function(){_0x46d93e[_0x8e28('0x34')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31ca03,_0x375ff7){return function(_0x284c83){if(!_0x284c83){_0x31ca03[_0x8e28('0x2d')](0x194);}return _0x284c83;};}function handleError(_0x486caf,_0x319227){_0x319227=_0x319227||0x1f4;return function(_0x116936){logger[_0x8e28('0x29')](_0x116936['stack']);if(_0x116936['name']){delete _0x116936[_0x8e28('0x3c')];}_0x486caf['status'](_0x319227)['send'](_0x116936);};}exports[_0x8e28('0x3d')]=function(_0x1e542e,_0x361258){var _0x156c20={},_0x2e0385={},_0x44c650={'count':0x0,'rows':[]};var _0x23c6b9=_[_0x8e28('0x3e')](db[_0x8e28('0x3f')]['rawAttributes'],function(_0x4c17a7){return{'name':_0x4c17a7[_0x8e28('0x40')],'type':_0x4c17a7[_0x8e28('0x41')]['key']};});_0x2e0385[_0x8e28('0x42')]=_[_0x8e28('0x3e')](_0x23c6b9,_0x8e28('0x3c'));_0x2e0385[_0x8e28('0x43')]=_[_0x8e28('0x44')](_0x1e542e['query']);_0x2e0385['filters']=_[_0x8e28('0x45')](_0x2e0385[_0x8e28('0x42')],_0x2e0385['query']);_0x156c20['attributes']=_[_0x8e28('0x45')](_0x2e0385['model'],qs[_0x8e28('0x46')](_0x1e542e[_0x8e28('0x43')][_0x8e28('0x46')]));_0x156c20[_0x8e28('0x47')]=_0x156c20[_0x8e28('0x47')][_0x8e28('0x48')]?_0x156c20[_0x8e28('0x47')]:_0x2e0385[_0x8e28('0x42')];if(!_0x1e542e[_0x8e28('0x43')][_0x8e28('0x49')](_0x8e28('0x4a'))){_0x156c20['limit']=qs[_0x8e28('0x32')](_0x1e542e[_0x8e28('0x43')][_0x8e28('0x32')]);_0x156c20[_0x8e28('0x30')]=qs['offset'](_0x1e542e[_0x8e28('0x43')][_0x8e28('0x30')]);}_0x156c20['order']=qs[_0x8e28('0x4b')](_0x1e542e[_0x8e28('0x43')]['sort']);_0x156c20[_0x8e28('0x4c')]=qs['filters'](_[_0x8e28('0x4d')](_0x1e542e[_0x8e28('0x43')],_0x2e0385['filters']),_0x23c6b9);if(_0x1e542e[_0x8e28('0x43')]['filter']){_0x156c20[_0x8e28('0x4c')]=_[_0x8e28('0x4e')](_0x156c20['where'],{'$or':_[_0x8e28('0x3e')](_0x23c6b9,function(_0x2906c7){if(_0x2906c7['type']!==_0x8e28('0x4f')){var _0x41960d={};_0x41960d[_0x2906c7['name']]={'$like':'%'+_0x1e542e['query'][_0x8e28('0x50')]+'%'};return _0x41960d;}})});}_0x156c20=_[_0x8e28('0x4e')]({},_0x156c20,_0x1e542e['options']);var _0x3f80fa={'where':_0x156c20[_0x8e28('0x4c')]};return db[_0x8e28('0x3f')][_0x8e28('0x33')](_0x3f80fa)['then'](function(_0x302ca4){_0x44c650[_0x8e28('0x33')]=_0x302ca4;if(_0x1e542e[_0x8e28('0x43')]['includeAll']){_0x156c20[_0x8e28('0x51')]=[{'all':!![]}];}return db[_0x8e28('0x3f')]['findAll'](_0x156c20);})[_0x8e28('0x3b')](function(_0x50ed3b){_0x44c650[_0x8e28('0x52')]=_0x50ed3b;return _0x44c650;})[_0x8e28('0x3b')](respondWithFilteredResult(_0x361258,_0x156c20))[_0x8e28('0x2c')](handleError(_0x361258,null));};exports[_0x8e28('0x53')]=function(_0x450f5d,_0x1ff656){var _0x988321={'raw':!![],'where':{'id':_0x450f5d[_0x8e28('0x54')]['id']}},_0x5c1eeb={};_0x5c1eeb['model']=_[_0x8e28('0x44')](db['WhatsappMessage'][_0x8e28('0x55')]);_0x5c1eeb['query']=_[_0x8e28('0x44')](_0x450f5d['query']);_0x5c1eeb[_0x8e28('0x56')]=_['intersection'](_0x5c1eeb[_0x8e28('0x42')],_0x5c1eeb['query']);_0x988321[_0x8e28('0x47')]=_['intersection'](_0x5c1eeb[_0x8e28('0x42')],qs[_0x8e28('0x46')](_0x450f5d[_0x8e28('0x43')]['fields']));_0x988321['attributes']=_0x988321[_0x8e28('0x47')][_0x8e28('0x48')]?_0x988321[_0x8e28('0x47')]:_0x5c1eeb['model'];if(_0x450f5d[_0x8e28('0x43')][_0x8e28('0x57')]){_0x988321[_0x8e28('0x51')]=[{'all':!![]}];}_0x988321=_[_0x8e28('0x4e')]({},_0x988321,_0x450f5d[_0x8e28('0x58')]);return db['WhatsappMessage'][_0x8e28('0x59')](_0x988321)[_0x8e28('0x3b')](handleEntityNotFound(_0x1ff656,null))[_0x8e28('0x3b')](respondWithResult(_0x1ff656,null))[_0x8e28('0x2c')](handleError(_0x1ff656,null));};exports['create']=function(_0x480669,_0x2676a4){return db[_0x8e28('0x3f')][_0x8e28('0x5a')](_0x480669['body'],{})['then'](respondWithResult(_0x2676a4,0xc9))[_0x8e28('0x2c')](handleError(_0x2676a4,null));};exports[_0x8e28('0x3a')]=function(_0x157905,_0x47e3e3){if(_0x157905['body']['id']){delete _0x157905['body']['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x157905[_0x8e28('0x54')]['id']}})[_0x8e28('0x3b')](handleEntityNotFound(_0x47e3e3,null))[_0x8e28('0x3b')](saveUpdates(_0x157905[_0x8e28('0x5b')],null))[_0x8e28('0x3b')](respondWithResult(_0x47e3e3,null))[_0x8e28('0x2c')](handleError(_0x47e3e3,null));};exports['destroy']=function(_0x311e2d,_0x4613bb){return db[_0x8e28('0x3f')]['find']({'where':{'id':_0x311e2d[_0x8e28('0x54')]['id']}})[_0x8e28('0x3b')](handleEntityNotFound(_0x4613bb,null))[_0x8e28('0x3b')](removeEntity(_0x4613bb,null))[_0x8e28('0x2c')](handleError(_0x4613bb,null));};exports[_0x8e28('0x5c')]=function(_0x3657cf,_0x2da747){return db[_0x8e28('0x3f')][_0x8e28('0x5c')]()[_0x8e28('0x3b')](respondWithResult(_0x2da747,null))[_0x8e28('0x2c')](handleError(_0x2da747,null));};var interaction_log=require(_0x8e28('0x16'))(_0x8e28('0x5d'));exports[_0x8e28('0x5e')]=function(_0x5c1159,_0x342a92,_0x159824){var _0x334ab8={'agent':{},'channel':_0x8e28('0x5f')};if(_0x5c1159['body']['id']){delete _0x5c1159['body']['id'];}_0x5c1159['body'][_0x8e28('0x60')]=!![];_0x5c1159[_0x8e28('0x5b')]['readAt']=moment()[_0x8e28('0x61')](_0x8e28('0x62'));_0x5c1159[_0x8e28('0x5b')][_0x8e28('0x63')]=_0x5c1159['body']['UserId']||_0x5c1159[_0x8e28('0x64')]['id'];_0x334ab8['agent']['id']=_0x5c1159[_0x8e28('0x5b')][_0x8e28('0x63')];return db[_0x8e28('0x3f')]['find']({'where':{'id':_0x5c1159[_0x8e28('0x54')]['id'],'UserId':null}})[_0x8e28('0x3b')](handleEntityNotFound(_0x342a92,null))[_0x8e28('0x3b')](saveUpdates(_0x5c1159['body'],null))['then'](function(_0x2f12a0){if(_0x2f12a0){_0x334ab8[_0x8e28('0x2a')]=_0x2f12a0[_0x8e28('0x65')]({'plain':!![]});return db[_0x8e28('0x66')][_0x8e28('0x59')]({'where':{'id':_0x2f12a0['WhatsappInteractionId']}});}return null;})[_0x8e28('0x3b')](handleEntityNotFound(_0x342a92,null))[_0x8e28('0x3b')](function(_0x69bcec){if(_0x69bcec){return _0x69bcec[_0x8e28('0x3a')]({'UserId':_0x5c1159[_0x8e28('0x5b')][_0x8e28('0x63')],'read1stAt':_[_0x8e28('0x67')](_0x69bcec[_0x8e28('0x68')])?moment()[_0x8e28('0x61')](_0x8e28('0x62')):undefined});}return null;})[_0x8e28('0x3b')](function(_0x5864ee){if(_0x5864ee){_0x334ab8[_0x8e28('0x69')]=_0x5864ee['get']({'plain':!![]});interaction_log[_0x8e28('0x2b')](_0x8e28('0x6a'),_0x5c1159['user']['id'],_0x5c1159[_0x8e28('0x64')][_0x8e28('0x3c')],_0x5c1159[_0x8e28('0x64')][_0x8e28('0x6b')],_0x334ab8[_0x8e28('0x69')]['id'],_0x5c1159[_0x8e28('0x5b')]?JSON[_0x8e28('0x27')](_0x5c1159[_0x8e28('0x5b')]):'null');return respondWithRpcPromise(_0x8e28('0x6c'),'acceptMessage',_0x334ab8);}return null;})[_0x8e28('0x3b')](function(_0x4a15c5){var _0x3e0943=_0x8e28('0x6d')+_0x4a15c5['message']['ContactId'];return db[_0x8e28('0x6e')][_0x8e28('0x43')](_0x3e0943,{'type':db[_0x8e28('0x6f')]['QueryTypes'][_0x8e28('0x70')],'raw':!![]})[_0x8e28('0x3b')](function(_0x1444dd){return _0x1444dd;});})['then'](function(_0x17a4fa){if(_0x17a4fa){_0x334ab8[_0x8e28('0x2a')][_0x8e28('0x71')]=_0x17a4fa[0x0];if(!_0x5c1159[_0x8e28('0x5b')][_0x8e28('0x63')])return;return db['User'][_0x8e28('0x59')]({'where':{'id':_0x5c1159[_0x8e28('0x5b')]['UserId'],'role':_0x8e28('0x72')},'attributes':['id','name','fullname',_0x8e28('0x73'),_0x8e28('0x74')],'raw':!![]});}return null;})[_0x8e28('0x3b')](function(_0xca65d9){if(!_0xca65d9)return null;_0x334ab8[_0x8e28('0x2a')][_0x8e28('0x72')]=_0xca65d9;return _0x334ab8;})[_0x8e28('0x3b')](function(_0x38b799){if(_0x38b799){if(_0x5c1159[_0x8e28('0x5b')][_0x8e28('0x75')]){_0x334ab8['message']['interface']=util['format'](_0x8e28('0x76'),_0x5c1159[_0x8e28('0x64')][_0x8e28('0x3c')]);_0x334ab8[_0x8e28('0x2a')]['channel']=_0x334ab8[_0x8e28('0x77')];_0x334ab8[_0x8e28('0x2a')]['motionChannel']=_0x334ab8[_0x8e28('0x77')];_0x334ab8[_0x8e28('0x2a')][_0x8e28('0x78')]='accept';return respondWithRpcPromise(_0x8e28('0x79'),'EventManager',{'event':_0x8e28('0x7a'),'message':_0x334ab8['message']},client9002)[_0x8e28('0x3b')](function(){return _0x334ab8;});}return _0x334ab8;}return null;})[_0x8e28('0x3b')](respondWithResult(_0x342a92,null))['catch'](handleError(_0x342a92,null));};var interaction_log=require('../../config/logger')(_0x8e28('0x5d'));exports[_0x8e28('0x38')]=function(_0x114bd3,_0x395175,_0x482b92){var _0xcd0a13={'agent':{},'channel':_0x8e28('0x5f')};if(_0x114bd3[_0x8e28('0x5b')]['id']){delete _0x114bd3['body']['id'];}_0x114bd3[_0x8e28('0x5b')][_0x8e28('0x63')]=_0x114bd3[_0x8e28('0x5b')][_0x8e28('0x63')]||_0x114bd3[_0x8e28('0x64')]['id'];_0xcd0a13[_0x8e28('0x72')]['id']=_0x114bd3[_0x8e28('0x5b')][_0x8e28('0x63')];return db['WhatsappMessage'][_0x8e28('0x59')]({'where':{'id':_0x114bd3[_0x8e28('0x54')]['id'],'UserId':null}})[_0x8e28('0x3b')](handleEntityNotFound(_0x395175,null))['then'](function(_0x52d415){if(_0x52d415){_0xcd0a13['message']=_0x52d415[_0x8e28('0x65')]({'plain':!![]});return db[_0x8e28('0x66')][_0x8e28('0x59')]({'where':{'id':_0x52d415[_0x8e28('0x7b')]}});}return null;})[_0x8e28('0x3b')](handleEntityNotFound(_0x395175,null))[_0x8e28('0x3b')](function(_0x15f2c9){if(_0x15f2c9){_0xcd0a13[_0x8e28('0x69')]=_0x15f2c9[_0x8e28('0x65')]({'plain':!![]});interaction_log[_0x8e28('0x2b')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x114bd3['user']['id'],_0x114bd3[_0x8e28('0x64')]['name'],_0x114bd3['user'][_0x8e28('0x6b')],_0xcd0a13[_0x8e28('0x69')]['id'],_0x114bd3[_0x8e28('0x5b')]?JSON[_0x8e28('0x27')](_0x114bd3['body']):_0x8e28('0x7c'));return respondWithRpcPromise(_0x8e28('0x7d'),_0x8e28('0x7e'),_0xcd0a13);}return null;})[_0x8e28('0x3b')](function(_0x429bd3){var _0x21476c=_0x8e28('0x6d')+_0x429bd3['message'][_0x8e28('0x7f')];return db[_0x8e28('0x6e')][_0x8e28('0x43')](_0x21476c,{'type':db[_0x8e28('0x6f')][_0x8e28('0x80')][_0x8e28('0x70')],'raw':!![]})[_0x8e28('0x3b')](function(_0x3c11a0){return _0x3c11a0;});})['then'](function(_0x46dad0){if(_0x46dad0){_0xcd0a13['message'][_0x8e28('0x71')]=_0x46dad0[0x0];if(!_0x114bd3[_0x8e28('0x5b')][_0x8e28('0x63')])return;return db[_0x8e28('0x81')][_0x8e28('0x59')]({'where':{'id':_0x114bd3[_0x8e28('0x5b')]['UserId'],'role':_0x8e28('0x72')},'attributes':['id','name','fullname','email',_0x8e28('0x74')],'raw':!![]});}return null;})[_0x8e28('0x3b')](function(_0x130efc){if(!_0x130efc)return null;_0xcd0a13['message'][_0x8e28('0x72')]=_0x130efc;return _0xcd0a13;})['then'](function(_0xae88f8){if(_0xae88f8){_0xae88f8[_0x8e28('0x2a')][_0x8e28('0x82')]=util[_0x8e28('0x61')](_0x8e28('0x76'),_0x114bd3[_0x8e28('0x64')][_0x8e28('0x3c')]);_0xae88f8['message'][_0x8e28('0x77')]=_0xcd0a13['channel'];_0xae88f8[_0x8e28('0x2a')][_0x8e28('0x83')]=_0xcd0a13[_0x8e28('0x77')];_0xae88f8[_0x8e28('0x2a')][_0x8e28('0x78')]='reject';respondWithRpcPromise(_0x8e28('0x79'),_0x8e28('0x79'),{'event':_0x8e28('0x84'),'message':_0xae88f8['message']},client9002);return _0xcd0a13;}return null;})[_0x8e28('0x3b')](respondWithResult(_0x395175,null))[_0x8e28('0x2c')](handleError(_0x395175,null));};exports[_0x8e28('0x34')]=function(_0x4f6510,_0x277a3e,_0x409425){if(_0x4f6510['body']['id']){delete _0x4f6510[_0x8e28('0x5b')]['id'];}var _0x1364cb;return db[_0x8e28('0x3f')][_0x8e28('0x59')]({'where':{'id':_0x4f6510[_0x8e28('0x54')]['id']}})[_0x8e28('0x3b')](handleEntityNotFound(_0x277a3e,null))[_0x8e28('0x3b')](function(_0x4b7746){if(_0x4b7746){_0x1364cb=_0x4b7746;return db['WhatsappAccount'][_0x8e28('0x59')]({'where':{'id':_0x4b7746[_0x8e28('0x85')]}});}})[_0x8e28('0x3b')](handleEntityNotFound(_0x277a3e,null))[_0x8e28('0x3b')](function(_0x3769ec){if(_0x3769ec){logger[_0x8e28('0x25')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x8e28('0x34'),'received\x20delivery\x20report\x20from',_0x3769ec[_0x8e28('0x41')],util[_0x8e28('0x86')](_0x4f6510[_0x8e28('0x5b')],{'showHidden':![],'depth':null}));switch(_0x3769ec[_0x8e28('0x41')]){case _0x8e28('0x87'):if(_0x4f6510[_0x8e28('0x5b')]['MessageSid']&&_0x4f6510['body']['MessageSid']===_0x1364cb[_0x8e28('0x88')]&&_0x4f6510['body'][_0x8e28('0x89')]&&_0x4f6510[_0x8e28('0x5b')]['MessageStatus']===_0x8e28('0x60')){return _0x1364cb[_0x8e28('0x3a')]({'read':!![]});}else{logger[_0x8e28('0x29')](_0x8e28('0x8a'),'status',_0x8e28('0x87'),util[_0x8e28('0x86')](_0x4f6510['body'],{'showHidden':![],'depth':null}));}break;}return _0x1364cb;}})[_0x8e28('0x3b')](respondWithResult(_0x277a3e,null))[_0x8e28('0x2c')](handleError(_0x277a3e,null));}; \ No newline at end of file +var _0x609d=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','WhatsappMessage','findAll','rows','show','params','intersection','includeAll','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','get','WhatsappInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','agent','email','manual','interface','SIP/%s','channel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','Sequelize','User','fullname','internal','motionChannel','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4328fc,_0x5c2006){var _0x5d2251=function(_0x1a0e64){while(--_0x1a0e64){_0x4328fc['push'](_0x4328fc['shift']());}};_0x5d2251(++_0x5c2006);}(_0x609d,0x197));var _0xd609=function(_0x834bb6,_0x1c5e35){_0x834bb6=_0x834bb6-0x0;var _0xa35d00=_0x609d[_0x834bb6];return _0xa35d00;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd609('0x0'));var zipdir=require(_0xd609('0x1'));var jsonpatch=require(_0xd609('0x2'));var rp=require(_0xd609('0x3'));var moment=require(_0xd609('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd609('0x5'));var util=require(_0xd609('0x6'));var path=require(_0xd609('0x7'));var sox=require(_0xd609('0x8'));var csv=require(_0xd609('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd609('0xa'));var _=require(_0xd609('0xb'));var squel=require(_0xd609('0xc'));var crypto=require('crypto');var jsforce=require(_0xd609('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd609('0xe'));var Papa=require(_0xd609('0xf'));var Redis=require(_0xd609('0x10'));var authService=require(_0xd609('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd609('0x12'));var hardwareService=require(_0xd609('0x13'));var logger=require(_0xd609('0x14'))(_0xd609('0x15'));var utils=require('../../config/utils');var config=require(_0xd609('0x16'));var licenseUtil=require(_0xd609('0x17'));var db=require(_0xd609('0x18'))['db'];config[_0xd609('0x19')]=_[_0xd609('0x1a')](config['redis'],{'host':_0xd609('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd609('0x19')]));require('./whatsappMessage.socket')[_0xd609('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd609('0x1d')][_0xd609('0x1e')]({'port':0x232c});var client9002=jayson[_0xd609('0x1d')][_0xd609('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1ee1c1,_0x1d8766,_0x2488e0,_0x4d887e){return new BPromise(function(_0x5ce546,_0x51a37b){var _0x3fb52f=_0x4d887e||client;return _0x3fb52f[_0xd609('0x1f')](_0x1ee1c1,_0x2488e0)[_0xd609('0x20')](function(_0x100ea4){logger[_0xd609('0x21')](_0xd609('0x22'),_0x1d8766,_0xd609('0x23'));logger[_0xd609('0x24')](_0xd609('0x25'),_0x1d8766,'request\x20sent',JSON[_0xd609('0x26')](_0x100ea4));if(_0x100ea4[_0xd609('0x27')]){if(_0x100ea4[_0xd609('0x27')][_0xd609('0x28')]===0x1f4){logger[_0xd609('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x1d8766,_0x100ea4[_0xd609('0x27')][_0xd609('0x29')]);return _0x51a37b(_0x100ea4[_0xd609('0x27')]['message']);}logger[_0xd609('0x27')](_0xd609('0x22'),_0x1d8766,_0x100ea4[_0xd609('0x27')][_0xd609('0x29')]);return _0x5ce546(_0x100ea4[_0xd609('0x27')]['message']);}else{logger[_0xd609('0x21')](_0xd609('0x22'),_0x1d8766,_0xd609('0x23'));_0x5ce546(_0x100ea4['result'][_0xd609('0x29')]);}})[_0xd609('0x2a')](function(_0x4cc410){logger[_0xd609('0x27')](_0xd609('0x22'),_0x1d8766,_0x4cc410);_0x51a37b(_0x4cc410);});});}function respondWithStatusCode(_0x4ef6f6,_0x312220){_0x312220=_0x312220||0xcc;return function(_0x144214){if(_0x144214){return _0x4ef6f6[_0xd609('0x2b')](_0x312220);}return _0x4ef6f6['status'](_0x312220)['end']();};}function respondWithResult(_0x48c19c,_0x128284){_0x128284=_0x128284||0xc8;return function(_0x36a123){if(_0x36a123){return _0x48c19c['status'](_0x128284)[_0xd609('0x2c')](_0x36a123);}};}function respondWithFilteredResult(_0x12866a,_0x4b10ec){return function(_0xfb3f26){if(_0xfb3f26){var _0x165a4e=typeof _0x4b10ec[_0xd609('0x2d')]===_0xd609('0x2e')&&typeof _0x4b10ec[_0xd609('0x2f')]===_0xd609('0x2e');var _0x2349b2=_0xfb3f26['count'];var _0x52e2d2=_0x165a4e?0x0:_0x4b10ec[_0xd609('0x2d')];var _0x55163b=_0x165a4e?_0xfb3f26[_0xd609('0x30')]:_0x4b10ec[_0xd609('0x2d')]+_0x4b10ec[_0xd609('0x2f')];var _0x1d8cd4;if(_0x55163b>=_0x2349b2){_0x55163b=_0x2349b2;_0x1d8cd4=0xc8;}else{_0x1d8cd4=0xce;}_0x12866a[_0xd609('0x31')](_0x1d8cd4);return _0x12866a[_0xd609('0x32')](_0xd609('0x33'),_0x52e2d2+'-'+_0x55163b+'/'+_0x2349b2)[_0xd609('0x2c')](_0xfb3f26);}return null;};}function patchUpdates(_0x2ac60d){return function(_0x11e8a0){try{jsonpatch[_0xd609('0x34')](_0x11e8a0,_0x2ac60d,!![]);}catch(_0x791335){return BPromise[_0xd609('0x35')](_0x791335);}return _0x11e8a0['save']();};}function saveUpdates(_0x3249ee,_0x2a58c8){return function(_0x32120d){if(_0x32120d){return _0x32120d[_0xd609('0x36')](_0x3249ee)['then'](function(_0x30b415){return _0x30b415;});}return null;};}function removeEntity(_0x29a306,_0x32b522){return function(_0x27f378){if(_0x27f378){return _0x27f378[_0xd609('0x37')]()[_0xd609('0x20')](function(){_0x29a306[_0xd609('0x31')](0xcc)[_0xd609('0x38')]();});}};}function handleEntityNotFound(_0x1f53de,_0x101b1e){return function(_0x669e1e){if(!_0x669e1e){_0x1f53de[_0xd609('0x2b')](0x194);}return _0x669e1e;};}function handleError(_0x48e80e,_0x145791){_0x145791=_0x145791||0x1f4;return function(_0x126b27){logger['error'](_0x126b27[_0xd609('0x39')]);if(_0x126b27[_0xd609('0x3a')]){delete _0x126b27[_0xd609('0x3a')];}_0x48e80e[_0xd609('0x31')](_0x145791)[_0xd609('0x3b')](_0x126b27);};}exports[_0xd609('0x3c')]=function(_0x406154,_0x5a480d){var _0x5893c9={},_0x591520={},_0x140992={'count':0x0,'rows':[]};var _0x3fbb71=_[_0xd609('0x3d')](db['WhatsappMessage'][_0xd609('0x3e')],function(_0x4440d3){return{'name':_0x4440d3[_0xd609('0x3f')],'type':_0x4440d3[_0xd609('0x40')]['key']};});_0x591520[_0xd609('0x41')]=_[_0xd609('0x3d')](_0x3fbb71,_0xd609('0x3a'));_0x591520[_0xd609('0x42')]=_[_0xd609('0x43')](_0x406154[_0xd609('0x42')]);_0x591520['filters']=_['intersection'](_0x591520[_0xd609('0x41')],_0x591520[_0xd609('0x42')]);_0x5893c9[_0xd609('0x44')]=_['intersection'](_0x591520[_0xd609('0x41')],qs[_0xd609('0x45')](_0x406154['query'][_0xd609('0x45')]));_0x5893c9[_0xd609('0x44')]=_0x5893c9['attributes'][_0xd609('0x46')]?_0x5893c9[_0xd609('0x44')]:_0x591520[_0xd609('0x41')];if(!_0x406154['query'][_0xd609('0x47')](_0xd609('0x48'))){_0x5893c9[_0xd609('0x2f')]=qs[_0xd609('0x2f')](_0x406154[_0xd609('0x42')]['limit']);_0x5893c9[_0xd609('0x2d')]=qs[_0xd609('0x2d')](_0x406154['query'][_0xd609('0x2d')]);}_0x5893c9[_0xd609('0x49')]=qs[_0xd609('0x4a')](_0x406154['query'][_0xd609('0x4a')]);_0x5893c9[_0xd609('0x4b')]=qs[_0xd609('0x4c')](_['pick'](_0x406154[_0xd609('0x42')],_0x591520['filters']),_0x3fbb71);if(_0x406154[_0xd609('0x42')][_0xd609('0x4d')]){_0x5893c9['where']=_[_0xd609('0x4e')](_0x5893c9[_0xd609('0x4b')],{'$or':_['map'](_0x3fbb71,function(_0x59b5ea){if(_0x59b5ea[_0xd609('0x40')]!==_0xd609('0x4f')){var _0x54f184={};_0x54f184[_0x59b5ea['name']]={'$like':'%'+_0x406154[_0xd609('0x42')][_0xd609('0x4d')]+'%'};return _0x54f184;}})});}_0x5893c9=_[_0xd609('0x4e')]({},_0x5893c9,_0x406154[_0xd609('0x50')]);var _0x7891bc={'where':_0x5893c9[_0xd609('0x4b')]};return db['WhatsappMessage']['count'](_0x7891bc)[_0xd609('0x20')](function(_0x350bf1){_0x140992[_0xd609('0x30')]=_0x350bf1;if(_0x406154[_0xd609('0x42')]['includeAll']){_0x5893c9[_0xd609('0x51')]=[{'all':!![]}];}return db[_0xd609('0x52')][_0xd609('0x53')](_0x5893c9);})['then'](function(_0x1a52f0){_0x140992[_0xd609('0x54')]=_0x1a52f0;return _0x140992;})[_0xd609('0x20')](respondWithFilteredResult(_0x5a480d,_0x5893c9))['catch'](handleError(_0x5a480d,null));};exports[_0xd609('0x55')]=function(_0xedf329,_0x4468a0){var _0x70fc7={'raw':!![],'where':{'id':_0xedf329[_0xd609('0x56')]['id']}},_0x39d9d7={};_0x39d9d7[_0xd609('0x41')]=_[_0xd609('0x43')](db['WhatsappMessage'][_0xd609('0x3e')]);_0x39d9d7[_0xd609('0x42')]=_[_0xd609('0x43')](_0xedf329[_0xd609('0x42')]);_0x39d9d7[_0xd609('0x4c')]=_['intersection'](_0x39d9d7[_0xd609('0x41')],_0x39d9d7[_0xd609('0x42')]);_0x70fc7[_0xd609('0x44')]=_[_0xd609('0x57')](_0x39d9d7[_0xd609('0x41')],qs[_0xd609('0x45')](_0xedf329[_0xd609('0x42')][_0xd609('0x45')]));_0x70fc7[_0xd609('0x44')]=_0x70fc7[_0xd609('0x44')][_0xd609('0x46')]?_0x70fc7['attributes']:_0x39d9d7[_0xd609('0x41')];if(_0xedf329['query'][_0xd609('0x58')]){_0x70fc7[_0xd609('0x51')]=[{'all':!![]}];}_0x70fc7=_['merge']({},_0x70fc7,_0xedf329['options']);return db[_0xd609('0x52')]['find'](_0x70fc7)[_0xd609('0x20')](handleEntityNotFound(_0x4468a0,null))[_0xd609('0x20')](respondWithResult(_0x4468a0,null))['catch'](handleError(_0x4468a0,null));};exports[_0xd609('0x59')]=function(_0x23f7ef,_0xad3407){return db[_0xd609('0x52')][_0xd609('0x59')](_0x23f7ef[_0xd609('0x5a')],{})[_0xd609('0x20')](respondWithResult(_0xad3407,0xc9))['catch'](handleError(_0xad3407,null));};exports[_0xd609('0x36')]=function(_0x55cdda,_0x527432){if(_0x55cdda[_0xd609('0x5a')]['id']){delete _0x55cdda[_0xd609('0x5a')]['id'];}return db['WhatsappMessage'][_0xd609('0x5b')]({'where':{'id':_0x55cdda[_0xd609('0x56')]['id']}})[_0xd609('0x20')](handleEntityNotFound(_0x527432,null))['then'](saveUpdates(_0x55cdda['body'],null))[_0xd609('0x20')](respondWithResult(_0x527432,null))[_0xd609('0x2a')](handleError(_0x527432,null));};exports['destroy']=function(_0x26d9c2,_0x49d83a){return db[_0xd609('0x52')][_0xd609('0x5b')]({'where':{'id':_0x26d9c2[_0xd609('0x56')]['id']}})[_0xd609('0x20')](handleEntityNotFound(_0x49d83a,null))[_0xd609('0x20')](removeEntity(_0x49d83a,null))[_0xd609('0x2a')](handleError(_0x49d83a,null));};exports[_0xd609('0x5c')]=function(_0x2f33f6,_0x479ce8){return db[_0xd609('0x52')][_0xd609('0x5c')]()[_0xd609('0x20')](respondWithResult(_0x479ce8,null))[_0xd609('0x2a')](handleError(_0x479ce8,null));};var interaction_log=require('../../config/logger')(_0xd609('0x5d'));exports[_0xd609('0x5e')]=function(_0x2a1924,_0x274598,_0x28f377){var _0xaa0807={'agent':{},'channel':_0xd609('0x5f')};if(_0x2a1924[_0xd609('0x5a')]['id']){delete _0x2a1924[_0xd609('0x5a')]['id'];}_0x2a1924[_0xd609('0x5a')][_0xd609('0x60')]=!![];_0x2a1924[_0xd609('0x5a')][_0xd609('0x61')]=moment()[_0xd609('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a1924[_0xd609('0x5a')][_0xd609('0x63')]=_0x2a1924[_0xd609('0x5a')]['UserId']||_0x2a1924[_0xd609('0x64')]['id'];_0xaa0807['agent']['id']=_0x2a1924[_0xd609('0x5a')][_0xd609('0x63')];return db[_0xd609('0x52')][_0xd609('0x5b')]({'where':{'id':_0x2a1924[_0xd609('0x56')]['id'],'UserId':null}})[_0xd609('0x20')](handleEntityNotFound(_0x274598,null))[_0xd609('0x20')](saveUpdates(_0x2a1924[_0xd609('0x5a')],null))[_0xd609('0x20')](function(_0x2932bd){if(_0x2932bd){_0xaa0807['message']=_0x2932bd[_0xd609('0x65')]({'plain':!![]});return db[_0xd609('0x66')][_0xd609('0x5b')]({'where':{'id':_0x2932bd['WhatsappInteractionId']}});}return null;})[_0xd609('0x20')](handleEntityNotFound(_0x274598,null))[_0xd609('0x20')](function(_0x32c924){if(_0x32c924){return _0x32c924[_0xd609('0x36')]({'UserId':_0x2a1924[_0xd609('0x5a')]['UserId'],'read1stAt':_[_0xd609('0x67')](_0x32c924[_0xd609('0x68')])?moment()[_0xd609('0x62')](_0xd609('0x69')):undefined});}return null;})[_0xd609('0x20')](function(_0x1e24ef){if(_0x1e24ef){_0xaa0807[_0xd609('0x6a')]=_0x1e24ef[_0xd609('0x65')]({'plain':!![]});interaction_log[_0xd609('0x21')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a1924['user']['id'],_0x2a1924[_0xd609('0x64')][_0xd609('0x3a')],_0x2a1924[_0xd609('0x64')][_0xd609('0x6b')],_0xaa0807['interaction']['id'],_0x2a1924[_0xd609('0x5a')]?JSON[_0xd609('0x26')](_0x2a1924['body']):_0xd609('0x6c'));return respondWithRpcPromise(_0xd609('0x6d'),_0xd609('0x6e'),_0xaa0807);}return null;})[_0xd609('0x20')](function(_0x1dccf5){var _0x58fe4d=_0xd609('0x6f')+_0x1dccf5[_0xd609('0x29')][_0xd609('0x70')];return db['sequelize'][_0xd609('0x42')](_0x58fe4d,{'type':db['Sequelize'][_0xd609('0x71')][_0xd609('0x72')],'raw':!![]})[_0xd609('0x20')](function(_0x5219f1){return _0x5219f1;});})[_0xd609('0x20')](function(_0x4b0123){if(_0x4b0123){_0xaa0807[_0xd609('0x29')][_0xd609('0x73')]=_0x4b0123[0x0];if(!_0x2a1924[_0xd609('0x5a')]['UserId'])return;return db['User'][_0xd609('0x5b')]({'where':{'id':_0x2a1924[_0xd609('0x5a')][_0xd609('0x63')],'role':_0xd609('0x74')},'attributes':['id',_0xd609('0x3a'),'fullname',_0xd609('0x75'),'internal'],'raw':!![]});}return null;})['then'](function(_0x96bbf9){if(!_0x96bbf9)return null;_0xaa0807[_0xd609('0x29')][_0xd609('0x74')]=_0x96bbf9;return _0xaa0807;})[_0xd609('0x20')](function(_0x59aba3){if(_0x59aba3){if(_0x2a1924[_0xd609('0x5a')][_0xd609('0x76')]){_0xaa0807['message'][_0xd609('0x77')]=util['format'](_0xd609('0x78'),_0x2a1924[_0xd609('0x64')][_0xd609('0x3a')]);_0xaa0807['message'][_0xd609('0x79')]=_0xaa0807[_0xd609('0x79')];_0xaa0807[_0xd609('0x29')]['motionChannel']=_0xaa0807['channel'];_0xaa0807[_0xd609('0x29')]['event']=_0xd609('0x5e');return respondWithRpcPromise(_0xd609('0x7a'),'EventManager',{'event':_0xd609('0x7b'),'message':_0xaa0807['message']},client9002)[_0xd609('0x20')](function(){return _0xaa0807;});}return _0xaa0807;}return null;})[_0xd609('0x20')](respondWithResult(_0x274598,null))[_0xd609('0x2a')](handleError(_0x274598,null));};var interaction_log=require('../../config/logger')(_0xd609('0x5d'));exports['reject']=function(_0x1167d1,_0x24b01d,_0x5c6385){var _0x5b75d1={'agent':{},'channel':_0xd609('0x5f')};if(_0x1167d1[_0xd609('0x5a')]['id']){delete _0x1167d1[_0xd609('0x5a')]['id'];}_0x1167d1[_0xd609('0x5a')]['UserId']=_0x1167d1[_0xd609('0x5a')][_0xd609('0x63')]||_0x1167d1[_0xd609('0x64')]['id'];_0x5b75d1[_0xd609('0x74')]['id']=_0x1167d1['body'][_0xd609('0x63')];return db[_0xd609('0x52')]['find']({'where':{'id':_0x1167d1[_0xd609('0x56')]['id'],'UserId':null}})[_0xd609('0x20')](handleEntityNotFound(_0x24b01d,null))[_0xd609('0x20')](function(_0x3a50e5){if(_0x3a50e5){_0x5b75d1[_0xd609('0x29')]=_0x3a50e5[_0xd609('0x65')]({'plain':!![]});return db['WhatsappInteraction'][_0xd609('0x5b')]({'where':{'id':_0x3a50e5['WhatsappInteractionId']}});}return null;})[_0xd609('0x20')](handleEntityNotFound(_0x24b01d,null))['then'](function(_0x45b8f1){if(_0x45b8f1){_0x5b75d1['interaction']=_0x45b8f1[_0xd609('0x65')]({'plain':!![]});interaction_log[_0xd609('0x21')](_0xd609('0x7c'),_0x1167d1[_0xd609('0x64')]['id'],_0x1167d1['user'][_0xd609('0x3a')],_0x1167d1[_0xd609('0x64')]['role'],_0x5b75d1['interaction']['id'],_0x1167d1[_0xd609('0x5a')]?JSON[_0xd609('0x26')](_0x1167d1['body']):_0xd609('0x6c'));return respondWithRpcPromise('RejectMessage',_0xd609('0x7d'),_0x5b75d1);}return null;})[_0xd609('0x20')](function(_0xc81053){var _0x3a11b8=_0xd609('0x6f')+_0xc81053[_0xd609('0x29')]['ContactId'];return db['sequelize'][_0xd609('0x42')](_0x3a11b8,{'type':db[_0xd609('0x7e')][_0xd609('0x71')][_0xd609('0x72')],'raw':!![]})['then'](function(_0x565ec3){return _0x565ec3;});})[_0xd609('0x20')](function(_0x10d8d2){if(_0x10d8d2){_0x5b75d1[_0xd609('0x29')][_0xd609('0x73')]=_0x10d8d2[0x0];if(!_0x1167d1[_0xd609('0x5a')]['UserId'])return;return db[_0xd609('0x7f')]['find']({'where':{'id':_0x1167d1[_0xd609('0x5a')]['UserId'],'role':'agent'},'attributes':['id',_0xd609('0x3a'),_0xd609('0x80'),_0xd609('0x75'),_0xd609('0x81')],'raw':!![]});}return null;})[_0xd609('0x20')](function(_0x12933a){if(!_0x12933a)return null;_0x5b75d1[_0xd609('0x29')][_0xd609('0x74')]=_0x12933a;return _0x5b75d1;})['then'](function(_0x23792a){if(_0x23792a){_0x23792a[_0xd609('0x29')][_0xd609('0x77')]=util[_0xd609('0x62')](_0xd609('0x78'),_0x1167d1['user'][_0xd609('0x3a')]);_0x23792a[_0xd609('0x29')][_0xd609('0x79')]=_0x5b75d1[_0xd609('0x79')];_0x23792a[_0xd609('0x29')][_0xd609('0x82')]=_0x5b75d1['channel'];_0x23792a[_0xd609('0x29')][_0xd609('0x83')]='reject';respondWithRpcPromise(_0xd609('0x7a'),_0xd609('0x7a'),{'event':_0xd609('0x84'),'message':_0x23792a[_0xd609('0x29')]},client9002);return _0x5b75d1;}return null;})[_0xd609('0x20')](respondWithResult(_0x24b01d,null))[_0xd609('0x2a')](handleError(_0x24b01d,null));};exports[_0xd609('0x31')]=function(_0x65f0c8,_0x5e6dc9,_0x2057d9){if(_0x65f0c8[_0xd609('0x5a')]['id']){delete _0x65f0c8[_0xd609('0x5a')]['id'];}var _0x2d8c6d;return db[_0xd609('0x52')]['find']({'where':{'id':_0x65f0c8[_0xd609('0x56')]['id']}})[_0xd609('0x20')](handleEntityNotFound(_0x5e6dc9,null))[_0xd609('0x20')](function(_0x2f0c22){if(_0x2f0c22){_0x2d8c6d=_0x2f0c22;return db[_0xd609('0x85')][_0xd609('0x5b')]({'where':{'id':_0x2f0c22[_0xd609('0x86')]}});}})[_0xd609('0x20')](handleEntityNotFound(_0x5e6dc9,null))[_0xd609('0x20')](function(_0x208d01){if(_0x208d01){logger[_0xd609('0x24')](_0xd609('0x87'),_0xd609('0x31'),_0xd609('0x88'),_0x208d01[_0xd609('0x40')],util[_0xd609('0x89')](_0x65f0c8[_0xd609('0x5a')],{'showHidden':![],'depth':null}));switch(_0x208d01[_0xd609('0x40')]){case _0xd609('0x8a'):if(_0x65f0c8[_0xd609('0x5a')][_0xd609('0x8b')]&&_0x65f0c8[_0xd609('0x5a')][_0xd609('0x8b')]===_0x2d8c6d[_0xd609('0x8c')]&&_0x65f0c8['body']['MessageStatus']&&_0x65f0c8[_0xd609('0x5a')][_0xd609('0x8d')]==='read'){return _0x2d8c6d[_0xd609('0x36')]({'read':!![]});}else{logger[_0xd609('0x27')](_0xd609('0x8e'),_0xd609('0x31'),_0xd609('0x8a'),util[_0xd609('0x89')](_0x65f0c8[_0xd609('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x2d8c6d;}})[_0xd609('0x20')](respondWithResult(_0x5e6dc9,null))[_0xd609('0x2a')](handleError(_0x5e6dc9,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index d5c7d32..08571de 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 _0x065e=['emit','hasOwnProperty','hook','events','save','update','remove'];(function(_0x119af7,_0xfa4caa){var _0x469b0d=function(_0x4f6672){while(--_0x4f6672){_0x119af7['push'](_0x119af7['shift']());}};_0x469b0d(++_0xfa4caa);}(_0x065e,0x1a7));var _0xe065=function(_0x51da74,_0xed04){_0x51da74=_0x51da74-0x0;var _0x58cbd7=_0x065e[_0x51da74];return _0x58cbd7;};'use strict';var EventEmitter=require(_0xe065('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe065('0x1'),'afterUpdate':_0xe065('0x2'),'afterDestroy':_0xe065('0x3')};function emitEvent(_0x4d35bf){return function(_0x4964fa,_0x4610a3,_0x2f90aa){WhatsappMessageEvents['emit'](_0x4d35bf+':'+_0x4964fa['id'],_0x4964fa);WhatsappMessageEvents[_0xe065('0x4')](_0x4d35bf,_0x4964fa);_0x2f90aa(null);};}for(var e in events){if(events[_0xe065('0x5')](e)){var event=events[e];WhatsappMessage[_0xe065('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x5423=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5423,0xe3));var _0x3542=function(_0x22ff4f,_0x440ca8){_0x22ff4f=_0x22ff4f-0x0;var _0x29e2fc=_0x5423[_0x22ff4f];return _0x29e2fc;};'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 f9a86d8..60ed260 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 _0x665a=['token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','util','api','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','direction','toLowerCase','out','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','catch','error','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token='];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x665a,0xbc));var _0xa665=function(_0x3c68ac,_0x38b406){_0x3c68ac=_0x3c68ac-0x0;var _0x35d849=_0x665a[_0x3c68ac];return _0x35d849;};'use strict';var _=require('lodash');var util=require(_0xa665('0x0'));var logger=require('../../config/logger')(_0xa665('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa665('0x2'));var fetch=require(_0xa665('0x3'));var fs=require('fs');var path=require(_0xa665('0x4'));var rimraf=require(_0xa665('0x5'));var config=require(_0xa665('0x6'));var attributes=require(_0xa665('0x7'));module['exports']=function(_0x2771ea,_0x4726b6){return _0x2771ea[_0xa665('0x8')](_0xa665('0x9'),attributes,{'tableName':_0xa665('0xa'),'paranoid':![],'indexes':[{'name':_0xa665('0xb'),'fields':['messageId']},{'name':_0xa665('0xc'),'fields':[_0xa665('0xd')],'type':_0xa665('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b10af,_0x1699c1,_0x46e9c9){var _0x280984=_0x2771ea['models'];var _0x1600f1=_0x5b10af['get']({'plain':!![]});if(_0x1600f1[_0xa665('0xf')][_0xa665('0x10')]()==='in'||_0x1600f1['direction']['toLowerCase']()===_0xa665('0x11')&&!_0x1600f1['secret']&&!_['isNil'](_0x1600f1['UserId'])){_0x280984[_0xa665('0x12')][_0xa665('0x13')]({'where':{'id':_0x1600f1[_0xa665('0x14')]}})[_0xa665('0x15')](function(_0x570df0){if(_0x570df0){_0x570df0[_0xa665('0x16')]({'lastMsgAt':_0x1600f1['createdAt'],'lastMsgDirection':_0x1600f1['direction']['toLowerCase']()});}})[_0xa665('0x17')](function(_0x30a8b2){console[_0xa665('0x18')](_0x30a8b2);});}if(_0x1600f1[_0xa665('0xf')]===_0xa665('0x11')&&!_0x1600f1[_0xa665('0x19')]){var _0xbbc650;_0x280984[_0xa665('0x1a')][_0xa665('0x1b')]({'where':{'id':_0x1600f1[_0xa665('0x1c')]},'raw':!![]})[_0xa665('0x15')](function(_0x27c09a){_0xbbc650=_0x27c09a;if(_0xbbc650&&_0xbbc650['type']){switch(_0xbbc650[_0xa665('0x1d')]){case _0xa665('0x1e'):var _0xe4d26e=require('twilio');if(_0xbbc650['accountSid']&&_0xbbc650[_0xa665('0x1f')]&&_0xbbc650[_0xa665('0x20')]){var _0x1cf921=new _0xe4d26e(_0xbbc650[_0xa665('0x21')],_0xbbc650[_0xa665('0x1f')]);_0x1cf921[_0xa665('0x22')][_0xa665('0x23')]({'body':_0x1600f1[_0xa665('0xd')],'to':'whatsapp:'+_0x1600f1['phone'],'from':_0xa665('0x24')+_0xbbc650['phone'],'statusCallback':_0xbbc650[_0xa665('0x25')]+_0xa665('0x26')+_0x1600f1['id']+_0xa665('0x27')+_0xbbc650[_0xa665('0x28')]})['then'](function(_0x114a0e){if(_0x114a0e['sid']){return _0x5b10af['update']({'messageId':_0x114a0e[_0xa665('0x29')]});}})[_0xa665('0x17')](function(_0x1c6a6f){logger['error'](_0xa665('0x2a'),_0xa665('0x2b'),_0xa665('0x1e'),util[_0xa665('0x2c')](_0x1c6a6f,{'showHidden':![],'depth':null}));});}else{logger[_0xa665('0x18')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xa665('0x2b'),_0xa665('0x1e'),_0xa665('0x2d'));}break;case'sinch':var _0x4c0e76=_0xbbc650['accountSid'];var _0x13333f=_0xbbc650[_0xa665('0x1f')];var _0x3701f2=_0xbbc650[_0xa665('0x2e')]+_0xa665('0x2f')+_0x4c0e76+'/messages/';var _0x2de919={'to':[_0x1600f1[_0xa665('0x20')]],'message':{'type':'text','text':_0x1600f1[_0xa665('0xd')]}};var _0x3f815b={'method':_0xa665('0x30'),'uri':_0x3701f2,'headers':{'Authorization':_0xa665('0x31')+_0x13333f,'Content-Type':_0xa665('0x32')},'body':_0x2de919,'json':!![]};rp(_0x3f815b)[_0xa665('0x15')](function(_0x3d08a3){if(_0x3d08a3[_0xa665('0x33')][0x0][_0xa665('0x34')]){return _0x5b10af[_0xa665('0x16')]({'messageId':_0x3d08a3[_0xa665('0x33')][0x0][_0xa665('0x34')]});}})[_0xa665('0x17')](function(_0x43a20a){logger[_0xa665('0x35')](_0xa665('0x36'),_0x43a20a);});break;}}})[_0xa665('0x37')](function(){_0x46e9c9();});}else{_0x46e9c9();}}},'charset':_0xa665('0x38'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2d0c=['whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','exports','WhatsappMessage'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0x2d0c,0x70));var _0xc2d0=function(_0x19b1c2,_0x205062){_0x19b1c2=_0x19b1c2-0x0;var _0x4e1ae5=_0x2d0c[_0x19b1c2];return _0x4e1ae5;};'use strict';var _=require(_0xc2d0('0x0'));var util=require(_0xc2d0('0x1'));var logger=require(_0xc2d0('0x2'))('api');var moment=require(_0xc2d0('0x3'));var BPromise=require(_0xc2d0('0x4'));var rp=require(_0xc2d0('0x5'));var fetch=require(_0xc2d0('0x6'));var fs=require('fs');var path=require(_0xc2d0('0x7'));var rimraf=require(_0xc2d0('0x8'));var config=require(_0xc2d0('0x9'));var attributes=require('./whatsappMessage.attributes');module[_0xc2d0('0xa')]=function(_0x5d0c9e,_0x3e7ee0){return _0x5d0c9e['define'](_0xc2d0('0xb'),attributes,{'tableName':_0xc2d0('0xc'),'paranoid':![],'indexes':[{'name':_0xc2d0('0xd'),'fields':[_0xc2d0('0xd')]},{'name':_0xc2d0('0xe'),'fields':[_0xc2d0('0xf')],'type':_0xc2d0('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x883480,_0x2f96bd,_0x3b50fb){var _0x400bdd=_0x5d0c9e['models'];var _0x4c962a=_0x883480[_0xc2d0('0x11')]({'plain':!![]});if(_0x4c962a[_0xc2d0('0x12')][_0xc2d0('0x13')]()==='in'||_0x4c962a[_0xc2d0('0x12')]['toLowerCase']()===_0xc2d0('0x14')&&!_0x4c962a[_0xc2d0('0x15')]&&!_['isNil'](_0x4c962a[_0xc2d0('0x16')])){_0x400bdd[_0xc2d0('0x17')][_0xc2d0('0x18')]({'where':{'id':_0x4c962a[_0xc2d0('0x19')]}})[_0xc2d0('0x1a')](function(_0x1e5985){if(_0x1e5985){_0x1e5985['update']({'lastMsgAt':_0x4c962a[_0xc2d0('0x1b')],'lastMsgDirection':_0x4c962a[_0xc2d0('0x12')]['toLowerCase']()});}})[_0xc2d0('0x1c')](function(_0x2258fc){console[_0xc2d0('0x1d')](_0x2258fc);});}if(_0x4c962a['direction']==='out'&&!_0x4c962a[_0xc2d0('0x15')]){var _0x5b3048;_0x400bdd[_0xc2d0('0x1e')][_0xc2d0('0x1f')]({'where':{'id':_0x4c962a[_0xc2d0('0x20')]},'raw':!![]})[_0xc2d0('0x1a')](function(_0x3163e9){_0x5b3048=_0x3163e9;if(_0x5b3048&&_0x5b3048[_0xc2d0('0x21')]){switch(_0x5b3048['type']){case _0xc2d0('0x22'):var _0x52088a=require(_0xc2d0('0x22'));if(_0x5b3048[_0xc2d0('0x23')]&&_0x5b3048['authToken']&&_0x5b3048['phone']){var _0x15273f=new _0x52088a(_0x5b3048[_0xc2d0('0x23')],_0x5b3048[_0xc2d0('0x24')]);_0x15273f[_0xc2d0('0x25')][_0xc2d0('0x26')]({'body':_0x4c962a[_0xc2d0('0xf')],'to':_0xc2d0('0x27')+_0x4c962a['phone'],'from':_0xc2d0('0x27')+_0x5b3048[_0xc2d0('0x28')],'statusCallback':_0x5b3048[_0xc2d0('0x29')]+'/api/whatsapp/messages/'+_0x4c962a['id']+_0xc2d0('0x2a')+_0x5b3048[_0xc2d0('0x2b')]})['then'](function(_0x3ed886){if(_0x3ed886[_0xc2d0('0x2c')]){return _0x883480[_0xc2d0('0x2d')]({'messageId':_0x3ed886[_0xc2d0('0x2c')]});}})['catch'](function(_0xa132d5){logger[_0xc2d0('0x1d')](_0xc2d0('0x2e'),_0xc2d0('0x2f'),_0xc2d0('0x22'),util[_0xc2d0('0x30')](_0xa132d5,{'showHidden':![],'depth':null}));});}else{logger[_0xc2d0('0x1d')](_0xc2d0('0x2e'),_0xc2d0('0x2f'),_0xc2d0('0x22'),_0xc2d0('0x31'));}break;case'sinch':var _0x2f8a8c=_0x5b3048[_0xc2d0('0x23')];var _0x17090e=_0x5b3048[_0xc2d0('0x24')];var _0x590ca3=_0x5b3048[_0xc2d0('0x32')]+_0xc2d0('0x33')+_0x2f8a8c+_0xc2d0('0x34');var _0xee1796={'to':[_0x4c962a['phone']],'message':{'type':_0xc2d0('0x35'),'text':_0x4c962a[_0xc2d0('0xf')]}};var _0x42bee5={'method':_0xc2d0('0x36'),'uri':_0x590ca3,'headers':{'Authorization':_0xc2d0('0x37')+_0x17090e,'Content-Type':_0xc2d0('0x38')},'body':_0xee1796,'json':!![]};rp(_0x42bee5)[_0xc2d0('0x1a')](function(_0x3c2e3f){if(_0x3c2e3f[_0xc2d0('0x39')][0x0][_0xc2d0('0x3a')]){return _0x883480[_0xc2d0('0x2d')]({'messageId':_0x3c2e3f[_0xc2d0('0x39')][0x0][_0xc2d0('0x3a')]});}})[_0xc2d0('0x1c')](function(_0x18d915){logger['err']('WhatsappMessage,\x20%s',_0x18d915);});break;}}})[_0xc2d0('0x3b')](function(){_0x3b50fb();});}else{_0x3b50fb();}}},'charset':_0xc2d0('0x3c'),'collate':_0xc2d0('0x3d')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index f485693..ed257c2 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 _0xf109=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateWhatsappMessage','create','options','raw','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf109,0xe0));var _0x9f10=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xf109[_0x1a7846];return _0x48049;};'use strict';var _=require(_0x9f10('0x0'));var util=require('util');var moment=require(_0x9f10('0x1'));var BPromise=require(_0x9f10('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f10('0x3'));var db=require(_0x9f10('0x4'))['db'];var utils=require(_0x9f10('0x5'));var logger=require(_0x9f10('0x6'))(_0x9f10('0x7'));var config=require(_0x9f10('0x8'));var jayson=require(_0x9f10('0x9'));var client=jayson[_0x9f10('0xa')]['http']({'port':0x232a});config[_0x9f10('0xb')]=_[_0x9f10('0xc')](config[_0x9f10('0xb')],{'host':_0x9f10('0xd'),'port':0x18eb});var socket=require(_0x9f10('0xe'))(new Redis(config[_0x9f10('0xb')]));require(_0x9f10('0xf'))[_0x9f10('0x10')](socket);function respondWithRpcPromise(_0x1576cb,_0x3a824c,_0x15b856){return new BPromise(function(_0x44d2bd,_0x169149){return client[_0x9f10('0x11')](_0x1576cb,_0x15b856)[_0x9f10('0x12')](function(_0xc8e59f){logger['info'](_0x9f10('0x13'),_0x3a824c,_0x9f10('0x14'));logger['debug'](_0x9f10('0x15'),_0x3a824c,_0x9f10('0x14'),JSON[_0x9f10('0x16')](_0xc8e59f));if(_0xc8e59f['error']){if(_0xc8e59f[_0x9f10('0x17')][_0x9f10('0x18')]===0x1f4){logger['error'](_0x9f10('0x13'),_0x3a824c,_0xc8e59f[_0x9f10('0x17')][_0x9f10('0x19')]);return _0x169149(_0xc8e59f['error'][_0x9f10('0x19')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x3a824c,_0xc8e59f[_0x9f10('0x17')][_0x9f10('0x19')]);return _0x44d2bd(_0xc8e59f[_0x9f10('0x17')][_0x9f10('0x19')]);}else{logger[_0x9f10('0x1a')](_0x9f10('0x13'),_0x3a824c,_0x9f10('0x14'));_0x44d2bd(_0xc8e59f[_0x9f10('0x1b')]['message']);}})['catch'](function(_0x4f988c){logger['error'](_0x9f10('0x13'),_0x3a824c,_0x4f988c);_0x169149(_0x4f988c);});});}exports[_0x9f10('0x1c')]=function(_0xc1aa8f){var _0x3132ee=this;return new Promise(function(_0x50e481,_0x58d0ff){return db['WhatsappMessage'][_0x9f10('0x1d')](_0xc1aa8f['body'],{'raw':_0xc1aa8f[_0x9f10('0x1e')]?_0xc1aa8f[_0x9f10('0x1e')][_0x9f10('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x71842b){logger['info']('CreateWhatsappMessage',_0xc1aa8f);logger['debug'](_0x9f10('0x1c'),_0xc1aa8f,JSON[_0x9f10('0x16')](_0x71842b));_0x50e481(_0x71842b);})[_0x9f10('0x20')](function(_0x36e421){logger[_0x9f10('0x17')](_0x9f10('0x1c'),_0x36e421[_0x9f10('0x19')],_0xc1aa8f);_0x58d0ff(_0x3132ee[_0x9f10('0x17')](0x1f4,_0x36e421[_0x9f10('0x19')]));});});}; \ No newline at end of file +var _0x2063=['options','CreateWhatsappMessage','debug','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappMessage','create','body'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x2063,0x183));var _0x3206=function(_0x578f1b,_0x5a3be1){_0x578f1b=_0x578f1b-0x0;var _0x1777be=_0x2063[_0x578f1b];return _0x1777be;};'use strict';var _=require(_0x3206('0x0'));var util=require('util');var moment=require(_0x3206('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3206('0x2'));var db=require(_0x3206('0x3'))['db'];var utils=require(_0x3206('0x4'));var logger=require(_0x3206('0x5'))(_0x3206('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3206('0x7')][_0x3206('0x8')]({'port':0x232a});config['redis']=_[_0x3206('0x9')](config[_0x3206('0xa')],{'host':_0x3206('0xb'),'port':0x18eb});var socket=require(_0x3206('0xc'))(new Redis(config[_0x3206('0xa')]));require('./whatsappMessage.socket')[_0x3206('0xd')](socket);function respondWithRpcPromise(_0x134b68,_0x16b41d,_0x4d2815){return new BPromise(function(_0x3faaab,_0x2e9c69){return client[_0x3206('0xe')](_0x134b68,_0x4d2815)[_0x3206('0xf')](function(_0x491359){logger[_0x3206('0x10')](_0x3206('0x11'),_0x16b41d,_0x3206('0x12'));logger['debug'](_0x3206('0x13'),_0x16b41d,_0x3206('0x12'),JSON[_0x3206('0x14')](_0x491359));if(_0x491359[_0x3206('0x15')]){if(_0x491359['error'][_0x3206('0x16')]===0x1f4){logger[_0x3206('0x15')](_0x3206('0x11'),_0x16b41d,_0x491359[_0x3206('0x15')][_0x3206('0x17')]);return _0x2e9c69(_0x491359[_0x3206('0x15')][_0x3206('0x17')]);}logger[_0x3206('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x16b41d,_0x491359[_0x3206('0x15')][_0x3206('0x17')]);return _0x3faaab(_0x491359[_0x3206('0x15')][_0x3206('0x17')]);}else{logger['info'](_0x3206('0x11'),_0x16b41d,'request\x20sent');_0x3faaab(_0x491359[_0x3206('0x18')][_0x3206('0x17')]);}})[_0x3206('0x19')](function(_0xd273a4){logger[_0x3206('0x15')](_0x3206('0x11'),_0x16b41d,_0xd273a4);_0x2e9c69(_0xd273a4);});});}exports['CreateWhatsappMessage']=function(_0x325ec6){var _0x18e0cb=this;return new Promise(function(_0x35d04a,_0x118358){return db[_0x3206('0x1a')][_0x3206('0x1b')](_0x325ec6[_0x3206('0x1c')],{'raw':_0x325ec6[_0x3206('0x1d')]?_0x325ec6[_0x3206('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x3206('0xf')](function(_0x3952b1){logger[_0x3206('0x10')](_0x3206('0x1e'),_0x325ec6);logger[_0x3206('0x1f')](_0x3206('0x1e'),_0x325ec6,JSON[_0x3206('0x14')](_0x3952b1));_0x35d04a(_0x3952b1);})[_0x3206('0x19')](function(_0x3a1dd4){logger[_0x3206('0x15')](_0x3206('0x1e'),_0x3a1dd4[_0x3206('0x17')],_0x325ec6);_0x118358(_0x18e0cb[_0x3206('0x15')](0x1f4,_0x3a1dd4[_0x3206('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 518829b..c9c201d 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 _0x3804=['emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','update'];(function(_0x94522b,_0x59646a){var _0x5b7f9=function(_0x166f2){while(--_0x166f2){_0x94522b['push'](_0x94522b['shift']());}};_0x5b7f9(++_0x59646a);}(_0x3804,0x11d));var _0x4380=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3804[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require(_0x4380('0x0'));var events=[_0x4380('0x1'),'remove',_0x4380('0x2')];function createListener(_0x4331ac,_0x186a12){return function(_0x54dc34){_0x186a12[_0x4380('0x3')](_0x4331ac,_0x54dc34);};}function removeListener(_0xdeb86b,_0x4e762e){return function(){WhatsappMessageEvents[_0x4380('0x4')](_0xdeb86b,_0x4e762e);};}exports[_0x4380('0x5')]=function(_0x108064){for(var _0x5014d4=0x0,_0x5d37de=events[_0x4380('0x6')];_0x5014d4<_0x5d37de;_0x5014d4++){var _0x315225=events[_0x5014d4];var _0x21db65=createListener(_0x4380('0x7')+_0x315225,_0x108064);WhatsappMessageEvents['on'](_0x315225,_0x21db65);}}; \ No newline at end of file +var _0xd446=['save','emit','removeListener','register','./whatsappMessage.events'];(function(_0x870cc1,_0x56ecd4){var _0x41fb2d=function(_0x8ec16e){while(--_0x8ec16e){_0x870cc1['push'](_0x870cc1['shift']());}};_0x41fb2d(++_0x56ecd4);}(_0xd446,0x153));var _0x6d44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd446[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require(_0x6d44('0x0'));var events=[_0x6d44('0x1'),'remove','update'];function createListener(_0x49651d,_0x6b8b70){return function(_0x1f9f47){_0x6b8b70[_0x6d44('0x2')](_0x49651d,_0x1f9f47);};}function removeListener(_0x5d9a5a,_0x1cdb9e){return function(){WhatsappMessageEvents[_0x6d44('0x3')](_0x5d9a5a,_0x1cdb9e);};}exports[_0x6d44('0x4')]=function(_0x220fb4){for(var _0x52cc37=0x0,_0x241459=events['length'];_0x52cc37<_0x241459;_0x52cc37++){var _0x4ed1a1=events[_0x52cc37];var _0x53d7b1=createListener('whatsappMessage:'+_0x4ed1a1,_0x220fb4);WhatsappMessageEvents['on'](_0x4ed1a1,_0x53d7b1);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 542dbbd..4f4492b 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 _0x6e03=['Router','../../components/interaction/service','./whatsappQueue.controller','get','index','/describe','describe','isAuthenticated','show','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','/:id','update','delete','removeTeams','removeAgents','exports','multer','connect-timeout','express'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x6e03,0x177));var _0x36e0=function(_0x55cf4a,_0x21f4d6){_0x55cf4a=_0x55cf4a-0x0;var _0x1a7e25=_0x6e03[_0x55cf4a];return _0x1a7e25;};'use strict';var multer=require(_0x36e0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x36e0('0x1'));var express=require(_0x36e0('0x2'));var router=express[_0x36e0('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x36e0('0x4'));var config=require('../../config/environment');var controller=require(_0x36e0('0x5'));router[_0x36e0('0x6')]('/',auth['isAuthenticated'](),controller[_0x36e0('0x7')]);router[_0x36e0('0x6')](_0x36e0('0x8'),auth['isAuthenticated'](),controller[_0x36e0('0x9')]);router['get']('/:id',auth[_0x36e0('0xa')](),controller[_0x36e0('0xb')]);router[_0x36e0('0x6')]('/:id/members',auth['isAuthenticated'](),controller[_0x36e0('0xc')]);router[_0x36e0('0x6')]('/:id/teams',auth['isAuthenticated'](),controller[_0x36e0('0xd')]);router['get'](_0x36e0('0xe'),auth[_0x36e0('0xa')](),controller[_0x36e0('0xf')]);router[_0x36e0('0x10')]('/',auth[_0x36e0('0xa')](),controller['create']);router[_0x36e0('0x10')](_0x36e0('0x11'),auth[_0x36e0('0xa')](),controller[_0x36e0('0x12')]);router[_0x36e0('0x10')](_0x36e0('0xe'),auth['isAuthenticated'](),controller[_0x36e0('0x13')]);router[_0x36e0('0x14')](_0x36e0('0x15'),auth[_0x36e0('0xa')](),controller[_0x36e0('0x16')]);router[_0x36e0('0x17')](_0x36e0('0x15'),auth[_0x36e0('0xa')](),controller['destroy']);router[_0x36e0('0x17')](_0x36e0('0x11'),auth[_0x36e0('0xa')](),controller[_0x36e0('0x18')]);router[_0x36e0('0x17')](_0x36e0('0xe'),auth[_0x36e0('0xa')](),controller[_0x36e0('0x19')]);module[_0x36e0('0x1a')]=router; \ No newline at end of file +var _0x5007=['update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','/:id'];(function(_0x3f0847,_0x537690){var _0x7b8340=function(_0x44ff34){while(--_0x44ff34){_0x3f0847['push'](_0x3f0847['shift']());}};_0x7b8340(++_0x537690);}(_0x5007,0xe5));var _0x7500=function(_0x314dfd,_0x38da0b){_0x314dfd=_0x314dfd-0x0;var _0x344d04=_0x5007[_0x314dfd];return _0x344d04;};'use strict';var multer=require(_0x7500('0x0'));var util=require(_0x7500('0x1'));var path=require(_0x7500('0x2'));var timeout=require(_0x7500('0x3'));var express=require(_0x7500('0x4'));var router=express['Router']();var fs_extra=require(_0x7500('0x5'));var auth=require(_0x7500('0x6'));var interaction=require(_0x7500('0x7'));var config=require(_0x7500('0x8'));var controller=require(_0x7500('0x9'));router[_0x7500('0xa')]('/',auth[_0x7500('0xb')](),controller[_0x7500('0xc')]);router[_0x7500('0xa')](_0x7500('0xd'),auth[_0x7500('0xb')](),controller[_0x7500('0xe')]);router[_0x7500('0xa')]('/:id',auth[_0x7500('0xb')](),controller[_0x7500('0xf')]);router['get'](_0x7500('0x10'),auth[_0x7500('0xb')](),controller[_0x7500('0x11')]);router[_0x7500('0xa')]('/:id/teams',auth[_0x7500('0xb')](),controller[_0x7500('0x12')]);router['get'](_0x7500('0x13'),auth[_0x7500('0xb')](),controller[_0x7500('0x14')]);router[_0x7500('0x15')]('/',auth[_0x7500('0xb')](),controller[_0x7500('0x16')]);router[_0x7500('0x15')](_0x7500('0x17'),auth[_0x7500('0xb')](),controller[_0x7500('0x18')]);router[_0x7500('0x15')](_0x7500('0x13'),auth[_0x7500('0xb')](),controller['addAgents']);router[_0x7500('0x19')](_0x7500('0x1a'),auth[_0x7500('0xb')](),controller[_0x7500('0x1b')]);router[_0x7500('0x1c')](_0x7500('0x1a'),auth[_0x7500('0xb')](),controller[_0x7500('0x1d')]);router[_0x7500('0x1c')](_0x7500('0x17'),auth['isAuthenticated'](),controller[_0x7500('0x1e')]);router[_0x7500('0x1c')](_0x7500('0x13'),auth[_0x7500('0xb')](),controller['removeAgents']);module[_0x7500('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 16457fd..c833b15 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 _0xf2a6=['INTEGER','rrmemory','beepall','roundrobin','STRING','sequelize'];(function(_0x1f1862,_0x5b47c0){var _0xb84025=function(_0x4d2add){while(--_0x4d2add){_0x1f1862['push'](_0x1f1862['shift']());}};_0xb84025(++_0x5b47c0);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x1919c4,_0x17d1b3){_0x1919c4=_0x1919c4-0x0;var _0x6794e5=_0xf2a6[_0x1919c4];return _0x6794e5;};'use strict';var Sequelize=require(_0x6f2a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6f2a('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6f2a('0x2'),_0x6f2a('0x3'),_0x6f2a('0x4'))},'description':{'type':Sequelize[_0x6f2a('0x5')]}}; \ No newline at end of file +var _0xb9a7=['ENUM','beepall','roundrobin','STRING','exports'];(function(_0xf1a1e9,_0x424d15){var _0x56c744=function(_0x256a05){while(--_0x256a05){_0xf1a1e9['push'](_0xf1a1e9['shift']());}};_0x56c744(++_0x424d15);}(_0xb9a7,0x112));var _0x7b9a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xb9a7[_0x4792c8];return _0x35edb1;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7b9a('0x1')]('rrmemory',_0x7b9a('0x2'),_0x7b9a('0x3'))},'description':{'type':Sequelize[_0x7b9a('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index c155b3b..46e150d 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 _0xcd87=['socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','then','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','WhatsappQueue','fieldName','type','getOptions','where','query','findAll','rows','catch','params','model','keys','rawAttributes','filters','intersection','fields','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','destroy','describe','findOne','hasOwnProperty','order','sort','pick','WhatsappQueueId','filter','UserWhatsappQueue','User','findAndCountAll','map','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','nolimit','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','forEach','emit','removeTeams','Team','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','sequelize','SELECT','every','includes','value','isEmpty','userWhatsappQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x241a81,_0x4536fa){var _0x3a84f7=function(_0x53c1d5){while(--_0x53c1d5){_0x241a81['push'](_0x241a81['shift']());}};_0x3a84f7(++_0x4536fa);}(_0xcd87,0x6b));var _0x7cd8=function(_0x3e0b9f,_0x482387){_0x3e0b9f=_0x3e0b9f-0x0;var _0xd8b7e1=_0xcd87[_0x3e0b9f];return _0xd8b7e1;};'use strict';var BPromise=require(_0x7cd8('0x0'));var util=require(_0x7cd8('0x1'));var _=require(_0x7cd8('0x2'));var squel=require(_0x7cd8('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x7cd8('0x4'))('api');var config=require(_0x7cd8('0x5'));var db=require(_0x7cd8('0x6'))['db'];config[_0x7cd8('0x7')]=_[_0x7cd8('0x8')](config[_0x7cd8('0x7')],{'host':_0x7cd8('0x9'),'port':0x18eb});var socket=require(_0x7cd8('0xa'))(new Redis(config[_0x7cd8('0x7')]));require(_0x7cd8('0xb'))[_0x7cd8('0xc')](socket);function respondWithStatusCode(_0x69ac4b,_0x4acaf8){_0x4acaf8=_0x4acaf8||0xcc;return function(_0x3f988e){if(_0x3f988e){return _0x69ac4b[_0x7cd8('0xd')](_0x4acaf8);}return _0x69ac4b[_0x7cd8('0xe')](_0x4acaf8)[_0x7cd8('0xf')]();};}function respondWithResult(_0x11c6d6,_0x3a5086){_0x3a5086=_0x3a5086||0xc8;return function(_0x3f4c9c){if(_0x3f4c9c){return _0x11c6d6[_0x7cd8('0xe')](_0x3a5086)['json'](_0x3f4c9c);}};}function respondWithFilteredResult(_0x2d4230,_0x29b762){return function(_0x3d5b0f){if(_0x3d5b0f){var _0x57d710=typeof _0x29b762[_0x7cd8('0x10')]===_0x7cd8('0x11')&&typeof _0x29b762[_0x7cd8('0x12')]==='undefined';var _0x31f7e4=_0x3d5b0f[_0x7cd8('0x13')];var _0x641589=_0x57d710?0x0:_0x29b762[_0x7cd8('0x10')];var _0x3a8ecc=_0x57d710?_0x3d5b0f[_0x7cd8('0x13')]:_0x29b762[_0x7cd8('0x10')]+_0x29b762[_0x7cd8('0x12')];var _0x145657;if(_0x3a8ecc>=_0x31f7e4){_0x3a8ecc=_0x31f7e4;_0x145657=0xc8;}else{_0x145657=0xce;}_0x2d4230['status'](_0x145657);return _0x2d4230['set'](_0x7cd8('0x14'),_0x641589+'-'+_0x3a8ecc+'/'+_0x31f7e4)[_0x7cd8('0x15')](_0x3d5b0f);}return null;};}function saveUpdates(_0x157f21){return function(_0x418576){if(_0x418576){return _0x418576[_0x7cd8('0x16')](_0x157f21)[_0x7cd8('0x17')](function(_0x26bb72){return _0x26bb72;});}return null;};}function removeEntity(_0x1c2a06){return function(_0x3fef7a){if(_0x3fef7a){return _0x3fef7a['destroy']()['then'](function(){var _0x58cc7c=_0x3fef7a[_0x7cd8('0x18')]({'plain':!![]});var _0x1f6419=_0x7cd8('0x19');return db[_0x7cd8('0x1a')]['destroy']({'where':{'type':_0x1f6419,'resourceId':_0x58cc7c['id']}})[_0x7cd8('0x17')](function(){return _0x3fef7a;});})[_0x7cd8('0x17')](function(){_0x1c2a06['status'](0xcc)[_0x7cd8('0xf')]();});}};}function handleEntityNotFound(_0x44dff6){return function(_0x1c23e6){if(!_0x1c23e6){_0x44dff6[_0x7cd8('0xd')](0x194);}return _0x1c23e6;};}function handleError(_0x5b42b7,_0x2ff11d){_0x2ff11d=_0x2ff11d||0x1f4;return function(_0x1554d0){logger[_0x7cd8('0x1b')](_0x1554d0[_0x7cd8('0x1c')]);if(_0x1554d0[_0x7cd8('0x1d')]){delete _0x1554d0[_0x7cd8('0x1d')];}_0x5b42b7[_0x7cd8('0xe')](_0x2ff11d)[_0x7cd8('0x1e')](_0x1554d0);};}exports[_0x7cd8('0x1f')]=function(_0x567af6,_0x174beb){var _0x2065d7={};var _0x2f2a1b={'count':0x0,'rows':[]};var _0x51d1ea=_['map'](db[_0x7cd8('0x20')]['rawAttributes'],function(_0x1ca9d4){return{'name':_0x1ca9d4[_0x7cd8('0x21')],'type':_0x1ca9d4[_0x7cd8('0x22')]['key']};});_0x2065d7=qs[_0x7cd8('0x23')](_0x51d1ea,_0x567af6);var _0x29354f={'where':_0x2065d7[_0x7cd8('0x24')]};return db[_0x7cd8('0x20')]['count'](_0x29354f)[_0x7cd8('0x17')](function(_0x275b60){_0x2f2a1b[_0x7cd8('0x13')]=_0x275b60;_0x2065d7['include']=qs['include'](_0x567af6[_0x7cd8('0x25')]);return db[_0x7cd8('0x20')][_0x7cd8('0x26')](_0x2065d7);})[_0x7cd8('0x17')](function(_0x378fac){_0x2f2a1b[_0x7cd8('0x27')]=_0x378fac;return _0x2f2a1b;})['then'](respondWithFilteredResult(_0x174beb,_0x2065d7))[_0x7cd8('0x28')](handleError(_0x174beb,null));};exports['show']=function(_0x5dbb3d,_0x470f48){var _0xe38fa9={'raw':!![],'where':{'id':_0x5dbb3d[_0x7cd8('0x29')]['id']}},_0xd82469={};_0xd82469[_0x7cd8('0x2a')]=_[_0x7cd8('0x2b')](db[_0x7cd8('0x20')][_0x7cd8('0x2c')]);_0xd82469[_0x7cd8('0x25')]=_['keys'](_0x5dbb3d[_0x7cd8('0x25')]);_0xd82469[_0x7cd8('0x2d')]=_[_0x7cd8('0x2e')](_0xd82469['model'],_0xd82469[_0x7cd8('0x25')]);_0xe38fa9['attributes']=_[_0x7cd8('0x2e')](_0xd82469['model'],qs[_0x7cd8('0x2f')](_0x5dbb3d[_0x7cd8('0x25')][_0x7cd8('0x2f')]));_0xe38fa9[_0x7cd8('0x30')]=_0xe38fa9[_0x7cd8('0x30')][_0x7cd8('0x31')]?_0xe38fa9[_0x7cd8('0x30')]:_0xd82469[_0x7cd8('0x2a')];if(_0x5dbb3d[_0x7cd8('0x25')][_0x7cd8('0x32')]){_0xe38fa9['include']=[{'all':!![]}];}_0xe38fa9=_[_0x7cd8('0x33')]({},_0xe38fa9,_0x5dbb3d[_0x7cd8('0x34')]);return db[_0x7cd8('0x20')]['find'](_0xe38fa9)['then'](handleEntityNotFound(_0x470f48,null))[_0x7cd8('0x17')](respondWithResult(_0x470f48,null))[_0x7cd8('0x28')](handleError(_0x470f48,null));};exports[_0x7cd8('0x35')]=function(_0x11cd85,_0x561607){return db[_0x7cd8('0x20')]['create'](_0x11cd85[_0x7cd8('0x36')],{})[_0x7cd8('0x17')](function(_0x4d9654){var _0x45f93a=_0x11cd85[_0x7cd8('0x37')][_0x7cd8('0x18')]({'plain':!![]});if(!_0x45f93a)throw new Error(_0x7cd8('0x38'));if(_0x45f93a[_0x7cd8('0x39')]===_0x7cd8('0x37')){var _0xe62d88=_0x4d9654[_0x7cd8('0x18')]({'plain':!![]});var _0x1a6ca5=_0x7cd8('0x19');return db[_0x7cd8('0x3a')][_0x7cd8('0x3b')]({'where':{'name':_0x1a6ca5,'userProfileId':_0x45f93a[_0x7cd8('0x3c')]},'raw':!![]})[_0x7cd8('0x17')](function(_0x4c8d14){if(_0x4c8d14&&_0x4c8d14[_0x7cd8('0x3d')]===0x0){return db[_0x7cd8('0x1a')][_0x7cd8('0x35')]({'name':_0xe62d88[_0x7cd8('0x1d')],'resourceId':_0xe62d88['id'],'type':_0x4c8d14['name'],'sectionId':_0x4c8d14['id']},{})['then'](function(){return _0x4d9654;});}else{return _0x4d9654;}})['catch'](function(_0x65acdf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x65acdf);throw _0x65acdf;});}return _0x4d9654;})['then'](respondWithResult(_0x561607,0xc9))['catch'](handleError(_0x561607,null));};exports[_0x7cd8('0x16')]=function(_0x45bbf6,_0xe294e7){if(_0x45bbf6[_0x7cd8('0x36')]['id']){delete _0x45bbf6[_0x7cd8('0x36')]['id'];}return db['WhatsappQueue'][_0x7cd8('0x3b')]({'where':{'id':_0x45bbf6[_0x7cd8('0x29')]['id']}})[_0x7cd8('0x17')](handleEntityNotFound(_0xe294e7,null))[_0x7cd8('0x17')](saveUpdates(_0x45bbf6['body'],null))[_0x7cd8('0x17')](respondWithResult(_0xe294e7,null))['catch'](handleError(_0xe294e7,null));};exports[_0x7cd8('0x3e')]=function(_0x4999f5,_0x1aa87f){return db['WhatsappQueue'][_0x7cd8('0x3b')]({'where':{'id':_0x4999f5[_0x7cd8('0x29')]['id']}})['then'](handleEntityNotFound(_0x1aa87f,null))['then'](removeEntity(_0x1aa87f,null))[_0x7cd8('0x28')](handleError(_0x1aa87f,null));};exports[_0x7cd8('0x3f')]=function(_0x2d6ec7,_0x23b2bb){return db[_0x7cd8('0x20')][_0x7cd8('0x3f')]()[_0x7cd8('0x17')](respondWithResult(_0x23b2bb,null))[_0x7cd8('0x28')](handleError(_0x23b2bb,null));};exports['getMembers']=function(_0x2720ad,_0x20456b){var _0x1aa96e={'raw':!![],'where':{}},_0x58ae4a={},_0x33028e;return db[_0x7cd8('0x20')][_0x7cd8('0x40')]({'where':{'id':_0x2720ad[_0x7cd8('0x29')]['id']}})[_0x7cd8('0x17')](handleEntityNotFound(_0x20456b,null))[_0x7cd8('0x17')](function(_0x176810){if(_0x176810){_0x33028e=_0x176810[_0x7cd8('0x18')]({'plain':!![]});_0x58ae4a[_0x7cd8('0x2a')]=_[_0x7cd8('0x2b')](db['UserWhatsappQueue'][_0x7cd8('0x2c')]);_0x58ae4a[_0x7cd8('0x25')]=_[_0x7cd8('0x2b')](_0x2720ad['query']);_0x58ae4a[_0x7cd8('0x2d')]=_['intersection'](_0x58ae4a[_0x7cd8('0x2a')],_0x58ae4a[_0x7cd8('0x25')]);_0x1aa96e['attributes']=_[_0x7cd8('0x2e')](_0x58ae4a[_0x7cd8('0x2a')],qs[_0x7cd8('0x2f')](_0x2720ad[_0x7cd8('0x25')][_0x7cd8('0x2f')]));_0x1aa96e[_0x7cd8('0x30')]=_0x1aa96e[_0x7cd8('0x30')][_0x7cd8('0x31')]?_0x1aa96e[_0x7cd8('0x30')]:_0x58ae4a[_0x7cd8('0x2a')];if(!_0x2720ad[_0x7cd8('0x25')][_0x7cd8('0x41')]('nolimit')){_0x1aa96e[_0x7cd8('0x12')]=qs['limit'](_0x2720ad[_0x7cd8('0x25')][_0x7cd8('0x12')]);_0x1aa96e['offset']=qs[_0x7cd8('0x10')](_0x2720ad['query']['offset']);}_0x1aa96e[_0x7cd8('0x42')]=qs['sort'](_0x2720ad[_0x7cd8('0x25')][_0x7cd8('0x43')]);_0x1aa96e[_0x7cd8('0x24')]=qs['filters'](_[_0x7cd8('0x44')](_0x2720ad[_0x7cd8('0x25')],_0x58ae4a[_0x7cd8('0x2d')]));_0x1aa96e[_0x7cd8('0x24')][_0x7cd8('0x45')]=_0x176810['id'];if(_0x2720ad['query'][_0x7cd8('0x46')]){_0x1aa96e[_0x7cd8('0x24')]=_[_0x7cd8('0x33')](_0x1aa96e[_0x7cd8('0x24')],{'$or':_['map'](_0x1aa96e[_0x7cd8('0x30')],function(_0x527a40){var _0x1f7ba7={};_0x1f7ba7[_0x527a40]={'$like':'%'+_0x2720ad['query']['filter']+'%'};return _0x1f7ba7;})});}_0x1aa96e=_[_0x7cd8('0x33')]({},_0x1aa96e,_0x2720ad['options']);return db[_0x7cd8('0x47')][_0x7cd8('0x26')](_0x1aa96e);}})['then'](function(_0x4552e2){if(_0x4552e2){return db[_0x7cd8('0x48')][_0x7cd8('0x49')]({'where':{'id':_[_0x7cd8('0x4a')](_0x4552e2,'UserId'),'role':_0x7cd8('0x4b')},'attributes':['id',_0x7cd8('0x1d'),_0x7cd8('0x4c'),_0x7cd8('0x4d'),_0x7cd8('0x4e')]});}})['then'](function(_0x254698){if(_0x254698){return{'count':_0x254698[_0x7cd8('0x13')],'rows':_[_0x7cd8('0x4a')](_0x254698[_0x7cd8('0x27')],function(_0x5a38c6){return{'membername':_0x5a38c6[_0x7cd8('0x1d')],'UserId':_0x5a38c6['id'],'queue_name':_0x33028e[_0x7cd8('0x1d')],'WhatsappQueueId':_0x33028e['id'],'interface':util[_0x7cd8('0x4f')](_0x7cd8('0x50'),_0x7cd8('0x51'),_0x5a38c6[_0x7cd8('0x1d')]),'penalty':0x0,'paused':_0x5a38c6[_0x7cd8('0x4c')],'createdAt':_0x5a38c6[_0x7cd8('0x4e')],'updatedAt':_0x5a38c6[_0x7cd8('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7cd8('0x17')](respondWithFilteredResult(_0x20456b,_0x1aa96e))[_0x7cd8('0x28')](handleError(_0x20456b,null));};exports['getTeams']=function(_0x596340,_0xe7e193){var _0x287fa3={};var _0x18c9d9={};var _0x5ec832;var _0x1d3803;return db[_0x7cd8('0x20')][_0x7cd8('0x40')]({'where':{'id':_0x596340['params']['id']}})[_0x7cd8('0x17')](handleEntityNotFound(_0xe7e193,null))[_0x7cd8('0x17')](function(_0x68f97){if(_0x68f97){_0x5ec832=_0x68f97;_0x18c9d9[_0x7cd8('0x2a')]=_[_0x7cd8('0x2b')](db['Team'][_0x7cd8('0x2c')]);_0x18c9d9[_0x7cd8('0x25')]=_[_0x7cd8('0x2b')](_0x596340['query']);_0x18c9d9[_0x7cd8('0x2d')]=_[_0x7cd8('0x2e')](_0x18c9d9[_0x7cd8('0x2a')],_0x18c9d9[_0x7cd8('0x25')]);_0x287fa3[_0x7cd8('0x30')]=_[_0x7cd8('0x2e')](_0x18c9d9[_0x7cd8('0x2a')],qs[_0x7cd8('0x2f')](_0x596340[_0x7cd8('0x25')][_0x7cd8('0x2f')]));_0x287fa3[_0x7cd8('0x30')]=_0x287fa3[_0x7cd8('0x30')][_0x7cd8('0x31')]?_0x287fa3[_0x7cd8('0x30')]:_0x18c9d9[_0x7cd8('0x2a')];_0x287fa3['order']=qs[_0x7cd8('0x43')](_0x596340[_0x7cd8('0x25')][_0x7cd8('0x43')]);_0x287fa3['where']=qs[_0x7cd8('0x2d')](_[_0x7cd8('0x44')](_0x596340['query'],_0x18c9d9[_0x7cd8('0x2d')]));if(_0x596340['query'][_0x7cd8('0x46')]){_0x287fa3[_0x7cd8('0x24')]=_[_0x7cd8('0x33')](_0x287fa3[_0x7cd8('0x24')],{'$or':_[_0x7cd8('0x4a')](_0x287fa3['attributes'],function(_0x4972c1){var _0x43f3cc={};_0x43f3cc[_0x4972c1]={'$like':'%'+_0x596340[_0x7cd8('0x25')][_0x7cd8('0x46')]+'%'};return _0x43f3cc;})});}_0x287fa3=_['merge']({},_0x287fa3,_0x596340[_0x7cd8('0x34')]);return _0x5ec832['getTeams'](_0x287fa3);}})[_0x7cd8('0x17')](function(_0x523ed7){if(_0x523ed7){_0x1d3803=_0x523ed7[_0x7cd8('0x31')];if(!_0x596340[_0x7cd8('0x25')][_0x7cd8('0x41')](_0x7cd8('0x52'))){_0x287fa3[_0x7cd8('0x12')]=qs[_0x7cd8('0x12')](_0x596340[_0x7cd8('0x25')]['limit']);_0x287fa3[_0x7cd8('0x10')]=qs['offset'](_0x596340['query'][_0x7cd8('0x10')]);}return _0x5ec832[_0x7cd8('0x53')](_0x287fa3);}})[_0x7cd8('0x17')](function(_0x29e11e){if(_0x29e11e){return _0x29e11e?{'count':_0x1d3803,'rows':_0x29e11e}:null;}})[_0x7cd8('0x17')](respondWithResult(_0xe7e193,null))[_0x7cd8('0x28')](handleError(_0xe7e193,null));};exports[_0x7cd8('0x54')]=function(_0x301a13,_0x244c47){var _0x4e79de=_0x301a13[_0x7cd8('0x36')][_0x7cd8('0x55')];return db['Team'][_0x7cd8('0x26')]({'where':{'id':_0x4e79de},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7cd8('0x56'),'attributes':['id','name',_0x7cd8('0x57'),_0x7cd8('0x58'),_0x7cd8('0x59')],'raw':!![]}]})[_0x7cd8('0x17')](function(_0x44e16b){if(_0x44e16b){var _0x28db81=_[_0x7cd8('0x5a')](_0x44e16b,function(_0x16915e){var _0x542fe6=_0x16915e[_0x7cd8('0x18')]({'plain':!![]});return _0x542fe6[_0x7cd8('0x56')];});return db[_0x7cd8('0x20')]['find']({'where':{'id':_0x301a13[_0x7cd8('0x29')]['id']}})[_0x7cd8('0x17')](function(_0x4e5999){return db['sequelize'][_0x7cd8('0x5b')](function(_0x2d770c){return _0x4e5999['addTeams'](_0x4e79de,{'transaction':_0x2d770c})[_0x7cd8('0x17')](function(){return BPromise[_0x7cd8('0x5c')](_0x28db81,function(_0x450806){return db[_0x7cd8('0x47')]['findOrCreate']({'where':{'UserId':_0x450806['id'],'WhatsappQueueId':_0x301a13[_0x7cd8('0x29')]['id']},'transaction':_0x2d770c});});})[_0x7cd8('0x17')](function(){_0x28db81[_0x7cd8('0x5d')](function(_0xb3740b){socket[_0x7cd8('0x5e')]('userWhatsappQueue:save',{'UserId':_0xb3740b['id'],'WhatsappQueueId':_0x4e5999['id']});});});});});}})['then'](respondWithStatusCode(_0x244c47,null))[_0x7cd8('0x28')](handleError(_0x244c47,null));};exports[_0x7cd8('0x5f')]=function(_0x227d00,_0x5166){return db[_0x7cd8('0x60')][_0x7cd8('0x26')]({'where':{'id':_0x227d00['query'][_0x7cd8('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7cd8('0x56'),'attributes':['id'],'raw':!![]}]})[_0x7cd8('0x17')](handleEntityNotFound(_0x5166,null))['then'](function(_0x213949){var _0x32b0f2=_['map'](_0x213949,'id');var _0x43d9b2=[];var _0x11af67=[];var _0x3eeb67=squel['select']();_0x3eeb67['field'](_0x7cd8('0x61'))[_0x7cd8('0x62')](_0x7cd8('0x63'),'tq')[_0x7cd8('0x64')]('user_has_teams','ut',_0x7cd8('0x65'))[_0x7cd8('0x24')](_0x7cd8('0x66'),_0x227d00[_0x7cd8('0x29')]['id']);for(var _0x211db8=0x0;_0x211db8<_0x213949[_0x7cd8('0x31')];_0x211db8+=0x1){let _0x18dcc6=_0x213949[_0x211db8];for(var _0x1ccfc8=0x0;_0x1ccfc8<_0x18dcc6['Agents'][_0x7cd8('0x31')];_0x1ccfc8+=0x1){let _0xa29f6e=_0x18dcc6[_0x7cd8('0x56')][_0x1ccfc8];var _0x51b85c=_0x3eeb67[_0x7cd8('0x67')]();_0x51b85c['where']('ut.UserId\x20=\x20?',_0xa29f6e['id']);_0x11af67[_0x7cd8('0x68')](db[_0x7cd8('0x69')][_0x7cd8('0x25')](_0x51b85c['toString'](),{'type':db[_0x7cd8('0x69')]['QueryTypes'][_0x7cd8('0x6a')]})['then'](function(_0x3e127c){if(_0x3e127c[_0x7cd8('0x31')]===0x1){return _0xa29f6e['id'];}else{var _0x52ee51=_[_0x7cd8('0x6b')](_[_0x7cd8('0x4a')](_0x3e127c,'TeamId'),function(_0x893445){return _[_0x7cd8('0x6c')](_0x32b0f2,_0x893445);});if(_0x52ee51){return _0xa29f6e['id'];}}}));}}return BPromise['all'](_0x11af67)['then'](function(_0x52a907){_0x43d9b2=_(_0x43d9b2)['union'](_0x52a907)['compact']()[_0x7cd8('0x6d')]();return db[_0x7cd8('0x20')]['find']({'where':{'id':_0x227d00[_0x7cd8('0x29')]['id']}})[_0x7cd8('0x17')](function(_0x45ae91){return db[_0x7cd8('0x69')][_0x7cd8('0x5b')](function(_0x2bb9e4){return _0x45ae91['removeTeams'](_0x227d00[_0x7cd8('0x25')][_0x7cd8('0x55')],{'transaction':_0x2bb9e4})['then'](function(){if(!_[_0x7cd8('0x6e')](_0x43d9b2)){return _0x45ae91['removeAgents'](_0x43d9b2,{'transaction':_0x2bb9e4});}})[_0x7cd8('0x17')](function(){_0x43d9b2[_0x7cd8('0x5d')](function(_0x22d40e){socket[_0x7cd8('0x5e')](_0x7cd8('0x6f'),{'UserId':_0x22d40e,'WhatsappQueueId':_0x45ae91['id']});});});});});});})[_0x7cd8('0x17')](respondWithStatusCode(_0x5166,null))[_0x7cd8('0x28')](handleError(_0x5166,null));};exports[_0x7cd8('0x70')]=function(_0x3dbe60,_0xa8243a){return db[_0x7cd8('0x20')]['find']({'where':{'id':_0x3dbe60[_0x7cd8('0x29')]['id']}})['then'](handleEntityNotFound(_0xa8243a,null))[_0x7cd8('0x17')](function(_0x5cd030){if(_0x5cd030){return _0x5cd030[_0x7cd8('0x70')](_0x3dbe60[_0x7cd8('0x36')][_0x7cd8('0x55')],_[_0x7cd8('0x71')](_0x3dbe60[_0x7cd8('0x36')],['ids','id'])||{})['spread'](function(_0x212998){for(var _0x12f2c0=0x0;_0x12f2c0<_0x3dbe60[_0x7cd8('0x36')][_0x7cd8('0x55')][_0x7cd8('0x31')];_0x12f2c0+=0x1){socket[_0x7cd8('0x5e')]('userWhatsappQueue:save',{'UserId':Number(_0x3dbe60[_0x7cd8('0x36')][_0x7cd8('0x55')][_0x12f2c0]),'WhatsappQueueId':Number(_0x3dbe60[_0x7cd8('0x29')]['id'])});}return _0x212998;});}})[_0x7cd8('0x17')](respondWithResult(_0xa8243a,null))[_0x7cd8('0x28')](handleError(_0xa8243a,null));};exports[_0x7cd8('0x72')]=function(_0x486695,_0xb27e9){return db['WhatsappQueue']['find']({'where':{'id':_0x486695['params']['id']}})[_0x7cd8('0x17')](handleEntityNotFound(_0xb27e9,null))[_0x7cd8('0x17')](function(_0x5b41e8){if(_0x5b41e8){return _0x5b41e8[_0x7cd8('0x72')](_0x486695[_0x7cd8('0x25')][_0x7cd8('0x55')])[_0x7cd8('0x17')](function(){if(_[_0x7cd8('0x73')](_0x486695[_0x7cd8('0x25')][_0x7cd8('0x55')])){for(var _0x3a50db=0x0;_0x3a50db<_0x486695[_0x7cd8('0x25')]['ids']['length'];_0x3a50db+=0x1){socket['emit'](_0x7cd8('0x6f'),{'UserId':Number(_0x486695['query'][_0x7cd8('0x55')][_0x3a50db]),'WhatsappQueueId':Number(_0x486695[_0x7cd8('0x29')]['id'])});}}else{socket[_0x7cd8('0x5e')](_0x7cd8('0x6f'),{'UserId':Number(_0x486695['query'][_0x7cd8('0x55')]),'WhatsappQueueId':Number(_0x486695[_0x7cd8('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0xb27e9,null))[_0x7cd8('0x28')](handleError(_0xb27e9,null));};exports[_0x7cd8('0x74')]=function(_0x4b7e82,_0x36f2c6){var _0x28e275={};var _0x5172f0={};var _0x257bc9;var _0x1454e9;return db[_0x7cd8('0x20')][_0x7cd8('0x40')]({'where':{'id':_0x4b7e82['params']['id']}})[_0x7cd8('0x17')](handleEntityNotFound(_0x36f2c6,null))[_0x7cd8('0x17')](function(_0x47735e){if(_0x47735e){_0x257bc9=_0x47735e;_0x5172f0[_0x7cd8('0x2a')]=_[_0x7cd8('0x2b')](db[_0x7cd8('0x48')]['rawAttributes']);_0x5172f0['query']=_[_0x7cd8('0x2b')](_0x4b7e82[_0x7cd8('0x25')]);_0x5172f0[_0x7cd8('0x2d')]=_[_0x7cd8('0x2e')](_0x5172f0[_0x7cd8('0x2a')],_0x5172f0['query']);_0x28e275[_0x7cd8('0x30')]=_[_0x7cd8('0x2e')](_0x5172f0[_0x7cd8('0x2a')],qs[_0x7cd8('0x2f')](_0x4b7e82[_0x7cd8('0x25')][_0x7cd8('0x2f')]));_0x28e275['attributes']=_0x28e275[_0x7cd8('0x30')]['length']?_0x28e275[_0x7cd8('0x30')]:_0x5172f0[_0x7cd8('0x2a')];_0x28e275[_0x7cd8('0x42')]=qs['sort'](_0x4b7e82['query']['sort']);_0x28e275[_0x7cd8('0x24')]=qs[_0x7cd8('0x2d')](_[_0x7cd8('0x44')](_0x4b7e82[_0x7cd8('0x25')],_0x5172f0[_0x7cd8('0x2d')]));if(_0x4b7e82['query'][_0x7cd8('0x46')]){_0x28e275[_0x7cd8('0x24')]=_['merge'](_0x28e275['where'],{'$or':_[_0x7cd8('0x4a')](_0x28e275['attributes'],function(_0x137033){var _0x168368={};_0x168368[_0x137033]={'$like':'%'+_0x4b7e82[_0x7cd8('0x25')][_0x7cd8('0x46')]+'%'};return _0x168368;})});}_0x28e275=_[_0x7cd8('0x33')]({},_0x28e275,_0x4b7e82[_0x7cd8('0x34')]);return _0x257bc9['getAgents'](_0x28e275);}})[_0x7cd8('0x17')](function(_0x1ade00){if(_0x1ade00){_0x1454e9=_0x1ade00[_0x7cd8('0x31')];if(!_0x4b7e82[_0x7cd8('0x25')][_0x7cd8('0x41')](_0x7cd8('0x52'))){_0x28e275[_0x7cd8('0x12')]=qs['limit'](_0x4b7e82[_0x7cd8('0x25')][_0x7cd8('0x12')]);_0x28e275[_0x7cd8('0x10')]=qs[_0x7cd8('0x10')](_0x4b7e82[_0x7cd8('0x25')]['offset']);}return _0x257bc9[_0x7cd8('0x74')](_0x28e275);}})['then'](function(_0xe76d17){if(_0xe76d17){return _0xe76d17?{'count':_0x1454e9,'rows':_0xe76d17}:null;}})[_0x7cd8('0x17')](respondWithResult(_0x36f2c6,null))[_0x7cd8('0x28')](handleError(_0x36f2c6,null));}; \ No newline at end of file +var _0xa35f=['set','Content-Range','json','update','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','send','map','WhatsappQueue','rawAttributes','fieldName','include','query','findAll','rows','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','filters','hasOwnProperty','nolimit','sort','where','WhatsappQueueId','filter','UserWhatsappQueue','User','findAndCountAll','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','order','pick','ids','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','Agents','sequelize','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','offset','limit','undefined','count'];(function(_0x42ad6b,_0x39a94){var _0x442838=function(_0x4dc38c){while(--_0x4dc38c){_0x42ad6b['push'](_0x42ad6b['shift']());}};_0x442838(++_0x39a94);}(_0xa35f,0x66));var _0xfa35=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0xa35f[_0x17c8cc];return _0x3db4eb;};'use strict';var BPromise=require(_0xfa35('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0xfa35('0x1'));var Redis=require(_0xfa35('0x2'));var qs=require(_0xfa35('0x3'));var logger=require(_0xfa35('0x4'))(_0xfa35('0x5'));var config=require(_0xfa35('0x6'));var db=require(_0xfa35('0x7'))['db'];config[_0xfa35('0x8')]=_[_0xfa35('0x9')](config['redis'],{'host':_0xfa35('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa35('0x8')]));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x162105,_0x5efc21){_0x5efc21=_0x5efc21||0xcc;return function(_0x26eed7){if(_0x26eed7){return _0x162105[_0xfa35('0xb')](_0x5efc21);}return _0x162105[_0xfa35('0xc')](_0x5efc21)[_0xfa35('0xd')]();};}function respondWithResult(_0x554738,_0xe13faf){_0xe13faf=_0xe13faf||0xc8;return function(_0x5207e7){if(_0x5207e7){return _0x554738[_0xfa35('0xc')](_0xe13faf)['json'](_0x5207e7);}};}function respondWithFilteredResult(_0x199c59,_0x303cfb){return function(_0x514c55){if(_0x514c55){var _0x244b9d=typeof _0x303cfb[_0xfa35('0xe')]==='undefined'&&typeof _0x303cfb[_0xfa35('0xf')]===_0xfa35('0x10');var _0x392ec2=_0x514c55[_0xfa35('0x11')];var _0x26ccbb=_0x244b9d?0x0:_0x303cfb[_0xfa35('0xe')];var _0x1d2fb3=_0x244b9d?_0x514c55['count']:_0x303cfb[_0xfa35('0xe')]+_0x303cfb[_0xfa35('0xf')];var _0x328d89;if(_0x1d2fb3>=_0x392ec2){_0x1d2fb3=_0x392ec2;_0x328d89=0xc8;}else{_0x328d89=0xce;}_0x199c59[_0xfa35('0xc')](_0x328d89);return _0x199c59[_0xfa35('0x12')](_0xfa35('0x13'),_0x26ccbb+'-'+_0x1d2fb3+'/'+_0x392ec2)[_0xfa35('0x14')](_0x514c55);}return null;};}function saveUpdates(_0x4eca13){return function(_0x441e92){if(_0x441e92){return _0x441e92[_0xfa35('0x15')](_0x4eca13)['then'](function(_0x19823e){return _0x19823e;});}return null;};}function removeEntity(_0x40ae81){return function(_0x3ab133){if(_0x3ab133){return _0x3ab133['destroy']()[_0xfa35('0x16')](function(){var _0x46548e=_0x3ab133[_0xfa35('0x17')]({'plain':!![]});var _0x2996f6=_0xfa35('0x18');return db[_0xfa35('0x19')][_0xfa35('0x1a')]({'where':{'type':_0x2996f6,'resourceId':_0x46548e['id']}})[_0xfa35('0x16')](function(){return _0x3ab133;});})[_0xfa35('0x16')](function(){_0x40ae81['status'](0xcc)[_0xfa35('0xd')]();});}};}function handleEntityNotFound(_0x5e2a0b){return function(_0x4fe837){if(!_0x4fe837){_0x5e2a0b[_0xfa35('0xb')](0x194);}return _0x4fe837;};}function handleError(_0x345eb5,_0xbd273e){_0xbd273e=_0xbd273e||0x1f4;return function(_0x1f03e1){logger[_0xfa35('0x1b')](_0x1f03e1[_0xfa35('0x1c')]);if(_0x1f03e1['name']){delete _0x1f03e1['name'];}_0x345eb5[_0xfa35('0xc')](_0xbd273e)[_0xfa35('0x1d')](_0x1f03e1);};}exports['index']=function(_0x316ae3,_0xe662f9){var _0x304288={};var _0x5bef33={'count':0x0,'rows':[]};var _0x239e63=_[_0xfa35('0x1e')](db[_0xfa35('0x1f')][_0xfa35('0x20')],function(_0x137805){return{'name':_0x137805[_0xfa35('0x21')],'type':_0x137805['type']['key']};});_0x304288=qs['getOptions'](_0x239e63,_0x316ae3);var _0x24525c={'where':_0x304288['where']};return db[_0xfa35('0x1f')]['count'](_0x24525c)[_0xfa35('0x16')](function(_0x3c93a9){_0x5bef33[_0xfa35('0x11')]=_0x3c93a9;_0x304288[_0xfa35('0x22')]=qs[_0xfa35('0x22')](_0x316ae3[_0xfa35('0x23')]);return db[_0xfa35('0x1f')][_0xfa35('0x24')](_0x304288);})['then'](function(_0xfb696){_0x5bef33[_0xfa35('0x25')]=_0xfb696;return _0x5bef33;})[_0xfa35('0x16')](respondWithFilteredResult(_0xe662f9,_0x304288))[_0xfa35('0x26')](handleError(_0xe662f9,null));};exports[_0xfa35('0x27')]=function(_0x8c1fb8,_0x931e1d){var _0x3f1b66={'raw':!![],'where':{'id':_0x8c1fb8[_0xfa35('0x28')]['id']}},_0x13b040={};_0x13b040[_0xfa35('0x29')]=_[_0xfa35('0x2a')](db[_0xfa35('0x1f')]['rawAttributes']);_0x13b040[_0xfa35('0x23')]=_[_0xfa35('0x2a')](_0x8c1fb8[_0xfa35('0x23')]);_0x13b040['filters']=_[_0xfa35('0x2b')](_0x13b040[_0xfa35('0x29')],_0x13b040[_0xfa35('0x23')]);_0x3f1b66[_0xfa35('0x2c')]=_[_0xfa35('0x2b')](_0x13b040[_0xfa35('0x29')],qs['fields'](_0x8c1fb8['query'][_0xfa35('0x2d')]));_0x3f1b66[_0xfa35('0x2c')]=_0x3f1b66[_0xfa35('0x2c')][_0xfa35('0x2e')]?_0x3f1b66['attributes']:_0x13b040['model'];if(_0x8c1fb8['query'][_0xfa35('0x2f')]){_0x3f1b66[_0xfa35('0x22')]=[{'all':!![]}];}_0x3f1b66=_[_0xfa35('0x30')]({},_0x3f1b66,_0x8c1fb8[_0xfa35('0x31')]);return db[_0xfa35('0x1f')][_0xfa35('0x32')](_0x3f1b66)['then'](handleEntityNotFound(_0x931e1d,null))[_0xfa35('0x16')](respondWithResult(_0x931e1d,null))[_0xfa35('0x26')](handleError(_0x931e1d,null));};exports[_0xfa35('0x33')]=function(_0x20ff47,_0x20e06b){return db['WhatsappQueue'][_0xfa35('0x33')](_0x20ff47['body'],{})[_0xfa35('0x16')](function(_0x4a03b1){var _0x5ca6e9=_0x20ff47[_0xfa35('0x34')]['get']({'plain':!![]});if(!_0x5ca6e9)throw new Error(_0xfa35('0x35'));if(_0x5ca6e9[_0xfa35('0x36')]===_0xfa35('0x34')){var _0x59ca04=_0x4a03b1[_0xfa35('0x17')]({'plain':!![]});var _0x39e5c8=_0xfa35('0x18');return db[_0xfa35('0x37')][_0xfa35('0x32')]({'where':{'name':_0x39e5c8,'userProfileId':_0x5ca6e9[_0xfa35('0x38')]},'raw':!![]})[_0xfa35('0x16')](function(_0x1c409d){if(_0x1c409d&&_0x1c409d[_0xfa35('0x39')]===0x0){return db[_0xfa35('0x19')][_0xfa35('0x33')]({'name':_0x59ca04['name'],'resourceId':_0x59ca04['id'],'type':_0x1c409d[_0xfa35('0x3a')],'sectionId':_0x1c409d['id']},{})[_0xfa35('0x16')](function(){return _0x4a03b1;});}else{return _0x4a03b1;}})[_0xfa35('0x26')](function(_0x588a99){logger[_0xfa35('0x1b')](_0xfa35('0x3b'),_0x588a99);throw _0x588a99;});}return _0x4a03b1;})[_0xfa35('0x16')](respondWithResult(_0x20e06b,0xc9))[_0xfa35('0x26')](handleError(_0x20e06b,null));};exports[_0xfa35('0x15')]=function(_0x40a9ec,_0x4d0ae1){if(_0x40a9ec[_0xfa35('0x3c')]['id']){delete _0x40a9ec[_0xfa35('0x3c')]['id'];}return db[_0xfa35('0x1f')][_0xfa35('0x32')]({'where':{'id':_0x40a9ec[_0xfa35('0x28')]['id']}})['then'](handleEntityNotFound(_0x4d0ae1,null))[_0xfa35('0x16')](saveUpdates(_0x40a9ec[_0xfa35('0x3c')],null))[_0xfa35('0x16')](respondWithResult(_0x4d0ae1,null))[_0xfa35('0x26')](handleError(_0x4d0ae1,null));};exports[_0xfa35('0x1a')]=function(_0x545b48,_0x58ab7c){return db[_0xfa35('0x1f')][_0xfa35('0x32')]({'where':{'id':_0x545b48[_0xfa35('0x28')]['id']}})[_0xfa35('0x16')](handleEntityNotFound(_0x58ab7c,null))['then'](removeEntity(_0x58ab7c,null))[_0xfa35('0x26')](handleError(_0x58ab7c,null));};exports[_0xfa35('0x3d')]=function(_0x548e51,_0x3a7737){return db['WhatsappQueue'][_0xfa35('0x3d')]()[_0xfa35('0x16')](respondWithResult(_0x3a7737,null))[_0xfa35('0x26')](handleError(_0x3a7737,null));};exports[_0xfa35('0x3e')]=function(_0x5a2df2,_0x236aed){var _0xf1ebc4={'raw':!![],'where':{}},_0x340611={},_0x58cf20;return db[_0xfa35('0x1f')][_0xfa35('0x3f')]({'where':{'id':_0x5a2df2[_0xfa35('0x28')]['id']}})[_0xfa35('0x16')](handleEntityNotFound(_0x236aed,null))[_0xfa35('0x16')](function(_0x25a7e5){if(_0x25a7e5){_0x58cf20=_0x25a7e5[_0xfa35('0x17')]({'plain':!![]});_0x340611[_0xfa35('0x29')]=_[_0xfa35('0x2a')](db['UserWhatsappQueue'][_0xfa35('0x20')]);_0x340611['query']=_[_0xfa35('0x2a')](_0x5a2df2['query']);_0x340611[_0xfa35('0x40')]=_[_0xfa35('0x2b')](_0x340611['model'],_0x340611[_0xfa35('0x23')]);_0xf1ebc4[_0xfa35('0x2c')]=_[_0xfa35('0x2b')](_0x340611[_0xfa35('0x29')],qs[_0xfa35('0x2d')](_0x5a2df2[_0xfa35('0x23')][_0xfa35('0x2d')]));_0xf1ebc4[_0xfa35('0x2c')]=_0xf1ebc4[_0xfa35('0x2c')]['length']?_0xf1ebc4[_0xfa35('0x2c')]:_0x340611[_0xfa35('0x29')];if(!_0x5a2df2[_0xfa35('0x23')][_0xfa35('0x41')](_0xfa35('0x42'))){_0xf1ebc4[_0xfa35('0xf')]=qs[_0xfa35('0xf')](_0x5a2df2[_0xfa35('0x23')][_0xfa35('0xf')]);_0xf1ebc4[_0xfa35('0xe')]=qs['offset'](_0x5a2df2[_0xfa35('0x23')][_0xfa35('0xe')]);}_0xf1ebc4['order']=qs['sort'](_0x5a2df2[_0xfa35('0x23')][_0xfa35('0x43')]);_0xf1ebc4[_0xfa35('0x44')]=qs[_0xfa35('0x40')](_['pick'](_0x5a2df2['query'],_0x340611[_0xfa35('0x40')]));_0xf1ebc4[_0xfa35('0x44')][_0xfa35('0x45')]=_0x25a7e5['id'];if(_0x5a2df2[_0xfa35('0x23')][_0xfa35('0x46')]){_0xf1ebc4[_0xfa35('0x44')]=_[_0xfa35('0x30')](_0xf1ebc4[_0xfa35('0x44')],{'$or':_['map'](_0xf1ebc4[_0xfa35('0x2c')],function(_0x4892ec){var _0x1037bc={};_0x1037bc[_0x4892ec]={'$like':'%'+_0x5a2df2['query'][_0xfa35('0x46')]+'%'};return _0x1037bc;})});}_0xf1ebc4=_[_0xfa35('0x30')]({},_0xf1ebc4,_0x5a2df2[_0xfa35('0x31')]);return db[_0xfa35('0x47')][_0xfa35('0x24')](_0xf1ebc4);}})[_0xfa35('0x16')](function(_0x2db765){if(_0x2db765){return db[_0xfa35('0x48')][_0xfa35('0x49')]({'where':{'id':_[_0xfa35('0x1e')](_0x2db765,'UserId'),'role':_0xfa35('0x4a')},'attributes':['id',_0xfa35('0x3a'),_0xfa35('0x4b'),'updatedAt',_0xfa35('0x4c')]});}})[_0xfa35('0x16')](function(_0x3cf3da){if(_0x3cf3da){return{'count':_0x3cf3da['count'],'rows':_[_0xfa35('0x1e')](_0x3cf3da[_0xfa35('0x25')],function(_0x42a443){return{'membername':_0x42a443[_0xfa35('0x3a')],'UserId':_0x42a443['id'],'queue_name':_0x58cf20[_0xfa35('0x3a')],'WhatsappQueueId':_0x58cf20['id'],'interface':util[_0xfa35('0x4d')](_0xfa35('0x4e'),_0xfa35('0x4f'),_0x42a443[_0xfa35('0x3a')]),'penalty':0x0,'paused':_0x42a443[_0xfa35('0x4b')],'createdAt':_0x42a443[_0xfa35('0x4c')],'updatedAt':_0x42a443[_0xfa35('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfa35('0x16')](respondWithFilteredResult(_0x236aed,_0xf1ebc4))[_0xfa35('0x26')](handleError(_0x236aed,null));};exports[_0xfa35('0x51')]=function(_0x5b1aed,_0x22a286){var _0x200370={};var _0x34d1ad={};var _0x4e8350;var _0x429da9;return db[_0xfa35('0x1f')]['findOne']({'where':{'id':_0x5b1aed[_0xfa35('0x28')]['id']}})[_0xfa35('0x16')](handleEntityNotFound(_0x22a286,null))['then'](function(_0x17713d){if(_0x17713d){_0x4e8350=_0x17713d;_0x34d1ad['model']=_['keys'](db[_0xfa35('0x52')][_0xfa35('0x20')]);_0x34d1ad[_0xfa35('0x23')]=_[_0xfa35('0x2a')](_0x5b1aed[_0xfa35('0x23')]);_0x34d1ad[_0xfa35('0x40')]=_['intersection'](_0x34d1ad[_0xfa35('0x29')],_0x34d1ad['query']);_0x200370['attributes']=_[_0xfa35('0x2b')](_0x34d1ad[_0xfa35('0x29')],qs[_0xfa35('0x2d')](_0x5b1aed[_0xfa35('0x23')][_0xfa35('0x2d')]));_0x200370[_0xfa35('0x2c')]=_0x200370[_0xfa35('0x2c')]['length']?_0x200370[_0xfa35('0x2c')]:_0x34d1ad[_0xfa35('0x29')];_0x200370[_0xfa35('0x53')]=qs[_0xfa35('0x43')](_0x5b1aed[_0xfa35('0x23')][_0xfa35('0x43')]);_0x200370[_0xfa35('0x44')]=qs[_0xfa35('0x40')](_[_0xfa35('0x54')](_0x5b1aed['query'],_0x34d1ad['filters']));if(_0x5b1aed[_0xfa35('0x23')]['filter']){_0x200370[_0xfa35('0x44')]=_['merge'](_0x200370[_0xfa35('0x44')],{'$or':_['map'](_0x200370[_0xfa35('0x2c')],function(_0x5c3248){var _0x50909d={};_0x50909d[_0x5c3248]={'$like':'%'+_0x5b1aed[_0xfa35('0x23')][_0xfa35('0x46')]+'%'};return _0x50909d;})});}_0x200370=_['merge']({},_0x200370,_0x5b1aed['options']);return _0x4e8350[_0xfa35('0x51')](_0x200370);}})[_0xfa35('0x16')](function(_0x43a501){if(_0x43a501){_0x429da9=_0x43a501[_0xfa35('0x2e')];if(!_0x5b1aed[_0xfa35('0x23')][_0xfa35('0x41')]('nolimit')){_0x200370[_0xfa35('0xf')]=qs[_0xfa35('0xf')](_0x5b1aed[_0xfa35('0x23')][_0xfa35('0xf')]);_0x200370['offset']=qs[_0xfa35('0xe')](_0x5b1aed[_0xfa35('0x23')][_0xfa35('0xe')]);}return _0x4e8350[_0xfa35('0x51')](_0x200370);}})[_0xfa35('0x16')](function(_0x512904){if(_0x512904){return _0x512904?{'count':_0x429da9,'rows':_0x512904}:null;}})[_0xfa35('0x16')](respondWithResult(_0x22a286,null))[_0xfa35('0x26')](handleError(_0x22a286,null));};exports['addTeams']=function(_0x5e0e46,_0x202a50){var _0x201e2a=_0x5e0e46[_0xfa35('0x3c')][_0xfa35('0x55')];return db[_0xfa35('0x52')][_0xfa35('0x24')]({'where':{'id':_0x201e2a},'attributes':['id'],'include':[{'model':db[_0xfa35('0x48')],'as':'Agents','attributes':['id','name',_0xfa35('0x56'),_0xfa35('0x57'),_0xfa35('0x58')],'raw':!![]}]})[_0xfa35('0x16')](function(_0x34ec2d){if(_0x34ec2d){var _0x15c127=_[_0xfa35('0x59')](_0x34ec2d,function(_0x2ee679){var _0x23ef3f=_0x2ee679[_0xfa35('0x17')]({'plain':!![]});return _0x23ef3f['Agents'];});return db[_0xfa35('0x1f')][_0xfa35('0x32')]({'where':{'id':_0x5e0e46[_0xfa35('0x28')]['id']}})['then'](function(_0x436f11){return db['sequelize'][_0xfa35('0x5a')](function(_0x4cc85d){return _0x436f11['addTeams'](_0x201e2a,{'transaction':_0x4cc85d})[_0xfa35('0x16')](function(){return BPromise['each'](_0x15c127,function(_0xc7009){return db[_0xfa35('0x47')][_0xfa35('0x5b')]({'where':{'UserId':_0xc7009['id'],'WhatsappQueueId':_0x5e0e46['params']['id']},'transaction':_0x4cc85d});});})[_0xfa35('0x16')](function(){_0x15c127[_0xfa35('0x5c')](function(_0x5dcbab){socket[_0xfa35('0x5d')](_0xfa35('0x5e'),{'UserId':_0x5dcbab['id'],'WhatsappQueueId':_0x436f11['id']});});});});});}})[_0xfa35('0x16')](respondWithStatusCode(_0x202a50,null))['catch'](handleError(_0x202a50,null));};exports[_0xfa35('0x5f')]=function(_0x3d9c32,_0x219f70){return db['Team']['findAll']({'where':{'id':_0x3d9c32['query'][_0xfa35('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfa35('0x16')](handleEntityNotFound(_0x219f70,null))[_0xfa35('0x16')](function(_0x457d68){var _0x15dd7a=_[_0xfa35('0x1e')](_0x457d68,'id');var _0x160a5c=[];var _0xed37f0=[];var _0x409333=squel[_0xfa35('0x60')]();_0x409333['field']('tq.TeamId')[_0xfa35('0x61')](_0xfa35('0x62'),'tq')[_0xfa35('0x63')](_0xfa35('0x64'),'ut',_0xfa35('0x65'))[_0xfa35('0x44')](_0xfa35('0x66'),_0x3d9c32[_0xfa35('0x28')]['id']);for(var _0x1754ba=0x0;_0x1754ba<_0x457d68[_0xfa35('0x2e')];_0x1754ba+=0x1){let _0x35eecb=_0x457d68[_0x1754ba];for(var _0xea93ab=0x0;_0xea93ab<_0x35eecb[_0xfa35('0x67')][_0xfa35('0x2e')];_0xea93ab+=0x1){let _0x2af60a=_0x35eecb[_0xfa35('0x67')][_0xea93ab];var _0x2ad570=_0x409333['clone']();_0x2ad570['where']('ut.UserId\x20=\x20?',_0x2af60a['id']);_0xed37f0['push'](db[_0xfa35('0x68')][_0xfa35('0x23')](_0x2ad570['toString'](),{'type':db[_0xfa35('0x68')]['QueryTypes'][_0xfa35('0x69')]})[_0xfa35('0x16')](function(_0x566427){if(_0x566427[_0xfa35('0x2e')]===0x1){return _0x2af60a['id'];}else{var _0x36c7a1=_[_0xfa35('0x6a')](_[_0xfa35('0x1e')](_0x566427,_0xfa35('0x6b')),function(_0x4680fe){return _['includes'](_0x15dd7a,_0x4680fe);});if(_0x36c7a1){return _0x2af60a['id'];}}}));}}return BPromise[_0xfa35('0x6c')](_0xed37f0)['then'](function(_0x2d980f){_0x160a5c=_(_0x160a5c)[_0xfa35('0x6d')](_0x2d980f)[_0xfa35('0x6e')]()[_0xfa35('0x6f')]();return db[_0xfa35('0x1f')][_0xfa35('0x32')]({'where':{'id':_0x3d9c32[_0xfa35('0x28')]['id']}})[_0xfa35('0x16')](function(_0x3dee55){return db[_0xfa35('0x68')][_0xfa35('0x5a')](function(_0x1cd3b3){return _0x3dee55[_0xfa35('0x5f')](_0x3d9c32[_0xfa35('0x23')][_0xfa35('0x55')],{'transaction':_0x1cd3b3})[_0xfa35('0x16')](function(){if(!_[_0xfa35('0x70')](_0x160a5c)){return _0x3dee55[_0xfa35('0x71')](_0x160a5c,{'transaction':_0x1cd3b3});}})[_0xfa35('0x16')](function(){_0x160a5c[_0xfa35('0x5c')](function(_0x378978){socket['emit'](_0xfa35('0x72'),{'UserId':_0x378978,'WhatsappQueueId':_0x3dee55['id']});});});});});});})[_0xfa35('0x16')](respondWithStatusCode(_0x219f70,null))[_0xfa35('0x26')](handleError(_0x219f70,null));};exports[_0xfa35('0x73')]=function(_0x36724f,_0x95f4c3){return db[_0xfa35('0x1f')][_0xfa35('0x32')]({'where':{'id':_0x36724f[_0xfa35('0x28')]['id']}})[_0xfa35('0x16')](handleEntityNotFound(_0x95f4c3,null))[_0xfa35('0x16')](function(_0x106304){if(_0x106304){return _0x106304[_0xfa35('0x73')](_0x36724f[_0xfa35('0x3c')][_0xfa35('0x55')],_[_0xfa35('0x74')](_0x36724f[_0xfa35('0x3c')],[_0xfa35('0x55'),'id'])||{})[_0xfa35('0x75')](function(_0x13eb69){for(var _0x33090b=0x0;_0x33090b<_0x36724f[_0xfa35('0x3c')][_0xfa35('0x55')][_0xfa35('0x2e')];_0x33090b+=0x1){socket[_0xfa35('0x5d')]('userWhatsappQueue:save',{'UserId':Number(_0x36724f[_0xfa35('0x3c')][_0xfa35('0x55')][_0x33090b]),'WhatsappQueueId':Number(_0x36724f[_0xfa35('0x28')]['id'])});}return _0x13eb69;});}})[_0xfa35('0x16')](respondWithResult(_0x95f4c3,null))[_0xfa35('0x26')](handleError(_0x95f4c3,null));};exports[_0xfa35('0x71')]=function(_0x28a172,_0x3b7316){return db['WhatsappQueue'][_0xfa35('0x32')]({'where':{'id':_0x28a172[_0xfa35('0x28')]['id']}})['then'](handleEntityNotFound(_0x3b7316,null))['then'](function(_0x153a87){if(_0x153a87){return _0x153a87[_0xfa35('0x71')](_0x28a172[_0xfa35('0x23')]['ids'])[_0xfa35('0x16')](function(){if(_[_0xfa35('0x76')](_0x28a172[_0xfa35('0x23')][_0xfa35('0x55')])){for(var _0x1ddc32=0x0;_0x1ddc32<_0x28a172['query'][_0xfa35('0x55')][_0xfa35('0x2e')];_0x1ddc32+=0x1){socket['emit'](_0xfa35('0x72'),{'UserId':Number(_0x28a172[_0xfa35('0x23')][_0xfa35('0x55')][_0x1ddc32]),'WhatsappQueueId':Number(_0x28a172[_0xfa35('0x28')]['id'])});}}else{socket[_0xfa35('0x5d')]('userWhatsappQueue:remove',{'UserId':Number(_0x28a172[_0xfa35('0x23')][_0xfa35('0x55')]),'WhatsappQueueId':Number(_0x28a172[_0xfa35('0x28')]['id'])});}});}})[_0xfa35('0x16')](respondWithStatusCode(_0x3b7316,null))[_0xfa35('0x26')](handleError(_0x3b7316,null));};exports[_0xfa35('0x77')]=function(_0x7d5aeb,_0x3a2d97){var _0x316ca1={};var _0x17586c={};var _0x308c46;var _0xb69d4c;return db['WhatsappQueue'][_0xfa35('0x3f')]({'where':{'id':_0x7d5aeb[_0xfa35('0x28')]['id']}})[_0xfa35('0x16')](handleEntityNotFound(_0x3a2d97,null))[_0xfa35('0x16')](function(_0x80e6c0){if(_0x80e6c0){_0x308c46=_0x80e6c0;_0x17586c[_0xfa35('0x29')]=_[_0xfa35('0x2a')](db[_0xfa35('0x48')][_0xfa35('0x20')]);_0x17586c['query']=_[_0xfa35('0x2a')](_0x7d5aeb[_0xfa35('0x23')]);_0x17586c[_0xfa35('0x40')]=_[_0xfa35('0x2b')](_0x17586c[_0xfa35('0x29')],_0x17586c[_0xfa35('0x23')]);_0x316ca1['attributes']=_[_0xfa35('0x2b')](_0x17586c[_0xfa35('0x29')],qs[_0xfa35('0x2d')](_0x7d5aeb['query'][_0xfa35('0x2d')]));_0x316ca1[_0xfa35('0x2c')]=_0x316ca1['attributes'][_0xfa35('0x2e')]?_0x316ca1[_0xfa35('0x2c')]:_0x17586c[_0xfa35('0x29')];_0x316ca1['order']=qs['sort'](_0x7d5aeb[_0xfa35('0x23')]['sort']);_0x316ca1['where']=qs[_0xfa35('0x40')](_[_0xfa35('0x54')](_0x7d5aeb[_0xfa35('0x23')],_0x17586c[_0xfa35('0x40')]));if(_0x7d5aeb[_0xfa35('0x23')][_0xfa35('0x46')]){_0x316ca1[_0xfa35('0x44')]=_[_0xfa35('0x30')](_0x316ca1[_0xfa35('0x44')],{'$or':_[_0xfa35('0x1e')](_0x316ca1[_0xfa35('0x2c')],function(_0x540365){var _0x38c9af={};_0x38c9af[_0x540365]={'$like':'%'+_0x7d5aeb['query'][_0xfa35('0x46')]+'%'};return _0x38c9af;})});}_0x316ca1=_[_0xfa35('0x30')]({},_0x316ca1,_0x7d5aeb[_0xfa35('0x31')]);return _0x308c46['getAgents'](_0x316ca1);}})[_0xfa35('0x16')](function(_0x3fbf45){if(_0x3fbf45){_0xb69d4c=_0x3fbf45['length'];if(!_0x7d5aeb[_0xfa35('0x23')][_0xfa35('0x41')]('nolimit')){_0x316ca1[_0xfa35('0xf')]=qs[_0xfa35('0xf')](_0x7d5aeb[_0xfa35('0x23')][_0xfa35('0xf')]);_0x316ca1[_0xfa35('0xe')]=qs[_0xfa35('0xe')](_0x7d5aeb['query'][_0xfa35('0xe')]);}return _0x308c46[_0xfa35('0x77')](_0x316ca1);}})[_0xfa35('0x16')](function(_0x102d43){if(_0x102d43){return _0x102d43?{'count':_0xb69d4c,'rows':_0x102d43}:null;}})['then'](respondWithResult(_0x3a2d97,null))['catch'](handleError(_0x3a2d97,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 377ead3..13e4548 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 _0x2346=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2346,0x102));var _0x6234=function(_0x4eef56,_0x3ad39b){_0x4eef56=_0x4eef56-0x0;var _0x349d4a=_0x2346[_0x4eef56];return _0x349d4a;};'use strict';var EventEmitter=require(_0x6234('0x0'));var WhatsappQueue=require(_0x6234('0x1'))['db'][_0x6234('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6234('0x3')](0x0);var events={'afterCreate':_0x6234('0x4'),'afterUpdate':_0x6234('0x5'),'afterDestroy':_0x6234('0x6')};function emitEvent(_0x4759e1){return function(_0xf2c092,_0x1c8ed4,_0xf759d5){WhatsappQueueEvents[_0x6234('0x7')](_0x4759e1+':'+_0xf2c092['id'],_0xf2c092);WhatsappQueueEvents[_0x6234('0x7')](_0x4759e1,_0xf2c092);_0xf759d5(null);};}for(var e in events){if(events[_0x6234('0x8')](e)){var event=events[e];WhatsappQueue[_0x6234('0x9')](e,emitEvent(event));}}module[_0x6234('0xa')]=WhatsappQueueEvents; \ No newline at end of file +var _0xb062=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove','emit'];(function(_0x5a5caa,_0x510ada){var _0x77d337=function(_0x71d858){while(--_0x71d858){_0x5a5caa['push'](_0x5a5caa['shift']());}};_0x77d337(++_0x510ada);}(_0xb062,0x1a7));var _0x2b06=function(_0x332aae,_0x48b7e8){_0x332aae=_0x332aae-0x0;var _0x16fb4a=_0xb062[_0x332aae];return _0x16fb4a;};'use strict';var EventEmitter=require(_0x2b06('0x0'));var WhatsappQueue=require(_0x2b06('0x1'))['db'][_0x2b06('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x2b06('0x3')](0x0);var events={'afterCreate':_0x2b06('0x4'),'afterUpdate':'update','afterDestroy':_0x2b06('0x5')};function emitEvent(_0x28db2d){return function(_0x139918,_0x41c845,_0x10aeda){WhatsappQueueEvents[_0x2b06('0x6')](_0x28db2d+':'+_0x139918['id'],_0x139918);WhatsappQueueEvents['emit'](_0x28db2d,_0x139918);_0x10aeda(null);};}for(var e in events){if(events[_0x2b06('0x7')](e)){var event=events[e];WhatsappQueue[_0x2b06('0x8')](e,emitEvent(event));}}module[_0x2b06('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index dd965b5..f100d54 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 _0x50fc=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','WhatsappQueue','whatsapp_queues'];(function(_0x328d45,_0x28d0f6){var _0x3e34f6=function(_0x3e8cb2){while(--_0x3e8cb2){_0x328d45['push'](_0x328d45['shift']());}};_0x3e34f6(++_0x28d0f6);}(_0x50fc,0x1ad));var _0xc50f=function(_0x3ec822,_0x59a9c2){_0x3ec822=_0x3ec822-0x0;var _0x5927c6=_0x50fc[_0x3ec822];return _0x5927c6;};'use strict';var _=require('lodash');var util=require(_0xc50f('0x0'));var logger=require(_0xc50f('0x1'))('api');var moment=require(_0xc50f('0x2'));var BPromise=require(_0xc50f('0x3'));var rp=require(_0xc50f('0x4'));var fs=require('fs');var path=require(_0xc50f('0x5'));var rimraf=require(_0xc50f('0x6'));var config=require(_0xc50f('0x7'));var attributes=require(_0xc50f('0x8'));module['exports']=function(_0x2616e3,_0x2f7df4){return _0x2616e3['define'](_0xc50f('0x9'),attributes,{'tableName':_0xc50f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63aa=['moment','bluebird','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','lodash','../../config/logger','api'];(function(_0x2ab9eb,_0x10e74b){var _0x4c4cb1=function(_0x213f28){while(--_0x213f28){_0x2ab9eb['push'](_0x2ab9eb['shift']());}};_0x4c4cb1(++_0x10e74b);}(_0x63aa,0xcf));var _0xa63a=function(_0x290737,_0x3f0a0e){_0x290737=_0x290737-0x0;var _0x30e287=_0x63aa[_0x290737];return _0x30e287;};'use strict';var _=require(_0xa63a('0x0'));var util=require('util');var logger=require(_0xa63a('0x1'))(_0xa63a('0x2'));var moment=require(_0xa63a('0x3'));var BPromise=require(_0xa63a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa63a('0x5'));var config=require(_0xa63a('0x6'));var attributes=require(_0xa63a('0x7'));module['exports']=function(_0x269814,_0xbf70ea){return _0x269814[_0xa63a('0x8')](_0xa63a('0x9'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 5e5b911..5cc08ad 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 _0x4bfe=['debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','attributes','include','map','model','info','stringify','ShowWhatsappQueue','find','raw','where','util','moment','randomstring','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x4bfe,0xd3));var _0xe4bf=function(_0x355324,_0x21039d){_0x355324=_0x355324-0x0;var _0x26953a=_0x4bfe[_0x355324];return _0x26953a;};'use strict';var _=require('lodash');var util=require(_0xe4bf('0x0'));var moment=require(_0xe4bf('0x1'));var BPromise=require('bluebird');var rs=require(_0xe4bf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe4bf('0x3'))(_0xe4bf('0x4'));var config=require(_0xe4bf('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe4bf('0x6')][_0xe4bf('0x7')]({'port':0x232a});config[_0xe4bf('0x8')]=_[_0xe4bf('0x9')](config[_0xe4bf('0x8')],{'host':_0xe4bf('0xa'),'port':0x18eb});var socket=require(_0xe4bf('0xb'))(new Redis(config[_0xe4bf('0x8')]));require('./whatsappQueue.socket')[_0xe4bf('0xc')](socket);function respondWithRpcPromise(_0x278561,_0x1e73e6,_0x16d883){return new BPromise(function(_0x29c794,_0x475878){return client[_0xe4bf('0xd')](_0x278561,_0x16d883)[_0xe4bf('0xe')](function(_0x2c8987){logger['info'](_0xe4bf('0xf'),_0x1e73e6,_0xe4bf('0x10'));logger[_0xe4bf('0x11')](_0xe4bf('0x12'),_0x1e73e6,_0xe4bf('0x10'),JSON['stringify'](_0x2c8987));if(_0x2c8987[_0xe4bf('0x13')]){if(_0x2c8987[_0xe4bf('0x13')][_0xe4bf('0x14')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1e73e6,_0x2c8987['error'][_0xe4bf('0x15')]);return _0x475878(_0x2c8987[_0xe4bf('0x13')]['message']);}logger[_0xe4bf('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x1e73e6,_0x2c8987[_0xe4bf('0x13')]['message']);return _0x29c794(_0x2c8987[_0xe4bf('0x13')][_0xe4bf('0x15')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x1e73e6,_0xe4bf('0x10'));_0x29c794(_0x2c8987[_0xe4bf('0x16')]['message']);}})[_0xe4bf('0x17')](function(_0x208a6e){logger[_0xe4bf('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x1e73e6,_0x208a6e);_0x475878(_0x208a6e);});});}exports[_0xe4bf('0x18')]=function(_0x142b56){var _0x38d344=this;return new Promise(function(_0x481cfe,_0x437e61){return db[_0xe4bf('0x19')][_0xe4bf('0x1a')]({'raw':_0x142b56['options']?_0x142b56['options']['raw']===undefined?!![]:![]:!![],'where':_0x142b56['options']?_0x142b56[_0xe4bf('0x1b')]['where']||null:null,'attributes':_0x142b56['options']?_0x142b56[_0xe4bf('0x1b')][_0xe4bf('0x1c')]||null:null,'limit':_0x142b56[_0xe4bf('0x1b')]?_0x142b56[_0xe4bf('0x1b')]['limit']||null:null,'include':_0x142b56['options']?_0x142b56[_0xe4bf('0x1b')][_0xe4bf('0x1d')]?_[_0xe4bf('0x1e')](_0x142b56[_0xe4bf('0x1b')][_0xe4bf('0x1d')],function(_0x57f566){return{'model':db[_0x57f566[_0xe4bf('0x1f')]],'as':_0x57f566['as'],'attributes':_0x57f566['attributes'],'include':_0x57f566['include']?_['map'](_0x57f566[_0xe4bf('0x1d')],function(_0x1ba0ee){return{'model':db[_0x1ba0ee['model']],'as':_0x1ba0ee['as'],'attributes':_0x1ba0ee[_0xe4bf('0x1c')],'include':_0x1ba0ee[_0xe4bf('0x1d')]?_[_0xe4bf('0x1e')](_0x1ba0ee[_0xe4bf('0x1d')],function(_0x33eb6c){return{'model':db[_0x33eb6c['model']],'as':_0x33eb6c['as'],'attributes':_0x33eb6c['attributes']};}):[]};}):[]};}):[]:[]})[_0xe4bf('0xe')](function(_0x1da328){logger[_0xe4bf('0x20')](_0xe4bf('0x18'),_0x142b56);logger[_0xe4bf('0x11')](_0xe4bf('0x18'),_0x142b56,JSON[_0xe4bf('0x21')](_0x1da328));_0x481cfe(_0x1da328);})[_0xe4bf('0x17')](function(_0x537ed9){logger[_0xe4bf('0x13')](_0xe4bf('0x18'),_0x537ed9['message'],_0x142b56);_0x437e61(_0x38d344[_0xe4bf('0x13')](0x1f4,_0x537ed9[_0xe4bf('0x15')]));});});};exports[_0xe4bf('0x22')]=function(_0x4d8b18){var _0x530b41=this;return new Promise(function(_0x391d05,_0x38dac0){return db[_0xe4bf('0x19')][_0xe4bf('0x23')]({'raw':_0x4d8b18['options']?_0x4d8b18[_0xe4bf('0x1b')][_0xe4bf('0x24')]===undefined?!![]:![]:!![],'where':_0x4d8b18[_0xe4bf('0x1b')]?_0x4d8b18['options'][_0xe4bf('0x25')]||null:null,'attributes':_0x4d8b18[_0xe4bf('0x1b')]?_0x4d8b18[_0xe4bf('0x1b')][_0xe4bf('0x1c')]||null:null,'include':_0x4d8b18[_0xe4bf('0x1b')]?_0x4d8b18[_0xe4bf('0x1b')][_0xe4bf('0x1d')]?_[_0xe4bf('0x1e')](_0x4d8b18['options'][_0xe4bf('0x1d')],function(_0x1672aa){return{'model':db[_0x1672aa[_0xe4bf('0x1f')]],'as':_0x1672aa['as'],'attributes':_0x1672aa[_0xe4bf('0x1c')],'include':_0x1672aa['include']?_[_0xe4bf('0x1e')](_0x1672aa['include'],function(_0x582059){return{'model':db[_0x582059['model']],'as':_0x582059['as'],'attributes':_0x582059[_0xe4bf('0x1c')],'include':_0x582059[_0xe4bf('0x1d')]?_[_0xe4bf('0x1e')](_0x582059[_0xe4bf('0x1d')],function(_0x59c040){return{'model':db[_0x59c040[_0xe4bf('0x1f')]],'as':_0x59c040['as'],'attributes':_0x59c040['attributes']};}):[]};}):[]};}):[]:[]})[_0xe4bf('0xe')](function(_0x254b85){logger[_0xe4bf('0x20')](_0xe4bf('0x22'),_0x4d8b18);logger[_0xe4bf('0x11')]('ShowWhatsappQueue',_0x4d8b18,JSON['stringify'](_0x254b85));_0x391d05(_0x254b85);})['catch'](function(_0x5b998d){logger['error'](_0xe4bf('0x22'),_0x5b998d['message'],_0x4d8b18);_0x38dac0(_0x530b41[_0xe4bf('0x13')](0x1f4,_0x5b998d[_0xe4bf('0x15')]));});});}; \ No newline at end of file +var _0x7c72=['request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','WhatsappQueue','options','raw','attributes','limit','include','map','model','GetWhatsappQueue','stringify','ShowWhatsappQueue','where','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0x7c72,0x64));var _0x27c7=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x7c72[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0x27c7('0x0'));var util=require('util');var moment=require(_0x27c7('0x1'));var BPromise=require(_0x27c7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27c7('0x3'))['db'];var utils=require(_0x27c7('0x4'));var logger=require('../../config/logger')(_0x27c7('0x5'));var config=require(_0x27c7('0x6'));var jayson=require(_0x27c7('0x7'));var client=jayson['client'][_0x27c7('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x27c7('0x9')],{'host':_0x27c7('0xa'),'port':0x18eb});var socket=require(_0x27c7('0xb'))(new Redis(config['redis']));require(_0x27c7('0xc'))[_0x27c7('0xd')](socket);function respondWithRpcPromise(_0xc00834,_0x58da6f,_0x49132a){return new BPromise(function(_0x2a4e30,_0x2803d5){return client[_0x27c7('0xe')](_0xc00834,_0x49132a)[_0x27c7('0xf')](function(_0xaadb2b){logger[_0x27c7('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x58da6f,_0x27c7('0x11'));logger[_0x27c7('0x12')](_0x27c7('0x13'),_0x58da6f,_0x27c7('0x11'),JSON['stringify'](_0xaadb2b));if(_0xaadb2b['error']){if(_0xaadb2b[_0x27c7('0x14')][_0x27c7('0x15')]===0x1f4){logger[_0x27c7('0x14')](_0x27c7('0x16'),_0x58da6f,_0xaadb2b[_0x27c7('0x14')]['message']);return _0x2803d5(_0xaadb2b[_0x27c7('0x14')][_0x27c7('0x17')]);}logger[_0x27c7('0x14')](_0x27c7('0x16'),_0x58da6f,_0xaadb2b[_0x27c7('0x14')]['message']);return _0x2a4e30(_0xaadb2b[_0x27c7('0x14')][_0x27c7('0x17')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x58da6f,_0x27c7('0x11'));_0x2a4e30(_0xaadb2b[_0x27c7('0x18')][_0x27c7('0x17')]);}})[_0x27c7('0x19')](function(_0x20053f){logger[_0x27c7('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x58da6f,_0x20053f);_0x2803d5(_0x20053f);});});}exports['GetWhatsappQueue']=function(_0x2660f6){var _0xb0e871=this;return new Promise(function(_0x5dde1c,_0x4b038c){return db[_0x27c7('0x1a')]['findAll']({'raw':_0x2660f6[_0x27c7('0x1b')]?_0x2660f6[_0x27c7('0x1b')][_0x27c7('0x1c')]===undefined?!![]:![]:!![],'where':_0x2660f6['options']?_0x2660f6[_0x27c7('0x1b')]['where']||null:null,'attributes':_0x2660f6[_0x27c7('0x1b')]?_0x2660f6['options'][_0x27c7('0x1d')]||null:null,'limit':_0x2660f6[_0x27c7('0x1b')]?_0x2660f6[_0x27c7('0x1b')][_0x27c7('0x1e')]||null:null,'include':_0x2660f6[_0x27c7('0x1b')]?_0x2660f6['options'][_0x27c7('0x1f')]?_[_0x27c7('0x20')](_0x2660f6[_0x27c7('0x1b')][_0x27c7('0x1f')],function(_0x5e7029){return{'model':db[_0x5e7029[_0x27c7('0x21')]],'as':_0x5e7029['as'],'attributes':_0x5e7029['attributes'],'include':_0x5e7029['include']?_['map'](_0x5e7029[_0x27c7('0x1f')],function(_0x637c2a){return{'model':db[_0x637c2a[_0x27c7('0x21')]],'as':_0x637c2a['as'],'attributes':_0x637c2a[_0x27c7('0x1d')],'include':_0x637c2a[_0x27c7('0x1f')]?_[_0x27c7('0x20')](_0x637c2a[_0x27c7('0x1f')],function(_0x360db8){return{'model':db[_0x360db8['model']],'as':_0x360db8['as'],'attributes':_0x360db8[_0x27c7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x27c7('0xf')](function(_0x1be4c6){logger[_0x27c7('0x10')]('GetWhatsappQueue',_0x2660f6);logger[_0x27c7('0x12')](_0x27c7('0x22'),_0x2660f6,JSON[_0x27c7('0x23')](_0x1be4c6));_0x5dde1c(_0x1be4c6);})[_0x27c7('0x19')](function(_0x4713a1){logger[_0x27c7('0x14')]('GetWhatsappQueue',_0x4713a1['message'],_0x2660f6);_0x4b038c(_0xb0e871[_0x27c7('0x14')](0x1f4,_0x4713a1[_0x27c7('0x17')]));});});};exports[_0x27c7('0x24')]=function(_0x382e74){var _0x2e4313=this;return new Promise(function(_0x3e143e,_0x172855){return db[_0x27c7('0x1a')]['find']({'raw':_0x382e74['options']?_0x382e74['options'][_0x27c7('0x1c')]===undefined?!![]:![]:!![],'where':_0x382e74[_0x27c7('0x1b')]?_0x382e74[_0x27c7('0x1b')][_0x27c7('0x25')]||null:null,'attributes':_0x382e74[_0x27c7('0x1b')]?_0x382e74[_0x27c7('0x1b')]['attributes']||null:null,'include':_0x382e74[_0x27c7('0x1b')]?_0x382e74[_0x27c7('0x1b')][_0x27c7('0x1f')]?_[_0x27c7('0x20')](_0x382e74[_0x27c7('0x1b')][_0x27c7('0x1f')],function(_0x2de52a){return{'model':db[_0x2de52a[_0x27c7('0x21')]],'as':_0x2de52a['as'],'attributes':_0x2de52a[_0x27c7('0x1d')],'include':_0x2de52a['include']?_['map'](_0x2de52a[_0x27c7('0x1f')],function(_0x4e0f86){return{'model':db[_0x4e0f86[_0x27c7('0x21')]],'as':_0x4e0f86['as'],'attributes':_0x4e0f86[_0x27c7('0x1d')],'include':_0x4e0f86[_0x27c7('0x1f')]?_['map'](_0x4e0f86['include'],function(_0x421d09){return{'model':db[_0x421d09[_0x27c7('0x21')]],'as':_0x421d09['as'],'attributes':_0x421d09['attributes']};}):[]};}):[]};}):[]:[]})[_0x27c7('0xf')](function(_0x1d238e){logger[_0x27c7('0x10')]('ShowWhatsappQueue',_0x382e74);logger['debug'](_0x27c7('0x24'),_0x382e74,JSON['stringify'](_0x1d238e));_0x3e143e(_0x1d238e);})[_0x27c7('0x19')](function(_0x201c83){logger[_0x27c7('0x14')]('ShowWhatsappQueue',_0x201c83[_0x27c7('0x17')],_0x382e74);_0x172855(_0x2e4313[_0x27c7('0x14')](0x1f4,_0x201c83['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 71c0afd..36b6df9 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 _0xf1e1=['remove','emit','removeListener','length','whatsappQueue:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf1e1,0x1bd));var _0x1f1e=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0xf1e1[_0x16e57d];return _0x40239c;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0x1f1e('0x0'),'update'];function createListener(_0x50b856,_0x1d34c7){return function(_0x717866){_0x1d34c7[_0x1f1e('0x1')](_0x50b856,_0x717866);};}function removeListener(_0x3f1aad,_0x10a2da){return function(){WhatsappQueueEvents[_0x1f1e('0x2')](_0x3f1aad,_0x10a2da);};}exports['register']=function(_0x5a080f){for(var _0x1d62ae=0x0,_0x2e9c73=events[_0x1f1e('0x3')];_0x1d62ae<_0x2e9c73;_0x1d62ae++){var _0xfd3878=events[_0x1d62ae];var _0x47cb51=createListener(_0x1f1e('0x4')+_0xfd3878,_0x5a080f);WhatsappQueueEvents['on'](_0xfd3878,_0x47cb51);}}; \ No newline at end of file +var _0x3744=['./whatsappQueue.events','save','emit','removeListener','register','length','whatsappQueue:'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x3744,0x11f));var _0x4374=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3744[_0x3bf83f];return _0x22c4a9;};'use strict';var WhatsappQueueEvents=require(_0x4374('0x0'));var events=[_0x4374('0x1'),'remove','update'];function createListener(_0x2831ec,_0x47e2b8){return function(_0x1ca0e4){_0x47e2b8[_0x4374('0x2')](_0x2831ec,_0x1ca0e4);};}function removeListener(_0xee58db,_0x457752){return function(){WhatsappQueueEvents[_0x4374('0x3')](_0xee58db,_0x457752);};}exports[_0x4374('0x4')]=function(_0x51173e){for(var _0x301be2=0x0,_0x55053=events[_0x4374('0x5')];_0x301be2<_0x55053;_0x301be2++){var _0x80b2f5=events[_0x301be2];var _0x56d3e7=createListener(_0x4374('0x6')+_0x80b2f5,_0x51173e);WhatsappQueueEvents['on'](_0x80b2f5,_0x56d3e7);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 46f4bdb..5e1acb6 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 _0x9772=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./whatsappQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update','destroy'];(function(_0x5045f3,_0x4fa42e){var _0x44c672=function(_0x32a28f){while(--_0x32a28f){_0x5045f3['push'](_0x5045f3['shift']());}};_0x44c672(++_0x4fa42e);}(_0x9772,0x1c9));var _0x2977=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x9772[_0x1203f];return _0x365f0a;};'use strict';var multer=require(_0x2977('0x0'));var util=require(_0x2977('0x1'));var path=require(_0x2977('0x2'));var timeout=require('connect-timeout');var express=require(_0x2977('0x3'));var router=express[_0x2977('0x4')]();var fs_extra=require(_0x2977('0x5'));var auth=require(_0x2977('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2977('0x7'));router[_0x2977('0x8')]('/',auth[_0x2977('0x9')](),controller[_0x2977('0xa')]);router[_0x2977('0x8')]('/describe',auth[_0x2977('0x9')](),controller[_0x2977('0xb')]);router[_0x2977('0x8')](_0x2977('0xc'),auth[_0x2977('0x9')](),controller[_0x2977('0xd')]);router[_0x2977('0xe')]('/',auth[_0x2977('0x9')](),controller[_0x2977('0xf')]);router['put'](_0x2977('0xc'),auth[_0x2977('0x9')](),controller[_0x2977('0x10')]);router['delete']('/:id',auth[_0x2977('0x9')](),controller[_0x2977('0x11')]);module[_0x2977('0x12')]=router; \ No newline at end of file +var _0xef36=['../../config/environment','get','isAuthenticated','/describe','describe','show','post','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xef36,0x1bf));var _0x6ef3=function(_0x5f354e,_0x3698bf){_0x5f354e=_0x5f354e-0x0;var _0x4cb29c=_0xef36[_0x5f354e];return _0x4cb29c;};'use strict';var multer=require(_0x6ef3('0x0'));var util=require(_0x6ef3('0x1'));var path=require(_0x6ef3('0x2'));var timeout=require(_0x6ef3('0x3'));var express=require(_0x6ef3('0x4'));var router=express[_0x6ef3('0x5')]();var fs_extra=require(_0x6ef3('0x6'));var auth=require(_0x6ef3('0x7'));var interaction=require(_0x6ef3('0x8'));var config=require(_0x6ef3('0x9'));var controller=require('./whatsappQueueReport.controller');router[_0x6ef3('0xa')]('/',auth[_0x6ef3('0xb')](),controller['index']);router[_0x6ef3('0xa')](_0x6ef3('0xc'),auth[_0x6ef3('0xb')](),controller[_0x6ef3('0xd')]);router[_0x6ef3('0xa')]('/:id',auth[_0x6ef3('0xb')](),controller[_0x6ef3('0xe')]);router[_0x6ef3('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6ef3('0x10'),auth['isAuthenticated'](),controller[_0x6ef3('0x11')]);router['delete'](_0x6ef3('0x10'),auth[_0x6ef3('0xb')](),controller[_0x6ef3('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 103ce19..8f3c50e 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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x421c0c,_0x2f6c41){var _0x17182f=function(_0x3135ab){while(--_0x3135ab){_0x421c0c['push'](_0x421c0c['shift']());}};_0x17182f(++_0x2f6c41);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'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 +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x31e60d,_0x37ac23){var _0xc586f3=function(_0x5abae6){while(--_0x5abae6){_0x31e60d['push'](_0x31e60d['shift']());}};_0xc586f3(++_0x37ac23);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 3d6fe24..e300cab 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 _0x6b20=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','include','options','find','create','update','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x375fe6,_0x606707){var _0x234c90=function(_0x4eb6da){while(--_0x4eb6da){_0x375fe6['push'](_0x375fe6['shift']());}};_0x234c90(++_0x606707);}(_0x6b20,0xd1));var _0x06b2=function(_0x2243a9,_0x1a0ea5){_0x2243a9=_0x2243a9-0x0;var _0x5689b8=_0x6b20[_0x2243a9];return _0x5689b8;};'use strict';var emlformat=require(_0x06b2('0x0'));var rimraf=require(_0x06b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06b2('0x2'));var rp=require('request-promise');var moment=require(_0x06b2('0x3'));var BPromise=require(_0x06b2('0x4'));var Mustache=require(_0x06b2('0x5'));var util=require('util');var path=require(_0x06b2('0x6'));var sox=require(_0x06b2('0x7'));var csv=require(_0x06b2('0x8'));var ejs=require(_0x06b2('0x9'));var fs=require('fs');var fs_extra=require(_0x06b2('0xa'));var _=require(_0x06b2('0xb'));var squel=require(_0x06b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x06b2('0xd'));var deskjs=require(_0x06b2('0xe'));var toCsv=require(_0x06b2('0x8'));var querystring=require('querystring');var Papa=require(_0x06b2('0xf'));var Redis=require('ioredis');var authService=require(_0x06b2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06b2('0x11'));var logger=require(_0x06b2('0x12'))('api');var utils=require(_0x06b2('0x13'));var config=require(_0x06b2('0x14'));var licenseUtil=require(_0x06b2('0x15'));var db=require(_0x06b2('0x16'))['db'];function respondWithStatusCode(_0x44a9b4,_0x810a12){_0x810a12=_0x810a12||0xcc;return function(_0x3039c9){if(_0x3039c9){return _0x44a9b4[_0x06b2('0x17')](_0x810a12);}return _0x44a9b4[_0x06b2('0x18')](_0x810a12)[_0x06b2('0x19')]();};}function respondWithResult(_0xa81f11,_0x2822e9){_0x2822e9=_0x2822e9||0xc8;return function(_0x26faee){if(_0x26faee){return _0xa81f11['status'](_0x2822e9)[_0x06b2('0x1a')](_0x26faee);}};}function respondWithFilteredResult(_0xaee98c,_0x47496c){return function(_0x3830e9){if(_0x3830e9){var _0xef0466=typeof _0x47496c[_0x06b2('0x1b')]==='undefined'&&typeof _0x47496c[_0x06b2('0x1c')]===_0x06b2('0x1d');var _0x525945=_0x3830e9[_0x06b2('0x1e')];var _0x594b48=_0xef0466?0x0:_0x47496c['offset'];var _0x192270=_0xef0466?_0x3830e9[_0x06b2('0x1e')]:_0x47496c[_0x06b2('0x1b')]+_0x47496c[_0x06b2('0x1c')];var _0x4c4e21;if(_0x192270>=_0x525945){_0x192270=_0x525945;_0x4c4e21=0xc8;}else{_0x4c4e21=0xce;}_0xaee98c[_0x06b2('0x18')](_0x4c4e21);return _0xaee98c[_0x06b2('0x1f')](_0x06b2('0x20'),_0x594b48+'-'+_0x192270+'/'+_0x525945)[_0x06b2('0x1a')](_0x3830e9);}return null;};}function patchUpdates(_0xe28985){return function(_0x368ad8){try{jsonpatch[_0x06b2('0x21')](_0x368ad8,_0xe28985,!![]);}catch(_0x5ca622){return BPromise[_0x06b2('0x22')](_0x5ca622);}return _0x368ad8[_0x06b2('0x23')]();};}function saveUpdates(_0xb05f65,_0x208384){return function(_0x4e2a4c){if(_0x4e2a4c){return _0x4e2a4c['update'](_0xb05f65)[_0x06b2('0x24')](function(_0xb5231e){return _0xb5231e;});}return null;};}function removeEntity(_0x4fc95f,_0x39659f){return function(_0x5e40f2){if(_0x5e40f2){return _0x5e40f2[_0x06b2('0x25')]()[_0x06b2('0x24')](function(){_0x4fc95f[_0x06b2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4382ce,_0x306ce){return function(_0xc65820){if(!_0xc65820){_0x4382ce[_0x06b2('0x17')](0x194);}return _0xc65820;};}function handleError(_0x1173fc,_0x4f5e90){_0x4f5e90=_0x4f5e90||0x1f4;return function(_0xbb00ea){logger[_0x06b2('0x26')](_0xbb00ea[_0x06b2('0x27')]);if(_0xbb00ea[_0x06b2('0x28')]){delete _0xbb00ea[_0x06b2('0x28')];}_0x1173fc[_0x06b2('0x18')](_0x4f5e90)['send'](_0xbb00ea);};}exports[_0x06b2('0x29')]=function(_0x2a3228,_0x2720fa){var _0x13c0eb={},_0x1f02d8={},_0x1bfaa9={'count':0x0,'rows':[]};var _0x3668bb=_['map'](db[_0x06b2('0x2a')][_0x06b2('0x2b')],function(_0x1637c2){return{'name':_0x1637c2[_0x06b2('0x2c')],'type':_0x1637c2[_0x06b2('0x2d')][_0x06b2('0x2e')]};});_0x1f02d8[_0x06b2('0x2f')]=_[_0x06b2('0x30')](_0x3668bb,'name');_0x1f02d8[_0x06b2('0x31')]=_[_0x06b2('0x32')](_0x2a3228[_0x06b2('0x31')]);_0x1f02d8[_0x06b2('0x33')]=_[_0x06b2('0x34')](_0x1f02d8[_0x06b2('0x2f')],_0x1f02d8[_0x06b2('0x31')]);_0x13c0eb['attributes']=_['intersection'](_0x1f02d8[_0x06b2('0x2f')],qs[_0x06b2('0x35')](_0x2a3228[_0x06b2('0x31')]['fields']));_0x13c0eb[_0x06b2('0x36')]=_0x13c0eb[_0x06b2('0x36')][_0x06b2('0x37')]?_0x13c0eb[_0x06b2('0x36')]:_0x1f02d8[_0x06b2('0x2f')];if(!_0x2a3228[_0x06b2('0x31')]['hasOwnProperty'](_0x06b2('0x38'))){_0x13c0eb[_0x06b2('0x1c')]=qs[_0x06b2('0x1c')](_0x2a3228['query'][_0x06b2('0x1c')]);_0x13c0eb[_0x06b2('0x1b')]=qs['offset'](_0x2a3228[_0x06b2('0x31')][_0x06b2('0x1b')]);}_0x13c0eb[_0x06b2('0x39')]=qs[_0x06b2('0x3a')](_0x2a3228[_0x06b2('0x31')][_0x06b2('0x3a')]);_0x13c0eb[_0x06b2('0x3b')]=qs[_0x06b2('0x33')](_[_0x06b2('0x3c')](_0x2a3228[_0x06b2('0x31')],_0x1f02d8[_0x06b2('0x33')]),_0x3668bb);if(_0x2a3228[_0x06b2('0x31')]['filter']){_0x13c0eb[_0x06b2('0x3b')]=_['merge'](_0x13c0eb['where'],{'$or':_[_0x06b2('0x30')](_0x3668bb,function(_0x4e92e0){if(_0x4e92e0[_0x06b2('0x2d')]!=='VIRTUAL'){var _0x35e29c={};_0x35e29c[_0x4e92e0[_0x06b2('0x28')]]={'$like':'%'+_0x2a3228[_0x06b2('0x31')][_0x06b2('0x3d')]+'%'};return _0x35e29c;}})});}_0x13c0eb=_[_0x06b2('0x3e')]({},_0x13c0eb,_0x2a3228['options']);var _0x404eab={'where':_0x13c0eb[_0x06b2('0x3b')]};return db[_0x06b2('0x2a')][_0x06b2('0x1e')](_0x404eab)[_0x06b2('0x24')](function(_0x39fd60){_0x1bfaa9['count']=_0x39fd60;if(_0x2a3228[_0x06b2('0x31')][_0x06b2('0x3f')]){_0x13c0eb['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x06b2('0x40')](_0x13c0eb);})[_0x06b2('0x24')](function(_0x286c9b){_0x1bfaa9[_0x06b2('0x41')]=_0x286c9b;return _0x1bfaa9;})[_0x06b2('0x24')](respondWithFilteredResult(_0x2720fa,_0x13c0eb))[_0x06b2('0x42')](handleError(_0x2720fa,null));};exports[_0x06b2('0x43')]=function(_0x2ff968,_0x2e2a80){var _0x117bf4={'raw':!![],'where':{'id':_0x2ff968[_0x06b2('0x44')]['id']}},_0x1d7750={};_0x1d7750[_0x06b2('0x2f')]=_[_0x06b2('0x32')](db[_0x06b2('0x2a')][_0x06b2('0x2b')]);_0x1d7750[_0x06b2('0x31')]=_[_0x06b2('0x32')](_0x2ff968[_0x06b2('0x31')]);_0x1d7750['filters']=_[_0x06b2('0x34')](_0x1d7750[_0x06b2('0x2f')],_0x1d7750[_0x06b2('0x31')]);_0x117bf4[_0x06b2('0x36')]=_['intersection'](_0x1d7750[_0x06b2('0x2f')],qs[_0x06b2('0x35')](_0x2ff968['query'][_0x06b2('0x35')]));_0x117bf4[_0x06b2('0x36')]=_0x117bf4['attributes'][_0x06b2('0x37')]?_0x117bf4[_0x06b2('0x36')]:_0x1d7750['model'];if(_0x2ff968['query']['includeAll']){_0x117bf4[_0x06b2('0x45')]=[{'all':!![]}];}_0x117bf4=_[_0x06b2('0x3e')]({},_0x117bf4,_0x2ff968[_0x06b2('0x46')]);return db[_0x06b2('0x2a')][_0x06b2('0x47')](_0x117bf4)['then'](handleEntityNotFound(_0x2e2a80,null))['then'](respondWithResult(_0x2e2a80,null))[_0x06b2('0x42')](handleError(_0x2e2a80,null));};exports[_0x06b2('0x48')]=function(_0x979759,_0x1f4d89){return db[_0x06b2('0x2a')][_0x06b2('0x48')](_0x979759['body'],{})[_0x06b2('0x24')](respondWithResult(_0x1f4d89,0xc9))[_0x06b2('0x42')](handleError(_0x1f4d89,null));};exports[_0x06b2('0x49')]=function(_0x33f72e,_0x146c5c){if(_0x33f72e[_0x06b2('0x4a')]['id']){delete _0x33f72e['body']['id'];}return db[_0x06b2('0x2a')][_0x06b2('0x47')]({'where':{'id':_0x33f72e[_0x06b2('0x44')]['id']}})[_0x06b2('0x24')](handleEntityNotFound(_0x146c5c,null))['then'](saveUpdates(_0x33f72e[_0x06b2('0x4a')],null))[_0x06b2('0x24')](respondWithResult(_0x146c5c,null))[_0x06b2('0x42')](handleError(_0x146c5c,null));};exports[_0x06b2('0x25')]=function(_0x546c9e,_0x346f04){return db[_0x06b2('0x2a')][_0x06b2('0x47')]({'where':{'id':_0x546c9e[_0x06b2('0x44')]['id']}})[_0x06b2('0x24')](handleEntityNotFound(_0x346f04,null))[_0x06b2('0x24')](removeEntity(_0x346f04,null))[_0x06b2('0x42')](handleError(_0x346f04,null));};exports[_0x06b2('0x4b')]=function(_0x568091,_0x33bc8e){return db[_0x06b2('0x2a')][_0x06b2('0x4b')]()[_0x06b2('0x24')](respondWithResult(_0x33bc8e,null))[_0x06b2('0x42')](handleError(_0x33bc8e,null));}; \ No newline at end of file +var _0x36ee=['describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','WhatsappQueueReport','rawAttributes','type','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36ee,0xe8));var _0xe36e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x36ee[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];function respondWithStatusCode(_0x4fbdb2,_0x32981d){_0x32981d=_0x32981d||0xcc;return function(_0x27841e){if(_0x27841e){return _0x4fbdb2[_0xe36e('0x19')](_0x32981d);}return _0x4fbdb2[_0xe36e('0x1a')](_0x32981d)['end']();};}function respondWithResult(_0x3e264a,_0x521afa){_0x521afa=_0x521afa||0xc8;return function(_0x525155){if(_0x525155){return _0x3e264a[_0xe36e('0x1a')](_0x521afa)[_0xe36e('0x1b')](_0x525155);}};}function respondWithFilteredResult(_0x26fb37,_0x278135){return function(_0xd6828e){if(_0xd6828e){var _0x924cd5=typeof _0x278135[_0xe36e('0x1c')]===_0xe36e('0x1d')&&typeof _0x278135[_0xe36e('0x1e')]===_0xe36e('0x1d');var _0x5792e8=_0xd6828e[_0xe36e('0x1f')];var _0x2184ae=_0x924cd5?0x0:_0x278135['offset'];var _0x21d9a3=_0x924cd5?_0xd6828e['count']:_0x278135[_0xe36e('0x1c')]+_0x278135[_0xe36e('0x1e')];var _0x5e15f5;if(_0x21d9a3>=_0x5792e8){_0x21d9a3=_0x5792e8;_0x5e15f5=0xc8;}else{_0x5e15f5=0xce;}_0x26fb37[_0xe36e('0x1a')](_0x5e15f5);return _0x26fb37[_0xe36e('0x20')](_0xe36e('0x21'),_0x2184ae+'-'+_0x21d9a3+'/'+_0x5792e8)['json'](_0xd6828e);}return null;};}function patchUpdates(_0x21e95e){return function(_0x21bcf9){try{jsonpatch[_0xe36e('0x22')](_0x21bcf9,_0x21e95e,!![]);}catch(_0x3c4017){return BPromise[_0xe36e('0x23')](_0x3c4017);}return _0x21bcf9[_0xe36e('0x24')]();};}function saveUpdates(_0x4f438a,_0xd71137){return function(_0x4f214a){if(_0x4f214a){return _0x4f214a[_0xe36e('0x25')](_0x4f438a)[_0xe36e('0x26')](function(_0x437f3f){return _0x437f3f;});}return null;};}function removeEntity(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(_0x4749a8){return _0x4749a8[_0xe36e('0x27')]()[_0xe36e('0x26')](function(){_0x53e13a[_0xe36e('0x1a')](0xcc)[_0xe36e('0x28')]();});}};}function handleEntityNotFound(_0x1507f9,_0x1a045c){return function(_0x5ac484){if(!_0x5ac484){_0x1507f9[_0xe36e('0x19')](0x194);}return _0x5ac484;};}function handleError(_0x35f9e7,_0x10597f){_0x10597f=_0x10597f||0x1f4;return function(_0x262caa){logger['error'](_0x262caa[_0xe36e('0x29')]);if(_0x262caa['name']){delete _0x262caa[_0xe36e('0x2a')];}_0x35f9e7['status'](_0x10597f)[_0xe36e('0x2b')](_0x262caa);};}exports['index']=function(_0x410504,_0x4c5d98){var _0x3b1045={},_0x59548b={},_0x4bb75b={'count':0x0,'rows':[]};var _0x5d8fd8=_['map'](db[_0xe36e('0x2c')][_0xe36e('0x2d')],function(_0x4cf185){return{'name':_0x4cf185['fieldName'],'type':_0x4cf185[_0xe36e('0x2e')][_0xe36e('0x2f')]};});_0x59548b[_0xe36e('0x30')]=_[_0xe36e('0x31')](_0x5d8fd8,_0xe36e('0x2a'));_0x59548b[_0xe36e('0x32')]=_['keys'](_0x410504[_0xe36e('0x32')]);_0x59548b[_0xe36e('0x33')]=_['intersection'](_0x59548b[_0xe36e('0x30')],_0x59548b[_0xe36e('0x32')]);_0x3b1045[_0xe36e('0x34')]=_[_0xe36e('0x35')](_0x59548b[_0xe36e('0x30')],qs[_0xe36e('0x36')](_0x410504[_0xe36e('0x32')][_0xe36e('0x36')]));_0x3b1045[_0xe36e('0x34')]=_0x3b1045[_0xe36e('0x34')][_0xe36e('0x37')]?_0x3b1045['attributes']:_0x59548b[_0xe36e('0x30')];if(!_0x410504['query']['hasOwnProperty'](_0xe36e('0x38'))){_0x3b1045['limit']=qs[_0xe36e('0x1e')](_0x410504[_0xe36e('0x32')][_0xe36e('0x1e')]);_0x3b1045[_0xe36e('0x1c')]=qs['offset'](_0x410504['query'][_0xe36e('0x1c')]);}_0x3b1045[_0xe36e('0x39')]=qs[_0xe36e('0x3a')](_0x410504[_0xe36e('0x32')]['sort']);_0x3b1045[_0xe36e('0x3b')]=qs[_0xe36e('0x33')](_[_0xe36e('0x3c')](_0x410504['query'],_0x59548b[_0xe36e('0x33')]),_0x5d8fd8);if(_0x410504[_0xe36e('0x32')]['filter']){_0x3b1045[_0xe36e('0x3b')]=_[_0xe36e('0x3d')](_0x3b1045[_0xe36e('0x3b')],{'$or':_[_0xe36e('0x31')](_0x5d8fd8,function(_0xeadfa6){if(_0xeadfa6[_0xe36e('0x2e')]!==_0xe36e('0x3e')){var _0x20877d={};_0x20877d[_0xeadfa6[_0xe36e('0x2a')]]={'$like':'%'+_0x410504[_0xe36e('0x32')][_0xe36e('0x3f')]+'%'};return _0x20877d;}})});}_0x3b1045=_[_0xe36e('0x3d')]({},_0x3b1045,_0x410504[_0xe36e('0x40')]);var _0x5f396c={'where':_0x3b1045[_0xe36e('0x3b')]};return db[_0xe36e('0x2c')][_0xe36e('0x1f')](_0x5f396c)[_0xe36e('0x26')](function(_0x295feb){_0x4bb75b['count']=_0x295feb;if(_0x410504['query'][_0xe36e('0x41')]){_0x3b1045[_0xe36e('0x42')]=[{'all':!![]}];}return db[_0xe36e('0x2c')][_0xe36e('0x43')](_0x3b1045);})[_0xe36e('0x26')](function(_0x34a1ba){_0x4bb75b[_0xe36e('0x44')]=_0x34a1ba;return _0x4bb75b;})[_0xe36e('0x26')](respondWithFilteredResult(_0x4c5d98,_0x3b1045))['catch'](handleError(_0x4c5d98,null));};exports[_0xe36e('0x45')]=function(_0x2d392c,_0x4788a0){var _0x21dc35={'raw':!![],'where':{'id':_0x2d392c[_0xe36e('0x46')]['id']}},_0x5ef3e4={};_0x5ef3e4[_0xe36e('0x30')]=_[_0xe36e('0x47')](db[_0xe36e('0x2c')][_0xe36e('0x2d')]);_0x5ef3e4['query']=_[_0xe36e('0x47')](_0x2d392c[_0xe36e('0x32')]);_0x5ef3e4[_0xe36e('0x33')]=_[_0xe36e('0x35')](_0x5ef3e4[_0xe36e('0x30')],_0x5ef3e4[_0xe36e('0x32')]);_0x21dc35['attributes']=_[_0xe36e('0x35')](_0x5ef3e4[_0xe36e('0x30')],qs[_0xe36e('0x36')](_0x2d392c[_0xe36e('0x32')][_0xe36e('0x36')]));_0x21dc35['attributes']=_0x21dc35[_0xe36e('0x34')][_0xe36e('0x37')]?_0x21dc35[_0xe36e('0x34')]:_0x5ef3e4[_0xe36e('0x30')];if(_0x2d392c[_0xe36e('0x32')][_0xe36e('0x41')]){_0x21dc35[_0xe36e('0x42')]=[{'all':!![]}];}_0x21dc35=_[_0xe36e('0x3d')]({},_0x21dc35,_0x2d392c[_0xe36e('0x40')]);return db['WhatsappQueueReport']['find'](_0x21dc35)[_0xe36e('0x26')](handleEntityNotFound(_0x4788a0,null))['then'](respondWithResult(_0x4788a0,null))[_0xe36e('0x48')](handleError(_0x4788a0,null));};exports[_0xe36e('0x49')]=function(_0x38b93f,_0x25aa09){return db['WhatsappQueueReport'][_0xe36e('0x49')](_0x38b93f[_0xe36e('0x4a')],{})['then'](respondWithResult(_0x25aa09,0xc9))[_0xe36e('0x48')](handleError(_0x25aa09,null));};exports[_0xe36e('0x25')]=function(_0x2c26e6,_0x42eae5){if(_0x2c26e6[_0xe36e('0x4a')]['id']){delete _0x2c26e6[_0xe36e('0x4a')]['id'];}return db[_0xe36e('0x2c')][_0xe36e('0x4b')]({'where':{'id':_0x2c26e6[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x42eae5,null))[_0xe36e('0x26')](saveUpdates(_0x2c26e6[_0xe36e('0x4a')],null))[_0xe36e('0x26')](respondWithResult(_0x42eae5,null))[_0xe36e('0x48')](handleError(_0x42eae5,null));};exports[_0xe36e('0x27')]=function(_0x5678d3,_0x3262bf){return db['WhatsappQueueReport']['find']({'where':{'id':_0x5678d3[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x3262bf,null))['then'](removeEntity(_0x3262bf,null))[_0xe36e('0x48')](handleError(_0x3262bf,null));};exports[_0xe36e('0x4c')]=function(_0x8a767a,_0x1f4a5d){return db[_0xe36e('0x2c')][_0xe36e('0x4c')]()[_0xe36e('0x26')](respondWithResult(_0x1f4a5d,null))[_0xe36e('0x48')](handleError(_0x1f4a5d,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index ec5a3f5..0cd0269 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 _0x6781=['path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x6781,0xe9));var _0x1678=function(_0x940b2e,_0x4c223e){_0x940b2e=_0x940b2e-0x0;var _0x2f94fa=_0x6781[_0x940b2e];return _0x2f94fa;};'use strict';var _=require('lodash');var util=require(_0x1678('0x0'));var logger=require(_0x1678('0x1'))(_0x1678('0x2'));var moment=require(_0x1678('0x3'));var BPromise=require(_0x1678('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1678('0x5'));var rimraf=require(_0x1678('0x6'));var config=require(_0x1678('0x7'));var attributes=require(_0x1678('0x8'));module[_0x1678('0x9')]=function(_0x20f8f3,_0x4fade2){return _0x20f8f3[_0x1678('0xa')](_0x1678('0xb'),attributes,{'tableName':_0x1678('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1678('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7002=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x4e1119,_0x32dc78){var _0x35f53d=function(_0x2bbfe0){while(--_0x2bbfe0){_0x4e1119['push'](_0x4e1119['shift']());}};_0x35f53d(++_0x32dc78);}(_0x7002,0x16d));var _0x2700=function(_0x427217,_0x4039b1){_0x427217=_0x427217-0x0;var _0x5b28fb=_0x7002[_0x427217];return _0x5b28fb;};'use strict';var _=require(_0x2700('0x0'));var util=require('util');var logger=require(_0x2700('0x1'))(_0x2700('0x2'));var moment=require(_0x2700('0x3'));var BPromise=require(_0x2700('0x4'));var rp=require(_0x2700('0x5'));var fs=require('fs');var path=require(_0x2700('0x6'));var rimraf=require(_0x2700('0x7'));var config=require(_0x2700('0x8'));var attributes=require(_0x2700('0x9'));module[_0x2700('0xa')]=function(_0x14a66a,_0x5f5353){return _0x14a66a[_0x2700('0xb')](_0x2700('0xc'),attributes,{'tableName':_0x2700('0xd'),'paranoid':![],'indexes':[{'name':_0x2700('0xe'),'fields':[_0x2700('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 3bda66f..b5d7173 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 _0xb2fb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','options','raw','then','CreateWhatsappQueueReport','update','body','where','attributes','UpdateWhatsappQueueReport','moment','randomstring'];(function(_0x433a8c,_0x1574c7){var _0x1d79f9=function(_0x4e5cbd){while(--_0x4e5cbd){_0x433a8c['push'](_0x433a8c['shift']());}};_0x1d79f9(++_0x1574c7);}(_0xb2fb,0x16a));var _0xbb2f=function(_0x1f1fb4,_0x15a561){_0x1f1fb4=_0x1f1fb4-0x0;var _0x12fa15=_0xb2fb[_0x1f1fb4];return _0x12fa15;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbb2f('0x0'));var BPromise=require('bluebird');var rs=require(_0xbb2f('0x1'));var fs=require('fs');var Redis=require(_0xbb2f('0x2'));var db=require(_0xbb2f('0x3'))['db'];var utils=require(_0xbb2f('0x4'));var logger=require(_0xbb2f('0x5'))(_0xbb2f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbb2f('0x7')][_0xbb2f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbf7d3,_0x2fcde5,_0x10d66d){return new BPromise(function(_0x47e823,_0x2fda3c){return client['request'](_0xbf7d3,_0x10d66d)['then'](function(_0x1a53eb){logger[_0xbb2f('0x9')](_0xbb2f('0xa'),_0x2fcde5,_0xbb2f('0xb'));logger[_0xbb2f('0xc')](_0xbb2f('0xd'),_0x2fcde5,_0xbb2f('0xb'),JSON[_0xbb2f('0xe')](_0x1a53eb));if(_0x1a53eb[_0xbb2f('0xf')]){if(_0x1a53eb[_0xbb2f('0xf')][_0xbb2f('0x10')]===0x1f4){logger[_0xbb2f('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2fcde5,_0x1a53eb['error']['message']);return _0x2fda3c(_0x1a53eb['error'][_0xbb2f('0x11')]);}logger[_0xbb2f('0xf')](_0xbb2f('0xa'),_0x2fcde5,_0x1a53eb[_0xbb2f('0xf')]['message']);return _0x47e823(_0x1a53eb[_0xbb2f('0xf')][_0xbb2f('0x11')]);}else{logger[_0xbb2f('0x9')](_0xbb2f('0xa'),_0x2fcde5,_0xbb2f('0xb'));_0x47e823(_0x1a53eb['result']['message']);}})[_0xbb2f('0x12')](function(_0xa796bc){logger[_0xbb2f('0xf')](_0xbb2f('0xa'),_0x2fcde5,_0xa796bc);_0x2fda3c(_0xa796bc);});});}exports['CreateWhatsappQueueReport']=function(_0x1cea7d){var _0x2bb248=this;return new Promise(function(_0x42afc9,_0x42af3b){return db['WhatsappQueueReport']['create'](_0x1cea7d['body'],{'raw':_0x1cea7d[_0xbb2f('0x13')]?_0x1cea7d[_0xbb2f('0x13')][_0xbb2f('0x14')]===undefined?!![]:![]:!![]})[_0xbb2f('0x15')](function(_0x3cb8c0){logger[_0xbb2f('0x9')]('CreateWhatsappQueueReport',_0x1cea7d);logger[_0xbb2f('0xc')](_0xbb2f('0x16'),_0x1cea7d,JSON[_0xbb2f('0xe')](_0x3cb8c0));_0x42afc9(_0x3cb8c0);})['catch'](function(_0x561af9){logger[_0xbb2f('0xf')]('CreateWhatsappQueueReport',_0x561af9[_0xbb2f('0x11')],_0x1cea7d);_0x42af3b(_0x2bb248['error'](0x1f4,_0x561af9[_0xbb2f('0x11')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x590d88){var _0xb0621=this;return new Promise(function(_0x228cba,_0x36bcb8){return db['WhatsappQueueReport'][_0xbb2f('0x17')](_0x590d88[_0xbb2f('0x18')],{'raw':_0x590d88['options']?_0x590d88[_0xbb2f('0x13')][_0xbb2f('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x590d88['options']?_0x590d88[_0xbb2f('0x13')][_0xbb2f('0x19')]||null:null,'attributes':_0x590d88[_0xbb2f('0x13')]?_0x590d88[_0xbb2f('0x13')][_0xbb2f('0x1a')]||null:null,'limit':_0x590d88[_0xbb2f('0x13')]?_0x590d88['options']['limit']||null:null})[_0xbb2f('0x15')](function(_0x115744){logger[_0xbb2f('0x9')](_0xbb2f('0x1b'),_0x590d88);logger['debug']('UpdateWhatsappQueueReport',_0x590d88,JSON[_0xbb2f('0xe')](_0x115744));_0x228cba(_0x115744);})[_0xbb2f('0x12')](function(_0x3d6ea8){logger['error']('UpdateWhatsappQueueReport',_0x3d6ea8['message'],_0x590d88);_0x36bcb8(_0xb0621[_0xbb2f('0xf')](0x1f4,_0x3d6ea8['message']));});});}; \ No newline at end of file +var _0x2c3b=['options','UpdateWhatsappQueueReport','update','raw','where','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body'];(function(_0x222875,_0x58c290){var _0x47e501=function(_0x4dbe5c){while(--_0x4dbe5c){_0x222875['push'](_0x222875['shift']());}};_0x47e501(++_0x58c290);}(_0x2c3b,0x106));var _0xb2c3=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x2c3b[_0x1ae491];return _0x4958a5;};'use strict';var _=require(_0xb2c3('0x0'));var util=require('util');var moment=require(_0xb2c3('0x1'));var BPromise=require(_0xb2c3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2c3('0x3'));var db=require(_0xb2c3('0x4'))['db'];var utils=require(_0xb2c3('0x5'));var logger=require(_0xb2c3('0x6'))(_0xb2c3('0x7'));var config=require(_0xb2c3('0x8'));var jayson=require(_0xb2c3('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59d3a6,_0x32a661,_0x5d7261){return new BPromise(function(_0x22125d,_0x172e43){return client[_0xb2c3('0xa')](_0x59d3a6,_0x5d7261)[_0xb2c3('0xb')](function(_0x319445){logger[_0xb2c3('0xc')](_0xb2c3('0xd'),_0x32a661,_0xb2c3('0xe'));logger[_0xb2c3('0xf')](_0xb2c3('0x10'),_0x32a661,_0xb2c3('0xe'),JSON[_0xb2c3('0x11')](_0x319445));if(_0x319445[_0xb2c3('0x12')]){if(_0x319445[_0xb2c3('0x12')][_0xb2c3('0x13')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x32a661,_0x319445[_0xb2c3('0x12')]['message']);return _0x172e43(_0x319445[_0xb2c3('0x12')][_0xb2c3('0x14')]);}logger[_0xb2c3('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x32a661,_0x319445[_0xb2c3('0x12')]['message']);return _0x22125d(_0x319445['error'][_0xb2c3('0x14')]);}else{logger[_0xb2c3('0xc')](_0xb2c3('0xd'),_0x32a661,_0xb2c3('0xe'));_0x22125d(_0x319445[_0xb2c3('0x15')][_0xb2c3('0x14')]);}})[_0xb2c3('0x16')](function(_0x334b5f){logger[_0xb2c3('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x32a661,_0x334b5f);_0x172e43(_0x334b5f);});});}exports[_0xb2c3('0x17')]=function(_0x523cbf){var _0x14c435=this;return new Promise(function(_0x2d07a2,_0x2bf3ad){return db[_0xb2c3('0x18')]['create'](_0x523cbf[_0xb2c3('0x19')],{'raw':_0x523cbf[_0xb2c3('0x1a')]?_0x523cbf['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2815e6){logger[_0xb2c3('0xc')](_0xb2c3('0x17'),_0x523cbf);logger['debug'](_0xb2c3('0x17'),_0x523cbf,JSON['stringify'](_0x2815e6));_0x2d07a2(_0x2815e6);})['catch'](function(_0x55711c){logger[_0xb2c3('0x12')](_0xb2c3('0x17'),_0x55711c['message'],_0x523cbf);_0x2bf3ad(_0x14c435[_0xb2c3('0x12')](0x1f4,_0x55711c[_0xb2c3('0x14')]));});});};exports[_0xb2c3('0x1b')]=function(_0x4008ce){var _0x552039=this;return new Promise(function(_0x299748,_0x22d3d7){return db['WhatsappQueueReport'][_0xb2c3('0x1c')](_0x4008ce[_0xb2c3('0x19')],{'raw':_0x4008ce[_0xb2c3('0x1a')]?_0x4008ce[_0xb2c3('0x1a')][_0xb2c3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4008ce['options']?_0x4008ce[_0xb2c3('0x1a')][_0xb2c3('0x1e')]||null:null,'attributes':_0x4008ce[_0xb2c3('0x1a')]?_0x4008ce['options']['attributes']||null:null,'limit':_0x4008ce['options']?_0x4008ce[_0xb2c3('0x1a')][_0xb2c3('0x1f')]||null:null})['then'](function(_0xf452c5){logger[_0xb2c3('0xc')](_0xb2c3('0x1b'),_0x4008ce);logger['debug']('UpdateWhatsappQueueReport',_0x4008ce,JSON['stringify'](_0xf452c5));_0x299748(_0xf452c5);})[_0xb2c3('0x16')](function(_0x338386){logger[_0xb2c3('0x12')]('UpdateWhatsappQueueReport',_0x338386[_0xb2c3('0x14')],_0x4008ce);_0x22d3d7(_0x552039[_0xb2c3('0x12')](0x1f4,_0x338386[_0xb2c3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 39e20fe..022652c 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 _0x0064=['index','/describe','describe','/:id','show','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated'];(function(_0x1a2006,_0x1f3e85){var _0x141910=function(_0x1bc521){while(--_0x1bc521){_0x1a2006['push'](_0x1a2006['shift']());}};_0x141910(++_0x1f3e85);}(_0x0064,0x1d0));var _0x4006=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0064[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4006('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4006('0x1'));var express=require(_0x4006('0x2'));var router=express[_0x4006('0x3')]();var fs_extra=require(_0x4006('0x4'));var auth=require(_0x4006('0x5'));var interaction=require(_0x4006('0x6'));var config=require(_0x4006('0x7'));var controller=require(_0x4006('0x8'));router[_0x4006('0x9')]('/',auth[_0x4006('0xa')](),controller[_0x4006('0xb')]);router[_0x4006('0x9')](_0x4006('0xc'),auth[_0x4006('0xa')](),controller[_0x4006('0xd')]);router['get'](_0x4006('0xe'),auth[_0x4006('0xa')](),controller[_0x4006('0xf')]);router['post']('/',auth[_0x4006('0xa')](),controller['create']);router['put'](_0x4006('0xe'),auth['isAuthenticated'](),controller[_0x4006('0x10')]);router[_0x4006('0x11')](_0x4006('0xe'),auth[_0x4006('0xa')](),controller['destroy']);module[_0x4006('0x12')]=router; \ No newline at end of file +var _0x9f5f=['../../config/environment','./whatsappTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x246977,_0x276c7d){var _0x4ebded=function(_0x58aac1){while(--_0x58aac1){_0x246977['push'](_0x246977['shift']());}};_0x4ebded(++_0x276c7d);}(_0x9f5f,0xd7));var _0xf9f5=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x9f5f[_0x346737];return _0x1ade2e;};'use strict';var multer=require('multer');var util=require(_0xf9f5('0x0'));var path=require(_0xf9f5('0x1'));var timeout=require(_0xf9f5('0x2'));var express=require(_0xf9f5('0x3'));var router=express[_0xf9f5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf9f5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf9f5('0x6'));var controller=require(_0xf9f5('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf9f5('0x8')](_0xf9f5('0x9'),auth[_0xf9f5('0xa')](),controller['describe']);router[_0xf9f5('0x8')](_0xf9f5('0xb'),auth[_0xf9f5('0xa')](),controller[_0xf9f5('0xc')]);router[_0xf9f5('0xd')]('/',auth[_0xf9f5('0xa')](),controller[_0xf9f5('0xe')]);router['put'](_0xf9f5('0xb'),auth[_0xf9f5('0xa')](),controller['update']);router['delete']('/:id',auth[_0xf9f5('0xa')](),controller[_0xf9f5('0xf')]);module[_0xf9f5('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index f21a451..32a2cab 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 _0x087b=['queue','DATE','sequelize','exports','account'];(function(_0x11ebd4,_0x4c7bdc){var _0x93b047=function(_0x86cd91){while(--_0x86cd91){_0x11ebd4['push'](_0x11ebd4['shift']());}};_0x93b047(++_0x4c7bdc);}(_0x087b,0x11a));var _0xb087=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x087b[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb087('0x2'),'agent',_0xb087('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xb087('0x4')]}}; \ No newline at end of file +var _0x693f=['agent','queue','DATE','sequelize','exports','STRING','ENUM'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf693('0x0'));module[_0xf693('0x1')]={'uniqueid':{'type':Sequelize[_0xf693('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf693('0x3')]('account',_0xf693('0x4'),_0xf693('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf693('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 8abbf5a..6b86cb4 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 _0x272a=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','WhatsappTransferReport','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0x272a,0x132));var _0xa272=function(_0x3a7a64,_0xc59739){_0x3a7a64=_0x3a7a64-0x0;var _0x391091=_0x272a[_0x3a7a64];return _0x391091;};'use strict';var emlformat=require(_0xa272('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa272('0x1'));var jsonpatch=require(_0xa272('0x2'));var rp=require(_0xa272('0x3'));var moment=require(_0xa272('0x4'));var BPromise=require(_0xa272('0x5'));var Mustache=require(_0xa272('0x6'));var util=require(_0xa272('0x7'));var path=require(_0xa272('0x8'));var sox=require(_0xa272('0x9'));var csv=require(_0xa272('0xa'));var ejs=require(_0xa272('0xb'));var fs=require('fs');var fs_extra=require(_0xa272('0xc'));var _=require(_0xa272('0xd'));var squel=require(_0xa272('0xe'));var crypto=require('crypto');var jsforce=require(_0xa272('0xf'));var deskjs=require(_0xa272('0x10'));var toCsv=require(_0xa272('0xa'));var querystring=require('querystring');var Papa=require(_0xa272('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa272('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa272('0x13'));var logger=require(_0xa272('0x14'))(_0xa272('0x15'));var utils=require(_0xa272('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa272('0x17'));var db=require(_0xa272('0x18'))['db'];function respondWithStatusCode(_0x434b34,_0x44f92e){_0x44f92e=_0x44f92e||0xcc;return function(_0x461210){if(_0x461210){return _0x434b34['sendStatus'](_0x44f92e);}return _0x434b34[_0xa272('0x19')](_0x44f92e)[_0xa272('0x1a')]();};}function respondWithResult(_0x5d5ee6,_0x5ef847){_0x5ef847=_0x5ef847||0xc8;return function(_0x131bba){if(_0x131bba){return _0x5d5ee6[_0xa272('0x19')](_0x5ef847)['json'](_0x131bba);}};}function respondWithFilteredResult(_0x38da0d,_0x571c96){return function(_0x658261){if(_0x658261){var _0x4ddee6=typeof _0x571c96[_0xa272('0x1b')]===_0xa272('0x1c')&&typeof _0x571c96[_0xa272('0x1d')]===_0xa272('0x1c');var _0x34171e=_0x658261[_0xa272('0x1e')];var _0x8406a3=_0x4ddee6?0x0:_0x571c96[_0xa272('0x1b')];var _0x4cc65d=_0x4ddee6?_0x658261['count']:_0x571c96[_0xa272('0x1b')]+_0x571c96[_0xa272('0x1d')];var _0x4bd420;if(_0x4cc65d>=_0x34171e){_0x4cc65d=_0x34171e;_0x4bd420=0xc8;}else{_0x4bd420=0xce;}_0x38da0d[_0xa272('0x19')](_0x4bd420);return _0x38da0d[_0xa272('0x1f')](_0xa272('0x20'),_0x8406a3+'-'+_0x4cc65d+'/'+_0x34171e)['json'](_0x658261);}return null;};}function patchUpdates(_0x1cccff){return function(_0x19760b){try{jsonpatch[_0xa272('0x21')](_0x19760b,_0x1cccff,!![]);}catch(_0x13eeb7){return BPromise['reject'](_0x13eeb7);}return _0x19760b[_0xa272('0x22')]();};}function saveUpdates(_0x5e67a9,_0x578cb9){return function(_0x489d94){if(_0x489d94){return _0x489d94[_0xa272('0x23')](_0x5e67a9)[_0xa272('0x24')](function(_0xe7b1a5){return _0xe7b1a5;});}return null;};}function removeEntity(_0x173b1c,_0x59ee62){return function(_0x209b8d){if(_0x209b8d){return _0x209b8d[_0xa272('0x25')]()[_0xa272('0x24')](function(){_0x173b1c[_0xa272('0x19')](0xcc)[_0xa272('0x1a')]();});}};}function handleEntityNotFound(_0x3908c2,_0x1992d4){return function(_0x3bd59a){if(!_0x3bd59a){_0x3908c2[_0xa272('0x26')](0x194);}return _0x3bd59a;};}function handleError(_0x58569e,_0x440c59){_0x440c59=_0x440c59||0x1f4;return function(_0x24004b){logger[_0xa272('0x27')](_0x24004b[_0xa272('0x28')]);if(_0x24004b[_0xa272('0x29')]){delete _0x24004b[_0xa272('0x29')];}_0x58569e[_0xa272('0x19')](_0x440c59)[_0xa272('0x2a')](_0x24004b);};}exports[_0xa272('0x2b')]=function(_0x2e8c84,_0x54f19f){var _0x539639={},_0x11daeb={},_0x156125={'count':0x0,'rows':[]};var _0x2485fd=_['map'](db['WhatsappTransferReport']['rawAttributes'],function(_0x37d43b){return{'name':_0x37d43b[_0xa272('0x2c')],'type':_0x37d43b[_0xa272('0x2d')]['key']};});_0x11daeb[_0xa272('0x2e')]=_['map'](_0x2485fd,_0xa272('0x29'));_0x11daeb['query']=_[_0xa272('0x2f')](_0x2e8c84['query']);_0x11daeb[_0xa272('0x30')]=_[_0xa272('0x31')](_0x11daeb[_0xa272('0x2e')],_0x11daeb[_0xa272('0x32')]);_0x539639[_0xa272('0x33')]=_[_0xa272('0x31')](_0x11daeb['model'],qs[_0xa272('0x34')](_0x2e8c84[_0xa272('0x32')][_0xa272('0x34')]));_0x539639[_0xa272('0x33')]=_0x539639[_0xa272('0x33')][_0xa272('0x35')]?_0x539639[_0xa272('0x33')]:_0x11daeb['model'];if(!_0x2e8c84[_0xa272('0x32')][_0xa272('0x36')](_0xa272('0x37'))){_0x539639['limit']=qs[_0xa272('0x1d')](_0x2e8c84[_0xa272('0x32')]['limit']);_0x539639[_0xa272('0x1b')]=qs[_0xa272('0x1b')](_0x2e8c84['query'][_0xa272('0x1b')]);}_0x539639[_0xa272('0x38')]=qs['sort'](_0x2e8c84[_0xa272('0x32')][_0xa272('0x39')]);_0x539639[_0xa272('0x3a')]=qs[_0xa272('0x30')](_[_0xa272('0x3b')](_0x2e8c84[_0xa272('0x32')],_0x11daeb[_0xa272('0x30')]),_0x2485fd);if(_0x2e8c84[_0xa272('0x32')]['filter']){_0x539639[_0xa272('0x3a')]=_[_0xa272('0x3c')](_0x539639[_0xa272('0x3a')],{'$or':_[_0xa272('0x3d')](_0x2485fd,function(_0x1bc070){if(_0x1bc070[_0xa272('0x2d')]!=='VIRTUAL'){var _0x3d1b72={};_0x3d1b72[_0x1bc070[_0xa272('0x29')]]={'$like':'%'+_0x2e8c84[_0xa272('0x32')][_0xa272('0x3e')]+'%'};return _0x3d1b72;}})});}_0x539639=_[_0xa272('0x3c')]({},_0x539639,_0x2e8c84[_0xa272('0x3f')]);var _0x297625={'where':_0x539639['where']};return db[_0xa272('0x40')][_0xa272('0x1e')](_0x297625)[_0xa272('0x24')](function(_0x4bfab4){_0x156125[_0xa272('0x1e')]=_0x4bfab4;if(_0x2e8c84[_0xa272('0x32')]['includeAll']){_0x539639[_0xa272('0x41')]=[{'all':!![]}];}return db[_0xa272('0x40')][_0xa272('0x42')](_0x539639);})[_0xa272('0x24')](function(_0x40865d){_0x156125[_0xa272('0x43')]=_0x40865d;return _0x156125;})['then'](respondWithFilteredResult(_0x54f19f,_0x539639))[_0xa272('0x44')](handleError(_0x54f19f,null));};exports[_0xa272('0x45')]=function(_0x3a8320,_0x2570fe){var _0x203071={'raw':!![],'where':{'id':_0x3a8320[_0xa272('0x46')]['id']}},_0x59f073={};_0x59f073[_0xa272('0x2e')]=_[_0xa272('0x2f')](db[_0xa272('0x40')][_0xa272('0x47')]);_0x59f073[_0xa272('0x32')]=_[_0xa272('0x2f')](_0x3a8320['query']);_0x59f073['filters']=_[_0xa272('0x31')](_0x59f073[_0xa272('0x2e')],_0x59f073[_0xa272('0x32')]);_0x203071[_0xa272('0x33')]=_[_0xa272('0x31')](_0x59f073[_0xa272('0x2e')],qs['fields'](_0x3a8320[_0xa272('0x32')]['fields']));_0x203071['attributes']=_0x203071[_0xa272('0x33')]['length']?_0x203071[_0xa272('0x33')]:_0x59f073[_0xa272('0x2e')];if(_0x3a8320[_0xa272('0x32')][_0xa272('0x48')]){_0x203071['include']=[{'all':!![]}];}_0x203071=_['merge']({},_0x203071,_0x3a8320['options']);return db[_0xa272('0x40')][_0xa272('0x49')](_0x203071)[_0xa272('0x24')](handleEntityNotFound(_0x2570fe,null))[_0xa272('0x24')](respondWithResult(_0x2570fe,null))[_0xa272('0x44')](handleError(_0x2570fe,null));};exports[_0xa272('0x4a')]=function(_0x36fff9,_0xa3689a){return db[_0xa272('0x40')]['create'](_0x36fff9[_0xa272('0x4b')],{})[_0xa272('0x24')](respondWithResult(_0xa3689a,0xc9))[_0xa272('0x44')](handleError(_0xa3689a,null));};exports[_0xa272('0x23')]=function(_0x383f6e,_0x56d917){if(_0x383f6e[_0xa272('0x4b')]['id']){delete _0x383f6e[_0xa272('0x4b')]['id'];}return db[_0xa272('0x40')][_0xa272('0x49')]({'where':{'id':_0x383f6e[_0xa272('0x46')]['id']}})[_0xa272('0x24')](handleEntityNotFound(_0x56d917,null))[_0xa272('0x24')](saveUpdates(_0x383f6e[_0xa272('0x4b')],null))[_0xa272('0x24')](respondWithResult(_0x56d917,null))['catch'](handleError(_0x56d917,null));};exports['destroy']=function(_0x48fbc7,_0x2534f7){return db[_0xa272('0x40')][_0xa272('0x49')]({'where':{'id':_0x48fbc7['params']['id']}})[_0xa272('0x24')](handleEntityNotFound(_0x2534f7,null))[_0xa272('0x24')](removeEntity(_0x2534f7,null))[_0xa272('0x44')](handleError(_0x2534f7,null));};exports[_0xa272('0x4c')]=function(_0x33dc58,_0x5b9976){return db['WhatsappTransferReport'][_0xa272('0x4c')]()['then'](respondWithResult(_0x5b9976,null))[_0xa272('0x44')](handleError(_0x5b9976,null));}; \ No newline at end of file +var _0x40e8=['keys','filters','intersection','model','attributes','fields','length','nolimit','order','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','query'];(function(_0x36fc7b,_0x1a4c4b){var _0x20b70f=function(_0x8b9e2a){while(--_0x8b9e2a){_0x36fc7b['push'](_0x36fc7b['shift']());}};_0x20b70f(++_0x1a4c4b);}(_0x40e8,0x1d5));var _0x840e=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0x40e8[_0x4536a4];return _0x4fd1c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x840e('0x0'));var zipdir=require(_0x840e('0x1'));var jsonpatch=require(_0x840e('0x2'));var rp=require('request-promise');var moment=require(_0x840e('0x3'));var BPromise=require(_0x840e('0x4'));var Mustache=require(_0x840e('0x5'));var util=require(_0x840e('0x6'));var path=require(_0x840e('0x7'));var sox=require('sox');var csv=require(_0x840e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x840e('0x9'));var _=require(_0x840e('0xa'));var squel=require(_0x840e('0xb'));var crypto=require(_0x840e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x840e('0xd'));var toCsv=require(_0x840e('0x8'));var querystring=require('querystring');var Papa=require(_0x840e('0xe'));var Redis=require(_0x840e('0xf'));var authService=require(_0x840e('0x10'));var qs=require(_0x840e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x840e('0x12'));var logger=require(_0x840e('0x13'))(_0x840e('0x14'));var utils=require(_0x840e('0x15'));var config=require(_0x840e('0x16'));var licenseUtil=require(_0x840e('0x17'));var db=require(_0x840e('0x18'))['db'];function respondWithStatusCode(_0x4990a2,_0x5060d8){_0x5060d8=_0x5060d8||0xcc;return function(_0x37599e){if(_0x37599e){return _0x4990a2[_0x840e('0x19')](_0x5060d8);}return _0x4990a2['status'](_0x5060d8)[_0x840e('0x1a')]();};}function respondWithResult(_0x35b95c,_0x11348b){_0x11348b=_0x11348b||0xc8;return function(_0x5e1769){if(_0x5e1769){return _0x35b95c['status'](_0x11348b)[_0x840e('0x1b')](_0x5e1769);}};}function respondWithFilteredResult(_0x5dac74,_0x40b980){return function(_0x1cab67){if(_0x1cab67){var _0x1cd735=typeof _0x40b980[_0x840e('0x1c')]===_0x840e('0x1d')&&typeof _0x40b980[_0x840e('0x1e')]===_0x840e('0x1d');var _0x4b7616=_0x1cab67[_0x840e('0x1f')];var _0x322813=_0x1cd735?0x0:_0x40b980[_0x840e('0x1c')];var _0x3e3429=_0x1cd735?_0x1cab67[_0x840e('0x1f')]:_0x40b980[_0x840e('0x1c')]+_0x40b980[_0x840e('0x1e')];var _0x3c4ffa;if(_0x3e3429>=_0x4b7616){_0x3e3429=_0x4b7616;_0x3c4ffa=0xc8;}else{_0x3c4ffa=0xce;}_0x5dac74[_0x840e('0x20')](_0x3c4ffa);return _0x5dac74['set'](_0x840e('0x21'),_0x322813+'-'+_0x3e3429+'/'+_0x4b7616)[_0x840e('0x1b')](_0x1cab67);}return null;};}function patchUpdates(_0x3ef1e8){return function(_0x18f08a){try{jsonpatch['apply'](_0x18f08a,_0x3ef1e8,!![]);}catch(_0x3a9381){return BPromise[_0x840e('0x22')](_0x3a9381);}return _0x18f08a[_0x840e('0x23')]();};}function saveUpdates(_0x1a18e4,_0x4ddb71){return function(_0x844547){if(_0x844547){return _0x844547[_0x840e('0x24')](_0x1a18e4)[_0x840e('0x25')](function(_0x2f81bc){return _0x2f81bc;});}return null;};}function removeEntity(_0x17ff2f,_0x4c8875){return function(_0x5a79c6){if(_0x5a79c6){return _0x5a79c6[_0x840e('0x26')]()[_0x840e('0x25')](function(){_0x17ff2f[_0x840e('0x20')](0xcc)[_0x840e('0x1a')]();});}};}function handleEntityNotFound(_0x35500b,_0x64644a){return function(_0x3eb0b1){if(!_0x3eb0b1){_0x35500b[_0x840e('0x19')](0x194);}return _0x3eb0b1;};}function handleError(_0x4efd91,_0x49c29b){_0x49c29b=_0x49c29b||0x1f4;return function(_0x2eb394){logger[_0x840e('0x27')](_0x2eb394['stack']);if(_0x2eb394[_0x840e('0x28')]){delete _0x2eb394[_0x840e('0x28')];}_0x4efd91[_0x840e('0x20')](_0x49c29b)[_0x840e('0x29')](_0x2eb394);};}exports[_0x840e('0x2a')]=function(_0x3597e3,_0xb54044){var _0x16d919={},_0x37677b={},_0x3f4122={'count':0x0,'rows':[]};var _0x1f4b82=_[_0x840e('0x2b')](db[_0x840e('0x2c')][_0x840e('0x2d')],function(_0x1fba54){return{'name':_0x1fba54[_0x840e('0x2e')],'type':_0x1fba54[_0x840e('0x2f')]['key']};});_0x37677b['model']=_[_0x840e('0x2b')](_0x1f4b82,_0x840e('0x28'));_0x37677b[_0x840e('0x30')]=_[_0x840e('0x31')](_0x3597e3['query']);_0x37677b[_0x840e('0x32')]=_[_0x840e('0x33')](_0x37677b[_0x840e('0x34')],_0x37677b[_0x840e('0x30')]);_0x16d919[_0x840e('0x35')]=_['intersection'](_0x37677b[_0x840e('0x34')],qs[_0x840e('0x36')](_0x3597e3[_0x840e('0x30')][_0x840e('0x36')]));_0x16d919[_0x840e('0x35')]=_0x16d919[_0x840e('0x35')][_0x840e('0x37')]?_0x16d919['attributes']:_0x37677b['model'];if(!_0x3597e3['query']['hasOwnProperty'](_0x840e('0x38'))){_0x16d919[_0x840e('0x1e')]=qs['limit'](_0x3597e3[_0x840e('0x30')][_0x840e('0x1e')]);_0x16d919[_0x840e('0x1c')]=qs['offset'](_0x3597e3[_0x840e('0x30')][_0x840e('0x1c')]);}_0x16d919[_0x840e('0x39')]=qs['sort'](_0x3597e3[_0x840e('0x30')]['sort']);_0x16d919[_0x840e('0x3a')]=qs[_0x840e('0x32')](_['pick'](_0x3597e3['query'],_0x37677b[_0x840e('0x32')]),_0x1f4b82);if(_0x3597e3[_0x840e('0x30')][_0x840e('0x3b')]){_0x16d919[_0x840e('0x3a')]=_['merge'](_0x16d919['where'],{'$or':_['map'](_0x1f4b82,function(_0x3e0d45){if(_0x3e0d45[_0x840e('0x2f')]!==_0x840e('0x3c')){var _0x268e00={};_0x268e00[_0x3e0d45['name']]={'$like':'%'+_0x3597e3[_0x840e('0x30')][_0x840e('0x3b')]+'%'};return _0x268e00;}})});}_0x16d919=_[_0x840e('0x3d')]({},_0x16d919,_0x3597e3[_0x840e('0x3e')]);var _0x609f2e={'where':_0x16d919[_0x840e('0x3a')]};return db['WhatsappTransferReport'][_0x840e('0x1f')](_0x609f2e)[_0x840e('0x25')](function(_0x31604f){_0x3f4122['count']=_0x31604f;if(_0x3597e3['query'][_0x840e('0x3f')]){_0x16d919[_0x840e('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x840e('0x41')](_0x16d919);})[_0x840e('0x25')](function(_0x3ce966){_0x3f4122[_0x840e('0x42')]=_0x3ce966;return _0x3f4122;})[_0x840e('0x25')](respondWithFilteredResult(_0xb54044,_0x16d919))[_0x840e('0x43')](handleError(_0xb54044,null));};exports[_0x840e('0x44')]=function(_0xa7b7db,_0x293d90){var _0x18aa4f={'raw':!![],'where':{'id':_0xa7b7db['params']['id']}},_0xf0e793={};_0xf0e793[_0x840e('0x34')]=_[_0x840e('0x31')](db[_0x840e('0x2c')][_0x840e('0x2d')]);_0xf0e793[_0x840e('0x30')]=_[_0x840e('0x31')](_0xa7b7db[_0x840e('0x30')]);_0xf0e793[_0x840e('0x32')]=_['intersection'](_0xf0e793[_0x840e('0x34')],_0xf0e793[_0x840e('0x30')]);_0x18aa4f[_0x840e('0x35')]=_[_0x840e('0x33')](_0xf0e793[_0x840e('0x34')],qs[_0x840e('0x36')](_0xa7b7db[_0x840e('0x30')][_0x840e('0x36')]));_0x18aa4f[_0x840e('0x35')]=_0x18aa4f[_0x840e('0x35')]['length']?_0x18aa4f['attributes']:_0xf0e793['model'];if(_0xa7b7db[_0x840e('0x30')][_0x840e('0x3f')]){_0x18aa4f[_0x840e('0x40')]=[{'all':!![]}];}_0x18aa4f=_[_0x840e('0x3d')]({},_0x18aa4f,_0xa7b7db['options']);return db['WhatsappTransferReport'][_0x840e('0x45')](_0x18aa4f)[_0x840e('0x25')](handleEntityNotFound(_0x293d90,null))[_0x840e('0x25')](respondWithResult(_0x293d90,null))[_0x840e('0x43')](handleError(_0x293d90,null));};exports[_0x840e('0x46')]=function(_0x1695cf,_0x1a923f){return db[_0x840e('0x2c')][_0x840e('0x46')](_0x1695cf[_0x840e('0x47')],{})[_0x840e('0x25')](respondWithResult(_0x1a923f,0xc9))[_0x840e('0x43')](handleError(_0x1a923f,null));};exports['update']=function(_0x1824c0,_0x345c44){if(_0x1824c0[_0x840e('0x47')]['id']){delete _0x1824c0[_0x840e('0x47')]['id'];}return db[_0x840e('0x2c')][_0x840e('0x45')]({'where':{'id':_0x1824c0[_0x840e('0x48')]['id']}})[_0x840e('0x25')](handleEntityNotFound(_0x345c44,null))[_0x840e('0x25')](saveUpdates(_0x1824c0[_0x840e('0x47')],null))[_0x840e('0x25')](respondWithResult(_0x345c44,null))[_0x840e('0x43')](handleError(_0x345c44,null));};exports[_0x840e('0x26')]=function(_0x508ba1,_0x5011ed){return db[_0x840e('0x2c')][_0x840e('0x45')]({'where':{'id':_0x508ba1['params']['id']}})[_0x840e('0x25')](handleEntityNotFound(_0x5011ed,null))[_0x840e('0x25')](removeEntity(_0x5011ed,null))[_0x840e('0x43')](handleError(_0x5011ed,null));};exports[_0x840e('0x49')]=function(_0x3ba727,_0x545a1a){return db['WhatsappTransferReport'][_0x840e('0x49')]()[_0x840e('0x25')](respondWithResult(_0x545a1a,null))['catch'](handleError(_0x545a1a,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 75a2326..6ef6229 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 _0xccd2=['api','moment','bluebird','request-promise','path','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x5b912f,_0x3c7e3b){var _0x194f10=function(_0x31360b){while(--_0x31360b){_0x5b912f['push'](_0x5b912f['shift']());}};_0x194f10(++_0x3c7e3b);}(_0xccd2,0x11d));var _0x2ccd=function(_0x1ebeca,_0x35adf2){_0x1ebeca=_0x1ebeca-0x0;var _0x4ee0d3=_0xccd2[_0x1ebeca];return _0x4ee0d3;};'use strict';var _=require(_0x2ccd('0x0'));var util=require(_0x2ccd('0x1'));var logger=require(_0x2ccd('0x2'))(_0x2ccd('0x3'));var moment=require(_0x2ccd('0x4'));var BPromise=require(_0x2ccd('0x5'));var rp=require(_0x2ccd('0x6'));var fs=require('fs');var path=require(_0x2ccd('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2ccd('0x8'));module[_0x2ccd('0x9')]=function(_0x3da4f8,_0x537064){return _0x3da4f8['define'](_0x2ccd('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x2ccd('0xb'),'fields':[_0x2ccd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f3e=['exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x2f3e,0xae));var _0xe2f3=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x2f3e[_0x386c3e];return _0x4b8e13;};'use strict';var _=require(_0xe2f3('0x0'));var util=require(_0xe2f3('0x1'));var logger=require('../../config/logger')(_0xe2f3('0x2'));var moment=require(_0xe2f3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2f3('0x4'));var rimraf=require(_0xe2f3('0x5'));var config=require(_0xe2f3('0x6'));var attributes=require(_0xe2f3('0x7'));module[_0xe2f3('0x8')]=function(_0xc26186,_0x3e4799){return _0xc26186[_0xe2f3('0x9')](_0xe2f3('0xa'),attributes,{'tableName':_0xe2f3('0xb'),'paranoid':![],'indexes':[{'name':_0xe2f3('0xc'),'fields':[_0xe2f3('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 6b95834..d33dacc 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 _0xa940=['debug','stringify','error','code','message','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x105cbe,_0x35df5c){var _0x2aa23e=function(_0x136846){while(--_0x136846){_0x105cbe['push'](_0x105cbe['shift']());}};_0x2aa23e(++_0x35df5c);}(_0xa940,0x1bf));var _0x0a94=function(_0x8bac47,_0x927226){_0x8bac47=_0x8bac47-0x0;var _0x5811ec=_0xa940[_0x8bac47];return _0x5811ec;};'use strict';var _=require(_0x0a94('0x0'));var util=require(_0x0a94('0x1'));var moment=require(_0x0a94('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a94('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a94('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a94('0x5'))('rpc');var config=require(_0x0a94('0x6'));var jayson=require(_0x0a94('0x7'));var client=jayson['client'][_0x0a94('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11b701,_0x526362,_0x5baf39){return new BPromise(function(_0xce79d4,_0x5e7432){return client['request'](_0x11b701,_0x5baf39)['then'](function(_0x18f3ff){logger[_0x0a94('0x9')](_0x0a94('0xa'),_0x526362,_0x0a94('0xb'));logger[_0x0a94('0xc')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x526362,_0x0a94('0xb'),JSON[_0x0a94('0xd')](_0x18f3ff));if(_0x18f3ff[_0x0a94('0xe')]){if(_0x18f3ff[_0x0a94('0xe')][_0x0a94('0xf')]===0x1f4){logger[_0x0a94('0xe')](_0x0a94('0xa'),_0x526362,_0x18f3ff[_0x0a94('0xe')][_0x0a94('0x10')]);return _0x5e7432(_0x18f3ff[_0x0a94('0xe')]['message']);}logger['error'](_0x0a94('0xa'),_0x526362,_0x18f3ff[_0x0a94('0xe')][_0x0a94('0x10')]);return _0xce79d4(_0x18f3ff[_0x0a94('0xe')]['message']);}else{logger['info'](_0x0a94('0xa'),_0x526362,_0x0a94('0xb'));_0xce79d4(_0x18f3ff['result'][_0x0a94('0x10')]);}})['catch'](function(_0x2f7250){logger['error'](_0x0a94('0xa'),_0x526362,_0x2f7250);_0x5e7432(_0x2f7250);});});} \ No newline at end of file +var _0x64f1=['../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','randomstring','ioredis','../../config/utils','rpc'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x64f1,0xeb));var _0x164f=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x64f1[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x164f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x164f('0x1'));var fs=require('fs');var Redis=require(_0x164f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x164f('0x3'));var logger=require('../../config/logger')(_0x164f('0x4'));var config=require(_0x164f('0x5'));var jayson=require(_0x164f('0x6'));var client=jayson[_0x164f('0x7')][_0x164f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3617ac,_0x5584c2,_0x5e28e9){return new BPromise(function(_0x3738b2,_0x27cc08){return client[_0x164f('0x9')](_0x3617ac,_0x5e28e9)[_0x164f('0xa')](function(_0x1d3231){logger['info'](_0x164f('0xb'),_0x5584c2,_0x164f('0xc'));logger[_0x164f('0xd')](_0x164f('0xe'),_0x5584c2,'request\x20sent',JSON[_0x164f('0xf')](_0x1d3231));if(_0x1d3231[_0x164f('0x10')]){if(_0x1d3231['error']['code']===0x1f4){logger[_0x164f('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5584c2,_0x1d3231[_0x164f('0x10')][_0x164f('0x11')]);return _0x27cc08(_0x1d3231[_0x164f('0x10')][_0x164f('0x11')]);}logger[_0x164f('0x10')](_0x164f('0xb'),_0x5584c2,_0x1d3231[_0x164f('0x10')][_0x164f('0x11')]);return _0x3738b2(_0x1d3231[_0x164f('0x10')][_0x164f('0x11')]);}else{logger['info'](_0x164f('0xb'),_0x5584c2,_0x164f('0xc'));_0x3738b2(_0x1d3231[_0x164f('0x12')][_0x164f('0x11')]);}})[_0x164f('0x13')](function(_0x5861b9){logger[_0x164f('0x10')](_0x164f('0xb'),_0x5584c2,_0x5861b9);_0x27cc08(_0x5861b9);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 17b9fe7..6bbcecb 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b8f=['online','join','status','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/license','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','default','then','listen','info','start','filter','exitCode','number','length','name'];(function(_0x3b0193,_0x45f8b8){var _0x443614=function(_0x16f6fc){while(--_0x16f6fc){_0x3b0193['push'](_0x3b0193['shift']());}};_0x443614(++_0x45f8b8);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x5da50e,_0x472562){_0x5da50e=_0x5da50e-0x0;var _0xd52dc2=_0x6b8f[_0x5da50e];return _0xd52dc2;};'use strict';var _=require('lodash');var db=require(_0xf6b8('0x0'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xf6b8('0x1'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0xf6b8('0x2'))(_0xf6b8('0x3'));var pm2=require('./config/pm2');var pm2Config=require(_0xf6b8('0x4'));var schedule=require(_0xf6b8('0x5'));var chat=require(_0xf6b8('0x6'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xf6b8('0x7'));var provider=require(_0xf6b8('0x8'));function main(){return db[_0xf6b8('0x9')][_0xf6b8('0xa')]()['then'](function(){if(config['seedDB']){return seedDb[_0xf6b8('0xb')]();}})['then'](function(){return checkLicense[_0xf6b8('0xb')]();})[_0xf6b8('0xc')](function(){return rpc[_0xf6b8('0xd')]();})[_0xf6b8('0xc')](function(_0x21734d){logger[_0xf6b8('0xe')](_0x21734d);return chat['start']();})['then'](function(){return whatsapp['start']();})[_0xf6b8('0xc')](function(){return schedule[_0xf6b8('0xf')]();})[_0xf6b8('0xc')](function(){return transcribe[_0xf6b8('0xf')]();})['then'](function(){return provider['start']();})[_0xf6b8('0xc')](function(_0x3899a9){logger['info'](_0x3899a9);return pm2[_0xf6b8('0xf')](pm2Config);})[_0xf6b8('0xc')](function(_0x454d8a){var _0x59bfed=_0x454d8a[_0xf6b8('0x10')](function(_0x53d744){return typeof _0x53d744[_0xf6b8('0x11')]===_0xf6b8('0x12')&&_0x53d744[_0xf6b8('0x11')]>=0x0;});if(_0x59bfed[_0xf6b8('0x13')]>0x0){throw new Error(_0x59bfed[_0xf6b8('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x59bfed,function(_0x3bb9ae){return'\x22'+_0x3bb9ae['pm2_env'][_0xf6b8('0x14')]+'\x22';}));}logger[_0xf6b8('0xe')]('Online\x20apps:',_['map'](_[_0xf6b8('0x10')](_0x454d8a,{'status':_0xf6b8('0x15')}),_0xf6b8('0x14'))[_0xf6b8('0x16')]());logger['info']('Offline\x20apps:',_['map'](_[_0xf6b8('0x10')](_0x454d8a,function(_0x2a8195){return _0x2a8195[_0xf6b8('0x17')]!=='online';}),_0xf6b8('0x14'))[_0xf6b8('0x16')]()||_0xf6b8('0x18'));console[_0xf6b8('0x19')]('App\x20Ready!');})[_0xf6b8('0x1a')](function(_0x5c92ed){console[_0xf6b8('0x19')](_0xf6b8('0x1b'),_0x5c92ed);logger[_0xf6b8('0x1c')](_0xf6b8('0x1d'),_0x5c92ed);process[_0xf6b8('0x1e')](0x1);});}main(); \ No newline at end of file +var _0x444e=['exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','Offline\x20apps:','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','lodash','./config/seedDB','./rpc','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','default','start','info','filter'];(function(_0x51e79c,_0x51485e){var _0x2467be=function(_0xbf70f0){while(--_0xbf70f0){_0x51e79c['push'](_0x51e79c['shift']());}};_0x2467be(++_0x51485e);}(_0x444e,0xe8));var _0xe444=function(_0x4d4d56,_0xd44298){_0x4d4d56=_0x4d4d56-0x0;var _0x93cb29=_0x444e[_0x4d4d56];return _0x93cb29;};'use strict';var _=require(_0xe444('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xe444('0x1'));var checkLicense=require('./config/license');var rpc=require(_0xe444('0x2'));var config=require('./config/environment');var logger=require(_0xe444('0x3'))('app');var pm2=require(_0xe444('0x4'));var pm2Config=require(_0xe444('0x5'));var schedule=require(_0xe444('0x6'));var chat=require(_0xe444('0x7'));var whatsapp=require(_0xe444('0x8'));var transcribe=require(_0xe444('0x9'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xe444('0xa')]['sync']()[_0xe444('0xb')](function(){if(config['seedDB']){return seedDb[_0xe444('0xc')]();}})[_0xe444('0xb')](function(){return checkLicense[_0xe444('0xc')]();})['then'](function(){return rpc['listen']();})[_0xe444('0xb')](function(_0x1f41ff){logger['info'](_0x1f41ff);return chat[_0xe444('0xd')]();})['then'](function(){return whatsapp['start']();})[_0xe444('0xb')](function(){return schedule['start']();})[_0xe444('0xb')](function(){return transcribe[_0xe444('0xd')]();})['then'](function(){return provider[_0xe444('0xd')]();})['then'](function(_0x5ba044){logger[_0xe444('0xe')](_0x5ba044);return pm2[_0xe444('0xd')](pm2Config);})['then'](function(_0x192c1a){var _0x5d739a=_0x192c1a[_0xe444('0xf')](function(_0x3acd97){return typeof _0x3acd97[_0xe444('0x10')]===_0xe444('0x11')&&_0x3acd97[_0xe444('0x10')]>=0x0;});if(_0x5d739a[_0xe444('0x12')]>0x0){throw new Error(_0x5d739a[_0xe444('0x12')]+_0xe444('0x13')+_[_0xe444('0x14')](_0x5d739a,function(_0x4009c7){return'\x22'+_0x4009c7[_0xe444('0x15')][_0xe444('0x16')]+'\x22';}));}logger[_0xe444('0xe')]('Online\x20apps:',_[_0xe444('0x14')](_[_0xe444('0xf')](_0x192c1a,{'status':_0xe444('0x17')}),_0xe444('0x16'))['join']());logger[_0xe444('0xe')](_0xe444('0x18'),_[_0xe444('0x14')](_[_0xe444('0xf')](_0x192c1a,function(_0x37c15e){return _0x37c15e['status']!==_0xe444('0x17');}),_0xe444('0x16'))['join']()||_0xe444('0x19'));console['log'](_0xe444('0x1a'));})[_0xe444('0x1b')](function(_0x3d36c7){console[_0xe444('0x1c')](_0xe444('0x1d'),_0x3d36c7);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x3d36c7);process[_0xe444('0x1e')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index e255218..0de9354 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 _0xefda=['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.','decryptString','splice','unshift','encryptString','join','promisify','sign','secret','payload','verify','toString','floor','now','../../mysqldb','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','name','internal','email','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','use','user','findOne','params','closed','then','status','disposition','json','unmanaged','Unmanaged.','catch','headers','authorization','find','authenticate','pass','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','isWebrtcLicence','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','split','toLowerCase','format'];(function(_0x35906a,_0x9e0b54){var _0x43ba69=function(_0x3272b3){while(--_0x3272b3){_0x35906a['push'](_0x35906a['shift']());}};_0x43ba69(++_0x9e0b54);}(_0xefda,0x96));var _0xaefd=function(_0x44723b,_0x59c5f5){_0x44723b=_0x44723b-0x0;var _0x1588b2=_0xefda[_0x44723b];return _0x1588b2;};'use strict';var db=require(_0xaefd('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xaefd('0x1'));var encryptor=require(_0xaefd('0x2'));var _=require('lodash');var jwt=require(_0xaefd('0x3'));var expressJwt=require(_0xaefd('0x4'));var compose=require(_0xaefd('0x5'));var basicAuth=require(_0xaefd('0x6'));var crypto=require(_0xaefd('0x7'));var BPromise=require(_0xaefd('0x8'));var util=require('util');var moment=require(_0xaefd('0x9'));var validateJwt=expressJwt({'secret':config[_0xaefd('0xa')][_0xaefd('0xb')]});var userAttributes=['id',_0xaefd('0xc'),'fullname',_0xaefd('0xd'),_0xaefd('0xe'),_0xaefd('0xf'),'userpic','permissions','md5secret',_0xaefd('0x10'),_0xaefd('0x11'),_0xaefd('0x12'),_0xaefd('0x13'),_0xaefd('0x14'),_0xaefd('0x15'),_0xaefd('0x16'),_0xaefd('0x17'),_0xaefd('0x18'),_0xaefd('0x19'),_0xaefd('0x1a'),'allowmessenger',_0xaefd('0x1b'),'alias',_0xaefd('0x1c'),_0xaefd('0x1d'),_0xaefd('0x1e'),_0xaefd('0x1f'),'phoneBarEnableDtmfTone',_0xaefd('0x20'),_0xaefd('0x21'),_0xaefd('0x22'),_0xaefd('0x23'),_0xaefd('0x24'),_0xaefd('0x25'),_0xaefd('0x26'),_0xaefd('0x27'),'privacyEnabled',_0xaefd('0x28'),_0xaefd('0x29'),_0xaefd('0x2a'),_0xaefd('0x2b'),_0xaefd('0x2c'),_0xaefd('0x2d'),'selectRecallMeCampaign',_0xaefd('0x2e'),_0xaefd('0x2f'),_0xaefd('0x30'),_0xaefd('0x31'),_0xaefd('0x32'),_0xaefd('0x33'),'openchannelAutoanswer',_0xaefd('0x34'),_0xaefd('0x35'),_0xaefd('0x36'),_0xaefd('0x37'),_0xaefd('0x38'),'messengerSoundNotification'];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0xaefd('0x39')](function(_0xf62e43,_0x313a6f,_0x5a44ed){if(_0xf62e43[_0xaefd('0x3a')]){_0x5a44ed();}else{return db['ChatInteraction'][_0xaefd('0x3b')]({'where':{'id':_0xf62e43[_0xaefd('0x3c')]['id']},'attributes':['id',_0xaefd('0x3d'),'disposition'],'raw':!![]})[_0xaefd('0x3e')](function(_0x3ffc9c){if(_0x3ffc9c&&_0x3ffc9c[_0xaefd('0x3d')]){return _0x313a6f[_0xaefd('0x3f')](_0x3ffc9c[_0xaefd('0x40')]==='unmanaged'?0x195:0x193)[_0xaefd('0x41')]({'message':_0x3ffc9c['disposition']===_0xaefd('0x42')?_0xaefd('0x43'):'Forbidden.'});}else{_0x5a44ed();}})[_0xaefd('0x44')](function(_0x2a8fa8){_0x5a44ed(_0x2a8fa8);});}});};exports['isAuthenticated']=function isAuthenticated(_0xbeb1b8){return compose()[_0xaefd('0x39')](function(_0x36b6b7,_0x4c0898,_0x45f0e8){var _0x5c573b;if(_0x36b6b7[_0xaefd('0x45')]['authorization']){if(_['startsWith'](_0x36b6b7[_0xaefd('0x45')][_0xaefd('0x46')],'Basic')){var _0x578378=basicAuth(_0x36b6b7);db['User'][_0xaefd('0x47')]({'where':{'name':_0x578378[_0xaefd('0xd')]}})['then'](function(_0x5503d0){if(!_0x5503d0||!_0x5503d0[_0xaefd('0x48')](_0x578378[_0xaefd('0x49')])){return _0x4c0898[_0xaefd('0x3f')](0x191)[_0xaefd('0x41')]({'message':'Wrong\x20credentials.'});}_0x36b6b7[_0xaefd('0x3a')]={'id':_0x5503d0['id']};_0x45f0e8();})[_0xaefd('0x44')](function(_0x3b11e4){_0x45f0e8(_0x3b11e4);});}else if(_[_0xaefd('0x4a')](_0x36b6b7[_0xaefd('0x45')][_0xaefd('0x46')],_0xaefd('0x4b'))){validateJwt(_0x36b6b7,_0x4c0898,_0x45f0e8);}else{if(_0xbeb1b8){_0x45f0e8();}else{return _0x4c0898[_0xaefd('0x3f')](0x193)[_0xaefd('0x41')]({'message':_0xaefd('0x4c')});}}}else if(_0x36b6b7[_0xaefd('0x4d')][_0xaefd('0x4e')]){try{var _0x304d34={'audience':hardwareConf[_0xaefd('0x4f')](),'issuer':hardwareConf[_0xaefd('0x4f')]()};verifyJwt(_0x36b6b7[_0xaefd('0x4d')]['apikey'],_0x304d34)[_0xaefd('0x3e')](function(_0xcb4be8){return db[_0xaefd('0x50')]['find']({'where':{'id':_0xcb4be8[_0xaefd('0x51')]}})['then'](function(_0x187e76){_0x5c573b=_0x187e76;return db[_0xaefd('0x52')][_0xaefd('0x3b')]({'where':{'id':0x1},'attributes':[_0xaefd('0x53'),_0xaefd('0x54')],'raw':!![]});})[_0xaefd('0x3e')](function(_0x84ae70){if(!_0x5c573b||!_[_0xaefd('0x55')](_0x5c573b[_0xaefd('0x56')],_0xcb4be8[_0xaefd('0x57')])){return _0x4c0898[_0xaefd('0x3f')](0x191)[_0xaefd('0x41')]({'message':_0xaefd('0x58')});}if(_0x5c573b[_0xaefd('0x59')]){return _0x4c0898['status'](0x191)[_0xaefd('0x41')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x5c573b[_0xaefd('0x5a')]){if(_0x84ae70[_0xaefd('0x54')]>0x0){if(moment(_0x5c573b[_0xaefd('0x5b')])[_0xaefd('0x5c')](_0x84ae70[_0xaefd('0x54')],_0xaefd('0x5d'))>moment()){return _0x4c0898[_0xaefd('0x3f')](0x191)[_0xaefd('0x41')]({'message':_0xaefd('0x5e')});}}else{return _0x4c0898[_0xaefd('0x3f')](0x191)['json']({'message':_0xaefd('0x5e')});}}_0x36b6b7[_0xaefd('0x3a')]={'id':_0x5c573b['id']};_0x45f0e8();});})['catch'](function(){return _0x4c0898[_0xaefd('0x3f')](0x191)[_0xaefd('0x41')]({'message':_0xaefd('0x5e')});});}catch(_0x4aeadf){_0x45f0e8(_0x4aeadf);}}else if(_0xbeb1b8){_0x45f0e8();}else{return _0x4c0898['status'](0x193)[_0xaefd('0x41')]({'message':_0xaefd('0x4c')});}})[_0xaefd('0x39')](function(_0x179648,_0x2ce87,_0xa145c6){if(_0x179648[_0xaefd('0x3a')]){db[_0xaefd('0x50')]['find']({'where':{'id':_0x179648[_0xaefd('0x3a')]['id']},'attributes':userAttributes})[_0xaefd('0x3e')](function(_0x1d1c8a){if(!_0x1d1c8a){return _0x2ce87[_0xaefd('0x3f')](0x194)[_0xaefd('0x41')]({'message':_0xaefd('0x5f')});}_0x179648[_0xaefd('0x3a')]=_0x1d1c8a;_0xa145c6();})[_0xaefd('0x44')](function(_0x5d0f3d){_0xa145c6(_0x5d0f3d);});}else if(_0xbeb1b8){_0xa145c6();}else{return _0x2ce87['status'](0x194)[_0xaefd('0x41')]({'message':_0xaefd('0x60')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x17d611,_0xe37b2c,_0x2e2d63){return licenseUtil[_0xaefd('0x61')]()[_0xaefd('0x3e')](function(_0x27bf67){if(_0x27bf67[_0xaefd('0x62')]){_0x2e2d63();}else{return _0xe37b2c[_0xaefd('0x3f')](0x193)[_0xaefd('0x41')]({'message':'Forbidden'});}})[_0xaefd('0x44')](function(_0x3ff08c){_0x2e2d63(_0x3ff08c);});});};exports[_0xaefd('0x63')]=function isWebrtcLicence(){return compose()[_0xaefd('0x39')](function(_0x224613,_0x2cb72f,_0xf54e83){return licenseUtil['getLicense']()[_0xaefd('0x3e')](function(_0x4badfd){if(_0x4badfd[_0xaefd('0x64')]){_0xf54e83();}else{return _0x2cb72f[_0xaefd('0x3f')](0x193)[_0xaefd('0x41')]({'message':_0xaefd('0x65')});}})['catch'](function(_0x57fa12){_0xf54e83(_0x57fa12);});});};exports[_0xaefd('0x66')]=function(_0x34839e,_0x179b8b,_0x4eeb56){_0x34839e[_0xaefd('0x66')]=!![];return _0x4eeb56();};exports[_0xaefd('0x67')]=function signToken(_0x53e635){return signJwt(_0x53e635);};exports[_0xaefd('0x68')]=function(_0xf2783d,_0x3c6a3e){if(!_0xf2783d[_0xaefd('0x3a')]){return _0x3c6a3e[_0xaefd('0x3f')](0x194)[_0xaefd('0x41')]({'message':_0xaefd('0x69')});}var _0x3d5b7d={'payload':{'id':_0xf2783d['user']['id'],'role':_0xf2783d['user'][_0xaefd('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3d5b7d)[_0xaefd('0x3e')](function(_0x578e0c){_0x3c6a3e[_0xaefd('0x6a')]('motion.token',_0x578e0c);_0x3c6a3e[_0xaefd('0x6b')](_0xaefd('0x6c'));})[_0xaefd('0x44')](function(_0x69185e){return _0x3c6a3e[_0xaefd('0x3f')](0x1f4)[_0xaefd('0x6d')](_0x69185e);});};exports['retrieveApiKey']=function(_0x56e180){if(_[_0xaefd('0x6e')](_0x56e180[_0xaefd('0x56')])||_['isNil'](_0x56e180[_0xaefd('0x6f')])){return null;}else{return createJwt(_0x56e180);}};exports[_0xaefd('0x70')]=function(_0x392117){_0x392117[_0xaefd('0x56')]=generateNonce();_0x392117['apiKeyIat']=generateIssuedAt();return createJwt(_0x392117);};exports['regenerateApiKey']=function(_0x2b0d8e,_0x41ef40){var _0x417961=_0x2b0d8e[_0xaefd('0x4d')][_0xaefd('0x4e')];if(_0x417961){var _0x47cac9={'nonce':_0x41ef40[_0xaefd('0x56')],'iat':_0x41ef40[_0xaefd('0x6f')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xaefd('0x4f')]()};return verifyJwt(_0x417961,_0x47cac9)[_0xaefd('0x3e')](function(){return generateApiKey(_0x41ef40);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xaefd('0x71')]=function(_0x367944){var _0x46be93=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x46be93['test'](_0x367944))throw new db[(_0xaefd('0x72'))][(_0xaefd('0x73'))]('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[_0xaefd('0x74')]=function(_0x21b65c,_0x14b472,_0x2dd1ee){var _0x54382b=encryptor['decryptString'](_0x14b472)[_0xaefd('0x75')](',');for(var _0x268f07=0x0;_0x268f07<_0x2dd1ee;_0x268f07++){if(!_0x54382b[_0x268f07])break;if(_0x21b65c[_0xaefd('0x76')]()===_0x54382b[_0x268f07][_0xaefd('0x76')]()){var _0x4189c4=util[_0xaefd('0x77')](_0xaefd('0x78'),_0x2dd1ee);if(_0x2dd1ee===0x1){_0x4189c4=_0xaefd('0x79');}throw new db[(_0xaefd('0x72'))][(_0xaefd('0x73'))](_0x4189c4);}}return;};exports['updatePasswordsHistory']=function(_0x4fc1f9,_0x324eb4){var _0x431c1a=_0x324eb4?encryptor[_0xaefd('0x7a')](_0x324eb4)[_0xaefd('0x75')](','):[];if(_0x431c1a['length']===0x5){_0x431c1a[_0xaefd('0x7b')](-0x1,0x1);}_0x431c1a[_0xaefd('0x7c')](_0x4fc1f9);return encryptor[_0xaefd('0x7d')](_0x431c1a[_0xaefd('0x7e')](','));};function signJwt(_0x16c227){var _0x37414d=BPromise[_0xaefd('0x7f')](jwt[_0xaefd('0x80')],{'context':jwt});var _0x5c521f=_0x16c227[_0xaefd('0x81')]||config[_0xaefd('0xa')][_0xaefd('0xb')];return new BPromise(function(_0x2456a6,_0x5c7988){_0x37414d(_0x16c227[_0xaefd('0x82')],_0x5c521f,_0x16c227['options'])[_0xaefd('0x3e')](function(_0x22cf9d){_0x2456a6(_0x22cf9d);})['catch'](function(_0x537fa4){_0x5c7988(_0x537fa4);});});}function verifyJwt(_0x45028e,_0x524b1e,_0x5e0068){var _0x4e75bc=BPromise[_0xaefd('0x7f')](jwt[_0xaefd('0x83')],{'context':jwt});var _0x27fcb4=_0x5e0068||config[_0xaefd('0xa')][_0xaefd('0xb')];return new BPromise(function(_0x384847,_0x509a87){_0x4e75bc(_0x45028e,_0x27fcb4,_0x524b1e)['then'](function(_0x4f8e16){_0x384847(_0x4f8e16);})['catch'](function(_0x14f9a2){_0x509a87(_0x14f9a2);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xaefd('0x84')]('hex');}function generateIssuedAt(){return Math[_0xaefd('0x85')](Date[_0xaefd('0x86')]()/0x3e8)[_0xaefd('0x84')]();}function createJwt(_0xa128f9){var _0x25c018={'payload':{'iat':_0xa128f9[_0xaefd('0x6f')],'nonce':_0xa128f9[_0xaefd('0x56')]},'options':{'algorithm':'HS512','subject':_0xa128f9['id'][_0xaefd('0x84')](),'issuer':hardwareConf[_0xaefd('0x4f')](),'audience':hardwareConf[_0xaefd('0x4f')]()}};return signJwt(_0x25c018)[_0xaefd('0x3e')](function(_0x56eccc){return{'iat':_0xa128f9[_0xaefd('0x6f')],'nonce':_0xa128f9['apiKeyNonce'],'token':_0x56eccc};});} \ No newline at end of file +var _0x7916=['cookie','motion.token','redirect','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','query','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','decryptString','split','length','splice','join','promisify','sign','secret','secrets','options','verify','randomBytes','toString','hex','now','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','util','moment','session','fullname','email','userpic','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','wssPort','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','params','disposition','status','unmanaged','Forbidden.','headers','authorization','startsWith','find','name','then','authenticate','pass','json','Wrong\x20credentials.','user','Bearer','apikey','getUuid','User','sub','findOne','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockDuration','blockedAt','add','minutes','catch','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','role'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7916,0x128));var _0x6791=function(_0x1bc76e,_0x3c2452){_0x1bc76e=_0x1bc76e-0x0;var _0x549281=_0x7916[_0x1bc76e];return _0x549281;};'use strict';var db=require(_0x6791('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x6791('0x1'));var licenseUtil=require(_0x6791('0x2'));var encryptor=require('../encryptor');var _=require(_0x6791('0x3'));var jwt=require(_0x6791('0x4'));var expressJwt=require(_0x6791('0x5'));var compose=require(_0x6791('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x6791('0x7'));var BPromise=require('bluebird');var util=require(_0x6791('0x8'));var moment=require(_0x6791('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0x6791('0xa')]});var userAttributes=['id','role',_0x6791('0xb'),'name','internal',_0x6791('0xc'),_0x6791('0xd'),'permissions',_0x6791('0xe'),_0x6791('0xf'),_0x6791('0x10'),'mailPause',_0x6791('0x11'),_0x6791('0x12'),_0x6791('0x13'),_0x6791('0x14'),_0x6791('0x15'),_0x6791('0x16'),_0x6791('0x17'),_0x6791('0x18'),_0x6791('0x19'),_0x6791('0x1a'),_0x6791('0x1b'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x6791('0x1c'),'phoneBarEnableRecording',_0x6791('0x1d'),'phoneBarEnableSettings',_0x6791('0x1e'),_0x6791('0x1f'),'phoneBarRemoteControl',_0x6791('0x20'),'hotdesk',_0x6791('0x21'),_0x6791('0x22'),'privacyEnabled',_0x6791('0x23'),_0x6791('0x24'),'downloadVoiceRecordings',_0x6791('0x25'),'downloadAttachments',_0x6791('0x26'),_0x6791('0x27'),_0x6791('0x28'),_0x6791('0x29'),_0x6791('0x2a'),_0x6791('0x2b'),_0x6791('0x2c'),'smsAutoanswerDelay',_0x6791('0x2d'),_0x6791('0x2e'),'faxAutoanswer',_0x6791('0x2f'),_0x6791('0x30'),'whatsappAutoanswerDelay',_0x6791('0x31')];exports[_0x6791('0x32')]=function(){return this[_0x6791('0x33')](!![])[_0x6791('0x34')](function(_0x56ad28,_0x3e17b3,_0x1b516d){if(_0x56ad28['user']){_0x1b516d();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x56ad28[_0x6791('0x35')]['id']},'attributes':['id','closed',_0x6791('0x36')],'raw':!![]})['then'](function(_0x54a092){if(_0x54a092&&_0x54a092['closed']){return _0x3e17b3[_0x6791('0x37')](_0x54a092[_0x6791('0x36')]===_0x6791('0x38')?0x195:0x193)['json']({'message':_0x54a092[_0x6791('0x36')]===_0x6791('0x38')?'Unmanaged.':_0x6791('0x39')});}else{_0x1b516d();}})['catch'](function(_0x424b0e){_0x1b516d(_0x424b0e);});}});};exports['isAuthenticated']=function isAuthenticated(_0x4fc5d5){return compose()[_0x6791('0x34')](function(_0x551718,_0x2f56a2,_0x34b006){var _0x483d6c;if(_0x551718[_0x6791('0x3a')][_0x6791('0x3b')]){if(_[_0x6791('0x3c')](_0x551718[_0x6791('0x3a')]['authorization'],'Basic')){var _0x348b9c=basicAuth(_0x551718);db['User'][_0x6791('0x3d')]({'where':{'name':_0x348b9c[_0x6791('0x3e')]}})[_0x6791('0x3f')](function(_0x2b98b8){if(!_0x2b98b8||!_0x2b98b8[_0x6791('0x40')](_0x348b9c[_0x6791('0x41')])){return _0x2f56a2[_0x6791('0x37')](0x191)[_0x6791('0x42')]({'message':_0x6791('0x43')});}_0x551718[_0x6791('0x44')]={'id':_0x2b98b8['id']};_0x34b006();})['catch'](function(_0x28b3d4){_0x34b006(_0x28b3d4);});}else if(_[_0x6791('0x3c')](_0x551718[_0x6791('0x3a')][_0x6791('0x3b')],_0x6791('0x45'))){validateJwt(_0x551718,_0x2f56a2,_0x34b006);}else{if(_0x4fc5d5){_0x34b006();}else{return _0x2f56a2[_0x6791('0x37')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x551718['query'][_0x6791('0x46')]){try{var _0x21a9cf={'audience':hardwareConf[_0x6791('0x47')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x551718['query'][_0x6791('0x46')],_0x21a9cf)[_0x6791('0x3f')](function(_0x31a525){return db[_0x6791('0x48')]['find']({'where':{'id':_0x31a525[_0x6791('0x49')]}})[_0x6791('0x3f')](function(_0x2068a5){_0x483d6c=_0x2068a5;return db['Setting'][_0x6791('0x4a')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x6791('0x3f')](function(_0x1803ab){if(!_0x483d6c||!_['isEqual'](_0x483d6c[_0x6791('0x4b')],_0x31a525[_0x6791('0x4c')])){return _0x2f56a2[_0x6791('0x37')](0x191)[_0x6791('0x42')]({'message':_0x6791('0x4d')});}if(_0x483d6c['disabled']){return _0x2f56a2[_0x6791('0x37')](0x191)[_0x6791('0x42')]({'message':_0x6791('0x4e')});}if(_0x483d6c['blocked']){if(_0x1803ab[_0x6791('0x4f')]>0x0){if(moment(_0x483d6c[_0x6791('0x50')])[_0x6791('0x51')](_0x1803ab['blockDuration'],_0x6791('0x52'))>moment()){return _0x2f56a2[_0x6791('0x37')](0x191)[_0x6791('0x42')]({'message':_0x6791('0x4e')});}}else{return _0x2f56a2['status'](0x191)[_0x6791('0x42')]({'message':_0x6791('0x4e')});}}_0x551718[_0x6791('0x44')]={'id':_0x483d6c['id']};_0x34b006();});})[_0x6791('0x53')](function(){return _0x2f56a2[_0x6791('0x37')](0x191)[_0x6791('0x42')]({'message':_0x6791('0x4e')});});}catch(_0xae0e07){_0x34b006(_0xae0e07);}}else if(_0x4fc5d5){_0x34b006();}else{return _0x2f56a2[_0x6791('0x37')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x6791('0x34')](function(_0xe11675,_0x5900b6,_0x39dcb7){if(_0xe11675[_0x6791('0x44')]){db[_0x6791('0x48')][_0x6791('0x3d')]({'where':{'id':_0xe11675[_0x6791('0x44')]['id']},'attributes':userAttributes})[_0x6791('0x3f')](function(_0x44e0ba){if(!_0x44e0ba){return _0x5900b6['status'](0x194)[_0x6791('0x42')]({'message':'User\x20not\x20found.'});}_0xe11675[_0x6791('0x44')]=_0x44e0ba;_0x39dcb7();})[_0x6791('0x53')](function(_0x16f26c){_0x39dcb7(_0x16f26c);});}else if(_0x4fc5d5){_0x39dcb7();}else{return _0x5900b6[_0x6791('0x37')](0x194)['json']({'message':_0x6791('0x54')});}});};exports[_0x6791('0x55')]=function canUpdate(){return compose()[_0x6791('0x34')](function(_0x3251e9,_0x5a7fb6,_0x1763d8){return licenseUtil[_0x6791('0x56')]()[_0x6791('0x3f')](function(_0x57e39f){if(_0x57e39f[_0x6791('0x57')]){_0x1763d8();}else{return _0x5a7fb6[_0x6791('0x37')](0x193)[_0x6791('0x42')]({'message':_0x6791('0x58')});}})['catch'](function(_0x3e5e29){_0x1763d8(_0x3e5e29);});});};exports[_0x6791('0x59')]=function isWebrtcLicence(){return compose()['use'](function(_0x1ac964,_0x54ef7b,_0x38b6b5){return licenseUtil[_0x6791('0x56')]()[_0x6791('0x3f')](function(_0x3ddccc){if(_0x3ddccc[_0x6791('0x5a')]){_0x38b6b5();}else{return _0x54ef7b[_0x6791('0x37')](0x193)[_0x6791('0x42')]({'message':_0x6791('0x58')});}})[_0x6791('0x53')](function(_0x5cfa40){_0x38b6b5(_0x5cfa40);});});};exports[_0x6791('0x5b')]=function(_0x599f23,_0x10e806,_0x2bb86a){_0x599f23[_0x6791('0x5b')]=!![];return _0x2bb86a();};exports[_0x6791('0x5c')]=function signToken(_0x6ab7f6){return signJwt(_0x6ab7f6);};exports['setTokenCookie']=function(_0x2bc08d,_0x35e087){if(!_0x2bc08d[_0x6791('0x44')]){return _0x35e087[_0x6791('0x37')](0x194)[_0x6791('0x42')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x1a902c={'payload':{'id':_0x2bc08d[_0x6791('0x44')]['id'],'role':_0x2bc08d['user'][_0x6791('0x5d')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1a902c)['then'](function(_0x3d4b7e){_0x35e087[_0x6791('0x5e')](_0x6791('0x5f'),_0x3d4b7e);_0x35e087[_0x6791('0x60')]('/dashboards/general');})[_0x6791('0x53')](function(_0x243faf){return _0x35e087['status'](0x1f4)[_0x6791('0x61')](_0x243faf);});};exports[_0x6791('0x62')]=function(_0x3a895b){if(_['isNil'](_0x3a895b[_0x6791('0x4b')])||_[_0x6791('0x63')](_0x3a895b['apiKeyIat'])){return null;}else{return createJwt(_0x3a895b);}};exports[_0x6791('0x64')]=function(_0x2cec8d){_0x2cec8d['apiKeyNonce']=generateNonce();_0x2cec8d[_0x6791('0x65')]=generateIssuedAt();return createJwt(_0x2cec8d);};exports[_0x6791('0x66')]=function(_0x1b0bb1,_0x285bfd){var _0x582d50=_0x1b0bb1[_0x6791('0x67')][_0x6791('0x46')];if(_0x582d50){var _0x32f36b={'nonce':_0x285bfd['apiKeyNonce'],'iat':_0x285bfd['apiKeyIat'],'audience':hardwareConf[_0x6791('0x47')](),'issuer':hardwareConf[_0x6791('0x47')]()};return verifyJwt(_0x582d50,_0x32f36b)[_0x6791('0x3f')](function(){return generateApiKey(_0x285bfd);});}else{throw{'message':_0x6791('0x68')};}};exports[_0x6791('0x69')]=function(_0x53b651){var _0x54da93=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x54da93[_0x6791('0x6a')](_0x53b651))throw new db['Sequelize']['ValidationError'](_0x6791('0x6b'));return;};exports[_0x6791('0x6c')]=function(_0x2cb48e,_0x10b41b,_0x13089d){var _0x220cb1=encryptor['decryptString'](_0x10b41b)['split'](',');for(var _0x40649c=0x0;_0x40649c<_0x13089d;_0x40649c++){if(!_0x220cb1[_0x40649c])break;if(_0x2cb48e[_0x6791('0x6d')]()===_0x220cb1[_0x40649c]['toLowerCase']()){var _0x44b1df=util['format'](_0x6791('0x6e'),_0x13089d);if(_0x13089d===0x1){_0x44b1df=_0x6791('0x6f');}throw new db['Sequelize'][(_0x6791('0x70'))](_0x44b1df);}}return;};exports[_0x6791('0x71')]=function(_0x3fd984,_0x49ed65){var _0x3ba679=_0x49ed65?encryptor[_0x6791('0x72')](_0x49ed65)[_0x6791('0x73')](','):[];if(_0x3ba679[_0x6791('0x74')]===0x5){_0x3ba679[_0x6791('0x75')](-0x1,0x1);}_0x3ba679['unshift'](_0x3fd984);return encryptor['encryptString'](_0x3ba679[_0x6791('0x76')](','));};function signJwt(_0x13430e){var _0x5d2668=BPromise[_0x6791('0x77')](jwt[_0x6791('0x78')],{'context':jwt});var _0x66f6b4=_0x13430e[_0x6791('0x79')]||config[_0x6791('0x7a')][_0x6791('0xa')];return new BPromise(function(_0x33ac65,_0xb79679){_0x5d2668(_0x13430e['payload'],_0x66f6b4,_0x13430e[_0x6791('0x7b')])[_0x6791('0x3f')](function(_0x36b81e){_0x33ac65(_0x36b81e);})[_0x6791('0x53')](function(_0x548084){_0xb79679(_0x548084);});});}function verifyJwt(_0x16dff7,_0x10c7f3,_0xa8a8dd){var _0x5ca809=BPromise[_0x6791('0x77')](jwt[_0x6791('0x7c')],{'context':jwt});var _0x99d4ee=_0xa8a8dd||config[_0x6791('0x7a')]['session'];return new BPromise(function(_0x2c834f,_0x2843fb){_0x5ca809(_0x16dff7,_0x99d4ee,_0x10c7f3)['then'](function(_0x1114d4){_0x2c834f(_0x1114d4);})[_0x6791('0x53')](function(_0x215a63){_0x2843fb(_0x215a63);});});}function generateNonce(){return crypto[_0x6791('0x7d')](0x10)[_0x6791('0x7e')](_0x6791('0x7f'));}function generateIssuedAt(){return Math['floor'](Date[_0x6791('0x80')]()/0x3e8)[_0x6791('0x7e')]();}function createJwt(_0xf76291){var _0x547287={'payload':{'iat':_0xf76291[_0x6791('0x65')],'nonce':_0xf76291['apiKeyNonce']},'options':{'algorithm':_0x6791('0x81'),'subject':_0xf76291['id'][_0x6791('0x7e')](),'issuer':hardwareConf[_0x6791('0x47')](),'audience':hardwareConf[_0x6791('0x47')]()}};return signJwt(_0x547287)[_0x6791('0x3f')](function(_0x4a6bb8){return{'iat':_0xf76291[_0x6791('0x65')],'nonce':_0xf76291[_0x6791('0x4b')],'token':_0x4a6bb8};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 1e65df1..5bea373 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde49=['ids','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','all','length','fieldType','type','lodash','../../mysqldb','skipContactsQuery','resolve','then','search','parseQueryParameters','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions'];(function(_0x37ca27,_0x14cff9){var _0xe53602=function(_0x5c865b){while(--_0x5c865b){_0x37ca27['push'](_0x37ca27['shift']());}};_0xe53602(++_0x14cff9);}(_0xde49,0x187));var _0x9de4=function(_0x405b9,_0x5079eb){_0x405b9=_0x405b9-0x0;var _0x314c27=_0xde49[_0x405b9];return _0x314c27;};'use strict';var _=require(_0x9de4('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x9de4('0x1'))['db'];exports['findAll']=function(_0x4af2e6,_0x1d3532,_0x2a484e,_0x5dfcef){var _0xdf7dc2={'count':0x0,'rows':[]};var _0x1b63df=sqlUtils[_0x9de4('0x2')](_0x1d3532,_0x4af2e6);if(_0x1b63df){return Promise[_0x9de4('0x3')](_0xdf7dc2);}var _0x14b67a=sqlUtils['getContactsSubquery']();var _0x1a480c={};var _0x46b3f7=![];var _0x357776=![];return Promise[_0x9de4('0x3')]()[_0x9de4('0x4')](function(){if(_0x4af2e6['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x4af2e6[_0x9de4('0x5')],_0x5dfcef);}else{return sqlUtils[_0x9de4('0x6')](_0x4af2e6,_0x5dfcef);}})[_0x9de4('0x4')](function(_0x2c0258){_0x14b67a[_0x9de4('0x7')](_0x2c0258[_0x9de4('0x8')]);_0x14b67a[_0x9de4('0x7')](_0x2c0258[_0x9de4('0x9')]);_0x14b67a[_0x9de4('0x7')](_0x2c0258[_0x9de4('0xa')]);_0x14b67a[_0x9de4('0x7')](_0x2c0258[_0x9de4('0xb')][_0x9de4('0xc')]);_0x1a480c=_0x2c0258[_0x9de4('0xd')];_0x357776=_0x2c0258['user'][_0x9de4('0xe')];return sqlUtils[_0x9de4('0xf')](_0x1d3532,_0x4af2e6,_0x357776);})[_0x9de4('0x4')](function(_0x120d35){_0x14b67a[_0x9de4('0x7')](_0x120d35);var _0x1ba80c=_0x4af2e6[_0x9de4('0x5')]?_0x1a480c[_0x9de4('0x10')]:_0x4af2e6[_0x9de4('0x11')];_0x46b3f7=_0x1ba80c?!![]:![];return sqlUtils[_0x9de4('0x12')](_0x14b67a,_0x1ba80c);})[_0x9de4('0x4')](function(_0x483f3c){_0xdf7dc2[_0x9de4('0x13')]=_0x483f3c;if(_0xdf7dc2['count']===0x0){return;}if(_0x4af2e6[_0x9de4('0x14')]){_0x357776=!![];}return sqlUtils[_0x9de4('0x15')](_0x14b67a,_0x4af2e6['fields'],_0x2a484e,_0x46b3f7,_0x1a480c['clause'],_0x357776);})[_0x9de4('0x4')](function(_0x14f925){if(!_0x14f925){return[];}return sqlUtils[_0x9de4('0x16')](_0x14f925,_0x4af2e6,_0x2a484e);})['then'](function(_0x32b32d){_0xdf7dc2[_0x9de4('0x17')]=_0x32b32d;return _0xdf7dc2;})[_0x9de4('0x18')](function(_0x5c1c12){throw _0x5c1c12;});};exports[_0x9de4('0x19')]=function(){var _0xdab097={};var _0x17a3d7=[];return db[_0x9de4('0x1a')][_0x9de4('0x19')]()[_0x9de4('0x4')](function(_0x5b92af){_0xdab097=_0x5b92af;var _0x335568=Object[_0x9de4('0x1b')](_0xdab097)['filter'](function(_0x551bab){return _[_0x9de4('0x1c')](_0x551bab,_0x9de4('0x1d'))?_0x551bab:undefined;});var _0x5a6904=_0x335568[_0x9de4('0x1e')](function(_0x2eafd8){return db[_0x9de4('0x1f')][_0x9de4('0x20')]({'where':{'id':_0x2eafd8['slice'](0x3)},'raw':!![]});});return Promise[_0x9de4('0x21')](_0x5a6904);})['then'](function(_0x49a70a){for(var _0x5e1a84=0x0;_0x5e1a84<_0x49a70a[_0x9de4('0x22')];_0x5e1a84++){if(_0x49a70a[_0x5e1a84]){var _0x3c1206=_0x9de4('0x1d')+_0x49a70a[_0x5e1a84]['id'];_0xdab097[_0x3c1206][_0x9de4('0x23')]=_0x49a70a[_0x5e1a84][_0x9de4('0x24')];}}_0x17a3d7=_[_0x9de4('0x1e')](Object[_0x9de4('0x1b')](_0xdab097),function(_0x52cf26){return{'name':_0x52cf26,'type':_0xdab097[_0x52cf26][_0x9de4('0x24')]};});return _0x17a3d7;})[_0x9de4('0x18')](function(_0x407ea){throw _0x407ea;});}; \ No newline at end of file +var _0x5f26=['./sql-utils','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','filter','tags','user','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','describe','keys','findOne','slice','all','length','fieldType','type','lodash'];(function(_0x1395b8,_0xe2f288){var _0xeb93e7=function(_0x2a82f1){while(--_0x2a82f1){_0x1395b8['push'](_0x1395b8['shift']());}};_0xeb93e7(++_0xe2f288);}(_0x5f26,0x131));var _0x65f2=function(_0x4c075b,_0x56c2e7){_0x4c075b=_0x4c075b-0x0;var _0x228448=_0x5f26[_0x4c075b];return _0x228448;};'use strict';var _=require(_0x65f2('0x0'));var sqlUtils=require(_0x65f2('0x1'));var db=require('../../mysqldb')['db'];exports[_0x65f2('0x2')]=function(_0x3a533e,_0x56e9a0,_0x33e567,_0x519195){var _0x7a9438={'count':0x0,'rows':[]};var _0x2135e8=sqlUtils[_0x65f2('0x3')](_0x56e9a0,_0x3a533e);if(_0x2135e8){return Promise[_0x65f2('0x4')](_0x7a9438);}var _0x1d2b72=sqlUtils[_0x65f2('0x5')]();var _0x15a7d7={};var _0x170b4e=![];var _0x2ed2f6=![];return Promise['resolve']()[_0x65f2('0x6')](function(){if(_0x3a533e[_0x65f2('0x7')]){return sqlUtils[_0x65f2('0x8')](_0x3a533e[_0x65f2('0x7')],_0x519195);}else{return sqlUtils[_0x65f2('0x9')](_0x3a533e,_0x519195);}})[_0x65f2('0x6')](function(_0x28c425){_0x1d2b72['where'](_0x28c425[_0x65f2('0xa')]);_0x1d2b72[_0x65f2('0xb')](_0x28c425[_0x65f2('0xc')]);_0x1d2b72[_0x65f2('0xb')](_0x28c425[_0x65f2('0xd')]);_0x1d2b72[_0x65f2('0xb')](_0x28c425['user']['clause']);_0x15a7d7=_0x28c425[_0x65f2('0xe')];_0x2ed2f6=_0x28c425[_0x65f2('0xf')][_0x65f2('0x10')];return sqlUtils[_0x65f2('0x11')](_0x56e9a0,_0x3a533e,_0x2ed2f6);})[_0x65f2('0x6')](function(_0x212df5){_0x1d2b72[_0x65f2('0xb')](_0x212df5);var _0x4da11f=_0x3a533e[_0x65f2('0x7')]?_0x15a7d7[_0x65f2('0x12')]:_0x3a533e[_0x65f2('0x13')];_0x170b4e=_0x4da11f?!![]:![];return sqlUtils[_0x65f2('0x14')](_0x1d2b72,_0x4da11f);})['then'](function(_0x3dd5a4){_0x7a9438[_0x65f2('0x15')]=_0x3dd5a4;if(_0x7a9438[_0x65f2('0x15')]===0x0){return;}if(_0x3a533e['User']){_0x2ed2f6=!![];}return sqlUtils[_0x65f2('0x16')](_0x1d2b72,_0x3a533e['fields'],_0x33e567,_0x170b4e,_0x15a7d7['clause'],_0x2ed2f6);})[_0x65f2('0x6')](function(_0x2dccc9){if(!_0x2dccc9){return[];}return sqlUtils[_0x65f2('0x17')](_0x2dccc9,_0x3a533e,_0x33e567);})[_0x65f2('0x6')](function(_0x34a7ff){_0x7a9438[_0x65f2('0x18')]=_0x34a7ff;return _0x7a9438;})[_0x65f2('0x19')](function(_0x15a6a2){throw _0x15a6a2;});};exports[_0x65f2('0x1a')]=function(){var _0x130a25={};var _0x1ba742=[];return db['CmContact'][_0x65f2('0x1a')]()[_0x65f2('0x6')](function(_0x550671){_0x130a25=_0x550671;var _0x5e9cba=Object[_0x65f2('0x1b')](_0x130a25)[_0x65f2('0xd')](function(_0x55d233){return _['startsWith'](_0x55d233,'cf_')?_0x55d233:undefined;});var _0x17c847=_0x5e9cba['map'](function(_0x3e53cc){return db['CmCustomField'][_0x65f2('0x1c')]({'where':{'id':_0x3e53cc[_0x65f2('0x1d')](0x3)},'raw':!![]});});return Promise[_0x65f2('0x1e')](_0x17c847);})[_0x65f2('0x6')](function(_0x4deba7){for(var _0x2b2eba=0x0;_0x2b2eba<_0x4deba7[_0x65f2('0x1f')];_0x2b2eba++){if(_0x4deba7[_0x2b2eba]){var _0x5e8af5='cf_'+_0x4deba7[_0x2b2eba]['id'];_0x130a25[_0x5e8af5][_0x65f2('0x20')]=_0x4deba7[_0x2b2eba][_0x65f2('0x21')];}}_0x1ba742=_['map'](Object['keys'](_0x130a25),function(_0x20ef11){return{'name':_0x20ef11,'type':_0x130a25[_0x20ef11][_0x65f2('0x21')]};});return _0x1ba742;})[_0x65f2('0x19')](function(_0x2335c1){throw _0x2335c1;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index c9e584f..3cbb7c1 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce52=['exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','.id','ct.CmContactId\x20=\x20','tools_tags','firstName','lastName','phone','mobile','fax','email','CompanyId','updatedAt','deletedAt','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','fieldType','buildExpression','type','default','text','start','end','Tag','value','map','tags','clause','ids','User','user','and','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','\x20=\x20?','resolve','then','fields','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','c.id','limit','offset','group','subqry.id','having','order','DESC','subqry.','subqry','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','TagIds','Tags','push','clone','COUNT(*)','isEmpty'];(function(_0x2be483,_0x62f011){var _0x137784=function(_0x2580b6){while(--_0x2580b6){_0x2be483['push'](_0x2be483['shift']());}};_0x137784(++_0x62f011);}(_0xce52,0x13f));var _0x2ce5=function(_0xb34ab3,_0x5b933d){_0xb34ab3=_0xb34ab3-0x0;var _0x4687c9=_0xce52[_0xb34ab3];return _0x4687c9;};'use strict';var _=require(_0x2ce5('0x0'));var squel=require(_0x2ce5('0x1'));var as=require(_0x2ce5('0x2'));var qs=require('../parsers/qs');var utils=require(_0x2ce5('0x3'));var db=require(_0x2ce5('0x4'))['db'];function skipContactsQuery(_0x311acb,_0x4b11a9){var _0x4df1dd=![];if(_0x311acb[_0x2ce5('0x5')]===_0x2ce5('0x6')&&!_0x4b11a9[_0x2ce5('0x7')]&&!_0x4b11a9[_0x2ce5('0x8')]&&_0x4b11a9[_0x2ce5('0x9')]!==_0x2ce5('0xa')){_0x4df1dd=!![];}return _0x4df1dd;}function getContactsSubquery(){return squel[_0x2ce5('0xb')]()[_0x2ce5('0xc')]('cm_contacts','c')[_0x2ce5('0xd')](_0x2ce5('0xe'));}function applyJoinClauses(_0x542f2c,_0x29b429){var _0x61940e=_0x29b429?'c':'subqry';_0x542f2c[_0x2ce5('0xf')](_0x2ce5('0x10'),'uc','uc.CmContactId\x20=\x20'+_0x61940e+_0x2ce5('0x11'))[_0x2ce5('0xf')]('cm_contact_has_tags','ct',_0x2ce5('0x12')+_0x61940e+_0x2ce5('0x11'))[_0x2ce5('0xf')](_0x2ce5('0x13'),'t','t.id\x20=\x20ct.TagId');return _0x542f2c;}function addFieldsToQuery(_0x39098c,_0x1fba7d,_0x3933e8,_0x5b64ea,_0x25ea0){var _0x817f6b=_0x25ea0?'c':'subqry';if(!_0x1fba7d){_0x1fba7d=['id',_0x2ce5('0x14'),_0x2ce5('0x15'),_0x2ce5('0x16'),_0x2ce5('0x17'),_0x2ce5('0x18'),_0x2ce5('0x19'),_0x2ce5('0x8'),_0x2ce5('0x1a'),'createdAt',_0x2ce5('0x1b'),_0x2ce5('0x1c'),'TagIds'];}else if(!_0x1fba7d['includes']('id')){_0x1fba7d['push']('id');}var _0x53ca3f=_0x3933e8&&_0x25ea0||!_0x3933e8&&!_0x25ea0;if(_0x5b64ea){_0x53ca3f=_0x5b64ea&&_0x25ea0||!_0x5b64ea&&!_0x25ea0;}_0x1fba7d[_0x2ce5('0x1d')](function(_0x1216ef){if(_0x1216ef==='TagIds'){if(_0x53ca3f){_0x39098c[_0x2ce5('0x1e')](_0x2ce5('0x1f'),_0x1216ef);}else if(_0x3933e8||_0x5b64ea){_0x39098c[_0x2ce5('0x1e')](_0x817f6b+'.'+_0x1216ef);}}else{_0x39098c['field'](_0x817f6b+'.'+_0x1216ef);}});return _0x39098c;}function getSqlClauses(){var _0x1efdb6={'default':squel['expr'](),'fields':squel[_0x2ce5('0x20')](),'filter':squel[_0x2ce5('0x20')](),'tags':{'clause':squel[_0x2ce5('0x20')](),'ids':null},'user':{'clause':squel[_0x2ce5('0x20')](),'skip':![]}};return _0x1efdb6;}function parseTagParameter(_0x2d6020){var _0xe7c4a0=squel[_0x2ce5('0x20')]();if(_0x2d6020){var _0x3405cf=utils[_0x2ce5('0x21')](_0x2d6020);_0x3405cf['forEach'](function(_0x1c8d3e){_0xe7c4a0['or'](_0x2ce5('0x22'),'%,'+_0x1c8d3e+',%');});}return _0xe7c4a0;}function parseSearchFilter(_0x5a747b){var _0x16bed6=squel[_0x2ce5('0x20')]();if(_0x5a747b){var _0x5a271b=_0x5a747b[_0x2ce5('0x23')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x5a271b[_0x2ce5('0x24')]('\x20')[_0x2ce5('0x25')]>0x1){_0x16bed6['or'](_0x2ce5('0x26'),qs['getFullTextValue'](_0x5a271b,!![]),null);}else{if(qs['isNumeric'](_0x5a271b)){_0x16bed6['or'](_0x2ce5('0x27'),_0x5a271b+'%');_0x16bed6['or'](_0x2ce5('0x28'),_0x5a271b+'%');_0x16bed6['or'](_0x2ce5('0x29'),_0x5a271b+'%');_0x16bed6['or'](_0x2ce5('0x2a'),_0x5a271b+'%');}else if(qs[_0x2ce5('0x2b')](_0x5a271b)){_0x16bed6['or']('c.email\x20LIKE\x20?',_0x5a271b+'%');}else{_0x16bed6['or'](_0x2ce5('0x2c'),'%'+_0x5a271b+'%');_0x16bed6['or']('c.lastName\x20LIKE\x20?','%'+_0x5a271b+'%');_0x16bed6['or'](_0x2ce5('0x2d'),'%'+_0x5a271b+'%');}}}return _0x16bed6;}function parseAdvancedSearchFilter(_0x4a8f16,_0x5db22e){var _0x4894f1=getSqlClauses();var _0x1f28cc=as[_0x2ce5('0x2e')](_0x4a8f16);var _0x264529=_0x1f28cc['sqlOperator'];for(var _0x1f22e1=0x0;_0x1f22e1<_0x1f28cc[_0x2ce5('0x2f')][_0x2ce5('0x25')];_0x1f22e1++){var _0xff5047=_0x1f28cc['conditions'][_0x1f22e1];var _0x5e84c5='c';var _0x3e91f8=_[_0x2ce5('0x30')](_0x5db22e,[_0x2ce5('0x31'),_0xff5047[_0x2ce5('0x1e')]]);if(_0x3e91f8){if(_0xff5047[_0x2ce5('0x1e')]===_0x2ce5('0x32')||_0x3e91f8[_0x2ce5('0x33')]==='datetime'){_0xff5047['castTo']='DATE';}var _0x163f78=as[_0x2ce5('0x34')](_0x5e84c5,_0x3e91f8[_0x2ce5('0x35')],_0xff5047);_0x4894f1[_0x2ce5('0x36')][_0x264529](_0x163f78[_0x2ce5('0x37')],_0x163f78['value'][_0x2ce5('0x38')],_0x163f78['value'][_0x2ce5('0x39')]);}else{if(_0xff5047[_0x2ce5('0x1e')]===_0x2ce5('0x3a')){var _0x11ae06=_0xff5047[_0x2ce5('0x3b')][_0x2ce5('0x24')](',')[_0x2ce5('0x3c')](function(_0x202e02){return Number(_0x202e02);});var _0x36eb96=parseTagParameter(_0x11ae06);_0x4894f1[_0x2ce5('0x3d')][_0x2ce5('0x3e')]['and'](_0x36eb96);_0x4894f1[_0x2ce5('0x3d')][_0x2ce5('0x3f')]=_0x11ae06;}else if(_0xff5047['field']===_0x2ce5('0x40')){_0x4894f1[_0x2ce5('0x41')][_0x2ce5('0x3e')][_0x2ce5('0x42')](_0x2ce5('0x43'),_0xff5047[_0x2ce5('0x3b')]);_0x4894f1['user'][_0x2ce5('0x44')]=!![];}}}return _0x4894f1;}function parseModelFields(_0x16acbb,_0x12d415){var _0x42876a=squel[_0x2ce5('0x20')]();var _0x23fb9c=_(_0x16acbb)[_0x2ce5('0x45')]()[_0x2ce5('0x3c')](function(_0x116543){return _[_0x2ce5('0x46')](_0x12d415,['name',_0x116543])?_0x116543:undefined;})[_0x2ce5('0x47')]()['value']();if(_0x16acbb[_0x2ce5('0x48')]){_0x23fb9c['push']('Contact');}if(_0x16acbb[_0x2ce5('0x40')]){_0x23fb9c['push'](_0x2ce5('0x40'));}if(_0x23fb9c[_0x2ce5('0x25')]>0x0){_0x23fb9c[_0x2ce5('0x1d')](function(_0x3e405e){if(_0x3e405e===_0x2ce5('0x8')){_0x42876a[_0x2ce5('0x42')]('c.ListId\x20IN\x20?',[]['concat'](_0x16acbb[_0x3e405e]));}else if(_0x3e405e==='Contact'){var _0x55c33e='%'+_0x16acbb[_0x3e405e]+'%';_0x42876a[_0x2ce5('0x42')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x55c33e);}else if(_0x3e405e===_0x2ce5('0x40')){_0x42876a[_0x2ce5('0x42')]('uc.UserId\x20=\x20?',_0x16acbb[_0x3e405e]);}else{_0x42876a[_0x2ce5('0x42')]('c.'+_0x3e405e+_0x2ce5('0x49'),_0x16acbb[_0x3e405e]);}});}return _0x42876a;}function parseQueryParameters(_0x5de9da,_0x232ec4){var _0x4e119a=getSqlClauses();return Promise[_0x2ce5('0x4a')]()['then'](function(){return parseModelFields(_0x5de9da,_0x232ec4);})[_0x2ce5('0x4b')](function(_0x2a039d){_0x4e119a[_0x2ce5('0x4c')][_0x2ce5('0x42')](_0x2a039d);return parseTagParameter(_0x5de9da['tag']);})[_0x2ce5('0x4b')](function(_0x32d203){_0x4e119a[_0x2ce5('0x3d')][_0x2ce5('0x3e')][_0x2ce5('0x42')](_0x32d203);return parseSearchFilter(_0x5de9da['filter']);})['then'](function(_0x2f0ce4){_0x4e119a['filter']=_0x2f0ce4;return _0x4e119a;});}function checkListsRestrictions(_0x2a7692,_0x46fdc9,_0xa3c5e3){var _0x3a099b=squel[_0x2ce5('0x20')]();return Promise[_0x2ce5('0x4a')]()[_0x2ce5('0x4b')](function(){if(_0x46fdc9[_0x2ce5('0x7')]&&_0x2a7692[_0x2ce5('0x5')]===_0x2ce5('0x6')&&!_0xa3c5e3){return _0x2a7692[_0x2ce5('0x4d')]({'attributes':['id'],'raw':!![]});}})[_0x2ce5('0x4b')](function(_0x749df4){if(_0x749df4){if(_0x749df4[_0x2ce5('0x25')]===0x0){_0x3a099b['and'](_0x2ce5('0x4e'));}else{_0x3a099b['and'](_0x2ce5('0x4f'),_[_0x2ce5('0x3c')](_0x749df4,'id'));}}})[_0x2ce5('0x4b')](function(){return _0x3a099b;});}function buildContactsQuery(_0xc14331,_0xececf7,_0x5e5fd9,_0x3072af,_0x10d7cf,_0x4e5ac1){if(_0xececf7){_0xececf7=_0x5e5fd9[_0x2ce5('0x50')];}_0xc14331=addFieldsToQuery(_0xc14331,_0xececf7,_0x3072af,_0x4e5ac1,!![]);var _0x52e2ad=squel[_0x2ce5('0xb')]();_0x52e2ad=addFieldsToQuery(_0x52e2ad,_0xececf7,_0x3072af,_0x4e5ac1,![]);if(_0x3072af||_0x4e5ac1){_0xc14331=applyJoinClauses(_0xc14331,!![]);_0xc14331['group'](_0x2ce5('0x51'));if(_0x5e5fd9['limit']){_0x52e2ad[_0x2ce5('0x52')](_0x5e5fd9['limit']);}if(_0x5e5fd9[_0x2ce5('0x53')]){_0x52e2ad['offset'](_0x5e5fd9[_0x2ce5('0x53')]);}}else{_0x52e2ad=applyJoinClauses(_0x52e2ad,![]);_0x52e2ad[_0x2ce5('0x54')](_0x2ce5('0x55'));if(_0x5e5fd9[_0x2ce5('0x52')]){_0xc14331[_0x2ce5('0x52')](_0x5e5fd9[_0x2ce5('0x52')]);}if(_0x5e5fd9[_0x2ce5('0x53')]){_0xc14331[_0x2ce5('0x53')](_0x5e5fd9[_0x2ce5('0x53')]);}}_0x52e2ad[_0x2ce5('0x56')](_0x10d7cf);if(_0x5e5fd9[_0x2ce5('0x57')]){_0x5e5fd9[_0x2ce5('0x57')][_0x2ce5('0x1d')](function(_0x73d0db){_0xc14331[_0x2ce5('0x57')]('c.'+_0x73d0db[0x0],_0x73d0db[0x1]===_0x2ce5('0x58')?![]:!![]);_0x52e2ad[_0x2ce5('0x57')](_0x2ce5('0x59')+_0x73d0db[0x0],_0x73d0db[0x1]===_0x2ce5('0x58')?![]:!![]);});}_0x52e2ad[_0x2ce5('0xc')](_0xc14331,_0x2ce5('0x5a'));return _0x52e2ad;}function getFilteredContacts(_0x1d4b0d){var _0x3d3e4a=[];return db[_0x2ce5('0x3a')]['findAll']({'attributes':['id',_0x2ce5('0x31'),_0x2ce5('0x5b')],'raw':!![]})[_0x2ce5('0x4b')](function(_0x178809){_0x3d3e4a=_[_0x2ce5('0x5c')](_0x178809,'id');var _0x5b40cc={'type':db[_0x2ce5('0x5d')][_0x2ce5('0x5e')][_0x2ce5('0x5f')],'model':db[_0x2ce5('0x60')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x2ce5('0x61')][_0x2ce5('0x62')](_0x1d4b0d['toString'](),_0x5b40cc);})[_0x2ce5('0x4b')](function(_0x3c4274){_0x3c4274[_0x2ce5('0x1d')](function(_0x577f33){if(_0x577f33[_0x2ce5('0x63')]){_0x577f33[_0x2ce5('0x64')]=[];_0x577f33[_0x2ce5('0x63')][_0x2ce5('0x24')](',')['forEach'](function(_0x5ae2f8){_0x577f33[_0x2ce5('0x64')][_0x2ce5('0x65')](_0x3d3e4a[_0x5ae2f8]);});}delete _0x577f33[_0x2ce5('0x63')];});return _0x3c4274;});}function countFilteredContacts(_0xa2a41,_0x4c5059){var _0x3f7815=_0xa2a41[_0x2ce5('0x66')]();_0x3f7815[_0x2ce5('0x1e')](_0x2ce5('0x67'));_0x3f7815=applyJoinClauses(_0x3f7815,!![]);_0xa2a41[_0x2ce5('0x54')](_0x2ce5('0x51'));var _0x489291=utils['getSelectedTags'](_0x4c5059);if(!_[_0x2ce5('0x68')](_0x489291)){_0x3f7815['where']('t.id\x20IN\x20?',_0x489291);}var _0x37c65a={'type':db['Sequelize'][_0x2ce5('0x5e')][_0x2ce5('0x5f')],'raw':!![]};return db[_0x2ce5('0x61')][_0x2ce5('0x62')](_0x3f7815['toString'](),_0x37c65a)[_0x2ce5('0x4b')](function(_0x5ef530){return _0x5ef530[0x0]['COUNT(*)'];});}module[_0x2ce5('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x135a=['createdAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','length','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','start','end','Tag','map','clause','and','tags','user','uc.UserId\x20=\x20?','Contact','User','c.ListId\x20IN\x20?','\x20=\x20?','resolve','then','fields','filter','role','c.ListId\x20IS\x20NULL','attributes','limit','offset','subqry.id','order','DESC','findAll','color','keyBy','Sequelize','SELECT','CmContact','sequelize','toString','Tags','clone','COUNT(*)','c.id','isEmpty','where','QueryTypes','query','exports','lodash','squel','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','true','select','from','cm_contacts','subqry','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','fax','ListId','CompanyId'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0x135a,0xb1));var _0xa135=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x135a[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xa135('0x0'));var squel=require(_0xa135('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xa135('0x2'));var utils=require(_0xa135('0x3'));var db=require(_0xa135('0x4'))['db'];function skipContactsQuery(_0x1ad707,_0x4a1e57){var _0x3936f9=![];if(_0x1ad707['role']===_0xa135('0x5')&&!_0x4a1e57[_0xa135('0x6')]&&!_0x4a1e57['ListId']&&_0x4a1e57['autocomplete']!==_0xa135('0x7')){_0x3936f9=!![];}return _0x3936f9;}function getContactsSubquery(){return squel[_0xa135('0x8')]()[_0xa135('0x9')](_0xa135('0xa'),'c')['where']('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x4df3a5,_0x3bfff0){var _0x180342=_0x3bfff0?'c':_0xa135('0xb');_0x4df3a5['left_join'](_0xa135('0xc'),'uc','uc.CmContactId\x20=\x20'+_0x180342+_0xa135('0xd'))['left_join'](_0xa135('0xe'),'ct',_0xa135('0xf')+_0x180342+'.id')['left_join'](_0xa135('0x10'),'t',_0xa135('0x11'));return _0x4df3a5;}function addFieldsToQuery(_0x13185e,_0x135533,_0x4e1401,_0x3b2b88,_0x5114b1){var _0x5907e3=_0x5114b1?'c':_0xa135('0xb');if(!_0x135533){_0x135533=['id',_0xa135('0x12'),'lastName',_0xa135('0x13'),'mobile',_0xa135('0x14'),'email',_0xa135('0x15'),_0xa135('0x16'),_0xa135('0x17'),'updatedAt',_0xa135('0x18'),_0xa135('0x19')];}else if(!_0x135533[_0xa135('0x1a')]('id')){_0x135533[_0xa135('0x1b')]('id');}var _0x4ba917=_0x4e1401&&_0x5114b1||!_0x4e1401&&!_0x5114b1;if(_0x3b2b88){_0x4ba917=_0x3b2b88&&_0x5114b1||!_0x3b2b88&&!_0x5114b1;}_0x135533[_0xa135('0x1c')](function(_0x289083){if(_0x289083===_0xa135('0x19')){if(_0x4ba917){_0x13185e[_0xa135('0x1d')](_0xa135('0x1e'),_0x289083);}else if(_0x4e1401||_0x3b2b88){_0x13185e[_0xa135('0x1d')](_0x5907e3+'.'+_0x289083);}}else{_0x13185e[_0xa135('0x1d')](_0x5907e3+'.'+_0x289083);}});return _0x13185e;}function getSqlClauses(){var _0x13e4ff={'default':squel[_0xa135('0x1f')](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0xa135('0x1f')](),'skip':![]}};return _0x13e4ff;}function parseTagParameter(_0x54c7a5){var _0x456031=squel[_0xa135('0x1f')]();if(_0x54c7a5){var _0x10dbaa=utils[_0xa135('0x20')](_0x54c7a5);_0x10dbaa[_0xa135('0x1c')](function(_0x2d7732){_0x456031['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d7732+',%');});}return _0x456031;}function parseSearchFilter(_0x3ed706){var _0x42e75a=squel[_0xa135('0x1f')]();if(_0x3ed706){var _0x70ea6b=_0x3ed706[_0xa135('0x21')]('\x5c','\x5c\x5c')[_0xa135('0x21')](/'/g,'\x27\x27');if(_0x70ea6b[_0xa135('0x22')]('\x20')['length']>0x1){_0x42e75a['or'](_0xa135('0x23'),qs[_0xa135('0x24')](_0x70ea6b,!![]),null);}else{if(qs['isNumeric'](_0x70ea6b)){_0x42e75a['or'](_0xa135('0x25'),_0x70ea6b+'%');_0x42e75a['or'](_0xa135('0x26'),_0x70ea6b+'%');_0x42e75a['or'](_0xa135('0x27'),_0x70ea6b+'%');_0x42e75a['or'](_0xa135('0x28'),_0x70ea6b+'%');}else if(qs[_0xa135('0x29')](_0x70ea6b)){_0x42e75a['or'](_0xa135('0x2a'),_0x70ea6b+'%');}else{_0x42e75a['or']('c.firstName\x20LIKE\x20?','%'+_0x70ea6b+'%');_0x42e75a['or'](_0xa135('0x2b'),'%'+_0x70ea6b+'%');_0x42e75a['or'](_0xa135('0x2a'),'%'+_0x70ea6b+'%');}}}return _0x42e75a;}function parseAdvancedSearchFilter(_0x46b1a6,_0x3182a5){var _0x46fbee=getSqlClauses();var _0x6cb61d=as['parseSearch'](_0x46b1a6);var _0x382fa6=_0x6cb61d[_0xa135('0x2c')];for(var _0x22d108=0x0;_0x22d108<_0x6cb61d[_0xa135('0x2d')][_0xa135('0x2e')];_0x22d108++){var _0x36f185=_0x6cb61d[_0xa135('0x2d')][_0x22d108];var _0x39b8bf='c';var _0x58cb02=_['find'](_0x3182a5,[_0xa135('0x2f'),_0x36f185[_0xa135('0x1d')]]);if(_0x58cb02){if(_0x36f185[_0xa135('0x1d')]===_0xa135('0x30')||_0x58cb02[_0xa135('0x31')]===_0xa135('0x32')){_0x36f185[_0xa135('0x33')]=_0xa135('0x34');}var _0x2e5214=as[_0xa135('0x35')](_0x39b8bf,_0x58cb02[_0xa135('0x36')],_0x36f185);_0x46fbee[_0xa135('0x37')][_0x382fa6](_0x2e5214[_0xa135('0x38')],_0x2e5214[_0xa135('0x39')][_0xa135('0x3a')],_0x2e5214['value'][_0xa135('0x3b')]);}else{if(_0x36f185['field']===_0xa135('0x3c')){var _0x55251e=_0x36f185[_0xa135('0x39')][_0xa135('0x22')](',')[_0xa135('0x3d')](function(_0x5e9bf2){return Number(_0x5e9bf2);});var _0x4773df=parseTagParameter(_0x55251e);_0x46fbee['tags'][_0xa135('0x3e')][_0xa135('0x3f')](_0x4773df);_0x46fbee[_0xa135('0x40')]['ids']=_0x55251e;}else if(_0x36f185[_0xa135('0x1d')]==='User'){_0x46fbee[_0xa135('0x41')][_0xa135('0x3e')][_0xa135('0x3f')](_0xa135('0x42'),_0x36f185[_0xa135('0x39')]);_0x46fbee['user']['skip']=!![];}}}return _0x46fbee;}function parseModelFields(_0x5ab7a6,_0x51dfbf){var _0x26a6a2=squel['expr']();var _0x50a611=_(_0x5ab7a6)['keys']()[_0xa135('0x3d')](function(_0x21b02f){return _['some'](_0x51dfbf,[_0xa135('0x2f'),_0x21b02f])?_0x21b02f:undefined;})['compact']()['value']();if(_0x5ab7a6[_0xa135('0x43')]){_0x50a611[_0xa135('0x1b')](_0xa135('0x43'));}if(_0x5ab7a6['User']){_0x50a611[_0xa135('0x1b')](_0xa135('0x44'));}if(_0x50a611[_0xa135('0x2e')]>0x0){_0x50a611[_0xa135('0x1c')](function(_0x5e3440){if(_0x5e3440===_0xa135('0x15')){_0x26a6a2[_0xa135('0x3f')](_0xa135('0x45'),[]['concat'](_0x5ab7a6[_0x5e3440]));}else if(_0x5e3440===_0xa135('0x43')){var _0x575d31='%'+_0x5ab7a6[_0x5e3440]+'%';_0x26a6a2[_0xa135('0x3f')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x575d31);}else if(_0x5e3440===_0xa135('0x44')){_0x26a6a2[_0xa135('0x3f')](_0xa135('0x42'),_0x5ab7a6[_0x5e3440]);}else{_0x26a6a2[_0xa135('0x3f')]('c.'+_0x5e3440+_0xa135('0x46'),_0x5ab7a6[_0x5e3440]);}});}return _0x26a6a2;}function parseQueryParameters(_0x4e6e11,_0x4812a4){var _0x190c8e=getSqlClauses();return Promise[_0xa135('0x47')]()[_0xa135('0x48')](function(){return parseModelFields(_0x4e6e11,_0x4812a4);})[_0xa135('0x48')](function(_0x2e02f3){_0x190c8e[_0xa135('0x49')][_0xa135('0x3f')](_0x2e02f3);return parseTagParameter(_0x4e6e11['tag']);})['then'](function(_0x15dc3b){_0x190c8e['tags'][_0xa135('0x3e')][_0xa135('0x3f')](_0x15dc3b);return parseSearchFilter(_0x4e6e11[_0xa135('0x4a')]);})[_0xa135('0x48')](function(_0x53625e){_0x190c8e['filter']=_0x53625e;return _0x190c8e;});}function checkListsRestrictions(_0x575c5a,_0x41511d,_0x11d905){var _0x52495f=squel[_0xa135('0x1f')]();return Promise[_0xa135('0x47')]()['then'](function(){if(_0x41511d[_0xa135('0x6')]&&_0x575c5a[_0xa135('0x4b')]===_0xa135('0x5')&&!_0x11d905){return _0x575c5a['getLists']({'attributes':['id'],'raw':!![]});}})[_0xa135('0x48')](function(_0x5624c2){if(_0x5624c2){if(_0x5624c2['length']===0x0){_0x52495f['and'](_0xa135('0x4c'));}else{_0x52495f[_0xa135('0x3f')]('c.ListId\x20IN\x20?',_[_0xa135('0x3d')](_0x5624c2,'id'));}}})[_0xa135('0x48')](function(){return _0x52495f;});}function buildContactsQuery(_0x5f3936,_0x426fe9,_0x58db91,_0x4a5ed8,_0x29ea43,_0x217df5){if(_0x426fe9){_0x426fe9=_0x58db91[_0xa135('0x4d')];}_0x5f3936=addFieldsToQuery(_0x5f3936,_0x426fe9,_0x4a5ed8,_0x217df5,!![]);var _0x1d7514=squel[_0xa135('0x8')]();_0x1d7514=addFieldsToQuery(_0x1d7514,_0x426fe9,_0x4a5ed8,_0x217df5,![]);if(_0x4a5ed8||_0x217df5){_0x5f3936=applyJoinClauses(_0x5f3936,!![]);_0x5f3936['group']('c.id');if(_0x58db91[_0xa135('0x4e')]){_0x1d7514[_0xa135('0x4e')](_0x58db91[_0xa135('0x4e')]);}if(_0x58db91['offset']){_0x1d7514[_0xa135('0x4f')](_0x58db91['offset']);}}else{_0x1d7514=applyJoinClauses(_0x1d7514,![]);_0x1d7514['group'](_0xa135('0x50'));if(_0x58db91[_0xa135('0x4e')]){_0x5f3936[_0xa135('0x4e')](_0x58db91[_0xa135('0x4e')]);}if(_0x58db91[_0xa135('0x4f')]){_0x5f3936[_0xa135('0x4f')](_0x58db91[_0xa135('0x4f')]);}}_0x1d7514['having'](_0x29ea43);if(_0x58db91['order']){_0x58db91[_0xa135('0x51')][_0xa135('0x1c')](function(_0x433c85){_0x5f3936[_0xa135('0x51')]('c.'+_0x433c85[0x0],_0x433c85[0x1]===_0xa135('0x52')?![]:!![]);_0x1d7514['order']('subqry.'+_0x433c85[0x0],_0x433c85[0x1]===_0xa135('0x52')?![]:!![]);});}_0x1d7514[_0xa135('0x9')](_0x5f3936,_0xa135('0xb'));return _0x1d7514;}function getFilteredContacts(_0x4f78ea){var _0x1386f4=[];return db[_0xa135('0x3c')][_0xa135('0x53')]({'attributes':['id','name',_0xa135('0x54')],'raw':!![]})['then'](function(_0x18a6b7){_0x1386f4=_[_0xa135('0x55')](_0x18a6b7,'id');var _0x5171b9={'type':db[_0xa135('0x56')]['QueryTypes'][_0xa135('0x57')],'model':db[_0xa135('0x58')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xa135('0x59')]['query'](_0x4f78ea[_0xa135('0x5a')](),_0x5171b9);})['then'](function(_0x86e0e4){_0x86e0e4[_0xa135('0x1c')](function(_0x598f6d){if(_0x598f6d[_0xa135('0x19')]){_0x598f6d[_0xa135('0x5b')]=[];_0x598f6d[_0xa135('0x19')][_0xa135('0x22')](',')[_0xa135('0x1c')](function(_0x5070eb){_0x598f6d[_0xa135('0x5b')][_0xa135('0x1b')](_0x1386f4[_0x5070eb]);});}delete _0x598f6d['TagIds'];});return _0x86e0e4;});}function countFilteredContacts(_0xa1d60,_0x4af9b0){var _0x56c5f1=_0xa1d60[_0xa135('0x5c')]();_0x56c5f1[_0xa135('0x1d')](_0xa135('0x5d'));_0x56c5f1=applyJoinClauses(_0x56c5f1,!![]);_0xa1d60['group'](_0xa135('0x5e'));var _0x1a69b9=utils['getSelectedTags'](_0x4af9b0);if(!_[_0xa135('0x5f')](_0x1a69b9)){_0x56c5f1[_0xa135('0x60')]('t.id\x20IN\x20?',_0x1a69b9);}var _0x3a1258={'type':db[_0xa135('0x56')][_0xa135('0x61')][_0xa135('0x57')],'raw':!![]};return db[_0xa135('0x59')][_0xa135('0x62')](_0x56c5f1[_0xa135('0x5a')](),_0x3a1258)[_0xa135('0x48')](function(_0x2bf2dc){return _0x2bf2dc[0x0]['COUNT(*)'];});}module[_0xa135('0x63')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 97b9660..6b341d7 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 _0x12cc=['decryptString','createDecipher','base64','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','binary','write','end','final','close','unlink','decryptFile','data','update','encryptString','secret','utf8'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x12cc,0x135));var _0xc12c=function(_0x47f35d,_0x402937){_0x47f35d=_0x47f35d-0x0;var _0x4fcc32=_0x12cc[_0x47f35d];return _0x4fcc32;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xc12c('0x0'));var _=require(_0xc12c('0x1'));var config=require(_0xc12c('0x2'));var logger=require('../../config/logger')(_0xc12c('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc12c('0x4')][_0xc12c('0x5')],'algorithm':_0xc12c('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0xc12c('0x7')]&&config[_0xc12c('0x7')][_0xc12c('0x8')]){var isSupported=isAlgorithmSupported(config[_0xc12c('0x7')][_0xc12c('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0xc12c('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc12c('0x9')](',\x20');logger[_0xc12c('0xa')](config[_0xc12c('0x7')][_0xc12c('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x2e91c0){return AES_SUPPORTED_RX[_0xc12c('0xb')](_0x2e91c0);}function getSupportedCiphers(){return crypto[_0xc12c('0xc')]()[_0xc12c('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x5f514a){return getSupportedCiphers()[_0xc12c('0xe')](_0x5f514a)>-0x1;}function combineOptions(_0x234f41){var _0xccf1ee={};for(var _0x1d1b7a in fileOptions){if(fileOptions[_0xc12c('0xf')](_0x1d1b7a)){_0xccf1ee[_0x1d1b7a]=fileOptions[_0x1d1b7a];}}if(_0x234f41){for(var _0x4f0131 in _0x234f41){if(_0x234f41['hasOwnProperty'](_0x4f0131)){_0xccf1ee[_0x4f0131]=_0x234f41[_0x4f0131];}}}return _0xccf1ee;}exports['encryptFile']=function(_0x825782,_0x239a10,_0x1e7a98,_0x52c27a){return new BPromise(function(_0x392305,_0x3b1cad){_0x52c27a=combineOptions(_0x52c27a);var _0x396909=new Buffer(_0x1e7a98);var _0x2acb67=fs[_0xc12c('0x10')](_0x825782);var _0x1011bf=fs[_0xc12c('0x11')](_0x239a10);var _0x60a551=crypto[_0xc12c('0x12')](_0x52c27a[_0xc12c('0x8')],_0x396909);_0x2acb67['on']('data',function(_0xf9ca90){var _0x336c61=new Buffer(_0x60a551['update'](_0xf9ca90),_0xc12c('0x13'));_0x1011bf[_0xc12c('0x14')](_0x336c61);});_0x2acb67['on'](_0xc12c('0x15'),function(){try{var _0x203bed=new Buffer(_0x60a551[_0xc12c('0x16')](_0xc12c('0x13')),_0xc12c('0x13'));_0x1011bf[_0xc12c('0x14')](_0x203bed);_0x1011bf['end']();_0x1011bf['on'](_0xc12c('0x17'),function(){return _0x392305(_0x239a10);});}catch(_0x170149){fs[_0xc12c('0x18')](_0x239a10);return _0x3b1cad(_0x170149);}});});};exports[_0xc12c('0x19')]=function(_0x2bd466,_0x314a2f,_0x39a235,_0x575409){return new BPromise(function(_0x4b77de,_0x34d967){_0x575409=combineOptions(_0x575409);var _0x46941e=new Buffer(_0x39a235);var _0x50f68e=fs['createReadStream'](_0x2bd466);var _0x20f8cf=fs['createWriteStream'](_0x314a2f);var _0x37b9fb=crypto['createDecipher'](_0x575409[_0xc12c('0x8')],_0x46941e);_0x50f68e['on'](_0xc12c('0x1a'),function(_0x546661){var _0x19d6c6=new Buffer(_0x37b9fb[_0xc12c('0x1b')](_0x546661),_0xc12c('0x13'));_0x20f8cf[_0xc12c('0x14')](_0x19d6c6);});_0x50f68e['on'](_0xc12c('0x15'),function(){try{var _0x3dac9a=new Buffer(_0x37b9fb[_0xc12c('0x16')]('binary'),'binary');_0x20f8cf[_0xc12c('0x14')](_0x3dac9a);_0x20f8cf[_0xc12c('0x15')]();_0x20f8cf['on']('close',function(){return _0x4b77de(_0x314a2f);});}catch(_0x1034a3){fs[_0xc12c('0x18')](_0x314a2f);return _0x34d967(_0x1034a3);}});});};exports[_0xc12c('0x1c')]=function(_0x33274d,_0x26dbab,_0x458e53){var _0x1beba8=_0x458e53||stringOptions[_0xc12c('0x8')];var _0x2e4cee=_0x26dbab||stringOptions[_0xc12c('0x1d')];var _0x22a285=crypto[_0xc12c('0x12')](_0x1beba8,_0x2e4cee);var _0x405ae0=_0x22a285[_0xc12c('0x1b')](_0x33274d,_0xc12c('0x1e'),'base64');_0x405ae0+=_0x22a285[_0xc12c('0x16')]('base64');return _0x405ae0;};exports[_0xc12c('0x1f')]=function(_0x1415c3,_0x54b0fd,_0x27a142){var _0x62757d=_0x27a142||stringOptions[_0xc12c('0x8')];var _0x206eae=_0x54b0fd||stringOptions[_0xc12c('0x1d')];var _0x114dc7=crypto[_0xc12c('0x20')](_0x62757d,_0x206eae);var _0x5a491c=_0x114dc7[_0xc12c('0x1b')](_0x1415c3,_0xc12c('0x21'),_0xc12c('0x1e'));_0x5a491c+=_0x114dc7[_0xc12c('0x16')](_0xc12c('0x1e'));return _0x5a491c;}; \ No newline at end of file +var _0xb4a5=['decryptFile','end','close','secret','utf8','base64','decryptString','bluebird','lodash','app','secrets','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','final'];(function(_0xfaad9e,_0x50ed64){var _0x255539=function(_0x28ffb4){while(--_0x28ffb4){_0xfaad9e['push'](_0xfaad9e['shift']());}};_0x255539(++_0x50ed64);}(_0xb4a5,0x173));var _0x5b4a=function(_0x288eb2,_0x2e2289){_0x288eb2=_0x288eb2-0x0;var _0x22abd6=_0xb4a5[_0x288eb2];return _0x22abd6;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x5b4a('0x0'));var _=require(_0x5b4a('0x1'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x5b4a('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5b4a('0x3')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0x5b4a('0x4')]&&config['encrypt'][_0x5b4a('0x5')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x5b4a('0x5')]);if(isSupported){fileOptions[_0x5b4a('0x5')]=config[_0x5b4a('0x4')][_0x5b4a('0x5')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x5b4a('0x6')](',\x20');logger['error'](config[_0x5b4a('0x4')][_0x5b4a('0x5')],_0x5b4a('0x7'),supportedAlgorithms);}}function isASupportedCipher(_0x4362ac){return AES_SUPPORTED_RX[_0x5b4a('0x8')](_0x4362ac);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x5b4a('0x9')](isASupportedCipher);}function isAlgorithmSupported(_0x2d6092){return getSupportedCiphers()[_0x5b4a('0xa')](_0x2d6092)>-0x1;}function combineOptions(_0x5a8e72){var _0x259f04={};for(var _0x313639 in fileOptions){if(fileOptions[_0x5b4a('0xb')](_0x313639)){_0x259f04[_0x313639]=fileOptions[_0x313639];}}if(_0x5a8e72){for(var _0x45340d in _0x5a8e72){if(_0x5a8e72[_0x5b4a('0xb')](_0x45340d)){_0x259f04[_0x45340d]=_0x5a8e72[_0x45340d];}}}return _0x259f04;}exports[_0x5b4a('0xc')]=function(_0x20c615,_0x3650e6,_0x5c5493,_0x8c76ea){return new BPromise(function(_0xb08f22,_0x16ecba){_0x8c76ea=combineOptions(_0x8c76ea);var _0x4e5ccc=new Buffer(_0x5c5493);var _0x17bf09=fs[_0x5b4a('0xd')](_0x20c615);var _0x4b0174=fs[_0x5b4a('0xe')](_0x3650e6);var _0x5ca4d3=crypto[_0x5b4a('0xf')](_0x8c76ea[_0x5b4a('0x5')],_0x4e5ccc);_0x17bf09['on'](_0x5b4a('0x10'),function(_0x2df5ff){var _0x29fc1e=new Buffer(_0x5ca4d3[_0x5b4a('0x11')](_0x2df5ff),_0x5b4a('0x12'));_0x4b0174[_0x5b4a('0x13')](_0x29fc1e);});_0x17bf09['on']('end',function(){try{var _0x2ea9bf=new Buffer(_0x5ca4d3[_0x5b4a('0x14')](_0x5b4a('0x12')),_0x5b4a('0x12'));_0x4b0174['write'](_0x2ea9bf);_0x4b0174['end']();_0x4b0174['on']('close',function(){return _0xb08f22(_0x3650e6);});}catch(_0x3acb16){fs['unlink'](_0x3650e6);return _0x16ecba(_0x3acb16);}});});};exports[_0x5b4a('0x15')]=function(_0x2c384c,_0x184706,_0x217d66,_0x34e59b){return new BPromise(function(_0xf0455a,_0x51a90e){_0x34e59b=combineOptions(_0x34e59b);var _0x90fb80=new Buffer(_0x217d66);var _0x54aafb=fs['createReadStream'](_0x2c384c);var _0x4a08bc=fs['createWriteStream'](_0x184706);var _0x4afec=crypto['createDecipher'](_0x34e59b['algorithm'],_0x90fb80);_0x54aafb['on'](_0x5b4a('0x10'),function(_0x42f44b){var _0x481544=new Buffer(_0x4afec['update'](_0x42f44b),_0x5b4a('0x12'));_0x4a08bc[_0x5b4a('0x13')](_0x481544);});_0x54aafb['on'](_0x5b4a('0x16'),function(){try{var _0x532602=new Buffer(_0x4afec['final'](_0x5b4a('0x12')),_0x5b4a('0x12'));_0x4a08bc[_0x5b4a('0x13')](_0x532602);_0x4a08bc[_0x5b4a('0x16')]();_0x4a08bc['on'](_0x5b4a('0x17'),function(){return _0xf0455a(_0x184706);});}catch(_0x7a9019){fs['unlink'](_0x184706);return _0x51a90e(_0x7a9019);}});});};exports['encryptString']=function(_0x2e2e98,_0x22e344,_0xa9a49e){var _0x32159a=_0xa9a49e||stringOptions['algorithm'];var _0x218020=_0x22e344||stringOptions[_0x5b4a('0x18')];var _0x24b6b0=crypto[_0x5b4a('0xf')](_0x32159a,_0x218020);var _0x4ded99=_0x24b6b0[_0x5b4a('0x11')](_0x2e2e98,_0x5b4a('0x19'),_0x5b4a('0x1a'));_0x4ded99+=_0x24b6b0[_0x5b4a('0x14')](_0x5b4a('0x1a'));return _0x4ded99;};exports[_0x5b4a('0x1b')]=function(_0x35d113,_0x208afa,_0x1e1f27){var _0x34534c=_0x1e1f27||stringOptions[_0x5b4a('0x5')];var _0x323977=_0x208afa||stringOptions['secret'];var _0x321567=crypto['createDecipher'](_0x34534c,_0x323977);var _0x10493c=_0x321567['update'](_0x35d113,_0x5b4a('0x1a'),_0x5b4a('0x19'));_0x10493c+=_0x321567[_0x5b4a('0x14')](_0x5b4a('0x19'));return _0x10493c;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 4ff6468..ab52ee9 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 _0x2fed=['inspect','Failed','exit','path','to-csv','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','splitSizeCsv','then','sequelize','query','QueryTypes','num','Empty','split','length','range','SELECT','push','dirname','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch'];(function(_0x3f6694,_0x53d659){var _0x51bcae=function(_0x106749){while(--_0x106749){_0x3f6694['push'](_0x3f6694['shift']());}};_0x51bcae(++_0x53d659);}(_0x2fed,0xdf));var _0xd2fe=function(_0x24e1b6,_0x5218e6){_0x24e1b6=_0x24e1b6-0x0;var _0x367b07=_0x2fed[_0x24e1b6];return _0x367b07;};'use strict';var util=require('util');var path=require(_0xd2fe('0x0'));var _=require('lodash');var csv=require(_0xd2fe('0x1'));var fs=require('fs');var BPromise=require(_0xd2fe('0x2'));var zipdir=require(_0xd2fe('0x3'));var rimraf=require('rimraf');var db=require(_0xd2fe('0x4'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xd2fe('0x5'))(_0xd2fe('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xd2fe('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x83def5,_0x47f484){var _0x311e73={'status':_0x83def5};var _0x4817b1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x47f484){_0x311e73['savename']=_0x47f484;}return db[_0xd2fe('0x8')][_0xd2fe('0x9')](_0x311e73,_0x4817b1);}function main(){var _0x1ac497=0x1388;var _0x30507a;logger[_0xd2fe('0xa')](util[_0xd2fe('0xb')](_0xd2fe('0xc'),EXTRACTED_REPORT_ID,_0xd2fe('0xd')));return db['Setting'][_0xd2fe('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd2fe('0xf')]})['then'](function(_0x313958){if(_0x313958){_0x30507a=_0x313958;_0x1ac497=_0x30507a['splitSizeCsv']||0x1388;}})[_0xd2fe('0x10')](function(){return dbH[_0xd2fe('0x11')][_0xd2fe('0x12')](util[_0xd2fe('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xd2fe('0x11')][_0xd2fe('0x13')]['SELECT']});})[_0xd2fe('0x10')](function(_0x1565dc){if(!_0x1565dc[0x0][_0xd2fe('0x14')]){return analyticExtractedReport(_0xd2fe('0x15'));}var _0x120b5a=[];var _0x5b3cf0=0x0;if(_0x30507a[_0xd2fe('0x16')]){if(_0x1565dc&&_0x1565dc[_0xd2fe('0x17')]){var _0x239ea2=_[_0xd2fe('0x18')](_0x1565dc[0x0][_0xd2fe('0x14')]/_0x1ac497);var _0x35b87d=Number['isInteger'](_0x1565dc[0x0][_0xd2fe('0x14')]/_0x1ac497)?_0x1565dc[0x0]['num']%_0x1ac497:0x0;_0x239ea2['forEach'](function(_0x197da9){if(_0x197da9>0x0){_0x5b3cf0+=_0x1ac497;}_0x120b5a['push'](dbH['sequelize'][_0xd2fe('0x12')](util[_0xd2fe('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1ac497,_0x5b3cf0),{'type':dbH[_0xd2fe('0x11')]['QueryTypes'][_0xd2fe('0x19')]}));});if(_0x35b87d>0x0){_0x5b3cf0+=_0x1ac497;_0x120b5a[_0xd2fe('0x1a')](dbH[_0xd2fe('0x11')][_0xd2fe('0x12')](util[_0xd2fe('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x35b87d,_0x5b3cf0),{'type':dbH[_0xd2fe('0x11')][_0xd2fe('0x13')][_0xd2fe('0x19')]}));}}}else{_0x120b5a[_0xd2fe('0x1a')](dbH[_0xd2fe('0x11')][_0xd2fe('0x12')](QUERY,{'type':dbH[_0xd2fe('0x11')][_0xd2fe('0x13')][_0xd2fe('0x19')]}));}var _0x296a64=path[_0xd2fe('0x1b')](PATH);var _0x538c30=path['basename'](PATH,'.csv');var _0x246c7c=_0x30507a[_0xd2fe('0x16')]&&_0x120b5a[_0xd2fe('0x17')]>0x1;var _0x48292a=[];if(!fs[_0xd2fe('0x1c')](path['join'](_0x296a64,_0x538c30))&&_0x246c7c){fs[_0xd2fe('0x1d')](path[_0xd2fe('0x1e')](_0x296a64,_0x538c30));}return BPromise[_0xd2fe('0x1f')](_0x120b5a,function(_0x3acb51){_0x48292a[_0xd2fe('0x1a')](_0x3acb51);})['then'](function(){for(var _0x37b2a7=0x0;_0x37b2a7<_0x48292a[_0xd2fe('0x17')];_0x37b2a7+=0x1){var _0x3d5d12;var _0x55301b=_0x48292a[_0x37b2a7];if(_0x246c7c){_0x3d5d12=path[_0xd2fe('0x1e')](_0x296a64,_0x538c30,util[_0xd2fe('0xb')](_0xd2fe('0x20'),_0x538c30,_0x37b2a7,_0xd2fe('0x21')));}else{_0x3d5d12=path['join'](_0x296a64,util[_0xd2fe('0xb')](_0xd2fe('0x22'),_0x538c30,_0xd2fe('0x21')));}fs[_0xd2fe('0x23')](_0x3d5d12,csv(_0x55301b));}})[_0xd2fe('0x10')](function(){if(_0x246c7c){return new Promise(function(_0x54c320){zipdir(path[_0xd2fe('0x1e')](_0x296a64,_0x538c30),{'saveTo':path[_0xd2fe('0x1e')](_0x296a64,util[_0xd2fe('0xb')]('%s.%s',_0x538c30,_0xd2fe('0x24')))},function(_0x6ebcad,_0x566184){rimraf(path['join'](_0x296a64,_0x538c30),function(){});_0x54c320(_0xd2fe('0x25'));});});}})['then'](function(){logger['info'](util[_0xd2fe('0xb')](_0xd2fe('0x26'),EXTRACTED_REPORT_ID,_0xd2fe('0xd')));return analyticExtractedReport(_0xd2fe('0x27'),_0x246c7c?util[_0xd2fe('0xb')](_0xd2fe('0x22'),_0x538c30,_0x246c7c?_0xd2fe('0x24'):_0xd2fe('0x21')):null);});})[_0xd2fe('0x28')](function(_0x373000){logger[_0xd2fe('0xa')](util[_0xd2fe('0xb')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd2fe('0xd')),util[_0xd2fe('0x29')](_0x373000,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd2fe('0x2a'));})['finally'](function(){process[_0xd2fe('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x35ed=['range','num','forEach','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','push','basename','existsSync','mkdirSync','join','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','to-csv','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length'];(function(_0x1daaa9,_0x220393){var _0x1dd221=function(_0x492c61){while(--_0x492c61){_0x1daaa9['push'](_0x1daaa9['shift']());}};_0x1dd221(++_0x220393);}(_0x35ed,0x1aa));var _0xd35e=function(_0x3bc505,_0x3e0639){_0x3bc505=_0x3bc505-0x0;var _0x5aa3ae=_0x35ed[_0x3bc505];return _0x5aa3ae;};'use strict';var util=require(_0xd35e('0x0'));var path=require(_0xd35e('0x1'));var _=require(_0xd35e('0x2'));var csv=require(_0xd35e('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xd35e('0x4')];var logger=require(_0xd35e('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd35e('0x6')][0x2]);var QUERY=process[_0xd35e('0x6')][0x3];var PATH=process[_0xd35e('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5a01cd,_0x410872){var _0x361289={'status':_0x5a01cd};var _0x4db724={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x410872){_0x361289['savename']=_0x410872;}return db[_0xd35e('0x7')][_0xd35e('0x8')](_0x361289,_0x4db724);}function main(){var _0xe9875b=0x1388;var _0x4fd711;logger[_0xd35e('0x9')](util[_0xd35e('0xa')](_0xd35e('0xb'),EXTRACTED_REPORT_ID,_0xd35e('0xc')));return db[_0xd35e('0xd')][_0xd35e('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd35e('0xf'),_0xd35e('0x10')]})[_0xd35e('0x11')](function(_0x4a2563){if(_0x4a2563){_0x4fd711=_0x4a2563;_0xe9875b=_0x4fd711['splitSizeCsv']||0x1388;}})['then'](function(){return dbH['sequelize'][_0xd35e('0x12')](util[_0xd35e('0xa')](_0xd35e('0x13'),QUERY),{'type':dbH['sequelize'][_0xd35e('0x14')][_0xd35e('0x15')]});})[_0xd35e('0x11')](function(_0x9144ec){if(!_0x9144ec[0x0]['num']){return analyticExtractedReport(_0xd35e('0x16'));}var _0x352e42=[];var _0x43d7cd=0x0;if(_0x4fd711[_0xd35e('0xf')]){if(_0x9144ec&&_0x9144ec[_0xd35e('0x17')]){var _0x5238c0=_[_0xd35e('0x18')](_0x9144ec[0x0][_0xd35e('0x19')]/_0xe9875b);var _0x2d60c7=Number['isInteger'](_0x9144ec[0x0][_0xd35e('0x19')]/_0xe9875b)?_0x9144ec[0x0]['num']%_0xe9875b:0x0;_0x5238c0[_0xd35e('0x1a')](function(_0x94eeea){if(_0x94eeea>0x0){_0x43d7cd+=_0xe9875b;}_0x352e42['push'](dbH[_0xd35e('0x1b')]['query'](util[_0xd35e('0xa')](_0xd35e('0x1c'),QUERY,_0xe9875b,_0x43d7cd),{'type':dbH[_0xd35e('0x1b')][_0xd35e('0x14')][_0xd35e('0x15')]}));});if(_0x2d60c7>0x0){_0x43d7cd+=_0xe9875b;_0x352e42[_0xd35e('0x1d')](dbH[_0xd35e('0x1b')][_0xd35e('0x12')](util[_0xd35e('0xa')](_0xd35e('0x1c'),QUERY,_0x2d60c7,_0x43d7cd),{'type':dbH['sequelize'][_0xd35e('0x14')][_0xd35e('0x15')]}));}}}else{_0x352e42[_0xd35e('0x1d')](dbH[_0xd35e('0x1b')][_0xd35e('0x12')](QUERY,{'type':dbH[_0xd35e('0x1b')]['QueryTypes']['SELECT']}));}var _0x4d3fc3=path['dirname'](PATH);var _0x223819=path[_0xd35e('0x1e')](PATH,'.csv');var _0x371113=_0x4fd711['split']&&_0x352e42[_0xd35e('0x17')]>0x1;var _0x35605e=[];if(!fs[_0xd35e('0x1f')](path['join'](_0x4d3fc3,_0x223819))&&_0x371113){fs[_0xd35e('0x20')](path['join'](_0x4d3fc3,_0x223819));}return BPromise['each'](_0x352e42,function(_0x260965){_0x35605e[_0xd35e('0x1d')](_0x260965);})[_0xd35e('0x11')](function(){for(var _0x31f719=0x0;_0x31f719<_0x35605e[_0xd35e('0x17')];_0x31f719+=0x1){var _0x343909;var _0x3daca0=_0x35605e[_0x31f719];if(_0x371113){_0x343909=path[_0xd35e('0x21')](_0x4d3fc3,_0x223819,util['format'](_0xd35e('0x22'),_0x223819,_0x31f719,_0xd35e('0x23')));}else{_0x343909=path['join'](_0x4d3fc3,util[_0xd35e('0xa')](_0xd35e('0x24'),_0x223819,_0xd35e('0x23')));}fs[_0xd35e('0x25')](_0x343909,csv(_0x3daca0));}})[_0xd35e('0x11')](function(){if(_0x371113){return new Promise(function(_0x1519fc){zipdir(path[_0xd35e('0x21')](_0x4d3fc3,_0x223819),{'saveTo':path[_0xd35e('0x21')](_0x4d3fc3,util[_0xd35e('0xa')](_0xd35e('0x24'),_0x223819,_0xd35e('0x26')))},function(_0x2996b6,_0x1bfeb2){rimraf(path['join'](_0x4d3fc3,_0x223819),function(){});_0x1519fc('zip\x20finished');});});}})[_0xd35e('0x11')](function(){logger[_0xd35e('0x9')](util['format'](_0xd35e('0x27'),EXTRACTED_REPORT_ID,_0xd35e('0xc')));return analyticExtractedReport(_0xd35e('0x28'),_0x371113?util[_0xd35e('0xa')](_0xd35e('0x24'),_0x223819,_0x371113?_0xd35e('0x26'):'csv'):null);});})['catch'](function(_0x4d5cf4){logger['info'](util[_0xd35e('0xa')](_0xd35e('0x29'),EXTRACTED_REPORT_ID,'CSV'),util[_0xd35e('0x2a')](_0x4d5cf4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd35e('0x2b')](function(){process[_0xd35e('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 7dcbb58..fc1ade9 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 _0x9726=['argv','savename','update','map','toString','value','fill','auto','body','push','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','header','pageBreak','before','margin','\x20/\x20','footer','Arial','black','right','Empty','Setting','find','splitSizePdf','then','split','length','range','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','mkdirSync','join','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','pipe','createWriteStream','finish','createPdfFromHTML','lodash','path','moment','pdfmake/src/printer','zip-dir','rimraf','window','bluebird','../../mysqldb','../../config/logger'];(function(_0x5c2748,_0x564960){var _0x59761d=function(_0x1ccb1a){while(--_0x1ccb1a){_0x5c2748['push'](_0x5c2748['shift']());}};_0x59761d(++_0x564960);}(_0x9726,0xf5));var _0x6972=function(_0x36846e,_0x2d29cd){_0x36846e=_0x36846e-0x0;var _0x5667ec=_0x9726[_0x36846e];return _0x5667ec;};'use strict';var _=require(_0x6972('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x6972('0x1'));var moment=require(_0x6972('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x6972('0x3'));var zipdir=require(_0x6972('0x4'));var rimraf=require(_0x6972('0x5'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0x6972('0x6')];var BPromise=require(_0x6972('0x7'));var db=require('../../mysqldb')['db'];var dbH=require(_0x6972('0x8'))['dbH'];var logger=require(_0x6972('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6972('0xa')][0x2]);var QUERY=process[_0x6972('0xa')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2bf935,_0x1c0bc6){var _0x4e626b={'status':_0x2bf935};var _0x1afb9d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c0bc6){_0x4e626b[_0x6972('0xb')]=_0x1c0bc6;}return db['AnalyticExtractedReport'][_0x6972('0xc')](_0x4e626b,_0x1afb9d);}function getHeaders(_0x195ec7){return _[_0x6972('0xd')](_0x195ec7,function(_0x2b1763){return{'text':_0x2b1763,'style':'tableHeader'};});}function getRows(_0x2f61dd,_0x15d5b4){return _[_0x6972('0xd')](_0x15d5b4,function(_0x58cef1){return _(_0x58cef1)['pick'](_0x2f61dd)[_0x6972('0xd')](function(_0x43b55f){return _0x43b55f?_[_0x6972('0xe')](_0x43b55f):'';})[_0x6972('0xf')]();});}function createTable(_0x5377bd,_0x597395){var _0x3b42ba={'widths':_[_0x6972('0x10')](Array(_0x5377bd['length']),0x91),'heights':function(_0x13098e){return _0x13098e===0x0?_0x6972('0x11'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x30b7e3=getHeaders(_0x5377bd);_0x3b42ba[_0x6972('0x12')][_0x6972('0x13')](_0x30b7e3);var _0x4a8815=getRows(_0x5377bd,_0x597395);_0x3b42ba[_0x6972('0x12')]=_0x3b42ba['body'][_0x6972('0x14')](_0x4a8815);return _0x3b42ba;}function createTables(_0x3e70db){var _0x1a0b3b=[];var _0x5d3dc0=_['chunk'](Object[_0x6972('0x15')](_0x3e70db[0x0]),0x5);_0x5d3dc0[_0x6972('0x16')](function(_0x50be95){_0x1a0b3b['push'](createTable(_0x50be95,_0x3e70db));});return _0x1a0b3b;}function getPDFDocDefinition(_0x420cc9){var _0x41230f=util[_0x6972('0x17')](_0x6972('0x18'),NAME,EXTRACTED_REPORT[_0x6972('0x19')],moment(EXTRACTED_REPORT['startDate'])[_0x6972('0x17')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x6972('0x17')](FORMAT));var _0x3b1d94=[];for(var _0x5c529b=0x0;_0x5c529b<_0x420cc9['length'];_0x5c529b++){var _0x218b03=[];if(_0x5c529b===0x0){_0x218b03[_0x6972('0x13')]({'text':_0x41230f,'style':_0x6972('0x1a')});}var _0x21d13c={'table':_0x420cc9[_0x5c529b]};if(_0x5c529b>0x0){_0x21d13c[_0x6972('0x1b')]=_0x6972('0x1c');_0x21d13c[_0x6972('0x1d')]=[0x0,0x46,0x0,0x0];}_0x218b03[_0x6972('0x13')](_0x21d13c);_0x3b1d94[_0x6972('0x13')](_0x218b03);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x3b1d94,'footer':function(_0x1f22b4,_0x1fefff){return{'text':_0x1f22b4[_0x6972('0xe')]()+_0x6972('0x1e')+_0x1fefff,'style':_0x6972('0x1f')};},'defaultStyle':{'font':_0x6972('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x6972('0x21')},'footer':{'alignment':_0x6972('0x22'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x54af4f){var _0xb89308=0x1388;var _0x2c7039;if(!_0x54af4f[0x0]['num']){return analyticExtractedReport(_0x6972('0x23'));}return db[_0x6972('0x24')][_0x6972('0x25')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6972('0x26')]})[_0x6972('0x27')](function(_0x4269be){if(_0x4269be){_0x2c7039=_0x4269be;_0xb89308=_0x2c7039[_0x6972('0x26')]||0x3e8;}})[_0x6972('0x27')](function(){var _0x11956b=[];var _0x1a86ff=0x0;if(_0x2c7039[_0x6972('0x28')]){if(_0x54af4f&&_0x54af4f[_0x6972('0x29')]){var _0x553bc6=_[_0x6972('0x2a')](_0x54af4f[0x0][_0x6972('0x2b')]/_0xb89308);var _0x489acc=Number[_0x6972('0x2c')](_0x54af4f[0x0]['num']/_0xb89308)?_0x54af4f[0x0][_0x6972('0x2b')]%_0xb89308:0x0;_0x553bc6[_0x6972('0x16')](function(_0x61116e){if(_0x61116e>0x0){_0x1a86ff+=_0xb89308;}_0x11956b[_0x6972('0x13')](dbH[_0x6972('0x2d')][_0x6972('0x2e')](util[_0x6972('0x17')](_0x6972('0x2f'),QUERY,_0xb89308,_0x1a86ff),{'type':dbH[_0x6972('0x2d')][_0x6972('0x30')]['SELECT']}));});if(_0x489acc>0x0){_0x1a86ff+=_0xb89308;_0x11956b[_0x6972('0x13')](dbH['sequelize'][_0x6972('0x2e')](util[_0x6972('0x17')](_0x6972('0x2f'),QUERY,_0x489acc,_0x1a86ff),{'type':dbH['sequelize'][_0x6972('0x30')][_0x6972('0x31')]}));}}}else{_0x11956b[_0x6972('0x13')](dbH[_0x6972('0x2d')][_0x6972('0x2e')](QUERY,{'type':dbH[_0x6972('0x2d')][_0x6972('0x30')][_0x6972('0x31')]}));}var _0x42e512=path[_0x6972('0x32')](PATH);var _0x2c0c06=path[_0x6972('0x33')](PATH,_0x6972('0x34'));var _0x5d265d=_0x2c7039[_0x6972('0x28')]&&_0x11956b['length']>0x1;var _0x2729a9=[];if(!fs[_0x6972('0x35')](path['join'](_0x42e512,_0x2c0c06))&&_0x5d265d){fs[_0x6972('0x36')](path[_0x6972('0x37')](_0x42e512,_0x2c0c06));}return BPromise['each'](_0x11956b,function(_0x1766ef){_0x2729a9['push'](_0x1766ef);})['then'](function(){var _0x1db7fc=[];for(var _0x29981f=0x0;_0x29981f<_0x2729a9[_0x6972('0x29')];_0x29981f+=0x1){var _0x184af6=_0x2729a9[_0x29981f];var _0x4196ce=createTables(_['flatten'](_0x184af6));var _0x503fc6;var _0x39993d=getPDFDocDefinition(_0x4196ce);var _0x4e4937=getPDFPrinter();var _0x1d7632=_0x4e4937[_0x6972('0x38')](_0x39993d);if(_0x5d265d){_0x503fc6=path['join'](_0x42e512,_0x2c0c06,util[_0x6972('0x17')](_0x6972('0x39'),_0x2c0c06,_0x29981f,'pdf'));}else{_0x503fc6=path[_0x6972('0x37')](_0x42e512,util[_0x6972('0x17')](_0x6972('0x3a'),_0x2c0c06,_0x6972('0x3b')));}_0x1db7fc[_0x6972('0x13')](writePDFDocument(_0x1d7632,_0x503fc6));}return Promise[_0x6972('0x3c')](_0x1db7fc);})['then'](function(){if(_0x5d265d){return new Promise(function(_0x56972b){zipdir(path[_0x6972('0x37')](_0x42e512,_0x2c0c06),{'saveTo':path['join'](_0x42e512,util[_0x6972('0x17')](_0x6972('0x3a'),_0x2c0c06,_0x6972('0x3d')))},function(){rimraf(path['join'](_0x42e512,_0x2c0c06),function(){});_0x56972b('zip\x20finished');});});}})[_0x6972('0x27')](function(){if(!_0x5d265d)return;rimraf(path[_0x6972('0x37')](_0x42e512,_0x2c0c06),function(){});})[_0x6972('0x27')](function(){logger[_0x6972('0x3e')](util[_0x6972('0x17')](_0x6972('0x3f'),EXTRACTED_REPORT_ID,_0x6972('0x40')));return analyticExtractedReport(_0x6972('0x41'),_0x5d265d?util[_0x6972('0x17')](_0x6972('0x3a'),_0x2c0c06,_0x5d265d?_0x6972('0x3d'):_0x6972('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x6972('0x17')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6972('0x40')));return db[_0x6972('0x42')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x6972('0x27')](function(_0x52dc8e){EXTRACTED_REPORT=_0x52dc8e;return dbH['sequelize'][_0x6972('0x2e')](util[_0x6972('0x17')](_0x6972('0x43'),QUERY),{'type':dbH[_0x6972('0x2d')][_0x6972('0x30')][_0x6972('0x31')]});})['then'](extractReport)['catch'](function(_0x1296bc){logger[_0x6972('0x3e')](util[_0x6972('0x17')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6972('0x40')),util[_0x6972('0x44')](_0x1296bc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6972('0x45'));})[_0x6972('0x46')](function(){process[_0x6972('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5c7155=new PdfPrinter({'Arial':{'normal':__dirname+_0x6972('0x48'),'bold':__dirname+_0x6972('0x49'),'italics':__dirname+_0x6972('0x4a'),'bolditalics':__dirname+_0x6972('0x4b')}});return _0x5c7155;}function getPDFDocDefinitionFromHTML(_0x22f4e9,_0x1eedb1){var _0x2a54a3=util[_0x6972('0x17')](_0x6972('0x4c'),_0x1eedb1[_0x6972('0x4d')],_0x1eedb1[_0x6972('0x4e')]);var _0x53fbb8=moment()['format'](_0x6972('0x4f'))[_0x6972('0xe')]();var _0x4f9ad7=htmlToPdfmake(_0x22f4e9,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4f9ad7],'defaultStyle':{'font':_0x6972('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x6972('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x6972('0x50'),'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':'header'}];},'footer':function(_0x34b7ad,_0x2ad908){return[{'text':util[_0x6972('0x17')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x2a54a3,_0x34b7ad,_0x2ad908,_0x53fbb8),'style':_0x6972('0x1f')}];}};}function writePDFDocument(_0x502a56,_0x53b427){return new Promise(function(_0x3baf30,_0x4a039e){var _0x27ae7d=_0x502a56[_0x6972('0x51')](fs[_0x6972('0x52')](_0x53b427));_0x27ae7d['on'](_0x6972('0x53'),function(){_0x3baf30(_0x6972('0x53'));});_0x27ae7d['on']('error',function(_0x498361){_0x4a039e(_0x498361);});_0x502a56['end']();});}exports[_0x6972('0x54')]=function(_0x591554,_0x6fc0df){var _0x22389c=getPDFPrinter();var _0x543ebc=getPDFDocDefinitionFromHTML(_0x591554,_0x6fc0df);var _0x47517f=_0x22389c[_0x6972('0x38')](_0x543ebc);return writePDFDocument(_0x47517f,_0x6fc0df[_0x6972('0x1')])['catch'](function(_0x20061d){throw _0x20061d;});}; \ No newline at end of file +var _0xfee8=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','finish','createPdfKitDocument','lodash','util','path','html-to-pdfmake','zip-dir','rimraf','JSDOM','window','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','value','fill','length','auto','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','push','header','margin','landscape','toString','footer','Arial','black','right','Empty','Setting','find','then','splitSizePdf','split','range','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','mkdirSync','each','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info','PDF','Completed'];(function(_0x4bad12,_0x129a95){var _0x506627=function(_0x595cc5){while(--_0x595cc5){_0x4bad12['push'](_0x4bad12['shift']());}};_0x506627(++_0x129a95);}(_0xfee8,0x1c1));var _0x8fee=function(_0x339c23,_0x541ff6){_0x339c23=_0x339c23-0x0;var _0x5bf134=_0xfee8[_0x339c23];return _0x5bf134;};'use strict';var _=require(_0x8fee('0x0'));var fs=require('fs');var util=require(_0x8fee('0x1'));var path=require(_0x8fee('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x8fee('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x8fee('0x4'));var rimraf=require(_0x8fee('0x5'));var JSDOM=require('jsdom')[_0x8fee('0x6')];var window=new JSDOM('')[_0x8fee('0x7')];var BPromise=require('bluebird');var db=require(_0x8fee('0x8'))['db'];var dbH=require(_0x8fee('0x8'))[_0x8fee('0x9')];var logger=require('../../config/logger')(_0x8fee('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x8fee('0xb')][0x2]);var QUERY=process[_0x8fee('0xb')][0x3];var PATH=process[_0x8fee('0xb')][0x4];var NAME=process[_0x8fee('0xb')][0x5];var FORMAT=_0x8fee('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1b28fa,_0x19cee5){var _0x37b356={'status':_0x1b28fa};var _0x5ca413={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x19cee5){_0x37b356[_0x8fee('0xd')]=_0x19cee5;}return db[_0x8fee('0xe')][_0x8fee('0xf')](_0x37b356,_0x5ca413);}function getHeaders(_0xc29777){return _[_0x8fee('0x10')](_0xc29777,function(_0xdffeb9){return{'text':_0xdffeb9,'style':'tableHeader'};});}function getRows(_0x581c7f,_0x411de5){return _[_0x8fee('0x10')](_0x411de5,function(_0x399b45){return _(_0x399b45)['pick'](_0x581c7f)[_0x8fee('0x10')](function(_0x252691){return _0x252691?_['toString'](_0x252691):'';})[_0x8fee('0x11')]();});}function createTable(_0x135394,_0x27abe8){var _0x550065={'widths':_[_0x8fee('0x12')](Array(_0x135394[_0x8fee('0x13')]),0x91),'heights':function(_0x2c7e13){return _0x2c7e13===0x0?_0x8fee('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x21198f=getHeaders(_0x135394);_0x550065[_0x8fee('0x15')]['push'](_0x21198f);var _0xc347dc=getRows(_0x135394,_0x27abe8);_0x550065[_0x8fee('0x15')]=_0x550065[_0x8fee('0x15')][_0x8fee('0x16')](_0xc347dc);return _0x550065;}function createTables(_0xb8f029){var _0x4bbc15=[];var _0x15bbb0=_[_0x8fee('0x17')](Object[_0x8fee('0x18')](_0xb8f029[0x0]),0x5);_0x15bbb0[_0x8fee('0x19')](function(_0x44cede){_0x4bbc15['push'](createTable(_0x44cede,_0xb8f029));});return _0x4bbc15;}function getPDFDocDefinition(_0x58c827){var _0x4dd2e2=util[_0x8fee('0x1a')](_0x8fee('0x1b'),NAME,EXTRACTED_REPORT[_0x8fee('0x1c')],moment(EXTRACTED_REPORT[_0x8fee('0x1d')])[_0x8fee('0x1a')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x8fee('0x1a')](FORMAT));var _0x44cc84=[];for(var _0x1eb4d9=0x0;_0x1eb4d9<_0x58c827['length'];_0x1eb4d9++){var _0x3c874d=[];if(_0x1eb4d9===0x0){_0x3c874d[_0x8fee('0x1e')]({'text':_0x4dd2e2,'style':_0x8fee('0x1f')});}var _0x3302dd={'table':_0x58c827[_0x1eb4d9]};if(_0x1eb4d9>0x0){_0x3302dd['pageBreak']='before';_0x3302dd[_0x8fee('0x20')]=[0x0,0x46,0x0,0x0];}_0x3c874d[_0x8fee('0x1e')](_0x3302dd);_0x44cc84[_0x8fee('0x1e')](_0x3c874d);}return{'pageSize':'A4','pageOrientation':_0x8fee('0x21'),'content':_0x44cc84,'footer':function(_0x2dc5a8,_0x42a937){return{'text':_0x2dc5a8[_0x8fee('0x22')]()+'\x20/\x20'+_0x42a937,'style':_0x8fee('0x23')};},'defaultStyle':{'font':_0x8fee('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x8fee('0x25')},'footer':{'alignment':_0x8fee('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3cb884){var _0x4f1e8c=0x1388;var _0x2a5857;if(!_0x3cb884[0x0]['num']){return analyticExtractedReport(_0x8fee('0x27'));}return db[_0x8fee('0x28')][_0x8fee('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0x8fee('0x2a')](function(_0x4ee414){if(_0x4ee414){_0x2a5857=_0x4ee414;_0x4f1e8c=_0x2a5857[_0x8fee('0x2b')]||0x3e8;}})[_0x8fee('0x2a')](function(){var _0x5b7fe3=[];var _0x1a45ed=0x0;if(_0x2a5857[_0x8fee('0x2c')]){if(_0x3cb884&&_0x3cb884[_0x8fee('0x13')]){var _0x126c7e=_[_0x8fee('0x2d')](_0x3cb884[0x0][_0x8fee('0x2e')]/_0x4f1e8c);var _0x48d87b=Number[_0x8fee('0x2f')](_0x3cb884[0x0]['num']/_0x4f1e8c)?_0x3cb884[0x0][_0x8fee('0x2e')]%_0x4f1e8c:0x0;_0x126c7e[_0x8fee('0x19')](function(_0x4317c6){if(_0x4317c6>0x0){_0x1a45ed+=_0x4f1e8c;}_0x5b7fe3[_0x8fee('0x1e')](dbH[_0x8fee('0x30')][_0x8fee('0x31')](util[_0x8fee('0x1a')](_0x8fee('0x32'),QUERY,_0x4f1e8c,_0x1a45ed),{'type':dbH[_0x8fee('0x30')][_0x8fee('0x33')][_0x8fee('0x34')]}));});if(_0x48d87b>0x0){_0x1a45ed+=_0x4f1e8c;_0x5b7fe3[_0x8fee('0x1e')](dbH[_0x8fee('0x30')][_0x8fee('0x31')](util[_0x8fee('0x1a')](_0x8fee('0x32'),QUERY,_0x48d87b,_0x1a45ed),{'type':dbH[_0x8fee('0x30')][_0x8fee('0x33')][_0x8fee('0x34')]}));}}}else{_0x5b7fe3[_0x8fee('0x1e')](dbH[_0x8fee('0x30')][_0x8fee('0x31')](QUERY,{'type':dbH[_0x8fee('0x30')][_0x8fee('0x33')][_0x8fee('0x34')]}));}var _0x5b1794=path[_0x8fee('0x35')](PATH);var _0x2b034d=path[_0x8fee('0x36')](PATH,_0x8fee('0x37'));var _0x200129=_0x2a5857[_0x8fee('0x2c')]&&_0x5b7fe3['length']>0x1;var _0x19abbb=[];if(!fs['existsSync'](path[_0x8fee('0x38')](_0x5b1794,_0x2b034d))&&_0x200129){fs[_0x8fee('0x39')](path[_0x8fee('0x38')](_0x5b1794,_0x2b034d));}return BPromise[_0x8fee('0x3a')](_0x5b7fe3,function(_0x172cde){_0x19abbb[_0x8fee('0x1e')](_0x172cde);})[_0x8fee('0x2a')](function(){var _0x14561a=[];for(var _0x93076a=0x0;_0x93076a<_0x19abbb['length'];_0x93076a+=0x1){var _0xd103a7=_0x19abbb[_0x93076a];var _0x33d1ba=createTables(_['flatten'](_0xd103a7));var _0x181d53;var _0x312dea=getPDFDocDefinition(_0x33d1ba);var _0x4b2cb8=getPDFPrinter();var _0x21711f=_0x4b2cb8['createPdfKitDocument'](_0x312dea);if(_0x200129){_0x181d53=path['join'](_0x5b1794,_0x2b034d,util['format'](_0x8fee('0x3b'),_0x2b034d,_0x93076a,_0x8fee('0x3c')));}else{_0x181d53=path[_0x8fee('0x38')](_0x5b1794,util[_0x8fee('0x1a')](_0x8fee('0x3d'),_0x2b034d,_0x8fee('0x3c')));}_0x14561a[_0x8fee('0x1e')](writePDFDocument(_0x21711f,_0x181d53));}return Promise['all'](_0x14561a);})[_0x8fee('0x2a')](function(){if(_0x200129){return new Promise(function(_0x350f4){zipdir(path['join'](_0x5b1794,_0x2b034d),{'saveTo':path[_0x8fee('0x38')](_0x5b1794,util[_0x8fee('0x1a')](_0x8fee('0x3d'),_0x2b034d,_0x8fee('0x3e')))},function(){rimraf(path[_0x8fee('0x38')](_0x5b1794,_0x2b034d),function(){});_0x350f4(_0x8fee('0x3f'));});});}})[_0x8fee('0x2a')](function(){if(!_0x200129)return;rimraf(path[_0x8fee('0x38')](_0x5b1794,_0x2b034d),function(){});})[_0x8fee('0x2a')](function(){logger[_0x8fee('0x40')](util[_0x8fee('0x1a')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x8fee('0x41')));return analyticExtractedReport(_0x8fee('0x42'),_0x200129?util[_0x8fee('0x1a')]('%s.%s',_0x2b034d,_0x200129?_0x8fee('0x3e'):_0x8fee('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x8fee('0x40')](util[_0x8fee('0x1a')](_0x8fee('0x43'),EXTRACTED_REPORT_ID,_0x8fee('0x41')));return db[_0x8fee('0xe')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x8fee('0x2a')](function(_0xcfdad2){EXTRACTED_REPORT=_0xcfdad2;return dbH['sequelize'][_0x8fee('0x31')](util[_0x8fee('0x1a')](_0x8fee('0x44'),QUERY),{'type':dbH[_0x8fee('0x30')]['QueryTypes']['SELECT']});})[_0x8fee('0x2a')](extractReport)[_0x8fee('0x45')](function(_0x391560){logger[_0x8fee('0x40')](util['format'](_0x8fee('0x46'),EXTRACTED_REPORT_ID,_0x8fee('0x41')),util[_0x8fee('0x47')](_0x391560,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8fee('0x48'));})[_0x8fee('0x49')](function(){process[_0x8fee('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x48562e=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x8fee('0x4b'),'italics':__dirname+_0x8fee('0x4c'),'bolditalics':__dirname+_0x8fee('0x4d')}});return _0x48562e;}function getPDFDocDefinitionFromHTML(_0x1bc093,_0x5a4b72){var _0x2694ba=util[_0x8fee('0x1a')](_0x8fee('0x4e'),_0x5a4b72['channel'],_0x5a4b72[_0x8fee('0x4f')]);var _0x1a4e19=moment()[_0x8fee('0x1a')](_0x8fee('0x50'))[_0x8fee('0x22')]();var _0x4966f8=htmlToPdfmake(_0x1bc093,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4966f8],'defaultStyle':{'font':_0x8fee('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x8fee('0x51'),'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':_0x8fee('0x51')}},'header':function(){return[{'text':_0x8fee('0x52'),'style':_0x8fee('0x1f')}];},'footer':function(_0x55a1e5,_0x175525){return[{'text':util[_0x8fee('0x1a')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x2694ba,_0x55a1e5,_0x175525,_0x1a4e19),'style':_0x8fee('0x23')}];}};}function writePDFDocument(_0x555b87,_0x21fbb8){return new Promise(function(_0x2f001a,_0x49237c){var _0x4d8312=_0x555b87[_0x8fee('0x53')](fs['createWriteStream'](_0x21fbb8));_0x4d8312['on'](_0x8fee('0x54'),function(){_0x2f001a(_0x8fee('0x54'));});_0x4d8312['on']('error',function(_0x16ccc6){_0x49237c(_0x16ccc6);});_0x555b87['end']();});}exports['createPdfFromHTML']=function(_0x5c9678,_0x3d62fd){var _0x121412=getPDFPrinter();var _0x36bbe6=getPDFDocDefinitionFromHTML(_0x5c9678,_0x3d62fd);var _0x5e0975=_0x121412[_0x8fee('0x55')](_0x36bbe6);return writePDFDocument(_0x5e0975,_0x3d62fd[_0x8fee('0x2')])['catch'](function(_0x566c65){throw _0x566c65;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 19e8b93..37a1de7 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 _0x5df3=['binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','util','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','length','range','isInteger','forEach','push','QueryTypes','dirname','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','%s.%s','writeFileSync'];(function(_0x5b1fb3,_0x3604a1){var _0x4e749d=function(_0x5e57c2){while(--_0x5e57c2){_0x5b1fb3['push'](_0x5b1fb3['shift']());}};_0x4e749d(++_0x3604a1);}(_0x5df3,0x15f));var _0x35df=function(_0x29f013,_0x2b13f3){_0x29f013=_0x29f013-0x0;var _0x5001bb=_0x5df3[_0x29f013];return _0x5001bb;};'use strict';var util=require(_0x35df('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0x35df('0x1'));var BPromise=require(_0x35df('0x2'));var zipdir=require(_0x35df('0x3'));var rimraf=require(_0x35df('0x4'));var db=require(_0x35df('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x35df('0x6'))(_0x35df('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x35df('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x35df('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5032e,_0x35d9d4){var _0x43e40b={'status':_0x5032e};var _0x1c93d4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x35d9d4){_0x43e40b[_0x35df('0x9')]=_0x35d9d4;}return db[_0x35df('0xa')][_0x35df('0xb')](_0x43e40b,_0x1c93d4);}function main(){var _0x15abc3=0x1388;var _0x1654c5;logger[_0x35df('0xc')](util[_0x35df('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x35df('0xe')));return db[_0x35df('0xf')][_0x35df('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x35df('0x11'),_0x35df('0x12')]})['then'](function(_0x27dfa0){if(_0x27dfa0){_0x1654c5=_0x27dfa0;_0x15abc3=_0x1654c5[_0x35df('0x12')]||0x1388;}})[_0x35df('0x13')](function(){return dbH[_0x35df('0x14')][_0x35df('0x15')](util[_0x35df('0xd')](_0x35df('0x16'),QUERY),{'type':dbH[_0x35df('0x14')]['QueryTypes'][_0x35df('0x17')]});})[_0x35df('0x13')](function(_0x1ec0f9){if(!_0x1ec0f9[0x0][_0x35df('0x18')]){return analyticExtractedReport('Empty');}var _0x5228db=[];var _0x2e2d7a=0x0;if(_0x1654c5[_0x35df('0x11')]){if(_0x1ec0f9&&_0x1ec0f9[_0x35df('0x19')]){var _0x1a56b5=_[_0x35df('0x1a')](_0x1ec0f9[0x0][_0x35df('0x18')]/_0x15abc3);var _0x40d61c=Number[_0x35df('0x1b')](_0x1ec0f9[0x0][_0x35df('0x18')]/_0x15abc3)?_0x1ec0f9[0x0][_0x35df('0x18')]%_0x15abc3:0x0;_0x1a56b5[_0x35df('0x1c')](function(_0x1c84e5){if(_0x1c84e5>0x0){_0x2e2d7a+=_0x15abc3;}_0x5228db[_0x35df('0x1d')](dbH['sequelize'][_0x35df('0x15')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x15abc3,_0x2e2d7a),{'type':dbH[_0x35df('0x14')]['QueryTypes']['SELECT']}));});if(_0x40d61c>0x0){_0x2e2d7a+=_0x15abc3;_0x5228db[_0x35df('0x1d')](dbH[_0x35df('0x14')][_0x35df('0x15')](util[_0x35df('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x40d61c,_0x2e2d7a),{'type':dbH[_0x35df('0x14')][_0x35df('0x1e')]['SELECT']}));}}}else{_0x5228db[_0x35df('0x1d')](dbH[_0x35df('0x14')][_0x35df('0x15')](QUERY,{'type':dbH[_0x35df('0x14')][_0x35df('0x1e')][_0x35df('0x17')]}));}var _0x2d1009=path[_0x35df('0x1f')](PATH);var _0x44166b=path[_0x35df('0x20')](PATH,_0x35df('0x21'));var _0x713be5=_0x1654c5[_0x35df('0x11')]&&_0x5228db[_0x35df('0x19')]>0x1;var _0x7f9fe3=[];if(!fs[_0x35df('0x22')](path['join'](_0x2d1009,_0x44166b))&&_0x713be5){fs[_0x35df('0x23')](path[_0x35df('0x24')](_0x2d1009,_0x44166b));}return BPromise[_0x35df('0x25')](_0x5228db,function(_0x492829){_0x7f9fe3[_0x35df('0x1d')](_0x492829);})['then'](function(){for(var _0x2012d8=0x0;_0x2012d8<_0x7f9fe3[_0x35df('0x19')];_0x2012d8+=0x1){var _0x27ce22;var _0x553960=_0x7f9fe3[_0x2012d8];if(_0x713be5){_0x27ce22=path[_0x35df('0x24')](_0x2d1009,_0x44166b,util[_0x35df('0xd')](_0x35df('0x26'),_0x44166b,_0x2012d8,'xlsx'));}else{_0x27ce22=path[_0x35df('0x24')](_0x2d1009,util[_0x35df('0xd')](_0x35df('0x27'),_0x44166b,'xlsx'));}fs[_0x35df('0x28')](_0x27ce22,json2xls(_0x553960),_0x35df('0x29'));}})[_0x35df('0x13')](function(){if(_0x713be5){return new Promise(function(_0x379040){zipdir(path[_0x35df('0x24')](_0x2d1009,_0x44166b),{'saveTo':path['join'](_0x2d1009,util[_0x35df('0xd')]('%s.%s',_0x44166b,_0x35df('0x2a')))},function(_0x74a9c2,_0x557eb8){rimraf(path[_0x35df('0x24')](_0x2d1009,_0x44166b),function(){});_0x379040('zip\x20finished');});});}})['then'](function(){logger[_0x35df('0xc')](util[_0x35df('0xd')](_0x35df('0x2b'),EXTRACTED_REPORT_ID,_0x35df('0xe')));return analyticExtractedReport(_0x35df('0x2c'),_0x713be5?util[_0x35df('0xd')](_0x35df('0x27'),_0x44166b,_0x713be5?_0x35df('0x2a'):'xlsx'):null);});})[_0x35df('0x2d')](function(_0x25c44b){logger[_0x35df('0xc')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x35df('0xe')),util[_0x35df('0x2e')](_0x25c44b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x35df('0x2f'));})[_0x35df('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2556=['%s.%s','zip','zip\x20finished','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','Setting','split','splitSizeXlsx','sequelize','query','SELECT','then','Empty','length','num','QueryTypes','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','mkdirSync','each','join','%s%d.%s','xlsx','writeFileSync','binary'];(function(_0x521553,_0x26da84){var _0xc2af80=function(_0x38c012){while(--_0x38c012){_0x521553['push'](_0x521553['shift']());}};_0xc2af80(++_0x26da84);}(_0x2556,0x11c));var _0x6255=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x2556[_0x2070da];return _0x4f9fe1;};'use strict';var util=require(_0x6255('0x0'));var path=require(_0x6255('0x1'));var _=require(_0x6255('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x6255('0x3'));var zipdir=require(_0x6255('0x4'));var rimraf=require('rimraf');var db=require(_0x6255('0x5'))['db'];var dbH=require('../../mysqldb')[_0x6255('0x6')];var logger=require(_0x6255('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6255('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2d6571,_0x2c23a7){var _0xf78900={'status':_0x2d6571};var _0x40c8aa={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2c23a7){_0xf78900[_0x6255('0x9')]=_0x2c23a7;}return db[_0x6255('0xa')][_0x6255('0xb')](_0xf78900,_0x40c8aa);}function main(){var _0x26ef4f=0x1388;var _0x37b266;logger[_0x6255('0xc')](util[_0x6255('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6255('0xe')));return db[_0x6255('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6255('0x10'),_0x6255('0x11')]})['then'](function(_0x42577e){if(_0x42577e){_0x37b266=_0x42577e;_0x26ef4f=_0x37b266[_0x6255('0x11')]||0x1388;}})['then'](function(){return dbH[_0x6255('0x12')][_0x6255('0x13')](util[_0x6255('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x6255('0x12')]['QueryTypes'][_0x6255('0x14')]});})[_0x6255('0x15')](function(_0x1ca22c){if(!_0x1ca22c[0x0]['num']){return analyticExtractedReport(_0x6255('0x16'));}var _0x34b8f7=[];var _0x13308=0x0;if(_0x37b266['split']){if(_0x1ca22c&&_0x1ca22c[_0x6255('0x17')]){var _0x404c35=_['range'](_0x1ca22c[0x0][_0x6255('0x18')]/_0x26ef4f);var _0x5770c2=Number['isInteger'](_0x1ca22c[0x0][_0x6255('0x18')]/_0x26ef4f)?_0x1ca22c[0x0][_0x6255('0x18')]%_0x26ef4f:0x0;_0x404c35['forEach'](function(_0xe2484b){if(_0xe2484b>0x0){_0x13308+=_0x26ef4f;}_0x34b8f7['push'](dbH[_0x6255('0x12')][_0x6255('0x13')](util[_0x6255('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x26ef4f,_0x13308),{'type':dbH['sequelize'][_0x6255('0x19')][_0x6255('0x14')]}));});if(_0x5770c2>0x0){_0x13308+=_0x26ef4f;_0x34b8f7[_0x6255('0x1a')](dbH[_0x6255('0x12')][_0x6255('0x13')](util['format'](_0x6255('0x1b'),QUERY,_0x5770c2,_0x13308),{'type':dbH[_0x6255('0x12')][_0x6255('0x19')][_0x6255('0x14')]}));}}}else{_0x34b8f7[_0x6255('0x1a')](dbH['sequelize'][_0x6255('0x13')](QUERY,{'type':dbH[_0x6255('0x12')][_0x6255('0x19')][_0x6255('0x14')]}));}var _0xacf64f=path['dirname'](PATH);var _0x185be3=path[_0x6255('0x1c')](PATH,_0x6255('0x1d'));var _0x5e613b=_0x37b266[_0x6255('0x10')]&&_0x34b8f7[_0x6255('0x17')]>0x1;var _0x301b12=[];if(!fs[_0x6255('0x1e')](path['join'](_0xacf64f,_0x185be3))&&_0x5e613b){fs[_0x6255('0x1f')](path['join'](_0xacf64f,_0x185be3));}return BPromise[_0x6255('0x20')](_0x34b8f7,function(_0x33fe27){_0x301b12[_0x6255('0x1a')](_0x33fe27);})[_0x6255('0x15')](function(){for(var _0x375bed=0x0;_0x375bed<_0x301b12[_0x6255('0x17')];_0x375bed+=0x1){var _0x58bef7;var _0x174b4d=_0x301b12[_0x375bed];if(_0x5e613b){_0x58bef7=path[_0x6255('0x21')](_0xacf64f,_0x185be3,util[_0x6255('0xd')](_0x6255('0x22'),_0x185be3,_0x375bed,_0x6255('0x23')));}else{_0x58bef7=path[_0x6255('0x21')](_0xacf64f,util[_0x6255('0xd')]('%s.%s',_0x185be3,_0x6255('0x23')));}fs[_0x6255('0x24')](_0x58bef7,json2xls(_0x174b4d),_0x6255('0x25'));}})['then'](function(){if(_0x5e613b){return new Promise(function(_0x317b6b){zipdir(path['join'](_0xacf64f,_0x185be3),{'saveTo':path['join'](_0xacf64f,util[_0x6255('0xd')](_0x6255('0x26'),_0x185be3,_0x6255('0x27')))},function(_0x295fcb,_0x1eaf19){rimraf(path[_0x6255('0x21')](_0xacf64f,_0x185be3),function(){});_0x317b6b(_0x6255('0x28'));});});}})[_0x6255('0x15')](function(){logger[_0x6255('0xc')](util[_0x6255('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x6255('0xe')));return analyticExtractedReport(_0x6255('0x29'),_0x5e613b?util[_0x6255('0xd')](_0x6255('0x26'),_0x185be3,_0x5e613b?'zip':_0x6255('0x23')):null);});})['catch'](function(_0x2c23a6){logger[_0x6255('0xc')](util['format'](_0x6255('0x2a'),EXTRACTED_REPORT_ID,_0x6255('0xe')),util['inspect'](_0x2c23a6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6255('0x2b'));})[_0x6255('0x2c')](function(){process[_0x6255('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 86fd879..7a94291 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 _0xf2dd=['IntervalId','then','findAll','uniq','map','exten','filter','groupBy','queue','hasOwnProperty','extensions','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','priority','outbound','extension','${EXTEN:','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','updatedAt','interval','*,*,*,*','CDR(tag)=','tag','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','error','rewrite','lodash','util','models','Interval','intervals','VoiceExtension'];(function(_0x470291,_0x1ce9b4){var _0x398a4e=function(_0x1962f8){while(--_0x1962f8){_0x470291['push'](_0x470291['shift']());}};_0x398a4e(++_0x1ce9b4);}(_0xf2dd,0x1e4));var _0xdf2d=function(_0x3ef8f7,_0x35359a){_0x3ef8f7=_0x3ef8f7-0x0;var _0x3b097e=_0xf2dd[_0x3ef8f7];return _0x3b097e;};'use strict';var _=require(_0xdf2d('0x0'));var util=require(_0xdf2d('0x1'));function rewrite(_0x290857,_0x30318f){var _0x58271d=this;return _0x290857[_0xdf2d('0x2')][_0xdf2d('0x3')]['findAll']({'raw':!![]})['then'](function(_0x58d5a0){_0x58271d[_0xdf2d('0x4')]=_0x58d5a0;return _0x290857[_0xdf2d('0x2')][_0xdf2d('0x5')]['findAll']({'where':{'IntervalId':_0x30318f[_0xdf2d('0x6')]},'raw':!![]});})[_0xdf2d('0x7')](function(_0x548a24){return _0x290857[_0xdf2d('0x2')][_0xdf2d('0x5')][_0xdf2d('0x8')]({'where':{'exten':{'$in':_[_0xdf2d('0x9')](_[_0xdf2d('0xa')](_0x548a24,_0xdf2d('0xb')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xdf2d('0x7')](function(_0x26d4f0){var _0x47859a=_[_0xdf2d('0xc')](_0x26d4f0,{'priority':'1'});var _0x44217a=_[_0xdf2d('0xc')](_0x26d4f0,{'isApp':0x1});var _0x1049f7=_[_0xdf2d('0xd')](_0x44217a,_0xdf2d('0xb'));var _0x5e7e2d=[_0xdf2d('0xe'),'playback'];var _0x5e43eb=[];var _0x4eea96=[];for(var _0x4983ec in _0x1049f7){if(_0x1049f7[_0xdf2d('0xf')](_0x4983ec)){_0x58271d['priority']=0x2;_0x58271d[_0xdf2d('0x10')]=[];_0x58271d['extension']=_['find'](_0x47859a,{'exten':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0xb')]});_0x58271d[_0xdf2d('0x10')][_0xdf2d('0x11')]({'type':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x12')],'app':_0xdf2d('0x13'),'appdata':util[_0xdf2d('0x14')](_0xdf2d('0x15'),_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x12')]),'context':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x16')],'exten':_0x1049f7[_0x4983ec][0x0]['exten'],'priority':_0x58271d['priority']++,'VoiceExtensionId':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x17')]});if(_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x12')]===_0xdf2d('0x18')){_0x58271d[_0xdf2d('0x10')][_0xdf2d('0x11')]({'type':_0x1049f7[_0x4983ec][0x0]['type'],'app':_0xdf2d('0x13'),'appdata':_0xdf2d('0x19')+_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x17')],'context':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x16')],'exten':_0x1049f7[_0x4983ec][0x0]['exten'],'priority':_0x58271d[_0xdf2d('0x1a')]++,'VoiceExtensionId':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x17')]});}else if(_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x12')]===_0xdf2d('0x1b')){if(_0x58271d[_0xdf2d('0x1c')]){_0x58271d[_0xdf2d('0x10')][_0xdf2d('0x11')]({'type':_0x1049f7[_0x4983ec][0x0]['type'],'app':_0xdf2d('0x13'),'appdata':'CDR(destination)='+(_0x58271d[_0xdf2d('0x1c')]['cutdigits']?_0xdf2d('0x1d')+_0x58271d[_0xdf2d('0x1c')][_0xdf2d('0x1e')]+'}':'${EXTEN}'),'context':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x16')],'exten':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0xb')],'priority':_0x58271d[_0xdf2d('0x1a')]++,'VoiceExtensionId':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x17')]});}_0x58271d['extensions'][_0xdf2d('0x11')]({'type':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x12')],'app':_0xdf2d('0x13'),'appdata':_0xdf2d('0x19')+_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x17')],'context':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x16')],'exten':_0x1049f7[_0x4983ec][0x0]['exten'],'priority':_0x58271d[_0xdf2d('0x1a')]++,'VoiceExtensionId':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x17')]});var _0x1db9a4=_0x58271d[_0xdf2d('0x1a')]++;_0x58271d[_0xdf2d('0x10')][_0xdf2d('0x11')]({'type':_0x1049f7[_0x4983ec][0x0]['type'],'app':'ExecIf','appdata':_0xdf2d('0x1f')+(_0x1db9a4+0x2)+_0xdf2d('0x20')+(_0x1db9a4+0x1)+')','context':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x16')],'exten':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0xb')],'priority':_0x1db9a4,'VoiceExtensionId':_0x1049f7[_0x4983ec][0x0]['VoiceExtensionId']});if(_0x58271d['extension']){_0x58271d[_0xdf2d('0x10')][_0xdf2d('0x11')]({'type':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x12')],'app':_0xdf2d('0x13'),'appdata':_0x58271d[_0xdf2d('0x1c')][_0xdf2d('0x1e')]?_0xdf2d('0x21')+_0x58271d[_0xdf2d('0x1c')][_0xdf2d('0x1e')]+'}':_0xdf2d('0x22'),'context':_0x1049f7[_0x4983ec][0x0]['context'],'exten':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0xb')],'priority':_0x58271d[_0xdf2d('0x1a')]++,'VoiceExtensionId':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x17')]});}_0x58271d[_0xdf2d('0x10')]['push']({'type':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x12')],'app':_0xdf2d('0x13'),'appdata':_0xdf2d('0x23')+_0x1049f7[_0x4983ec][0x0]['VoiceExtensionId'],'context':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x16')],'exten':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0xb')],'priority':_0x58271d['priority']++,'VoiceExtensionId':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x17')]});if(_0x58271d[_0xdf2d('0x1c')]&&_0x58271d[_0xdf2d('0x1c')][_0xdf2d('0xf')](_0xdf2d('0x24'))&&_0x58271d[_0xdf2d('0x1c')][_0xdf2d('0x24')]!==_0xdf2d('0x25')){_0x58271d[_0xdf2d('0x10')]['push']({'type':_0x1049f7[_0x4983ec][0x0]['type'],'app':'Set','appdata':_0xdf2d('0x26'),'context':_0x1049f7[_0x4983ec][0x0]['context'],'exten':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0xb')],'priority':_0x58271d[_0xdf2d('0x1a')]++,'VoiceExtensionId':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x17')]});_0x58271d['extensions'][_0xdf2d('0x11')]({'type':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x12')],'app':_0xdf2d('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x58271d[_0xdf2d('0x1c')][_0xdf2d('0x24')]||_0xdf2d('0x27'),'context':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x16')],'exten':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0xb')],'priority':_0x58271d['priority']++,'VoiceExtensionId':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x17')]});}}_0x58271d[_0xdf2d('0x10')]['push']({'type':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x12')],'app':_0xdf2d('0x13'),'appdata':_0xdf2d('0x28'),'context':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x16')],'exten':_0x1049f7[_0x4983ec][0x0]['exten'],'priority':_0x58271d['priority']++,'VoiceExtensionId':_0x1049f7[_0x4983ec][0x0]['VoiceExtensionId']});_0x58271d[_0xdf2d('0x10')][_0xdf2d('0x11')]({'type':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x12')],'app':_0xdf2d('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1049f7[_0x4983ec][0x0]['context'],'exten':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0xb')],'priority':_0x58271d[_0xdf2d('0x1a')]++,'VoiceExtensionId':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x17')]});_0x58271d[_0xdf2d('0x10')][_0xdf2d('0x11')]({'type':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x12')],'app':_0xdf2d('0x13'),'appdata':_0xdf2d('0x29'),'context':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x16')],'exten':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0xb')],'priority':_0x58271d[_0xdf2d('0x1a')]++,'VoiceExtensionId':_0x1049f7[_0x4983ec][0x0]['VoiceExtensionId']});for(var _0x1ad6f9=0x0,_0x2d8924=0x0;_0x1ad6f9<_0x1049f7[_0x4983ec][_0xdf2d('0x2a')];_0x1ad6f9+=0x1,_0x2d8924=0x0){var _0x933ec5=_0x1049f7[_0x4983ec][_0x1ad6f9];if(_0x933ec5[_0xdf2d('0x12')]){_0x933ec5[_0xdf2d('0x12')]=_0x933ec5[_0xdf2d('0x12')]['toLowerCase']();}var _0x3064cf=[];var _0xf2f07e=[];delete _0x933ec5['id'];delete _0x933ec5['createdAt'];delete _0x933ec5[_0xdf2d('0x2b')];var _0x4271f1=_0x933ec5[_0xdf2d('0x2c')]!==_0xdf2d('0x2d')?[_0x933ec5[_0xdf2d('0x2c')]]:_0x933ec5[_0xdf2d('0x6')]?_[_0xdf2d('0xa')](_[_0xdf2d('0xc')](_0x58271d[_0xdf2d('0x4')],{'IntervalId':_0x933ec5['IntervalId']}),_0xdf2d('0x2c')):[];if(_0x933ec5[_0xdf2d('0xf')]('tag')){if(_0x933ec5['tag']&&_0x933ec5['tag']!=='--'){_0x3064cf[_0xdf2d('0x11')]({'type':_0x933ec5[_0xdf2d('0x12')],'app':_0xdf2d('0x13'),'appdata':_0xdf2d('0x2e')+_0x933ec5[_0xdf2d('0x2f')],'context':_0x933ec5[_0xdf2d('0x16')],'exten':_0x933ec5[_0xdf2d('0xb')],'priority':_0x4271f1[_0xdf2d('0x2a')]+_0x58271d['priority']+_0x2d8924++,'VoiceExtensionId':_0x933ec5[_0xdf2d('0x17')]});}}if(_0x933ec5[_0xdf2d('0x12')]===_0xdf2d('0x1b')&&_0x933ec5['hasOwnProperty'](_0xdf2d('0x30'))){if(_0x933ec5[_0xdf2d('0x30')]){_0x3064cf[_0xdf2d('0x11')]({'type':_0x933ec5[_0xdf2d('0x12')],'app':_0xdf2d('0x31'),'appdata':_0xdf2d('0x32')+_0x933ec5[_0xdf2d('0x30')]+')','context':_0x933ec5[_0xdf2d('0x16')],'exten':_0x933ec5[_0xdf2d('0xb')],'priority':_0x4271f1[_0xdf2d('0x2a')]+_0x58271d[_0xdf2d('0x1a')]+_0x2d8924++,'VoiceExtensionId':_0x933ec5['VoiceExtensionId']});}else{_0x3064cf[_0xdf2d('0x11')]({'type':_0x933ec5[_0xdf2d('0x12')],'app':'ExecIf','appdata':_0xdf2d('0x33'),'context':_0x933ec5[_0xdf2d('0x16')],'exten':_0x933ec5['exten'],'priority':_0x4271f1['length']+_0x58271d[_0xdf2d('0x1a')]+_0x2d8924++,'VoiceExtensionId':_0x933ec5['VoiceExtensionId']});}}if(_0x933ec5[_0xdf2d('0xf')](_0xdf2d('0x34'))){if(_0x5e7e2d[_0xdf2d('0x35')](_0x933ec5[_0xdf2d('0x36')]['toLowerCase']())>=0x0&&_0x933ec5[_0xdf2d('0x37')]!==_0xdf2d('0x38')){if(_0x933ec5[_0xdf2d('0x34')]){_0x3064cf[_0xdf2d('0x11')]({'type':_0x933ec5[_0xdf2d('0x12')],'app':_0xdf2d('0x31'),'appdata':_0xdf2d('0x39'),'context':_0x933ec5[_0xdf2d('0x16')],'exten':_0x933ec5[_0xdf2d('0xb')],'priority':_0x4271f1[_0xdf2d('0x2a')]+_0x58271d[_0xdf2d('0x1a')]+_0x2d8924++,'VoiceExtensionId':_0x933ec5[_0xdf2d('0x17')]});_0x3064cf[_0xdf2d('0x11')]({'type':_0x933ec5[_0xdf2d('0x12')],'app':_0xdf2d('0x13'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x933ec5[_0xdf2d('0x16')],'exten':_0x933ec5['exten'],'priority':_0x4271f1[_0xdf2d('0x2a')]+_0x58271d[_0xdf2d('0x1a')]+_0x2d8924++,'VoiceExtensionId':_0x933ec5[_0xdf2d('0x17')]});}else{_0x3064cf[_0xdf2d('0x11')]({'type':_0x933ec5[_0xdf2d('0x12')],'app':'ExecIf','appdata':_0xdf2d('0x3a'),'context':_0x933ec5[_0xdf2d('0x16')],'exten':_0x933ec5['exten'],'priority':_0x4271f1[_0xdf2d('0x2a')]+_0x58271d['priority']+_0x2d8924++,'VoiceExtensionId':_0x933ec5[_0xdf2d('0x17')]});_0x3064cf[_0xdf2d('0x11')]({'type':_0x933ec5[_0xdf2d('0x12')],'app':_0xdf2d('0x13'),'appdata':_0xdf2d('0x3b'),'context':_0x933ec5[_0xdf2d('0x16')],'exten':_0x933ec5[_0xdf2d('0xb')],'priority':_0x4271f1[_0xdf2d('0x2a')]+_0x58271d[_0xdf2d('0x1a')]+_0x2d8924++,'VoiceExtensionId':_0x933ec5[_0xdf2d('0x17')]});}}}for(var _0x135859=0x0;_0x135859<_0x4271f1[_0xdf2d('0x2a')];_0x135859+=0x1){var _0x2bbeaf=_0x58271d[_0xdf2d('0x1a')]+_0x4271f1[_0xdf2d('0x2a')];var _0x414b25=_0x135859===_0x4271f1[_0xdf2d('0x2a')]-0x1?_0x58271d[_0xdf2d('0x1a')]+_0x3064cf['length']+_0xf2f07e['length']+0x2:_0x58271d['priority']+_0x135859+0x1;_0x3064cf['splice'](_0x135859,0x0,{'type':_0x933ec5[_0xdf2d('0x12')],'app':_0xdf2d('0x3c'),'appdata':_0x4271f1[_0x135859]+'?'+_0x933ec5[_0xdf2d('0x16')]+_0xdf2d('0x3d')+_0x2bbeaf+':'+_0x933ec5['context']+',${EXTEN},'+_0x414b25,'exten':_0x933ec5[_0xdf2d('0xb')],'context':_0x933ec5[_0xdf2d('0x16')],'priority':_0x58271d[_0xdf2d('0x1a')]+_0x135859,'VoiceExtensionId':_0x1049f7[_0x4983ec][0x0]['VoiceExtensionId']});}_0x933ec5[_0xdf2d('0x1a')]=_0x3064cf[_0xdf2d('0x2a')]?_[_0xdf2d('0x3e')](_0x3064cf)[_0xdf2d('0x1a')]+0x1:_0x58271d[_0xdf2d('0x1a')];_0x58271d[_0xdf2d('0x1a')]=(_0xf2f07e['length']?_[_0xdf2d('0x3e')](_0xf2f07e)[_0xdf2d('0x1a')]:_0x933ec5['priority'])+0x1;_0x58271d[_0xdf2d('0x10')]=_[_0xdf2d('0x3f')](_0x58271d[_0xdf2d('0x10')],_0x3064cf,[_0x933ec5],_0xf2f07e);}_0x58271d[_0xdf2d('0x10')][_0xdf2d('0x11')]({'type':_0x1049f7[_0x4983ec][0x0]['type'],'app':_0xdf2d('0x40'),'exten':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0xb')],'context':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x16')],'priority':_0x58271d[_0xdf2d('0x1a')],'VoiceExtensionId':_0x1049f7[_0x4983ec][0x0][_0xdf2d('0x17')]});_0x5e43eb[_0xdf2d('0x11')](_0x1049f7[_0x4983ec][0x0]['VoiceExtensionId']);_0x4eea96=_[_0xdf2d('0x3f')](_0x4eea96,_0x58271d[_0xdf2d('0x10')]);}}return _0x290857[_0xdf2d('0x41')](function(_0x3c9482){return _0x290857[_0xdf2d('0x2')][_0xdf2d('0x5')][_0xdf2d('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x5e43eb}},'transaction':_0x3c9482})[_0xdf2d('0x7')](function(_0x120312){return _0x290857[_0xdf2d('0x2')][_0xdf2d('0x5')]['bulkCreate'](_[_0xdf2d('0x43')](_0x4eea96,'priority'),{'transaction':_0x3c9482});});});})['catch'](function(_0x4ae302){console[_0xdf2d('0x44')](_0x4ae302);});}exports[_0xdf2d('0x45')]=rewrite; \ No newline at end of file +var _0x4315=['last','concat','transaction','destroy','bulkCreate','sortBy','catch','rewrite','lodash','Interval','findAll','models','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','find','type','Set','format','CDR(type)=%s','priority','VoiceExtensionId','inbound','push','context','outbound','extension','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','intervals','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','app','toLowerCase','appType','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},'];(function(_0x56ea75,_0x2f0c76){var _0x2b6685=function(_0x346b7e){while(--_0x346b7e){_0x56ea75['push'](_0x56ea75['shift']());}};_0x2b6685(++_0x2f0c76);}(_0x4315,0x16b));var _0x5431=function(_0x16ff0e,_0x4e7dc6){_0x16ff0e=_0x16ff0e-0x0;var _0x95bd68=_0x4315[_0x16ff0e];return _0x95bd68;};'use strict';var _=require(_0x5431('0x0'));var util=require('util');function rewrite(_0x4cd711,_0x4150d4){var _0x1169e2=this;return _0x4cd711['models'][_0x5431('0x1')][_0x5431('0x2')]({'raw':!![]})['then'](function(_0x384376){_0x1169e2['intervals']=_0x384376;return _0x4cd711[_0x5431('0x3')][_0x5431('0x4')][_0x5431('0x2')]({'where':{'IntervalId':_0x4150d4[_0x5431('0x5')]},'raw':!![]});})[_0x5431('0x6')](function(_0x9c05f5){return _0x4cd711[_0x5431('0x3')][_0x5431('0x4')]['findAll']({'where':{'exten':{'$in':_[_0x5431('0x7')](_[_0x5431('0x8')](_0x9c05f5,_0x5431('0x9')))}},'order':[{'raw':_0x5431('0xa')}],'raw':!![]});})['then'](function(_0x48589d){var _0x40de3d=_['filter'](_0x48589d,{'priority':'1'});var _0xb08b81=_[_0x5431('0xb')](_0x48589d,{'isApp':0x1});var _0x29d597=_[_0x5431('0xc')](_0xb08b81,_0x5431('0x9'));var _0xea1e51=[_0x5431('0xd'),_0x5431('0xe')];var _0x558622=[];var _0xd4e422=[];for(var _0x1e4a31 in _0x29d597){if(_0x29d597[_0x5431('0xf')](_0x1e4a31)){_0x1169e2['priority']=0x2;_0x1169e2[_0x5431('0x10')]=[];_0x1169e2['extension']=_[_0x5431('0x11')](_0x40de3d,{'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')]});_0x1169e2[_0x5431('0x10')]['push']({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':util[_0x5431('0x14')](_0x5431('0x15'),_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')]),'context':_0x29d597[_0x1e4a31][0x0]['context'],'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'priority':_0x1169e2[_0x5431('0x16')]++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});if(_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')]===_0x5431('0x18')){_0x1169e2[_0x5431('0x10')][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':'Set','appdata':'CDR(routeid)='+_0x29d597[_0x1e4a31][0x0]['VoiceExtensionId'],'context':_0x29d597[_0x1e4a31][0x0][_0x5431('0x1a')],'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'priority':_0x1169e2[_0x5431('0x16')]++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});}else if(_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')]===_0x5431('0x1b')){if(_0x1169e2['extension']){_0x1169e2[_0x5431('0x10')][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0]['type'],'app':_0x5431('0x13'),'appdata':'CDR(destination)='+(_0x1169e2[_0x5431('0x1c')][_0x5431('0x1d')]?_0x5431('0x1e')+_0x1169e2[_0x5431('0x1c')]['cutdigits']+'}':_0x5431('0x1f')),'context':_0x29d597[_0x1e4a31][0x0][_0x5431('0x1a')],'exten':_0x29d597[_0x1e4a31][0x0]['exten'],'priority':_0x1169e2[_0x5431('0x16')]++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0]['VoiceExtensionId']});}_0x1169e2['extensions'][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':_0x5431('0x20')+_0x29d597[_0x1e4a31][0x0]['VoiceExtensionId'],'context':_0x29d597[_0x1e4a31][0x0][_0x5431('0x1a')],'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'priority':_0x1169e2['priority']++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});var _0x205ea2=_0x1169e2[_0x5431('0x16')]++;_0x1169e2['extensions'][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x21'),'appdata':_0x5431('0x22')+(_0x205ea2+0x2)+_0x5431('0x23')+(_0x205ea2+0x1)+')','context':_0x29d597[_0x1e4a31][0x0]['context'],'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'priority':_0x205ea2,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});if(_0x1169e2['extension']){_0x1169e2[_0x5431('0x10')][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':_0x1169e2[_0x5431('0x1c')][_0x5431('0x1d')]?_0x5431('0x24')+_0x1169e2['extension'][_0x5431('0x1d')]+'}':_0x5431('0x25'),'context':_0x29d597[_0x1e4a31][0x0][_0x5431('0x1a')],'exten':_0x29d597[_0x1e4a31][0x0]['exten'],'priority':_0x1169e2['priority']++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});}_0x1169e2[_0x5431('0x10')][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':_0x5431('0x26')+_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')],'context':_0x29d597[_0x1e4a31][0x0]['context'],'exten':_0x29d597[_0x1e4a31][0x0]['exten'],'priority':_0x1169e2['priority']++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0]['VoiceExtensionId']});if(_0x1169e2['extension']&&_0x1169e2[_0x5431('0x1c')][_0x5431('0xf')](_0x5431('0x27'))&&_0x1169e2[_0x5431('0x1c')]['recordingFormat']!==_0x5431('0x28')){_0x1169e2[_0x5431('0x10')][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0]['type'],'app':_0x5431('0x13'),'appdata':_0x5431('0x29'),'context':_0x29d597[_0x1e4a31][0x0][_0x5431('0x1a')],'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'priority':_0x1169e2[_0x5431('0x16')]++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});_0x1169e2['extensions'][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':_0x5431('0x2a')+_0x1169e2[_0x5431('0x1c')][_0x5431('0x27')]||_0x5431('0x2b'),'context':_0x29d597[_0x1e4a31][0x0][_0x5431('0x1a')],'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'priority':_0x1169e2['priority']++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});}}_0x1169e2['extensions']['push']({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x29d597[_0x1e4a31][0x0]['context'],'exten':_0x29d597[_0x1e4a31][0x0]['exten'],'priority':_0x1169e2['priority']++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});_0x1169e2[_0x5431('0x10')][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':_0x5431('0x2c'),'context':_0x29d597[_0x1e4a31][0x0][_0x5431('0x1a')],'exten':_0x29d597[_0x1e4a31][0x0]['exten'],'priority':_0x1169e2['priority']++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});_0x1169e2[_0x5431('0x10')]['push']({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':_0x5431('0x2d'),'context':_0x29d597[_0x1e4a31][0x0]['context'],'exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'priority':_0x1169e2[_0x5431('0x16')]++,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});for(var _0x3852ae=0x0,_0x4ae827=0x0;_0x3852ae<_0x29d597[_0x1e4a31][_0x5431('0x2e')];_0x3852ae+=0x1,_0x4ae827=0x0){var _0x51c370=_0x29d597[_0x1e4a31][_0x3852ae];if(_0x51c370[_0x5431('0x12')]){_0x51c370[_0x5431('0x12')]=_0x51c370[_0x5431('0x12')]['toLowerCase']();}var _0xccd383=[];var _0x4e9b08=[];delete _0x51c370['id'];delete _0x51c370[_0x5431('0x2f')];delete _0x51c370[_0x5431('0x30')];var _0x5435ef=_0x51c370[_0x5431('0x31')]!=='*,*,*,*'?[_0x51c370[_0x5431('0x31')]]:_0x51c370['IntervalId']?_[_0x5431('0x8')](_[_0x5431('0xb')](_0x1169e2[_0x5431('0x32')],{'IntervalId':_0x51c370[_0x5431('0x5')]}),_0x5431('0x31')):[];if(_0x51c370['hasOwnProperty'](_0x5431('0x33'))){if(_0x51c370[_0x5431('0x33')]&&_0x51c370[_0x5431('0x33')]!=='--'){_0xccd383[_0x5431('0x19')]({'type':_0x51c370['type'],'app':_0x5431('0x13'),'appdata':'CDR(tag)='+_0x51c370['tag'],'context':_0x51c370[_0x5431('0x1a')],'exten':_0x51c370[_0x5431('0x9')],'priority':_0x5435ef['length']+_0x1169e2[_0x5431('0x16')]+_0x4ae827++,'VoiceExtensionId':_0x51c370[_0x5431('0x17')]});}}if(_0x51c370[_0x5431('0x12')]===_0x5431('0x1b')&&_0x51c370[_0x5431('0xf')](_0x5431('0x34'))){if(_0x51c370[_0x5431('0x34')]){_0xccd383[_0x5431('0x19')]({'type':_0x51c370[_0x5431('0x12')],'app':_0x5431('0x21'),'appdata':_0x5431('0x35')+_0x51c370['callerID']+')','context':_0x51c370[_0x5431('0x1a')],'exten':_0x51c370[_0x5431('0x9')],'priority':_0x5435ef[_0x5431('0x2e')]+_0x1169e2[_0x5431('0x16')]+_0x4ae827++,'VoiceExtensionId':_0x51c370[_0x5431('0x17')]});}else{_0xccd383[_0x5431('0x19')]({'type':_0x51c370[_0x5431('0x12')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x51c370[_0x5431('0x1a')],'exten':_0x51c370['exten'],'priority':_0x5435ef['length']+_0x1169e2['priority']+_0x4ae827++,'VoiceExtensionId':_0x51c370[_0x5431('0x17')]});}}if(_0x51c370[_0x5431('0xf')](_0x5431('0x36'))){if(_0xea1e51['indexOf'](_0x51c370[_0x5431('0x37')][_0x5431('0x38')]())>=0x0&&_0x51c370[_0x5431('0x39')]!=='custom'){if(_0x51c370[_0x5431('0x36')]){_0xccd383[_0x5431('0x19')]({'type':_0x51c370['type'],'app':_0x5431('0x21'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x51c370[_0x5431('0x1a')],'exten':_0x51c370[_0x5431('0x9')],'priority':_0x5435ef['length']+_0x1169e2[_0x5431('0x16')]+_0x4ae827++,'VoiceExtensionId':_0x51c370[_0x5431('0x17')]});_0xccd383[_0x5431('0x19')]({'type':_0x51c370['type'],'app':_0x5431('0x13'),'appdata':_0x5431('0x3a'),'context':_0x51c370[_0x5431('0x1a')],'exten':_0x51c370['exten'],'priority':_0x5435ef['length']+_0x1169e2[_0x5431('0x16')]+_0x4ae827++,'VoiceExtensionId':_0x51c370[_0x5431('0x17')]});}else{_0xccd383['push']({'type':_0x51c370[_0x5431('0x12')],'app':_0x5431('0x21'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x51c370[_0x5431('0x1a')],'exten':_0x51c370[_0x5431('0x9')],'priority':_0x5435ef[_0x5431('0x2e')]+_0x1169e2[_0x5431('0x16')]+_0x4ae827++,'VoiceExtensionId':_0x51c370['VoiceExtensionId']});_0xccd383[_0x5431('0x19')]({'type':_0x51c370[_0x5431('0x12')],'app':_0x5431('0x13'),'appdata':_0x5431('0x3b'),'context':_0x51c370[_0x5431('0x1a')],'exten':_0x51c370['exten'],'priority':_0x5435ef[_0x5431('0x2e')]+_0x1169e2[_0x5431('0x16')]+_0x4ae827++,'VoiceExtensionId':_0x51c370[_0x5431('0x17')]});}}}for(var _0x469548=0x0;_0x469548<_0x5435ef[_0x5431('0x2e')];_0x469548+=0x1){var _0xe3c2e3=_0x1169e2[_0x5431('0x16')]+_0x5435ef[_0x5431('0x2e')];var _0x46cc51=_0x469548===_0x5435ef[_0x5431('0x2e')]-0x1?_0x1169e2[_0x5431('0x16')]+_0xccd383[_0x5431('0x2e')]+_0x4e9b08[_0x5431('0x2e')]+0x2:_0x1169e2['priority']+_0x469548+0x1;_0xccd383[_0x5431('0x3c')](_0x469548,0x0,{'type':_0x51c370['type'],'app':_0x5431('0x3d'),'appdata':_0x5435ef[_0x469548]+'?'+_0x51c370[_0x5431('0x1a')]+_0x5431('0x3e')+_0xe3c2e3+':'+_0x51c370[_0x5431('0x1a')]+_0x5431('0x3e')+_0x46cc51,'exten':_0x51c370[_0x5431('0x9')],'context':_0x51c370[_0x5431('0x1a')],'priority':_0x1169e2['priority']+_0x469548,'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});}_0x51c370['priority']=_0xccd383[_0x5431('0x2e')]?_['last'](_0xccd383)['priority']+0x1:_0x1169e2['priority'];_0x1169e2['priority']=(_0x4e9b08['length']?_[_0x5431('0x3f')](_0x4e9b08)[_0x5431('0x16')]:_0x51c370[_0x5431('0x16')])+0x1;_0x1169e2['extensions']=_[_0x5431('0x40')](_0x1169e2[_0x5431('0x10')],_0xccd383,[_0x51c370],_0x4e9b08);}_0x1169e2[_0x5431('0x10')][_0x5431('0x19')]({'type':_0x29d597[_0x1e4a31][0x0][_0x5431('0x12')],'app':'Hangup','exten':_0x29d597[_0x1e4a31][0x0][_0x5431('0x9')],'context':_0x29d597[_0x1e4a31][0x0]['context'],'priority':_0x1169e2[_0x5431('0x16')],'VoiceExtensionId':_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]});_0x558622[_0x5431('0x19')](_0x29d597[_0x1e4a31][0x0][_0x5431('0x17')]);_0xd4e422=_[_0x5431('0x40')](_0xd4e422,_0x1169e2[_0x5431('0x10')]);}}return _0x4cd711[_0x5431('0x41')](function(_0x5ae717){return _0x4cd711[_0x5431('0x3')][_0x5431('0x4')][_0x5431('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x558622}},'transaction':_0x5ae717})['then'](function(_0x413aba){return _0x4cd711['models']['VoiceExtension'][_0x5431('0x43')](_[_0x5431('0x44')](_0xd4e422,_0x5431('0x16')),{'transaction':_0x5ae717});});});})[_0x5431('0x45')](function(_0x2a1d0f){console['error'](_0x2a1d0f);});}exports[_0x5431('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 01b1f7c..79b8a45 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 _0xe734=['Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ListId','updatedAt','select','field','ContactId','toString','NOW()','createdAt','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_contacts','id\x20IN\x20?','str','calleridnum','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','get','query','VoiceQueueId','onlyIfOpen','sequelize','all','Campaign','dialCheckDuplicateType','always','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','squel','papaparse','../../../mysqldb','api','redis','defaults','../../../api/cmContact/cmContact.socket','register','argv','null','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xe734,0xd0));var _0x4e73=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xe734[_0x122096];return _0x3d1966;};'use strict';var BPromise=require('bluebird');var util=require(_0x4e73('0x0'));var _=require('lodash');var fs=require('fs');var squel=require(_0x4e73('0x1'));var Papa=require(_0x4e73('0x2'));var Redis=require('ioredis');var db=require(_0x4e73('0x3'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x4e73('0x4'));config[_0x4e73('0x5')]=_[_0x4e73('0x6')](config[_0x4e73('0x5')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4e73('0x5')]));require(_0x4e73('0x7'))[_0x4e73('0x8')](socket);try{if(!process[_0x4e73('0x9')][0x2]||process[_0x4e73('0x9')][0x2]==='undefined'||process[_0x4e73('0x9')][0x2]===_0x4e73('0xa')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x4e73('0x9')][0x2];if(!process[_0x4e73('0x9')][0x3]||process['argv'][0x3]==='undefined'||process[_0x4e73('0x9')][0x3]===_0x4e73('0xa')||!process['argv'][0x4]||process[_0x4e73('0x9')][0x4]===_0x4e73('0xb')||process[_0x4e73('0x9')][0x4]===_0x4e73('0xa')){throw new Error(_0x4e73('0xc'));}var FIELDS=_[_0x4e73('0xd')](process[_0x4e73('0x9')][0x3][_0x4e73('0xe')](','),process[_0x4e73('0x9')][0x4]['split'](','));if(!process[_0x4e73('0x9')][0x5]||process[_0x4e73('0x9')][0x5]==='undefined'||process[_0x4e73('0x9')][0x5]===_0x4e73('0xa')){throw new Error(_0x4e73('0xf'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x4e73('0x9')][0x6]&&process[_0x4e73('0x9')][0x6]!==_0x4e73('0xb')&&process[_0x4e73('0x9')][0x6]!==_0x4e73('0xa')?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x4e73('0x9')][0x7]!==_0x4e73('0xb')&&process[_0x4e73('0x9')][0x7]!==_0x4e73('0xa')?process[_0x4e73('0x9')][0x7]:null;if(!process[_0x4e73('0x9')][0x8]||process[_0x4e73('0x9')][0x8]===_0x4e73('0xb')||process[_0x4e73('0x9')][0x8]===_0x4e73('0xa')){throw new Error(_0x4e73('0x10'));}var SOCKET_TIMESTAMP=process[_0x4e73('0x9')][0x8];}catch(_0xf20ad){logger[_0x4e73('0x11')](_0xf20ad);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(_0x294945,_0x159dd3,_0x4720d2,_0x5c6e95){var _0x506417={'message':_0x159dd3};_0x506417[_0x294945]=!![];if(_0x4720d2){_0x506417[_0x4e73('0x12')]=_0x4720d2;}if(_0x5c6e95){_0x506417['index']=_0x5c6e95;}return _0x506417;}function isEmail(_0xd221db){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))*$/[_0x4e73('0x13')](_0xd221db);}function checkRow(_0x44d1d9,_0x2a013e,_0x5c9b81){return new BPromise(function(_0x12c50d,_0x317928){if(_[_0x4e73('0x14')](_0x44d1d9)){return _0x317928(handleCheckRowError(_0x4e73('0x11'),_0x4e73('0x15'),null,_0x5c9b81));}if(_0x44d1d9[_0x4e73('0x16')]&&_0x44d1d9[_0x4e73('0x16')][_0x4e73('0x17')]){var _0x21e1b4=_['map'](_0x44d1d9[_0x4e73('0x16')],_0x4e73('0x18'))[_0x4e73('0x19')](';');return _0x317928(handleCheckRowError('error',_0x21e1b4,null,_0x5c9b81));}var _0x398328={};for(var _0x590b72 in FIELDS){if(FIELDS[_0x4e73('0x1a')](_0x590b72)&&FIELDS[_0x590b72]){_0x398328[_0x590b72]=_0x44d1d9[_0x4e73('0x1b')][0x0][FIELDS[_0x590b72]]||_0x44d1d9[_0x4e73('0x1b')][0x0]['\ufeff'+FIELDS[_0x590b72]];}}if(!_0x398328[_0x4e73('0x1c')]){return _0x317928(handleCheckRowError(_0x4e73('0x11'),_0x4e73('0x1d'),null,_0x5c9b81));}if(!_0x398328[_0x4e73('0x1e')]){return _0x317928(handleCheckRowError(_0x4e73('0x11'),_0x4e73('0x1f'),null,_0x5c9b81));}if(_0x398328[_0x4e73('0x20')]){var _0x337b3b=moment(_0x398328[_0x4e73('0x20')],_0x4e73('0x21'));if(!_0x337b3b[_0x4e73('0x22')]()){return _0x317928(handleCheckRowError('error',_0x4e73('0x23'),null,_0x5c9b81));}}if(_0x398328[_0x4e73('0x24')]){if(!isEmail(_0x398328['email'])){return _0x317928(handleCheckRowError(_0x4e73('0x11'),_0x4e73('0x25'),null,_0x5c9b81));}}_0x398328['ListId']=LISTID;_0x398328[_0x4e73('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x4e73('0x17')]&&_0x2a013e){var _0x1594d2={};for(var _0x4c0613=0x0,_0x5e298d=DUPLICATES[_0x4e73('0x17')];_0x4c0613<_0x5e298d;_0x4c0613+=0x1){_0x1594d2[DUPLICATES[_0x4c0613]]=_0x398328[DUPLICATES[_0x4c0613]];}var _0x1a55a0=_[_0x4e73('0x27')](_0x2a013e,_0x1594d2);if(_0x1a55a0){return _0x317928(handleCheckRowError(_0x4e73('0x28'),_0x4e73('0x29'),_0x1a55a0,_0x5c9b81));}}return db[_0x4e73('0x2a')][_0x4e73('0x2b')](_0x398328,{'raw':!![],'hooks':![],'fields':_['keys'](_0x398328)})[_0x4e73('0x2c')](function(_0xb3c808){if(DUPLICATES&&DUPLICATES[_0x4e73('0x17')]&&_0x2a013e){_0x2a013e[_0x4e73('0x2d')](_[_0x4e73('0x2e')](_0x398328,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xb3c808['id'];return _0x12c50d();})[_0x4e73('0x2f')](function(_0x3929e4){return _0x317928(handleCheckRowError(_0x4e73('0x11'),_0x4e73('0x30')+(_0x3929e4['message']||JSON[_0x4e73('0x31')](_0x3929e4)),null,_0x5c9b81));});});}function checkHopper(){function _0x5be2c0(){return function(_0x5b5d21){logger[_0x4e73('0x11')](_0x4e73('0x32'),_0x4e73('0x33'),util[_0x4e73('0x34')](_0x5b5d21,{'showHidden':![],'depth':null}));};}var _0x5c9261=function(_0x7330d5,_0x1acbdb){var _0x3f43a9=squel[_0x4e73('0x35')]()[_0x4e73('0x36')](_0x4e73('0x37'))[_0x4e73('0x38')]([_0x4e73('0x1e'),_0x4e73('0x39'),'ContactId',_0x4e73('0x3a'),_0x1acbdb,'createdAt',_0x4e73('0x3b')],squel[_0x4e73('0x3c')]()[_0x4e73('0x3d')](_0x4e73('0x1e'),_0x4e73('0x1e'))[_0x4e73('0x3d')]('NOW()',_0x4e73('0x39'))[_0x4e73('0x3d')]('id',_0x4e73('0x3e'))[_0x4e73('0x3d')](LISTID[_0x4e73('0x3f')](),'ListId')[_0x4e73('0x3d')](_0x7330d5['id'][_0x4e73('0x3f')](),_0x1acbdb)[_0x4e73('0x3d')](_0x4e73('0x40'),_0x4e73('0x41'))[_0x4e73('0x3d')](_0x4e73('0x40'),_0x4e73('0x3b'))[_0x4e73('0x42')]('cm_contacts')[_0x4e73('0x43')](_0x4e73('0x44'))['where'](_0x4e73('0x45'),LISTID[_0x4e73('0x3f')]())[_0x4e73('0x43')](_0x4e73('0x46'))[_0x4e73('0x43')](_0x4e73('0x47'),squel['select']()[_0x4e73('0x3d')]('phone')[_0x4e73('0x42')](_0x4e73('0x37'))['where'](_0x1acbdb+_0x4e73('0x48'),_0x7330d5['id'][_0x4e73('0x3f')]())))[_0x4e73('0x3f')]();return _0x3f43a9;};var _0xc9c60=function(_0x5725a6,_0x581ea5){var _0x4bf58c=squel['insert']()[_0x4e73('0x36')]('cm_hopper')[_0x4e73('0x38')]([_0x4e73('0x1e'),'scheduledAt','ContactId',_0x4e73('0x3a'),_0x581ea5,_0x4e73('0x41'),_0x4e73('0x3b')],squel['select']()['field'](_0x4e73('0x1e'),_0x4e73('0x1e'))['field'](_0x4e73('0x40'),_0x4e73('0x39'))['field']('id','ContactId')[_0x4e73('0x3d')](LISTID[_0x4e73('0x3f')](),'ListId')['field'](_0x5725a6['id'][_0x4e73('0x3f')](),_0x581ea5)[_0x4e73('0x3d')]('NOW()',_0x4e73('0x41'))[_0x4e73('0x3d')](_0x4e73('0x40'),_0x4e73('0x3b'))['from'](_0x4e73('0x49'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x4e73('0x45'),LISTID[_0x4e73('0x3f')]())[_0x4e73('0x43')](_0x4e73('0x4a'),squel[_0x4e73('0x4b')](hopperContacts))[_0x4e73('0x43')](_0x4e73('0x46'))['where'](_0x4e73('0x47'),squel[_0x4e73('0x3c')]()[_0x4e73('0x3d')](_0x4e73('0x4c'))['from']('cm_hopper_final')[_0x4e73('0x43')](_0x581ea5+_0x4e73('0x48'),_0x5725a6['id'][_0x4e73('0x3f')]()))['where'](_0x4e73('0x47'),squel[_0x4e73('0x3c')]()[_0x4e73('0x3d')](_0x4e73('0x1e'))[_0x4e73('0x42')](_0x4e73('0x37'))[_0x4e73('0x43')](_0x581ea5+_0x4e73('0x48'),_0x5725a6['id']['toString']())))[_0x4e73('0x3f')]();return _0x4bf58c;};function _0x5810f9(_0xc33cb6,_0x11f04c){var _0x30daef=squel[_0x4e73('0x35')]()[_0x4e73('0x36')](_0x4e73('0x37'))['fromQuery']([_0x4e73('0x1e'),_0x4e73('0x39'),_0x4e73('0x3e'),'ListId',_0x11f04c,'createdAt',_0x4e73('0x3b')],squel['select']()[_0x4e73('0x3d')](_0x4e73('0x1e'),_0x4e73('0x1e'))[_0x4e73('0x3d')](_0x4e73('0x40'),'scheduledAt')['field']('id',_0x4e73('0x3e'))[_0x4e73('0x3d')](LISTID[_0x4e73('0x3f')](),_0x4e73('0x3a'))['field'](_0xc33cb6['id']['toString'](),_0x11f04c)['field'](_0x4e73('0x40'),_0x4e73('0x41'))[_0x4e73('0x3d')](_0x4e73('0x40'),'updatedAt')['from']('cm_contacts')[_0x4e73('0x43')](_0x4e73('0x44'))[_0x4e73('0x43')](_0x4e73('0x45'),LISTID[_0x4e73('0x3f')]())[_0x4e73('0x43')](_0x4e73('0x4a'),squel[_0x4e73('0x4b')](hopperContacts))[_0x4e73('0x43')](_0x4e73('0x46')))[_0x4e73('0x3f')]();return _0x30daef;}function _0x3291f9(_0x41174c,_0xbb8264){var _0x4f2ae5=squel[_0x4e73('0x35')]()[_0x4e73('0x36')](_0x4e73('0x4d'))[_0x4e73('0x38')]([_0x4e73('0x1e'),'ContactId',_0x4e73('0x3a'),_0xbb8264,_0x4e73('0x41'),_0x4e73('0x3b')],squel[_0x4e73('0x3c')]()[_0x4e73('0x3d')](_0x4e73('0x1e'),_0x4e73('0x1e'))['field']('id','ContactId')[_0x4e73('0x3d')](LISTID['toString'](),'ListId')[_0x4e73('0x3d')](_0x41174c['id'][_0x4e73('0x3f')](),_0xbb8264)[_0x4e73('0x3d')](_0x4e73('0x40'),_0x4e73('0x41'))[_0x4e73('0x3d')](_0x4e73('0x40'),_0x4e73('0x3b'))[_0x4e73('0x42')]('cm_contacts')[_0x4e73('0x43')](_0x4e73('0x44'))[_0x4e73('0x43')]('ListId\x20=\x20?',LISTID[_0x4e73('0x3f')]())[_0x4e73('0x43')](_0x4e73('0x4a'),squel[_0x4e73('0x4b')](hopperContacts))['where'](_0x4e73('0x46')))[_0x4e73('0x3f')]();return _0x4f2ae5;}return db[_0x4e73('0x4e')][_0x4e73('0x4f')]({'where':{'type':_0x4e73('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x4e73('0x51')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x53944f){var _0x3c5115=[];if(_0x53944f){var _0x2f489e;for(var _0x3c34ea=0x0,_0x35acc1;_0x3c34ea<_0x53944f[_0x4e73('0x17')];_0x3c34ea+=0x1){_0x35acc1=_0x53944f[_0x3c34ea][_0x4e73('0x52')]({'plain':!![]});switch(_0x35acc1['dialCheckDuplicateType']){case'always':_0x3c5115[_0x4e73('0x2d')](db['sequelize'][_0x4e73('0x53')](_0xc9c60(_0x35acc1,_0x4e73('0x54')))[_0x4e73('0x2c')](function(){})[_0x4e73('0x2f')](_0x5be2c0()));break;case _0x4e73('0x55'):_0x3c5115[_0x4e73('0x2d')](db['sequelize'][_0x4e73('0x53')](_0x5c9261(_0x35acc1,_0x4e73('0x54')))[_0x4e73('0x2c')](function(){})[_0x4e73('0x2f')](_0x5be2c0()));break;default:_0x3c5115[_0x4e73('0x2d')](db[_0x4e73('0x56')]['query'](_0x5810f9(_0x35acc1,_0x4e73('0x54')))['then'](function(){})[_0x4e73('0x2f')](_0x5be2c0()));}}}return _0x3c5115;})[_0x4e73('0x57')]()[_0x4e73('0x2c')](function(){return db['VoiceQueue'][_0x4e73('0x4f')]({'where':{'type':_0x4e73('0x50')},'attributes':['id'],'include':[{'model':db[_0x4e73('0x51')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x4e73('0x2c')](function(_0x1438d9){var _0x306d5d=[];if(_0x1438d9){var _0x468c94;for(var _0x47fbc2=0x0,_0x5970ad;_0x47fbc2<_0x1438d9[_0x4e73('0x17')];_0x47fbc2+=0x1){_0x5970ad=_0x1438d9[_0x47fbc2]['get']({'plain':!![]});_0x306d5d['push'](db[_0x4e73('0x56')][_0x4e73('0x53')](_0x3291f9(_0x5970ad,_0x4e73('0x54')))[_0x4e73('0x2c')](function(){})['catch'](_0x5be2c0()));}}return _0x306d5d;})[_0x4e73('0x57')]();})[_0x4e73('0x2c')](function(){return db[_0x4e73('0x58')][_0x4e73('0x4f')]({'attributes':['id',_0x4e73('0x59')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x2d9a46){var _0x29debe=[];if(_0x2d9a46){for(var _0x440ce9=0x0,_0x37c75c;_0x440ce9<_0x2d9a46[_0x4e73('0x17')];_0x440ce9+=0x1){_0x37c75c=_0x2d9a46[_0x440ce9][_0x4e73('0x52')]({'plain':!![]});switch(_0x37c75c['dialCheckDuplicateType']){case _0x4e73('0x5a'):_0x29debe['push'](db['sequelize'][_0x4e73('0x53')](_0xc9c60(_0x37c75c,'CampaignId'))[_0x4e73('0x2c')](function(){})[_0x4e73('0x2f')](_0x5be2c0()));break;case _0x4e73('0x55'):_0x29debe[_0x4e73('0x2d')](db[_0x4e73('0x56')]['query'](_0x5c9261(_0x37c75c,_0x4e73('0x5b')))['then'](function(){})[_0x4e73('0x2f')](_0x5be2c0()));break;default:_0x29debe[_0x4e73('0x2d')](db[_0x4e73('0x56')][_0x4e73('0x53')](_0x5810f9(_0x37c75c,_0x4e73('0x5b')))[_0x4e73('0x2c')](function(){})['catch'](_0x5be2c0()));}}}return _0x29debe;})['all']();})[_0x4e73('0x2c')](function(){return db[_0x4e73('0x58')][_0x4e73('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x4e73('0x51')],'as':_0x4e73('0x5c'),'where':{'id':LISTID}}]})[_0x4e73('0x2c')](function(_0x15c04b){var _0x4a505d=[];if(_0x15c04b){for(var _0x8ce846=0x0,_0x455755;_0x8ce846<_0x15c04b[_0x4e73('0x17')];_0x8ce846+=0x1){_0x455755=_0x15c04b[_0x8ce846]['get']({'plain':!![]});_0x4a505d[_0x4e73('0x2d')](db['sequelize'][_0x4e73('0x53')](_0x3291f9(_0x455755,_0x4e73('0x5b')))['then'](function(){})[_0x4e73('0x2f')](_0x5be2c0()));}}return _0x4a505d;})[_0x4e73('0x57')]();})['catch'](function(_0x2dd915){logger[_0x4e73('0x11')](_0x4e73('0x5d'),_0x4e73('0x5e'),_0x2dd915[_0x4e73('0x18')]);});}var processPromises=function(_0x4f4140){return BPromise['all'](promises)['then'](function(_0x25a42e){})[_0x4e73('0x2f')](function(_0x40521f){logger[_0x4e73('0x11')](_0x4e73('0x5f'),JSON[_0x4e73('0x31')](_0x40521f));})[_0x4e73('0x60')](function(){socket[_0x4e73('0x61')](_0x4e73('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4f4140){return _0x4f4140[_0x4e73('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x4e73('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0x4e73('0x2c')](function(){socket[_0x4e73('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x4e73('0x64')](FILEPATH);}catch(_0x1f0c7b){logger[_0x4e73('0x11')](_0x4e73('0x65'),JSON['stringify'](_0x1f0c7b));}finally{process[_0x4e73('0x66')](0x0);}});};process['on'](_0x4e73('0x67'),function(){logger[_0x4e73('0x68')](_0x4e73('0x69'));endCsv();});function main(){return BPromise[_0x4e73('0x6a')]()[_0x4e73('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x4e73('0xe')](',');return db[_0x4e73('0x2a')][_0x4e73('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x4e73('0x2c')](function(_0x478839){var _0x479ffa=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x4e73('0x6b')](_0x479ffa,{'header':!![],'skipEmptyLines':!![],'step':function(_0x19f419,_0x564ab0){total+=0x1;var _0xe47136=total;promises[_0x4e73('0x2d')](checkRow(_0x19f419,_0x478839,_0xe47136)[_0x4e73('0x2c')](function(){success+=0x1;})['catch'](function(_0x1e9bd0){if(_0x1e9bd0[_0x4e73('0x11')]){errors+=0x1;delete _0x1e9bd0[_0x4e73('0x11')];}else if(_0x1e9bd0[_0x4e73('0x28')]){duplicates+=0x1;delete _0x1e9bd0[_0x4e73('0x28')];}rows[_0x4e73('0x2d')](_0x1e9bd0);}));if(total%0xc8===0x0){_0x564ab0[_0x4e73('0x6c')]();return processPromises(_0x564ab0);}},'complete':function(){return processPromises()[_0x4e73('0x2c')](function(){logger['info'](_0x4e73('0x6d'));endCsv();});},'error':function(_0x370352,_0x269607){logger[_0x4e73('0x68')](_0x4e73('0x6e'),JSON['stringify'](_0x370352));endCsv();}});})[_0x4e73('0x2f')](function(_0xbb7a1b){logger['error'](_0x4e73('0x6f'),JSON[_0x4e73('0x31')](_0xbb7a1b));});}main(); \ No newline at end of file +var _0x8d5e=['bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','CmContact','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','createdAt','select','phone','NOW()','field','ContactId','toString','updatedAt','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','into','str','calleridnum','cm_hopper_final','cm_contacts','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','always','push','sequelize','query','onlyIfOpen','VoiceQueueId','BlackLists','all','Campaign','CmList','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x8d5e,0x74));var _0xe8d5=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x8d5e[_0xefd519];return _0x4bb882;};'use strict';var BPromise=require(_0xe8d5('0x0'));var util=require('util');var _=require(_0xe8d5('0x1'));var fs=require('fs');var squel=require(_0xe8d5('0x2'));var Papa=require(_0xe8d5('0x3'));var Redis=require(_0xe8d5('0x4'));var db=require(_0xe8d5('0x5'))['db'];var config=require(_0xe8d5('0x6'));var logger=require(_0xe8d5('0x7'))(_0xe8d5('0x8'));config[_0xe8d5('0x9')]=_[_0xe8d5('0xa')](config['redis'],{'host':_0xe8d5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8d5('0x9')]));require('../../../api/cmContact/cmContact.socket')[_0xe8d5('0xc')](socket);try{if(!process[_0xe8d5('0xd')][0x2]||process['argv'][0x2]===_0xe8d5('0xe')||process[_0xe8d5('0xd')][0x2]===_0xe8d5('0xf')){throw new Error(_0xe8d5('0x10'));}var FILEPATH=process[_0xe8d5('0xd')][0x2];if(!process['argv'][0x3]||process[_0xe8d5('0xd')][0x3]===_0xe8d5('0xe')||process[_0xe8d5('0xd')][0x3]===_0xe8d5('0xf')||!process[_0xe8d5('0xd')][0x4]||process['argv'][0x4]===_0xe8d5('0xe')||process[_0xe8d5('0xd')][0x4]===_0xe8d5('0xf')){throw new Error(_0xe8d5('0x11'));}var FIELDS=_[_0xe8d5('0x12')](process[_0xe8d5('0xd')][0x3][_0xe8d5('0x13')](','),process[_0xe8d5('0xd')][0x4][_0xe8d5('0x13')](','));if(!process[_0xe8d5('0xd')][0x5]||process['argv'][0x5]===_0xe8d5('0xe')||process[_0xe8d5('0xd')][0x5]===_0xe8d5('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xe8d5('0xd')][0x6]&&process['argv'][0x6]!==_0xe8d5('0xe')&&process[_0xe8d5('0xd')][0x6]!==_0xe8d5('0xf')?process[_0xe8d5('0xd')][0x6]:null;var DUPLICATES=process[_0xe8d5('0xd')][0x7]&&process[_0xe8d5('0xd')][0x7]!==_0xe8d5('0xe')&&process['argv'][0x7]!=='null'?process[_0xe8d5('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0xe8d5('0xd')][0x8]==='undefined'||process[_0xe8d5('0xd')][0x8]===_0xe8d5('0xf')){throw new Error(_0xe8d5('0x14'));}var SOCKET_TIMESTAMP=process[_0xe8d5('0xd')][0x8];}catch(_0x5e2d73){logger[_0xe8d5('0x15')](_0x5e2d73);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(_0x584df4,_0x23dac9,_0x4e6799,_0x49cd27){var _0x1ae098={'message':_0x23dac9};_0x1ae098[_0x584df4]=!![];if(_0x4e6799){_0x1ae098[_0xe8d5('0x16')]=_0x4e6799;}if(_0x49cd27){_0x1ae098[_0xe8d5('0x17')]=_0x49cd27;}return _0x1ae098;}function isEmail(_0x1764da){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))*$/[_0xe8d5('0x18')](_0x1764da);}function checkRow(_0x2570e5,_0x47664c,_0x281791){return new BPromise(function(_0x32fdc7,_0x551ce4){if(_[_0xe8d5('0x19')](_0x2570e5)){return _0x551ce4(handleCheckRowError(_0xe8d5('0x15'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x281791));}if(_0x2570e5['errors']&&_0x2570e5[_0xe8d5('0x1a')][_0xe8d5('0x1b')]){var _0x13fd87=_[_0xe8d5('0x1c')](_0x2570e5[_0xe8d5('0x1a')],_0xe8d5('0x1d'))[_0xe8d5('0x1e')](';');return _0x551ce4(handleCheckRowError('error',_0x13fd87,null,_0x281791));}var _0x3fd5a3={};for(var _0x17933e in FIELDS){if(FIELDS[_0xe8d5('0x1f')](_0x17933e)&&FIELDS[_0x17933e]){_0x3fd5a3[_0x17933e]=_0x2570e5[_0xe8d5('0x20')][0x0][FIELDS[_0x17933e]]||_0x2570e5['data'][0x0]['\ufeff'+FIELDS[_0x17933e]];}}if(!_0x3fd5a3['firstName']){return _0x551ce4(handleCheckRowError(_0xe8d5('0x15'),_0xe8d5('0x21'),null,_0x281791));}if(!_0x3fd5a3['phone']){return _0x551ce4(handleCheckRowError(_0xe8d5('0x15'),_0xe8d5('0x22'),null,_0x281791));}if(_0x3fd5a3[_0xe8d5('0x23')]){var _0x1c67e4=moment(_0x3fd5a3[_0xe8d5('0x23')],_0xe8d5('0x24'));if(!_0x1c67e4[_0xe8d5('0x25')]()){return _0x551ce4(handleCheckRowError(_0xe8d5('0x15'),_0xe8d5('0x26'),null,_0x281791));}}if(_0x3fd5a3[_0xe8d5('0x27')]){if(!isEmail(_0x3fd5a3['email'])){return _0x551ce4(handleCheckRowError(_0xe8d5('0x15'),_0xe8d5('0x28'),null,_0x281791));}}_0x3fd5a3[_0xe8d5('0x29')]=LISTID;_0x3fd5a3[_0xe8d5('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xe8d5('0x1b')]&&_0x47664c){var _0x5f13da={};for(var _0x7db5de=0x0,_0x16419a=DUPLICATES[_0xe8d5('0x1b')];_0x7db5de<_0x16419a;_0x7db5de+=0x1){_0x5f13da[DUPLICATES[_0x7db5de]]=_0x3fd5a3[DUPLICATES[_0x7db5de]];}var _0x4079f4=_[_0xe8d5('0x2b')](_0x47664c,_0x5f13da);if(_0x4079f4){return _0x551ce4(handleCheckRowError(_0xe8d5('0x2c'),'Duplicate\x20Contact',_0x4079f4,_0x281791));}}return db[_0xe8d5('0x2d')]['create'](_0x3fd5a3,{'raw':!![],'hooks':![],'fields':_[_0xe8d5('0x2e')](_0x3fd5a3)})[_0xe8d5('0x2f')](function(_0xeca382){if(DUPLICATES&&DUPLICATES['length']&&_0x47664c){_0x47664c['push'](_[_0xe8d5('0x30')](_0x3fd5a3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xeca382['id'];return _0x32fdc7();})[_0xe8d5('0x31')](function(_0x340071){return _0x551ce4(handleCheckRowError(_0xe8d5('0x15'),_0xe8d5('0x32')+(_0x340071[_0xe8d5('0x1d')]||JSON[_0xe8d5('0x33')](_0x340071)),null,_0x281791));});});}function checkHopper(){function _0x1456db(){return function(_0x1d05f8){logger[_0xe8d5('0x15')](_0xe8d5('0x34'),_0xe8d5('0x35'),util[_0xe8d5('0x36')](_0x1d05f8,{'showHidden':![],'depth':null}));};}var _0x55cc0c=function(_0x267c85,_0x42ef95){var _0x178d11=squel[_0xe8d5('0x37')]()['into'](_0xe8d5('0x38'))[_0xe8d5('0x39')](['phone',_0xe8d5('0x3a'),'ContactId',_0xe8d5('0x29'),_0x42ef95,_0xe8d5('0x3b'),'updatedAt'],squel[_0xe8d5('0x3c')]()['field'](_0xe8d5('0x3d'),_0xe8d5('0x3d'))['field'](_0xe8d5('0x3e'),_0xe8d5('0x3a'))[_0xe8d5('0x3f')]('id',_0xe8d5('0x40'))['field'](LISTID['toString'](),_0xe8d5('0x29'))['field'](_0x267c85['id'][_0xe8d5('0x41')](),_0x42ef95)[_0xe8d5('0x3f')](_0xe8d5('0x3e'),'createdAt')['field']('NOW()',_0xe8d5('0x42'))[_0xe8d5('0x43')]('cm_contacts')[_0xe8d5('0x44')](_0xe8d5('0x45'))[_0xe8d5('0x44')](_0xe8d5('0x46'),LISTID['toString']())[_0xe8d5('0x44')](_0xe8d5('0x47'))[_0xe8d5('0x44')](_0xe8d5('0x48'),squel[_0xe8d5('0x3c')]()[_0xe8d5('0x3f')]('phone')['from'](_0xe8d5('0x38'))['where'](_0x42ef95+_0xe8d5('0x49'),_0x267c85['id'][_0xe8d5('0x41')]())))[_0xe8d5('0x41')]();return _0x178d11;};var _0x4a81b1=function(_0x5cae9c,_0x89aeb9){var _0x1dfd33=squel['insert']()[_0xe8d5('0x4a')]('cm_hopper')[_0xe8d5('0x39')](['phone',_0xe8d5('0x3a'),_0xe8d5('0x40'),'ListId',_0x89aeb9,_0xe8d5('0x3b'),_0xe8d5('0x42')],squel['select']()[_0xe8d5('0x3f')](_0xe8d5('0x3d'),_0xe8d5('0x3d'))[_0xe8d5('0x3f')]('NOW()',_0xe8d5('0x3a'))[_0xe8d5('0x3f')]('id',_0xe8d5('0x40'))['field'](LISTID[_0xe8d5('0x41')](),_0xe8d5('0x29'))[_0xe8d5('0x3f')](_0x5cae9c['id'][_0xe8d5('0x41')](),_0x89aeb9)['field'](_0xe8d5('0x3e'),'createdAt')['field']('NOW()','updatedAt')['from']('cm_contacts')[_0xe8d5('0x44')]('deletedAt\x20IS\x20NULL')[_0xe8d5('0x44')](_0xe8d5('0x46'),LISTID['toString']())['where']('id\x20IN\x20?',squel[_0xe8d5('0x4b')](hopperContacts))[_0xe8d5('0x44')](_0xe8d5('0x47'))[_0xe8d5('0x44')](_0xe8d5('0x48'),squel[_0xe8d5('0x3c')]()[_0xe8d5('0x3f')](_0xe8d5('0x4c'))[_0xe8d5('0x43')](_0xe8d5('0x4d'))[_0xe8d5('0x44')](_0x89aeb9+'\x20=\x20?',_0x5cae9c['id']['toString']()))['where'](_0xe8d5('0x48'),squel['select']()['field']('phone')[_0xe8d5('0x43')]('cm_hopper')['where'](_0x89aeb9+_0xe8d5('0x49'),_0x5cae9c['id'][_0xe8d5('0x41')]())))[_0xe8d5('0x41')]();return _0x1dfd33;};function _0x67b8b5(_0x407346,_0x545931){var _0x438d7b=squel[_0xe8d5('0x37')]()['into'](_0xe8d5('0x38'))[_0xe8d5('0x39')]([_0xe8d5('0x3d'),'scheduledAt',_0xe8d5('0x40'),'ListId',_0x545931,_0xe8d5('0x3b'),_0xe8d5('0x42')],squel[_0xe8d5('0x3c')]()[_0xe8d5('0x3f')]('phone',_0xe8d5('0x3d'))[_0xe8d5('0x3f')](_0xe8d5('0x3e'),_0xe8d5('0x3a'))[_0xe8d5('0x3f')]('id',_0xe8d5('0x40'))['field'](LISTID[_0xe8d5('0x41')](),_0xe8d5('0x29'))['field'](_0x407346['id'][_0xe8d5('0x41')](),_0x545931)[_0xe8d5('0x3f')](_0xe8d5('0x3e'),'createdAt')['field']('NOW()',_0xe8d5('0x42'))[_0xe8d5('0x43')](_0xe8d5('0x4e'))[_0xe8d5('0x44')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0xe8d5('0x41')]())[_0xe8d5('0x44')](_0xe8d5('0x4f'),squel['str'](hopperContacts))[_0xe8d5('0x44')](_0xe8d5('0x47')))[_0xe8d5('0x41')]();return _0x438d7b;}function _0xd0d56f(_0x53b565,_0x4e3379){var _0x5405b0=squel[_0xe8d5('0x37')]()[_0xe8d5('0x4a')]('cm_hopper_black')['fromQuery']([_0xe8d5('0x3d'),_0xe8d5('0x40'),_0xe8d5('0x29'),_0x4e3379,_0xe8d5('0x3b'),_0xe8d5('0x42')],squel[_0xe8d5('0x3c')]()[_0xe8d5('0x3f')](_0xe8d5('0x3d'),_0xe8d5('0x3d'))['field']('id',_0xe8d5('0x40'))[_0xe8d5('0x3f')](LISTID[_0xe8d5('0x41')](),_0xe8d5('0x29'))['field'](_0x53b565['id'][_0xe8d5('0x41')](),_0x4e3379)[_0xe8d5('0x3f')]('NOW()',_0xe8d5('0x3b'))['field'](_0xe8d5('0x3e'),_0xe8d5('0x42'))[_0xe8d5('0x43')](_0xe8d5('0x4e'))[_0xe8d5('0x44')](_0xe8d5('0x45'))[_0xe8d5('0x44')](_0xe8d5('0x46'),LISTID[_0xe8d5('0x41')]())['where'](_0xe8d5('0x4f'),squel[_0xe8d5('0x4b')](hopperContacts))[_0xe8d5('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0xe8d5('0x41')]();return _0x5405b0;}return db[_0xe8d5('0x50')][_0xe8d5('0x51')]({'where':{'type':_0xe8d5('0x52')},'attributes':['id',_0xe8d5('0x53')],'include':[{'model':db['CmList'],'as':_0xe8d5('0x54'),'where':{'id':LISTID}}]})[_0xe8d5('0x2f')](function(_0x59113b){var _0x4d50c1=[];if(_0x59113b){var _0x2305e7;for(var _0x59b270=0x0,_0x35033f;_0x59b270<_0x59113b[_0xe8d5('0x1b')];_0x59b270+=0x1){_0x35033f=_0x59113b[_0x59b270][_0xe8d5('0x55')]({'plain':!![]});switch(_0x35033f[_0xe8d5('0x53')]){case _0xe8d5('0x56'):_0x4d50c1[_0xe8d5('0x57')](db[_0xe8d5('0x58')][_0xe8d5('0x59')](_0x4a81b1(_0x35033f,'VoiceQueueId'))[_0xe8d5('0x2f')](function(){})[_0xe8d5('0x31')](_0x1456db()));break;case _0xe8d5('0x5a'):_0x4d50c1['push'](db[_0xe8d5('0x58')]['query'](_0x55cc0c(_0x35033f,'VoiceQueueId'))['then'](function(){})['catch'](_0x1456db()));break;default:_0x4d50c1[_0xe8d5('0x57')](db[_0xe8d5('0x58')]['query'](_0x67b8b5(_0x35033f,_0xe8d5('0x5b')))[_0xe8d5('0x2f')](function(){})['catch'](_0x1456db()));}}}return _0x4d50c1;})['all']()[_0xe8d5('0x2f')](function(){return db[_0xe8d5('0x50')][_0xe8d5('0x51')]({'where':{'type':_0xe8d5('0x52')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xe8d5('0x5c'),'where':{'id':LISTID}}]})[_0xe8d5('0x2f')](function(_0x54d203){var _0x329137=[];if(_0x54d203){var _0x1afdbd;for(var _0x41db0b=0x0,_0x219c42;_0x41db0b<_0x54d203[_0xe8d5('0x1b')];_0x41db0b+=0x1){_0x219c42=_0x54d203[_0x41db0b][_0xe8d5('0x55')]({'plain':!![]});_0x329137[_0xe8d5('0x57')](db[_0xe8d5('0x58')][_0xe8d5('0x59')](_0xd0d56f(_0x219c42,'VoiceQueueId'))[_0xe8d5('0x2f')](function(){})['catch'](_0x1456db()));}}return _0x329137;})[_0xe8d5('0x5d')]();})[_0xe8d5('0x2f')](function(){return db[_0xe8d5('0x5e')][_0xe8d5('0x51')]({'attributes':['id',_0xe8d5('0x53')],'include':[{'model':db[_0xe8d5('0x5f')],'as':_0xe8d5('0x54'),'where':{'id':LISTID}}]})[_0xe8d5('0x2f')](function(_0x45aca8){var _0x279273=[];if(_0x45aca8){for(var _0x2b6797=0x0,_0x3ff8fa;_0x2b6797<_0x45aca8['length'];_0x2b6797+=0x1){_0x3ff8fa=_0x45aca8[_0x2b6797][_0xe8d5('0x55')]({'plain':!![]});switch(_0x3ff8fa[_0xe8d5('0x53')]){case _0xe8d5('0x56'):_0x279273[_0xe8d5('0x57')](db['sequelize'][_0xe8d5('0x59')](_0x4a81b1(_0x3ff8fa,_0xe8d5('0x60')))[_0xe8d5('0x2f')](function(){})[_0xe8d5('0x31')](_0x1456db()));break;case _0xe8d5('0x5a'):_0x279273[_0xe8d5('0x57')](db[_0xe8d5('0x58')][_0xe8d5('0x59')](_0x55cc0c(_0x3ff8fa,'CampaignId'))[_0xe8d5('0x2f')](function(){})[_0xe8d5('0x31')](_0x1456db()));break;default:_0x279273['push'](db[_0xe8d5('0x58')][_0xe8d5('0x59')](_0x67b8b5(_0x3ff8fa,'CampaignId'))[_0xe8d5('0x2f')](function(){})[_0xe8d5('0x31')](_0x1456db()));}}}return _0x279273;})[_0xe8d5('0x5d')]();})['then'](function(){return db['Campaign'][_0xe8d5('0x51')]({'attributes':['id'],'include':[{'model':db[_0xe8d5('0x5f')],'as':_0xe8d5('0x5c'),'where':{'id':LISTID}}]})[_0xe8d5('0x2f')](function(_0x26d90f){var _0x4db088=[];if(_0x26d90f){for(var _0x8edb45=0x0,_0x156c49;_0x8edb45<_0x26d90f[_0xe8d5('0x1b')];_0x8edb45+=0x1){_0x156c49=_0x26d90f[_0x8edb45][_0xe8d5('0x55')]({'plain':!![]});_0x4db088[_0xe8d5('0x57')](db[_0xe8d5('0x58')]['query'](_0xd0d56f(_0x156c49,_0xe8d5('0x60')))[_0xe8d5('0x2f')](function(){})[_0xe8d5('0x31')](_0x1456db()));}}return _0x4db088;})['all']();})[_0xe8d5('0x31')](function(_0x3fad38){logger[_0xe8d5('0x15')](_0xe8d5('0x61'),_0xe8d5('0x62'),_0x3fad38[_0xe8d5('0x1d')]);});}var processPromises=function(_0x38d8ff){return BPromise['all'](promises)[_0xe8d5('0x2f')](function(_0x31ff76){})['catch'](function(_0x3b992d){logger[_0xe8d5('0x15')](_0xe8d5('0x63'),JSON[_0xe8d5('0x33')](_0x3b992d));})[_0xe8d5('0x64')](function(){socket[_0xe8d5('0x65')](_0xe8d5('0x66')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x38d8ff){return _0x38d8ff[_0xe8d5('0x67')]();}});};var endCsv=function(){return BPromise[_0xe8d5('0x68')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xe8d5('0x2f')](function(){socket['emit'](_0xe8d5('0x66')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe8d5('0x69')](FILEPATH);}catch(_0x5b3ea1){logger[_0xe8d5('0x15')](_0xe8d5('0x6a'),JSON[_0xe8d5('0x33')](_0x5b3ea1));}finally{process[_0xe8d5('0x6b')](0x0);}});};process['on'](_0xe8d5('0x6c'),function(){logger[_0xe8d5('0x6d')](_0xe8d5('0x6e'));endCsv();});function main(){return BPromise['resolve']()[_0xe8d5('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xe8d5('0x2f')](function(_0x249376){var _0x47f0e7=fs[_0xe8d5('0x6f')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x47f0e7,{'header':!![],'skipEmptyLines':!![],'step':function(_0xbabdae,_0x3c60b7){total+=0x1;var _0x442c00=total;promises[_0xe8d5('0x57')](checkRow(_0xbabdae,_0x249376,_0x442c00)[_0xe8d5('0x2f')](function(){success+=0x1;})[_0xe8d5('0x31')](function(_0x205623){if(_0x205623[_0xe8d5('0x15')]){errors+=0x1;delete _0x205623[_0xe8d5('0x15')];}else if(_0x205623['duplicate']){duplicates+=0x1;delete _0x205623[_0xe8d5('0x2c')];}rows[_0xe8d5('0x57')](_0x205623);}));if(total%0xc8===0x0){_0x3c60b7[_0xe8d5('0x70')]();return processPromises(_0x3c60b7);}},'complete':function(){return processPromises()[_0xe8d5('0x2f')](function(){logger[_0xe8d5('0x6d')](_0xe8d5('0x71'));endCsv();});},'error':function(_0x40db81,_0x454e07){logger[_0xe8d5('0x6d')](_0xe8d5('0x72'),JSON[_0xe8d5('0x33')](_0x40db81));endCsv();}});})['catch'](function(_0x5e6f39){logger[_0xe8d5('0x15')](_0xe8d5('0x73'),JSON[_0xe8d5('0x33')](_0x5e6f39));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 55367db..44ed9b0 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 _0xb384=['code','info','sequelize','query','spread','campaigns.id','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','catch','message','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','set','offset','main','start','binding','clone','root','server/files/tmp','includes','keys','ContactItemType','name','_description','header','parse','createReadStream','data','rows','find','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','hasOwnProperty','trim','itemTypeId','description','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','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','contactId','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','exit','complete','argv','arguments\x20\x20\x20','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','moment','squel','ioredis','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','split','all','isNil','filter','CmContactHasItem','updated','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','phone','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','createdAt','.id\x20=\x20','cm_hopper_black','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.updatedAt','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','min_id','group','error','errors'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xb384,0x1c0));var _0x4b38=function(_0x5b6f05,_0x2bc97b){_0x5b6f05=_0x5b6f05-0x0;var _0x5d37db=_0xb384[_0x5b6f05];return _0x5d37db;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x4b38('0x0'));var Papa=require(_0x4b38('0x1'));var util=require(_0x4b38('0x2'));var BPromise=require('bluebird');var moment=require(_0x4b38('0x3'));var squel=require(_0x4b38('0x4'));var Redis=require(_0x4b38('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x4b38('0x6'));var shared=require('../../../config/environment/shared');var logger=require(_0x4b38('0x7'))('import');config[_0x4b38('0x8')]=_[_0x4b38('0x9')](config[_0x4b38('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b38('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x4b38('0xb')](_0x4b38('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x4b38('0xc'));function isEmail(_0x2cab5b){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))*$/[_0x4b38('0xd')](_0x2cab5b);}function selectNotIn(_0x108120,_0xed0a93,_0x24ec9c,_0x1ffeb9,_0x58f6ca){return squel[_0x4b38('0xe')]()[_0x4b38('0xf')]('phone')[_0x4b38('0x10')](_0x1ffeb9)[_0x4b38('0x11')](_0xed0a93,null,_0xed0a93+'.id\x20=\x20'+_0x1ffeb9+'.'+_0x24ec9c)['where'](_0x1ffeb9+'.'+_0x24ec9c+'\x20=\x20'+_0x108120+'.'+_0x24ec9c)[_0x4b38('0x12')](_0xed0a93+_0x4b38('0x13')+_0x58f6ca[_0x4b38('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1d7c98,_0x13463e){promisesAdditionalPhones=[];return db[_0x4b38('0x14')][_0x4b38('0x15')]({'raw':!![],'attributes':['id',_0x4b38('0x16')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x4b38('0x17')](function(_0xb2dbf7){if(_0xb2dbf7!==null){var _0x11a949=[];for(var _0x263473=0x0;_0x263473<_0xb2dbf7[_0x4b38('0x18')];_0x263473++){var _0x4efb05=_0xb2dbf7[_0x263473];_0x11a949[_0x4b38('0x19')](insertAdditionalPhones(_0x4efb05));}}Promise['all'](_0x11a949)[_0x4b38('0x17')](function(){_0x1d7c98({'val':0x1});});});});}function insertAdditionalPhones(_0x4d3931){return new Promise(function(_0x604275,_0x319978){var _0x4e3869=_0x4d3931[_0x4b38('0x16')];var _0xc90e92=_0x4e3869[_0x4b38('0x1a')](';');var _0x2c36a4=[];orderBy=0x0;for(var _0x3b50e3=0x0;_0x3b50e3<_0xc90e92['length'];_0x3b50e3++){_0x2c36a4[_0x4b38('0x19')](splitAdditionalPhone(_0x4d3931['id'],_0xc90e92[_0x3b50e3]));}Promise[_0x4b38('0x1b')](_0x2c36a4)[_0x4b38('0x17')](function(){_0x604275({'val':_0xc90e92[_0x4b38('0x18')]});});});}function splitAdditionalPhone(_0x3a3c28,_0x1fc7af){return new Promise(function(_0x1571b8,_0x36122b){var _0x236160=_0x1fc7af[_0x4b38('0x1a')](':');var _0xc0bc53=_0x236160[0x0];var _0x7a2976=_0x236160[0x1];if(!_[_0x4b38('0x1c')](_0x7a2976)){var _0x52f501=_0x7a2976[_0x4b38('0x1a')]('|');var _0x2d9b3e=[];for(var _0x68ab8d=0x0;_0x68ab8d<_0x52f501['length'];_0x68ab8d++){if(_0x52f501[_0x68ab8d]!==''){var _0x510eda=_[_0x4b38('0x1d')](promisesAdditionalPhones,{'contactId':_0x3a3c28,'phone':_0x52f501[_0x68ab8d]});if(_0x510eda[_0x4b38('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0x4b38('0x19')]({'contactId':_0x3a3c28,'contactTypeId':_0xc0bc53,'phone':_0x52f501[_0x68ab8d],'orderBy':orderBy});}}}_0x1571b8({'ok':0x1});}else _0x1571b8({'res':0x0});});}function createAdditionalPhone(_0x8ac386,_0x14890f,_0x7e9941,_0x2c9bd3){var _0x5b8734='';var _0x5dfc38='';var _0x3df773=_0x7e9941[_0x4b38('0x1a')]('§');_0x5b8734=_0x3df773[0x0];if(_0x3df773[_0x4b38('0x18')]==0x2)_0x5dfc38=_0x3df773[0x1];return new Promise(function(_0x271224,_0x12c3cb){return db[_0x4b38('0x1e')]['findOne']({'where':{'CmContactId':_0x8ac386,'item':_0x5b8734}})[_0x4b38('0x17')](function(_0x3a1df0){if(_0x3a1df0){return db[_0x4b38('0x1e')]['update']({'ItemTypeId':_0x14890f,'description':_0x5dfc38,'OrderBy':_0x2c9bd3},{'where':{'CmContactId':_0x8ac386,'item':_0x5b8734}})[_0x4b38('0x17')](function(_0x599379){_0x271224({'res':_0x4b38('0x1f')});});}else{return db['CmContactHasItem'][_0x4b38('0x20')]({'CmContactId':_0x8ac386,'item':_0x5b8734,'description':_0x5dfc38,'ItemTypeId':_0x14890f,'OrderBy':_0x2c9bd3,'ItemClass':'PHONE'})[_0x4b38('0x17')](function(_0x3a4bbc){_0x271224({'res':_0x4b38('0x21')});});}});});}function insertCmHopper(_0x10fd99,_0x219ad8,_0x12d95b,_0x3015ce,_0x7415ef){var _0x567741=[_0x4b38('0x22'),_0x4b38('0x23'),_0x4b38('0x24'),_0x4b38('0x25'),_0x219ad8+'.'+_0x3015ce,_0x4b38('0x26'),'cm_contacts.updatedAt',_0x4b38('0x27'),_0x4b38('0x28'),'\x22'+_0x7415ef+'\x22'];return squel[_0x4b38('0x29')]()[_0x4b38('0x2a')]('cm_hopper')[_0x4b38('0x2b')]([_0x4b38('0x2c'),_0x4b38('0x2d'),_0x4b38('0x2e'),_0x4b38('0x2f'),_0x3015ce,'createdAt',_0x4b38('0x30'),_0x4b38('0x31'),_0x4b38('0x32'),_0x4b38('0x33')],squel['select']()[_0x4b38('0x34')](_0x567741)[_0x4b38('0x10')](_0x219ad8)[_0x4b38('0x11')](_0x4b38('0x35'),null,_0x4b38('0x36')+_0x219ad8+_0x4b38('0x37'))[_0x4b38('0x11')](_0x12d95b,null,_0x12d95b+'.id\x20=\x20'+_0x219ad8+'.'+_0x3015ce)[_0x4b38('0x12')](_0x219ad8+_0x4b38('0x38'),_0x10fd99)['where'](_0x4b38('0x39'),NOW)[_0x4b38('0x12')](_0x4b38('0x3a'),selectNotIn(_0x219ad8,_0x12d95b,_0x3015ce,_0x4b38('0x3b'),[_0x4b38('0x3c'),_0x4b38('0x3d')]))[_0x4b38('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x219ad8,_0x12d95b,_0x3015ce,'cm_hopper',[_0x4b38('0x3c')])))[_0x4b38('0x3e')]();}function insertCmHopperBlack(_0x51bb6a,_0x1afc7a,_0x2ade6f,_0x3eb620){var _0x50ea37=[_0x4b38('0x22'),'cm_contacts.id',_0x4b38('0x25'),_0x1afc7a+'.'+_0x3eb620,_0x4b38('0x26'),'cm_contacts.updatedAt'];return squel[_0x4b38('0x29')]()[_0x4b38('0x2a')]('cm_hopper_black')[_0x4b38('0x2b')](['phone',_0x4b38('0x2e'),_0x4b38('0x2f'),_0x3eb620,_0x4b38('0x3f'),_0x4b38('0x30')],squel[_0x4b38('0xe')]()[_0x4b38('0x34')](_0x50ea37)['from'](_0x1afc7a)[_0x4b38('0x11')](_0x4b38('0x35'),null,_0x4b38('0x36')+_0x1afc7a+'.CmListId')[_0x4b38('0x11')](_0x2ade6f,null,_0x2ade6f+_0x4b38('0x40')+_0x1afc7a+'.'+_0x3eb620)['where'](_0x1afc7a+_0x4b38('0x38'),_0x51bb6a)[_0x4b38('0x12')](_0x4b38('0x39'),NOW)['where'](_0x4b38('0x3a'),squel[_0x4b38('0xe')]()[_0x4b38('0xf')](_0x4b38('0x2c'))[_0x4b38('0x10')](_0x4b38('0x41'))[_0x4b38('0x12')]('ListId\x20=\x20?',_0x51bb6a)[_0x4b38('0x12')](_0x3eb620+_0x4b38('0x42')+_0x1afc7a+'.'+_0x3eb620)))[_0x4b38('0x3e')]();}function insertTzCmHopper(_0x5c983c,_0x2aa4e5,_0x377e62,_0x27d67a,_0x4b5804,_0x1033a1){var _0x53ab9b=[_0x4b38('0x22'),_0x4b38('0x43')+_0x1033a1+'.offset-cm_contacts.utcOffset\x20minute)',_0x4b38('0x24'),_0x4b38('0x25'),_0x2aa4e5+'.'+_0x27d67a,_0x4b38('0x26'),_0x4b38('0x44'),_0x4b38('0x27'),'cm_contacts.UserId','\x22'+_0x4b5804+'\x22'];var _0x226054=squel['insert']()[_0x4b38('0x2a')](_0x4b38('0x3b'))[_0x4b38('0x2b')](['phone',_0x4b38('0x2d'),_0x4b38('0x2e'),_0x4b38('0x2f'),_0x27d67a,_0x4b38('0x3f'),_0x4b38('0x30'),'priority',_0x4b38('0x32'),'recallme'],squel[_0x4b38('0xe')]()[_0x4b38('0x34')](_0x53ab9b)[_0x4b38('0x10')](_0x2aa4e5)[_0x4b38('0x11')](_0x4b38('0x35'),null,_0x4b38('0x36')+_0x2aa4e5+'.CmListId')['join'](_0x377e62,null,_0x377e62+_0x4b38('0x40')+_0x2aa4e5+'.'+_0x27d67a)[_0x4b38('0x11')](_0x1033a1,null,_0x1033a1+_0x4b38('0x40')+_0x2aa4e5+'.'+_0x27d67a)[_0x4b38('0x12')](_0x2aa4e5+'.CmListId\x20=\x20?',_0x5c983c)[_0x4b38('0x12')](_0x4b38('0x39'),NOW)[_0x4b38('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2aa4e5,_0x377e62,_0x27d67a,'cm_hopper',[_0x4b38('0x3c'),_0x4b38('0x3d')]))[_0x4b38('0x12')](_0x4b38('0x3a'),selectNotIn(_0x2aa4e5,_0x377e62,_0x27d67a,_0x4b38('0x3b'),[_0x4b38('0x3c')])))[_0x4b38('0x3e')]();return _0x226054;}function insertTzCmHopperBlack(_0xe3a847,_0x30da02,_0x1dd05c,_0x41725e){var _0x161a68=[_0x4b38('0x22'),'cm_contacts.id',_0x4b38('0x25'),_0x30da02+'.'+_0x41725e,_0x4b38('0x26'),_0x4b38('0x44')];return squel[_0x4b38('0x29')]()[_0x4b38('0x2a')]('cm_hopper_black')[_0x4b38('0x2b')](['phone',_0x4b38('0x2e'),_0x4b38('0x2f'),_0x41725e,_0x4b38('0x3f'),_0x4b38('0x30')],squel[_0x4b38('0xe')]()[_0x4b38('0x34')](_0x161a68)[_0x4b38('0x10')](_0x30da02)['join'](_0x4b38('0x35'),null,_0x4b38('0x36')+_0x30da02+_0x4b38('0x37'))['join'](_0x1dd05c,null,_0x1dd05c+'.id\x20=\x20'+_0x30da02+'.'+_0x41725e)[_0x4b38('0x12')](_0x30da02+_0x4b38('0x38'),_0xe3a847)[_0x4b38('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x4b38('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x4b38('0xe')]()['field'](_0x4b38('0x2c'))[_0x4b38('0x10')](_0x4b38('0x41'))[_0x4b38('0x12')]('ListId\x20=\x20?',_0xe3a847)[_0x4b38('0x12')](_0x41725e+_0x4b38('0x42')+_0x30da02+'.'+_0x41725e)))[_0x4b38('0x3e')]();}function insertCmHopperAdditionalPhones(_0x25f9d4){var _0x1f7312=[_0x4b38('0x45'),_0x4b38('0x46'),'cm_contact_has_items.OrderBy',_0x4b38('0x47'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0x4b38('0x2a')](_0x4b38('0x48'))[_0x4b38('0x2b')]([_0x4b38('0x49'),_0x4b38('0x2c'),_0x4b38('0x4a'),'createdAt','updatedAt'],squel[_0x4b38('0xe')]()[_0x4b38('0x34')](_0x1f7312)[_0x4b38('0x10')](_0x4b38('0x3b'))[_0x4b38('0x11')](_0x4b38('0x35'),null,_0x4b38('0x4b'))[_0x4b38('0x11')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x4b38('0x12')](_0x4b38('0x4c'),_0x25f9d4)[_0x4b38('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x4b38('0x3e')]();}function insertCmContact(_0x10db78,_0x1f3674,_0x1b5129,_0x5a8fef){var _0x251f91=_[_0x4b38('0x4d')](_['keys'](_0x5a8fef),[_0x4b38('0x2f'),_0x4b38('0x4e'),_0x4b38('0x3f'),_0x4b38('0x30'),'scheduledAt']);return squel[_0x4b38('0x29')]()['into'](_0x4b38('0x35'))[_0x4b38('0x2b')](_0x251f91,squel[_0x4b38('0xe')]()['fields'](_0x251f91)[_0x4b38('0x10')](_0x1f3674)['where']('('+_0x1b5129[_0x4b38('0x11')](',')+_0x4b38('0x4f'),squel['select']()[_0x4b38('0x34')](_0x1b5129)[_0x4b38('0x10')](_0x4b38('0x35'))[_0x4b38('0x12')](_0x4b38('0x50'),_0x10db78)[_0x4b38('0x12')](_0x4b38('0x51')))['where']('id\x20IN\x20?',squel['select']()[_0x4b38('0xf')]('MIN(id)',_0x4b38('0x52'))[_0x4b38('0x10')](_0x1f3674)[_0x4b38('0x53')](_0x1b5129[_0x4b38('0x11')](','))))[_0x4b38('0x3e')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x1d0af8){logger[_0x4b38('0x54')](_0x1d0af8['message']);process['exit'](0x1);}function handleError(_0x5f20c0,_0x561e3b){stats[_0x4b38('0x55')][_0x4b38('0x19')]({'name':_0x561e3b[_0x4b38('0x56')],'message':_0x561e3b['message'],'row':_0x5f20c0});}function handleQuery(_0x20004){logger[_0x4b38('0x57')](_0x20004);return db[_0x4b38('0x58')][_0x4b38('0x59')](_0x20004)[_0x4b38('0x5a')](function(_0x56e1e7){results['push'](_0x56e1e7);})['catch'](function(_0xc5f12){logger[_0x4b38('0x54')](_0xc5f12['message']);});}function updateTzCampaigns(_0xd01508){return new Promise(function(_0x3e8d98,_0x2ded0b){var _0x569167=squel['select']()[_0x4b38('0x34')]([_0x4b38('0x5b'),'campaigns.dialTimezone'])[_0x4b38('0x10')]('campaigns')[_0x4b38('0x11')](_0x4b38('0x5c'),null,_0x4b38('0x5d'))['where']('campaigns_has_cm_lists.CmListId='+_0xd01508);db['sequelize']['query'](_0x569167[_0x4b38('0x3e')]())[_0x4b38('0x5a')](function(_0x42d886){var _0x322422=[];for(var _0x5bea07=0x0;_0x5bea07<_0x42d886['length'];_0x5bea07++){_0x322422['push'](getTimezoneData(_0x42d886[_0x5bea07],tmp_campaigns));}BPromise[_0x4b38('0x1b')](_0x322422)[_0x4b38('0x17')](function(){_0x3e8d98({'val':0x1});});})[_0x4b38('0x5e')](function(_0x1e9813){logger[_0x4b38('0x54')](_0x1e9813[_0x4b38('0x5f')]);_0x3e8d98({'val':0x0});});});}function updateTzVoiceQueues(_0x45eaa6){return new Promise(function(_0x2270d5,_0xadb779){var _0x3e1441=squel[_0x4b38('0xe')]()['fields']([_0x4b38('0x60'),'voice_queues.dialTimezone'])[_0x4b38('0x10')](_0x4b38('0x61'))[_0x4b38('0x11')](_0x4b38('0x62'),null,_0x4b38('0x63'))['where'](_0x4b38('0x64')+_0x45eaa6);db[_0x4b38('0x58')][_0x4b38('0x59')](_0x3e1441[_0x4b38('0x3e')]())[_0x4b38('0x5a')](function(_0x4c9d4d){var _0x2d4da6=[];for(var _0x184432=0x0;_0x184432<_0x4c9d4d['length'];_0x184432++){_0x2d4da6[_0x4b38('0x19')](getTimezoneData(_0x4c9d4d[_0x184432],tmp_voice_queues));}BPromise[_0x4b38('0x1b')](_0x2d4da6)['then'](function(){_0x2270d5({'val':0x1});});})['catch'](function(_0x57f61e){logger[_0x4b38('0x54')](_0x57f61e[_0x4b38('0x5f')]);_0x2270d5({'val':0x0});});});}function getTimezoneData(_0x48ee4c,_0x5231c0){return new Promise(function(_0x42769b,_0x481d33){var _0x5396f9=shared[_0x4b38('0x65')];var _0x5d1b49=_0x5396f9[_0x48ee4c[_0x4b38('0x66')]];if(_[_0x4b38('0x1c')](_0x5d1b49)){_0x42769b({'ret':0x1});}else{var _0x33e7b3=_0x5d1b49['utcOffset'];var _0x580674=squel[_0x4b38('0x29')]()[_0x4b38('0x2a')](_0x5231c0)[_0x4b38('0x67')]('id',_0x48ee4c['id'])[_0x4b38('0x67')](_0x4b38('0x68'),_0x33e7b3)[_0x4b38('0x67')](_0x4b38('0x66'),_0x48ee4c[_0x4b38('0x66')])[_0x4b38('0x3e')]();return db[_0x4b38('0x58')][_0x4b38('0x59')](_0x580674)['spread'](function(_0xe08f51){_0x42769b({'ret':0x1});})[_0x4b38('0x5e')](function(_0x556cb5){logger[_0x4b38('0x54')](_0x556cb5[_0x4b38('0x5f')]);_0x481d33({'ret':0x1});});}});}function handleTZQuery(_0x5397c8){logger[_0x4b38('0x57')](_0x5397c8);return db[_0x4b38('0x58')][_0x4b38('0x59')](_0x5397c8)[_0x4b38('0x5a')](function(_0x5eb39a){})['catch'](function(_0x1bd67e){logger[_0x4b38('0x54')](_0x1bd67e[_0x4b38('0x5f')]);});}function main(_0x20ff42,_0x28b448,_0x341f2d,_0x3d66f3){logger[_0x4b38('0x57')](_0x4b38('0x69'),_0x20ff42,JSON['stringify'](_0x28b448));process['send'](_0x4b38('0x6a'));var _0x56dd1a=_0x28b448[_0x4b38('0x6b')];var _0x50afee=_[_0x4b38('0x6c')](_0x56dd1a);var _0x2e5fda=_0x28b448['socket_timestamp'];var _0x3aa220=path[_0x4b38('0x11')](config[_0x4b38('0x6d')],_0x4b38('0x6e'),_0x2e5fda+'.csv');hasTZ=_['keys'](_0x56dd1a)[_0x4b38('0x6f')](_0x4b38('0x66'));var _0x1a3865=_[_0x4b38('0x70')](_0x56dd1a)[_0x4b38('0x11')]();logger[_0x4b38('0x57')]('header',_0x1a3865);db[_0x4b38('0x71')]['findAll']({'raw':!![],'attributes':['id',_0x4b38('0x72')]})[_0x4b38('0x17')](function(_0x4b0661){for(var _0x1d8ec3=0x0;_0x1d8ec3<_0x4b0661[_0x4b38('0x18')];_0x1d8ec3++){if(_0x4b0661[_0x1d8ec3][_0x4b38('0x72')]in _0x56dd1a){contactItemTypes[_0x4b38('0x19')](_0x4b0661[_0x1d8ec3]);delete _0x50afee[_0x4b0661[_0x1d8ec3]['name']];hasAdditionalPhones=!![];}for(var _0x374d69 in _0x56dd1a){if(_0x4b0661[_0x1d8ec3][_0x4b38('0x72')]+_0x4b38('0x73')===_0x374d69){phoneDescriptions[_0x4b38('0x19')]({'itemTypeId':_0x4b0661[_0x1d8ec3]['id'],'description':_0x374d69});delete _0x50afee[_0x374d69];}}}if(hasAdditionalPhones)_0x50afee['AdditionalPhones']='';var _0xc994d4=_[_0x4b38('0x70')](_0x50afee)['join']();logger[_0x4b38('0x57')](_0x4b38('0x74'),_0xc994d4);fs['writeFileSync'](_0x3aa220,_0xc994d4+'\x0a');Papa[_0x4b38('0x75')](fs[_0x4b38('0x76')](_0x20ff42),{'header':!![],'skipEmptyLines':!![],'step':function(_0x58dd97,_0x3d5897){try{for(var _0xeb871b=0x0,_0x43344f=[];_0xeb871b<_0x58dd97[_0x4b38('0x77')][_0x4b38('0x18')];_0xeb871b++){stats[_0x4b38('0x78')]+=0x1;if(_0x58dd97['errors'][_0xeb871b]){handleError(_0x58dd97[_0x4b38('0x77')][_0xeb871b],_0x58dd97[_0x4b38('0x55')][_0xeb871b]);}else{var _0x343661=[];var _0x24ecec=[];var _0x4512e8={};for(var _0x45191c in _0x56dd1a){let _0xcfde34=contactItemTypes[_0x4b38('0x79')](_0x51c11a=>_0x51c11a[_0x4b38('0x72')]===_0x45191c);let _0x5e039b=contactItemTypes[_0x4b38('0x79')](_0x560b7d=>_0x560b7d[_0x4b38('0x72')]+'_description'===_0x45191c);if(_['isNil'](_0xcfde34)&&_[_0x4b38('0x1c')](_0x5e039b)){if(_0x56dd1a['hasOwnProperty'](_0x45191c)){if(_0x58dd97[_0x4b38('0x77')][_0xeb871b][_0x56dd1a[_0x45191c]]){var _0x5adeba=_['trim'](_0x58dd97['data'][_0xeb871b][_0x56dd1a[_0x45191c]][_0x4b38('0x7a')](/"/g,'\x27'));switch(_0x45191c){case _0x4b38('0x2d'):var _0x513ef3=moment(_0x5adeba,_0x4b38('0xc'),!![]);if(_0x513ef3['isValid']()){_0x43344f[_0x4b38('0x19')]('\x22'+_0x5adeba+'\x22');}else{_0x343661[_0x4b38('0x19')](_0x4b38('0x7b'));}break;case'priority':var _0x47fda4=parseInt(_0x5adeba);_0x5adeba=_[_0x4b38('0x7c')](_0x47fda4)||_0x47fda4<0x0||_0x47fda4>0x4?_0x3d66f3?0x3:0x2:_0x47fda4;_0x43344f[_0x4b38('0x19')]('\x22'+_0x5adeba+'\x22');break;case _0x4b38('0x32'):var _0x6fa42d=parseInt(_0x5adeba);if(_[_0x4b38('0x7d')](_0x6fa42d)&&_[_0x4b38('0x6f')](_0x341f2d,_0x6fa42d)){_0x43344f[_0x4b38('0x19')]('\x22'+_0x6fa42d+'\x22');}else{_0x343661[_0x4b38('0x19')](_0x4b38('0x7e'));}break;case _0x4b38('0x7f'):if(isEmail(_0x5adeba)){_0x43344f[_0x4b38('0x19')]('\x22'+_0x5adeba+'\x22');}else{_0x343661['push']('email\x20wrong\x20format');}break;case _0x4b38('0x80'):var _0x770f46=moment(_0x5adeba,_0x4b38('0x81'),!![]);if(_0x770f46['isValid']()){_0x43344f[_0x4b38('0x19')]('\x22'+_0x5adeba+'\x22');}else{_0x343661[_0x4b38('0x19')](_0x4b38('0x82'));}break;case _0x4b38('0x66'):var _0x291f5e=shared['timezones'];var _0x188eb5=_0x291f5e[_0x5adeba];if(!_[_0x4b38('0x1c')](_0x188eb5)){var _0x458f19=_0x188eb5[_0x4b38('0x83')];_0x43344f[_0x4b38('0x19')]('\x22'+_0x5adeba+'\x22');_0x43344f['push']('\x22'+_0x458f19+'\x22');}break;default:_0x43344f[_0x4b38('0x19')]('\x22'+_0x5adeba+'\x22');}}else{switch(_0x45191c){case _0x4b38('0x84'):case _0x4b38('0x2c'):_0x343661[_0x4b38('0x19')](_0x45191c+'\x20not\x20specified');break;default:_0x43344f[_0x4b38('0x19')]('\x22\x22');}}}}else{var _0x9bc6ab='';if(!_[_0x4b38('0x1c')](_0xcfde34)){if(!_0x4512e8[_0x4b38('0x85')](_0xcfde34['id'])){if(!_[_0x4b38('0x1c')](_0x58dd97['data'][_0xeb871b][_0x56dd1a[_0x45191c]])){var _0x5adeba=_[_0x4b38('0x86')](_0x58dd97[_0x4b38('0x77')][_0xeb871b][_0x56dd1a[_0x45191c]][_0x4b38('0x7a')](/"/g,'\x27'));var _0x5e9924=phoneDescriptions['find'](_0x27b229=>_0x27b229[_0x4b38('0x87')]===_0xcfde34['id']);if(!_[_0x4b38('0x1c')](_0x5e9924)){var _0x4d07a3=_[_0x4b38('0x86')](_0x58dd97['data'][_0xeb871b][_0x56dd1a[_0x5e9924[_0x4b38('0x88')]]]['replace'](/"/g,'\x27'));if(!_[_0x4b38('0x1c')](_0x4d07a3))_0x5adeba=_0x5adeba+'§'+_0x4d07a3;}if(_0x9bc6ab=='')_0x9bc6ab=_0x5adeba;else _0x9bc6ab+='|'+_0x5adeba;}_0x24ecec[_0x4b38('0x19')](_0xcfde34['id']+':'+_0x9bc6ab);_0x4512e8[_0xcfde34['id']]=0x1;}}}}if(hasAdditionalPhones){_0x43344f[_0x4b38('0x19')]('\x22'+_0x24ecec[_0x4b38('0x11')](';')+'\x22');}if(_0x343661[_0x4b38('0x18')]){handleError(_0x58dd97[_0x4b38('0x77')][_0xeb871b],{'code':'SystemRow','message':_0x343661['join']()});}else{fs[_0x4b38('0x89')](_0x3aa220,_0x43344f[_0x4b38('0x11')]()+'\x0a');}_0x43344f=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x4b38('0x8a')+_0x2e5fda,stats);stats[_0x4b38('0x55')]=[];}}if(stopped){logger[_0x4b38('0x57')](_0x4b38('0x8b'));_0x3d5897[_0x4b38('0x8c')]();}}catch(_0x194634){handleError(_0x58dd97[_0x4b38('0x77')][_0xeb871b],{'code':_0x4b38('0x8d'),'message':_0x194634[_0x4b38('0x5f')]});logger[_0x4b38('0x54')](_0x4b38('0x8e'),_0x194634[_0x4b38('0x5f')]);}},'complete':function(){try{var _0x591420=[];var _0x532588=[];var _0x480781=_0x4b38('0x35');if(_0x28b448[_0x4b38('0x8f')]&&_0x28b448[_0x4b38('0x8f')][_0x4b38('0x18')]){_0x480781=_0x4b38('0x90')+_0x2e5fda;_0x591420[_0x4b38('0x19')](_0x4b38('0x91')+_0x480781+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x4b38('0x92')+_0x2e5fda;tmp_voice_queues=_0x4b38('0x93')+_0x2e5fda;_0x532588[_0x4b38('0x19')](_0x4b38('0x91')+tmp_campaigns+_0x4b38('0x94'));_0x532588[_0x4b38('0x19')](_0x4b38('0x91')+tmp_voice_queues+_0x4b38('0x94'));BPromise[_0x4b38('0x95')](_0x532588,handleTZQuery)[_0x4b38('0x17')](function(_0x1fe7d2){updateTzCampaigns(_0x28b448[_0x4b38('0x2f')])[_0x4b38('0x17')](function(_0x1fcb08){updateTzVoiceQueues(_0x28b448[_0x4b38('0x2f')])['then'](function(_0x1045fb){if(hasTZ)_0xc994d4=_0xc994d4[_0x4b38('0x7a')](_0x4b38('0x66'),_0x4b38('0x96'));var _0x2fc442=util['format'](_0x4b38('0x97'),_0x3aa220,_0x480781,_0xc994d4,_0x28b448[_0x4b38('0x2f')],_0x28b448[_0x4b38('0x4e')]||null,NOW,NOW);if(_[_0x4b38('0x1c')](_0x56dd1a['scheduledat'])){_0x2fc442+=',\x20scheduledAt\x20=\x20NOW()';}_0x591420[_0x4b38('0x19')](_0x2fc442);if(_0x28b448[_0x4b38('0x8f')]&&_0x28b448[_0x4b38('0x8f')]['length']){_0x591420['push'](insertCmContact(_0x28b448['ListId'],_0x480781,_0x28b448[_0x4b38('0x8f')],_0x56dd1a));_0x591420['push']('DROP\x20TABLE\x20'+_0x480781+';');}BPromise[_0x4b38('0x95')](_0x591420,handleQuery)['then'](function(_0x11b200){BPromise[_0x4b38('0x1b')]([handleAdditionalPhones()])[_0x4b38('0x17')](function(){_0x591420=[];for(var _0x659a7c=0x0;_0x659a7c\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','from','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','cm_contacts.createdAt'];(function(_0x23d98f,_0x31d925){var _0x18a67d=function(_0x284e8d){while(--_0x284e8d){_0x23d98f['push'](_0x23d98f['shift']());}};_0x18a67d(++_0x31d925);}(_0xedb6,0x7c));var _0x6edb=function(_0x239b31,_0x44a64d){_0x239b31=_0x239b31-0x0;var _0x41c8be=_0xedb6[_0x239b31];return _0x41c8be;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x6edb('0x0'));var util=require(_0x6edb('0x1'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x6edb('0x2'));var Redis=require(_0x6edb('0x3'));var db=require(_0x6edb('0x4'))['db'];var config=require('../../../config/environment');var shared=require(_0x6edb('0x5'));var logger=require(_0x6edb('0x6'))(_0x6edb('0x7'));config[_0x6edb('0x8')]=_[_0x6edb('0x9')](config['redis'],{'host':_0x6edb('0xa'),'port':0x18eb});var socket=require(_0x6edb('0xb'))(new Redis(config[_0x6edb('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x6edb('0xc')](_0x6edb('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x6edb('0xc')](_0x6edb('0xd'));function isEmail(_0x22c6b3){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))*$/[_0x6edb('0xe')](_0x22c6b3);}function selectNotIn(_0x35c5e6,_0x79e579,_0x505710,_0x43b2cd,_0x339cfc){return squel[_0x6edb('0xf')]()[_0x6edb('0x10')](_0x6edb('0x11'))['from'](_0x43b2cd)[_0x6edb('0x12')](_0x79e579,null,_0x79e579+_0x6edb('0x13')+_0x43b2cd+'.'+_0x505710)[_0x6edb('0x14')](_0x43b2cd+'.'+_0x505710+_0x6edb('0x15')+_0x35c5e6+'.'+_0x505710)[_0x6edb('0x14')](_0x79e579+_0x6edb('0x16')+_0x339cfc[_0x6edb('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x413f7d,_0x433741){promisesAdditionalPhones=[];return db[_0x6edb('0x17')][_0x6edb('0x18')]({'raw':!![],'attributes':['id',_0x6edb('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x6edb('0x1a')](function(_0x317023){if(_0x317023!==null){var _0x2dae46=[];for(var _0x5b6fbd=0x0;_0x5b6fbd<_0x317023[_0x6edb('0x1b')];_0x5b6fbd++){var _0x581d99=_0x317023[_0x5b6fbd];_0x2dae46[_0x6edb('0x1c')](insertAdditionalPhones(_0x581d99));}}Promise[_0x6edb('0x1d')](_0x2dae46)[_0x6edb('0x1a')](function(){_0x413f7d({'val':0x1});});});});}function insertAdditionalPhones(_0x221f41){return new Promise(function(_0x509ea9,_0x4b697d){var _0x1bda3e=_0x221f41[_0x6edb('0x19')];var _0x8101cd=_0x1bda3e[_0x6edb('0x1e')](';');var _0x1f88b7=[];orderBy=0x0;for(var _0x44cfd3=0x0;_0x44cfd3<_0x8101cd['length'];_0x44cfd3++){_0x1f88b7[_0x6edb('0x1c')](splitAdditionalPhone(_0x221f41['id'],_0x8101cd[_0x44cfd3]));}Promise['all'](_0x1f88b7)['then'](function(){_0x509ea9({'val':_0x8101cd[_0x6edb('0x1b')]});});});}function splitAdditionalPhone(_0x1dd25d,_0xfff25f){return new Promise(function(_0xd9fbb2,_0xe66a75){var _0x2d7ca0=_0xfff25f[_0x6edb('0x1e')](':');var _0x3ce7d5=_0x2d7ca0[0x0];var _0x2c9c98=_0x2d7ca0[0x1];if(!_['isNil'](_0x2c9c98)){var _0x1344ba=_0x2c9c98[_0x6edb('0x1e')]('|');var _0x2e8776=[];for(var _0x49a9ef=0x0;_0x49a9ef<_0x1344ba[_0x6edb('0x1b')];_0x49a9ef++){if(_0x1344ba[_0x49a9ef]!==''){var _0x48056f=_['filter'](promisesAdditionalPhones,{'contactId':_0x1dd25d,'phone':_0x1344ba[_0x49a9ef]});if(_0x48056f[_0x6edb('0x1b')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x1dd25d,'contactTypeId':_0x3ce7d5,'phone':_0x1344ba[_0x49a9ef],'orderBy':orderBy});}}}_0xd9fbb2({'ok':0x1});}else _0xd9fbb2({'res':0x0});});}function createAdditionalPhone(_0x5a0173,_0x4b1e33,_0x1b67c9,_0x479c35){var _0x1d15fa='';var _0x26d764='';var _0x17444e=_0x1b67c9[_0x6edb('0x1e')]('§');_0x1d15fa=_0x17444e[0x0];if(_0x17444e['length']==0x2)_0x26d764=_0x17444e[0x1];return new Promise(function(_0x54666d,_0x29e952){return db[_0x6edb('0x1f')][_0x6edb('0x20')]({'where':{'CmContactId':_0x5a0173,'item':_0x1d15fa}})[_0x6edb('0x1a')](function(_0x41a0f3){if(_0x41a0f3){return db[_0x6edb('0x1f')][_0x6edb('0x21')]({'ItemTypeId':_0x4b1e33,'description':_0x26d764,'OrderBy':_0x479c35},{'where':{'CmContactId':_0x5a0173,'item':_0x1d15fa}})[_0x6edb('0x1a')](function(_0x5b54ef){_0x54666d({'res':_0x6edb('0x22')});});}else{return db[_0x6edb('0x1f')][_0x6edb('0x23')]({'CmContactId':_0x5a0173,'item':_0x1d15fa,'description':_0x26d764,'ItemTypeId':_0x4b1e33,'OrderBy':_0x479c35,'ItemClass':_0x6edb('0x24')})['then'](function(_0x5d6387){_0x54666d({'res':_0x6edb('0x25')});});}});});}function insertCmHopper(_0x50ad47,_0x112274,_0x3461fb,_0x5a7a73,_0xb2a8b5){var _0x3c8b90=[_0x6edb('0x26'),_0x6edb('0x27'),_0x6edb('0x28'),_0x6edb('0x29'),_0x112274+'.'+_0x5a7a73,'cm_contacts.createdAt',_0x6edb('0x2a'),_0x6edb('0x2b'),_0x6edb('0x2c'),'\x22'+_0xb2a8b5+'\x22'];return squel['insert']()[_0x6edb('0x2d')](_0x6edb('0x2e'))[_0x6edb('0x2f')]([_0x6edb('0x11'),'scheduledat',_0x6edb('0x30'),_0x6edb('0x31'),_0x5a7a73,_0x6edb('0x32'),_0x6edb('0x33'),_0x6edb('0x34'),_0x6edb('0x35'),'recallme'],squel['select']()[_0x6edb('0x36')](_0x3c8b90)[_0x6edb('0x37')](_0x112274)[_0x6edb('0x12')]('cm_contacts',null,_0x6edb('0x38')+_0x112274+'.CmListId')[_0x6edb('0x12')](_0x3461fb,null,_0x3461fb+_0x6edb('0x13')+_0x112274+'.'+_0x5a7a73)[_0x6edb('0x14')](_0x112274+_0x6edb('0x39'),_0x50ad47)[_0x6edb('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x6edb('0x14')](_0x6edb('0x3a'),selectNotIn(_0x112274,_0x3461fb,_0x5a7a73,'cm_hopper',['\x22always\x22',_0x6edb('0x3b')]))['where'](_0x6edb('0x3a'),selectNotIn(_0x112274,_0x3461fb,_0x5a7a73,_0x6edb('0x2e'),[_0x6edb('0x3c')])))['toString']();}function insertCmHopperBlack(_0x32a90e,_0x2f3be4,_0x3c3f76,_0x447803){var _0x16d8fa=[_0x6edb('0x26'),_0x6edb('0x28'),_0x6edb('0x29'),_0x2f3be4+'.'+_0x447803,_0x6edb('0x3d'),_0x6edb('0x2a')];return squel[_0x6edb('0x3e')]()['into'](_0x6edb('0x3f'))['fromQuery']([_0x6edb('0x11'),_0x6edb('0x30'),_0x6edb('0x31'),_0x447803,'createdAt',_0x6edb('0x33')],squel['select']()[_0x6edb('0x36')](_0x16d8fa)[_0x6edb('0x37')](_0x2f3be4)[_0x6edb('0x12')](_0x6edb('0x40'),null,_0x6edb('0x38')+_0x2f3be4+_0x6edb('0x41'))[_0x6edb('0x12')](_0x3c3f76,null,_0x3c3f76+_0x6edb('0x13')+_0x2f3be4+'.'+_0x447803)[_0x6edb('0x14')](_0x2f3be4+'.CmListId\x20=\x20?',_0x32a90e)[_0x6edb('0x14')](_0x6edb('0x42'),NOW)[_0x6edb('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6edb('0xf')]()[_0x6edb('0x10')](_0x6edb('0x11'))[_0x6edb('0x37')](_0x6edb('0x3f'))[_0x6edb('0x14')](_0x6edb('0x43'),_0x32a90e)[_0x6edb('0x14')](_0x447803+_0x6edb('0x15')+_0x2f3be4+'.'+_0x447803)))[_0x6edb('0x44')]();}function insertTzCmHopper(_0x4866dd,_0x33074e,_0xa56df5,_0x3438ea,_0x4d8812,_0x2f7494){var _0x5db5d4=[_0x6edb('0x26'),_0x6edb('0x45')+_0x2f7494+_0x6edb('0x46'),'cm_contacts.id','cm_contacts.ListId',_0x33074e+'.'+_0x3438ea,_0x6edb('0x3d'),'cm_contacts.updatedAt',_0x6edb('0x2b'),_0x6edb('0x2c'),'\x22'+_0x4d8812+'\x22'];var _0x15ee24=squel[_0x6edb('0x3e')]()[_0x6edb('0x2d')](_0x6edb('0x2e'))['fromQuery'](['phone',_0x6edb('0x47'),_0x6edb('0x30'),_0x6edb('0x31'),_0x3438ea,'createdAt','updatedAt','priority',_0x6edb('0x35'),_0x6edb('0x48')],squel[_0x6edb('0xf')]()[_0x6edb('0x36')](_0x5db5d4)['from'](_0x33074e)[_0x6edb('0x12')]('cm_contacts',null,_0x6edb('0x38')+_0x33074e+_0x6edb('0x41'))[_0x6edb('0x12')](_0xa56df5,null,_0xa56df5+_0x6edb('0x13')+_0x33074e+'.'+_0x3438ea)[_0x6edb('0x12')](_0x2f7494,null,_0x2f7494+'.id\x20=\x20'+_0x33074e+'.'+_0x3438ea)[_0x6edb('0x14')](_0x33074e+_0x6edb('0x39'),_0x4866dd)[_0x6edb('0x14')](_0x6edb('0x42'),NOW)[_0x6edb('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x33074e,_0xa56df5,_0x3438ea,'cm_hopper',[_0x6edb('0x3c'),'\x22onlyIfOpen\x22']))[_0x6edb('0x14')](_0x6edb('0x3a'),selectNotIn(_0x33074e,_0xa56df5,_0x3438ea,'cm_hopper',['\x22always\x22'])))[_0x6edb('0x44')]();return _0x15ee24;}function insertTzCmHopperBlack(_0x39d2dd,_0x576592,_0x3bc5d3,_0x32732e){var _0x5eafe4=[_0x6edb('0x26'),_0x6edb('0x28'),_0x6edb('0x29'),_0x576592+'.'+_0x32732e,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x6edb('0x3e')]()['into']('cm_hopper_black')[_0x6edb('0x2f')](['phone',_0x6edb('0x30'),'ListId',_0x32732e,_0x6edb('0x32'),_0x6edb('0x33')],squel[_0x6edb('0xf')]()[_0x6edb('0x36')](_0x5eafe4)[_0x6edb('0x37')](_0x576592)['join'](_0x6edb('0x40'),null,_0x6edb('0x38')+_0x576592+_0x6edb('0x41'))[_0x6edb('0x12')](_0x3bc5d3,null,_0x3bc5d3+'.id\x20=\x20'+_0x576592+'.'+_0x32732e)[_0x6edb('0x14')](_0x576592+_0x6edb('0x39'),_0x39d2dd)[_0x6edb('0x14')](_0x6edb('0x42'),NOW)[_0x6edb('0x14')](_0x6edb('0x3a'),squel[_0x6edb('0xf')]()['field'](_0x6edb('0x11'))[_0x6edb('0x37')](_0x6edb('0x3f'))[_0x6edb('0x14')]('ListId\x20=\x20?',_0x39d2dd)[_0x6edb('0x14')](_0x32732e+_0x6edb('0x15')+_0x576592+'.'+_0x32732e)))[_0x6edb('0x44')]();}function insertCmHopperAdditionalPhones(_0x41ed21){var _0x1da4df=[_0x6edb('0x49'),'cm_contact_has_items.item',_0x6edb('0x4a'),_0x6edb('0x4b'),_0x6edb('0x4c')];return squel['insert']()[_0x6edb('0x2d')](_0x6edb('0x4d'))[_0x6edb('0x2f')](['CmHopperId',_0x6edb('0x11'),'OrderBy',_0x6edb('0x32'),_0x6edb('0x33')],squel[_0x6edb('0xf')]()['fields'](_0x1da4df)[_0x6edb('0x37')](_0x6edb('0x2e'))[_0x6edb('0x12')](_0x6edb('0x40'),null,_0x6edb('0x4e'))['join']('cm_contact_has_items',null,_0x6edb('0x4f'))['where']('cm_hopper.ListId\x20=\x20?',_0x41ed21)[_0x6edb('0x14')](_0x6edb('0x42'),NOW))[_0x6edb('0x44')]();}function insertCmContact(_0x2aa0e3,_0x5114f3,_0x38ea9e,_0xf424ce){var _0x289ca7=_[_0x6edb('0x50')](_[_0x6edb('0x51')](_0xf424ce),['ListId',_0x6edb('0x52'),_0x6edb('0x32'),_0x6edb('0x33'),'scheduledAt']);return squel[_0x6edb('0x3e')]()[_0x6edb('0x2d')](_0x6edb('0x40'))['fromQuery'](_0x289ca7,squel[_0x6edb('0xf')]()[_0x6edb('0x36')](_0x289ca7)[_0x6edb('0x37')](_0x5114f3)['where']('('+_0x38ea9e[_0x6edb('0x12')](',')+_0x6edb('0x53'),squel[_0x6edb('0xf')]()[_0x6edb('0x36')](_0x38ea9e)[_0x6edb('0x37')]('cm_contacts')[_0x6edb('0x14')]('ListId\x20=\x20?',_0x2aa0e3)[_0x6edb('0x14')](_0x6edb('0x54')))[_0x6edb('0x14')](_0x6edb('0x55'),squel[_0x6edb('0xf')]()['field'](_0x6edb('0x56'),'min_id')[_0x6edb('0x37')](_0x5114f3)[_0x6edb('0x57')](_0x38ea9e[_0x6edb('0x12')](','))))[_0x6edb('0x44')]();}function handleStop(){logger[_0x6edb('0x58')](_0x6edb('0x59'));stopped=!![];}function handleUncaughtException(_0x32cd17){logger[_0x6edb('0x5a')](_0x32cd17[_0x6edb('0x5b')]);process[_0x6edb('0x5c')](0x1);}function handleError(_0x1cde70,_0x23086d){stats[_0x6edb('0x5d')]['push']({'name':_0x23086d['code'],'message':_0x23086d[_0x6edb('0x5b')],'row':_0x1cde70});}function handleQuery(_0x4f2f52){logger[_0x6edb('0x58')](_0x4f2f52);return db[_0x6edb('0x5e')][_0x6edb('0x5f')](_0x4f2f52)[_0x6edb('0x60')](function(_0x59bfc3){results[_0x6edb('0x1c')](_0x59bfc3);})[_0x6edb('0x61')](function(_0x317390){logger[_0x6edb('0x5a')](_0x317390['message']);});}function updateTzCampaigns(_0x2fc660){return new Promise(function(_0x151d45,_0x33b353){var _0x5120f8=squel[_0x6edb('0xf')]()[_0x6edb('0x36')]([_0x6edb('0x62'),_0x6edb('0x63')])[_0x6edb('0x37')](_0x6edb('0x64'))['join']('campaigns_has_cm_lists',null,_0x6edb('0x65'))[_0x6edb('0x14')](_0x6edb('0x66')+_0x2fc660);db[_0x6edb('0x5e')][_0x6edb('0x5f')](_0x5120f8[_0x6edb('0x44')]())[_0x6edb('0x60')](function(_0x41ea90){var _0xfdb546=[];for(var _0xc7cef0=0x0;_0xc7cef0<_0x41ea90['length'];_0xc7cef0++){_0xfdb546[_0x6edb('0x1c')](getTimezoneData(_0x41ea90[_0xc7cef0],tmp_campaigns));}BPromise[_0x6edb('0x1d')](_0xfdb546)[_0x6edb('0x1a')](function(){_0x151d45({'val':0x1});});})[_0x6edb('0x61')](function(_0x1861cf){logger[_0x6edb('0x5a')](_0x1861cf[_0x6edb('0x5b')]);_0x151d45({'val':0x0});});});}function updateTzVoiceQueues(_0x1c97a7){return new Promise(function(_0x43cc03,_0x500683){var _0x18340b=squel[_0x6edb('0xf')]()[_0x6edb('0x36')]([_0x6edb('0x67'),_0x6edb('0x68')])[_0x6edb('0x37')]('voice_queues')[_0x6edb('0x12')](_0x6edb('0x69'),null,_0x6edb('0x6a'))[_0x6edb('0x14')](_0x6edb('0x6b')+_0x1c97a7);db[_0x6edb('0x5e')]['query'](_0x18340b[_0x6edb('0x44')]())['spread'](function(_0x3d6622){var _0x5d6101=[];for(var _0x4a6b79=0x0;_0x4a6b79<_0x3d6622['length'];_0x4a6b79++){_0x5d6101[_0x6edb('0x1c')](getTimezoneData(_0x3d6622[_0x4a6b79],tmp_voice_queues));}BPromise[_0x6edb('0x1d')](_0x5d6101)[_0x6edb('0x1a')](function(){_0x43cc03({'val':0x1});});})[_0x6edb('0x61')](function(_0x31354e){logger[_0x6edb('0x5a')](_0x31354e[_0x6edb('0x5b')]);_0x43cc03({'val':0x0});});});}function getTimezoneData(_0x36400c,_0x105ec6){return new Promise(function(_0x303c63,_0x5bde67){var _0x19c5e4=shared[_0x6edb('0x6c')];var _0xd2eca6=_0x19c5e4[_0x36400c[_0x6edb('0x6d')]];if(_[_0x6edb('0x6e')](_0xd2eca6)){_0x303c63({'ret':0x1});}else{var _0x22c269=_0xd2eca6[_0x6edb('0x6f')];var _0x28ed9d=squel[_0x6edb('0x3e')]()[_0x6edb('0x2d')](_0x105ec6)['set']('id',_0x36400c['id'])[_0x6edb('0x70')]('offset',_0x22c269)['set'](_0x6edb('0x6d'),_0x36400c[_0x6edb('0x6d')])[_0x6edb('0x44')]();return db[_0x6edb('0x5e')]['query'](_0x28ed9d)[_0x6edb('0x60')](function(_0x380ac2){_0x303c63({'ret':0x1});})[_0x6edb('0x61')](function(_0x49f94f){logger['error'](_0x49f94f[_0x6edb('0x5b')]);_0x5bde67({'ret':0x1});});}});}function handleTZQuery(_0x35e6c4){logger[_0x6edb('0x58')](_0x35e6c4);return db[_0x6edb('0x5e')][_0x6edb('0x5f')](_0x35e6c4)[_0x6edb('0x60')](function(_0x208058){})[_0x6edb('0x61')](function(_0x4b9027){logger['error'](_0x4b9027['message']);});}function main(_0x4b36d4,_0x46de3a,_0x162ae7,_0x469c10){logger[_0x6edb('0x58')]('main',_0x4b36d4,JSON['stringify'](_0x46de3a));process[_0x6edb('0x71')](_0x6edb('0x72'));var _0x44d730=_0x46de3a[_0x6edb('0x73')];var _0x3eefff=_[_0x6edb('0x74')](_0x44d730);var _0x1f42f6=_0x46de3a[_0x6edb('0x75')];var _0x137187=path[_0x6edb('0x12')](config[_0x6edb('0x76')],_0x6edb('0x77'),_0x1f42f6+_0x6edb('0x78'));hasTZ=_[_0x6edb('0x51')](_0x44d730)[_0x6edb('0x79')](_0x6edb('0x6d'));var _0x59fcb7=_[_0x6edb('0x51')](_0x44d730)['join']();logger['info'](_0x6edb('0x7a'),_0x59fcb7);db[_0x6edb('0x7b')][_0x6edb('0x18')]({'raw':!![],'attributes':['id',_0x6edb('0x7c')]})[_0x6edb('0x1a')](function(_0x34409e){for(var _0x45a819=0x0;_0x45a819<_0x34409e[_0x6edb('0x1b')];_0x45a819++){if(_0x34409e[_0x45a819][_0x6edb('0x7c')]in _0x44d730){contactItemTypes[_0x6edb('0x1c')](_0x34409e[_0x45a819]);delete _0x3eefff[_0x34409e[_0x45a819][_0x6edb('0x7c')]];hasAdditionalPhones=!![];}for(var _0x2360c0 in _0x44d730){if(_0x34409e[_0x45a819][_0x6edb('0x7c')]+'_description'===_0x2360c0){phoneDescriptions[_0x6edb('0x1c')]({'itemTypeId':_0x34409e[_0x45a819]['id'],'description':_0x2360c0});delete _0x3eefff[_0x2360c0];}}}if(hasAdditionalPhones)_0x3eefff[_0x6edb('0x19')]='';var _0x2cc610=_[_0x6edb('0x51')](_0x3eefff)[_0x6edb('0x12')]();logger['info'](_0x6edb('0x7a'),_0x2cc610);fs[_0x6edb('0x7d')](_0x137187,_0x2cc610+'\x0a');Papa[_0x6edb('0x7e')](fs[_0x6edb('0x7f')](_0x4b36d4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x592213,_0x35d68e){try{for(var _0x385191=0x0,_0x4fc336=[];_0x385191<_0x592213[_0x6edb('0x80')][_0x6edb('0x1b')];_0x385191++){stats[_0x6edb('0x81')]+=0x1;if(_0x592213[_0x6edb('0x5d')][_0x385191]){handleError(_0x592213[_0x6edb('0x80')][_0x385191],_0x592213['errors'][_0x385191]);}else{var _0x4d3618=[];var _0x30d9be=[];var _0x133b56={};for(var _0x47005 in _0x44d730){let _0x195cee=contactItemTypes[_0x6edb('0x82')](_0x7aac8b=>_0x7aac8b[_0x6edb('0x7c')]===_0x47005);let _0x1899aa=contactItemTypes[_0x6edb('0x82')](_0x1a8690=>_0x1a8690[_0x6edb('0x7c')]+'_description'===_0x47005);if(_[_0x6edb('0x6e')](_0x195cee)&&_[_0x6edb('0x6e')](_0x1899aa)){if(_0x44d730[_0x6edb('0x83')](_0x47005)){if(_0x592213['data'][_0x385191][_0x44d730[_0x47005]]){var _0x58878c=_[_0x6edb('0x84')](_0x592213['data'][_0x385191][_0x44d730[_0x47005]][_0x6edb('0x85')](/"/g,'\x27'));switch(_0x47005){case _0x6edb('0x47'):var _0x31067d=moment(_0x58878c,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x31067d['isValid']()){_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x58878c+'\x22');}else{_0x4d3618[_0x6edb('0x1c')](_0x6edb('0x86'));}break;case _0x6edb('0x34'):var _0x59ad84=parseInt(_0x58878c);_0x58878c=_[_0x6edb('0x87')](_0x59ad84)||_0x59ad84<0x0||_0x59ad84>0x4?_0x469c10?0x3:0x2:_0x59ad84;_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x58878c+'\x22');break;case'UserId':var _0x56d071=parseInt(_0x58878c);if(_['isNumber'](_0x56d071)&&_[_0x6edb('0x79')](_0x162ae7,_0x56d071)){_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x56d071+'\x22');}else{_0x4d3618[_0x6edb('0x1c')](_0x6edb('0x88'));}break;case _0x6edb('0x89'):if(isEmail(_0x58878c)){_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x58878c+'\x22');}else{_0x4d3618[_0x6edb('0x1c')](_0x6edb('0x8a'));}break;case _0x6edb('0x8b'):var _0x2ee2db=moment(_0x58878c,_0x6edb('0x8c'),!![]);if(_0x2ee2db[_0x6edb('0x8d')]()){_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x58878c+'\x22');}else{_0x4d3618[_0x6edb('0x1c')](_0x6edb('0x8e'));}break;case _0x6edb('0x6d'):var _0x5e887b=shared['timezones'];var _0x104283=_0x5e887b[_0x58878c];if(!_[_0x6edb('0x6e')](_0x104283)){var _0x5da1ff=_0x104283[_0x6edb('0x6f')];_0x4fc336['push']('\x22'+_0x58878c+'\x22');_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x5da1ff+'\x22');}break;default:_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x58878c+'\x22');}}else{switch(_0x47005){case _0x6edb('0x8f'):case _0x6edb('0x11'):_0x4d3618[_0x6edb('0x1c')](_0x47005+_0x6edb('0x90'));break;default:_0x4fc336[_0x6edb('0x1c')]('\x22\x22');}}}}else{var _0x4cc6cd='';if(!_[_0x6edb('0x6e')](_0x195cee)){if(!_0x133b56[_0x6edb('0x83')](_0x195cee['id'])){if(!_[_0x6edb('0x6e')](_0x592213[_0x6edb('0x80')][_0x385191][_0x44d730[_0x47005]])){var _0x58878c=_[_0x6edb('0x84')](_0x592213[_0x6edb('0x80')][_0x385191][_0x44d730[_0x47005]][_0x6edb('0x85')](/"/g,'\x27'));var _0x190705=phoneDescriptions[_0x6edb('0x82')](_0x1c8ab5=>_0x1c8ab5['itemTypeId']===_0x195cee['id']);if(!_[_0x6edb('0x6e')](_0x190705)){var _0x4f32d8=_['trim'](_0x592213[_0x6edb('0x80')][_0x385191][_0x44d730[_0x190705[_0x6edb('0x91')]]][_0x6edb('0x85')](/"/g,'\x27'));if(!_['isNil'](_0x4f32d8))_0x58878c=_0x58878c+'§'+_0x4f32d8;}if(_0x4cc6cd=='')_0x4cc6cd=_0x58878c;else _0x4cc6cd+='|'+_0x58878c;}_0x30d9be[_0x6edb('0x1c')](_0x195cee['id']+':'+_0x4cc6cd);_0x133b56[_0x195cee['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4fc336[_0x6edb('0x1c')]('\x22'+_0x30d9be[_0x6edb('0x12')](';')+'\x22');}if(_0x4d3618[_0x6edb('0x1b')]){handleError(_0x592213[_0x6edb('0x80')][_0x385191],{'code':_0x6edb('0x92'),'message':_0x4d3618[_0x6edb('0x12')]()});}else{fs[_0x6edb('0x93')](_0x137187,_0x4fc336[_0x6edb('0x12')]()+'\x0a');}_0x4fc336=[];}if(!(stats[_0x6edb('0x81')]%0xc8)){socket['emit'](_0x6edb('0x94')+_0x1f42f6,stats);stats[_0x6edb('0x5d')]=[];}}if(stopped){logger['info'](_0x6edb('0x95'));_0x35d68e['abort']();}}catch(_0x4ac0f9){handleError(_0x592213['data'][_0x385191],{'code':_0x6edb('0x96'),'message':_0x4ac0f9['message']});logger[_0x6edb('0x5a')](_0x6edb('0x97'),_0x4ac0f9[_0x6edb('0x5b')]);}},'complete':function(){try{var _0x469356=[];var _0x80150b=[];var _0x277613=_0x6edb('0x40');if(_0x46de3a[_0x6edb('0x98')]&&_0x46de3a[_0x6edb('0x98')][_0x6edb('0x1b')]){_0x277613='cm_contacts_'+_0x1f42f6;_0x469356[_0x6edb('0x1c')](_0x6edb('0x99')+_0x277613+_0x6edb('0x9a'));}tmp_campaigns='campaigns_'+_0x1f42f6;tmp_voice_queues=_0x6edb('0x9b')+_0x1f42f6;_0x80150b['push'](_0x6edb('0x99')+tmp_campaigns+_0x6edb('0x9c'));_0x80150b[_0x6edb('0x1c')](_0x6edb('0x99')+tmp_voice_queues+_0x6edb('0x9c'));BPromise['each'](_0x80150b,handleTZQuery)[_0x6edb('0x1a')](function(_0x21b8e7){updateTzCampaigns(_0x46de3a['ListId'])[_0x6edb('0x1a')](function(_0x2ce1ab){updateTzVoiceQueues(_0x46de3a[_0x6edb('0x31')])['then'](function(_0x3a69e9){if(hasTZ)_0x2cc610=_0x2cc610[_0x6edb('0x85')](_0x6edb('0x6d'),_0x6edb('0x9d'));var _0x48fce3=util['format'](_0x6edb('0x9e'),_0x137187,_0x277613,_0x2cc610,_0x46de3a[_0x6edb('0x31')],_0x46de3a[_0x6edb('0x52')]||null,NOW,NOW);if(_[_0x6edb('0x6e')](_0x44d730[_0x6edb('0x47')])){_0x48fce3+=_0x6edb('0x9f');}_0x469356[_0x6edb('0x1c')](_0x48fce3);if(_0x46de3a['duplicates']&&_0x46de3a[_0x6edb('0x98')][_0x6edb('0x1b')]){_0x469356['push'](insertCmContact(_0x46de3a[_0x6edb('0x31')],_0x277613,_0x46de3a[_0x6edb('0x98')],_0x44d730));_0x469356['push'](_0x6edb('0xa0')+_0x277613+';');}BPromise[_0x6edb('0xa1')](_0x469356,handleQuery)[_0x6edb('0x1a')](function(_0x1b2a04){BPromise[_0x6edb('0x1d')]([handleAdditionalPhones()])[_0x6edb('0x1a')](function(){_0x469356=[];for(var _0x1fdf6e=0x0;_0x1fdf6e\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','No\x20agent\x20available','SIGINT','path','lodash','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','test','select','field','phone','from','join','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','catch','error','message','split','all','filter','findOne','CmContactHasItem','then','updated','create','PHONE','inserted','CmContact','update','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','createdAt','priority','UserId','recallme','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.phone','cm_contacts.id','cm_hopper_black','ContactId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','CmHopperId','OrderBy','updatedAt','cm_contacts.id\x20=\x20cm_hopper.ContactId'];(function(_0x276df9,_0x142e6d){var _0x354bfc=function(_0x5e107c){while(--_0x5e107c){_0x276df9['push'](_0x276df9['shift']());}};_0x354bfc(++_0x142e6d);}(_0xb847,0x17e));var _0x7b84=function(_0x4dfe8f,_0x15d58a){_0x4dfe8f=_0x4dfe8f-0x0;var _0x525088=_0xb847[_0x4dfe8f];return _0x525088;};'use strict';var fs=require('fs');var path=require(_0x7b84('0x0'));var _=require(_0x7b84('0x1'));var Papa=require('papaparse');var util=require(_0x7b84('0x2'));var BPromise=require('bluebird');var moment=require(_0x7b84('0x3'));var squel=require(_0x7b84('0x4'));var Redis=require(_0x7b84('0x5'));var db=require(_0x7b84('0x6'))['db'];var config=require(_0x7b84('0x7'));var logger=require('../../../config/logger')('import');config['redis']=_[_0x7b84('0x8')](config[_0x7b84('0x9')],{'host':_0x7b84('0xa'),'port':0x18eb});var socket=require(_0x7b84('0xb'))(new Redis(config[_0x7b84('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()[_0x7b84('0xc')](_0x7b84('0xd'));var tempTableName=_0x7b84('0xe')+moment()[_0x7b84('0xc')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x20d3a6){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))*$/[_0x7b84('0xf')](_0x20d3a6);}function selectNotIn(_0x21b420,_0x47e2f0,_0x5d985e,_0x2d0e52,_0x5a7c18){return squel[_0x7b84('0x10')]()[_0x7b84('0x11')](_0x7b84('0x12'))[_0x7b84('0x13')](_0x2d0e52)[_0x7b84('0x14')](_0x47e2f0,null,_0x47e2f0+'.id\x20=\x20'+_0x2d0e52+'.'+_0x5d985e)['where'](_0x2d0e52+'.'+_0x5d985e+'\x20=\x20'+_0x21b420+'.'+_0x5d985e)[_0x7b84('0x15')](_0x47e2f0+_0x7b84('0x16')+_0x5a7c18[_0x7b84('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3d094e,_0xfb77ad){promisesAdditionalPhones=[];promisesContact=[];return db[_0x7b84('0x17')][_0x7b84('0x18')](_0x7b84('0x19')+tempTableName)[_0x7b84('0x1a')](function(_0x3fdf29){if(_0x3fdf29!==null){var _0x3ff00b=[];for(var _0xde008a=0x0;_0xde008a<_0x3fdf29[_0x7b84('0x1b')];_0xde008a++){var _0x35fcb4=_0x3fdf29[_0xde008a];if(!_[_0x7b84('0x1c')](_0x35fcb4['phone'])){if(!_['isNil'](_0x35fcb4[_0x7b84('0x1d')]))_0x3ff00b[_0x7b84('0x1e')](insertAdditionalPhones(_0x35fcb4));promisesContact['push']({'contact':_0x35fcb4});}}}Promise['all'](_0x3ff00b)['then'](function(){_0x3d094e({'val':0x1});});})[_0x7b84('0x1f')](function(_0x684420){logger[_0x7b84('0x20')](_0x684420[_0x7b84('0x21')]);});});}function insertAdditionalPhones(_0x1f6edf){return new Promise(function(_0x2239ba,_0xa8b8ec){var _0x24e5c0=_0x1f6edf['AdditionalPhones'];if(_[_0x7b84('0x1c')](_0x24e5c0))_0xa8b8ec({'val':0x0});else{var _0x114bfa=_0x24e5c0[_0x7b84('0x22')](';');var _0x53fb34=[];orderBy=0x0;for(var _0x75831d=0x0;_0x75831d<_0x114bfa[_0x7b84('0x1b')];_0x75831d++){_0x53fb34['push'](splitAdditionalPhone(_0x1f6edf['id'],_0x114bfa[_0x75831d]));}Promise[_0x7b84('0x23')](_0x53fb34)['then'](function(){_0x2239ba({'val':_0x114bfa[_0x7b84('0x1b')]});});}});}function splitAdditionalPhone(_0x2f70de,_0x1492c4){return new Promise(function(_0x5549c7,_0x557078){var _0x5de8ef=_0x1492c4[_0x7b84('0x22')](':');var _0x348241=_0x5de8ef[0x0];var _0x5abb6e=_0x5de8ef[0x1];if(_0x5abb6e!==''){var _0x1b11cc=_0x5abb6e[_0x7b84('0x22')]('|');var _0x4d57f5=[];for(var _0x5a2697=0x0;_0x5a2697<_0x1b11cc['length'];_0x5a2697++){if(_0x1b11cc[_0x5a2697]!==''){var _0x3bea0c=_[_0x7b84('0x24')](promisesAdditionalPhones,{'contactId':_0x2f70de,'phone':_0x1b11cc[_0x5a2697]});if(_0x3bea0c[_0x7b84('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x7b84('0x1e')]({'contactId':_0x2f70de,'contactTypeId':_0x348241,'phone':_0x1b11cc[_0x5a2697],'orderBy':orderBy});}}}_0x5549c7({'ok':0x1});}else _0x5549c7({'res':0x0});});}function createAdditionalPhone(_0xd1a24a,_0x50c7ca,_0x50fd74,_0x52925d){var _0x5e76d7='';var _0x68c6d7='';var _0x2903f2=_0x50fd74['split']('§');_0x5e76d7=_0x2903f2[0x0];if(_0x2903f2[_0x7b84('0x1b')]==0x2)_0x68c6d7=_0x2903f2[0x1];return new Promise(function(_0x36826c,_0x15d778){return db['CmContactHasItem'][_0x7b84('0x25')]({'where':{'CmContactId':_0xd1a24a,'item':_0x5e76d7}})['then'](function(_0x334cc2){if(_0x334cc2){return db[_0x7b84('0x26')]['update']({'ItemTypeId':_0x50c7ca,'description':_0x68c6d7,'OrderBy':_0x52925d},{'where':{'CmContactId':_0xd1a24a,'item':_0x5e76d7}})[_0x7b84('0x27')](function(_0x5c0bea){_0x36826c({'res':_0x7b84('0x28')});});}else{return db[_0x7b84('0x26')][_0x7b84('0x29')]({'CmContactId':_0xd1a24a,'item':_0x5e76d7,'ItemTypeId':_0x50c7ca,'description':_0x68c6d7,'OrderBy':_0x52925d,'ItemClass':_0x7b84('0x2a')})[_0x7b84('0x27')](function(_0x4e3123){_0x36826c({'res':_0x7b84('0x2b')});});}});});}function updateContact(_0x5da678){return new Promise(function(_0x34528a,_0x10692d){var _0x554955=_0x5da678['id'];delete _0x5da678['id'];return db[_0x7b84('0x2c')][_0x7b84('0x2d')](_0x5da678,{'where':{'id':_0x554955}})[_0x7b84('0x27')](function(_0x1c01dd){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0x5da678[_0x7b84('0x12')]},{'where':{'ContactId':_0x554955}})[_0x7b84('0x27')](function(_0x33647e){_0x34528a({'ret':'OK'});});});});}function insertCmHopper(_0x5cf43d,_0x1cf5a9,_0xa8220e,_0x1111bf,_0x161b2d){var _0x14f6ef=['cm_contacts.phone',_0x7b84('0x2e'),'cm_contacts.id',_0x7b84('0x2f'),_0x1cf5a9+'.'+_0x1111bf,_0x7b84('0x30'),_0x7b84('0x31'),_0x7b84('0x32'),'cm_contacts.UserId','\x22'+_0x161b2d+'\x22'];return squel[_0x7b84('0x33')]()[_0x7b84('0x34')](_0x7b84('0x35'))[_0x7b84('0x36')]([_0x7b84('0x12'),_0x7b84('0x37'),'ContactId','ListId',_0x1111bf,_0x7b84('0x38'),'updatedAt',_0x7b84('0x39'),_0x7b84('0x3a'),_0x7b84('0x3b')],squel[_0x7b84('0x10')]()['fields'](_0x14f6ef)[_0x7b84('0x13')](_0x1cf5a9)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x1cf5a9+'.CmListId')[_0x7b84('0x14')](_0xa8220e,null,_0xa8220e+_0x7b84('0x3c')+_0x1cf5a9+'.'+_0x1111bf)[_0x7b84('0x15')](_0x1cf5a9+_0x7b84('0x3d'),_0x5cf43d)[_0x7b84('0x15')](_0x7b84('0x3e'),NOW)[_0x7b84('0x15')](_0x7b84('0x3f'),selectNotIn(_0x1cf5a9,_0xa8220e,_0x1111bf,_0x7b84('0x35'),[_0x7b84('0x40'),'\x22onlyIfOpen\x22']))[_0x7b84('0x15')](_0x7b84('0x3f'),selectNotIn(_0x1cf5a9,_0xa8220e,_0x1111bf,_0x7b84('0x35'),[_0x7b84('0x40')])))[_0x7b84('0x41')]();}function insertCmHopperBlack(_0x22d1e4,_0x4abd2a,_0x195379,_0x591c1e){var _0x715a7e=[_0x7b84('0x42'),_0x7b84('0x43'),_0x7b84('0x2f'),_0x4abd2a+'.'+_0x591c1e,_0x7b84('0x30'),'cm_contacts.updatedAt'];return squel[_0x7b84('0x33')]()[_0x7b84('0x34')](_0x7b84('0x44'))[_0x7b84('0x36')]([_0x7b84('0x12'),_0x7b84('0x45'),'ListId',_0x591c1e,_0x7b84('0x38'),'updatedAt'],squel[_0x7b84('0x10')]()[_0x7b84('0x46')](_0x715a7e)[_0x7b84('0x13')](_0x4abd2a)[_0x7b84('0x14')](_0x7b84('0x47'),null,_0x7b84('0x48')+_0x4abd2a+'.CmListId')['join'](_0x195379,null,_0x195379+_0x7b84('0x3c')+_0x4abd2a+'.'+_0x591c1e)[_0x7b84('0x15')](_0x4abd2a+_0x7b84('0x3d'),_0x22d1e4)[_0x7b84('0x15')](_0x7b84('0x3e'),NOW)[_0x7b84('0x15')](_0x7b84('0x3f'),squel[_0x7b84('0x10')]()[_0x7b84('0x11')](_0x7b84('0x12'))[_0x7b84('0x13')]('cm_hopper_black')[_0x7b84('0x15')](_0x7b84('0x49'),_0x22d1e4)[_0x7b84('0x15')](_0x591c1e+_0x7b84('0x4a'),_0x4abd2a+'.'+_0x591c1e)))['toString']();}function insertCmHopperAdditionalPhones(_0x244bc6){var _0x4e57fe=[_0x7b84('0x4b'),_0x7b84('0x4c'),_0x7b84('0x4d'),_0x7b84('0x4e'),'cm_contact_has_items.updatedAt'];return squel[_0x7b84('0x33')]()[_0x7b84('0x34')]('cm_hopper_additional_phones')[_0x7b84('0x36')]([_0x7b84('0x4f'),_0x7b84('0x12'),_0x7b84('0x50'),_0x7b84('0x38'),_0x7b84('0x51')],squel[_0x7b84('0x10')]()[_0x7b84('0x46')](_0x4e57fe)[_0x7b84('0x13')]('cm_hopper')[_0x7b84('0x14')]('cm_contacts',null,_0x7b84('0x52'))[_0x7b84('0x14')](_0x7b84('0x53'),null,_0x7b84('0x54'))[_0x7b84('0x15')]('cm_hopper.ListId\x20=\x20?',_0x244bc6)[_0x7b84('0x15')](_0x7b84('0x3e'),NOW))[_0x7b84('0x41')]();}function insertCmContact(_0x21afa2,_0x59940c,_0x19be40,_0x58e0be){var _0x3037ee=_['concat'](_[_0x7b84('0x55')](_0x58e0be),[_0x7b84('0x56'),'CompanyId',_0x7b84('0x38'),_0x7b84('0x51')]);return squel[_0x7b84('0x33')]()['into'](_0x7b84('0x47'))[_0x7b84('0x36')](_0x3037ee,squel[_0x7b84('0x10')]()['fields'](_0x3037ee)[_0x7b84('0x13')](_0x59940c)[_0x7b84('0x15')]('('+_0x19be40[_0x7b84('0x14')](',')+_0x7b84('0x57'),squel['select']()[_0x7b84('0x46')](_0x19be40)[_0x7b84('0x13')](_0x7b84('0x47'))[_0x7b84('0x15')](_0x7b84('0x49'),_0x21afa2))[_0x7b84('0x15')](_0x7b84('0x58'),squel[_0x7b84('0x10')]()[_0x7b84('0x11')]('MIN(id)',_0x7b84('0x59'))[_0x7b84('0x13')](_0x59940c)[_0x7b84('0x5a')](_0x19be40['join'](','))))['toString']();}function handleStop(){logger[_0x7b84('0x5b')](_0x7b84('0x5c'));stopped=!![];}function handleUncaughtException(_0x2b3590){logger['error'](_0x2b3590[_0x7b84('0x21')]);process['exit'](0x1);}function handleError(_0x48fad9,_0x51251b){stats[_0x7b84('0x5d')][_0x7b84('0x1e')]({'name':_0x51251b[_0x7b84('0x5e')],'message':_0x51251b[_0x7b84('0x21')],'row':_0x48fad9});}function handleQuery(_0x179d69){logger[_0x7b84('0x5b')](_0x179d69);return db[_0x7b84('0x17')][_0x7b84('0x18')](_0x179d69)[_0x7b84('0x1a')](function(_0x2c6362){results['push'](_0x2c6362);})[_0x7b84('0x1f')](function(_0x485502){logger['error'](_0x485502[_0x7b84('0x21')]);});}function main(_0x51de2e,_0xf8e90d,_0x5826be,_0x58cab9){logger[_0x7b84('0x5b')](_0x7b84('0x5f'),_0x51de2e,JSON['stringify'](_0xf8e90d));process[_0x7b84('0x60')](_0x7b84('0x61'));var _0x2e58e4=_0xf8e90d['binding'];var _0x34ed00=_[_0x7b84('0x62')](_0x2e58e4);var _0x16c4f1=_0xf8e90d[_0x7b84('0x63')];var _0x1e971f=path[_0x7b84('0x14')](config[_0x7b84('0x64')],_0x7b84('0x65'),_0x16c4f1+_0x7b84('0x66'));logger[_0x7b84('0x5b')]('body',_0xf8e90d);db[_0x7b84('0x67')][_0x7b84('0x68')]({'raw':!![],'attributes':['id',_0x7b84('0x69')]})['then'](function(_0x2ef5f1){for(var _0x5ae526=0x0;_0x5ae526<_0x2ef5f1['length'];_0x5ae526++){if(_0x2ef5f1[_0x5ae526][_0x7b84('0x69')]in _0x2e58e4){contactItemTypes[_0x7b84('0x1e')](_0x2ef5f1[_0x5ae526]);delete _0x34ed00[_0x2ef5f1[_0x5ae526][_0x7b84('0x69')]];hasAdditionalPhones=!![];}for(var _0x1b7850 in _0x2e58e4){if(_0x2ef5f1[_0x5ae526]['name']+_0x7b84('0x6a')===_0x1b7850){phoneDescriptions[_0x7b84('0x1e')]({'itemTypeId':_0x2ef5f1[_0x5ae526]['id'],'description':_0x1b7850});delete _0x34ed00[_0x1b7850];}}}if(hasAdditionalPhones)_0x34ed00['AdditionalPhones']='';var _0xe29486=_['keys'](_0x34ed00)['join']();logger[_0x7b84('0x5b')](_0x7b84('0x6b'),_0xe29486);fs[_0x7b84('0x6c')](_0x1e971f,_0xe29486+'\x0a');Papa[_0x7b84('0x6d')](fs['createReadStream'](_0x51de2e),{'header':!![],'skipEmptyLines':!![],'step':function(_0xad3e7f,_0x3ba5ea){try{for(var _0x6a363c=0x0,_0x223b4b=[];_0x6a363c<_0xad3e7f[_0x7b84('0x6e')][_0x7b84('0x1b')];_0x6a363c++){stats[_0x7b84('0x6f')]+=0x1;if(_0xad3e7f[_0x7b84('0x5d')][_0x6a363c]){handleError(_0xad3e7f[_0x7b84('0x6e')][_0x6a363c],_0xad3e7f[_0x7b84('0x5d')][_0x6a363c]);}else{var _0x27ea28=[];var _0x310e95=[];var _0x124caf={};for(var _0x56911a in _0x2e58e4){let _0x3e0976=contactItemTypes[_0x7b84('0x70')](_0x18dc73=>_0x18dc73[_0x7b84('0x69')]===_0x56911a);let _0x5d9e84=contactItemTypes[_0x7b84('0x70')](_0x2d3f2d=>_0x2d3f2d[_0x7b84('0x69')]+_0x7b84('0x6a')===_0x56911a);if(_[_0x7b84('0x1c')](_0x3e0976)&&_[_0x7b84('0x1c')](_0x5d9e84)){if(_0x2e58e4[_0x7b84('0x71')](_0x56911a)){if(_0xad3e7f[_0x7b84('0x6e')][_0x6a363c][_0x2e58e4[_0x56911a]]){var _0x4c7c02=_[_0x7b84('0x72')](_0xad3e7f['data'][_0x6a363c][_0x2e58e4[_0x56911a]]['replace'](/"/g,'\x27'));switch(_0x56911a){case _0x7b84('0x37'):var _0x4fe7d1=moment(_0x4c7c02,_0x7b84('0xd'),!![]);if(_0x4fe7d1[_0x7b84('0x73')]()){_0x223b4b['push']('\x22'+_0x4c7c02+'\x22');}else{_0x27ea28[_0x7b84('0x1e')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x7b84('0x39'):var _0x1d2d83=parseInt(_0x4c7c02);_0x4c7c02=_['isNaN'](_0x1d2d83)||_0x1d2d83<0x0||_0x1d2d83>0x4?_0x58cab9?0x3:0x2:_0x1d2d83;_0x223b4b['push']('\x22'+_0x4c7c02+'\x22');break;case _0x7b84('0x3a'):var _0x5a71ff=parseInt(_0x4c7c02);if(_['isNumber'](_0x5a71ff)&&_[_0x7b84('0x74')](_0x5826be,_0x5a71ff)){_0x223b4b[_0x7b84('0x1e')]('\x22'+_0x5a71ff+'\x22');}else{_0x27ea28['push']('agent\x20not\x20exists');}break;case _0x7b84('0x75'):if(isEmail(_0x4c7c02)){_0x223b4b['push']('\x22'+_0x4c7c02+'\x22');}else{_0x27ea28[_0x7b84('0x1e')](_0x7b84('0x76'));}break;case _0x7b84('0x77'):var _0xea4a6b=moment(_0x4c7c02,_0x7b84('0x78'),!![]);if(_0xea4a6b[_0x7b84('0x73')]()){_0x223b4b[_0x7b84('0x1e')]('\x22'+_0x4c7c02+'\x22');}else{_0x27ea28[_0x7b84('0x1e')](_0x7b84('0x79'));}break;default:_0x223b4b[_0x7b84('0x1e')]('\x22'+_0x4c7c02+'\x22');}}else{switch(_0x56911a){case _0x7b84('0x7a'):case'phone':_0x27ea28[_0x7b84('0x1e')](_0x56911a+_0x7b84('0x7b'));break;default:_0x223b4b[_0x7b84('0x1e')]('\x22\x22');}}}}else{var _0x2c6201='';if(!_['isNil'](_0x3e0976)){if(!_0x124caf[_0x7b84('0x71')](_0x3e0976['id'])){for(var _0x49e995=0x0;_0x49e995<_0x2e58e4[_0x56911a]['length'];_0x49e995++){var _0x4c7c02=_[_0x7b84('0x72')](_0xad3e7f[_0x7b84('0x6e')][_0x6a363c][_0x2e58e4[_0x56911a][_0x49e995]][_0x7b84('0x7c')](/"/g,'\x27'));var _0x4bb383=phoneDescriptions[_0x7b84('0x70')](_0x4b7125=>_0x4b7125['itemTypeId']===_0x3e0976['id']);if(!_['isNil'](_0x4bb383)){var _0x287318=_[_0x7b84('0x72')](_0xad3e7f[_0x7b84('0x6e')][_0x6a363c][_0x2e58e4[_0x4bb383['description']][0x0]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x287318))_0x4c7c02=_0x4c7c02+'§'+_0x287318;}if(_0x2c6201=='')_0x2c6201=_0x4c7c02;else _0x2c6201+='|'+_0x4c7c02;}_0x310e95[_0x7b84('0x1e')](_0x3e0976['id']+':'+_0x2c6201);_0x124caf[_0x3e0976['id']]=0x1;}}}}if(hasAdditionalPhones){_0x223b4b['push']('\x22'+_0x310e95['join'](';')+'\x22');}if(_0x27ea28['length']){handleError(_0xad3e7f[_0x7b84('0x6e')][_0x6a363c],{'code':'SystemRow','message':_0x27ea28[_0x7b84('0x14')]()});}else{fs[_0x7b84('0x7d')](_0x1e971f,_0x223b4b[_0x7b84('0x14')]()+'\x0a');}_0x223b4b=[];}if(!(stats[_0x7b84('0x6f')]%0xc8)){socket[_0x7b84('0x7e')](_0x7b84('0x7f')+_0x16c4f1,stats);stats[_0x7b84('0x5d')]=[];}}if(stopped){logger[_0x7b84('0x5b')](_0x7b84('0x80'));_0x3ba5ea['abort']();}}catch(_0x4ae6f9){handleError(_0xad3e7f['data'][_0x6a363c],{'code':_0x7b84('0x81'),'message':_0x4ae6f9[_0x7b84('0x21')]});logger[_0x7b84('0x20')](_0x7b84('0x82'),_0x4ae6f9[_0x7b84('0x21')]);}},'complete':function(){try{var _0x2da496=[];var _0xc98282=tempTableName;_0x2da496['push'](_0x7b84('0x83')+_0xc98282+_0x7b84('0x84'));logger[_0x7b84('0x5b')](_0x7b84('0x85'),contactItemTypes[_0x7b84('0x1b')]);var _0x50a455=util[_0x7b84('0xc')](_0x7b84('0x86'),_0x1e971f,_0xc98282,_0xe29486,_0xf8e90d[_0x7b84('0x56')],_0xf8e90d[_0x7b84('0x87')]||null,NOW,NOW);if(_['isNil'](_0x2e58e4['scheduledat'])){_0x50a455+=_0x7b84('0x88');}_0x2da496[_0x7b84('0x1e')](_0x50a455);BPromise[_0x7b84('0x89')](_0x2da496,handleQuery)['then'](function(_0x3d2941){BPromise[_0x7b84('0x23')]([handleAdditionalPhones()])[_0x7b84('0x27')](function(){_0x2da496=[];for(var _0x4dafd9=0x0;_0x4dafd9_0x24289e['name']===_0x3b23cd);let _0x204852=contactItemTypes['find'](_0x251a9d=>_0x251a9d['name']+_0xb4ef('0x61')===_0x3b23cd);if(_[_0xb4ef('0x1a')](_0x5b93c0)&&_[_0xb4ef('0x1a')](_0x204852)){if(_0x7a7693[_0xb4ef('0x69')](_0x3b23cd)){if(_0x2cd08b[_0xb4ef('0x66')][_0x5d9d94][_0x7a7693[_0x3b23cd]]){var _0x2f2f4c=_[_0xb4ef('0x6a')](_0x2cd08b[_0xb4ef('0x66')][_0x5d9d94][_0x7a7693[_0x3b23cd]][_0xb4ef('0x6b')](/"/g,'\x27'));switch(_0x3b23cd){case'scheduledat':var _0x1c508a=moment(_0x2f2f4c,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x1c508a[_0xb4ef('0x6c')]()){_0x45859d['push']('\x22'+_0x2f2f4c+'\x22');}else{_0x4d4fe8['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xb4ef('0x6d'):var _0x4e5895=parseInt(_0x2f2f4c);_0x2f2f4c=_['isNaN'](_0x4e5895)||_0x4e5895<0x0||_0x4e5895>0x4?_0x4555c7?0x3:0x2:_0x4e5895;_0x45859d[_0xb4ef('0x1c')]('\x22'+_0x2f2f4c+'\x22');break;case _0xb4ef('0x6e'):var _0x4a6587=parseInt(_0x2f2f4c);if(_['isNumber'](_0x4a6587)&&_[_0xb4ef('0x6f')](_0x49528a,_0x4a6587)){_0x45859d[_0xb4ef('0x1c')]('\x22'+_0x4a6587+'\x22');}else{_0x4d4fe8[_0xb4ef('0x1c')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x2f2f4c)){_0x45859d[_0xb4ef('0x1c')]('\x22'+_0x2f2f4c+'\x22');}else{_0x4d4fe8[_0xb4ef('0x1c')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x49889a=moment(_0x2f2f4c,_0xb4ef('0x70'),!![]);if(_0x49889a[_0xb4ef('0x6c')]()){_0x45859d[_0xb4ef('0x1c')]('\x22'+_0x2f2f4c+'\x22');}else{_0x4d4fe8[_0xb4ef('0x1c')](_0xb4ef('0x71'));}break;default:_0x45859d[_0xb4ef('0x1c')]('\x22'+_0x2f2f4c+'\x22');}}else{switch(_0x3b23cd){case _0xb4ef('0x72'):case _0xb4ef('0x10'):_0x4d4fe8[_0xb4ef('0x1c')](_0x3b23cd+_0xb4ef('0x73'));break;default:_0x45859d[_0xb4ef('0x1c')]('\x22\x22');}}}}else{var _0x471e2d='';if(!_[_0xb4ef('0x1a')](_0x5b93c0)){if(!_0x840a45[_0xb4ef('0x69')](_0x5b93c0['id'])){for(var _0x35c743=0x0;_0x35c743<_0x7a7693[_0x3b23cd][_0xb4ef('0x19')];_0x35c743++){var _0x2f2f4c=_['trim'](_0x2cd08b[_0xb4ef('0x66')][_0x5d9d94][_0x7a7693[_0x3b23cd][_0x35c743]]['replace'](/"/g,'\x27'));var _0x12b04e=phoneDescriptions[_0xb4ef('0x68')](_0x55de43=>_0x55de43[_0xb4ef('0x74')]===_0x5b93c0['id']);if(!_['isNil'](_0x12b04e)){var _0x133fcb=_[_0xb4ef('0x6a')](_0x2cd08b['data'][_0x5d9d94][_0x7a7693[_0x12b04e[_0xb4ef('0x75')]][0x0]][_0xb4ef('0x6b')](/"/g,'\x27'));if(!_[_0xb4ef('0x1a')](_0x133fcb))_0x2f2f4c=_0x2f2f4c+'§'+_0x133fcb;}if(_0x471e2d=='')_0x471e2d=_0x2f2f4c;else _0x471e2d+='|'+_0x2f2f4c;}_0x44ef98[_0xb4ef('0x1c')](_0x5b93c0['id']+':'+_0x471e2d);_0x840a45[_0x5b93c0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x45859d[_0xb4ef('0x1c')]('\x22'+_0x44ef98[_0xb4ef('0x12')](';')+'\x22');}if(_0x4d4fe8[_0xb4ef('0x19')]){handleError(_0x2cd08b[_0xb4ef('0x66')][_0x5d9d94],{'code':'SystemRow','message':_0x4d4fe8['join']()});}else{fs['appendFileSync'](_0x5a37da,_0x45859d[_0xb4ef('0x12')]()+'\x0a');}_0x45859d=[];}if(!(stats[_0xb4ef('0x67')]%0xc8)){socket['emit']('contact:import:'+_0x3d6082,stats);stats[_0xb4ef('0x55')]=[];}}if(stopped){logger[_0xb4ef('0x52')]('Abort\x20parser');_0x3cd3b2[_0xb4ef('0x76')]();}}catch(_0x58408f){handleError(_0x2cd08b[_0xb4ef('0x66')][_0x5d9d94],{'code':_0xb4ef('0x77'),'message':_0x58408f['message']});logger[_0xb4ef('0x54')](_0xb4ef('0x78'),_0x58408f[_0xb4ef('0x20')]);}},'complete':function(){try{var _0x468170=[];var _0x2c99db=tempTableName;_0x468170['push'](_0xb4ef('0x79')+_0x2c99db+_0xb4ef('0x7a'));logger[_0xb4ef('0x52')]('CIS\x20len',contactItemTypes['length']);var _0x147f53=util[_0xb4ef('0xb')](_0xb4ef('0x7b'),_0x5a37da,_0x2c99db,_0x1b5175,_0x1a6534[_0xb4ef('0x33')],_0x1a6534[_0xb4ef('0x7c')]||null,NOW,NOW);if(_[_0xb4ef('0x1a')](_0x7a7693[_0xb4ef('0x7d')])){_0x147f53+=_0xb4ef('0x7e');}_0x468170[_0xb4ef('0x1c')](_0x147f53);BPromise[_0xb4ef('0x7f')](_0x468170,handleQuery)[_0xb4ef('0x1e')](function(_0x4fd3a4){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x468170=[];for(var _0x2dcfee=0x0;_0x2dcfee\x20\x20');}var _0xe30733=path['join'](config[_0xb4ef('0x5b')],_0xb4ef('0x8b'),process['argv'][0x2]);if(!fs[_0xb4ef('0x8c')](_0xe30733)){throw new Error(_0xb4ef('0x8d'));}var _0x2e1aca={};try{_0x2e1aca=JSON[_0xb4ef('0x64')](process[_0xb4ef('0x8a')][0x3]);if(!_0x2e1aca[_0xb4ef('0x59')]){throw new Error(_0xb4ef('0x8e'));}var _0x771a70=0x0;if(_0x2e1aca[_0xb4ef('0x59')][_0xb4ef('0x6e')]){_0x771a70=0x1;}if(!_0x2e1aca[_0xb4ef('0x33')]){throw new Error(_0xb4ef('0x8f'));}}catch(_0x38d2c4){throw new Error(_0xb4ef('0x90'));}var _0x6f4fe2=[];try{_0x6f4fe2=_[_0xb4ef('0x91')](JSON[_0xb4ef('0x64')](process[_0xb4ef('0x8a')][0x4]),'id');}catch(_0x470f81){logger[_0xb4ef('0x52')](_0xb4ef('0x92'));}main(_0xe30733,_0x2e1aca,_0x6f4fe2,_0x771a70);}validate();process['on'](_0xb4ef('0x93'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 7cfc39e..a6b8c1f 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94ab=['Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','push','variable','queue','calleridnum','Outbound\x20Call','destcalleridnum','voice','inbound','***\x20Call\x20Info\x20***','keyValue','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Number','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','outbound','Called\x20Number','Member\x20Name','starttime','***\x20Time\x20Info\x20***'];(function(_0x21a6da,_0x1f1ae3){var _0x41550b=function(_0x1490ad){while(--_0x1490ad){_0x21a6da['push'](_0x21a6da['shift']());}};_0x41550b(++_0x1f1ae3);}(_0x94ab,0x16f));var _0xb94a=function(_0x4f84ea,_0x3ee11c){_0x4f84ea=_0x4f84ea-0x0;var _0x12f462=_0x94ab[_0x4f84ea];return _0x12f462;};'use strict';exports[_0xb94a('0x0')]=function(_0x5a5c31,_0x44b53a){var _0x6e962a=[{'type':_0xb94a('0x1'),'content':_0xb94a('0x2'),'variableName':null}];switch(_0x5a5c31[_0xb94a('0x3')]()){case'voice':switch(_0x44b53a[_0xb94a('0x3')]()){case'inbound':_0x6e962a[_0xb94a('0x4')]({'type':_0xb94a('0x5'),'content':'','variableName':_0xb94a('0x6')});_0x6e962a[_0xb94a('0x4')]({'type':_0xb94a('0x5'),'content':'','variableName':_0xb94a('0x7')});break;case'outbound':_0x6e962a[_0xb94a('0x4')]({'type':_0xb94a('0x1'),'content':_0xb94a('0x8'),'variableName':null});_0x6e962a[_0xb94a('0x4')]({'type':_0xb94a('0x5'),'content':'','variableName':_0xb94a('0x9')});break;}}return _0x6e962a;};exports['getDescriptions']=function(_0x5dd993,_0x984b0e){var _0x579210=[];switch(_0x5dd993[_0xb94a('0x3')]()){case _0xb94a('0xa'):switch(_0x984b0e[_0xb94a('0x3')]()){case _0xb94a('0xb'):_0x579210=[{'type':_0xb94a('0x1'),'content':_0xb94a('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xb94a('0xd'),'content':'','key':'Caller\x20Number','keyType':_0xb94a('0x5'),'variableName':_0xb94a('0x7')},{'type':_0xb94a('0xd'),'content':'','key':'Caller\x20Name','keyType':_0xb94a('0x5'),'variableName':_0xb94a('0xe')},{'type':'keyValue','content':'','key':_0xb94a('0xf'),'keyType':'variable','variableName':_0xb94a('0x10')},{'type':_0xb94a('0xd'),'content':'','key':_0xb94a('0x11'),'keyType':_0xb94a('0x5'),'variableName':'queue'},{'type':_0xb94a('0xd'),'content':'','key':_0xb94a('0x12'),'keyType':_0xb94a('0x5'),'variableName':_0xb94a('0x13')},{'type':_0xb94a('0xd'),'content':'','key':_0xb94a('0x14'),'keyType':_0xb94a('0x5'),'variableName':'agentcalledAt'},{'type':_0xb94a('0x1'),'content':_0xb94a('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xb94a('0xd'),'content':'','key':'Agent\x20Name','keyType':_0xb94a('0x5'),'variableName':'destcalleridname'},{'type':_0xb94a('0xd'),'content':'','key':_0xb94a('0x16'),'keyType':'variable','variableName':_0xb94a('0x9')},{'type':_0xb94a('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xb94a('0xd'),'content':'','key':'Agent\x20Ring','keyType':_0xb94a('0x5'),'variableName':'agentcalledAt'},{'type':_0xb94a('0xd'),'content':'','key':_0xb94a('0x17'),'keyType':_0xb94a('0x5'),'variableName':_0xb94a('0x18')},{'type':'keyValue','content':'','key':_0xb94a('0x19'),'keyType':'variable','variableName':'agentcompleteAt'},{'type':_0xb94a('0xd'),'content':'','key':_0xb94a('0x1a'),'keyType':'variable','variableName':_0xb94a('0x1b')},{'type':_0xb94a('0xd'),'content':'','key':'Talk\x20Time','keyType':_0xb94a('0x5'),'variableName':'talktime'}];break;case _0xb94a('0x1c'):_0x579210=[{'type':_0xb94a('0x1'),'content':_0xb94a('0xc'),'variableName':null},{'type':_0xb94a('0xd'),'content':'','key':_0xb94a('0x1d'),'keyType':_0xb94a('0x5'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0xb94a('0xd'),'content':'','key':_0xb94a('0x1e'),'keyType':'variable','keyContent':'','variableName':'membername'},{'type':_0xb94a('0xd'),'content':'','key':_0xb94a('0x12'),'keyType':_0xb94a('0x5'),'keyContent':'','variableName':_0xb94a('0x13')},{'type':_0xb94a('0xd'),'content':'','key':'Date','keyType':'variable','keyContent':'','variableName':_0xb94a('0x1f')},{'type':_0xb94a('0x1'),'content':_0xb94a('0x20')},{'type':'keyValue','content':'','key':_0xb94a('0x21'),'keyType':_0xb94a('0x5'),'keyContent':'','variableName':_0xb94a('0x22')},{'type':_0xb94a('0xd'),'content':'','key':_0xb94a('0x23'),'keyType':_0xb94a('0x5'),'keyContent':'','variableName':_0xb94a('0x24')},{'type':'keyValue','content':'','key':_0xb94a('0x25'),'keyType':'variable','keyContent':'','variableName':_0xb94a('0x26')},{'type':_0xb94a('0xd'),'content':'','key':_0xb94a('0x27'),'keyType':_0xb94a('0x5'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x579210;}; \ No newline at end of file +var _0xba6b=['push','variable','queue','calleridnum','outbound','Outbound\x20Call','getDescriptions','Caller\x20Number','keyValue','Caller\x20Name','calleridname','destexten','Queue','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','Agent\x20Ring','agentconnectAt','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','UniqueId','starttime','***\x20Time\x20Info\x20***','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','string','[xCALLY\x20Ticket]','toLowerCase','inbound'];(function(_0x5ab5d9,_0x38a056){var _0x106fb8=function(_0x135e83){while(--_0x135e83){_0x5ab5d9['push'](_0x5ab5d9['shift']());}};_0x106fb8(++_0x38a056);}(_0xba6b,0xfe));var _0xbba6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xba6b[_0x126558];return _0x1f6d14;};'use strict';exports['getSubjects']=function(_0x1e6128,_0x30ba81){var _0x28a020=[{'type':_0xbba6('0x0'),'content':_0xbba6('0x1'),'variableName':null}];switch(_0x1e6128['toLowerCase']()){case'voice':switch(_0x30ba81[_0xbba6('0x2')]()){case _0xbba6('0x3'):_0x28a020[_0xbba6('0x4')]({'type':_0xbba6('0x5'),'content':'','variableName':_0xbba6('0x6')});_0x28a020['push']({'type':_0xbba6('0x5'),'content':'','variableName':_0xbba6('0x7')});break;case _0xbba6('0x8'):_0x28a020[_0xbba6('0x4')]({'type':_0xbba6('0x0'),'content':_0xbba6('0x9'),'variableName':null});_0x28a020[_0xbba6('0x4')]({'type':_0xbba6('0x5'),'content':'','variableName':'destcalleridnum'});break;}}return _0x28a020;};exports[_0xbba6('0xa')]=function(_0x590fea,_0x392a90){var _0x496e66=[];switch(_0x590fea[_0xbba6('0x2')]()){case'voice':switch(_0x392a90[_0xbba6('0x2')]()){case _0xbba6('0x3'):_0x496e66=[{'type':_0xbba6('0x0'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xbba6('0xb'),'keyType':'variable','variableName':_0xbba6('0x7')},{'type':_0xbba6('0xc'),'content':'','key':_0xbba6('0xd'),'keyType':'variable','variableName':_0xbba6('0xe')},{'type':_0xbba6('0xc'),'content':'','key':'Call\x20To','keyType':_0xbba6('0x5'),'variableName':_0xbba6('0xf')},{'type':'keyValue','content':'','key':_0xbba6('0x10'),'keyType':_0xbba6('0x5'),'variableName':'queue'},{'type':_0xbba6('0xc'),'content':'','key':'UniqueId','keyType':_0xbba6('0x5'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0xbba6('0x11'),'keyType':_0xbba6('0x5'),'variableName':_0xbba6('0x12')},{'type':_0xbba6('0x0'),'content':_0xbba6('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0xbba6('0xc'),'content':'','key':_0xbba6('0x14'),'keyType':'variable','variableName':_0xbba6('0x15')},{'type':'keyValue','content':'','key':_0xbba6('0x16'),'keyType':_0xbba6('0x5'),'variableName':_0xbba6('0x17')},{'type':_0xbba6('0x0'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xbba6('0xc'),'content':'','key':_0xbba6('0x18'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0xbba6('0xc'),'content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0xbba6('0x19')},{'type':_0xbba6('0xc'),'content':'','key':'Agent\x20Complete','keyType':_0xbba6('0x5'),'variableName':_0xbba6('0x1a')},{'type':_0xbba6('0xc'),'content':'','key':_0xbba6('0x1b'),'keyType':_0xbba6('0x5'),'variableName':'holdtime'},{'type':_0xbba6('0xc'),'content':'','key':_0xbba6('0x1c'),'keyType':_0xbba6('0x5'),'variableName':_0xbba6('0x1d')}];break;case'outbound':_0x496e66=[{'type':_0xbba6('0x0'),'content':_0xbba6('0x1e'),'variableName':null},{'type':_0xbba6('0xc'),'content':'','key':_0xbba6('0x1f'),'keyType':'variable','keyContent':'','variableName':_0xbba6('0x17')},{'type':'keyValue','content':'','key':_0xbba6('0x20'),'keyType':_0xbba6('0x5'),'keyContent':'','variableName':_0xbba6('0x21')},{'type':_0xbba6('0xc'),'content':'','key':_0xbba6('0x22'),'keyType':_0xbba6('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0xbba6('0xc'),'content':'','key':_0xbba6('0x11'),'keyType':_0xbba6('0x5'),'keyContent':'','variableName':_0xbba6('0x23')},{'type':_0xbba6('0x0'),'content':_0xbba6('0x24')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0xbba6('0x5'),'keyContent':'','variableName':_0xbba6('0x25')},{'type':'keyValue','content':'','key':_0xbba6('0x26'),'keyType':_0xbba6('0x5'),'keyContent':'','variableName':_0xbba6('0x27')},{'type':'keyValue','content':'','key':_0xbba6('0x28'),'keyType':'variable','keyContent':'','variableName':_0xbba6('0x29')},{'type':_0xbba6('0xc'),'content':'','key':_0xbba6('0x2a'),'keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x496e66;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 13278a3..8ea54f1 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa26=['omit','body','phone','updateUser','lodash','./sql-utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseAdvancedSearchFilter','where','contact','default','fields','filter','user','having','read','tags','checkAccountsRestrictions','group','ids','countFilteredInteractions','length','count','order','forEach','contactName','DESC','closed','getClosedOrderClause','getFilteredInteractions','rows','query','clone'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfa26,0x180));var _0x6fa2=function(_0x9255d2,_0x53d97f){_0x9255d2=_0x9255d2-0x0;var _0x4fe74e=_0xfa26[_0x9255d2];return _0x4fe74e;};'use strict';var _=require(_0x6fa2('0x0'));var sqlUtils=require(_0x6fa2('0x1'));var utils=require('./utils');exports[_0x6fa2('0x2')]=function(_0x3b418d,_0x2892e2,_0x21c5c1,_0x2cb635,_0x1013dd){var _0x499971={'count':0x0,'rows':[]};var _0x41e603=sqlUtils[_0x6fa2('0x3')](_0x3b418d,_0x21c5c1,_0x2892e2);if(_0x41e603){return Promise[_0x6fa2('0x4')](_0x499971);}var _0x1b3650=sqlUtils[_0x6fa2('0x5')](_0x3b418d);var _0x2f2357={};return Promise[_0x6fa2('0x4')]()[_0x6fa2('0x6')](function(){if(_0x2892e2[_0x6fa2('0x7')]){return sqlUtils[_0x6fa2('0x8')](_0x2892e2[_0x6fa2('0x7')],_0x1013dd);}else{return sqlUtils['parseQueryParameters'](_0x3b418d,_0x2892e2,_0x1013dd);}})[_0x6fa2('0x6')](function(_0x363c3f){_0x1b3650[_0x6fa2('0x9')](_0x363c3f['body']);_0x1b3650['where'](_0x363c3f[_0x6fa2('0xa')]);_0x1b3650[_0x6fa2('0x9')](_0x363c3f[_0x6fa2('0xb')]);_0x1b3650[_0x6fa2('0x9')](_0x363c3f[_0x6fa2('0xc')]);_0x1b3650[_0x6fa2('0x9')](_0x363c3f[_0x6fa2('0xd')]);_0x1b3650['where'](_0x363c3f[_0x6fa2('0xe')]);_0x1b3650[_0x6fa2('0xf')](_0x363c3f[_0x6fa2('0x10')]);_0x2f2357=_0x363c3f[_0x6fa2('0x11')];return sqlUtils[_0x6fa2('0x12')](_0x3b418d,_0x21c5c1,_0x2892e2);})[_0x6fa2('0x6')](function(_0x45cc24){_0x1b3650['where'](_0x45cc24);_0x1b3650[_0x6fa2('0x13')]('i.id');var _0x75bd82=_0x2892e2[_0x6fa2('0x7')]?_0x2f2357[_0x6fa2('0x14')]:_0x2892e2['tag'];return sqlUtils[_0x6fa2('0x15')](_0x1b3650,_0x75bd82);})['then'](function(_0x25be27){_0x499971['count']=_0x25be27[_0x6fa2('0x16')];if(_0x499971[_0x6fa2('0x17')]===0x0){return[];}_0x1b3650['having'](_0x2f2357['clause']);if(_0x2cb635[_0x6fa2('0x18')]){_0x2cb635['order'][_0x6fa2('0x19')](function(_0x1ab58a){var _0x5b4861=_0x1ab58a[0x0]===_0x6fa2('0x1a')?_0x1ab58a[0x0]:'i.'+_0x1ab58a[0x0];_0x1b3650['order'](_0x5b4861,_0x1ab58a[0x1]===_0x6fa2('0x1b')?![]:!![]);if(_0x1ab58a[0x0]===_0x6fa2('0x1c')){var _0x190500=sqlUtils[_0x6fa2('0x1d')](_0x3b418d,_0x2892e2);_0x1b3650['order'](_0x190500,_0x1ab58a[0x1]===_0x6fa2('0x1b')?![]:!![]);}});}return sqlUtils[_0x6fa2('0x1e')](_0x3b418d,_0x1b3650,_0x2892e2,_0x2cb635);})[_0x6fa2('0x6')](function(_0x5f0a79){_0x499971[_0x6fa2('0x1f')]=_0x5f0a79;return _0x499971;})['catch'](function(_0x2a92f0){throw _0x2a92f0;});};exports['tracked']=function(_0x23703b,_0x30ae34){return function(_0x4f3619,_0x3b4991,_0x27f821){var _0x5483da=_0x4f3619['user'];var _0x6ced8={};var _0x3da017=_0x4f3619[_0x6fa2('0x20')];if(_0x6ced8){_0x6ced8=_[_0x6fa2('0x21')](_0x4f3619['body']);_0x6ced8=_[_0x6fa2('0x22')](_0x6ced8,[_0x6fa2('0x23'),'html',_0x6fa2('0x24'),'fax','mobile']);}utils[_0x6fa2('0x25')](_0x5483da,_0x6ced8,_0x3da017,_0x23703b,_0x30ae34);_0x27f821(null);};}; \ No newline at end of file +var _0xc3c1=['catch','tracked','user','clone','body','omit','phone','fax','mobile','updateUser','./sql-utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','where','contact','fields','filter','read','tags','checkAccountsRestrictions','group','i.id','tag','countFilteredInteractions','count','length','having','clause','order','contactName','DESC','closed','getClosedOrderClause','getFilteredInteractions','rows'];(function(_0x48ea87,_0x5e26e2){var _0x233219=function(_0x3d70f0){while(--_0x3d70f0){_0x48ea87['push'](_0x48ea87['shift']());}};_0x233219(++_0x5e26e2);}(_0xc3c1,0x190));var _0x1c3c=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc3c1[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var sqlUtils=require(_0x1c3c('0x0'));var utils=require('./utils');exports[_0x1c3c('0x1')]=function(_0x27880a,_0x26788b,_0x1e6465,_0x18c578,_0x3ef0f6){var _0x4a238c={'count':0x0,'rows':[]};var _0xd7838a=sqlUtils[_0x1c3c('0x2')](_0x27880a,_0x1e6465,_0x26788b);if(_0xd7838a){return Promise[_0x1c3c('0x3')](_0x4a238c);}var _0x12e2ae=sqlUtils[_0x1c3c('0x4')](_0x27880a);var _0x102bd8={};return Promise[_0x1c3c('0x3')]()[_0x1c3c('0x5')](function(){if(_0x26788b['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x26788b[_0x1c3c('0x6')],_0x3ef0f6);}else{return sqlUtils['parseQueryParameters'](_0x27880a,_0x26788b,_0x3ef0f6);}})[_0x1c3c('0x5')](function(_0x2c91f5){_0x12e2ae[_0x1c3c('0x7')](_0x2c91f5['body']);_0x12e2ae[_0x1c3c('0x7')](_0x2c91f5[_0x1c3c('0x8')]);_0x12e2ae[_0x1c3c('0x7')](_0x2c91f5['default']);_0x12e2ae['where'](_0x2c91f5[_0x1c3c('0x9')]);_0x12e2ae[_0x1c3c('0x7')](_0x2c91f5[_0x1c3c('0xa')]);_0x12e2ae[_0x1c3c('0x7')](_0x2c91f5['user']);_0x12e2ae['having'](_0x2c91f5[_0x1c3c('0xb')]);_0x102bd8=_0x2c91f5[_0x1c3c('0xc')];return sqlUtils[_0x1c3c('0xd')](_0x27880a,_0x1e6465,_0x26788b);})['then'](function(_0x29140b){_0x12e2ae[_0x1c3c('0x7')](_0x29140b);_0x12e2ae[_0x1c3c('0xe')](_0x1c3c('0xf'));var _0x2550c7=_0x26788b['search']?_0x102bd8['ids']:_0x26788b[_0x1c3c('0x10')];return sqlUtils[_0x1c3c('0x11')](_0x12e2ae,_0x2550c7);})[_0x1c3c('0x5')](function(_0x57fcc5){_0x4a238c[_0x1c3c('0x12')]=_0x57fcc5[_0x1c3c('0x13')];if(_0x4a238c['count']===0x0){return[];}_0x12e2ae[_0x1c3c('0x14')](_0x102bd8[_0x1c3c('0x15')]);if(_0x18c578['order']){_0x18c578[_0x1c3c('0x16')]['forEach'](function(_0x5230ef){var _0x2c2ddd=_0x5230ef[0x0]===_0x1c3c('0x17')?_0x5230ef[0x0]:'i.'+_0x5230ef[0x0];_0x12e2ae[_0x1c3c('0x16')](_0x2c2ddd,_0x5230ef[0x1]===_0x1c3c('0x18')?![]:!![]);if(_0x5230ef[0x0]===_0x1c3c('0x19')){var _0x22a3cf=sqlUtils[_0x1c3c('0x1a')](_0x27880a,_0x26788b);_0x12e2ae[_0x1c3c('0x16')](_0x22a3cf,_0x5230ef[0x1]===_0x1c3c('0x18')?![]:!![]);}});}return sqlUtils[_0x1c3c('0x1b')](_0x27880a,_0x12e2ae,_0x26788b,_0x18c578);})[_0x1c3c('0x5')](function(_0x276bb2){_0x4a238c[_0x1c3c('0x1c')]=_0x276bb2;return _0x4a238c;})[_0x1c3c('0x1d')](function(_0x58ffc8){throw _0x58ffc8;});};exports[_0x1c3c('0x1e')]=function(_0x59fdfa,_0x3acccb){return function(_0x3c7867,_0x3230fe,_0x40215a){var _0x31dd70=_0x3c7867[_0x1c3c('0x1f')];var _0x4606ba={};var _0x288996=_0x3c7867['query'];if(_0x4606ba){_0x4606ba=_[_0x1c3c('0x20')](_0x3c7867[_0x1c3c('0x21')]);_0x4606ba=_[_0x1c3c('0x22')](_0x4606ba,[_0x1c3c('0x21'),'html',_0x1c3c('0x23'),_0x1c3c('0x24'),_0x1c3c('0x25')]);}utils[_0x1c3c('0x26')](_0x31dd70,_0x4606ba,_0x288996,_0x59fdfa,_0x3acccb);_0x40215a(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 900b15b..dc14ec3 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe20e=['CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','some','compact','and','concat','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','then','fields','clause','filter','get','chat','Websites','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','capitalize','Interaction','Sequelize','SELECT','sequelize','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\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.id','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.ContactId','i.MailAccountId','openchannel','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','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','enableEmailPreview','all','COUNT(*)','t.id\x20IN\x20?','QueryTypes','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','color','from','user_has_','_interactions','u.id','left_join','users','where','\x20IN\x20?','getInteractionsTables','getInteractionFK','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','interactionsTags','it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','sms','whatsapp','fax','mail','isEmail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','length','find','buildExpression','type','default','text','value','start','end','read','$substring','split','contact','name','ContactId','Tag','map','tags','ids','User','user'];(function(_0x5e2f7b,_0x226498){var _0x3c386e=function(_0x34c8e1){while(--_0x34c8e1){_0x5e2f7b['push'](_0x5e2f7b['shift']());}};_0x3c386e(++_0x226498);}(_0xe20e,0xf8));var _0xee20=function(_0x202ea3,_0x38ab41){_0x202ea3=_0x202ea3-0x0;var _0x58787b=_0xe20e[_0x202ea3];return _0x58787b;};'use strict';var _=require('lodash');var squel=require(_0xee20('0x0'));var as=require(_0xee20('0x1'));var qs=require(_0xee20('0x2'));var updateInteraction=require(_0xee20('0x3'))[_0xee20('0x4')];var utils=require(_0xee20('0x5'));var db=require(_0xee20('0x6'))['db'];function skipInteractionsQuery(_0x204606,_0x2c3ade,_0x223ac6){var _0x1e5c67=![];var _0x278fa6=utils[_0xee20('0x7')](_0x204606);if(_0x2c3ade[_0xee20('0x8')]===_0xee20('0x9')&&!_0x223ac6[_0xee20('0xa')]&&!_0x223ac6[_0x278fa6]){_0x1e5c67=!![];}return _0x1e5c67;}function getTagsQuery(){return squel[_0xee20('0xb')]()[_0xee20('0xc')]('id')[_0xee20('0xc')]('name')[_0xee20('0xc')](_0xee20('0xd'))[_0xee20('0xe')]('tools_tags');}function getUsersQuery(_0x1cf945,_0x2c6cea){var _0x1f6d16=utils['getInteractionFK'](_0x1cf945);var _0x5a4d2a=_0xee20('0xf')+_0x1cf945+_0xee20('0x10');var _0x6f832c=squel[_0xee20('0xb')]()[_0xee20('0xc')](_0xee20('0x11'))[_0xee20('0xc')]('u.fullname')[_0xee20('0xc')]('ui.'+_0x1f6d16)[_0xee20('0xe')](_0x5a4d2a,'ui')[_0xee20('0x12')](_0xee20('0x13'),'u','u.id\x20=\x20ui.UserId');if(_0x2c6cea['length']>0x0){_0x6f832c[_0xee20('0x14')]('ui.'+_0x1f6d16+_0xee20('0x15'),_['map'](_0x2c6cea,'id'));}return _0x6f832c;}function getInteractionsQuery(_0x5cac35){var _0xf58237=utils[_0xee20('0x16')](_0x5cac35);var _0x2ea087=utils['getAccountFK'](_0x5cac35);var _0x32f8a8=utils[_0xee20('0x17')](_0x5cac35);return squel[_0xee20('0xb')]()[_0xee20('0xe')](_0xf58237[_0xee20('0x18')],'i')[_0xee20('0x12')](_0xee20('0x19'),'c',_0xee20('0x1a'))[_0xee20('0x12')](_0xee20('0x13'),'o',_0xee20('0x1b'))['left_join'](_0xf58237[_0xee20('0x1c')],'a',_0xee20('0x1d')+_0x2ea087)[_0xee20('0x12')](_0xf58237[_0xee20('0x1e')],'me','me.'+_0x32f8a8+_0xee20('0x1f'))[_0xee20('0x12')](_0xf58237[_0xee20('0x20')],'it',_0xee20('0x21')+_0x32f8a8+'\x20=\x20i.id')['left_join'](_0xee20('0x22'),'t',_0xee20('0x23'));}function getSqlClauses(){var _0x171fee={'body':squel['expr'](),'contact':squel[_0xee20('0x24')](),'default':squel[_0xee20('0x24')](),'fields':squel[_0xee20('0x24')](),'filter':squel[_0xee20('0x24')](),'read':squel[_0xee20('0x24')](),'tags':{'clause':squel[_0xee20('0x24')](),'ids':null},'user':squel[_0xee20('0x24')]()};return _0x171fee;}function parseTagParameter(_0x787938){var _0x48872f=squel[_0xee20('0x24')]();if(_0x787938){var _0x4252ea=utils[_0xee20('0x25')](_0x787938);_0x4252ea[_0xee20('0x26')](function(_0x2ca043){_0x48872f['or'](_0xee20('0x27'),'%,'+_0x2ca043+',%');});}return _0x48872f;}function parseReadParameter(_0x35285d){var _0x175a63='';if(_0x35285d){_0x175a63='unreadMessages\x20{OPERATOR}\x200';if(_0x35285d==='1'){_0x175a63=_0x175a63[_0xee20('0x28')](_0xee20('0x29'),'=');}else{_0x175a63=_0x175a63[_0xee20('0x28')]('{OPERATOR}','>');}}return _0x175a63;}function parseSearchFilter(_0x1d4db9,_0x24dc17){var _0x51808b=squel[_0xee20('0x24')]();if(_0x24dc17){var _0x48b21c=_0x24dc17['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xee20('0x2a')](_0x48b21c)){_0x51808b['or']('i.id\x20LIKE\x20?',_0x48b21c+'%');if([_0xee20('0x2b'),_0xee20('0x2c')]['includes'](_0x1d4db9)){_0x51808b['or']('i.phone\x20LIKE\x20?',_0x48b21c+'%');}else if(_0x1d4db9===_0xee20('0x2d')){_0x51808b['or']('i.fax\x20LIKE\x20?',_0x48b21c+'%');}else if(_0x1d4db9==='openchannel'){_0x51808b['or']('i.from\x20LIKE\x20?',_0x48b21c+'%');}}else if(_0x1d4db9===_0xee20('0x2e')&&qs[_0xee20('0x2f')](_0x48b21c)){_0x51808b['or']('c.email\x20LIKE\x20?',_0x48b21c+'%');}else{if(_0x1d4db9===_0xee20('0x2e')){_0x51808b['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xee20('0x30')](_0x48b21c,!![]))['or'](_0xee20('0x31'),qs[_0xee20('0x30')](_0x48b21c));}else if(_0x1d4db9!==_0xee20('0x2d')){_0x51808b['or'](_0xee20('0x32'),qs['getFullTextValue'](_0x48b21c));}_0x51808b['or'](_0xee20('0x33'),qs[_0xee20('0x30')](_0x48b21c,!![]),null);}}return _0x51808b;}function parseAdvancedSearchFilter(_0x300ac0,_0x296783){var _0x2ab909=getSqlClauses();var _0x28517c=as[_0xee20('0x34')](_0x300ac0);var _0x4b9a26=_0x28517c[_0xee20('0x35')];for(var _0x5e19a2=0x0;_0x5e19a2<_0x28517c[_0xee20('0x36')][_0xee20('0x37')];_0x5e19a2++){var _0x8e0f98=_0x28517c[_0xee20('0x36')][_0x5e19a2];var _0x5bd94b='i';var _0x5e3479=_[_0xee20('0x38')](_0x296783,['name',_0x8e0f98[_0xee20('0xc')]]);if(_0x5e3479){var _0xc2946c=as[_0xee20('0x39')](_0x5bd94b,_0x5e3479[_0xee20('0x3a')],_0x8e0f98);_0x2ab909[_0xee20('0x3b')][_0x4b9a26](_0xc2946c[_0xee20('0x3c')],_0xc2946c[_0xee20('0x3d')][_0xee20('0x3e')],_0xc2946c['value'][_0xee20('0x3f')]);}else{switch(_0x8e0f98['field']){case'unreadMessages':var _0x273291=parseReadParameter(_0x8e0f98[_0xee20('0x3d')]);_0x2ab909[_0xee20('0x40')]['and'](_0x273291);break;case'Contact':if(_0x8e0f98['operator']===_0xee20('0x41')){if(_0x8e0f98[_0xee20('0x3d')][_0xee20('0x42')]('\x20')[_0xee20('0x37')]>0x1){_0x2ab909['contact'][_0x4b9a26](_0xee20('0x33'),qs[_0xee20('0x30')](_0x8e0f98['value'],!![]),null);}else{var _0xf5df4f='%'+_0x8e0f98[_0xee20('0x3d')]+'%';_0x2ab909[_0xee20('0x43')][_0x4b9a26]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xf5df4f,_0xf5df4f,_0xf5df4f);}}else{_0x5e3479=_[_0xee20('0x38')](_0x296783,[_0xee20('0x44'),'ContactId']);_0x8e0f98[_0xee20('0xc')]=_0xee20('0x45');_0xc2946c=as[_0xee20('0x39')](_0x5bd94b,_0x5e3479[_0xee20('0x3a')],_0x8e0f98);_0x2ab909[_0xee20('0x43')][_0x4b9a26](_0xc2946c['text'],_0xc2946c[_0xee20('0x3d')][_0xee20('0x3e')],_0xc2946c['value'][_0xee20('0x3f')]);}break;case _0xee20('0x46'):var _0x335147=_0x8e0f98[_0xee20('0x3d')][_0xee20('0x42')](',')[_0xee20('0x47')](function(_0x256337){return Number(_0x256337);});var _0x35cb4f=parseTagParameter(_0x335147);_0x2ab909[_0xee20('0x48')]['clause']['and'](_0x35cb4f);_0x2ab909[_0xee20('0x48')][_0xee20('0x49')]=_0x335147;break;case _0xee20('0x4a'):if(_0x8e0f98['operator']===_0xee20('0x41')){_0x2ab909[_0xee20('0x4b')][_0x4b9a26](_0xee20('0x4c'),'%'+_0x8e0f98[_0xee20('0x3d')]+'%',null);}else{_0x5e3479=_[_0xee20('0x38')](_0x296783,[_0xee20('0x44'),'UserId']);_0x8e0f98[_0xee20('0xc')]=_0xee20('0x4d');_0xc2946c=as[_0xee20('0x39')](_0x5bd94b,_0x5e3479[_0xee20('0x3a')],_0x8e0f98);_0x2ab909[_0xee20('0x4b')][_0x4b9a26](_0xc2946c[_0xee20('0x3c')],_0xc2946c[_0xee20('0x3d')][_0xee20('0x3e')],_0xc2946c[_0xee20('0x3d')][_0xee20('0x3f')]);}break;case _0xee20('0x4e'):case _0xee20('0x4f'):_0xc2946c=as[_0xee20('0x39')]('me',null,_0x8e0f98);_0x2ab909[_0xee20('0x4e')][_0x4b9a26](_0xc2946c[_0xee20('0x3c')],_0xc2946c[_0xee20('0x3d')][_0xee20('0x3e')],_0xc2946c[_0xee20('0x3d')][_0xee20('0x3f')]);break;}}}return _0x2ab909;}function parseModelFields(_0x4b01f7,_0x252cc0,_0x397d55){var _0x4dd12c=utils[_0xee20('0x7')](_0x4b01f7);var _0x4b3291=squel[_0xee20('0x24')]();var _0x33f80d=_(_0x252cc0)[_0xee20('0x50')]()['map'](function(_0x32cf91){return _[_0xee20('0x51')](_0x397d55,['name',_0x32cf91])?_0x32cf91:undefined;})[_0xee20('0x52')]()[_0xee20('0x3d')]();if(_0x33f80d[_0xee20('0x37')]>0x0){_0x33f80d[_0xee20('0x26')](function(_0x458ad6){if(_0x458ad6===_0x4dd12c){_0x4b3291[_0xee20('0x53')]('i.'+_0x4dd12c+_0xee20('0x15'),[][_0xee20('0x54')](_0x252cc0[_0x458ad6]));}else if(_0x458ad6===_0xee20('0x55')){var _0x2e04f0=JSON['parse'](_0x252cc0[_0x458ad6])[_0xee20('0x56')];var _0x14f8b0=JSON[_0xee20('0x57')](_0x252cc0[_0x458ad6])[_0xee20('0x58')];_0x4b3291['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2e04f0,_0x14f8b0);}else{if(_0x252cc0[_0x458ad6]===_0xee20('0x59')){_0x4b3291['and']('i.'+_0x458ad6+_0xee20('0x5a'));}else{_0x4b3291[_0xee20('0x53')]('i.'+_0x458ad6+_0xee20('0x5b'),_0x252cc0[_0x458ad6]);}}});}return _0x4b3291;}function parseQueryParameters(_0x412b37,_0x57e8d2,_0x5ed639){var _0x7a82eb=getSqlClauses();return Promise['resolve']()[_0xee20('0x5c')](function(){return parseModelFields(_0x412b37,_0x57e8d2,_0x5ed639);})[_0xee20('0x5c')](function(_0x15bac7){_0x7a82eb[_0xee20('0x5d')]['and'](_0x15bac7);return parseReadParameter(_0x57e8d2[_0xee20('0x40')]);})[_0xee20('0x5c')](function(_0x1f8071){_0x7a82eb[_0xee20('0x40')][_0xee20('0x53')](_0x1f8071);return parseTagParameter(_0x57e8d2['tag']);})[_0xee20('0x5c')](function(_0x12c176){_0x7a82eb['tags'][_0xee20('0x5e')][_0xee20('0x53')](_0x12c176);return parseSearchFilter(_0x412b37,_0x57e8d2[_0xee20('0x5f')]);})[_0xee20('0x5c')](function(_0x5204e6){_0x7a82eb[_0xee20('0x5f')]=_0x5204e6;return _0x7a82eb;});}function checkAccountsRestrictions(_0x867fd,_0x318b82,_0x531cc3){var _0x4daa51=utils[_0xee20('0x7')](_0x867fd);var _0x109f3c=_0xee20('0x60')+_['capitalize'](_0x867fd)+(_0x867fd===_0xee20('0x61')?_0xee20('0x62'):'Accounts');var _0x2dade2=squel[_0xee20('0x24')]();return Promise['resolve']()[_0xee20('0x5c')](function(){if(_0x531cc3[_0xee20('0xa')]&&_0x318b82[_0xee20('0x8')]===_0xee20('0x9')){return _0x318b82[_0x109f3c]({'attributes':['id'],'raw':!![]});}})[_0xee20('0x5c')](function(_0x3e4af0){if(_0x3e4af0){if(_0x3e4af0[_0xee20('0x37')]===0x0){_0x2dade2[_0xee20('0x53')]('i.'+_0x4daa51+_0xee20('0x5a'));}else{_0x2dade2[_0xee20('0x53')]('i.'+_0x4daa51+_0xee20('0x15'),_[_0xee20('0x47')](_0x3e4af0,'id'));}}else if(!_0x531cc3[_0x4daa51]){_0x2dade2[_0xee20('0x53')]('i.'+_0x4daa51+_0xee20('0x63'));}})[_0xee20('0x5c')](function(){return _0x2dade2;});}function getClosedOrderClause(_0x1b0d2d,_0x59e8af){var _0x183740='';var _0xd91d94=[_0xee20('0x64'),_0xee20('0x65'),_0xee20('0x66')];if(_0x1b0d2d===_0xee20('0x2e')){_0xd91d94[_0xee20('0x67')](_0xee20('0x68'));}if(_0x59e8af[_0xee20('0x69')]==='0'&&_0x1b0d2d===_0xee20('0x2e')){_0x183740='i.substatus';}else{if(_0x59e8af[_0xee20('0x69')]==='1'){_0xd91d94[_0xee20('0x6a')]();}_0x183740=_0xee20('0x6b')+_0xd91d94[_0xee20('0x6c')](',\x20')+')';}return _0x183740;}function getFilteredInteractions(_0x1582ee,_0x2aa491,_0x337054,_0x5691b0){var _0x1cf0b7=utils[_0xee20('0x17')](_0x1582ee);var _0x4a4750=_[_0xee20('0x6d')](_0x1582ee)+_0xee20('0x6e');var _0x2f3f36=[];var _0x5ac9f7=getTagsQuery();var _0xedaba={'type':db[_0xee20('0x6f')]['QueryTypes'][_0xee20('0x70')],'raw':!![]};var _0x4c0aca=[];var _0x407a93=[];return db[_0xee20('0x71')][_0xee20('0x72')](_0x5ac9f7[_0xee20('0x73')](),_0xedaba)[_0xee20('0x5c')](function(_0x726dd2){_0x2f3f36=_[_0xee20('0x74')](_0x726dd2,'id');_0xedaba=_[_0xee20('0x75')](_0xedaba,{'model':db[_0x4a4750],'mapToModel':!![],'nest':!![]});if(_0x337054['fields']){_0x5691b0[_0xee20('0x76')][_0xee20('0x26')](function(_0x392eec){_0x2aa491['field']('i.'+_0x392eec);});}else{_0x2aa491['field'](_0xee20('0x77'),_0xee20('0x78'));_0x2aa491[_0xee20('0xc')](_0xee20('0x79'),'Account.key');_0x2aa491[_0xee20('0xc')](_0xee20('0x7a'),_0xee20('0x7b'));if(_0x1582ee===_0xee20('0x2e')){_0x2aa491['field']('a.email','Account.email');_0x2aa491['field'](_0xee20('0x7c'),_0xee20('0x7d'));_0x2aa491[_0xee20('0xc')](_0xee20('0x7e'));_0x2aa491['field'](_0xee20('0x7f'));_0x2aa491['field'](_0xee20('0x80'));_0x2aa491[_0xee20('0xc')]('i.closed');_0x2aa491[_0xee20('0xc')](_0xee20('0x81'));_0x2aa491[_0xee20('0xc')](_0xee20('0x82'));_0x2aa491[_0xee20('0xc')]('i.lastMsgAt');_0x2aa491['field'](_0xee20('0x83'));_0x2aa491[_0xee20('0xc')](_0xee20('0x84'));_0x2aa491[_0xee20('0xc')](_0xee20('0x66'));_0x2aa491[_0xee20('0xc')](_0xee20('0x65'));_0x2aa491[_0xee20('0xc')](_0xee20('0x64'));_0x2aa491[_0xee20('0xc')]('i.substatus');_0x2aa491[_0xee20('0xc')]('i.to');_0x2aa491[_0xee20('0xc')](_0xee20('0x85'));_0x2aa491['field'](_0xee20('0x86'));_0x2aa491[_0xee20('0xc')]('i.UserId');}else if(_0x1582ee===_0xee20('0x87')){_0x2aa491[_0xee20('0xc')](_0xee20('0x88'),_0xee20('0x7d'));}else{_0x2aa491[_0xee20('0xc')](_0xee20('0x89'),_0xee20('0x7d'));}if(_0x1582ee!==_0xee20('0x2e')){_0x2aa491['field']('i.*');}_0x2aa491[_0xee20('0xc')](_0xee20('0x8a'),_0xee20('0x8b'));_0x2aa491[_0xee20('0xc')](_0xee20('0x8c'),_0xee20('0x8d'));_0x2aa491[_0xee20('0xc')](_0xee20('0x8e'),'Contact.email');_0x2aa491[_0xee20('0xc')](_0xee20('0x8f'),_0xee20('0x90'));_0x2aa491[_0xee20('0xc')](_0xee20('0x91'),'Contact.mobile');_0x2aa491[_0xee20('0xc')](_0xee20('0x92'),_0xee20('0x93'));_0x2aa491[_0xee20('0xc')](_0xee20('0x94'),_0xee20('0x95'));_0x2aa491['field']('o.internal',_0xee20('0x96'));_0x2aa491[_0xee20('0xc')](_0xee20('0x97'),_0xee20('0x98'));}if(_0x5691b0[_0xee20('0x99')]){_0x2aa491[_0xee20('0x99')](_0x5691b0['limit']);}if(_0x5691b0['offset']){_0x2aa491[_0xee20('0x9a')](_0x5691b0[_0xee20('0x9a')]);}return db[_0xee20('0x71')][_0xee20('0x72')](_0x2aa491[_0xee20('0x73')](),_0xedaba);})[_0xee20('0x5c')](function(_0x530eea){_0x4c0aca=_0x530eea;var _0x3392ad=getUsersQuery(_0x1582ee,_0x4c0aca);return db[_0xee20('0x71')][_0xee20('0x72')](_0x3392ad[_0xee20('0x73')](),_0xedaba);})['then'](function(_0x10375e){_0x407a93=_[_0xee20('0x9b')](_0x10375e,_0x1cf0b7);if(_0x1582ee===_0xee20('0x2e')){return db[_0xee20('0x9c')]['findOne']({'attributes':[_0xee20('0x9d')],'raw':!![]});}})[_0xee20('0x5c')](function(_0x3481b4){var _0x3ae351=_0x3481b4?_0x3481b4['enableEmailPreview']:undefined;var _0x2ac0b6=_0x4c0aca[_0xee20('0x47')](function(_0x23bb48){return updateInteraction(_0x23bb48,_0x2f3f36,_0x407a93,_0x3ae351);});return Promise[_0xee20('0x9e')](_0x2ac0b6);});}function countFilteredInteractions(_0x247e78,_0x4fad53){var _0x5bfc70=_0x247e78['clone']();_0x5bfc70[_0xee20('0xc')](_0xee20('0x9f'));_0x5bfc70['field'](_0xee20('0x77'),'unreadMessages');var _0x9c4a0d=utils[_0xee20('0x25')](_0x4fad53);if(!_['isEmpty'](_0x9c4a0d)){_0x5bfc70['where'](_0xee20('0xa0'),_0x9c4a0d);}var _0x5093ac={'type':db[_0xee20('0x6f')][_0xee20('0xa1')][_0xee20('0x70')],'raw':!![]};return db[_0xee20('0x71')][_0xee20('0x72')](_0x5bfc70[_0xee20('0x73')](),_0x5093ac);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x21ed=['ui.','left_join','where','\x20IN\x20?','map','getInteractionsTables','getInteractionFK','cm_contacts','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','isNumeric','i.id\x20LIKE\x20?','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','length','conditions','find','buildExpression','type','text','value','start','end','unreadMessages','read','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','some','compact','and','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','get','Websites','Accounts','role','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','Sequelize','QueryTypes','SELECT','sequelize','query','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','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.id','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','toString','groupBy','Setting','findOne','enableEmailPreview','all','COUNT(*)','getSelectedTags','isEmpty','t.id\x20IN\x20?','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','getAccountFK','agent','search','select','field','name','from','tools_tags','_interactions','u.id','u.fullname'];(function(_0x2a4e7a,_0x4e4326){var _0x485fb6=function(_0x27fa6e){while(--_0x27fa6e){_0x2a4e7a['push'](_0x2a4e7a['shift']());}};_0x485fb6(++_0x4e4326);}(_0x21ed,0x90));var _0xd21e=function(_0x5d623b,_0x56be27){_0x5d623b=_0x5d623b-0x0;var _0x2057fc=_0x21ed[_0x5d623b];return _0x2057fc;};'use strict';var _=require(_0xd21e('0x0'));var squel=require('squel');var as=require(_0xd21e('0x1'));var qs=require(_0xd21e('0x2'));var updateInteraction=require(_0xd21e('0x3'))[_0xd21e('0x4')];var utils=require(_0xd21e('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x558ff5,_0x21910e,_0x4fb374){var _0x430ee3=![];var _0x1bd8c7=utils[_0xd21e('0x6')](_0x558ff5);if(_0x21910e['role']===_0xd21e('0x7')&&!_0x4fb374[_0xd21e('0x8')]&&!_0x4fb374[_0x1bd8c7]){_0x430ee3=!![];}return _0x430ee3;}function getTagsQuery(){return squel[_0xd21e('0x9')]()[_0xd21e('0xa')]('id')[_0xd21e('0xa')](_0xd21e('0xb'))['field']('color')[_0xd21e('0xc')](_0xd21e('0xd'));}function getUsersQuery(_0x201573,_0x1e763a){var _0x4c9770=utils['getInteractionFK'](_0x201573);var _0x5b25f7='user_has_'+_0x201573+_0xd21e('0xe');var _0x482be3=squel['select']()['field'](_0xd21e('0xf'))[_0xd21e('0xa')](_0xd21e('0x10'))[_0xd21e('0xa')](_0xd21e('0x11')+_0x4c9770)['from'](_0x5b25f7,'ui')[_0xd21e('0x12')]('users','u','u.id\x20=\x20ui.UserId');if(_0x1e763a['length']>0x0){_0x482be3[_0xd21e('0x13')]('ui.'+_0x4c9770+_0xd21e('0x14'),_[_0xd21e('0x15')](_0x1e763a,'id'));}return _0x482be3;}function getInteractionsQuery(_0x47ee52){var _0x193048=utils[_0xd21e('0x16')](_0x47ee52);var _0x2dd58b=utils[_0xd21e('0x6')](_0x47ee52);var _0x1b9009=utils[_0xd21e('0x17')](_0x47ee52);return squel['select']()[_0xd21e('0xc')](_0x193048['interactions'],'i')[_0xd21e('0x12')](_0xd21e('0x18'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xd21e('0x12')]('users','o','o.id\x20=\x20i.UserId')[_0xd21e('0x12')](_0x193048[_0xd21e('0x19')],'a',_0xd21e('0x1a')+_0x2dd58b)[_0xd21e('0x12')](_0x193048[_0xd21e('0x1b')],'me',_0xd21e('0x1c')+_0x1b9009+_0xd21e('0x1d'))[_0xd21e('0x12')](_0x193048[_0xd21e('0x1e')],'it',_0xd21e('0x1f')+_0x1b9009+_0xd21e('0x1d'))[_0xd21e('0x12')](_0xd21e('0xd'),'t',_0xd21e('0x20'));}function getSqlClauses(){var _0x5016c4={'body':squel['expr'](),'contact':squel[_0xd21e('0x21')](),'default':squel[_0xd21e('0x21')](),'fields':squel[_0xd21e('0x21')](),'filter':squel[_0xd21e('0x21')](),'read':squel[_0xd21e('0x21')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0xd21e('0x21')]()};return _0x5016c4;}function parseTagParameter(_0x5ee666){var _0x35fde6=squel['expr']();if(_0x5ee666){var _0xff0463=utils['getSelectedTags'](_0x5ee666);_0xff0463[_0xd21e('0x22')](function(_0x2ca262){_0x35fde6['or'](_0xd21e('0x23'),'%,'+_0x2ca262+',%');});}return _0x35fde6;}function parseReadParameter(_0x48d818){var _0x207f95='';if(_0x48d818){_0x207f95=_0xd21e('0x24');if(_0x48d818==='1'){_0x207f95=_0x207f95['replace'](_0xd21e('0x25'),'=');}else{_0x207f95=_0x207f95[_0xd21e('0x26')](_0xd21e('0x25'),'>');}}return _0x207f95;}function parseSearchFilter(_0x14f03a,_0x14fd2c){var _0x4057d8=squel[_0xd21e('0x21')]();if(_0x14fd2c){var _0x4967bd=_0x14fd2c[_0xd21e('0x26')]('\x5c','\x5c\x5c')[_0xd21e('0x26')](/'/g,'\x27\x27');if(qs[_0xd21e('0x27')](_0x4967bd)){_0x4057d8['or'](_0xd21e('0x28'),_0x4967bd+'%');if(['sms','whatsapp'][_0xd21e('0x29')](_0x14f03a)){_0x4057d8['or'](_0xd21e('0x2a'),_0x4967bd+'%');}else if(_0x14f03a===_0xd21e('0x2b')){_0x4057d8['or'](_0xd21e('0x2c'),_0x4967bd+'%');}else if(_0x14f03a===_0xd21e('0x2d')){_0x4057d8['or'](_0xd21e('0x2e'),_0x4967bd+'%');}}else if(_0x14f03a===_0xd21e('0x2f')&&qs[_0xd21e('0x30')](_0x4967bd)){_0x4057d8['or'](_0xd21e('0x31'),_0x4967bd+'%');}else{if(_0x14f03a===_0xd21e('0x2f')){_0x4057d8['or'](_0xd21e('0x32'),qs[_0xd21e('0x33')](_0x4967bd,!![]))['or'](_0xd21e('0x34'),qs[_0xd21e('0x33')](_0x4967bd));}else if(_0x14f03a!==_0xd21e('0x2b')){_0x4057d8['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd21e('0x33')](_0x4967bd));}_0x4057d8['or'](_0xd21e('0x35'),qs[_0xd21e('0x33')](_0x4967bd,!![]),null);}}return _0x4057d8;}function parseAdvancedSearchFilter(_0x1d9607,_0x24e431){var _0x57d832=getSqlClauses();var _0x53a8d5=as[_0xd21e('0x36')](_0x1d9607);var _0x3b16e0=_0x53a8d5[_0xd21e('0x37')];for(var _0x5dd764=0x0;_0x5dd764<_0x53a8d5['conditions'][_0xd21e('0x38')];_0x5dd764++){var _0x5d4248=_0x53a8d5[_0xd21e('0x39')][_0x5dd764];var _0x297f94='i';var _0xe911b0=_[_0xd21e('0x3a')](_0x24e431,[_0xd21e('0xb'),_0x5d4248['field']]);if(_0xe911b0){var _0xffd441=as[_0xd21e('0x3b')](_0x297f94,_0xe911b0[_0xd21e('0x3c')],_0x5d4248);_0x57d832['default'][_0x3b16e0](_0xffd441[_0xd21e('0x3d')],_0xffd441[_0xd21e('0x3e')][_0xd21e('0x3f')],_0xffd441[_0xd21e('0x3e')][_0xd21e('0x40')]);}else{switch(_0x5d4248['field']){case _0xd21e('0x41'):var _0x25462b=parseReadParameter(_0x5d4248[_0xd21e('0x3e')]);_0x57d832[_0xd21e('0x42')]['and'](_0x25462b);break;case'Contact':if(_0x5d4248[_0xd21e('0x43')]===_0xd21e('0x44')){if(_0x5d4248[_0xd21e('0x3e')][_0xd21e('0x45')]('\x20')[_0xd21e('0x38')]>0x1){_0x57d832[_0xd21e('0x46')][_0x3b16e0](_0xd21e('0x35'),qs['getFullTextValue'](_0x5d4248[_0xd21e('0x3e')],!![]),null);}else{var _0x36ff30='%'+_0x5d4248[_0xd21e('0x3e')]+'%';_0x57d832[_0xd21e('0x46')][_0x3b16e0](_0xd21e('0x47'),_0x36ff30,_0x36ff30,_0x36ff30);}}else{_0xe911b0=_[_0xd21e('0x3a')](_0x24e431,['name',_0xd21e('0x48')]);_0x5d4248[_0xd21e('0xa')]=_0xd21e('0x48');_0xffd441=as[_0xd21e('0x3b')](_0x297f94,_0xe911b0['type'],_0x5d4248);_0x57d832[_0xd21e('0x46')][_0x3b16e0](_0xffd441[_0xd21e('0x3d')],_0xffd441[_0xd21e('0x3e')][_0xd21e('0x3f')],_0xffd441[_0xd21e('0x3e')][_0xd21e('0x40')]);}break;case _0xd21e('0x49'):var _0x4b5c56=_0x5d4248['value'][_0xd21e('0x45')](',')[_0xd21e('0x15')](function(_0x5b74df){return Number(_0x5b74df);});var _0xa2b1f0=parseTagParameter(_0x4b5c56);_0x57d832[_0xd21e('0x4a')][_0xd21e('0x4b')]['and'](_0xa2b1f0);_0x57d832[_0xd21e('0x4a')][_0xd21e('0x4c')]=_0x4b5c56;break;case _0xd21e('0x4d'):if(_0x5d4248[_0xd21e('0x43')]===_0xd21e('0x44')){_0x57d832[_0xd21e('0x4e')][_0x3b16e0](_0xd21e('0x4f'),'%'+_0x5d4248[_0xd21e('0x3e')]+'%',null);}else{_0xe911b0=_[_0xd21e('0x3a')](_0x24e431,[_0xd21e('0xb'),_0xd21e('0x50')]);_0x5d4248[_0xd21e('0xa')]='UserId';_0xffd441=as[_0xd21e('0x3b')](_0x297f94,_0xe911b0['type'],_0x5d4248);_0x57d832[_0xd21e('0x4e')][_0x3b16e0](_0xffd441[_0xd21e('0x3d')],_0xffd441['value'][_0xd21e('0x3f')],_0xffd441[_0xd21e('0x3e')][_0xd21e('0x40')]);}break;case _0xd21e('0x51'):case _0xd21e('0x52'):_0xffd441=as['buildExpression']('me',null,_0x5d4248);_0x57d832[_0xd21e('0x51')][_0x3b16e0](_0xffd441[_0xd21e('0x3d')],_0xffd441[_0xd21e('0x3e')][_0xd21e('0x3f')],_0xffd441['value']['end']);break;}}}return _0x57d832;}function parseModelFields(_0x138179,_0x2f8698,_0x1d8e2c){var _0x42518f=utils[_0xd21e('0x6')](_0x138179);var _0x1ca714=squel[_0xd21e('0x21')]();var _0x40d88d=_(_0x2f8698)[_0xd21e('0x53')]()['map'](function(_0x4d8ab6){return _[_0xd21e('0x54')](_0x1d8e2c,['name',_0x4d8ab6])?_0x4d8ab6:undefined;})[_0xd21e('0x55')]()[_0xd21e('0x3e')]();if(_0x40d88d['length']>0x0){_0x40d88d['forEach'](function(_0x3ca2e7){if(_0x3ca2e7===_0x42518f){_0x1ca714[_0xd21e('0x56')]('i.'+_0x42518f+_0xd21e('0x14'),[]['concat'](_0x2f8698[_0x3ca2e7]));}else if(_0x3ca2e7===_0xd21e('0x57')){var _0x8bcd9a=JSON[_0xd21e('0x58')](_0x2f8698[_0x3ca2e7])[_0xd21e('0x59')];var _0x53f281=JSON[_0xd21e('0x58')](_0x2f8698[_0x3ca2e7])[_0xd21e('0x5a')];_0x1ca714[_0xd21e('0x56')](_0xd21e('0x5b'),_0x8bcd9a,_0x53f281);}else{if(_0x2f8698[_0x3ca2e7]===_0xd21e('0x5c')){_0x1ca714[_0xd21e('0x56')]('i.'+_0x3ca2e7+_0xd21e('0x5d'));}else{_0x1ca714[_0xd21e('0x56')]('i.'+_0x3ca2e7+_0xd21e('0x5e'),_0x2f8698[_0x3ca2e7]);}}});}return _0x1ca714;}function parseQueryParameters(_0x30b5d3,_0x477372,_0xeb8152){var _0x1502df=getSqlClauses();return Promise[_0xd21e('0x5f')]()[_0xd21e('0x60')](function(){return parseModelFields(_0x30b5d3,_0x477372,_0xeb8152);})['then'](function(_0x392669){_0x1502df[_0xd21e('0x61')][_0xd21e('0x56')](_0x392669);return parseReadParameter(_0x477372[_0xd21e('0x42')]);})['then'](function(_0x1bbbcf){_0x1502df[_0xd21e('0x42')][_0xd21e('0x56')](_0x1bbbcf);return parseTagParameter(_0x477372[_0xd21e('0x62')]);})[_0xd21e('0x60')](function(_0x1a74fc){_0x1502df[_0xd21e('0x4a')]['clause'][_0xd21e('0x56')](_0x1a74fc);return parseSearchFilter(_0x30b5d3,_0x477372[_0xd21e('0x63')]);})[_0xd21e('0x60')](function(_0x26c955){_0x1502df[_0xd21e('0x63')]=_0x26c955;return _0x1502df;});}function checkAccountsRestrictions(_0x11b5bd,_0x217b82,_0x29ca04){var _0x4d03e8=utils[_0xd21e('0x6')](_0x11b5bd);var _0x3bbd03=_0xd21e('0x64')+_['capitalize'](_0x11b5bd)+(_0x11b5bd==='chat'?_0xd21e('0x65'):_0xd21e('0x66'));var _0x1c23c3=squel[_0xd21e('0x21')]();return Promise[_0xd21e('0x5f')]()['then'](function(){if(_0x29ca04[_0xd21e('0x8')]&&_0x217b82[_0xd21e('0x67')]===_0xd21e('0x7')){return _0x217b82[_0x3bbd03]({'attributes':['id'],'raw':!![]});}})['then'](function(_0xcf0cda){if(_0xcf0cda){if(_0xcf0cda[_0xd21e('0x38')]===0x0){_0x1c23c3[_0xd21e('0x56')]('i.'+_0x4d03e8+_0xd21e('0x5d'));}else{_0x1c23c3[_0xd21e('0x56')]('i.'+_0x4d03e8+_0xd21e('0x14'),_[_0xd21e('0x15')](_0xcf0cda,'id'));}}else if(!_0x29ca04[_0x4d03e8]){_0x1c23c3[_0xd21e('0x56')]('i.'+_0x4d03e8+_0xd21e('0x68'));}})['then'](function(){return _0x1c23c3;});}function getClosedOrderClause(_0xde8631,_0x4cf002){var _0x204ef7='';var _0x5330dc=[_0xd21e('0x69'),'i.secondDisposition',_0xd21e('0x6a')];if(_0xde8631===_0xd21e('0x2f')){_0x5330dc[_0xd21e('0x6b')](_0xd21e('0x6c'));}if(_0x4cf002[_0xd21e('0x6d')]==='0'&&_0xde8631==='mail'){_0x204ef7=_0xd21e('0x6c');}else{if(_0x4cf002[_0xd21e('0x6d')]==='1'){_0x5330dc['shift']();}_0x204ef7=_0xd21e('0x6e')+_0x5330dc[_0xd21e('0x6f')](',\x20')+')';}return _0x204ef7;}function getFilteredInteractions(_0x55ab7f,_0x2114ea,_0x18f8b9,_0x180c11){var _0x514791=utils[_0xd21e('0x17')](_0x55ab7f);var _0x245cb7=_['capitalize'](_0x55ab7f)+'Interaction';var _0x51d8a6=[];var _0x524a84=getTagsQuery();var _0xa3fce={'type':db[_0xd21e('0x70')][_0xd21e('0x71')][_0xd21e('0x72')],'raw':!![]};var _0x53c078=[];var _0x155a8b=[];return db[_0xd21e('0x73')][_0xd21e('0x74')](_0x524a84['toString'](),_0xa3fce)[_0xd21e('0x60')](function(_0x2d90c6){_0x51d8a6=_[_0xd21e('0x75')](_0x2d90c6,'id');_0xa3fce=_[_0xd21e('0x76')](_0xa3fce,{'model':db[_0x245cb7],'mapToModel':!![],'nest':!![]});if(_0x18f8b9['fields']){_0x180c11['attributes'][_0xd21e('0x22')](function(_0x3c4f87){_0x2114ea['field']('i.'+_0x3c4f87);});}else{_0x2114ea[_0xd21e('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd21e('0x41'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x77'),_0xd21e('0x78'));_0x2114ea[_0xd21e('0xa')]('a.mandatoryDisposition',_0xd21e('0x79'));if(_0x55ab7f===_0xd21e('0x2f')){_0x2114ea[_0xd21e('0xa')]('a.email',_0xd21e('0x7a'));_0x2114ea['field'](_0xd21e('0x7b'),'contactName');_0x2114ea[_0xd21e('0xa')](_0xd21e('0x7c'));_0x2114ea[_0xd21e('0xa')]('i.createdAt');_0x2114ea[_0xd21e('0xa')]('i.updatedAt');_0x2114ea[_0xd21e('0xa')]('i.closed');_0x2114ea[_0xd21e('0xa')](_0xd21e('0x7d'));_0x2114ea['field'](_0xd21e('0x7e'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x7f'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x80'));_0x2114ea['field'](_0xd21e('0x81'));_0x2114ea['field']('i.disposition');_0x2114ea['field']('i.secondDisposition');_0x2114ea[_0xd21e('0xa')](_0xd21e('0x69'));_0x2114ea[_0xd21e('0xa')]('i.substatus');_0x2114ea['field'](_0xd21e('0x82'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x83'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x84'));_0x2114ea['field'](_0xd21e('0x85'));}else if(_0x55ab7f===_0xd21e('0x2d')){_0x2114ea[_0xd21e('0xa')]('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',_0xd21e('0x86'));}else{_0x2114ea[_0xd21e('0xa')](_0xd21e('0x87'),_0xd21e('0x86'));}if(_0x55ab7f!==_0xd21e('0x2f')){_0x2114ea[_0xd21e('0xa')]('i.*');}_0x2114ea[_0xd21e('0xa')](_0xd21e('0x88'),_0xd21e('0x89'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x8a'),_0xd21e('0x8b'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x8c'),'Contact.email');_0x2114ea['field'](_0xd21e('0x8d'),'Contact.phone');_0x2114ea['field'](_0xd21e('0x8e'),_0xd21e('0x8f'));_0x2114ea[_0xd21e('0xa')]('c.fax',_0xd21e('0x90'));_0x2114ea[_0xd21e('0xa')]('o.fullname',_0xd21e('0x91'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x92'),_0xd21e('0x93'));_0x2114ea[_0xd21e('0xa')](_0xd21e('0x94'),'TagIds');}if(_0x180c11[_0xd21e('0x95')]){_0x2114ea[_0xd21e('0x95')](_0x180c11[_0xd21e('0x95')]);}if(_0x180c11['offset']){_0x2114ea[_0xd21e('0x96')](_0x180c11[_0xd21e('0x96')]);}return db[_0xd21e('0x73')][_0xd21e('0x74')](_0x2114ea[_0xd21e('0x97')](),_0xa3fce);})[_0xd21e('0x60')](function(_0x5efae1){_0x53c078=_0x5efae1;var _0x49235e=getUsersQuery(_0x55ab7f,_0x53c078);return db['sequelize'][_0xd21e('0x74')](_0x49235e['toString'](),_0xa3fce);})[_0xd21e('0x60')](function(_0xf53c5b){_0x155a8b=_[_0xd21e('0x98')](_0xf53c5b,_0x514791);if(_0x55ab7f===_0xd21e('0x2f')){return db[_0xd21e('0x99')][_0xd21e('0x9a')]({'attributes':[_0xd21e('0x9b')],'raw':!![]});}})[_0xd21e('0x60')](function(_0x263eb1){var _0x58c2c6=_0x263eb1?_0x263eb1['enableEmailPreview']:undefined;var _0x1f8c7c=_0x53c078[_0xd21e('0x15')](function(_0x2a8c7f){return updateInteraction(_0x2a8c7f,_0x51d8a6,_0x155a8b,_0x58c2c6);});return Promise[_0xd21e('0x9c')](_0x1f8c7c);});}function countFilteredInteractions(_0x392de3,_0x3e1f81){var _0x361e19=_0x392de3['clone']();_0x361e19['field'](_0xd21e('0x9d'));_0x361e19[_0xd21e('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd21e('0x41'));var _0x15241b=utils[_0xd21e('0x9e')](_0x3e1f81);if(!_[_0xd21e('0x9f')](_0x15241b)){_0x361e19['where'](_0xd21e('0xa0'),_0x15241b);}var _0x4207f1={'type':db[_0xd21e('0x70')][_0xd21e('0x71')]['SELECT'],'raw':!![]};return db['sequelize']['query'](_0x361e19[_0xd21e('0x97')](),_0x4207f1);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 8e9e980..397e991 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda97=['abandoned','total','closed','disposition','UserId','MailMessage','out','then','plainBody','catch','updateInteraction','TagIds','Tags','lodash','map','waiting','talking'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda97,0x12e));var _0x7da9=function(_0x589b6b,_0xfd48a5){_0x589b6b=_0x589b6b-0x0;var _0x1d17b3=_0xda97[_0x589b6b];return _0x1d17b3;};'use strict';var _=require(_0x7da9('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x4f849a,_0x361343){return new Promise(function(_0x17e7be,_0x92152b){try{var _0x29c853=[];if(_0x361343[_0x4f849a]){_0x29c853=_0x361343[_0x4f849a][_0x7da9('0x1')](function(_0x33c07a){return{'id':_0x33c07a['id'],'fullname':_0x33c07a['fullname']};});}return _0x17e7be(_0x29c853);}catch(_0x1fc46c){_0x92152b(_0x1fc46c);}});}function getInteractionTags(_0x1b1434,_0x277e23){var _0x489ad6=[];if(_0x1b1434){_0x1b1434['split'](',')['forEach'](function(_0x5a0752){_0x489ad6['push'](_0x277e23[_0x5a0752]);});}return _0x489ad6;}function updateWaitingCounter(_0x122da0){if(_0x122da0[_0x7da9('0x2')]){_0x122da0[_0x7da9('0x2')]-=0x1;}}function updateInteractionCounters(_0x5e2ccb){_0x5e2ccb[_0x7da9('0x2')]=0x0;_0x5e2ccb[_0x7da9('0x3')]=0x0;_0x5e2ccb['answered']=0x0;_0x5e2ccb['unmanaged']=0x0;_0x5e2ccb[_0x7da9('0x4')]=0x0;_0x5e2ccb[_0x7da9('0x5')]=0x0;if(_0x5e2ccb[_0x7da9('0x6')]){if(_0x5e2ccb[_0x7da9('0x7')]===_0x7da9('0x4')){_0x5e2ccb['abandoned']+=0x1;updateWaitingCounter(_0x5e2ccb);}if(_0x5e2ccb['UserId']){_0x5e2ccb['answered']+=0x1;if(_0x5e2ccb[_0x7da9('0x3')]){_0x5e2ccb[_0x7da9('0x3')]-=0x1;}}else{if(_0x5e2ccb['disposition']){_0x5e2ccb['unmanaged']+=0x1;updateWaitingCounter(_0x5e2ccb);}}}else{if(!_0x5e2ccb[_0x7da9('0x8')]){_0x5e2ccb[_0x7da9('0x2')]+=0x1;}if(_0x5e2ccb[_0x7da9('0x8')]){_0x5e2ccb['talking']+=0x1;updateWaitingCounter(_0x5e2ccb);}}_0x5e2ccb[_0x7da9('0x5')]+=0x1;return _0x5e2ccb;}function getLastMessageText(_0x3a963e){return db[_0x7da9('0x9')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x3a963e['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x7da9('0xa')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})[_0x7da9('0xb')](function(_0x5eca85){if(_0x5eca85&&_0x5eca85[_0x7da9('0xc')]){_0x3a963e['lastMsgText']=_['trimStart'](_0x5eca85[_0x7da9('0xc')]);}return _0x3a963e;})[_0x7da9('0xd')](function(_0x424093){throw _0x424093;});}exports[_0x7da9('0xe')]=function(_0x5285dc,_0x147537,_0xf8ac4,_0x135ba3){return new Promise(function(_0x3f97fb,_0x129af7){return getInteractionUsers(_0x5285dc['id'],_0xf8ac4)['then'](function(_0xc0b437){_0x5285dc['Users']=_0xc0b437;return getInteractionTags(_0x5285dc[_0x7da9('0xf')],_0x147537);})[_0x7da9('0xb')](function(_0x81b2c3){_0x5285dc[_0x7da9('0x10')]=_0x81b2c3;delete _0x5285dc[_0x7da9('0xf')];return updateInteractionCounters(_0x5285dc);})[_0x7da9('0xb')](function(_0x311ed5){if(_0x135ba3){return getLastMessageText(_0x311ed5);}else{return _0x311ed5;}})['then'](function(_0x525f7b){_0x3f97fb(_0x525f7b);})[_0x7da9('0xd')](function(_0x28d298){_0x129af7(_0x28d298);});});}; \ No newline at end of file +var _0x51d4=['../../mysqldb','map','fullname','split','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','findOne','out','plainBody','lastMsgText','trimStart','catch','updateInteraction','then','TagIds','lodash'];(function(_0x307b82,_0x3b0016){var _0x41f399=function(_0x524d0c){while(--_0x524d0c){_0x307b82['push'](_0x307b82['shift']());}};_0x41f399(++_0x3b0016);}(_0x51d4,0x17f));var _0x451d=function(_0xce5ae8,_0xf5b703){_0xce5ae8=_0xce5ae8-0x0;var _0x320398=_0x51d4[_0xce5ae8];return _0x320398;};'use strict';var _=require(_0x451d('0x0'));var db=require(_0x451d('0x1'))['db'];function getInteractionUsers(_0x3f0ed4,_0x39536d){return new Promise(function(_0x16f06f,_0x39c754){try{var _0x3ce393=[];if(_0x39536d[_0x3f0ed4]){_0x3ce393=_0x39536d[_0x3f0ed4][_0x451d('0x2')](function(_0x2cd922){return{'id':_0x2cd922['id'],'fullname':_0x2cd922[_0x451d('0x3')]};});}return _0x16f06f(_0x3ce393);}catch(_0x598532){_0x39c754(_0x598532);}});}function getInteractionTags(_0x60070b,_0x3897b5){var _0x21d553=[];if(_0x60070b){_0x60070b[_0x451d('0x4')](',')['forEach'](function(_0x22983e){_0x21d553[_0x451d('0x5')](_0x3897b5[_0x22983e]);});}return _0x21d553;}function updateWaitingCounter(_0xd3f195){if(_0xd3f195['waiting']){_0xd3f195[_0x451d('0x6')]-=0x1;}}function updateInteractionCounters(_0x4754ea){_0x4754ea[_0x451d('0x6')]=0x0;_0x4754ea[_0x451d('0x7')]=0x0;_0x4754ea[_0x451d('0x8')]=0x0;_0x4754ea[_0x451d('0x9')]=0x0;_0x4754ea[_0x451d('0xa')]=0x0;_0x4754ea[_0x451d('0xb')]=0x0;if(_0x4754ea[_0x451d('0xc')]){if(_0x4754ea[_0x451d('0xd')]===_0x451d('0xa')){_0x4754ea['abandoned']+=0x1;updateWaitingCounter(_0x4754ea);}if(_0x4754ea[_0x451d('0xe')]){_0x4754ea[_0x451d('0x8')]+=0x1;if(_0x4754ea[_0x451d('0x7')]){_0x4754ea[_0x451d('0x7')]-=0x1;}}else{if(_0x4754ea[_0x451d('0xd')]){_0x4754ea['unmanaged']+=0x1;updateWaitingCounter(_0x4754ea);}}}else{if(!_0x4754ea['UserId']){_0x4754ea[_0x451d('0x6')]+=0x1;}if(_0x4754ea[_0x451d('0xe')]){_0x4754ea[_0x451d('0x7')]+=0x1;updateWaitingCounter(_0x4754ea);}}_0x4754ea[_0x451d('0xb')]+=0x1;return _0x4754ea;}function getLastMessageText(_0x1da595){return db['MailMessage'][_0x451d('0xf')]({'where':{'$and':[{'MailInteractionId':_0x1da595['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x451d('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x451d('0x11')],'order':'-id','raw':!![]})['then'](function(_0x5f1287){if(_0x5f1287&&_0x5f1287[_0x451d('0x11')]){_0x1da595[_0x451d('0x12')]=_[_0x451d('0x13')](_0x5f1287['plainBody']);}return _0x1da595;})[_0x451d('0x14')](function(_0x2a63c8){throw _0x2a63c8;});}exports[_0x451d('0x15')]=function(_0x4cf746,_0x412bff,_0x24e2c0,_0x9a6776){return new Promise(function(_0x2e11c3,_0x370557){return getInteractionUsers(_0x4cf746['id'],_0x24e2c0)['then'](function(_0x35854e){_0x4cf746['Users']=_0x35854e;return getInteractionTags(_0x4cf746['TagIds'],_0x412bff);})[_0x451d('0x16')](function(_0x2589f2){_0x4cf746['Tags']=_0x2589f2;delete _0x4cf746[_0x451d('0x17')];return updateInteractionCounters(_0x4cf746);})[_0x451d('0x16')](function(_0x47a3bd){if(_0x9a6776){return getLastMessageText(_0x47a3bd);}else{return _0x47a3bd;}})[_0x451d('0x16')](function(_0x59a7b0){_0x2e11c3(_0x59a7b0);})['catch'](function(_0x784f4a){_0x370557(_0x784f4a);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index e2ac42f..6a0c516 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa42c=['chat','Account','InteractionId','upperFirst','unknown','accounts','_interaction_has_tags','_messages','_interactions','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','null','Interaction','findOne','update','info','catch','exports','lodash','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize'];(function(_0x67cb8b,_0x1b0026){var _0x261615=function(_0x3b8281){while(--_0x3b8281){_0x67cb8b['push'](_0x67cb8b['shift']());}};_0x261615(++_0x1b0026);}(_0xa42c,0x80));var _0xca42=function(_0xad15c7,_0x210cb4){_0xad15c7=_0xad15c7-0x0;var _0x520045=_0xa42c[_0xad15c7];return _0x520045;};'use strict';var _=require(_0xca42('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xca42('0x1'))('openchannel-interactions'),'mail':require(_0xca42('0x1'))('mail-interactions'),'fax':require(_0xca42('0x1'))(_0xca42('0x2')),'sms':require(_0xca42('0x1'))(_0xca42('0x3')),'chat':require(_0xca42('0x1'))(_0xca42('0x4')),'whatsapp':require('../../config/logger')(_0xca42('0x5'))};function getAccountFK(_0x582d00){return _[_0xca42('0x6')](_0x582d00)+(_0x582d00===_0xca42('0x7')?'Website':_0xca42('0x8'))+'Id';}function getInteractionFK(_0x23629a){return _[_0xca42('0x6')](_0x23629a)+_0xca42('0x9');}function getInteractionId(_0x4fbcc8,_0x451e85,_0x2cb524){if(_0x4fbcc8&&_0x4fbcc8[_[_0xca42('0xa')](_0x2cb524)+'InteractionId']){return _0x4fbcc8[_['upperFirst'](_0x2cb524)+_0xca42('0x9')];}else if(_0x4fbcc8&&_0x4fbcc8['id']){return _0x4fbcc8['id'];}else if(_0x451e85&&_0x451e85['id']){return _0x451e85['id'];}else{return _0xca42('0xb');}}function getInteractionsTables(_0x46833c){return{'accounts':_0x46833c+'_'+(_0x46833c==='chat'?'websites':_0xca42('0xc')),'interactions':_0x46833c+'_interactions','interactionsTags':_0x46833c+_0xca42('0xd'),'messages':_0x46833c+_0xca42('0xe'),'userInteractions':'user_has_'+_0x46833c+_0xca42('0xf')};}function getSelectedTags(_0x1f88b4){var _0x76180=[];if(_0x1f88b4){_0x76180=Array[_0xca42('0x10')](_0x1f88b4)?_0x1f88b4:[_0x1f88b4];}return _0x76180;}function log(_0x33bb48,_0xd2f034,_0xa7308f,_0x5864db,_0x4154c9,_0x23a053){loggers[_0x4154c9['toLowerCase']()][_0x33bb48](_0xca42('0x11'),_0x23a053[_0xca42('0x12')](),_0xd2f034?_0xd2f034['id']:null,_0xd2f034?_0xd2f034[_0xca42('0x13')]:null,_0xd2f034?_0xd2f034['role']:null,getInteractionId(_0xa7308f,_0x5864db,_0x4154c9),_0xa7308f?JSON['stringify'](_0xa7308f):_0xca42('0x14'));}function updateUser(_0x58c929,_0x26052e,_0x57494f,_0x2ec10a,_0xb8a69e){db[_[_0xca42('0xa')](_0x2ec10a)+_0xca42('0x15')][_0xca42('0x16')]({'where':{'id':getInteractionId(_0x26052e,_0x57494f,_0x2ec10a)}})['then'](function(_0x35bcef){if(_0x35bcef){return _0x35bcef[_0xca42('0x17')]({'UserId':_0x58c929?_0x58c929['id']:null});}})['then'](function(_0x2b8001){if(_0x2b8001){log(_0xca42('0x18'),_0x58c929,_0x26052e,_0x57494f,_0x2ec10a,_0xb8a69e);}})[_0xca42('0x19')](function(){log('error',_0x58c929,_0x26052e,_0x57494f,_0x2ec10a,_0xb8a69e);});}module[_0xca42('0x1a')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xd4bd=['Interaction','findOne','update','then','info','catch','exports','../../mysqldb','../../config/logger','fax-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','_interaction_has_tags','_messages','user_has_','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','null'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xd4bd,0x1e3));var _0xdd4b=function(_0x48ca9d,_0x141284){_0x48ca9d=_0x48ca9d-0x0;var _0x451301=_0xd4bd[_0x48ca9d];return _0x451301;};'use strict';var _=require('lodash');var db=require(_0xdd4b('0x0'))['db'];var loggers={'openchannel':require(_0xdd4b('0x1'))('openchannel-interactions'),'mail':require(_0xdd4b('0x1'))('mail-interactions'),'fax':require(_0xdd4b('0x1'))(_0xdd4b('0x2')),'sms':require(_0xdd4b('0x1'))('sms-interactions'),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require(_0xdd4b('0x1'))(_0xdd4b('0x3'))};function getAccountFK(_0x559d9b){return _[_0xdd4b('0x4')](_0x559d9b)+(_0x559d9b===_0xdd4b('0x5')?_0xdd4b('0x6'):_0xdd4b('0x7'))+'Id';}function getInteractionFK(_0x3c3e8a){return _[_0xdd4b('0x4')](_0x3c3e8a)+_0xdd4b('0x8');}function getInteractionId(_0x1f29d0,_0x1f3af5,_0x2b2d30){if(_0x1f29d0&&_0x1f29d0[_[_0xdd4b('0x9')](_0x2b2d30)+'InteractionId']){return _0x1f29d0[_[_0xdd4b('0x9')](_0x2b2d30)+_0xdd4b('0x8')];}else if(_0x1f29d0&&_0x1f29d0['id']){return _0x1f29d0['id'];}else if(_0x1f3af5&&_0x1f3af5['id']){return _0x1f3af5['id'];}else{return _0xdd4b('0xa');}}function getInteractionsTables(_0x1cef66){return{'accounts':_0x1cef66+'_'+(_0x1cef66===_0xdd4b('0x5')?'websites':'accounts'),'interactions':_0x1cef66+'_interactions','interactionsTags':_0x1cef66+_0xdd4b('0xb'),'messages':_0x1cef66+_0xdd4b('0xc'),'userInteractions':_0xdd4b('0xd')+_0x1cef66+_0xdd4b('0xe')};}function getSelectedTags(_0x49f9b4){var _0xfb9627=[];if(_0x49f9b4){_0xfb9627=Array[_0xdd4b('0xf')](_0x49f9b4)?_0x49f9b4:[_0x49f9b4];}return _0xfb9627;}function log(_0x4481fe,_0x5e13ba,_0x51fa38,_0x4d7047,_0xf5808d,_0x1aa052){loggers[_0xf5808d[_0xdd4b('0x10')]()][_0x4481fe](_0xdd4b('0x11'),_0x1aa052[_0xdd4b('0x12')](),_0x5e13ba?_0x5e13ba['id']:null,_0x5e13ba?_0x5e13ba['name']:null,_0x5e13ba?_0x5e13ba[_0xdd4b('0x13')]:null,getInteractionId(_0x51fa38,_0x4d7047,_0xf5808d),_0x51fa38?JSON['stringify'](_0x51fa38):_0xdd4b('0x14'));}function updateUser(_0x2d4dfb,_0x30e1a5,_0x443c9d,_0x4d2854,_0x44b6c8){db[_[_0xdd4b('0x9')](_0x4d2854)+_0xdd4b('0x15')][_0xdd4b('0x16')]({'where':{'id':getInteractionId(_0x30e1a5,_0x443c9d,_0x4d2854)}})['then'](function(_0x42cda6){if(_0x42cda6){return _0x42cda6[_0xdd4b('0x17')]({'UserId':_0x2d4dfb?_0x2d4dfb['id']:null});}})[_0xdd4b('0x18')](function(_0x1842b2){if(_0x1842b2){log(_0xdd4b('0x19'),_0x2d4dfb,_0x30e1a5,_0x443c9d,_0x4d2854,_0x44b6c8);}})[_0xdd4b('0x1a')](function(){log('error',_0x2d4dfb,_0x30e1a5,_0x443c9d,_0x4d2854,_0x44b6c8);});}module[_0xdd4b('0x1b')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index e7752ee..44aebea 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x618f=['%s:%s:%s','update','final','utf8','parse','hasOwnProperty','use','License','findOne','then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','user','crypto','composable-middleware','data1','license','split','createDecipher','aes-256-ctr','format'];(function(_0x285800,_0x26765e){var _0x4b809e=function(_0x12c58b){while(--_0x12c58b){_0x285800['push'](_0x285800['shift']());}};_0x4b809e(++_0x26765e);}(_0x618f,0x7c));var _0xf618=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x618f[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0xf618('0x0'));var util=require('util');var compose=require(_0xf618('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x218d46,_0x28875e){if(_0x218d46&&_0x28875e){if(_0x28875e[_0xf618('0x2')]&&_0x28875e['license']){var _0x5c81be=_0x28875e['data1'];var _0x5e8400=_0x28875e[_0xf618('0x3')];var _0x56c962=_0x5c81be[_0xf618('0x4')]('-')[0x4];var _0x189df1=_0x5c81be['split']('-')[0x0];var _0x4870bb=crypto[_0xf618('0x5')](_0xf618('0x6'),util[_0xf618('0x7')](_0xf618('0x8'),_0x56c962,_0x5c81be,_0x189df1));var _0x2c58f3=_0x4870bb[_0xf618('0x9')](_0x5e8400,'base64','utf8');_0x2c58f3+=_0x4870bb[_0xf618('0xa')](_0xf618('0xb'));var _0xade189=JSON[_0xf618('0xc')](_0x2c58f3);return _0xade189[_0xf618('0xd')](_0x218d46)?_0xade189[_0x218d46]:null;}}return null;}function isLimit(_0x249c82,_0x27ac3b,_0x46fab9,_0xe6776f){var _0x48fb1e=_0x27ac3b;return compose()[_0xf618('0xe')](function(_0x101a47,_0x28b78e,_0x369e24){return db[_0xf618('0xf')][_0xf618('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xf618('0x11')](function(_0x4dc300){var _0x3dbcbd=getValueFromLicense(_0x249c82,_0x4dc300);return _0x3dbcbd?_0x3dbcbd:_0x48fb1e;})[_0xf618('0x11')](function(_0x3cc51a){_0x48fb1e=_0x3cc51a;return _0x46fab9['count'](_0xe6776f);})[_0xf618('0x11')](function(_0x1c24e9){if(_0x1c24e9>=_0x48fb1e){return _0x28b78e['status'](0x193)[_0xf618('0x12')]({'message':util[_0xf618('0x7')](_0xf618('0x13'),_0x249c82)});}_0x369e24();})['catch'](function(_0x5b6b8b){_0x369e24(_0x5b6b8b);});});}function isUserLimit(){return isLimit(_0xf618('0x14'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0xf618('0x15')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xf24b=['split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','parse','hasOwnProperty','use','License','findOne','then','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','crypto','util','../../config/environment','data1','license'];(function(_0x1eb5f6,_0x869d5f){var _0x1a6272=function(_0x56b7d9){while(--_0x56b7d9){_0x1eb5f6['push'](_0x1eb5f6['shift']());}};_0x1a6272(++_0x869d5f);}(_0xf24b,0x64));var _0xbf24=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xf24b[_0x32d457];return _0x338386;};'use strict';var crypto=require(_0xbf24('0x0'));var util=require(_0xbf24('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0xbf24('0x2'));function getValueFromLicense(_0x83f0b8,_0x5079ec){if(_0x83f0b8&&_0x5079ec){if(_0x5079ec[_0xbf24('0x3')]&&_0x5079ec[_0xbf24('0x4')]){var _0x3af049=_0x5079ec[_0xbf24('0x3')];var _0xc77019=_0x5079ec[_0xbf24('0x4')];var _0x1775d2=_0x3af049[_0xbf24('0x5')]('-')[0x4];var _0x55ede0=_0x3af049[_0xbf24('0x5')]('-')[0x0];var _0x1089b2=crypto[_0xbf24('0x6')](_0xbf24('0x7'),util[_0xbf24('0x8')](_0xbf24('0x9'),_0x1775d2,_0x3af049,_0x55ede0));var _0x23fc2f=_0x1089b2['update'](_0xc77019,_0xbf24('0xa'),_0xbf24('0xb'));_0x23fc2f+=_0x1089b2['final'](_0xbf24('0xb'));var _0x43ffc4=JSON[_0xbf24('0xc')](_0x23fc2f);return _0x43ffc4[_0xbf24('0xd')](_0x83f0b8)?_0x43ffc4[_0x83f0b8]:null;}}return null;}function isLimit(_0x3c0648,_0x526413,_0x7cd51e,_0x187b9f){var _0xcf39ae=_0x526413;return compose()[_0xbf24('0xe')](function(_0x35a0dc,_0x5a4c4d,_0x4be7ec){return db[_0xbf24('0xf')][_0xbf24('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xbf24('0x11')](function(_0x16d255){var _0x31fe86=getValueFromLicense(_0x3c0648,_0x16d255);return _0x31fe86?_0x31fe86:_0xcf39ae;})[_0xbf24('0x11')](function(_0x204c9f){_0xcf39ae=_0x204c9f;return _0x7cd51e['count'](_0x187b9f);})[_0xbf24('0x11')](function(_0x2ef844){if(_0x2ef844>=_0xcf39ae){return _0x5a4c4d['status'](0x193)['json']({'message':util[_0xbf24('0x8')](_0xbf24('0x12'),_0x3c0648)});}_0x4be7ec();})[_0xbf24('0x13')](function(_0x4a6b1d){_0x4be7ec(_0x4a6b1d);});});}function isUserLimit(){return isLimit(_0xbf24('0x14'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 8859ab5..eff915d 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 _0x04bd=['add','days','format','castTo','CAST(','field','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','utcOffset','hours','minutes','start','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','shift','match','filter','indexOf','map','conditions','buildExpression','DATE','operator','$eq','$between','value','includes','$gt'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x04bd,0xc3));var _0xd04b=function(_0x5a2a15,_0x336ad1){_0x5a2a15=_0x5a2a15-0x0;var _0x3a4062=_0x04bd[_0x5a2a15];return _0x3a4062;};'use strict';var _=require('lodash');var moment=require(_0xd04b('0x0'));exports[_0xd04b('0x1')]=function(_0x16e935){var _0x1e3349={'conditions':[]};_0x1e3349[_0xd04b('0x2')]=_[_0xd04b('0x3')](_0x16e935,_0xd04b('0x4'))?'or':_0xd04b('0x5');var _0x8129d2=_0x16e935[_0xd04b('0x6')](_0xd04b('0x7'),'')[_0xd04b('0x6')](_0xd04b('0x4'),'')['split']('||');for(var _0x20127f=0x0;_0x20127f<_0x8129d2['length'];_0x20127f++){var _0x306a3f=_0x8129d2[_0x20127f][_0xd04b('0x8')](':=');var _0xe662b1=_0x306a3f[0x0];var _0x20c2a4=_0x306a3f[_0xd04b('0x9')](0x1);_0x20c2a4[_0xd04b('0xa')](function(_0xa807e6){var _0x503581=_0xa807e6[_0xd04b('0x8')]('[')[_0xd04b('0xb')]();var _0xc61d=_0xa807e6[_0xd04b('0xc')](/\[(.*?)\]/g);_0xc61d[_0xd04b('0xa')](function(_0x34efdd){var _0x3e2fd5=_0x34efdd[_0xd04b('0x8')]('[')[_0xd04b('0xd')](function(_0x15f0f0){return _0x15f0f0[_0xd04b('0xe')](']')>-0x1;})[_0xd04b('0xf')](function(_0x39d1b9){return _0x39d1b9[_0xd04b('0x8')](']')[0x0];})[0x0];_0x1e3349[_0xd04b('0x10')]['push']({'field':_0xe662b1,'operator':_0x503581,'value':_0x3e2fd5});});});}return _0x1e3349;};exports[_0xd04b('0x11')]=function(_0x442e95,_0x2be7ff,_0x3e712b){var _0x5140f9={};if(_0x2be7ff===_0xd04b('0x12')){if(_0x3e712b[_0xd04b('0x13')]===_0xd04b('0x14')){_0x3e712b['operator']=_0xd04b('0x15');_0x3e712b[_0xd04b('0x16')]+=','+_0x3e712b['value'];}else if(_[_0xd04b('0x17')]([_0xd04b('0x18'),'$lte'],_0x3e712b[_0xd04b('0x13')])){_0x3e712b['value']=moment(_0x3e712b[_0xd04b('0x16')])[_0xd04b('0x19')](0x1,_0xd04b('0x1a'))[_0xd04b('0x1b')]('YYYY-MM-DD');}}if(_0x3e712b[_0xd04b('0x1c')]){_0x2be7ff=_0x3e712b['castTo'];_0x5140f9['text']=_0xd04b('0x1d')+_0x442e95+'.'+_0x3e712b[_0xd04b('0x1e')]+'\x20AS\x20'+_0x3e712b['castTo']+')\x20'+parseOperator(_0x3e712b[_0xd04b('0x13')]);}else{_0x5140f9[_0xd04b('0x1f')]=_0x442e95+'.'+_0x3e712b[_0xd04b('0x1e')]+'\x20'+parseOperator(_0x3e712b['operator']);}if(_[_0xd04b('0x17')]([_0xd04b('0x20'),_0xd04b('0x21')],_0x3e712b[_0xd04b('0x13')]))_0x5140f9['text']='('+_0x5140f9['text']+_0xd04b('0x22')+_0x442e95+'.'+_0x3e712b[_0xd04b('0x1e')]+_0xd04b('0x23');_0x5140f9[_0xd04b('0x16')]=parseValue(_0x2be7ff,_0x3e712b[_0xd04b('0x13')],_0x3e712b['value']);return _0x5140f9;};function parseOperator(_0x3db5ba){var _0x1b21aa;switch(_0x3db5ba){case _0xd04b('0x24'):_0x1b21aa=_0xd04b('0x25');break;case _0xd04b('0x21'):_0x1b21aa=_0xd04b('0x26');break;case'$eq':_0x1b21aa=_0xd04b('0x27');break;case'$ne':_0x1b21aa='<>\x20?';break;case _0xd04b('0x28'):case _0xd04b('0x29'):case _0xd04b('0x2a'):_0x1b21aa=_0xd04b('0x2b');break;case _0xd04b('0x2c'):_0x1b21aa='<\x20?';break;case _0xd04b('0x18'):_0x1b21aa=_0xd04b('0x2d');break;case _0xd04b('0x2e'):_0x1b21aa=_0xd04b('0x2f');break;case _0xd04b('0x30'):_0x1b21aa=_0xd04b('0x31');break;case _0xd04b('0x15'):_0x1b21aa=_0xd04b('0x32');break;}return _0x1b21aa;}function parseValue(_0x5b53b3,_0x8e39ec,_0x51b2f1){var _0x38c31d={'start':undefined,'end':undefined};switch(_0x8e39ec){case _0xd04b('0x24'):case _0xd04b('0x21'):_0x38c31d['start']=_0x51b2f1[_0xd04b('0x8')](',');break;case'$substring':_0x38c31d['start']='%'+_0x51b2f1+'%';break;case'$startsWith':_0x38c31d['start']=_0x51b2f1+'%';break;case _0xd04b('0x2a'):_0x38c31d['start']='%'+_0x51b2f1;break;case _0xd04b('0x15'):var _0x592d29=_0x51b2f1[_0xd04b('0x8')](',');var _0x51b2f1=_0x592d29[_0xd04b('0xb')]();var _0x1e5588=_0x592d29['pop']();if(_0x5b53b3===_0xd04b('0x12')){_0x51b2f1=moment(_0x51b2f1)[_0xd04b('0x33')](0x0,!![])[_0xd04b('0x1b')]();_0x1e5588=moment(_0x1e5588)['utcOffset'](0x0,!![])['add'](0x17,_0xd04b('0x34'))[_0xd04b('0x19')](0x3b,_0xd04b('0x35'))[_0xd04b('0x19')](0x3b,'seconds')[_0xd04b('0x1b')]();}_0x38c31d={'start':_0x51b2f1,'end':_0x1e5588};break;default:_0x38c31d[_0xd04b('0x36')]=_0x51b2f1;break;}return _0x38c31d;} \ No newline at end of file +var _0x08da=['\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','slice','forEach','shift','match','indexOf','map','conditions','push','buildExpression','DATE','$eq','$between','value','includes','operator','add','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$notIn'];(function(_0x30ab8f,_0x43ecb9){var _0x338358=function(_0x44f465){while(--_0x44f465){_0x30ab8f['push'](_0x30ab8f['shift']());}};_0x338358(++_0x43ecb9);}(_0x08da,0xc9));var _0xa08d=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x08da[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xa08d('0x0'));var moment=require(_0xa08d('0x1'));exports[_0xa08d('0x2')]=function(_0x241ffe){var _0x50d51e={'conditions':[]};_0x50d51e[_0xa08d('0x3')]=_[_0xa08d('0x4')](_0x241ffe,_0xa08d('0x5'))?'or':_0xa08d('0x6');var _0x59556f=_0x241ffe[_0xa08d('0x7')](_0xa08d('0x8'),'')[_0xa08d('0x7')](_0xa08d('0x5'),'')['split']('||');for(var _0x6ca568=0x0;_0x6ca568<_0x59556f[_0xa08d('0x9')];_0x6ca568++){var _0x563bf4=_0x59556f[_0x6ca568][_0xa08d('0xa')](':=');var _0x2081d4=_0x563bf4[0x0];var _0x2ccf8d=_0x563bf4[_0xa08d('0xb')](0x1);_0x2ccf8d[_0xa08d('0xc')](function(_0x50f666){var _0x1821e8=_0x50f666['split']('[')[_0xa08d('0xd')]();var _0x14da23=_0x50f666[_0xa08d('0xe')](/\[(.*?)\]/g);_0x14da23[_0xa08d('0xc')](function(_0x2becbe){var _0x3794ec=_0x2becbe['split']('[')['filter'](function(_0x1bfbad){return _0x1bfbad[_0xa08d('0xf')](']')>-0x1;})[_0xa08d('0x10')](function(_0x76514a){return _0x76514a['split'](']')[0x0];})[0x0];_0x50d51e[_0xa08d('0x11')][_0xa08d('0x12')]({'field':_0x2081d4,'operator':_0x1821e8,'value':_0x3794ec});});});}return _0x50d51e;};exports[_0xa08d('0x13')]=function(_0x1ad401,_0x11e491,_0x5383fc){var _0x438300={};if(_0x11e491===_0xa08d('0x14')){if(_0x5383fc['operator']===_0xa08d('0x15')){_0x5383fc['operator']=_0xa08d('0x16');_0x5383fc[_0xa08d('0x17')]+=','+_0x5383fc[_0xa08d('0x17')];}else if(_[_0xa08d('0x18')](['$gt','$lte'],_0x5383fc[_0xa08d('0x19')])){_0x5383fc[_0xa08d('0x17')]=moment(_0x5383fc[_0xa08d('0x17')])[_0xa08d('0x1a')](0x1,_0xa08d('0x1b'))[_0xa08d('0x1c')](_0xa08d('0x1d'));}}if(_0x5383fc[_0xa08d('0x1e')]){_0x11e491=_0x5383fc['castTo'];_0x438300[_0xa08d('0x1f')]='CAST('+_0x1ad401+'.'+_0x5383fc[_0xa08d('0x20')]+_0xa08d('0x21')+_0x5383fc[_0xa08d('0x1e')]+')\x20'+parseOperator(_0x5383fc[_0xa08d('0x19')]);}else{_0x438300[_0xa08d('0x1f')]=_0x1ad401+'.'+_0x5383fc['field']+'\x20'+parseOperator(_0x5383fc['operator']);}if(_[_0xa08d('0x18')](['$ne',_0xa08d('0x22')],_0x5383fc[_0xa08d('0x19')]))_0x438300[_0xa08d('0x1f')]='('+_0x438300[_0xa08d('0x1f')]+_0xa08d('0x23')+_0x1ad401+'.'+_0x5383fc['field']+_0xa08d('0x24');_0x438300[_0xa08d('0x17')]=parseValue(_0x11e491,_0x5383fc[_0xa08d('0x19')],_0x5383fc[_0xa08d('0x17')]);return _0x438300;};function parseOperator(_0x631a67){var _0xdb857b;switch(_0x631a67){case _0xa08d('0x25'):_0xdb857b=_0xa08d('0x26');break;case _0xa08d('0x22'):_0xdb857b=_0xa08d('0x27');break;case'$eq':_0xdb857b=_0xa08d('0x28');break;case _0xa08d('0x29'):_0xdb857b=_0xa08d('0x2a');break;case _0xa08d('0x2b'):case _0xa08d('0x2c'):case _0xa08d('0x2d'):_0xdb857b=_0xa08d('0x2e');break;case _0xa08d('0x2f'):_0xdb857b=_0xa08d('0x30');break;case _0xa08d('0x31'):_0xdb857b=_0xa08d('0x32');break;case'$lte':_0xdb857b='<=\x20?';break;case _0xa08d('0x33'):_0xdb857b=_0xa08d('0x34');break;case'$between':_0xdb857b=_0xa08d('0x35');break;}return _0xdb857b;}function parseValue(_0x451947,_0x5444b9,_0x1bf8e5){var _0x5e1fcb={'start':undefined,'end':undefined};switch(_0x5444b9){case _0xa08d('0x25'):case _0xa08d('0x22'):_0x5e1fcb[_0xa08d('0x36')]=_0x1bf8e5['split'](',');break;case'$substring':_0x5e1fcb[_0xa08d('0x36')]='%'+_0x1bf8e5+'%';break;case _0xa08d('0x2c'):_0x5e1fcb[_0xa08d('0x36')]=_0x1bf8e5+'%';break;case _0xa08d('0x2d'):_0x5e1fcb[_0xa08d('0x36')]='%'+_0x1bf8e5;break;case'$between':var _0x54ef75=_0x1bf8e5[_0xa08d('0xa')](',');var _0x1bf8e5=_0x54ef75[_0xa08d('0xd')]();var _0x37cfe2=_0x54ef75[_0xa08d('0x37')]();if(_0x451947===_0xa08d('0x14')){_0x1bf8e5=moment(_0x1bf8e5)[_0xa08d('0x38')](0x0,!![])[_0xa08d('0x1c')]();_0x37cfe2=moment(_0x37cfe2)['utcOffset'](0x0,!![])[_0xa08d('0x1a')](0x17,_0xa08d('0x39'))[_0xa08d('0x1a')](0x3b,'minutes')['add'](0x3b,_0xa08d('0x3a'))[_0xa08d('0x1c')]();}_0x5e1fcb={'start':_0x1bf8e5,'end':_0x37cfe2};break;default:_0x5e1fcb[_0xa08d('0x36')]=_0x1bf8e5;break;}return _0x5e1fcb;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 0168bde..e07f2b7 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 _0xff00=['indexOf','priority','cast','col','unsigned','substr','DESC','ASC','isObject','isString','unset','hasOwnProperty','omit','^[+]?[0-9]*$','isEmail','match','getFullTextValue','{EXPR}','forEach','push','getOptions','query','map','filters','intersection','attributes','length','nolimit','where','pick','filter','columns','merge','VIRTUAL','lower','options','include','includeAll','lodash','sequelize','moment','../../mysqldb','keys','includes','parse','model','fields','split','isEmpty','forOwn','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','sort'];(function(_0x36d169,_0x1923a7){var _0x4a0215=function(_0x4ae870){while(--_0x4ae870){_0x36d169['push'](_0x36d169['shift']());}};_0x4a0215(++_0x1923a7);}(_0xff00,0x1a6));var _0x0ff0=function(_0x4d868b,_0x12d14f){_0x4d868b=_0x4d868b-0x0;var _0x54e3ab=_0xff00[_0x4d868b];return _0x54e3ab;};'use strict';var _=require(_0x0ff0('0x0'));var sequelize=require(_0x0ff0('0x1'));var moment=require(_0x0ff0('0x2'));var db=require(_0x0ff0('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4d8627){var _0xf46a0a=['ne'];try{var _0x35d4de=JSON['parse'](_0x4d8627);var _0x3376c7=Object[_0x0ff0('0x4')](_0x35d4de)[0x0];return _0xf46a0a[_0x0ff0('0x5')](_0x3376c7);}catch(_0x25bec6){return![];}}function getOperatorValue(_0x2487ba){var _0x4ba249=JSON[_0x0ff0('0x6')](_0x2487ba);var _0x5d5a44=Object['keys'](_0x4ba249)[0x0];var _0x586a6d=_0x4ba249[_0x5d5a44];return{['$'+_0x5d5a44]:_0x586a6d};}function parseIncludeModel(_0x130e24){var _0x513910=JSON['parse'](_0x130e24);return{'model':db[_0x513910[_0x0ff0('0x7')]],'as':_0x513910['alias'],'attributes':_0x513910[_0x0ff0('0x8')],'raw':_0x513910['raw']};}exports[_0x0ff0('0x8')]=function(_0x3a6de6){var _0x32db8f=null;if(_0x3a6de6){_0x32db8f=_0x3a6de6[_0x0ff0('0x9')](',');}return _0x32db8f;};exports['filters']=function(_0x2a03c9,_0x8b27a){var _0x5ee05a={};if(!_[_0x0ff0('0xa')](_0x2a03c9)){_[_0x0ff0('0xb')](_0x2a03c9,function(_0x20a119,_0x2b8e6d){try{if(_0x8b27a){var _0x4dfb7e=_['find'](_0x8b27a,{'name':_0x2b8e6d})||{};if(hasSequelizeOperator(_0x20a119)){_0x5ee05a[_0x2b8e6d]=getOperatorValue(_0x20a119);}else if(_0x4dfb7e['type']===_0x0ff0('0xc')&&_[_0x0ff0('0xd')](_0x20a119)){var _0x58d7e7=JSON[_0x0ff0('0x6')](_0x20a119);var _0x482610={'$gte':moment(moment(_0x58d7e7[_0x0ff0('0xe')])[_0x0ff0('0xf')](_0x0ff0('0x10')))[_0x0ff0('0x11')]()[_0x0ff0('0xf')](),'$lte':moment(moment(_0x58d7e7[_0x0ff0('0x12')])[_0x0ff0('0xf')]('YYYY-MM-DD'))[_0x0ff0('0x11')]()[_0x0ff0('0x13')](0x1,'s')[_0x0ff0('0xf')]()};_0x5ee05a[_0x2b8e6d]=_0x482610;}else if(_0x4dfb7e[_0x0ff0('0x14')]===_0x0ff0('0x15')){_0x5ee05a[_0x2b8e6d]=_0x20a119;}else{_0x5ee05a[_0x2b8e6d]=_[_0x0ff0('0x16')](_0x20a119)?_0x20a119:JSON['parse'](_0x20a119);}}else{_0x5ee05a[_0x2b8e6d]=_[_0x0ff0('0x16')](_0x20a119)?_0x20a119:JSON[_0x0ff0('0x6')](_0x20a119);}}catch(_0x1a066e){_0x5ee05a[_0x2b8e6d]=_0x20a119['split'](',');}});}return _0x5ee05a;};exports[_0x0ff0('0x17')]=function(_0x3fed17){_0x3fed17=parseInt(_0x3fed17,0xa);if(!_0x3fed17||_0x3fed17<0x0){_0x3fed17=LIMIT_VALUE;}return _0x3fed17;};exports[_0x0ff0('0x18')]=function(_0x56631c){_0x56631c=parseInt(_0x56631c,0xa);if(!_0x56631c||_0x56631c<0x0){_0x56631c=0x0;}return _0x56631c;};exports[_0x0ff0('0x19')]=function(_0x3a867c){var _0x1a2ad0,_0xe81b94=null;if(_0x3a867c){_0x1a2ad0=_0x3a867c[_0x0ff0('0x9')](',');_0xe81b94=_['map'](_0x1a2ad0,function(_0x1dceb8){if(_0x1dceb8[_0x0ff0('0x1a')]('-')===0x0){return[_0x1dceb8===_0x0ff0('0x1b')?sequelize[_0x0ff0('0x1c')](sequelize[_0x0ff0('0x1d')](_0x0ff0('0x1b')),_0x0ff0('0x1e')):_0x1dceb8[_0x0ff0('0x1f')](0x1),_0x0ff0('0x20')];}else{return[_0x1dceb8==='priority'?sequelize[_0x0ff0('0x1c')](sequelize[_0x0ff0('0x1d')](_0x0ff0('0x1b')),'unsigned'):_0x1dceb8,_0x0ff0('0x21')];}});}return _0xe81b94;};exports['omit']=function(_0x32c1c5,_0xe41d18){if(_[_0x0ff0('0xa')](_0x32c1c5)){return _0x32c1c5;}if(_['isArray'](_0x32c1c5)){for(var _0x104977=0x0;_0x104977<_0x32c1c5['length'];_0x104977+=0x1){_0x32c1c5[_0x104977]=this['omit'](_0x32c1c5[_0x104977],_0xe41d18);}return _0x32c1c5;}if(!_[_0x0ff0('0x22')](_0x32c1c5)){return _0x32c1c5;}if(_[_0x0ff0('0x23')](_0xe41d18)){_0xe41d18=[_0xe41d18];}if(!_[_0x0ff0('0x16')](_0xe41d18)){return _0x32c1c5;}for(var _0x4acec8=0x0;_0x4acec8<_0xe41d18['length'];_0x4acec8+=0x1){_[_0x0ff0('0x24')](_0x32c1c5,_0xe41d18[_0x4acec8]);}for(var _0x59f9a7 in _0x32c1c5){if(_0x32c1c5[_0x0ff0('0x25')](_0x59f9a7)){_0x32c1c5[_0x59f9a7]=this[_0x0ff0('0x26')](_0x32c1c5[_0x59f9a7],_0xe41d18);}}return _0x32c1c5;};exports['isNumeric']=function(_0x4c300f){return _0x4c300f['match'](RegExp(_0x0ff0('0x27')))?!![]:![];};exports[_0x0ff0('0x28')]=function(_0x55c005){return _0x55c005[_0x0ff0('0x29')](/^\S+@\S+$/)?!![]:![];};exports[_0x0ff0('0x2a')]=function(_0x484b5d,_0x9ed018){var _0x481b00=[];var _0x1c608f=/[ `!@#$%^&*()_\-?~]/;var _0x31a46d=_0x9ed018?'\x22{EXPR}\x22':_0x0ff0('0x2b');_0x484b5d[_0x0ff0('0x9')](/[ ,]+/)[_0x0ff0('0x2c')](function(_0x3f65b6){_0x3f65b6=_0x3f65b6['replace'](/([^:]")"+/g,'$1');_0x3f65b6='+'+_0x3f65b6+'*';var _0x44ef9e=_0x3f65b6[_0x0ff0('0x29')](_0x1c608f);if(_0x44ef9e){_0x3f65b6='\x22'+_0x3f65b6+'\x22';}_0x481b00[_0x0ff0('0x2d')](_0x3f65b6);});_0x31a46d=_0x31a46d['replace']('{EXPR}',_0x481b00['join']('\x20'));return _0x31a46d;};exports[_0x0ff0('0x2e')]=function(_0x4de7d2,_0x3c5fe7,_0x3d402a){var _0x20f937={},_0x3142af={};if(_0x3c5fe7[_0x0ff0('0x2f')]['$id']){_0x3c5fe7[_0x0ff0('0x2f')]['id']=_0x3c5fe7[_0x0ff0('0x2f')]['$id'];delete _0x3c5fe7[_0x0ff0('0x2f')]['$id'];}_0x20f937[_0x0ff0('0x7')]=_[_0x0ff0('0x30')](_0x4de7d2,'name');_0x20f937[_0x0ff0('0x2f')]=_[_0x0ff0('0x4')](_0x3c5fe7['query']);_0x20f937[_0x0ff0('0x31')]=_[_0x0ff0('0x32')](_0x20f937[_0x0ff0('0x7')],_0x20f937['query']);_0x3142af[_0x0ff0('0x33')]=_[_0x0ff0('0x32')](_0x20f937[_0x0ff0('0x7')],this[_0x0ff0('0x8')](_0x3c5fe7['query'][_0x0ff0('0x8')]));_0x3142af[_0x0ff0('0x33')]=_0x3142af[_0x0ff0('0x33')][_0x0ff0('0x34')]?_0x3142af[_0x0ff0('0x33')]:_0x20f937['model'];if(!_0x3c5fe7[_0x0ff0('0x2f')][_0x0ff0('0x25')](_0x0ff0('0x35'))){_0x3142af[_0x0ff0('0x17')]=this[_0x0ff0('0x17')](_0x3c5fe7[_0x0ff0('0x2f')][_0x0ff0('0x17')]);_0x3142af[_0x0ff0('0x18')]=this['offset'](_0x3c5fe7[_0x0ff0('0x2f')][_0x0ff0('0x18')]);}_0x3142af['order']=this['sort'](_0x3c5fe7[_0x0ff0('0x2f')][_0x0ff0('0x19')]);_0x3142af[_0x0ff0('0x36')]=this['filters'](_[_0x0ff0('0x37')](_0x3c5fe7[_0x0ff0('0x2f')],_0x20f937['filters']),_0x4de7d2);if(_0x3c5fe7[_0x0ff0('0x2f')][_0x0ff0('0x38')]){var _0x2b46a3=_0x4de7d2;var _0x1efeee=_0x3c5fe7[_0x0ff0('0x2f')][_0x0ff0('0x38')];if(typeof _0x1efeee==='object'){_0x2b46a3=_[_0x0ff0('0x38')](_0x4de7d2,function(_0x571935){return _[_0x0ff0('0x5')](_0x1efeee[_0x0ff0('0x39')],_0x571935[_0x0ff0('0x14')]);});_0x1efeee=_0x1efeee['value'];}_0x3142af[_0x0ff0('0x36')]=_[_0x0ff0('0x3a')](_0x3142af[_0x0ff0('0x36')],{'$or':_[_0x0ff0('0x30')](_0x2b46a3,function(_0x486800){if(_0x486800['type']!==_0x0ff0('0x3b')){if(_0x3d402a){return sequelize[_0x0ff0('0x36')](sequelize['fn'](_0x0ff0('0x3c'),sequelize[_0x0ff0('0x1d')](_0x486800[_0x0ff0('0x14')])),{'$like':sequelize['fn']('lower','%'+_0x3c5fe7[_0x0ff0('0x2f')]['filter']+'%')});}else{var _0x208645={};_0x208645[_0x486800[_0x0ff0('0x14')]]={'$like':'%'+_0x3c5fe7['query'][_0x0ff0('0x38')]+'%'};return _0x208645;}}})});}_0x3142af=_['merge']({},_0x3142af,_0x3c5fe7[_0x0ff0('0x3d')]);return _0x3142af;};exports[_0x0ff0('0x3e')]=function(_0x148f08){var _0x16e083=[];if(_0x148f08[_0x0ff0('0x3f')]){_0x16e083['push']({'all':!![]});}else if(_0x148f08[_0x0ff0('0x3e')]){if(Array[_0x0ff0('0x16')](_0x148f08['include'])){_0x16e083=Object[_0x0ff0('0x4')](_0x148f08[_0x0ff0('0x3e')])[_0x0ff0('0x30')](function(_0x139a00){return parseIncludeModel(_0x148f08[_0x0ff0('0x3e')][_0x139a00]);});}else{var _0x19df39=parseIncludeModel(_0x148f08[_0x0ff0('0x3e')]);_0x16e083[_0x0ff0('0x2d')](_0x19df39);}}return _0x16e083;}; \ No newline at end of file +var _0xaab2=['includes','columns','where','merge','map','type','VIRTUAL','lower','include','includeAll','sequelize','moment','../../mysqldb','parse','keys','model','alias','fields','filters','isEmpty','forOwn','find','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','split','limit','offset','sort','indexOf','priority','col','unsigned','substr','DESC','cast','omit','length','isString','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','\x22{EXPR}\x22','replace','join','getOptions','query','$id','intersection','attributes','nolimit','pick','filter','object'];(function(_0x4ed949,_0x53954b){var _0x441a62=function(_0x15d6e4){while(--_0x15d6e4){_0x4ed949['push'](_0x4ed949['shift']());}};_0x441a62(++_0x53954b);}(_0xaab2,0xca));var _0x2aab=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xaab2[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var sequelize=require(_0x2aab('0x0'));var moment=require(_0x2aab('0x1'));var db=require(_0x2aab('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x564a5a){var _0x149bb7=['ne'];try{var _0xc770d0=JSON[_0x2aab('0x3')](_0x564a5a);var _0x342fe5=Object[_0x2aab('0x4')](_0xc770d0)[0x0];return _0x149bb7['includes'](_0x342fe5);}catch(_0x1b01e0){return![];}}function getOperatorValue(_0x5b35ec){var _0x3af395=JSON[_0x2aab('0x3')](_0x5b35ec);var _0x4fe8a5=Object[_0x2aab('0x4')](_0x3af395)[0x0];var _0x494216=_0x3af395[_0x4fe8a5];return{['$'+_0x4fe8a5]:_0x494216};}function parseIncludeModel(_0xf6602a){var _0x2bd4e8=JSON[_0x2aab('0x3')](_0xf6602a);return{'model':db[_0x2bd4e8[_0x2aab('0x5')]],'as':_0x2bd4e8[_0x2aab('0x6')],'attributes':_0x2bd4e8[_0x2aab('0x7')],'raw':_0x2bd4e8['raw']};}exports['fields']=function(_0x205778){var _0x762dc5=null;if(_0x205778){_0x762dc5=_0x205778['split'](',');}return _0x762dc5;};exports[_0x2aab('0x8')]=function(_0x14dde1,_0x2a59bf){var _0x4bd48d={};if(!_[_0x2aab('0x9')](_0x14dde1)){_[_0x2aab('0xa')](_0x14dde1,function(_0x32d7ef,_0x355795){try{if(_0x2a59bf){var _0xc03782=_[_0x2aab('0xb')](_0x2a59bf,{'name':_0x355795})||{};if(hasSequelizeOperator(_0x32d7ef)){_0x4bd48d[_0x355795]=getOperatorValue(_0x32d7ef);}else if(_0xc03782['type']==='DATE'&&_[_0x2aab('0xc')](_0x32d7ef)){var _0x4c062d=JSON['parse'](_0x32d7ef);var _0x135345={'$gte':moment(moment(_0x4c062d[_0x2aab('0xd')])[_0x2aab('0xe')](_0x2aab('0xf')))[_0x2aab('0x10')]()[_0x2aab('0xe')](),'$lte':moment(moment(_0x4c062d[_0x2aab('0x11')])[_0x2aab('0xe')]('YYYY-MM-DD'))[_0x2aab('0x10')]()[_0x2aab('0x12')](0x1,'s')[_0x2aab('0xe')]()};_0x4bd48d[_0x355795]=_0x135345;}else if(_0xc03782[_0x2aab('0x13')]===_0x2aab('0x14')){_0x4bd48d[_0x355795]=_0x32d7ef;}else{_0x4bd48d[_0x355795]=_[_0x2aab('0x15')](_0x32d7ef)?_0x32d7ef:JSON[_0x2aab('0x3')](_0x32d7ef);}}else{_0x4bd48d[_0x355795]=_[_0x2aab('0x15')](_0x32d7ef)?_0x32d7ef:JSON[_0x2aab('0x3')](_0x32d7ef);}}catch(_0x35d69e){_0x4bd48d[_0x355795]=_0x32d7ef[_0x2aab('0x16')](',');}});}return _0x4bd48d;};exports[_0x2aab('0x17')]=function(_0x1ec2d8){_0x1ec2d8=parseInt(_0x1ec2d8,0xa);if(!_0x1ec2d8||_0x1ec2d8<0x0){_0x1ec2d8=LIMIT_VALUE;}return _0x1ec2d8;};exports[_0x2aab('0x18')]=function(_0x158859){_0x158859=parseInt(_0x158859,0xa);if(!_0x158859||_0x158859<0x0){_0x158859=0x0;}return _0x158859;};exports[_0x2aab('0x19')]=function(_0x40fb14){var _0x79cbaa,_0x1bb2bb=null;if(_0x40fb14){_0x79cbaa=_0x40fb14[_0x2aab('0x16')](',');_0x1bb2bb=_['map'](_0x79cbaa,function(_0x1b7ee2){if(_0x1b7ee2[_0x2aab('0x1a')]('-')===0x0){return[_0x1b7ee2===_0x2aab('0x1b')?sequelize['cast'](sequelize[_0x2aab('0x1c')](_0x2aab('0x1b')),_0x2aab('0x1d')):_0x1b7ee2[_0x2aab('0x1e')](0x1),_0x2aab('0x1f')];}else{return[_0x1b7ee2==='priority'?sequelize[_0x2aab('0x20')](sequelize[_0x2aab('0x1c')](_0x2aab('0x1b')),_0x2aab('0x1d')):_0x1b7ee2,'ASC'];}});}return _0x1bb2bb;};exports[_0x2aab('0x21')]=function(_0x117bbb,_0x571c6c){if(_[_0x2aab('0x9')](_0x117bbb)){return _0x117bbb;}if(_[_0x2aab('0x15')](_0x117bbb)){for(var _0x86cbd3=0x0;_0x86cbd3<_0x117bbb[_0x2aab('0x22')];_0x86cbd3+=0x1){_0x117bbb[_0x86cbd3]=this['omit'](_0x117bbb[_0x86cbd3],_0x571c6c);}return _0x117bbb;}if(!_['isObject'](_0x117bbb)){return _0x117bbb;}if(_[_0x2aab('0x23')](_0x571c6c)){_0x571c6c=[_0x571c6c];}if(!_[_0x2aab('0x15')](_0x571c6c)){return _0x117bbb;}for(var _0x3e7746=0x0;_0x3e7746<_0x571c6c[_0x2aab('0x22')];_0x3e7746+=0x1){_[_0x2aab('0x24')](_0x117bbb,_0x571c6c[_0x3e7746]);}for(var _0x1a5af5 in _0x117bbb){if(_0x117bbb[_0x2aab('0x25')](_0x1a5af5)){_0x117bbb[_0x1a5af5]=this[_0x2aab('0x21')](_0x117bbb[_0x1a5af5],_0x571c6c);}}return _0x117bbb;};exports[_0x2aab('0x26')]=function(_0x2986b9){return _0x2986b9[_0x2aab('0x27')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x2aab('0x28')]=function(_0x325cb9){return _0x325cb9[_0x2aab('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x2aab('0x29')]=function(_0x576409,_0x325bca){var _0x341936=[];var _0x32acab=/[ `!@#$%^&*()_\-?~]/;var _0x2cddb8=_0x325bca?_0x2aab('0x2a'):'{EXPR}';_0x576409[_0x2aab('0x16')](/[ ,]+/)['forEach'](function(_0x392dcd){_0x392dcd=_0x392dcd[_0x2aab('0x2b')](/([^:]")"+/g,'$1');_0x392dcd='+'+_0x392dcd+'*';var _0x2ea1e3=_0x392dcd[_0x2aab('0x27')](_0x32acab);if(_0x2ea1e3){_0x392dcd='\x22'+_0x392dcd+'\x22';}_0x341936['push'](_0x392dcd);});_0x2cddb8=_0x2cddb8[_0x2aab('0x2b')]('{EXPR}',_0x341936[_0x2aab('0x2c')]('\x20'));return _0x2cddb8;};exports[_0x2aab('0x2d')]=function(_0x2c6a95,_0x1a9273,_0x37d262){var _0x458d86={},_0x23e4a4={};if(_0x1a9273[_0x2aab('0x2e')][_0x2aab('0x2f')]){_0x1a9273[_0x2aab('0x2e')]['id']=_0x1a9273[_0x2aab('0x2e')]['$id'];delete _0x1a9273[_0x2aab('0x2e')][_0x2aab('0x2f')];}_0x458d86['model']=_['map'](_0x2c6a95,_0x2aab('0x13'));_0x458d86[_0x2aab('0x2e')]=_[_0x2aab('0x4')](_0x1a9273['query']);_0x458d86['filters']=_[_0x2aab('0x30')](_0x458d86[_0x2aab('0x5')],_0x458d86[_0x2aab('0x2e')]);_0x23e4a4['attributes']=_['intersection'](_0x458d86['model'],this[_0x2aab('0x7')](_0x1a9273[_0x2aab('0x2e')][_0x2aab('0x7')]));_0x23e4a4[_0x2aab('0x31')]=_0x23e4a4[_0x2aab('0x31')][_0x2aab('0x22')]?_0x23e4a4['attributes']:_0x458d86['model'];if(!_0x1a9273[_0x2aab('0x2e')]['hasOwnProperty'](_0x2aab('0x32'))){_0x23e4a4[_0x2aab('0x17')]=this[_0x2aab('0x17')](_0x1a9273['query'][_0x2aab('0x17')]);_0x23e4a4['offset']=this[_0x2aab('0x18')](_0x1a9273[_0x2aab('0x2e')]['offset']);}_0x23e4a4['order']=this[_0x2aab('0x19')](_0x1a9273[_0x2aab('0x2e')][_0x2aab('0x19')]);_0x23e4a4['where']=this[_0x2aab('0x8')](_[_0x2aab('0x33')](_0x1a9273[_0x2aab('0x2e')],_0x458d86[_0x2aab('0x8')]),_0x2c6a95);if(_0x1a9273[_0x2aab('0x2e')][_0x2aab('0x34')]){var _0x484ee7=_0x2c6a95;var _0xdb9a44=_0x1a9273['query']['filter'];if(typeof _0xdb9a44===_0x2aab('0x35')){_0x484ee7=_[_0x2aab('0x34')](_0x2c6a95,function(_0x5b950e){return _[_0x2aab('0x36')](_0xdb9a44[_0x2aab('0x37')],_0x5b950e[_0x2aab('0x13')]);});_0xdb9a44=_0xdb9a44['value'];}_0x23e4a4[_0x2aab('0x38')]=_[_0x2aab('0x39')](_0x23e4a4[_0x2aab('0x38')],{'$or':_[_0x2aab('0x3a')](_0x484ee7,function(_0x4e00fb){if(_0x4e00fb[_0x2aab('0x3b')]!==_0x2aab('0x3c')){if(_0x37d262){return sequelize[_0x2aab('0x38')](sequelize['fn'](_0x2aab('0x3d'),sequelize[_0x2aab('0x1c')](_0x4e00fb[_0x2aab('0x13')])),{'$like':sequelize['fn'](_0x2aab('0x3d'),'%'+_0x1a9273[_0x2aab('0x2e')][_0x2aab('0x34')]+'%')});}else{var _0x19bb48={};_0x19bb48[_0x4e00fb['name']]={'$like':'%'+_0x1a9273[_0x2aab('0x2e')][_0x2aab('0x34')]+'%'};return _0x19bb48;}}})});}_0x23e4a4=_[_0x2aab('0x39')]({},_0x23e4a4,_0x1a9273['options']);return _0x23e4a4;};exports[_0x2aab('0x3e')]=function(_0x7601fa){var _0x42c40b=[];if(_0x7601fa[_0x2aab('0x3f')]){_0x42c40b['push']({'all':!![]});}else if(_0x7601fa[_0x2aab('0x3e')]){if(Array[_0x2aab('0x15')](_0x7601fa[_0x2aab('0x3e')])){_0x42c40b=Object[_0x2aab('0x4')](_0x7601fa[_0x2aab('0x3e')])['map'](function(_0x51209b){return parseIncludeModel(_0x7601fa[_0x2aab('0x3e')][_0x51209b]);});}else{var _0x2fe0b5=parseIncludeModel(_0x7601fa[_0x2aab('0x3e')]);_0x42c40b['push'](_0x2fe0b5);}}return _0x42c40b;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 55c9729..1d7ac47 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5fd=['routealias','omit','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','voiceStatus','idle','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','*pause','busy','startCase','Queue','findOne','getAgents','all','flatten','map','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','faxPause','find','getSortedAgentsIdsByStatus','split','globalStatus','startsWith','ASC','fullname,internal','fullname','indexOf','validateSortParameter','DESC','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','internal','address','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xf5fd,0xc6));var _0xdf5f=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xf5fd[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0xdf5f('0x0'));var jayson=require(_0xdf5f('0x1'));var db=require(_0xdf5f('0x2'))['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0xdf5f('0x3')][_0xdf5f('0x4')]({'port':0x232c});function isAgentPaused(_0x40f419,_0xa7b384){var _0x52157a=[_0x40f419[_0xdf5f('0x5')],_0x40f419['faxPause'],_0x40f419[_0xdf5f('0x6')],_0x40f419[_0xdf5f('0x7')],_0x40f419[_0xdf5f('0x8')],_0x40f419[_0xdf5f('0x9')],_0x40f419[_0xdf5f('0xa')]];if(!_0xa7b384)return _[_0xdf5f('0xb')](_0x52157a);var _0x40c165=_[_0xdf5f('0xc')](_0x52157a);return _0x40c165[_0xdf5f('0xd')]>0x0&&_0x40c165[_0xdf5f('0xd')]<_0x52157a[_0xdf5f('0xd')]?!![]:![];}function isIdle(_0x8b3f5b){return _0x8b3f5b==='idle'||_0x8b3f5b===_0xdf5f('0xe')||_0x8b3f5b===_0xdf5f('0xf')||_0x8b3f5b===_0xdf5f('0x10')||_[_0xdf5f('0x11')](_0x8b3f5b);}function isAgentIdle(_0x42401d){if(_0x42401d[_0xdf5f('0x12')]!==_0xdf5f('0x13')&&_0x42401d[_0xdf5f('0x9')]){_0x42401d['voiceStatus']=_0xdf5f('0x14');return![];}return _['every']([_0x42401d[_0xdf5f('0x15')],_0x42401d[_0xdf5f('0x16')],_0x42401d[_0xdf5f('0x17')],_0x42401d[_0xdf5f('0x18')],_0x42401d[_0xdf5f('0x19')],_0x42401d[_0xdf5f('0x12')],_0x42401d[_0xdf5f('0x1a')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xdf5f('0x1b')]('Agents',{})['then'](function(_0x3af0dc){if(_0x3af0dc[_0xdf5f('0x1c')]){throw new Error(_0xdf5f('0x1d'));}var _0xefbdf1=_0x3af0dc[_0xdf5f('0x1e')];return routingClient[_0xdf5f('0x1b')](_0xdf5f('0x1f'),{})[_0xdf5f('0x20')](function(_0x4a8b16){if(_0x4a8b16[_0xdf5f('0x1c')]){throw new Error(_0xdf5f('0x21'));}var _0x3abd41=_0x4a8b16[_0xdf5f('0x1e')];return _[_0xdf5f('0x22')]({},_0xefbdf1,_0x3abd41);});})[_0xdf5f('0x23')](function(_0x4a004b){throw _0x4a004b;});}exports[_0xdf5f('0x24')]=getRealtimeAgents;function getAgentStatus(_0xe92b03){var _0x4beac8=_0xdf5f('0xe');if(isAgentPaused(_0xe92b03))_0x4beac8=_0xdf5f('0x14');else if(isAgentPaused(_0xe92b03,!![]))_0x4beac8=_0xdf5f('0x25');else if(isAgentIdle(_0xe92b03))_0x4beac8=_0xdf5f('0x13');else _0x4beac8=_0xdf5f('0x26');return _0x4beac8;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x4ff4b5,_0x49b9b0){var _0x2de526=_['isArray'](_0x4ff4b5)?_0x4ff4b5:[_0x4ff4b5];var _0x45cd44=_[_0xdf5f('0x27')](_0x49b9b0)+_0xdf5f('0x28');var _0x154ad8=_['map'](_0x2de526,function(_0x4e5d86){return db[_0x45cd44][_0xdf5f('0x29')]({'where':{'id':_0x4e5d86}})[_0xdf5f('0x20')](function(_0x1f1456){if(!_0x1f1456)return[];return _0x1f1456[_0xdf5f('0x2a')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xdf5f('0x2b')](_0x154ad8)[_0xdf5f('0x20')](function(_0x231fad){var _0x5a3aad=_(_0x231fad)[_0xdf5f('0x2c')]()[_0xdf5f('0x2d')]('id')[_0xdf5f('0x2e')]()[_0xdf5f('0x2f')]();return _0x5a3aad;});}exports[_0xdf5f('0x30')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x46f827,_0x5e49d5,_0x494fd4){try{if(_0x5e49d5['length']>0x0){_0x46f827=_0x46f827['filter'](function(_0x4a84c5){return _0x5e49d5[_0xdf5f('0x31')](_0x4a84c5['id']);});}var _0x2e5620=_0x46f827['filter'](function(_0x290c81){var _0x3c6f8a=_0xdf5f('0x26');if(isAgentIdle(_0x290c81)){_0x3c6f8a=_0xdf5f('0x13');}return _0x3c6f8a===_0x494fd4;});return _[_0xdf5f('0x2d')](_0x2e5620,'id');}catch(_0x24e60a){throw _0x24e60a;}}exports[_0xdf5f('0x32')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1b1679,_0x5386e0,_0x45ba84){return Promise[_0xdf5f('0x33')]()[_0xdf5f('0x20')](function(){if(_0x5386e0['length']>0x0){_0x1b1679=_0x1b1679[_0xdf5f('0xc')](function(_0x3e16b4){return _0x5386e0['includes'](_0x3e16b4['id']);});}return _0x1b1679;})[_0xdf5f('0x20')](function(){return db[_0xdf5f('0x34')][_0xdf5f('0x35')]({'attributes':['id',_0xdf5f('0x36'),'fullname',_0xdf5f('0x5'),_0xdf5f('0x37'),_0xdf5f('0x6'),_0xdf5f('0x7'),_0xdf5f('0x8'),'voicePause','whatsappPause','pauseType'],'where':{'id':{'$in':_[_0xdf5f('0x2d')](_0x1b1679,'id')}},'raw':!![]});})[_0xdf5f('0x20')](function(_0x27a017){return _0x27a017[_0xdf5f('0x2d')](function(_0x51d4f3){var _0x2c5652=_[_0xdf5f('0x38')](_0x1b1679,['id',_0x51d4f3['id']]);var _0x1ae36a=filterAgentAttributes(_0x2c5652);_[_0xdf5f('0x22')](_0x51d4f3,_0x1ae36a);_0x51d4f3['globalStatus']=getAgentStatus(_0x51d4f3);return _0x51d4f3;});})['then'](function(_0x6f44){var _0x160e2e=sortAgentsByStatus(_0x6f44,_0x45ba84);return _['map'](_0x160e2e,'id');})[_0xdf5f('0x23')](function(_0x4bbe6c){throw _0x4bbe6c;});}exports[_0xdf5f('0x39')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x107145){var _0xa76d17={'fields':[],'order':null};var _0x20b730=_0x107145[_0xdf5f('0x3a')](',');_0xa76d17['fields']=_['filter'](_0x20b730,function(_0x4e14cd){if(!_0x4e14cd[_0xdf5f('0x31')](_0xdf5f('0x3b'))){return!![];}_0xa76d17['order']=_[_0xdf5f('0x3c')](_0x4e14cd,'-')?'DESC':_0xdf5f('0x3d');return![];});return _0xa76d17;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x21343c){if(!_0x21343c){_0x21343c=_0xdf5f('0x3e');}if(_0x21343c[_0xdf5f('0x31')](_0xdf5f('0x3f'))&&!_0x21343c[_0xdf5f('0x31')]('internal')){var _0x2d80a6=_0x21343c['substring'](0x0,_0x21343c[_0xdf5f('0x40')]('fullname'));_0x21343c+=','+_0x2d80a6+'internal';}return _0x21343c;}exports[_0xdf5f('0x41')]=validateSortParameter;function sortAgentsByStatus(_0x54612a,_0x146326){var _0x3e13fa=_0x54612a['sort'](function(_0x42ece5,_0x458c22){if(_0x42ece5[_0xdf5f('0x3b')]===_0x458c22[_0xdf5f('0x3b')]){if(_0x42ece5['globalStatus']===_0xdf5f('0x14')){if(_0x146326===_0xdf5f('0x42')){return(_0x42ece5[_0xdf5f('0x43')]||'')<(_0x458c22[_0xdf5f('0x43')]||'')||_0x42ece5['fullname']['toLowerCase']()>_0x458c22[_0xdf5f('0x3f')][_0xdf5f('0x44')]()?0x1:-0x1;}else{return(_0x42ece5[_0xdf5f('0x43')]||'')<(_0x458c22[_0xdf5f('0x43')]||'')||_0x42ece5['fullname'][_0xdf5f('0x44')]()>_0x458c22[_0xdf5f('0x3f')][_0xdf5f('0x44')]()?-0x1:0x1;}}else{if(_0x146326===_0xdf5f('0x42')){return _0x42ece5[_0xdf5f('0x3f')][_0xdf5f('0x44')]()<_0x458c22['fullname']['toLowerCase']()?0x1:-0x1;}else{return _0x42ece5[_0xdf5f('0x3f')][_0xdf5f('0x44')]()<_0x458c22[_0xdf5f('0x3f')][_0xdf5f('0x44')]()?-0x1:0x1;}}}else{if(_0x146326==='DESC'){return _0x42ece5['globalStatus']<_0x458c22[_0xdf5f('0x3b')]?0x1:-0x1;}else{return _0x42ece5['globalStatus']<_0x458c22[_0xdf5f('0x3b')]?-0x1:0x1;}}});return _0x3e13fa;}exports[_0xdf5f('0x45')]=sortAgentsByStatus;function filterAgentAttributes(_0x574671){var _0x325db9=[_0xdf5f('0x46'),_0xdf5f('0x47'),_0xdf5f('0x48'),_0xdf5f('0x49'),_0xdf5f('0x43'),'lastPauseAt',_0xdf5f('0x4a'),_0xdf5f('0x4b'),'chatPause',_0xdf5f('0x7'),_0xdf5f('0x6'),_0xdf5f('0x8'),_0xdf5f('0xa'),'faxPause','voicePause',_0xdf5f('0x4c'),_0xdf5f('0x4d'),_0xdf5f('0x4e'),'smsCapacity',_0xdf5f('0x4f'),'faxCapacity',_0xdf5f('0x50'),_0xdf5f('0x51'),_0xdf5f('0x52'),_0xdf5f('0x53'),'whatsappCurrentCapacity',_0xdf5f('0x54'),_0xdf5f('0x15'),_0xdf5f('0x18'),_0xdf5f('0x17'),_0xdf5f('0x19'),_0xdf5f('0x1a'),_0xdf5f('0x16'),_0xdf5f('0x12'),'chatStatusTime',_0xdf5f('0x55'),_0xdf5f('0x56'),_0xdf5f('0x57'),_0xdf5f('0x58'),'faxStatusTime','voiceStatusTime',_0xdf5f('0x59'),_0xdf5f('0x5a'),_0xdf5f('0x5b'),_0xdf5f('0x5c'),'phoneBarEnableAutomaticScreenRecording',_0xdf5f('0x5d')];var _0x4f09fa=[_0xdf5f('0x5'),'openchannelPause',_0xdf5f('0x6'),_0xdf5f('0x8'),_0xdf5f('0xa'),_0xdf5f('0x37'),_0xdf5f('0x9'),_0xdf5f('0x47')];var _0x5d3e97=_(_0x574671)[_0xdf5f('0x5e')](_0x4f09fa)[_0xdf5f('0x5f')](_0x325db9)[_0xdf5f('0x2f')]();return _0x5d3e97;}exports[_0xdf5f('0x60')]=filterAgentAttributes; \ No newline at end of file +var _0x95e8=['getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','all','then','flatten','uniq','value','getAgentIdsByQueues','filter','includes','resolve','User','findAll','fullname','pauseType','find','getSortedAgentsIdsByStatus','fields','globalStatus','order','startsWith','ASC','fullname,internal','substring','indexOf','internal','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatus','smsStatus','openchannelStatusTime','mailStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','length','idle','unknown','isNil','voiceStatus','voicePause','chatStatus','faxStatus','mailStatus','whatsappStatus','request','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch'];(function(_0x4257a1,_0x512d35){var _0x263b38=function(_0x895794){while(--_0x895794){_0x4257a1['push'](_0x4257a1['shift']());}};_0x263b38(++_0x512d35);}(_0x95e8,0x157));var _0x895e=function(_0x2a3405,_0x282cdf){_0x2a3405=_0x2a3405-0x0;var _0x467a0e=_0x95e8[_0x2a3405];return _0x467a0e;};'use strict';var _=require(_0x895e('0x0'));var jayson=require(_0x895e('0x1'));var db=require(_0x895e('0x2'))['db'];var amiClient=jayson[_0x895e('0x3')][_0x895e('0x4')]({'port':0x232a});var routingClient=jayson[_0x895e('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x5b1aee,_0x3ce3c6){var _0x9453f=[_0x5b1aee[_0x895e('0x5')],_0x5b1aee[_0x895e('0x6')],_0x5b1aee[_0x895e('0x7')],_0x5b1aee[_0x895e('0x8')],_0x5b1aee[_0x895e('0x9')],_0x5b1aee['voicePause'],_0x5b1aee[_0x895e('0xa')]];if(!_0x3ce3c6)return _[_0x895e('0xb')](_0x9453f);var _0xf7f5bf=_['filter'](_0x9453f);return _0xf7f5bf[_0x895e('0xc')]>0x0&&_0xf7f5bf[_0x895e('0xc')]<_0x9453f[_0x895e('0xc')]?!![]:![];}function isIdle(_0x5d6899){return _0x5d6899===_0x895e('0xd')||_0x5d6899===_0x895e('0xe')||_0x5d6899==='unavailable'||_0x5d6899==='ringing'||_[_0x895e('0xf')](_0x5d6899);}function isAgentIdle(_0x196a74){if(_0x196a74[_0x895e('0x10')]!==_0x895e('0xd')&&_0x196a74[_0x895e('0x11')]){_0x196a74['voiceStatus']='pause';return![];}return _['every']([_0x196a74[_0x895e('0x12')],_0x196a74[_0x895e('0x13')],_0x196a74[_0x895e('0x14')],_0x196a74['openchannelStatus'],_0x196a74['smsStatus'],_0x196a74[_0x895e('0x10')],_0x196a74[_0x895e('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x895e('0x16')]('Agents',{})['then'](function(_0x31387c){if(_0x31387c[_0x895e('0x17')]){throw new Error(_0x895e('0x18'));}var _0x56d647=_0x31387c[_0x895e('0x19')];return routingClient[_0x895e('0x16')]('Agents',{})['then'](function(_0x27613b){if(_0x27613b[_0x895e('0x17')]){throw new Error(_0x895e('0x1a'));}var _0x16093f=_0x27613b[_0x895e('0x19')];return _[_0x895e('0x1b')]({},_0x56d647,_0x16093f);});})[_0x895e('0x1c')](function(_0x1bb36c){throw _0x1bb36c;});}exports[_0x895e('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x56f095){var _0x315434=_0x895e('0xe');if(isAgentPaused(_0x56f095))_0x315434=_0x895e('0x1e');else if(isAgentPaused(_0x56f095,!![]))_0x315434=_0x895e('0x1f');else if(isAgentIdle(_0x56f095))_0x315434=_0x895e('0xd');else _0x315434=_0x895e('0x20');return _0x315434;}exports[_0x895e('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x4c8e23,_0x1e0369){var _0x1bf61f=_[_0x895e('0x22')](_0x4c8e23)?_0x4c8e23:[_0x4c8e23];var _0x16a9f0=_[_0x895e('0x23')](_0x1e0369)+_0x895e('0x24');var _0x17f157=_[_0x895e('0x25')](_0x1bf61f,function(_0x1ec955){return db[_0x16a9f0]['findOne']({'where':{'id':_0x1ec955}})['then'](function(_0x282d77){if(!_0x282d77)return[];return _0x282d77['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x895e('0x26')](_0x17f157)[_0x895e('0x27')](function(_0x513ae2){var _0x3d4540=_(_0x513ae2)[_0x895e('0x28')]()[_0x895e('0x25')]('id')[_0x895e('0x29')]()[_0x895e('0x2a')]();return _0x3d4540;});}exports[_0x895e('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3934c8,_0x1116dd,_0x342c8a){try{if(_0x1116dd[_0x895e('0xc')]>0x0){_0x3934c8=_0x3934c8[_0x895e('0x2c')](function(_0x5da652){return _0x1116dd[_0x895e('0x2d')](_0x5da652['id']);});}var _0x3c4b71=_0x3934c8[_0x895e('0x2c')](function(_0x2e3f99){var _0xafa039=_0x895e('0x20');if(isAgentIdle(_0x2e3f99)){_0xafa039=_0x895e('0xd');}return _0xafa039===_0x342c8a;});return _['map'](_0x3c4b71,'id');}catch(_0x2cfed5){throw _0x2cfed5;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2bdb09,_0x9bcea9,_0x46cfd8){return Promise[_0x895e('0x2e')]()['then'](function(){if(_0x9bcea9[_0x895e('0xc')]>0x0){_0x2bdb09=_0x2bdb09[_0x895e('0x2c')](function(_0x43c56d){return _0x9bcea9[_0x895e('0x2d')](_0x43c56d['id']);});}return _0x2bdb09;})[_0x895e('0x27')](function(){return db[_0x895e('0x2f')][_0x895e('0x30')]({'attributes':['id','name',_0x895e('0x31'),_0x895e('0x5'),'faxPause','mailPause','openchannelPause',_0x895e('0x9'),_0x895e('0x11'),'whatsappPause',_0x895e('0x32')],'where':{'id':{'$in':_[_0x895e('0x25')](_0x2bdb09,'id')}},'raw':!![]});})[_0x895e('0x27')](function(_0x19aedc){return _0x19aedc[_0x895e('0x25')](function(_0x4f5d4a){var _0xb5277=_[_0x895e('0x33')](_0x2bdb09,['id',_0x4f5d4a['id']]);var _0x2e6653=filterAgentAttributes(_0xb5277);_[_0x895e('0x1b')](_0x4f5d4a,_0x2e6653);_0x4f5d4a['globalStatus']=getAgentStatus(_0x4f5d4a);return _0x4f5d4a;});})['then'](function(_0x226f34){var _0x53c309=sortAgentsByStatus(_0x226f34,_0x46cfd8);return _[_0x895e('0x25')](_0x53c309,'id');})[_0x895e('0x1c')](function(_0x3eeae8){throw _0x3eeae8;});}exports[_0x895e('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x31c482){var _0x2591ef={'fields':[],'order':null};var _0x200cae=_0x31c482['split'](',');_0x2591ef[_0x895e('0x35')]=_[_0x895e('0x2c')](_0x200cae,function(_0x3dda43){if(!_0x3dda43[_0x895e('0x2d')](_0x895e('0x36'))){return!![];}_0x2591ef[_0x895e('0x37')]=_[_0x895e('0x38')](_0x3dda43,'-')?'DESC':_0x895e('0x39');return![];});return _0x2591ef;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x56d162){if(!_0x56d162){_0x56d162=_0x895e('0x3a');}if(_0x56d162[_0x895e('0x2d')]('fullname')&&!_0x56d162[_0x895e('0x2d')]('internal')){var _0x43fb31=_0x56d162[_0x895e('0x3b')](0x0,_0x56d162[_0x895e('0x3c')]('fullname'));_0x56d162+=','+_0x43fb31+_0x895e('0x3d');}return _0x56d162;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x52cf15,_0x517106){var _0x583e4b=_0x52cf15[_0x895e('0x3e')](function(_0x1a1eca,_0x51117f){if(_0x1a1eca[_0x895e('0x36')]===_0x51117f[_0x895e('0x36')]){if(_0x1a1eca[_0x895e('0x36')]===_0x895e('0x1e')){if(_0x517106===_0x895e('0x3f')){return(_0x1a1eca['pauseType']||'')<(_0x51117f[_0x895e('0x32')]||'')||_0x1a1eca[_0x895e('0x31')][_0x895e('0x40')]()>_0x51117f[_0x895e('0x31')][_0x895e('0x40')]()?0x1:-0x1;}else{return(_0x1a1eca[_0x895e('0x32')]||'')<(_0x51117f[_0x895e('0x32')]||'')||_0x1a1eca[_0x895e('0x31')][_0x895e('0x40')]()>_0x51117f['fullname'][_0x895e('0x40')]()?-0x1:0x1;}}else{if(_0x517106===_0x895e('0x3f')){return _0x1a1eca['fullname'][_0x895e('0x40')]()<_0x51117f['fullname'][_0x895e('0x40')]()?0x1:-0x1;}else{return _0x1a1eca[_0x895e('0x31')][_0x895e('0x40')]()<_0x51117f[_0x895e('0x31')][_0x895e('0x40')]()?-0x1:0x1;}}}else{if(_0x517106==='DESC'){return _0x1a1eca[_0x895e('0x36')]<_0x51117f[_0x895e('0x36')]?0x1:-0x1;}else{return _0x1a1eca[_0x895e('0x36')]<_0x51117f[_0x895e('0x36')]?-0x1:0x1;}}});return _0x583e4b;}exports[_0x895e('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x2fdb45){var _0x570110=[_0x895e('0x42'),_0x895e('0x43'),_0x895e('0x44'),_0x895e('0x45'),'pauseType',_0x895e('0x45'),_0x895e('0x3d'),_0x895e('0x46'),_0x895e('0x5'),'openchannelPause','mailPause',_0x895e('0x9'),_0x895e('0xa'),_0x895e('0x6'),_0x895e('0x11'),_0x895e('0x47'),'openchannelCapacity',_0x895e('0x48'),_0x895e('0x49'),_0x895e('0x4a'),'faxCapacity',_0x895e('0x4b'),_0x895e('0x4c'),_0x895e('0x4d'),_0x895e('0x4e'),'whatsappCurrentCapacity',_0x895e('0x4f'),'chatStatus',_0x895e('0x50'),_0x895e('0x14'),_0x895e('0x51'),_0x895e('0x15'),_0x895e('0x13'),_0x895e('0x10'),'chatStatusTime',_0x895e('0x52'),_0x895e('0x53'),'smsStatusTime','whatsappStatusTime','faxStatusTime',_0x895e('0x54'),_0x895e('0x55'),_0x895e('0x56'),_0x895e('0x57'),_0x895e('0x58'),_0x895e('0x59'),_0x895e('0x5a')];var _0x386591=[_0x895e('0x5'),_0x895e('0x8'),'mailPause',_0x895e('0x9'),'whatsappPause',_0x895e('0x6'),_0x895e('0x11'),_0x895e('0x43')];var _0x3d2b45=_(_0x2fdb45)[_0x895e('0x5b')](_0x386591)['pick'](_0x570110)[_0x895e('0x2a')]();return _0x3d2b45;}exports[_0x895e('0x5c')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index c7dd842..c5709fc 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c70=['getRealtimeQueues','concat','map','get','loggedInDb','voice','busy','outbound','find','merge','initializeQueues','lodash','jayson/promise','util','http','available','loggedIn','paused','waiting','inUse','notInUse','onHold','ringing','unavailable','pTalking','originated','message','statusMessage','dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','Queues','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result'];(function(_0x4727d4,_0x4bc47b){var _0x3f3a49=function(_0xd00b6e){while(--_0xd00b6e){_0x4727d4['push'](_0x4727d4['shift']());}};_0x3f3a49(++_0x4bc47b);}(_0x3c70,0x9b));var _0x03c7=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x3c70[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x03c7('0x0'));var jayson=require(_0x03c7('0x1'));var util=require(_0x03c7('0x2'));var amiClient=jayson['client'][_0x03c7('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x03c7('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x03c7('0x4'),_0x03c7('0x5'),_0x03c7('0x6'),_0x03c7('0x7')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x03c7('0x8'),'invalid','loggedInDb',_0x03c7('0x9'),_0x03c7('0xa'),_0x03c7('0xb'),'ringInUse','talking',_0x03c7('0xc'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x03c7('0xd'),_0x03c7('0xe'),_0x03c7('0xf'),_0x03c7('0x10'),'dialActive',_0x03c7('0x11'),_0x03c7('0x12'),_0x03c7('0x13'),_0x03c7('0x14'),'erlangCalls',_0x03c7('0x15'),_0x03c7('0x16'),'erlangBusyFactor',_0x03c7('0x17'),'dialPredictiveIntervalMaxThreshold',_0x03c7('0x18'),_0x03c7('0x19'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls',_0x03c7('0x1a'),_0x03c7('0x1b'),_0x03c7('0x1c'),_0x03c7('0x1d')];function getRealtimeQueues(_0x3775b3,_0x48dfda){var _0x1423a5=_0x48dfda==='voice'?amiClient:routingClient;return _0x1423a5[_0x03c7('0x1e')](_[_0x03c7('0x1f')](_0x48dfda)+_0x03c7('0x20'),_0x3775b3)[_0x03c7('0x21')](function(_0x504d43){if(_0x504d43[_0x03c7('0x22')])throw new Error(util['format'](_0x03c7('0x23'),_0x48dfda));return _0x504d43[_0x03c7('0x24')];})['catch'](function(_0x2e442a){throw _0x2e442a;});}exports[_0x03c7('0x25')]=getRealtimeQueues;function initializeQueues(_0x3c2e62,_0xfbd187,_0x33e048,_0x2f58b4){var _0x39f352=DEFAULT_QUEUE_ATTRIBUTES;if(_0x33e048==='voice'){if(_0x2f58b4==='inbound'){_0x39f352=_0x39f352[_0x03c7('0x26')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2f58b4==='outbound'){_0x39f352=_0x39f352['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3c2e62[_0x03c7('0x27')](function(_0x4b022b){var _0xbdd351=_0x4b022b[_0x03c7('0x28')]({'plain':!![]});_0xbdd351[_0x03c7('0x6')]=0x0;_0xbdd351[_0x03c7('0x29')]=0x0;_0xbdd351[_0x03c7('0x5')]=0x0;_0xbdd351[_0x03c7('0x4')]=0x0;_0xbdd351[_0x03c7('0x7')]=0x0;if(_0x33e048===_0x03c7('0x2a')){_0xbdd351['talking']=0x0;_0xbdd351[_0x03c7('0x2b')]=0x0;if(_0x2f58b4===_0x03c7('0x2c')){_0xbdd351[_0x03c7('0xd')]=0x0;_0xbdd351['originated']=0x0;}}var _0x23d737=_[_0x03c7('0x2d')](_0xfbd187,['id',_0xbdd351['id']]);if(_0x23d737){_[_0x03c7('0x2e')](_0xbdd351,_['pick'](_0x23d737,_0x39f352));}return _0xbdd351;});}exports[_0x03c7('0x2f')]=initializeQueues; \ No newline at end of file +var _0x1078=['dialMethod','startPredictive','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','outbound','concat','map','merge','pick','lodash','jayson/promise','util','client','paused','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unknown','pTalking','originated','message','statusMessage'];(function(_0x5194f3,_0x4136a6){var _0x5734a6=function(_0x192704){while(--_0x192704){_0x5194f3['push'](_0x5194f3['shift']());}};_0x5734a6(++_0x4136a6);}(_0x1078,0x1b9));var _0x8107=function(_0x25baf6,_0x35f025){_0x25baf6=_0x25baf6-0x0;var _0x2a2565=_0x1078[_0x25baf6];return _0x2a2565;};'use strict';var _=require(_0x8107('0x0'));var jayson=require(_0x8107('0x1'));var util=require(_0x8107('0x2'));var amiClient=jayson[_0x8107('0x3')]['http']({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available','loggedIn',_0x8107('0x4'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x8107('0x5'),_0x8107('0x6'),_0x8107('0x7'),_0x8107('0x8'),_0x8107('0x9'),_0x8107('0xa'),_0x8107('0xb'),_0x8107('0xc'),_0x8107('0xd'),'unavailable',_0x8107('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8107('0xf'),_0x8107('0x10'),_0x8107('0x11'),_0x8107('0x12'),'dialActive',_0x8107('0x13'),'Trunk',_0x8107('0x14'),'startProgressive','erlangCalls',_0x8107('0x15'),'erlangAbandonmentRate',_0x8107('0x16'),_0x8107('0x17'),_0x8107('0x18'),'dialPredictiveIntervalMinThreshold',_0x8107('0x19'),_0x8107('0x1a'),_0x8107('0x1b'),_0x8107('0x1c'),_0x8107('0x1d'),_0x8107('0x1e'),_0x8107('0x1f')];function getRealtimeQueues(_0x17dd05,_0x5c7573){var _0x59a754=_0x5c7573===_0x8107('0x20')?amiClient:routingClient;return _0x59a754[_0x8107('0x21')](_[_0x8107('0x22')](_0x5c7573)+'Queues',_0x17dd05)[_0x8107('0x23')](function(_0x2447e0){if(_0x2447e0[_0x8107('0x24')])throw new Error(util['format'](_0x8107('0x25'),_0x5c7573));return _0x2447e0[_0x8107('0x26')];})['catch'](function(_0x891896){throw _0x891896;});}exports[_0x8107('0x27')]=getRealtimeQueues;function initializeQueues(_0x3a46b6,_0x2753f0,_0x3853c8,_0x2d0b81){var _0x59733b=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3853c8===_0x8107('0x20')){if(_0x2d0b81===_0x8107('0x28')){_0x59733b=_0x59733b['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2d0b81===_0x8107('0x29')){_0x59733b=_0x59733b[_0x8107('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3a46b6[_0x8107('0x2b')](function(_0x1a680a){var _0x19eb78=_0x1a680a['get']({'plain':!![]});_0x19eb78[_0x8107('0x4')]=0x0;_0x19eb78[_0x8107('0x8')]=0x0;_0x19eb78['loggedIn']=0x0;_0x19eb78['available']=0x0;_0x19eb78['waiting']=0x0;if(_0x3853c8===_0x8107('0x20')){_0x19eb78[_0x8107('0xd')]=0x0;_0x19eb78[_0x8107('0x5')]=0x0;if(_0x2d0b81==='outbound'){_0x19eb78[_0x8107('0xf')]=0x0;_0x19eb78['originated']=0x0;}}var _0x4e59e3=_['find'](_0x2753f0,['id',_0x19eb78['id']]);if(_0x4e59e3){_[_0x8107('0x2c')](_0x19eb78,_[_0x8107('0x2d')](_0x4e59e3,_0x59733b));}return _0x19eb78;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 00dad5b..d416b40 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(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x566a4e,_0xeeb3f6){var _0x36d409=function(_0x25960c){while(--_0x25960c){_0x566a4e['push'](_0x566a4e['shift']());}};_0x36d409(++_0xeeb3f6);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index d7201f8..bf168cb 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 _0x7ee7=['createHash','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','md5','substring','crypto','child_process','execSync','../environment','networkInterfaces','orderBy','keys','family','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','model','join'];(function(_0x2b5b44,_0x17189c){var _0x32cb66=function(_0x4ce183){while(--_0x4ce183){_0x2b5b44['push'](_0x2b5b44['shift']());}};_0x32cb66(++_0x17189c);}(_0x7ee7,0x164));var _0x77ee=function(_0x3d21f6,_0x23db44){_0x3d21f6=_0x3d21f6-0x0;var _0x5d0d66=_0x7ee7[_0x3d21f6];return _0x5d0d66;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x77ee('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0x77ee('0x1'))[_0x77ee('0x2')];var config=require(_0x77ee('0x3'));function getInterfaces(){var _0x4fb78d=[];var _0x296c03=os[_0x77ee('0x4')]();var _0x103691=_[_0x77ee('0x5')](_[_0x77ee('0x6')](_0x296c03));for(var _0x100b92=0x0;_0x100b92<_0x103691['length'];_0x100b92++){var _0x1ed2e0=_0x296c03[_0x103691[_0x100b92]]['filter'](function(_0x40dbbf){return _0x40dbbf[_0x77ee('0x7')]==='IPv4'&&_0x40dbbf[_0x77ee('0x8')]===![];});_0x4fb78d=_0x4fb78d[_0x77ee('0x9')](_0x1ed2e0);}return _0x4fb78d;}function getFirstInterface(){var _0x218637=_[_0x77ee('0xa')](getInterfaces());return{'macAddress':_0x218637&&_0x218637[_0x77ee('0xb')]?_0x218637[_0x77ee('0xb')]:'00:00:00:00:00:00','ipAddress':_0x218637&&_0x218637[_0x77ee('0xc')]?_0x218637['address']:_0x77ee('0xd')};}exports[_0x77ee('0xe')]=getFirstInterface;function getCPUhash(){var _0x522c1a=_[_0x77ee('0x5')](os[_0x77ee('0xf')]()['map'](function(_0x4814ed){return _0x4814ed[_0x77ee('0x10')];}))[_0x77ee('0x11')](':');return crypto[_0x77ee('0x12')]('md5')[_0x77ee('0x13')](_0x522c1a)[_0x77ee('0x14')](_0x77ee('0x15'));}exports[_0x77ee('0x16')]=function(){var _0x212926=os[_0x77ee('0x17')]();var _0x44ee2b=/[0-9a-f-]{36}/;if(config[_0x77ee('0x18')]&&_0x44ee2b[_0x77ee('0x19')](config['licenseToken'])){return config[_0x77ee('0x18')];}else if(_0x212926===_0x77ee('0x1a')){return exec(_0x77ee('0x1b'),{'encoding':_0x77ee('0x1c')})[_0x77ee('0x1d')]('\x0d\x0a','');}else{var _0x50f28e=getFirstInterface();var _0x34e226=getCPUhash();var _0x34f1c2=_0x34e226+'|'+os[_0x77ee('0x1e')]()+'|'+_0x50f28e['macAddress']+'|'+_0x50f28e[_0x77ee('0x1f')];var _0x4d13a3=crypto[_0x77ee('0x12')](_0x77ee('0x20'))[_0x77ee('0x13')](_0x34f1c2)['digest']('hex');return _0x4d13a3[_0x77ee('0x21')](0x0,0x8)+'-'+_0x4d13a3[_0x77ee('0x21')](0x8,0xc)+'-'+_0x4d13a3[_0x77ee('0x21')](0xc,0x10)+'-'+_0x4d13a3[_0x77ee('0x21')](0x10,0x14)+'-'+_0x4d13a3[_0x77ee('0x21')](0x14);}}; \ No newline at end of file +var _0x3928=['ipAddress','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','macAddress'];(function(_0x456418,_0x513607){var _0x32ccd7=function(_0x3c8495){while(--_0x3c8495){_0x456418['push'](_0x456418['shift']());}};_0x32ccd7(++_0x513607);}(_0x3928,0x1d6));var _0x8392=function(_0x4a97b4,_0x486675){_0x4a97b4=_0x4a97b4-0x0;var _0x67c691=_0x3928[_0x4a97b4];return _0x67c691;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x8392('0x0'));var machine=require(_0x8392('0x1'));var exec=require(_0x8392('0x2'))[_0x8392('0x3')];var config=require(_0x8392('0x4'));function getInterfaces(){var _0x1c8845=[];var _0x310b9a=os[_0x8392('0x5')]();var _0x367c9d=_[_0x8392('0x6')](_[_0x8392('0x7')](_0x310b9a));for(var _0x326e89=0x0;_0x326e89<_0x367c9d['length'];_0x326e89++){var _0x342ad5=_0x310b9a[_0x367c9d[_0x326e89]][_0x8392('0x8')](function(_0xa14038){return _0xa14038[_0x8392('0x9')]===_0x8392('0xa')&&_0xa14038[_0x8392('0xb')]===![];});_0x1c8845=_0x1c8845[_0x8392('0xc')](_0x342ad5);}return _0x1c8845;}function getFirstInterface(){var _0x35a711=_['head'](getInterfaces());return{'macAddress':_0x35a711&&_0x35a711[_0x8392('0xd')]?_0x35a711['mac']:_0x8392('0xe'),'ipAddress':_0x35a711&&_0x35a711[_0x8392('0xf')]?_0x35a711[_0x8392('0xf')]:_0x8392('0x10')};}exports[_0x8392('0x11')]=getFirstInterface;function getCPUhash(){var _0x5804ab=_['orderBy'](os[_0x8392('0x12')]()[_0x8392('0x13')](function(_0x4607de){return _0x4607de[_0x8392('0x14')];}))[_0x8392('0x15')](':');return crypto[_0x8392('0x16')](_0x8392('0x17'))[_0x8392('0x18')](_0x5804ab)[_0x8392('0x19')](_0x8392('0x1a'));}exports[_0x8392('0x1b')]=function(){var _0xf01dd7=os['platform']();var _0x9bda16=/[0-9a-f-]{36}/;if(config[_0x8392('0x1c')]&&_0x9bda16[_0x8392('0x1d')](config['licenseToken'])){return config[_0x8392('0x1c')];}else if(_0xf01dd7===_0x8392('0x1e')){return exec(_0x8392('0x1f'),{'encoding':_0x8392('0x20')})['replace']('\x0d\x0a','');}else{var _0x1f44c2=getFirstInterface();var _0xbff0c1=getCPUhash();var _0x487d8c=_0xbff0c1+'|'+os['hostname']()+'|'+_0x1f44c2[_0x8392('0x21')]+'|'+_0x1f44c2[_0x8392('0x22')];var _0x149110=crypto['createHash']('md5')['update'](_0x487d8c)[_0x8392('0x19')](_0x8392('0x1a'));return _0x149110['substring'](0x0,0x8)+'-'+_0x149110[_0x8392('0x23')](0x8,0xc)+'-'+_0x149110['substring'](0xc,0x10)+'-'+_0x149110['substring'](0x10,0x14)+'-'+_0x149110['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 40dbf5a..cab8cc7 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 _0xf1d3=['THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','moment','request-promise','bluebird','version','../../mysqldb','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled'];(function(_0x3e07d2,_0x3b11fb){var _0x458631=function(_0x5d8dd3){while(--_0x5d8dd3){_0x3e07d2['push'](_0x3e07d2['shift']());}};_0x458631(++_0x3b11fb);}(_0xf1d3,0x1d3));var _0x3f1d=function(_0x3903d8,_0x261d5b){_0x3903d8=_0x3903d8-0x0;var _0x3025f7=_0xf1d3[_0x3903d8];return _0x3025f7;};'use strict';var util=require('util');var moment=require(_0x3f1d('0x0'));var rp=require(_0x3f1d('0x1'));var BPromise=require(_0x3f1d('0x2'));var pkginfo=require('pkginfo')(module,_0x3f1d('0x3'));var db=require(_0x3f1d('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x3f1d('0x5'));var logger=require(_0x3f1d('0x6'))('license');var HOST=_0x3f1d('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x15698d){return new BPromise(function(_0x54cae2,_0x1b62df){var _0xfec3ac=util[_0x3f1d('0x8')](_0x3f1d('0x9'),HOST,_0x15698d,module[_0x3f1d('0xa')]['version']);if(oldToken){_0xfec3ac=util[_0x3f1d('0x8')](_0x3f1d('0xb'),HOST,_0x15698d,module[_0x3f1d('0xa')]['version'],oldToken);}var _0x6c081c={'uri':_0xfec3ac,'method':_0x3f1d('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x6c081c)[_0x3f1d('0xd')](function(_0xadf04a){_0x54cae2(_0xadf04a);})[_0x3f1d('0xe')](function(_0x43b70d){_0x1b62df(_0x43b70d);});});}function manageLicense(_0x81461e,_0x1a65ac){var _0x58677f=_0x1a65ac[_0x3f1d('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x58677f[_0x3f1d('0x10')]!==_0x81461e&&!_0x58677f[_0x3f1d('0x11')]){oldToken=_0x58677f[_0x3f1d('0x10')];}httpRequest(_0x81461e)[_0x3f1d('0xd')](function(_0x24171e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x24171e[_0x3f1d('0x12')]){isOldTokenSent=![];if(!_0x58677f['license']&&_0x58677f['license']!=_0x24171e[_0x3f1d('0x13')]||_0x58677f[_0x3f1d('0x13')]&&_0x58677f[_0x3f1d('0x11')]){logger[_0x3f1d('0x14')](_0x3f1d('0x15'));}if(_0x58677f['license']&&!_0x58677f['data2']&&_0x58677f['license']!=_0x24171e[_0x3f1d('0x13')]){logger[_0x3f1d('0x14')](_0x3f1d('0x16'));}if(_0x58677f[_0x3f1d('0x13')]&&!_0x58677f[_0x3f1d('0x11')]&&_0x58677f[_0x3f1d('0x13')]==_0x24171e[_0x3f1d('0x13')]){return _0x1a65ac;}return _0x1a65ac[_0x3f1d('0x17')]({'data1':_0x81461e,'data2':null,'license':_0x24171e['license']});}else{if(_0x24171e['license']||_0x58677f[_0x3f1d('0x13')]){if(!_0x58677f[_0x3f1d('0x11')]){if(_0x58677f['data1']==_0x81461e){GRAY_PERIOD_REASON=_0x3f1d('0x18');logger['info'](_0x3f1d('0x19'));}else{GRAY_PERIOD_REASON=_0x3f1d('0x1a');logger[_0x3f1d('0x14')](_0x3f1d('0x1b'),_0x58677f[_0x3f1d('0x10')],_0x81461e);}logger[_0x3f1d('0x14')](_0x3f1d('0x1c'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x3f1d('0x8')]('YYYY-MM-DD\x20HH:mm'));return _0x1a65ac['update']({'data2':encryptor['encryptString'](moment()[_0x3f1d('0x8')](_0x3f1d('0x1d')))});}else{if(moment()[_0x3f1d('0x1e')](encryptor[_0x3f1d('0x1f')](_0x58677f[_0x3f1d('0x11')]),_0x3f1d('0x20'))>DAYS){logger['info'](_0x3f1d('0x21'),moment()[_0x3f1d('0x8')](_0x3f1d('0x1d')));isOldTokenSent=![];return _0x1a65ac[_0x3f1d('0x17')]({'data1':_0x81461e,'data2':null,'license':null});}}}else{if(_0x58677f[_0x3f1d('0x10')]!=_0x81461e){logger[_0x3f1d('0x14')](_0x3f1d('0x1b'),_0x58677f[_0x3f1d('0x10')],_0x81461e);return _0x1a65ac[_0x3f1d('0x17')]({'data1':_0x81461e,'data2':null,'license':null});}}}return _0x1a65ac;})[_0x3f1d('0xd')](function(_0xcf043d){_0x1a65ac=_0xcf043d;})['catch'](function(_0x1317f7){logger[_0x3f1d('0x22')](_0x1317f7[_0x3f1d('0x23')]);})[_0x3f1d('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0x3f1d('0x25')](),_0x1a65ac);},TIME);});}function defaultLicense(){var _0xb2f7e5=hardware[_0x3f1d('0x25')]();if(_0xb2f7e5){return db[_0x3f1d('0x26')][_0x3f1d('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0xb2f7e5}})['spread'](function(_0x2b144a,_0x349441){logger['info'](_0x3f1d('0x28'),_0xb2f7e5);manageLicense(_0xb2f7e5,_0x2b144a);})[_0x3f1d('0xe')](function(_0x96d4b2){logger[_0x3f1d('0x22')](_0x96d4b2[_0x3f1d('0x23')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x3b60=['finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','days','error'];(function(_0x473ac3,_0xf8066a){var _0x563cfd=function(_0x54b0eb){while(--_0x54b0eb){_0x473ac3['push'](_0x473ac3['shift']());}};_0x563cfd(++_0xf8066a);}(_0x3b60,0xac));var _0x03b6=function(_0x5f1d7f,_0x3ce067){_0x5f1d7f=_0x5f1d7f-0x0;var _0x43dca9=_0x3b60[_0x5f1d7f];return _0x43dca9;};'use strict';var util=require(_0x03b6('0x0'));var moment=require(_0x03b6('0x1'));var rp=require(_0x03b6('0x2'));var BPromise=require(_0x03b6('0x3'));var pkginfo=require(_0x03b6('0x4'))(module,_0x03b6('0x5'));var db=require(_0x03b6('0x6'))['db'];var encryptor=require(_0x03b6('0x7'));var hardware=require(_0x03b6('0x8'));var logger=require(_0x03b6('0x9'))(_0x03b6('0xa'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x318384){return new BPromise(function(_0xf2144,_0x36cb60){var _0x1220d4=util[_0x03b6('0xb')](_0x03b6('0xc'),HOST,_0x318384,module[_0x03b6('0xd')][_0x03b6('0x5')]);if(oldToken){_0x1220d4=util[_0x03b6('0xb')](_0x03b6('0xe'),HOST,_0x318384,module[_0x03b6('0xd')]['version'],oldToken);}var _0x147a24={'uri':_0x1220d4,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x147a24)[_0x03b6('0xf')](function(_0x816151){_0xf2144(_0x816151);})[_0x03b6('0x10')](function(_0x4d0455){_0x36cb60(_0x4d0455);});});}function manageLicense(_0x4a9611,_0x271ff6){var _0x5d6924=_0x271ff6['get']({'plain':!![]});if(!isOldTokenSent&&_0x5d6924[_0x03b6('0x11')]!==_0x4a9611&&!_0x5d6924[_0x03b6('0x12')]){oldToken=_0x5d6924['data1'];}httpRequest(_0x4a9611)[_0x03b6('0xf')](function(_0x5cc52e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5cc52e[_0x03b6('0x13')]){isOldTokenSent=![];if(!_0x5d6924['license']&&_0x5d6924[_0x03b6('0xa')]!=_0x5cc52e[_0x03b6('0xa')]||_0x5d6924['license']&&_0x5d6924['data2']){logger[_0x03b6('0x14')](_0x03b6('0x15'));}if(_0x5d6924[_0x03b6('0xa')]&&!_0x5d6924[_0x03b6('0x12')]&&_0x5d6924[_0x03b6('0xa')]!=_0x5cc52e[_0x03b6('0xa')]){logger[_0x03b6('0x14')](_0x03b6('0x16'));}if(_0x5d6924[_0x03b6('0xa')]&&!_0x5d6924[_0x03b6('0x12')]&&_0x5d6924[_0x03b6('0xa')]==_0x5cc52e[_0x03b6('0xa')]){return _0x271ff6;}return _0x271ff6[_0x03b6('0x17')]({'data1':_0x4a9611,'data2':null,'license':_0x5cc52e['license']});}else{if(_0x5cc52e[_0x03b6('0xa')]||_0x5d6924[_0x03b6('0xa')]){if(!_0x5d6924[_0x03b6('0x12')]){if(_0x5d6924[_0x03b6('0x11')]==_0x4a9611){GRAY_PERIOD_REASON=_0x03b6('0x18');logger[_0x03b6('0x14')](_0x03b6('0x19'));}else{GRAY_PERIOD_REASON=_0x03b6('0x1a');logger[_0x03b6('0x14')](_0x03b6('0x1b'),_0x5d6924[_0x03b6('0x11')],_0x4a9611);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x03b6('0x1c')](),moment()['format'](_0x03b6('0x1d')));return _0x271ff6[_0x03b6('0x17')]({'data2':encryptor[_0x03b6('0x1e')](moment()[_0x03b6('0xb')](_0x03b6('0x1d')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x5d6924['data2']),_0x03b6('0x1f'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x03b6('0xb')](_0x03b6('0x1d')));isOldTokenSent=![];return _0x271ff6['update']({'data1':_0x4a9611,'data2':null,'license':null});}}}else{if(_0x5d6924[_0x03b6('0x11')]!=_0x4a9611){logger[_0x03b6('0x14')](_0x03b6('0x1b'),_0x5d6924[_0x03b6('0x11')],_0x4a9611);return _0x271ff6[_0x03b6('0x17')]({'data1':_0x4a9611,'data2':null,'license':null});}}}return _0x271ff6;})[_0x03b6('0xf')](function(_0x4a6eba){_0x271ff6=_0x4a6eba;})[_0x03b6('0x10')](function(_0x1bcea9){logger[_0x03b6('0x20')](_0x1bcea9['message']);})[_0x03b6('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x03b6('0x22')](),_0x271ff6);},TIME);});}function defaultLicense(){var _0x5acaf8=hardware[_0x03b6('0x22')]();if(_0x5acaf8){return db[_0x03b6('0x23')][_0x03b6('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x5acaf8}})[_0x03b6('0x25')](function(_0xa059b1,_0x2f44a6){logger[_0x03b6('0x14')](_0x03b6('0x26'),_0x5acaf8);manageLicense(_0x5acaf8,_0xa059b1);})[_0x03b6('0x10')](function(_0x1ca286){logger[_0x03b6('0x20')](_0x1ca286[_0x03b6('0x27')]);});}}exports[_0x03b6('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 5bd181b..4e047dd 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 _0x4fe4=['COUNT','sequelize','col','count','user','telephone','users','telephones','forEach','admin','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','then','catch','data1','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','grayReason','uuid','changed','message','User','findAll','role'];(function(_0x1188a1,_0x14de0c){var _0x42389e=function(_0x3bb1f0){while(--_0x3bb1f0){_0x1188a1['push'](_0x1188a1['shift']());}};_0x42389e(++_0x14de0c);}(_0x4fe4,0x11c));var _0x44fe=function(_0x4cb9d5,_0x187d5a){_0x4cb9d5=_0x4cb9d5-0x0;var _0x444523=_0x4fe4[_0x4cb9d5];return _0x444523;};'use strict';var util=require('util');var _=require(_0x44fe('0x0'));var moment=require(_0x44fe('0x1'));var BPromise=require('bluebird');var hardware=require(_0x44fe('0x2'));var encryptor=require(_0x44fe('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x44fe('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x44fe('0x5'),'machineUuid':hardware[_0x44fe('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x44fe('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x44fe('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5216e9){return new BPromise(function(_0x3d4375,_0x5b78ab){return db[_0x44fe('0x8')]['find'](_['defaults'](_0x5216e9,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x39bd30){return checkLicense(_0x39bd30,null);})[_0x44fe('0x9')](function(_0x2eac93){_0x3d4375(_0x2eac93);return;})[_0x44fe('0xa')](function(_0x1fb719){_0x5b78ab(_0x1fb719);});});}function checkLicense(_0x57014a,_0x2aef28){if(!_0x57014a){demoLicense['uuid']=_0x57014a[_0x44fe('0xb')];return demoLicense;}try{var _0x1216fb=_0x2aef28||_0x57014a['license'];if(_['isEmpty'](_0x1216fb)){throw new Error(_0x44fe('0xc'));}var _0x4cb1e3=_0x57014a[_0x44fe('0xb')];var _0x3f57ff=_0x57014a[_0x44fe('0xd')];var _0x2b66a6=_0x4cb1e3[_0x44fe('0xe')]('-')[0x4];var _0x25b160=_0x4cb1e3[_0x44fe('0xe')]('-')[0x0];var _0x4dc775=encryptor[_0x44fe('0xf')](_0x1216fb,util[_0x44fe('0x10')](_0x44fe('0x11'),_0x2b66a6,_0x4cb1e3,_0x25b160));var _0x4cf9b1=JSON[_0x44fe('0x12')](_0x4dc775);_0x4cf9b1[_0x44fe('0x13')]=![];_0x4cf9b1['uuid']=_0x4cb1e3;_0x4cf9b1[_0x44fe('0x14')]=hardware['getUuid']();if(_0x3f57ff){var _0x15bdd0=encryptor[_0x44fe('0xf')](_0x3f57ff);_0x4cf9b1[_0x44fe('0x15')]=_0x15bdd0;_0x4cf9b1[_0x44fe('0x16')]=moment(_0x15bdd0)[_0x44fe('0x17')](0x7,'days')['format']();_0x4cf9b1[_0x44fe('0x18')]=_0x4cf9b1[_0x44fe('0x19')]!=_0x4cf9b1[_0x44fe('0x14')]?_0x44fe('0x1a'):'disabled';}return _0x4cf9b1;}catch(_0xab7563){breakingLicense[_0x44fe('0x19')]=_0x57014a[_0x44fe('0xb')];breakingLicense['message']=_0xab7563[_0x44fe('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x27e739,_0xfb80a6){getLicense()[_0x44fe('0x9')](function(_0x5ccd82){return db[_0x44fe('0x1c')][_0x44fe('0x1d')]({'attributes':[_0x44fe('0x1e'),[db['sequelize']['fn'](_0x44fe('0x1f'),db[_0x44fe('0x20')][_0x44fe('0x21')](_0x44fe('0x1e'))),_0x44fe('0x22')]],'group':_0x44fe('0x1e'),'where':{'role':{'$or':['admin',_0x44fe('0x23'),_0x44fe('0x24')]}},'raw':!![]})[_0x44fe('0x9')](function(_0x44b95f){var _0x236725={'user':_0x5ccd82[_0x44fe('0x25')]||0x0,'telephone':_0x5ccd82[_0x44fe('0x26')]||0x0};_0x44b95f[_0x44fe('0x27')](function(_0x49bc5c){var _0x4c0729=_0x49bc5c[_0x44fe('0x1e')]===_0x44fe('0x28')?_0x44fe('0x23'):_0x49bc5c[_0x44fe('0x1e')];_0x236725[_0x4c0729]-=_0x49bc5c[_0x44fe('0x22')];if(_0x236725[_0x4c0729]<0x0)_0x236725[_0x4c0729]=0x0;});_0x27e739(_0x236725);return;});})[_0x44fe('0xa')](function(_0x3dc911){_0xfb80a6(_0x3dc911);});});}function checkUserLimits(_0x235704){return new BPromise(function(_0x28049e,_0x54c192){getLimits()['then'](function(_0x39a1d9){var _0x1bd444=_['pick'](_[_0x44fe('0x29')](_0x235704,_0x44fe('0x1e')),[_0x44fe('0x28'),_0x44fe('0x23'),_0x44fe('0x24')]);var _0x571ad6=(_0x1bd444['admin']||0x0)+(_0x1bd444[_0x44fe('0x23')]||0x0);var _0x96da3d=_0x1bd444['telephone']||0x0;if(_0x571ad6>_0x39a1d9[_0x44fe('0x23')])return _0x54c192(_0x44fe('0x2a'));if(_0x96da3d>_0x39a1d9[_0x44fe('0x24')])return _0x54c192(_0x44fe('0x2b'));return _0x28049e();})[_0x44fe('0xa')](function(_0x16251f){_0x54c192(_0x16251f);});});}module[_0x44fe('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x8846=['role','user','users','forEach','admin','count','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','parse','uuid','machineUuid','deadline','add','days','grayReason','changed','message','findAll','sequelize','COUNT','col'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8846,0xec));var _0x6884=function(_0x59b475,_0x38e91f){_0x59b475=_0x59b475-0x0;var _0x377cc8=_0x8846[_0x59b475];return _0x377cc8;};'use strict';var util=require(_0x6884('0x0'));var _=require(_0x6884('0x1'));var moment=require(_0x6884('0x2'));var BPromise=require(_0x6884('0x3'));var hardware=require(_0x6884('0x4'));var encryptor=require(_0x6884('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6884('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6884('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6884('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6884('0x8'),'machineUuid':hardware[_0x6884('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x294c17){return new BPromise(function(_0x3b025c,_0x2481e3){return db[_0x6884('0xa')]['find'](_[_0x6884('0xb')](_0x294c17,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0xc8c3d8){return checkLicense(_0xc8c3d8,null);})[_0x6884('0xc')](function(_0x3e4bbe){_0x3b025c(_0x3e4bbe);return;})[_0x6884('0xd')](function(_0x58d158){_0x2481e3(_0x58d158);});});}function checkLicense(_0x1ed89c,_0x1fefd0){if(!_0x1ed89c){demoLicense['uuid']=_0x1ed89c[_0x6884('0xe')];return demoLicense;}try{var _0x5be9aa=_0x1fefd0||_0x1ed89c[_0x6884('0xf')];if(_[_0x6884('0x10')](_0x5be9aa)){throw new Error(_0x6884('0x11'));}var _0x325d4e=_0x1ed89c[_0x6884('0xe')];var _0x59a9ef=_0x1ed89c['data2'];var _0x48050c=_0x325d4e[_0x6884('0x12')]('-')[0x4];var _0x492683=_0x325d4e['split']('-')[0x0];var _0x409a97=encryptor[_0x6884('0x13')](_0x5be9aa,util[_0x6884('0x14')]('%s:%s:%s',_0x48050c,_0x325d4e,_0x492683));var _0x4b21c7=JSON[_0x6884('0x15')](_0x409a97);_0x4b21c7['demo']=![];_0x4b21c7[_0x6884('0x16')]=_0x325d4e;_0x4b21c7[_0x6884('0x17')]=hardware[_0x6884('0x9')]();if(_0x59a9ef){var _0x1999d4=encryptor['decryptString'](_0x59a9ef);_0x4b21c7['gray']=_0x1999d4;_0x4b21c7[_0x6884('0x18')]=moment(_0x1999d4)[_0x6884('0x19')](0x7,_0x6884('0x1a'))['format']();_0x4b21c7[_0x6884('0x1b')]=_0x4b21c7[_0x6884('0x16')]!=_0x4b21c7[_0x6884('0x17')]?_0x6884('0x1c'):'disabled';}return _0x4b21c7;}catch(_0x3179dd){breakingLicense[_0x6884('0x16')]=_0x1ed89c[_0x6884('0xe')];breakingLicense['message']=_0x3179dd[_0x6884('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2b06a9,_0x4a2d65){getLicense()[_0x6884('0xc')](function(_0x45d080){return db['User'][_0x6884('0x1e')]({'attributes':['role',[db[_0x6884('0x1f')]['fn'](_0x6884('0x20'),db[_0x6884('0x1f')][_0x6884('0x21')](_0x6884('0x22'))),'count']],'group':_0x6884('0x22'),'where':{'role':{'$or':['admin',_0x6884('0x23'),'telephone']}},'raw':!![]})[_0x6884('0xc')](function(_0x18fe5e){var _0x370bc8={'user':_0x45d080[_0x6884('0x24')]||0x0,'telephone':_0x45d080['telephones']||0x0};_0x18fe5e[_0x6884('0x25')](function(_0xaaf0fe){var _0x2da727=_0xaaf0fe['role']===_0x6884('0x26')?_0x6884('0x23'):_0xaaf0fe[_0x6884('0x22')];_0x370bc8[_0x2da727]-=_0xaaf0fe[_0x6884('0x27')];if(_0x370bc8[_0x2da727]<0x0)_0x370bc8[_0x2da727]=0x0;});_0x2b06a9(_0x370bc8);return;});})[_0x6884('0xd')](function(_0x245467){_0x4a2d65(_0x245467);});});}function checkUserLimits(_0x4cc925){return new BPromise(function(_0x14f020,_0x438580){getLimits()[_0x6884('0xc')](function(_0x4b2264){var _0x33c305=_[_0x6884('0x28')](_[_0x6884('0x29')](_0x4cc925,_0x6884('0x22')),[_0x6884('0x26'),'user',_0x6884('0x2a')]);var _0x5eaf6e=(_0x33c305[_0x6884('0x26')]||0x0)+(_0x33c305['user']||0x0);var _0x459efc=_0x33c305[_0x6884('0x2a')]||0x0;if(_0x5eaf6e>_0x4b2264[_0x6884('0x23')])return _0x438580(_0x6884('0x2b'));if(_0x459efc>_0x4b2264[_0x6884('0x2a')])return _0x438580(_0x6884('0x2c'));return _0x14f020();})[_0x6884('0xd')](function(_0x172d43){_0x438580(_0x172d43);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index d855185..a6143ac 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 _0x6343=['myappanuglar-secret','app-id'];(function(_0x2abd13,_0x501317){var _0x5ad645=function(_0x55ae11){while(--_0x55ae11){_0x2abd13['push'](_0x2abd13['shift']());}};_0x5ad645(++_0x501317);}(_0x6343,0x168));var _0x3634=function(_0x31d764,_0x3bc721){_0x31d764=_0x31d764-0x0;var _0x4e141c=_0x6343[_0x31d764];return _0x4e141c;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3634('0x0'),'GOOGLE_ID':_0x3634('0x1'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x4991=['secret','exports','myappanuglar-secret'];(function(_0x473658,_0x4683b1){var _0x16ffcb=function(_0x41744d){while(--_0x41744d){_0x473658['push'](_0x473658['shift']());}};_0x16ffcb(++_0x4683b1);}(_0x4991,0xf7));var _0x1499=function(_0x4a3ad6,_0x2debf4){_0x4a3ad6=_0x4a3ad6-0x0;var _0x528bb6=_0x4991[_0x4a3ad6];return _0x528bb6;};'use strict';module[_0x1499('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x1499('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x1499('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index c80eb86..259a3b8 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa3f=['exports','../utils/loggers','fileLogger'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xaa3f,0x14e));var _0xfaa3=function(_0x227dc8,_0x10bbc5){_0x227dc8=_0x227dc8-0x0;var _0x46b2ae=_0xaa3f[_0x227dc8];return _0x46b2ae;};'use strict';var fileLogger=require(_0xfaa3('0x0'))[_0xfaa3('0x1')];module[_0xfaa3('0x2')]=fileLogger; \ No newline at end of file +var _0x4b83=['../utils/loggers'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0x4b83,0x16d));var _0x34b8=function(_0x57ad23,_0xade05){_0x57ad23=_0x57ad23-0x0;var _0x3d6220=_0x4b83[_0x57ad23];return _0x3d6220;};'use strict';var fileLogger=require(_0x34b8('0x0'))['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 4b6999a..388b0fd 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 _0xbcac=['path','../../config/environment','resolve','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/routing/index.js'];(function(_0x39fc29,_0x1d3373){var _0x561aeb=function(_0x505230){while(--_0x505230){_0x39fc29['push'](_0x39fc29['shift']());}};_0x561aeb(++_0x1d3373);}(_0xbcac,0x79));var _0xcbca=function(_0x9b6c93,_0x3fc2c3){_0x9b6c93=_0x9b6c93-0x0;var _0x36d8aa=_0xbcac[_0x9b6c93];return _0x36d8aa;};'use strict';var path=require(_0xcbca('0x0'));var cfg=require(_0xcbca('0x1'));var env={'NODE_PATH':path[_0xcbca('0x2')](path[_0xcbca('0x3')](cfg['root'],'legacy-libs'))};var pm2config={'apps':[{'name':'express','script':path[_0xcbca('0x3')](__dirname,_0xcbca('0x4')),'env':env},{'name':_0xcbca('0x5'),'script':path[_0xcbca('0x3')](__dirname,_0xcbca('0x6')),'env':env},{'name':_0xcbca('0x7'),'script':path[_0xcbca('0x3')](__dirname,_0xcbca('0x8')),'env':env},{'name':_0xcbca('0x9'),'script':path['join'](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path['join'](__dirname,_0xcbca('0xa')),'env':env},{'name':'xdr','script':path['join'](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x82db=['join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','path','../../config/environment','resolve'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x82db,0x14f));var _0xb82d=function(_0x15aeef,_0xacd6a8){_0x15aeef=_0x15aeef-0x0;var _0x3d0c1b=_0x82db[_0x15aeef];return _0x3d0c1b;};'use strict';var path=require(_0xb82d('0x0'));var cfg=require(_0xb82d('0x1'));var env={'NODE_PATH':path[_0xb82d('0x2')](path[_0xb82d('0x3')](cfg[_0xb82d('0x4')],_0xb82d('0x5')))};var pm2config={'apps':[{'name':_0xb82d('0x6'),'script':path[_0xb82d('0x3')](__dirname,_0xb82d('0x7')),'env':env},{'name':_0xb82d('0x8'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path['join'](__dirname,_0xb82d('0x9')),'env':env},{'name':'email','script':path['join'](__dirname,_0xb82d('0xa')),'env':env},{'name':_0xb82d('0xb'),'script':path[_0xb82d('0x3')](__dirname,_0xb82d('0xc')),'env':env},{'name':'xdr','script':path[_0xb82d('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index efc1107..3834512 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 _0x0220=['bluebird','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','pm2'];(function(_0x17fea7,_0x2743c0){var _0x14a1f6=function(_0x38d147){while(--_0x38d147){_0x17fea7['push'](_0x17fea7['shift']());}};_0x14a1f6(++_0x2743c0);}(_0x0220,0x11d));var _0x0022=function(_0x59ecf9,_0x9a29d){_0x59ecf9=_0x59ecf9-0x0;var _0x3c68c1=_0x0220[_0x59ecf9];return _0x3c68c1;};'use strict';var pm2=require(_0x0022('0x0'));var BPromise=require(_0x0022('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x5423dc,_0x2d5936){return pm2[_0x0022('0x2')](function(_0x1bf19a){if(_0x1bf19a){return _0x2d5936(_0x1bf19a);}return _0x5423dc(_0x0022('0x3'));});});};exports[_0x0022('0x4')]=function(_0x5477e1){return connect()[_0x0022('0x5')](function(){return new BPromise(function(_0x20a1a2,_0x406862){return pm2[_0x0022('0x4')](_0x5477e1,function(_0x238034,_0x5c957a){if(_0x238034){return _0x406862(_0x238034);}pm2[_0x0022('0x6')]();return _0x20a1a2(_0x5c957a);});});});};exports[_0x0022('0x7')]=function(_0x4b34e9){return connect()[_0x0022('0x5')](function(){return new BPromise(function(_0x2b21d5,_0x362ac8){return pm2[_0x0022('0x7')](_0x4b34e9,function(_0x5b1d02,_0x1e7ccf){if(_0x5b1d02){return _0x362ac8(_0x5b1d02);}pm2[_0x0022('0x6')]();return _0x2b21d5(_0x1e7ccf);});});});};exports['restart']=function(_0x1baa6f){return connect()[_0x0022('0x5')](function(){return new BPromise(function(_0x77261a,_0x526c68){return pm2[_0x0022('0x8')](_0x1baa6f,function(_0x3ee27f,_0x37fac9){if(_0x3ee27f){return _0x526c68(_0x3ee27f);}pm2['disconnect']();return _0x77261a(_0x37fac9);});});});};exports['list']=function(){return connect()[_0x0022('0x5')](function(){return new BPromise(function(_0x4ef8fb,_0x2886a4){return pm2[_0x0022('0x9')](function(_0x1612b7,_0x3f3096){if(_0x1612b7){return _0x2886a4(_0x1612b7);}pm2['disconnect']();return _0x4ef8fb(_0x3f3096);});});});};exports[_0x0022('0xa')]=function(_0x1f69b3){return connect()[_0x0022('0x5')](function(){return new BPromise(function(_0x48403f,_0xffe9b8){return pm2['describe'](_0x1f69b3,function(_0xc9053f,_0x207388){if(_0xc9053f){return _0xffe9b8(_0xc9053f);}pm2[_0x0022('0x6')]();return _0x48403f(_0x207388);});});});};exports[_0x0022('0xb')]=function(_0x3a9a4b){return connect()[_0x0022('0x5')](function(){return new BPromise(function(_0xc0abe5,_0x26f360){return pm2[_0x0022('0xb')](_0x3a9a4b,function(_0x16678c,_0xbb55fa){if(_0x16678c){return _0x26f360(_0x16678c);}pm2[_0x0022('0x6')]();return _0xc0abe5(_0xbb55fa);});});});};exports[_0x0022('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3c5098,_0x596daa){return pm2['dump'](function(_0x48d47d){if(_0x48d47d){return _0x596daa(_0x48d47d);}return _0x3c5098('saved');});});});}; \ No newline at end of file +var _0xfde5=['disconnect','restart','list','describe','delete','dump','pm2','bluebird','./config','connect','connected','start','then','stop'];(function(_0x22639a,_0x50a9e0){var _0x1b93ae=function(_0x2f0302){while(--_0x2f0302){_0x22639a['push'](_0x22639a['shift']());}};_0x1b93ae(++_0x50a9e0);}(_0xfde5,0x110));var _0x5fde=function(_0x63c0d3,_0x11e125){_0x63c0d3=_0x63c0d3-0x0;var _0x1bc8b7=_0xfde5[_0x63c0d3];return _0x1bc8b7;};'use strict';var pm2=require(_0x5fde('0x0'));var BPromise=require(_0x5fde('0x1'));var config=require(_0x5fde('0x2'));function connect(){return new BPromise(function(_0x192d6e,_0x469bbf){return pm2[_0x5fde('0x3')](function(_0x44ab4f){if(_0x44ab4f){return _0x469bbf(_0x44ab4f);}return _0x192d6e(_0x5fde('0x4'));});});};exports[_0x5fde('0x5')]=function(_0x583779){return connect()[_0x5fde('0x6')](function(){return new BPromise(function(_0x34b277,_0x3bb2a4){return pm2[_0x5fde('0x5')](_0x583779,function(_0x1efb21,_0x1c777a){if(_0x1efb21){return _0x3bb2a4(_0x1efb21);}pm2['disconnect']();return _0x34b277(_0x1c777a);});});});};exports['stop']=function(_0x46d9bc){return connect()[_0x5fde('0x6')](function(){return new BPromise(function(_0xee3be4,_0x49a460){return pm2[_0x5fde('0x7')](_0x46d9bc,function(_0x4bc3cc,_0x55b8cf){if(_0x4bc3cc){return _0x49a460(_0x4bc3cc);}pm2[_0x5fde('0x8')]();return _0xee3be4(_0x55b8cf);});});});};exports[_0x5fde('0x9')]=function(_0x4f36e6){return connect()[_0x5fde('0x6')](function(){return new BPromise(function(_0x29a07e,_0x436e90){return pm2[_0x5fde('0x9')](_0x4f36e6,function(_0x7ba7ab,_0x853f8a){if(_0x7ba7ab){return _0x436e90(_0x7ba7ab);}pm2[_0x5fde('0x8')]();return _0x29a07e(_0x853f8a);});});});};exports[_0x5fde('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2f33d1,_0x276834){return pm2[_0x5fde('0xa')](function(_0x38862a,_0x7f1a6){if(_0x38862a){return _0x276834(_0x38862a);}pm2[_0x5fde('0x8')]();return _0x2f33d1(_0x7f1a6);});});});};exports[_0x5fde('0xb')]=function(_0x2121c0){return connect()['then'](function(){return new BPromise(function(_0x6e2ba6,_0x5e238f){return pm2[_0x5fde('0xb')](_0x2121c0,function(_0x54f8b7,_0x2d825c){if(_0x54f8b7){return _0x5e238f(_0x54f8b7);}pm2[_0x5fde('0x8')]();return _0x6e2ba6(_0x2d825c);});});});};exports['delete']=function(_0x3a4e36){return connect()['then'](function(){return new BPromise(function(_0x5c4038,_0xe35f23){return pm2[_0x5fde('0xc')](_0x3a4e36,function(_0x193b33,_0x43f8be){if(_0x193b33){return _0xe35f23(_0x193b33);}pm2[_0x5fde('0x8')]();return _0x5c4038(_0x43f8be);});});});};exports[_0x5fde('0xd')]=function(){return connect()[_0x5fde('0x6')](function(){return new BPromise(function(_0xfe5f1e,_0x4a6880){return pm2[_0x5fde('0xd')](function(_0x320d8e){if(_0x320d8e){return _0x4a6880(_0x320d8e);}return _0xfe5f1e('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index d0b232a..33e6dad 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 _0xf84e=['info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','inspect','start','moment','ioredis','util','../../mysqldb','defaults','socket.io-emitter','redis','Setting','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length'];(function(_0x46be70,_0x47b6eb){var _0x570809=function(_0x45e4b4){while(--_0x45e4b4){_0x46be70['push'](_0x46be70['shift']());}};_0x570809(++_0x47b6eb);}(_0xf84e,0x140));var _0xef84=function(_0xceea39,_0x2e07e7){_0xceea39=_0xceea39-0x0;var _0x11b02e=_0xf84e[_0xceea39];return _0x11b02e;};'use strict';var _=require('lodash');var moment=require(_0xef84('0x0'));var Redis=require(_0xef84('0x1'));var util=require(_0xef84('0x2'));var config=require('../../config/environment');var db=require(_0xef84('0x3'))['db'];var logger=require('../logger')('schedule');config['redis']=_[_0xef84('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xef84('0x5'))(new Redis(config[_0xef84('0x6')]));function closeInteractions(){var _0x29c3d9=0x0;var _0x2a9058=[];return db[_0xef84('0x7')]['find']({'raw':!![],'attributes':['id',_0xef84('0x8')],'where':{'id':0x1}})[_0xef84('0x9')](function(_0x2718ac){_0x29c3d9=_0x2718ac[_0xef84('0x8')];if(_0x29c3d9){return db[_0xef84('0xa')][_0xef84('0xb')]({'raw':!![],'attributes':['id',_0xef84('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xef84('0xd')](_0x2718ac['chatTimeout'],_0xef84('0xe'))}}});}else{return[];}})[_0xef84('0x9')](function(_0x3f5104){if(_0x3f5104&&_0x3f5104[_0xef84('0xf')]){_0x2a9058=_['map'](_0x3f5104||[],'id');logger[_0xef84('0x10')](_0xef84('0x11'),_0x2a9058[_0xef84('0x12')]());return db[_0xef84('0xa')][_0xef84('0x13')]({'closeReason':_0xef84('0x14'),'disposition':_0xef84('0x15'),'closed':!![],'closedAt':moment()[_0xef84('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2a9058}});}})[_0xef84('0x9')](function(){if(_0x2a9058&&_0x2a9058['length']){logger['info'](_0xef84('0x17'),_0x2a9058[_0xef84('0x12')]());for(var _0x4af1ad=0x0;_0x4af1ad<_0x2a9058[_0xef84('0xf')];_0x4af1ad++){io[_0xef84('0x18')](_0xef84('0x19'),{'id':_0x2a9058[_0x4af1ad],'closed':!![]});}}})['catch'](function(_0x2e778a){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x2e778a?util[_0xef84('0x1a')](_0x2e778a,{'showHidden':![],'depth':null}):'');});}exports[_0xef84('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x7107=['redis','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','inspect','start','moment','util','../../config/environment','../logger','schedule'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x7107,0x96));var _0x7710=function(_0x368b3a,_0x49ecb6){_0x368b3a=_0x368b3a-0x0;var _0x12deda=_0x7107[_0x368b3a];return _0x12deda;};'use strict';var _=require('lodash');var moment=require(_0x7710('0x0'));var Redis=require('ioredis');var util=require(_0x7710('0x1'));var config=require(_0x7710('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x7710('0x3'))(_0x7710('0x4'));config[_0x7710('0x5')]=_['defaults'](config['redis'],{'host':_0x7710('0x6'),'port':0x18eb});var io=require(_0x7710('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x269111=0x0;var _0x46e19b=[];return db['Setting'][_0x7710('0x8')]({'raw':!![],'attributes':['id',_0x7710('0x9')],'where':{'id':0x1}})[_0x7710('0xa')](function(_0x31f92e){_0x269111=_0x31f92e['chatTimeout'];if(_0x269111){return db[_0x7710('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x7710('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7710('0xd')](_0x31f92e[_0x7710('0x9')],_0x7710('0xe'))}}});}else{return[];}})[_0x7710('0xa')](function(_0x49be5d){if(_0x49be5d&&_0x49be5d[_0x7710('0xf')]){_0x46e19b=_[_0x7710('0x10')](_0x49be5d||[],'id');logger[_0x7710('0x11')](_0x7710('0x12'),_0x46e19b[_0x7710('0x13')]());return db['ChatInteraction'][_0x7710('0x14')]({'closeReason':_0x7710('0x15'),'disposition':_0x7710('0x16'),'closed':!![],'closedAt':moment()[_0x7710('0x17')](_0x7710('0x18'))},{'where':{'id':_0x46e19b}});}})[_0x7710('0xa')](function(){if(_0x46e19b&&_0x46e19b[_0x7710('0xf')]){logger['info'](_0x7710('0x19'),_0x46e19b[_0x7710('0x13')]());for(var _0x2800f2=0x0;_0x2800f2<_0x46e19b[_0x7710('0xf')];_0x2800f2++){io[_0x7710('0x1a')](_0x7710('0x1b'),{'id':_0x46e19b[_0x2800f2],'closed':!![]});}}})['catch'](function(_0x40c32e){logger[_0x7710('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x40c32e?util[_0x7710('0x1d')](_0x40c32e,{'showHidden':![],'depth':null}):'');});}exports[_0x7710('0x1e')]=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 c08571b..731c969 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 _0xc070=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0xc070,0x18f));var _0x0c07=function(_0x59d96b,_0x450a67){_0x59d96b=_0x59d96b-0x0;var _0x1e22b5=_0xc070[_0x59d96b];return _0x1e22b5;};'use strict';function start(){var _0x514f03=require(_0x0c07('0x0'));return _0x514f03['startAllRefreshIntervals']();}module[_0x0c07('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x1fe5=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x1fe5,0x183));var _0x51fe=function(_0x35563c,_0x1393e9){_0x35563c=_0x35563c-0x0;var _0x2a763c=_0x1fe5[_0x35563c];return _0x2a763c;};'use strict';function start(){var _0xcf7811=require(_0x51fe('0x0'));return _0xcf7811[_0x51fe('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 3a49928..a630d8f 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 _0xacd1=['my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','exists','stop\x20cron','update\x20cron','run','path','lodash','cron-job-manager','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','extname','zip','existsSync','status','Sent','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','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','error','error\x20mail','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','then','CustomReportId','runReport','Schedule','findAll','CloudProvider','keys','jobs','map','toString','difference','intersection','length','stop','deleteJob','delete\x20cron','index'];(function(_0x57684a,_0x514ea0){var _0x51a36e=function(_0x25b8e5){while(--_0x25b8e5){_0x57684a['push'](_0x57684a['shift']());}};_0x51a36e(++_0x514ea0);}(_0xacd1,0xff));var _0x1acd=function(_0x3d3a19,_0x595596){_0x3d3a19=_0x3d3a19-0x0;var _0x4e5e65=_0xacd1[_0x3d3a19];return _0x4e5e65;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x1acd('0x0'));var _=require(_0x1acd('0x1'));var moment=require('moment');var CronJobManager=require(_0x1acd('0x2'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1acd('0x3'))(_0x1acd('0x4'));var db=require(_0x1acd('0x5'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x1acd('0x6'));var client=jayson[_0x1acd('0x7')][_0x1acd('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x14beee,_0xca8468){return function(){logger[_0x1acd('0x9')](_0x1acd('0xa'),_0x14beee[_0x1acd('0xb')]);var _0x5b3885=!![];var _0x6185cc=_0x14beee['MailAccount'][_0x1acd('0xc')]();var _0x189029={'account':_0x6185cc,'message':{'from':util['format'](_0x1acd('0xd'),_0x14beee[_0x1acd('0xe')][_0x1acd('0xf')],_0x14beee[_0x1acd('0xe')][_0x1acd('0xb')]||_0x14beee['MailAccount'][_0x1acd('0x10')]['user']),'to':_0x14beee['email'],'cc':_0x14beee['cc'],'bcc':_0x14beee['bcc'],'subject':util[_0x1acd('0x11')](_0x1acd('0x12'),_0xca8468['name'],_0x14beee[_0x1acd('0x13')],_0x14beee[_0x1acd('0x14')])}};var _0x42cd20=path[_0x1acd('0x15')](__dirname,_0x1acd('0x16'));var _0x308f36=_0xca8468[_0x1acd('0x17')];var _0x513a4f=util[_0x1acd('0x11')]('%s.%s',path['basename'](_0xca8468[_0x1acd('0x17')],path[_0x1acd('0x18')](_0xca8468[_0x1acd('0x17')])),_0x1acd('0x19'));var _0x28cc82=path[_0x1acd('0x15')](_0x42cd20,_0x308f36);var _0x5d66ed=path[_0x1acd('0x15')](_0x42cd20,_0x513a4f);if(fs[_0x1acd('0x1a')](_0x28cc82)){_0xca8468[_0x1acd('0x1b')]=_0x1acd('0x1c');_0x189029[_0x1acd('0x1d')]['attachments']=[{'filename':_0x308f36,'path':_0x28cc82}];_0x189029['message']['text']=util[_0x1acd('0x11')](_0x1acd('0x1e'),JSON[_0x1acd('0x1f')](_0xca8468,null,0x2));}else if(fs[_0x1acd('0x1a')](_0x5d66ed)){_0xca8468[_0x1acd('0x1b')]=_0x1acd('0x1c');_0x189029['message'][_0x1acd('0x20')]=[{'filename':_0x513a4f,'path':_0x5d66ed}];}else{_0x189029[_0x1acd('0x1d')]['text']=_0x1acd('0x21');if(!_0x14beee[_0x1acd('0x22')]){_0x5b3885=![];logger[_0x1acd('0x9')](_0x1acd('0x23'));}}if(_0x5b3885){return client[_0x1acd('0x24')](_0x1acd('0x25'),_0x189029)['then'](function(_0x5a7737){if(_0x5a7737[_0x1acd('0x26')]){return logger['error'](_0x1acd('0x27'),JSON[_0x1acd('0x1f')](_0x5a7737));}return logger[_0x1acd('0x9')]('email\x20sent');})[_0x1acd('0x28')](function(_0x33f6ca){return logger['error'](_0x1acd('0x27'),JSON['stringify'](_0x33f6ca));});}};}function handleError(){return function(_0x1b4451){return logger[_0x1acd('0x26')](JSON['stringify'](_0x1b4451));};}function handleResult(_0x26f8da){return function(_0x27fda1){logger[_0x1acd('0x9')]('data',JSON['stringify'](_0x27fda1));if(_0x26f8da[_0x1acd('0xe')]&&_0x26f8da['MailAccount'][_0x1acd('0x10')]&&!_[_0x1acd('0x29')](_0x26f8da[_0x1acd('0xb')])){setTimeout(handleSendEmail(_0x26f8da,_0x27fda1),0x3c*0x3e8);}};}function handleJob(_0x237e9d){return function(){try{if(_['isNil'](_0x237e9d[_0x1acd('0x13')])){return logger[_0x1acd('0x9')](_0x1acd('0x2a'));}if(_[_0x1acd('0x29')](_0x237e9d[_0x1acd('0x14')])){return logger[_0x1acd('0x9')](_0x1acd('0x2b'));}var _0x1e54e6={'startDate':moment()[_0x1acd('0x2c')](_0x237e9d[_0x1acd('0x13')],_0x237e9d[_0x1acd('0x14')])[_0x1acd('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x1acd('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x1acd('0x2d'),'output':_0x237e9d['output'],'name':_0x237e9d['name']};if(!_[_0x1acd('0x29')](_0x237e9d[_0x1acd('0x2e')])){logger['info'](_0x1acd('0x2f'),_0x237e9d[_0x1acd('0x2e')]);return analyticDefaultReportController['runReport']({'id':_0x237e9d['DefaultReportId']},_0x1e54e6)[_0x1acd('0x30')](handleResult(_0x237e9d))[_0x1acd('0x28')](handleError());}if(!_[_0x1acd('0x29')](_0x237e9d['CustomReportId'])){logger[_0x1acd('0x9')]('exec\x20custom\x20report\x20id:%s',_0x237e9d[_0x1acd('0x31')]);return analyticCustomReportController[_0x1acd('0x32')]({'id':_0x237e9d[_0x1acd('0x31')]},_0x1e54e6)['then'](handleResult(_0x237e9d))[_0x1acd('0x28')](handleError());}}catch(_0x26986e){logger['error'](JSON[_0x1acd('0x1f')](_0x26986e));}return logger[_0x1acd('0x9')]('no\x20report\x20id');};}function getJobs(_0x4ae213){var _0x34b559={};if(_0x4ae213){_0x34b559['id']=_0x4ae213;}return db[_0x1acd('0x33')][_0x1acd('0x34')]({'where':_0x34b559,'include':[{'model':db[_0x1acd('0xe')],'attributes':['id','name',_0x1acd('0xb')],'include':[{'model':db['MailServerOut'],'as':_0x1acd('0x10'),'include':[{'model':db[_0x1acd('0x35')],'as':_0x1acd('0x35')}]}]}]})['then'](function(_0x109d34){var _0x3bdfee=_[_0x1acd('0x36')](manager[_0x1acd('0x37')]);var _0x3c0fc6=_[_0x1acd('0x38')](_0x109d34,function(_0x3b3b5c){return _0x3b3b5c['id'][_0x1acd('0x39')]();});var _0x389844=_['keyBy'](_0x109d34,function(_0x38af17){return _0x38af17['id'][_0x1acd('0x39')]();});var _0x3fe893=_0x4ae213?_0x3c0fc6:_[_0x1acd('0x3a')](_0x3c0fc6,_0x3bdfee);var _0x1977fe=_[_0x1acd('0x3b')](_0x3c0fc6,_0x3bdfee);var _0x4e8cd0=_[_0x1acd('0x3a')](_0x3bdfee,_0x3c0fc6);var _0x440e85;var _0x23153a;for(_0x440e85=0x0;_0x440e85<_0x4e8cd0[_0x1acd('0x3c')]&&!_0x4ae213;_0x440e85+=0x1){_0x23153a=_0x4e8cd0[_0x440e85]['toString']();if(manager['exists'](_0x23153a)){manager[_0x1acd('0x3d')](_0x23153a);manager[_0x1acd('0x3e')](_0x23153a);logger[_0x1acd('0x9')](_0x1acd('0x3f'),_0x23153a);}}logger[_0x1acd('0x9')]('toRun',JSON['stringify'](_0x3fe893));for(_0x440e85=0x0;_0x440e85<_0x3fe893[_0x1acd('0x3c')];_0x440e85+=0x1){_0x23153a=_0x3fe893[_0x440e85][_0x1acd('0x39')]();logger['info'](_0x1acd('0x40'),_0x23153a);if(_0x4ae213){logger[_0x1acd('0x9')](_0x1acd('0x41'),_0x4ae213);logger[_0x1acd('0x9')](JSON[_0x1acd('0x1f')](_0x389844[_0x23153a]));BPromise[_0x1acd('0x42')]()[_0x1acd('0x30')](handleJob(_0x389844[_0x23153a]));logger[_0x1acd('0x9')](_0x1acd('0x43'),_0x389844[_0x23153a]['name'],_0x389844[_0x23153a][_0x1acd('0x44')]);}else if(_0x389844[_0x23153a]['cron']&&_0x389844[_0x23153a][_0x1acd('0x45')]&&moment()[_0x1acd('0x46')](_0x389844[_0x23153a][_0x1acd('0x47')],_0x389844[_0x23153a][_0x1acd('0x48')])){manager[_0x1acd('0x49')](_0x23153a,_0x389844[_0x23153a][_0x1acd('0x44')],handleJob(_0x389844[_0x23153a]));manager[_0x1acd('0x4a')](_0x23153a);logger['info'](_0x1acd('0x4b'),_0x389844[_0x23153a][_0x1acd('0xf')],_0x389844[_0x23153a]['cron']);}else if(manager[_0x1acd('0x4c')](_0x23153a)){manager['stop'](_0x23153a);manager[_0x1acd('0x3e')](_0x23153a);logger['info'](_0x1acd('0x4d'),_0x389844[_0x23153a][_0x1acd('0xf')],_0x389844[_0x23153a][_0x1acd('0x44')]);}}for(_0x440e85=0x0,_0x23153a;_0x440e85<_0x1977fe['length']&&!_0x4ae213;_0x440e85+=0x1){_0x23153a=_0x1977fe[_0x440e85][_0x1acd('0x39')]();if(manager[_0x1acd('0x4c')](_0x23153a)){if(_0x389844[_0x23153a][_0x1acd('0x44')]&&_0x389844[_0x23153a][_0x1acd('0x45')]&&moment()[_0x1acd('0x46')](_0x389844[_0x23153a]['startAt'],_0x389844[_0x23153a][_0x1acd('0x48')])){manager['update'](_0x23153a,_0x389844[_0x23153a][_0x1acd('0x44')],handleJob(_0x389844[_0x23153a]));logger[_0x1acd('0x9')](_0x1acd('0x4e'),_0x389844[_0x23153a][_0x1acd('0xf')],_0x389844[_0x23153a][_0x1acd('0x44')]);}else{manager[_0x1acd('0x3d')](_0x23153a);manager[_0x1acd('0x3e')](_0x23153a);logger[_0x1acd('0x9')](_0x1acd('0x4d'),_0x389844[_0x23153a][_0x1acd('0xf')],_0x389844[_0x23153a]['cron']);}}}})['catch'](function(_0x13e492){logger[_0x1acd('0x26')](JSON[_0x1acd('0x1f')](_0x13e492));});}exports[_0x1acd('0x4f')]=function(_0x2d3359){return getJobs(_0x2d3359);};exports[_0x1acd('0x4a')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xcd04=['\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','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','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','then','error','error\x20mail','email\x20sent','catch','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','jobs','keyBy','toString','intersection','length','exists','stop','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','endAt','add','start','add\x20cron','stop\x20cron','active','startAt','update','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xcd04,0x149));var _0x4cd0=function(_0x7d0de9,_0x68046b){_0x7d0de9=_0x7d0de9-0x0;var _0x18932a=_0xcd04[_0x7d0de9];return _0x18932a;};'use strict';var fs=require('fs');var util=require(_0x4cd0('0x0'));var path=require(_0x4cd0('0x1'));var _=require(_0x4cd0('0x2'));var moment=require(_0x4cd0('0x3'));var CronJobManager=require(_0x4cd0('0x4'));var jayson=require(_0x4cd0('0x5'));var BPromise=require('bluebird');var logger=require(_0x4cd0('0x6'))(_0x4cd0('0x7'));var db=require(_0x4cd0('0x8'))['db'];var analyticCustomReportController=require(_0x4cd0('0x9'));var analyticDefaultReportController=require(_0x4cd0('0xa'));var client=jayson[_0x4cd0('0xb')][_0x4cd0('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x255a67,_0x585b3b){return function(){logger[_0x4cd0('0xd')](_0x4cd0('0xe'),_0x255a67[_0x4cd0('0xf')]);var _0x53c197=!![];var _0x17aeb5=_0x255a67[_0x4cd0('0x10')][_0x4cd0('0x11')]();var _0x16aa9f={'account':_0x17aeb5,'message':{'from':util[_0x4cd0('0x12')](_0x4cd0('0x13'),_0x255a67['MailAccount'][_0x4cd0('0x14')],_0x255a67['MailAccount'][_0x4cd0('0xf')]||_0x255a67[_0x4cd0('0x10')]['Smtp'][_0x4cd0('0x15')]),'to':_0x255a67[_0x4cd0('0xf')],'cc':_0x255a67['cc'],'bcc':_0x255a67[_0x4cd0('0x16')],'subject':util['format'](_0x4cd0('0x17'),_0x585b3b[_0x4cd0('0x14')],_0x255a67['subtractNumber'],_0x255a67[_0x4cd0('0x18')])}};var _0x5d3e1c=path[_0x4cd0('0x19')](__dirname,_0x4cd0('0x1a'));var _0x578a80=_0x585b3b[_0x4cd0('0x1b')];var _0x1d5195=util[_0x4cd0('0x12')](_0x4cd0('0x1c'),path['basename'](_0x585b3b[_0x4cd0('0x1b')],path[_0x4cd0('0x1d')](_0x585b3b['savename'])),_0x4cd0('0x1e'));var _0x13cd59=path[_0x4cd0('0x19')](_0x5d3e1c,_0x578a80);var _0x57376f=path[_0x4cd0('0x19')](_0x5d3e1c,_0x1d5195);if(fs['existsSync'](_0x13cd59)){_0x585b3b[_0x4cd0('0x1f')]=_0x4cd0('0x20');_0x16aa9f[_0x4cd0('0x21')]['attachments']=[{'filename':_0x578a80,'path':_0x13cd59}];_0x16aa9f['message'][_0x4cd0('0x22')]=util['format'](_0x4cd0('0x23'),JSON[_0x4cd0('0x24')](_0x585b3b,null,0x2));}else if(fs[_0x4cd0('0x25')](_0x57376f)){_0x585b3b[_0x4cd0('0x1f')]=_0x4cd0('0x20');_0x16aa9f[_0x4cd0('0x21')]['attachments']=[{'filename':_0x1d5195,'path':_0x57376f}];}else{_0x16aa9f[_0x4cd0('0x21')][_0x4cd0('0x22')]=_0x4cd0('0x26');if(!_0x255a67[_0x4cd0('0x27')]){_0x53c197=![];logger['info'](_0x4cd0('0x28'));}}if(_0x53c197){return client[_0x4cd0('0x29')]('SendMail',_0x16aa9f)[_0x4cd0('0x2a')](function(_0x237fb4){if(_0x237fb4['error']){return logger[_0x4cd0('0x2b')](_0x4cd0('0x2c'),JSON[_0x4cd0('0x24')](_0x237fb4));}return logger[_0x4cd0('0xd')](_0x4cd0('0x2d'));})[_0x4cd0('0x2e')](function(_0x223974){return logger['error'](_0x4cd0('0x2c'),JSON[_0x4cd0('0x24')](_0x223974));});}};}function handleError(){return function(_0xae853c){return logger[_0x4cd0('0x2b')](JSON[_0x4cd0('0x24')](_0xae853c));};}function handleResult(_0x29f0df){return function(_0x754bd0){logger[_0x4cd0('0xd')]('data',JSON['stringify'](_0x754bd0));if(_0x29f0df['MailAccount']&&_0x29f0df[_0x4cd0('0x10')][_0x4cd0('0x2f')]&&!_[_0x4cd0('0x30')](_0x29f0df['email'])){setTimeout(handleSendEmail(_0x29f0df,_0x754bd0),0x3c*0x3e8);}};}function handleJob(_0x4be380){return function(){try{if(_[_0x4cd0('0x30')](_0x4be380['subtractNumber'])){return logger[_0x4cd0('0xd')](_0x4cd0('0x31'));}if(_['isNil'](_0x4be380[_0x4cd0('0x18')])){return logger[_0x4cd0('0xd')](_0x4cd0('0x32'));}var _0x2c56c8={'startDate':moment()[_0x4cd0('0x33')](_0x4be380['subtractNumber'],_0x4be380[_0x4cd0('0x18')])[_0x4cd0('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x4cd0('0x34')),'type':'scheduled','output':_0x4be380[_0x4cd0('0x35')],'name':_0x4be380[_0x4cd0('0x14')]};if(!_['isNil'](_0x4be380[_0x4cd0('0x36')])){logger[_0x4cd0('0xd')](_0x4cd0('0x37'),_0x4be380[_0x4cd0('0x36')]);return analyticDefaultReportController[_0x4cd0('0x38')]({'id':_0x4be380[_0x4cd0('0x36')]},_0x2c56c8)[_0x4cd0('0x2a')](handleResult(_0x4be380))[_0x4cd0('0x2e')](handleError());}if(!_['isNil'](_0x4be380[_0x4cd0('0x39')])){logger['info'](_0x4cd0('0x3a'),_0x4be380[_0x4cd0('0x39')]);return analyticCustomReportController['runReport']({'id':_0x4be380[_0x4cd0('0x39')]},_0x2c56c8)[_0x4cd0('0x2a')](handleResult(_0x4be380))['catch'](handleError());}}catch(_0x47a8c4){logger[_0x4cd0('0x2b')](JSON[_0x4cd0('0x24')](_0x47a8c4));}return logger['info'](_0x4cd0('0x3b'));};}function getJobs(_0x15ccfb){var _0x3a5b0c={};if(_0x15ccfb){_0x3a5b0c['id']=_0x15ccfb;}return db[_0x4cd0('0x3c')]['findAll']({'where':_0x3a5b0c,'include':[{'model':db['MailAccount'],'attributes':['id','name','email'],'include':[{'model':db[_0x4cd0('0x3d')],'as':_0x4cd0('0x2f'),'include':[{'model':db[_0x4cd0('0x3e')],'as':_0x4cd0('0x3e')}]}]}]})['then'](function(_0x2f5577){var _0x4a2770=_[_0x4cd0('0x3f')](manager[_0x4cd0('0x40')]);var _0x2d23a0=_['map'](_0x2f5577,function(_0xd11edb){return _0xd11edb['id']['toString']();});var _0x453cfa=_[_0x4cd0('0x41')](_0x2f5577,function(_0x326463){return _0x326463['id'][_0x4cd0('0x42')]();});var _0x3999d6=_0x15ccfb?_0x2d23a0:_['difference'](_0x2d23a0,_0x4a2770);var _0x4c7913=_[_0x4cd0('0x43')](_0x2d23a0,_0x4a2770);var _0x5cdd93=_['difference'](_0x4a2770,_0x2d23a0);var _0x2b8153;var _0x18801e;for(_0x2b8153=0x0;_0x2b8153<_0x5cdd93[_0x4cd0('0x44')]&&!_0x15ccfb;_0x2b8153+=0x1){_0x18801e=_0x5cdd93[_0x2b8153][_0x4cd0('0x42')]();if(manager[_0x4cd0('0x45')](_0x18801e)){manager[_0x4cd0('0x46')](_0x18801e);manager[_0x4cd0('0x47')](_0x18801e);logger[_0x4cd0('0xd')]('delete\x20cron',_0x18801e);}}logger['info'](_0x4cd0('0x48'),JSON[_0x4cd0('0x24')](_0x3999d6));for(_0x2b8153=0x0;_0x2b8153<_0x3999d6[_0x4cd0('0x44')];_0x2b8153+=0x1){_0x18801e=_0x3999d6[_0x2b8153][_0x4cd0('0x42')]();logger[_0x4cd0('0xd')](_0x4cd0('0x49'),_0x18801e);if(_0x15ccfb){logger[_0x4cd0('0xd')](_0x4cd0('0x4a'),_0x15ccfb);logger[_0x4cd0('0xd')](JSON[_0x4cd0('0x24')](_0x453cfa[_0x18801e]));BPromise[_0x4cd0('0x4b')]()[_0x4cd0('0x2a')](handleJob(_0x453cfa[_0x18801e]));logger['info'](_0x4cd0('0x4c'),_0x453cfa[_0x18801e][_0x4cd0('0x14')],_0x453cfa[_0x18801e][_0x4cd0('0x4d')]);}else if(_0x453cfa[_0x18801e][_0x4cd0('0x4d')]&&_0x453cfa[_0x18801e]['active']&&moment()[_0x4cd0('0x4e')](_0x453cfa[_0x18801e]['startAt'],_0x453cfa[_0x18801e][_0x4cd0('0x4f')])){manager[_0x4cd0('0x50')](_0x18801e,_0x453cfa[_0x18801e][_0x4cd0('0x4d')],handleJob(_0x453cfa[_0x18801e]));manager[_0x4cd0('0x51')](_0x18801e);logger[_0x4cd0('0xd')](_0x4cd0('0x52'),_0x453cfa[_0x18801e][_0x4cd0('0x14')],_0x453cfa[_0x18801e]['cron']);}else if(manager[_0x4cd0('0x45')](_0x18801e)){manager[_0x4cd0('0x46')](_0x18801e);manager[_0x4cd0('0x47')](_0x18801e);logger[_0x4cd0('0xd')](_0x4cd0('0x53'),_0x453cfa[_0x18801e][_0x4cd0('0x14')],_0x453cfa[_0x18801e][_0x4cd0('0x4d')]);}}for(_0x2b8153=0x0,_0x18801e;_0x2b8153<_0x4c7913['length']&&!_0x15ccfb;_0x2b8153+=0x1){_0x18801e=_0x4c7913[_0x2b8153][_0x4cd0('0x42')]();if(manager['exists'](_0x18801e)){if(_0x453cfa[_0x18801e]['cron']&&_0x453cfa[_0x18801e][_0x4cd0('0x54')]&&moment()[_0x4cd0('0x4e')](_0x453cfa[_0x18801e][_0x4cd0('0x55')],_0x453cfa[_0x18801e][_0x4cd0('0x4f')])){manager[_0x4cd0('0x56')](_0x18801e,_0x453cfa[_0x18801e][_0x4cd0('0x4d')],handleJob(_0x453cfa[_0x18801e]));logger['info']('update\x20cron',_0x453cfa[_0x18801e]['name'],_0x453cfa[_0x18801e][_0x4cd0('0x4d')]);}else{manager[_0x4cd0('0x46')](_0x18801e);manager[_0x4cd0('0x47')](_0x18801e);logger[_0x4cd0('0xd')](_0x4cd0('0x53'),_0x453cfa[_0x18801e][_0x4cd0('0x14')],_0x453cfa[_0x18801e][_0x4cd0('0x4d')]);}}}})[_0x4cd0('0x2e')](function(_0x12495c){logger['error'](JSON['stringify'](_0x12495c));});}exports['run']=function(_0x17b89a){return getJobs(_0x17b89a);};exports[_0x4cd0('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 68f6c07..79fcedb 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 _0xc15c=['Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','push','start','request-promise','util','bluebird','../../config/logger','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','fileText','length','update','then','Sequelize','sentiment','sentimentAccountId','sentimentRegion','language','bucket','ValidationError'];(function(_0x5097e9,_0xa4ad09){var _0x10885a=function(_0x4894e5){while(--_0x4894e5){_0x5097e9['push'](_0x5097e9['shift']());}};_0x10885a(++_0xa4ad09);}(_0xc15c,0xae));var _0xcc15=function(_0x5ed59c,_0x460824){_0x5ed59c=_0x5ed59c-0x0;var _0xb7f99b=_0xc15c[_0x5ed59c];return _0xb7f99b;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0xcc15('0x0'));var util=require(_0xcc15('0x1'));var BPromise=require(_0xcc15('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xcc15('0x3'))('transcribe');function getTranscriptionJob(_0x571abf,_0x1d3a5f,_0x5c145e,_0x4bd89a){return new Promise(function(_0x11ae7e,_0x15135d){var _0x597a7e=new AWS['TranscribeService']({'accessKeyId':_0x1d3a5f,'secretAccessKey':_0x571abf,'region':_0x5c145e});_0x597a7e[_0xcc15('0x4')]({'TranscriptionJobName':_0x4bd89a},function(_0x25fee6,_0x16c0bd){if(_0x25fee6){return _0x15135d(_0x25fee6);}else{return _0x11ae7e(_0x16c0bd);}});});}function sentiment(_0x47695b,_0x441857,_0x5eafea,_0x355a96,_0x363e58){return new Promise(function(_0x24316b,_0x391197){var _0x55a853=new AWS[(_0xcc15('0x5'))]({'accessKeyId':_0x441857,'secretAccessKey':_0x47695b,'region':_0x5eafea});_0x55a853[_0xcc15('0x6')]({'Text':_0x355a96,'LanguageCode':_0x363e58[_0xcc15('0x7')](0x0,0x2)},function(_0x49da6c,_0x507233){if(_0x49da6c){return _0x391197(_0x49da6c);}else{return _0x24316b(_0x507233);}});});}function checkTranscribeJob(_0x12e2b7,_0x49344c,_0x45667d){var _0x5bddf5;return new BPromise(function(_0x2ebd95,_0x5dca00){logger[_0xcc15('0x8')](util['format'](_0xcc15('0x9'),_0x12e2b7['id'],_0x12e2b7[_0xcc15('0xa')]));return getTranscriptionJob(_0x45667d[_0xcc15('0xb')],_0x45667d[_0xcc15('0xc')],_0x49344c['transcribeRegion'],_0x12e2b7['transcribeName'])['then'](function(_0x591c2f){logger[_0xcc15('0x8')](util[_0xcc15('0xd')](_0xcc15('0xe'),_0x12e2b7['id'],_0x12e2b7['transcribeName'],_0x591c2f['TranscriptionJob'][_0xcc15('0xf')]));if(!_0x12e2b7['fileText']){switch(_0x591c2f[_0xcc15('0x10')][_0xcc15('0xf')]){case _0xcc15('0x11'):var _0x47a574={'transcribeStatus':_0x591c2f['TranscriptionJob'][_0xcc15('0xf')],'fileUri':_0x591c2f[_0xcc15('0x10')]['Transcript'][_0xcc15('0x12')]};logger[_0xcc15('0x8')](util[_0xcc15('0xd')]('[RECORDING:%d]\x20Get\x20transcript',_0x12e2b7['id']));return rp({'uri':_0x591c2f[_0xcc15('0x10')]['Transcript'][_0xcc15('0x12')],'json':!![]})['then'](function(_0x2f2910){logger[_0xcc15('0x8')](util[_0xcc15('0xd')](_0xcc15('0x13'),_0x12e2b7['id']));if(_0x2f2910&&_0x2f2910['results']&&_0x2f2910[_0xcc15('0x14')][_0xcc15('0x15')]&&_0x2f2910[_0xcc15('0x14')][_0xcc15('0x15')]['length']){_0x47a574[_0xcc15('0x16')]='';for(var _0x1a4f95=0x0;_0x1a4f95<_0x2f2910['results']['transcripts'][_0xcc15('0x17')];_0x1a4f95++){_0x47a574[_0xcc15('0x16')]+=_0x2f2910[_0xcc15('0x14')][_0xcc15('0x15')][_0x1a4f95]['transcript']+'';}}return _0x12e2b7[_0xcc15('0x18')](_0x47a574);})[_0xcc15('0x19')](function(){logger['info'](util[_0xcc15('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x12e2b7['id']));if(!_0x12e2b7['tempSentiment']){throw new db[(_0xcc15('0x1a'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x49344c[_0xcc15('0x1b')]||!_0x49344c[_0xcc15('0x1c')]||!_0x49344c[_0xcc15('0x1d')]||!_0x49344c[_0xcc15('0x1e')]||!_0x49344c[_0xcc15('0x1f')]){throw new db['Sequelize'][(_0xcc15('0x20'))](_0xcc15('0x21'));}if(!_0x47a574[_0xcc15('0x16')]){throw new Error(_0xcc15('0x22'));}if(_0x49344c[_0xcc15('0x1c')]===_0x45667d['id']){return _0x45667d;}else{return db[_0xcc15('0x23')][_0xcc15('0x24')]({'where':{'id':_settings[_0xcc15('0x1c')]}});}})[_0xcc15('0x19')](function(_0x392fd8){if(!_0x392fd8){throw new db['Sequelize']['ValidationError'](_0xcc15('0x25'));}if(!_0x392fd8[_0xcc15('0xb')]||!_0x392fd8[_0xcc15('0xc')]){throw new db[(_0xcc15('0x1a'))][(_0xcc15('0x20'))](_0xcc15('0x26'));}_0x5bddf5=_0x392fd8;logger['info'](util[_0xcc15('0xd')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x12e2b7['id']));return sentiment(_0x5bddf5[_0xcc15('0xb')],_0x5bddf5[_0xcc15('0xc')],_0x49344c[_0xcc15('0x1d')],_0x47a574[_0xcc15('0x16')],_0x49344c[_0xcc15('0x1e')]);})[_0xcc15('0x19')](function(_0x422b97){logger[_0xcc15('0x8')](util[_0xcc15('0xd')](_0xcc15('0x27'),_0x12e2b7['id']));return _0x12e2b7['update']({'sentiment':_0x422b97[_0xcc15('0x28')],'sPositive':_0x422b97[_0xcc15('0x29')][_0xcc15('0x2a')],'sNegative':_0x422b97[_0xcc15('0x29')][_0xcc15('0x2b')],'sMixed':_0x422b97['SentimentScore'][_0xcc15('0x2c')],'sNeutral':_0x422b97[_0xcc15('0x29')][_0xcc15('0x2d')]});})['then'](function(){logger['info'](util[_0xcc15('0xd')](_0xcc15('0x2e'),_0x12e2b7['id']));_0x2ebd95();});case'FAILED':return _0x12e2b7[_0xcc15('0x18')]({'transcribeStatus':'FAILED','failureReason':_0x591c2f[_0xcc15('0x10')][_0xcc15('0x2f')]})[_0xcc15('0x19')](function(){logger[_0xcc15('0x8')](util['format'](_0xcc15('0x2e'),_0x12e2b7['id']));_0x2ebd95();});default:logger[_0xcc15('0x8')](util[_0xcc15('0xd')](_0xcc15('0x30'),_0x12e2b7['id']));break;}}else{return BPromise[_0xcc15('0x31')]()[_0xcc15('0x19')](function(){if(!_0x12e2b7[_0xcc15('0x32')]){throw new db[(_0xcc15('0x1a'))][(_0xcc15('0x20'))](_0xcc15('0x33'));}if(!_0x49344c[_0xcc15('0x1b')]||!_0x49344c[_0xcc15('0x1c')]||!_0x49344c[_0xcc15('0x1d')]||!_0x49344c[_0xcc15('0x1e')]||!_0x49344c[_0xcc15('0x1f')]){throw new db['Sequelize'][(_0xcc15('0x20'))](_0xcc15('0x21'));}if(!_0x12e2b7['fileText']){throw new Error(_0xcc15('0x22'));}if(_0x49344c[_0xcc15('0x1c')]===_0x45667d['id']){return _0x45667d;}else{return db[_0xcc15('0x23')][_0xcc15('0x24')]({'where':{'id':_settings[_0xcc15('0x1c')]}});}})[_0xcc15('0x19')](function(_0x47664c){if(!_0x47664c){throw new db[(_0xcc15('0x1a'))][(_0xcc15('0x20'))](_0xcc15('0x25'));}if(!_0x47664c[_0xcc15('0xb')]||!_0x47664c[_0xcc15('0xc')]){throw new db['Sequelize']['ValidationError'](_0xcc15('0x26'));}_0x5bddf5=_0x47664c;logger[_0xcc15('0x8')](util[_0xcc15('0xd')](_0xcc15('0x34'),_0x12e2b7['id']));return sentiment(_0x5bddf5['data1'],_0x5bddf5[_0xcc15('0xc')],_0x49344c[_0xcc15('0x1d')],_0x12e2b7['fileText'],_0x49344c['language']);})[_0xcc15('0x19')](function(_0x13f25e){logger[_0xcc15('0x8')](util[_0xcc15('0xd')](_0xcc15('0x27'),_0x12e2b7['id']));return _0x12e2b7[_0xcc15('0x18')]({'sentiment':_0x13f25e['Sentiment'],'sPositive':_0x13f25e[_0xcc15('0x29')][_0xcc15('0x2a')],'sNegative':_0x13f25e['SentimentScore'][_0xcc15('0x2b')],'sMixed':_0x13f25e['SentimentScore']['Mixed'],'sNeutral':_0x13f25e[_0xcc15('0x29')]['Neutral'],'transcribeStatus':_0xcc15('0x11')});})['then'](function(){logger[_0xcc15('0x8')](util[_0xcc15('0xd')](_0xcc15('0x2e'),_0x12e2b7['id']));_0x2ebd95();});}})[_0xcc15('0x35')](function(_0x1c0b59){if(_0x1c0b59){if(!_0x1c0b59[_0xcc15('0x36')]||_0x1c0b59['name']!==_0xcc15('0x37')){logger[_0xcc15('0x38')](util['format'](_0xcc15('0x39'),_0x12e2b7['id']),util[_0xcc15('0x3a')](_0x1c0b59,{'showHidden':![],'depth':null}));}}_0x2ebd95();});});}function checkTranscribe(){var _0x1c1b03;var _0x18306f;var _0x5f08bb;return db[_0xcc15('0x3b')][_0xcc15('0x3c')]({'where':{'transcribeStatus':_0xcc15('0x3d')}})[_0xcc15('0x19')](function(_0xb6b3d0){if(!_0xb6b3d0||!_0xb6b3d0[_0xcc15('0x17')]){throw new db[(_0xcc15('0x1a'))][(_0xcc15('0x20'))](_0xcc15('0x3e'));}_0x1c1b03=_0xb6b3d0;return db[_0xcc15('0x3f')][_0xcc15('0x24')]({'where':{'id':0x1}});})[_0xcc15('0x19')](function(_0x34c6b1){if(!_0x34c6b1){throw new db[(_0xcc15('0x1a'))][(_0xcc15('0x20'))](_0xcc15('0x40'));}_0x18306f=_0x34c6b1;if(!_0x18306f['transcribe']||!_0x18306f['transcribeAccountId']||!_0x18306f['transcribeRegion']||!_0x18306f['language']||!_0x18306f[_0xcc15('0x1f')]){throw new db[(_0xcc15('0x1a'))][(_0xcc15('0x20'))](_0xcc15('0x41'));}return db['CloudProvider'][_0xcc15('0x24')]({'where':{'id':_0x18306f[_0xcc15('0x42')]}});})[_0xcc15('0x19')](function(_0x12b9e9){if(!_0x12b9e9){throw new db[(_0xcc15('0x1a'))][(_0xcc15('0x20'))](_0xcc15('0x25'));}if(!_0x12b9e9['data1']||!_0x12b9e9[_0xcc15('0xc')]){throw new db[(_0xcc15('0x1a'))][(_0xcc15('0x20'))](_0xcc15('0x26'));}_0x5f08bb=_0x12b9e9;var _0x131966=[];_0x1c1b03['forEach'](function(_0x253fd8){_0x131966[_0xcc15('0x43')](checkTranscribeJob(_0x253fd8,_0x18306f,_0x5f08bb));});return BPromise['all'](_0x131966);})[_0xcc15('0x35')](function(_0x5cd21b){if(_0x5cd21b){if(!_0x5cd21b[_0xcc15('0x36')]||_0x5cd21b[_0xcc15('0x36')]!==_0xcc15('0x37')){logger[_0xcc15('0x38')](util[_0xcc15('0x3a')](_0x5cd21b,{'showHidden':![],'depth':null}));}}});}exports[_0xcc15('0x44')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xede3=['substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeName','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','then','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Neutral','FAILED','FailureReason','Sentiment\x20Analysis\x20not\x20configured','Mixed','catch','name','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','start','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment'];(function(_0x2aba7f,_0x549c6e){var _0x48c187=function(_0x50a532){while(--_0x50a532){_0x2aba7f['push'](_0x2aba7f['shift']());}};_0x48c187(++_0x549c6e);}(_0xede3,0xc0));var _0x3ede=function(_0x39c4ea,_0x4ba298){_0x39c4ea=_0x39c4ea-0x0;var _0x3205c1=_0xede3[_0x39c4ea];return _0x3205c1;};var _=require('lodash');var AWS=require(_0x3ede('0x0'));var rp=require('request-promise');var util=require(_0x3ede('0x1'));var BPromise=require(_0x3ede('0x2'));var db=require(_0x3ede('0x3'))['db'];var logger=require(_0x3ede('0x4'))(_0x3ede('0x5'));function getTranscriptionJob(_0x1e463b,_0x10dbc8,_0x450f99,_0xf6f567){return new Promise(function(_0x365db9,_0x328085){var _0x150182=new AWS[(_0x3ede('0x6'))]({'accessKeyId':_0x10dbc8,'secretAccessKey':_0x1e463b,'region':_0x450f99});_0x150182[_0x3ede('0x7')]({'TranscriptionJobName':_0xf6f567},function(_0x583272,_0x428a4b){if(_0x583272){return _0x328085(_0x583272);}else{return _0x365db9(_0x428a4b);}});});}function sentiment(_0x3d308f,_0x4168b5,_0x58ceae,_0x35cea4,_0x555bd){return new Promise(function(_0x177db,_0x377182){var _0x1e5240=new AWS['Comprehend']({'accessKeyId':_0x4168b5,'secretAccessKey':_0x3d308f,'region':_0x58ceae});_0x1e5240[_0x3ede('0x8')]({'Text':_0x35cea4,'LanguageCode':_0x555bd[_0x3ede('0x9')](0x0,0x2)},function(_0x3a22b8,_0xdeba4e){if(_0x3a22b8){return _0x377182(_0x3a22b8);}else{return _0x177db(_0xdeba4e);}});});}function checkTranscribeJob(_0x4a9c49,_0x35c8d4,_0x3b2697){var _0xf1a93b;return new BPromise(function(_0x449111,_0x3875f0){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0xc'),_0x4a9c49['id'],_0x4a9c49['transcribeName']));return getTranscriptionJob(_0x3b2697['data1'],_0x3b2697[_0x3ede('0xd')],_0x35c8d4['transcribeRegion'],_0x4a9c49[_0x3ede('0xe')])['then'](function(_0x54ae57){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0xf'),_0x4a9c49['id'],_0x4a9c49['transcribeName'],_0x54ae57[_0x3ede('0x10')]['TranscriptionJobStatus']));if(!_0x4a9c49['fileText']){switch(_0x54ae57[_0x3ede('0x10')][_0x3ede('0x11')]){case _0x3ede('0x12'):var _0x54aeb9={'transcribeStatus':_0x54ae57[_0x3ede('0x10')][_0x3ede('0x11')],'fileUri':_0x54ae57[_0x3ede('0x10')]['Transcript']['TranscriptFileUri']};logger[_0x3ede('0xa')](util['format'](_0x3ede('0x13'),_0x4a9c49['id']));return rp({'uri':_0x54ae57['TranscriptionJob'][_0x3ede('0x14')][_0x3ede('0x15')],'json':!![]})[_0x3ede('0x16')](function(_0xf821d9){logger[_0x3ede('0xa')](util[_0x3ede('0xb')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x4a9c49['id']));if(_0xf821d9&&_0xf821d9[_0x3ede('0x17')]&&_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')]&&_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')][_0x3ede('0x19')]){_0x54aeb9[_0x3ede('0x1a')]='';for(var _0x44713b=0x0;_0x44713b<_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')]['length'];_0x44713b++){_0x54aeb9['fileText']+=_0xf821d9[_0x3ede('0x17')][_0x3ede('0x18')][_0x44713b][_0x3ede('0x1b')]+'';}}return _0x4a9c49[_0x3ede('0x1c')](_0x54aeb9);})[_0x3ede('0x16')](function(){logger[_0x3ede('0xa')](util['format'](_0x3ede('0x1d'),_0x4a9c49['id']));if(!_0x4a9c49[_0x3ede('0x1e')]){throw new db[(_0x3ede('0x1f'))]['ValidationError'](_0x3ede('0x20'));}if(!_0x35c8d4[_0x3ede('0x21')]||!_0x35c8d4[_0x3ede('0x22')]||!_0x35c8d4['sentimentRegion']||!_0x35c8d4[_0x3ede('0x23')]||!_0x35c8d4['bucket']){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x54aeb9['fileText']){throw new Error(_0x3ede('0x25'));}if(_0x35c8d4[_0x3ede('0x22')]===_0x3b2697['id']){return _0x3b2697;}else{return db[_0x3ede('0x26')][_0x3ede('0x27')]({'where':{'id':_settings[_0x3ede('0x22')]}});}})[_0x3ede('0x16')](function(_0x41c790){if(!_0x41c790){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x28'));}if(!_0x41c790['data1']||!_0x41c790[_0x3ede('0xd')]){throw new db[(_0x3ede('0x1f'))]['ValidationError'](_0x3ede('0x29'));}_0xf1a93b=_0x41c790;logger[_0x3ede('0xa')](util[_0x3ede('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4a9c49['id']));return sentiment(_0xf1a93b[_0x3ede('0x2a')],_0xf1a93b['data2'],_0x35c8d4[_0x3ede('0x2b')],_0x54aeb9[_0x3ede('0x1a')],_0x35c8d4[_0x3ede('0x23')]);})['then'](function(_0x518543){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0x2c'),_0x4a9c49['id']));return _0x4a9c49[_0x3ede('0x1c')]({'sentiment':_0x518543[_0x3ede('0x2d')],'sPositive':_0x518543['SentimentScore'][_0x3ede('0x2e')],'sNegative':_0x518543[_0x3ede('0x2f')][_0x3ede('0x30')],'sMixed':_0x518543[_0x3ede('0x2f')]['Mixed'],'sNeutral':_0x518543[_0x3ede('0x2f')][_0x3ede('0x31')]});})[_0x3ede('0x16')](function(){logger['info'](util['format'](_0x3ede('0x1d'),_0x4a9c49['id']));_0x449111();});case _0x3ede('0x32'):return _0x4a9c49[_0x3ede('0x1c')]({'transcribeStatus':_0x3ede('0x32'),'failureReason':_0x54ae57[_0x3ede('0x10')][_0x3ede('0x33')]})[_0x3ede('0x16')](function(){logger['info'](util[_0x3ede('0xb')](_0x3ede('0x1d'),_0x4a9c49['id']));_0x449111();});default:logger[_0x3ede('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x4a9c49['id']));break;}}else{return BPromise['resolve']()[_0x3ede('0x16')](function(){if(!_0x4a9c49[_0x3ede('0x1e')]){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x20'));}if(!_0x35c8d4[_0x3ede('0x21')]||!_0x35c8d4[_0x3ede('0x22')]||!_0x35c8d4[_0x3ede('0x2b')]||!_0x35c8d4[_0x3ede('0x23')]||!_0x35c8d4['bucket']){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x34'));}if(!_0x4a9c49['fileText']){throw new Error(_0x3ede('0x25'));}if(_0x35c8d4[_0x3ede('0x22')]===_0x3b2697['id']){return _0x3b2697;}else{return db[_0x3ede('0x26')][_0x3ede('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x222a85){if(!_0x222a85){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x28'));}if(!_0x222a85['data1']||!_0x222a85[_0x3ede('0xd')]){throw new db[(_0x3ede('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xf1a93b=_0x222a85;logger['info'](util[_0x3ede('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4a9c49['id']));return sentiment(_0xf1a93b['data1'],_0xf1a93b['data2'],_0x35c8d4[_0x3ede('0x2b')],_0x4a9c49[_0x3ede('0x1a')],_0x35c8d4[_0x3ede('0x23')]);})[_0x3ede('0x16')](function(_0x22ae1a){logger[_0x3ede('0xa')](util['format'](_0x3ede('0x2c'),_0x4a9c49['id']));return _0x4a9c49['update']({'sentiment':_0x22ae1a['Sentiment'],'sPositive':_0x22ae1a[_0x3ede('0x2f')][_0x3ede('0x2e')],'sNegative':_0x22ae1a[_0x3ede('0x2f')]['Negative'],'sMixed':_0x22ae1a['SentimentScore'][_0x3ede('0x35')],'sNeutral':_0x22ae1a[_0x3ede('0x2f')][_0x3ede('0x31')],'transcribeStatus':'COMPLETED'});})[_0x3ede('0x16')](function(){logger[_0x3ede('0xa')](util[_0x3ede('0xb')](_0x3ede('0x1d'),_0x4a9c49['id']));_0x449111();});}})[_0x3ede('0x36')](function(_0x34f94a){if(_0x34f94a){if(!_0x34f94a[_0x3ede('0x37')]||_0x34f94a['name']!=='SequelizeValidationError'){logger['error'](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x4a9c49['id']),util[_0x3ede('0x38')](_0x34f94a,{'showHidden':![],'depth':null}));}}_0x449111();});});}function checkTranscribe(){var _0x44ba2a;var _0x13b7a0;var _0x29f801;return db[_0x3ede('0x39')][_0x3ede('0x3a')]({'where':{'transcribeStatus':_0x3ede('0x3b')}})['then'](function(_0x52d97e){if(!_0x52d97e||!_0x52d97e[_0x3ede('0x19')]){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x3c'));}_0x44ba2a=_0x52d97e;return db[_0x3ede('0x3d')][_0x3ede('0x27')]({'where':{'id':0x1}});})['then'](function(_0x3dc3a5){if(!_0x3dc3a5){throw new db[(_0x3ede('0x1f'))][(_0x3ede('0x24'))](_0x3ede('0x3e'));}_0x13b7a0=_0x3dc3a5;if(!_0x13b7a0[_0x3ede('0x5')]||!_0x13b7a0[_0x3ede('0x3f')]||!_0x13b7a0[_0x3ede('0x40')]||!_0x13b7a0[_0x3ede('0x23')]||!_0x13b7a0['bucket']){throw new db['Sequelize']['ValidationError'](_0x3ede('0x41'));}return db[_0x3ede('0x26')][_0x3ede('0x27')]({'where':{'id':_0x13b7a0[_0x3ede('0x3f')]}});})['then'](function(_0x253773){if(!_0x253773){throw new db[(_0x3ede('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x253773[_0x3ede('0x2a')]||!_0x253773['data2']){throw new db['Sequelize'][(_0x3ede('0x24'))](_0x3ede('0x29'));}_0x29f801=_0x253773;var _0x148c96=[];_0x44ba2a['forEach'](function(_0x2c6981){_0x148c96['push'](checkTranscribeJob(_0x2c6981,_0x13b7a0,_0x29f801));});return BPromise['all'](_0x148c96);})[_0x3ede('0x36')](function(_0x37fbbb){if(_0x37fbbb){if(!_0x37fbbb[_0x3ede('0x37')]||_0x37fbbb['name']!=='SequelizeValidationError'){logger['error'](util[_0x3ede('0x38')](_0x37fbbb,{'showHidden':![],'depth':null}));}}});}exports[_0x3ede('0x42')]=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 9205ed8..192a885 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 _0xff54=['[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3feb8a,_0x47c784){var _0x4523ca=function(_0x4fba86){while(--_0x4fba86){_0x3feb8a['push'](_0x3feb8a['shift']());}};_0x4523ca(++_0x47c784);}(_0xff54,0x1b9));var _0x4ff5=function(_0x5b8e8d,_0x5f1dc9){_0x5b8e8d=_0x5b8e8d-0x0;var _0x5877db=_0xff54[_0x5b8e8d];return _0x5877db;};'use strict';var _=require(_0x4ff5('0x0'));var moment=require(_0x4ff5('0x1'));var Redis=require(_0x4ff5('0x2'));var util=require(_0x4ff5('0x3'));var config=require(_0x4ff5('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x4ff5('0x5'))(_0x4ff5('0x6'));config[_0x4ff5('0x7')]=_[_0x4ff5('0x8')](config[_0x4ff5('0x7')],{'host':_0x4ff5('0x9'),'port':0x18eb});var io=require(_0x4ff5('0xa'))(new Redis(config[_0x4ff5('0x7')]));function closeInteractions(){var _0x295d3c=[];return db[_0x4ff5('0xb')][_0x4ff5('0xc')]({'raw':!![],'attributes':['id',_0x4ff5('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4ff5('0xe')](0x18,_0x4ff5('0xf'))}}})['then'](function(_0x782e04){if(_0x782e04&&_0x782e04[_0x4ff5('0x10')]){_0x295d3c=_['map'](_0x782e04||[],'id');logger[_0x4ff5('0x11')](_0x4ff5('0x12'),_0x295d3c['join']());return db[_0x4ff5('0xb')][_0x4ff5('0x13')]({'closeReason':_0x4ff5('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x4ff5('0x15')](_0x4ff5('0x16'))},{'where':{'id':_0x295d3c}});}})['then'](function(){if(_0x295d3c&&_0x295d3c[_0x4ff5('0x10')]){logger[_0x4ff5('0x11')](_0x4ff5('0x17'),_0x295d3c[_0x4ff5('0x18')]());for(var _0x2e1945=0x0;_0x2e1945<_0x295d3c['length'];_0x2e1945++){io[_0x4ff5('0x19')]('whatsappInteraction:update',{'id':_0x295d3c[_0x2e1945],'closed':!![]});}}})[_0x4ff5('0x1a')](function(_0x21296e){logger['error'](_0x4ff5('0x1b'),_0x21296e?util['inspect'](_0x21296e,{'showHidden':![],'depth':null}):'');});}exports[_0x4ff5('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc9b8=['info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','moment','ioredis','util','../../mysqldb','schedule','redis','defaults','localhost','WhatsappInteraction','findAll','subtract','hours','then','length','update','timeout','format'];(function(_0x7261e6,_0x3e3bf7){var _0x20d5ed=function(_0x522641){while(--_0x522641){_0x7261e6['push'](_0x7261e6['shift']());}};_0x20d5ed(++_0x3e3bf7);}(_0xc9b8,0x1e3));var _0x8c9b=function(_0x194b4c,_0x7c9ca2){_0x194b4c=_0x194b4c-0x0;var _0x1fdd22=_0xc9b8[_0x194b4c];return _0x1fdd22;};'use strict';var _=require('lodash');var moment=require(_0x8c9b('0x0'));var Redis=require(_0x8c9b('0x1'));var util=require(_0x8c9b('0x2'));var config=require('../../config/environment');var db=require(_0x8c9b('0x3'))['db'];var logger=require('../logger')(_0x8c9b('0x4'));config[_0x8c9b('0x5')]=_[_0x8c9b('0x6')](config[_0x8c9b('0x5')],{'host':_0x8c9b('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8c9b('0x5')]));function closeInteractions(){var _0x4af595=[];return db[_0x8c9b('0x8')][_0x8c9b('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8c9b('0xa')](0x18,_0x8c9b('0xb'))}}})[_0x8c9b('0xc')](function(_0x522e18){if(_0x522e18&&_0x522e18[_0x8c9b('0xd')]){_0x4af595=_['map'](_0x522e18||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4af595['join']());return db[_0x8c9b('0x8')][_0x8c9b('0xe')]({'closeReason':'system','disposition':_0x8c9b('0xf'),'closed':!![],'closedAt':moment()[_0x8c9b('0x10')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4af595}});}})['then'](function(){if(_0x4af595&&_0x4af595['length']){logger[_0x8c9b('0x11')](_0x8c9b('0x12'),_0x4af595['join']());for(var _0x51aaf8=0x0;_0x51aaf8<_0x4af595['length'];_0x51aaf8++){io[_0x8c9b('0x13')](_0x8c9b('0x14'),{'id':_0x4af595[_0x51aaf8],'closed':!![]});}}})[_0x8c9b('0x15')](function(_0x542758){logger[_0x8c9b('0x16')](_0x8c9b('0x17'),_0x542758?util['inspect'](_0x542758,{'showHidden':![],'depth':null}):'');});}exports[_0x8c9b('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 1242664..c09f728 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63f7=['finished\x20populating','contacts1','CmHopper','hopper1','contacts2','catch','util','push','Innocenzo','now','Biondo','@xcally.com','CmContact','destroy','then','bulkCreate','log'];(function(_0x2d2e85,_0x22faa9){var _0x3e9f5e=function(_0x101c22){while(--_0x101c22){_0x2d2e85['push'](_0x2d2e85['shift']());}};_0x3e9f5e(++_0x22faa9);}(_0x63f7,0xb0));var _0x763f=function(_0x3e394e,_0x5ca852){_0x3e394e=_0x3e394e-0x0;var _0x3e1e96=_0x63f7[_0x3e394e];return _0x3e1e96;};'use strict';var util=require(_0x763f('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x763f('0x1')]({'id':i,'firstName':_0x763f('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x763f('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x763f('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x763f('0x3')](),'updatedAt':Date[_0x763f('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x763f('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x763f('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x763f('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x763f('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db[_0x763f('0x6')][_0x763f('0x7')]({'where':{}})[_0x763f('0x8')](function(){return db['CmContact'][_0x763f('0x9')](contacts);})[_0x763f('0x8')](function(){console[_0x763f('0xa')](_0x763f('0xb'),_0x763f('0xc'));return db[_0x763f('0xd')][_0x763f('0x7')]({'where':{}});})[_0x763f('0x8')](function(){return db[_0x763f('0xd')][_0x763f('0x9')](hopper);})['then'](function(){console[_0x763f('0xa')](_0x763f('0xb'),_0x763f('0xe'));return db[_0x763f('0x6')]['bulkCreate'](contacts2);})['then'](function(){console[_0x763f('0xa')](_0x763f('0xb'),_0x763f('0xf'));return db[_0x763f('0xd')][_0x763f('0x9')](hopper2);})[_0x763f('0x8')](function(){console[_0x763f('0xa')](_0x763f('0xb'),'hopper2');})[_0x763f('0x10')](function(_0x174876){console[_0x763f('0xa')](_0x174876);}); \ No newline at end of file +var _0x2709=['push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','CmHopper','hopper1','../mysqldb'];(function(_0x78b7d5,_0x3e368a){var _0x2ce3e6=function(_0x219fcf){while(--_0x219fcf){_0x78b7d5['push'](_0x78b7d5['shift']());}};_0x2ce3e6(++_0x3e368a);}(_0x2709,0x185));var _0x9270=function(_0x19942d,_0x19e972){_0x19942d=_0x19942d-0x0;var _0x1de8a9=_0x2709[_0x19942d];return _0x1de8a9;};'use strict';var util=require('util');var db=require(_0x9270('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9270('0x1')]({'id':i,'firstName':_0x9270('0x2')+i,'lastName':_0x9270('0x3')+i,'phone':0xf879fb460+i,'email':_0x9270('0x4')+i+_0x9270('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x9270('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9270('0x6')](),'updatedAt':Date[_0x9270('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x9270('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x9270('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9270('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x9270('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x9270('0x6')]()});}db[_0x9270('0x7')][_0x9270('0x8')]({'where':{}})[_0x9270('0x9')](function(){return db['CmContact'][_0x9270('0xa')](contacts);})[_0x9270('0x9')](function(){console[_0x9270('0xb')](_0x9270('0xc'),'contacts1');return db[_0x9270('0xd')][_0x9270('0x8')]({'where':{}});})[_0x9270('0x9')](function(){return db[_0x9270('0xd')][_0x9270('0xa')](hopper);})[_0x9270('0x9')](function(){console[_0x9270('0xb')](_0x9270('0xc'),_0x9270('0xe'));return db[_0x9270('0x7')][_0x9270('0xa')](contacts2);})['then'](function(){console[_0x9270('0xb')](_0x9270('0xc'),'contacts2');return db[_0x9270('0xd')][_0x9270('0xa')](hopper2);})['then'](function(){console[_0x9270('0xb')](_0x9270('0xc'),'hopper2');})['catch'](function(_0x154168){console[_0x9270('0xb')](_0x154168);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index c50fc04..b4fa4df 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e47=['push','format','%s%s','agent','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','log','add\x20user','catch','util'];(function(_0x93fed7,_0x4b99f4){var _0x2669c7=function(_0x2a7c85){while(--_0x2a7c85){_0x93fed7['push'](_0x93fed7['shift']());}};_0x2669c7(++_0x4b99f4);}(_0x1e47,0x9f));var _0x71e4=function(_0x307a91,_0x52d098){_0x307a91=_0x307a91-0x0;var _0x37869e=_0x1e47[_0x307a91];return _0x37869e;};'use strict';var util=require(_0x71e4('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x71e4('0x1')]({'name':util[_0x71e4('0x2')](_0x71e4('0x3'),_0x71e4('0x4'),i),'fullname':util[_0x71e4('0x2')](_0x71e4('0x3'),_0x71e4('0x4'),i),'email':util[_0x71e4('0x2')]('%s%s@xcally.com',_0x71e4('0x4'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x71e4('0x5'),'ws','wss'],'disallow':[_0x71e4('0x6')],'allow':[_0x71e4('0x7')],'defaultuser':util[_0x71e4('0x2')](_0x71e4('0x3'),_0x71e4('0x4'),i),'encryption':_0x71e4('0x8'),'avpf':_0x71e4('0x8'),'force_avp':'yes','icesupport':_0x71e4('0x8'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x71e4('0x9'),'dtlsprivatekey':_0x71e4('0xa'),'dtlssetup':_0x71e4('0xb'),'callerid':util[_0x71e4('0x2')]('\x22%s\x22\x20<%s>',util[_0x71e4('0x2')](_0x71e4('0x3'),_0x71e4('0x4'),i),0xfa0+i)});}db[_0x71e4('0xc')]['bulkCreate'](users)['then'](function(){console[_0x71e4('0xd')](_0x71e4('0xe'));})[_0x71e4('0xf')](function(_0x457d55){console[_0x71e4('0xd')](_0x457d55);}); \ No newline at end of file +var _0x30f8=['friend','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','catch','log','util','push','%s%s','agent','format'];(function(_0x510051,_0x19a82f){var _0x204456=function(_0x3ffe00){while(--_0x3ffe00){_0x510051['push'](_0x510051['shift']());}};_0x204456(++_0x19a82f);}(_0x30f8,0x199));var _0x830f=function(_0x532f76,_0x41a8bc){_0x532f76=_0x532f76-0x0;var _0x308592=_0x30f8[_0x532f76];return _0x308592;};'use strict';var util=require(_0x830f('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x830f('0x1')]({'name':util['format'](_0x830f('0x2'),_0x830f('0x3'),i),'fullname':util[_0x830f('0x4')](_0x830f('0x2'),_0x830f('0x3'),i),'email':util[_0x830f('0x4')]('%s%s@xcally.com',_0x830f('0x3'),i),'role':_0x830f('0x3'),'password':'password','internal':0xfa0+i,'type':_0x830f('0x5'),'transport':['udp','ws','wss'],'disallow':[_0x830f('0x6')],'allow':[_0x830f('0x7')],'defaultuser':util[_0x830f('0x4')](_0x830f('0x2'),_0x830f('0x3'),i),'encryption':_0x830f('0x8'),'avpf':_0x830f('0x8'),'force_avp':_0x830f('0x8'),'icesupport':_0x830f('0x8'),'dtlsenable':_0x830f('0x8'),'dtlsverify':'no','dtlscertfile':_0x830f('0x9'),'dtlsprivatekey':_0x830f('0xa'),'dtlssetup':'actpass','callerid':util['format'](_0x830f('0xb'),util[_0x830f('0x4')](_0x830f('0x2'),'agent',i),0xfa0+i)});}db[_0x830f('0xc')][_0x830f('0xd')](users)[_0x830f('0xe')](function(){console['log'](_0x830f('0xf'));})[_0x830f('0x10')](function(_0x2c8353){console[_0x830f('0x11')](_0x2c8353);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 9bc0b92..59c0d01 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x867e=['format','%s:queue:%s','user:%s','handshake','query','User','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','VoiceQueue','ChatQueue','push','FaxQueue','SmsQueue','MailQueue','user','WhatsappQueue','Trunk','IvrCampaigns','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','voice','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','ChatInteractions','emit','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','log','join','default','connection','address','request','remotePort','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','Agents','name','role','agent','telephone','type','ivr','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','where','Campaign'];(function(_0x3ff40a,_0x3ada13){var _0x15e62e=function(_0x1490eb){while(--_0x1490eb){_0x3ff40a['push'](_0x3ff40a['shift']());}};_0x15e62e(++_0x3ada13);}(_0x867e,0x1c5));var _0xe867=function(_0x10a7be,_0x400931){_0x10a7be=_0x10a7be-0x0;var _0x17ab0f=_0x867e[_0x10a7be];return _0x17ab0f;};'use strict';var _=require(_0xe867('0x0'));var util=require(_0xe867('0x1'));var BPromise=require(_0xe867('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xe867('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xe867('0x4'),'model':db['User'],'attributes':['id',_0xe867('0x5'),_0xe867('0x6')],'raw':!![],'where':{'role':_0xe867('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xe867('0x5')],'where':{'role':_0xe867('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xe867('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xe867('0x5')],'where':{'role':_0xe867('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xe867('0x5'),_0xe867('0x9')],'where':{'type':_0xe867('0xa')}};function getAssociatedResources(_0x3a852b,_0x2b0ff4,_0x49e166){return db['UserProfileSection']['findOne']({'where':{'name':_0x3a852b,'userProfileId':_0x2b0ff4},'raw':!![]})[_0xe867('0xb')](function(_0x1a8da8){if(_0x1a8da8){if(_0x1a8da8[_0xe867('0xc')]){switch(_0x3a852b){case _0xe867('0xd'):case _0xe867('0xe'):case _0xe867('0xf'):case _0xe867('0x10'):case _0xe867('0x11'):case _0xe867('0x12'):case _0xe867('0x13'):return db[_0x49e166][_0xe867('0x14')](queryQueues);case _0xe867('0x15'):return db[_0x49e166][_0xe867('0x14')](queryTelephones);case _0xe867('0x16'):return db[_0x49e166]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x49e166][_0xe867('0x14')](queryCampaigns);}}else{return db[_0xe867('0x17')]['findAll']({'attributes':[_0xe867('0x18')],'where':{'sectionId':_0x1a8da8['id']},'raw':!![]})[_0xe867('0xb')](function(_0x559881){if(_0x559881){var _0x477147={'where':{'id':_['map'](_0x559881,_0xe867('0x18'))},'raw':!![]};switch(_0x49e166){case'User':_0x477147[_0xe867('0x19')][_0xe867('0x6')]=_0xe867('0x8');break;case _0xe867('0x1a'):_0x477147[_0xe867('0x19')]['type']='ivr';break;}return db[_0x49e166]['findAll'](_0x477147);}else{return[];}});}}else{return[];}})[_0xe867('0xb')](function(_0x481ad4){return _0x481ad4;});}function joinOrLeaveQueues(_0x2128f9,_0x2d9acb,_0x25d429,_0x21a471){_0x2128f9[_0x2d9acb](util[_0xe867('0x1b')](_0xe867('0x1c'),_0x25d429,_0x21a471[_0xe867('0x5')]));if(_0x21a471[_0xe867('0x4')]){for(var _0x5aeda6=0x0;_0x5aeda6<_0x21a471[_0xe867('0x4')]['length'];_0x5aeda6+=0x1){_0x2128f9[_0x2d9acb](util['format'](_0xe867('0x1d'),_0x21a471[_0xe867('0x4')][_0x5aeda6][_0xe867('0x5')]));}}}function joinOrLeave(_0x53a333,_0x491dd8,_0x537c4d){var _0x226e92;if(_0x53a333[_0xe867('0x1e')][_0xe867('0x1f')]['id']){db[_0xe867('0x20')][_0xe867('0x21')]({'attributes':['id',_0xe867('0x5'),'role',_0xe867('0x22')],'where':{'id':_0x53a333[_0xe867('0x1e')][_0xe867('0x1f')]['id']},'include':[{'model':db[_0xe867('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe867('0x24')],'as':_0xe867('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xe867('0x26')],'as':_0xe867('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xe867('0x28')],'as':_0xe867('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xe867('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe867('0x2b')],'as':_0xe867('0x2c'),'attributes':['id'],'raw':!![]}]})[_0xe867('0xb')](function(_0x3abcee){if(_0x3abcee){_0x226e92=_0x3abcee;_0x53a333[_0x491dd8](util[_0xe867('0x1b')](_0xe867('0x1d'),_0x3abcee[_0xe867('0x5')]));var _0x36117c=[];switch(_0x3abcee['role']){case _0xe867('0x2d'):_0x53a333[_0x491dd8](_0xe867('0x2e'));_0x53a333[_0x491dd8](_0xe867('0x2f'));if(queryQueues['hasOwnProperty'](_0xe867('0x30'))){delete queryQueues[_0xe867('0x30')];}_0x36117c['push'](db[_0xe867('0x31')]['findAll'](queryQueues));_0x36117c['push'](db[_0xe867('0x32')]['findAll'](queryQueues));_0x36117c[_0xe867('0x33')](db[_0xe867('0x34')]['findAll'](queryQueues));_0x36117c[_0xe867('0x33')](db[_0xe867('0x35')]['findAll'](queryQueues));_0x36117c[_0xe867('0x33')](db[_0xe867('0x36')][_0xe867('0x14')](queryQueues));_0x36117c[_0xe867('0x33')](db['OpenchannelQueue'][_0xe867('0x14')](queryQueues));_0x36117c['push'](db['WhatsappQueue'][_0xe867('0x14')](queryQueues));_0x36117c[_0xe867('0x33')](db['User'][_0xe867('0x14')](queryTelephones));_0x36117c[_0xe867('0x33')](db['Trunk'][_0xe867('0x14')](queryTrunks));_0x36117c[_0xe867('0x33')](db[_0xe867('0x1a')][_0xe867('0x14')](queryCampaigns));_0x36117c['push'](db[_0xe867('0x20')][_0xe867('0x14')](queryAgents));break;case _0xe867('0x37'):_0x53a333[_0x491dd8](_0xe867('0x2e'));_0x53a333[_0x491dd8](_0xe867('0x2f'));_0x36117c[_0xe867('0x33')](getAssociatedResources(_0xe867('0xd'),_0x3abcee[_0xe867('0x22')],'VoiceQueue'));_0x36117c['push'](getAssociatedResources(_0xe867('0xe'),_0x3abcee[_0xe867('0x22')],_0xe867('0x32')));_0x36117c['push'](getAssociatedResources(_0xe867('0xf'),_0x3abcee[_0xe867('0x22')],_0xe867('0x34')));_0x36117c[_0xe867('0x33')](getAssociatedResources(_0xe867('0x10'),_0x3abcee[_0xe867('0x22')],'SmsQueue'));_0x36117c[_0xe867('0x33')](getAssociatedResources('MailQueues',_0x3abcee['userProfileId'],_0xe867('0x36')));_0x36117c[_0xe867('0x33')](getAssociatedResources(_0xe867('0x12'),_0x3abcee[_0xe867('0x22')],'OpenchannelQueue'));_0x36117c['push'](getAssociatedResources(_0xe867('0x13'),_0x3abcee[_0xe867('0x22')],_0xe867('0x38')));_0x36117c[_0xe867('0x33')](getAssociatedResources('Telephones',_0x3abcee['userProfileId'],_0xe867('0x20')));_0x36117c[_0xe867('0x33')](getAssociatedResources(_0xe867('0x16'),_0x3abcee['userProfileId'],_0xe867('0x39')));_0x36117c[_0xe867('0x33')](getAssociatedResources(_0xe867('0x3a'),_0x3abcee[_0xe867('0x22')],_0xe867('0x1a')));_0x36117c[_0xe867('0x33')](db[_0xe867('0x20')]['findAll'](queryAgents));break;case _0xe867('0x7'):_0x53a333[_0x491dd8](_0xe867('0x2e'));_0x53a333[_0x491dd8](_0xe867('0x2f'));_0x36117c['push'](_0x3abcee[_0xe867('0x3b')]({'attributes':['id','name']}));_0x36117c['push'](_0x3abcee['getChatQueues']({'attributes':['id',_0xe867('0x5')]}));_0x36117c[_0xe867('0x33')](_0x3abcee[_0xe867('0x3c')]({'attributes':['id',_0xe867('0x5')]}));_0x36117c[_0xe867('0x33')](_0x3abcee[_0xe867('0x3d')]({'attributes':['id','name']}));_0x36117c[_0xe867('0x33')](_0x3abcee[_0xe867('0x3e')]({'attributes':['id',_0xe867('0x5')]}));_0x36117c[_0xe867('0x33')](_0x3abcee['getOpenchannelQueues']({'attributes':['id',_0xe867('0x5')]}));_0x36117c[_0xe867('0x33')](_0x3abcee[_0xe867('0x3f')]({'attributes':['id','name']}));break;}return BPromise[_0xe867('0x40')](_0x36117c);}})['then'](function(_0x15238d){if(_0x15238d&&_0x15238d[_0xe867('0x41')]){for(var _0x57dd08=0x0;_0x57dd08<_0x15238d['length'];_0x57dd08+=0x1){for(var _0xb0e302=0x0;_0xb0e302<_0x15238d[_0x57dd08][_0xe867('0x41')];_0xb0e302+=0x1){switch(_0x57dd08){case 0x0:joinOrLeaveQueues(_0x53a333,_0x491dd8,_0xe867('0x42'),_0x15238d[_0x57dd08][_0xb0e302]);break;case 0x1:joinOrLeaveQueues(_0x53a333,_0x491dd8,'chat',_0x15238d[_0x57dd08][_0xb0e302]);break;case 0x2:joinOrLeaveQueues(_0x53a333,_0x491dd8,'fax',_0x15238d[_0x57dd08][_0xb0e302]);break;case 0x3:joinOrLeaveQueues(_0x53a333,_0x491dd8,_0xe867('0x43'),_0x15238d[_0x57dd08][_0xb0e302]);break;case 0x4:joinOrLeaveQueues(_0x53a333,_0x491dd8,_0xe867('0x44'),_0x15238d[_0x57dd08][_0xb0e302]);break;case 0x5:joinOrLeaveQueues(_0x53a333,_0x491dd8,_0xe867('0x45'),_0x15238d[_0x57dd08][_0xb0e302]);break;case 0x6:joinOrLeaveQueues(_0x53a333,_0x491dd8,_0xe867('0x46'),_0x15238d[_0x57dd08][_0xb0e302]);break;case 0x7:if(_0x226e92[_0xe867('0x6')]!=='agent')_0x53a333[_0x491dd8](util[_0xe867('0x1b')](_0xe867('0x47'),_0x15238d[_0x57dd08][_0xb0e302]['name']));break;case 0x8:if(_0x226e92[_0xe867('0x6')]!==_0xe867('0x7'))_0x53a333[_0x491dd8](util[_0xe867('0x1b')](_0xe867('0x48'),_0x15238d[_0x57dd08][_0xb0e302][_0xe867('0x5')]));break;case 0x9:if(_0x226e92[_0xe867('0x6')]!==_0xe867('0x7'))_0x53a333[_0x491dd8](util['format'](_0xe867('0x49'),_0x15238d[_0x57dd08][_0xb0e302][_0xe867('0x9')],_0x15238d[_0x57dd08][_0xb0e302][_0xe867('0x5')]));break;case 0xa:_0x53a333[_0x491dd8](util[_0xe867('0x1b')](_0xe867('0x1d'),_0x15238d[_0x57dd08][_0xb0e302][_0xe867('0x5')]));break;}}}}})[_0xe867('0xb')](function(){if(_0x491dd8===_0xe867('0x4a')){var _0x545048=_[_0xe867('0x4b')](_0x226e92[_0xe867('0x4c')],'id');return _0x226e92['removeChatInteractions'](_0x545048)[_0xe867('0xb')](function(){for(var _0x10404e=0x0;_0x10404e<_0x545048['length'];_0x10404e+=0x1){_0x537c4d[_0xe867('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x545048[_0x10404e]),'UserId':Number(_0x226e92['id'])});}});}})[_0xe867('0xb')](function(){if(_0x491dd8==='leave'){var _0x55728b=_[_0xe867('0x4b')](_0x226e92[_0xe867('0x25')],'id');return _0x226e92[_0xe867('0x4e')](_0x55728b)[_0xe867('0xb')](function(){for(var _0x57b438=0x0;_0x57b438<_0x55728b[_0xe867('0x41')];_0x57b438+=0x1){_0x537c4d[_0xe867('0x4d')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x55728b[_0x57b438]),'UserId':Number(_0x226e92['id'])});}});}})[_0xe867('0xb')](function(){if(_0x491dd8===_0xe867('0x4a')){var _0x16f46a=_['map'](_0x226e92[_0xe867('0x27')],'id');return _0x226e92[_0xe867('0x4f')](_0x16f46a)[_0xe867('0xb')](function(){for(var _0x1e1668=0x0;_0x1e1668<_0x16f46a[_0xe867('0x41')];_0x1e1668+=0x1){_0x537c4d[_0xe867('0x4d')](_0xe867('0x50'),{'FaxInteractionId':Number(_0x16f46a[_0x1e1668]),'UserId':Number(_0x226e92['id'])});}});}})['then'](function(){if(_0x491dd8==='leave'){var _0x5d36cd=_[_0xe867('0x4b')](_0x226e92[_0xe867('0x29')],'id');return _0x226e92[_0xe867('0x51')](_0x5d36cd)['then'](function(){for(var _0xd7238=0x0;_0xd7238<_0x5d36cd[_0xe867('0x41')];_0xd7238+=0x1){_0x537c4d[_0xe867('0x4d')](_0xe867('0x52'),{'SmsInteractionId':Number(_0x5d36cd[_0xd7238]),'UserId':Number(_0x226e92['id'])});}});}})[_0xe867('0xb')](function(){if(_0x491dd8===_0xe867('0x4a')){var _0xc8f272=_[_0xe867('0x4b')](_0x226e92['OpenchannelInteractions'],'id');return _0x226e92[_0xe867('0x53')](_0xc8f272)['then'](function(){for(var _0x406289=0x0;_0x406289<_0xc8f272['length'];_0x406289+=0x1){_0x537c4d[_0xe867('0x4d')](_0xe867('0x54'),{'OpenchannelInteractionId':Number(_0xc8f272[_0x406289]),'UserId':Number(_0x226e92['id'])});}});}})[_0xe867('0xb')](function(){if(_0x491dd8===_0xe867('0x4a')){var _0x26d868=_['map'](_0x226e92['WhatsappInteractions'],'id');return _0x226e92['removeWhatsappInteractions'](_0x26d868)[_0xe867('0xb')](function(){for(var _0x265048=0x0;_0x265048<_0x26d868[_0xe867('0x41')];_0x265048+=0x1){_0x537c4d['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x26d868[_0x265048]),'UserId':Number(_0x226e92['id'])});}});}})['catch'](function(_0x5c25fc){_0x53a333[_0xe867('0x55')](_0x5c25fc);});}}function onDisconnect(_0x1e2aa7,_0x31252b){joinOrLeave(_0x1e2aa7,_0xe867('0x4a'),_0x31252b);}function onConnect(_0x2db83a){joinOrLeave(_0x2db83a,_0xe867('0x56'));}exports[_0xe867('0x57')]=function(_0x28882e){_0x28882e['on'](_0xe867('0x58'),function(_0x323912){_0x323912['setMaxListeners'](0x0);_0x323912[_0xe867('0x59')]=_0x323912['request'][_0xe867('0x58')]['remoteAddress']+':'+_0x323912[_0xe867('0x5a')][_0xe867('0x58')][_0xe867('0x5b')];_0x323912['connectedAt']=new Date();_0x323912[_0xe867('0x55')]=function(_0x2c1ba7){console[_0xe867('0x55')](_0xe867('0x5c')+_0x323912[_0xe867('0x5d')][_0xe867('0x5')]+'['+_0x323912[_0xe867('0x59')]+']',_0x2c1ba7);};_0x323912['on']('disconnect',function(){onDisconnect(_0x323912,_0x28882e);_0x323912[_0xe867('0x55')](_0xe867('0x5e'));});onConnect(_0x323912);_0x323912['log'](_0xe867('0x5f'));});}; \ No newline at end of file +var _0x9147=['sms','openchannel','whatsapp','telephone:%s','trunk:%s','map','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','leave','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','role','agent','telephone','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','User','where','Campaign','type','ivr','%s:queue:%s','format','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','voice:inbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:outbound','VoiceQueues','VoiceQueue','FaxQueue','WhatsappQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x9147,0x81));var _0x7914=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x9147[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7914('0x0'));var util=require(_0x7914('0x1'));var BPromise=require(_0x7914('0x2'));var db=require(_0x7914('0x3'))['db'];var config=require(_0x7914('0x4'));var queryQueues={'attributes':['id',_0x7914('0x5')],'include':[{'as':_0x7914('0x6'),'model':db['User'],'attributes':['id',_0x7914('0x5'),_0x7914('0x7')],'raw':!![],'where':{'role':_0x7914('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7914('0x5')],'where':{'role':_0x7914('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x7914('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7914('0x5'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0xa22f08,_0x8ce32,_0x2d6ea3){return db['UserProfileSection'][_0x7914('0xa')]({'where':{'name':_0xa22f08,'userProfileId':_0x8ce32},'raw':!![]})[_0x7914('0xb')](function(_0x5e8bc5){if(_0x5e8bc5){if(_0x5e8bc5[_0x7914('0xc')]){switch(_0xa22f08){case'VoiceQueues':case _0x7914('0xd'):case _0x7914('0xe'):case _0x7914('0xf'):case _0x7914('0x10'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x2d6ea3][_0x7914('0x11')](queryQueues);case _0x7914('0x12'):return db[_0x2d6ea3]['findAll'](queryTelephones);case _0x7914('0x13'):return db[_0x2d6ea3][_0x7914('0x11')](queryTrunks);case _0x7914('0x14'):return db[_0x2d6ea3][_0x7914('0x11')](queryCampaigns);}}else{return db[_0x7914('0x15')][_0x7914('0x11')]({'attributes':[_0x7914('0x16')],'where':{'sectionId':_0x5e8bc5['id']},'raw':!![]})['then'](function(_0x289740){if(_0x289740){var _0x26561a={'where':{'id':_['map'](_0x289740,_0x7914('0x16'))},'raw':!![]};switch(_0x2d6ea3){case _0x7914('0x17'):_0x26561a[_0x7914('0x18')][_0x7914('0x7')]=_0x7914('0x9');break;case _0x7914('0x19'):_0x26561a['where'][_0x7914('0x1a')]=_0x7914('0x1b');break;}return db[_0x2d6ea3][_0x7914('0x11')](_0x26561a);}else{return[];}});}}else{return[];}})[_0x7914('0xb')](function(_0x463e70){return _0x463e70;});}function joinOrLeaveQueues(_0x10d5d2,_0x59c2b1,_0xf9f7fa,_0x2c91c9){_0x10d5d2[_0x59c2b1](util['format'](_0x7914('0x1c'),_0xf9f7fa,_0x2c91c9[_0x7914('0x5')]));if(_0x2c91c9[_0x7914('0x6')]){for(var _0x38af0a=0x0;_0x38af0a<_0x2c91c9[_0x7914('0x6')]['length'];_0x38af0a+=0x1){_0x10d5d2[_0x59c2b1](util[_0x7914('0x1d')](_0x7914('0x1e'),_0x2c91c9[_0x7914('0x6')][_0x38af0a][_0x7914('0x5')]));}}}function joinOrLeave(_0x37cc3a,_0x560436,_0x87fe22){var _0x50b341;if(_0x37cc3a[_0x7914('0x1f')][_0x7914('0x20')]['id']){db[_0x7914('0x17')]['find']({'attributes':['id','name',_0x7914('0x7'),_0x7914('0x21')],'where':{'id':_0x37cc3a[_0x7914('0x1f')][_0x7914('0x20')]['id']},'include':[{'model':db[_0x7914('0x22')],'as':_0x7914('0x23'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x7914('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x7914('0x25')],'as':_0x7914('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x7914('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x7914('0x28')],'as':_0x7914('0x29'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x7914('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x7914('0xb')](function(_0x106120){if(_0x106120){_0x50b341=_0x106120;_0x37cc3a[_0x560436](util[_0x7914('0x1d')]('user:%s',_0x106120[_0x7914('0x5')]));var _0x4d45ae=[];switch(_0x106120[_0x7914('0x7')]){case'admin':_0x37cc3a[_0x560436](_0x7914('0x2b'));_0x37cc3a[_0x560436]('voice:outbound');if(queryQueues[_0x7914('0x2c')](_0x7914('0x2d'))){delete queryQueues['include'];}_0x4d45ae[_0x7914('0x2e')](db['VoiceQueue']['findAll'](queryQueues));_0x4d45ae[_0x7914('0x2e')](db[_0x7914('0x2f')][_0x7914('0x11')](queryQueues));_0x4d45ae[_0x7914('0x2e')](db['FaxQueue'][_0x7914('0x11')](queryQueues));_0x4d45ae['push'](db[_0x7914('0x30')][_0x7914('0x11')](queryQueues));_0x4d45ae[_0x7914('0x2e')](db[_0x7914('0x31')][_0x7914('0x11')](queryQueues));_0x4d45ae[_0x7914('0x2e')](db[_0x7914('0x32')][_0x7914('0x11')](queryQueues));_0x4d45ae[_0x7914('0x2e')](db[_0x7914('0x33')]['findAll'](queryQueues));_0x4d45ae[_0x7914('0x2e')](db[_0x7914('0x17')]['findAll'](queryTelephones));_0x4d45ae['push'](db[_0x7914('0x34')][_0x7914('0x11')](queryTrunks));_0x4d45ae[_0x7914('0x2e')](db[_0x7914('0x19')][_0x7914('0x11')](queryCampaigns));_0x4d45ae[_0x7914('0x2e')](db['User'][_0x7914('0x11')](queryAgents));break;case'user':_0x37cc3a[_0x560436]('voice:inbound');_0x37cc3a[_0x560436](_0x7914('0x35'));_0x4d45ae[_0x7914('0x2e')](getAssociatedResources(_0x7914('0x36'),_0x106120[_0x7914('0x21')],_0x7914('0x37')));_0x4d45ae['push'](getAssociatedResources(_0x7914('0xd'),_0x106120[_0x7914('0x21')],_0x7914('0x2f')));_0x4d45ae[_0x7914('0x2e')](getAssociatedResources(_0x7914('0xe'),_0x106120[_0x7914('0x21')],_0x7914('0x38')));_0x4d45ae[_0x7914('0x2e')](getAssociatedResources('SmsQueues',_0x106120[_0x7914('0x21')],'SmsQueue'));_0x4d45ae['push'](getAssociatedResources('MailQueues',_0x106120[_0x7914('0x21')],_0x7914('0x31')));_0x4d45ae['push'](getAssociatedResources('OpenchannelQueues',_0x106120['userProfileId'],_0x7914('0x32')));_0x4d45ae['push'](getAssociatedResources(_0x7914('0x39'),_0x106120[_0x7914('0x21')],_0x7914('0x33')));_0x4d45ae[_0x7914('0x2e')](getAssociatedResources(_0x7914('0x12'),_0x106120[_0x7914('0x21')],_0x7914('0x17')));_0x4d45ae[_0x7914('0x2e')](getAssociatedResources('Trunks',_0x106120['userProfileId'],_0x7914('0x34')));_0x4d45ae['push'](getAssociatedResources(_0x7914('0x14'),_0x106120['userProfileId'],_0x7914('0x19')));_0x4d45ae[_0x7914('0x2e')](db[_0x7914('0x17')]['findAll'](queryAgents));break;case'agent':_0x37cc3a[_0x560436](_0x7914('0x2b'));_0x37cc3a[_0x560436](_0x7914('0x35'));_0x4d45ae['push'](_0x106120['getVoiceQueues']({'attributes':['id',_0x7914('0x5')]}));_0x4d45ae['push'](_0x106120['getChatQueues']({'attributes':['id','name']}));_0x4d45ae[_0x7914('0x2e')](_0x106120[_0x7914('0x3a')]({'attributes':['id',_0x7914('0x5')]}));_0x4d45ae[_0x7914('0x2e')](_0x106120[_0x7914('0x3b')]({'attributes':['id',_0x7914('0x5')]}));_0x4d45ae[_0x7914('0x2e')](_0x106120[_0x7914('0x3c')]({'attributes':['id',_0x7914('0x5')]}));_0x4d45ae['push'](_0x106120[_0x7914('0x3d')]({'attributes':['id',_0x7914('0x5')]}));_0x4d45ae[_0x7914('0x2e')](_0x106120[_0x7914('0x3e')]({'attributes':['id','name']}));break;}return BPromise[_0x7914('0x3f')](_0x4d45ae);}})['then'](function(_0xa02ddc){if(_0xa02ddc&&_0xa02ddc[_0x7914('0x40')]){for(var _0x3e03f5=0x0;_0x3e03f5<_0xa02ddc[_0x7914('0x40')];_0x3e03f5+=0x1){for(var _0x12f05e=0x0;_0x12f05e<_0xa02ddc[_0x3e03f5][_0x7914('0x40')];_0x12f05e+=0x1){switch(_0x3e03f5){case 0x0:joinOrLeaveQueues(_0x37cc3a,_0x560436,_0x7914('0x41'),_0xa02ddc[_0x3e03f5][_0x12f05e]);break;case 0x1:joinOrLeaveQueues(_0x37cc3a,_0x560436,_0x7914('0x42'),_0xa02ddc[_0x3e03f5][_0x12f05e]);break;case 0x2:joinOrLeaveQueues(_0x37cc3a,_0x560436,'fax',_0xa02ddc[_0x3e03f5][_0x12f05e]);break;case 0x3:joinOrLeaveQueues(_0x37cc3a,_0x560436,_0x7914('0x43'),_0xa02ddc[_0x3e03f5][_0x12f05e]);break;case 0x4:joinOrLeaveQueues(_0x37cc3a,_0x560436,'mail',_0xa02ddc[_0x3e03f5][_0x12f05e]);break;case 0x5:joinOrLeaveQueues(_0x37cc3a,_0x560436,_0x7914('0x44'),_0xa02ddc[_0x3e03f5][_0x12f05e]);break;case 0x6:joinOrLeaveQueues(_0x37cc3a,_0x560436,_0x7914('0x45'),_0xa02ddc[_0x3e03f5][_0x12f05e]);break;case 0x7:if(_0x50b341[_0x7914('0x7')]!=='agent')_0x37cc3a[_0x560436](util[_0x7914('0x1d')](_0x7914('0x46'),_0xa02ddc[_0x3e03f5][_0x12f05e]['name']));break;case 0x8:if(_0x50b341[_0x7914('0x7')]!==_0x7914('0x8'))_0x37cc3a[_0x560436](util['format'](_0x7914('0x47'),_0xa02ddc[_0x3e03f5][_0x12f05e][_0x7914('0x5')]));break;case 0x9:if(_0x50b341[_0x7914('0x7')]!=='agent')_0x37cc3a[_0x560436](util[_0x7914('0x1d')]('campaign:%s:%s',_0xa02ddc[_0x3e03f5][_0x12f05e]['type'],_0xa02ddc[_0x3e03f5][_0x12f05e][_0x7914('0x5')]));break;case 0xa:_0x37cc3a[_0x560436](util[_0x7914('0x1d')](_0x7914('0x1e'),_0xa02ddc[_0x3e03f5][_0x12f05e][_0x7914('0x5')]));break;}}}}})[_0x7914('0xb')](function(){if(_0x560436==='leave'){var _0x24b773=_[_0x7914('0x48')](_0x50b341[_0x7914('0x23')],'id');return _0x50b341[_0x7914('0x49')](_0x24b773)[_0x7914('0xb')](function(){for(var _0x49c1f3=0x0;_0x49c1f3<_0x24b773[_0x7914('0x40')];_0x49c1f3+=0x1){_0x87fe22['emit'](_0x7914('0x4a'),{'ChatInteractionId':Number(_0x24b773[_0x49c1f3]),'UserId':Number(_0x50b341['id'])});}});}})[_0x7914('0xb')](function(){if(_0x560436==='leave'){var _0x72013e=_[_0x7914('0x48')](_0x50b341[_0x7914('0x24')],'id');return _0x50b341[_0x7914('0x4b')](_0x72013e)[_0x7914('0xb')](function(){for(var _0x3285fc=0x0;_0x3285fc<_0x72013e[_0x7914('0x40')];_0x3285fc+=0x1){_0x87fe22[_0x7914('0x4c')](_0x7914('0x4d'),{'MailInteractionId':Number(_0x72013e[_0x3285fc]),'UserId':Number(_0x50b341['id'])});}});}})[_0x7914('0xb')](function(){if(_0x560436===_0x7914('0x4e')){var _0x3b1fdb=_[_0x7914('0x48')](_0x50b341[_0x7914('0x26')],'id');return _0x50b341[_0x7914('0x4f')](_0x3b1fdb)[_0x7914('0xb')](function(){for(var _0x56a3d6=0x0;_0x56a3d6<_0x3b1fdb[_0x7914('0x40')];_0x56a3d6+=0x1){_0x87fe22[_0x7914('0x4c')](_0x7914('0x50'),{'FaxInteractionId':Number(_0x3b1fdb[_0x56a3d6]),'UserId':Number(_0x50b341['id'])});}});}})[_0x7914('0xb')](function(){if(_0x560436===_0x7914('0x4e')){var _0x44aa64=_[_0x7914('0x48')](_0x50b341[_0x7914('0x27')],'id');return _0x50b341['removeSmsInteractions'](_0x44aa64)['then'](function(){for(var _0x334f52=0x0;_0x334f52<_0x44aa64[_0x7914('0x40')];_0x334f52+=0x1){_0x87fe22[_0x7914('0x4c')](_0x7914('0x51'),{'SmsInteractionId':Number(_0x44aa64[_0x334f52]),'UserId':Number(_0x50b341['id'])});}});}})['then'](function(){if(_0x560436===_0x7914('0x4e')){var _0x5c3969=_[_0x7914('0x48')](_0x50b341['OpenchannelInteractions'],'id');return _0x50b341[_0x7914('0x52')](_0x5c3969)[_0x7914('0xb')](function(){for(var _0x3e94e0=0x0;_0x3e94e0<_0x5c3969[_0x7914('0x40')];_0x3e94e0+=0x1){_0x87fe22[_0x7914('0x4c')](_0x7914('0x53'),{'OpenchannelInteractionId':Number(_0x5c3969[_0x3e94e0]),'UserId':Number(_0x50b341['id'])});}});}})['then'](function(){if(_0x560436===_0x7914('0x4e')){var _0x59cf20=_[_0x7914('0x48')](_0x50b341[_0x7914('0x2a')],'id');return _0x50b341['removeWhatsappInteractions'](_0x59cf20)['then'](function(){for(var _0x401406=0x0;_0x401406<_0x59cf20[_0x7914('0x40')];_0x401406+=0x1){_0x87fe22['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x59cf20[_0x401406]),'UserId':Number(_0x50b341['id'])});}});}})['catch'](function(_0x191a05){_0x37cc3a[_0x7914('0x54')](_0x191a05);});}}function onDisconnect(_0x2612ac,_0x2467f4){joinOrLeave(_0x2612ac,'leave',_0x2467f4);}function onConnect(_0x33180b){joinOrLeave(_0x33180b,_0x7914('0x55'));}exports[_0x7914('0x56')]=function(_0x32f7f1){_0x32f7f1['on']('connection',function(_0xf2c3f5){_0xf2c3f5[_0x7914('0x57')](0x0);_0xf2c3f5[_0x7914('0x58')]=_0xf2c3f5[_0x7914('0x59')][_0x7914('0x5a')][_0x7914('0x5b')]+':'+_0xf2c3f5[_0x7914('0x59')][_0x7914('0x5a')][_0x7914('0x5c')];_0xf2c3f5['connectedAt']=new Date();_0xf2c3f5[_0x7914('0x54')]=function(_0x1ebce6){console[_0x7914('0x54')](_0x7914('0x5d')+_0xf2c3f5[_0x7914('0x5e')][_0x7914('0x5')]+'['+_0xf2c3f5[_0x7914('0x58')]+']',_0x1ebce6);};_0xf2c3f5['on'](_0x7914('0x5f'),function(){onDisconnect(_0xf2c3f5,_0x32f7f1);_0xf2c3f5[_0x7914('0x54')](_0x7914('0x60'));});onConnect(_0xf2c3f5);_0xf2c3f5[_0x7914('0x54')](_0x7914('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index dd632cf..c20a57f 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 _0xaa19=['get','channel','motionChannel','event','direction','resolve','ContactId','undefined','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','name','outgoingmessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','agent','changed','closed','substatus','AfterUpdate','User','find','fullname','email','internal','default','length','hasOwnProperty','model','hook','callback','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','code','Trigger,\x20%s','catch'];(function(_0x2ecd0e,_0x33a388){var _0x10432a=function(_0x64c731){while(--_0x64c731){_0x2ecd0e['push'](_0x2ecd0e['shift']());}};_0x10432a(++_0x33a388);}(_0xaa19,0x197));var _0x9aa1=function(_0x12425b,_0x36ffb1){_0x12425b=_0x12425b-0x0;var _0x26e107=_0xaa19[_0x12425b];return _0x26e107;};'use strict';var util=require('util');var db=require('../../mysqldb')['db'];var jayson=require(_0x9aa1('0x0'));var logger=require(_0x9aa1('0x1'))(_0x9aa1('0x2'));var client=jayson[_0x9aa1('0x3')][_0x9aa1('0x4')]({'port':0x232a});var triggers=[{'channel':_0x9aa1('0x5'),'model':_0x9aa1('0x6'),'event':'afterCreate','condition':_0x9aa1('0x7'),'callback':afterCreate},{'channel':_0x9aa1('0x5'),'model':_0x9aa1('0x6'),'event':_0x9aa1('0x8'),'condition':_0x9aa1('0x9'),'callback':afterUpdate},{'channel':_0x9aa1('0x5'),'model':_0x9aa1('0xa'),'event':_0x9aa1('0xb'),'condition':_0x9aa1('0xc'),'callback':afterCreateMessage},{'channel':_0x9aa1('0x5'),'model':_0x9aa1('0xd'),'event':_0x9aa1('0xb'),'condition':_0x9aa1('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0x9aa1('0xe'),'model':_0x9aa1('0xf'),'event':_0x9aa1('0xb'),'condition':_0x9aa1('0x7'),'callback':afterCreate},{'channel':_0x9aa1('0xe'),'model':_0x9aa1('0xf'),'event':_0x9aa1('0x8'),'condition':_0x9aa1('0x9'),'callback':afterUpdate},{'channel':'Sms','model':_0x9aa1('0x10'),'event':_0x9aa1('0xb'),'condition':_0x9aa1('0xc'),'callback':afterCreateMessage},{'channel':_0x9aa1('0x11'),'model':_0x9aa1('0x12'),'event':_0x9aa1('0xb'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x9aa1('0x11'),'model':_0x9aa1('0x12'),'event':_0x9aa1('0x8'),'condition':_0x9aa1('0x9'),'callback':afterUpdate},{'channel':_0x9aa1('0x11'),'model':_0x9aa1('0x13'),'event':_0x9aa1('0xb'),'condition':_0x9aa1('0xc'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x9aa1('0x14'),'event':_0x9aa1('0xb'),'condition':_0x9aa1('0x7'),'callback':afterCreate},{'channel':_0x9aa1('0x15'),'model':_0x9aa1('0x14'),'event':_0x9aa1('0x8'),'condition':_0x9aa1('0x9'),'callback':afterUpdate},{'channel':_0x9aa1('0x15'),'model':_0x9aa1('0x16'),'event':_0x9aa1('0xb'),'condition':_0x9aa1('0xc'),'callback':afterCreateMessage},{'channel':_0x9aa1('0x17'),'model':_0x9aa1('0x18'),'event':'afterCreate','condition':_0x9aa1('0x7'),'callback':afterCreate},{'channel':_0x9aa1('0x17'),'model':_0x9aa1('0x18'),'event':_0x9aa1('0x8'),'condition':_0x9aa1('0x9'),'callback':afterUpdate},{'channel':'Mail','model':_0x9aa1('0x19'),'event':_0x9aa1('0xb'),'condition':_0x9aa1('0xc'),'callback':afterCreateMessage},{'channel':_0x9aa1('0x1a'),'model':'OpenchannelInteraction','event':_0x9aa1('0xb'),'condition':_0x9aa1('0x7'),'callback':afterCreate},{'channel':_0x9aa1('0x1a'),'model':_0x9aa1('0x1b'),'event':_0x9aa1('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9aa1('0x1a'),'model':_0x9aa1('0x1c'),'event':_0x9aa1('0xb'),'condition':_0x9aa1('0xc'),'callback':afterCreateMessage}];function request(_0x4d949e){return client[_0x9aa1('0x1d')](_0x9aa1('0x1e'),_0x4d949e)[_0x9aa1('0x1f')](function(_0xb4c43c){logger[_0x9aa1('0x20')]('Trigger,\x20%s',_0x9aa1('0x1e'),_0xb4c43c);if(_0xb4c43c[_0x9aa1('0x21')]){if(_0xb4c43c['error'][_0x9aa1('0x22')]===0x1f4){logger[_0x9aa1('0x21')](_0x9aa1('0x23'),'EventManager',_0xb4c43c['error']);}}})[_0x9aa1('0x24')](function(_0x5a7011){logger['error'](_0x9aa1('0x23'),_0x9aa1('0x1e'),_0x5a7011);});}function afterCreateMessage(_0x619dcd){return function(_0x55c858){_0x55c858=_0x55c858[_0x9aa1('0x25')]({'plain':!![]});_0x55c858[_0x9aa1('0x26')]=_0x619dcd;_0x55c858[_0x9aa1('0x27')]=_0x619dcd;_0x55c858[_0x9aa1('0x28')]=_0x55c858[_0x9aa1('0x29')];Promise[_0x9aa1('0x2a')]()[_0x9aa1('0x1f')](function(){if(typeof _0x55c858[_0x9aa1('0x2b')]===_0x9aa1('0x2c'))return null;var _0x535f66='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x55c858[_0x9aa1('0x2b')];return db['sequelize'][_0x9aa1('0x2d')](_0x535f66,{'type':db[_0x9aa1('0x2e')][_0x9aa1('0x2f')][_0x9aa1('0x30')],'raw':!![]});})['then'](function(_0x28f861){if(_0x28f861){_0x55c858[_0x9aa1('0x31')]=_0x28f861[0x0];}if(typeof _0x55c858['UserId']===_0x9aa1('0x2c'))return;return getAgent(_0x55c858[_0x9aa1('0x32')]);})['then'](function(_0x469188){if(_0x469188){_0x55c858[_0x9aa1('0x33')]=util[_0x9aa1('0x34')](_0x9aa1('0x35'),_0x469188[_0x9aa1('0x36')]);_0x55c858['agent']=_0x469188;_0x55c858[_0x9aa1('0x26')]=_0x619dcd;return request({'event':'incomingmessage','message':_0x55c858});}else{return request({'event':_0x9aa1('0x37'),'message':_0x55c858});}})['catch'](function(_0x583411){logger[_0x9aa1('0x21')]('Trigger,\x20%s','AfterCreateMessage',_0x583411);});};}function afterCreateOfflineMessage(_0x1d0e5d){return function(_0x5105b2){_0x5105b2=_0x5105b2['get']({'plain':!![]});_0x5105b2[_0x9aa1('0x26')]=_0x1d0e5d;_0x5105b2[_0x9aa1('0x27')]=_0x1d0e5d;_0x5105b2[_0x9aa1('0x28')]='offlineMessage';return request({'event':_0x5105b2['event'],'message':_0x5105b2});};}function afterCreate(_0xadfec6,_0x3c1d97){return function(_0x509264){_0x509264=_0x509264['get']({'plain':!![]});_0x509264[_0x9aa1('0x26')]=_0xadfec6;_0x509264[_0x9aa1('0x27')]=_0xadfec6;_0x509264[_0x9aa1('0x28')]='opened';Promise[_0x9aa1('0x2a')]()[_0x9aa1('0x1f')](function(){var _0x4eeaf0=_0x9aa1('0x38')+_0x509264[_0x9aa1('0x2b')];return db[_0x9aa1('0x39')][_0x9aa1('0x2d')](_0x4eeaf0,{'type':db[_0x9aa1('0x2e')][_0x9aa1('0x2f')][_0x9aa1('0x30')],'raw':!![]});})[_0x9aa1('0x1f')](function(_0x2725fe){if(_0x2725fe){_0x509264['contact']=_0x2725fe[0x0];}if(typeof _0x509264['UserId']===_0x9aa1('0x2c'))return;return getAgent(_0x509264[_0x9aa1('0x32')]);})['then'](function(_0x5f3bbd){if(_0x5f3bbd){_0x509264[_0x9aa1('0x33')]=util[_0x9aa1('0x34')](_0x9aa1('0x35'),_0x5f3bbd[_0x9aa1('0x36')]);_0x509264[_0x9aa1('0x3a')]=_0x5f3bbd;}return request({'event':_0x3c1d97,'message':_0x509264});})[_0x9aa1('0x24')](function(_0x41d414){logger[_0x9aa1('0x21')](_0x9aa1('0x23'),'AfterCreate',_0x41d414);});};}function afterUpdate(_0xd28f2a){return function(_0x20142a){var _0xad1fec=_0x20142a[_0x9aa1('0x3b')]('closed')&&_0x20142a[_0x9aa1('0x3c')];var _0x2fbaa6=_0x20142a['changed'](_0x9aa1('0x3d'));if(_0xad1fec||_0x2fbaa6){var _0x3b2615=_0xad1fec?_0x9aa1('0x9'):_0x9aa1('0x3d');var _0x3f75c0=_0x20142a[_0x9aa1('0x25')]({'plain':!![]});_0x3f75c0['channel']=_0xd28f2a;_0x3f75c0[_0x9aa1('0x27')]=_0xd28f2a;_0x3f75c0['event']=_0xad1fec?_0x9aa1('0x3c'):'substatus';var _0x4bbe20=_0x9aa1('0x38')+_0x3f75c0['ContactId'];return db[_0x9aa1('0x39')][_0x9aa1('0x2d')](_0x4bbe20,{'type':db[_0x9aa1('0x2e')][_0x9aa1('0x2f')][_0x9aa1('0x30')],'raw':!![]})[_0x9aa1('0x1f')](function(_0x1c456a){if(_0x1c456a){_0x3f75c0[_0x9aa1('0x31')]=_0x1c456a[0x0];}if(typeof _0x3f75c0[_0x9aa1('0x32')]===_0x9aa1('0x2c'))return;return getAgent(_0x3f75c0[_0x9aa1('0x32')]);})['then'](function(_0x5eefa7){if(_0x5eefa7){_0x3f75c0[_0x9aa1('0x33')]=util['format']('SIP/%s',_0x5eefa7[_0x9aa1('0x36')]);_0x3f75c0[_0x9aa1('0x3a')]=_0x5eefa7;}return request({'event':_0x3b2615,'message':_0x3f75c0});})['catch'](function(_0x53a3d9){logger[_0x9aa1('0x21')](_0x9aa1('0x23'),_0x9aa1('0x3e'),_0x53a3d9);});}};}function getAgent(_0x4868fd){return db[_0x9aa1('0x3f')][_0x9aa1('0x40')]({'where':{'id':_0x4868fd},'attributes':['id','name',_0x9aa1('0x41'),_0x9aa1('0x42'),_0x9aa1('0x43')],'raw':!![]})['then'](function(_0xfdc59b){return _0xfdc59b;});}exports[_0x9aa1('0x44')]=function(){for(var _0x1f2148=0x0;_0x1f2148=_0xa25458[_0x9835('0x11')]){throw Error(_0x9835('0x12'));}_0x559eee(_0x32be1c);})['catch'](function(_0x1e1daf){_0x2190bb(_0x1e1daf);});});}; \ No newline at end of file +var _0x79d7=['agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','./license/util','voice','fax','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','isUndefined','updateAttributes','getLicense'];(function(_0x4f4bf6,_0x58fcef){var _0x49656b=function(_0x1720b5){while(--_0x1720b5){_0x4f4bf6['push'](_0x4f4bf6['shift']());}};_0x49656b(++_0x58fcef);}(_0x79d7,0x197));var _0x779d=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x79d7[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x779d('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0x779d('0x1'));var channels=[_0x779d('0x2'),'mail','chat',_0x779d('0x3'),'sms',_0x779d('0x4'),_0x779d('0x5')];exports[_0x779d('0x6')]=function(){return channels;};exports[_0x779d('0x7')]=function(_0x1c0b9c){_0x1c0b9c=_0x1c0b9c[_0x779d('0x8')]();return _[_0x779d('0x9')](channels,_0x1c0b9c);};exports['clearBlockUser']=function(_0x24a725,_0x533970,_0xeb421,_0x1c494a){var _0x34b825={'loginAttempts':_0x533970,'blocked':_0xeb421};if(!_[_0x779d('0xa')](_0x1c494a)){_0x34b825['blockedAt']=_0x1c494a;}return _0x24a725[_0x779d('0xb')](_0x34b825);};exports[_0x779d('0xc')]=function(_0x2f8745){return new BPromise(function(_0x5c981a,_0x2b8235){var _0x272c67=0x0;if(_0x2f8745['role']!==_0x779d('0xd')){_0x5c981a(_0x2f8745);}db[_0x779d('0xe')][_0x779d('0xf')]({'where':{'role':_0x779d('0xd'),'online':!![],'id':{'$ne':_0x2f8745['id']}}})[_0x779d('0x10')](function(_0x2f3dea){_0x272c67=_0x2f3dea;return util[_0x779d('0xc')]();})[_0x779d('0x10')](function(_0x2c4a25){if(_0x2c4a25&&_0x2c4a25[_0x779d('0x11')]&&_0x272c67>=_0x2c4a25[_0x779d('0x11')]){throw Error(_0x779d('0x12'));}_0x5c981a(_0x2f8745);})[_0x779d('0x13')](function(_0x4e0edf){_0x2b8235(_0x4e0edf);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index c4d762c..223016b 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bd7=['inherits','Entity\x20not\x20found','Not\x20Found','Out\x20Of\x20Interval','code','OutOfInterval','Forbidden','error','stack','exports','../config/logger','api','message','name','Error','Bad\x20Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5bd7,0x12a));var _0x75bd=function(_0x2f5201,_0xd92795){_0x2f5201=_0x2f5201-0x0;var _0x486ec6=_0x5bd7[_0x2f5201];return _0x486ec6;};'use strict';var util=require('util');var logger=require(_0x75bd('0x0'))(_0x75bd('0x1'));var APIError=function(_0x227fbf,_0x52a721){this[_0x75bd('0x2')]=_0x227fbf||'Internal\x20Server\x20Error';this[_0x75bd('0x3')]=_0x52a721||_0x75bd('0x4');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x440c0d){this[_0x75bd('0x2')]=_0x440c0d||_0x75bd('0x5');this['name']=_0x75bd('0x5');util[_0x75bd('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x70cd30){this[_0x75bd('0x2')]=_0x70cd30||_0x75bd('0x7');this[_0x75bd('0x3')]=_0x75bd('0x8');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x6533d2){this['message']=_0x6533d2||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x75bd('0x3')]=_0x75bd('0x9');this[_0x75bd('0xa')]=0x193;this['details']={'type':_0x75bd('0xb')};util[_0x75bd('0x6')](APIOutOfIntervalError,APIError);};function getStatusCode(_0xe3361f){switch(_0xe3361f){case _0x75bd('0x5'):return 0x190;case _0x75bd('0xc'),_0x75bd('0x9'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x5d9ad7){if(_0x5d9ad7==='Out\x20Of\x20Interval')return _0x5d9ad7;return null;}function handleError(_0x21df25){return function(_0x147532){logger[_0x75bd('0xd')](_0x147532[_0x75bd('0xe')]);var _0x1edb5c=getStatusCode(_0x147532[_0x75bd('0x3')]);var _0x631be3=getCustomStatusMessage(_0x147532[_0x75bd('0x3')]);if(_0x147532[_0x75bd('0x3')]){delete _0x147532['name'];}if(_0x631be3){_0x21df25['statusMessage']=_0x631be3;}return _0x21df25['status'](_0x1edb5c)['send'](_0x147532);};}module[_0x75bd('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'handleError':handleError}; \ No newline at end of file +var _0xc4aa=['stack','statusMessage','status','exports','util','../config/logger','api','message','inherits','Bad\x20Request','name','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error'];(function(_0x4c42b5,_0x1f219a){var _0x5b5cec=function(_0x439b60){while(--_0x439b60){_0x4c42b5['push'](_0x4c42b5['shift']());}};_0x5b5cec(++_0x1f219a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xc4aa[_0x422905];return _0x33dc6c;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var APIError=function(_0x351dd5,_0x275161){this[_0xac4a('0x3')]=_0x351dd5||'Internal\x20Server\x20Error';this['name']=_0x275161||'Error';util[_0xac4a('0x4')](APIError,Error);};var APIBadRequestError=function(_0x15b967){this[_0xac4a('0x3')]=_0x15b967||_0xac4a('0x5');this[_0xac4a('0x6')]=_0xac4a('0x5');util[_0xac4a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x10525b){this['message']=_0x10525b||'Entity\x20not\x20found';this[_0xac4a('0x6')]=_0xac4a('0x7');util[_0xac4a('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4f4146){this[_0xac4a('0x3')]=_0x4f4146||_0xac4a('0x8');this[_0xac4a('0x6')]='Out\x20Of\x20Interval';util[_0xac4a('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x488e3c){switch(_0x488e3c){case _0xac4a('0x5'):return 0x190;case'Forbidden',_0xac4a('0x9'):return 0x193;case _0xac4a('0x7'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x24291d){if(_0x24291d==='Out\x20Of\x20Interval')return _0x24291d;return null;}function handleError(_0x21a79){return function(_0x68424a){logger[_0xac4a('0xa')](_0x68424a[_0xac4a('0xb')]);var _0x1b4313=getStatusCode(_0x68424a[_0xac4a('0x6')]);var _0x34bc01=getCustomStatusMessage(_0x68424a[_0xac4a('0x6')]);if(_0x68424a[_0xac4a('0x6')])delete _0x68424a[_0xac4a('0x6')];if(_0x34bc01)_0x21a79[_0xac4a('0xc')]=_0x34bc01;return _0x21a79[_0xac4a('0xd')](_0x1b4313)['send'](_0x68424a);};}module[_0xac4a('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 9dad88b..791dbd5 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4be=['json','exports','404','status'];(function(_0x260292,_0x33a96c){var _0x1daaac=function(_0x1acadb){while(--_0x1acadb){_0x260292['push'](_0x260292['shift']());}};_0x1daaac(++_0x33a96c);}(_0xc4be,0x1ed));var _0xec4b=function(_0x10e352,_0x15653a){_0x10e352=_0x10e352-0x0;var _0x2d73b0=_0xc4be[_0x10e352];return _0x2d73b0;};'use strict';module[_0xec4b('0x0')][0x194]=function pageNotFound(_0x791cb,_0x551724){var _0x22bb7a=_0xec4b('0x1');var _0x3b0af1=0x194;var _0x1e33db={'status':_0x3b0af1};_0x551724[_0xec4b('0x2')](_0x1e33db[_0xec4b('0x2')]);_0x551724['render'](_0x22bb7a,{},function(_0x114f34,_0x5c8486){if(_0x114f34){return _0x551724[_0xec4b('0x2')](_0x1e33db[_0xec4b('0x2')])[_0xec4b('0x3')](_0x1e33db);}_0x551724['send'](_0x5c8486);});}; \ No newline at end of file +var _0x1d3d=['exports','404','status','render','send'];(function(_0xecfc6,_0x4e3394){var _0x59f6b3=function(_0x2f6463){while(--_0x2f6463){_0xecfc6['push'](_0xecfc6['shift']());}};_0x59f6b3(++_0x4e3394);}(_0x1d3d,0x13b));var _0xd1d3=function(_0xa7ab86,_0x33a3b3){_0xa7ab86=_0xa7ab86-0x0;var _0x263679=_0x1d3d[_0xa7ab86];return _0x263679;};'use strict';module[_0xd1d3('0x0')][0x194]=function pageNotFound(_0x37c3ec,_0x1b4fb1){var _0x4db048=_0xd1d3('0x1');var _0x2da771=0x194;var _0x180080={'status':_0x2da771};_0x1b4fb1[_0xd1d3('0x2')](_0x180080[_0xd1d3('0x2')]);_0x1b4fb1[_0xd1d3('0x3')](_0x4db048,{},function(_0x176991,_0x3e8b8b){if(_0x176991){return _0x1b4fb1['status'](_0x180080[_0xd1d3('0x2')])['json'](_0x180080);}_0x1b4fb1[_0xd1d3('0x4')](_0x3e8b8b);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 259a874..ee99571 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x2e5f9c,_0x134a52){var _0x538b44=function(_0x38ef13){while(--_0x38ef13){_0x2e5f9c['push'](_0x2e5f9c['shift']());}};_0x538b44(++_0x134a52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 6985bba..6685059 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['./api/voiceQueueReport','/api/members/reports','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./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/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./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/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','join','root','/apidoc','/www','static','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','path','setupLoggers','then','use','/api/users','./api/user','/api/voice/chanspy','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceRecording','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports'];(function(_0x4a60a3,_0x1891a0){var _0x1f9f37=function(_0x63dd2d){while(--_0x63dd2d){_0x4a60a3['push'](_0x4a60a3['shift']());}};_0x1f9f37(++_0x1891a0);}(_0xf4eb,0xec));var _0xbf4e=function(_0x36d488,_0x443b22){_0x36d488=_0x36d488-0x0;var _0x135d6b=_0xf4eb[_0x36d488];return _0x135d6b;};'use strict';var path=require(_0xbf4e('0x0'));var express=require('express');var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require('./utils/client-side-logger')[_0xbf4e('0x1')];var clientSideLogs=require('./api/client-side-logs');exports['default']=function(_0x2e3070){return setupLoggers(_0x2e3070)[_0xbf4e('0x2')](function(){_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x4'),require(_0xbf4e('0x5')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x6'),require('./api/voiceChanSpy'));_0x2e3070[_0xbf4e('0x3')]('/api/voice/contexts',require('./api/voiceContext'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x7'),require(_0xbf4e('0x8')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x9'),require(_0xbf4e('0xa')));_0x2e3070[_0xbf4e('0x3')]('/api/voice/queues',require('./api/voiceQueue'));_0x2e3070[_0xbf4e('0x3')]('/api/voice/recordings',require(_0xbf4e('0xb')));_0x2e3070[_0xbf4e('0x3')]('/api/screen/recordings',require(_0xbf4e('0xc')));_0x2e3070['use']('/api/voice/mails',require(_0xbf4e('0xd')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xe'),require(_0xbf4e('0xf')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x10'),require('./api/voiceCallReport'));_0x2e3070['use'](_0xbf4e('0x11'),require(_0xbf4e('0x12')));_0x2e3070[_0xbf4e('0x3')]('/api/voice/agents/reports',require(_0xbf4e('0x13')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x14'),require(_0xbf4e('0x15')));_0x2e3070['use'](_0xbf4e('0x16'),require('./api/memberReport'));_0x2e3070['use']('/api/trunks',require('./api/trunk'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x17'),require(_0xbf4e('0x18')));_0x2e3070['use']('/api/mail/out_servers',require(_0xbf4e('0x19')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x1a'),require(_0xbf4e('0x1b')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x1c'),require(_0xbf4e('0x1d')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x1e'),require(_0xbf4e('0x1f')));_0x2e3070[_0xbf4e('0x3')]('/api/mail/interactions',require(_0xbf4e('0x20')));_0x2e3070[_0xbf4e('0x3')]('/api/mail/messages',require(_0xbf4e('0x21')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x22'),require(_0xbf4e('0x23')));_0x2e3070[_0xbf4e('0x3')]('/api/mail/reports/queue',require(_0xbf4e('0x24')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x25'),require('./api/dashboard'));_0x2e3070[_0xbf4e('0x3')]('/api/dashboards/items',require('./api/dashboardItem'));_0x2e3070[_0xbf4e('0x3')]('/api/fax/accounts',require(_0xbf4e('0x26')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x27'),require(_0xbf4e('0x28')));_0x2e3070['use'](_0xbf4e('0x29'),require(_0xbf4e('0x2a')));_0x2e3070[_0xbf4e('0x3')]('/api/fax/messages',require(_0xbf4e('0x2b')));_0x2e3070['use'](_0xbf4e('0x2c'),require(_0xbf4e('0x2d')));_0x2e3070[_0xbf4e('0x3')]('/api/fax/reports/queue',require(_0xbf4e('0x2e')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x2f'),require(_0xbf4e('0x30')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x31'),require('./api/smsApplication'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x32'),require('./api/smsInteraction'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x33'),require('./api/smsMessage'));_0x2e3070[_0xbf4e('0x3')]('/api/sms/queues',require(_0xbf4e('0x34')));_0x2e3070['use'](_0xbf4e('0x35'),require(_0xbf4e('0x36')));_0x2e3070[_0xbf4e('0x3')]('/api/openchannel/applications',require(_0xbf4e('0x37')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x38'),require(_0xbf4e('0x39')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x3a'),require('./api/openchannelMessage'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x3b'),require(_0xbf4e('0x3c')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x3d'),require('./api/chatWebsite'));_0x2e3070['use']('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x3e'),require(_0xbf4e('0x3f')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x40'),require(_0xbf4e('0x41')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x42'),require(_0xbf4e('0x43')));_0x2e3070['use']('/api/chat/offline_messages',require(_0xbf4e('0x44')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x45'),require('./api/chatQueue'));_0x2e3070[_0xbf4e('0x3')]('/api/chat/groups',require(_0xbf4e('0x46')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x47'),require(_0xbf4e('0x48')));_0x2e3070['use'](_0xbf4e('0x49'),require(_0xbf4e('0x4a')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x4b'),require('./api/cmContact'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x4c'),require(_0xbf4e('0x4d')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x4e'),require(_0xbf4e('0x4f')));_0x2e3070[_0xbf4e('0x3')]('/api/cm/hopper_final',require(_0xbf4e('0x50')));_0x2e3070[_0xbf4e('0x3')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x51'),require('./api/cmCustomField'));_0x2e3070['use'](_0xbf4e('0x52'),require(_0xbf4e('0x53')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x54'),require(_0xbf4e('0x55')));_0x2e3070[_0xbf4e('0x3')]('/api/canned_answers',require(_0xbf4e('0x56')));_0x2e3070[_0xbf4e('0x3')]('/api/dispositions',require('./api/disposition'));_0x2e3070['use']('/api/conditions',require(_0xbf4e('0x57')));_0x2e3070['use'](_0xbf4e('0x58'),require(_0xbf4e('0x59')));_0x2e3070['use']('/api/pauses',require(_0xbf4e('0x5a')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x5b'),require(_0xbf4e('0x5c')));_0x2e3070[_0xbf4e('0x3')]('/api/voiceQueuesLog',require(_0xbf4e('0x5d')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x5e'),require(_0xbf4e('0x5f')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x60'),require(_0xbf4e('0x61')));_0x2e3070[_0xbf4e('0x3')]('/api/tags',require(_0xbf4e('0x62')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x63'),require(_0xbf4e('0x64')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x65'),require(_0xbf4e('0x66')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x67'),require(_0xbf4e('0x68')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x69'),require(_0xbf4e('0x6a')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x6b'),require(_0xbf4e('0x6c')));_0x2e3070[_0xbf4e('0x3')]('/api/variables',require(_0xbf4e('0x6d')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x6e'),require('./api/integration'));_0x2e3070[_0xbf4e('0x3')]('/api/integrations/reports',require('./api/integrationReport'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x6f'),require('./api/analyticCustomReport'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x70'),require(_0xbf4e('0x71')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x72'),require(_0xbf4e('0x73')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x74'),require(_0xbf4e('0x75')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x76'),require('./api/analyticFieldReport'));_0x2e3070['use'](_0xbf4e('0x77'),require(_0xbf4e('0x78')));_0x2e3070[_0xbf4e('0x3')]('/api/integrations/salesforce/accounts',require(_0xbf4e('0x79')));_0x2e3070[_0xbf4e('0x3')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x2e3070[_0xbf4e('0x3')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x7a'),require(_0xbf4e('0x7b')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x7c'),require('./api/intSugarcrmConfiguration'));_0x2e3070[_0xbf4e('0x3')]('/api/integrations/sugarcrm/fields',require(_0xbf4e('0x7d')));_0x2e3070['use'](_0xbf4e('0x7e'),require('./api/intDeskAccount'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x7f'),require(_0xbf4e('0x80')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x81'),require('./api/intDeskField'));_0x2e3070['use']('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x82'),require('./api/intZohoConfiguration'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x83'),require(_0xbf4e('0x84')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x85'),require(_0xbf4e('0x86')));_0x2e3070[_0xbf4e('0x3')]('/api/integrations/zendesk/configurations',require(_0xbf4e('0x87')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x88'),require('./api/intZendeskField'));_0x2e3070['use'](_0xbf4e('0x89'),require(_0xbf4e('0x8a')));_0x2e3070[_0xbf4e('0x3')]('/api/integrations/freshdesk/configurations',require(_0xbf4e('0x8b')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x8c'),require(_0xbf4e('0x8d')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x8e'),require(_0xbf4e('0x8f')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x90'),require(_0xbf4e('0x91')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x92'),require('./api/intVtigerField'));_0x2e3070[_0xbf4e('0x3')]('/api/integrations/servicenow/accounts',require(_0xbf4e('0x93')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x94'),require(_0xbf4e('0x95')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x96'),require(_0xbf4e('0x97')));_0x2e3070[_0xbf4e('0x3')]('/api/integrations/dynamics365/accounts',require(_0xbf4e('0x98')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x99'),require(_0xbf4e('0x9a')));_0x2e3070[_0xbf4e('0x3')]('/api/integrations/dynamics365/fields',require(_0xbf4e('0x9b')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x9c'),require(_0xbf4e('0x9d')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0x9e'),require('./api/intFreshsalesConfiguration'));_0x2e3070[_0xbf4e('0x3')]('/api/integrations/freshsales/fields',require(_0xbf4e('0x9f')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xa0'),require(_0xbf4e('0xa1')));_0x2e3070['use'](_0xbf4e('0xa2'),require('./api/chatQueueReport'));_0x2e3070['use'](_0xbf4e('0xa3'),require(_0xbf4e('0xa4')));_0x2e3070[_0xbf4e('0x3')]('/api/jscripty/answers/reports',require(_0xbf4e('0xa5')));_0x2e3070[_0xbf4e('0x3')]('/api/jscripty/questions/reports',require(_0xbf4e('0xa6')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xa7'),require(_0xbf4e('0xa8')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xa9'),require(_0xbf4e('0xaa')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xab'),require('./api/squareReport'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xac'),require(_0xbf4e('0xad')));_0x2e3070[_0xbf4e('0x3')]('/api/jscripty/projects',require(_0xbf4e('0xae')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xaf'),require(_0xbf4e('0xb0')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xb1'),require(_0xbf4e('0xb2')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xb3'),require('./api/squareProject'));_0x2e3070[_0xbf4e('0x3')]('/api/square/recordings',require(_0xbf4e('0xb4')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xb5'),require(_0xbf4e('0xb6')));_0x2e3070[_0xbf4e('0x3')]('/api/teams',require(_0xbf4e('0xb7')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xb8'),require('./api/license'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xb9'),require(_0xbf4e('0xba')));_0x2e3070['use'](_0xbf4e('0xbb'),require(_0xbf4e('0xbc')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xbd'),require(_0xbf4e('0xbe')));_0x2e3070['use'](_0xbf4e('0xbf'),require('./api/plugin'));_0x2e3070[_0xbf4e('0x3')]('/api/mail/reports/transfer',require(_0xbf4e('0xc0')));_0x2e3070['use'](_0xbf4e('0xc1'),require('./api/chatTransferReport'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xc2'),require(_0xbf4e('0xc3')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xc4'),require(_0xbf4e('0xc5')));_0x2e3070[_0xbf4e('0x3')]('/api/sms/reports/transfer',require(_0xbf4e('0xc6')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xc7'),require(_0xbf4e('0xc8')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xc9'),require('./api/voicePrefix'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xca'),require('./api/userProfile'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xcb'),require(_0xbf4e('0xcc')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xcd'),require(_0xbf4e('0xce')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xcf'),require(_0xbf4e('0xd0')));_0x2e3070['use'](_0xbf4e('0xd1'),require(_0xbf4e('0xd2')));_0x2e3070[_0xbf4e('0x3')]('/api/whatsapp/applications',require(_0xbf4e('0xd3')));_0x2e3070[_0xbf4e('0x3')]('/api/whatsapp/interactions',require(_0xbf4e('0xd4')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xd5'),require(_0xbf4e('0xd6')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xd7'),require(_0xbf4e('0xd8')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xd9'),require(_0xbf4e('0xda')));_0x2e3070['use']('/api/whatsapp/queues',require(_0xbf4e('0xdb')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xdc'),require(_0xbf4e('0xdd')));_0x2e3070['use'](_0xbf4e('0xde'),require(_0xbf4e('0xdf')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xe0'),require(_0xbf4e('0xe1')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xe2'),require('./api/authLocal'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xe3'),require(_0xbf4e('0xe4')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xe5'),require(_0xbf4e('0xe6')));_0x2e3070['use'](_0xbf4e('0xe7'),require(_0xbf4e('0xe8')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xe9'),require(_0xbf4e('0xea')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xeb'),require('./api/version'));_0x2e3070['use'](_0xbf4e('0xec'),require(_0xbf4e('0xed')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xee'),require(_0xbf4e('0xef')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xf0'),require('./api/webbar'));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xf1'),clientSideLogs);_0x2e3070[_0xbf4e('0x3')]('/apidoc',express['static'](path[_0xbf4e('0xf2')](config[_0xbf4e('0xf3')],_0xbf4e('0xf4'))));_0x2e3070['use'](_0xbf4e('0xf5'),express[_0xbf4e('0xf6')](path[_0xbf4e('0xf2')](config['root'],_0xbf4e('0xf5'))));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xf7'),express[_0xbf4e('0xf6')](path[_0xbf4e('0xf2')](config[_0xbf4e('0xf3')],_0xbf4e('0xf7'))));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xf8'),express[_0xbf4e('0xf6')](path[_0xbf4e('0xf2')](config['root'],_0xbf4e('0xf9'),'3.5.0')));_0x2e3070[_0xbf4e('0x3')](_0xbf4e('0xfa'),express[_0xbf4e('0xf6')](path[_0xbf4e('0xf2')](config['root'],_0xbf4e('0xfb'))));_0x2e3070[_0xbf4e('0xfc')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xbf4e('0xfd')](errors[0x194]);_0x2e3070[_0xbf4e('0xfc')]('/*')[_0xbf4e('0xfd')](function(_0x25b29c,_0x2f2013){_0x2f2013[_0xbf4e('0xfe')](path[_0xbf4e('0xff')](_0x2e3070[_0xbf4e('0xfd')](_0xbf4e('0x100'))+'/index.html'));});return _0x2e3070;});}; \ No newline at end of file +var _0xdb76=['./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/configurations','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfile/sections','./api/userProfileSection','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','/www','/demo','root','snippet','3.5.0','/plugins','/server/files/plugins','get','route','resolve','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','/api/contact_item_types'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xdb76,0x1be));var _0x6db7=function(_0x1c92b7,_0x42cd2b){_0x1c92b7=_0x1c92b7-0x0;var _0x3d234b=_0xdb76[_0x1c92b7];return _0x3d234b;};'use strict';var path=require(_0x6db7('0x0'));var express=require(_0x6db7('0x1'));var errors=require(_0x6db7('0x2'));var config=require(_0x6db7('0x3'));var setupLoggers=require(_0x6db7('0x4'))['setupLoggers'];var clientSideLogs=require(_0x6db7('0x5'));exports[_0x6db7('0x6')]=function(_0x3e17d8){return setupLoggers(_0x3e17d8)[_0x6db7('0x7')](function(){_0x3e17d8['use'](_0x6db7('0x8'),require(_0x6db7('0x9')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xb'),require(_0x6db7('0xc')));_0x3e17d8['use'](_0x6db7('0xd'),require(_0x6db7('0xe')));_0x3e17d8['use'](_0x6db7('0xf'),require(_0x6db7('0x10')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x11'),require(_0x6db7('0x12')));_0x3e17d8[_0x6db7('0xa')]('/api/voice/queues',require('./api/voiceQueue'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x13'),require('./api/voiceRecording'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x14'),require(_0x6db7('0x15')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x16'),require(_0x6db7('0x17')));_0x3e17d8['use']('/api/voice/mails/messages',require(_0x6db7('0x18')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x19'),require(_0x6db7('0x1a')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x1b'),require(_0x6db7('0x1c')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x1d'),require(_0x6db7('0x1e')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x1f'),require('./api/voiceQueueReport'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x20'),require(_0x6db7('0x21')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x22'),require(_0x6db7('0x23')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x24'),require(_0x6db7('0x25')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x26'),require(_0x6db7('0x27')));_0x3e17d8['use'](_0x6db7('0x28'),require(_0x6db7('0x29')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x2a'),require(_0x6db7('0x2b')));_0x3e17d8[_0x6db7('0xa')]('/api/mail/substatuses',require(_0x6db7('0x2c')));_0x3e17d8[_0x6db7('0xa')]('/api/mail/interactions',require(_0x6db7('0x2d')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x2e'),require('./api/mailMessage'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x2f'),require('./api/mailApplication'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x30'),require(_0x6db7('0x31')));_0x3e17d8['use']('/api/dashboards',require(_0x6db7('0x32')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x33'),require('./api/dashboardItem'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x34'),require('./api/faxAccount'));_0x3e17d8['use'](_0x6db7('0x35'),require(_0x6db7('0x36')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x37'),require(_0x6db7('0x38')));_0x3e17d8[_0x6db7('0xa')]('/api/fax/messages',require(_0x6db7('0x39')));_0x3e17d8[_0x6db7('0xa')]('/api/fax/queues',require(_0x6db7('0x3a')));_0x3e17d8['use'](_0x6db7('0x3b'),require(_0x6db7('0x3c')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x3d'),require('./api/smsAccount'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x3e'),require(_0x6db7('0x3f')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x40'),require('./api/smsInteraction'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x41'),require(_0x6db7('0x42')));_0x3e17d8['use'](_0x6db7('0x43'),require(_0x6db7('0x44')));_0x3e17d8[_0x6db7('0xa')]('/api/openchannel/accounts',require(_0x6db7('0x45')));_0x3e17d8['use'](_0x6db7('0x46'),require('./api/openchannelApplication'));_0x3e17d8['use'](_0x6db7('0x47'),require(_0x6db7('0x48')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x49'),require('./api/openchannelMessage'));_0x3e17d8['use'](_0x6db7('0x4a'),require(_0x6db7('0x4b')));_0x3e17d8['use'](_0x6db7('0x4c'),require('./api/chatWebsite'));_0x3e17d8[_0x6db7('0xa')]('/api/openchannel/reports/queue',require(_0x6db7('0x4d')));_0x3e17d8['use']('/api/chat/applications',require(_0x6db7('0x4e')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x4f'),require(_0x6db7('0x50')));_0x3e17d8[_0x6db7('0xa')]('/api/chat/messages',require(_0x6db7('0x51')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x52'),require(_0x6db7('0x53')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x54'),require('./api/chatQueue'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x55'),require(_0x6db7('0x56')));_0x3e17d8['use'](_0x6db7('0x57'),require('./api/chatProactiveAction'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x58'),require('./api/cmCompany'));_0x3e17d8[_0x6db7('0xa')]('/api/cm/contacts',require(_0x6db7('0x59')));_0x3e17d8['use'](_0x6db7('0x5a'),require('./api/cmHopper'));_0x3e17d8[_0x6db7('0xa')]('/api/cm/hopper_black',require(_0x6db7('0x5b')));_0x3e17d8['use'](_0x6db7('0x5c'),require(_0x6db7('0x5d')));_0x3e17d8[_0x6db7('0xa')]('/api/cm/hopper_history',require(_0x6db7('0x5e')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x5f'),require('./api/cmCustomField'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x60'),require(_0x6db7('0x61')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x62'),require(_0x6db7('0x63')));_0x3e17d8['use'](_0x6db7('0x64'),require(_0x6db7('0x65')));_0x3e17d8['use']('/api/dispositions',require(_0x6db7('0x66')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x67'),require('./api/condition'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x68'),require(_0x6db7('0x69')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x6a'),require('./api/pause'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x6b'),require(_0x6db7('0x6c')));_0x3e17d8['use']('/api/voiceQueuesLog',require(_0x6db7('0x6d')));_0x3e17d8['use'](_0x6db7('0x6e'),require(_0x6db7('0x6f')));_0x3e17d8['use']('/api/sounds',require(_0x6db7('0x70')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x71'),require(_0x6db7('0x72')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x73'),require(_0x6db7('0x74')));_0x3e17d8[_0x6db7('0xa')]('/api/cm_contact_has_items',require(_0x6db7('0x75')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x76'),require('./api/cmHopperAdditionalPhone'));_0x3e17d8['use'](_0x6db7('0x77'),require(_0x6db7('0x78')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x79'),require(_0x6db7('0x7a')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x7b'),require('./api/variable'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x7c'),require(_0x6db7('0x7d')));_0x3e17d8[_0x6db7('0xa')]('/api/integrations/reports',require(_0x6db7('0x7e')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x7f'),require(_0x6db7('0x80')));_0x3e17d8['use'](_0x6db7('0x81'),require(_0x6db7('0x82')));_0x3e17d8['use']('/api/analytics/extracted_reports',require(_0x6db7('0x83')));_0x3e17d8['use'](_0x6db7('0x84'),require('./api/analyticMetric'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x85'),require('./api/analyticFieldReport'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x86'),require(_0x6db7('0x87')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x88'),require(_0x6db7('0x89')));_0x3e17d8['use'](_0x6db7('0x8a'),require(_0x6db7('0x8b')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x8c'),require(_0x6db7('0x8d')));_0x3e17d8['use'](_0x6db7('0x8e'),require(_0x6db7('0x8f')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x90'),require(_0x6db7('0x91')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x92'),require(_0x6db7('0x93')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x94'),require('./api/intDeskAccount'));_0x3e17d8['use'](_0x6db7('0x95'),require(_0x6db7('0x96')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x97'),require(_0x6db7('0x98')));_0x3e17d8[_0x6db7('0xa')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x99'),require('./api/intZohoConfiguration'));_0x3e17d8[_0x6db7('0xa')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x9a'),require(_0x6db7('0x9b')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x9c'),require(_0x6db7('0x9d')));_0x3e17d8['use'](_0x6db7('0x9e'),require(_0x6db7('0x9f')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xa0'),require(_0x6db7('0xa1')));_0x3e17d8['use'](_0x6db7('0xa2'),require('./api/intFreshdeskConfiguration'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xa3'),require(_0x6db7('0xa4')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xa5'),require('./api/intVtigerAccount'));_0x3e17d8[_0x6db7('0xa')]('/api/integrations/vtiger/configurations',require(_0x6db7('0xa6')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xa7'),require(_0x6db7('0xa8')));_0x3e17d8[_0x6db7('0xa')]('/api/integrations/servicenow/accounts',require(_0x6db7('0xa9')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xaa'),require(_0x6db7('0xab')));_0x3e17d8['use'](_0x6db7('0xac'),require(_0x6db7('0xad')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xae'),require(_0x6db7('0xaf')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xb0'),require(_0x6db7('0xb1')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xb2'),require('./api/intDynamics365Field'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xb3'),require(_0x6db7('0xb4')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xb5'),require('./api/intFreshsalesConfiguration'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xb6'),require(_0x6db7('0xb7')));_0x3e17d8[_0x6db7('0xa')]('/api/networks',require(_0x6db7('0xb8')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xb9'),require(_0x6db7('0xba')));_0x3e17d8['use'](_0x6db7('0xbb'),require(_0x6db7('0xbc')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xbd'),require(_0x6db7('0xbe')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xbf'),require(_0x6db7('0xc0')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xc1'),require('./api/jscriptySessionReport'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xc2'),require(_0x6db7('0xc3')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xc4'),require(_0x6db7('0xc5')));_0x3e17d8['use'](_0x6db7('0xc6'),require(_0x6db7('0xc7')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xc8'),require(_0x6db7('0xc9')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xca'),require(_0x6db7('0xcb')));_0x3e17d8['use'](_0x6db7('0xcc'),require(_0x6db7('0xcd')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xce'),require('./api/squareProject'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xcf'),require(_0x6db7('0xd0')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xd1'),require(_0x6db7('0xd2')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xd3'),require(_0x6db7('0xd4')));_0x3e17d8['use'](_0x6db7('0xd5'),require(_0x6db7('0xd6')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xd7'),require(_0x6db7('0xd8')));_0x3e17d8[_0x6db7('0xa')]('/api/migrations',require(_0x6db7('0xd9')));_0x3e17d8[_0x6db7('0xa')]('/api/attachments',require(_0x6db7('0xda')));_0x3e17d8['use']('/api/plugins',require(_0x6db7('0xdb')));_0x3e17d8['use'](_0x6db7('0xdc'),require(_0x6db7('0xdd')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xde'),require('./api/chatTransferReport'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xdf'),require(_0x6db7('0xe0')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xe1'),require(_0x6db7('0xe2')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xe3'),require(_0x6db7('0xe4')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xe5'),require(_0x6db7('0xe6')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xe7'),require(_0x6db7('0xe8')));_0x3e17d8[_0x6db7('0xa')]('/api/userProfiles',require('./api/userProfile'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xe9'),require(_0x6db7('0xea')));_0x3e17d8[_0x6db7('0xa')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xeb'),require(_0x6db7('0xec')));_0x3e17d8['use'](_0x6db7('0xed'),require('./api/whatsappAccount'));_0x3e17d8['use'](_0x6db7('0xee'),require(_0x6db7('0xef')));_0x3e17d8[_0x6db7('0xa')]('/api/whatsapp/interactions',require(_0x6db7('0xf0')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xf1'),require('./api/whatsappMessage'));_0x3e17d8['use'](_0x6db7('0xf2'),require(_0x6db7('0xf3')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xf4'),require('./api/whatsappTransferReport'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xf5'),require(_0x6db7('0xf6')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xf7'),require('./api/cloudProvider'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xf8'),require(_0x6db7('0xf9')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xfa'),require(_0x6db7('0xfb')));_0x3e17d8['use'](_0x6db7('0xfc'),require(_0x6db7('0xfd')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0xfe'),require(_0x6db7('0xff')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x100'),require(_0x6db7('0x101')));_0x3e17d8[_0x6db7('0xa')]('/api/jira',require('./api/jira'));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x102'),require(_0x6db7('0x103')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x104'),require(_0x6db7('0x105')));_0x3e17d8['use']('/api/system',require(_0x6db7('0x106')));_0x3e17d8['use']('/api/pm2',require(_0x6db7('0x107')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x108'),require(_0x6db7('0x109')));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x10a'),clientSideLogs);_0x3e17d8['use'](_0x6db7('0x10b'),express[_0x6db7('0x10c')](path['join'](config['root'],_0x6db7('0x10b'))));_0x3e17d8['use']('/www',express[_0x6db7('0x10c')](path[_0x6db7('0x10d')](config['root'],_0x6db7('0x10e'))));_0x3e17d8['use'](_0x6db7('0x10f'),express[_0x6db7('0x10c')](path[_0x6db7('0x10d')](config['root'],_0x6db7('0x10f'))));_0x3e17d8[_0x6db7('0xa')]('/snippet',express['static'](path[_0x6db7('0x10d')](config[_0x6db7('0x110')],_0x6db7('0x111'),_0x6db7('0x112'))));_0x3e17d8[_0x6db7('0xa')](_0x6db7('0x113'),express['static'](path['join'](config[_0x6db7('0x110')],_0x6db7('0x114'))));_0x3e17d8['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x6db7('0x115')](errors[0x194]);_0x3e17d8[_0x6db7('0x116')]('/*')['get'](function(_0x54f9d9,_0x1f3241){_0x1f3241['sendFile'](path[_0x6db7('0x117')](_0x3e17d8[_0x6db7('0x115')]('appPath')+_0x6db7('0x118')));});return _0x3e17d8;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 61564a5..227f819 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9388=['../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9388,0x13f));var _0x8938=function(_0x1ac321,_0x48c476){_0x1ac321=_0x1ac321-0x0;var _0x2b61b8=_0x9388[_0x1ac321];return _0x2b61b8;};'use strict';var jayson=require(_0x8938('0x0'));var _=require(_0x8938('0x1'));var config=require(_0x8938('0x2'));exports[_0x8938('0x3')]=function(){return new Promise(function(_0x312279,_0x19ac6b){var _0x427a8c={};_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0x4')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x6')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require('../api/voiceQueue/voiceQueue.rpc'));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x7')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x8')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x9')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0xa')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require('../api/memberReport/memberReport.rpc'));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0xb')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0xc')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0xd')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0xe')));_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0xf')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x10')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x11')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x12')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x13')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x14')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require('../api/faxApplication/faxApplication.rpc'));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x15')));_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0x16')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x17')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0x18')));_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0x19')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x1a')));_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0x1b')));_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0x1c')));_0x427a8c=_['merge'](_0x427a8c,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x1d')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x1e')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x1f')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x20')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x21')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x22')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require('../api/cmContact/cmContact.rpc'));_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0x23')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x24')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x25')));_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0x26')));_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0x27')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x28')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require('../api/pause/pause.rpc'));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x29')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0x2a')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x2b')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require('../api/variable/variable.rpc'));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x2c')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x2d')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x2e')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x2f')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x30')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x31')));_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0x32')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x33')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x34')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x35')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x36')));_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0x37')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x38')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x39')));_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0x3a')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x3b')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x3c')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x3d')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x3e')));_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0x3f')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x427a8c=_['merge'](_0x427a8c,require(_0x8938('0x40')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require(_0x8938('0x41')));_0x427a8c=_[_0x8938('0x5')](_0x427a8c,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x314cec=jayson[_0x8938('0x42')](_0x427a8c)[_0x8938('0x43')]();var _0x3d3a43=config[_0x8938('0x44')]['port']||config[_0x8938('0x45')]+0x1;var _0x4a943d=config[_0x8938('0x44')]['ip']||_0x8938('0x46');_0x314cec['on'](_0x8938('0x47'),function(_0x1e5d08){return _0x19ac6b(_0x1e5d08);});_0x314cec[_0x8938('0x3')](_0x3d3a43,_0x4a943d,function(){console[_0x8938('0x48')](_0x8938('0x49'),_0x4a943d,_0x3d3a43);require(_0x8938('0x4a'))[_0x8938('0x4b')]();return _0x312279('RPC\x20listening\x20on\x20'+_0x4a943d+':'+_0x3d3a43);});});}; \ No newline at end of file +var _0x0497=['../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','rpc','port','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','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/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0497,0xe1));var _0x7049=function(_0x10a12a,_0xee7529){_0x10a12a=_0x10a12a-0x0;var _0x1905af=_0x0497[_0x10a12a];return _0x1905af;};'use strict';var jayson=require(_0x7049('0x0'));var _=require(_0x7049('0x1'));var config=require('../config/environment');exports[_0x7049('0x2')]=function(){return new Promise(function(_0x122d5c,_0x455419){var _0x11bbf7={};_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x4')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x5')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x6')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x7')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x8')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x9')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0xa')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0xb')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0xc')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0xd')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0xe')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0xf')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x10')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x11')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x12')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x13')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x14')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x15')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x16')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x17')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x18')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x19')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x1a')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x1b')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x1c')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x1d')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x1e')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x1f')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x20')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x21')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x22')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x23')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x24')));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/chatQueue/chatQueue.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x25')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/cmHopper/cmHopper.rpc'));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x26')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x27')));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/sound/sound.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x28')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x29')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/variable/variable.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x2a')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x2b')));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x2c')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x2d')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x2e')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x2f')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x30')));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/squareReport/squareReport.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x31')));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/setting/setting.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x32')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x33')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/squareRecording/squareRecording.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x34')));_0x11bbf7=_['merge'](_0x11bbf7,require(_0x7049('0x35')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x36')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x37')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x38')));_0x11bbf7=_['merge'](_0x11bbf7,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require(_0x7049('0x39')));_0x11bbf7=_[_0x7049('0x3')](_0x11bbf7,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x44ef9d=jayson['server'](_0x11bbf7)['http']();var _0x520a01=config[_0x7049('0x3a')]['port']||config[_0x7049('0x3b')]+0x1;var _0x3ec3c5=config[_0x7049('0x3a')]['ip']||'localhost';_0x44ef9d['on'](_0x7049('0x3c'),function(_0x272c7f){return _0x455419(_0x272c7f);});_0x44ef9d[_0x7049('0x2')](_0x520a01,_0x3ec3c5,function(){console['log'](_0x7049('0x3d'),_0x3ec3c5,_0x520a01);require(_0x7049('0x3e'))[_0x7049('0x3f')]();return _0x122d5c(_0x7049('0x40')+_0x3ec3c5+':'+_0x520a01);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 9483b21..7d67c14 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 _0x5c10=['getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','./error','call','setEncoding','utf8','setTimeout','ready','toLowerCase','hangup','520-Invalid','search','substring','result=','substr','startsWith','length','match','emit','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','function','inherits','sendRequest','command','prototype','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s'];(function(_0xc689c7,_0x63165a){var _0x535e43=function(_0x429c8b){while(--_0x429c8b){_0xc689c7['push'](_0xc689c7['shift']());}};_0x535e43(++_0x63165a);}(_0x5c10,0x183));var _0x05c1=function(_0x26dda0,_0x5b58ab){_0x26dda0=_0x26dda0-0x0;var _0x41089c=_0x5c10[_0x26dda0];return _0x41089c;};'use strict';var util=require(_0x05c1('0x0'));var _=require('lodash');var EventEmitter=require(_0x05c1('0x1'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x05c1('0x2'));function AGIChannel(_0x17f8a9){var _0x487e39=this,_0x3041f0=new AGIReply(),_0xf1f78e=![],_0x542deb={};EventEmitter[_0x05c1('0x3')](_0x487e39);_0x17f8a9[_0x05c1('0x4')](_0x05c1('0x5'));_0x17f8a9[_0x05c1('0x6')](0x8*0x3c*0x3c*0x3e8);_0x3041f0['setEncoding'](_0x05c1('0x5'));_0x3041f0['on']('headers',function(_0x41a93f){for(var _0x49c5ee in _0x41a93f){_0x487e39[_0x49c5ee]=_0x41a93f[_0x49c5ee];}_0x487e39['emit'](_0x05c1('0x7'));});_0x3041f0['on']('line',function(_0x5cbef6){if(_0x5cbef6[_0x05c1('0x8')]()==_0x05c1('0x9')){_0x487e39['emit']('hangup');return;}if(_0x5cbef6['substring'](0x0,0xb)==_0x05c1('0xa')){_0xf1f78e=!![];}if(_0xf1f78e){_0x542deb['rx']+=_0x5cbef6+'\x0a';if(_0x5cbef6[_0x05c1('0xb')]('520\x20End\x20of\x20proper')!=-0x1){_0xf1f78e=![];}}else{_0x542deb['rx']=_0x5cbef6;}if(_0xf1f78e){return;}if(typeof _0x542deb['cb']=='function'){var _0x5f4896=_0x542deb['rx']['substring'](0x0,0x3),_0x569b42=null,_0x1d78ae=null;_0x5f4896=parseInt(_0x5f4896);if(isNaN(_0x5f4896)){_0x542deb['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x5f4896!=0xc8){_0x542deb['cb'](null,{'code':_0x5f4896,'result':-0x1,'extra':'KO'});return;}_0x569b42=_0x542deb['rx'][_0x05c1('0xc')](0x4)['replace'](_0x05c1('0xd'),'');if(_0x569b42['indexOf']('\x20')!=-0x1){_0x569b42=_0x569b42[_0x05c1('0xe')](0x0,_0x569b42['indexOf']('\x20'));}if(_[_0x05c1('0xf')](_0x569b42,'-1')){_0x569b42=parseInt(_0x569b42);}_0x1d78ae=_0x542deb['rx']['split']('\x20');if(_0x1d78ae[_0x05c1('0x10')]==0x3){_0x1d78ae=_0x1d78ae[0x2][_0x05c1('0xc')](0x1,_0x1d78ae[0x2][_0x05c1('0x10')]-0x1);}else if(_0x1d78ae[_0x05c1('0x10')]>0x3){var _0x405c3d=/\((.+)\)/;var _0x13635e=_0x542deb['rx'][_0x05c1('0x11')](_0x405c3d);if(_0x13635e){_0x1d78ae=_0x13635e[0x1];}else{_0x1d78ae=null;}}else{_0x1d78ae=null;}_0x542deb['cb'](null,{'code':_0x5f4896,'result':_0x569b42,'extra':_0x1d78ae});}});_0x17f8a9['on']('error',function(_0x4501b0){_0x487e39[_0x05c1('0x12')](_0x05c1('0x13'),new AGIError('E_AGI_SOCKET_ERROR',_0x4501b0[_0x05c1('0x14')]));});_0x17f8a9['on']('close',function(){_0x487e39[_0x05c1('0x12')](_0x05c1('0x15'),new AGIError(_0x05c1('0x16')));});_0x17f8a9['on'](_0x05c1('0x17'),function(){_0x487e39[_0x05c1('0x12')](_0x05c1('0x17'),new AGIError(_0x05c1('0x18')));_0x17f8a9['destroy']();});_0x17f8a9[_0x05c1('0x19')](_0x3041f0);this['command']=function(_0x4e61c0,_0x2d04c9){var _0x4e61c0=_0x4e61c0||'',_0x2d04c9=typeof _0x2d04c9==_0x05c1('0x1a')?_0x2d04c9:new Function();_0x542deb={'tx':_0x4e61c0,'rx':'','cb':_0x2d04c9};_0x17f8a9['write'](_0x4e61c0+'\x0a');},this['close']=function(){_0x17f8a9['destroy']();};}util[_0x05c1('0x1b')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x05c1('0x1c')]=function(_0x4c452c){return this[_0x05c1('0x1d')]['sync'](this,_0x4c452c);};AGIChannel[_0x05c1('0x1e')][_0x05c1('0x1f')]=function(){return this['sendRequest'](_0x05c1('0x20'));};AGIChannel[_0x05c1('0x1e')][_0x05c1('0x21')]=function(_0x419c40,_0x1ef51f,_0x38237e){_0x419c40=_0x419c40===undefined?_0x05c1('0x22'):_0x419c40;_0x1ef51f=_0x1ef51f===undefined?'5':_0x1ef51f;_0x38237e=_0x38237e===undefined?'1':_0x38237e;return this[_0x05c1('0x1c')](util[_0x05c1('0x23')](_0x05c1('0x24'),_0x419c40,_0x1ef51f*0x3e8,_0x38237e));};AGIChannel['prototype'][_0x05c1('0x25')]=function(_0x239255){_0x239255=_0x239255||_0x05c1('0x26');return this['sendRequest'](util[_0x05c1('0x23')](_0x05c1('0x27'),_0x239255));};AGIChannel[_0x05c1('0x1e')][_0x05c1('0x28')]=function(_0x3a41a3,_0x5e78be){if(_[_0x05c1('0x29')](_0x5e78be)){return this[_0x05c1('0x1c')](util[_0x05c1('0x23')](_0x05c1('0x2a'),_0x3a41a3,_0x5e78be[_0x05c1('0x2b')](',')));}return this[_0x05c1('0x1c')](util[_0x05c1('0x23')](_0x05c1('0x2a'),_0x3a41a3,_0x5e78be));};AGIChannel[_0x05c1('0x1e')][_0x05c1('0x2c')]=function(_0x265467){return this[_0x05c1('0x1c')](util[_0x05c1('0x23')](_0x05c1('0x2d'),_0x265467));};AGIChannel['prototype'][_0x05c1('0x2e')]=function(_0x2d2805){return this[_0x05c1('0x1c')](util[_0x05c1('0x23')](_0x05c1('0x2f'),_0x2d2805));};AGIChannel[_0x05c1('0x1e')][_0x05c1('0x30')]=function(_0x1f9970){return this['sendRequest'](util[_0x05c1('0x23')](_0x05c1('0x31'),_0x1f9970));};AGIChannel['prototype'][_0x05c1('0x9')]=function(){return this[_0x05c1('0x1c')]('HANGUP');};AGIChannel['prototype'][_0x05c1('0x32')]=function(_0xae5559,_0x38f0a6){var _0x4e52d7=_[_0x05c1('0x33')](_0x38f0a6)||_[_0x05c1('0x34')](_0x38f0a6)?_0x38f0a6[_0x05c1('0x35')]():_0x38f0a6;return this[_0x05c1('0x1c')](util[_0x05c1('0x23')](_0x05c1('0x36'),_0xae5559,_0x4e52d7?_0x4e52d7[_0x05c1('0x35')]()[_0x05c1('0x37')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x05c1('0x1e')][_0x05c1('0x38')]=function(_0x2be5a9,_0x1857d3){return this[_0x05c1('0x1c')](util[_0x05c1('0x23')](_0x05c1('0x39'),_0x2be5a9,_0x1857d3));};AGIChannel['prototype'][_0x05c1('0x3a')]=function(_0x24f2fe,_0x45b7b3){return this[_0x05c1('0x1c')](util[_0x05c1('0x23')](_0x05c1('0x3b'),_0x24f2fe,_0x45b7b3));};AGIChannel[_0x05c1('0x1e')]['sayPhonetic']=function(_0x4b3f7e,_0x912e3c){return this[_0x05c1('0x1c')](util[_0x05c1('0x23')](_0x05c1('0x3c'),_0x4b3f7e,_0x912e3c));};AGIChannel['prototype'][_0x05c1('0x3d')]=function(_0x5b2464,_0x2c0cd3,_0x383f37){_0x2c0cd3=_0x2c0cd3||this['extension'];_0x383f37=_0x383f37||0x1;this[_0x05c1('0x2c')](_0x5b2464);this['setExtension'](_0x2c0cd3);this['setPriority'](_0x383f37);return this[_0x05c1('0x25')](util[_0x05c1('0x23')](_0x05c1('0x3e'),_0x5b2464,_0x2c0cd3,_0x383f37));};AGIChannel[_0x05c1('0x1e')][_0x05c1('0x3f')]=function(_0x2fadcd){return this[_0x05c1('0x1c')](util[_0x05c1('0x23')](_0x05c1('0x40'),_0x2fadcd));};AGIChannel[_0x05c1('0x1e')][_0x05c1('0x41')]=function(_0x507527,_0xbb5d8d,_0x1db9c5,_0x4fc301,_0x28bc78,_0x1da174){_0xbb5d8d=_0xbb5d8d||'wav';_0x1db9c5=_0x1db9c5||'';_0x4fc301=_0x4fc301===undefined?-0x1:_0x4fc301==='-1'?-0x1:_0x4fc301*0x3e8;_0x28bc78=_0x28bc78===undefined?'':'s='+_0x28bc78;_0x1da174=_0x1da174?_0x05c1('0x42'):'';return this['sendRequest'](util[_0x05c1('0x23')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x507527,_0xbb5d8d,_0x1db9c5,_0x4fc301,_0x1da174,_0x28bc78));};AGIChannel[_0x05c1('0x1e')][_0x05c1('0x43')]=function(_0x557dbd,_0x7831f6){_0x7831f6=_0x7831f6||'';return this[_0x05c1('0x1c')](util[_0x05c1('0x23')](_0x05c1('0x44'),_0x557dbd,_0x7831f6));};AGIChannel[_0x05c1('0x1e')][_0x05c1('0x45')]=function(_0x2cda66){return this[_0x05c1('0x28')](_0x05c1('0x46'),_0x2cda66);};AGIChannel[_0x05c1('0x1e')][_0x05c1('0x47')]=function(_0x3216c7){return this['exec']('WAIT',_0x3216c7);};AGIChannel[_0x05c1('0x1e')][_0x05c1('0x13')]=function(_0x72b76b,_0x99bcec){this['noop'](util[_0x05c1('0x23')](_0x05c1('0x48'),_0x72b76b['id'],_0x72b76b[_0x05c1('0x49')],_0x99bcec));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x05c1('0x4a')]=AGIChannel; \ No newline at end of file +var _0x9ec0=['EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','sendRequest','sync','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events'];(function(_0x2799cc,_0x4b1eeb){var _0x428a0a=function(_0x2eaed5){while(--_0x2eaed5){_0x2799cc['push'](_0x2799cc['shift']());}};_0x428a0a(++_0x4b1eeb);}(_0x9ec0,0x1b9));var _0x09ec=function(_0x179cce,_0x239422){_0x179cce=_0x179cce-0x0;var _0x54ac6d=_0x9ec0[_0x179cce];return _0x54ac6d;};'use strict';var util=require(_0x09ec('0x0'));var _=require(_0x09ec('0x1'));var EventEmitter=require(_0x09ec('0x2'))[_0x09ec('0x3')];var AGIReply=require(_0x09ec('0x4'));var AGIError=require(_0x09ec('0x5'));function AGIChannel(_0x5b9c41){var _0x59411b=this,_0x2adfe8=new AGIReply(),_0x1da19a=![],_0x5aff33={};EventEmitter[_0x09ec('0x6')](_0x59411b);_0x5b9c41[_0x09ec('0x7')](_0x09ec('0x8'));_0x5b9c41[_0x09ec('0x9')](0x8*0x3c*0x3c*0x3e8);_0x2adfe8['setEncoding'](_0x09ec('0x8'));_0x2adfe8['on'](_0x09ec('0xa'),function(_0x45160d){for(var _0x3b689d in _0x45160d){_0x59411b[_0x3b689d]=_0x45160d[_0x3b689d];}_0x59411b[_0x09ec('0xb')]('ready');});_0x2adfe8['on'](_0x09ec('0xc'),function(_0xd98a6a){if(_0xd98a6a['toLowerCase']()==_0x09ec('0xd')){_0x59411b[_0x09ec('0xb')](_0x09ec('0xd'));return;}if(_0xd98a6a[_0x09ec('0xe')](0x0,0xb)==_0x09ec('0xf')){_0x1da19a=!![];}if(_0x1da19a){_0x5aff33['rx']+=_0xd98a6a+'\x0a';if(_0xd98a6a[_0x09ec('0x10')](_0x09ec('0x11'))!=-0x1){_0x1da19a=![];}}else{_0x5aff33['rx']=_0xd98a6a;}if(_0x1da19a){return;}if(typeof _0x5aff33['cb']==_0x09ec('0x12')){var _0x1a66f7=_0x5aff33['rx'][_0x09ec('0xe')](0x0,0x3),_0x38c432=null,_0x3261c4=null;_0x1a66f7=parseInt(_0x1a66f7);if(isNaN(_0x1a66f7)){_0x5aff33['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x09ec('0x13')});return;}if(_0x1a66f7!=0xc8){_0x5aff33['cb'](null,{'code':_0x1a66f7,'result':-0x1,'extra':'KO'});return;}_0x38c432=_0x5aff33['rx'][_0x09ec('0xe')](0x4)[_0x09ec('0x14')]('result=','');if(_0x38c432[_0x09ec('0x15')]('\x20')!=-0x1){_0x38c432=_0x38c432[_0x09ec('0x16')](0x0,_0x38c432[_0x09ec('0x15')]('\x20'));}if(_['startsWith'](_0x38c432,'-1')){_0x38c432=parseInt(_0x38c432);}_0x3261c4=_0x5aff33['rx']['split']('\x20');if(_0x3261c4['length']==0x3){_0x3261c4=_0x3261c4[0x2][_0x09ec('0xe')](0x1,_0x3261c4[0x2][_0x09ec('0x17')]-0x1);}else if(_0x3261c4[_0x09ec('0x17')]>0x3){var _0x383b8d=/\((.+)\)/;var _0x561baa=_0x5aff33['rx']['match'](_0x383b8d);if(_0x561baa){_0x3261c4=_0x561baa[0x1];}else{_0x3261c4=null;}}else{_0x3261c4=null;}_0x5aff33['cb'](null,{'code':_0x1a66f7,'result':_0x38c432,'extra':_0x3261c4});}});_0x5b9c41['on']('error',function(_0x1c751b){_0x59411b[_0x09ec('0xb')](_0x09ec('0x18'),new AGIError(_0x09ec('0x19'),_0x1c751b[_0x09ec('0x1a')]));});_0x5b9c41['on'](_0x09ec('0x1b'),function(){_0x59411b[_0x09ec('0xb')](_0x09ec('0x1b'),new AGIError(_0x09ec('0x1c')));});_0x5b9c41['on'](_0x09ec('0x1d'),function(){_0x59411b[_0x09ec('0xb')](_0x09ec('0x1d'),new AGIError(_0x09ec('0x1e')));_0x5b9c41[_0x09ec('0x1f')]();});_0x5b9c41[_0x09ec('0x20')](_0x2adfe8);this['command']=function(_0x204841,_0x577839){var _0x204841=_0x204841||'',_0x577839=typeof _0x577839==_0x09ec('0x12')?_0x577839:new Function();_0x5aff33={'tx':_0x204841,'rx':'','cb':_0x577839};_0x5b9c41[_0x09ec('0x21')](_0x204841+'\x0a');},this[_0x09ec('0x1b')]=function(){_0x5b9c41[_0x09ec('0x1f')]();};}util[_0x09ec('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x09ec('0x23')]=function(_0x319e80){return this['command'][_0x09ec('0x24')](this,_0x319e80);};AGIChannel['prototype']['answer']=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x09ec('0x25')][_0x09ec('0x26')]=function(_0x9a5687,_0x12167a,_0x3437e8){_0x9a5687=_0x9a5687===undefined?_0x09ec('0x27'):_0x9a5687;_0x12167a=_0x12167a===undefined?'5':_0x12167a;_0x3437e8=_0x3437e8===undefined?'1':_0x3437e8;return this[_0x09ec('0x23')](util[_0x09ec('0x28')](_0x09ec('0x29'),_0x9a5687,_0x12167a*0x3e8,_0x3437e8));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x2a')]=function(_0x3318bd){_0x3318bd=_0x3318bd||_0x09ec('0x2b');return this[_0x09ec('0x23')](util[_0x09ec('0x28')]('VERBOSE\x20\x22%s\x22',_0x3318bd));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x2c')]=function(_0x5d54a8,_0x2b6480){if(_['isArray'](_0x2b6480)){return this[_0x09ec('0x23')](util[_0x09ec('0x28')](_0x09ec('0x2d'),_0x5d54a8,_0x2b6480[_0x09ec('0x2e')](',')));}return this[_0x09ec('0x23')](util[_0x09ec('0x28')](_0x09ec('0x2d'),_0x5d54a8,_0x2b6480));};AGIChannel[_0x09ec('0x25')]['setContext']=function(_0x5ae77e){return this['sendRequest'](util['format'](_0x09ec('0x2f'),_0x5ae77e));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x30')]=function(_0x4cf342){return this[_0x09ec('0x23')](util[_0x09ec('0x28')](_0x09ec('0x31'),_0x4cf342));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x32')]=function(_0xa2288e){return this[_0x09ec('0x23')](util[_0x09ec('0x28')]('SET\x20PRIORITY\x20%s',_0xa2288e));};AGIChannel[_0x09ec('0x25')][_0x09ec('0xd')]=function(){return this['sendRequest'](_0x09ec('0x33'));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x34')]=function(_0x59b2b9,_0x37eebf){var _0x1527cb=_[_0x09ec('0x35')](_0x37eebf)||_[_0x09ec('0x36')](_0x37eebf)?_0x37eebf['toString']():_0x37eebf;return this[_0x09ec('0x23')](util[_0x09ec('0x28')](_0x09ec('0x37'),_0x59b2b9,_0x1527cb?_0x1527cb['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x38')]=function(_0x402176,_0x188fbd){return this[_0x09ec('0x23')](util[_0x09ec('0x28')](_0x09ec('0x39'),_0x402176,_0x188fbd));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x3a')]=function(_0x54f55b,_0x184f19){return this['sendRequest'](util[_0x09ec('0x28')]('SAY\x20DIGITS\x20%s\x20%s',_0x54f55b,_0x184f19));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x3b')]=function(_0x4a2fb7,_0x5135b0){return this['sendRequest'](util[_0x09ec('0x28')](_0x09ec('0x3c'),_0x4a2fb7,_0x5135b0));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x3d')]=function(_0x6fdceb,_0x1221fb,_0x40bf2c){_0x1221fb=_0x1221fb||this['extension'];_0x40bf2c=_0x40bf2c||0x1;this[_0x09ec('0x3e')](_0x6fdceb);this[_0x09ec('0x30')](_0x1221fb);this[_0x09ec('0x32')](_0x40bf2c);return this[_0x09ec('0x2a')](util[_0x09ec('0x28')](_0x09ec('0x3f'),_0x6fdceb,_0x1221fb,_0x40bf2c));};AGIChannel['prototype']['getVariable']=function(_0x3fc097){return this[_0x09ec('0x23')](util[_0x09ec('0x28')](_0x09ec('0x40'),_0x3fc097));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x41')]=function(_0x3b6c3e,_0x1bd06a,_0x1cfc94,_0x125eb4,_0x1da282,_0x5985d1){_0x1bd06a=_0x1bd06a||_0x09ec('0x42');_0x1cfc94=_0x1cfc94||'';_0x125eb4=_0x125eb4===undefined?-0x1:_0x125eb4==='-1'?-0x1:_0x125eb4*0x3e8;_0x1da282=_0x1da282===undefined?'':'s='+_0x1da282;_0x5985d1=_0x5985d1?_0x09ec('0x43'):'';return this[_0x09ec('0x23')](util[_0x09ec('0x28')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3b6c3e,_0x1bd06a,_0x1cfc94,_0x125eb4,_0x5985d1,_0x1da282));};AGIChannel[_0x09ec('0x25')][_0x09ec('0x44')]=function(_0x5db7d3,_0x4800e9){_0x4800e9=_0x4800e9||'';return this['sendRequest'](util[_0x09ec('0x28')](_0x09ec('0x45'),_0x5db7d3,_0x4800e9));};AGIChannel['prototype'][_0x09ec('0x46')]=function(_0x13fa4b){return this[_0x09ec('0x2c')]('AGI',_0x13fa4b);};AGIChannel[_0x09ec('0x25')]['wait']=function(_0x510bb2){return this['exec']('WAIT',_0x510bb2);};AGIChannel['prototype'][_0x09ec('0x18')]=function(_0x403f11,_0x1807ed){this[_0x09ec('0x2a')](util[_0x09ec('0x28')](_0x09ec('0x47'),_0x403f11['id'],_0x403f11[_0x09ec('0x48')],_0x1807ed));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x09ec('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index d1b7041..50e54a0 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 _0x6f7a=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','message','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.'];(function(_0x946239,_0x58da1c){var _0x3f07eb=function(_0x403bb8){while(--_0x403bb8){_0x946239['push'](_0x946239['shift']());}};_0x3f07eb(++_0x58da1c);}(_0x6f7a,0x81));var _0xa6f7=function(_0x3db6c2,_0x2c21bf){_0x3db6c2=_0x3db6c2-0x0;var _0x534cf2=_0x6f7a[_0x3db6c2];return _0x534cf2;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xa6f7('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xa6f7('0x1'),'E_AGI_SERVER_CLOSE':_0xa6f7('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xa6f7('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xa6f7('0x4'),'E_AGI_SOCKET_CLOSE':_0xa6f7('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xa6f7('0x6'),'E_AGI_COMMAND_EMPTY':_0xa6f7('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xa6f7('0x8')};function AGIError(_0x36ef42){var _0x36ef42=_0x36ef42||null,_0x1f1dde=_0x1f1dde||[],_0x449818=0x1,_0x59bfee='';if(!error[_0x36ef42]){_0x36ef42='E_AGI_UNDEFINED';}_0x1f1dde[_0xa6f7('0x9')](error[_0x36ef42]);while(arguments[_0x449818]){_0x1f1dde['push'](arguments[_0x449818]);_0x449818++;}_0x59bfee=util[_0xa6f7('0xa')]['apply'](util,_0x1f1dde);this[_0xa6f7('0xb')]=_0x59bfee;this['name']=_0x36ef42;}module['exports']=AGIError; \ No newline at end of file +var _0x6d61=['util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','apply','message','name','exports'];(function(_0x11668e,_0x5f3e5e){var _0x1cd231=function(_0x36396f){while(--_0x36396f){_0x11668e['push'](_0x11668e['shift']());}};_0x1cd231(++_0x5f3e5e);}(_0x6d61,0x1dc));var _0x16d6=function(_0x5aa29b,_0x2a4afa){_0x5aa29b=_0x5aa29b-0x0;var _0x14cda3=_0x6d61[_0x5aa29b];return _0x14cda3;};'use strict';var util=require(_0x16d6('0x0'));var error={'E_AGI_UNDEFINED':_0x16d6('0x1'),'E_AGI_ARGUMENT_PORT':_0x16d6('0x2'),'E_AGI_SERVER_ERROR':_0x16d6('0x3'),'E_AGI_SERVER_CLOSE':_0x16d6('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x16d6('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x16d6('0x6'),'E_AGI_COMMAND_EMPTY':_0x16d6('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x16d6('0x8')};function AGIError(_0x4c79cf){var _0x4c79cf=_0x4c79cf||null,_0x5c6693=_0x5c6693||[],_0x65bcbd=0x1,_0xeb8ef5='';if(!error[_0x4c79cf]){_0x4c79cf='E_AGI_UNDEFINED';}_0x5c6693[_0x16d6('0x9')](error[_0x4c79cf]);while(arguments[_0x65bcbd]){_0x5c6693[_0x16d6('0x9')](arguments[_0x65bcbd]);_0x65bcbd++;}_0xeb8ef5=util['format'][_0x16d6('0xa')](util,_0x5c6693);this[_0x16d6('0xb')]=_0xeb8ef5;this[_0x16d6('0xc')]=_0x4c79cf;}module[_0x16d6('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index c975203..c154d29 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 _0x5062=['events','EventEmitter','ioredis','./error','redis','defaults','subscribe','agi','emit','message','parse','projectUpdate','error','E_AGI_SERVER_ERROR','exports'];(function(_0x404e0c,_0x484e8a){var _0x373b3f=function(_0xef494e){while(--_0xef494e){_0x404e0c['push'](_0x404e0c['shift']());}};_0x373b3f(++_0x484e8a);}(_0x5062,0xd2));var _0x2506=function(_0x209699,_0x148a28){_0x209699=_0x209699-0x0;var _0x41be37=_0x5062[_0x209699];return _0x41be37;};'use strict';var _=require('lodash');var EventEmitter=require(_0x2506('0x0'))[_0x2506('0x1')];var Redis=require(_0x2506('0x2'));var AGIError=require(_0x2506('0x3'));var config=require('../../config/environment');config[_0x2506('0x4')]=_[_0x2506('0x5')](config[_0x2506('0x4')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x2506('0x4')]);sub[_0x2506('0x6')](_0x2506('0x7'),function(_0x45eb6b){if(_0x45eb6b)return eventEmitter[_0x2506('0x8')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x45eb6b));});sub['on'](_0x2506('0x9'),function(_0x44e622,_0x24c8cb){if(_0x44e622!=='agi')return;try{var _0x119a14=JSON[_0x2506('0xa')](_0x24c8cb);eventEmitter['emit'](_0x2506('0xb'),_0x119a14);}catch(_0x2f7c0a){eventEmitter[_0x2506('0x8')](_0x2506('0xc'),new AGIError(_0x2506('0xd'),_0x2f7c0a));}});module[_0x2506('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x91a3=['emit','error','message','parse','projectUpdate','E_AGI_SERVER_ERROR','lodash','events','EventEmitter','ioredis','../../config/environment','redis','defaults','localhost','agi'];(function(_0x39a4dc,_0x239b61){var _0x33a23e=function(_0xcf368f){while(--_0xcf368f){_0x39a4dc['push'](_0x39a4dc['shift']());}};_0x33a23e(++_0x239b61);}(_0x91a3,0x141));var _0x391a=function(_0x4e3a88,_0x2b9373){_0x4e3a88=_0x4e3a88-0x0;var _0x4620d9=_0x91a3[_0x4e3a88];return _0x4620d9;};'use strict';var _=require(_0x391a('0x0'));var EventEmitter=require(_0x391a('0x1'))[_0x391a('0x2')];var Redis=require(_0x391a('0x3'));var AGIError=require('./error');var config=require(_0x391a('0x4'));config[_0x391a('0x5')]=_[_0x391a('0x6')](config['redis'],{'host':_0x391a('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x391a('0x5')]);sub['subscribe'](_0x391a('0x8'),function(_0x21dd7d){if(_0x21dd7d)return eventEmitter[_0x391a('0x9')](_0x391a('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x21dd7d));});sub['on'](_0x391a('0xb'),function(_0x2c911c,_0x2050dc){if(_0x2c911c!==_0x391a('0x8'))return;try{var _0x1660f2=JSON[_0x391a('0xc')](_0x2050dc);eventEmitter[_0x391a('0x9')](_0x391a('0xd'),_0x1660f2);}catch(_0x2927d5){eventEmitter['emit'](_0x391a('0xa'),new AGIError(_0x391a('0xe'),_0x2927d5));}});module['exports']={'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 8b59e6f..3aee26e 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 _0xa99a=['vertices','addEdge','push','size','getVertex','traverseBFS','info','stop\x20traverse','length','condition','vswitch','agicommand','target','default\x20on\x20switch\x20not\x20found','includes','lodash','../../../config/logger','menu','getsecretdigits','edges','numberOfEdges','prototype'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0xa99a,0x7d));var _0xaa99=function(_0x36a468,_0xd0ddc2){_0x36a468=_0x36a468-0x0;var _0x33afe0=_0xa99a[_0x36a468];return _0x33afe0;};'use strict';var _=require(_0xaa99('0x0'));var logger=require(_0xaa99('0x1'))('agi');var verticesWithRetry=[_0xaa99('0x2'),'getdigits',_0xaa99('0x3')];var Graph=function(){this['vertices']={};this[_0xaa99('0x4')]={};this[_0xaa99('0x5')]=0x0;};Graph[_0xaa99('0x6')]['addVertex']=function(_0x11603e){this[_0xaa99('0x7')][_0x11603e['id']]=_0x11603e;this[_0xaa99('0x4')][_0x11603e['id']]=[];};Graph[_0xaa99('0x6')][_0xaa99('0x8')]=function(_0x4784fc,_0x3e7d7e,_0x3c4af3){this[_0xaa99('0x4')][_0x4784fc][_0xaa99('0x9')]({'target':_0x3e7d7e,'condition':_0x3c4af3});this[_0xaa99('0x5')]+=0x1;};Graph[_0xaa99('0x6')][_0xaa99('0xa')]=function(){return _['size'](this[_0xaa99('0x7')]);};Graph['prototype']['relations']=function(){return this[_0xaa99('0x5')];};Graph['prototype'][_0xaa99('0xb')]=function(_0x57d1b8){return this[_0xaa99('0x7')][_0x57d1b8];};Graph[_0xaa99('0x6')][_0xaa99('0xc')]=function(_0x149ac3,_0x2588af){if(!this[_0xaa99('0x7')][_0x149ac3]){return logger['info']('no\x20vertex\x20found');}var _0x1a0e5f=_0x2588af(this[_0xaa99('0x7')][_0x149ac3]);if(!_0x1a0e5f){return logger[_0xaa99('0xd')](_0xaa99('0xe'));}if(this[_0xaa99('0x4')][_0x149ac3][_0xaa99('0xf')]===0x0){return logger[_0xaa99('0xd')]('no\x20edge/s\x20available');}for(var _0x2ae3c2=0x0,_0x5517a1=[],_0x2b3a37=![];_0x2ae3c2\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','[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','evtHangup','createSquareReport','catch','hasOwnProperty','indexOf','agi_','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','find','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','then','getAll','[LICENSE]','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','findIndex','deleted','splice','push','error','log'];(function(_0x2e75c8,_0x43557b){var _0x4ebdd0=function(_0x308628){while(--_0x308628){_0x2e75c8['push'](_0x2e75c8['shift']());}};_0x4ebdd0(++_0x43557b);}(_0xc3c4,0xa2));var _0x4c3c=function(_0x25a23b,_0xca2f0d){_0x25a23b=_0x25a23b-0x0;var _0x1f01f6=_0xc3c4[_0x25a23b];return _0x1f01f6;};'use strict';var _=require(_0x4c3c('0x0'));var syncho=require(_0x4c3c('0x1'));var util=require(_0x4c3c('0x2'));var config=require(_0x4c3c('0x3'));var logger=require(_0x4c3c('0x4'))(_0x4c3c('0x5'));var utilLicense=require(_0x4c3c('0x6'));var rpc=require(_0x4c3c('0x7'));var Project=require(_0x4c3c('0x8'));var AGIEmitter=require(_0x4c3c('0x9'))[_0x4c3c('0xa')];var projects=[];config[_0x4c3c('0x5')]=_[_0x4c3c('0xb')](config[_0x4c3c('0x5')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x6d3aa3){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x6d3aa3);agiHandler(_0x6d3aa3);}catch(_0xb2b223){logger['error'](_0xb2b223['stack']);}});});}function projectUpdateHandler(_0xe5445){try{var _0x3be65c=_[_0x4c3c('0xc')](projects,['id',_0xe5445['id']]);if(_0x3be65c>-0x1){if(_0xe5445[_0x4c3c('0xd')]===!![]){projects[_0x4c3c('0xe')](_0x3be65c,0x1);}else{projects[_0x3be65c]=_0xe5445;}}else{projects[_0x4c3c('0xf')](_0xe5445);}}catch(_0x5e0470){logger[_0x4c3c('0x10')](_0x5e0470['stack']);}}function listeningHandler(){console[_0x4c3c('0x11')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x4c3c('0x5')][_0x4c3c('0x12')]);logger[_0x4c3c('0x13')](util['format'](_0x4c3c('0x14'),config[_0x4c3c('0x5')]['ip'],config[_0x4c3c('0x5')][_0x4c3c('0x12')]));}function errorHandler(_0x1ab1cc){if(_0x1ab1cc&&_0x1ab1cc[_0x4c3c('0x15')]&&_0x1ab1cc['message']){logger[_0x4c3c('0x10')](util[_0x4c3c('0x16')](_0x4c3c('0x17'),_0x1ab1cc[_0x4c3c('0x15')],_0x1ab1cc[_0x4c3c('0x18')]));}else{logger['error'](util[_0x4c3c('0x16')](_0x4c3c('0x19'),_0x1ab1cc[_0x4c3c('0x1a')]));}}function closeHandler(){logger['info'](util[_0x4c3c('0x16')](_0x4c3c('0x1b'),this[_0x4c3c('0x1c')],this[_0x4c3c('0x1d')],this[_0x4c3c('0x1e')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x32be99){logger[_0x4c3c('0x10')](_0x32be99[_0x4c3c('0x1a')]);}}function timeoutHandler(){logger['info'](util[_0x4c3c('0x16')](_0x4c3c('0x1f'),this[_0x4c3c('0x1c')],this[_0x4c3c('0x1d')],this[_0x4c3c('0x1e')],this[_0x4c3c('0x20')],this['uniqueid']));}function hangupHandler(){logger['info'](util['format'](_0x4c3c('0x21'),this[_0x4c3c('0x1c')],this[_0x4c3c('0x1d')],this['callerid'],this['dnid'],this['uniqueid']));this[_0x4c3c('0x22')]=!![];}function createSquareReport(_0x381e20,_0x383245){rpc[_0x4c3c('0x23')](_0x381e20)['then'](function(_0x39893f){if(_0x383245){_0x383245(null,_0x39893f);}})[_0x4c3c('0x24')](function(_0x2e8182){if(_0x383245){_0x383245(null,_0x2e8182);}});}function setChannelVariables(_0x422d95){for(var _0x396fd1 in _0x422d95){if(_0x422d95[_0x4c3c('0x25')](_0x396fd1)){if(_0x396fd1[_0x4c3c('0x26')](_0x4c3c('0x27'))===0x0){_0x422d95[_0x396fd1[_0x4c3c('0x28')](0x4)]=_0x422d95[_0x396fd1];delete _0x422d95[_0x396fd1];}}}}function agiHandler(_0x450fba){logger[_0x4c3c('0x29')]('variables',JSON[_0x4c3c('0x2a')](_0x450fba,null,0x2));logger[_0x4c3c('0x13')](util[_0x4c3c('0x16')](_0x4c3c('0x2b'),_0x450fba[_0x4c3c('0x1c')],_0x450fba[_0x4c3c('0x1d')],_0x450fba[_0x4c3c('0x1e')],_0x450fba[_0x4c3c('0x20')],_0x450fba['uniqueid']));_0x450fba['on'](_0x4c3c('0x10'),errorHandler);_0x450fba['on'](_0x4c3c('0x2c'),closeHandler);_0x450fba['on']('timeout',timeoutHandler);_0x450fba['evtHangup']=![];_0x450fba['on']('hangup',hangupHandler);var _0x48b772=_[_0x4c3c('0x2d')](projects,['name',_0x450fba[_0x4c3c('0x1c')]]);if(!_0x48b772)return Project['handleNotFound'](_0x450fba);if(!_0x48b772[_0x4c3c('0x2e')])return Project[_0x4c3c('0x2f')](_0x450fba);return Project[_0x4c3c('0x30')](_0x48b772,_0x450fba);}function main(){var _0xa92c0a;return utilLicense[_0x4c3c('0x31')]()['then'](function(_0x2fd5a5){if(!_0x2fd5a5)return;if(_0x2fd5a5[_0x4c3c('0x32')]){if(_0x2fd5a5[_0x4c3c('0x33')]&&_0x2fd5a5[_0x4c3c('0x33')]>0x0){logger[_0x4c3c('0x13')](util['format'](_0x4c3c('0x34'),_0x2fd5a5['callysquare']));_0xa92c0a=_0x2fd5a5[_0x4c3c('0x33')];}else{logger['info'](_0x4c3c('0x35'));}}else{logger[_0x4c3c('0x13')](_0x4c3c('0x36'));_0xa92c0a=-0x1;}})[_0x4c3c('0x37')](function(){return Project[_0x4c3c('0x38')]();})[_0x4c3c('0x37')](function(_0x584b26){projects=_0x584b26;return;})[_0x4c3c('0x24')](function(_0x3a7c98){logger['error'](_0x4c3c('0x39'),_0x3a7c98[_0x4c3c('0x1a')]);})['finally'](function(){var _0x3d4e7f=require('./server')(config['agi']['port'],config[_0x4c3c('0x5')]['ip'],_0xa92c0a);_0x3d4e7f['on'](_0x4c3c('0x10'),errorHandler);_0x3d4e7f['on'](_0x4c3c('0x3a'),listeningHandler);_0x3d4e7f['on'](_0x4c3c('0x3b'),connectionHandler);_0x3d4e7f['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xdb47=['find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','[LICENSE]','listening','connection','close','lodash','syncho','util','../../config/environment','../../config/logger','agi','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','hasOwnProperty','indexOf','agi_','substring','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup'];(function(_0x3fb90d,_0xf3be1b){var _0x41d208=function(_0x1e8983){while(--_0x1e8983){_0x3fb90d['push'](_0x3fb90d['shift']());}};_0x41d208(++_0xf3be1b);}(_0xdb47,0x145));var _0x7db4=function(_0x51eba4,_0x1ed011){_0x51eba4=_0x51eba4-0x0;var _0x3195ce=_0xdb47[_0x51eba4];return _0x3195ce;};'use strict';var _=require(_0x7db4('0x0'));var syncho=require(_0x7db4('0x1'));var util=require(_0x7db4('0x2'));var config=require(_0x7db4('0x3'));var logger=require(_0x7db4('0x4'))(_0x7db4('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0x7db4('0x6'));var Project=require(_0x7db4('0x7'));var AGIEmitter=require(_0x7db4('0x8'))[_0x7db4('0x9')];var projects=[];config[_0x7db4('0x5')]=_[_0x7db4('0xa')](config[_0x7db4('0x5')],{'ip':_0x7db4('0xb'),'port':0x11dd});AGIEmitter['on'](_0x7db4('0xc'),projectUpdateHandler);function connectionHandler(_0x437645){process[_0x7db4('0xd')](function(){syncho(function(){try{setChannelVariables(_0x437645);agiHandler(_0x437645);}catch(_0x3d7ae5){logger[_0x7db4('0xe')](_0x3d7ae5[_0x7db4('0xf')]);}});});}function projectUpdateHandler(_0x5ec57f){try{var _0xc31447=_[_0x7db4('0x10')](projects,['id',_0x5ec57f['id']]);if(_0xc31447>-0x1){if(_0x5ec57f[_0x7db4('0x11')]===!![]){projects[_0x7db4('0x12')](_0xc31447,0x1);}else{projects[_0xc31447]=_0x5ec57f;}}else{projects['push'](_0x5ec57f);}}catch(_0x2cc6b5){logger['error'](_0x2cc6b5[_0x7db4('0xf')]);}}function listeningHandler(){console[_0x7db4('0x13')](_0x7db4('0x14'),config['agi'][_0x7db4('0x15')]);logger[_0x7db4('0x16')](util[_0x7db4('0x17')](_0x7db4('0x18'),config['agi']['ip'],config['agi'][_0x7db4('0x15')]));}function errorHandler(_0x4c65d6){if(_0x4c65d6&&_0x4c65d6[_0x7db4('0x19')]&&_0x4c65d6[_0x7db4('0x1a')]){logger['error'](util[_0x7db4('0x17')](_0x7db4('0x1b'),_0x4c65d6[_0x7db4('0x19')],_0x4c65d6['message']));}else{logger[_0x7db4('0xe')](util['format'](_0x7db4('0x1c'),_0x4c65d6[_0x7db4('0xf')]));}}function closeHandler(){logger[_0x7db4('0x16')](util[_0x7db4('0x17')](_0x7db4('0x1d'),this[_0x7db4('0x1e')],this[_0x7db4('0x1f')],this[_0x7db4('0x20')],this[_0x7db4('0x21')],this[_0x7db4('0x22')]));try{createSquareReport(this);}catch(_0x98ddc9){logger[_0x7db4('0xe')](_0x98ddc9[_0x7db4('0xf')]);}}function timeoutHandler(){logger[_0x7db4('0x16')](util[_0x7db4('0x17')](_0x7db4('0x23'),this[_0x7db4('0x1e')],this[_0x7db4('0x1f')],this['callerid'],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0x7db4('0x16')](util[_0x7db4('0x17')](_0x7db4('0x24'),this[_0x7db4('0x1e')],this[_0x7db4('0x1f')],this[_0x7db4('0x20')],this[_0x7db4('0x21')],this[_0x7db4('0x22')]));this[_0x7db4('0x25')]=!![];}function createSquareReport(_0x1d560b,_0x227a2c){rpc[_0x7db4('0x26')](_0x1d560b)[_0x7db4('0x27')](function(_0x30861c){if(_0x227a2c){_0x227a2c(null,_0x30861c);}})['catch'](function(_0x5d904b){if(_0x227a2c){_0x227a2c(null,_0x5d904b);}});}function setChannelVariables(_0x2c8935){for(var _0x2de340 in _0x2c8935){if(_0x2c8935[_0x7db4('0x28')](_0x2de340)){if(_0x2de340[_0x7db4('0x29')](_0x7db4('0x2a'))===0x0){_0x2c8935[_0x2de340[_0x7db4('0x2b')](0x4)]=_0x2c8935[_0x2de340];delete _0x2c8935[_0x2de340];}}}}function agiHandler(_0x15f475){logger['debug']('variables',JSON['stringify'](_0x15f475,null,0x2));logger[_0x7db4('0x16')](util[_0x7db4('0x17')](_0x7db4('0x2c'),_0x15f475[_0x7db4('0x1e')],_0x15f475[_0x7db4('0x1f')],_0x15f475[_0x7db4('0x20')],_0x15f475[_0x7db4('0x21')],_0x15f475['uniqueid']));_0x15f475['on'](_0x7db4('0xe'),errorHandler);_0x15f475['on']('close',closeHandler);_0x15f475['on'](_0x7db4('0x2d'),timeoutHandler);_0x15f475[_0x7db4('0x25')]=![];_0x15f475['on'](_0x7db4('0x2e'),hangupHandler);var _0x40719f=_[_0x7db4('0x2f')](projects,[_0x7db4('0x19'),_0x15f475[_0x7db4('0x1e')]]);if(!_0x40719f)return Project[_0x7db4('0x30')](_0x15f475);if(!_0x40719f[_0x7db4('0x31')])return Project[_0x7db4('0x32')](_0x15f475);return Project[_0x7db4('0x33')](_0x40719f,_0x15f475);}function main(){var _0x41bfeb;return utilLicense[_0x7db4('0x34')]()[_0x7db4('0x27')](function(_0x36987a){if(!_0x36987a)return;if(_0x36987a[_0x7db4('0x35')]){if(_0x36987a['callysquare']&&_0x36987a[_0x7db4('0x36')]>0x0){logger[_0x7db4('0x16')](util[_0x7db4('0x17')]('[LICENSE]\x20CHANNELS:\x20%s',_0x36987a[_0x7db4('0x36')]));_0x41bfeb=_0x36987a['callysquare'];}else{logger[_0x7db4('0x16')](_0x7db4('0x37'));}}else{logger['info'](_0x7db4('0x38'));_0x41bfeb=-0x1;}})[_0x7db4('0x27')](function(){return Project['getAll']();})['then'](function(_0x1ae673){projects=_0x1ae673;return;})[_0x7db4('0x39')](function(_0x27cf1e){logger['error'](_0x7db4('0x3a'),_0x27cf1e[_0x7db4('0xf')]);})['finally'](function(){var _0x18b01a=require('./server')(config[_0x7db4('0x5')][_0x7db4('0x15')],config[_0x7db4('0x5')]['ip'],_0x41bfeb);_0x18b01a['on'](_0x7db4('0xe'),errorHandler);_0x18b01a['on'](_0x7db4('0x3b'),listeningHandler);_0x18b01a['on'](_0x7db4('0x3c'),connectionHandler);_0x18b01a['on'](_0x7db4('0x3d'),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 305c314..f6e216e 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 _0x3978=['error','message','result','catch','sendMailMessage','SendMail','bluebird','http','request'];(function(_0x3c07dd,_0x30cdf1){var _0x1934b8=function(_0xa1e261){while(--_0xa1e261){_0x3c07dd['push'](_0x3c07dd['shift']());}};_0x1934b8(++_0x30cdf1);}(_0x3978,0x12f));var _0x8397=function(_0x42cb46,_0x4ed8e9){_0x42cb46=_0x42cb46-0x0;var _0x4c2723=_0x3978[_0x42cb46];return _0x4c2723;};'use strict';var BPromise=require(_0x8397('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8397('0x1')]({'port':0x232b});function request(_0x1f0614,_0x273835){return new BPromise(function(_0x694fbf,_0x3c7675){return client[_0x8397('0x2')](_0x1f0614,_0x273835)['then'](function(_0x28b3b4){if(_0x28b3b4[_0x8397('0x3')]){return _0x3c7675(_0x28b3b4[_0x8397('0x3')][_0x8397('0x4')]);}else{return _0x694fbf(_0x28b3b4[_0x8397('0x5')]);}})[_0x8397('0x6')](function(_0x2bdac5){return _0x3c7675(_0x2bdac5);});});}exports[_0x8397('0x7')]=function(_0x268d3f,_0x186c06){return request(_0x8397('0x8'),{'account':_0x268d3f,'message':_0x186c06});}; \ No newline at end of file +var _0x7d4b=['bluebird','jayson/promise','http','request','then','error','message','result','catch','sendMailMessage','SendMail'];(function(_0x461b99,_0x187486){var _0x2dc278=function(_0x5d7689){while(--_0x5d7689){_0x461b99['push'](_0x461b99['shift']());}};_0x2dc278(++_0x187486);}(_0x7d4b,0x8f));var _0xb7d4=function(_0x4ee814,_0x5043ed){_0x4ee814=_0x4ee814-0x0;var _0x29ea69=_0x7d4b[_0x4ee814];return _0x29ea69;};'use strict';var BPromise=require(_0xb7d4('0x0'));var jayson=require(_0xb7d4('0x1'));var client=jayson['client'][_0xb7d4('0x2')]({'port':0x232b});function request(_0x270f4e,_0x4195df){return new BPromise(function(_0xfc71dd,_0x1b0bf6){return client[_0xb7d4('0x3')](_0x270f4e,_0x4195df)[_0xb7d4('0x4')](function(_0x58d7e0){if(_0x58d7e0[_0xb7d4('0x5')]){return _0x1b0bf6(_0x58d7e0[_0xb7d4('0x5')][_0xb7d4('0x6')]);}else{return _0xfc71dd(_0x58d7e0[_0xb7d4('0x7')]);}})[_0xb7d4('0x8')](function(_0x53999a){return _0x1b0bf6(_0x53999a);});});}exports[_0xb7d4('0x9')]=function(_0x4768fc,_0x2ddaa0){return request(_0xb7d4('0xa'),{'account':_0x4768fc,'message':_0x2ddaa0});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 00bd375..d2c9e6c 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 _0x7ae2=['inspect','production','start','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','traverseBFS','clear','debug','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','evtHangup','isUndefined','result','toString','agicommand\x20not\x20found','stack','finally','uniqueid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','lodash','moment','xml2json','util','../../config/logger','agi','./mailRpc','./graph','./vertices','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root'];(function(_0x4fecf3,_0x17fdb0){var _0x50161f=function(_0x49b2ad){while(--_0x49b2ad){_0x4fecf3['push'](_0x4fecf3['shift']());}};_0x50161f(++_0x17fdb0);}(_0x7ae2,0x13d));var _0x27ae=function(_0x555df7,_0x45d0af){_0x555df7=_0x555df7-0x0;var _0x5efd64=_0x7ae2[_0x555df7];return _0x5efd64;};'use strict';var _=require(_0x27ae('0x0'));var moment=require(_0x27ae('0x1'));var parser=require(_0x27ae('0x2'));var util=require(_0x27ae('0x3'));var logger=require(_0x27ae('0x4'))(_0x27ae('0x5'));var rpc=require('./rpc');var mailRpc=require(_0x27ae('0x6'));var Graph=require(_0x27ae('0x7'));var Vertices=require(_0x27ae('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0x3db739){logger[_0x27ae('0x9')](_0x27ae('0xa'),_0x3db739['stack']);return[];});}function addVertex(_0x17a916,_0x400a5a,_0x4d192c){_0x400a5a[_0x27ae('0xb')]=_0x4d192c;if(_0x400a5a[_0x27ae('0xc')](_0x27ae('0xd'))){_0x400a5a['maxRetry']=parseInt(_0x400a5a[_0x27ae('0xd')],0xa);}_0x17a916['addVertex'](_[_0x27ae('0xe')](_0x400a5a,_0x27ae('0xf')));}function initGraph(_0x12d359,_0x208aeb){var _0x2845bf=new Graph();for(var _0x3b52d6 in _0x12d359){if(_0x12d359[_0x27ae('0xc')](_0x3b52d6)){if(_[_0x27ae('0x10')](_0x12d359[_0x3b52d6])){for(var _0x12df09=0x0;_0x12df09<_0x12d359[_0x3b52d6]['length'];_0x12df09+=0x1){addVertex(_0x2845bf,_0x12d359[_0x3b52d6][_0x12df09],_0x3b52d6);}}else{addVertex(_0x2845bf,_0x12d359[_0x3b52d6],_0x3b52d6);}}}for(var _0x30a0aa=0x0;_0x30a0aa<_0x208aeb[_0x27ae('0x11')];_0x30a0aa+=0x1){if(_0x208aeb[_0x30a0aa][_0x27ae('0x12')]&&_0x208aeb[_0x30a0aa][_0x27ae('0x13')]){_0x2845bf[_0x27ae('0x14')](_0x208aeb[_0x30a0aa][_0x27ae('0x12')],_0x208aeb[_0x30a0aa][_0x27ae('0x13')],_0x208aeb[_0x30a0aa][_0x27ae('0x15')]);}}return _0x2845bf;}function getRoot(_0x554f5b){return parser[_0x27ae('0x16')](_0x554f5b,{'object':!![]})[_0x27ae('0x17')][_0x27ae('0x18')];}function inspect(_0x1eb740){return util[_0x27ae('0x19')](_0x1eb740,{'showHidden':![],'depth':null});}function initialize(_0x40ecb1,_0x1532e3){var _0x2cc9ce=getRoot(_0x40ecb1[_0x27ae('0x1a')]);if(!_0x2cc9ce||!_0x2cc9ce[_0x27ae('0x1b')])return;var _0x4cd801,_0x16481f,_0x570b24;logger['debug'](_0x27ae('0x18'),JSON[_0x27ae('0x1c')](_0x2cc9ce,null,0x2));_0x1532e3[_0x27ae('0x1d')]=moment()[_0x27ae('0x1e')](_0x27ae('0x1f'));_0x4cd801=initGraph(_['omit'](_0x2cc9ce,_0x27ae('0xf')),_0x2cc9ce[_0x27ae('0xf')]);_0x16481f=new Vertices(_0x1532e3,rpc,mailRpc);logger[_0x27ae('0x20')](util[_0x27ae('0x1e')](_0x27ae('0x21'),_0x1532e3[_0x27ae('0x22')],_0x1532e3['calleridname'],_0x1532e3[_0x27ae('0x23')],_0x1532e3['dnid'],_0x1532e3['uniqueid']));_0x4cd801[_0x27ae('0x24')](_0x2cc9ce[_0x27ae('0x1b')]['id'],function(_0x479cb7){try{_0x479cb7=_0x16481f[_0x27ae('0x25')](_0x479cb7);logger[_0x27ae('0x26')]('vertex',JSON[_0x27ae('0x1c')](_0x479cb7,null,0x2));if(_0x479cb7[_0x27ae('0xb')]==='gotoc'){logger[_0x27ae('0x20')](_0x27ae('0x27'));_0x1532e3[_0x27ae('0x28')]=_0x479cb7[_0x27ae('0x28')]||_0x1532e3[_0x27ae('0x28')];_0x1532e3['extension']=_0x479cb7[_0x27ae('0x29')];_0x1532e3[_0x27ae('0x2a')]=_0x479cb7[_0x27ae('0x2a')]?_0x479cb7['priority']-0x1:0x1;return null;}else if(_0x479cb7&&_0x16481f[_0x479cb7[_0x27ae('0xb')]]){_0x570b24=_0x16481f[_0x479cb7['agicommand']](_0x479cb7);logger[_0x27ae('0x20')](_0x27ae('0x2b'),JSON[_0x27ae('0x1c')](_0x570b24,null,0x2));if(_0x570b24&&_0x570b24['code']===AGI_CODE_SUCCESS&&_0x570b24['result']!==AGI_RESULT_ERROR&&!_0x1532e3[_0x27ae('0x2c')]){logger['debug'](_0x27ae('0x2b'),inspect(_0x570b24));return _[_0x27ae('0x2d')](_0x570b24[_0x27ae('0x2e')])?null:_0x570b24['result'][_0x27ae('0x2f')]();}else{logger['error'](_0x27ae('0x2b'),inspect(_0x570b24));return null;}}else{logger[_0x27ae('0x9')](_0x27ae('0x30'));return null;}}catch(_0x4e6bb2){logger[_0x27ae('0x9')](_0x4e6bb2[_0x27ae('0x31')]);return null;}});if(_0x2cc9ce[_0x27ae('0x32')]){logger[_0x27ae('0x20')](util[_0x27ae('0x1e')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1532e3[_0x27ae('0x22')],_0x1532e3['calleridname'],_0x1532e3[_0x27ae('0x23')],_0x1532e3['dnid'],_0x1532e3[_0x27ae('0x33')]));_0x4cd801['traverseBFS'](_0x2cc9ce[_0x27ae('0x32')]['id'],function(_0x3b833a){try{_0x3b833a=_0x16481f['clear'](_0x3b833a);logger[_0x27ae('0x26')]('vertex',JSON[_0x27ae('0x1c')](_0x3b833a,null,0x2));if(_0x3b833a&&_0x16481f[_0x3b833a[_0x27ae('0xb')]]){_0x570b24=_0x16481f[_0x3b833a[_0x27ae('0xb')]](_0x3b833a);if(_0x570b24){logger[_0x27ae('0x26')](_0x27ae('0x2b'),inspect(_0x570b24));return _['isUndefined'](_0x570b24[_0x27ae('0x2e')])?null:_0x570b24[_0x27ae('0x2e')][_0x27ae('0x2f')]();}else{logger[_0x27ae('0x9')]('response',inspect(_0x570b24));return null;}}else{logger[_0x27ae('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x3c8603){logger[_0x27ae('0x9')](_0x3c8603['stack']);return null;}});}logger[_0x27ae('0x20')](util[_0x27ae('0x1e')](_0x27ae('0x34'),_0x1532e3['arg_1'],_0x1532e3['calleridname'],_0x1532e3[_0x27ae('0x23')],_0x1532e3['dnid'],_0x1532e3[_0x27ae('0x33')]));logger[_0x27ae('0x20')](util[_0x27ae('0x1e')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x1532e3[_0x27ae('0x28')],_0x1532e3[_0x27ae('0x29')],parseInt(_0x1532e3[_0x27ae('0x2a')],0xa)+0x1));_0x1532e3['continueAt'](_0x1532e3[_0x27ae('0x28')],_0x1532e3[_0x27ae('0x29')],parseInt(_0x1532e3[_0x27ae('0x2a')],0xa)+0x1);_0x1532e3[_0x27ae('0x35')]();}function handleNotFound(_0x3c3dc5){logger[_0x27ae('0x9')](util['format'](_0x27ae('0x36'),_0x3c3dc5[_0x27ae('0x22')]));_0x3c3dc5[_0x27ae('0x37')](_0x3c3dc5['context'],_0x3c3dc5[_0x27ae('0x29')],parseInt(_0x3c3dc5[_0x27ae('0x2a')],0xa)+0x1);_0x3c3dc5[_0x27ae('0x35')]();}function handleUnpublished(_0x1f1c28){logger[_0x27ae('0x9')](util[_0x27ae('0x1e')](_0x27ae('0x38'),_0x1f1c28[_0x27ae('0x22')]));_0x1f1c28[_0x27ae('0x37')](_0x1f1c28[_0x27ae('0x28')],_0x1f1c28['extension'],parseInt(_0x1f1c28['priority'],0xa)+0x1);_0x1f1c28[_0x27ae('0x35')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xca7d=['calleridname','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','lodash','moment','util','agi','./rpc','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','traverseBFS','clear','debug','vertex','stringify','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x3e6f8f,_0x5d93fe){var _0x4cbeb6=function(_0x5421fe){while(--_0x5421fe){_0x3e6f8f['push'](_0x3e6f8f['shift']());}};_0x4cbeb6(++_0x5d93fe);}(_0xca7d,0xba));var _0xdca7=function(_0x27a3d0,_0x2b4214){_0x27a3d0=_0x27a3d0-0x0;var _0x4cc94d=_0xca7d[_0x27a3d0];return _0x4cc94d;};'use strict';var _=require(_0xdca7('0x0'));var moment=require(_0xdca7('0x1'));var parser=require('xml2json');var util=require(_0xdca7('0x2'));var logger=require('../../config/logger')(_0xdca7('0x3'));var rpc=require(_0xdca7('0x4'));var mailRpc=require(_0xdca7('0x5'));var Graph=require(_0xdca7('0x6'));var Vertices=require(_0xdca7('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xdca7('0x8')](function(_0x4bc69e){logger[_0xdca7('0x9')](_0xdca7('0xa'),_0x4bc69e['stack']);return[];});}function addVertex(_0x383946,_0x59500e,_0x4dff14){_0x59500e[_0xdca7('0xb')]=_0x4dff14;if(_0x59500e[_0xdca7('0xc')]('retry')){_0x59500e[_0xdca7('0xd')]=parseInt(_0x59500e[_0xdca7('0xe')],0xa);}_0x383946[_0xdca7('0xf')](_[_0xdca7('0x10')](_0x59500e,_0xdca7('0x11')));}function initGraph(_0x7d031f,_0x39bd3a){var _0x36cf5b=new Graph();for(var _0x4bf5fe in _0x7d031f){if(_0x7d031f[_0xdca7('0xc')](_0x4bf5fe)){if(_[_0xdca7('0x12')](_0x7d031f[_0x4bf5fe])){for(var _0x1f0804=0x0;_0x1f0804<_0x7d031f[_0x4bf5fe][_0xdca7('0x13')];_0x1f0804+=0x1){addVertex(_0x36cf5b,_0x7d031f[_0x4bf5fe][_0x1f0804],_0x4bf5fe);}}else{addVertex(_0x36cf5b,_0x7d031f[_0x4bf5fe],_0x4bf5fe);}}}for(var _0x2e508d=0x0;_0x2e508d<_0x39bd3a[_0xdca7('0x13')];_0x2e508d+=0x1){if(_0x39bd3a[_0x2e508d][_0xdca7('0x14')]&&_0x39bd3a[_0x2e508d][_0xdca7('0x15')]){_0x36cf5b[_0xdca7('0x16')](_0x39bd3a[_0x2e508d][_0xdca7('0x14')],_0x39bd3a[_0x2e508d][_0xdca7('0x15')],_0x39bd3a[_0x2e508d][_0xdca7('0x17')]);}}return _0x36cf5b;}function getRoot(_0x17a231){return parser[_0xdca7('0x18')](_0x17a231,{'object':!![]})[_0xdca7('0x19')][_0xdca7('0x1a')];}function inspect(_0x2f1c80){return util['inspect'](_0x2f1c80,{'showHidden':![],'depth':null});}function initialize(_0x3872ba,_0xc3e0){var _0x490474=getRoot(_0x3872ba[_0xdca7('0x1b')]);if(!_0x490474||!_0x490474[_0xdca7('0x1c')])return;var _0x131f1a,_0x783ba3,_0x2b6b93;logger['debug'](_0xdca7('0x1a'),JSON['stringify'](_0x490474,null,0x2));_0xc3e0[_0xdca7('0x1d')]=moment()['format'](_0xdca7('0x1e'));_0x131f1a=initGraph(_['omit'](_0x490474,'mxCell'),_0x490474[_0xdca7('0x11')]);_0x783ba3=new Vertices(_0xc3e0,rpc,mailRpc);logger[_0xdca7('0x1f')](util[_0xdca7('0x20')](_0xdca7('0x21'),_0xc3e0[_0xdca7('0x22')],_0xc3e0['calleridname'],_0xc3e0[_0xdca7('0x23')],_0xc3e0[_0xdca7('0x24')],_0xc3e0['uniqueid']));_0x131f1a[_0xdca7('0x25')](_0x490474[_0xdca7('0x1c')]['id'],function(_0x442a31){try{_0x442a31=_0x783ba3[_0xdca7('0x26')](_0x442a31);logger[_0xdca7('0x27')](_0xdca7('0x28'),JSON[_0xdca7('0x29')](_0x442a31,null,0x2));if(_0x442a31[_0xdca7('0xb')]==='gotoc'){logger[_0xdca7('0x1f')](_0xdca7('0x2a'));_0xc3e0[_0xdca7('0x2b')]=_0x442a31[_0xdca7('0x2b')]||_0xc3e0[_0xdca7('0x2b')];_0xc3e0[_0xdca7('0x2c')]=_0x442a31[_0xdca7('0x2c')];_0xc3e0['priority']=_0x442a31[_0xdca7('0x2d')]?_0x442a31['priority']-0x1:0x1;return null;}else if(_0x442a31&&_0x783ba3[_0x442a31[_0xdca7('0xb')]]){_0x2b6b93=_0x783ba3[_0x442a31[_0xdca7('0xb')]](_0x442a31);logger[_0xdca7('0x1f')](_0xdca7('0x2e'),JSON[_0xdca7('0x29')](_0x2b6b93,null,0x2));if(_0x2b6b93&&_0x2b6b93[_0xdca7('0x2f')]===AGI_CODE_SUCCESS&&_0x2b6b93[_0xdca7('0x30')]!==AGI_RESULT_ERROR&&!_0xc3e0['evtHangup']){logger[_0xdca7('0x27')]('response',inspect(_0x2b6b93));return _['isUndefined'](_0x2b6b93[_0xdca7('0x30')])?null:_0x2b6b93[_0xdca7('0x30')][_0xdca7('0x31')]();}else{logger[_0xdca7('0x9')](_0xdca7('0x2e'),inspect(_0x2b6b93));return null;}}else{logger[_0xdca7('0x9')](_0xdca7('0x32'));return null;}}catch(_0x1ec9e4){logger[_0xdca7('0x9')](_0x1ec9e4[_0xdca7('0x33')]);return null;}});if(_0x490474[_0xdca7('0x34')]){logger[_0xdca7('0x1f')](util['format'](_0xdca7('0x35'),_0xc3e0[_0xdca7('0x22')],_0xc3e0[_0xdca7('0x36')],_0xc3e0['callerid'],_0xc3e0[_0xdca7('0x24')],_0xc3e0['uniqueid']));_0x131f1a[_0xdca7('0x25')](_0x490474[_0xdca7('0x34')]['id'],function(_0x2a7d16){try{_0x2a7d16=_0x783ba3[_0xdca7('0x26')](_0x2a7d16);logger[_0xdca7('0x27')](_0xdca7('0x28'),JSON[_0xdca7('0x29')](_0x2a7d16,null,0x2));if(_0x2a7d16&&_0x783ba3[_0x2a7d16[_0xdca7('0xb')]]){_0x2b6b93=_0x783ba3[_0x2a7d16[_0xdca7('0xb')]](_0x2a7d16);if(_0x2b6b93){logger[_0xdca7('0x27')](_0xdca7('0x2e'),inspect(_0x2b6b93));return _[_0xdca7('0x37')](_0x2b6b93[_0xdca7('0x30')])?null:_0x2b6b93[_0xdca7('0x30')][_0xdca7('0x31')]();}else{logger['error']('response',inspect(_0x2b6b93));return null;}}else{logger['error'](_0xdca7('0x32'));return null;}}catch(_0x577980){logger[_0xdca7('0x9')](_0x577980['stack']);return null;}});}logger[_0xdca7('0x1f')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xc3e0[_0xdca7('0x22')],_0xc3e0[_0xdca7('0x36')],_0xc3e0[_0xdca7('0x23')],_0xc3e0[_0xdca7('0x24')],_0xc3e0['uniqueid']));logger['info'](util[_0xdca7('0x20')](_0xdca7('0x38'),_0xc3e0['context'],_0xc3e0['extension'],parseInt(_0xc3e0[_0xdca7('0x2d')],0xa)+0x1));_0xc3e0[_0xdca7('0x39')](_0xc3e0[_0xdca7('0x2b')],_0xc3e0[_0xdca7('0x2c')],parseInt(_0xc3e0['priority'],0xa)+0x1);_0xc3e0[_0xdca7('0x3a')]();}function handleNotFound(_0x2966ed){logger[_0xdca7('0x9')](util[_0xdca7('0x20')]('Project\x20%s\x20not\x20found',_0x2966ed[_0xdca7('0x22')]));_0x2966ed[_0xdca7('0x39')](_0x2966ed[_0xdca7('0x2b')],_0x2966ed[_0xdca7('0x2c')],parseInt(_0x2966ed[_0xdca7('0x2d')],0xa)+0x1);_0x2966ed['close']();}function handleUnpublished(_0x3d6e32){logger[_0xdca7('0x9')](util[_0xdca7('0x20')](_0xdca7('0x3b'),_0x3d6e32[_0xdca7('0x22')]));_0x3d6e32[_0xdca7('0x39')](_0x3d6e32[_0xdca7('0x2b')],_0x3d6e32[_0xdca7('0x2c')],parseInt(_0x3d6e32[_0xdca7('0x2d')],0xa)+0x1);_0x3d6e32['close']();}module['exports']={'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 f5a8688..cc08b26 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 _0xb8ba=['\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','line','exports','util','Transform','call','_localBuffer','_inBody','prototype','_transform'];(function(_0x3e46a5,_0x2acf50){var _0x342d7a=function(_0x4e029a){while(--_0x4e029a){_0x3e46a5['push'](_0x3e46a5['shift']());}};_0x342d7a(++_0x2acf50);}(_0xb8ba,0x1a9));var _0xab8b=function(_0x38b8f3,_0x34e033){_0x38b8f3=_0x38b8f3-0x0;var _0x2b43fd=_0xb8ba[_0x38b8f3];return _0x2b43fd;};'use strict';var util=require(_0xab8b('0x0'));var Transform=require('stream')[_0xab8b('0x1')];function AGIReply(_0x4ab208){Transform[_0xab8b('0x2')](this,_0x4ab208);this[_0xab8b('0x3')]='';this[_0xab8b('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xab8b('0x5')][_0xab8b('0x6')]=function(_0x4b32cb,_0x527e7e,_0x3d815d){var _0x4b7c74='\x0a',_0x1ef4b6=['\x0a\x0a',_0xab8b('0x7')],_0x51085a=-0x1,_0x4bcfa6=-0x1,_0xfba0df='',_0x2f8a50=0x0,_0x2fcc41='',_0x3cdbe2='';this[_0xab8b('0x3')]+=_0x4b32cb[_0xab8b('0x8')]();_0x2fcc41=this[_0xab8b('0x3')];if(!this[_0xab8b('0x4')]){_0x2f8a50=0x0;while(_0x1ef4b6[_0x2f8a50]){while((_0x4bcfa6=_0x2fcc41[_0xab8b('0x9')](_0x1ef4b6[_0x2f8a50]))!=-0x1){_0xfba0df=_0x1ef4b6[_0x2f8a50];_0x3cdbe2=_0x2fcc41[_0xab8b('0xa')](0x0,_0x4bcfa6);_0x2fcc41=_0x2fcc41[_0xab8b('0xa')](_0x4bcfa6+_0xfba0df[_0xab8b('0xb')]);var _0x1f1b5d=_0x3cdbe2[_0xab8b('0xc')](_0x4b7c74),_0x37e137=0x0,_0x339680={},_0x4e5eb6='',_0x2ae07e='',_0xd8287f=-0x1;while(_0x1f1b5d[_0x37e137]){_0xd8287f=_0x1f1b5d[_0x37e137]['indexOf'](':');if(_0xd8287f!=-0x1){_0x4e5eb6=_0x1f1b5d[_0x37e137][_0xab8b('0xd')](0x0,_0xd8287f)[_0xab8b('0xe')]();_0x2ae07e=_0x1f1b5d[_0x37e137]['slice'](_0xd8287f+0x1)[_0xab8b('0xe')]();if(_0x4e5eb6['length']>0x0){_0x339680[_0x4e5eb6]=_0x2ae07e;}}else{}_0x37e137++;}this[_0xab8b('0xf')]('headers',_0x339680);this['_inBody']=!![];}_0x2f8a50++;}this[_0xab8b('0x3')]=_0x2fcc41;}else{while((_0x51085a=_0x2fcc41[_0xab8b('0x9')](_0x4b7c74))!=-0x1){_0x3cdbe2=_0x2fcc41[_0xab8b('0xa')](0x0,_0x51085a);this['emit'](_0xab8b('0x10'),_0x3cdbe2);_0x2fcc41=_0x2fcc41[_0xab8b('0xa')](_0x51085a+_0x4b7c74[_0xab8b('0xb')]);}this[_0xab8b('0x3')]=_0x2fcc41;}_0x3d815d();};module[_0xab8b('0x11')]=AGIReply; \ No newline at end of file +var _0x8a72=['line','Transform','call','_localBuffer','_inBody','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','length','split','slice','trim','emit','headers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a72,0xa6));var _0x28a7=function(_0x5baa80,_0xbd60ab){_0x5baa80=_0x5baa80-0x0;var _0x817ac8=_0x8a72[_0x5baa80];return _0x817ac8;};'use strict';var util=require('util');var Transform=require('stream')[_0x28a7('0x0')];function AGIReply(_0x573016){Transform[_0x28a7('0x1')](this,_0x573016);this[_0x28a7('0x2')]='';this[_0x28a7('0x3')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x28a7('0x4')]=function(_0x294605,_0x57c71f,_0x49ff02){var _0x5681da='\x0a',_0x9b7041=['\x0a\x0a',_0x28a7('0x5')],_0x3d8924=-0x1,_0x576fd3=-0x1,_0x57fd04='',_0x3a6773=0x0,_0x141fcb='',_0x219585='';this[_0x28a7('0x2')]+=_0x294605['toString']();_0x141fcb=this[_0x28a7('0x2')];if(!this['_inBody']){_0x3a6773=0x0;while(_0x9b7041[_0x3a6773]){while((_0x576fd3=_0x141fcb[_0x28a7('0x6')](_0x9b7041[_0x3a6773]))!=-0x1){_0x57fd04=_0x9b7041[_0x3a6773];_0x219585=_0x141fcb[_0x28a7('0x7')](0x0,_0x576fd3);_0x141fcb=_0x141fcb[_0x28a7('0x7')](_0x576fd3+_0x57fd04[_0x28a7('0x8')]);var _0x343683=_0x219585[_0x28a7('0x9')](_0x5681da),_0x140235=0x0,_0x406f24={},_0x4aab57='',_0x580b70='',_0xebfc79=-0x1;while(_0x343683[_0x140235]){_0xebfc79=_0x343683[_0x140235][_0x28a7('0x6')](':');if(_0xebfc79!=-0x1){_0x4aab57=_0x343683[_0x140235][_0x28a7('0xa')](0x0,_0xebfc79)[_0x28a7('0xb')]();_0x580b70=_0x343683[_0x140235][_0x28a7('0xa')](_0xebfc79+0x1)[_0x28a7('0xb')]();if(_0x4aab57[_0x28a7('0x8')]>0x0){_0x406f24[_0x4aab57]=_0x580b70;}}else{}_0x140235++;}this[_0x28a7('0xc')](_0x28a7('0xd'),_0x406f24);this[_0x28a7('0x3')]=!![];}_0x3a6773++;}this[_0x28a7('0x2')]=_0x141fcb;}else{while((_0x3d8924=_0x141fcb[_0x28a7('0x6')](_0x5681da))!=-0x1){_0x219585=_0x141fcb['substring'](0x0,_0x3d8924);this[_0x28a7('0xc')](_0x28a7('0xe'),_0x219585);_0x141fcb=_0x141fcb[_0x28a7('0x7')](_0x3d8924+_0x5681da['length']);}this['_localBuffer']=_0x141fcb;}_0x49ff02();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index e9fb24e..98830c6 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 _0xd73a=['CreateSquareMessage','ListId','CreateCmContact','ShowPause','LoginUser','agentPause','agentUnpause','UnpauseUser','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','error','message','result','catch','GetSquareProjects','production','getSquareProject','MailServerOut','Smtp','CloudProvider','name','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording'];(function(_0x73b541,_0x467e60){var _0xc44399=function(_0x100bcb){while(--_0x100bcb){_0x73b541['push'](_0x73b541['shift']());}};_0xc44399(++_0x467e60);}(_0xd73a,0x171));var _0xad73=function(_0x9ba10f,_0x5c2a97){_0x9ba10f=_0x9ba10f-0x0;var _0x3a1545=_0xd73a[_0x9ba10f];return _0x3a1545;};'use strict';var _=require(_0xad73('0x0'));var moment=require(_0xad73('0x1'));var jayson=require(_0xad73('0x2'));var client=jayson[_0xad73('0x3')][_0xad73('0x4')]({'port':0x2329});function request(_0x59c24f,_0x5048f2){return new Promise(function(_0x1b0cd2,_0x216563){return client[_0xad73('0x5')](_0x59c24f,_0x5048f2)[_0xad73('0x6')](function(_0xadbaa3){if(_0xadbaa3[_0xad73('0x7')]){return _0x216563(_0xadbaa3[_0xad73('0x7')][_0xad73('0x8')]);}else{return _0x1b0cd2(_0xadbaa3[_0xad73('0x9')]);}})[_0xad73('0xa')](function(_0x1352b3){return _0x216563(_0x1352b3);});});}exports['getSquareProjects']=function(){return request(_0xad73('0xb'),{'options':{'raw':![],'attributes':['id','name',_0xad73('0xc')]}});};exports[_0xad73('0xd')]=function(_0x20222b){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x20222b},'attributes':[_0xad73('0xc')]}});};exports['getMailAccountById']=function(_0x3d5ee5){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3d5ee5},'include':[{'model':_0xad73('0xe'),'as':_0xad73('0xf'),'include':[{'model':_0xad73('0x10'),'as':'CloudProvider'}]}],'attributes':['id',_0xad73('0x11'),_0xad73('0x12')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x10e1ab){return request(_0xad73('0x13'),{'options':{'where':{'id':_0x10e1ab},'attributes':[_0xad73('0x11')]}});};exports[_0xad73('0x14')]=function(_0x15f72d){return request(_0xad73('0x15'),{'options':{'where':{'id':_0x15f72d},'attributes':['name']}});};exports[_0xad73('0x16')]=function(_0x35c2c5){return request(_0xad73('0x17'),{'options':{'where':{'id':_0x35c2c5},'attributes':[_0xad73('0x11')]}});};exports[_0xad73('0x18')]=function(_0x9de467){return request(_0xad73('0x19'),{'options':{'where':{'id':_0x9de467},'attributes':[_0xad73('0x1a')]}});};exports[_0xad73('0x1b')]=function(_0xad072c){return request('ShowUser',{'options':{'where':{'id':_0xad072c},'attributes':[_0xad73('0x11')]}});};exports['getContactByPhone']=function(_0x5bd242){return request(_0xad73('0x1c'),{'options':{'where':{'phone':_0x5bd242[_0xad73('0x1d')]},'attributes':['id']}});};exports[_0xad73('0x1e')]=function(_0x578068){return request(_0xad73('0x1f'),{'options':{'where':{'id':_0x578068},'attributes':[_0xad73('0x11')]}});};exports['getSoundById']=function(_0x3a8830){return request(_0xad73('0x20'),{'options':{'where':{'id':_0x3a8830},'attributes':[_0xad73('0x21')]}});};exports[_0xad73('0x22')]=function(_0x2e6cdb){return request(_0xad73('0x23'),{'options':{'raw':![],'where':{'id':_0x2e6cdb},'include':[{'model':_0xad73('0x24'),'as':'Intervals'}]}});};exports[_0xad73('0x25')]=function(_0x31f5c4){return request(_0xad73('0x26'),{'options':{'where':{'id':_0x31f5c4},'attributes':['id',_0xad73('0x11')]}});};exports[_0xad73('0x27')]=function(_0x2a1295){return request(_0xad73('0x28'),{'body':_0x2a1295});};exports[_0xad73('0x29')]=function(_0xcdb93d){return request(_0xad73('0x2a'),{'body':_0xcdb93d});};exports[_0xad73('0x2b')]=function(_0x2843a7){return request(_0xad73('0x2c'),{'body':_[_0xad73('0x2d')](_0x2843a7,{'project_name':_0x2843a7[_0xad73('0x2e')],'prev_project_name':_0x2843a7[_0xad73('0x2f')]||'','is_subproject':_0x2843a7[_0xad73('0x2f')]?!![]:![],'leaveAt':moment()[_0xad73('0x30')](_0xad73('0x31'))})});};exports[_0xad73('0x32')]=function(_0x5bd387){return request('CreateSquareRecording',{'body':_0x5bd387});};exports['createSquareMessage']=function(_0x366d96){return request(_0xad73('0x33'),{'body':_0x366d96});};exports['createCmContact']=function(_0x3f1f80){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x3f1f80['phone'],'ListId':_0x3f1f80[_0xad73('0x34')]}}})[_0xad73('0x6')](function(_0x34fe4d){if(_0x34fe4d){return _0x34fe4d;}return request(_0xad73('0x35'),{'body':_0x3f1f80});});};exports['getPauseById']=function(_0xdf45e8){return request(_0xad73('0x36'),{'options':{'where':{'id':_0xdf45e8},'attributes':[_0xad73('0x11')]}});};exports['agentLogin']=function(_0xca0215,_0x1b488a){return request(_0xad73('0x37'),{'body':{'interface':_0x1b488a},'options':{'where':_0xca0215}});};exports[_0xad73('0x38')]=function(_0x6cc7dc,_0x53cd43,_0x592639){return request('PauseUser',{'body':{'type':_0x53cd43,'uniqueid':_0x592639},'options':{'where':_0x6cc7dc}});};exports[_0xad73('0x39')]=function(_0x54d8fe){return request(_0xad73('0x3a'),{'body':{},'options':{'where':_0x54d8fe}});};exports['agentLogout']=function(_0x1535a6){return request(_0xad73('0x3b'),{'body':{},'options':{'where':_0x1535a6}});}; \ No newline at end of file +var _0x1af3=['arg_2','format','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','error','message','catch','getSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1'];(function(_0x1f816d,_0x2d44dc){var _0x92b0cd=function(_0x43d0ef){while(--_0x43d0ef){_0x1f816d['push'](_0x1f816d['shift']());}};_0x92b0cd(++_0x2d44dc);}(_0x1af3,0x1ca));var _0x31af=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x1af3[_0x32d457];return _0x338386;};'use strict';var _=require(_0x31af('0x0'));var moment=require(_0x31af('0x1'));var jayson=require(_0x31af('0x2'));var client=jayson[_0x31af('0x3')][_0x31af('0x4')]({'port':0x2329});function request(_0xf27e22,_0x3d693c){return new Promise(function(_0x1a6ea6,_0x3d64ae){return client[_0x31af('0x5')](_0xf27e22,_0x3d693c)['then'](function(_0x19acd1){if(_0x19acd1[_0x31af('0x6')]){return _0x3d64ae(_0x19acd1[_0x31af('0x6')][_0x31af('0x7')]);}else{return _0x1a6ea6(_0x19acd1['result']);}})[_0x31af('0x8')](function(_0x1833de){return _0x3d64ae(_0x1833de);});});}exports[_0x31af('0x9')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x31af('0xa'),_0x31af('0xb')]}});};exports[_0x31af('0xc')]=function(_0x1d2cd0){return request(_0x31af('0xd'),{'options':{'raw':![],'where':{'name':_0x1d2cd0},'attributes':[_0x31af('0xb')]}});};exports[_0x31af('0xe')]=function(_0x33b4a5){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x33b4a5},'include':[{'model':_0x31af('0xf'),'as':_0x31af('0x10'),'include':[{'model':_0x31af('0x11'),'as':_0x31af('0x11')}]}],'attributes':['id',_0x31af('0xa'),'email'],'smtp':!![]}});};exports[_0x31af('0x12')]=function(_0x4fc1ca){return request('ShowSquareProject',{'options':{'where':{'id':_0x4fc1ca},'attributes':['name']}});};exports[_0x31af('0x13')]=function(_0x46a494){return request(_0x31af('0x14'),{'options':{'where':{'id':_0x46a494},'attributes':[_0x31af('0xa')]}});};exports[_0x31af('0x15')]=function(_0x1d35fa){return request(_0x31af('0x16'),{'options':{'where':{'id':_0x1d35fa},'attributes':[_0x31af('0xa')]}});};exports[_0x31af('0x17')]=function(_0x5a651f){return request(_0x31af('0x18'),{'options':{'where':{'id':_0x5a651f},'attributes':['dsn']}});};exports[_0x31af('0x19')]=function(_0xd33b3f){return request(_0x31af('0x1a'),{'options':{'where':{'id':_0xd33b3f},'attributes':[_0x31af('0xa')]}});};exports[_0x31af('0x1b')]=function(_0x30a112){return request(_0x31af('0x1c'),{'options':{'where':{'phone':_0x30a112[_0x31af('0x1d')]},'attributes':['id']}});};exports[_0x31af('0x1e')]=function(_0x550870){return request(_0x31af('0x1f'),{'options':{'where':{'id':_0x550870},'attributes':[_0x31af('0xa')]}});};exports[_0x31af('0x20')]=function(_0x2ce4c2){return request(_0x31af('0x21'),{'options':{'where':{'id':_0x2ce4c2},'attributes':['save_name']}});};exports[_0x31af('0x22')]=function(_0x46b03e){return request(_0x31af('0x23'),{'options':{'raw':![],'where':{'id':_0x46b03e},'include':[{'model':_0x31af('0x24'),'as':_0x31af('0x25')}]}});};exports[_0x31af('0x26')]=function(_0x1ddfba){return request(_0x31af('0x27'),{'options':{'where':{'id':_0x1ddfba},'attributes':['id',_0x31af('0xa')]}});};exports[_0x31af('0x28')]=function(_0x40aa32){return request(_0x31af('0x29'),{'body':_0x40aa32});};exports[_0x31af('0x2a')]=function(_0x34a5a7){return request(_0x31af('0x2b'),{'body':_0x34a5a7});};exports['createSquareReport']=function(_0x5b74ca){return request('CreateSquareReport',{'body':_[_0x31af('0x2c')](_0x5b74ca,{'project_name':_0x5b74ca[_0x31af('0x2d')],'prev_project_name':_0x5b74ca['arg_2']||'','is_subproject':_0x5b74ca[_0x31af('0x2e')]?!![]:![],'leaveAt':moment()[_0x31af('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x31af('0x30')]=function(_0x21e227){return request('CreateSquareRecording',{'body':_0x21e227});};exports[_0x31af('0x31')]=function(_0x28bb13){return request(_0x31af('0x32'),{'body':_0x28bb13});};exports[_0x31af('0x33')]=function(_0x3326a7){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x3326a7[_0x31af('0x1d')],'ListId':_0x3326a7[_0x31af('0x34')]}}})[_0x31af('0x35')](function(_0x1f4eae){if(_0x1f4eae){return _0x1f4eae;}return request(_0x31af('0x36'),{'body':_0x3326a7});});};exports[_0x31af('0x37')]=function(_0x149d01){return request(_0x31af('0x38'),{'options':{'where':{'id':_0x149d01},'attributes':[_0x31af('0xa')]}});};exports[_0x31af('0x39')]=function(_0x388e9c,_0x27ad23){return request('LoginUser',{'body':{'interface':_0x27ad23},'options':{'where':_0x388e9c}});};exports[_0x31af('0x3a')]=function(_0xf58cfe,_0x4d5166,_0x4cabed){return request('PauseUser',{'body':{'type':_0x4d5166,'uniqueid':_0x4cabed},'options':{'where':_0xf58cfe}});};exports[_0x31af('0x3b')]=function(_0x49783f){return request(_0x31af('0x3c'),{'body':{},'options':{'where':_0x49783f}});};exports[_0x31af('0x3d')]=function(_0x2899a0){return request(_0x31af('0x3e'),{'body':{},'options':{'where':_0x2899a0}});}; \ 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 6dfe301..7bf27cb 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 _0x3f8a=['exports','./polly','./lex'];(function(_0x17d8c2,_0x39356b){var _0x43dac8=function(_0x28e843){while(--_0x28e843){_0x17d8c2['push'](_0x17d8c2['shift']());}};_0x43dac8(++_0x39356b);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2b6a07,_0x2cdae9){_0x2b6a07=_0x2b6a07-0x0;var _0x3de699=_0x3f8a[_0x2b6a07];return _0x3de699;};var polly=require(_0xa3f8('0x0'));var lex=require(_0xa3f8('0x1'));module[_0xa3f8('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x0763=['exports','./polly'];(function(_0x45e706,_0x42f0d6){var _0x1ac835=function(_0x41c770){while(--_0x41c770){_0x45e706['push'](_0x45e706['shift']());}};_0x1ac835(++_0x42f0d6);}(_0x0763,0x87));var _0x3076=function(_0x1653b1,_0x35b7d1){_0x1653b1=_0x1653b1-0x0;var _0x3e0b17=_0x0763[_0x1653b1];return _0x3e0b17;};var polly=require(_0x3076('0x0'));var lex=require('./lex');module[_0x3076('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 d99d63d..b925ad5 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c00=['./lib/api','exports'];(function(_0xf5ab76,_0xec906){var _0x520090=function(_0x26fef0){while(--_0x26fef0){_0xf5ab76['push'](_0xf5ab76['shift']());}};_0x520090(++_0xec906);}(_0x9c00,0x1a0));var _0x09c0=function(_0x430ea6,_0x58db3b){_0x430ea6=_0x430ea6-0x0;var _0x8c837=_0x9c00[_0x430ea6];return _0x8c837;};'use strict';var lex=require(_0x09c0('0x0'));module[_0x09c0('0x1')]=function(_0x4dff21,_0x5e32e7,_0xe0d293,_0x8c9907,_0x5d1967,_0x220c0c){return lex(_0x4dff21,_0x5e32e7,_0xe0d293,_0x8c9907,_0x5d1967,_0x220c0c);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x26fe42,_0xe4a5bf,_0x17d4ec,_0x22c4b8,_0x4c37e8,_0x8c392f){return lex(_0x26fe42,_0xe4a5bf,_0x17d4ec,_0x22c4b8,_0x4c37e8,_0x8c392f);}; \ 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 7d08060..22bcd53 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(_0x53ba1c,_0x35c815){var _0x435a02=function(_0x529dc7){while(--_0x529dc7){_0x53ba1c['push'](_0x53ba1c['shift']());}};_0x435a02(++_0x35c815);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x1efb4a,_0x5bd7e7){var _0x109341=function(_0x3c4e7d){while(--_0x3c4e7d){_0x1efb4a['push'](_0x1efb4a['shift']());}};_0x109341(++_0x5bd7e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 4418b4f..08072d1 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42cb=['exports','./lib/api'];(function(_0x10a65d,_0x5f2230){var _0x30552a=function(_0x3beb36){while(--_0x3beb36){_0x10a65d['push'](_0x10a65d['shift']());}};_0x30552a(++_0x5f2230);}(_0x42cb,0x1cb));var _0xb42c=function(_0xc39e00,_0x4c00a0){_0xc39e00=_0xc39e00-0x0;var _0x31b169=_0x42cb[_0xc39e00];return _0x31b169;};'use strict';var polly=require(_0xb42c('0x0'));module[_0xb42c('0x1')]=function(_0x3dbf86,_0x5a7f12,_0x57f2b1,_0x4d70cb,_0x5a27ca,_0x529c8a,_0x149d57){return polly(_0x3dbf86,_0x5a7f12,_0x57f2b1,_0x4d70cb,_0x5a27ca,_0x529c8a,_0x149d57);}; \ No newline at end of file +var _0xc5d1=['./lib/api','exports'];(function(_0x3cdcfb,_0x161e5c){var _0x59f5da=function(_0x337416){while(--_0x337416){_0x3cdcfb['push'](_0x3cdcfb['shift']());}};_0x59f5da(++_0x161e5c);}(_0xc5d1,0xb4));var _0x1c5d=function(_0x22133a,_0x21dfc2){_0x22133a=_0x22133a-0x0;var _0xffab4c=_0xc5d1[_0x22133a];return _0xffab4c;};'use strict';var polly=require(_0x1c5d('0x0'));module[_0x1c5d('0x1')]=function(_0x13f882,_0xd43f8b,_0xfba089,_0x3a70d5,_0x547bef,_0xc369fa,_0x49c0f4){return polly(_0x13f882,_0xd43f8b,_0xfba089,_0x3a70d5,_0x547bef,_0xc369fa,_0x49c0f4);}; \ 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 90ede4a..c48961e 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 _0xdcf6=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x5f2d99,_0x1e6fb5){var _0x17a894=function(_0x2d6389){while(--_0x2d6389){_0x5f2d99['push'](_0x5f2d99['shift']());}};_0x17a894(++_0x1e6fb5);}(_0xdcf6,0x71));var _0x6dcf=function(_0xb260f8,_0xc008c5){_0xb260f8=_0xb260f8-0x0;var _0x63096d=_0xdcf6[_0xb260f8];return _0x63096d;};'use strict';var fs=require('fs');var path=require(_0x6dcf('0x0'));var BPromise=require(_0x6dcf('0x1'));var rs=require('randomstring');var AWS=require(_0x6dcf('0x2'));function pollyResult(_0x449ff5,_0x21e566,_0xfbeab1){return new BPromise(function(_0x16aaf3,_0x4ae3e2){_0x449ff5[_0x6dcf('0x3')](_0x21e566,function(_0x43263f,_0x423e87){if(_0x43263f){_0x4ae3e2(_0x43263f);}else if(_0x423e87){if(_0x423e87[_0x6dcf('0x4')]instanceof Buffer){fs[_0x6dcf('0x5')](_0xfbeab1,_0x423e87[_0x6dcf('0x4')],function(_0x59c148){if(_0x59c148){_0x4ae3e2(_0x59c148);}else{_0x16aaf3();}});}else{_0x4ae3e2(new Error(_0x6dcf('0x6')));}}else{_0x4ae3e2(new Error(_0x6dcf('0x7')));}});});}module[_0x6dcf('0x8')]=function(_0xa28b92,_0x4668c2,_0x55badc,_0x34fbb8,_0x57b4b6,_0x3a6e5b,_0x24718b){var _0x414960=new AWS[(_0x6dcf('0x9'))]({'accessKeyId':_0xa28b92,'secretAccessKey':_0x4668c2,'region':_0x55badc});var _0x13a30c={'Text':_0x57b4b6,'TextType':_0x3a6e5b||_0x6dcf('0xa'),'OutputFormat':_0x6dcf('0xb'),'VoiceId':_0x34fbb8};return pollyResult(_0x414960,_0x13a30c,_0x24718b);}; \ No newline at end of file +var _0xd805=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','path','bluebird','randomstring','aws-sdk','AudioStream'];(function(_0x286e63,_0x90bf8f){var _0x4535eb=function(_0x1d71b4){while(--_0x1d71b4){_0x286e63['push'](_0x286e63['shift']());}};_0x4535eb(++_0x90bf8f);}(_0xd805,0x16d));var _0x5d80=function(_0x4853fc,_0x52cd55){_0x4853fc=_0x4853fc-0x0;var _0x23be73=_0xd805[_0x4853fc];return _0x23be73;};'use strict';var fs=require('fs');var path=require(_0x5d80('0x0'));var BPromise=require(_0x5d80('0x1'));var rs=require(_0x5d80('0x2'));var AWS=require(_0x5d80('0x3'));function pollyResult(_0x142d23,_0x19217,_0x50c7db){return new BPromise(function(_0x22d76c,_0x413e6e){_0x142d23['synthesizeSpeech'](_0x19217,function(_0x1c3b5c,_0x153d4a){if(_0x1c3b5c){_0x413e6e(_0x1c3b5c);}else if(_0x153d4a){if(_0x153d4a[_0x5d80('0x4')]instanceof Buffer){fs[_0x5d80('0x5')](_0x50c7db,_0x153d4a[_0x5d80('0x4')],function(_0x4cbfff){if(_0x4cbfff){_0x413e6e(_0x4cbfff);}else{_0x22d76c();}});}else{_0x413e6e(new Error(_0x5d80('0x6')));}}else{_0x413e6e(new Error(_0x5d80('0x7')));}});});}module['exports']=function(_0x56cae8,_0x279c71,_0x4cf2ba,_0x17e2df,_0x1699b1,_0x4742cf,_0x387f36){var _0x1cb4b5=new AWS[(_0x5d80('0x8'))]({'accessKeyId':_0x56cae8,'secretAccessKey':_0x279c71,'region':_0x4cf2ba});var _0x3fbe66={'Text':_0x1699b1,'TextType':_0x4742cf||'text','OutputFormat':_0x5d80('0x9'),'VoiceId':_0x17e2df};return pollyResult(_0x1cb4b5,_0x3fbe66,_0x387f36);}; \ 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 13586ca..d9969be 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 _0x25da=['exports','./lib/api'];(function(_0x1de593,_0x32ddef){var _0x169afe=function(_0x1cc8a1){while(--_0x1cc8a1){_0x1de593['push'](_0x1de593['shift']());}};_0x169afe(++_0x32ddef);}(_0x25da,0x18b));var _0xa25d=function(_0x518d98,_0x22d7b5){_0x518d98=_0x518d98-0x0;var _0x3316a6=_0x25da[_0x518d98];return _0x3316a6;};'use strict';var asr=require(_0xa25d('0x0'));module[_0xa25d('0x1')]=function(_0x4e7615,_0x1b34c8,_0x4f8e0e,_0x117f9e){return asr(_0x4e7615,_0x1b34c8,_0x4f8e0e);}; \ No newline at end of file +var _0x7d99=['./lib/api','exports'];(function(_0x3b7874,_0x5aed14){var _0xcb1ba8=function(_0x3f1ef6){while(--_0x3f1ef6){_0x3b7874['push'](_0x3b7874['shift']());}};_0xcb1ba8(++_0x5aed14);}(_0x7d99,0x138));var _0x97d9=function(_0x162a9b,_0x335d87){_0x162a9b=_0x162a9b-0x0;var _0x3623db=_0x7d99[_0x162a9b];return _0x3623db;};'use strict';var asr=require(_0x97d9('0x0'));module[_0x97d9('0x1')]=function(_0x4e888c,_0x20705a,_0x55f6cd,_0x172f84){return asr(_0x4e888c,_0x20705a,_0x55f6cd);}; \ 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 45f07af..47858d6 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 _0x2bdb=['LINEAR16','url','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key='];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2bdb,0x105));var _0xb2bd=function(_0x43fc7e,_0xbf8e31){_0x43fc7e=_0x43fc7e-0x0;var _0x5b39a8=_0x2bdb[_0x43fc7e];return _0x5b39a8;};'use strict';var url=require(_0xb2bd('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xb2bd('0x1');module['exports']=function(_0x3b40de,_0x1d3ddb,_0xab9a35){return new BPromise(function(_0x552d38,_0x438ced){var _0x2be356;if(typeof _0x3b40de!==_0xb2bd('0x2')||_0x3b40de[_0xb2bd('0x3')]===0x0){return _0x438ced(_0xb2bd('0x4'));}if(typeof _0x1d3ddb!==_0xb2bd('0x2')||_0x1d3ddb[_0xb2bd('0x3')]===0x0){return _0x438ced('key\x20should\x20be\x20a\x20string');}if(typeof _0xab9a35!==_0xb2bd('0x5')&&(typeof _0xab9a35!=='string'||_0xab9a35[_0xb2bd('0x3')]===0x0)){return _0x438ced(_0xb2bd('0x6'));}try{_0x2be356=fs[_0xb2bd('0x7')](_0x3b40de)[_0xb2bd('0x8')](_0xb2bd('0x9'));}catch(_0x3d3b28){return _0x438ced(_0x3d3b28);}return _0x552d38({'method':_0xb2bd('0xa'),'uri':host+_0xb2bd('0xb')+_0x1d3ddb,'body':{'config':{'encoding':_0xb2bd('0xc'),'sampleRateHertz':'8000','languageCode':_0xab9a35},'audio':{'content':_0x2be356}},'json':!![]});});}; \ No newline at end of file +var _0xc36d=['bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url'];(function(_0x3fc53b,_0x4c95a3){var _0x35c204=function(_0x4a8749){while(--_0x4a8749){_0x3fc53b['push'](_0x3fc53b['shift']());}};_0x35c204(++_0x4c95a3);}(_0xc36d,0x7d));var _0xdc36=function(_0x2c3a88,_0x48637e){_0x2c3a88=_0x2c3a88-0x0;var _0x4a7925=_0xc36d[_0x2c3a88];return _0x4a7925;};'use strict';var url=require(_0xdc36('0x0'));var BPromise=require(_0xdc36('0x1'));var fs=require('fs');var host=_0xdc36('0x2');module[_0xdc36('0x3')]=function(_0x471240,_0x2d5df5,_0x4c42dd){return new BPromise(function(_0x42522b,_0x3431f9){var _0x53ac17;if(typeof _0x471240!==_0xdc36('0x4')||_0x471240[_0xdc36('0x5')]===0x0){return _0x3431f9(_0xdc36('0x6'));}if(typeof _0x2d5df5!==_0xdc36('0x4')||_0x2d5df5[_0xdc36('0x5')]===0x0){return _0x3431f9('key\x20should\x20be\x20a\x20string');}if(typeof _0x4c42dd!==_0xdc36('0x7')&&(typeof _0x4c42dd!==_0xdc36('0x4')||_0x4c42dd[_0xdc36('0x5')]===0x0)){return _0x3431f9(_0xdc36('0x8'));}try{_0x53ac17=fs['readFileSync'](_0x471240)[_0xdc36('0x9')](_0xdc36('0xa'));}catch(_0x573f8e){return _0x3431f9(_0x573f8e);}return _0x42522b({'method':_0xdc36('0xb'),'uri':host+_0xdc36('0xc')+_0x2d5df5,'body':{'config':{'encoding':_0xdc36('0xd'),'sampleRateHertz':'8000','languageCode':_0x4c42dd},'audio':{'content':_0x53ac17}},'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 b9871e5..36206de 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 _0x6e85=['exports','./asr'];(function(_0x5f1322,_0x1e32d0){var _0x34db1a=function(_0x3ed80d){while(--_0x3ed80d){_0x5f1322['push'](_0x5f1322['shift']());}};_0x34db1a(++_0x1e32d0);}(_0x6e85,0xdf));var _0x56e8=function(_0x541eb8,_0x18d01d){_0x541eb8=_0x541eb8-0x0;var _0x54e8d4=_0x6e85[_0x541eb8];return _0x54e8d4;};var asr=require(_0x56e8('0x0'));module[_0x56e8('0x1')]={'asr':asr}; \ No newline at end of file +var _0xbd9b=['./asr'];(function(_0x8a2dae,_0x2a21a7){var _0x308f20=function(_0x701c92){while(--_0x701c92){_0x8a2dae['push'](_0x8a2dae['shift']());}};_0x308f20(++_0x2a21a7);}(_0xbd9b,0x67));var _0xbbd9=function(_0x598bb1,_0x41c397){_0x598bb1=_0x598bb1-0x0;var _0x5c00a1=_0xbd9b[_0x598bb1];return _0x5c00a1;};var asr=require(_0xbbd9('0x0'));module['exports']={'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 9954f82..7982c8f 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 _0x849f=['googleASR\x20confidence','[%s]\x20%s:%s','name','message','textRequest','result','resolvedQuery','action','actionIncomplete','speech','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','parse','sestekNDA','text','CustomAction','channelData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','md5','path','randomstring','sox','google-tts-api','url','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','info','finish\x20download\x20file','error','unlink','pipe','end','data','transcode','wav','finish\x20to\x20convert','start','resolve','tmp','.wav','base64','chmodSync','777','readFileSync','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','POST','then','.mp3','from','audioContent','writeFile','generate','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','parse\x20response\x20failed:\x0a','length','lang\x20\x22','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence'];(function(_0x5f382f,_0x3f1432){var _0x3bb11b=function(_0x4daf9b){while(--_0x4daf9b){_0x5f382f['push'](_0x5f382f['shift']());}};_0x3bb11b(++_0x3f1432);}(_0x849f,0x1c9));var _0xf849=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x849f[_0xdea41a];return _0x15d0d8;};'use strict';var apiai=require(_0xf849('0x0'));var BPromise=require(_0xf849('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xf849('0x2'));var https=require('https');var md5=require(_0xf849('0x3'));var path=require(_0xf849('0x4'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0xf849('0x5'));var sox=require(_0xf849('0x6'));var tts=require(_0xf849('0x7'));var urlParse=require(_0xf849('0x8'))['parse'];var util=require(_0xf849('0x9'));var aws=require(_0xf849('0xa'));var google=require(_0xf849('0xb'));var sestek=require(_0xf849('0xc'));var tilde=require('./tilde');var logger=require(_0xf849('0xd'))(_0xf849('0xe'));var ISPEECH_API=_0xf849('0xf');function downloadFile(_0x347e60,_0x324e55){return new BPromise(function(_0x379743,_0xa86555){var _0x5d9a25=urlParse(_0x347e60);var _0x3d81b7=_0x5d9a25[_0xf849('0x10')]===_0xf849('0x11')?https:http;var _0x54c079={'host':_0x5d9a25[_0xf849('0x12')],'path':_0x5d9a25[_0xf849('0x4')],'headers':{'user-agent':_0xf849('0x13')}};_0x3d81b7[_0xf849('0x14')](_0x54c079,function(_0x1e7ede){if(_0x1e7ede['statusCode']!==0xc8){logger['error'](_0xf849('0x15')+_0x347e60+_0xf849('0x16')+_0x1e7ede[_0xf849('0x17')]+'\x20('+_0x1e7ede[_0xf849('0x18')]+')');_0xa86555(new Error(_0xf849('0x15')+_0x347e60+'\x20failed,\x20status\x20code\x20=\x20'+_0x1e7ede[_0xf849('0x17')]+'\x20('+_0x1e7ede['statusMessage']+')'));return;}var _0x2412c2=fs[_0xf849('0x19')](_0x324e55);_0x2412c2['on']('finish',function(){logger[_0xf849('0x1a')](_0xf849('0x1b'));_0x2412c2['close'](_0x379743);});_0x2412c2['on'](_0xf849('0x1c'),function(_0x443de6){fs[_0xf849('0x1d')](_0x324e55);logger[_0xf849('0x1c')]('download\x20error',_0x443de6);_0xa86555(_0x443de6);});_0x1e7ede[_0xf849('0x1e')](_0x2412c2);})['on'](_0xf849('0x1c'),function(_0xcc5fd8){logger['error'](_0xcc5fd8);_0xa86555(_0xcc5fd8);})[_0xf849('0x1f')]();});}function uploadFile(_0x686c07){return new BPromise(function(_0x2c5def,_0x54f4ce){var _0x4aaa12=urlParse(_0x686c07);var _0x40619b=_0x4aaa12[_0xf849('0x10')]==='https:'?https:http;var _0x1d9a04={'host':_0x4aaa12[_0xf849('0x12')],'path':_0x4aaa12['path'],'headers':{'user-agent':_0xf849('0x13')}};_0x40619b[_0xf849('0x14')](_0x1d9a04,function(_0xe9e951){if(_0xe9e951[_0xf849('0x17')]!==0xc8){_0x54f4ce(new Error(_0xf849('0x15')+_0x686c07+_0xf849('0x16')+_0xe9e951[_0xf849('0x17')]+'\x20('+_0xe9e951[_0xf849('0x18')]+')'));return;}var _0x86553b='';_0xe9e951['on'](_0xf849('0x20'),function(_0x4fbecf){_0x86553b+=_0x4fbecf;});_0xe9e951['on'](_0xf849('0x1f'),function(){_0x2c5def(_0x86553b);});})['on']('error',function(_0x29677f){_0x54f4ce(_0x29677f);})[_0xf849('0x1f')]();});}function convertFile(_0x174da3,_0x501257){return new BPromise(function(_0xfd5810,_0x4dccd3){var _0xdbcc7d=sox[_0xf849('0x21')](_0x174da3,_0x501257,{'sampleRate':0x1f40,'format':_0xf849('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xdbcc7d['on']('error',function(_0x1c0db5){logger[_0xf849('0x1c')]('error\x20convert',_0x1c0db5);_0x4dccd3(_0x1c0db5);});_0xdbcc7d['on'](_0xf849('0x1f'),function(){logger[_0xf849('0x1a')](_0xf849('0x23'));_0xfd5810();});_0xdbcc7d[_0xf849('0x24')]();});}function base64Decode(_0x510501,_0x35c65f){var _0x4a4d92=path[_0xf849('0x25')](__dirname,_0xf849('0x26'),rs['generate'](0x4)+_0xf849('0x27'));fs['writeFileSync'](_0x4a4d92,_0x510501,_0xf849('0x28'));return convertFile(_0x4a4d92,_0x35c65f)['then'](function(){try{fs[_0xf849('0x1d')](_0x4a4d92);fs[_0xf849('0x29')](_0x35c65f,_0xf849('0x2a'));}catch(_0x475d99){logger['error'](_0x475d99);}return _0x35c65f['split']('.')[0x0];});}function base64Encode(_0x35088c){var _0x307848=fs[_0xf849('0x2b')](_0x35088c);return new Buffer(_0x307848)[_0xf849('0x2c')](_0xf849('0x28'));}exports[_0xf849('0x2d')]=function(_0x2791bd,_0x46b0f8,_0x2b2512,_0x705d07,_0x5b7c70,_0x435e8c){var _0x1276b5,_0x1068cd;var _0x3534f7='https://texttospeech.googleapis.com/v1/';var _0xffd0c8=_0xf849('0x2e')+_0x2791bd;var _0x9bdf7e={};if(_0x46b0f8===_0xf849('0x2f')){_0x9bdf7e[_0xf849('0x30')]={'ssml':_0x2b2512};}else{_0x9bdf7e[_0xf849('0x30')]={'text':_0x2b2512};};_0x9bdf7e[_0xf849('0x31')]={'languageCode':_0x705d07,'ssmlGender':_0x5b7c70};_0x9bdf7e[_0xf849('0x32')]={'audioEncoding':_0xf849('0x33'),'sampleRateHertz':0x1f40};var _0x106639={'url':_0x3534f7+'text:synthesize'+_0xffd0c8,'method':_0xf849('0x34'),'json':!![],'body':_0x9bdf7e};return rp(_0x106639)[_0xf849('0x35')](function(_0x540e20){return new BPromise(function(_0x147a9f,_0x340c1c){_0x1276b5=path[_0xf849('0x25')](__dirname,_0xf849('0x26'),rs['generate'](0x4)+_0xf849('0x36'));var _0x29fe26=Buffer[_0xf849('0x37')](_0x540e20[_0xf849('0x38')],'base64');return fs[_0xf849('0x39')](_0x1276b5,_0x29fe26,function(_0x5f31eb){_0x340c1c(_0x5f31eb);},function(_0x11f28c){fs['chmodSync'](_0x1276b5,'777');_0x147a9f(_0x11f28c);});});})[_0xf849('0x35')](function(_0x432bc3){_0x1068cd=path['resolve'](__dirname,_0xf849('0x26'),rs[_0xf849('0x3a')](0x4)+'.wav');return convertFile(_0x1276b5,_0x1068cd);})[_0xf849('0x35')](function(){try{fs[_0xf849('0x1d')](_0x1276b5);fs[_0xf849('0x29')](_0x1068cd,_0xf849('0x2a'));}catch(_0x430afd){logger[_0xf849('0x1c')](_0x430afd);}logger['info'](_0xf849('0x3b'),_0x1068cd[_0xf849('0x3c')]('.')[0x0]);return _0x1068cd[_0xf849('0x3c')]('.')[0x0];});};exports[_0xf849('0x3d')]=function(_0x3d74ea,_0x42d281){var _0x1ca424=_0xf849('0x3e');var _0x37cc49,_0x4f6ff1;var _0x5a3746;var _0x6a1002={'encoding':_0xf849('0x3f'),'method':_0xf849('0x34'),'timeout':0x2710,'url':_0x1ca424,'headers':{'Content-Type':_0xf849('0x40')},'body':_0xf849('0x41')+encodeURIComponent(JSON[_0xf849('0x42')]([[[_0xf849('0x43'),JSON[_0xf849('0x42')]([_0x3d74ea,_0x42d281||'en',![],'null']),null,_0xf849('0x44')]]]))};return rp(_0x6a1002)['then'](function(_0x3cd410){try{_0x5a3746=eval(_0x3cd410['slice'](0x5))[0x0][0x2];}catch(_0x4fba82){throw new Error(_0xf849('0x45')+_0x3cd410[_0xf849('0x20')]);}if(!_0x5a3746){if(_0x3d74ea[_0xf849('0x46')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xf849('0x47')+_0x42d281+'\x22\x20might\x20not\x20exist');}}try{_0x5a3746=eval(_0x5a3746)[0x0];}catch(_0x57248d){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xf849('0x20')]);}const _0x11af00=_0x5a3746;_0x37cc49=path[_0xf849('0x25')](__dirname,_0xf849('0x26'),rs[_0xf849('0x3a')](0x4)+'.mp3');fs[_0xf849('0x48')](_0x37cc49,_0x5a3746,{'encoding':_0xf849('0x28')});_0x4f6ff1=path[_0xf849('0x25')](__dirname,_0xf849('0x26'),rs[_0xf849('0x3a')](0x4)+_0xf849('0x27'));return convertFile(_0x37cc49,_0x4f6ff1);})['then'](function(){try{fs[_0xf849('0x1d')](_0x37cc49);fs[_0xf849('0x29')](_0x4f6ff1,_0xf849('0x2a'));}catch(_0x4cc684){logger[_0xf849('0x1c')](_0x4cc684);}logger[_0xf849('0x1a')](_0xf849('0x49'),_0x4f6ff1[_0xf849('0x3c')]('.')[0x0]);return _0x4f6ff1[_0xf849('0x3c')]('.')[0x0];});};exports[_0xf849('0x4a')]=function(_0x16105f,_0xaa8253,_0xfe918c){return google[_0xf849('0x4b')](_0x16105f,_0xaa8253,_0xfe918c)[_0xf849('0x35')](function(_0x43ab4f){logger[_0xf849('0x1a')](_0x43ab4f[_0xf849('0x4c')]);return rp(_0x43ab4f);})[_0xf849('0x35')](function(_0x3608ed){var _0xd9dfd9='';var _0xe904d9=0x0;try{fs['unlink'](_0x16105f);}catch(_0x1198f4){logger[_0xf849('0x1c')](_0x1198f4);}if(_0x3608ed&&_0x3608ed[_0xf849('0x4d')]){_0xd9dfd9=_0x3608ed[_0xf849('0x4d')][_0xf849('0x4e')](function(_0x4fd51c){return _0x4fd51c&&_0x4fd51c[_0xf849('0x4f')][0x0]&&_0x4fd51c['alternatives'][0x0][_0xf849('0x50')]?_0x4fd51c[_0xf849('0x4f')][0x0][_0xf849('0x50')]:'';})[_0xf849('0x51')]('\x0a');_0xe904d9=_0x3608ed[_0xf849('0x4d')][_0xf849('0x4e')](function(_0x5f458e){return _0x5f458e&&_0x5f458e['alternatives'][0x0]&&_0x5f458e['alternatives'][0x0][_0xf849('0x52')]?_0x5f458e[_0xf849('0x4f')][0x0][_0xf849('0x52')]:0x0;})[_0xf849('0x51')]('\x0a');}logger[_0xf849('0x1a')]('googleASR\x20transcription',_0xd9dfd9);logger[_0xf849('0x1a')](_0xf849('0x53'),_0xe904d9);return{'transcript':_0xd9dfd9,'confidence':_0xe904d9};})['catch'](function(_0x500919){logger['error'](_0xf849('0x54'),_0x500919['statusCode'],_0x500919[_0xf849('0x55')],_0x500919[_0xf849('0x56')]);});};exports['googleDialogflow']=function(_0x46a140,_0x50c8bc,_0x141645,_0x470aba){var _0x27e1e9=apiai(_0x50c8bc,{'language':_0x470aba||'en'});return _0x27e1e9[_0xf849('0x57')](_0x141645,{'sessionId':md5(_0x46a140)})[_0xf849('0x35')](function(_0x1f89a7){logger[_0xf849('0x1a')](JSON[_0xf849('0x42')](_0x1f89a7));return{'source':_0x1f89a7['result']['source'],'resolvedQuery':_0x1f89a7[_0xf849('0x58')][_0xf849('0x59')],'action':_0x1f89a7[_0xf849('0x58')][_0xf849('0x5a')],'actionIncomplete':_0x1f89a7[_0xf849('0x58')][_0xf849('0x5b')],'speech':_0x1f89a7[_0xf849('0x58')]['fulfillment'][_0xf849('0x5c')],'score':_0x1f89a7[_0xf849('0x58')][_0xf849('0x5d')],'statusCode':_0x1f89a7[_0xf849('0x5e')]['code'],'endConversation':_0x1f89a7['result'][_0xf849('0x5f')][_0xf849('0x60')]||![],'isFallbackIntent':_0x1f89a7[_0xf849('0x58')][_0xf849('0x5f')][_0xf849('0x61')]};});};exports[_0xf849('0x62')]=function(_0x44d699,_0x3b0527,_0x1d65be,_0x5110fd,_0x3630b8,_0x15508a){var _0x2c0253=_0x5110fd[_0xf849('0x63')](/\\n/g,'\x0a');var _0x4e6362={'credentials':{'private_key':_0x2c0253,'client_email':_0x1d65be}};var _0x4c1c46=new dialogflow[(_0xf849('0x64'))](_0x4e6362);var _0x2e0a49=_0x4c1c46[_0xf849('0x65')](_0x3b0527,md5(_0x44d699));var _0x44f05e={'session':_0x2e0a49,'queryInput':{'text':{'text':_0x3630b8,'languageCode':_0x15508a}}};return _0x4c1c46[_0xf849('0x66')](_0x44f05e)['then'](function(_0x1e0bd4){if(_0x1e0bd4&&_0x1e0bd4[_0xf849('0x46')]){logger['info'](_0xf849('0x67'),JSON[_0xf849('0x42')](_0x1e0bd4));var _0x2fe90c=_0x1e0bd4[0x0];if(_0x2fe90c){var _0x22924d={'action':_0x2fe90c[_0xf849('0x68')][_0xf849('0x5a')],'allRequiredParamsPresent':_0x2fe90c[_0xf849('0x68')][_0xf849('0x69')],'endConversation':_0x2fe90c[_0xf849('0x68')][_0xf849('0x6a')]&&_0x2fe90c[_0xf849('0x68')][_0xf849('0x6a')]['fields']?_0x2fe90c['queryResult'][_0xf849('0x6a')][_0xf849('0x6b')]['end_conversation'][_0xf849('0x6c')]:![],'fulfillmentText':_0x2fe90c['queryResult'][_0xf849('0x6d')],'intentName':_0x2fe90c['queryResult']['intent'][_0xf849('0x55')],'intentDisplayName':_0x2fe90c[_0xf849('0x68')][_0xf849('0x6e')]['displayName'],'isFallbackIntent':_0x2fe90c[_0xf849('0x68')][_0xf849('0x6e')]['isFallback'],'languageCode':_0x2fe90c[_0xf849('0x68')][_0xf849('0x6f')],'queryText':_0x2fe90c[_0xf849('0x68')][_0xf849('0x70')],'responseId':_0x2fe90c[_0xf849('0x71')],'score':_0x2fe90c[_0xf849('0x68')][_0xf849('0x72')],'speech':_0x2fe90c[_0xf849('0x68')][_0xf849('0x6d')],'providerResponse':JSON['stringify'](_0x1e0bd4)};return _0x22924d;}}});};exports['tildeASR']=function(_0x399747,_0x37ca95,_0x1a45b2,_0x14a654){return tilde[_0xf849('0x4b')](_0x399747,_0x37ca95,_0x1a45b2,_0x14a654)['then'](function(_0x38559a){try{fs['unlink'](_0x399747);}catch(_0x21a4fb){logger['error'](_0x21a4fb);}logger[_0xf849('0x1a')](_0xf849('0x73'),_0x38559a[_0xf849('0x50')]);logger['info'](_0xf849('0x74'),_0x38559a[_0xf849('0x52')]);return _0x38559a;});};exports[_0xf849('0x75')]=function(_0x40b69f,_0x143b55,_0x4dae80,_0x5f1070,_0x20ad17,_0x203e21){var _0x52b8d8=path[_0xf849('0x25')](__dirname,_0xf849('0x26'),rs['generate'](0x4)+_0xf849('0x36'));var _0xe23e82;return aws[_0xf849('0x76')](_0x40b69f,_0x143b55,_0x4dae80,_0x5f1070,_0x20ad17,_0x203e21,_0x52b8d8)[_0xf849('0x35')](function(){_0xe23e82=path[_0xf849('0x25')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x52b8d8,_0xe23e82);})[_0xf849('0x35')](function(){try{fs['unlink'](_0x52b8d8);fs[_0xf849('0x29')](_0xe23e82,_0xf849('0x2a'));}catch(_0x44df74){logger[_0xf849('0x1c')](_0x44df74);}return _0xe23e82[_0xf849('0x3c')]('.')[0x0];});};exports[_0xf849('0x77')]=function(_0x1931b8,_0x3ff642,_0x29ed68,_0x2a9f78,_0x1c1a0c,_0x27a11a){return aws[_0xf849('0x78')](_0x1931b8,_0x3ff642,_0x29ed68,_0x2a9f78,_0x1c1a0c,_0x27a11a)[_0xf849('0x35')](function(_0x1f0fa0){logger['info'](JSON[_0xf849('0x42')](_0x1f0fa0));return _0x1f0fa0;});};exports['ispeechTTS']=function(_0x493f63,_0x17913f,_0x9b4adf,_0x37087f){var _0x123bba=util[_0xf849('0x79')](_0xf849('0x7a'),ISPEECH_API,_0x493f63,encodeURIComponent(_0x17913f),_0x9b4adf,_0x37087f);var _0x334af8=path['resolve'](__dirname,_0xf849('0x26'),rs[_0xf849('0x3a')](0x4)+_0xf849('0x36'));var _0x52f6f4;return downloadFile(_0x123bba,_0x334af8)[_0xf849('0x35')](function(){_0x52f6f4=path[_0xf849('0x25')](__dirname,_0xf849('0x26'),rs[_0xf849('0x3a')](0x4)+'.wav');return convertFile(_0x334af8,_0x52f6f4);})[_0xf849('0x35')](function(){try{fs[_0xf849('0x1d')](_0x334af8);fs['chmodSync'](_0x52f6f4,_0xf849('0x2a'));}catch(_0x58278e){logger[_0xf849('0x1c')](_0x58278e);}return _0x52f6f4['split']('.')[0x0];});};exports[_0xf849('0x7b')]=function(_0x509cee,_0x3912e5,_0x1a7546,_0x4702bd){var _0x57abfe=util[_0xf849('0x79')](_0xf849('0x7c'),ISPEECH_API,_0x3912e5,_0x1a7546,base64Encode(_0x509cee),_0x4702bd?util[_0xf849('0x79')]('model=%s',encodeURIComponent(_0x4702bd)):_0xf849('0x7d'));return uploadFile(_0x57abfe)[_0xf849('0x35')](function(_0x26d89c){return querystring[_0xf849('0x7e')](_0x26d89c);});};exports[_0xf849('0x7f')]=function(_0x21c230,_0x540d1d){return sestek['nda'](_0x21c230,_0x540d1d)[_0xf849('0x35')](function(_0x21f261){logger['info'](JSON[_0xf849('0x42')](_0x21f261));var _0x11335b={'speech':_0x21f261[_0xf849('0x80')],'action':_0x21f261['channelData']?_0x21f261['channelData'][_0xf849('0x81')]:undefined,'actiondata':_0x21f261[_0xf849('0x82')]?_0x21f261[_0xf849('0x82')]['CustomActionData']:undefined};if(_0x21f261[_0xf849('0x82')]&&_0x21f261[_0xf849('0x82')][_0xf849('0x83')]){return base64Decode(_0x21f261[_0xf849('0x82')][_0xf849('0x83')][_0xf849('0x84')],path[_0xf849('0x25')](__dirname,_0xf849('0x26'),rs[_0xf849('0x3a')](0x4)+_0xf849('0x27')))['then'](function(_0x2d48bc){_0x11335b[_0xf849('0x85')]=_0x2d48bc;return _0x11335b;});}return _0x11335b;});};exports[_0xf849('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0xec01=['querystring','request-promise','randomstring','sox','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','error','unlink','pipe','end','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','then','chmodSync','777','split','toString','base64','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','.mp3','writeFileSync','goggleTTS\x20path','asr','results','alternatives','transcript','join','map','googleASR\x20transcription','catch','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','sessionPath','Dialogflow\x20V2\x20response:','action','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','languageCode','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','path'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xec01,0x79));var _0x1ec0=function(_0x2f76ea,_0xd08471){_0x2f76ea=_0x2f76ea-0x0;var _0x515879=_0xec01[_0x2f76ea];return _0x515879;};'use strict';var apiai=require(_0x1ec0('0x0'));var BPromise=require(_0x1ec0('0x1'));var dialogflow=require(_0x1ec0('0x2'));var fs=require('fs');var http=require(_0x1ec0('0x3'));var https=require(_0x1ec0('0x4'));var md5=require('md5');var path=require(_0x1ec0('0x5'));var querystring=require(_0x1ec0('0x6'));var rp=require(_0x1ec0('0x7'));var rs=require(_0x1ec0('0x8'));var sox=require(_0x1ec0('0x9'));var tts=require('google-tts-api');var urlParse=require('url')[_0x1ec0('0xa')];var util=require(_0x1ec0('0xb'));var aws=require(_0x1ec0('0xc'));var google=require(_0x1ec0('0xd'));var sestek=require(_0x1ec0('0xe'));var tilde=require('./tilde');var logger=require(_0x1ec0('0xf'))(_0x1ec0('0x10'));var ISPEECH_API=_0x1ec0('0x11');function downloadFile(_0x4ca034,_0x1a81e0){return new BPromise(function(_0x12a541,_0x2095bc){var _0x4822fb=urlParse(_0x4ca034);var _0x20cae8=_0x4822fb[_0x1ec0('0x12')]===_0x1ec0('0x13')?https:http;var _0x53ee24={'host':_0x4822fb[_0x1ec0('0x14')],'path':_0x4822fb[_0x1ec0('0x5')],'headers':{'user-agent':_0x1ec0('0x15')}};_0x20cae8[_0x1ec0('0x16')](_0x53ee24,function(_0x1e2285){if(_0x1e2285['statusCode']!==0xc8){logger['error'](_0x1ec0('0x17')+_0x4ca034+_0x1ec0('0x18')+_0x1e2285[_0x1ec0('0x19')]+'\x20('+_0x1e2285[_0x1ec0('0x1a')]+')');_0x2095bc(new Error(_0x1ec0('0x17')+_0x4ca034+'\x20failed,\x20status\x20code\x20=\x20'+_0x1e2285['statusCode']+'\x20('+_0x1e2285[_0x1ec0('0x1a')]+')'));return;}var _0x48c88b=fs[_0x1ec0('0x1b')](_0x1a81e0);_0x48c88b['on'](_0x1ec0('0x1c'),function(){logger[_0x1ec0('0x1d')](_0x1ec0('0x1e'));_0x48c88b['close'](_0x12a541);});_0x48c88b['on'](_0x1ec0('0x1f'),function(_0x35fce4){fs[_0x1ec0('0x20')](_0x1a81e0);logger[_0x1ec0('0x1f')]('download\x20error',_0x35fce4);_0x2095bc(_0x35fce4);});_0x1e2285[_0x1ec0('0x21')](_0x48c88b);})['on'](_0x1ec0('0x1f'),function(_0x2e8e96){logger['error'](_0x2e8e96);_0x2095bc(_0x2e8e96);})[_0x1ec0('0x22')]();});}function uploadFile(_0x48b624){return new BPromise(function(_0x17823a,_0x20e6c9){var _0x140d6=urlParse(_0x48b624);var _0x53219b=_0x140d6[_0x1ec0('0x12')]===_0x1ec0('0x13')?https:http;var _0x4f01f8={'host':_0x140d6['host'],'path':_0x140d6[_0x1ec0('0x5')],'headers':{'user-agent':_0x1ec0('0x15')}};_0x53219b[_0x1ec0('0x16')](_0x4f01f8,function(_0x2ebc9b){if(_0x2ebc9b[_0x1ec0('0x19')]!==0xc8){_0x20e6c9(new Error(_0x1ec0('0x17')+_0x48b624+_0x1ec0('0x18')+_0x2ebc9b[_0x1ec0('0x19')]+'\x20('+_0x2ebc9b['statusMessage']+')'));return;}var _0xf20cb2='';_0x2ebc9b['on'](_0x1ec0('0x23'),function(_0x108fce){_0xf20cb2+=_0x108fce;});_0x2ebc9b['on'](_0x1ec0('0x22'),function(){_0x17823a(_0xf20cb2);});})['on']('error',function(_0x1f62bc){_0x20e6c9(_0x1f62bc);})['end']();});}function convertFile(_0x24d109,_0x39b989){return new BPromise(function(_0x1b16d9,_0x505459){var _0x547e1b=sox[_0x1ec0('0x24')](_0x24d109,_0x39b989,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x547e1b['on'](_0x1ec0('0x1f'),function(_0x1897f5){logger[_0x1ec0('0x1f')](_0x1ec0('0x25'),_0x1897f5);_0x505459(_0x1897f5);});_0x547e1b['on']('end',function(){logger[_0x1ec0('0x1d')](_0x1ec0('0x26'));_0x1b16d9();});_0x547e1b[_0x1ec0('0x27')]();});}function base64Decode(_0x216bae,_0x2a30c8){var _0x1af9c4=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs[_0x1ec0('0x2a')](0x4)+_0x1ec0('0x2b'));fs['writeFileSync'](_0x1af9c4,_0x216bae,'base64');return convertFile(_0x1af9c4,_0x2a30c8)[_0x1ec0('0x2c')](function(){try{fs['unlink'](_0x1af9c4);fs[_0x1ec0('0x2d')](_0x2a30c8,_0x1ec0('0x2e'));}catch(_0x2baed1){logger[_0x1ec0('0x1f')](_0x2baed1);}return _0x2a30c8[_0x1ec0('0x2f')]('.')[0x0];});}function base64Encode(_0x238c66){var _0x264be4=fs['readFileSync'](_0x238c66);return new Buffer(_0x264be4)[_0x1ec0('0x30')](_0x1ec0('0x31'));}exports['googleCloudTTS']=function(_0x59e6b1,_0x3d1554,_0x2818f4,_0x53546e,_0x2fa42e,_0x479e12){var _0x5d6a25,_0x1b756c;var _0x44f39e=_0x1ec0('0x32');var _0x3fa11f='?key='+_0x59e6b1;var _0x331c90={};if(_0x3d1554===_0x1ec0('0x33')){_0x331c90[_0x1ec0('0x34')]={'ssml':_0x2818f4};}else{_0x331c90[_0x1ec0('0x34')]={'text':_0x2818f4};};_0x331c90[_0x1ec0('0x35')]={'languageCode':_0x53546e,'ssmlGender':_0x2fa42e};_0x331c90[_0x1ec0('0x36')]={'audioEncoding':_0x1ec0('0x37'),'sampleRateHertz':0x1f40};var _0x450268={'url':_0x44f39e+_0x1ec0('0x38')+_0x3fa11f,'method':_0x1ec0('0x39'),'json':!![],'body':_0x331c90};return rp(_0x450268)[_0x1ec0('0x2c')](function(_0x2f5986){return new BPromise(function(_0x92e49e,_0x1dbfa4){_0x5d6a25=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs[_0x1ec0('0x2a')](0x4)+'.mp3');var _0x37cb4c=Buffer['from'](_0x2f5986['audioContent'],_0x1ec0('0x31'));return fs[_0x1ec0('0x3a')](_0x5d6a25,_0x37cb4c,function(_0x30b150){_0x1dbfa4(_0x30b150);},function(_0xb464a4){fs[_0x1ec0('0x2d')](_0x5d6a25,_0x1ec0('0x2e'));_0x92e49e(_0xb464a4);});});})[_0x1ec0('0x2c')](function(_0x5f59a6){_0x1b756c=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs[_0x1ec0('0x2a')](0x4)+_0x1ec0('0x2b'));return convertFile(_0x5d6a25,_0x1b756c);})[_0x1ec0('0x2c')](function(){try{fs['unlink'](_0x5d6a25);fs[_0x1ec0('0x2d')](_0x1b756c,_0x1ec0('0x2e'));}catch(_0x586d02){logger[_0x1ec0('0x1f')](_0x586d02);}logger['info'](_0x1ec0('0x3b'),_0x1b756c[_0x1ec0('0x2f')]('.')[0x0]);return _0x1b756c[_0x1ec0('0x2f')]('.')[0x0];});};exports[_0x1ec0('0x3c')]=function(_0x2c2572,_0x12054d){var _0x580c02=_0x1ec0('0x3d');var _0x1749f0,_0x27f815;var _0x288c16;var _0x5c3865={'encoding':_0x1ec0('0x3e'),'method':_0x1ec0('0x39'),'timeout':0x2710,'url':_0x580c02,'headers':{'Content-Type':_0x1ec0('0x3f')},'body':'f.req='+encodeURIComponent(JSON[_0x1ec0('0x40')]([[['jQ1olc',JSON[_0x1ec0('0x40')]([_0x2c2572,_0x12054d||'en',![],_0x1ec0('0x41')]),null,'generic']]]))};return rp(_0x5c3865)[_0x1ec0('0x2c')](function(_0x26f81c){try{_0x288c16=eval(_0x26f81c[_0x1ec0('0x42')](0x5))[0x0][0x2];}catch(_0x4e77c3){throw new Error(_0x1ec0('0x43')+_0x26f81c['data']);}if(!_0x288c16){if(_0x2c2572[_0x1ec0('0x44')]>0xc8){throw new Error(_0x1ec0('0x45'));}else{throw new Error('lang\x20\x22'+_0x12054d+_0x1ec0('0x46'));}}try{_0x288c16=eval(_0x288c16)[0x0];}catch(_0x209624){throw new Error(_0x1ec0('0x43')+res['data']);}const _0x6f4554=_0x288c16;_0x1749f0=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs[_0x1ec0('0x2a')](0x4)+_0x1ec0('0x47'));fs[_0x1ec0('0x48')](_0x1749f0,_0x288c16,{'encoding':_0x1ec0('0x31')});_0x27f815=path[_0x1ec0('0x28')](__dirname,'tmp',rs[_0x1ec0('0x2a')](0x4)+_0x1ec0('0x2b'));return convertFile(_0x1749f0,_0x27f815);})[_0x1ec0('0x2c')](function(){try{fs[_0x1ec0('0x20')](_0x1749f0);fs[_0x1ec0('0x2d')](_0x27f815,_0x1ec0('0x2e'));}catch(_0x596ac2){logger[_0x1ec0('0x1f')](_0x596ac2);}logger[_0x1ec0('0x1d')](_0x1ec0('0x49'),_0x27f815[_0x1ec0('0x2f')]('.')[0x0]);return _0x27f815[_0x1ec0('0x2f')]('.')[0x0];});};exports['googleASR']=function(_0x1fdcbd,_0x557c2e,_0x50bcf3){return google[_0x1ec0('0x4a')](_0x1fdcbd,_0x557c2e,_0x50bcf3)[_0x1ec0('0x2c')](function(_0x14bf1b){logger['info'](_0x14bf1b['uri']);return rp(_0x14bf1b);})[_0x1ec0('0x2c')](function(_0x1baaa6){var _0x31be02='';var _0x2e6ca0=0x0;try{fs[_0x1ec0('0x20')](_0x1fdcbd);}catch(_0x28a9db){logger['error'](_0x28a9db);}if(_0x1baaa6&&_0x1baaa6[_0x1ec0('0x4b')]){_0x31be02=_0x1baaa6[_0x1ec0('0x4b')]['map'](function(_0x492c21){return _0x492c21&&_0x492c21[_0x1ec0('0x4c')][0x0]&&_0x492c21[_0x1ec0('0x4c')][0x0][_0x1ec0('0x4d')]?_0x492c21[_0x1ec0('0x4c')][0x0][_0x1ec0('0x4d')]:'';})[_0x1ec0('0x4e')]('\x0a');_0x2e6ca0=_0x1baaa6[_0x1ec0('0x4b')][_0x1ec0('0x4f')](function(_0x4b4c60){return _0x4b4c60&&_0x4b4c60['alternatives'][0x0]&&_0x4b4c60['alternatives'][0x0]['confidence']?_0x4b4c60[_0x1ec0('0x4c')][0x0]['confidence']:0x0;})[_0x1ec0('0x4e')]('\x0a');}logger[_0x1ec0('0x1d')](_0x1ec0('0x50'),_0x31be02);logger[_0x1ec0('0x1d')]('googleASR\x20confidence',_0x2e6ca0);return{'transcript':_0x31be02,'confidence':_0x2e6ca0};})[_0x1ec0('0x51')](function(_0x1d4004){logger['error']('[%s]\x20%s:%s',_0x1d4004['statusCode'],_0x1d4004[_0x1ec0('0x52')],_0x1d4004[_0x1ec0('0x53')]);});};exports[_0x1ec0('0x54')]=function(_0xeb2eaf,_0xe0e040,_0x171e75,_0x4614d3){var _0x52fe9e=apiai(_0xe0e040,{'language':_0x4614d3||'en'});return _0x52fe9e[_0x1ec0('0x55')](_0x171e75,{'sessionId':md5(_0xeb2eaf)})['then'](function(_0x197b77){logger['info'](JSON[_0x1ec0('0x40')](_0x197b77));return{'source':_0x197b77['result'][_0x1ec0('0x56')],'resolvedQuery':_0x197b77[_0x1ec0('0x57')][_0x1ec0('0x58')],'action':_0x197b77['result']['action'],'actionIncomplete':_0x197b77[_0x1ec0('0x57')][_0x1ec0('0x59')],'speech':_0x197b77[_0x1ec0('0x57')][_0x1ec0('0x5a')][_0x1ec0('0x5b')],'score':_0x197b77['result'][_0x1ec0('0x5c')],'statusCode':_0x197b77[_0x1ec0('0x5d')]['code'],'endConversation':_0x197b77[_0x1ec0('0x57')][_0x1ec0('0x5e')][_0x1ec0('0x5f')]||![],'isFallbackIntent':_0x197b77[_0x1ec0('0x57')][_0x1ec0('0x5e')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x1d6cd4,_0x5b796e,_0x80234a,_0xfe4204,_0x3834b6,_0x4e59e0){var _0x355cff=_0xfe4204['replace'](/\\n/g,'\x0a');var _0x36a039={'credentials':{'private_key':_0x355cff,'client_email':_0x80234a}};var _0x83c79a=new dialogflow['SessionsClient'](_0x36a039);var _0x22edca=_0x83c79a[_0x1ec0('0x60')](_0x5b796e,md5(_0x1d6cd4));var _0x8fb216={'session':_0x22edca,'queryInput':{'text':{'text':_0x3834b6,'languageCode':_0x4e59e0}}};return _0x83c79a['detectIntent'](_0x8fb216)[_0x1ec0('0x2c')](function(_0x15b33e){if(_0x15b33e&&_0x15b33e[_0x1ec0('0x44')]){logger['info'](_0x1ec0('0x61'),JSON[_0x1ec0('0x40')](_0x15b33e));var _0x4fa6b7=_0x15b33e[0x0];if(_0x4fa6b7){var _0x234174={'action':_0x4fa6b7['queryResult'][_0x1ec0('0x62')],'allRequiredParamsPresent':_0x4fa6b7['queryResult']['allRequiredParamsPresent'],'endConversation':_0x4fa6b7[_0x1ec0('0x63')][_0x1ec0('0x64')]&&_0x4fa6b7[_0x1ec0('0x63')][_0x1ec0('0x64')]['fields']?_0x4fa6b7[_0x1ec0('0x63')][_0x1ec0('0x64')][_0x1ec0('0x65')][_0x1ec0('0x66')][_0x1ec0('0x67')]:![],'fulfillmentText':_0x4fa6b7[_0x1ec0('0x63')][_0x1ec0('0x68')],'intentName':_0x4fa6b7[_0x1ec0('0x63')]['intent'][_0x1ec0('0x52')],'intentDisplayName':_0x4fa6b7[_0x1ec0('0x63')][_0x1ec0('0x69')]['displayName'],'isFallbackIntent':_0x4fa6b7['queryResult'][_0x1ec0('0x69')]['isFallback'],'languageCode':_0x4fa6b7[_0x1ec0('0x63')][_0x1ec0('0x6a')],'queryText':_0x4fa6b7['queryResult']['queryText'],'responseId':_0x4fa6b7[_0x1ec0('0x6b')],'score':_0x4fa6b7[_0x1ec0('0x63')]['intentDetectionConfidence'],'speech':_0x4fa6b7[_0x1ec0('0x63')][_0x1ec0('0x68')],'providerResponse':JSON['stringify'](_0x15b33e)};return _0x234174;}}});};exports[_0x1ec0('0x6c')]=function(_0x2a792d,_0xaca625,_0x254ac7,_0x1924ed){return tilde[_0x1ec0('0x4a')](_0x2a792d,_0xaca625,_0x254ac7,_0x1924ed)['then'](function(_0x2f8292){try{fs[_0x1ec0('0x20')](_0x2a792d);}catch(_0x488474){logger[_0x1ec0('0x1f')](_0x488474);}logger['info'](_0x1ec0('0x6d'),_0x2f8292[_0x1ec0('0x4d')]);logger[_0x1ec0('0x1d')](_0x1ec0('0x6e'),_0x2f8292['confidence']);return _0x2f8292;});};exports[_0x1ec0('0x6f')]=function(_0x328f42,_0x4bae05,_0x173248,_0x3b9bdc,_0x4fdfdd,_0x1abdaf){var _0x15c4a6=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs[_0x1ec0('0x2a')](0x4)+_0x1ec0('0x47'));var _0x47aa07;return aws[_0x1ec0('0x70')](_0x328f42,_0x4bae05,_0x173248,_0x3b9bdc,_0x4fdfdd,_0x1abdaf,_0x15c4a6)[_0x1ec0('0x2c')](function(){_0x47aa07=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs[_0x1ec0('0x2a')](0x4)+_0x1ec0('0x2b'));return convertFile(_0x15c4a6,_0x47aa07);})[_0x1ec0('0x2c')](function(){try{fs[_0x1ec0('0x20')](_0x15c4a6);fs[_0x1ec0('0x2d')](_0x47aa07,_0x1ec0('0x2e'));}catch(_0x7124dd){logger[_0x1ec0('0x1f')](_0x7124dd);}return _0x47aa07['split']('.')[0x0];});};exports[_0x1ec0('0x71')]=function(_0x3035a4,_0x2d6d1e,_0x166b73,_0x1cad74,_0xea5a74,_0x2f2298){return aws['lex'](_0x3035a4,_0x2d6d1e,_0x166b73,_0x1cad74,_0xea5a74,_0x2f2298)[_0x1ec0('0x2c')](function(_0x3970d2){logger[_0x1ec0('0x1d')](JSON[_0x1ec0('0x40')](_0x3970d2));return _0x3970d2;});};exports[_0x1ec0('0x72')]=function(_0x3cf196,_0x2fe5b2,_0x18465b,_0x1815d0){var _0x39bd08=util[_0x1ec0('0x73')](_0x1ec0('0x74'),ISPEECH_API,_0x3cf196,encodeURIComponent(_0x2fe5b2),_0x18465b,_0x1815d0);var _0x41f90e=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs[_0x1ec0('0x2a')](0x4)+_0x1ec0('0x47'));var _0x1e881a;return downloadFile(_0x39bd08,_0x41f90e)[_0x1ec0('0x2c')](function(){_0x1e881a=path[_0x1ec0('0x28')](__dirname,_0x1ec0('0x29'),rs['generate'](0x4)+_0x1ec0('0x2b'));return convertFile(_0x41f90e,_0x1e881a);})[_0x1ec0('0x2c')](function(){try{fs[_0x1ec0('0x20')](_0x41f90e);fs[_0x1ec0('0x2d')](_0x1e881a,_0x1ec0('0x2e'));}catch(_0x51b157){logger[_0x1ec0('0x1f')](_0x51b157);}return _0x1e881a[_0x1ec0('0x2f')]('.')[0x0];});};exports['ispeechASR']=function(_0x55c2e1,_0x48e209,_0x3aa0af,_0x753a85){var _0x2b5214=util[_0x1ec0('0x73')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x48e209,_0x3aa0af,base64Encode(_0x55c2e1),_0x753a85?util[_0x1ec0('0x73')](_0x1ec0('0x75'),encodeURIComponent(_0x753a85)):_0x1ec0('0x76'));return uploadFile(_0x2b5214)[_0x1ec0('0x2c')](function(_0x1345b5){return querystring[_0x1ec0('0xa')](_0x1345b5);});};exports['sestekNDA']=function(_0x101829,_0x4712dc){return sestek[_0x1ec0('0x77')](_0x101829,_0x4712dc)['then'](function(_0x196640){logger['info'](JSON[_0x1ec0('0x40')](_0x196640));var _0xf9c197={'speech':_0x196640[_0x1ec0('0x78')],'action':_0x196640[_0x1ec0('0x79')]?_0x196640[_0x1ec0('0x79')][_0x1ec0('0x7a')]:undefined,'actiondata':_0x196640[_0x1ec0('0x79')]?_0x196640[_0x1ec0('0x79')][_0x1ec0('0x7b')]:undefined};if(_0x196640[_0x1ec0('0x79')]&&_0x196640['channelData'][_0x1ec0('0x7c')]){return base64Decode(_0x196640[_0x1ec0('0x79')][_0x1ec0('0x7c')][_0x1ec0('0x7d')],path[_0x1ec0('0x28')](__dirname,'tmp',rs[_0x1ec0('0x2a')](0x4)+'.wav'))[_0x1ec0('0x2c')](function(_0x42c2c0){_0xf9c197[_0x1ec0('0x7e')]=_0x42c2c0;return _0xf9c197;});}return _0xf9c197;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index ab28300..8f34e03 100644 --- a/server/services/agi/scripts/sestek/index.js +++ b/server/services/agi/scripts/sestek/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9933=['./nda'];(function(_0x51270b,_0x2dca10){var _0x18c0d7=function(_0x401c1a){while(--_0x401c1a){_0x51270b['push'](_0x51270b['shift']());}};_0x18c0d7(++_0x2dca10);}(_0x9933,0x8e));var _0x3993=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9933[_0x397e5f];return _0x5302b8;};var nda=require(_0x3993('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 8d9ad13..06f71f1 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 _0xb627=['text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','agi','POST','resolve','ndauth_url','/token','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid','extension'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xb627,0x144));var _0x7b62=function(_0x175491,_0x13ab64){_0x175491=_0x175491-0x0;var _0x4995f3=_0xb627[_0x175491];return _0x4995f3;};'use strict';var rp=require(_0x7b62('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0x7b62('0x1'));module['exports']=function(_0x365157,_0x47114b){var _0xa15423={'method':_0x7b62('0x2'),'uri':url[_0x7b62('0x3')](_0x47114b[_0x7b62('0x4')],_0x7b62('0x5')),'form':{'grant_type':'password','username':_0x47114b[_0x7b62('0x6')],'password':_0x47114b['password']},'json':!![]};return rp(_0xa15423)[_0x7b62('0x7')](function(_0x264cfa){var _0x4ae3ef={'method':_0x7b62('0x2'),'uri':url['resolve'](_0x47114b[_0x7b62('0x8')],_0x7b62('0x9')),'body':{'type':_0x47114b[_0x7b62('0xa')]||'message','channelId':_0x7b62('0xb'),'conversation':{'id':_0x365157[_0x7b62('0xc')]},'from':{'id':_0x365157[_0x7b62('0xd')],'name':_0x365157[_0x7b62('0xe')]},'recipient':{'id':_0x365157[_0x7b62('0xf')],'name':_0x365157[_0x7b62('0x10')]},'text':_0x47114b[_0x7b62('0x11')],'channelData':{}},'headers':{'Authorization':_0x7b62('0x12')+_0x264cfa[_0x7b62('0x13')]},'json':!![]};if(_0x47114b[_0x7b62('0x14')]){_0x4ae3ef[_0x7b62('0x15')][_0x7b62('0x16')][_0x7b62('0x17')]=_0x47114b['project'];}if(_0x47114b[_0x7b62('0x18')]=='1'){_0x4ae3ef['body'][_0x7b62('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7b62('0x19')};}if(_0x47114b['custom_action']){_0x4ae3ef['body'][_0x7b62('0x16')]['CustomAction']=_0x47114b[_0x7b62('0x1a')];if(_0x47114b[_0x7b62('0x1b')]){_0x4ae3ef[_0x7b62('0x15')]['channelData'][_0x7b62('0x1c')]=_0x47114b['custom_action_data'];}}logger[_0x7b62('0x1d')](JSON[_0x7b62('0x1e')](_0x4ae3ef));return rp(_0x4ae3ef);});}; \ No newline at end of file +var _0x6ae0=['Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','ProjectName','ndagenerate_audio','body','channelData','AudioOutputSettings','CustomAction','custom_action','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','ndauth_url','/token','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message'];(function(_0x3ae750,_0x2c37a9){var _0x484a18=function(_0x21bac4){while(--_0x21bac4){_0x3ae750['push'](_0x3ae750['shift']());}};_0x484a18(++_0x2c37a9);}(_0x6ae0,0x192));var _0x06ae=function(_0x47ae56,_0x13ec08){_0x47ae56=_0x47ae56-0x0;var _0x222aa2=_0x6ae0[_0x47ae56];return _0x222aa2;};'use strict';var rp=require(_0x06ae('0x0'));var url=require(_0x06ae('0x1'));var logger=require(_0x06ae('0x2'))(_0x06ae('0x3'));module['exports']=function(_0x52f385,_0x319535){var _0x58c780={'method':_0x06ae('0x4'),'uri':url['resolve'](_0x319535[_0x06ae('0x5')],_0x06ae('0x6')),'form':{'grant_type':'password','username':_0x319535[_0x06ae('0x7')],'password':_0x319535['password']},'json':!![]};return rp(_0x58c780)[_0x06ae('0x8')](function(_0x2bc2ad){var _0x591c0f={'method':_0x06ae('0x4'),'uri':url[_0x06ae('0x9')](_0x319535[_0x06ae('0xa')],_0x06ae('0xb')),'body':{'type':_0x319535[_0x06ae('0xc')]||_0x06ae('0xd'),'channelId':_0x06ae('0xe'),'conversation':{'id':_0x52f385['uniqueid']},'from':{'id':_0x52f385[_0x06ae('0xf')],'name':_0x52f385[_0x06ae('0x10')]},'recipient':{'id':_0x52f385[_0x06ae('0x11')],'name':_0x52f385[_0x06ae('0x12')]},'text':_0x319535[_0x06ae('0x13')],'channelData':{}},'headers':{'Authorization':_0x06ae('0x14')+_0x2bc2ad[_0x06ae('0x15')]},'json':!![]};if(_0x319535['project']){_0x591c0f['body']['channelData'][_0x06ae('0x16')]=_0x319535['project'];}if(_0x319535[_0x06ae('0x17')]=='1'){_0x591c0f[_0x06ae('0x18')][_0x06ae('0x19')][_0x06ae('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x319535['custom_action']){_0x591c0f[_0x06ae('0x18')]['channelData'][_0x06ae('0x1b')]=_0x319535[_0x06ae('0x1c')];if(_0x319535[_0x06ae('0x1d')]){_0x591c0f['body']['channelData']['CustomActionData']=_0x319535[_0x06ae('0x1d')];}}logger[_0x06ae('0x1e')](JSON[_0x06ae('0x1f')](_0x591c0f));return rp(_0x591c0f);});}; \ 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 b4f15a3..0f21cc8 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 _0xe0b7=['exports','./lib/api'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xe0b7,0x1f1));var _0x7e0b=function(_0xbcb344,_0x21f1ee){_0xbcb344=_0xbcb344-0x0;var _0x394356=_0xe0b7[_0xbcb344];return _0x394356;};'use strict';var asr=require(_0x7e0b('0x0'));module[_0x7e0b('0x1')]=function(_0x55ccbb,_0x58e2d3,_0x2a9e13,_0x1e4280){return asr(_0x55ccbb,_0x58e2d3,_0x2a9e13,_0x1e4280);}; \ No newline at end of file +var _0xd892=['exports','./lib/api'];(function(_0x37d145,_0x591195){var _0x273447=function(_0x1874a2){while(--_0x1874a2){_0x37d145['push'](_0x37d145['shift']());}};_0x273447(++_0x591195);}(_0xd892,0x1c9));var _0x2d89=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xd892[_0x491a7f];return _0x3d8f44;};'use strict';var asr=require(_0x2d89('0x0'));module[_0x2d89('0x1')]=function(_0x149792,_0x470a3e,_0x217a5e,_0x560815){return asr(_0x149792,_0x470a3e,_0x217a5e,_0x560815);}; \ 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 45672ee..30b5360 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 _0xde2a=['open','message','close','bluebird','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','error','Tilde\x20ASR\x20send\x20error','parse','final','result','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject'];(function(_0x4b2b03,_0xbf34ee){var _0x1bf0ed=function(_0x562785){while(--_0x562785){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x1bf0ed(++_0xbf34ee);}(_0xde2a,0xc1));var _0xade2=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0xde2a[_0x22b8a3];return _0x199a0c;};'use strict';var BPromise=require(_0xade2('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xade2('0x1'));var logger=require(_0xade2('0x2'))(_0xade2('0x3'));module[_0xade2('0x4')]=function(_0x1525cc,_0x338f44,_0x2df56b,_0x104aaa){return new BPromise(function(_0x45c98f,_0x221a98){logger['info'](_0xade2('0x5'),_0x104aaa||_0xade2('0x6'));var _0x117af1=new WebSocket(_0x104aaa||_0xade2('0x6'),{'perMessageDeflate':![]});var _0x452c27='';var _0x284843='0';var _0x1cd06b='1';var _0x41b739='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x4df4f6(_0x2eddb9){var _0x1d3fa2=crypto[_0xade2('0x7')](_0xade2('0x8'));_0x1d3fa2['update'](_0x2eddb9);return _0x1d3fa2[_0xade2('0x9')](_0xade2('0xa'));}function _0x10356e(){try{logger[_0xade2('0xb')](_0xade2('0xc'));var _0x58956c=moment()[_0xade2('0xd')]();var _0x10e4cd=_0x4df4f6(_0x58956c+_0x338f44+_0x2df56b);_0x117af1[_0xade2('0xe')](JSON[_0xade2('0xf')]({'appID':_0x338f44,'timestamp':_0x58956c,'appKey':_0x10e4cd}));var _0x58504a=fs['createReadStream'](_0x1525cc);_0x58504a['on'](_0xade2('0x10'),function(_0x201663){_0x117af1[_0xade2('0xe')](_0x201663);});_0x58504a['on']('close',function(){_0x117af1['send']('EOS');});}catch(_0x3b5922){logger[_0xade2('0x11')](_0xade2('0x12'),JSON['stringify'](_0x3b5922));_0x117af1['terminate']();}}function _0x6097e1(_0x1513f2){try{if(_0x1513f2){var _0x515453=JSON[_0xade2('0x13')](_0x1513f2);switch(_0x515453['status']){case 0x0:if(_0x515453['result']){if(_0x515453['result'][_0xade2('0x14')]){logger[_0xade2('0xb')]('Tilde\x20ASR\x20hypoteses',JSON[_0xade2('0xf')](_0x515453[_0xade2('0x15')][_0xade2('0x16')]));_0x452c27=_0x515453['result'][_0xade2('0x16')][0x0]['transcript'];_0x284843=_0x515453[_0xade2('0x15')][_0xade2('0x16')][0x0][_0xade2('0x17')];_0x1cd06b='0';_0x41b739=_0xade2('0x18');_0x117af1['terminate']();}}break;case 0x1:logger[_0xade2('0xb')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x1cd06b='1';_0x41b739=_0xade2('0x19');break;case 0x2:logger[_0xade2('0xb')](_0xade2('0x1a'));_0x1cd06b='2';_0x41b739='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xade2('0xb')](_0xade2('0x1b'));_0x1cd06b='9';_0x41b739=_0xade2('0x1b');break;case 0xa:logger[_0xade2('0xb')]('Authentication\x20failed.');_0x1cd06b='10';_0x41b739=_0xade2('0x1c');break;case 0xb:logger[_0xade2('0xb')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x1cd06b='11';_0x41b739=_0xade2('0x1d');}}}catch(_0x2f1d5e){logger['error'](_0xade2('0x1e'),JSON[_0xade2('0xf')](_0x2f1d5e));_0x117af1['terminate']();}}function _0x323136(){logger[_0xade2('0xb')](_0xade2('0x1f'));_0x45c98f({'transcript':_0x452c27,'confidence':_0x284843,'status':_0x1cd06b,'status_message':_0x41b739});}function _0x59eaa0(_0x10d8f6){logger['error'](_0xade2('0x20'));if(!_[_0xade2('0x21')](_0x10d8f6)){logger[_0xade2('0x11')](_[_0xade2('0x22')](_0x10d8f6)?JSON[_0xade2('0xf')](_0x10d8f6):_0x10d8f6);}}_0x117af1['on'](_0xade2('0x23'),_0x10356e);_0x117af1['on'](_0xade2('0x24'),_0x6097e1);_0x117af1['on'](_0xade2('0x25'),_0x323136);_0x117af1['on']('error',_0x59eaa0);});}; \ No newline at end of file +var _0x96c4=['update','digest','stringify','data','send','close','EOS','error','terminate','parse','status','result','final','hypotheses','transcript','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech'];(function(_0x2dc2ae,_0x180c1d){var _0x5c3c77=function(_0x551c67){while(--_0x551c67){_0x2dc2ae['push'](_0x2dc2ae['shift']());}};_0x5c3c77(++_0x180c1d);}(_0x96c4,0x10e));var _0x496c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x96c4[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x496c('0x0'));var _=require(_0x496c('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x496c('0x2'));var crypto=require(_0x496c('0x3'));var logger=require(_0x496c('0x4'))(_0x496c('0x5'));module[_0x496c('0x6')]=function(_0x9f90ec,_0x1163b0,_0x3d3594,_0x14d614){return new BPromise(function(_0x1d43f2,_0x8e673f){logger[_0x496c('0x7')]('Tilde\x20URI',_0x14d614||_0x496c('0x8'));var _0x1b664c=new WebSocket(_0x14d614||_0x496c('0x8'),{'perMessageDeflate':![]});var _0x41e085='';var _0x421737='0';var _0x47729e='1';var _0x3f8769=_0x496c('0x9');function _0x244b5d(_0x4544ad){var _0x33d9f4=crypto['createHash']('sha1');_0x33d9f4[_0x496c('0xa')](_0x4544ad);return _0x33d9f4[_0x496c('0xb')]('hex');}function _0x8f86b3(){try{logger[_0x496c('0x7')]('Open\x20Tilde\x20ASR\x20socket');var _0x272f27=moment()['unix']();var _0x38c251=_0x244b5d(_0x272f27+_0x1163b0+_0x3d3594);_0x1b664c['send'](JSON[_0x496c('0xc')]({'appID':_0x1163b0,'timestamp':_0x272f27,'appKey':_0x38c251}));var _0x403423=fs['createReadStream'](_0x9f90ec);_0x403423['on'](_0x496c('0xd'),function(_0x1e7853){_0x1b664c[_0x496c('0xe')](_0x1e7853);});_0x403423['on'](_0x496c('0xf'),function(){_0x1b664c[_0x496c('0xe')](_0x496c('0x10'));});}catch(_0xd7a7f6){logger[_0x496c('0x11')]('Tilde\x20ASR\x20send\x20error',JSON[_0x496c('0xc')](_0xd7a7f6));_0x1b664c[_0x496c('0x12')]();}}function _0x559d60(_0x4aa395){try{if(_0x4aa395){var _0x46e623=JSON[_0x496c('0x13')](_0x4aa395);switch(_0x46e623[_0x496c('0x14')]){case 0x0:if(_0x46e623[_0x496c('0x15')]){if(_0x46e623['result'][_0x496c('0x16')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x496c('0xc')](_0x46e623['result'][_0x496c('0x17')]));_0x41e085=_0x46e623[_0x496c('0x15')][_0x496c('0x17')][0x0][_0x496c('0x18')];_0x421737=_0x46e623['result'][_0x496c('0x17')][0x0]['likelihood'];_0x47729e='0';_0x3f8769='Success.';_0x1b664c[_0x496c('0x12')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x47729e='1';_0x3f8769=_0x496c('0x9');break;case 0x2:logger[_0x496c('0x7')](_0x496c('0x19'));_0x47729e='2';_0x3f8769=_0x496c('0x19');break;case 0x9:logger['info'](_0x496c('0x1a'));_0x47729e='9';_0x3f8769='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x496c('0x7')](_0x496c('0x1b'));_0x47729e='10';_0x3f8769=_0x496c('0x1b');break;case 0xb:logger[_0x496c('0x7')](_0x496c('0x1c'));_0x47729e='11';_0x3f8769='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2fa197){logger[_0x496c('0x11')](_0x496c('0x1d'),JSON[_0x496c('0xc')](_0x2fa197));_0x1b664c[_0x496c('0x12')]();}}function _0x3c66d6(){logger[_0x496c('0x7')](_0x496c('0x1e'));_0x1d43f2({'transcript':_0x41e085,'confidence':_0x421737,'status':_0x47729e,'status_message':_0x3f8769});}function _0x3cd5b1(_0x139310){logger[_0x496c('0x11')](_0x496c('0x1f'));if(!_[_0x496c('0x20')](_0x139310)){logger[_0x496c('0x11')](_[_0x496c('0x21')](_0x139310)?JSON[_0x496c('0xc')](_0x139310):_0x139310);}}_0x1b664c['on']('open',_0x8f86b3);_0x1b664c['on'](_0x496c('0x22'),_0x559d60);_0x1b664c['on']('close',_0x3c66d6);_0x1b664c['on'](_0x496c('0x11'),_0x3cd5b1);});}; \ 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 134fb4d..cda1597 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 _0xc04d=['./asr','exports'];(function(_0x430953,_0x4b6180){var _0x2945b=function(_0x176676){while(--_0x176676){_0x430953['push'](_0x430953['shift']());}};_0x2945b(++_0x4b6180);}(_0xc04d,0x1b4));var _0xdc04=function(_0x2332e1,_0x433415){_0x2332e1=_0x2332e1-0x0;var _0x2c3bda=_0xc04d[_0x2332e1];return _0x2c3bda;};var asr=require(_0xdc04('0x0'));module[_0xdc04('0x1')]={'asr':asr}; \ No newline at end of file +var _0x5d55=['./asr','exports'];(function(_0x5c88c8,_0x2c04cf){var _0x7b15d5=function(_0x3435dd){while(--_0x3435dd){_0x5c88c8['push'](_0x5c88c8['shift']());}};_0x7b15d5(++_0x2c04cf);}(_0x5d55,0x144));var _0x55d5=function(_0x29e06f,_0x3e37a3){_0x29e06f=_0x29e06f-0x0;var _0xbe5807=_0x5d55[_0x29e06f];return _0xbe5807;};var asr=require(_0x55d5('0x0'));module[_0x55d5('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 3ce5c13..8477bc9 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 _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x1ebd10,_0x4914b4){var _0x1004d3=function(_0x59e3ba){while(--_0x59e3ba){_0x1ebd10['push'](_0x1ebd10['shift']());}};_0x1004d3(++_0x4914b4);}(_0xe706,0xa3));var _0x6e70=function(_0xbebf50,_0x44ec09){_0xbebf50=_0xbebf50-0x0;var _0xce1496=_0xe706[_0xbebf50];return _0xce1496;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 618122a..8e2de5a 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 _0x24ca=['no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','no\x20find\x20by\x20configured','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','%s_STATUS_CODE','statusCode','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','bcc','subject','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','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','.wav','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','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','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','odbc','moment','mustache','request-promise','agi','../../config/environment','./scripts','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','catch','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','interval','map','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','parse','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','computedVariables','sync','uri','render','headers','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','replaceObjectAllVariables','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','toString','getAndSetVariable','getVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','scheduledAt','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','DIAL','dialogflow','no\x20key\x20configured','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','beep','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block'];(function(_0x3d8802,_0x1cd6ec){var _0x269369=function(_0x3690bb){while(--_0x3690bb){_0x3d8802['push'](_0x3d8802['shift']());}};_0x269369(++_0x1cd6ec);}(_0x24ca,0x8c));var _0xa24c=function(_0x9b3efc,_0x577a0d){_0x9b3efc=_0x9b3efc-0x0;var _0x200f05=_0x24ca[_0x9b3efc];return _0x200f05;};'use strict';var fs=require('fs');var util=require(_0xa24c('0x0'));var _=require('lodash');var sh=require('shelljs');var odbc=require(_0xa24c('0x1'))();var rs=require('randomstring');var moment=require(_0xa24c('0x2'));var Mustache=require(_0xa24c('0x3'));var rp=require(_0xa24c('0x4'));var logger=require('../../config/logger')(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var scripts=require(_0xa24c('0x7'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0xa24c('0x8'),_0xa24c('0x9'),_0xa24c('0xa')];var AGIVertices=function(_0x3c3959,_0x34288c,_0x87c265){this['channel']=_0x3c3959;this[_0xa24c('0xb')]=_0x34288c;this[_0xa24c('0xc')]=_0x87c265;};AGIVertices[_0xa24c('0xd')]['getVariable']=function(_0x5a474b,_0x1331f4){this[_0xa24c('0xb')][_0xa24c('0xe')](_0x5a474b)[_0xa24c('0xf')](function(_0xbaf0be){_0x1331f4(null,_0xbaf0be?_0xbaf0be[_0xa24c('0x10')]:![]);})['catch'](function(_0x5bb631){_0x1331f4(_0x5bb631);});};AGIVertices['prototype'][_0xa24c('0x11')]=function(_0x23bd58,_0x337c8a){this[_0xa24c('0xb')][_0xa24c('0x12')](_0x23bd58)['then'](function(_0x13076d){_0x337c8a(null,_0x13076d?_0x13076d['name']:![]);})['catch'](function(_0x588acf){_0x337c8a(_0x588acf);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x13')]=function(_0x3f762e,_0x267762){this[_0xa24c('0xb')][_0xa24c('0x14')](_0x3f762e)[_0xa24c('0xf')](function(_0x32a226){_0x267762(null,_0x32a226?_0x32a226[_0xa24c('0x10')]:![]);})[_0xa24c('0x15')](function(_0x1970fc){_0x267762(_0x1970fc);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x16')]=function(_0x3e4e81,_0x5276b6){this[_0xa24c('0xb')]['getSquareOdbcById'](_0x3e4e81)[_0xa24c('0xf')](function(_0xf9f8bd){_0x5276b6(null,_0xf9f8bd?_0xf9f8bd[_0xa24c('0x17')]:![]);})[_0xa24c('0x15')](function(_0x240f6c){_0x5276b6(_0x240f6c);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x18')]=function(_0x432c15,_0xba710){this[_0xa24c('0xb')][_0xa24c('0x19')](_0x432c15)['then'](function(_0x4eadb2){_0xba710(null,_0x4eadb2?_0x4eadb2[_0xa24c('0x10')]:![]);})[_0xa24c('0x15')](function(_0x316a68){_0xba710(_0x316a68);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x1a')]=function(_0xfb13c0,_0x16bd20){this[_0xa24c('0xb')][_0xa24c('0x1b')](_0xfb13c0)['then'](function(_0x2290e1){_0x16bd20(null,_0x2290e1?_0x2290e1['name']:![]);})[_0xa24c('0x15')](function(_0x256fbc){_0x16bd20(_0x256fbc);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x1c')]=function(_0x54b8a6,_0x58ff62){var _0x4c86c6=this;this['rpc'][_0xa24c('0x1d')](_0x54b8a6)[_0xa24c('0xf')](function(_0xab6197){_0x58ff62(null,_0xab6197?_0x4c86c6[_0xa24c('0x1e')](_0xab6197[_0xa24c('0x1f')]):![]);})['catch'](function(_0x5c8113){_0x58ff62(_0x5c8113);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x20')]=function(_0x2eab62,_0x1d500e){this[_0xa24c('0xb')][_0xa24c('0x21')](_0x2eab62)[_0xa24c('0xf')](function(_0x1e30a9){_0x1d500e(null,_0x1e30a9?_0x1e30a9:![]);})[_0xa24c('0x15')](function(_0x17a001){_0x1d500e(_0x17a001);});};AGIVertices['prototype'][_0xa24c('0x22')]=function(_0x3b94f0,_0x56b717,_0x3c9649){this[_0xa24c('0xc')][_0xa24c('0x22')](_0x3b94f0,_0x56b717)[_0xa24c('0xf')](function(){_0x3c9649(null);})[_0xa24c('0x15')](function(_0x44d282){_0x3c9649(_0x44d282);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x23')]=function(_0x33824b,_0x3eed7d){this['rpc']['getIntervalById'](_0x33824b)['then'](function(_0x44c3b0){if(_0x44c3b0){if(_0x44c3b0['IntervalId']){_0x3eed7d(null,[_0x44c3b0[_0xa24c('0x24')]]);}else{_0x3eed7d(null,_[_0xa24c('0x25')](_0x44c3b0[_0xa24c('0x26')],'interval'));}}else{_0x3eed7d(null,![]);}})[_0xa24c('0x15')](function(_0x2cd5fd){_0x3eed7d(_0x2cd5fd);});};AGIVertices[_0xa24c('0xd')]['getSoundPath']=function(_0x115c42){return util[_0xa24c('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x115c42);};AGIVertices[_0xa24c('0xd')][_0xa24c('0x28')]=function(_0xd837dc,_0x570d7c,_0x45c429){odbc[_0xa24c('0x29')](_0xd837dc,function(_0x3461ad){if(_0x3461ad){logger[_0xa24c('0x2a')](_0xa24c('0x2b'),_0x3461ad);_0x45c429(_0x3461ad);}else{logger['info'](_0xa24c('0x2c'));odbc[_0xa24c('0x2d')](_0x570d7c,function(_0x5d4837,_0x34232a){if(_0x5d4837){logger[_0xa24c('0x2e')](_0xa24c('0x2f'),_0x570d7c);_0x45c429(_0x5d4837);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x570d7c);odbc[_0xa24c('0x30')](function(_0xa5c873){if(_0xa5c873){logger[_0xa24c('0x2a')](_0xa24c('0x31'),_0xa5c873);}_0x45c429(null,_0x34232a);});}});}});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x32')]=function(_0x54ea40,_0x46c0bf){this[_0xa24c('0xb')][_0xa24c('0x33')](_0x54ea40)[_0xa24c('0xf')](function(_0x5f3cd4){_0x46c0bf(null,_0x5f3cd4?_0x5f3cd4:![]);})[_0xa24c('0x15')](function(_0x190dfc){_0x46c0bf(_0x190dfc);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x34')]=function(_0x103b50,_0x7d16aa){this[_0xa24c('0xb')]['createSmsMessage'](_0x103b50)['then'](function(_0x22c57e){_0x7d16aa(null,_0x22c57e);})['catch'](function(_0x295616){_0x7d16aa(_0x295616);});};AGIVertices['prototype'][_0xa24c('0x35')]=function(_0x214627,_0x37372d,_0x23b509){this[_0xa24c('0xb')][_0xa24c('0x35')]({'uniqueid':this[_0xa24c('0x36')][_0xa24c('0x37')],'node':_0x214627[_0xa24c('0x38')],'application':_0x214627[_0xa24c('0x39')],'data':_0x37372d||null,'project_name':this[_0xa24c('0x36')][_0xa24c('0x3a')],'callerid':this[_0xa24c('0x36')][_0xa24c('0x3b')]})[_0xa24c('0xf')](function(_0x2d0da8){if(_0x23b509){_0x23b509(null,_0x2d0da8);}})['catch'](function(_0x1ad4ee){if(_0x23b509){_0x23b509(_0x1ad4ee);}});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x3c')]=function(_0x5803ce,_0x3fca65,_0x271c46,_0x1f4f57){this[_0xa24c('0xb')]['createSquareRecording']({'uniqueid':this[_0xa24c('0x36')][_0xa24c('0x37')],'callerid':this[_0xa24c('0x36')][_0xa24c('0x3b')],'calleridname':this[_0xa24c('0x36')][_0xa24c('0x3d')],'context':this[_0xa24c('0x36')][_0xa24c('0x3e')],'extension':this[_0xa24c('0x36')][_0xa24c('0x3f')],'priority':this[_0xa24c('0x36')][_0xa24c('0x40')],'accountcode':this[_0xa24c('0x36')]['accountcode'],'dnid':this[_0xa24c('0x36')]['dnid'],'projectName':this[_0xa24c('0x36')][_0xa24c('0x3a')],'saveName':_0x3fca65,'filename':_0x5803ce[_0xa24c('0x41')]||_0x3fca65,'savePath':_0x271c46})[_0xa24c('0xf')](function(_0xd4761e){_0x1f4f57(null,_0xd4761e);})[_0xa24c('0x15')](function(_0x338877){_0x1f4f57(_0x338877);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x42')]=function(_0x4668c8,_0x235b2d,_0x390688,_0x14c813,_0x5974b3){this[_0xa24c('0xb')][_0xa24c('0x42')]({'uniqueid':this[_0xa24c('0x36')][_0xa24c('0x37')],'body':_0x4668c8,'direction':_0x235b2d,'providerName':_0x390688,'providerResponse':_0x14c813})['then'](function(_0x2a0c29){if(_0x5974b3){_0x5974b3(null,_0x2a0c29);}})[_0xa24c('0x15')](function(_0x2a8182){if(_0x5974b3){_0x5974b3(_0x2a8182);}});};AGIVertices['prototype']['createCmContact']=function(_0x3f8e77,_0x1c8980){this['rpc'][_0xa24c('0x43')]({'firstName':_[_0xa24c('0x44')](_0x3f8e77['name'])||_[_0xa24c('0x45')](_0x3f8e77['name'])?'callback_'+Math[_0xa24c('0x46')]():_0x3f8e77['name'],'lastName':_[_0xa24c('0x44')](_0x3f8e77[_0xa24c('0x47')])||_['isNil'](_0x3f8e77[_0xa24c('0x47')])?null:_0x3f8e77[_0xa24c('0x47')],'phone':_0x3f8e77[_0xa24c('0x48')],'ListId':_0x3f8e77[_0xa24c('0x49')],'scheduledat':_0x3f8e77['scheduledAt'],'callbackUniqueid':this[_0xa24c('0x36')]['uniqueid'],'tags':_0xa24c('0x4a'),'description':_0xa24c('0x4b')+_0x3f8e77['scheduledAt']['toString'](),'priority':_0x3f8e77[_0xa24c('0x4c')]})[_0xa24c('0xf')](function(_0xfc21f5){_0x1c8980(null,_0xfc21f5);})[_0xa24c('0x15')](function(_0x3aa9d7){_0x1c8980(_0x3aa9d7);});};AGIVertices['prototype'][_0xa24c('0x4d')]=function(_0x52cf4f,_0xf9d311){this['rpc']['getPauseById'](_0x52cf4f)['then'](function(_0x3fc3d9){_0xf9d311(null,_0x3fc3d9?_0x3fc3d9['name']:![]);})['catch'](function(_0x22b9fa){_0xf9d311(_0x22b9fa);});};AGIVertices['prototype'][_0xa24c('0x4e')]=function(_0x143bdb,_0x2d6420,_0x14c819){var _0x33c5f7={'role':_0xa24c('0x4f')};_0x33c5f7[_0x143bdb]=this[_0xa24c('0x36')][_0xa24c('0x3b')];this['rpc']['agentPause'](_0x33c5f7,_0x2d6420,this[_0xa24c('0x36')][_0xa24c('0x37')])['then'](function(_0x7ebe16){_0x14c819(null,_[_0xa24c('0x45')](_0x7ebe16)?![]:!![]);})['catch'](function(_0xf1cfb4){logger[_0xa24c('0x2a')](_0xf1cfb4);_0x14c819(null,![]);});};AGIVertices[_0xa24c('0xd')]['agentUnpause']=function(_0x4693a8,_0x20a39a){var _0x4e428e={'role':_0xa24c('0x4f')};_0x4e428e[_0x4693a8]=this['channel'][_0xa24c('0x3b')];this[_0xa24c('0xb')][_0xa24c('0x50')](_0x4e428e)[_0xa24c('0xf')](function(_0xe19b91){_0x20a39a(null,_[_0xa24c('0x45')](_0xe19b91)?![]:!![]);})[_0xa24c('0x15')](function(_0x1bda8c){logger[_0xa24c('0x2a')](_0x1bda8c);_0x20a39a(null,![]);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x51')]=function(_0x3a66b2,_0x3d13f5){var _0xe383bf={'role':_0xa24c('0x4f')};_0xe383bf[_0x3a66b2]=this[_0xa24c('0x36')][_0xa24c('0x3b')];this[_0xa24c('0xb')]['agentLogout'](_0xe383bf)[_0xa24c('0xf')](function(_0x535acb){_0x3d13f5(null,_[_0xa24c('0x45')](_0x535acb)?![]:!![]);})[_0xa24c('0x15')](function(_0xe54de4){logger[_0xa24c('0x2a')](_0xe54de4);_0x3d13f5(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x256987,_0x1e6005){var _0x3d82de={'role':'agent'};_0x3d82de[_0x256987]=this[_0xa24c('0x36')][_0xa24c('0x3b')];var _0x406880=_0x256987!=_0xa24c('0x52')?util[_0xa24c('0x27')](_0xa24c('0x53'),_0xa24c('0x54'),this[_0xa24c('0x36')][_0xa24c('0x3b')]):undefined;this[_0xa24c('0xb')][_0xa24c('0x55')](_0x3d82de,_0x406880)[_0xa24c('0xf')](function(_0x3b68d7){_0x1e6005(null,_[_0xa24c('0x45')](_0x3b68d7)?![]:!![]);})[_0xa24c('0x15')](function(_0xa3cb6a){logger[_0xa24c('0x2a')](_0xa3cb6a);_0x1e6005(null,![]);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x56')]=function(_0x325145,_0x333cb7){sh[_0xa24c('0x57')](_[_0xa24c('0x58')](_0x325145),function(_0x4524e1,_0x43f34b){var _0xc2edf0=_0x43f34b[_0xa24c('0x59')](/(\r\n|\n|\r)/gm,'');_0x333cb7(null,_0xc2edf0);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x5a')]=function(_0x3aa08f,_0x492fbd){scripts[_0xa24c('0x5a')](_0x3aa08f['apiKey'],_0x3aa08f[_0xa24c('0x5b')]||_0xa24c('0x5c'),_0x3aa08f[_0xa24c('0x5c')],_0x3aa08f[_0xa24c('0x5d')]||'en-US',_0x3aa08f[_0xa24c('0x5e')]||_0xa24c('0x5f'),_0x3aa08f[_0xa24c('0x60')]||'MP3')[_0xa24c('0xf')](function(_0x53f6c0){_0x492fbd(null,_0x53f6c0);})[_0xa24c('0x15')](function(_0x1204b3){_0x492fbd(_0x1204b3);});};AGIVertices[_0xa24c('0xd')]['googleTTS']=function(_0x2d1f56,_0x846186){scripts['googleTTS'](_0x2d1f56[_0xa24c('0x5c')],_0x2d1f56[_0xa24c('0x61')]||'en',0x1)[_0xa24c('0xf')](function(_0x2a189a){_0x846186(null,_0x2a189a);})[_0xa24c('0x15')](function(_0x15800c){_0x846186(_0x15800c);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x62')]=function(_0xfa7269,_0x327360){var _0x247eea={'uri':_0xfa7269[_0xa24c('0x63')],'method':_0xfa7269[_0xa24c('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xfa7269[_0xa24c('0x65')])===_0xa24c('0x66')&&parseInt(_0xfa7269[_0xa24c('0x65')])>=0x1?parseInt(_0xfa7269['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xa24c('0x67')]([_0xa24c('0x68'),_0xa24c('0x69')],_0x247eea[_0xa24c('0x64')][_0xa24c('0x6a')]())){try{_0x247eea['body']=_0xfa7269['rawBody']?JSON[_0xa24c('0x6b')](_0xfa7269[_0xa24c('0x6c')]):{};}catch(_0x5b217a){logger[_0xa24c('0x2a')](_0xa24c('0x6d'),_0x5b217a);}}try{_0x247eea['headers']=_0xfa7269[_0xa24c('0x6e')]?JSON[_0xa24c('0x6b')](_0xfa7269[_0xa24c('0x6e')]):{};}catch(_0x5af947){logger[_0xa24c('0x2a')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5af947);}if(_0xfa7269['computedVariables']){try{var _0x5d507a=require(_0xfa7269[_0xa24c('0x6f')])[_0xa24c('0x70')](this,_0x247eea);_0x247eea[_0xa24c('0x71')]=Mustache[_0xa24c('0x72')](_0xfa7269['url'],_0x5d507a,{},['$$','$$']);if(_0x247eea[_0xa24c('0x73')]){_0x247eea[_0xa24c('0x73')]=JSON[_0xa24c('0x6b')](Mustache[_0xa24c('0x72')](JSON[_0xa24c('0x74')](_0x247eea['headers']),_0x5d507a,{},['$$','$$']));}if(_0x247eea[_0xa24c('0x75')]){_0x247eea[_0xa24c('0x75')]=JSON['parse'](Mustache['render'](JSON[_0xa24c('0x74')](_0x247eea[_0xa24c('0x75')]),_0x5d507a,{},['$$','$$']));}}catch(_0x2dcdc8){logger[_0xa24c('0x2a')](_0xa24c('0x76'),_0x2dcdc8);}}rp(_0x247eea)[_0xa24c('0xf')](function(_0x8436d9){var _0x1df820={'statusCode':_0x8436d9['statusCode']||0xc8,'statusMessage':_0x8436d9['statusMessage']||'OK','headers':_0x8436d9[_0xa24c('0x73')]||{},'body':_0x8436d9[_0xa24c('0x75')]||{}};_0x327360(null,_0x1df820);})[_0xa24c('0x15')](function(_0x27a7e7){var _0x370b41={'statusCode':_0x27a7e7['statusCode']||0x1f4,'statusMessage':_0x27a7e7[_0xa24c('0x77')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x27a7e7['options'][_0xa24c('0x73')]||{},'body':_0x27a7e7[_0xa24c('0x78')]['body']||{}};_0x327360(null,_0x370b41);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x79')]=function(_0x283f63,_0x4c7ca1){scripts[_0xa24c('0x79')](this['channel'][_0xa24c('0x37')],_0x283f63[_0xa24c('0x7a')],_0x283f63[_0xa24c('0x5c')],_0x283f63[_0xa24c('0x7b')]||'en')[_0xa24c('0xf')](function(_0x2ae078){_0x4c7ca1(null,_0x2ae078);})[_0xa24c('0x15')](function(_0x29ea15){_0x4c7ca1(_0x29ea15);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x7c')]=function(_0x475526,_0x3a7b72){scripts[_0xa24c('0x7c')](this['channel']['uniqueid'],_0x475526[_0xa24c('0x7d')],_0x475526[_0xa24c('0x7e')],_0x475526[_0xa24c('0x7f')],_0x475526[_0xa24c('0x5c')],_0x475526[_0xa24c('0x80')]||'en')[_0xa24c('0xf')](function(_0x3fa348){_0x3a7b72(null,_0x3fa348);})[_0xa24c('0x15')](function(_0x409f10){_0x3a7b72(_0x409f10);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x81')]=function(_0x4c9498,_0x1927c2){scripts[_0xa24c('0x81')](this[_0xa24c('0x36')],_0x4c9498)[_0xa24c('0xf')](function(_0x406a70){_0x1927c2(null,_0x406a70);})[_0xa24c('0x15')](function(_0x4bec32){_0x1927c2(_0x4bec32);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x82')]=function(_0x21d006,_0x48dd93){scripts[_0xa24c('0x82')](_0x21d006['key'],_0x21d006[_0xa24c('0x5c')],_0x21d006[_0xa24c('0x83')]||_0xa24c('0x84'),_0x21d006['speed'])[_0xa24c('0xf')](function(_0x336856){_0x48dd93(null,_0x336856);})[_0xa24c('0x15')](function(_0xb7afb3){_0x48dd93(_0xb7afb3);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x85')]=function(_0x3c364d,_0x2813cc,_0x2c50e7){scripts[_0xa24c('0x85')](_0x2813cc,_0x3c364d[_0xa24c('0x7a')],_0x3c364d[_0xa24c('0x86')]||'en-US',this[_0xa24c('0x87')](_0x3c364d[_0xa24c('0x88')])?_0x3c364d[_0xa24c('0x88')]:undefined)[_0xa24c('0xf')](function(_0x295ed8){_0x2c50e7(null,_0x295ed8);})['catch'](function(_0x254fd1){_0x2c50e7(_0x254fd1);});};AGIVertices['prototype'][_0xa24c('0x89')]=function(_0x1468db,_0x3d5949){scripts['awsPolly'](_0x1468db[_0xa24c('0x8a')],_0x1468db['aws_secret_access_key'],_0x1468db[_0xa24c('0x8b')],_0x1468db[_0xa24c('0x8c')]||_0xa24c('0x8d'),_0x1468db['text'],_0x1468db[_0xa24c('0x8e')]||_0xa24c('0x5c'))['then'](function(_0x3c7756){_0x3d5949(null,_0x3c7756);})[_0xa24c('0x15')](function(_0xff839){_0x3d5949(_0xff839);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x8f')]=function(_0x27ca92,_0x243485){scripts[_0xa24c('0x8f')](this[_0xa24c('0x36')][_0xa24c('0x37')],_0x27ca92[_0xa24c('0x8a')],_0x27ca92[_0xa24c('0x90')],_0x27ca92['aws_lex_region'],_0x27ca92[_0xa24c('0x5c')],_0x27ca92[_0xa24c('0x91')])[_0xa24c('0xf')](function(_0x5076cf){_0x243485(null,_0x5076cf);})[_0xa24c('0x15')](function(_0x6512e9){_0x243485(_0x6512e9);});};AGIVertices[_0xa24c('0xd')]['googleASR']=function(_0xa38bc1,_0x402a6a,_0xc8496f){scripts[_0xa24c('0x92')](_0x402a6a,_0xa38bc1[_0xa24c('0x7a')],_0xa38bc1[_0xa24c('0x93')]||'en-US')[_0xa24c('0xf')](function(_0x3f1be5){_0xc8496f(null,_0x3f1be5);})[_0xa24c('0x15')](function(_0x698427){_0xc8496f(_0x698427);});};AGIVertices[_0xa24c('0xd')]['tildeASR']=function(_0x3c8859,_0x45ff16,_0x35332f){scripts[_0xa24c('0x94')](_0x45ff16,_0x3c8859[_0xa24c('0x95')],_0x3c8859['appsecret'],_0x3c8859['uri'])[_0xa24c('0xf')](function(_0x3197c7){_0x35332f(null,_0x3197c7);})['catch'](function(_0x1910bf){_0x35332f(_0x1910bf);});};AGIVertices[_0xa24c('0xd')][_0xa24c('0x96')]=function(_0x39bfc5){var _0x49a4d1=_[_0xa24c('0x67')](verticesWithRetry,_0x39bfc5[_0xa24c('0x39')])?_0x39bfc5:_[_0xa24c('0x97')](_0x39bfc5);for(var _0x28b08c in _0x49a4d1){if(_0x49a4d1['hasOwnProperty'](_0x28b08c)){if(_0x49a4d1[_0x28b08c]&&_['isString'](_0x49a4d1[_0x28b08c])){if(_[_0xa24c('0x67')](recursiveMapAttributes,_0x28b08c)){_0x49a4d1[_0x28b08c]=this[_0xa24c('0x98')](_0x49a4d1[_0x28b08c]);}else{_0x49a4d1[_0x28b08c]=this[_0xa24c('0x99')](_0x49a4d1[_0x28b08c]);}}}}return _0x49a4d1;};AGIVertices[_0xa24c('0xd')]['recursiveNodeIndex']=function(_0x29b6eb){for(var _0x16f089 in _0x29b6eb){if(_0x29b6eb[_0xa24c('0x9a')](_0x16f089)){if(_[_0xa24c('0x9b')](_0x29b6eb[_0x16f089])){this[_0xa24c('0x9c')](_0x29b6eb[_0x16f089]);}else if(_[_0xa24c('0x9d')](_0x29b6eb[_0x16f089])){for(var _0x423c3c=0x0;_0x423c3c<_0x29b6eb[_0x16f089][_0xa24c('0x9e')];_0x423c3c++){this[_0xa24c('0x9c')](_0x29b6eb[_0x16f089][_0x423c3c]);}}else if(_[_0xa24c('0x9f')](_0x29b6eb[_0x16f089])){_0x29b6eb[_0x16f089]=this[_0xa24c('0x99')](_0x29b6eb[_0x16f089]);}}}};AGIVertices[_0xa24c('0xd')][_0xa24c('0xa0')]=function(_0x5cf230,_0x4538e6){for(var _0x3bf62c in _0x5cf230){if(_0x5cf230[_0xa24c('0x9a')](_0x3bf62c)){if(_[_0xa24c('0x9b')](_0x5cf230[_0x3bf62c])){if(!_[_0xa24c('0x44')](_0x5cf230[_0x3bf62c])){this['saveRestApiResult'](_0x5cf230[_0x3bf62c],util[_0xa24c('0x27')](_0xa24c('0xa1'),_0x4538e6,_0x3bf62c));}}else if(_['isArray'](_0x5cf230[_0x3bf62c])){for(var _0x503e29=0x0;_0x503e29<_0x5cf230[_0x3bf62c]['length'];_0x503e29++){this[_0xa24c('0xa0')](_0x5cf230[_0x3bf62c][_0x503e29],util['format'](_0xa24c('0xa1'),_0x4538e6,_0x3bf62c+'['+_0x503e29+']'));}}else{if(!_[_0xa24c('0x45')](_0x5cf230[_0x3bf62c])){this['channel'][_0xa24c('0xa2')](util[_0xa24c('0x27')]('%s.%s',_0x4538e6,_0x3bf62c),_0x5cf230[_0x3bf62c]);}}}}};AGIVertices['prototype'][_0xa24c('0x98')]=function(_0xa5dc13){try{var _0x44533d=JSON[_0xa24c('0x6b')](_0xa5dc13);this['recursiveNodeIndex'](_0x44533d);return JSON[_0xa24c('0x74')](_0x44533d);}catch(_0x1064f2){return this['replaceAllVariables'](_0xa5dc13);}};AGIVertices[_0xa24c('0xd')][_0xa24c('0x99')]=function(_0xa581b5){var _0x27c52f=_0xa581b5[_0xa24c('0xa3')]('{');for(var _0x2bafac=0x1;_0x2bafac<_0x27c52f[_0xa24c('0x9e')];_0x2bafac+=0x1){var _0x4e4788=_0x27c52f[_0x2bafac]['split']('}');if(_0x4e4788[_0xa24c('0x9e')]>0x1){_0xa581b5=_0xa581b5[_0xa24c('0xa4')]('{'+_0x4e4788[0x0]+'}',this['channel']['getVariable'](_0x4e4788[0x0])[_0xa24c('0xa5')]||_0x4e4788[0x0]);}}if(_0x27c52f[_0xa24c('0x9e')]===0x1){return _0xa581b5[_0xa24c('0xa6')]();}return this['replaceAllVariables'](_0xa581b5);};AGIVertices[_0xa24c('0xd')][_0xa24c('0xa7')]=function(_0x3c0bfd,_0x93dd46){var _0x27f331=this[_0xa24c('0x36')][_0xa24c('0xa8')](_0x3c0bfd);if(_0x27f331[_0xa24c('0xa9')]===-0x1){return _0x27f331;}logger['info'](util['format'](_0xa24c('0xaa'),_0x93dd46,_0x27f331[_0xa24c('0xa5')]));return this['channel']['setVariable'](_0x93dd46,_0x27f331[_0xa24c('0xa5')]);};AGIVertices[_0xa24c('0xd')][_0xa24c('0x87')]=function(_0x3056ca){return _0x3056ca&&_0x3056ca!=='0'&&_0x3056ca!=='-1'&&_0x3056ca!=='';};AGIVertices[_0xa24c('0xd')][_0xa24c('0xab')]=function(_0x3ce4de){this[_0xa24c('0x35')]['sync'](this,_0x3ce4de,'-');_0x3ce4de[_0xa24c('0xac')]=_0x3ce4de[_0xa24c('0xab')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa24c('0xd')][_0xa24c('0xad')]=function(_0x22db07){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0xae'),_0x22db07[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x22db07[_0xa24c('0x5c')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0xb0'));}var _0x3fbb72='\x22'+_0x22db07[_0xa24c('0x5c')]+'\x22';if(this['isConfigured'](_0x22db07['options'])){_0x3fbb72+=','+_0x22db07[_0xa24c('0x78')];}var _0x3a52d7=this[_0xa24c('0x36')][_0xa24c('0x57')](_0xa24c('0xb1'),_0x3fbb72);if(_0x3a52d7[_0xa24c('0xa9')]===-0x1){return _0x3a52d7;}return this[_0xa24c('0x36')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x3fbb72));};AGIVertices['prototype']['mrcprecog']=function(_0xeaef09){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0xb2'),_0xeaef09[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0xeaef09[_0xa24c('0xb3')])){return this['channel'][_0xa24c('0xaf')]('no\x20grammar\x20configured');}var _0x2d25c0=_0xeaef09[_0xa24c('0xb3')];if(this[_0xa24c('0x87')](_0xeaef09[_0xa24c('0x78')])){_0x2d25c0+=','+_0xeaef09['options'];}var _0x5e20ab=this['channel'][_0xa24c('0x57')](_0xa24c('0xb4'),_0x2d25c0);if(_0x5e20ab['result']===-0x1){return _0x5e20ab;}var _0x457e9c=this['getAndSetVariable'](_0xa24c('0xb5'),_0xa24c('0xb6'));if(_0x457e9c[_0xa24c('0xa9')]===-0x1){return _0x457e9c;}var _0x31aab0=this[_0xa24c('0xa7')](_0xa24c('0xb7'),_0xa24c('0xb8'));if(_0x31aab0[_0xa24c('0xa9')]===-0x1){return _0x31aab0;}var _0x4744e3=this[_0xa24c('0xa7')](_0xa24c('0xb9'),'MRCP_RECOG_INSTANCE');if(_0x4744e3['result']===-0x1){return _0x4744e3;}return this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2d25c0));};AGIVertices[_0xa24c('0xd')][_0xa24c('0x5')]=function(_0x3acb7c){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0xba'),_0x3acb7c['label']));return this[_0xa24c('0x36')]['agi']([_0x3acb7c[_0xa24c('0xbb')],_0x3acb7c[_0xa24c('0xbc')]]);};AGIVertices[_0xa24c('0xd')][_0xa24c('0xbd')]=function(_0x3c5b2f){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x3c5b2f[_0xa24c('0x38')]));if(this[_0xa24c('0x87')](_0x3c5b2f[_0xa24c('0x65')])){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0xbe'),_0x3c5b2f['timeout']));var _0x268414=this[_0xa24c('0x36')]['wait'](_0x3c5b2f['timeout']);if(_0x268414[_0xa24c('0xa9')]===-0x1){return _0x268414;}}return this[_0xa24c('0x36')][_0xa24c('0xbd')]();};AGIVertices['prototype'][_0xa24c('0x4a')]=function(_0x4ab8e0){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0xbf'),_0x4ab8e0[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x4ab8e0['list_id'])){return this['channel']['error'](_0x4ab8e0,_0xa24c('0xc0'));}_0x4ab8e0[_0xa24c('0xc1')]=moment();if(this[_0xa24c('0x87')](_0x4ab8e0[_0xa24c('0xc2')])){_0x4ab8e0['scheduledAt']=moment()[_0xa24c('0xc3')](_0x4ab8e0['delay'],'minutes');}if(!this['isConfigured'](_0x4ab8e0[_0xa24c('0x4c')])){_0x4ab8e0['callback_priority']=0x2;}this[_0xa24c('0x43')][_0xa24c('0x70')](this,_0x4ab8e0);return this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0xc4'),_0x4ab8e0[_0xa24c('0x48')],_0x4ab8e0[_0xa24c('0x49')],_0x4ab8e0[_0xa24c('0xc1')]));};AGIVertices[_0xa24c('0xd')][_0xa24c('0xc5')]=function(_0x1cf967){logger['info'](util[_0xa24c('0x27')](_0xa24c('0xc6'),_0x1cf967[_0xa24c('0x38')]));var _0xe1dcb1=this[_0xa24c('0x36')][_0xa24c('0x57')](_0x1cf967['application'],_0x1cf967[_0xa24c('0x78')]);if(_0xe1dcb1['result']===-0x1){return _0xe1dcb1;}return this['channel'][_0xa24c('0xaf')](util['format']('Executed\x20command\x20%s\x20%s',_0x1cf967[_0xa24c('0xc7')],_0x1cf967[_0xa24c('0x78')]));};AGIVertices[_0xa24c('0xd')]['lumenvoxtts']=function(_0x48354a){logger[_0xa24c('0x2e')](util['format']('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x48354a['label']));if(!this[_0xa24c('0x87')](_0x48354a['text'])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0xb0'));}var _0x5f49fc='\x22'+_0x48354a[_0xa24c('0x5c')]+'\x22';if(this[_0xa24c('0x87')](_0x48354a[_0xa24c('0x78')])){_0x5f49fc+=','+_0x48354a[_0xa24c('0x78')];}var _0x4957a1=this[_0xa24c('0x36')][_0xa24c('0x57')](_0xa24c('0xb1'),_0x5f49fc);if(_0x4957a1[_0xa24c('0xa9')]===-0x1){return _0x4957a1;}return this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0xc8'),_0x5f49fc));};AGIVertices[_0xa24c('0xd')]['sestektts']=function(_0x4bd7b1){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0xc9'),_0x4bd7b1[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x4bd7b1['text'])){return this['channel']['noop'](_0xa24c('0xb0'));}var _0x43d5a0='\x22'+_0x4bd7b1[_0xa24c('0x5c')]+'\x22';if(this[_0xa24c('0x87')](_0x4bd7b1[_0xa24c('0x78')])){_0x43d5a0+=','+_0x4bd7b1['options'];}var _0x52a448=this[_0xa24c('0x36')][_0xa24c('0x57')]('MRCPSynth',_0x43d5a0);if(_0x52a448[_0xa24c('0xa9')]===-0x1){return _0x52a448;}return this['channel']['noop'](util[_0xa24c('0x27')](_0xa24c('0xc8'),_0x43d5a0));};AGIVertices[_0xa24c('0xd')][_0xa24c('0xca')]=function(_0x5516c8){logger['info'](util[_0xa24c('0x27')](_0xa24c('0xcb'),_0x5516c8['label']));if(!this[_0xa24c('0x87')](_0x5516c8[_0xa24c('0xb3')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')]('no\x20grammar\x20configured');}var _0x50b2e9=_0x5516c8[_0xa24c('0xb3')];if(this['isConfigured'](_0x5516c8[_0xa24c('0x78')])){_0x50b2e9+=','+_0x5516c8['options'];}var _0x310da3=this['channel']['exec'](_0xa24c('0xb4'),_0x50b2e9);if(_0x310da3['result']===-0x1){return _0x310da3;}var _0x43fc04=this[_0xa24c('0xa7')](_0xa24c('0xb5'),_0xa24c('0xcc'));if(_0x43fc04[_0xa24c('0xa9')]===-0x1){return _0x43fc04;}var _0x1e434f=this['getAndSetVariable'](_0xa24c('0xb7'),_0xa24c('0xcd'));if(_0x1e434f[_0xa24c('0xa9')]===-0x1){return _0x1e434f;}var _0x474bce=this[_0xa24c('0xa7')]('RECOG_INSTANCE()',_0xa24c('0xce'));if(_0x474bce[_0xa24c('0xa9')]===-0x1){return _0x474bce;}return this['channel'][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0xcf'),_0x50b2e9));};AGIVertices[_0xa24c('0xd')][_0xa24c('0xd0')]=function(_0x223771){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0xd1'),_0x223771['label']));if(!this[_0xa24c('0x87')](_0x223771[_0xa24c('0xb3')])){return this['channel']['noop'](_0xa24c('0xd2'));}var _0x4160bf=_0x223771[_0xa24c('0xb3')];if(this[_0xa24c('0x87')](_0x223771['options'])){_0x4160bf+=','+_0x223771['options'];}var _0x19a718=this[_0xa24c('0x36')][_0xa24c('0x57')](_0xa24c('0xb4'),_0x4160bf);if(_0x19a718['result']===-0x1){return _0x19a718;}var _0x1ef74f=this[_0xa24c('0xa7')](_0xa24c('0xb5'),_0xa24c('0xd3'));if(_0x1ef74f['result']===-0x1){return _0x1ef74f;}var _0x46ba0b=this[_0xa24c('0xa7')](_0xa24c('0xb7'),_0xa24c('0xd4'));if(_0x46ba0b[_0xa24c('0xa9')]===-0x1){return _0x46ba0b;}var _0x2abd19=this[_0xa24c('0xa7')](_0xa24c('0xb9'),_0xa24c('0xd5'));if(_0x2abd19[_0xa24c('0xa9')]===-0x1){return _0x2abd19;}return this[_0xa24c('0x36')][_0xa24c('0xaf')](util['format'](_0xa24c('0xcf'),_0x4160bf));};AGIVertices['prototype']['database']=function(_0x58e905){logger['info'](util[_0xa24c('0x27')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x58e905['label']));if(!this['isConfigured'](_0x58e905[_0xa24c('0xd6')])){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x58e905,'no\x20database\x20selected');}var _0x49cb2c=this[_0xa24c('0x16')][_0xa24c('0x70')](this,_0x58e905[_0xa24c('0xd6')]);if(!_0x49cb2c){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x58e905,_0xa24c('0xd7'));}if(!this[_0xa24c('0x87')](_0x58e905[_0xa24c('0x2d')])){return this['channel'][_0xa24c('0x2a')](_0x58e905,_0xa24c('0xd8'));}var _0x433262=_0x58e905[_0xa24c('0x2d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0xd9'),_0x433262));var _0x2d6338=this[_0xa24c('0x28')]['sync'](this,_0x49cb2c,_0x433262);this['createSquareDetailsReport'][_0xa24c('0x70')](this,_0x58e905,_0x433262);if(!this['isConfigured'](_0x58e905[_0xa24c('0xda')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0xdb'));}var _0x3d2489=this[_0xa24c('0xa8')][_0xa24c('0x70')](this,_0x58e905['variable_id']);if(!_0x3d2489){return this[_0xa24c('0x36')]['error'](_0x58e905,'no\x20variable\x20found');}var _0x2490af=this;_0x2d6338[_0xa24c('0xdc')](function(_0x3d340b,_0x309ef0){Object[_0xa24c('0xdd')](_0x3d340b)[_0xa24c('0xdc')](function(_0x1efbd0){_0x2490af[_0xa24c('0x36')][_0xa24c('0xa2')](util[_0xa24c('0x27')](_0xa24c('0xde'),_0x3d2489,_0x309ef0,_0x1efbd0),_0x3d340b[_0x1efbd0]);});});this['channel']['setVariable'](util[_0xa24c('0x27')](_0xa24c('0xdf'),_0x3d2489),_0x2d6338[_0xa24c('0x9e')]);return this['channel'][_0xa24c('0xaf')](util[_0xa24c('0x27')]('variable\x20%s\x20set',_0x3d2489));};AGIVertices[_0xa24c('0xd')][_0xa24c('0xe0')]=function(_0x46b7f1){logger[_0xa24c('0xe1')](util[_0xa24c('0x27')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x46b7f1[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x46b7f1[_0xa24c('0xe2')])){return this['channel'][_0xa24c('0x2a')](_0x46b7f1,_0xa24c('0xe3'));}var _0xa21ebc=this[_0xa24c('0x18')][_0xa24c('0x70')](this,_0x46b7f1[_0xa24c('0xe2')]);if(!_0xa21ebc){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x46b7f1,_0xa24c('0xe4'));}var _0x10e923=this['channel'][_0xa24c('0x57')]('DIAL',[util[_0xa24c('0x27')](_0xa24c('0xe5'),_0xa21ebc),_0x46b7f1[_0xa24c('0x65')],_0x46b7f1[_0xa24c('0xe6')],_0x46b7f1['url']]);if(_0x10e923[_0xa24c('0xa9')]===-0x1){return _0x10e923;}return this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')]('Executed\x20command\x20%s',_0xa24c('0xe7')));};AGIVertices[_0xa24c('0xd')][_0xa24c('0xe8')]=function(_0x196409){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x196409[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x196409[_0xa24c('0x7a')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0xe9'));}if(!this[_0xa24c('0x87')](_0x196409[_0xa24c('0x5c')])){return this['channel'][_0xa24c('0xaf')](_0xa24c('0xb0'));}this[_0xa24c('0x36')]['bot']=!![];this[_0xa24c('0x35')](_0x196409);this[_0xa24c('0x42')](_0x196409[_0xa24c('0x5c')],'in','','');this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')]('Trying\x20Dialogflow:\x20%s',_0x196409[_0xa24c('0x5c')]));var _0xf3c1d=this[_0xa24c('0x79')][_0xa24c('0x70')](this,_0x196409);if(_0xf3c1d){for(var _0x179161 in _0xf3c1d){if(_0xf3c1d['hasOwnProperty'](_0x179161)){this['channel']['setVariable'](util[_0xa24c('0x27')]('DIALOGFLOW_%s',_0x179161[_0xa24c('0x6a')]()),_0xf3c1d[_0x179161]);}}this[_0xa24c('0x42')](_0xf3c1d[_0xa24c('0xea')],_0xa24c('0xeb'),'dialogflow','');return this['channel'][_0xa24c('0xaf')](util['format']('Dialogflow\x20Result\x20%s',_0xf3c1d['speech']));}return this[_0xa24c('0x36')]['error'](_0x196409,_0xa24c('0xec'));};AGIVertices[_0xa24c('0xd')][_0xa24c('0xed')]=function(_0x36ad99){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0xee'),_0x36ad99[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x36ad99['dialogflowV2_project_id'])){return this[_0xa24c('0x36')]['noop'](_0xa24c('0xef'));}if(!this[_0xa24c('0x87')](_0x36ad99[_0xa24c('0x7e')])){return this[_0xa24c('0x36')]['noop'](_0xa24c('0xf0'));}if(!this['isConfigured'](_0x36ad99[_0xa24c('0x7f')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0xf1'));}if(!this[_0xa24c('0x87')](_0x36ad99[_0xa24c('0x80')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0xf2'));}if(!this[_0xa24c('0x87')](_0x36ad99[_0xa24c('0x5c')])){return this[_0xa24c('0x36')]['noop']('no\x20text\x20configured');}this[_0xa24c('0x36')][_0xa24c('0xf3')]=!![];this['createSquareDetailsReport'](_0x36ad99);this[_0xa24c('0x42')](_0x36ad99[_0xa24c('0x5c')],'in','','');this[_0xa24c('0x36')]['noop'](util[_0xa24c('0x27')](_0xa24c('0xf4'),_0x36ad99[_0xa24c('0x5c')]));var _0x58f8ba=this[_0xa24c('0x7c')][_0xa24c('0x70')](this,_0x36ad99);if(_0x58f8ba){for(var _0xd4612f in _0x58f8ba){if(_0x58f8ba[_0xa24c('0x9a')](_0xd4612f)){if(_0xd4612f!==_0xa24c('0xf5')){this[_0xa24c('0x36')][_0xa24c('0xa2')](util['format']('DIALOGFLOW_%s',_0xd4612f[_0xa24c('0x6a')]()),_0x58f8ba[_0xd4612f]);}}}this[_0xa24c('0x42')](_0x58f8ba['speech'],_0xa24c('0xeb'),_0xa24c('0xed'),_0x58f8ba[_0xa24c('0xf5')]);return this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')]('DialogflowV2\x20Result\x20%s',_0x58f8ba[_0xa24c('0xea')]));}return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x36ad99,_0xa24c('0xf6'));};AGIVertices['prototype'][_0xa24c('0xf7')]=function(_0x1a23e8){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0xf8'),_0x1a23e8[_0xa24c('0x38')]));if(!this['isConfigured'](_0x1a23e8[_0xa24c('0xf9')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0xfa'));}if(!this[_0xa24c('0x87')](_0x1a23e8[_0xa24c('0xfb')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0xfc'));}if(!this[_0xa24c('0x87')](_0x1a23e8[_0xa24c('0xfd')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')]('no\x20password\x20configured');}if(!this[_0xa24c('0x87')](_0x1a23e8[_0xa24c('0xfe')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0xb0'));}this[_0xa24c('0x36')][_0xa24c('0xf3')]=!![];this[_0xa24c('0x35')](_0x1a23e8);this[_0xa24c('0x42')](_0x1a23e8[_0xa24c('0x5c')],'in','','');this[_0xa24c('0x36')]['noop'](util[_0xa24c('0x27')](_0xa24c('0xff'),_0x1a23e8[_0xa24c('0x5c')]));var _0x799be2=this[_0xa24c('0x81')]['sync'](this,_0x1a23e8);if(_0x799be2){for(var _0x1d4334 in _0x799be2){if(_0x799be2[_0xa24c('0x9a')](_0x1d4334)){this['channel'][_0xa24c('0xa2')](util[_0xa24c('0x27')](_0xa24c('0x100'),_0x1d4334[_0xa24c('0x6a')]()),_0x799be2[_0x1d4334]);}}this[_0xa24c('0x42')](_0x799be2['speech'],_0xa24c('0xeb'),'sesteknda','');if(_0x799be2[_0xa24c('0x101')]){this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x102'),_0x799be2[_0xa24c('0x101')]));var _0x3a561e=this[_0xa24c('0x36')][_0xa24c('0x103')](_0x799be2['audiofile']);try{fs[_0xa24c('0x104')](_0x799be2['audiofile']+'.wav');}catch(_0x396496){logger[_0xa24c('0x2a')](_0x396496);}return _0x3a561e;}else{return this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')]('SestekNDA\x20Result\x20%s',_0x799be2[_0xa24c('0xea')]));}}return this['channel'][_0xa24c('0x2a')](_0x1a23e8,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xa24c('0xd')]['end']=function(_0x51e3ea){logger[_0xa24c('0x2e')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x51e3ea[_0xa24c('0x38')]));return this[_0xa24c('0x36')][_0xa24c('0xaf')]('end');};AGIVertices[_0xa24c('0xd')][_0xa24c('0x105')]=function(_0x15e5a3){logger['info'](util[_0xa24c('0x27')](_0xa24c('0x106'),_0x15e5a3[_0xa24c('0x38')]));var _0x783377='';if(_0x15e5a3[_0xa24c('0x107')]){if(!this['isConfigured'](_0x15e5a3['trunk_id'])){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x15e5a3,'no\x20trunk\x20selected');}else{var _0x20c0b8=parseInt(_0x15e5a3[_0xa24c('0x107')],0xa);if(isNaN(_0x20c0b8)){_0x783377=_0x15e5a3[_0xa24c('0x107')];}else{_0x783377=this[_0xa24c('0x1a')][_0xa24c('0x70')](this,_0x15e5a3[_0xa24c('0x107')]);if(!_0x783377){return this['channel'][_0xa24c('0x2a')](_0x15e5a3,_0xa24c('0x108'));}}}}else if(_0x15e5a3['trunk_name']){_0x783377=_0x15e5a3[_0xa24c('0x109')];}else{return this['channel'][_0xa24c('0x2a')](_0x15e5a3,_0xa24c('0x10a'));}var _0x18628d=this[_0xa24c('0x36')][_0xa24c('0x57')]('DIAL',[util[_0xa24c('0x27')](_0xa24c('0x10b'),_0x783377,_0x15e5a3[_0xa24c('0x48')]),_0x15e5a3[_0xa24c('0x65')],_0x15e5a3[_0xa24c('0xe6')],_0x15e5a3['url']]);if(_0x18628d[_0xa24c('0xa9')]===-0x1){return _0x18628d;}return this['channel'][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x10c'),'DIAL'));};AGIVertices[_0xa24c('0xd')][_0xa24c('0x10d')]=function(_0x295472){logger['info'](util[_0xa24c('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x295472['label']));return this['channel'][_0xa24c('0xaf')](_0xa24c('0x10d'));};AGIVertices[_0xa24c('0xd')]['getdigits']=function(_0x4f1c30){logger['info'](util[_0xa24c('0x27')](_0xa24c('0x10e'),_0x4f1c30['label']));if(_0x4f1c30['retry']===0x0){return this[_0xa24c('0xab')](_0x4f1c30);}_0x4f1c30[_0xa24c('0xac')]-=0x1;if(!this[_0xa24c('0x87')](_0x4f1c30[_0xa24c('0x10f')])){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x4f1c30,_0xa24c('0x110'));}var _0x47446b=this[_0xa24c('0x1c')][_0xa24c('0x70')](this,_0x4f1c30[_0xa24c('0x10f')]);if(!_0x47446b){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x4f1c30,_0xa24c('0x111'));}if(!this[_0xa24c('0x87')](_0x4f1c30['variable_id'])){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0xa24c('0xdb'));}var _0x456640=this[_0xa24c('0x36')][_0xa24c('0x112')](_0x47446b,_0x4f1c30[_0xa24c('0x113')],_0x4f1c30[_0xa24c('0x114')]);var _0x555a50=_0x456640['result']?_0x456640[_0xa24c('0xa9')][_0xa24c('0xa6')]():'';logger[_0xa24c('0x2e')]('test',JSON[_0xa24c('0x74')](_0x456640));if(_0x456640[_0xa24c('0xa9')]===-0x1){this[_0xa24c('0x35')]['sync'](this,_0x4f1c30,_0x555a50);return _0x456640;}else if(_0x456640['extra']===_0xa24c('0x65')){_0x456640[_0xa24c('0xa9')]=_0x555a50[_0xa24c('0x9e')]>=parseInt(_0x4f1c30[_0xa24c('0x115')])?'x':'i';}else{_0x456640[_0xa24c('0xa9')]=_0x555a50['length']>=parseInt(_0x4f1c30[_0xa24c('0x115')])&&_0x555a50[_0xa24c('0x9e')]<=parseInt(_0x4f1c30[_0xa24c('0x114')])?'x':'i';}var _0x42ffc7=this[_0xa24c('0xa8')][_0xa24c('0x70')](this,_0x4f1c30[_0xa24c('0xda')]);if(!_0x42ffc7){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x4f1c30,_0xa24c('0x116'));}this[_0xa24c('0x36')][_0xa24c('0xa2')](_0x42ffc7,_0x555a50);if(this[_0xa24c('0x87')](_0x4f1c30['hiddendigitsnum'])){var _0x5a8719=parseInt(_0x4f1c30[_0xa24c('0x117')],0xa);var _0x129632=rs[_0xa24c('0x118')]({'charset':'*','length':_0x5a8719});var _0x31c908=_0x555a50['length'];if(_0x31c908>0x0){if(_0x31c908>_0x5a8719){this[_0xa24c('0x35')][_0xa24c('0x70')](this,_0x4f1c30,_0x4f1c30[_0xa24c('0x119')]===_0xa24c('0x11a')?_0x129632+_0x555a50[_0xa24c('0x11b')](_0x5a8719):_0x555a50[_0xa24c('0x11b')](0x0,_0x31c908-_0x5a8719)+_0x129632);}else{this[_0xa24c('0x35')][_0xa24c('0x70')](this,_0x4f1c30,rs['generate']({'charset':'*','length':_0x31c908}));}}else{this[_0xa24c('0x35')][_0xa24c('0x70')](this,_0x4f1c30,'');}}else{this[_0xa24c('0x35')][_0xa24c('0x70')](this,_0x4f1c30,_0x555a50);}return _0x456640;};AGIVertices['prototype'][_0xa24c('0xa')]=function(_0xc8f4a7){logger['info'](util[_0xa24c('0x27')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0xc8f4a7[_0xa24c('0x38')]));return this[_0xa24c('0x9')](_0xc8f4a7);};AGIVertices[_0xa24c('0xd')][_0xa24c('0x11c')]=function(_0x4b8893){logger['info'](util[_0xa24c('0x27')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x4b8893[_0xa24c('0x38')]));this[_0xa24c('0x35')]['sync'](this,_0x4b8893,_0x4b8893[_0xa24c('0x11d')]);return this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')]('GOAL\x20%s',_0x4b8893['goalname']));};AGIVertices[_0xa24c('0xd')][_0xa24c('0x11e')]=function(_0x9c3210){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x11f'),_0x9c3210['label']));if(!this[_0xa24c('0x87')](_0x9c3210['aws_access_key_id'])||!this[_0xa24c('0x87')](_0x9c3210['aws_secret_access_key'])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0x120'));}if(!this['isConfigured'](_0x9c3210['text'])){return this['channel']['noop'](_0xa24c('0xb0'));}this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x121'),_0x9c3210[_0xa24c('0x5c')]));var _0x3a934e=this[_0xa24c('0x89')][_0xa24c('0x70')](this,_0x9c3210);if(_0x3a934e){this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x122'),_0x3a934e));var _0x3b59ae=this[_0xa24c('0x36')]['streamFile'](_0x3a934e);try{fs['unlink'](_0x3a934e+'.wav');}catch(_0xcff3b4){logger[_0xa24c('0x2a')](_0xcff3b4);}return _0x3b59ae;}return this[_0xa24c('0x36')]['error'](_0x9c3210,_0xa24c('0x123'));};AGIVertices['prototype']['awslex']=function(_0x4327bd){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x124'),_0x4327bd[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x4327bd[_0xa24c('0x8a')])||!this[_0xa24c('0x87')](_0x4327bd[_0xa24c('0x90')])){return this['channel'][_0xa24c('0xaf')](_0xa24c('0x120'));}if(!this[_0xa24c('0x87')](_0x4327bd[_0xa24c('0x91')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')]('no\x20bot\x20name\x20configured');}if(!this[_0xa24c('0x87')](_0x4327bd[_0xa24c('0x5c')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')]('no\x20text\x20configured');}this[_0xa24c('0x36')]['bot']=!![];this[_0xa24c('0x35')](_0x4327bd);this['createSquareMessage'](_0x4327bd['text'],'in','','');this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x125'),_0x4327bd[_0xa24c('0x5c')]));var _0x869afb=this[_0xa24c('0x8f')][_0xa24c('0x70')](this,_0x4327bd);if(_0x869afb){for(var _0x4b4eaa in _0x869afb){if(_0x869afb[_0xa24c('0x9a')](_0x4b4eaa)&&_[_0xa24c('0x9f')](_0x869afb[_0x4b4eaa])){this[_0xa24c('0x36')][_0xa24c('0xa2')](util[_0xa24c('0x27')]('AWS_LEX_%s',_0x4b4eaa['toUpperCase']()),_0x869afb[_0x4b4eaa]);}}if(_[_0xa24c('0x45')](_0x869afb[_0xa24c('0x77')])){return this['channel'][_0xa24c('0xaf')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xa24c('0x42')](_0x869afb[_0xa24c('0x77')],_0xa24c('0xeb'),'amazonlex','');return this[_0xa24c('0x36')][_0xa24c('0xaf')](util['format'](_0xa24c('0x126'),_0x869afb['message']));}}return this[_0xa24c('0x36')]['error'](_0x4327bd,_0xa24c('0x127'));};AGIVertices[_0xa24c('0xd')][_0xa24c('0x128')]=function(_0x10e2a5){logger[_0xa24c('0x2e')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x10e2a5['label'],_0x10e2a5['timeout']));if(!this[_0xa24c('0x87')](_0x10e2a5[_0xa24c('0x7a')])){return this['channel']['noop']('no\x20key\x20configured');}var _0x3f1926=_0xa24c('0x129');var _0x4138c7=util[_0xa24c('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0xa24c('0x118')](0x4));var _0x2f28ce=util[_0xa24c('0x27')](_0xa24c('0xa1'),_0x4138c7,_0x3f1926);var _0x1b8782=!![];if(_0x10e2a5[_0xa24c('0x12a')]==='NOBEEP'){_0x1b8782=![];}var _0x526291=this[_0xa24c('0x36')][_0xa24c('0x12b')](_0x4138c7,_0x3f1926,_0x10e2a5[_0xa24c('0x12c')],_0x10e2a5[_0xa24c('0x65')],undefined,_0x1b8782);if(_0x526291[_0xa24c('0xa9')]!==-0x1){this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')]('google\x20%s\x20file\x20created',_0x2f28ce));var _0x45258b=this[_0xa24c('0x92')][_0xa24c('0x70')](this,_0x10e2a5,_0x2f28ce);if(_0x45258b){for(var _0x2a7079 in _0x45258b){if(_0x45258b[_0xa24c('0x9a')](_0x2a7079)){this[_0xa24c('0x36')]['setVariable'](util['format'](_0xa24c('0x12d'),_0x2a7079[_0xa24c('0x6a')]()),_0x45258b[_0x2a7079]);}}return this[_0xa24c('0x36')]['noop'](util[_0xa24c('0x27')](_0xa24c('0x12e'),JSON[_0xa24c('0x74')](_0x45258b)));}}return _0x526291;};AGIVertices[_0xa24c('0xd')][_0xa24c('0x12f')]=function(_0x2bd972){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x130'),_0x2bd972['label']));if(!this[_0xa24c('0x87')](_0x2bd972[_0xa24c('0x95')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x2bd972[_0xa24c('0x131')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0x132'));}var _0xcc5e3c=_0xa24c('0x129');var _0x282449=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xa24c('0x118')](0x4));var _0x1a929d=util[_0xa24c('0x27')](_0xa24c('0xa1'),_0x282449,_0xcc5e3c);var _0x1f267f=!![];if(_0x2bd972[_0xa24c('0x12a')]===_0xa24c('0x133')){_0x1f267f=![];}var _0x1316b6=this['channel']['recordFile'](_0x282449,_0xcc5e3c,_0x2bd972[_0xa24c('0x12c')],_0x2bd972['timeout'],undefined,_0x1f267f);if(_0x1316b6[_0xa24c('0xa9')]!==-0x1){this[_0xa24c('0x36')][_0xa24c('0xaf')](util['format'](_0xa24c('0x134'),_0x1a929d));var _0x1259c7=this[_0xa24c('0x94')][_0xa24c('0x70')](this,_0x2bd972,_0x1a929d);if(_0x1259c7){for(var _0x579658 in _0x1259c7){if(_0x1259c7[_0xa24c('0x9a')](_0x579658)){this[_0xa24c('0x36')][_0xa24c('0xa2')](util[_0xa24c('0x27')]('TILDE_ASR_%s',_0x579658[_0xa24c('0x6a')]()),_0x1259c7[_0x579658]);}}return this['channel']['noop'](util[_0xa24c('0x27')]('TildeASR\x20Result\x20%s',JSON[_0xa24c('0x74')](_0x1259c7)));}}return _0x1316b6;};AGIVertices[_0xa24c('0xd')]['gotoc']=function(_0x37f733){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x135'),_0x37f733[_0xa24c('0x38')]));return this[_0xa24c('0x36')][_0xa24c('0x136')](_0x37f733[_0xa24c('0x3e')],_0x37f733[_0xa24c('0x3f')],_0x37f733[_0xa24c('0x40')]);};AGIVertices[_0xa24c('0xd')][_0xa24c('0x137')]=function(_0x4d72e7){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4d72e7['label']));if(!this[_0xa24c('0x87')](_0x4d72e7['condition'])){return this['channel']['error'](_0x4d72e7,'no\x20condition\x20configured');}try{var _0x343e05=eval(_0x4d72e7[_0xa24c('0x138')])?'true':_0xa24c('0x139');this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x13a'),_0x4d72e7[_0xa24c('0x138')],_0x343e05));return{'code':0xc8,'result':_0x343e05};}catch(_0x21171b){return{'code':0xc8,'result':_0xa24c('0x139')};}};AGIVertices[_0xa24c('0xd')][_0xa24c('0x13b')]=function(_0x3c30ab){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0x13c'),_0x3c30ab['label']));if(!this['isConfigured'](_0x3c30ab['interval_id'])){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x3c30ab,_0xa24c('0x13d'));}var _0x572ac5=this[_0xa24c('0x23')]['sync'](this,_0x3c30ab[_0xa24c('0x13e')]);if(!_0x572ac5){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x3c30ab,_0xa24c('0x13f'));}for(var _0x5e110a=0x0;_0x5e110a<_0x572ac5['length'];_0x5e110a+=0x1){var _0x574bf7=this[_0xa24c('0x36')][_0xa24c('0xa8')](util[_0xa24c('0x27')]('IFTIME(%s?true:false)',_0x572ac5[_0x5e110a]));if(_0x574bf7[_0xa24c('0xa9')]===-0x1){return _0x574bf7;}logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0x140'),_0x572ac5[_0x5e110a],_0x574bf7['extra']));if(_0x574bf7[_0xa24c('0xa5')]===_0xa24c('0x141')){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0x140'),_0x572ac5[_0x5e110a],_0xa24c('0x141')));this['channel'][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x140'),_0x572ac5[_0x5e110a],_0xa24c('0x141')));return{'code':0xc8,'result':'true'};}else{logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0x140'),_0x572ac5[_0x5e110a],'false'));this[_0xa24c('0x36')]['noop'](util[_0xa24c('0x27')](_0xa24c('0x140'),_0x572ac5[_0x5e110a],_0xa24c('0x139')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xa24c('0xd')][_0xa24c('0x142')]=function(_0x3d94ee){logger['info'](util[_0xa24c('0x27')](_0xa24c('0x143'),_0x3d94ee[_0xa24c('0x38')]));return this['channel']['hangup']();};AGIVertices['prototype'][_0xa24c('0x144')]=function(_0x2ce72e){logger['info'](util[_0xa24c('0x27')](_0xa24c('0x145'),_0x2ce72e[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x2ce72e['key'])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0xe9'));}var _0x591ebb=_0xa24c('0x129');var _0x2163d5=util[_0xa24c('0x27')](_0xa24c('0x146'),FILES_PATH,rs[_0xa24c('0x118')](0x4));var _0x537eb7=util['format'](_0xa24c('0xa1'),_0x2163d5,_0x591ebb);var _0x1ec0c7=!![];if(_0x2ce72e['beep']===_0xa24c('0x133')){_0x1ec0c7=![];}var _0x2e4bfd=this[_0xa24c('0x36')]['recordFile'](_0x2163d5,_0x591ebb,_0x2ce72e['intKey'],_0x2ce72e[_0xa24c('0x65')],undefined,_0x1ec0c7);if(_0x2e4bfd[_0xa24c('0xa9')]!==-0x1){this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x147'),_0x537eb7));var _0x1df44c=this[_0xa24c('0x85')]['sync'](this,_0x2ce72e,_0x537eb7);if(_0x1df44c){for(var _0x1fbd54 in _0x1df44c){if(_0x1df44c[_0xa24c('0x9a')](_0x1fbd54)){this[_0xa24c('0x36')][_0xa24c('0xa2')](util['format'](_0xa24c('0x148'),_0x1fbd54[_0xa24c('0x6a')]()),_0x1df44c[_0x1fbd54]);}}return this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x149'),JSON[_0xa24c('0x74')](_0x1df44c)));}}return _0x2e4bfd;};AGIVertices[_0xa24c('0xd')][_0xa24c('0x14a')]=function(_0x2cc469){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x2cc469['label']));if(!this[_0xa24c('0x87')](_0x2cc469[_0xa24c('0x7a')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0xe9'));}if(!this['isConfigured'](_0x2cc469[_0xa24c('0x5c')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')]('no\x20text\x20configured');}this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x14b'),_0x2cc469[_0xa24c('0x5c')]));var _0x45c6d9=this[_0xa24c('0x82')][_0xa24c('0x70')](this,_0x2cc469);if(_0x45c6d9){this[_0xa24c('0x36')]['noop'](util[_0xa24c('0x27')](_0xa24c('0x147'),_0x45c6d9));var _0x1a61a2=this[_0xa24c('0x36')]['streamFile'](_0x45c6d9,_0x2cc469[_0xa24c('0x12c')]);try{fs['unlink'](_0x45c6d9+'.wav');}catch(_0x692c71){logger['error'](_0x692c71);}return _0x1a61a2;}return this['channel'][_0xa24c('0x2a')](_0x2cc469,_0xa24c('0x14c'));};AGIVertices[_0xa24c('0xd')][_0xa24c('0x14d')]=function(_0x502179){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0x14e'),_0x502179[_0xa24c('0x38')]));if(!this['isConfigured'](_0x502179['findBy'])){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x502179,'no\x20find\x20by\x20configured');}logger[_0xa24c('0x2e')](util[_0xa24c('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa24c('0x36')][_0xa24c('0x3b')],_0x502179[_0xa24c('0x14f')]));var _0x3c0c0c=this[_0xa24c('0x55')][_0xa24c('0x70')](this,_0x502179['findBy']);if(_0x3c0c0c){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa24c('0x36')][_0xa24c('0x3b')],_0x502179['findBy']));this[_0xa24c('0x36')]['noop'](util[_0xa24c('0x27')](_0xa24c('0x150'),this[_0xa24c('0x36')]['callerid'],_0x502179[_0xa24c('0x14f')]));return{'code':0xc8,'result':_0xa24c('0x151')};}else{logger['info'](util['format'](_0xa24c('0x152'),this[_0xa24c('0x36')][_0xa24c('0x3b')],_0x502179[_0xa24c('0x14f')]));this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x152'),this[_0xa24c('0x36')]['callerid'],_0x502179[_0xa24c('0x14f')]));return{'code':0xc8,'result':_0xa24c('0x153')};}};AGIVertices[_0xa24c('0xd')][_0xa24c('0x154')]=function(_0x52d4ef){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x52d4ef[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x52d4ef[_0xa24c('0x14f')])){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x52d4ef,'no\x20find\x20by\x20configured');}logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0x155'),this['channel'][_0xa24c('0x3b')],_0x52d4ef['findBy']));var _0x1b3b5e=this[_0xa24c('0x51')][_0xa24c('0x70')](this,_0x52d4ef[_0xa24c('0x14f')]);if(_0x1b3b5e){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xa24c('0x3b')],_0x52d4ef[_0xa24c('0x14f')]));this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x150'),this[_0xa24c('0x36')][_0xa24c('0x3b')],_0x52d4ef['findBy']));return{'code':0xc8,'result':_0xa24c('0x151')};}else{logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0x152'),this[_0xa24c('0x36')][_0xa24c('0x3b')],_0x52d4ef['findBy']));this['channel']['noop'](util[_0xa24c('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa24c('0x36')]['callerid'],_0x52d4ef[_0xa24c('0x14f')]));return{'code':0xc8,'result':_0xa24c('0x153')};}};AGIVertices[_0xa24c('0xd')][_0xa24c('0x156')]=function(_0x15252a){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x157'),_0x15252a[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x15252a[_0xa24c('0x158')])){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x15252a,'no\x20operation\x20configured');}this['channel'][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x159'),_0x15252a[_0xa24c('0x158')]));var _0x4f9168=eval(_0x15252a[_0xa24c('0x158')]);if(!this[_0xa24c('0x87')](_0x15252a[_0xa24c('0xda')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5343fe=this[_0xa24c('0xa8')][_0xa24c('0x70')](this,_0x15252a[_0xa24c('0xda')]);if(!_0x5343fe){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x15252a,_0xa24c('0x116'));}if(_[_0xa24c('0x9d')](_0x4f9168)){var _0x436cd1=this;_0x4f9168[_0xa24c('0xdc')](function(_0xa2e18,_0x58078b){_0x436cd1[_0xa24c('0x36')][_0xa24c('0xa2')](util[_0xa24c('0x27')](_0xa24c('0x15a'),_0x5343fe,_0x58078b),_0xa2e18);});return this['channel'][_0xa24c('0xaf')](util['format'](_0xa24c('0x15b'),_0x5343fe));}else{return this[_0xa24c('0x36')][_0xa24c('0xa2')](_0x5343fe,_0x4f9168);}};AGIVertices[_0xa24c('0xd')][_0xa24c('0x8')]=function(_0x2091df){logger['info'](util[_0xa24c('0x27')](_0xa24c('0x15c'),_0x2091df['label']));if(_0x2091df[_0xa24c('0xac')]===0x0){return this[_0xa24c('0xab')](_0x2091df);}_0x2091df[_0xa24c('0xac')]-=0x1;if(!this[_0xa24c('0x87')](_0x2091df[_0xa24c('0x10f')])){return this['channel'][_0xa24c('0x2a')](_0x2091df,_0xa24c('0x110'));}var _0x2d1f66=this[_0xa24c('0x1c')][_0xa24c('0x70')](this,_0x2091df[_0xa24c('0x10f')]);if(!_0x2d1f66){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x2091df,_0xa24c('0x111'));}var _0x59aef0=this[_0xa24c('0x36')][_0xa24c('0x112')](_0x2d1f66,_0x2091df[_0xa24c('0x113')],_0x2091df[_0xa24c('0x15d')]);var _0x4ddcf9=_0x59aef0[_0xa24c('0xa9')];if(_0x59aef0[_0xa24c('0xa9')]===-0x1){this[_0xa24c('0x35')][_0xa24c('0x70')](this,_0x2091df,'-1');return _0x59aef0;}else if(_0x59aef0[_0xa24c('0xa5')]==='timeout'){_0x59aef0[_0xa24c('0xa9')]=_0x59aef0[_0xa24c('0xa9')][_0xa24c('0x9e')]>0x0?_0x59aef0[_0xa24c('0xa9')]:'t';}else if(_[_0xa24c('0x44')](_0x59aef0[_0xa24c('0xa9')])){_0x59aef0[_0xa24c('0xa9')]='#';_0x4ddcf9='#';}if(!this[_0xa24c('0x87')](_0x2091df[_0xa24c('0xda')])){this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0xdb'));}else{var _0x12a330=this[_0xa24c('0xa8')]['sync'](this,_0x2091df[_0xa24c('0xda')]);if(!_0x12a330){return this[_0xa24c('0x36')]['error'](_0x2091df,_0xa24c('0x116'));}this[_0xa24c('0x36')][_0xa24c('0xa2')](_0x12a330,_0x4ddcf9);}this['createSquareDetailsReport']['sync'](this,_0x2091df,_0x4ddcf9);return _0x59aef0;};AGIVertices[_0xa24c('0xd')][_0xa24c('0xaf')]=function(_0x52223e){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0x15e'),_0x52223e['label']));return this[_0xa24c('0x36')]['noop'](_0x52223e[_0xa24c('0x15f')]||_0x52223e['label']);};AGIVertices[_0xa24c('0xd')][_0xa24c('0x160')]=function(_0x5a1919){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x5a1919['label']));if(!this[_0xa24c('0x87')](_0x5a1919[_0xa24c('0x14f')])){return this['channel']['error'](_0x5a1919,_0xa24c('0x161'));}logger[_0xa24c('0x2e')](util[_0xa24c('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa24c('0x36')]['callerid'],_0x5a1919[_0xa24c('0x14f')]));var _0x484699=this['getPause'][_0xa24c('0x70')](this,_0x5a1919[_0xa24c('0x162')]);var _0x374bdf=this[_0xa24c('0x4e')][_0xa24c('0x70')](this,_0x5a1919[_0xa24c('0x14f')],_0x484699);if(_0x374bdf){logger['info'](util[_0xa24c('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa24c('0x36')]['callerid'],_0x5a1919[_0xa24c('0x14f')]));this['channel'][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x150'),this[_0xa24c('0x36')][_0xa24c('0x3b')],_0x5a1919[_0xa24c('0x14f')]));return{'code':0xc8,'result':_0xa24c('0x151')};}else{logger['info'](util[_0xa24c('0x27')](_0xa24c('0x152'),this['channel'][_0xa24c('0x3b')],_0x5a1919[_0xa24c('0x14f')]));this[_0xa24c('0x36')][_0xa24c('0xaf')](util['format'](_0xa24c('0x150'),this[_0xa24c('0x36')][_0xa24c('0x3b')],_0x5a1919[_0xa24c('0x14f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa24c('0xd')][_0xa24c('0x163')]=function(_0x9f99b5){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0x164'),_0x9f99b5[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x9f99b5[_0xa24c('0x10f')])){return this['channel']['error'](_0x9f99b5,_0xa24c('0x110'));}var _0x138b7b=this[_0xa24c('0x1c')]['sync'](this,_0x9f99b5[_0xa24c('0x10f')]);if(!_0x138b7b){return this[_0xa24c('0x36')]['error'](_0x9f99b5,_0xa24c('0x111'));}var _0x5bdca3=this[_0xa24c('0x36')][_0xa24c('0x57')](_0xa24c('0x165'),[_0x138b7b,_0x9f99b5[_0xa24c('0xe6')]]);if(_0x5bdca3[_0xa24c('0xa9')]===-0x1){return _0x5bdca3;}return this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x166'),_0xa24c('0x165'),_0x138b7b));};AGIVertices[_0xa24c('0xd')][_0xa24c('0x167')]=function(_0x2c0702){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0x168'),_0x2c0702[_0xa24c('0x38')]));if(!this['isConfigured'](_0x2c0702[_0xa24c('0x169')])){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x2c0702,_0xa24c('0x16a'));}var _0x3b0e39='';var _0x5221c8=parseInt(_0x2c0702[_0xa24c('0x169')],0xa);if(isNaN(_0x5221c8)){_0x3b0e39=_0x2c0702[_0xa24c('0x169')];}else{_0x3b0e39=this[_0xa24c('0x11')][_0xa24c('0x70')](this,_0x2c0702['queue_id']);if(!_0x3b0e39){return this[_0xa24c('0x36')]['error'](_0x2c0702,_0xa24c('0x16b'));}}var _0x3a9e59='';if(this[_0xa24c('0x87')](_0x2c0702[_0xa24c('0x10f')])){var _0x3f8aa8=this['getSound'][_0xa24c('0x70')](this,_0x2c0702[_0xa24c('0x10f')]);if(_0x3f8aa8){_0x3a9e59=_0x3f8aa8;}}this[_0xa24c('0x35')]['sync'](this,_0x2c0702,_0x3b0e39);if(_0x2c0702[_0xa24c('0xe6')][_0xa24c('0x16c')]('x')<0x0){_0x2c0702[_0xa24c('0xe6')]+='x';}if(_0x2c0702[_0xa24c('0xe6')][_0xa24c('0x16c')]('X')<0x0){_0x2c0702[_0xa24c('0xe6')]+='X';}this[_0xa24c('0x36')][_0xa24c('0xa2')](_0xa24c('0x16d'),_0x3b0e39?_0x3b0e39['toLowerCase']():'');var _0x4b15b8=this[_0xa24c('0x36')]['exec'](_0xa24c('0x16e'),[_0x3b0e39,_0x2c0702[_0xa24c('0xe6')],_0x2c0702['url'],_0x3a9e59,_0x2c0702[_0xa24c('0x65')],_0x2c0702[_0xa24c('0x5')],_0x2c0702[_0xa24c('0x16f')],_0x2c0702[_0xa24c('0x170')],'',_0x2c0702[_0xa24c('0x171')]]);if(_0x4b15b8[_0xa24c('0xa9')]===-0x1){return _0x4b15b8;}return this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')]('Executed\x20command\x20%s\x20%s',_0xa24c('0x16e'),_0x3b0e39));};AGIVertices['prototype'][_0xa24c('0x172')]=function(_0x51e0e8){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0x173'),_0x51e0e8[_0xa24c('0x38')]));var _0x2b91be=_0x51e0e8['recordingFormat']||'wav';var _0x2edfd2=util[_0xa24c('0x27')](_0xa24c('0x174'),this['channel'][_0xa24c('0x37')],rs['generate'](0x5));var _0x3bf8d7=util['format'](_0xa24c('0x175'),FILES_PATH,_0x2edfd2,_0x2b91be);var _0x2eff51=util['format'](_0xa24c('0x146'),FILES_PATH,_0x2edfd2);this[_0xa24c('0x3c')]['sync'](this,_0x51e0e8,_0x2edfd2,_0x3bf8d7);this[_0xa24c('0x36')][_0xa24c('0xa2')](_0xa24c('0x176'),_0x2edfd2);logger[_0xa24c('0x2e')](_0xa24c('0x177'),_0x2eff51,_0x2b91be,_0x51e0e8[_0xa24c('0x178')],_0x51e0e8[_0xa24c('0x65')]);return this['channel'][_0xa24c('0x12b')](_0x2eff51,_0x2b91be,_0x51e0e8[_0xa24c('0x178')],_0x51e0e8['timeout'],undefined,!![]);};AGIVertices[_0xa24c('0xd')][_0xa24c('0x179')]=function(_0x27bfa9){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x17a'),_0x27bfa9['label']));if(!this['isConfigured'](_0x27bfa9['url'])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0x17b'));}var _0x142dff=this[_0xa24c('0x62')][_0xa24c('0x70')](this,_0x27bfa9);logger[_0xa24c('0x2e')](util['format']('Response:',util[_0xa24c('0x17c')](_0x142dff,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x27bfa9[_0xa24c('0xda')])){return this[_0xa24c('0x36')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x241be0=this[_0xa24c('0xa8')]['sync'](this,_0x27bfa9[_0xa24c('0xda')]);if(!_0x241be0){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x27bfa9,_0xa24c('0x116'));}this[_0xa24c('0x36')][_0xa24c('0xa2')](util['format'](_0xa24c('0x17d'),_0x241be0),_0x142dff[_0xa24c('0x17e')]?_0x142dff[_0xa24c('0x17e')]:_0xa24c('0x17f'));this['channel'][_0xa24c('0xa2')](util['format'](_0xa24c('0x180'),_0x241be0),_0x142dff[_0xa24c('0x181')]?_0x142dff[_0xa24c('0x181')]:'OK');if(_0x142dff[_0xa24c('0x75')]){try{this[_0xa24c('0xa0')](_0x142dff[_0xa24c('0x75')],_0x241be0);}catch(_0x5ac955){logger[_0xa24c('0x2a')](util[_0xa24c('0x27')](_0xa24c('0x182'),_0x241be0));}}return this['channel']['noop'](util[_0xa24c('0x27')](_0xa24c('0x183'),_0x241be0));};AGIVertices[_0xa24c('0xd')]['saydigits']=function(_0x31b142){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0x184'),_0x31b142[_0xa24c('0x38')]));return this[_0xa24c('0x36')][_0xa24c('0x185')](_0x31b142[_0xa24c('0x186')][_0xa24c('0x59')](/\s+/g,''),_0x31b142['escape_digits']);};AGIVertices[_0xa24c('0xd')][_0xa24c('0x187')]=function(_0x33f219){logger[_0xa24c('0x2e')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x33f219['label']));return this[_0xa24c('0x36')][_0xa24c('0x188')](_0x33f219[_0xa24c('0x66')]['replace'](/\s+/g,''),_0x33f219[_0xa24c('0x178')]);};AGIVertices[_0xa24c('0xd')][_0xa24c('0x189')]=function(_0x458ae0){logger['info'](util[_0xa24c('0x27')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x458ae0[_0xa24c('0x38')]));return this[_0xa24c('0x36')][_0xa24c('0x18a')](_0x458ae0['text'],_0x458ae0[_0xa24c('0x178')]);};AGIVertices[_0xa24c('0xd')][_0xa24c('0x18b')]=function(_0x2ff781){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x18c'),_0x2ff781['label']));if(!this['isConfigured'](_0x2ff781[_0xa24c('0x18d')])){return this[_0xa24c('0x36')]['noop'](_0xa24c('0x18e'));}var _0xef6567=this[_0xa24c('0x20')][_0xa24c('0x70')](this,_0x2ff781['account_id']);if(!_0xef6567||!_0xef6567['Smtp']){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x2ff781,_0xa24c('0x18f'));}var _0x2ab46b={'from':util[_0xa24c('0x27')](_0xa24c('0x190'),_0xef6567[_0xa24c('0x10')],_0xef6567[_0xa24c('0x191')]||_0xef6567[_0xa24c('0x192')]['user']),'to':_0x2ff781['to']||'','cc':_0x2ff781['cc']||'','bcc':_0x2ff781[_0xa24c('0x193')]||'','subject':_0x2ff781[_0xa24c('0x194')],'html':_0x2ff781[_0xa24c('0x5c')],'text':_0x2ff781[_0xa24c('0x5c')]};if(this['isConfigured'](_0x2ff781['template_id'])){}logger[_0xa24c('0xe1')](_0xa24c('0x195'),JSON[_0xa24c('0x74')](_0x2ab46b));this[_0xa24c('0x35')][_0xa24c('0x70')](this,_0x2ff781,_0x2ff781['account_id']);this['channel'][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x196'),_0xef6567[_0xa24c('0x10')]));this[_0xa24c('0x22')][_0xa24c('0x70')](this,_0xef6567[_0xa24c('0x197')],_0x2ab46b);return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0x198'));};AGIVertices[_0xa24c('0xd')][_0xa24c('0x199')]=function(_0x364353){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x364353[_0xa24c('0x38')]));return this['channel'][_0xa24c('0xaf')](_0xa24c('0x19a'));};AGIVertices[_0xa24c('0xd')][_0xa24c('0x19b')]=function(_0x22d5e9){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0x19c'),_0x22d5e9[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x22d5e9['sms_account_id'])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0x19d'));}var _0x3af946=this[_0xa24c('0x32')][_0xa24c('0x70')](this,_0x22d5e9[_0xa24c('0x19e')]);if(!_0x3af946){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x22d5e9,_0xa24c('0x19f'));}var _0x4e4190={'body':_0x22d5e9['sms_text'],'phone':_0x22d5e9['to']||'','SmsAccountId':_0x3af946['id']};logger[_0xa24c('0xe1')](_0xa24c('0x1a0'),JSON[_0xa24c('0x74')](_0x4e4190));this['createSquareDetailsReport'][_0xa24c('0x70')](this,_0x22d5e9,_0x22d5e9[_0xa24c('0x19e')]);this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x3af946[_0xa24c('0x10')]));this[_0xa24c('0x34')]['sync'](this,_0x4e4190);return this[_0xa24c('0x36')][_0xa24c('0xaf')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa24c('0xd')][_0xa24c('0x1a1')]=function(_0x1c98a1){logger['info'](util[_0xa24c('0x27')](_0xa24c('0x1a2'),_0x1c98a1[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x1c98a1[_0xa24c('0xda')])){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x1c98a1,_0xa24c('0x1a3'));}var _0xac8b49=this['getVariable'][_0xa24c('0x70')](this,_0x1c98a1[_0xa24c('0xda')]);if(!_0xac8b49){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x1c98a1,_0xa24c('0x116'));}return this[_0xa24c('0x36')][_0xa24c('0xa2')](_0xac8b49,_0x1c98a1['variable_value']);};AGIVertices['prototype'][_0xa24c('0x1a4')]=function(_0x164af1){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x1a5'),_0x164af1['label']));this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0x1a6'));var _0x13b22d=this['channel'][_0xa24c('0xa8')](_0xa24c('0x1a7'));if(!_[_0xa24c('0x44')](_0x13b22d[_0xa24c('0xa5')])){this[_0xa24c('0x36')]['uniqueid']=_0x13b22d['extra'];}if(_0x164af1['answer']==='yes'){this[_0xa24c('0x36')]['noop'](_0xa24c('0x1a8'));return this[_0xa24c('0x36')]['answer']();}return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0x1a9'));};AGIVertices[_0xa24c('0xd')][_0xa24c('0x1aa')]=function(_0x432ecf){logger['info'](util[_0xa24c('0x27')](_0xa24c('0x1ab'),_0x432ecf[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x432ecf[_0xa24c('0x1ac')])){return this[_0xa24c('0x36')]['error'](_0x432ecf,_0xa24c('0x1ad'));}var _0x320152=this[_0xa24c('0x13')]['sync'](this,_0x432ecf[_0xa24c('0x1ac')]);if(!this[_0xa24c('0x87')](_0x320152)){return this['channel']['error'](_0x432ecf,util[_0xa24c('0x27')](_0xa24c('0x1ae'),_0x432ecf[_0xa24c('0x1ac')]));}if(_0x320152===this['channel'][_0xa24c('0x3a')]){return this[_0xa24c('0x36')]['error'](_0x432ecf,_0xa24c('0x1af'));}this[_0xa24c('0x35')][_0xa24c('0x70')](this,_0x432ecf,_0x320152);var _0x208dd6=this['channel'][_0xa24c('0x57')]('AGI',util[_0xa24c('0x27')](_0xa24c('0x1b0'),config[_0xa24c('0x5')][_0xa24c('0x1b1')]||_0xa24c('0x1b2'),_0x320152,this[_0xa24c('0x36')][_0xa24c('0x3a')]));if(_0x208dd6[_0xa24c('0xa9')]===-0x1){return _0x208dd6;}return this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x166'),'AGI',_0x320152));};AGIVertices[_0xa24c('0xd')]['system']=function(_0x5a5cbf){logger['info'](util[_0xa24c('0x27')](_0xa24c('0x1b3'),_0x5a5cbf['label']));var _0x4715bb=this[_0xa24c('0x56')][_0xa24c('0x70')](this,_0x5a5cbf['command']);this[_0xa24c('0x35')][_0xa24c('0x70')](this,_0x5a5cbf,_0x5a5cbf['command']);if(this[_0xa24c('0x87')](_0x5a5cbf[_0xa24c('0xda')])){var _0x3817de=this[_0xa24c('0xa8')][_0xa24c('0x70')](this,_0x5a5cbf[_0xa24c('0xda')]);if(_0x3817de){this['channel'][_0xa24c('0xa2')](_0x3817de,_0x4715bb);return this[_0xa24c('0x36')]['noop'](util[_0xa24c('0x27')](_0xa24c('0x1b4'),_0x5a5cbf[_0xa24c('0xbb')],_0x3817de));}}return this[_0xa24c('0x36')]['noop'](util[_0xa24c('0x27')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x5a5cbf[_0xa24c('0xbb')]));};AGIVertices[_0xa24c('0xd')]['google_cloud_tts']=function(_0x52dd09){logger['info'](util[_0xa24c('0x27')](_0xa24c('0x1b5'),_0x52dd09['label']));_0x52dd09[_0xa24c('0x5c')]=_0x52dd09['text'][_0xa24c('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa24c('0x87')](_0x52dd09[_0xa24c('0x1b6')])){return this[_0xa24c('0x36')]['noop'](_0xa24c('0x1b7'));}if(!this['isConfigured'](_0x52dd09[_0xa24c('0x5c')])){return this['channel'][_0xa24c('0xaf')]('no\x20text\x20configured');}this[_0xa24c('0x36')][_0xa24c('0xaf')](util['format'](_0xa24c('0x1b8'),_0x52dd09[_0xa24c('0x5c')]));var _0xe95a39=this[_0xa24c('0x5a')]['sync'](this,_0x52dd09);if(_0xe95a39){this[_0xa24c('0x36')]['noop'](util['format'](_0xa24c('0x1b9'),_0xe95a39));var _0xb6e669=this['channel']['streamFile'](_0xe95a39);try{fs[_0xa24c('0x104')](_0xe95a39+_0xa24c('0x1ba'));}catch(_0x4d5842){logger[_0xa24c('0x2a')](_0x4d5842);}return _0xb6e669;}return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x52dd09,_0xa24c('0x1bb'));};AGIVertices[_0xa24c('0xd')][_0xa24c('0x1bc')]=function(_0x16a483){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x1bd'),_0x16a483[_0xa24c('0x38')]));_0x16a483[_0xa24c('0x5c')]=_0x16a483['text'][_0xa24c('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x16a483[_0xa24c('0x5c')])){return this[_0xa24c('0x36')][_0xa24c('0xaf')](_0xa24c('0xb0'));}this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x1be'),_0x16a483[_0xa24c('0x5c')]));var _0x2b37d3=this['googleTTS'][_0xa24c('0x70')](this,_0x16a483);if(_0x2b37d3){this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x1bf'),_0x2b37d3));var _0x5493b1=this[_0xa24c('0x36')][_0xa24c('0x103')](_0x2b37d3);try{fs[_0xa24c('0x104')](_0x2b37d3+_0xa24c('0x1ba'));}catch(_0xc04989){logger[_0xa24c('0x2a')](_0xc04989);}return _0x5493b1;}return this['channel'][_0xa24c('0x2a')](_0x16a483,_0xa24c('0x1c0'));};AGIVertices[_0xa24c('0xd')]['unpause']=function(_0x15e080){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0x1c1'),_0x15e080[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x15e080['findBy'])){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x15e080,_0xa24c('0x161'));}logger[_0xa24c('0x2e')](util[_0xa24c('0x27')](_0xa24c('0x155'),this[_0xa24c('0x36')][_0xa24c('0x3b')],_0x15e080[_0xa24c('0x14f')]));var _0x5a3527=this[_0xa24c('0x50')][_0xa24c('0x70')](this,_0x15e080[_0xa24c('0x14f')]);if(_0x5a3527){logger[_0xa24c('0x2e')](util[_0xa24c('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa24c('0x36')][_0xa24c('0x3b')],_0x15e080['findBy']));this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa24c('0x36')][_0xa24c('0x3b')],_0x15e080['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xa24c('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa24c('0x36')][_0xa24c('0x3b')],_0x15e080[_0xa24c('0x14f')]));this[_0xa24c('0x36')][_0xa24c('0xaf')](util[_0xa24c('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa24c('0x36')][_0xa24c('0x3b')],_0x15e080[_0xa24c('0x14f')]));return{'code':0xc8,'result':_0xa24c('0x153')};}};AGIVertices[_0xa24c('0xd')][_0xa24c('0x1c2')]=function(_0x5c72e5){logger[_0xa24c('0x2e')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x5c72e5[_0xa24c('0x38')]));var _0x467c28=this[_0xa24c('0x36')][_0xa24c('0x57')](_0xa24c('0x1c3'),[_0x5c72e5[_0xa24c('0x1c4')],_0x5c72e5['options']]);if(_0x467c28['result']===-0x1){return _0x467c28;}return this['channel'][_0xa24c('0xaf')](util[_0xa24c('0x27')](_0xa24c('0x166'),_0xa24c('0x1c3'),_0x5c72e5[_0xa24c('0x1c4')]));};AGIVertices[_0xa24c('0xd')][_0xa24c('0x1c5')]=function(_0x2a1461){logger[_0xa24c('0x2e')](util['format'](_0xa24c('0x1c6'),_0x2a1461[_0xa24c('0x38')]));if(!this[_0xa24c('0x87')](_0x2a1461['variable_id'])){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x2a1461,_0xa24c('0x1a3'));}var _0x305901=this[_0xa24c('0xa8')]['sync'](this,_0x2a1461[_0xa24c('0xda')]);if(!_0x305901){return this[_0xa24c('0x36')][_0xa24c('0x2a')](_0x2a1461,_0xa24c('0x116'));}var _0x1adf64=this[_0xa24c('0x36')][_0xa24c('0xa8')](_0x305901);return{'code':0xc8,'result':_0x1adf64[_0xa24c('0xa5')]?_0x1adf64[_0xa24c('0xa5')]:'-'};};String[_0xa24c('0xd')][_0xa24c('0xa4')]=function(_0x395ae3,_0x2d9e5d){return this[_0xa24c('0xa3')](_0x395ae3)[_0xa24c('0x1c7')](_0x2d9e5d);};module[_0xa24c('0x1c8')]=AGIVertices; \ No newline at end of file +var _0xf0ba=['set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','replaceAll','exports','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','agi','./scripts','rawBody','menu','getdigits','getsecretdigits','channel','rpc','prototype','then','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','interval','map','Intervals','getSoundPath','format','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','isNil','agentUnpause','agent','agentLogout','agentLogin','internal','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','method','number','timeout','includes','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','url','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','appid','clear','agicommand','clone','isString','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','hasOwnProperty','%s.%s','setVariable','replaceObjectAllVariables','split','getVariable','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','options','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','callback_priority','sync','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','grammar','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','toUpperCase','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','hiddendigitspos','first','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','beep','recordFile','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','true','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','false','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20selected','getVoiceQueue','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','bcc','subject','template_id','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var fs=require('fs');var util=require(_0xaf0b('0x0'));var _=require(_0xaf0b('0x1'));var sh=require(_0xaf0b('0x2'));var odbc=require(_0xaf0b('0x3'))();var rs=require(_0xaf0b('0x4'));var moment=require('moment');var Mustache=require(_0xaf0b('0x5'));var rp=require(_0xaf0b('0x6'));var logger=require('../../config/logger')(_0xaf0b('0x7'));var config=require('../../config/environment');var scripts=require(_0xaf0b('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0xaf0b('0x9')];var verticesWithRetry=[_0xaf0b('0xa'),_0xaf0b('0xb'),_0xaf0b('0xc')];var AGIVertices=function(_0xd67a9,_0x5b7f0c,_0x2fac18){this[_0xaf0b('0xd')]=_0xd67a9;this[_0xaf0b('0xe')]=_0x5b7f0c;this['mailRpc']=_0x2fac18;};AGIVertices[_0xaf0b('0xf')]['getVariable']=function(_0x3261b8,_0x758a23){this[_0xaf0b('0xe')]['getVariableById'](_0x3261b8)[_0xaf0b('0x10')](function(_0x385633){_0x758a23(null,_0x385633?_0x385633[_0xaf0b('0x11')]:![]);})[_0xaf0b('0x12')](function(_0x283de8){_0x758a23(_0x283de8);});};AGIVertices[_0xaf0b('0xf')]['getVoiceQueue']=function(_0x16282b,_0xdbd3d6){this[_0xaf0b('0xe')][_0xaf0b('0x13')](_0x16282b)['then'](function(_0x317cbf){_0xdbd3d6(null,_0x317cbf?_0x317cbf[_0xaf0b('0x11')]:![]);})[_0xaf0b('0x12')](function(_0x2cb9a2){_0xdbd3d6(_0x2cb9a2);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x14')]=function(_0x2afbae,_0x1f1308){this['rpc'][_0xaf0b('0x15')](_0x2afbae)['then'](function(_0x152f69){_0x1f1308(null,_0x152f69?_0x152f69[_0xaf0b('0x11')]:![]);})[_0xaf0b('0x12')](function(_0xbe0d1e){_0x1f1308(_0xbe0d1e);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x16')]=function(_0x1a32c2,_0x217a08){this[_0xaf0b('0xe')][_0xaf0b('0x17')](_0x1a32c2)['then'](function(_0x29c3df){_0x217a08(null,_0x29c3df?_0x29c3df[_0xaf0b('0x18')]:![]);})[_0xaf0b('0x12')](function(_0x546303){_0x217a08(_0x546303);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x19')]=function(_0x4904b3,_0x3f77d5){this[_0xaf0b('0xe')][_0xaf0b('0x1a')](_0x4904b3)[_0xaf0b('0x10')](function(_0x1a7b68){_0x3f77d5(null,_0x1a7b68?_0x1a7b68['name']:![]);})['catch'](function(_0x4541c5){_0x3f77d5(_0x4541c5);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x1b')]=function(_0x24ca9d,_0x24f78c){this[_0xaf0b('0xe')][_0xaf0b('0x1c')](_0x24ca9d)[_0xaf0b('0x10')](function(_0x5396f2){_0x24f78c(null,_0x5396f2?_0x5396f2[_0xaf0b('0x11')]:![]);})[_0xaf0b('0x12')](function(_0x3a4820){_0x24f78c(_0x3a4820);});};AGIVertices['prototype'][_0xaf0b('0x1d')]=function(_0x3d1a23,_0x54c3be){var _0x5a3e1b=this;this['rpc'][_0xaf0b('0x1e')](_0x3d1a23)[_0xaf0b('0x10')](function(_0x862513){_0x54c3be(null,_0x862513?_0x5a3e1b['getSoundPath'](_0x862513[_0xaf0b('0x1f')]):![]);})[_0xaf0b('0x12')](function(_0x4b9031){_0x54c3be(_0x4b9031);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x20')]=function(_0x246e23,_0x159389){this['rpc'][_0xaf0b('0x21')](_0x246e23)[_0xaf0b('0x10')](function(_0x4beee6){_0x159389(null,_0x4beee6?_0x4beee6:![]);})[_0xaf0b('0x12')](function(_0x1dcd89){_0x159389(_0x1dcd89);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x22')]=function(_0x3935ca,_0x28d0a3,_0x3d6112){this[_0xaf0b('0x23')][_0xaf0b('0x22')](_0x3935ca,_0x28d0a3)['then'](function(){_0x3d6112(null);})[_0xaf0b('0x12')](function(_0x588726){_0x3d6112(_0x588726);});};AGIVertices['prototype']['getIntervals']=function(_0x1d6771,_0x3b0f51){this[_0xaf0b('0xe')][_0xaf0b('0x24')](_0x1d6771)[_0xaf0b('0x10')](function(_0x460e37){if(_0x460e37){if(_0x460e37['IntervalId']){_0x3b0f51(null,[_0x460e37[_0xaf0b('0x25')]]);}else{_0x3b0f51(null,_[_0xaf0b('0x26')](_0x460e37[_0xaf0b('0x27')],_0xaf0b('0x25')));}}else{_0x3b0f51(null,![]);}})[_0xaf0b('0x12')](function(_0x3a17e0){_0x3b0f51(_0x3a17e0);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x28')]=function(_0xf18f8){return util[_0xaf0b('0x29')]('%s/sounds/converted/%s',FILES_PATH,_0xf18f8);};AGIVertices[_0xaf0b('0xf')]['getQueryOdbc']=function(_0x2ed4bd,_0x478dec,_0x1f429d){odbc['open'](_0x2ed4bd,function(_0xc7ceff){if(_0xc7ceff){logger[_0xaf0b('0x2a')](_0xaf0b('0x2b'),_0xc7ceff);_0x1f429d(_0xc7ceff);}else{logger[_0xaf0b('0x2c')](_0xaf0b('0x2d'));odbc[_0xaf0b('0x2e')](_0x478dec,function(_0x39e8ec,_0x53df94){if(_0x39e8ec){logger[_0xaf0b('0x2c')](_0xaf0b('0x2f'),_0x478dec);_0x1f429d(_0x39e8ec);}else{logger[_0xaf0b('0x2c')](_0xaf0b('0x30'),_0x478dec);odbc['close'](function(_0xf44ffd){if(_0xf44ffd){logger[_0xaf0b('0x2a')](_0xaf0b('0x31'),_0xf44ffd);}_0x1f429d(null,_0x53df94);});}});}});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x32')]=function(_0x5df6d2,_0x21ef80){this[_0xaf0b('0xe')][_0xaf0b('0x33')](_0x5df6d2)[_0xaf0b('0x10')](function(_0x185d64){_0x21ef80(null,_0x185d64?_0x185d64:![]);})[_0xaf0b('0x12')](function(_0x41e4c5){_0x21ef80(_0x41e4c5);});};AGIVertices['prototype'][_0xaf0b('0x34')]=function(_0x4a7160,_0x3d12b2){this[_0xaf0b('0xe')][_0xaf0b('0x34')](_0x4a7160)[_0xaf0b('0x10')](function(_0x3c0e4b){_0x3d12b2(null,_0x3c0e4b);})[_0xaf0b('0x12')](function(_0x29a249){_0x3d12b2(_0x29a249);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x35')]=function(_0x4b604d,_0x1e0743,_0x1521c1){this[_0xaf0b('0xe')][_0xaf0b('0x35')]({'uniqueid':this[_0xaf0b('0xd')]['uniqueid'],'node':_0x4b604d[_0xaf0b('0x36')],'application':_0x4b604d['agicommand'],'data':_0x1e0743||null,'project_name':this[_0xaf0b('0xd')][_0xaf0b('0x37')],'callerid':this[_0xaf0b('0xd')][_0xaf0b('0x38')]})[_0xaf0b('0x10')](function(_0x2fa23b){if(_0x1521c1){_0x1521c1(null,_0x2fa23b);}})[_0xaf0b('0x12')](function(_0x1acc55){if(_0x1521c1){_0x1521c1(_0x1acc55);}});};AGIVertices[_0xaf0b('0xf')]['createSquareRecording']=function(_0x2e314a,_0x3fa620,_0x4d5ced,_0x3dc17c){this[_0xaf0b('0xe')][_0xaf0b('0x39')]({'uniqueid':this[_0xaf0b('0xd')][_0xaf0b('0x3a')],'callerid':this[_0xaf0b('0xd')][_0xaf0b('0x38')],'calleridname':this[_0xaf0b('0xd')][_0xaf0b('0x3b')],'context':this[_0xaf0b('0xd')][_0xaf0b('0x3c')],'extension':this['channel'][_0xaf0b('0x3d')],'priority':this[_0xaf0b('0xd')][_0xaf0b('0x3e')],'accountcode':this[_0xaf0b('0xd')][_0xaf0b('0x3f')],'dnid':this[_0xaf0b('0xd')][_0xaf0b('0x40')],'projectName':this[_0xaf0b('0xd')][_0xaf0b('0x37')],'saveName':_0x3fa620,'filename':_0x2e314a['file']||_0x3fa620,'savePath':_0x4d5ced})[_0xaf0b('0x10')](function(_0x598904){_0x3dc17c(null,_0x598904);})[_0xaf0b('0x12')](function(_0x3f8e17){_0x3dc17c(_0x3f8e17);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x41')]=function(_0x2064b6,_0x2d865f,_0x4d3f0e,_0x54922c,_0x321181){this[_0xaf0b('0xe')][_0xaf0b('0x41')]({'uniqueid':this[_0xaf0b('0xd')][_0xaf0b('0x3a')],'body':_0x2064b6,'direction':_0x2d865f,'providerName':_0x4d3f0e,'providerResponse':_0x54922c})['then'](function(_0x3e9b52){if(_0x321181){_0x321181(null,_0x3e9b52);}})[_0xaf0b('0x12')](function(_0x3cc93f){if(_0x321181){_0x321181(_0x3cc93f);}});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x42')]=function(_0x11c1d1,_0xc9d8c3){this['rpc'][_0xaf0b('0x42')]({'firstName':_[_0xaf0b('0x43')](_0x11c1d1[_0xaf0b('0x11')])||_['isNil'](_0x11c1d1[_0xaf0b('0x11')])?'callback_'+Math[_0xaf0b('0x44')]():_0x11c1d1[_0xaf0b('0x11')],'lastName':_[_0xaf0b('0x43')](_0x11c1d1[_0xaf0b('0x45')])||_['isNil'](_0x11c1d1[_0xaf0b('0x45')])?null:_0x11c1d1[_0xaf0b('0x45')],'phone':_0x11c1d1[_0xaf0b('0x46')],'ListId':_0x11c1d1[_0xaf0b('0x47')],'scheduledat':_0x11c1d1[_0xaf0b('0x48')],'callbackUniqueid':this[_0xaf0b('0xd')][_0xaf0b('0x3a')],'tags':_0xaf0b('0x49'),'description':_0xaf0b('0x4a')+_0x11c1d1['scheduledAt'][_0xaf0b('0x4b')](),'priority':_0x11c1d1['callback_priority']})[_0xaf0b('0x10')](function(_0x102da9){_0xc9d8c3(null,_0x102da9);})['catch'](function(_0x5e6d85){_0xc9d8c3(_0x5e6d85);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x4c')]=function(_0x586dd2,_0x2a229c){this['rpc'][_0xaf0b('0x4d')](_0x586dd2)[_0xaf0b('0x10')](function(_0x2d21ae){_0x2a229c(null,_0x2d21ae?_0x2d21ae['name']:![]);})[_0xaf0b('0x12')](function(_0xa6a4a2){_0x2a229c(_0xa6a4a2);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x4e')]=function(_0x29ea6b,_0x5e17d1,_0xfeddb9){var _0x1ce3ab={'role':'agent'};_0x1ce3ab[_0x29ea6b]=this[_0xaf0b('0xd')][_0xaf0b('0x38')];this[_0xaf0b('0xe')][_0xaf0b('0x4e')](_0x1ce3ab,_0x5e17d1,this[_0xaf0b('0xd')][_0xaf0b('0x3a')])[_0xaf0b('0x10')](function(_0x1aa20){_0xfeddb9(null,_[_0xaf0b('0x4f')](_0x1aa20)?![]:!![]);})[_0xaf0b('0x12')](function(_0x55cc97){logger[_0xaf0b('0x2a')](_0x55cc97);_0xfeddb9(null,![]);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x50')]=function(_0x42a4b4,_0x5ed57d){var _0x2189b7={'role':_0xaf0b('0x51')};_0x2189b7[_0x42a4b4]=this['channel']['callerid'];this[_0xaf0b('0xe')][_0xaf0b('0x50')](_0x2189b7)[_0xaf0b('0x10')](function(_0x486f73){_0x5ed57d(null,_['isNil'](_0x486f73)?![]:!![]);})['catch'](function(_0x4db608){logger['error'](_0x4db608);_0x5ed57d(null,![]);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x52')]=function(_0x9cf508,_0x939992){var _0x2db367={'role':'agent'};_0x2db367[_0x9cf508]=this[_0xaf0b('0xd')]['callerid'];this[_0xaf0b('0xe')][_0xaf0b('0x52')](_0x2db367)[_0xaf0b('0x10')](function(_0x409e41){_0x939992(null,_['isNil'](_0x409e41)?![]:!![]);})['catch'](function(_0x211d27){logger['error'](_0x211d27);_0x939992(null,![]);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x53')]=function(_0x5ce7c6,_0x2c5c3d){var _0x15d37e={'role':'agent'};_0x15d37e[_0x5ce7c6]=this['channel']['callerid'];var _0x16933c=_0x5ce7c6!=_0xaf0b('0x54')?util['format']('%s/%s@from-sip/n','LOCAL',this[_0xaf0b('0xd')]['callerid']):undefined;this['rpc'][_0xaf0b('0x53')](_0x15d37e,_0x16933c)[_0xaf0b('0x10')](function(_0x343073){_0x2c5c3d(null,_[_0xaf0b('0x4f')](_0x343073)?![]:!![]);})['catch'](function(_0x25554f){logger[_0xaf0b('0x2a')](_0x25554f);_0x2c5c3d(null,![]);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x55')]=function(_0x295ce6,_0x14d082){sh[_0xaf0b('0x56')](_[_0xaf0b('0x57')](_0x295ce6),function(_0x20a90c,_0x280534){var _0x4a5193=_0x280534[_0xaf0b('0x58')](/(\r\n|\n|\r)/gm,'');_0x14d082(null,_0x4a5193);});};AGIVertices[_0xaf0b('0xf')]['googleCloudTTS']=function(_0x2da4b4,_0x49f603){scripts[_0xaf0b('0x59')](_0x2da4b4[_0xaf0b('0x5a')],_0x2da4b4[_0xaf0b('0x5b')]||_0xaf0b('0x5c'),_0x2da4b4[_0xaf0b('0x5c')],_0x2da4b4['languageCode']||'en-US',_0x2da4b4[_0xaf0b('0x5d')]||_0xaf0b('0x5e'),_0x2da4b4[_0xaf0b('0x5f')]||'MP3')[_0xaf0b('0x10')](function(_0x2d4349){_0x49f603(null,_0x2d4349);})[_0xaf0b('0x12')](function(_0x270105){_0x49f603(_0x270105);});};AGIVertices['prototype'][_0xaf0b('0x60')]=function(_0x147a9a,_0x4d1a6e){scripts[_0xaf0b('0x60')](_0x147a9a[_0xaf0b('0x5c')],_0x147a9a['google_tts_language']||'en',0x1)[_0xaf0b('0x10')](function(_0xf9371f){_0x4d1a6e(null,_0xf9371f);})['catch'](function(_0x2bf83f){_0x4d1a6e(_0x2bf83f);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x61')]=function(_0x4caa18,_0x59d425){var _0x19ff45={'uri':_0x4caa18['url'],'method':_0x4caa18[_0xaf0b('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4caa18['timeout'])===_0xaf0b('0x63')&&parseInt(_0x4caa18['timeout'])>=0x1?parseInt(_0x4caa18[_0xaf0b('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xaf0b('0x65')](['POST',_0xaf0b('0x66')],_0x19ff45[_0xaf0b('0x62')]['toUpperCase']())){try{_0x19ff45[_0xaf0b('0x67')]=_0x4caa18[_0xaf0b('0x9')]?JSON[_0xaf0b('0x68')](_0x4caa18[_0xaf0b('0x9')]):{};}catch(_0x58c774){logger[_0xaf0b('0x2a')](_0xaf0b('0x69'),_0x58c774);}}try{_0x19ff45[_0xaf0b('0x6a')]=_0x4caa18['rawHeaders']?JSON[_0xaf0b('0x68')](_0x4caa18[_0xaf0b('0x6b')]):{};}catch(_0x20904a){logger[_0xaf0b('0x2a')](_0xaf0b('0x6c'),_0x20904a);}if(_0x4caa18['computedVariables']){try{var _0x4a9a7a=require(_0x4caa18[_0xaf0b('0x6d')])['sync'](this,_0x19ff45);_0x19ff45[_0xaf0b('0x6e')]=Mustache['render'](_0x4caa18[_0xaf0b('0x6f')],_0x4a9a7a,{},['$$','$$']);if(_0x19ff45[_0xaf0b('0x6a')]){_0x19ff45[_0xaf0b('0x6a')]=JSON[_0xaf0b('0x68')](Mustache[_0xaf0b('0x70')](JSON[_0xaf0b('0x71')](_0x19ff45[_0xaf0b('0x6a')]),_0x4a9a7a,{},['$$','$$']));}if(_0x19ff45[_0xaf0b('0x67')]){_0x19ff45['body']=JSON[_0xaf0b('0x68')](Mustache[_0xaf0b('0x70')](JSON[_0xaf0b('0x71')](_0x19ff45[_0xaf0b('0x67')]),_0x4a9a7a,{},['$$','$$']));}}catch(_0x3f7f1c){logger[_0xaf0b('0x2a')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3f7f1c);}}rp(_0x19ff45)[_0xaf0b('0x10')](function(_0x5c68ab){var _0x526039={'statusCode':_0x5c68ab[_0xaf0b('0x72')]||0xc8,'statusMessage':_0x5c68ab[_0xaf0b('0x73')]||'OK','headers':_0x5c68ab['headers']||{},'body':_0x5c68ab['body']||{}};_0x59d425(null,_0x526039);})[_0xaf0b('0x12')](function(_0x11fbfe){var _0x203019={'statusCode':_0x11fbfe[_0xaf0b('0x72')]||0x1f4,'statusMessage':_0x11fbfe[_0xaf0b('0x74')]||_0xaf0b('0x75'),'headers':_0x11fbfe['options'][_0xaf0b('0x6a')]||{},'body':_0x11fbfe['options'][_0xaf0b('0x67')]||{}};_0x59d425(null,_0x203019);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x76')]=function(_0x3a591d,_0x3334f8){scripts[_0xaf0b('0x76')](this['channel']['uniqueid'],_0x3a591d[_0xaf0b('0x77')],_0x3a591d[_0xaf0b('0x5c')],_0x3a591d[_0xaf0b('0x78')]||'en')['then'](function(_0x12e271){_0x3334f8(null,_0x12e271);})['catch'](function(_0x46a0d4){_0x3334f8(_0x46a0d4);});};AGIVertices['prototype'][_0xaf0b('0x79')]=function(_0x52ad66,_0x475268){scripts[_0xaf0b('0x79')](this[_0xaf0b('0xd')][_0xaf0b('0x3a')],_0x52ad66[_0xaf0b('0x7a')],_0x52ad66['client_email'],_0x52ad66['private_key'],_0x52ad66[_0xaf0b('0x5c')],_0x52ad66[_0xaf0b('0x7b')]||'en')['then'](function(_0x2d9af2){_0x475268(null,_0x2d9af2);})[_0xaf0b('0x12')](function(_0x2a5235){_0x475268(_0x2a5235);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x7c')]=function(_0x193b54,_0x221186){scripts[_0xaf0b('0x7c')](this[_0xaf0b('0xd')],_0x193b54)[_0xaf0b('0x10')](function(_0x5e7875){_0x221186(null,_0x5e7875);})[_0xaf0b('0x12')](function(_0x4a3f4a){_0x221186(_0x4a3f4a);});};AGIVertices['prototype'][_0xaf0b('0x7d')]=function(_0x4ce09c,_0x557671){scripts[_0xaf0b('0x7d')](_0x4ce09c[_0xaf0b('0x77')],_0x4ce09c[_0xaf0b('0x5c')],_0x4ce09c[_0xaf0b('0x7e')]||_0xaf0b('0x7f'),_0x4ce09c[_0xaf0b('0x80')])[_0xaf0b('0x10')](function(_0x383d9e){_0x557671(null,_0x383d9e);})[_0xaf0b('0x12')](function(_0x4bb377){_0x557671(_0x4bb377);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x81')]=function(_0xc26217,_0x1489d4,_0x2a6310){scripts[_0xaf0b('0x81')](_0x1489d4,_0xc26217[_0xaf0b('0x77')],_0xc26217[_0xaf0b('0x82')]||_0xaf0b('0x7f'),this[_0xaf0b('0x83')](_0xc26217[_0xaf0b('0x84')])?_0xc26217[_0xaf0b('0x84')]:undefined)[_0xaf0b('0x10')](function(_0x5317c7){_0x2a6310(null,_0x5317c7);})[_0xaf0b('0x12')](function(_0xa63fbb){_0x2a6310(_0xa63fbb);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x85')]=function(_0x1a97d2,_0x55003a){scripts[_0xaf0b('0x85')](_0x1a97d2[_0xaf0b('0x86')],_0x1a97d2[_0xaf0b('0x87')],_0x1a97d2[_0xaf0b('0x88')],_0x1a97d2[_0xaf0b('0x89')]||_0xaf0b('0x8a'),_0x1a97d2[_0xaf0b('0x5c')],_0x1a97d2[_0xaf0b('0x8b')]||_0xaf0b('0x5c'))[_0xaf0b('0x10')](function(_0x1f8e36){_0x55003a(null,_0x1f8e36);})[_0xaf0b('0x12')](function(_0x4a08b0){_0x55003a(_0x4a08b0);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x8c')]=function(_0x4b360c,_0x2e5f16){scripts['awsLex'](this[_0xaf0b('0xd')][_0xaf0b('0x3a')],_0x4b360c[_0xaf0b('0x86')],_0x4b360c[_0xaf0b('0x87')],_0x4b360c[_0xaf0b('0x8d')],_0x4b360c[_0xaf0b('0x5c')],_0x4b360c[_0xaf0b('0x8e')])[_0xaf0b('0x10')](function(_0x1ee7ed){_0x2e5f16(null,_0x1ee7ed);})[_0xaf0b('0x12')](function(_0x5beceb){_0x2e5f16(_0x5beceb);});};AGIVertices[_0xaf0b('0xf')]['googleASR']=function(_0x1ccdd5,_0x3e7bff,_0x402a82){scripts[_0xaf0b('0x8f')](_0x3e7bff,_0x1ccdd5[_0xaf0b('0x77')],_0x1ccdd5[_0xaf0b('0x90')]||'en-US')['then'](function(_0xbce52b){_0x402a82(null,_0xbce52b);})[_0xaf0b('0x12')](function(_0x28a66e){_0x402a82(_0x28a66e);});};AGIVertices[_0xaf0b('0xf')]['tildeASR']=function(_0x3c281d,_0x254392,_0x23e7d5){scripts['tildeASR'](_0x254392,_0x3c281d[_0xaf0b('0x91')],_0x3c281d['appsecret'],_0x3c281d[_0xaf0b('0x6e')])[_0xaf0b('0x10')](function(_0x54d554){_0x23e7d5(null,_0x54d554);})[_0xaf0b('0x12')](function(_0x1c3241){_0x23e7d5(_0x1c3241);});};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x92')]=function(_0x30095b){var _0x4a0f30=_[_0xaf0b('0x65')](verticesWithRetry,_0x30095b[_0xaf0b('0x93')])?_0x30095b:_[_0xaf0b('0x94')](_0x30095b);for(var _0x2eb732 in _0x4a0f30){if(_0x4a0f30['hasOwnProperty'](_0x2eb732)){if(_0x4a0f30[_0x2eb732]&&_[_0xaf0b('0x95')](_0x4a0f30[_0x2eb732])){if(_[_0xaf0b('0x65')](recursiveMapAttributes,_0x2eb732)){_0x4a0f30[_0x2eb732]=this['replaceObjectAllVariables'](_0x4a0f30[_0x2eb732]);}else{_0x4a0f30[_0x2eb732]=this[_0xaf0b('0x96')](_0x4a0f30[_0x2eb732]);}}}}return _0x4a0f30;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x499d78){for(var _0x2320fc in _0x499d78){if(_0x499d78['hasOwnProperty'](_0x2320fc)){if(_[_0xaf0b('0x97')](_0x499d78[_0x2320fc])){this[_0xaf0b('0x98')](_0x499d78[_0x2320fc]);}else if(_[_0xaf0b('0x99')](_0x499d78[_0x2320fc])){for(var _0x4d5550=0x0;_0x4d5550<_0x499d78[_0x2320fc][_0xaf0b('0x9a')];_0x4d5550++){this[_0xaf0b('0x98')](_0x499d78[_0x2320fc][_0x4d5550]);}}else if(_[_0xaf0b('0x95')](_0x499d78[_0x2320fc])){_0x499d78[_0x2320fc]=this['replaceAllVariables'](_0x499d78[_0x2320fc]);}}}};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x9b')]=function(_0x5d9a66,_0x47269f){for(var _0x3fc941 in _0x5d9a66){if(_0x5d9a66[_0xaf0b('0x9c')](_0x3fc941)){if(_[_0xaf0b('0x97')](_0x5d9a66[_0x3fc941])){if(!_[_0xaf0b('0x43')](_0x5d9a66[_0x3fc941])){this[_0xaf0b('0x9b')](_0x5d9a66[_0x3fc941],util['format'](_0xaf0b('0x9d'),_0x47269f,_0x3fc941));}}else if(_[_0xaf0b('0x99')](_0x5d9a66[_0x3fc941])){for(var _0x3560b8=0x0;_0x3560b8<_0x5d9a66[_0x3fc941][_0xaf0b('0x9a')];_0x3560b8++){this['saveRestApiResult'](_0x5d9a66[_0x3fc941][_0x3560b8],util[_0xaf0b('0x29')](_0xaf0b('0x9d'),_0x47269f,_0x3fc941+'['+_0x3560b8+']'));}}else{if(!_[_0xaf0b('0x4f')](_0x5d9a66[_0x3fc941])){this[_0xaf0b('0xd')][_0xaf0b('0x9e')](util['format'](_0xaf0b('0x9d'),_0x47269f,_0x3fc941),_0x5d9a66[_0x3fc941]);}}}}};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x9f')]=function(_0x37331e){try{var _0x147982=JSON[_0xaf0b('0x68')](_0x37331e);this[_0xaf0b('0x98')](_0x147982);return JSON[_0xaf0b('0x71')](_0x147982);}catch(_0x2eee90){return this[_0xaf0b('0x96')](_0x37331e);}};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x96')]=function(_0x673097){var _0x5d3b36=_0x673097[_0xaf0b('0xa0')]('{');for(var _0x5baa0a=0x1;_0x5baa0a<_0x5d3b36[_0xaf0b('0x9a')];_0x5baa0a+=0x1){var _0x2bfba1=_0x5d3b36[_0x5baa0a][_0xaf0b('0xa0')]('}');if(_0x2bfba1['length']>0x1){_0x673097=_0x673097['replaceAll']('{'+_0x2bfba1[0x0]+'}',this['channel'][_0xaf0b('0xa1')](_0x2bfba1[0x0])[_0xaf0b('0xa2')]||_0x2bfba1[0x0]);}}if(_0x5d3b36[_0xaf0b('0x9a')]===0x1){return _0x673097[_0xaf0b('0x4b')]();}return this[_0xaf0b('0x96')](_0x673097);};AGIVertices['prototype']['getAndSetVariable']=function(_0x56ef20,_0x22b98b){var _0x3c9df0=this[_0xaf0b('0xd')][_0xaf0b('0xa1')](_0x56ef20);if(_0x3c9df0[_0xaf0b('0xa3')]===-0x1){return _0x3c9df0;}logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0xa4'),_0x22b98b,_0x3c9df0[_0xaf0b('0xa2')]));return this['channel'][_0xaf0b('0x9e')](_0x22b98b,_0x3c9df0[_0xaf0b('0xa2')]);};AGIVertices['prototype']['isConfigured']=function(_0x543cfe){return _0x543cfe&&_0x543cfe!=='0'&&_0x543cfe!=='-1'&&_0x543cfe!=='';};AGIVertices[_0xaf0b('0xf')]['maxRetry']=function(_0x6092bc){this['createSquareDetailsReport']['sync'](this,_0x6092bc,'-');_0x6092bc[_0xaf0b('0xa5')]=_0x6092bc[_0xaf0b('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x430f76){logger['info'](util['format'](_0xaf0b('0xa7'),_0x430f76[_0xaf0b('0x36')]));if(!this['isConfigured'](_0x430f76[_0xaf0b('0x5c')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xa9'));}var _0x19f4ea='\x22'+_0x430f76[_0xaf0b('0x5c')]+'\x22';if(this[_0xaf0b('0x83')](_0x430f76[_0xaf0b('0xaa')])){_0x19f4ea+=','+_0x430f76['options'];}var _0x3ce1c0=this[_0xaf0b('0xd')][_0xaf0b('0x56')](_0xaf0b('0xab'),_0x19f4ea);if(_0x3ce1c0['result']===-0x1){return _0x3ce1c0;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0xac'),_0x19f4ea));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xad')]=function(_0x15f206){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0xae'),_0x15f206[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x15f206['grammar'])){return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0xaf'));}var _0x304092=_0x15f206['grammar'];if(this[_0xaf0b('0x83')](_0x15f206[_0xaf0b('0xaa')])){_0x304092+=','+_0x15f206[_0xaf0b('0xaa')];}var _0x443e35=this[_0xaf0b('0xd')]['exec'](_0xaf0b('0xb0'),_0x304092);if(_0x443e35[_0xaf0b('0xa3')]===-0x1){return _0x443e35;}var _0x26979b=this[_0xaf0b('0xb1')]('RECOG_CONFIDENCE()',_0xaf0b('0xb2'));if(_0x26979b[_0xaf0b('0xa3')]===-0x1){return _0x26979b;}var _0x2ad8a7=this['getAndSetVariable'](_0xaf0b('0xb3'),'MRCP_RECOG_TRANSCRIPT');if(_0x2ad8a7[_0xaf0b('0xa3')]===-0x1){return _0x2ad8a7;}var _0x54da9a=this[_0xaf0b('0xb1')](_0xaf0b('0xb4'),_0xaf0b('0xb5'));if(_0x54da9a[_0xaf0b('0xa3')]===-0x1){return _0x54da9a;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0xb6'),_0x304092));};AGIVertices[_0xaf0b('0xf')]['agi']=function(_0x3efef6){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0xb7'),_0x3efef6[_0xaf0b('0x36')]));return this[_0xaf0b('0xd')][_0xaf0b('0x7')]([_0x3efef6['command'],_0x3efef6[_0xaf0b('0xb8')]]);};AGIVertices['prototype'][_0xaf0b('0xb9')]=function(_0x5b901b){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0xba'),_0x5b901b[_0xaf0b('0x36')]));if(this[_0xaf0b('0x83')](_0x5b901b[_0xaf0b('0x64')])){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0xbb'),_0x5b901b[_0xaf0b('0x64')]));var _0xea8245=this[_0xaf0b('0xd')][_0xaf0b('0xbc')](_0x5b901b[_0xaf0b('0x64')]);if(_0xea8245['result']===-0x1){return _0xea8245;}}return this[_0xaf0b('0xd')][_0xaf0b('0xb9')]();};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x49')]=function(_0xd38f01){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0xbd'),_0xd38f01[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0xd38f01[_0xaf0b('0x47')])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0xd38f01,'no\x20list\x20selected');}_0xd38f01[_0xaf0b('0x48')]=moment();if(this[_0xaf0b('0x83')](_0xd38f01[_0xaf0b('0xbe')])){_0xd38f01['scheduledAt']=moment()[_0xaf0b('0xbf')](_0xd38f01['delay'],'minutes');}if(!this['isConfigured'](_0xd38f01[_0xaf0b('0xc0')])){_0xd38f01[_0xaf0b('0xc0')]=0x2;}this['createCmContact'][_0xaf0b('0xc1')](this,_0xd38f01);return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0xd38f01['phone'],_0xd38f01[_0xaf0b('0x47')],_0xd38f01['scheduledAt']));};AGIVertices[_0xaf0b('0xf')]['custom_app']=function(_0x5c8de4){logger['info'](util['format'](_0xaf0b('0xc2'),_0x5c8de4[_0xaf0b('0x36')]));var _0x1297d9=this['channel'][_0xaf0b('0x56')](_0x5c8de4[_0xaf0b('0xc3')],_0x5c8de4[_0xaf0b('0xaa')]);if(_0x1297d9[_0xaf0b('0xa3')]===-0x1){return _0x1297d9;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format']('Executed\x20command\x20%s\x20%s',_0x5c8de4[_0xaf0b('0xc3')],_0x5c8de4[_0xaf0b('0xaa')]));};AGIVertices[_0xaf0b('0xf')]['lumenvoxtts']=function(_0x98a5d3){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0xc4'),_0x98a5d3[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x98a5d3[_0xaf0b('0x5c')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')]('no\x20text\x20configured');}var _0x49edca='\x22'+_0x98a5d3[_0xaf0b('0x5c')]+'\x22';if(this['isConfigured'](_0x98a5d3[_0xaf0b('0xaa')])){_0x49edca+=','+_0x98a5d3['options'];}var _0x3d551b=this[_0xaf0b('0xd')][_0xaf0b('0x56')](_0xaf0b('0xab'),_0x49edca);if(_0x3d551b[_0xaf0b('0xa3')]===-0x1){return _0x3d551b;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0xac'),_0x49edca));};AGIVertices['prototype'][_0xaf0b('0xc5')]=function(_0x5bb93f){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5bb93f[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x5bb93f[_0xaf0b('0x5c')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')]('no\x20text\x20configured');}var _0x19b9b3='\x22'+_0x5bb93f[_0xaf0b('0x5c')]+'\x22';if(this[_0xaf0b('0x83')](_0x5bb93f['options'])){_0x19b9b3+=','+_0x5bb93f['options'];}var _0x3042a7=this['channel'][_0xaf0b('0x56')](_0xaf0b('0xab'),_0x19b9b3);if(_0x3042a7[_0xaf0b('0xa3')]===-0x1){return _0x3042a7;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format'](_0xaf0b('0xac'),_0x19b9b3));};AGIVertices['prototype'][_0xaf0b('0xc6')]=function(_0x5d038f){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x5d038f[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x5d038f[_0xaf0b('0xc7')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xaf'));}var _0x863398=_0x5d038f[_0xaf0b('0xc7')];if(this[_0xaf0b('0x83')](_0x5d038f[_0xaf0b('0xaa')])){_0x863398+=','+_0x5d038f[_0xaf0b('0xaa')];}var _0x4e540e=this[_0xaf0b('0xd')]['exec'](_0xaf0b('0xb0'),_0x863398);if(_0x4e540e[_0xaf0b('0xa3')]===-0x1){return _0x4e540e;}var _0x33edb2=this['getAndSetVariable'](_0xaf0b('0xc8'),_0xaf0b('0xc9'));if(_0x33edb2[_0xaf0b('0xa3')]===-0x1){return _0x33edb2;}var _0x24ea00=this[_0xaf0b('0xb1')](_0xaf0b('0xb3'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x24ea00[_0xaf0b('0xa3')]===-0x1){return _0x24ea00;}var _0x443afc=this['getAndSetVariable'](_0xaf0b('0xb4'),_0xaf0b('0xca'));if(_0x443afc['result']===-0x1){return _0x443afc;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format'](_0xaf0b('0xb6'),_0x863398));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xcb')]=function(_0x2aafa1){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0xcc'),_0x2aafa1[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x2aafa1[_0xaf0b('0xc7')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')]('no\x20grammar\x20configured');}var _0x989c3f=_0x2aafa1[_0xaf0b('0xc7')];if(this[_0xaf0b('0x83')](_0x2aafa1[_0xaf0b('0xaa')])){_0x989c3f+=','+_0x2aafa1[_0xaf0b('0xaa')];}var _0x25ed49=this[_0xaf0b('0xd')][_0xaf0b('0x56')](_0xaf0b('0xb0'),_0x989c3f);if(_0x25ed49['result']===-0x1){return _0x25ed49;}var _0x334d81=this['getAndSetVariable']('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x334d81[_0xaf0b('0xa3')]===-0x1){return _0x334d81;}var _0x47b5dd=this[_0xaf0b('0xb1')](_0xaf0b('0xb3'),_0xaf0b('0xcd'));if(_0x47b5dd[_0xaf0b('0xa3')]===-0x1){return _0x47b5dd;}var _0x223350=this[_0xaf0b('0xb1')](_0xaf0b('0xb4'),_0xaf0b('0xce'));if(_0x223350['result']===-0x1){return _0x223350;}return this[_0xaf0b('0xd')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x989c3f));};AGIVertices[_0xaf0b('0xf')]['database']=function(_0x13fbf4){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x13fbf4[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x13fbf4[_0xaf0b('0xcf')])){return this['channel'][_0xaf0b('0x2a')](_0x13fbf4,_0xaf0b('0xd0'));}var _0x38b9c6=this[_0xaf0b('0x16')][_0xaf0b('0xc1')](this,_0x13fbf4[_0xaf0b('0xcf')]);if(!_0x38b9c6){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x13fbf4,_0xaf0b('0xd1'));}if(!this[_0xaf0b('0x83')](_0x13fbf4[_0xaf0b('0x2e')])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x13fbf4,_0xaf0b('0xd2'));}var _0x64eb5=_0x13fbf4[_0xaf0b('0x2e')][_0xaf0b('0x58')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util['format'](_0xaf0b('0xd3'),_0x64eb5));var _0x4f8c4d=this['getQueryOdbc'][_0xaf0b('0xc1')](this,_0x38b9c6,_0x64eb5);this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0x13fbf4,_0x64eb5);if(!this['isConfigured'](_0x13fbf4[_0xaf0b('0xd4')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xd5'));}var _0x599abc=this[_0xaf0b('0xa1')]['sync'](this,_0x13fbf4[_0xaf0b('0xd4')]);if(!_0x599abc){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x13fbf4,_0xaf0b('0xd6'));}var _0x1e887e=this;_0x4f8c4d[_0xaf0b('0xd7')](function(_0x53a820,_0x31d5ad){Object[_0xaf0b('0xd8')](_0x53a820)[_0xaf0b('0xd7')](function(_0x2ae51c){_0x1e887e[_0xaf0b('0xd')][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0xd9'),_0x599abc,_0x31d5ad,_0x2ae51c),_0x53a820[_0x2ae51c]);});});this[_0xaf0b('0xd')][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0xda'),_0x599abc),_0x4f8c4d[_0xaf0b('0x9a')]);return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0xdb'),_0x599abc));};AGIVertices['prototype'][_0xaf0b('0xdc')]=function(_0xc2f35b){logger[_0xaf0b('0xdd')](util[_0xaf0b('0x29')](_0xaf0b('0xde'),_0xc2f35b[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0xc2f35b['sip_id'])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0xc2f35b,_0xaf0b('0xdf'));}var _0x1dcbbd=this[_0xaf0b('0x19')]['sync'](this,_0xc2f35b[_0xaf0b('0xe0')]);if(!_0x1dcbbd){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0xc2f35b,_0xaf0b('0xe1'));}var _0x87e133=this[_0xaf0b('0xd')][_0xaf0b('0x56')](_0xaf0b('0xe2'),[util[_0xaf0b('0x29')](_0xaf0b('0xe3'),_0x1dcbbd),_0xc2f35b[_0xaf0b('0x64')],_0xc2f35b['opts'],_0xc2f35b[_0xaf0b('0x6f')]]);if(_0x87e133[_0xaf0b('0xa3')]===-0x1){return _0x87e133;}return this[_0xaf0b('0xd')]['noop'](util['format']('Executed\x20command\x20%s',_0xaf0b('0xe2')));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xe4')]=function(_0x5d7e06){logger['info'](util[_0xaf0b('0x29')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5d7e06['label']));if(!this[_0xaf0b('0x83')](_0x5d7e06[_0xaf0b('0x77')])){return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0xe5'));}if(!this[_0xaf0b('0x83')](_0x5d7e06['text'])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')]('no\x20text\x20configured');}this['channel'][_0xaf0b('0xe6')]=!![];this[_0xaf0b('0x35')](_0x5d7e06);this[_0xaf0b('0x41')](_0x5d7e06[_0xaf0b('0x5c')],'in','','');this[_0xaf0b('0xd')]['noop'](util[_0xaf0b('0x29')](_0xaf0b('0xe7'),_0x5d7e06[_0xaf0b('0x5c')]));var _0x4195a9=this[_0xaf0b('0x76')][_0xaf0b('0xc1')](this,_0x5d7e06);if(_0x4195a9){for(var _0x326e32 in _0x4195a9){if(_0x4195a9[_0xaf0b('0x9c')](_0x326e32)){this[_0xaf0b('0xd')]['setVariable'](util[_0xaf0b('0x29')]('DIALOGFLOW_%s',_0x326e32['toUpperCase']()),_0x4195a9[_0x326e32]);}}this['createSquareMessage'](_0x4195a9['speech'],_0xaf0b('0xe8'),_0xaf0b('0xe4'),'');return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0xe9'),_0x4195a9[_0xaf0b('0xea')]));}return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x5d7e06,_0xaf0b('0xeb'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xec')]=function(_0x2e3c37){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0xed'),_0x2e3c37[_0xaf0b('0x36')]));if(!this['isConfigured'](_0x2e3c37[_0xaf0b('0x7a')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xee'));}if(!this['isConfigured'](_0x2e3c37[_0xaf0b('0xef')])){return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0xf0'));}if(!this[_0xaf0b('0x83')](_0x2e3c37['private_key'])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xf1'));}if(!this[_0xaf0b('0x83')](_0x2e3c37[_0xaf0b('0x7b')])){return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0xf2'));}if(!this[_0xaf0b('0x83')](_0x2e3c37[_0xaf0b('0x5c')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xa9'));}this[_0xaf0b('0xd')][_0xaf0b('0xe6')]=!![];this[_0xaf0b('0x35')](_0x2e3c37);this[_0xaf0b('0x41')](_0x2e3c37[_0xaf0b('0x5c')],'in','','');this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format'](_0xaf0b('0xf3'),_0x2e3c37[_0xaf0b('0x5c')]));var _0x1631eb=this[_0xaf0b('0x79')][_0xaf0b('0xc1')](this,_0x2e3c37);if(_0x1631eb){for(var _0x423213 in _0x1631eb){if(_0x1631eb[_0xaf0b('0x9c')](_0x423213)){if(_0x423213!==_0xaf0b('0xf4')){this['channel']['setVariable'](util[_0xaf0b('0x29')](_0xaf0b('0xf5'),_0x423213[_0xaf0b('0xf6')]()),_0x1631eb[_0x423213]);}}}this[_0xaf0b('0x41')](_0x1631eb[_0xaf0b('0xea')],'out','dialogflowV2',_0x1631eb[_0xaf0b('0xf4')]);return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format'](_0xaf0b('0xf7'),_0x1631eb[_0xaf0b('0xea')]));}return this['channel'][_0xaf0b('0x2a')](_0x2e3c37,_0xaf0b('0xf8'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xf9')]=function(_0x21626e){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0xfa'),_0x21626e['label']));if(!this[_0xaf0b('0x83')](_0x21626e[_0xaf0b('0xfb')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xfc'));}if(!this[_0xaf0b('0x83')](_0x21626e['username'])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x21626e[_0xaf0b('0xfd')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xfe'));}if(!this['isConfigured'](_0x21626e['ndassistant_url'])){return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0xa9'));}this[_0xaf0b('0xd')][_0xaf0b('0xe6')]=!![];this[_0xaf0b('0x35')](_0x21626e);this[_0xaf0b('0x41')](_0x21626e['text'],'in','','');this[_0xaf0b('0xd')]['noop'](util[_0xaf0b('0x29')](_0xaf0b('0xff'),_0x21626e[_0xaf0b('0x5c')]));var _0x5e8d27=this[_0xaf0b('0x7c')][_0xaf0b('0xc1')](this,_0x21626e);if(_0x5e8d27){for(var _0x962fc0 in _0x5e8d27){if(_0x5e8d27[_0xaf0b('0x9c')](_0x962fc0)){this[_0xaf0b('0xd')][_0xaf0b('0x9e')](util['format'](_0xaf0b('0x100'),_0x962fc0['toUpperCase']()),_0x5e8d27[_0x962fc0]);}}this[_0xaf0b('0x41')](_0x5e8d27[_0xaf0b('0xea')],_0xaf0b('0xe8'),_0xaf0b('0xf9'),'');if(_0x5e8d27[_0xaf0b('0x101')]){this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format'](_0xaf0b('0x102'),_0x5e8d27['audiofile']));var _0x96cc5d=this['channel'][_0xaf0b('0x103')](_0x5e8d27[_0xaf0b('0x101')]);try{fs[_0xaf0b('0x104')](_0x5e8d27['audiofile']+'.wav');}catch(_0x2bcf33){logger[_0xaf0b('0x2a')](_0x2bcf33);}return _0x96cc5d;}else{return this['channel']['noop'](util['format']('SestekNDA\x20Result\x20%s',_0x5e8d27[_0xaf0b('0xea')]));}}return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x21626e,_0xaf0b('0x105'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x106')]=function(_0x3a27cf){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x107'),_0x3a27cf['label']));return this['channel'][_0xaf0b('0xa8')](_0xaf0b('0x106'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x108')]=function(_0x1052e8){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x109'),_0x1052e8[_0xaf0b('0x36')]));var _0x4c8ae9='';if(_0x1052e8[_0xaf0b('0x10a')]){if(!this[_0xaf0b('0x83')](_0x1052e8[_0xaf0b('0x10a')])){return this['channel'][_0xaf0b('0x2a')](_0x1052e8,_0xaf0b('0x10b'));}else{var _0x3247b7=parseInt(_0x1052e8[_0xaf0b('0x10a')],0xa);if(isNaN(_0x3247b7)){_0x4c8ae9=_0x1052e8[_0xaf0b('0x10a')];}else{_0x4c8ae9=this[_0xaf0b('0x1b')]['sync'](this,_0x1052e8['trunk_id']);if(!_0x4c8ae9){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x1052e8,_0xaf0b('0x10c'));}}}}else if(_0x1052e8[_0xaf0b('0x10d')]){_0x4c8ae9=_0x1052e8['trunk_name'];}else{return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x1052e8,'no\x20trunk\x20selected');}var _0x250cfa=this['channel']['exec']('DIAL',[util[_0xaf0b('0x29')](_0xaf0b('0x10e'),_0x4c8ae9,_0x1052e8['phone']),_0x1052e8[_0xaf0b('0x64')],_0x1052e8[_0xaf0b('0x10f')],_0x1052e8[_0xaf0b('0x6f')]]);if(_0x250cfa['result']===-0x1){return _0x250cfa;}return this['channel'][_0xaf0b('0xa8')](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x110')]=function(_0x5ea2c8){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x111'),_0x5ea2c8[_0xaf0b('0x36')]));return this[_0xaf0b('0xd')][_0xaf0b('0xa8')]('finally');};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xb')]=function(_0x382cdd){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x112'),_0x382cdd[_0xaf0b('0x36')]));if(_0x382cdd['retry']===0x0){return this['maxRetry'](_0x382cdd);}_0x382cdd[_0xaf0b('0xa5')]-=0x1;if(!this[_0xaf0b('0x83')](_0x382cdd[_0xaf0b('0x113')])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x382cdd,_0xaf0b('0x114'));}var _0x5f5b39=this['getSound'][_0xaf0b('0xc1')](this,_0x382cdd[_0xaf0b('0x113')]);if(!_0x5f5b39){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x382cdd,_0xaf0b('0x115'));}if(!this[_0xaf0b('0x83')](_0x382cdd['variable_id'])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0xaf0b('0xd5'));}var _0x59636d=this['channel'][_0xaf0b('0x116')](_0x5f5b39,_0x382cdd[_0xaf0b('0x117')],_0x382cdd[_0xaf0b('0x118')]);var _0x27511d=_0x59636d['result']?_0x59636d['result'][_0xaf0b('0x4b')]():'';logger[_0xaf0b('0x2c')]('test',JSON[_0xaf0b('0x71')](_0x59636d));if(_0x59636d[_0xaf0b('0xa3')]===-0x1){this[_0xaf0b('0x35')]['sync'](this,_0x382cdd,_0x27511d);return _0x59636d;}else if(_0x59636d['extra']===_0xaf0b('0x64')){_0x59636d[_0xaf0b('0xa3')]=_0x27511d[_0xaf0b('0x9a')]>=parseInt(_0x382cdd['mindigit'])?'x':'i';}else{_0x59636d[_0xaf0b('0xa3')]=_0x27511d[_0xaf0b('0x9a')]>=parseInt(_0x382cdd[_0xaf0b('0x119')])&&_0x27511d['length']<=parseInt(_0x382cdd[_0xaf0b('0x118')])?'x':'i';}var _0x2c84d6=this['getVariable'][_0xaf0b('0xc1')](this,_0x382cdd[_0xaf0b('0xd4')]);if(!_0x2c84d6){return this[_0xaf0b('0xd')]['error'](_0x382cdd,'no\x20variable\x20found');}this[_0xaf0b('0xd')][_0xaf0b('0x9e')](_0x2c84d6,_0x27511d);if(this[_0xaf0b('0x83')](_0x382cdd[_0xaf0b('0x11a')])){var _0x5dd16c=parseInt(_0x382cdd[_0xaf0b('0x11a')],0xa);var _0x58f374=rs['generate']({'charset':'*','length':_0x5dd16c});var _0x221e02=_0x27511d['length'];if(_0x221e02>0x0){if(_0x221e02>_0x5dd16c){this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0x382cdd,_0x382cdd[_0xaf0b('0x11b')]===_0xaf0b('0x11c')?_0x58f374+_0x27511d['substr'](_0x5dd16c):_0x27511d['substr'](0x0,_0x221e02-_0x5dd16c)+_0x58f374);}else{this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0x382cdd,rs[_0xaf0b('0x11d')]({'charset':'*','length':_0x221e02}));}}else{this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0x382cdd,'');}}else{this['createSquareDetailsReport'][_0xaf0b('0xc1')](this,_0x382cdd,_0x27511d);}return _0x59636d;};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xc')]=function(_0x4ae148){logger['info'](util['format'](_0xaf0b('0x11e'),_0x4ae148['label']));return this[_0xaf0b('0xb')](_0x4ae148);};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x11f')]=function(_0xabc144){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0xabc144[_0xaf0b('0x36')]));this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0xabc144,_0xabc144['goalname']);return this[_0xaf0b('0xd')]['noop'](util[_0xaf0b('0x29')]('GOAL\x20%s',_0xabc144[_0xaf0b('0x120')]));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x121')]=function(_0x33b66a){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x122'),_0x33b66a['label']));if(!this['isConfigured'](_0x33b66a[_0xaf0b('0x86')])||!this['isConfigured'](_0x33b66a[_0xaf0b('0x87')])){return this['channel'][_0xaf0b('0xa8')](_0xaf0b('0x123'));}if(!this[_0xaf0b('0x83')](_0x33b66a[_0xaf0b('0x5c')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xa9'));}this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x124'),_0x33b66a[_0xaf0b('0x5c')]));var _0x7f3c2f=this[_0xaf0b('0x85')][_0xaf0b('0xc1')](this,_0x33b66a);if(_0x7f3c2f){this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format'](_0xaf0b('0x125'),_0x7f3c2f));var _0x2f8067=this[_0xaf0b('0xd')][_0xaf0b('0x103')](_0x7f3c2f);try{fs[_0xaf0b('0x104')](_0x7f3c2f+_0xaf0b('0x126'));}catch(_0x5cfb13){logger[_0xaf0b('0x2a')](_0x5cfb13);}return _0x2f8067;}return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x33b66a,_0xaf0b('0x127'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x128')]=function(_0x4b630d){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x129'),_0x4b630d[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x4b630d[_0xaf0b('0x86')])||!this[_0xaf0b('0x83')](_0x4b630d['aws_secret_access_key'])){return this[_0xaf0b('0xd')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xaf0b('0x83')](_0x4b630d['aws_bot_name'])){return this[_0xaf0b('0xd')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0xaf0b('0x83')](_0x4b630d['text'])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0xa9'));}this[_0xaf0b('0xd')][_0xaf0b('0xe6')]=!![];this[_0xaf0b('0x35')](_0x4b630d);this[_0xaf0b('0x41')](_0x4b630d[_0xaf0b('0x5c')],'in','','');this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x12a'),_0x4b630d[_0xaf0b('0x5c')]));var _0x237b41=this[_0xaf0b('0x8c')][_0xaf0b('0xc1')](this,_0x4b630d);if(_0x237b41){for(var _0x4f4b03 in _0x237b41){if(_0x237b41[_0xaf0b('0x9c')](_0x4f4b03)&&_[_0xaf0b('0x95')](_0x237b41[_0x4f4b03])){this[_0xaf0b('0xd')][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0x12b'),_0x4f4b03[_0xaf0b('0xf6')]()),_0x237b41[_0x4f4b03]);}}if(_[_0xaf0b('0x4f')](_0x237b41['message'])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0x12c'));}else{this['createSquareMessage'](_0x237b41['message'],'out',_0xaf0b('0x12d'),'');return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x12e'),_0x237b41[_0xaf0b('0x74')]));}}return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x4b630d,_0xaf0b('0x12f'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x130')]=function(_0x2a158c){logger['info'](util[_0xaf0b('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x2a158c[_0xaf0b('0x36')],_0x2a158c[_0xaf0b('0x64')]));if(!this['isConfigured'](_0x2a158c['key'])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')]('no\x20key\x20configured');}var _0x5a8d3f=_0xaf0b('0x131');var _0x24121a=util[_0xaf0b('0x29')](_0xaf0b('0x132'),FILES_PATH,rs[_0xaf0b('0x11d')](0x4));var _0x1a946b=util[_0xaf0b('0x29')](_0xaf0b('0x9d'),_0x24121a,_0x5a8d3f);var _0x12aa89=!![];if(_0x2a158c['beep']===_0xaf0b('0x133')){_0x12aa89=![];}var _0x44c532=this[_0xaf0b('0xd')]['recordFile'](_0x24121a,_0x5a8d3f,_0x2a158c[_0xaf0b('0x134')],_0x2a158c[_0xaf0b('0x64')],undefined,_0x12aa89);if(_0x44c532[_0xaf0b('0xa3')]!==-0x1){this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x135'),_0x1a946b));var _0x59653e=this['googleASR'][_0xaf0b('0xc1')](this,_0x2a158c,_0x1a946b);if(_0x59653e){for(var _0xceb92 in _0x59653e){if(_0x59653e[_0xaf0b('0x9c')](_0xceb92)){this['channel'][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0x136'),_0xceb92[_0xaf0b('0xf6')]()),_0x59653e[_0xceb92]);}}return this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x59653e)));}}return _0x44c532;};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x137')]=function(_0x524651){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x138'),_0x524651[_0xaf0b('0x36')]));if(!this['isConfigured'](_0x524651[_0xaf0b('0x91')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0x139'));}if(!this[_0xaf0b('0x83')](_0x524651[_0xaf0b('0x13a')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0x13b'));}var _0x17e33d=_0xaf0b('0x131');var _0x199617=util[_0xaf0b('0x29')](_0xaf0b('0x132'),FILES_PATH,rs[_0xaf0b('0x11d')](0x4));var _0x281cea=util['format'](_0xaf0b('0x9d'),_0x199617,_0x17e33d);var _0x59694a=!![];if(_0x524651[_0xaf0b('0x13c')]==='NOBEEP'){_0x59694a=![];}var _0x18c7c9=this[_0xaf0b('0xd')][_0xaf0b('0x13d')](_0x199617,_0x17e33d,_0x524651['intKey'],_0x524651[_0xaf0b('0x64')],undefined,_0x59694a);if(_0x18c7c9[_0xaf0b('0xa3')]!==-0x1){this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x13e'),_0x281cea));var _0x47270d=this[_0xaf0b('0x13f')][_0xaf0b('0xc1')](this,_0x524651,_0x281cea);if(_0x47270d){for(var _0x51d450 in _0x47270d){if(_0x47270d['hasOwnProperty'](_0x51d450)){this[_0xaf0b('0xd')][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0x140'),_0x51d450[_0xaf0b('0xf6')]()),_0x47270d[_0x51d450]);}}return this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x141'),JSON[_0xaf0b('0x71')](_0x47270d)));}}return _0x18c7c9;};AGIVertices['prototype'][_0xaf0b('0x142')]=function(_0x344cbe){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x143'),_0x344cbe[_0xaf0b('0x36')]));return this[_0xaf0b('0xd')][_0xaf0b('0x144')](_0x344cbe[_0xaf0b('0x3c')],_0x344cbe['extension'],_0x344cbe[_0xaf0b('0x3e')]);};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x145')]=function(_0x27cf00){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x146'),_0x27cf00[_0xaf0b('0x36')]));if(!this['isConfigured'](_0x27cf00['condition'])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x27cf00,_0xaf0b('0x147'));}try{var _0x1ec4a3=eval(_0x27cf00['condition'])?_0xaf0b('0x148'):'false';this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x27cf00[_0xaf0b('0x149')],_0x1ec4a3));return{'code':0xc8,'result':_0x1ec4a3};}catch(_0x127f23){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0xaf0b('0x14a')]=function(_0x26d341){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x14b'),_0x26d341['label']));if(!this[_0xaf0b('0x83')](_0x26d341[_0xaf0b('0x14c')])){return this[_0xaf0b('0xd')]['error'](_0x26d341,_0xaf0b('0x14d'));}var _0x287f90=this['getIntervals'][_0xaf0b('0xc1')](this,_0x26d341[_0xaf0b('0x14c')]);if(!_0x287f90){return this[_0xaf0b('0xd')]['error'](_0x26d341,'no\x20intervals\x20found');}for(var _0x52d7e1=0x0;_0x52d7e1<_0x287f90[_0xaf0b('0x9a')];_0x52d7e1+=0x1){var _0x45a5ca=this[_0xaf0b('0xd')][_0xaf0b('0xa1')](util[_0xaf0b('0x29')](_0xaf0b('0x14e'),_0x287f90[_0x52d7e1]));if(_0x45a5ca[_0xaf0b('0xa3')]===-0x1){return _0x45a5ca;}logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x14f'),_0x287f90[_0x52d7e1],_0x45a5ca['extra']));if(_0x45a5ca[_0xaf0b('0xa2')]===_0xaf0b('0x148')){logger['info'](util['format'](_0xaf0b('0x14f'),_0x287f90[_0x52d7e1],_0xaf0b('0x148')));this[_0xaf0b('0xd')]['noop'](util[_0xaf0b('0x29')](_0xaf0b('0x14f'),_0x287f90[_0x52d7e1],_0xaf0b('0x148')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x14f'),_0x287f90[_0x52d7e1],_0xaf0b('0x150')));this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x14f'),_0x287f90[_0x52d7e1],_0xaf0b('0x150')));}}return{'code':0xc8,'result':_0xaf0b('0x150')};};AGIVertices[_0xaf0b('0xf')]['hangup']=function(_0x10ac3a){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0x151'),_0x10ac3a[_0xaf0b('0x36')]));return this[_0xaf0b('0xd')][_0xaf0b('0x152')]();};AGIVertices[_0xaf0b('0xf')]['ispeechasr']=function(_0x396d7c){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x153'),_0x396d7c['label']));if(!this[_0xaf0b('0x83')](_0x396d7c['key'])){return this['channel'][_0xaf0b('0xa8')](_0xaf0b('0xe5'));}var _0xb8bbfc=_0xaf0b('0x131');var _0x1ad010=util[_0xaf0b('0x29')](_0xaf0b('0x132'),FILES_PATH,rs[_0xaf0b('0x11d')](0x4));var _0x3f58be=util[_0xaf0b('0x29')](_0xaf0b('0x9d'),_0x1ad010,_0xb8bbfc);var _0x259392=!![];if(_0x396d7c[_0xaf0b('0x13c')]===_0xaf0b('0x133')){_0x259392=![];}var _0x874f5a=this[_0xaf0b('0xd')][_0xaf0b('0x13d')](_0x1ad010,_0xb8bbfc,_0x396d7c[_0xaf0b('0x134')],_0x396d7c['timeout'],undefined,_0x259392);if(_0x874f5a[_0xaf0b('0xa3')]!==-0x1){this[_0xaf0b('0xd')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x3f58be));var _0x24b8aa=this[_0xaf0b('0x81')]['sync'](this,_0x396d7c,_0x3f58be);if(_0x24b8aa){for(var _0x1a9126 in _0x24b8aa){if(_0x24b8aa['hasOwnProperty'](_0x1a9126)){this[_0xaf0b('0xd')]['setVariable'](util[_0xaf0b('0x29')](_0xaf0b('0x154'),_0x1a9126[_0xaf0b('0xf6')]()),_0x24b8aa[_0x1a9126]);}}return this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x155'),JSON['stringify'](_0x24b8aa)));}}return _0x874f5a;};AGIVertices['prototype'][_0xaf0b('0x156')]=function(_0x25e80d){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x157'),_0x25e80d[_0xaf0b('0x36')]));if(!this['isConfigured'](_0x25e80d[_0xaf0b('0x77')])){return this['channel'][_0xaf0b('0xa8')]('no\x20key\x20configured');}if(!this[_0xaf0b('0x83')](_0x25e80d['text'])){return this['channel'][_0xaf0b('0xa8')](_0xaf0b('0xa9'));}this[_0xaf0b('0xd')]['noop'](util[_0xaf0b('0x29')]('Trying\x20ispeech\x20TTS\x20%s',_0x25e80d[_0xaf0b('0x5c')]));var _0x4f5060=this[_0xaf0b('0x7d')][_0xaf0b('0xc1')](this,_0x25e80d);if(_0x4f5060){this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x158'),_0x4f5060));var _0x445f25=this[_0xaf0b('0xd')][_0xaf0b('0x103')](_0x4f5060,_0x25e80d[_0xaf0b('0x134')]);try{fs[_0xaf0b('0x104')](_0x4f5060+_0xaf0b('0x126'));}catch(_0x3676a7){logger[_0xaf0b('0x2a')](_0x3676a7);}return _0x445f25;}return this['channel'][_0xaf0b('0x2a')](_0x25e80d,_0xaf0b('0x159'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x15a')]=function(_0x383d17){logger['info'](util['format'](_0xaf0b('0x15b'),_0x383d17[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x383d17['findBy'])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x383d17,_0xaf0b('0x15c'));}logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x15d'),this['channel']['callerid'],_0x383d17['findBy']));var _0x4b6358=this['agentLogin'][_0xaf0b('0xc1')](this,_0x383d17[_0xaf0b('0x15e')]);if(_0x4b6358){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x15f'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x383d17[_0xaf0b('0x15e')]));this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x383d17[_0xaf0b('0x15e')]));return{'code':0xc8,'result':_0xaf0b('0x160')};}else{logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x161'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x383d17[_0xaf0b('0x15e')]));this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x161'),this[_0xaf0b('0xd')]['callerid'],_0x383d17[_0xaf0b('0x15e')]));return{'code':0xc8,'result':_0xaf0b('0x162')};}};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x163')]=function(_0x9aa0f){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x164'),_0x9aa0f[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x9aa0f['findBy'])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x9aa0f,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0xaf0b('0x15d'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x9aa0f[_0xaf0b('0x15e')]));var _0x3cbaf0=this['agentLogout'][_0xaf0b('0xc1')](this,_0x9aa0f[_0xaf0b('0x15e')]);if(_0x3cbaf0){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x15f'),this['channel']['callerid'],_0x9aa0f[_0xaf0b('0x15e')]));this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x15f'),this['channel'][_0xaf0b('0x38')],_0x9aa0f[_0xaf0b('0x15e')]));return{'code':0xc8,'result':_0xaf0b('0x160')};}else{logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xaf0b('0xd')]['callerid'],_0x9aa0f[_0xaf0b('0x15e')]));this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x161'),this['channel'][_0xaf0b('0x38')],_0x9aa0f[_0xaf0b('0x15e')]));return{'code':0xc8,'result':_0xaf0b('0x162')};}};AGIVertices[_0xaf0b('0xf')]['math']=function(_0x30260a){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x165'),_0x30260a[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x30260a[_0xaf0b('0x166')])){return this[_0xaf0b('0xd')]['error'](_0x30260a,_0xaf0b('0x167'));}this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x168'),_0x30260a['operation']));var _0x535ad8=eval(_0x30260a['operation']);if(!this[_0xaf0b('0x83')](_0x30260a[_0xaf0b('0xd4')])){return this['channel'][_0xaf0b('0xa8')](_0xaf0b('0xd5'));}var _0x5f2285=this[_0xaf0b('0xa1')][_0xaf0b('0xc1')](this,_0x30260a[_0xaf0b('0xd4')]);if(!_0x5f2285){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x30260a,_0xaf0b('0xd6'));}if(_[_0xaf0b('0x99')](_0x535ad8)){var _0x3196b7=this;_0x535ad8[_0xaf0b('0xd7')](function(_0x59d4ae,_0x300466){_0x3196b7[_0xaf0b('0xd')][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0x169'),_0x5f2285,_0x300466),_0x59d4ae);});return this[_0xaf0b('0xd')]['noop'](util[_0xaf0b('0x29')](_0xaf0b('0x16a'),_0x5f2285));}else{return this[_0xaf0b('0xd')][_0xaf0b('0x9e')](_0x5f2285,_0x535ad8);}};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0xa')]=function(_0x1fdb0d){logger['info'](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x1fdb0d[_0xaf0b('0x36')]));if(_0x1fdb0d[_0xaf0b('0xa5')]===0x0){return this[_0xaf0b('0xa6')](_0x1fdb0d);}_0x1fdb0d[_0xaf0b('0xa5')]-=0x1;if(!this[_0xaf0b('0x83')](_0x1fdb0d['file_id'])){return this[_0xaf0b('0xd')]['error'](_0x1fdb0d,_0xaf0b('0x114'));}var _0x17ec96=this['getSound'][_0xaf0b('0xc1')](this,_0x1fdb0d[_0xaf0b('0x113')]);if(!_0x17ec96){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x1fdb0d,_0xaf0b('0x115'));}var _0x4f18b8=this['channel'][_0xaf0b('0x116')](_0x17ec96,_0x1fdb0d['response'],_0x1fdb0d['digit']);var _0x53005a=_0x4f18b8[_0xaf0b('0xa3')];if(_0x4f18b8[_0xaf0b('0xa3')]===-0x1){this['createSquareDetailsReport'][_0xaf0b('0xc1')](this,_0x1fdb0d,'-1');return _0x4f18b8;}else if(_0x4f18b8[_0xaf0b('0xa2')]===_0xaf0b('0x64')){_0x4f18b8[_0xaf0b('0xa3')]=_0x4f18b8[_0xaf0b('0xa3')]['length']>0x0?_0x4f18b8[_0xaf0b('0xa3')]:'t';}else if(_[_0xaf0b('0x43')](_0x4f18b8[_0xaf0b('0xa3')])){_0x4f18b8[_0xaf0b('0xa3')]='#';_0x53005a='#';}if(!this[_0xaf0b('0x83')](_0x1fdb0d[_0xaf0b('0xd4')])){this['channel'][_0xaf0b('0xa8')](_0xaf0b('0xd5'));}else{var _0x4c1b05=this[_0xaf0b('0xa1')]['sync'](this,_0x1fdb0d[_0xaf0b('0xd4')]);if(!_0x4c1b05){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x1fdb0d,'no\x20variable\x20found');}this[_0xaf0b('0xd')][_0xaf0b('0x9e')](_0x4c1b05,_0x53005a);}this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0x1fdb0d,_0x53005a);return _0x4f18b8;};AGIVertices['prototype'][_0xaf0b('0xa8')]=function(_0x46907a){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x16b'),_0x46907a['label']));return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0x46907a[_0xaf0b('0x16c')]||_0x46907a[_0xaf0b('0x36')]);};AGIVertices['prototype'][_0xaf0b('0x16d')]=function(_0x5d03b1){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x16e'),_0x5d03b1[_0xaf0b('0x36')]));if(!this['isConfigured'](_0x5d03b1[_0xaf0b('0x15e')])){return this['channel'][_0xaf0b('0x2a')](_0x5d03b1,_0xaf0b('0x15c'));}logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x15d'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x5d03b1[_0xaf0b('0x15e')]));var _0x33bdef=this['getPause']['sync'](this,_0x5d03b1[_0xaf0b('0x16f')]);var _0x542f73=this[_0xaf0b('0x4e')][_0xaf0b('0xc1')](this,_0x5d03b1[_0xaf0b('0x15e')],_0x33bdef);if(_0x542f73){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0x15f'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x5d03b1['findBy']));this['channel'][_0xaf0b('0xa8')](util['format'](_0xaf0b('0x15f'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x5d03b1['findBy']));return{'code':0xc8,'result':_0xaf0b('0x160')};}else{logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x161'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x5d03b1[_0xaf0b('0x15e')]));this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x5d03b1[_0xaf0b('0x15e')]));return{'code':0xc8,'result':_0xaf0b('0x162')};}};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x170')]=function(_0x5a1481){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0x171'),_0x5a1481[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x5a1481[_0xaf0b('0x113')])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x5a1481,'no\x20file\x20audio\x20selected');}var _0x2a1e74=this[_0xaf0b('0x1d')][_0xaf0b('0xc1')](this,_0x5a1481[_0xaf0b('0x113')]);if(!_0x2a1e74){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x5a1481,'no\x20file\x20audio\x20found');}var _0x3f4db0=this[_0xaf0b('0xd')][_0xaf0b('0x56')]('PLAYBACK',[_0x2a1e74,_0x5a1481[_0xaf0b('0x10f')]]);if(_0x3f4db0[_0xaf0b('0xa3')]===-0x1){return _0x3f4db0;}return this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x172'),'PLAYBACK',_0x2a1e74));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x173')]=function(_0x1183af){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x1183af[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x1183af[_0xaf0b('0x174')])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x1183af,_0xaf0b('0x175'));}var _0x49ff5d='';var _0x2b0b10=parseInt(_0x1183af['queue_id'],0xa);if(isNaN(_0x2b0b10)){_0x49ff5d=_0x1183af[_0xaf0b('0x174')];}else{_0x49ff5d=this[_0xaf0b('0x176')]['sync'](this,_0x1183af['queue_id']);if(!_0x49ff5d){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x1183af,'no\x20queue\x20found');}}var _0x1d2dd3='';if(this[_0xaf0b('0x83')](_0x1183af[_0xaf0b('0x113')])){var _0x49cf0a=this[_0xaf0b('0x1d')][_0xaf0b('0xc1')](this,_0x1183af[_0xaf0b('0x113')]);if(_0x49cf0a){_0x1d2dd3=_0x49cf0a;}}this['createSquareDetailsReport'][_0xaf0b('0xc1')](this,_0x1183af,_0x49ff5d);if(_0x1183af[_0xaf0b('0x10f')]['indexOf']('x')<0x0){_0x1183af[_0xaf0b('0x10f')]+='x';}if(_0x1183af[_0xaf0b('0x10f')]['indexOf']('X')<0x0){_0x1183af[_0xaf0b('0x10f')]+='X';}this['channel'][_0xaf0b('0x9e')](_0xaf0b('0x177'),_0x49ff5d?_0x49ff5d[_0xaf0b('0x178')]():'');var _0x1084b8=this[_0xaf0b('0xd')]['exec'](_0xaf0b('0x179'),[_0x49ff5d,_0x1183af[_0xaf0b('0x10f')],_0x1183af['url'],_0x1d2dd3,_0x1183af[_0xaf0b('0x64')],_0x1183af[_0xaf0b('0x7')],_0x1183af[_0xaf0b('0x17a')],_0x1183af['gosub'],'',_0x1183af[_0xaf0b('0x17b')]]);if(_0x1084b8[_0xaf0b('0xa3')]===-0x1){return _0x1084b8;}return this[_0xaf0b('0xd')]['noop'](util['format'](_0xaf0b('0x172'),_0xaf0b('0x179'),_0x49ff5d));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x17c')]=function(_0x4a8e65){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x17d'),_0x4a8e65[_0xaf0b('0x36')]));var _0x43f5e8=_0x4a8e65['recordingFormat']||_0xaf0b('0x131');var _0x107afd=util[_0xaf0b('0x29')](_0xaf0b('0x17e'),this[_0xaf0b('0xd')][_0xaf0b('0x3a')],rs[_0xaf0b('0x11d')](0x5));var _0x43df5a=util[_0xaf0b('0x29')]('%s/recordings/%s.%s',FILES_PATH,_0x107afd,_0x43f5e8);var _0x2375b2=util['format'](_0xaf0b('0x132'),FILES_PATH,_0x107afd);this['createSquareRecording'][_0xaf0b('0xc1')](this,_0x4a8e65,_0x107afd,_0x43df5a);this[_0xaf0b('0xd')][_0xaf0b('0x9e')]('RECORDING_SAVENAME',_0x107afd);logger[_0xaf0b('0x2c')](_0xaf0b('0x17f'),_0x2375b2,_0x43f5e8,_0x4a8e65['escape_digits'],_0x4a8e65[_0xaf0b('0x64')]);return this['channel'][_0xaf0b('0x13d')](_0x2375b2,_0x43f5e8,_0x4a8e65[_0xaf0b('0x180')],_0x4a8e65['timeout'],undefined,!![]);};AGIVertices[_0xaf0b('0xf')]['restapi']=function(_0x508362){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x181'),_0x508362['label']));if(!this[_0xaf0b('0x83')](_0x508362[_0xaf0b('0x6f')])){return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0x182'));}var _0xf1cef9=this[_0xaf0b('0x61')][_0xaf0b('0xc1')](this,_0x508362);logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x183'),util[_0xaf0b('0x184')](_0xf1cef9,{'showHidden':![],'depth':null})));if(!this[_0xaf0b('0x83')](_0x508362['variable_id'])){return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0x185'));}var _0x4f22f0=this[_0xaf0b('0xa1')][_0xaf0b('0xc1')](this,_0x508362[_0xaf0b('0xd4')]);if(!_0x4f22f0){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x508362,_0xaf0b('0xd6'));}this[_0xaf0b('0xd')][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0x186'),_0x4f22f0),_0xf1cef9['statusCode']?_0xf1cef9['statusCode']:_0xaf0b('0x187'));this[_0xaf0b('0xd')][_0xaf0b('0x9e')](util[_0xaf0b('0x29')](_0xaf0b('0x188'),_0x4f22f0),_0xf1cef9[_0xaf0b('0x73')]?_0xf1cef9[_0xaf0b('0x73')]:'OK');if(_0xf1cef9[_0xaf0b('0x67')]){try{this[_0xaf0b('0x9b')](_0xf1cef9[_0xaf0b('0x67')],_0x4f22f0);}catch(_0x3bcb62){logger['error'](util[_0xaf0b('0x29')](_0xaf0b('0x189'),_0x4f22f0));}}return this['channel'][_0xaf0b('0xa8')](util['format'](_0xaf0b('0xdb'),_0x4f22f0));};AGIVertices[_0xaf0b('0xf')]['saydigits']=function(_0x51a627){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x18a'),_0x51a627['label']));return this['channel']['sayDigits'](_0x51a627[_0xaf0b('0x18b')]['replace'](/\s+/g,''),_0x51a627[_0xaf0b('0x180')]);};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x18c')]=function(_0x847437){logger['info'](util['format'](_0xaf0b('0x18d'),_0x847437[_0xaf0b('0x36')]));return this[_0xaf0b('0xd')][_0xaf0b('0x18e')](_0x847437[_0xaf0b('0x63')]['replace'](/\s+/g,''),_0x847437[_0xaf0b('0x180')]);};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x18f')]=function(_0x544cbb){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x190'),_0x544cbb['label']));return this['channel']['sayPhonetic'](_0x544cbb[_0xaf0b('0x5c')],_0x544cbb[_0xaf0b('0x180')]);};AGIVertices[_0xaf0b('0xf')]['sendMail']=function(_0xc9e164){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x191'),_0xc9e164['label']));if(!this[_0xaf0b('0x83')](_0xc9e164[_0xaf0b('0x192')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0x193'));}var _0x14e2c9=this['getMailAccount'][_0xaf0b('0xc1')](this,_0xc9e164[_0xaf0b('0x192')]);if(!_0x14e2c9||!_0x14e2c9[_0xaf0b('0x194')]){return this[_0xaf0b('0xd')]['error'](_0xc9e164,_0xaf0b('0x195'));}var _0x46e593={'from':util[_0xaf0b('0x29')](_0xaf0b('0x196'),_0x14e2c9[_0xaf0b('0x11')],_0x14e2c9['email']||_0x14e2c9[_0xaf0b('0x194')]['user']),'to':_0xc9e164['to']||'','cc':_0xc9e164['cc']||'','bcc':_0xc9e164[_0xaf0b('0x197')]||'','subject':_0xc9e164[_0xaf0b('0x198')],'html':_0xc9e164[_0xaf0b('0x5c')],'text':_0xc9e164[_0xaf0b('0x5c')]};if(this[_0xaf0b('0x83')](_0xc9e164[_0xaf0b('0x199')])){}logger[_0xaf0b('0xdd')](_0xaf0b('0x19a'),JSON[_0xaf0b('0x71')](_0x46e593));this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0xc9e164,_0xc9e164[_0xaf0b('0x192')]);this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x14e2c9['name']));this[_0xaf0b('0x22')][_0xaf0b('0xc1')](this,_0x14e2c9[_0xaf0b('0x19b')],_0x46e593);return this[_0xaf0b('0xd')]['noop'](_0xaf0b('0x19c'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x19d')]=function(_0x3d4fa9){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x19e'),_0x3d4fa9[_0xaf0b('0x36')]));return this['channel'][_0xaf0b('0xa8')](_0xaf0b('0x19f'));};AGIVertices[_0xaf0b('0xf')]['sendSMS']=function(_0x57f536){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x1a0'),_0x57f536[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x57f536[_0xaf0b('0x1a1')])){return this['channel'][_0xaf0b('0xa8')](_0xaf0b('0x1a2'));}var _0x51043a=this[_0xaf0b('0x32')][_0xaf0b('0xc1')](this,_0x57f536['sms_account_id']);if(!_0x51043a){return this['channel'][_0xaf0b('0x2a')](_0x57f536,_0xaf0b('0x1a3'));}var _0xaef96a={'body':_0x57f536[_0xaf0b('0x1a4')],'phone':_0x57f536['to']||'','SmsAccountId':_0x51043a['id']};logger[_0xaf0b('0xdd')](_0xaf0b('0x1a5'),JSON['stringify'](_0xaef96a));this[_0xaf0b('0x35')][_0xaf0b('0xc1')](this,_0x57f536,_0x57f536[_0xaf0b('0x1a1')]);this['channel'][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x1a6'),_0x51043a['name']));this['createSmsMessage'][_0xaf0b('0xc1')](this,_0xaef96a);return this['channel'][_0xaf0b('0xa8')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x1a7')]=function(_0x2dc10a){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x2dc10a[_0xaf0b('0x36')]));if(!this[_0xaf0b('0x83')](_0x2dc10a[_0xaf0b('0xd4')])){return this['channel'][_0xaf0b('0x2a')](_0x2dc10a,_0xaf0b('0x1a8'));}var _0x3a3bf8=this[_0xaf0b('0xa1')]['sync'](this,_0x2dc10a[_0xaf0b('0xd4')]);if(!_0x3a3bf8){return this[_0xaf0b('0xd')]['error'](_0x2dc10a,_0xaf0b('0xd6'));}return this[_0xaf0b('0xd')][_0xaf0b('0x9e')](_0x3a3bf8,_0x2dc10a[_0xaf0b('0x1a9')]);};AGIVertices['prototype'][_0xaf0b('0x1aa')]=function(_0x82e186){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x1ab'),_0x82e186[_0xaf0b('0x36')]));this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0x1ac'));var _0x392f6c=this['channel'][_0xaf0b('0xa1')](_0xaf0b('0x1ad'));if(!_[_0xaf0b('0x43')](_0x392f6c[_0xaf0b('0xa2')])){this[_0xaf0b('0xd')][_0xaf0b('0x3a')]=_0x392f6c[_0xaf0b('0xa2')];}if(_0x82e186[_0xaf0b('0xb9')]==='yes'){this[_0xaf0b('0xd')]['noop']('Answer');return this[_0xaf0b('0xd')][_0xaf0b('0xb9')]();}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0x1ae'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x1af')]=function(_0x39aeb0){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0x1b0'),_0x39aeb0['label']));if(!this['isConfigured'](_0x39aeb0['project_id'])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x39aeb0,'no\x20subproject\x20selected');}var _0x5d4986=this[_0xaf0b('0x14')][_0xaf0b('0xc1')](this,_0x39aeb0[_0xaf0b('0x1b1')]);if(!this['isConfigured'](_0x5d4986)){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x39aeb0,util[_0xaf0b('0x29')](_0xaf0b('0x1b2'),_0x39aeb0[_0xaf0b('0x1b1')]));}if(_0x5d4986===this['channel'][_0xaf0b('0x37')]){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x39aeb0,_0xaf0b('0x1b3'));}this['createSquareDetailsReport']['sync'](this,_0x39aeb0,_0x5d4986);var _0x533412=this['channel'][_0xaf0b('0x56')](_0xaf0b('0x1b4'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xaf0b('0x7')][_0xaf0b('0x1b5')]||_0xaf0b('0x1b6'),_0x5d4986,this[_0xaf0b('0xd')]['arg_1']));if(_0x533412[_0xaf0b('0xa3')]===-0x1){return _0x533412;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format']('Executed\x20command\x20%s\x20%s','AGI',_0x5d4986));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x1b7')]=function(_0x27c175){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x1b8'),_0x27c175[_0xaf0b('0x36')]));var _0x340b24=this[_0xaf0b('0x55')][_0xaf0b('0xc1')](this,_0x27c175[_0xaf0b('0x1b9')]);this['createSquareDetailsReport'][_0xaf0b('0xc1')](this,_0x27c175,_0x27c175[_0xaf0b('0x1b9')]);if(this['isConfigured'](_0x27c175['variable_id'])){var _0x1bfa6e=this[_0xaf0b('0xa1')]['sync'](this,_0x27c175[_0xaf0b('0xd4')]);if(_0x1bfa6e){this['channel']['setVariable'](_0x1bfa6e,_0x340b24);return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x27c175[_0xaf0b('0x1b9')],_0x1bfa6e));}}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x1ba'),_0x27c175[_0xaf0b('0x1b9')]));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x1bb')]=function(_0xd2b227){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x1bc'),_0xd2b227[_0xaf0b('0x36')]));_0xd2b227['text']=_0xd2b227[_0xaf0b('0x5c')][_0xaf0b('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xaf0b('0x83')](_0xd2b227[_0xaf0b('0x5a')])){return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](_0xaf0b('0x1bd'));}if(!this['isConfigured'](_0xd2b227['text'])){return this['channel']['noop'](_0xaf0b('0xa9'));}this[_0xaf0b('0xd')]['noop'](util['format'](_0xaf0b('0x1be'),_0xd2b227[_0xaf0b('0x5c')]));var _0x43be21=this[_0xaf0b('0x59')][_0xaf0b('0xc1')](this,_0xd2b227);if(_0x43be21){this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x43be21));var _0x3cbf7b=this['channel'][_0xaf0b('0x103')](_0x43be21);try{fs[_0xaf0b('0x104')](_0x43be21+_0xaf0b('0x126'));}catch(_0x11d25b){logger[_0xaf0b('0x2a')](_0x11d25b);}return _0x3cbf7b;}return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0xd2b227,_0xaf0b('0x1bf'));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x1c0')]=function(_0x3864eb){logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x1c1'),_0x3864eb['label']));_0x3864eb['text']=_0x3864eb['text'][_0xaf0b('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xaf0b('0x83')](_0x3864eb[_0xaf0b('0x5c')])){return this['channel']['noop']('no\x20text\x20configured');}this['channel']['noop'](util['format']('Trying\x20Google\x20TTS\x20%s',_0x3864eb['text']));var _0x5c0b32=this[_0xaf0b('0x60')]['sync'](this,_0x3864eb);if(_0x5c0b32){this[_0xaf0b('0xd')]['noop'](util[_0xaf0b('0x29')](_0xaf0b('0x1c2'),_0x5c0b32));var _0x4ba7eb=this[_0xaf0b('0xd')][_0xaf0b('0x103')](_0x5c0b32);try{fs['unlink'](_0x5c0b32+_0xaf0b('0x126'));}catch(_0x3fef3a){logger[_0xaf0b('0x2a')](_0x3fef3a);}return _0x4ba7eb;}return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x3864eb,_0xaf0b('0x1c3'));};AGIVertices[_0xaf0b('0xf')]['unpause']=function(_0x190dd4){logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x1c4'),_0x190dd4[_0xaf0b('0x36')]));if(!this['isConfigured'](_0x190dd4[_0xaf0b('0x15e')])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x190dd4,'no\x20find\x20by\x20configured');}logger[_0xaf0b('0x2c')](util[_0xaf0b('0x29')](_0xaf0b('0x15d'),this['channel']['callerid'],_0x190dd4[_0xaf0b('0x15e')]));var _0x448956=this['agentUnpause'][_0xaf0b('0xc1')](this,_0x190dd4[_0xaf0b('0x15e')]);if(_0x448956){logger['info'](util[_0xaf0b('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x190dd4[_0xaf0b('0x15e')]));this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x190dd4[_0xaf0b('0x15e')]));return{'code':0xc8,'result':_0xaf0b('0x160')};}else{logger['info'](util[_0xaf0b('0x29')](_0xaf0b('0x161'),this[_0xaf0b('0xd')]['callerid'],_0x190dd4['findBy']));this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util['format'](_0xaf0b('0x161'),this[_0xaf0b('0xd')][_0xaf0b('0x38')],_0x190dd4['findBy']));return{'code':0xc8,'result':_0xaf0b('0x162')};}};AGIVertices[_0xaf0b('0xf')]['voicemail']=function(_0x521cc7){logger[_0xaf0b('0x2c')](util['format'](_0xaf0b('0x1c5'),_0x521cc7['label']));var _0x42a71e=this[_0xaf0b('0xd')]['exec'](_0xaf0b('0x1c6'),[_0x521cc7['mailbox'],_0x521cc7[_0xaf0b('0xaa')]]);if(_0x42a71e['result']===-0x1){return _0x42a71e;}return this[_0xaf0b('0xd')][_0xaf0b('0xa8')](util[_0xaf0b('0x29')](_0xaf0b('0x172'),'VOICEMAIL',_0x521cc7['mailbox']));};AGIVertices[_0xaf0b('0xf')][_0xaf0b('0x1c7')]=function(_0x583138){logger['info'](util[_0xaf0b('0x29')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x583138['label']));if(!this['isConfigured'](_0x583138[_0xaf0b('0xd4')])){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x583138,_0xaf0b('0x1a8'));}var _0x26bc71=this[_0xaf0b('0xa1')][_0xaf0b('0xc1')](this,_0x583138[_0xaf0b('0xd4')]);if(!_0x26bc71){return this[_0xaf0b('0xd')][_0xaf0b('0x2a')](_0x583138,_0xaf0b('0xd6'));}var _0x2921b0=this[_0xaf0b('0xd')][_0xaf0b('0xa1')](_0x26bc71);return{'code':0xc8,'result':_0x2921b0[_0xaf0b('0xa2')]?_0x2921b0['extra']:'-'};};String[_0xaf0b('0xf')][_0xaf0b('0x1c8')]=function(_0x593376,_0x2f6741){return this[_0xaf0b('0xa0')](_0x593376)['join'](_0x2f6741);};module[_0xaf0b('0x1c9')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 4225863..fe618b9 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 _0x5a5a=['agents','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','savePause','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','catch','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','uniqueid','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','interface','destlinkedid','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','attended','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','stringify','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','then','info','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','finally','channels','queue','ACW','mandatoryDisposition','name'];(function(_0x406481,_0x51953b){var _0x1bac0a=function(_0x563808){while(--_0x563808){_0x406481['push'](_0x406481['shift']());}};_0x1bac0a(++_0x51953b);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0xd2dfeb,_0x51aa27){_0xd2dfeb=_0xd2dfeb-0x0;var _0x313172=_0x5a5a[_0xd2dfeb];return _0x313172;};'use strict';var _=require('lodash');var moment=require(_0xa5a5('0x0'));var ami=require(_0xa5a5('0x1'));var logger=require(_0xa5a5('0x2'))(_0xa5a5('0x3'));var RpcUser=require(_0xa5a5('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x1e6eca){this[_0xa5a5('0x5')]=_0x1e6eca[_0xa5a5('0x5')];this['agents']=_0x1e6eca['agents'];this[_0xa5a5('0x6')]=_0x1e6eca[_0xa5a5('0x6')];this['channels']={};ami['on'](_0xa5a5('0x7'),this[_0xa5a5('0x8')][_0xa5a5('0x9')](this));ami['on'](_0xa5a5('0xa'),this[_0xa5a5('0xb')]['bind'](this));ami['on'](_0xa5a5('0xc'),this[_0xa5a5('0xd')][_0xa5a5('0x9')](this));ami['on'](_0xa5a5('0xe'),this[_0xa5a5('0xf')][_0xa5a5('0x9')](this));ami['on'](_0xa5a5('0x10'),this[_0xa5a5('0x11')][_0xa5a5('0x9')](this));ami['on'](_0xa5a5('0x12'),this[_0xa5a5('0x13')][_0xa5a5('0x9')](this));ami['on']('custom:agentConnectPreview',this[_0xa5a5('0x14')][_0xa5a5('0x9')](this));}function getDiff(_0x3917b1){var _0x266985=moment()[_0xa5a5('0x15')](0x0);var _0xa81eeb=moment(_0x3917b1)['milliseconds'](0x0);return _0x266985[_0xa5a5('0x16')](_0xa81eeb,_0xa5a5('0x17'));}Acw[_0xa5a5('0x18')][_0xa5a5('0x19')]=function(_0x2daae6,_0x38305a){var _0x1464d9=this;var _0x62aa04=getDiff(_0x1464d9['timers'][_0x2daae6][_0xa5a5('0x1a')]);clearTimeout(_0x1464d9[_0xa5a5('0x6')][_0x2daae6][_0xa5a5('0x1b')]);_0x1464d9[_0xa5a5('0x6')][_0x2daae6][_0xa5a5('0x1b')]=![];return RpcVoiceAgentReport[_0xa5a5('0x1c')]({'acwtime':_0x62aa04},_0x1464d9[_0xa5a5('0x6')][_0x2daae6]['uniqueid'],_0x2daae6)[_0xa5a5('0x1d')](function(_0x47514d){logger[_0xa5a5('0x1e')](_0xa5a5('0x1f'),_0x38305a,_0x62aa04,_0x47514d);})['catch'](function(_0x244c9a){logger['error'](_0xa5a5('0x20'),_0x38305a,_0x244c9a);})[_0xa5a5('0x21')](function(){delete _0x1464d9[_0xa5a5('0x6')][_0x2daae6];});};Acw[_0xa5a5('0x18')]['startAcw']=function(_0x4a7030){try{var _0x2001ed=this;var _0x1a258f=this[_0xa5a5('0x22')][_0x4a7030]['interface'];var _0x466027=this['channels'][_0x4a7030][_0xa5a5('0x23')];var _0x4996b3=this['voiceQueues'][_0x466027];var _0x29c914=![];var _0x210293=_0xa5a5('0x24');if(_0x4996b3[_0xa5a5('0x25')]&&_0x4996b3['mandatoryDispositionPause'][_0xa5a5('0x26')]){_0x29c914=!![];_0x210293=_0x4996b3['mandatoryDispositionPause'][_0xa5a5('0x26')];}if(!_0x2001ed[_0xa5a5('0x27')][_0x1a258f]){return Promise['resolve']();}return RpcUser['getAgent'](_0x2001ed[_0xa5a5('0x27')][_0x1a258f]['id'])[_0xa5a5('0x1d')](function(_0x47992c){if(!_0x47992c||_0x47992c['voicePause']){logger[_0xa5a5('0x1e')](_0xa5a5('0x28'),_0x4a7030,_0x1a258f,_0x466027);return;}logger[_0xa5a5('0x1e')](_0xa5a5('0x29'),_0x4a7030,_0x1a258f,_0x466027);var _0x16fdd4=_0x2001ed[_0xa5a5('0x22')][_0x4a7030]['attended']&&_0x2001ed[_0xa5a5('0x22')][_0x4a7030]['destlinkedid']?_0x2001ed[_0xa5a5('0x22')][_0x4a7030]['destlinkedid']:_0x4a7030;return RpcUser[_0xa5a5('0x2a')](_0x2001ed[_0xa5a5('0x27')][_0x1a258f],_0x210293,_0x16fdd4);})['then'](function(_0x47ed1d){if(_0x29c914||!_0x47ed1d){return;}_0x2001ed['timers'][_0x1a258f]={};logger[_0xa5a5('0x1e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4a7030,_0x2001ed[_0xa5a5('0x5')][_0x466027][_0xa5a5('0x2b')],_0x1a258f,_0x466027);_0x2001ed['timers'][_0x1a258f][_0xa5a5('0x1b')]=setTimeout(_0x2001ed[_0xa5a5('0x2c')]['bind'](_0x2001ed,_0x1a258f),_0x2001ed[_0xa5a5('0x5')][_0x466027][_0xa5a5('0x2b')]*0x3e8);_0x2001ed[_0xa5a5('0x6')][_0x1a258f][_0xa5a5('0x1a')]=moment()[_0xa5a5('0x2d')](_0xa5a5('0x2e'));_0x2001ed[_0xa5a5('0x6')][_0x1a258f]['uniqueid']=_0x4a7030;_0x2001ed[_0xa5a5('0x6')][_0x1a258f][_0xa5a5('0x23')]=_0x466027;_0x2001ed[_0xa5a5('0x6')][_0x1a258f][_0xa5a5('0x19')]=_0x2001ed[_0xa5a5('0x19')][_0xa5a5('0x9')](_0x2001ed,_0x1a258f,_0x4a7030);})[_0xa5a5('0x2f')](function(){logger[_0xa5a5('0x30')](_0xa5a5('0x31'),_0x4a7030,_0x2001ed[_0xa5a5('0x5')][_0x466027][_0xa5a5('0x2b')],_0x1a258f,_0x466027);})[_0xa5a5('0x21')](function(){delete _0x2001ed[_0xa5a5('0x22')][_0x4a7030];});}catch(_0xab892d){logger[_0xa5a5('0x30')](_0xa5a5('0x32'),_0xab892d[_0xa5a5('0x33')]);}};Acw['prototype'][_0xa5a5('0x2c')]=function(_0x53e26b){try{var _0x49c55d=this;if(_0x49c55d['timers'][_0x53e26b]){_0x49c55d[_0xa5a5('0x6')][_0x53e26b]['timer']=![];var _0x1f049c=_0x49c55d[_0xa5a5('0x6')][_0x53e26b][_0xa5a5('0x34')];var _0x486759=_0x49c55d[_0xa5a5('0x6')][_0x53e26b]['queue'];var _0x54f90d=_0x49c55d[_0xa5a5('0x5')][_0x486759][_0xa5a5('0x2b')];logger['info'](_0xa5a5('0x35'),_0x1f049c,_0x53e26b);RpcUser['saveUnpause'](this['agents'][_0x53e26b]);RpcVoiceAgentReport[_0xa5a5('0x1c')]({'acwtime':_0x54f90d,'agentacw':!![]},_0x1f049c,_0x53e26b)['then'](function(_0x2ad7c0){logger['info'](_0xa5a5('0x1f'),_0x1f049c,_0x54f90d,_0x2ad7c0);})[_0xa5a5('0x2f')](function(_0x1a1083){logger[_0xa5a5('0x30')](_0xa5a5('0x20'),_0x1f049c,_0x1a1083);});}else{logger[_0xa5a5('0x30')](_0xa5a5('0x36'),_0x53e26b);if(_0x49c55d[_0xa5a5('0x6')]){logger[_0xa5a5('0x1e')](_0xa5a5('0x37'),JSON['stringify'](_0x49c55d[_0xa5a5('0x6')]));}}}catch(_0x491532){logger[_0xa5a5('0x30')](_0xa5a5('0x38'),_0x491532['message']);}};Acw[_0xa5a5('0x18')][_0xa5a5('0x8')]=function(_0x2373f4){try{if(this[_0xa5a5('0x5')][_0x2373f4[_0xa5a5('0x23')]]&&(this['voiceQueues'][_0x2373f4[_0xa5a5('0x23')]][_0xa5a5('0x3')]||this['voiceQueues'][_0x2373f4[_0xa5a5('0x23')]][_0xa5a5('0x25')])){if(this[_0xa5a5('0x27')][_0x2373f4[_0xa5a5('0x39')]]){this[_0xa5a5('0x22')][_0x2373f4[_0xa5a5('0x34')]]={'queue':_0x2373f4[_0xa5a5('0x23')],'interface':_0x2373f4['interface'],'destlinkedid':_0x2373f4[_0xa5a5('0x3a')]};}}}catch(_0x4a969e){logger[_0xa5a5('0x30')]('[ACW][syncAgentConnect]\x20%s',_0x4a969e['message']);}};Acw[_0xa5a5('0x18')][_0xa5a5('0x14')]=function(_0x254107){try{if(this['voiceQueues'][_0x254107[_0xa5a5('0x23')]]&&(this['voiceQueues'][_0x254107['queue']][_0xa5a5('0x3')]||this[_0xa5a5('0x5')][_0x254107[_0xa5a5('0x23')]]['mandatoryDisposition'])){if(this[_0xa5a5('0x27')][_0x254107['interface']]){this['channels'][_0x254107[_0xa5a5('0x34')]]={'queue':_0x254107[_0xa5a5('0x23')],'interface':_0x254107[_0xa5a5('0x39')]};}}}catch(_0x25091f){logger[_0xa5a5('0x30')](_0xa5a5('0x3b'),_0x25091f[_0xa5a5('0x33')]);}};Acw[_0xa5a5('0x18')]['syncHangupRequest']=function(_0x2f1b43){try{if(this[_0xa5a5('0x22')][_0x2f1b43[_0xa5a5('0x34')]]&&_[_0xa5a5('0x3c')](this[_0xa5a5('0x22')][_0x2f1b43[_0xa5a5('0x34')]]['attended'])){logger[_0xa5a5('0x1e')](_0xa5a5('0x3d'),_0x2f1b43['uniqueid']);this[_0xa5a5('0x3e')](_0x2f1b43[_0xa5a5('0x34')]);}else if(this[_0xa5a5('0x22')][_0x2f1b43['linkedid']]&&_[_0xa5a5('0x3c')](this[_0xa5a5('0x22')][_0x2f1b43[_0xa5a5('0x3f')]][_0xa5a5('0x40')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x2f1b43[_0xa5a5('0x3f')]);this[_0xa5a5('0x3e')](_0x2f1b43[_0xa5a5('0x3f')]);}}catch(_0x56b513){logger[_0xa5a5('0x30')](_0xa5a5('0x41'),_0x56b513[_0xa5a5('0x33')]);}};Acw[_0xa5a5('0x18')][_0xa5a5('0xd')]=function(_0x2197bf){try{if(this[_0xa5a5('0x22')][_0x2197bf['uniqueid']]&&this[_0xa5a5('0x22')][_0x2197bf[_0xa5a5('0x34')]][_0xa5a5('0x40')]){logger[_0xa5a5('0x1e')](_0xa5a5('0x42'),_0x2197bf[_0xa5a5('0x34')]);this['startAcw'](_0x2197bf[_0xa5a5('0x34')]);}else if(this[_0xa5a5('0x22')][_0x2197bf[_0xa5a5('0x3f')]]&&this['channels'][_0x2197bf[_0xa5a5('0x3f')]][_0xa5a5('0x40')]){logger['info'](_0xa5a5('0x43'),_0x2197bf[_0xa5a5('0x3f')]);this[_0xa5a5('0x3e')](_0x2197bf[_0xa5a5('0x3f')]);}}catch(_0x4d9b44){logger['error'](_0xa5a5('0x44'),_0x4d9b44[_0xa5a5('0x33')]);}};Acw[_0xa5a5('0x18')][_0xa5a5('0x11')]=function(_0x227337){try{if(!_[_0xa5a5('0x45')](this['channels'][_0x227337['transfereeuniqueid']])){this[_0xa5a5('0x3e')](_0x227337[_0xa5a5('0x46')]);if(this[_0xa5a5('0x22')][_0x227337['secondtransfereruniqueid']]){this['channels'][_0x227337['secondtransfereruniqueid']][_0xa5a5('0x40')]=!![];this[_0xa5a5('0x22')][_0x227337[_0xa5a5('0x47')]]=this[_0xa5a5('0x22')][_0x227337[_0xa5a5('0x48')]];delete this[_0xa5a5('0x22')][_0x227337[_0xa5a5('0x48')]];}}else if(!_[_0xa5a5('0x45')](this[_0xa5a5('0x22')][_0x227337[_0xa5a5('0x47')]])){this['startAcw'](_0x227337[_0xa5a5('0x47')]);if(this['channels'][_0x227337[_0xa5a5('0x49')]]){this[_0xa5a5('0x22')][_0x227337[_0xa5a5('0x49')]]['attended']=!![];this[_0xa5a5('0x22')][_0x227337[_0xa5a5('0x46')]]=this['channels'][_0x227337[_0xa5a5('0x49')]];delete this[_0xa5a5('0x22')][_0x227337[_0xa5a5('0x49')]];}}}catch(_0x19910c){logger[_0xa5a5('0x30')](_0xa5a5('0x4a'),_0x19910c[_0xa5a5('0x33')]);}};Acw[_0xa5a5('0x18')][_0xa5a5('0x13')]=function(_0x13a2c2){try{if(this['channels'][_0x13a2c2[_0xa5a5('0x4b')]]){logger[_0xa5a5('0x1e')](_0xa5a5('0x4c'),JSON['stringify'](_0x13a2c2[_0xa5a5('0x4b')]));this[_0xa5a5('0x3e')](_0x13a2c2[_0xa5a5('0x4b')]);}else if(this[_0xa5a5('0x22')][_0x13a2c2[_0xa5a5('0x4d')]]){logger[_0xa5a5('0x1e')](_0xa5a5('0x4e'),JSON[_0xa5a5('0x4f')](_0x13a2c2[_0xa5a5('0x4d')]));this['startAcw'](_0x13a2c2['transfererlinkedid']);}}catch(_0x3f0523){logger[_0xa5a5('0x30')](_0xa5a5('0x50'),_0x3f0523['message']);}};Acw[_0xa5a5('0x18')]['syncAgentRingNoAnswer']=function(_0x3dfee1){try{if(this[_0xa5a5('0x5')][_0x3dfee1[_0xa5a5('0x23')]]&&this[_0xa5a5('0x5')][_0x3dfee1['queue']]['autopause']===_0xa5a5('0x51')){if(this[_0xa5a5('0x27')][_0x3dfee1['interface']]){logger[_0xa5a5('0x1e')](_0xa5a5('0x52'),_0x3dfee1[_0xa5a5('0x34')],_0x3dfee1[_0xa5a5('0x39')],_0x3dfee1['queue']);return RpcUser['savePause'](this[_0xa5a5('0x27')][_0x3dfee1['interface']],_0xa5a5('0x53'),_0x3dfee1[_0xa5a5('0x34')]);}}}catch(_0x6c7c28){logger[_0xa5a5('0x30')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x6c7c28[_0xa5a5('0x33')]);}};module['exports']=Acw; \ No newline at end of file +var _0xee2c=['acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','[ACW][START]\x20%s','message','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','resolve','getAgent','then','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid'];(function(_0x1abeb2,_0x79f462){var _0x48da20=function(_0x42a90b){while(--_0x42a90b){_0x1abeb2['push'](_0x1abeb2['shift']());}};_0x48da20(++_0x79f462);}(_0xee2c,0x1c7));var _0xcee2=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xee2c[_0x2112d4];return _0x434972;};'use strict';var _=require(_0xcee2('0x0'));var moment=require('moment');var ami=require(_0xcee2('0x1'));var logger=require(_0xcee2('0x2'))(_0xcee2('0x3'));var RpcUser=require(_0xcee2('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x589e9d){this[_0xcee2('0x5')]=_0x589e9d[_0xcee2('0x5')];this['agents']=_0x589e9d[_0xcee2('0x6')];this[_0xcee2('0x7')]=_0x589e9d[_0xcee2('0x7')];this[_0xcee2('0x8')]={};ami['on'](_0xcee2('0x9'),this['syncAgentConnect']['bind'](this));ami['on'](_0xcee2('0xa'),this[_0xcee2('0xb')][_0xcee2('0xc')](this));ami['on'](_0xcee2('0xd'),this[_0xcee2('0xe')][_0xcee2('0xc')](this));ami['on'](_0xcee2('0xf'),this[_0xcee2('0x10')]['bind'](this));ami['on'](_0xcee2('0x11'),this[_0xcee2('0x12')][_0xcee2('0xc')](this));ami['on'](_0xcee2('0x13'),this[_0xcee2('0x14')]['bind'](this));ami['on'](_0xcee2('0x15'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x5dad1e){var _0xfa663a=moment()[_0xcee2('0x16')](0x0);var _0x2afc56=moment(_0x5dad1e)[_0xcee2('0x16')](0x0);return _0xfa663a['diff'](_0x2afc56,_0xcee2('0x17'));}Acw[_0xcee2('0x18')][_0xcee2('0x19')]=function(_0x238da0,_0x1787ec){var _0x21a182=this;var _0x25bdcf=getDiff(_0x21a182[_0xcee2('0x7')][_0x238da0][_0xcee2('0x1a')]);clearTimeout(_0x21a182['timers'][_0x238da0][_0xcee2('0x1b')]);_0x21a182['timers'][_0x238da0][_0xcee2('0x1b')]=![];return RpcVoiceAgentReport[_0xcee2('0x1c')]({'acwtime':_0x25bdcf},_0x21a182[_0xcee2('0x7')][_0x238da0][_0xcee2('0x1d')],_0x238da0)['then'](function(_0x245811){logger[_0xcee2('0x1e')](_0xcee2('0x1f'),_0x1787ec,_0x25bdcf,_0x245811);})[_0xcee2('0x20')](function(_0x3395b1){logger[_0xcee2('0x21')](_0xcee2('0x22'),_0x1787ec,_0x3395b1);})[_0xcee2('0x23')](function(){delete _0x21a182[_0xcee2('0x7')][_0x238da0];});};Acw[_0xcee2('0x18')][_0xcee2('0x24')]=function(_0x5d42aa){try{var _0x3f4f92=this;var _0x4864d7=this['channels'][_0x5d42aa]['interface'];var _0x2c1b27=this['channels'][_0x5d42aa][_0xcee2('0x25')];var _0x1a935a=this[_0xcee2('0x5')][_0x2c1b27];var _0x53bd9f=![];var _0x49b1a8=_0xcee2('0x26');if(_0x1a935a[_0xcee2('0x27')]&&_0x1a935a[_0xcee2('0x28')]['name']){_0x53bd9f=!![];_0x49b1a8=_0x1a935a[_0xcee2('0x28')]['name'];}if(!_0x3f4f92[_0xcee2('0x6')][_0x4864d7]){return Promise[_0xcee2('0x29')]();}return RpcUser[_0xcee2('0x2a')](_0x3f4f92[_0xcee2('0x6')][_0x4864d7]['id'])[_0xcee2('0x2b')](function(_0x31618c){if(!_0x31618c||_0x31618c[_0xcee2('0x2c')]){logger[_0xcee2('0x1e')](_0xcee2('0x2d'),_0x5d42aa,_0x4864d7,_0x2c1b27);return;}logger[_0xcee2('0x1e')](_0xcee2('0x2e'),_0x5d42aa,_0x4864d7,_0x2c1b27);var _0x483d22=_0x3f4f92[_0xcee2('0x8')][_0x5d42aa][_0xcee2('0x2f')]&&_0x3f4f92[_0xcee2('0x8')][_0x5d42aa]['destlinkedid']?_0x3f4f92[_0xcee2('0x8')][_0x5d42aa][_0xcee2('0x30')]:_0x5d42aa;return RpcUser['savePause'](_0x3f4f92[_0xcee2('0x6')][_0x4864d7],_0x49b1a8,_0x483d22);})[_0xcee2('0x2b')](function(_0x56e23b){if(_0x53bd9f||!_0x56e23b){return;}_0x3f4f92['timers'][_0x4864d7]={};logger[_0xcee2('0x1e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5d42aa,_0x3f4f92['voiceQueues'][_0x2c1b27][_0xcee2('0x31')],_0x4864d7,_0x2c1b27);_0x3f4f92[_0xcee2('0x7')][_0x4864d7]['timer']=setTimeout(_0x3f4f92[_0xcee2('0x32')][_0xcee2('0xc')](_0x3f4f92,_0x4864d7),_0x3f4f92[_0xcee2('0x5')][_0x2c1b27][_0xcee2('0x31')]*0x3e8);_0x3f4f92[_0xcee2('0x7')][_0x4864d7][_0xcee2('0x1a')]=moment()[_0xcee2('0x33')](_0xcee2('0x34'));_0x3f4f92[_0xcee2('0x7')][_0x4864d7][_0xcee2('0x1d')]=_0x5d42aa;_0x3f4f92[_0xcee2('0x7')][_0x4864d7][_0xcee2('0x25')]=_0x2c1b27;_0x3f4f92['timers'][_0x4864d7][_0xcee2('0x19')]=_0x3f4f92[_0xcee2('0x19')]['bind'](_0x3f4f92,_0x4864d7,_0x5d42aa);})[_0xcee2('0x20')](function(){logger[_0xcee2('0x21')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5d42aa,_0x3f4f92[_0xcee2('0x5')][_0x2c1b27][_0xcee2('0x31')],_0x4864d7,_0x2c1b27);})[_0xcee2('0x23')](function(){delete _0x3f4f92['channels'][_0x5d42aa];});}catch(_0x590dd4){logger[_0xcee2('0x21')](_0xcee2('0x35'),_0x590dd4[_0xcee2('0x36')]);}};Acw[_0xcee2('0x18')][_0xcee2('0x32')]=function(_0x538984){try{var _0x457f39=this;if(_0x457f39[_0xcee2('0x7')][_0x538984]){_0x457f39[_0xcee2('0x7')][_0x538984]['timer']=![];var _0x1836cd=_0x457f39['timers'][_0x538984]['uniqueid'];var _0x42c307=_0x457f39[_0xcee2('0x7')][_0x538984][_0xcee2('0x25')];var _0x2abeb3=_0x457f39[_0xcee2('0x5')][_0x42c307][_0xcee2('0x31')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x1836cd,_0x538984);RpcUser['saveUnpause'](this[_0xcee2('0x6')][_0x538984]);RpcVoiceAgentReport['update']({'acwtime':_0x2abeb3,'agentacw':!![]},_0x1836cd,_0x538984)[_0xcee2('0x2b')](function(_0x157220){logger['info'](_0xcee2('0x1f'),_0x1836cd,_0x2abeb3,_0x157220);})['catch'](function(_0x54d75a){logger[_0xcee2('0x21')](_0xcee2('0x22'),_0x1836cd,_0x54d75a);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x538984);if(_0x457f39[_0xcee2('0x7')]){logger[_0xcee2('0x1e')](_0xcee2('0x37'),JSON[_0xcee2('0x38')](_0x457f39[_0xcee2('0x7')]));}}}catch(_0x28bb5b){logger[_0xcee2('0x21')](_0xcee2('0x39'),_0x28bb5b[_0xcee2('0x36')]);}};Acw['prototype'][_0xcee2('0x3a')]=function(_0x395b2f){try{if(this[_0xcee2('0x5')][_0x395b2f[_0xcee2('0x25')]]&&(this['voiceQueues'][_0x395b2f[_0xcee2('0x25')]][_0xcee2('0x3')]||this[_0xcee2('0x5')][_0x395b2f[_0xcee2('0x25')]][_0xcee2('0x27')])){if(this[_0xcee2('0x6')][_0x395b2f[_0xcee2('0x3b')]]){this[_0xcee2('0x8')][_0x395b2f[_0xcee2('0x1d')]]={'queue':_0x395b2f['queue'],'interface':_0x395b2f[_0xcee2('0x3b')],'destlinkedid':_0x395b2f[_0xcee2('0x30')]};}}}catch(_0x1a6ff7){logger['error'](_0xcee2('0x3c'),_0x1a6ff7[_0xcee2('0x36')]);}};Acw[_0xcee2('0x18')][_0xcee2('0x3d')]=function(_0x64f54c){try{if(this[_0xcee2('0x5')][_0x64f54c[_0xcee2('0x25')]]&&(this[_0xcee2('0x5')][_0x64f54c[_0xcee2('0x25')]][_0xcee2('0x3')]||this[_0xcee2('0x5')][_0x64f54c[_0xcee2('0x25')]][_0xcee2('0x27')])){if(this[_0xcee2('0x6')][_0x64f54c['interface']]){this[_0xcee2('0x8')][_0x64f54c['uniqueid']]={'queue':_0x64f54c['queue'],'interface':_0x64f54c[_0xcee2('0x3b')]};}}}catch(_0x399291){logger[_0xcee2('0x21')](_0xcee2('0x3e'),_0x399291[_0xcee2('0x36')]);}};Acw['prototype'][_0xcee2('0xb')]=function(_0x4b9864){try{if(this[_0xcee2('0x8')][_0x4b9864[_0xcee2('0x1d')]]&&_[_0xcee2('0x3f')](this[_0xcee2('0x8')][_0x4b9864[_0xcee2('0x1d')]][_0xcee2('0x2f')])){logger[_0xcee2('0x1e')]('[%s][HANGUP:UNIQUEID]',_0x4b9864[_0xcee2('0x1d')]);this[_0xcee2('0x24')](_0x4b9864[_0xcee2('0x1d')]);}else if(this[_0xcee2('0x8')][_0x4b9864[_0xcee2('0x40')]]&&_[_0xcee2('0x3f')](this[_0xcee2('0x8')][_0x4b9864[_0xcee2('0x40')]][_0xcee2('0x2f')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x4b9864[_0xcee2('0x40')]);this[_0xcee2('0x24')](_0x4b9864['linkedid']);}}catch(_0x21cfe0){logger[_0xcee2('0x21')](_0xcee2('0x41'),_0x21cfe0[_0xcee2('0x36')]);}};Acw[_0xcee2('0x18')][_0xcee2('0xe')]=function(_0x2ce4bd){try{if(this['channels'][_0x2ce4bd['uniqueid']]&&this['channels'][_0x2ce4bd[_0xcee2('0x1d')]][_0xcee2('0x2f')]){logger[_0xcee2('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x2ce4bd[_0xcee2('0x1d')]);this[_0xcee2('0x24')](_0x2ce4bd[_0xcee2('0x1d')]);}else if(this['channels'][_0x2ce4bd[_0xcee2('0x40')]]&&this[_0xcee2('0x8')][_0x2ce4bd[_0xcee2('0x40')]]['attended']){logger[_0xcee2('0x1e')](_0xcee2('0x42'),_0x2ce4bd[_0xcee2('0x40')]);this[_0xcee2('0x24')](_0x2ce4bd['linkedid']);}}catch(_0x4f5052){logger['error'](_0xcee2('0x43'),_0x4f5052[_0xcee2('0x36')]);}};Acw[_0xcee2('0x18')][_0xcee2('0x12')]=function(_0x1fb998){try{if(!_[_0xcee2('0x44')](this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x45')]])){this[_0xcee2('0x24')](_0x1fb998[_0xcee2('0x45')]);if(this[_0xcee2('0x8')][_0x1fb998['secondtransfereruniqueid']]){this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x46')]][_0xcee2('0x2f')]=!![];this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x47')]]=this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x46')]];delete this[_0xcee2('0x8')][_0x1fb998['secondtransfereruniqueid']];}}else if(!_[_0xcee2('0x44')](this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x47')]])){this[_0xcee2('0x24')](_0x1fb998[_0xcee2('0x47')]);if(this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x48')]]){this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x48')]][_0xcee2('0x2f')]=!![];this['channels'][_0x1fb998['transfereeuniqueid']]=this[_0xcee2('0x8')][_0x1fb998[_0xcee2('0x48')]];delete this[_0xcee2('0x8')][_0x1fb998['origtransfereruniqueid']];}}}catch(_0x5089e1){logger['error'](_0xcee2('0x49'),_0x5089e1['message']);}};Acw['prototype'][_0xcee2('0x14')]=function(_0x53bbc9){try{if(this[_0xcee2('0x8')][_0x53bbc9[_0xcee2('0x4a')]]){logger['info'](_0xcee2('0x4b'),JSON[_0xcee2('0x38')](_0x53bbc9['transfereruniqueid']));this['startAcw'](_0x53bbc9[_0xcee2('0x4a')]);}else if(this[_0xcee2('0x8')][_0x53bbc9[_0xcee2('0x4c')]]){logger[_0xcee2('0x1e')](_0xcee2('0x4d'),JSON['stringify'](_0x53bbc9[_0xcee2('0x4c')]));this[_0xcee2('0x24')](_0x53bbc9[_0xcee2('0x4c')]);}}catch(_0xa39d9a){logger[_0xcee2('0x21')](_0xcee2('0x4e'),_0xa39d9a[_0xcee2('0x36')]);}};Acw[_0xcee2('0x18')][_0xcee2('0x10')]=function(_0x4004f0){try{if(this[_0xcee2('0x5')][_0x4004f0[_0xcee2('0x25')]]&&this['voiceQueues'][_0x4004f0[_0xcee2('0x25')]][_0xcee2('0x4f')]===_0xcee2('0x50')){if(this['agents'][_0x4004f0['interface']]){logger[_0xcee2('0x1e')](_0xcee2('0x51'),_0x4004f0[_0xcee2('0x1d')],_0x4004f0[_0xcee2('0x3b')],_0x4004f0['queue']);return RpcUser['savePause'](this[_0xcee2('0x6')][_0x4004f0[_0xcee2('0x3b')]],_0xcee2('0x52'),_0x4004f0[_0xcee2('0x1d')]);}}}catch(_0xe75e6e){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0xe75e6e[_0xcee2('0x36')]);}};module[_0xcee2('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 07eeb4e..6cf6c65 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 _0x7f59=['../../config/logger','ami','../../config/environment','asterisk','port','username','password','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','connect','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','once','exports','bluebird'];(function(_0x18deef,_0x5b8774){var _0x3f4361=function(_0xc61e4d){while(--_0xc61e4d){_0x18deef['push'](_0x18deef['shift']());}};_0x3f4361(++_0x5b8774);}(_0x7f59,0x131));var _0x97f5=function(_0x5c1dca,_0x132a71){_0x5c1dca=_0x5c1dca-0x0;var _0x2a1204=_0x7f59[_0x5c1dca];return _0x2a1204;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x97f5('0x0'));var util=require('util');var logger=require(_0x97f5('0x1'))(_0x97f5('0x2'));var config=require(_0x97f5('0x3'));var ami=new Manager(config[_0x97f5('0x4')][_0x97f5('0x5')],config[_0x97f5('0x4')]['ip'],config['asterisk'][_0x97f5('0x6')],config[_0x97f5('0x4')][_0x97f5('0x7')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0x97f5('0x8')](ami[_0x97f5('0x9')]);function error(_0x62b0f1){logger[_0x97f5('0xa')](util[_0x97f5('0xb')](_0x97f5('0xc'),config[_0x97f5('0x4')][_0x97f5('0x6')],config[_0x97f5('0x4')]['ip'],config[_0x97f5('0x4')][_0x97f5('0x5')],util[_0x97f5('0xd')](_0x62b0f1,![],null)));}function close(){logger[_0x97f5('0xa')](util[_0x97f5('0xb')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x97f5('0x4')][_0x97f5('0x6')],config[_0x97f5('0x4')]['ip'],config[_0x97f5('0x4')][_0x97f5('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x97f5('0xe')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x97f5('0xe')]({'action':_0x97f5('0xf')});};};ami[_0x97f5('0x10')]=function(){return function(){return ami['Action']({'action':_0x97f5('0x11')});};};ami[_0x97f5('0x12')]=function(){return function(){return ami[_0x97f5('0xe')]({'action':_0x97f5('0x13')});};};ami[_0x97f5('0x14')]=function(){return function(){return ami[_0x97f5('0xe')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util[_0x97f5('0xb')](_0x97f5('0x15'),config[_0x97f5('0x4')][_0x97f5('0x6')],config[_0x97f5('0x4')]['ip'],config['asterisk'][_0x97f5('0x5')]));ami['once']('error',error);ami['once'](_0x97f5('0x16'),close);}ami['on'](_0x97f5('0x17'),connect);ami['on']('shutdown',function(_0x1794ba){logger[_0x97f5('0x18')](util[_0x97f5('0xb')](_0x97f5('0x19'),config['asterisk'][_0x97f5('0x6')],config[_0x97f5('0x4')]['ip'],config['asterisk'][_0x97f5('0x5')],util[_0x97f5('0xd')](_0x1794ba,![],null)));});ami['on']('fullybooted',function(){logger[_0x97f5('0x18')](util[_0x97f5('0xb')](_0x97f5('0x1a'),config[_0x97f5('0x4')]['username'],config['asterisk']['ip'],config[_0x97f5('0x4')][_0x97f5('0x5')]));return Promise[_0x97f5('0x1b')]()[_0x97f5('0x1c')](ami[_0x97f5('0x1d')]())[_0x97f5('0x1c')](ami[_0x97f5('0x1e')]())[_0x97f5('0x1c')](ami[_0x97f5('0x10')]())[_0x97f5('0x1c')](ami['actionQueueSummary']())['then'](ami[_0x97f5('0x14')]())[_0x97f5('0x1f')](function(_0x1a7c4d){logger['error']('[ami.js][fullybooted]',util[_0x97f5('0xd')](_0x1a7c4d,{'showHidden':![],'depth':null}));});});ami['once'](_0x97f5('0xa'),error);ami[_0x97f5('0x20')]('close',close);module[_0x97f5('0x21')]=ami; \ No newline at end of file +var _0xbd5e=['Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','once','close','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted'];(function(_0x89894b,_0xa075f5){var _0x3dd5a7=function(_0xb43319){while(--_0xb43319){_0x89894b['push'](_0x89894b['shift']());}};_0x3dd5a7(++_0xa075f5);}(_0xbd5e,0xf6));var _0xebd5=function(_0x15469f,_0xb86ad7){_0x15469f=_0x15469f-0x0;var _0x1c5f58=_0xbd5e[_0x15469f];return _0x1c5f58;};'use strict';var Manager=require(_0xebd5('0x0'));var BPromise=require(_0xebd5('0x1'));var util=require(_0xebd5('0x2'));var logger=require(_0xebd5('0x3'))(_0xebd5('0x4'));var config=require(_0xebd5('0x5'));var ami=new Manager(config[_0xebd5('0x6')][_0xebd5('0x7')],config[_0xebd5('0x6')]['ip'],config[_0xebd5('0x6')][_0xebd5('0x8')],config[_0xebd5('0x6')][_0xebd5('0x9')],!![]);ami['keepConnected']();ami[_0xebd5('0xa')]=BPromise[_0xebd5('0xb')](ami[_0xebd5('0xc')]);function error(_0x17da9c){logger[_0xebd5('0xd')](util[_0xebd5('0xe')](_0xebd5('0xf'),config[_0xebd5('0x6')][_0xebd5('0x8')],config[_0xebd5('0x6')]['ip'],config[_0xebd5('0x6')]['port'],util['inspect'](_0x17da9c,![],null)));}function close(){logger['error'](util['format'](_0xebd5('0x10'),config['asterisk'][_0xebd5('0x8')],config[_0xebd5('0x6')]['ip'],config[_0xebd5('0x6')][_0xebd5('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xebd5('0xa')]({'action':_0xebd5('0x11')});};};ami[_0xebd5('0x12')]=function(){return function(){return ami[_0xebd5('0xa')]({'action':_0xebd5('0x13')});};};ami[_0xebd5('0x14')]=function(){return function(){return ami['Action']({'action':_0xebd5('0x15')});};};ami[_0xebd5('0x16')]=function(){return function(){return ami['Action']({'action':_0xebd5('0x17')});};};ami[_0xebd5('0x18')]=function(){return function(){return ami[_0xebd5('0xa')]({'action':_0xebd5('0x19')});};};function connect(){logger['info'](util[_0xebd5('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xebd5('0x6')][_0xebd5('0x8')],config[_0xebd5('0x6')]['ip'],config[_0xebd5('0x6')][_0xebd5('0x7')]));ami[_0xebd5('0x1a')]('error',error);ami['once'](_0xebd5('0x1b'),close);}ami['on'](_0xebd5('0x1c'),connect);ami['on'](_0xebd5('0x1d'),function(_0x499f9a){logger[_0xebd5('0x1e')](util[_0xebd5('0xe')](_0xebd5('0x1f'),config[_0xebd5('0x6')]['username'],config[_0xebd5('0x6')]['ip'],config[_0xebd5('0x6')][_0xebd5('0x7')],util[_0xebd5('0x20')](_0x499f9a,![],null)));});ami['on'](_0xebd5('0x21'),function(){logger[_0xebd5('0x1e')](util[_0xebd5('0xe')](_0xebd5('0x22'),config[_0xebd5('0x6')]['username'],config[_0xebd5('0x6')]['ip'],config['asterisk'][_0xebd5('0x7')]));return Promise[_0xebd5('0x23')]()[_0xebd5('0x24')](ami[_0xebd5('0x25')]())[_0xebd5('0x24')](ami['actionDeviceStateList']())[_0xebd5('0x24')](ami['actionSipPeerStatus']())[_0xebd5('0x24')](ami[_0xebd5('0x16')]())[_0xebd5('0x24')](ami[_0xebd5('0x18')]())[_0xebd5('0x26')](function(_0x5c989d){logger[_0xebd5('0xd')](_0xebd5('0x27'),util['inspect'](_0x5c989d,{'showHidden':![],'depth':null}));});});ami[_0xebd5('0x1a')]('error',error);ami[_0xebd5('0x1a')](_0xebd5('0x1b'),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 1e8335e..ca3f335 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 _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x57e7d2,_0x322b42){var _0x32cad4=function(_0x872a3c){while(--_0x872a3c){_0x57e7d2['push'](_0x57e7d2['shift']());}};_0x32cad4(++_0x322b42);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x486a95,_0x18bed7){_0x486a95=_0x486a95-0x0;var _0x1cc0ec=_0xbdb7[_0x486a95];return _0x1cc0ec;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0xcb91[_0x3b0912];return _0xa8f339;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 9b29cc9..6d26dc2 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 _0xeb6d=['predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','floor','erlangAbandonmentRate','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','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(','busyFactor','[getDataPredictive]','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','check\x20failure','one\x20call\x20every:','milliseconds','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','actionOriginate','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','abandonmentRate','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','then','isUndefined','emit','outbound','debug','inspect','format','voice:queue:%s','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','predictiveIntervalTotalCalls','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','---------------------------','merge','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','isTrunkReachable','active','reachable','SIP/%s','unmonitored','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTimeIntervals','ifTimeIvr','ifTime','\x20Intervals\x20is\x20null\x20','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','catch','true','all','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','stringify','syncCampaigns','undefined','resolve','checkIsTrunkReachable','checkIfTime','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','Timezone:\x20','isGlobal','AMI\x20IfTime','[ifTime][Action]','Error','syncAgentConnect','uniqueid','ivr','updateOriginated','queue','YYYY-MM-DD\x20HH:mm:ss','type','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','ContactId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','isNil','locked','status','paused','agents','stateinterface','idHopper','syncQueueStatusComplete','roundrobin','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','dialAMDActive','HANGUP','HangupInAMD','membername','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','value','MACHINE','outboundAnswerAgiCallsDay','AMD','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countagentrejectretry','stateGlobal','dialMachineMaxRetry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','outboundUnknownCallsDay','cause-txt','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','inUse','talking','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','sequence','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','object','voiceQueue\x20is\x20undefine','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','checkRetriveMax','countnoanswerretry','dialGlobalMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','outboundRejectCallsDay','AgentReject','agentreject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable'];(function(_0x566a62,_0x2c50f5){var _0x490904=function(_0x3bcc1e){while(--_0x3bcc1e){_0x566a62['push'](_0x566a62['shift']());}};_0x490904(++_0x2c50f5);}(_0xeb6d,0x67));var _0xdeb6=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xeb6d[_0x9fd887];return _0x1a54ab;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0xdeb6('0x0'));var moment=require(_0xdeb6('0x1'));var rr=require('rr');var Redis=require(_0xdeb6('0x2'));var utils=require(_0xdeb6('0x3'));var hopperUtils=require(_0xdeb6('0x4'));var ut=require(_0xdeb6('0x5'));var config=require(_0xdeb6('0x6'));var logger=require(_0xdeb6('0x7'))(_0xdeb6('0x8'));var loggerBooked=require('../../../config/logger')(_0xdeb6('0x9'));var loggerPredictive=require(_0xdeb6('0x7'))(_0xdeb6('0xa'));var loggerPredictiveCalls=require(_0xdeb6('0x7'))(_0xdeb6('0xb'));var loggerSyncQueueSummary=require(_0xdeb6('0x7'))(_0xdeb6('0xc'));var ami=require(_0xdeb6('0xd'));config[_0xdeb6('0xe')]=_[_0xdeb6('0xf')](config[_0xdeb6('0xe')],{'host':_0xdeb6('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdeb6('0xe')]));var cmHopper=require(_0xdeb6('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xdeb6('0x12'));var Interval=require(_0xdeb6('0x13'));var Action=require(_0xdeb6('0x14'));var History=require(_0xdeb6('0x15'));var Final=require(_0xdeb6('0x16'));var AgentComplete=require(_0xdeb6('0x17'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require('./models/hangup');var ipAgi=process['env'][_0xdeb6('0x18')]||_0xdeb6('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xdeb6('0x1a')][_0xdeb6('0x1b')]=function(_0x2be076){this[_0xdeb6('0x1c')]=this[_0xdeb6('0x1c')]?this[_0xdeb6('0x1c')][_0xdeb6('0x1d')](_0x2be076):_0x2be076();};function Dialer(_0x5e010f,_0x41c1f6){this['sequence']=new Sequence();this[_0xdeb6('0x1e')]=_0x41c1f6;this['voiceQueues']=_0x5e010f[_0xdeb6('0x1f')];this[_0xdeb6('0x20')]=_0x5e010f[_0xdeb6('0x20')];this['agents']=_0x5e010f['agents'];this[_0xdeb6('0x21')]=_0x5e010f[_0xdeb6('0x21')];this['maxNumberOriginate']=config[_0xdeb6('0x22')]||0x2;this[_0xdeb6('0x23')]={};this[_0xdeb6('0x24')]={};this['contactsId']={};this[_0xdeb6('0x25')]={};this[_0xdeb6('0x26')]={};this[_0xdeb6('0x27')]={};this[_0xdeb6('0x28')]={};this[_0xdeb6('0x29')]={};this[_0xdeb6('0x2a')]={};this['queueBookedRR']={};this[_0xdeb6('0x2b')]={};ami['on'](_0xdeb6('0x2c'),this['syncAgentConnect'][_0xdeb6('0x2d')](this));ami['on']('queuecallerabandon',this[_0xdeb6('0x2e')][_0xdeb6('0x2d')](this));ami['on'](_0xdeb6('0x2f'),this[_0xdeb6('0x30')]['bind'](this));ami['on'](_0xdeb6('0x31'),this['syncAgentComplete']['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0xdeb6('0x2d')](this));ami['on'](_0xdeb6('0x32'),this[_0xdeb6('0x33')][_0xdeb6('0x2d')](this));ami['on'](_0xdeb6('0x34'),this[_0xdeb6('0x35')][_0xdeb6('0x2d')](this));ami['on'](_0xdeb6('0x36'),this[_0xdeb6('0x37')][_0xdeb6('0x2d')](this));ami['on'](_0xdeb6('0x38'),this[_0xdeb6('0x39')][_0xdeb6('0x2d')](this));ami['on'](_0xdeb6('0x3a'),this[_0xdeb6('0x3b')][_0xdeb6('0x2d')](this));ami['on'](_0xdeb6('0x3c'),this['syncQueueStatusComplete']['bind'](this));this[_0xdeb6('0x3d')]();this[_0xdeb6('0x3e')]();RpcSetting['getSettings']()[_0xdeb6('0x3f')](function(_0x269bb9){previewRecallmeReminderInterval=_0x269bb9['previewRecallmeReminderInterval'];});}function isNotNull(_0x59585c){return _0x59585c!==null&&!_[_0xdeb6('0x40')](_0x59585c);}function msgResponse(_0x4e90ba,_0x3d2bc5,_0x4dbc6c){return{'action':_0x4e90ba,'response':_0x3d2bc5,'message':_0x4dbc6c,'stack':_0x4dbc6c};}function emit(_0x4be133,_0xdbcdd7,_0x11a282){io['to'](_0x4be133)[_0xdeb6('0x41')](_0xdbcdd7,_0x11a282);}function emitOutboundVoiceQueueSummary(_0x30fcc6){if(_0x30fcc6['type']===_0xdeb6('0x42')){logger[_0xdeb6('0x43')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xdeb6('0x44')](_0x30fcc6,{'showHidden':![],'depth':null}));emit(util[_0xdeb6('0x45')](_0xdeb6('0x46'),_0x30fcc6['name']),_0xdeb6('0x47'),_0x30fcc6);}}function checkGetDataPredictive(_0x1db6bc){if(isNotNull(_0x1db6bc)&&!_[_0xdeb6('0x48')](_0x1db6bc)){loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x4a'));loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x4b'),_0x1db6bc['predictiveIntervalTotalCalls']);loggerPredictive[_0xdeb6('0x49')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1db6bc[_0xdeb6('0x4c')]);loggerPredictive['info'](_0xdeb6('0x4d'),_0x1db6bc[_0xdeb6('0x4e')]);loggerPredictive[_0xdeb6('0x49')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1db6bc['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xdeb6('0x49')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1db6bc[_0xdeb6('0x4f')]);loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x50'),_0x1db6bc[_0xdeb6('0x51')]);loggerPredictive[_0xdeb6('0x49')]('---------------------------');if(_0x1db6bc[_0xdeb6('0x52')]>0x0){if(!_['isUndefined'](_0x1db6bc['predictiveIntervalAvgTalktime'])&&_0x1db6bc[_0xdeb6('0x51')]>0x0){return!![];}loggerPredictive[_0xdeb6('0x49')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xdeb6('0x40')](_0x1db6bc['predictiveIntervalAvgHoldtime'])&&_0x1db6bc[_0xdeb6('0x4f')]>0x0){return!![];}loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x53'));}else{loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x54'));}}else{loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x55'));}return![];}function mergeDataErlangB(_0x52eb49){return function(_0x2048de){loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x56'));loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x57'),_0x2048de[_0xdeb6('0x58')]);loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x59'),_0x2048de[_0xdeb6('0x5a')]);loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x5b'),_0x2048de['erlangAbandonmentRate']);loggerPredictive['info'](_0xdeb6('0x5c'),_0x2048de[_0xdeb6('0x5d')]);loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x5b'),_0x2048de['erlangAbandonmentRate']);loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x5e'));_[_0xdeb6('0x5f')](_0x52eb49,_0x2048de);};}function ifInterval(_0x54cb90,_0x4de59a){if(_[_0xdeb6('0x40')](_0x4de59a)){return![];}return utils[_0xdeb6('0x60')](undefined,_0x4de59a)<_0x54cb90*0x3c;}function clearPredictiveAttributes(_0x2e4cbc){if(_0x2e4cbc[_0xdeb6('0x28')]){_0x2e4cbc[_0xdeb6('0x28')]=undefined;loggerPredictive[_0xdeb6('0x43')](_0x2e4cbc[_0xdeb6('0x61')],_0xdeb6('0x62'));}if(_0x2e4cbc[_0xdeb6('0x27')]){_0x2e4cbc['startPredictive']=undefined;loggerPredictive[_0xdeb6('0x43')](_0x2e4cbc[_0xdeb6('0x61')],_0xdeb6('0x63'));}if(_0x2e4cbc[_0xdeb6('0x64')]){clearInterval(_0x2e4cbc[_0xdeb6('0x64')]);_0x2e4cbc[_0xdeb6('0x64')]=undefined;loggerPredictive[_0xdeb6('0x43')](_0x2e4cbc[_0xdeb6('0x61')],_0xdeb6('0x65'));}}function loggerCatchPredictive(_0x5673b6,_0x198b5b){return function(_0x31113d){loggerPredictive[_0xdeb6('0x66')](_0x198b5b[_0xdeb6('0x61')],_0x5673b6);loggerPredictive[_0xdeb6('0x66')](_0x31113d[_0xdeb6('0x67')]);clearPredictiveAttributes(_0x198b5b);};}function loggerCatch(_0x2b2f82){return function(_0x365a7b){logger['error'](_0x2b2f82,util[_0xdeb6('0x44')](_0x365a7b,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4a3883,_0x294868,_0x1ef0a8){return function(_0x4b3e3f){utils[_0xdeb6('0x68')](_0x294868,_0x1ef0a8,0x0);logger[_0xdeb6('0x66')](_0x4a3883,util[_0xdeb6('0x44')](_0x4b3e3f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1a9b40){return function(_0x1d2bb2){if(isNotNull(_0x1d2bb2)&&isNotNull(_0x1d2bb2[0x0])){if(_0x1d2bb2[0x0][_0xdeb6('0x69')]>0x0){_0x1a9b40['message']=utils[_0xdeb6('0x6a')][_0xdeb6('0x6b')];logger[_0xdeb6('0x49')](_0xdeb6('0x6c')+_0x1a9b40['name'],_0x1d2bb2[0x0]['contactsRescheduled'],_0xdeb6('0x6d'));}else{_0x1a9b40[_0xdeb6('0x6e')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0xdeb6('0x49')](_0xdeb6('0x6f')+_0x1a9b40[_0xdeb6('0x61')]);}}};}function createObjHistory(_0x24e755,_0x403296,_0x556d02,_0x4c335b,_0x8d59fa){_0x24e755[_0xdeb6('0x6e')]=_0x556d02;var _0x40af93=new Action(_0x24e755,_0x403296);var _0x3931b9=new History(_0x40af93);_0x3931b9[_0xdeb6('0x70')]=_0x4c335b;_0x3931b9[_0xdeb6('0x71')]=_0x8d59fa;_0x3931b9[_0xdeb6('0x72')]=_0x40af93[_0xdeb6('0x73')];return _0x3931b9;}function unlockQueueStatus(_0x5f01b7,_0x396c5b){setTimeout(function(){if(_[_0xdeb6('0x40')](_0x5f01b7['queueStatusComplete'])){loggerBooked['error'](_0xdeb6('0x74'),_0x396c5b);}_0x5f01b7[_0xdeb6('0x75')]=!![];loggerBooked[_0xdeb6('0x49')](_0xdeb6('0x76'),_0x396c5b,JSON['stringify'](_[_0xdeb6('0x77')](_0x5f01b7,[_0xdeb6('0x61'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x2977c3){return function(){if(!isNotNull(_0x2977c3[_0xdeb6('0x78')])){_0x2977c3[_0xdeb6('0x6e')]=utils[_0xdeb6('0x6a')][_0xdeb6('0x79')];throw _0x2977c3['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x2977c3[_0xdeb6('0x78')][_0xdeb6('0x7a')])){_0x2977c3[_0xdeb6('0x6e')]=utils[_0xdeb6('0x6a')]['NULL_INTERVAL'];throw _0x2977c3[_0xdeb6('0x61')]+_0xdeb6('0x7b');}if(!isNotNull(_[_0xdeb6('0x48')](_0x2977c3['Interval'][_0xdeb6('0x7a')]))){_0x2977c3[_0xdeb6('0x6e')]=utils[_0xdeb6('0x6a')][_0xdeb6('0x79')];throw _0x2977c3['name']+_0xdeb6('0x7b');}};}function checkIsIVRCampaignActive(_0x56d63f){return function(){if(!utils[_0xdeb6('0x7c')](_0x56d63f)){_0x56d63f['message']=utils[_0xdeb6('0x6a')][_0xdeb6('0x7d')];throw _0x56d63f[_0xdeb6('0x61')]+_0xdeb6('0x7e');}};}function emitCampaignSummary(_0x2b184e){if(utils[_0xdeb6('0x7f')](_0x2b184e)){emit(util['format'](_0xdeb6('0x80'),_0x2b184e[_0xdeb6('0x61')]),_0xdeb6('0x81'),_0x2b184e);}}function loggerCatchQueueSummary(_0x24d7ec,_0x9f0bb3){return function(_0x275ce0){clearPredictiveAttributes(_0x9f0bb3);emitCampaignSummary(_0x9f0bb3);loggerSyncQueueSummary[_0xdeb6('0x43')](_0x24d7ec,util[_0xdeb6('0x44')](_0x275ce0,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3bd841){if(_0x3bd841[_0xdeb6('0x82')]){if(_0x3bd841['originated']===0x0){_0x3bd841[_0xdeb6('0x82')]=![];_0x3bd841[_0xdeb6('0x6e')]=utils[_0xdeb6('0x6a')]['INACTIVE'];loggerSyncQueueSummary[_0xdeb6('0x43')](_0xdeb6('0x83'),_0x3bd841[_0xdeb6('0x61')],_0xdeb6('0x84'));}else{_0x3bd841[_0xdeb6('0x6e')]=utils[_0xdeb6('0x6a')]['DISACTIVED'];loggerSyncQueueSummary[_0xdeb6('0x43')](_0xdeb6('0x83'),_0x3bd841[_0xdeb6('0x61')],_0xdeb6('0x85'));}emitCampaignSummary(_0x3bd841);}}function myreject(_0x707e06){return function(_0x1f5163){return _0x707e06(msgResponse('[ifTime][Action]','Error',JSON['stringify'](_0x1f5163)));};}Dialer['prototype'][_0xdeb6('0x86')]=function(_0x1eb06f){return!_[_0xdeb6('0x40')](_0x1eb06f)&&_0x1eb06f&&!_['isUndefined'](_0x1eb06f[_0xdeb6('0x61')])&&!_[_0xdeb6('0x40')](_0x1eb06f[_0xdeb6('0x87')])&&_0x1eb06f[_0xdeb6('0x87')]&&(this[_0xdeb6('0x21')][util[_0xdeb6('0x45')]('SIP/%s',_0x1eb06f[_0xdeb6('0x61')])]['status']===_0xdeb6('0x88')||this['trunks'][util[_0xdeb6('0x45')](_0xdeb6('0x89'),_0x1eb06f[_0xdeb6('0x61')])]['status']===_0xdeb6('0x8a'));};Dialer[_0xdeb6('0x1a')]['checkIsTrunkReachable']=function(_0x30df78){var _0x1a5904=this;return function(){if(!_0x1a5904[_0xdeb6('0x86')](_0x30df78['Trunk'])){if(!_0x1a5904[_0xdeb6('0x86')](_0x30df78[_0xdeb6('0x8b')])){_0x30df78[_0xdeb6('0x6e')]=utils[_0xdeb6('0x6a')][_0xdeb6('0x8c')];throw _0x30df78[_0xdeb6('0x61')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype']['checkIfTime']=function(_0x2cdd10,_0x1c3858,_0x7cd0f6,_0x52f8ee){var _0x12d174=this;return function(){var _0xf53491=!![];return _0x12d174['ifTimeIvr'](_0x2cdd10,_0x1c3858,_0x7cd0f6,_0x52f8ee,_0xf53491);};};Dialer['prototype'][_0xdeb6('0x8d')]=function(_0x1882a7,_0x51dc13,_0x51fa02,_0x256a34){var _0x160a55=this;return function(){var _0x1484a8=![];return _0x160a55[_0xdeb6('0x8e')](_0x1882a7[_0xdeb6('0x7a')],_0x51dc13,_0x51fa02,_0x256a34,_0x1484a8);};};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x8e')]=function(_0x23ef7c,_0x7edef6,_0x13ccaf,_0x4d9013,_0x1ec176){var _0x21ea76=[];return new Promise(function(_0x10a171,_0x4bec02){if(!isNotNull(_0x23ef7c)){_0x4d9013[_0xdeb6('0x6e')]=utils[_0xdeb6('0x6a')][_0xdeb6('0x79')];return _0x4bec02(msgResponse(_0xdeb6('0x8f'),'Failure',_0x13ccaf+_0xdeb6('0x90')));}if(_['isEmpty'](_0x23ef7c)){_0x4d9013['message']=utils['CAMPAIGN_STATUS']['EMPTY_INTERVAL'];return _0x4bec02(msgResponse('ifTime',_0xdeb6('0x91'),_0x13ccaf+_0xdeb6('0x92')));}if(_0x7edef6&&_['isUndefined'](config[_0xdeb6('0x93')][_0x7edef6])){_0x4d9013[_0xdeb6('0x6e')]=utils[_0xdeb6('0x6a')][_0xdeb6('0x94')];return _0x4bec02(msgResponse(_0xdeb6('0x8f'),_0xdeb6('0x91'),_0x13ccaf+_0xdeb6('0x95')+_0x7edef6));}if(_[_0xdeb6('0x96')](_0x23ef7c)){for(var _0x21b8ef=0x0;_0x21b8ef<_0x23ef7c[_0xdeb6('0x97')];_0x21b8ef+=0x1){_0x21ea76[_0xdeb6('0x98')](ami[_0xdeb6('0x99')]({'action':_0xdeb6('0x9a'),'command':util[_0xdeb6('0x45')](_0xdeb6('0x9b'),_0x23ef7c[_0x21b8ef][_0xdeb6('0x9c')],!_[_0xdeb6('0x40')](config[_0xdeb6('0x93')][_0x7edef6])?_0x7edef6:'')})[_0xdeb6('0x3f')](function(_0x4c0ca7){return _0x4c0ca7[_0xdeb6('0x9d')][_0xdeb6('0x9e')]('true')>=0x0;})[_0xdeb6('0x9f')](myreject(_0x4bec02)));}}else{_0x21ea76[_0xdeb6('0x98')](ami['Action']({'action':_0xdeb6('0x9a'),'command':util[_0xdeb6('0x45')]('iftime\x20%s,%s',_0x23ef7c,!_['isUndefined'](config[_0xdeb6('0x93')][_0x7edef6])?_0x7edef6:'')})[_0xdeb6('0x3f')](function(_0x256e94){return _0x256e94[_0xdeb6('0x9d')][_0xdeb6('0x9e')](_0xdeb6('0xa0'))>=0x0;})[_0xdeb6('0x9f')](myreject(_0x4bec02)));}Promise[_0xdeb6('0xa1')](_0x21ea76)[_0xdeb6('0x3f')](function(_0x2117dc){var _0x162c9f=_['some'](_0x2117dc);if(_0x162c9f){return _0x10a171(_0x162c9f);}else{_0x4d9013[_0xdeb6('0x6e')]=_0x1ec176?utils[_0xdeb6('0x6a')][_0xdeb6('0xa2')]:utils[_0xdeb6('0x6a')]['OVERTIME_INTERVAL'];return _0x4bec02(msgResponse(_0xdeb6('0xa3'),'Failure',_0xdeb6('0xa4')+_0x1ec176+'\x20'+_0x13ccaf+_0xdeb6('0xa5')+util[_0xdeb6('0x44')](_0x23ef7c,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x7edef6));}})[_0xdeb6('0x9f')](function(_0x57f950){return _0x4bec02(msgResponse(_0xdeb6('0x8f'),_0xdeb6('0x91'),JSON[_0xdeb6('0xa6')](_0x57f950)));});});};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x3d')]=function(){var _0x13d376=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0xdeb6('0x3f')](function(){setInterval(function(){_0x13d376['syncCampaigns']();},0x3e8);});};Dialer[_0xdeb6('0x1a')][_0xdeb6('0xa7')]=function(){var _0x2b7f07=this;var _0x37c3bb;for(var _0x3d8b93 in this['campaigns']){if(typeof this['campaigns'][_0x3d8b93]!==_0xdeb6('0xa8')){_0x37c3bb=this['campaigns'][_0x3d8b93];if(utils['isIVRCampaign'](_0x37c3bb)&&utils[_0xdeb6('0x7c')](_0x37c3bb)){_0x37c3bb[_0xdeb6('0x82')]=!![];Promise[_0xdeb6('0xa9')]()[_0xdeb6('0x3f')](checkIsIVRCampaignActive(_0x37c3bb))[_0xdeb6('0x3f')](checkInterval(_0x37c3bb))[_0xdeb6('0x3f')](_0x2b7f07[_0xdeb6('0xaa')](_0x37c3bb))[_0xdeb6('0x3f')](_0x2b7f07[_0xdeb6('0xab')](_0x37c3bb[_0xdeb6('0xac')],_0x37c3bb[_0xdeb6('0xad')],_0x37c3bb[_0xdeb6('0x61')],_0x37c3bb))['then'](_0x2b7f07['checkIfTimeIntervals'](_0x37c3bb[_0xdeb6('0x78')],_0x37c3bb[_0xdeb6('0xad')],_0x37c3bb[_0xdeb6('0x61')],_0x37c3bb))[_0xdeb6('0x3f')](_0x2b7f07[_0xdeb6('0xae')](_0x37c3bb))['catch'](loggerCatchQueueSummary(_0xdeb6('0xaf'),_0x37c3bb));}else{notSendMessagesCampaign(_0x37c3bb);}}}};Dialer[_0xdeb6('0x1a')]['checkDialMethod']=function(_0x1ec5dc){if(_0x1ec5dc['dialMethod']!==_0xdeb6('0xa')){clearPredictiveAttributes(_0x1ec5dc);}switch(_0x1ec5dc[_0xdeb6('0xb0')]){case _0xdeb6('0xb1'):this[_0xdeb6('0xb2')](_0x1ec5dc,0x1);break;case _0xdeb6('0xb3'):this[_0xdeb6('0xb2')](_0x1ec5dc,_0x1ec5dc[_0xdeb6('0xb4')]);break;case _0xdeb6('0xa'):this[_0xdeb6('0xa')](_0x1ec5dc);break;case _0xdeb6('0x9'):this['handlePower'](_0x1ec5dc,0x1);break;default:logger[_0xdeb6('0x66')](_0xdeb6('0xb5'),_0x1ec5dc['name'],_0xdeb6('0xb6'));}};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x8f')]=function(_0x3da55d,_0x53d4e4){var _0x17109d=_0x3da55d['dialTimezone'];var _0x216448=_0x53d4e4?_0x3da55d[_0xdeb6('0xac')]:_0x3da55d[_0xdeb6('0x78')][_0xdeb6('0x7a')];logger[_0xdeb6('0xb7')](_0xdeb6('0xb8'),_0x216448,_0x17109d,_0x3da55d[_0xdeb6('0x61')],util[_0xdeb6('0x45')](_0xdeb6('0xb9'),_0x3da55d[_0xdeb6('0x61')],_0x3da55d['id']));var _0x57b7ae=null;return Interval[_0xdeb6('0xba')](_0x216448,_0x17109d)['then'](function(_0x21a378){if(_0x21a378===!![]){return _0x21a378;}else{_0x3da55d[_0xdeb6('0x6e')]=_0x53d4e4?utils['CAMPAIGN_STATUS'][_0xdeb6('0xa2')]:utils[_0xdeb6('0x6a')][_0xdeb6('0xbb')];_0x57b7ae=msgResponse(_0xdeb6('0xa3'),'Failure',_0xdeb6('0xa4')+_0x53d4e4+'\x20'+_0x3da55d['name']+_0xdeb6('0xa5')+util[_0xdeb6('0x44')](_0x216448,{'showHidden':![],'depth':null})+_0xdeb6('0xbc')+_0x17109d);}if(_0x57b7ae!==null){logger[_0xdeb6('0xb7')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x57b7ae);_0x57b7ae[_0xdeb6('0xbd')]=_0x53d4e4;throw _0x57b7ae;}})['catch'](function(_0x3b6181){logger[_0xdeb6('0x66')](_0xdeb6('0xbe'),_0x3b6181);throw msgResponse(_0xdeb6('0xbf'),_0xdeb6('0xc0'),util[_0xdeb6('0x44')](_0x3b6181,{'showHidden':![],'depth':null}));});};Dialer[_0xdeb6('0x1a')][_0xdeb6('0xc1')]=function(_0x44de07){if(this[_0xdeb6('0x1f')][_0x44de07['queue']]){if(this[_0xdeb6('0x25')][_0x44de07[_0xdeb6('0xc2')]]&&this['uniqueId'][_0x44de07[_0xdeb6('0xc2')]]['type']!==_0xdeb6('0xc3')){this[_0xdeb6('0xc4')](this[_0xdeb6('0x1f')][_0x44de07[_0xdeb6('0xc5')]]);this[_0xdeb6('0x25')][_0x44de07[_0xdeb6('0xc2')]]['answertime']=moment()['format'](_0xdeb6('0xc6'));}}};Dialer[_0xdeb6('0x1a')]['syncAgentComplete']=function(_0x38c870){var _0x47e285=this[_0xdeb6('0x25')][_0x38c870['uniqueid']];if(this['voiceQueues'][_0x38c870['queue']]){if(_0x47e285&&_0x47e285[_0xdeb6('0xc7')]!==_0xdeb6('0xc3')){delete this[_0xdeb6('0x25')][_0x38c870[_0xdeb6('0xc2')]];this['voiceQueues'][_0x38c870[_0xdeb6('0xc5')]][_0xdeb6('0xc8')]+=0x1;var _0x36de0b=new AgentComplete(_0x47e285,_0x38c870);if(_0x38c870[_0xdeb6('0xc9')]===_0xdeb6('0xca')){_0x36de0b[_0xdeb6('0xcb')]=this['voiceQueues'][_0x38c870[_0xdeb6('0xc5')]][_0xdeb6('0xcc')]&&this[_0xdeb6('0x1f')][_0x38c870[_0xdeb6('0xc5')]][_0xdeb6('0xcd')]?moment()[_0xdeb6('0x45')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0xdeb6('0xce')](_0x36de0b)[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0xcf')));hopperUtils[_0xdeb6('0xd0')](_0x36de0b)[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0xd1')));}}};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x2e')]=function(_0x4b0cb4){var _0x5dbca8=this['uniqueId'][_0x4b0cb4['uniqueid']];var _0x1f81c5=this;var _0x15dda8=![];var _0x3e1906;var _0xd71aeb;if(this[_0xdeb6('0x1f')][_0x4b0cb4[_0xdeb6('0xc5')]]){if(_0x5dbca8&&_0x5dbca8[_0xdeb6('0xc7')]!=='ivr'){delete this[_0xdeb6('0x25')][_0x4b0cb4['uniqueid']];this[_0xdeb6('0xc4')](this[_0xdeb6('0x1f')][_0x4b0cb4[_0xdeb6('0xc5')]]);_0x5dbca8['droptime']=moment()[_0xdeb6('0x45')](_0xdeb6('0xc6'));var _0x2fdf4a=new QueueCallerAbandon(_0x5dbca8,_0x4b0cb4);if(utils[_0xdeb6('0x60')](_0x5dbca8[_0xdeb6('0xd2')],_0x5dbca8[_0xdeb6('0xd3')])>=_0x5dbca8[_0xdeb6('0xd4')]){this[_0xdeb6('0x1f')][_0x4b0cb4[_0xdeb6('0xc5')]][_0xdeb6('0x4e')]+=0x1;this[_0xdeb6('0x1f')][_0x4b0cb4['queue']][_0xdeb6('0xd5')]+=0x1;this['voiceQueues'][_0x4b0cb4['queue']][_0xdeb6('0xd6')]+=0x1;_0x2fdf4a[_0xdeb6('0x70')]=0xa;_0x2fdf4a['statedesc']=_0xdeb6('0xd7');_0x2fdf4a[_0xdeb6('0xd8')]=_0xdeb6('0xd9');_0x2fdf4a[_0xdeb6('0xcb')]=this[_0xdeb6('0x1f')][_0x4b0cb4['queue']][_0xdeb6('0xcc')]?moment()[_0xdeb6('0x45')](_0xdeb6('0xc6')):undefined;_0x2fdf4a[_0xdeb6('0xda')]+=0x1;_0x2fdf4a[_0xdeb6('0xdb')]+=0x1;_0x3e1906=this['voiceQueues'][_0x4b0cb4[_0xdeb6('0xc5')]]['dialDropRetryFrequency'];_0xd71aeb=this['voiceQueues'][_0x4b0cb4[_0xdeb6('0xc5')]][_0xdeb6('0xdc')];hopperUtils[_0xdeb6('0xdd')](_0x2fdf4a,_0x2fdf4a[_0xdeb6('0x70')],_0x5dbca8[_0xdeb6('0xde')])[_0xdeb6('0x3f')](function(_0x40666b){_0x15dda8=_0x40666b[_0xdeb6('0xdf')]==0x1;if(_0x2fdf4a[_0xdeb6('0xda')]>=_0x1f81c5[_0xdeb6('0x1f')][_0x4b0cb4[_0xdeb6('0xc5')]][_0xdeb6('0xe0')]){_0x1f81c5[_0xdeb6('0xe1')](_0x2fdf4a,_0x40666b[_0xdeb6('0xdf')]);}else{hopperUtils[_0xdeb6('0xe2')]({'active':![],'countdropretry':_0x2fdf4a[_0xdeb6('0xda')],'scheduledat':moment()[_0xdeb6('0xe3')](_0x1f81c5['voiceQueues'][_0x4b0cb4[_0xdeb6('0xc5')]][_0xdeb6('0xe4')],_0xdeb6('0xe5'))[_0xdeb6('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5dbca8['ContactId'],'ListId':_0x5dbca8[_0xdeb6('0xe6')],'VoiceQueueId':_0x5dbca8[_0xdeb6('0xe7')]||undefined,'CampaignId':_0x5dbca8[_0xdeb6('0xe8')]||undefined})[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0xe9')));var _0x5a786c=new History(_0x2fdf4a);_0x5a786c[_0xdeb6('0x70')]=0xa;_0x5a786c[_0xdeb6('0x71')]=_0xdeb6('0xd7');_0x5a786c[_0xdeb6('0x73')]=moment()[_0xdeb6('0x45')](_0xdeb6('0xc6'));_0x5a786c[_0xdeb6('0x72')]=_0x5a786c[_0xdeb6('0x73')];_0x5a786c[_0xdeb6('0xea')]=_0x2fdf4a[_0xdeb6('0xea')];_0x5a786c['calleridnum']=_0x2fdf4a[_0xdeb6('0xeb')];hopperUtils[_0xdeb6('0xce')](_0x5a786c)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xdeb6('0x3f')](function(){if(_0x15dda8)hopperUtils[_0xdeb6('0xec')](_0x2fdf4a,_0x3e1906,_0xd71aeb)[_0xdeb6('0x3f')](function(){return 0x1;});});}else{this['voiceQueues'][_0x4b0cb4['queue']][_0xdeb6('0xed')]+=0x1;this[_0xdeb6('0x1f')][_0x4b0cb4['queue']][_0xdeb6('0xee')]+=0x1;_0x2fdf4a[_0xdeb6('0x70')]=0xb;_0x2fdf4a[_0xdeb6('0x71')]=_0xdeb6('0xef');_0x2fdf4a[_0xdeb6('0xd8')]=_0xdeb6('0xf0');_0x2fdf4a[_0xdeb6('0xf1')]+=0x1;_0x2fdf4a['countglobal']+=0x1;_0x3e1906=this[_0xdeb6('0x1f')][_0x4b0cb4[_0xdeb6('0xc5')]][_0xdeb6('0xf2')];_0xd71aeb=this[_0xdeb6('0x1f')][_0x4b0cb4[_0xdeb6('0xc5')]][_0xdeb6('0xdc')];hopperUtils[_0xdeb6('0xdd')](_0x2fdf4a,_0x2fdf4a[_0xdeb6('0x70')],_0x5dbca8['voiceQueue'])['then'](function(_0x411e26){if(_0x2fdf4a[_0xdeb6('0xf1')]>=_0x1f81c5['voiceQueues'][_0x4b0cb4[_0xdeb6('0xc5')]][_0xdeb6('0xf3')]){_0x1f81c5[_0xdeb6('0xe1')](_0x2fdf4a,_0x411e26['additional']);}else{hopperUtils[_0xdeb6('0xe2')]({'active':![],'countabandonedretry':_0x2fdf4a[_0xdeb6('0xf1')],'scheduledat':moment()[_0xdeb6('0xe3')](_0x1f81c5[_0xdeb6('0x1f')][_0x4b0cb4[_0xdeb6('0xc5')]][_0xdeb6('0xf2')],'minutes')[_0xdeb6('0x45')](_0xdeb6('0xc6')),'ContactId':_0x5dbca8[_0xdeb6('0xf4')],'ListId':_0x5dbca8[_0xdeb6('0xe6')],'VoiceQueueId':_0x5dbca8[_0xdeb6('0xe7')]||undefined,'CampaignId':_0x5dbca8[_0xdeb6('0xe8')]||undefined})[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0xf5')));var _0x26f748=new History(_0x2fdf4a);_0x26f748[_0xdeb6('0x70')]=0xb;_0x26f748['statedesc']='Abandoned';_0x26f748[_0xdeb6('0x73')]=moment()[_0xdeb6('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x26f748[_0xdeb6('0x72')]=_0x26f748[_0xdeb6('0x73')];_0x26f748[_0xdeb6('0xea')]=_0x2fdf4a[_0xdeb6('0xea')];_0x26f748['calleridnum']=_0x2fdf4a[_0xdeb6('0xeb')];hopperUtils[_0xdeb6('0xce')](_0x26f748)[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0xf6')));}})['then'](function(){if(_0x15dda8)hopperUtils[_0xdeb6('0xec')](_0x2fdf4a,_0x3e1906,_0xd71aeb)[_0xdeb6('0x3f')](function(){return 0x1;});});}}}};Dialer[_0xdeb6('0x1a')]['syncNewExten']=function(_0x1716fb){if(this[_0xdeb6('0x24')][_0x1716fb['uniqueid']]){this[_0xdeb6('0x24')][_0x1716fb[_0xdeb6('0xc2')]][_0xdeb6('0xf7')]=_0x1716fb[_0xdeb6('0xf7')];}if(this[_0xdeb6('0x25')][_0x1716fb[_0xdeb6('0xc2')]]){this[_0xdeb6('0x25')][_0x1716fb['uniqueid']][_0xdeb6('0xf7')]=_0x1716fb[_0xdeb6('0xf7')];}};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x3b')]=function(_0x1d9832){if(!this[_0xdeb6('0x24')][_0x1d9832[_0xdeb6('0xf8')]]){return;}var _0x4b1f6f=this[_0xdeb6('0x1f')][this[_0xdeb6('0x24')][_0x1d9832['actionid']]['queue']][_0xdeb6('0xf9')]||_0xdeb6('0xfa');if(_0x4b1f6f==='roundrobin'){if(this[_0xdeb6('0x24')][_0x1d9832[_0xdeb6('0xf8')]]&&_[_0xdeb6('0xfb')](this['actions'][_0x1d9832[_0xdeb6('0xf8')]][_0xdeb6('0xfc')])&&_0x1d9832[_0xdeb6('0xfd')]==='1'&&_0x1d9832[_0xdeb6('0xfe')]==='0'){if(this[_0xdeb6('0xff')][_0x1d9832[_0xdeb6('0x100')]]){if(!this[_0xdeb6('0xff')][_0x1d9832['stateinterface']][_0xdeb6('0xfc')]){this[_0xdeb6('0xff')][_0x1d9832[_0xdeb6('0x100')]]['locked']=!![];this['actions'][_0x1d9832[_0xdeb6('0xf8')]][_0xdeb6('0xfc')]=!![];this['actions'][_0x1d9832[_0xdeb6('0xf8')]]['stateinterface']=_0x1d9832[_0xdeb6('0x100')];}}}}else if(_0x4b1f6f==='rrmemory'){if(this[_0xdeb6('0x24')][_0x1d9832[_0xdeb6('0xf8')]]){if(this[_0xdeb6('0xff')][_0x1d9832[_0xdeb6('0x100')]]){this[_0xdeb6('0x24')][_0x1d9832[_0xdeb6('0xf8')]]['stateinterface']=_0x1d9832['stateinterface'];if(_[_0xdeb6('0xfb')](this[_0xdeb6('0x2a')][this[_0xdeb6('0x24')][_0x1d9832[_0xdeb6('0xf8')]][_0xdeb6('0xc5')]])){this[_0xdeb6('0x2a')][this[_0xdeb6('0x24')][_0x1d9832[_0xdeb6('0xf8')]]['queue']]=[];}this[_0xdeb6('0x2a')][this[_0xdeb6('0x24')][_0x1d9832[_0xdeb6('0xf8')]]['queue']]['push'](_['merge'](_[_0xdeb6('0x77')](this[_0xdeb6('0x24')][_0x1d9832[_0xdeb6('0xf8')]],[_0xdeb6('0x101'),'stateinterface']),{'status':_0x1d9832[_0xdeb6('0xfd')],'paused':_0x1d9832[_0xdeb6('0xfe')]}));}}}};Dialer['prototype'][_0xdeb6('0x102')]=function(_0x5a0071){if(!this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]]){return;}var _0x3625ed=this;var _0x404a7a=this[_0xdeb6('0x1f')][this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0xc5')]];var _0x4ba07a=_0x404a7a[_0xdeb6('0xf9')]||_0xdeb6('0xfa');if(_0x4ba07a===_0xdeb6('0x103')){if(this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]]&&this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0x100')]){this[_0xdeb6('0x1e')][_0xdeb6('0x104')](this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0x101')],this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]]['stateinterface'])['catch'](function(_0x28dfb3){logger['error'](_0xdeb6('0x105'),util[_0xdeb6('0x44')](_0x28dfb3,{'showHidden':![],'depth':null}));})[_0xdeb6('0x1d')](function(){_0x3625ed[_0xdeb6('0xc4')](_0x3625ed[_0xdeb6('0x1f')][_0x3625ed[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0xc5')]]);_0x3625ed[_0xdeb6('0xff')][_0x3625ed['actions'][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0x100')]][_0xdeb6('0xfc')]=![];delete _0x3625ed[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]];unlockQueueStatus(_0x404a7a);});}else{this[_0xdeb6('0xc4')](this['voiceQueues'][this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0xc5')]]);hopperUtils[_0xdeb6('0xe2')]({'active':![],'ContactId':this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0xf4')],'ListId':this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0xe6')],'VoiceQueueId':this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0xe7')]||undefined,'CampaignId':this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0xe8')]||undefined})[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0x106')));delete this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]];unlockQueueStatus(_0x404a7a);}}else if(_0x4ba07a===_0xdeb6('0xfa')){var _0x298c8d;if(this[_0xdeb6('0x24')][_0x5a0071['actionid']]&&!_[_0xdeb6('0x48')](this['queueBooked'][this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0xc5')]])){if(this['queueBookedRR'][_0x3625ed[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0xc5')]]){this[_0xdeb6('0x107')][_0x3625ed[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0xc5')]]=this['queueBookedRR'][this['actions'][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0xc5')]]?this[_0xdeb6('0x107')][this[_0xdeb6('0x24')][_0x5a0071['actionid']]['queue']]:this['queueBooked'][this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0xc5')]]?this[_0xdeb6('0x2a')][this['actions'][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0xc5')]][_0xdeb6('0x108')]||0x0:0x0;}this[_0xdeb6('0x2a')][this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0xc5')]][_0xdeb6('0x108')]=this[_0xdeb6('0x107')][this[_0xdeb6('0x24')][_0x5a0071[_0xdeb6('0xf8')]][_0xdeb6('0xc5')]];for(var _0x3cada6=0x0;_0x3cada6=_0x30c175['dialGlobalMaxRetry']){_0x5d15aa['stateGlobal'](_0x4c053,_0x296f8d,_0x57b0c9,_0xdeb6('0x12b'));}else{if(_0x4c053[_0xdeb6('0x125')]>=_0x30c175['dialMachineMaxRetry']){_0x5d15aa[_0xdeb6('0x12c')](_0x4c053,_0x296f8d,_0x57b0c9,_0xdeb6('0x12d'));}else{hopperUtils[_0xdeb6('0xe2')]({'active':![],'countmachineretry':_0x4c053[_0xdeb6('0x125')],'scheduledat':moment()[_0xdeb6('0xe3')](_0x30c175[_0xdeb6('0x12e')],_0xdeb6('0xe5'))[_0xdeb6('0x45')](_0xdeb6('0xc6')),'ContactId':_0x4c053['ContactId'],'ListId':_0x4c053['ListId'],'VoiceQueueId':_0x4c053[_0xdeb6('0xe7')]||undefined,'CampaignId':_0x4c053[_0xdeb6('0xe8')]||undefined})['catch'](loggerCatch(_0xdeb6('0x12f')));_0x296f8d({'reschedule':0x1});}}});}if(_0x4ded82[_0xdeb6('0xc7')]===_0xdeb6('0xc3')&&this[_0xdeb6('0x20')][_0x4ded82[_0xdeb6('0xc5')]][_0xdeb6('0x119')]&&_0x196a8c[_0xdeb6('0x121')]===_0xdeb6('0x11a')){delete this[_0xdeb6('0x25')][_0x196a8c['uniqueid']];this['updateOriginated'](this[_0xdeb6('0x20')][_0x4ded82[_0xdeb6('0xc5')]]);_0x439029=new Hangup(_0x4ded82,_0x196a8c);_0x439029[_0xdeb6('0x70')]=0x12;_0x439029[_0xdeb6('0x71')]=_0xdeb6('0x11b');_0x439029['membername']=_0xdeb6('0x124');ami[_0xdeb6('0x41')](_0xdeb6('0x126'),ut[_0xdeb6('0x11d')](_0x439029,_0xdeb6('0x11e')));this[_0xdeb6('0x11f')](_0x439029,_0xdeb6('0x130'),_0xdeb6('0x131'));}if(_0x4ded82[_0xdeb6('0xc7')]===_0xdeb6('0xc3')&&this[_0xdeb6('0x20')][_0x4ded82[_0xdeb6('0xc5')]]['dialAMDActive']&&_0x196a8c['value']===_0xdeb6('0x122')){return new Promise(function(_0x2c86bc,_0x3a2d41){delete _0x5d15aa[_0xdeb6('0x25')][_0x196a8c[_0xdeb6('0xc2')]];_0x5d15aa[_0xdeb6('0xc4')](_0x5d15aa[_0xdeb6('0x20')][_0x4ded82[_0xdeb6('0xc5')]]);_0x5d15aa[_0xdeb6('0x20')][_0x4ded82['queue']]['outboundAnswerCallsDay']+=0x1;_0x5d15aa[_0xdeb6('0x20')][_0x4ded82['queue']][_0xdeb6('0x123')]+=0x1;var _0x4fe69f=_0x5d15aa[_0xdeb6('0x20')][_0x4ded82[_0xdeb6('0xc5')]];var _0x15c37a=new Hangup(_0x4ded82,_0x196a8c);_0x15c37a['state']=0x13;_0x15c37a['statedesc']=_0xdeb6('0x132');_0x15c37a[_0xdeb6('0x11c')]=_0xdeb6('0x124');_0x15c37a[_0xdeb6('0x125')]+=0x1;_0x15c37a[_0xdeb6('0xdb')]+=0x1;_0x15c37a[_0xdeb6('0x11e')]=!![];ami[_0xdeb6('0x41')](_0xdeb6('0x126'),ut[_0xdeb6('0x11d')](_0x15c37a,_0xdeb6('0x11e')));hopperUtils[_0xdeb6('0xce')](_0x15c37a)[_0xdeb6('0x9f')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x15c37a[_0xdeb6('0x128')]+_0x15c37a['countcongestionretry']+_0x15c37a['countnoanswerretry']+_0x15c37a[_0xdeb6('0x12a')]+_0x15c37a[_0xdeb6('0xda')]+_0x15c37a[_0xdeb6('0xf1')]+_0x15c37a['countmachineretry']+_0x15c37a[_0xdeb6('0x133')]>=_0x4fe69f['dialGlobalMaxRetry']){_0x5d15aa[_0xdeb6('0x134')](_0x15c37a,_0x2c86bc,_0x3a2d41,'reason19\x20machine....');}else{if(_0x15c37a[_0xdeb6('0x125')]>=_0x4fe69f[_0xdeb6('0x135')]){_0x5d15aa['createStateFinal'](_0x15c37a,_0x2c86bc,_0x3a2d41,_0xdeb6('0x12d'));}else{hopperUtils[_0xdeb6('0xe2')]({'active':![],'countmachineretry':_0x15c37a['countmachineretry'],'scheduledat':moment()[_0xdeb6('0xe3')](_0x4fe69f[_0xdeb6('0x12e')],_0xdeb6('0xe5'))['format'](_0xdeb6('0xc6')),'ContactId':_0x15c37a[_0xdeb6('0xf4')],'ListId':_0x15c37a['ListId'],'VoiceQueueId':_0x15c37a[_0xdeb6('0xe7')]||undefined,'CampaignId':_0x15c37a[_0xdeb6('0xe8')]||undefined})[_0xdeb6('0x9f')](loggerCatch('[rescheduleContact][Machine]'));_0x2c86bc({'reschedule':0x1});}}});}}};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x35')]=function(_0x1af783){var _0x1d3546=this[_0xdeb6('0x25')][_0x1af783['uniqueid']];var _0x3b0d5d;if(_0x1d3546&&_0x1d3546[_0xdeb6('0xc7')]==='ivr'){delete this[_0xdeb6('0x25')][_0x1af783['uniqueid']];this[_0xdeb6('0xc4')](this[_0xdeb6('0x20')][_0x1d3546[_0xdeb6('0xc5')]]);this[_0xdeb6('0x20')][_0x1d3546[_0xdeb6('0xc5')]][_0xdeb6('0x136')]+=0x1;_0x3b0d5d=new Hangup(_0x1d3546,_0x1af783);hopperUtils['createHistory'](_0x3b0d5d)['catch'](loggerCatch(_0xdeb6('0x137')));hopperUtils[_0xdeb6('0xd0')](_0x3b0d5d)['catch'](loggerCatch(_0xdeb6('0x138')));}if(_0x1d3546&&_0x1d3546[_0xdeb6('0xc7')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x1d3546[_0xdeb6('0xc5')]][_0xdeb6('0x139')])){delete this[_0xdeb6('0x25')][_0x1af783['uniqueid']];this[_0xdeb6('0xc4')](this[_0xdeb6('0x1f')][_0x1d3546[_0xdeb6('0xc5')]]);this[_0xdeb6('0x1f')][_0x1d3546[_0xdeb6('0xc5')]][_0xdeb6('0xc8')]+=0x1;this[_0xdeb6('0x1f')][_0x1d3546[_0xdeb6('0xc5')]][_0xdeb6('0x123')]+=0x1;_0x3b0d5d=new Hangup(_0x1d3546,_0x1af783);_0x3b0d5d[_0xdeb6('0x70')]=0x10;_0x3b0d5d[_0xdeb6('0x71')]='AnswerAGI';_0x3b0d5d[_0xdeb6('0x11c')]='AGI';hopperUtils[_0xdeb6('0xce')](_0x3b0d5d)['catch'](loggerCatch(_0xdeb6('0x137')));hopperUtils['moveContactManagedDialer'](_0x3b0d5d)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x1d3546&&_0x1d3546[_0xdeb6('0xc7')]!==_0xdeb6('0xc3')&&!isNotNull(this[_0xdeb6('0x1f')][_0x1d3546[_0xdeb6('0xc5')]]['dialQueueProject'])){delete this['uniqueId'][_0x1af783[_0xdeb6('0xc2')]];this[_0xdeb6('0xc4')](this[_0xdeb6('0x1f')][_0x1d3546[_0xdeb6('0xc5')]]);this[_0xdeb6('0x1f')][_0x1d3546[_0xdeb6('0xc5')]][_0xdeb6('0x13a')]+=0x1;_0x3b0d5d=new Hangup(_0x1d3546,_0x1af783);_0x3b0d5d['state']=0xc;_0x3b0d5d[_0xdeb6('0x71')]=_0x1af783[_0xdeb6('0x13b')];_0x3b0d5d[_0xdeb6('0x11c')]='Unknow';hopperUtils['createHistory'](_0x3b0d5d)[_0xdeb6('0x9f')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xdeb6('0xd0')](_0x3b0d5d)[_0xdeb6('0x9f')](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype']['syncQueueSummary']=function(_0x7215b0){var _0x256531=this;if(!_0x256531[_0xdeb6('0x2b')][_0x7215b0['name']]){_0x256531['queuesSummary'][_0x7215b0[_0xdeb6('0x61')]]={'running':![]};}else if(_0x256531[_0xdeb6('0x2b')][_0x7215b0[_0xdeb6('0x61')]][_0xdeb6('0x13c')]===!![]){return;}else if(_0x256531[_0xdeb6('0x2b')][_0x7215b0[_0xdeb6('0x61')]][_0xdeb6('0x13c')]===![]){_0x256531[_0xdeb6('0x2b')][_0x7215b0[_0xdeb6('0x61')]][_0xdeb6('0x13c')]=!![];}var _0x3c2a12=_0x256531[_0xdeb6('0x1f')][_0x7215b0[_0xdeb6('0x61')]];var _0x27a4de=_0x3c2a12['message']!==utils[_0xdeb6('0x6a')]['INACTIVE'];var _0x5ca7aa=utils[_0xdeb6('0x13d')](_0x3c2a12);_0x3c2a12[_0xdeb6('0x13e')]=utils[_0xdeb6('0x13f')](_0x3c2a12,_0x256531['trunks']);Promise[_0xdeb6('0xa9')]()[_0xdeb6('0x3f')](function(){if(_0x3c2a12[_0xdeb6('0x13e')]===utils[_0xdeb6('0x6a')][_0xdeb6('0x7d')]){if(_0x27a4de){clearPredictiveAttributes(_0x3c2a12);_0x7215b0['startPredictive']=undefined;_0x7215b0[_0xdeb6('0x28')]=undefined;}if(_0x3c2a12[_0xdeb6('0x13e')]===utils[_0xdeb6('0x6a')][_0xdeb6('0x7d')]){_0x7215b0['available']=0x0;_0x7215b0[_0xdeb6('0xfe')]=0x0;_0x7215b0[_0xdeb6('0x140')]=0x0;_0x7215b0[_0xdeb6('0x141')]=0x0;_0x7215b0['pTalking']=0x0;}}else if(_0x3c2a12['statusMessage']===utils[_0xdeb6('0x6a')]['ACTIVE']&&!_0x5ca7aa){return _0x256531[_0xdeb6('0x8f')](_0x3c2a12,!![])['then'](function(){return _0x256531[_0xdeb6('0x8f')](_0x3c2a12,![]);})[_0xdeb6('0x3f')](function(){return _0x256531['checkDialMethod'](_0x3c2a12);})[_0xdeb6('0x9f')](function(_0xff0119){loggerSyncQueueSummary[_0xdeb6('0x43')](_0xdeb6('0x142'),util[_0xdeb6('0x44')](_0xff0119,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3c2a12);});}else{clearPredictiveAttributes(_0x3c2a12);}})['then'](function(){var _0x4d37e9=_0x7215b0['compareToOutboundQueue'](_0x3c2a12);if(_0x4d37e9||_0x3c2a12[_0xdeb6('0x143')]){_0x3c2a12[_0xdeb6('0x143')]=![];_0x7215b0[_0xdeb6('0x144')](_0x3c2a12);Object[_0xdeb6('0x145')](_0x3c2a12,_0x7215b0);emitOutboundVoiceQueueSummary(_0x7215b0);}_0x256531['queuesSummary'][_0x3c2a12['name']]['running']=![];})[_0xdeb6('0x9f')](function(_0x36c519){logger[_0xdeb6('0x66')](_0xdeb6('0x142'),util[_0xdeb6('0x44')](_0x36c519,{'showHidden':![],'depth':null}));_0x256531['queuesSummary'][_0x3c2a12[_0xdeb6('0x61')]]['running']=![];});};Dialer['prototype'][_0xdeb6('0x33')]=_[_0xdeb6('0x146')](function(){var _0x7a867f=_[_0xdeb6('0x147')](this[_0xdeb6('0x1f')],function(_0x217fa6){return _0x217fa6['dialPreviewRecallmeReminder'];});var _0x448009=_['filter'](this[_0xdeb6('0xff')],function(_0x10c089){return _0x10c089['online']&&_0x10c089[_0xdeb6('0xfd')]===_0xdeb6('0x88');});if(_0x7a867f['length']>0x0&&_0x448009[_0xdeb6('0x97')]>0x0){return Promise[_0xdeb6('0xa9')]()[_0xdeb6('0x3f')](cmHopper['handlePreviewRecallNotifications'](_[_0xdeb6('0x148')](_0x7a867f,'id'),previewRecallmeReminderInterval,_['map'](_0x448009,'id')))['then'](function(_0x559acf){for(var _0x3fdd61=0x0;_0x3fdd61<_0x559acf['length'];_0x3fdd61++){var _0x5b51e0=_0x559acf[_0x3fdd61][_0xdeb6('0x149')][_0xdeb6('0x61')];if(_0x5b51e0)io['to'](util[_0xdeb6('0x45')](_0xdeb6('0x14a'),_0x5b51e0))['emit'](_0xdeb6('0x14b'),{'hopper':_0x559acf[_0x3fdd61]});}})[_0xdeb6('0x9f')](function(_0x54c1aa){logger[_0xdeb6('0x66')](_0xdeb6('0x14c'),_0x54c1aa);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xdeb6('0x1a')][_0xdeb6('0x3e')]=function(){var _0x283c1f=this;setInterval(function(){_0x283c1f['clearZombieChannels'](_0x283c1f[_0xdeb6('0x25')],'[uniqueid]');_0x283c1f[_0xdeb6('0x14d')](_0x283c1f['actions'],'[actions]');},0x32c8);};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x14d')]=function(_0x319a8b,_0x4b99ca){var _0x1d1015=this;for(var _0x1e948c in _0x319a8b){if(typeof _0x319a8b[_0x1e948c]!==_0xdeb6('0xa8')){this[_0xdeb6('0x14e')][_0xdeb6('0x1b')](function(){if(!_[_0xdeb6('0xfb')](_0x319a8b[_0x1e948c])){return ami[_0xdeb6('0x99')]({'action':_0xdeb6('0xfd'),'channel':_0x319a8b[_0x1e948c][_0xdeb6('0xf7')]})[_0xdeb6('0x9f')](function(_0x41abd1){if(_0x41abd1[_0xdeb6('0x6e')]===_0xdeb6('0x14f')){setTimeout(function(){if(_0x319a8b[_0x1e948c]&&_0x319a8b[_0x1e948c][_0xdeb6('0xc7')]!==_0xdeb6('0xc3')){_0x1d1015[_0xdeb6('0xc4')](_0x1d1015[_0xdeb6('0x1f')][_0x319a8b[_0x1e948c][_0xdeb6('0xc5')]]);logger[_0xdeb6('0x66')](_0xdeb6('0x150'),_0x4b99ca,_0x1e948c,_0x319a8b[_0x1e948c][_0xdeb6('0xc5')]);delete _0x319a8b[_0x1e948c];}if(_0x319a8b[_0x1e948c]&&_0x319a8b[_0x1e948c][_0xdeb6('0xc7')]===_0xdeb6('0xc3')){_0x1d1015[_0xdeb6('0xc4')](_0x1d1015['campaigns'][_0x319a8b[_0x1e948c][_0xdeb6('0xc5')]]);logger[_0xdeb6('0x66')](_0xdeb6('0x151'),_0x4b99ca,_0x1e948c,_0x319a8b[_0x1e948c]['queue']);delete _0x319a8b[_0x1e948c];}},0x2328);}});}});}}};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x152')]=function(_0x1955ad){return Promise[_0xdeb6('0xa9')]()[_0xdeb6('0x3f')](voiceQueueRt['getVoiceQueueRtPauses'](_0x1955ad))[_0xdeb6('0x9f')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xdeb6('0x1a')][_0xdeb6('0xc4')]=function(_0x5d61a1){if(!_[_0xdeb6('0x40')](_0x5d61a1)&&_0x5d61a1!==null){if(typeof _0x5d61a1[_0xdeb6('0x153')]!==_0xdeb6('0xa8')){if(_0x5d61a1[_0xdeb6('0x153')]>0x0){_0x5d61a1['originated']-=0x1;}else{logger['error'](_0xdeb6('0x154'));}}}else{logger[_0xdeb6('0x66')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x155')]=function(_0x1fd12a,_0x53844f){var _0x9bfbf0=this;return function(_0x4ed29b){_0x9bfbf0['updateOriginated'](_0x53844f);logger[_0xdeb6('0x66')](_0x1fd12a,util[_0xdeb6('0x44')](_0x4ed29b,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xdeb6('0x156')]=function(_0x82907e,_0x9d0ab,_0x1ef885){var _0x5aa48e={'state':0x19,'statedesc':_0xdeb6('0x157')};this[_0xdeb6('0xc4')](_0x9d0ab);this['saveInDb'](_[_0xdeb6('0x5f')](_0x5aa48e,_[_0xdeb6('0x77')](_0x1ef885,['ContactId',_0xdeb6('0xe6'),_0xdeb6('0x158'),'VoiceQueueId',_0xdeb6('0xe8')])),'[emptyContact][createHistory]',_0xdeb6('0x159'));logger[_0xdeb6('0x66')](_0x82907e);};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x11f')]=function(_0x5d1eeb,_0x198399,_0x4e33c6){hopperUtils[_0xdeb6('0xce')](_0x5d1eeb)[_0xdeb6('0x9f')](loggerCatch(_0x198399));hopperUtils[_0xdeb6('0xd0')](_0x5d1eeb)[_0xdeb6('0x9f')](loggerCatch(_0x4e33c6));};Dialer[_0xdeb6('0x1a')][_0xdeb6('0xe1')]=function(_0x4b7283,_0x15eeca){hopperUtils[_0xdeb6('0xce')](_0x4b7283)[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0xcf')));if(_0x15eeca==0x0){hopperUtils[_0xdeb6('0xd0')](_0x4b7283)[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0x15a')));}};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x14c')]=function(_0x51fb44){return Promise[_0xdeb6('0xa9')]()[_0xdeb6('0x3f')](cmHopper[_0xdeb6('0x15b')](_0x51fb44['id'],previewRecallmeReminderInterval))['then'](function(_0x13fe18){for(var _0x39fef1=0x0;_0x39fef1<_0x13fe18[_0xdeb6('0x97')];_0x39fef1++){var _0x344627=_0x13fe18[_0x39fef1][_0xdeb6('0x149')][_0xdeb6('0x61')];if(_0x344627)io['to'](util[_0xdeb6('0x45')](_0xdeb6('0x14a'),_0x344627))[_0xdeb6('0x41')](_0xdeb6('0x14b'),{'hopper':_0x13fe18[_0x39fef1]});}})[_0xdeb6('0x9f')](function(){});};Dialer[_0xdeb6('0x1a')][_0xdeb6('0xae')]=function(_0x2fe712){var _0x38c7b7=this;return function(){_0x38c7b7['handleIvr'](_0x2fe712);};};Dialer[_0xdeb6('0x1a')]['actionOriginate']=function(_0x4d2235,_0x6163ec){var _0x47d10f=this;var _0x193ae2=uuid['v4']();this[_0xdeb6('0x24')][_0x193ae2]=new Action(_0x4d2235,_0x6163ec,_0x193ae2);return new Promise(function(_0x24e2de,_0x5b7914){if(_['isUndefined'](_0x4d2235)&&typeof _0x4d2235!==_0xdeb6('0x15c')){return _0x5b7914(msgResponse('originate',_0xdeb6('0x91'),_0xdeb6('0x15d')));}if(_[_0xdeb6('0x40')](_0x6163ec[_0xdeb6('0x15e')])||_0x6163ec[_0xdeb6('0x15e')]===null){return _0x5b7914(msgResponse(_0xdeb6('0x15f'),_0xdeb6('0x91'),'contact\x20is\x20undefine'));}var _0xbf2c20={'XMD-CALLERID':_0x47d10f['actions'][_0x193ae2][_0xdeb6('0x160')](),'XMD-AGI':_0x4d2235[_0xdeb6('0x139')]?util[_0xdeb6('0x45')](_0xdeb6('0x161'),ipAgi,_0x4d2235['dialQueueProject']):_0xdeb6('0x162'),'XMD-AGIAFTER':_0x4d2235[_0xdeb6('0xcc')]?util[_0xdeb6('0x45')](_0xdeb6('0x161'),ipAgi,_0x4d2235[_0xdeb6('0xcc')]):_0xdeb6('0x162'),'XMD-QUEUE':utils[_0xdeb6('0x163')](_0x4d2235)?util[_0xdeb6('0x45')]('\x22%s,%s%s,,,%s\x22',_0x4d2235['name'],_0x4d2235[_0xdeb6('0x164')]||'',_0x4d2235[_0xdeb6('0xcd')]?'c':'',_0x4d2235[_0xdeb6('0xd4')]||0x3):_0xdeb6('0x162'),'XMD-CONTACTID':_0x6163ec[_0xdeb6('0xf4')],'XMD-CDRTYPE':_0xdeb6('0x8'),'CALLERID(all)':_0x47d10f[_0xdeb6('0x24')][_0x193ae2][_0xdeb6('0x160')](),'XMD-AMD':_0x4d2235[_0xdeb6('0x119')]?_0xdeb6('0x165'):_0xdeb6('0x162'),'XMD-DESTINATION':_0xdeb6('0x118')};if(_0x4d2235[_0xdeb6('0x119')]){_0xbf2c20[_0xdeb6('0x166')]=_0x4d2235[_0xdeb6('0x167')]||0x9c4;_0xbf2c20['XMD-AMDGREETING']=_0x4d2235[_0xdeb6('0x168')]||0x5dc;_0xbf2c20['XMD-AMDAFTERGREETINGSILENCE']=_0x4d2235[_0xdeb6('0x169')]||0x320;_0xbf2c20[_0xdeb6('0x16a')]=_0x4d2235['dialAMDTotalAnalysisTime']||0x1388;_0xbf2c20['XMD-AMDMINWORDLENGTH']=_0x4d2235[_0xdeb6('0x16b')]||0x64;_0xbf2c20['XMD-AMDBETWEENWORDSSILENCE']=_0x4d2235[_0xdeb6('0x16c')]||0x32;_0xbf2c20[_0xdeb6('0x16d')]=_0x4d2235[_0xdeb6('0x16e')]||0x3;_0xbf2c20[_0xdeb6('0x16f')]=_0x4d2235[_0xdeb6('0x170')]||0x100;_0xbf2c20[_0xdeb6('0x171')]=_0x4d2235[_0xdeb6('0x172')]||0x1388;}if(utils[_0xdeb6('0x163')](_0x4d2235)){_0xbf2c20[_0xdeb6('0x173')]=_0x6163ec[_0xdeb6('0xe7')];}else{_0xbf2c20['XMD-CAMPAIGNID']=_0x6163ec[_0xdeb6('0xe8')];}var _0xce27f=utils[_0xdeb6('0x174')](_0x6163ec[_0xdeb6('0x175')]);Object['assign'](_0xbf2c20,_0xce27f);var _0x23a299=_0x47d10f[_0xdeb6('0x86')](_0x4d2235[_0xdeb6('0x176')])?utils[_0xdeb6('0x177')](_0x4d2235[_0xdeb6('0x176')][_0xdeb6('0x178')],_0x4d2235[_0xdeb6('0x179')],_0x4d2235[_0xdeb6('0x17a')]>0x0?utils[_0xdeb6('0x17b')](_0x4d2235[_0xdeb6('0x17c')],_0x4d2235[_0xdeb6('0x17a')]):_0x4d2235[_0xdeb6('0x17c')]):utils[_0xdeb6('0x177')](_[_0xdeb6('0xfb')](_0x4d2235[_0xdeb6('0x8b')])?_0x4d2235[_0xdeb6('0x176')][_0xdeb6('0x178')]:_0x4d2235[_0xdeb6('0x8b')][_0xdeb6('0x178')],_0x4d2235[_0xdeb6('0x179')],_0x4d2235['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xdeb6('0x17b')](_0x4d2235[_0xdeb6('0x17c')],_0x4d2235[_0xdeb6('0x17a')]):_0x4d2235['dialOriginateCallerIdNumber']);if(_0x23a299){_0xbf2c20['XMD-ORIGINATECALLERIDNAME']=_0x47d10f['actions'][_0x193ae2][_0xdeb6('0x17d')]=utils['extractCalleridName'](_0x23a299);_0xbf2c20[_0xdeb6('0x17e')]=_0x6163ec['phone'];}_0x4d2235[_0xdeb6('0x17f')]=_0xbf2c20;return ami[_0xdeb6('0x99')]({'actionid':_0x193ae2,'action':'originate','channel':_0x47d10f[_0xdeb6('0x86')](_0x4d2235[_0xdeb6('0x176')])?util[_0xdeb6('0x45')](_0xdeb6('0x180'),_0x4d2235[_0xdeb6('0x176')][_0xdeb6('0x61')],isNotNull(_0x4d2235[_0xdeb6('0x181')])?_0x4d2235[_0xdeb6('0x181')][_0xdeb6('0x182')]()||'':'',_0x4d2235[_0xdeb6('0x183')]>0x0?_0x6163ec[_0xdeb6('0x15e')][_0xdeb6('0x184')](_0x4d2235[_0xdeb6('0x183')]):_0x6163ec[_0xdeb6('0x15e')]):util[_0xdeb6('0x45')](_0xdeb6('0x180'),_[_0xdeb6('0xfb')](_0x4d2235[_0xdeb6('0x8b')])?_0x4d2235['Trunk'][_0xdeb6('0x61')]:_0x4d2235['TrunkBackup'][_0xdeb6('0x61')],isNotNull(_0x4d2235[_0xdeb6('0x181')])?_0x4d2235['dialPrefix'][_0xdeb6('0x182')]()||'':'',_0x4d2235['dialCutDigit']>0x0?_0x6163ec['phone'][_0xdeb6('0x184')](_0x4d2235[_0xdeb6('0x183')]):_0x6163ec[_0xdeb6('0x15e')]),'callerid':_0x23a299,'Exten':_0xdeb6('0x118'),'Context':_0xdeb6('0x185'),'Priority':'1','variable':_0xbf2c20,'timeout':(_0x4d2235['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x193ae2})[_0xdeb6('0x3f')](function(_0x1ca1a6){return _0x24e2de(_0x1ca1a6);})[_0xdeb6('0x9f')](function(_0x4b069b){_0x4d2235[_0xdeb6('0x186')]+=0x1;var _0x3db163=new History(_0x47d10f['actions'][_0x193ae2]);logger[_0xdeb6('0x66')](util[_0xdeb6('0x45')](_0xdeb6('0x187'),JSON['stringify'](_0x4b069b)));_0x3db163['state']=0xe;_0x3db163[_0xdeb6('0x71')]=_0xdeb6('0x188');_0x3db163[_0xdeb6('0x73')]=moment()[_0xdeb6('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x3db163[_0xdeb6('0x72')]=_0x3db163[_0xdeb6('0x73')];hopperUtils[_0xdeb6('0xce')](_0x3db163)[_0xdeb6('0x9f')](loggerCatch('[originate][error]'));_0x47d10f[_0xdeb6('0xd0')](_0x3db163)[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0x189')))[_0xdeb6('0x1d')](function(){delete _0x47d10f[_0xdeb6('0x24')][_0x193ae2];return _0x5b7914(msgResponse(_0xdeb6('0x15f'),_0xdeb6('0xc0'),'originate\x20action\x20Error'));});});});};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x18a')]=function(_0x2097e4,_0x268339,_0x376968){var _0xafdca2=new History(_0x268339);if(_0xafdca2[_0xdeb6('0x128')]+_0xafdca2[_0xdeb6('0x129')]+_0xafdca2[_0xdeb6('0x18b')]+_0xafdca2[_0xdeb6('0x12a')]+_0xafdca2[_0xdeb6('0xda')]+_0xafdca2[_0xdeb6('0xf1')]+_0xafdca2['countmachineretry']+_0xafdca2[_0xdeb6('0x133')]>=_0x376968[_0xdeb6('0x18c')]-0x1){return!![];}switch(_0x2097e4){case 0x3:if(_0xafdca2['countnoanswerretry']>=_0x376968['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xdeb6('0xe2')]({'active':![],'countnoanswerretry':_0xafdca2[_0xdeb6('0x18b')]+=0x1,'scheduledat':moment()[_0xdeb6('0xe3')](_0x376968[_0xdeb6('0x18d')],_0xdeb6('0xe5'))[_0xdeb6('0x45')](_0xdeb6('0xc6')),'ContactId':_0xafdca2[_0xdeb6('0xf4')],'ListId':_0xafdca2[_0xdeb6('0xe6')],'VoiceQueueId':_0xafdca2['VoiceQueueId']||undefined,'CampaignId':_0xafdca2['CampaignId']||undefined})[_0xdeb6('0x9f')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0xafdca2[_0xdeb6('0x128')]>=_0x376968[_0xdeb6('0x18e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0xafdca2[_0xdeb6('0x128')]+=0x1,'scheduledat':moment()['add'](_0x376968[_0xdeb6('0x18f')],_0xdeb6('0xe5'))[_0xdeb6('0x45')](_0xdeb6('0xc6')),'ContactId':_0xafdca2[_0xdeb6('0xf4')],'ListId':_0xafdca2['ListId'],'VoiceQueueId':_0xafdca2[_0xdeb6('0xe7')]||undefined,'CampaignId':_0xafdca2['CampaignId']||undefined})[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0x190')));break;case 0x8:if(_0xafdca2[_0xdeb6('0x129')]>=_0x376968[_0xdeb6('0x191')]-0x1){return!![];}hopperUtils[_0xdeb6('0xe2')]({'active':![],'countcongestionretry':_0xafdca2['countcongestionretry']+=0x1,'scheduledat':moment()[_0xdeb6('0xe3')](_0x376968[_0xdeb6('0x192')],'minutes')[_0xdeb6('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xafdca2[_0xdeb6('0xf4')],'ListId':_0xafdca2[_0xdeb6('0xe6')],'VoiceQueueId':_0xafdca2[_0xdeb6('0xe7')]||undefined,'CampaignId':_0xafdca2['CampaignId']||undefined})[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0x193')));break;case 0x0:if(_0xafdca2[_0xdeb6('0x12a')]>=_0x376968[_0xdeb6('0x194')]-0x1){return!![];}else{hopperUtils[_0xdeb6('0xe2')]({'active':![],'countnosuchnumberretry':_0xafdca2[_0xdeb6('0x12a')]+=0x1,'scheduledat':moment()[_0xdeb6('0xe3')](_0x376968[_0xdeb6('0x195')],_0xdeb6('0xe5'))['format'](_0xdeb6('0xc6')),'ContactId':_0xafdca2[_0xdeb6('0xf4')],'ListId':_0xafdca2['ListId'],'VoiceQueueId':_0xafdca2[_0xdeb6('0xe7')]||undefined,'CampaignId':_0xafdca2[_0xdeb6('0xe8')]||undefined})[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0x196')));}break;case 0xa:if(_0xafdca2[_0xdeb6('0xda')]>=_0x376968[_0xdeb6('0xe0')]-0x1){return!![];}hopperUtils[_0xdeb6('0xe2')]({'active':![],'countdropretry':_0xafdca2['countdropretry']+=0x1,'scheduledat':moment()[_0xdeb6('0xe3')](_0x376968[_0xdeb6('0xe4')],_0xdeb6('0xe5'))[_0xdeb6('0x45')](_0xdeb6('0xc6')),'ContactId':_0xafdca2['ContactId'],'ListId':_0xafdca2['ListId'],'VoiceQueueId':_0xafdca2[_0xdeb6('0xe7')]||undefined,'CampaignId':_0xafdca2[_0xdeb6('0xe8')]||undefined})[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0xe9')));break;case 0xb:if(_0xafdca2[_0xdeb6('0xf1')]>=_0x376968[_0xdeb6('0xf3')]-0x1){return!![];}hopperUtils[_0xdeb6('0xe2')]({'active':![],'countabandonedretry':_0xafdca2[_0xdeb6('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x376968[_0xdeb6('0xf2')],_0xdeb6('0xe5'))[_0xdeb6('0x45')](_0xdeb6('0xc6')),'ContactId':_0xafdca2[_0xdeb6('0xf4')],'ListId':_0xafdca2['ListId'],'VoiceQueueId':_0xafdca2['VoiceQueueId']||undefined,'CampaignId':_0xafdca2['CampaignId']||undefined})[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0xf5')));break;case 0x13:if(_0xafdca2[_0xdeb6('0x125')]>=_0x376968['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0xdeb6('0xe2')]({'active':![],'countmachineretry':_0xafdca2[_0xdeb6('0x125')]+=0x1,'scheduledat':moment()['add'](_0x376968[_0xdeb6('0x12e')],_0xdeb6('0xe5'))[_0xdeb6('0x45')](_0xdeb6('0xc6')),'ContactId':_0xafdca2['ContactId'],'ListId':_0xafdca2[_0xdeb6('0xe6')],'VoiceQueueId':_0xafdca2[_0xdeb6('0xe7')]||undefined,'CampaignId':_0xafdca2['CampaignId']||undefined})[_0xdeb6('0x9f')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0xafdca2['countagentrejectretry']>=_0x376968['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0xdeb6('0xe2')]({'active':![],'countagentrejectretry':_0xafdca2[_0xdeb6('0x133')]+=0x1,'scheduledat':moment()[_0xdeb6('0xe3')](_0x376968[_0xdeb6('0x197')],_0xdeb6('0xe5'))['format'](_0xdeb6('0xc6')),'ContactId':_0xafdca2['ContactId'],'ListId':_0xafdca2[_0xdeb6('0xe6')],'VoiceQueueId':_0xafdca2[_0xdeb6('0xe7')]||undefined,'CampaignId':_0xafdca2[_0xdeb6('0xe8')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x198')]=function(_0x28aa45,_0xeb75a1,_0xcc68c5){var _0x4a27c9=this;var _0x2622b2=new History(_0x28aa45);var _0x1d66a7=![];var _0x2b82a8;var _0x170d54;return new Promise(function(_0x23c2f8,_0x906b4d){if(_[_0xdeb6('0x40')](_0xeb75a1)&&typeof _0xeb75a1!=='object'){return _0x906b4d(msgResponse(_0xdeb6('0x199'),_0xdeb6('0x91'),_0xdeb6('0x19a')));}if(_[_0xdeb6('0x40')](_0xcc68c5)&&typeof _0xcc68c5!=='object'){return _0x906b4d(msgResponse(_0xdeb6('0x199'),_0xdeb6('0x91'),_0xdeb6('0x19b')));}hopperUtils[_0xdeb6('0xdd')](_0x2622b2,_0xcc68c5['reason'],_0xeb75a1)[_0xdeb6('0x3f')](function(_0x153823){if(_0x153823[_0xdeb6('0xdf')]==0x1)_0x1d66a7=!![];switch(_0xcc68c5[_0xdeb6('0xc9')]){case'0':_0xeb75a1[_0xdeb6('0x19c')]+=0x1;_0x2622b2[_0xdeb6('0x70')]=0x0;_0x2622b2[_0xdeb6('0x71')]=_0xdeb6('0x19d');_0x2622b2['countnosuchnumberretry']+=0x1;_0x2622b2[_0xdeb6('0xdb')]+=0x1;ami['emit'](_0xdeb6('0x19e'),ut[_0xdeb6('0x11d')](_0x28aa45,_0xdeb6('0x19f')));_0x2b82a8=_0xeb75a1[_0xdeb6('0x195')];_0x170d54=_0xeb75a1[_0xdeb6('0xdc')];hopperUtils[_0xdeb6('0xce')](_0x2622b2)[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0x127')));if(_0x4a27c9[_0xdeb6('0x18a')](0x0,_0x28aa45,_0xeb75a1)&&!_0x1d66a7){if(_0x2622b2[_0xdeb6('0x12a')]>=_0xeb75a1['dialNoSuchNumberMaxRetry']){_0x4a27c9['createStateFinal'](_0x2622b2,_0x23c2f8,_0x906b4d,_0xdeb6('0x1a0'));}else{_0x4a27c9[_0xdeb6('0x134')](_0x2622b2,_0x23c2f8,_0x906b4d,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0xeb75a1['outboundNoAnswerCallsDay']+=0x1;_0x2622b2[_0xdeb6('0x70')]=0x3;_0x2622b2[_0xdeb6('0x71')]=_0xdeb6('0x1a1');_0x2622b2['countnoanswerretry']+=0x1;_0x2622b2[_0xdeb6('0xdb')]+=0x1;var _0x4c6f8b=ut['buildNoAnswerEventPayload'](_0x28aa45,_0xeb75a1);ami['emit']('custom:agentnoanswer',_0x4c6f8b);_0x2b82a8=_0xeb75a1['dialNoAnswerRetryFrequency'];_0x170d54=_0xeb75a1[_0xdeb6('0xdc')];hopperUtils['createHistory'](_0x2622b2)[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0x1a2')));if(_0x4a27c9[_0xdeb6('0x18a')](0x3,_0x28aa45,_0xeb75a1)&&!_0x1d66a7){if(_0x2622b2['countnoanswerretry']>=_0xeb75a1[_0xdeb6('0x1a3')]){_0x4a27c9[_0xdeb6('0x12c')](_0x2622b2,_0x23c2f8,_0x906b4d,_0xdeb6('0x1a4'));}else{_0x4a27c9[_0xdeb6('0x134')](_0x2622b2,_0x23c2f8,_0x906b4d,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0xeb75a1['outboundBusyCallsDay']+=0x1;_0x2622b2[_0xdeb6('0x70')]=0x5;_0x2622b2['statedesc']=_0xdeb6('0x1a5');_0x2622b2[_0xdeb6('0x128')]+=0x1;_0x2622b2[_0xdeb6('0xdb')]+=0x1;ami[_0xdeb6('0x41')](_0xdeb6('0x1a6'),ut[_0xdeb6('0x11d')](_0x28aa45,_0xdeb6('0x1a7')));_0x2b82a8=_0xeb75a1[_0xdeb6('0x18f')];_0x170d54=_0xeb75a1[_0xdeb6('0xdc')];hopperUtils[_0xdeb6('0xce')](_0x2622b2)[_0xdeb6('0x9f')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x4a27c9['checkRetriveMax'](0x5,_0x28aa45,_0xeb75a1)&&!_0x1d66a7){if(_0x2622b2[_0xdeb6('0x128')]>=_0xeb75a1[_0xdeb6('0x18e')]){_0x4a27c9[_0xdeb6('0x12c')](_0x2622b2,_0x23c2f8,_0x906b4d,_0xdeb6('0x1a8'));}else{_0x4a27c9[_0xdeb6('0x134')](_0x2622b2,_0x23c2f8,_0x906b4d,_0xdeb6('0x1a8'));}}break;case'8':_0xeb75a1['outboundCongestionCallsDay']+=0x1;_0x2622b2['state']=0x8;_0x2622b2[_0xdeb6('0x71')]=_0xdeb6('0x1a9');_0x2622b2[_0xdeb6('0x129')]+=0x1;_0x2622b2['countglobal']+=0x1;_0x2b82a8=_0xeb75a1[_0xdeb6('0x192')];_0x170d54=_0xeb75a1['callAdditionalPhoneAfterMin'];ami[_0xdeb6('0x41')](_0xdeb6('0x1aa'),ut['buildObj'](_0x28aa45,_0xdeb6('0x1ab')));hopperUtils[_0xdeb6('0xce')](_0x2622b2)['catch'](loggerCatch(_0xdeb6('0x1ac')));if(_0x4a27c9['checkRetriveMax'](0x8,_0x28aa45,_0xeb75a1)&&!_0x1d66a7){if(_0x2622b2[_0xdeb6('0x129')]>=_0xeb75a1[_0xdeb6('0x191')]){_0x4a27c9[_0xdeb6('0x12c')](_0x2622b2,_0x23c2f8,_0x906b4d,_0xdeb6('0x1ad'));}else{_0x4a27c9[_0xdeb6('0x134')](_0x2622b2,_0x23c2f8,_0x906b4d,_0xdeb6('0x1ad'));}}break;case'11':_0xeb75a1[_0xdeb6('0x1ae')]+=0x1;_0x2622b2['state']=0xb;_0x2622b2['statedesc']=_0xdeb6('0xef');_0x2622b2['countabandonedretry']+=0x1;_0x2622b2[_0xdeb6('0xdb')]+=0x1;_0x2b82a8=_0xeb75a1['dialAbandonedRetryFrequency'];_0x170d54=_0xeb75a1[_0xdeb6('0xdc')];hopperUtils[_0xdeb6('0xce')](_0x2622b2)[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0xf6')));if(_0x4a27c9[_0xdeb6('0x18a')](0xb,_0x28aa45,_0xeb75a1)&&!_0x1d66a7){if(_0x2622b2['countabandonedretry']>=_0xeb75a1['dialAbandonedMaxRetry']){_0x4a27c9[_0xdeb6('0x12c')](_0x2622b2,_0x23c2f8,_0x906b4d,'reason\x2011\x20abandoned');}else{_0x4a27c9[_0xdeb6('0x134')](_0x2622b2,_0x23c2f8,_0x906b4d,'reason\x2011\x20abandoned');}}break;case'20':_0xeb75a1[_0xdeb6('0x1af')]+=0x1;_0x2622b2[_0xdeb6('0x70')]=0x14;_0x2622b2[_0xdeb6('0x71')]=_0xdeb6('0x1b0');_0x2622b2[_0xdeb6('0x133')]+=0x1;_0x2622b2[_0xdeb6('0xdb')]+=0x1;_0x2b82a8=_0xeb75a1[_0xdeb6('0x197')];_0x170d54=_0xeb75a1[_0xdeb6('0xdc')];ami['emit']('custom:agentreject',ut['buildObj'](_0x28aa45,_0xdeb6('0x1b1')));hopperUtils[_0xdeb6('0xce')](_0x2622b2)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x4a27c9[_0xdeb6('0x18a')](0x14,_0x28aa45,_0xeb75a1)&&!_0x1d66a7){if(_0x2622b2[_0xdeb6('0x133')]>=_0xeb75a1[_0xdeb6('0x1b2')]){_0x4a27c9['createStateFinal'](_0x2622b2,_0x23c2f8,_0x906b4d,_0xdeb6('0x1b3'));}else{_0x4a27c9[_0xdeb6('0x134')](_0x2622b2,_0x23c2f8,_0x906b4d,'reason\x2020\x20agentreject');}}break;default:_0xeb75a1[_0xdeb6('0x13a')]+=0x1;_0x2622b2['state']=0xc;_0x2622b2[_0xdeb6('0x71')]=_0xcc68c5[_0xdeb6('0xc9')];_0x2b82a8=_0xeb75a1[_0xdeb6('0x197')];_0x170d54=_0xeb75a1[_0xdeb6('0xdc')];hopperUtils[_0xdeb6('0xce')](_0x2622b2)[_0xdeb6('0x9f')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4a27c9['checkRetriveMax'](_0xcc68c5['reason'],_0x28aa45,_0xeb75a1)&&!_0x1d66a7){if(_0x2622b2[_0xdeb6('0x128')]+_0x2622b2[_0xdeb6('0x129')]+_0x2622b2[_0xdeb6('0x18b')]+_0x2622b2['countnosuchnumberretry']+_0x2622b2[_0xdeb6('0xda')]+_0x2622b2[_0xdeb6('0xf1')]+_0x2622b2[_0xdeb6('0x125')]+_0x2622b2[_0xdeb6('0x133')]>=_0xeb75a1[_0xdeb6('0x18c')]){_0x4a27c9['stateGlobal'](_0x2622b2,_0x23c2f8,_0x906b4d,_0xcc68c5[_0xdeb6('0xc9')]);}else{_0x4a27c9[_0xdeb6('0x12c')](_0x2622b2,_0x23c2f8,_0x906b4d,_0xcc68c5[_0xdeb6('0xc9')]);}}}})[_0xdeb6('0x3f')](function(){if(_0x1d66a7){hopperUtils[_0xdeb6('0xec')](_0x2622b2,_0x2b82a8,_0x170d54)[_0xdeb6('0x3f')](function(){return _0x23c2f8(0x1);});}});});};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x134')]=function(_0x2358c0,_0x5e76f8,_0x35685f,_0x196f71){var _0xfae108=new Final(_0x2358c0);_0xfae108[_0xdeb6('0x70')]=0xf;_0xfae108[_0xdeb6('0x71')]=_0xdeb6('0x1b4');this[_0xdeb6('0x12c')](_0xfae108,_0x5e76f8,_0x35685f,_0x196f71);};Dialer[_0xdeb6('0x1a')]['createStateFinal']=function(_0x16d5a1,_0x1c605f,_0x40dc7a,_0x3a888b){hopperUtils[_0xdeb6('0xd0')](_0x16d5a1)[_0xdeb6('0x3f')](function(){return _0x1c605f(msgResponse(_0xdeb6('0x199'),_0xdeb6('0x114'),_0x3a888b));})[_0xdeb6('0x9f')](function(){return _0x40dc7a(msgResponse(_0xdeb6('0x1b5'),_0xdeb6('0x91'),'contact\x20not\x20moved'));});};Dialer[_0xdeb6('0x1a')][_0xdeb6('0xa')]=function(_0x4269a5){var _0x255eca=_0x4269a5[_0xdeb6('0x1b6')]/0x64;var _0x1889b9=_0x4269a5['outboundDropCallsDayTimeout']/(_0x4269a5['outboundDropCallsDayTimeout']+_0x4269a5[_0xdeb6('0xc8')]);var _0x50600a=Math[_0xdeb6('0x1b7')](_0x4269a5[_0xdeb6('0x1b8')]*(_0x4269a5[_0xdeb6('0x1b9')]/0x64));var _0x43da35=Math[_0xdeb6('0x1b7')](_0x4269a5[_0xdeb6('0x1b8')]*(_0x4269a5[_0xdeb6('0x1ba')]/0x64));var _0x31fee6=_0x4269a5[_0xdeb6('0x1bb')]+_0x4269a5['talking'];var _0x26f54c=Math[_0xdeb6('0x1bc')](_0x4269a5[_0xdeb6('0x58')]*_0x4269a5[_0xdeb6('0x1bd')]*_0x4269a5[_0xdeb6('0x1be')]*_0x4269a5[_0xdeb6('0x1bf')]);if(_[_0xdeb6('0x40')](_0x4269a5[_0xdeb6('0x28')])){if(!_[_0xdeb6('0x40')](_0x4269a5[_0xdeb6('0x27')])){_0x4269a5[_0xdeb6('0x27')]=undefined;loggerPredictive['error'](_0xdeb6('0x1c0'),_0xdeb6('0x1c1'));}if(!_[_0xdeb6('0x40')](_0x4269a5[_0xdeb6('0x64')])){loggerPredictive[_0xdeb6('0x66')](_0xdeb6('0x1c0'),_0xdeb6('0x1c2'));clearInterval(_0x4269a5['handlePredictive']);_0x4269a5['handlePredictive']=undefined;}_0x4269a5[_0xdeb6('0x28')]=moment()[_0xdeb6('0x45')](_0xdeb6('0xc6'));loggerPredictive['info'](_0x4269a5[_0xdeb6('0x61')],'collection\x20data\x20in\x20progressive\x20at',_0x4269a5[_0xdeb6('0x28')]);this[_0xdeb6('0xb2')](_0x4269a5,0x1);}else if(ifInterval(_0x4269a5[_0xdeb6('0x1c3')],_0x4269a5[_0xdeb6('0x28')])){this[_0xdeb6('0xb2')](_0x4269a5,0x1);loggerPredictiveCalls['info'](_0xdeb6('0x1c4'),_0x4269a5[_0xdeb6('0x28')],_0x4269a5[_0xdeb6('0x61')]);_0x4269a5[_0xdeb6('0x58')]=0x0;_0x4269a5[_0xdeb6('0xd6')]=0x0;}else if(_0x255eca<_0x1889b9&&_0x4269a5[_0xdeb6('0x1c5')]===_0xdeb6('0x1c6')){clearPredictiveAttributes(_0x4269a5);loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x1c7'),_0xdeb6('0x1c8'),_0x1889b9,'startProgressive',_0x4269a5[_0xdeb6('0x61')]);}else if(_0x26f54c<_0x4269a5[_0xdeb6('0xd6')]&&_0x4269a5['dialPredictiveOptimization']===_0xdeb6('0x1c6')){clearPredictiveAttributes(_0x4269a5);loggerPredictive['info'](_0xdeb6('0x1c9'),_0xdeb6('0x1ca'),_0x26f54c,_0xdeb6('0x1cb'),_0x4269a5[_0xdeb6('0xd6')],'startProgressive',_0x4269a5[_0xdeb6('0x61')]);}else if(!ifInterval(_0x4269a5[_0xdeb6('0x1c3')],_0x4269a5[_0xdeb6('0x28')])&&_[_0xdeb6('0x40')](_0x4269a5[_0xdeb6('0x27')])&&!_[_0xdeb6('0x40')](_0x4269a5[_0xdeb6('0x28')])){_0x4269a5[_0xdeb6('0x27')]=moment()[_0xdeb6('0x45')](_0xdeb6('0xc6'));loggerPredictive[_0xdeb6('0x49')](_0x4269a5[_0xdeb6('0x61')],_0xdeb6('0x1cc'),_0x4269a5[_0xdeb6('0x27')]);hopperUtils[_0xdeb6('0x1cd')](_0x4269a5[_0xdeb6('0x1c3')])[_0xdeb6('0x3f')](this[_0xdeb6('0x1ce')](_0x4269a5))['then'](mergeDataErlangB(_0x4269a5))['then'](this[_0xdeb6('0x1cf')](_0x4269a5))[_0xdeb6('0x9f')](loggerCatchPredictive(_0xdeb6('0x1d0'),_0x4269a5));}else if(!ifInterval(_0x4269a5['dialPredictiveInterval'],_0x4269a5[_0xdeb6('0x27')])){_0x4269a5['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4269a5[_0xdeb6('0x27')]=moment()[_0xdeb6('0x45')](_0xdeb6('0xc6'));loggerPredictive[_0xdeb6('0x49')](_0x4269a5[_0xdeb6('0x61')],_0xdeb6('0x1d1'),_0x4269a5[_0xdeb6('0x27')]);clearInterval(_0x4269a5[_0xdeb6('0x64')]);_0x4269a5[_0xdeb6('0x64')]=undefined;hopperUtils[_0xdeb6('0x1cd')](_0x4269a5[_0xdeb6('0x1c3')])[_0xdeb6('0x3f')](this[_0xdeb6('0x1ce')](_0x4269a5))[_0xdeb6('0x3f')](mergeDataErlangB(_0x4269a5))[_0xdeb6('0x3f')](this[_0xdeb6('0x1cf')](_0x4269a5))[_0xdeb6('0x9f')](loggerCatchPredictive(_0xdeb6('0x1d2'),_0x4269a5));}else if(_0x4269a5[_0xdeb6('0x1b8')]&&_0x31fee6<_0x4269a5['predictiveIntervalAvailable']-_0x43da35){clearPredictiveAttributes(_0x4269a5);loggerPredictive[_0xdeb6('0x49')](_0x4269a5[_0xdeb6('0x61')],_0xdeb6('0x1d3'),_0x31fee6,_0xdeb6('0x1d4'),_0x4269a5[_0xdeb6('0x1b8')],'-',_0x43da35,'=',_0x4269a5['predictiveIntervalAvailable']-_0x43da35,')');}else if(_0x4269a5['predictiveIntervalAvailable']&&_0x31fee6>_0x4269a5[_0xdeb6('0x1b8')]+_0x50600a){clearPredictiveAttributes(_0x4269a5);loggerPredictive['info'](_0x4269a5[_0xdeb6('0x61')],_0xdeb6('0x1d3'),_0x31fee6,_0xdeb6('0x1d5'),_0x4269a5['predictiveIntervalAvailable'],'+',_0x50600a,'=',_0x4269a5[_0xdeb6('0x1b8')]+_0x50600a,')');}};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x1ce')]=function(_0x14df6f){var _0x50da39=this;return function(_0x50a7f2){return new Promise(function(_0x343993,_0x408186){_[_0xdeb6('0x5f')](_0x14df6f,_0x50a7f2[0x0]);if(checkGetDataPredictive(_0x50a7f2[0x0])){var _0x11e9ac=_0x14df6f[_0xdeb6('0x1b8')]=_0x14df6f[_0xdeb6('0x141')]+_0x14df6f['available'];var _0x183542=_0x14df6f[_0xdeb6('0x1c3')]*0x3c;var _0x3c2ccd=_0x50a7f2[0x0][_0xdeb6('0x51')]+_0x50a7f2[0x0][_0xdeb6('0x4f')];var _0x12f59b=(_0x50a7f2[0x0]['predictiveIntervalAnsweredCalls']+_0x50a7f2[0x0][_0xdeb6('0x4e')]+_0x50a7f2[0x0][_0xdeb6('0xed')])/_0x50a7f2[0x0]['predictiveIntervalTotalCalls'];_0x14df6f[_0xdeb6('0x1be')]=_0x12f59b>0x0?_0x12f59b:0x1;switch(_0x14df6f['dialPredictiveOptimization']){case _0xdeb6('0x1c6'):var _0x3c3863=_0x14df6f[_0xdeb6('0x1b6')]/0x64;return _0x50da39['abandonmentRate'](_0x11e9ac,_0x183542,_0x3c2ccd,_0x12f59b,_0x3c3863)['then'](function(_0x3649c4){return _0x343993(_0x3649c4);});case'agentBusyFactor':var _0x3c49df=_0x14df6f['dialPredictiveOptimizationPercentage']/0x64;return _0x50da39[_0xdeb6('0x1d6')](_0x11e9ac,_0x183542,_0x3c2ccd,_0x12f59b,_0x3c49df)[_0xdeb6('0x3f')](function(_0x2654c7){return _0x343993(_0x2654c7);});default:return _0x408186(msgResponse(_0xdeb6('0x1d7'),_0xdeb6('0x91'),'Unknown\x20Predictive'));}}else{return _0x408186(msgResponse(_0xdeb6('0x1d7'),_0xdeb6('0x91'),'check\x20failure'));}});};};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x1d8')]=function(_0x3eb8fe){var _0x1742ad=this;return function(_0x462607){return new Promise(function(_0x3da4c6,_0x5ca833){_[_0xdeb6('0x5f')](_0x3eb8fe,_0x462607[0x0]);if(checkGetDataPredictive(_0x462607[0x0])){loggerPredictive[_0xdeb6('0x49')](JSON[_0xdeb6('0xa6')](_0x462607[0x0]));if(_0x3eb8fe[_0xdeb6('0x1c5')]==='dropRate'){return _0x1742ad[_0xdeb6('0x152')](_0x3eb8fe['id'])['then'](function(_0x164fff){var _0x51a7a2=_0x3eb8fe[_0xdeb6('0x1d9')]-_0x164fff[0x0]['outboundQueuePauses'];var _0xc135cb=_0x3eb8fe[_0xdeb6('0x1c3')]*0x3c;var _0x32bab2=_0x462607[0x0][_0xdeb6('0x51')]+_0x462607[0x0][_0xdeb6('0x4f')];var _0x21607e=(_0x462607[0x0][_0xdeb6('0x4c')]+_0x462607[0x0][_0xdeb6('0x4e')]+_0x462607[0x0][_0xdeb6('0xed')])/_0x462607[0x0]['predictiveIntervalTotalCalls'];var _0x4eb15c=_0x3eb8fe['dialPredictiveOptimizationPercentage']/0x64;_0x3eb8fe[_0xdeb6('0x1da')]=_0x164fff[0x0][_0xdeb6('0x1db')]||0x0;_0x3eb8fe[_0xdeb6('0x1be')]=_0x21607e>0x0?_0x21607e:0x1;return _0x1742ad['abandonmentRate'](_0x51a7a2,_0xc135cb,_0x32bab2,_0x21607e,_0x4eb15c);})[_0xdeb6('0x3f')](function(_0x5eb01d){return _0x3da4c6(_0x5eb01d);})['catch'](function(_0x24492d){return _0x5ca833(msgResponse(_0xdeb6('0x1dc'),_0xdeb6('0x91'),JSON['stringify'](_0x24492d)));});}if(_0x3eb8fe[_0xdeb6('0x1c5')]===_0xdeb6('0x1dd')){return _0x1742ad[_0xdeb6('0x152')](_0x3eb8fe['id'])[_0xdeb6('0x3f')](function(_0x254404){var _0x4149fb=_0x3eb8fe[_0xdeb6('0x1d9')]-_0x254404[0x0][_0xdeb6('0x1db')];var _0x213eaa=_0x3eb8fe[_0xdeb6('0x1c3')]*0x3c;var _0x13d9d1=_0x462607[0x0][_0xdeb6('0x51')]+_0x462607[0x0]['predictiveIntervalAvgHoldtime'];var _0x3a7841=(_0x462607[0x0][_0xdeb6('0x4c')]+_0x462607[0x0][_0xdeb6('0x4e')]+_0x462607[0x0][_0xdeb6('0xed')])/_0x462607[0x0]['predictiveIntervalTotalCalls'];var _0x152d4e=_0x3eb8fe[_0xdeb6('0x1b6')]/0x64;_0x3eb8fe[_0xdeb6('0x1da')]=_0x254404[0x0][_0xdeb6('0x1db')]||0x0;_0x3eb8fe[_0xdeb6('0x1be')]=_0x3a7841>0x0?_0x3a7841:0x1;return _0x1742ad['busyFactor'](_0x4149fb,_0x213eaa,_0x13d9d1,_0x3a7841,_0x152d4e);})['then'](function(_0x44266c){return _0x3da4c6(_0x44266c);})[_0xdeb6('0x9f')](function(_0x14d069){return _0x5ca833(msgResponse(_0xdeb6('0x1dc'),_0xdeb6('0x91'),JSON[_0xdeb6('0xa6')](_0x14d069)));});}}else{return _0x5ca833(msgResponse(_0xdeb6('0x1d7'),_0xdeb6('0x91'),_0xdeb6('0x1de')));}});};};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x1cf')]=function(_0x101faa){var _0x249bfe=this;return function(){var _0x4f0357=0x0;var _0x1b1dcd=Math[_0xdeb6('0x1bc')](_0x101faa[_0xdeb6('0x5a')]*0x3e8);if(_0x1b1dcd>0x0){_0x1b1dcd=_0x1b1dcd<0x64?0x64:_0x1b1dcd;loggerPredictive[_0xdeb6('0x49')](_0x101faa[_0xdeb6('0x61')],_0xdeb6('0x1df'),_0x1b1dcd,_0xdeb6('0x1e0'));_0x101faa[_0xdeb6('0x64')]=setInterval(function(){_0x249bfe['handlePredictive'](_0x101faa);loggerPredictiveCalls['info']('[handlePredictive]',_0x4f0357+=0x1);},_0x1b1dcd);}else{loggerPredictive[_0xdeb6('0x49')](_0x101faa['name'],_0xdeb6('0x1e1'));}};};Dialer['prototype'][_0xdeb6('0x1e2')]=function(_0x4d9a06,_0x5ed7ed){var _0x3e8678=this;return function(_0x4d73a8){if(_['isEmpty'](_0x4d73a8)){if(_[_0xdeb6('0xfb')](_0x5ed7ed[_0xdeb6('0x158')])||!_0x5ed7ed[_0xdeb6('0x1e3')]){if(_0x4d9a06[_0xdeb6('0xb0')]===_0xdeb6('0x9')){_0x4d9a06[_0xdeb6('0x75')]=_[_0xdeb6('0x40')](_0x4d9a06[_0xdeb6('0x75')])?!![]:_0x4d9a06[_0xdeb6('0x75')];var _0x2310d4=uuid['v4']();_0x3e8678[_0xdeb6('0x24')][_0x2310d4]=new Action(_0x4d9a06,_0x5ed7ed,_0x2310d4);loggerBooked[_0xdeb6('0x49')](_0xdeb6('0x1e4'),_0x2310d4,'queueStatusComplete:\x20',JSON[_0xdeb6('0xa6')](_0x4d9a06['queueStatusComplete']),'Queue:\x20',_0x4d9a06[_0xdeb6('0x61')]);if(_0x4d9a06[_0xdeb6('0x75')]){_0x4d9a06[_0xdeb6('0x75')]=![];_0x3e8678[_0xdeb6('0x2a')][_0x3e8678[_0xdeb6('0x24')][_0x2310d4][_0xdeb6('0xc5')]]=[];ami[_0xdeb6('0x99')]({'actionid':_0x2310d4,'action':_0xdeb6('0x1e5'),'queue':_0x4d9a06[_0xdeb6('0x61')]})[_0xdeb6('0x9f')](function(){_0x3e8678[_0xdeb6('0xc4')](_0x4d9a06);hopperUtils[_0xdeb6('0xe2')]({'active':![],'ContactId':_0x3e8678[_0xdeb6('0x24')][_0x2310d4]['ContactId'],'ListId':_0x3e8678[_0xdeb6('0x24')][_0x2310d4]['ListId'],'VoiceQueueId':_0x3e8678[_0xdeb6('0x24')][_0x2310d4][_0xdeb6('0xe7')]||undefined,'CampaignId':_0x3e8678[_0xdeb6('0x24')][_0x2310d4][_0xdeb6('0xe8')]||undefined})[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0x1e6')));delete _0x3e8678[_0xdeb6('0x24')][_0x2310d4];});}else{loggerBooked[_0xdeb6('0x49')](_0xdeb6('0x1e7'),JSON['stringify'](_0x4d9a06[_0xdeb6('0x75')]),_0xdeb6('0x1e8'),_0x4d9a06['name']);_0x3e8678[_0xdeb6('0xc4')](_0x4d9a06);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x3e8678[_0xdeb6('0x24')][_0x2310d4]['ContactId'],'ListId':_0x3e8678[_0xdeb6('0x24')][_0x2310d4]['ListId'],'VoiceQueueId':_0x3e8678[_0xdeb6('0x24')][_0x2310d4][_0xdeb6('0xe7')]||undefined,'CampaignId':_0x3e8678[_0xdeb6('0x24')][_0x2310d4][_0xdeb6('0xe8')]||undefined})['catch'](loggerCatch(_0xdeb6('0x1e6')));delete _0x3e8678['actions'][_0x2310d4];}}else{return _0x3e8678[_0xdeb6('0x1e9')](_0x4d9a06,_0x5ed7ed);}}else{if(utils[_0xdeb6('0x60')](undefined,_0x5ed7ed[_0xdeb6('0x1ea')])<_0x4d9a06[_0xdeb6('0x1eb')]*0x3c){if(_0x5ed7ed[_0xdeb6('0x149')]&&!_0x5ed7ed[_0xdeb6('0x149')]['voicePause']){_0x3e8678[_0xdeb6('0x1e')][_0xdeb6('0x104')](_0x5ed7ed['id'])[_0xdeb6('0x1d')](function(){_0x3e8678[_0xdeb6('0xc4')](_0x4d9a06);});}else{hopperUtils[_0xdeb6('0x1ec')]({'active':![]},_0x5ed7ed['id'],0x1)[_0xdeb6('0x1d')](function(){_0x3e8678[_0xdeb6('0xc4')](_0x4d9a06);});}}else{_0x4d9a06[_0xdeb6('0x1ed')]+=0x1;_0x3e8678[_0xdeb6('0xc4')](_0x4d9a06);if(_0x4d9a06[_0xdeb6('0x1ee')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5ed7ed[_0xdeb6('0xf4')],'ListId':_0x5ed7ed['ListId'],'VoiceQueueId':_0x5ed7ed[_0xdeb6('0xe7')]||undefined,'CampaignId':_0x5ed7ed[_0xdeb6('0xe8')]||undefined})[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0x1ef')));hopperUtils[_0xdeb6('0xce')](createObjHistory(_0x4d9a06,_0x5ed7ed,utils[_0xdeb6('0x6a')][_0xdeb6('0x1f0')],0x17,'RecallInQueue'))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x3e8678[_0xdeb6('0x11f')](createObjHistory(_0x4d9a06,_0x5ed7ed,utils[_0xdeb6('0x6a')][_0xdeb6('0x1f1')],0x16,'RecallFailedTimeout'),_0xdeb6('0x1f2'),'[Originate][HistoryRecallClose]');}}}}else{_0x4d9a06[_0xdeb6('0x1f3')]+=0x1;_0x3e8678['saveInDb'](createObjHistory(_0x4d9a06,_0x5ed7ed,utils[_0xdeb6('0x6a')]['BLACKLIST'],0xd,_0xdeb6('0x1f4')),_0xdeb6('0x1f5'),_0xdeb6('0x1f6'));throw _0xdeb6('0x1f7');}};};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x1f8')]=function(_0x46d60d){var _0x4af899=this;var _0x522fd3=_0x46d60d[_0xdeb6('0x1f9')]-_0x46d60d[_0xdeb6('0x153')];emitCampaignSummary(_0x46d60d);if(_0x522fd3>0x0&&_0x46d60d[_0xdeb6('0x1fa')]==0x0){if(_0x522fd3>this['maxNumberOriginate']){_0x522fd3=this[_0xdeb6('0x22')];}_0x46d60d[_0xdeb6('0x1fa')]=0x1;hopperUtils[_0xdeb6('0x1fb')](_0x46d60d,_0x522fd3)['then'](function(_0x1b400e){_0x46d60d[_0xdeb6('0x1fa')]=0x0;if(_0x1b400e){if(!utils[_0xdeb6('0x1fc')](_0x1b400e)){_0x46d60d[_0xdeb6('0x6e')]=utils[_0xdeb6('0x6a')][_0xdeb6('0x1fd')];logger[_0xdeb6('0x49')](_0xdeb6('0x1fe')+_0x46d60d[_0xdeb6('0x61')]);}else{_0x46d60d[_0xdeb6('0x153')]+=_0x1b400e[_0xdeb6('0x97')];_0x46d60d['message']=utils[_0xdeb6('0x6a')][_0xdeb6('0x1ff')];for(var _0x484d92=0x0;_0x484d92<_0x1b400e[_0xdeb6('0x97')];_0x484d92+=0x1){_0x46d60d['ivrTotalCallsDays']+=0x1;if(_[_0xdeb6('0xfb')](_0x1b400e[_0x484d92])||_[_0xdeb6('0xfb')](_0x1b400e[_0x484d92][_0xdeb6('0x175')])||_[_0xdeb6('0xfb')](_0x1b400e[_0x484d92][_0xdeb6('0x15e')])){_0x4af899[_0xdeb6('0x156')](_0xdeb6('0x200'),_0x46d60d,_0x1b400e[_0x484d92]);}else{hopperUtils[_0xdeb6('0x201')](_['pick'](_0x1b400e[_0x484d92],['CampaignId',_0xdeb6('0x15e')]))[_0xdeb6('0x3f')](_0x4af899[_0xdeb6('0x1e2')](_0x46d60d,_0x1b400e[_0x484d92]))['catch'](_0x4af899['loggerHandler'](_0xdeb6('0x202'),_0x46d60d));}}}}})[_0xdeb6('0x9f')](loggerGetContactDialer(_0xdeb6('0x203'),_0x46d60d,_0x522fd3));}};Dialer['prototype'][_0xdeb6('0xb2')]=function(_0x4ee24b,_0x273e35){var _0xb727f4=this;var _0x505029=[];if(_0x273e35<0x1||_0x4ee24b[_0xdeb6('0xb0')]===_0xdeb6('0x9')){_0x273e35=0x1;}var _0x4187da=Math['floor'](_0x4ee24b[_0xdeb6('0x1bb')]*_0x273e35)-_0x4ee24b[_0xdeb6('0x153')];if(_0x4ee24b[_0xdeb6('0x204')]>0x0){var _0xd41c44=_0x4ee24b[_0xdeb6('0x204')]-_0x4ee24b['originated']-_0x4ee24b[_0xdeb6('0x141')]-_0x4ee24b[_0xdeb6('0x205')];if(_0x4187da>_0xd41c44){_0x4187da=_0xd41c44;}}if(_0x4187da>0x0&&_0x4ee24b['temp']==0x0){if(_0x4ee24b[_0xdeb6('0xb0')]===_0xdeb6('0x9')){_0x4187da=0x1;}if(_0x4187da>this[_0xdeb6('0x22')]){_0x4187da=this[_0xdeb6('0x22')];}for(var _0x6d0097 in this[_0xdeb6('0xff')]){if(typeof this[_0xdeb6('0xff')][_0x6d0097]!==_0xdeb6('0xa8')){if(this[_0xdeb6('0xff')][_0x6d0097]['state']==='not_inuse'&&this['agents'][_0x6d0097]['status']===_0xdeb6('0x88')){_0x505029[_0xdeb6('0x98')](this['agents'][_0x6d0097]['id']);}}}_0x4ee24b[_0xdeb6('0x1fa')]=0x1;hopperUtils[_0xdeb6('0x206')](_0x4ee24b,_0x505029,_0x4187da)['then'](function(_0x4ebd0c){_0x4ee24b[_0xdeb6('0x1fa')]=0x0;if(_0x4ebd0c){if(!utils[_0xdeb6('0x1fc')](_0x4ebd0c)){hopperUtils[_0xdeb6('0x207')](_0x4ee24b)[_0xdeb6('0x3f')](sendMessageReschedule(_0x4ee24b))[_0xdeb6('0x9f')](loggerCatch(_0xdeb6('0x208')));}else{_0x4ee24b[_0xdeb6('0x153')]+=_0x4ebd0c[_0xdeb6('0x97')];_0x4ee24b[_0xdeb6('0x6e')]=_0x4ee24b[_0xdeb6('0xb0')]===_0xdeb6('0x9')?utils[_0xdeb6('0x6a')]['ACTIVE']:utils['CAMPAIGN_STATUS'][_0xdeb6('0x1ff')];for(var _0x30af31=0x0;_0x30af31<_0x4ebd0c[_0xdeb6('0x97')];_0x30af31+=0x1){if(_[_0xdeb6('0xfb')](_0x4ebd0c[_0x30af31])||_[_0xdeb6('0xfb')](_0x4ebd0c[_0x30af31]['Contact'])||_[_0xdeb6('0xfb')](_0x4ebd0c[_0x30af31][_0xdeb6('0x15e')])){_0xb727f4[_0xdeb6('0x156')]('[actionOriginate]\x20',_0x4ee24b,_0x4ebd0c[_0x30af31]);}else{hopperUtils[_0xdeb6('0x209')](_[_0xdeb6('0x77')](_0x4ebd0c[_0x30af31],['VoiceQueueId',_0xdeb6('0x15e')]))[_0xdeb6('0x3f')](_0xb727f4[_0xdeb6('0x1e2')](_0x4ee24b,_0x4ebd0c[_0x30af31]))[_0xdeb6('0x9f')](_0xb727f4[_0xdeb6('0x155')](_0xdeb6('0x200'),_0x4ee24b));}}}}})[_0xdeb6('0x9f')](loggerGetContactDialer(_0xdeb6('0x20a'),_0x4ee24b,_0x4187da));}};Dialer[_0xdeb6('0x1a')]['handlePredictive']=function(_0x30d0fa){if(_0x30d0fa[_0xdeb6('0x204')]>0x0){var _0x35b247=_0x30d0fa[_0xdeb6('0x204')]-_0x30d0fa[_0xdeb6('0x153')]-_0x30d0fa[_0xdeb6('0x141')];if(_0x35b247>0x0&&_0x30d0fa[_0xdeb6('0x1fa')]==0x0){this['tryOriginatePredictive'](_0x30d0fa);}else{loggerPredictiveCalls[_0xdeb6('0x49')](_0xdeb6('0x20b'));}}else{this['tryOriginatePredictive'](_0x30d0fa);}};Dialer[_0xdeb6('0x1a')][_0xdeb6('0x20c')]=function(_0x269597){var _0x109cf4=this;var _0x20e600=[];_0x269597[_0xdeb6('0x153')]+=0x1;for(var _0x1de39f in this[_0xdeb6('0xff')]){if(typeof this['agents'][_0x1de39f]!==_0xdeb6('0xa8')){if(this[_0xdeb6('0xff')][_0x1de39f][_0xdeb6('0x70')]===_0xdeb6('0x20d')&&this[_0xdeb6('0xff')][_0x1de39f][_0xdeb6('0xfd')]===_0xdeb6('0x88')){_0x20e600[_0xdeb6('0x98')](this[_0xdeb6('0xff')][_0x1de39f]['id']);}}}_0x269597['temp']=0x1;return this['getContactDialer'](_0x269597['id'],_0x20e600,0x1,_0x269597[_0xdeb6('0x20e')],_0x269597)['then'](function(_0x410838){_0x269597[_0xdeb6('0x1fa')]=0x1;if(_0x410838){if(!utils['checkContactEmpty'](_0x410838)){utils[_0xdeb6('0x68')](_0x269597,0x1,0x0);return hopperUtils[_0xdeb6('0x207')](_0x269597)['then'](sendMessageReschedule(_0x269597))['catch'](loggerCatch(_0xdeb6('0x208')));}else{_0x269597['message']=utils[_0xdeb6('0x6a')][_0xdeb6('0x1ff')];if(_[_0xdeb6('0xfb')](_0x410838[0x0])||_[_0xdeb6('0xfb')](_0x410838[0x0][_0xdeb6('0x175')])||_['isNil'](_0x410838[0x0][_0xdeb6('0x15e')])){_0x109cf4['emptyContact']('[actionOriginate]\x20',_0x269597,_0x410838[0x0]);}else{return hopperUtils[_0xdeb6('0x209')](_[_0xdeb6('0x77')](_0x410838[0x0],[_0xdeb6('0xe7'),_0xdeb6('0x15e')]))['then'](_0x109cf4[_0xdeb6('0x1e2')](_0x269597,_0x410838[0x0]))[_0xdeb6('0x9f')](_0x109cf4['loggerHandler'](_0xdeb6('0x20f'),_0x269597));}}}})[_0xdeb6('0x9f')](loggerGetContactDialer('[getContactDialerPredictive]',_0x269597,0x1));};Dialer['prototype'][_0xdeb6('0x210')]=function(_0x421912,_0x21102b,_0x1d7962,_0x22145e,_0x37709d,_0x285b35){loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x211'));loggerPredictive['info'](_0xdeb6('0x212'),_0x421912);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x21102b);loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x213'),_0x1d7962);loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x214'),_0x22145e);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37709d);loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x5e'));return new Promise(function(_0x31e85c,_0x412ad1){if(_0x421912<=0x0||isNaN(_0x421912)){return _0x412ad1(msgResponse(_0xdeb6('0x215'),_0xdeb6('0xc0'),_0xdeb6('0x216')+_0x421912));}if(_0x1d7962<=0x0||isNaN(_0x1d7962)){return _0x412ad1(msgResponse(_0xdeb6('0x215'),'Error',_0xdeb6('0x217')+_0x1d7962));}if(_0x22145e<=0x0||isNaN(_0x22145e)){return _0x412ad1(msgResponse(_0xdeb6('0x215'),_0xdeb6('0xc0'),_0xdeb6('0x218')+_0x22145e));}if(_0x21102b<=0x0||isNaN(_0x21102b)){return _0x412ad1(msgResponse(_0xdeb6('0x215'),_0xdeb6('0xc0'),'interval\x20=\x20'+_0x21102b));}if(_0x37709d<=0x0||isNaN(_0x37709d)){return _0x412ad1(msgResponse(_0xdeb6('0x215'),_0xdeb6('0xc0'),'Amax\x20=\x20'+_0x37709d));}_0x285b35=_0x285b35||0x0;var _0xa4afc4=0x1/_0x1d7962;var _0xb85cc7=0x0;var _0x1c1400=0x0;var _0x423600=0x0;var _0x27ac6a=0x0;for(var _0x3591d3=0x0;_0x423600<_0x37709d;_0x3591d3+=0x1){_0x1c1400=_0x3591d3/_0x21102b;_0xb85cc7=(_0x22145e*_0x1c1400+_0x285b35)/_0xa4afc4;_0x423600=utils[_0xdeb6('0x219')](_0xb85cc7,_0x421912);_0x27ac6a=_0xb85cc7/_0x421912*(0x1-utils[_0xdeb6('0x219')](_0xb85cc7,_0x421912));}return _0x31e85c({'erlangCalls':_0x3591d3,'erlangCallToSecond':_0x21102b/_0x3591d3,'erlangAbandonmentRate':_0x423600,'erlangBusyFactor':_0x27ac6a});});};Dialer['prototype'][_0xdeb6('0x1d6')]=function(_0x5c3e7c,_0x47f4cf,_0x9e5dee,_0x17747a,_0x12c8bd,_0x5f1a99){loggerPredictive['info'](_0xdeb6('0x21a'));loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x212'),_0x5c3e7c);loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x21b'),_0x47f4cf);loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x213'),_0x9e5dee);loggerPredictive[_0xdeb6('0x49')]('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',_0x17747a);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x12c8bd);loggerPredictive[_0xdeb6('0x49')](_0xdeb6('0x5e'));return new Promise(function(_0x4054fa,_0xb9fd18){if(_0x5c3e7c<=0x0||isNaN(_0x5c3e7c)){return _0xb9fd18(msgResponse('[busyFactor]','Error','m\x20=\x20'+_0x5c3e7c));}if(_0x9e5dee<=0x0||isNaN(_0x9e5dee)){return _0xb9fd18(msgResponse(_0xdeb6('0x21c'),_0xdeb6('0xc0'),_0xdeb6('0x217')+_0x9e5dee));}if(_0x17747a<=0x0||isNaN(_0x17747a)){return _0xb9fd18(msgResponse('[busyFactor]',_0xdeb6('0xc0'),_0xdeb6('0x218')+_0x17747a));}if(_0x47f4cf<=0x0||isNaN(_0x47f4cf)){return _0xb9fd18(msgResponse(_0xdeb6('0x21c'),'Error',_0xdeb6('0x21d')+_0x47f4cf));}if(_0x12c8bd<=0x0||isNaN(_0x12c8bd)){return _0xb9fd18(msgResponse(_0xdeb6('0x21c'),_0xdeb6('0xc0'),_0xdeb6('0x21e')+_0x12c8bd));}_0x5f1a99=_0x5f1a99||0x0;var _0x1f20d4=0x1/_0x9e5dee;var _0x149ba5=0x0;var _0x2e2e69=0x0;var _0x36e484=0x0;var _0x11dd5e=0x0;for(var _0x23dc49=0x0;_0x11dd5e<_0x12c8bd;_0x23dc49+=0x1){_0x2e2e69=_0x23dc49/_0x47f4cf;_0x149ba5=(_0x17747a*_0x2e2e69+_0x5f1a99)/_0x1f20d4;_0x36e484=utils[_0xdeb6('0x219')](_0x149ba5,_0x5c3e7c);_0x11dd5e=_0x149ba5/_0x5c3e7c*(0x1-utils[_0xdeb6('0x219')](_0x149ba5,_0x5c3e7c));}return _0x4054fa({'erlangCalls':_0x23dc49,'erlangCallToSecond':_0x47f4cf/_0x23dc49,'erlangAbandonmentRate':_0x36e484,'erlangBusyFactor':_0x11dd5e});});};module[_0xdeb6('0x21f')]=Dialer; \ No newline at end of file +var _0x6fef=['dialAMDActive','value','HANGUP','outboundAnswerCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','outboundAnswerAgiCallsDay','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','MACHINE','Machine','countcongestionretry','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','[uniqueid]','clearZombieChannels','[actions]','Action','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','setXMDContactVariables','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','substring','SIP/%s/%s%s','dialCutDigit','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dialPredictiveOptimization','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','avgHandleTime','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','check\x20failure','startMethodPredictive','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','queueStatusComplete:\x20','queuestatus','[booked][checkContactBlack][else]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','getSeconds','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','checkContactEmpty','RUNNING','ivrTotalCallsDays','Contact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','not_inuse','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/setting','../rpc/interval','./models/action','./models/hangup','env','XCALLY_IP_AGI','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','bind','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','error','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','\x20INTERVAL_IS_NULL','Interval','Intervals','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','isIVRCampaign','campaign:ivr:%s','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','checkIsTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','content','catch','indexOf','true','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','dialTimezone','dialGlobalInterval','silly','intervalIftime','isGlobal','AMI\x20IfTime','syncAgentConnect','queue','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','agiafterat','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','countdropretry','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','add','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','rrmemory','roundrobin','actionid','isNil','paused','stateinterface','locked','pick','idHopper','syncQueueStatusComplete','strategy','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','Agent:\x20','unlockRR','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer'];(function(_0x542657,_0x58f77d){var _0x5dbdcb=function(_0x46451d){while(--_0x46451d){_0x542657['push'](_0x542657['shift']());}};_0x5dbdcb(++_0x58f77d);}(_0x6fef,0x116));var _0xf6fe=function(_0x5df346,_0xe55672){_0x5df346=_0x5df346-0x0;var _0x5e1119=_0x6fef[_0x5df346];return _0x5e1119;};'use strict';var util=require(_0xf6fe('0x0'));var _=require(_0xf6fe('0x1'));var uuid=require(_0xf6fe('0x2'));var moment=require(_0xf6fe('0x3'));var rr=require('rr');var Redis=require(_0xf6fe('0x4'));var utils=require(_0xf6fe('0x5'));var hopperUtils=require(_0xf6fe('0x6'));var ut=require('../preview/util/util');var config=require(_0xf6fe('0x7'));var logger=require(_0xf6fe('0x8'))('dialer');var loggerBooked=require(_0xf6fe('0x8'))(_0xf6fe('0x9'));var loggerPredictive=require(_0xf6fe('0x8'))(_0xf6fe('0xa'));var loggerPredictiveCalls=require(_0xf6fe('0x8'))(_0xf6fe('0xb'));var loggerSyncQueueSummary=require(_0xf6fe('0x8'))('syncQueueSummary');var ami=require(_0xf6fe('0xc'));config['redis']=_[_0xf6fe('0xd')](config[_0xf6fe('0xe')],{'host':_0xf6fe('0xf'),'port':0x18eb});var io=require(_0xf6fe('0x10'))(new Redis(config[_0xf6fe('0xe')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xf6fe('0x11'));var Interval=require(_0xf6fe('0x12'));var Action=require(_0xf6fe('0x13'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0xf6fe('0x14'));var ipAgi=process[_0xf6fe('0x15')][_0xf6fe('0x16')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xf6fe('0x17')][_0xf6fe('0x18')]=function(_0x2da878){this[_0xf6fe('0x19')]=this[_0xf6fe('0x19')]?this[_0xf6fe('0x19')][_0xf6fe('0x1a')](_0x2da878):_0x2da878();};function Dialer(_0x176907,_0x19fb37){this[_0xf6fe('0x1b')]=new Sequence();this[_0xf6fe('0x1c')]=_0x19fb37;this[_0xf6fe('0x1d')]=_0x176907['voiceQueues'];this[_0xf6fe('0x1e')]=_0x176907[_0xf6fe('0x1e')];this[_0xf6fe('0x1f')]=_0x176907[_0xf6fe('0x1f')];this[_0xf6fe('0x20')]=_0x176907['trunks'];this[_0xf6fe('0x21')]=config[_0xf6fe('0x21')]||0x2;this[_0xf6fe('0x22')]={};this[_0xf6fe('0x23')]={};this[_0xf6fe('0x24')]={};this[_0xf6fe('0x25')]={};this[_0xf6fe('0x26')]={};this['startPredictive']={};this[_0xf6fe('0x27')]={};this[_0xf6fe('0x28')]={};this[_0xf6fe('0x29')]={};this[_0xf6fe('0x2a')]={};this[_0xf6fe('0x2b')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xf6fe('0x2c')](this));ami['on']('queuecallerabandon',this[_0xf6fe('0x2d')][_0xf6fe('0x2c')](this));ami['on'](_0xf6fe('0x2e'),this['syncOriginateResponse'][_0xf6fe('0x2c')](this));ami['on'](_0xf6fe('0x2f'),this[_0xf6fe('0x30')]['bind'](this));ami['on'](_0xf6fe('0x31'),this[_0xf6fe('0x32')]['bind'](this));ami['on'](_0xf6fe('0x33'),this[_0xf6fe('0x34')][_0xf6fe('0x2c')](this));ami['on']('hangup',this[_0xf6fe('0x35')][_0xf6fe('0x2c')](this));ami['on']('newexten',this[_0xf6fe('0x36')]['bind'](this));ami['on'](_0xf6fe('0x37'),this[_0xf6fe('0x38')][_0xf6fe('0x2c')](this));ami['on'](_0xf6fe('0x39'),this[_0xf6fe('0x3a')]['bind'](this));ami['on'](_0xf6fe('0x3b'),this['syncQueueStatusComplete'][_0xf6fe('0x2c')](this));this[_0xf6fe('0x3c')]();this['loopClearZombieChannels']();RpcSetting[_0xf6fe('0x3d')]()[_0xf6fe('0x3e')](function(_0x426d5b){previewRecallmeReminderInterval=_0x426d5b[_0xf6fe('0x3f')];});}function isNotNull(_0x22ebfb){return _0x22ebfb!==null&&!_[_0xf6fe('0x40')](_0x22ebfb);}function msgResponse(_0x4cc812,_0x5553f7,_0x36ca2a){return{'action':_0x4cc812,'response':_0x5553f7,'message':_0x36ca2a,'stack':_0x36ca2a};}function emit(_0x44f8ef,_0x2d533b,_0x3949e1){io['to'](_0x44f8ef)['emit'](_0x2d533b,_0x3949e1);}function emitOutboundVoiceQueueSummary(_0x3f4118){if(_0x3f4118[_0xf6fe('0x41')]===_0xf6fe('0x42')){logger[_0xf6fe('0x43')](_0xf6fe('0x44'),util[_0xf6fe('0x45')](_0x3f4118,{'showHidden':![],'depth':null}));emit(util[_0xf6fe('0x46')](_0xf6fe('0x47'),_0x3f4118[_0xf6fe('0x48')]),_0xf6fe('0x49'),_0x3f4118);}}function checkGetDataPredictive(_0x13bdf7){if(isNotNull(_0x13bdf7)&&!_[_0xf6fe('0x4a')](_0x13bdf7)){loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x4c'));loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x4d'),_0x13bdf7[_0xf6fe('0x4e')]);loggerPredictive['info'](_0xf6fe('0x4f'),_0x13bdf7[_0xf6fe('0x50')]);loggerPredictive['info'](_0xf6fe('0x51'),_0x13bdf7[_0xf6fe('0x52')]);loggerPredictive[_0xf6fe('0x4b')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x13bdf7[_0xf6fe('0x53')]);loggerPredictive[_0xf6fe('0x4b')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x13bdf7[_0xf6fe('0x54')]);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x55'),_0x13bdf7['predictiveIntervalAvgTalktime']);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x56'));if(_0x13bdf7['predictiveIntervalTotalCalls']>0x0){if(!_[_0xf6fe('0x40')](_0x13bdf7['predictiveIntervalAvgTalktime'])&&_0x13bdf7[_0xf6fe('0x57')]>0x0){return!![];}loggerPredictive[_0xf6fe('0x4b')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x13bdf7[_0xf6fe('0x54')])&&_0x13bdf7[_0xf6fe('0x54')]>0x0){return!![];}loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x58'));}else{loggerPredictive[_0xf6fe('0x4b')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xf6fe('0x4b')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x402a6b){return function(_0xf8fe08){loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x59'));loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x5a'),_0xf8fe08[_0xf6fe('0x5b')]);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x5c'),_0xf8fe08[_0xf6fe('0x5d')]);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x5e'),_0xf8fe08[_0xf6fe('0x5f')]);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x60'),_0xf8fe08[_0xf6fe('0x61')]);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x5e'),_0xf8fe08['erlangAbandonmentRate']);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x56'));_[_0xf6fe('0x62')](_0x402a6b,_0xf8fe08);};}function ifInterval(_0x372185,_0x25a7fe){if(_[_0xf6fe('0x40')](_0x25a7fe)){return![];}return utils['getSeconds'](undefined,_0x25a7fe)<_0x372185*0x3c;}function clearPredictiveAttributes(_0x4094a9){if(_0x4094a9['startProgressive']){_0x4094a9[_0xf6fe('0x27')]=undefined;loggerPredictive[_0xf6fe('0x43')](_0x4094a9[_0xf6fe('0x48')],'startProgressive\x20value\x20cleared');}if(_0x4094a9['startPredictive']){_0x4094a9[_0xf6fe('0x63')]=undefined;loggerPredictive[_0xf6fe('0x43')](_0x4094a9['name'],_0xf6fe('0x64'));}if(_0x4094a9[_0xf6fe('0x65')]){clearInterval(_0x4094a9['handlePredictive']);_0x4094a9['handlePredictive']=undefined;loggerPredictive[_0xf6fe('0x43')](_0x4094a9['name'],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x19c157,_0x42e1f7){return function(_0x2e85c4){loggerPredictive['error'](_0x42e1f7[_0xf6fe('0x48')],_0x19c157);loggerPredictive['error'](_0x2e85c4['stack']);clearPredictiveAttributes(_0x42e1f7);};}function loggerCatch(_0x73512a){return function(_0xbf9af3){logger[_0xf6fe('0x66')](_0x73512a,util[_0xf6fe('0x45')](_0xbf9af3,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x5aac98,_0x16e678,_0x4a0e4f){return function(_0x57036f){utils[_0xf6fe('0x67')](_0x16e678,_0x4a0e4f,0x0);_0x16e678['temp']=0x0;logger[_0xf6fe('0x66')](_0x5aac98,util[_0xf6fe('0x45')](_0x57036f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x24b2df){return function(_0x42423a){if(isNotNull(_0x42423a)&&isNotNull(_0x42423a[0x0])){if(_0x42423a[0x0][_0xf6fe('0x68')]>0x0){_0x24b2df[_0xf6fe('0x69')]=utils[_0xf6fe('0x6a')][_0xf6fe('0x6b')];logger[_0xf6fe('0x4b')](_0xf6fe('0x6c')+_0x24b2df['name'],_0x42423a[0x0][_0xf6fe('0x68')],'contacts');}else{_0x24b2df['message']=utils[_0xf6fe('0x6a')][_0xf6fe('0x6d')];logger[_0xf6fe('0x4b')]('[getContactDialer2][Empty]'+_0x24b2df[_0xf6fe('0x48')]);}}};}function createObjHistory(_0x5e3ad3,_0x1bb76a,_0x109133,_0x112918,_0x19e2df){_0x5e3ad3[_0xf6fe('0x69')]=_0x109133;var _0x62cdc0=new Action(_0x5e3ad3,_0x1bb76a);var _0xb1883d=new History(_0x62cdc0);_0xb1883d[_0xf6fe('0x6e')]=_0x112918;_0xb1883d[_0xf6fe('0x6f')]=_0x19e2df;_0xb1883d[_0xf6fe('0x70')]=_0x62cdc0[_0xf6fe('0x71')];return _0xb1883d;}function unlockQueueStatus(_0x4af7a6,_0x4c1ffd){setTimeout(function(){if(_[_0xf6fe('0x40')](_0x4af7a6[_0xf6fe('0x72')])){loggerBooked[_0xf6fe('0x66')](_0xf6fe('0x73'),_0x4c1ffd);}_0x4af7a6['queueStatusComplete']=!![];loggerBooked[_0xf6fe('0x4b')](_0xf6fe('0x74'),_0x4c1ffd,JSON[_0xf6fe('0x75')](_['pick'](_0x4af7a6,['name',_0xf6fe('0x72')])));},0x1f3);}function checkInterval(_0x168d6e){return function(){if(!isNotNull(_0x168d6e['Interval'])){_0x168d6e[_0xf6fe('0x69')]=utils[_0xf6fe('0x6a')]['NULL_INTERVAL'];throw _0x168d6e[_0xf6fe('0x48')]+_0xf6fe('0x76');}if(!isNotNull(_0x168d6e[_0xf6fe('0x77')][_0xf6fe('0x78')])){_0x168d6e[_0xf6fe('0x69')]=utils[_0xf6fe('0x6a')][_0xf6fe('0x79')];throw _0x168d6e['name']+_0xf6fe('0x76');}if(!isNotNull(_[_0xf6fe('0x4a')](_0x168d6e[_0xf6fe('0x77')][_0xf6fe('0x78')]))){_0x168d6e[_0xf6fe('0x69')]=utils[_0xf6fe('0x6a')][_0xf6fe('0x79')];throw _0x168d6e[_0xf6fe('0x48')]+_0xf6fe('0x76');}};}function checkIsIVRCampaignActive(_0x527d68){return function(){if(!utils[_0xf6fe('0x7a')](_0x527d68)){_0x527d68[_0xf6fe('0x69')]=utils['CAMPAIGN_STATUS'][_0xf6fe('0x7b')];throw _0x527d68[_0xf6fe('0x48')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x36da19){if(utils[_0xf6fe('0x7c')](_0x36da19)){emit(util[_0xf6fe('0x46')](_0xf6fe('0x7d'),_0x36da19['name']),'campaign:save',_0x36da19);}}function loggerCatchQueueSummary(_0x4e2451,_0x2524d8){return function(_0x760897){clearPredictiveAttributes(_0x2524d8);emitCampaignSummary(_0x2524d8);loggerSyncQueueSummary[_0xf6fe('0x43')](_0x4e2451,util['inspect'](_0x760897,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1e0589){if(_0x1e0589['sendMessageOneNotActive']){if(_0x1e0589[_0xf6fe('0x7e')]===0x0){_0x1e0589[_0xf6fe('0x7f')]=![];_0x1e0589[_0xf6fe('0x69')]=utils[_0xf6fe('0x6a')][_0xf6fe('0x7b')];loggerSyncQueueSummary['debug'](_0xf6fe('0x80'),_0x1e0589['name'],_0xf6fe('0x81'));}else{_0x1e0589['message']=utils[_0xf6fe('0x6a')][_0xf6fe('0x82')];loggerSyncQueueSummary['debug'](_0xf6fe('0x80'),_0x1e0589[_0xf6fe('0x48')],_0xf6fe('0x83'));}emitCampaignSummary(_0x1e0589);}}function myreject(_0x53402b){return function(_0x2420d9){return _0x53402b(msgResponse(_0xf6fe('0x84'),_0xf6fe('0x85'),JSON[_0xf6fe('0x75')](_0x2420d9)));};}Dialer[_0xf6fe('0x17')][_0xf6fe('0x86')]=function(_0x2d18ad){return!_[_0xf6fe('0x40')](_0x2d18ad)&&_0x2d18ad&&!_[_0xf6fe('0x40')](_0x2d18ad[_0xf6fe('0x48')])&&!_[_0xf6fe('0x40')](_0x2d18ad['active'])&&_0x2d18ad[_0xf6fe('0x87')]&&(this[_0xf6fe('0x20')][util[_0xf6fe('0x46')](_0xf6fe('0x88'),_0x2d18ad[_0xf6fe('0x48')])][_0xf6fe('0x89')]===_0xf6fe('0x8a')||this['trunks'][util[_0xf6fe('0x46')]('SIP/%s',_0x2d18ad[_0xf6fe('0x48')])][_0xf6fe('0x89')]==='unmonitored');};Dialer[_0xf6fe('0x17')][_0xf6fe('0x8b')]=function(_0x1d505e){var _0x4114ee=this;return function(){if(!_0x4114ee['isTrunkReachable'](_0x1d505e['Trunk'])){if(!_0x4114ee[_0xf6fe('0x86')](_0x1d505e[_0xf6fe('0x8c')])){_0x1d505e['message']=utils[_0xf6fe('0x6a')][_0xf6fe('0x8d')];throw _0x1d505e[_0xf6fe('0x48')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0xf6fe('0x17')][_0xf6fe('0x8e')]=function(_0x4b5d2b,_0x2eb479,_0x1adf76,_0x3ba408){var _0x120f34=this;return function(){var _0x19d97e=!![];return _0x120f34[_0xf6fe('0x8f')](_0x4b5d2b,_0x2eb479,_0x1adf76,_0x3ba408,_0x19d97e);};};Dialer[_0xf6fe('0x17')][_0xf6fe('0x90')]=function(_0x5c63f2,_0x1498dd,_0x333df2,_0x3e8b8b){var _0x27909c=this;return function(){var _0x2358be=![];return _0x27909c['ifTimeIvr'](_0x5c63f2[_0xf6fe('0x78')],_0x1498dd,_0x333df2,_0x3e8b8b,_0x2358be);};};Dialer[_0xf6fe('0x17')][_0xf6fe('0x8f')]=function(_0x306abf,_0x11d069,_0x2b8ce3,_0x5989f8,_0x5bed8f){var _0x29c2a5=[];return new Promise(function(_0x4a377c,_0x4dff4f){if(!isNotNull(_0x306abf)){_0x5989f8['message']=utils[_0xf6fe('0x6a')]['NULL_INTERVAL'];return _0x4dff4f(msgResponse(_0xf6fe('0x91'),_0xf6fe('0x92'),_0x2b8ce3+_0xf6fe('0x93')));}if(_[_0xf6fe('0x4a')](_0x306abf)){_0x5989f8[_0xf6fe('0x69')]=utils[_0xf6fe('0x6a')][_0xf6fe('0x94')];return _0x4dff4f(msgResponse(_0xf6fe('0x91'),_0xf6fe('0x92'),_0x2b8ce3+'\x20Intervals\x20is\x20empty\x20'));}if(_0x11d069&&_[_0xf6fe('0x40')](config[_0xf6fe('0x95')][_0x11d069])){_0x5989f8[_0xf6fe('0x69')]=utils[_0xf6fe('0x6a')][_0xf6fe('0x96')];return _0x4dff4f(msgResponse(_0xf6fe('0x91'),'Failure',_0x2b8ce3+_0xf6fe('0x97')+_0x11d069));}if(_[_0xf6fe('0x98')](_0x306abf)){for(var _0x5c9b7e=0x0;_0x5c9b7e<_0x306abf[_0xf6fe('0x99')];_0x5c9b7e+=0x1){_0x29c2a5[_0xf6fe('0x9a')](ami['Action']({'action':_0xf6fe('0x9b'),'command':util[_0xf6fe('0x46')](_0xf6fe('0x9c'),_0x306abf[_0x5c9b7e][_0xf6fe('0x9d')],!_[_0xf6fe('0x40')](config[_0xf6fe('0x95')][_0x11d069])?_0x11d069:'')})[_0xf6fe('0x3e')](function(_0x5df198){return _0x5df198[_0xf6fe('0x9e')]['indexOf']('true')>=0x0;})[_0xf6fe('0x9f')](myreject(_0x4dff4f)));}}else{_0x29c2a5['push'](ami['Action']({'action':_0xf6fe('0x9b'),'command':util[_0xf6fe('0x46')](_0xf6fe('0x9c'),_0x306abf,!_['isUndefined'](config[_0xf6fe('0x95')][_0x11d069])?_0x11d069:'')})[_0xf6fe('0x3e')](function(_0x53a702){return _0x53a702[_0xf6fe('0x9e')][_0xf6fe('0xa0')](_0xf6fe('0xa1'))>=0x0;})['catch'](myreject(_0x4dff4f)));}Promise[_0xf6fe('0xa2')](_0x29c2a5)[_0xf6fe('0x3e')](function(_0x3116bf){var _0x6c8422=_[_0xf6fe('0xa3')](_0x3116bf);if(_0x6c8422){return _0x4a377c(_0x6c8422);}else{_0x5989f8[_0xf6fe('0x69')]=_0x5bed8f?utils[_0xf6fe('0x6a')][_0xf6fe('0xa4')]:utils['CAMPAIGN_STATUS'][_0xf6fe('0xa5')];return _0x4dff4f(msgResponse(_0xf6fe('0xa6'),'Failure','Global:\x20'+_0x5bed8f+'\x20'+_0x2b8ce3+_0xf6fe('0xa7')+util[_0xf6fe('0x45')](_0x306abf,{'showHidden':![],'depth':null})+_0xf6fe('0xa8')+_0x11d069));}})[_0xf6fe('0x9f')](function(_0x1e6988){return _0x4dff4f(msgResponse(_0xf6fe('0x91'),_0xf6fe('0x92'),JSON[_0xf6fe('0x75')](_0x1e6988)));});});};Dialer[_0xf6fe('0x17')][_0xf6fe('0x3c')]=function(){var _0x3ff5e5=this;return cmHopper[_0xf6fe('0xa9')]({'active':![]},{'where':{'active':!![]}})[_0xf6fe('0x3e')](function(){setInterval(function(){_0x3ff5e5[_0xf6fe('0xaa')]();},0x3e8);});};Dialer['prototype']['syncCampaigns']=function(){var _0x16d23f=this;var _0x27f597;for(var _0x389da0 in this[_0xf6fe('0x1e')]){if(typeof this[_0xf6fe('0x1e')][_0x389da0]!==_0xf6fe('0xab')){_0x27f597=this['campaigns'][_0x389da0];if(utils['isIVRCampaign'](_0x27f597)&&utils[_0xf6fe('0x7a')](_0x27f597)){_0x27f597[_0xf6fe('0x7f')]=!![];Promise['resolve']()['then'](checkIsIVRCampaignActive(_0x27f597))['then'](checkInterval(_0x27f597))[_0xf6fe('0x3e')](_0x16d23f[_0xf6fe('0x8b')](_0x27f597))[_0xf6fe('0x3e')](_0x16d23f[_0xf6fe('0x8e')](_0x27f597['dialGlobalInterval'],_0x27f597['dialTimezone'],_0x27f597[_0xf6fe('0x48')],_0x27f597))[_0xf6fe('0x3e')](_0x16d23f[_0xf6fe('0x90')](_0x27f597[_0xf6fe('0x77')],_0x27f597['dialTimezone'],_0x27f597['name'],_0x27f597))[_0xf6fe('0x3e')](_0x16d23f['launchHandleIvr'](_0x27f597))[_0xf6fe('0x9f')](loggerCatchQueueSummary(_0xf6fe('0xac'),_0x27f597));}else{notSendMessagesCampaign(_0x27f597);}}}};Dialer['prototype'][_0xf6fe('0xad')]=function(_0x1616cb){if(_0x1616cb[_0xf6fe('0xae')]!==_0xf6fe('0xa')){clearPredictiveAttributes(_0x1616cb);}switch(_0x1616cb[_0xf6fe('0xae')]){case'progressive':this[_0xf6fe('0xaf')](_0x1616cb,0x1);break;case'power':this[_0xf6fe('0xaf')](_0x1616cb,_0x1616cb[_0xf6fe('0xb0')]);break;case _0xf6fe('0xa'):this[_0xf6fe('0xa')](_0x1616cb);break;case _0xf6fe('0x9'):this[_0xf6fe('0xaf')](_0x1616cb,0x1);break;default:logger[_0xf6fe('0x66')](_0xf6fe('0xb1'),_0x1616cb[_0xf6fe('0x48')],_0xf6fe('0xb2'));}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x91')]=function(_0x36e940,_0x469efb){var _0x148197=_0x36e940[_0xf6fe('0xb3')];var _0x2d287c=_0x469efb?_0x36e940[_0xf6fe('0xb4')]:_0x36e940['Interval'][_0xf6fe('0x78')];logger[_0xf6fe('0xb5')]('Dialer::ifTime()',_0x2d287c,_0x148197,_0x36e940['name'],util[_0xf6fe('0x46')]('Voice\x20Queue\x20%s\x20$s',_0x36e940[_0xf6fe('0x48')],_0x36e940['id']));var _0x287fe7=null;return Interval[_0xf6fe('0xb6')](_0x2d287c,_0x148197)['then'](function(_0x3b7eab){if(_0x3b7eab===!![]){return _0x3b7eab;}else{_0x36e940[_0xf6fe('0x69')]=_0x469efb?utils[_0xf6fe('0x6a')][_0xf6fe('0xa4')]:utils[_0xf6fe('0x6a')][_0xf6fe('0xa5')];_0x287fe7=msgResponse(_0xf6fe('0xa6'),_0xf6fe('0x92'),'Global:\x20'+_0x469efb+'\x20'+_0x36e940['name']+_0xf6fe('0xa7')+util['inspect'](_0x2d287c,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x148197);}if(_0x287fe7!==null){logger[_0xf6fe('0xb5')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x287fe7);_0x287fe7[_0xf6fe('0xb7')]=_0x469efb;throw _0x287fe7;}})[_0xf6fe('0x9f')](function(_0x3a260b){logger[_0xf6fe('0x66')](_0xf6fe('0xb8'),_0x3a260b);throw msgResponse('[ifTime][Action]',_0xf6fe('0x85'),util[_0xf6fe('0x45')](_0x3a260b,{'showHidden':![],'depth':null}));});};Dialer[_0xf6fe('0x17')][_0xf6fe('0xb9')]=function(_0x5c87a9){if(this[_0xf6fe('0x1d')][_0x5c87a9[_0xf6fe('0xba')]]){if(this['uniqueId'][_0x5c87a9['uniqueid']]&&this[_0xf6fe('0x25')][_0x5c87a9[_0xf6fe('0xbb')]][_0xf6fe('0x41')]!==_0xf6fe('0xbc')){this[_0xf6fe('0xbd')](this[_0xf6fe('0x1d')][_0x5c87a9[_0xf6fe('0xba')]]);this[_0xf6fe('0x25')][_0x5c87a9['uniqueid']]['answertime']=moment()['format'](_0xf6fe('0xbe'));}}};Dialer['prototype'][_0xf6fe('0x30')]=function(_0x23efc8){var _0x144d30=this[_0xf6fe('0x25')][_0x23efc8[_0xf6fe('0xbb')]];if(this[_0xf6fe('0x1d')][_0x23efc8[_0xf6fe('0xba')]]){if(_0x144d30&&_0x144d30[_0xf6fe('0x41')]!==_0xf6fe('0xbc')){delete this[_0xf6fe('0x25')][_0x23efc8['uniqueid']];this[_0xf6fe('0x1d')][_0x23efc8[_0xf6fe('0xba')]]['outboundAnswerCallsDay']+=0x1;var _0x2c3d0e=new AgentComplete(_0x144d30,_0x23efc8);if(_0x23efc8[_0xf6fe('0xbf')]===_0xf6fe('0xc0')){_0x2c3d0e['agiafterat']=this['voiceQueues'][_0x23efc8[_0xf6fe('0xba')]][_0xf6fe('0xc1')]&&this[_0xf6fe('0x1d')][_0x23efc8[_0xf6fe('0xba')]][_0xf6fe('0xc2')]?moment()[_0xf6fe('0x46')](_0xf6fe('0xbe')):undefined;}hopperUtils[_0xf6fe('0xc3')](_0x2c3d0e)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xc4')));hopperUtils[_0xf6fe('0xc5')](_0x2c3d0e)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xc6')));}}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x2d')]=function(_0x493203){var _0x19196e=this[_0xf6fe('0x25')][_0x493203[_0xf6fe('0xbb')]];var _0x13009e=this;var _0x1fa3de=![];var _0x10544e;var _0x3fe154;if(this[_0xf6fe('0x1d')][_0x493203['queue']]){if(_0x19196e&&_0x19196e[_0xf6fe('0x41')]!==_0xf6fe('0xbc')){delete this[_0xf6fe('0x25')][_0x493203[_0xf6fe('0xbb')]];this[_0xf6fe('0xbd')](this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]]);_0x19196e[_0xf6fe('0xc7')]=moment()[_0xf6fe('0x46')]('YYYY-MM-DD\x20HH:mm:ss');var _0x40bf7c=new QueueCallerAbandon(_0x19196e,_0x493203);if(utils['getSeconds'](_0x19196e[_0xf6fe('0xc7')],_0x19196e[_0xf6fe('0xc8')])>=_0x19196e[_0xf6fe('0xc9')]){this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]][_0xf6fe('0x52')]+=0x1;this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xf6fe('0x1d')][_0x493203['queue']][_0xf6fe('0xca')]+=0x1;_0x40bf7c[_0xf6fe('0x6e')]=0xa;_0x40bf7c[_0xf6fe('0x6f')]=_0xf6fe('0xcb');_0x40bf7c[_0xf6fe('0xcc')]=_0xf6fe('0xcd');_0x40bf7c[_0xf6fe('0xce')]=this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]]['dialQueueProject2']?moment()['format'](_0xf6fe('0xbe')):undefined;_0x40bf7c['countdropretry']+=0x1;_0x40bf7c[_0xf6fe('0xcf')]+=0x1;_0x10544e=this[_0xf6fe('0x1d')][_0x493203['queue']][_0xf6fe('0xd0')];_0x3fe154=this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]][_0xf6fe('0xd1')];hopperUtils[_0xf6fe('0xd2')](_0x40bf7c,_0x40bf7c[_0xf6fe('0x6e')],_0x19196e[_0xf6fe('0xd3')])[_0xf6fe('0x3e')](function(_0x40cb8d){_0x1fa3de=_0x40cb8d[_0xf6fe('0xd4')]==0x1;if(_0x40bf7c['countdropretry']>=_0x13009e[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]][_0xf6fe('0xd5')]){_0x13009e[_0xf6fe('0xd6')](_0x40bf7c,_0x40cb8d[_0xf6fe('0xd4')]);}else{hopperUtils[_0xf6fe('0xd7')]({'active':![],'countdropretry':_0x40bf7c[_0xf6fe('0xd8')],'scheduledat':moment()['add'](_0x13009e['voiceQueues'][_0x493203[_0xf6fe('0xba')]][_0xf6fe('0xd0')],_0xf6fe('0xd9'))['format'](_0xf6fe('0xbe')),'ContactId':_0x19196e[_0xf6fe('0xda')],'ListId':_0x19196e[_0xf6fe('0xdb')],'VoiceQueueId':_0x19196e[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x19196e[_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xde')));var _0x4012f0=new History(_0x40bf7c);_0x4012f0[_0xf6fe('0x6e')]=0xa;_0x4012f0[_0xf6fe('0x6f')]='Drop';_0x4012f0[_0xf6fe('0x71')]=moment()[_0xf6fe('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x4012f0[_0xf6fe('0x70')]=_0x4012f0[_0xf6fe('0x71')];_0x4012f0[_0xf6fe('0xdf')]=_0x40bf7c[_0xf6fe('0xdf')];_0x4012f0['calleridnum']=_0x40bf7c[_0xf6fe('0xe0')];hopperUtils[_0xf6fe('0xc3')](_0x4012f0)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xe1')));}})[_0xf6fe('0x3e')](function(){if(_0x1fa3de)hopperUtils[_0xf6fe('0xe2')](_0x40bf7c,_0x10544e,_0x3fe154)[_0xf6fe('0x3e')](function(){return 0x1;});});}else{this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]][_0xf6fe('0x53')]+=0x1;this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]]['outboundDropCallsDayCallersExit']+=0x1;_0x40bf7c['state']=0xb;_0x40bf7c[_0xf6fe('0x6f')]=_0xf6fe('0xe3');_0x40bf7c[_0xf6fe('0xcc')]='CALLEREXIT';_0x40bf7c[_0xf6fe('0xe4')]+=0x1;_0x40bf7c[_0xf6fe('0xcf')]+=0x1;_0x10544e=this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]][_0xf6fe('0xe5')];_0x3fe154=this[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xf6fe('0xd2')](_0x40bf7c,_0x40bf7c[_0xf6fe('0x6e')],_0x19196e[_0xf6fe('0xd3')])[_0xf6fe('0x3e')](function(_0x3c65d9){if(_0x40bf7c['countabandonedretry']>=_0x13009e[_0xf6fe('0x1d')][_0x493203['queue']][_0xf6fe('0xe6')]){_0x13009e['queueCallerAbandonCreateState'](_0x40bf7c,_0x3c65d9[_0xf6fe('0xd4')]);}else{hopperUtils[_0xf6fe('0xd7')]({'active':![],'countabandonedretry':_0x40bf7c[_0xf6fe('0xe4')],'scheduledat':moment()[_0xf6fe('0xe7')](_0x13009e[_0xf6fe('0x1d')][_0x493203[_0xf6fe('0xba')]][_0xf6fe('0xe5')],_0xf6fe('0xd9'))[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0x19196e[_0xf6fe('0xda')],'ListId':_0x19196e[_0xf6fe('0xdb')],'VoiceQueueId':_0x19196e[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x19196e['CampaignId']||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xe8')));var _0xa64c71=new History(_0x40bf7c);_0xa64c71['state']=0xb;_0xa64c71['statedesc']='Abandoned';_0xa64c71['starttime']=moment()['format'](_0xf6fe('0xbe'));_0xa64c71[_0xf6fe('0x70')]=_0xa64c71[_0xf6fe('0x71')];_0xa64c71[_0xf6fe('0xdf')]=_0x40bf7c[_0xf6fe('0xdf')];_0xa64c71['calleridnum']=_0x40bf7c['calleridnum'];hopperUtils[_0xf6fe('0xc3')](_0xa64c71)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xe9')));}})['then'](function(){if(_0x1fa3de)hopperUtils[_0xf6fe('0xe2')](_0x40bf7c,_0x10544e,_0x3fe154)[_0xf6fe('0x3e')](function(){return 0x1;});});}}}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x36')]=function(_0x2dcd84){if(this[_0xf6fe('0x23')][_0x2dcd84[_0xf6fe('0xbb')]]){this[_0xf6fe('0x23')][_0x2dcd84[_0xf6fe('0xbb')]][_0xf6fe('0xea')]=_0x2dcd84['channel'];}if(this['uniqueId'][_0x2dcd84[_0xf6fe('0xbb')]]){this[_0xf6fe('0x25')][_0x2dcd84[_0xf6fe('0xbb')]][_0xf6fe('0xea')]=_0x2dcd84[_0xf6fe('0xea')];}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x3a')]=function(_0x541662){if(!this[_0xf6fe('0x23')][_0x541662['actionid']]){return;}var _0x707a9c=this[_0xf6fe('0x1d')][this[_0xf6fe('0x23')][_0x541662['actionid']][_0xf6fe('0xba')]]['strategy']||_0xf6fe('0xeb');if(_0x707a9c===_0xf6fe('0xec')){if(this[_0xf6fe('0x23')][_0x541662[_0xf6fe('0xed')]]&&_[_0xf6fe('0xee')](this[_0xf6fe('0x23')][_0x541662['actionid']]['locked'])&&_0x541662[_0xf6fe('0x89')]==='1'&&_0x541662[_0xf6fe('0xef')]==='0'){if(this['agents'][_0x541662[_0xf6fe('0xf0')]]){if(!this['agents'][_0x541662[_0xf6fe('0xf0')]]['locked']){this['agents'][_0x541662[_0xf6fe('0xf0')]]['locked']=!![];this['actions'][_0x541662[_0xf6fe('0xed')]][_0xf6fe('0xf1')]=!![];this['actions'][_0x541662[_0xf6fe('0xed')]][_0xf6fe('0xf0')]=_0x541662[_0xf6fe('0xf0')];}}}}else if(_0x707a9c===_0xf6fe('0xeb')){if(this['actions'][_0x541662[_0xf6fe('0xed')]]){if(this[_0xf6fe('0x1f')][_0x541662[_0xf6fe('0xf0')]]){this['actions'][_0x541662[_0xf6fe('0xed')]][_0xf6fe('0xf0')]=_0x541662['stateinterface'];if(_[_0xf6fe('0xee')](this[_0xf6fe('0x29')][this[_0xf6fe('0x23')][_0x541662['actionid']][_0xf6fe('0xba')]])){this['queueBooked'][this[_0xf6fe('0x23')][_0x541662[_0xf6fe('0xed')]][_0xf6fe('0xba')]]=[];}this[_0xf6fe('0x29')][this[_0xf6fe('0x23')][_0x541662[_0xf6fe('0xed')]][_0xf6fe('0xba')]][_0xf6fe('0x9a')](_[_0xf6fe('0x62')](_[_0xf6fe('0xf2')](this['actions'][_0x541662[_0xf6fe('0xed')]],[_0xf6fe('0xf3'),_0xf6fe('0xf0')]),{'status':_0x541662[_0xf6fe('0x89')],'paused':_0x541662['paused']}));}}}};Dialer[_0xf6fe('0x17')][_0xf6fe('0xf4')]=function(_0x15064f){if(!this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]]){return;}var _0xbe89d=this;var _0x29efbb=this[_0xf6fe('0x1d')][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]];var _0x4262c1=_0x29efbb[_0xf6fe('0xf5')]||_0xf6fe('0xeb');if(_0x4262c1==='roundrobin'){if(this[_0xf6fe('0x23')][_0x15064f['actionid']]&&this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xf0')]){this['preview']['run'](this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xf3')],this['actions'][_0x15064f[_0xf6fe('0xed')]]['stateinterface'])['catch'](function(_0xc0398e){logger[_0xf6fe('0x66')](_0xf6fe('0xf6'),util[_0xf6fe('0x45')](_0xc0398e,{'showHidden':![],'depth':null}));})[_0xf6fe('0x1a')](function(){_0xbe89d['updateOriginated'](_0xbe89d[_0xf6fe('0x1d')][_0xbe89d[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]]);_0xbe89d[_0xf6fe('0x1f')][_0xbe89d[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xf0')]][_0xf6fe('0xf1')]=![];delete _0xbe89d['actions'][_0x15064f[_0xf6fe('0xed')]];unlockQueueStatus(_0x29efbb);});}else{this[_0xf6fe('0xbd')](this[_0xf6fe('0x1d')][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]]['queue']]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]]['ContactId'],'ListId':this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xdb')],'VoiceQueueId':this[_0xf6fe('0x23')][_0x15064f['actionid']][_0xf6fe('0xdc')]||undefined,'CampaignId':this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xdd')]||undefined})['catch'](loggerCatch(_0xf6fe('0xf7')));delete this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]];unlockQueueStatus(_0x29efbb);}}else if(_0x4262c1===_0xf6fe('0xeb')){var _0x3f1f86;if(this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]]&&!_[_0xf6fe('0x4a')](this['queueBooked'][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]]['queue']])){if(this['queueBookedRR'][_0xbe89d[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]]){this[_0xf6fe('0x2a')][_0xbe89d[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]]['queue']]=this[_0xf6fe('0x2a')][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]]['queue']]?this[_0xf6fe('0x2a')][this['actions'][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]]:this[_0xf6fe('0x29')][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]]?this[_0xf6fe('0x29')][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]][_0xf6fe('0xf8')]||0x0:0x0;}this[_0xf6fe('0x29')][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]][_0xf6fe('0xf8')]=this[_0xf6fe('0x2a')][this[_0xf6fe('0x23')][_0x15064f[_0xf6fe('0xed')]][_0xf6fe('0xba')]];for(var _0x49a813=0x0;_0x49a813=_0x34f31e[_0xf6fe('0x120')]){_0x5e19c1[_0xf6fe('0x121')](_0x15e1a8,_0x2a79b5,_0x3b7dd2,_0xf6fe('0x122'));}else{if(_0x15e1a8[_0xf6fe('0x119')]>=_0x34f31e[_0xf6fe('0x123')]){_0x5e19c1[_0xf6fe('0x124')](_0x15e1a8,_0x2a79b5,_0x3b7dd2,'reason\x2019\x20machine....');}else{hopperUtils[_0xf6fe('0xd7')]({'active':![],'countmachineretry':_0x15e1a8[_0xf6fe('0x119')],'scheduledat':moment()['add'](_0x34f31e[_0xf6fe('0x125')],_0xf6fe('0xd9'))[_0xf6fe('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x15e1a8[_0xf6fe('0xda')],'ListId':_0x15e1a8[_0xf6fe('0xdb')],'VoiceQueueId':_0x15e1a8[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x15e1a8['CampaignId']||undefined})['catch'](loggerCatch(_0xf6fe('0x126')));_0x2a79b5({'reschedule':0x1});}}});}if(_0x13a18e[_0xf6fe('0x41')]===_0xf6fe('0xbc')&&this[_0xf6fe('0x1e')][_0x13a18e[_0xf6fe('0xba')]][_0xf6fe('0x10c')]&&_0x518844['value']==='HANGUP'){delete this[_0xf6fe('0x25')][_0x518844[_0xf6fe('0xbb')]];this[_0xf6fe('0xbd')](this[_0xf6fe('0x1e')][_0x13a18e[_0xf6fe('0xba')]]);_0x52ccfb=new Hangup(_0x13a18e,_0x518844);_0x52ccfb[_0xf6fe('0x6e')]=0x12;_0x52ccfb['statedesc']='HangupInAMD';_0x52ccfb[_0xf6fe('0x111')]=_0xf6fe('0x112');ami[_0xf6fe('0x113')]('custom:amd',ut[_0xf6fe('0x115')](_0x52ccfb,_0xf6fe('0x11a')));this[_0xf6fe('0x116')](_0x52ccfb,'[syncHangupInAMDIvr][createHistory]',_0xf6fe('0x127'));}if(_0x13a18e[_0xf6fe('0x41')]===_0xf6fe('0xbc')&&this['campaigns'][_0x13a18e[_0xf6fe('0xba')]]['dialAMDActive']&&_0x518844[_0xf6fe('0x10d')]===_0xf6fe('0x128')){return new Promise(function(_0x18d648,_0x4a0391){delete _0x5e19c1[_0xf6fe('0x25')][_0x518844[_0xf6fe('0xbb')]];_0x5e19c1['updateOriginated'](_0x5e19c1[_0xf6fe('0x1e')][_0x13a18e[_0xf6fe('0xba')]]);_0x5e19c1[_0xf6fe('0x1e')][_0x13a18e[_0xf6fe('0xba')]]['outboundAnswerCallsDay']+=0x1;_0x5e19c1[_0xf6fe('0x1e')][_0x13a18e[_0xf6fe('0xba')]][_0xf6fe('0x118')]+=0x1;var _0x493ffc=_0x5e19c1[_0xf6fe('0x1e')][_0x13a18e[_0xf6fe('0xba')]];var _0xbb1af4=new Hangup(_0x13a18e,_0x518844);_0xbb1af4[_0xf6fe('0x6e')]=0x13;_0xbb1af4[_0xf6fe('0x6f')]=_0xf6fe('0x129');_0xbb1af4[_0xf6fe('0x111')]='AMD';_0xbb1af4[_0xf6fe('0x119')]+=0x1;_0xbb1af4[_0xf6fe('0xcf')]+=0x1;_0xbb1af4[_0xf6fe('0x11a')]=!![];ami['emit'](_0xf6fe('0x114'),ut['buildObj'](_0xbb1af4,_0xf6fe('0x11a')));hopperUtils[_0xf6fe('0xc3')](_0xbb1af4)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x11b')));if(_0xbb1af4[_0xf6fe('0x11c')]+_0xbb1af4[_0xf6fe('0x12a')]+_0xbb1af4[_0xf6fe('0x11d')]+_0xbb1af4[_0xf6fe('0x11e')]+_0xbb1af4[_0xf6fe('0xd8')]+_0xbb1af4[_0xf6fe('0xe4')]+_0xbb1af4[_0xf6fe('0x119')]+_0xbb1af4[_0xf6fe('0x11f')]>=_0x493ffc[_0xf6fe('0x120')]){_0x5e19c1[_0xf6fe('0x121')](_0xbb1af4,_0x18d648,_0x4a0391,_0xf6fe('0x122'));}else{if(_0xbb1af4[_0xf6fe('0x119')]>=_0x493ffc[_0xf6fe('0x123')]){_0x5e19c1[_0xf6fe('0x124')](_0xbb1af4,_0x18d648,_0x4a0391,_0xf6fe('0x12b'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0xbb1af4[_0xf6fe('0x119')],'scheduledat':moment()[_0xf6fe('0xe7')](_0x493ffc[_0xf6fe('0x125')],'minutes')[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0xbb1af4[_0xf6fe('0xda')],'ListId':_0xbb1af4['ListId'],'VoiceQueueId':_0xbb1af4[_0xf6fe('0xdc')]||undefined,'CampaignId':_0xbb1af4['CampaignId']||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x126')));_0x18d648({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x5570e3){var _0xe12d15=this[_0xf6fe('0x25')][_0x5570e3[_0xf6fe('0xbb')]];var _0x161cd9;if(_0xe12d15&&_0xe12d15['type']===_0xf6fe('0xbc')){delete this[_0xf6fe('0x25')][_0x5570e3[_0xf6fe('0xbb')]];this[_0xf6fe('0xbd')](this['campaigns'][_0xe12d15[_0xf6fe('0xba')]]);this[_0xf6fe('0x1e')][_0xe12d15[_0xf6fe('0xba')]][_0xf6fe('0x12c')]+=0x1;_0x161cd9=new Hangup(_0xe12d15,_0x5570e3);hopperUtils[_0xf6fe('0xc3')](_0x161cd9)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x12d')));hopperUtils[_0xf6fe('0xc5')](_0x161cd9)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x12e')));}if(_0xe12d15&&_0xe12d15[_0xf6fe('0x41')]!==_0xf6fe('0xbc')&&isNotNull(this['voiceQueues'][_0xe12d15[_0xf6fe('0xba')]][_0xf6fe('0x12f')])){delete this[_0xf6fe('0x25')][_0x5570e3[_0xf6fe('0xbb')]];this[_0xf6fe('0xbd')](this[_0xf6fe('0x1d')][_0xe12d15['queue']]);this[_0xf6fe('0x1d')][_0xe12d15[_0xf6fe('0xba')]][_0xf6fe('0x10f')]+=0x1;this[_0xf6fe('0x1d')][_0xe12d15['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x161cd9=new Hangup(_0xe12d15,_0x5570e3);_0x161cd9[_0xf6fe('0x6e')]=0x10;_0x161cd9[_0xf6fe('0x6f')]=_0xf6fe('0x130');_0x161cd9[_0xf6fe('0x111')]=_0xf6fe('0x131');hopperUtils[_0xf6fe('0xc3')](_0x161cd9)['catch'](loggerCatch(_0xf6fe('0x12d')));hopperUtils[_0xf6fe('0xc5')](_0x161cd9)[_0xf6fe('0x9f')](loggerCatch('[syncHangupIvr]'));}if(_0xe12d15&&_0xe12d15[_0xf6fe('0x41')]!==_0xf6fe('0xbc')&&!isNotNull(this[_0xf6fe('0x1d')][_0xe12d15[_0xf6fe('0xba')]][_0xf6fe('0x12f')])){delete this['uniqueId'][_0x5570e3[_0xf6fe('0xbb')]];this[_0xf6fe('0xbd')](this[_0xf6fe('0x1d')][_0xe12d15[_0xf6fe('0xba')]]);this[_0xf6fe('0x1d')][_0xe12d15[_0xf6fe('0xba')]]['outboundUnknownCallsDay']+=0x1;_0x161cd9=new Hangup(_0xe12d15,_0x5570e3);_0x161cd9[_0xf6fe('0x6e')]=0xc;_0x161cd9[_0xf6fe('0x6f')]=_0x5570e3[_0xf6fe('0x132')];_0x161cd9[_0xf6fe('0x111')]='Unknow';hopperUtils[_0xf6fe('0xc3')](_0x161cd9)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x12d')));hopperUtils[_0xf6fe('0xc5')](_0x161cd9)[_0xf6fe('0x9f')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xf6fe('0x17')]['syncQueueSummary']=function(_0x1418f9){var _0x589b70=this;if(!_0x589b70[_0xf6fe('0x2b')][_0x1418f9[_0xf6fe('0x48')]]){_0x589b70[_0xf6fe('0x2b')][_0x1418f9[_0xf6fe('0x48')]]={'running':![]};}else if(_0x589b70[_0xf6fe('0x2b')][_0x1418f9[_0xf6fe('0x48')]][_0xf6fe('0x133')]===!![]){return;}else if(_0x589b70[_0xf6fe('0x2b')][_0x1418f9[_0xf6fe('0x48')]][_0xf6fe('0x133')]===![]){_0x589b70[_0xf6fe('0x2b')][_0x1418f9[_0xf6fe('0x48')]][_0xf6fe('0x133')]=!![];}var _0x1e7288=_0x589b70[_0xf6fe('0x1d')][_0x1418f9[_0xf6fe('0x48')]];var _0x4e1442=_0x1e7288['message']!==utils[_0xf6fe('0x6a')]['INACTIVE'];var _0x5c92c7=utils[_0xf6fe('0x134')](_0x1e7288);_0x1e7288[_0xf6fe('0x135')]=utils[_0xf6fe('0x136')](_0x1e7288,_0x589b70[_0xf6fe('0x20')]);Promise[_0xf6fe('0x137')]()[_0xf6fe('0x3e')](function(){if(_0x1e7288[_0xf6fe('0x135')]===utils[_0xf6fe('0x6a')][_0xf6fe('0x7b')]){if(_0x4e1442){clearPredictiveAttributes(_0x1e7288);_0x1418f9[_0xf6fe('0x63')]=undefined;_0x1418f9[_0xf6fe('0x27')]=undefined;}if(_0x1e7288[_0xf6fe('0x135')]===utils[_0xf6fe('0x6a')][_0xf6fe('0x7b')]){_0x1418f9[_0xf6fe('0x138')]=0x0;_0x1418f9[_0xf6fe('0xef')]=0x0;_0x1418f9[_0xf6fe('0x139')]=0x0;_0x1418f9[_0xf6fe('0x13a')]=0x0;_0x1418f9[_0xf6fe('0x13b')]=0x0;}}else if(_0x1e7288[_0xf6fe('0x135')]===utils['CAMPAIGN_STATUS'][_0xf6fe('0x13c')]&&!_0x5c92c7){return _0x589b70['ifTime'](_0x1e7288,!![])[_0xf6fe('0x3e')](function(){return _0x589b70[_0xf6fe('0x91')](_0x1e7288,![]);})['then'](function(){return _0x589b70[_0xf6fe('0xad')](_0x1e7288);})[_0xf6fe('0x9f')](function(_0x4ee0aa){loggerSyncQueueSummary[_0xf6fe('0x43')](_0xf6fe('0x13d'),util['inspect'](_0x4ee0aa,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1e7288);});}else{clearPredictiveAttributes(_0x1e7288);}})[_0xf6fe('0x3e')](function(){var _0x3751fc=_0x1418f9[_0xf6fe('0x13e')](_0x1e7288);if(_0x3751fc||_0x1e7288['queueSummaryCountersUpdated']){_0x1e7288[_0xf6fe('0x13f')]=![];_0x1418f9[_0xf6fe('0x140')](_0x1e7288);Object[_0xf6fe('0x141')](_0x1e7288,_0x1418f9);emitOutboundVoiceQueueSummary(_0x1418f9);}_0x589b70[_0xf6fe('0x2b')][_0x1e7288[_0xf6fe('0x48')]][_0xf6fe('0x133')]=![];})[_0xf6fe('0x9f')](function(_0x596ded){logger['error']('[syncQueueSummary]',util[_0xf6fe('0x45')](_0x596ded,{'showHidden':![],'depth':null}));_0x589b70['queuesSummary'][_0x1e7288[_0xf6fe('0x48')]][_0xf6fe('0x133')]=![];});};Dialer['prototype'][_0xf6fe('0x34')]=_[_0xf6fe('0x142')](function(){var _0x5b1f84=_[_0xf6fe('0x143')](this['voiceQueues'],function(_0x2d84f6){return _0x2d84f6['dialPreviewRecallmeReminder'];});var _0x586655=_['filter'](this[_0xf6fe('0x1f')],function(_0x202503){return _0x202503[_0xf6fe('0x144')]&&_0x202503['status']===_0xf6fe('0x8a');});if(_0x5b1f84[_0xf6fe('0x99')]>0x0&&_0x586655[_0xf6fe('0x99')]>0x0){return Promise[_0xf6fe('0x137')]()[_0xf6fe('0x3e')](cmHopper[_0xf6fe('0x145')](_[_0xf6fe('0x146')](_0x5b1f84,'id'),previewRecallmeReminderInterval,_[_0xf6fe('0x146')](_0x586655,'id')))[_0xf6fe('0x3e')](function(_0xa735f8){for(var _0x143782=0x0;_0x143782<_0xa735f8[_0xf6fe('0x99')];_0x143782++){var _0x31d3d1=_0xa735f8[_0x143782][_0xf6fe('0x147')][_0xf6fe('0x48')];if(_0x31d3d1)io['to'](util['format'](_0xf6fe('0x148'),_0x31d3d1))[_0xf6fe('0x113')](_0xf6fe('0x149'),{'hopper':_0xa735f8[_0x143782]});}})[_0xf6fe('0x9f')](function(_0x1b10f5){logger[_0xf6fe('0x66')](_0xf6fe('0x14a'),_0x1b10f5);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xf6fe('0x17')][_0xf6fe('0x14b')]=function(){var _0x190092=this;setInterval(function(){_0x190092['clearZombieChannels'](_0x190092[_0xf6fe('0x25')],_0xf6fe('0x14c'));_0x190092[_0xf6fe('0x14d')](_0x190092[_0xf6fe('0x23')],_0xf6fe('0x14e'));},0x32c8);};Dialer['prototype'][_0xf6fe('0x14d')]=function(_0x4cd9fd,_0xf9a91b){var _0x46d325=this;for(var _0x5e5a4a in _0x4cd9fd){if(typeof _0x4cd9fd[_0x5e5a4a]!=='undefined'){this[_0xf6fe('0x1b')]['enqueue'](function(){if(!_[_0xf6fe('0xee')](_0x4cd9fd[_0x5e5a4a])){return ami[_0xf6fe('0x14f')]({'action':_0xf6fe('0x89'),'channel':_0x4cd9fd[_0x5e5a4a][_0xf6fe('0xea')]})[_0xf6fe('0x9f')](function(_0x30d07b){if(_0x30d07b['message']===_0xf6fe('0x150')){setTimeout(function(){if(_0x4cd9fd[_0x5e5a4a]&&_0x4cd9fd[_0x5e5a4a][_0xf6fe('0x41')]!==_0xf6fe('0xbc')){_0x46d325[_0xf6fe('0xbd')](_0x46d325[_0xf6fe('0x1d')][_0x4cd9fd[_0x5e5a4a][_0xf6fe('0xba')]]);logger[_0xf6fe('0x66')](_0xf6fe('0x151'),_0xf9a91b,_0x5e5a4a,_0x4cd9fd[_0x5e5a4a][_0xf6fe('0xba')]);delete _0x4cd9fd[_0x5e5a4a];}if(_0x4cd9fd[_0x5e5a4a]&&_0x4cd9fd[_0x5e5a4a][_0xf6fe('0x41')]===_0xf6fe('0xbc')){_0x46d325[_0xf6fe('0xbd')](_0x46d325[_0xf6fe('0x1e')][_0x4cd9fd[_0x5e5a4a]['queue']]);logger[_0xf6fe('0x66')]('[Dialer][checkChannel][ivr]',_0xf9a91b,_0x5e5a4a,_0x4cd9fd[_0x5e5a4a][_0xf6fe('0xba')]);delete _0x4cd9fd[_0x5e5a4a];}},0x2328);}});}});}}};Dialer['prototype'][_0xf6fe('0x152')]=function(_0x570d0d){return Promise['resolve']()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x570d0d))[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x153')));};Dialer[_0xf6fe('0x17')]['updateOriginated']=function(_0x562b67){if(!_[_0xf6fe('0x40')](_0x562b67)&&_0x562b67!==null){if(typeof _0x562b67[_0xf6fe('0x7e')]!=='undefined'){if(_0x562b67[_0xf6fe('0x7e')]>0x0){_0x562b67[_0xf6fe('0x7e')]-=0x1;}else{logger['error'](_0xf6fe('0x154'));}}}else{logger[_0xf6fe('0x66')](_0xf6fe('0x155'));}};Dialer['prototype'][_0xf6fe('0x156')]=function(_0x4839ab,_0x36d318){var _0x3ce70e=this;return function(_0x781ca8){_0x3ce70e[_0xf6fe('0xbd')](_0x36d318);logger[_0xf6fe('0x66')](_0x4839ab,util[_0xf6fe('0x45')](_0x781ca8,{'showHidden':![],'depth':null}));};};Dialer[_0xf6fe('0x17')][_0xf6fe('0x157')]=function(_0x13e890,_0x12a978,_0x2c0bc0){var _0x500896={'state':0x19,'statedesc':_0xf6fe('0x158')};this[_0xf6fe('0xbd')](_0x12a978);this[_0xf6fe('0x116')](_[_0xf6fe('0x62')](_0x500896,_[_0xf6fe('0xf2')](_0x2c0bc0,['ContactId',_0xf6fe('0xdb'),'UserId',_0xf6fe('0xdc'),'CampaignId'])),_0xf6fe('0x159'),'[emptyContact]');logger[_0xf6fe('0x66')](_0x13e890);};Dialer[_0xf6fe('0x17')][_0xf6fe('0x116')]=function(_0x42cd3f,_0x53d8d5,_0x4f9bb7){hopperUtils[_0xf6fe('0xc3')](_0x42cd3f)[_0xf6fe('0x9f')](loggerCatch(_0x53d8d5));hopperUtils['moveContactManagedDialer'](_0x42cd3f)['catch'](loggerCatch(_0x4f9bb7));};Dialer[_0xf6fe('0x17')][_0xf6fe('0xd6')]=function(_0x25fdb9,_0x362ae9){hopperUtils[_0xf6fe('0xc3')](_0x25fdb9)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xc4')));if(_0x362ae9==0x0){hopperUtils[_0xf6fe('0xc5')](_0x25fdb9)['catch'](loggerCatch(_0xf6fe('0x15a')));}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x14a')]=function(_0x24bd44){return Promise[_0xf6fe('0x137')]()['then'](cmHopper[_0xf6fe('0x145')](_0x24bd44['id'],previewRecallmeReminderInterval))[_0xf6fe('0x3e')](function(_0x562bf7){for(var _0x30e15d=0x0;_0x30e15d<_0x562bf7[_0xf6fe('0x99')];_0x30e15d++){var _0x1e7dab=_0x562bf7[_0x30e15d]['Agent'][_0xf6fe('0x48')];if(_0x1e7dab)io['to'](util[_0xf6fe('0x46')]('user:%s',_0x1e7dab))[_0xf6fe('0x113')](_0xf6fe('0x149'),{'hopper':_0x562bf7[_0x30e15d]});}})['catch'](function(){});};Dialer[_0xf6fe('0x17')]['launchHandleIvr']=function(_0x2ffe28){var _0x156775=this;return function(){_0x156775[_0xf6fe('0x15b')](_0x2ffe28);};};Dialer['prototype']['actionOriginate']=function(_0x151a8b,_0x344df0){var _0x45f2f2=this;var _0x1f0414=uuid['v4']();this[_0xf6fe('0x23')][_0x1f0414]=new Action(_0x151a8b,_0x344df0,_0x1f0414);return new Promise(function(_0x24913b,_0x4a7689){if(_['isUndefined'](_0x151a8b)&&typeof _0x151a8b!==_0xf6fe('0x15c')){return _0x4a7689(msgResponse(_0xf6fe('0x15d'),_0xf6fe('0x92'),_0xf6fe('0x15e')));}if(_['isUndefined'](_0x344df0['phone'])||_0x344df0[_0xf6fe('0x15f')]===null){return _0x4a7689(msgResponse(_0xf6fe('0x15d'),_0xf6fe('0x92'),_0xf6fe('0x160')));}var _0x50aafb={'XMD-CALLERID':_0x45f2f2[_0xf6fe('0x23')][_0x1f0414][_0xf6fe('0x161')](),'XMD-AGI':_0x151a8b[_0xf6fe('0x12f')]?util['format'](_0xf6fe('0x162'),ipAgi,_0x151a8b[_0xf6fe('0x12f')]):_0xf6fe('0x163'),'XMD-AGIAFTER':_0x151a8b['dialQueueProject2']?util[_0xf6fe('0x46')](_0xf6fe('0x162'),ipAgi,_0x151a8b['dialQueueProject2']):_0xf6fe('0x163'),'XMD-QUEUE':utils[_0xf6fe('0x164')](_0x151a8b)?util[_0xf6fe('0x46')](_0xf6fe('0x165'),_0x151a8b['name'],_0x151a8b[_0xf6fe('0x166')]||'',_0x151a8b['dialAgiAfterHangupAgent']?'c':'',_0x151a8b[_0xf6fe('0xc9')]||0x3):_0xf6fe('0x163'),'XMD-CONTACTID':_0x344df0[_0xf6fe('0xda')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x45f2f2[_0xf6fe('0x23')][_0x1f0414][_0xf6fe('0x161')](),'XMD-AMD':_0x151a8b['dialAMDActive']?'ACTIVE':_0xf6fe('0x163'),'XMD-DESTINATION':_0xf6fe('0x10b')};if(_0x151a8b[_0xf6fe('0x10c')]){_0x50aafb['XMD-AMDINITIALSILENCE']=_0x151a8b[_0xf6fe('0x167')]||0x9c4;_0x50aafb['XMD-AMDGREETING']=_0x151a8b[_0xf6fe('0x168')]||0x5dc;_0x50aafb[_0xf6fe('0x169')]=_0x151a8b[_0xf6fe('0x16a')]||0x320;_0x50aafb[_0xf6fe('0x16b')]=_0x151a8b[_0xf6fe('0x16c')]||0x1388;_0x50aafb[_0xf6fe('0x16d')]=_0x151a8b[_0xf6fe('0x16e')]||0x64;_0x50aafb[_0xf6fe('0x16f')]=_0x151a8b[_0xf6fe('0x170')]||0x32;_0x50aafb[_0xf6fe('0x171')]=_0x151a8b['dialAMDMaximumNumberOfWords']||0x3;_0x50aafb[_0xf6fe('0x172')]=_0x151a8b[_0xf6fe('0x173')]||0x100;_0x50aafb['XMD-AMDMAXIMUMWORDLENGTH']=_0x151a8b[_0xf6fe('0x174')]||0x1388;}if(utils[_0xf6fe('0x164')](_0x151a8b)){_0x50aafb['XMD-VOICEQUEUEID']=_0x344df0[_0xf6fe('0xdc')];}else{_0x50aafb['XMD-CAMPAIGNID']=_0x344df0[_0xf6fe('0xdd')];}var _0x309c10=utils[_0xf6fe('0x175')](_0x344df0['Contact']);Object[_0xf6fe('0x141')](_0x50aafb,_0x309c10);var _0x426f45=_0x45f2f2[_0xf6fe('0x86')](_0x151a8b[_0xf6fe('0x176')])?utils[_0xf6fe('0x177')](_0x151a8b[_0xf6fe('0x176')][_0xf6fe('0x178')],_0x151a8b[_0xf6fe('0x179')],_0x151a8b[_0xf6fe('0x17a')]>0x0?utils['getCallerIdRandom'](_0x151a8b[_0xf6fe('0x17b')],_0x151a8b[_0xf6fe('0x17a')]):_0x151a8b[_0xf6fe('0x17b')]):utils[_0xf6fe('0x177')](_[_0xf6fe('0xee')](_0x151a8b[_0xf6fe('0x8c')])?_0x151a8b[_0xf6fe('0x176')]['callerid']:_0x151a8b[_0xf6fe('0x8c')][_0xf6fe('0x178')],_0x151a8b[_0xf6fe('0x179')],_0x151a8b[_0xf6fe('0x17a')]>0x0?utils['getCallerIdRandom'](_0x151a8b[_0xf6fe('0x17b')],_0x151a8b[_0xf6fe('0x17a')]):_0x151a8b[_0xf6fe('0x17b')]);if(_0x426f45){_0x50aafb['XMD-ORIGINATECALLERIDNAME']=_0x45f2f2[_0xf6fe('0x23')][_0x1f0414][_0xf6fe('0x17c')]=utils['extractCalleridName'](_0x426f45);_0x50aafb[_0xf6fe('0x17d')]=_0x344df0['phone'];}_0x151a8b[_0xf6fe('0x17e')]=_0x50aafb;return ami['Action']({'actionid':_0x1f0414,'action':_0xf6fe('0x15d'),'channel':_0x45f2f2[_0xf6fe('0x86')](_0x151a8b[_0xf6fe('0x176')])?util['format']('SIP/%s/%s%s',_0x151a8b['Trunk'][_0xf6fe('0x48')],isNotNull(_0x151a8b[_0xf6fe('0x17f')])?_0x151a8b[_0xf6fe('0x17f')][_0xf6fe('0x180')]()||'':'',_0x151a8b['dialCutDigit']>0x0?_0x344df0['phone'][_0xf6fe('0x181')](_0x151a8b['dialCutDigit']):_0x344df0[_0xf6fe('0x15f')]):util[_0xf6fe('0x46')](_0xf6fe('0x182'),_[_0xf6fe('0xee')](_0x151a8b['TrunkBackup'])?_0x151a8b[_0xf6fe('0x176')][_0xf6fe('0x48')]:_0x151a8b[_0xf6fe('0x8c')][_0xf6fe('0x48')],isNotNull(_0x151a8b[_0xf6fe('0x17f')])?_0x151a8b[_0xf6fe('0x17f')][_0xf6fe('0x180')]()||'':'',_0x151a8b[_0xf6fe('0x183')]>0x0?_0x344df0['phone']['substring'](_0x151a8b[_0xf6fe('0x183')]):_0x344df0[_0xf6fe('0x15f')]),'callerid':_0x426f45,'Exten':_0xf6fe('0x10b'),'Context':'from-sip','Priority':'1','variable':_0x50aafb,'timeout':(_0x151a8b[_0xf6fe('0x184')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1f0414})[_0xf6fe('0x3e')](function(_0x2d138e){return _0x24913b(_0x2d138e);})['catch'](function(_0x3239f4){_0x151a8b[_0xf6fe('0x185')]+=0x1;var _0x8048b5=new History(_0x45f2f2[_0xf6fe('0x23')][_0x1f0414]);logger[_0xf6fe('0x66')](util[_0xf6fe('0x46')](_0xf6fe('0x186'),JSON[_0xf6fe('0x75')](_0x3239f4)));_0x8048b5[_0xf6fe('0x6e')]=0xe;_0x8048b5['statedesc']=_0xf6fe('0x187');_0x8048b5[_0xf6fe('0x71')]=moment()[_0xf6fe('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x8048b5['endtime']=_0x8048b5['starttime'];hopperUtils[_0xf6fe('0xc3')](_0x8048b5)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x188')));_0x45f2f2[_0xf6fe('0xc5')](_0x8048b5)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x188')))['finally'](function(){delete _0x45f2f2[_0xf6fe('0x23')][_0x1f0414];return _0x4a7689(msgResponse(_0xf6fe('0x15d'),'Error',_0xf6fe('0x189')));});});});};Dialer['prototype'][_0xf6fe('0x18a')]=function(_0x32931c,_0x517456,_0x50447f){var _0x3114d5=new History(_0x517456);if(_0x3114d5[_0xf6fe('0x11c')]+_0x3114d5[_0xf6fe('0x12a')]+_0x3114d5['countnoanswerretry']+_0x3114d5[_0xf6fe('0x11e')]+_0x3114d5[_0xf6fe('0xd8')]+_0x3114d5[_0xf6fe('0xe4')]+_0x3114d5['countmachineretry']+_0x3114d5[_0xf6fe('0x11f')]>=_0x50447f[_0xf6fe('0x120')]-0x1){return!![];}switch(_0x32931c){case 0x3:if(_0x3114d5[_0xf6fe('0x11d')]>=_0x50447f[_0xf6fe('0x18b')]-0x1){return!![];}hopperUtils[_0xf6fe('0xd7')]({'active':![],'countnoanswerretry':_0x3114d5[_0xf6fe('0x11d')]+=0x1,'scheduledat':moment()[_0xf6fe('0xe7')](_0x50447f[_0xf6fe('0x18c')],_0xf6fe('0xd9'))['format'](_0xf6fe('0xbe')),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x3114d5[_0xf6fe('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x3114d5[_0xf6fe('0x11c')]>=_0x50447f[_0xf6fe('0x18d')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x3114d5[_0xf6fe('0x11c')]+=0x1,'scheduledat':moment()[_0xf6fe('0xe7')](_0x50447f['dialBusyRetryFrequency'],_0xf6fe('0xd9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x3114d5[_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x18e')));break;case 0x8:if(_0x3114d5['countcongestionretry']>=_0x50447f[_0xf6fe('0x18f')]-0x1){return!![];}hopperUtils[_0xf6fe('0xd7')]({'active':![],'countcongestionretry':_0x3114d5[_0xf6fe('0x12a')]+=0x1,'scheduledat':moment()['add'](_0x50447f[_0xf6fe('0x190')],'minutes')[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x3114d5[_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x191')));break;case 0x0:if(_0x3114d5[_0xf6fe('0x11e')]>=_0x50447f['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0xf6fe('0xd7')]({'active':![],'countnosuchnumberretry':_0x3114d5[_0xf6fe('0x11e')]+=0x1,'scheduledat':moment()[_0xf6fe('0xe7')](_0x50447f['dialNoSuchNumberRetryFrequency'],_0xf6fe('0xd9'))[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x3114d5[_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x192')));}break;case 0xa:if(_0x3114d5['countdropretry']>=_0x50447f['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0xf6fe('0xd7')]({'active':![],'countdropretry':_0x3114d5[_0xf6fe('0xd8')]+=0x1,'scheduledat':moment()[_0xf6fe('0xe7')](_0x50447f[_0xf6fe('0xd0')],'minutes')[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x3114d5[_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0xde')));break;case 0xb:if(_0x3114d5['countabandonedretry']>=_0x50447f[_0xf6fe('0xe6')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x3114d5['countabandonedretry']+=0x1,'scheduledat':moment()[_0xf6fe('0xe7')](_0x50447f[_0xf6fe('0xe5')],_0xf6fe('0xd9'))[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x3114d5['CampaignId']||undefined})['catch'](loggerCatch(_0xf6fe('0xe8')));break;case 0x13:if(_0x3114d5[_0xf6fe('0x119')]>=_0x50447f[_0xf6fe('0x123')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3114d5[_0xf6fe('0x119')]+=0x1,'scheduledat':moment()[_0xf6fe('0xe7')](_0x50447f[_0xf6fe('0x125')],_0xf6fe('0xd9'))[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x3114d5[_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x3114d5['countagentrejectretry']>=_0x50447f['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0xf6fe('0xd7')]({'active':![],'countagentrejectretry':_0x3114d5[_0xf6fe('0x11f')]+=0x1,'scheduledat':moment()[_0xf6fe('0xe7')](_0x50447f[_0xf6fe('0x193')],'minutes')[_0xf6fe('0x46')](_0xf6fe('0xbe')),'ContactId':_0x3114d5[_0xf6fe('0xda')],'ListId':_0x3114d5[_0xf6fe('0xdb')],'VoiceQueueId':_0x3114d5['VoiceQueueId']||undefined,'CampaignId':_0x3114d5[_0xf6fe('0xdd')]||undefined})['catch'](loggerCatch(_0xf6fe('0x194')));break;default:return!![];}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x106')]=function(_0x325680,_0x565803,_0x345fb1){var _0x450247=this;var _0x45e88e=new History(_0x325680);var _0x4538ff=![];var _0x43ed70;var _0x14d1c7;return new Promise(function(_0x2fa574,_0x42f7bc){if(_[_0xf6fe('0x40')](_0x565803)&&typeof _0x565803!==_0xf6fe('0x15c')){return _0x42f7bc(msgResponse(_0xf6fe('0x195'),_0xf6fe('0x92'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x345fb1)&&typeof _0x345fb1!==_0xf6fe('0x15c')){return _0x42f7bc(msgResponse(_0xf6fe('0x195'),_0xf6fe('0x92'),_0xf6fe('0x196')));}hopperUtils[_0xf6fe('0xd2')](_0x45e88e,_0x345fb1[_0xf6fe('0xbf')],_0x565803)[_0xf6fe('0x3e')](function(_0x5653ec){if(_0x5653ec[_0xf6fe('0xd4')]==0x1)_0x4538ff=!![];switch(_0x345fb1[_0xf6fe('0xbf')]){case'0':_0x565803[_0xf6fe('0x197')]+=0x1;_0x45e88e[_0xf6fe('0x6e')]=0x0;_0x45e88e['statedesc']=_0xf6fe('0x198');_0x45e88e[_0xf6fe('0x11e')]+=0x1;_0x45e88e[_0xf6fe('0xcf')]+=0x1;ami[_0xf6fe('0x113')](_0xf6fe('0x199'),ut['buildObj'](_0x325680,_0xf6fe('0x19a')));_0x43ed70=_0x565803['dialNoSuchNumberRetryFrequency'];_0x14d1c7=_0x565803[_0xf6fe('0xd1')];hopperUtils[_0xf6fe('0xc3')](_0x45e88e)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x11b')));if(_0x450247['checkRetriveMax'](0x0,_0x325680,_0x565803)&&!_0x4538ff){if(_0x45e88e['countnosuchnumberretry']>=_0x565803[_0xf6fe('0x19b')]){_0x450247['createStateFinal'](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x19c'));}else{_0x450247[_0xf6fe('0x121')](_0x45e88e,_0x2fa574,_0x42f7bc,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x565803[_0xf6fe('0x19d')]+=0x1;_0x45e88e[_0xf6fe('0x6e')]=0x3;_0x45e88e[_0xf6fe('0x6f')]=_0xf6fe('0x19e');_0x45e88e['countnoanswerretry']+=0x1;_0x45e88e['countglobal']+=0x1;var _0x3fa7d8=ut[_0xf6fe('0x19f')](_0x325680,_0x565803);ami[_0xf6fe('0x113')](_0xf6fe('0x1a0'),_0x3fa7d8);_0x43ed70=_0x565803[_0xf6fe('0x18c')];_0x14d1c7=_0x565803[_0xf6fe('0xd1')];hopperUtils[_0xf6fe('0xc3')](_0x45e88e)[_0xf6fe('0x9f')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x450247[_0xf6fe('0x18a')](0x3,_0x325680,_0x565803)&&!_0x4538ff){if(_0x45e88e[_0xf6fe('0x11d')]>=_0x565803['dialNoAnswerMaxRetry']){_0x450247[_0xf6fe('0x124')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1a1'));}else{_0x450247[_0xf6fe('0x121')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1a1'));}}break;case'5':_0x565803[_0xf6fe('0x1a2')]+=0x1;_0x45e88e['state']=0x5;_0x45e88e['statedesc']=_0xf6fe('0x1a3');_0x45e88e[_0xf6fe('0x11c')]+=0x1;_0x45e88e[_0xf6fe('0xcf')]+=0x1;ami[_0xf6fe('0x113')](_0xf6fe('0x1a4'),ut[_0xf6fe('0x115')](_0x325680,_0xf6fe('0x1a5')));_0x43ed70=_0x565803[_0xf6fe('0x1a6')];_0x14d1c7=_0x565803[_0xf6fe('0xd1')];hopperUtils['createHistory'](_0x45e88e)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x1a7')));if(_0x450247[_0xf6fe('0x18a')](0x5,_0x325680,_0x565803)&&!_0x4538ff){if(_0x45e88e['countbusyretry']>=_0x565803[_0xf6fe('0x18d')]){_0x450247['createStateFinal'](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1a8'));}else{_0x450247[_0xf6fe('0x121')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1a8'));}}break;case'8':_0x565803[_0xf6fe('0x1a9')]+=0x1;_0x45e88e[_0xf6fe('0x6e')]=0x8;_0x45e88e[_0xf6fe('0x6f')]=_0xf6fe('0x1aa');_0x45e88e[_0xf6fe('0x12a')]+=0x1;_0x45e88e[_0xf6fe('0xcf')]+=0x1;_0x43ed70=_0x565803['dialCongestionRetryFrequency'];_0x14d1c7=_0x565803[_0xf6fe('0xd1')];ami[_0xf6fe('0x113')]('custom:agentcongestion',ut['buildObj'](_0x325680,_0xf6fe('0x1ab')));hopperUtils[_0xf6fe('0xc3')](_0x45e88e)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x1ac')));if(_0x450247['checkRetriveMax'](0x8,_0x325680,_0x565803)&&!_0x4538ff){if(_0x45e88e['countcongestionretry']>=_0x565803[_0xf6fe('0x18f')]){_0x450247[_0xf6fe('0x124')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1ad'));}else{_0x450247[_0xf6fe('0x121')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1ad'));}}break;case'11':_0x565803[_0xf6fe('0x1ae')]+=0x1;_0x45e88e[_0xf6fe('0x6e')]=0xb;_0x45e88e['statedesc']='Abandoned';_0x45e88e[_0xf6fe('0xe4')]+=0x1;_0x45e88e[_0xf6fe('0xcf')]+=0x1;_0x43ed70=_0x565803[_0xf6fe('0xe5')];_0x14d1c7=_0x565803[_0xf6fe('0xd1')];hopperUtils[_0xf6fe('0xc3')](_0x45e88e)[_0xf6fe('0x9f')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x450247[_0xf6fe('0x18a')](0xb,_0x325680,_0x565803)&&!_0x4538ff){if(_0x45e88e[_0xf6fe('0xe4')]>=_0x565803['dialAbandonedMaxRetry']){_0x450247['createStateFinal'](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1af'));}else{_0x450247[_0xf6fe('0x121')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1af'));}}break;case'20':_0x565803['outboundRejectCallsDay']+=0x1;_0x45e88e[_0xf6fe('0x6e')]=0x14;_0x45e88e[_0xf6fe('0x6f')]=_0xf6fe('0x1b0');_0x45e88e[_0xf6fe('0x11f')]+=0x1;_0x45e88e[_0xf6fe('0xcf')]+=0x1;_0x43ed70=_0x565803[_0xf6fe('0x193')];_0x14d1c7=_0x565803[_0xf6fe('0xd1')];ami[_0xf6fe('0x113')](_0xf6fe('0x1b1'),ut['buildObj'](_0x325680,_0xf6fe('0x1b2')));hopperUtils[_0xf6fe('0xc3')](_0x45e88e)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x1b3')));if(_0x450247[_0xf6fe('0x18a')](0x14,_0x325680,_0x565803)&&!_0x4538ff){if(_0x45e88e[_0xf6fe('0x11f')]>=_0x565803['dialAgentRejectMaxRetry']){_0x450247[_0xf6fe('0x124')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1b4'));}else{_0x450247[_0xf6fe('0x121')](_0x45e88e,_0x2fa574,_0x42f7bc,_0xf6fe('0x1b4'));}}break;default:_0x565803[_0xf6fe('0x1b5')]+=0x1;_0x45e88e[_0xf6fe('0x6e')]=0xc;_0x45e88e['statedesc']=_0x345fb1[_0xf6fe('0xbf')];_0x43ed70=_0x565803['dialAgentRejectRetryFrequency'];_0x14d1c7=_0x565803[_0xf6fe('0xd1')];hopperUtils['createHistory'](_0x45e88e)[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x1b6')));if(_0x450247[_0xf6fe('0x18a')](_0x345fb1['reason'],_0x325680,_0x565803)&&!_0x4538ff){if(_0x45e88e['countbusyretry']+_0x45e88e[_0xf6fe('0x12a')]+_0x45e88e[_0xf6fe('0x11d')]+_0x45e88e[_0xf6fe('0x11e')]+_0x45e88e['countdropretry']+_0x45e88e[_0xf6fe('0xe4')]+_0x45e88e[_0xf6fe('0x119')]+_0x45e88e[_0xf6fe('0x11f')]>=_0x565803[_0xf6fe('0x120')]){_0x450247[_0xf6fe('0x121')](_0x45e88e,_0x2fa574,_0x42f7bc,_0x345fb1[_0xf6fe('0xbf')]);}else{_0x450247[_0xf6fe('0x124')](_0x45e88e,_0x2fa574,_0x42f7bc,_0x345fb1[_0xf6fe('0xbf')]);}}}})[_0xf6fe('0x3e')](function(){if(_0x4538ff){hopperUtils[_0xf6fe('0xe2')](_0x45e88e,_0x43ed70,_0x14d1c7)[_0xf6fe('0x3e')](function(){return _0x2fa574(0x1);});}});});};Dialer[_0xf6fe('0x17')][_0xf6fe('0x121')]=function(_0x2a2883,_0x35e81b,_0x2335da,_0x338ac2){var _0x187c04=new Final(_0x2a2883);_0x187c04['state']=0xf;_0x187c04[_0xf6fe('0x6f')]=_0xf6fe('0x1b7');this[_0xf6fe('0x124')](_0x187c04,_0x35e81b,_0x2335da,_0x338ac2);};Dialer[_0xf6fe('0x17')][_0xf6fe('0x124')]=function(_0x3875eb,_0x4239cd,_0x18e374,_0x545d96){hopperUtils['moveContactManagedDialer'](_0x3875eb)[_0xf6fe('0x3e')](function(){return _0x4239cd(msgResponse(_0xf6fe('0x195'),_0xf6fe('0x105'),_0x545d96));})[_0xf6fe('0x9f')](function(){return _0x18e374(msgResponse('[moveContactManagedDialer][0]',_0xf6fe('0x92'),_0xf6fe('0x1b8')));});};Dialer[_0xf6fe('0x17')]['predictive']=function(_0x4692c4){var _0x4b8b07=_0x4692c4[_0xf6fe('0x1b9')]/0x64;var _0x4e5516=_0x4692c4[_0xf6fe('0x1ba')]/(_0x4692c4[_0xf6fe('0x1ba')]+_0x4692c4['outboundAnswerCallsDay']);var _0x37356=Math[_0xf6fe('0x1bb')](_0x4692c4[_0xf6fe('0x1bc')]*(_0x4692c4[_0xf6fe('0x1bd')]/0x64));var _0xae3410=Math['round'](_0x4692c4[_0xf6fe('0x1bc')]*(_0x4692c4[_0xf6fe('0x1be')]/0x64));var _0x2df739=_0x4692c4['available']+_0x4692c4['talking'];var _0x4a878b=Math[_0xf6fe('0x1bf')](_0x4692c4[_0xf6fe('0x5b')]*_0x4692c4[_0xf6fe('0x5f')]*_0x4692c4[_0xf6fe('0x1c0')]*_0x4692c4[_0xf6fe('0x1c1')]);if(_[_0xf6fe('0x40')](_0x4692c4[_0xf6fe('0x27')])){if(!_[_0xf6fe('0x40')](_0x4692c4[_0xf6fe('0x63')])){_0x4692c4['startPredictive']=undefined;loggerPredictive[_0xf6fe('0x66')](_0xf6fe('0x1c2'),_0xf6fe('0x1c3'));}if(!_[_0xf6fe('0x40')](_0x4692c4['handlePredictive'])){loggerPredictive[_0xf6fe('0x66')](_0xf6fe('0x1c2'),_0xf6fe('0x1c4'));clearInterval(_0x4692c4[_0xf6fe('0x65')]);_0x4692c4[_0xf6fe('0x65')]=undefined;}_0x4692c4[_0xf6fe('0x27')]=moment()[_0xf6fe('0x46')](_0xf6fe('0xbe'));loggerPredictive[_0xf6fe('0x4b')](_0x4692c4[_0xf6fe('0x48')],_0xf6fe('0x1c5'),_0x4692c4[_0xf6fe('0x27')]);this['handlePower'](_0x4692c4,0x1);}else if(ifInterval(_0x4692c4[_0xf6fe('0x1c6')],_0x4692c4['startProgressive'])){this[_0xf6fe('0xaf')](_0x4692c4,0x1);loggerPredictiveCalls[_0xf6fe('0x4b')](_0xf6fe('0x1c7'),_0x4692c4['startProgressive'],_0x4692c4[_0xf6fe('0x48')]);_0x4692c4[_0xf6fe('0x5b')]=0x0;_0x4692c4[_0xf6fe('0xca')]=0x0;}else if(_0x4b8b07<_0x4e5516&&_0x4692c4['dialPredictiveOptimization']===_0xf6fe('0x1c8')){clearPredictiveAttributes(_0x4692c4);loggerPredictive['info'](_0xf6fe('0x1c9'),'Dropped\x20calls\x20day',_0x4e5516,_0xf6fe('0x27'),_0x4692c4[_0xf6fe('0x48')]);}else if(_0x4a878b<_0x4692c4[_0xf6fe('0xca')]&&_0x4692c4[_0xf6fe('0x1ca')]===_0xf6fe('0x1c8')){clearPredictiveAttributes(_0x4692c4);loggerPredictive[_0xf6fe('0x4b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x4a878b,_0xf6fe('0x1cb'),_0x4692c4[_0xf6fe('0xca')],_0xf6fe('0x27'),_0x4692c4[_0xf6fe('0x48')]);}else if(!ifInterval(_0x4692c4['dialPredictiveInterval'],_0x4692c4['startProgressive'])&&_[_0xf6fe('0x40')](_0x4692c4['startPredictive'])&&!_[_0xf6fe('0x40')](_0x4692c4[_0xf6fe('0x27')])){_0x4692c4[_0xf6fe('0x63')]=moment()[_0xf6fe('0x46')](_0xf6fe('0xbe'));loggerPredictive[_0xf6fe('0x4b')](_0x4692c4[_0xf6fe('0x48')],_0xf6fe('0x1cc'),_0x4692c4[_0xf6fe('0x63')]);hopperUtils['avgHandleTime'](_0x4692c4[_0xf6fe('0x1c6')])['then'](this[_0xf6fe('0x1cd')](_0x4692c4))[_0xf6fe('0x3e')](mergeDataErlangB(_0x4692c4))[_0xf6fe('0x3e')](this['startMethodPredictive'](_0x4692c4))['catch'](loggerCatchPredictive(_0xf6fe('0x1ce'),_0x4692c4));}else if(!ifInterval(_0x4692c4[_0xf6fe('0x1c6')],_0x4692c4['startPredictive'])){_0x4692c4[_0xf6fe('0xca')]=0x0;_0x4692c4['startPredictive']=moment()['format'](_0xf6fe('0xbe'));loggerPredictive[_0xf6fe('0x4b')](_0x4692c4[_0xf6fe('0x48')],_0xf6fe('0x1cf'),_0x4692c4['startPredictive']);clearInterval(_0x4692c4['handlePredictive']);_0x4692c4[_0xf6fe('0x65')]=undefined;hopperUtils[_0xf6fe('0x1d0')](_0x4692c4[_0xf6fe('0x1c6')])['then'](this[_0xf6fe('0x1cd')](_0x4692c4))['then'](mergeDataErlangB(_0x4692c4))['then'](this['startMethodPredictive'](_0x4692c4))[_0xf6fe('0x9f')](loggerCatchPredictive(_0xf6fe('0x1d1'),_0x4692c4));}else if(_0x4692c4[_0xf6fe('0x1bc')]&&_0x2df739<_0x4692c4[_0xf6fe('0x1bc')]-_0xae3410){clearPredictiveAttributes(_0x4692c4);loggerPredictive['info'](_0x4692c4[_0xf6fe('0x48')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2df739,_0xf6fe('0x1d2'),_0x4692c4[_0xf6fe('0x1bc')],'-',_0xae3410,'=',_0x4692c4[_0xf6fe('0x1bc')]-_0xae3410,')');}else if(_0x4692c4[_0xf6fe('0x1bc')]&&_0x2df739>_0x4692c4[_0xf6fe('0x1bc')]+_0x37356){clearPredictiveAttributes(_0x4692c4);loggerPredictive[_0xf6fe('0x4b')](_0x4692c4[_0xf6fe('0x48')],_0xf6fe('0x1d3'),_0x2df739,_0xf6fe('0x1d4'),_0x4692c4[_0xf6fe('0x1bc')],'+',_0x37356,'=',_0x4692c4[_0xf6fe('0x1bc')]+_0x37356,')');}};Dialer['prototype'][_0xf6fe('0x1cd')]=function(_0x3b8253){var _0x2a0216=this;return function(_0x266f7f){return new Promise(function(_0x4af9cf,_0x5bb619){_[_0xf6fe('0x62')](_0x3b8253,_0x266f7f[0x0]);if(checkGetDataPredictive(_0x266f7f[0x0])){var _0x2edda4=_0x3b8253['predictiveIntervalAvailable']=_0x3b8253['talking']+_0x3b8253[_0xf6fe('0x138')];var _0x233eb3=_0x3b8253[_0xf6fe('0x1c6')]*0x3c;var _0x4ba459=_0x266f7f[0x0]['predictiveIntervalAvgTalktime']+_0x266f7f[0x0][_0xf6fe('0x54')];var _0x52424d=(_0x266f7f[0x0][_0xf6fe('0x50')]+_0x266f7f[0x0][_0xf6fe('0x52')]+_0x266f7f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x266f7f[0x0][_0xf6fe('0x4e')];_0x3b8253[_0xf6fe('0x1c0')]=_0x52424d>0x0?_0x52424d:0x1;switch(_0x3b8253[_0xf6fe('0x1ca')]){case'dropRate':var _0x1e4905=_0x3b8253[_0xf6fe('0x1b9')]/0x64;return _0x2a0216[_0xf6fe('0x1d5')](_0x2edda4,_0x233eb3,_0x4ba459,_0x52424d,_0x1e4905)[_0xf6fe('0x3e')](function(_0x1d8219){return _0x4af9cf(_0x1d8219);});case _0xf6fe('0x1d6'):var _0x3ebf76=_0x3b8253[_0xf6fe('0x1b9')]/0x64;return _0x2a0216[_0xf6fe('0x1d7')](_0x2edda4,_0x233eb3,_0x4ba459,_0x52424d,_0x3ebf76)[_0xf6fe('0x3e')](function(_0x1e6ec4){return _0x4af9cf(_0x1e6ec4);});default:return _0x5bb619(msgResponse(_0xf6fe('0x1d8'),_0xf6fe('0x92'),_0xf6fe('0x1d9')));}}else{return _0x5bb619(msgResponse(_0xf6fe('0x1d8'),_0xf6fe('0x92'),'check\x20failure'));}});};};Dialer['prototype'][_0xf6fe('0x1da')]=function(_0xdb014){var _0x424fbe=this;return function(_0x5bceb8){return new Promise(function(_0x1c51bb,_0x422929){_[_0xf6fe('0x62')](_0xdb014,_0x5bceb8[0x0]);if(checkGetDataPredictive(_0x5bceb8[0x0])){loggerPredictive[_0xf6fe('0x4b')](JSON['stringify'](_0x5bceb8[0x0]));if(_0xdb014[_0xf6fe('0x1ca')]===_0xf6fe('0x1c8')){return _0x424fbe['getVoiceQueueRtPauses'](_0xdb014['id'])['then'](function(_0x2784d8){var _0x307d42=_0xdb014[_0xf6fe('0x1db')]-_0x2784d8[0x0]['outboundQueuePauses'];var _0x14e2cf=_0xdb014['dialPredictiveInterval']*0x3c;var _0x20d963=_0x5bceb8[0x0][_0xf6fe('0x57')]+_0x5bceb8[0x0]['predictiveIntervalAvgHoldtime'];var _0x3c287b=(_0x5bceb8[0x0]['predictiveIntervalAnsweredCalls']+_0x5bceb8[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5bceb8[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5bceb8[0x0]['predictiveIntervalTotalCalls'];var _0x4ee8ef=_0xdb014[_0xf6fe('0x1b9')]/0x64;_0xdb014['predictiveIntervalPauses']=_0x2784d8[0x0][_0xf6fe('0x1dc')]||0x0;_0xdb014[_0xf6fe('0x1c0')]=_0x3c287b>0x0?_0x3c287b:0x1;return _0x424fbe[_0xf6fe('0x1d5')](_0x307d42,_0x14e2cf,_0x20d963,_0x3c287b,_0x4ee8ef);})[_0xf6fe('0x3e')](function(_0x2b486c){return _0x1c51bb(_0x2b486c);})[_0xf6fe('0x9f')](function(_0x359751){return _0x422929(msgResponse(_0xf6fe('0x1dd'),_0xf6fe('0x92'),JSON[_0xf6fe('0x75')](_0x359751)));});}if(_0xdb014[_0xf6fe('0x1ca')]==='agentBusyFactor'){return _0x424fbe['getVoiceQueueRtPauses'](_0xdb014['id'])[_0xf6fe('0x3e')](function(_0x4b43ff){var _0x291df9=_0xdb014['loggedIn']-_0x4b43ff[0x0][_0xf6fe('0x1dc')];var _0x191986=_0xdb014[_0xf6fe('0x1c6')]*0x3c;var _0x38d214=_0x5bceb8[0x0][_0xf6fe('0x57')]+_0x5bceb8[0x0]['predictiveIntervalAvgHoldtime'];var _0x263758=(_0x5bceb8[0x0][_0xf6fe('0x50')]+_0x5bceb8[0x0][_0xf6fe('0x52')]+_0x5bceb8[0x0][_0xf6fe('0x53')])/_0x5bceb8[0x0]['predictiveIntervalTotalCalls'];var _0x38dd4a=_0xdb014['dialPredictiveOptimizationPercentage']/0x64;_0xdb014[_0xf6fe('0x1de')]=_0x4b43ff[0x0]['outboundQueuePauses']||0x0;_0xdb014['predictiveIntervalHitRate']=_0x263758>0x0?_0x263758:0x1;return _0x424fbe[_0xf6fe('0x1d7')](_0x291df9,_0x191986,_0x38d214,_0x263758,_0x38dd4a);})[_0xf6fe('0x3e')](function(_0x2ce5a9){return _0x1c51bb(_0x2ce5a9);})['catch'](function(_0x323bb4){return _0x422929(msgResponse(_0xf6fe('0x1dd'),_0xf6fe('0x92'),JSON[_0xf6fe('0x75')](_0x323bb4)));});}}else{return _0x422929(msgResponse('[getDataPredictive]',_0xf6fe('0x92'),_0xf6fe('0x1df')));}});};};Dialer[_0xf6fe('0x17')][_0xf6fe('0x1e0')]=function(_0x457649){var _0x25a4eb=this;return function(){var _0x1f6024=0x0;var _0x49f12e=Math[_0xf6fe('0x1bf')](_0x457649[_0xf6fe('0x5d')]*0x3e8);if(_0x49f12e>0x0){_0x49f12e=_0x49f12e<0x64?0x64:_0x49f12e;loggerPredictive[_0xf6fe('0x4b')](_0x457649['name'],_0xf6fe('0x1e1'),_0x49f12e,_0xf6fe('0x1e2'));_0x457649['handlePredictive']=setInterval(function(){_0x25a4eb[_0xf6fe('0x65')](_0x457649);loggerPredictiveCalls[_0xf6fe('0x4b')](_0xf6fe('0x1e3'),_0x1f6024+=0x1);},_0x49f12e);}else{loggerPredictive[_0xf6fe('0x4b')](_0x457649[_0xf6fe('0x48')],_0xf6fe('0x1e4'));}};};Dialer['prototype'][_0xf6fe('0x1e5')]=function(_0x4f34f9,_0x5e5731){var _0x4aedd1=this;return function(_0x5d9a67){if(_['isEmpty'](_0x5d9a67)){if(_[_0xf6fe('0xee')](_0x5e5731[_0xf6fe('0x1e6')])||!_0x5e5731['recallme']){if(_0x4f34f9['dialMethod']===_0xf6fe('0x9')){_0x4f34f9[_0xf6fe('0x72')]=_[_0xf6fe('0x40')](_0x4f34f9['queueStatusComplete'])?!![]:_0x4f34f9['queueStatusComplete'];var _0x1176aa=uuid['v4']();_0x4aedd1[_0xf6fe('0x23')][_0x1176aa]=new Action(_0x4f34f9,_0x5e5731,_0x1176aa);loggerBooked[_0xf6fe('0x4b')]('[booked][checkContactBlack]',_0x1176aa,_0xf6fe('0x1e7'),JSON['stringify'](_0x4f34f9[_0xf6fe('0x72')]),'Queue:\x20',_0x4f34f9[_0xf6fe('0x48')]);if(_0x4f34f9[_0xf6fe('0x72')]){_0x4f34f9[_0xf6fe('0x72')]=![];_0x4aedd1['queueBooked'][_0x4aedd1[_0xf6fe('0x23')][_0x1176aa][_0xf6fe('0xba')]]=[];ami['Action']({'actionid':_0x1176aa,'action':_0xf6fe('0x1e8'),'queue':_0x4f34f9[_0xf6fe('0x48')]})[_0xf6fe('0x9f')](function(){_0x4aedd1[_0xf6fe('0xbd')](_0x4f34f9);hopperUtils[_0xf6fe('0xd7')]({'active':![],'ContactId':_0x4aedd1['actions'][_0x1176aa][_0xf6fe('0xda')],'ListId':_0x4aedd1[_0xf6fe('0x23')][_0x1176aa]['ListId'],'VoiceQueueId':_0x4aedd1[_0xf6fe('0x23')][_0x1176aa][_0xf6fe('0xdc')]||undefined,'CampaignId':_0x4aedd1[_0xf6fe('0x23')][_0x1176aa][_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4aedd1[_0xf6fe('0x23')][_0x1176aa];});}else{loggerBooked[_0xf6fe('0x4b')](_0xf6fe('0x1e9'),JSON[_0xf6fe('0x75')](_0x4f34f9[_0xf6fe('0x72')]),_0xf6fe('0x1ea'),_0x4f34f9[_0xf6fe('0x48')]);_0x4aedd1[_0xf6fe('0xbd')](_0x4f34f9);hopperUtils[_0xf6fe('0xd7')]({'active':![],'ContactId':_0x4aedd1[_0xf6fe('0x23')][_0x1176aa]['ContactId'],'ListId':_0x4aedd1['actions'][_0x1176aa][_0xf6fe('0xdb')],'VoiceQueueId':_0x4aedd1['actions'][_0x1176aa]['VoiceQueueId']||undefined,'CampaignId':_0x4aedd1[_0xf6fe('0x23')][_0x1176aa][_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x1eb')));delete _0x4aedd1[_0xf6fe('0x23')][_0x1176aa];}}else{return _0x4aedd1[_0xf6fe('0x1ec')](_0x4f34f9,_0x5e5731);}}else{if(utils[_0xf6fe('0x1ed')](undefined,_0x5e5731[_0xf6fe('0x1ee')])<_0x4f34f9[_0xf6fe('0x1ef')]*0x3c){if(_0x5e5731[_0xf6fe('0x147')]&&!_0x5e5731[_0xf6fe('0x147')][_0xf6fe('0x1f0')]){_0x4aedd1['preview'][_0xf6fe('0xfc')](_0x5e5731['id'])['finally'](function(){_0x4aedd1['updateOriginated'](_0x4f34f9);});}else{hopperUtils['unlockContact']({'active':![]},_0x5e5731['id'],0x1)['finally'](function(){_0x4aedd1[_0xf6fe('0xbd')](_0x4f34f9);});}}else{_0x4f34f9[_0xf6fe('0x1f1')]+=0x1;_0x4aedd1[_0xf6fe('0xbd')](_0x4f34f9);if(_0x4f34f9[_0xf6fe('0x1f2')]){hopperUtils[_0xf6fe('0xd7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5e5731[_0xf6fe('0xda')],'ListId':_0x5e5731[_0xf6fe('0xdb')],'VoiceQueueId':_0x5e5731[_0xf6fe('0xdc')]||undefined,'CampaignId':_0x5e5731[_0xf6fe('0xdd')]||undefined})[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x1f3')));hopperUtils[_0xf6fe('0xc3')](createObjHistory(_0x4f34f9,_0x5e5731,utils[_0xf6fe('0x6a')][_0xf6fe('0x1f4')],0x17,'RecallInQueue'))[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x1f5')));}else{_0x4aedd1[_0xf6fe('0x116')](createObjHistory(_0x4f34f9,_0x5e5731,utils['CAMPAIGN_STATUS']['RECALL_TIMEOUT'],0x16,_0xf6fe('0x1f6')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x4f34f9[_0xf6fe('0x1f7')]+=0x1;_0x4aedd1['saveInDb'](createObjHistory(_0x4f34f9,_0x5e5731,utils[_0xf6fe('0x6a')][_0xf6fe('0x1f8')],0xd,'Blacklist'),_0xf6fe('0x1f9'),_0xf6fe('0x1fa'));throw _0xf6fe('0x1fb');}};};Dialer['prototype'][_0xf6fe('0x15b')]=function(_0x5c4ad2){var _0x5c5ffc=this;var _0x2fc7ca=_0x5c4ad2[_0xf6fe('0x1fc')]-_0x5c4ad2['originated'];emitCampaignSummary(_0x5c4ad2);if(_0x2fc7ca>0x0&&_0x5c4ad2['temp']==0x0){if(_0x2fc7ca>this[_0xf6fe('0x21')]){_0x2fc7ca=this['maxNumberOriginate'];}_0x5c4ad2['temp']=0x1;hopperUtils['getContactDialerIvr'](_0x5c4ad2,_0x2fc7ca)[_0xf6fe('0x3e')](function(_0x1523d7){_0x5c4ad2[_0xf6fe('0x1fd')]=0x0;if(_0x1523d7){if(!utils[_0xf6fe('0x1fe')](_0x1523d7)){_0x5c4ad2[_0xf6fe('0x69')]=utils['CAMPAIGN_STATUS'][_0xf6fe('0x6d')];logger[_0xf6fe('0x4b')]('[getContactCampaign2][Empty]'+_0x5c4ad2['name']);}else{_0x5c4ad2['originated']+=_0x1523d7[_0xf6fe('0x99')];_0x5c4ad2[_0xf6fe('0x69')]=utils['CAMPAIGN_STATUS'][_0xf6fe('0x1ff')];for(var _0x5b51db=0x0;_0x5b51db<_0x1523d7['length'];_0x5b51db+=0x1){_0x5c4ad2[_0xf6fe('0x200')]+=0x1;if(_[_0xf6fe('0xee')](_0x1523d7[_0x5b51db])||_[_0xf6fe('0xee')](_0x1523d7[_0x5b51db][_0xf6fe('0x201')])||_['isNil'](_0x1523d7[_0x5b51db][_0xf6fe('0x15f')])){_0x5c5ffc[_0xf6fe('0x157')](_0xf6fe('0x202'),_0x5c4ad2,_0x1523d7[_0x5b51db]);}else{hopperUtils[_0xf6fe('0x203')](_[_0xf6fe('0xf2')](_0x1523d7[_0x5b51db],['CampaignId','phone']))[_0xf6fe('0x3e')](_0x5c5ffc[_0xf6fe('0x1e5')](_0x5c4ad2,_0x1523d7[_0x5b51db]))[_0xf6fe('0x9f')](_0x5c5ffc['loggerHandler'](_0xf6fe('0x204'),_0x5c4ad2));}}}}})[_0xf6fe('0x9f')](loggerGetContactDialer(_0xf6fe('0x205'),_0x5c4ad2,_0x2fc7ca));}};Dialer[_0xf6fe('0x17')][_0xf6fe('0xaf')]=function(_0x454a6d,_0x59f6ea){var _0x884fe4=this;var _0x3424c5=[];if(_0x59f6ea<0x1||_0x454a6d[_0xf6fe('0xae')]==='booked'){_0x59f6ea=0x1;}var _0x574091=Math['floor'](_0x454a6d[_0xf6fe('0x138')]*_0x59f6ea)-_0x454a6d[_0xf6fe('0x7e')];if(_0x454a6d['dialLimitQueue']>0x0){var _0x3ef8a6=_0x454a6d['dialLimitQueue']-_0x454a6d[_0xf6fe('0x7e')]-_0x454a6d[_0xf6fe('0x13a')]-_0x454a6d[_0xf6fe('0x13b')];if(_0x574091>_0x3ef8a6){_0x574091=_0x3ef8a6;}}if(_0x574091>0x0&&_0x454a6d[_0xf6fe('0x1fd')]==0x0){if(_0x454a6d[_0xf6fe('0xae')]===_0xf6fe('0x9')){_0x574091=0x1;}if(_0x574091>this['maxNumberOriginate']){_0x574091=this[_0xf6fe('0x21')];}for(var _0x381dea in this[_0xf6fe('0x1f')]){if(typeof this[_0xf6fe('0x1f')][_0x381dea]!==_0xf6fe('0xab')){if(this[_0xf6fe('0x1f')][_0x381dea][_0xf6fe('0x6e')]==='not_inuse'&&this['agents'][_0x381dea][_0xf6fe('0x89')]==='reachable'){_0x3424c5['push'](this['agents'][_0x381dea]['id']);}}}_0x454a6d['temp']=0x1;hopperUtils[_0xf6fe('0x206')](_0x454a6d,_0x3424c5,_0x574091)[_0xf6fe('0x3e')](function(_0x7b1c3d){_0x454a6d['temp']=0x0;if(_0x7b1c3d){if(!utils[_0xf6fe('0x1fe')](_0x7b1c3d)){hopperUtils[_0xf6fe('0x207')](_0x454a6d)[_0xf6fe('0x3e')](sendMessageReschedule(_0x454a6d))[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x208')));}else{_0x454a6d[_0xf6fe('0x7e')]+=_0x7b1c3d[_0xf6fe('0x99')];_0x454a6d[_0xf6fe('0x69')]=_0x454a6d[_0xf6fe('0xae')]===_0xf6fe('0x9')?utils['CAMPAIGN_STATUS'][_0xf6fe('0x13c')]:utils['CAMPAIGN_STATUS'][_0xf6fe('0x1ff')];for(var _0x10d337=0x0;_0x10d337<_0x7b1c3d[_0xf6fe('0x99')];_0x10d337+=0x1){if(_[_0xf6fe('0xee')](_0x7b1c3d[_0x10d337])||_[_0xf6fe('0xee')](_0x7b1c3d[_0x10d337]['Contact'])||_[_0xf6fe('0xee')](_0x7b1c3d[_0x10d337][_0xf6fe('0x15f')])){_0x884fe4[_0xf6fe('0x157')](_0xf6fe('0x202'),_0x454a6d,_0x7b1c3d[_0x10d337]);}else{hopperUtils[_0xf6fe('0x209')](_[_0xf6fe('0xf2')](_0x7b1c3d[_0x10d337],['VoiceQueueId',_0xf6fe('0x15f')]))[_0xf6fe('0x3e')](_0x884fe4[_0xf6fe('0x1e5')](_0x454a6d,_0x7b1c3d[_0x10d337]))['catch'](_0x884fe4[_0xf6fe('0x156')](_0xf6fe('0x202'),_0x454a6d));}}}}})[_0xf6fe('0x9f')](loggerGetContactDialer(_0xf6fe('0x20a'),_0x454a6d,_0x574091));}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x65')]=function(_0x2edb7c){if(_0x2edb7c[_0xf6fe('0x20b')]>0x0){var _0x5a5c55=_0x2edb7c[_0xf6fe('0x20b')]-_0x2edb7c[_0xf6fe('0x7e')]-_0x2edb7c[_0xf6fe('0x13a')];if(_0x5a5c55>0x0&&_0x2edb7c[_0xf6fe('0x1fd')]==0x0){this[_0xf6fe('0x20c')](_0x2edb7c);}else{loggerPredictiveCalls[_0xf6fe('0x4b')]('[handlePredictive][limitChannel]');}}else{this[_0xf6fe('0x20c')](_0x2edb7c);}};Dialer[_0xf6fe('0x17')][_0xf6fe('0x20c')]=function(_0x3c8cb3){var _0x254c90=this;var _0x43465a=[];_0x3c8cb3[_0xf6fe('0x7e')]+=0x1;for(var _0x2561c1 in this[_0xf6fe('0x1f')]){if(typeof this[_0xf6fe('0x1f')][_0x2561c1]!==_0xf6fe('0xab')){if(this[_0xf6fe('0x1f')][_0x2561c1][_0xf6fe('0x6e')]===_0xf6fe('0x20d')&&this['agents'][_0x2561c1][_0xf6fe('0x89')]===_0xf6fe('0x8a')){_0x43465a[_0xf6fe('0x9a')](this['agents'][_0x2561c1]['id']);}}}_0x3c8cb3['temp']=0x1;return this[_0xf6fe('0x206')](_0x3c8cb3['id'],_0x43465a,0x1,_0x3c8cb3[_0xf6fe('0x20e')],_0x3c8cb3)[_0xf6fe('0x3e')](function(_0xa28ed2){_0x3c8cb3[_0xf6fe('0x1fd')]=0x1;if(_0xa28ed2){if(!utils['checkContactEmpty'](_0xa28ed2)){utils[_0xf6fe('0x67')](_0x3c8cb3,0x1,0x0);return hopperUtils[_0xf6fe('0x207')](_0x3c8cb3)[_0xf6fe('0x3e')](sendMessageReschedule(_0x3c8cb3))[_0xf6fe('0x9f')](loggerCatch(_0xf6fe('0x208')));}else{_0x3c8cb3['message']=utils['CAMPAIGN_STATUS'][_0xf6fe('0x1ff')];if(_[_0xf6fe('0xee')](_0xa28ed2[0x0])||_['isNil'](_0xa28ed2[0x0]['Contact'])||_['isNil'](_0xa28ed2[0x0][_0xf6fe('0x15f')])){_0x254c90[_0xf6fe('0x157')](_0xf6fe('0x202'),_0x3c8cb3,_0xa28ed2[0x0]);}else{return hopperUtils[_0xf6fe('0x209')](_['pick'](_0xa28ed2[0x0],[_0xf6fe('0xdc'),_0xf6fe('0x15f')]))[_0xf6fe('0x3e')](_0x254c90[_0xf6fe('0x1e5')](_0x3c8cb3,_0xa28ed2[0x0]))[_0xf6fe('0x9f')](_0x254c90[_0xf6fe('0x156')](_0xf6fe('0x20f'),_0x3c8cb3));}}}})[_0xf6fe('0x9f')](loggerGetContactDialer(_0xf6fe('0x210'),_0x3c8cb3,0x1));};Dialer[_0xf6fe('0x17')]['abandonmentRate']=function(_0x5d5c2b,_0x54d4ba,_0x1fe411,_0x4e2a90,_0x32901f,_0x45b0e3){loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x211'));loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x212'),_0x5d5c2b);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x213'),_0x54d4ba);loggerPredictive['info']('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',_0x1fe411);loggerPredictive[_0xf6fe('0x4b')]('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',_0x4e2a90);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x214'),_0x32901f);loggerPredictive[_0xf6fe('0x4b')]('---------------------------');return new Promise(function(_0x5bdf59,_0x1c1b79){if(_0x5d5c2b<=0x0||isNaN(_0x5d5c2b)){return _0x1c1b79(msgResponse(_0xf6fe('0x215'),'Error',_0xf6fe('0x216')+_0x5d5c2b));}if(_0x1fe411<=0x0||isNaN(_0x1fe411)){return _0x1c1b79(msgResponse(_0xf6fe('0x215'),_0xf6fe('0x85'),_0xf6fe('0x217')+_0x1fe411));}if(_0x4e2a90<=0x0||isNaN(_0x4e2a90)){return _0x1c1b79(msgResponse(_0xf6fe('0x215'),_0xf6fe('0x85'),_0xf6fe('0x218')+_0x4e2a90));}if(_0x54d4ba<=0x0||isNaN(_0x54d4ba)){return _0x1c1b79(msgResponse(_0xf6fe('0x215'),'Error','interval\x20=\x20'+_0x54d4ba));}if(_0x32901f<=0x0||isNaN(_0x32901f)){return _0x1c1b79(msgResponse('[abandonmentRate]','Error',_0xf6fe('0x219')+_0x32901f));}_0x45b0e3=_0x45b0e3||0x0;var _0x4dcf5b=0x1/_0x1fe411;var _0x5169b0=0x0;var _0x52f3be=0x0;var _0x5c2cf3=0x0;var _0x2b9479=0x0;for(var _0x3933ea=0x0;_0x5c2cf3<_0x32901f;_0x3933ea+=0x1){_0x52f3be=_0x3933ea/_0x54d4ba;_0x5169b0=(_0x4e2a90*_0x52f3be+_0x45b0e3)/_0x4dcf5b;_0x5c2cf3=utils[_0xf6fe('0x21a')](_0x5169b0,_0x5d5c2b);_0x2b9479=_0x5169b0/_0x5d5c2b*(0x1-utils[_0xf6fe('0x21a')](_0x5169b0,_0x5d5c2b));}return _0x5bdf59({'erlangCalls':_0x3933ea,'erlangCallToSecond':_0x54d4ba/_0x3933ea,'erlangAbandonmentRate':_0x5c2cf3,'erlangBusyFactor':_0x2b9479});});};Dialer['prototype'][_0xf6fe('0x1d7')]=function(_0x2f8d52,_0x42df2d,_0x1be4d2,_0x217207,_0x1ad750,_0xd8b923){loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x21b'));loggerPredictive['info'](_0xf6fe('0x212'),_0x2f8d52);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x213'),_0x42df2d);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x21c'),_0x1be4d2);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x21d'),_0x217207);loggerPredictive['info'](_0xf6fe('0x21e'),_0x1ad750);loggerPredictive[_0xf6fe('0x4b')](_0xf6fe('0x56'));return new Promise(function(_0x2f0b33,_0x39b87a){if(_0x2f8d52<=0x0||isNaN(_0x2f8d52)){return _0x39b87a(msgResponse('[busyFactor]',_0xf6fe('0x85'),_0xf6fe('0x216')+_0x2f8d52));}if(_0x1be4d2<=0x0||isNaN(_0x1be4d2)){return _0x39b87a(msgResponse(_0xf6fe('0x21f'),'Error',_0xf6fe('0x217')+_0x1be4d2));}if(_0x217207<=0x0||isNaN(_0x217207)){return _0x39b87a(msgResponse(_0xf6fe('0x21f'),'Error',_0xf6fe('0x218')+_0x217207));}if(_0x42df2d<=0x0||isNaN(_0x42df2d)){return _0x39b87a(msgResponse(_0xf6fe('0x21f'),_0xf6fe('0x85'),'interval\x20=\x20'+_0x42df2d));}if(_0x1ad750<=0x0||isNaN(_0x1ad750)){return _0x39b87a(msgResponse(_0xf6fe('0x21f'),_0xf6fe('0x85'),_0xf6fe('0x220')+_0x1ad750));}_0xd8b923=_0xd8b923||0x0;var _0x424f5d=0x1/_0x1be4d2;var _0x401b54=0x0;var _0xd7d185=0x0;var _0x1ea585=0x0;var _0x73f6c4=0x0;for(var _0x31bd8b=0x0;_0x73f6c4<_0x1ad750;_0x31bd8b+=0x1){_0xd7d185=_0x31bd8b/_0x42df2d;_0x401b54=(_0x217207*_0xd7d185+_0xd8b923)/_0x424f5d;_0x1ea585=utils['erlangb'](_0x401b54,_0x2f8d52);_0x73f6c4=_0x401b54/_0x2f8d52*(0x1-utils[_0xf6fe('0x21a')](_0x401b54,_0x2f8d52));}return _0x2f0b33({'erlangCalls':_0x31bd8b,'erlangCallToSecond':_0x42df2d/_0x31bd8b,'erlangAbandonmentRate':_0x1ea585,'erlangBusyFactor':_0x73f6c4});});};module[_0xf6fe('0x221')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 18d2d59..87b2729 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4431=['moment','isNil','string','voiceQueue','phone','Contact','firstName','lastName','number','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','substring','dialCutDigit','getQueue','queue','exports','util','lodash'];(function(_0x59881a,_0x5ef668){var _0x33a221=function(_0x396188){while(--_0x396188){_0x59881a['push'](_0x59881a['shift']());}};_0x33a221(++_0x5ef668);}(_0x4431,0x16e));var _0x1443=function(_0x59122b,_0x5831f5){_0x59122b=_0x59122b-0x0;var _0x5ba3b2=_0x4431[_0x59122b];return _0x5ba3b2;};'use strict';var util=require(_0x1443('0x0'));var _=require(_0x1443('0x1'));var moment=require(_0x1443('0x2'));function checkNameSurname(_0x2998d3,_0x2db348,_0xffd01d){var _0x3a293b='';if(!_[_0x1443('0x3')](_0x2db348)&&_0x1443('0x4')===typeof _0x2db348){_0x3a293b+=_0x2db348;}if(!_[_0x1443('0x3')](_0xffd01d)&&_0x1443('0x4')===typeof _0xffd01d){_0x3a293b+='\x20'+_0xffd01d;}if(_0x3a293b!==''){return _0x3a293b;}return _0x2998d3;}function Action(_0x7bbd82,_0x1b2e47,_0x3b049c){this[_0x1443('0x5')]=_0x7bbd82;this['uniqueid']=_0x3b049c||undefined;this['name']=checkNameSurname(_0x1b2e47['Contact'][_0x1443('0x6')],_0x1b2e47[_0x1443('0x7')][_0x1443('0x8')],_0x1b2e47[_0x1443('0x7')][_0x1443('0x9')]);this[_0x1443('0xa')]=_0x1b2e47[_0x1443('0x6')];this['queue']=_0x7bbd82[_0x1443('0xb')];this['active']=_0x1b2e47[_0x1443('0xc')]||![];this[_0x1443('0xd')]=_0x7bbd82[_0x1443('0xd')];this[_0x1443('0xe')]=_0x7bbd82[_0x1443('0xe')]||0x3;this[_0x1443('0xf')]=_0x1b2e47['scheduledat'];this[_0x1443('0x10')]=_0x1b2e47[_0x1443('0x10')];this[_0x1443('0x11')]=_0x1b2e47['countcongestionretry'];this[_0x1443('0x12')]=_0x1b2e47[_0x1443('0x12')];this[_0x1443('0x13')]=_0x1b2e47['countnosuchnumberretry'];this[_0x1443('0x14')]=_0x1b2e47[_0x1443('0x14')];this[_0x1443('0x15')]=_0x1b2e47[_0x1443('0x15')];this[_0x1443('0x16')]=_0x1b2e47[_0x1443('0x16')];this[_0x1443('0x17')]=_0x1b2e47[_0x1443('0x17')];this[_0x1443('0x18')]=_0x1b2e47[_0x1443('0x18')];this[_0x1443('0x19')]=_0x1b2e47['ListId'];this[_0x1443('0x1a')]=_0x1b2e47[_0x1443('0x1a')];this[_0x1443('0x1b')]=_0x1b2e47[_0x1443('0x1b')];this[_0x1443('0x1c')]=_0x1b2e47[_0x1443('0x1c')];this[_0x1443('0x1d')]=_0x1b2e47['id'];this[_0x1443('0x1e')]=_0x1b2e47[_0x1443('0x7')][_0x1443('0x8')]||'';this[_0x1443('0x1f')]=moment()[_0x1443('0x20')](_0x1443('0x21'));this['callback']=_0x1b2e47[_0x1443('0x22')];this['callbackuniqueid']=_0x1b2e47[_0x1443('0x23')];this['callbackat']=_0x1b2e47[_0x1443('0x24')];this[_0x1443('0x25')]=_0x1b2e47[_0x1443('0x25')];this[_0x1443('0x26')]='';this['originatecalleridname']='';}Action[_0x1443('0x27')]['getCaller']=function(){return util[_0x1443('0x20')](_0x1443('0x28'),this[_0x1443('0xb')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x1443('0xa')][_0x1443('0x29')](this[_0x1443('0x5')][_0x1443('0x2a')]):this[_0x1443('0xa')]);};Action[_0x1443('0x27')][_0x1443('0x2b')]=function(){return this[_0x1443('0x2c')];};module[_0x1443('0x2d')]=Action; \ No newline at end of file +var _0x11fc=['idHopper','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x2ef51e,_0xbc63ab){var _0x3c9895=function(_0x73cc79){while(--_0x73cc79){_0x2ef51e['push'](_0x2ef51e['shift']());}};_0x3c9895(++_0xbc63ab);}(_0x11fc,0x1dd));var _0xc11f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x11fc[_0x618414];return _0x21c19a;};'use strict';var util=require(_0xc11f('0x0'));var _=require('lodash');var moment=require(_0xc11f('0x1'));function checkNameSurname(_0x397229,_0x31cb6c,_0x10b72c){var _0x5d442a='';if(!_[_0xc11f('0x2')](_0x31cb6c)&&_0xc11f('0x3')===typeof _0x31cb6c){_0x5d442a+=_0x31cb6c;}if(!_['isNil'](_0x10b72c)&&_0xc11f('0x3')===typeof _0x10b72c){_0x5d442a+='\x20'+_0x10b72c;}if(_0x5d442a!==''){return _0x5d442a;}return _0x397229;}function Action(_0x2d7d4b,_0x3e9bc2,_0x5f2626){this[_0xc11f('0x4')]=_0x2d7d4b;this[_0xc11f('0x5')]=_0x5f2626||undefined;this[_0xc11f('0x6')]=checkNameSurname(_0x3e9bc2[_0xc11f('0x7')][_0xc11f('0x8')],_0x3e9bc2[_0xc11f('0x7')][_0xc11f('0x9')],_0x3e9bc2['Contact'][_0xc11f('0xa')]);this[_0xc11f('0xb')]=_0x3e9bc2[_0xc11f('0x8')];this['queue']=_0x2d7d4b[_0xc11f('0x6')];this[_0xc11f('0xc')]=_0x3e9bc2['active']||![];this[_0xc11f('0xd')]=_0x2d7d4b['type'];this['dialQueueTimeout']=_0x2d7d4b[_0xc11f('0xe')]||0x3;this[_0xc11f('0xf')]=_0x3e9bc2[_0xc11f('0xf')];this[_0xc11f('0x10')]=_0x3e9bc2[_0xc11f('0x10')];this[_0xc11f('0x11')]=_0x3e9bc2[_0xc11f('0x11')];this[_0xc11f('0x12')]=_0x3e9bc2[_0xc11f('0x12')];this['countnosuchnumberretry']=_0x3e9bc2[_0xc11f('0x13')];this[_0xc11f('0x14')]=_0x3e9bc2[_0xc11f('0x14')];this[_0xc11f('0x15')]=_0x3e9bc2[_0xc11f('0x15')];this[_0xc11f('0x16')]=_0x3e9bc2[_0xc11f('0x16')];this[_0xc11f('0x17')]=_0x3e9bc2[_0xc11f('0x17')];this[_0xc11f('0x18')]=_0x3e9bc2[_0xc11f('0x18')];this[_0xc11f('0x19')]=_0x3e9bc2['ListId'];this[_0xc11f('0x1a')]=_0x3e9bc2[_0xc11f('0x1a')];this[_0xc11f('0x1b')]=_0x3e9bc2['VoiceQueueId'];this[_0xc11f('0x1c')]=_0x3e9bc2[_0xc11f('0x1c')];this[_0xc11f('0x1d')]=_0x3e9bc2['id'];this['ContactFirstName']=_0x3e9bc2[_0xc11f('0x7')][_0xc11f('0x9')]||'';this['starttime']=moment()[_0xc11f('0x1e')](_0xc11f('0x1f'));this[_0xc11f('0x20')]=_0x3e9bc2[_0xc11f('0x20')];this[_0xc11f('0x21')]=_0x3e9bc2[_0xc11f('0x21')];this[_0xc11f('0x22')]=_0x3e9bc2[_0xc11f('0x22')];this[_0xc11f('0x23')]=_0x3e9bc2[_0xc11f('0x23')];this[_0xc11f('0x24')]='';this[_0xc11f('0x25')]='';}Action[_0xc11f('0x26')][_0xc11f('0x27')]=function(){return util['format'](_0xc11f('0x28'),this[_0xc11f('0x6')],this[_0xc11f('0x4')][_0xc11f('0x29')]>0x0?this[_0xc11f('0xb')][_0xc11f('0x2a')](this[_0xc11f('0x4')][_0xc11f('0x29')]):this['number']);};Action[_0xc11f('0x26')][_0xc11f('0x2b')]=function(){return this[_0xc11f('0x2c')];};module[_0xc11f('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 266b758..977ae18 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1939=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','statedesc','scheduledat','campaigntype','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0x1939,0x16f));var _0x9193=function(_0x56bcff,_0x158e5f){_0x56bcff=_0x56bcff-0x0;var _0x340351=_0x1939[_0x56bcff];return _0x340351;};'use strict';var moment=require(_0x9193('0x0'));var utils=require(_0x9193('0x1'));function AgentComplete(_0x4f2415,_0x1fc5f0){this['state']=0x4;this[_0x9193('0x2')]='Answer';this[_0x9193('0x3')]=_0x4f2415['scheduledat'];this['type']=_0x4f2415['type'];this[_0x9193('0x4')]=_0x4f2415[_0x9193('0x5')]===_0x9193('0x6')?'queue':_0x4f2415[_0x9193('0x5')];this[_0x9193('0x7')]=_0x4f2415['countbusyretry'];this[_0x9193('0x8')]=_0x4f2415['countcongestionretry'];this[_0x9193('0x9')]=_0x4f2415[_0x9193('0x9')];this[_0x9193('0xa')]=_0x4f2415[_0x9193('0x7')]+_0x4f2415[_0x9193('0x8')]+_0x4f2415[_0x9193('0x9')]+_0x4f2415['countnosuchnumberretry']+_0x4f2415['countdropretry']+_0x4f2415[_0x9193('0xb')]+_0x4f2415[_0x9193('0xc')]+_0x4f2415[_0x9193('0xd')];this[_0x9193('0xe')]=_0x4f2415[_0x9193('0xe')];this[_0x9193('0xf')]=_0x4f2415[_0x9193('0xf')];this['countabandonedretry']=_0x4f2415[_0x9193('0xb')];this[_0x9193('0xc')]=_0x4f2415[_0x9193('0xc')];this[_0x9193('0xd')]=_0x4f2415[_0x9193('0xd')];this[_0x9193('0x10')]=_0x1fc5f0['uniqueid'];this[_0x9193('0x11')]=_0x4f2415[_0x9193('0x12')];this[_0x9193('0x13')]=_0x4f2415[_0x9193('0x14')];this[_0x9193('0x15')]=_0x4f2415[_0x9193('0x15')];this[_0x9193('0x16')]=_0x4f2415[_0x9193('0x16')];this[_0x9193('0x17')]=_0x4f2415[_0x9193('0x17')];this[_0x9193('0x18')]=moment()[_0x9193('0x19')](_0x9193('0x1a'));this['ringtime']=utils[_0x9193('0x1b')](_0x4f2415[_0x9193('0x16')],_0x4f2415[_0x9193('0x15')]);this[_0x9193('0x1c')]=utils[_0x9193('0x1b')](_0x4f2415[_0x9193('0x17')],_0x4f2415[_0x9193('0x16')]);this[_0x9193('0x1d')]=utils[_0x9193('0x1b')](this[_0x9193('0x18')],_0x4f2415[_0x9193('0x17')]);this[_0x9193('0x1e')]=_0x1fc5f0[_0x9193('0x1e')];this[_0x9193('0x1f')]=_0x1fc5f0['membername'];this[_0x9193('0x20')]=_0x1fc5f0[_0x9193('0x20')];this[_0x9193('0x21')]=_0x4f2415[_0x9193('0x21')];this['callbackuniqueid']=_0x4f2415[_0x9193('0x22')];this['callbackat']=_0x4f2415['callbackat'];this[_0x9193('0x23')]=_0x4f2415['recallme'];this[_0x9193('0x24')]=_0x4f2415[_0x9193('0x24')];this[_0x9193('0x25')]=_0x4f2415[_0x9193('0x25')];this['UserId']=_0x4f2415[_0x9193('0x26')];this[_0x9193('0x27')]=_0x4f2415[_0x9193('0x27')];this[_0x9193('0x28')]=_0x4f2415[_0x9193('0x28')];this[_0x9193('0x29')]=_0x4f2415['originatecalleridnum']||'';this[_0x9193('0x2a')]=_0x4f2415[_0x9193('0x2a')]||'';this[_0x9193('0x2b')]=_0x4f2415[_0x9193('0x2b')];}module[_0x9193('0x2c')]=AgentComplete; \ No newline at end of file +var _0x94c8=['responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','../utils','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x94c8,0xca));var _0x894c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x94c8[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var utils=require(_0x894c('0x0'));function AgentComplete(_0x1049ab,_0x5860aa){this[_0x894c('0x1')]=0x4;this[_0x894c('0x2')]='Answer';this[_0x894c('0x3')]=_0x1049ab[_0x894c('0x3')];this['type']=_0x1049ab[_0x894c('0x4')];this[_0x894c('0x5')]=_0x1049ab[_0x894c('0x4')]===_0x894c('0x6')?_0x894c('0x7'):_0x1049ab[_0x894c('0x4')];this[_0x894c('0x8')]=_0x1049ab[_0x894c('0x8')];this['countcongestionretry']=_0x1049ab[_0x894c('0x9')];this['countnoanswerretry']=_0x1049ab[_0x894c('0xa')];this[_0x894c('0xb')]=_0x1049ab[_0x894c('0x8')]+_0x1049ab[_0x894c('0x9')]+_0x1049ab[_0x894c('0xa')]+_0x1049ab[_0x894c('0xc')]+_0x1049ab[_0x894c('0xd')]+_0x1049ab['countabandonedretry']+_0x1049ab[_0x894c('0xe')]+_0x1049ab[_0x894c('0xf')];this[_0x894c('0xc')]=_0x1049ab[_0x894c('0xc')];this[_0x894c('0xd')]=_0x1049ab[_0x894c('0xd')];this[_0x894c('0x10')]=_0x1049ab['countabandonedretry'];this['countmachineretry']=_0x1049ab['countmachineretry'];this[_0x894c('0xf')]=_0x1049ab['countagentrejectretry'];this[_0x894c('0x11')]=_0x5860aa['uniqueid'];this[_0x894c('0x12')]=_0x1049ab[_0x894c('0x13')];this[_0x894c('0x14')]=_0x1049ab[_0x894c('0x15')];this['starttime']=_0x1049ab[_0x894c('0x16')];this[_0x894c('0x17')]=_0x1049ab[_0x894c('0x17')];this[_0x894c('0x18')]=_0x1049ab[_0x894c('0x18')];this[_0x894c('0x19')]=moment()['format'](_0x894c('0x1a'));this[_0x894c('0x1b')]=utils['getSeconds'](_0x1049ab[_0x894c('0x17')],_0x1049ab[_0x894c('0x16')]);this[_0x894c('0x1c')]=utils[_0x894c('0x1d')](_0x1049ab[_0x894c('0x18')],_0x1049ab[_0x894c('0x17')]);this[_0x894c('0x1e')]=utils[_0x894c('0x1d')](this[_0x894c('0x19')],_0x1049ab[_0x894c('0x18')]);this['queue']=_0x5860aa[_0x894c('0x7')];this[_0x894c('0x1f')]=_0x5860aa[_0x894c('0x1f')];this[_0x894c('0x20')]=_0x5860aa[_0x894c('0x20')];this[_0x894c('0x21')]=_0x1049ab[_0x894c('0x21')];this['callbackuniqueid']=_0x1049ab[_0x894c('0x22')];this[_0x894c('0x23')]=_0x1049ab[_0x894c('0x23')];this[_0x894c('0x24')]=_0x1049ab[_0x894c('0x24')];this['ContactId']=_0x1049ab[_0x894c('0x25')];this[_0x894c('0x26')]=_0x1049ab[_0x894c('0x26')];this[_0x894c('0x27')]=_0x1049ab['UserId'];this[_0x894c('0x28')]=_0x1049ab['VoiceQueueId'];this[_0x894c('0x29')]=_0x1049ab[_0x894c('0x29')];this[_0x894c('0x2a')]=_0x1049ab[_0x894c('0x2a')]||'';this[_0x894c('0x2b')]=_0x1049ab[_0x894c('0x2b')]||'';this[_0x894c('0x2c')]=_0x1049ab[_0x894c('0x2c')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 496d889..4ab2371 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c6d=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime'];(function(_0x3577ac,_0xa14dda){var _0x5af6c6=function(_0x2cd923){while(--_0x2cd923){_0x3577ac['push'](_0x3577ac['shift']());}};_0x5af6c6(++_0xa14dda);}(_0x0c6d,0x12e));var _0xd0c6=function(_0x40ac38,_0x14c877){_0x40ac38=_0x40ac38-0x0;var _0x38193b=_0x0c6d[_0x40ac38];return _0x38193b;};'use strict';function Final(_0x4ec124){this['uniqueid']=_0x4ec124[_0xd0c6('0x0')];this[_0xd0c6('0x1')]=_0x4ec124['scheduledat'];this[_0xd0c6('0x2')]=_0x4ec124[_0xd0c6('0x2')];this[_0xd0c6('0x3')]=_0x4ec124[_0xd0c6('0x2')]===_0xd0c6('0x4')?_0xd0c6('0x5'):_0x4ec124[_0xd0c6('0x2')];this[_0xd0c6('0x6')]=_0x4ec124[_0xd0c6('0x6')];this[_0xd0c6('0x7')]=_0x4ec124[_0xd0c6('0x7')];this[_0xd0c6('0x8')]=_0x4ec124[_0xd0c6('0x8')];this[_0xd0c6('0x9')]=_0x4ec124[_0xd0c6('0x6')]+_0x4ec124['countcongestionretry']+_0x4ec124[_0xd0c6('0x8')]+_0x4ec124[_0xd0c6('0xa')]+_0x4ec124[_0xd0c6('0xb')]+_0x4ec124[_0xd0c6('0xc')]+_0x4ec124[_0xd0c6('0xd')]+_0x4ec124[_0xd0c6('0xe')];this[_0xd0c6('0xa')]=_0x4ec124[_0xd0c6('0xa')];this['countdropretry']=_0x4ec124['countdropretry'];this[_0xd0c6('0xc')]=_0x4ec124[_0xd0c6('0xc')];this[_0xd0c6('0xd')]=_0x4ec124[_0xd0c6('0xd')];this[_0xd0c6('0xe')]=_0x4ec124['countagentrejectretry'];this['queue']=_0x4ec124[_0xd0c6('0x5')];this['calleridname']=_0x4ec124[_0xd0c6('0xf')];this['calleridnum']=_0x4ec124[_0xd0c6('0x10')];this[_0xd0c6('0x11')]=_0x4ec124[_0xd0c6('0x11')];this[_0xd0c6('0x12')]=_0x4ec124[_0xd0c6('0x12')];this['endtime']=_0x4ec124[_0xd0c6('0x12')];this[_0xd0c6('0x13')]=_0x4ec124[_0xd0c6('0x13')]||0x0;this[_0xd0c6('0x14')]=_0x4ec124['holdtime']||0x0;this['talktime']=_0x4ec124[_0xd0c6('0x15')]||0x0;this[_0xd0c6('0x16')]=_0x4ec124[_0xd0c6('0x16')];this['callbackuniqueid']=_0x4ec124[_0xd0c6('0x17')];this['callbackat']=_0x4ec124[_0xd0c6('0x18')];this[_0xd0c6('0x19')]=_0x4ec124[_0xd0c6('0x19')];this['ContactId']=_0x4ec124[_0xd0c6('0x1a')];this[_0xd0c6('0x1b')]=_0x4ec124['ListId'];this[_0xd0c6('0x1c')]=_0x4ec124[_0xd0c6('0x1c')];this[_0xd0c6('0x1d')]=_0x4ec124[_0xd0c6('0x1d')];this[_0xd0c6('0x1e')]=_0x4ec124[_0xd0c6('0x1e')];this[_0xd0c6('0x1f')]=_0x4ec124[_0xd0c6('0x1f')]||'';this[_0xd0c6('0x20')]=_0x4ec124[_0xd0c6('0x20')]||'';this['state']=_0x4ec124[_0xd0c6('0x21')];this[_0xd0c6('0x22')]=_0x4ec124[_0xd0c6('0x22')];}module[_0xd0c6('0x23')]=Final; \ No newline at end of file +var _0xb6f2=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId'];(function(_0x1ccb6e,_0x4beb7a){var _0xef4ae2=function(_0x3054e4){while(--_0x3054e4){_0x1ccb6e['push'](_0x1ccb6e['shift']());}};_0xef4ae2(++_0x4beb7a);}(_0xb6f2,0xba));var _0x2b6f=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xb6f2[_0x4792c8];return _0x35edb1;};'use strict';function Final(_0xbaea4c){this[_0x2b6f('0x0')]=_0xbaea4c[_0x2b6f('0x0')];this['scheduledat']=_0xbaea4c[_0x2b6f('0x1')];this['type']=_0xbaea4c[_0x2b6f('0x2')];this[_0x2b6f('0x3')]=_0xbaea4c[_0x2b6f('0x2')]===_0x2b6f('0x4')?_0x2b6f('0x5'):_0xbaea4c[_0x2b6f('0x2')];this[_0x2b6f('0x6')]=_0xbaea4c[_0x2b6f('0x6')];this[_0x2b6f('0x7')]=_0xbaea4c['countcongestionretry'];this[_0x2b6f('0x8')]=_0xbaea4c[_0x2b6f('0x8')];this[_0x2b6f('0x9')]=_0xbaea4c[_0x2b6f('0x6')]+_0xbaea4c[_0x2b6f('0x7')]+_0xbaea4c['countnoanswerretry']+_0xbaea4c[_0x2b6f('0xa')]+_0xbaea4c[_0x2b6f('0xb')]+_0xbaea4c[_0x2b6f('0xc')]+_0xbaea4c[_0x2b6f('0xd')]+_0xbaea4c[_0x2b6f('0xe')];this[_0x2b6f('0xa')]=_0xbaea4c['countnosuchnumberretry'];this[_0x2b6f('0xb')]=_0xbaea4c[_0x2b6f('0xb')];this[_0x2b6f('0xc')]=_0xbaea4c[_0x2b6f('0xc')];this[_0x2b6f('0xd')]=_0xbaea4c['countmachineretry'];this['countagentrejectretry']=_0xbaea4c[_0x2b6f('0xe')];this[_0x2b6f('0x5')]=_0xbaea4c['queue'];this[_0x2b6f('0xf')]=_0xbaea4c[_0x2b6f('0xf')];this[_0x2b6f('0x10')]=_0xbaea4c[_0x2b6f('0x10')];this[_0x2b6f('0x11')]=_0xbaea4c['starttime'];this[_0x2b6f('0x12')]=_0xbaea4c[_0x2b6f('0x12')];this[_0x2b6f('0x13')]=_0xbaea4c[_0x2b6f('0x12')];this[_0x2b6f('0x14')]=_0xbaea4c[_0x2b6f('0x14')]||0x0;this['holdtime']=_0xbaea4c[_0x2b6f('0x15')]||0x0;this[_0x2b6f('0x16')]=_0xbaea4c[_0x2b6f('0x16')]||0x0;this[_0x2b6f('0x17')]=_0xbaea4c[_0x2b6f('0x17')];this[_0x2b6f('0x18')]=_0xbaea4c[_0x2b6f('0x18')];this[_0x2b6f('0x19')]=_0xbaea4c[_0x2b6f('0x19')];this['recallme']=_0xbaea4c[_0x2b6f('0x1a')];this[_0x2b6f('0x1b')]=_0xbaea4c['ContactId'];this[_0x2b6f('0x1c')]=_0xbaea4c['ListId'];this['UserId']=_0xbaea4c['UserId'];this[_0x2b6f('0x1d')]=_0xbaea4c[_0x2b6f('0x1d')];this[_0x2b6f('0x1e')]=_0xbaea4c['CampaignId'];this[_0x2b6f('0x1f')]=_0xbaea4c[_0x2b6f('0x1f')]||'';this[_0x2b6f('0x20')]=_0xbaea4c[_0x2b6f('0x20')]||'';this[_0x2b6f('0x21')]=_0xbaea4c[_0x2b6f('0x21')];this[_0x2b6f('0x22')]=_0xbaea4c['statedesc'];}module[_0x2b6f('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index ded2505..c493cfa 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b04=['YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','starttime','responsetime','endtime','format'];(function(_0xf95083,_0x3ea060){var _0xf4bd9=function(_0x3beae9){while(--_0x3beae9){_0xf95083['push'](_0xf95083['shift']());}};_0xf4bd9(++_0x3ea060);}(_0x5b04,0x17a));var _0x45b0=function(_0x3a1c91,_0x46fb03){_0x3a1c91=_0x3a1c91-0x0;var _0x6c5a86=_0x5b04[_0x3a1c91];return _0x6c5a86;};'use strict';var moment=require('moment');var utils=require(_0x45b0('0x0'));function Hangup(_0x34a5e4,_0x1e0ac3){this[_0x45b0('0x1')]=0x4;this[_0x45b0('0x2')]=_0x45b0('0x3');this['scheduledat']=_0x34a5e4[_0x45b0('0x4')];this[_0x45b0('0x5')]=_0x34a5e4[_0x45b0('0x5')];this[_0x45b0('0x6')]=_0x34a5e4[_0x45b0('0x5')]===_0x45b0('0x7')?_0x45b0('0x8'):_0x34a5e4[_0x45b0('0x5')];this[_0x45b0('0x9')]=_0x34a5e4[_0x45b0('0x9')]||![];this['countbusyretry']=_0x34a5e4[_0x45b0('0xa')];this[_0x45b0('0xb')]=_0x34a5e4['countcongestionretry'];this['countnoanswerretry']=_0x34a5e4['countnoanswerretry'];this['countglobal']=_0x34a5e4[_0x45b0('0xa')]+_0x34a5e4[_0x45b0('0xb')]+_0x34a5e4[_0x45b0('0xc')]+_0x34a5e4[_0x45b0('0xd')]+_0x34a5e4[_0x45b0('0xe')]+_0x34a5e4[_0x45b0('0xf')]+_0x34a5e4[_0x45b0('0x10')]+_0x34a5e4[_0x45b0('0x11')];this['countnosuchnumberretry']=_0x34a5e4[_0x45b0('0xd')];this[_0x45b0('0xe')]=_0x34a5e4[_0x45b0('0xe')];this[_0x45b0('0xf')]=_0x34a5e4[_0x45b0('0xf')];this[_0x45b0('0x10')]=_0x34a5e4[_0x45b0('0x10')];this[_0x45b0('0x11')]=_0x34a5e4[_0x45b0('0x11')];this['uniqueid']=_0x1e0ac3['uniqueid'];this['calleridname']=_0x34a5e4['name'];this['calleridnum']=_0x34a5e4['number'];this[_0x45b0('0x12')]=_0x34a5e4[_0x45b0('0x12')];this[_0x45b0('0x13')]=_0x34a5e4[_0x45b0('0x13')];this[_0x45b0('0x14')]=moment()[_0x45b0('0x15')](_0x45b0('0x16'));this[_0x45b0('0x17')]=utils[_0x45b0('0x18')](_0x34a5e4['responsetime'],_0x34a5e4[_0x45b0('0x12')]);this[_0x45b0('0x19')]=0x0;this[_0x45b0('0x1a')]=utils['getSeconds'](this[_0x45b0('0x14')],_0x34a5e4[_0x45b0('0x13')]);this[_0x45b0('0x8')]=_0x34a5e4[_0x45b0('0x8')];this[_0x45b0('0x1b')]=_0x45b0('0x1c');this[_0x45b0('0x1d')]=_0x1e0ac3[_0x45b0('0x1e')];this[_0x45b0('0x1f')]=_0x34a5e4[_0x45b0('0x1f')];this[_0x45b0('0x20')]=_0x34a5e4['callbackuniqueid'];this['callbackat']=_0x34a5e4['callbackat'];this[_0x45b0('0x21')]=_0x34a5e4[_0x45b0('0x21')];this[_0x45b0('0x22')]=_0x34a5e4[_0x45b0('0x22')];this[_0x45b0('0x23')]=_0x34a5e4['ListId'];this[_0x45b0('0x24')]=_0x34a5e4[_0x45b0('0x24')];this[_0x45b0('0x25')]=_0x34a5e4[_0x45b0('0x25')];this['CampaignId']=_0x34a5e4[_0x45b0('0x26')];}module[_0x45b0('0x27')]=Hangup; \ No newline at end of file +var _0xba96=['moment','../utils','statedesc','Answer','scheduledat','type','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x3f111b,_0x147f4b){var _0x55e5aa=function(_0x2c3351){while(--_0x2c3351){_0x3f111b['push'](_0x3f111b['shift']());}};_0x55e5aa(++_0x147f4b);}(_0xba96,0x156));var _0x6ba9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xba96[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x6ba9('0x0'));var utils=require(_0x6ba9('0x1'));function Hangup(_0x3adfd4,_0x3fea54){this['state']=0x4;this[_0x6ba9('0x2')]=_0x6ba9('0x3');this[_0x6ba9('0x4')]=_0x3adfd4['scheduledat'];this[_0x6ba9('0x5')]=_0x3adfd4[_0x6ba9('0x5')];this['campaigntype']=_0x3adfd4[_0x6ba9('0x5')]==='outbound'?_0x6ba9('0x6'):_0x3adfd4['type'];this[_0x6ba9('0x7')]=_0x3adfd4[_0x6ba9('0x7')]||![];this[_0x6ba9('0x8')]=_0x3adfd4[_0x6ba9('0x8')];this[_0x6ba9('0x9')]=_0x3adfd4[_0x6ba9('0x9')];this[_0x6ba9('0xa')]=_0x3adfd4[_0x6ba9('0xa')];this['countglobal']=_0x3adfd4[_0x6ba9('0x8')]+_0x3adfd4['countcongestionretry']+_0x3adfd4[_0x6ba9('0xa')]+_0x3adfd4[_0x6ba9('0xb')]+_0x3adfd4[_0x6ba9('0xc')]+_0x3adfd4[_0x6ba9('0xd')]+_0x3adfd4[_0x6ba9('0xe')]+_0x3adfd4[_0x6ba9('0xf')];this[_0x6ba9('0xb')]=_0x3adfd4[_0x6ba9('0xb')];this[_0x6ba9('0xc')]=_0x3adfd4['countdropretry'];this[_0x6ba9('0xd')]=_0x3adfd4[_0x6ba9('0xd')];this[_0x6ba9('0xe')]=_0x3adfd4[_0x6ba9('0xe')];this[_0x6ba9('0xf')]=_0x3adfd4[_0x6ba9('0xf')];this['uniqueid']=_0x3fea54[_0x6ba9('0x10')];this['calleridname']=_0x3adfd4[_0x6ba9('0x11')];this[_0x6ba9('0x12')]=_0x3adfd4['number'];this[_0x6ba9('0x13')]=_0x3adfd4[_0x6ba9('0x13')];this[_0x6ba9('0x14')]=_0x3adfd4[_0x6ba9('0x14')];this[_0x6ba9('0x15')]=moment()['format'](_0x6ba9('0x16'));this[_0x6ba9('0x17')]=utils['getSeconds'](_0x3adfd4['responsetime'],_0x3adfd4[_0x6ba9('0x13')]);this[_0x6ba9('0x18')]=0x0;this['talktime']=utils['getSeconds'](this['endtime'],_0x3adfd4[_0x6ba9('0x14')]);this[_0x6ba9('0x6')]=_0x3adfd4[_0x6ba9('0x6')];this[_0x6ba9('0x19')]=_0x6ba9('0x1a');this[_0x6ba9('0x1b')]=_0x3fea54[_0x6ba9('0x1c')];this[_0x6ba9('0x1d')]=_0x3adfd4[_0x6ba9('0x1d')];this[_0x6ba9('0x1e')]=_0x3adfd4['callbackuniqueid'];this[_0x6ba9('0x1f')]=_0x3adfd4[_0x6ba9('0x1f')];this['recallme']=_0x3adfd4[_0x6ba9('0x20')];this['ContactId']=_0x3adfd4[_0x6ba9('0x21')];this[_0x6ba9('0x22')]=_0x3adfd4['ListId'];this['UserId']=_0x3adfd4[_0x6ba9('0x23')];this[_0x6ba9('0x24')]=_0x3adfd4[_0x6ba9('0x24')];this[_0x6ba9('0x25')]=_0x3adfd4[_0x6ba9('0x25')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index f909b68..e2d7db7 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e0d=['countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue'];(function(_0x5a326d,_0x483bc6){var _0x1742df=function(_0x1162cf){while(--_0x1162cf){_0x5a326d['push'](_0x5a326d['shift']());}};_0x1742df(++_0x483bc6);}(_0x4e0d,0x17f));var _0xd4e0=function(_0x5dd3d9,_0x346936){_0x5dd3d9=_0x5dd3d9-0x0;var _0x278481=_0x4e0d[_0x5dd3d9];return _0x278481;};'use strict';var utils=require(_0xd4e0('0x0'));function History(_0x41c769){this['uniqueid']=_0x41c769[_0xd4e0('0x1')];this[_0xd4e0('0x2')]=_0x41c769['scheduledat']||undefined;this[_0xd4e0('0x3')]=_0x41c769['type'];this[_0xd4e0('0x4')]=_0x41c769['type']===_0xd4e0('0x5')?_0xd4e0('0x6'):_0x41c769[_0xd4e0('0x3')];this[_0xd4e0('0x7')]=_0x41c769[_0xd4e0('0x7')];this['countcongestionretry']=_0x41c769['countcongestionretry'];this[_0xd4e0('0x8')]=_0x41c769['countnoanswerretry'];this[_0xd4e0('0x9')]=_0x41c769[_0xd4e0('0x7')]+_0x41c769[_0xd4e0('0xa')]+_0x41c769[_0xd4e0('0x8')]+_0x41c769['countnosuchnumberretry']+_0x41c769['countdropretry']+_0x41c769['countabandonedretry']+_0x41c769[_0xd4e0('0xb')]+_0x41c769[_0xd4e0('0xc')];this['countnosuchnumberretry']=_0x41c769[_0xd4e0('0xd')];this[_0xd4e0('0xe')]=_0x41c769[_0xd4e0('0xe')];this[_0xd4e0('0xf')]=_0x41c769[_0xd4e0('0xf')];this[_0xd4e0('0xb')]=_0x41c769['countmachineretry'];this[_0xd4e0('0xc')]=_0x41c769[_0xd4e0('0xc')];this[_0xd4e0('0x6')]=_0x41c769[_0xd4e0('0x6')];this[_0xd4e0('0x10')]=_0x41c769[_0xd4e0('0x11')];this[_0xd4e0('0x12')]=_0x41c769[_0xd4e0('0x13')];this['starttime']=_0x41c769[_0xd4e0('0x14')];this[_0xd4e0('0x15')]=_0x41c769['responsetime'];this[_0xd4e0('0x16')]=_0x41c769[_0xd4e0('0x15')];this[_0xd4e0('0x17')]=utils[_0xd4e0('0x18')](_0x41c769[_0xd4e0('0x15')],_0x41c769[_0xd4e0('0x14')]);this['holdtime']=0x0;this[_0xd4e0('0x19')]=0x0;this[_0xd4e0('0x1a')]=_0x41c769['callback'];this[_0xd4e0('0x1b')]=_0x41c769['callbackuniqueid'];this[_0xd4e0('0x1c')]=_0x41c769[_0xd4e0('0x1c')];this[_0xd4e0('0x1d')]=_0x41c769['recallme'];this[_0xd4e0('0x1e')]=_0x41c769['ContactId'];this['ListId']=_0x41c769['ListId'];this['UserId']=_0x41c769[_0xd4e0('0x1f')];this[_0xd4e0('0x20')]=_0x41c769[_0xd4e0('0x20')];this[_0xd4e0('0x21')]=_0x41c769[_0xd4e0('0x21')];this[_0xd4e0('0x22')]=_0x41c769[_0xd4e0('0x22')]||'';this[_0xd4e0('0x23')]=_0x41c769['originatecalleridname']||'';this[_0xd4e0('0x24')]=_0x41c769[_0xd4e0('0x24')];this[_0xd4e0('0x25')]=_0x41c769[_0xd4e0('0x25')];}module[_0xd4e0('0x26')]=History; \ No newline at end of file +var _0x8d44=['name','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','calleridname'];(function(_0x5974a8,_0xa02263){var _0x3a614b=function(_0x1f0d44){while(--_0x1f0d44){_0x5974a8['push'](_0x5974a8['shift']());}};_0x3a614b(++_0xa02263);}(_0x8d44,0x161));var _0x48d4=function(_0x325f16,_0x128ed4){_0x325f16=_0x325f16-0x0;var _0x24b8ac=_0x8d44[_0x325f16];return _0x24b8ac;};'use strict';var utils=require(_0x48d4('0x0'));function History(_0x10dc73){this['uniqueid']=_0x10dc73[_0x48d4('0x1')];this[_0x48d4('0x2')]=_0x10dc73[_0x48d4('0x2')]||undefined;this[_0x48d4('0x3')]=_0x10dc73['type'];this[_0x48d4('0x4')]=_0x10dc73['type']===_0x48d4('0x5')?_0x48d4('0x6'):_0x10dc73['type'];this[_0x48d4('0x7')]=_0x10dc73[_0x48d4('0x7')];this[_0x48d4('0x8')]=_0x10dc73['countcongestionretry'];this[_0x48d4('0x9')]=_0x10dc73[_0x48d4('0x9')];this[_0x48d4('0xa')]=_0x10dc73[_0x48d4('0x7')]+_0x10dc73[_0x48d4('0x8')]+_0x10dc73[_0x48d4('0x9')]+_0x10dc73['countnosuchnumberretry']+_0x10dc73['countdropretry']+_0x10dc73[_0x48d4('0xb')]+_0x10dc73['countmachineretry']+_0x10dc73[_0x48d4('0xc')];this[_0x48d4('0xd')]=_0x10dc73[_0x48d4('0xd')];this['countdropretry']=_0x10dc73[_0x48d4('0xe')];this[_0x48d4('0xb')]=_0x10dc73[_0x48d4('0xb')];this[_0x48d4('0xf')]=_0x10dc73[_0x48d4('0xf')];this[_0x48d4('0xc')]=_0x10dc73[_0x48d4('0xc')];this[_0x48d4('0x6')]=_0x10dc73['queue'];this[_0x48d4('0x10')]=_0x10dc73[_0x48d4('0x11')];this[_0x48d4('0x12')]=_0x10dc73['number'];this[_0x48d4('0x13')]=_0x10dc73[_0x48d4('0x13')];this[_0x48d4('0x14')]=_0x10dc73[_0x48d4('0x14')];this[_0x48d4('0x15')]=_0x10dc73[_0x48d4('0x14')];this['ringtime']=utils['getSeconds'](_0x10dc73['responsetime'],_0x10dc73['starttime']);this[_0x48d4('0x16')]=0x0;this[_0x48d4('0x17')]=0x0;this[_0x48d4('0x18')]=_0x10dc73[_0x48d4('0x18')];this[_0x48d4('0x19')]=_0x10dc73[_0x48d4('0x19')];this[_0x48d4('0x1a')]=_0x10dc73[_0x48d4('0x1a')];this['recallme']=_0x10dc73[_0x48d4('0x1b')];this[_0x48d4('0x1c')]=_0x10dc73[_0x48d4('0x1c')];this[_0x48d4('0x1d')]=_0x10dc73[_0x48d4('0x1d')];this['UserId']=_0x10dc73[_0x48d4('0x1e')];this['VoiceQueueId']=_0x10dc73[_0x48d4('0x1f')];this[_0x48d4('0x20')]=_0x10dc73['CampaignId'];this[_0x48d4('0x21')]=_0x10dc73['originatecalleridnum']||'';this[_0x48d4('0x22')]=_0x10dc73['originatecalleridname']||'';this['state']=_0x10dc73[_0x48d4('0x23')];this[_0x48d4('0x24')]=_0x10dc73['statedesc'];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 4a9aa6d..3673667 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe135=['reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','statedesc','exports','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime'];(function(_0x2e80be,_0x1244d5){var _0x4dfac7=function(_0x2d50d8){while(--_0x2d50d8){_0x2e80be['push'](_0x2e80be['shift']());}};_0x4dfac7(++_0x1244d5);}(_0xe135,0x177));var _0x5e13=function(_0x3aaf69,_0x318ff9){_0x3aaf69=_0x3aaf69-0x0;var _0x4542c6=_0xe135[_0x3aaf69];return _0x4542c6;};'use strict';var utils=require(_0x5e13('0x0'));function QueueCallerAbandon(_0x31c3d7,_0x92c1ed){this[_0x5e13('0x1')]=_0x31c3d7[_0x5e13('0x1')];this[_0x5e13('0x2')]=_0x31c3d7[_0x5e13('0x2')];this['campaigntype']=_0x31c3d7[_0x5e13('0x2')]===_0x5e13('0x3')?_0x5e13('0x4'):_0x31c3d7[_0x5e13('0x2')];this[_0x5e13('0x5')]=_0x31c3d7[_0x5e13('0x5')];this[_0x5e13('0x6')]=_0x31c3d7['countcongestionretry'];this['countnoanswerretry']=_0x31c3d7[_0x5e13('0x7')];this['countglobal']=_0x31c3d7[_0x5e13('0x5')]+_0x31c3d7[_0x5e13('0x6')]+_0x31c3d7['countnoanswerretry']+_0x31c3d7['countnosuchnumberretry']+_0x31c3d7[_0x5e13('0x8')]+_0x31c3d7[_0x5e13('0x9')]+_0x31c3d7[_0x5e13('0xa')]+_0x31c3d7['countagentrejectretry'];this['countnosuchnumberretry']=_0x31c3d7[_0x5e13('0xb')];this[_0x5e13('0x8')]=_0x31c3d7[_0x5e13('0x8')];this[_0x5e13('0x9')]=_0x31c3d7[_0x5e13('0x9')];this['countmachineretry']=_0x31c3d7[_0x5e13('0xa')];this[_0x5e13('0xc')]=_0x31c3d7['countagentrejectretry'];this['uniqueid']=_0x92c1ed[_0x5e13('0xd')];this[_0x5e13('0xe')]=_0x31c3d7['name'];this[_0x5e13('0xf')]=_0x31c3d7[_0x5e13('0x10')];this[_0x5e13('0x11')]=_0x31c3d7[_0x5e13('0x11')];this[_0x5e13('0x12')]=_0x31c3d7[_0x5e13('0x12')];this[_0x5e13('0x13')]=_0x31c3d7[_0x5e13('0x13')];this[_0x5e13('0x14')]=_0x31c3d7[_0x5e13('0x14')];this[_0x5e13('0x15')]=this['droptime'];this[_0x5e13('0x16')]=utils[_0x5e13('0x17')](_0x31c3d7[_0x5e13('0x12')],_0x31c3d7[_0x5e13('0x11')]);this[_0x5e13('0x18')]=utils['getSeconds'](this[_0x5e13('0x13')],_0x31c3d7['responsetime']);this['talktime']=0x0;this[_0x5e13('0x4')]=_0x92c1ed[_0x5e13('0x4')];this['membername']=_0x92c1ed['connectedlinename'];this['reason']=_0x92c1ed[_0x5e13('0x19')];this[_0x5e13('0x1a')]=_0x31c3d7[_0x5e13('0x1a')];this[_0x5e13('0x1b')]=_0x31c3d7['callbackuniqueid'];this[_0x5e13('0x1c')]=_0x31c3d7['callbackat'];this['recallme']=_0x31c3d7[_0x5e13('0x1d')];this[_0x5e13('0x1e')]=_0x31c3d7[_0x5e13('0x1e')];this[_0x5e13('0x1f')]=_0x31c3d7[_0x5e13('0x1f')];this[_0x5e13('0x20')]=_0x31c3d7[_0x5e13('0x20')];this[_0x5e13('0x21')]=_0x31c3d7[_0x5e13('0x21')];this[_0x5e13('0x22')]=_0x31c3d7[_0x5e13('0x22')];this[_0x5e13('0x23')]=_0x31c3d7[_0x5e13('0x23')]||'';this['originatecalleridname']=_0x31c3d7[_0x5e13('0x24')]||'';this['agiafterat']=_0x31c3d7[_0x5e13('0x25')];this['state']=_0x31c3d7['state'];this[_0x5e13('0x26')]=_0x31c3d7[_0x5e13('0x26')];}module[_0x5e13('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x9fe7=['countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal'];(function(_0x5bbaf4,_0xfc8b3f){var _0x477d0a=function(_0x51189b){while(--_0x51189b){_0x5bbaf4['push'](_0x5bbaf4['shift']());}};_0x477d0a(++_0xfc8b3f);}(_0x9fe7,0xf9));var _0x79fe=function(_0xba4026,_0xeaa0f7){_0xba4026=_0xba4026-0x0;var _0x3a8666=_0x9fe7[_0xba4026];return _0x3a8666;};'use strict';var utils=require(_0x79fe('0x0'));function QueueCallerAbandon(_0x1171f2,_0x2fbdbb){this[_0x79fe('0x1')]=_0x1171f2[_0x79fe('0x1')];this['type']=_0x1171f2[_0x79fe('0x2')];this[_0x79fe('0x3')]=_0x1171f2[_0x79fe('0x2')]===_0x79fe('0x4')?_0x79fe('0x5'):_0x1171f2[_0x79fe('0x2')];this[_0x79fe('0x6')]=_0x1171f2['countbusyretry'];this['countcongestionretry']=_0x1171f2[_0x79fe('0x7')];this['countnoanswerretry']=_0x1171f2['countnoanswerretry'];this[_0x79fe('0x8')]=_0x1171f2[_0x79fe('0x6')]+_0x1171f2[_0x79fe('0x7')]+_0x1171f2['countnoanswerretry']+_0x1171f2[_0x79fe('0x9')]+_0x1171f2[_0x79fe('0xa')]+_0x1171f2[_0x79fe('0xb')]+_0x1171f2['countmachineretry']+_0x1171f2[_0x79fe('0xc')];this['countnosuchnumberretry']=_0x1171f2['countnosuchnumberretry'];this[_0x79fe('0xa')]=_0x1171f2[_0x79fe('0xa')];this[_0x79fe('0xb')]=_0x1171f2[_0x79fe('0xb')];this[_0x79fe('0xd')]=_0x1171f2['countmachineretry'];this[_0x79fe('0xc')]=_0x1171f2[_0x79fe('0xc')];this[_0x79fe('0xe')]=_0x2fbdbb[_0x79fe('0xe')];this[_0x79fe('0xf')]=_0x1171f2[_0x79fe('0x10')];this[_0x79fe('0x11')]=_0x1171f2[_0x79fe('0x12')];this[_0x79fe('0x13')]=_0x1171f2[_0x79fe('0x13')];this[_0x79fe('0x14')]=_0x1171f2[_0x79fe('0x14')];this[_0x79fe('0x15')]=_0x1171f2[_0x79fe('0x15')];this[_0x79fe('0x16')]=_0x1171f2['dropreason'];this['endtime']=this['droptime'];this['ringtime']=utils[_0x79fe('0x17')](_0x1171f2['responsetime'],_0x1171f2['starttime']);this[_0x79fe('0x18')]=utils[_0x79fe('0x17')](this[_0x79fe('0x15')],_0x1171f2[_0x79fe('0x14')]);this[_0x79fe('0x19')]=0x0;this[_0x79fe('0x5')]=_0x2fbdbb['queue'];this[_0x79fe('0x1a')]=_0x2fbdbb['connectedlinename'];this[_0x79fe('0x1b')]=_0x2fbdbb[_0x79fe('0x1b')];this['callback']=_0x1171f2[_0x79fe('0x1c')];this[_0x79fe('0x1d')]=_0x1171f2[_0x79fe('0x1d')];this[_0x79fe('0x1e')]=_0x1171f2[_0x79fe('0x1e')];this[_0x79fe('0x1f')]=_0x1171f2['recallme'];this['ContactId']=_0x1171f2[_0x79fe('0x20')];this[_0x79fe('0x21')]=_0x1171f2['ListId'];this[_0x79fe('0x22')]=_0x1171f2[_0x79fe('0x22')];this[_0x79fe('0x23')]=_0x1171f2[_0x79fe('0x23')];this[_0x79fe('0x24')]=_0x1171f2[_0x79fe('0x24')];this['originatecalleridnum']=_0x1171f2[_0x79fe('0x25')]||'';this[_0x79fe('0x26')]=_0x1171f2[_0x79fe('0x26')]||'';this['agiafterat']=_0x1171f2[_0x79fe('0x27')];this['state']=_0x1171f2[_0x79fe('0x28')];this[_0x79fe('0x29')]=_0x1171f2[_0x79fe('0x29')];}module[_0x79fe('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 36837d2..3d69b56 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd101=['createHistory','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[createHistory]'];(function(_0x7fc0c1,_0x7d2d7){var _0x2597e0=function(_0x280036){while(--_0x280036){_0x7fc0c1['push'](_0x7fc0c1['shift']());}};_0x2597e0(++_0x7d2d7);}(_0xd101,0xc1));var _0x1d10=function(_0x568b02,_0x3df503){_0x568b02=_0x568b02-0x0;var _0x3a0a26=_0xd101[_0x568b02];return _0x3a0a26;};'use strict';var util=require(_0x1d10('0x0'));var logger=require('../../../../config/logger')(_0x1d10('0x1'));var cmHopper=require(_0x1d10('0x2'));var cmHopperAdditionalPhone=require(_0x1d10('0x3'));var cmHopperBlack=require(_0x1d10('0x4'));var cmHopperHistory=require(_0x1d10('0x5'));function inspectError(_0x25b425){return util[_0x1d10('0x6')](_0x25b425,{'showHidden':![],'depth':null});}function getContactDialer(_0x1e83e0,_0x5c5c42,_0x42b6d2){return cmHopper[_0x1d10('0x7')](_0x1e83e0['id'],_0x5c5c42,_0x42b6d2,_0x1e83e0[_0x1d10('0x8')])[_0x1d10('0x9')](function(_0xb9e08){_0x1e83e0[_0x1d10('0xa')]=0x0;logger[_0x1d10('0xb')](_0x1d10('0xc'),inspectError(_0xb9e08));});}exports[_0x1d10('0x7')]=getContactDialer;function getContactDialerIvr(_0x182c87,_0xf7926b){return cmHopper[_0x1d10('0xd')](_0x182c87['id'],_0xf7926b,_0x182c87[_0x1d10('0x8')])[_0x1d10('0x9')](function(_0x42efad){_0x182c87[_0x1d10('0xa')]=0x0;logger[_0x1d10('0xb')]('[getContactDialerIvr]',inspectError(_0x42efad));});}exports[_0x1d10('0xd')]=getContactDialerIvr;function countReScheduled(_0x93cb59){return cmHopper[_0x1d10('0xe')](_0x93cb59)[_0x1d10('0x9')](function(_0x268506){logger['error'](_0x1d10('0xf'),inspectError(_0x268506));});}exports[_0x1d10('0xe')]=countReScheduled;function rescheduleContact(_0x1a6586){return cmHopper[_0x1d10('0x10')](_0x1a6586)[_0x1d10('0x9')](function(_0x183bc4){logger['error'](_0x1d10('0x11'),inspectError(_0x183bc4));});}exports[_0x1d10('0x10')]=rescheduleContact;function unlockContact(_0x306953,_0x2ad3c0,_0x4f014a){return cmHopper[_0x1d10('0x12')](_0x306953,_0x2ad3c0,_0x4f014a)[_0x1d10('0x9')](function(_0x41152c){logger[_0x1d10('0xb')](_0x1d10('0x13'),inspectError(_0x41152c));});}exports[_0x1d10('0x12')]=unlockContact;function moveContactManagedDialer(_0x4528a6){return cmHopper['moveContactManagedDialer'](_0x4528a6)[_0x1d10('0x9')](function(_0x1163dd){logger[_0x1d10('0xb')](_0x1d10('0x14'),inspectError(_0x1163dd));});}exports[_0x1d10('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x5e61f8){return cmHopperBlack['checkIsBlackList'](_0x5e61f8)[_0x1d10('0x9')](function(_0x57ec1c){logger['error']('[checkIsBlackList]',inspectError(_0x57ec1c));});}exports[_0x1d10('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x2496bc){return cmHopperBlack[_0x1d10('0x17')](_0x2496bc)[_0x1d10('0x9')](function(_0x4ce84a){logger['error'](_0x1d10('0x18'),inspectError(_0x4ce84a));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x68b09,_0x474321,_0x160802){return cmHopperAdditionalPhone[_0x1d10('0x19')](_0x68b09,_0x474321,_0x160802)[_0x1d10('0x9')](function(_0x3601ba){logger[_0x1d10('0xb')](_0x1d10('0x1a'),inspectError(_0x3601ba));});}exports[_0x1d10('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x84055f,_0xf1e4c8,_0x5abc58){return cmHopperAdditionalPhone[_0x1d10('0x1b')](_0x84055f,_0xf1e4c8,_0x5abc58)[_0x1d10('0x9')](function(_0x475934){logger[_0x1d10('0xb')](_0x1d10('0x1c'),inspectError(_0x475934));});}exports[_0x1d10('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x38f583){return cmHopperHistory[_0x1d10('0x1d')](_0x38f583)['catch'](function(_0x355e10){logger[_0x1d10('0xb')]('[avgHandleTime]',inspectError(_0x355e10));});}exports[_0x1d10('0x1d')]=avgHandleTime;function createHistory(_0x52d514){return cmHopperHistory['createHistory'](_0x52d514)[_0x1d10('0x9')](function(_0x597aea){logger[_0x1d10('0xb')](_0x1d10('0x1e'),inspectError(_0x597aea));});}exports[_0x1d10('0x1f')]=createHistory; \ No newline at end of file +var _0x68b3=['../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper'];(function(_0x1b9d5f,_0x48b57d){var _0x5ec1cf=function(_0x5c663b){while(--_0x5c663b){_0x1b9d5f['push'](_0x1b9d5f['shift']());}};_0x5ec1cf(++_0x48b57d);}(_0x68b3,0x1d8));var _0x368b=function(_0x5776b8,_0x1fa1a2){_0x5776b8=_0x5776b8-0x0;var _0x3d84f5=_0x68b3[_0x5776b8];return _0x3d84f5;};'use strict';var util=require(_0x368b('0x0'));var logger=require(_0x368b('0x1'))(_0x368b('0x2'));var cmHopper=require(_0x368b('0x3'));var cmHopperAdditionalPhone=require(_0x368b('0x4'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x368b('0x5'));function inspectError(_0x3325ac){return util[_0x368b('0x6')](_0x3325ac,{'showHidden':![],'depth':null});}function getContactDialer(_0x404282,_0x5d68cb,_0x12eb8f){return cmHopper[_0x368b('0x7')](_0x404282['id'],_0x5d68cb,_0x12eb8f,_0x404282[_0x368b('0x8')])[_0x368b('0x9')](function(_0x4406c8){_0x404282[_0x368b('0xa')]=0x0;logger[_0x368b('0xb')](_0x368b('0xc'),inspectError(_0x4406c8));});}exports[_0x368b('0x7')]=getContactDialer;function getContactDialerIvr(_0x1f64d8,_0x2a7b9f){return cmHopper['getContactDialerIvr'](_0x1f64d8['id'],_0x2a7b9f,_0x1f64d8[_0x368b('0x8')])[_0x368b('0x9')](function(_0x34a110){_0x1f64d8['temp']=0x0;logger[_0x368b('0xb')](_0x368b('0xd'),inspectError(_0x34a110));});}exports[_0x368b('0xe')]=getContactDialerIvr;function countReScheduled(_0x5924a6){return cmHopper[_0x368b('0xf')](_0x5924a6)[_0x368b('0x9')](function(_0x514dc7){logger[_0x368b('0xb')](_0x368b('0x10'),inspectError(_0x514dc7));});}exports[_0x368b('0xf')]=countReScheduled;function rescheduleContact(_0x4015fe){return cmHopper[_0x368b('0x11')](_0x4015fe)['catch'](function(_0x2b326c){logger[_0x368b('0xb')]('[rescheduleContact]',inspectError(_0x2b326c));});}exports[_0x368b('0x11')]=rescheduleContact;function unlockContact(_0x2aabb9,_0x30c245,_0x515350){return cmHopper[_0x368b('0x12')](_0x2aabb9,_0x30c245,_0x515350)[_0x368b('0x9')](function(_0x1f1029){logger['error'](_0x368b('0x13'),inspectError(_0x1f1029));});}exports[_0x368b('0x12')]=unlockContact;function moveContactManagedDialer(_0x1c2956){return cmHopper['moveContactManagedDialer'](_0x1c2956)['catch'](function(_0x3e2e9f){logger[_0x368b('0xb')](_0x368b('0x14'),inspectError(_0x3e2e9f));});}exports[_0x368b('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x1a4f20){return cmHopperBlack['checkIsBlackList'](_0x1a4f20)[_0x368b('0x9')](function(_0x44cfe6){logger[_0x368b('0xb')](_0x368b('0x16'),inspectError(_0x44cfe6));});}exports[_0x368b('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0x26b206){return cmHopperBlack[_0x368b('0x18')](_0x26b206)[_0x368b('0x9')](function(_0x508e48){logger[_0x368b('0xb')](_0x368b('0x19'),inspectError(_0x508e48));});}exports[_0x368b('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0xc0f7af,_0x286853,_0x4c2fca){return cmHopperAdditionalPhone[_0x368b('0x1a')](_0xc0f7af,_0x286853,_0x4c2fca)[_0x368b('0x9')](function(_0x3a22bd){logger[_0x368b('0xb')](_0x368b('0x1b'),inspectError(_0x3a22bd));});}exports[_0x368b('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x430e16,_0x11ea2d,_0x3123c1){return cmHopperAdditionalPhone[_0x368b('0x1c')](_0x430e16,_0x11ea2d,_0x3123c1)[_0x368b('0x9')](function(_0x344d8a){logger[_0x368b('0xb')](_0x368b('0x1d'),inspectError(_0x344d8a));});}exports[_0x368b('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x23a83a){return cmHopperHistory[_0x368b('0x1e')](_0x23a83a)[_0x368b('0x9')](function(_0x39ef94){logger[_0x368b('0xb')](_0x368b('0x1f'),inspectError(_0x39ef94));});}exports[_0x368b('0x1e')]=avgHandleTime;function createHistory(_0x107d2f){return cmHopperHistory[_0x368b('0x20')](_0x107d2f)['catch'](function(_0x4af77a){logger[_0x368b('0xb')](_0x368b('0x21'),inspectError(_0x4af77a));});}exports[_0x368b('0x20')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 5bf8d81..0aeb138 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x655b=['checkContactEmpty','checkContactLowerLimitOriginate','description','tags','updatedAt','undefined','%s%s','XMD-','toUpperCase','lodash','moment','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','isOutboundQueue','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','seconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','dialGlobalInterval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','status','TrunkBackup','includes','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','match','string','isUndefined','\x22%s\x22\x20<%s>','\x22\x22\x20<>','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','length'];(function(_0xe1b03c,_0x50ddbc){var _0x376a63=function(_0x38c6dd){while(--_0x38c6dd){_0xe1b03c['push'](_0xe1b03c['shift']());}};_0x376a63(++_0x50ddbc);}(_0x655b,0x159));var _0xb655=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x655b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb655('0x0'));var moment=require(_0xb655('0x1'));var util=require('util');var logger=require('../../../../config/logger')(_0xb655('0x2'));var timezones=require(_0xb655('0x3'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xb655('0x4'),'BLACKLIST':_0xb655('0x5'),'CONTACTS_RESCHEDULED':_0xb655('0x6'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xb655('0x7'),'EMPTY_INTERVAL':_0xb655('0x8'),'INACTIVE':_0xb655('0x9'),'NO_AGENTS_LOGGED':_0xb655('0xa'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xb655('0xb'),'OVERTIME_INTERVAL':_0xb655('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0xb655('0xd'),'QUEUE_RECALL':_0xb655('0xe'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0xb655('0xf'),'UNKNOWN_TIMEZONE':_0xb655('0x10'),'UNREACHABLE_TRUNK':_0xb655('0x11')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2dd472){return _0x2dd472[_0xb655('0x12')]===_0xb655('0x13');}exports[_0xb655('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x13ce5e){return _0x13ce5e[_0xb655('0x15')]===_0xb655('0x16');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x32c147){return _0x32c147[_0xb655('0x15')]==='outbound';}exports[_0xb655('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x3b00f7){return _0x3b00f7[_0xb655('0x18')];}exports[_0xb655('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2b181f){return _0x2b181f['active'];}exports[_0xb655('0x1a')]=isIVRCampaignActive;function getSeconds(_0x115a7f,_0xfdf637){var _0x1fd762=moment(_0x115a7f)['milliseconds'](0x0);var _0x418837=moment(_0xfdf637)[_0xb655('0x1b')](0x0);return _0x1fd762['diff'](_0x418837,_0xb655('0x1c'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x43ab8d,_0x408ca9){var _0x19a50c=![];var _0x1a9291=_0x43ab8d[_0xb655('0x12')]!==_0x408ca9[_0xb655('0x12')]||_0x43ab8d[_0xb655('0x18')]!==_0x408ca9[_0xb655('0x18')]||_0x43ab8d['message']!==_0x408ca9[_0xb655('0x1d')];var _0x1470e0=_0x43ab8d[_0xb655('0x1e')]!==_0x408ca9[_0xb655('0x1e')]||_0x43ab8d['loggedIn']!==_0x408ca9[_0xb655('0x1f')]||_0x43ab8d[_0xb655('0x20')]!==_0x408ca9[_0xb655('0x20')]||_0x43ab8d['paused']!==_0x408ca9[_0xb655('0x21')]||_0x43ab8d[_0xb655('0x22')]!==_0x408ca9['talking']||_0x43ab8d[_0xb655('0x23')]!==_0x408ca9[_0xb655('0x23')]||_0x43ab8d[_0xb655('0x24')]!==_0x408ca9[_0xb655('0x24')]||_0x43ab8d['inUse']!==_0x408ca9[_0xb655('0x25')]||_0x43ab8d[_0xb655('0x26')]!==_0x408ca9['originated'];if(_0x43ab8d[_0xb655('0x27')]&&_0x408ca9['Trunk']){_0x19a50c=_0x43ab8d[_0xb655('0x27')][_0xb655('0x28')]!==_0x408ca9[_0xb655('0x27')][_0xb655('0x28')]||_0x43ab8d[_0xb655('0x27')]['active']!==_0x408ca9[_0xb655('0x27')][_0xb655('0x29')];}return _0x1a9291||_0x1470e0||_0x19a50c;}exports[_0xb655('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1108f1){var _0x4c1d1e=null;var _0xf827d5=_0x1108f1[_0xb655('0x2b')];if(_['isNil'](_0x1108f1['dialGlobalInterval'])||_[_0xb655('0x2c')](_0x1108f1['Interval'])||_[_0xb655('0x2c')](_0x1108f1[_0xb655('0x2d')][_0xb655('0x2e')])){_0x4c1d1e=CAMPAIGN_STATUS[_0xb655('0x2f')];}else if(_[_0xb655('0x30')](_0x1108f1[_0xb655('0x31')])||_[_0xb655('0x30')](_0x1108f1[_0xb655('0x2d')][_0xb655('0x2e')])){_0x4c1d1e=CAMPAIGN_STATUS[_0xb655('0x32')];}else if(_0xf827d5&&!timezones[_0xf827d5]){_0x4c1d1e=CAMPAIGN_STATUS[_0xb655('0x33')];}return _0x4c1d1e;}function checkAnyValidTrunk(_0x22d763,_0x34c493){var _0x4ca16a=null;var _0x496efc=_0xb655('0x34');var _0x1a1329=[_0xb655('0x35'),'unmonitored'];var _0x5072f3=!![];if(_0x22d763['Trunk']&&_0x22d763[_0xb655('0x27')][_0xb655('0x29')]){_0x496efc+=_0x22d763[_0xb655('0x27')]['name'];_0x4ca16a=_0x34c493[_0x496efc];_0x5072f3=_0x1a1329['includes'](_0x4ca16a[_0xb655('0x36')]);}else if(_0x22d763['TrunkBackup']&&_0x22d763['TrunkBackup']['active']){_0x496efc+=_0x22d763[_0xb655('0x37')][_0xb655('0x28')];_0x4ca16a=_0x34c493[_0x496efc];_0x5072f3=_0x1a1329[_0xb655('0x38')](_0x4ca16a['status']);}return _0x5072f3;}function getQueueCampaignStatusMessage(_0x173c9f,_0x217cb7){var _0x2ae950=CAMPAIGN_STATUS['ACTIVE'];var _0x3d1eb2=isPreviewCampaign(_0x173c9f);if(!isQueueCampaignActive(_0x173c9f)){if(_0x3d1eb2){_0x2ae950=CAMPAIGN_STATUS[_0xb655('0x39')];}else{if(_0x173c9f['originated']===0x0&&_0x173c9f['talking']===0x0&&_0x173c9f[_0xb655('0x24')]===0x0&&(_0x173c9f[_0xb655('0x23')]||0x0)===0x0){_0x2ae950=CAMPAIGN_STATUS[_0xb655('0x39')];}else{_0x2ae950=CAMPAIGN_STATUS[_0xb655('0x3a')];}}}else if(_0x173c9f[_0xb655('0x1f')]===0x0){_0x2ae950=CAMPAIGN_STATUS[_0xb655('0x3b')];}else if(!checkAnyValidTrunk(_0x173c9f,_0x217cb7)){_0x2ae950=CAMPAIGN_STATUS[_0xb655('0x3c')];}else if(!isPreviewCampaign(_0x173c9f)){var _0x24ad91=checkAnyValidQueueCampaignInterval(_0x173c9f);if(_0x24ad91){_0x2ae950=_0x24ad91;}}return _0x2ae950;}exports[_0xb655('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1da539){var _0x2f711a=CAMPAIGN_STATUS[_0xb655('0x3a')];if(_0x1da539['originated']===0x0&&_0x1da539[_0xb655('0x22')]===0x0&&_0x1da539[_0xb655('0x24')]===0x0&&(_0x1da539[_0xb655('0x23')]||0x0)===0x0){_0x2f711a=CAMPAIGN_STATUS[_0xb655('0x39')];}return _0x2f711a;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2817b1){var _0x5df7bf=_0x2817b1[_0xb655('0x3e')](/"(.*?)"/);return _0x5df7bf?_0x5df7bf[0x1]:_0x2817b1;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x196b0b,_0x1cac3c,_0x347b94){if(!_['isUndefined'](_0x347b94)&&typeof _0x347b94===_0xb655('0x3f')&&!_[_0xb655('0x30')](_0x347b94)){if(!_[_0xb655('0x40')](_0x1cac3c)&&typeof _0x1cac3c===_0xb655('0x3f')&&!_['isEmpty'](_0x1cac3c)){return util['format'](_0xb655('0x41'),_0x1cac3c,_0x347b94);}return util['format'](_0xb655('0x41'),_0x347b94,_0x347b94);}if(!_[_0xb655('0x40')](_0x196b0b)&&typeof _0x196b0b===_0xb655('0x3f')&&!_[_0xb655('0x30')](_0x196b0b)){return _0x196b0b;}return _0xb655('0x42');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x2a1241,_0x4c4b6e){var _0x2b5d02;var _0x387b40;var _0x1fb93b;if(_0x4c4b6e<=0x0){_0x4c4b6e=0x1;}_0x2b5d02=new RegExp('\x5cw{0,'+_0x4c4b6e+'}$');_0x387b40=Math['pow'](0xa,_0x4c4b6e-0x1);_0x1fb93b=Math[_0xb655('0x43')](0xa,_0x4c4b6e)-0x1;return util['format']('%s',_[_0xb655('0x44')](_0x2a1241,_0x2b5d02,_[_0xb655('0x45')](_0x387b40,_0x1fb93b)[_0xb655('0x46')]()));}exports[_0xb655('0x47')]=getCallerIdRandom;function decrementOriginate(_0x2807f7){if(_0x2807f7[_0xb655('0x26')]&&_0x2807f7[_0xb655('0x26')]>0x0){_0x2807f7[_0xb655('0x26')]-=0x1;}else{logger[_0xb655('0x48')](_0xb655('0x49'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x55fa6a){return _0x55fa6a&&_0x55fa6a[_0xb655('0x4a')]>0x0;}exports[_0xb655('0x4b')]=checkContactEmpty;function erlangb(_0x49362c,_0x503243){if(_0x503243===0x0){return 0x0;}var _0x54c8a5=0x1;for(var _0x5f38e7=0x1;_0x5f38e7<=_0x503243;_0x5f38e7+=0x1){_0x54c8a5=0x1+_0x54c8a5*_0x5f38e7/_0x49362c;}return 0x1/_0x54c8a5;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x240aaa,_0x12839c,_0x23d890){if(_0x12839c>_0x23d890){for(var _0x4143fe=0x0;_0x4143fe<_0x12839c-_0x23d890;_0x4143fe+=0x1){decrementOriginate(_0x240aaa);}}}exports[_0xb655('0x4c')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x21d24a){var _0x2a93db={};var _0x392b0b=['id','createdAt',_0xb655('0x4d'),_0xb655('0x4e'),_0xb655('0x4f')];if(_0x21d24a){for(var _0x3aada7 in _0x21d24a){if(typeof _0x21d24a[_0x3aada7]!==_0xb655('0x50')){if(!_['isNil'](_0x21d24a[_0x3aada7])&&!_0x392b0b[_0xb655('0x38')](_0x3aada7)){_0x2a93db[util['format'](_0xb655('0x51'),_0xb655('0x52'),_0x3aada7[_0xb655('0x53')]())]=_0x21d24a[_0x3aada7];}}}}return _0x2a93db;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x0731=['available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','description','tags','updatedAt','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','util','dialer','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message'];(function(_0x5932c7,_0x49c434){var _0xf5d6ef=function(_0x416f6b){while(--_0x416f6b){_0x5932c7['push'](_0x5932c7['shift']());}};_0xf5d6ef(++_0x49c434);}(_0x0731,0x14a));var _0x1073=function(_0x46a827,_0x8d79fe){_0x46a827=_0x46a827-0x0;var _0x396d8b=_0x0731[_0x46a827];return _0x396d8b;};'use strict';var _=require(_0x1073('0x0'));var moment=require('moment');var util=require(_0x1073('0x1'));var logger=require('../../../../config/logger')(_0x1073('0x2'));var timezones=require('../../../../config/environment/shared')[_0x1073('0x3')];var CAMPAIGN_STATUS={'ACTIVE':_0x1073('0x4'),'BLACKLIST':_0x1073('0x5'),'CONTACTS_RESCHEDULED':_0x1073('0x6'),'DEACTIVATED':_0x1073('0x7'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x1073('0x8'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x1073('0x9'),'NO_AVAILABLE_CONTACTS':_0x1073('0xa'),'NULL_INTERVAL':_0x1073('0xb'),'OVERTIME_INTERVAL':_0x1073('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0x1073('0xd'),'QUEUE_RECALL':_0x1073('0xe'),'RECALL_TIMEOUT':_0x1073('0xf'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x1073('0x10'),'UNREACHABLE_TRUNK':_0x1073('0x11')};exports[_0x1073('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2f27f9){return _0x2f27f9[_0x1073('0x13')]===_0x1073('0x14');}exports[_0x1073('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x392a0d){return _0x392a0d[_0x1073('0x16')]===_0x1073('0x17');}exports[_0x1073('0x18')]=isIVRCampaign;function isOutboundQueue(_0x1addf3){return _0x1addf3[_0x1073('0x16')]===_0x1073('0x19');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x1bed65){return _0x1bed65[_0x1073('0x1a')];}exports[_0x1073('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2a9240){return _0x2a9240['active'];}exports[_0x1073('0x1c')]=isIVRCampaignActive;function getSeconds(_0x3f1b3e,_0x38ab1c){var _0x481244=moment(_0x3f1b3e)[_0x1073('0x1d')](0x0);var _0x3edb6d=moment(_0x38ab1c)[_0x1073('0x1d')](0x0);return _0x481244[_0x1073('0x1e')](_0x3edb6d,_0x1073('0x1f'));}exports[_0x1073('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x28fb21,_0x2571f5){var _0x482422=![];var _0x2cd2b1=_0x28fb21[_0x1073('0x13')]!==_0x2571f5[_0x1073('0x13')]||_0x28fb21[_0x1073('0x1a')]!==_0x2571f5[_0x1073('0x1a')]||_0x28fb21['message']!==_0x2571f5[_0x1073('0x21')];var _0x17765c=_0x28fb21['available']!==_0x2571f5[_0x1073('0x22')]||_0x28fb21['loggedIn']!==_0x2571f5[_0x1073('0x23')]||_0x28fb21[_0x1073('0x24')]!==_0x2571f5[_0x1073('0x24')]||_0x28fb21[_0x1073('0x25')]!==_0x2571f5[_0x1073('0x25')]||_0x28fb21['talking']!==_0x2571f5[_0x1073('0x26')]||_0x28fb21[_0x1073('0x27')]!==_0x2571f5[_0x1073('0x27')]||_0x28fb21[_0x1073('0x28')]!==_0x2571f5['waiting']||_0x28fb21[_0x1073('0x29')]!==_0x2571f5[_0x1073('0x29')]||_0x28fb21[_0x1073('0x2a')]!==_0x2571f5['originated'];if(_0x28fb21[_0x1073('0x2b')]&&_0x2571f5[_0x1073('0x2b')]){_0x482422=_0x28fb21[_0x1073('0x2b')][_0x1073('0x2c')]!==_0x2571f5['Trunk']['name']||_0x28fb21[_0x1073('0x2b')][_0x1073('0x2d')]!==_0x2571f5['Trunk'][_0x1073('0x2d')];}return _0x2cd2b1||_0x17765c||_0x482422;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x4f9037){var _0xbba0ac=null;var _0x345fcd=_0x4f9037['dialTimezone'];if(_[_0x1073('0x2e')](_0x4f9037[_0x1073('0x2f')])||_[_0x1073('0x2e')](_0x4f9037[_0x1073('0x30')])||_['isNil'](_0x4f9037[_0x1073('0x30')][_0x1073('0x31')])){_0xbba0ac=CAMPAIGN_STATUS[_0x1073('0x32')];}else if(_['isEmpty'](_0x4f9037['dialGlobalInterval'])||_[_0x1073('0x33')](_0x4f9037[_0x1073('0x30')][_0x1073('0x31')])){_0xbba0ac=CAMPAIGN_STATUS[_0x1073('0x34')];}else if(_0x345fcd&&!timezones[_0x345fcd]){_0xbba0ac=CAMPAIGN_STATUS[_0x1073('0x35')];}return _0xbba0ac;}function checkAnyValidTrunk(_0x2e9edc,_0x3579a4){var _0xc99353=null;var _0x2b59d2='SIP/';var _0x4437d1=[_0x1073('0x36'),_0x1073('0x37')];var _0x572270=!![];if(_0x2e9edc[_0x1073('0x2b')]&&_0x2e9edc['Trunk'][_0x1073('0x2d')]){_0x2b59d2+=_0x2e9edc[_0x1073('0x2b')][_0x1073('0x2c')];_0xc99353=_0x3579a4[_0x2b59d2];_0x572270=_0x4437d1[_0x1073('0x38')](_0xc99353[_0x1073('0x39')]);}else if(_0x2e9edc[_0x1073('0x3a')]&&_0x2e9edc[_0x1073('0x3a')][_0x1073('0x2d')]){_0x2b59d2+=_0x2e9edc[_0x1073('0x3a')][_0x1073('0x2c')];_0xc99353=_0x3579a4[_0x2b59d2];_0x572270=_0x4437d1[_0x1073('0x38')](_0xc99353['status']);}return _0x572270;}function getQueueCampaignStatusMessage(_0x5a103f,_0x3aa3f4){var _0x1d3d97=CAMPAIGN_STATUS[_0x1073('0x4')];var _0x2411d7=isPreviewCampaign(_0x5a103f);if(!isQueueCampaignActive(_0x5a103f)){if(_0x2411d7){_0x1d3d97=CAMPAIGN_STATUS[_0x1073('0x3b')];}else{if(_0x5a103f[_0x1073('0x2a')]===0x0&&_0x5a103f[_0x1073('0x26')]===0x0&&_0x5a103f[_0x1073('0x28')]===0x0&&(_0x5a103f[_0x1073('0x27')]||0x0)===0x0){_0x1d3d97=CAMPAIGN_STATUS['INACTIVE'];}else{_0x1d3d97=CAMPAIGN_STATUS[_0x1073('0x3c')];}}}else if(_0x5a103f['loggedIn']===0x0){_0x1d3d97=CAMPAIGN_STATUS[_0x1073('0x3d')];}else if(!checkAnyValidTrunk(_0x5a103f,_0x3aa3f4)){_0x1d3d97=CAMPAIGN_STATUS[_0x1073('0x3e')];}else if(!isPreviewCampaign(_0x5a103f)){var _0x3c3e60=checkAnyValidQueueCampaignInterval(_0x5a103f);if(_0x3c3e60){_0x1d3d97=_0x3c3e60;}}return _0x1d3d97;}exports[_0x1073('0x3f')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x500188){var _0x32b993=CAMPAIGN_STATUS['DISACTIVED'];if(_0x500188['originated']===0x0&&_0x500188[_0x1073('0x26')]===0x0&&_0x500188[_0x1073('0x28')]===0x0&&(_0x500188[_0x1073('0x27')]||0x0)===0x0){_0x32b993=CAMPAIGN_STATUS['INACTIVE'];}return _0x32b993;}exports[_0x1073('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x413f8f){var _0x385adb=_0x413f8f[_0x1073('0x41')](/"(.*?)"/);return _0x385adb?_0x385adb[0x1]:_0x413f8f;}exports[_0x1073('0x42')]=extractCalleridName;function getCallerId(_0x402ebd,_0x35ab16,_0x3f6a15){if(!_[_0x1073('0x43')](_0x3f6a15)&&typeof _0x3f6a15===_0x1073('0x44')&&!_[_0x1073('0x33')](_0x3f6a15)){if(!_[_0x1073('0x43')](_0x35ab16)&&typeof _0x35ab16===_0x1073('0x44')&&!_[_0x1073('0x33')](_0x35ab16)){return util[_0x1073('0x45')](_0x1073('0x46'),_0x35ab16,_0x3f6a15);}return util[_0x1073('0x45')](_0x1073('0x46'),_0x3f6a15,_0x3f6a15);}if(!_[_0x1073('0x43')](_0x402ebd)&&typeof _0x402ebd===_0x1073('0x44')&&!_[_0x1073('0x33')](_0x402ebd)){return _0x402ebd;}return'\x22\x22\x20<>';}exports[_0x1073('0x47')]=getCallerId;function getCallerIdRandom(_0x47215a,_0x36c526){var _0x277589;var _0x16c7be;var _0x5ab8a7;if(_0x36c526<=0x0){_0x36c526=0x1;}_0x277589=new RegExp(_0x1073('0x48')+_0x36c526+'}$');_0x16c7be=Math['pow'](0xa,_0x36c526-0x1);_0x5ab8a7=Math[_0x1073('0x49')](0xa,_0x36c526)-0x1;return util[_0x1073('0x45')]('%s',_[_0x1073('0x4a')](_0x47215a,_0x277589,_[_0x1073('0x4b')](_0x16c7be,_0x5ab8a7)[_0x1073('0x4c')]()));}exports[_0x1073('0x4d')]=getCallerIdRandom;function decrementOriginate(_0x318099){if(_0x318099['originated']&&_0x318099[_0x1073('0x2a')]>0x0){_0x318099[_0x1073('0x2a')]-=0x1;}else{logger[_0x1073('0x4e')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x574fb0){return _0x574fb0&&_0x574fb0[_0x1073('0x4f')]>0x0;}exports[_0x1073('0x50')]=checkContactEmpty;function erlangb(_0x20f627,_0x7a0a17){if(_0x7a0a17===0x0){return 0x0;}var _0x3362d1=0x1;for(var _0x665013=0x1;_0x665013<=_0x7a0a17;_0x665013+=0x1){_0x3362d1=0x1+_0x3362d1*_0x665013/_0x20f627;}return 0x1/_0x3362d1;}exports[_0x1073('0x51')]=erlangb;function checkContactLowerLimitOriginate(_0x154f39,_0x44d120,_0x3a5920){if(_0x44d120>_0x3a5920){for(var _0x2fb235=0x0;_0x2fb235<_0x44d120-_0x3a5920;_0x2fb235+=0x1){decrementOriginate(_0x154f39);}}}exports[_0x1073('0x52')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x444571){var _0x3e9cfe={};var _0x54c36a=['id','createdAt',_0x1073('0x53'),_0x1073('0x54'),_0x1073('0x55')];if(_0x444571){for(var _0x851ff7 in _0x444571){if(typeof _0x444571[_0x851ff7]!==_0x1073('0x56')){if(!_[_0x1073('0x2e')](_0x444571[_0x851ff7])&&!_0x54c36a[_0x1073('0x38')](_0x851ff7)){_0x3e9cfe[util[_0x1073('0x45')](_0x1073('0x57'),_0x1073('0x58'),_0x851ff7[_0x1073('0x59')]())]=_0x444571[_0x851ff7];}}}}return _0x3e9cfe;}exports[_0x1073('0x5a')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 922e548..ca40e2c 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(_0x21f45,_0xd1ea6d){var _0x1b51b5=function(_0x1f97b5){while(--_0x1f97b5){_0x21f45['push'](_0x21f45['shift']());}};_0x1b51b5(++_0xd1ea6d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x36a98f,_0x40e71b){var _0xf5f0e1=function(_0x4dbb3b){while(--_0x4dbb3b){_0x36a98f['push'](_0x36a98f['shift']());}};_0xf5f0e1(++_0x40e71b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 93b18e9..8b0cd2e 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 _0x9399=['value','channelstate','channelstatedesc','syncNewExten','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','then','notify','error','\x20notify\x20','stringify','merge','pick','response','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','catch','[Fax][execOriginate][failure]','message','Fax\x20failed','isValid','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','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','execOriginate','addVariables','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','moment','path','./util/gs','fax','./rpcDb','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','syncNewchannel','varset','bind','newstate','syncNewState','faxstatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','syncVarSet','variable'];(function(_0x2d6a55,_0xd61fb9){var _0x9f1624=function(_0x3d7bdc){while(--_0x3d7bdc){_0x2d6a55['push'](_0x2d6a55['shift']());}};_0x9f1624(++_0xd61fb9);}(_0x9399,0xc1));var _0x9939=function(_0x5d19d4,_0x40c19d){_0x5d19d4=_0x5d19d4-0x0;var _0x4dcb90=_0x9399[_0x5d19d4];return _0x4dcb90;};'use strict';var util=require('util');var _=require(_0x9939('0x0'));var BPromise=require(_0x9939('0x1'));var uuid=require('uuid');var moment=require(_0x9939('0x2'));var path=require(_0x9939('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x9939('0x4'));var logger=require('../../../config/logger')(_0x9939('0x5'));var ami=require('../ami');var rpcDb=require(_0x9939('0x6'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x9939('0x7'));var faxAccount=require(_0x9939('0x8'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x9939('0x9'));function Fax(_0x47ff72){this[_0x9939('0xa')]={};this[_0x9939('0xb')]=_0x47ff72[_0x9939('0xb')];this[_0x9939('0xc')]=_0x47ff72[_0x9939('0xc')];this['actions']={};ami['on']('newchannel',this[_0x9939('0xd')]['bind'](this));ami['on'](_0x9939('0xe'),this['syncVarSet'][_0x9939('0xf')](this));ami['on'](_0x9939('0x10'),this[_0x9939('0x11')][_0x9939('0xf')](this));ami['on']('newexten',this['syncNewExten'][_0x9939('0xf')](this));ami['on'](_0x9939('0x12'),this['syncFaxStatus'][_0x9939('0xf')](this));ami['on'](_0x9939('0x13'),this[_0x9939('0x14')][_0x9939('0xf')](this));ami['on'](_0x9939('0x15'),this['syncHangup'][_0x9939('0xf')](this));ami['on'](_0x9939('0x16'),this[_0x9939('0x17')][_0x9939('0xf')](this));}Fax[_0x9939('0x18')][_0x9939('0xd')]=function(_0x34d116){if(_0x34d116[_0x9939('0x19')]===_0x9939('0x1a')){for(var _0x30d2c3 in this[_0x9939('0xb')]){if(this[_0x9939('0xb')][_0x9939('0x1b')](_0x30d2c3)){if(_0x34d116['exten']===this[_0x9939('0xb')][_0x30d2c3][_0x9939('0x1c')]){this[_0x9939('0xa')][_0x34d116['uniqueid']]={};this[_0x9939('0xa')][_0x34d116[_0x9939('0x1d')]][_0x9939('0x1e')]=_0x34d116[_0x9939('0x1e')];this[_0x9939('0xa')][_0x34d116[_0x9939('0x1d')]]['id']=this['faxAccounts'][_0x30d2c3]['id'];this[_0x9939('0xa')][_0x34d116['uniqueid']]['name']=this[_0x9939('0xb')][_0x30d2c3][_0x9939('0x1f')];logger[_0x9939('0x20')](_0x34d116['uniqueid'],_0x9939('0x21'));}}}}if(this[_0x9939('0x22')][_0x34d116['uniqueid']]){this[_0x9939('0xa')][_0x34d116['uniqueid']]={};this[_0x9939('0xa')][_0x34d116[_0x9939('0x1d')]][_0x9939('0x1e')]=_0x34d116['channel'];logger['info'](_0x34d116[_0x9939('0x1d')],_0x9939('0x21'));}};Fax['prototype'][_0x9939('0x23')]=function(_0xc9425d){if(this[_0x9939('0xa')][_0xc9425d[_0x9939('0x1d')]]){for(var _0x3490c6 in _0xc9425d[_0x9939('0x24')]){if(_0xc9425d['variable'][_0x9939('0x1b')](_0x3490c6)){this[_0x9939('0xa')][_0xc9425d[_0x9939('0x1d')]][_0x3490c6]=_0xc9425d[_0x9939('0x25')];}}}};Fax[_0x9939('0x18')]['syncNewState']=function(_0x27068b){if(this[_0x9939('0xa')][_0x27068b[_0x9939('0x1d')]]){this['channels'][_0x27068b[_0x9939('0x1d')]][_0x9939('0x26')]=_0x27068b[_0x9939('0x26')];this[_0x9939('0xa')][_0x27068b[_0x9939('0x1d')]]['channelstatedesc']=_0x27068b[_0x9939('0x27')];}};Fax['prototype'][_0x9939('0x28')]=function(_0x58aad6){if(this[_0x9939('0xa')][_0x58aad6[_0x9939('0x1d')]]){for(var _0x594496 in _0x58aad6['variable']){if(_0x58aad6[_0x9939('0x24')][_0x9939('0x1b')](_0x594496)){this[_0x9939('0xa')][_0x58aad6[_0x9939('0x1d')]][_0x594496]=_0x58aad6[_0x9939('0x25')];}}}};Fax[_0x9939('0x18')][_0x9939('0x29')]=function(_0x480b51){if(this[_0x9939('0xa')][_0x480b51[_0x9939('0x1d')]]){this[_0x9939('0xa')][_0x480b51[_0x9939('0x1d')]]['operation']=_0x480b51[_0x9939('0x2a')];this[_0x9939('0xa')][_0x480b51[_0x9939('0x1d')]][_0x9939('0x2b')]=_0x480b51[_0x9939('0x2b')];this['channels'][_0x480b51[_0x9939('0x1d')]]['localstationid']=_0x480b51[_0x9939('0x1c')];this[_0x9939('0xa')][_0x480b51[_0x9939('0x1d')]][_0x9939('0x2c')]=_0x480b51[_0x9939('0x2c')];logger[_0x9939('0x20')](_0x480b51[_0x9939('0x1d')],_0x9939('0x2d'));}};Fax[_0x9939('0x18')][_0x9939('0x14')]=function(_0x26730f){var _0x315778=this;if(this['channels'][_0x26730f[_0x9939('0x1d')]]){var _0x55c9f5=this['channels'][_0x26730f[_0x9939('0x1d')]]['id'];this['channels'][_0x26730f[_0x9939('0x1d')]][_0x9939('0x2e')]=_0x26730f[_0x9939('0x2e')];this['channels'][_0x26730f[_0x9939('0x1d')]][_0x9939('0x2f')]=_0x26730f[_0x9939('0x2f')];this[_0x9939('0xa')][_0x26730f[_0x9939('0x1d')]][_0x9939('0x1c')]=_0x26730f[_0x9939('0x1c')];this[_0x9939('0xa')][_0x26730f[_0x9939('0x1d')]][_0x9939('0x30')]=_0x26730f[_0x9939('0x30')];this[_0x9939('0xa')][_0x26730f['uniqueid']][_0x9939('0x31')]=_0x26730f[_0x9939('0x31')];this[_0x9939('0xa')][_0x26730f[_0x9939('0x1d')]]['filename']=_0x26730f[_0x9939('0x2c')];this['channels'][_0x26730f[_0x9939('0x1d')]][_0x9939('0x32')]=_0x26730f[_0x9939('0x32')];if(this[_0x9939('0xa')][_0x26730f[_0x9939('0x1d')]][_0x9939('0x2f')]>0x0){tiff2pdf(_0x26730f[_0x9939('0x2c')],_0x9939('0x33'),function(_0x34988f){logger[_0x9939('0x20')](_0x26730f[_0x9939('0x1d')],_0x9939('0x34'),_0x34988f['message']);attachment[_0x9939('0x35')]({'name':path[_0x9939('0x36')](_0x26730f['filename'])[_0x9939('0x1f')],'basename':path[_0x9939('0x36')](_0x26730f[_0x9939('0x2c')])[_0x9939('0x1f')]+_0x9939('0x37'),'type':'application/pdf'})[_0x9939('0x38')](function(_0xcfc34e){faxAccount[_0x9939('0x39')](_0x55c9f5,{'from':_0x26730f[_0x9939('0x32')],'mapKey':_0x9939('0x5'),'body':path['parse'](_0x26730f[_0x9939('0x2c')])[_0x9939('0x1f')]+_0x9939('0x37'),'AttachmentId':_0xcfc34e['id']})['catch'](function(_0x3e18c7){logger[_0x9939('0x3a')](_0x26730f[_0x9939('0x1d')],_0x9939('0x3b'),JSON[_0x9939('0x3c')](_0x3e18c7));});})['catch'](function(_0x51014f){logger[_0x9939('0x3a')](_0x26730f[_0x9939('0x1d')],'\x20receiveFax\x20',JSON[_0x9939('0x3c')](_0x51014f));});});}logger[_0x9939('0x20')](_0x26730f['uniqueid'],'\x20receiveFax\x20');}};Fax[_0x9939('0x18')][_0x9939('0x17')]=function(_0x4b878e){if(this[_0x9939('0x22')][_0x4b878e[_0x9939('0x1d')]]){_[_0x9939('0x3d')](this[_0x9939('0xa')][_0x4b878e[_0x9939('0x1d')]],_[_0x9939('0x3e')](_0x4b878e,[_0x9939('0x3f'),'reason']));}};function updateStatus(_0x56d27){if(_0x56d27[_0x9939('0x40')]){faxMessage['update'](_0x56d27['AttachmentId'],{'failMessage':_0x9939('0x41')})[_0x9939('0x38')](function(_0x4adf51){ut[_0x9939('0x42')](_0x9939('0x43'),_0x4adf51);})['catch'](function(_0x17cec6){ut[_0x9939('0x42')](_0x9939('0x44'),_0x17cec6);});}else{ut[_0x9939('0x42')](_0x9939('0x45'));}}Fax['prototype']['updateStatus']=function(_0x442454,_0x18bb41,_0x584166){var _0x2eccef=this;var _0x3d8a07={};if(_0x18bb41){_0x3d8a07={'read':_0x18bb41};}else{_0x3d8a07={'failMessage':_0x584166};}if(this[_0x9939('0x22')][_0x442454][_0x9939('0x40')]){faxMessage['update'](this[_0x9939('0x22')][_0x442454][_0x9939('0x40')],_0x3d8a07)[_0x9939('0x38')](function(_0x2e77c1){ut[_0x9939('0x42')]('[Fax][Message][Updated]',_0x2e77c1);})['catch'](function(_0x441691){ut[_0x9939('0x42')](_0x9939('0x46'),_0x441691);})[_0x9939('0x47')](function(){delete _0x2eccef[_0x9939('0xa')][_0x442454];delete _0x2eccef[_0x9939('0x22')][_0x442454];});}else{ut[_0x9939('0x42')](_0x9939('0x48'));delete this['channels'][_0x442454];delete this['actions'][_0x442454];}};Fax[_0x9939('0x18')][_0x9939('0x49')]=function(_0x1ac67b){var _0x3d28fa=this;if(this[_0x9939('0xa')][_0x1ac67b['uniqueid']]){if(this[_0x9939('0x22')][_0x1ac67b[_0x9939('0x1d')]]){this[_0x9939('0xa')][_0x1ac67b['uniqueid']]['id']=this[_0x9939('0x22')][_0x1ac67b['uniqueid']]['id'];this[_0x9939('0xa')][_0x1ac67b[_0x9939('0x1d')]][_0x9939('0x1f')]=this[_0x9939('0x22')][_0x1ac67b[_0x9939('0x1d')]][_0x9939('0x1f')];}logger[_0x9939('0x20')](_0x1ac67b[_0x9939('0x1d')],this['actions'][_0x1ac67b[_0x9939('0x1d')]]?_0x9939('0x4a'):_0x9939('0x4b'),JSON['stringify'](this['channels'][_0x1ac67b['uniqueid']]));if(this[_0x9939('0x22')][_0x1ac67b[_0x9939('0x1d')]]){if(this[_0x9939('0xa')][_0x1ac67b[_0x9939('0x1d')]][_0x9939('0x4c')]>0x0&&this[_0x9939('0xa')][_0x1ac67b[_0x9939('0x1d')]][_0x9939('0x12')]===_0x9939('0x4d')){this[_0x9939('0x4e')](_0x1ac67b[_0x9939('0x1d')],!![]);}else{this[_0x9939('0x4e')](_0x1ac67b[_0x9939('0x1d')],![],this[_0x9939('0xa')][_0x1ac67b[_0x9939('0x1d')]][_0x9939('0x4f')]?'SENDING\x20FAILED:\x20'+this[_0x9939('0xa')][_0x1ac67b[_0x9939('0x1d')]]['faxstatusstring']:_0x9939('0x50'));}}}};Fax['prototype'][_0x9939('0x51')]=function(_0x201c31){var _0x5f3345=this;return new BPromise(function(_0x2b79c4,_0x268b43){_0x5f3345['execOriginate'](_0x201c31,_0x5f3345[_0x9939('0xb')][_0x201c31[_0x9939('0x52')]])[_0x9939('0x38')](function(_0x2eb75c){ut[_0x9939('0x42')](_0x9939('0x53'),_0x2eb75c);_0x2b79c4(ut['message'](_0x9939('0x54')));})[_0x9939('0x55')](function(_0x11e754){ut['logger'](_0x9939('0x56'),_0x11e754);updateStatus(_0x201c31);_0x268b43(ut[_0x9939('0x57')](_0x9939('0x58')));});});};Fax[_0x9939('0x18')]['checkAfterSend']=function(_0x166fcc){var _0x4b7a8f=this;return new BPromise(function(_0x1b37da,_0x30bfd6){var _0x56ef38=_0x4b7a8f['checkTrunk'](_0x4b7a8f[_0x9939('0xb')][_0x166fcc[_0x9939('0x52')]]['Trunk'],_0x166fcc);if(_0x56ef38[_0x9939('0x59')]){_0x1b37da(ut[_0x9939('0x57')]('Trunk\x20Reachable'));}else{_0x30bfd6(ut['message'](_0x56ef38[_0x9939('0x57')]));}});};function originate(_0x21a4f5,_0xf03f5c,_0x5e1944){return new BPromise(function(_0xb56615,_0x44d78a){if(_0x5e1944){var _0x8ece69=util[_0x9939('0x5a')](_0x9939('0x5b'),path[_0x9939('0x36')](_0x21a4f5[_0x9939('0x3')])[_0x9939('0x1f')],_0x21a4f5[_0x9939('0x3')]);gs['execute'](_0x8ece69)['then'](function(){_0x21a4f5[_0x9939('0x3')]=util['format'](_0x9939('0x5c'),path['parse'](_0x21a4f5[_0x9939('0x3')])[_0x9939('0x5d')],path[_0x9939('0x36')](_0x21a4f5['path'])[_0x9939('0x1f')]);_0xf03f5c[_0x9939('0x5e')]=_0x21a4f5[_0x9939('0x3')];ut[_0x9939('0x42')](_0x9939('0x5f'),'');ami['Action'](ut[_0x9939('0x60')](_0x21a4f5,_0xf03f5c))['then'](function(_0x4cdb59){_0xb56615(_0x4cdb59);})[_0x9939('0x55')](function(_0x16ad1a){_0x44d78a(_0x16ad1a);});})[_0x9939('0x55')](function(_0x2fea95){_0x44d78a(_0x2fea95);});}else{ami[_0x9939('0x61')](ut['variablesAction'](_0x21a4f5,_0xf03f5c))[_0x9939('0x38')](function(_0x4acc5b){_0xb56615(_0x4acc5b);})[_0x9939('0x55')](function(_0x7b88d2){_0x44d78a(_0x7b88d2);});}});}Fax['prototype'][_0x9939('0x62')]=function(_0x31e4c6,_0x443d80){var _0x4fd9d4=this;return new BPromise(function(_0x578691,_0x1ca5ea){var _0x170c1f=uuid['v4']();var _0x46d3cc=ut[_0x9939('0x63')](_0x31e4c6,_0x443d80);_0x4fd9d4[_0x9939('0x22')][_0x170c1f]=new Action(_0x170c1f,_0x443d80,_0x31e4c6);var _0x257fc1=_0x4fd9d4[_0x9939('0x22')][_0x170c1f];if(path['parse'](_0x31e4c6[_0x9939('0x3')])['ext']===_0x9939('0x37')){originate(_0x257fc1,_0x46d3cc,!![])[_0x9939('0x38')](function(_0x3383a3){_0x578691(_0x3383a3);})[_0x9939('0x55')](function(_0x27c5d0){_0x1ca5ea(_0x27c5d0);});}else{originate(_0x257fc1,_0x46d3cc,![])[_0x9939('0x38')](function(_0x2f3028){_0x578691(_0x2f3028);})[_0x9939('0x55')](function(_0x43632f){_0x1ca5ea(_0x43632f);});}});};Fax[_0x9939('0x18')]['isTrunkReachable']=function(_0x4a0aad){return!_[_0x9939('0x64')](_0x4a0aad)&&!_[_0x9939('0x64')](_0x4a0aad[_0x9939('0x1f')])&&!_[_0x9939('0x64')](_0x4a0aad[_0x9939('0x65')])&&_0x4a0aad[_0x9939('0x65')]&&!_[_0x9939('0x64')](this[_0x9939('0xc')][util['format'](_0x9939('0x66'),_0x4a0aad[_0x9939('0x1f')])])&&!_[_0x9939('0x64')](this[_0x9939('0xc')][util[_0x9939('0x5a')](_0x9939('0x66'),_0x4a0aad[_0x9939('0x1f')])][_0x9939('0x2b')])&&(this[_0x9939('0xc')][util['format']('SIP/%s',_0x4a0aad[_0x9939('0x1f')])][_0x9939('0x2b')]===_0x9939('0x67')||this[_0x9939('0xc')][util[_0x9939('0x5a')](_0x9939('0x66'),_0x4a0aad[_0x9939('0x1f')])]['status']===_0x9939('0x68'));};Fax['prototype'][_0x9939('0x69')]=function(_0x4ffd33,_0x2fc2d4){if(!this[_0x9939('0x6a')](_0x4ffd33)){ut[_0x9939('0x42')](_0x9939('0x6b'),_[_0x9939('0x64')](_0x4ffd33)?'':_0x4ffd33['name']+_0x9939('0x6c'));return{'isValid':![],'message':_0x9939('0x6d')};}if(_[_0x9939('0x64')](_0x2fc2d4['fax'])){ut[_0x9939('0x42')](_0x9939('0x6e'),JSON[_0x9939('0x3c')](_0x2fc2d4));return{'isValid':![],'message':_0x9939('0x6f')};}if(_['isNil'](_0x2fc2d4['path'])){ut[_0x9939('0x42')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x9939('0x3c')](_0x2fc2d4));return{'isValid':![],'message':_0x9939('0x70')};}return{'isValid':!![],'message':_0x9939('0x71')};};module[_0x9939('0x72')]=Fax; \ No newline at end of file +var _0x075e=['name','info','\x20syncNewchannel\x20','prototype','value','channelstate','channelstatedesc','variable','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','then','notify','catch','\x20notify\x20','stringify','\x20receiveFax\x20','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','faxpages','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','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','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[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','Is\x20Valid','exports','bluebird','uuid','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','syncNewchannel','varset','syncVarSet','syncNewState','bind','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','context','from-voip-provider','exten','localstationid','uniqueid','channel'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x075e,0x1a4));var _0xe075=function(_0x267e68,_0x47d360){_0x267e68=_0x267e68-0x0;var _0x436784=_0x075e[_0x267e68];return _0x436784;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xe075('0x0'));var uuid=require(_0xe075('0x1'));var moment=require('moment');var path=require(_0xe075('0x2'));var tiff2pdf=require(_0xe075('0x3'));var gs=require(_0xe075('0x4'));var logger=require('../../../config/logger')(_0xe075('0x5'));var ami=require(_0xe075('0x6'));var rpcDb=require(_0xe075('0x7'));var Channel=require(_0xe075('0x8'));var ut=require(_0xe075('0x9'));var Action=require(_0xe075('0xa'));var faxAccount=require(_0xe075('0xb'));var attachment=require(_0xe075('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x5f2635){this[_0xe075('0xd')]={};this['faxAccounts']=_0x5f2635[_0xe075('0xe')];this[_0xe075('0xf')]=_0x5f2635['trunks'];this[_0xe075('0x10')]={};ami['on']('newchannel',this[_0xe075('0x11')]['bind'](this));ami['on'](_0xe075('0x12'),this[_0xe075('0x13')]['bind'](this));ami['on']('newstate',this[_0xe075('0x14')][_0xe075('0x15')](this));ami['on'](_0xe075('0x16'),this['syncNewExten'][_0xe075('0x15')](this));ami['on'](_0xe075('0x17'),this[_0xe075('0x18')][_0xe075('0x15')](this));ami['on'](_0xe075('0x19'),this[_0xe075('0x1a')][_0xe075('0x15')](this));ami['on'](_0xe075('0x1b'),this[_0xe075('0x1c')][_0xe075('0x15')](this));ami['on']('originateresponse',this[_0xe075('0x1d')][_0xe075('0x15')](this));}Fax['prototype'][_0xe075('0x11')]=function(_0x57081a){if(_0x57081a[_0xe075('0x1e')]===_0xe075('0x1f')){for(var _0x5151bc in this[_0xe075('0xe')]){if(this[_0xe075('0xe')]['hasOwnProperty'](_0x5151bc)){if(_0x57081a[_0xe075('0x20')]===this[_0xe075('0xe')][_0x5151bc][_0xe075('0x21')]){this[_0xe075('0xd')][_0x57081a[_0xe075('0x22')]]={};this[_0xe075('0xd')][_0x57081a[_0xe075('0x22')]][_0xe075('0x23')]=_0x57081a[_0xe075('0x23')];this[_0xe075('0xd')][_0x57081a[_0xe075('0x22')]]['id']=this[_0xe075('0xe')][_0x5151bc]['id'];this['channels'][_0x57081a[_0xe075('0x22')]][_0xe075('0x24')]=this['faxAccounts'][_0x5151bc]['name'];logger[_0xe075('0x25')](_0x57081a[_0xe075('0x22')],_0xe075('0x26'));}}}}if(this[_0xe075('0x10')][_0x57081a['uniqueid']]){this[_0xe075('0xd')][_0x57081a[_0xe075('0x22')]]={};this[_0xe075('0xd')][_0x57081a[_0xe075('0x22')]]['channel']=_0x57081a[_0xe075('0x23')];logger['info'](_0x57081a[_0xe075('0x22')],_0xe075('0x26'));}};Fax[_0xe075('0x27')][_0xe075('0x13')]=function(_0x1116ee){if(this[_0xe075('0xd')][_0x1116ee[_0xe075('0x22')]]){for(var _0x43f663 in _0x1116ee['variable']){if(_0x1116ee['variable']['hasOwnProperty'](_0x43f663)){this[_0xe075('0xd')][_0x1116ee['uniqueid']][_0x43f663]=_0x1116ee[_0xe075('0x28')];}}}};Fax[_0xe075('0x27')]['syncNewState']=function(_0x4a8dfd){if(this[_0xe075('0xd')][_0x4a8dfd[_0xe075('0x22')]]){this['channels'][_0x4a8dfd[_0xe075('0x22')]][_0xe075('0x29')]=_0x4a8dfd[_0xe075('0x29')];this[_0xe075('0xd')][_0x4a8dfd[_0xe075('0x22')]][_0xe075('0x2a')]=_0x4a8dfd['channelstatedesc'];}};Fax[_0xe075('0x27')]['syncNewExten']=function(_0x5dedfa){if(this['channels'][_0x5dedfa[_0xe075('0x22')]]){for(var _0x1fe825 in _0x5dedfa[_0xe075('0x2b')]){if(_0x5dedfa[_0xe075('0x2b')]['hasOwnProperty'](_0x1fe825)){this[_0xe075('0xd')][_0x5dedfa[_0xe075('0x22')]][_0x1fe825]=_0x5dedfa['value'];}}}};Fax['prototype'][_0xe075('0x18')]=function(_0x1723db){if(this['channels'][_0x1723db[_0xe075('0x22')]]){this['channels'][_0x1723db[_0xe075('0x22')]]['operation']=_0x1723db['operation'];this['channels'][_0x1723db[_0xe075('0x22')]][_0xe075('0x2c')]=_0x1723db[_0xe075('0x2c')];this['channels'][_0x1723db[_0xe075('0x22')]][_0xe075('0x21')]=_0x1723db[_0xe075('0x21')];this[_0xe075('0xd')][_0x1723db[_0xe075('0x22')]][_0xe075('0x2d')]=_0x1723db[_0xe075('0x2d')];logger[_0xe075('0x25')](_0x1723db[_0xe075('0x22')],_0xe075('0x2e'));}};Fax['prototype'][_0xe075('0x1a')]=function(_0x40c8a2){var _0x57d8eb=this;if(this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]]){var _0x3809b2=this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]]['id'];this['channels'][_0x40c8a2['uniqueid']][_0xe075('0x2f')]=_0x40c8a2['remotestationid'];this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]][_0xe075('0x30')]=_0x40c8a2[_0xe075('0x30')];this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]]['localstationid']=_0x40c8a2[_0xe075('0x21')];this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]][_0xe075('0x31')]=_0x40c8a2['resolution'];this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]][_0xe075('0x32')]=_0x40c8a2[_0xe075('0x32')];this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]]['filename']=_0x40c8a2[_0xe075('0x2d')];this['channels'][_0x40c8a2[_0xe075('0x22')]]['calleridnum']=_0x40c8a2[_0xe075('0x33')];if(this[_0xe075('0xd')][_0x40c8a2[_0xe075('0x22')]]['pagestransferred']>0x0){tiff2pdf(_0x40c8a2['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x460d99){logger[_0xe075('0x25')](_0x40c8a2[_0xe075('0x22')],_0xe075('0x34'),_0x460d99[_0xe075('0x35')]);attachment['create']({'name':path[_0xe075('0x36')](_0x40c8a2[_0xe075('0x2d')])['name'],'basename':path[_0xe075('0x36')](_0x40c8a2['filename'])['name']+_0xe075('0x37'),'type':'application/pdf'})[_0xe075('0x38')](function(_0x59cdb6){faxAccount[_0xe075('0x39')](_0x3809b2,{'from':_0x40c8a2['calleridnum'],'mapKey':_0xe075('0x5'),'body':path[_0xe075('0x36')](_0x40c8a2[_0xe075('0x2d')])[_0xe075('0x24')]+_0xe075('0x37'),'AttachmentId':_0x59cdb6['id']})[_0xe075('0x3a')](function(_0x3e6f50){logger['error'](_0x40c8a2[_0xe075('0x22')],_0xe075('0x3b'),JSON[_0xe075('0x3c')](_0x3e6f50));});})['catch'](function(_0x2ba6f7){logger['error'](_0x40c8a2['uniqueid'],_0xe075('0x3d'),JSON['stringify'](_0x2ba6f7));});});}logger[_0xe075('0x25')](_0x40c8a2[_0xe075('0x22')],_0xe075('0x3d'));}};Fax['prototype'][_0xe075('0x1d')]=function(_0x3b5f87){if(this[_0xe075('0x10')][_0x3b5f87['uniqueid']]){_[_0xe075('0x3e')](this[_0xe075('0xd')][_0x3b5f87[_0xe075('0x22')]],_['pick'](_0x3b5f87,[_0xe075('0x3f'),_0xe075('0x40')]));}};function updateStatus(_0x281f27){if(_0x281f27[_0xe075('0x41')]){faxMessage[_0xe075('0x42')](_0x281f27[_0xe075('0x41')],{'failMessage':_0xe075('0x43')})[_0xe075('0x38')](function(_0x1d0235){ut[_0xe075('0x44')](_0xe075('0x45'),_0x1d0235);})[_0xe075('0x3a')](function(_0x2eddac){ut[_0xe075('0x44')]('[Fax][Message][Error][NoUpdate1]',_0x2eddac);});}else{ut[_0xe075('0x44')](_0xe075('0x46'));}}Fax[_0xe075('0x27')][_0xe075('0x47')]=function(_0x32b69f,_0x5ca797,_0x435ac0){var _0x33480e=this;var _0x467078={};if(_0x5ca797){_0x467078={'read':_0x5ca797};}else{_0x467078={'failMessage':_0x435ac0};}if(this['actions'][_0x32b69f][_0xe075('0x41')]){faxMessage['update'](this[_0xe075('0x10')][_0x32b69f]['AttachmentId'],_0x467078)[_0xe075('0x38')](function(_0x24a1b8){ut[_0xe075('0x44')](_0xe075('0x48'),_0x24a1b8);})[_0xe075('0x3a')](function(_0x31cd5b){ut[_0xe075('0x44')](_0xe075('0x49'),_0x31cd5b);})[_0xe075('0x4a')](function(){delete _0x33480e[_0xe075('0xd')][_0x32b69f];delete _0x33480e['actions'][_0x32b69f];});}else{ut['logger'](_0xe075('0x4b'));delete this[_0xe075('0xd')][_0x32b69f];delete this[_0xe075('0x10')][_0x32b69f];}};Fax[_0xe075('0x27')]['syncHangup']=function(_0x1c22a3){var _0x41242d=this;if(this[_0xe075('0xd')][_0x1c22a3[_0xe075('0x22')]]){if(this[_0xe075('0x10')][_0x1c22a3[_0xe075('0x22')]]){this['channels'][_0x1c22a3[_0xe075('0x22')]]['id']=this[_0xe075('0x10')][_0x1c22a3[_0xe075('0x22')]]['id'];this[_0xe075('0xd')][_0x1c22a3[_0xe075('0x22')]][_0xe075('0x24')]=this['actions'][_0x1c22a3[_0xe075('0x22')]][_0xe075('0x24')];}logger[_0xe075('0x25')](_0x1c22a3[_0xe075('0x22')],this['actions'][_0x1c22a3[_0xe075('0x22')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0xe075('0x3c')](this['channels'][_0x1c22a3[_0xe075('0x22')]]));if(this['actions'][_0x1c22a3[_0xe075('0x22')]]){if(this['channels'][_0x1c22a3[_0xe075('0x22')]][_0xe075('0x4c')]>0x0&&this[_0xe075('0xd')][_0x1c22a3[_0xe075('0x22')]]['faxstatus']==='SUCCESS'){this[_0xe075('0x47')](_0x1c22a3['uniqueid'],!![]);}else{this[_0xe075('0x47')](_0x1c22a3[_0xe075('0x22')],![],this[_0xe075('0xd')][_0x1c22a3[_0xe075('0x22')]][_0xe075('0x4d')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x1c22a3[_0xe075('0x22')]]['faxstatusstring']:_0xe075('0x4e'));}}}};Fax[_0xe075('0x27')][_0xe075('0x4f')]=function(_0x10c5b1){var _0x1bcce4=this;return new BPromise(function(_0x2d3e53,_0x59c30e){_0x1bcce4[_0xe075('0x50')](_0x10c5b1,_0x1bcce4[_0xe075('0xe')][_0x10c5b1[_0xe075('0x51')]])[_0xe075('0x38')](function(_0x4523f0){ut[_0xe075('0x44')]('[Fax][execOriginate][success]',_0x4523f0);_0x2d3e53(ut['message'](_0xe075('0x52')));})[_0xe075('0x3a')](function(_0x3b2085){ut[_0xe075('0x44')](_0xe075('0x53'),_0x3b2085);updateStatus(_0x10c5b1);_0x59c30e(ut['message'](_0xe075('0x54')));});});};Fax[_0xe075('0x27')][_0xe075('0x55')]=function(_0x2f8851){var _0x4cf95e=this;return new BPromise(function(_0xe830d4,_0x1a2c8e){var _0x4ac650=_0x4cf95e[_0xe075('0x56')](_0x4cf95e[_0xe075('0xe')][_0x2f8851[_0xe075('0x51')]][_0xe075('0x57')],_0x2f8851);if(_0x4ac650[_0xe075('0x58')]){_0xe830d4(ut['message']('Trunk\x20Reachable'));}else{_0x1a2c8e(ut[_0xe075('0x35')](_0x4ac650[_0xe075('0x35')]));}});};function originate(_0x3ae091,_0x3331a3,_0x55770f){return new BPromise(function(_0x3c07bd,_0x586dd0){if(_0x55770f){var _0x1a2eae=util[_0xe075('0x59')](_0xe075('0x5a'),path[_0xe075('0x36')](_0x3ae091[_0xe075('0x2')])[_0xe075('0x24')],_0x3ae091[_0xe075('0x2')]);gs[_0xe075('0x5b')](_0x1a2eae)[_0xe075('0x38')](function(){_0x3ae091[_0xe075('0x2')]=util['format'](_0xe075('0x5c'),path[_0xe075('0x36')](_0x3ae091[_0xe075('0x2')])[_0xe075('0x5d')],path['parse'](_0x3ae091[_0xe075('0x2')])[_0xe075('0x24')]);_0x3331a3['XMF-PATH']=_0x3ae091[_0xe075('0x2')];ut[_0xe075('0x44')](_0xe075('0x5e'),'');ami[_0xe075('0x5f')](ut[_0xe075('0x60')](_0x3ae091,_0x3331a3))['then'](function(_0xfceb91){_0x3c07bd(_0xfceb91);})[_0xe075('0x3a')](function(_0x1c88f1){_0x586dd0(_0x1c88f1);});})['catch'](function(_0x378366){_0x586dd0(_0x378366);});}else{ami[_0xe075('0x5f')](ut[_0xe075('0x60')](_0x3ae091,_0x3331a3))['then'](function(_0x3a9e08){_0x3c07bd(_0x3a9e08);})[_0xe075('0x3a')](function(_0x2e3ed9){_0x586dd0(_0x2e3ed9);});}});}Fax[_0xe075('0x27')][_0xe075('0x50')]=function(_0x34d003,_0x5d33bd){var _0x57e871=this;return new BPromise(function(_0x2bcf2d,_0x371eef){var _0x1f7995=uuid['v4']();var _0x164d9b=ut[_0xe075('0x61')](_0x34d003,_0x5d33bd);_0x57e871[_0xe075('0x10')][_0x1f7995]=new Action(_0x1f7995,_0x5d33bd,_0x34d003);var _0x1f9a95=_0x57e871[_0xe075('0x10')][_0x1f7995];if(path['parse'](_0x34d003[_0xe075('0x2')])[_0xe075('0x62')]===_0xe075('0x37')){originate(_0x1f9a95,_0x164d9b,!![])['then'](function(_0x17d95b){_0x2bcf2d(_0x17d95b);})[_0xe075('0x3a')](function(_0x6fe55a){_0x371eef(_0x6fe55a);});}else{originate(_0x1f9a95,_0x164d9b,![])[_0xe075('0x38')](function(_0x49a664){_0x2bcf2d(_0x49a664);})[_0xe075('0x3a')](function(_0x4a3501){_0x371eef(_0x4a3501);});}});};Fax['prototype'][_0xe075('0x63')]=function(_0x284f98){return!_['isNil'](_0x284f98)&&!_['isNil'](_0x284f98[_0xe075('0x24')])&&!_[_0xe075('0x64')](_0x284f98[_0xe075('0x65')])&&_0x284f98[_0xe075('0x65')]&&!_[_0xe075('0x64')](this[_0xe075('0xf')][util[_0xe075('0x59')]('SIP/%s',_0x284f98['name'])])&&!_[_0xe075('0x64')](this[_0xe075('0xf')][util['format'](_0xe075('0x66'),_0x284f98[_0xe075('0x24')])]['status'])&&(this['trunks'][util['format'](_0xe075('0x66'),_0x284f98[_0xe075('0x24')])]['status']===_0xe075('0x67')||this[_0xe075('0xf')][util[_0xe075('0x59')](_0xe075('0x66'),_0x284f98[_0xe075('0x24')])][_0xe075('0x2c')]===_0xe075('0x68'));};Fax['prototype'][_0xe075('0x56')]=function(_0x50f3ba,_0x2f3b49){if(!this[_0xe075('0x63')](_0x50f3ba)){ut[_0xe075('0x44')](_0xe075('0x69'),_[_0xe075('0x64')](_0x50f3ba)?'':_0x50f3ba[_0xe075('0x24')]+_0xe075('0x6a'));return{'isValid':![],'message':_0xe075('0x6b')};}if(_[_0xe075('0x64')](_0x2f3b49[_0xe075('0x5')])){ut[_0xe075('0x44')](_0xe075('0x6c'),JSON[_0xe075('0x3c')](_0x2f3b49));return{'isValid':![],'message':_0xe075('0x6d')};}if(_[_0xe075('0x64')](_0x2f3b49[_0xe075('0x2')])){ut[_0xe075('0x44')](_0xe075('0x6e'),JSON[_0xe075('0x3c')](_0x2f3b49));return{'isValid':![],'message':_0xe075('0x6f')};}return{'isValid':!![],'message':_0xe075('0x70')};};module[_0xe075('0x71')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 3ebaf23..0546fe9 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 _0x5d66=['catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','../rpc/faxAccount','notify'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5d66,0x1d2));var _0x65d6=function(_0x5cfff9,_0x1ec486){_0x5cfff9=_0x5cfff9-0x0;var _0x414e87=_0x5d66[_0x5cfff9];return _0x414e87;};'use strict';var util=require(_0x65d6('0x0'));var BPromise=require(_0x65d6('0x1'));var logger=require(_0x65d6('0x2'))(_0x65d6('0x3'));var _=require('lodash');var faxAccount=require(_0x65d6('0x4'));function loggerCatch(_0x2e8849){return function(_0x41463f){logger['error'](_0x2e8849,util['inspect'](_0x41463f,{'showHidden':![],'depth':null}));};}exports[_0x65d6('0x5')]=function(_0x3c26a3,_0x2f1cef){return BPromise['resolve']()['then'](faxAccount[_0x65d6('0x5')](_0x3c26a3,_0x2f1cef))[_0x65d6('0x6')](loggerCatch(_0x65d6('0x7')));}; \ No newline at end of file +var _0xaa2c=['preview','lodash','error','inspect','notify','resolve','then','catch','[Notify]\x20','bluebird','../../../config/logger'];(function(_0x6f463f,_0x69340a){var _0x5d8a9f=function(_0x17b2e2){while(--_0x17b2e2){_0x6f463f['push'](_0x6f463f['shift']());}};_0x5d8a9f(++_0x69340a);}(_0xaa2c,0x6c));var _0xcaa2=function(_0x5b3a84,_0x3a8d78){_0x5b3a84=_0x5b3a84-0x0;var _0x593ef1=_0xaa2c[_0x5b3a84];return _0x593ef1;};'use strict';var util=require('util');var BPromise=require(_0xcaa2('0x0'));var logger=require(_0xcaa2('0x1'))(_0xcaa2('0x2'));var _=require(_0xcaa2('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x534938){return function(_0x3639cc){logger[_0xcaa2('0x4')](_0x534938,util[_0xcaa2('0x5')](_0x3639cc,{'showHidden':![],'depth':null}));};}exports[_0xcaa2('0x6')]=function(_0x98f42c,_0x419223){return BPromise[_0xcaa2('0x7')]()[_0xcaa2('0x8')](faxAccount[_0xcaa2('0x6')](_0x98f42c,_0x419223))[_0xcaa2('0x9')](loggerCatch(_0xcaa2('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 3f20d2d..8339343 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 _0x785e=['info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','bluebird','child_process','exec','execute'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x785e,0x16c));var _0xe785=function(_0x2ba6bd,_0x4ca008){_0x2ba6bd=_0x2ba6bd-0x0;var _0x8d0d47=_0x785e[_0x2ba6bd];return _0x8d0d47;};'use strict';var util=require('util');var logger=require(_0xe785('0x0'))('fax');var BPromise=require(_0xe785('0x1'));var exec=require(_0xe785('0x2'))[_0xe785('0x3')];exports[_0xe785('0x4')]=function(_0x14e3e3){return new BPromise(function(_0x1d2548,_0x550e9d){exec(_0x14e3e3,function(_0x2c0375,_0x173b9a,_0xbd41c5){logger[_0xe785('0x5')](_0xe785('0x6'),_0x173b9a);if(_0x2c0375){logger[_0xe785('0x5')](_0xe785('0x6'),_0xe785('0x7'),util[_0xe785('0x8')](_0x2c0375,{'showHidden':![],'depth':null}),_0x173b9a,_0xbd41c5);_0x550e9d(_0x2c0375);}_0x1d2548(_0x173b9a);});});}; \ No newline at end of file +var _0x2903=['util','../../../../config/logger','fax','bluebird','child_process','exec','execute','inspect'];(function(_0x2859f2,_0x1e3102){var _0x4974cd=function(_0x13ec65){while(--_0x13ec65){_0x2859f2['push'](_0x2859f2['shift']());}};_0x4974cd(++_0x1e3102);}(_0x2903,0x1d0));var _0x3290=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2903[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x3290('0x0'));var logger=require(_0x3290('0x1'))(_0x3290('0x2'));var BPromise=require(_0x3290('0x3'));var exec=require(_0x3290('0x4'))[_0x3290('0x5')];exports[_0x3290('0x6')]=function(_0x4ebc9a){return new BPromise(function(_0xd1b140,_0x181300){exec(_0x4ebc9a,function(_0xcacb94,_0x504c69,_0x5efb65){logger['info']('Exec\x20gs',_0x504c69);if(_0xcacb94){logger['info']('Exec\x20gs','\x20Error\x20:',util[_0x3290('0x7')](_0xcacb94,{'showHidden':![],'depth':null}),_0x504c69,_0x5efb65);_0x181300(_0xcacb94);}_0xd1b140(_0x504c69);});});}; \ 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 88f9c07..64539ba 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 _0x279c=['maxrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate'];(function(_0x5834fd,_0x314e49){var _0xdc37c4=function(_0x50a6d5){while(--_0x50a6d5){_0x5834fd['push'](_0x5834fd['shift']());}};_0xdc37c4(++_0x314e49);}(_0x279c,0x193));var _0xc279=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x279c[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0xc279('0x0'));var _=require(_0xc279('0x1'));var moment=require(_0xc279('0x2'));var logger=require(_0xc279('0x3'))(_0xc279('0x4'));exports[_0xc279('0x5')]=function(_0x41226e){return{'message':_0x41226e};};exports[_0xc279('0x6')]=function(_0x50917f,_0x2b939c){logger[_0xc279('0x7')](_0x50917f,util[_0xc279('0x8')](_0x2b939c,{'showHidden':![],'depth':null}));};exports[_0xc279('0x9')]=function(_0x18be8a,_0x5b6b65){var _0x1c7e59={'XMF-ECM':_0x5b6b65[_0xc279('0xa')],'XMF-HEADERINFO':_0x5b6b65[_0xc279('0xb')],'XMF-MINRATE':_0x5b6b65[_0xc279('0xc')],'XMF-MAXRATE':_0x5b6b65[_0xc279('0xd')],'XMF-MODEM':util[_0xc279('0xe')](_0xc279('0xf'),_0x5b6b65['modem']),'XMF-GATEWAY':_0x5b6b65[_0xc279('0x10')],'XMF-FAXDETECT':_0x5b6b65[_0xc279('0x11')],'XMF-T38TIMEOUT':_0x5b6b65[_0xc279('0x12')],'XMF-LOCALSTATIONID':_0x5b6b65[_0xc279('0x13')],'XMF-PATH':_0x18be8a['path']};return _0x1c7e59;};exports[_0xc279('0x14')]=function(_0x1f6844,_0x3966b9){return{'actionid':_0x1f6844[_0xc279('0x15')],'action':_0xc279('0x16'),'channel':_0x1f6844['channel'],'Exten':_0xc279('0x17'),'Context':_0xc279('0x18'),'Priority':'1','callerid':util[_0xc279('0xe')](_0xc279('0x19'),_0x1f6844['headerinfo']?_0x1f6844['headerinfo']:'',_0x1f6844[_0xc279('0x13')]),'variable':_0x3966b9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1f6844['uniqueid']};}; \ No newline at end of file +var _0x5a38=['path','variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid'];(function(_0x39ffd1,_0x299703){var _0x31267e=function(_0x11b420){while(--_0x11b420){_0x39ffd1['push'](_0x39ffd1['shift']());}};_0x31267e(++_0x299703);}(_0x5a38,0xaf));var _0x85a3=function(_0x57c872,_0x63a1fa){_0x57c872=_0x57c872-0x0;var _0x3ce770=_0x5a38[_0x57c872];return _0x3ce770;};'use strict';var util=require(_0x85a3('0x0'));var _=require(_0x85a3('0x1'));var moment=require(_0x85a3('0x2'));var logger=require(_0x85a3('0x3'))(_0x85a3('0x4'));exports[_0x85a3('0x5')]=function(_0x120bf0){return{'message':_0x120bf0};};exports[_0x85a3('0x6')]=function(_0x4d8997,_0x2af2dc){logger[_0x85a3('0x7')](_0x4d8997,util[_0x85a3('0x8')](_0x2af2dc,{'showHidden':![],'depth':null}));};exports[_0x85a3('0x9')]=function(_0x381bc9,_0x2895f9){var _0x454637={'XMF-ECM':_0x2895f9[_0x85a3('0xa')],'XMF-HEADERINFO':_0x2895f9[_0x85a3('0xb')],'XMF-MINRATE':_0x2895f9[_0x85a3('0xc')],'XMF-MAXRATE':_0x2895f9[_0x85a3('0xd')],'XMF-MODEM':util[_0x85a3('0xe')](_0x85a3('0xf'),_0x2895f9[_0x85a3('0x10')]),'XMF-GATEWAY':_0x2895f9[_0x85a3('0x11')],'XMF-FAXDETECT':_0x2895f9[_0x85a3('0x12')],'XMF-T38TIMEOUT':_0x2895f9[_0x85a3('0x13')],'XMF-LOCALSTATIONID':_0x2895f9[_0x85a3('0x14')],'XMF-PATH':_0x381bc9[_0x85a3('0x15')]};return _0x454637;};exports[_0x85a3('0x16')]=function(_0x35b6d2,_0x497708){return{'actionid':_0x35b6d2[_0x85a3('0x17')],'action':_0x85a3('0x18'),'channel':_0x35b6d2[_0x85a3('0x19')],'Exten':'xcally-motion-fax','Context':_0x85a3('0x1a'),'Priority':'1','callerid':util[_0x85a3('0xe')](_0x85a3('0x1b'),_0x35b6d2[_0x85a3('0xb')]?_0x35b6d2[_0x85a3('0xb')]:'',_0x35b6d2[_0x85a3('0x14')]),'variable':_0x497708,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x35b6d2[_0x85a3('0x17')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 0604852..fd8ecee 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 _0xccbe=['getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','sync','[index.js][main]','./server','./realtime','./acw','./trigger','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTrunks','initVoiceQueues'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xccbe,0xa4));var _0xeccb=function(_0x4cefc3,_0x23f291){_0x4cefc3=_0x4cefc3-0x0;var _0x1cc779=_0xccbe[_0x4cefc3];return _0x1cc779;};'use strict';var util=require('util');var moment=require('moment');var server=require(_0xeccb('0x0'));var Realtime=require(_0xeccb('0x1'));var Report=require('./report');var Acw=require(_0xeccb('0x2'));var Trigger=require(_0xeccb('0x3'));var Dialer=require('./dialer');var Preview=require(_0xeccb('0x4'));var Fax=require(_0xeccb('0x5'));var user=require('./rpc/user');var voiceQueue=require(_0xeccb('0x6'));var voiceQueueReport=require(_0xeccb('0x7'));var voiceCallReport=require(_0xeccb('0x8'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0xeccb('0x9'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xeccb('0xa'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xeccb('0xb'));var zendesk=require(_0xeccb('0xc'));var salesforce=require(_0xeccb('0xd'));var sugarcrm=require(_0xeccb('0xe'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0xeccb('0xf'));var vtiger=require(_0xeccb('0x10'));var freshsales=require(_0xeccb('0x11'));var servicenow=require(_0xeccb('0x12'));var dynamics365=require(_0xeccb('0x13'));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(_0xeccb('0x14'))(_0xeccb('0x15'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xeccb('0x16')](_0xeccb('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xeccb('0x16')](_0xeccb('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xeccb('0x18')]()[_0xeccb('0x19')](user[_0xeccb('0x1a')]())[_0xeccb('0x19')](realtime[_0xeccb('0x1b')]())[_0xeccb('0x19')](user[_0xeccb('0x1c')]())['then'](realtime['initTelephones']())[_0xeccb('0x19')](trunk['getTrunks']())[_0xeccb('0x19')](realtime[_0xeccb('0x1d')]())[_0xeccb('0x19')](voiceQueue['getVoiceQueues']())[_0xeccb('0x19')](realtime[_0xeccb('0x1e')]())[_0xeccb('0x19')](trigger[_0xeccb('0x1f')]())['then'](realtime[_0xeccb('0x20')]())[_0xeccb('0x19')](template[_0xeccb('0x21')]())[_0xeccb('0x19')](realtime[_0xeccb('0x22')]())[_0xeccb('0x19')](zendesk[_0xeccb('0x23')]())[_0xeccb('0x19')](realtime['initZendeskAccounts']())[_0xeccb('0x19')](salesforce[_0xeccb('0x24')]())['then'](realtime['initSalesforceAccounts']())[_0xeccb('0x19')](sugarcrm[_0xeccb('0x25')]())[_0xeccb('0x19')](realtime[_0xeccb('0x26')]())[_0xeccb('0x19')](freshdesk[_0xeccb('0x27')]())[_0xeccb('0x19')](realtime[_0xeccb('0x28')]())[_0xeccb('0x19')](desk[_0xeccb('0x29')]())[_0xeccb('0x19')](realtime[_0xeccb('0x2a')]())['then'](zoho[_0xeccb('0x2b')]())[_0xeccb('0x19')](realtime[_0xeccb('0x2c')]())['then'](vtiger['getVtigerAccounts']())[_0xeccb('0x19')](realtime[_0xeccb('0x2d')]())[_0xeccb('0x19')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0xeccb('0x2e')]())[_0xeccb('0x19')](servicenow['getServicenowAccounts']())['then'](realtime[_0xeccb('0x2f')]())[_0xeccb('0x19')](dynamics365[_0xeccb('0x30')]())[_0xeccb('0x19')](realtime['initDynamics365Accounts']())[_0xeccb('0x19')](campaign['getCampaigns']())[_0xeccb('0x19')](realtime[_0xeccb('0x31')]())['then'](voiceExtension[_0xeccb('0x32')]())[_0xeccb('0x19')](realtime[_0xeccb('0x33')]())['then'](faxAccount[_0xeccb('0x34')]())[_0xeccb('0x19')](realtime['initFaxAccounts']())[_0xeccb('0x19')](function(){return realtime;});}function initParams(){return Promise[_0xeccb('0x18')]()[_0xeccb('0x19')](voiceQueueReport[_0xeccb('0x35')]())[_0xeccb('0x19')](realtime[_0xeccb('0x36')]())[_0xeccb('0x19')](cmHopperHistory[_0xeccb('0x37')]())[_0xeccb('0x19')](realtime['initVoiceQueueHopperHistory']())[_0xeccb('0x19')](cmHopperHistory[_0xeccb('0x38')]())[_0xeccb('0x19')](realtime[_0xeccb('0x39')]())[_0xeccb('0x19')](voiceCallReport['getVoiceCallReports']())[_0xeccb('0x19')](realtime[_0xeccb('0x3a')]())[_0xeccb('0x3b')](function(_0x17a0e6){logger[_0xeccb('0x3c')](_0xeccb('0x3d'),util[_0xeccb('0x3e')](_0x17a0e6,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xeccb('0x19')](function(){return initRealtime();})['then'](function(){return initParams();})[_0xeccb('0x19')](function(){report[_0xeccb('0x3f')]();setInterval(initRealtime,0x1388);})['catch'](function(_0xdb468d){logger[_0xeccb('0x3c')](_0xeccb('0x40'),util[_0xeccb('0x3e')](_0xdb468d,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x6fd8=['initCampaigns','getVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','error','[index.js][main]','util','./server','./realtime','./report','./acw','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','../../config/logger','ami','hour','get','resolve','getAgents','then','initAgents','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6fd8,0xea));var _0x86fd=function(_0x1c6bd2,_0x56e81e){_0x1c6bd2=_0x1c6bd2-0x0;var _0x195830=_0x6fd8[_0x1c6bd2];return _0x195830;};'use strict';var util=require(_0x86fd('0x0'));var moment=require('moment');var server=require(_0x86fd('0x1'));var Realtime=require(_0x86fd('0x2'));var Report=require(_0x86fd('0x3'));var Acw=require(_0x86fd('0x4'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x86fd('0x5'));var Fax=require(_0x86fd('0x6'));var user=require(_0x86fd('0x7'));var voiceQueue=require(_0x86fd('0x8'));var voiceQueueReport=require(_0x86fd('0x9'));var voiceCallReport=require(_0x86fd('0xa'));var trunk=require(_0x86fd('0xb'));var trigger=require(_0x86fd('0xc'));var template=require(_0x86fd('0xd'));var cmHopperHistory=require(_0x86fd('0xe'));var campaign=require(_0x86fd('0xf'));var voiceExtension=require(_0x86fd('0x10'));var faxAccount=require(_0x86fd('0x11'));var zendesk=require(_0x86fd('0x12'));var salesforce=require(_0x86fd('0x13'));var sugarcrm=require(_0x86fd('0x14'));var freshdesk=require(_0x86fd('0x15'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x86fd('0x16'));var vtiger=require(_0x86fd('0x17'));var freshsales=require(_0x86fd('0x18'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');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(_0x86fd('0x19'))(_0x86fd('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x86fd('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x86fd('0x1c')](_0x86fd('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x86fd('0x1d')]()['then'](user[_0x86fd('0x1e')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x20')]())[_0x86fd('0x1f')](user['getTelephones']())['then'](realtime['initTelephones']())[_0x86fd('0x1f')](trunk[_0x86fd('0x21')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x22')]())['then'](voiceQueue[_0x86fd('0x23')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x24')]())['then'](trigger[_0x86fd('0x25')]())['then'](realtime[_0x86fd('0x26')]())[_0x86fd('0x1f')](template[_0x86fd('0x27')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x28')]())[_0x86fd('0x1f')](zendesk[_0x86fd('0x29')]())[_0x86fd('0x1f')](realtime['initZendeskAccounts']())[_0x86fd('0x1f')](salesforce[_0x86fd('0x2a')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x2b')]())[_0x86fd('0x1f')](sugarcrm[_0x86fd('0x2c')]())['then'](realtime[_0x86fd('0x2d')]())['then'](freshdesk[_0x86fd('0x2e')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x2f')]())[_0x86fd('0x1f')](desk[_0x86fd('0x30')]())[_0x86fd('0x1f')](realtime['initDeskAccounts']())[_0x86fd('0x1f')](zoho['getZohoAccounts']())[_0x86fd('0x1f')](realtime[_0x86fd('0x31')]())[_0x86fd('0x1f')](vtiger[_0x86fd('0x32')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x33')]())['then'](freshsales[_0x86fd('0x34')]())[_0x86fd('0x1f')](realtime['initFreshsalesAccounts']())[_0x86fd('0x1f')](servicenow[_0x86fd('0x35')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x36')]())['then'](dynamics365[_0x86fd('0x37')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x38')]())[_0x86fd('0x1f')](campaign[_0x86fd('0x39')]())['then'](realtime[_0x86fd('0x3a')]())[_0x86fd('0x1f')](voiceExtension[_0x86fd('0x3b')]())[_0x86fd('0x1f')](realtime['initVoiceExtensions']())[_0x86fd('0x1f')](faxAccount['getFaxAccounts']())[_0x86fd('0x1f')](realtime[_0x86fd('0x3c')]())[_0x86fd('0x1f')](function(){return realtime;});}function initParams(){return Promise[_0x86fd('0x1d')]()[_0x86fd('0x1f')](voiceQueueReport[_0x86fd('0x3d')]())[_0x86fd('0x1f')](realtime[_0x86fd('0x3e')]())[_0x86fd('0x1f')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x86fd('0x1f')](realtime['initVoiceQueueHopperHistory']())[_0x86fd('0x1f')](cmHopperHistory[_0x86fd('0x3f')]())['then'](realtime[_0x86fd('0x40')]())[_0x86fd('0x1f')](voiceCallReport['getVoiceCallReports']())[_0x86fd('0x1f')](realtime[_0x86fd('0x41')]())[_0x86fd('0x42')](function(_0x4c1c54){logger['error'](_0x86fd('0x43'),util[_0x86fd('0x44')](_0x4c1c54,{'showHidden':![],'depth':null}));});}function main(){return server[_0x86fd('0x45')](realtime,preview,fax)[_0x86fd('0x1f')](function(){return initRealtime();})[_0x86fd('0x1f')](function(){return initParams();})['then'](function(){report[_0x86fd('0x46')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x3383f9){logger[_0x86fd('0x47')](_0x86fd('0x48'),util[_0x86fd('0x44')](_0x3383f9,{'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 6717fe3..99936e0 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 _0x5044=['mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','idle','talking','statePause','toNumber','format','user:%s','emit','user:ami:update','user:presence','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','unknown','address','phone'];(function(_0x24e2ca,_0x5d7d2d){var _0x56d93c=function(_0x12015e){while(--_0x12015e){_0x24e2ca['push'](_0x24e2ca['shift']());}};_0x56d93c(++_0x5d7d2d);}(_0x5044,0xc8));var _0x4504=function(_0x542ae7,_0x57332f){_0x542ae7=_0x542ae7-0x0;var _0x5a96a6=_0x5044[_0x542ae7];return _0x5a96a6;};'use strict';var _=require('lodash');var util=require(_0x4504('0x0'));var moment=require('moment');var Redis=require(_0x4504('0x1'));var config=require(_0x4504('0x2'));config[_0x4504('0x3')]=_[_0x4504('0x4')](config[_0x4504('0x3')],{'host':_0x4504('0x5'),'port':0x18eb});var io=require(_0x4504('0x6'))(new Redis(config[_0x4504('0x3')]));function Agent(_0x4d5c5a){this['id']=_0x4d5c5a['id']||0x0;this[_0x4504('0x7')]=_0x4d5c5a[_0x4504('0x7')]||'';this[_0x4504('0x8')]=_0x4d5c5a[_0x4504('0x8')]||'';this[_0x4504('0x9')]=_0x4d5c5a[_0x4504('0x9')]||'';this[_0x4504('0xa')]=_0x4d5c5a[_0x4504('0xa')]||'';this[_0x4504('0xb')]='unknown';this[_0x4504('0xc')]=0x0;this['status']=_0x4504('0xd');this[_0x4504('0xe')]='';this[_0x4504('0xf')]='';this[_0x4504('0x10')]='';this[_0x4504('0x11')]='';this[_0x4504('0x12')]=_0x4d5c5a[_0x4504('0x12')]||![];this[_0x4504('0x13')]=_0x4504('0xd');this[_0x4504('0x14')]=0x0;this[_0x4504('0x15')]='';this[_0x4504('0x16')]='';this[_0x4504('0x17')]=![];this['local']=![];}Agent[_0x4504('0x18')][_0x4504('0x19')]=function(_0x564bc5){if(!_0x564bc5[_0x4504('0xb')]){return;}var _0x2d8b5f=null;var _0x3cdd27=_0x564bc5[_0x4504('0xb')]['toLowerCase']();switch(_0x3cdd27){case'not_inuse':_0x3cdd27=_0x4504('0x1a');break;case'inuse':_0x3cdd27=_0x4504('0x1b');break;}if(this['voiceStatus']!==_0x3cdd27||_0x564bc5[_0x4504('0x1c')]){_0x2d8b5f=_[_0x4504('0x1d')](moment()[_0x4504('0x1e')]('x'));}var _0x52f09e={'id':this['id'],'name':this[_0x4504('0x7')],'email':this[_0x4504('0x8')],'accountcode':this[_0x4504('0x9')],'fullname':this[_0x4504('0xa')],'state':this[_0x4504('0xb')],'stateTime':this[_0x4504('0xc')],'status':this['status'],'address':this['address'],'voiceStatus':_0x3cdd27||this['voiceStatus'],'voiceStatusTime':_0x2d8b5f||this[_0x4504('0x14')],'voiceStatusCallerIdNumber':this[_0x4504('0x15')],'voiceStatusQueue':this[_0x4504('0x16')],'interface':this[_0x4504('0x11')],'onhold':this[_0x4504('0x17')]};if(this['voiceStatus']!==_0x3cdd27){this[_0x4504('0x13')]=_0x3cdd27;io['to'](util[_0x4504('0x1e')](_0x4504('0x1f'),_0x52f09e[_0x4504('0x7')]))[_0x4504('0x20')](_0x4504('0x21'),_0x52f09e);io['emit'](_0x4504('0x22'),_0x52f09e);}};module[_0x4504('0x23')]=Agent; \ No newline at end of file +var _0xffe1=['user:ami:update','emit','user:presence','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','toLowerCase','idle','talking','statePause','toNumber','fullname','voiceStatusTime','format','user:%s'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xffe1,0x175));var _0x1ffe=function(_0x5e8e29,_0x4c2aea){_0x5e8e29=_0x5e8e29-0x0;var _0x1b9c84=_0xffe1[_0x5e8e29];return _0x1b9c84;};'use strict';var _=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x1ffe('0x2'));config[_0x1ffe('0x3')]=_[_0x1ffe('0x4')](config['redis'],{'host':_0x1ffe('0x5'),'port':0x18eb});var io=require(_0x1ffe('0x6'))(new Redis(config[_0x1ffe('0x3')]));function Agent(_0x5a5912){this['id']=_0x5a5912['id']||0x0;this[_0x1ffe('0x7')]=_0x5a5912[_0x1ffe('0x7')]||'';this[_0x1ffe('0x8')]=_0x5a5912[_0x1ffe('0x8')]||'';this[_0x1ffe('0x9')]=_0x5a5912[_0x1ffe('0x9')]||'';this['fullname']=_0x5a5912['fullname']||'';this[_0x1ffe('0xa')]=_0x1ffe('0xb');this[_0x1ffe('0xc')]=0x0;this[_0x1ffe('0xd')]='unknown';this[_0x1ffe('0xe')]='';this[_0x1ffe('0xf')]='';this[_0x1ffe('0x10')]='';this[_0x1ffe('0x11')]='';this[_0x1ffe('0x12')]=_0x5a5912[_0x1ffe('0x12')]||![];this[_0x1ffe('0x13')]=_0x1ffe('0xb');this['voiceStatusTime']=0x0;this[_0x1ffe('0x14')]='';this[_0x1ffe('0x15')]='';this['onhold']=![];this[_0x1ffe('0x16')]=![];}Agent[_0x1ffe('0x17')][_0x1ffe('0x18')]=function(_0xae23bf){if(!_0xae23bf[_0x1ffe('0xa')]){return;}var _0x5ab4b4=null;var _0x972599=_0xae23bf[_0x1ffe('0xa')][_0x1ffe('0x19')]();switch(_0x972599){case'not_inuse':_0x972599=_0x1ffe('0x1a');break;case'inuse':_0x972599=_0x1ffe('0x1b');break;}if(this['voiceStatus']!==_0x972599||_0xae23bf[_0x1ffe('0x1c')]){_0x5ab4b4=_[_0x1ffe('0x1d')](moment()['format']('x'));}var _0x561670={'id':this['id'],'name':this['name'],'email':this[_0x1ffe('0x8')],'accountcode':this[_0x1ffe('0x9')],'fullname':this[_0x1ffe('0x1e')],'state':this[_0x1ffe('0xa')],'stateTime':this[_0x1ffe('0xc')],'status':this[_0x1ffe('0xd')],'address':this[_0x1ffe('0xe')],'voiceStatus':_0x972599||this[_0x1ffe('0x13')],'voiceStatusTime':_0x5ab4b4||this[_0x1ffe('0x1f')],'voiceStatusCallerIdNumber':this[_0x1ffe('0x14')],'voiceStatusQueue':this[_0x1ffe('0x15')],'interface':this[_0x1ffe('0x11')],'onhold':this['onhold']};if(this['voiceStatus']!==_0x972599){this[_0x1ffe('0x13')]=_0x972599;io['to'](util[_0x1ffe('0x20')](_0x1ffe('0x21'),_0x561670['name']))['emit'](_0x1ffe('0x22'),_0x561670);io[_0x1ffe('0x23')](_0x1ffe('0x24'),_0x561670);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 41f7675..e664389 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 _0x16ef=['dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x1956c8,_0x67869c){var _0x52b8f2=function(_0x3e828b){while(--_0x3e828b){_0x1956c8['push'](_0x1956c8['shift']());}};_0x52b8f2(++_0x67869c);}(_0x16ef,0x105));var _0xf16e=function(_0x4338d5,_0x5c636a){_0x4338d5=_0x4338d5-0x0;var _0x14536e=_0x16ef[_0x4338d5];return _0x14536e;};'use strict';function Campaign(_0x4a609a){this['id']=_0x4a609a['id']||0x0;this[_0xf16e('0x0')]=_0x4a609a[_0xf16e('0x0')]||'';this[_0xf16e('0x1')]=_0x4a609a[_0xf16e('0x1')]||_0xf16e('0x2');this[_0xf16e('0x3')]=0x0;this[_0xf16e('0x4')]=0x0;this[_0xf16e('0x5')]=0x0;this[_0xf16e('0x6')]=0x0;this[_0xf16e('0x7')]='';this[_0xf16e('0x8')]=!![];this[_0xf16e('0x9')]=_0x4a609a[_0xf16e('0x9')];this[_0xf16e('0xa')]=_0x4a609a['limitCalls'];this[_0xf16e('0xb')]=_0x4a609a[_0xf16e('0xb')]||null;this[_0xf16e('0xc')]=_0x4a609a['dialGlobalInterval']?_0x4a609a['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x4a609a[_0xf16e('0xd')];this[_0xf16e('0xe')]=_0x4a609a[_0xf16e('0xe')];this[_0xf16e('0xf')]=_0x4a609a[_0xf16e('0xf')]||0x1e;this[_0xf16e('0x10')]=_0x4a609a[_0xf16e('0x10')];this[_0xf16e('0x11')]=_0x4a609a[_0xf16e('0x11')];this[_0xf16e('0x12')]=_0x4a609a[_0xf16e('0x12')];this['dialBusyRetryFrequency']=_0x4a609a['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x4a609a[_0xf16e('0x13')];this[_0xf16e('0x14')]=_0x4a609a['dialNoAnswerRetryFrequency'];this[_0xf16e('0x15')]=_0x4a609a[_0xf16e('0x15')];this[_0xf16e('0x16')]=_0x4a609a[_0xf16e('0x16')]||0x3;this[_0xf16e('0x17')]=_0x4a609a[_0xf16e('0x17')]||0x96;this[_0xf16e('0x18')]=_0x4a609a[_0xf16e('0x18')]||0x3;this[_0xf16e('0x19')]=_0x4a609a[_0xf16e('0x19')]||0x96;this[_0xf16e('0x1a')]=_0x4a609a[_0xf16e('0x1a')]||0x3;this[_0xf16e('0x1b')]=_0x4a609a[_0xf16e('0x1b')]||0x96;this['dialMachineMaxRetry']=_0x4a609a[_0xf16e('0x1c')]||0x3;this[_0xf16e('0x1d')]=_0x4a609a[_0xf16e('0x1d')]||0x96;this[_0xf16e('0x1e')]=_0x4a609a['dialAgentRejectMaxRetry']||0x3;this[_0xf16e('0x1f')]=_0x4a609a[_0xf16e('0x1f')]||0x96;this[_0xf16e('0x20')]=_0x4a609a[_0xf16e('0x20')]||_0xf16e('0x21');this['dialPrefix']=_0x4a609a[_0xf16e('0x22')]||undefined;this[_0xf16e('0x23')]=_0x4a609a[_0xf16e('0x23')]||undefined;this[_0xf16e('0x24')]=_0x4a609a[_0xf16e('0x24')]||undefined;this[_0xf16e('0x25')]=_0x4a609a[_0xf16e('0x25')]?_0x4a609a['TrunkBackup']:undefined;this[_0xf16e('0x26')]=_0x4a609a['Trunk']?_0x4a609a[_0xf16e('0x26')]:undefined;this[_0xf16e('0x27')]=_0x4a609a[_0xf16e('0x27')]?_0x4a609a[_0xf16e('0x27')]:undefined;this[_0xf16e('0x28')]=_0x4a609a[_0xf16e('0x28')]?_0x4a609a[_0xf16e('0x28')]:undefined;this[_0xf16e('0x29')]=_0x4a609a[_0xf16e('0x28')]?_0x4a609a['SquareProject'][_0xf16e('0x0')]:undefined;this[_0xf16e('0x2a')]=_0x4a609a[_0xf16e('0x2a')]||![];this['dialAMDInitialSilence']=_0x4a609a[_0xf16e('0x2b')];this[_0xf16e('0x2c')]=_0x4a609a['dialAMDGreeting'];this[_0xf16e('0x2d')]=_0x4a609a['dialAMDAfterGreetingSilence'];this[_0xf16e('0x2e')]=_0x4a609a[_0xf16e('0x2e')];this[_0xf16e('0x2f')]=_0x4a609a['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x4a609a[_0xf16e('0x30')];this['dialAMDMaximumNumberOfWords']=_0x4a609a[_0xf16e('0x31')];this[_0xf16e('0x32')]=_0x4a609a[_0xf16e('0x32')];this[_0xf16e('0x33')]=_0x4a609a[_0xf16e('0x33')];}module['exports']=Campaign; \ No newline at end of file +var _0x2aa7=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2aa7,0xe4));var _0x72aa=function(_0x20b0fe,_0x3ebb0a){_0x20b0fe=_0x20b0fe-0x0;var _0x5c50cc=_0x2aa7[_0x20b0fe];return _0x5c50cc;};'use strict';function Campaign(_0x1fb44d){this['id']=_0x1fb44d['id']||0x0;this['name']=_0x1fb44d[_0x72aa('0x0')]||'';this[_0x72aa('0x1')]=_0x1fb44d[_0x72aa('0x1')]||_0x72aa('0x2');this[_0x72aa('0x3')]=0x0;this['temp']=0x0;this[_0x72aa('0x4')]=0x0;this[_0x72aa('0x5')]=0x0;this[_0x72aa('0x6')]='';this[_0x72aa('0x7')]=!![];this[_0x72aa('0x8')]=_0x1fb44d[_0x72aa('0x8')];this[_0x72aa('0x9')]=_0x1fb44d['limitCalls'];this[_0x72aa('0xa')]=_0x1fb44d[_0x72aa('0xa')]||null;this[_0x72aa('0xb')]=_0x1fb44d[_0x72aa('0xb')]?_0x1fb44d['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x1fb44d[_0x72aa('0xc')];this[_0x72aa('0xd')]=_0x1fb44d['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x1fb44d[_0x72aa('0xe')]||0x1e;this[_0x72aa('0xf')]=_0x1fb44d[_0x72aa('0xf')];this[_0x72aa('0x10')]=_0x1fb44d[_0x72aa('0x10')];this[_0x72aa('0x11')]=_0x1fb44d['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x1fb44d[_0x72aa('0x12')];this['dialNoAnswerMaxRetry']=_0x1fb44d['dialNoAnswerMaxRetry'];this[_0x72aa('0x13')]=_0x1fb44d[_0x72aa('0x13')];this[_0x72aa('0x14')]=_0x1fb44d['dialGlobalMaxRetry'];this[_0x72aa('0x15')]=_0x1fb44d[_0x72aa('0x15')]||0x3;this[_0x72aa('0x16')]=_0x1fb44d[_0x72aa('0x16')]||0x96;this['dialDropMaxRetry']=_0x1fb44d[_0x72aa('0x17')]||0x3;this['dialDropRetryFrequency']=_0x1fb44d['dialDropRetryFrequency']||0x96;this[_0x72aa('0x18')]=_0x1fb44d['dialAbandonedMaxRetry']||0x3;this[_0x72aa('0x19')]=_0x1fb44d['dialAbandonedRetryFrequency']||0x96;this[_0x72aa('0x1a')]=_0x1fb44d[_0x72aa('0x1a')]||0x3;this[_0x72aa('0x1b')]=_0x1fb44d[_0x72aa('0x1b')]||0x96;this[_0x72aa('0x1c')]=_0x1fb44d[_0x72aa('0x1c')]||0x3;this[_0x72aa('0x1d')]=_0x1fb44d[_0x72aa('0x1d')]||0x96;this[_0x72aa('0x1e')]=_0x1fb44d['dialOrderByScheduledAt']||_0x72aa('0x1f');this[_0x72aa('0x20')]=_0x1fb44d['dialPrefix']||undefined;this[_0x72aa('0x21')]=_0x1fb44d['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x72aa('0x22')]=_0x1fb44d[_0x72aa('0x22')]||undefined;this['TrunkBackup']=_0x1fb44d[_0x72aa('0x23')]?_0x1fb44d[_0x72aa('0x23')]:undefined;this['Trunk']=_0x1fb44d['Trunk']?_0x1fb44d[_0x72aa('0x24')]:undefined;this[_0x72aa('0x25')]=_0x1fb44d[_0x72aa('0x25')]?_0x1fb44d[_0x72aa('0x25')]:undefined;this[_0x72aa('0x26')]=_0x1fb44d[_0x72aa('0x26')]?_0x1fb44d['SquareProject']:undefined;this['dialQueueProject']=_0x1fb44d[_0x72aa('0x26')]?_0x1fb44d[_0x72aa('0x26')]['name']:undefined;this[_0x72aa('0x27')]=_0x1fb44d[_0x72aa('0x27')]||![];this[_0x72aa('0x28')]=_0x1fb44d[_0x72aa('0x28')];this[_0x72aa('0x29')]=_0x1fb44d['dialAMDGreeting'];this[_0x72aa('0x2a')]=_0x1fb44d[_0x72aa('0x2a')];this[_0x72aa('0x2b')]=_0x1fb44d[_0x72aa('0x2b')];this[_0x72aa('0x2c')]=_0x1fb44d[_0x72aa('0x2c')];this[_0x72aa('0x2d')]=_0x1fb44d[_0x72aa('0x2d')];this[_0x72aa('0x2e')]=_0x1fb44d[_0x72aa('0x2e')];this['dialAMDSilenceThreshold']=_0x1fb44d[_0x72aa('0x2f')];this['dialAMDMaximumWordLength']=_0x1fb44d['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 ef6436a..d2ab6ef 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 _0x1349=['duration','billableseconds','holdtime','tag','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','answered','answertime','endtime','lastapplication'];(function(_0x20f1bf,_0x366b19){var _0x51e5a4=function(_0x250fc4){while(--_0x250fc4){_0x20f1bf['push'](_0x20f1bf['shift']());}};_0x51e5a4(++_0x366b19);}(_0x1349,0x1ac));var _0x9134=function(_0x5247c6,_0x3722b7){_0x5247c6=_0x5247c6-0x0;var _0x2c8fdf=_0x1349[_0x5247c6];return _0x2c8fdf;};'use strict';function Channel(){this[_0x9134('0x0')]=null;this[_0x9134('0x1')]='';this[_0x9134('0x2')]='';this[_0x9134('0x3')]=0x0;this[_0x9134('0x4')]='';this[_0x9134('0x5')]=undefined;this[_0x9134('0x6')]=undefined;this[_0x9134('0x7')]=0x0;this[_0x9134('0x8')]='';this['uniqueid']=0x0;this[_0x9134('0x9')]=0x0;this['exten']=0x0;this[_0x9134('0xa')]=![];this[_0x9134('0xb')]=null;this[_0x9134('0xc')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0x9134('0xd')]='';this['lastdata']='';this[_0x9134('0xe')]=0x0;this[_0x9134('0xf')]=0x0;this[_0x9134('0x10')]=0x0;this['type']=null;this[_0x9134('0x11')]=null;this[_0x9134('0x12')]=null;this[_0x9134('0x13')]=![];this[_0x9134('0x14')]=null;this[_0x9134('0x15')]=null;this[_0x9134('0x16')]=[];this['transfercalleridnum']=undefined;this[_0x9134('0x17')]=undefined;this[_0x9134('0x18')]=undefined;this[_0x9134('0x19')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x1267=['channel','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','lastapplication','duration','holdtime','type','tag','disposition','monitor','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime'];(function(_0x3326d2,_0xda9655){var _0x5004b7=function(_0x2d3e30){while(--_0x2d3e30){_0x3326d2['push'](_0x3326d2['shift']());}};_0x5004b7(++_0xda9655);}(_0x1267,0xb5));var _0x7126=function(_0x448f4e,_0x258f8f){_0x448f4e=_0x448f4e-0x0;var _0x589b2c=_0x1267[_0x448f4e];return _0x589b2c;};'use strict';function Channel(){this[_0x7126('0x0')]=null;this[_0x7126('0x1')]='';this['destinationchannel']='';this['calleridnum']=0x0;this[_0x7126('0x2')]='';this[_0x7126('0x3')]=undefined;this[_0x7126('0x4')]=undefined;this[_0x7126('0x5')]=0x0;this[_0x7126('0x6')]='';this[_0x7126('0x7')]=0x0;this[_0x7126('0x8')]=0x0;this['exten']=0x0;this[_0x7126('0x9')]=![];this[_0x7126('0xa')]=null;this[_0x7126('0xb')]=null;this[_0x7126('0xc')]=![];this['abandoned']=![];this[_0x7126('0xd')]='';this['lastdata']='';this[_0x7126('0xe')]=0x0;this['billableseconds']=0x0;this[_0x7126('0xf')]=0x0;this[_0x7126('0x10')]=null;this[_0x7126('0x11')]=null;this[_0x7126('0x12')]=null;this[_0x7126('0x13')]=![];this['monitorFilename']=null;this['queue']=null;this[_0x7126('0x14')]=[];this[_0x7126('0x15')]=undefined;this[_0x7126('0x16')]=undefined;this[_0x7126('0x17')]=undefined;this[_0x7126('0x18')]=0x0;}module[_0x7126('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index c4d68df..d1d6235 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 _0x55c3=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x1f0a50,_0x3b61f4){var _0x23bcd2=function(_0x29eb34){while(--_0x29eb34){_0x1f0a50['push'](_0x1f0a50['shift']());}};_0x23bcd2(++_0x3b61f4);}(_0x55c3,0xf1));var _0x355c=function(_0x3f6abc,_0x4791f1){_0x3f6abc=_0x3f6abc-0x0;var _0x50a554=_0x55c3[_0x3f6abc];return _0x50a554;};'use strict';function DeskAccount(_0xa2f7a1){this['id']=_0xa2f7a1['id']||0x0;this[_0x355c('0x0')]=_0xa2f7a1[_0x355c('0x0')]||'';this['username']=_0xa2f7a1[_0x355c('0x1')]||'';this[_0x355c('0x2')]=_0xa2f7a1[_0x355c('0x2')]||'';this[_0x355c('0x3')]=_0xa2f7a1[_0x355c('0x3')]||'';this[_0x355c('0x4')]=_0xa2f7a1[_0x355c('0x4')]||'';this[_0x355c('0x5')]=_0xa2f7a1[_0x355c('0x5')]||'';this[_0x355c('0x6')]=_0xa2f7a1[_0x355c('0x6')]||'';this[_0x355c('0x7')]=_0xa2f7a1['token']||'';this[_0x355c('0x8')]=_0xa2f7a1['tokenSecret']||'';this[_0x355c('0x9')]=_0xa2f7a1['type']||'';this[_0x355c('0xa')]=_0xa2f7a1['serverUrl']||'';this[_0x355c('0xb')]=_0xa2f7a1['Configurations']||{};}module[_0x355c('0xc')]=DeskAccount; \ No newline at end of file +var _0x6c8f=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x439ebd,_0x52d087){var _0x3e6c51=function(_0x28b88e){while(--_0x28b88e){_0x439ebd['push'](_0x439ebd['shift']());}};_0x3e6c51(++_0x52d087);}(_0x6c8f,0x19e));var _0xf6c8=function(_0x47f7a6,_0x51552b){_0x47f7a6=_0x47f7a6-0x0;var _0x793094=_0x6c8f[_0x47f7a6];return _0x793094;};'use strict';function DeskAccount(_0x16eba2){this['id']=_0x16eba2['id']||0x0;this['name']=_0x16eba2[_0xf6c8('0x0')]||'';this[_0xf6c8('0x1')]=_0x16eba2['username']||'';this['remoteUri']=_0x16eba2[_0xf6c8('0x2')]||'';this[_0xf6c8('0x3')]=_0x16eba2[_0xf6c8('0x3')]||'';this[_0xf6c8('0x4')]=_0x16eba2[_0xf6c8('0x4')]||'';this['consumerKey']=_0x16eba2[_0xf6c8('0x5')]||'';this['consumerSecret']=_0x16eba2[_0xf6c8('0x6')]||'';this[_0xf6c8('0x7')]=_0x16eba2['token']||'';this[_0xf6c8('0x8')]=_0x16eba2['tokenSecret']||'';this[_0xf6c8('0x9')]=_0x16eba2[_0xf6c8('0x9')]||'';this['serverUrl']=_0x16eba2[_0xf6c8('0xa')]||'';this[_0xf6c8('0xb')]=_0x16eba2[_0xf6c8('0xb')]||{};}module[_0xf6c8('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 a1b4d3f..edc29e6 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 _0x7e56=['serverUrl','modernAuthentication','CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x4a5fa5,_0x51dadc){var _0x241266=function(_0x404501){while(--_0x404501){_0x4a5fa5['push'](_0x4a5fa5['shift']());}};_0x241266(++_0x51dadc);}(_0x7e56,0x161));var _0x67e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e56[_0x3dd15e];return _0x231fd0;};'use strict';function Dynamics365Account(_0x15f2ac){this['id']=_0x15f2ac['id']||0x0;this[_0x67e5('0x0')]=_0x15f2ac[_0x67e5('0x0')]||'';this['username']=_0x15f2ac[_0x67e5('0x1')]||'';this['password']=_0x15f2ac[_0x67e5('0x2')]||'';this[_0x67e5('0x3')]=_0x15f2ac[_0x67e5('0x3')]||'';this[_0x67e5('0x4')]=_0x15f2ac[_0x67e5('0x4')]||'';this[_0x67e5('0x5')]=_0x15f2ac[_0x67e5('0x5')]||'';this['clientSecret']=_0x15f2ac[_0x67e5('0x6')]||{};this[_0x67e5('0x7')]=_0x15f2ac[_0x67e5('0x7')]||'';this[_0x67e5('0x8')]=_0x15f2ac[_0x67e5('0x8')]||![];this['Configurations']=_0x15f2ac['Configurations']||{};this[_0x67e5('0x9')]=_0x15f2ac[_0x67e5('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xc1fd=['name','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x23e25b,_0x4f60a0){var _0x933e34=function(_0x3fe3e){while(--_0x3fe3e){_0x23e25b['push'](_0x23e25b['shift']());}};_0x933e34(++_0x4f60a0);}(_0xc1fd,0xbb));var _0xdc1f=function(_0x4ba74e,_0x51fdbf){_0x4ba74e=_0x4ba74e-0x0;var _0x2b137b=_0xc1fd[_0x4ba74e];return _0x2b137b;};'use strict';function Dynamics365Account(_0x4875d5){this['id']=_0x4875d5['id']||0x0;this[_0xdc1f('0x0')]=_0x4875d5[_0xdc1f('0x0')]||'';this[_0xdc1f('0x1')]=_0x4875d5[_0xdc1f('0x1')]||'';this['password']=_0x4875d5[_0xdc1f('0x2')]||'';this['remoteUri']=_0x4875d5[_0xdc1f('0x3')]||'';this[_0xdc1f('0x4')]=_0x4875d5[_0xdc1f('0x4')]||'';this[_0xdc1f('0x5')]=_0x4875d5['clientId']||'';this[_0xdc1f('0x6')]=_0x4875d5[_0xdc1f('0x6')]||{};this['serverUrl']=_0x4875d5['serverUrl']||'';this[_0xdc1f('0x7')]=_0x4875d5[_0xdc1f('0x7')]||![];this['Configurations']=_0x4875d5[_0xdc1f('0x8')]||{};this[_0xdc1f('0x9')]=_0x4875d5[_0xdc1f('0x9')]||{};}module[_0xdc1f('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 7142d7b..8ab8b31 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 _0x6ca5=['exports','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key'];(function(_0x27e2b2,_0x5d54af){var _0x1ba1fa=function(_0x4a4f9d){while(--_0x4a4f9d){_0x27e2b2['push'](_0x27e2b2['shift']());}};_0x1ba1fa(++_0x5d54af);}(_0x6ca5,0x101));var _0x56ca=function(_0x48c8ff,_0x321970){_0x48c8ff=_0x48c8ff-0x0;var _0x1cef1e=_0x6ca5[_0x48c8ff];return _0x1cef1e;};'use strict';function FaxAccount(_0x58133e){this['id']=_0x58133e['id']||0x0;this['name']=_0x58133e['name']||'';this['description']=_0x58133e[_0x56ca('0x0')];this['ecm']=_0x58133e[_0x56ca('0x1')];this['headerinfo']=_0x58133e[_0x56ca('0x2')];this[_0x56ca('0x3')]=_0x58133e[_0x56ca('0x3')];this['minrate']=_0x58133e[_0x56ca('0x4')]||0x960;this[_0x56ca('0x5')]=_0x58133e[_0x56ca('0x5')]||0x3840;this['modem']=_0x58133e[_0x56ca('0x6')]||_0x56ca('0x7');this[_0x56ca('0x8')]=_0x58133e[_0x56ca('0x8')]||'no';this[_0x56ca('0x9')]=_0x58133e[_0x56ca('0x9')]||'no';this[_0x56ca('0xa')]=_0x58133e[_0x56ca('0xa')]||0x1388;this[_0x56ca('0xb')]=_0x58133e[_0x56ca('0xb')]||'SIP';this[_0x56ca('0xc')]=_0x58133e[_0x56ca('0xc')]?_0x58133e[_0x56ca('0xc')]:undefined;this[_0x56ca('0xd')]=_0x58133e[_0x56ca('0xd')];this[_0x56ca('0xe')]=_0x58133e[_0x56ca('0xe')];}module[_0x56ca('0xf')]=FaxAccount; \ No newline at end of file +var _0xdb47=['t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','localstationid','maxrate','modem','gateway','faxdetect'];(function(_0x50f66c,_0x6ce2da){var _0x2d612c=function(_0x50c1ae){while(--_0x50c1ae){_0x50f66c['push'](_0x50f66c['shift']());}};_0x2d612c(++_0x6ce2da);}(_0xdb47,0x16f));var _0x7db4=function(_0x22b02e,_0x27861c){_0x22b02e=_0x22b02e-0x0;var _0x417a4a=_0xdb47[_0x22b02e];return _0x417a4a;};'use strict';function FaxAccount(_0x2cd7f9){this['id']=_0x2cd7f9['id']||0x0;this[_0x7db4('0x0')]=_0x2cd7f9['name']||'';this[_0x7db4('0x1')]=_0x2cd7f9[_0x7db4('0x1')];this['ecm']=_0x2cd7f9[_0x7db4('0x2')];this['headerinfo']=_0x2cd7f9['headerinfo'];this[_0x7db4('0x3')]=_0x2cd7f9[_0x7db4('0x3')];this['minrate']=_0x2cd7f9['minrate']||0x960;this[_0x7db4('0x4')]=_0x2cd7f9[_0x7db4('0x4')]||0x3840;this[_0x7db4('0x5')]=_0x2cd7f9[_0x7db4('0x5')]||'v17,v27,v29';this['gateway']=_0x2cd7f9[_0x7db4('0x6')]||'no';this[_0x7db4('0x7')]=_0x2cd7f9['faxdetect']||'no';this[_0x7db4('0x8')]=_0x2cd7f9['t38timeout']||0x1388;this[_0x7db4('0x9')]=_0x2cd7f9[_0x7db4('0x9')]||_0x7db4('0xa');this[_0x7db4('0xb')]=_0x2cd7f9[_0x7db4('0xb')]?_0x2cd7f9[_0x7db4('0xb')]:undefined;this[_0x7db4('0xc')]=_0x2cd7f9['ListId'];this[_0x7db4('0xd')]=_0x2cd7f9[_0x7db4('0xd')];}module[_0x7db4('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 3ee528b..761fe57 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 _0xfaf6=['serverUrl','Configurations','exports','name','username','token'];(function(_0x31f5b5,_0x1ada3a){var _0x362967=function(_0x6fe3f5){while(--_0x6fe3f5){_0x31f5b5['push'](_0x31f5b5['shift']());}};_0x362967(++_0x1ada3a);}(_0xfaf6,0x10b));var _0x6faf=function(_0x148271,_0x1ba6b0){_0x148271=_0x148271-0x0;var _0x1b4dbf=_0xfaf6[_0x148271];return _0x1b4dbf;};'use strict';function FreshdeskAccount(_0x1fba7c){this['id']=_0x1fba7c['id']||0x0;this[_0x6faf('0x0')]=_0x1fba7c['name']||'';this[_0x6faf('0x1')]=_0x1fba7c[_0x6faf('0x1')]||'';this['apiKey']=_0x1fba7c[_0x6faf('0x2')]||'';this['remoteUri']=_0x1fba7c['remoteUri']||'';this['serverUrl']=_0x1fba7c[_0x6faf('0x3')]||'';this['Configurations']=_0x1fba7c[_0x6faf('0x4')]||{};}module[_0x6faf('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0x0fc8=['Configurations','exports','name','username','apiKey','token','serverUrl'];(function(_0x34cfcd,_0x360e5a){var _0x2f961e=function(_0x3d1b5a){while(--_0x3d1b5a){_0x34cfcd['push'](_0x34cfcd['shift']());}};_0x2f961e(++_0x360e5a);}(_0x0fc8,0x79));var _0x80fc=function(_0x53b413,_0x50e8ed){_0x53b413=_0x53b413-0x0;var _0x495f1d=_0x0fc8[_0x53b413];return _0x495f1d;};'use strict';function FreshdeskAccount(_0x2dd2c8){this['id']=_0x2dd2c8['id']||0x0;this['name']=_0x2dd2c8[_0x80fc('0x0')]||'';this['username']=_0x2dd2c8[_0x80fc('0x1')]||'';this[_0x80fc('0x2')]=_0x2dd2c8[_0x80fc('0x3')]||'';this['remoteUri']=_0x2dd2c8['remoteUri']||'';this[_0x80fc('0x4')]=_0x2dd2c8[_0x80fc('0x4')]||'';this[_0x80fc('0x5')]=_0x2dd2c8[_0x80fc('0x5')]||{};}module[_0x80fc('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 e30835f..49dcad6 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 _0x9b2a=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x5676fc,_0x1507e4){var _0x13999b=function(_0x11395a){while(--_0x11395a){_0x5676fc['push'](_0x5676fc['shift']());}};_0x13999b(++_0x1507e4);}(_0x9b2a,0x127));var _0xa9b2=function(_0x2b7510,_0x2015cc){_0x2b7510=_0x2b7510-0x0;var _0x3d6973=_0x9b2a[_0x2b7510];return _0x3d6973;};'use strict';function FreshsalesAccount(_0x19fd42){this['id']=_0x19fd42['id']||0x0;this['name']=_0x19fd42[_0xa9b2('0x0')]||'';this[_0xa9b2('0x1')]=_0x19fd42[_0xa9b2('0x1')]||'';this['apiKey']=_0x19fd42[_0xa9b2('0x2')]||'';this[_0xa9b2('0x3')]=_0x19fd42['remoteUri']||'';this['serverUrl']=_0x19fd42[_0xa9b2('0x4')]||'';this[_0xa9b2('0x5')]=_0x19fd42[_0xa9b2('0x5')]||{};}module[_0xa9b2('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xf842=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x39bc06,_0x1d91af){var _0x40dc5f=function(_0x29e8be){while(--_0x29e8be){_0x39bc06['push'](_0x39bc06['shift']());}};_0x40dc5f(++_0x1d91af);}(_0xf842,0x172));var _0x2f84=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0xf842[_0x503950];return _0x1657a9;};'use strict';function FreshsalesAccount(_0x3344){this['id']=_0x3344['id']||0x0;this[_0x2f84('0x0')]=_0x3344[_0x2f84('0x0')]||'';this[_0x2f84('0x1')]=_0x3344['username']||'';this[_0x2f84('0x2')]=_0x3344[_0x2f84('0x3')]||'';this[_0x2f84('0x4')]=_0x3344[_0x2f84('0x4')]||'';this[_0x2f84('0x5')]=_0x3344['serverUrl']||'';this[_0x2f84('0x6')]=_0x3344[_0x2f84('0x6')]||{};}module[_0x2f84('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 672ee98..5b03fb5 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 _0x89e9=['queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','mohtime','exports','inbound','uniqueid','calleridnum','calleridname','queue'];(function(_0x5cd2bb,_0x4a063f){var _0x1e5ecc=function(_0x542815){while(--_0x542815){_0x5cd2bb['push'](_0x5cd2bb['shift']());}};_0x1e5ecc(++_0x4a063f);}(_0x89e9,0x73));var _0x989e=function(_0x5c0f8a,_0x5ee3df){_0x5c0f8a=_0x5c0f8a-0x0;var _0x2fb45f=_0x89e9[_0x5c0f8a];return _0x2fb45f;};'use strict';function QueueReport(){this['type']=_0x989e('0x0');this[_0x989e('0x1')]='';this[_0x989e('0x2')]='';this[_0x989e('0x3')]='';this[_0x989e('0x4')]='';this[_0x989e('0x5')]=null;this[_0x989e('0x6')]=null;this[_0x989e('0x7')]=0x1;this[_0x989e('0x8')]=0x1;this[_0x989e('0x9')]=![];this[_0x989e('0xa')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0x989e('0xb')]=![];this[_0x989e('0xc')]=null;this[_0x989e('0xd')]=0x1;this['channel']='';this[_0x989e('0xe')]='';this['connectedlinename']='';this['accountcode']='';this[_0x989e('0xf')]='';this[_0x989e('0x10')]='';this[_0x989e('0x11')]='';this[_0x989e('0x12')]=0x0;this['assigned']=![];this[_0x989e('0x13')]='';this[_0x989e('0x14')]=_0x989e('0x15');this['routealias']=null;this[_0x989e('0x16')]=0x0;this['variables']={};}module[_0x989e('0x17')]=QueueReport; \ No newline at end of file +var _0x9b9c=['accountcode','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','routealias','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','position','count','queuecallercomplete','queuecallercompleteAt','channel','connectedlinename'];(function(_0x18b8ec,_0x7b7c07){var _0x2a1df5=function(_0x511837){while(--_0x511837){_0x18b8ec['push'](_0x18b8ec['shift']());}};_0x2a1df5(++_0x7b7c07);}(_0x9b9c,0x129));var _0xc9b9=function(_0x4f6021,_0x23ccfa){_0x4f6021=_0x4f6021-0x0;var _0x398dbe=_0x9b9c[_0x4f6021];return _0x398dbe;};'use strict';function QueueReport(){this[_0xc9b9('0x0')]=_0xc9b9('0x1');this['uniqueid']='';this[_0xc9b9('0x2')]='';this[_0xc9b9('0x3')]='';this[_0xc9b9('0x4')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xc9b9('0x5')]=0x1;this[_0xc9b9('0x6')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xc9b9('0x7')]=![];this[_0xc9b9('0x8')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0xc9b9('0x9')]='';this['connectedlinenum']='';this[_0xc9b9('0xa')]='';this[_0xc9b9('0xb')]='';this['context']='';this[_0xc9b9('0xc')]='';this[_0xc9b9('0xd')]='';this[_0xc9b9('0xe')]=0x0;this[_0xc9b9('0xf')]=![];this[_0xc9b9('0x10')]='';this[_0xc9b9('0x11')]='voice';this[_0xc9b9('0x12')]=null;this[_0xc9b9('0x13')]=0x0;this[_0xc9b9('0x14')]={};}module[_0xc9b9('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 74cc271..a4430ac 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 _0x62f1=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x401089,_0x469a19){var _0x128e7c=function(_0x286ffa){while(--_0x286ffa){_0x401089['push'](_0x401089['shift']());}};_0x128e7c(++_0x469a19);}(_0x62f1,0x112));var _0x162f=function(_0x2bb024,_0xcf9341){_0x2bb024=_0x2bb024-0x0;var _0x3d6aff=_0x62f1[_0x2bb024];return _0x3d6aff;};'use strict';function SalesforceAccount(_0x22ddd3){this['id']=_0x22ddd3['id']||0x0;this['name']=_0x22ddd3[_0x162f('0x0')]||'';this[_0x162f('0x1')]=_0x22ddd3[_0x162f('0x1')]||'';this[_0x162f('0x2')]=_0x22ddd3[_0x162f('0x2')]||'';this[_0x162f('0x3')]=_0x22ddd3[_0x162f('0x3')]||'';this[_0x162f('0x4')]=_0x22ddd3[_0x162f('0x4')]||'';this[_0x162f('0x5')]=_0x22ddd3['clientSecret']||'';this[_0x162f('0x6')]=_0x22ddd3[_0x162f('0x6')]||'';this['type']=_0x22ddd3[_0x162f('0x7')]||_0x162f('0x8');this[_0x162f('0x9')]=_0x22ddd3['serverUrl']||'';this[_0x162f('0xa')]=_0x22ddd3[_0x162f('0xa')]||{};}module[_0x162f('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x9a69=['remoteUri','password','clientId','clientSecret','type','integrationTab','serverUrl','Configurations','name','username'];(function(_0x1699e9,_0x1f2652){var _0x14b104=function(_0x319079){while(--_0x319079){_0x1699e9['push'](_0x1699e9['shift']());}};_0x14b104(++_0x1f2652);}(_0x9a69,0x9e));var _0x99a6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9a69[_0x2641f9];return _0x585741;};'use strict';function SalesforceAccount(_0x3d45b6){this['id']=_0x3d45b6['id']||0x0;this[_0x99a6('0x0')]=_0x3d45b6[_0x99a6('0x0')]||'';this[_0x99a6('0x1')]=_0x3d45b6[_0x99a6('0x1')]||'';this[_0x99a6('0x2')]=_0x3d45b6[_0x99a6('0x2')]||'';this[_0x99a6('0x3')]=_0x3d45b6[_0x99a6('0x3')]||'';this[_0x99a6('0x4')]=_0x3d45b6['clientId']||'';this[_0x99a6('0x5')]=_0x3d45b6[_0x99a6('0x5')]||'';this['securityToken']=_0x3d45b6['securityToken']||'';this[_0x99a6('0x6')]=_0x3d45b6[_0x99a6('0x6')]||_0x99a6('0x7');this[_0x99a6('0x8')]=_0x3d45b6[_0x99a6('0x8')]||'';this[_0x99a6('0x9')]=_0x3d45b6['Configurations']||{};}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 e400e22..e9fddd3 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 _0xf585=['name','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x4b2169,_0x414264){var _0x4f05b7=function(_0x567606){while(--_0x567606){_0x4b2169['push'](_0x4b2169['shift']());}};_0x4f05b7(++_0x414264);}(_0xf585,0x6c));var _0x5f58=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xf585[_0x5f1391];return _0x50ebe3;};'use strict';function ServicenowAccount(_0x1a5971){this['id']=_0x1a5971['id']||0x0;this[_0x5f58('0x0')]=_0x1a5971['name']||'';this['username']=_0x1a5971['username']||'';this[_0x5f58('0x1')]=_0x1a5971[_0x5f58('0x1')]||'';this[_0x5f58('0x2')]=_0x1a5971['remoteUri']||'';this['serverUrl']=_0x1a5971[_0x5f58('0x3')]||'';this[_0x5f58('0x4')]=_0x1a5971[_0x5f58('0x4')]||{};}module[_0x5f58('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x897f=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x897f,0x12d));var _0xf897=function(_0x279e6f,_0x566574){_0x279e6f=_0x279e6f-0x0;var _0x489a5f=_0x897f[_0x279e6f];return _0x489a5f;};'use strict';function ServicenowAccount(_0x5ba042){this['id']=_0x5ba042['id']||0x0;this[_0xf897('0x0')]=_0x5ba042['name']||'';this['username']=_0x5ba042[_0xf897('0x1')]||'';this[_0xf897('0x2')]=_0x5ba042[_0xf897('0x2')]||'';this[_0xf897('0x3')]=_0x5ba042['remoteUri']||'';this[_0xf897('0x4')]=_0x5ba042[_0xf897('0x4')]||'';this[_0xf897('0x5')]=_0x5ba042[_0xf897('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 90f175e..e93a469 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 _0xd859=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0xf98dc2,_0x5ded80){var _0x16c48a=function(_0xd1da21){while(--_0xd1da21){_0xf98dc2['push'](_0xf98dc2['shift']());}};_0x16c48a(++_0x5ded80);}(_0xd859,0x189));var _0x9d85=function(_0x11e1ab,_0x4bb093){_0x11e1ab=_0x11e1ab-0x0;var _0x530ca0=_0xd859[_0x11e1ab];return _0x530ca0;};'use strict';function SugarcrmAccount(_0xfba058){this['id']=_0xfba058['id']||0x0;this['name']=_0xfba058[_0x9d85('0x0')]||'';this[_0x9d85('0x1')]=_0xfba058[_0x9d85('0x1')]||'';this['password']=_0xfba058[_0x9d85('0x2')]||'';this[_0x9d85('0x3')]=_0xfba058[_0x9d85('0x3')]||'';this[_0x9d85('0x4')]=_0xfba058[_0x9d85('0x4')]||'';this[_0x9d85('0x5')]=_0xfba058['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xa7c4=['name','username','password','serverUrl','Configurations','exports'];(function(_0x1910c8,_0x2c13c6){var _0x335da0=function(_0x4b6332){while(--_0x4b6332){_0x1910c8['push'](_0x1910c8['shift']());}};_0x335da0(++_0x2c13c6);}(_0xa7c4,0x1b0));var _0x4a7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7c4[_0x3dd15e];return _0x231fd0;};'use strict';function SugarcrmAccount(_0x4edc78){this['id']=_0x4edc78['id']||0x0;this[_0x4a7c('0x0')]=_0x4edc78[_0x4a7c('0x0')]||'';this[_0x4a7c('0x1')]=_0x4edc78['username']||'';this[_0x4a7c('0x2')]=_0x4edc78[_0x4a7c('0x2')]||'';this['remoteUri']=_0x4edc78['remoteUri']||'';this[_0x4a7c('0x3')]=_0x4edc78[_0x4a7c('0x3')]||'';this[_0x4a7c('0x4')]=_0x4edc78[_0x4a7c('0x4')]||{};}module[_0x4a7c('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 97ed068..7084578 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 _0xbefc=['unknown','stateTime','status','address','exports','name','accountcode','state'];(function(_0x120756,_0x4a925d){var _0x117828=function(_0x12a4a8){while(--_0x12a4a8){_0x120756['push'](_0x120756['shift']());}};_0x117828(++_0x4a925d);}(_0xbefc,0x195));var _0xcbef=function(_0x4f4ef8,_0x296898){_0x4f4ef8=_0x4f4ef8-0x0;var _0x545b1d=_0xbefc[_0x4f4ef8];return _0x545b1d;};'use strict';function Telephone(_0x3672e9){this['id']=_0x3672e9['id']||0x0;this[_0xcbef('0x0')]=_0x3672e9[_0xcbef('0x0')]||'';this[_0xcbef('0x1')]=_0x3672e9[_0xcbef('0x1')]||'';this[_0xcbef('0x2')]=_0xcbef('0x3');this[_0xcbef('0x4')]=0x0;this[_0xcbef('0x5')]=_0xcbef('0x3');this[_0xcbef('0x6')]='';}module[_0xcbef('0x7')]=Telephone; \ No newline at end of file +var _0xa68c=['accountcode','state','unknown','stateTime','status','exports','name'];(function(_0x40bded,_0x379ee1){var _0x2ea61f=function(_0x29e75f){while(--_0x29e75f){_0x40bded['push'](_0x40bded['shift']());}};_0x2ea61f(++_0x379ee1);}(_0xa68c,0x187));var _0xca68=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa68c[_0x3b380d];return _0x54502b;};'use strict';function Telephone(_0x542521){this['id']=_0x542521['id']||0x0;this[_0xca68('0x0')]=_0x542521[_0xca68('0x0')]||'';this[_0xca68('0x1')]=_0x542521[_0xca68('0x1')]||'';this[_0xca68('0x2')]=_0xca68('0x3');this[_0xca68('0x4')]=0x0;this[_0xca68('0x5')]='unknown';this['address']='';}module[_0xca68('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 2873949..f314a28 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x5cfbf1,_0x2b992d){var _0xe2bf34=function(_0x149194){while(--_0x149194){_0x5cfbf1['push'](_0x5cfbf1['shift']());}};_0xe2bf34(++_0x2b992d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x4b4717,_0x12a287){var _0x15b0d2=function(_0x66602){while(--_0x66602){_0x4b4717['push'](_0x4b4717['shift']());}};_0x15b0d2(++_0x12a287);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 4b382c4..b1d90d4 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 _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x3f676a,_0x1215c2){var _0x2e4cee=function(_0x2719fa){while(--_0x2719fa){_0x3f676a['push'](_0x3f676a['shift']());}};_0x2e4cee(++_0x1215c2);}(_0xda3f,0xec));var _0xfda3=function(_0x35bdab,_0x311305){_0x35bdab=_0x35bdab-0x0;var _0x38ab37=_0xda3f[_0x35bdab];return _0x38ab37;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 19f1726..b8d6161 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 _0x834c=['stateTime','registry','indexOf','split','host','port','domainport','refresh','stateRegistry','address','defaultuser','exports','active','name','state','unknown'];(function(_0x5d168d,_0xe112d5){var _0x49b587=function(_0x31b729){while(--_0x31b729){_0x5d168d['push'](_0x5d168d['shift']());}};_0x49b587(++_0xe112d5);}(_0x834c,0x8c));var _0xc834=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0x834c[_0x4d45c1];return _0x244478;};'use strict';function Trunk(_0x3cfcf1){this['id']=_0x3cfcf1['id']||0x0;this[_0xc834('0x0')]=_0x3cfcf1[_0xc834('0x0')]||![];this[_0xc834('0x1')]=_0x3cfcf1['name']||'';this[_0xc834('0x2')]=_0xc834('0x3');this[_0xc834('0x4')]=0x0;this['status']=_0xc834('0x3');this[_0xc834('0x5')]=_0x3cfcf1['registry']&&_0x3cfcf1[_0xc834('0x5')][_0xc834('0x6')](':')?_0x3cfcf1['registry'][_0xc834('0x7')](':')[0x0]:'';this[_0xc834('0x8')]='';this[_0xc834('0x9')]='';this['domain']='';this[_0xc834('0xa')]='';this[_0xc834('0xb')]='';this[_0xc834('0xc')]=_0xc834('0x3');this['registrationtime']='';this[_0xc834('0xd')]='';this[_0xc834('0xe')]=_0x3cfcf1[_0xc834('0xe')]||'';}module[_0xc834('0xf')]=Trunk; \ No newline at end of file +var _0x1458=['stateRegistry','registrationtime','defaultuser','exports','active','name','state','unknown','stateTime','registry','indexOf','split','host','port','domain','refresh'];(function(_0x97f96f,_0x1a3d1b){var _0x41af19=function(_0x4cc24f){while(--_0x4cc24f){_0x97f96f['push'](_0x97f96f['shift']());}};_0x41af19(++_0x1a3d1b);}(_0x1458,0x144));var _0x8145=function(_0x4ff41c,_0x483c21){_0x4ff41c=_0x4ff41c-0x0;var _0x275644=_0x1458[_0x4ff41c];return _0x275644;};'use strict';function Trunk(_0x334e3c){this['id']=_0x334e3c['id']||0x0;this[_0x8145('0x0')]=_0x334e3c['active']||![];this['name']=_0x334e3c[_0x8145('0x1')]||'';this[_0x8145('0x2')]=_0x8145('0x3');this[_0x8145('0x4')]=0x0;this['status']='unknown';this[_0x8145('0x5')]=_0x334e3c[_0x8145('0x5')]&&_0x334e3c['registry'][_0x8145('0x6')](':')?_0x334e3c[_0x8145('0x5')][_0x8145('0x7')](':')[0x0]:'';this[_0x8145('0x8')]='';this[_0x8145('0x9')]='';this[_0x8145('0xa')]='';this['domainport']='';this[_0x8145('0xb')]='';this[_0x8145('0xc')]=_0x8145('0x3');this[_0x8145('0xd')]='';this['address']='';this[_0x8145('0xe')]=_0x334e3c[_0x8145('0xe')]||'';}module[_0x8145('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index f24c50e..3c0b9aa 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 _0x50de=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x5d3c37,_0x18da5b){var _0x345566=function(_0x187cad){while(--_0x187cad){_0x5d3c37['push'](_0x5d3c37['shift']());}};_0x345566(++_0x18da5b);}(_0x50de,0xe8));var _0xe50d=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0x50de[_0x2a0738];return _0x159679;};'use strict';function voiceExtension(_0xe94306){this['id']=_0xe94306['id']||0x0;this[_0xe50d('0x0')]=_0xe94306[_0xe50d('0x0')]||'';this[_0xe50d('0x1')]=_0xe94306[_0xe50d('0x1')]||_0xe50d('0x2');this[_0xe50d('0x3')]=_0xe94306[_0xe50d('0x3')]||![];}module[_0xe50d('0x4')]=voiceExtension; \ No newline at end of file +var _0x7459=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x48c5ee,_0x293504){var _0xb039b=function(_0x5e47f6){while(--_0x5e47f6){_0x48c5ee['push'](_0x48c5ee['shift']());}};_0xb039b(++_0x293504);}(_0x7459,0x173));var _0x9745=function(_0x3dd67,_0xdef602){_0x3dd67=_0x3dd67-0x0;var _0x2b33ea=_0x7459[_0x3dd67];return _0x2b33ea;};'use strict';function voiceExtension(_0x59d506){this['id']=_0x59d506['id']||0x0;this[_0x9745('0x0')]=_0x59d506[_0x9745('0x0')]||'';this[_0x9745('0x1')]=_0x59d506['recordingFormat']||_0x9745('0x2');this['mandatoryDisposition']=_0x59d506[_0x9745('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 79dfb02..774435d 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 _0xc21c=['rrordered','wrandom','name','monitor_format','type','inbound','total','sumDuration','sumBillable','unmanaged','busy','inUse','loggedIn','onHold','paused','ringing','talking','unknown','acw','acwTimeout','autopause','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','linear','random','roundrobin','rrmemory'];(function(_0x423ace,_0x5a486e){var _0x487e0b=function(_0x45a8ad){while(--_0x45a8ad){_0x423ace['push'](_0x423ace['shift']());}};_0x487e0b(++_0x5a486e);}(_0xc21c,0x166));var _0xcc21=function(_0x1248dd,_0x80a640){_0x1248dd=_0x1248dd-0x0;var _0x3e079f=_0xc21c[_0x1248dd];return _0x3e079f;};'use strict';var monitorFormat={'wav':_0xcc21('0x0'),'wav49':_0xcc21('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0xcc21('0x2'),'leastrecent':_0xcc21('0x3'),'linear':_0xcc21('0x4'),'random':_0xcc21('0x5'),'ringall':'ringall','rr':_0xcc21('0x6'),'rrmemory':_0xcc21('0x7'),'rrordered':_0xcc21('0x8'),'wrandom':_0xcc21('0x9')};function VoiceQueue(_0x1ff108){this['id']=_0x1ff108['id']||0x0;this[_0xcc21('0xa')]=_0x1ff108[_0xcc21('0xa')]||'';this['monitor_format']=_0x1ff108[_0xcc21('0xb')]||'';this[_0xcc21('0xc')]=_0x1ff108[_0xcc21('0xc')]||_0xcc21('0xd');this['waiting']=0x0;this[_0xcc21('0xe')]=0x0;this['answered']=0x0;this[_0xcc21('0xf')]=0x0;this['sumHoldTime']=0x0;this[_0xcc21('0x10')]=0x0;this[_0xcc21('0x11')]=0x0;this['abandoned']=0x0;this['available']=0x0;this[_0xcc21('0x12')]=0x0;this[_0xcc21('0x13')]=0x0;this['invalid']=0x0;this[_0xcc21('0x14')]=0x0;this['notInUse']=0x0;this[_0xcc21('0x15')]=0x0;this[_0xcc21('0x16')]=0x0;this[_0xcc21('0x17')]=0x0;this['ringInUse']=0x0;this[_0xcc21('0x18')]=0x0;this['unavailable']=0x0;this[_0xcc21('0x19')]=0x0;this[_0xcc21('0x1a')]=_0x1ff108[_0xcc21('0x1a')]||![];this[_0xcc21('0x1b')]=_0x1ff108[_0xcc21('0x1b')]||0xa;this[_0xcc21('0x1c')]=_0x1ff108[_0xcc21('0x1c')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0xcc21('0x1d')]='';this['originated']=0x0;this[_0xcc21('0x1e')]=0x0;this[_0xcc21('0x1f')]=_0x1ff108[_0xcc21('0x1f')]||null;this[_0xcc21('0x20')]=_0x1ff108[_0xcc21('0x20')]?_0x1ff108['dialGlobalInterval']:null;this[_0xcc21('0x21')]=_0x1ff108[_0xcc21('0x21')];this[_0xcc21('0x22')]=_0x1ff108[_0xcc21('0x22')]||'progressive';this[_0xcc21('0x23')]=_0x1ff108[_0xcc21('0x23')]||0x0;this[_0xcc21('0x24')]=_0x1ff108[_0xcc21('0x24')]||0x0;this[_0xcc21('0x25')]=_0x1ff108['dialPowerLevel']||0x1;this[_0xcc21('0x26')]=_0x1ff108[_0xcc21('0x26')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x1ff108[_0xcc21('0x27')]||0.03;this['dialPredictiveInterval']=_0x1ff108[_0xcc21('0x28')]||0x258;this[_0xcc21('0x29')]=_0x1ff108[_0xcc21('0x29')]||_0xcc21('0x2a');this[_0xcc21('0x2b')]=_0x1ff108[_0xcc21('0x2b')]||'anonymous';this[_0xcc21('0x2c')]=_0x1ff108['dialOriginateTimeout']||0x1e;this[_0xcc21('0x2d')]=_0x1ff108[_0xcc21('0x2d')]||_0xcc21('0x2e');this[_0xcc21('0x2f')]=_0x1ff108['dialQueueTimeout']||0x3;this[_0xcc21('0x30')]=_0x1ff108['dialQueueProject']||undefined;this[_0xcc21('0x31')]=_0x1ff108[_0xcc21('0x31')]||0x3;this[_0xcc21('0x32')]=_0x1ff108[_0xcc21('0x32')]||0x96;this[_0xcc21('0x33')]=_0x1ff108[_0xcc21('0x33')]||0x3;this[_0xcc21('0x34')]=_0x1ff108[_0xcc21('0x34')]||0x96;this[_0xcc21('0x35')]=_0x1ff108[_0xcc21('0x35')]||0x3;this['dialNoAnswerRetryFrequency']=_0x1ff108[_0xcc21('0x36')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x1ff108[_0xcc21('0x37')]||0x3;this[_0xcc21('0x38')]=_0x1ff108[_0xcc21('0x38')]||0x96;this['dialDropMaxRetry']=_0x1ff108[_0xcc21('0x39')]||0x3;this['dialDropRetryFrequency']=_0x1ff108[_0xcc21('0x3a')]||0x96;this['dialAbandonedMaxRetry']=_0x1ff108['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x1ff108['dialAbandonedRetryFrequency']||0x96;this[_0xcc21('0x3b')]=_0x1ff108['dialMachineMaxRetry']||0x3;this[_0xcc21('0x3c')]=_0x1ff108['dialMachineRetryFrequency']||0x96;this[_0xcc21('0x3d')]=_0x1ff108[_0xcc21('0x3d')]||0x3;this[_0xcc21('0x3e')]=_0x1ff108['dialAgentRejectRetryFrequency']||0x96;this[_0xcc21('0x3f')]=_0x1ff108[_0xcc21('0x3f')]||0x3;this[_0xcc21('0x40')]=_0x1ff108[_0xcc21('0x40')]||0x4;this['Trunk']=_0x1ff108['Trunk']?_0x1ff108[_0xcc21('0x41')]:undefined;this['TrunkBackup']=_0x1ff108[_0xcc21('0x42')]?_0x1ff108[_0xcc21('0x42')]:undefined;this[_0xcc21('0x43')]=_0x1ff108['dialPrefix']||undefined;this[_0xcc21('0x44')]=_0x1ff108['Interval']?_0x1ff108['Interval']:undefined;this[_0xcc21('0x45')]=_0x1ff108[_0xcc21('0x45')]||'DESC';this[_0xcc21('0x46')]=_0x1ff108[_0xcc21('0x46')]||undefined;this[_0xcc21('0x47')]=_0x1ff108[_0xcc21('0x47')]||undefined;this[_0xcc21('0x48')]=strategy[_0x1ff108[_0xcc21('0x48')]];this['queueStatusComplete']=!![];this[_0xcc21('0x49')]=_0x1ff108[_0xcc21('0x49')]||![];this[_0xcc21('0x4a')]=_0x1ff108[_0xcc21('0x4a')];this[_0xcc21('0x4b')]=_0x1ff108['dialAMDGreeting'];this[_0xcc21('0x4c')]=_0x1ff108[_0xcc21('0x4c')];this[_0xcc21('0x4d')]=_0x1ff108['dialAMDTotalAnalysisTime'];this[_0xcc21('0x4e')]=_0x1ff108[_0xcc21('0x4e')];this[_0xcc21('0x4f')]=_0x1ff108[_0xcc21('0x4f')];this['dialAMDMaximumNumberOfWords']=_0x1ff108['dialAMDMaximumNumberOfWords'];this[_0xcc21('0x50')]=_0x1ff108[_0xcc21('0x50')];this['dialAMDMaximumWordLength']=_0x1ff108[_0xcc21('0x51')];this[_0xcc21('0x52')]=0x0;this[_0xcc21('0x53')]=0x0;this[_0xcc21('0x54')]=_0x1ff108[_0xcc21('0x54')];this[_0xcc21('0x55')]=0x0;this[_0xcc21('0x56')]=0x0;this[_0xcc21('0x57')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xcc21('0x58')]=0x0;this[_0xcc21('0x59')]=0x0;this[_0xcc21('0x5a')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xcc21('0x5b')]=0x0;this[_0xcc21('0x5c')]=0x0;this[_0xcc21('0x5d')]=0x0;this[_0xcc21('0x5e')]=0x0;this[_0xcc21('0x5f')]=undefined;this['startPredictive']=undefined;this[_0xcc21('0x60')]=undefined;this[_0xcc21('0x61')]=1.05;this[_0xcc21('0x62')]=0x0;this[_0xcc21('0x63')]=0x0;this[_0xcc21('0x64')]=0x0;this[_0xcc21('0x65')]=0x0;this[_0xcc21('0x66')]=0x0;this[_0xcc21('0x67')]=0x0;this[_0xcc21('0x68')]=0x0;this[_0xcc21('0x69')]=0x0;this[_0xcc21('0x6a')]=_0x1ff108[_0xcc21('0x6b')]||0x14;this['predictiveIntervalMinThreshold']=_0x1ff108['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xcc21('0x6c')]=0x0;this[_0xcc21('0x6d')]=0x1;this[_0xcc21('0x6e')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0xcc21('0x6f')]=_0x1ff108[_0xcc21('0x6f')]||0x1e;this[_0xcc21('0x70')]=_0x1ff108[_0xcc21('0x70')]||![];this[_0xcc21('0x71')]=!!_0x1ff108[_0xcc21('0x71')]||![];this[_0xcc21('0x72')]=!!_0x1ff108['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x1ff108[_0xcc21('0x73')]||undefined;this[_0xcc21('0x74')]=_0x1ff108[_0xcc21('0x74')]||![];this['dialAgiAfterHangupAgent']=_0x1ff108[_0xcc21('0x75')]||![];this[_0xcc21('0xb')]=monitorFormat[_0x1ff108[_0xcc21('0xb')]]?monitorFormat[_0x1ff108[_0xcc21('0xb')]]:undefined;this['mandatoryDisposition']=_0x1ff108[_0xcc21('0x76')]||![];this[_0xcc21('0x77')]=_0x1ff108[_0xcc21('0x77')]?_0x1ff108[_0xcc21('0x77')]:undefined;this[_0xcc21('0x78')]=![];}module[_0xcc21('0x79')]=VoiceQueue; \ No newline at end of file +var _0xbcba=['abandoned','available','busy','inUse','invalid','loggedIn','notInUse','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','linear','random','ringall','roundrobin','wrandom','monitor_format','inbound','total','answered','sumDuration','sumHoldTime','unmanaged'];(function(_0x3ec74e,_0x2f6536){var _0x5a53f9=function(_0x461459){while(--_0x461459){_0x3ec74e['push'](_0x3ec74e['shift']());}};_0x5a53f9(++_0x2f6536);}(_0xbcba,0x6d));var _0xabcb=function(_0x21eb86,_0x10141a){_0x21eb86=_0x21eb86-0x0;var _0x33924a=_0xbcba[_0x21eb86];return _0x33924a;};'use strict';var monitorFormat={'wav':_0xabcb('0x0'),'wav49':_0xabcb('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0xabcb('0x2'),'leastrecent':_0xabcb('0x3'),'linear':_0xabcb('0x4'),'random':_0xabcb('0x5'),'ringall':_0xabcb('0x6'),'rr':_0xabcb('0x7'),'rrmemory':'rrmemory','rrordered':'rrordered','wrandom':_0xabcb('0x8')};function VoiceQueue(_0x1290b2){this['id']=_0x1290b2['id']||0x0;this['name']=_0x1290b2['name']||'';this[_0xabcb('0x9')]=_0x1290b2[_0xabcb('0x9')]||'';this['type']=_0x1290b2['type']||_0xabcb('0xa');this['waiting']=0x0;this[_0xabcb('0xb')]=0x0;this[_0xabcb('0xc')]=0x0;this[_0xabcb('0xd')]=0x0;this[_0xabcb('0xe')]=0x0;this['sumBillable']=0x0;this[_0xabcb('0xf')]=0x0;this[_0xabcb('0x10')]=0x0;this[_0xabcb('0x11')]=0x0;this[_0xabcb('0x12')]=0x0;this[_0xabcb('0x13')]=0x0;this[_0xabcb('0x14')]=0x0;this[_0xabcb('0x15')]=0x0;this[_0xabcb('0x16')]=0x0;this['onHold']=0x0;this[_0xabcb('0x17')]=0x0;this[_0xabcb('0x18')]=0x0;this[_0xabcb('0x19')]=0x0;this[_0xabcb('0x1a')]=0x0;this[_0xabcb('0x1b')]=0x0;this[_0xabcb('0x1c')]=0x0;this['acw']=_0x1290b2[_0xabcb('0x1d')]||![];this[_0xabcb('0x1e')]=_0x1290b2[_0xabcb('0x1e')]||0xa;this[_0xabcb('0x1f')]=_0x1290b2[_0xabcb('0x1f')]||'no';this[_0xabcb('0x20')]=!![];this[_0xabcb('0x21')]='';this[_0xabcb('0x22')]='';this[_0xabcb('0x23')]=0x0;this[_0xabcb('0x24')]=0x0;this['dialTimezone']=_0x1290b2[_0xabcb('0x25')]||null;this[_0xabcb('0x26')]=_0x1290b2[_0xabcb('0x26')]?_0x1290b2[_0xabcb('0x26')]:null;this[_0xabcb('0x27')]=_0x1290b2[_0xabcb('0x27')];this[_0xabcb('0x28')]=_0x1290b2[_0xabcb('0x28')]||_0xabcb('0x29');this[_0xabcb('0x2a')]=_0x1290b2[_0xabcb('0x2a')]||0x0;this[_0xabcb('0x2b')]=_0x1290b2[_0xabcb('0x2b')]||0x0;this[_0xabcb('0x2c')]=_0x1290b2['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x1290b2['dialPredictiveOptimization']||_0xabcb('0x2d');this[_0xabcb('0x2e')]=_0x1290b2[_0xabcb('0x2e')]||0.03;this[_0xabcb('0x2f')]=_0x1290b2[_0xabcb('0x2f')]||0x258;this['dialOriginateCallerIdName']=_0x1290b2[_0xabcb('0x30')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x1290b2[_0xabcb('0x31')]||_0xabcb('0x32');this[_0xabcb('0x33')]=_0x1290b2[_0xabcb('0x33')]||0x1e;this['dialQueueOptions']=_0x1290b2[_0xabcb('0x34')]||_0xabcb('0x35');this[_0xabcb('0x36')]=_0x1290b2[_0xabcb('0x36')]||0x3;this['dialQueueProject']=_0x1290b2[_0xabcb('0x37')]||undefined;this[_0xabcb('0x38')]=_0x1290b2['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x1290b2[_0xabcb('0x39')]||0x96;this['dialBusyMaxRetry']=_0x1290b2[_0xabcb('0x3a')]||0x3;this[_0xabcb('0x3b')]=_0x1290b2[_0xabcb('0x3b')]||0x96;this[_0xabcb('0x3c')]=_0x1290b2[_0xabcb('0x3c')]||0x3;this[_0xabcb('0x3d')]=_0x1290b2[_0xabcb('0x3d')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x1290b2['dialNoSuchNumberMaxRetry']||0x3;this[_0xabcb('0x3e')]=_0x1290b2[_0xabcb('0x3e')]||0x96;this['dialDropMaxRetry']=_0x1290b2[_0xabcb('0x3f')]||0x3;this[_0xabcb('0x40')]=_0x1290b2[_0xabcb('0x40')]||0x96;this[_0xabcb('0x41')]=_0x1290b2[_0xabcb('0x41')]||0x3;this[_0xabcb('0x42')]=_0x1290b2['dialAbandonedRetryFrequency']||0x96;this[_0xabcb('0x43')]=_0x1290b2[_0xabcb('0x43')]||0x3;this['dialMachineRetryFrequency']=_0x1290b2[_0xabcb('0x44')]||0x96;this[_0xabcb('0x45')]=_0x1290b2['dialAgentRejectMaxRetry']||0x3;this[_0xabcb('0x46')]=_0x1290b2[_0xabcb('0x46')]||0x96;this['callAdditionalPhoneAfterMin']=_0x1290b2['callAdditionalPhoneAfterMin']||0x3;this[_0xabcb('0x47')]=_0x1290b2['dialGlobalMaxRetry']||0x4;this[_0xabcb('0x48')]=_0x1290b2['Trunk']?_0x1290b2['Trunk']:undefined;this['TrunkBackup']=_0x1290b2[_0xabcb('0x49')]?_0x1290b2[_0xabcb('0x49')]:undefined;this[_0xabcb('0x4a')]=_0x1290b2['dialPrefix']||undefined;this[_0xabcb('0x4b')]=_0x1290b2[_0xabcb('0x4b')]?_0x1290b2[_0xabcb('0x4b')]:undefined;this[_0xabcb('0x4c')]=_0x1290b2['dialOrderByScheduledAt']||'DESC';this[_0xabcb('0x4d')]=_0x1290b2[_0xabcb('0x4d')]||undefined;this['dialCutDigit']=_0x1290b2[_0xabcb('0x4e')]||undefined;this[_0xabcb('0x4f')]=strategy[_0x1290b2[_0xabcb('0x4f')]];this['queueStatusComplete']=!![];this[_0xabcb('0x50')]=_0x1290b2[_0xabcb('0x50')]||![];this[_0xabcb('0x51')]=_0x1290b2['dialAMDInitialSilence'];this[_0xabcb('0x52')]=_0x1290b2[_0xabcb('0x52')];this[_0xabcb('0x53')]=_0x1290b2['dialAMDAfterGreetingSilence'];this[_0xabcb('0x54')]=_0x1290b2[_0xabcb('0x54')];this[_0xabcb('0x55')]=_0x1290b2[_0xabcb('0x55')];this[_0xabcb('0x56')]=_0x1290b2['dialAMDBetweenWordsSilence'];this[_0xabcb('0x57')]=_0x1290b2[_0xabcb('0x57')];this[_0xabcb('0x58')]=_0x1290b2[_0xabcb('0x58')];this[_0xabcb('0x59')]=_0x1290b2['dialAMDMaximumWordLength'];this[_0xabcb('0x5a')]=0x0;this[_0xabcb('0x5b')]=0x0;this[_0xabcb('0x5c')]=_0x1290b2[_0xabcb('0x5c')];this[_0xabcb('0x5d')]=0x0;this[_0xabcb('0x5e')]=0x0;this[_0xabcb('0x5f')]=0x0;this[_0xabcb('0x60')]=0x0;this[_0xabcb('0x61')]=0x0;this[_0xabcb('0x62')]=0x0;this[_0xabcb('0x63')]=0x0;this[_0xabcb('0x64')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xabcb('0x65')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xabcb('0x66')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0xabcb('0x67')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xabcb('0x68')]=0x0;this[_0xabcb('0x69')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xabcb('0x6a')]=0x0;this[_0xabcb('0x6b')]=0x0;this[_0xabcb('0x6c')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x1290b2[_0xabcb('0x6d')]||0x14;this[_0xabcb('0x6e')]=_0x1290b2[_0xabcb('0x6d')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xabcb('0x6f')]=0x0;this['erlangCallToSecond']=0x0;this[_0xabcb('0x70')]=0x0;this[_0xabcb('0x71')]=0x0;this[_0xabcb('0x72')]=_0x1290b2['dialRecallMeTimeout']||0x1e;this[_0xabcb('0x73')]=_0x1290b2['dialRecallInQueue']||![];this[_0xabcb('0x74')]=!!_0x1290b2['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x1290b2[_0xabcb('0x75')]||![];this[_0xabcb('0x76')]=_0x1290b2[_0xabcb('0x76')]||undefined;this['dialAgiAfterHangupClient']=_0x1290b2[_0xabcb('0x77')]||![];this[_0xabcb('0x78')]=_0x1290b2['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x1290b2[_0xabcb('0x9')]]?monitorFormat[_0x1290b2[_0xabcb('0x9')]]:undefined;this[_0xabcb('0x79')]=_0x1290b2['mandatoryDisposition']||![];this[_0xabcb('0x7a')]=_0x1290b2[_0xabcb('0x7a')]?_0x1290b2[_0xabcb('0x7a')]:undefined;this[_0xabcb('0x7b')]=![];}module[_0xabcb('0x7c')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 899dfc3..e26a9fc 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','status','queue','dialer','exten','xcally-motion-preview','some','compareToOutboundQueue','message','statusMessage','updateReportFromOutboundQueue','outboundUnknownCallsDay','exports','available','loggedIn','talking','waiting','answered','inUse','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','paused','pTalking','sumBillable','sumDuration','total','name','abandoned','busy','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];(function(_0x3662b6,_0xeffc6e){var _0x1f726a=function(_0x3b1fcc){while(--_0x3b1fcc){_0x3662b6['push'](_0x3662b6['shift']());}};_0x1f726a(++_0xeffc6e);}(_0x55ca,0x126));var _0xa55c=function(_0x5d1594,_0x105585){_0x5d1594=_0x5d1594-0x0;var _0x5c4153=_0x55ca[_0x5d1594];return _0x5c4153;};'use strict';var INBOUND_COUNTERS=[_0xa55c('0x0'),_0xa55c('0x1'),'loggedInDb','paused','ringing',_0xa55c('0x2'),_0xa55c('0x3')];var OUTBOUND_COUNTERS=['available',_0xa55c('0x4'),_0xa55c('0x5'),_0xa55c('0x1'),_0xa55c('0x6'),_0xa55c('0x7'),_0xa55c('0x8'),_0xa55c('0x9'),'outboundBlacklistCallsDay',_0xa55c('0xa'),_0xa55c('0xb'),'outboundNoAnswerCallsDay',_0xa55c('0xc'),_0xa55c('0xd'),'outboundRejectCallsDay','outboundUnknownCallsDay',_0xa55c('0xe'),_0xa55c('0xf'),_0xa55c('0x2'),_0xa55c('0x10'),_0xa55c('0x11'),_0xa55c('0x12'),_0xa55c('0x3')];function VoiceQueueSummary(_0x70c2de){this['id']=_0x70c2de['id'];this[_0xa55c('0x13')]=_0x70c2de[_0xa55c('0x13')];this['strategy']=_0x70c2de['strategy'];this[_0xa55c('0x14')]=_0x70c2de['abandoned']||0x0;this['answered']=_0x70c2de['answered']||0x0;this[_0xa55c('0x0')]=_0x70c2de[_0xa55c('0x0')]||0x0;this[_0xa55c('0x15')]=_0x70c2de[_0xa55c('0x15')]||0x0;this[_0xa55c('0x5')]=_0x70c2de[_0xa55c('0x5')]||0x0;this['invalid']=_0x70c2de[_0xa55c('0x16')]||0x0;this[_0xa55c('0x1')]=_0x70c2de[_0xa55c('0x1')]||0x0;this[_0xa55c('0x6')]=_0x70c2de[_0xa55c('0x6')]||0x0;this[_0xa55c('0x17')]=_0x70c2de[_0xa55c('0x17')]||0x0;this[_0xa55c('0x18')]=_0x70c2de[_0xa55c('0x18')]||0x0;this['paused']=_0x70c2de[_0xa55c('0xe')]||0x0;this[_0xa55c('0x19')]=_0x70c2de[_0xa55c('0x19')]||0x0;this[_0xa55c('0x1a')]=_0x70c2de[_0xa55c('0x1a')];this[_0xa55c('0x10')]=_0x70c2de['sumBillable'];this['sumDuration']=_0x70c2de[_0xa55c('0x11')];this[_0xa55c('0x1b')]=_0x70c2de[_0xa55c('0x1b')]||0x0;this['talking']=_0x70c2de[_0xa55c('0x2')]||0x0;this[_0xa55c('0x12')]=_0x70c2de['total']||0x0;this[_0xa55c('0x1c')]=_0x70c2de[_0xa55c('0x1c')];this[_0xa55c('0x1d')]=_0x70c2de[_0xa55c('0x1d')]||0x0;this[_0xa55c('0x1e')]=_0x70c2de['unknown']||0x0;this[_0xa55c('0x1f')]=_0x70c2de['unmanaged']||0x0;this['waiting']=_0x70c2de['waiting']||0x0;if(_0x70c2de[_0xa55c('0x1c')]==='outbound'){this[_0xa55c('0xf')]=_0x70c2de[_0xa55c('0xf')]||0x0;this[_0xa55c('0x20')]=_0x70c2de[_0xa55c('0x20')];this[_0xa55c('0x21')]=_0x70c2de[_0xa55c('0x21')];this[_0xa55c('0x22')]=_0x70c2de[_0xa55c('0x22')];this[_0xa55c('0x23')]=_0x70c2de[_0xa55c('0x23')];this[_0xa55c('0x24')]=_0x70c2de['dialOriginateTimeout'];this[_0xa55c('0x25')]=_0x70c2de[_0xa55c('0x25')];this[_0xa55c('0x26')]=_0x70c2de[_0xa55c('0x26')];this['outboundAnswerAgiCallsDay']=_0x70c2de[_0xa55c('0x27')];this[_0xa55c('0x9')]=_0x70c2de[_0xa55c('0x9')];this[_0xa55c('0x28')]=_0x70c2de[_0xa55c('0x28')];this[_0xa55c('0xa')]=_0x70c2de['outboundBusyCallsDay'];this[_0xa55c('0xb')]=_0x70c2de['outboundCongestionCallsDay'];this[_0xa55c('0x29')]=_0x70c2de[_0xa55c('0x29')];this[_0xa55c('0x2a')]=_0x70c2de[_0xa55c('0x2a')];this['outboundDropCallsDayTimeout']=_0x70c2de[_0xa55c('0x2b')];this[_0xa55c('0x2c')]=_0x70c2de[_0xa55c('0x2c')];this[_0xa55c('0xc')]=_0x70c2de[_0xa55c('0xc')];this[_0xa55c('0x2d')]=_0x70c2de[_0xa55c('0x2d')];this[_0xa55c('0xd')]=_0x70c2de[_0xa55c('0xd')];this[_0xa55c('0x2e')]=_0x70c2de[_0xa55c('0x2e')];this['outboundUnknownCallsDay']=_0x70c2de['outboundUnknownCallsDay'];this[_0xa55c('0x2f')]=_0x70c2de[_0xa55c('0x2f')];this['predictiveIntervalAvgHoldtime']=_0x70c2de[_0xa55c('0x30')];this[_0xa55c('0x31')]=_0x70c2de[_0xa55c('0x31')];this[_0xa55c('0x32')]=_0x70c2de[_0xa55c('0x32')];this[_0xa55c('0x33')]=_0x70c2de[_0xa55c('0x33')];this[_0xa55c('0x34')]=_0x70c2de[_0xa55c('0x34')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x70c2de['predictiveIntervalErlangCallsDroppedCalls'];this['predictiveIntervalHitRate']=_0x70c2de[_0xa55c('0x35')];this[_0xa55c('0x36')]=_0x70c2de[_0xa55c('0x36')];this['predictiveIntervalPauses']=_0x70c2de[_0xa55c('0x37')];this['predictiveIntervalAvailable']=_0x70c2de[_0xa55c('0x38')];this['predictiveIntervalTotalCalls']=_0x70c2de[_0xa55c('0x39')];this[_0xa55c('0x7')]=_0x70c2de[_0xa55c('0x7')];this['erlangCalls']=_0x70c2de[_0xa55c('0x3a')];this[_0xa55c('0x3b')]=_0x70c2de['erlangCallToSecond'];this[_0xa55c('0x3c')]=_0x70c2de[_0xa55c('0x3c')];this['erlangBusyFactor']=_0x70c2de['erlangBusyFactor'];this[_0xa55c('0x3d')]=_0x70c2de['startPredictive'];this[_0xa55c('0x3e')]=_0x70c2de[_0xa55c('0x3e')];this['message']=_0x70c2de['message'];this['statusMessage']=_0x70c2de['statusMessage'];}if(_0x70c2de[_0xa55c('0x3f')]){this[_0xa55c('0x3f')]={'id':_0x70c2de[_0xa55c('0x3f')]['id'],'name':_0x70c2de[_0xa55c('0x3f')][_0xa55c('0x13')],'active':_0x70c2de['Trunk'][_0xa55c('0x40')],'callerid':_0x70c2de[_0xa55c('0x3f')][_0xa55c('0x41')]};}}VoiceQueueSummary[_0xa55c('0x42')][_0xa55c('0x43')]=function(_0x23cef5,_0x554620,_0x386e34,_0x5ee63d){this['loggedInDb']=0x0;this[_0xa55c('0x2')]=0x0;this[_0xa55c('0xe')]=0x0;this['unknown']=0x0;this[_0xa55c('0x18')]=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0xa55c('0x16')]=0x0;this[_0xa55c('0x1d')]=0x0;this[_0xa55c('0x19')]=0x0;this['ringInUse']=0x0;this[_0xa55c('0x17')]=0x0;if(_0x386e34){if(_0x386e34[_0xa55c('0x0')]){this['available']=Number(_0x386e34[_0xa55c('0x0')]);}if(_0x386e34['loggedin']){this[_0xa55c('0x1')]=Number(_0x386e34[_0xa55c('0x44')]);}if(_0x386e34['callers']){this[_0xa55c('0x3')]=Number(_0x386e34[_0xa55c('0x45')]);}}for(var _0x5d834d=0x0;_0x5d834d<_0x23cef5[_0xa55c('0x46')];_0x5d834d++){var _0x187e09=_0x554620[_0xa55c('0x47')+_0x23cef5[_0x5d834d]['name']];if(_0x187e09&&_0x187e09[_0xa55c('0x48')]){this['loggedInDb']+=0x1;}if(_0x23cef5[_0x5d834d][_0xa55c('0x49')]==='1'){this[_0xa55c('0x2')]+=0x1;}if(_0x23cef5[_0x5d834d][_0xa55c('0xe')]==='1'&&!['2','7','8']['includes'](_0x23cef5[_0x5d834d][_0xa55c('0x4a')])){this[_0xa55c('0xe')]+=0x1;}switch(_0x23cef5[_0x5d834d]['status']){case'0':this[_0xa55c('0x1e')]+=0x1;break;case'1':this[_0xa55c('0x18')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xa55c('0x15')]+=0x1;break;case'4':this[_0xa55c('0x16')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xa55c('0x19')]+=0x1;break;case'7':this[_0xa55c('0x1a')]+=0x1;break;case'8':this[_0xa55c('0x17')]+=0x1;break;}}if(this[_0xa55c('0x21')]==='booked'){var _0x143989=Object['keys'](_0x5ee63d);for(var _0x2157d6=0x0;_0x2157d6<_0x143989[_0xa55c('0x46')];_0x2157d6++){var _0x194a79=_0x143989[_0x2157d6];var _0x4a7adc=_0x5ee63d[_0x194a79];if(_0x4a7adc[_0xa55c('0x4b')]===this[_0xa55c('0x13')]&&_0x4a7adc['type']===_0xa55c('0x4c')&&_0x4a7adc[_0xa55c('0x4d')]===_0xa55c('0x4e')){this[_0xa55c('0x2')]+=0x1;}}if(this[_0xa55c('0x2')]>this[_0xa55c('0x5')]){this[_0xa55c('0x2')]=this[_0xa55c('0x5')];}this[_0xa55c('0xf')]=0x0;}return this;};VoiceQueueSummary[_0xa55c('0x42')]['compareToInboundQueue']=function(_0x13e1d4){var _0x46e27d=![];if(_0x13e1d4){_0x46e27d=INBOUND_COUNTERS[_0xa55c('0x4f')](function(_0x4f73b6){return this[_0x4f73b6]!==_0x13e1d4[_0x4f73b6];},this);}return _0x46e27d;};VoiceQueueSummary[_0xa55c('0x42')][_0xa55c('0x50')]=function(_0x4f5ecd){var _0x21b760=![];var _0x4fa412=![];var _0x2b6a0e=![];if(_0x4f5ecd){_0x21b760=this[_0xa55c('0x21')]!==_0x4f5ecd[_0xa55c('0x21')]||this[_0xa55c('0x20')]!==_0x4f5ecd[_0xa55c('0x20')]||this['message']!==_0x4f5ecd[_0xa55c('0x51')]||this[_0xa55c('0x52')]!==_0x4f5ecd['statusMessage'];_0x4fa412=OUTBOUND_COUNTERS[_0xa55c('0x4f')](function(_0x2291e0){return this[_0x2291e0]!==_0x4f5ecd[_0x2291e0];},this);if(this[_0xa55c('0x3f')]&&_0x4f5ecd[_0xa55c('0x3f')]){_0x2b6a0e=this['Trunk']['name']!==_0x4f5ecd[_0xa55c('0x3f')][_0xa55c('0x13')]||this[_0xa55c('0x3f')][_0xa55c('0x40')]!==_0x4f5ecd['Trunk'][_0xa55c('0x40')];}}return _0x21b760||_0x4fa412||_0x2b6a0e;};VoiceQueueSummary['prototype'][_0xa55c('0x53')]=function(_0x437ced){this[_0xa55c('0x4')]=_0x437ced[_0xa55c('0x4')];this[_0xa55c('0x51')]=_0x437ced['message'];this[_0xa55c('0x52')]=_0x437ced['statusMessage'];this[_0xa55c('0x7')]=_0x437ced[_0xa55c('0x7')];this[_0xa55c('0x8')]=_0x437ced[_0xa55c('0x8')];this[_0xa55c('0x9')]=_0x437ced[_0xa55c('0x9')];this[_0xa55c('0x28')]=_0x437ced['outboundBlacklistCallsDay'];this[_0xa55c('0xa')]=_0x437ced[_0xa55c('0xa')];this[_0xa55c('0xb')]=_0x437ced[_0xa55c('0xb')];this[_0xa55c('0x2c')]=_0x437ced['outboundNoAnswerCallsDay'];this[_0xa55c('0xc')]=_0x437ced[_0xa55c('0xc')];this[_0xa55c('0xd')]=_0x437ced[_0xa55c('0xd')];this[_0xa55c('0x2e')]=_0x437ced['outboundRejectCallsDay'];this[_0xa55c('0x54')]=_0x437ced[_0xa55c('0x54')];this[_0xa55c('0x10')]=_0x437ced[_0xa55c('0x10')];this[_0xa55c('0x11')]=_0x437ced['sumDuration'];this[_0xa55c('0x12')]=_0x437ced['total'];if(this[_0xa55c('0x21')]==='preview'){this[_0xa55c('0xf')]=_0x437ced['pTalking'];}};module[_0xa55c('0x55')]=VoiceQueueSummary; \ No newline at end of file +var _0x00b3=['ringInUse','total','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','name','prototype','createReport','busy','loggedin','callers','length','SIP/','online','incall','includes','booked','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','active','updateReportFromOutboundQueue','preview','exports','available','paused','ringing','answered','inUse','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','talking','sumBillable','sumDuration','waiting','strategy','abandoned','invalid','loggedIn','onHold','notInUse'];(function(_0x422f01,_0x9fb359){var _0x115795=function(_0x989190){while(--_0x989190){_0x422f01['push'](_0x422f01['shift']());}};_0x115795(++_0x9fb359);}(_0x00b3,0x97));var _0x300b=function(_0xcaf859,_0x453a51){_0xcaf859=_0xcaf859-0x0;var _0x29ca3c=_0x00b3[_0xcaf859];return _0x29ca3c;};'use strict';var INBOUND_COUNTERS=[_0x300b('0x0'),'loggedIn','loggedInDb',_0x300b('0x1'),_0x300b('0x2'),'talking','waiting'];var OUTBOUND_COUNTERS=[_0x300b('0x0'),_0x300b('0x3'),_0x300b('0x4'),'loggedIn',_0x300b('0x5'),_0x300b('0x6'),_0x300b('0x7'),_0x300b('0x8'),_0x300b('0x9'),_0x300b('0xa'),_0x300b('0xb'),_0x300b('0xc'),_0x300b('0xd'),_0x300b('0xe'),_0x300b('0xf'),_0x300b('0x10'),_0x300b('0x1'),'pTalking',_0x300b('0x11'),_0x300b('0x12'),_0x300b('0x13'),'total',_0x300b('0x14')];function VoiceQueueSummary(_0x1ab63f){this['id']=_0x1ab63f['id'];this['name']=_0x1ab63f['name'];this[_0x300b('0x15')]=_0x1ab63f['strategy'];this[_0x300b('0x16')]=_0x1ab63f[_0x300b('0x16')]||0x0;this[_0x300b('0x3')]=_0x1ab63f[_0x300b('0x3')]||0x0;this[_0x300b('0x0')]=_0x1ab63f[_0x300b('0x0')]||0x0;this['busy']=_0x1ab63f['busy']||0x0;this[_0x300b('0x4')]=_0x1ab63f[_0x300b('0x4')]||0x0;this[_0x300b('0x17')]=_0x1ab63f[_0x300b('0x17')]||0x0;this[_0x300b('0x18')]=_0x1ab63f[_0x300b('0x18')]||0x0;this[_0x300b('0x5')]=_0x1ab63f[_0x300b('0x5')]||0x0;this['onHold']=_0x1ab63f[_0x300b('0x19')]||0x0;this[_0x300b('0x1a')]=_0x1ab63f['notInUse']||0x0;this[_0x300b('0x1')]=_0x1ab63f[_0x300b('0x1')]||0x0;this[_0x300b('0x2')]=_0x1ab63f[_0x300b('0x2')]||0x0;this['ringInUse']=_0x1ab63f[_0x300b('0x1b')];this[_0x300b('0x12')]=_0x1ab63f[_0x300b('0x12')];this[_0x300b('0x13')]=_0x1ab63f['sumDuration'];this['sumHoldTime']=_0x1ab63f['sumHoldTime']||0x0;this['talking']=_0x1ab63f[_0x300b('0x11')]||0x0;this[_0x300b('0x1c')]=_0x1ab63f[_0x300b('0x1c')]||0x0;this[_0x300b('0x1d')]=_0x1ab63f['type'];this[_0x300b('0x1e')]=_0x1ab63f[_0x300b('0x1e')]||0x0;this[_0x300b('0x1f')]=_0x1ab63f[_0x300b('0x1f')]||0x0;this[_0x300b('0x20')]=_0x1ab63f['unmanaged']||0x0;this[_0x300b('0x14')]=_0x1ab63f[_0x300b('0x14')]||0x0;if(_0x1ab63f[_0x300b('0x1d')]===_0x300b('0x21')){this[_0x300b('0x22')]=_0x1ab63f[_0x300b('0x22')]||0x0;this[_0x300b('0x23')]=_0x1ab63f[_0x300b('0x23')];this[_0x300b('0x24')]=_0x1ab63f['dialMethod'];this['dialOriginateCallerIdName']=_0x1ab63f[_0x300b('0x25')];this['dialOriginateCallerIdNumber']=_0x1ab63f[_0x300b('0x26')];this[_0x300b('0x27')]=_0x1ab63f[_0x300b('0x27')];this[_0x300b('0x28')]=_0x1ab63f['dialPrefix'];this[_0x300b('0x29')]=_0x1ab63f[_0x300b('0x29')];this['outboundAnswerAgiCallsDay']=_0x1ab63f[_0x300b('0x2a')];this[_0x300b('0x8')]=_0x1ab63f[_0x300b('0x8')];this[_0x300b('0x9')]=_0x1ab63f['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x1ab63f[_0x300b('0xa')];this[_0x300b('0xb')]=_0x1ab63f[_0x300b('0xb')];this['outboundDropCallsDayACS']=_0x1ab63f['outboundDropCallsDayACS'];this[_0x300b('0x2b')]=_0x1ab63f[_0x300b('0x2b')];this[_0x300b('0x2c')]=_0x1ab63f[_0x300b('0x2c')];this[_0x300b('0xc')]=_0x1ab63f[_0x300b('0xc')];this['outboundNoSuchCallsDay']=_0x1ab63f[_0x300b('0xd')];this[_0x300b('0x2d')]=_0x1ab63f[_0x300b('0x2d')];this[_0x300b('0xe')]=_0x1ab63f[_0x300b('0xe')];this['outboundRejectCallsDay']=_0x1ab63f['outboundRejectCallsDay'];this[_0x300b('0x10')]=_0x1ab63f[_0x300b('0x10')];this['predictiveIntervalAnsweredCalls']=_0x1ab63f[_0x300b('0x2e')];this[_0x300b('0x2f')]=_0x1ab63f['predictiveIntervalAvgHoldtime'];this[_0x300b('0x30')]=_0x1ab63f['predictiveIntervalAvgTalktime'];this[_0x300b('0x31')]=_0x1ab63f[_0x300b('0x31')];this['predictiveIntervalDroppedCallsTimeout']=_0x1ab63f[_0x300b('0x32')];this[_0x300b('0x33')]=_0x1ab63f[_0x300b('0x33')];this[_0x300b('0x34')]=_0x1ab63f[_0x300b('0x34')];this[_0x300b('0x35')]=_0x1ab63f[_0x300b('0x35')];this[_0x300b('0x36')]=_0x1ab63f[_0x300b('0x36')];this[_0x300b('0x37')]=_0x1ab63f[_0x300b('0x37')];this[_0x300b('0x38')]=_0x1ab63f['predictiveIntervalAvailable'];this[_0x300b('0x39')]=_0x1ab63f['predictiveIntervalTotalCalls'];this['originated']=_0x1ab63f[_0x300b('0x6')];this[_0x300b('0x3a')]=_0x1ab63f['erlangCalls'];this[_0x300b('0x3b')]=_0x1ab63f['erlangCallToSecond'];this[_0x300b('0x3c')]=_0x1ab63f[_0x300b('0x3c')];this['erlangBusyFactor']=_0x1ab63f[_0x300b('0x3d')];this[_0x300b('0x3e')]=_0x1ab63f[_0x300b('0x3e')];this[_0x300b('0x3f')]=_0x1ab63f[_0x300b('0x3f')];this[_0x300b('0x40')]=_0x1ab63f['message'];this[_0x300b('0x41')]=_0x1ab63f[_0x300b('0x41')];}if(_0x1ab63f[_0x300b('0x42')]){this['Trunk']={'id':_0x1ab63f['Trunk']['id'],'name':_0x1ab63f[_0x300b('0x42')][_0x300b('0x43')],'active':_0x1ab63f[_0x300b('0x42')]['active'],'callerid':_0x1ab63f[_0x300b('0x42')]['callerid']};}}VoiceQueueSummary[_0x300b('0x44')][_0x300b('0x45')]=function(_0x4ab488,_0x3ac962,_0x2151c1,_0x4d7314){this['loggedInDb']=0x0;this[_0x300b('0x11')]=0x0;this[_0x300b('0x1')]=0x0;this['unknown']=0x0;this[_0x300b('0x1a')]=0x0;this['inUse']=0x0;this[_0x300b('0x46')]=0x0;this[_0x300b('0x17')]=0x0;this[_0x300b('0x1e')]=0x0;this[_0x300b('0x2')]=0x0;this[_0x300b('0x1b')]=0x0;this[_0x300b('0x19')]=0x0;if(_0x2151c1){if(_0x2151c1['available']){this[_0x300b('0x0')]=Number(_0x2151c1[_0x300b('0x0')]);}if(_0x2151c1[_0x300b('0x47')]){this[_0x300b('0x18')]=Number(_0x2151c1[_0x300b('0x47')]);}if(_0x2151c1[_0x300b('0x48')]){this[_0x300b('0x14')]=Number(_0x2151c1['callers']);}}for(var _0x20261d=0x0;_0x20261d<_0x4ab488[_0x300b('0x49')];_0x20261d++){var _0x863365=_0x3ac962[_0x300b('0x4a')+_0x4ab488[_0x20261d]['name']];if(_0x863365&&_0x863365[_0x300b('0x4b')]){this[_0x300b('0x5')]+=0x1;}if(_0x4ab488[_0x20261d][_0x300b('0x4c')]==='1'){this[_0x300b('0x11')]+=0x1;}if(_0x4ab488[_0x20261d]['paused']==='1'&&!['2','7','8'][_0x300b('0x4d')](_0x4ab488[_0x20261d]['status'])){this['paused']+=0x1;}switch(_0x4ab488[_0x20261d]['status']){case'0':this[_0x300b('0x1f')]+=0x1;break;case'1':this[_0x300b('0x1a')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x300b('0x46')]+=0x1;break;case'4':this[_0x300b('0x17')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x300b('0x1b')]+=0x1;break;case'8':this[_0x300b('0x19')]+=0x1;break;}}if(this[_0x300b('0x24')]===_0x300b('0x4e')){var _0x574731=Object['keys'](_0x4d7314);for(var _0x58a114=0x0;_0x58a114<_0x574731['length'];_0x58a114++){var _0x2db2b7=_0x574731[_0x58a114];var _0x380cda=_0x4d7314[_0x2db2b7];if(_0x380cda[_0x300b('0x4f')]===this[_0x300b('0x43')]&&_0x380cda[_0x300b('0x1d')]===_0x300b('0x50')&&_0x380cda[_0x300b('0x51')]===_0x300b('0x52')){this['talking']+=0x1;}}if(this[_0x300b('0x11')]>this[_0x300b('0x4')]){this['talking']=this[_0x300b('0x4')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary['prototype'][_0x300b('0x53')]=function(_0x358616){var _0x5e6010=![];if(_0x358616){_0x5e6010=INBOUND_COUNTERS[_0x300b('0x54')](function(_0x33c352){return this[_0x33c352]!==_0x358616[_0x33c352];},this);}return _0x5e6010;};VoiceQueueSummary[_0x300b('0x44')]['compareToOutboundQueue']=function(_0xdb8d13){var _0x9250b=![];var _0x4f8536=![];var _0x18f4ee=![];if(_0xdb8d13){_0x9250b=this['dialMethod']!==_0xdb8d13[_0x300b('0x24')]||this[_0x300b('0x23')]!==_0xdb8d13[_0x300b('0x23')]||this[_0x300b('0x40')]!==_0xdb8d13['message']||this[_0x300b('0x41')]!==_0xdb8d13['statusMessage'];_0x4f8536=OUTBOUND_COUNTERS['some'](function(_0x3db941){return this[_0x3db941]!==_0xdb8d13[_0x3db941];},this);if(this[_0x300b('0x42')]&&_0xdb8d13[_0x300b('0x42')]){_0x18f4ee=this[_0x300b('0x42')]['name']!==_0xdb8d13['Trunk'][_0x300b('0x43')]||this['Trunk'][_0x300b('0x55')]!==_0xdb8d13[_0x300b('0x42')][_0x300b('0x55')];}}return _0x9250b||_0x4f8536||_0x18f4ee;};VoiceQueueSummary['prototype'][_0x300b('0x56')]=function(_0x3ce55f){this[_0x300b('0x3')]=_0x3ce55f['answered'];this[_0x300b('0x40')]=_0x3ce55f[_0x300b('0x40')];this[_0x300b('0x41')]=_0x3ce55f[_0x300b('0x41')];this['originated']=_0x3ce55f['originated'];this['outboundAbandonedCallsDay']=_0x3ce55f[_0x300b('0x7')];this['outboundAnswerCallsDay']=_0x3ce55f[_0x300b('0x8')];this['outboundBlacklistCallsDay']=_0x3ce55f[_0x300b('0x9')];this[_0x300b('0xa')]=_0x3ce55f['outboundBusyCallsDay'];this[_0x300b('0xb')]=_0x3ce55f[_0x300b('0xb')];this[_0x300b('0xc')]=_0x3ce55f[_0x300b('0xc')];this[_0x300b('0xd')]=_0x3ce55f[_0x300b('0xd')];this[_0x300b('0xe')]=_0x3ce55f['outboundReCallsDay'];this[_0x300b('0xf')]=_0x3ce55f[_0x300b('0xf')];this[_0x300b('0x10')]=_0x3ce55f[_0x300b('0x10')];this['sumBillable']=_0x3ce55f[_0x300b('0x12')];this[_0x300b('0x13')]=_0x3ce55f[_0x300b('0x13')];this[_0x300b('0x1c')]=_0x3ce55f[_0x300b('0x1c')];if(this[_0x300b('0x24')]===_0x300b('0x57')){this[_0x300b('0x22')]=_0x3ce55f[_0x300b('0x22')];}};module[_0x300b('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index e9058e4..ab489a0 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 _0x74ce=['Configurations','exports','name','accessKey','remoteUri','serverUrl'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x74ce,0x18e));var _0xe74c=function(_0x31f486,_0x8b89bd){_0x31f486=_0x31f486-0x0;var _0x1d2588=_0x74ce[_0x31f486];return _0x1d2588;};'use strict';function VtigerAccount(_0xd48ca0){this['id']=_0xd48ca0['id']||0x0;this[_0xe74c('0x0')]=_0xd48ca0[_0xe74c('0x0')]||'';this['username']=_0xd48ca0['username']||'';this[_0xe74c('0x1')]=_0xd48ca0[_0xe74c('0x1')]||'';this[_0xe74c('0x2')]=_0xd48ca0[_0xe74c('0x2')]||'';this[_0xe74c('0x3')]=_0xd48ca0['serverUrl']||'';this[_0xe74c('0x4')]=_0xd48ca0['Configurations']||{};}module[_0xe74c('0x5')]=VtigerAccount; \ No newline at end of file +var _0xd0fc=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xd0fc,0x1a3));var _0xcd0f=function(_0x4d6f07,_0xd498d3){_0x4d6f07=_0x4d6f07-0x0;var _0x5c23a4=_0xd0fc[_0x4d6f07];return _0x5c23a4;};'use strict';function VtigerAccount(_0x192eae){this['id']=_0x192eae['id']||0x0;this[_0xcd0f('0x0')]=_0x192eae[_0xcd0f('0x0')]||'';this[_0xcd0f('0x1')]=_0x192eae[_0xcd0f('0x1')]||'';this[_0xcd0f('0x2')]=_0x192eae[_0xcd0f('0x2')]||'';this[_0xcd0f('0x3')]=_0x192eae[_0xcd0f('0x3')]||'';this[_0xcd0f('0x4')]=_0x192eae[_0xcd0f('0x4')]||'';this[_0xcd0f('0x5')]=_0x192eae['Configurations']||{};}module[_0xcd0f('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index ca0449d..918c2d1 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 _0xd557=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0xd557,0xc2));var _0x7d55=function(_0x2773d1,_0x5475c2){_0x2773d1=_0x2773d1-0x0;var _0x2fb466=_0xd557[_0x2773d1];return _0x2fb466;};'use strict';function ZendeskAccount(_0x4960c9){this['id']=_0x4960c9['id']||0x0;this['name']=_0x4960c9[_0x7d55('0x0')]||'';this[_0x7d55('0x1')]=_0x4960c9[_0x7d55('0x1')]||'';this[_0x7d55('0x2')]=_0x4960c9['password']||'';this['token']=_0x4960c9[_0x7d55('0x3')]||'';this['remoteUri']=_0x4960c9[_0x7d55('0x4')]||'';this['authType']=_0x4960c9[_0x7d55('0x5')]||'';this[_0x7d55('0x6')]=_0x4960c9[_0x7d55('0x6')]||_0x7d55('0x7');this[_0x7d55('0x8')]=_0x4960c9[_0x7d55('0x8')]||'';this[_0x7d55('0x9')]=_0x4960c9[_0x7d55('0x9')]||{};}module[_0x7d55('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x24cd=['token','remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x9e54b5,_0x5c10ea){var _0x44dee2=function(_0x5e4a0c){while(--_0x5e4a0c){_0x9e54b5['push'](_0x9e54b5['shift']());}};_0x44dee2(++_0x5c10ea);}(_0x24cd,0xcf));var _0xd24c=function(_0x3fd1cd,_0x3dc978){_0x3fd1cd=_0x3fd1cd-0x0;var _0x40db2e=_0x24cd[_0x3fd1cd];return _0x40db2e;};'use strict';function ZendeskAccount(_0x3afc67){this['id']=_0x3afc67['id']||0x0;this['name']=_0x3afc67[_0xd24c('0x0')]||'';this[_0xd24c('0x1')]=_0x3afc67[_0xd24c('0x1')]||'';this[_0xd24c('0x2')]=_0x3afc67['password']||'';this[_0xd24c('0x3')]=_0x3afc67['token']||'';this[_0xd24c('0x4')]=_0x3afc67['remoteUri']||'';this[_0xd24c('0x5')]=_0x3afc67['authType']||'';this['type']=_0x3afc67['type']||_0xd24c('0x6');this[_0xd24c('0x7')]=_0x3afc67[_0xd24c('0x7')]||'';this[_0xd24c('0x8')]=_0x3afc67['Configurations']||{};}module[_0xd24c('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 1da3964..6db9917 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 _0x8466=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x572c3b,_0x5971e7){var _0x519b60=function(_0x1892a1){while(--_0x1892a1){_0x572c3b['push'](_0x572c3b['shift']());}};_0x519b60(++_0x5971e7);}(_0x8466,0x1bc));var _0x6846=function(_0x4cf729,_0x34d0e9){_0x4cf729=_0x4cf729-0x0;var _0x56e13d=_0x8466[_0x4cf729];return _0x56e13d;};'use strict';function ZohoAccount(_0x2a9fdb){this['id']=_0x2a9fdb['id']||0x0;this[_0x6846('0x0')]=_0x2a9fdb[_0x6846('0x0')]||'';this[_0x6846('0x1')]=_0x2a9fdb['description']||'';this[_0x6846('0x2')]=_0x2a9fdb[_0x6846('0x2')]||'';this[_0x6846('0x3')]=_0x2a9fdb['zone']||'';this['clientId']=_0x2a9fdb[_0x6846('0x4')]||'';this['clientSecret']=_0x2a9fdb[_0x6846('0x5')]||'';this[_0x6846('0x6')]=_0x2a9fdb[_0x6846('0x6')]||'';this[_0x6846('0x7')]=_0x2a9fdb['code']||'';this[_0x6846('0x8')]=_0x2a9fdb[_0x6846('0x8')]||'';this[_0x6846('0x9')]=_0x2a9fdb[_0x6846('0x9')]||{};}module[_0x6846('0xa')]=ZohoAccount; \ No newline at end of file +var _0x981f=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','clientId','clientSecret'];(function(_0x466d24,_0x3a3d6c){var _0x535da6=function(_0x241c41){while(--_0x241c41){_0x466d24['push'](_0x466d24['shift']());}};_0x535da6(++_0x3a3d6c);}(_0x981f,0x145));var _0xf981=function(_0x1b40df,_0x48fbea){_0x1b40df=_0x1b40df-0x0;var _0x115723=_0x981f[_0x1b40df];return _0x115723;};'use strict';function ZohoAccount(_0x965a83){this['id']=_0x965a83['id']||0x0;this['name']=_0x965a83[_0xf981('0x0')]||'';this[_0xf981('0x1')]=_0x965a83[_0xf981('0x1')]||'';this[_0xf981('0x2')]=_0x965a83[_0xf981('0x2')]||'';this['zone']=_0x965a83['zone']||'';this[_0xf981('0x3')]=_0x965a83[_0xf981('0x3')]||'';this[_0xf981('0x4')]=_0x965a83['clientSecret']||'';this['serverUrl']=_0x965a83[_0xf981('0x5')]||'';this[_0xf981('0x6')]=_0x965a83['code']||'';this[_0xf981('0x7')]=_0x965a83['refreshToken']||'';this[_0xf981('0x8')]=_0x965a83[_0xf981('0x8')]||{};}module[_0xf981('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 126e9c9..12dc0f6 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 _0x25e7=['ListId','UserId','Agent','VoiceQueueId','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','number','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','channelAgent','SIP/%s','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme'];(function(_0x27f860,_0x565fa2){var _0x21b426=function(_0x29cfc5){while(--_0x29cfc5){_0x27f860['push'](_0x27f860['shift']());}};_0x21b426(++_0x565fa2);}(_0x25e7,0x1d6));var _0x725e=function(_0x4f46f1,_0x2a39b9){_0x4f46f1=_0x4f46f1-0x0;var _0x5e146b=_0x25e7[_0x4f46f1];return _0x5e146b;};'use strict';var util=require(_0x725e('0x0'));var _=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));function checkNameSurname(_0x3fdca4,_0x3644c1,_0x1c3b9){var _0x223d77='';if(!_[_0x725e('0x3')](_0x3644c1)&&_0x725e('0x4')===typeof _0x3644c1){_0x223d77+=_0x3644c1;}if(!_[_0x725e('0x3')](_0x1c3b9)&&'string'===typeof _0x1c3b9){_0x223d77+='\x20'+_0x1c3b9;}if(_0x223d77!==''){return _0x223d77;}return _0x3fdca4;}function Action(_0x5e17a9,_0x2497a5,_0x480945,_0x481316,_0x111a50){this[_0x725e('0x5')]=_0x480945||undefined;this[_0x725e('0x6')]=_0x5e17a9['id'];this[_0x725e('0x7')]=_0x2497a5[_0x725e('0x8')];this[_0x725e('0x9')]=_0x2497a5[_0x725e('0x9')];this[_0x725e('0xa')]=_0x725e('0x7');this[_0x725e('0xb')]=![];this[_0x725e('0xc')]=_[_0x725e('0x3')](_0x5e17a9['Agent'])?undefined:_0x5e17a9['Agent'][_0x725e('0x8')];this[_0x725e('0xd')]=this['membername']?util['format'](_0x725e('0xe'),this[_0x725e('0xc')]):_0x481316||undefined;this['calleridname']=checkNameSurname(_0x5e17a9[_0x725e('0xf')][_0x725e('0x10')],_0x5e17a9[_0x725e('0xf')]['firstName'],_0x5e17a9[_0x725e('0xf')][_0x725e('0x11')]);this[_0x725e('0x12')]=_0x5e17a9[_0x725e('0x12')]||![];this[_0x725e('0x13')]=_0x5e17a9[_0x725e('0x10')];this['scheduledat']=_0x5e17a9[_0x725e('0x14')];this[_0x725e('0x15')]=_0x5e17a9[_0x725e('0x15')]||0x0;this['countcongestionretry']=_0x5e17a9[_0x725e('0x16')]||0x0;this[_0x725e('0x17')]=_0x5e17a9[_0x725e('0x17')]||0x0;this[_0x725e('0x18')]=(_0x5e17a9[_0x725e('0x15')]||0x0)+(_0x5e17a9[_0x725e('0x16')]||0x0)+(_0x5e17a9['countnoanswerretry']||0x0)+(_0x5e17a9[_0x725e('0x19')]||0x0)+(_0x5e17a9[_0x725e('0x1a')]||0x0)+(_0x5e17a9[_0x725e('0x1b')]||0x0)+(_0x5e17a9[_0x725e('0x1c')]||0x0)+(_0x5e17a9[_0x725e('0x1d')]||0x0);this[_0x725e('0x19')]=_0x5e17a9['countnosuchnumberretry']||0x0;this[_0x725e('0x1a')]=_0x5e17a9[_0x725e('0x1a')]||0x0;this[_0x725e('0x1b')]=_0x5e17a9[_0x725e('0x1b')]||0x0;this[_0x725e('0x1c')]=_0x5e17a9[_0x725e('0x1c')]||0x0;this[_0x725e('0x1d')]=_0x5e17a9[_0x725e('0x1d')]||0x0;this[_0x725e('0x1e')]=_0x5e17a9['callback'];this[_0x725e('0x1f')]=_0x5e17a9[_0x725e('0x1f')];this[_0x725e('0x20')]=_0x5e17a9[_0x725e('0x20')];this['recallme']=_0x5e17a9[_0x725e('0x21')];this['ContactId']=_0x5e17a9['ContactId'];this['ListId']=_0x5e17a9[_0x725e('0x22')];this[_0x725e('0x23')]=_[_0x725e('0x3')](_0x5e17a9['Agent'])?_0x5e17a9[_0x725e('0x23')]:_0x5e17a9[_0x725e('0x24')]['id'];this['VoiceQueueId']=_0x5e17a9[_0x725e('0x25')];this[_0x725e('0x26')]='';this['originatecalleridname']='';}Action[_0x725e('0x27')]['getCaller']=function(){return util['format'](_0x725e('0x28'),this['calleridname'],this[_0x725e('0x29')]);};module['exports']=Action; \ No newline at end of file +var _0x8952=['originatecalleridnum','originatecalleridname','getCaller','exports','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','format','SIP/%s','calleridname','Contact','firstName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x1888f8,_0x14fa68){var _0x2c3c15=function(_0x175f14){while(--_0x175f14){_0x1888f8['push'](_0x1888f8['shift']());}};_0x2c3c15(++_0x14fa68);}(_0x8952,0x17e));var _0x2895=function(_0x5d4723,_0x539f69){_0x5d4723=_0x5d4723-0x0;var _0x194fa8=_0x8952[_0x5d4723];return _0x194fa8;};'use strict';var util=require('util');var _=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));function checkNameSurname(_0x43e8d9,_0x2d485c,_0x2454c5){var _0x58085b='';if(!_[_0x2895('0x2')](_0x2d485c)&&_0x2895('0x3')===typeof _0x2d485c){_0x58085b+=_0x2d485c;}if(!_[_0x2895('0x2')](_0x2454c5)&&'string'===typeof _0x2454c5){_0x58085b+='\x20'+_0x2454c5;}if(_0x58085b!==''){return _0x58085b;}return _0x43e8d9;}function Action(_0x32429c,_0x73c245,_0x37305b,_0x4ea619,_0x526c32){this[_0x2895('0x4')]=_0x37305b||undefined;this[_0x2895('0x5')]=_0x32429c['id'];this[_0x2895('0x6')]=_0x73c245[_0x2895('0x7')];this[_0x2895('0x8')]=_0x73c245['type'];this[_0x2895('0x9')]='queue';this[_0x2895('0xa')]=![];this['membername']=_['isNil'](_0x32429c['Agent'])?undefined:_0x32429c[_0x2895('0xb')][_0x2895('0x7')];this[_0x2895('0xc')]=this['membername']?util[_0x2895('0xd')](_0x2895('0xe'),this['membername']):_0x4ea619||undefined;this[_0x2895('0xf')]=checkNameSurname(_0x32429c[_0x2895('0x10')]['phone'],_0x32429c['Contact'][_0x2895('0x11')],_0x32429c[_0x2895('0x10')]['lastName']);this[_0x2895('0x12')]=_0x32429c[_0x2895('0x12')]||![];this[_0x2895('0x13')]=_0x32429c[_0x2895('0x14')];this[_0x2895('0x15')]=_0x32429c[_0x2895('0x15')];this[_0x2895('0x16')]=_0x32429c[_0x2895('0x16')]||0x0;this[_0x2895('0x17')]=_0x32429c[_0x2895('0x17')]||0x0;this[_0x2895('0x18')]=_0x32429c[_0x2895('0x18')]||0x0;this[_0x2895('0x19')]=(_0x32429c[_0x2895('0x16')]||0x0)+(_0x32429c[_0x2895('0x17')]||0x0)+(_0x32429c[_0x2895('0x18')]||0x0)+(_0x32429c[_0x2895('0x1a')]||0x0)+(_0x32429c[_0x2895('0x1b')]||0x0)+(_0x32429c['countabandonedretry']||0x0)+(_0x32429c['countmachineretry']||0x0)+(_0x32429c['countagentrejectretry']||0x0);this[_0x2895('0x1a')]=_0x32429c[_0x2895('0x1a')]||0x0;this[_0x2895('0x1b')]=_0x32429c['countdropretry']||0x0;this[_0x2895('0x1c')]=_0x32429c[_0x2895('0x1c')]||0x0;this[_0x2895('0x1d')]=_0x32429c[_0x2895('0x1d')]||0x0;this[_0x2895('0x1e')]=_0x32429c['countagentrejectretry']||0x0;this[_0x2895('0x1f')]=_0x32429c[_0x2895('0x1f')];this['callbackuniqueid']=_0x32429c[_0x2895('0x20')];this[_0x2895('0x21')]=_0x32429c[_0x2895('0x21')];this['recallme']=_0x32429c['recallme'];this[_0x2895('0x22')]=_0x32429c[_0x2895('0x22')];this[_0x2895('0x23')]=_0x32429c['ListId'];this[_0x2895('0x24')]=_[_0x2895('0x2')](_0x32429c['Agent'])?_0x32429c[_0x2895('0x24')]:_0x32429c[_0x2895('0xb')]['id'];this[_0x2895('0x25')]=_0x32429c['VoiceQueueId'];this[_0x2895('0x26')]='';this[_0x2895('0x27')]='';}Action['prototype'][_0x2895('0x28')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x2895('0xf')],this['number']);};module[_0x2895('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index b516a03..2a122ba 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 _0xd6d1=['transfer','destlinkedid','destuniqueid','addVariable','filterKey','keys','variable','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','util','lodash','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','CAMPAIGN_STATUS','DEACTIVATED','logger','\x20is\x20deactivated','prototype','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','actions','queue','pTalking:\x20','dialAnswer','contactId','UserId','ListId','Action','status','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','then','length','getDiff','Agent','run','logger2','[RecallMe]','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','INACTIVE','isTrunkReachable','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','createCustomerFinal','rescheduleContact','scheduledAt','unlockAgent','activeContact','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','YYYY-MM-DD\x20HH:mm:ss','answertime','uniqueid','\x20Queue','emit','custom:agentconnect','buildObj','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','Answer','crateCustomerReportQueue','talktime','sumBillable','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','linkedid','cause-txt','custom:amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','ANSWER','callProgressDetectingAgent','object','isUndefined','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','Contact','Contact\x20is\x20undefined','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','pick','unlock','active','disableContact','getContactPreview','validateContact','isValid','VoiceQueueId','phone','checkInBlack','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','TrunkBackup','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','assign','merge','starttime','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','channel','actionid','lookAgent','clone','responsetime','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate'];(function(_0x35300,_0x289a06){var _0x2acead=function(_0x4094c4){while(--_0x4094c4){_0x35300['push'](_0x35300['shift']());}};_0x2acead(++_0x289a06);}(_0xd6d1,0x14a));var _0x1d6d=function(_0x3bdabf,_0x26f199){_0x3bdabf=_0x3bdabf-0x0;var _0x179ff1=_0xd6d1[_0x3bdabf];return _0x179ff1;};'use strict';var util=require(_0x1d6d('0x0'));var _=require(_0x1d6d('0x1'));var uuid=require('uuid');var moment=require('moment');var Redis=require(_0x1d6d('0x2'));var config=require(_0x1d6d('0x3'));var logger=require(_0x1d6d('0x4'))(_0x1d6d('0x5'));var loggerAction=require(_0x1d6d('0x4'))(_0x1d6d('0x6'));var ami=require(_0x1d6d('0x7'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require(_0x1d6d('0x8'));var utils=require(_0x1d6d('0x9'));config[_0x1d6d('0xa')]=_[_0x1d6d('0xb')](config[_0x1d6d('0xa')],{'host':_0x1d6d('0xc'),'port':0x18eb});var io=require(_0x1d6d('0xd'))(new Redis(config[_0x1d6d('0xa')]));var Sequence=function(){};Sequence['prototype'][_0x1d6d('0xe')]=function(_0x34431e){this['tail']=this[_0x1d6d('0xf')]?this[_0x1d6d('0xf')][_0x1d6d('0x10')](_0x34431e):_0x34431e();};function Preview(_0x4733b3){this[_0x1d6d('0x11')]=new Sequence();this[_0x1d6d('0x12')]=_0x4733b3[_0x1d6d('0x13')];this[_0x1d6d('0x14')]=_0x4733b3['trunks'];this['actions']={};this[_0x1d6d('0x15')]=_0x4733b3[_0x1d6d('0x15')];this['clockClearZombieChannels']=0x0;ami['on'](_0x1d6d('0x16'),this[_0x1d6d('0x17')][_0x1d6d('0x18')](this));ami['on']('hangup',this[_0x1d6d('0x19')][_0x1d6d('0x18')](this));ami['on'](_0x1d6d('0x1a'),this[_0x1d6d('0x1b')]['bind'](this));ami['on']('dialend',this[_0x1d6d('0x1c')][_0x1d6d('0x18')](this));ami['on'](_0x1d6d('0x1d'),this[_0x1d6d('0x1e')][_0x1d6d('0x18')](this));ami['on'](_0x1d6d('0x1f'),this[_0x1d6d('0x20')][_0x1d6d('0x18')](this));ami['on'](_0x1d6d('0x21'),this[_0x1d6d('0x22')][_0x1d6d('0x18')](this));ami['on'](_0x1d6d('0x23'),this[_0x1d6d('0x24')]['bind'](this));this[_0x1d6d('0x25')](this['campaignsPreview']);}function emit(_0x414b4f,_0x42d01a,_0x1b6348){io['to'](_0x414b4f)['emit'](_0x42d01a,_0x1b6348);}function emitVoiceQueueChannelRemove(_0x2f3c2c){logger[_0x1d6d('0x26')](_0x1d6d('0x27'),JSON[_0x1d6d('0x28')](_0x2f3c2c));emit(util[_0x1d6d('0x29')](_0x1d6d('0x2a'),_0x2f3c2c[_0x1d6d('0x2b')]),_0x1d6d('0x2c'),_0x2f3c2c);io['emit'](_0x1d6d('0x2d'),_0x2f3c2c);}function notSendMessagesQueue(_0x1af567){if(_0x1af567[_0x1d6d('0x2e')]){if(_0x1af567[_0x1d6d('0x2f')]===0x0&&_0x1af567[_0x1d6d('0x30')]===0x0){_0x1af567[_0x1d6d('0x2e')]=![];_0x1af567[_0x1d6d('0x31')]=0x0;_0x1af567[_0x1d6d('0x32')]=0x0;_0x1af567[_0x1d6d('0x33')]=utils['CAMPAIGN_STATUS']['INACTIVE'];ut['logger'](_0x1d6d('0x34'),_0x1af567[_0x1d6d('0x2b')]+_0x1d6d('0x35'));}else{_0x1af567[_0x1d6d('0x33')]=utils[_0x1d6d('0x36')][_0x1d6d('0x37')];ut[_0x1d6d('0x38')](_0x1d6d('0x34'),_0x1af567[_0x1d6d('0x2b')]+_0x1d6d('0x39'));}}}Preview[_0x1d6d('0x3a')]['loopCampaigns']=function(){var _0x32e21d=this;setInterval(function(){_0x32e21d[_0x1d6d('0x3b')]();},0x7cf);};Preview[_0x1d6d('0x3a')][_0x1d6d('0x3b')]=function(){var _0xbb3e3e=this[_0x1d6d('0x12')];this[_0x1d6d('0x3c')]+=0x1;for(var _0x4772c8 in _0xbb3e3e){if(_0xbb3e3e[_0x1d6d('0x3d')](_0x4772c8)&&(_0xbb3e3e[_0x4772c8][_0x1d6d('0x3e')]===_0x1d6d('0x5')||_0xbb3e3e[_0x4772c8][_0x1d6d('0x3e')]===_0x1d6d('0x3f'))&&_0xbb3e3e[_0x4772c8][_0x1d6d('0x40')]===_0x1d6d('0x41')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0xbb3e3e[_0x1d6d('0x3d')](_0x4772c8)&&_0xbb3e3e[_0x4772c8][_0x1d6d('0x3e')]===_0x1d6d('0x5')&&_0xbb3e3e[_0x4772c8][_0x1d6d('0x40')]===_0x1d6d('0x41')){if(_0xbb3e3e[_0x4772c8][_0x1d6d('0x42')]){this[_0x1d6d('0x43')](_0xbb3e3e[_0x4772c8]);if(_0xbb3e3e[_0x4772c8][_0x1d6d('0x44')])this[_0x1d6d('0x45')](_0xbb3e3e[_0x4772c8]);}else{notSendMessagesQueue(_0xbb3e3e[_0x4772c8]);}}}};Preview[_0x1d6d('0x3a')][_0x1d6d('0x46')]=function(_0x5da156){var _0x1cff45=this;this[_0x1d6d('0x11')][_0x1d6d('0xe')](function(){if(!_[_0x1d6d('0x47')](_0x1cff45['actions'][_0x5da156])){loggerAction[_0x1d6d('0x26')](_0x1d6d('0x48'),_0x5da156,_0x1d6d('0x49'),_0x1cff45[_0x1d6d('0x4a')][_0x5da156][_0x1d6d('0x4b')],'originated:\x20',JSON[_0x1d6d('0x28')](_0x1cff45['campaignsPreview'][_0x1cff45[_0x1d6d('0x4a')][_0x5da156][_0x1d6d('0x4b')]][_0x1d6d('0x2f')]),_0x1d6d('0x4c'),JSON[_0x1d6d('0x28')](_0x1cff45[_0x1d6d('0x12')][_0x1cff45[_0x1d6d('0x4a')][_0x5da156][_0x1d6d('0x4b')]]['pTalking']),JSON[_0x1d6d('0x28')](_0x1cff45[_0x1d6d('0x4a')][_0x5da156][_0x1d6d('0x4d')]),JSON[_0x1d6d('0x28')](_['pick'](_0x1cff45['actions'][_0x5da156],[_0x1d6d('0x4e'),_0x1d6d('0x4f'),'VoiceQueueId',_0x1d6d('0x50')])));return ami[_0x1d6d('0x51')]({'action':_0x1d6d('0x52'),'channel':_0x1cff45['actions'][_0x5da156]['channel']})[_0x1d6d('0x53')](function(_0x49a98d){if(_0x49a98d[_0x1d6d('0x33')]===_0x1d6d('0x54')){setTimeout(function(){if(_0x1cff45[_0x1d6d('0x4a')][_0x5da156]){ut['updateOriginated'](_0x1cff45[_0x1d6d('0x12')][_0x1cff45[_0x1d6d('0x4a')][_0x5da156][_0x1d6d('0x4b')]],_0x1d6d('0x55'));if(_0x1cff45[_0x1d6d('0x4a')][_0x5da156]['dialAnswer']===!![]){ut[_0x1d6d('0x56')](_0x1cff45['campaignsPreview'][_0x1cff45[_0x1d6d('0x4a')][_0x5da156][_0x1d6d('0x4b')]],_0x1d6d('0x55'));ut[_0x1d6d('0x57')](_0x1d6d('0x58')+_0x5da156,_0x1cff45[_0x1d6d('0x4a')][_0x5da156][_0x1d6d('0x4b')]);}ut[_0x1d6d('0x57')]('[Dialer][checkChannel][Preview]'+_0x5da156,_0x1cff45['actions'][_0x5da156][_0x1d6d('0x4b')]);delete _0x1cff45[_0x1d6d('0x4a')][_0x5da156];}},0x2328);}});}});};Preview[_0x1d6d('0x3a')]['clearZombieChannels']=function(){var _0x5e11a4=this;loggerAction[_0x1d6d('0x26')](_0x1d6d('0x59'),_['size'](this[_0x1d6d('0x4a')]));for(var _0x190d94 in this['actions']){if(_0x5e11a4['actions'][_0x1d6d('0x3d')](_0x190d94)){_0x5e11a4['clearZombieChannel'](_0x190d94);}}};Preview[_0x1d6d('0x3a')][_0x1d6d('0x45')]=function(_0x5f2fd6){var _0x438817=this;rpcDb['getContactRecallMe'](_0x5f2fd6['id'],ut['agentReadyId'](this[_0x1d6d('0x15')]))[_0x1d6d('0x5a')](function(_0x448e2f){if(!_[_0x1d6d('0x47')](_0x448e2f)){for(var _0x2fff73=0x0;_0x2fff73<_0x448e2f[_0x1d6d('0x5b')];_0x2fff73+=0x1){if(ut[_0x1d6d('0x5c')](_0x448e2f[_0x2fff73]['scheduledat'])<_0x5f2fd6['dialRecallMeTimeout']*0x3c){if(_0x448e2f[_0x2fff73][_0x1d6d('0x5d')]&&!_0x448e2f[_0x2fff73][_0x1d6d('0x5d')]['voicePause']){_0x438817[_0x1d6d('0x5e')](_0x448e2f[_0x2fff73]['id'])[_0x1d6d('0x5a')](ut[_0x1d6d('0x5f')](_0x1d6d('0x60')))[_0x1d6d('0x53')](ut['logger2'](_0x1d6d('0x60')));}else{rpcDb['disableContact'](_0x448e2f[_0x2fff73]['id']);}}else{var _0x28395e=new Action(_0x448e2f[_0x2fff73],_0x5f2fd6);_0x28395e['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5f2fd6['outboundReCallsDay']+=0x1;ut[_0x1d6d('0x61')](_0x28395e,0x17,_0x1d6d('0x62'));if(_0x5f2fd6[_0x1d6d('0x63')]){rpcDb[_0x1d6d('0x64')](ut[_0x1d6d('0x65')](_0x448e2f[_0x2fff73]));rpcDb[_0x1d6d('0x66')](_0x28395e,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x1d6d('0x61')](_0x28395e,0x16,'RecallFailedTimeout');rpcDb[_0x1d6d('0x66')](_0x28395e,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x28395e,_0x1d6d('0x67'));}}}}})[_0x1d6d('0x53')](ut[_0x1d6d('0x5f')](_0x1d6d('0x68')));};Preview[_0x1d6d('0x3a')]['setMessage']=function(_0x354d3d){_0x354d3d[_0x1d6d('0x2e')]=!![];if(ut[_0x1d6d('0x69')](_0x354d3d[_0x1d6d('0x6a')])){_0x354d3d[_0x1d6d('0x33')]=utils[_0x1d6d('0x36')][_0x1d6d('0x6b')];}else if(!ut[_0x1d6d('0x6c')](_0x354d3d[_0x1d6d('0x42')])){_0x354d3d['message']=utils[_0x1d6d('0x36')][_0x1d6d('0x6d')];}else if(!this[_0x1d6d('0x6e')](_0x354d3d[_0x1d6d('0x6f')])){if(!this[_0x1d6d('0x6e')](_0x354d3d['TrunkBackup'])){_0x354d3d[_0x1d6d('0x33')]=utils[_0x1d6d('0x36')][_0x1d6d('0x70')];}else{_0x354d3d[_0x1d6d('0x33')]=utils[_0x1d6d('0x36')][_0x1d6d('0x71')];}}else{_0x354d3d[_0x1d6d('0x33')]=utils['CAMPAIGN_STATUS'][_0x1d6d('0x71')];}};Preview[_0x1d6d('0x3a')][_0x1d6d('0x72')]=function(_0x1006a8,_0x2dfd63,_0x5583c1){var _0x251a9d=this;var _0x532370=this['actions'][_0x2dfd63];var _0x193397=this[_0x1d6d('0x12')][_0x532370[_0x1d6d('0x4b')]];var _0x1de0d2;var _0x5e8f50=![];var _0x375fca=0x2;var _0x354100=0x3;if(_0x193397){switch(_0x5583c1){case'1':_0x193397[_0x1d6d('0x73')]+=0x1;_0x532370[_0x1d6d('0x74')]+=0x1;_0x532370[_0x1d6d('0x75')]=ut['totalGlobal'](_0x532370);ut[_0x1d6d('0x61')](_0x532370,0x0,_0x1d6d('0x76'));ami['emit'](_0x1d6d('0x77'),ut['buildObj'](_0x532370,_0x1d6d('0x78')));rpcDb[_0x1d6d('0x66')](_0x532370,_0x1d6d('0x79'));_0x251a9d[_0x1d6d('0x7a')](_0x532370,'0',_0x193397)[_0x1d6d('0x5a')](function(_0x587e3c){_0x5e8f50=_0x587e3c[_0x1d6d('0x7b')]==0x1;_0x375fca=_0x193397[_0x1d6d('0x7c')];_0x354100=_0x193397[_0x1d6d('0x7d')];if(!_0x5e8f50){if(ut[_0x1d6d('0x7e')](_0x532370)>=_0x193397[_0x1d6d('0x7f')]){_0x1de0d2=ut[_0x1d6d('0x80')](_0x532370,0xf,_0x1d6d('0x81'));rpcDb['createCustomerFinal'](_0x1de0d2,_0x1d6d('0x82'));}else{if(_0x532370[_0x1d6d('0x74')]>=_0x193397[_0x1d6d('0x83')]){rpcDb[_0x1d6d('0x84')](_0x532370,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x1d6d('0x85')](ut[_0x1d6d('0x86')](_0x532370,_0x1d6d('0x74'),_0x193397[_0x1d6d('0x7c')]),_0x532370[_0x1d6d('0x87')],_0x532370[_0x1d6d('0x88')]);}}delete this[_0x1d6d('0x4a')][_0x1006a8['linkedid']];}else{_0x532370[_0x1d6d('0x74')]++;logger['info'](_0x1d6d('0x89'),_0x532370[_0x1d6d('0x74')]);logger[_0x1d6d('0x26')]('id',_0x532370[_0x1d6d('0x8a')]);_0x251a9d[_0x1d6d('0x8b')]({'id':_0x532370[_0x1d6d('0x8a')],'field':{'countnosuchnumberretry':_0x532370['countnosuchnumberretry']}})[_0x1d6d('0x5a')](function(){_0x251a9d[_0x1d6d('0x8c')](_0x532370,_0x375fca,_0x354100)['then'](function(){});});}});break;case'ANSWER':var _0x153be6=moment()[_0x1d6d('0x29')](_0x1d6d('0x8d'));_0x532370['responsetime']=_0x153be6;_0x532370[_0x1d6d('0x8e')]=_0x153be6;_0x532370[_0x1d6d('0x4d')]=!![];_0x193397['pTalking']+=0x1;logger[_0x1d6d('0x26')]('[syncHangup][talking][increment]',_0x532370[_0x1d6d('0x8f')],_0x1d6d('0x90'),_0x193397[_0x1d6d('0x2b')],_0x1d6d('0x4c'),_0x193397[_0x1d6d('0x30')]);ami[_0x1d6d('0x91')](_0x1d6d('0x92'),ut[_0x1d6d('0x93')](_0x532370,_0x1d6d('0x94'),this[_0x1d6d('0x12')][_0x532370[_0x1d6d('0x4b')]]));if(_0x193397['acw']){ami[_0x1d6d('0x91')](_0x1d6d('0x95'),ut[_0x1d6d('0x96')](_0x532370));}break;case'16':ami[_0x1d6d('0x91')](_0x1d6d('0x97'),ut[_0x1d6d('0x93')](_0x532370,_0x1d6d('0x98'),this[_0x1d6d('0x12')][_0x532370[_0x1d6d('0x4b')]]));emitVoiceQueueChannelRemove(ut[_0x1d6d('0x93')](_0x532370,_0x1d6d('0x98')));_0x193397[_0x1d6d('0x99')]+=0x1;_0x193397[_0x1d6d('0x9a')]+=0x1;_0x193397[_0x1d6d('0x9b')]+=0x1;ut[_0x1d6d('0x56')](_0x193397,_0x1d6d('0x9c'));_0x532370[_0x1d6d('0x75')]=ut['totalGlobal'](_0x532370);ut[_0x1d6d('0x61')](_0x532370,0x4,_0x1d6d('0x9d'));rpcDb[_0x1d6d('0x66')](_0x532370,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x1d6d('0x84')](_0x532370,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x1d6d('0x9e')](_0x532370);_0x193397['sumDuration']+=_0x532370[_0x1d6d('0x9f')];_0x193397[_0x1d6d('0xa0')]+=_0x532370[_0x1d6d('0x9f')];logger[_0x1d6d('0x26')]('[syncHangup][talking][decrement]',_0x532370[_0x1d6d('0x8f')],_0x1d6d('0x90'),_0x193397['name'],_0x1d6d('0x4c'),_0x193397[_0x1d6d('0x30')]);delete this[_0x1d6d('0x4a')][_0x1006a8['linkedid']];break;case _0x1d6d('0xa1'):_0x193397[_0x1d6d('0xa2')]+=0x1;_0x532370[_0x1d6d('0xa3')]+=0x1;_0x532370[_0x1d6d('0x75')]=ut[_0x1d6d('0x7e')](_0x532370);ut[_0x1d6d('0x61')](_0x532370,0x5,_0x1d6d('0xa4'));_0x375fca=_0x193397[_0x1d6d('0xa5')];_0x354100=_0x193397['callAdditionalPhoneAfterMin'];ami[_0x1d6d('0x91')](_0x1d6d('0xa6'),ut[_0x1d6d('0x93')](_0x532370,_0x1d6d('0xa7')));rpcDb[_0x1d6d('0x66')](_0x532370,_0x1d6d('0xa8'));_0x251a9d['verifyAdditionalPhones'](_0x532370,'5',_0x193397)[_0x1d6d('0x5a')](function(_0x5e4d42){_0x5e8f50=_0x5e4d42[_0x1d6d('0x7b')]==0x1;if(!_0x5e8f50){if(ut[_0x1d6d('0x7e')](_0x532370)>=_0x193397[_0x1d6d('0x7f')]){_0x1de0d2=ut[_0x1d6d('0x80')](_0x532370,0xf,_0x1d6d('0x81'));rpcDb[_0x1d6d('0x84')](_0x1de0d2,_0x1d6d('0xa9'));}else{if(_0x532370['countbusyretry']>=_0x193397['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x532370,_0x1d6d('0xa8'));}else{rpcDb[_0x1d6d('0x85')](ut[_0x1d6d('0x86')](_0x532370,_0x1d6d('0xa3'),_0x193397[_0x1d6d('0xa5')]),_0x532370[_0x1d6d('0x87')],_0x532370[_0x1d6d('0x88')]);}}}else{_0x532370[_0x1d6d('0xa3')]++;_0x251a9d['incrementPreviewCounters']({'id':_0x532370[_0x1d6d('0x8a')],'field':{'countbusyretry':_0x532370[_0x1d6d('0xa3')]}})[_0x1d6d('0x5a')](function(){_0x251a9d[_0x1d6d('0x8c')](_0x532370,_0x375fca,_0x354100)[_0x1d6d('0x5a')](function(){});});}});break;case'NOANSWER':_0x193397[_0x1d6d('0xaa')]+=0x1;_0x532370[_0x1d6d('0xab')]+=0x1;_0x532370[_0x1d6d('0x75')]=ut[_0x1d6d('0x7e')](_0x532370);ut[_0x1d6d('0x61')](_0x532370,0x3,_0x1d6d('0xac'));_0x375fca=_0x193397[_0x1d6d('0xad')];_0x354100=_0x193397['callAdditionalPhoneAfterMin'];var _0x3e5b1c=ut[_0x1d6d('0xae')](_0x532370,_0x193397);ami['emit'](_0x1d6d('0xaf'),_0x3e5b1c);rpcDb[_0x1d6d('0x66')](_0x532370,_0x1d6d('0xb0'));_0x251a9d[_0x1d6d('0x7a')](_0x532370,'3',_0x193397)[_0x1d6d('0x5a')](function(_0x5ca10d){_0x5e8f50=_0x5ca10d[_0x1d6d('0x7b')]==0x1;if(!_0x5e8f50){if(ut[_0x1d6d('0x7e')](_0x532370)>=_0x193397[_0x1d6d('0x7f')]){_0x1de0d2=ut['cloneAction'](_0x532370,0xf,_0x1d6d('0x81'));rpcDb[_0x1d6d('0x84')](_0x1de0d2,_0x1d6d('0xb1'));}else{if(_0x532370[_0x1d6d('0xab')]>=_0x193397[_0x1d6d('0xb2')]){rpcDb[_0x1d6d('0x84')](_0x532370,_0x1d6d('0xb0'));}else{rpcDb[_0x1d6d('0x85')](ut[_0x1d6d('0x86')](_0x532370,_0x1d6d('0xab'),_0x193397[_0x1d6d('0xad')]),_0x532370[_0x1d6d('0x87')],_0x532370['activeContact']);}}}else{_0x532370['countnoanswerretry']++;_0x251a9d[_0x1d6d('0x8b')]({'id':_0x532370[_0x1d6d('0x8a')],'field':{'countnoanswerretry':_0x532370['countnoanswerretry']}})[_0x1d6d('0x5a')](function(){_0x251a9d[_0x1d6d('0x8c')](_0x532370,_0x375fca,_0x354100)[_0x1d6d('0x5a')](function(){});});}});break;case _0x1d6d('0xb3'):_0x193397[_0x1d6d('0xb4')]+=0x1;_0x532370[_0x1d6d('0xb5')]+=0x1;_0x532370[_0x1d6d('0x75')]=ut[_0x1d6d('0x7e')](_0x532370);ut[_0x1d6d('0x61')](_0x532370,0x8,_0x1d6d('0xb6'));_0x375fca=_0x193397[_0x1d6d('0xb7')];_0x354100=_0x193397[_0x1d6d('0x7d')];ami['emit'](_0x1d6d('0xb8'),ut[_0x1d6d('0x93')](_0x532370,_0x1d6d('0xb9')));rpcDb[_0x1d6d('0x66')](_0x532370,_0x1d6d('0xba'));_0x251a9d[_0x1d6d('0x7a')](_0x532370,'8',_0x193397)['then'](function(_0x10698b){_0x5e8f50=_0x10698b['additional']==0x1;if(!_0x5e8f50){if(ut['totalGlobal'](_0x532370)>=_0x193397['dialGlobalMaxRetry']){_0x1de0d2=ut[_0x1d6d('0x80')](_0x532370,0xf,_0x1d6d('0x81'));rpcDb[_0x1d6d('0x84')](_0x1de0d2,_0x1d6d('0xbb'));}else{if(_0x532370[_0x1d6d('0xb5')]>=_0x193397[_0x1d6d('0xbc')]){rpcDb['createCustomerFinal'](_0x532370,_0x1d6d('0xba'));}else{rpcDb['rescheduleContact'](ut[_0x1d6d('0x86')](_0x532370,_0x1d6d('0xb5'),_0x193397[_0x1d6d('0xa5')]),_0x532370['unlockAgent'],_0x532370['activeContact']);}}}else{_0x532370[_0x1d6d('0xb5')]++;_0x251a9d['incrementPreviewCounters']({'id':_0x532370[_0x1d6d('0x8a')],'field':{'countcongestionretry':_0x532370[_0x1d6d('0xb5')]}})[_0x1d6d('0x5a')](function(){_0x251a9d[_0x1d6d('0x8c')](_0x532370,_0x375fca,_0x354100)[_0x1d6d('0x5a')](function(){});});}});break;case'CANCEL':_0x193397[_0x1d6d('0xbd')]+=0x1;_0x532370[_0x1d6d('0xbe')]+=0x1;_0x532370[_0x1d6d('0x75')]=ut['totalGlobal'](_0x532370);ut[_0x1d6d('0x61')](_0x532370,0x14,_0x1d6d('0xbf'));_0x375fca=_0x193397['dialAgentRejectRetryFrequency'];_0x354100=_0x193397[_0x1d6d('0x7d')];ami[_0x1d6d('0x91')]('custom:agentreject',ut[_0x1d6d('0x93')](_0x532370,_0x1d6d('0xc0')));rpcDb[_0x1d6d('0x66')](_0x532370,_0x1d6d('0xc1'));_0x251a9d[_0x1d6d('0x7a')](_0x532370,'20',_0x193397)['then'](function(_0x2f94a2){_0x5e8f50=_0x2f94a2['additional']==0x1;if(!_0x5e8f50){if(ut[_0x1d6d('0x7e')](_0x532370)>=_0x193397[_0x1d6d('0x7f')]){_0x1de0d2=ut[_0x1d6d('0x80')](_0x532370,0x14,_0x1d6d('0xbf'));rpcDb[_0x1d6d('0x84')](_0x1de0d2,_0x1d6d('0xc2'));}else{if(_0x532370[_0x1d6d('0xbe')]>=_0x193397[_0x1d6d('0xc3')]){rpcDb[_0x1d6d('0x84')](_0x532370,_0x1d6d('0xc2'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x532370,_0x1d6d('0xbe'),_0x193397[_0x1d6d('0xc4')]),_0x532370[_0x1d6d('0x87')],_0x532370['activeContact']);}}}else{_0x532370[_0x1d6d('0xab')]++;_0x251a9d['incrementPreviewCounters']({'id':_0x532370[_0x1d6d('0x8a')],'field':{'countnoanswerretry':_0x532370[_0x1d6d('0xab')]}})[_0x1d6d('0x5a')](function(){_0x251a9d[_0x1d6d('0x8c')](_0x532370,_0x375fca,_0x354100)['then'](function(){});});}});break;case _0x1d6d('0xc5'):_0x193397[_0x1d6d('0xc6')]+=0x1;_0x532370[_0x1d6d('0xc7')]+=0x1;_0x532370['countglobal']=ut['totalGlobal'](_0x532370);ut[_0x1d6d('0x61')](_0x532370,0xb,_0x1d6d('0xc8'));rpcDb[_0x1d6d('0x66')](_0x532370,_0x1d6d('0xc9'));_0x251a9d[_0x1d6d('0x7a')](_0x532370,'11',_0x193397)[_0x1d6d('0x5a')](function(_0x5237bc){_0x5e8f50=_0x5237bc[_0x1d6d('0x7b')]==0x1;if(!_0x5e8f50){if(ut[_0x1d6d('0x7e')](_0x532370)>=_0x193397[_0x1d6d('0x7f')]){_0x1de0d2=ut[_0x1d6d('0x80')](_0x532370,0xf,_0x1d6d('0x81'));rpcDb[_0x1d6d('0x84')](_0x1de0d2,_0x1d6d('0xc9'));}else{if(_0x532370['countabandonedetry']>=_0x193397['dialAbandonedMaxRety']){rpcDb[_0x1d6d('0x84')](_0x532370,_0x1d6d('0xc9'));}else{rpcDb['rescheduleContact'](ut[_0x1d6d('0x86')](_0x532370,'countabandonedretry',_0x193397[_0x1d6d('0xca')]),_0x532370['unlockAgent'],_0x532370[_0x1d6d('0x88')]);}}}else{_0x532370[_0x1d6d('0xab')]++;_0x251a9d[_0x1d6d('0x8b')]({'id':_0x532370[_0x1d6d('0x8a')],'field':{'countnoanswerretry':_0x532370[_0x1d6d('0xab')]}})['then'](function(){_0x251a9d[_0x1d6d('0x8c')](_0x532370,_0x375fca,_0x354100)[_0x1d6d('0x5a')](function(){});});}});break;case'18':_0x193397[_0x1d6d('0xcb')]+=0x1;_0x532370[_0x1d6d('0xcc')]+=0x1;_0x532370[_0x1d6d('0x75')]=ut[_0x1d6d('0x7e')](_0x532370);ut['logCustomer'](_0x532370,0x12,_0x1006a8['cause-txt']||_0x1006a8[_0x1d6d('0xcd')]);ami[_0x1d6d('0x91')]('custom:amd',ut[_0x1d6d('0x93')](_0x532370,_0x1d6d('0xce')));rpcDb[_0x1d6d('0x66')](_0x532370,_0x1d6d('0xcf'));_0x251a9d[_0x1d6d('0x7a')](_0x532370,'18',_0x193397)['then'](function(_0x1d6354){_0x5e8f50=_0x1d6354[_0x1d6d('0x7b')]==0x1;if(!_0x5e8f50){if(ut[_0x1d6d('0x7e')](_0x532370)>=_0x193397[_0x1d6d('0x7f')]){_0x1de0d2=ut['cloneAction'](_0x532370,0x12,'Global');rpcDb[_0x1d6d('0x84')](_0x1de0d2,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x1d6d('0x84')](_0x532370,_0x1d6d('0xcf'));}}else{_0x532370[_0x1d6d('0xab')]++;_0x251a9d['incrementPreviewCounters']({'id':_0x532370['idContact'],'field':{'countnoanswerretry':_0x532370[_0x1d6d('0xab')]}})[_0x1d6d('0x5a')](function(){_0x251a9d['swapAdditionalPhones'](_0x532370,_0x375fca,_0x354100)['then'](function(){});});}});delete this['actions'][_0x1006a8[_0x1d6d('0xd0')]];break;case'19':_0x193397[_0x1d6d('0xcb')]+=0x1;_0x532370[_0x1d6d('0x75')]=ut[_0x1d6d('0x7e')](_0x532370);ut[_0x1d6d('0x61')](_0x532370,0x13,_0x1006a8[_0x1d6d('0xd1')]||_0x1006a8[_0x1d6d('0xcd')]);ami[_0x1d6d('0x91')](_0x1d6d('0xd2'),ut[_0x1d6d('0x93')](_0x532370,_0x1d6d('0xce')));rpcDb[_0x1d6d('0x66')](_0x532370,_0x1d6d('0xd3'));_0x251a9d[_0x1d6d('0x7a')](_0x532370,'18',_0x193397)['then'](function(_0x4fbb13){_0x5e8f50=_0x4fbb13['additional']==0x1;if(!_0x5e8f50){if(ut[_0x1d6d('0x7e')](_0x532370)>=_0x193397[_0x1d6d('0x7f')]){_0x1de0d2=ut[_0x1d6d('0x80')](_0x532370,0xf,'Global');rpcDb[_0x1d6d('0x84')](_0x1de0d2,_0x1d6d('0xd3'));}else{rpcDb[_0x1d6d('0x84')](_0x532370,'[callProgressDetectingCustomer][machine]');}}else{_0x532370['countnoanswerretry']++;_0x251a9d[_0x1d6d('0x8b')]({'id':_0x532370[_0x1d6d('0x8a')],'field':{'countnoanswerretry':_0x532370[_0x1d6d('0xab')]}})['then'](function(){_0x251a9d['swapAdditionalPhones'](_0x532370,_0x375fca,_0x354100)[_0x1d6d('0x5a')](function(){});});}});delete this[_0x1d6d('0x4a')][_0x1006a8['linkedid']];break;default:if(_0x532370[_0x1d6d('0x4d')]){ut[_0x1d6d('0x56')](_0x193397,'[default]');ut[_0x1d6d('0x57')](_0x1d6d('0xd4')+_0x193397[_0x1d6d('0x2b')],_0x1006a8);}_0x193397['outboundUnknownCallsDay']+=0x1;_0x532370['countglobal']=ut['totalGlobal'](_0x532370);ut[_0x1d6d('0x61')](_0x532370,0xc,_0x1006a8[_0x1d6d('0xd1')]||_0x1006a8[_0x1d6d('0xcd')]);_0x375fca=_0x193397['dialAgentRejectRetryFrequency'];_0x354100=_0x193397[_0x1d6d('0x7d')];rpcDb[_0x1d6d('0x66')](_0x532370,_0x1d6d('0xd5'));_0x251a9d[_0x1d6d('0x7a')](_0x532370,'20',_0x193397)[_0x1d6d('0x5a')](function(_0xc583be){_0x5e8f50=_0xc583be[_0x1d6d('0x7b')]==0x1;if(!_0x5e8f50){if(ut[_0x1d6d('0x7e')](_0x532370)>=_0x193397[_0x1d6d('0x7f')]){_0x1de0d2=ut['cloneAction'](_0x532370,0xf,_0x1d6d('0x81'));rpcDb[_0x1d6d('0x84')](_0x1de0d2,_0x1d6d('0xd6'));}else{rpcDb['createCustomerFinal'](_0x532370,_0x1d6d('0xd6'));}delete this['actions'][_0x1006a8[_0x1d6d('0xd0')]];}else{_0x251a9d[_0x1d6d('0x8c')](_0x532370,_0x375fca,_0x354100)[_0x1d6d('0x5a')](function(){});}});}if(!(_0x532370[_0x1d6d('0x4d')]&&_0x5583c1==='16')){ut['updateOriginated'](_0x193397,'[callProgressDetectingCustomer]');logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x532370[_0x1d6d('0x8f')],_0x1d6d('0x90'),_0x193397[_0x1d6d('0x2b')],'originated:\x20',_0x193397[_0x1d6d('0x2f')]);}if(_0x5583c1!==_0x1d6d('0xd7')){delete this[_0x1d6d('0x4a')][_0x1006a8[_0x1d6d('0xd0')]];delete this[_0x1d6d('0x4a')][_0x1006a8['destlinkedid']];}_0x193397['queueSummaryCountersUpdated']=!![];}};Preview[_0x1d6d('0x3a')][_0x1d6d('0xd8')]=function(_0x29bd8d,_0x289f92,_0x571a1e){if(_['isUndefined'](_0x289f92)&&_0x1d6d('0xd9')!==typeof _0x289f92){return;}if(_[_0x1d6d('0xda')](_0x571a1e)&&'object'!==typeof _0x571a1e){return;}switch(_0x571a1e['reason']){case'0':ut['logAgent'](_0x29bd8d,0x0,_0x1d6d('0x76'));rpcDb[_0x1d6d('0xdb')](_0x29bd8d,_0x1d6d('0xdc'));break;case'3':ut[_0x1d6d('0xdd')](_0x29bd8d,0x3,_0x1d6d('0xac'));rpcDb[_0x1d6d('0xdb')](_0x29bd8d,_0x1d6d('0xde'));break;case'5':ut[_0x1d6d('0xdd')](_0x29bd8d,0x5,_0x1d6d('0xa4'));rpcDb[_0x1d6d('0xdb')](_0x29bd8d,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x29bd8d,0x8,_0x1d6d('0xb6'));rpcDb['createAgentHistory'](_0x29bd8d,_0x1d6d('0xdf'));break;case'22':ut[_0x1d6d('0xdd')](_0x29bd8d,0x16,_0x1d6d('0xe0'));rpcDb[_0x1d6d('0xdb')](_0x29bd8d,_0x1d6d('0xe1'));break;default:ut['logAgent'](_0x29bd8d,0xc,_0x571a1e[_0x1d6d('0xe2')]);rpcDb[_0x1d6d('0xdb')](_0x29bd8d,_0x1d6d('0xdf'));}ut['updateOriginated'](_0x289f92,_0x1d6d('0xe3'));logger[_0x1d6d('0x26')](_0x1d6d('0xe4'),_0x29bd8d['uniqueid'],_0x1d6d('0x90'),_0x289f92['name'],'originated:\x20',_0x289f92[_0x1d6d('0x2f')]);delete this['actions'][_0x29bd8d['uniqueid']];};Preview[_0x1d6d('0x3a')]['verifyAdditionalPhones']=function(_0x2eadf3,_0x10e01a,_0x44fffb){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2eadf3,_0x10e01a,_0x44fffb)[_0x1d6d('0x53')](logger[_0x1d6d('0x26')]('[verifyAdditionalPhone]\x20'));};Preview['prototype'][_0x1d6d('0x8c')]=function(_0xf6af8a,_0xf547fd,_0x421d8c){return cmHopperAdditionalPhone[_0x1d6d('0x8c')](_0xf6af8a,_0xf547fd,_0x421d8c)[_0x1d6d('0x53')](logger[_0x1d6d('0x26')]('[swapAdditionalPhone]\x20'));};Preview[_0x1d6d('0x3a')][_0x1d6d('0x8b')]=function(_0x26b65f){return Promise[_0x1d6d('0xe5')]()['then'](cmHopperAdditionalPhone[_0x1d6d('0x8b')](_0x26b65f))['catch'](logger[_0x1d6d('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x1d6d('0x3a')]['checkInBlack']=function(_0x1a7074,_0x3ef9ef,_0x3316e5,_0x3d1102,_0x49a022){var _0x4a3565=this;return new Promise(function(_0x128b2b,_0x120358){if(_[_0x1d6d('0x47')](_0x3ef9ef)||_[_0x1d6d('0x47')](_0x3ef9ef[_0x1d6d('0xe6')])||_[_0x1d6d('0x47')](_0x3ef9ef['phone'])||_[_0x1d6d('0x47')](_0x3ef9ef['VoiceQueueId'])){_0x120358(ut[_0x1d6d('0x33')](_0x1d6d('0xe7'),_0x3d1102,_0x49a022));return;}var _0x3b5692=uuid['v4']();var _0x100729=_0x4a3565[_0x1d6d('0x12')][_0x3ef9ef[_0x1d6d('0x49')][_0x1d6d('0x2b')]];var _0x1fccc4=_0x3316e5?_0x4a3565[_0x1d6d('0x15')][_0x3316e5]['id']:undefined;_0x4a3565[_0x1d6d('0x4a')][_0x3b5692]=new Action(_0x3ef9ef,_0x100729,_0x3b5692,_0x3316e5,_0x1fccc4);var _0x39ca8e=_0x4a3565[_0x1d6d('0x4a')][_0x3b5692];_0x39ca8e['unlockAgent']=_0x3d1102;_0x39ca8e[_0x1d6d('0x88')]=_0x49a022;_0x39ca8e['lookAgent']=_0x3316e5;if(_['isEmpty'](_0x1a7074)){_0x4a3565['execCall'](_0x39ca8e,_0x100729,_0x3ef9ef,_0x3316e5)['then'](function(_0x58a275){logger[_0x1d6d('0x26')](_0x1d6d('0xe8'),_0x1d6d('0xe9')+_0x39ca8e[_0x1d6d('0x4b')]+_0x1d6d('0xea')+_0x39ca8e[_0x1d6d('0x8a')],JSON[_0x1d6d('0x28')](_0x58a275));ami[_0x1d6d('0x91')]('custom:agentcalled',ut[_0x1d6d('0x93')](_0x39ca8e,_0x1d6d('0xeb'),_0x4a3565[_0x1d6d('0x12')][_0x39ca8e[_0x1d6d('0x4b')]]));_0x128b2b(ut[_0x1d6d('0x33')](_0x1d6d('0xec')));})['catch'](function(_0x437d30){ut[_0x1d6d('0x38')](_0x1d6d('0xed'),_0x437d30);_0x120358(ut['message'](_0x1d6d('0xee'),_0x3d1102,_0x49a022));});}else{_0x100729[_0x1d6d('0xef')]+=0x1;ut[_0x1d6d('0xf0')](_0x39ca8e);rpcDb[_0x1d6d('0xf1')](_0x39ca8e,_0x1d6d('0xf2'));delete _0x4a3565[_0x1d6d('0x4a')][_0x3b5692];_0x120358(ut['message'](_0x1d6d('0xf3'),_0x3d1102,_0x49a022));}});};Preview[_0x1d6d('0x3a')][_0x1d6d('0x6e')]=function(_0x3d7295){return!_[_0x1d6d('0x47')](_0x3d7295)&&!_['isNil'](_0x3d7295['name'])&&!_['isNil'](_0x3d7295['active'])&&_0x3d7295['active']&&!_['isNil'](this[_0x1d6d('0x14')][util[_0x1d6d('0x29')](_0x1d6d('0xf4'),_0x3d7295[_0x1d6d('0x2b')])])&&!_[_0x1d6d('0x47')](this['trunks'][util[_0x1d6d('0x29')]('SIP/%s',_0x3d7295[_0x1d6d('0x2b')])][_0x1d6d('0x52')])&&(this[_0x1d6d('0x14')][util['format'](_0x1d6d('0xf4'),_0x3d7295['name'])][_0x1d6d('0x52')]===_0x1d6d('0xf5')||this[_0x1d6d('0x14')][util[_0x1d6d('0x29')](_0x1d6d('0xf4'),_0x3d7295[_0x1d6d('0x2b')])][_0x1d6d('0x52')]===_0x1d6d('0xf6'));};Preview[_0x1d6d('0x3a')][_0x1d6d('0x5e')]=function(_0x3ac2fb,_0x43ba84){return this[_0x1d6d('0xf7')](_0x3ac2fb,_0x43ba84)[_0x1d6d('0x5a')](function(_0x4be00e){return _[_0x1d6d('0xf8')](_0x4be00e,[_0x1d6d('0x33')]);})[_0x1d6d('0x53')](function(_0x1fe910){if(_0x1fe910[_0x1d6d('0xf9')]){rpcDb['unlockContact'](_0x3ac2fb);}if(_0x1fe910[_0x1d6d('0xfa')]){rpcDb[_0x1d6d('0xfb')](_0x3ac2fb);}throw _['pick'](_0x1fe910,[_0x1d6d('0x33')]);});};Preview[_0x1d6d('0x3a')][_0x1d6d('0xf7')]=function(_0x2e50e6,_0x4b13cb){var _0x3cbd2f=this;var _0x367995,_0x57702d;return rpcDb[_0x1d6d('0xfc')](_0x2e50e6)[_0x1d6d('0x5a')](function(_0x1141e7){if(!_[_0x1d6d('0x47')](_0x1141e7[0x0])){_0x57702d=_0x1141e7[0x0]['recallme']?![]:!![];_0x367995=_0x1141e7[0x0]['recallme']?!![]:![];_0x367995=_0x4b13cb?!![]:_0x367995;}var _0x4c3b29=_0x3cbd2f[_0x1d6d('0xfd')](_0x1141e7);if(_0x4c3b29[_0x1d6d('0xfe')]){rpcDb['checkIsBlackList'](_[_0x1d6d('0xf8')](_0x1141e7[0x0],[_0x1d6d('0xff'),_0x1d6d('0x100')]))['then'](function(_0x57682d){_0x3cbd2f[_0x1d6d('0x101')](_0x57682d,_0x1141e7[0x0],_0x4b13cb,_0x57702d,_0x367995)[_0x1d6d('0x5a')](function(_0x1b9a52){return _0x1b9a52;})[_0x1d6d('0x53')](function(_0x579852){throw _0x579852;});})[_0x1d6d('0x53')](function(_0x1259ce){ut[_0x1d6d('0x38')]('[Preview][checkIsBlackList]',_0x1259ce);throw ut[_0x1d6d('0x33')](_0x1d6d('0x102'),_0x57702d,_0x367995);});}else{throw ut[_0x1d6d('0x33')](_0x4c3b29['message'],_0x57702d,_0x367995);}})[_0x1d6d('0x53')](function(_0xb19980){ut['logger'](_0x1d6d('0x103'),_0xb19980);throw ut[_0x1d6d('0x33')](_0x1d6d('0x102'),![],!![]);});};Preview[_0x1d6d('0x3a')][_0x1d6d('0xfd')]=function(_0x17bb3e){if(_['isNil'](_0x17bb3e)||_[_0x1d6d('0x104')](_0x17bb3e)||!_[_0x1d6d('0x47')](_0x17bb3e[0x0][_0x1d6d('0x5d')])&&_[_0x1d6d('0x47')](_0x17bb3e[0x0][_0x1d6d('0x5d')][_0x1d6d('0x2b')])){ut['logger'](_0x1d6d('0x105'),_0x17bb3e);return{'isValid':![],'message':_0x1d6d('0x106')};}var _0x23c8fa=this['campaignsPreview'][_0x17bb3e[0x0][_0x1d6d('0x49')]['name']];_0x23c8fa[_0x1d6d('0x33')]=utils[_0x1d6d('0x36')]['ACTIVE'];if(_[_0x1d6d('0x47')](_0x23c8fa)){ut[_0x1d6d('0x38')](_0x1d6d('0x107'),_0x23c8fa);return{'isValid':![],'message':_0x1d6d('0x108')};}if(!this[_0x1d6d('0x6e')](_0x23c8fa[_0x1d6d('0x6f')])){ut[_0x1d6d('0x38')](_0x1d6d('0x109'),_0x1d6d('0x10a')+_0x23c8fa[_0x1d6d('0x2b')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x1d6d('0x6e')](_0x23c8fa['TrunkBackup'])){ut[_0x1d6d('0x38')](_0x1d6d('0x109'),_0x23c8fa['name']+_0x1d6d('0x10b'));return{'isValid':![],'message':_0x1d6d('0x10c')};}}if(!ut[_0x1d6d('0x6c')](_0x23c8fa[_0x1d6d('0x42')])){ut[_0x1d6d('0x38')]('[Preview][validateContact][Campaign\x20Active]',_0x23c8fa[_0x1d6d('0x2b')]+_0x1d6d('0x10d'));return{'isValid':![],'message':_0x1d6d('0x10a')+_0x23c8fa[_0x1d6d('0x2b')]+_0x1d6d('0x10d')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x1d6d('0x3a')]['execCall']=function(_0x1af6ba,_0xb2b2f5,_0x3b7b7f,_0x3549bb){var _0x58baf3=this;return new Promise(function(_0x2ad57f,_0x1a0652){var _0xa5b77b=_0x1af6ba['uniqueid'];var _0xa504f1=_0x58baf3[_0x1d6d('0x6e')](_0xb2b2f5[_0x1d6d('0x6f')])?util[_0x1d6d('0x29')]('SIP/%s/%s%s',_0xb2b2f5[_0x1d6d('0x6f')][_0x1d6d('0x2b')],_[_0x1d6d('0x47')](_0xb2b2f5['dialPrefix'])?'':_0xb2b2f5['dialPrefix']['trim']()||'',_0xb2b2f5['dialCutDigit']>0x0?_0x3b7b7f[_0x1d6d('0x100')]['substring'](_0xb2b2f5['dialCutDigit']):_0x3b7b7f[_0x1d6d('0x100')]):util[_0x1d6d('0x29')]('SIP/%s/%s%s',_['isNil'](_0xb2b2f5[_0x1d6d('0x10e')])?_0xb2b2f5[_0x1d6d('0x6f')]['name']:_0xb2b2f5[_0x1d6d('0x10e')]['name'],_[_0x1d6d('0x47')](_0xb2b2f5[_0x1d6d('0x10f')])?'':_0xb2b2f5[_0x1d6d('0x10f')][_0x1d6d('0x110')]()||'',_0xb2b2f5[_0x1d6d('0x111')]>0x0?_0x3b7b7f[_0x1d6d('0x100')][_0x1d6d('0x112')](_0xb2b2f5[_0x1d6d('0x111')]):_0x3b7b7f[_0x1d6d('0x100')]);var _0x1602e9=_0x58baf3[_0x1d6d('0x6e')](_0xb2b2f5[_0x1d6d('0x6f')])?ut[_0x1d6d('0x113')](_0xb2b2f5[_0x1d6d('0x6f')][_0x1d6d('0x114')],_0xb2b2f5['dialOriginateCallerIdName'],_0xb2b2f5[_0x1d6d('0x115')]>0x0?ut[_0x1d6d('0x116')](_0xb2b2f5[_0x1d6d('0x117')],_0xb2b2f5[_0x1d6d('0x115')]):_0xb2b2f5[_0x1d6d('0x117')]):ut[_0x1d6d('0x113')](_[_0x1d6d('0x47')](_0xb2b2f5['TrunkBackup'])?_0xb2b2f5[_0x1d6d('0x6f')][_0x1d6d('0x114')]:_0xb2b2f5['TrunkBackup'][_0x1d6d('0x114')],_0xb2b2f5['dialOriginateCallerIdName'],_0xb2b2f5[_0x1d6d('0x115')]>0x0?ut['getCallerIdRandom'](_0xb2b2f5[_0x1d6d('0x117')],_0xb2b2f5[_0x1d6d('0x115')]):_0xb2b2f5[_0x1d6d('0x117')]);if(_0x1602e9){_0x1af6ba[_0x1d6d('0x118')]=ut[_0x1d6d('0x119')](_0x1602e9);_0x1af6ba[_0x1d6d('0x11a')]=ut[_0x1d6d('0x11b')](_0x1602e9);}var _0x1a7564=ut[_0x1d6d('0x11c')](_0xb2b2f5,_0x3b7b7f,_0xa504f1,_0x1602e9,_0xa5b77b,_0x1af6ba);var _0x5d98b9=utils['setXMDContactVariables'](_0x3b7b7f[_0x1d6d('0xe6')]);Object[_0x1d6d('0x11d')](_0x1a7564,_0x5d98b9);_[_0x1d6d('0x11e')](_0x1af6ba,ut['toLowerVariables'](_0x1a7564));_0x1af6ba[_0x1d6d('0x11f')]=moment()[_0x1d6d('0x29')]('YYYY-MM-DD\x20HH:mm:ss');_0xb2b2f5[_0x1d6d('0x120')]=_0x1a7564;var _0x2802e7=ut[_0x1d6d('0x121')](_0x1af6ba,_0xb2b2f5,_0x1a7564,_0x1af6ba[_0x1d6d('0x88')],_0x3549bb);return ami[_0x1d6d('0x51')](_0x2802e7)['then'](function(_0x4ccb24){_0xb2b2f5['originated']+=0x1;logger['info'](_0x1d6d('0x122'),_0xa5b77b,_0x1d6d('0x90'),_0xb2b2f5['name'],'originated:\x20',_0xb2b2f5[_0x1d6d('0x2f')]);_0x2ad57f(_0x4ccb24);})['catch'](function(_0x227d61){ut[_0x1d6d('0xdd')](_0x1af6ba,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x1af6ba,_0x1d6d('0x123'));_0x1a0652(_0x227d61);});});};Preview[_0x1d6d('0x3a')][_0x1d6d('0x1e')]=function(_0x4bceed){if(this['actions'][_0x4bceed[_0x1d6d('0xd0')]]){this['actions'][_0x4bceed[_0x1d6d('0xd0')]][_0x1d6d('0x124')]=_0x4bceed['channel'];}};Preview[_0x1d6d('0x3a')][_0x1d6d('0x17')]=function(_0x6a3d5){var _0x41de64=this;var _0x2894d9=this[_0x1d6d('0x4a')][_0x6a3d5[_0x1d6d('0x125')]];if(_0x2894d9){if(_0x2894d9[_0x1d6d('0x126')]&&this[_0x1d6d('0x15')][_0x2894d9['lookAgent']]){ut['logLookAgent'](_0x2894d9,this[_0x1d6d('0x15')][_0x2894d9[_0x1d6d('0x126')]][_0x1d6d('0x2b')],this['agents'][_0x2894d9[_0x1d6d('0x126')]]['id']);}var _0x40a2ff=_[_0x1d6d('0x127')](_0x2894d9);_0x40a2ff[_0x1d6d('0x128')]=moment()[_0x1d6d('0x29')](_0x1d6d('0x8d'));var _0xc27424=_0x41de64[_0x1d6d('0x12')][_0x2894d9[_0x1d6d('0x4b')]];if(ut[_0x1d6d('0x129')](_0x6a3d5[_0x1d6d('0x12a')])){if(_0x2894d9['unlockAgent']){rpcDb[_0x1d6d('0x12b')](_0x2894d9['idContact']);}if(_0x2894d9['activeContact']){rpcDb[_0x1d6d('0xfb')](_0x2894d9['idContact']);}ami[_0x1d6d('0x91')](_0x1d6d('0x12c'),ut[_0x1d6d('0x93')](_0x2894d9,_0x1d6d('0x12d'),this['campaignsPreview'][_0x2894d9[_0x1d6d('0x4b')]]));this[_0x1d6d('0xd8')](_0x40a2ff,_0xc27424,_0x6a3d5);}else{_0x2894d9[_0x1d6d('0x11f')]=moment()[_0x1d6d('0x29')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x1d6d('0xdd')](_0x40a2ff,0x4,'Answer');rpcDb[_0x1d6d('0xdb')](_0x40a2ff,_0x1d6d('0x12e'));}}};Preview[_0x1d6d('0x3a')][_0x1d6d('0x19')]=function(_0xf4ba5f){var _0x4c882b=this[_0x1d6d('0x4a')][_0xf4ba5f[_0x1d6d('0xd0')]];var _0x437631;if(_0x4c882b){_0x437631=this[_0x1d6d('0x12')][_0x4c882b[_0x1d6d('0x4b')]];logger[_0x1d6d('0x26')](_0x1d6d('0x12f'),_0xf4ba5f['linkedid'],_0x1d6d('0x90'),_0x437631[_0x1d6d('0x2b')],_0x1d6d('0x4c'),_0x437631[_0x1d6d('0x30')]);}if(this[_0x1d6d('0x4a')][_0xf4ba5f[_0x1d6d('0xd0')]]&&_0xf4ba5f[_0x1d6d('0xd0')]!==_0xf4ba5f[_0x1d6d('0x8f')]){if(_0xf4ba5f[_0x1d6d('0x130')]==='16'&&this[_0x1d6d('0x4a')][_0xf4ba5f[_0x1d6d('0xd0')]][_0x1d6d('0x4d')]){this[_0x1d6d('0x72')](_0xf4ba5f,_0xf4ba5f[_0x1d6d('0xd0')],_0xf4ba5f[_0x1d6d('0x130')]);}else if(this[_0x1d6d('0x4a')][_0xf4ba5f[_0x1d6d('0xd0')]]['dialAnswer']){logger[_0x1d6d('0x26')](_0x1d6d('0x131'),_0xf4ba5f[_0x1d6d('0xd0')],_0xf4ba5f[_0x1d6d('0x130')],'\x20Queue',_0x437631[_0x1d6d('0x2b')],_0x1d6d('0x4c'),_0x437631['pTalking']);this['callProgressDetectingCustomer'](_0xf4ba5f,_0xf4ba5f['linkedid'],_0xf4ba5f[_0x1d6d('0x130')]);}}else if(_0x4c882b&&_[_0x1d6d('0x47')](_0x4c882b[_0x1d6d('0x132')])&&_0x437631['dialQueueProject']&&_0xf4ba5f[_0x1d6d('0xd0')]===_0xf4ba5f[_0x1d6d('0x8f')]&&_['isNil'](_0xf4ba5f['reason'])&&_0xf4ba5f['cause']==='16'&&_0xf4ba5f[_0x1d6d('0x133')]==='6'&&_['isUndefined'](_0x4c882b[_0x1d6d('0x134')])){if(_0x4c882b[_0x1d6d('0x87')]){rpcDb[_0x1d6d('0x12b')](_0x4c882b[_0x1d6d('0x8a')]);}if(_0x4c882b[_0x1d6d('0x88')]){rpcDb[_0x1d6d('0xfb')](_0x4c882b[_0x1d6d('0x8a')]);}_0xf4ba5f['reason']='22';this[_0x1d6d('0xd8')](_0x4c882b,_0x437631,_0xf4ba5f);}else if(_0x4c882b&&_0x4c882b['transfer']){if(_0xf4ba5f['cause']==='16'&&this[_0x1d6d('0x4a')][_0xf4ba5f[_0x1d6d('0xd0')]][_0x1d6d('0x4d')]){logger[_0x1d6d('0x26')]('[syncHangup][talking][transfer]',_0xf4ba5f['linkedid'],_0xf4ba5f[_0x1d6d('0x130')],_0x1d6d('0x90'),_0x437631[_0x1d6d('0x2b')],_0x1d6d('0x4c'),_0x437631['pTalking']);this[_0x1d6d('0x72')](_0xf4ba5f,_0xf4ba5f['linkedid'],_0xf4ba5f[_0x1d6d('0x130')]);}else if(this[_0x1d6d('0x4a')][_0xf4ba5f[_0x1d6d('0xd0')]]['dialAnswer']){logger['info'](_0x1d6d('0x131'),_0xf4ba5f['linkedid'],_0xf4ba5f[_0x1d6d('0x130')],_0x1d6d('0x90'),_0x437631['name'],_0x1d6d('0x4c'),_0x437631[_0x1d6d('0x30')]);this[_0x1d6d('0x72')](_0xf4ba5f,_0xf4ba5f[_0x1d6d('0xd0')],_0xf4ba5f[_0x1d6d('0x130')]);}}};Preview[_0x1d6d('0x3a')][_0x1d6d('0x1c')]=function(_0x37259c){if(this['actions'][_0x37259c[_0x1d6d('0x135')]]&&_0x37259c[_0x1d6d('0x135')]!==_0x37259c[_0x1d6d('0x136')]){this[_0x1d6d('0x72')](_0x37259c,_0x37259c[_0x1d6d('0x135')],_0x37259c[_0x1d6d('0xcd')]);}};Preview[_0x1d6d('0x3a')][_0x1d6d('0x1b')]=function(_0x3556c0){if(this['actions'][_0x3556c0[_0x1d6d('0xd0')]]&&_0x3556c0[_0x1d6d('0xd0')]!==_0x3556c0[_0x1d6d('0x8f')]&&!this[_0x1d6d('0x4a')][_0x3556c0[_0x1d6d('0xd0')]][_0x1d6d('0x4d')]){if(_0x3556c0[_0x1d6d('0x130')]==='1'){this[_0x1d6d('0x72')](_0x3556c0,_0x3556c0[_0x1d6d('0xd0')],_0x3556c0[_0x1d6d('0x130')]);}}};Preview[_0x1d6d('0x3a')][_0x1d6d('0x137')]=function(_0x2adac8,_0x33c004,_0x5badf1){if(this[_0x1d6d('0x4a')][_0x2adac8]){if(_[_0x1d6d('0x47')](this[_0x1d6d('0x4a')][_0x2adac8][_0x1d6d('0x120')])){this[_0x1d6d('0x4a')][_0x2adac8]['variables']={};}this['actions'][_0x2adac8][_0x1d6d('0x120')][_0x33c004]=_0x5badf1;}};Preview[_0x1d6d('0x3a')][_0x1d6d('0x20')]=function(_0x2a2e82){try{if(!_['isNil'](_0x2a2e82)){if(ut[_0x1d6d('0x138')](_[_0x1d6d('0x139')](_0x2a2e82['variable'])[0x0])){this['addVariable'](_0x2a2e82[_0x1d6d('0x8f')],_[_0x1d6d('0x139')](_0x2a2e82[_0x1d6d('0x13a')])[0x0],_0x2a2e82['value']);}}}catch(_0x1c2d73){logger[_0x1d6d('0x13b')](_0x1d6d('0x13c'),util['inspect'](_0x1c2d73,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x1d6d('0x22')]=function(_0x5d2ec4){if(_0x5d2ec4){if(this[_0x1d6d('0x4a')][_0x5d2ec4[_0x1d6d('0x13d')]]){this['actions'][_0x5d2ec4['transfertargetlinkedid']][_0x1d6d('0x134')]=!![];}}};Preview[_0x1d6d('0x3a')][_0x1d6d('0x24')]=function(_0x4cce11){if(_0x4cce11){if(this[_0x1d6d('0x4a')][_0x4cce11[_0x1d6d('0x13e')]]){this[_0x1d6d('0x4a')][_0x4cce11['transfererlinkedid']][_0x1d6d('0x134')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xbac8=['answered','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','dialGlobalMaxRetry','Global','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','incrementPreviewCounters','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','congestion','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','outboundUnknownCallsDay','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','reachable','unmonitored','run','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variables','OriginateError','actionid','lookAgent','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','syncHangup','cause','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','addVariable','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','logger','\x20is\x20deactivated','dialMethod','booked','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pTalking','dialAnswer','contactId','VoiceQueueId','Action','status','channel','catch','message','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','nosuchnumber','additional','callAdditionalPhoneAfterMin','cloneAction','dialNoSuchNumberMaxRetry','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbac8,0x1ec));var _0x8bac=function(_0x2c778b,_0x144e2d){_0x2c778b=_0x2c778b-0x0;var _0x11181b=_0xbac8[_0x2c778b];return _0x11181b;};'use strict';var util=require('util');var _=require(_0x8bac('0x0'));var uuid=require(_0x8bac('0x1'));var moment=require(_0x8bac('0x2'));var Redis=require(_0x8bac('0x3'));var config=require(_0x8bac('0x4'));var logger=require(_0x8bac('0x5'))(_0x8bac('0x6'));var loggerAction=require(_0x8bac('0x5'))('actionPreview');var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x8bac('0x7'));var Action=require(_0x8bac('0x8'));var ut=require(_0x8bac('0x9'));var utils=require(_0x8bac('0xa'));config[_0x8bac('0xb')]=_['defaults'](config[_0x8bac('0xb')],{'host':_0x8bac('0xc'),'port':0x18eb});var io=require(_0x8bac('0xd'))(new Redis(config[_0x8bac('0xb')]));var Sequence=function(){};Sequence[_0x8bac('0xe')][_0x8bac('0xf')]=function(_0x270ebc){this[_0x8bac('0x10')]=this['tail']?this[_0x8bac('0x10')]['finally'](_0x270ebc):_0x270ebc();};function Preview(_0x1dac07){this[_0x8bac('0x11')]=new Sequence();this[_0x8bac('0x12')]=_0x1dac07[_0x8bac('0x13')];this[_0x8bac('0x14')]=_0x1dac07['trunks'];this[_0x8bac('0x15')]={};this[_0x8bac('0x16')]=_0x1dac07['agents'];this[_0x8bac('0x17')]=0x0;ami['on']('originateresponse',this[_0x8bac('0x18')][_0x8bac('0x19')](this));ami['on']('hangup',this['syncHangup'][_0x8bac('0x19')](this));ami['on'](_0x8bac('0x1a'),this[_0x8bac('0x1b')][_0x8bac('0x19')](this));ami['on'](_0x8bac('0x1c'),this['syncDialEnd']['bind'](this));ami['on'](_0x8bac('0x1d'),this[_0x8bac('0x1e')]['bind'](this));ami['on'](_0x8bac('0x1f'),this['syncVarSet'][_0x8bac('0x19')](this));ami['on']('attendedtransfer',this[_0x8bac('0x20')][_0x8bac('0x19')](this));ami['on'](_0x8bac('0x21'),this[_0x8bac('0x22')][_0x8bac('0x19')](this));this[_0x8bac('0x23')](this[_0x8bac('0x12')]);}function emit(_0x4c0cf3,_0x6e46cf,_0x2da984){io['to'](_0x4c0cf3)[_0x8bac('0x24')](_0x6e46cf,_0x2da984);}function emitVoiceQueueChannelRemove(_0x21fdaa){logger[_0x8bac('0x25')](_0x8bac('0x26'),JSON[_0x8bac('0x27')](_0x21fdaa));emit(util[_0x8bac('0x28')]('voice:queue:%s',_0x21fdaa[_0x8bac('0x29')]),_0x8bac('0x2a'),_0x21fdaa);io[_0x8bac('0x24')](_0x8bac('0x2b'),_0x21fdaa);}function notSendMessagesQueue(_0x4adf41){if(_0x4adf41[_0x8bac('0x2c')]){if(_0x4adf41[_0x8bac('0x2d')]===0x0&&_0x4adf41['pTalking']===0x0){_0x4adf41['sendMessageOneNotActive']=![];_0x4adf41['available']=0x0;_0x4adf41['paused']=0x0;_0x4adf41['message']=utils[_0x8bac('0x2e')][_0x8bac('0x2f')];ut['logger'](_0x8bac('0x30'),_0x4adf41[_0x8bac('0x29')]+_0x8bac('0x31'));}else{_0x4adf41['message']=utils[_0x8bac('0x2e')]['DEACTIVATED'];ut[_0x8bac('0x32')](_0x8bac('0x30'),_0x4adf41[_0x8bac('0x29')]+_0x8bac('0x33'));}}}Preview[_0x8bac('0xe')]['loopCampaigns']=function(){var _0x41c2c3=this;setInterval(function(){_0x41c2c3['syncCampaigns']();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x2e85bd=this[_0x8bac('0x12')];this[_0x8bac('0x17')]+=0x1;for(var _0x33a493 in _0x2e85bd){if(_0x2e85bd['hasOwnProperty'](_0x33a493)&&(_0x2e85bd[_0x33a493][_0x8bac('0x34')]===_0x8bac('0x6')||_0x2e85bd[_0x33a493][_0x8bac('0x34')]===_0x8bac('0x35'))&&_0x2e85bd[_0x33a493][_0x8bac('0x36')]===_0x8bac('0x37')){if(this[_0x8bac('0x17')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x8bac('0x38')]();}}if(_0x2e85bd[_0x8bac('0x39')](_0x33a493)&&_0x2e85bd[_0x33a493][_0x8bac('0x34')]===_0x8bac('0x6')&&_0x2e85bd[_0x33a493][_0x8bac('0x36')]==='outbound'){if(_0x2e85bd[_0x33a493][_0x8bac('0x3a')]){this[_0x8bac('0x3b')](_0x2e85bd[_0x33a493]);if(_0x2e85bd[_0x33a493][_0x8bac('0x3c')])this[_0x8bac('0x3d')](_0x2e85bd[_0x33a493]);}else{notSendMessagesQueue(_0x2e85bd[_0x33a493]);}}}};Preview[_0x8bac('0xe')][_0x8bac('0x3e')]=function(_0x433cce){var _0x529009=this;this[_0x8bac('0x11')][_0x8bac('0xf')](function(){if(!_[_0x8bac('0x3f')](_0x529009[_0x8bac('0x15')][_0x433cce])){loggerAction['info'](_0x8bac('0x40'),_0x433cce,_0x8bac('0x41'),_0x529009[_0x8bac('0x15')][_0x433cce][_0x8bac('0x42')],_0x8bac('0x43'),JSON[_0x8bac('0x27')](_0x529009[_0x8bac('0x12')][_0x529009[_0x8bac('0x15')][_0x433cce]['queue']][_0x8bac('0x2d')]),_0x8bac('0x44'),JSON[_0x8bac('0x27')](_0x529009[_0x8bac('0x12')][_0x529009[_0x8bac('0x15')][_0x433cce][_0x8bac('0x42')]][_0x8bac('0x45')]),JSON[_0x8bac('0x27')](_0x529009[_0x8bac('0x15')][_0x433cce][_0x8bac('0x46')]),JSON[_0x8bac('0x27')](_['pick'](_0x529009[_0x8bac('0x15')][_0x433cce],[_0x8bac('0x47'),'UserId',_0x8bac('0x48'),'ListId'])));return ami[_0x8bac('0x49')]({'action':_0x8bac('0x4a'),'channel':_0x529009['actions'][_0x433cce][_0x8bac('0x4b')]})[_0x8bac('0x4c')](function(_0x33d4b1){if(_0x33d4b1[_0x8bac('0x4d')]===_0x8bac('0x4e')){setTimeout(function(){if(_0x529009[_0x8bac('0x15')][_0x433cce]){ut[_0x8bac('0x4f')](_0x529009['campaignsPreview'][_0x529009['actions'][_0x433cce][_0x8bac('0x42')]],_0x8bac('0x50'));if(_0x529009[_0x8bac('0x15')][_0x433cce][_0x8bac('0x46')]===!![]){ut['decrementTalkink'](_0x529009[_0x8bac('0x12')][_0x529009[_0x8bac('0x15')][_0x433cce][_0x8bac('0x42')]],_0x8bac('0x50'));ut[_0x8bac('0x51')](_0x8bac('0x52')+_0x433cce,_0x529009[_0x8bac('0x15')][_0x433cce]['queue']);}ut[_0x8bac('0x51')](_0x8bac('0x53')+_0x433cce,_0x529009[_0x8bac('0x15')][_0x433cce][_0x8bac('0x42')]);delete _0x529009[_0x8bac('0x15')][_0x433cce];}},0x2328);}});}});};Preview['prototype'][_0x8bac('0x38')]=function(){var _0x238b7d=this;loggerAction['info'](_0x8bac('0x54'),_[_0x8bac('0x55')](this[_0x8bac('0x15')]));for(var _0x52adaf in this['actions']){if(_0x238b7d[_0x8bac('0x15')][_0x8bac('0x39')](_0x52adaf)){_0x238b7d['clearZombieChannel'](_0x52adaf);}}};Preview[_0x8bac('0xe')][_0x8bac('0x3d')]=function(_0x1a7218){var _0x141bbe=this;rpcDb[_0x8bac('0x56')](_0x1a7218['id'],ut['agentReadyId'](this['agents']))[_0x8bac('0x57')](function(_0x438221){if(!_[_0x8bac('0x3f')](_0x438221)){for(var _0x311acd=0x0;_0x311acd<_0x438221[_0x8bac('0x58')];_0x311acd+=0x1){if(ut[_0x8bac('0x59')](_0x438221[_0x311acd][_0x8bac('0x5a')])<_0x1a7218[_0x8bac('0x5b')]*0x3c){if(_0x438221[_0x311acd][_0x8bac('0x5c')]&&!_0x438221[_0x311acd][_0x8bac('0x5c')]['voicePause']){_0x141bbe['run'](_0x438221[_0x311acd]['id'])[_0x8bac('0x57')](ut[_0x8bac('0x5d')](_0x8bac('0x5e')))[_0x8bac('0x4c')](ut['logger2'](_0x8bac('0x5e')));}else{rpcDb[_0x8bac('0x5f')](_0x438221[_0x311acd]['id']);}}else{var _0x5e6efd=new Action(_0x438221[_0x311acd],_0x1a7218);_0x5e6efd[_0x8bac('0x60')]=moment()['format'](_0x8bac('0x61'));_0x1a7218[_0x8bac('0x62')]+=0x1;ut[_0x8bac('0x63')](_0x5e6efd,0x17,_0x8bac('0x64'));if(_0x1a7218[_0x8bac('0x65')]){rpcDb[_0x8bac('0x66')](ut[_0x8bac('0x67')](_0x438221[_0x311acd]));rpcDb[_0x8bac('0x68')](_0x5e6efd,_0x8bac('0x69'));}else{ut[_0x8bac('0x63')](_0x5e6efd,0x16,_0x8bac('0x6a'));rpcDb[_0x8bac('0x68')](_0x5e6efd,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x5e6efd,_0x8bac('0x6b'));}}}}})['catch'](ut['logger2'](_0x8bac('0x6c')));};Preview['prototype'][_0x8bac('0x3b')]=function(_0x26683b){_0x26683b['sendMessageOneNotActive']=!![];if(ut[_0x8bac('0x6d')](_0x26683b[_0x8bac('0x6e')])){_0x26683b[_0x8bac('0x4d')]=utils[_0x8bac('0x2e')]['NO_AGENTS_LOGGED'];}else if(!ut['isActive'](_0x26683b[_0x8bac('0x3a')])){_0x26683b[_0x8bac('0x4d')]=utils['CAMPAIGN_STATUS']['INACTIVE'];}else if(!this[_0x8bac('0x6f')](_0x26683b[_0x8bac('0x70')])){if(!this[_0x8bac('0x6f')](_0x26683b[_0x8bac('0x71')])){_0x26683b[_0x8bac('0x4d')]=utils[_0x8bac('0x2e')][_0x8bac('0x72')];}else{_0x26683b[_0x8bac('0x4d')]=utils[_0x8bac('0x2e')]['ACTIVE'];}}else{_0x26683b[_0x8bac('0x4d')]=utils[_0x8bac('0x2e')][_0x8bac('0x73')];}};Preview[_0x8bac('0xe')][_0x8bac('0x74')]=function(_0xf6c4e0,_0x13e846,_0x35380d){var _0x31e457=this;var _0x15d8b6=this[_0x8bac('0x15')][_0x13e846];var _0x22a814=this[_0x8bac('0x12')][_0x15d8b6['queue']];var _0x23df7f;var _0x222729=![];var _0x627f9e=0x2;var _0x24e08b=0x3;if(_0x22a814){switch(_0x35380d){case'1':_0x22a814[_0x8bac('0x75')]+=0x1;_0x15d8b6[_0x8bac('0x76')]+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut[_0x8bac('0x78')](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0x0,_0x8bac('0x79'));ami['emit']('custom:agentnosuchnumber',ut['buildObj'](_0x15d8b6,_0x8bac('0x7a')));rpcDb[_0x8bac('0x68')](_0x15d8b6,'[callProgressDetectingCustomer][logNoSuch]');_0x31e457['verifyAdditionalPhones'](_0x15d8b6,'0',_0x22a814)[_0x8bac('0x57')](function(_0x1ecad4){_0x222729=_0x1ecad4[_0x8bac('0x7b')]==0x1;_0x627f9e=_0x22a814['dialNoSuchNumberRetryFrequency'];_0x24e08b=_0x22a814[_0x8bac('0x7c')];if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814['dialGlobalMaxRetry']){_0x23df7f=ut[_0x8bac('0x7d')](_0x15d8b6,0xf,'Global');rpcDb['createCustomerFinal'](_0x23df7f,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x15d8b6[_0x8bac('0x76')]>=_0x22a814[_0x8bac('0x7e')]){rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0x80'));}else{rpcDb[_0x8bac('0x81')](ut[_0x8bac('0x82')](_0x15d8b6,'countnosuchnumberretry',_0x22a814['dialNoSuchNumberRetryFrequency']),_0x15d8b6[_0x8bac('0x83')],_0x15d8b6[_0x8bac('0x84')]);}}delete this['actions'][_0xf6c4e0[_0x8bac('0x85')]];}else{_0x15d8b6[_0x8bac('0x76')]++;logger['info'](_0x8bac('0x86'),_0x15d8b6['countnosuchnumberretry']);logger[_0x8bac('0x25')]('id',_0x15d8b6[_0x8bac('0x87')]);_0x31e457['incrementPreviewCounters']({'id':_0x15d8b6[_0x8bac('0x87')],'field':{'countnosuchnumberretry':_0x15d8b6[_0x8bac('0x76')]}})[_0x8bac('0x57')](function(){_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)[_0x8bac('0x57')](function(){});});}});break;case _0x8bac('0x89'):var _0x2020ad=moment()[_0x8bac('0x28')](_0x8bac('0x61'));_0x15d8b6[_0x8bac('0x8a')]=_0x2020ad;_0x15d8b6[_0x8bac('0x8b')]=_0x2020ad;_0x15d8b6[_0x8bac('0x46')]=!![];_0x22a814[_0x8bac('0x45')]+=0x1;logger[_0x8bac('0x25')](_0x8bac('0x8c'),_0x15d8b6[_0x8bac('0x8d')],_0x8bac('0x8e'),_0x22a814[_0x8bac('0x29')],_0x8bac('0x44'),_0x22a814[_0x8bac('0x45')]);ami['emit']('custom:agentconnect',ut[_0x8bac('0x8f')](_0x15d8b6,_0x8bac('0x90'),this['campaignsPreview'][_0x15d8b6[_0x8bac('0x42')]]));if(_0x22a814[_0x8bac('0x91')]){ami[_0x8bac('0x24')](_0x8bac('0x92'),ut[_0x8bac('0x93')](_0x15d8b6));}break;case'16':ami[_0x8bac('0x24')](_0x8bac('0x94'),ut[_0x8bac('0x8f')](_0x15d8b6,_0x8bac('0x95'),this[_0x8bac('0x12')][_0x15d8b6[_0x8bac('0x42')]]));emitVoiceQueueChannelRemove(ut[_0x8bac('0x8f')](_0x15d8b6,'complete'));_0x22a814[_0x8bac('0x96')]+=0x1;_0x22a814[_0x8bac('0x97')]+=0x1;_0x22a814[_0x8bac('0x98')]+=0x1;ut[_0x8bac('0x99')](_0x22a814,_0x8bac('0x9a'));_0x15d8b6[_0x8bac('0x77')]=ut[_0x8bac('0x78')](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0x4,'Answer');rpcDb[_0x8bac('0x68')](_0x15d8b6,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0x9b'));rpcDb['crateCustomerReportQueue'](_0x15d8b6);_0x22a814['sumDuration']+=_0x15d8b6[_0x8bac('0x9c')];_0x22a814[_0x8bac('0x9d')]+=_0x15d8b6['talktime'];logger['info'](_0x8bac('0x9e'),_0x15d8b6[_0x8bac('0x8d')],_0x8bac('0x8e'),_0x22a814[_0x8bac('0x29')],_0x8bac('0x44'),_0x22a814[_0x8bac('0x45')]);delete this['actions'][_0xf6c4e0[_0x8bac('0x85')]];break;case _0x8bac('0x9f'):_0x22a814[_0x8bac('0xa0')]+=0x1;_0x15d8b6[_0x8bac('0xa1')]+=0x1;_0x15d8b6['countglobal']=ut[_0x8bac('0x78')](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0x5,_0x8bac('0xa2'));_0x627f9e=_0x22a814[_0x8bac('0xa3')];_0x24e08b=_0x22a814[_0x8bac('0x7c')];ami[_0x8bac('0x24')](_0x8bac('0xa4'),ut[_0x8bac('0x8f')](_0x15d8b6,_0x8bac('0xa5')));rpcDb[_0x8bac('0x68')](_0x15d8b6,_0x8bac('0xa6'));_0x31e457[_0x8bac('0xa7')](_0x15d8b6,'5',_0x22a814)[_0x8bac('0x57')](function(_0x23b3ab){_0x222729=_0x23b3ab[_0x8bac('0x7b')]==0x1;if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut['cloneAction'](_0x15d8b6,0xf,_0x8bac('0xa9'));rpcDb[_0x8bac('0x7f')](_0x23df7f,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x15d8b6[_0x8bac('0xa1')]>=_0x22a814[_0x8bac('0xaa')]){rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0xa6'));}else{rpcDb[_0x8bac('0x81')](ut[_0x8bac('0x82')](_0x15d8b6,_0x8bac('0xa1'),_0x22a814['dialBusyRetryFrequency']),_0x15d8b6[_0x8bac('0x83')],_0x15d8b6['activeContact']);}}}else{_0x15d8b6[_0x8bac('0xa1')]++;_0x31e457['incrementPreviewCounters']({'id':_0x15d8b6[_0x8bac('0x87')],'field':{'countbusyretry':_0x15d8b6['countbusyretry']}})[_0x8bac('0x57')](function(){_0x31e457['swapAdditionalPhones'](_0x15d8b6,_0x627f9e,_0x24e08b)[_0x8bac('0x57')](function(){});});}});break;case _0x8bac('0xab'):_0x22a814[_0x8bac('0xac')]+=0x1;_0x15d8b6[_0x8bac('0xad')]+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut['totalGlobal'](_0x15d8b6);ut['logCustomer'](_0x15d8b6,0x3,_0x8bac('0xae'));_0x627f9e=_0x22a814[_0x8bac('0xaf')];_0x24e08b=_0x22a814[_0x8bac('0x7c')];var _0x3ba69c=ut[_0x8bac('0xb0')](_0x15d8b6,_0x22a814);ami[_0x8bac('0x24')]('custom:agentnoanswer',_0x3ba69c);rpcDb[_0x8bac('0x68')](_0x15d8b6,_0x8bac('0xb1'));_0x31e457[_0x8bac('0xa7')](_0x15d8b6,'3',_0x22a814)[_0x8bac('0x57')](function(_0x4d2e14){_0x222729=_0x4d2e14[_0x8bac('0x7b')]==0x1;if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut[_0x8bac('0x7d')](_0x15d8b6,0xf,'Global');rpcDb[_0x8bac('0x7f')](_0x23df7f,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x15d8b6[_0x8bac('0xad')]>=_0x22a814[_0x8bac('0xb2')]){rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0xb1'));}else{rpcDb[_0x8bac('0x81')](ut[_0x8bac('0x82')](_0x15d8b6,_0x8bac('0xad'),_0x22a814[_0x8bac('0xaf')]),_0x15d8b6[_0x8bac('0x83')],_0x15d8b6[_0x8bac('0x84')]);}}}else{_0x15d8b6[_0x8bac('0xad')]++;_0x31e457[_0x8bac('0xb3')]({'id':_0x15d8b6[_0x8bac('0x87')],'field':{'countnoanswerretry':_0x15d8b6['countnoanswerretry']}})[_0x8bac('0x57')](function(){_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)['then'](function(){});});}});break;case _0x8bac('0xb4'):_0x22a814[_0x8bac('0xb5')]+=0x1;_0x15d8b6[_0x8bac('0xb6')]+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut[_0x8bac('0x78')](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0x8,_0x8bac('0xb7'));_0x627f9e=_0x22a814['dialCongestionRetryFrequency'];_0x24e08b=_0x22a814[_0x8bac('0x7c')];ami[_0x8bac('0x24')]('custom:agentcongestion',ut[_0x8bac('0x8f')](_0x15d8b6,_0x8bac('0xb8')));rpcDb[_0x8bac('0x68')](_0x15d8b6,'[callProgressDetectingCustomer][logCongestion]');_0x31e457[_0x8bac('0xa7')](_0x15d8b6,'8',_0x22a814)[_0x8bac('0x57')](function(_0x5ec602){_0x222729=_0x5ec602[_0x8bac('0x7b')]==0x1;if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut['cloneAction'](_0x15d8b6,0xf,_0x8bac('0xa9'));rpcDb['createCustomerFinal'](_0x23df7f,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x15d8b6[_0x8bac('0xb6')]>=_0x22a814[_0x8bac('0xb9')]){rpcDb['createCustomerFinal'](_0x15d8b6,_0x8bac('0xba'));}else{rpcDb[_0x8bac('0x81')](ut[_0x8bac('0x82')](_0x15d8b6,_0x8bac('0xb6'),_0x22a814['dialBusyRetryFrequency']),_0x15d8b6[_0x8bac('0x83')],_0x15d8b6[_0x8bac('0x84')]);}}}else{_0x15d8b6[_0x8bac('0xb6')]++;_0x31e457[_0x8bac('0xb3')]({'id':_0x15d8b6['idContact'],'field':{'countcongestionretry':_0x15d8b6[_0x8bac('0xb6')]}})[_0x8bac('0x57')](function(){_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)[_0x8bac('0x57')](function(){});});}});break;case _0x8bac('0xbb'):_0x22a814[_0x8bac('0xbc')]+=0x1;_0x15d8b6[_0x8bac('0xbd')]+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut['totalGlobal'](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0x14,'AgentReject');_0x627f9e=_0x22a814[_0x8bac('0xbe')];_0x24e08b=_0x22a814[_0x8bac('0x7c')];ami[_0x8bac('0x24')](_0x8bac('0xbf'),ut[_0x8bac('0x8f')](_0x15d8b6,_0x8bac('0xc0')));rpcDb[_0x8bac('0x68')](_0x15d8b6,_0x8bac('0xc1'));_0x31e457['verifyAdditionalPhones'](_0x15d8b6,'20',_0x22a814)[_0x8bac('0x57')](function(_0x2ecae1){_0x222729=_0x2ecae1['additional']==0x1;if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut[_0x8bac('0x7d')](_0x15d8b6,0x14,_0x8bac('0xc2'));rpcDb['createCustomerFinal'](_0x23df7f,_0x8bac('0xc3'));}else{if(_0x15d8b6[_0x8bac('0xbd')]>=_0x22a814[_0x8bac('0xc4')]){rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0xc3'));}else{rpcDb[_0x8bac('0x81')](ut[_0x8bac('0x82')](_0x15d8b6,'countagentrejectretry',_0x22a814[_0x8bac('0xbe')]),_0x15d8b6[_0x8bac('0x83')],_0x15d8b6['activeContact']);}}}else{_0x15d8b6[_0x8bac('0xad')]++;_0x31e457[_0x8bac('0xb3')]({'id':_0x15d8b6[_0x8bac('0x87')],'field':{'countnoanswerretry':_0x15d8b6['countnoanswerretry']}})[_0x8bac('0x57')](function(){_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)['then'](function(){});});}});break;case _0x8bac('0xc5'):_0x22a814[_0x8bac('0xc6')]+=0x1;_0x15d8b6[_0x8bac('0xc7')]+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut[_0x8bac('0x78')](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0xb,_0x8bac('0xc8'));rpcDb[_0x8bac('0x68')](_0x15d8b6,_0x8bac('0xc9'));_0x31e457[_0x8bac('0xa7')](_0x15d8b6,'11',_0x22a814)[_0x8bac('0x57')](function(_0xe59d53){_0x222729=_0xe59d53[_0x8bac('0x7b')]==0x1;if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut[_0x8bac('0x7d')](_0x15d8b6,0xf,_0x8bac('0xa9'));rpcDb[_0x8bac('0x7f')](_0x23df7f,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x15d8b6[_0x8bac('0xca')]>=_0x22a814[_0x8bac('0xcb')]){rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0xc9'));}else{rpcDb['rescheduleContact'](ut[_0x8bac('0x82')](_0x15d8b6,_0x8bac('0xc7'),_0x22a814[_0x8bac('0xcc')]),_0x15d8b6[_0x8bac('0x83')],_0x15d8b6['activeContact']);}}}else{_0x15d8b6['countnoanswerretry']++;_0x31e457[_0x8bac('0xb3')]({'id':_0x15d8b6[_0x8bac('0x87')],'field':{'countnoanswerretry':_0x15d8b6[_0x8bac('0xad')]}})['then'](function(){_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)[_0x8bac('0x57')](function(){});});}});break;case'18':_0x22a814['outboundUnknownCallsDay']+=0x1;_0x15d8b6[_0x8bac('0xcd')]+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut[_0x8bac('0x78')](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0x12,_0xf6c4e0['cause-txt']||_0xf6c4e0[_0x8bac('0xce')]);ami[_0x8bac('0x24')](_0x8bac('0xcf'),ut[_0x8bac('0x8f')](_0x15d8b6,_0x8bac('0xd0')));rpcDb[_0x8bac('0x68')](_0x15d8b6,_0x8bac('0xd1'));_0x31e457[_0x8bac('0xa7')](_0x15d8b6,'18',_0x22a814)[_0x8bac('0x57')](function(_0x44c55f){_0x222729=_0x44c55f[_0x8bac('0x7b')]==0x1;if(!_0x222729){if(ut['totalGlobal'](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut[_0x8bac('0x7d')](_0x15d8b6,0x12,_0x8bac('0xa9'));rpcDb[_0x8bac('0x7f')](_0x23df7f,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0xd1'));}}else{_0x15d8b6['countnoanswerretry']++;_0x31e457[_0x8bac('0xb3')]({'id':_0x15d8b6['idContact'],'field':{'countnoanswerretry':_0x15d8b6[_0x8bac('0xad')]}})[_0x8bac('0x57')](function(){_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)['then'](function(){});});}});delete this[_0x8bac('0x15')][_0xf6c4e0[_0x8bac('0x85')]];break;case'19':_0x22a814['outboundUnknownCallsDay']+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut[_0x8bac('0x78')](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0x13,_0xf6c4e0[_0x8bac('0xd2')]||_0xf6c4e0[_0x8bac('0xce')]);ami[_0x8bac('0x24')]('custom:amd',ut['buildObj'](_0x15d8b6,_0x8bac('0xd0')));rpcDb[_0x8bac('0x68')](_0x15d8b6,'[callProgressDetectingCustomer][machine]');_0x31e457[_0x8bac('0xa7')](_0x15d8b6,'18',_0x22a814)['then'](function(_0x2746f9){_0x222729=_0x2746f9[_0x8bac('0x7b')]==0x1;if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut['cloneAction'](_0x15d8b6,0xf,_0x8bac('0xa9'));rpcDb[_0x8bac('0x7f')](_0x23df7f,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0xd3'));}}else{_0x15d8b6[_0x8bac('0xad')]++;_0x31e457[_0x8bac('0xb3')]({'id':_0x15d8b6[_0x8bac('0x87')],'field':{'countnoanswerretry':_0x15d8b6['countnoanswerretry']}})[_0x8bac('0x57')](function(){_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)[_0x8bac('0x57')](function(){});});}});delete this[_0x8bac('0x15')][_0xf6c4e0['linkedid']];break;default:if(_0x15d8b6[_0x8bac('0x46')]){ut[_0x8bac('0x99')](_0x22a814,_0x8bac('0xd4'));ut[_0x8bac('0x51')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x22a814[_0x8bac('0x29')],_0xf6c4e0);}_0x22a814[_0x8bac('0xd5')]+=0x1;_0x15d8b6[_0x8bac('0x77')]=ut['totalGlobal'](_0x15d8b6);ut[_0x8bac('0x63')](_0x15d8b6,0xc,_0xf6c4e0[_0x8bac('0xd2')]||_0xf6c4e0['dialstatus']);_0x627f9e=_0x22a814[_0x8bac('0xbe')];_0x24e08b=_0x22a814[_0x8bac('0x7c')];rpcDb[_0x8bac('0x68')](_0x15d8b6,_0x8bac('0xd6'));_0x31e457[_0x8bac('0xa7')](_0x15d8b6,'20',_0x22a814)['then'](function(_0x43b682){_0x222729=_0x43b682['additional']==0x1;if(!_0x222729){if(ut[_0x8bac('0x78')](_0x15d8b6)>=_0x22a814[_0x8bac('0xa8')]){_0x23df7f=ut[_0x8bac('0x7d')](_0x15d8b6,0xf,'Global');rpcDb[_0x8bac('0x7f')](_0x23df7f,_0x8bac('0xd7'));}else{rpcDb[_0x8bac('0x7f')](_0x15d8b6,_0x8bac('0xd7'));}delete this['actions'][_0xf6c4e0['linkedid']];}else{_0x31e457[_0x8bac('0x88')](_0x15d8b6,_0x627f9e,_0x24e08b)[_0x8bac('0x57')](function(){});}});}if(!(_0x15d8b6[_0x8bac('0x46')]&&_0x35380d==='16')){ut[_0x8bac('0x4f')](_0x22a814,'[callProgressDetectingCustomer]');logger[_0x8bac('0x25')](_0x8bac('0xd8'),_0x15d8b6['uniqueid'],_0x8bac('0x8e'),_0x22a814[_0x8bac('0x29')],_0x8bac('0x43'),_0x22a814[_0x8bac('0x2d')]);}if(_0x35380d!==_0x8bac('0x89')){delete this[_0x8bac('0x15')][_0xf6c4e0[_0x8bac('0x85')]];delete this['actions'][_0xf6c4e0[_0x8bac('0xd9')]];}_0x22a814[_0x8bac('0xda')]=!![];}};Preview[_0x8bac('0xe')][_0x8bac('0xdb')]=function(_0x1f5bca,_0x149546,_0x5230cf){if(_['isUndefined'](_0x149546)&&_0x8bac('0xdc')!==typeof _0x149546){return;}if(_[_0x8bac('0xdd')](_0x5230cf)&&_0x8bac('0xdc')!==typeof _0x5230cf){return;}switch(_0x5230cf['reason']){case'0':ut[_0x8bac('0xde')](_0x1f5bca,0x0,'NoSuchNumber');rpcDb[_0x8bac('0xdf')](_0x1f5bca,_0x8bac('0xe0'));break;case'3':ut[_0x8bac('0xde')](_0x1f5bca,0x3,_0x8bac('0xae'));rpcDb[_0x8bac('0xdf')](_0x1f5bca,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x8bac('0xde')](_0x1f5bca,0x5,_0x8bac('0xa2'));rpcDb[_0x8bac('0xdf')](_0x1f5bca,_0x8bac('0xe1'));break;case'8':ut['logAgent'](_0x1f5bca,0x8,_0x8bac('0xb7'));rpcDb[_0x8bac('0xdf')](_0x1f5bca,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x8bac('0xde')](_0x1f5bca,0x16,_0x8bac('0xe2'));rpcDb[_0x8bac('0xdf')](_0x1f5bca,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x8bac('0xde')](_0x1f5bca,0xc,_0x5230cf['reason']);rpcDb[_0x8bac('0xdf')](_0x1f5bca,_0x8bac('0xe3'));}ut[_0x8bac('0x4f')](_0x149546,_0x8bac('0xe4'));logger[_0x8bac('0x25')](_0x8bac('0xe5'),_0x1f5bca['uniqueid'],_0x8bac('0x8e'),_0x149546[_0x8bac('0x29')],_0x8bac('0x43'),_0x149546[_0x8bac('0x2d')]);delete this['actions'][_0x1f5bca[_0x8bac('0x8d')]];};Preview[_0x8bac('0xe')]['verifyAdditionalPhones']=function(_0x2d067e,_0x21fe97,_0x3aabed){return cmHopperAdditionalPhone[_0x8bac('0xa7')](_0x2d067e,_0x21fe97,_0x3aabed)[_0x8bac('0x4c')](logger['info'](_0x8bac('0xe6')));};Preview[_0x8bac('0xe')][_0x8bac('0x88')]=function(_0x2b9449,_0x435b1c,_0x48b727){return cmHopperAdditionalPhone[_0x8bac('0x88')](_0x2b9449,_0x435b1c,_0x48b727)[_0x8bac('0x4c')](logger[_0x8bac('0x25')](_0x8bac('0xe7')));};Preview[_0x8bac('0xe')]['incrementPreviewCounters']=function(_0xa0d3e7){return Promise['resolve']()[_0x8bac('0x57')](cmHopperAdditionalPhone[_0x8bac('0xb3')](_0xa0d3e7))[_0x8bac('0x4c')](logger[_0x8bac('0x25')](_0x8bac('0xe8')));};Preview[_0x8bac('0xe')][_0x8bac('0xe9')]=function(_0x277d46,_0x465d3b,_0x5bdfbe,_0x171c5e,_0x497d7a){var _0x565ea8=this;return new Promise(function(_0x49e8a5,_0x5d7e7b){if(_[_0x8bac('0x3f')](_0x465d3b)||_[_0x8bac('0x3f')](_0x465d3b[_0x8bac('0xea')])||_[_0x8bac('0x3f')](_0x465d3b['phone'])||_[_0x8bac('0x3f')](_0x465d3b[_0x8bac('0x48')])){_0x5d7e7b(ut[_0x8bac('0x4d')](_0x8bac('0xeb'),_0x171c5e,_0x497d7a));return;}var _0x572ec6=uuid['v4']();var _0x5eb725=_0x565ea8['campaignsPreview'][_0x465d3b['Queue']['name']];var _0x453361=_0x5bdfbe?_0x565ea8[_0x8bac('0x16')][_0x5bdfbe]['id']:undefined;_0x565ea8[_0x8bac('0x15')][_0x572ec6]=new Action(_0x465d3b,_0x5eb725,_0x572ec6,_0x5bdfbe,_0x453361);var _0x515175=_0x565ea8['actions'][_0x572ec6];_0x515175['unlockAgent']=_0x171c5e;_0x515175[_0x8bac('0x84')]=_0x497d7a;_0x515175['lookAgent']=_0x5bdfbe;if(_[_0x8bac('0xec')](_0x277d46)){_0x565ea8[_0x8bac('0xed')](_0x515175,_0x5eb725,_0x465d3b,_0x5bdfbe)[_0x8bac('0x57')](function(_0x7e3421){logger[_0x8bac('0x25')](_0x8bac('0xee'),_0x8bac('0xef')+_0x515175[_0x8bac('0x42')]+_0x8bac('0xf0')+_0x515175[_0x8bac('0x87')],JSON[_0x8bac('0x27')](_0x7e3421));ami[_0x8bac('0x24')]('custom:agentcalled',ut[_0x8bac('0x8f')](_0x515175,_0x8bac('0xf1'),_0x565ea8[_0x8bac('0x12')][_0x515175['queue']]));_0x49e8a5(ut['message'](_0x8bac('0xf2')));})[_0x8bac('0x4c')](function(_0x2be671){ut[_0x8bac('0x32')](_0x8bac('0xf3'),_0x2be671);_0x5d7e7b(ut[_0x8bac('0x4d')](_0x8bac('0xf4'),_0x171c5e,_0x497d7a));});}else{_0x5eb725[_0x8bac('0xf5')]+=0x1;ut[_0x8bac('0xf6')](_0x515175);rpcDb[_0x8bac('0xf7')](_0x515175,_0x8bac('0xf8'));delete _0x565ea8[_0x8bac('0x15')][_0x572ec6];_0x5d7e7b(ut[_0x8bac('0x4d')]('Contact\x20in\x20black\x20List',_0x171c5e,_0x497d7a));}});};Preview[_0x8bac('0xe')][_0x8bac('0x6f')]=function(_0x2d4642){return!_[_0x8bac('0x3f')](_0x2d4642)&&!_[_0x8bac('0x3f')](_0x2d4642['name'])&&!_[_0x8bac('0x3f')](_0x2d4642[_0x8bac('0xf9')])&&_0x2d4642[_0x8bac('0xf9')]&&!_[_0x8bac('0x3f')](this[_0x8bac('0x14')][util['format'](_0x8bac('0xfa'),_0x2d4642[_0x8bac('0x29')])])&&!_[_0x8bac('0x3f')](this[_0x8bac('0x14')][util[_0x8bac('0x28')]('SIP/%s',_0x2d4642[_0x8bac('0x29')])][_0x8bac('0x4a')])&&(this['trunks'][util[_0x8bac('0x28')](_0x8bac('0xfa'),_0x2d4642[_0x8bac('0x29')])][_0x8bac('0x4a')]===_0x8bac('0xfb')||this[_0x8bac('0x14')][util[_0x8bac('0x28')]('SIP/%s',_0x2d4642[_0x8bac('0x29')])][_0x8bac('0x4a')]===_0x8bac('0xfc'));};Preview[_0x8bac('0xe')][_0x8bac('0xfd')]=function(_0x517a11,_0x15f15e){return this[_0x8bac('0xfe')](_0x517a11,_0x15f15e)[_0x8bac('0x57')](function(_0x3d4ea8){return _[_0x8bac('0xff')](_0x3d4ea8,[_0x8bac('0x4d')]);})[_0x8bac('0x4c')](function(_0x46c3dd){if(_0x46c3dd[_0x8bac('0x100')]){rpcDb[_0x8bac('0x101')](_0x517a11);}if(_0x46c3dd[_0x8bac('0xf9')]){rpcDb[_0x8bac('0x5f')](_0x517a11);}throw _[_0x8bac('0xff')](_0x46c3dd,[_0x8bac('0x4d')]);});};Preview['prototype'][_0x8bac('0xfe')]=function(_0x4fe6df,_0x534e86){var _0x2fe20b=this;var _0x20d043,_0x137e9b;return rpcDb[_0x8bac('0x102')](_0x4fe6df)[_0x8bac('0x57')](function(_0x5555f0){if(!_[_0x8bac('0x3f')](_0x5555f0[0x0])){_0x137e9b=_0x5555f0[0x0][_0x8bac('0x103')]?![]:!![];_0x20d043=_0x5555f0[0x0][_0x8bac('0x103')]?!![]:![];_0x20d043=_0x534e86?!![]:_0x20d043;}var _0x59377b=_0x2fe20b[_0x8bac('0x104')](_0x5555f0);if(_0x59377b[_0x8bac('0x105')]){rpcDb[_0x8bac('0x106')](_['pick'](_0x5555f0[0x0],[_0x8bac('0x48'),_0x8bac('0x107')]))[_0x8bac('0x57')](function(_0x15d3b6){_0x2fe20b[_0x8bac('0xe9')](_0x15d3b6,_0x5555f0[0x0],_0x534e86,_0x137e9b,_0x20d043)[_0x8bac('0x57')](function(_0x479795){return _0x479795;})['catch'](function(_0x400b09){throw _0x400b09;});})[_0x8bac('0x4c')](function(_0xb0f3e5){ut[_0x8bac('0x32')](_0x8bac('0x108'),_0xb0f3e5);throw ut[_0x8bac('0x4d')]('Call\x20unsuccessful',_0x137e9b,_0x20d043);});}else{throw ut[_0x8bac('0x4d')](_0x59377b[_0x8bac('0x4d')],_0x137e9b,_0x20d043);}})[_0x8bac('0x4c')](function(_0x35842b){ut[_0x8bac('0x32')](_0x8bac('0x109'),_0x35842b);throw ut['message'](_0x8bac('0x10a'),![],!![]);});};Preview[_0x8bac('0xe')][_0x8bac('0x104')]=function(_0x1e7f37){if(_['isNil'](_0x1e7f37)||_[_0x8bac('0xec')](_0x1e7f37)||!_[_0x8bac('0x3f')](_0x1e7f37[0x0][_0x8bac('0x5c')])&&_[_0x8bac('0x3f')](_0x1e7f37[0x0][_0x8bac('0x5c')]['name'])){ut[_0x8bac('0x32')](_0x8bac('0x10b'),_0x1e7f37);return{'isValid':![],'message':_0x8bac('0x10c')};}var _0x489695=this[_0x8bac('0x12')][_0x1e7f37[0x0]['Queue'][_0x8bac('0x29')]];_0x489695['message']=utils[_0x8bac('0x2e')][_0x8bac('0x73')];if(_[_0x8bac('0x3f')](_0x489695)){ut[_0x8bac('0x32')]('[Preview][validateContact][Empty\x20Campaign]',_0x489695);return{'isValid':![],'message':_0x8bac('0x10d')};}if(!this[_0x8bac('0x6f')](_0x489695['Trunk'])){ut[_0x8bac('0x32')](_0x8bac('0x10e'),'campaign\x20Name:\x20'+_0x489695['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x8bac('0x6f')](_0x489695[_0x8bac('0x71')])){ut[_0x8bac('0x32')](_0x8bac('0x10e'),_0x489695['name']+_0x8bac('0x10f'));return{'isValid':![],'message':_0x8bac('0x110')};}}if(!ut[_0x8bac('0x111')](_0x489695[_0x8bac('0x3a')])){ut[_0x8bac('0x32')](_0x8bac('0x112'),_0x489695[_0x8bac('0x29')]+_0x8bac('0x113'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x489695[_0x8bac('0x29')]+_0x8bac('0x113')};}return{'isValid':!![],'message':_0x8bac('0x114')};};Preview[_0x8bac('0xe')]['execCall']=function(_0x4ab612,_0xe95cf0,_0xf9954c,_0x2a5e7d){var _0x29d111=this;return new Promise(function(_0x288b76,_0x4ed9ca){var _0x305979=_0x4ab612[_0x8bac('0x8d')];var _0x12111a=_0x29d111['isTrunkReachable'](_0xe95cf0[_0x8bac('0x70')])?util[_0x8bac('0x28')](_0x8bac('0x115'),_0xe95cf0[_0x8bac('0x70')][_0x8bac('0x29')],_[_0x8bac('0x3f')](_0xe95cf0['dialPrefix'])?'':_0xe95cf0[_0x8bac('0x116')]['trim']()||'',_0xe95cf0[_0x8bac('0x117')]>0x0?_0xf9954c[_0x8bac('0x107')][_0x8bac('0x118')](_0xe95cf0['dialCutDigit']):_0xf9954c['phone']):util[_0x8bac('0x28')](_0x8bac('0x115'),_[_0x8bac('0x3f')](_0xe95cf0['TrunkBackup'])?_0xe95cf0[_0x8bac('0x70')][_0x8bac('0x29')]:_0xe95cf0[_0x8bac('0x71')][_0x8bac('0x29')],_[_0x8bac('0x3f')](_0xe95cf0[_0x8bac('0x116')])?'':_0xe95cf0[_0x8bac('0x116')]['trim']()||'',_0xe95cf0[_0x8bac('0x117')]>0x0?_0xf9954c[_0x8bac('0x107')]['substring'](_0xe95cf0['dialCutDigit']):_0xf9954c[_0x8bac('0x107')]);var _0x2c49ef=_0x29d111[_0x8bac('0x6f')](_0xe95cf0[_0x8bac('0x70')])?ut[_0x8bac('0x119')](_0xe95cf0['Trunk'][_0x8bac('0x11a')],_0xe95cf0['dialOriginateCallerIdName'],_0xe95cf0[_0x8bac('0x11b')]>0x0?ut[_0x8bac('0x11c')](_0xe95cf0[_0x8bac('0x11d')],_0xe95cf0['dialRandomLastDigitCallerIdNumber']):_0xe95cf0['dialOriginateCallerIdNumber']):ut[_0x8bac('0x119')](_[_0x8bac('0x3f')](_0xe95cf0[_0x8bac('0x71')])?_0xe95cf0[_0x8bac('0x70')][_0x8bac('0x11a')]:_0xe95cf0[_0x8bac('0x71')][_0x8bac('0x11a')],_0xe95cf0[_0x8bac('0x11e')],_0xe95cf0[_0x8bac('0x11b')]>0x0?ut['getCallerIdRandom'](_0xe95cf0['dialOriginateCallerIdNumber'],_0xe95cf0[_0x8bac('0x11b')]):_0xe95cf0[_0x8bac('0x11d')]);if(_0x2c49ef){_0x4ab612[_0x8bac('0x11f')]=ut[_0x8bac('0x120')](_0x2c49ef);_0x4ab612[_0x8bac('0x121')]=ut[_0x8bac('0x122')](_0x2c49ef);}var _0x42f423=ut[_0x8bac('0x123')](_0xe95cf0,_0xf9954c,_0x12111a,_0x2c49ef,_0x305979,_0x4ab612);var _0x2a576b=utils[_0x8bac('0x124')](_0xf9954c[_0x8bac('0xea')]);Object[_0x8bac('0x125')](_0x42f423,_0x2a576b);_[_0x8bac('0x126')](_0x4ab612,ut[_0x8bac('0x127')](_0x42f423));_0x4ab612[_0x8bac('0x60')]=moment()['format'](_0x8bac('0x61'));_0xe95cf0[_0x8bac('0x128')]=_0x42f423;var _0x236e29=ut['variablesAction'](_0x4ab612,_0xe95cf0,_0x42f423,_0x4ab612['activeContact'],_0x2a5e7d);return ami[_0x8bac('0x49')](_0x236e29)[_0x8bac('0x57')](function(_0x32412f){_0xe95cf0[_0x8bac('0x2d')]+=0x1;logger['info']('[originated][increment]',_0x305979,'\x20Queue',_0xe95cf0['name'],_0x8bac('0x43'),_0xe95cf0[_0x8bac('0x2d')]);_0x288b76(_0x32412f);})[_0x8bac('0x4c')](function(_0x1f964e){ut[_0x8bac('0xde')](_0x4ab612,0xe,_0x8bac('0x129'));rpcDb[_0x8bac('0xdf')](_0x4ab612,'[originateFailure][logOriginateFailure]');_0x4ed9ca(_0x1f964e);});});};Preview[_0x8bac('0xe')]['syncNewExten']=function(_0x2d05c3){if(this[_0x8bac('0x15')][_0x2d05c3[_0x8bac('0x85')]]){this[_0x8bac('0x15')][_0x2d05c3['linkedid']][_0x8bac('0x4b')]=_0x2d05c3[_0x8bac('0x4b')];}};Preview[_0x8bac('0xe')][_0x8bac('0x18')]=function(_0x59ba4c){var _0x31ab77=this;var _0x53f960=this[_0x8bac('0x15')][_0x59ba4c[_0x8bac('0x12a')]];if(_0x53f960){if(_0x53f960[_0x8bac('0x12b')]&&this[_0x8bac('0x16')][_0x53f960['lookAgent']]){ut['logLookAgent'](_0x53f960,this[_0x8bac('0x16')][_0x53f960[_0x8bac('0x12b')]]['name'],this[_0x8bac('0x16')][_0x53f960['lookAgent']]['id']);}var _0x54eef0=_['clone'](_0x53f960);_0x54eef0[_0x8bac('0x8a')]=moment()[_0x8bac('0x28')](_0x8bac('0x61'));var _0xcd0364=_0x31ab77[_0x8bac('0x12')][_0x53f960[_0x8bac('0x42')]];if(ut['isFailure'](_0x59ba4c['response'])){if(_0x53f960[_0x8bac('0x83')]){rpcDb['unlockContact'](_0x53f960[_0x8bac('0x87')]);}if(_0x53f960[_0x8bac('0x84')]){rpcDb[_0x8bac('0x5f')](_0x53f960[_0x8bac('0x87')]);}ami[_0x8bac('0x24')](_0x8bac('0x12c'),ut[_0x8bac('0x8f')](_0x53f960,_0x8bac('0x12d'),this[_0x8bac('0x12')][_0x53f960[_0x8bac('0x42')]]));this[_0x8bac('0xdb')](_0x54eef0,_0xcd0364,_0x59ba4c);}else{_0x53f960[_0x8bac('0x60')]=moment()[_0x8bac('0x28')](_0x8bac('0x61'));ut['logAgent'](_0x54eef0,0x4,_0x8bac('0x12e'));rpcDb[_0x8bac('0xdf')](_0x54eef0,_0x8bac('0x12f'));}}};Preview[_0x8bac('0xe')][_0x8bac('0x130')]=function(_0x301695){var _0x553f42=this[_0x8bac('0x15')][_0x301695[_0x8bac('0x85')]];var _0x193a67;if(_0x553f42){_0x193a67=this[_0x8bac('0x12')][_0x553f42['queue']];logger[_0x8bac('0x25')]('[syncHangup][talking]',_0x301695['linkedid'],_0x8bac('0x8e'),_0x193a67[_0x8bac('0x29')],_0x8bac('0x44'),_0x193a67['pTalking']);}if(this[_0x8bac('0x15')][_0x301695[_0x8bac('0x85')]]&&_0x301695[_0x8bac('0x85')]!==_0x301695[_0x8bac('0x8d')]){if(_0x301695[_0x8bac('0x131')]==='16'&&this[_0x8bac('0x15')][_0x301695[_0x8bac('0x85')]][_0x8bac('0x46')]){this[_0x8bac('0x74')](_0x301695,_0x301695['linkedid'],_0x301695[_0x8bac('0x131')]);}else if(this['actions'][_0x301695['linkedid']][_0x8bac('0x46')]){logger[_0x8bac('0x25')]('[syncHangup][talking][cause]',_0x301695[_0x8bac('0x85')],_0x301695[_0x8bac('0x131')],'\x20Queue',_0x193a67[_0x8bac('0x29')],_0x8bac('0x44'),_0x193a67['pTalking']);this['callProgressDetectingCustomer'](_0x301695,_0x301695[_0x8bac('0x85')],_0x301695['cause']);}}else if(_0x553f42&&_[_0x8bac('0x3f')](_0x553f42['statedesc'])&&_0x193a67['dialQueueProject']&&_0x301695[_0x8bac('0x85')]===_0x301695['uniqueid']&&_[_0x8bac('0x3f')](_0x301695['reason'])&&_0x301695[_0x8bac('0x131')]==='16'&&_0x301695[_0x8bac('0x132')]==='6'&&_['isUndefined'](_0x553f42['transfer'])){if(_0x553f42[_0x8bac('0x83')]){rpcDb[_0x8bac('0x101')](_0x553f42[_0x8bac('0x87')]);}if(_0x553f42[_0x8bac('0x84')]){rpcDb[_0x8bac('0x5f')](_0x553f42[_0x8bac('0x87')]);}_0x301695['reason']='22';this[_0x8bac('0xdb')](_0x553f42,_0x193a67,_0x301695);}else if(_0x553f42&&_0x553f42[_0x8bac('0x133')]){if(_0x301695[_0x8bac('0x131')]==='16'&&this[_0x8bac('0x15')][_0x301695[_0x8bac('0x85')]][_0x8bac('0x46')]){logger[_0x8bac('0x25')](_0x8bac('0x134'),_0x301695[_0x8bac('0x85')],_0x301695[_0x8bac('0x131')],_0x8bac('0x8e'),_0x193a67[_0x8bac('0x29')],_0x8bac('0x44'),_0x193a67['pTalking']);this[_0x8bac('0x74')](_0x301695,_0x301695['linkedid'],_0x301695['cause']);}else if(this['actions'][_0x301695[_0x8bac('0x85')]][_0x8bac('0x46')]){logger[_0x8bac('0x25')]('[syncHangup][talking][cause]',_0x301695['linkedid'],_0x301695[_0x8bac('0x131')],'\x20Queue',_0x193a67[_0x8bac('0x29')],_0x8bac('0x44'),_0x193a67[_0x8bac('0x45')]);this[_0x8bac('0x74')](_0x301695,_0x301695[_0x8bac('0x85')],_0x301695['cause']);}}};Preview['prototype'][_0x8bac('0x135')]=function(_0x4f44e8){if(this['actions'][_0x4f44e8[_0x8bac('0xd9')]]&&_0x4f44e8[_0x8bac('0xd9')]!==_0x4f44e8['destuniqueid']){this[_0x8bac('0x74')](_0x4f44e8,_0x4f44e8[_0x8bac('0xd9')],_0x4f44e8[_0x8bac('0xce')]);}};Preview['prototype'][_0x8bac('0x1b')]=function(_0x30f209){if(this[_0x8bac('0x15')][_0x30f209[_0x8bac('0x85')]]&&_0x30f209['linkedid']!==_0x30f209[_0x8bac('0x8d')]&&!this[_0x8bac('0x15')][_0x30f209['linkedid']][_0x8bac('0x46')]){if(_0x30f209['cause']==='1'){this[_0x8bac('0x74')](_0x30f209,_0x30f209[_0x8bac('0x85')],_0x30f209['cause']);}}};Preview[_0x8bac('0xe')][_0x8bac('0x136')]=function(_0x494530,_0x36a217,_0x26b5e9){if(this[_0x8bac('0x15')][_0x494530]){if(_[_0x8bac('0x3f')](this[_0x8bac('0x15')][_0x494530][_0x8bac('0x128')])){this[_0x8bac('0x15')][_0x494530]['variables']={};}this[_0x8bac('0x15')][_0x494530][_0x8bac('0x128')][_0x36a217]=_0x26b5e9;}};Preview[_0x8bac('0xe')][_0x8bac('0x137')]=function(_0x494141){try{if(!_[_0x8bac('0x3f')](_0x494141)){if(ut[_0x8bac('0x138')](_[_0x8bac('0x139')](_0x494141['variable'])[0x0])){this['addVariable'](_0x494141[_0x8bac('0x8d')],_[_0x8bac('0x139')](_0x494141[_0x8bac('0x13a')])[0x0],_0x494141[_0x8bac('0x13b')]);}}}catch(_0xe97389){logger[_0x8bac('0x13c')](_0x8bac('0x13d'),util[_0x8bac('0x13e')](_0xe97389,{'showHidden':![],'depth':null}));}};Preview[_0x8bac('0xe')][_0x8bac('0x20')]=function(_0x3ae3e6){if(_0x3ae3e6){if(this[_0x8bac('0x15')][_0x3ae3e6[_0x8bac('0x13f')]]){this[_0x8bac('0x15')][_0x3ae3e6['transfertargetlinkedid']][_0x8bac('0x133')]=!![];}}};Preview[_0x8bac('0xe')][_0x8bac('0x22')]=function(_0xc9f438){if(_0xc9f438){if(this[_0x8bac('0x15')][_0xc9f438[_0x8bac('0x140')]]){this[_0x8bac('0x15')][_0xc9f438['transfererlinkedid']][_0x8bac('0x133')]=!![];}}};module[_0x8bac('0x141')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 8325cb0..82a383d 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 _0x9445=['active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','catch','then','createHistory','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','resolve','getContactPreview','createCustomerHistory','rescheduleContact','UserId'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x9445,0x166));var _0x5944=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9445[_0x4a9fb1];return _0x348672;};'use strict';var util=require('util');var BPromise=require(_0x5944('0x0'));var logger=require(_0x5944('0x1'))(_0x5944('0x2'));var cmHopper=require(_0x5944('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x5944('0x4'));var voiceQueueReport=require(_0x5944('0x5'));function loggerCatch(_0x284274){return function(_0x592fc8){logger[_0x5944('0x6')](_0x284274,util[_0x5944('0x7')](_0x592fc8,{'showHidden':![],'depth':null}));};}function create(_0x53d7a4){return cmHopperHistory['createHistory'](_0x53d7a4)[_0x5944('0x8')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x215bcf){return BPromise['resolve']()[_0x5944('0x9')](agentReportPreview[_0x5944('0xa')](_0x215bcf))[_0x5944('0x8')](loggerCatch(_0x5944('0xb')));}function moveContact(_0x594523){return cmHopper['moveContactManagedDialer'](_0x594523,!![])[_0x5944('0x8')](loggerCatch(_0x5944('0xc')));}exports['checkIsBlackList']=function(_0x4f45d6){return cmHopperBlack[_0x5944('0xd')](_0x4f45d6)['catch'](loggerCatch(_0x5944('0xe')));};exports['getContactPreview']=function(_0x5183b2){return BPromise[_0x5944('0xf')]()[_0x5944('0x9')](cmHopper[_0x5944('0x10')](_0x5183b2))[_0x5944('0x8')](loggerCatch('[getContactPreview]\x20'));};exports[_0x5944('0xa')]=function(_0x58f458,_0x275028){create(_0x58f458)['catch'](loggerCatch(_0x275028));moveContact(_0x58f458)[_0x5944('0x8')](loggerCatch(_0x275028));};exports['createAgentHistory']=function(_0x5aac31,_0x10663c){createAgent(_0x5aac31)[_0x5944('0x8')](loggerCatch(_0x10663c));};exports[_0x5944('0x11')]=function(_0x36b035,_0xe72dfe){create(_0x36b035)['catch'](loggerCatch(_0xe72dfe));};exports['createCustomerFinal']=function(_0x547cf5,_0x4785d9){moveContact(_0x547cf5)['catch'](loggerCatch(_0x4785d9));};exports[_0x5944('0x12')]=function(_0x182a76,_0x32061a,_0x1a5814){if(_0x32061a){_0x182a76[_0x5944('0x13')]=null;}if(_0x1a5814){_0x182a76[_0x5944('0x14')]=![];}return cmHopper['rescheduleContact'](_0x182a76)[_0x5944('0x8')](loggerCatch(_0x5944('0x15')));};exports[_0x5944('0x16')]=function(_0x1e4f46){return cmHopper[_0x5944('0x16')](_0x1e4f46)[_0x5944('0x8')](loggerCatch(_0x5944('0x17')));};exports[_0x5944('0x18')]=function(_0x5b871f){return cmHopper[_0x5944('0x18')]({'UserId':null},_0x5b871f,0x1)[_0x5944('0x8')](loggerCatch(_0x5944('0x19')));};exports[_0x5944('0x1a')]=function(_0x265ae3){return cmHopper['unlockContact']({'active':![]},_0x265ae3,0x1)[_0x5944('0x8')](loggerCatch(_0x5944('0x1b')));};exports['crateCustomerReportQueue']=function(_0x10f857){var _0x394154={};_0x394154[_0x5944('0x1c')]=_0x10f857[_0x5944('0x1c')];_0x394154['uniqueid']=_0x10f857[_0x5944('0x1d')];_0x394154[_0x5944('0x1e')]=_0x10f857[_0x5944('0x1e')];_0x394154[_0x5944('0x1f')]=_0x10f857[_0x5944('0x1f')];_0x394154['queue']=_0x10f857[_0x5944('0x20')];_0x394154[_0x5944('0x21')]=_0x10f857[_0x5944('0x22')];_0x394154[_0x5944('0x23')]=_0x10f857[_0x5944('0x22')];_0x394154[_0x5944('0x24')]=0x1;_0x394154[_0x5944('0x25')]=_0x10f857[_0x5944('0x26')];_0x394154[_0x5944('0x27')]=_0x10f857[_0x5944('0x28')];_0x394154[_0x5944('0x29')]=_0x5944('0x2a');_0x394154[_0x5944('0x2b')]=_0x5944('0x2c');_0x394154[_0x5944('0x2d')]=0x0;_0x394154[_0x5944('0x2e')]=0x1;_0x394154[_0x5944('0x2f')]=_0x10f857['membername'];_0x394154[_0x5944('0x30')]='COMPLETED';return BPromise[_0x5944('0xf')]()['then'](voiceQueueReport['create'](_0x394154))['catch'](loggerCatch(_0x5944('0x31')));};exports[_0x5944('0x32')]=function(_0x1b8d9f,_0x5a8955){return BPromise[_0x5944('0xf')]()['then'](cmHopper[_0x5944('0x32')](_0x1b8d9f,_0x5a8955))[_0x5944('0x8')](loggerCatch(_0x5944('0x33')));};exports[_0x5944('0x34')]=function(_0x1bc799){return cmHopper['rescheduleContact'](_0x1bc799,!![],!![])[_0x5944('0x8')](loggerCatch(_0x5944('0x35')));}; \ No newline at end of file +var _0x5aa1=['../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','preview','../rpc/cmHopper','../rpc/cmHopperHistory'];(function(_0x821e12,_0x464e62){var _0x162c6d=function(_0x1f2970){while(--_0x1f2970){_0x821e12['push'](_0x821e12['shift']());}};_0x162c6d(++_0x464e62);}(_0x5aa1,0x16f));var _0x15aa=function(_0x1b6c96,_0x30bd30){_0x1b6c96=_0x1b6c96-0x0;var _0x80e240=_0x5aa1[_0x1b6c96];return _0x80e240;};'use strict';var util=require(_0x15aa('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x15aa('0x1'));var cmHopper=require(_0x15aa('0x2'));var cmHopperHistory=require(_0x15aa('0x3'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x15aa('0x4'));var voiceQueueReport=require(_0x15aa('0x5'));function loggerCatch(_0x1c101d){return function(_0x47c8bd){logger[_0x15aa('0x6')](_0x1c101d,util[_0x15aa('0x7')](_0x47c8bd,{'showHidden':![],'depth':null}));};}function create(_0x28d76f){return cmHopperHistory[_0x15aa('0x8')](_0x28d76f)[_0x15aa('0x9')](loggerCatch(_0x15aa('0xa')));}function createAgent(_0x3583c4){return BPromise[_0x15aa('0xb')]()[_0x15aa('0xc')](agentReportPreview[_0x15aa('0x8')](_0x3583c4))[_0x15aa('0x9')](loggerCatch(_0x15aa('0xa')));}function moveContact(_0x16e9ab){return cmHopper[_0x15aa('0xd')](_0x16e9ab,!![])['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x48e33f){return cmHopperBlack[_0x15aa('0xe')](_0x48e33f)[_0x15aa('0x9')](loggerCatch(_0x15aa('0xf')));};exports['getContactPreview']=function(_0x34ae45){return BPromise[_0x15aa('0xb')]()['then'](cmHopper[_0x15aa('0x10')](_0x34ae45))[_0x15aa('0x9')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x469ff3,_0x23202f){create(_0x469ff3)[_0x15aa('0x9')](loggerCatch(_0x23202f));moveContact(_0x469ff3)[_0x15aa('0x9')](loggerCatch(_0x23202f));};exports[_0x15aa('0x11')]=function(_0x313e55,_0x7f2dfb){createAgent(_0x313e55)[_0x15aa('0x9')](loggerCatch(_0x7f2dfb));};exports[_0x15aa('0x12')]=function(_0x5f2b35,_0x2f066c){create(_0x5f2b35)[_0x15aa('0x9')](loggerCatch(_0x2f066c));};exports[_0x15aa('0x13')]=function(_0x3c63a3,_0x48e41f){moveContact(_0x3c63a3)['catch'](loggerCatch(_0x48e41f));};exports[_0x15aa('0x14')]=function(_0x4625b5,_0xcd6794,_0xd78f7f){if(_0xcd6794){_0x4625b5[_0x15aa('0x15')]=null;}if(_0xd78f7f){_0x4625b5[_0x15aa('0x16')]=![];}return cmHopper['rescheduleContact'](_0x4625b5)[_0x15aa('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x15aa('0x17')]=function(_0x32740e){return cmHopper['countReScheduled'](_0x32740e)[_0x15aa('0x9')](loggerCatch(_0x15aa('0x18')));};exports[_0x15aa('0x19')]=function(_0x3029c5){return cmHopper['unlockContact']({'UserId':null},_0x3029c5,0x1)[_0x15aa('0x9')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x16f5ae){return cmHopper['unlockContact']({'active':![]},_0x16f5ae,0x1)[_0x15aa('0x9')](loggerCatch('[activeContact]\x20'));};exports[_0x15aa('0x1a')]=function(_0x1defe8){var _0xae4222={};_0xae4222[_0x15aa('0x1b')]=_0x1defe8['type'];_0xae4222['uniqueid']=_0x1defe8[_0x15aa('0x1c')];_0xae4222[_0x15aa('0x1d')]=_0x1defe8[_0x15aa('0x1d')];_0xae4222[_0x15aa('0x1e')]=_0x1defe8[_0x15aa('0x1e')];_0xae4222[_0x15aa('0x1f')]=_0x1defe8[_0x15aa('0x1f')];_0xae4222[_0x15aa('0x20')]=_0x1defe8['answertime'];_0xae4222[_0x15aa('0x21')]=_0x1defe8[_0x15aa('0x22')];_0xae4222[_0x15aa('0x23')]=0x1;_0xae4222[_0x15aa('0x24')]=_0x1defe8[_0x15aa('0x25')];_0xae4222[_0x15aa('0x26')]=_0x1defe8[_0x15aa('0x27')];_0xae4222[_0x15aa('0x28')]=_0x15aa('0x29');_0xae4222[_0x15aa('0x2a')]=_0x15aa('0x2b');_0xae4222['holdtime']=0x0;_0xae4222[_0x15aa('0x2c')]=0x1;_0xae4222[_0x15aa('0x2d')]=_0x1defe8['membername'];_0xae4222['queuecallerexitreason']=_0x15aa('0x2e');return BPromise['resolve']()[_0x15aa('0xc')](voiceQueueReport[_0x15aa('0x2f')](_0xae4222))[_0x15aa('0x9')](loggerCatch(_0x15aa('0x30')));};exports[_0x15aa('0x31')]=function(_0x1b8666,_0x2eea60){return BPromise[_0x15aa('0xb')]()[_0x15aa('0xc')](cmHopper[_0x15aa('0x31')](_0x1b8666,_0x2eea60))[_0x15aa('0x9')](loggerCatch(_0x15aa('0x32')));};exports[_0x15aa('0x33')]=function(_0x4f9631){return cmHopper[_0x15aa('0x14')](_0x4f9631,!![],!![])[_0x15aa('0x9')](loggerCatch(_0x15aa('0x34')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 123f177..77c7b5b 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 _0xc4d6=['BOOKED','uniqueid','originate','from-sip','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','status','reachable','milliseconds','diff','seconds','createBody','type','dialAnswer','countnoanswerretry','callback','callbackuniqueid','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','moment','preview','127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','loggerError','error','logger2','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','membername','UserId','logCustomer','talktime','answertime','isFailure'];(function(_0x3f7b40,_0x52d4ce){var _0x1b0d75=function(_0xc31ce8){while(--_0xc31ce8){_0x3f7b40['push'](_0x3f7b40['shift']());}};_0x1b0d75(++_0x52d4ce);}(_0xc4d6,0xcd));var _0x6c4d=function(_0x493a89,_0x2f5fac){_0x493a89=_0x493a89-0x0;var _0x5be45c=_0xc4d6[_0x493a89];return _0x5be45c;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x6c4d('0x0'));var logger=require('../../../../config/logger')(_0x6c4d('0x1'));var ipAgi=process['env']['XCALLY_IP_AGI']||_0x6c4d('0x2');var utils=require(_0x6c4d('0x3'));exports[_0x6c4d('0x4')]=function(_0x3b1d13){return function(_0x5995fe){logger['error'](_0x3b1d13,util[_0x6c4d('0x5')](_0x5995fe,{'showHidden':![],'depth':null}));};};exports[_0x6c4d('0x6')]=function(_0x237fd3,_0x2e9504){logger['info'](_0x237fd3,util['inspect'](_0x2e9504,{'showHidden':![],'depth':null}));};exports[_0x6c4d('0x7')]=function(_0x26ad18,_0x49b56c){logger[_0x6c4d('0x8')](_0x26ad18,util[_0x6c4d('0x5')](_0x49b56c,{'showHidden':![],'depth':null}));};exports[_0x6c4d('0x9')]=function(_0x456330){return function(_0x672b7f){logger[_0x6c4d('0xa')](_0x456330,util[_0x6c4d('0x5')](_0x672b7f,{'showHidden':![],'depth':null}));};};exports[_0x6c4d('0xb')]=function(_0x3507e5,_0x4f0465,_0x81932c){return{'message':_0x3507e5,'unlock':_0x4f0465,'active':_0x81932c};};exports[_0x6c4d('0xc')]=function(_0x4f10e3,_0x543e10,_0x45baa6){if(!_[_0x6c4d('0xd')](_0x45baa6)&&_0x6c4d('0xe')===typeof _0x45baa6&&!_[_0x6c4d('0xf')](_0x45baa6)){if(!_[_0x6c4d('0xd')](_0x543e10)&&_0x6c4d('0xe')===typeof _0x543e10&&!_['isEmpty'](_0x543e10)){return util[_0x6c4d('0x10')](_0x6c4d('0x11'),_0x543e10,_0x45baa6);}return util[_0x6c4d('0x10')]('\x22%s\x22\x20<%s>',_0x45baa6,_0x45baa6);}if(!_[_0x6c4d('0xd')](_0x4f10e3)&&'string'===typeof _0x4f10e3&&!_[_0x6c4d('0xf')](_0x4f10e3)){return _0x4f10e3;}return _0x6c4d('0x12');};exports[_0x6c4d('0x13')]=function(_0x5ef13e){if(_[_0x6c4d('0x14')](_0x5ef13e)){return![];}return _0x5ef13e;};exports['addVariables']=function(_0x26d85b,_0x3eb392,_0x3b1cf3,_0x219abf,_0x268706,_0x4c6331){var _0x125ce8={'XMD-QUEUE':_0x3eb392[_0x6c4d('0x15')]?_0x3eb392[_0x6c4d('0x15')][_0x6c4d('0x16')]:'','XMD-CALLERID':_0x219abf,'XMD-CALLERID-PREVIEW':_0x4c6331?util[_0x6c4d('0x10')](_0x6c4d('0x11'),_0x4c6331[_0x6c4d('0x17')],_0x4c6331[_0x6c4d('0x18')]):_0x219abf,'XMD-DIALID':_0x268706,'XMD-CONTACTID':_0x3eb392[_0x6c4d('0x19')],'XMD-CDRTYPE':_0x6c4d('0x1a'),'CALLERID(all)':_0x219abf,'XMD-VOICEQUEUEID':_0x3eb392[_0x6c4d('0x1b')],'XMD-DIALCHANNEL':_0x3b1cf3,'XMD-DIALTIMEOUT':_0x26d85b['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x6c4d('0x10')](_0x6c4d('0x1c'),_0x26d85b[_0x6c4d('0x1d')]?'g':'',_[_0x6c4d('0xf')](_0x26d85b[_0x6c4d('0x1e')])?'':_0x6c4d('0x1f')),'XMD-DIALURL':_0x26d85b[_0x6c4d('0x20')]||'','XMD-AGI':_0x26d85b[_0x6c4d('0x21')]?util[_0x6c4d('0x10')](_0x6c4d('0x22'),ipAgi,_0x26d85b[_0x6c4d('0x21')]):_0x6c4d('0x23'),'XMD-AGIAFTER':_0x26d85b[_0x6c4d('0x1d')]?util[_0x6c4d('0x10')](_0x6c4d('0x22'),ipAgi,_0x26d85b[_0x6c4d('0x1d')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x4c6331?_0x4c6331[_0x6c4d('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x4c6331?_0x4c6331['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x6c4d('0x25')};if(!_[_0x6c4d('0xf')](_0x26d85b[_0x6c4d('0x1e')])){_0x125ce8[util[_0x6c4d('0x10')]('%s',_0x6c4d('0x26'))]=_0x26d85b[_0x6c4d('0x1e')];_0x125ce8[util[_0x6c4d('0x10')]('%s',_0x6c4d('0x27'))]=_0x268706;}return _0x125ce8;};exports[_0x6c4d('0x28')]=function(_0x6d5639){var _0x310d74={};for(var _0x2d6964 in _0x6d5639){if(_0x6d5639[_0x6c4d('0x29')](_0x2d6964)){_0x310d74[util[_0x6c4d('0x10')]('%s',_[_0x6c4d('0x2a')](_0x2d6964))]=_0x6d5639[_0x2d6964];}}return{'variables':_0x310d74};};exports[_0x6c4d('0x2b')]=function(_0x444cc0,_0x16c6b0){if(!_[_0x6c4d('0x14')](_0x444cc0)){if(_0x444cc0['hasOwnProperty'](_0x6c4d('0x2c'))){if(_0x444cc0[_0x6c4d('0x2c')]>0x0){_0x444cc0[_0x6c4d('0x2c')]-=0x1;}else{logger[_0x6c4d('0x8')](_0x6c4d('0x2d'),_0x16c6b0);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x16c6b0);}};exports['logBlacklist']=function(_0x36ba27){var _0x311c2c=moment()['format'](_0x6c4d('0x2e'));_0x36ba27[_0x6c4d('0x2f')]=0xd;_0x36ba27[_0x6c4d('0x30')]=_0x6c4d('0x31');_0x36ba27[_0x6c4d('0x32')]=_0x311c2c;_0x36ba27[_0x6c4d('0x33')]=_0x311c2c;_0x36ba27[_0x6c4d('0x34')]=_0x311c2c;};exports[_0x6c4d('0x35')]=function(_0x36d05c,_0x1aab05,_0x30ec1e){var _0x306b68=moment()[_0x6c4d('0x10')](_0x6c4d('0x2e'));_0x36d05c['state']=_0x1aab05;_0x36d05c[_0x6c4d('0x30')]=_0x30ec1e;_0x36d05c[_0x6c4d('0x33')]=_0x306b68;_0x36d05c[_0x6c4d('0x36')]=utils['getSeconds'](_0x36d05c[_0x6c4d('0x33')],_0x36d05c[_0x6c4d('0x32')]);};exports['logLookAgent']=function(_0x367b6d,_0x236ead,_0xee1b92){_0x367b6d[_0x6c4d('0x37')]=_0x236ead;_0x367b6d[_0x6c4d('0x38')]=_0xee1b92;};exports[_0x6c4d('0x39')]=function(_0x43f32a,_0x446244,_0x37c6c4){var _0x18b0e4=moment()[_0x6c4d('0x10')](_0x6c4d('0x2e'));_0x43f32a[_0x6c4d('0x2f')]=_0x446244;_0x43f32a[_0x6c4d('0x30')]=_0x37c6c4;_0x43f32a['responsetime']=_0x43f32a['responsetime']?_0x43f32a[_0x6c4d('0x33')]:_0x18b0e4;_0x43f32a[_0x6c4d('0x34')]=_0x43f32a[_0x6c4d('0x34')]?_0x43f32a['endtime']:_0x18b0e4;_0x43f32a[_0x6c4d('0x36')]=utils['getSeconds'](_0x43f32a[_0x6c4d('0x33')]||0x0,_0x43f32a[_0x6c4d('0x32')]||0x0);_0x43f32a[_0x6c4d('0x3a')]=_0x43f32a[_0x6c4d('0x3b')]?utils['getSeconds'](_0x43f32a[_0x6c4d('0x34')],_0x43f32a[_0x6c4d('0x3b')]):0x0;};exports[_0x6c4d('0x3c')]=function(_0x73faac){return _0x73faac==='Failure';};exports['variablesAction']=function(_0x1239ee,_0x24db10,_0x49f6d0,_0x5245dd,_0x7c8c4a){var _0x131953=_0x5245dd?'RECALL':_0x1239ee[_0x6c4d('0x17')];_0x131953=_0x7c8c4a?_0x6c4d('0x3d'):_0x131953;return{'actionid':_0x1239ee[_0x6c4d('0x3e')],'action':_0x6c4d('0x3f'),'channel':_0x1239ee['channelAgent'],'callerid':util[_0x6c4d('0x10')](_0x6c4d('0x11'),_0x131953,_0x1239ee['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x6c4d('0x40'),'Priority':'1','variable':_0x49f6d0,'timeout':(_0x24db10['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1239ee[_0x6c4d('0x3e')]};};exports[_0x6c4d('0x41')]=function(_0x4d706f){return _0x4d706f[_0x6c4d('0x42')]+_0x4d706f[_0x6c4d('0x43')]+_0x4d706f['countnoanswerretry']+_0x4d706f[_0x6c4d('0x44')]+_0x4d706f[_0x6c4d('0x45')];};exports[_0x6c4d('0x46')]=function(_0x4a4df9){var _0x4a0970=_[_0x6c4d('0x47')](_0x4a4df9);_0x4a0970[_0x6c4d('0x2f')]=0xf;_0x4a0970['statedesc']=_0x6c4d('0x48');return _0x4a0970;};exports[_0x6c4d('0x49')]=function(_0x5e81c9,_0x3de94f,_0x4f4126){var _0x329457={};_0x329457[_0x3de94f]=_0x5e81c9[_0x3de94f];_0x329457[_0x6c4d('0x4a')]=![];_0x329457[_0x6c4d('0x4b')]=moment()['add'](_0x4f4126,_0x6c4d('0x4c'))[_0x6c4d('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x329457[_0x6c4d('0x19')]=_0x5e81c9['ContactId'];_0x329457[_0x6c4d('0x4d')]=_0x5e81c9['ListId'];_0x329457[_0x6c4d('0x1b')]=_0x5e81c9[_0x6c4d('0x1b')]||undefined;return _0x329457;};exports['decrementTalkink']=function(_0x47c02a,_0x562e53){if(!_[_0x6c4d('0x14')](_0x47c02a)){if(_0x47c02a[_0x6c4d('0x4e')]>0x0){_0x47c02a[_0x6c4d('0x4e')]-=0x1;}else{logger[_0x6c4d('0x8')](_0x562e53,_0x6c4d('0x4f'));}}else{logger[_0x6c4d('0x8')](_0x562e53,_0x6c4d('0x50'));}};exports[_0x6c4d('0x51')]=function(_0x1fb2b0){if(_0x1fb2b0<=0x0){return!![];}return![];};function buildObj(_0x2c66d1,_0x5f31bd,_0x34347c){_0x2c66d1['lastevent']=_0x5f31bd;_0x2c66d1[_0x6c4d('0x16')]=_0x2c66d1[_0x6c4d('0x52')];_0x2c66d1[_0x6c4d('0x53')]=_0x2c66d1[_0x6c4d('0x54')];_0x2c66d1[_0x6c4d('0x55')]=_0x6c4d('0x56');if(_0x34347c){_0x2c66d1[_0x6c4d('0x57')]=_0x34347c[_0x6c4d('0x57')];}return _0x2c66d1;}exports['buildObj']=buildObj;exports[_0x6c4d('0x58')]=function(_0x508d3d){var _0x2b23ca={};_0x2b23ca[_0x6c4d('0x52')]=_0x508d3d['queue'];_0x2b23ca[_0x6c4d('0x53')]=_0x508d3d[_0x6c4d('0x54')];_0x2b23ca[_0x6c4d('0x3e')]=_0x508d3d[_0x6c4d('0x3e')];return _0x2b23ca;};exports[_0x6c4d('0x59')]=function(_0x509fbb){var _0x24b6c0=[];for(var _0x23b09c in _0x509fbb){if(_0x509fbb['hasOwnProperty'](_0x23b09c)){if(!_[_0x6c4d('0x14')](_0x509fbb[_0x23b09c])&&_0x509fbb[_0x23b09c][_0x6c4d('0x2f')]==='not_inuse'&&_0x509fbb[_0x23b09c][_0x6c4d('0x5a')]===_0x6c4d('0x5b')){_0x24b6c0['push'](_0x509fbb[_0x23b09c]['id']);}}}return _0x24b6c0;};exports['getDiff']=function(_0x2b14ec){var _0x8c1dc3=moment()[_0x6c4d('0x5c')](0x0);var _0x5786ee=moment(_0x2b14ec)[_0x6c4d('0x5c')](0x0);return _0x8c1dc3[_0x6c4d('0x5d')](_0x5786ee,_0x6c4d('0x5e'));};exports[_0x6c4d('0x5f')]=function(_0x2c428e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2c428e[_0x6c4d('0x19')],'ListId':_0x2c428e[_0x6c4d('0x4d')],'VoiceQueueId':_0x2c428e[_0x6c4d('0x1b')]||undefined,'CampaignId':_0x2c428e['CampaignId']||undefined};};exports['filterKey']=function(_0x161f97){if(_0x161f97===_0x6c4d('0x3e')||_0x161f97==='idContact'||_0x161f97===_0x6c4d('0x52')||_0x161f97===_0x6c4d('0x60')||_0x161f97==='campaigntype'||_0x161f97===_0x6c4d('0x61')||_0x161f97===_0x6c4d('0x37')||_0x161f97===_0x6c4d('0x54')||_0x161f97===_0x6c4d('0x17')||_0x161f97===_0x6c4d('0x4a')||_0x161f97==='calleridnum'||_0x161f97==='scheduledat'||_0x161f97===_0x6c4d('0x42')||_0x161f97==='countcongestionretry'||_0x161f97===_0x6c4d('0x62')||_0x161f97==='countglobal'||_0x161f97===_0x6c4d('0x63')||_0x161f97===_0x6c4d('0x64')||_0x161f97==='callbackat'||_0x161f97==='recallme'||_0x161f97===_0x6c4d('0x19')||_0x161f97===_0x6c4d('0x4d')||_0x161f97==='UserId'||_0x161f97===_0x6c4d('0x1b')||_0x161f97===_0x6c4d('0x65')||_0x161f97==='xmd-voicequeueid'||_0x161f97===_0x6c4d('0x66')||_0x161f97===_0x6c4d('0x67')||_0x161f97===_0x6c4d('0x68')||_0x161f97===_0x6c4d('0x69')||_0x161f97===_0x6c4d('0x6a')||_0x161f97===_0x6c4d('0x6b')||_0x161f97===_0x6c4d('0x6c')||_0x161f97==='xmd-dialchannel'||_0x161f97===_0x6c4d('0x6d')||_0x161f97===_0x6c4d('0x6e')||_0x161f97===_0x6c4d('0x6f')||_0x161f97===_0x6c4d('0x70')||_0x161f97==='xmd-agi'||_0x161f97===_0x6c4d('0x71')||_0x161f97===_0x6c4d('0x72')||_0x161f97===_0x6c4d('0x73')||_0x161f97===_0x6c4d('0x74')||_0x161f97===_0x6c4d('0x75')||_0x161f97===_0x6c4d('0x76')||_0x161f97===_0x6c4d('0x77')||_0x161f97===_0x6c4d('0x78')||_0x161f97===_0x6c4d('0x71')||_0x161f97===_0x6c4d('0x72')||_0x161f97==='rtpaudioqosjitter'||_0x161f97===_0x6c4d('0x74')||_0x161f97===_0x6c4d('0x75')||_0x161f97===_0x6c4d('0x76')||_0x161f97===_0x6c4d('0x77')||_0x161f97===_0x6c4d('0x78')||_0x161f97===_0x6c4d('0x79')||_0x161f97==='bridgepvtcallid'||_0x161f97==='state'||_0x161f97==='statedesc'){return![];}return!![];};exports[_0x6c4d('0x7a')]=function(_0x57b5c9,_0x118093){var _0x459739,_0x4b41e3,_0x128d13;if(_0x118093<=0x0){_0x118093=0x1;}_0x459739=new RegExp(_0x6c4d('0x7b')+_0x118093+'}$');_0x4b41e3=Math[_0x6c4d('0x7c')](0xa,_0x118093-0x1);_0x128d13=Math[_0x6c4d('0x7c')](0xa,_0x118093)-0x1;return util['format']('%s',_['replace'](_0x57b5c9,_0x459739,_[_0x6c4d('0x7d')](_0x4b41e3,_0x128d13)));};exports['extractCalleridName']=function(_0x4dfb08){var _0x4b805b=_0x4dfb08['match'](/"(.*?)"/);return _0x4b805b?_0x4b805b[0x1]:_0x4dfb08;};exports[_0x6c4d('0x7e')]=function(_0x39f0c0){var _0x18aeef=_0x39f0c0['match'](/<(.*?)>/);return _0x18aeef?_0x18aeef[0x1]:_0x39f0c0;};function buildNoAnswerEventPayload(_0x3ffd1a,_0x570baa){var _0x4b1be9=buildObj(_0x3ffd1a,_0x6c4d('0x7f'));if(!_[_0x6c4d('0xf')](_0x570baa[_0x6c4d('0x80')])){Object[_0x6c4d('0x81')](_0x570baa[_0x6c4d('0x80')])[_0x6c4d('0x82')](function(_0x2997d2){_0x4b1be9[_0x2997d2[_0x6c4d('0x83')]()]=_0x570baa['variables'][_0x2997d2];});}return _0x4b1be9;}exports[_0x6c4d('0x84')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x8d52=['RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','createBody','CampaignId','type','campaigntype','dialAnswer','active','countglobal','callback','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','\x5cw{0,','replace','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','keys','forEach','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','info','loggerError','error','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','membername','endtime','answertime','isFailure'];(function(_0x43b861,_0x5074ef){var _0xcd330=function(_0x484e3){while(--_0x484e3){_0x43b861['push'](_0x43b861['shift']());}};_0xcd330(++_0x5074ef);}(_0x8d52,0xe5));var _0x28d5=function(_0xc2e3bf,_0x1b0b7f){_0xc2e3bf=_0xc2e3bf-0x0;var _0x2a6b3f=_0x8d52[_0xc2e3bf];return _0x2a6b3f;};'use strict';var util=require(_0x28d5('0x0'));var _=require(_0x28d5('0x1'));var moment=require(_0x28d5('0x2'));var logger=require(_0x28d5('0x3'))(_0x28d5('0x4'));var ipAgi=process[_0x28d5('0x5')][_0x28d5('0x6')]||_0x28d5('0x7');var utils=require(_0x28d5('0x8'));exports[_0x28d5('0x9')]=function(_0x278ba7){return function(_0x43b39c){logger['error'](_0x278ba7,util[_0x28d5('0xa')](_0x43b39c,{'showHidden':![],'depth':null}));};};exports[_0x28d5('0xb')]=function(_0x3fd55c,_0x3734dd){logger[_0x28d5('0xc')](_0x3fd55c,util['inspect'](_0x3734dd,{'showHidden':![],'depth':null}));};exports[_0x28d5('0xd')]=function(_0xde47ff,_0x4bee44){logger[_0x28d5('0xe')](_0xde47ff,util[_0x28d5('0xa')](_0x4bee44,{'showHidden':![],'depth':null}));};exports[_0x28d5('0xf')]=function(_0x1462c9){return function(_0x63c32){logger[_0x28d5('0xc')](_0x1462c9,util['inspect'](_0x63c32,{'showHidden':![],'depth':null}));};};exports[_0x28d5('0x10')]=function(_0x179416,_0x115c1d,_0x1af68d){return{'message':_0x179416,'unlock':_0x115c1d,'active':_0x1af68d};};exports[_0x28d5('0x11')]=function(_0x53ec4e,_0x268919,_0x58d6b6){if(!_[_0x28d5('0x12')](_0x58d6b6)&&_0x28d5('0x13')===typeof _0x58d6b6&&!_[_0x28d5('0x14')](_0x58d6b6)){if(!_[_0x28d5('0x12')](_0x268919)&&_0x28d5('0x13')===typeof _0x268919&&!_[_0x28d5('0x14')](_0x268919)){return util[_0x28d5('0x15')](_0x28d5('0x16'),_0x268919,_0x58d6b6);}return util[_0x28d5('0x15')]('\x22%s\x22\x20<%s>',_0x58d6b6,_0x58d6b6);}if(!_[_0x28d5('0x12')](_0x53ec4e)&&_0x28d5('0x13')===typeof _0x53ec4e&&!_[_0x28d5('0x14')](_0x53ec4e)){return _0x53ec4e;}return'\x22\x22\x20<>';};exports[_0x28d5('0x17')]=function(_0x1fae1d){if(_[_0x28d5('0x18')](_0x1fae1d)){return![];}return _0x1fae1d;};exports[_0x28d5('0x19')]=function(_0x15714d,_0x32a735,_0x5e79ed,_0x503b90,_0x59d482,_0x41fa96){var _0x26185a={'XMD-QUEUE':_0x32a735[_0x28d5('0x1a')]?_0x32a735['Queue'][_0x28d5('0x1b')]:'','XMD-CALLERID':_0x503b90,'XMD-CALLERID-PREVIEW':_0x41fa96?util[_0x28d5('0x15')](_0x28d5('0x16'),_0x41fa96[_0x28d5('0x1c')],_0x41fa96[_0x28d5('0x1d')]):_0x503b90,'XMD-DIALID':_0x59d482,'XMD-CONTACTID':_0x32a735[_0x28d5('0x1e')],'XMD-CDRTYPE':_0x28d5('0x1f'),'CALLERID(all)':_0x503b90,'XMD-VOICEQUEUEID':_0x32a735[_0x28d5('0x20')],'XMD-DIALCHANNEL':_0x5e79ed,'XMD-DIALTIMEOUT':_0x15714d[_0x28d5('0x21')]||0x1e,'XMD-DIALOPTIONS':util[_0x28d5('0x15')](_0x28d5('0x22'),_0x15714d[_0x28d5('0x23')]?'g':'',_['isEmpty'](_0x15714d[_0x28d5('0x24')])?'':_0x28d5('0x25')),'XMD-DIALURL':_0x15714d[_0x28d5('0x26')]||'','XMD-AGI':_0x15714d[_0x28d5('0x27')]?util[_0x28d5('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0x15714d[_0x28d5('0x27')]):_0x28d5('0x28'),'XMD-AGIAFTER':_0x15714d[_0x28d5('0x23')]?util['format'](_0x28d5('0x29'),ipAgi,_0x15714d[_0x28d5('0x23')]):_0x28d5('0x28'),'XMD-ORIGINATECALLERIDNUM':_0x41fa96?_0x41fa96[_0x28d5('0x2a')]:'','XMD-ORIGINATECALLERIDNAME':_0x41fa96?_0x41fa96[_0x28d5('0x2b')]:'','XMD-DESTINATION':_0x28d5('0x2c'),'SIPADDHEADER':_0x28d5('0x2d')};if(!_[_0x28d5('0x14')](_0x15714d[_0x28d5('0x24')])){_0x26185a[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x15714d[_0x28d5('0x24')];_0x26185a[util[_0x28d5('0x15')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x59d482;}return _0x26185a;};exports[_0x28d5('0x2e')]=function(_0x3740c5){var _0x47840d={};for(var _0x27d4d7 in _0x3740c5){if(_0x3740c5[_0x28d5('0x2f')](_0x27d4d7)){_0x47840d[util[_0x28d5('0x15')]('%s',_[_0x28d5('0x30')](_0x27d4d7))]=_0x3740c5[_0x27d4d7];}}return{'variables':_0x47840d};};exports[_0x28d5('0x31')]=function(_0x259c48,_0x26b288){if(!_[_0x28d5('0x18')](_0x259c48)){if(_0x259c48['hasOwnProperty'](_0x28d5('0x32'))){if(_0x259c48['originated']>0x0){_0x259c48[_0x28d5('0x32')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x26b288);}}}else{logger[_0x28d5('0xe')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x26b288);}};exports[_0x28d5('0x33')]=function(_0x4d0044){var _0x534fdf=moment()[_0x28d5('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x4d0044[_0x28d5('0x34')]=0xd;_0x4d0044[_0x28d5('0x35')]=_0x28d5('0x36');_0x4d0044[_0x28d5('0x37')]=_0x534fdf;_0x4d0044[_0x28d5('0x38')]=_0x534fdf;_0x4d0044['endtime']=_0x534fdf;};exports[_0x28d5('0x39')]=function(_0x349d79,_0x135366,_0x5373c8){var _0x17812f=moment()['format'](_0x28d5('0x3a'));_0x349d79[_0x28d5('0x34')]=_0x135366;_0x349d79[_0x28d5('0x35')]=_0x5373c8;_0x349d79[_0x28d5('0x38')]=_0x17812f;_0x349d79[_0x28d5('0x3b')]=utils[_0x28d5('0x3c')](_0x349d79[_0x28d5('0x38')],_0x349d79[_0x28d5('0x37')]);};exports['logLookAgent']=function(_0x53bc2a,_0xae740b,_0x20c738){_0x53bc2a[_0x28d5('0x3d')]=_0xae740b;_0x53bc2a['UserId']=_0x20c738;};exports['logCustomer']=function(_0x2e028e,_0x3adf13,_0xc8009b){var _0x4d2b9e=moment()[_0x28d5('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e028e[_0x28d5('0x34')]=_0x3adf13;_0x2e028e[_0x28d5('0x35')]=_0xc8009b;_0x2e028e[_0x28d5('0x38')]=_0x2e028e[_0x28d5('0x38')]?_0x2e028e[_0x28d5('0x38')]:_0x4d2b9e;_0x2e028e[_0x28d5('0x3e')]=_0x2e028e[_0x28d5('0x3e')]?_0x2e028e[_0x28d5('0x3e')]:_0x4d2b9e;_0x2e028e['ringtime']=utils['getSeconds'](_0x2e028e[_0x28d5('0x38')]||0x0,_0x2e028e[_0x28d5('0x37')]||0x0);_0x2e028e['talktime']=_0x2e028e[_0x28d5('0x3f')]?utils[_0x28d5('0x3c')](_0x2e028e[_0x28d5('0x3e')],_0x2e028e[_0x28d5('0x3f')]):0x0;};exports[_0x28d5('0x40')]=function(_0x32d0b5){return _0x32d0b5==='Failure';};exports['variablesAction']=function(_0x5c9dab,_0x1e9748,_0x5dc029,_0x5d8f4c,_0x155c78){var _0x5111cf=_0x5d8f4c?_0x28d5('0x41'):_0x5c9dab[_0x28d5('0x1c')];_0x5111cf=_0x155c78?_0x28d5('0x42'):_0x5111cf;return{'actionid':_0x5c9dab[_0x28d5('0x43')],'action':_0x28d5('0x44'),'channel':_0x5c9dab[_0x28d5('0x45')],'callerid':util[_0x28d5('0x15')]('\x22%s\x22\x20<%s>',_0x5111cf,_0x5c9dab[_0x28d5('0x1d')]),'Exten':'xcally-motion-preview','Context':_0x28d5('0x46'),'Priority':'1','variable':_0x5dc029,'timeout':(_0x1e9748[_0x28d5('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5c9dab[_0x28d5('0x43')]};};exports[_0x28d5('0x48')]=function(_0x4dcc9d){return _0x4dcc9d[_0x28d5('0x49')]+_0x4dcc9d[_0x28d5('0x4a')]+_0x4dcc9d[_0x28d5('0x4b')]+_0x4dcc9d[_0x28d5('0x4c')]+_0x4dcc9d[_0x28d5('0x4d')];};exports['cloneAction']=function(_0x5e9f79){var _0x3b8ae1=_[_0x28d5('0x4e')](_0x5e9f79);_0x3b8ae1[_0x28d5('0x34')]=0xf;_0x3b8ae1['statedesc']=_0x28d5('0x4f');return _0x3b8ae1;};exports[_0x28d5('0x50')]=function(_0xd5e090,_0x363c59,_0x170a6a){var _0x364a66={};_0x364a66[_0x363c59]=_0xd5e090[_0x363c59];_0x364a66['active']=![];_0x364a66[_0x28d5('0x51')]=moment()[_0x28d5('0x52')](_0x170a6a,_0x28d5('0x53'))[_0x28d5('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x364a66[_0x28d5('0x1e')]=_0xd5e090[_0x28d5('0x1e')];_0x364a66[_0x28d5('0x54')]=_0xd5e090[_0x28d5('0x54')];_0x364a66[_0x28d5('0x20')]=_0xd5e090[_0x28d5('0x20')]||undefined;return _0x364a66;};exports[_0x28d5('0x55')]=function(_0x1460ce,_0xbf63f4){if(!_[_0x28d5('0x18')](_0x1460ce)){if(_0x1460ce[_0x28d5('0x56')]>0x0){_0x1460ce[_0x28d5('0x56')]-=0x1;}else{logger[_0x28d5('0xe')](_0xbf63f4,_0x28d5('0x57'));}}else{logger[_0x28d5('0xe')](_0xbf63f4,_0x28d5('0x58'));}};exports[_0x28d5('0x59')]=function(_0x28ca67){if(_0x28ca67<=0x0){return!![];}return![];};function buildObj(_0x1c4c22,_0x48b278,_0x1dc71d){_0x1c4c22[_0x28d5('0x5a')]=_0x48b278;_0x1c4c22[_0x28d5('0x1b')]=_0x1c4c22[_0x28d5('0x5b')];_0x1c4c22[_0x28d5('0x5c')]=_0x1c4c22['channelAgent'];_0x1c4c22[_0x28d5('0x5d')]=_0x28d5('0x5e');if(_0x1dc71d){_0x1c4c22[_0x28d5('0x5f')]=_0x1dc71d[_0x28d5('0x5f')];}return _0x1c4c22;}exports[_0x28d5('0x60')]=buildObj;exports[_0x28d5('0x61')]=function(_0x396b11){var _0x4f7138={};_0x4f7138[_0x28d5('0x5b')]=_0x396b11[_0x28d5('0x5b')];_0x4f7138[_0x28d5('0x5c')]=_0x396b11[_0x28d5('0x45')];_0x4f7138[_0x28d5('0x43')]=_0x396b11[_0x28d5('0x43')];return _0x4f7138;};exports[_0x28d5('0x62')]=function(_0x2cf61a){var _0x1da03e=[];for(var _0x5de2fa in _0x2cf61a){if(_0x2cf61a[_0x28d5('0x2f')](_0x5de2fa)){if(!_[_0x28d5('0x18')](_0x2cf61a[_0x5de2fa])&&_0x2cf61a[_0x5de2fa][_0x28d5('0x34')]===_0x28d5('0x63')&&_0x2cf61a[_0x5de2fa][_0x28d5('0x64')]===_0x28d5('0x65')){_0x1da03e[_0x28d5('0x66')](_0x2cf61a[_0x5de2fa]['id']);}}}return _0x1da03e;};exports[_0x28d5('0x67')]=function(_0x563d81){var _0x5c1c4b=moment()[_0x28d5('0x68')](0x0);var _0x50889e=moment(_0x563d81)[_0x28d5('0x68')](0x0);return _0x5c1c4b[_0x28d5('0x69')](_0x50889e,'seconds');};exports[_0x28d5('0x6a')]=function(_0x5b8006){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5b8006[_0x28d5('0x1e')],'ListId':_0x5b8006[_0x28d5('0x54')],'VoiceQueueId':_0x5b8006[_0x28d5('0x20')]||undefined,'CampaignId':_0x5b8006[_0x28d5('0x6b')]||undefined};};exports['filterKey']=function(_0x54f833){if(_0x54f833==='uniqueid'||_0x54f833==='idContact'||_0x54f833==='queue'||_0x54f833===_0x28d5('0x6c')||_0x54f833===_0x28d5('0x6d')||_0x54f833===_0x28d5('0x6e')||_0x54f833===_0x28d5('0x3d')||_0x54f833===_0x28d5('0x45')||_0x54f833===_0x28d5('0x1c')||_0x54f833===_0x28d5('0x6f')||_0x54f833==='calleridnum'||_0x54f833===_0x28d5('0x51')||_0x54f833===_0x28d5('0x49')||_0x54f833===_0x28d5('0x4a')||_0x54f833===_0x28d5('0x4b')||_0x54f833===_0x28d5('0x70')||_0x54f833===_0x28d5('0x71')||_0x54f833==='callbackuniqueid'||_0x54f833===_0x28d5('0x72')||_0x54f833===_0x28d5('0x73')||_0x54f833===_0x28d5('0x1e')||_0x54f833===_0x28d5('0x54')||_0x54f833===_0x28d5('0x74')||_0x54f833===_0x28d5('0x20')||_0x54f833===_0x28d5('0x75')||_0x54f833===_0x28d5('0x76')||_0x54f833==='xmd-queue'||_0x54f833===_0x28d5('0x77')||_0x54f833===_0x28d5('0x78')||_0x54f833===_0x28d5('0x79')||_0x54f833==='xmd-dialtimeout'||_0x54f833===_0x28d5('0x7a')||_0x54f833===_0x28d5('0x7b')||_0x54f833==='xmd-dialchannel'||_0x54f833===_0x28d5('0x7c')||_0x54f833===_0x28d5('0x7d')||_0x54f833===_0x28d5('0x7e')||_0x54f833==='xmd-agiafter'||_0x54f833==='xmd-agi'||_0x54f833===_0x28d5('0x7f')||_0x54f833==='rtpaudioqosbridged'||_0x54f833===_0x28d5('0x80')||_0x54f833===_0x28d5('0x81')||_0x54f833===_0x28d5('0x82')||_0x54f833==='rtpaudioqoslossbridged'||_0x54f833==='rtpaudioqosrtt'||_0x54f833===_0x28d5('0x83')||_0x54f833===_0x28d5('0x7f')||_0x54f833==='rtpaudioqosbridged'||_0x54f833===_0x28d5('0x80')||_0x54f833==='rtpaudioqosjitterbridged'||_0x54f833===_0x28d5('0x82')||_0x54f833===_0x28d5('0x84')||_0x54f833===_0x28d5('0x85')||_0x54f833===_0x28d5('0x83')||_0x54f833===_0x28d5('0x86')||_0x54f833==='bridgepvtcallid'||_0x54f833===_0x28d5('0x34')||_0x54f833===_0x28d5('0x35')){return![];}return!![];};exports[_0x28d5('0x87')]=function(_0x226440,_0x13bcce){var _0x343846,_0x440745,_0x5cb73d;if(_0x13bcce<=0x0){_0x13bcce=0x1;}_0x343846=new RegExp(_0x28d5('0x88')+_0x13bcce+'}$');_0x440745=Math['pow'](0xa,_0x13bcce-0x1);_0x5cb73d=Math['pow'](0xa,_0x13bcce)-0x1;return util[_0x28d5('0x15')]('%s',_[_0x28d5('0x89')](_0x226440,_0x343846,_[_0x28d5('0x8a')](_0x440745,_0x5cb73d)));};exports[_0x28d5('0x8b')]=function(_0x35e214){var _0x256367=_0x35e214['match'](/"(.*?)"/);return _0x256367?_0x256367[0x1]:_0x35e214;};exports[_0x28d5('0x8c')]=function(_0x3032a8){var _0x11e2cd=_0x3032a8[_0x28d5('0x8d')](/<(.*?)>/);return _0x11e2cd?_0x11e2cd[0x1]:_0x3032a8;};function buildNoAnswerEventPayload(_0x2b846c,_0x4e7c53){var _0x4a9549=buildObj(_0x2b846c,_0x28d5('0x8e'));if(!_[_0x28d5('0x14')](_0x4e7c53[_0x28d5('0x8f')])){Object[_0x28d5('0x90')](_0x4e7c53['variables'])[_0x28d5('0x91')](function(_0x3108da){_0x4a9549[_0x3108da['toLowerCase']()]=_0x4e7c53['variables'][_0x3108da];});}return _0x4a9549;}exports[_0x28d5('0x92')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 3cb2050..ba8678c 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 _0xbfde=['queueadd','string','number','boolean','queueremove','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x58838e,_0x33ad08){var _0x4ae8dc=function(_0x209667){while(--_0x209667){_0x58838e['push'](_0x58838e['shift']());}};_0x4ae8dc(++_0x33ad08);}(_0xbfde,0x10e));var _0xebfd=function(_0x207edf,_0x49fe68){_0x207edf=_0x207edf-0x0;var _0x2e6026=_0xbfde[_0x207edf];return _0x2e6026;};'use strict';exports[_0xebfd('0x0')]={'queue':{'type':_0xebfd('0x1'),'required':!![]},'interface':{'type':_0xebfd('0x1'),'required':!![]},'membername':{'type':_0xebfd('0x1'),'required':!![]},'penalty':{'type':_0xebfd('0x2'),'required':![]},'paused':{'type':_0xebfd('0x3'),'required':![]}};exports[_0xebfd('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xebfd('0x1'),'required':!![]}};exports[_0xebfd('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xebfd('0x3')},'reason':{'type':_0xebfd('0x1'),'required':![]}};exports['reload']={'module':{'type':_0xebfd('0x1'),'required':![]}};exports[_0xebfd('0x6')]={'uniqueid':{'type':_0xebfd('0x1'),'required':!![]}};exports[_0xebfd('0x7')]={'uniqueid':{'type':_0xebfd('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0xebfd('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xebfd('0x1'),'required':!![]},'exten':{'type':_0xebfd('0x1'),'required':!![]},'context':{'type':_0xebfd('0x1')}}; \ No newline at end of file +var _0x5088=['string','number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x331085,_0x46ef3b){var _0x1547f4=function(_0x549b5d){while(--_0x549b5d){_0x331085['push'](_0x331085['shift']());}};_0x1547f4(++_0x46ef3b);}(_0x5088,0x1a3));var _0x8508=function(_0x385b70,_0x52974f){_0x385b70=_0x385b70-0x0;var _0x33e2ef=_0x5088[_0x385b70];return _0x33e2ef;};'use strict';exports[_0x8508('0x0')]={'queue':{'type':_0x8508('0x1'),'required':!![]},'interface':{'type':_0x8508('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x8508('0x2'),'required':![]},'paused':{'type':_0x8508('0x3'),'required':![]}};exports[_0x8508('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8508('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x8508('0x1'),'required':!![]},'paused':{'type':_0x8508('0x3')},'reason':{'type':_0x8508('0x1'),'required':![]}};exports[_0x8508('0x5')]={'module':{'type':_0x8508('0x1'),'required':![]}};exports[_0x8508('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x8508('0x7')]={'uniqueid':{'type':_0x8508('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0x8508('0x1')}};exports[_0x8508('0x8')]={'uniqueid':{'type':_0x8508('0x1'),'required':!![]}};exports[_0x8508('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x8508('0x1'),'required':!![]},'context':{'type':_0x8508('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 9f2c224..161eb0f 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 _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0xbf18c0,_0x51e936){var _0x47b057=function(_0x3caed2){while(--_0x3caed2){_0xbf18c0['push'](_0xbf18c0['shift']());}};_0x47b057(++_0x51e936);}(_0xb10b,0x12a));var _0xbb10=function(_0x30a2b4,_0x2fe7b3){_0x30a2b4=_0x30a2b4-0x0;var _0x1b2bef=_0xb10b[_0x30a2b4];return _0x1b2bef;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x101ce2,_0x2f3ef5){var _0x9dc5eb=function(_0x45a2ef){while(--_0x45a2ef){_0x101ce2['push'](_0x101ce2['shift']());}};_0x9dc5eb(++_0x2f3ef5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 2da578b..d239b7b 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef14=['mergeDBDataToRealtime'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xef14,0x160));var _0x4ef1=function(_0x25b4b1,_0x48a351){_0x25b4b1=_0x25b4b1-0x0;var _0x5e2323=_0xef14[_0x25b4b1];return _0x5e2323;};'use strict';function mergeDBDataToRealtime(_0x23875d,_0x255773){var _0x423b10=Object['assign']({},_0x23875d);for(var _0x3d516b in _0x255773){if(_0x423b10['hasOwnProperty'](_0x3d516b)){_0x423b10[_0x3d516b]=_0x255773[_0x3d516b];}}return _0x423b10;}exports[_0x4ef1('0x0')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x4724=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0xcc27e3,_0xf159c4){var _0x1c4ba1=function(_0x4e2d8b){while(--_0x4e2d8b){_0xcc27e3['push'](_0xcc27e3['shift']());}};_0x1c4ba1(++_0xf159c4);}(_0x4724,0xc2));var _0x4472=function(_0x58379a,_0x1840de){_0x58379a=_0x58379a-0x0;var _0xf88d78=_0x4724[_0x58379a];return _0xf88d78;};'use strict';function mergeDBDataToRealtime(_0x589b21,_0x2d7c98){var _0x4965f6=Object[_0x4472('0x0')]({},_0x589b21);for(var _0x1fcacc in _0x2d7c98){if(_0x4965f6[_0x4472('0x1')](_0x1fcacc)){_0x4965f6[_0x1fcacc]=_0x2d7c98[_0x1fcacc];}}return _0x4965f6;}exports[_0x4472('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 7b5b456..110de0e 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 _0x632c=['dialer','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','UserId','membername','monitor','monitorFilename','monitors','createdAt','exten','connectedlinename','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./userReport','agents','telephones','prototype','realtime','xdr','disabled','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','format','SIP/%s','voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','interface','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','type'];(function(_0x1bb494,_0x15443c){var _0x4c895c=function(_0x373e56){while(--_0x373e56){_0x1bb494['push'](_0x1bb494['shift']());}};_0x4c895c(++_0x15443c);}(_0x632c,0xd5));var _0xc632=function(_0x14aa23,_0x55860e){_0x14aa23=_0x14aa23-0x0;var _0x3daf0c=_0x632c[_0x14aa23];return _0x3daf0c;};'use strict';var _=require(_0xc632('0x0'));var moment=require(_0xc632('0x1'));var util=require('util');var config=require('../../../config/environment');var ami=require(_0xc632('0x2'));var RpcVoiceAgentReport=require(_0xc632('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xc632('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xc632('0x5'));var RpcVoiceRecording=require(_0xc632('0x6'));var RpcVoiceTransferReport=require(_0xc632('0x7'));var VoiceQueueReport=require(_0xc632('0x8'));var VoiceCallReport=require(_0xc632('0x9'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xc632('0xa'));function Report(_0x4c65d5){this['realtime']=_0x4c65d5;this['agents']=_0x4c65d5[_0xc632('0xb')];this[_0xc632('0xc')]=_0x4c65d5[_0xc632('0xc')];}Report[_0xc632('0xd')]['sync']=function(_0x55c2d6){var _0x4876e2=new VoiceQueueReport(this['realtime']);var _0x11778f=new VoiceAgentReport(this[_0xc632('0xe')]);var _0x5e5efd=new VoiceDialReport(this[_0xc632('0xe')]);var _0x4af7d1=new VoiceCallReport(this[_0xc632('0xe')]);var _0x3cbdcc=new UserReport(this[_0xc632('0xe')]);if(config[_0xc632('0xf')]&&config[_0xc632('0xf')][_0xc632('0x10')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0xc632('0x11')](this));ami['on']('custom:voiceCallReport',this[_0xc632('0x12')][_0xc632('0x11')](this));ami['on'](_0xc632('0x13'),this[_0xc632('0x14')]['bind'](this));ami['on'](_0xc632('0x15'),this[_0xc632('0x16')][_0xc632('0x11')](this));ami['on'](_0xc632('0x17'),this[_0xc632('0x18')][_0xc632('0x11')](this));ami['on'](_0xc632('0x19'),this[_0xc632('0x1a')][_0xc632('0x11')](this));}};Report[_0xc632('0xd')][_0xc632('0x1b')]=function(_0x74e4a8){var _0x42baf9;_0x42baf9=_[_0xc632('0x1c')](this[_0xc632('0xb')],function(_0x5848d2){return _0x5848d2[_0xc632('0x1d')]==_0x74e4a8||_0x5848d2['name']==_0x74e4a8;});if(_['isNil'](_0x42baf9)){var _0x170b33=_[_0xc632('0x1c')](this['telephones'],function(_0x53390a){return _0x53390a[_0xc632('0x1d')]==_0x74e4a8||_0x53390a[_0xc632('0x1e')]==_0x74e4a8;});if(_0x170b33){_0x42baf9=_[_0xc632('0x1c')](this['agents'],function(_0x4078c1){return _0x4078c1['interface']==util[_0xc632('0x1f')](_0xc632('0x20'),_0x170b33[_0xc632('0x1e')]);});}}return _0x42baf9;};Report[_0xc632('0xd')][_0xc632('0x21')]=function(_0x424ec2){for(var _0x2e7f23=0x0;_0x2e7f23<_0x424ec2[_0xc632('0x22')];_0x2e7f23+=0x1){var _0x422aac=this[_0xc632('0x1b')](_0x424ec2[_0x2e7f23][_0xc632('0x23')]);if(_0x422aac){_0x424ec2[_0x2e7f23]['accountcode']=_0x422aac[_0xc632('0x1d')];_0x424ec2[_0x2e7f23][_0xc632('0x24')]=!![];_0x424ec2[_0x2e7f23][_0xc632('0x25')]=_0x422aac[_0xc632('0x1e')];_0x424ec2[_0x2e7f23][_0xc632('0x26')]=_['isNil'](_0x422aac['interface'])?util[_0xc632('0x1f')](_0xc632('0x20'),_0x422aac[_0xc632('0x1e')]):_0x422aac[_0xc632('0x26')];if(_0x424ec2[_0x2e7f23]['queuecallercomplete']){_0x424ec2[_0x2e7f23][_0xc632('0x27')]=moment()[_0xc632('0x1f')](_0xc632('0x28'));}if(_0x424ec2[_0x2e7f23][_0xc632('0x29')]){_0x424ec2[_0x2e7f23][_0xc632('0x2a')]=moment()[_0xc632('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x424ec2[_0x2e7f23]);}RpcVoiceQueueReport[_0xc632('0x2b')](_0x424ec2[_0x2e7f23]);}};function extractCalleridNumber(_0x59cd9f){var _0x2828a7=_0x59cd9f['match'](/<(.*?)>/);return _0x2828a7?_0x2828a7[0x1]:_0x59cd9f;}Report[_0xc632('0xd')][_0xc632('0x2c')]=function(_0x421ad8){for(var _0x2d9769=0x0;_0x2d9769','calleridname','transfers','linkedid','uniqueid','UserId','membername','monitors','filename','createdAt','exten','connectedlinename','xcally-motion-dialer','forEach','startsWith','Local'];(function(_0x310bc2,_0x453c97){var _0x353226=function(_0x28d173){while(--_0x28d173){_0x310bc2['push'](_0x310bc2['shift']());}};_0x353226(++_0x453c97);}(_0x75f7,0x1c9));var _0x775f=function(_0x33c7de,_0x3f6793){_0x33c7de=_0x33c7de-0x0;var _0xe6a895=_0x75f7[_0x33c7de];return _0xe6a895;};'use strict';var _=require(_0x775f('0x0'));var moment=require(_0x775f('0x1'));var util=require(_0x775f('0x2'));var config=require(_0x775f('0x3'));var ami=require(_0x775f('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x775f('0x5'));var RpcVoiceDialReport=require(_0x775f('0x6'));var RpcMemberReport=require(_0x775f('0x7'));var RpcVoiceQueueReport=require(_0x775f('0x8'));var RpcVoiceRecording=require(_0x775f('0x9'));var RpcVoiceTransferReport=require(_0x775f('0xa'));var VoiceQueueReport=require(_0x775f('0xb'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x775f('0xc'));var VoiceDialReport=require(_0x775f('0xd'));var UserReport=require(_0x775f('0xe'));function Report(_0x2c9715){this[_0x775f('0xf')]=_0x2c9715;this[_0x775f('0x10')]=_0x2c9715[_0x775f('0x10')];this[_0x775f('0x11')]=_0x2c9715[_0x775f('0x11')];}Report[_0x775f('0x12')][_0x775f('0x13')]=function(_0x359b7a){var _0xd3a72e=new VoiceQueueReport(this[_0x775f('0xf')]);var _0xd73b5e=new VoiceAgentReport(this['realtime']);var _0x45885e=new VoiceDialReport(this[_0x775f('0xf')]);var _0xfb6ca9=new VoiceCallReport(this[_0x775f('0xf')]);var _0x224cca=new UserReport(this[_0x775f('0xf')]);if(config[_0x775f('0x14')]&&config[_0x775f('0x14')]['disabled']){ami['on'](_0x775f('0x15'),this[_0x775f('0x16')]['bind'](this));ami['on'](_0x775f('0x17'),this[_0x775f('0x18')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x775f('0x19')][_0x775f('0x1a')](this));ami['on'](_0x775f('0x1b'),this[_0x775f('0x1c')][_0x775f('0x1a')](this));ami['on'](_0x775f('0x1d'),this[_0x775f('0x1e')][_0x775f('0x1a')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x775f('0x1a')](this));}};Report[_0x775f('0x12')][_0x775f('0x1f')]=function(_0x52c567){var _0x5d477a;_0x5d477a=_['find'](this[_0x775f('0x10')],function(_0x37b645){return _0x37b645[_0x775f('0x20')]==_0x52c567||_0x37b645['name']==_0x52c567;});if(_[_0x775f('0x21')](_0x5d477a)){var _0x442b1c=_[_0x775f('0x22')](this[_0x775f('0x11')],function(_0x232283){return _0x232283[_0x775f('0x20')]==_0x52c567||_0x232283[_0x775f('0x23')]==_0x52c567;});if(_0x442b1c){_0x5d477a=_[_0x775f('0x22')](this[_0x775f('0x10')],function(_0x388aa2){return _0x388aa2[_0x775f('0x24')]==util['format'](_0x775f('0x25'),_0x442b1c[_0x775f('0x23')]);});}}return _0x5d477a;};Report['prototype'][_0x775f('0x16')]=function(_0x33d0c1){for(var _0xe19fb5=0x0;_0xe19fb5<_0x33d0c1[_0x775f('0x26')];_0xe19fb5+=0x1){var _0x54fa3=this[_0x775f('0x1f')](_0x33d0c1[_0xe19fb5][_0x775f('0x27')]);if(_0x54fa3){_0x33d0c1[_0xe19fb5][_0x775f('0x20')]=_0x54fa3['accountcode'];_0x33d0c1[_0xe19fb5][_0x775f('0x28')]=!![];_0x33d0c1[_0xe19fb5][_0x775f('0x29')]=_0x54fa3[_0x775f('0x23')];_0x33d0c1[_0xe19fb5]['interface']=_['isNil'](_0x54fa3['interface'])?util[_0x775f('0x2a')](_0x775f('0x25'),_0x54fa3['name']):_0x54fa3[_0x775f('0x24')];if(_0x33d0c1[_0xe19fb5][_0x775f('0x2b')]){_0x33d0c1[_0xe19fb5][_0x775f('0x2c')]=moment()[_0x775f('0x2a')](_0x775f('0x2d'));}if(_0x33d0c1[_0xe19fb5][_0x775f('0x2e')]){_0x33d0c1[_0xe19fb5]['queuecallerexitAt']=moment()[_0x775f('0x2a')](_0x775f('0x2d'));}RpcMemberReport['voiceQueueReport'](_0x33d0c1[_0xe19fb5]);}RpcVoiceQueueReport[_0x775f('0x2f')](_0x33d0c1[_0xe19fb5]);}};function extractCalleridNumber(_0x8fde96){var _0x4f0955=_0x8fde96['match'](/<(.*?)>/);return _0x4f0955?_0x4f0955[0x1]:_0x8fde96;}Report[_0x775f('0x12')][_0x775f('0x30')]=function(_0x22267e){for(var _0x466117=0x0;_0x4661170x0?!![]:![];if(!_0x2ff988){return this[_0x0b51('0x1c')](this[_0x0b51('0x18')]['completeEvent']);}};VoiceQueueReport['prototype'][_0x0b51('0x1e')]=function(_0x25d230){var _0x176edd=this['summary']['id'];if(this[_0x0b51('0x18')][_0x0b51('0x64')][_0x176edd]&&this[_0x0b51('0x18')]['queuestatus'][_0x176edd][_0x25d230[_0x0b51('0x63')]]){this[_0x0b51('0x18')]['queuestatus'][_0x176edd][_0x25d230['actionid']][_0x0b51('0x13')][_0x0b51('0x6f')](_0x25d230);}};VoiceQueueReport[_0x0b51('0xc')][_0x0b51('0x70')]=function(_0x24cfd8){var _0x2fbf6=this;try{if(this[_0x0b51('0x5c')](_0x24cfd8)&&this[_0x0b51('0x5c')](_0x24cfd8[_0x0b51('0x51')])){logger[_0x0b51('0x4c')](_0x0b51('0x71'),util['inspect'](_0x24cfd8,{'showHidden':![],'depth':null}));var _0x2147e6=this[_0x0b51('0x16')][_0x24cfd8[_0x0b51('0x51')]];if(_0x2147e6){logger[_0x0b51('0x4c')](_0x0b51('0x72'),_0x2147e6[_0x0b51('0x5a')]);this[_0x0b51('0x18')][_0x0b51('0x5e')][_0x2147e6[_0x0b51('0x5a')]]={'summaryEvent':_0x24cfd8};this[_0x0b51('0x18')]['statusRequests']+=0x1;return ami[_0x0b51('0x3d')]({'action':_0x0b51('0x64'),'queue':_0x2147e6[_0x0b51('0x5a')]})[_0x0b51('0x62')](function(_0x48fb34){if(!_0x2fbf6['summary'][_0x0b51('0x64')][_0x24cfd8[_0x0b51('0x63')]]){_0x2fbf6[_0x0b51('0x18')]['queuestatus'][_0x24cfd8[_0x0b51('0x63')]]={};}_0x2fbf6[_0x0b51('0x18')]['queuestatus'][_0x24cfd8[_0x0b51('0x63')]][_0x48fb34[_0x0b51('0x63')]]={'queue':_0x2147e6[_0x0b51('0x5a')],'agents':[]};})['catch'](function(_0x4fe8ba){throw _0x4fe8ba;});}}}catch(_0x23e16f){logger['error'](_0x0b51('0x73'),util[_0x0b51('0x43')](_0x23e16f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0b51('0x1c')]=function(_0x4b9b09){if(this[_0x0b51('0x18')][_0x0b51('0x6e')]>0x0){this[_0x0b51('0x18')][_0x0b51('0x74')]=_0x4b9b09;return;}logger[_0x0b51('0x4c')](_0x0b51('0x75'),util['inspect'](_0x4b9b09,{'showHidden':![],'depth':null}));this[_0x0b51('0x18')]=initializeSummary();ami[_0x0b51('0x4a')](_0x0b51('0x76'),{});};VoiceQueueReport[_0x0b51('0xc')]['syncQueueCallerJoin']=function(_0x172716){try{if(this[_0x0b51('0x5c')](_0x172716)){logger[_0x0b51('0x4c')](_0x0b51('0x77'),_0x172716[_0x0b51('0x4e')],util[_0x0b51('0x43')](_0x172716,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x0b51('0x11')][_0x172716['uniqueid']])){this['queueReports'][_0x172716[_0x0b51('0x4e')]]=[];}if(_[_0x0b51('0x5d')](this['channels'][_0x172716['uniqueid']])){this[_0x0b51('0x14')][_0x172716[_0x0b51('0x4e')]]={};}var _0x14e4cf=new QueueReport();_0x14e4cf[_0x0b51('0x51')]=_0x172716[_0x0b51('0x51')];_0x14e4cf[_0x0b51('0x57')]=this[_0x0b51('0x16')][_0x14e4cf['queue']]&&this['voiceQueues'][_0x14e4cf['queue']][_0x0b51('0x57')]?this[_0x0b51('0x16')][_0x14e4cf[_0x0b51('0x51')]][_0x0b51('0x57')]||_0x0b51('0x58'):_0x0b51('0x58');_0x14e4cf[_0x0b51('0x78')]=moment()[_0x0b51('0x4f')](_0x0b51('0x79'));_0x14e4cf['position']=_0x172716[_0x0b51('0x7a')];_0x14e4cf[_0x0b51('0x7b')]=_0x172716['count'];_0x14e4cf[_0x0b51('0x4e')]=_0x172716['uniqueid'];_0x14e4cf[_0x0b51('0x7c')]=this[_0x0b51('0x14')][_0x172716[_0x0b51('0x4e')]]['routealias'];logger[_0x0b51('0x7d')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x14e4cf[_0x0b51('0x51')],_0x14e4cf[_0x0b51('0x57')]);Object[_0x0b51('0x6a')](_0x14e4cf,_[_0x0b51('0x7e')](_0x172716,_[_0x0b51('0x7f')](_0x14e4cf)));this[_0x0b51('0x11')][_0x172716[_0x0b51('0x4e')]][_0x0b51('0x6f')](_0x14e4cf);this[_0x0b51('0x14')][_0x172716[_0x0b51('0x4e')]]=_0x14e4cf;this[_0x0b51('0x4b')](_0x14e4cf,_0x0b51('0x1f'));}}catch(_0x11d7b0){logger[_0x0b51('0x42')](_0x0b51('0x77'),_0x172716['uniqueid'],util[_0x0b51('0x43')](_0x11d7b0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0b51('0xc')][_0x0b51('0x80')]=function(_0x513633){try{if(this[_0x0b51('0x5c')](_0x513633)){logger['debug'](_0x0b51('0x81'),_0x513633[_0x0b51('0x4e')],util['inspect'](_0x513633,{'showHidden':![],'depth':null}));if(this[_0x0b51('0x11')][_0x513633[_0x0b51('0x4e')]]){var _0x9cca08=_[_0x0b51('0x82')](this[_0x0b51('0x11')][_0x513633['uniqueid']]);_0x9cca08[_0x0b51('0x83')]=![];_0x9cca08[_0x0b51('0x84')]=null;_0x9cca08['holdtime']=_0x513633[_0x0b51('0x85')];_0x9cca08[_0x0b51('0x86')]=_0x513633['originalposition'];_0x9cca08['queuecallerabandon']=!![];_0x9cca08[_0x0b51('0x87')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x9cca08['queuecallerexitreason']=_0x0b51('0x88');_0x9cca08[_0x0b51('0x89')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x9cca08['queue'],_0x9cca08[_0x0b51('0x57')]);this[_0x0b51('0x14')][_0x513633[_0x0b51('0x4e')]]=_0x9cca08;this['emitVoiceQueueChannelRemove'](_0x9cca08,_0x0b51('0x21'));}}}catch(_0x4694a0){logger[_0x0b51('0x42')](_0x0b51('0x81'),_0x513633[_0x0b51('0x4e')],util['inspect'](_0x4694a0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0b51('0x23')]=function(_0x323d6c){try{if(this[_0x0b51('0x5c')](_0x323d6c)){logger[_0x0b51('0x4c')](_0x0b51('0x8a'),_0x323d6c[_0x0b51('0x4e')],util[_0x0b51('0x43')](_0x323d6c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x323d6c[_0x0b51('0x4e')]]){var _0x288d7c=_[_0x0b51('0x82')](this[_0x0b51('0x11')][_0x323d6c['uniqueid']]);_0x288d7c[_0x0b51('0x8b')]=moment()[_0x0b51('0x4f')](_0x0b51('0x79'));_0x288d7c[_0x0b51('0x8c')]=_0x323d6c[_0x0b51('0x8c')];_0x288d7c[_0x0b51('0x8d')]=_0x323d6c[_0x0b51('0x8d')];logger[_0x0b51('0x7d')](_0x0b51('0x8e'),_0x288d7c[_0x0b51('0x51')],_0x288d7c[_0x0b51('0x57')],_0x323d6c[_0x0b51('0x8c')],_0x323d6c[_0x0b51('0x8d')]);this[_0x0b51('0x14')][_0x323d6c['uniqueid']]=_0x288d7c;this[_0x0b51('0x4b')](_0x288d7c,_0x0b51('0x22'));}}}catch(_0x52ace5){logger[_0x0b51('0x42')](_0x0b51('0x8a'),_0x323d6c[_0x0b51('0x4e')],util[_0x0b51('0x43')](_0x52ace5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0b51('0xc')]['syncAgentConnect']=function(_0x493c77){try{if(this[_0x0b51('0x5c')](_0x493c77)){logger[_0x0b51('0x4c')](_0x0b51('0x8f'),_0x493c77[_0x0b51('0x4e')],util[_0x0b51('0x43')](_0x493c77,{'showHidden':![],'depth':null}));if(this[_0x0b51('0x11')][_0x493c77[_0x0b51('0x4e')]]){var _0x33faed=_[_0x0b51('0x82')](this[_0x0b51('0x11')][_0x493c77[_0x0b51('0x4e')]]);_0x33faed[_0x0b51('0x83')]=!![];_0x33faed[_0x0b51('0x90')]=_0x0b51('0x91');logger[_0x0b51('0x7d')](_0x0b51('0x92'),_0x33faed[_0x0b51('0x51')],_0x33faed['type']);}}}catch(_0x81c9e1){logger[_0x0b51('0x42')]('[%s][voiceQueueReport][agentconnect]',_0x493c77[_0x0b51('0x4e')],util[_0x0b51('0x43')](_0x81c9e1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0b51('0xc')][_0x0b51('0x25')]=function(_0x2d883b){try{if(this[_0x0b51('0x5c')](_0x2d883b)){logger[_0x0b51('0x4c')]('[%s][voiceQueueReport][agentcomplete]',_0x2d883b[_0x0b51('0x4e')],util['inspect'](_0x2d883b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2d883b[_0x0b51('0x4e')]]){var _0x1586dd=_[_0x0b51('0x82')](this[_0x0b51('0x11')][_0x2d883b[_0x0b51('0x4e')]]);_0x1586dd[_0x0b51('0x21')]=![];_0x1586dd[_0x0b51('0x87')]=null;_0x1586dd[_0x0b51('0x93')]=!![];_0x1586dd[_0x0b51('0x89')]=_0x2d883b['membername'];_0x1586dd[_0x0b51('0x85')]=_0x2d883b[_0x0b51('0x85')];_0x1586dd[_0x0b51('0x83')]=!![];_0x1586dd[_0x0b51('0x3a')]=![];_0x1586dd['queuecallerexitAt']=null;if(!_0x1586dd[_0x0b51('0x94')]){if(_0x2d883b[_0x0b51('0x95')]==_0x0b51('0x94')){_0x1586dd['queuecallerexitreason']=_0x0b51('0x96');logger[_0x0b51('0x7d')](_0x0b51('0x97'),_0x1586dd[_0x0b51('0x51')],_0x1586dd['type']);}else{if(_['startsWith'](_0x2d883b[_0x0b51('0x98')][_0x0b51('0x99')](),'local/')){if(this['queueReports'][_0x2d883b[_0x0b51('0x9a')]]){var _0x6f8113=_[_0x0b51('0x82')](this[_0x0b51('0x11')][_0x2d883b[_0x0b51('0x9a')]]);_0x6f8113[_0x0b51('0x83')]=![];_0x6f8113['queuecallerexit']=!![];_0x6f8113[_0x0b51('0x9b')]=moment(_0x1586dd[_0x0b51('0x78')])[_0x0b51('0x9c')](_0x2d883b[_0x0b51('0x85')],_0x0b51('0x9d'))[_0x0b51('0x4f')](_0x0b51('0x79'));_0x6f8113[_0x0b51('0x90')]=_0x0b51('0x9e');_0x6f8113[_0x0b51('0x94')]=!![];_0x6f8113[_0x0b51('0x9f')]=_0x0b51('0xa0');_0x6f8113['transferexten']=_0x2d883b[_0x0b51('0xa1')];_0x6f8113['transferuniqueid']=_0x2d883b['uniqueid'];logger[_0x0b51('0x7d')](_0x0b51('0xa2'),_0x6f8113[_0x0b51('0x51')],_0x6f8113[_0x0b51('0x57')]);var _0x14e48a=this['queueReports'][_0x2d883b[_0x0b51('0x9a')]];this[_0x0b51('0x11')][_0x2d883b[_0x0b51('0x9a')]]=this['queueReports'][_0x2d883b[_0x0b51('0x4e')]];this[_0x0b51('0x11')][_0x2d883b[_0x0b51('0x4e')]]=_0x14e48a;}}else{_0x1586dd[_0x0b51('0x90')]='COMPLETEDBY'+_0x2d883b[_0x0b51('0x95')]['toUpperCase']();logger[_0x0b51('0x7d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x1586dd['queue'],_0x1586dd[_0x0b51('0x57')],_0x1586dd[_0x0b51('0x90')]);}}}this['channels'][_0x2d883b[_0x0b51('0x4e')]]=_0x1586dd;}}}catch(_0x574a50){logger[_0x0b51('0x42')](_0x0b51('0xa3'),_0x2d883b[_0x0b51('0x4e')],util[_0x0b51('0x43')](_0x574a50,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0b51('0xc')][_0x0b51('0x28')]=function(_0x4a8def){try{if(this[_0x0b51('0x5c')](_0x4a8def)){logger[_0x0b51('0x4c')]('[%s][voiceQueueReport][varset]',_0x4a8def[_0x0b51('0x4e')],util['inspect'](_0x4a8def,{'showHidden':![],'depth':null}));this[_0x0b51('0xa4')](_0x4a8def[_0x0b51('0x4e')],_[_0x0b51('0x7f')](_0x4a8def[_0x0b51('0xa5')])[0x0],_0x4a8def['value']);if(this['queueReports'][_0x4a8def['uniqueid']]){var _0x4366bb=_[_0x0b51('0x82')](this[_0x0b51('0x11')][_0x4a8def['uniqueid']]);if(_0x4366bb){if(this[_0x0b51('0x5c')](_0x4a8def[_0x0b51('0xa5')])&&this[_0x0b51('0x5c')](_0x4a8def[_0x0b51('0xa5')][_0x0b51('0x64')])){switch(_0x4a8def[_0x0b51('0xa6')]){case _0x0b51('0xa7'):_0x4366bb[_0x0b51('0x3a')]=![];_0x4366bb[_0x0b51('0x9b')]=null;break;case _0x0b51('0xa8'):_0x4366bb[_0x0b51('0xa9')]=_0x0b51('0xaa');_0x4366bb[_0x0b51('0x3a')]=!![];_0x4366bb['queuecallerexitAt']=moment()[_0x0b51('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x4366bb[_0x0b51('0x8b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0x0b51('0xab'),_0x4a8def[_0x0b51('0x4e')],util[_0x0b51('0x43')](_0x4366bb,{'showHidden':![],'depth':null}));ami[_0x0b51('0x4a')](_0x0b51('0xac'),_0x4366bb);break;default:_0x4366bb[_0x0b51('0x3a')]=!![];_0x4366bb[_0x0b51('0x9b')]=moment()['format'](_0x0b51('0x79'));_0x4366bb[_0x0b51('0x8b')]=moment()[_0x0b51('0x4f')](_0x0b51('0x79'));}_0x4366bb['queuecallerabandon']=![];_0x4366bb['queuecallerabandonAt']=null;_0x4366bb[_0x0b51('0x90')]=_0x4a8def[_0x0b51('0xa6')];this[_0x0b51('0x14')][_0x4a8def[_0x0b51('0x4e')]]=_0x4366bb;this['emitVoiceQueueChannelRemove'](_0x4366bb,_0x0b51('0x27'));}else if(this[_0x0b51('0x5c')](_0x4a8def[_0x0b51('0xa5')])&&this[_0x0b51('0x5c')](_0x4a8def[_0x0b51('0xa5')][_0x0b51('0xad')])){if(!_0x4366bb[_0x0b51('0x21')]){_0x4366bb[_0x0b51('0x3a')]=!![];_0x4366bb[_0x0b51('0x9b')]=moment()[_0x0b51('0x4f')](_0x0b51('0x79'));_0x4366bb[_0x0b51('0x90')]=_0x0b51('0xae');_0x4366bb[_0x0b51('0x8b')]=moment()['format'](_0x0b51('0x79'));this[_0x0b51('0x14')][_0x4a8def[_0x0b51('0x4e')]]=_0x4366bb;}}logger[_0x0b51('0x7d')](_0x0b51('0xaf'),_0x4a8def[_0x0b51('0x4e')],_0x4366bb[_0x0b51('0x51')],_0x4366bb[_0x0b51('0x57')],_[_0x0b51('0x7f')](_0x4a8def[_0x0b51('0xa5')])[0x0],_0x4a8def[_0x0b51('0xa6')]);_0x4366bb[_0x0b51('0x19')]=this[_0x0b51('0x19')][_0x4a8def[_0x0b51('0x4e')]];}}}}catch(_0x39f68d){logger[_0x0b51('0x42')](_0x0b51('0xb0'),_0x4a8def[_0x0b51('0x4e')],util[_0x0b51('0x43')](_0x39f68d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0b51('0xc')][_0x0b51('0xa4')]=function(_0x4ffb47,_0x353b73,_0x28cbd7){var _0x4466b6=['rtpaudioqos',_0x0b51('0xb1'),_0x0b51('0xb2'),_0x0b51('0xb3'),_0x0b51('0xb4'),'rtpaudioqoslossbridged',_0x0b51('0xb5'),_0x0b51('0xb6'),_0x0b51('0xb7'),'sipuri',_0x0b51('0xb8'),_0x0b51('0xb9'),'membercalls',_0x0b51('0xba'),'memberinterface',_0x0b51('0xbb'),_0x0b51('0xbc'),'memberpenalty',_0x0b51('0xbd')];if(!_[_0x0b51('0x3c')](_0x353b73)&&!_[_0x0b51('0xbe')](_0x4466b6,_0x353b73)){if(_['isUndefined'](this[_0x0b51('0x19')][_0x4ffb47])){this[_0x0b51('0x19')][_0x4ffb47]={};}this[_0x0b51('0x19')][_0x4ffb47][_0x353b73]=_0x28cbd7;}};VoiceQueueReport[_0x0b51('0xc')][_0x0b51('0xbf')]=function(_0x498b39,_0x534294,_0x283aea){try{var _0x2319c9={};if(this[_0x0b51('0x11')][_0x498b39]){for(var _0x27f63b=0x0;_0x27f63b0x0?!![]:![];if(!_0x4d5121){return this[_0x44b6('0x19')](this[_0x44b6('0x40')][_0x44b6('0x65')]);}};VoiceQueueReport[_0x44b6('0xc')]['syncQueueMember']=function(_0xd020a4){var _0xe578c4=this['summary']['id'];if(this[_0x44b6('0x40')][_0x44b6('0x5c')][_0xe578c4]&&this[_0x44b6('0x40')]['queuestatus'][_0xe578c4][_0xd020a4['actionid']]){this[_0x44b6('0x40')][_0x44b6('0x5c')][_0xe578c4][_0xd020a4['actionid']]['agents'][_0x44b6('0x66')](_0xd020a4);}};VoiceQueueReport[_0x44b6('0xc')][_0x44b6('0x67')]=function(_0x180009){var _0x2353d0=this;try{if(this[_0x44b6('0x54')](_0x180009)&&this[_0x44b6('0x54')](_0x180009['queue'])){logger[_0x44b6('0x4d')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x44b6('0x3e')](_0x180009,{'showHidden':![],'depth':null}));var _0x4dea1c=this[_0x44b6('0x15')][_0x180009[_0x44b6('0x4a')]];if(_0x4dea1c){logger[_0x44b6('0x4d')](_0x44b6('0x68'),_0x4dea1c['name']);this[_0x44b6('0x40')][_0x44b6('0x5f')][_0x4dea1c[_0x44b6('0x53')]]={'summaryEvent':_0x180009};this[_0x44b6('0x40')][_0x44b6('0x69')]+=0x1;return ami[_0x44b6('0x56')]({'action':_0x44b6('0x5c'),'queue':_0x4dea1c['name']})['then'](function(_0x3ba1eb){if(!_0x2353d0[_0x44b6('0x40')][_0x44b6('0x5c')][_0x180009[_0x44b6('0x5a')]]){_0x2353d0[_0x44b6('0x40')][_0x44b6('0x5c')][_0x180009[_0x44b6('0x5a')]]={};}_0x2353d0[_0x44b6('0x40')]['queuestatus'][_0x180009['actionid']][_0x3ba1eb['actionid']]={'queue':_0x4dea1c[_0x44b6('0x53')],'agents':[]};})[_0x44b6('0x3a')](function(_0x1fd38c){throw _0x1fd38c;});}}}catch(_0x15cbeb){logger[_0x44b6('0x3c')](_0x44b6('0x5d'),util[_0x44b6('0x3e')](_0x15cbeb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x44b6('0xc')][_0x44b6('0x19')]=function(_0x38ace1){if(this['summary'][_0x44b6('0x69')]>0x0){this['summary'][_0x44b6('0x65')]=_0x38ace1;return;}logger[_0x44b6('0x4d')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x38ace1,{'showHidden':![],'depth':null}));this[_0x44b6('0x40')]=initializeSummary();ami[_0x44b6('0x43')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x44b6('0xc')][_0x44b6('0x1e')]=function(_0x298d58){try{if(this[_0x44b6('0x54')](_0x298d58)){logger[_0x44b6('0x4d')](_0x44b6('0x6a'),_0x298d58['uniqueid'],util['inspect'](_0x298d58,{'showHidden':![],'depth':null}));if(_[_0x44b6('0x55')](this['queueReports'][_0x298d58[_0x44b6('0x47')]])){this[_0x44b6('0x10')][_0x298d58[_0x44b6('0x47')]]=[];}if(_['isUndefined'](this[_0x44b6('0x13')][_0x298d58[_0x44b6('0x47')]])){this[_0x44b6('0x13')][_0x298d58[_0x44b6('0x47')]]={};}var _0x43bb3f=new QueueReport();_0x43bb3f[_0x44b6('0x4a')]=_0x298d58['queue'];_0x43bb3f[_0x44b6('0x52')]=this[_0x44b6('0x15')][_0x43bb3f[_0x44b6('0x4a')]]&&this['voiceQueues'][_0x43bb3f[_0x44b6('0x4a')]][_0x44b6('0x52')]?this['voiceQueues'][_0x43bb3f[_0x44b6('0x4a')]][_0x44b6('0x52')]||_0x44b6('0x6b'):_0x44b6('0x6b');_0x43bb3f[_0x44b6('0x6c')]=moment()[_0x44b6('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x43bb3f[_0x44b6('0x6d')]=_0x298d58['position'];_0x43bb3f['count']=_0x298d58[_0x44b6('0x6e')];_0x43bb3f['uniqueid']=_0x298d58[_0x44b6('0x47')];_0x43bb3f['routealias']=this[_0x44b6('0x13')][_0x298d58[_0x44b6('0x47')]][_0x44b6('0x6f')];logger[_0x44b6('0x70')](_0x44b6('0x71'),_0x43bb3f[_0x44b6('0x4a')],_0x43bb3f[_0x44b6('0x52')]);Object[_0x44b6('0x63')](_0x43bb3f,_[_0x44b6('0x72')](_0x298d58,_[_0x44b6('0x73')](_0x43bb3f)));this['queueReports'][_0x298d58['uniqueid']][_0x44b6('0x66')](_0x43bb3f);this['channels'][_0x298d58[_0x44b6('0x47')]]=_0x43bb3f;this[_0x44b6('0x44')](_0x43bb3f,'queuecallerjoin');}}catch(_0x39f6c1){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x298d58['uniqueid'],util[_0x44b6('0x3e')](_0x39f6c1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x44b6('0xc')][_0x44b6('0x20')]=function(_0x1f742a){try{if(this[_0x44b6('0x54')](_0x1f742a)){logger[_0x44b6('0x4d')]('[%s][voiceQueueReport][queuecallerabandon]',_0x1f742a['uniqueid'],util[_0x44b6('0x3e')](_0x1f742a,{'showHidden':![],'depth':null}));if(this[_0x44b6('0x10')][_0x1f742a['uniqueid']]){var _0x467cd1=_[_0x44b6('0x74')](this[_0x44b6('0x10')][_0x1f742a[_0x44b6('0x47')]]);_0x467cd1[_0x44b6('0x36')]=![];_0x467cd1[_0x44b6('0x75')]=null;_0x467cd1[_0x44b6('0x76')]=_0x1f742a[_0x44b6('0x76')];_0x467cd1[_0x44b6('0x77')]=_0x1f742a[_0x44b6('0x77')];_0x467cd1['queuecallerabandon']=!![];_0x467cd1[_0x44b6('0x78')]=moment()['format'](_0x44b6('0x79'));_0x467cd1[_0x44b6('0x7a')]=_0x44b6('0x7b');_0x467cd1[_0x44b6('0x7c')]=null;logger['info'](_0x44b6('0x7d'),_0x467cd1['queue'],_0x467cd1[_0x44b6('0x52')]);this[_0x44b6('0x13')][_0x1f742a['uniqueid']]=_0x467cd1;this[_0x44b6('0x42')](_0x467cd1,_0x44b6('0x1f'));}}}catch(_0x52bd66){logger['error'](_0x44b6('0x7e'),_0x1f742a[_0x44b6('0x47')],util[_0x44b6('0x3e')](_0x52bd66,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x44b6('0xc')][_0x44b6('0x7f')]=function(_0x864afe){try{if(this[_0x44b6('0x54')](_0x864afe)){logger[_0x44b6('0x4d')]('[%s][voiceQueueReport][queuecallerleave]',_0x864afe[_0x44b6('0x47')],util['inspect'](_0x864afe,{'showHidden':![],'depth':null}));if(this[_0x44b6('0x10')][_0x864afe[_0x44b6('0x47')]]){var _0xa2fe52=_[_0x44b6('0x74')](this[_0x44b6('0x10')][_0x864afe[_0x44b6('0x47')]]);_0xa2fe52['queuecallerleaveAt']=moment()[_0x44b6('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0xa2fe52[_0x44b6('0x80')]=_0x864afe[_0x44b6('0x80')];_0xa2fe52[_0x44b6('0x81')]=_0x864afe[_0x44b6('0x81')];logger['info'](_0x44b6('0x82'),_0xa2fe52[_0x44b6('0x4a')],_0xa2fe52[_0x44b6('0x52')],_0x864afe[_0x44b6('0x80')],_0x864afe['connectedlinename']);this[_0x44b6('0x13')][_0x864afe[_0x44b6('0x47')]]=_0xa2fe52;this[_0x44b6('0x44')](_0xa2fe52,_0x44b6('0x21'));}}}catch(_0x2ba6ec){logger[_0x44b6('0x3c')]('[%s][voiceQueueReport][queuecallerleave]',_0x864afe[_0x44b6('0x47')],util[_0x44b6('0x3e')](_0x2ba6ec,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x44b6('0xc')][_0x44b6('0x83')]=function(_0x1ca2c2){try{if(this[_0x44b6('0x54')](_0x1ca2c2)){logger[_0x44b6('0x4d')](_0x44b6('0x84'),_0x1ca2c2['uniqueid'],util[_0x44b6('0x3e')](_0x1ca2c2,{'showHidden':![],'depth':null}));if(this[_0x44b6('0x10')][_0x1ca2c2[_0x44b6('0x47')]]){var _0x554d9e=_[_0x44b6('0x74')](this[_0x44b6('0x10')][_0x1ca2c2[_0x44b6('0x47')]]);_0x554d9e[_0x44b6('0x36')]=!![];_0x554d9e[_0x44b6('0x7a')]=_0x44b6('0x85');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x554d9e[_0x44b6('0x4a')],_0x554d9e[_0x44b6('0x52')]);}}}catch(_0x54544c){logger[_0x44b6('0x3c')](_0x44b6('0x84'),_0x1ca2c2['uniqueid'],util['inspect'](_0x54544c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x44b6('0xc')][_0x44b6('0x86')]=function(_0x5c1272){try{if(this[_0x44b6('0x54')](_0x5c1272)){logger[_0x44b6('0x4d')](_0x44b6('0x87'),_0x5c1272['uniqueid'],util[_0x44b6('0x3e')](_0x5c1272,{'showHidden':![],'depth':null}));if(this[_0x44b6('0x10')][_0x5c1272[_0x44b6('0x47')]]){var _0x52683a=_['last'](this['queueReports'][_0x5c1272[_0x44b6('0x47')]]);_0x52683a[_0x44b6('0x1f')]=![];_0x52683a[_0x44b6('0x78')]=null;_0x52683a['assigned']=!![];_0x52683a['lastAssignedTo']=_0x5c1272[_0x44b6('0x88')];_0x52683a[_0x44b6('0x76')]=_0x5c1272['holdtime'];_0x52683a[_0x44b6('0x36')]=!![];_0x52683a[_0x44b6('0x35')]=![];_0x52683a[_0x44b6('0x89')]=null;if(!_0x52683a[_0x44b6('0x8a')]){if(_0x5c1272['reason']==_0x44b6('0x8a')){_0x52683a['queuecallerexitreason']='COMPLETED';logger[_0x44b6('0x70')](_0x44b6('0x8b'),_0x52683a[_0x44b6('0x4a')],_0x52683a[_0x44b6('0x52')]);}else{if(_['startsWith'](_0x5c1272['channel'][_0x44b6('0x8c')](),'local/')){if(this[_0x44b6('0x10')][_0x5c1272[_0x44b6('0x8d')]]){var _0xecd5e9=_[_0x44b6('0x74')](this[_0x44b6('0x10')][_0x5c1272[_0x44b6('0x8d')]]);_0xecd5e9[_0x44b6('0x36')]=![];_0xecd5e9[_0x44b6('0x35')]=!![];_0xecd5e9['queuecallerexitAt']=moment(_0x52683a['queuecallerjoinAt'])[_0x44b6('0x8e')](_0x5c1272[_0x44b6('0x76')],_0x44b6('0x8f'))['format'](_0x44b6('0x79'));_0xecd5e9[_0x44b6('0x7a')]=_0x44b6('0x90');_0xecd5e9[_0x44b6('0x8a')]=!![];_0xecd5e9['transfertype']=_0x44b6('0x91');_0xecd5e9[_0x44b6('0x92')]=_0x5c1272[_0x44b6('0x93')];_0xecd5e9['transferuniqueid']=_0x5c1272['uniqueid'];logger[_0x44b6('0x70')](_0x44b6('0x94'),_0xecd5e9[_0x44b6('0x4a')],_0xecd5e9[_0x44b6('0x52')]);var _0x5b8200=this[_0x44b6('0x10')][_0x5c1272[_0x44b6('0x8d')]];this[_0x44b6('0x10')][_0x5c1272[_0x44b6('0x8d')]]=this[_0x44b6('0x10')][_0x5c1272['uniqueid']];this[_0x44b6('0x10')][_0x5c1272[_0x44b6('0x47')]]=_0x5b8200;}}else{_0x52683a[_0x44b6('0x7a')]=_0x44b6('0x95')+_0x5c1272[_0x44b6('0x96')][_0x44b6('0x97')]();logger[_0x44b6('0x70')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x52683a[_0x44b6('0x4a')],_0x52683a[_0x44b6('0x52')],_0x52683a[_0x44b6('0x7a')]);}}}this['channels'][_0x5c1272[_0x44b6('0x47')]]=_0x52683a;}}}catch(_0x2f207a){logger[_0x44b6('0x3c')]('[%s][voiceQueueReport][agentcomplete]',_0x5c1272[_0x44b6('0x47')],util[_0x44b6('0x3e')](_0x2f207a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x44b6('0x25')]=function(_0x3dc16e){try{if(this[_0x44b6('0x54')](_0x3dc16e)){logger[_0x44b6('0x4d')](_0x44b6('0x98'),_0x3dc16e['uniqueid'],util[_0x44b6('0x3e')](_0x3dc16e,{'showHidden':![],'depth':null}));this[_0x44b6('0x99')](_0x3dc16e[_0x44b6('0x47')],_[_0x44b6('0x73')](_0x3dc16e[_0x44b6('0x9a')])[0x0],_0x3dc16e[_0x44b6('0x9b')]);if(this['queueReports'][_0x3dc16e[_0x44b6('0x47')]]){var _0x524549=_['last'](this[_0x44b6('0x10')][_0x3dc16e[_0x44b6('0x47')]]);if(_0x524549){if(this['isNotNull'](_0x3dc16e['variable'])&&this[_0x44b6('0x54')](_0x3dc16e[_0x44b6('0x9a')][_0x44b6('0x5c')])){switch(_0x3dc16e[_0x44b6('0x9b')]){case'CONTINUE':_0x524549[_0x44b6('0x35')]=![];_0x524549[_0x44b6('0x89')]=null;break;case'TIMEOUT':_0x524549[_0x44b6('0x9c')]=_0x44b6('0x9d');_0x524549[_0x44b6('0x35')]=!![];_0x524549['queuecallerexitAt']=moment()[_0x44b6('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x524549['queuecallerleaveAt']=moment()[_0x44b6('0x48')](_0x44b6('0x79'));logger[_0x44b6('0x4d')](_0x44b6('0x9e'),_0x3dc16e[_0x44b6('0x47')],util['inspect'](_0x524549,{'showHidden':![],'depth':null}));ami[_0x44b6('0x43')](_0x44b6('0x9f'),_0x524549);break;default:_0x524549[_0x44b6('0x35')]=!![];_0x524549['queuecallerexitAt']=moment()['format'](_0x44b6('0x79'));_0x524549['queuecallerleaveAt']=moment()['format'](_0x44b6('0x79'));}_0x524549[_0x44b6('0x1f')]=![];_0x524549['queuecallerabandonAt']=null;_0x524549['queuecallerexitreason']=_0x3dc16e[_0x44b6('0x9b')];this[_0x44b6('0x13')][_0x3dc16e[_0x44b6('0x47')]]=_0x524549;this[_0x44b6('0x42')](_0x524549,_0x44b6('0x24'));}else if(this[_0x44b6('0x54')](_0x3dc16e[_0x44b6('0x9a')])&&this['isNotNull'](_0x3dc16e[_0x44b6('0x9a')]['queueposition'])){if(!_0x524549[_0x44b6('0x1f')]){_0x524549['queuecallerexit']=!![];_0x524549[_0x44b6('0x89')]=moment()[_0x44b6('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x524549[_0x44b6('0x7a')]=_0x44b6('0xa0');_0x524549[_0x44b6('0xa1')]=moment()[_0x44b6('0x48')](_0x44b6('0x79'));this[_0x44b6('0x13')][_0x3dc16e['uniqueid']]=_0x524549;}}logger[_0x44b6('0x70')](_0x44b6('0xa2'),_0x3dc16e[_0x44b6('0x47')],_0x524549['queue'],_0x524549[_0x44b6('0x52')],_[_0x44b6('0x73')](_0x3dc16e[_0x44b6('0x9a')])[0x0],_0x3dc16e[_0x44b6('0x9b')]);_0x524549[_0x44b6('0x17')]=this['variables'][_0x3dc16e[_0x44b6('0x47')]];}}}}catch(_0x3c3f4d){logger[_0x44b6('0x3c')]('[%s][voiceQueueReport][varset]',_0x3dc16e['uniqueid'],util['inspect'](_0x3c3f4d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x1a2304,_0x408af5,_0xabc176){var _0x595b95=[_0x44b6('0xa3'),_0x44b6('0xa4'),_0x44b6('0xa5'),'rtpaudioqosjitterbridged',_0x44b6('0xa6'),'rtpaudioqoslossbridged',_0x44b6('0xa7'),'rtpaudioqosrttbridged','sipcallid',_0x44b6('0xa8'),_0x44b6('0xa9'),_0x44b6('0xaa'),_0x44b6('0xab'),_0x44b6('0xac'),_0x44b6('0xad'),_0x44b6('0xae'),'membername',_0x44b6('0xaf'),_0x44b6('0xb0')];if(!_[_0x44b6('0xb1')](_0x408af5)&&!_[_0x44b6('0xb2')](_0x595b95,_0x408af5)){if(_[_0x44b6('0x55')](this[_0x44b6('0x17')][_0x1a2304])){this['variables'][_0x1a2304]={};}this[_0x44b6('0x17')][_0x1a2304][_0x408af5]=_0xabc176;}};VoiceQueueReport[_0x44b6('0xc')]['handleHangup']=function(_0x489a27,_0x192ff9,_0x21db22){try{var _0xeda642={};if(this[_0x44b6('0x10')][_0x489a27]){for(var _0x5855f9=0x0;_0x5855f9=0x0?moment(_0x30172a['endtime'])['diff'](_0x30172a[_0xf5b0('0x17')],'seconds'):null,'data1':_0xf5b0('0x1b'),'data2':_0x30172a[_0xf5b0('0x10')],'data3':_0x30172a[_0xf5b0('0xe')],'data4':_0x30172a[_0xf5b0('0x1c')]||null,'role':_0xf5b0('0xf'),'internal':_0x30172a[_0xf5b0('0x10')]?_[_0xf5b0('0x11')](_0x30172a['accountcode']):undefined,'uniqueid':_0x30172a[_0xf5b0('0x12')]},'log':_0xf5b0('0x13')});}; \ No newline at end of file +var _0xad52=['calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','membername','endtime','starttime','outbound','dialstring','moment','lodash','util','voiceQueueReport','Request','CreateMemberReport','voice','interface','format','SIP/%s','lastAssignedTo','TALKING','diff','queuecallerleaveAt','seconds','inbound'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xad52,0x7c));var _0x2ad5=function(_0x415ac5,_0x3c52ba){_0x415ac5=_0x415ac5-0x0;var _0xc14ef7=_0xad52[_0x415ac5];return _0xc14ef7;};'use strict';var moment=require(_0x2ad5('0x0'));var _=require(_0x2ad5('0x1'));var util=require(_0x2ad5('0x2'));var client=require('../client');exports[_0x2ad5('0x3')]=function(_0x1f080c){var _0x1297ab=_0x1f080c['queuecallercompleteAt']||_0x1f080c['queuecallerexitAt'];return client[_0x2ad5('0x4')](_0x2ad5('0x5'),{'body':{'channel':_0x2ad5('0x6'),'membername':_0x1f080c['lastAssignedTo'],'interface':_['isNil'](_0x1f080c[_0x2ad5('0x7')])?util[_0x2ad5('0x8')](_0x2ad5('0x9'),_0x1f080c[_0x2ad5('0xa')]):_0x1f080c[_0x2ad5('0x7')],'type':_0x2ad5('0xb'),'enterAt':_0x1f080c['queuecallerleaveAt'],'exitAt':_0x1297ab,'duration':moment(_0x1297ab)[_0x2ad5('0xc')](_0x1f080c[_0x2ad5('0xd')],_0x2ad5('0xe')),'data1':_0x2ad5('0xf'),'data2':_0x1f080c[_0x2ad5('0x10')],'data3':_0x1f080c[_0x2ad5('0x11')],'data4':null,'data5':_0x1f080c[_0x2ad5('0x12')],'role':_0x2ad5('0x13'),'internal':_0x1f080c[_0x2ad5('0x14')]?_[_0x2ad5('0x15')](_0x1f080c['accountcode']):undefined,'uniqueid':_0x1f080c[_0x2ad5('0x16')]},'log':_0x2ad5('0x5')});};exports['voiceDialReport']=function(_0x5e64d5){return client[_0x2ad5('0x4')](_0x2ad5('0x5'),{'body':{'channel':_0x2ad5('0x6'),'membername':_0x5e64d5[_0x2ad5('0x17')],'interface':_0x5e64d5[_0x2ad5('0x7')],'type':_0x2ad5('0xb'),'enterAt':_0x5e64d5['starttime'],'exitAt':_0x5e64d5[_0x2ad5('0x18')],'duration':moment(_0x5e64d5[_0x2ad5('0x18')])[_0x2ad5('0xc')](_0x5e64d5[_0x2ad5('0x19')],_0x2ad5('0xe'))>=0x0?moment(_0x5e64d5[_0x2ad5('0x18')])[_0x2ad5('0xc')](_0x5e64d5[_0x2ad5('0x19')],_0x2ad5('0xe')):null,'data1':_0x2ad5('0x1a'),'data2':_0x5e64d5[_0x2ad5('0x14')],'data3':_0x5e64d5[_0x2ad5('0x11')],'data4':_0x5e64d5[_0x2ad5('0x1b')]||null,'role':_0x2ad5('0x13'),'internal':_0x5e64d5[_0x2ad5('0x14')]?_[_0x2ad5('0x15')](_0x5e64d5[_0x2ad5('0x14')]):undefined,'uniqueid':_0x5e64d5[_0x2ad5('0x16')]},'log':_0x2ad5('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 96b1990..526695a 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 _0xaac0=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','../client','getSettings'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0xaac0,0x10c));var _0x0aac=function(_0x5d8fa1,_0x48f172){_0x5d8fa1=_0x5d8fa1-0x0;var _0x53a280=_0xaac0[_0x5d8fa1];return _0x53a280;};'use strict';var client=require(_0x0aac('0x0'));exports[_0x0aac('0x1')]=function(){return client['Request'](_0x0aac('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0aac('0x3'),_0x0aac('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xe1e8=['Request','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xe1e8,0x1cb));var _0x8e1e=function(_0x10bd0e,_0x264ead){_0x10bd0e=_0x10bd0e-0x0;var _0x57b4bd=_0xe1e8[_0x10bd0e];return _0x57b4bd;};'use strict';var client=require(_0x8e1e('0x0'));exports['getSettings']=function(){return client[_0x8e1e('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x8e1e('0x2')]},'log':_0x8e1e('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 7beb48f..040a28f 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 _0x2343=['getTemplates','Request','name','html','GetTemplate','../client'];(function(_0x280dd8,_0x5c8eb8){var _0x2a6aa6=function(_0x118d85){while(--_0x118d85){_0x280dd8['push'](_0x280dd8['shift']());}};_0x2a6aa6(++_0x5c8eb8);}(_0x2343,0xef));var _0x3234=function(_0x55b460,_0x497077){_0x55b460=_0x55b460-0x0;var _0x3ac537=_0x2343[_0x55b460];return _0x3ac537;};'use strict';var client=require(_0x3234('0x0'));exports[_0x3234('0x1')]=function(_0x10bb2b){return function(_0x4c5144){return client[_0x3234('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x3234('0x3'),_0x3234('0x4')]},'log':_0x3234('0x5')});};}; \ No newline at end of file +var _0xd0d5=['GetTemplate','name','html','../client','Request'];(function(_0x17de8f,_0x2d5177){var _0xc19ec4=function(_0x3424c0){while(--_0x3424c0){_0x17de8f['push'](_0x17de8f['shift']());}};_0xc19ec4(++_0x2d5177);}(_0xd0d5,0x1e3));var _0x5d0d=function(_0x4d91ed,_0x30c529){_0x4d91ed=_0x4d91ed-0x0;var _0x26f2b3=_0xd0d5[_0x4d91ed];return _0x26f2b3;};'use strict';var client=require(_0x5d0d('0x0'));exports['getTemplates']=function(_0x1def69){return function(_0x27d433){return client[_0x5d0d('0x1')](_0x5d0d('0x2'),{'options':{'raw':!![],'attributes':['id',_0x5d0d('0x3'),_0x5d0d('0x4')]},'log':_0x5d0d('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index da3db8b..1a2e685 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 _0xa8ee=['data3','data4','data5','data6','data7','../client','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1'];(function(_0xda41f2,_0x5da015){var _0x1995c9=function(_0x4e970b){while(--_0x4e970b){_0xda41f2['push'](_0xda41f2['shift']());}};_0x1995c9(++_0x5da015);}(_0xa8ee,0xad));var _0xea8e=function(_0xf1dfa7,_0x48989b){_0xf1dfa7=_0xf1dfa7-0x0;var _0x275088=_0xa8ee[_0xf1dfa7];return _0x275088;};'use strict';var client=require(_0xea8e('0x0'));exports['getTriggers']=function(_0x35ee4e){return function(_0x396fce){return client[_0xea8e('0x1')](_0xea8e('0x2'),{'options':{'raw':![],'attributes':['id',_0xea8e('0x3'),_0xea8e('0x4'),_0xea8e('0x5')],'include':[{'model':_0xea8e('0x6'),'as':_0xea8e('0x7'),'attributes':['id',_0xea8e('0x8'),_0xea8e('0x9'),_0xea8e('0xa')]},{'model':_0xea8e('0x6'),'as':_0xea8e('0xb'),'attributes':['id',_0xea8e('0x8'),_0xea8e('0x9'),_0xea8e('0xa')]},{'model':_0xea8e('0xc'),'as':_0xea8e('0xd'),'attributes':['id',_0xea8e('0xe'),_0xea8e('0xf'),'data2',_0xea8e('0x10'),_0xea8e('0x11'),_0xea8e('0x12'),_0xea8e('0x13'),_0xea8e('0x14')]}]},'log':_0xea8e('0x2')});};}; \ No newline at end of file +var _0xa64a=['Condition','AnyConditions','value','Action','data1','data2','data4','data5','data7','GetTrigger','../client','Request','channel','AllConditions','field','operator'];(function(_0x276015,_0x57eb3d){var _0x385345=function(_0x3c5bb4){while(--_0x3c5bb4){_0x276015['push'](_0x276015['shift']());}};_0x385345(++_0x57eb3d);}(_0xa64a,0x12a));var _0xaa64=function(_0x8e44b8,_0x1f2d62){_0x8e44b8=_0x8e44b8-0x0;var _0x3f3a12=_0xa64a[_0x8e44b8];return _0x3f3a12;};'use strict';var client=require(_0xaa64('0x0'));exports['getTriggers']=function(_0x2db718){return function(_0x1f9c3e){return client[_0xaa64('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0xaa64('0x2'),'status'],'include':[{'model':'Condition','as':_0xaa64('0x3'),'attributes':['id',_0xaa64('0x4'),_0xaa64('0x5'),'value']},{'model':_0xaa64('0x6'),'as':_0xaa64('0x7'),'attributes':['id',_0xaa64('0x4'),'operator',_0xaa64('0x8')]},{'model':_0xaa64('0x9'),'as':'Actions','attributes':['id','action',_0xaa64('0xa'),_0xaa64('0xb'),'data3',_0xaa64('0xc'),_0xaa64('0xd'),'data6',_0xaa64('0xe')]}]},'log':_0xaa64('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index fb7424d..336f425 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 _0x1301=['GetTrunk','name','../client','getTrunks','Request'];(function(_0x579f84,_0x2ad590){var _0x4dad52=function(_0x1b0953){while(--_0x1b0953){_0x579f84['push'](_0x579f84['shift']());}};_0x4dad52(++_0x2ad590);}(_0x1301,0x70));var _0x1130=function(_0xc26710,_0x594706){_0xc26710=_0xc26710-0x0;var _0x276f08=_0x1301[_0xc26710];return _0x276f08;};'use strict';var client=require(_0x1130('0x0'));exports[_0x1130('0x1')]=function(_0x4c0869){return function(_0x58fc8a){return client[_0x1130('0x2')](_0x1130('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x1130('0x4'),'registry','defaultuser']},'log':_0x1130('0x3')});};}; \ No newline at end of file +var _0x0748=['registry','../client','getTrunks','Request','GetTrunk','name'];(function(_0xb05c7c,_0x1c7e9c){var _0x226468=function(_0x47e9b6){while(--_0x47e9b6){_0xb05c7c['push'](_0xb05c7c['shift']());}};_0x226468(++_0x1c7e9c);}(_0x0748,0xc7));var _0x8074=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x0748[_0x2f3794];return _0x1c9fbe;};'use strict';var client=require(_0x8074('0x0'));exports[_0x8074('0x1')]=function(_0x56b450){return function(_0x1f570f){return client[_0x8074('0x2')](_0x8074('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x8074('0x4'),_0x8074('0x5'),'defaultuser']},'log':_0x8074('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 4bceddf..e55f330 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x3cb28,_0x2fff70){var _0x232e0c=function(_0x1b3ef3){while(--_0x1b3ef3){_0x3cb28['push'](_0x3cb28['shift']());}};_0x232e0c(++_0x2fff70);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 6c0d8ee..6f583df 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 _0x6fcf=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x3260f4,_0x7224c3){var _0x234eeb=function(_0xc64f2b){while(--_0xc64f2b){_0x3260f4['push'](_0x3260f4['shift']());}};_0x234eeb(++_0x7224c3);}(_0x6fcf,0x69));var _0xf6fc=function(_0x3e83f1,_0x1b09ae){_0x3e83f1=_0x3e83f1-0x0;var _0x28cd96=_0x6fcf[_0x3e83f1];return _0x28cd96;};'use strict';var client=require(_0xf6fc('0x0'));exports['create']=function(_0xdb0fca){return client[_0xf6fc('0x1')](_0xf6fc('0x2'),{'body':_0xdb0fca,'log':_0xf6fc('0x2')});};exports[_0xf6fc('0x3')]=function(_0x1a3d2e,_0x53375e,_0x2a81b3){return client[_0xf6fc('0x1')](_0xf6fc('0x4'),{'body':_0x1a3d2e,'options':{'where':{'uniqueid':_0x53375e,'interface':_0x2a81b3,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xa1bd=['../client','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x5b328e,_0x1d1d24){var _0x45a9cc=function(_0x59f067){while(--_0x59f067){_0x5b328e['push'](_0x5b328e['shift']());}};_0x45a9cc(++_0x1d1d24);}(_0xa1bd,0x158));var _0xda1b=function(_0x44787c,_0x37a8f){_0x44787c=_0x44787c-0x0;var _0x3ec69f=_0xa1bd[_0x44787c];return _0x3ec69f;};'use strict';var client=require(_0xda1b('0x0'));exports['create']=function(_0x49f19d){return client[_0xda1b('0x1')](_0xda1b('0x2'),{'body':_0x49f19d,'log':_0xda1b('0x2')});};exports['update']=function(_0x22402c,_0x14e5c4,_0x32df03){return client[_0xda1b('0x1')](_0xda1b('0x3'),{'body':_0x22402c,'options':{'where':{'uniqueid':_0x14e5c4,'interface':_0x32df03,'agentcomplete':!![]}},'log':_0xda1b('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 0313f5e..f11ca93 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 _0x00e4=['format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','moment','util','../client','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00e4,0x1d6));var _0x400e=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x00e4[_0x53ccf2];return _0x5a2964;};'use strict';var moment=require(_0x400e('0x0'));var util=require(_0x400e('0x1'));var _=require('lodash');var client=require(_0x400e('0x2'));exports['create']=function(_0x461911){return client[_0x400e('0x3')](_0x400e('0x4'),{'body':_[_0x400e('0x5')](_0x461911,{'source':_0x461911[_0x400e('0x6')],'destinationcontext':_0x461911[_0x400e('0x7')],'callerid':_0x461911[_0x400e('0x8')],'amaflags':_0x400e('0x9')}),'log':_0x400e('0x4')});};exports[_0x400e('0xa')]=function(){return function(){return client['Request'](_0x400e('0xb'),{'options':{'where':{'type':[_0x400e('0xc')],'createdAt':{'$between':[moment()[_0x400e('0xd')]('day')[_0x400e('0xe')](_0x400e('0xf')),moment()[_0x400e('0x10')](_0x400e('0x11'))[_0x400e('0xe')](_0x400e('0xf'))]}},'attributes':[_0x400e('0x12'),_0x400e('0x13'),_0x400e('0x14'),_0x400e('0x15')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x6ec2=['lodash','../client','Request','CreateVoiceCallReport','merge','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','GetVoiceCallReports','util'];(function(_0x38080e,_0x95512d){var _0x4e4c87=function(_0x2be6b3){while(--_0x2be6b3){_0x38080e['push'](_0x38080e['shift']());}};_0x4e4c87(++_0x95512d);}(_0x6ec2,0xf6));var _0x26ec=function(_0x22fd5d,_0x13afb5){_0x22fd5d=_0x22fd5d-0x0;var _0x39153c=_0x6ec2[_0x22fd5d];return _0x39153c;};'use strict';var moment=require('moment');var util=require(_0x26ec('0x0'));var _=require(_0x26ec('0x1'));var client=require(_0x26ec('0x2'));exports['create']=function(_0x294adc){return client[_0x26ec('0x3')](_0x26ec('0x4'),{'body':_[_0x26ec('0x5')](_0x294adc,{'source':_0x294adc['calleridnum'],'destinationcontext':_0x294adc[_0x26ec('0x6')],'callerid':_0x294adc[_0x26ec('0x7')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x26ec('0x8')]=function(){return function(){return client[_0x26ec('0x3')](_0x26ec('0x9'),{'options':{'where':{'type':[_0x26ec('0xa')],'createdAt':{'$between':[moment()['startOf'](_0x26ec('0xb'))[_0x26ec('0xc')](_0x26ec('0xd')),moment()[_0x26ec('0xe')]('day')[_0x26ec('0xc')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x26ec('0xf'),_0x26ec('0x10'),_0x26ec('0x11'),'billableseconds']},'log':_0x26ec('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 15b1e8f..cdf48b2 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 _0xd14d=['../client','create','Request','CreateVoiceDialReport'];(function(_0x5941c3,_0x190094){var _0x141810=function(_0x574284){while(--_0x574284){_0x5941c3['push'](_0x5941c3['shift']());}};_0x141810(++_0x190094);}(_0xd14d,0x1c8));var _0xdd14=function(_0x3abd59,_0x2fa71d){_0x3abd59=_0x3abd59-0x0;var _0x2a805b=_0xd14d[_0x3abd59];return _0x2a805b;};'use strict';var client=require(_0xdd14('0x0'));exports[_0xdd14('0x1')]=function(_0x141e11){return client[_0xdd14('0x2')](_0xdd14('0x3'),{'body':_0x141e11,'log':_0xdd14('0x3')});}; \ No newline at end of file +var _0x8d0f=['Request','CreateVoiceDialReport','../client','create'];(function(_0x19779d,_0x32f029){var _0x5cfc06=function(_0x54ba1e){while(--_0x54ba1e){_0x19779d['push'](_0x19779d['shift']());}};_0x5cfc06(++_0x32f029);}(_0x8d0f,0x72));var _0xf8d0=function(_0x59a549,_0x2fe2bb){_0x59a549=_0x59a549-0x0;var _0x12adbe=_0x8d0f[_0x59a549];return _0x12adbe;};'use strict';var client=require(_0xf8d0('0x0'));exports[_0xf8d0('0x1')]=function(_0x399cf8){return client[_0xf8d0('0x2')]('CreateVoiceDialReport',{'body':_0x399cf8,'log':_0xf8d0('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ef8c96e..5192b5c 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 _0x85b5=['getVoiceExtensions','GetVoiceExtension','recordingFormat','../client'];(function(_0x87d3ec,_0x387888){var _0x5f3f6f=function(_0x5492ac){while(--_0x5492ac){_0x87d3ec['push'](_0x87d3ec['shift']());}};_0x5f3f6f(++_0x387888);}(_0x85b5,0x7f));var _0x585b=function(_0x14759f,_0x393a08){_0x14759f=_0x14759f-0x0;var _0x244f20=_0x85b5[_0x14759f];return _0x244f20;};'use strict';var client=require(_0x585b('0x0'));exports[_0x585b('0x1')]=function(){return function(){return client['Request'](_0x585b('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x585b('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xeea4=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x48ccc1,_0x55e9cb){var _0x9ffe13=function(_0x323a36){while(--_0x323a36){_0x48ccc1['push'](_0x48ccc1['shift']());}};_0x9ffe13(++_0x55e9cb);}(_0xeea4,0x19e));var _0x4eea=function(_0x37f29b,_0x4419e4){_0x37f29b=_0x37f29b-0x0;var _0x2389da=_0xeea4[_0x37f29b];return _0x2389da;};'use strict';var client=require(_0x4eea('0x0'));exports[_0x4eea('0x1')]=function(){return function(){return client[_0x4eea('0x2')](_0x4eea('0x3'),{'options':{'raw':!![],'attributes':['id',_0x4eea('0x4'),_0x4eea('0x5')],'where':{'VoiceExtensionId':null}},'log':_0x4eea('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 83bb0bd..ddace2c 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 _0xba86=['mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency'];(function(_0x353abb,_0x194c80){var _0x43c9c5=function(_0x456b74){while(--_0x456b74){_0x353abb['push'](_0x353abb['shift']());}};_0x43c9c5(++_0x194c80);}(_0xba86,0x7c));var _0x6ba8=function(_0x166580,_0x5fbd6f){_0x166580=_0x166580-0x0;var _0x54e596=_0xba86[_0x166580];return _0x54e596;};'use strict';var client=require(_0x6ba8('0x0'));exports[_0x6ba8('0x1')]=function(){return function(){return client[_0x6ba8('0x2')](_0x6ba8('0x3'),{'options':{'raw':![],'attributes':['id',_0x6ba8('0x4'),_0x6ba8('0x5'),'acwTimeout',_0x6ba8('0x6'),'monitor_format',_0x6ba8('0x7'),_0x6ba8('0x8'),'dialMethod',_0x6ba8('0x9'),_0x6ba8('0xa'),_0x6ba8('0xb'),_0x6ba8('0xc'),_0x6ba8('0xd'),'dialPredictiveInterval',_0x6ba8('0xe'),_0x6ba8('0xf'),_0x6ba8('0x10'),_0x6ba8('0x11'),_0x6ba8('0x12'),_0x6ba8('0x13'),_0x6ba8('0x14'),_0x6ba8('0x15'),'dialBusyMaxRetry',_0x6ba8('0x16'),_0x6ba8('0x17'),_0x6ba8('0x18'),_0x6ba8('0x19'),'dialTimezone',_0x6ba8('0x1a'),'dialPrefix',_0x6ba8('0x1b'),_0x6ba8('0x1c'),_0x6ba8('0x1d'),_0x6ba8('0x1e'),'dialAMDAfterGreetingSilence',_0x6ba8('0x1f'),_0x6ba8('0x20'),'dialAMDBetweenWordsSilence',_0x6ba8('0x21'),'dialAMDSilenceThreshold',_0x6ba8('0x22'),'timeout',_0x6ba8('0x23'),_0x6ba8('0x24'),'dialOrderByScheduledAt',_0x6ba8('0x25'),'dialAgiAfterHangupClient','dialQueueProject2',_0x6ba8('0x26'),_0x6ba8('0x27'),_0x6ba8('0x28'),_0x6ba8('0x29'),'dialNoSuchNumberMaxRetry',_0x6ba8('0x2a'),'dialDropMaxRetry','dialDropRetryFrequency',_0x6ba8('0x2b'),_0x6ba8('0x2c'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x6ba8('0x2d'),_0x6ba8('0x2e'),_0x6ba8('0x2f'),_0x6ba8('0x30'),'dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe',_0x6ba8('0x31')],'include':[{'model':_0x6ba8('0x32'),'as':'Trunk','attributes':['id',_0x6ba8('0x4'),_0x6ba8('0x33'),_0x6ba8('0x34')]},{'model':_0x6ba8('0x35'),'as':'mandatoryDispositionPause','attributes':['id',_0x6ba8('0x4')]},{'model':_0x6ba8('0x32'),'as':_0x6ba8('0x36'),'attributes':['id',_0x6ba8('0x4'),'callerid',_0x6ba8('0x34')]},{'model':_0x6ba8('0x37'),'as':_0x6ba8('0x37'),'attributes':['id',_0x6ba8('0x4')],'include':[{'model':_0x6ba8('0x37'),'as':_0x6ba8('0x38'),'attributes':['id','name','interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x62b6=['Trunk','callerid','active','Pause','Interval','interval','../client','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'];(function(_0x3c5fd9,_0x40ce3b){var _0x2a245d=function(_0x32f619){while(--_0x32f619){_0x3c5fd9['push'](_0x3c5fd9['shift']());}};_0x2a245d(++_0x40ce3b);}(_0x62b6,0x19c));var _0x662b=function(_0x1c2d5d,_0x441658){_0x1c2d5d=_0x1c2d5d-0x0;var _0x24f987=_0x62b6[_0x1c2d5d];return _0x24f987;};'use strict';var client=require(_0x662b('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x662b('0x1'),{'options':{'raw':![],'attributes':['id',_0x662b('0x2'),_0x662b('0x3'),_0x662b('0x4'),_0x662b('0x5'),_0x662b('0x6'),_0x662b('0x7'),_0x662b('0x8'),_0x662b('0x9'),'dialLimitChannel','dialLimitQueue',_0x662b('0xa'),'dialPredictiveOptimization',_0x662b('0xb'),_0x662b('0xc'),_0x662b('0xd'),_0x662b('0xe'),_0x662b('0xf'),'dialQueueOptions',_0x662b('0x10'),_0x662b('0x11'),_0x662b('0x12'),_0x662b('0x13'),_0x662b('0x14'),_0x662b('0x15'),'dialNoAnswerMaxRetry',_0x662b('0x16'),_0x662b('0x17'),_0x662b('0x18'),'dialGlobalInterval',_0x662b('0x19'),'dialCheckDuplicateType',_0x662b('0x1a'),_0x662b('0x1b'),_0x662b('0x1c'),_0x662b('0x1d'),_0x662b('0x1e'),'dialAMDMinWordLength',_0x662b('0x1f'),'dialAMDMaximumNumberOfWords',_0x662b('0x20'),_0x662b('0x21'),'timeout',_0x662b('0x22'),'dialRecallInQueue',_0x662b('0x23'),'dialAgiAfterHangupAgent',_0x662b('0x24'),_0x662b('0x25'),_0x662b('0x6'),_0x662b('0x26'),_0x662b('0x27'),'dialCutDigit',_0x662b('0x28'),_0x662b('0x29'),_0x662b('0x2a'),'dialDropRetryFrequency',_0x662b('0x2b'),_0x662b('0x2c'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x662b('0x2d'),_0x662b('0x2e'),_0x662b('0x2f'),_0x662b('0x30'),_0x662b('0x31'),_0x662b('0x32'),_0x662b('0x33')],'include':[{'model':_0x662b('0x34'),'as':_0x662b('0x34'),'attributes':['id','name',_0x662b('0x35'),_0x662b('0x36')]},{'model':_0x662b('0x37'),'as':'mandatoryDispositionPause','attributes':['id',_0x662b('0x2')]},{'model':_0x662b('0x34'),'as':'TrunkBackup','attributes':['id',_0x662b('0x2'),_0x662b('0x35'),_0x662b('0x36')]},{'model':_0x662b('0x38'),'as':_0x662b('0x38'),'attributes':['id',_0x662b('0x2')],'include':[{'model':_0x662b('0x38'),'as':'Intervals','attributes':['id',_0x662b('0x2'),_0x662b('0x39')]}]}]},'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 3c4129d..4a21eab 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(_0x5d3a04,_0x506a78){var _0x3a6b3e=function(_0x477ccb){while(--_0x477ccb){_0x5d3a04['push'](_0x5d3a04['shift']());}};_0x3a6b3e(++_0x506a78);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x4788c3,_0x4c7c22){var _0x486a0f=function(_0x44773d){while(--_0x44773d){_0x4788c3['push'](_0x4788c3['shift']());}};_0x486a0f(++_0x4c7c22);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 ce69857..a913a90 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 _0x3f1c=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x5b2a3d,_0x426194){var _0x2a4497=function(_0x6eb04a){while(--_0x6eb04a){_0x5b2a3d['push'](_0x5b2a3d['shift']());}};_0x2a4497(++_0x426194);}(_0x3f1c,0xb1));var _0xc3f1=function(_0x117d5b,_0x12c630){_0x117d5b=_0x117d5b-0x0;var _0xb99855=_0x3f1c[_0x117d5b];return _0xb99855;};'use strict';var client=require(_0xc3f1('0x0'));exports[_0xc3f1('0x1')]=function(_0x277e58){return function(){return client[_0xc3f1('0x2')](_0xc3f1('0x3'),{'options':{'where':{'VoiceQueueId':_0x277e58,'paused':!![]},'raw':!![]},'log':_0xc3f1('0x1')});};}; \ No newline at end of file +var _0x4a90=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x17cb01,_0xad4fd6){var _0x1786ce=function(_0x91faa6){while(--_0x91faa6){_0x17cb01['push'](_0x17cb01['shift']());}};_0x1786ce(++_0xad4fd6);}(_0x4a90,0x129));var _0x04a9=function(_0x3743cf,_0x51579e){_0x3743cf=_0x3743cf-0x0;var _0x32358f=_0x4a90[_0x3743cf];return _0x32358f;};'use strict';var client=require(_0x04a9('0x0'));exports[_0x04a9('0x1')]=function(_0x16b014){return function(){return client[_0x04a9('0x2')](_0x04a9('0x3'),{'options':{'where':{'VoiceQueueId':_0x16b014,'paused':!![]},'raw':!![]},'log':_0x04a9('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index f617a84..c591b40 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(_0x43d274,_0x5ab1d9){var _0x2781fb=function(_0x251364){while(--_0x251364){_0x43d274['push'](_0x43d274['shift']());}};_0x2781fb(++_0x5ab1d9);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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(_0x456dc4,_0x39f6a4){var _0x437250=function(_0x168ed3){while(--_0x168ed3){_0x456dc4['push'](_0x456dc4['shift']());}};_0x437250(++_0x39f6a4);}(_0x7a54,0x106));var _0x47a5=function(_0x1c49bc,_0x19c921){_0x1c49bc=_0x1c49bc-0x0;var _0x4b064e=_0x7a54[_0x1c49bc];return _0x4b064e;};'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 ba05865..044cd1b 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 _0xabdf=['transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename'];(function(_0x5956e0,_0x37b423){var _0x4770b4=function(_0x37b6b9){while(--_0x37b6b9){_0x5956e0['push'](_0x5956e0['shift']());}};_0x4770b4(++_0x37b423);}(_0xabdf,0x11f));var _0xfabd=function(_0x522552,_0x4a11b1){_0x522552=_0x522552-0x0;var _0x12160c=_0xabdf[_0x522552];return _0x12160c;};'use strict';var client=require('../client');exports[_0xfabd('0x0')]={};exports[_0xfabd('0x1')]=function(_0x56fd4a){return client[_0xfabd('0x2')](_0xfabd('0x3'),{'body':{'result':_0x56fd4a['result'],'transfererchannel':_0x56fd4a[_0xfabd('0x4')],'transferercalleridnum':_0x56fd4a['transferercalleridnum'],'transferercalleridname':_0x56fd4a[_0xfabd('0x5')],'transfererconnectedlinenum':_0x56fd4a['transfererconnectedlinenum'],'transfererconnectedlinename':_0x56fd4a[_0xfabd('0x6')],'transfereraccountcode':_0x56fd4a[_0xfabd('0x7')],'transferercontext':_0x56fd4a[_0xfabd('0x8')],'transfererexten':_0x56fd4a['transfererexten'],'transfererlinkedid':_0x56fd4a[_0xfabd('0x9')],'transfereechannel':_0x56fd4a[_0xfabd('0xa')],'transfereecalleridnum':_0x56fd4a['transfereecalleridnum'],'transfereecalleridname':_0x56fd4a[_0xfabd('0xb')],'transfereeconnectedlinenum':_0x56fd4a[_0xfabd('0xc')],'transfereeconnectedlinename':_0x56fd4a[_0xfabd('0xd')],'transfereeaccountcode':_0x56fd4a[_0xfabd('0xe')],'transfereecontext':_0x56fd4a[_0xfabd('0xf')],'transfereeexten':_0x56fd4a[_0xfabd('0x10')],'transfereelinkedid':_0x56fd4a[_0xfabd('0x11')],'isexternal':_0x56fd4a[_0xfabd('0x12')],'context':_0x56fd4a[_0xfabd('0x13')],'extension':_0x56fd4a[_0xfabd('0x14')],'type':_0xfabd('0x15')},'log':'CreateVoiceTransferReport'});};exports[_0xfabd('0x16')]=function(_0x29e79e){return client[_0xfabd('0x2')](_0xfabd('0x3'),{'body':{'result':_0x29e79e[_0xfabd('0x17')],'transfererchannel':_0x29e79e[_0xfabd('0x18')],'transferercalleridnum':_0x29e79e[_0xfabd('0x19')],'transferercalleridname':_0x29e79e[_0xfabd('0x1a')],'transfererconnectedlinenum':_0x29e79e[_0xfabd('0x1b')],'transfererconnectedlinename':_0x29e79e[_0xfabd('0x1c')],'transfereraccountcode':_0x29e79e[_0xfabd('0x1d')],'transferercontext':_0x29e79e['secondtransferercontext'],'transfererexten':_0x29e79e['secondtransfererexten'],'transfererlinkedid':_0x29e79e[_0xfabd('0x1e')],'transfereechannel':_0x29e79e[_0xfabd('0x1f')],'transfereecalleridnum':_0x29e79e[_0xfabd('0x20')],'transfereecalleridname':_0x29e79e[_0xfabd('0x21')],'transfereeconnectedlinenum':_0x29e79e[_0xfabd('0x22')],'transfereeconnectedlinename':_0x29e79e[_0xfabd('0x23')],'transfereeaccountcode':_0x29e79e[_0xfabd('0x24')],'transfereecontext':_0x29e79e[_0xfabd('0x25')],'transfereeexten':_0x29e79e[_0xfabd('0x26')],'transfereelinkedid':_0x29e79e[_0xfabd('0x27')],'isexternal':_0x29e79e[_0xfabd('0x12')],'context':_0x29e79e[_0xfabd('0x28')],'extension':_0x29e79e[_0xfabd('0x29')],'type':_0xfabd('0x2a')},'log':_0xfabd('0x3')});}; \ No newline at end of file +var _0x0597=['transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname'];(function(_0x59857d,_0x16f4fa){var _0x17b121=function(_0x434329){while(--_0x434329){_0x59857d['push'](_0x59857d['shift']());}};_0x17b121(++_0x16f4fa);}(_0x0597,0x1c0));var _0x7059=function(_0x4517f6,_0x2db9a5){_0x4517f6=_0x4517f6-0x0;var _0xd2e6ff=_0x0597[_0x4517f6];return _0xd2e6ff;};'use strict';var client=require(_0x7059('0x0'));exports[_0x7059('0x1')]={};exports['blindTransfer']=function(_0x707737){return client[_0x7059('0x2')](_0x7059('0x3'),{'body':{'result':_0x707737[_0x7059('0x4')],'transfererchannel':_0x707737[_0x7059('0x5')],'transferercalleridnum':_0x707737['transferercalleridnum'],'transferercalleridname':_0x707737[_0x7059('0x6')],'transfererconnectedlinenum':_0x707737[_0x7059('0x7')],'transfererconnectedlinename':_0x707737[_0x7059('0x8')],'transfereraccountcode':_0x707737[_0x7059('0x9')],'transferercontext':_0x707737['transferercontext'],'transfererexten':_0x707737['transfererexten'],'transfererlinkedid':_0x707737[_0x7059('0xa')],'transfereechannel':_0x707737[_0x7059('0xb')],'transfereecalleridnum':_0x707737[_0x7059('0xc')],'transfereecalleridname':_0x707737[_0x7059('0xd')],'transfereeconnectedlinenum':_0x707737[_0x7059('0xe')],'transfereeconnectedlinename':_0x707737[_0x7059('0xf')],'transfereeaccountcode':_0x707737[_0x7059('0x10')],'transfereecontext':_0x707737['transfereecontext'],'transfereeexten':_0x707737[_0x7059('0x11')],'transfereelinkedid':_0x707737[_0x7059('0x12')],'isexternal':_0x707737[_0x7059('0x13')],'context':_0x707737[_0x7059('0x14')],'extension':_0x707737['extension'],'type':_0x7059('0x15')},'log':_0x7059('0x3')});};exports[_0x7059('0x16')]=function(_0x2aaa09){return client[_0x7059('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x2aaa09[_0x7059('0x4')],'transfererchannel':_0x2aaa09[_0x7059('0x17')],'transferercalleridnum':_0x2aaa09[_0x7059('0x18')],'transferercalleridname':_0x2aaa09['origtransferercalleridname'],'transfererconnectedlinenum':_0x2aaa09[_0x7059('0x19')],'transfererconnectedlinename':_0x2aaa09['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2aaa09[_0x7059('0x1a')],'transferercontext':_0x2aaa09['secondtransferercontext'],'transfererexten':_0x2aaa09[_0x7059('0x1b')],'transfererlinkedid':_0x2aaa09['origtransfererlinkedid'],'transfereechannel':_0x2aaa09[_0x7059('0x1c')],'transfereecalleridnum':_0x2aaa09[_0x7059('0x1d')],'transfereecalleridname':_0x2aaa09[_0x7059('0x1e')],'transfereeconnectedlinenum':_0x2aaa09['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2aaa09['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2aaa09['transfertargetaccountcode'],'transfereecontext':_0x2aaa09['transfertargetcontext'],'transfereeexten':_0x2aaa09[_0x7059('0x1f')],'transfereelinkedid':_0x2aaa09['transfertargetlinkedid'],'isexternal':_0x2aaa09[_0x7059('0x13')],'context':_0x2aaa09[_0x7059('0x20')],'extension':_0x2aaa09[_0x7059('0x21')],'type':_0x7059('0x22')},'log':_0x7059('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 7526ae1..56681d1 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 _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x4af228,_0x4e18ab){var _0x34acfe=function(_0x5a0ae3){while(--_0x5a0ae3){_0x4af228['push'](_0x4af228['shift']());}};_0x34acfe(++_0x4e18ab);}(_0x7a54,0x106));var _0x47a5=function(_0x86da47,_0x5b32bb){_0x86da47=_0x86da47-0x0;var _0x378f9c=_0x7a54[_0x86da47];return _0x378f9c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x3ceca5,_0x5c9695){var _0x4207d9=function(_0x5537b9){while(--_0x5537b9){_0x3ceca5['push'](_0x3ceca5['shift']());}};_0x4207d9(++_0x5c9695);}(_0xb10b,0x12a));var _0xbb10=function(_0x509b99,_0x3ff1f0){_0x509b99=_0x509b99-0x0;var _0x383d46=_0xb10b[_0x509b99];return _0x383d46;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+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 6cc64dd..35fb474 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 _0xed61=['trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','resolve','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xed61,0x7e));var _0x1ed6=function(_0x3e29df,_0x42fdf8){_0x3e29df=_0x3e29df-0x0;var _0x3e3ba9=_0xed61[_0x3e29df];return _0x3e3ba9;};'use strict';var _=require(_0x1ed6('0x0'));var BPromise=require(_0x1ed6('0x1'));var Redis=require(_0x1ed6('0x2'));var util=require(_0x1ed6('0x3'));var config=require(_0x1ed6('0x4'));var logger=require(_0x1ed6('0x5'))(_0x1ed6('0x6'));var cmContactRpc=require(_0x1ed6('0x7'));config[_0x1ed6('0x8')]=_['defaults'](config['redis'],{'host':_0x1ed6('0x9'),'port':0x18eb});var io=require(_0x1ed6('0xa'))(new Redis(config[_0x1ed6('0x8')]));function emit(_0x35c1e4,_0x38ed7e,_0x55ba5b,_0x33e85c,_0x1ae462){logger[_0x1ed6('0xb')](_0x1ed6('0xc'),_0x35c1e4,_0x38ed7e['id'],_0x55ba5b,_0x33e85c,JSON['stringify'](_0x1ae462));io['to'](_0x55ba5b)[_0x1ed6('0xd')](_0x33e85c,_0x1ae462);}exports[_0x1ed6('0xe')]=function(_0x5e88c9,_0xadca83,_0x57ab0f,_0x5308a0){var _0x30f971,_0xf5a8f;var _0x48fe24={};var _0x14fb39;var _0x1e38ae=Number(_0x57ab0f[_0x1ed6('0xf')]);var _0x2e7302=_0x57ab0f[_0x1ed6('0x10')]?Boolean(Number(_0x57ab0f[_0x1ed6('0x10')])):![];var _0x2f4d3a;var _0x90d578=![];if(!_[_0x1ed6('0x11')](_0x57ab0f[_0x1ed6('0x12')])){if(_0x57ab0f[_0x1ed6('0x12')]=='1')_0x90d578=!![];}if(!_0x90d578){if(_0x5308a0[_0x1ed6('0x13')]){_0x48fe24['id']=_0x5308a0['xmd-contactid'];}}if(!_0x48fe24['id']){_0x48fe24[_0x1ed6('0x14')]=_0x1e38ae;_0x2f4d3a=_0x57ab0f['data3']&&_0x57ab0f['data3']!=='0'?_0x57ab0f[_0x1ed6('0x15')][_0x1ed6('0x16')](','):[_0x1ed6('0x17')];_0x48fe24[_0x1ed6('0x18')]=_[_0x1ed6('0x19')](_0x2f4d3a,function(_0x3c7366){var _0x27c438={};_0x27c438[_0x3c7366]=_0x5308a0[_0x1ed6('0x1a')]?_0x5308a0[_0x1ed6('0x1b')]:_0x5308a0[_0x1ed6('0x1c')];return _0x27c438;});_0x14fb39=_0x5308a0[_0x1ed6('0x1a')]?_0x5308a0['destcalleridnum']:_0x5308a0[_0x1ed6('0x1c')];}var _0x44d206=['id',_0x1ed6('0x1d'),_0x1ed6('0x1e'),'phone',_0x1ed6('0x1f'),_0x1ed6('0x20'),_0x1ed6('0x14'),_0x1ed6('0x21'),_0x1ed6('0x22'),_0x1ed6('0x23')];var _0x3a01a8=_[_0x1ed6('0x24')](_0x44d206,_0x2f4d3a);BPromise['resolve']()[_0x1ed6('0x25')](cmContactRpc[_0x1ed6('0x26')]({'attributes':_0x3a01a8,'where':_0x48fe24,'phone':_0x14fb39}))[_0x1ed6('0x25')](function(_0x2f7d57){_0xf5a8f=_0x2f7d57;if(!_[_0x1ed6('0x27')](_0xf5a8f)){if(_0xf5a8f[_0x1ed6('0x28')]===0x1){_0x30f971=_0xf5a8f[0x0];logger['info'](_0x1ed6('0x29'),_0x5308a0[_0x1ed6('0x2a')],_0xadca83['id'],_0x30f971['id']);}else{logger[_0x1ed6('0xb')](_0x1ed6('0x2b'),_0x5308a0['uniqueid'],_0xadca83['id'],_[_0x1ed6('0x19')](_0xf5a8f,'id')['join'](','));}return;}else{logger[_0x1ed6('0xb')](_0x1ed6('0x2c'),_0x5308a0['uniqueid'],_0xadca83['id']);var _0x3955a7={'ListId':_0x1e38ae};var _0x257467=_0x57ab0f[_0x1ed6('0x2d')]&&_0x57ab0f[_0x1ed6('0x2d')]!=='0'?_0x57ab0f['data4']:_0x1ed6('0x17');if(_0x2e7302){logger[_0x1ed6('0xb')](_0x1ed6('0x2e'),_0x5308a0[_0x1ed6('0x2a')],_0xadca83['id']);_0x3955a7[_0x257467]=_[_0x1ed6('0x11')](_0x5308a0['routeId'])?_0x5308a0['calleridnum']:_0x5308a0[_0x1ed6('0x1b')];if(_[_0x1ed6('0x11')](_0x5308a0[_0x1ed6('0x1a')])){_0x3955a7[_0x1ed6('0x1d')]=_0x5308a0[_0x1ed6('0x2f')]&&_0x5308a0['calleridname']!==_0x1ed6('0x30')?_0x5308a0['calleridname']:_0x1ed6('0x31');}else{_0x3955a7['firstName']=_0x5308a0[_0x1ed6('0x32')]&&_0x5308a0[_0x1ed6('0x32')]!==_0x1ed6('0x30')?_0x5308a0[_0x1ed6('0x32')]:_0x1ed6('0x31');}return BPromise[_0x1ed6('0x33')]()[_0x1ed6('0x25')](cmContactRpc['createContact'](_0x3955a7))[_0x1ed6('0x25')](function(_0x5e4c00){_0x30f971=_0x5e4c00;_0xf5a8f[_0x1ed6('0x34')](_0x5e4c00);if(_0x30f971){logger[_0x1ed6('0xb')](_0x1ed6('0x35'),_0x5308a0[_0x1ed6('0x2a')],_0xadca83['id'],_0x30f971['id']);}return;});}else{logger[_0x1ed6('0xb')](_0x1ed6('0x36'),_0x5308a0['uniqueid'],_0xadca83['id']);_0x3955a7[_0x257467]=_[_0x1ed6('0x11')](_0x5308a0[_0x1ed6('0x1a')])?_0x5308a0[_0x1ed6('0x1c')]:_0x5308a0[_0x1ed6('0x1b')];if(_[_0x1ed6('0x11')](_0x5308a0[_0x1ed6('0x1a')])){_0x3955a7[_0x1ed6('0x1d')]=_0x5308a0['calleridname']&&_0x5308a0[_0x1ed6('0x2f')]!==_0x1ed6('0x30')?_0x5308a0[_0x1ed6('0x2f')]:_0x1ed6('0x31');}else{_0x3955a7['firstName']=_0x5308a0[_0x1ed6('0x32')]&&_0x5308a0['destcalleridname']!==_0x1ed6('0x30')?_0x5308a0['destcalleridname']:_0x1ed6('0x31');}_0x30f971=_0x3955a7;_0xf5a8f['push'](_0x3955a7);return;}}})['then'](function(){if(_0x5e88c9){emit(_0x5308a0['uniqueid'],_0xadca83,util[_0x1ed6('0x37')]('user:%s',_0x5e88c9[_0x1ed6('0x38')]),util[_0x1ed6('0x37')](_0x1ed6('0x39'),_0x57ab0f[_0x1ed6('0x3a')][_0x1ed6('0x3b')]()),{'evt':_[_0x1ed6('0x3c')](_0x5308a0,{'autoCreate':_0x2e7302}),'contact':_0x30f971===undefined?{}:_0x30f971,'contacts':_0xf5a8f[_0x1ed6('0x28')]===0x0?undefined:_0xf5a8f});}});}; \ No newline at end of file +var _0x1f3d=['../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','data5','xmd-contactid','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','fax','ListId','createdAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','uniqueid','data4','isNil','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','name','toLowerCase','merge','lodash','bluebird','ioredis','../../../../config/environment'];(function(_0x5635d9,_0x2da3ef){var _0x401308=function(_0x3d5b41){while(--_0x3d5b41){_0x5635d9['push'](_0x5635d9['shift']());}};_0x401308(++_0x2da3ef);}(_0x1f3d,0x10f));var _0xd1f3=function(_0x558790,_0x237bd2){_0x558790=_0x558790-0x0;var _0x78ccf9=_0x1f3d[_0x558790];return _0x78ccf9;};'use strict';var _=require(_0xd1f3('0x0'));var BPromise=require(_0xd1f3('0x1'));var Redis=require(_0xd1f3('0x2'));var util=require('util');var config=require(_0xd1f3('0x3'));var logger=require(_0xd1f3('0x4'))(_0xd1f3('0x5'));var cmContactRpc=require(_0xd1f3('0x6'));config[_0xd1f3('0x7')]=_['defaults'](config[_0xd1f3('0x7')],{'host':_0xd1f3('0x8'),'port':0x18eb});var io=require(_0xd1f3('0x9'))(new Redis(config['redis']));function emit(_0x3358fc,_0x372296,_0x53bd7d,_0x4a4711,_0x240dc4){logger[_0xd1f3('0xa')](_0xd1f3('0xb'),_0x3358fc,_0x372296['id'],_0x53bd7d,_0x4a4711,JSON['stringify'](_0x240dc4));io['to'](_0x53bd7d)[_0xd1f3('0xc')](_0x4a4711,_0x240dc4);}exports[_0xd1f3('0xd')]=function(_0x230e13,_0x2b50c6,_0x415107,_0xec5588){var _0x36aeb5,_0x2fc121;var _0x3a378a={};var _0x3cdfa0;var _0x24598e=Number(_0x415107[_0xd1f3('0xe')]);var _0x43df58=_0x415107[_0xd1f3('0xf')]?Boolean(Number(_0x415107[_0xd1f3('0xf')])):![];var _0x1c514c;var _0x5c47a5=![];if(!_['isNil'](_0x415107['data5'])){if(_0x415107[_0xd1f3('0x10')]=='1')_0x5c47a5=!![];}if(!_0x5c47a5){if(_0xec5588[_0xd1f3('0x11')]){_0x3a378a['id']=_0xec5588['xmd-contactid'];}}if(!_0x3a378a['id']){_0x3a378a['ListId']=_0x24598e;_0x1c514c=_0x415107[_0xd1f3('0x12')]&&_0x415107[_0xd1f3('0x12')]!=='0'?_0x415107[_0xd1f3('0x12')][_0xd1f3('0x13')](','):[_0xd1f3('0x14')];_0x3a378a[_0xd1f3('0x15')]=_[_0xd1f3('0x16')](_0x1c514c,function(_0xbb1a7b){var _0x38bb2d={};_0x38bb2d[_0xbb1a7b]=_0xec5588[_0xd1f3('0x17')]?_0xec5588[_0xd1f3('0x18')]:_0xec5588['calleridnum'];return _0x38bb2d;});_0x3cdfa0=_0xec5588[_0xd1f3('0x17')]?_0xec5588['destcalleridnum']:_0xec5588[_0xd1f3('0x19')];}var _0x30b6b3=['id',_0xd1f3('0x1a'),_0xd1f3('0x1b'),_0xd1f3('0x14'),'mobile',_0xd1f3('0x1c'),_0xd1f3('0x1d'),_0xd1f3('0x1e'),'scheduledAt',_0xd1f3('0x1f')];var _0x5557a5=_[_0xd1f3('0x20')](_0x30b6b3,_0x1c514c);BPromise[_0xd1f3('0x21')]()['then'](cmContactRpc[_0xd1f3('0x22')]({'attributes':_0x5557a5,'where':_0x3a378a,'phone':_0x3cdfa0}))[_0xd1f3('0x23')](function(_0x402e5f){_0x2fc121=_0x402e5f;if(!_[_0xd1f3('0x24')](_0x2fc121)){if(_0x2fc121[_0xd1f3('0x25')]===0x1){_0x36aeb5=_0x2fc121[0x0];logger[_0xd1f3('0xa')](_0xd1f3('0x26'),_0xec5588['uniqueid'],_0x2b50c6['id'],_0x36aeb5['id']);}else{logger[_0xd1f3('0xa')](_0xd1f3('0x27'),_0xec5588['uniqueid'],_0x2b50c6['id'],_[_0xd1f3('0x16')](_0x2fc121,'id')[_0xd1f3('0x28')](','));}return;}else{logger[_0xd1f3('0xa')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0xec5588[_0xd1f3('0x29')],_0x2b50c6['id']);var _0x314da3={'ListId':_0x24598e};var _0x3a6ec0=_0x415107[_0xd1f3('0x2a')]&&_0x415107[_0xd1f3('0x2a')]!=='0'?_0x415107[_0xd1f3('0x2a')]:_0xd1f3('0x14');if(_0x43df58){logger[_0xd1f3('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0xec5588[_0xd1f3('0x29')],_0x2b50c6['id']);_0x314da3[_0x3a6ec0]=_['isNil'](_0xec5588['routeId'])?_0xec5588[_0xd1f3('0x19')]:_0xec5588['destcalleridnum'];if(_[_0xd1f3('0x2b')](_0xec5588[_0xd1f3('0x17')])){_0x314da3['firstName']=_0xec5588[_0xd1f3('0x2c')]&&_0xec5588[_0xd1f3('0x2c')]!==_0xd1f3('0x2d')?_0xec5588[_0xd1f3('0x2c')]:'Unknown';}else{_0x314da3[_0xd1f3('0x1a')]=_0xec5588[_0xd1f3('0x2e')]&&_0xec5588[_0xd1f3('0x2e')]!==_0xd1f3('0x2d')?_0xec5588[_0xd1f3('0x2e')]:_0xd1f3('0x2f');}return BPromise[_0xd1f3('0x21')]()[_0xd1f3('0x23')](cmContactRpc[_0xd1f3('0x30')](_0x314da3))[_0xd1f3('0x23')](function(_0x80141b){_0x36aeb5=_0x80141b;_0x2fc121[_0xd1f3('0x31')](_0x80141b);if(_0x36aeb5){logger['info'](_0xd1f3('0x32'),_0xec5588[_0xd1f3('0x29')],_0x2b50c6['id'],_0x36aeb5['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0xec5588[_0xd1f3('0x29')],_0x2b50c6['id']);_0x314da3[_0x3a6ec0]=_[_0xd1f3('0x2b')](_0xec5588[_0xd1f3('0x17')])?_0xec5588['calleridnum']:_0xec5588[_0xd1f3('0x18')];if(_['isNil'](_0xec5588[_0xd1f3('0x17')])){_0x314da3[_0xd1f3('0x1a')]=_0xec5588[_0xd1f3('0x2c')]&&_0xec5588[_0xd1f3('0x2c')]!==_0xd1f3('0x2d')?_0xec5588[_0xd1f3('0x2c')]:_0xd1f3('0x2f');}else{_0x314da3[_0xd1f3('0x1a')]=_0xec5588[_0xd1f3('0x2e')]&&_0xec5588[_0xd1f3('0x2e')]!==_0xd1f3('0x2d')?_0xec5588[_0xd1f3('0x2e')]:'Unknown';}_0x36aeb5=_0x314da3;_0x2fc121[_0xd1f3('0x31')](_0x314da3);return;}}})[_0xd1f3('0x23')](function(){if(_0x230e13){emit(_0xec5588[_0xd1f3('0x29')],_0x2b50c6,util[_0xd1f3('0x33')]('user:%s',_0x230e13[_0xd1f3('0x34')]),util[_0xd1f3('0x33')]('trigger:%s',_0x415107['action'][_0xd1f3('0x35')]()),{'evt':_[_0xd1f3('0x36')](_0xec5588,{'autoCreate':_0x43df58}),'contact':_0x36aeb5===undefined?{}:_0x36aeb5,'contacts':_0x2fc121['length']===0x0?undefined:_0x2fc121});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index c9bbe36..e1eba7b 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 _0x6b1a=['search','replace','channel','AllConditions','every','AnyConditions','some','checkConditions','debug','checkTrigger:\x20trigger','inspect','evt','field','ChatWebsiteId','operator','value','upperFirst','AccountId','message','event','membername','lastevent','mailSubstatus','substatus','offlineMessage','created','util','lodash','url','ioredis','./urlforward','./integration','../../../config/environment','../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','undefined','motionChannel','voice','checkTriggers','interface','hasOwnProperty','status','checkTrigger','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','data3','isNil','data4','location','uriLocation','windowWidth','800','data5','data6','winApplication','winArguments','user:%s','name','trigger:%s:%s','merge','jscripty','format','trigger:%s','exec','integration','queue','routeId','script','buildUri','parse','query'];(function(_0x2c0d8b,_0x55270d){var _0x32d0ea=function(_0x583ce9){while(--_0x583ce9){_0x2c0d8b['push'](_0x2c0d8b['shift']());}};_0x32d0ea(++_0x55270d);}(_0x6b1a,0x1a9));var _0xa6b1=function(_0xdf3a31,_0x3a5cc7){_0xdf3a31=_0xdf3a31-0x0;var _0x96d43e=_0x6b1a[_0xdf3a31];return _0x96d43e;};'use strict';var util=require(_0xa6b1('0x0'));var _=require(_0xa6b1('0x1'));var url=require(_0xa6b1('0x2'));var Mustache=require('mustache');var Redis=require(_0xa6b1('0x3'));var urlforward=require(_0xa6b1('0x4'));var integration=require(_0xa6b1('0x5'));var cmContact=require('./cmContact');var script=require('./script');var config=require(_0xa6b1('0x6'));var logger=require(_0xa6b1('0x7'))(_0xa6b1('0x8'));var ami=require('../ami');config[_0xa6b1('0x9')]=_[_0xa6b1('0xa')](config[_0xa6b1('0x9')],{'host':_0xa6b1('0xb'),'port':0x18eb});var io=require(_0xa6b1('0xc'))(new Redis(config[_0xa6b1('0x9')]));var operators={'equals':function(_0x723f9f,_0x4abe7c){return _0x723f9f==_0x4abe7c;},'not_equals':function(_0x633c1b,_0x50b677){return _0x633c1b!=_0x50b677;}};var barAndWebActions=[_0xa6b1('0xd'),_0xa6b1('0x2'),_0xa6b1('0xe')];function Trigger(_0x35f87e){this[_0xa6b1('0xf')]=_0x35f87e['triggers'];this[_0xa6b1('0x10')]=_0x35f87e['agents'];this[_0xa6b1('0x11')]=_0x35f87e['voiceQueues'];this[_0xa6b1('0x12')]=_0x35f87e[_0xa6b1('0x12')];this[_0xa6b1('0x13')]=_0x35f87e[_0xa6b1('0x13')];this[_0xa6b1('0x14')]=_0x35f87e[_0xa6b1('0x14')];this['freshdeskAccounts']=_0x35f87e[_0xa6b1('0x15')];this[_0xa6b1('0x16')]=_0x35f87e[_0xa6b1('0x16')];this[_0xa6b1('0x17')]=_0x35f87e[_0xa6b1('0x17')];this[_0xa6b1('0x18')]=_0x35f87e[_0xa6b1('0x18')];this[_0xa6b1('0x19')]=_0x35f87e[_0xa6b1('0x19')];this['vtigerAccounts']=_0x35f87e[_0xa6b1('0x1a')];this['servicenowAccounts']=_0x35f87e[_0xa6b1('0x1b')];this[_0xa6b1('0x1c')]=_0x35f87e[_0xa6b1('0x1c')];this[_0xa6b1('0x1d')]=_0x35f87e[_0xa6b1('0x1d')];this[_0xa6b1('0x1e')]={'zendesk':this[_0xa6b1('0x14')],'salesforce':this[_0xa6b1('0x16')],'freshdesk':this[_0xa6b1('0x15')],'sugarcrm':this[_0xa6b1('0x17')],'zoho':this['zohoAccounts'],'desk':this[_0xa6b1('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xa6b1('0x1c')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xa6b1('0x1b')]};ami['on'](_0xa6b1('0x1f'),this[_0xa6b1('0x20')][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x22'),this['syncCustomEvent'][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x23'),this[_0xa6b1('0x20')][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x24'),this[_0xa6b1('0x20')][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x25'),this[_0xa6b1('0x20')][_0xa6b1('0x21')](this));ami['on']('custom:agentnoanswer',this[_0xa6b1('0x20')][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x26'),this['syncCustomEvent'][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x27'),this[_0xa6b1('0x20')]['bind'](this));ami['on'](_0xa6b1('0x28'),this[_0xa6b1('0x20')]['bind'](this));ami['on']('custom:amd',this[_0xa6b1('0x20')][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x29'),this[_0xa6b1('0x20')][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x2a'),this[_0xa6b1('0x20')][_0xa6b1('0x21')](this));ami['on']('custom:dialbegin',this[_0xa6b1('0x2b')][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x2c'),this[_0xa6b1('0x2b')][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x2d'),this['syncAgentDial'][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x2e'),this[_0xa6b1('0x20')]['bind'](this));ami['on']('custom:closedinteraction',this[_0xa6b1('0x20')][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x2f'),this[_0xa6b1('0x20')][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x30'),this[_0xa6b1('0x20')][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x31'),this[_0xa6b1('0x20')][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x32'),this[_0xa6b1('0x20')][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x33'),this[_0xa6b1('0x20')][_0xa6b1('0x21')](this));ami['on'](_0xa6b1('0x34'),this[_0xa6b1('0x20')]['bind'](this));}Trigger[_0xa6b1('0x35')][_0xa6b1('0x36')]=function(_0x2c724b,_0x43a144,_0x4f38a3){logger[_0xa6b1('0x37')](_0x2c724b,_0x43a144,JSON[_0xa6b1('0x38')](_0x4f38a3));io['to'](_0x2c724b)[_0xa6b1('0x36')](_0x43a144,_0x4f38a3);};Trigger['prototype'][_0xa6b1('0x20')]=function(_0x10462e){var _0x69b197=_[_0xa6b1('0x39')](_0x10462e);if(typeof _0x69b197['motionChannel']===_0xa6b1('0x3a')){_0x69b197[_0xa6b1('0x3b')]=_0xa6b1('0x3c');}logger['debug'](_0xa6b1('0x20'),util['inspect'](_0x69b197,{'showHidden':!![],'depth':null}));this[_0xa6b1('0x3d')](_0x69b197);};Trigger[_0xa6b1('0x35')]['syncAgentDial']=function(_0x657512){if(this[_0xa6b1('0x10')][_0x657512[_0xa6b1('0x3e')]]){this['syncCustomEvent'](_0x657512);}};Trigger['prototype'][_0xa6b1('0x3d')]=function(_0x4a149d){var _0x53ac99;for(var _0x11bce1 in this['triggers']){if(this[_0xa6b1('0xf')][_0xa6b1('0x3f')](_0x11bce1)){if(this[_0xa6b1('0xf')][_0x11bce1][_0xa6b1('0x40')]){_0x53ac99=this[_0xa6b1('0x41')](this[_0xa6b1('0xf')][_0x11bce1],_0x4a149d);if(_0x53ac99){_['merge'](_0x4a149d,_0x4a149d[_0xa6b1('0x42')]);for(var _0x462d28=0x0,_0x3ff715,_0x18d88a,_0x3d1bf5;_0x462d280x0){_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 _0x326f=['catch','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','then','total_entries','_embedded','entries','Agent\x20found!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','debug','[HTTP]','GET','authType','basic','password','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','toString','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','xCALLY','concat','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','%s/agent/tickets/%s'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x326f,0xd1));var _0xf326=function(_0x20a5e1,_0x57f34b){_0x20a5e1=_0x20a5e1-0x0;var _0x1bd7eb=_0x326f[_0x20a5e1];return _0x1bd7eb;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var intUtil=require(_0xf326('0x3'));var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));config[_0xf326('0x7')]=_[_0xf326('0x8')](config[_0xf326('0x7')],{'host':_0xf326('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf326('0x7')]));function emit(_0x3851eb,_0x165f95,_0x1e7b8a){io['to'](_0x3851eb)['emit'](_0x165f95,_0x1e7b8a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x3bacf2,_0x1fc80e){if(intUtil[_0xf326('0xa')](_0x1fc80e)===!![]){logger[_0xf326('0xb')](_0xf326('0xc'),_0x1fc80e);return request({'uri':util['format'](_0xf326('0xd'),_0x3bacf2['remoteUri'])})[_0xf326('0xe')](function(_0x4aaf3a){if(_0x4aaf3a[_0xf326('0xf')]){return _['find'](_0x4aaf3a[_0xf326('0x10')][_0xf326('0x11')],{'email':_0x1fc80e});}})['then'](function(_0x342fe5){if(_0x342fe5){logger[_0xf326('0xb')](_0xf326('0x12'));return _0x342fe5;}else{logger[_0xf326('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf326('0x13')]('%s/users/me',_0x3bacf2['remoteUri'])});}});}else{logger[_0xf326('0xb')](_0xf326('0x14'));return request({'uri':util[_0xf326('0x13')](_0xf326('0x15'),_0x3bacf2[_0xf326('0x16')])});}}function request(_0x287a2a){logger[_0xf326('0x17')](_0xf326('0x18'),JSON['stringify'](_0x287a2a));return rp(_[_0xf326('0x8')](_0x287a2a,{'method':_0xf326('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x18bee3){var _0x31ffb9;if(_0x18bee3[_0xf326('0x1a')]===_0xf326('0x1b')){_0x31ffb9=util['format']('%s:%s',_0x18bee3['username'],_0x18bee3[_0xf326('0x1c')]);}else if(_0x18bee3[_0xf326('0x1a')]==='token'){_0x31ffb9=util['format'](_0xf326('0x1d'),_0x18bee3['username'],_0x18bee3['token']);}return util[_0xf326('0x13')](_0xf326('0x1e'),new Buffer(_0x31ffb9)['toString']('base64'));}function getEndUser(_0x19b8ba,_0xb1efcf,_0x5f21a2){logger[_0xf326('0xb')](_0xf326('0x1f'),_0x5f21a2);return request({'uri':util[_0xf326('0x13')](_0xf326('0x20'),_0x19b8ba[_0xf326('0x16')]),'qs':{'phone':_0x5f21a2}})[_0xf326('0xe')](function(_0x5ce532){if(_0x5ce532['total_entries']){logger['info'](_0xf326('0x21'));return _0x5ce532[_0xf326('0x10')][_0xf326('0x11')][0x0];}else{logger[_0xf326('0xb')](_0xf326('0x22'));return request({'uri':util[_0xf326('0x13')]('%s/customers',_0x19b8ba[_0xf326('0x16')]),'method':_0xf326('0x23'),'body':{'first_name':_0xb1efcf,'title':_0xb1efcf,'phone_numbers':[{'type':_0xf326('0x24'),'value':_0x5f21a2}]}});}});}function getTags(_0x581531,_0x1617d2){var _0x55ad0f=[];if(_0x581531&&_0x581531['length']>0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ 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 f183641..67be53f 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 _0x5e6c=['replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','enduserId','includes','string','type','nameField','customField','indexOf','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','phonecall','callDirection','queue','Subjects','calleridnum','Fields','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','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','./util','md5','ioredis','dynamics365','localhost','remoteUri','data7','tenantId','CloudProvider','data2','resolve','data5','POST','clientId','username','password','access_token','catch','error',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','userEmail','length','email','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','outbound','destcalleridnum','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','toLowerCase','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27'];(function(_0xb53c57,_0xc87666){var _0x3ed206=function(_0x5323b7){while(--_0x5323b7){_0xb53c57['push'](_0xb53c57['shift']());}};_0x3ed206(++_0xc87666);}(_0x5e6c,0xa7));var _0xc5e6=function(_0x14e6a2,_0x124bbd){_0x14e6a2=_0x14e6a2-0x0;var _0x4d56eb=_0x5e6c[_0x14e6a2];return _0x4d56eb;};'use strict';var _=require(_0xc5e6('0x0'));var rp=require('request-promise');var util=require('util');var intUtil=require(_0xc5e6('0x1'));var md5=require(_0xc5e6('0x2'));var Redis=require(_0xc5e6('0x3'));var logger=require('../../../../config/logger')(_0xc5e6('0x4'));var config=require('../../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':_0xc5e6('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x27a520,_0x15b667,_0x11dfb2){if(_0x27a520['modernAuthentication']){_0x27a520[_0xc5e6('0x6')]=_0x27a520['CloudProvider'][_0xc5e6('0x7')];_0x27a520[_0xc5e6('0x8')]=_0x27a520[_0xc5e6('0x9')][_0xc5e6('0xa')];return Promise[_0xc5e6('0xb')](_0x27a520[_0xc5e6('0x9')][_0xc5e6('0xc')]);}var _0xcf29fb={'method':_0xc5e6('0xd'),'uri':_0x15b667,'form':{'client_id':_0x27a520[_0xc5e6('0xe')],'resource':_0x27a520['remoteUri'],'username':_0x27a520[_0xc5e6('0xf')],'password':_0x27a520[_0xc5e6('0x10')],'grant_type':_0xc5e6('0x10'),'client_secret':_0x27a520['clientSecret']},'json':!![]};return rp(_0xcf29fb)['then'](function(_0x438b0a){return _0x438b0a[_0xc5e6('0x11')];})[_0xc5e6('0x12')](function(_0x490476){logger[_0xc5e6('0x13')]('['+[_0x11dfb2['toUpperCase']()]+_0xc5e6('0x14'));return _0x490476[_0xc5e6('0x15')];});}function getUser(_0x207fe5,_0x3872c4,_0x21ade9,_0x1ac953,_0x176cef,_0x3e56b4){return new Promise(function(_0x323a37,_0x25c8f1){return getAuthToken(_0x3872c4,_0x1ac953,_0x3e56b4)[_0xc5e6('0x16')](function(_0x5e44f8){var _0x4fef3b={'method':_0xc5e6('0x17'),'uri':_0x176cef+_0xc5e6('0x18'),'headers':{'Authorization':_0xc5e6('0x19')+_0x5e44f8,'OData-Version':_0xc5e6('0x1a')},'json':!![]};return rp(_0x4fef3b);})[_0xc5e6('0x16')](function(_0x4e3651){var _0x542d91=_0x4e3651[_0xc5e6('0x1b')];var _0x59ccdd=![];var _0x1d2fb3=null;if(!_['isNil'](_0x21ade9)){if(intUtil[_0xc5e6('0x1c')](_0x21ade9['email'])){_0x207fe5[_0xc5e6('0x1d')]=_0x21ade9['email'];for(_0x1d2fb3=0x0;_0x1d2fb3<_0x542d91[_0xc5e6('0x1e')];_0x1d2fb3++){if(_0x542d91[_0x1d2fb3]['internalemailaddress']===_0x21ade9[_0xc5e6('0x1f')]&&!_0x542d91[_0x1d2fb3][_0xc5e6('0x20')]){_0x59ccdd=!![];logger[_0xc5e6('0x21')]('['+[_0x3e56b4[_0xc5e6('0x22')]()]+_0xc5e6('0x23')+_0x542d91[_0x1d2fb3]['systemuserid']+'!');_0x207fe5[_0xc5e6('0x24')]=_0x542d91[_0x1d2fb3][_0xc5e6('0x25')];}}}}if(!_0x59ccdd){logger[_0xc5e6('0x21')]('['+[_0x3e56b4[_0xc5e6('0x22')]()]+_0xc5e6('0x26'));_0x207fe5['userEmail']=_0x3872c4['username'];for(_0x1d2fb3=0x0;_0x1d2fb3<_0x542d91[_0xc5e6('0x1e')];_0x1d2fb3++){if(_0x542d91[_0x1d2fb3][_0xc5e6('0x27')]===_0x3872c4[_0xc5e6('0xf')]){_0x207fe5[_0xc5e6('0x24')]=_0x542d91[_0x1d2fb3][_0xc5e6('0x25')];}}}_0x323a37(_0x207fe5);})['catch'](function(_0x3578e8){_0x25c8f1(_0x3578e8[_0xc5e6('0x15')]);});});}function createEndUser(_0x4c7e71,_0x553315,_0x5c16a1,_0x2d3b1f,_0x396ff8,_0x435c78,_0x253cbf){return new Promise(function(_0x523869,_0x16ba58){return getAuthToken(_0x553315,_0x5c16a1,_0x435c78)[_0xc5e6('0x16')](function(_0x176041){var _0x1dcd99=_0x435c78['toLowerCase']()===_0xc5e6('0x28')?_0x396ff8[_0xc5e6('0x29')]:_0x396ff8['calleridnum'];var _0x5a1eac={'method':'POST','uri':_0x2d3b1f+'contacts','body':{'fullname':_0x1dcd99,'firstname':_0x1dcd99,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xc5e6('0x2a')+_0x4c7e71['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x176041,'OData-Version':_0xc5e6('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x5a1eac[_0xc5e6('0x2b')][_0x253cbf]=_0x1dcd99;return rp(_0x5a1eac);})['then'](function(_0x371d94){var _0x7ad090=_0x371d94[_0xc5e6('0x2c')][_0xc5e6('0x2d')];var _0x1772bb=_0x7ad090[_0xc5e6('0x2e')](_0x7ad090[_0xc5e6('0x2f')]('(')+0x1,_0x7ad090[_0xc5e6('0x2f')](')'));_0x4c7e71['enduserId']=_0x1772bb;_0x523869(_0x4c7e71);})['catch'](function(_0x2e752d){_0x16ba58(_0x2e752d['message']);});});}function getEndUser(_0x36c616,_0x1ac1d7,_0x19fdf8,_0x1945e6,_0x160919,_0x44032b,_0x1ab394,_0x389a65){var _0x43dba5=_0x44032b[_0xc5e6('0x30')]()==='outbound'?_0x160919['destcalleridnum']:_0x160919['calleridnum'];return getAuthToken(_0x1ac1d7,_0x19fdf8,_0x44032b)[_0xc5e6('0x16')](function(_0x54677b){_0x389a65=_0x389a65?_0x389a65:_0xc5e6('0x31');var _0x5ad81d={'method':_0xc5e6('0x17'),'uri':_0x1945e6+_0xc5e6('0x32')+_0x389a65+_0xc5e6('0x33')+_0x389a65+_0xc5e6('0x34')+_0x43dba5[_0xc5e6('0x35')]('+',_0xc5e6('0x36'))+'\x27','headers':{'Authorization':_0xc5e6('0x19')+_0x54677b,'If-None-Match':null,'OData-Version':_0xc5e6('0x1a')},'json':!![]};return rp(_0x5ad81d);})[_0xc5e6('0x16')](function(_0x2db545){var _0x10aa8b=![];if(!_0x2db545)return _0x10aa8b;var _0x5e62b7=_0x2db545[_0xc5e6('0x1b')];for(var _0x1aae27=0x0;_0x1aae27<_0x5e62b7[_0xc5e6('0x1e')];_0x1aae27++){if(_0x5e62b7[_0x1aae27][_0x389a65]===_0x43dba5){_0x10aa8b=!![];_0x36c616['enduserId']=_0x5e62b7[_0x1aae27][_0xc5e6('0x37')];}}return _0x10aa8b;})[_0xc5e6('0x16')](function(_0x2589e8){if(_0x2589e8)return _0x36c616;if(_0x1ab394===_0xc5e6('0x38')){logger[_0xc5e6('0x21')]('['+[_0x44032b[_0xc5e6('0x22')]()]+_0xc5e6('0x39'));return _0x36c616;}return createEndUser(_0x36c616,_0x1ac1d7,_0x19fdf8,_0x1945e6,_0x160919,_0x44032b,_0x389a65)[_0xc5e6('0x16')](function(_0x54a247){logger['info']('['+[_0x44032b[_0xc5e6('0x22')]()]+_0xc5e6('0x3a'),_0x54a247[_0xc5e6('0x3b')]);return _0x54a247;});});}function getCustomFields(_0x410622,_0x11ba86,_0x42e366){var _0x2f6a12={};if(_0x410622[_0xc5e6('0x1e')]>0x0){_['forEach'](_0x410622,function(_0x159a23){if(_[_0xc5e6('0x3c')]([_0xc5e6('0x3d'),'picklist'],_0x159a23[_0xc5e6('0x3e')])&&_0x159a23[_0xc5e6('0x3f')]&&!_0x159a23[_0xc5e6('0x40')]){var _0x219fc2=_0x159a23['idField'][_0xc5e6('0x30')]();var _0x6babdb=_0x219fc2[_0xc5e6('0x2e')](0x0,_0x219fc2['indexOf']('_'));var _0x58a317=_0x219fc2['substring'](_0x219fc2[_0xc5e6('0x41')]('_')+0x1);if(_0x6babdb===_0x42e366){_0x2f6a12[_0x58a317]=_0x159a23['content'];}}});}return _0x2f6a12;}function getTicket(_0x396ae0,_0x57569e,_0x323de6,_0xb332a4,_0x3952ec,_0x354ee8,_0x1bff4b){return new Promise(function(_0x1e4bf8,_0xc9d7f2){var _0x37b9ba;return getAuthToken(_0x57569e,_0x323de6,_0x1bff4b)[_0xc5e6('0x16')](function(_0x5ccfc6){if(_0x354ee8[_0xc5e6('0x42')]===_0xc5e6('0x43')){_0x37b9ba={'method':_0xc5e6('0xd'),'uri':_0xb332a4+_0xc5e6('0x44'),'body':Object[_0xc5e6('0x45')]({},{'title':intUtil['getString'](_0x354ee8['Subjects'],_0x3952ec,'\x20'),'description':intUtil[_0xc5e6('0x46')](_0x354ee8[_0xc5e6('0x47')],_0x3952ec,'\x0a'),'customerid_contact@odata.bind':_0x396ae0['enduserId']?_0xc5e6('0x48')+_0x396ae0[_0xc5e6('0x3b')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x396ae0[_0xc5e6('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x354ee8['Fields'],_0x3952ec,_0x354ee8[_0xc5e6('0x42')])),'headers':{'Authorization':_0xc5e6('0x19')+_0x5ccfc6,'OData-Version':_0xc5e6('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x354ee8[_0xc5e6('0x42')]===_0xc5e6('0x49')){var _0x2c50d4=_0x396ae0[_0xc5e6('0x3b')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x396ae0[_0xc5e6('0x24')]+')','participationtypemask':_0x396ae0[_0xc5e6('0x4a')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xc5e6('0x48')+_0x396ae0[_0xc5e6('0x3b')]+')','participationtypemask':_0x396ae0[_0xc5e6('0x4a')]===_0xc5e6('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xc5e6('0x2a')+_0x396ae0[_0xc5e6('0x24')]+')','participationtypemask':_0x396ae0[_0xc5e6('0x4a')]==='queue'?0x2:0x1}];_0x37b9ba={'method':'POST','uri':_0xb332a4+'phonecalls','body':Object[_0xc5e6('0x45')]({},{'subject':intUtil[_0xc5e6('0x46')](_0x354ee8[_0xc5e6('0x4c')],_0x3952ec,'\x20'),'phonenumber':String(_0x3952ec[_0xc5e6('0x4d')]),'description':intUtil[_0xc5e6('0x46')](_0x354ee8[_0xc5e6('0x47')],_0x3952ec,'\x0a'),'regardingobjectid_contact@odata.bind':_0x396ae0['enduserId']?_0xc5e6('0x48')+_0x396ae0['enduserId']+')':undefined,'ownerid@odata.bind':_0xc5e6('0x2a')+_0x396ae0[_0xc5e6('0x24')]+')','directioncode':_0x396ae0['callDirection']===_0xc5e6('0x4b')?![]:!![],'phonecall_activity_parties':_0x2c50d4},getCustomFields(_0x354ee8[_0xc5e6('0x4e')],_0x3952ec,_0x354ee8[_0xc5e6('0x42')])),'headers':{'Authorization':_0xc5e6('0x19')+_0x5ccfc6,'OData-Version':_0xc5e6('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x37b9ba);})['then'](function(_0x45ca80){var _0x937e25=_0x45ca80[_0xc5e6('0x2c')][_0xc5e6('0x2d')];var _0x22b8e1=_0x937e25[_0xc5e6('0x2e')](_0x937e25[_0xc5e6('0x2f')]('(')+0x1,_0x937e25['lastIndexOf'](')'));_0x396ae0['ticketId']=_0x22b8e1;_0x1e4bf8(_0x396ae0);})[_0xc5e6('0x12')](function(_0xadfb83){_0xc9d7f2(_0xadfb83[_0xc5e6('0x15')]);});});}function emit(_0x387ccc,_0x124c7f,_0x3c459b,_0x4138c9){var _0x4788ce={'uri':util[_0xc5e6('0x4f')](_0xc5e6('0x50'),_0x387ccc,_0x3c459b,_0x4138c9)};io['to'](util[_0xc5e6('0x4f')](_0xc5e6('0x51'),_0x124c7f))[_0xc5e6('0x52')](_0xc5e6('0x53'),_0x4788ce);}exports['cs']=function(_0x5cb2e5,_0x2be151,_0x4e1b7a,_0x447303,_0x20969a,_0x60d175,_0x4764b7,_0xe78173){var _0x4b6684={};_0x60d175[_0xc5e6('0x6')]=_0x60d175[_0xc5e6('0x54')]?intUtil[_0xc5e6('0x55')](_0x60d175['CloudProvider'][_0xc5e6('0x7')]):intUtil['stripTrailingSlash'](_0x60d175[_0xc5e6('0x6')]);_0x60d175[_0xc5e6('0x56')]=intUtil[_0xc5e6('0x55')](_0x60d175[_0xc5e6('0x56')]);_0x4b6684['callDirection']=_0xe78173===_0xc5e6('0x4b')||_0xe78173==='unmanaged'?_0xc5e6('0x4b'):_0xc5e6('0x28');var _0x32f9fa=_0x60d175[_0xc5e6('0x54')]?util[_0xc5e6('0x4f')]('%s/api/data/v9.0/',_0x60d175[_0xc5e6('0x9')][_0xc5e6('0x7')]):util['format'](_0xc5e6('0x57'),_0x60d175[_0xc5e6('0x6')]);var _0x16f758=util[_0xc5e6('0x4f')](_0xc5e6('0x58'),_0x60d175[_0xc5e6('0x8')]);var _0x5e7a02=util[_0xc5e6('0x4f')](_0xc5e6('0x59'),_0x60d175['serverUrl'],_0x2be151[_0xc5e6('0x5a')],md5(_0x2be151['uniqueid']));if(_0x20969a&&_0x20969a[_0xc5e6('0x5b')]){logger[_0xc5e6('0x21')]('[QUEUE]',_0xc5e6('0x5c'));_0x2be151[_0xc5e6('0x5d')]=_0x5e7a02;}else if(_0x4764b7&&_0x4764b7[_0xc5e6('0x5e')]&&_0x4764b7['recordingFormat']!==_0xc5e6('0x5f')){logger[_0xc5e6('0x21')](_0xc5e6('0x60'),_0xc5e6('0x5c'));_0x2be151[_0xc5e6('0x5d')]=_0x5e7a02;}else{_0x2be151[_0xc5e6('0x5d')]='';}return getUser(_0x4b6684,_0x60d175,_0x447303,_0x16f758,_0x32f9fa,_0xe78173)[_0xc5e6('0x16')](function(_0xf54f87){logger[_0xc5e6('0x21')]('['+_0xe78173['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0xf54f87[_0xc5e6('0x24')]);logger['info']('['+_0xe78173[_0xc5e6('0x22')]()+_0xc5e6('0x61'),_0xf54f87[_0xc5e6('0x1d')]);return getEndUser(_0xf54f87,_0x60d175,_0x16f758,_0x32f9fa,_0x2be151,_0xe78173,_0x4e1b7a[_0xc5e6('0x62')],_0x4e1b7a[_0xc5e6('0x63')]);})[_0xc5e6('0x16')](function(_0x3819aa){logger[_0xc5e6('0x21')]('['+_0xe78173['toUpperCase']()+_0xc5e6('0x64'),_0x3819aa[_0xc5e6('0x3b')]);logger['info']('['+_0xe78173[_0xc5e6('0x22')]()+_0xc5e6('0x65'),_0x2be151[_0xc5e6('0x4d')]);return getTicket(_0x3819aa,_0x60d175,_0x16f758,_0x32f9fa,_0x2be151,_0x4e1b7a,_0xe78173);})['then'](function(_0x383e63){logger[_0xc5e6('0x21')](util['format']('['+_0xe78173[_0xc5e6('0x22')]()+_0xc5e6('0x66'),_0x4e1b7a[_0xc5e6('0x42')],_0x383e63['ticketId']));logger[_0xc5e6('0x21')](util[_0xc5e6('0x4f')]('['+_0xe78173[_0xc5e6('0x22')]()+_0xc5e6('0x67'),_0xe78173));if(_0xe78173!=='unmanaged'&&_0x4e1b7a[_0xc5e6('0x68')]){logger[_0xc5e6('0x21')]('['+_0xe78173['toUpperCase']()+']',_0xc5e6('0x69'));emit(_0x60d175[_0xc5e6('0x6')],_0x447303[_0xc5e6('0x6a')],_0x4e1b7a[_0xc5e6('0x42')],_0x383e63[_0xc5e6('0x6b')]);}})[_0xc5e6('0x12')](function(_0x1e7fd4){logger[_0xc5e6('0x13')]('['+_0xe78173['toUpperCase']()+_0xc5e6('0x6c'),_0x1e7fd4[_0xc5e6('0x15')]);console[_0xc5e6('0x13')](_0xc5e6('0x6d'),_0x1e7fd4);});}; \ No newline at end of file +var _0x49d1=['phonecalls','Subjects','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','unmanaged','outbound','modernAuthentication','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','CloudProvider','data7','tenantId','data2','resolve','data5','POST','username','password','catch','toUpperCase',']\x20Wrong\x20credentials!','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','toLowerCase','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','destcalleridnum','calleridnum','telephone1','contacts?$select=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','picklist','type','nameField','customField','indexOf','content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','callDirection','queue'];(function(_0x146af4,_0xe414cc){var _0x728a8a=function(_0x18b3e0){while(--_0x18b3e0){_0x146af4['push'](_0x146af4['shift']());}};_0x728a8a(++_0xe414cc);}(_0x49d1,0xf8));var _0x149d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x49d1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var rp=require(_0x149d('0x0'));var util=require('util');var intUtil=require(_0x149d('0x1'));var md5=require(_0x149d('0x2'));var Redis=require(_0x149d('0x3'));var logger=require(_0x149d('0x4'))(_0x149d('0x5'));var config=require('../../../../config/environment');config[_0x149d('0x6')]=_[_0x149d('0x7')](config['redis'],{'host':_0x149d('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x149d('0x6')]));function getAuthToken(_0x2b4a85,_0x115f8f,_0x3bd56c){if(_0x2b4a85['modernAuthentication']){_0x2b4a85['remoteUri']=_0x2b4a85[_0x149d('0x9')][_0x149d('0xa')];_0x2b4a85[_0x149d('0xb')]=_0x2b4a85[_0x149d('0x9')][_0x149d('0xc')];return Promise[_0x149d('0xd')](_0x2b4a85[_0x149d('0x9')][_0x149d('0xe')]);}var _0x22f7dd={'method':_0x149d('0xf'),'uri':_0x115f8f,'form':{'client_id':_0x2b4a85['clientId'],'resource':_0x2b4a85['remoteUri'],'username':_0x2b4a85[_0x149d('0x10')],'password':_0x2b4a85[_0x149d('0x11')],'grant_type':_0x149d('0x11'),'client_secret':_0x2b4a85['clientSecret']},'json':!![]};return rp(_0x22f7dd)['then'](function(_0x1910da){return _0x1910da['access_token'];})[_0x149d('0x12')](function(_0x383a51){logger['error']('['+[_0x3bd56c[_0x149d('0x13')]()]+_0x149d('0x14'));return _0x383a51['message'];});}function getUser(_0x1e0952,_0x49377d,_0x79c43c,_0x1d75b6,_0x11aa0d,_0x41c87c){return new Promise(function(_0x4e51d8,_0x9f9169){return getAuthToken(_0x49377d,_0x1d75b6,_0x41c87c)[_0x149d('0x15')](function(_0x41fa4c){var _0x1c2afe={'method':_0x149d('0x16'),'uri':_0x11aa0d+_0x149d('0x17'),'headers':{'Authorization':_0x149d('0x18')+_0x41fa4c,'OData-Version':_0x149d('0x19')},'json':!![]};return rp(_0x1c2afe);})['then'](function(_0x117e31){var _0x3bcf01=_0x117e31[_0x149d('0x1a')];var _0x5cff23=![];var _0x4fa931=null;if(!_[_0x149d('0x1b')](_0x79c43c)){if(intUtil['validateEmail'](_0x79c43c[_0x149d('0x1c')])){_0x1e0952[_0x149d('0x1d')]=_0x79c43c[_0x149d('0x1c')];for(_0x4fa931=0x0;_0x4fa931<_0x3bcf01[_0x149d('0x1e')];_0x4fa931++){if(_0x3bcf01[_0x4fa931][_0x149d('0x1f')]===_0x79c43c[_0x149d('0x1c')]&&!_0x3bcf01[_0x4fa931]['isdisabled']){_0x5cff23=!![];logger[_0x149d('0x20')]('['+[_0x41c87c[_0x149d('0x13')]()]+_0x149d('0x21')+_0x3bcf01[_0x4fa931]['systemuserid']+'!');_0x1e0952[_0x149d('0x22')]=_0x3bcf01[_0x4fa931][_0x149d('0x23')];}}}}if(!_0x5cff23){logger['info']('['+[_0x41c87c[_0x149d('0x13')]()]+_0x149d('0x24'));_0x1e0952[_0x149d('0x1d')]=_0x49377d[_0x149d('0x10')];for(_0x4fa931=0x0;_0x4fa931<_0x3bcf01['length'];_0x4fa931++){if(_0x3bcf01[_0x4fa931]['internalemailaddress']===_0x49377d['username']){_0x1e0952[_0x149d('0x22')]=_0x3bcf01[_0x4fa931][_0x149d('0x23')];}}}_0x4e51d8(_0x1e0952);})[_0x149d('0x12')](function(_0x24dffa){_0x9f9169(_0x24dffa[_0x149d('0x25')]);});});}function createEndUser(_0x361b4c,_0x493afe,_0x1bfef4,_0x3abb8a,_0x365099,_0x417553,_0x1a5bb7){return new Promise(function(_0xd5b41b,_0x305ea9){return getAuthToken(_0x493afe,_0x1bfef4,_0x417553)[_0x149d('0x15')](function(_0xc3c492){var _0xb9609d=_0x417553[_0x149d('0x26')]()==='outbound'?_0x365099['destcalleridnum']:_0x365099['calleridnum'];var _0x556949={'method':_0x149d('0xf'),'uri':_0x3abb8a+'contacts','body':{'fullname':_0xb9609d,'firstname':_0xb9609d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x149d('0x27')+_0x361b4c['userId']+')'},'headers':{'Authorization':_0x149d('0x18')+_0xc3c492,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x556949[_0x149d('0x28')][_0x1a5bb7]=_0xb9609d;return rp(_0x556949);})[_0x149d('0x15')](function(_0x3b57b1){var _0x21cc0c=_0x3b57b1[_0x149d('0x29')][_0x149d('0x2a')];var _0x173cd1=_0x21cc0c[_0x149d('0x2b')](_0x21cc0c['lastIndexOf']('(')+0x1,_0x21cc0c[_0x149d('0x2c')](')'));_0x361b4c[_0x149d('0x2d')]=_0x173cd1;_0xd5b41b(_0x361b4c);})['catch'](function(_0x232023){_0x305ea9(_0x232023['message']);});});}function getEndUser(_0x4546f3,_0x28d6f3,_0xc0d408,_0x8bccc4,_0x3c4340,_0x8eb272,_0x584bb9,_0x2d6386){var _0x596521=_0x8eb272[_0x149d('0x26')]()==='outbound'?_0x3c4340[_0x149d('0x2e')]:_0x3c4340[_0x149d('0x2f')];return getAuthToken(_0x28d6f3,_0xc0d408,_0x8eb272)[_0x149d('0x15')](function(_0x75d395){_0x2d6386=_0x2d6386?_0x2d6386:_0x149d('0x30');var _0x5c0494={'method':_0x149d('0x16'),'uri':_0x8bccc4+_0x149d('0x31')+_0x2d6386+'&$filter='+_0x2d6386+_0x149d('0x32')+_0x596521[_0x149d('0x33')]('+',_0x149d('0x34'))+'\x27','headers':{'Authorization':_0x149d('0x18')+_0x75d395,'If-None-Match':null,'OData-Version':_0x149d('0x19')},'json':!![]};return rp(_0x5c0494);})['then'](function(_0x4c87c7){var _0x2b42d1=![];if(!_0x4c87c7)return _0x2b42d1;var _0x343586=_0x4c87c7[_0x149d('0x1a')];for(var _0x52026d=0x0;_0x52026d<_0x343586[_0x149d('0x1e')];_0x52026d++){if(_0x343586[_0x52026d][_0x2d6386]===_0x596521){_0x2b42d1=!![];_0x4546f3[_0x149d('0x2d')]=_0x343586[_0x52026d][_0x149d('0x35')];}}return _0x2b42d1;})['then'](function(_0x5d4019){if(_0x5d4019)return _0x4546f3;if(_0x584bb9===_0x149d('0x36')){logger[_0x149d('0x20')]('['+[_0x8eb272['toUpperCase']()]+_0x149d('0x37'));return _0x4546f3;}return createEndUser(_0x4546f3,_0x28d6f3,_0xc0d408,_0x8bccc4,_0x3c4340,_0x8eb272,_0x2d6386)[_0x149d('0x15')](function(_0x20c44c){logger[_0x149d('0x20')]('['+[_0x8eb272[_0x149d('0x13')]()]+']\x20Enduser\x20created!',_0x20c44c[_0x149d('0x2d')]);return _0x20c44c;});});}function getCustomFields(_0x134aa3,_0x32cab7,_0x5adf71){var _0x29929d={};if(_0x134aa3['length']>0x0){_[_0x149d('0x38')](_0x134aa3,function(_0x204411){if(_[_0x149d('0x39')]([_0x149d('0x3a'),_0x149d('0x3b')],_0x204411[_0x149d('0x3c')])&&_0x204411[_0x149d('0x3d')]&&!_0x204411[_0x149d('0x3e')]){var _0x4f682d=_0x204411['idField']['toLowerCase']();var _0x4f144b=_0x4f682d['substring'](0x0,_0x4f682d[_0x149d('0x3f')]('_'));var _0x167108=_0x4f682d[_0x149d('0x2b')](_0x4f682d[_0x149d('0x3f')]('_')+0x1);if(_0x4f144b===_0x5adf71){_0x29929d[_0x167108]=_0x204411[_0x149d('0x40')];}}});}return _0x29929d;}function getTicket(_0x4b1742,_0x5e5430,_0x3aa47d,_0x27517f,_0x2e2268,_0x400f08,_0xf2bd3a){return new Promise(function(_0x12db64,_0x3d4406){var _0x269e2f;return getAuthToken(_0x5e5430,_0x3aa47d,_0xf2bd3a)[_0x149d('0x15')](function(_0x27daf4){if(_0x400f08[_0x149d('0x41')]===_0x149d('0x42')){_0x269e2f={'method':_0x149d('0xf'),'uri':_0x27517f+_0x149d('0x43'),'body':Object[_0x149d('0x44')]({},{'title':intUtil['getString'](_0x400f08['Subjects'],_0x2e2268,'\x20'),'description':intUtil[_0x149d('0x45')](_0x400f08[_0x149d('0x46')],_0x2e2268,'\x0a'),'customerid_contact@odata.bind':_0x4b1742[_0x149d('0x2d')]?_0x149d('0x47')+_0x4b1742['enduserId']+')':undefined,'ownerid@odata.bind':_0x149d('0x27')+_0x4b1742[_0x149d('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x400f08[_0x149d('0x48')],_0x2e2268,_0x400f08[_0x149d('0x41')])),'headers':{'Authorization':_0x149d('0x18')+_0x27daf4,'OData-Version':_0x149d('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x400f08['ticketType']===_0x149d('0x49')){var _0x9d5ce5=_0x4b1742[_0x149d('0x2d')]?[{'partyid_systemuser@odata.bind':_0x149d('0x27')+_0x4b1742[_0x149d('0x22')]+')','participationtypemask':_0x4b1742[_0x149d('0x4a')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x4b1742[_0x149d('0x2d')]+')','participationtypemask':_0x4b1742[_0x149d('0x4a')]===_0x149d('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x4b1742[_0x149d('0x22')]+')','participationtypemask':_0x4b1742[_0x149d('0x4a')]===_0x149d('0x4b')?0x2:0x1}];_0x269e2f={'method':'POST','uri':_0x27517f+_0x149d('0x4c'),'body':Object['assign']({},{'subject':intUtil[_0x149d('0x45')](_0x400f08[_0x149d('0x4d')],_0x2e2268,'\x20'),'phonenumber':String(_0x2e2268[_0x149d('0x2f')]),'description':intUtil[_0x149d('0x45')](_0x400f08['Descriptions'],_0x2e2268,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4b1742[_0x149d('0x2d')]?_0x149d('0x47')+_0x4b1742['enduserId']+')':undefined,'ownerid@odata.bind':_0x149d('0x27')+_0x4b1742[_0x149d('0x22')]+')','directioncode':_0x4b1742[_0x149d('0x4a')]===_0x149d('0x4b')?![]:!![],'phonecall_activity_parties':_0x9d5ce5},getCustomFields(_0x400f08[_0x149d('0x48')],_0x2e2268,_0x400f08[_0x149d('0x41')])),'headers':{'Authorization':_0x149d('0x18')+_0x27daf4,'OData-Version':_0x149d('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x269e2f);})[_0x149d('0x15')](function(_0x43377f){var _0x5f44d0=_0x43377f[_0x149d('0x29')]['odata-entityid'];var _0x519509=_0x5f44d0[_0x149d('0x2b')](_0x5f44d0[_0x149d('0x2c')]('(')+0x1,_0x5f44d0['lastIndexOf'](')'));_0x4b1742['ticketId']=_0x519509;_0x12db64(_0x4b1742);})[_0x149d('0x12')](function(_0x3503db){_0x3d4406(_0x3503db[_0x149d('0x25')]);});});}function emit(_0x5e065d,_0x5bbd8d,_0x2606e0,_0x37bc98){var _0x4cffc8={'uri':util[_0x149d('0x4e')](_0x149d('0x4f'),_0x5e065d,_0x2606e0,_0x37bc98)};io['to'](util['format'](_0x149d('0x50'),_0x5bbd8d))['emit'](_0x149d('0x51'),_0x4cffc8);}exports['cs']=function(_0xbe3857,_0x1fca3c,_0x299dd6,_0x2f65e3,_0x363901,_0x33f383,_0x4559e1,_0x2791d9){var _0x3a0cc9={};_0x33f383[_0x149d('0x52')]=_0x33f383['modernAuthentication']?intUtil[_0x149d('0x53')](_0x33f383['CloudProvider'][_0x149d('0xa')]):intUtil[_0x149d('0x53')](_0x33f383['remoteUri']);_0x33f383[_0x149d('0x54')]=intUtil[_0x149d('0x53')](_0x33f383[_0x149d('0x54')]);_0x3a0cc9['callDirection']=_0x2791d9===_0x149d('0x4b')||_0x2791d9===_0x149d('0x55')?'queue':_0x149d('0x56');var _0x3041d4=_0x33f383[_0x149d('0x57')]?util[_0x149d('0x4e')](_0x149d('0x58'),_0x33f383['CloudProvider']['data7']):util[_0x149d('0x4e')](_0x149d('0x58'),_0x33f383[_0x149d('0x52')]);var _0x440a28=util[_0x149d('0x4e')]('https://login.microsoftonline.com/%s/oauth2/token',_0x33f383[_0x149d('0xb')]);var _0x4d13ad=util[_0x149d('0x4e')](_0x149d('0x59'),_0x33f383[_0x149d('0x54')],_0x1fca3c[_0x149d('0x5a')],md5(_0x1fca3c[_0x149d('0x5a')]));if(_0x363901&&_0x363901[_0x149d('0x5b')]){logger['info'](_0x149d('0x5c'),_0x149d('0x5d'));_0x1fca3c[_0x149d('0x5e')]=_0x4d13ad;}else if(_0x4559e1&&_0x4559e1[_0x149d('0x5f')]&&_0x4559e1[_0x149d('0x5f')]!=='none'){logger[_0x149d('0x20')](_0x149d('0x60'),'Recording\x20is\x20enabled!');_0x1fca3c['recordingURL']=_0x4d13ad;}else{_0x1fca3c['recordingURL']='';}return getUser(_0x3a0cc9,_0x33f383,_0x2f65e3,_0x440a28,_0x3041d4,_0x2791d9)['then'](function(_0x384872){logger[_0x149d('0x20')]('['+_0x2791d9[_0x149d('0x13')]()+_0x149d('0x61'),_0x384872[_0x149d('0x22')]);logger[_0x149d('0x20')]('['+_0x2791d9[_0x149d('0x13')]()+_0x149d('0x62'),_0x384872['userEmail']);return getEndUser(_0x384872,_0x33f383,_0x440a28,_0x3041d4,_0x1fca3c,_0x2791d9,_0x299dd6[_0x149d('0x63')],_0x299dd6['additionalSearchContact']);})['then'](function(_0x2942f4){logger['info']('['+_0x2791d9[_0x149d('0x13')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x2942f4[_0x149d('0x2d')]);logger[_0x149d('0x20')]('['+_0x2791d9[_0x149d('0x13')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x1fca3c[_0x149d('0x2f')]);return getTicket(_0x2942f4,_0x33f383,_0x440a28,_0x3041d4,_0x1fca3c,_0x299dd6,_0x2791d9);})[_0x149d('0x15')](function(_0x3c1132){logger[_0x149d('0x20')](util[_0x149d('0x4e')]('['+_0x2791d9[_0x149d('0x13')]()+_0x149d('0x64'),_0x299dd6[_0x149d('0x41')],_0x3c1132[_0x149d('0x65')]));logger[_0x149d('0x20')](util[_0x149d('0x4e')]('['+_0x2791d9[_0x149d('0x13')]()+']\x20Call\x20direction:\x20%s',_0x2791d9));if(_0x2791d9!=='unmanaged'&&_0x299dd6[_0x149d('0x66')]){logger[_0x149d('0x20')]('['+_0x2791d9[_0x149d('0x13')]()+']',_0x149d('0x67'));emit(_0x33f383[_0x149d('0x52')],_0x2f65e3[_0x149d('0x68')],_0x299dd6['ticketType'],_0x3c1132[_0x149d('0x65')]);}})['catch'](function(_0x5cf175){logger[_0x149d('0x69')]('['+_0x2791d9['toUpperCase']()+_0x149d('0x6a'),_0x5cf175['message']);console[_0x149d('0x69')](_0x149d('0x6b'),_0x5cf175);});}; \ 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 0b9c059..eb57da1 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 _0x0fcd=['debug','[HTTP]','map','forEach','string','picklist','nameField','customField','toLowerCase','type','idField','push','content','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','stringify','recordingFormat','none','destcalleridname','destcalleridnum','user:%s','%s/helpdesk/tickets/%d','catch','[OUTBOUND]','unmanaged','lastevent','lodash','request-promise','md5','util','ioredis','./util','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','merge','format','Subjects','getString','Descriptions','
','Tags','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString'];(function(_0x2f2f30,_0x4d2e37){var _0x3dd56e=function(_0x2fbfaf){while(--_0x2fbfaf){_0x2f2f30['push'](_0x2f2f30['shift']());}};_0x3dd56e(++_0x4d2e37);}(_0x0fcd,0x85));var _0xd0fc=function(_0x2a49c2,_0x335eb0){_0x2a49c2=_0x2a49c2-0x0;var _0xed4443=_0x0fcd[_0x2a49c2];return _0xed4443;};'use strict';var _=require(_0xd0fc('0x0'));var rp=require(_0xd0fc('0x1'));var md5=require(_0xd0fc('0x2'));var util=require(_0xd0fc('0x3'));var Redis=require(_0xd0fc('0x4'));var intUtil=require(_0xd0fc('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xd0fc('0x6'));config[_0xd0fc('0x7')]=_[_0xd0fc('0x8')](config[_0xd0fc('0x7')],{'host':_0xd0fc('0x9'),'port':0x18eb});var io=require(_0xd0fc('0xa'))(new Redis(config[_0xd0fc('0x7')]));var headers={'Content-Type':_0xd0fc('0xb'),'Accept':_0xd0fc('0xb')};function emit(_0x576b75,_0x1d9a2e,_0x2ba295){io['to'](_0x576b75)[_0xd0fc('0xc')](_0x1d9a2e,_0x2ba295);}function getTicket(_0x179d73,_0x1eb2e9,_0x2d8e1f,_0x45570e,_0x28be31){logger[_0xd0fc('0xd')]('Creating\x20new\x20ticket...');var _0x470178=_[_0xd0fc('0xe')]({'responder_id':_0x1eb2e9['id'],'requester_id':_0x2d8e1f['id'],'name':util[_0xd0fc('0xf')]('Caller\x20-\x20%s',_0x28be31['calleridname']),'phone':_0x28be31['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x45570e[_0xd0fc('0x10')],_0x28be31,'\x20'),'description':intUtil[_0xd0fc('0x11')](_0x45570e[_0xd0fc('0x12')],_0x28be31,_0xd0fc('0x13')),'tags':getTags(_0x45570e[_0xd0fc('0x14')],'name')},getCustomFields(_0x45570e[_0xd0fc('0x15')],_0x28be31));_0x470178[_0xd0fc('0x16')]=_['mapValues'](_[_0xd0fc('0x17')](_0x470178['custom_fields'],'id'),_0xd0fc('0x18'));return request({'uri':util['format'](_0xd0fc('0x19'),_0x179d73[_0xd0fc('0x1a')]),'method':_0xd0fc('0x1b'),'body':_0x470178})[_0xd0fc('0x1c')](function(_0x346856){logger[_0xd0fc('0xd')](_0xd0fc('0x1d'));return _0x346856;});}function getUser(_0x33092f,_0x58da92){if(intUtil['validateEmail'](_0x58da92)){return request({'uri':util[_0xd0fc('0xf')](_0xd0fc('0x1e'),_0x33092f[_0xd0fc('0x1a')]),'qs':{'email':_0x58da92}})[_0xd0fc('0x1c')](function(_0x579a95){if(_0x579a95['length']){logger[_0xd0fc('0xd')](_0xd0fc('0x1f'));return _['find'](_0x579a95,function(_0x41ab5a){return _0x41ab5a[_0xd0fc('0x20')][_0xd0fc('0x21')]===_0x58da92;});}else{logger[_0xd0fc('0xd')](_0xd0fc('0x22'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x33092f[_0xd0fc('0x1a')])})[_0xd0fc('0x1c')](function(_0x5bb841){logger['info']('Admin\x20account\x20selected.');return _0x5bb841;});}});}else{logger[_0xd0fc('0xd')](_0xd0fc('0x23'));return request({'uri':util[_0xd0fc('0xf')](_0xd0fc('0x24'),_0x33092f[_0xd0fc('0x1a')])})['then'](function(_0x3c1f4c){logger[_0xd0fc('0xd')](_0xd0fc('0x25'));return _0x3c1f4c;});}}function getEndUser(_0x57040c,_0x472818,_0x290351){logger[_0xd0fc('0xd')]('Searching\x20enduser\x20with\x20phone',_0x290351);return request({'uri':util[_0xd0fc('0xf')](_0xd0fc('0x26'),_0x57040c[_0xd0fc('0x1a')]),'qs':{'phone':_0x290351}})[_0xd0fc('0x1c')](function(_0x39ef0f){if(_0x39ef0f[_0xd0fc('0x27')]){logger[_0xd0fc('0xd')](_0xd0fc('0x28'));return _['find'](_0x39ef0f,{'phone':_0x290351});}else{logger['info'](_0xd0fc('0x29'));return request({'uri':util['format'](_0xd0fc('0x26'),_0x57040c['remoteUri']),'method':_0xd0fc('0x1b'),'body':{'name':_0x472818,'phone':_0x290351}})[_0xd0fc('0x1c')](function(_0x4e9194){logger[_0xd0fc('0xd')]('Enduser\x20created.');return _0x4e9194;});}});}function getAuth(_0x4ca4a9){return util[_0xd0fc('0xf')](_0xd0fc('0x2a'),new Buffer(_0x4ca4a9[_0xd0fc('0x2b')]+':X')[_0xd0fc('0x2c')]('base64'));}function request(_0x2cfb65){logger[_0xd0fc('0x2d')](_0xd0fc('0x2e'),JSON['stringify'](_0x2cfb65));return rp(_[_0xd0fc('0x8')](_0x2cfb65,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x42c379,_0x1ea34c){var _0x5b8cbb=[];if(_0x42c379&&_0x42c379[_0xd0fc('0x27')]>0x0){_0x5b8cbb=_[_0xd0fc('0x2f')](_0x42c379,_0x1ea34c);}return _0x5b8cbb;}function getCustomFields(_0x4c8b73,_0x578e81){var _0x50c812=[];var _0x155bf9={'custom_fields':[]};if(_0x4c8b73['length']>0x0){_[_0xd0fc('0x30')](_0x4c8b73,function(_0x1d2c9f){if(_['includes']([_0xd0fc('0x31'),_0xd0fc('0x32')],_0x1d2c9f['type'])&&_0x1d2c9f[_0xd0fc('0x33')]&&!_0x1d2c9f[_0xd0fc('0x34')]){_0x155bf9[_0x1d2c9f['nameField'][_0xd0fc('0x35')]()]=_0x1d2c9f['content']['toString']();}else if(_['includes']([_0xd0fc('0x31'),_0xd0fc('0x32')],_0x1d2c9f[_0xd0fc('0x36')])&&_0x1d2c9f[_0xd0fc('0x37')]&&_0x1d2c9f['customField']){_0x155bf9[_0xd0fc('0x16')][_0xd0fc('0x38')]({'id':_0x1d2c9f[_0xd0fc('0x37')],'value':_0x1d2c9f[_0xd0fc('0x39')][_0xd0fc('0x2c')]()});}else if(_0x1d2c9f[_0xd0fc('0x36')]==='variable'&&_0x1d2c9f[_0xd0fc('0x3a')]&&_0x1d2c9f[_0xd0fc('0x37')]&&_0x1d2c9f[_0xd0fc('0x34')]){_0x578e81[_0x1d2c9f[_0xd0fc('0x3a')]]&&_0x155bf9[_0xd0fc('0x16')][_0xd0fc('0x38')]({'id':_0x1d2c9f[_0xd0fc('0x37')],'value':_0x578e81[_0x1d2c9f['variableName']][_0xd0fc('0x2c')]()});}else if(_0x1d2c9f[_0xd0fc('0x36')]===_0xd0fc('0x3b')&&_0x1d2c9f[_0xd0fc('0x3c')]&&_0x1d2c9f[_0xd0fc('0x3c')][_0xd0fc('0x3d')]&&_0x1d2c9f[_0xd0fc('0x37')]&&_0x1d2c9f[_0xd0fc('0x34')]){_0x578e81[_0x1d2c9f[_0xd0fc('0x3c')][_0xd0fc('0x3d')][_0xd0fc('0x35')]()]&&_0x155bf9['custom_fields'][_0xd0fc('0x38')]({'id':_0x1d2c9f[_0xd0fc('0x37')],'value':_0x578e81[_0x1d2c9f['Variable'][_0xd0fc('0x3d')][_0xd0fc('0x35')]()][_0xd0fc('0x2c')]()});}});}return _0x155bf9;}exports[_0xd0fc('0x3e')]=function(_0x3a0e51,_0x3b8083,_0xc88f8d,_0x59d909,_0x58a4d8,_0x5b4b47){var _0xb9a791,_0x2570d0;_0x5b4b47['remoteUri']=intUtil[_0xd0fc('0x3f')](_0x5b4b47['remoteUri']);_0x5b4b47[_0xd0fc('0x40')]=intUtil['stripTrailingSlash'](_0x5b4b47[_0xd0fc('0x40')]);if(_0x58a4d8&&_0x58a4d8['monitor_format']){logger[_0xd0fc('0xd')](_0xd0fc('0x41'),_0xd0fc('0x42'));_0x3b8083['recordingURL']=util[_0xd0fc('0xf')](_0xd0fc('0x43'),_0x5b4b47[_0xd0fc('0x40')],_0x3b8083[_0xd0fc('0x44')],md5(_0x3b8083[_0xd0fc('0x44')]));}else{_0x3b8083[_0xd0fc('0x45')]='';}headers[_0xd0fc('0x46')]=getAuth(_0x5b4b47);return getUser(_0x5b4b47,_0x59d909[_0xd0fc('0x21')])[_0xd0fc('0x1c')](function(_0x1ca985){_0xb9a791=_0x1ca985;logger[_0xd0fc('0xd')](_0xd0fc('0x47'),_0xb9a791['id']);return getEndUser(_0x5b4b47,_0x3b8083['calleridname'],_0x3b8083[_0xd0fc('0x48')]);})[_0xd0fc('0x1c')](function(_0x4894c7){_0x2570d0=_0x4894c7;logger[_0xd0fc('0xd')](_0xd0fc('0x49'),_0x2570d0['id']);return getTicket(_0x5b4b47,_0xb9a791,_0x2570d0,_0xc88f8d,_0x3b8083);})['then'](function(_0x3eb625){if(_0x3eb625&&_0x3eb625['id']){logger['info'](_0xd0fc('0x1d'));logger[_0xd0fc('0xd')](_0xd0fc('0x4a'),_0x3eb625['id']);logger[_0xd0fc('0xd')]('[QUEUE]',_0xd0fc('0x4b'));emit(util['format']('user:%s',_0x59d909[_0xd0fc('0x3d')]),_0xd0fc('0x4c'),{'uri':util[_0xd0fc('0xf')]('%s/helpdesk/tickets/%d',_0x5b4b47[_0xd0fc('0x1a')],_0x3eb625['id'])});}})['catch'](function(_0x73bd7){logger[_0xd0fc('0x4d')](_0xd0fc('0x41'),JSON[_0xd0fc('0x4e')](_0x73bd7));});};exports['outbound']=function(_0x980162,_0x5a4a84,_0x2f4fd5,_0xeed54a,_0x3e1f4e,_0xd27aa2,_0x3ce30b){var _0xefc205,_0x5ae4dc;_0xd27aa2[_0xd0fc('0x1a')]=intUtil[_0xd0fc('0x3f')](_0xd27aa2[_0xd0fc('0x1a')]);_0xd27aa2['serverUrl']=intUtil[_0xd0fc('0x3f')](_0xd27aa2[_0xd0fc('0x40')]);if(_0x3ce30b&&_0x3ce30b['recordingFormat']&&_0x3ce30b[_0xd0fc('0x4f')]!==_0xd0fc('0x50')){logger[_0xd0fc('0xd')]('[OUTBOUND]',_0xd0fc('0x42'));_0x5a4a84[_0xd0fc('0x45')]=util[_0xd0fc('0xf')](_0xd0fc('0x43'),_0xd27aa2[_0xd0fc('0x40')],_0x5a4a84[_0xd0fc('0x44')],md5(_0x5a4a84[_0xd0fc('0x44')]));}headers['Authorization']=getAuth(_0xd27aa2);return getUser(_0xd27aa2,_0xeed54a[_0xd0fc('0x21')])[_0xd0fc('0x1c')](function(_0x477b27){_0xefc205=_0x477b27;logger[_0xd0fc('0xd')](_0xd0fc('0x47'),_0xefc205['id']);return getEndUser(_0xd27aa2,_0x5a4a84[_0xd0fc('0x51')],_0x5a4a84[_0xd0fc('0x52')]);})[_0xd0fc('0x1c')](function(_0x542c32){_0x5ae4dc=_0x542c32;logger[_0xd0fc('0xd')](_0xd0fc('0x49'),_0x5ae4dc['id']);return getTicket(_0xd27aa2,_0xefc205,_0x5ae4dc,_0x2f4fd5,_0x5a4a84);})[_0xd0fc('0x1c')](function(_0x404307){if(_0x404307&&_0x404307['id']){logger[_0xd0fc('0xd')](_0xd0fc('0x1d'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x404307['id']);logger[_0xd0fc('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd0fc('0xf')](_0xd0fc('0x53'),_0xeed54a[_0xd0fc('0x3d')]),_0xd0fc('0x4c'),{'uri':util['format'](_0xd0fc('0x54'),_0xd27aa2[_0xd0fc('0x1a')],_0x404307['id'])});}})[_0xd0fc('0x55')](function(_0x4ac857){logger[_0xd0fc('0x4d')](_0xd0fc('0x56'),JSON[_0xd0fc('0x4e')](_0x4ac857));});};exports[_0xd0fc('0x57')]=function(_0x1c456c,_0x3dad17,_0x1c959a,_0x24ae61,_0x1bf200,_0x3fb7eb){var _0x241d5b,_0x49697f;_0x3fb7eb['remoteUri']=intUtil[_0xd0fc('0x3f')](_0x3fb7eb[_0xd0fc('0x1a')]);_0x3fb7eb['serverUrl']=intUtil[_0xd0fc('0x3f')](_0x3fb7eb[_0xd0fc('0x40')]);if(_0x1bf200&&_0x1bf200['monitor_format']){logger[_0xd0fc('0xd')]('['+_0x3dad17[_0xd0fc('0x58')]['toUpperCase']()+']',_0xd0fc('0x42'));_0x3dad17['recordingURL']=util['format'](_0xd0fc('0x43'),_0x3fb7eb[_0xd0fc('0x40')],_0x3dad17[_0xd0fc('0x44')],md5(_0x3dad17[_0xd0fc('0x44')]));}else{_0x3dad17[_0xd0fc('0x45')]='';}headers[_0xd0fc('0x46')]=getAuth(_0x3fb7eb);return getUser(_0x3fb7eb,'')[_0xd0fc('0x1c')](function(_0x491490){_0x241d5b=_0x491490;logger[_0xd0fc('0xd')](_0xd0fc('0x47'),_0x241d5b['id']);return getEndUser(_0x3fb7eb,_0x3dad17['calleridname'],_0x3dad17[_0xd0fc('0x48')]);})[_0xd0fc('0x1c')](function(_0x2beab2){_0x49697f=_0x2beab2;logger['info']('The\x20Enduser\x20ID\x20is:',_0x49697f['id']);return getTicket(_0x3fb7eb,_0x241d5b,_0x49697f,_0x1c959a,_0x3dad17);})[_0xd0fc('0x1c')](function(_0x3bd331){if(_0x3bd331){logger[_0xd0fc('0xd')](_0xd0fc('0x1d'));logger[_0xd0fc('0xd')](_0xd0fc('0x4a'),_0x3bd331['id']);}})[_0xd0fc('0x55')](function(_0x54a28a){logger[_0xd0fc('0x4d')]('['+_0x3dad17[_0xd0fc('0x58')]['toUpperCase']()+']',JSON[_0xd0fc('0x4e')](_0x54a28a));});}; \ No newline at end of file +var _0x8ff6=['includes','string','picklist','nameField','customField','toLowerCase','content','type','push','idField','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','uniqueid','Authorization','destcalleridname','destcalleridnum','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','find','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','apiKey','toString','base64','[HTTP]','stringify','GET','map'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x8ff6,0xde));var _0x68ff=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x8ff6[_0x47b58b];return _0x46bebe;};'use strict';var _=require('lodash');var rp=require(_0x68ff('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x68ff('0x1'));var intUtil=require(_0x68ff('0x2'));var config=require(_0x68ff('0x3'));var logger=require(_0x68ff('0x4'))(_0x68ff('0x5'));config[_0x68ff('0x6')]=_[_0x68ff('0x7')](config['redis'],{'host':_0x68ff('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x68ff('0x6')]));var headers={'Content-Type':'application/json','Accept':_0x68ff('0x9')};function emit(_0x2d78b7,_0x1f5347,_0xada381){io['to'](_0x2d78b7)[_0x68ff('0xa')](_0x1f5347,_0xada381);}function getTicket(_0x310167,_0x26ce69,_0x27db3d,_0x1bace2,_0xd05c){logger[_0x68ff('0xb')](_0x68ff('0xc'));var _0x308740=_[_0x68ff('0xd')]({'responder_id':_0x26ce69['id'],'requester_id':_0x27db3d['id'],'name':util[_0x68ff('0xe')](_0x68ff('0xf'),_0xd05c[_0x68ff('0x10')]),'phone':_0xd05c[_0x68ff('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x68ff('0x12')](_0x1bace2[_0x68ff('0x13')],_0xd05c,'\x20'),'description':intUtil[_0x68ff('0x12')](_0x1bace2['Descriptions'],_0xd05c,_0x68ff('0x14')),'tags':getTags(_0x1bace2['Tags'],_0x68ff('0x15'))},getCustomFields(_0x1bace2[_0x68ff('0x16')],_0xd05c));_0x308740[_0x68ff('0x17')]=_[_0x68ff('0x18')](_[_0x68ff('0x19')](_0x308740[_0x68ff('0x17')],'id'),_0x68ff('0x1a'));return request({'uri':util[_0x68ff('0xe')](_0x68ff('0x1b'),_0x310167[_0x68ff('0x1c')]),'method':_0x68ff('0x1d'),'body':_0x308740})[_0x68ff('0x1e')](function(_0x1fd609){logger[_0x68ff('0xb')](_0x68ff('0x1f'));return _0x1fd609;});}function getUser(_0x47088e,_0x1166cf){if(intUtil[_0x68ff('0x20')](_0x1166cf)){return request({'uri':util['format'](_0x68ff('0x21'),_0x47088e['remoteUri']),'qs':{'email':_0x1166cf}})[_0x68ff('0x1e')](function(_0x5d27ed){if(_0x5d27ed['length']){logger[_0x68ff('0xb')]('Agent\x20found!');return _[_0x68ff('0x22')](_0x5d27ed,function(_0x4211f5){return _0x4211f5['contact'][_0x68ff('0x23')]===_0x1166cf;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x68ff('0x24'),_0x47088e[_0x68ff('0x1c')])})[_0x68ff('0x1e')](function(_0x2e6e62){logger[_0x68ff('0xb')]('Admin\x20account\x20selected.');return _0x2e6e62;});}});}else{logger[_0x68ff('0xb')](_0x68ff('0x25'));return request({'uri':util['format'](_0x68ff('0x24'),_0x47088e['remoteUri'])})[_0x68ff('0x1e')](function(_0x5a2dc0){logger[_0x68ff('0xb')](_0x68ff('0x26'));return _0x5a2dc0;});}}function getEndUser(_0x1f36d7,_0x455c60,_0x2f9e22){logger[_0x68ff('0xb')](_0x68ff('0x27'),_0x2f9e22);return request({'uri':util[_0x68ff('0xe')](_0x68ff('0x28'),_0x1f36d7[_0x68ff('0x1c')]),'qs':{'phone':_0x2f9e22}})[_0x68ff('0x1e')](function(_0x196ca5){if(_0x196ca5[_0x68ff('0x29')]){logger[_0x68ff('0xb')](_0x68ff('0x2a'));return _[_0x68ff('0x22')](_0x196ca5,{'phone':_0x2f9e22});}else{logger['info'](_0x68ff('0x2b'));return request({'uri':util[_0x68ff('0xe')]('%s/api/v2/contacts',_0x1f36d7[_0x68ff('0x1c')]),'method':_0x68ff('0x1d'),'body':{'name':_0x455c60,'phone':_0x2f9e22}})[_0x68ff('0x1e')](function(_0x4b6a7c){logger[_0x68ff('0xb')]('Enduser\x20created.');return _0x4b6a7c;});}});}function getAuth(_0x2e932f){return util[_0x68ff('0xe')]('Basic\x20%s',new Buffer(_0x2e932f[_0x68ff('0x2c')]+':X')[_0x68ff('0x2d')](_0x68ff('0x2e')));}function request(_0x578792){logger['debug'](_0x68ff('0x2f'),JSON[_0x68ff('0x30')](_0x578792));return rp(_[_0x68ff('0x7')](_0x578792,{'method':_0x68ff('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x5a59d2,_0x1f8c83){var _0x1efccc=[];if(_0x5a59d2&&_0x5a59d2[_0x68ff('0x29')]>0x0){_0x1efccc=_[_0x68ff('0x32')](_0x5a59d2,_0x1f8c83);}return _0x1efccc;}function getCustomFields(_0x4aa8b3,_0x311c74){var _0x2a379f=[];var _0x9b4a4c={'custom_fields':[]};if(_0x4aa8b3[_0x68ff('0x29')]>0x0){_['forEach'](_0x4aa8b3,function(_0x528383){if(_[_0x68ff('0x33')]([_0x68ff('0x34'),_0x68ff('0x35')],_0x528383['type'])&&_0x528383[_0x68ff('0x36')]&&!_0x528383[_0x68ff('0x37')]){_0x9b4a4c[_0x528383[_0x68ff('0x36')][_0x68ff('0x38')]()]=_0x528383[_0x68ff('0x39')][_0x68ff('0x2d')]();}else if(_[_0x68ff('0x33')]([_0x68ff('0x34'),_0x68ff('0x35')],_0x528383[_0x68ff('0x3a')])&&_0x528383['idField']&&_0x528383[_0x68ff('0x37')]){_0x9b4a4c[_0x68ff('0x17')][_0x68ff('0x3b')]({'id':_0x528383[_0x68ff('0x3c')],'value':_0x528383[_0x68ff('0x39')][_0x68ff('0x2d')]()});}else if(_0x528383[_0x68ff('0x3a')]===_0x68ff('0x3d')&&_0x528383[_0x68ff('0x3e')]&&_0x528383['idField']&&_0x528383[_0x68ff('0x37')]){_0x311c74[_0x528383['variableName']]&&_0x9b4a4c[_0x68ff('0x17')][_0x68ff('0x3b')]({'id':_0x528383[_0x68ff('0x3c')],'value':_0x311c74[_0x528383[_0x68ff('0x3e')]][_0x68ff('0x2d')]()});}else if(_0x528383[_0x68ff('0x3a')]===_0x68ff('0x3f')&&_0x528383[_0x68ff('0x40')]&&_0x528383[_0x68ff('0x40')][_0x68ff('0x15')]&&_0x528383[_0x68ff('0x3c')]&&_0x528383[_0x68ff('0x37')]){_0x311c74[_0x528383[_0x68ff('0x40')][_0x68ff('0x15')][_0x68ff('0x38')]()]&&_0x9b4a4c[_0x68ff('0x17')]['push']({'id':_0x528383[_0x68ff('0x3c')],'value':_0x311c74[_0x528383['Variable'][_0x68ff('0x15')]['toLowerCase']()][_0x68ff('0x2d')]()});}});}return _0x9b4a4c;}exports[_0x68ff('0x41')]=function(_0x5a5c16,_0x172a47,_0x16b683,_0x187201,_0x1d6bf8,_0x1c3b47){var _0x13ae22,_0x3a8e1a;_0x1c3b47[_0x68ff('0x1c')]=intUtil['stripTrailingSlash'](_0x1c3b47[_0x68ff('0x1c')]);_0x1c3b47[_0x68ff('0x42')]=intUtil[_0x68ff('0x43')](_0x1c3b47[_0x68ff('0x42')]);if(_0x1d6bf8&&_0x1d6bf8[_0x68ff('0x44')]){logger[_0x68ff('0xb')](_0x68ff('0x45'),_0x68ff('0x46'));_0x172a47[_0x68ff('0x47')]=util['format'](_0x68ff('0x48'),_0x1c3b47[_0x68ff('0x42')],_0x172a47['uniqueid'],md5(_0x172a47['uniqueid']));}else{_0x172a47[_0x68ff('0x47')]='';}headers['Authorization']=getAuth(_0x1c3b47);return getUser(_0x1c3b47,_0x187201[_0x68ff('0x23')])['then'](function(_0x1bba9a){_0x13ae22=_0x1bba9a;logger[_0x68ff('0xb')]('The\x20User\x20ID\x20is:',_0x13ae22['id']);return getEndUser(_0x1c3b47,_0x172a47[_0x68ff('0x10')],_0x172a47[_0x68ff('0x11')]);})[_0x68ff('0x1e')](function(_0x5cfcff){_0x3a8e1a=_0x5cfcff;logger[_0x68ff('0xb')](_0x68ff('0x49'),_0x3a8e1a['id']);return getTicket(_0x1c3b47,_0x13ae22,_0x3a8e1a,_0x16b683,_0x172a47);})['then'](function(_0x5e3686){if(_0x5e3686&&_0x5e3686['id']){logger[_0x68ff('0xb')](_0x68ff('0x1f'));logger[_0x68ff('0xb')](_0x68ff('0x4a'),_0x5e3686['id']);logger[_0x68ff('0xb')]('[QUEUE]',_0x68ff('0x4b'));emit(util[_0x68ff('0xe')]('user:%s',_0x187201[_0x68ff('0x15')]),_0x68ff('0x4c'),{'uri':util[_0x68ff('0xe')](_0x68ff('0x4d'),_0x1c3b47[_0x68ff('0x1c')],_0x5e3686['id'])});}})[_0x68ff('0x4e')](function(_0x114c4d){logger[_0x68ff('0x4f')](_0x68ff('0x45'),JSON[_0x68ff('0x30')](_0x114c4d));});};exports[_0x68ff('0x50')]=function(_0x307ca1,_0x439920,_0x54b128,_0x563f69,_0x463ac4,_0x3bc189,_0xc22e6a){var _0x34f951,_0x2b1a7d;_0x3bc189[_0x68ff('0x1c')]=intUtil[_0x68ff('0x43')](_0x3bc189['remoteUri']);_0x3bc189[_0x68ff('0x42')]=intUtil['stripTrailingSlash'](_0x3bc189[_0x68ff('0x42')]);if(_0xc22e6a&&_0xc22e6a[_0x68ff('0x51')]&&_0xc22e6a[_0x68ff('0x51')]!=='none'){logger[_0x68ff('0xb')](_0x68ff('0x52'),_0x68ff('0x46'));_0x439920[_0x68ff('0x47')]=util[_0x68ff('0xe')](_0x68ff('0x48'),_0x3bc189[_0x68ff('0x42')],_0x439920['uniqueid'],md5(_0x439920[_0x68ff('0x53')]));}headers[_0x68ff('0x54')]=getAuth(_0x3bc189);return getUser(_0x3bc189,_0x563f69[_0x68ff('0x23')])[_0x68ff('0x1e')](function(_0x10e842){_0x34f951=_0x10e842;logger[_0x68ff('0xb')]('The\x20User\x20ID\x20is:',_0x34f951['id']);return getEndUser(_0x3bc189,_0x439920[_0x68ff('0x55')],_0x439920[_0x68ff('0x56')]);})[_0x68ff('0x1e')](function(_0x3e394d){_0x2b1a7d=_0x3e394d;logger['info'](_0x68ff('0x49'),_0x2b1a7d['id']);return getTicket(_0x3bc189,_0x34f951,_0x2b1a7d,_0x54b128,_0x439920);})[_0x68ff('0x1e')](function(_0x59c768){if(_0x59c768&&_0x59c768['id']){logger[_0x68ff('0xb')]('Ticket\x20created!');logger[_0x68ff('0xb')]('The\x20Ticket\x20ID\x20is:',_0x59c768['id']);logger[_0x68ff('0xb')](_0x68ff('0x52'),_0x68ff('0x4b'));emit(util[_0x68ff('0xe')]('user:%s',_0x563f69[_0x68ff('0x15')]),_0x68ff('0x4c'),{'uri':util[_0x68ff('0xe')](_0x68ff('0x4d'),_0x3bc189[_0x68ff('0x1c')],_0x59c768['id'])});}})[_0x68ff('0x4e')](function(_0x47e9cc){logger[_0x68ff('0x4f')](_0x68ff('0x52'),JSON[_0x68ff('0x30')](_0x47e9cc));});};exports[_0x68ff('0x57')]=function(_0x36b244,_0x193a4b,_0x407107,_0x22600c,_0x1aff8d,_0x228daa){var _0x14a901,_0x7157fb;_0x228daa[_0x68ff('0x1c')]=intUtil['stripTrailingSlash'](_0x228daa[_0x68ff('0x1c')]);_0x228daa[_0x68ff('0x42')]=intUtil[_0x68ff('0x43')](_0x228daa[_0x68ff('0x42')]);if(_0x1aff8d&&_0x1aff8d[_0x68ff('0x44')]){logger[_0x68ff('0xb')]('['+_0x193a4b[_0x68ff('0x58')][_0x68ff('0x59')]()+']',_0x68ff('0x46'));_0x193a4b[_0x68ff('0x47')]=util[_0x68ff('0xe')](_0x68ff('0x48'),_0x228daa['serverUrl'],_0x193a4b[_0x68ff('0x53')],md5(_0x193a4b[_0x68ff('0x53')]));}else{_0x193a4b[_0x68ff('0x47')]='';}headers['Authorization']=getAuth(_0x228daa);return getUser(_0x228daa,'')[_0x68ff('0x1e')](function(_0x216778){_0x14a901=_0x216778;logger[_0x68ff('0xb')](_0x68ff('0x5a'),_0x14a901['id']);return getEndUser(_0x228daa,_0x193a4b[_0x68ff('0x10')],_0x193a4b[_0x68ff('0x11')]);})[_0x68ff('0x1e')](function(_0x20c233){_0x7157fb=_0x20c233;logger['info'](_0x68ff('0x49'),_0x7157fb['id']);return getTicket(_0x228daa,_0x14a901,_0x7157fb,_0x407107,_0x193a4b);})[_0x68ff('0x1e')](function(_0x282d33){if(_0x282d33){logger[_0x68ff('0xb')](_0x68ff('0x1f'));logger[_0x68ff('0xb')](_0x68ff('0x4a'),_0x282d33['id']);}})['catch'](function(_0x46ea26){logger[_0x68ff('0x4f')]('['+_0x193a4b[_0x68ff('0x58')][_0x68ff('0x59')]()+']',JSON[_0x68ff('0x30')](_0x46ea26));});}; \ 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 5521eef..64c85ea 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 _0xb607=['/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','/api/lookup?q=','find','contacts','format','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','work_number','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Contact','add','ticketId','task','Task\x20created:'];(function(_0x4b70a2,_0x5d0fbd){var _0x2170fa=function(_0x245bf2){while(--_0x245bf2){_0x4b70a2['push'](_0x4b70a2['shift']());}};_0x2170fa(++_0x5d0fbd);}(_0xb607,0x73));var _0x7b60=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xb607[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x7b60('0x0'));var rp=require(_0x7b60('0x1'));var md5=require(_0x7b60('0x2'));var util=require(_0x7b60('0x3'));var moment=require(_0x7b60('0x4'));var Promise=require(_0x7b60('0x5'));var Redis=require(_0x7b60('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x7b60('0x7'))(_0x7b60('0x8'));config[_0x7b60('0x9')]=_[_0x7b60('0xa')](config[_0x7b60('0x9')],{'host':_0x7b60('0xb'),'port':0x18eb});var io=require(_0x7b60('0xc'))(new Redis(config[_0x7b60('0x9')]));function getAdminId(_0x5df255,_0x51990a,_0x5aded7,_0x4aae98){return new Promise(function(_0x105724,_0x456c50){var _0x2c928e=![];var _0x2cfd94={'method':_0x7b60('0xd'),'uri':_0x4aae98+_0x7b60('0xe'),'json':!![]};_0x2cfd94[_0x7b60('0xf')]=_0x5aded7;logger[_0x7b60('0x10')](_0x7b60('0x11'));return rp(_0x2cfd94)[_0x7b60('0x12')](function(_0x82b63a){if(_0x82b63a){var _0x2e9092=_0x82b63a[_0x7b60('0x13')];var _0x1f7c98=null;for(_0x1f7c98=0x0;_0x1f7c98<_0x2e9092['length'];_0x1f7c98++){if(_0x2e9092[_0x1f7c98][_0x7b60('0x14')]===_0x5df255[_0x7b60('0x15')]){_0x5df255[_0x7b60('0x16')]=_0x2e9092[_0x1f7c98]['id'];_0x2c928e=!![];}}if(_0x2c928e){logger['info'](_0x7b60('0x17'),_0x5df255['adminId']);_0x105724(_0x5df255);}else{_0x456c50({'statusCode':0x194,'message':_0x7b60('0x18')});}}else{_0x456c50({'statusCode':0x194,'message':_0x7b60('0x18')});}})[_0x7b60('0x19')](function(_0x2e5338){logger[_0x7b60('0x1a')]('['+[_0x51990a[_0x7b60('0x1b')]()]+']',_0x2e5338[_0x7b60('0x1c')]);_0x456c50(_0x2e5338);});});}function getUser(_0x30fcbb,_0x1b0114,_0x5c09d7){return function(_0x47f1bb){return new Promise(function(_0x4876a7,_0x3b6fd9){var _0xd408f9={'method':'GET','uri':_0x5c09d7+_0x7b60('0xe'),'json':!![]};_0xd408f9['headers']=_0x1b0114;logger[_0x7b60('0x10')](_0x7b60('0x1d'));return rp(_0xd408f9)[_0x7b60('0x12')](function(_0xfa5675){if(_0xfa5675){var _0x287357=_0xfa5675[_0x7b60('0x13')];var _0x11749e=![];var _0x524465=null;if(_0x47f1bb[_0x7b60('0x1e')]!==null){logger[_0x7b60('0x10')](_0x7b60('0x1f'),_0x47f1bb[_0x7b60('0x1e')]);_0x47f1bb[_0x7b60('0x20')]=_0x47f1bb[_0x7b60('0x1e')];for(_0x524465=0x0;_0x524465<_0x287357['length'];_0x524465++){if(_0x287357[_0x524465][_0x7b60('0x14')]===_0x47f1bb[_0x7b60('0x1e')]){_0x11749e=!![];_0x47f1bb[_0x7b60('0x21')]=_0x287357[_0x524465]['id'];logger[_0x7b60('0x10')]('User\x20found:',_0x47f1bb[_0x7b60('0x21')]);}}}if(!_0x11749e){logger[_0x7b60('0x10')](_0x7b60('0x22'));_0x47f1bb[_0x7b60('0x20')]=_0x47f1bb[_0x7b60('0x15')];_0x47f1bb[_0x7b60('0x21')]=_0x47f1bb[_0x7b60('0x16')];_0x11749e=!![];}if(_0x11749e){_0x4876a7(_0x47f1bb);}else{_0x3b6fd9({'statusCode':0x194,'message':_0x7b60('0x18')});}}else{_0x3b6fd9({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x7b60('0x19')](function(_0x3e98d7){logger[_0x7b60('0x1a')]('['+[_0x30fcbb['toUpperCase']()]+']',_0x3e98d7[_0x7b60('0x1c')]);_0x3b6fd9(_0x3e98d7);});});};}function searchContact(_0xf1f3e9,_0x5c3494,_0x5946a0,_0x2f1c5b){return new Promise(function(_0x2eb5ad,_0x1385d9){var _0x303f43={'method':_0x7b60('0xd'),'headers':_0x5c3494,'uri':_0xf1f3e9+_0x7b60('0x23')+_0x2f1c5b+'&f='+_0x5946a0+'&entities=contact','json':!![]};rp(_0x303f43)[_0x7b60('0x12')](function(_0x1995a5){var _0x58fd23=_[_0x7b60('0x24')](_0x1995a5[_0x7b60('0x25')][_0x7b60('0x25')],[_0x5946a0,_0x2f1c5b]);_0x2eb5ad(_0x58fd23);})[_0x7b60('0x19')](function(_0x37d599){_0x1385d9(_0x37d599);});});}function getEndUser(_0x33c037,_0x565295,_0x348d65){return function(_0x5bcfc4){return new Promise(function(_0x3005ef,_0x528587){logger[_0x7b60('0x10')](util[_0x7b60('0x26')]('Searching\x20contact\x20with\x20phone\x20%s',_0x5bcfc4[_0x7b60('0x27')]));searchContact(_0x348d65,_0x565295,_0x7b60('0x28'),_0x5bcfc4[_0x7b60('0x27')])[_0x7b60('0x12')](function(_0x340d0f){if(_0x340d0f){_0x5bcfc4['endUserId']=_0x340d0f['id'];logger[_0x7b60('0x10')](_0x7b60('0x29'),_0x5bcfc4['endUserId']);return _0x3005ef(_0x5bcfc4);}searchContact(_0x348d65,_0x565295,_0x7b60('0x2a'),_0x5bcfc4['contactNumber'])[_0x7b60('0x12')](function(_0x19dc34){if(_0x19dc34){_0x5bcfc4[_0x7b60('0x2b')]=_0x19dc34['id'];logger[_0x7b60('0x10')](_0x7b60('0x2c'),_0x5bcfc4[_0x7b60('0x2b')]);return _0x3005ef(_0x5bcfc4);}createEndUser(_0x5bcfc4,_0x33c037,_0x565295,_0x348d65)[_0x7b60('0x12')](function(_0x42f086){logger[_0x7b60('0x10')](_0x7b60('0x2d'),_0x42f086[_0x7b60('0x2b')]);return _0x3005ef(_0x42f086);});});})['catch'](function(_0x130e0b){_0x528587(_0x130e0b);});});};}function createEndUser(_0x21b66d,_0x136df3,_0x36aaab,_0xb72e22){return new Promise(function(_0x47b1a9,_0x24afd4){var _0x26299b=moment();var _0x4f4b5e={'method':_0x7b60('0x2e'),'uri':_0xb72e22+_0x7b60('0x2f'),'body':{'contact':{'last_name':_0x21b66d['contactNumber'],'work_number':_0x21b66d[_0x7b60('0x27')],'mobile_number':_0x21b66d['contactNumber'],'owner_id':_0x21b66d[_0x7b60('0x21')],'created_at':_0x26299b[_0x7b60('0x26')](_0x7b60('0x30'))}},'json':!![]};_0x4f4b5e[_0x7b60('0xf')]=_0x36aaab;logger['info'](_0x7b60('0x31'));return rp(_0x4f4b5e)[_0x7b60('0x12')](function(_0xb1c28){_0x21b66d[_0x7b60('0x2b')]=_0xb1c28[_0x7b60('0x32')]['id'];_0x47b1a9(_0x21b66d);})['catch'](function(_0x39e01f){logger['error']('['+[_0x136df3['toUpperCase']()]+']',_0x39e01f[_0x7b60('0x1c')]);_0x24afd4(_0x39e01f[_0x7b60('0x1c')]);});});}function getTicket(_0x51b465,_0x45782e,_0x45bd7c,_0x59e104,_0x3a3080){return function(_0x47fc25){logger[_0x7b60('0x10')](_0x7b60('0x33'));return new Promise(function(_0x2c3ce4,_0x419971){var _0x46bb7b=moment();var _0x12a5cc={'method':_0x7b60('0x2e'),'uri':_0x45bd7c+'/api/tasks','body':{'title':intUtil[_0x7b60('0x34')](_0x59e104[_0x7b60('0x35')],_0x3a3080,'\x20'),'description':intUtil[_0x7b60('0x34')](_0x59e104['Descriptions'],_0x3a3080,'\x0a'),'owner_id':_0x47fc25[_0x7b60('0x21')],'creater_id':_0x47fc25['adminId'],'targetable_id':_0x47fc25[_0x7b60('0x2b')],'targetable_type':_0x7b60('0x36'),'created_at':_0x46bb7b['format'](_0x7b60('0x30')),'due_date':_0x46bb7b[_0x7b60('0x37')](0x1e,'m')[_0x7b60('0x26')](_0x7b60('0x30'))},'json':!![]};_0x12a5cc['headers']=_0x45782e;return rp(_0x12a5cc)[_0x7b60('0x12')](function(_0x5b8a0e){_0x47fc25[_0x7b60('0x38')]=_0x5b8a0e[_0x7b60('0x39')]['id'];logger[_0x7b60('0x10')](_0x7b60('0x3a'),_0x47fc25[_0x7b60('0x38')]);_0x2c3ce4(_0x47fc25);})[_0x7b60('0x19')](function(_0x437a08){logger['error']('['+[_0x51b465[_0x7b60('0x1b')]()]+']',_0x437a08[_0x7b60('0x1c')]);_0x419971(_0x437a08['message']);});});};}function emit(_0x5dc486,_0x35935a,_0x5c9e5a){var _0x2b3566={'uri':_0x5dc486+_0x7b60('0x3b')+_0x5c9e5a};io['to'](util[_0x7b60('0x26')](_0x7b60('0x3c'),_0x35935a))[_0x7b60('0x3d')](_0x7b60('0x3e'),_0x2b3566);}exports['cs']=function(_0x26d86a,_0x1cc9a8,_0x2a33f9,_0xc4e195,_0x5caf2f,_0x11ad23,_0x103151,_0x1ab998){var _0x5e2e30={};var _0x2a5759={'Authorization':_0x7b60('0x3f')+_0x11ad23[_0x7b60('0x40')]};_0x11ad23['remoteUri']=intUtil[_0x7b60('0x41')](_0x11ad23[_0x7b60('0x42')]);_0x11ad23['serverUrl']=intUtil[_0x7b60('0x41')](_0x11ad23[_0x7b60('0x43')]);var _0x19386c=_0x11ad23['remoteUri'];_0x5e2e30[_0x7b60('0x15')]=_0x11ad23[_0x7b60('0x44')];_0x5e2e30['contactNumber']=_0x1ab998[_0x7b60('0x45')]()===_0x7b60('0x46')?_0x1cc9a8[_0x7b60('0x47')]:_0x1cc9a8[_0x7b60('0x48')];_0x5e2e30[_0x7b60('0x49')]=_0x1ab998===_0x7b60('0x4a')||_0x1ab998==='unmanaged'?_0x7b60('0x4a'):_0x7b60('0x46');if(_0xc4e195){_0x5e2e30['agentEmail']=_0xc4e195[_0x7b60('0x14')];}var _0x1efbe0=util[_0x7b60('0x26')](_0x7b60('0x4b'),_0x11ad23[_0x7b60('0x43')],_0x1cc9a8[_0x7b60('0x4c')],md5(_0x1cc9a8[_0x7b60('0x4c')]));if(_0x5caf2f&&_0x5caf2f[_0x7b60('0x4d')]){logger[_0x7b60('0x10')](_0x7b60('0x4e'),'Recording\x20is\x20enabled!');_0x1cc9a8[_0x7b60('0x4f')]=_0x1efbe0;}else if(_0x103151&&_0x103151[_0x7b60('0x50')]&&_0x103151[_0x7b60('0x50')]!=='none'){logger[_0x7b60('0x10')]('[OUTBOUND]',_0x7b60('0x51'));_0x1cc9a8[_0x7b60('0x4f')]=_0x1efbe0;}else{_0x1cc9a8['recordingURL']='';}return getAdminId(_0x5e2e30,_0x1ab998,_0x2a5759,_0x19386c)[_0x7b60('0x12')](getUser(_0x1ab998,_0x2a5759,_0x19386c))[_0x7b60('0x12')](getEndUser(_0x1ab998,_0x2a5759,_0x19386c))['then'](getTicket(_0x1ab998,_0x2a5759,_0x19386c,_0x2a33f9,_0x1cc9a8))[_0x7b60('0x12')](function(_0x3d8011){logger['info'](util[_0x7b60('0x26')](_0x7b60('0x52'),_0x3d8011[_0x7b60('0x38')]));if(_0x1ab998!=='unmanaged'){logger[_0x7b60('0x10')]('['+[_0x1ab998[_0x7b60('0x1b')]()]+']',_0x7b60('0x53'));emit(_0x19386c,_0xc4e195[_0x7b60('0x54')],_0x3d8011[_0x7b60('0x2b')]);}})[_0x7b60('0x19')](function(_0x9d8fc6){logger[_0x7b60('0x1a')]('['+[_0x1ab998[_0x7b60('0x1b')]()]+_0x7b60('0x55'),util[_0x7b60('0x56')](_0x9d8fc6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7020=['stripTrailingSlash','serverUrl','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','GET','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','email','User\x20found:','userId','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Contact','add','task','ticketId','/contacts/','emit','apiKey','remoteUri'];(function(_0x11114b,_0x43f0fa){var _0x24f0a1=function(_0x55826e){while(--_0x55826e){_0x11114b['push'](_0x11114b['shift']());}};_0x24f0a1(++_0x43f0fa);}(_0x7020,0x105));var _0x0702=function(_0x49615f,_0x4a27ab){_0x49615f=_0x49615f-0x0;var _0x4845ae=_0x7020[_0x49615f];return _0x4845ae;};'use strict';var _=require(_0x0702('0x0'));var rp=require(_0x0702('0x1'));var md5=require(_0x0702('0x2'));var util=require(_0x0702('0x3'));var moment=require(_0x0702('0x4'));var Promise=require(_0x0702('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x0702('0x6'));var logger=require('../../../../config/logger')(_0x0702('0x7'));config[_0x0702('0x8')]=_[_0x0702('0x9')](config[_0x0702('0x8')],{'host':_0x0702('0xa'),'port':0x18eb});var io=require(_0x0702('0xb'))(new Redis(config[_0x0702('0x8')]));function getAdminId(_0x484cbd,_0x4d26e9,_0x4b07d9,_0x3233d6){return new Promise(function(_0x1091c9,_0x27423d){var _0x2463ea=![];var _0x555435={'method':_0x0702('0xc'),'uri':_0x3233d6+'/api/selector/owners','json':!![]};_0x555435['headers']=_0x4b07d9;logger['info'](_0x0702('0xd'));return rp(_0x555435)[_0x0702('0xe')](function(_0xc76b36){if(_0xc76b36){var _0x463056=_0xc76b36[_0x0702('0xf')];var _0x99d680=null;for(_0x99d680=0x0;_0x99d680<_0x463056[_0x0702('0x10')];_0x99d680++){if(_0x463056[_0x99d680]['email']===_0x484cbd[_0x0702('0x11')]){_0x484cbd[_0x0702('0x12')]=_0x463056[_0x99d680]['id'];_0x2463ea=!![];}}if(_0x2463ea){logger[_0x0702('0x13')](_0x0702('0x14'),_0x484cbd['adminId']);_0x1091c9(_0x484cbd);}else{_0x27423d({'statusCode':0x194,'message':_0x0702('0x15')});}}else{_0x27423d({'statusCode':0x194,'message':_0x0702('0x15')});}})[_0x0702('0x16')](function(_0x1330da){logger[_0x0702('0x17')]('['+[_0x4d26e9[_0x0702('0x18')]()]+']',_0x1330da[_0x0702('0x19')]);_0x27423d(_0x1330da);});});}function getUser(_0x329577,_0x228423,_0x1fd196){return function(_0x3f9d5c){return new Promise(function(_0xdb4dd4,_0x1a409c){var _0x37b362={'method':_0x0702('0xc'),'uri':_0x1fd196+_0x0702('0x1a'),'json':!![]};_0x37b362[_0x0702('0x1b')]=_0x228423;logger['info'](_0x0702('0x1c'));return rp(_0x37b362)[_0x0702('0xe')](function(_0x20a179){if(_0x20a179){var _0x3239ee=_0x20a179[_0x0702('0xf')];var _0x1da5d2=![];var _0x35acb0=null;if(_0x3f9d5c[_0x0702('0x1d')]!==null){logger[_0x0702('0x13')](_0x0702('0x1e'),_0x3f9d5c[_0x0702('0x1d')]);_0x3f9d5c['userEmail']=_0x3f9d5c['agentEmail'];for(_0x35acb0=0x0;_0x35acb0<_0x3239ee[_0x0702('0x10')];_0x35acb0++){if(_0x3239ee[_0x35acb0][_0x0702('0x1f')]===_0x3f9d5c[_0x0702('0x1d')]){_0x1da5d2=!![];_0x3f9d5c['userId']=_0x3239ee[_0x35acb0]['id'];logger['info'](_0x0702('0x20'),_0x3f9d5c[_0x0702('0x21')]);}}}if(!_0x1da5d2){logger[_0x0702('0x13')](_0x0702('0x22'));_0x3f9d5c['userEmail']=_0x3f9d5c['adminEmail'];_0x3f9d5c[_0x0702('0x21')]=_0x3f9d5c[_0x0702('0x12')];_0x1da5d2=!![];}if(_0x1da5d2){_0xdb4dd4(_0x3f9d5c);}else{_0x1a409c({'statusCode':0x194,'message':_0x0702('0x15')});}}else{_0x1a409c({'statusCode':0x194,'message':_0x0702('0x15')});}})[_0x0702('0x16')](function(_0x2d3275){logger[_0x0702('0x17')]('['+[_0x329577[_0x0702('0x18')]()]+']',_0x2d3275[_0x0702('0x19')]);_0x1a409c(_0x2d3275);});});};}function searchContact(_0x488fe3,_0x3db295,_0xa170aa,_0x35725b){return new Promise(function(_0x2cebcb,_0x29b43d){var _0x8b2e55={'method':_0x0702('0xc'),'headers':_0x3db295,'uri':_0x488fe3+_0x0702('0x23')+_0x35725b+_0x0702('0x24')+_0xa170aa+_0x0702('0x25'),'json':!![]};rp(_0x8b2e55)[_0x0702('0xe')](function(_0x488cef){var _0x229df3=_[_0x0702('0x26')](_0x488cef[_0x0702('0x27')][_0x0702('0x27')],[_0xa170aa,_0x35725b]);_0x2cebcb(_0x229df3);})['catch'](function(_0x4c5324){_0x29b43d(_0x4c5324);});});}function getEndUser(_0x33e8fe,_0x5e0487,_0x4073ad){return function(_0x56ed20){return new Promise(function(_0x5a7762,_0x415c6a){logger[_0x0702('0x13')](util[_0x0702('0x28')](_0x0702('0x29'),_0x56ed20['contactNumber']));searchContact(_0x4073ad,_0x5e0487,'mobile_number',_0x56ed20[_0x0702('0x2a')])[_0x0702('0xe')](function(_0x3e8b1c){if(_0x3e8b1c){_0x56ed20[_0x0702('0x2b')]=_0x3e8b1c['id'];logger[_0x0702('0x13')](_0x0702('0x2c'),_0x56ed20[_0x0702('0x2b')]);return _0x5a7762(_0x56ed20);}searchContact(_0x4073ad,_0x5e0487,'work_number',_0x56ed20[_0x0702('0x2a')])[_0x0702('0xe')](function(_0xc081d3){if(_0xc081d3){_0x56ed20[_0x0702('0x2b')]=_0xc081d3['id'];logger[_0x0702('0x13')](_0x0702('0x2d'),_0x56ed20[_0x0702('0x2b')]);return _0x5a7762(_0x56ed20);}createEndUser(_0x56ed20,_0x33e8fe,_0x5e0487,_0x4073ad)['then'](function(_0x52f691){logger[_0x0702('0x13')](_0x0702('0x2e'),_0x52f691[_0x0702('0x2b')]);return _0x5a7762(_0x52f691);});});})[_0x0702('0x16')](function(_0x163cea){_0x415c6a(_0x163cea);});});};}function createEndUser(_0x1cb9ec,_0x4909d6,_0x1aa28b,_0x5e4fe3){return new Promise(function(_0x395390,_0x32c1c7){var _0x47b964=moment();var _0xe7a6df={'method':_0x0702('0x2f'),'uri':_0x5e4fe3+_0x0702('0x30'),'body':{'contact':{'last_name':_0x1cb9ec[_0x0702('0x2a')],'work_number':_0x1cb9ec[_0x0702('0x2a')],'mobile_number':_0x1cb9ec[_0x0702('0x2a')],'owner_id':_0x1cb9ec[_0x0702('0x21')],'created_at':_0x47b964[_0x0702('0x28')](_0x0702('0x31'))}},'json':!![]};_0xe7a6df[_0x0702('0x1b')]=_0x1aa28b;logger[_0x0702('0x13')](_0x0702('0x32'));return rp(_0xe7a6df)[_0x0702('0xe')](function(_0x54c7e6){_0x1cb9ec[_0x0702('0x2b')]=_0x54c7e6[_0x0702('0x33')]['id'];_0x395390(_0x1cb9ec);})['catch'](function(_0x5114dd){logger[_0x0702('0x17')]('['+[_0x4909d6[_0x0702('0x18')]()]+']',_0x5114dd[_0x0702('0x19')]);_0x32c1c7(_0x5114dd[_0x0702('0x19')]);});});}function getTicket(_0x1ee91f,_0xcaa610,_0x25b03c,_0x37266f,_0x399ec6){return function(_0x1d57aa){logger['info'](_0x0702('0x34'));return new Promise(function(_0x261529,_0x10b75b){var _0x24ed08=moment();var _0x4e64e1={'method':_0x0702('0x2f'),'uri':_0x25b03c+_0x0702('0x35'),'body':{'title':intUtil[_0x0702('0x36')](_0x37266f['Subjects'],_0x399ec6,'\x20'),'description':intUtil[_0x0702('0x36')](_0x37266f['Descriptions'],_0x399ec6,'\x0a'),'owner_id':_0x1d57aa[_0x0702('0x21')],'creater_id':_0x1d57aa[_0x0702('0x12')],'targetable_id':_0x1d57aa[_0x0702('0x2b')],'targetable_type':_0x0702('0x37'),'created_at':_0x24ed08[_0x0702('0x28')](_0x0702('0x31')),'due_date':_0x24ed08[_0x0702('0x38')](0x1e,'m')[_0x0702('0x28')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x4e64e1[_0x0702('0x1b')]=_0xcaa610;return rp(_0x4e64e1)[_0x0702('0xe')](function(_0x212d13){_0x1d57aa['ticketId']=_0x212d13[_0x0702('0x39')]['id'];logger[_0x0702('0x13')]('Task\x20created:',_0x1d57aa[_0x0702('0x3a')]);_0x261529(_0x1d57aa);})[_0x0702('0x16')](function(_0x3a4d2a){logger[_0x0702('0x17')]('['+[_0x1ee91f['toUpperCase']()]+']',_0x3a4d2a[_0x0702('0x19')]);_0x10b75b(_0x3a4d2a[_0x0702('0x19')]);});});};}function emit(_0xc94293,_0x3f705a,_0x394ecf){var _0x5b6fbe={'uri':_0xc94293+_0x0702('0x3b')+_0x394ecf};io['to'](util['format']('user:%s',_0x3f705a))[_0x0702('0x3c')]('trigger:browser:url',_0x5b6fbe);}exports['cs']=function(_0x2517b3,_0x29ddf8,_0x287710,_0x25b606,_0x5776eb,_0x4b8f15,_0x54b7f4,_0x1f3feb){var _0x64525d={};var _0x209861={'Authorization':'Token\x20token='+_0x4b8f15[_0x0702('0x3d')]};_0x4b8f15[_0x0702('0x3e')]=intUtil[_0x0702('0x3f')](_0x4b8f15[_0x0702('0x3e')]);_0x4b8f15[_0x0702('0x40')]=intUtil[_0x0702('0x3f')](_0x4b8f15[_0x0702('0x40')]);var _0x412cba=_0x4b8f15[_0x0702('0x3e')];_0x64525d[_0x0702('0x11')]=_0x4b8f15['username'];_0x64525d[_0x0702('0x2a')]=_0x1f3feb[_0x0702('0x41')]()==='outbound'?_0x29ddf8[_0x0702('0x42')]:_0x29ddf8[_0x0702('0x43')];_0x64525d[_0x0702('0x44')]=_0x1f3feb===_0x0702('0x45')||_0x1f3feb==='unmanaged'?_0x0702('0x45'):_0x0702('0x46');if(_0x25b606){_0x64525d[_0x0702('0x1d')]=_0x25b606[_0x0702('0x1f')];}var _0x5f19b1=util[_0x0702('0x28')](_0x0702('0x47'),_0x4b8f15[_0x0702('0x40')],_0x29ddf8[_0x0702('0x48')],md5(_0x29ddf8[_0x0702('0x48')]));if(_0x5776eb&&_0x5776eb['monitor_format']){logger[_0x0702('0x13')](_0x0702('0x49'),_0x0702('0x4a'));_0x29ddf8[_0x0702('0x4b')]=_0x5f19b1;}else if(_0x54b7f4&&_0x54b7f4[_0x0702('0x4c')]&&_0x54b7f4[_0x0702('0x4c')]!=='none'){logger[_0x0702('0x13')]('[OUTBOUND]',_0x0702('0x4a'));_0x29ddf8[_0x0702('0x4b')]=_0x5f19b1;}else{_0x29ddf8[_0x0702('0x4b')]='';}return getAdminId(_0x64525d,_0x1f3feb,_0x209861,_0x412cba)[_0x0702('0xe')](getUser(_0x1f3feb,_0x209861,_0x412cba))[_0x0702('0xe')](getEndUser(_0x1f3feb,_0x209861,_0x412cba))['then'](getTicket(_0x1f3feb,_0x209861,_0x412cba,_0x287710,_0x29ddf8))[_0x0702('0xe')](function(_0x39b9a6){logger[_0x0702('0x13')](util[_0x0702('0x28')]('The\x20ticket\x20ID\x20is:\x20%s',_0x39b9a6[_0x0702('0x3a')]));if(_0x1f3feb!=='unmanaged'){logger[_0x0702('0x13')]('['+[_0x1f3feb[_0x0702('0x18')]()]+']',_0x0702('0x4d'));emit(_0x412cba,_0x25b606[_0x0702('0x4e')],_0x39b9a6['endUserId']);}})['catch'](function(_0x94065c){logger[_0x0702('0x17')]('['+[_0x1f3feb[_0x0702('0x18')]()]+_0x0702('0x4f'),util[_0x0702('0x50')](_0x94065c,{'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 e83aba5..bd012da 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 _0xec55=['./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','servicenow','exec','includes','data1','toLowerCase','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','dynamics365','log','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','./zendesk','./salesforce','./sugarcrm','./desk','./dynamics365'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xec55,0x1c9));var _0x5ec5=function(_0x2a2dfc,_0x33b59c){_0x2a2dfc=_0x2a2dfc-0x0;var _0x124c3f=_0xec55[_0x2a2dfc];return _0x124c3f;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x5ec5('0x0'));var salesforce=require(_0x5ec5('0x1'));var sugarcrm=require(_0x5ec5('0x2'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0x5ec5('0x3'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x5ec5('0x4'));var freshsales=require(_0x5ec5('0x5'));var integrations=[_0x5ec5('0x6'),_0x5ec5('0x7'),_0x5ec5('0x8'),_0x5ec5('0x9'),_0x5ec5('0xa'),_0x5ec5('0xb'),_0x5ec5('0xc'),'dynamics365','freshsales',_0x5ec5('0xd')];exports[_0x5ec5('0xe')]=function(_0x5bf75b,_0x5a605c,_0x122e48,_0x27c973,_0x105293,_0x4a3fe2){if(_0x122e48){if(_[_0x5ec5('0xf')](integrations,_0x5bf75b[_0x5ec5('0x10')][_0x5ec5('0x11')]())){try{var _0x5255b6=null;var _0x25ff58='';var _0x2a7279=_0x122e48[_0x5bf75b['data1'][_0x5ec5('0x11')]()];if(_0x2a7279){var _0x2de66b=_0x2a7279[_0x5bf75b['data2']];if(_0x2de66b){var _0x51d760=_['find'](_0x2de66b[_0x5ec5('0x12')],{'id':parseInt(_0x5bf75b[_0x5ec5('0x13')],0xa)});if(_0x51d760){if(_0x27c973){if(_0x105293&&_0x5a605c[_0x5ec5('0x14')]){_0x25ff58='queue';}else if(_0x5a605c[_0x5ec5('0x15')]){_0x25ff58=_0x5ec5('0x16');}else{console['log'](_0x5ec5('0x17'),_0x5a605c);}}else{_0x25ff58=_0x5ec5('0x18');}switch(_0x5bf75b[_0x5ec5('0x10')]['toLowerCase']()){case'zendesk':zendesk[_0x25ff58](_0x5bf75b,_0x5a605c,_0x51d760,_0x27c973,_0x105293,_0x2de66b,_0x4a3fe2);break;case _0x5ec5('0x7'):salesforce[_0x25ff58](_0x5bf75b,_0x5a605c,_0x51d760,_0x27c973,_0x105293,_0x2de66b,_0x4a3fe2);break;case _0x5ec5('0x8'):sugarcrm[_0x25ff58](_0x5bf75b,_0x5a605c,_0x51d760,_0x27c973,_0x105293,_0x2de66b,_0x4a3fe2);break;case _0x5ec5('0x9'):freshdesk[_0x25ff58](_0x5bf75b,_0x5a605c,_0x51d760,_0x27c973,_0x105293,_0x2de66b,_0x4a3fe2);break;case'zoho':zoho[_0x25ff58](_0x5bf75b,_0x5a605c,_0x51d760,_0x27c973,_0x105293,_0x2de66b,_0x4a3fe2);break;case _0x5ec5('0xb'):desk[_0x25ff58](_0x5bf75b,_0x5a605c,_0x51d760,_0x27c973,_0x105293,_0x2de66b,_0x4a3fe2);break;case _0x5ec5('0xc'):vtiger[_0x25ff58](_0x5bf75b,_0x5a605c,_0x51d760,_0x27c973,_0x105293,_0x2de66b,_0x4a3fe2);break;case'freshsales':freshsales['cs'](_0x5bf75b,_0x5a605c,_0x51d760,_0x27c973,_0x105293,_0x2de66b,_0x4a3fe2,_0x25ff58);break;case _0x5ec5('0xd'):servicenow['cs'](_0x5bf75b,_0x5a605c,_0x51d760,_0x27c973,_0x105293,_0x2de66b,_0x4a3fe2,_0x25ff58);break;case _0x5ec5('0x19'):dynamics365['cs'](_0x5bf75b,_0x5a605c,_0x51d760,_0x27c973,_0x105293,_0x2de66b,_0x4a3fe2,_0x25ff58);break;default:console[_0x5ec5('0x1a')]('unknown\x20integration');}}else{_0x5255b6=require(_0x5ec5('0x1b'))(_0x5bf75b[_0x5ec5('0x10')][_0x5ec5('0x11')]());_0x5255b6[_0x5ec5('0x1c')](_0x5ec5('0x1d'),util[_0x5ec5('0x1e')](_0x5ec5('0x1f'),_0x5bf75b[_0x5ec5('0x10')][_0x5ec5('0x11')](),_0x5bf75b[_0x5ec5('0x13')]));}}else{_0x5255b6=require(_0x5ec5('0x1b'))(_0x5bf75b[_0x5ec5('0x10')][_0x5ec5('0x11')]());_0x5255b6[_0x5ec5('0x1c')](_0x5ec5('0x1d'),util['format'](_0x5ec5('0x20'),_0x5bf75b[_0x5ec5('0x10')][_0x5ec5('0x11')](),_0x5bf75b['data2']));}}else{}}catch(_0x13f41f){console[_0x5ec5('0x1c')](_0x13f41f);}}}}; \ No newline at end of file +var _0x9f83=['lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./servicenow','./dynamics365','./freshsales','zendesk','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger'];(function(_0x5027ce,_0x195cdf){var _0x4e7232=function(_0xe2e3e2){while(--_0xe2e3e2){_0x5027ce['push'](_0x5027ce['shift']());}};_0x4e7232(++_0x195cdf);}(_0x9f83,0x144));var _0x39f8=function(_0x1514fd,_0x4804b6){_0x1514fd=_0x1514fd-0x0;var _0x43f74d=_0x9f83[_0x1514fd];return _0x43f74d;};'use strict';var _=require(_0x39f8('0x0'));var util=require('util');var zendesk=require(_0x39f8('0x1'));var salesforce=require(_0x39f8('0x2'));var sugarcrm=require(_0x39f8('0x3'));var freshdesk=require(_0x39f8('0x4'));var zoho=require(_0x39f8('0x5'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x39f8('0x6'));var dynamics365=require(_0x39f8('0x7'));var freshsales=require(_0x39f8('0x8'));var integrations=[_0x39f8('0x9'),'salesforce','sugarcrm',_0x39f8('0xa'),_0x39f8('0xb'),_0x39f8('0xc'),_0x39f8('0xd'),_0x39f8('0xe'),_0x39f8('0xf'),_0x39f8('0x10')];exports['exec']=function(_0x4af978,_0x4bc404,_0x423e7f,_0xfb4f28,_0x22766d,_0x5cec50){if(_0x423e7f){if(_[_0x39f8('0x11')](integrations,_0x4af978[_0x39f8('0x12')][_0x39f8('0x13')]())){try{var _0xea34d8=null;var _0x56356b='';var _0x432c29=_0x423e7f[_0x4af978[_0x39f8('0x12')]['toLowerCase']()];if(_0x432c29){var _0x4cc9f8=_0x432c29[_0x4af978[_0x39f8('0x14')]];if(_0x4cc9f8){var _0x40f547=_[_0x39f8('0x15')](_0x4cc9f8[_0x39f8('0x16')],{'id':parseInt(_0x4af978[_0x39f8('0x17')],0xa)});if(_0x40f547){if(_0xfb4f28){if(_0x22766d&&_0x4bc404[_0x39f8('0x18')]){_0x56356b=_0x39f8('0x18');}else if(_0x4bc404[_0x39f8('0x19')]){_0x56356b=_0x39f8('0x1a');}else{console[_0x39f8('0x1b')](_0x39f8('0x1c'),_0x4bc404);}}else{_0x56356b=_0x39f8('0x1d');}switch(_0x4af978[_0x39f8('0x12')][_0x39f8('0x13')]()){case _0x39f8('0x9'):zendesk[_0x56356b](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50);break;case _0x39f8('0x1e'):salesforce[_0x56356b](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50);break;case'sugarcrm':sugarcrm[_0x56356b](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50);break;case _0x39f8('0xa'):freshdesk[_0x56356b](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50);break;case _0x39f8('0xb'):zoho[_0x56356b](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50);break;case _0x39f8('0xc'):desk[_0x56356b](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50);break;case'vtiger':vtiger[_0x56356b](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50);break;case _0x39f8('0xf'):freshsales['cs'](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50,_0x56356b);break;case'servicenow':servicenow['cs'](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50,_0x56356b);break;case _0x39f8('0xe'):dynamics365['cs'](_0x4af978,_0x4bc404,_0x40f547,_0xfb4f28,_0x22766d,_0x4cc9f8,_0x5cec50,_0x56356b);break;default:console['log']('unknown\x20integration');}}else{_0xea34d8=require('../../../../config/logger')(_0x4af978['data1']['toLowerCase']());_0xea34d8[_0x39f8('0x1f')](_0x39f8('0x20'),util[_0x39f8('0x21')](_0x39f8('0x22'),_0x4af978['data1'][_0x39f8('0x13')](),_0x4af978[_0x39f8('0x17')]));}}else{_0xea34d8=require(_0x39f8('0x23'))(_0x4af978['data1'][_0x39f8('0x13')]());_0xea34d8[_0x39f8('0x1f')](_0x39f8('0x20'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x4af978[_0x39f8('0x12')][_0x39f8('0x13')](),_0x4af978['data2']));}}else{}}catch(_0x4a0a70){console[_0x39f8('0x1f')](_0x4a0a70);}}}}; \ 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 110b5de..e7ba0af 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 _0xbe4d=['Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','toUpperCase','lodash','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','getString','Subjects','Descriptions','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','WhatId','contact','leadId','info','sobject','isNil','validateEmail','User','find','execute','then','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','identity','user_id','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','length','additionalSearchLead','additionalSearchAccount','Account','Contact','Lead','first','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','Company','No\x20Company','upperFirst','create','forEach','includes','string','picklist','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','Connection','remoteUri','https://login.salesforce.com','clientId','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','integrationTab','newTab','error'];(function(_0xe18042,_0x2ab1d7){var _0x544b23=function(_0x194415){while(--_0x194415){_0xe18042['push'](_0xe18042['shift']());}};_0x544b23(++_0x2ab1d7);}(_0xbe4d,0x102));var _0xdbe4=function(_0x57b968,_0xee3b4b){_0x57b968=_0x57b968-0x0;var _0x35f7fe=_0xbe4d[_0x57b968];return _0x35f7fe;};'use strict';var _=require(_0xdbe4('0x0'));var rp=require(_0xdbe4('0x1'));var moment=require(_0xdbe4('0x2'));var BPromise=require('bluebird');var md5=require(_0xdbe4('0x3'));var jsforce=require(_0xdbe4('0x4'));var util=require(_0xdbe4('0x5'));var Redis=require(_0xdbe4('0x6'));var intUtil=require(_0xdbe4('0x7'));var config=require(_0xdbe4('0x8'));var logger=require(_0xdbe4('0x9'))('salesforce');config[_0xdbe4('0xa')]=_[_0xdbe4('0xb')](config['redis'],{'host':_0xdbe4('0xc'),'port':0x18eb});var io=require(_0xdbe4('0xd'))(new Redis(config[_0xdbe4('0xa')]));function emit(_0x2062fb,_0x4d0239,_0x6672fa){io['to'](_0x2062fb)['emit'](_0x4d0239,_0x6672fa);}function getTicket(_0x44aea3,_0x567d2a,_0x1182ab,_0x1b9be8,_0x35b4a6,_0x80e191,_0x4b7399,_0x28124d){var _0x42a5da=Object['assign']({},{'OwnerId':_0x567d2a['id'],'Subject':intUtil[_0xdbe4('0xe')](_0x1b9be8[_0xdbe4('0xf')],_0x35b4a6,'\x20'),'Description':intUtil['getString'](_0x1b9be8[_0xdbe4('0x10')],_0x35b4a6,'\x0a')},getCustomFields(_0x80e191,_0x35b4a6));if(_0x1182ab){if(_0x1b9be8[_0xdbe4('0x11')]===_0xdbe4('0x12')){_0x42a5da['ActivityDate']=moment[_0xdbe4('0x13')]();_0x42a5da[_0xdbe4('0x14')]=![];_0x42a5da[_0xdbe4('0x15')]=![];if(_0x1182ab[_0xdbe4('0x16')]==='contact'||_0x1182ab[_0xdbe4('0x16')]===_0xdbe4('0x17')){_0x42a5da[_0xdbe4('0x18')]=_0x1182ab['id'];}else if(_0x1182ab[_0xdbe4('0x16')]===_0xdbe4('0x19')){_0x42a5da[_0xdbe4('0x1a')]=_0x1182ab['id'];}}else if(_0x1b9be8[_0xdbe4('0x11')]==='Case'){if(_0x1182ab['endUserType']===_0xdbe4('0x1b')){_0x42a5da['ContactId']=_0x1182ab['id'];}else if(_0x1182ab[_0xdbe4('0x16')]===_0xdbe4('0x19')){_0x42a5da['AccountId']=_0x1182ab['id'];}else if(_0x1182ab[_0xdbe4('0x16')]==='lead'&&_0x1b9be8['leadId']){_0x42a5da[_0x1b9be8[_0xdbe4('0x1c')]]=_0x1182ab['id'];}else{logger[_0xdbe4('0x1d')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4b7399[_0xdbe4('0x1e')](_0x1b9be8[_0xdbe4('0x11')])['create'](_0x42a5da);}function getUser(_0x5963d7,_0x4acc81,_0x23a6d6){if(!_[_0xdbe4('0x1f')](_0x4acc81)&&intUtil[_0xdbe4('0x20')](_0x4acc81)){var _0x4c1e4f={'Email':_0x4acc81};var _0x34f1ea={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x23a6d6[_0xdbe4('0x1e')](_0xdbe4('0x21'))[_0xdbe4('0x22')](_0x4c1e4f,_0x34f1ea)[_0xdbe4('0x23')]()[_0xdbe4('0x24')](function(_0x42e245){if(_0x42e245['length']){var _0x28601b=_[_0xdbe4('0x22')](_0x42e245,function(_0x20f1d6){return _0x20f1d6[_0xdbe4('0x25')]===_0x4acc81;});if(_0x28601b){logger[_0xdbe4('0x1d')](_0xdbe4('0x26'),_0x4acc81);return BPromise[_0xdbe4('0x27')]({'id':_0x28601b['Id'],'name':_0x28601b[_0xdbe4('0x28')]});}}else{logger[_0xdbe4('0x1d')](_0xdbe4('0x29'),_0x4acc81);return _0x23a6d6['identity']()[_0xdbe4('0x24')](function(_0x5e1a51){return BPromise[_0xdbe4('0x27')]({'id':_0x5e1a51['user_id'],'name':_0x5e1a51[_0xdbe4('0x2a')]});});}});}else{logger[_0xdbe4('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x4acc81);return _0x23a6d6[_0xdbe4('0x2b')]()[_0xdbe4('0x24')](function(_0x5b284d){return BPromise[_0xdbe4('0x27')]({'id':_0x5b284d[_0xdbe4('0x2c')],'name':_0x5b284d['display_name']});});}}function getEndUser(_0x53cb7c,_0x51207e,_0x1127b8,_0x4aa37c,_0x3f433a){var _0x4f5d0e={'$or':{'Phone':_0x4aa37c}};var _0x4758d9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xdbe4('0x27')]()[_0xdbe4('0x24')](function(){logger[_0xdbe4('0x1d')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x4aa37c,_0x51207e[_0xdbe4('0x2d')]);switch(_0x51207e[_0xdbe4('0x2d')]){case _0xdbe4('0x2e'):var _0x2c7a2b=_[_0xdbe4('0x2f')](_0x4f5d0e);if(_0x51207e[_0xdbe4('0x30')]){var _0xf4d239={};_0xf4d239[_0x51207e[_0xdbe4('0x30')]]=_0x4aa37c;_[_0xdbe4('0x31')](_0x2c7a2b[_0xdbe4('0x32')],_0xf4d239);}return _0x3f433a[_0xdbe4('0x1e')]('Contact')[_0xdbe4('0x22')](_0x2c7a2b,_0x4758d9)[_0xdbe4('0x23')]()['then'](function(_0x8c3e68){if(_0x8c3e68&&_0x8c3e68[_0xdbe4('0x33')]){return _0x8c3e68;}else{var _0x118a40=_[_0xdbe4('0x2f')](_0x4f5d0e);if(_0x51207e[_0xdbe4('0x34')]){var _0x1b868b={};_0x1b868b[_0x51207e[_0xdbe4('0x34')]]=_0x4aa37c;_[_0xdbe4('0x31')](_0x118a40['$or'],_0x1b868b);}return _0x3f433a[_0xdbe4('0x1e')]('Lead')[_0xdbe4('0x22')](_0x118a40,_0x4758d9);}});case'account_contact_lead':var _0x6ac531=_['cloneDeep'](_0x4f5d0e);if(_0x51207e[_0xdbe4('0x35')]){var _0xf4d239={};_0xf4d239[_0x51207e[_0xdbe4('0x35')]]=_0x4aa37c;_[_0xdbe4('0x31')](_0x6ac531[_0xdbe4('0x32')],_0xf4d239);}return _0x3f433a['sobject'](_0xdbe4('0x36'))['find'](_0x6ac531,_0x4758d9)[_0xdbe4('0x23')]()['then'](function(_0x4b24c2){if(_0x4b24c2&&_0x4b24c2[_0xdbe4('0x33')]){return _0x4b24c2;}else{var _0x5cc0cb=_[_0xdbe4('0x2f')](_0x4f5d0e);if(_0x51207e[_0xdbe4('0x30')]){var _0xa3efaf={};_0xa3efaf[_0x51207e[_0xdbe4('0x30')]]=_0x4aa37c;_[_0xdbe4('0x31')](_0x5cc0cb[_0xdbe4('0x32')],_0xa3efaf);}return _0x3f433a[_0xdbe4('0x1e')](_0xdbe4('0x37'))[_0xdbe4('0x22')](_0x5cc0cb,_0x4758d9)[_0xdbe4('0x24')](function(_0x4e0fc2){if(_0x4e0fc2&&_0x4e0fc2[_0xdbe4('0x33')]){return _0x4e0fc2;}else{var _0x176809=_[_0xdbe4('0x2f')](_0x4f5d0e);if(_0x51207e[_0xdbe4('0x34')]){var _0x614e82={};_0x614e82[_0x51207e[_0xdbe4('0x34')]]=_0x4aa37c;_[_0xdbe4('0x31')](_0x176809[_0xdbe4('0x32')],_0x614e82);}return _0x3f433a[_0xdbe4('0x1e')]('Lead')[_0xdbe4('0x22')](_0x176809,_0x4758d9);}});}});case _0xdbe4('0x1b'):var _0x2c7a2b=_[_0xdbe4('0x2f')](_0x4f5d0e);if(_0x51207e[_0xdbe4('0x30')]){var _0xf4d239={};_0xf4d239[_0x51207e['additionalSearchContact']]=_0x4aa37c;_[_0xdbe4('0x31')](_0x2c7a2b['$or'],_0xf4d239);}return _0x3f433a[_0xdbe4('0x1e')](_0xdbe4('0x37'))[_0xdbe4('0x22')](_0x2c7a2b,_0x4758d9)[_0xdbe4('0x23')]();case _0xdbe4('0x17'):var _0x3b0cd2=_[_0xdbe4('0x2f')](_0x4f5d0e);if(_0x51207e[_0xdbe4('0x34')]){var _0xf4d239={};_0xf4d239[_0x51207e[_0xdbe4('0x34')]]=_0x4aa37c;_[_0xdbe4('0x31')](_0x3b0cd2[_0xdbe4('0x32')],_0xf4d239);}return _0x3f433a['sobject'](_0xdbe4('0x38'))[_0xdbe4('0x22')](_0x3b0cd2,_0x4758d9);case _0xdbe4('0x19'):var _0x6ac531=_['cloneDeep'](_0x4f5d0e);if(_0x51207e[_0xdbe4('0x35')]){var _0xf4d239={};_0xf4d239[_0x51207e[_0xdbe4('0x35')]]=_0x4aa37c;_['merge'](_0x6ac531[_0xdbe4('0x32')],_0xf4d239);}return _0x3f433a[_0xdbe4('0x1e')]('Account')[_0xdbe4('0x22')](_0x6ac531,_0x4758d9);default:return null;}})[_0xdbe4('0x24')](function(_0x4033f6){if(_0x4033f6&&_0x4033f6[_0xdbe4('0x33')]){var _0x6faf4a=_[_0xdbe4('0x39')](_0x4033f6);if(_0x6faf4a){return BPromise[_0xdbe4('0x27')]({'id':_0x6faf4a['Id'],'name':_0x6faf4a[_0xdbe4('0x28')],'phone':_0x6faf4a['Phone'],'endUserType':_0x6faf4a[_0xdbe4('0x3a')][_0xdbe4('0x3b')]['toLowerCase']()});}}})[_0xdbe4('0x24')](function(_0x5d619a){if(_0x5d619a){logger['info'](_0xdbe4('0x3c'),_0x5d619a[_0xdbe4('0x16')],_0x4aa37c);return BPromise[_0xdbe4('0x27')](_0x5d619a);}else{logger['info'](_0xdbe4('0x3d'),_0x4aa37c);var _0x568bb5={'Phone':_0x4aa37c};if(_0x51207e[_0xdbe4('0x3e')]){if(_0x51207e[_0xdbe4('0x3e')]==='contact'){logger[_0xdbe4('0x1d')](_0xdbe4('0x3f'),_0x4aa37c,_0x51207e['moduleCreate']);_0x568bb5[_0xdbe4('0x40')]=_0x1127b8!==''?_0x1127b8:util[_0xdbe4('0x41')](_0xdbe4('0x42'),_0x4aa37c);}else if(_0x51207e[_0xdbe4('0x3e')]===_0xdbe4('0x17')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4aa37c,_0x51207e[_0xdbe4('0x3e')]);_0x568bb5['LastName']=_0x1127b8!==_0xdbe4('0x43')?_0x1127b8:util[_0xdbe4('0x41')]('Caller\x20-\x20%s',_0x4aa37c);_0x568bb5[_0xdbe4('0x44')]=_0xdbe4('0x45');}else if(_0x51207e['moduleCreate']===_0xdbe4('0x19')){logger[_0xdbe4('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4aa37c,_0x51207e[_0xdbe4('0x3e')]);_0x568bb5[_0xdbe4('0x28')]=_0x1127b8!==_0xdbe4('0x43')?_0x1127b8:util['format'](_0xdbe4('0x42'),_0x4aa37c);}else{return null;}}return _0x3f433a[_0xdbe4('0x1e')](_[_0xdbe4('0x46')](_0x51207e[_0xdbe4('0x3e')]))[_0xdbe4('0x47')](_0x568bb5)['then'](function(_0x3e7a42){return BPromise[_0xdbe4('0x27')]({'id':_0x3e7a42['id'],'endUserType':_0x51207e[_0xdbe4('0x3e')]});});}});}function getCustomFields(_0x5e0a90,_0x356087){var _0x380348={};if(_0x5e0a90['length']>0x0){_[_0xdbe4('0x48')](_0x5e0a90,function(_0x42217e){if(_[_0xdbe4('0x49')]([_0xdbe4('0x4a'),_0xdbe4('0x4b')],_0x42217e[_0xdbe4('0x3b')])&&_0x42217e['idField']){_0x380348[_0x42217e[_0xdbe4('0x4c')]]=_0x42217e['content'][_0xdbe4('0x4d')]();}else if(_0x42217e[_0xdbe4('0x3b')]===_0xdbe4('0x4e')&&_0x42217e[_0xdbe4('0x4f')]&&_0x42217e[_0xdbe4('0x4c')]){_0x356087[_0x42217e['variableName']]&&(_0x380348[_0x42217e['idField']]=_0x356087[_0x42217e[_0xdbe4('0x4f')]]['toString']());}else if(_0x42217e['type']===_0xdbe4('0x50')&&_0x42217e[_0xdbe4('0x51')]&&_0x42217e[_0xdbe4('0x51')][_0xdbe4('0x52')]&&_0x42217e['idField']){_0x356087[_0x42217e['Variable'][_0xdbe4('0x52')][_0xdbe4('0x53')]()]&&(_0x380348[_0x42217e['idField']]=_0x356087[_0x42217e[_0xdbe4('0x51')][_0xdbe4('0x52')][_0xdbe4('0x53')]()][_0xdbe4('0x4d')]());}});}return _0x380348;}function getConnection(_0x5ed67d){var _0x4d8f66=_0x5ed67d[_0xdbe4('0x54')]['concat'](_0x5ed67d['securityToken']);var _0x2092ca=new jsforce[(_0xdbe4('0x55'))]({'oauth2':{'loginUrl':_0x5ed67d[_0xdbe4('0x56')]||_0xdbe4('0x57'),'clientId':_0x5ed67d[_0xdbe4('0x58')],'clientSecret':_0x5ed67d['clientSecret']}});return _0x2092ca[_0xdbe4('0x59')](_0x5ed67d['username'],_0x4d8f66)[_0xdbe4('0x24')](function(){logger['info'](_0xdbe4('0x5a'));return _0x2092ca;});}exports[_0xdbe4('0x5b')]=function(_0x482f7a,_0x1da00f,_0x4529b7,_0x9f8316,_0x3a6f06,_0x27f033){var _0x50b3ca,_0x110d8c,_0x1d7716,_0x9441d1;_0x27f033[_0xdbe4('0x5c')]=intUtil[_0xdbe4('0x5d')](_0x27f033[_0xdbe4('0x5c')]);_0x27f033['remoteUri']=intUtil[_0xdbe4('0x5d')](_0x27f033['remoteUri']);if(_0x3a6f06&&_0x3a6f06[_0xdbe4('0x5e')]){logger[_0xdbe4('0x1d')]('[QUEUE]',_0xdbe4('0x5f'));_0x1da00f['recordingURL']=util[_0xdbe4('0x41')](_0xdbe4('0x60'),_0x27f033[_0xdbe4('0x5c')],_0x1da00f['uniqueid'],md5(_0x1da00f[_0xdbe4('0x61')]));}else{_0x1da00f['recordingURL']='';}return getConnection(_0x27f033)[_0xdbe4('0x24')](function(_0x178468){_0x9441d1=_0x178468;return getUser(_0x27f033,_0x9f8316[_0xdbe4('0x62')],_0x9441d1);})[_0xdbe4('0x24')](function(_0xea9dc8){_0x50b3ca=_0xea9dc8;return getEndUser(_0x27f033,_0x4529b7,_0x1da00f[_0xdbe4('0x63')],_0x1da00f[_0xdbe4('0x64')],_0x9441d1);})[_0xdbe4('0x24')](function(_0x5def2a){_0x110d8c=_0x5def2a;return getTicket(_0x27f033,_0x50b3ca,_0x110d8c,_0x4529b7,_0x1da00f,_0x4529b7[_0xdbe4('0x65')],_0x9441d1,'queue');})[_0xdbe4('0x24')](function(_0x1badd1){_0x1d7716=_0x1badd1;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x1d7716['id']);logger[_0xdbe4('0x1d')](_0xdbe4('0x66'),_0x1d7716['id'],_0x9f8316[_0xdbe4('0x52')],_0x27f033[_0xdbe4('0x3b')]);switch(_0x27f033['type']){case'integrationTab':emit(util[_0xdbe4('0x41')](_0xdbe4('0x67'),_0x9f8316[_0xdbe4('0x52')]),_0xdbe4('0x68'),{'recordId':_0x1d7716['id']});break;case'newTab':emit(util[_0xdbe4('0x41')]('user:%s',_0x9f8316[_0xdbe4('0x52')]),_0xdbe4('0x69'),{'uri':util[_0xdbe4('0x41')](_0xdbe4('0x6a'),_0x9441d1[_0xdbe4('0x6b')],_0x1d7716['id'])});break;default:logger['error'](_0xdbe4('0x6c'));}})[_0xdbe4('0x6d')](function(_0x99ece2){logger['error'](_0xdbe4('0x6e'),_0x99ece2);});};exports[_0xdbe4('0x6f')]=function(_0x4825d4,_0x1d038a,_0x36a538,_0x34efa7,_0x1dffc4,_0x207463,_0x5d42e8){var _0x55e7d3,_0x3ba8ff,_0x5a01b3,_0x39a789;_0x207463['serverUrl']=intUtil[_0xdbe4('0x5d')](_0x207463[_0xdbe4('0x5c')]);_0x207463['remoteUri']=intUtil[_0xdbe4('0x5d')](_0x207463[_0xdbe4('0x56')]);if(_0x5d42e8&&_0x5d42e8[_0xdbe4('0x70')]&&_0x5d42e8[_0xdbe4('0x70')]!==_0xdbe4('0x71')){logger[_0xdbe4('0x1d')](_0xdbe4('0x72'),_0xdbe4('0x5f'));_0x1d038a[_0xdbe4('0x73')]=util[_0xdbe4('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x207463[_0xdbe4('0x5c')],_0x1d038a[_0xdbe4('0x61')],md5(_0x1d038a['uniqueid']));}return getConnection(_0x207463)[_0xdbe4('0x24')](function(_0x40ff78){_0x39a789=_0x40ff78;return getUser(_0x207463,_0x34efa7[_0xdbe4('0x62')],_0x39a789);})['then'](function(_0x575a69){_0x55e7d3=_0x575a69;return getEndUser(_0x207463,_0x36a538,_0x1d038a[_0xdbe4('0x74')],_0x1d038a['destcalleridnum'],_0x39a789);})[_0xdbe4('0x24')](function(_0x151d25){_0x3ba8ff=_0x151d25;return getTicket(_0x207463,_0x55e7d3,_0x3ba8ff,_0x36a538,_0x1d038a,_0x36a538[_0xdbe4('0x65')],_0x39a789,_0xdbe4('0x6f'));})['then'](function(_0x4dc094){_0x5a01b3=_0x4dc094;logger[_0xdbe4('0x1d')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x5a01b3['id']);logger[_0xdbe4('0x1d')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5a01b3['id'],_0x34efa7[_0xdbe4('0x52')],_0x207463[_0xdbe4('0x3b')]);switch(_0x207463['type']){case _0xdbe4('0x75'):emit(util[_0xdbe4('0x41')](_0xdbe4('0x67'),_0x34efa7['name']),_0xdbe4('0x68'),{'recordId':_0x5a01b3['id']});break;case _0xdbe4('0x76'):emit(util[_0xdbe4('0x41')](_0xdbe4('0x67'),_0x34efa7[_0xdbe4('0x52')]),_0xdbe4('0x69'),{'uri':util['format'](_0xdbe4('0x6a'),_0x39a789[_0xdbe4('0x6b')],_0x5a01b3['id'])});break;default:logger[_0xdbe4('0x77')](_0xdbe4('0x72'),_0xdbe4('0x78'));}})[_0xdbe4('0x6d')](function(_0x50c106){logger[_0xdbe4('0x77')](_0xdbe4('0x72'),_0x50c106);});};exports[_0xdbe4('0x79')]=function(_0x1d15a9,_0xbe3ebb,_0x13eeb8,_0x480bab,_0x3bf8b5,_0x27428a){var _0x8de591,_0xf8863f,_0x3d051e,_0x2ecfc2;_0x27428a['serverUrl']=intUtil[_0xdbe4('0x5d')](_0x27428a[_0xdbe4('0x5c')]);_0x27428a[_0xdbe4('0x56')]=intUtil['stripTrailingSlash'](_0x27428a[_0xdbe4('0x56')]);if(_0x3bf8b5&&_0x3bf8b5['monitor_format']){logger[_0xdbe4('0x1d')]('['+_0xbe3ebb[_0xdbe4('0x7a')]['toUpperCase']()+']',_0xdbe4('0x5f'));_0xbe3ebb[_0xdbe4('0x73')]=util['format'](_0xdbe4('0x60'),_0x27428a[_0xdbe4('0x5c')],_0xbe3ebb[_0xdbe4('0x61')],md5(_0xbe3ebb[_0xdbe4('0x61')]));}else{_0xbe3ebb[_0xdbe4('0x73')]='';}return getConnection(_0x27428a)['then'](function(_0x67d289){_0x2ecfc2=_0x67d289;if(!_[_0xdbe4('0x1f')](_0x480bab)){return getUser(_0x27428a,_0x480bab['name'],_0x2ecfc2);}else{return getUser(_0x27428a,null,_0x2ecfc2);}})['then'](function(_0x1bf90c){_0x8de591=_0x1bf90c;return getEndUser(_0x27428a,_0x13eeb8,_0xbe3ebb[_0xdbe4('0x63')],_0xbe3ebb['calleridnum'],_0x2ecfc2);})['then'](function(_0x1cbacf){_0xf8863f=_0x1cbacf;return getTicket(_0x27428a,_0x8de591,_0xf8863f,_0x13eeb8,_0xbe3ebb,_0x13eeb8[_0xdbe4('0x65')],_0x2ecfc2);})[_0xdbe4('0x24')](function(_0x1d47a5){_0x3d051e=_0x1d47a5;logger[_0xdbe4('0x1d')]('['+_0xbe3ebb[_0xdbe4('0x7a')]['toUpperCase']()+_0xdbe4('0x7b'),_0x3d051e['id']);logger['info']('['+_0xbe3ebb[_0xdbe4('0x7a')]['toUpperCase']()+_0xdbe4('0x7c'),_0x27428a['type']);})['catch'](function(_0x15fed8){logger[_0xdbe4('0x77')]('['+_0xbe3ebb['lastevent'][_0xdbe4('0x7d')]()+']',_0x15fed8);});}; \ No newline at end of file +var _0xc775=['clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','defaults','localhost','socket.io-emitter','emit','assign','Subjects','getString','Descriptions','ticketType','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','WhatId','Case','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','execute','then','length','find','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','merge','Contact','cloneDeep','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Name','Phone','attributes','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','No\x20Company','includes','string','picklist','idField','content','toString','type','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken'];(function(_0x478e79,_0x3d51de){var _0x38f3d7=function(_0x3625af){while(--_0x3625af){_0x478e79['push'](_0x478e79['shift']());}};_0x38f3d7(++_0x3d51de);}(_0xc775,0x128));var _0x5c77=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc775[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x5c77('0x0'));var rp=require('request-promise');var moment=require(_0x5c77('0x1'));var BPromise=require('bluebird');var md5=require(_0x5c77('0x2'));var jsforce=require(_0x5c77('0x3'));var util=require(_0x5c77('0x4'));var Redis=require('ioredis');var intUtil=require(_0x5c77('0x5'));var config=require(_0x5c77('0x6'));var logger=require(_0x5c77('0x7'))('salesforce');config['redis']=_[_0x5c77('0x8')](config['redis'],{'host':_0x5c77('0x9'),'port':0x18eb});var io=require(_0x5c77('0xa'))(new Redis(config['redis']));function emit(_0x597679,_0x3fccd8,_0x35df40){io['to'](_0x597679)[_0x5c77('0xb')](_0x3fccd8,_0x35df40);}function getTicket(_0x202c91,_0x3de9e5,_0x146625,_0x520bdd,_0x45c315,_0x4a3108,_0x1bbc89,_0x4812c1){var _0x51eda0=Object[_0x5c77('0xc')]({},{'OwnerId':_0x3de9e5['id'],'Subject':intUtil['getString'](_0x520bdd[_0x5c77('0xd')],_0x45c315,'\x20'),'Description':intUtil[_0x5c77('0xe')](_0x520bdd[_0x5c77('0xf')],_0x45c315,'\x0a')},getCustomFields(_0x4a3108,_0x45c315));if(_0x146625){if(_0x520bdd[_0x5c77('0x10')]==='Task'){_0x51eda0['ActivityDate']=moment[_0x5c77('0x11')]();_0x51eda0[_0x5c77('0x12')]=![];_0x51eda0[_0x5c77('0x13')]=![];if(_0x146625[_0x5c77('0x14')]===_0x5c77('0x15')||_0x146625[_0x5c77('0x14')]===_0x5c77('0x16')){_0x51eda0[_0x5c77('0x17')]=_0x146625['id'];}else if(_0x146625[_0x5c77('0x14')]==='account'){_0x51eda0[_0x5c77('0x18')]=_0x146625['id'];}}else if(_0x520bdd[_0x5c77('0x10')]===_0x5c77('0x19')){if(_0x146625[_0x5c77('0x14')]==='contact'){_0x51eda0[_0x5c77('0x1a')]=_0x146625['id'];}else if(_0x146625[_0x5c77('0x14')]===_0x5c77('0x1b')){_0x51eda0[_0x5c77('0x1c')]=_0x146625['id'];}else if(_0x146625[_0x5c77('0x14')]===_0x5c77('0x16')&&_0x520bdd[_0x5c77('0x1d')]){_0x51eda0[_0x520bdd[_0x5c77('0x1d')]]=_0x146625['id'];}else{logger[_0x5c77('0x1e')](_0x5c77('0x1f'));}}}return _0x1bbc89[_0x5c77('0x20')](_0x520bdd['ticketType'])[_0x5c77('0x21')](_0x51eda0);}function getUser(_0x4e72c5,_0x3cdc94,_0x59ae2e){if(!_[_0x5c77('0x22')](_0x3cdc94)&&intUtil[_0x5c77('0x23')](_0x3cdc94)){var _0x41a1d5={'Email':_0x3cdc94};var _0x4b09b2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x59ae2e[_0x5c77('0x20')](_0x5c77('0x24'))['find'](_0x41a1d5,_0x4b09b2)[_0x5c77('0x25')]()[_0x5c77('0x26')](function(_0x51102b){if(_0x51102b[_0x5c77('0x27')]){var _0x2d9980=_[_0x5c77('0x28')](_0x51102b,function(_0x21cca4){return _0x21cca4['Email']===_0x3cdc94;});if(_0x2d9980){logger['info'](_0x5c77('0x29'),_0x3cdc94);return BPromise[_0x5c77('0x2a')]({'id':_0x2d9980['Id'],'name':_0x2d9980['Name']});}}else{logger[_0x5c77('0x1e')](_0x5c77('0x2b'),_0x3cdc94);return _0x59ae2e['identity']()[_0x5c77('0x26')](function(_0x3b3ae4){return BPromise[_0x5c77('0x2a')]({'id':_0x3b3ae4[_0x5c77('0x2c')],'name':_0x3b3ae4[_0x5c77('0x2d')]});});}});}else{logger[_0x5c77('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3cdc94);return _0x59ae2e[_0x5c77('0x2e')]()[_0x5c77('0x26')](function(_0x61f098){return BPromise[_0x5c77('0x2a')]({'id':_0x61f098['user_id'],'name':_0x61f098['display_name']});});}}function getEndUser(_0x289a0b,_0x510cc5,_0xf96a2d,_0x49acdf,_0x4e582a){var _0x19928a={'$or':{'Phone':_0x49acdf}};var _0x401060={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x5c77('0x2a')]()[_0x5c77('0x26')](function(){logger[_0x5c77('0x1e')](_0x5c77('0x2f'),_0x49acdf,_0x510cc5[_0x5c77('0x30')]);switch(_0x510cc5[_0x5c77('0x30')]){case'contact_lead':var _0x586689=_['cloneDeep'](_0x19928a);if(_0x510cc5[_0x5c77('0x31')]){var _0x386afd={};_0x386afd[_0x510cc5['additionalSearchContact']]=_0x49acdf;_[_0x5c77('0x32')](_0x586689['$or'],_0x386afd);}return _0x4e582a[_0x5c77('0x20')](_0x5c77('0x33'))[_0x5c77('0x28')](_0x586689,_0x401060)['execute']()[_0x5c77('0x26')](function(_0x1ae049){if(_0x1ae049&&_0x1ae049[_0x5c77('0x27')]){return _0x1ae049;}else{var _0x33d21d=_[_0x5c77('0x34')](_0x19928a);if(_0x510cc5[_0x5c77('0x35')]){var _0x4b58ef={};_0x4b58ef[_0x510cc5[_0x5c77('0x35')]]=_0x49acdf;_[_0x5c77('0x32')](_0x33d21d[_0x5c77('0x36')],_0x4b58ef);}return _0x4e582a[_0x5c77('0x20')](_0x5c77('0x37'))[_0x5c77('0x28')](_0x33d21d,_0x401060);}});case _0x5c77('0x38'):var _0x2f439b=_[_0x5c77('0x34')](_0x19928a);if(_0x510cc5[_0x5c77('0x39')]){var _0x386afd={};_0x386afd[_0x510cc5[_0x5c77('0x39')]]=_0x49acdf;_[_0x5c77('0x32')](_0x2f439b[_0x5c77('0x36')],_0x386afd);}return _0x4e582a[_0x5c77('0x20')]('Account')[_0x5c77('0x28')](_0x2f439b,_0x401060)['execute']()[_0x5c77('0x26')](function(_0x90b38){if(_0x90b38&&_0x90b38[_0x5c77('0x27')]){return _0x90b38;}else{var _0x55efa9=_[_0x5c77('0x34')](_0x19928a);if(_0x510cc5[_0x5c77('0x31')]){var _0xeaa34c={};_0xeaa34c[_0x510cc5['additionalSearchContact']]=_0x49acdf;_[_0x5c77('0x32')](_0x55efa9['$or'],_0xeaa34c);}return _0x4e582a[_0x5c77('0x20')]('Contact')[_0x5c77('0x28')](_0x55efa9,_0x401060)['then'](function(_0x3407a5){if(_0x3407a5&&_0x3407a5['length']){return _0x3407a5;}else{var _0x5184a0=_[_0x5c77('0x34')](_0x19928a);if(_0x510cc5[_0x5c77('0x35')]){var _0x2c8e0e={};_0x2c8e0e[_0x510cc5[_0x5c77('0x35')]]=_0x49acdf;_[_0x5c77('0x32')](_0x5184a0[_0x5c77('0x36')],_0x2c8e0e);}return _0x4e582a['sobject'](_0x5c77('0x37'))[_0x5c77('0x28')](_0x5184a0,_0x401060);}});}});case _0x5c77('0x15'):var _0x586689=_[_0x5c77('0x34')](_0x19928a);if(_0x510cc5[_0x5c77('0x31')]){var _0x386afd={};_0x386afd[_0x510cc5['additionalSearchContact']]=_0x49acdf;_[_0x5c77('0x32')](_0x586689[_0x5c77('0x36')],_0x386afd);}return _0x4e582a['sobject'](_0x5c77('0x33'))[_0x5c77('0x28')](_0x586689,_0x401060)[_0x5c77('0x25')]();case _0x5c77('0x16'):var _0x156376=_[_0x5c77('0x34')](_0x19928a);if(_0x510cc5[_0x5c77('0x35')]){var _0x386afd={};_0x386afd[_0x510cc5[_0x5c77('0x35')]]=_0x49acdf;_[_0x5c77('0x32')](_0x156376[_0x5c77('0x36')],_0x386afd);}return _0x4e582a[_0x5c77('0x20')](_0x5c77('0x37'))[_0x5c77('0x28')](_0x156376,_0x401060);case _0x5c77('0x1b'):var _0x2f439b=_['cloneDeep'](_0x19928a);if(_0x510cc5['additionalSearchAccount']){var _0x386afd={};_0x386afd[_0x510cc5[_0x5c77('0x39')]]=_0x49acdf;_[_0x5c77('0x32')](_0x2f439b[_0x5c77('0x36')],_0x386afd);}return _0x4e582a[_0x5c77('0x20')]('Account')[_0x5c77('0x28')](_0x2f439b,_0x401060);default:return null;}})['then'](function(_0x40df00){if(_0x40df00&&_0x40df00[_0x5c77('0x27')]){var _0x5af7a5=_['first'](_0x40df00);if(_0x5af7a5){return BPromise[_0x5c77('0x2a')]({'id':_0x5af7a5['Id'],'name':_0x5af7a5[_0x5c77('0x3a')],'phone':_0x5af7a5[_0x5c77('0x3b')],'endUserType':_0x5af7a5[_0x5c77('0x3c')]['type']['toLowerCase']()});}}})[_0x5c77('0x26')](function(_0x29c424){if(_0x29c424){logger[_0x5c77('0x1e')](_0x5c77('0x3d'),_0x29c424[_0x5c77('0x14')],_0x49acdf);return BPromise['resolve'](_0x29c424);}else{logger[_0x5c77('0x1e')](_0x5c77('0x3e'),_0x49acdf);var _0x507dfc={'Phone':_0x49acdf};if(_0x510cc5[_0x5c77('0x3f')]){if(_0x510cc5[_0x5c77('0x3f')]===_0x5c77('0x15')){logger[_0x5c77('0x1e')](_0x5c77('0x40'),_0x49acdf,_0x510cc5[_0x5c77('0x3f')]);_0x507dfc['LastName']=_0xf96a2d!==_0x5c77('0x41')?_0xf96a2d:util[_0x5c77('0x42')](_0x5c77('0x43'),_0x49acdf);}else if(_0x510cc5[_0x5c77('0x3f')]===_0x5c77('0x16')){logger[_0x5c77('0x1e')](_0x5c77('0x40'),_0x49acdf,_0x510cc5['moduleCreate']);_0x507dfc[_0x5c77('0x44')]=_0xf96a2d!==''?_0xf96a2d:util[_0x5c77('0x42')](_0x5c77('0x43'),_0x49acdf);_0x507dfc['Company']=_0x5c77('0x45');}else if(_0x510cc5['moduleCreate']==='account'){logger[_0x5c77('0x1e')](_0x5c77('0x40'),_0x49acdf,_0x510cc5[_0x5c77('0x3f')]);_0x507dfc['Name']=_0xf96a2d!==''?_0xf96a2d:util[_0x5c77('0x42')](_0x5c77('0x43'),_0x49acdf);}else{return null;}}return _0x4e582a[_0x5c77('0x20')](_['upperFirst'](_0x510cc5[_0x5c77('0x3f')]))[_0x5c77('0x21')](_0x507dfc)[_0x5c77('0x26')](function(_0x10e348){return BPromise[_0x5c77('0x2a')]({'id':_0x10e348['id'],'endUserType':_0x510cc5[_0x5c77('0x3f')]});});}});}function getCustomFields(_0xf1c133,_0x304ce4){var _0x883beb={};if(_0xf1c133['length']>0x0){_['forEach'](_0xf1c133,function(_0x58e99a){if(_[_0x5c77('0x46')]([_0x5c77('0x47'),_0x5c77('0x48')],_0x58e99a['type'])&&_0x58e99a['idField']){_0x883beb[_0x58e99a[_0x5c77('0x49')]]=_0x58e99a[_0x5c77('0x4a')][_0x5c77('0x4b')]();}else if(_0x58e99a[_0x5c77('0x4c')]==='variable'&&_0x58e99a[_0x5c77('0x4d')]&&_0x58e99a[_0x5c77('0x49')]){_0x304ce4[_0x58e99a[_0x5c77('0x4d')]]&&(_0x883beb[_0x58e99a['idField']]=_0x304ce4[_0x58e99a[_0x5c77('0x4d')]][_0x5c77('0x4b')]());}else if(_0x58e99a[_0x5c77('0x4c')]===_0x5c77('0x4e')&&_0x58e99a[_0x5c77('0x4f')]&&_0x58e99a[_0x5c77('0x4f')][_0x5c77('0x50')]&&_0x58e99a[_0x5c77('0x49')]){_0x304ce4[_0x58e99a[_0x5c77('0x4f')][_0x5c77('0x50')][_0x5c77('0x51')]()]&&(_0x883beb[_0x58e99a['idField']]=_0x304ce4[_0x58e99a[_0x5c77('0x4f')][_0x5c77('0x50')]['toLowerCase']()][_0x5c77('0x4b')]());}});}return _0x883beb;}function getConnection(_0x48b060){var _0x22e738=_0x48b060[_0x5c77('0x52')][_0x5c77('0x53')](_0x48b060[_0x5c77('0x54')]);var _0xb34751=new jsforce['Connection']({'oauth2':{'loginUrl':_0x48b060['remoteUri']||'https://login.salesforce.com','clientId':_0x48b060[_0x5c77('0x55')],'clientSecret':_0x48b060[_0x5c77('0x56')]}});return _0xb34751[_0x5c77('0x57')](_0x48b060[_0x5c77('0x58')],_0x22e738)[_0x5c77('0x26')](function(){logger[_0x5c77('0x1e')](_0x5c77('0x59'));return _0xb34751;});}exports[_0x5c77('0x5a')]=function(_0x59e994,_0x232f09,_0xfdc741,_0x3c4c14,_0x2b68ac,_0x58bf04){var _0x2cc66c,_0x588ec1,_0x233d6c,_0x5e14e0;_0x58bf04[_0x5c77('0x5b')]=intUtil[_0x5c77('0x5c')](_0x58bf04['serverUrl']);_0x58bf04['remoteUri']=intUtil['stripTrailingSlash'](_0x58bf04[_0x5c77('0x5d')]);if(_0x2b68ac&&_0x2b68ac[_0x5c77('0x5e')]){logger[_0x5c77('0x1e')](_0x5c77('0x5f'),_0x5c77('0x60'));_0x232f09[_0x5c77('0x61')]=util[_0x5c77('0x42')](_0x5c77('0x62'),_0x58bf04[_0x5c77('0x5b')],_0x232f09['uniqueid'],md5(_0x232f09[_0x5c77('0x63')]));}else{_0x232f09[_0x5c77('0x61')]='';}return getConnection(_0x58bf04)[_0x5c77('0x26')](function(_0xfe818e){_0x5e14e0=_0xfe818e;return getUser(_0x58bf04,_0x3c4c14[_0x5c77('0x64')],_0x5e14e0);})['then'](function(_0x11ea8d){_0x2cc66c=_0x11ea8d;return getEndUser(_0x58bf04,_0xfdc741,_0x232f09[_0x5c77('0x65')],_0x232f09['calleridnum'],_0x5e14e0);})['then'](function(_0x1eecef){_0x588ec1=_0x1eecef;return getTicket(_0x58bf04,_0x2cc66c,_0x588ec1,_0xfdc741,_0x232f09,_0xfdc741[_0x5c77('0x66')],_0x5e14e0,'queue');})[_0x5c77('0x26')](function(_0x2b3125){_0x233d6c=_0x2b3125;logger[_0x5c77('0x1e')](_0x5c77('0x67'),_0x233d6c['id']);logger[_0x5c77('0x1e')](_0x5c77('0x68'),_0x233d6c['id'],_0x3c4c14[_0x5c77('0x50')],_0x58bf04[_0x5c77('0x4c')]);switch(_0x58bf04[_0x5c77('0x4c')]){case _0x5c77('0x69'):emit(util[_0x5c77('0x42')](_0x5c77('0x6a'),_0x3c4c14[_0x5c77('0x50')]),'trigger:salesforce:display',{'recordId':_0x233d6c['id']});break;case _0x5c77('0x6b'):emit(util[_0x5c77('0x42')](_0x5c77('0x6a'),_0x3c4c14[_0x5c77('0x50')]),_0x5c77('0x6c'),{'uri':util[_0x5c77('0x42')](_0x5c77('0x6d'),_0x5e14e0['instanceUrl'],_0x233d6c['id'])});break;default:logger[_0x5c77('0x6e')](_0x5c77('0x6f'));}})[_0x5c77('0x70')](function(_0x84d3dc){logger[_0x5c77('0x6e')](_0x5c77('0x5f'),_0x84d3dc);});};exports['outbound']=function(_0x5af2cb,_0x30efaa,_0x1943eb,_0x5e45e9,_0x511375,_0x13c44b,_0x245ba1){var _0x39dfc,_0x2089fa,_0xa109b4,_0x19d02d;_0x13c44b[_0x5c77('0x5b')]=intUtil['stripTrailingSlash'](_0x13c44b[_0x5c77('0x5b')]);_0x13c44b[_0x5c77('0x5d')]=intUtil[_0x5c77('0x5c')](_0x13c44b[_0x5c77('0x5d')]);if(_0x245ba1&&_0x245ba1[_0x5c77('0x71')]&&_0x245ba1[_0x5c77('0x71')]!==_0x5c77('0x72')){logger[_0x5c77('0x1e')](_0x5c77('0x73'),_0x5c77('0x60'));_0x30efaa['recordingURL']=util['format'](_0x5c77('0x62'),_0x13c44b['serverUrl'],_0x30efaa[_0x5c77('0x63')],md5(_0x30efaa[_0x5c77('0x63')]));}return getConnection(_0x13c44b)['then'](function(_0xea4b1){_0x19d02d=_0xea4b1;return getUser(_0x13c44b,_0x5e45e9['email'],_0x19d02d);})[_0x5c77('0x26')](function(_0x3436f0){_0x39dfc=_0x3436f0;return getEndUser(_0x13c44b,_0x1943eb,_0x30efaa[_0x5c77('0x74')],_0x30efaa['destcalleridnum'],_0x19d02d);})[_0x5c77('0x26')](function(_0x60f874){_0x2089fa=_0x60f874;return getTicket(_0x13c44b,_0x39dfc,_0x2089fa,_0x1943eb,_0x30efaa,_0x1943eb['Fields'],_0x19d02d,_0x5c77('0x75'));})[_0x5c77('0x26')](function(_0x312eb5){_0xa109b4=_0x312eb5;logger['info'](_0x5c77('0x76'),_0xa109b4['id']);logger[_0x5c77('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0xa109b4['id'],_0x5e45e9[_0x5c77('0x50')],_0x13c44b['type']);switch(_0x13c44b[_0x5c77('0x4c')]){case _0x5c77('0x69'):emit(util['format']('user:%s',_0x5e45e9[_0x5c77('0x50')]),_0x5c77('0x77'),{'recordId':_0xa109b4['id']});break;case _0x5c77('0x6b'):emit(util['format']('user:%s',_0x5e45e9['name']),_0x5c77('0x6c'),{'uri':util[_0x5c77('0x42')](_0x5c77('0x6d'),_0x19d02d['instanceUrl'],_0xa109b4['id'])});break;default:logger[_0x5c77('0x6e')](_0x5c77('0x73'),_0x5c77('0x78'));}})['catch'](function(_0x3919d7){logger[_0x5c77('0x6e')](_0x5c77('0x73'),_0x3919d7);});};exports[_0x5c77('0x79')]=function(_0x5f1f73,_0x53ec58,_0x4a0e03,_0x25d6ee,_0x8b22aa,_0x20d91a){var _0x313503,_0xd91d40,_0x5c01ae,_0x12b5ca;_0x20d91a['serverUrl']=intUtil[_0x5c77('0x5c')](_0x20d91a['serverUrl']);_0x20d91a[_0x5c77('0x5d')]=intUtil[_0x5c77('0x5c')](_0x20d91a['remoteUri']);if(_0x8b22aa&&_0x8b22aa[_0x5c77('0x5e')]){logger['info']('['+_0x53ec58[_0x5c77('0x7a')]['toUpperCase']()+']',_0x5c77('0x60'));_0x53ec58[_0x5c77('0x61')]=util['format'](_0x5c77('0x62'),_0x20d91a[_0x5c77('0x5b')],_0x53ec58[_0x5c77('0x63')],md5(_0x53ec58['uniqueid']));}else{_0x53ec58[_0x5c77('0x61')]='';}return getConnection(_0x20d91a)['then'](function(_0x4f7b69){_0x12b5ca=_0x4f7b69;if(!_['isNil'](_0x25d6ee)){return getUser(_0x20d91a,_0x25d6ee[_0x5c77('0x50')],_0x12b5ca);}else{return getUser(_0x20d91a,null,_0x12b5ca);}})[_0x5c77('0x26')](function(_0x3e9b18){_0x313503=_0x3e9b18;return getEndUser(_0x20d91a,_0x4a0e03,_0x53ec58[_0x5c77('0x65')],_0x53ec58[_0x5c77('0x7b')],_0x12b5ca);})[_0x5c77('0x26')](function(_0x79fc9e){_0xd91d40=_0x79fc9e;return getTicket(_0x20d91a,_0x313503,_0xd91d40,_0x4a0e03,_0x53ec58,_0x4a0e03[_0x5c77('0x66')],_0x12b5ca);})['then'](function(_0x74ee2){_0x5c01ae=_0x74ee2;logger[_0x5c77('0x1e')]('['+_0x53ec58[_0x5c77('0x7a')][_0x5c77('0x7c')]()+_0x5c77('0x7d'),_0x5c01ae['id']);logger[_0x5c77('0x1e')]('['+_0x53ec58[_0x5c77('0x7a')][_0x5c77('0x7c')]()+_0x5c77('0x7e'),_0x20d91a['type']);})[_0x5c77('0x70')](function(_0x2e75bf){logger['error']('['+_0x53ec58['lastevent'][_0x5c77('0x7c')]()+']',_0x2e75bf);});}; \ 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 94bf290..7e506bf 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 _0xbcee=['],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','customVariable','name','Variable','endUserId','POST','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','uniqueid','[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','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0xbcee,0xc1));var _0xebce=function(_0x149a41,_0x3cbb44){_0x149a41=_0x149a41-0x0;var _0x10132c=_0xbcee[_0x149a41];return _0x10132c;};'use strict';var _=require(_0xebce('0x0'));var Promise=require(_0xebce('0x1'));var rp=require(_0xebce('0x2'));var util=require(_0xebce('0x3'));var md5=require(_0xebce('0x4'));var Redis=require(_0xebce('0x5'));var intUtil=require('./util');var config=require(_0xebce('0x6'));var logger=require(_0xebce('0x7'))(_0xebce('0x8'));config[_0xebce('0x9')]=_[_0xebce('0xa')](config['redis'],{'host':_0xebce('0xb'),'port':0x18eb});var io=require(_0xebce('0xc'))(new Redis(config['redis']));function getAdminUser(_0x5e232b,_0x2d875f,_0x4e6935,_0x3e45a0,_0x49f6bd,_0x4561da){return new Promise(function(_0x38effd,_0x520391){var _0x3bfe37={'method':_0xebce('0xd'),'uri':_0x3e45a0+_0xebce('0xe')+'&'+_0x49f6bd+'&'+_0x4561da,'auth':_0x2d875f,'json':!![]};return rp(_0x3bfe37)[_0xebce('0xf')](function(_0x4b49c0){if(_0x4b49c0[_0xebce('0x10')]['length']>0x0){_0x4e6935[_0xebce('0x11')]=_0x4b49c0[_0xebce('0x10')][0x0][_0xebce('0x12')];}logger[_0xebce('0x13')]('['+[_0x5e232b['toUpperCase']()]+_0xebce('0x14'),_0x4e6935);_0x38effd(_0x4e6935);})[_0xebce('0x15')](function(_0x47e40d){logger[_0xebce('0x16')]('['+[_0x5e232b[_0xebce('0x17')]()]+']',_0x47e40d['message']);_0x520391(_0x47e40d[_0xebce('0x18')]);});});}function getUser(_0x50057a,_0x2605eb,_0x39a04f,_0x102edf,_0x21d681){return function(_0x4300ca){logger[_0xebce('0x13')]('['+[_0x50057a['toUpperCase']()]+_0xebce('0x19'),_0x4300ca);return new Promise(function(_0x39df06,_0x22bfe9){if(intUtil[_0xebce('0x1a')](_0x4300ca['userEmail'])){var _0x2de613={'method':'GET','uri':_0x39a04f+_0xebce('0x1b')+_0x4300ca[_0xebce('0x1c')]+'&'+_0x102edf+'&'+_0x21d681,'auth':_0x2605eb,'json':!![]};logger[_0xebce('0x13')]('['+[_0x50057a[_0xebce('0x17')]()]+_0xebce('0x1d'),_0x2de613);return rp(_0x2de613)[_0xebce('0xf')](function(_0x36b029){logger[_0xebce('0x13')]('['+[_0x50057a[_0xebce('0x17')]()]+_0xebce('0x1e'),_0x36b029);if(_0x36b029[_0xebce('0x10')]['length']>0x0&&String(_0x36b029[_0xebce('0x10')][0x0][_0xebce('0x1f')])===_0xebce('0x20')){_0x4300ca[_0xebce('0x21')]=_0x36b029[_0xebce('0x10')][0x0][_0xebce('0x12')];}else{_0x4300ca[_0xebce('0x21')]=_0x4300ca['adminId'];_0x4300ca[_0xebce('0x1c')]=_0x4300ca['adminEmail'];}logger[_0xebce('0x13')]('['+[_0x50057a[_0xebce('0x17')]()]+_0xebce('0x22'),_0x4300ca);_0x39df06(_0x4300ca);})[_0xebce('0x15')](function(_0x5f58cd){logger[_0xebce('0x16')]('['+[_0x50057a['toUpperCase']()]+']',_0x5f58cd[_0xebce('0x18')]);_0x22bfe9(_0x5f58cd[_0xebce('0x18')]);});}else{logger[_0xebce('0x13')]('['+[_0x50057a[_0xebce('0x17')]()]+_0xebce('0x23'));_0x4300ca[_0xebce('0x21')]=_0x4300ca[_0xebce('0x11')];_0x4300ca['userEmail']=_0x4300ca[_0xebce('0x24')];_0x39df06(_0x4300ca);}});};}function createEndUser(_0x5efb0f,_0x3c7ea3,_0x58c3b5,_0x133caf,_0x1528ee){logger[_0xebce('0x13')]('['+[_0x5efb0f['toUpperCase']()]+_0xebce('0x25'),_0x58c3b5);return new Promise(function(_0x16efba,_0x29d62f){var _0x12f0cb={'method':'POST','uri':_0x133caf+_0xebce('0x26')+_0x1528ee,'body':{'user_name':_0x58c3b5[_0xebce('0x27')],'roles':_0xebce('0x28'),'first_name':_0x58c3b5[_0xebce('0x27')],'active':_0xebce('0x20'),'date_format':'System','phone':_0x58c3b5[_0xebce('0x27')]},'auth':_0x3c7ea3,'json':!![]};return rp(_0x12f0cb)[_0xebce('0xf')](function(_0x4fdf8b){logger[_0xebce('0x13')]('['+[_0x5efb0f['toUpperCase']()]+_0xebce('0x29'),_0x4fdf8b[_0xebce('0x10')]);_0x58c3b5['endUserId']=_0x4fdf8b['result'][_0xebce('0x12')];_0x16efba(_0x58c3b5);})[_0xebce('0x15')](function(_0x5112f9){logger[_0xebce('0x16')]('['+[_0x5efb0f[_0xebce('0x17')]()]+']',_0x5112f9[_0xebce('0x18')]);_0x29d62f(_0x5112f9[_0xebce('0x18')]);});});}function getEndUser(_0x19c816,_0x4871d0,_0x557349,_0x12b3b0,_0x7a2d8c){return function(_0x1750eb){logger[_0xebce('0x13')]('['+[_0x19c816['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x1750eb);return new Promise(function(_0x12e3b2,_0x4237a9){var _0xa46858={'method':_0xebce('0xd'),'uri':_0x557349+_0xebce('0x2a')+_0x1750eb[_0xebce('0x27')]+'&'+_0x12b3b0+'&'+_0x7a2d8c,'auth':_0x4871d0,'json':!![]};return rp(_0xa46858)[_0xebce('0xf')](function(_0x39d9ed){if(_0x39d9ed[_0xebce('0x10')]['length']>0x0){_0x1750eb['endUserId']=_0x39d9ed[_0xebce('0x10')][0x0][_0xebce('0x12')];logger[_0xebce('0x13')]('['+[_0x19c816['toUpperCase']()]+_0xebce('0x2b'),_0x1750eb);_0x12e3b2(_0x1750eb);}else{return createEndUser(_0x19c816,_0x4871d0,_0x1750eb,_0x557349,_0x12b3b0)[_0xebce('0xf')](function(_0x2a83e7){logger['info']('['+[_0x19c816[_0xebce('0x17')]()]+_0xebce('0x2c'),_0x2a83e7);_0x12e3b2(_0x2a83e7);});}})[_0xebce('0x15')](function(_0x2dcb13){logger[_0xebce('0x16')]('['+[_0x19c816[_0xebce('0x17')]()]+']',_0x2dcb13[_0xebce('0x18')]);_0x4237a9(_0x2dcb13[_0xebce('0x18')]);});});};}function getCustomFields(_0x41aa83,_0x2b1ef4){var _0x4bfa82={};if(_0x41aa83[_0xebce('0x2d')]>0x0){_[_0xebce('0x2e')](_0x41aa83,function(_0xb48b83){if(_[_0xebce('0x2f')]([_0xebce('0x30'),_0xebce('0x31')],_0xb48b83[_0xebce('0x32')])&&_0xb48b83[_0xebce('0x33')]&&!_0xb48b83[_0xebce('0x34')]){_0x4bfa82[_0xb48b83[_0xebce('0x33')][_0xebce('0x35')]()]=_0xb48b83[_0xebce('0x36')][_0xebce('0x37')]();}else if(_[_0xebce('0x2f')]([_0xebce('0x30'),_0xebce('0x31')],_0xb48b83[_0xebce('0x32')])&&_0xb48b83[_0xebce('0x38')]&&_0xb48b83['customField']){_0x4bfa82[_0xb48b83['idField'][_0xebce('0x35')]()]=_0xb48b83[_0xebce('0x36')][_0xebce('0x37')]();}else if(_0xb48b83[_0xebce('0x32')]==='variable'&&_0xb48b83[_0xebce('0x39')]&&_0xb48b83['idField']&&_0xb48b83[_0xebce('0x34')]){_0x4bfa82[_0xb48b83[_0xebce('0x38')][_0xebce('0x35')]()]=_0x2b1ef4[_0xb48b83['variableName']][_0xebce('0x37')]();}else if(_0xb48b83[_0xebce('0x32')]===_0xebce('0x3a')&&_0xb48b83['Variable']&&_0xb48b83['Variable'][_0xebce('0x3b')]&&_0xb48b83['idField']&&_0xb48b83[_0xebce('0x34')]){_0x4bfa82[_0xb48b83[_0xebce('0x38')][_0xebce('0x35')]()]=_0x2b1ef4[_0xb48b83[_0xebce('0x3c')][_0xebce('0x3b')][_0xebce('0x35')]()][_0xebce('0x37')]();}});}return _0x4bfa82;}function getTicket(_0x3e15c3,_0x166b99,_0x528f21,_0x5f481f,_0x216fc3,_0xb30863){return function(_0x514c5a){logger[_0xebce('0x13')]('['+[_0x3e15c3[_0xebce('0x17')]()]+']\x20getTicket\x20input\x20crm',_0x514c5a);return new Promise(function(_0x9ba69,_0x5da15f){var _0x16c73e=_0x3e15c3[_0xebce('0x35')]()==='outbound'?_0x514c5a[_0xebce('0x21')]:_0x514c5a[_0xebce('0x3d')];var _0x3b1e28={'method':_0xebce('0x3e'),'uri':_0x528f21+_0xebce('0x3f')+'?'+_0xb30863,'body':Object[_0xebce('0x40')]({},{'active':_0xebce('0x20'),'caller_id':_0x16c73e,'assigned_to':_0x514c5a[_0xebce('0x21')],'short_description':intUtil[_0xebce('0x41')](_0x5f481f[_0xebce('0x42')],_0x216fc3,'\x20'),'description':intUtil['getString'](_0x5f481f[_0xebce('0x43')],_0x216fc3,'\x0a')},getCustomFields(_0x5f481f[_0xebce('0x44')],_0x216fc3)),'auth':_0x166b99,'json':!![]};return rp(_0x3b1e28)[_0xebce('0xf')](function(_0x13e627){logger[_0xebce('0x13')]('['+[_0x3e15c3[_0xebce('0x17')]()]+_0xebce('0x45'),_0x13e627[_0xebce('0x10')]);_0x514c5a[_0xebce('0x46')]=_0x13e627[_0xebce('0x10')]['sys_id'];_0x514c5a[_0xebce('0x47')]=_0x13e627['result'][_0xebce('0x48')];logger[_0xebce('0x13')]('['+[_0x3e15c3[_0xebce('0x17')]()]+_0xebce('0x49'),_0x514c5a);_0x9ba69(_0x514c5a);})[_0xebce('0x15')](function(_0x580eef){logger[_0xebce('0x16')]('['+[_0x3e15c3[_0xebce('0x17')]()]+']',_0x580eef[_0xebce('0x18')]);_0x5da15f(_0x580eef['message']);});});};}function createRemoteTag(_0x52e2d1,_0x5b1132,_0x379364,_0x4f5900){return new Promise(function(_0x3fffd8,_0x6b87b8){var _0x337633={'method':_0xebce('0x3e'),'uri':_0x379364+_0xebce('0x4a')+'?'+_0x4f5900,'body':{'short_description':_0x52e2d1,'global':!![],'active':!![],'name':_0x52e2d1},'auth':_0x5b1132,'json':!![]};return rp(_0x337633)['then'](function(_0x36d90a){var _0x5f5974=_0x36d90a[_0xebce('0x10')][_0xebce('0x12')];_0x3fffd8(_0x5f5974);});});}function getRemoteTag(_0x37d60c,_0x13508a,_0x57b424,_0x5c45b3,_0x45ae77){return new Promise(function(_0x2d9656,_0x29d8ad){var _0x1323d6={'method':_0xebce('0xd'),'uri':_0x57b424+_0xebce('0x4a')+_0xebce('0x4b')+_0x37d60c+'&'+_0x5c45b3,'auth':_0x13508a,'json':!![]};return rp(_0x1323d6)[_0xebce('0xf')](function(_0x351e6b){if(_0x351e6b['result'][_0xebce('0x2d')]>0x0){var _0x3d4055=_0x351e6b[_0xebce('0x10')][0x0]['sys_id'];_0x2d9656(_0x3d4055);}else{return createRemoteTag(_0x37d60c,_0x13508a,_0x57b424,_0x5c45b3)[_0xebce('0xf')](function(_0x5c2809){_0x2d9656(_0x5c2809);});}});});}function assignTagToIncident(_0x1009d7,_0x1f3c6b,_0x2c91ab,_0x8b3db4,_0x2caa68){return new Promise(function(_0xb051dd,_0x4de504){var _0x548569={'method':_0xebce('0x3e'),'uri':_0x2c91ab+_0xebce('0x4c')+'?'+_0x2caa68,'body':{'label':_0x1009d7,'table':_0xebce('0x3f'),'id_type':_0xebce('0x4d'),'table_key':_0x8b3db4[_0xebce('0x46')],'title':_0xebce('0x4e')+_0x8b3db4[_0xebce('0x47')],'id_display':_0x8b3db4[_0xebce('0x47')]},'auth':_0x1f3c6b,'json':!![]};return rp(_0x548569)['then'](function(_0x23744e){_0xb051dd();})[_0xebce('0x15')](function(){_0xb051dd();});});}function manageTags(_0xcac449,_0x38125a,_0x56cc68,_0x57576c,_0x21fb75,_0x378eaf,_0x21e906){return new Promise(function(_0x327fe3,_0x321618){var _0x1b9d29=[];_0x38125a[_0xebce('0x2e')](function(_0xf62318){_0x1b9d29['push'](getRemoteTag(_0xf62318,_0x56cc68,_0x57576c,_0x378eaf,_0x21e906));});return Promise['all'](_0x1b9d29)[_0xebce('0xf')](function(_0x4ece52){if(_0x4ece52[_0xebce('0x2d')]){logger[_0xebce('0x13')]('['+[_0xcac449[_0xebce('0x17')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4ece52);var _0x40ea29=[];_0x4ece52[_0xebce('0x2e')](function(_0x16d3dc){_0x40ea29[_0xebce('0x4f')](assignTagToIncident(_0x16d3dc,_0x56cc68,_0x57576c,_0x21fb75,_0x378eaf));});return Promise[_0xebce('0x50')](_0x40ea29)[_0xebce('0xf')](function(){_0x327fe3();})[_0xebce('0x15')](function(){_0x327fe3();});}else{_0x327fe3();}});});}function getTags(_0x495b60,_0x4f7cc3,_0x1fd367,_0x59a703,_0x1f790a,_0x101460){return function(_0x2906b6){return new Promise(function(_0x54c98b,_0xc5c427){var _0x5f37cd=[];var _0xa962bf=_0x59a703[_0xebce('0x51')];if(_0xa962bf&&_0xa962bf[_0xebce('0x2d')]>0x0){_0x5f37cd=_['map'](_0xa962bf,_0xebce('0x3b'));}if(_0x5f37cd['length']>0x0){return manageTags(_0x495b60,_0x5f37cd,_0x4f7cc3,_0x1fd367,_0x2906b6,_0x1f790a,_0x101460)[_0xebce('0xf')](function(){_0x54c98b(_0x2906b6);});}else{_0x54c98b(_0x2906b6);}});};}function emit(_0x74bc22,_0x315e4e,_0x145316){var _0x8bfd01=_0xebce('0x52')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xebce('0x53')+_0xebce('0x54');var _0x5ea450={'uri':_0x74bc22+_0xebce('0x55')+_0x145316+_0x8bfd01};io['to'](util[_0xebce('0x56')](_0xebce('0x57'),_0x315e4e))[_0xebce('0x58')](_0xebce('0x59'),_0x5ea450);}exports['cs']=function(_0x470075,_0x29bf4c,_0x490b13,_0x4fbad4,_0x767f34,_0x863815,_0x353e75,_0xbf3b31){var _0x37d45b={};var _0x4d58ac={'user':_0x863815[_0xebce('0x5a')],'pass':_0x863815['password']};var _0x539fc4=_0xebce('0x5b');var _0x2055d6='sysparm_display_value=true';_0x863815[_0xebce('0x5c')]=intUtil[_0xebce('0x5d')](_0x863815[_0xebce('0x5c')]);_0x863815[_0xebce('0x5e')]=intUtil[_0xebce('0x5d')](_0x863815['serverUrl']);var _0x33af9c=util[_0xebce('0x56')](_0xebce('0x5f'),_0x863815['remoteUri']);_0x37d45b[_0xebce('0x1c')]=!_[_0xebce('0x60')](_0x4fbad4)?_0x4fbad4[_0xebce('0x61')]:null;_0x37d45b[_0xebce('0x24')]=_0x863815[_0xebce('0x61')];_0x37d45b[_0xebce('0x27')]=_0xbf3b31[_0xebce('0x35')]()==='outbound'?_0x29bf4c[_0xebce('0x62')]:_0x29bf4c[_0xebce('0x63')];_0x37d45b[_0xebce('0x64')]=_0xbf3b31==='queue'||_0xbf3b31===_0xebce('0x65')?_0xebce('0x66'):'outbound';var _0x3cc6b5=util[_0xebce('0x56')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x863815['serverUrl'],_0x29bf4c[_0xebce('0x67')],md5(_0x29bf4c['uniqueid']));if(_0x767f34&&_0x767f34['monitor_format']){logger[_0xebce('0x13')](_0xebce('0x68'),_0xebce('0x69'));_0x29bf4c[_0xebce('0x6a')]=_0x3cc6b5;}else if(_0x353e75&&_0x353e75[_0xebce('0x6b')]&&_0x353e75[_0xebce('0x6b')]!==_0xebce('0x6c')){logger[_0xebce('0x13')](_0xebce('0x6d'),_0xebce('0x69'));_0x29bf4c[_0xebce('0x6a')]=_0x3cc6b5;}else{_0x29bf4c[_0xebce('0x6a')]='';}return getAdminUser(_0xbf3b31,_0x4d58ac,_0x37d45b,_0x33af9c,_0x2055d6,_0x539fc4)['then'](getUser(_0xbf3b31,_0x4d58ac,_0x33af9c,_0x2055d6,_0x539fc4))['then'](getEndUser(_0xbf3b31,_0x4d58ac,_0x33af9c,_0x2055d6,_0x539fc4))[_0xebce('0xf')](getTicket(_0xbf3b31,_0x4d58ac,_0x33af9c,_0x490b13,_0x29bf4c,_0x2055d6))[_0xebce('0xf')](function(_0x2745b6){logger[_0xebce('0x13')](util[_0xebce('0x56')](_0xebce('0x6e'),_0x2745b6['ticketId']));logger['info'](util['format'](_0xebce('0x6f'),_0xbf3b31));if(_0xbf3b31!==_0xebce('0x65')){logger['info']('['+[_0xbf3b31[_0xebce('0x17')]()]+']',_0xebce('0x70'));emit(_0x863815['remoteUri'],_0x4fbad4['name'],_0x2745b6[_0xebce('0x46')]);}})[_0xebce('0x15')](function(_0x3fb641){logger[_0xebce('0x16')]('['+[_0xbf3b31[_0xebce('0x17')]()]+_0xebce('0x71'),util[_0xebce('0x72')](_0x3fb641,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xfc15=[']\x20getTicket\x20crm','label','label_entry','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','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','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','localhost','socket.io-emitter','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','userEmail','sys_user?sysparm_query=email%3D','toUpperCase','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','result','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','idField','toString','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xfc15,0xf3));var _0x5fc1=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xfc15[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x5fc1('0x0'));var Promise=require('bluebird');var rp=require(_0x5fc1('0x1'));var util=require(_0x5fc1('0x2'));var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0x5fc1('0x3'));var config=require(_0x5fc1('0x4'));var logger=require(_0x5fc1('0x5'))(_0x5fc1('0x6'));config['redis']=_[_0x5fc1('0x7')](config['redis'],{'host':_0x5fc1('0x8'),'port':0x18eb});var io=require(_0x5fc1('0x9'))(new Redis(config[_0x5fc1('0xa')]));function getAdminUser(_0x488fe0,_0x5b1254,_0x2b025c,_0x2fcfd4,_0x2124cb,_0x18c65d){return new Promise(function(_0xa853fb,_0x2038ab){var _0xc16571={'method':_0x5fc1('0xb'),'uri':_0x2fcfd4+_0x5fc1('0xc')+'&'+_0x2124cb+'&'+_0x18c65d,'auth':_0x5b1254,'json':!![]};return rp(_0xc16571)['then'](function(_0x5e8064){if(_0x5e8064['result'][_0x5fc1('0xd')]>0x0){_0x2b025c[_0x5fc1('0xe')]=_0x5e8064['result'][0x0][_0x5fc1('0xf')];}logger[_0x5fc1('0x10')]('['+[_0x488fe0['toUpperCase']()]+_0x5fc1('0x11'),_0x2b025c);_0xa853fb(_0x2b025c);})[_0x5fc1('0x12')](function(_0x340f37){logger[_0x5fc1('0x13')]('['+[_0x488fe0['toUpperCase']()]+']',_0x340f37['message']);_0x2038ab(_0x340f37[_0x5fc1('0x14')]);});});}function getUser(_0xdda755,_0x2e5c4d,_0xf8a7df,_0x1e5ca6,_0x28b2d0){return function(_0x43f9c5){logger[_0x5fc1('0x10')]('['+[_0xdda755['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x43f9c5);return new Promise(function(_0x5573b9,_0x224c10){if(intUtil['validateEmail'](_0x43f9c5[_0x5fc1('0x15')])){var _0x2d7aa0={'method':'GET','uri':_0xf8a7df+_0x5fc1('0x16')+_0x43f9c5[_0x5fc1('0x15')]+'&'+_0x1e5ca6+'&'+_0x28b2d0,'auth':_0x2e5c4d,'json':!![]};logger['info']('['+[_0xdda755[_0x5fc1('0x17')]()]+_0x5fc1('0x18'),_0x2d7aa0);return rp(_0x2d7aa0)[_0x5fc1('0x19')](function(_0x1e8d5c){logger[_0x5fc1('0x10')]('['+[_0xdda755[_0x5fc1('0x17')]()]+_0x5fc1('0x1a'),_0x1e8d5c);if(_0x1e8d5c['result'][_0x5fc1('0xd')]>0x0&&String(_0x1e8d5c[_0x5fc1('0x1b')][0x0][_0x5fc1('0x1c')])===_0x5fc1('0x1d')){_0x43f9c5[_0x5fc1('0x1e')]=_0x1e8d5c[_0x5fc1('0x1b')][0x0][_0x5fc1('0xf')];}else{_0x43f9c5[_0x5fc1('0x1e')]=_0x43f9c5[_0x5fc1('0xe')];_0x43f9c5[_0x5fc1('0x15')]=_0x43f9c5[_0x5fc1('0x1f')];}logger[_0x5fc1('0x10')]('['+[_0xdda755[_0x5fc1('0x17')]()]+_0x5fc1('0x20'),_0x43f9c5);_0x5573b9(_0x43f9c5);})[_0x5fc1('0x12')](function(_0x3ef126){logger['error']('['+[_0xdda755['toUpperCase']()]+']',_0x3ef126[_0x5fc1('0x14')]);_0x224c10(_0x3ef126[_0x5fc1('0x14')]);});}else{logger[_0x5fc1('0x10')]('['+[_0xdda755[_0x5fc1('0x17')]()]+_0x5fc1('0x21'));_0x43f9c5[_0x5fc1('0x1e')]=_0x43f9c5[_0x5fc1('0xe')];_0x43f9c5[_0x5fc1('0x15')]=_0x43f9c5[_0x5fc1('0x1f')];_0x5573b9(_0x43f9c5);}});};}function createEndUser(_0x1092dd,_0x2e50f6,_0x10de1a,_0x310541,_0x3fd3e1){logger[_0x5fc1('0x10')]('['+[_0x1092dd[_0x5fc1('0x17')]()]+'],\x20createEndUser\x20input\x20crm',_0x10de1a);return new Promise(function(_0x423636,_0x168a2a){var _0x4e16ac={'method':_0x5fc1('0x22'),'uri':_0x310541+_0x5fc1('0x23')+_0x3fd3e1,'body':{'user_name':_0x10de1a[_0x5fc1('0x24')],'roles':'user','first_name':_0x10de1a['endUserNumber'],'active':_0x5fc1('0x1d'),'date_format':'System','phone':_0x10de1a[_0x5fc1('0x24')]},'auth':_0x2e50f6,'json':!![]};return rp(_0x4e16ac)[_0x5fc1('0x19')](function(_0x2e83ae){logger[_0x5fc1('0x10')]('['+[_0x1092dd['toUpperCase']()]+_0x5fc1('0x25'),_0x2e83ae[_0x5fc1('0x1b')]);_0x10de1a[_0x5fc1('0x26')]=_0x2e83ae['result'][_0x5fc1('0xf')];_0x423636(_0x10de1a);})[_0x5fc1('0x12')](function(_0x506f7c){logger[_0x5fc1('0x13')]('['+[_0x1092dd[_0x5fc1('0x17')]()]+']',_0x506f7c[_0x5fc1('0x14')]);_0x168a2a(_0x506f7c[_0x5fc1('0x14')]);});});}function getEndUser(_0x4fd804,_0x2b844b,_0x425c88,_0x58c0a9,_0x3c552f){return function(_0x467006){logger[_0x5fc1('0x10')]('['+[_0x4fd804[_0x5fc1('0x17')]()]+_0x5fc1('0x27'),_0x467006);return new Promise(function(_0x2e77f0,_0x105b5c){var _0x1fd75={'method':_0x5fc1('0xb'),'uri':_0x425c88+'sys_user?sysparm_query=phone%3D'+_0x467006[_0x5fc1('0x24')]+'&'+_0x58c0a9+'&'+_0x3c552f,'auth':_0x2b844b,'json':!![]};return rp(_0x1fd75)[_0x5fc1('0x19')](function(_0x1c2ce6){if(_0x1c2ce6[_0x5fc1('0x1b')][_0x5fc1('0xd')]>0x0){_0x467006[_0x5fc1('0x26')]=_0x1c2ce6[_0x5fc1('0x1b')][0x0]['sys_id'];logger['info']('['+[_0x4fd804[_0x5fc1('0x17')]()]+_0x5fc1('0x28'),_0x467006);_0x2e77f0(_0x467006);}else{return createEndUser(_0x4fd804,_0x2b844b,_0x467006,_0x425c88,_0x58c0a9)['then'](function(_0x1efcaf){logger[_0x5fc1('0x10')]('['+[_0x4fd804[_0x5fc1('0x17')]()]+_0x5fc1('0x29'),_0x1efcaf);_0x2e77f0(_0x1efcaf);});}})[_0x5fc1('0x12')](function(_0x20d7dc){logger['error']('['+[_0x4fd804[_0x5fc1('0x17')]()]+']',_0x20d7dc[_0x5fc1('0x14')]);_0x105b5c(_0x20d7dc[_0x5fc1('0x14')]);});});};}function getCustomFields(_0x3a5b7b,_0x13b0d6){var _0x1646f0={};if(_0x3a5b7b['length']>0x0){_[_0x5fc1('0x2a')](_0x3a5b7b,function(_0x32450f){if(_[_0x5fc1('0x2b')]([_0x5fc1('0x2c'),_0x5fc1('0x2d')],_0x32450f[_0x5fc1('0x2e')])&&_0x32450f[_0x5fc1('0x2f')]&&!_0x32450f[_0x5fc1('0x30')]){_0x1646f0[_0x32450f[_0x5fc1('0x2f')][_0x5fc1('0x31')]()]=_0x32450f['content']['toString']();}else if(_['includes']([_0x5fc1('0x2c'),_0x5fc1('0x2d')],_0x32450f[_0x5fc1('0x2e')])&&_0x32450f[_0x5fc1('0x32')]&&_0x32450f[_0x5fc1('0x30')]){_0x1646f0[_0x32450f[_0x5fc1('0x32')][_0x5fc1('0x31')]()]=_0x32450f['content'][_0x5fc1('0x33')]();}else if(_0x32450f[_0x5fc1('0x2e')]==='variable'&&_0x32450f[_0x5fc1('0x34')]&&_0x32450f[_0x5fc1('0x32')]&&_0x32450f[_0x5fc1('0x30')]){_0x1646f0[_0x32450f[_0x5fc1('0x32')][_0x5fc1('0x31')]()]=_0x13b0d6[_0x32450f[_0x5fc1('0x34')]][_0x5fc1('0x33')]();}else if(_0x32450f[_0x5fc1('0x2e')]==='customVariable'&&_0x32450f[_0x5fc1('0x35')]&&_0x32450f['Variable'][_0x5fc1('0x36')]&&_0x32450f['idField']&&_0x32450f[_0x5fc1('0x30')]){_0x1646f0[_0x32450f[_0x5fc1('0x32')][_0x5fc1('0x31')]()]=_0x13b0d6[_0x32450f['Variable']['name'][_0x5fc1('0x31')]()][_0x5fc1('0x33')]();}});}return _0x1646f0;}function getTicket(_0x2f8b24,_0x3755f3,_0x14db55,_0x468c0d,_0x23c525,_0x3e926e){return function(_0x572490){logger[_0x5fc1('0x10')]('['+[_0x2f8b24[_0x5fc1('0x17')]()]+_0x5fc1('0x37'),_0x572490);return new Promise(function(_0x1f11cf,_0x13a714){var _0xd1aeb3=_0x2f8b24['toLowerCase']()===_0x5fc1('0x38')?_0x572490[_0x5fc1('0x1e')]:_0x572490[_0x5fc1('0x26')];var _0x1f3415={'method':'POST','uri':_0x14db55+_0x5fc1('0x39')+'?'+_0x3e926e,'body':Object['assign']({},{'active':'true','caller_id':_0xd1aeb3,'assigned_to':_0x572490[_0x5fc1('0x1e')],'short_description':intUtil[_0x5fc1('0x3a')](_0x468c0d[_0x5fc1('0x3b')],_0x23c525,'\x20'),'description':intUtil[_0x5fc1('0x3a')](_0x468c0d[_0x5fc1('0x3c')],_0x23c525,'\x0a')},getCustomFields(_0x468c0d['Fields'],_0x23c525)),'auth':_0x3755f3,'json':!![]};return rp(_0x1f3415)['then'](function(_0x18112a){logger['info']('['+[_0x2f8b24[_0x5fc1('0x17')]()]+_0x5fc1('0x3d'),_0x18112a[_0x5fc1('0x1b')]);_0x572490[_0x5fc1('0x3e')]=_0x18112a['result'][_0x5fc1('0xf')];_0x572490['ticketNumber']=_0x18112a[_0x5fc1('0x1b')]['number'];logger[_0x5fc1('0x10')]('['+[_0x2f8b24['toUpperCase']()]+_0x5fc1('0x3f'),_0x572490);_0x1f11cf(_0x572490);})[_0x5fc1('0x12')](function(_0x3c5887){logger[_0x5fc1('0x13')]('['+[_0x2f8b24['toUpperCase']()]+']',_0x3c5887[_0x5fc1('0x14')]);_0x13a714(_0x3c5887[_0x5fc1('0x14')]);});});};}function createRemoteTag(_0x57480c,_0x103982,_0xda3bec,_0x2fd97f){return new Promise(function(_0x52bab1,_0x149116){var _0x13d071={'method':_0x5fc1('0x22'),'uri':_0xda3bec+'label'+'?'+_0x2fd97f,'body':{'short_description':_0x57480c,'global':!![],'active':!![],'name':_0x57480c},'auth':_0x103982,'json':!![]};return rp(_0x13d071)[_0x5fc1('0x19')](function(_0x240aee){var _0x5e89eb=_0x240aee[_0x5fc1('0x1b')][_0x5fc1('0xf')];_0x52bab1(_0x5e89eb);});});}function getRemoteTag(_0x3593e2,_0x2ae726,_0x108ce2,_0x2207ed,_0x2ada13){return new Promise(function(_0x4da82d,_0x59d9fa){var _0x36dfb4={'method':_0x5fc1('0xb'),'uri':_0x108ce2+_0x5fc1('0x40')+'?sysparm_query=name%3D'+_0x3593e2+'&'+_0x2207ed,'auth':_0x2ae726,'json':!![]};return rp(_0x36dfb4)['then'](function(_0x431187){if(_0x431187[_0x5fc1('0x1b')]['length']>0x0){var _0x3e6e71=_0x431187[_0x5fc1('0x1b')][0x0][_0x5fc1('0xf')];_0x4da82d(_0x3e6e71);}else{return createRemoteTag(_0x3593e2,_0x2ae726,_0x108ce2,_0x2207ed)['then'](function(_0x3d98f3){_0x4da82d(_0x3d98f3);});}});});}function assignTagToIncident(_0x35f629,_0x30136c,_0x3bfdc4,_0x4db143,_0x2086bc){return new Promise(function(_0x57899d,_0x1ef96e){var _0x573f31={'method':_0x5fc1('0x22'),'uri':_0x3bfdc4+_0x5fc1('0x41')+'?'+_0x2086bc,'body':{'label':_0x35f629,'table':_0x5fc1('0x39'),'id_type':'Incident','table_key':_0x4db143[_0x5fc1('0x3e')],'title':_0x5fc1('0x42')+_0x4db143['ticketNumber'],'id_display':_0x4db143['ticketNumber']},'auth':_0x30136c,'json':!![]};return rp(_0x573f31)[_0x5fc1('0x19')](function(_0x8156ab){_0x57899d();})[_0x5fc1('0x12')](function(){_0x57899d();});});}function manageTags(_0x48bce6,_0x32c5a1,_0x251030,_0x177384,_0x55be84,_0x433096,_0x2f2f2c){return new Promise(function(_0x4a0442,_0x563d00){var _0x4c5bd6=[];_0x32c5a1['forEach'](function(_0x264e2c){_0x4c5bd6[_0x5fc1('0x43')](getRemoteTag(_0x264e2c,_0x251030,_0x177384,_0x433096,_0x2f2f2c));});return Promise['all'](_0x4c5bd6)[_0x5fc1('0x19')](function(_0x131a49){if(_0x131a49[_0x5fc1('0xd')]){logger[_0x5fc1('0x10')]('['+[_0x48bce6[_0x5fc1('0x17')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x131a49);var _0xe849b0=[];_0x131a49[_0x5fc1('0x2a')](function(_0x462b76){_0xe849b0[_0x5fc1('0x43')](assignTagToIncident(_0x462b76,_0x251030,_0x177384,_0x55be84,_0x433096));});return Promise[_0x5fc1('0x44')](_0xe849b0)['then'](function(){_0x4a0442();})[_0x5fc1('0x12')](function(){_0x4a0442();});}else{_0x4a0442();}});});}function getTags(_0x3fe37c,_0x2048a5,_0x53885e,_0x53d45d,_0x8c21e7,_0x3b8842){return function(_0x302003){return new Promise(function(_0x26dd66,_0x53f778){var _0x4c5d38=[];var _0x170950=_0x53d45d[_0x5fc1('0x45')];if(_0x170950&&_0x170950[_0x5fc1('0xd')]>0x0){_0x4c5d38=_[_0x5fc1('0x46')](_0x170950,'name');}if(_0x4c5d38['length']>0x0){return manageTags(_0x3fe37c,_0x4c5d38,_0x2048a5,_0x53885e,_0x302003,_0x8c21e7,_0x3b8842)['then'](function(){_0x26dd66(_0x302003);});}else{_0x26dd66(_0x302003);}});};}function emit(_0x103e30,_0x2b21d1,_0x52b04c){var _0x331f1a=_0x5fc1('0x47')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x5fc1('0x48');var _0xf5ed01={'uri':_0x103e30+_0x5fc1('0x49')+_0x52b04c+_0x331f1a};io['to'](util[_0x5fc1('0x4a')](_0x5fc1('0x4b'),_0x2b21d1))['emit'](_0x5fc1('0x4c'),_0xf5ed01);}exports['cs']=function(_0x13a1f7,_0x10bf58,_0x1f3fb0,_0x2ee4e3,_0x5e71be,_0x21d3f2,_0x164e86,_0x187482){var _0x3ede52={};var _0x2ed274={'user':_0x21d3f2[_0x5fc1('0x4d')],'pass':_0x21d3f2[_0x5fc1('0x4e')]};var _0x2286d3=_0x5fc1('0x4f');var _0x11eeac='sysparm_display_value=true';_0x21d3f2[_0x5fc1('0x50')]=intUtil[_0x5fc1('0x51')](_0x21d3f2[_0x5fc1('0x50')]);_0x21d3f2[_0x5fc1('0x52')]=intUtil[_0x5fc1('0x51')](_0x21d3f2[_0x5fc1('0x52')]);var _0x51574c=util[_0x5fc1('0x4a')]('%s/api/now/table/',_0x21d3f2['remoteUri']);_0x3ede52[_0x5fc1('0x15')]=!_[_0x5fc1('0x53')](_0x2ee4e3)?_0x2ee4e3['email']:null;_0x3ede52[_0x5fc1('0x1f')]=_0x21d3f2[_0x5fc1('0x54')];_0x3ede52[_0x5fc1('0x24')]=_0x187482[_0x5fc1('0x31')]()===_0x5fc1('0x38')?_0x10bf58[_0x5fc1('0x55')]:_0x10bf58[_0x5fc1('0x56')];_0x3ede52[_0x5fc1('0x57')]=_0x187482===_0x5fc1('0x58')||_0x187482===_0x5fc1('0x59')?_0x5fc1('0x58'):_0x5fc1('0x38');var _0x2fa91b=util[_0x5fc1('0x4a')](_0x5fc1('0x5a'),_0x21d3f2[_0x5fc1('0x52')],_0x10bf58[_0x5fc1('0x5b')],md5(_0x10bf58[_0x5fc1('0x5b')]));if(_0x5e71be&&_0x5e71be[_0x5fc1('0x5c')]){logger[_0x5fc1('0x10')](_0x5fc1('0x5d'),_0x5fc1('0x5e'));_0x10bf58[_0x5fc1('0x5f')]=_0x2fa91b;}else if(_0x164e86&&_0x164e86[_0x5fc1('0x60')]&&_0x164e86[_0x5fc1('0x60')]!==_0x5fc1('0x61')){logger[_0x5fc1('0x10')]('[OUTBOUND]',_0x5fc1('0x5e'));_0x10bf58[_0x5fc1('0x5f')]=_0x2fa91b;}else{_0x10bf58['recordingURL']='';}return getAdminUser(_0x187482,_0x2ed274,_0x3ede52,_0x51574c,_0x11eeac,_0x2286d3)[_0x5fc1('0x19')](getUser(_0x187482,_0x2ed274,_0x51574c,_0x11eeac,_0x2286d3))[_0x5fc1('0x19')](getEndUser(_0x187482,_0x2ed274,_0x51574c,_0x11eeac,_0x2286d3))[_0x5fc1('0x19')](getTicket(_0x187482,_0x2ed274,_0x51574c,_0x1f3fb0,_0x10bf58,_0x11eeac))[_0x5fc1('0x19')](function(_0x9f7ab4){logger[_0x5fc1('0x10')](util[_0x5fc1('0x4a')](_0x5fc1('0x62'),_0x9f7ab4['ticketId']));logger['info'](util[_0x5fc1('0x4a')](_0x5fc1('0x63'),_0x187482));if(_0x187482!==_0x5fc1('0x59')){logger['info']('['+[_0x187482['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x21d3f2[_0x5fc1('0x50')],_0x2ee4e3['name'],_0x9f7ab4['ticketId']);}})[_0x5fc1('0x12')](function(_0x1e841e){logger['error']('['+[_0x187482[_0x5fc1('0x17')]()]+_0x5fc1('0x64'),util[_0x5fc1('0x65')](_0x1e841e,{'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 e4e9d82..7a98623 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 _0x59e3=['nameField','customField','toLowerCase','content','custom_fields','toString','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','Outbound','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','Inbound','The\x20Ticket\x20ID\x20is:','lastevent','request-promise','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','socket.io-emitter','POST','emit','info','name','getString','Subjects','created_by','description','Descriptions','date_start','toISOString','slice','duration_hours','parent_id','Contacts','parent_name','direction','length','forEach','variableName','push','idField','JSON','format','Basic\x20%s','apiKey','get_server_info','stringify','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','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','phone_home','Enduser\x20found!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','type'];(function(_0x3e338e,_0x2b78a6){var _0x2921fc=function(_0x110ad5){while(--_0x110ad5){_0x3e338e['push'](_0x3e338e['shift']());}};_0x2921fc(++_0x2b78a6);}(_0x59e3,0xb2));var _0x359e=function(_0x36d9a1,_0x396a6b){_0x36d9a1=_0x36d9a1-0x0;var _0x40a8a6=_0x59e3[_0x36d9a1];return _0x40a8a6;};'use strict';var _=require('lodash');var rp=require(_0x359e('0x0'));var BPromise=require(_0x359e('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x359e('0x2'));var intUtil=require(_0x359e('0x3'));var config=require(_0x359e('0x4'));var logger=require(_0x359e('0x5'))(_0x359e('0x6'));config['redis']=_['defaults'](config[_0x359e('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x359e('0x8'))(new Redis(config[_0x359e('0x7')]));var def={'method':_0x359e('0x9'),'json':!![]};function emit(_0x3ca9db,_0x5503b6,_0x5b4fef){io['to'](_0x3ca9db)[_0x359e('0xa')](_0x5503b6,_0x5b4fef);}function getTicket(_0x3858a2,_0x5c4084,_0x46f109,_0x54e4c4,_0x595858,_0x2f6f00,_0x36cdbe,_0x5dbf67){logger[_0x359e('0xb')]('Creating\x20new\x20ticket...');var _0x4869e9=new Date();var _0x2d4cfc=[{'name':_0x359e('0xc'),'value':intUtil[_0x359e('0xd')](_0x54e4c4[_0x359e('0xe')],_0x595858,'\x20')},{'name':'assigned_user_id','value':_0x5c4084['id']},{'name':_0x359e('0xf'),'value':_0x5c4084['id']},{'name':_0x359e('0x10'),'value':intUtil[_0x359e('0xd')](_0x54e4c4[_0x359e('0x11')],_0x595858,'\x0a')},{'name':_0x359e('0x12'),'value':_0x4869e9[_0x359e('0x13')]()[_0x359e('0x14')](0x0,0x13)['replace']('T','\x20')},{'name':_0x359e('0x15'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x359e('0x16'),'value':_0x46f109['id']},{'name':'parent_type','value':_0x359e('0x17')},{'name':_0x359e('0x18'),'value':_0x46f109['name']},{'name':_0x359e('0x19'),'value':_0x5dbf67}];if(_0x2f6f00[_0x359e('0x1a')]){_[_0x359e('0x1b')](_0x2f6f00,function(_0x4a8bf5){if(_0x595858[_0x4a8bf5[_0x359e('0x1c')]]){_0x2d4cfc[_0x359e('0x1d')]({'name':_0x4a8bf5[_0x359e('0x1e')],'value':_0x595858[_0x4a8bf5[_0x359e('0x1c')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x359e('0x1f'),'response_type':_0x359e('0x1f'),'rest_data':JSON['stringify']({'session':_0x36cdbe['id'],'module_name':'Calls','name_value_list':_0x2d4cfc})}});}function getAuth(_0x4f8e79){return util[_0x359e('0x20')](_0x359e('0x21'),new Buffer(_0x4f8e79[_0x359e('0x22')]+':X')['toString']('base64'));}function getServerInfo(_0x3d3a35){return request({'form':{'method':_0x359e('0x23'),'input_type':_0x359e('0x1f'),'response_type':_0x359e('0x1f'),'rest_data':JSON[_0x359e('0x24')]({'session':_0x3d3a35['id']})}});}function getUser(_0x3fe1c1,_0x4f18bd,_0x214d77){if(!_[_0x359e('0x25')](_0x4f18bd)){logger['info'](_0x359e('0x26'),_0x4f18bd);return request({'form':{'method':_0x359e('0x27'),'input_type':_0x359e('0x1f'),'response_type':_0x359e('0x1f'),'rest_data':JSON[_0x359e('0x24')]({'session':_0x214d77['id'],'module_name':_0x359e('0x28'),'query':util[_0x359e('0x20')](_0x359e('0x29'),_0x4f18bd),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x359e('0x2a')](function(_0x3fd262){if(_0x3fd262[_0x359e('0x2b')][_0x359e('0x1a')]){var _0x41b56c=_['find'](_0x3fd262[_0x359e('0x2b')],function(_0x1c5750){return _0x1c5750[_0x359e('0x2c')][_0x359e('0x2d')][_0x359e('0x2e')]===_0x4f18bd;});if(_0x41b56c){logger['info'](_0x359e('0x2f'));return BPromise[_0x359e('0x30')]({'id':_0x41b56c[_0x359e('0x2c')]['id'][_0x359e('0x2e')],'name':_0x41b56c[_0x359e('0x2c')][_0x359e('0xc')][_0x359e('0x2e')]});}}logger['info'](_0x359e('0x31'));return BPromise[_0x359e('0x30')]({'id':_0x214d77['name_value_list'][_0x359e('0x32')][_0x359e('0x2e')],'name':_0x214d77[_0x359e('0x2c')]['user_name'][_0x359e('0x2e')]});});}else{logger[_0x359e('0xb')](_0x359e('0x33'));return BPromise[_0x359e('0x30')]({'id':_0x214d77[_0x359e('0x2c')][_0x359e('0x32')][_0x359e('0x2e')],'name':_0x214d77[_0x359e('0x2c')][_0x359e('0x2d')]['value']});}}function getEndUser(_0xcb829,_0x2829cb,_0x58aab1,_0x59101b){logger[_0x359e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x58aab1);return request({'form':{'method':'get_entry_list','input_type':_0x359e('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x59101b['id'],'module_name':_0x359e('0x17'),'query':util[_0x359e('0x20')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x58aab1),'order_by':'','offset':'0','select_fields':['id','name',_0x359e('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x359e('0x2a')](function(_0x2551a2){if(_0x2551a2[_0x359e('0x2b')][_0x359e('0x1a')]){var _0x294363=_['find'](_0x2551a2[_0x359e('0x2b')],function(_0x282286){return _0x282286[_0x359e('0x2c')][_0x359e('0x34')][_0x359e('0x2e')]===_0x58aab1;});if(_0x294363){logger[_0x359e('0xb')](_0x359e('0x35'));return BPromise[_0x359e('0x30')]({'id':_0x294363[_0x359e('0x2c')]['id'][_0x359e('0x2e')],'name':_0x294363[_0x359e('0x2c')][_0x359e('0xc')][_0x359e('0x2e')],'phone':_0x294363['name_value_list'][_0x359e('0x34')][_0x359e('0x2e')]});}}else{logger[_0x359e('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x359e('0x36'),'input_type':_0x359e('0x1f'),'response_type':_0x359e('0x1f'),'rest_data':JSON[_0x359e('0x24')]({'session':_0x59101b['id'],'module_name':_0x359e('0x17'),'name_value_list':[{'name':_0x359e('0x37'),'value':_0x2829cb!==_0x359e('0x38')?_0x2829cb:util[_0x359e('0x20')](_0x359e('0x39'),_0x58aab1)},{'name':_0x359e('0x34'),'value':_0x58aab1}]})}})[_0x359e('0x2a')](function(_0x381af7){logger[_0x359e('0xb')](_0x359e('0x3a'));return BPromise[_0x359e('0x30')]({'id':_0x381af7['id'],'name':_0x381af7[_0x359e('0x2b')][_0x359e('0x37')][_0x359e('0x2e')],'phone':_0x381af7[_0x359e('0x2b')][_0x359e('0x34')][_0x359e('0x2e')]});});}});}function request(_0x4fc964){logger[_0x359e('0x3b')]('[HTTP]',JSON['stringify'](_0x4fc964));return rp(_[_0x359e('0x3c')](def,_0x4fc964));}function getTags(_0x52da79,_0x15219d){var _0x263c6f=[];if(_0x52da79&&_0x52da79[_0x359e('0x1a')]>0x0){_0x263c6f=_['map'](_0x52da79,_0x15219d);}return _0x263c6f;}function getCustomFields(_0x2ffbbf,_0x1c7a96){var _0x1aac70=[];var _0x5d9a9e={'custom_fields':[]};if(_0x2ffbbf[_0x359e('0x1a')]>0x0){_[_0x359e('0x1b')](_0x2ffbbf,function(_0x26220c){if(_0x26220c[_0x359e('0x3d')]==='string'&&_0x26220c[_0x359e('0x3e')]&&!_0x26220c[_0x359e('0x3f')]){_0x5d9a9e[_0x26220c[_0x359e('0x3e')][_0x359e('0x40')]()]=_0x26220c[_0x359e('0x41')]['toString']();}else if(_0x26220c[_0x359e('0x3d')]==='string'&&_0x26220c[_0x359e('0x1e')]&&_0x26220c[_0x359e('0x3f')]){_0x5d9a9e[_0x359e('0x42')][_0x359e('0x1d')]({'id':_0x26220c['idField'],'value':_0x26220c['content'][_0x359e('0x43')]()});}else if(_0x26220c['type']===_0x359e('0x44')&&_0x26220c[_0x359e('0x1c')]&&_0x26220c[_0x359e('0x1e')]&&_0x26220c[_0x359e('0x3f')]){_0x1c7a96[_0x26220c[_0x359e('0x1c')]]&&_0x5d9a9e[_0x359e('0x42')]['push']({'id':_0x26220c['idField'],'value':_0x1c7a96[_0x26220c[_0x359e('0x1c')]][_0x359e('0x43')]()});}else if(_0x26220c[_0x359e('0x3d')]===_0x359e('0x45')&&_0x26220c[_0x359e('0x46')]&&_0x26220c[_0x359e('0x46')][_0x359e('0xc')]&&_0x26220c['idField']&&_0x26220c[_0x359e('0x3f')]){_0x1c7a96[_0x26220c[_0x359e('0x46')][_0x359e('0xc')]['toLowerCase']()]&&_0x5d9a9e[_0x359e('0x42')][_0x359e('0x1d')]({'id':_0x26220c[_0x359e('0x1e')],'value':_0x1c7a96[_0x26220c[_0x359e('0x46')][_0x359e('0xc')]['toLowerCase']()][_0x359e('0x43')]()});}});}return _0x5d9a9e;}function getConnection(_0x27c8dc){return request({'method':'POST','form':{'method':_0x359e('0x47'),'input_type':_0x359e('0x1f'),'response_type':_0x359e('0x1f'),'rest_data':JSON[_0x359e('0x24')]({'user_auth':{'user_name':_0x27c8dc[_0x359e('0x48')],'password':_0x27c8dc[_0x359e('0x49')],'encryption':_0x359e('0x4a')},'application':_0x359e('0x4b')})}})[_0x359e('0x2a')](function(_0x5e4b3d){var _0x5112a7=_0x5e4b3d;if(_0x5112a7['id']){def['sessionID']=_0x5112a7['id'];return BPromise['resolve'](_0x5112a7);}else{throw new Error(util['format'](_0x359e('0x4c'),_0x27c8dc['id']));}});}function setRelationship(_0x170bbc,_0x4d37a0,_0x3b91cb,_0x11d744){return request({'form':{'method':_0x359e('0x4d'),'input_type':_0x359e('0x1f'),'response_type':_0x359e('0x1f'),'rest_data':JSON[_0x359e('0x24')]({'session':_0x170bbc['id'],'module_name':_0x359e('0x4e'),'module_id':_0x3b91cb['id'],'link_field_name':_0x11d744,'related_ids':[_0x4d37a0['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x359e('0x4f')]=function(_0x14ffeb,_0x11912d,_0x348169,_0x17ed2c,_0x32b3bb,_0xf3dcd4){var _0x25ddf9,_0x45d318,_0x2066e8,_0x4e5ccc;_0xf3dcd4[_0x359e('0x50')]=intUtil[_0x359e('0x51')](_0xf3dcd4['remoteUri']);_0xf3dcd4[_0x359e('0x52')]=intUtil['stripTrailingSlash'](_0xf3dcd4[_0x359e('0x52')]);def[_0x359e('0x53')]=util['format']('%s/service/v4_1/rest.php',_0xf3dcd4[_0x359e('0x50')]);if(_0x32b3bb&&_0x32b3bb[_0x359e('0x54')]){logger[_0x359e('0xb')](_0x359e('0x55'),_0x359e('0x56'));_0x11912d[_0x359e('0x57')]=util[_0x359e('0x20')](_0x359e('0x58'),_0xf3dcd4['serverUrl'],_0x11912d[_0x359e('0x59')],md5(_0x11912d[_0x359e('0x59')]));}else{_0x11912d[_0x359e('0x57')]='';}return getConnection(_0xf3dcd4)[_0x359e('0x2a')](function(_0x3e28c6){_0x4e5ccc=_0x3e28c6;return getUser(_0xf3dcd4,_0x17ed2c[_0x359e('0xc')],_0x4e5ccc);})[_0x359e('0x2a')](function(_0x464d63){_0x25ddf9=_0x464d63;logger[_0x359e('0xb')]('The\x20User\x20ID\x20is:',_0x25ddf9['id']);return getEndUser(_0xf3dcd4,_0x11912d[_0x359e('0x5a')],_0x11912d[_0x359e('0x5b')],_0x4e5ccc);})[_0x359e('0x2a')](function(_0x4e53d1){_0x45d318=_0x4e53d1;logger[_0x359e('0xb')](_0x359e('0x5c'),_0x45d318['id']);return getTicket(_0xf3dcd4,_0x25ddf9,_0x45d318,_0x348169,_0x11912d,_0x348169['Fields'],_0x4e5ccc,'Inbound');})[_0x359e('0x2a')](function(_0x31afbf){_0x2066e8=_0x31afbf;logger['info'](_0x359e('0x5d'));logger[_0x359e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x2066e8['id']);return setRelationship(_0x4e5ccc,_0x25ddf9,_0x2066e8,_0x359e('0x5e'));})[_0x359e('0x2a')](function(){return setRelationship(_0x4e5ccc,_0x45d318,_0x2066e8,_0x359e('0x5f'));})[_0x359e('0x2a')](function(){return getServerInfo(_0x4e5ccc);})[_0x359e('0x2a')](function(_0x7ec53){var _0x1fb4bf=parseInt(_0x7ec53['version'][_0x359e('0x60')](0x0));var _0x57b5f5=util[_0x359e('0x20')](_0x359e('0x61'),_0xf3dcd4[_0x359e('0x50')],_0x2066e8['id']);if(_0x1fb4bf>0x6){_0x57b5f5=util[_0x359e('0x20')](_0x359e('0x62'),_0xf3dcd4['remoteUri'],_0x2066e8['id']);}logger[_0x359e('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x359e('0x20')](_0x359e('0x63'),_0x17ed2c[_0x359e('0xc')]),_0x359e('0x64'),{'uri':_0x57b5f5});})[_0x359e('0x65')](function(_0x13807e){logger[_0x359e('0x66')](_0x359e('0x55'),JSON[_0x359e('0x24')](_0x13807e));});};exports[_0x359e('0x67')]=function(_0x16cc9f,_0x29d195,_0xd05236,_0x5e9acf,_0x56ade9,_0x2d78c9,_0x3fe595){var _0x34b5a4,_0x6140ba,_0x243cad,_0x32d9d8;_0x2d78c9[_0x359e('0x50')]=intUtil[_0x359e('0x51')](_0x2d78c9[_0x359e('0x50')]);_0x2d78c9[_0x359e('0x52')]=intUtil['stripTrailingSlash'](_0x2d78c9['serverUrl']);def[_0x359e('0x53')]=util[_0x359e('0x20')](_0x359e('0x68'),_0x2d78c9[_0x359e('0x50')]);if(_0x3fe595&&_0x3fe595[_0x359e('0x69')]&&_0x3fe595[_0x359e('0x69')]!==_0x359e('0x6a')){logger[_0x359e('0xb')](_0x359e('0x6b'),'Recording\x20is\x20enabled!');_0x29d195[_0x359e('0x57')]=util[_0x359e('0x20')](_0x359e('0x58'),_0x2d78c9['serverUrl'],_0x29d195['uniqueid'],md5(_0x29d195[_0x359e('0x59')]));}return getConnection(_0x2d78c9)[_0x359e('0x2a')](function(_0x2236c0){_0x32d9d8=_0x2236c0;return getUser(_0x2d78c9,_0x5e9acf[_0x359e('0xc')],_0x32d9d8);})[_0x359e('0x2a')](function(_0x49f7ec){_0x34b5a4=_0x49f7ec;logger[_0x359e('0xb')](_0x359e('0x6c'),_0x34b5a4['id']);return getEndUser(_0x2d78c9,_0x29d195[_0x359e('0x6d')],_0x29d195[_0x359e('0x6e')],_0x32d9d8);})[_0x359e('0x2a')](function(_0x17b690){_0x6140ba=_0x17b690;logger['info'](_0x359e('0x5c'),_0x6140ba['id']);return getTicket(_0x2d78c9,_0x34b5a4,_0x6140ba,_0xd05236,_0x29d195,_0xd05236[_0x359e('0x6f')],_0x32d9d8,_0x359e('0x70'));})['then'](function(_0xcda79a){_0x243cad=_0xcda79a;logger[_0x359e('0xb')](_0x359e('0x5d'));logger[_0x359e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x243cad['id']);return setRelationship(_0x32d9d8,_0x34b5a4,_0x243cad,_0x359e('0x5e'));})['then'](function(){return setRelationship(_0x32d9d8,_0x6140ba,_0x243cad,_0x359e('0x5f'));})[_0x359e('0x2a')](function(){return getServerInfo(_0x32d9d8);})['then'](function(_0x3be17b){var _0x163f05=parseInt(_0x3be17b[_0x359e('0x71')][_0x359e('0x60')](0x0));var _0x12313c=util[_0x359e('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x2d78c9[_0x359e('0x50')],_0x243cad['id']);if(_0x163f05>0x6){_0x12313c=util[_0x359e('0x20')](_0x359e('0x62'),_0x2d78c9['remoteUri'],_0x243cad['id']);}logger['info'](_0x359e('0x6b'),_0x359e('0x72'));emit(util[_0x359e('0x20')](_0x359e('0x63'),_0x5e9acf[_0x359e('0xc')]),_0x359e('0x64'),{'uri':_0x12313c});})['catch'](function(_0x494d66){logger['error'](_0x359e('0x6b'),JSON[_0x359e('0x24')](_0x494d66));});};exports[_0x359e('0x73')]=function(_0xadb8da,_0x377724,_0x262379,_0x5d3630,_0x59247e,_0x3e329a){var _0x2070f2,_0x292703,_0x296c8c,_0x52919b;_0x3e329a[_0x359e('0x50')]=intUtil[_0x359e('0x51')](_0x3e329a['remoteUri']);_0x3e329a['serverUrl']=intUtil[_0x359e('0x51')](_0x3e329a[_0x359e('0x52')]);def[_0x359e('0x53')]=util[_0x359e('0x20')](_0x359e('0x68'),_0x3e329a[_0x359e('0x50')]);if(_0x59247e&&_0x59247e['monitor_format']){logger['info']('['+_0x377724['lastevent'][_0x359e('0x74')]()+']',_0x359e('0x56'));_0x377724['recordingURL']=util[_0x359e('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e329a[_0x359e('0x52')],_0x377724[_0x359e('0x59')],md5(_0x377724[_0x359e('0x59')]));}else{_0x377724[_0x359e('0x57')]='';}return getConnection(_0x3e329a)[_0x359e('0x2a')](function(_0x415996){_0x52919b=_0x415996;if(!_[_0x359e('0x25')](_0x5d3630)){return getUser(_0x3e329a,_0x5d3630['name'],_0x52919b);}else{return getUser(_0x3e329a,null,_0x52919b);}})[_0x359e('0x2a')](function(_0x3c85ec){_0x2070f2=_0x3c85ec;logger[_0x359e('0xb')](_0x359e('0x6c'),_0x2070f2['id']);return getEndUser(_0x3e329a,_0x377724[_0x359e('0x5a')],_0x377724['calleridnum'],_0x52919b);})[_0x359e('0x2a')](function(_0x4a07ff){_0x292703=_0x4a07ff;logger['info'](_0x359e('0x5c'),_0x292703['id']);return getTicket(_0x3e329a,_0x2070f2,_0x292703,_0x262379,_0x377724,_0x262379[_0x359e('0x6f')],_0x52919b,_0x359e('0x75'));})[_0x359e('0x2a')](function(_0xa2d640){_0x296c8c=_0xa2d640;logger[_0x359e('0xb')]('Ticket\x20created!');logger[_0x359e('0xb')](_0x359e('0x76'),_0x296c8c['id']);return setRelationship(_0x52919b,_0x2070f2,_0x296c8c,_0x359e('0x5e'));})['then'](function(){return setRelationship(_0x52919b,_0x292703,_0x296c8c,'contacts');})['then'](function(){return getServerInfo(_0x52919b);})['catch'](function(_0x37b4f8){logger['error']('['+_0x377724[_0x359e('0x77')][_0x359e('0x74')]()+']',JSON[_0x359e('0x24')](_0x37b4f8));});}; \ No newline at end of file +var _0xf07c=['debug','merge','map','type','string','nameField','content','custom_fields','variable','customField','customVariable','Variable','toLowerCase','POST','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','Fields','Inbound','Ticket\x20created!','users','contacts','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','The\x20Ticket\x20ID\x20is:','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','[OUTBOUND]','user:%s','error','lastevent','toUpperCase','calleridname','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','emit','info','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','date_start','slice','replace','duration_minutes','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','get_server_info','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.'];(function(_0x1de64c,_0x25c467){var _0x3f6d6f=function(_0x1fa98d){while(--_0x1fa98d){_0x1de64c['push'](_0x1de64c['shift']());}};_0x3f6d6f(++_0x25c467);}(_0xf07c,0xb9));var _0xcf07=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xf07c[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0xcf07('0x0'));var rp=require(_0xcf07('0x1'));var BPromise=require('bluebird');var md5=require(_0xcf07('0x2'));var util=require(_0xcf07('0x3'));var Redis=require(_0xcf07('0x4'));var intUtil=require(_0xcf07('0x5'));var config=require(_0xcf07('0x6'));var logger=require(_0xcf07('0x7'))(_0xcf07('0x8'));config[_0xcf07('0x9')]=_['defaults'](config[_0xcf07('0x9')],{'host':_0xcf07('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcf07('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x33da33,_0x36d650,_0x3c7499){io['to'](_0x33da33)[_0xcf07('0xb')](_0x36d650,_0x3c7499);}function getTicket(_0x4d1ac8,_0x25e30e,_0xc0c247,_0x39c4fd,_0x401f6a,_0x6d1c66,_0x401c46,_0x30af47){logger[_0xcf07('0xc')]('Creating\x20new\x20ticket...');var _0x1e6625=new Date();var _0x2f5064=[{'name':_0xcf07('0xd'),'value':intUtil['getString'](_0x39c4fd[_0xcf07('0xe')],_0x401f6a,'\x20')},{'name':_0xcf07('0xf'),'value':_0x25e30e['id']},{'name':_0xcf07('0x10'),'value':_0x25e30e['id']},{'name':_0xcf07('0x11'),'value':intUtil[_0xcf07('0x12')](_0x39c4fd[_0xcf07('0x13')],_0x401f6a,'\x0a')},{'name':_0xcf07('0x14'),'value':_0x1e6625['toISOString']()[_0xcf07('0x15')](0x0,0x13)[_0xcf07('0x16')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xcf07('0x17'),'value':'15'},{'name':'parent_id','value':_0xc0c247['id']},{'name':'parent_type','value':_0xcf07('0x18')},{'name':_0xcf07('0x19'),'value':_0xc0c247[_0xcf07('0xd')]},{'name':_0xcf07('0x1a'),'value':_0x30af47}];if(_0x6d1c66[_0xcf07('0x1b')]){_[_0xcf07('0x1c')](_0x6d1c66,function(_0x211e7e){if(_0x401f6a[_0x211e7e[_0xcf07('0x1d')]]){_0x2f5064[_0xcf07('0x1e')]({'name':_0x211e7e[_0xcf07('0x1f')],'value':_0x401f6a[_0x211e7e['variableName']]});}});}return request({'form':{'method':_0xcf07('0x20'),'input_type':_0xcf07('0x21'),'response_type':_0xcf07('0x21'),'rest_data':JSON[_0xcf07('0x22')]({'session':_0x401c46['id'],'module_name':_0xcf07('0x23'),'name_value_list':_0x2f5064})}});}function getAuth(_0x379bd1){return util[_0xcf07('0x24')]('Basic\x20%s',new Buffer(_0x379bd1[_0xcf07('0x25')]+':X')[_0xcf07('0x26')]('base64'));}function getServerInfo(_0x3730eb){return request({'form':{'method':_0xcf07('0x27'),'input_type':_0xcf07('0x21'),'response_type':_0xcf07('0x21'),'rest_data':JSON[_0xcf07('0x22')]({'session':_0x3730eb['id']})}});}function getUser(_0x29b469,_0x2d7cd6,_0x151098){if(!_[_0xcf07('0x28')](_0x2d7cd6)){logger[_0xcf07('0xc')]('Getting\x20agent\x20with\x20name',_0x2d7cd6);return request({'form':{'method':_0xcf07('0x29'),'input_type':_0xcf07('0x21'),'response_type':_0xcf07('0x21'),'rest_data':JSON['stringify']({'session':_0x151098['id'],'module_name':_0xcf07('0x2a'),'query':util['format'](_0xcf07('0x2b'),_0x2d7cd6),'order_by':'','offset':'0','select_fields':['id',_0xcf07('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcf07('0x2c')](function(_0x2e3e5e){if(_0x2e3e5e[_0xcf07('0x2d')][_0xcf07('0x1b')]){var _0x4a6a49=_[_0xcf07('0x2e')](_0x2e3e5e[_0xcf07('0x2d')],function(_0x10e5b8){return _0x10e5b8['name_value_list']['user_name'][_0xcf07('0x2f')]===_0x2d7cd6;});if(_0x4a6a49){logger[_0xcf07('0xc')](_0xcf07('0x30'));return BPromise[_0xcf07('0x31')]({'id':_0x4a6a49['name_value_list']['id'][_0xcf07('0x2f')],'name':_0x4a6a49[_0xcf07('0x32')][_0xcf07('0xd')][_0xcf07('0x2f')]});}}logger[_0xcf07('0xc')](_0xcf07('0x33'));return BPromise[_0xcf07('0x31')]({'id':_0x151098[_0xcf07('0x32')][_0xcf07('0x34')][_0xcf07('0x2f')],'name':_0x151098[_0xcf07('0x32')][_0xcf07('0x35')][_0xcf07('0x2f')]});});}else{logger[_0xcf07('0xc')](_0xcf07('0x36'));return BPromise[_0xcf07('0x31')]({'id':_0x151098[_0xcf07('0x32')][_0xcf07('0x34')]['value'],'name':_0x151098[_0xcf07('0x32')][_0xcf07('0x35')][_0xcf07('0x2f')]});}}function getEndUser(_0x46d1b9,_0x5f1a0c,_0x5c4bb9,_0x334584){logger[_0xcf07('0xc')](_0xcf07('0x37'),_0x5c4bb9);return request({'form':{'method':_0xcf07('0x29'),'input_type':_0xcf07('0x21'),'response_type':_0xcf07('0x21'),'rest_data':JSON[_0xcf07('0x22')]({'session':_0x334584['id'],'module_name':'Contacts','query':util[_0xcf07('0x24')](_0xcf07('0x38'),_0x5c4bb9),'order_by':'','offset':'0','select_fields':['id',_0xcf07('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcf07('0x2c')](function(_0x490e0c){if(_0x490e0c['entry_list'][_0xcf07('0x1b')]){var _0x1a6b66=_[_0xcf07('0x2e')](_0x490e0c[_0xcf07('0x2d')],function(_0x24e57b){return _0x24e57b['name_value_list'][_0xcf07('0x39')][_0xcf07('0x2f')]===_0x5c4bb9;});if(_0x1a6b66){logger['info'](_0xcf07('0x3a'));return BPromise[_0xcf07('0x31')]({'id':_0x1a6b66[_0xcf07('0x32')]['id'][_0xcf07('0x2f')],'name':_0x1a6b66[_0xcf07('0x32')][_0xcf07('0xd')][_0xcf07('0x2f')],'phone':_0x1a6b66['name_value_list'][_0xcf07('0x39')][_0xcf07('0x2f')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xcf07('0x20'),'input_type':'JSON','response_type':_0xcf07('0x21'),'rest_data':JSON[_0xcf07('0x22')]({'session':_0x334584['id'],'module_name':_0xcf07('0x18'),'name_value_list':[{'name':_0xcf07('0x3b'),'value':_0x5f1a0c!==_0xcf07('0x3c')?_0x5f1a0c:util['format'](_0xcf07('0x3d'),_0x5c4bb9)},{'name':'phone_home','value':_0x5c4bb9}]})}})[_0xcf07('0x2c')](function(_0x745e75){logger[_0xcf07('0xc')](_0xcf07('0x3e'));return BPromise['resolve']({'id':_0x745e75['id'],'name':_0x745e75['entry_list']['first_name']['value'],'phone':_0x745e75[_0xcf07('0x2d')][_0xcf07('0x39')][_0xcf07('0x2f')]});});}});}function request(_0x4039a5){logger[_0xcf07('0x3f')]('[HTTP]',JSON[_0xcf07('0x22')](_0x4039a5));return rp(_[_0xcf07('0x40')](def,_0x4039a5));}function getTags(_0x1b123f,_0x185f7a){var _0x32923f=[];if(_0x1b123f&&_0x1b123f[_0xcf07('0x1b')]>0x0){_0x32923f=_[_0xcf07('0x41')](_0x1b123f,_0x185f7a);}return _0x32923f;}function getCustomFields(_0x478cc9,_0x1d7bd3){var _0x36a730=[];var _0x1a736e={'custom_fields':[]};if(_0x478cc9[_0xcf07('0x1b')]>0x0){_[_0xcf07('0x1c')](_0x478cc9,function(_0x5c71b0){if(_0x5c71b0[_0xcf07('0x42')]===_0xcf07('0x43')&&_0x5c71b0[_0xcf07('0x44')]&&!_0x5c71b0['customField']){_0x1a736e[_0x5c71b0[_0xcf07('0x44')]['toLowerCase']()]=_0x5c71b0[_0xcf07('0x45')][_0xcf07('0x26')]();}else if(_0x5c71b0[_0xcf07('0x42')]===_0xcf07('0x43')&&_0x5c71b0[_0xcf07('0x1f')]&&_0x5c71b0['customField']){_0x1a736e[_0xcf07('0x46')][_0xcf07('0x1e')]({'id':_0x5c71b0[_0xcf07('0x1f')],'value':_0x5c71b0[_0xcf07('0x45')][_0xcf07('0x26')]()});}else if(_0x5c71b0[_0xcf07('0x42')]===_0xcf07('0x47')&&_0x5c71b0['variableName']&&_0x5c71b0[_0xcf07('0x1f')]&&_0x5c71b0[_0xcf07('0x48')]){_0x1d7bd3[_0x5c71b0[_0xcf07('0x1d')]]&&_0x1a736e[_0xcf07('0x46')][_0xcf07('0x1e')]({'id':_0x5c71b0[_0xcf07('0x1f')],'value':_0x1d7bd3[_0x5c71b0[_0xcf07('0x1d')]][_0xcf07('0x26')]()});}else if(_0x5c71b0[_0xcf07('0x42')]===_0xcf07('0x49')&&_0x5c71b0[_0xcf07('0x4a')]&&_0x5c71b0[_0xcf07('0x4a')]['name']&&_0x5c71b0[_0xcf07('0x1f')]&&_0x5c71b0['customField']){_0x1d7bd3[_0x5c71b0[_0xcf07('0x4a')]['name'][_0xcf07('0x4b')]()]&&_0x1a736e[_0xcf07('0x46')][_0xcf07('0x1e')]({'id':_0x5c71b0[_0xcf07('0x1f')],'value':_0x1d7bd3[_0x5c71b0['Variable'][_0xcf07('0xd')][_0xcf07('0x4b')]()]['toString']()});}});}return _0x1a736e;}function getConnection(_0x4c716c){return request({'method':_0xcf07('0x4c'),'form':{'method':_0xcf07('0x4d'),'input_type':_0xcf07('0x21'),'response_type':'JSON','rest_data':JSON[_0xcf07('0x22')]({'user_auth':{'user_name':_0x4c716c[_0xcf07('0x4e')],'password':_0x4c716c[_0xcf07('0x4f')],'encryption':_0xcf07('0x50')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xcf07('0x2c')](function(_0x4bd689){var _0x47460f=_0x4bd689;if(_0x47460f['id']){def[_0xcf07('0x51')]=_0x47460f['id'];return BPromise[_0xcf07('0x31')](_0x47460f);}else{throw new Error(util[_0xcf07('0x24')](_0xcf07('0x52'),_0x4c716c['id']));}});}function setRelationship(_0x3754b4,_0x110a57,_0x51f336,_0x4e375d){return request({'form':{'method':_0xcf07('0x53'),'input_type':_0xcf07('0x21'),'response_type':_0xcf07('0x21'),'rest_data':JSON['stringify']({'session':_0x3754b4['id'],'module_name':_0xcf07('0x23'),'module_id':_0x51f336['id'],'link_field_name':_0x4e375d,'related_ids':[_0x110a57['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xcf07('0x54')]=function(_0x1dd462,_0x17ed4e,_0x529f6b,_0x17c691,_0x5c290f,_0x10048a){var _0xca1143,_0x52823d,_0x191ea0,_0x445de;_0x10048a[_0xcf07('0x55')]=intUtil[_0xcf07('0x56')](_0x10048a[_0xcf07('0x55')]);_0x10048a[_0xcf07('0x57')]=intUtil['stripTrailingSlash'](_0x10048a[_0xcf07('0x57')]);def[_0xcf07('0x58')]=util[_0xcf07('0x24')](_0xcf07('0x59'),_0x10048a[_0xcf07('0x55')]);if(_0x5c290f&&_0x5c290f[_0xcf07('0x5a')]){logger[_0xcf07('0xc')](_0xcf07('0x5b'),'Recording\x20is\x20enabled!');_0x17ed4e['recordingURL']=util[_0xcf07('0x24')](_0xcf07('0x5c'),_0x10048a[_0xcf07('0x57')],_0x17ed4e[_0xcf07('0x5d')],md5(_0x17ed4e[_0xcf07('0x5d')]));}else{_0x17ed4e[_0xcf07('0x5e')]='';}return getConnection(_0x10048a)[_0xcf07('0x2c')](function(_0x51f42c){_0x445de=_0x51f42c;return getUser(_0x10048a,_0x17c691['name'],_0x445de);})['then'](function(_0x386408){_0xca1143=_0x386408;logger[_0xcf07('0xc')](_0xcf07('0x5f'),_0xca1143['id']);return getEndUser(_0x10048a,_0x17ed4e['calleridname'],_0x17ed4e[_0xcf07('0x60')],_0x445de);})[_0xcf07('0x2c')](function(_0x23b340){_0x52823d=_0x23b340;logger[_0xcf07('0xc')]('The\x20Enduser\x20ID\x20is:',_0x52823d['id']);return getTicket(_0x10048a,_0xca1143,_0x52823d,_0x529f6b,_0x17ed4e,_0x529f6b[_0xcf07('0x61')],_0x445de,_0xcf07('0x62'));})[_0xcf07('0x2c')](function(_0x1a0b2c){_0x191ea0=_0x1a0b2c;logger[_0xcf07('0xc')](_0xcf07('0x63'));logger[_0xcf07('0xc')]('The\x20Ticket\x20ID\x20is:',_0x191ea0['id']);return setRelationship(_0x445de,_0xca1143,_0x191ea0,_0xcf07('0x64'));})['then'](function(){return setRelationship(_0x445de,_0x52823d,_0x191ea0,_0xcf07('0x65'));})['then'](function(){return getServerInfo(_0x445de);})['then'](function(_0x2473f6){var _0x4cceed=parseInt(_0x2473f6['version'][_0xcf07('0x66')](0x0));var _0x224a5e=util[_0xcf07('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x10048a['remoteUri'],_0x191ea0['id']);if(_0x4cceed>0x6){_0x224a5e=util[_0xcf07('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x10048a['remoteUri'],_0x191ea0['id']);}logger[_0xcf07('0xc')](_0xcf07('0x5b'),_0xcf07('0x67'));emit(util[_0xcf07('0x24')]('user:%s',_0x17c691['name']),_0xcf07('0x68'),{'uri':_0x224a5e});})[_0xcf07('0x69')](function(_0x1aa297){logger['error'](_0xcf07('0x5b'),JSON[_0xcf07('0x22')](_0x1aa297));});};exports[_0xcf07('0x6a')]=function(_0x26da38,_0x42ad66,_0x46ed48,_0x344bee,_0x481ba7,_0x524bc6,_0x1210d8){var _0x24de7e,_0x4073d3,_0x507c7a,_0x377ead;_0x524bc6[_0xcf07('0x55')]=intUtil[_0xcf07('0x56')](_0x524bc6[_0xcf07('0x55')]);_0x524bc6[_0xcf07('0x57')]=intUtil[_0xcf07('0x56')](_0x524bc6[_0xcf07('0x57')]);def[_0xcf07('0x58')]=util[_0xcf07('0x24')](_0xcf07('0x59'),_0x524bc6[_0xcf07('0x55')]);if(_0x1210d8&&_0x1210d8[_0xcf07('0x6b')]&&_0x1210d8[_0xcf07('0x6b')]!==_0xcf07('0x6c')){logger[_0xcf07('0xc')]('[OUTBOUND]',_0xcf07('0x6d'));_0x42ad66[_0xcf07('0x5e')]=util[_0xcf07('0x24')](_0xcf07('0x5c'),_0x524bc6[_0xcf07('0x57')],_0x42ad66[_0xcf07('0x5d')],md5(_0x42ad66[_0xcf07('0x5d')]));}return getConnection(_0x524bc6)['then'](function(_0x368c36){_0x377ead=_0x368c36;return getUser(_0x524bc6,_0x344bee['name'],_0x377ead);})[_0xcf07('0x2c')](function(_0x15f7f0){_0x24de7e=_0x15f7f0;logger[_0xcf07('0xc')](_0xcf07('0x5f'),_0x24de7e['id']);return getEndUser(_0x524bc6,_0x42ad66[_0xcf07('0x6e')],_0x42ad66[_0xcf07('0x6f')],_0x377ead);})[_0xcf07('0x2c')](function(_0x3d8d03){_0x4073d3=_0x3d8d03;logger[_0xcf07('0xc')](_0xcf07('0x70'),_0x4073d3['id']);return getTicket(_0x524bc6,_0x24de7e,_0x4073d3,_0x46ed48,_0x42ad66,_0x46ed48[_0xcf07('0x61')],_0x377ead,_0xcf07('0x71'));})[_0xcf07('0x2c')](function(_0x4a8fca){_0x507c7a=_0x4a8fca;logger[_0xcf07('0xc')]('Ticket\x20created!');logger[_0xcf07('0xc')](_0xcf07('0x72'),_0x507c7a['id']);return setRelationship(_0x377ead,_0x24de7e,_0x507c7a,_0xcf07('0x64'));})[_0xcf07('0x2c')](function(){return setRelationship(_0x377ead,_0x4073d3,_0x507c7a,'contacts');})[_0xcf07('0x2c')](function(){return getServerInfo(_0x377ead);})[_0xcf07('0x2c')](function(_0x4942c9){var _0x501183=parseInt(_0x4942c9[_0xcf07('0x73')][_0xcf07('0x66')](0x0));var _0x5e2ca7=util[_0xcf07('0x24')](_0xcf07('0x74'),_0x524bc6[_0xcf07('0x55')],_0x507c7a['id']);if(_0x501183>0x6){_0x5e2ca7=util['format'](_0xcf07('0x75'),_0x524bc6['remoteUri'],_0x507c7a['id']);}logger[_0xcf07('0xc')](_0xcf07('0x76'),_0xcf07('0x67'));emit(util[_0xcf07('0x24')](_0xcf07('0x77'),_0x344bee[_0xcf07('0xd')]),'trigger:browser:url',{'uri':_0x5e2ca7});})['catch'](function(_0xcaaf43){logger[_0xcf07('0x78')]('[OUTBOUND]',JSON[_0xcf07('0x22')](_0xcaaf43));});};exports['unmanaged']=function(_0x224ef2,_0x4f70ab,_0x439d51,_0x170921,_0x53d0b4,_0x222250){var _0x565e49,_0x533f52,_0x42fdc8,_0x52008e;_0x222250[_0xcf07('0x55')]=intUtil[_0xcf07('0x56')](_0x222250[_0xcf07('0x55')]);_0x222250[_0xcf07('0x57')]=intUtil[_0xcf07('0x56')](_0x222250[_0xcf07('0x57')]);def[_0xcf07('0x58')]=util[_0xcf07('0x24')](_0xcf07('0x59'),_0x222250[_0xcf07('0x55')]);if(_0x53d0b4&&_0x53d0b4[_0xcf07('0x5a')]){logger[_0xcf07('0xc')]('['+_0x4f70ab[_0xcf07('0x79')][_0xcf07('0x7a')]()+']',_0xcf07('0x6d'));_0x4f70ab[_0xcf07('0x5e')]=util['format'](_0xcf07('0x5c'),_0x222250[_0xcf07('0x57')],_0x4f70ab[_0xcf07('0x5d')],md5(_0x4f70ab[_0xcf07('0x5d')]));}else{_0x4f70ab[_0xcf07('0x5e')]='';}return getConnection(_0x222250)['then'](function(_0x329be5){_0x52008e=_0x329be5;if(!_[_0xcf07('0x28')](_0x170921)){return getUser(_0x222250,_0x170921[_0xcf07('0xd')],_0x52008e);}else{return getUser(_0x222250,null,_0x52008e);}})[_0xcf07('0x2c')](function(_0x9e261e){_0x565e49=_0x9e261e;logger[_0xcf07('0xc')]('The\x20User\x20ID\x20is:',_0x565e49['id']);return getEndUser(_0x222250,_0x4f70ab[_0xcf07('0x7b')],_0x4f70ab[_0xcf07('0x60')],_0x52008e);})['then'](function(_0x15e63c){_0x533f52=_0x15e63c;logger['info']('The\x20Enduser\x20ID\x20is:',_0x533f52['id']);return getTicket(_0x222250,_0x565e49,_0x533f52,_0x439d51,_0x4f70ab,_0x439d51[_0xcf07('0x61')],_0x52008e,_0xcf07('0x62'));})[_0xcf07('0x2c')](function(_0x600efa){_0x42fdc8=_0x600efa;logger[_0xcf07('0xc')](_0xcf07('0x63'));logger[_0xcf07('0xc')](_0xcf07('0x72'),_0x42fdc8['id']);return setRelationship(_0x52008e,_0x565e49,_0x42fdc8,'users');})['then'](function(){return setRelationship(_0x52008e,_0x533f52,_0x42fdc8,_0xcf07('0x65'));})['then'](function(){return getServerInfo(_0x52008e);})['catch'](function(_0x39db66){logger[_0xcf07('0x78')]('['+_0x4f70ab['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x39db66));});}; \ 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 400f375..2606aca 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 _0x1135=['push','variable','variableName','type','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','format','%s:\x20%s','key','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','sortBy','string'];(function(_0x1ddc6b,_0x5754a8){var _0x129e92=function(_0x4a4269){while(--_0x4a4269){_0x1ddc6b['push'](_0x1ddc6b['shift']());}};_0x129e92(++_0x5754a8);}(_0x1135,0x82));var _0x5113=function(_0x37ccf8,_0x33a591){_0x37ccf8=_0x37ccf8-0x0;var _0x36d925=_0x1135[_0x37ccf8];return _0x36d925;};'use strict';var _=require(_0x5113('0x0'));var util=require(_0x5113('0x1'));exports[_0x5113('0x2')]=function(_0xa2a5a2,_0x57b056,_0x1ca225){var _0x44c8e6=[];if(_0xa2a5a2['length']>0x0){var _0x15ae53=_[_0x5113('0x3')](_0xa2a5a2,['id']);for(var _0x2f57c4=0x0;_0x2f57c4<_0x15ae53['length'];_0x2f57c4++){var _0x4bd8cf=_0x15ae53[_0x2f57c4];if(_0x4bd8cf['type']===_0x5113('0x4')){_0x44c8e6[_0x5113('0x5')](_0x4bd8cf['content']);}else if(_0x4bd8cf['type']===_0x5113('0x6')&&_0x4bd8cf[_0x5113('0x7')]){_0x57b056[_0x4bd8cf['variableName']]&&_0x44c8e6[_0x5113('0x5')](_0x57b056[_0x4bd8cf[_0x5113('0x7')]]['toString']());}else if(_0x4bd8cf[_0x5113('0x8')]===_0x5113('0x9')&&_0x4bd8cf[_0x5113('0xa')]&&_0x4bd8cf[_0x5113('0xa')][_0x5113('0xb')]){_0x57b056[_0x4bd8cf[_0x5113('0xa')][_0x5113('0xb')][_0x5113('0xc')]()]&&_0x44c8e6[_0x5113('0x5')](_0x57b056[_0x4bd8cf['Variable'][_0x5113('0xb')][_0x5113('0xc')]()][_0x5113('0xd')]());}else if(_0x4bd8cf['type']===_0x5113('0xe')){if(_0x4bd8cf[_0x5113('0xf')]==='string'&&_0x4bd8cf['key']){_0x44c8e6['push'](util[_0x5113('0x10')](_0x5113('0x11'),_0x4bd8cf[_0x5113('0x12')],_0x4bd8cf['keyContent']));}else if(_0x4bd8cf[_0x5113('0xf')]===_0x5113('0x6')&&_0x4bd8cf['variableName']&&_0x4bd8cf[_0x5113('0x12')]){_0x57b056[_0x4bd8cf[_0x5113('0x7')]]&&_0x44c8e6[_0x5113('0x5')](util['format'](_0x5113('0x11'),_0x4bd8cf[_0x5113('0x12')],_0x57b056[_0x4bd8cf[_0x5113('0x7')]]));}else if(_0x4bd8cf[_0x5113('0xf')]===_0x5113('0x9')&&_0x4bd8cf['Variable']&&_0x4bd8cf['Variable']['name']&&_0x4bd8cf[_0x5113('0x12')]){_0x57b056[_0x4bd8cf[_0x5113('0xa')][_0x5113('0xb')]['toLowerCase']()]&&_0x44c8e6[_0x5113('0x5')](util[_0x5113('0x10')](_0x5113('0x11'),_0x4bd8cf[_0x5113('0x12')],_0x57b056[_0x4bd8cf[_0x5113('0xa')]['name'][_0x5113('0xc')]()]));}}}}return _0x44c8e6[_0x5113('0x13')](_0x1ca225);};exports[_0x5113('0x14')]=function(_0x23945a){var _0x4e94ee=_0x23945a[_0x5113('0x15')](-0x1);if(_0x4e94ee==='/'){_0x23945a=_0x23945a[_0x5113('0x16')](0x0,_0x23945a[_0x5113('0x17')](_0x4e94ee));}return _0x23945a;};exports[_0x5113('0x18')]=function(_0x4ba733){if(!_[_0x5113('0x19')](_0x4ba733)&&_0x4ba733!==''){var _0x3f628d=/^(([^<>()\[\]\\.,;:\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 _0x3f628d[_0x5113('0x1a')](String(_0x4ba733)[_0x5113('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x05cb=['toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','join','slice','substring','lastIndexOf','validateEmail','test','lodash','sortBy','length','type','variable','variableName','toString','customVariable','Variable','name','push'];(function(_0x18cb99,_0x5deff4){var _0x582edc=function(_0x543c8c){while(--_0x543c8c){_0x18cb99['push'](_0x18cb99['shift']());}};_0x582edc(++_0x5deff4);}(_0x05cb,0x85));var _0xb05c=function(_0x85ab2b,_0x516a9d){_0x85ab2b=_0x85ab2b-0x0;var _0x37fd3b=_0x05cb[_0x85ab2b];return _0x37fd3b;};'use strict';var _=require(_0xb05c('0x0'));var util=require('util');exports['getString']=function(_0x1bb9d5,_0x57a6c9,_0x40f32f){var _0x257c07=[];if(_0x1bb9d5['length']>0x0){var _0x4aa000=_[_0xb05c('0x1')](_0x1bb9d5,['id']);for(var _0x46c075=0x0;_0x46c075<_0x4aa000[_0xb05c('0x2')];_0x46c075++){var _0xb173a1=_0x4aa000[_0x46c075];if(_0xb173a1[_0xb05c('0x3')]==='string'){_0x257c07['push'](_0xb173a1['content']);}else if(_0xb173a1[_0xb05c('0x3')]===_0xb05c('0x4')&&_0xb173a1[_0xb05c('0x5')]){_0x57a6c9[_0xb173a1['variableName']]&&_0x257c07['push'](_0x57a6c9[_0xb173a1['variableName']][_0xb05c('0x6')]());}else if(_0xb173a1[_0xb05c('0x3')]===_0xb05c('0x7')&&_0xb173a1[_0xb05c('0x8')]&&_0xb173a1['Variable'][_0xb05c('0x9')]){_0x57a6c9[_0xb173a1[_0xb05c('0x8')][_0xb05c('0x9')]['toLowerCase']()]&&_0x257c07[_0xb05c('0xa')](_0x57a6c9[_0xb173a1[_0xb05c('0x8')]['name'][_0xb05c('0xb')]()][_0xb05c('0x6')]());}else if(_0xb173a1[_0xb05c('0x3')]===_0xb05c('0xc')){if(_0xb173a1[_0xb05c('0xd')]===_0xb05c('0xe')&&_0xb173a1[_0xb05c('0xf')]){_0x257c07[_0xb05c('0xa')](util[_0xb05c('0x10')]('%s:\x20%s',_0xb173a1['key'],_0xb173a1['keyContent']));}else if(_0xb173a1[_0xb05c('0xd')]===_0xb05c('0x4')&&_0xb173a1[_0xb05c('0x5')]&&_0xb173a1['key']){_0x57a6c9[_0xb173a1[_0xb05c('0x5')]]&&_0x257c07[_0xb05c('0xa')](util[_0xb05c('0x10')](_0xb05c('0x11'),_0xb173a1[_0xb05c('0xf')],_0x57a6c9[_0xb173a1['variableName']]));}else if(_0xb173a1['keyType']===_0xb05c('0x7')&&_0xb173a1[_0xb05c('0x8')]&&_0xb173a1[_0xb05c('0x8')][_0xb05c('0x9')]&&_0xb173a1['key']){_0x57a6c9[_0xb173a1[_0xb05c('0x8')][_0xb05c('0x9')][_0xb05c('0xb')]()]&&_0x257c07['push'](util[_0xb05c('0x10')](_0xb05c('0x11'),_0xb173a1[_0xb05c('0xf')],_0x57a6c9[_0xb173a1[_0xb05c('0x8')]['name']['toLowerCase']()]));}}}}return _0x257c07[_0xb05c('0x12')](_0x40f32f);};exports['stripTrailingSlash']=function(_0x546215){var _0x338c63=_0x546215[_0xb05c('0x13')](-0x1);if(_0x338c63==='/'){_0x546215=_0x546215[_0xb05c('0x14')](0x0,_0x546215[_0xb05c('0x15')](_0x338c63));}return _0x546215;};exports[_0xb05c('0x16')]=function(_0x56fc6c){if(!_['isNil'](_0x56fc6c)&&_0x56fc6c!==''){var _0x4b3fc8=/^(([^<>()\[\]\\.,;:\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 _0x4b3fc8[_0xb05c('0x17')](String(_0x56fc6c)['toLowerCase']());}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 eb00240..c16f7e1 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(_0x1e3373,_0x371278){var _0x462fd5=function(_0xeb9815){while(--_0xeb9815){_0x1e3373['push'](_0x1e3373['shift']());}};_0x462fd5(++_0x371278);}(_0xe706,0xa3));var _0x6e70=function(_0x2b0690,_0x4f742f){_0x2b0690=_0x2b0690-0x0;var _0x82be1=_0xe706[_0x2b0690];return _0x82be1;};'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 _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x1da215,_0x420eb7){var _0x36f1a1=function(_0x38a02b){while(--_0x38a02b){_0x1da215['push'](_0x1da215['shift']());}};_0x36f1a1(++_0x420eb7);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 607f185..7a4054d 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 _0x905c=['../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Caller\x20-\x20%s','authType','password','%s:%s','username','token','Basic\x20%s','base64','debug','stringify','GET','forEach','picklist','type','nameField','customField','toLowerCase','content','toString','includes','custom_fields','push','idField','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','email','destcalleridname','replace','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','./util'];(function(_0x1ff2a9,_0x3f3884){var _0xeb6853=function(_0x3a69de){while(--_0x3a69de){_0x1ff2a9['push'](_0x1ff2a9['shift']());}};_0xeb6853(++_0x3f3884);}(_0x905c,0xd5));var _0xc905=function(_0x5aee87,_0x326706){_0x5aee87=_0x5aee87-0x0;var _0x1dc87f=_0x905c[_0x5aee87];return _0x1dc87f;};'use strict';var _=require(_0xc905('0x0'));var rp=require(_0xc905('0x1'));var md5=require(_0xc905('0x2'));var util=require('util');var Redis=require(_0xc905('0x3'));var intUtil=require(_0xc905('0x4'));var config=require(_0xc905('0x5'));var logger=require(_0xc905('0x6'))(_0xc905('0x7'));config[_0xc905('0x8')]=_[_0xc905('0x9')](config[_0xc905('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc905('0xa'))(new Redis(config[_0xc905('0x8')]));function emit(_0x361150,_0x54e16c,_0x5246ba){io['to'](_0x361150)[_0xc905('0xb')](_0x54e16c,_0x5246ba);}var headers={'Content-Type':_0xc905('0xc'),'Accept':_0xc905('0xc')};function getTicket(_0xf20945,_0x4f87b4,_0x122c95,_0x2251eb,_0x2f676f){logger[_0xc905('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xc905('0xe')](_0xc905('0xf'),_0xf20945[_0xc905('0x10')]),'method':_0xc905('0x11'),'body':{'ticket':_[_0xc905('0x12')]({'requester_id':_0x122c95['id'],'submitter_id':_0x4f87b4?_0x4f87b4['id']:undefined,'assignee_id':_0x4f87b4?_0x4f87b4['id']:undefined,'tags':getTags(_0x2251eb[_0xc905('0x13')],_0xc905('0x14')),'subject':intUtil[_0xc905('0x15')](_0x2251eb[_0xc905('0x16')],_0x2f676f,'\x20'),'description':intUtil[_0xc905('0x15')](_0x2251eb['Descriptions'],_0x2f676f,'\x0a'),'comment':{'public':![],'body':intUtil[_0xc905('0x15')](_0x2251eb[_0xc905('0x17')],_0x2f676f,'\x0a')}},getCustomFields(_0x2251eb[_0xc905('0x18')],_0x2f676f))}})[_0xc905('0x19')](function(_0x3a2cb4){logger['info'](_0xc905('0x1a'));return _0x3a2cb4[_0xc905('0x1b')];});}function getUser(_0x53c1a3,_0x555639){if(intUtil[_0xc905('0x1c')](_0x555639)){logger[_0xc905('0xd')](_0xc905('0x1d'),_0x555639);return request({'uri':util[_0xc905('0xe')](_0xc905('0x1e'),_0x53c1a3[_0xc905('0x10')]),'qs':{'query':util[_0xc905('0xe')](_0xc905('0x1f'),_0x555639)}})[_0xc905('0x19')](function(_0x547253){if(_0x547253[_0xc905('0x20')]){logger[_0xc905('0xd')]('Agent\x20found!');return _[_0xc905('0x21')](_0x547253[_0xc905('0x22')],{'email':_0x555639,'role':_0xc905('0x23')});}else{logger[_0xc905('0xd')](_0xc905('0x24'));return request({'uri':util[_0xc905('0xe')](_0xc905('0x25'),_0x53c1a3['remoteUri'])})[_0xc905('0x19')](function(_0x2968e6){logger[_0xc905('0xd')](_0xc905('0x26'));return _0x2968e6[_0xc905('0x27')];});}});}else{logger['info'](_0xc905('0x24'));return request({'uri':util[_0xc905('0xe')](_0xc905('0x25'),_0x53c1a3[_0xc905('0x10')])})[_0xc905('0x19')](function(_0x5e25b7){logger[_0xc905('0xd')](_0xc905('0x26'));return _0x5e25b7[_0xc905('0x27')];});}}function getEndUser(_0x2fb5a1,_0x3a38bc,_0x11eb1d){logger['info']('Searching\x20enduser\x20with\x20phone',_0x11eb1d);return request({'uri':util[_0xc905('0xe')](_0xc905('0x1e'),_0x2fb5a1['remoteUri']),'qs':{'query':util[_0xc905('0xe')](_0xc905('0x28'),_0x11eb1d)}})[_0xc905('0x19')](function(_0x5d5ee1){var _0x15e22c;if(_0x5d5ee1[_0xc905('0x22')][_0xc905('0x29')]){_0x5d5ee1['results']=_[_0xc905('0x2a')](_0x5d5ee1[_0xc905('0x22')],{'suspended':![],'role':_0xc905('0x2b')});if(_0x5d5ee1['results']['length']){_0x15e22c=_['first'](_0x5d5ee1[_0xc905('0x22')]);}}if(_0x15e22c){logger[_0xc905('0xd')]('Enduser\x20found!');return _0x15e22c;}else{logger[_0xc905('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xc905('0xe')]('%s/users.json',_0x2fb5a1['remoteUri']),'method':_0xc905('0x11'),'body':{'user':{'role':_0xc905('0x2b'),'name':util[_0xc905('0xe')](_0xc905('0x2c'),_0x3a38bc||_0x11eb1d),'phone':_0x11eb1d}}})[_0xc905('0x19')](function(_0x1b1006){logger[_0xc905('0xd')]('Enduser\x20created.');return _0x1b1006[_0xc905('0x27')];});}});}function getAuth(_0x3bb6e3){var _0x1de88f;if(_0x3bb6e3[_0xc905('0x2d')]===_0xc905('0x2e')){_0x1de88f=util[_0xc905('0xe')](_0xc905('0x2f'),_0x3bb6e3[_0xc905('0x30')],_0x3bb6e3[_0xc905('0x2e')]);}else if(_0x3bb6e3[_0xc905('0x2d')]===_0xc905('0x31')){_0x1de88f=util[_0xc905('0xe')]('%s/token:%s',_0x3bb6e3['username'],_0x3bb6e3[_0xc905('0x31')]);}return util[_0xc905('0xe')](_0xc905('0x32'),new Buffer(_0x1de88f)['toString'](_0xc905('0x33')));}function request(_0x5349ae){logger[_0xc905('0x34')]('[HTTP]',JSON[_0xc905('0x35')](_0x5349ae));return rp(_[_0xc905('0x9')](_0x5349ae,{'method':_0xc905('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x4d9d3a,_0x3ca2f4){var _0x353d9a=[];if(_0x4d9d3a&&_0x4d9d3a[_0xc905('0x29')]>0x0){_0x353d9a=_['map'](_0x4d9d3a,_0x3ca2f4);}return _0x353d9a;}function getCustomFields(_0x12cac2,_0x284e5b){var _0x556520=[];var _0xb6610a={'custom_fields':[]};if(_0x12cac2[_0xc905('0x29')]>0x0){_[_0xc905('0x37')](_0x12cac2,function(_0x51493c){if(_['includes'](['string',_0xc905('0x38')],_0x51493c[_0xc905('0x39')])&&_0x51493c[_0xc905('0x3a')]&&!_0x51493c[_0xc905('0x3b')]){_0xb6610a[_0x51493c[_0xc905('0x3a')][_0xc905('0x3c')]()]=_0x51493c[_0xc905('0x3d')][_0xc905('0x3e')]();}else if(_[_0xc905('0x3f')](['string','picklist'],_0x51493c['type'])&&_0x51493c['idField']&&_0x51493c['customField']){_0xb6610a[_0xc905('0x40')][_0xc905('0x41')]({'id':_0x51493c[_0xc905('0x42')],'value':_0x51493c['content'][_0xc905('0x3e')]()});}else if(_0x51493c[_0xc905('0x39')]===_0xc905('0x43')&&_0x51493c[_0xc905('0x44')]&&_0x51493c[_0xc905('0x42')]&&_0x51493c['customField']){_0x284e5b[_0x51493c[_0xc905('0x44')]]&&_0xb6610a[_0xc905('0x40')][_0xc905('0x41')]({'id':_0x51493c[_0xc905('0x42')],'value':_0x284e5b[_0x51493c[_0xc905('0x44')]][_0xc905('0x3e')]()});}else if(_0x51493c[_0xc905('0x39')]===_0xc905('0x45')&&_0x51493c[_0xc905('0x46')]&&_0x51493c[_0xc905('0x46')]['name']&&_0x51493c['idField']&&_0x51493c['customField']){_0x284e5b[_0x51493c[_0xc905('0x46')][_0xc905('0x14')][_0xc905('0x3c')]()]&&_0xb6610a[_0xc905('0x40')]['push']({'id':_0x51493c[_0xc905('0x42')],'value':_0x284e5b[_0x51493c['Variable']['name'][_0xc905('0x3c')]()][_0xc905('0x3e')]()});}});}return _0xb6610a;}exports[_0xc905('0x47')]=function(_0x34fd03,_0x130b7a,_0x53b061,_0x5711b0,_0x19eb34,_0x43c905){var _0x2cc1e7,_0x59290f;_0x43c905[_0xc905('0x10')]=intUtil[_0xc905('0x48')](_0x43c905[_0xc905('0x10')]);_0x43c905[_0xc905('0x49')]=intUtil['stripTrailingSlash'](_0x43c905[_0xc905('0x49')]);if(_0x19eb34&&_0x19eb34[_0xc905('0x4a')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x130b7a[_0xc905('0x4b')]=util['format'](_0xc905('0x4c'),_0x43c905['serverUrl'],_0x130b7a[_0xc905('0x4d')],md5(_0x130b7a[_0xc905('0x4d')]));}else{_0x130b7a['recordingURL']='';}headers['Authorization']=getAuth(_0x43c905);return getUser(_0x43c905,_0x5711b0['email'])[_0xc905('0x19')](function(_0x512110){_0x2cc1e7=_0x512110;logger[_0xc905('0xd')](_0xc905('0x4e'),_0x2cc1e7['id']);return getEndUser(_0x43c905,_0x130b7a[_0xc905('0x4f')],_0x130b7a[_0xc905('0x50')]);})[_0xc905('0x19')](function(_0x4336d5){_0x59290f=_0x4336d5;logger['info'](_0xc905('0x51'),_0x59290f['id']);return getTicket(_0x43c905,_0x2cc1e7,_0x59290f,_0x53b061,_0x130b7a);})[_0xc905('0x19')](function(_0x2c713b){if(_0x2c713b){logger[_0xc905('0xd')](_0xc905('0x52'),_0x2c713b['id']);switch(_0x43c905['type']){case _0xc905('0x53'):logger['info'](_0xc905('0x54'),_0xc905('0x55'));return request({'uri':util[_0xc905('0xe')](_0xc905('0x56'),_0x43c905['remoteUri'],_0x2cc1e7['id'],_0x2c713b['id']),'method':'POST'});case _0xc905('0x57'):logger[_0xc905('0xd')](_0xc905('0x54'),_0xc905('0x58'));emit(util[_0xc905('0xe')](_0xc905('0x59'),_0x5711b0[_0xc905('0x14')]),_0xc905('0x5a'),{'uri':util['format'](_0xc905('0x5b'),_0x43c905[_0xc905('0x10')]['replace'](_0xc905('0x5c'),''),_0x2c713b['id'])});break;default:logger[_0xc905('0x5d')](_0xc905('0x54'),_0xc905('0x5e'));}}})[_0xc905('0x5f')](function(_0x31b707){logger[_0xc905('0x5d')](_0xc905('0x60'),util[_0xc905('0x61')](_0x31b707,{'showHidden':!![],'depth':null}));});};exports[_0xc905('0x62')]=function(_0x5588b3,_0x55f141,_0x425a6b,_0x285abb,_0x46f96b,_0x599094,_0x6dd93d){var _0x597fff,_0xceae68;_0x599094[_0xc905('0x10')]=intUtil['stripTrailingSlash'](_0x599094[_0xc905('0x10')]);_0x599094[_0xc905('0x49')]=intUtil[_0xc905('0x48')](_0x599094['serverUrl']);if(_0x6dd93d&&_0x6dd93d[_0xc905('0x63')]&&_0x6dd93d[_0xc905('0x63')]!=='none'){logger[_0xc905('0xd')](_0xc905('0x64'),_0xc905('0x65'));_0x55f141['recordingURL']=util[_0xc905('0xe')](_0xc905('0x4c'),_0x599094['serverUrl'],_0x55f141['uniqueid'],md5(_0x55f141[_0xc905('0x4d')]));}headers[_0xc905('0x66')]=getAuth(_0x599094);return getUser(_0x599094,_0x285abb[_0xc905('0x67')])[_0xc905('0x19')](function(_0x1d9bcb){_0x597fff=_0x1d9bcb;logger['info'](_0xc905('0x4e'),_0x597fff['id']);return getEndUser(_0x599094,_0x55f141[_0xc905('0x68')],_0x55f141['destcalleridnum']);})[_0xc905('0x19')](function(_0x377a36){_0xceae68=_0x377a36;logger[_0xc905('0xd')](_0xc905('0x51'),_0xceae68['id']);return getTicket(_0x599094,_0x597fff,_0xceae68,_0x425a6b,_0x55f141);})[_0xc905('0x19')](function(_0x565a19){if(_0x565a19){logger[_0xc905('0xd')](_0xc905('0x52'),_0x565a19['id']);switch(_0x599094[_0xc905('0x39')]){case _0xc905('0x53'):logger[_0xc905('0xd')](_0xc905('0x64'),_0xc905('0x55'));return request({'uri':util['format'](_0xc905('0x56'),_0x599094[_0xc905('0x10')],_0x597fff['id'],_0x565a19['id']),'method':_0xc905('0x11')});case _0xc905('0x57'):logger['info'](_0xc905('0x64'),_0xc905('0x58'));emit(util[_0xc905('0xe')](_0xc905('0x59'),_0x285abb['name']),_0xc905('0x5a'),{'uri':util[_0xc905('0xe')](_0xc905('0x5b'),_0x599094[_0xc905('0x10')][_0xc905('0x69')](_0xc905('0x5c'),''),_0x565a19['id'])});break;default:logger['error'](_0xc905('0x64'),_0xc905('0x5e'));}}})[_0xc905('0x5f')](function(_0x38deff){logger[_0xc905('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xc905('0x61')](_0x38deff,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x171654,_0x428ca5,_0x2b308c,_0x3e9567,_0x1078bc,_0x5a98e2){var _0x3428b7,_0x37a05c;_0x5a98e2[_0xc905('0x10')]=intUtil[_0xc905('0x48')](_0x5a98e2[_0xc905('0x10')]);_0x5a98e2[_0xc905('0x49')]=intUtil['stripTrailingSlash'](_0x5a98e2[_0xc905('0x49')]);if(_0x1078bc&&_0x1078bc[_0xc905('0x4a')]){logger[_0xc905('0xd')]('['+_0x428ca5[_0xc905('0x6a')]['toUpperCase']()+']',_0xc905('0x65'));_0x428ca5[_0xc905('0x4b')]=util[_0xc905('0xe')](_0xc905('0x4c'),_0x5a98e2[_0xc905('0x49')],_0x428ca5['uniqueid'],md5(_0x428ca5[_0xc905('0x4d')]));}else{_0x428ca5[_0xc905('0x4b')]='';}headers[_0xc905('0x66')]=getAuth(_0x5a98e2);return getUser(_0x5a98e2)[_0xc905('0x19')](function(_0x1f3f5e){_0x3428b7=_0x1f3f5e;logger['info'](_0xc905('0x4e'),_0x3428b7['id']);return getEndUser(_0x5a98e2,_0x428ca5[_0xc905('0x4f')],_0x428ca5[_0xc905('0x50')]);})[_0xc905('0x19')](function(_0x49a7d5){_0x37a05c=_0x49a7d5;logger[_0xc905('0xd')](_0xc905('0x51'),_0x37a05c['id']);return getTicket(_0x5a98e2,_0x3428b7,_0x37a05c,_0x2b308c,_0x428ca5);})[_0xc905('0x19')](function(_0x449244){if(_0x449244){logger[_0xc905('0xd')]('The\x20Ticket\x20ID\x20is:',_0x449244['id']);}})[_0xc905('0x5f')](function(_0x440b5c){logger[_0xc905('0x5d')]('['+_0x428ca5[_0xc905('0x6a')][_0xc905('0x6b')]()+']'+_0xc905('0x6c'),util[_0xc905('0x61')](_0x440b5c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x82ab=['email','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','destcalleridname','replace','unmanaged','lastevent','toUpperCase','calleridnum','The\x20Enduser\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','format','remoteUri','POST','getString','Subjects','Descriptions','Fields','info','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','password','%s:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','toLowerCase','content','idField','custom_fields','push','variable','variableName','customField','customVariable','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82ab,0x1cc));var _0xb82a=function(_0x3ca1f8,_0x4afa33){_0x3ca1f8=_0x3ca1f8-0x0;var _0x94fb6b=_0x82ab[_0x3ca1f8];return _0x94fb6b;};'use strict';var _=require(_0xb82a('0x0'));var rp=require('request-promise');var md5=require(_0xb82a('0x1'));var util=require(_0xb82a('0x2'));var Redis=require('ioredis');var intUtil=require(_0xb82a('0x3'));var config=require(_0xb82a('0x4'));var logger=require('../../../../config/logger')(_0xb82a('0x5'));config[_0xb82a('0x6')]=_[_0xb82a('0x7')](config[_0xb82a('0x6')],{'host':_0xb82a('0x8'),'port':0x18eb});var io=require(_0xb82a('0x9'))(new Redis(config[_0xb82a('0x6')]));function emit(_0xe842ac,_0x14f326,_0x5f2ab6){io['to'](_0xe842ac)['emit'](_0x14f326,_0x5f2ab6);}var headers={'Content-Type':_0xb82a('0xa'),'Accept':'application/json'};function getTicket(_0x325b53,_0x348e57,_0x37bc22,_0x5737f0,_0x5e9a3b){logger['info'](_0xb82a('0xb'));return request({'uri':util[_0xb82a('0xc')]('%s/tickets.json',_0x325b53[_0xb82a('0xd')]),'method':_0xb82a('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x37bc22['id'],'submitter_id':_0x348e57?_0x348e57['id']:undefined,'assignee_id':_0x348e57?_0x348e57['id']:undefined,'tags':getTags(_0x5737f0['Tags'],'name'),'subject':intUtil[_0xb82a('0xf')](_0x5737f0[_0xb82a('0x10')],_0x5e9a3b,'\x20'),'description':intUtil[_0xb82a('0xf')](_0x5737f0[_0xb82a('0x11')],_0x5e9a3b,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb82a('0xf')](_0x5737f0[_0xb82a('0x11')],_0x5e9a3b,'\x0a')}},getCustomFields(_0x5737f0[_0xb82a('0x12')],_0x5e9a3b))}})['then'](function(_0x981526){logger[_0xb82a('0x13')](_0xb82a('0x14'));return _0x981526[_0xb82a('0x15')];});}function getUser(_0x3cf222,_0xca117c){if(intUtil['validateEmail'](_0xca117c)){logger['info'](_0xb82a('0x16'),_0xca117c);return request({'uri':util[_0xb82a('0xc')](_0xb82a('0x17'),_0x3cf222[_0xb82a('0xd')]),'qs':{'query':util[_0xb82a('0xc')](_0xb82a('0x18'),_0xca117c)}})[_0xb82a('0x19')](function(_0x405de2){if(_0x405de2[_0xb82a('0x1a')]){logger['info'](_0xb82a('0x1b'));return _[_0xb82a('0x1c')](_0x405de2[_0xb82a('0x1d')],{'email':_0xca117c,'role':_0xb82a('0x1e')});}else{logger[_0xb82a('0x13')](_0xb82a('0x1f'));return request({'uri':util[_0xb82a('0xc')]('%s/users/me.json',_0x3cf222[_0xb82a('0xd')])})[_0xb82a('0x19')](function(_0xc9927){logger[_0xb82a('0x13')]('Admin\x20account\x20selected.');return _0xc9927[_0xb82a('0x20')];});}});}else{logger[_0xb82a('0x13')](_0xb82a('0x1f'));return request({'uri':util[_0xb82a('0xc')]('%s/users/me.json',_0x3cf222[_0xb82a('0xd')])})['then'](function(_0x3c1000){logger[_0xb82a('0x13')](_0xb82a('0x21'));return _0x3c1000['user'];});}}function getEndUser(_0xa015b2,_0x314457,_0x1684e6){logger['info'](_0xb82a('0x22'),_0x1684e6);return request({'uri':util[_0xb82a('0xc')](_0xb82a('0x17'),_0xa015b2['remoteUri']),'qs':{'query':util[_0xb82a('0xc')](_0xb82a('0x23'),_0x1684e6)}})[_0xb82a('0x19')](function(_0x27b0ba){var _0xe1f31a;if(_0x27b0ba['results'][_0xb82a('0x24')]){_0x27b0ba[_0xb82a('0x1d')]=_['filter'](_0x27b0ba['results'],{'suspended':![],'role':_0xb82a('0x25')});if(_0x27b0ba[_0xb82a('0x1d')][_0xb82a('0x24')]){_0xe1f31a=_[_0xb82a('0x26')](_0x27b0ba[_0xb82a('0x1d')]);}}if(_0xe1f31a){logger[_0xb82a('0x13')](_0xb82a('0x27'));return _0xe1f31a;}else{logger[_0xb82a('0x13')](_0xb82a('0x28'));return request({'uri':util[_0xb82a('0xc')](_0xb82a('0x29'),_0xa015b2[_0xb82a('0xd')]),'method':'POST','body':{'user':{'role':_0xb82a('0x25'),'name':util[_0xb82a('0xc')](_0xb82a('0x2a'),_0x314457||_0x1684e6),'phone':_0x1684e6}}})[_0xb82a('0x19')](function(_0x18c262){logger[_0xb82a('0x13')]('Enduser\x20created.');return _0x18c262['user'];});}});}function getAuth(_0x27622d){var _0x535bb5;if(_0x27622d['authType']===_0xb82a('0x2b')){_0x535bb5=util[_0xb82a('0xc')](_0xb82a('0x2c'),_0x27622d['username'],_0x27622d[_0xb82a('0x2b')]);}else if(_0x27622d['authType']===_0xb82a('0x2d')){_0x535bb5=util[_0xb82a('0xc')]('%s/token:%s',_0x27622d['username'],_0x27622d[_0xb82a('0x2d')]);}return util[_0xb82a('0xc')](_0xb82a('0x2e'),new Buffer(_0x535bb5)[_0xb82a('0x2f')](_0xb82a('0x30')));}function request(_0x10472f){logger[_0xb82a('0x31')](_0xb82a('0x32'),JSON[_0xb82a('0x33')](_0x10472f));return rp(_[_0xb82a('0x7')](_0x10472f,{'method':_0xb82a('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x5a9950,_0x27ff98){var _0x2fa0b7=[];if(_0x5a9950&&_0x5a9950['length']>0x0){_0x2fa0b7=_[_0xb82a('0x35')](_0x5a9950,_0x27ff98);}return _0x2fa0b7;}function getCustomFields(_0x3bef16,_0x131856){var _0x4dca8c=[];var _0x2ec3bf={'custom_fields':[]};if(_0x3bef16['length']>0x0){_[_0xb82a('0x36')](_0x3bef16,function(_0x43939f){if(_[_0xb82a('0x37')]([_0xb82a('0x38'),_0xb82a('0x39')],_0x43939f[_0xb82a('0x3a')])&&_0x43939f['nameField']&&!_0x43939f['customField']){_0x2ec3bf[_0x43939f['nameField'][_0xb82a('0x3b')]()]=_0x43939f[_0xb82a('0x3c')][_0xb82a('0x2f')]();}else if(_[_0xb82a('0x37')]([_0xb82a('0x38'),_0xb82a('0x39')],_0x43939f['type'])&&_0x43939f[_0xb82a('0x3d')]&&_0x43939f['customField']){_0x2ec3bf[_0xb82a('0x3e')][_0xb82a('0x3f')]({'id':_0x43939f[_0xb82a('0x3d')],'value':_0x43939f[_0xb82a('0x3c')][_0xb82a('0x2f')]()});}else if(_0x43939f['type']===_0xb82a('0x40')&&_0x43939f[_0xb82a('0x41')]&&_0x43939f[_0xb82a('0x3d')]&&_0x43939f[_0xb82a('0x42')]){_0x131856[_0x43939f[_0xb82a('0x41')]]&&_0x2ec3bf[_0xb82a('0x3e')][_0xb82a('0x3f')]({'id':_0x43939f['idField'],'value':_0x131856[_0x43939f[_0xb82a('0x41')]][_0xb82a('0x2f')]()});}else if(_0x43939f[_0xb82a('0x3a')]===_0xb82a('0x43')&&_0x43939f['Variable']&&_0x43939f[_0xb82a('0x44')][_0xb82a('0x45')]&&_0x43939f[_0xb82a('0x3d')]&&_0x43939f[_0xb82a('0x42')]){_0x131856[_0x43939f[_0xb82a('0x44')][_0xb82a('0x45')][_0xb82a('0x3b')]()]&&_0x2ec3bf['custom_fields'][_0xb82a('0x3f')]({'id':_0x43939f[_0xb82a('0x3d')],'value':_0x131856[_0x43939f[_0xb82a('0x44')][_0xb82a('0x45')]['toLowerCase']()][_0xb82a('0x2f')]()});}});}return _0x2ec3bf;}exports[_0xb82a('0x46')]=function(_0x1595f9,_0x2b876d,_0x2cb8d3,_0x8c1df5,_0x584843,_0xd518fe){var _0x166699,_0x5f1725;_0xd518fe[_0xb82a('0xd')]=intUtil['stripTrailingSlash'](_0xd518fe['remoteUri']);_0xd518fe[_0xb82a('0x47')]=intUtil[_0xb82a('0x48')](_0xd518fe[_0xb82a('0x47')]);if(_0x584843&&_0x584843[_0xb82a('0x49')]){logger[_0xb82a('0x13')](_0xb82a('0x4a'),_0xb82a('0x4b'));_0x2b876d[_0xb82a('0x4c')]=util[_0xb82a('0xc')](_0xb82a('0x4d'),_0xd518fe[_0xb82a('0x47')],_0x2b876d[_0xb82a('0x4e')],md5(_0x2b876d[_0xb82a('0x4e')]));}else{_0x2b876d[_0xb82a('0x4c')]='';}headers[_0xb82a('0x4f')]=getAuth(_0xd518fe);return getUser(_0xd518fe,_0x8c1df5[_0xb82a('0x50')])[_0xb82a('0x19')](function(_0x30db1c){_0x166699=_0x30db1c;logger[_0xb82a('0x13')](_0xb82a('0x51'),_0x166699['id']);return getEndUser(_0xd518fe,_0x2b876d[_0xb82a('0x52')],_0x2b876d['calleridnum']);})[_0xb82a('0x19')](function(_0x52e3ac){_0x5f1725=_0x52e3ac;logger[_0xb82a('0x13')]('The\x20Enduser\x20ID\x20is:',_0x5f1725['id']);return getTicket(_0xd518fe,_0x166699,_0x5f1725,_0x2cb8d3,_0x2b876d);})[_0xb82a('0x19')](function(_0x1f4c58){if(_0x1f4c58){logger['info'](_0xb82a('0x53'),_0x1f4c58['id']);switch(_0xd518fe[_0xb82a('0x3a')]){case'integrationTab':logger[_0xb82a('0x13')](_0xb82a('0x4a'),_0xb82a('0x54'));return request({'uri':util[_0xb82a('0xc')](_0xb82a('0x55'),_0xd518fe['remoteUri'],_0x166699['id'],_0x1f4c58['id']),'method':_0xb82a('0xe')});case _0xb82a('0x56'):logger[_0xb82a('0x13')]('[QUEUE]',_0xb82a('0x57'));emit(util['format'](_0xb82a('0x58'),_0x8c1df5[_0xb82a('0x45')]),_0xb82a('0x59'),{'uri':util[_0xb82a('0xc')](_0xb82a('0x5a'),_0xd518fe[_0xb82a('0xd')]['replace'](_0xb82a('0x5b'),''),_0x1f4c58['id'])});break;default:logger['error'](_0xb82a('0x4a'),_0xb82a('0x5c'));}}})[_0xb82a('0x5d')](function(_0x375912){logger[_0xb82a('0x5e')](_0xb82a('0x5f'),util[_0xb82a('0x60')](_0x375912,{'showHidden':!![],'depth':null}));});};exports[_0xb82a('0x61')]=function(_0x5b9950,_0x596032,_0x2cf764,_0x75fa7a,_0x578a5d,_0x5ea13d,_0x485fa8){var _0x10606c,_0x60031b;_0x5ea13d[_0xb82a('0xd')]=intUtil[_0xb82a('0x48')](_0x5ea13d[_0xb82a('0xd')]);_0x5ea13d['serverUrl']=intUtil[_0xb82a('0x48')](_0x5ea13d[_0xb82a('0x47')]);if(_0x485fa8&&_0x485fa8[_0xb82a('0x62')]&&_0x485fa8['recordingFormat']!=='none'){logger['info'](_0xb82a('0x63'),'Recording\x20is\x20enabled!');_0x596032[_0xb82a('0x4c')]=util[_0xb82a('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5ea13d[_0xb82a('0x47')],_0x596032['uniqueid'],md5(_0x596032[_0xb82a('0x4e')]));}headers['Authorization']=getAuth(_0x5ea13d);return getUser(_0x5ea13d,_0x75fa7a[_0xb82a('0x50')])[_0xb82a('0x19')](function(_0x1e8fa7){_0x10606c=_0x1e8fa7;logger[_0xb82a('0x13')](_0xb82a('0x51'),_0x10606c['id']);return getEndUser(_0x5ea13d,_0x596032[_0xb82a('0x64')],_0x596032['destcalleridnum']);})['then'](function(_0x4a9d9d){_0x60031b=_0x4a9d9d;logger['info']('The\x20Enduser\x20ID\x20is:',_0x60031b['id']);return getTicket(_0x5ea13d,_0x10606c,_0x60031b,_0x2cf764,_0x596032);})[_0xb82a('0x19')](function(_0x174286){if(_0x174286){logger[_0xb82a('0x13')](_0xb82a('0x53'),_0x174286['id']);switch(_0x5ea13d[_0xb82a('0x3a')]){case'integrationTab':logger[_0xb82a('0x13')](_0xb82a('0x63'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5ea13d[_0xb82a('0xd')],_0x10606c['id'],_0x174286['id']),'method':'POST'});case _0xb82a('0x56'):logger['info'](_0xb82a('0x63'),_0xb82a('0x57'));emit(util['format']('user:%s',_0x75fa7a[_0xb82a('0x45')]),_0xb82a('0x59'),{'uri':util[_0xb82a('0xc')](_0xb82a('0x5a'),_0x5ea13d[_0xb82a('0xd')][_0xb82a('0x65')](_0xb82a('0x5b'),''),_0x174286['id'])});break;default:logger[_0xb82a('0x5e')]('[OUTBOUND]',_0xb82a('0x5c'));}}})[_0xb82a('0x5d')](function(_0x48e9cb){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xb82a('0x60')](_0x48e9cb,{'showHidden':!![],'depth':null}));});};exports[_0xb82a('0x66')]=function(_0x2c3c06,_0x1da3f6,_0x232509,_0x5d9c4f,_0x3d2444,_0x513882){var _0x492339,_0x49af75;_0x513882['remoteUri']=intUtil[_0xb82a('0x48')](_0x513882[_0xb82a('0xd')]);_0x513882[_0xb82a('0x47')]=intUtil[_0xb82a('0x48')](_0x513882[_0xb82a('0x47')]);if(_0x3d2444&&_0x3d2444[_0xb82a('0x49')]){logger['info']('['+_0x1da3f6[_0xb82a('0x67')][_0xb82a('0x68')]()+']',_0xb82a('0x4b'));_0x1da3f6[_0xb82a('0x4c')]=util['format'](_0xb82a('0x4d'),_0x513882['serverUrl'],_0x1da3f6[_0xb82a('0x4e')],md5(_0x1da3f6[_0xb82a('0x4e')]));}else{_0x1da3f6[_0xb82a('0x4c')]='';}headers['Authorization']=getAuth(_0x513882);return getUser(_0x513882)[_0xb82a('0x19')](function(_0x2183cc){_0x492339=_0x2183cc;logger[_0xb82a('0x13')](_0xb82a('0x51'),_0x492339['id']);return getEndUser(_0x513882,_0x1da3f6['calleridname'],_0x1da3f6[_0xb82a('0x69')]);})['then'](function(_0x28338d){_0x49af75=_0x28338d;logger[_0xb82a('0x13')](_0xb82a('0x6a'),_0x49af75['id']);return getTicket(_0x513882,_0x492339,_0x49af75,_0x232509,_0x1da3f6);})['then'](function(_0x39d7e5){if(_0x39d7e5){logger[_0xb82a('0x13')]('The\x20Ticket\x20ID\x20is:',_0x39d7e5['id']);}})['catch'](function(_0x484ad2){logger[_0xb82a('0x5e')]('['+_0x1da3f6[_0xb82a('0x67')][_0xb82a('0x68')]()+']'+_0xb82a('0x6b'),util['inspect'](_0x484ad2,{'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 801141d..3f10568 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 _0x9b00=['talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','Call_Result','Called','complete','Answered','Rejected','Timeout','Call_Start_Time','outbound','Inbound','merge','Fields','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged','lastevent','calleridname','toUpperCase','lodash','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','localhost','socket.io-emitter','redis','emit','debug','[HTTP]','stringify','length','forEach','includes','string','type','idField','toString','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','moduleCreate','role','first_name','last_name','code','SUCCESS','details','log','CREATE\x20ERROR','GET','contact_lead','uri','https://www.zohoapis.','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','profile','administrator','Subject','getString','Subjects','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','startCase'];(function(_0x430ce1,_0x12449a){var _0x3c64e9=function(_0x496bce){while(--_0x496bce){_0x430ce1['push'](_0x430ce1['shift']());}};_0x3c64e9(++_0x12449a);}(_0x9b00,0xcc));var _0x09b0=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x9b00[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x09b0('0x0'));var rp=require(_0x09b0('0x1'));var md5=require(_0x09b0('0x2'));var util=require('util');var intUtil=require(_0x09b0('0x3'));var moment=require(_0x09b0('0x4'));var Redis=require(_0x09b0('0x5'));var BPromise=require(_0x09b0('0x6'));var config=require(_0x09b0('0x7'));var logger=require(_0x09b0('0x8'))(_0x09b0('0x9'));config['redis']=_[_0x09b0('0xa')](config['redis'],{'host':_0x09b0('0xb'),'port':0x18eb});var io=require(_0x09b0('0xc'))(new Redis(config[_0x09b0('0xd')]));function emit(_0x4290c7,_0x1bc2ce,_0x419960){io['to'](_0x4290c7)[_0x09b0('0xe')](_0x1bc2ce,_0x419960);}function request(_0x541785){logger[_0x09b0('0xf')](_0x09b0('0x10'),JSON[_0x09b0('0x11')](_0x541785));return rp(_0x541785);}function getCustomFields(_0x247ab0,_0x3847f9){var _0x344aed={};if(_0x247ab0[_0x09b0('0x12')]>0x0){_[_0x09b0('0x13')](_0x247ab0,function(_0x2d487b){if(_[_0x09b0('0x14')]([_0x09b0('0x15'),'picklist'],_0x2d487b[_0x09b0('0x16')])&&_0x2d487b[_0x09b0('0x17')]){_0x344aed[_0x2d487b[_0x09b0('0x17')]]=_0x2d487b['content'][_0x09b0('0x18')]();}else if(_0x2d487b[_0x09b0('0x16')]==='variable'&&_0x2d487b[_0x09b0('0x19')]&&_0x2d487b['idField']&&_0x3847f9[_0x2d487b[_0x09b0('0x19')]]){_0x344aed[_0x2d487b[_0x09b0('0x17')]]=_0x3847f9[_0x2d487b[_0x09b0('0x19')]][_0x09b0('0x18')]();}else if(_0x2d487b['type']==='customVariable'&&_0x2d487b['Variable']&&_0x2d487b[_0x09b0('0x1a')][_0x09b0('0x1b')]&&_0x2d487b['idField']&&_0x3847f9[_0x2d487b[_0x09b0('0x1a')]['name']['toLowerCase']()]){_0x344aed[_0x2d487b['idField']]=_0x3847f9[_0x2d487b[_0x09b0('0x1a')][_0x09b0('0x1b')][_0x09b0('0x1c')]()][_0x09b0('0x18')]();}});}return _0x344aed;}function getName(_0xe6757e){if(_0xe6757e[_0x09b0('0x1d')]('\x20')>0x0){var _0x2ab991=_0xe6757e[_0x09b0('0x1e')](/ (.+)/);if(_0x2ab991[0x1]){return _0x2ab991;}}return[_0xe6757e,_0xe6757e];}var accountsTokens={};function getAccessToken(_0x4b0c2c){return new Promise(function(_0x243da2,_0x4a4554){if(!_[_0x09b0('0x1f')](accountsTokens[_0x4b0c2c['id']])&&!_[_0x09b0('0x1f')](accountsTokens[_0x4b0c2c['id']][_0x09b0('0x20')])){if(moment()[_0x09b0('0x21')](accountsTokens[_0x4b0c2c['id']][_0x09b0('0x22')])){_0x243da2(accountsTokens[_0x4b0c2c['id']]['access_token']);}}var _0x2e301e;switch(_0x4b0c2c['zone']){case'US':_0x2e301e='https://accounts.zoho.com';break;case'AU':_0x2e301e=_0x09b0('0x23');break;case'EU':_0x2e301e='https://accounts.zoho.eu';break;case'IN':_0x2e301e=_0x09b0('0x24');break;case'CN':_0x2e301e=_0x09b0('0x25');break;default:_0x2e301e='https://accounts.zoho.eu';break;}var _0x1e6324={'method':_0x09b0('0x26'),'uri':_0x2e301e+_0x09b0('0x27'),'qs':{'refresh_token':_0x4b0c2c[_0x09b0('0x28')],'client_id':_0x4b0c2c[_0x09b0('0x29')],'client_secret':_0x4b0c2c[_0x09b0('0x2a')],'grant_type':_0x09b0('0x2b')},'json':!![]};return rp(_0x1e6324)[_0x09b0('0x2c')](function(_0x35f7cd){accountsTokens[_0x4b0c2c['id']]={'access_token':_0x35f7cd[_0x09b0('0x20')],'expires_in':moment()[_0x09b0('0x2d')](_0x35f7cd[_0x09b0('0x22')],'seconds')};_0x243da2(_0x35f7cd[_0x09b0('0x20')]);})['catch'](function(_0x2ee741){logger['error'](_0x09b0('0x2e'),_0x2ee741[_0x09b0('0x2f')]);_0x4a4554(_0x2ee741);});});}function getUser(_0x16a864,_0x37e380,_0x58d2d7,_0x2f3850){logger[_0x09b0('0x30')](_0x09b0('0x31'));return request({'method':'GET','uri':util[_0x09b0('0x32')](_0x09b0('0x33'),_0x37e380),'qs':{'type':_0x09b0('0x34')},'headers':{'Authorization':_0x09b0('0x35')+_0x16a864},'json':!![]})[_0x09b0('0x2c')](function(_0x5ac4e9){if(_0x5ac4e9[_0x09b0('0x36')]){var _0x433864=-0x1;if(_[_0x09b0('0x37')](_0x5ac4e9[_0x09b0('0x36')])){if(!_[_0x09b0('0x1f')](_0x2f3850)){_0x433864=_[_0x09b0('0x38')](_0x5ac4e9[_0x09b0('0x36')],function(_0x2bf698){return _0x2bf698[_0x09b0('0x39')]===_0x2f3850;});}if(_0x433864>=0x0){logger[_0x09b0('0x30')](_0x09b0('0x3a'));}else{logger[_0x09b0('0x30')]('Using\x20the\x20admin\x20account!');_0x433864=_[_0x09b0('0x38')](_0x5ac4e9['users'],function(_0x15a362){return _0x15a362['profile'][_0x09b0('0x1b')]===_0x09b0('0x3b');});}return _0x5ac4e9[_0x09b0('0x36')][_0x433864];}else{if(_0x5ac4e9[_0x09b0('0x3c')]['profile']['name']===_0x09b0('0x3b')){logger[_0x09b0('0x30')](_0x09b0('0x3d'));user=_0x5ac4e9[_0x09b0('0x3c')];return user;}else{logger['error'](_0x09b0('0x3e'),JSON['stringify'](_0x5ac4e9));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x09b0('0x11')](_0x5ac4e9));}}}else{logger[_0x09b0('0x3f')](_0x09b0('0x3e'),JSON[_0x09b0('0x11')](_0x5ac4e9));throw new Error(_0x09b0('0x40')+JSON[_0x09b0('0x11')](_0x5ac4e9));}})[_0x09b0('0x41')](function(_0x4b5ec4){console[_0x09b0('0x3f')](_0x4b5ec4);});}function getZohoUser(_0x280a32,_0x2ce7e9){return new BPromise(function(_0x53147a,_0x21470b){request(_0x280a32)[_0x09b0('0x2c')](function(_0x1aa9e9){var _0x17d494=null;if(_0x1aa9e9){_0x17d494=_0x1aa9e9[_0x09b0('0x42')][0x0];_0x17d494[_0x09b0('0x43')]=_0x2ce7e9;}_0x53147a(_0x17d494);})[_0x09b0('0x41')](function(_0x38083b){_0x21470b(_0x38083b);});});}function createEndUser(_0x2aa147,_0x2b431a,_0x12a163,_0x3a5aad,_0x531dbb,_0x190266){var _0x12a163=getName(_0x12a163);return request({'method':_0x09b0('0x26'),'uri':'https://www.zohoapis.'+_0x2b431a+'/crm/v2/'+_['startCase'](_0x190266[_0x09b0('0x44')])+'s','body':{'data':[{'Last_Name':_0x12a163[0x1],'First_Name':_0x12a163[0x0],'Phone':_0x3a5aad,'Owner':{'name':!_[_0x09b0('0x1f')](_0x531dbb[_0x09b0('0x45')]['name'])?_0x531dbb[_0x09b0('0x45')][_0x09b0('0x1b')]:!_[_0x09b0('0x1f')](_0x531dbb[_0x09b0('0x46')])?_0x531dbb[_0x09b0('0x46')]+'\x20'+_0x531dbb['last_name']:_0x531dbb[_0x09b0('0x47')],'id':_0x531dbb['id']}}]},'headers':{'Authorization':_0x09b0('0x35')+_0x2aa147},'json':!![]})[_0x09b0('0x2c')](function(_0x5e154f){if(_0x5e154f&&_0x5e154f[_0x09b0('0x42')][0x0][_0x09b0('0x48')]===_0x09b0('0x49')){var _0x291ee8=_0x5e154f[_0x09b0('0x42')][0x0][_0x09b0('0x4a')];_0x291ee8[_0x09b0('0x43')]=_['startCase'](_0x190266['moduleCreate'])+'s';return _0x291ee8;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x09b0('0x11')](data));throw new Error('Error:\x20'+JSON[_0x09b0('0x11')](data));})[_0x09b0('0x41')](function(_0x57f2f3){console[_0x09b0('0x4b')](_0x09b0('0x4c'),_0x57f2f3);});}function getEndUser(_0x10b02e,_0x4a8f13,_0x4b5c71,_0x286427,_0x4238d9,_0x2d22bc,_0x51bf70){var _0x288122={'method':_0x09b0('0x4d'),'uri':'','headers':{'Authorization':_0x09b0('0x35')+_0x10b02e},'json':!![]};switch(_0x51bf70['moduleSearch']){case _0x09b0('0x4e'):_0x288122[_0x09b0('0x4f')]=_0x09b0('0x50')+_0x4a8f13+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4238d9+'))';return getZohoUser(_0x288122,_0x09b0('0x51'))[_0x09b0('0x2c')](function(_0x1af6bc){if(_0x1af6bc)return _0x1af6bc;_0x288122[_0x09b0('0x4f')]='https://www.zohoapis.'+_0x4a8f13+_0x09b0('0x52')+_0x4238d9+'))';return getZohoUser(_0x288122,_0x09b0('0x53'))[_0x09b0('0x2c')](function(_0x78a2b6){if(_0x78a2b6)return _0x78a2b6;if(_0x51bf70[_0x09b0('0x44')]!=_0x09b0('0x54')){return createEndUser(_0x10b02e,_0x4a8f13,_0x286427,_0x4238d9,_0x2d22bc,_0x51bf70);}else{return{};}});});break;case _0x09b0('0x55'):_0x288122[_0x09b0('0x4f')]=_0x09b0('0x50')+_0x4a8f13+_0x09b0('0x56')+_0x4238d9+'))';return getZohoUser(_0x288122,_0x09b0('0x51'))[_0x09b0('0x2c')](function(_0x5a1ace){if(_0x5a1ace)return _0x5a1ace;if(_0x51bf70['moduleCreate']!='nothing'){return createEndUser(_0x10b02e,_0x4a8f13,_0x286427,_0x4238d9,_0x2d22bc,_0x51bf70);}else{return{};}});break;case _0x09b0('0x57'):_0x288122['uri']=_0x09b0('0x50')+_0x4a8f13+_0x09b0('0x52')+_0x4238d9+'))';return getZohoUser(_0x288122,_0x09b0('0x53'))['then'](function(_0x5687d3){if(_0x5687d3)return _0x5687d3;if(_0x51bf70[_0x09b0('0x44')]!=_0x09b0('0x54')){return createEndUser(_0x10b02e,_0x4a8f13,_0x286427,_0x4238d9,_0x2d22bc,_0x51bf70);}else{return{};}});break;}}function getCall(_0xb21291,_0x17298d,_0x562918,_0x216af5,_0xca921c,_0xeb9465,_0x390cf3,_0x4d107b){logger[_0x09b0('0x30')](_0x09b0('0x58'));var _0x34f69e={};_0x34f69e[_0x09b0('0x59')]={'name':!_[_0x09b0('0x1f')](_0x216af5['role'][_0x09b0('0x1b')])&&!_[_0x09b0('0x1f')](_0x216af5[_0x09b0('0x5a')][_0x09b0('0x1b')])&&_0x216af5[_0x09b0('0x5a')][_0x09b0('0x1b')]===_0x09b0('0x5b')?_0x216af5['role'][_0x09b0('0x1b')]:!_['isNil'](_0x216af5['first_name'])?_0x216af5[_0x09b0('0x46')]+'\x20'+_0x216af5[_0x09b0('0x47')]:_0x216af5[_0x09b0('0x47')],'id':_0x216af5['id']};_0x34f69e[_0x09b0('0x5c')]=intUtil[_0x09b0('0x5d')](_0xeb9465[_0x09b0('0x5e')],_0x390cf3,'\x20');_0x34f69e['Description']=intUtil['getString'](_0xeb9465[_0x09b0('0x5f')],_0x390cf3,'\x0a');if(_0xca921c[_0x09b0('0x43')]==='Contacts'){_0x34f69e['Who_Id']={'name':!_[_0x09b0('0x1f')](_0xca921c[_0x09b0('0x60')])?_0xca921c[_0x09b0('0x60')]:!_['isNil'](_0xca921c['First_Name'])?_0xca921c[_0x09b0('0x61')]+'\x20'+_0xca921c[_0x09b0('0x62')]:_0xca921c['Last_Name'],'id':_0xca921c['id']};}if(_0xca921c[_0x09b0('0x43')]===_0x09b0('0x53')){_0x34f69e[_0x09b0('0x63')]={'name':!_[_0x09b0('0x1f')](_0xca921c['Full_Name'])?_0xca921c[_0x09b0('0x60')]:!_[_0x09b0('0x1f')](_0xca921c['First_Name'])?_0xca921c[_0x09b0('0x61')]+'\x20'+_0xca921c[_0x09b0('0x62')]:_0xca921c[_0x09b0('0x62')],'id':_0xca921c['id']};_0x34f69e[_0x09b0('0x64')]=_[_0x09b0('0x65')](_0xca921c[_0x09b0('0x43')]);}if(_0x390cf3[_0x09b0('0x66')]){_0x34f69e[_0x09b0('0x67')]=moment[_0x09b0('0x68')](parseInt(_0x390cf3[_0x09b0('0x66')])*0x3e8)[_0x09b0('0x32')]('mm:ss');}else if(_0x390cf3[_0x09b0('0x69')]&&_0x390cf3[_0x09b0('0x6a')]){_0x34f69e[_0x09b0('0x67')]=moment[_0x09b0('0x68')](moment(_0x390cf3['endtime'],_0x09b0('0x6b'))[_0x09b0('0x6c')](moment(_0x390cf3[_0x09b0('0x6d')],'YYYY-MM-DDTHH:mm:ss')))[_0x09b0('0x32')](_0x09b0('0x6e'));}switch(_0x390cf3['lastevent']){case'called':_0x34f69e[_0x09b0('0x6f')]=_0x09b0('0x70');break;case _0x09b0('0x71'):case'connect':_0x34f69e[_0x09b0('0x6f')]=_0x09b0('0x72');break;case'rejected':_0x34f69e[_0x09b0('0x6f')]=_0x09b0('0x73');break;case'abandoned':_0x34f69e[_0x09b0('0x6f')]='Abandoned';break;case'timeout':_0x34f69e['Call_Result']=_0x09b0('0x74');default:}_0x34f69e[_0x09b0('0x75')]=(_0x4d107b===_0x09b0('0x76')?moment(_0x390cf3[_0x09b0('0x6d')])[_0x09b0('0x32')](_0x09b0('0x6b')):moment(_0x390cf3['agentcalledAt'])[_0x09b0('0x32')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x09b0('0x32')](_0x09b0('0x6b'));_0x34f69e['Call_Type']=_0x4d107b||_0x09b0('0x77');_0x34f69e=_[_0x09b0('0x78')](_0x34f69e,getCustomFields(_0xeb9465[_0x09b0('0x79')],_0x390cf3));return request({'method':_0x09b0('0x26'),'uri':_0x09b0('0x50')+_0x17298d+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xb21291},'body':{'data':[_0x34f69e]},'json':!![]})[_0x09b0('0x2c')](function(_0x5a333e){if(_0x5a333e&&_0x5a333e[_0x09b0('0x42')][0x0]['code']===_0x09b0('0x49')){logger[_0x09b0('0x30')]('Call\x20created!');return{'id':_0x5a333e[_0x09b0('0x42')][0x0][_0x09b0('0x4a')]['id']};}})[_0x09b0('0x41')](function(_0x1298d5){logger['info'](_0x09b0('0x7a'),_0x1298d5[_0x09b0('0x2f')]);console[_0x09b0('0x4b')](_0x09b0('0x7a'),_0x1298d5);});}exports[_0x09b0('0x7b')]=function(_0x1ce9a7,_0x1250ec,_0x1c3fb2,_0x134cf5,_0x3ba511,_0x281ad9){var _0x34496f,_0x102cbf,_0x377cd7;_0x281ad9[_0x09b0('0x7c')]=intUtil[_0x09b0('0x7d')](_0x281ad9[_0x09b0('0x7c')]);_0x281ad9[_0x09b0('0x7e')]=intUtil[_0x09b0('0x7d')](_0x281ad9[_0x09b0('0x7e')]);if(_0x3ba511&&_0x3ba511[_0x09b0('0x7f')]){logger[_0x09b0('0x30')]('[QUEUE]',_0x09b0('0x80'));_0x1250ec[_0x09b0('0x81')]=_0x281ad9['serverUrl']+_0x09b0('0x82')+_0x1250ec[_0x09b0('0x83')]+_0x09b0('0x84')+md5(_0x1250ec[_0x09b0('0x83')]);}else{_0x1250ec[_0x09b0('0x81')]='';}var _0x4305f8=_0x281ad9['host']===_0x09b0('0x85')?'eu':_0x09b0('0x86');return getAccessToken(_0x281ad9)[_0x09b0('0x2c')](function(_0x3b6463){_0x377cd7=_0x3b6463;return getUser(_0x377cd7,_0x4305f8,_0x281ad9,_0x134cf5['email']);})['then'](function(_0x574528){_0x34496f=_0x574528;logger[_0x09b0('0x30')](_0x09b0('0x87'),_0x34496f['id']);return getEndUser(_0x377cd7,_0x4305f8,_0x281ad9,_0x1250ec['calleridname'],_0x1250ec[_0x09b0('0x88')],_0x34496f,_0x1c3fb2);})[_0x09b0('0x2c')](function(_0xc9b1b7){_0x102cbf=_0xc9b1b7;return getCall(_0x377cd7,_0x4305f8,_0x281ad9,_0x34496f,_0x102cbf,_0x1c3fb2,_0x1250ec,_0x09b0('0x77'));})[_0x09b0('0x2c')](function(_0x1a8cb5){if(_0x1a8cb5){logger[_0x09b0('0x30')]('The\x20Call\x20ID\x20is:',_0x1a8cb5['id']);logger[_0x09b0('0x30')](_0x09b0('0x89'),_0x09b0('0x8a'));emit(util[_0x09b0('0x32')](_0x09b0('0x8b'),_0x134cf5[_0x09b0('0x1b')]),_0x09b0('0x8c'),{'uri':_0x09b0('0x8d')+_0x281ad9['host']+_0x09b0('0x8e')+_0x1a8cb5['id']});}})['catch'](function(_0x280931){logger[_0x09b0('0x3f')](_0x09b0('0x89'),JSON['stringify'](_0x280931));});};exports['outbound']=function(_0x1bb5bd,_0x1ea5bd,_0x29c4e5,_0x5e3ba2,_0x1e739e,_0x3d762d,_0x366955){var _0x2ba565,_0xbbcb8f,_0x530bbe;_0x3d762d['host']=intUtil[_0x09b0('0x7d')](_0x3d762d[_0x09b0('0x7c')]);_0x3d762d[_0x09b0('0x7e')]=intUtil[_0x09b0('0x7d')](_0x3d762d[_0x09b0('0x7e')]);if(_0x366955&&_0x366955[_0x09b0('0x8f')]&&_0x366955['recordingFormat']!==_0x09b0('0x90')){logger[_0x09b0('0x30')]('[OUTBOUND]',_0x09b0('0x80'));_0x1ea5bd[_0x09b0('0x81')]=_0x3d762d['serverUrl']+'/api/voice/recordings/'+_0x1ea5bd[_0x09b0('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x1ea5bd['uniqueid']);}var _0x4de1c6=_0x3d762d[_0x09b0('0x7c')]===_0x09b0('0x85')?'eu':'com';return getAccessToken(_0x3d762d)[_0x09b0('0x2c')](function(_0x1627e3){_0x530bbe=_0x1627e3;return getUser(_0x530bbe,_0x4de1c6,_0x3d762d,_0x5e3ba2[_0x09b0('0x39')]);})['then'](function(_0x873dfd){_0x2ba565=_0x873dfd;logger['info'](_0x09b0('0x87'),_0x2ba565['id']);return getEndUser(_0x530bbe,_0x4de1c6,_0x3d762d,_0x1ea5bd['destcalleridname'],_0x1ea5bd[_0x09b0('0x91')],_0x2ba565,_0x29c4e5);})[_0x09b0('0x2c')](function(_0x5b9d65){_0xbbcb8f=_0x5b9d65;return getCall(_0x530bbe,_0x4de1c6,_0x3d762d,_0x2ba565,_0xbbcb8f,_0x29c4e5,_0x1ea5bd,_0x09b0('0x92'));})['then'](function(_0xa864ee){if(_0xa864ee){logger[_0x09b0('0x30')](_0x09b0('0x93'),_0xa864ee['id']);logger[_0x09b0('0x30')](_0x09b0('0x94'),_0x09b0('0x8a'));emit(util[_0x09b0('0x32')](_0x09b0('0x8b'),_0x5e3ba2[_0x09b0('0x1b')]),_0x09b0('0x8c'),{'uri':_0x09b0('0x8d')+_0x3d762d['host']+'/crm/EntityInfo.do?module=Calls&id='+_0xa864ee['id']});}})[_0x09b0('0x41')](function(_0x2c1759){logger['error'](_0x09b0('0x94'),JSON[_0x09b0('0x11')](_0x2c1759));});};exports[_0x09b0('0x95')]=function(_0x47b214,_0x1a4b40,_0x56d8be,_0xfde7cd,_0x1ff9db,_0x4b9536){var _0x29d5d9,_0x2c0879,_0xc6986c;_0x4b9536[_0x09b0('0x7c')]=intUtil[_0x09b0('0x7d')](_0x4b9536[_0x09b0('0x7c')]);_0x4b9536['serverUrl']=intUtil['stripTrailingSlash'](_0x4b9536['serverUrl']);if(_0x1ff9db&&_0x1ff9db[_0x09b0('0x7f')]){logger[_0x09b0('0x30')]('['+_0x1a4b40[_0x09b0('0x96')]['toUpperCase']()+']',_0x09b0('0x80'));_0x1a4b40[_0x09b0('0x81')]=_0x4b9536[_0x09b0('0x7e')]+_0x09b0('0x82')+_0x1a4b40[_0x09b0('0x83')]+_0x09b0('0x84')+md5(_0x1a4b40[_0x09b0('0x83')]);}else{_0x1a4b40['recordingURL']='';}var _0x735671=_0x4b9536[_0x09b0('0x7c')]==='zoho.eu'?'eu':_0x09b0('0x86');return getAccessToken(_0x4b9536)[_0x09b0('0x2c')](function(_0x1dae36){_0xc6986c=_0x1dae36;return getUser(_0xc6986c,_0x735671,_0x4b9536);})['then'](function(_0x44d8fc){_0x29d5d9=_0x44d8fc;logger[_0x09b0('0x30')]('The\x20User\x20ID\x20is:',_0x29d5d9['id']);return getEndUser(_0xc6986c,_0x735671,_0x4b9536,_0x1a4b40[_0x09b0('0x97')],_0x1a4b40[_0x09b0('0x88')],_0x29d5d9,_0x56d8be);})['then'](function(_0x5caa95){_0x2c0879=_0x5caa95;return getCall(_0xc6986c,_0x735671,_0x4b9536,_0x29d5d9,_0x2c0879,_0x56d8be,_0x1a4b40,'Inbound');})[_0x09b0('0x2c')](function(_0x2998dd){if(_0x2998dd){logger[_0x09b0('0x30')]('The\x20Call\x20ID\x20is:',_0x2998dd['id']);}})['catch'](function(_0x2df708){logger[_0x09b0('0x3f')]('['+_0x1a4b40[_0x09b0('0x96')][_0x09b0('0x98')]()+']',JSON[_0x09b0('0x11')](_0x2df708));});}; \ No newline at end of file +var _0xa446=['abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','merge','Fields','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','Inbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','util','moment','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','stringify','length','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','add','expires_in','seconds','catch','error','Search\x20user','GET','format','ActiveUsers','then','isArrayLikeObject','users','email','info','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','data','https://www.zohoapis.','/crm/v2/','moduleCreate','role','last_name','Zoho-oauthtoken\x20','details','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','getString','Subjects','Description','Descriptions','enduserType','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','called','Call_Result','Called','complete','Answered','Rejected'];(function(_0x5077c9,_0x3ecbbb){var _0x649f09=function(_0x587379){while(--_0x587379){_0x5077c9['push'](_0x5077c9['shift']());}};_0x649f09(++_0x3ecbbb);}(_0xa446,0xc6));var _0x6a44=function(_0xa1608a,_0x2db3de){_0xa1608a=_0xa1608a-0x0;var _0x1595f2=_0xa446[_0xa1608a];return _0x1595f2;};'use strict';var _=require(_0x6a44('0x0'));var rp=require(_0x6a44('0x1'));var md5=require('md5');var util=require(_0x6a44('0x2'));var intUtil=require('./util');var moment=require(_0x6a44('0x3'));var Redis=require('ioredis');var BPromise=require(_0x6a44('0x4'));var config=require('../../../../config/environment');var logger=require(_0x6a44('0x5'))(_0x6a44('0x6'));config[_0x6a44('0x7')]=_[_0x6a44('0x8')](config[_0x6a44('0x7')],{'host':_0x6a44('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6a44('0x7')]));function emit(_0x36a426,_0x4f72f8,_0x78c684){io['to'](_0x36a426)[_0x6a44('0xa')](_0x4f72f8,_0x78c684);}function request(_0x5596eb){logger[_0x6a44('0xb')](_0x6a44('0xc'),JSON[_0x6a44('0xd')](_0x5596eb));return rp(_0x5596eb);}function getCustomFields(_0x2e07df,_0xb69bdd){var _0x159d5d={};if(_0x2e07df[_0x6a44('0xe')]>0x0){_['forEach'](_0x2e07df,function(_0xdecea8){if(_[_0x6a44('0xf')](['string',_0x6a44('0x10')],_0xdecea8[_0x6a44('0x11')])&&_0xdecea8[_0x6a44('0x12')]){_0x159d5d[_0xdecea8['idField']]=_0xdecea8[_0x6a44('0x13')][_0x6a44('0x14')]();}else if(_0xdecea8[_0x6a44('0x11')]===_0x6a44('0x15')&&_0xdecea8[_0x6a44('0x16')]&&_0xdecea8[_0x6a44('0x12')]&&_0xb69bdd[_0xdecea8['variableName']]){_0x159d5d[_0xdecea8['idField']]=_0xb69bdd[_0xdecea8[_0x6a44('0x16')]][_0x6a44('0x14')]();}else if(_0xdecea8['type']===_0x6a44('0x17')&&_0xdecea8[_0x6a44('0x18')]&&_0xdecea8[_0x6a44('0x18')][_0x6a44('0x19')]&&_0xdecea8[_0x6a44('0x12')]&&_0xb69bdd[_0xdecea8[_0x6a44('0x18')][_0x6a44('0x19')][_0x6a44('0x1a')]()]){_0x159d5d[_0xdecea8[_0x6a44('0x12')]]=_0xb69bdd[_0xdecea8[_0x6a44('0x18')][_0x6a44('0x19')][_0x6a44('0x1a')]()][_0x6a44('0x14')]();}});}return _0x159d5d;}function getName(_0x108c4b){if(_0x108c4b['indexOf']('\x20')>0x0){var _0x49ae81=_0x108c4b['split'](/ (.+)/);if(_0x49ae81[0x1]){return _0x49ae81;}}return[_0x108c4b,_0x108c4b];}var accountsTokens={};function getAccessToken(_0x2d279b){return new Promise(function(_0x19410f,_0x2ef3cf){if(!_[_0x6a44('0x1b')](accountsTokens[_0x2d279b['id']])&&!_['isNil'](accountsTokens[_0x2d279b['id']][_0x6a44('0x1c')])){if(moment()[_0x6a44('0x1d')](accountsTokens[_0x2d279b['id']]['expires_in'])){_0x19410f(accountsTokens[_0x2d279b['id']][_0x6a44('0x1c')]);}}var _0x24c04a;switch(_0x2d279b[_0x6a44('0x1e')]){case'US':_0x24c04a=_0x6a44('0x1f');break;case'AU':_0x24c04a=_0x6a44('0x20');break;case'EU':_0x24c04a=_0x6a44('0x21');break;case'IN':_0x24c04a=_0x6a44('0x22');break;case'CN':_0x24c04a=_0x6a44('0x23');break;default:_0x24c04a=_0x6a44('0x21');break;}var _0x4b5762={'method':_0x6a44('0x24'),'uri':_0x24c04a+_0x6a44('0x25'),'qs':{'refresh_token':_0x2d279b[_0x6a44('0x26')],'client_id':_0x2d279b[_0x6a44('0x27')],'client_secret':_0x2d279b['clientSecret'],'grant_type':_0x6a44('0x28')},'json':!![]};return rp(_0x4b5762)['then'](function(_0x3ad23e){accountsTokens[_0x2d279b['id']]={'access_token':_0x3ad23e[_0x6a44('0x1c')],'expires_in':moment()[_0x6a44('0x29')](_0x3ad23e[_0x6a44('0x2a')],_0x6a44('0x2b'))};_0x19410f(_0x3ad23e[_0x6a44('0x1c')]);})[_0x6a44('0x2c')](function(_0x3fc846){logger[_0x6a44('0x2d')]('Failing\x20creating\x20the\x20access_token',_0x3fc846['stack']);_0x2ef3cf(_0x3fc846);});});}function getUser(_0x265f9d,_0x5abc23,_0xaef746,_0x5b46cd){logger['info'](_0x6a44('0x2e'));return request({'method':_0x6a44('0x2f'),'uri':util[_0x6a44('0x30')]('https://www.zohoapis.%s/crm/v2/users',_0x5abc23),'qs':{'type':_0x6a44('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x265f9d},'json':!![]})[_0x6a44('0x32')](function(_0x2c0dcd){if(_0x2c0dcd['users']){var _0x58a1b4=-0x1;if(_[_0x6a44('0x33')](_0x2c0dcd[_0x6a44('0x34')])){if(!_[_0x6a44('0x1b')](_0x5b46cd)){_0x58a1b4=_['findIndex'](_0x2c0dcd['users'],function(_0xe98554){return _0xe98554[_0x6a44('0x35')]===_0x5b46cd;});}if(_0x58a1b4>=0x0){logger[_0x6a44('0x36')]('Agent\x20found!');}else{logger[_0x6a44('0x36')](_0x6a44('0x37'));_0x58a1b4=_[_0x6a44('0x38')](_0x2c0dcd[_0x6a44('0x34')],function(_0x3a2e5f){return _0x3a2e5f[_0x6a44('0x39')][_0x6a44('0x19')]===_0x6a44('0x3a');});}return _0x2c0dcd[_0x6a44('0x34')][_0x58a1b4];}else{if(_0x2c0dcd[_0x6a44('0x3b')][_0x6a44('0x39')][_0x6a44('0x19')]==='Administrator'){logger[_0x6a44('0x36')]('Using\x20the\x20admin\x20account!');user=_0x2c0dcd['user'];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x6a44('0xd')](_0x2c0dcd));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x6a44('0xd')](_0x2c0dcd));}}}else{logger['error'](_0x6a44('0x3c'),JSON[_0x6a44('0xd')](_0x2c0dcd));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x2c0dcd));}})[_0x6a44('0x2c')](function(_0x3918b3){console[_0x6a44('0x2d')](_0x3918b3);});}function getZohoUser(_0x4a0611,_0x48d4bb){return new BPromise(function(_0x309237,_0xf7d957){request(_0x4a0611)[_0x6a44('0x32')](function(_0x4738cb){var _0x2c2d74=null;if(_0x4738cb){_0x2c2d74=_0x4738cb[_0x6a44('0x3d')][0x0];_0x2c2d74['enduserType']=_0x48d4bb;}_0x309237(_0x2c2d74);})[_0x6a44('0x2c')](function(_0x3b3adc){_0xf7d957(_0x3b3adc);});});}function createEndUser(_0x58d3bf,_0x334195,_0x4e3223,_0xcd852f,_0x527df6,_0x34dcc6){var _0x4e3223=getName(_0x4e3223);return request({'method':_0x6a44('0x24'),'uri':_0x6a44('0x3e')+_0x334195+_0x6a44('0x3f')+_['startCase'](_0x34dcc6[_0x6a44('0x40')])+'s','body':{'data':[{'Last_Name':_0x4e3223[0x1],'First_Name':_0x4e3223[0x0],'Phone':_0xcd852f,'Owner':{'name':!_[_0x6a44('0x1b')](_0x527df6[_0x6a44('0x41')]['name'])?_0x527df6[_0x6a44('0x41')][_0x6a44('0x19')]:!_['isNil'](_0x527df6['first_name'])?_0x527df6['first_name']+'\x20'+_0x527df6['last_name']:_0x527df6[_0x6a44('0x42')],'id':_0x527df6['id']}}]},'headers':{'Authorization':_0x6a44('0x43')+_0x58d3bf},'json':!![]})[_0x6a44('0x32')](function(_0x18315e){if(_0x18315e&&_0x18315e[_0x6a44('0x3d')][0x0]['code']==='SUCCESS'){var _0x25b742=_0x18315e[_0x6a44('0x3d')][0x0][_0x6a44('0x44')];_0x25b742['enduserType']=_[_0x6a44('0x45')](_0x34dcc6[_0x6a44('0x40')])+'s';return _0x25b742;}logger[_0x6a44('0x2d')]('The\x20failing\x20result\x20is',JSON[_0x6a44('0xd')](data));throw new Error(_0x6a44('0x46')+JSON[_0x6a44('0xd')](data));})[_0x6a44('0x2c')](function(_0xf91df9){console[_0x6a44('0x47')](_0x6a44('0x48'),_0xf91df9);});}function getEndUser(_0xb169f,_0x4bf874,_0xa74584,_0x3767c9,_0x2ccdbc,_0x446fbf,_0x1362c7){var _0x3fcb0b={'method':_0x6a44('0x2f'),'uri':'','headers':{'Authorization':_0x6a44('0x43')+_0xb169f},'json':!![]};switch(_0x1362c7[_0x6a44('0x49')]){case'contact_lead':_0x3fcb0b[_0x6a44('0x4a')]=_0x6a44('0x3e')+_0x4bf874+_0x6a44('0x4b')+_0x2ccdbc+'))';return getZohoUser(_0x3fcb0b,_0x6a44('0x4c'))[_0x6a44('0x32')](function(_0x215b77){if(_0x215b77)return _0x215b77;_0x3fcb0b[_0x6a44('0x4a')]=_0x6a44('0x3e')+_0x4bf874+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2ccdbc+'))';return getZohoUser(_0x3fcb0b,_0x6a44('0x4d'))[_0x6a44('0x32')](function(_0x59377e){if(_0x59377e)return _0x59377e;if(_0x1362c7['moduleCreate']!=_0x6a44('0x4e')){return createEndUser(_0xb169f,_0x4bf874,_0x3767c9,_0x2ccdbc,_0x446fbf,_0x1362c7);}else{return{};}});});break;case'contact':_0x3fcb0b['uri']=_0x6a44('0x3e')+_0x4bf874+_0x6a44('0x4b')+_0x2ccdbc+'))';return getZohoUser(_0x3fcb0b,'Contacts')['then'](function(_0x32fe47){if(_0x32fe47)return _0x32fe47;if(_0x1362c7[_0x6a44('0x40')]!='nothing'){return createEndUser(_0xb169f,_0x4bf874,_0x3767c9,_0x2ccdbc,_0x446fbf,_0x1362c7);}else{return{};}});break;case _0x6a44('0x4f'):_0x3fcb0b['uri']=_0x6a44('0x3e')+_0x4bf874+_0x6a44('0x50')+_0x2ccdbc+'))';return getZohoUser(_0x3fcb0b,_0x6a44('0x4d'))['then'](function(_0x52b343){if(_0x52b343)return _0x52b343;if(_0x1362c7['moduleCreate']!='nothing'){return createEndUser(_0xb169f,_0x4bf874,_0x3767c9,_0x2ccdbc,_0x446fbf,_0x1362c7);}else{return{};}});break;}}function getCall(_0x267fe8,_0xa393fc,_0x428a08,_0x21b457,_0x213478,_0x598d7a,_0x288224,_0x560ab2){logger[_0x6a44('0x36')](_0x6a44('0x51'));var _0x4a33d0={};_0x4a33d0[_0x6a44('0x52')]={'name':!_[_0x6a44('0x1b')](_0x21b457['role'][_0x6a44('0x19')])&&!_[_0x6a44('0x1b')](_0x21b457[_0x6a44('0x39')][_0x6a44('0x19')])&&_0x21b457[_0x6a44('0x39')][_0x6a44('0x19')]===_0x6a44('0x53')?_0x21b457[_0x6a44('0x41')][_0x6a44('0x19')]:!_[_0x6a44('0x1b')](_0x21b457['first_name'])?_0x21b457[_0x6a44('0x54')]+'\x20'+_0x21b457['last_name']:_0x21b457[_0x6a44('0x42')],'id':_0x21b457['id']};_0x4a33d0[_0x6a44('0x55')]=intUtil[_0x6a44('0x56')](_0x598d7a[_0x6a44('0x57')],_0x288224,'\x20');_0x4a33d0[_0x6a44('0x58')]=intUtil['getString'](_0x598d7a[_0x6a44('0x59')],_0x288224,'\x0a');if(_0x213478[_0x6a44('0x5a')]===_0x6a44('0x4c')){_0x4a33d0[_0x6a44('0x5b')]={'name':!_[_0x6a44('0x1b')](_0x213478[_0x6a44('0x5c')])?_0x213478[_0x6a44('0x5c')]:!_[_0x6a44('0x1b')](_0x213478[_0x6a44('0x5d')])?_0x213478[_0x6a44('0x5d')]+'\x20'+_0x213478[_0x6a44('0x5e')]:_0x213478['Last_Name'],'id':_0x213478['id']};}if(_0x213478[_0x6a44('0x5a')]===_0x6a44('0x4d')){_0x4a33d0[_0x6a44('0x5f')]={'name':!_[_0x6a44('0x1b')](_0x213478[_0x6a44('0x5c')])?_0x213478[_0x6a44('0x5c')]:!_[_0x6a44('0x1b')](_0x213478[_0x6a44('0x5d')])?_0x213478[_0x6a44('0x5d')]+'\x20'+_0x213478['Last_Name']:_0x213478[_0x6a44('0x5e')],'id':_0x213478['id']};_0x4a33d0[_0x6a44('0x60')]=_[_0x6a44('0x45')](_0x213478[_0x6a44('0x5a')]);}if(_0x288224['talktime']){_0x4a33d0[_0x6a44('0x61')]=moment[_0x6a44('0x62')](parseInt(_0x288224[_0x6a44('0x63')])*0x3e8)['format'](_0x6a44('0x64'));}else if(_0x288224['answertime']&&_0x288224['endtime']){_0x4a33d0[_0x6a44('0x61')]=moment[_0x6a44('0x62')](moment(_0x288224[_0x6a44('0x65')],_0x6a44('0x66'))[_0x6a44('0x67')](moment(_0x288224['starttime'],_0x6a44('0x66'))))[_0x6a44('0x30')]('mm:ss');}switch(_0x288224['lastevent']){case _0x6a44('0x68'):_0x4a33d0[_0x6a44('0x69')]=_0x6a44('0x6a');break;case _0x6a44('0x6b'):case'connect':_0x4a33d0[_0x6a44('0x69')]=_0x6a44('0x6c');break;case'rejected':_0x4a33d0['Call_Result']=_0x6a44('0x6d');break;case _0x6a44('0x6e'):_0x4a33d0[_0x6a44('0x69')]='Abandoned';break;case _0x6a44('0x6f'):_0x4a33d0[_0x6a44('0x69')]=_0x6a44('0x70');default:}_0x4a33d0[_0x6a44('0x71')]=(_0x560ab2===_0x6a44('0x72')?moment(_0x288224[_0x6a44('0x73')])['format'](_0x6a44('0x66')):moment(_0x288224[_0x6a44('0x74')])['format'](_0x6a44('0x66')))||moment()[_0x6a44('0x30')](_0x6a44('0x66'));_0x4a33d0['Call_Type']=_0x560ab2||'Inbound';_0x4a33d0=_[_0x6a44('0x75')](_0x4a33d0,getCustomFields(_0x598d7a[_0x6a44('0x76')],_0x288224));return request({'method':'POST','uri':_0x6a44('0x3e')+_0xa393fc+'/crm/v2/Calls','headers':{'Authorization':_0x6a44('0x43')+_0x267fe8},'body':{'data':[_0x4a33d0]},'json':!![]})[_0x6a44('0x32')](function(_0x3a46b2){if(_0x3a46b2&&_0x3a46b2[_0x6a44('0x3d')][0x0]['code']==='SUCCESS'){logger[_0x6a44('0x36')](_0x6a44('0x77'));return{'id':_0x3a46b2[_0x6a44('0x3d')][0x0][_0x6a44('0x44')]['id']};}})[_0x6a44('0x2c')](function(_0x15a310){logger[_0x6a44('0x36')](_0x6a44('0x78'),_0x15a310[_0x6a44('0x79')]);console[_0x6a44('0x47')](_0x6a44('0x78'),_0x15a310);});}exports[_0x6a44('0x7a')]=function(_0x19de84,_0x238eb3,_0x1490be,_0xfee628,_0x2f4d68,_0x38238e){var _0x566c17,_0x35459e,_0x5374f2;_0x38238e[_0x6a44('0x7b')]=intUtil[_0x6a44('0x7c')](_0x38238e[_0x6a44('0x7b')]);_0x38238e[_0x6a44('0x7d')]=intUtil['stripTrailingSlash'](_0x38238e[_0x6a44('0x7d')]);if(_0x2f4d68&&_0x2f4d68[_0x6a44('0x7e')]){logger[_0x6a44('0x36')](_0x6a44('0x7f'),_0x6a44('0x80'));_0x238eb3[_0x6a44('0x81')]=_0x38238e['serverUrl']+_0x6a44('0x82')+_0x238eb3[_0x6a44('0x83')]+_0x6a44('0x84')+md5(_0x238eb3[_0x6a44('0x83')]);}else{_0x238eb3[_0x6a44('0x81')]='';}var _0x13aead=_0x38238e['host']===_0x6a44('0x85')?'eu':_0x6a44('0x86');return getAccessToken(_0x38238e)['then'](function(_0x36543d){_0x5374f2=_0x36543d;return getUser(_0x5374f2,_0x13aead,_0x38238e,_0xfee628[_0x6a44('0x35')]);})[_0x6a44('0x32')](function(_0x4cd9f5){_0x566c17=_0x4cd9f5;logger[_0x6a44('0x36')]('The\x20User\x20ID\x20is:',_0x566c17['id']);return getEndUser(_0x5374f2,_0x13aead,_0x38238e,_0x238eb3[_0x6a44('0x87')],_0x238eb3['calleridnum'],_0x566c17,_0x1490be);})[_0x6a44('0x32')](function(_0x5a5d31){_0x35459e=_0x5a5d31;return getCall(_0x5374f2,_0x13aead,_0x38238e,_0x566c17,_0x35459e,_0x1490be,_0x238eb3,_0x6a44('0x88'));})[_0x6a44('0x32')](function(_0xeba1e2){if(_0xeba1e2){logger['info']('The\x20Call\x20ID\x20is:',_0xeba1e2['id']);logger[_0x6a44('0x36')](_0x6a44('0x7f'),_0x6a44('0x89'));emit(util[_0x6a44('0x30')](_0x6a44('0x8a'),_0xfee628['name']),_0x6a44('0x8b'),{'uri':_0x6a44('0x8c')+_0x38238e[_0x6a44('0x7b')]+_0x6a44('0x8d')+_0xeba1e2['id']});}})[_0x6a44('0x2c')](function(_0x3580b0){logger[_0x6a44('0x2d')]('[QUEUE]',JSON[_0x6a44('0xd')](_0x3580b0));});};exports[_0x6a44('0x72')]=function(_0x2ec199,_0x7c3bc7,_0x1c3f75,_0x188ca8,_0x1fb454,_0x2f383e,_0x13f364){var _0x49d513,_0x4781fb,_0x4d9102;_0x2f383e['host']=intUtil['stripTrailingSlash'](_0x2f383e[_0x6a44('0x7b')]);_0x2f383e[_0x6a44('0x7d')]=intUtil[_0x6a44('0x7c')](_0x2f383e[_0x6a44('0x7d')]);if(_0x13f364&&_0x13f364[_0x6a44('0x8e')]&&_0x13f364['recordingFormat']!==_0x6a44('0x8f')){logger['info'](_0x6a44('0x90'),_0x6a44('0x80'));_0x7c3bc7[_0x6a44('0x81')]=_0x2f383e['serverUrl']+_0x6a44('0x82')+_0x7c3bc7[_0x6a44('0x83')]+_0x6a44('0x84')+md5(_0x7c3bc7[_0x6a44('0x83')]);}var _0x114eb0=_0x2f383e[_0x6a44('0x7b')]==='zoho.eu'?'eu':_0x6a44('0x86');return getAccessToken(_0x2f383e)['then'](function(_0x48fec3){_0x4d9102=_0x48fec3;return getUser(_0x4d9102,_0x114eb0,_0x2f383e,_0x188ca8[_0x6a44('0x35')]);})[_0x6a44('0x32')](function(_0x51880a){_0x49d513=_0x51880a;logger['info'](_0x6a44('0x91'),_0x49d513['id']);return getEndUser(_0x4d9102,_0x114eb0,_0x2f383e,_0x7c3bc7[_0x6a44('0x92')],_0x7c3bc7[_0x6a44('0x93')],_0x49d513,_0x1c3f75);})[_0x6a44('0x32')](function(_0x1d312c){_0x4781fb=_0x1d312c;return getCall(_0x4d9102,_0x114eb0,_0x2f383e,_0x49d513,_0x4781fb,_0x1c3f75,_0x7c3bc7,_0x6a44('0x94'));})[_0x6a44('0x32')](function(_0x110922){if(_0x110922){logger[_0x6a44('0x36')](_0x6a44('0x95'),_0x110922['id']);logger[_0x6a44('0x36')](_0x6a44('0x90'),_0x6a44('0x89'));emit(util[_0x6a44('0x30')](_0x6a44('0x8a'),_0x188ca8[_0x6a44('0x19')]),'trigger:browser:url',{'uri':_0x6a44('0x8c')+_0x2f383e[_0x6a44('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x110922['id']});}})[_0x6a44('0x2c')](function(_0x38fcb1){logger['error'](_0x6a44('0x90'),JSON['stringify'](_0x38fcb1));});};exports[_0x6a44('0x96')]=function(_0x3bd5a3,_0x350915,_0x2b22f3,_0x3e3513,_0x159c82,_0x4aac1c){var _0x437f5b,_0x3d45ad,_0x455bea;_0x4aac1c[_0x6a44('0x7b')]=intUtil['stripTrailingSlash'](_0x4aac1c[_0x6a44('0x7b')]);_0x4aac1c[_0x6a44('0x7d')]=intUtil[_0x6a44('0x7c')](_0x4aac1c[_0x6a44('0x7d')]);if(_0x159c82&&_0x159c82['monitor_format']){logger[_0x6a44('0x36')]('['+_0x350915[_0x6a44('0x97')][_0x6a44('0x98')]()+']',_0x6a44('0x80'));_0x350915[_0x6a44('0x81')]=_0x4aac1c[_0x6a44('0x7d')]+_0x6a44('0x82')+_0x350915[_0x6a44('0x83')]+_0x6a44('0x84')+md5(_0x350915[_0x6a44('0x83')]);}else{_0x350915[_0x6a44('0x81')]='';}var _0x33931c=_0x4aac1c['host']===_0x6a44('0x85')?'eu':_0x6a44('0x86');return getAccessToken(_0x4aac1c)['then'](function(_0xd00b93){_0x455bea=_0xd00b93;return getUser(_0x455bea,_0x33931c,_0x4aac1c);})[_0x6a44('0x32')](function(_0x4e2a6c){_0x437f5b=_0x4e2a6c;logger[_0x6a44('0x36')](_0x6a44('0x91'),_0x437f5b['id']);return getEndUser(_0x455bea,_0x33931c,_0x4aac1c,_0x350915[_0x6a44('0x87')],_0x350915[_0x6a44('0x99')],_0x437f5b,_0x2b22f3);})[_0x6a44('0x32')](function(_0x8b9d16){_0x3d45ad=_0x8b9d16;return getCall(_0x455bea,_0x33931c,_0x4aac1c,_0x437f5b,_0x3d45ad,_0x2b22f3,_0x350915,_0x6a44('0x88'));})[_0x6a44('0x32')](function(_0x149fc3){if(_0x149fc3){logger[_0x6a44('0x36')](_0x6a44('0x95'),_0x149fc3['id']);}})[_0x6a44('0x2c')](function(_0xcc57b0){logger[_0x6a44('0x2d')]('['+_0x350915[_0x6a44('0x97')][_0x6a44('0x98')]()+']',JSON[_0x6a44('0xd')](_0xcc57b0));});}; \ 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 bc75270..5b93399 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 _0xb38f=['shelljs','mustache','../../../../config/logger','exec','data2','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0xb38f,0x12c));var _0xfb38=function(_0x5774af,_0x411c94){_0x5774af=_0x5774af-0x0;var _0x480589=_0xb38f[_0x5774af];return _0x480589;};'use strict';var util=require('util');var sh=require(_0xfb38('0x0'));var Mustache=require(_0xfb38('0x1'));var logger=require(_0xfb38('0x2'))('trigger');exports[_0xfb38('0x3')]=function(_0x156a1e,_0x59faf2){var _0x3ee6c4=_0x156a1e[_0xfb38('0x4')]?_0x156a1e[_0xfb38('0x4')]:'Script';var _0x2dc816=_0x156a1e[_0xfb38('0x5')]?Mustache[_0xfb38('0x6')](_0x156a1e[_0xfb38('0x5')],_0x59faf2):_0x59faf2;sh['exec'](_0x2dc816,function(_0x33cc09,_0x37db9f,_0x2a1598){if(_0x33cc09!==0x0){logger[_0xfb38('0x7')](util[_0xfb38('0x8')](_0xfb38('0x9'),_0x3ee6c4,_0x2dc816,_0x33cc09,_0x2a1598));}else{logger[_0xfb38('0xa')](util[_0xfb38('0x8')](_0xfb38('0xb'),_0x3ee6c4,_0x2dc816,_0x37db9f));}});}; \ No newline at end of file +var _0x9b87=['format','info','mustache','../../../../config/logger','trigger','exec','data2','data3','render','error'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0x9b87,0x17e));var _0x79b8=function(_0xe17893,_0x5b2192){_0xe17893=_0xe17893-0x0;var _0x529162=_0x9b87[_0xe17893];return _0x529162;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require(_0x79b8('0x0'));var logger=require(_0x79b8('0x1'))(_0x79b8('0x2'));exports[_0x79b8('0x3')]=function(_0x5f4023,_0x5b0114){var _0x4231ea=_0x5f4023[_0x79b8('0x4')]?_0x5f4023[_0x79b8('0x4')]:'Script';var _0x44dd23=_0x5f4023[_0x79b8('0x5')]?Mustache[_0x79b8('0x6')](_0x5f4023[_0x79b8('0x5')],_0x5b0114):_0x5b0114;sh[_0x79b8('0x3')](_0x44dd23,function(_0x54375f,_0x2526d7,_0x7df195){if(_0x54375f!==0x0){logger[_0x79b8('0x7')](util[_0x79b8('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x4231ea,_0x44dd23,_0x54375f,_0x7df195));}else{logger[_0x79b8('0x9')](util[_0x79b8('0x8')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x4231ea,_0x44dd23,_0x2526d7));}});}; \ 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 67fdd34..35cc89a 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 _0x899e=['%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','util','lodash','../../../../config/logger','exec','toUpperCase','data2','data5','data6','parse','render','stack','data1','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch'];(function(_0xa9e921,_0x1171ab){var _0x3b2510=function(_0x39edd0){while(--_0x39edd0){_0xa9e921['push'](_0xa9e921['shift']());}};_0x3b2510(++_0x1171ab);}(_0x899e,0x130));var _0xe899=function(_0x6252f6,_0x2beb98){_0x6252f6=_0x6252f6-0x0;var _0x21c2dc=_0x899e[_0x6252f6];return _0x21c2dc;};'use strict';var rp=require(_0xe899('0x0'));var util=require(_0xe899('0x1'));var _=require(_0xe899('0x2'));var Mustache=require('mustache');var logger=require(_0xe899('0x3'))('trigger');exports[_0xe899('0x4')]=function(_0x1e11fd,_0x1a88dd){var _0x20d08c,_0x5bb82a;var _0x517d9f={'method':_0x1e11fd['data1'][_0xe899('0x5')](),'uri':Mustache['render'](_0x1e11fd[_0xe899('0x6')],_0x1a88dd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1e11fd['data5'])==='number'&&parseInt(_0x1e11fd[_0xe899('0x7')])>=0x1&&parseInt(_0x1e11fd[_0xe899('0x7')])<=0xa?parseInt(_0x1e11fd[_0xe899('0x7')])*0x3e8:0x5*0x3e8};try{_0x517d9f['headers']=_0x1e11fd[_0xe899('0x8')]?JSON[_0xe899('0x9')](Mustache[_0xe899('0xa')](_0x1e11fd['data6'],_0x1a88dd)):{};}catch(_0x3480cf){logger['error'](_0x3480cf[_0xe899('0xb')]);}switch(_0x1e11fd[_0xe899('0xc')][_0xe899('0x5')]()){case'GET':case'DELETE':_0x20d08c=null;_0x517d9f['qs']=_0x1a88dd;break;case'POST':case _0xe899('0xd'):if(_0x1e11fd['data7']){try{_0x20d08c=JSON[_0xe899('0x9')](Mustache[_0xe899('0xa')](_0x1e11fd[_0xe899('0xe')],_0x1a88dd));_0x517d9f[_0xe899('0xf')]=_0x20d08c;}catch(_0x5a16f0){logger[_0xe899('0x10')](_0x5a16f0[_0xe899('0xb')]);logger['error'](_0xe899('0x11'));}}else{_0x20d08c=_0x1a88dd;_0x517d9f[_0xe899('0xf')]=_0x20d08c;}break;}logger[_0xe899('0x12')](util['format'](_0xe899('0x13'),_0x1e11fd[_0xe899('0xc')],_0x1e11fd['data2'],JSON[_0xe899('0x14')](_0x517d9f)));rp(_0x517d9f)['then'](function(_0x2570d2){_0x20d08c=!_[_0xe899('0x15')](_0x20d08c)?_0xe899('0x16')+_0x20d08c:'';_0x5bb82a=typeof _0x2570d2[_0xe899('0xf')]==='object'?JSON[_0xe899('0x14')](_0x2570d2[_0xe899('0xf')]):_0x2570d2[_0xe899('0xf')];logger[_0xe899('0x12')](util[_0xe899('0x17')](_0xe899('0x18'),_0x1e11fd['data1'],_0x1e11fd['data2'],_0x2570d2['statusCode'],_0x5bb82a));})[_0xe899('0x19')](function(_0x55eada){logger['error'](util[_0xe899('0x17')](_0xe899('0x1a'),_0x1e11fd[_0xe899('0xc')],_0x1e11fd[_0xe899('0x6')],_0x55eada[_0xe899('0x1b')],_0x55eada[_0xe899('0x1c')],_0x55eada[_0xe899('0x1d')]));});}; \ No newline at end of file +var _0xb45c=['body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','data7'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xb45c,0x185));var _0xcb45=function(_0x599586,_0x506cab){_0x599586=_0x599586-0x0;var _0x28ffb1=_0xb45c[_0x599586];return _0x28ffb1;};'use strict';var rp=require(_0xcb45('0x0'));var util=require('util');var _=require(_0xcb45('0x1'));var Mustache=require(_0xcb45('0x2'));var logger=require(_0xcb45('0x3'))(_0xcb45('0x4'));exports[_0xcb45('0x5')]=function(_0x56d2b4,_0x37fee0){var _0x37214f,_0x4d30ab;var _0x4c967d={'method':_0x56d2b4[_0xcb45('0x6')][_0xcb45('0x7')](),'uri':Mustache[_0xcb45('0x8')](_0x56d2b4[_0xcb45('0x9')],_0x37fee0),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x56d2b4['data5'])===_0xcb45('0xa')&&parseInt(_0x56d2b4[_0xcb45('0xb')])>=0x1&&parseInt(_0x56d2b4[_0xcb45('0xb')])<=0xa?parseInt(_0x56d2b4[_0xcb45('0xb')])*0x3e8:0x5*0x3e8};try{_0x4c967d[_0xcb45('0xc')]=_0x56d2b4[_0xcb45('0xd')]?JSON[_0xcb45('0xe')](Mustache['render'](_0x56d2b4[_0xcb45('0xd')],_0x37fee0)):{};}catch(_0x234503){logger['error'](_0x234503[_0xcb45('0xf')]);}switch(_0x56d2b4['data1'][_0xcb45('0x7')]()){case _0xcb45('0x10'):case _0xcb45('0x11'):_0x37214f=null;_0x4c967d['qs']=_0x37fee0;break;case'POST':case'PUT':if(_0x56d2b4[_0xcb45('0x12')]){try{_0x37214f=JSON[_0xcb45('0xe')](Mustache['render'](_0x56d2b4[_0xcb45('0x12')],_0x37fee0));_0x4c967d[_0xcb45('0x13')]=_0x37214f;}catch(_0x46ae98){logger[_0xcb45('0x14')](_0x46ae98[_0xcb45('0xf')]);logger[_0xcb45('0x14')](_0xcb45('0x15'));}}else{_0x37214f=_0x37fee0;_0x4c967d[_0xcb45('0x13')]=_0x37214f;}break;}logger[_0xcb45('0x16')](util[_0xcb45('0x17')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x56d2b4[_0xcb45('0x6')],_0x56d2b4[_0xcb45('0x9')],JSON[_0xcb45('0x18')](_0x4c967d)));rp(_0x4c967d)['then'](function(_0x28c416){_0x37214f=!_[_0xcb45('0x19')](_0x37214f)?_0xcb45('0x1a')+_0x37214f:'';_0x4d30ab=typeof _0x28c416[_0xcb45('0x13')]===_0xcb45('0x1b')?JSON[_0xcb45('0x18')](_0x28c416[_0xcb45('0x13')]):_0x28c416[_0xcb45('0x13')];logger[_0xcb45('0x16')](util[_0xcb45('0x17')](_0xcb45('0x1c'),_0x56d2b4[_0xcb45('0x6')],_0x56d2b4[_0xcb45('0x9')],_0x28c416[_0xcb45('0x1d')],_0x4d30ab));})[_0xcb45('0x1e')](function(_0x3d334e){logger['error'](util[_0xcb45('0x17')](_0xcb45('0x1f'),_0x56d2b4['data1'],_0x56d2b4['data2'],_0x3d334e[_0xcb45('0x1d')],_0x3d334e[_0xcb45('0x20')],_0x3d334e[_0xcb45('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 8307cb3..74b4701 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 _0x5d37=['../../config/logger','routing','request','then','rpc','error','result','catch','exports','jayson/promise','bluebird'];(function(_0x33cf43,_0x5b4337){var _0x180266=function(_0x31e709){while(--_0x31e709){_0x33cf43['push'](_0x33cf43['shift']());}};_0x180266(++_0x5b4337);}(_0x5d37,0x13d));var _0x75d3=function(_0x546ee8,_0x5d234f){_0x546ee8=_0x546ee8-0x0;var _0x2691f9=_0x5d37[_0x546ee8];return _0x2691f9;};'use strict';var jayson=require(_0x75d3('0x0'));var BPromise=require(_0x75d3('0x1'));var logger=require(_0x75d3('0x2'))(_0x75d3('0x3'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x7cc39a,_0xc42745){return new BPromise(function(_0x59143b,_0x19284c){return client[_0x75d3('0x4')](_0x7cc39a,_0xc42745)[_0x75d3('0x5')](function(_0x432b20){logger['debug'](_0x75d3('0x6'),'routing',_0x7cc39a,_0xc42745,_0x432b20);if(_0x432b20['error']){logger[_0x75d3('0x7')](_0x75d3('0x6'),_0x75d3('0x3'),_0x7cc39a,_0x432b20[_0x75d3('0x7')]['message'],_0xc42745);return _0x19284c(_0x432b20[_0x75d3('0x7')]['message']);}else{return _0x59143b(_0x432b20[_0x75d3('0x8')]);}})[_0x75d3('0x9')](function(_0x27ea4d){logger[_0x75d3('0x7')](_0x75d3('0x6'),_0x75d3('0x3'),_0x7cc39a,_0x27ea4d,_0xc42745);return _0x19284c(_0x27ea4d);});});};module[_0x75d3('0xa')]=client; \ No newline at end of file +var _0x1da0=['error','rpc','routing','message','result','bluebird','../../config/logger','client','http','Request','request','then'];(function(_0x382ee9,_0x357044){var _0x3252d=function(_0x5455df){while(--_0x5455df){_0x382ee9['push'](_0x382ee9['shift']());}};_0x3252d(++_0x357044);}(_0x1da0,0xf5));var _0x01da=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x1da0[_0x1b7368];return _0x25d54c;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x01da('0x0'));var logger=require(_0x01da('0x1'))('routing');var client=jayson[_0x01da('0x2')][_0x01da('0x3')]({'port':0x2329});client[_0x01da('0x4')]=function(_0x8c7f6f,_0x372003){return new BPromise(function(_0x275d81,_0x5b9cc2){return client[_0x01da('0x5')](_0x8c7f6f,_0x372003)[_0x01da('0x6')](function(_0x1d9329){logger['debug']('rpc','routing',_0x8c7f6f,_0x372003,_0x1d9329);if(_0x1d9329[_0x01da('0x7')]){logger['error'](_0x01da('0x8'),_0x01da('0x9'),_0x8c7f6f,_0x1d9329[_0x01da('0x7')][_0x01da('0xa')],_0x372003);return _0x5b9cc2(_0x1d9329['error'][_0x01da('0xa')]);}else{return _0x275d81(_0x1d9329[_0x01da('0xb')]);}})['catch'](function(_0x4cb42f){logger['error'](_0x01da('0x8'),_0x01da('0x9'),_0x8c7f6f,_0x4cb42f,_0x372003);return _0x5b9cc2(_0x4cb42f);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index de85ac0..40e557f 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 _0xa7c2=['./lib/email','./rpc/mailAccount','../../config/logger','email','then','getMailAccounts','initMailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime'];(function(_0x480ab3,_0x2102f4){var _0x263f62=function(_0x43cf0e){while(--_0x43cf0e){_0x480ab3['push'](_0x480ab3['shift']());}};_0x263f62(++_0x2102f4);}(_0xa7c2,0x184));var _0x2a7c=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xa7c2[_0x1d24eb];return _0x1dc576;};'use strict';var server=require(_0x2a7c('0x0'));var Realtime=require(_0x2a7c('0x1'));var EmailChannel=require(_0x2a7c('0x2'));var mailAccount=require(_0x2a7c('0x3'));var setting=require('./rpc/setting');var logger=require(_0x2a7c('0x4'))(_0x2a7c('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x2a7c('0x6')](mailAccount[_0x2a7c('0x7')]())[_0x2a7c('0x6')](realtime[_0x2a7c('0x8')]())[_0x2a7c('0x6')](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x2a7c('0x9')](realtime,email)[_0x2a7c('0x6')](function(){return initRealtime();})[_0x2a7c('0x6')](function(){return setting[_0x2a7c('0xa')]();})[_0x2a7c('0x6')](function(_0x4624c8){return setInterval(initRealtime,_0x4624c8[_0x2a7c('0xb')]*0x3e8);})[_0x2a7c('0xc')](function(_0x51aaef){logger[_0x2a7c('0xd')](_0x2a7c('0xe'),_0x51aaef);});}main(); \ No newline at end of file +var _0x6a07=['getMailAccounts','mailAccounts','listen','catch','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6a07,0x1e6));var _0x76a0=function(_0x50a9af,_0x24df09){_0x50a9af=_0x50a9af-0x0;var _0x3478f9=_0x6a07[_0x50a9af];return _0x3478f9;};'use strict';var server=require(_0x76a0('0x0'));var Realtime=require(_0x76a0('0x1'));var EmailChannel=require(_0x76a0('0x2'));var mailAccount=require(_0x76a0('0x3'));var setting=require(_0x76a0('0x4'));var logger=require(_0x76a0('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x76a0('0x6')]()[_0x76a0('0x7')](mailAccount[_0x76a0('0x8')]())[_0x76a0('0x7')](realtime['initMailAccounts']())[_0x76a0('0x7')](function(){email['refresh'](realtime[_0x76a0('0x9')]);return realtime;});}function main(){return server[_0x76a0('0xa')](realtime,email)[_0x76a0('0x7')](function(){return initRealtime();})[_0x76a0('0x7')](function(){return setting['getSettings']();})[_0x76a0('0x7')](function(_0x4bf467){return setInterval(initRealtime,_0x4bf467['loginMailFrequency']*0x3e8);})[_0x76a0('0xb')](function(_0xc7ef93){logger['error'](_0x76a0('0xc'),_0xc7ef93);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index e361f7c..e17bd12 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 _0xfe5e=['error','isNil','disabled','messageStatus','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','active','status','Imap','total','stringify','mailAccount:update','prototype','hasOwnProperty','provider','custom','service','box','handleImapBox','handleImapEmail','bind','end'];(function(_0x26462e,_0x416ff7){var _0x31c3f0=function(_0xd387ea){while(--_0xd387ea){_0x26462e['push'](_0x26462e['shift']());}};_0x31c3f0(++_0x416ff7);}(_0xfe5e,0x1b6));var _0xefe5=function(_0x2c8de4,_0x48ecd7){_0x2c8de4=_0x2c8de4-0x0;var _0xa5f1d5=_0xfe5e[_0x2c8de4];return _0xa5f1d5;};'use strict';var _=require(_0xefe5('0x0'));var moment=require(_0xefe5('0x1'));var BPromise=require(_0xefe5('0x2'));var md5=require(_0xefe5('0x3'));var Redis=require(_0xefe5('0x4'));var config=require('../../../config/environment');var logger=require(_0xefe5('0x5'))(_0xefe5('0x6'));config[_0xefe5('0x7')]=_['defaults'](config['redis'],{'host':_0xefe5('0x8'),'port':0x18eb});var io=require(_0xefe5('0x9'))(new Redis(config['redis']));var EmailImap=require(_0xefe5('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xefe5('0xb'));var md5Accounts={};function EmailChannel(_0x573418){logger[_0xefe5('0xc')](_0xefe5('0xd'));this[_0xefe5('0xe')]=_0x573418[_0xefe5('0xe')];this[_0xefe5('0xf')]={};this[_0xefe5('0x10')]=new EmailSmtp();}EmailChannel['prototype'][_0xefe5('0x11')]=function(_0x45fc46){var _0x5a836e=this['mailAccounts'][_0x45fc46];var _0x444a44={'id':_0x5a836e['id'],'name':_0x5a836e['name'],'key':_0x5a836e['key'],'active':_0x5a836e[_0xefe5('0x12')],'Imap':{'status':_0x5a836e['Imap'][_0xefe5('0x13')],'messageStatus':_0x5a836e[_0xefe5('0x14')]['messageStatus'],'total':_0x5a836e['Imap'][_0xefe5('0x15')]}};if(_['isNil'](md5Accounts[_0x45fc46])){md5Accounts[_0x45fc46]={};}var _0x408a0c=md5(JSON[_0xefe5('0x16')](_0x444a44));if(md5Accounts[_0x45fc46]['md5']!==_0x408a0c){md5Accounts[_0x45fc46]['md5']=_0x408a0c;io['emit'](_0xefe5('0x17'),_0x444a44);}};EmailChannel[_0xefe5('0x18')]['refresh']=function(_0x52283a){for(var _0x4ec061 in _0x52283a){if(_0x52283a[_0xefe5('0x19')](_0x4ec061)){if(_0x52283a[_0x4ec061][_0xefe5('0x14')]&&_0x52283a[_0x4ec061]['active']){var _0x50dd33=_0x52283a[_0x4ec061][_0xefe5('0x14')];if(!_0x50dd33['service']&&_0x52283a[_0x4ec061][_0xefe5('0x1a')]!==_0xefe5('0x1b'))_0x50dd33[_0xefe5('0x1c')]=_0x52283a[_0x4ec061][_0xefe5('0x1a')];if(!this[_0xefe5('0xf')][_0xefe5('0x19')](_0x50dd33['id'])){this['imapAccounts'][_0x50dd33['id']]=new EmailImap(_0x50dd33,_0x52283a[_0x4ec061][_0xefe5('0x6')]);this[_0xefe5('0xf')][_0x50dd33['id']]['on'](_0xefe5('0x1d'),this[_0xefe5('0x1e')]['bind'](this,_0x4ec061));this[_0xefe5('0xf')][_0x50dd33['id']]['on'](_0xefe5('0x6'),this[_0xefe5('0x1f')][_0xefe5('0x20')](this,_0x4ec061));this[_0xefe5('0xf')][_0x50dd33['id']]['on'](_0xefe5('0x21'),this['handleImapEnd']['bind'](this,_0x4ec061));this[_0xefe5('0xf')][_0x50dd33['id']]['on'](_0xefe5('0x22'),this['handleImapError']['bind'](this,_0x4ec061));}}else{if(_[_0xefe5('0x23')](this[_0xefe5('0xe')][_0x4ec061][_0xefe5('0x14')])){this[_0xefe5('0xe')][_0x4ec061][_0xefe5('0x14')]={};}this[_0xefe5('0xe')][_0x4ec061]['Imap'][_0xefe5('0x13')]=_0xefe5('0x24');this[_0xefe5('0xe')][_0x4ec061][_0xefe5('0x14')][_0xefe5('0x25')]='';this[_0xefe5('0x11')](_0x4ec061);}}}};EmailChannel['prototype'][_0xefe5('0x1e')]=function(_0x1ab51e,_0x29f2f1){if(this[_0xefe5('0xe')][_0x1ab51e]){this['mailAccounts'][_0x1ab51e][_0xefe5('0x14')][_0xefe5('0x13')]=_0xefe5('0x26');this['mailAccounts'][_0x1ab51e][_0xefe5('0x14')][_0xefe5('0x25')]=_0x29f2f1[_0xefe5('0x27')];if(_0x29f2f1[_0xefe5('0x28')]){this[_0xefe5('0xe')][_0x1ab51e][_0xefe5('0x14')][_0xefe5('0x15')]=_0x29f2f1[_0xefe5('0x28')][_0xefe5('0x15')];}return this[_0xefe5('0x11')](_0x1ab51e);}};EmailChannel[_0xefe5('0x18')][_0xefe5('0x1f')]=function(_0x2551d3,_0x9d52b9){logger[_0xefe5('0xc')](_0xefe5('0x29'),_0x9d52b9[_0xefe5('0x2a')],_0x9d52b9[_0xefe5('0x2b')],_0x9d52b9[_0xefe5('0x2c')],_0x2551d3);if(this[_0xefe5('0xe')][_0x2551d3]){return mailAccount[_0xefe5('0x2d')](_0x2551d3,_0x9d52b9)[_0xefe5('0x2e')](function(_0x5e7fc6){if(_0x5e7fc6){logger[_0xefe5('0xc')](_0xefe5('0x2f'));}})[_0xefe5('0x30')](function(_0x45b3bc){logger[_0xefe5('0x22')](_0xefe5('0x31'),JSON['stringify'](_0x45b3bc));});}};EmailChannel[_0xefe5('0x18')][_0xefe5('0x32')]=function(_0x207658){if(this['mailAccounts'][_0x207658]&&this['mailAccounts'][_0x207658][_0xefe5('0x14')]){if(this[_0xefe5('0xf')][this[_0xefe5('0xe')][_0x207658][_0xefe5('0x14')]['id']]){delete this[_0xefe5('0xf')][this['mailAccounts'][_0x207658][_0xefe5('0x14')]['id']];}this[_0xefe5('0xe')][_0x207658][_0xefe5('0x14')][_0xefe5('0x33')]=moment();this[_0xefe5('0x11')](_0x207658);}};EmailChannel[_0xefe5('0x18')][_0xefe5('0x34')]=function(_0x33ce55,_0x43705b){if(this[_0xefe5('0xe')][_0x33ce55]){this[_0xefe5('0xe')][_0x33ce55][_0xefe5('0x14')][_0xefe5('0x13')]='error';this[_0xefe5('0xe')][_0x33ce55][_0xefe5('0x14')][_0xefe5('0x25')]=_0x43705b;return this[_0xefe5('0x11')](_0x33ce55);}};EmailChannel[_0xefe5('0x18')][_0xefe5('0x35')]=function(_0x40848d,_0x4664ab){return this[_0xefe5('0x10')][_0xefe5('0x36')](_0x40848d,_0x4664ab);};EmailChannel[_0xefe5('0x18')][_0xefe5('0x37')]=function(_0x4a281d){var _0x1681c5=this;if(this[_0xefe5('0xe')][_0x4a281d['id']]){if(_[_0xefe5('0x23')](this[_0xefe5('0xe')][_0x4a281d['id']][_0xefe5('0x38')])){this['mailAccounts'][_0x4a281d['id']][_0xefe5('0x38')]={};}this['mailAccounts'][_0x4a281d['id']][_0xefe5('0x38')][_0xefe5('0x33')]=moment();return new BPromise(function(_0x38d4e0,_0x2792e2){return _0x1681c5[_0xefe5('0x10')][_0xefe5('0x39')](_0x4a281d)[_0xefe5('0x2e')](function(_0x1b9c95){_0x1681c5[_0xefe5('0xe')][_0x4a281d['id']]['Smtp']['status']='verified';_0x1681c5[_0xefe5('0xe')][_0x4a281d['id']][_0xefe5('0x38')][_0xefe5('0x25')]='';_0x1681c5['emit'](_0x4a281d['id']);_0x38d4e0(_0x1b9c95);})[_0xefe5('0x30')](function(_0x22c598){_0x1681c5['mailAccounts'][_0x4a281d['id']][_0xefe5('0x38')][_0xefe5('0x13')]=_0xefe5('0x22');_0x1681c5[_0xefe5('0xe')][_0x4a281d['id']][_0xefe5('0x38')]['messageStatus']=_0x22c598;_0x1681c5[_0xefe5('0x11')](_0x4a281d['id']);_0x2792e2(_0x22c598);});});}return this[_0xefe5('0x10')][_0xefe5('0x39')](_0x4a281d);};module[_0xefe5('0x3a')]=EmailChannel; \ No newline at end of file +var _0xe1f7=['./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','key','active','Imap','status','messageStatus','total','isNil','stringify','emit','mailAccount:update','custom','provider','hasOwnProperty','box','handleImapBox','bind','end','handleImapEnd','error','disabled','connected','name','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','lastSync','sendMail','smtp','send','Smtp','verify','then','verified','exports','lodash','bluebird','../../../config/logger','email','redis','defaults','localhost','./imap'];(function(_0x2f5a87,_0x471130){var _0xe6886f=function(_0x4f4cb6){while(--_0x4f4cb6){_0x2f5a87['push'](_0x2f5a87['shift']());}};_0xe6886f(++_0x471130);}(_0xe1f7,0x190));var _0x7e1f=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0xe1f7[_0x3eb4a9];return _0x48dbad;};'use strict';var _=require(_0x7e1f('0x0'));var moment=require('moment');var BPromise=require(_0x7e1f('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x7e1f('0x2'))(_0x7e1f('0x3'));config[_0x7e1f('0x4')]=_[_0x7e1f('0x5')](config[_0x7e1f('0x4')],{'host':_0x7e1f('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0x7e1f('0x7'));var EmailSmtp=require(_0x7e1f('0x8'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x55155d){logger[_0x7e1f('0x9')](_0x7e1f('0xa'));this[_0x7e1f('0xb')]=_0x55155d[_0x7e1f('0xb')];this[_0x7e1f('0xc')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x7e1f('0xd')]['emit']=function(_0x11a4cd){var _0x11dce7=this['mailAccounts'][_0x11a4cd];var _0x54f902={'id':_0x11dce7['id'],'name':_0x11dce7['name'],'key':_0x11dce7[_0x7e1f('0xe')],'active':_0x11dce7[_0x7e1f('0xf')],'Imap':{'status':_0x11dce7[_0x7e1f('0x10')][_0x7e1f('0x11')],'messageStatus':_0x11dce7[_0x7e1f('0x10')][_0x7e1f('0x12')],'total':_0x11dce7[_0x7e1f('0x10')][_0x7e1f('0x13')]}};if(_[_0x7e1f('0x14')](md5Accounts[_0x11a4cd])){md5Accounts[_0x11a4cd]={};}var _0x41fdbf=md5(JSON[_0x7e1f('0x15')](_0x54f902));if(md5Accounts[_0x11a4cd]['md5']!==_0x41fdbf){md5Accounts[_0x11a4cd]['md5']=_0x41fdbf;io[_0x7e1f('0x16')](_0x7e1f('0x17'),_0x54f902);}};EmailChannel[_0x7e1f('0xd')]['refresh']=function(_0x44f70d){for(var _0x1ea040 in _0x44f70d){if(_0x44f70d['hasOwnProperty'](_0x1ea040)){if(_0x44f70d[_0x1ea040][_0x7e1f('0x10')]&&_0x44f70d[_0x1ea040][_0x7e1f('0xf')]){var _0x28d562=_0x44f70d[_0x1ea040][_0x7e1f('0x10')];if(!_0x28d562['service']&&_0x44f70d[_0x1ea040]['provider']!==_0x7e1f('0x18'))_0x28d562['service']=_0x44f70d[_0x1ea040][_0x7e1f('0x19')];if(!this['imapAccounts'][_0x7e1f('0x1a')](_0x28d562['id'])){this[_0x7e1f('0xc')][_0x28d562['id']]=new EmailImap(_0x28d562,_0x44f70d[_0x1ea040][_0x7e1f('0x3')]);this[_0x7e1f('0xc')][_0x28d562['id']]['on'](_0x7e1f('0x1b'),this[_0x7e1f('0x1c')][_0x7e1f('0x1d')](this,_0x1ea040));this[_0x7e1f('0xc')][_0x28d562['id']]['on'](_0x7e1f('0x3'),this['handleImapEmail']['bind'](this,_0x1ea040));this[_0x7e1f('0xc')][_0x28d562['id']]['on'](_0x7e1f('0x1e'),this[_0x7e1f('0x1f')]['bind'](this,_0x1ea040));this['imapAccounts'][_0x28d562['id']]['on'](_0x7e1f('0x20'),this['handleImapError']['bind'](this,_0x1ea040));}}else{if(_['isNil'](this[_0x7e1f('0xb')][_0x1ea040][_0x7e1f('0x10')])){this['mailAccounts'][_0x1ea040]['Imap']={};}this[_0x7e1f('0xb')][_0x1ea040][_0x7e1f('0x10')]['status']=_0x7e1f('0x21');this[_0x7e1f('0xb')][_0x1ea040][_0x7e1f('0x10')][_0x7e1f('0x12')]='';this[_0x7e1f('0x16')](_0x1ea040);}}}};EmailChannel['prototype'][_0x7e1f('0x1c')]=function(_0x3c26c8,_0x3c7c4a){if(this['mailAccounts'][_0x3c26c8]){this[_0x7e1f('0xb')][_0x3c26c8][_0x7e1f('0x10')][_0x7e1f('0x11')]=_0x7e1f('0x22');this[_0x7e1f('0xb')][_0x3c26c8]['Imap']['messageStatus']=_0x3c7c4a[_0x7e1f('0x23')];if(_0x3c7c4a[_0x7e1f('0x24')]){this[_0x7e1f('0xb')][_0x3c26c8][_0x7e1f('0x10')][_0x7e1f('0x13')]=_0x3c7c4a[_0x7e1f('0x24')][_0x7e1f('0x13')];}return this[_0x7e1f('0x16')](_0x3c26c8);}};EmailChannel[_0x7e1f('0xd')][_0x7e1f('0x25')]=function(_0x4bf1f6,_0x1c8bff){logger[_0x7e1f('0x9')](_0x7e1f('0x26'),_0x1c8bff['firstName'],_0x1c8bff[_0x7e1f('0x27')],_0x1c8bff[_0x7e1f('0x28')],_0x4bf1f6);if(this[_0x7e1f('0xb')][_0x4bf1f6]){return mailAccount[_0x7e1f('0x29')](_0x4bf1f6,_0x1c8bff)['then'](function(_0x54135e){if(_0x54135e){logger[_0x7e1f('0x9')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x42948f){logger[_0x7e1f('0x20')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x7e1f('0x15')](_0x42948f));});}};EmailChannel[_0x7e1f('0xd')][_0x7e1f('0x1f')]=function(_0x30d126){if(this[_0x7e1f('0xb')][_0x30d126]&&this[_0x7e1f('0xb')][_0x30d126]['Imap']){if(this['imapAccounts'][this[_0x7e1f('0xb')][_0x30d126]['Imap']['id']]){delete this[_0x7e1f('0xc')][this[_0x7e1f('0xb')][_0x30d126][_0x7e1f('0x10')]['id']];}this[_0x7e1f('0xb')][_0x30d126]['Imap'][_0x7e1f('0x2a')]=moment();this[_0x7e1f('0x16')](_0x30d126);}};EmailChannel[_0x7e1f('0xd')]['handleImapError']=function(_0xcbfcd6,_0x3fa4bb){if(this[_0x7e1f('0xb')][_0xcbfcd6]){this[_0x7e1f('0xb')][_0xcbfcd6][_0x7e1f('0x10')]['status']='error';this[_0x7e1f('0xb')][_0xcbfcd6][_0x7e1f('0x10')]['messageStatus']=_0x3fa4bb;return this['emit'](_0xcbfcd6);}};EmailChannel[_0x7e1f('0xd')][_0x7e1f('0x2b')]=function(_0x631b34,_0x1eeb2a){return this[_0x7e1f('0x2c')][_0x7e1f('0x2d')](_0x631b34,_0x1eeb2a);};EmailChannel[_0x7e1f('0xd')]['verifySmtp']=function(_0x56cf76){var _0x4e84d9=this;if(this[_0x7e1f('0xb')][_0x56cf76['id']]){if(_[_0x7e1f('0x14')](this[_0x7e1f('0xb')][_0x56cf76['id']][_0x7e1f('0x2e')])){this[_0x7e1f('0xb')][_0x56cf76['id']][_0x7e1f('0x2e')]={};}this[_0x7e1f('0xb')][_0x56cf76['id']]['Smtp'][_0x7e1f('0x2a')]=moment();return new BPromise(function(_0x1ea118,_0x47f1d3){return _0x4e84d9[_0x7e1f('0x2c')][_0x7e1f('0x2f')](_0x56cf76)[_0x7e1f('0x30')](function(_0x4cf3ed){_0x4e84d9[_0x7e1f('0xb')][_0x56cf76['id']][_0x7e1f('0x2e')][_0x7e1f('0x11')]=_0x7e1f('0x31');_0x4e84d9[_0x7e1f('0xb')][_0x56cf76['id']][_0x7e1f('0x2e')][_0x7e1f('0x12')]='';_0x4e84d9[_0x7e1f('0x16')](_0x56cf76['id']);_0x1ea118(_0x4cf3ed);})['catch'](function(_0x2376f8){_0x4e84d9['mailAccounts'][_0x56cf76['id']][_0x7e1f('0x2e')][_0x7e1f('0x11')]='error';_0x4e84d9[_0x7e1f('0xb')][_0x56cf76['id']]['Smtp'][_0x7e1f('0x12')]=_0x2376f8;_0x4e84d9[_0x7e1f('0x16')](_0x56cf76['id']);_0x47f1d3(_0x2376f8);});});}return this[_0x7e1f('0x2c')][_0x7e1f('0x2f')](_0x56cf76);};module[_0x7e1f('0x32')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 45fc9f8..5b7bc1e 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 _0x1d71=['password','authentication','email','host','port','tls','autotls','handleOpenBox','emit','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','attributes','handleMessageAttributes','handleMessageBody','handleSimpleParser','handleMessageEnd','textCode','hasOwnProperty','exports','lodash','util','imap','mailparser','simpleParser','iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','getAccount','account','once','ready','handleReady','bind','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','user','modernAuthentication','generateXOAuth2Token','CloudProvider','data5'];(function(_0x1cc31d,_0x24bc71){var _0x1e61ec=function(_0x4321c6){while(--_0x4321c6){_0x1cc31d['push'](_0x1cc31d['shift']());}};_0x1e61ec(++_0x24bc71);}(_0x1d71,0x13e));var _0x11d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d71[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x11d7('0x0'));var util=require(_0x11d7('0x1'));var Imap=require(_0x11d7('0x2'));var simpleParser=require(_0x11d7('0x3'))[_0x11d7('0x4')];var Iconv=require(_0x11d7('0x5'))['Iconv'];var EventEmitter=require(_0x11d7('0x6'))[_0x11d7('0x7')];var utils=require(_0x11d7('0x8'));var logger=require(_0x11d7('0x9'))('email');function EmailImap(_0x6ebe5f,_0x39ec92){this['mailbox']=_0x6ebe5f[_0x11d7('0xa')];this['account']=this[_0x11d7('0xb')](_0x6ebe5f,_0x39ec92);this['imap']=new Imap(this[_0x11d7('0xc')]);this['imap'][_0x11d7('0xd')](_0x11d7('0xe'),this[_0x11d7('0xf')][_0x11d7('0x10')](this));this['imap'][_0x11d7('0xd')]('end',this[_0x11d7('0x11')][_0x11d7('0x10')](this));this[_0x11d7('0x2')]['on'](_0x11d7('0x12'),this[_0x11d7('0x13')][_0x11d7('0x10')](this));this['imap'][_0x11d7('0x14')]();}util[_0x11d7('0x15')](EmailImap,EventEmitter);EmailImap[_0x11d7('0x16')][_0x11d7('0xb')]=function(_0x771540,_0x433d5c){var _0x136d45={'connTimeout':_0x771540[_0x11d7('0x17')]?_0x771540['connTimeout']*0x3e8:0x2710,'authTimeout':_0x771540['authTimeout']?_0x771540[_0x11d7('0x18')]*0x3e8:0x1388};if(_0x771540['service']){_0x136d45[_0x11d7('0x19')]=_0x771540[_0x11d7('0x19')];if(_0x771540[_0x11d7('0x1a')]){_0x136d45['xoauth2']=utils[_0x11d7('0x1b')](_0x771540[_0x11d7('0x1c')][_0x11d7('0x1d')],_0x771540[_0x11d7('0x19')]);}else{_0x136d45[_0x11d7('0x1e')]=_0x771540[_0x11d7('0x1e')];}}else{if(_0x771540[_0x11d7('0x1f')]){_0x136d45[_0x11d7('0x19')]=_0x771540[_0x11d7('0x19')];_0x136d45[_0x11d7('0x1e')]=_0x771540[_0x11d7('0x1e')];}}_0x136d45[_0x11d7('0x20')]=_0x433d5c||_0x771540[_0x11d7('0x19')]||'anonymous@xcally.com';_0x136d45[_0x11d7('0x21')]=_0x771540[_0x11d7('0x21')];_0x136d45[_0x11d7('0x22')]=_0x771540[_0x11d7('0x22')]||0x3e1;if(_0x771540[_0x11d7('0x23')]){_0x136d45[_0x11d7('0x23')]=!![];}else{_0x136d45['tls']=![];_0x136d45[_0x11d7('0x24')]='required';}return _0x136d45;};EmailImap[_0x11d7('0x16')]['handleReady']=function(){this[_0x11d7('0x2')]['openBox'](this['mailbox'],![],this[_0x11d7('0x25')][_0x11d7('0x10')](this));};EmailImap[_0x11d7('0x16')][_0x11d7('0x25')]=function(_0x26180b,_0x524560){if(_0x26180b){this[_0x11d7('0x13')](_0x26180b,!![]);}else{this[_0x11d7('0x26')]('box',_0x524560);this[_0x11d7('0x27')]();}};EmailImap[_0x11d7('0x16')][_0x11d7('0x28')]=function(_0x2403cd){if(_0x2403cd){this[_0x11d7('0x13')](_0x2403cd,!![]);}else{this[_0x11d7('0x2')][_0x11d7('0x29')]();}};EmailImap[_0x11d7('0x16')]['readUnseen']=function(){this[_0x11d7('0x2')][_0x11d7('0x2a')]([_0x11d7('0x2b')],this[_0x11d7('0x2c')][_0x11d7('0x10')](this));};EmailImap['prototype'][_0x11d7('0x2c')]=function(_0x3b381f,_0x570f81){if(_0x3b381f){this[_0x11d7('0x13')](_0x3b381f,!![]);}else{if(_0x570f81['length']){try{var _0x5204d9=this[_0x11d7('0x2')]['fetch'](_0x570f81,{'bodies':'','markSeen':!![]});_0x5204d9['on']('message',this['handleFetchMessage']['bind'](this));_0x5204d9[_0x11d7('0xd')]('error',this[_0x11d7('0x2d')][_0x11d7('0x10')](this));_0x5204d9[_0x11d7('0xd')]('end',this[_0x11d7('0x2e')][_0x11d7('0x10')](this));}catch(_0x9f6801){logger['error'](_0x9f6801);}}else{this[_0x11d7('0x2')][_0x11d7('0x2f')](!![],this[_0x11d7('0x28')][_0x11d7('0x10')](this));}}};EmailImap['prototype'][_0x11d7('0x30')]=function(_0x15f5a5){_0x15f5a5['on'](_0x11d7('0x31'),this['handleMessageBody'][_0x11d7('0x10')](this));_0x15f5a5[_0x11d7('0xd')](_0x11d7('0x32'),this[_0x11d7('0x33')][_0x11d7('0x10')](this));_0x15f5a5['once'](_0x11d7('0x29'),this['handleMessageEnd'][_0x11d7('0x10')](this));};EmailImap[_0x11d7('0x16')][_0x11d7('0x34')]=function(_0x1fcd58){simpleParser(_0x1fcd58,{'Iconv':Iconv},this[_0x11d7('0x35')][_0x11d7('0x10')](this));};EmailImap[_0x11d7('0x16')]['handleMessageAttributes']=function(){};EmailImap[_0x11d7('0x16')][_0x11d7('0x36')]=function(){};EmailImap[_0x11d7('0x16')][_0x11d7('0x35')]=function(_0xfb5599,_0x402e38){if(_0xfb5599){logger[_0x11d7('0x12')](_0xfb5599);}else{var _0x1dc50c=this;utils['parser'](this[_0x11d7('0xc')],_0x402e38,function(_0x249ebc){_0x1dc50c[_0x11d7('0x26')](_0x11d7('0x20'),_0x249ebc);});}};EmailImap[_0x11d7('0x16')][_0x11d7('0x2e')]=function(){this[_0x11d7('0x2')][_0x11d7('0x2f')](!![],this['handleCloseBox'][_0x11d7('0x10')](this));};EmailImap['prototype'][_0x11d7('0x2d')]=function(_0x5b7395){this['handleError'](_0x5b7395);this['imap'][_0x11d7('0x2f')](!![],this[_0x11d7('0x28')][_0x11d7('0x10')](this));};EmailImap[_0x11d7('0x16')][_0x11d7('0x11')]=function(){this[_0x11d7('0x26')](_0x11d7('0x29'));};EmailImap[_0x11d7('0x16')][_0x11d7('0x13')]=function(_0xf86e6f,_0x284ede){logger[_0x11d7('0x12')]('handleError',this[_0x11d7('0xc')][_0x11d7('0x20')],JSON['stringify'](_0xf86e6f));var _0x231f95='';if(_0xf86e6f){if(_0xf86e6f[_0x11d7('0x37')]){_0x231f95=_0xf86e6f[_0x11d7('0x37')];}else{for(var _0x59555d in _0xf86e6f){if(_0xf86e6f[_0x11d7('0x38')](_0x59555d)){_0x231f95+=_['upperFirst'](_0x59555d)+':\x20'+_0xf86e6f[_0x59555d]+'\x0a';}}}}if(_0x284ede){this[_0x11d7('0x2')]['end']();}else{this['emit']('error',_0x231f95);this[_0x11d7('0x26')](_0x11d7('0x29'));}};module[_0x11d7('0x39')]=EmailImap; \ No newline at end of file +var _0x6386=['emit','handleFetchEnd','handleEnd','stringify','textCode','hasOwnProperty','exports','util','imap','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','mailbox','account','getAccount','once','handleReady','end','bind','error','handleError','connect','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','host','port','tls','autotls','required','prototype','openBox','handleOpenBox','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser'];(function(_0x214bdc,_0x3f398c){var _0x3ee5df=function(_0x4c5eec){while(--_0x4c5eec){_0x214bdc['push'](_0x214bdc['shift']());}};_0x3ee5df(++_0x3f398c);}(_0x6386,0x18d));var _0x6638=function(_0x1122a4,_0x5dff81){_0x1122a4=_0x1122a4-0x0;var _0x505498=_0x6386[_0x1122a4];return _0x505498;};'use strict';var _=require('lodash');var util=require(_0x6638('0x0'));var Imap=require(_0x6638('0x1'));var simpleParser=require(_0x6638('0x2'))[_0x6638('0x3')];var Iconv=require(_0x6638('0x4'))[_0x6638('0x5')];var EventEmitter=require(_0x6638('0x6'))['EventEmitter'];var utils=require(_0x6638('0x7'));var logger=require(_0x6638('0x8'))('email');function EmailImap(_0x5aaa35,_0x35de5e){this[_0x6638('0x9')]=_0x5aaa35['mailbox'];this[_0x6638('0xa')]=this[_0x6638('0xb')](_0x5aaa35,_0x35de5e);this[_0x6638('0x1')]=new Imap(this[_0x6638('0xa')]);this[_0x6638('0x1')][_0x6638('0xc')]('ready',this[_0x6638('0xd')]['bind'](this));this['imap'][_0x6638('0xc')](_0x6638('0xe'),this['handleEnd'][_0x6638('0xf')](this));this['imap']['on'](_0x6638('0x10'),this[_0x6638('0x11')][_0x6638('0xf')](this));this['imap'][_0x6638('0x12')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x6638('0xb')]=function(_0x62a01b,_0x437e8){var _0x577434={'connTimeout':_0x62a01b[_0x6638('0x13')]?_0x62a01b[_0x6638('0x13')]*0x3e8:0x2710,'authTimeout':_0x62a01b['authTimeout']?_0x62a01b[_0x6638('0x14')]*0x3e8:0x1388};if(_0x62a01b[_0x6638('0x15')]){_0x577434[_0x6638('0x16')]=_0x62a01b[_0x6638('0x16')];if(_0x62a01b[_0x6638('0x17')]){_0x577434[_0x6638('0x18')]=utils[_0x6638('0x19')](_0x62a01b[_0x6638('0x1a')][_0x6638('0x1b')],_0x62a01b[_0x6638('0x16')]);}else{_0x577434[_0x6638('0x1c')]=_0x62a01b[_0x6638('0x1c')];}}else{if(_0x62a01b[_0x6638('0x1d')]){_0x577434['user']=_0x62a01b[_0x6638('0x16')];_0x577434[_0x6638('0x1c')]=_0x62a01b[_0x6638('0x1c')];}}_0x577434[_0x6638('0x1e')]=_0x437e8||_0x62a01b[_0x6638('0x16')]||_0x6638('0x1f');_0x577434[_0x6638('0x20')]=_0x62a01b[_0x6638('0x20')];_0x577434[_0x6638('0x21')]=_0x62a01b['port']||0x3e1;if(_0x62a01b[_0x6638('0x22')]){_0x577434[_0x6638('0x22')]=!![];}else{_0x577434[_0x6638('0x22')]=![];_0x577434[_0x6638('0x23')]=_0x6638('0x24');}return _0x577434;};EmailImap[_0x6638('0x25')][_0x6638('0xd')]=function(){this[_0x6638('0x1')][_0x6638('0x26')](this[_0x6638('0x9')],![],this[_0x6638('0x27')][_0x6638('0xf')](this));};EmailImap['prototype'][_0x6638('0x27')]=function(_0x11cb9a,_0x1a52dd){if(_0x11cb9a){this[_0x6638('0x11')](_0x11cb9a,!![]);}else{this['emit'](_0x6638('0x28'),_0x1a52dd);this[_0x6638('0x29')]();}};EmailImap[_0x6638('0x25')]['handleCloseBox']=function(_0x43cb57){if(_0x43cb57){this[_0x6638('0x11')](_0x43cb57,!![]);}else{this[_0x6638('0x1')]['end']();}};EmailImap[_0x6638('0x25')]['readUnseen']=function(){this[_0x6638('0x1')][_0x6638('0x2a')]([_0x6638('0x2b')],this['handleReadUnseen']['bind'](this));};EmailImap['prototype'][_0x6638('0x2c')]=function(_0x406ed6,_0x2f6bdf){if(_0x406ed6){this['handleError'](_0x406ed6,!![]);}else{if(_0x2f6bdf[_0x6638('0x2d')]){try{var _0x38fded=this['imap'][_0x6638('0x2e')](_0x2f6bdf,{'bodies':'','markSeen':!![]});_0x38fded['on'](_0x6638('0x2f'),this[_0x6638('0x30')]['bind'](this));_0x38fded['once'](_0x6638('0x10'),this[_0x6638('0x31')][_0x6638('0xf')](this));_0x38fded[_0x6638('0xc')](_0x6638('0xe'),this['handleFetchEnd'][_0x6638('0xf')](this));}catch(_0x1185a0){logger['error'](_0x1185a0);}}else{this[_0x6638('0x1')][_0x6638('0x32')](!![],this[_0x6638('0x33')]['bind'](this));}}};EmailImap[_0x6638('0x25')]['handleFetchMessage']=function(_0x4da6c8){_0x4da6c8['on'](_0x6638('0x34'),this[_0x6638('0x35')][_0x6638('0xf')](this));_0x4da6c8[_0x6638('0xc')](_0x6638('0x36'),this[_0x6638('0x37')][_0x6638('0xf')](this));_0x4da6c8['once'](_0x6638('0xe'),this[_0x6638('0x38')][_0x6638('0xf')](this));};EmailImap['prototype'][_0x6638('0x35')]=function(_0x224024){simpleParser(_0x224024,{'Iconv':Iconv},this[_0x6638('0x39')][_0x6638('0xf')](this));};EmailImap[_0x6638('0x25')][_0x6638('0x37')]=function(){};EmailImap[_0x6638('0x25')][_0x6638('0x38')]=function(){};EmailImap[_0x6638('0x25')][_0x6638('0x39')]=function(_0x4d9497,_0x468a8e){if(_0x4d9497){logger[_0x6638('0x10')](_0x4d9497);}else{var _0x28d68a=this;utils['parser'](this[_0x6638('0xa')],_0x468a8e,function(_0x499f99){_0x28d68a[_0x6638('0x3a')](_0x6638('0x1e'),_0x499f99);});}};EmailImap['prototype'][_0x6638('0x3b')]=function(){this['imap']['closeBox'](!![],this[_0x6638('0x33')][_0x6638('0xf')](this));};EmailImap[_0x6638('0x25')][_0x6638('0x31')]=function(_0x386bb8){this[_0x6638('0x11')](_0x386bb8);this['imap'][_0x6638('0x32')](!![],this[_0x6638('0x33')][_0x6638('0xf')](this));};EmailImap[_0x6638('0x25')][_0x6638('0x3c')]=function(){this[_0x6638('0x3a')]('end');};EmailImap[_0x6638('0x25')][_0x6638('0x11')]=function(_0x418a9c,_0x4838e7){logger['error'](_0x6638('0x11'),this[_0x6638('0xa')][_0x6638('0x1e')],JSON[_0x6638('0x3d')](_0x418a9c));var _0xe8fad5='';if(_0x418a9c){if(_0x418a9c[_0x6638('0x3e')]){_0xe8fad5=_0x418a9c['textCode'];}else{for(var _0x4e125f in _0x418a9c){if(_0x418a9c[_0x6638('0x3f')](_0x4e125f)){_0xe8fad5+=_['upperFirst'](_0x4e125f)+':\x20'+_0x418a9c[_0x4e125f]+'\x0a';}}}}if(_0x4838e7){this[_0x6638('0x1')]['end']();}else{this[_0x6638('0x3a')](_0x6638('0x10'),_0xe8fad5);this['emit']('end');}};module[_0x6638('0x40')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 32ffbe7..880b341 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 _0xebec=['use','compile','toString','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x29e55e,_0x34e0f3){var _0x2efe2c=function(_0x5e8817){while(--_0x5e8817){_0x29e55e['push'](_0x29e55e['shift']());}};_0x2efe2c(++_0x34e0f3);}(_0xebec,0x91));var _0xcebe=function(_0x445435,_0x50d870){_0x445435=_0x445435-0x0;var _0x22f0ab=_0xebec[_0x445435];return _0x22f0ab;};'use strict';var nodemailer=require(_0xcebe('0x0'));var inlineBase64=require(_0xcebe('0x1'));function EmailSmtp(){}EmailSmtp[_0xcebe('0x2')][_0xcebe('0x3')]=function(_0x2373ea,_0x1899b0){return new Promise(function(_0x335fbd,_0x53cd66){var _0x430eee=nodemailer[_0xcebe('0x4')](_0x2373ea);_0x430eee[_0xcebe('0x5')](_0xcebe('0x6'),inlineBase64());_0x430eee['sendMail'](_0x1899b0,function(_0x5ee01d,_0x7de1c5){if(_0x5ee01d){_0x53cd66(_0x5ee01d[_0xcebe('0x7')]());}else{_0x335fbd(_0x7de1c5);}});});};EmailSmtp[_0xcebe('0x2')][_0xcebe('0x8')]=function(_0x40afef){return new Promise(function(_0x2939ca,_0xa1270a){var _0x48fa29=nodemailer['createTransport'](_0x40afef);_0x48fa29[_0xcebe('0x8')](function(_0x368fa2,_0x2837ec){if(_0x368fa2){_0xa1270a(_0x368fa2['toString']());}else{if(_0x2837ec){_0x2939ca(_0x2837ec);}else{_0xa1270a(_0xcebe('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xe5dc=['nodemailer','prototype','send','createTransport','use','compile','sendMail','toString','Not\x20verifired','exports'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xe5dc,0x1cc));var _0xce5d=function(_0x1b8c74,_0x413446){_0x1b8c74=_0x1b8c74-0x0;var _0x24a27a=_0xe5dc[_0x1b8c74];return _0x24a27a;};'use strict';var nodemailer=require(_0xce5d('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xce5d('0x1')][_0xce5d('0x2')]=function(_0x53df7c,_0x225dff){return new Promise(function(_0x37117b,_0x1fca32){var _0x16ca82=nodemailer[_0xce5d('0x3')](_0x53df7c);_0x16ca82[_0xce5d('0x4')](_0xce5d('0x5'),inlineBase64());_0x16ca82[_0xce5d('0x6')](_0x225dff,function(_0x372efe,_0x21ecf0){if(_0x372efe){_0x1fca32(_0x372efe[_0xce5d('0x7')]());}else{_0x37117b(_0x21ecf0);}});});};EmailSmtp['prototype']['verify']=function(_0x47081d){return new Promise(function(_0x20fade,_0x576e51){var _0x4b7df1=nodemailer[_0xce5d('0x3')](_0x47081d);_0x4b7df1['verify'](function(_0x5d2c4a,_0x47f1ed){if(_0x5d2c4a){_0x576e51(_0x5d2c4a[_0xce5d('0x7')]());}else{if(_0x47f1ed){_0x20fade(_0x47f1ed);}else{_0x576e51(_0xce5d('0x8'));}}});});};module[_0xce5d('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index f303687..16bee85 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 _0x2241=['Auto-Submitted:\x20auto-replied','Precedence:\x20auto_reply','headerLines','line','isAutoreply','parser','from','subject','messageId','inReplyTo','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','content','BodyHTML','

Empty\x20message

','Attachments','push','Title','generateXOAuth2Token','user=','auth=Bearer\x20','join','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','head','value','address','generate','@xcally.com','name','substring','indexOf','split','length','slice','Anonymous','pop','isEmpty','anonymous','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x1859ca[_0x1224('0x10')](0x0,-0x1)['join']('\x20'):_0x30a89a[_0x1224('0xb')];}return _0x1224('0x11');}function getLastName(_0x375db5){var _0x2eb4b0=_[_0x1224('0x6')](_0x375db5[_0x1224('0x7')]);if(_0x2eb4b0&&_0x2eb4b0[_0x1224('0xb')]){var _0x54f57e=_0x2eb4b0['name']['split'](/\s+/);return _0x54f57e['length']>0x1?_0x54f57e[_0x1224('0x12')]():'';}return'';}function getMails(_0x257f85,_0x13c19d){var _0x120a4d='';for(var _0x311a8e=0x0;_0x311a8e<_0x13c19d['value'][_0x1224('0xf')];_0x311a8e+=0x1){if(_0x13c19d[_0x1224('0x7')][_0x311a8e][_0x1224('0x8')]!==_0x257f85){if(!_[_0x1224('0x13')](_0x120a4d)){_0x120a4d+=',';}_0x120a4d+=_0x13c19d[_0x1224('0x7')][_0x311a8e][_0x1224('0xb')]||_0x13c19d[_0x1224('0x7')][_0x311a8e][_0x1224('0x8')]||'';_0x120a4d+='\x20<';_0x120a4d+=_0x13c19d[_0x1224('0x7')][_0x311a8e]['address']?_0x13c19d[_0x1224('0x7')][_0x311a8e]['address']:_0x1224('0x14')+random[_0x1224('0x9')](0x6)+'@xcally.com';_0x120a4d+='>';}}return _0x120a4d;}function parseEmail(_0x324e5d,_0x3aefff,_0x502c6a){if(_0x3aefff[_0x1224('0x15')]){var _0x1a7fd7=/)<[^<]*)*<\/script>/gi;while(_0x1a7fd7[_0x1224('0x16')](_0x3aefff[_0x1224('0x15')])){_0x3aefff[_0x1224('0x15')]=_0x3aefff[_0x1224('0x15')][_0x1224('0x17')](_0x1a7fd7,'');}if(_0x3aefff[_0x1224('0x15')][_0x1224('0x18')](_0x1224('0x19'))){var _0x6a52c2=[];_0x3aefff[_0x1224('0x1a')][_0x1224('0x1b')](_0x50879f=>{_0x6a52c2['push'](_0x50879f[_0x1224('0x1c')]);});var _0x269f29=/]+>/g;var _0x368564=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4ff561=_0x3aefff['html']['replace'](_0x368564,_0x1224('0x1d'));var _0x6d2db7=_0x4ff561[_0x1224('0x17')](_0x269f29,_0x1224('0x1e'));for(let _0x46cb8b=0x0;_0x46cb8b<_0x6a52c2[_0x1224('0xf')];_0x46cb8b++){var _0xb91a8e=_0x6d2db7[_0x1224('0x17')](_0x1224('0x1e'),_0x1224('0x1f')+_0x6a52c2[_0x46cb8b]+_0x1224('0x20'));_0x6d2db7=_0xb91a8e;}_0x3aefff[_0x1224('0x15')]=_0x6d2db7;}_0x502c6a[_0x1224('0x21')]=_0x3aefff['html'];}else{_0x502c6a[_0x1224('0x21')]=_0x3aefff[_0x1224('0x22')];}if(_0x502c6a[_0x1224('0x21')]){_0x502c6a[_0x1224('0x21')]=_0x502c6a[_0x1224('0x21')][_0x1224('0x17')](/0x0){var _0x3a6ca2=[_0x1224('0x2f'),'X-Auto-Response-Suppress:\x20All',_0x1224('0x30')];for(var _0x1a18b1=0x0;_0x1a18b1<_0x3aefff['headerLines'][_0x1224('0xf')];_0x1a18b1++){var _0x195cbf=_[_0x1224('0xd')](_0x3a6ca2,_0x3aefff[_0x1224('0x31')][_0x1a18b1][_0x1224('0x32')]);if(_0x195cbf>=0x0){_0x502c6a[_0x1224('0x33')]=!![];}}}return _0x502c6a;}exports[_0x1224('0x34')]=function(_0x4ba2b9,_0x49ec20,_0x3fbe58){var _0x35178e={'from':getAddress(_0x49ec20[_0x1224('0x35')]),'firstName':getFirstName(_0x49ec20[_0x1224('0x35')]),'lastName':getLastName(_0x49ec20[_0x1224('0x35')]),'mapKey':_0x1224('0x26'),'message':{'from':getMails(_0x4ba2b9[_0x1224('0x26')],_0x49ec20[_0x1224('0x35')]),'to':_0x4ba2b9[_0x1224('0x26')],'cc':'','subject':_0x49ec20[_0x1224('0x36')]||'','messageId':_0x49ec20[_0x1224('0x37')],'inReplyTo':_0x49ec20[_0x1224('0x38')],'sentAt':moment(_0x49ec20['date'])[_0x1224('0x2b')](_0x1224('0x39')),'attach':![],'attachments':[]}};if(!_0x49ec20[_0x1224('0x15')]&&!_0x49ec20[_0x1224('0x22')]){var _0x3adaaa=_[_0x1224('0x3a')](_0x49ec20[_0x1224('0x1a')],{'contentType':_0x1224('0x3b')});if(_0x3adaaa[_0x1224('0xf')]){logger[_0x1224('0x3c')](util['format'](_0x1224('0x3d'),_0x49ec20[_0x1224('0x37')]));tnef[_0x1224('0x3e')](_[_0x1224('0x3f')](_0x3adaaa)[_0x1224('0x40')],function(_0x51e0c9,_0x1fbcd5){if(_0x1fbcd5){_0x49ec20[_0x1224('0x15')]=_0x1fbcd5[_0x1224('0x41')]||_0x1224('0x42');if(_0x1fbcd5[_0x1224('0x43')]){for(var _0x266c83=0x0;_0x266c83<_0x1fbcd5[_0x1224('0x43')][_0x1224('0xf')];_0x266c83++){var _0xc58b05=_0x1fbcd5['Attachments'][_0x266c83];_0x35178e[_0x1224('0x24')][_0x1224('0x1a')][_0x1224('0x44')]({'filename':_0xc58b05[_0x1224('0x45')],'content':Buffer['from'](_0xc58b05['Data'])});}}}_0x3fbe58(parseEmail(_0x4ba2b9,_0x49ec20,_0x35178e));});}else{_0x49ec20[_0x1224('0x15')]=_0x1224('0x42');_0x3fbe58(parseEmail(_0x4ba2b9,_0x49ec20,_0x35178e));}}else{_0x3fbe58(parseEmail(_0x4ba2b9,_0x49ec20,_0x35178e));}};exports[_0x1224('0x46')]=function(_0x2a1572,_0x1bf133){var _0x1d8e9a=[_0x1224('0x47')+(_0x1bf133||''),_0x1224('0x48')+_0x2a1572,'',''];return Buffer[_0x1224('0x35')](_0x1d8e9a[_0x1224('0x49')](''),_0x1224('0x4a'))[_0x1224('0x4b')](_0x1224('0x4c'));}; \ No newline at end of file +var _0xc202=['format','now','join','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','from','subject','messageId','date','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','address','anonymous','generate','@xcally.com','value','name','substring','indexOf','split','length','slice','pop','html','test','replace','\x20[Attachment:\x20','body','textAsHtml','0x1?_0x236dff[_0x2c20('0x13')](0x0,-0x1)['join']('\x20'):_0x976572[_0x2c20('0xe')];}return'Anonymous';}function getLastName(_0x54fbba){var _0x53fc8a=_['head'](_0x54fbba[_0x2c20('0xd')]);if(_0x53fc8a&&_0x53fc8a[_0x2c20('0xe')]){var _0x567f72=_0x53fc8a['name'][_0x2c20('0x11')](/\s+/);return _0x567f72[_0x2c20('0x12')]>0x1?_0x567f72[_0x2c20('0x14')]():'';}return'';}function getMails(_0x20f556,_0x127b54){var _0x3606a1='';for(var _0x3b6005=0x0;_0x3b6005<_0x127b54['value'][_0x2c20('0x12')];_0x3b6005+=0x1){if(_0x127b54[_0x2c20('0xd')][_0x3b6005][_0x2c20('0x9')]!==_0x20f556){if(!_['isEmpty'](_0x3606a1)){_0x3606a1+=',';}_0x3606a1+=_0x127b54['value'][_0x3b6005][_0x2c20('0xe')]||_0x127b54[_0x2c20('0xd')][_0x3b6005][_0x2c20('0x9')]||'';_0x3606a1+='\x20<';_0x3606a1+=_0x127b54[_0x2c20('0xd')][_0x3b6005]['address']?_0x127b54[_0x2c20('0xd')][_0x3b6005]['address']:'anonymous'+random[_0x2c20('0xb')](0x6)+_0x2c20('0xc');_0x3606a1+='>';}}return _0x3606a1;}function parseEmail(_0x328efe,_0x4e2891,_0x121df6){if(_0x4e2891[_0x2c20('0x15')]){var _0x594850=/)<[^<]*)*<\/script>/gi;while(_0x594850[_0x2c20('0x16')](_0x4e2891[_0x2c20('0x15')])){_0x4e2891['html']=_0x4e2891[_0x2c20('0x15')][_0x2c20('0x17')](_0x594850,'');}if(_0x4e2891[_0x2c20('0x15')]['includes'](_0x2c20('0x18'))){var _0x1f8e02=[];_0x4e2891[_0x2c20('0x19')][_0x2c20('0x1a')](_0x137076=>{_0x1f8e02[_0x2c20('0x1b')](_0x137076[_0x2c20('0x1c')]);});var _0x21d39d=/]+>/g;var _0x4a5971=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3700a0=_0x4e2891[_0x2c20('0x15')][_0x2c20('0x17')](_0x4a5971,_0x2c20('0x1d'));var _0x100c41=_0x3700a0['replace'](_0x21d39d,_0x2c20('0x1e'));for(let _0x5267f2=0x0;_0x5267f2<_0x1f8e02['length'];_0x5267f2++){var _0x3e2999=_0x100c41['replace'](_0x2c20('0x1e'),_0x2c20('0x1f')+_0x1f8e02[_0x5267f2]+'\x20]');_0x100c41=_0x3e2999;}_0x4e2891[_0x2c20('0x15')]=_0x100c41;}_0x121df6[_0x2c20('0x20')]=_0x4e2891[_0x2c20('0x15')];}else{_0x121df6[_0x2c20('0x20')]=_0x4e2891[_0x2c20('0x21')];}if(_0x121df6[_0x2c20('0x20')]){_0x121df6['body']=_0x121df6['body'][_0x2c20('0x17')](/0x0){var _0x41958b=['Auto-Submitted:\x20auto-replied',_0x2c20('0x35'),_0x2c20('0x36')];for(var _0x4c7e3d=0x0;_0x4c7e3d<_0x4e2891[_0x2c20('0x34')][_0x2c20('0x12')];_0x4c7e3d++){var _0x1b71a8=_['indexOf'](_0x41958b,_0x4e2891[_0x2c20('0x34')][_0x4c7e3d][_0x2c20('0x37')]);if(_0x1b71a8>=0x0){_0x121df6[_0x2c20('0x38')]=!![];}}}return _0x121df6;}exports['parser']=function(_0x2b9958,_0x5ca3a9,_0x1a0a66){var _0x354de8={'from':getAddress(_0x5ca3a9[_0x2c20('0x39')]),'firstName':getFirstName(_0x5ca3a9[_0x2c20('0x39')]),'lastName':getLastName(_0x5ca3a9['from']),'mapKey':'email','message':{'from':getMails(_0x2b9958[_0x2c20('0x7')],_0x5ca3a9[_0x2c20('0x39')]),'to':_0x2b9958[_0x2c20('0x7')],'cc':'','subject':_0x5ca3a9[_0x2c20('0x3a')]||'','messageId':_0x5ca3a9[_0x2c20('0x3b')],'inReplyTo':_0x5ca3a9['inReplyTo'],'sentAt':moment(_0x5ca3a9[_0x2c20('0x3c')])['format'](_0x2c20('0x3d')),'attach':![],'attachments':[]}};if(!_0x5ca3a9['html']&&!_0x5ca3a9['textAsHtml']){var _0x30a54a=_['filter'](_0x5ca3a9['attachments'],{'contentType':_0x2c20('0x3e')});if(_0x30a54a[_0x2c20('0x12')]){logger[_0x2c20('0x3f')](util[_0x2c20('0x2c')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x5ca3a9[_0x2c20('0x3b')]));tnef[_0x2c20('0x40')](_[_0x2c20('0x41')](_0x30a54a)[_0x2c20('0x32')],function(_0x33bfef,_0x5324e5){if(_0x5324e5){_0x5ca3a9[_0x2c20('0x15')]=_0x5324e5[_0x2c20('0x42')]||_0x2c20('0x43');if(_0x5324e5[_0x2c20('0x44')]){for(var _0x5f5b26=0x0;_0x5f5b26<_0x5324e5[_0x2c20('0x44')][_0x2c20('0x12')];_0x5f5b26++){var _0x534e19=_0x5324e5[_0x2c20('0x44')][_0x5f5b26];_0x354de8[_0x2c20('0x25')][_0x2c20('0x19')][_0x2c20('0x1b')]({'filename':_0x534e19[_0x2c20('0x45')],'content':Buffer[_0x2c20('0x39')](_0x534e19[_0x2c20('0x46')])});}}}_0x1a0a66(parseEmail(_0x2b9958,_0x5ca3a9,_0x354de8));});}else{_0x5ca3a9['html']=_0x2c20('0x43');_0x1a0a66(parseEmail(_0x2b9958,_0x5ca3a9,_0x354de8));}}else{_0x1a0a66(parseEmail(_0x2b9958,_0x5ca3a9,_0x354de8));}};exports[_0x2c20('0x47')]=function(_0x120ee2,_0x25e4ae){var _0x591757=[_0x2c20('0x48')+(_0x25e4ae||''),_0x2c20('0x49')+_0x120ee2,'',''];return Buffer['from'](_0x591757[_0x2c20('0x2e')](''),_0x2c20('0x4a'))[_0x2c20('0x4b')](_0x2c20('0x4c'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 3b0d3b3..d8fdcf4 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 _0xc428=['key','active','Imap','Smtp','exports','name','Service'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xc428,0x1a2));var _0x8c42=function(_0x2b491d,_0x4253a4){_0x2b491d=_0x2b491d-0x0;var _0x4d3162=_0xc428[_0x2b491d];return _0x4d3162;};'use strict';var _=require('lodash');function MailAccount(_0x3a9251){this['id']=_0x3a9251['id']||0x0;this[_0x8c42('0x0')]=_0x3a9251[_0x8c42('0x0')]||_0x8c42('0x1');this[_0x8c42('0x2')]=_0x3a9251[_0x8c42('0x2')]||'SERV';this['active']=_0x3a9251[_0x8c42('0x3')]||![];this[_0x8c42('0x4')]=_0x3a9251[_0x8c42('0x4')]||[];this[_0x8c42('0x5')]=_0x3a9251['Smtp']||[];}module[_0x8c42('0x6')]=MailAccount; \ No newline at end of file +var _0x9674=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0x5391a1,_0xc617ff){var _0xb454de=function(_0x2b5772){while(--_0x2b5772){_0x5391a1['push'](_0x5391a1['shift']());}};_0xb454de(++_0xc617ff);}(_0x9674,0x197));var _0x4967=function(_0x43fda2,_0x1c5662){_0x43fda2=_0x43fda2-0x0;var _0xa492a2=_0x9674[_0x43fda2];return _0xa492a2;};'use strict';var _=require(_0x4967('0x0'));function MailAccount(_0x311546){this['id']=_0x311546['id']||0x0;this['name']=_0x311546[_0x4967('0x1')]||_0x4967('0x2');this['key']=_0x311546[_0x4967('0x3')]||_0x4967('0x4');this[_0x4967('0x5')]=_0x311546[_0x4967('0x5')]||![];this[_0x4967('0x6')]=_0x311546['Imap']||[];this[_0x4967('0x7')]=_0x311546[_0x4967('0x7')]||[];}module[_0x4967('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index c5a4339..40b1ea2 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 _0x84f2=['hasOwnProperty','mergeFromDatabase','initMailAccounts','merge','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x1f4712,_0x4a2021){var _0x2771f6=function(_0x52d4ad){while(--_0x52d4ad){_0x1f4712['push'](_0x1f4712['shift']());}};_0x2771f6(++_0x4a2021);}(_0x84f2,0x17e));var _0x284f=function(_0x16ca8e,_0x60f267){_0x16ca8e=_0x16ca8e-0x0;var _0x4c560e=_0x84f2[_0x16ca8e];return _0x4c560e;};'use strict';var _=require('lodash');var MailAccount=require(_0x284f('0x0'));var Realtime=function(){this[_0x284f('0x1')]={};};function freeIsNotKey(_0x449219,_0x38a8a3,_0x478c03){var _0x8fc013=_[_0x284f('0x2')](_0x449219,function(_0x50b399,_0xfc602e){return _0x50b399[_0x478c03];});for(var _0x1f94f3 in _0x38a8a3){if(_0x38a8a3[_0x284f('0x3')](_0x1f94f3)){if(!_0x8fc013[_0x1f94f3]){delete _0x38a8a3[_0x1f94f3];}}}}Realtime['prototype'][_0x284f('0x4')]=function(_0x4cb60d,_0x4df94d){for(var _0x21f366 in _0x4df94d){if(_0x4cb60d[_0x284f('0x3')](_0x21f366)){_0x4cb60d[_0x21f366]=_0x4df94d[_0x21f366];}}};Realtime['prototype'][_0x284f('0x5')]=function(){var _0x4f7c43=this;return function(_0x28616){if(_0x28616){freeIsNotKey(_0x28616,_0x4f7c43['mailAccounts'],'id');for(var _0x5056cd=0x0,_0x43ddca={},_0xa53ca2={};_0x5056cd<_0x28616['length'];_0x5056cd+=0x1){_0x43ddca=_0x28616[_0x5056cd];if(_['isUndefined'](_0x4f7c43[_0x284f('0x1')][_0x43ddca['id']])){_0x4f7c43[_0x284f('0x1')][_0x43ddca['id']]=new MailAccount(_0x43ddca);}else{_[_0x284f('0x6')](_0x4f7c43['mailAccounts'][_0x43ddca['id']],_0x43ddca);}}}return _0x4f7c43[_0x284f('0x1')];};};module['exports']=Realtime; \ No newline at end of file +var _0xe933=['mergeFromDatabase','prototype','length','exports','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x38c817,_0x88a47e){var _0x3a1e4e=function(_0x5b3638){while(--_0x5b3638){_0x38c817['push'](_0x38c817['shift']());}};_0x3a1e4e(++_0x88a47e);}(_0xe933,0x174));var _0x3e93=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe933[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var MailAccount=require(_0x3e93('0x0'));var Realtime=function(){this[_0x3e93('0x1')]={};};function freeIsNotKey(_0x1aca45,_0x2b6a06,_0x1c898f){var _0x2568f4=_[_0x3e93('0x2')](_0x1aca45,function(_0x5863f8,_0x1610b9){return _0x5863f8[_0x1c898f];});for(var _0x498153 in _0x2b6a06){if(_0x2b6a06[_0x3e93('0x3')](_0x498153)){if(!_0x2568f4[_0x498153]){delete _0x2b6a06[_0x498153];}}}}Realtime['prototype'][_0x3e93('0x4')]=function(_0x1eefed,_0x3c61ec){for(var _0x3c7a55 in _0x3c61ec){if(_0x1eefed[_0x3e93('0x3')](_0x3c7a55)){_0x1eefed[_0x3c7a55]=_0x3c61ec[_0x3c7a55];}}};Realtime[_0x3e93('0x5')]['initMailAccounts']=function(){var _0x2d22e0=this;return function(_0x171255){if(_0x171255){freeIsNotKey(_0x171255,_0x2d22e0['mailAccounts'],'id');for(var _0x3e125f=0x0,_0x48a1c6={},_0x474512={};_0x3e125f<_0x171255[_0x3e93('0x6')];_0x3e125f+=0x1){_0x48a1c6=_0x171255[_0x3e125f];if(_['isUndefined'](_0x2d22e0[_0x3e93('0x1')][_0x48a1c6['id']])){_0x2d22e0[_0x3e93('0x1')][_0x48a1c6['id']]=new MailAccount(_0x48a1c6);}else{_['merge'](_0x2d22e0[_0x3e93('0x1')][_0x48a1c6['id']],_0x48a1c6);}}}return _0x2d22e0[_0x3e93('0x1')];};};module[_0x3e93('0x7')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index a1bb07f..0c39d3d 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 _0x9ff9=['NotifyMailAccount','getMailAccounts','GetMailAccount','name','service','email','active','key','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','Smtp','getMailAccount','notify','Request'];(function(_0x32eae5,_0x4971a5){var _0x36aa12=function(_0x48df67){while(--_0x48df67){_0x32eae5['push'](_0x32eae5['shift']());}};_0x36aa12(++_0x4971a5);}(_0x9ff9,0x1c3));var _0x99ff=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x9ff9[_0x31cb5f];return _0x586042;};'use strict';var client=require('../client');exports[_0x99ff('0x0')]=function(){return function(){return client['Request'](_0x99ff('0x1'),{'options':{'attributes':['id',_0x99ff('0x2'),'provider',_0x99ff('0x3'),_0x99ff('0x4'),_0x99ff('0x5'),_0x99ff('0x6'),'ListId',_0x99ff('0x7')],'raw':![],'include':[{'model':_0x99ff('0x8'),'as':_0x99ff('0x9'),'include':[{'model':_0x99ff('0xa'),'attributes':['id',_0x99ff('0x2'),'service',_0x99ff('0xb'),_0x99ff('0xc')],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0x99ff('0xd'),'include':[{'model':'CloudProvider','attributes':['id',_0x99ff('0x2'),'service',_0x99ff('0xb'),'data5'],'as':_0x99ff('0xa')}]}]},'log':_0x99ff('0xe')});};};exports[_0x99ff('0xf')]=function(_0x51c16c,_0x6c0fcf){return client[_0x99ff('0x10')](_0x99ff('0x11'),{'account':{'id':_0x51c16c},'body':_0x6c0fcf,'log':_0x99ff('0x11')});}; \ No newline at end of file +var _0xdb82=['email','active','key','ListId','Imap','type','data5','CloudProvider','name','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','service'];(function(_0xfe5765,_0x15557c){var _0x3ebbcc=function(_0x484c06){while(--_0x484c06){_0xfe5765['push'](_0xfe5765['shift']());}};_0x3ebbcc(++_0x15557c);}(_0xdb82,0x1dc));var _0x2db8=function(_0x117a6b,_0x103d7e){_0x117a6b=_0x117a6b-0x0;var _0x402379=_0xdb82[_0x117a6b];return _0x402379;};'use strict';var client=require(_0x2db8('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x2db8('0x1')](_0x2db8('0x2'),{'options':{'attributes':['id','name','provider',_0x2db8('0x3'),_0x2db8('0x4'),_0x2db8('0x5'),_0x2db8('0x6'),_0x2db8('0x7'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0x2db8('0x8'),'include':[{'model':'CloudProvider','attributes':['id','name','service',_0x2db8('0x9'),_0x2db8('0xa')],'as':'CloudProvider'}]},{'model':'MailServerOut','as':'Smtp','include':[{'model':_0x2db8('0xb'),'attributes':['id',_0x2db8('0xc'),_0x2db8('0x3'),_0x2db8('0x9'),'data5'],'as':_0x2db8('0xb')}]}]},'log':_0x2db8('0xd')});};};exports[_0x2db8('0xe')]=function(_0x50086c,_0x502a9b){return client[_0x2db8('0x1')](_0x2db8('0xf'),{'account':{'id':_0x50086c},'body':_0x502a9b,'log':_0x2db8('0xf')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index f16c7be..9cd08a5 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 _0x267e=['loginMailFrequency','GetSettings','../client','getSettings','ShowSetting'];(function(_0x1a2e28,_0x911614){var _0x5ced5b=function(_0x18ee0b){while(--_0x18ee0b){_0x1a2e28['push'](_0x1a2e28['shift']());}};_0x5ced5b(++_0x911614);}(_0x267e,0x9d));var _0xe267=function(_0x25e1af,_0x373d40){_0x25e1af=_0x25e1af-0x0;var _0x5386fe=_0x267e[_0x25e1af];return _0x5386fe;};'use strict';var client=require(_0xe267('0x0'));exports[_0xe267('0x1')]=function(){return client['Request'](_0xe267('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe267('0x3')]},'log':_0xe267('0x4')});}; \ No newline at end of file +var _0xedf5=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xedf5,0xc6));var _0x5edf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xedf5[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5edf('0x0'));exports[_0x5edf('0x1')]=function(){return client['Request'](_0x5edf('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5edf('0x3')]},'log':_0x5edf('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index d83e2eb..87d4bed 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index b447df6..9134f11 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 _0x1ba2=['defaults','redis','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x1ba2,0x16b));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x21ba('0x0'));var sticky=require(_0x21ba('0x1'));var Redis=require(_0x21ba('0x2'));var config=require(_0x21ba('0x3'));var app=express();var server=http[_0x21ba('0x4')](app);server[_0x21ba('0x5')]=0xdbba0;if(sticky[_0x21ba('0x6')](server,config[_0x21ba('0x7')])){var socketio=require(_0x21ba('0x8'))(server,{'transports':[_0x21ba('0x9'),_0x21ba('0xa')]});config['redis']=_[_0x21ba('0xb')](config[_0x21ba('0xc')],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0x21ba('0xd'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x21ba('0xc')])}));require(_0x21ba('0xe'))[_0x21ba('0xf')]();require(_0x21ba('0x10'))[_0x21ba('0xf')](socketio);require(_0x21ba('0x11'))[_0x21ba('0xf')](app);require(_0x21ba('0x12'))[_0x21ba('0xf')](app);}else{server['once'](_0x21ba('0x13'),function(){console[_0x21ba('0x14')](_0x21ba('0x15'),config[_0x21ba('0x7')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x3b19=['../../config/environment','timeout','listen','port','defaults','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3b19,0x8b));var _0x93b1=function(_0x64397d,_0xc17569){_0x64397d=_0x64397d-0x0;var _0x5de5cc=_0x3b19[_0x64397d];return _0x5de5cc;};'use strict';var _=require(_0x93b1('0x0'));var http=require(_0x93b1('0x1'));var express=require(_0x93b1('0x2'));var sticky=require(_0x93b1('0x3'));var Redis=require(_0x93b1('0x4'));var config=require(_0x93b1('0x5'));var app=express();var server=http['createServer'](app);server[_0x93b1('0x6')]=0xdbba0;if(sticky[_0x93b1('0x7')](server,config[_0x93b1('0x8')])){var socketio=require('socket.io')(server,{'transports':['websocket','polling']});config['redis']=_[_0x93b1('0x9')](config[_0x93b1('0xa')],{'host':_0x93b1('0xb'),'port':0x18eb});socketio[_0x93b1('0xc')](require(_0x93b1('0xd'))({'pubClient':new Redis(config[_0x93b1('0xa')]),'subClient':new Redis(config[_0x93b1('0xa')])}));require(_0x93b1('0xe'))[_0x93b1('0xf')]();require(_0x93b1('0x10'))[_0x93b1('0xf')](socketio);require(_0x93b1('0x11'))[_0x93b1('0xf')](app);require(_0x93b1('0x12'))['default'](app);}else{server[_0x93b1('0x13')](_0x93b1('0x14'),function(){console[_0x93b1('0x15')](_0x93b1('0x16'),config['port']);});}exports=module[_0x93b1('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index b13f033..faf962a 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 _0x9e49=['jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','routing','error','message','result','catch','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e49,0x80));var _0x99e4=function(_0x4bc413,_0x4a5161){_0x4bc413=_0x4bc413-0x0;var _0x13910d=_0x9e49[_0x4bc413];return _0x13910d;};'use strict';var jayson=require(_0x99e4('0x0'));var BPromise=require(_0x99e4('0x1'));var logger=require(_0x99e4('0x2'))('routing');var client=jayson[_0x99e4('0x3')][_0x99e4('0x4')]({'port':0x2329});client[_0x99e4('0x5')]=function(_0x7d3a10,_0x2621fe){return new BPromise(function(_0x3c922c,_0x39924b){return client[_0x99e4('0x6')](_0x7d3a10,_0x2621fe)[_0x99e4('0x7')](function(_0x148547){logger[_0x99e4('0x8')](_0x99e4('0x9'),_0x99e4('0xa'),_0x7d3a10,_0x2621fe,_0x148547);if(_0x148547[_0x99e4('0xb')]){logger['error'](_0x99e4('0x9'),_0x99e4('0xa'),_0x7d3a10,_0x148547['error'][_0x99e4('0xc')],_0x2621fe);return _0x39924b(_0x148547[_0x99e4('0xb')][_0x99e4('0xc')]);}else{return _0x3c922c(_0x148547[_0x99e4('0xd')]);}})[_0x99e4('0xe')](function(_0x17afc1){logger[_0x99e4('0xb')](_0x99e4('0x9'),'routing',_0x7d3a10,_0x17afc1,_0x2621fe);return _0x39924b(_0x17afc1);});});};module[_0x99e4('0xf')]=client; \ No newline at end of file +var _0x75b6=['Request','request','debug','rpc','error','message','result','catch','jayson/promise','bluebird','routing','client','http'];(function(_0x4f0111,_0x10ed84){var _0x3d3781=function(_0x1d2be9){while(--_0x1d2be9){_0x4f0111['push'](_0x4f0111['shift']());}};_0x3d3781(++_0x10ed84);}(_0x75b6,0xa4));var _0x675b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75b6[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x675b('0x0'));var BPromise=require(_0x675b('0x1'));var logger=require('../../config/logger')(_0x675b('0x2'));var client=jayson[_0x675b('0x3')][_0x675b('0x4')]({'port':0x2329});client[_0x675b('0x5')]=function(_0x510420,_0x52f48f){return new BPromise(function(_0x1730a1,_0x293799){return client[_0x675b('0x6')](_0x510420,_0x52f48f)['then'](function(_0x570dd9){logger[_0x675b('0x7')](_0x675b('0x8'),_0x675b('0x2'),_0x510420,_0x52f48f,_0x570dd9);if(_0x570dd9[_0x675b('0x9')]){logger[_0x675b('0x9')](_0x675b('0x8'),_0x675b('0x2'),_0x510420,_0x570dd9[_0x675b('0x9')][_0x675b('0xa')],_0x52f48f);return _0x293799(_0x570dd9[_0x675b('0x9')][_0x675b('0xa')]);}else{return _0x1730a1(_0x570dd9[_0x675b('0xb')]);}})[_0x675b('0xc')](function(_0x1bf874){logger['error'](_0x675b('0x8'),'routing',_0x510420,_0x1bf874,_0x52f48f);return _0x293799(_0x1bf874);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 06b0747..d88da82 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 _0x96a1=['log','bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x96a1,0x11f));var _0x196a=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x96a1[_0x1cc8fe];return _0x230054;};'use strict';var BPromise=require(_0x196a('0x0'));var server=require(_0x196a('0x1'));var Realtime=require(_0x196a('0x2'));var user=require('./rpc/user');var interval=require(_0x196a('0x3'));var openchannelQueue=require(_0x196a('0x4'));var chatQueue=require(_0x196a('0x5'));var smsQueue=require(_0x196a('0x6'));var mailQueue=require(_0x196a('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x196a('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x196a('0x9')]()['then'](user[_0x196a('0xa')]())[_0x196a('0xb')](realtime[_0x196a('0xc')]())[_0x196a('0xb')](interval[_0x196a('0xd')]())[_0x196a('0xb')](realtime[_0x196a('0xe')]())[_0x196a('0xb')](openchannelQueue[_0x196a('0xf')]())[_0x196a('0xb')](realtime['initOpenchannelQueues']())['then'](chatQueue['getChatQueues']())[_0x196a('0xb')](realtime[_0x196a('0x10')]())['then'](smsQueue[_0x196a('0x11')]())['then'](realtime[_0x196a('0x12')]())['then'](mailQueue[_0x196a('0x13')]())[_0x196a('0xb')](realtime['initMailQueues']())[_0x196a('0xb')](faxQueue[_0x196a('0x14')]())['then'](realtime[_0x196a('0x15')]())['then'](whatsappQueue[_0x196a('0x16')]())[_0x196a('0xb')](realtime['initWhatsappQueues']())[_0x196a('0xb')](function(){return realtime;});}function main(){return server[_0x196a('0x17')](realtime)['then'](function(_0x326def){return initRealtime();})[_0x196a('0xb')](function(_0x5c282b){return setInterval(initRealtime,0x1388);})[_0x196a('0x18')](function(_0x283b7d){console[_0x196a('0x19')](_0x283b7d);});}main(); \ No newline at end of file +var _0x3cf8=['initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getFaxQueues'];(function(_0x202c99,_0x121caf){var _0x256a0f=function(_0x3a55fa){while(--_0x3a55fa){_0x202c99['push'](_0x202c99['shift']());}};_0x256a0f(++_0x121caf);}(_0x3cf8,0x17c));var _0x83cf=function(_0x26eca8,_0x38a131){_0x26eca8=_0x26eca8-0x0;var _0x46f327=_0x3cf8[_0x26eca8];return _0x46f327;};'use strict';var BPromise=require('bluebird');var server=require(_0x83cf('0x0'));var Realtime=require(_0x83cf('0x1'));var user=require(_0x83cf('0x2'));var interval=require(_0x83cf('0x3'));var openchannelQueue=require(_0x83cf('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x83cf('0x5'));var mailQueue=require(_0x83cf('0x6'));var faxQueue=require(_0x83cf('0x7'));var whatsappQueue=require(_0x83cf('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x83cf('0x9')]()['then'](user[_0x83cf('0xa')]())[_0x83cf('0xb')](realtime['initAgents']())[_0x83cf('0xb')](interval[_0x83cf('0xc')]())[_0x83cf('0xb')](realtime[_0x83cf('0xd')]())[_0x83cf('0xb')](openchannelQueue[_0x83cf('0xe')]())[_0x83cf('0xb')](realtime[_0x83cf('0xf')]())[_0x83cf('0xb')](chatQueue['getChatQueues']())['then'](realtime[_0x83cf('0x10')]())['then'](smsQueue[_0x83cf('0x11')]())[_0x83cf('0xb')](realtime[_0x83cf('0x12')]())[_0x83cf('0xb')](mailQueue['getMailQueues']())['then'](realtime['initMailQueues']())[_0x83cf('0xb')](faxQueue[_0x83cf('0x13')]())[_0x83cf('0xb')](realtime[_0x83cf('0x14')]())['then'](whatsappQueue[_0x83cf('0x15')]())[_0x83cf('0xb')](realtime[_0x83cf('0x16')]())[_0x83cf('0xb')](function(){return realtime;});}function main(){return server[_0x83cf('0x17')](realtime)[_0x83cf('0xb')](function(_0x2c2b16){return initRealtime();})[_0x83cf('0xb')](function(_0x50140d){return setInterval(initRealtime,0x1388);})['catch'](function(_0x449494){console[_0x83cf('0x18')](_0x449494);});}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 d7c1820..69d451b 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0xac56ce,_0xb73e4){var _0x5105e1=function(_0x52768d){while(--_0x52768d){_0xac56ce['push'](_0xac56ce['shift']());}};_0x5105e1(++_0xb73e4);}(_0x326f,0xd1));var _0xf326=function(_0x5e57ea,_0x3c2334){_0x5e57ea=_0x5e57ea-0x0;var _0x3c509d=_0x326f[_0x5e57ea];return _0x3c509d;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x4ede00,_0x16905f){var _0x5455a6=function(_0x404b61){while(--_0x404b61){_0x4ede00['push'](_0x4ede00['shift']());}};_0x5455a6(++_0x16905f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0x5fc3[_0x377a6e];return _0x37f751;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 4fa330e..b79fe6f 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 _0x8206=['error','message','result','bluebird','client','request'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8206,0x141));var _0x6820=function(_0x231bc5,_0x182c85){_0x231bc5=_0x231bc5-0x0;var _0x5aa049=_0x8206[_0x231bc5];return _0x5aa049;};'use strict';var BPromise=require(_0x6820('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x6820('0x1')]['http']({'port':0x232b});function request(_0x10760f,_0x497f47){return new BPromise(function(_0x4c5a52,_0x82ebb3){return client[_0x6820('0x2')](_0x10760f,_0x497f47)['then'](function(_0x13c7e0){if(_0x13c7e0[_0x6820('0x3')]){return _0x82ebb3(_0x13c7e0['error'][_0x6820('0x4')]);}else{return _0x4c5a52(_0x13c7e0[_0x6820('0x5')]);}})['catch'](function(_0x2ad231){return _0x82ebb3(_0x2ad231);});});}exports['sendMailMessage']=function(_0x33dc3c,_0x4a5c6c){return request('SendMail',{'account':_0x33dc3c,'message':_0x4a5c6c});}; \ No newline at end of file +var _0x0836=['http','request','then','error','result','sendMailMessage','SendMail','bluebird','jayson/promise','client'];(function(_0x17f7c1,_0x2fa7b9){var _0x13c24a=function(_0x4a7f44){while(--_0x4a7f44){_0x17f7c1['push'](_0x17f7c1['shift']());}};_0x13c24a(++_0x2fa7b9);}(_0x0836,0x9d));var _0x6083=function(_0x414996,_0x335997){_0x414996=_0x414996-0x0;var _0x5b06a1=_0x0836[_0x414996];return _0x5b06a1;};'use strict';var BPromise=require(_0x6083('0x0'));var jayson=require(_0x6083('0x1'));var client=jayson[_0x6083('0x2')][_0x6083('0x3')]({'port':0x232b});function request(_0x26e04f,_0x2dd76c){return new BPromise(function(_0x543c96,_0x1e2650){return client[_0x6083('0x4')](_0x26e04f,_0x2dd76c)[_0x6083('0x5')](function(_0x28bb7e){if(_0x28bb7e[_0x6083('0x6')]){return _0x1e2650(_0x28bb7e[_0x6083('0x6')]['message']);}else{return _0x543c96(_0x28bb7e[_0x6083('0x7')]);}})['catch'](function(_0x3a3e32){return _0x1e2650(_0x3a3e32);});});}exports[_0x6083('0x8')]=function(_0x18909b,_0x1a70f3){return request(_0x6083('0x9'),{'account':_0x18909b,'message':_0x1a70f3});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 0eacc80..b435f2a 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 _0x4936=['whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','mail','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','format','online','faxPause','chatStatus','chatStatusTime','mailStatusTime','whatsappCurrentCapacity','mailWaitingInteractions','stringify','emit','../../../config/environment','redis','defaults','name','voicePause','chatPause','mailPause','smsPause','openchannelPause','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions'];(function(_0x4352d1,_0x140c02){var _0x33148c=function(_0x2490ca){while(--_0x2490ca){_0x4352d1['push'](_0x4352d1['shift']());}};_0x33148c(++_0x140c02);}(_0x4936,0x99));var _0x6493=function(_0x7309ef,_0xb2c923){_0x7309ef=_0x7309ef-0x0;var _0x2450ab=_0x4936[_0x7309ef];return _0x2450ab;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x6493('0x0'));config[_0x6493('0x1')]=_[_0x6493('0x2')](config[_0x6493('0x1')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6493('0x1')]));function Agent(_0x4d04bb){this['id']=_0x4d04bb['id']||0x0;this[_0x6493('0x3')]=_0x4d04bb[_0x6493('0x3')]||'';this[_0x6493('0x4')]=_0x4d04bb[_0x6493('0x4')]||![];this[_0x6493('0x5')]=_0x4d04bb[_0x6493('0x5')]||![];this[_0x6493('0x6')]=_0x4d04bb['mailPause']||![];this['faxPause']=_0x4d04bb['faxPause']||![];this[_0x6493('0x7')]=_0x4d04bb[_0x6493('0x7')]||![];this[_0x6493('0x8')]=_0x4d04bb[_0x6493('0x8')]||![];this['chatStatus']=_0x6493('0x9');this['chatStatusTime']=0x0;this[_0x6493('0xa')]=_0x4d04bb['chatCapacity']||0x0;this[_0x6493('0xb')]=0x0;this[_0x6493('0xc')]='unknown';this['mailStatusTime']=0x0;this[_0x6493('0xd')]=_0x4d04bb[_0x6493('0xd')]||0x0;this[_0x6493('0xe')]=0x0;this[_0x6493('0xf')]=_0x6493('0x9');this[_0x6493('0x10')]=0x0;this[_0x6493('0x11')]=_0x4d04bb['faxCapacity']||0x0;this[_0x6493('0x12')]=0x0;this[_0x6493('0x13')]=_0x6493('0x9');this['smsStatusTime']=0x0;this[_0x6493('0x14')]=_0x4d04bb[_0x6493('0x14')]||0x0;this[_0x6493('0x15')]=0x0;this[_0x6493('0x16')]=_0x6493('0x9');this[_0x6493('0x17')]=0x0;this[_0x6493('0x18')]=_0x4d04bb[_0x6493('0x18')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x6493('0x19')]='unknown';this[_0x6493('0x1a')]=0x0;this[_0x6493('0x1b')]=_0x4d04bb[_0x6493('0x1b')]||0x0;this[_0x6493('0x1c')]=0x0;this[_0x6493('0x1d')]=![];this[_0x6493('0x1e')]=undefined;this[_0x6493('0x1f')]='';this[_0x6493('0x20')]={};this[_0x6493('0x21')]={};this['mailWaitingInteractions']={};this[_0x6493('0x22')]={};this[_0x6493('0x23')]={};this[_0x6493('0x24')]={};this[_0x6493('0x25')]();}Agent[_0x6493('0x26')]['getChannelStatus']=function(_0x3744c9){if(this[_0x3744c9+_0x6493('0x27')]>0x0){if(this[_0x3744c9+_0x6493('0x28')]>0x0&&this[_0x3744c9+_0x6493('0x27')]>=this[_0x3744c9+'Capacity']){return _0x6493('0x29');}else{return'working';}}else{return'idle';}};Agent[_0x6493('0x26')][_0x6493('0x25')]=function(){var _0x5e5308=[_0x6493('0x2a'),_0x6493('0x2b'),_0x6493('0x2c'),_0x6493('0x2d'),_0x6493('0x2e'),_0x6493('0x2f')];for(var _0x17ce53=0x0;_0x17ce53<_0x5e5308[_0x6493('0x30')];_0x17ce53+=0x1){var _0x134791=this[_0x6493('0x31')](_0x5e5308[_0x17ce53]);if(this[_0x5e5308[_0x17ce53]+_0x6493('0x32')]!==_0x134791){this[_0x5e5308[_0x17ce53]+_0x6493('0x33')]=_[_0x6493('0x34')](moment()[_0x6493('0x35')]('x'));}this[_0x5e5308[_0x17ce53]+'Status']=_0x134791;}var _0x2fbcfb={'id':this['id'],'name':this[_0x6493('0x3')],'online':this[_0x6493('0x36')],'voicePause':this['voicePause'],'chatPause':this[_0x6493('0x5')],'mailPause':this['mailPause'],'smsPause':this[_0x6493('0x7')],'faxPause':this[_0x6493('0x37')],'openchannelPause':this[_0x6493('0x8')],'chatStatus':this[_0x6493('0x38')],'chatStatusTime':this[_0x6493('0x39')],'chatCapacity':this[_0x6493('0xa')],'chatCurrentCapacity':this[_0x6493('0xb')],'mailStatus':this[_0x6493('0xc')],'mailStatusTime':this[_0x6493('0x3a')],'mailCapacity':this[_0x6493('0xd')],'mailCurrentCapacity':this[_0x6493('0xe')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x6493('0x11')],'faxCurrentCapacity':this[_0x6493('0x12')],'smsStatus':this[_0x6493('0x13')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x6493('0x14')],'smsCurrentCapacity':this[_0x6493('0x15')],'whatsappStatus':this[_0x6493('0x16')],'whatsappStatusTime':this[_0x6493('0x17')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x6493('0x3b')],'openchannelStatus':this[_0x6493('0x19')],'openchannelStatusTime':this[_0x6493('0x1a')],'openchannelCapacity':this[_0x6493('0x1b')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x6493('0x20')],'faxWaitingInteractions':this[_0x6493('0x21')],'mailWaitingInteractions':this[_0x6493('0x3c')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x6493('0x23')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x1659e5=md5(JSON[_0x6493('0x3d')](_0x2fbcfb));if(this['md5']!==_0x1659e5){this[_0x6493('0x1f')]=_0x1659e5;io[_0x6493('0x3e')]('user:routing:update',_0x2fbcfb);}};module['exports']=Agent; \ No newline at end of file +var _0x83b8=['faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','online','chatCapacity','mailCurrentCapacity','smsStatus','openchannelWaitingInteractions','stringify','emit','user:routing:update','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','localhost','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity'];(function(_0x3878bd,_0x51e3e5){var _0x359e60=function(_0xe70276){while(--_0xe70276){_0x3878bd['push'](_0x3878bd['shift']());}};_0x359e60(++_0x51e3e5);}(_0x83b8,0xb4));var _0x883b=function(_0x48dd43,_0x585fbe){_0x48dd43=_0x48dd43-0x0;var _0x5617d4=_0x83b8[_0x48dd43];return _0x5617d4;};'use strict';var _=require(_0x883b('0x0'));var moment=require(_0x883b('0x1'));var md5=require(_0x883b('0x2'));var Redis=require(_0x883b('0x3'));var config=require(_0x883b('0x4'));config[_0x883b('0x5')]=_['defaults'](config[_0x883b('0x5')],{'host':_0x883b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x883b('0x5')]));function Agent(_0x17b7ba){this['id']=_0x17b7ba['id']||0x0;this['name']=_0x17b7ba[_0x883b('0x7')]||'';this[_0x883b('0x8')]=_0x17b7ba[_0x883b('0x8')]||![];this[_0x883b('0x9')]=_0x17b7ba[_0x883b('0x9')]||![];this[_0x883b('0xa')]=_0x17b7ba[_0x883b('0xa')]||![];this['faxPause']=_0x17b7ba[_0x883b('0xb')]||![];this[_0x883b('0xc')]=_0x17b7ba['smsPause']||![];this[_0x883b('0xd')]=_0x17b7ba[_0x883b('0xd')]||![];this[_0x883b('0xe')]=_0x883b('0xf');this[_0x883b('0x10')]=0x0;this['chatCapacity']=_0x17b7ba['chatCapacity']||0x0;this[_0x883b('0x11')]=0x0;this[_0x883b('0x12')]=_0x883b('0xf');this[_0x883b('0x13')]=0x0;this[_0x883b('0x14')]=_0x17b7ba[_0x883b('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x883b('0x15')]='unknown';this[_0x883b('0x16')]=0x0;this['faxCapacity']=_0x17b7ba[_0x883b('0x17')]||0x0;this[_0x883b('0x18')]=0x0;this['smsStatus']=_0x883b('0xf');this[_0x883b('0x19')]=0x0;this[_0x883b('0x1a')]=_0x17b7ba['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x883b('0x1b')]=_0x883b('0xf');this[_0x883b('0x1c')]=0x0;this[_0x883b('0x1d')]=_0x17b7ba[_0x883b('0x1d')]||0x0;this[_0x883b('0x1e')]=0x0;this[_0x883b('0x1f')]=_0x883b('0xf');this[_0x883b('0x20')]=0x0;this[_0x883b('0x21')]=_0x17b7ba['openchannelCapacity']||0x0;this[_0x883b('0x22')]=0x0;this['busy']=![];this[_0x883b('0x23')]=undefined;this[_0x883b('0x2')]='';this[_0x883b('0x24')]={};this[_0x883b('0x25')]={};this[_0x883b('0x26')]={};this['openchannelWaitingInteractions']={};this[_0x883b('0x27')]={};this[_0x883b('0x28')]={};this[_0x883b('0x29')]();}Agent['prototype'][_0x883b('0x2a')]=function(_0x428975){if(this[_0x428975+_0x883b('0x2b')]>0x0){if(this[_0x428975+_0x883b('0x2c')]>0x0&&this[_0x428975+_0x883b('0x2b')]>=this[_0x428975+_0x883b('0x2c')]){return _0x883b('0x2d');}else{return _0x883b('0x2e');}}else{return _0x883b('0x2f');}};Agent[_0x883b('0x30')][_0x883b('0x29')]=function(){var _0x57f84e=['mail','chat',_0x883b('0x31'),_0x883b('0x32'),_0x883b('0x33'),_0x883b('0x34')];for(var _0x241da9=0x0;_0x241da9<_0x57f84e[_0x883b('0x35')];_0x241da9+=0x1){var _0x5592d0=this[_0x883b('0x2a')](_0x57f84e[_0x241da9]);if(this[_0x57f84e[_0x241da9]+_0x883b('0x36')]!==_0x5592d0){this[_0x57f84e[_0x241da9]+_0x883b('0x37')]=_[_0x883b('0x38')](moment()[_0x883b('0x39')]('x'));}this[_0x57f84e[_0x241da9]+_0x883b('0x36')]=_0x5592d0;}var _0x103f4f={'id':this['id'],'name':this[_0x883b('0x7')],'online':this[_0x883b('0x3a')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0x883b('0xa')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x883b('0xd')],'chatStatus':this[_0x883b('0xe')],'chatStatusTime':this[_0x883b('0x10')],'chatCapacity':this[_0x883b('0x3b')],'chatCurrentCapacity':this[_0x883b('0x11')],'mailStatus':this[_0x883b('0x12')],'mailStatusTime':this[_0x883b('0x13')],'mailCapacity':this[_0x883b('0x14')],'mailCurrentCapacity':this[_0x883b('0x3c')],'faxStatus':this[_0x883b('0x15')],'faxStatusTime':this[_0x883b('0x16')],'faxCapacity':this[_0x883b('0x17')],'faxCurrentCapacity':this[_0x883b('0x18')],'smsStatus':this[_0x883b('0x3d')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x883b('0x1a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x883b('0x1b')],'whatsappStatusTime':this[_0x883b('0x1c')],'whatsappCapacity':this[_0x883b('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x883b('0x1f')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x883b('0x24')],'faxWaitingInteractions':this[_0x883b('0x25')],'mailWaitingInteractions':this[_0x883b('0x26')],'openchannelWaitingInteractions':this[_0x883b('0x3e')],'smsWaitingInteractions':this[_0x883b('0x27')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x4307e9=md5(JSON[_0x883b('0x3f')](_0x103f4f));if(this[_0x883b('0x2')]!==_0x4307e9){this[_0x883b('0x2')]=_0x4307e9;io[_0x883b('0x40')](_0x883b('0x41'),_0x103f4f);}};module[_0x883b('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index c13dde2..19510ff 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 _0x81df=['loggedIn','chatPause','paused','available','stringify','format','chat:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','online'];(function(_0x13a9ee,_0x2ae084){var _0x157788=function(_0x4c11e2){while(--_0x4c11e2){_0x13a9ee['push'](_0x13a9ee['shift']());}};_0x157788(++_0x2ae084);}(_0x81df,0x12a));var _0xf81d=function(_0x3aa8de,_0x6d5dcf){_0x3aa8de=_0x3aa8de-0x0;var _0xec278f=_0x81df[_0x3aa8de];return _0xec278f;};'use strict';var _=require(_0xf81d('0x0'));var md5=require(_0xf81d('0x1'));var util=require(_0xf81d('0x2'));var Redis=require(_0xf81d('0x3'));var config=require(_0xf81d('0x4'));config[_0xf81d('0x5')]=_[_0xf81d('0x6')](config['redis'],{'host':_0xf81d('0x7'),'port':0x18eb});var io=require(_0xf81d('0x8'))(new Redis(config['redis']));function ChatQueue(_0x31b89a){this['id']=_0x31b89a['id']||0x0;this[_0xf81d('0x9')]=_0x31b89a['name']||'';this['timeout']=_0x31b89a[_0xf81d('0xa')]||0xa;this[_0xf81d('0xb')]=_0x31b89a['strategy']||_0xf81d('0xc');this[_0xf81d('0xd')]=_0x31b89a['Agents'];this['mapAgentsId']={};this[_0xf81d('0xe')]=0x0;this[_0xf81d('0x1')]='';this[_0xf81d('0xf')]();this[_0xf81d('0x10')]();}ChatQueue[_0xf81d('0x11')][_0xf81d('0xf')]=function(){var _0x17e361=this[_0xf81d('0x12')][_0xf81d('0x13')];this[_0xf81d('0x12')]=_['map'](this[_0xf81d('0xd')],'id');this['mapAgentsId'][_0xf81d('0x13')]=_0x17e361;};ChatQueue[_0xf81d('0x11')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x5bb4e7=0x0;_0x5bb4e7=0x0?this[_0xf81d('0x18')]:0x0;var _0x1a521f={'id':this['id'],'available':this[_0xf81d('0x18')],'loggedIn':this[_0xf81d('0x15')],'name':this[_0xf81d('0x9')],'paused':this[_0xf81d('0x17')],'waiting':this[_0xf81d('0xe')]};var _0x28b0c5=md5(JSON[_0xf81d('0x19')](_0x1a521f));if(this[_0xf81d('0x1')]!==_0x28b0c5){this[_0xf81d('0x1')]=_0x28b0c5;io['to'](util[_0xf81d('0x1a')](_0xf81d('0x1b'),_0x1a521f[_0xf81d('0x9')]))['emit']('chat_queue:save',_0x1a521f);}};module[_0xf81d('0x1c')]=ChatQueue; \ No newline at end of file +var _0x7e4a=['waiting','updateRouting','_rr','mapAgentsId','map','Agents','loggedIn','paused','online','chatPause','available','stringify','format','emit','chat_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x582d5a,_0x3b57c0){var _0x5625ef=function(_0x509d83){while(--_0x509d83){_0x582d5a['push'](_0x582d5a['shift']());}};_0x5625ef(++_0x3b57c0);}(_0x7e4a,0x1b4));var _0xa7e4=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7e4a[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xa7e4('0x0'));var md5=require(_0xa7e4('0x1'));var util=require(_0xa7e4('0x2'));var Redis=require('ioredis');var config=require(_0xa7e4('0x3'));config[_0xa7e4('0x4')]=_[_0xa7e4('0x5')](config['redis'],{'host':_0xa7e4('0x6'),'port':0x18eb});var io=require(_0xa7e4('0x7'))(new Redis(config[_0xa7e4('0x4')]));function ChatQueue(_0x23cf57){this['id']=_0x23cf57['id']||0x0;this[_0xa7e4('0x8')]=_0x23cf57['name']||'';this[_0xa7e4('0x9')]=_0x23cf57[_0xa7e4('0x9')]||0xa;this['strategy']=_0x23cf57[_0xa7e4('0xa')]||_0xa7e4('0xb');this['Agents']=_0x23cf57['Agents'];this['mapAgentsId']={};this[_0xa7e4('0xc')]=0x0;this['md5']='';this[_0xa7e4('0xd')]();this['updateRealtime']();}ChatQueue['prototype'][_0xa7e4('0xd')]=function(){var _0x1656e7=this['mapAgentsId'][_0xa7e4('0xe')];this[_0xa7e4('0xf')]=_[_0xa7e4('0x10')](this[_0xa7e4('0x11')],'id');this['mapAgentsId'][_0xa7e4('0xe')]=_0x1656e7;};ChatQueue['prototype']['updateRealtime']=function(){this[_0xa7e4('0x12')]=0x0;this[_0xa7e4('0x13')]=0x0;for(var _0x13586e=0x0;_0x13586e=0x0?this[_0xa7e4('0x16')]:0x0;var _0x4db3db={'id':this['id'],'available':this[_0xa7e4('0x16')],'loggedIn':this[_0xa7e4('0x12')],'name':this[_0xa7e4('0x8')],'paused':this[_0xa7e4('0x13')],'waiting':this[_0xa7e4('0xc')]};var _0x54327e=md5(JSON[_0xa7e4('0x17')](_0x4db3db));if(this[_0xa7e4('0x1')]!==_0x54327e){this[_0xa7e4('0x1')]=_0x54327e;io['to'](util[_0xa7e4('0x18')]('chat:queue:%s',_0x4db3db[_0xa7e4('0x8')]))[_0xa7e4('0x19')](_0xa7e4('0x1a'),_0x4db3db);}};module[_0xa7e4('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 2a93631..9d8f3e8 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 _0x2fb9=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x2fb9,0x8c));var _0x92fb=function(_0x54200f,_0x557e1e){_0x54200f=_0x54200f-0x0;var _0x268a2b=_0x2fb9[_0x54200f];return _0x268a2b;};'use strict';var _=require(_0x92fb('0x0'));var md5=require(_0x92fb('0x1'));var util=require(_0x92fb('0x2'));var Redis=require(_0x92fb('0x3'));var config=require(_0x92fb('0x4'));config['redis']=_[_0x92fb('0x5')](config[_0x92fb('0x6')],{'host':_0x92fb('0x7'),'port':0x18eb});var io=require(_0x92fb('0x8'))(new Redis(config[_0x92fb('0x6')]));function FaxQueue(_0x21f859){this['id']=_0x21f859['id']||0x0;this[_0x92fb('0x9')]=_0x21f859[_0x92fb('0x9')]||'';this[_0x92fb('0xa')]=_0x21f859[_0x92fb('0xa')]||0xa;this[_0x92fb('0xb')]=_0x21f859[_0x92fb('0xb')]||_0x92fb('0xc');this[_0x92fb('0xd')]=_0x21f859[_0x92fb('0xd')];this[_0x92fb('0xe')]={};this[_0x92fb('0xf')]=0x0;this[_0x92fb('0x1')]='';this[_0x92fb('0x10')]();this[_0x92fb('0x11')]();}FaxQueue['prototype'][_0x92fb('0x10')]=function(){var _0x443671=this[_0x92fb('0xe')][_0x92fb('0x12')];this['mapAgentsId']=_[_0x92fb('0x13')](this[_0x92fb('0xd')],'id');this[_0x92fb('0xe')][_0x92fb('0x12')]=_0x443671;};FaxQueue['prototype'][_0x92fb('0x11')]=function(){this[_0x92fb('0x14')]=0x0;this[_0x92fb('0x15')]=0x0;for(var _0x7e388=0x0;_0x7e388=0x0?this[_0x92fb('0x17')]:0x0;var _0x271292={'id':this['id'],'available':this[_0x92fb('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x92fb('0x9')],'paused':this[_0x92fb('0x15')],'waiting':this['waiting']};var _0x34b609=md5(JSON[_0x92fb('0x18')](_0x271292));if(this[_0x92fb('0x1')]!==_0x34b609){this[_0x92fb('0x1')]=_0x34b609;io['to'](util[_0x92fb('0x19')](_0x92fb('0x1a'),_0x271292[_0x92fb('0x9')]))[_0x92fb('0x1b')](_0x92fb('0x1c'),_0x271292);}};module[_0x92fb('0x1d')]=FaxQueue; \ No newline at end of file +var _0x57ee=['updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','online','faxPause','available','md5','format','fax:queue:%s','emit','fax_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x308d25,_0x41fd23){var _0x18fc27=function(_0x1d5bef){while(--_0x1d5bef){_0x308d25['push'](_0x308d25['shift']());}};_0x18fc27(++_0x41fd23);}(_0x57ee,0x15a));var _0xe57e=function(_0x19a96c,_0x1eccba){_0x19a96c=_0x19a96c-0x0;var _0x2c3050=_0x57ee[_0x19a96c];return _0x2c3050;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xe57e('0x0'));var Redis=require(_0xe57e('0x1'));var config=require(_0xe57e('0x2'));config[_0xe57e('0x3')]=_[_0xe57e('0x4')](config[_0xe57e('0x3')],{'host':_0xe57e('0x5'),'port':0x18eb});var io=require(_0xe57e('0x6'))(new Redis(config['redis']));function FaxQueue(_0x9ee7fe){this['id']=_0x9ee7fe['id']||0x0;this['name']=_0x9ee7fe[_0xe57e('0x7')]||'';this[_0xe57e('0x8')]=_0x9ee7fe['timeout']||0xa;this[_0xe57e('0x9')]=_0x9ee7fe['strategy']||_0xe57e('0xa');this[_0xe57e('0xb')]=_0x9ee7fe[_0xe57e('0xb')];this[_0xe57e('0xc')]={};this[_0xe57e('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0xe57e('0xe')]();}FaxQueue[_0xe57e('0xf')][_0xe57e('0x10')]=function(){var _0x54a2a5=this[_0xe57e('0xc')][_0xe57e('0x11')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xe57e('0xc')]['_rr']=_0x54a2a5;};FaxQueue[_0xe57e('0xf')]['updateRealtime']=function(){this[_0xe57e('0x12')]=0x0;this[_0xe57e('0x13')]=0x0;for(var _0x2c9515=0x0;_0x2c9515=0x0?this['available']:0x0;var _0xcc3144={'id':this['id'],'available':this[_0xe57e('0x17')],'loggedIn':this[_0xe57e('0x12')],'name':this[_0xe57e('0x7')],'paused':this['paused'],'waiting':this[_0xe57e('0xd')]};var _0xb2c521=md5(JSON['stringify'](_0xcc3144));if(this['md5']!==_0xb2c521){this[_0xe57e('0x18')]=_0xb2c521;io['to'](util[_0xe57e('0x19')](_0xe57e('0x1a'),_0xcc3144['name']))[_0xe57e('0x1b')](_0xe57e('0x1c'),_0xcc3144);}};module[_0xe57e('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 932e2a8..7e76e39 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 _0x7be0=['name','Intervals','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7be0,0x189));var _0x07be=function(_0x36eaad,_0x5ed526){_0x36eaad=_0x36eaad-0x0;var _0x1ef3a3=_0x7be0[_0x36eaad];return _0x1ef3a3;};'use strict';function Interval(_0x5a5ff3){this['id']=_0x5a5ff3['id']||0x0;this[_0x07be('0x0')]=_0x5a5ff3[_0x07be('0x0')]||'';this[_0x07be('0x1')]=_0x5a5ff3[_0x07be('0x1')]||{};}module[_0x07be('0x2')]=Interval; \ No newline at end of file +var _0x617c=['exports','name','Intervals'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x617c,0x12a));var _0xc617=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0x617c[_0x593564];return _0x211a89;};'use strict';function Interval(_0x8ea606){this['id']=_0x8ea606['id']||0x0;this['name']=_0x8ea606[_0xc617('0x0')]||'';this[_0xc617('0x1')]=_0x8ea606[_0xc617('0x1')]||{};}module[_0xc617('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index f562e7c..0489a40 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 _0xbd71=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','mailPause','available','md5','format','emit','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xbd71,0x1e9));var _0x1bd7=function(_0x5528c1,_0x12a738){_0x5528c1=_0x5528c1-0x0;var _0x43cca2=_0xbd71[_0x5528c1];return _0x43cca2;};'use strict';var _=require(_0x1bd7('0x0'));var md5=require('md5');var util=require(_0x1bd7('0x1'));var Redis=require(_0x1bd7('0x2'));var config=require(_0x1bd7('0x3'));config['redis']=_['defaults'](config[_0x1bd7('0x4')],{'host':_0x1bd7('0x5'),'port':0x18eb});var io=require(_0x1bd7('0x6'))(new Redis(config[_0x1bd7('0x4')]));function MailQueue(_0x437ef4){this['id']=_0x437ef4['id']||0x0;this[_0x1bd7('0x7')]=_0x437ef4[_0x1bd7('0x7')]||'';this[_0x1bd7('0x8')]=_0x437ef4[_0x1bd7('0x8')]||0xa;this[_0x1bd7('0x9')]=_0x437ef4[_0x1bd7('0x9')]||_0x1bd7('0xa');this[_0x1bd7('0xb')]=_0x437ef4['Agents'];this[_0x1bd7('0xc')]={};this[_0x1bd7('0xd')]=0x0;this['md5']='';this[_0x1bd7('0xe')]();this[_0x1bd7('0xf')]();}MailQueue[_0x1bd7('0x10')][_0x1bd7('0xe')]=function(){var _0x5a3730=this['mapAgentsId'][_0x1bd7('0x11')];this[_0x1bd7('0xc')]=_[_0x1bd7('0x12')](this[_0x1bd7('0xb')],'id');this[_0x1bd7('0xc')][_0x1bd7('0x11')]=_0x5a3730;};MailQueue[_0x1bd7('0x10')]['updateRealtime']=function(){this[_0x1bd7('0x13')]=0x0;this[_0x1bd7('0x14')]=0x0;for(var _0x3530ce=0x0;_0x3530ce=0x0?this[_0x1bd7('0x17')]:0x0;var _0x42cce2={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1bd7('0x13')],'name':this['name'],'paused':this[_0x1bd7('0x14')],'waiting':this[_0x1bd7('0xd')]};var _0x3c3ef3=md5(JSON['stringify'](_0x42cce2));if(this[_0x1bd7('0x18')]!==_0x3c3ef3){this['md5']=_0x3c3ef3;io['to'](util[_0x1bd7('0x19')]('mail:queue:%s',_0x42cce2['name']))[_0x1bd7('0x1a')](_0x1bd7('0x1b'),_0x42cce2);}};module[_0x1bd7('0x1c')]=MailQueue; \ No newline at end of file +var _0x70a9=['available','stringify','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length'];(function(_0xba7fba,_0x47539d){var _0x8c73bb=function(_0x4b56f5){while(--_0x4b56f5){_0xba7fba['push'](_0xba7fba['shift']());}};_0x8c73bb(++_0x47539d);}(_0x70a9,0x1ad));var _0x970a=function(_0x1788af,_0x278e47){_0x1788af=_0x1788af-0x0;var _0x4c186e=_0x70a9[_0x1788af];return _0x4c186e;};'use strict';var _=require(_0x970a('0x0'));var md5=require(_0x970a('0x1'));var util=require(_0x970a('0x2'));var Redis=require('ioredis');var config=require(_0x970a('0x3'));config[_0x970a('0x4')]=_[_0x970a('0x5')](config[_0x970a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x970a('0x6'))(new Redis(config[_0x970a('0x4')]));function MailQueue(_0x28401e){this['id']=_0x28401e['id']||0x0;this[_0x970a('0x7')]=_0x28401e[_0x970a('0x7')]||'';this[_0x970a('0x8')]=_0x28401e[_0x970a('0x8')]||0xa;this['strategy']=_0x28401e[_0x970a('0x9')]||_0x970a('0xa');this[_0x970a('0xb')]=_0x28401e['Agents'];this[_0x970a('0xc')]={};this[_0x970a('0xd')]=0x0;this[_0x970a('0x1')]='';this[_0x970a('0xe')]();this[_0x970a('0xf')]();}MailQueue['prototype']['updateRouting']=function(){var _0x4c9ba4=this[_0x970a('0xc')][_0x970a('0x10')];this[_0x970a('0xc')]=_[_0x970a('0x11')](this[_0x970a('0xb')],'id');this[_0x970a('0xc')][_0x970a('0x10')]=_0x4c9ba4;};MailQueue['prototype'][_0x970a('0xf')]=function(){this[_0x970a('0x12')]=0x0;this[_0x970a('0x13')]=0x0;for(var _0x5da2c6=0x0;_0x5da2c6=0x0?this['available']:0x0;var _0x11ae8a={'id':this['id'],'available':this[_0x970a('0x15')],'loggedIn':this[_0x970a('0x12')],'name':this[_0x970a('0x7')],'paused':this[_0x970a('0x13')],'waiting':this[_0x970a('0xd')]};var _0x2922f2=md5(JSON[_0x970a('0x16')](_0x11ae8a));if(this[_0x970a('0x1')]!==_0x2922f2){this[_0x970a('0x1')]=_0x2922f2;io['to'](util['format']('mail:queue:%s',_0x11ae8a[_0x970a('0x7')]))['emit'](_0x970a('0x17'),_0x11ae8a);}};module[_0x970a('0x18')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index b6954f3..834d8e2 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 _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x1a5182,_0x25b2dd){var _0x37d275=function(_0x2d7cfc){while(--_0x2d7cfc){_0x1a5182['push'](_0x1a5182['shift']());}};_0x37d275(++_0x25b2dd);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x5fc3[_0x4226d6];return _0x19655b;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x3fdee7,_0x259d89){var _0x5aa868=function(_0x122583){while(--_0x122583){_0x3fdee7['push'](_0x3fdee7['shift']());}};_0x5aa868(++_0x259d89);}(_0x814b,0x1a2));var _0xb814=function(_0x3c1ca2,_0x3428ae){_0x3c1ca2=_0x3c1ca2-0x0;var _0x310c01=_0x814b[_0x3c1ca2];return _0x310c01;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index f30b78e..6feb9b8 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 _0x5d70=['_rr','map','Agents','loggedIn','paused','length','smsPause','available','stringify','format','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0x10372f,_0x7fbe8e){var _0x5b756d=function(_0x1f8abc){while(--_0x1f8abc){_0x10372f['push'](_0x10372f['shift']());}};_0x5b756d(++_0x7fbe8e);}(_0x5d70,0x8d));var _0x05d7=function(_0x57eb58,_0x377e60){_0x57eb58=_0x57eb58-0x0;var _0x219917=_0x5d70[_0x57eb58];return _0x219917;};'use strict';var _=require(_0x05d7('0x0'));var md5=require(_0x05d7('0x1'));var util=require('util');var Redis=require(_0x05d7('0x2'));var config=require(_0x05d7('0x3'));config[_0x05d7('0x4')]=_[_0x05d7('0x5')](config[_0x05d7('0x4')],{'host':_0x05d7('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x05d7('0x4')]));function SmsQueue(_0x3e774b){this['id']=_0x3e774b['id']||0x0;this[_0x05d7('0x7')]=_0x3e774b[_0x05d7('0x7')]||'';this['timeout']=_0x3e774b['timeout']||0xa;this[_0x05d7('0x8')]=_0x3e774b[_0x05d7('0x8')]||_0x05d7('0x9');this['Agents']=_0x3e774b['Agents'];this[_0x05d7('0xa')]={};this[_0x05d7('0xb')]=0x0;this[_0x05d7('0x1')]='';this[_0x05d7('0xc')]();this[_0x05d7('0xd')]();}SmsQueue[_0x05d7('0xe')][_0x05d7('0xc')]=function(){var _0x46e0bd=this[_0x05d7('0xa')][_0x05d7('0xf')];this[_0x05d7('0xa')]=_[_0x05d7('0x10')](this[_0x05d7('0x11')],'id');this[_0x05d7('0xa')][_0x05d7('0xf')]=_0x46e0bd;};SmsQueue[_0x05d7('0xe')][_0x05d7('0xd')]=function(){this[_0x05d7('0x12')]=0x0;this[_0x05d7('0x13')]=0x0;for(var _0x34cd5b=0x0;_0x34cd5b=0x0?this[_0x05d7('0x16')]:0x0;var _0x9e84b2={'id':this['id'],'available':this[_0x05d7('0x16')],'loggedIn':this[_0x05d7('0x12')],'name':this[_0x05d7('0x7')],'paused':this[_0x05d7('0x13')],'waiting':this[_0x05d7('0xb')]};var _0x24e4df=md5(JSON[_0x05d7('0x17')](_0x9e84b2));if(this[_0x05d7('0x1')]!==_0x24e4df){this[_0x05d7('0x1')]=_0x24e4df;io['to'](util[_0x05d7('0x18')]('sms:queue:%s',_0x9e84b2[_0x05d7('0x7')]))['emit']('sms_queue:save',_0x9e84b2);}};module[_0x05d7('0x19')]=SmsQueue; \ No newline at end of file +var _0x0269=['util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','smsPause','available','paused','md5','format','sms:queue:%s','emit','sms_queue:save','exports','lodash'];(function(_0x203cbf,_0x41885c){var _0x2ef4ce=function(_0x25c437){while(--_0x25c437){_0x203cbf['push'](_0x203cbf['shift']());}};_0x2ef4ce(++_0x41885c);}(_0x0269,0x135));var _0x9026=function(_0x5f260f,_0x3e449f){_0x5f260f=_0x5f260f-0x0;var _0x54ec0d=_0x0269[_0x5f260f];return _0x54ec0d;};'use strict';var _=require(_0x9026('0x0'));var md5=require('md5');var util=require(_0x9026('0x1'));var Redis=require('ioredis');var config=require(_0x9026('0x2'));config['redis']=_[_0x9026('0x3')](config[_0x9026('0x4')],{'host':_0x9026('0x5'),'port':0x18eb});var io=require(_0x9026('0x6'))(new Redis(config['redis']));function SmsQueue(_0x314458){this['id']=_0x314458['id']||0x0;this[_0x9026('0x7')]=_0x314458['name']||'';this['timeout']=_0x314458[_0x9026('0x8')]||0xa;this[_0x9026('0x9')]=_0x314458[_0x9026('0x9')]||_0x9026('0xa');this['Agents']=_0x314458[_0x9026('0xb')];this[_0x9026('0xc')]={};this[_0x9026('0xd')]=0x0;this['md5']='';this[_0x9026('0xe')]();this[_0x9026('0xf')]();}SmsQueue[_0x9026('0x10')]['updateRouting']=function(){var _0x2c1dd2=this['mapAgentsId'][_0x9026('0x11')];this[_0x9026('0xc')]=_[_0x9026('0x12')](this[_0x9026('0xb')],'id');this[_0x9026('0xc')][_0x9026('0x11')]=_0x2c1dd2;};SmsQueue[_0x9026('0x10')]['updateRealtime']=function(){this[_0x9026('0x13')]=0x0;this['paused']=0x0;for(var _0x385afc=0x0;_0x385afc=0x0?this[_0x9026('0x17')]:0x0;var _0x4e37d0={'id':this['id'],'available':this[_0x9026('0x17')],'loggedIn':this[_0x9026('0x13')],'name':this[_0x9026('0x7')],'paused':this[_0x9026('0x18')],'waiting':this['waiting']};var _0x7985=md5(JSON['stringify'](_0x4e37d0));if(this[_0x9026('0x19')]!==_0x7985){this['md5']=_0x7985;io['to'](util[_0x9026('0x1a')](_0x9026('0x1b'),_0x4e37d0[_0x9026('0x7')]))[_0x9026('0x1c')](_0x9026('0x1d'),_0x4e37d0);}};module[_0x9026('0x1e')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index ef2a03c..7034edd 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 _0x5534=['updateRealtime','paused','length','online','loggedIn','available','stringify','format','whatsapp:queue:%s','name','emit','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype'];(function(_0x5dee2a,_0x47d02a){var _0x31e98e=function(_0x48b1e9){while(--_0x48b1e9){_0x5dee2a['push'](_0x5dee2a['shift']());}};_0x31e98e(++_0x47d02a);}(_0x5534,0xfd));var _0x4553=function(_0x416cca,_0x390489){_0x416cca=_0x416cca-0x0;var _0x2d8b1b=_0x5534[_0x416cca];return _0x2d8b1b;};'use strict';var _=require(_0x4553('0x0'));var md5=require(_0x4553('0x1'));var util=require(_0x4553('0x2'));var Redis=require('ioredis');var config=require(_0x4553('0x3'));config[_0x4553('0x4')]=_[_0x4553('0x5')](config['redis'],{'host':_0x4553('0x6'),'port':0x18eb});var io=require(_0x4553('0x7'))(new Redis(config[_0x4553('0x4')]));function WhatsappQueue(_0x292d3e){this['id']=_0x292d3e['id']||0x0;this['name']=_0x292d3e['name']||'';this[_0x4553('0x8')]=_0x292d3e[_0x4553('0x8')]||0xa;this['strategy']=_0x292d3e['strategy']||_0x4553('0x9');this['Agents']=_0x292d3e[_0x4553('0xa')];this[_0x4553('0xb')]={};this[_0x4553('0xc')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue['prototype'][_0x4553('0xd')]=function(){var _0x6291cc=this[_0x4553('0xb')][_0x4553('0xe')];this[_0x4553('0xb')]=_[_0x4553('0xf')](this[_0x4553('0xa')],'id');this[_0x4553('0xb')][_0x4553('0xe')]=_0x6291cc;};WhatsappQueue[_0x4553('0x10')][_0x4553('0x11')]=function(){this['loggedIn']=0x0;this[_0x4553('0x12')]=0x0;for(var _0x4aadfd=0x0;_0x4aadfd=0x0?this['available']:0x0;var _0x5a545b={'id':this['id'],'available':this[_0x4553('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x4553('0x12')],'waiting':this['waiting']};var _0x1a2616=md5(JSON[_0x4553('0x17')](_0x5a545b));if(this['md5']!==_0x1a2616){this[_0x4553('0x1')]=_0x1a2616;io['to'](util[_0x4553('0x18')](_0x4553('0x19'),_0x5a545b[_0x4553('0x1a')]))[_0x4553('0x1b')](_0x4553('0x1c'),_0x5a545b);}};module[_0x4553('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x5010=['map','loggedIn','paused','length','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5010,0x137));var _0x0501=function(_0xc18a4b,_0x3312a6){_0xc18a4b=_0xc18a4b-0x0;var _0x1db4f1=_0x5010[_0xc18a4b];return _0x1db4f1;};'use strict';var _=require('lodash');var md5=require(_0x0501('0x0'));var util=require(_0x0501('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0501('0x2')]=_[_0x0501('0x3')](config[_0x0501('0x2')],{'host':_0x0501('0x4'),'port':0x18eb});var io=require(_0x0501('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x5cde32){this['id']=_0x5cde32['id']||0x0;this[_0x0501('0x6')]=_0x5cde32[_0x0501('0x6')]||'';this['timeout']=_0x5cde32['timeout']||0xa;this[_0x0501('0x7')]=_0x5cde32['strategy']||_0x0501('0x8');this['Agents']=_0x5cde32[_0x0501('0x9')];this['mapAgentsId']={};this[_0x0501('0xa')]=0x0;this[_0x0501('0x0')]='';this[_0x0501('0xb')]();this['updateRealtime']();}WhatsappQueue[_0x0501('0xc')][_0x0501('0xb')]=function(){var _0x71b156=this[_0x0501('0xd')]['_rr'];this[_0x0501('0xd')]=_[_0x0501('0xe')](this[_0x0501('0x9')],'id');this[_0x0501('0xd')]['_rr']=_0x71b156;};WhatsappQueue[_0x0501('0xc')]['updateRealtime']=function(){this[_0x0501('0xf')]=0x0;this[_0x0501('0x10')]=0x0;for(var _0x37dc75=0x0;_0x37dc75=0x0?this['available']:0x0;var _0x2c164a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x0501('0xf')],'name':this[_0x0501('0x6')],'paused':this[_0x0501('0x10')],'waiting':this[_0x0501('0xa')]};var _0x29e946=md5(JSON[_0x0501('0x14')](_0x2c164a));if(this['md5']!==_0x29e946){this['md5']=_0x29e946;io['to'](util['format'](_0x0501('0x15'),_0x2c164a[_0x0501('0x6')]))[_0x0501('0x16')](_0x0501('0x17'),_0x2c164a);}};module[_0x0501('0x18')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 9ef3135..da48263 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(_0x42a205,_0x49ef00){var _0xb9f81f=function(_0x4ee74d){while(--_0x4ee74d){_0x42a205['push'](_0x42a205['shift']());}};_0xb9f81f(++_0x49ef00);}(_0xb10b,0x12a));var _0xbb10=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0xb10b[_0x57e00e];return _0x415e60;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x158f5d,_0x1be83e){var _0x1d42bd=function(_0x27317b){while(--_0x27317b){_0x158f5d['push'](_0x158f5d['shift']());}};_0x1d42bd(++_0x1be83e);}(_0xb10b,0x12a));var _0xbb10=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0xb10b[_0x374ada];return _0x449ed8;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 4f951b3..e6da28a 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 _0xd0dc=['../client','update','Request','updateChatInteraction','addTagsToChatInteraction'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xd0dc,0x1b8));var _0xcd0d=function(_0x14a791,_0xee32e9){_0x14a791=_0x14a791-0x0;var _0x2150f3=_0xd0dc[_0x14a791];return _0x2150f3;};'use strict';var client=require(_0xcd0d('0x0'));exports[_0xcd0d('0x1')]=function(_0x2c81db,_0x4c5037){return client[_0xcd0d('0x2')]('UpdateChatInteraction',{'body':_0x4c5037,'options':{'where':{'id':_0x2c81db}},'log':_0xcd0d('0x3')});};exports['addTags']=function(_0xbed35e,_0x4159e4){return client[_0xcd0d('0x2')]('AddTagsToChatInteraction',{'body':_0x4159e4,'options':{'where':{'id':_0xbed35e}},'log':_0xcd0d('0x4')});}; \ No newline at end of file +var _0xa27f=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x1418b5,_0x3c92bf){var _0x4708f2=function(_0x3d9413){while(--_0x3d9413){_0x1418b5['push'](_0x1418b5['shift']());}};_0x4708f2(++_0x3c92bf);}(_0xa27f,0x14c));var _0xfa27=function(_0x10542c,_0x1001a4){_0x10542c=_0x10542c-0x0;var _0x2a468b=_0xa27f[_0x10542c];return _0x2a468b;};'use strict';var client=require(_0xfa27('0x0'));exports['update']=function(_0x434e60,_0x30abaa){return client[_0xfa27('0x1')](_0xfa27('0x2'),{'body':_0x30abaa,'options':{'where':{'id':_0x434e60}},'log':_0xfa27('0x3')});};exports[_0xfa27('0x4')]=function(_0x39d234,_0x584dba){return client['Request'](_0xfa27('0x5'),{'body':_0x584dba,'options':{'where':{'id':_0x39d234}},'log':_0xfa27('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index ec53a83..7b37004 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 _0x7ae8=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x45313f,_0x46caf4){var _0x402910=function(_0x4883d8){while(--_0x4883d8){_0x45313f['push'](_0x45313f['shift']());}};_0x402910(++_0x46caf4);}(_0x7ae8,0x8e));var _0x87ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7ae8[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x87ae('0x0'));exports[_0x87ae('0x1')]=function(_0x3487e3){return client[_0x87ae('0x2')](_0x87ae('0x3'),{'body':_0x3487e3,'log':_0x87ae('0x4')});}; \ No newline at end of file +var _0xa5da=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0xa5da,0x1bf));var _0xaa5d=function(_0x1cdc0c,_0x29b3e7){_0x1cdc0c=_0x1cdc0c-0x0;var _0x4e659d=_0xa5da[_0x1cdc0c];return _0x4e659d;};'use strict';var client=require(_0xaa5d('0x0'));exports[_0xaa5d('0x1')]=function(_0x33c867){return client[_0xaa5d('0x2')](_0xaa5d('0x3'),{'body':_0x33c867,'log':_0xaa5d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 506bc92..8f08060 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 _0xbe48=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','User','Agents','online'];(function(_0x18be7e,_0x32fd6c){var _0x44139b=function(_0x219c43){while(--_0x219c43){_0x18be7e['push'](_0x18be7e['shift']());}};_0x44139b(++_0x32fd6c);}(_0xbe48,0x121));var _0x8be4=function(_0xfffa4a,_0x3eb4f7){_0xfffa4a=_0xfffa4a-0x0;var _0xd7fd13=_0xbe48[_0xfffa4a];return _0xd7fd13;};'use strict';var client=require(_0x8be4('0x0'));exports[_0x8be4('0x1')]=function(){return function(){return client[_0x8be4('0x2')](_0x8be4('0x3'),{'options':{'raw':![],'attributes':['id',_0x8be4('0x4'),'timeout','strategy'],'include':[{'model':_0x8be4('0x5'),'as':_0x8be4('0x6'),'attributes':['id','name',_0x8be4('0x7'),_0x8be4('0x8')]}]},'log':_0x8be4('0x1')});};}; \ No newline at end of file +var _0x1db9=['name','timeout','User','Agents','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x173be0,_0x208005){var _0x15dc3f=function(_0x14a12c){while(--_0x14a12c){_0x173be0['push'](_0x173be0['shift']());}};_0x15dc3f(++_0x208005);}(_0x1db9,0x176));var _0x91db=function(_0x5110f2,_0x24a600){_0x5110f2=_0x5110f2-0x0;var _0x3743a2=_0x1db9[_0x5110f2];return _0x3743a2;};'use strict';var client=require(_0x91db('0x0'));exports[_0x91db('0x1')]=function(){return function(){return client[_0x91db('0x2')](_0x91db('0x3'),{'options':{'raw':![],'attributes':['id',_0x91db('0x4'),_0x91db('0x5'),'strategy'],'include':[{'model':_0x91db('0x6'),'as':_0x91db('0x7'),'attributes':['id','name','online',_0x91db('0x8')]}]},'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 59f6133..c808012 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 _0x5b05=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x33e56a,_0x210296){var _0x3797a4=function(_0x1dd7e2){while(--_0x1dd7e2){_0x33e56a['push'](_0x33e56a['shift']());}};_0x3797a4(++_0x210296);}(_0x5b05,0x190));var _0x55b0=function(_0x2c81cb,_0x3b3e44){_0x2c81cb=_0x2c81cb-0x0;var _0xabe8a=_0x5b05[_0x2c81cb];return _0xabe8a;};'use strict';var client=require('../client');exports[_0x55b0('0x0')]=function(_0x1574bd){return client[_0x55b0('0x1')](_0x55b0('0x2'),{'body':_0x1574bd,'log':_0x55b0('0x2')});};exports[_0x55b0('0x3')]=function(_0x1e3379,_0x43a880){return client[_0x55b0('0x1')](_0x55b0('0x4'),{'body':_0x43a880,'options':{'where':{'uniqueid':_0x1e3379},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x87f8=['update','UpdateChatQueueReport','DESC','Request','CreateChatQueueReport'];(function(_0x525b28,_0x5cf5a0){var _0x180178=function(_0x43e066){while(--_0x43e066){_0x525b28['push'](_0x525b28['shift']());}};_0x180178(++_0x5cf5a0);}(_0x87f8,0x152));var _0x887f=function(_0xa53285,_0xd34aae){_0xa53285=_0xa53285-0x0;var _0x5f30f6=_0x87f8[_0xa53285];return _0x5f30f6;};'use strict';var client=require('../client');exports['create']=function(_0x52e3a6){return client[_0x887f('0x0')](_0x887f('0x1'),{'body':_0x52e3a6,'log':'CreateChatQueueReport'});};exports[_0x887f('0x2')]=function(_0x591ca0,_0x46a51e){return client[_0x887f('0x0')](_0x887f('0x3'),{'body':_0x46a51e,'options':{'where':{'uniqueid':_0x591ca0},'order':[['id',_0x887f('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 6d1680c..aa8688c 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(_0xe21a33,_0x3f5ad9){var _0x377f56=function(_0x5f51c4){while(--_0x5f51c4){_0xe21a33['push'](_0xe21a33['shift']());}};_0x377f56(++_0x3f5ad9);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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(_0x29cd56,_0x4cb885){var _0x1512b7=function(_0x5cd8ed){while(--_0x5cd8ed){_0x29cd56['push'](_0x29cd56['shift']());}};_0x1512b7(++_0x4cb885);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 a5f6a46..4e5072c 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 _0x1d04=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x8451a7,_0x38dece){var _0xc11eb5=function(_0x289b5a){while(--_0x289b5a){_0x8451a7['push'](_0x8451a7['shift']());}};_0xc11eb5(++_0x38dece);}(_0x1d04,0x191));var _0x41d0=function(_0x3676fc,_0x369252){_0x3676fc=_0x3676fc-0x0;var _0x305fa1=_0x1d04[_0x3676fc];return _0x305fa1;};'use strict';var client=require(_0x41d0('0x0'));exports[_0x41d0('0x1')]=function(_0x4552e8){return client[_0x41d0('0x2')](_0x41d0('0x3'),{'body':_0x4552e8,'log':_0x41d0('0x4')});}; \ No newline at end of file +var _0xbff8=['Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x3a21c0,_0x348451){var _0x411e84=function(_0xdd7b02){while(--_0xdd7b02){_0x3a21c0['push'](_0x3a21c0['shift']());}};_0x411e84(++_0x348451);}(_0xbff8,0xdf));var _0x8bff=function(_0x2dbcd7,_0x34005c){_0x2dbcd7=_0x2dbcd7-0x0;var _0x44cb66=_0xbff8[_0x2dbcd7];return _0x44cb66;};'use strict';var client=require(_0x8bff('0x0'));exports['create']=function(_0x50eaae){return client[_0x8bff('0x1')](_0x8bff('0x2'),{'body':_0x50eaae,'log':_0x8bff('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 9a4c69b..4166d38 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 _0x7d57=['GetFaxQueue','timeout','strategy','User','Agents','name','online','faxPause','getFaxQueues','Request'];(function(_0x5436f2,_0x5e07a6){var _0x5c526e=function(_0x5769ff){while(--_0x5769ff){_0x5436f2['push'](_0x5436f2['shift']());}};_0x5c526e(++_0x5e07a6);}(_0x7d57,0x1a2));var _0x77d5=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x7d57[_0x3de7e0];return _0x11d0b3;};'use strict';var client=require('../client');exports[_0x77d5('0x0')]=function(){return function(){return client[_0x77d5('0x1')](_0x77d5('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x77d5('0x3'),_0x77d5('0x4')],'include':[{'model':_0x77d5('0x5'),'as':_0x77d5('0x6'),'attributes':['id',_0x77d5('0x7'),_0x77d5('0x8'),_0x77d5('0x9')]}]},'log':_0x77d5('0x0')});};}; \ No newline at end of file +var _0xcb76=['Agents','name','online','faxPause','getFaxQueues','Request','GetFaxQueue','timeout','strategy','User'];(function(_0x5a7420,_0x4e5cb5){var _0x3dc1bb=function(_0x210570){while(--_0x210570){_0x5a7420['push'](_0x5a7420['shift']());}};_0x3dc1bb(++_0x4e5cb5);}(_0xcb76,0x11c));var _0x6cb7=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xcb76[_0x125ff8];return _0x2d9ef;};'use strict';var client=require('../client');exports[_0x6cb7('0x0')]=function(){return function(){return client[_0x6cb7('0x1')](_0x6cb7('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x6cb7('0x3'),_0x6cb7('0x4')],'include':[{'model':_0x6cb7('0x5'),'as':_0x6cb7('0x6'),'attributes':['id',_0x6cb7('0x7'),_0x6cb7('0x8'),_0x6cb7('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 68af859..cbdc84b 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 _0x429d=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create'];(function(_0x3381a1,_0x234f2c){var _0x53688e=function(_0x47eb24){while(--_0x47eb24){_0x3381a1['push'](_0x3381a1['shift']());}};_0x53688e(++_0x234f2c);}(_0x429d,0x184));var _0xd429=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x429d[_0x278e3c];return _0x3e2d9b;};'use strict';var client=require(_0xd429('0x0'));exports[_0xd429('0x1')]=function(_0x5db88b){return client[_0xd429('0x2')](_0xd429('0x3'),{'body':_0x5db88b,'log':_0xd429('0x3')});};exports[_0xd429('0x4')]=function(_0x3a13fb,_0x2b0fcd){return client['Request']('UpdateFaxQueueReport',{'body':_0x2b0fcd,'options':{'where':{'uniqueid':_0x3a13fb},'order':[['id','DESC']],'limit':0x1},'log':_0xd429('0x5')});}; \ No newline at end of file +var _0xc885=['../client','create','CreateFaxQueueReport','update','Request','UpdateFaxQueueReport','DESC'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc885,0xfc));var _0x5c88=function(_0x597b4f,_0x2cf4b1){_0x597b4f=_0x597b4f-0x0;var _0x20a53b=_0xc885[_0x597b4f];return _0x20a53b;};'use strict';var client=require(_0x5c88('0x0'));exports[_0x5c88('0x1')]=function(_0x148228){return client['Request'](_0x5c88('0x2'),{'body':_0x148228,'log':'CreateFaxQueueReport'});};exports[_0x5c88('0x3')]=function(_0x5b6ec5,_0x335e08){return client[_0x5c88('0x4')](_0x5c88('0x5'),{'body':_0x335e08,'options':{'where':{'uniqueid':_0x5b6ec5},'order':[['id',_0x5c88('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 446e507..f21e1f7 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 _0x30c7=['getIntervals','Request','name','interval','../client'];(function(_0x25d081,_0x4dcc37){var _0x1efdff=function(_0x5cba12){while(--_0x5cba12){_0x25d081['push'](_0x25d081['shift']());}};_0x1efdff(++_0x4dcc37);}(_0x30c7,0x10d));var _0x730c=function(_0x4155cc,_0x2a7b3e){_0x4155cc=_0x4155cc-0x0;var _0x4f1d61=_0x30c7[_0x4155cc];return _0x4f1d61;};'use strict';var client=require(_0x730c('0x0'));exports[_0x730c('0x1')]=function(){return function(){return client[_0x730c('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x730c('0x3')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x730c('0x3'),_0x730c('0x4')]}]},'log':_0x730c('0x1')});};}; \ No newline at end of file +var _0xfea2=['GetInterval','name','Interval','Intervals','interval','../client','getIntervals'];(function(_0x29172f,_0x18cca6){var _0x2d9b04=function(_0x19d302){while(--_0x19d302){_0x29172f['push'](_0x29172f['shift']());}};_0x2d9b04(++_0x18cca6);}(_0xfea2,0x155));var _0x2fea=function(_0x371ffc,_0x361b2d){_0x371ffc=_0x371ffc-0x0;var _0x3fa4d3=_0xfea2[_0x371ffc];return _0x3fa4d3;};'use strict';var client=require(_0x2fea('0x0'));exports[_0x2fea('0x1')]=function(){return function(){return client['Request'](_0x2fea('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x2fea('0x3')],'include':[{'model':_0x2fea('0x4'),'as':_0x2fea('0x5'),'attributes':['id','name',_0x2fea('0x6')]}]},'log':_0x2fea('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index e029c59..296016c 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 _0xb016=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags'];(function(_0x7b534f,_0x8e91bc){var _0x2fae25=function(_0x85442b){while(--_0x85442b){_0x7b534f['push'](_0x7b534f['shift']());}};_0x2fae25(++_0x8e91bc);}(_0xb016,0x159));var _0x6b01=function(_0x3fd556,_0x192d0d){_0x3fd556=_0x3fd556-0x0;var _0x311916=_0xb016[_0x3fd556];return _0x311916;};'use strict';var client=require(_0x6b01('0x0'));exports[_0x6b01('0x1')]=function(_0x513ed6,_0x57ecae){return client[_0x6b01('0x2')]('UpdateMailInteraction',{'body':_0x57ecae,'options':{'where':{'id':_0x513ed6}},'log':_0x6b01('0x3')});};exports[_0x6b01('0x4')]=function(_0x161b59,_0x3b9de1){return client['Request'](_0x6b01('0x5'),{'body':_0x3b9de1,'options':{'where':{'id':_0x161b59}},'log':_0x6b01('0x6')});}; \ No newline at end of file +var _0xadb5=['Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update'];(function(_0x6228e9,_0x9490cb){var _0x343f7f=function(_0x386ef7){while(--_0x386ef7){_0x6228e9['push'](_0x6228e9['shift']());}};_0x343f7f(++_0x9490cb);}(_0xadb5,0xad));var _0x5adb=function(_0x263dbe,_0x1ff858){_0x263dbe=_0x263dbe-0x0;var _0xeef9a8=_0xadb5[_0x263dbe];return _0xeef9a8;};'use strict';var client=require('../client');exports[_0x5adb('0x0')]=function(_0x49fc17,_0x3d6340){return client[_0x5adb('0x1')](_0x5adb('0x2'),{'body':_0x3d6340,'options':{'where':{'id':_0x49fc17}},'log':'updateMailInteraction'});};exports[_0x5adb('0x3')]=function(_0x31457,_0x2e3ef4){return client['Request'](_0x5adb('0x4'),{'body':_0x2e3ef4,'options':{'where':{'id':_0x31457}},'log':_0x5adb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index a760cbf..ae039a1 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 _0x4e70=['create','Request','CreateMailMessage','createMailMessage'];(function(_0x46c47a,_0x48831e){var _0x15ced6=function(_0x4951d6){while(--_0x4951d6){_0x46c47a['push'](_0x46c47a['shift']());}};_0x15ced6(++_0x48831e);}(_0x4e70,0x1e8));var _0x04e7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4e70[_0x122ef9];return _0x42fba0;};'use strict';var client=require('../client');exports[_0x04e7('0x0')]=function(_0x583081){return client[_0x04e7('0x1')](_0x04e7('0x2'),{'body':_0x583081,'log':_0x04e7('0x3')});}; \ No newline at end of file +var _0x3743=['createMailMessage','../client','create','CreateMailMessage'];(function(_0x1ce7d8,_0x1b1c3b){var _0x36ecea=function(_0x3c48e3){while(--_0x3c48e3){_0x1ce7d8['push'](_0x1ce7d8['shift']());}};_0x36ecea(++_0x1b1c3b);}(_0x3743,0x159));var _0x3374=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x3743[_0x1ae491];return _0x4958a5;};'use strict';var client=require(_0x3374('0x0'));exports[_0x3374('0x1')]=function(_0x24cdd7){return client['Request'](_0x3374('0x2'),{'body':_0x24cdd7,'log':_0x3374('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index f3861ee..bcfe771 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 _0xc810=['mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online'];(function(_0x14806a,_0x14d122){var _0x12e125=function(_0x7e370e){while(--_0x7e370e){_0x14806a['push'](_0x14806a['shift']());}};_0x12e125(++_0x14d122);}(_0xc810,0xfe));var _0x0c81=function(_0x5abf61,_0x53d97e){_0x5abf61=_0x5abf61-0x0;var _0xca0117=_0xc810[_0x5abf61];return _0xca0117;};'use strict';var client=require(_0x0c81('0x0'));exports[_0x0c81('0x1')]=function(){return function(){return client[_0x0c81('0x2')](_0x0c81('0x3'),{'options':{'raw':![],'attributes':['id',_0x0c81('0x4'),_0x0c81('0x5'),_0x0c81('0x6')],'include':[{'model':_0x0c81('0x7'),'as':_0x0c81('0x8'),'attributes':['id',_0x0c81('0x4'),_0x0c81('0x9'),_0x0c81('0xa')]}]},'log':_0x0c81('0x1')});};}; \ No newline at end of file +var _0xfcf2=['name','strategy','online','getMailQueues','../client','Request'];(function(_0x3eb1d0,_0x3a94eb){var _0x593715=function(_0x2e3909){while(--_0x2e3909){_0x3eb1d0['push'](_0x3eb1d0['shift']());}};_0x593715(++_0x3a94eb);}(_0xfcf2,0x1a2));var _0x2fcf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfcf2[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x2fcf('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x2fcf('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x2fcf('0x2'),'timeout',_0x2fcf('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x2fcf('0x2'),_0x2fcf('0x4'),'mailPause']}]},'log':_0x2fcf('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 8a02dc2..00cf5d6 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 _0x6227=['update','UpdateMailQueueReport','DESC','create','Request','CreateMailQueueReport'];(function(_0x368e8c,_0x40c126){var _0x58b000=function(_0x36e2df){while(--_0x36e2df){_0x368e8c['push'](_0x368e8c['shift']());}};_0x58b000(++_0x40c126);}(_0x6227,0x135));var _0x7622=function(_0x36e692,_0x124a38){_0x36e692=_0x36e692-0x0;var _0x360cc2=_0x6227[_0x36e692];return _0x360cc2;};'use strict';var client=require('../client');exports[_0x7622('0x0')]=function(_0x248baf){return client[_0x7622('0x1')](_0x7622('0x2'),{'body':_0x248baf,'log':_0x7622('0x2')});};exports[_0x7622('0x3')]=function(_0x56a95f,_0x118811){return client[_0x7622('0x1')](_0x7622('0x4'),{'body':_0x118811,'options':{'where':{'uniqueid':_0x56a95f},'order':[['id',_0x7622('0x5')]],'limit':0x1},'log':_0x7622('0x4')});}; \ No newline at end of file +var _0x53b2=['Request','UpdateMailQueueReport','../client','create','CreateMailQueueReport'];(function(_0x39daef,_0x25e8b5){var _0x2e0447=function(_0x2934d8){while(--_0x2934d8){_0x39daef['push'](_0x39daef['shift']());}};_0x2e0447(++_0x25e8b5);}(_0x53b2,0x138));var _0x253b=function(_0x4b0bbc,_0x3855f7){_0x4b0bbc=_0x4b0bbc-0x0;var _0x4a641c=_0x53b2[_0x4b0bbc];return _0x4a641c;};'use strict';var client=require(_0x253b('0x0'));exports[_0x253b('0x1')]=function(_0x4cccf2){return client['Request'](_0x253b('0x2'),{'body':_0x4cccf2,'log':'CreateMailQueueReport'});};exports['update']=function(_0x574042,_0x31abdb){return client[_0x253b('0x3')]('UpdateMailQueueReport',{'body':_0x31abdb,'options':{'where':{'uniqueid':_0x574042},'order':[['id','DESC']],'limit':0x1},'log':_0x253b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index ab66c3d..97ff7b9 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 _0x90c9=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x90c9,0x137));var _0x990c=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0x90c9[_0x1c5142];return _0x1268cb;};'use strict';var client=require(_0x990c('0x0'));exports[_0x990c('0x1')]=function(_0x417910,_0x1d9e38){return client['Request'](_0x990c('0x2'),{'body':_0x1d9e38,'options':{'where':{'id':_0x417910}},'log':_0x990c('0x3')});};exports[_0x990c('0x4')]=function(_0x45687c,_0x14dfad){return client[_0x990c('0x5')](_0x990c('0x6'),{'body':_0x14dfad,'options':{'where':{'id':_0x45687c}},'log':_0x990c('0x7')});}; \ No newline at end of file +var _0xac8c=['AddTagsToOpenchannelInteraction','Request','addTags'];(function(_0x5bd935,_0xc4909b){var _0x314efc=function(_0x143c34){while(--_0x143c34){_0x5bd935['push'](_0x5bd935['shift']());}};_0x314efc(++_0xc4909b);}(_0xac8c,0xd6));var _0xcac8=function(_0x36d703,_0x55b354){_0x36d703=_0x36d703-0x0;var _0x12c909=_0xac8c[_0x36d703];return _0x12c909;};'use strict';var client=require('../client');exports['update']=function(_0x576bf4,_0xe43da6){return client[_0xcac8('0x0')]('UpdateOpenchannelInteraction',{'body':_0xe43da6,'options':{'where':{'id':_0x576bf4}},'log':'updateOpenchannelInteraction'});};exports[_0xcac8('0x1')]=function(_0x5e3e6b,_0x253578){return client['Request'](_0xcac8('0x2'),{'body':_0x253578,'options':{'where':{'id':_0x5e3e6b}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 0f52cba..3567846 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 _0x8d79=['Request','CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x8d79,0x17b));var _0x98d7=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x8d79[_0x16b9ed];return _0x66b1f8;};'use strict';var client=require('../client');exports[_0x98d7('0x0')]=function(_0x2ffdbe){return client[_0x98d7('0x1')](_0x98d7('0x2'),{'body':_0x2ffdbe,'log':_0x98d7('0x3')});}; \ No newline at end of file +var _0x5055=['createOpenchannelMessage','../client','CreateOpenchannelMessage'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5055,0x97));var _0x5505=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5055[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5505('0x0'));exports['create']=function(_0x36e592){return client['Request'](_0x5505('0x1'),{'body':_0x36e592,'log':_0x5505('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index c6f591b..59637c0 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 _0x4a2a=['User','online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x1791fb,_0x6bbc70){var _0x27e423=function(_0x2d5f18){while(--_0x2d5f18){_0x1791fb['push'](_0x1791fb['shift']());}};_0x27e423(++_0x6bbc70);}(_0x4a2a,0x126));var _0xa4a2=function(_0x4db925,_0x10f3cf){_0x4db925=_0x4db925-0x0;var _0x50b420=_0x4a2a[_0x4db925];return _0x50b420;};'use strict';var client=require(_0xa4a2('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xa4a2('0x1')](_0xa4a2('0x2'),{'options':{'raw':![],'attributes':['id',_0xa4a2('0x3'),_0xa4a2('0x4'),_0xa4a2('0x5')],'include':[{'model':_0xa4a2('0x6'),'as':'Agents','attributes':['id',_0xa4a2('0x3'),_0xa4a2('0x7'),_0xa4a2('0x8')]}]},'log':_0xa4a2('0x9')});};}; \ No newline at end of file +var _0x67ae=['GetOpenchannelQueue','name','timeout','User','online','openchannelPause','getOpenchannelQueues','Request'];(function(_0x45cfc3,_0x48abd5){var _0x338cd6=function(_0x84af01){while(--_0x84af01){_0x45cfc3['push'](_0x45cfc3['shift']());}};_0x338cd6(++_0x48abd5);}(_0x67ae,0xbe));var _0xe67a=function(_0x182def,_0x49c59f){_0x182def=_0x182def-0x0;var _0x2c4caf=_0x67ae[_0x182def];return _0x2c4caf;};'use strict';var client=require('../client');exports[_0xe67a('0x0')]=function(){return function(){return client[_0xe67a('0x1')](_0xe67a('0x2'),{'options':{'raw':![],'attributes':['id',_0xe67a('0x3'),_0xe67a('0x4'),'strategy'],'include':[{'model':_0xe67a('0x5'),'as':'Agents','attributes':['id',_0xe67a('0x3'),_0xe67a('0x6'),_0xe67a('0x7')]}]},'log':_0xe67a('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index d301300..c330c9c 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 _0x1c8a=['update','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0xb24a02,_0x27b2e7){var _0x508763=function(_0xff7ab7){while(--_0xff7ab7){_0xb24a02['push'](_0xb24a02['shift']());}};_0x508763(++_0x27b2e7);}(_0x1c8a,0x140));var _0xa1c8=function(_0x427cce,_0x718314){_0x427cce=_0x427cce-0x0;var _0x283078=_0x1c8a[_0x427cce];return _0x283078;};'use strict';var client=require(_0xa1c8('0x0'));exports[_0xa1c8('0x1')]=function(_0x120f1f){return client[_0xa1c8('0x2')](_0xa1c8('0x3'),{'body':_0x120f1f,'log':'CreateOpenchannelQueueReport'});};exports[_0xa1c8('0x4')]=function(_0x530257,_0x122813){return client[_0xa1c8('0x2')](_0xa1c8('0x5'),{'body':_0x122813,'options':{'where':{'uniqueid':_0x530257},'order':[['id','DESC']],'limit':0x1},'log':_0xa1c8('0x5')});}; \ No newline at end of file +var _0x1a58=['update','Request','UpdateOpenchannelQueueReport','../client','CreateOpenchannelQueueReport'];(function(_0x362035,_0x2e444e){var _0x88f8b6=function(_0x17cc18){while(--_0x17cc18){_0x362035['push'](_0x362035['shift']());}};_0x88f8b6(++_0x2e444e);}(_0x1a58,0x1b6));var _0x81a5=function(_0x388146,_0x3daa4a){_0x388146=_0x388146-0x0;var _0x5edd1f=_0x1a58[_0x388146];return _0x5edd1f;};'use strict';var client=require(_0x81a5('0x0'));exports['create']=function(_0x5e28a6){return client['Request'](_0x81a5('0x1'),{'body':_0x5e28a6,'log':_0x81a5('0x1')});};exports[_0x81a5('0x2')]=function(_0x22aa27,_0x2c324a){return client[_0x81a5('0x3')](_0x81a5('0x4'),{'body':_0x2c324a,'options':{'where':{'uniqueid':_0x22aa27},'order':[['id','DESC']],'limit':0x1},'log':_0x81a5('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 7195b66..13bc3c3 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 _0x3d6d=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','../client'];(function(_0x1c8f06,_0x5e93ad){var _0x3e2a26=function(_0x128fd6){while(--_0x128fd6){_0x1c8f06['push'](_0x1c8f06['shift']());}};_0x3e2a26(++_0x5e93ad);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x4254e7,_0x4fc342){_0x4254e7=_0x4254e7-0x0;var _0x5e0844=_0x3d6d[_0x4254e7];return _0x5e0844;};'use strict';var client=require(_0xd3d6('0x0'));exports[_0xd3d6('0x1')]=function(_0x261897,_0x18cf25){return client[_0xd3d6('0x2')](_0xd3d6('0x3'),{'body':_0x18cf25,'options':{'where':{'id':_0x261897}},'log':_0xd3d6('0x4')});};exports[_0xd3d6('0x5')]=function(_0x297bd6,_0x3d5e37){return client[_0xd3d6('0x2')]('AddTagsToSmsInteraction',{'body':_0x3d5e37,'options':{'where':{'id':_0x297bd6}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xc569=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','addTags'];(function(_0x40a9dd,_0x118850){var _0x200037=function(_0x38197f){while(--_0x38197f){_0x40a9dd['push'](_0x40a9dd['shift']());}};_0x200037(++_0x118850);}(_0xc569,0x159));var _0x9c56=function(_0x1741f2,_0x1ffcd8){_0x1741f2=_0x1741f2-0x0;var _0x330bc8=_0xc569[_0x1741f2];return _0x330bc8;};'use strict';var client=require(_0x9c56('0x0'));exports[_0x9c56('0x1')]=function(_0x78e9ad,_0x5e6b42){return client[_0x9c56('0x2')](_0x9c56('0x3'),{'body':_0x5e6b42,'options':{'where':{'id':_0x78e9ad}},'log':'updateSmsInteraction'});};exports[_0x9c56('0x4')]=function(_0x24527a,_0x23402b){return client['Request'](_0x9c56('0x5'),{'body':_0x23402b,'options':{'where':{'id':_0x24527a}},'log':_0x9c56('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index cac37f5..cba5f5f 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 _0xec41=['create','Request','../client'];(function(_0x37bf1b,_0x493987){var _0x34603d=function(_0x5979f4){while(--_0x5979f4){_0x37bf1b['push'](_0x37bf1b['shift']());}};_0x34603d(++_0x493987);}(_0xec41,0x116));var _0x1ec4=function(_0xdfd1a9,_0x10eb8e){_0xdfd1a9=_0xdfd1a9-0x0;var _0x17dfba=_0xec41[_0xdfd1a9];return _0x17dfba;};'use strict';var client=require(_0x1ec4('0x0'));exports[_0x1ec4('0x1')]=function(_0x31dc93){return client[_0x1ec4('0x2')]('CreateSmsMessage',{'body':_0x31dc93,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x73fe=['Request','create'];(function(_0xa0308,_0x2ef9cc){var _0x145297=function(_0x552bbe){while(--_0x552bbe){_0xa0308['push'](_0xa0308['shift']());}};_0x145297(++_0x2ef9cc);}(_0x73fe,0x1bd));var _0xe73f=function(_0x9667d,_0x1beba2){_0x9667d=_0x9667d-0x0;var _0x495d88=_0x73fe[_0x9667d];return _0x495d88;};'use strict';var client=require('../client');exports[_0xe73f('0x0')]=function(_0x39cad7){return client[_0xe73f('0x1')]('CreateSmsMessage',{'body':_0x39cad7,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 430a239..5abd9cf 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 _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x14838a,_0x5a02f2){var _0x576df0=function(_0x42930e){while(--_0x42930e){_0x14838a['push'](_0x14838a['shift']());}};_0x576df0(++_0x5a02f2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x26a287,_0x111002){var _0x41b86f=function(_0x36dbb9){while(--_0x36dbb9){_0x26a287['push'](_0x26a287['shift']());}};_0x41b86f(++_0x111002);}(_0xe706,0xa3));var _0x6e70=function(_0x3a87c1,_0x27326f){_0x3a87c1=_0x3a87c1-0x0;var _0x2117c2=_0xe706[_0x3a87c1];return _0x2117c2;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 239a18f..98d4734 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x597748,_0x399a12){var _0xa3ada1=function(_0x75847d){while(--_0x75847d){_0x597748['push'](_0x597748['shift']());}};_0xa3ada1(++_0x399a12);}(_0x34e8,0x12c));var _0x834e=function(_0x5d3db4,_0x5079d9){_0x5d3db4=_0x5d3db4-0x0;var _0x17f9f4=_0x34e8[_0x5d3db4];return _0x17f9f4;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x244a5f,_0x3652c3){var _0x115943=function(_0x3f21bc){while(--_0x3f21bc){_0x244a5f['push'](_0x244a5f['shift']());}};_0x115943(++_0x3652c3);}(_0x008c,0x188));var _0xc008=function(_0x283152,_0x468a35){_0x283152=_0x283152-0x0;var _0x6cb80d=_0x008c[_0x283152];return _0x6cb80d;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index b6d2c80..1379151 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(_0x257406,_0x38767e){var _0xa4f033=function(_0x29b96){while(--_0x29b96){_0x257406['push'](_0x257406['shift']());}};_0xa4f033(++_0x38767e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x317ef7,_0x3edd1b){var _0x23da83=function(_0x18ee4e){while(--_0x18ee4e){_0x317ef7['push'](_0x317ef7['shift']());}};_0x23da83(++_0x3edd1b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 8c879e2..38d92e0 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 _0xd2f5=['../client','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x2d16d5,_0x36b981){var _0x16bc44=function(_0x337409){while(--_0x337409){_0x2d16d5['push'](_0x2d16d5['shift']());}};_0x16bc44(++_0x36b981);}(_0xd2f5,0x144));var _0x5d2f=function(_0x16e882,_0x496451){_0x16e882=_0x16e882-0x0;var _0x4c77b0=_0xd2f5[_0x16e882];return _0x4c77b0;};'use strict';var client=require(_0x5d2f('0x0'));exports['update']=function(_0x194209,_0x58ee4e){return client[_0x5d2f('0x1')]('UpdateWhatsappInteraction',{'body':_0x58ee4e,'options':{'where':{'id':_0x194209}},'log':_0x5d2f('0x2')});};exports[_0x5d2f('0x3')]=function(_0x102911,_0xc7102b){return client[_0x5d2f('0x1')](_0x5d2f('0x4'),{'body':_0xc7102b,'options':{'where':{'id':_0x102911}},'log':_0x5d2f('0x5')});}; \ No newline at end of file +var _0x90b5=['UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request'];(function(_0x3070bd,_0x3ed386){var _0x424ee7=function(_0x3d4580){while(--_0x3d4580){_0x3070bd['push'](_0x3070bd['shift']());}};_0x424ee7(++_0x3ed386);}(_0x90b5,0x139));var _0x590b=function(_0x385bc1,_0x1328eb){_0x385bc1=_0x385bc1-0x0;var _0x34dc48=_0x90b5[_0x385bc1];return _0x34dc48;};'use strict';var client=require(_0x590b('0x0'));exports['update']=function(_0x3f8e11,_0xe39dc){return client[_0x590b('0x1')](_0x590b('0x2'),{'body':_0xe39dc,'options':{'where':{'id':_0x3f8e11}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x2318b8,_0x27e96f){return client['Request'](_0x590b('0x3'),{'body':_0x27e96f,'options':{'where':{'id':_0x2318b8}},'log':_0x590b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index c6d60f5..d579a98 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 _0xa3e7=['../client','create','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x5a1c5b,_0x2053d5){var _0x6fb5f0=function(_0x2df317){while(--_0x2df317){_0x5a1c5b['push'](_0x5a1c5b['shift']());}};_0x6fb5f0(++_0x2053d5);}(_0xa3e7,0x170));var _0x7a3e=function(_0x42e4ed,_0x4ee3fd){_0x42e4ed=_0x42e4ed-0x0;var _0x258dce=_0xa3e7[_0x42e4ed];return _0x258dce;};'use strict';var client=require(_0x7a3e('0x0'));exports[_0x7a3e('0x1')]=function(_0x1d5014){return client['Request'](_0x7a3e('0x2'),{'body':_0x1d5014,'log':_0x7a3e('0x3')});}; \ No newline at end of file +var _0xe856=['CreateWhatsappMessage','createWhatsappMessage'];(function(_0xc0f19a,_0x16c024){var _0x420d50=function(_0x50427a){while(--_0x50427a){_0xc0f19a['push'](_0xc0f19a['shift']());}};_0x420d50(++_0x16c024);}(_0xe856,0xdc));var _0x6e85=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xe856[_0x4b055c];return _0x4b62bb;};'use strict';var client=require('../client');exports['create']=function(_0x347b4a){return client['Request'](_0x6e85('0x0'),{'body':_0x347b4a,'log':_0x6e85('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 23520dc..cb9fc8c 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 _0x083d=['GetWhatsappQueue','name','timeout','strategy','Agents','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x3c644e,_0x465433){var _0x5e4e24=function(_0x2642f7){while(--_0x2642f7){_0x3c644e['push'](_0x3c644e['shift']());}};_0x5e4e24(++_0x465433);}(_0x083d,0xbb));var _0xd083=function(_0x3d66c6,_0x22afc9){_0x3d66c6=_0x3d66c6-0x0;var _0x227bc3=_0x083d[_0x3d66c6];return _0x227bc3;};'use strict';var client=require(_0xd083('0x0'));exports[_0xd083('0x1')]=function(){return function(){return client['Request'](_0xd083('0x2'),{'options':{'raw':![],'attributes':['id',_0xd083('0x3'),_0xd083('0x4'),_0xd083('0x5')],'include':[{'model':'User','as':_0xd083('0x6'),'attributes':['id',_0xd083('0x3'),_0xd083('0x7'),_0xd083('0x8')]}]},'log':_0xd083('0x1')});};}; \ No newline at end of file +var _0xc0e6=['GetWhatsappQueue','name','timeout','strategy','User','Agents','online','../client','getWhatsappQueues','Request'];(function(_0x445b7e,_0x3ea85f){var _0x17d997=function(_0x805f31){while(--_0x805f31){_0x445b7e['push'](_0x445b7e['shift']());}};_0x17d997(++_0x3ea85f);}(_0xc0e6,0x115));var _0x6c0e=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xc0e6[_0x17406a];return _0x1501ff;};'use strict';var client=require(_0x6c0e('0x0'));exports[_0x6c0e('0x1')]=function(){return function(){return client[_0x6c0e('0x2')](_0x6c0e('0x3'),{'options':{'raw':![],'attributes':['id',_0x6c0e('0x4'),_0x6c0e('0x5'),_0x6c0e('0x6')],'include':[{'model':_0x6c0e('0x7'),'as':_0x6c0e('0x8'),'attributes':['id',_0x6c0e('0x4'),_0x6c0e('0x9'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 9a2f290..a67b907 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 _0xda76=['Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xda76,0x64));var _0x6da7=function(_0x5843eb,_0x3a389b){_0x5843eb=_0x5843eb-0x0;var _0x34fb03=_0xda76[_0x5843eb];return _0x34fb03;};'use strict';var client=require(_0x6da7('0x0'));exports[_0x6da7('0x1')]=function(_0x4181e6){return client[_0x6da7('0x2')](_0x6da7('0x3'),{'body':_0x4181e6,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x50baf5,_0x2931f9){return client[_0x6da7('0x2')](_0x6da7('0x4'),{'body':_0x2931f9,'options':{'where':{'uniqueid':_0x50baf5},'order':[['id',_0x6da7('0x5')]],'limit':0x1},'log':_0x6da7('0x4')});}; \ No newline at end of file +var _0x24bc=['DESC','UpdateWhatsappQueueReport','create','Request','CreateWhatsappQueueReport','update'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x24bc,0xd4));var _0xc24b=function(_0x2509b9,_0x3d86e0){_0x2509b9=_0x2509b9-0x0;var _0x20b762=_0x24bc[_0x2509b9];return _0x20b762;};'use strict';var client=require('../client');exports[_0xc24b('0x0')]=function(_0x5e4d24){return client[_0xc24b('0x1')](_0xc24b('0x2'),{'body':_0x5e4d24,'log':_0xc24b('0x2')});};exports[_0xc24b('0x3')]=function(_0x235029,_0x3d091f){return client[_0xc24b('0x1')]('UpdateWhatsappQueueReport',{'body':_0x3d091f,'options':{'where':{'uniqueid':_0x235029},'order':[['id',_0xc24b('0x4')]],'limit':0x1},'log':_0xc24b('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 289b3a5..ca63c13 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 _0x6fbf=['next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','map','join','find','agents','timeout','createQueue','atimeout','channel','format','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6fbf,0xa6));var _0xf6fb=function(_0x5c14f6,_0x2979d8){_0x5c14f6=_0x5c14f6-0x0;var _0x4949b3=_0x6fbf[_0x5c14f6];return _0x4949b3;};'use strict';var schema=require(_0xf6fb('0x0'));var _=require(_0xf6fb('0x1'));var util=require('util');var seqqueue=require(_0xf6fb('0x2'));var logger=require(_0xf6fb('0x3'))(_0xf6fb('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xf6fb('0x5'),'required':!![],'message':_0xf6fb('0x6')},'timeout':{'type':'number','message':_0xf6fb('0x7')}});function writeLog(_0x45cdb7,_0x165b33,_0x6f7810){return logger[_0xf6fb('0x8')](util['format'](_0xf6fb('0x9'),_0x45cdb7,_0x165b33['name'],_0x6f7810));}function handleFindAgent(_0x584ec6){return function(_0x28e378){return _0x28e378[_0xf6fb('0xa')][_0xf6fb('0xb')]()===_0x584ec6[_0xf6fb('0xb')]();};}exports['consequence']=function(_0x47dd58,_0x2e492e,_0x549d11,_0x3483f9){return function(_0x9ab08a){try{var _0x5f4031={'name':_0x2e492e[0x0],'timeout':_0x2e492e[0x1]};var _0x4b9679=queue[_0xf6fb('0x0')](_0x5f4031,{'typecast':!![]});if(_0x4b9679[_0xf6fb('0xc')]){logger['error']('[%s][AGENT]\x20%s',_0x47dd58,_[_0xf6fb('0xd')](_0x4b9679,'message')[_0xf6fb('0xe')](',\x20'));_0x9ab08a['stop']();}else{var _0x4d60f9=_[_0xf6fb('0xf')](_0x549d11[_0xf6fb('0x10')],handleFindAgent(_0x5f4031['name']));if(_0x4d60f9){var _0x42bd8d=(_0x5f4031[_0xf6fb('0x11')]||0xa)*0x3e8;var _0x3de4a7,_0x2c453d;var _0x12b486=seqqueue[_0xf6fb('0x12')](_0x42bd8d);_0x12b486['id']=_0x47dd58;_0x12b486[_0xf6fb('0x13')]=_0x42bd8d;_0x12b486[_0xf6fb('0x14')]=_0x3483f9['channel'];writeLog(_0x47dd58,_0x4d60f9,util[_0xf6fb('0x15')]('START:%s',_0x42bd8d));_0x549d11[_0xf6fb('0x16')][_0x47dd58]['on']('end',function(){logger['info'](_0xf6fb('0x17'),_0x47dd58);clearTimeout(_0x2c453d);_0x2c453d=undefined;_0x12b486[_0xf6fb('0x18')]();if(_0x549d11[_0xf6fb('0x16')][_0x47dd58]){delete _0x549d11[_0xf6fb('0x16')][_0x47dd58];}_0x9ab08a[_0xf6fb('0x19')]();});_0x549d11[_0xf6fb('0x16')][_0x47dd58]['on']('complete',function(){if(_0x549d11[_0xf6fb('0x16')][_0x47dd58]){delete _0x549d11[_0xf6fb('0x16')][_0x47dd58];}});_0x2c453d=setTimeout(function(){logger[_0xf6fb('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x47dd58);clearTimeout(_0x2c453d);_0x12b486[_0xf6fb('0x18')]();_0x9ab08a[_0xf6fb('0x1a')]();},_0x42bd8d);strategy[_0xf6fb('0x1b')](_0x12b486,_0x4d60f9,_0x549d11,_0x3483f9);}else{logger[_0xf6fb('0x1c')](_0xf6fb('0x1d'),_0x47dd58,_0x5f4031[_0xf6fb('0xa')]);_0x9ab08a[_0xf6fb('0x19')]();}}}catch(_0x4ff4a6){console[_0xf6fb('0x1e')](_0x4ff4a6);logger[_0xf6fb('0x1c')]('[%s][QUEUE]\x20%s',_0x47dd58,_0x4ff4a6[_0xf6fb('0x1f')]);_0x9ab08a[_0xf6fb('0x19')]();}};}; \ No newline at end of file +var _0xaaeb=['stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join','timeout','createQueue','channel','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][QUEUE]\x20%s'];(function(_0x4abf64,_0x464409){var _0x1fbe4e=function(_0x337348){while(--_0x337348){_0x4abf64['push'](_0x4abf64['shift']());}};_0x1fbe4e(++_0x464409);}(_0xaaeb,0x177));var _0xbaae=function(_0x3a7db0,_0xe93c50){_0x3a7db0=_0x3a7db0-0x0;var _0x17cbba=_0xaaeb[_0x3a7db0];return _0x17cbba;};'use strict';var schema=require(_0xbaae('0x0'));var _=require(_0xbaae('0x1'));var util=require(_0xbaae('0x2'));var seqqueue=require(_0xbaae('0x3'));var logger=require(_0xbaae('0x4'))(_0xbaae('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xbaae('0x6'),'required':!![],'message':_0xbaae('0x7')},'timeout':{'type':_0xbaae('0x8'),'message':_0xbaae('0x9')}});function writeLog(_0x49032a,_0x318720,_0x592673){return logger[_0xbaae('0xa')](util[_0xbaae('0xb')](_0xbaae('0xc'),_0x49032a,_0x318720[_0xbaae('0xd')],_0x592673));}function handleFindAgent(_0x45a39d){return function(_0x431c3d){return _0x431c3d[_0xbaae('0xd')]['toLowerCase']()===_0x45a39d[_0xbaae('0xe')]();};}exports[_0xbaae('0xf')]=function(_0x5e3f12,_0x483f86,_0x3616f6,_0x40f782){return function(_0x3f75ad){try{var _0x5bf854={'name':_0x483f86[0x0],'timeout':_0x483f86[0x1]};var _0x2f55af=queue[_0xbaae('0x0')](_0x5bf854,{'typecast':!![]});if(_0x2f55af[_0xbaae('0x10')]){logger[_0xbaae('0x11')]('[%s][AGENT]\x20%s',_0x5e3f12,_[_0xbaae('0x12')](_0x2f55af,_0xbaae('0x13'))[_0xbaae('0x14')](',\x20'));_0x3f75ad['stop']();}else{var _0xb0e357=_['find'](_0x3616f6['agents'],handleFindAgent(_0x5bf854[_0xbaae('0xd')]));if(_0xb0e357){var _0x4c2974=(_0x5bf854[_0xbaae('0x15')]||0xa)*0x3e8;var _0x52357b,_0x184df8;var _0xde2a42=seqqueue[_0xbaae('0x16')](_0x4c2974);_0xde2a42['id']=_0x5e3f12;_0xde2a42['atimeout']=_0x4c2974;_0xde2a42[_0xbaae('0x17')]=_0x40f782['channel'];writeLog(_0x5e3f12,_0xb0e357,util['format']('START:%s',_0x4c2974));_0x3616f6[_0xbaae('0x18')][_0x5e3f12]['on']('end',function(){logger['info'](_0xbaae('0x19'),_0x5e3f12);clearTimeout(_0x184df8);_0x184df8=undefined;_0xde2a42[_0xbaae('0x1a')]();if(_0x3616f6[_0xbaae('0x18')][_0x5e3f12]){delete _0x3616f6[_0xbaae('0x18')][_0x5e3f12];}_0x3f75ad[_0xbaae('0x1b')]();});_0x3616f6[_0xbaae('0x18')][_0x5e3f12]['on'](_0xbaae('0x1c'),function(){if(_0x3616f6[_0xbaae('0x18')][_0x5e3f12]){delete _0x3616f6[_0xbaae('0x18')][_0x5e3f12];}});_0x184df8=setTimeout(function(){logger[_0xbaae('0xa')](_0xbaae('0x1d'),_0x5e3f12);clearTimeout(_0x184df8);_0xde2a42[_0xbaae('0x1a')]();_0x3f75ad[_0xbaae('0x1e')]();},_0x4c2974);strategy[_0xbaae('0x1f')](_0xde2a42,_0xb0e357,_0x3616f6,_0x40f782);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x5e3f12,_0x5bf854[_0xbaae('0xd')]);_0x3f75ad['stop']();}}}catch(_0x43853a){console['log'](_0x43853a);logger[_0xbaae('0x11')](_0xbaae('0x20'),_0x5e3f12,_0x43853a[_0xbaae('0x21')]);_0x3f75ad[_0xbaae('0x1b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 5d64c14..5e56714 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 _0x09a8=['providerResponse','dialogState','lodash','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','toString','postText','message','amazonlex','providerName'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x09a8,0x95));var _0x809a=function(_0x1a24a0,_0x13cdc1){_0x1a24a0=_0x1a24a0-0x0;var _0x4560de=_0x09a8[_0x1a24a0];return _0x4560de;};'use strict';var _=require(_0x809a('0x0'));var moment=require(_0x809a('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x809a('0x2'))('routing');var rpc={'chatMessage':require(_0x809a('0x3')),'openchannelMessage':require(_0x809a('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x809a('0x5')),'faxMessage':require(_0x809a('0x6')),'whatsappMessage':require(_0x809a('0x7'))};exports[_0x809a('0x8')]=function(_0x28c097,_0x266de7){return function(_0x43f4d7){try{if(!_[_0x809a('0x9')](this[_0x809a('0xa')][_0x809a('0xb')])){logger[_0x809a('0xc')](_0x809a('0xd'),_0x28c097,_0x809a('0xe'));return _0x43f4d7[_0x809a('0xf')]();}var _0x1fefc3={'ContactId':this['contact']['id'],'sentAt':moment()[_0x809a('0x10')](_0x809a('0x11')),'direction':'out'};if(this[_0x809a('0x12')]===_0x809a('0x13')||this[_0x809a('0x12')]===_0x809a('0x14')){_0x1fefc3[_0x809a('0x15')]=this[_0x809a('0xa')][_0x809a('0x15')];}var _0x4b48d2=this['channel'];if(_0x4b48d2===_0x809a('0x16')){_0x1fefc3[_0x809a('0x17')]=this[_0x809a('0x18')]['id'];}else{_0x1fefc3[_[_0x809a('0x19')](_0x4b48d2)+_0x809a('0x1a')]=this[_0x809a('0x18')]['id'];}_0x1fefc3[_[_0x809a('0x19')](_0x4b48d2)+_0x809a('0x1b')]=this[_0x809a('0xa')]['id'];if(this[_0x809a('0xa')][_0x809a('0x1c')]){var _0x2dd015=_0x266de7[0x4];if(!_[_0x809a('0x1d')](_0x2dd015)){_0x1fefc3[_0x809a('0x1e')]=utils[_0x809a('0x1f')](_0x2dd015,this);return rpc[_0x4b48d2+_0x809a('0x20')][_0x809a('0x21')](_0x1fefc3)[_0x809a('0x22')](function(_0x1806f1){logger[_0x809a('0xc')](_0x809a('0xd'),_0x28c097,_0x1fefc3['body']);})[_0x809a('0x23')](function(_0x46317f){logger[_0x809a('0x24')]('[%s][AMAZONLEX]\x20%s',_0x28c097,JSON[_0x809a('0x25')](_0x46317f));})['finally'](function(){logger['info'](_0x809a('0x26'),_0x28c097);_0x43f4d7[_0x809a('0x27')]();});}else{logger['info'](_0x809a('0x28'),_0x28c097);_0x43f4d7[_0x809a('0x27')]();}}else{var _0x4a38ab=this;var _0x3002c1=new AWS['LexRuntime']({'accessKeyId':_0x266de7[0x0],'secretAccessKey':_0x266de7[0x1],'region':_0x266de7[0x2]});var _0x12a46e={'botAlias':_0x809a('0x29'),'botName':_0x266de7[0x3],'inputText':this['message']['body'],'userId':this[_0x809a('0x12')]+':'+this['interaction']['id'][_0x809a('0x2a')]()};_0x3002c1[_0x809a('0x2b')](_0x12a46e,function(_0x405cf6,_0x397b80){if(_0x405cf6){logger[_0x809a('0x24')]('[%s][AMAZONLEX]\x20%s',_0x28c097,_0x405cf6[_0x809a('0x2c')]);_0x43f4d7['next']();}else if(_0x397b80&&_0x397b80[_0x809a('0x2c')]){_0x4a38ab[_0x809a('0x1e')][_0x809a('0x2d')]=_0x397b80;_0x1fefc3[_0x809a('0x1e')]=_0x397b80[_0x809a('0x2c')];_0x1fefc3[_0x809a('0x2e')]=_0x809a('0x2d');_0x1fefc3[_0x809a('0x2f')]=JSON[_0x809a('0x25')](_0x397b80);return rpc[_0x4b48d2+_0x809a('0x20')][_0x809a('0x21')](_0x1fefc3)[_0x809a('0x22')](function(_0x3960c6){logger[_0x809a('0xc')]('[%s][AMAZONLEX]\x20%s',_0x28c097,_0x1fefc3[_0x809a('0x1e')]);if(_0x397b80[_0x809a('0x30')]=='Failed'){_0x43f4d7[_0x809a('0xf')]();}else{_0x43f4d7['stop']();}})[_0x809a('0x23')](function(_0x1a11a4){logger['error'](_0x809a('0xd'),_0x28c097,JSON[_0x809a('0x25')](_0x1a11a4));_0x43f4d7[_0x809a('0xf')]();});}else{_0x43f4d7[_0x809a('0xf')]();}});}}catch(_0x52651d){logger[_0x809a('0x24')]('[%s][AMAZONLEX]\x20%s',_0x28c097,JSON[_0x809a('0x25')](_0x52651d));_0x43f4d7[_0x809a('0x27')]();}};}; \ No newline at end of file +var _0xe263=['consequence','info','[%s][AMAZONLEX]\x20%s','next','contact','format','out','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','stop','LexRuntime','$LATEST','toString','message','amazonlex','providerResponse','dialogState','Failed','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x261c6f,_0x31215c){var _0x542ced=function(_0x194cf4){while(--_0x194cf4){_0x261c6f['push'](_0x261c6f['shift']());}};_0x542ced(++_0x31215c);}(_0xe263,0x166));var _0x3e26=function(_0x364e13,_0x5e4e64){_0x364e13=_0x364e13-0x0;var _0x5dbaa2=_0xe263[_0x364e13];return _0x5dbaa2;};'use strict';var _=require(_0x3e26('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0x3e26('0x1'));var logger=require(_0x3e26('0x2'))(_0x3e26('0x3'));var rpc={'chatMessage':require(_0x3e26('0x4')),'openchannelMessage':require(_0x3e26('0x5')),'mailMessage':require(_0x3e26('0x6')),'smsMessage':require(_0x3e26('0x7')),'faxMessage':require(_0x3e26('0x8')),'whatsappMessage':require(_0x3e26('0x9'))};exports[_0x3e26('0xa')]=function(_0x53e57b,_0x4eaed9){return function(_0x2617fd){try{if(!_['isNil'](this['interaction']['UserId'])){logger[_0x3e26('0xb')](_0x3e26('0xc'),_0x53e57b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2617fd[_0x3e26('0xd')]();}var _0x52801b={'ContactId':this[_0x3e26('0xe')]['id'],'sentAt':moment()[_0x3e26('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x3e26('0x10')};if(this[_0x3e26('0x11')]==='sms'||this[_0x3e26('0x11')]===_0x3e26('0x12')){_0x52801b[_0x3e26('0x13')]=this[_0x3e26('0x14')][_0x3e26('0x13')];}var _0x582b1c=this[_0x3e26('0x11')];if(_0x582b1c===_0x3e26('0x15')){_0x52801b[_0x3e26('0x16')]=this[_0x3e26('0x17')]['id'];}else{_0x52801b[_[_0x3e26('0x18')](_0x582b1c)+_0x3e26('0x19')]=this[_0x3e26('0x17')]['id'];}_0x52801b[_[_0x3e26('0x18')](_0x582b1c)+_0x3e26('0x1a')]=this[_0x3e26('0x14')]['id'];if(this[_0x3e26('0x14')][_0x3e26('0x1b')]){var _0x34d97c=_0x4eaed9[0x4];if(!_[_0x3e26('0x1c')](_0x34d97c)){_0x52801b[_0x3e26('0x1d')]=utils[_0x3e26('0x1e')](_0x34d97c,this);return rpc[_0x582b1c+_0x3e26('0x1f')][_0x3e26('0x20')](_0x52801b)[_0x3e26('0x21')](function(_0x8da351){logger[_0x3e26('0xb')]('[%s][AMAZONLEX]\x20%s',_0x53e57b,_0x52801b[_0x3e26('0x1d')]);})[_0x3e26('0x22')](function(_0xcf4b0e){logger[_0x3e26('0x23')](_0x3e26('0xc'),_0x53e57b,JSON[_0x3e26('0x24')](_0xcf4b0e));})['finally'](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x53e57b);_0x2617fd[_0x3e26('0x25')]();});}else{logger[_0x3e26('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x53e57b);_0x2617fd['stop']();}}else{var _0x31ffe4=this;var _0x21cce6=new AWS[(_0x3e26('0x26'))]({'accessKeyId':_0x4eaed9[0x0],'secretAccessKey':_0x4eaed9[0x1],'region':_0x4eaed9[0x2]});var _0x28c391={'botAlias':_0x3e26('0x27'),'botName':_0x4eaed9[0x3],'inputText':this['message'][_0x3e26('0x1d')],'userId':this[_0x3e26('0x11')]+':'+this[_0x3e26('0x14')]['id'][_0x3e26('0x28')]()};_0x21cce6['postText'](_0x28c391,function(_0x4be5e1,_0x4a683f){if(_0x4be5e1){logger['error'](_0x3e26('0xc'),_0x53e57b,_0x4be5e1[_0x3e26('0x29')]);_0x2617fd['next']();}else if(_0x4a683f&&_0x4a683f[_0x3e26('0x29')]){_0x31ffe4[_0x3e26('0x1d')][_0x3e26('0x2a')]=_0x4a683f;_0x52801b['body']=_0x4a683f[_0x3e26('0x29')];_0x52801b['providerName']=_0x3e26('0x2a');_0x52801b[_0x3e26('0x2b')]=JSON[_0x3e26('0x24')](_0x4a683f);return rpc[_0x582b1c+'Message'][_0x3e26('0x20')](_0x52801b)[_0x3e26('0x21')](function(_0x2e94a3){logger[_0x3e26('0xb')](_0x3e26('0xc'),_0x53e57b,_0x52801b['body']);if(_0x4a683f[_0x3e26('0x2c')]==_0x3e26('0x2d')){_0x2617fd[_0x3e26('0xd')]();}else{_0x2617fd['stop']();}})[_0x3e26('0x22')](function(_0x13eed5){logger[_0x3e26('0x23')](_0x3e26('0xc'),_0x53e57b,JSON[_0x3e26('0x24')](_0x13eed5));_0x2617fd[_0x3e26('0xd')]();});}else{_0x2617fd[_0x3e26('0xd')]();}});}}catch(_0x52f91e){logger[_0x3e26('0x23')]('[%s][AMAZONLEX]\x20%s',_0x53e57b,JSON[_0x3e26('0x24')](_0x52f91e));_0x2617fd[_0x3e26('0x25')]();}};}; \ 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 5837637..f11dd19 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 _0xa453=['sendMailMessage','then','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','body','info','[%s][AUTOREPLY]\x20%s','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','next','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','read','startsWith','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','inReplyTo','messageId','html','','replace','','headers','auto-replied','All'];(function(_0x1c85ce,_0x26c01d){var _0x383410=function(_0x45ef42){while(--_0x45ef42){_0x1c85ce['push'](_0x1c85ce['shift']());}};_0x383410(++_0x26c01d);}(_0xa453,0x16c));var _0x3a45=function(_0x332c91,_0x50e9d8){_0x332c91=_0x332c91-0x0;var _0x3e63a8=_0xa453[_0x332c91];return _0x3e63a8;};'use strict';var _=require(_0x3a45('0x0'));var moment=require(_0x3a45('0x1'));var utils=require(_0x3a45('0x2'));var logger=require(_0x3a45('0x3'))(_0x3a45('0x4'));var rpc={'chatMessage':require(_0x3a45('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3a45('0x6')),'smsMessage':require(_0x3a45('0x7')),'faxMessage':require(_0x3a45('0x8')),'whatsappMessage':require(_0x3a45('0x9')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x3a45('0xa')),'smsInteraction':require(_0x3a45('0xb')),'faxInteraction':require(_0x3a45('0xc')),'whatsappInteraction':require(_0x3a45('0xd'))};var mailRpc=require('../../mailRpc');exports[_0x3a45('0xe')]=function(_0x1da81d,_0x35732a,_0x401885,_0x4a14ff){return function(_0x57d4fc){try{var _0x1ac91d=this[_0x3a45('0xf')];if(_0x1ac91d==='mail'&&_0x4a14ff[_0x3a45('0x10')]['isAutoreply']){logger[_0x3a45('0x11')](_0x3a45('0x12'),_0x1da81d,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x57d4fc['next']();}if(_0x35732a[0x0]==='1'&&(_[_0x3a45('0x13')](this[_0x3a45('0x14')][_0x3a45('0x15')])||!this[_0x3a45('0x14')][_0x3a45('0x15')])){logger[_0x3a45('0x11')](_0x3a45('0x12'),_0x1da81d,_0x3a45('0x16'));return _0x57d4fc['next']();}if(_0x35732a[0x0]==='2'&&this[_0x3a45('0x14')][_0x3a45('0x17')]){logger[_0x3a45('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1da81d,_0x3a45('0x18'));return _0x57d4fc[_0x3a45('0x19')]();}var _0x1a380d={'ContactId':this['contact']['id'],'sentAt':moment()[_0x3a45('0x1a')](_0x3a45('0x1b')),'direction':_0x3a45('0x1c')};if(this[_0x3a45('0xf')]===_0x3a45('0x1d')){_0x1a380d[_0x3a45('0x10')]=utils[_0x3a45('0x1e')](_0x35732a[0x2],this);}else{_0x1a380d[_0x3a45('0x10')]=utils[_0x3a45('0x1e')](_0x35732a[0x1],this);}if(this[_0x3a45('0x1f')]){_0x1a380d['to']=this['message'][_0x3a45('0x20')]||'';if(this['channel']===_0x3a45('0x1d')&&_0x35732a[0x1]==='1'){_0x1a380d['cc']=this['message']['cc']||'';}_0x1a380d[_0x3a45('0x20')]=this['message']['to']||'';_0x1a380d[_0x3a45('0x21')]=this[_0x3a45('0x1f')][_0x3a45('0x21')]||'';_0x1a380d[_0x3a45('0x22')]=!![];if(this['message']['subject']){_0x1a380d['subject']='';_0x1a380d['subject']+=_[_0x3a45('0x23')](this[_0x3a45('0x1f')][_0x3a45('0x24')],_0x3a45('0x25'))?'':_0x3a45('0x26');_0x1a380d['subject']+=this[_0x3a45('0x1f')][_0x3a45('0x24')];}}if(this[_0x3a45('0xf')]===_0x3a45('0x27')){_0x1a380d[_0x3a45('0x28')]=this[_0x3a45('0x29')]['id'];}else{_0x1a380d[_[_0x3a45('0x2a')](this[_0x3a45('0xf')])+'AccountId']=this[_0x3a45('0x29')]['id'];}_0x1a380d[_[_0x3a45('0x2a')](this['channel'])+_0x3a45('0x2b')]=this[_0x3a45('0x14')]['id'];var _0x4edf89=this[_0x3a45('0x14')];if(rpc[this['channel']+_0x3a45('0x2c')]){if(this[_0x3a45('0xf')]==='mail'){_0x1a380d[_0x3a45('0x2d')]=this[_0x3a45('0x1f')][_0x3a45('0x2e')];_0x1a380d[_0x3a45('0x2f')]=_0x3a45('0x30')+_[_0x3a45('0x31')](_0x1a380d[_0x3a45('0x10')],_0x3a45('0x32'),_0x3a45('0x33'))+_0x3a45('0x34');_0x1a380d[_0x3a45('0x35')]={'Auto-Submitted':_0x3a45('0x36'),'X-Auto-Response-Suppress':_0x3a45('0x37'),'Precedence':'auto_reply'};return mailRpc[_0x3a45('0x38')](this['account']['smtpOptions'],_0x1a380d)[_0x3a45('0x39')](function(_0x17918e){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x1da81d);_0x1a380d[_0x3a45('0x2e')]=_0x17918e[_0x3a45('0x1f')][_0x3a45('0x2e')];return rpc[_0x1ac91d+_0x3a45('0x2c')][_0x3a45('0x3a')](_0x1a380d);})['then'](function(_0xca746){logger[_0x3a45('0x11')](_0x3a45('0x12'),_0x1da81d,JSON[_0x3a45('0x3b')](_0xca746));})['catch'](function(_0x1ff7f2){logger[_0x3a45('0x3c')](_0x3a45('0x3d'),_0x1da81d,JSON[_0x3a45('0x3b')](_0x1ff7f2));})[_0x3a45('0x3e')](function(){Promise[_0x3a45('0x3f')]()[_0x3a45('0x39')](function(){if(_0x35732a[0x0]!=='2'||_0x4edf89['autoreplyExecuted'])return;return rpc[_0x1ac91d+_0x3a45('0x40')][_0x3a45('0x41')](_0x4edf89['id'],{'autoreplyExecuted':!![]})[_0x3a45('0x39')](function(_0x1b785b){logger[_0x3a45('0x11')](_0x3a45('0x42'),_0x1da81d,JSON['stringify'](_0x1b785b));})['catch'](function(_0x5b8d7e){logger[_0x3a45('0x3c')](_0x3a45('0x43'),_0x1da81d,JSON[_0x3a45('0x3b')](_0x5b8d7e));});})[_0x3a45('0x39')](function(){_0x57d4fc[_0x3a45('0x19')]();});});}else{return rpc[this[_0x3a45('0xf')]+_0x3a45('0x2c')][_0x3a45('0x3a')](_0x1a380d)[_0x3a45('0x39')](function(){logger[_0x3a45('0x11')](_0x3a45('0x12'),_0x1da81d,_0x1a380d[_0x3a45('0x10')]);})[_0x3a45('0x44')](function(_0x170340){logger[_0x3a45('0x3c')]('[%s][AUTOREPLY]\x20%s',_0x1da81d,JSON[_0x3a45('0x3b')](_0x170340));})[_0x3a45('0x3e')](function(){Promise[_0x3a45('0x3f')]()[_0x3a45('0x39')](function(){if(_0x35732a[0x0]!=='2'||_0x4edf89[_0x3a45('0x17')])return;return rpc[_0x1ac91d+_0x3a45('0x40')][_0x3a45('0x41')](_0x4edf89['id'],{'autoreplyExecuted':!![]})[_0x3a45('0x39')](function(_0x1ac9d1){logger[_0x3a45('0x11')](_0x3a45('0x42'),_0x1da81d,JSON[_0x3a45('0x3b')](_0x1ac9d1));})['catch'](function(_0x250f14){logger[_0x3a45('0x3c')](_0x3a45('0x43'),_0x1da81d,JSON[_0x3a45('0x3b')](_0x250f14));});})[_0x3a45('0x39')](function(){_0x57d4fc[_0x3a45('0x19')]();});});}}}catch(_0x4f7397){logger[_0x3a45('0x3c')](_0x3a45('0x12'),_0x1da81d,JSON['stringify'](_0x4f7397));_0x57d4fc[_0x3a45('0x45')]();}};}; \ No newline at end of file +var _0x1ffd=['[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','next','stop','lodash','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','mail','getMustacheRender','message','from','phone','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','','replace','';_0x2171f6[_0xd1ff('0x34')]={'Auto-Submitted':_0xd1ff('0x35'),'X-Auto-Response-Suppress':_0xd1ff('0x36'),'Precedence':_0xd1ff('0x37')};return mailRpc[_0xd1ff('0x38')](this['account'][_0xd1ff('0x39')],_0x2171f6)[_0xd1ff('0x3a')](function(_0x91bbb6){logger[_0xd1ff('0x10')](_0xd1ff('0x3b'),_0x313af1);_0x2171f6['messageId']=_0x91bbb6[_0xd1ff('0x20')][_0xd1ff('0x2e')];return rpc[_0x13a70d+'Message'][_0xd1ff('0x3c')](_0x2171f6);})[_0xd1ff('0x3a')](function(_0x25238b){logger[_0xd1ff('0x10')](_0xd1ff('0x11'),_0x313af1,JSON['stringify'](_0x25238b));})[_0xd1ff('0x3d')](function(_0x1f4506){logger[_0xd1ff('0x3e')](_0xd1ff('0x3f'),_0x313af1,JSON[_0xd1ff('0x40')](_0x1f4506));})[_0xd1ff('0x41')](function(){Promise[_0xd1ff('0x42')]()[_0xd1ff('0x3a')](function(){if(_0xb43993[0x0]!=='2'||_0xb48533['autoreplyExecuted'])return;return rpc[_0x13a70d+_0xd1ff('0x43')]['update'](_0xb48533['id'],{'autoreplyExecuted':!![]})[_0xd1ff('0x3a')](function(_0x10efd3){logger[_0xd1ff('0x10')](_0xd1ff('0x17'),_0x313af1,JSON[_0xd1ff('0x40')](_0x10efd3));})[_0xd1ff('0x3d')](function(_0x53d9d3){logger[_0xd1ff('0x3e')](_0xd1ff('0x44'),_0x313af1,JSON[_0xd1ff('0x40')](_0x53d9d3));});})[_0xd1ff('0x3a')](function(){_0x434776[_0xd1ff('0x45')]();});});}else{return rpc[this[_0xd1ff('0x1d')]+_0xd1ff('0x2c')][_0xd1ff('0x3c')](_0x2171f6)[_0xd1ff('0x3a')](function(){logger['info']('[%s][AUTOREPLY]\x20%s',_0x313af1,_0x2171f6['body']);})['catch'](function(_0x333d56){logger[_0xd1ff('0x3e')](_0xd1ff('0x11'),_0x313af1,JSON['stringify'](_0x333d56));})[_0xd1ff('0x41')](function(){Promise[_0xd1ff('0x42')]()[_0xd1ff('0x3a')](function(){if(_0xb43993[0x0]!=='2'||_0xb48533['autoreplyExecuted'])return;return rpc[_0x13a70d+_0xd1ff('0x43')]['update'](_0xb48533['id'],{'autoreplyExecuted':!![]})[_0xd1ff('0x3a')](function(_0x24cf49){logger['info'](_0xd1ff('0x17'),_0x313af1,JSON[_0xd1ff('0x40')](_0x24cf49));})[_0xd1ff('0x3d')](function(_0x2617c2){logger[_0xd1ff('0x3e')](_0xd1ff('0x44'),_0x313af1,JSON['stringify'](_0x2617c2));});})['then'](function(){_0x434776[_0xd1ff('0x45')]();});});}}}catch(_0x480023){logger[_0xd1ff('0x3e')](_0xd1ff('0x11'),_0x313af1,JSON[_0xd1ff('0x40')](_0x480023));_0x434776[_0xd1ff('0x46')]();}};}; \ 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 a2b8862..426f74e 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 _0x2773=['../../rpc/mailInteraction','info','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/smsInteraction'];(function(_0x40f355,_0x27fac0){var _0x1ebb62=function(_0x5e94f4){while(--_0x5e94f4){_0x40f355['push'](_0x40f355['shift']());}};_0x1ebb62(++_0x27fac0);}(_0x2773,0x11d));var _0x3277=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2773[_0x59ee6f];return _0x4c0979;};'use strict';var moment=require(_0x3277('0x0'));var logger=require(_0x3277('0x1'))('routing');var rpc={'chatInteraction':require(_0x3277('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x3277('0x3')),'mailInteraction':require(_0x3277('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x1fb701,_0x221444,_0x406050,_0x969469){return function(_0x5592da){try{logger[_0x3277('0x5')]('[%s][CLOSE]\x20reason\x20%s',_0x1fb701,_0x221444[0x0]);var _0x172c38={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x3277('0x6'),'disposition':_0x221444[0x0]};if(rpc[_0x969469[_0x3277('0x7')]+_0x3277('0x8')]){rpc[_0x969469[_0x3277('0x7')]+_0x3277('0x8')][_0x3277('0x9')](_0x969469['interaction']['id'],_0x172c38)[_0x3277('0xa')](function(_0x40fb32){logger[_0x3277('0x5')](_0x3277('0xb'),_0x1fb701,_0x969469['interaction']['id']);})['catch'](function(_0x384a0a){logger[_0x3277('0xc')](_0x3277('0xd'),_0x1fb701,JSON[_0x3277('0xe')](_0x384a0a));})[_0x3277('0xf')](function(){_0x5592da[_0x3277('0x10')]();});}}catch(_0x54e1ee){logger['error'](_0x3277('0xd'),_0x1fb701,JSON[_0x3277('0xe')](_0x54e1ee));_0x5592da[_0x3277('0x10')]();}};}; \ No newline at end of file +var _0xbe17=['stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xbe17,0x166));var _0x7be1=function(_0x5d3eba,_0x480c66){_0x5d3eba=_0x5d3eba-0x0;var _0x31a7bd=_0xbe17[_0x5d3eba];return _0x31a7bd;};'use strict';var moment=require(_0x7be1('0x0'));var logger=require(_0x7be1('0x1'))('routing');var rpc={'chatInteraction':require(_0x7be1('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7be1('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x7be1('0x4'))};exports[_0x7be1('0x5')]=function(_0x300249,_0x244b67,_0x36b01d,_0x311913){return function(_0x4fbb3b){try{logger[_0x7be1('0x6')](_0x7be1('0x7'),_0x300249,_0x244b67[0x0]);var _0x4a1107={'closed':0x1,'closedAt':moment()['format'](_0x7be1('0x8')),'closeReason':_0x7be1('0x9'),'disposition':_0x244b67[0x0]};if(rpc[_0x311913[_0x7be1('0xa')]+_0x7be1('0xb')]){rpc[_0x311913[_0x7be1('0xa')]+_0x7be1('0xb')][_0x7be1('0xc')](_0x311913[_0x7be1('0xd')]['id'],_0x4a1107)[_0x7be1('0xe')](function(_0x117e92){logger['info'](_0x7be1('0xf'),_0x300249,_0x311913[_0x7be1('0xd')]['id']);})[_0x7be1('0x10')](function(_0x408e6d){logger[_0x7be1('0x11')](_0x7be1('0x12'),_0x300249,JSON[_0x7be1('0x13')](_0x408e6d));})['finally'](function(){_0x4fbb3b[_0x7be1('0x14')]();});}}catch(_0x3bd8ea){logger[_0x7be1('0x11')]('[%s][CLOSE]\x20%s',_0x300249,JSON[_0x7be1('0x13')](_0x3bd8ea));_0x4fbb3b[_0x7be1('0x14')]();}};}; \ 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 600ecef..0d131e4 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 _0x5a5a=['speech','providerResponse','metadata','endConversation','error','stringify','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','dialogflow','result'];(function(_0x45b420,_0x29394a){var _0x4ab9=function(_0x46e0d5){while(--_0x46e0d5){_0x45b420['push'](_0x45b420['shift']());}};_0x4ab9(++_0x29394a);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x181b84,_0x42f8f1){_0x181b84=_0x181b84-0x0;var _0x3f773d=_0x5a5a[_0x181b84];return _0x3f773d;};'use strict';var _=require('lodash');var moment=require(_0xa5a5('0x0'));var apiai=require(_0xa5a5('0x1'));var md5=require(_0xa5a5('0x2'));var utils=require(_0xa5a5('0x3'));var logger=require(_0xa5a5('0x4'))('routing');var rpc={'chatMessage':require(_0xa5a5('0x5')),'openchannelMessage':require(_0xa5a5('0x6')),'mailMessage':require(_0xa5a5('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa5a5('0x8'))};exports[_0xa5a5('0x9')]=function(_0x5691f1,_0x3ea00f){return function(_0xf2ea20){try{if(!_[_0xa5a5('0xa')](this[_0xa5a5('0xb')][_0xa5a5('0xc')])){logger['info'](_0xa5a5('0xd'),_0x5691f1,_0xa5a5('0xe'));return _0xf2ea20[_0xa5a5('0xf')]();}var _0x2dace1={'ContactId':this[_0xa5a5('0x10')]['id'],'sentAt':moment()[_0xa5a5('0x11')](_0xa5a5('0x12')),'direction':_0xa5a5('0x13')};if(this[_0xa5a5('0x14')]===_0xa5a5('0x15')||this[_0xa5a5('0x14')]===_0xa5a5('0x16')){_0x2dace1['phone']=this[_0xa5a5('0xb')][_0xa5a5('0x17')];}var _0x3917b1=this[_0xa5a5('0x14')];if(_0x3917b1===_0xa5a5('0x18')){_0x2dace1[_0xa5a5('0x19')]=this['account']['id'];}else{_0x2dace1[_[_0xa5a5('0x1a')](_0x3917b1)+_0xa5a5('0x1b')]=this[_0xa5a5('0x1c')]['id'];}_0x2dace1[_[_0xa5a5('0x1a')](_0x3917b1)+_0xa5a5('0x1d')]=this[_0xa5a5('0xb')]['id'];if(this[_0xa5a5('0xb')][_0xa5a5('0x1e')]){var _0x48d369=_0x3ea00f[0x2];if(!_[_0xa5a5('0x1f')](_0x48d369)){_0x2dace1[_0xa5a5('0x20')]=utils[_0xa5a5('0x21')](_0x48d369,this);return rpc[_0x3917b1+_0xa5a5('0x22')][_0xa5a5('0x23')](_0x2dace1)[_0xa5a5('0x24')](function(_0x28c89f){logger['info'](_0xa5a5('0xd'),_0x5691f1,_0x2dace1[_0xa5a5('0x20')]);})[_0xa5a5('0x25')](function(_0x3776cb){logger['error'](_0xa5a5('0xd'),_0x5691f1,JSON['stringify'](_0x3776cb));})[_0xa5a5('0x26')](function(){logger[_0xa5a5('0x27')](_0xa5a5('0x28'),_0x5691f1);_0xf2ea20[_0xa5a5('0x29')]();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5691f1);_0xf2ea20[_0xa5a5('0x29')]();}}else{var _0x1a258f=this;var _0x417df3=apiai(_0x3ea00f[0x0],{'language':_0x3ea00f[0x1]||'en'});return _0x417df3['textRequest'](this[_0xa5a5('0x2a')]['body'],{'sessionId':md5(this[_0xa5a5('0xb')]['id'])})['then'](function(_0x4c0ff2){_0x1a258f[_0xa5a5('0x20')][_0xa5a5('0x2b')]=_0x4c0ff2;_0x2dace1[_0xa5a5('0x20')]=_0x4c0ff2[_0xa5a5('0x2c')]['fulfillment'][_0xa5a5('0x2d')];_0x2dace1['providerName']=_0xa5a5('0x2b');_0x2dace1[_0xa5a5('0x2e')]=JSON['stringify'](_0x4c0ff2);return rpc[_0x3917b1+'Message'][_0xa5a5('0x23')](_0x2dace1)[_0xa5a5('0x24')](function(_0x47992c){logger['info'](_0xa5a5('0xd'),_0x5691f1,_0x2dace1[_0xa5a5('0x20')]);if(_0x4c0ff2[_0xa5a5('0x2c')][_0xa5a5('0x2f')][_0xa5a5('0x30')]){_0xf2ea20[_0xa5a5('0xf')]();}else{_0xf2ea20['stop']();}})[_0xa5a5('0x25')](function(_0x4d1eef){logger[_0xa5a5('0x31')]('[%s][DIALOGFLOW]\x20%s',_0x5691f1,JSON[_0xa5a5('0x32')](_0x4d1eef));_0xf2ea20[_0xa5a5('0xf')]();});})['catch'](function(_0x47ed1d){logger['error'](_0xa5a5('0xd'),_0x5691f1,_0x47ed1d['message']);_0xf2ea20[_0xa5a5('0xf')]();});}}catch(_0x378dda){logger['error'](_0xa5a5('0xd'),_0x5691f1,JSON[_0xa5a5('0x32')](_0x378dda));_0xf2ea20['stop']();}};}; \ No newline at end of file +var _0x2f4a=['./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','next','contact','format','out','sms','channel','phone','ChatWebsiteId','account','upperFirst','AccountId','isEmpty','body','getMustacheRender','info','[%s][DIALOGFLOW]\x20%s','catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','then','dialogflow','result','speech','providerName','providerResponse','Message','create','metadata','endConversation','error','message','lodash','moment','apiai-promise','md5'];(function(_0xff456d,_0x16c7cb){var _0x38e493=function(_0x147450){while(--_0x147450){_0xff456d['push'](_0xff456d['shift']());}};_0x38e493(++_0x16c7cb);}(_0x2f4a,0x8f));var _0xa2f4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2f4a[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xa2f4('0x0'));var moment=require(_0xa2f4('0x1'));var apiai=require(_0xa2f4('0x2'));var md5=require(_0xa2f4('0x3'));var utils=require(_0xa2f4('0x4'));var logger=require(_0xa2f4('0x5'))(_0xa2f4('0x6'));var rpc={'chatMessage':require(_0xa2f4('0x7')),'openchannelMessage':require(_0xa2f4('0x8')),'mailMessage':require(_0xa2f4('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xa2f4('0xa')),'whatsappMessage':require(_0xa2f4('0xb'))};exports[_0xa2f4('0xc')]=function(_0x151045,_0x2cd086){return function(_0x194ee8){try{if(!_['isNil'](this[_0xa2f4('0xd')]['UserId'])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x151045,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x194ee8[_0xa2f4('0xe')]();}var _0x1a8c24={'ContactId':this[_0xa2f4('0xf')]['id'],'sentAt':moment()[_0xa2f4('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa2f4('0x11')};if(this['channel']===_0xa2f4('0x12')||this[_0xa2f4('0x13')]==='whatsapp'){_0x1a8c24[_0xa2f4('0x14')]=this['interaction'][_0xa2f4('0x14')];}var _0x485447=this[_0xa2f4('0x13')];if(_0x485447==='chat'){_0x1a8c24[_0xa2f4('0x15')]=this[_0xa2f4('0x16')]['id'];}else{_0x1a8c24[_[_0xa2f4('0x17')](_0x485447)+_0xa2f4('0x18')]=this[_0xa2f4('0x16')]['id'];}_0x1a8c24[_[_0xa2f4('0x17')](_0x485447)+'InteractionId']=this[_0xa2f4('0xd')]['id'];if(this[_0xa2f4('0xd')]['created']){var _0x4ae792=_0x2cd086[0x2];if(!_[_0xa2f4('0x19')](_0x4ae792)){_0x1a8c24[_0xa2f4('0x1a')]=utils[_0xa2f4('0x1b')](_0x4ae792,this);return rpc[_0x485447+'Message']['create'](_0x1a8c24)['then'](function(_0x5a0aa3){logger[_0xa2f4('0x1c')](_0xa2f4('0x1d'),_0x151045,_0x1a8c24['body']);})[_0xa2f4('0x1e')](function(_0x426013){logger['error'](_0xa2f4('0x1d'),_0x151045,JSON[_0xa2f4('0x1f')](_0x426013));})[_0xa2f4('0x20')](function(){logger[_0xa2f4('0x1c')](_0xa2f4('0x21'),_0x151045);_0x194ee8[_0xa2f4('0x22')]();});}else{logger[_0xa2f4('0x1c')](_0xa2f4('0x23'),_0x151045);_0x194ee8[_0xa2f4('0x22')]();}}else{var _0x21dce2=this;var _0x47c203=apiai(_0x2cd086[0x0],{'language':_0x2cd086[0x1]||'en'});return _0x47c203[_0xa2f4('0x24')](this['message'][_0xa2f4('0x1a')],{'sessionId':md5(this['interaction']['id'])})[_0xa2f4('0x25')](function(_0x235cae){_0x21dce2[_0xa2f4('0x1a')][_0xa2f4('0x26')]=_0x235cae;_0x1a8c24['body']=_0x235cae[_0xa2f4('0x27')]['fulfillment'][_0xa2f4('0x28')];_0x1a8c24[_0xa2f4('0x29')]='dialogflow';_0x1a8c24[_0xa2f4('0x2a')]=JSON[_0xa2f4('0x1f')](_0x235cae);return rpc[_0x485447+_0xa2f4('0x2b')][_0xa2f4('0x2c')](_0x1a8c24)[_0xa2f4('0x25')](function(_0x49824c){logger[_0xa2f4('0x1c')](_0xa2f4('0x1d'),_0x151045,_0x1a8c24[_0xa2f4('0x1a')]);if(_0x235cae[_0xa2f4('0x27')][_0xa2f4('0x2d')][_0xa2f4('0x2e')]){_0x194ee8[_0xa2f4('0xe')]();}else{_0x194ee8[_0xa2f4('0x22')]();}})[_0xa2f4('0x1e')](function(_0x3650fc){logger[_0xa2f4('0x2f')](_0xa2f4('0x1d'),_0x151045,JSON[_0xa2f4('0x1f')](_0x3650fc));_0x194ee8['next']();});})[_0xa2f4('0x1e')](function(_0x4bfd92){logger[_0xa2f4('0x2f')](_0xa2f4('0x1d'),_0x151045,_0x4bfd92[_0xa2f4('0x30')]);_0x194ee8[_0xa2f4('0xe')]();});}}catch(_0x383f9d){logger[_0xa2f4('0x2f')](_0xa2f4('0x1d'),_0x151045,JSON['stringify'](_0x383f9d));_0x194ee8[_0xa2f4('0x22')]();}};}; \ 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 5b19714..bc4e778 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 _0xd363=['Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','boolValue','DIALOGFLOWV2_INTENTNAME','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','all','next','message','stack','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','body'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xd363,0x112));var _0x3d36=function(_0x41f882,_0x360760){_0x41f882=_0x41f882-0x0;var _0x402761=_0xd363[_0x41f882];return _0x402761;};'use strict';var _=require(_0x3d36('0x0'));var dialogflow=require(_0x3d36('0x1'));var md5=require(_0x3d36('0x2'));var moment=require(_0x3d36('0x3'));var Promise=require(_0x3d36('0x4'));var logger=require(_0x3d36('0x5'))(_0x3d36('0x6'));var utils=require(_0x3d36('0x7'));var rpc={'chatMessage':require(_0x3d36('0x8')),'openchannelMessage':require(_0x3d36('0x9')),'mailMessage':require(_0x3d36('0xa')),'smsMessage':require(_0x3d36('0xb')),'faxMessage':require(_0x3d36('0xc')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x14a025,_0x4002a4,_0x2a1476,_0x48134f){return new Promise(function(_0x3fa1ae,_0xe73452){var _0x25dcff=_['clone'](_0x2a1476);_0x25dcff[_0x3d36('0xd')]=_0x48134f;return rpc[_0x4002a4+_0x3d36('0xe')][_0x3d36('0xf')](_0x25dcff)[_0x3d36('0x10')](function(){logger[_0x3d36('0x11')](_0x3d36('0x12'),_0x14a025,_0x25dcff[_0x3d36('0xd')]);_0x3fa1ae();})[_0x3d36('0x13')](function(_0x218314){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x14a025,JSON[_0x3d36('0x14')](_0x218314));_0xe73452(_0x218314);});});}exports[_0x3d36('0x15')]=function(_0x3df1cb,_0x10e0f2){return function(_0xdbde9b){try{if(!_['isNil'](this[_0x3d36('0x16')]['UserId'])){logger['info'](_0x3d36('0x12'),_0x3df1cb,_0x3d36('0x17'));return _0xdbde9b['next']();}var _0x5a8143={'ContactId':this['contact']['id'],'sentAt':moment()[_0x3d36('0x18')](_0x3d36('0x19')),'direction':_0x3d36('0x1a')};if(this[_0x3d36('0x1b')]===_0x3d36('0x1c')||this[_0x3d36('0x1b')]==='whatsapp'){_0x5a8143[_0x3d36('0x1d')]=this[_0x3d36('0x16')]['phone'];}var _0x4ff331=this['channel'];if(_0x4ff331===_0x3d36('0x1e')){_0x5a8143[_0x3d36('0x1f')]=this[_0x3d36('0x20')]['id'];}else{_0x5a8143[_[_0x3d36('0x21')](_0x4ff331)+_0x3d36('0x22')]=this[_0x3d36('0x20')]['id'];}_0x5a8143[_['upperFirst'](_0x4ff331)+_0x3d36('0x23')]=this[_0x3d36('0x16')]['id'];if(this[_0x3d36('0x16')]['created']){var _0x32dec5=_0x10e0f2[0x4];if(!_[_0x3d36('0x24')](_0x32dec5)){_0x5a8143[_0x3d36('0xd')]=utils[_0x3d36('0x25')](_0x32dec5,this);return rpc[_0x4ff331+_0x3d36('0xe')][_0x3d36('0xf')](_0x5a8143)['then'](function(_0x210234){logger[_0x3d36('0x11')](_0x3d36('0x12'),_0x3df1cb,_0x5a8143[_0x3d36('0xd')]);})[_0x3d36('0x13')](function(_0x10eda5){logger[_0x3d36('0x26')](_0x3d36('0x12'),_0x3df1cb,JSON['stringify'](_0x10eda5));})[_0x3d36('0x27')](function(){logger['info'](_0x3d36('0x28'),_0x3df1cb);_0xdbde9b[_0x3d36('0x29')]();});}else{logger[_0x3d36('0x11')](_0x3d36('0x2a'),_0x3df1cb);_0xdbde9b[_0x3d36('0x29')]();}}else{var _0x54f313=this;var _0x1dffbe=_0x10e0f2[0x2][_0x3d36('0x2b')](/\\n/g,'\x0a');var _0x7a38d={'credentials':{'private_key':_0x1dffbe,'client_email':_0x10e0f2[0x1]}};var _0x2edba4=new dialogflow['SessionsClient'](_0x7a38d);var _0x45860c=_0x2edba4[_0x3d36('0x2c')](_0x10e0f2[0x0],md5(_0x54f313[_0x3d36('0x16')]['id']));var _0x5757e6={'session':_0x45860c,'queryInput':{'text':{'text':_0x54f313['message'][_0x3d36('0xd')],'languageCode':_0x10e0f2[0x3]||'en'}}};return _0x2edba4[_0x3d36('0x2d')](_0x5757e6)['then'](function(_0x1e89bf){if(_0x1e89bf&&_0x1e89bf['length']){_0x54f313[_0x3d36('0xd')][_0x3d36('0x2e')]=_0x1e89bf;var _0x2e604d=_0x1e89bf[0x0];var _0x1756f8=_0x2e604d[_0x3d36('0x2f')][_0x3d36('0x30')]&&_0x2e604d[_0x3d36('0x2f')][_0x3d36('0x30')][_0x3d36('0x31')]?_0x2e604d[_0x3d36('0x2f')][_0x3d36('0x30')][_0x3d36('0x31')]['end_conversation']['boolValue']:![];_0x54f313[_0x3d36('0xd')][_0x3d36('0x32')]=_0x2e604d['queryResult'][_0x3d36('0x33')];_0x54f313[_0x3d36('0xd')][_0x3d36('0x34')]=_0x2e604d[_0x3d36('0x2f')]['allRequiredParamsPresent'];_0x54f313['body'][_0x3d36('0x35')]=_0x2e604d[_0x3d36('0x2f')][_0x3d36('0x30')]&&_0x2e604d[_0x3d36('0x2f')][_0x3d36('0x30')][_0x3d36('0x31')]?_0x2e604d[_0x3d36('0x2f')][_0x3d36('0x30')][_0x3d36('0x31')][_0x3d36('0x36')][_0x3d36('0x37')]:![];_0x54f313[_0x3d36('0xd')][_0x3d36('0x38')]=_0x2e604d[_0x3d36('0x2f')]['intent']['name'];_0x54f313[_0x3d36('0xd')][_0x3d36('0x39')]=_0x2e604d[_0x3d36('0x2f')][_0x3d36('0x3a')]['displayName'];_0x54f313[_0x3d36('0xd')][_0x3d36('0x3b')]=_0x2e604d[_0x3d36('0x2f')][_0x3d36('0x3a')][_0x3d36('0x3c')];_0x54f313[_0x3d36('0xd')][_0x3d36('0x3d')]=_0x2e604d[_0x3d36('0x2f')][_0x3d36('0x3e')];_0x54f313[_0x3d36('0xd')]['DIALOGFLOWV2_QUERYTEXT']=_0x2e604d[_0x3d36('0x2f')][_0x3d36('0x3f')];_0x54f313[_0x3d36('0xd')][_0x3d36('0x40')]=_0x2e604d[_0x3d36('0x2f')][_0x3d36('0x41')];_0x5a8143['providerName']=_0x3d36('0x2e');_0x5a8143[_0x3d36('0x42')]=JSON['stringify'](_0x1e89bf);var _0x2f6dbc=[];for(var _0x27664a=0x0;_0x27664a<_0x1e89bf['length'];_0x27664a++){var _0x8ed455=_0x1e89bf[_0x27664a];if(_0x8ed455&&_0x8ed455[_0x3d36('0x2f')]&&_0x8ed455[_0x3d36('0x2f')]['fulfillmentText']){_0x2f6dbc['push'](createMessage(_0x3df1cb,_0x4ff331,_0x5a8143,_0x8ed455[_0x3d36('0x2f')][_0x3d36('0x43')]));}}return Promise[_0x3d36('0x44')](_0x2f6dbc)[_0x3d36('0x10')](function(){if(_0x1756f8){_0xdbde9b['next']();}else{_0xdbde9b['stop']();}})['catch'](function(_0x66f4b2){logger[_0x3d36('0x26')](_0x3d36('0x12'),_0x3df1cb,JSON[_0x3d36('0x14')](_0x66f4b2));_0xdbde9b[_0x3d36('0x45')]();});}})[_0x3d36('0x13')](function(_0xc4a12f){logger[_0x3d36('0x26')](_0x3d36('0x12'),_0x3df1cb,_0xc4a12f[_0x3d36('0x46')],_0xc4a12f[_0x3d36('0x47')]);_0xdbde9b['next']();});}}catch(_0x5c086b){logger[_0x3d36('0x26')]('[%s][DIALOGFLOWV2]\x20%s',_0x3df1cb,JSON[_0x3d36('0x14')](_0x5c086b));_0xdbde9b[_0x3d36('0x29')]();}};}; \ No newline at end of file +var _0x180c=['../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','phone','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','getMustacheRender','catch','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','queryText','intentDetectionConfidence','providerResponse','fulfillmentText','push','all','dialogflow','md5','moment','bluebird'];(function(_0x15656d,_0x3402b8){var _0x12646c=function(_0x1208e2){while(--_0x1208e2){_0x15656d['push'](_0x15656d['shift']());}};_0x12646c(++_0x3402b8);}(_0x180c,0x1b8));var _0xc180=function(_0x4b403b,_0x37a67a){_0x4b403b=_0x4b403b-0x0;var _0x143987=_0x180c[_0x4b403b];return _0x143987;};'use strict';var _=require('lodash');var dialogflow=require(_0xc180('0x0'));var md5=require(_0xc180('0x1'));var moment=require(_0xc180('0x2'));var Promise=require(_0xc180('0x3'));var logger=require(_0xc180('0x4'))(_0xc180('0x5'));var utils=require(_0xc180('0x6'));var rpc={'chatMessage':require(_0xc180('0x7')),'openchannelMessage':require(_0xc180('0x8')),'mailMessage':require(_0xc180('0x9')),'smsMessage':require(_0xc180('0xa')),'faxMessage':require(_0xc180('0xb')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x2e823b,_0x448adf,_0xe56433,_0x124b0b){return new Promise(function(_0x2727b6,_0x512613){var _0x34b933=_['clone'](_0xe56433);_0x34b933['body']=_0x124b0b;return rpc[_0x448adf+_0xc180('0xc')][_0xc180('0xd')](_0x34b933)[_0xc180('0xe')](function(){logger[_0xc180('0xf')](_0xc180('0x10'),_0x2e823b,_0x34b933[_0xc180('0x11')]);_0x2727b6();})['catch'](function(_0x273bb2){logger['error'](_0xc180('0x10'),_0x2e823b,JSON[_0xc180('0x12')](_0x273bb2));_0x512613(_0x273bb2);});});}exports[_0xc180('0x13')]=function(_0x86b69f,_0x5e978d){return function(_0x36ebb3){try{if(!_[_0xc180('0x14')](this[_0xc180('0x15')][_0xc180('0x16')])){logger[_0xc180('0xf')](_0xc180('0x10'),_0x86b69f,_0xc180('0x17'));return _0x36ebb3[_0xc180('0x18')]();}var _0x19f61b={'ContactId':this[_0xc180('0x19')]['id'],'sentAt':moment()[_0xc180('0x1a')](_0xc180('0x1b')),'direction':'out'};if(this['channel']===_0xc180('0x1c')||this[_0xc180('0x1d')]==='whatsapp'){_0x19f61b['phone']=this[_0xc180('0x15')][_0xc180('0x1e')];}var _0x38148c=this[_0xc180('0x1d')];if(_0x38148c==='chat'){_0x19f61b[_0xc180('0x1f')]=this['account']['id'];}else{_0x19f61b[_[_0xc180('0x20')](_0x38148c)+_0xc180('0x21')]=this[_0xc180('0x22')]['id'];}_0x19f61b[_[_0xc180('0x20')](_0x38148c)+_0xc180('0x23')]=this[_0xc180('0x15')]['id'];if(this[_0xc180('0x15')][_0xc180('0x24')]){var _0x57361e=_0x5e978d[0x4];if(!_[_0xc180('0x25')](_0x57361e)){_0x19f61b[_0xc180('0x11')]=utils[_0xc180('0x26')](_0x57361e,this);return rpc[_0x38148c+_0xc180('0xc')][_0xc180('0xd')](_0x19f61b)['then'](function(_0x20a947){logger['info'](_0xc180('0x10'),_0x86b69f,_0x19f61b[_0xc180('0x11')]);})[_0xc180('0x27')](function(_0x559812){logger[_0xc180('0x28')](_0xc180('0x10'),_0x86b69f,JSON['stringify'](_0x559812));})[_0xc180('0x29')](function(){logger[_0xc180('0xf')](_0xc180('0x2a'),_0x86b69f);_0x36ebb3[_0xc180('0x2b')]();});}else{logger[_0xc180('0xf')](_0xc180('0x2c'),_0x86b69f);_0x36ebb3[_0xc180('0x2b')]();}}else{var _0x4a7c0d=this;var _0x4ad902=_0x5e978d[0x2]['replace'](/\\n/g,'\x0a');var _0x39edcf={'credentials':{'private_key':_0x4ad902,'client_email':_0x5e978d[0x1]}};var _0x6fffdf=new dialogflow[(_0xc180('0x2d'))](_0x39edcf);var _0x390a07=_0x6fffdf[_0xc180('0x2e')](_0x5e978d[0x0],md5(_0x4a7c0d[_0xc180('0x15')]['id']));var _0x5c3e85={'session':_0x390a07,'queryInput':{'text':{'text':_0x4a7c0d[_0xc180('0x2f')][_0xc180('0x11')],'languageCode':_0x5e978d[0x3]||'en'}}};return _0x6fffdf[_0xc180('0x30')](_0x5c3e85)[_0xc180('0xe')](function(_0xb61d95){if(_0xb61d95&&_0xb61d95[_0xc180('0x31')]){_0x4a7c0d['body'][_0xc180('0x32')]=_0xb61d95;var _0x27b67f=_0xb61d95[0x0];var _0xbd835=_0x27b67f[_0xc180('0x33')][_0xc180('0x34')]&&_0x27b67f[_0xc180('0x33')][_0xc180('0x34')][_0xc180('0x35')]?_0x27b67f[_0xc180('0x33')]['diagnosticInfo']['fields'][_0xc180('0x36')]['boolValue']:![];_0x4a7c0d[_0xc180('0x11')][_0xc180('0x37')]=_0x27b67f['queryResult'][_0xc180('0x38')];_0x4a7c0d['body'][_0xc180('0x39')]=_0x27b67f[_0xc180('0x33')][_0xc180('0x3a')];_0x4a7c0d[_0xc180('0x11')][_0xc180('0x3b')]=_0x27b67f[_0xc180('0x33')][_0xc180('0x34')]&&_0x27b67f[_0xc180('0x33')][_0xc180('0x34')][_0xc180('0x35')]?_0x27b67f[_0xc180('0x33')][_0xc180('0x34')][_0xc180('0x35')][_0xc180('0x36')][_0xc180('0x3c')]:![];_0x4a7c0d['body'][_0xc180('0x3d')]=_0x27b67f[_0xc180('0x33')][_0xc180('0x3e')][_0xc180('0x3f')];_0x4a7c0d[_0xc180('0x11')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x27b67f[_0xc180('0x33')][_0xc180('0x3e')][_0xc180('0x40')];_0x4a7c0d['body'][_0xc180('0x41')]=_0x27b67f['queryResult'][_0xc180('0x3e')][_0xc180('0x42')];_0x4a7c0d['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x27b67f[_0xc180('0x33')][_0xc180('0x43')];_0x4a7c0d[_0xc180('0x11')]['DIALOGFLOWV2_QUERYTEXT']=_0x27b67f[_0xc180('0x33')][_0xc180('0x44')];_0x4a7c0d['body']['DIALOGFLOWV2_SCORE']=_0x27b67f[_0xc180('0x33')][_0xc180('0x45')];_0x19f61b['providerName']=_0xc180('0x32');_0x19f61b[_0xc180('0x46')]=JSON[_0xc180('0x12')](_0xb61d95);var _0x3b59f3=[];for(var _0xc185b9=0x0;_0xc185b9<_0xb61d95[_0xc180('0x31')];_0xc185b9++){var _0x860da2=_0xb61d95[_0xc185b9];if(_0x860da2&&_0x860da2[_0xc180('0x33')]&&_0x860da2[_0xc180('0x33')][_0xc180('0x47')]){_0x3b59f3[_0xc180('0x48')](createMessage(_0x86b69f,_0x38148c,_0x19f61b,_0x860da2[_0xc180('0x33')][_0xc180('0x47')]));}}return Promise[_0xc180('0x49')](_0x3b59f3)[_0xc180('0xe')](function(){if(_0xbd835){_0x36ebb3[_0xc180('0x18')]();}else{_0x36ebb3['stop']();}})[_0xc180('0x27')](function(_0x426fe1){logger[_0xc180('0x28')](_0xc180('0x10'),_0x86b69f,JSON[_0xc180('0x12')](_0x426fe1));_0x36ebb3['next']();});}})['catch'](function(_0x383ea4){logger[_0xc180('0x28')](_0xc180('0x10'),_0x86b69f,_0x383ea4[_0xc180('0x2f')],_0x383ea4['stack']);_0x36ebb3['next']();});}}catch(_0x1e846e){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x86b69f,JSON[_0xc180('0x12')](_0x1e846e));_0x36ebb3[_0xc180('0x2b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 867d48a..d93452c 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 _0x60e7=['[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','info','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','../../../../config/logger','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex'];(function(_0x561771,_0x554760){var _0x54d16e=function(_0x381c1f){while(--_0x381c1f){_0x561771['push'](_0x561771['shift']());}};_0x54d16e(++_0x554760);}(_0x60e7,0xff));var _0x760e=function(_0x11f2f9,_0x24152b){_0x11f2f9=_0x11f2f9-0x0;var _0x226d6b=_0x60e7[_0x11f2f9];return _0x226d6b;};'use strict';var schema=require(_0x760e('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0x760e('0x1'))('routing');var gotoif=schema({'condition':{'type':_0x760e('0x2'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x760e('0x3'),'message':_0x760e('0x4')},'priorityFalse':{'type':_0x760e('0x3'),'message':_0x760e('0x5')}});exports[_0x760e('0x6')]=function(_0x532ad2,_0x3f8d3a){return function(_0x3510dc){try{var _0x4f8332={'condition':htmlToText['fromString'](utils[_0x760e('0x7')](_0x3f8d3a[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3f8d3a[0x1],'priorityFalse':_0x3f8d3a[0x2]};var _0x16d9ac=gotoif[_0x760e('0x0')](_0x4f8332,{'typecast':!![]});if(_0x16d9ac[_0x760e('0x8')]){logger[_0x760e('0x9')](_0x760e('0xa'),_0x532ad2,_[_0x760e('0xb')](_0x16d9ac,_0x760e('0xc'))[_0x760e('0xd')](',\x20'));_0x3510dc['stop']();}else{try{var _0x414d51=eval('('+_0x4f8332[_0x760e('0xe')]+')');var _0x31638c=_0x414d51?_0x4f8332[_0x760e('0xf')]:_0x4f8332[_0x760e('0x10')];logger['info'](_0x760e('0x11'),_0x532ad2,_0x4f8332[_0x760e('0xe')],_0x414d51,_0x31638c||_0x760e('0x12'));if(_0x31638c){var _0x22e60e=_[_0x760e('0x13')](_0x3510dc['rules'](),{'p':_0x31638c});if(_0x22e60e>=0x0){logger['info'](_0x760e('0x14'),_0x532ad2,_0x31638c||_0x760e('0x12'),_0x22e60e);_0x3510dc[_0x760e('0x12')](_0x22e60e);}else{logger[_0x760e('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x532ad2,_0x31638c||_0x760e('0x12'));_0x3510dc[_0x760e('0x16')]();}}else{_0x3510dc[_0x760e('0x12')]();}}catch(_0x135d27){logger[_0x760e('0x9')](_0x760e('0x17'),_0x532ad2,_0x135d27[_0x760e('0xc')]);_0x3510dc[_0x760e('0x16')]();}}}catch(_0x487f36){logger[_0x760e('0x9')](_0x760e('0xa'),_0x532ad2,JSON[_0x760e('0x18')](_0x487f36));_0x3510dc[_0x760e('0x16')]();}};}; \ No newline at end of file +var _0x49d4=['condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','consequence','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','stringify','lodash','html-to-text','./utils','string'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x49d4,0x10a));var _0x449d=function(_0x477aca,_0x139cb0){_0x477aca=_0x477aca-0x0;var _0x565010=_0x49d4[_0x477aca];return _0x565010;};'use strict';var schema=require('validate');var _=require(_0x449d('0x0'));var htmlToText=require(_0x449d('0x1'));var utils=require(_0x449d('0x2'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0x449d('0x3'),'required':!![],'message':_0x449d('0x4')},'priorityTrue':{'type':'number','message':_0x449d('0x5')},'priorityFalse':{'type':_0x449d('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x449d('0x7')]=function(_0x4615fb,_0x542f94){return function(_0x13573c){try{var _0x1e3255={'condition':htmlToText['fromString'](utils[_0x449d('0x8')](_0x542f94[0x0],this),{'wordwrap':![]})[_0x449d('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x542f94[0x1],'priorityFalse':_0x542f94[0x2]};var _0x2822b9=gotoif['validate'](_0x1e3255,{'typecast':!![]});if(_0x2822b9[_0x449d('0xa')]){logger[_0x449d('0xb')](_0x449d('0xc'),_0x4615fb,_[_0x449d('0xd')](_0x2822b9,_0x449d('0xe'))[_0x449d('0xf')](',\x20'));_0x13573c['stop']();}else{try{var _0x33f8e8=eval('('+_0x1e3255['condition']+')');var _0x30e11f=_0x33f8e8?_0x1e3255[_0x449d('0x10')]:_0x1e3255[_0x449d('0x11')];logger[_0x449d('0x12')](_0x449d('0x13'),_0x4615fb,_0x1e3255[_0x449d('0x14')],_0x33f8e8,_0x30e11f||_0x449d('0x15'));if(_0x30e11f){var _0x59752d=_[_0x449d('0x16')](_0x13573c[_0x449d('0x17')](),{'p':_0x30e11f});if(_0x59752d>=0x0){logger[_0x449d('0x12')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4615fb,_0x30e11f||_0x449d('0x15'),_0x59752d);_0x13573c['next'](_0x59752d);}else{logger[_0x449d('0x12')](_0x449d('0x18'),_0x4615fb,_0x30e11f||_0x449d('0x15'));_0x13573c[_0x449d('0x19')]();}}else{_0x13573c[_0x449d('0x15')]();}}catch(_0x310c17){logger[_0x449d('0xb')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x4615fb,_0x310c17[_0x449d('0xe')]);_0x13573c['stop']();}}}catch(_0x1f0fbc){logger[_0x449d('0xb')](_0x449d('0xc'),_0x4615fb,JSON[_0x449d('0x1a')](_0x1f0fbc));_0x13573c[_0x449d('0x19')]();}};}; \ 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 c3241ee..7253612 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 _0x0c69=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','message','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','error','stringify','validate','lodash','../../../../config/logger','number'];(function(_0x12700c,_0x2c1308){var _0x3aeb74=function(_0x3f3f87){while(--_0x3f3f87){_0x12700c['push'](_0x12700c['shift']());}};_0x3aeb74(++_0x2c1308);}(_0x0c69,0x18b));var _0x90c6=function(_0x511c86,_0x305ee5){_0x511c86=_0x511c86-0x0;var _0xb96d7d=_0x0c69[_0x511c86];return _0xb96d7d;};'use strict';var schema=require(_0x90c6('0x0'));var _=require(_0x90c6('0x1'));var logger=require(_0x90c6('0x2'))('routing');var gotop=schema({'priority':{'type':_0x90c6('0x3'),'required':!![],'message':_0x90c6('0x4')}});exports[_0x90c6('0x5')]=function(_0x121945,_0x1734e3){return function(_0x5bf92a){try{var _0x248734={'priority':_0x1734e3[0x0]};var _0x457b76=gotop['validate'](_0x248734,{'typecast':!![]});if(_0x457b76[_0x90c6('0x6')]){logger['error'](_0x90c6('0x7'),_0x121945,_['map'](_0x457b76,_0x90c6('0x8'))[_0x90c6('0x9')](',\x20'));_0x5bf92a[_0x90c6('0xa')]();}else{logger[_0x90c6('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x121945,_0x248734[_0x90c6('0xc')]);if(_0x248734[_0x90c6('0xc')]){var _0x1806f5=_[_0x90c6('0xd')](_0x5bf92a[_0x90c6('0xe')](),{'p':_0x248734['priority']});if(_0x1806f5>=0x0){logger[_0x90c6('0xb')](_0x90c6('0xf'),_0x121945,_0x248734[_0x90c6('0xc')]||_0x90c6('0x10'),_0x1806f5);_0x5bf92a['next'](_0x1806f5);}else{logger[_0x90c6('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x121945,_0x248734[_0x90c6('0xc')]||_0x90c6('0x10'));_0x5bf92a[_0x90c6('0xa')]();}}else{_0x5bf92a['next']();}}}catch(_0x37a9d1){logger[_0x90c6('0x11')]('[%s][GOTOP]\x20%s',_0x121945,JSON[_0x90c6('0x12')](_0x37a9d1));_0x5bf92a[_0x90c6('0xa')]();}};}; \ No newline at end of file +var _0xddb5=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x112626,_0x2c5b3b){var _0x17bd38=function(_0x5b957d){while(--_0x5b957d){_0x112626['push'](_0x112626['shift']());}};_0x17bd38(++_0x2c5b3b);}(_0xddb5,0x8f));var _0x5ddb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xddb5[_0x502c7d];return _0x30b7ed;};'use strict';var schema=require('validate');var _=require(_0x5ddb('0x0'));var logger=require(_0x5ddb('0x1'))(_0x5ddb('0x2'));var gotop=schema({'priority':{'type':_0x5ddb('0x3'),'required':!![],'message':_0x5ddb('0x4')}});exports[_0x5ddb('0x5')]=function(_0x10b7f1,_0x55a8c7){return function(_0x46c4f7){try{var _0x584fba={'priority':_0x55a8c7[0x0]};var _0x34ffc2=gotop['validate'](_0x584fba,{'typecast':!![]});if(_0x34ffc2[_0x5ddb('0x6')]){logger[_0x5ddb('0x7')](_0x5ddb('0x8'),_0x10b7f1,_[_0x5ddb('0x9')](_0x34ffc2,_0x5ddb('0xa'))['join'](',\x20'));_0x46c4f7[_0x5ddb('0xb')]();}else{logger[_0x5ddb('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x10b7f1,_0x584fba['priority']);if(_0x584fba[_0x5ddb('0xd')]){var _0x257e36=_[_0x5ddb('0xe')](_0x46c4f7[_0x5ddb('0xf')](),{'p':_0x584fba[_0x5ddb('0xd')]});if(_0x257e36>=0x0){logger[_0x5ddb('0xc')](_0x5ddb('0x10'),_0x10b7f1,_0x584fba[_0x5ddb('0xd')]||_0x5ddb('0x11'),_0x257e36);_0x46c4f7[_0x5ddb('0x11')](_0x257e36);}else{logger['info'](_0x5ddb('0x12'),_0x10b7f1,_0x584fba[_0x5ddb('0xd')]||'next');_0x46c4f7[_0x5ddb('0xb')]();}}else{_0x46c4f7[_0x5ddb('0x11')]();}}}catch(_0x5156da){logger[_0x5ddb('0x7')](_0x5ddb('0x8'),_0x10b7f1,JSON[_0x5ddb('0x13')](_0x5156da));_0x46c4f7['stop']();}};}; \ 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 f17d244..55be3ef 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 _0x0fd7=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','then','next','catch','[%s][MESSAGE]\x20%s','stringify','error','stop','lodash','./utils','routing'];(function(_0x15a96c,_0x2c1ef7){var _0x5083e8=function(_0xd4d8bc){while(--_0xd4d8bc){_0x15a96c['push'](_0x15a96c['shift']());}};_0x5083e8(++_0x2c1ef7);}(_0x0fd7,0x9f));var _0x70fd=function(_0x219590,_0x45cab8){_0x219590=_0x219590-0x0;var _0x3d5eda=_0x0fd7[_0x219590];return _0x3d5eda;};'use strict';var _=require(_0x70fd('0x0'));var utils=require(_0x70fd('0x1'));var logger=require('../../../../config/logger')(_0x70fd('0x2'));var rpc={'chatMessage':require(_0x70fd('0x3')),'openchannelMessage':require(_0x70fd('0x4')),'mailMessage':require(_0x70fd('0x5')),'smsMessage':require(_0x70fd('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x70fd('0x7'))};exports[_0x70fd('0x8')]=function(_0x3a0126,_0x59bca1){return function(_0x22e69a){try{var _0x5b8588={'body':utils[_0x70fd('0x9')](_0x59bca1[0x0],this),'ContactId':this[_0x70fd('0xa')]['id']};if(this[_0x70fd('0xb')]===_0x70fd('0xc')){_0x5b8588[_0x70fd('0xd')]=this[_0x70fd('0xe')]['id'];}else{_0x5b8588[_['upperFirst'](this[_0x70fd('0xb')])+_0x70fd('0xf')]=this[_0x70fd('0xe')]['id'];}_0x5b8588[_[_0x70fd('0x10')](this['channel'])+_0x70fd('0x11')]=this[_0x70fd('0x12')]['id'];if(rpc[this[_0x70fd('0xb')]+'Message']){return rpc[this['channel']+_0x70fd('0x13')]['create'](_0x5b8588)[_0x70fd('0x14')](function(_0x2b788a){logger['info']('[%s][MESSAGE]\x20%s',_0x3a0126,_0x5b8588['body']);_0x22e69a[_0x70fd('0x15')]();})[_0x70fd('0x16')](function(_0x50dd0a){logger['error'](_0x70fd('0x17'),_0x3a0126,JSON[_0x70fd('0x18')](_0x50dd0a));_0x22e69a['stop']();});}}catch(_0x35f1d2){logger[_0x70fd('0x19')](_0x70fd('0x17'),_0x3a0126,JSON[_0x70fd('0x18')](_0x35f1d2));_0x22e69a[_0x70fd('0x1a')]();}};}; \ No newline at end of file +var _0x755e=['../../rpc/mailMessage','../../rpc/faxMessage','consequence','contact','chat','account','upperFirst','channel','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x755e,0x96));var _0xe755=function(_0x32c04b,_0x187085){_0x32c04b=_0x32c04b-0x0;var _0x2947b1=_0x755e[_0x32c04b];return _0x2947b1;};'use strict';var _=require(_0xe755('0x0'));var utils=require(_0xe755('0x1'));var logger=require(_0xe755('0x2'))(_0xe755('0x3'));var rpc={'chatMessage':require(_0xe755('0x4')),'openchannelMessage':require(_0xe755('0x5')),'mailMessage':require(_0xe755('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe755('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xe755('0x8')]=function(_0x36eb84,_0xe29839){return function(_0x3b82da){try{var _0x3184c3={'body':utils['getMustacheRender'](_0xe29839[0x0],this),'ContactId':this[_0xe755('0x9')]['id']};if(this['channel']===_0xe755('0xa')){_0x3184c3['ChatWebsiteId']=this[_0xe755('0xb')]['id'];}else{_0x3184c3[_[_0xe755('0xc')](this[_0xe755('0xd')])+_0xe755('0xe')]=this[_0xe755('0xb')]['id'];}_0x3184c3[_[_0xe755('0xc')](this[_0xe755('0xd')])+_0xe755('0xf')]=this[_0xe755('0x10')]['id'];if(rpc[this[_0xe755('0xd')]+_0xe755('0x11')]){return rpc[this[_0xe755('0xd')]+'Message'][_0xe755('0x12')](_0x3184c3)[_0xe755('0x13')](function(_0x48d347){logger[_0xe755('0x14')](_0xe755('0x15'),_0x36eb84,_0x3184c3[_0xe755('0x16')]);_0x3b82da['next']();})[_0xe755('0x17')](function(_0x306ddc){logger['error'](_0xe755('0x15'),_0x36eb84,JSON[_0xe755('0x18')](_0x306ddc));_0x3b82da['stop']();});}}catch(_0x245763){logger['error'](_0xe755('0x15'),_0x36eb84,JSON[_0xe755('0x18')](_0x245763));_0x3b82da[_0xe755('0x19')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 97e6fdd..019addb 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 _0xa103=['consequence','info','[%s][NOOP]\x20%s','./utils','../../../../config/logger','routing'];(function(_0x794f16,_0x37337e){var _0x48cf67=function(_0x3681e3){while(--_0x3681e3){_0x794f16['push'](_0x794f16['shift']());}};_0x48cf67(++_0x37337e);}(_0xa103,0xab));var _0x3a10=function(_0x1f8204,_0x1811cc){_0x1f8204=_0x1f8204-0x0;var _0x424442=_0xa103[_0x1f8204];return _0x424442;};'use strict';var utils=require(_0x3a10('0x0'));var logger=require(_0x3a10('0x1'))(_0x3a10('0x2'));exports[_0x3a10('0x3')]=function(_0x2eedb2,_0x25e657){return function(_0x4a7cbf){try{logger[_0x3a10('0x4')](_0x3a10('0x5'),_0x2eedb2,utils['getMustacheRender'](_0x25e657[0x0],this));_0x4a7cbf['next']();}catch(_0x5c312b){logger['error'](_0x3a10('0x5'),_0x2eedb2,JSON['stringify'](_0x5c312b));_0x4a7cbf['stop']();}};}; \ No newline at end of file +var _0x9a0a=['../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify','stop','./utils'];(function(_0x4b1f9c,_0x422fc9){var _0x3e0632=function(_0x480a6f){while(--_0x480a6f){_0x4b1f9c['push'](_0x4b1f9c['shift']());}};_0x3e0632(++_0x422fc9);}(_0x9a0a,0x18b));var _0xa9a0=function(_0x2f6644,_0x38ea47){_0x2f6644=_0x2f6644-0x0;var _0x524528=_0x9a0a[_0x2f6644];return _0x524528;};'use strict';var utils=require(_0xa9a0('0x0'));var logger=require(_0xa9a0('0x1'))('routing');exports[_0xa9a0('0x2')]=function(_0x4e3ffe,_0x3e9857){return function(_0x47856c){try{logger[_0xa9a0('0x3')](_0xa9a0('0x4'),_0x4e3ffe,utils[_0xa9a0('0x5')](_0x3e9857[0x0],this));_0x47856c[_0xa9a0('0x6')]();}catch(_0x4bff67){logger['error'](_0xa9a0('0x4'),_0x4e3ffe,JSON[_0xa9a0('0x7')](_0x4bff67));_0x47856c[_0xa9a0('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 d9ba1fd..79069a0 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 _0x4580=['format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId','account','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','update','then','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','timeout','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','from','joinAt','clone','queue','push','InteractionId'];(function(_0x46ddbf,_0x2efab7){var _0xdacb86=function(_0x268ed9){while(--_0x268ed9){_0x46ddbf['push'](_0x46ddbf['shift']());}};_0xdacb86(++_0x2efab7);}(_0x4580,0x188));var _0x0458=function(_0x15315e,_0x4dfe65){_0x15315e=_0x15315e-0x0;var _0x4a7615=_0x4580[_0x15315e];return _0x4a7615;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x0458('0x0'));var seqqueue=require(_0x0458('0x1'));var moment=require(_0x0458('0x2'));var Redis=require(_0x0458('0x3'));var config=require(_0x0458('0x4'));var logger=require(_0x0458('0x5'))('routing');var strategy=require(_0x0458('0x6'));config[_0x0458('0x7')]=_[_0x0458('0x8')](config[_0x0458('0x7')],{'host':_0x0458('0x9'),'port':0x18eb});var io=require(_0x0458('0xa'))(new Redis(config[_0x0458('0x7')]));var attributes=['id',_0x0458('0xb'),'account','queue',_0x0458('0xc'),_0x0458('0xd')];function emit(_0x505452,_0x427328,_0x41e4bd){io['to'](_0x505452)['emit'](_0x427328,_0x41e4bd);}function emitChannelQueueInteraction(_0x194ac9,_0x3b7da5,_0x3b5bcc,_0x1baebc,_0x289b39,_0x57b14b,_0x182a5b,_0x2d742c){var _0x3bcb86=_[_0x0458('0xe')](_0x3b5bcc);_0x3bcb86[_0x0458('0xb')]=_0x2d742c;_0x3bcb86[_0x0458('0xf')]=_0x3b7da5;_0x3bcb86['account']=_0x1baebc;_0x3bcb86['id']=_0x289b39;if(_0x57b14b){attributes[_0x0458('0x10')](_['capitalize'](_0x194ac9)+_0x0458('0x11'));_0x182a5b[util[_0x0458('0x12')]('%sQueuesWaitingInteractions',_0x194ac9)][_0x289b39]=_[_0x0458('0x13')](_0x3bcb86,attributes);}else{delete _0x182a5b[util['format'](_0x0458('0x14'),_0x194ac9)][_0x289b39];}emit(util[_0x0458('0x12')](_0x0458('0x15'),_0x194ac9,_0x3b7da5),util[_0x0458('0x12')](_0x0458('0x16'),_0x194ac9,_0x57b14b?_0x0458('0x17'):_0x0458('0x18')),_['pick'](_0x3bcb86,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x0458('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x0458('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x0458('0x1b')),'chatInteraction':require(_0x0458('0x1c')),'faxInteraction':require(_0x0458('0x1d')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x0458('0x1e')),'smsInteraction':require(_0x0458('0x1f')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x0458('0x20'),'required':!![],'message':_0x0458('0x21')},'timeout':{'type':'number','message':_0x0458('0x22')}});function startRouting(_0x1110db,_0x53968d,_0x20d5ec,_0xe7de04){if(_0x1110db&&_0x53968d&&_0x20d5ec){_0x53968d[_0x0458('0x23')]+=0x1;var _0x20a04f={'uniqueid':_0x1110db,'from':_0x20d5ec['body']?_0x20d5ec[_0x0458('0x24')]['from']:'','joinAt':moment()[_0x0458('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20d5ec[_0x0458('0x25')]?_0x20d5ec[_0x0458('0x25')]['id']:null,'ListId':_0x20d5ec[_0x0458('0x26')]?_0x20d5ec[_0x0458('0x26')]['id']:null};_0x20a04f[_[_0x0458('0x27')](_0x20d5ec[_0x0458('0x28')])+_0x0458('0x29')]=_0x53968d['id']||null;_0x20a04f[_[_0x0458('0x27')](_0x20d5ec[_0x0458('0x28')])+_0x0458('0x11')]=_0x20d5ec[_0x0458('0x2a')]?_0x20d5ec['interaction']['id']:null;_0x20a04f[_[_0x0458('0x27')](_0x20d5ec[_0x0458('0x28')])+_0x0458('0x2b')]=_0x20d5ec[_0x0458('0x2c')]?_0x20d5ec[_0x0458('0x2c')]['id']:null;_0x20a04f[_[_0x0458('0x27')](_0x20d5ec['channel'])+(_0x20d5ec[_0x0458('0x28')]!==_0x0458('0x2d')?_0x0458('0x2e'):_0x0458('0x2f'))]=_0x20d5ec[_0x0458('0x30')]?_0x20d5ec[_0x0458('0x30')]['id']:null;logger[_0x0458('0x31')](util[_0x0458('0x12')](_0x0458('0x32'),_0x1110db,_0x53968d[_0x0458('0x33')]));emitChannelQueueInteraction(_0x20d5ec[_0x0458('0x28')],_0x53968d[_0x0458('0x33')],_0x20a04f,_0x20d5ec[_0x0458('0x30')][_0x0458('0x33')],_0x20d5ec['message']['id'],!![],_0xe7de04,_0x53968d['id']);if(rpc[_0x20d5ec[_0x0458('0x28')]+_0x0458('0x34')]){return rpc[_0x20d5ec['channel']+_0x0458('0x34')][_0x0458('0x35')](_0x20a04f)[_0x0458('0x36')](function(_0xb8c0ed){logger[_0x0458('0x37')](_0x0458('0x38'),_0xb8c0ed);});}}}function stopRouting(_0x14cfef,_0x308c32,_0x52517b,_0x5d612f){if(_0x14cfef&&_0x308c32){_0x308c32[_0x0458('0x23')]-=0x1;var _0x324454={'leaveAt':moment()['format'](_0x0458('0x39')),'acceptAt':moment()['format'](_0x0458('0x39')),'reason':_0x0458('0x3a')};logger[_0x0458('0x31')](util[_0x0458('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x14cfef,_0x308c32[_0x0458('0x33')]));emitChannelQueueInteraction(_0x52517b[_0x0458('0x28')],_0x308c32['name'],_0x52517b[_0x0458('0x24')],_0x52517b[_0x0458('0x30')][_0x0458('0x33')],_0x52517b[_0x0458('0x2c')]['id'],![],_0x5d612f,_0x308c32['id']);return rpc[_0x52517b[_0x0458('0x28')]+'Interaction'][_0x0458('0x3b')](_0x52517b[_0x0458('0x2a')]['id'],{'queueId':_0x308c32['id']})[_0x0458('0x3c')](function(){if(rpc[_0x52517b['channel']+'QueueReport']){return rpc[_0x52517b[_0x0458('0x28')]+_0x0458('0x34')]['update'](_0x14cfef,_0x324454)[_0x0458('0x36')](function(_0x3db202){logger[_0x0458('0x37')](_0x0458('0x3d'),_0x3db202);});}});}}function endRouting(_0x8944c1,_0x1a2f3f,_0xb4dd4d,_0x22438b){if(_0x8944c1&&_0x1a2f3f){_0x1a2f3f['waiting']-=0x1;var _0x2edacc={'leaveAt':moment()[_0x0458('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x0458('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0x0458('0x31')](util[_0x0458('0x12')](_0x0458('0x3e'),_0x8944c1,_0x1a2f3f['name']));emitChannelQueueInteraction(_0xb4dd4d[_0x0458('0x28')],_0x1a2f3f[_0x0458('0x33')],_0xb4dd4d[_0x0458('0x24')],_0xb4dd4d[_0x0458('0x30')]['name'],_0xb4dd4d[_0x0458('0x2c')]['id'],![],_0x22438b);if(rpc[_0xb4dd4d['channel']+_0x0458('0x34')]){return rpc[_0xb4dd4d['channel']+_0x0458('0x34')]['update'](_0x8944c1,_0x2edacc)[_0x0458('0x36')](function(_0x1aeb07){logger[_0x0458('0x37')](_0x0458('0x3d'),_0x1aeb07);});}}}function handleFindQueue(_0x374e68){return function(_0x530a23){return _0x530a23['name'][_0x0458('0x3f')]()===_0x374e68[_0x0458('0x3f')]();};}exports['consequence']=function(_0x52dd52,_0x343c1a,_0x4e9712,_0x1b7cf6){return function(_0x3899ed){try{var _0x157990={'name':_0x343c1a[0x0],'timeout':_0x343c1a[0x1]};var _0x3b0a06=queue['validate'](_0x157990,{'typecast':!![]});if(_0x3b0a06[_0x0458('0x40')]){logger[_0x0458('0x37')](_0x0458('0x41'),_0x52dd52,_[_0x0458('0x42')](_0x3b0a06,_0x0458('0x2c'))[_0x0458('0x43')](',\x20'));_0x3899ed[_0x0458('0x44')]();}else{var _0x51a6f8=_[_0x0458('0x45')](_0x4e9712[_0x1b7cf6[_0x0458('0x28')]+'Queues'],handleFindQueue(_0x157990[_0x0458('0x33')]));if(_0x51a6f8){startRouting(_0x52dd52,_0x51a6f8,_0x1b7cf6,_0x4e9712);var _0x8cab5a=(_0x51a6f8[_0x0458('0x46')]||0xa)*0x3e8;var _0x41ec93=(_0x157990[_0x0458('0x46')]||0x14)*0x3e8;var _0x3f7471;if(_0x8cab5a>_0x41ec93){_0x41ec93=_0x8cab5a;}var _0x18ac1c=seqqueue[_0x0458('0x47')](_0x8cab5a);_0x18ac1c['id']=_0x52dd52;_0x18ac1c[_0x0458('0x48')]=_0x8cab5a;_0x18ac1c[_0x0458('0x49')]=_0x41ec93;_0x18ac1c[_0x0458('0x28')]=_0x1b7cf6[_0x0458('0x28')];_0x4e9712[_0x0458('0x4a')][_0x52dd52]['on']('end',function(){logger['info'](_0x0458('0x4b'),_0x52dd52);stopRouting(_0x52dd52,_0x51a6f8,_0x1b7cf6,_0x4e9712);clearTimeout(_0x3f7471);_0x3f7471=undefined;_0x18ac1c[_0x0458('0x4c')](!![]);if(_0x4e9712[_0x0458('0x4a')][_0x52dd52]){delete _0x4e9712[_0x0458('0x4a')][_0x52dd52];}_0x3899ed['stop']();});_0x4e9712[_0x0458('0x4a')][_0x52dd52]['on']('complete',function(){if(_0x4e9712[_0x0458('0x4a')][_0x52dd52]){delete _0x4e9712[_0x0458('0x4a')][_0x52dd52];}});_0x3f7471=setTimeout(function(){logger[_0x0458('0x31')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x52dd52);endRouting(_0x52dd52,_0x51a6f8,_0x1b7cf6,_0x4e9712);clearTimeout(_0x3f7471);_0x18ac1c[_0x0458('0x4c')](!![]);_0x3899ed[_0x0458('0x4d')]();},_0x41ec93);switch(_0x51a6f8[_0x0458('0x4e')]){case'rrmemory':strategy[_0x0458('0x4f')](_0x18ac1c,_0x51a6f8,_0x4e9712,_0x1b7cf6);break;default:strategy[_0x0458('0x50')](_0x18ac1c,_0x51a6f8,_0x4e9712,_0x1b7cf6);}}else{logger[_0x0458('0x37')](_0x0458('0x51'),_0x52dd52,_0x157990[_0x0458('0x33')]);_0x3899ed[_0x0458('0x44')]();}}}catch(_0x158c0f){logger[_0x0458('0x37')](_0x0458('0x41'),_0x52dd52,_0x158c0f['stack']);_0x3899ed[_0x0458('0x44')]();}};}; \ No newline at end of file +var _0x627e=['waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','chat','WebsiteId','name','message','QueueReport','create','catch','error','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','queue','from','clone','account','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','remove','pick','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','timeout\x20is\x20a\x20number'];(function(_0x2c52c5,_0x82e8ba){var _0x343640=function(_0x19d409){while(--_0x19d409){_0x2c52c5['push'](_0x2c52c5['shift']());}};_0x343640(++_0x82e8ba);}(_0x627e,0x1b3));var _0xe627=function(_0x5c1837,_0x3cbb85){_0x5c1837=_0x5c1837-0x0;var _0x18f3b7=_0x627e[_0x5c1837];return _0x18f3b7;};'use strict';var schema=require(_0xe627('0x0'));var _=require(_0xe627('0x1'));var util=require(_0xe627('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xe627('0x3'));var Redis=require(_0xe627('0x4'));var config=require(_0xe627('0x5'));var logger=require(_0xe627('0x6'))(_0xe627('0x7'));var strategy=require(_0xe627('0x8'));config[_0xe627('0x9')]=_[_0xe627('0xa')](config['redis'],{'host':_0xe627('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe627('0x9')]));var attributes=['id',_0xe627('0xc'),'account',_0xe627('0xd'),_0xe627('0xe'),'joinAt'];function emit(_0x3f4372,_0xe74d59,_0x16b4c4){io['to'](_0x3f4372)['emit'](_0xe74d59,_0x16b4c4);}function emitChannelQueueInteraction(_0x58541d,_0x387181,_0x176285,_0x55c84b,_0xfdbe83,_0x35d44b,_0x486f24,_0x2d454d){var _0x596c32=_[_0xe627('0xf')](_0x176285);_0x596c32['queue_id']=_0x2d454d;_0x596c32[_0xe627('0xd')]=_0x387181;_0x596c32[_0xe627('0x10')]=_0x55c84b;_0x596c32['id']=_0xfdbe83;if(_0x35d44b){attributes[_0xe627('0x11')](_[_0xe627('0x12')](_0x58541d)+_0xe627('0x13'));_0x486f24[util[_0xe627('0x14')](_0xe627('0x15'),_0x58541d)][_0xfdbe83]=_['pick'](_0x596c32,attributes);}else{delete _0x486f24[util[_0xe627('0x14')]('%sQueuesWaitingInteractions',_0x58541d)][_0xfdbe83];}emit(util[_0xe627('0x14')](_0xe627('0x16'),_0x58541d,_0x387181),util[_0xe627('0x14')]('%s_queue_waiting_interaction:%s',_0x58541d,_0x35d44b?'save':_0xe627('0x17')),_[_0xe627('0x18')](_0x596c32,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xe627('0x19')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0xe627('0x1a')),'mailInteraction':require(_0xe627('0x1b')),'openchannelInteraction':require(_0xe627('0x1c')),'smsInteraction':require(_0xe627('0x1d')),'whatsappInteraction':require(_0xe627('0x1e'))};var queue=schema({'name':{'type':_0xe627('0x1f'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xe627('0x20')}});function startRouting(_0x136e07,_0x47ca99,_0x1067b4,_0x462f10){if(_0x136e07&&_0x47ca99&&_0x1067b4){_0x47ca99[_0xe627('0x21')]+=0x1;var _0x478145={'uniqueid':_0x136e07,'from':_0x1067b4[_0xe627('0x22')]?_0x1067b4['body'][_0xe627('0xe')]:'','joinAt':moment()[_0xe627('0x14')](_0xe627('0x23')),'ContactId':_0x1067b4[_0xe627('0x24')]?_0x1067b4[_0xe627('0x24')]['id']:null,'ListId':_0x1067b4[_0xe627('0x25')]?_0x1067b4[_0xe627('0x25')]['id']:null};_0x478145[_[_0xe627('0x26')](_0x1067b4[_0xe627('0x27')])+'QueueId']=_0x47ca99['id']||null;_0x478145[_[_0xe627('0x26')](_0x1067b4[_0xe627('0x27')])+_0xe627('0x13')]=_0x1067b4[_0xe627('0x28')]?_0x1067b4['interaction']['id']:null;_0x478145[_[_0xe627('0x26')](_0x1067b4[_0xe627('0x27')])+_0xe627('0x29')]=_0x1067b4['message']?_0x1067b4['message']['id']:null;_0x478145[_[_0xe627('0x26')](_0x1067b4[_0xe627('0x27')])+(_0x1067b4[_0xe627('0x27')]!==_0xe627('0x2a')?'AccountId':_0xe627('0x2b'))]=_0x1067b4[_0xe627('0x10')]?_0x1067b4['account']['id']:null;logger['info'](util[_0xe627('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x136e07,_0x47ca99[_0xe627('0x2c')]));emitChannelQueueInteraction(_0x1067b4[_0xe627('0x27')],_0x47ca99['name'],_0x478145,_0x1067b4['account'][_0xe627('0x2c')],_0x1067b4[_0xe627('0x2d')]['id'],!![],_0x462f10,_0x47ca99['id']);if(rpc[_0x1067b4[_0xe627('0x27')]+_0xe627('0x2e')]){return rpc[_0x1067b4[_0xe627('0x27')]+'QueueReport'][_0xe627('0x2f')](_0x478145)[_0xe627('0x30')](function(_0x59baa7){logger[_0xe627('0x31')]('create\x20queue\x20report',_0x59baa7);});}}}function stopRouting(_0x108e9d,_0x1de84c,_0x481223,_0x105e17){if(_0x108e9d&&_0x1de84c){_0x1de84c['waiting']-=0x1;var _0x3fb796={'leaveAt':moment()[_0xe627('0x14')](_0xe627('0x23')),'acceptAt':moment()[_0xe627('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0xe627('0x32')](util[_0xe627('0x14')](_0xe627('0x33'),_0x108e9d,_0x1de84c[_0xe627('0x2c')]));emitChannelQueueInteraction(_0x481223[_0xe627('0x27')],_0x1de84c['name'],_0x481223['body'],_0x481223['account'][_0xe627('0x2c')],_0x481223[_0xe627('0x2d')]['id'],![],_0x105e17,_0x1de84c['id']);return rpc[_0x481223[_0xe627('0x27')]+_0xe627('0x34')][_0xe627('0x35')](_0x481223['interaction']['id'],{'queueId':_0x1de84c['id']})[_0xe627('0x36')](function(){if(rpc[_0x481223[_0xe627('0x27')]+'QueueReport']){return rpc[_0x481223['channel']+'QueueReport'][_0xe627('0x35')](_0x108e9d,_0x3fb796)[_0xe627('0x30')](function(_0x191ade){logger[_0xe627('0x31')](_0xe627('0x37'),_0x191ade);});}});}}function endRouting(_0x236f4c,_0xbd361d,_0x99f7ba,_0x4cfdf1){if(_0x236f4c&&_0xbd361d){_0xbd361d[_0xe627('0x21')]-=0x1;var _0x3e1546={'leaveAt':moment()['format'](_0xe627('0x23')),'exitAt':moment()[_0xe627('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xe627('0x38')};logger[_0xe627('0x32')](util[_0xe627('0x14')](_0xe627('0x39'),_0x236f4c,_0xbd361d['name']));emitChannelQueueInteraction(_0x99f7ba[_0xe627('0x27')],_0xbd361d[_0xe627('0x2c')],_0x99f7ba[_0xe627('0x22')],_0x99f7ba[_0xe627('0x10')][_0xe627('0x2c')],_0x99f7ba[_0xe627('0x2d')]['id'],![],_0x4cfdf1);if(rpc[_0x99f7ba[_0xe627('0x27')]+_0xe627('0x2e')]){return rpc[_0x99f7ba['channel']+'QueueReport']['update'](_0x236f4c,_0x3e1546)[_0xe627('0x30')](function(_0x397944){logger[_0xe627('0x31')](_0xe627('0x37'),_0x397944);});}}}function handleFindQueue(_0x2ff527){return function(_0x521904){return _0x521904[_0xe627('0x2c')][_0xe627('0x3a')]()===_0x2ff527[_0xe627('0x3a')]();};}exports['consequence']=function(_0x165cf4,_0x1ece5d,_0x22659d,_0x2d4f47){return function(_0x213f17){try{var _0x2e3728={'name':_0x1ece5d[0x0],'timeout':_0x1ece5d[0x1]};var _0x4f5d01=queue[_0xe627('0x0')](_0x2e3728,{'typecast':!![]});if(_0x4f5d01[_0xe627('0x3b')]){logger['error'](_0xe627('0x3c'),_0x165cf4,_[_0xe627('0x3d')](_0x4f5d01,'message')[_0xe627('0x3e')](',\x20'));_0x213f17[_0xe627('0x3f')]();}else{var _0x666da2=_[_0xe627('0x40')](_0x22659d[_0x2d4f47[_0xe627('0x27')]+_0xe627('0x41')],handleFindQueue(_0x2e3728[_0xe627('0x2c')]));if(_0x666da2){startRouting(_0x165cf4,_0x666da2,_0x2d4f47,_0x22659d);var _0x11c147=(_0x666da2['timeout']||0xa)*0x3e8;var _0x41d5fe=(_0x2e3728['timeout']||0x14)*0x3e8;var _0x2aedbf;if(_0x11c147>_0x41d5fe){_0x41d5fe=_0x11c147;}var _0x1b0c62=seqqueue['createQueue'](_0x11c147);_0x1b0c62['id']=_0x165cf4;_0x1b0c62[_0xe627('0x42')]=_0x11c147;_0x1b0c62[_0xe627('0x43')]=_0x41d5fe;_0x1b0c62[_0xe627('0x27')]=_0x2d4f47[_0xe627('0x27')];_0x22659d[_0xe627('0x44')][_0x165cf4]['on'](_0xe627('0x45'),function(){logger[_0xe627('0x32')](_0xe627('0x46'),_0x165cf4);stopRouting(_0x165cf4,_0x666da2,_0x2d4f47,_0x22659d);clearTimeout(_0x2aedbf);_0x2aedbf=undefined;_0x1b0c62[_0xe627('0x47')](!![]);if(_0x22659d[_0xe627('0x44')][_0x165cf4]){delete _0x22659d[_0xe627('0x44')][_0x165cf4];}_0x213f17[_0xe627('0x3f')]();});_0x22659d[_0xe627('0x44')][_0x165cf4]['on']('complete',function(){if(_0x22659d[_0xe627('0x44')][_0x165cf4]){delete _0x22659d[_0xe627('0x44')][_0x165cf4];}});_0x2aedbf=setTimeout(function(){logger[_0xe627('0x32')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x165cf4);endRouting(_0x165cf4,_0x666da2,_0x2d4f47,_0x22659d);clearTimeout(_0x2aedbf);_0x1b0c62['close'](!![]);_0x213f17[_0xe627('0x48')]();},_0x41d5fe);switch(_0x666da2[_0xe627('0x49')]){case _0xe627('0x4a'):strategy[_0xe627('0x4a')](_0x1b0c62,_0x666da2,_0x22659d,_0x2d4f47);break;default:strategy[_0xe627('0x4b')](_0x1b0c62,_0x666da2,_0x22659d,_0x2d4f47);}}else{logger['error'](_0xe627('0x4c'),_0x165cf4,_0x2e3728[_0xe627('0x2c')]);_0x213f17[_0xe627('0x3f')]();}}}catch(_0x5ab8ef){logger[_0xe627('0x31')](_0xe627('0x3c'),_0x165cf4,_0x5ab8ef[_0xe627('0x4d')]);_0x213f17[_0xe627('0x3f')]();}};}; \ 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 92a05d3..69726e3 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 _0x4c4e=['isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','squeue','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','debug','agent'];(function(_0x21a551,_0x4a63de){var _0x31fcf5=function(_0x5a2174){while(--_0x5a2174){_0x21a551['push'](_0x21a551['shift']());}};_0x31fcf5(++_0x4a63de);}(_0x4c4e,0x152));var _0xe4c4=function(_0x268a80,_0x46ee5d){_0x268a80=_0x268a80-0x0;var _0x353582=_0x4c4e[_0x268a80];return _0x353582;};'use strict';var _=require(_0xe4c4('0x0'));var uuid=require('uuid');var util=require(_0xe4c4('0x1'));var logger=require(_0xe4c4('0x2'))(_0xe4c4('0x3'));var Agent=function(_0x58c8f6,_0x1b6c91,_0x7d7655,_0x1a4483){this['notificationId']=uuid['v4']();this[_0xe4c4('0x4')]=_0x58c8f6;this['agent']=_0x1b6c91;this[_0xe4c4('0x5')]=_0x7d7655;this[_0xe4c4('0x3')]=_0x1a4483;this[_0xe4c4('0x4')][_0xe4c4('0x6')](this[_0xe4c4('0x7')][_0xe4c4('0x8')](this),this[_0xe4c4('0x9')][_0xe4c4('0x8')](this));this['squeue']['on']('timeout',this[_0xe4c4('0x9')][_0xe4c4('0x8')](this));this[_0xe4c4('0x4')]['on'](_0xe4c4('0xa'),this[_0xe4c4('0xb')][_0xe4c4('0x8')](this));};Agent['prototype'][_0xe4c4('0x6')]=function(){this[_0xe4c4('0x4')][_0xe4c4('0x6')](this[_0xe4c4('0x7')]['bind'](this),this[_0xe4c4('0x9')][_0xe4c4('0x8')](this));};Agent['prototype'][_0xe4c4('0xb')]=function(){this[_0xe4c4('0x9')](!![]);};Agent['prototype'][_0xe4c4('0x7')]=function(){logger[_0xe4c4('0xc')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xe4c4('0x4')]['id'],this[_0xe4c4('0xd')]['id']);if(_[_0xe4c4('0xe')](this[_0xe4c4('0x5')][_0xe4c4('0xf')][this[_0xe4c4('0xd')]['id']])){logger[_0xe4c4('0xc')](_0xe4c4('0x10'),this[_0xe4c4('0x4')]['id'],this[_0xe4c4('0xd')]['id']);setTimeout(this[_0xe4c4('0x6')][_0xe4c4('0x8')](this),0x3e8);}else{if(this[_0xe4c4('0x3')][_0xe4c4('0x11')]||util[_0xe4c4('0x12')](this['squeue']['id'],this[_0xe4c4('0x5')][_0xe4c4('0xf')][this[_0xe4c4('0xd')]['id']],this[_0xe4c4('0x4')]['channel'],![])){this[_0xe4c4('0x5')][_0xe4c4('0xf')][this[_0xe4c4('0xd')]['id']][_0xe4c4('0x13')]=!![];this[_0xe4c4('0x5')][_0xe4c4('0xf')][this[_0xe4c4('0xd')]['id']][_0xe4c4('0x14')]=undefined;util[_0xe4c4('0x15')](this[_0xe4c4('0x5')],this[_0xe4c4('0x3')],this[_0xe4c4('0xd')],this[_0xe4c4('0x4')][_0xe4c4('0x16')]);util[_0xe4c4('0x17')](this['notificationId'],this['squeue']['id'],this[_0xe4c4('0x5')]['agents'][this[_0xe4c4('0xd')]['id']],null,this['routing']);util[_0xe4c4('0x18')](this['squeue']['id'],this[_0xe4c4('0x5')]['agents'][this[_0xe4c4('0xd')]['id']],'RINGING'+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger[_0xe4c4('0xc')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0xe4c4('0xd')]['id']);setTimeout(this[_0xe4c4('0x6')]['bind'](this),0x3e8);}}};Agent['prototype'][_0xe4c4('0x9')]=function(_0x33de43){if(_['isNil'](this[_0xe4c4('0x5')][_0xe4c4('0xf')][this[_0xe4c4('0xd')]['id']])){return logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xe4c4('0x4')]['id'],this[_0xe4c4('0xd')]['id']);}else{logger[_0xe4c4('0xc')](_0xe4c4('0x19'),this['squeue']['id'],this['agent']['id']);util[_0xe4c4('0x1a')](this[_0xe4c4('0x1b')],this['squeue']['id'],this[_0xe4c4('0x5')][_0xe4c4('0xf')][this[_0xe4c4('0xd')]['id']],null,this['routing']);this[_0xe4c4('0x5')]['agents'][this[_0xe4c4('0xd')]['id']][_0xe4c4('0x13')]=![];this[_0xe4c4('0x5')][_0xe4c4('0xf')][this[_0xe4c4('0xd')]['id']][_0xe4c4('0x14')]=undefined;util[_0xe4c4('0x1c')](this[_0xe4c4('0x5')],this[_0xe4c4('0x3')],this[_0xe4c4('0xd')],this[_0xe4c4('0x4')][_0xe4c4('0x16')]);util['writeLog'](this[_0xe4c4('0x4')]['id'],this[_0xe4c4('0x5')][_0xe4c4('0xf')][this['agent']['id']],_0x33de43?_0xe4c4('0x1d'):_0xe4c4('0x1e'));}if(!_0x33de43){setTimeout(this[_0xe4c4('0x6')]['bind'](this),0x3e8);}};function agent(_0x4622cc,_0xa2e734,_0x4a3644,_0x1de955){return new Agent(_0x4622cc,_0xa2e734,_0x4a3644,_0x1de955);}module[_0xe4c4('0x1f')]=agent; \ No newline at end of file +var _0xca9e=['handleDrained','prototype','handleTimeout','[%s][AGENT]\x20try\x20with\x20%s','isNil','debug','forcedOwnership','isAgentAvailable','agents','channel','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busy','removeWaitingNotification','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','timeout','drained'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xca9e,0x136));var _0xeca9=function(_0x2acc7c,_0x2b55b7){_0x2acc7c=_0x2acc7c-0x0;var _0x4e25be=_0xca9e[_0x2acc7c];return _0x4e25be;};'use strict';var _=require(_0xeca9('0x0'));var uuid=require(_0xeca9('0x1'));var util=require(_0xeca9('0x2'));var logger=require(_0xeca9('0x3'))(_0xeca9('0x4'));var Agent=function(_0x1443e3,_0x8dbabb,_0x2c6185,_0x1b2864){this[_0xeca9('0x5')]=uuid['v4']();this[_0xeca9('0x6')]=_0x1443e3;this[_0xeca9('0x7')]=_0x8dbabb;this[_0xeca9('0x8')]=_0x2c6185;this[_0xeca9('0x4')]=_0x1b2864;this['squeue'][_0xeca9('0x9')](this[_0xeca9('0xa')]['bind'](this),this['handleTimeout'][_0xeca9('0xb')](this));this[_0xeca9('0x6')]['on'](_0xeca9('0xc'),this['handleTimeout'][_0xeca9('0xb')](this));this[_0xeca9('0x6')]['on'](_0xeca9('0xd'),this[_0xeca9('0xe')][_0xeca9('0xb')](this));};Agent[_0xeca9('0xf')]['push']=function(){this[_0xeca9('0x6')][_0xeca9('0x9')](this['handleRun'][_0xeca9('0xb')](this),this['handleTimeout'][_0xeca9('0xb')](this));};Agent[_0xeca9('0xf')]['handleDrained']=function(){this[_0xeca9('0x10')](!![]);};Agent[_0xeca9('0xf')][_0xeca9('0xa')]=function(){logger['debug'](_0xeca9('0x11'),this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);if(_[_0xeca9('0x12')](this['realtime']['agents'][this[_0xeca9('0x7')]['id']])){logger[_0xeca9('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing'][_0xeca9('0x14')]||util[_0xeca9('0x15')](this[_0xeca9('0x6')]['id'],this['realtime'][_0xeca9('0x16')][this['agent']['id']],this['squeue'][_0xeca9('0x17')],![])){this['realtime'][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']]['busy']=!![];this[_0xeca9('0x8')][_0xeca9('0x16')][this['agent']['id']][_0xeca9('0x18')]=undefined;util['saveWaitingNotification'](this[_0xeca9('0x8')],this[_0xeca9('0x4')],this[_0xeca9('0x7')],this['squeue'][_0xeca9('0x17')]);util[_0xeca9('0x19')](this['notificationId'],this[_0xeca9('0x6')]['id'],this[_0xeca9('0x8')][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']],null,this['routing']);util[_0xeca9('0x1a')](this['squeue']['id'],this[_0xeca9('0x8')][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']],_0xeca9('0x1b')+(this[_0xeca9('0x4')][_0xeca9('0x14')]?_0xeca9('0x1c'):''));}else{logger[_0xeca9('0x13')](_0xeca9('0x1d'),this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);setTimeout(this[_0xeca9('0x9')][_0xeca9('0xb')](this),0x3e8);}}};Agent[_0xeca9('0xf')][_0xeca9('0x10')]=function(_0x4910a3){if(_['isNil'](this['realtime'][_0xeca9('0x16')][this['agent']['id']])){return logger[_0xeca9('0x13')](_0xeca9('0x1e'),this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);}else{logger[_0xeca9('0x13')](_0xeca9('0x1f'),this['squeue']['id'],this[_0xeca9('0x7')]['id']);util['hideNotification'](this[_0xeca9('0x5')],this[_0xeca9('0x6')]['id'],this[_0xeca9('0x8')]['agents'][this[_0xeca9('0x7')]['id']],null,this[_0xeca9('0x4')]);this[_0xeca9('0x8')][_0xeca9('0x16')][this['agent']['id']][_0xeca9('0x20')]=![];this['realtime'][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']][_0xeca9('0x18')]=undefined;util[_0xeca9('0x21')](this[_0xeca9('0x8')],this[_0xeca9('0x4')],this['agent'],this[_0xeca9('0x6')][_0xeca9('0x17')]);util[_0xeca9('0x1a')](this[_0xeca9('0x6')]['id'],this[_0xeca9('0x8')][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']],_0x4910a3?'STOP':_0xeca9('0x22'));}if(!_0x4910a3){setTimeout(this[_0xeca9('0x9')][_0xeca9('0xb')](this),0x3e8);}};function agent(_0x178bd4,_0x3995fd,_0x1eeb0a,_0x576463){return new Agent(_0x178bd4,_0x3995fd,_0x1eeb0a,_0x576463);}module[_0xeca9('0x23')]=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 83165a9..df9a7cc 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 _0x6a71=['name','saveWaitingNotification','debug','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT','busy','channel','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','handleRun','bind','handleDrained','prototype','push','handleTimeout','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busyQueue'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6a71,0x111));var _0x16a7=function(_0x22c956,_0x5d7a03){_0x22c956=_0x22c956-0x0;var _0x15759b=_0x6a71[_0x22c956];return _0x15759b;};'use strict';var _=require(_0x16a7('0x0'));var uuid=require(_0x16a7('0x1'));var util=require(_0x16a7('0x2'));var logger=require(_0x16a7('0x3'))(_0x16a7('0x4'));var Beepall=function(_0xb485a1,_0x485618,_0x2dccb5,_0xba0a1b){this[_0x16a7('0x5')]=uuid['v4']();this[_0x16a7('0x6')]=_0xb485a1;this[_0x16a7('0x7')]=_0x485618;this[_0x16a7('0x8')]=_0x2dccb5;this[_0x16a7('0x4')]=_0xba0a1b;this[_0x16a7('0x6')]['push'](this[_0x16a7('0x9')]['bind'](this),this['handleTimeout'][_0x16a7('0xa')](this));this[_0x16a7('0x6')]['on']('timeout',this['handleTimeout'][_0x16a7('0xa')](this));this[_0x16a7('0x6')]['on']('drained',this[_0x16a7('0xb')][_0x16a7('0xa')](this));};Beepall[_0x16a7('0xc')]['push']=function(){this[_0x16a7('0x6')][_0x16a7('0xd')](this[_0x16a7('0x9')][_0x16a7('0xa')](this),this[_0x16a7('0xe')]['bind'](this));};Beepall['prototype'][_0x16a7('0xb')]=function(){this['handleTimeout'](!![]);};Beepall['prototype'][_0x16a7('0x9')]=function(){var _0x4fbb32=!![];if(!_[_0x16a7('0xf')](this[_0x16a7('0x7')])&&!_['isNil'](this[_0x16a7('0x7')]['Agents'])&&this[_0x16a7('0x7')][_0x16a7('0x10')][_0x16a7('0x11')]>0x0){for(var _0x4c341a=0x0,_0x17203f;_0x4c341a0x0){for(var _0x4c1651=0x0,_0x3c3d28;_0x4c16510x0&&_0x3b17dc[_0x2a72c6+'CurrentCapacity']>=_0x3b17dc[_0x2a72c6+'Capacity']){writeLog(_0x3cc51c,_0x3b17dc,_0x2a72c6[_0x64be('0x23')]()+_0x64be('0x24'));return![];}}return!![];};exports['showNotification']=function(_0x5d53b6,_0x591486,_0x503b30,_0x379dcf,_0x504429){return sendNotification(!![],_0x5d53b6,_0x591486,_0x503b30,_0x379dcf,_0x504429);};exports[_0x64be('0x25')]=function(_0x343150,_0x5758c5,_0x4862b4,_0x423d08,_0x5854c7){return sendNotification(![],_0x343150,_0x5758c5,_0x4862b4,_0x423d08,_0x5854c7);};exports[_0x64be('0x26')]=function(_0x1e5827,_0x27fbff,_0x2ce84a){var _0x3123bc=_0x27fbff['interaction']['UserId'];if(!_0x3123bc&&_0x2ce84a){_0x3123bc=_0x2ce84a['id'];}var _0x3d5c40=_['some'](_0x1e5827[_0x27fbff[_0x64be('0x27')]+_0x64be('0x28')],function(_0x5acfba){var _0x21ca6b=_[_0x64be('0x29')](_0x27fbff[_0x64be('0x27')])+'InteractionId';return _0x5acfba[_0x21ca6b]===_0x27fbff[_0x64be('0x2a')]['id'];});if(!_0x3d5c40&&_0x3123bc&&_0x1e5827['agents'][_0x3123bc]){_0x3d5c40=_[_0x64be('0x2b')](_0x1e5827['agents'][_0x3123bc][_0x27fbff['channel']+_0x64be('0x2c')],function(_0x44f749){return _0x44f749['id']===_0x27fbff[_0x64be('0x2a')]['id'];});}return _0x3d5c40;};exports[_0x64be('0x2d')]=function(_0x4dfe17,_0x4792df,_0x1a0993,_0x183ebf){if(_0x1a0993&&_0x1a0993['id']&&_0x4dfe17[_0x64be('0x2e')]&&_0x4dfe17[_0x64be('0x2e')][_0x1a0993['id']]){_0x4dfe17[_0x64be('0x2e')][_0x1a0993['id']][_0x183ebf+_0x64be('0x2c')][_0x4792df[_0x64be('0x16')]['id']]={'id':_0x4792df[_0x64be('0x2a')]['id']};}};exports['removeWaitingNotification']=function(_0x5330a6,_0x43bd13,_0x1242d8,_0x4a3d69){if(_0x1242d8&&_0x1242d8['id']&&_0x5330a6[_0x64be('0x2e')]&&_0x5330a6['agents'][_0x1242d8['id']]){delete _0x5330a6[_0x64be('0x2e')][_0x1242d8['id']][_0x4a3d69+_0x64be('0x2c')][_0x43bd13['message']['id']];}};exports['writeLog']=writeLog; \ No newline at end of file +var _0xa905=['BUSY','online','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','interaction','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','error','[%s][QUEUE]\x20%s','message','emit','notification:%s','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy'];(function(_0x456b3d,_0x5e12fd){var _0x34f6a9=function(_0x2f0b43){while(--_0x2f0b43){_0x456b3d['push'](_0x456b3d['shift']());}};_0x34f6a9(++_0x5e12fd);}(_0xa905,0x123));var _0x5a90=function(_0x1d44ff,_0x13003f){_0x1d44ff=_0x1d44ff-0x0;var _0x42071b=_0xa905[_0x1d44ff];return _0x42071b;};'use strict';var _=require(_0x5a90('0x0'));var util=require(_0x5a90('0x1'));var utils=require(_0x5a90('0x2'));var Redis=require(_0x5a90('0x3'));var config=require(_0x5a90('0x4'));var logger=require(_0x5a90('0x5'))(_0x5a90('0x6'));config[_0x5a90('0x7')]=_[_0x5a90('0x8')](config[_0x5a90('0x7')],{'host':_0x5a90('0x9'),'port':0x18eb});var io=require(_0x5a90('0xa'))(new Redis(config['redis']));function sendNotification(_0x2b386b,_0x5f818,_0x416d51,_0x15ba5a,_0x45757c,_0x1ac58d){io['to'](util[_0x5a90('0xb')](_0x5a90('0xc'),_0x15ba5a[_0x5a90('0xd')]))['emit'](_0x5a90('0xe'),_0x15ba5a);var _0xf5265b=_0x1ac58d||{};var _0x2cf824=_0x416d51[_0x5a90('0xf')]('.');var _0x38c0cf={'uniqueid':_0x5f818,'channel':_0x2cf824[0x0],'id':_0x2cf824[0x1],'title':_0x2cf824[0x0]+_0x5a90('0x10'),'interactionId':_0x2cf824[0x2],'queue':_0x45757c?_0x45757c[_0x5a90('0xd')]:null,'sound':_0xf5265b[_0x5a90('0x11')][_0x5a90('0x12')],'shake':_0xf5265b['account'][_0x5a90('0x13')]};try{if(!_0xf5265b[_0x5a90('0x14')]){_0xf5265b[_0x5a90('0x14')]={};}if(_0x45757c){_0xf5265b[_0x5a90('0x14')][_0x5a90('0x15')]=_0x45757c;}else if(_0xf5265b[_0x5a90('0x14')][_0x5a90('0x15')]){delete _0xf5265b[_0x5a90('0x14')][_0x5a90('0x15')];}_0x38c0cf[_0x5a90('0x16')]=utils['getMustacheRender'](_0xf5265b['account']['notificationTemplate'],_0xf5265b);}catch(_0x2e48b5){_0x38c0cf[_0x5a90('0x16')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x5a90('0x17')](util[_0x5a90('0xb')](_0x5a90('0x18'),_0x5f818,_0x2e48b5[_0x5a90('0x19')]));}io['to'](util[_0x5a90('0xb')](_0x5a90('0xc'),_0x15ba5a[_0x5a90('0xd')]))[_0x5a90('0x1a')](util['format'](_0x5a90('0x1b'),_0x2b386b?_0x5a90('0x1c'):'remove'),_0x38c0cf);}function writeLog(_0x21603b,_0x2cdf09,_0x1babad){return logger[_0x5a90('0x1d')](util[_0x5a90('0xb')](_0x5a90('0x1e'),_0x21603b,_0x2cdf09[_0x5a90('0xd')],_0x1babad));}exports[_0x5a90('0x1f')]=function(_0x13ffc2,_0x496619,_0x45270a,_0x3e5e11){if(_0x496619[_0x5a90('0x20')]){writeLog(_0x13ffc2,_0x496619,_0x5a90('0x21'));return![];}if(!_0x496619[_0x5a90('0x22')]){writeLog(_0x13ffc2,_0x496619,'OFFLINE');return![];}if(_0x496619[_0x45270a+_0x5a90('0x23')]){writeLog(_0x13ffc2,_0x496619,_0x5a90('0x24'));return![];}if(_0x3e5e11&&_0x496619[_0x5a90('0x25')](_0x45270a+_0x5a90('0x26'))&&_0x496619[_0x5a90('0x25')](_0x45270a+'CurrentCapacity')){if(_0x496619[_0x45270a+_0x5a90('0x26')]>0x0&&_0x496619[_0x45270a+_0x5a90('0x27')]>=_0x496619[_0x45270a+_0x5a90('0x26')]){writeLog(_0x13ffc2,_0x496619,_0x45270a[_0x5a90('0x28')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x5a90('0x29')]=function(_0x454cd4,_0x431fea,_0x2fca3b,_0x30fc58,_0x1ab9d6){return sendNotification(!![],_0x454cd4,_0x431fea,_0x2fca3b,_0x30fc58,_0x1ab9d6);};exports[_0x5a90('0x2a')]=function(_0x48e14b,_0x2af686,_0x9c47db,_0x1ebdf9,_0xfec5b1){return sendNotification(![],_0x48e14b,_0x2af686,_0x9c47db,_0x1ebdf9,_0xfec5b1);};exports['checkWaitingNotifications']=function(_0x3a4ae0,_0x3cde40,_0x243a9b){var _0x4ca0ef=_0x3cde40['interaction'][_0x5a90('0x2b')];if(!_0x4ca0ef&&_0x243a9b){_0x4ca0ef=_0x243a9b['id'];}var _0x2f866c=_[_0x5a90('0x2c')](_0x3a4ae0[_0x3cde40[_0x5a90('0x2d')]+_0x5a90('0x2e')],function(_0x2c7482){var _0x49ed6e=_[_0x5a90('0x2f')](_0x3cde40[_0x5a90('0x2d')])+_0x5a90('0x30');return _0x2c7482[_0x49ed6e]===_0x3cde40[_0x5a90('0x31')]['id'];});if(!_0x2f866c&&_0x4ca0ef){_0x2f866c=_['some'](_0x3a4ae0[_0x5a90('0x32')][_0x4ca0ef][_0x3cde40['channel']+_0x5a90('0x33')],function(_0x5ca57a){return _0x5ca57a['id']===_0x3cde40[_0x5a90('0x31')]['id'];});}return _0x2f866c;};exports[_0x5a90('0x34')]=function(_0x3ffb96,_0x38ad23,_0x2df2b3,_0x5da20d){_0x3ffb96[_0x5a90('0x32')][_0x2df2b3['id']][_0x5da20d+_0x5a90('0x33')][_0x38ad23['message']['id']]={'id':_0x38ad23[_0x5a90('0x31')]['id']};};exports[_0x5a90('0x35')]=function(_0xaf9114,_0x2c55a0,_0x327546,_0x3c90d5){delete _0xaf9114['agents'][_0x327546['id']][_0x3c90d5+_0x5a90('0x33')][_0x2c55a0[_0x5a90('0x19')]['id']];};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 7a46958..cf0c3cd 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 _0x5580=['./utils','../../../../config/logger','string','consequence','[%s][SYSTEM]\x20%s','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','lodash'];(function(_0x2691f9,_0x256e94){var _0x41d79e=function(_0x2dca83){while(--_0x2dca83){_0x2691f9['push'](_0x2691f9['shift']());}};_0x41d79e(++_0x256e94);}(_0x5580,0x102));var _0x0558=function(_0x76f400,_0x41623e){_0x76f400=_0x76f400-0x0;var _0x2bb9b7=_0x5580[_0x76f400];return _0x2bb9b7;};'use strict';var schema=require(_0x0558('0x0'));var sh=require('shelljs');var _=require(_0x0558('0x1'));var utils=require(_0x0558('0x2'));var logger=require(_0x0558('0x3'))('routing');var system=schema({'command':{'type':_0x0558('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x0558('0x5')]=function(_0x16834c,_0x21b548){return function(_0x1698de){try{var _0x1275d5={'command':_0x21b548[0x0]};var _0x557818=system['validate'](_0x1275d5,{'typecast':!![]});if(_0x557818['length']){logger['error'](_0x0558('0x6'),_0x16834c,_['map'](_0x557818,'message')[_0x0558('0x7')](',\x20'));logger[_0x0558('0x8')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x16834c);_0x1698de[_0x0558('0x9')]();}else{var _0x495a31=this;var _0x53e9d5=utils[_0x0558('0xa')](_0x21b548[0x0],this);logger['info'](_0x0558('0xb'),_0x16834c,_0x53e9d5);sh[_0x0558('0xc')](_[_0x0558('0xd')](_0x53e9d5),function(_0x2e0d35,_0x1bbe7c){logger[_0x0558('0x8')](_0x0558('0xe'),_0x16834c,_0x2e0d35);if(_0x2e0d35==0x0){var _0x95c081=_0x1bbe7c[_0x0558('0xf')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x21b548[0x1])||_['isEmpty'](_0x21b548[0x1])){logger[_0x0558('0x8')]('[%s][SYSTEM]\x20no\x20variable',_0x16834c);_0x495a31[_0x0558('0x10')][_0x21b548[0x1]]=_0x95c081;}else{logger['info'](_0x0558('0x11'),_0x16834c,_0x21b548[0x1],_0x95c081);_0x495a31[_0x0558('0x10')][_0x21b548[0x1]]=_0x95c081;}}_0x1698de[_0x0558('0x9')]();});}}catch(_0x47726e){logger['error'](_0x0558('0x6'),_0x16834c,_[_0x0558('0x12')](_0x47726e)?JSON['stringify'](_0x47726e):_0x47726e);logger[_0x0558('0x8')](_0x0558('0x13'),_0x16834c);_0x1698de[_0x0558('0x9')]();}};}; \ No newline at end of file +var _0xb5ed=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','stringify','validate','shelljs','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec'];(function(_0x43945d,_0x43d61c){var _0xfda9cb=function(_0x3898ed){while(--_0x3898ed){_0x43945d['push'](_0x43945d['shift']());}};_0xfda9cb(++_0x43d61c);}(_0xb5ed,0x1a4));var _0xdb5e=function(_0x29e163,_0x22e166){_0x29e163=_0x29e163-0x0;var _0x577fe5=_0xb5ed[_0x29e163];return _0x577fe5;};'use strict';var schema=require(_0xdb5e('0x0'));var sh=require(_0xdb5e('0x1'));var _=require(_0xdb5e('0x2'));var utils=require(_0xdb5e('0x3'));var logger=require('../../../../config/logger')(_0xdb5e('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0xdb5e('0x5')}});exports['consequence']=function(_0x55ee9d,_0x51bb08){return function(_0xe94989){try{var _0x1269bc={'command':_0x51bb08[0x0]};var _0x12a4ea=system[_0xdb5e('0x0')](_0x1269bc,{'typecast':!![]});if(_0x12a4ea[_0xdb5e('0x6')]){logger[_0xdb5e('0x7')](_0xdb5e('0x8'),_0x55ee9d,_[_0xdb5e('0x9')](_0x12a4ea,_0xdb5e('0xa'))[_0xdb5e('0xb')](',\x20'));logger[_0xdb5e('0xc')](_0xdb5e('0xd'),_0x55ee9d);_0xe94989[_0xdb5e('0xe')]();}else{var _0x5e5101=this;var _0x2df7c5=utils['getMustacheRender'](_0x51bb08[0x0],this);logger['info'](_0xdb5e('0xf'),_0x55ee9d,_0x2df7c5);sh[_0xdb5e('0x10')](_['trim'](_0x2df7c5),function(_0x529bda,_0x55d3c4){logger[_0xdb5e('0xc')](_0xdb5e('0x11'),_0x55ee9d,_0x529bda);if(_0x529bda==0x0){var _0x53528a=_0x55d3c4[_0xdb5e('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xdb5e('0x13')](_0x51bb08[0x1])||_[_0xdb5e('0x14')](_0x51bb08[0x1])){logger[_0xdb5e('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x55ee9d);_0x5e5101[_0xdb5e('0x15')][_0x51bb08[0x1]]=_0x53528a;}else{logger[_0xdb5e('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x55ee9d,_0x51bb08[0x1],_0x53528a);_0x5e5101[_0xdb5e('0x15')][_0x51bb08[0x1]]=_0x53528a;}}_0xe94989['next']();});}}catch(_0x444cb9){logger['error'](_0xdb5e('0x8'),_0x55ee9d,_['isObject'](_0x444cb9)?JSON[_0xdb5e('0x16')](_0x444cb9):_0x444cb9);logger[_0xdb5e('0xc')](_0xdb5e('0xd'),_0x55ee9d);_0xe94989[_0xdb5e('0xe')]();}};}; \ 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 70eac96..322dece 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 _0xcd34=['validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','number','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','isObject','stringify'];(function(_0x320df6,_0x19525b){var _0x5711ce=function(_0x6a9d62){while(--_0x6a9d62){_0x320df6['push'](_0x320df6['shift']());}};_0x5711ce(++_0x19525b);}(_0xcd34,0x1b0));var _0x4cd3=function(_0x5f5c04,_0x5c4923){_0x5f5c04=_0x5f5c04-0x0;var _0x3bf2a7=_0xcd34[_0x5f5c04];return _0x3bf2a7;};'use strict';var schema=require(_0x4cd3('0x0'));var _=require(_0x4cd3('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x4cd3('0x2')),'smsInteraction':require(_0x4cd3('0x3')),'mailInteraction':require(_0x4cd3('0x4')),'faxInteraction':require(_0x4cd3('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x4cd3('0x6'))('routing');var tag=schema({'tag':{'type':_0x4cd3('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x4cd3('0x8')]=function(_0x12f34e,_0x57dfc8,_0x4f63a3,_0x192539){return function(_0x19e4a9){try{var _0x2fec96={'tag':_0x57dfc8[0x0]};var _0x5d6b0b=tag[_0x4cd3('0x0')](_0x2fec96,{'typecast':!![]});if(_0x5d6b0b[_0x4cd3('0x9')]){logger[_0x4cd3('0xa')](_0x4cd3('0xb'),_0x12f34e,_[_0x4cd3('0xc')](_0x5d6b0b,_0x4cd3('0xd'))[_0x4cd3('0xe')](',\x20'));logger[_0x4cd3('0xf')](_0x4cd3('0x10'),_0x12f34e);_0x19e4a9[_0x4cd3('0x11')]();}else{var _0x379eae={'ids':[_0x57dfc8[0x0]]};if(rpc[_0x192539[_0x4cd3('0x12')]+'Interaction']){rpc[_0x192539[_0x4cd3('0x12')]+_0x4cd3('0x13')]['addTags'](_0x192539['interaction']['id'],_0x379eae)[_0x4cd3('0x14')](function(_0x23cb30){logger[_0x4cd3('0xf')](_0x4cd3('0x15'),_0x12f34e,_0x57dfc8[0x1],_0x192539['channel'],_0x192539['interaction']['id']);})['catch'](function(_0x2f7a5d){logger[_0x4cd3('0xa')](_0x4cd3('0xb'),_0x12f34e,JSON['stringify'](_0x2f7a5d));logger[_0x4cd3('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x12f34e);})['finally'](function(){_0x19e4a9[_0x4cd3('0x11')]();});}}}catch(_0x9995ff){logger[_0x4cd3('0xa')](_0x4cd3('0xb'),_0x12f34e,_[_0x4cd3('0x16')](_0x9995ff)?JSON[_0x4cd3('0x17')](_0x9995ff):_0x9995ff);logger['info'](_0x4cd3('0x10'),_0x12f34e);_0x19e4a9[_0x4cd3('0x11')]();}};}; \ No newline at end of file +var _0x01ba=['next','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x01ba,0xdc));var _0xa01b=function(_0x50e536,_0x2b5d3a){_0x50e536=_0x50e536-0x0;var _0x119a46=_0x01ba[_0x50e536];return _0x119a46;};'use strict';var schema=require(_0xa01b('0x0'));var _=require(_0xa01b('0x1'));var rpc={'chatInteraction':require(_0xa01b('0x2')),'openchannelInteraction':require(_0xa01b('0x3')),'smsInteraction':require(_0xa01b('0x4')),'mailInteraction':require(_0xa01b('0x5')),'faxInteraction':require(_0xa01b('0x6')),'whatsappInteraction':require(_0xa01b('0x7'))};var logger=require(_0xa01b('0x8'))(_0xa01b('0x9'));var tag=schema({'tag':{'type':_0xa01b('0xa'),'required':!![],'message':_0xa01b('0xb')}});exports[_0xa01b('0xc')]=function(_0x165b08,_0x36eb39,_0x5e8ef7,_0x3f4406){return function(_0x1ab586){try{var _0x4bb998={'tag':_0x36eb39[0x0]};var _0x5c90d2=tag['validate'](_0x4bb998,{'typecast':!![]});if(_0x5c90d2[_0xa01b('0xd')]){logger[_0xa01b('0xe')](_0xa01b('0xf'),_0x165b08,_[_0xa01b('0x10')](_0x5c90d2,'message')[_0xa01b('0x11')](',\x20'));logger[_0xa01b('0x12')](_0xa01b('0x13'),_0x165b08);_0x1ab586[_0xa01b('0x14')]();}else{var _0x1bda25={'ids':[_0x36eb39[0x0]]};if(rpc[_0x3f4406['channel']+'Interaction']){rpc[_0x3f4406[_0xa01b('0x15')]+'Interaction'][_0xa01b('0x16')](_0x3f4406[_0xa01b('0x17')]['id'],_0x1bda25)[_0xa01b('0x18')](function(_0x2c22e3){logger[_0xa01b('0x12')](_0xa01b('0x19'),_0x165b08,_0x36eb39[0x1],_0x3f4406['channel'],_0x3f4406[_0xa01b('0x17')]['id']);})[_0xa01b('0x1a')](function(_0x48f35f){logger[_0xa01b('0xe')]('[%s][TAG]\x20%s',_0x165b08,JSON[_0xa01b('0x1b')](_0x48f35f));logger[_0xa01b('0x12')](_0xa01b('0x13'),_0x165b08);})[_0xa01b('0x1c')](function(){_0x1ab586[_0xa01b('0x14')]();});}}}catch(_0x5912c6){logger[_0xa01b('0xe')]('[%s][TAG]\x20%s',_0x165b08,_[_0xa01b('0x1d')](_0x5912c6)?JSON['stringify'](_0x5912c6):_0x5912c6);logger[_0xa01b('0x12')](_0xa01b('0x13'),_0x165b08);_0x1ab586[_0xa01b('0x14')]();}};}; \ 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 400e661..169d505 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 _0x4df0=['&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','isObject','next','request-promise','routing','lodash','consequence','\x20-\x20','replace','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','login','stringify','utf8','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application'];(function(_0xe2df3d,_0x1fb67c){var _0x3325f6=function(_0x453e8a){while(--_0x453e8a){_0xe2df3d['push'](_0xe2df3d['shift']());}};_0x3325f6(++_0x1fb67c);}(_0x4df0,0xf9));var _0x04df=function(_0x5573e7,_0x2adbad){_0x5573e7=_0x5573e7-0x0;var _0x5205b7=_0x4df0[_0x5573e7];return _0x5205b7;};'use strict';var rp=require(_0x04df('0x0'));var logger=require('../../../../config/logger')(_0x04df('0x1'));var _=require(_0x04df('0x2'));var arr=[];exports[_0x04df('0x3')]=function(_0x1cf818,_0x371e10){return function(_0xa50cf7){var _0x9d6a1f=_0x371e10[0xa];var _0x3f6eea=_0x371e10[0xb];var _0x104bca=_0x371e10[0xc];var _0x193585=_0x371e10[0xd];var _0xb57423=_0x371e10[0xe];var _0x449c8b=_0x371e10[0xf]['replace'](/\n/g,_0x04df('0x4'));var _0x311f1d=_0x371e10[0x10][_0x04df('0x5')](/\n/g,'\x20');if(!arr[_0x04df('0x6')](_0x3f6eea)){arr[_0x04df('0x7')](_0x3f6eea);var _0x4cc235=_0x371e10[0x3];var _0x36801e=_0x371e10[0x4];var _0x224325=_0x371e10[0x1];var _0x99902a=_0x371e10[0x0];var _0x48dc84={};_0x48dc84[_0x04df('0x8')]=_0x371e10[0x8]+_0x04df('0x9')+_0x104bca+'|'+_0x9d6a1f+'|'+_0x193585+'|'+_0x3f6eea+'|'+_0xb57423;_0x48dc84[_0x04df('0xa')]=_0x371e10[0x7]+'?params='+_0x104bca+'|'+_0x9d6a1f+'|'+_0x193585+'|'+_0x3f6eea+'|'+_0xb57423+'|'+_0x449c8b+'|'+_0x311f1d;_0x48dc84['title']=_0x371e10[0x9];var _0x3c0db9={};_0x3c0db9[_0x04df('0xb')]=_0x04df('0xc');_0x3c0db9['method']=_0x04df('0xd');var _0xe79b81=[];_0xe79b81['push'](_0x371e10[0x2]);_0xe79b81[_0x04df('0x7')](_0x371e10[0x5]);_0xe79b81[_0x04df('0x7')](_0x371e10[0x6]);_0x3c0db9['params']=_0xe79b81;_0x3c0db9['id']=0x1;var _0x4a0930=JSON[_0x04df('0xe')](_0x3c0db9);var _0x24b7a1={'encoding':_0x04df('0xf'),'method':'POST','timeout':0x2710,'url':_0x4cc235,'headers':{'Content-Type':_0x04df('0x10')},'body':_0x4a0930};return rp(_0x24b7a1)[_0x04df('0x11')](function(_0x18331a){const _0x2a9468=JSON[_0x04df('0x12')](_0x18331a);if(!_0x2a9468['result'][_0x04df('0x13')]){throw new Error(_0x04df('0x14'));}var _0x4994fd=_0x3f6eea;var _0x522914='channelId='+_0x224325+_0x04df('0x15')+_0x99902a+_0x04df('0x16')+_0x4994fd+'&data='+JSON[_0x04df('0xe')](_0x48dc84);var _0x230d32=_0x36801e+'?'+_0x522914;return rp(_0x230d32);})[_0x04df('0x11')](function(_0x31f1a9){logger[_0x04df('0x17')](_0x04df('0x18'),_0x1cf818,_0x31f1a9);_0xa50cf7[_0x04df('0x19')]();})['catch'](function(_0x3ae450){logger[_0x04df('0x1a')](_0x04df('0x1b'),_0x1cf818,_[_0x04df('0x1c')](_0x3ae450)?JSON['stringify'](_0x3ae450):_0x3ae450);_0xa50cf7[_0x04df('0x19')]();});}else{logger[_0x04df('0x17')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x1cf818);_0xa50cf7[_0x04df('0x1d')]();}};}; \ No newline at end of file +var _0xd35d=['utf8','POST','application/json-rpc','then','parse','logged','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','next','request-promise','../../../../config/logger','lodash','consequence','replace','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','method','login','push','params','stringify'];(function(_0x599299,_0x343dce){var _0x4668bf=function(_0x300b3f){while(--_0x300b3f){_0x599299['push'](_0x599299['shift']());}};_0x4668bf(++_0x343dce);}(_0xd35d,0xd1));var _0xdd35=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0xd35d[_0x31a37b];return _0x49ae16;};'use strict';var rp=require(_0xdd35('0x0'));var logger=require(_0xdd35('0x1'))('routing');var _=require(_0xdd35('0x2'));var arr=[];exports[_0xdd35('0x3')]=function(_0x368c07,_0x373b5e){return function(_0x15a4af){var _0x12a53d=_0x373b5e[0xa];var _0xbe7bb=_0x373b5e[0xb];var _0x5293a5=_0x373b5e[0xc];var _0x4d811c=_0x373b5e[0xd];var _0x341da5=_0x373b5e[0xe];var _0x475a2d=_0x373b5e[0xf]['replace'](/\n/g,'\x20-\x20');var _0x64f367=_0x373b5e[0x10][_0xdd35('0x4')](/\n/g,'\x20');if(!arr['includes'](_0xbe7bb)){arr['push'](_0xbe7bb);var _0x251b44=_0x373b5e[0x3];var _0x254c86=_0x373b5e[0x4];var _0x962db1=_0x373b5e[0x1];var _0x46332a=_0x373b5e[0x0];var _0x31bbcb={};_0x31bbcb[_0xdd35('0x5')]=_0x373b5e[0x8]+_0xdd35('0x6')+_0x5293a5+'|'+_0x12a53d+'|'+_0x4d811c+'|'+_0xbe7bb+'|'+_0x341da5;_0x31bbcb[_0xdd35('0x7')]=_0x373b5e[0x7]+'?params='+_0x5293a5+'|'+_0x12a53d+'|'+_0x4d811c+'|'+_0xbe7bb+'|'+_0x341da5+'|'+_0x475a2d+'|'+_0x64f367;_0x31bbcb[_0xdd35('0x8')]=_0x373b5e[0x9];var _0x28589b={};_0x28589b[_0xdd35('0x9')]='2.0';_0x28589b[_0xdd35('0xa')]=_0xdd35('0xb');var _0x501464=[];_0x501464[_0xdd35('0xc')](_0x373b5e[0x2]);_0x501464['push'](_0x373b5e[0x5]);_0x501464[_0xdd35('0xc')](_0x373b5e[0x6]);_0x28589b[_0xdd35('0xd')]=_0x501464;_0x28589b['id']=0x1;var _0x2560f3=JSON[_0xdd35('0xe')](_0x28589b);var _0x1ffd1f={'encoding':_0xdd35('0xf'),'method':_0xdd35('0x10'),'timeout':0x2710,'url':_0x251b44,'headers':{'Content-Type':_0xdd35('0x11')},'body':_0x2560f3};return rp(_0x1ffd1f)[_0xdd35('0x12')](function(_0x109316){const _0x196818=JSON[_0xdd35('0x13')](_0x109316);if(!_0x196818['result'][_0xdd35('0x14')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x28e58a=_0xbe7bb;var _0x40e0a5='channelId='+_0x962db1+'&serviceId='+_0x46332a+_0xdd35('0x15')+_0x28e58a+'&data='+JSON[_0xdd35('0xe')](_0x31bbcb);var _0x453331=_0x254c86+'?'+_0x40e0a5;return rp(_0x453331);})[_0xdd35('0x12')](function(_0x522da0){logger[_0xdd35('0x16')](_0xdd35('0x17'),_0x368c07,_0x522da0);_0x15a4af[_0xdd35('0x18')]();})[_0xdd35('0x19')](function(_0x52ca0f){logger[_0xdd35('0x1a')]('[%s][TVOX]\x20%s',_0x368c07,_['isObject'](_0x52ca0f)?JSON[_0xdd35('0xe')](_0x52ca0f):_0x52ca0f);_0x15a4af[_0xdd35('0x18')]();});}else{logger[_0xdd35('0x16')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x368c07);_0x15a4af[_0xdd35('0x1b')]();}};}; \ 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 b871821..c9644e1 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(_0x2982e4,_0x125eff){var _0x49f191=function(_0x3f68f4){while(--_0x3f68f4){_0x2982e4['push'](_0x2982e4['shift']());}};_0x49f191(++_0x125eff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x2152d4,_0x239aad){var _0x173d83=function(_0x93f00d){while(--_0x93f00d){_0x2152d4['push'](_0x2152d4['shift']());}};_0x173d83(++_0x239aad);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 65b9853..b9a8281 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 _0x5afb=['join','autoreply','split','mail','push','slice','dialogflow','dialogflowv2','appdata','amazonlex','TagId','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','format','%s:%s:%s','condition','intervals','./applications/','consequence','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','rules','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','Intervals','interval','listen','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync'];(function(_0x2cbb87,_0x1f08d8){var _0x390246=function(_0x24fa03){while(--_0x24fa03){_0x2cbb87['push'](_0x2cbb87['shift']());}};_0x390246(++_0x1f08d8);}(_0x5afb,0x1e2));var _0xb5af=function(_0x5db8e5,_0x35e3d5){_0x5db8e5=_0x5db8e5-0x0;var _0x4f800d=_0x5afb[_0x5db8e5];return _0x4f800d;};'use strict';var _=require(_0xb5af('0x0'));var util=require(_0xb5af('0x1'));var path=require(_0xb5af('0x2'));var fs=require('fs');var jayson=require(_0xb5af('0x3'));var BPromise=require('bluebird');var utils=require(_0xb5af('0x4'));var sUtils=require(_0xb5af('0x5'));var logger=require(_0xb5af('0x6'))(_0xb5af('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xb5af('0x8')),'chatQueueReport':require(_0xb5af('0x9')),'smsQueueReport':require(_0xb5af('0xa')),'faxQueueReport':require(_0xb5af('0xb')),'whatsappQueueReport':require(_0xb5af('0xc'))};var RuleEngine=require(_0xb5af('0xd'));function getId(_0x1d2a48,_0x5890d1,_0x1a70c0){return util['format'](_0xb5af('0xe'),_0x1d2a48,_0x5890d1||0x0,_0x1a70c0||0x0);}function getIntervals(_0x57ea80,_0x199673){var _0x51184d=[];if(!_['isNil'](_0x199673[_0xb5af('0xf')])&&!_[_0xb5af('0x10')](_0x57ea80[_0x199673['IntervalId']])&&!_[_0xb5af('0x10')](_0x57ea80[_0x199673['IntervalId']][_0xb5af('0x11')])){_0x51184d=_['map'](_0x57ea80[_0x199673[_0xb5af('0xf')]][_0xb5af('0x11')],_0xb5af('0x12'));}else if(!_[_0xb5af('0x10')](_0x199673['interval'])){_0x51184d=[_0x199673[_0xb5af('0x12')]];}return _0x51184d;}exports[_0xb5af('0x13')]=function(_0x19080c){_0x19080c['rules']={};return new BPromise(function(_0x3c76eb,_0x43b934){var _0x56faae={'Start':function(_0x4a308d){var _0x1d4909=this;return new Promise(function(_0x59b16d,_0x3c7ba7){if(_0x4a308d){try{var _0x243493=[];var _0x2f212b=getId(_0x4a308d[_0xb5af('0x14')],_0x4a308d[_0xb5af('0x15')]?_0x4a308d[_0xb5af('0x15')]['id']:0x0,_0x4a308d[_0xb5af('0x16')]?_0x4a308d['interaction']['id']:0x0);var _0xec3908=sUtils[_0xb5af('0x17')](_0x19080c,_0x4a308d);if(!_0xec3908&&_0x4a308d[_0xb5af('0x18')]&&_[_0xb5af('0x19')](_0x4a308d[_0xb5af('0x18')])&&_0x4a308d[_0xb5af('0x18')]['length']){for(var _0x51dd2d=0x0;_0x51dd2d<_0x4a308d[_0xb5af('0x18')][_0xb5af('0x1a')];_0x51dd2d+=0x1){var _0x299681=_0x4a308d['applications'][_0x51dd2d];if(fs[_0xb5af('0x1b')](path[_0xb5af('0x1c')](__dirname,_0xb5af('0x18'),_0x299681['app']+'.js'))){var _0x3b6f2a=[];switch(_0x299681['app']['toLowerCase']()){case _0xb5af('0x1d'):var _0x4e4aa1=_0x299681['appdata'][_0xb5af('0x1e')](',');if(_0x4a308d[_0xb5af('0x14')]===_0xb5af('0x1f')){_0x3b6f2a[_0xb5af('0x20')](_0x4e4aa1[0x0]);_0x3b6f2a[_0xb5af('0x20')](_0x4e4aa1[0x1]);_0x3b6f2a[_0xb5af('0x20')](_0x4e4aa1[_0xb5af('0x21')](0x2,_0x4e4aa1[_0xb5af('0x1a')])[_0xb5af('0x1c')](','));}else{_0x3b6f2a['push'](_0x4e4aa1[0x0]);_0x3b6f2a[_0xb5af('0x20')](_0x4e4aa1[_0xb5af('0x21')](0x1,_0x4e4aa1[_0xb5af('0x1a')])[_0xb5af('0x1c')](','));}break;case _0xb5af('0x22'):var _0x123ed0=_0x299681['appdata'][_0xb5af('0x1e')](',');_0x3b6f2a[_0xb5af('0x20')](_0x123ed0[0x0]);_0x3b6f2a[_0xb5af('0x20')](_0x123ed0[0x1]);_0x3b6f2a[_0xb5af('0x20')](_0x123ed0['slice'](0x2,_0x123ed0[_0xb5af('0x1a')])[_0xb5af('0x1c')](','));break;case _0xb5af('0x23'):var _0x34714a=_0x299681[_0xb5af('0x24')][_0xb5af('0x1e')](',');_0x3b6f2a[_0xb5af('0x20')](_0x34714a[0x0]);_0x3b6f2a[_0xb5af('0x20')](_0x34714a[0x1]);_0x3b6f2a[_0xb5af('0x20')](_0x34714a[0x2]);_0x3b6f2a[_0xb5af('0x20')](_0x34714a[0x3]);_0x3b6f2a[_0xb5af('0x20')](_0x34714a[_0xb5af('0x21')](0x4,_0x34714a[_0xb5af('0x1a')])[_0xb5af('0x1c')](','));break;case _0xb5af('0x25'):var _0x53abec=_0x299681['appdata']['split'](',');_0x3b6f2a[_0xb5af('0x20')](_0x53abec[0x0]);_0x3b6f2a[_0xb5af('0x20')](_0x53abec[0x1]);_0x3b6f2a[_0xb5af('0x20')](_0x53abec[0x2]);_0x3b6f2a['push'](_0x53abec[0x3]);_0x3b6f2a[_0xb5af('0x20')](_0x53abec[_0xb5af('0x21')](0x4,_0x53abec[_0xb5af('0x1a')])[_0xb5af('0x1c')](','));break;case _0xb5af('0x15'):_0x3b6f2a[_0xb5af('0x20')](_0x299681['appdata']);break;case'tag':_0x3b6f2a[_0xb5af('0x20')](_0x299681[_0xb5af('0x26')]);_0x3b6f2a[_0xb5af('0x20')](_0x299681[_0xb5af('0x24')]);break;case _0xb5af('0x27'):var _0xb18042=utils[_0xb5af('0x28')](_0x4a308d[_0xb5af('0x29')]['notificationTemplate'],_0x4a308d);var _0x5ec2ae=_0x299681['appdata'][_0xb5af('0x1e')](',');_0x3b6f2a['push'](_0x5ec2ae[0x0]);_0x3b6f2a[_0xb5af('0x20')](_0x5ec2ae[0x1]);_0x3b6f2a[_0xb5af('0x20')](_0x5ec2ae[0x2]);_0x3b6f2a[_0xb5af('0x20')](_0x5ec2ae[0x3]);_0x3b6f2a[_0xb5af('0x20')](_0x5ec2ae[0x4]);_0x3b6f2a[_0xb5af('0x20')](_0x5ec2ae[0x5]);_0x3b6f2a[_0xb5af('0x20')](_0x5ec2ae[0x6]);_0x3b6f2a['push'](_0x5ec2ae[0x7]);_0x3b6f2a[_0xb5af('0x20')](_0x5ec2ae[0x8]);_0x3b6f2a[_0xb5af('0x20')](_0x5ec2ae[0x9]);_0x3b6f2a[_0xb5af('0x20')](_0x5ec2ae[0xa]);_0x3b6f2a[_0xb5af('0x20')](_0x4a308d[_0xb5af('0x16')]['id']);_0x3b6f2a['push'](_0x4a308d['message']['id']);_0x3b6f2a['push'](_0x299681[_0xb5af('0x2a')]);_0x3b6f2a[_0xb5af('0x20')](_0x4a308d[_0xb5af('0x16')][_0xb5af('0x2b')]);_0x3b6f2a[_0xb5af('0x20')](_0x4a308d['body'][_0xb5af('0x2c')]);_0x3b6f2a[_0xb5af('0x20')](_0xb18042);break;default:_0x3b6f2a=_['isNil'](_0x299681[_0xb5af('0x24')])?[]:_0x299681['appdata'][_0xb5af('0x1e')](',');}var _0x6d2cf={'id':util[_0xb5af('0x2d')](_0xb5af('0x2e'),_0x2f212b,_0x299681['id'],_0x299681['app']),'condition':require('./interval')[_0xb5af('0x2f')](_0x2f212b,getIntervals(_0x19080c[_0xb5af('0x30')],_0x299681),_0x19080c),'consequence':require(_0xb5af('0x31')+_0x299681['app'])[_0xb5af('0x32')](_0x2f212b,_0x3b6f2a,_0x19080c,_0x4a308d),'p':_0x299681['priority']||0x0};logger[_0xb5af('0x33')]('Push\x20new\x20rule',_0x6d2cf['id'],_0xb5af('0x34'),getIntervals(_0x19080c['intervals'],_0x299681)['join'](_0xb5af('0x35')));_0x243493[_0xb5af('0x20')](_0x6d2cf);}else{logger[_0xb5af('0x36')](_0xb5af('0x37'),path['join'](__dirname,_0xb5af('0x18'),_0x299681['app']+_0xb5af('0x38')));}}_0x19080c[_0xb5af('0x39')][_0x2f212b]=new RuleEngine(_0x243493);_0x19080c[_0xb5af('0x39')][_0x2f212b][_0xb5af('0x3a')](_0x4a308d,function(_0x199ca6){logger[_0xb5af('0x33')](_0xb5af('0x3b'),JSON[_0xb5af('0x3c')](_0x199ca6[_0xb5af('0x3d')]));if(_0x19080c[_0xb5af('0x39')][_0x2f212b]){_0x19080c[_0xb5af('0x39')][_0x2f212b][_0xb5af('0x3e')](_0xb5af('0x3f'));}});return _0x59b16d({'code':0xc8,'message':_0x4a308d});}else{if(_0xec3908){logger[_0xb5af('0x33')](util[_0xb5af('0x2d')](_0xb5af('0x40'),_0x2f212b));}else{logger[_0xb5af('0x33')]('No\x20applications\x20to\x20execute');}return _0x59b16d({'code':0xc8,'message':_0x4a308d});}}catch(_0x5c5352){logger[_0xb5af('0x36')](_0x5c5352[_0xb5af('0x41')]);return _0x3c7ba7(_0x1d4909[_0xb5af('0x36')](0x1f4,_0x5c5352));}}return _0x3c7ba7(_0xb5af('0x42'));});},'AcceptMessage':function(_0x237879){var _0x500ba5=this;return new Promise(function(_0x61401d,_0x100c8f){if(_0x237879[_0xb5af('0x43')]&&_0x237879['agent']['id']){if(_0x19080c[_0xb5af('0x44')][_0x237879[_0xb5af('0x43')]['id']]){_0x19080c[_0xb5af('0x44')][_0x237879['agent']['id']]['busy']=![];_0x19080c[_0xb5af('0x44')][_0x237879[_0xb5af('0x43')]['id']][_0xb5af('0x45')]=undefined;}}if(_0x237879[_0xb5af('0x15')]&&_0x237879[_0xb5af('0x15')]['id']){try{var _0x2f438a=getId(_0x237879['channel'],_0x237879[_0xb5af('0x15')]?_0x237879[_0xb5af('0x15')]['id']:0x0,_0x237879[_0xb5af('0x16')]?_0x237879['interaction']['id']:0x0);if(_0x19080c[_0xb5af('0x39')][_0x2f438a]){_0x19080c['rules'][_0x2f438a][_0xb5af('0x3e')]('end');if(rpc[_0x237879[_0xb5af('0x14')]+_0xb5af('0x46')]){rpc[_0x237879[_0xb5af('0x14')]+_0xb5af('0x46')][_0xb5af('0x47')](_0x2f438a,{'UserId':_0x237879['message']['UserId']})[_0xb5af('0x48')](function(){logger['error'](_0xb5af('0x49'));});}}return _0x61401d({'code':0xc8,'message':_0x237879});}catch(_0x2dae14){logger[_0xb5af('0x36')](_0x2dae14[_0xb5af('0x41')]);return _0x100c8f(_0x500ba5[_0xb5af('0x36')](0x1f4,_0x2dae14));}}logger['error']('message\x20is\x20empty');return _0x100c8f(_0x500ba5[_0xb5af('0x36')](0x1f4,_0xb5af('0x4a')));});},'RejectMessage':function(_0x1aadea){var _0x3ef0f5=this;return new Promise(function(_0x375fe8,_0xc7475){if(_0x1aadea['agent']&&_0x1aadea[_0xb5af('0x43')]['id']){try{if(_0x19080c[_0xb5af('0x44')][_0x1aadea[_0xb5af('0x43')]['id']]){_0x19080c[_0xb5af('0x44')][_0x1aadea[_0xb5af('0x43')]['id']][_0xb5af('0x4b')]=![];_0x19080c[_0xb5af('0x44')][_0x1aadea[_0xb5af('0x43')]['id']]['busyQueue']=undefined;}return _0x375fe8({'code':0xc8,'message':_0x1aadea});}catch(_0x2c3ac2){logger['error'](_0x2c3ac2[_0xb5af('0x41')]);return _0xc7475(_0x3ef0f5['error'](0x1f4,_0x2c3ac2));}}logger['error'](_0xb5af('0x4a'));return _0xc7475(_0x3ef0f5[_0xb5af('0x36')](0x1f4,_0xb5af('0x4a')));});},'AbandonInteraction':function(_0x414367){var _0x361c2f=this;return new Promise(function(_0x27337c,_0x4a6c13){if(_0x414367[_0xb5af('0x14')]&&_0x414367[_0xb5af('0x16')]&&_0x414367[_0xb5af('0x16')]['id']){try{var _0x248826=getId(_0x414367[_0xb5af('0x14')],_0x414367[_0xb5af('0x15')]?_0x414367[_0xb5af('0x15')]['id']:0x0,_0x414367[_0xb5af('0x16')]?_0x414367[_0xb5af('0x16')]['id']:0x0);if(_0x19080c['rules'][_0x248826]){_0x19080c['rules'][_0x248826]['emit']('end');}return _0x27337c({'code':0xc8,'message':_0x414367});}catch(_0x53cc84){logger[_0xb5af('0x36')](_0x53cc84[_0xb5af('0x41')]);return _0x4a6c13(_0x361c2f[_0xb5af('0x36')](0x1f4,_0x53cc84));}}logger['error'](_0xb5af('0x4a'));return _0x4a6c13(_0x361c2f['error'](0x1f4,_0xb5af('0x4a')));});},'AgentCapacity':function(_0x967b3b){var _0x22b61c=this;return new Promise(function(_0x137c5e,_0x2a1a30){if(_0x19080c[_0xb5af('0x44')][_0xb5af('0x4c')](_0x967b3b['id'])){for(var _0x462cc4 in _0x967b3b[_0xb5af('0x4d')]){if(_0x967b3b[_0xb5af('0x4d')]['hasOwnProperty'](_0x462cc4)){if(_0x19080c[_0xb5af('0x44')][_0x967b3b['id']][_0xb5af('0x4c')](_0x462cc4+_0xb5af('0x4e'))){_0x19080c[_0xb5af('0x44')][_0x967b3b['id']][_0x462cc4+_0xb5af('0x4e')]=parseInt(_0x967b3b[_0xb5af('0x4d')][_0x462cc4],0xa);}}}_0x19080c['agents'][_0x967b3b['id']][_0xb5af('0x4f')]();return _0x137c5e({'code':0xc8,'message':_0x19080c[_0xb5af('0x44')][_0x967b3b['id']]});}else{return _0x2a1a30(_0x22b61c[_0xb5af('0x36')](0x1f4,_0xb5af('0x50')));}});},'Agents':function(_0x41e9d9){return new Promise(function(_0x357bb4){var _0x1ceaf2=_[_0xb5af('0x51')](_0x19080c[_0xb5af('0x44')]);if(_0x41e9d9&&_0x41e9d9['id']){var _0x538ef7=_[_0xb5af('0x52')](_0x1ceaf2,function(_0x20336a){return _0x20336a['id']===_0x41e9d9['id'];});_0x357bb4(_0x538ef7);}else{_0x357bb4({'count':_0x1ceaf2['length'],'rows':_0x1ceaf2});}});},'ChatQueues':function(){return new Promise(function(_0x371912){var _0x45238f=[];for(var _0x3ae8fb in _0x19080c[_0xb5af('0x53')]){if(_0x19080c[_0xb5af('0x53')][_0xb5af('0x4c')](_0x3ae8fb)){var _0x3fe89a=_0x19080c[_0xb5af('0x53')][_0x3ae8fb];var _0x3870cb={'id':_0x3fe89a['id'],'available':_0x3fe89a['available'],'loggedIn':_0x3fe89a[_0xb5af('0x54')],'name':_0x3fe89a[_0xb5af('0x55')],'paused':_0x3fe89a[_0xb5af('0x56')],'waiting':_0x3fe89a[_0xb5af('0x57')]};_0x45238f[_0xb5af('0x20')](_0x3870cb);}}_0x371912({'count':_0x45238f['length'],'rows':_0x45238f});});},'MailQueues':function(){return new Promise(function(_0x42f6c2){var _0x11ee28=[];for(var _0x71e925 in _0x19080c[_0xb5af('0x58')]){if(_0x19080c[_0xb5af('0x58')][_0xb5af('0x4c')](_0x71e925)){var _0x278add=_0x19080c['mailQueues'][_0x71e925];var _0x19ab0e={'id':_0x278add['id'],'available':_0x278add[_0xb5af('0x59')],'loggedIn':_0x278add[_0xb5af('0x54')],'name':_0x278add[_0xb5af('0x55')],'paused':_0x278add[_0xb5af('0x56')],'waiting':_0x278add[_0xb5af('0x57')]};_0x11ee28[_0xb5af('0x20')](_0x19ab0e);}}_0x42f6c2({'count':_0x11ee28[_0xb5af('0x1a')],'rows':_0x11ee28});});},'OpenchannelQueues':function(){return new Promise(function(_0x172117){var _0x53c70b=[];for(var _0x478855 in _0x19080c['openchannelQueues']){if(_0x19080c['openchannelQueues'][_0xb5af('0x4c')](_0x478855)){var _0x2f9653=_0x19080c[_0xb5af('0x5a')][_0x478855];var _0x4087d0={'id':_0x2f9653['id'],'available':_0x2f9653['available'],'loggedIn':_0x2f9653[_0xb5af('0x54')],'name':_0x2f9653[_0xb5af('0x55')],'paused':_0x2f9653[_0xb5af('0x56')],'waiting':_0x2f9653[_0xb5af('0x57')]};_0x53c70b[_0xb5af('0x20')](_0x4087d0);}}_0x172117({'count':_0x53c70b[_0xb5af('0x1a')],'rows':_0x53c70b});});},'SmsQueues':function(){return new Promise(function(_0x113be9){var _0x50a0fe=[];for(var _0x5de138 in _0x19080c[_0xb5af('0x5b')]){if(_0x19080c['smsQueues'][_0xb5af('0x4c')](_0x5de138)){var _0xbbcbf7=_0x19080c[_0xb5af('0x5b')][_0x5de138];var _0x468795={'id':_0xbbcbf7['id'],'available':_0xbbcbf7[_0xb5af('0x59')],'loggedIn':_0xbbcbf7[_0xb5af('0x54')],'name':_0xbbcbf7[_0xb5af('0x55')],'paused':_0xbbcbf7[_0xb5af('0x56')],'waiting':_0xbbcbf7[_0xb5af('0x57')]};_0x50a0fe[_0xb5af('0x20')](_0x468795);}}_0x113be9({'count':_0x50a0fe[_0xb5af('0x1a')],'rows':_0x50a0fe});});},'FaxQueues':function(){return new Promise(function(_0x57f99a){var _0x3d1f42=[];for(var _0x361e60 in _0x19080c[_0xb5af('0x5c')]){if(_0x19080c[_0xb5af('0x5c')][_0xb5af('0x4c')](_0x361e60)){var _0x3c15b6=_0x19080c[_0xb5af('0x5c')][_0x361e60];var _0x2eb3ed={'id':_0x3c15b6['id'],'available':_0x3c15b6[_0xb5af('0x59')],'loggedIn':_0x3c15b6[_0xb5af('0x54')],'name':_0x3c15b6[_0xb5af('0x55')],'paused':_0x3c15b6['paused'],'waiting':_0x3c15b6[_0xb5af('0x57')]};_0x3d1f42[_0xb5af('0x20')](_0x2eb3ed);}}_0x57f99a({'count':_0x3d1f42['length'],'rows':_0x3d1f42});});},'WhatsappQueues':function(){return new Promise(function(_0x1bfc54){var _0x3c8bf5=[];for(var _0x348d8d in _0x19080c[_0xb5af('0x5d')]){if(_0x19080c[_0xb5af('0x5d')]['hasOwnProperty'](_0x348d8d)){var _0x3c18a6=_0x19080c[_0xb5af('0x5d')][_0x348d8d];var _0x35bd45={'id':_0x3c18a6['id'],'available':_0x3c18a6['available'],'loggedIn':_0x3c18a6[_0xb5af('0x54')],'name':_0x3c18a6[_0xb5af('0x55')],'paused':_0x3c18a6[_0xb5af('0x56')],'waiting':_0x3c18a6[_0xb5af('0x57')]};_0x3c8bf5[_0xb5af('0x20')](_0x35bd45);}}_0x1bfc54({'count':_0x3c8bf5[_0xb5af('0x1a')],'rows':_0x3c8bf5});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4b88e0){var _0x2446ff=_['values'](_0x19080c[_0xb5af('0x5e')]);_0x4b88e0({'count':_0x2446ff['length'],'rows':_0x2446ff});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3c8318){var _0x387f0d=_['values'](_0x19080c[_0xb5af('0x5f')]);_0x3c8318({'count':_0x387f0d[_0xb5af('0x1a')],'rows':_0x387f0d});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x530f76){var _0x448b5d=_[_0xb5af('0x51')](_0x19080c['openchannelQueuesWaitingInteractions']);_0x530f76({'count':_0x448b5d['length'],'rows':_0x448b5d});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x581709){var _0x35df03=_[_0xb5af('0x51')](_0x19080c[_0xb5af('0x60')]);_0x581709({'count':_0x35df03[_0xb5af('0x1a')],'rows':_0x35df03});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x2d4076){var _0x451565=_[_0xb5af('0x51')](_0x19080c[_0xb5af('0x61')]);_0x2d4076({'count':_0x451565['length'],'rows':_0x451565});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xed57b5){var _0x405094=_['values'](_0x19080c['whatsappQueuesWaitingInteractions']);_0xed57b5({'count':_0x405094[_0xb5af('0x1a')],'rows':_0x405094});});}};var _0x30a82c=jayson['server'](_0x56faae)[_0xb5af('0x62')]();_0x30a82c['on'](_0xb5af('0x36'),function(_0x4022a0){logger['error'](JSON[_0xb5af('0x3c')](_0x4022a0));return _0x43b934(_0x4022a0);});_0x30a82c[_0xb5af('0x13')](0x232c,'127.0.0.1',function(){console[_0xb5af('0x63')](_0xb5af('0x64'),0x232c);return _0x3c76eb(_0xb5af('0x65')+0x232c);});});}; \ No newline at end of file +var _0x4bc6=['body','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','agent','agents','QueueReport','update','UserId','message\x20is\x20empty','busy','busyQueue','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','waiting','mailQueues','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','interaction','checkWaitingNotifications','isArray','length','applications','existsSync','join','app','.js','toLowerCase','split','mail','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','message','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId'];(function(_0x186d17,_0x9fa8ef){var _0x5d4b89=function(_0x57bd70){while(--_0x57bd70){_0x186d17['push'](_0x186d17['shift']());}};_0x5d4b89(++_0x9fa8ef);}(_0x4bc6,0xfe));var _0x64bc=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x4bc6[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x64bc('0x0'));var util=require(_0x64bc('0x1'));var path=require(_0x64bc('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require(_0x64bc('0x3'));var logger=require(_0x64bc('0x4'))(_0x64bc('0x5'));var rpc={'openchannelQueueReport':require(_0x64bc('0x6')),'mailQueueReport':require(_0x64bc('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x64bc('0x8')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x64bc('0x9'));function getId(_0x49394d,_0x410eb5,_0x453748){return util[_0x64bc('0xa')](_0x64bc('0xb'),_0x49394d,_0x410eb5||0x0,_0x453748||0x0);}function getIntervals(_0x1a5b9b,_0x1453b9){var _0x3010d9=[];if(!_[_0x64bc('0xc')](_0x1453b9[_0x64bc('0xd')])&&!_['isNil'](_0x1a5b9b[_0x1453b9[_0x64bc('0xd')]])&&!_[_0x64bc('0xc')](_0x1a5b9b[_0x1453b9[_0x64bc('0xd')]]['Intervals'])){_0x3010d9=_[_0x64bc('0xe')](_0x1a5b9b[_0x1453b9[_0x64bc('0xd')]][_0x64bc('0xf')],'interval');}else if(!_[_0x64bc('0xc')](_0x1453b9[_0x64bc('0x10')])){_0x3010d9=[_0x1453b9[_0x64bc('0x10')]];}return _0x3010d9;}exports[_0x64bc('0x11')]=function(_0x5775a2){_0x5775a2[_0x64bc('0x12')]={};return new BPromise(function(_0x372664,_0x55bb60){var _0x40cc0a={'Start':function(_0x1c3967){var _0x4f3505=this;return new Promise(function(_0x21c775,_0x5b34d7){if(_0x1c3967){try{var _0x4376d1=[];var _0x51a9cc=getId(_0x1c3967[_0x64bc('0x13')],_0x1c3967['message']?_0x1c3967['message']['id']:0x0,_0x1c3967[_0x64bc('0x14')]?_0x1c3967['interaction']['id']:0x0);var _0x31ec61=sUtils[_0x64bc('0x15')](_0x5775a2,_0x1c3967);if(!_0x31ec61&&_0x1c3967['applications']&&_[_0x64bc('0x16')](_0x1c3967['applications'])&&_0x1c3967['applications'][_0x64bc('0x17')]){for(var _0x549844=0x0;_0x549844<_0x1c3967[_0x64bc('0x18')][_0x64bc('0x17')];_0x549844+=0x1){var _0x2172b8=_0x1c3967[_0x64bc('0x18')][_0x549844];if(fs[_0x64bc('0x19')](path[_0x64bc('0x1a')](__dirname,'applications',_0x2172b8[_0x64bc('0x1b')]+_0x64bc('0x1c')))){var _0x35ba38=[];switch(_0x2172b8[_0x64bc('0x1b')][_0x64bc('0x1d')]()){case'autoreply':var _0x4b0afd=_0x2172b8['appdata'][_0x64bc('0x1e')](',');if(_0x1c3967[_0x64bc('0x13')]===_0x64bc('0x1f')){_0x35ba38['push'](_0x4b0afd[0x0]);_0x35ba38[_0x64bc('0x20')](_0x4b0afd[0x1]);_0x35ba38[_0x64bc('0x20')](_0x4b0afd[_0x64bc('0x21')](0x2,_0x4b0afd[_0x64bc('0x17')])['join'](','));}else{_0x35ba38[_0x64bc('0x20')](_0x4b0afd[0x0]);_0x35ba38[_0x64bc('0x20')](_0x4b0afd[_0x64bc('0x21')](0x1,_0x4b0afd[_0x64bc('0x17')])[_0x64bc('0x1a')](','));}break;case _0x64bc('0x22'):var _0x26fdbc=_0x2172b8[_0x64bc('0x23')]['split'](',');_0x35ba38[_0x64bc('0x20')](_0x26fdbc[0x0]);_0x35ba38[_0x64bc('0x20')](_0x26fdbc[0x1]);_0x35ba38[_0x64bc('0x20')](_0x26fdbc[_0x64bc('0x21')](0x2,_0x26fdbc[_0x64bc('0x17')])['join'](','));break;case _0x64bc('0x24'):var _0x4bcf97=_0x2172b8[_0x64bc('0x23')][_0x64bc('0x1e')](',');_0x35ba38[_0x64bc('0x20')](_0x4bcf97[0x0]);_0x35ba38[_0x64bc('0x20')](_0x4bcf97[0x1]);_0x35ba38[_0x64bc('0x20')](_0x4bcf97[0x2]);_0x35ba38[_0x64bc('0x20')](_0x4bcf97[0x3]);_0x35ba38[_0x64bc('0x20')](_0x4bcf97[_0x64bc('0x21')](0x4,_0x4bcf97[_0x64bc('0x17')])[_0x64bc('0x1a')](','));break;case _0x64bc('0x25'):var _0x5c22b3=_0x2172b8[_0x64bc('0x23')]['split'](',');_0x35ba38[_0x64bc('0x20')](_0x5c22b3[0x0]);_0x35ba38[_0x64bc('0x20')](_0x5c22b3[0x1]);_0x35ba38['push'](_0x5c22b3[0x2]);_0x35ba38['push'](_0x5c22b3[0x3]);_0x35ba38[_0x64bc('0x20')](_0x5c22b3[_0x64bc('0x21')](0x4,_0x5c22b3[_0x64bc('0x17')])[_0x64bc('0x1a')](','));break;case _0x64bc('0x26'):_0x35ba38[_0x64bc('0x20')](_0x2172b8[_0x64bc('0x23')]);break;case _0x64bc('0x27'):_0x35ba38[_0x64bc('0x20')](_0x2172b8[_0x64bc('0x28')]);_0x35ba38['push'](_0x2172b8[_0x64bc('0x23')]);break;case'tvox':var _0x283ac7=utils[_0x64bc('0x29')](_0x1c3967[_0x64bc('0x2a')][_0x64bc('0x2b')],_0x1c3967);var _0x176d6c=_0x2172b8[_0x64bc('0x23')]['split'](',');_0x35ba38[_0x64bc('0x20')](_0x176d6c[0x0]);_0x35ba38[_0x64bc('0x20')](_0x176d6c[0x1]);_0x35ba38['push'](_0x176d6c[0x2]);_0x35ba38[_0x64bc('0x20')](_0x176d6c[0x3]);_0x35ba38['push'](_0x176d6c[0x4]);_0x35ba38[_0x64bc('0x20')](_0x176d6c[0x5]);_0x35ba38['push'](_0x176d6c[0x6]);_0x35ba38[_0x64bc('0x20')](_0x176d6c[0x7]);_0x35ba38[_0x64bc('0x20')](_0x176d6c[0x8]);_0x35ba38[_0x64bc('0x20')](_0x176d6c[0x9]);_0x35ba38[_0x64bc('0x20')](_0x176d6c[0xa]);_0x35ba38[_0x64bc('0x20')](_0x1c3967['interaction']['id']);_0x35ba38['push'](_0x1c3967['message']['id']);_0x35ba38[_0x64bc('0x20')](_0x2172b8[_0x64bc('0x2c')]);_0x35ba38[_0x64bc('0x20')](_0x1c3967[_0x64bc('0x14')][_0x64bc('0x2d')]);_0x35ba38['push'](_0x1c3967['body'][_0x64bc('0x2e')]);_0x35ba38['push'](_0x283ac7);break;default:_0x35ba38=_[_0x64bc('0xc')](_0x2172b8[_0x64bc('0x23')])?[]:_0x2172b8[_0x64bc('0x23')][_0x64bc('0x1e')](',');}var _0xb02451={'id':util[_0x64bc('0xa')](_0x64bc('0x2f'),_0x51a9cc,_0x2172b8['id'],_0x2172b8[_0x64bc('0x1b')]),'condition':require(_0x64bc('0x30'))['condition'](_0x51a9cc,getIntervals(_0x5775a2[_0x64bc('0x31')],_0x2172b8),_0x5775a2),'consequence':require(_0x64bc('0x32')+_0x2172b8[_0x64bc('0x1b')])[_0x64bc('0x33')](_0x51a9cc,_0x35ba38,_0x5775a2,_0x1c3967),'p':_0x2172b8[_0x64bc('0x34')]||0x0};logger[_0x64bc('0x35')](_0x64bc('0x36'),_0xb02451['id'],'on\x20interval',getIntervals(_0x5775a2['intervals'],_0x2172b8)['join'](_0x64bc('0x37')));_0x4376d1[_0x64bc('0x20')](_0xb02451);}else{logger['error'](_0x64bc('0x38'),path[_0x64bc('0x1a')](__dirname,_0x64bc('0x18'),_0x2172b8[_0x64bc('0x1b')]+_0x64bc('0x1c')));}}_0x5775a2['rules'][_0x51a9cc]=new RuleEngine(_0x4376d1);_0x5775a2[_0x64bc('0x12')][_0x51a9cc][_0x64bc('0x39')](_0x1c3967,function(_0x51e0cd){logger[_0x64bc('0x35')](_0x64bc('0x3a'),JSON[_0x64bc('0x3b')](_0x51e0cd['matchPath']));if(_0x5775a2['rules'][_0x51a9cc]){_0x5775a2['rules'][_0x51a9cc][_0x64bc('0x3c')](_0x64bc('0x3d'));}});return _0x21c775({'code':0xc8,'message':_0x1c3967});}else{if(_0x31ec61){logger[_0x64bc('0x35')](util['format'](_0x64bc('0x3e'),_0x51a9cc));}else{logger[_0x64bc('0x35')](_0x64bc('0x3f'));}return _0x21c775({'code':0xc8,'message':_0x1c3967});}}catch(_0x2db069){logger[_0x64bc('0x40')](_0x2db069[_0x64bc('0x41')]);return _0x5b34d7(_0x4f3505[_0x64bc('0x40')](0x1f4,_0x2db069));}}return _0x5b34d7('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4f354a){var _0x20f719=this;return new Promise(function(_0x26f5cd,_0x511c17){if(_0x4f354a[_0x64bc('0x42')]&&_0x4f354a[_0x64bc('0x42')]['id']){if(_0x5775a2['agents'][_0x4f354a[_0x64bc('0x42')]['id']]){_0x5775a2[_0x64bc('0x43')][_0x4f354a['agent']['id']]['busy']=![];_0x5775a2[_0x64bc('0x43')][_0x4f354a[_0x64bc('0x42')]['id']]['busyQueue']=undefined;}}if(_0x4f354a[_0x64bc('0x26')]&&_0x4f354a[_0x64bc('0x26')]['id']){try{var _0x353751=getId(_0x4f354a['channel'],_0x4f354a['message']?_0x4f354a[_0x64bc('0x26')]['id']:0x0,_0x4f354a[_0x64bc('0x14')]?_0x4f354a['interaction']['id']:0x0);if(_0x5775a2[_0x64bc('0x12')][_0x353751]){_0x5775a2[_0x64bc('0x12')][_0x353751][_0x64bc('0x3c')]('end');if(rpc[_0x4f354a[_0x64bc('0x13')]+'QueueReport']){rpc[_0x4f354a['channel']+_0x64bc('0x44')][_0x64bc('0x45')](_0x353751,{'UserId':_0x4f354a[_0x64bc('0x26')][_0x64bc('0x46')]})['catch'](function(){logger['error']('error\x20update\x20queue\x20report');});}}return _0x26f5cd({'code':0xc8,'message':_0x4f354a});}catch(_0x28dab8){logger[_0x64bc('0x40')](_0x28dab8['stack']);return _0x511c17(_0x20f719[_0x64bc('0x40')](0x1f4,_0x28dab8));}}logger[_0x64bc('0x40')]('message\x20is\x20empty');return _0x511c17(_0x20f719[_0x64bc('0x40')](0x1f4,_0x64bc('0x47')));});},'RejectMessage':function(_0x370574){var _0x784942=this;return new Promise(function(_0x2c0516,_0xb959ac){if(_0x370574[_0x64bc('0x42')]&&_0x370574['agent']['id']){try{if(_0x5775a2[_0x64bc('0x43')][_0x370574[_0x64bc('0x42')]['id']]){_0x5775a2['agents'][_0x370574[_0x64bc('0x42')]['id']][_0x64bc('0x48')]=![];_0x5775a2[_0x64bc('0x43')][_0x370574['agent']['id']][_0x64bc('0x49')]=undefined;}return _0x2c0516({'code':0xc8,'message':_0x370574});}catch(_0x593cea){logger[_0x64bc('0x40')](_0x593cea['stack']);return _0xb959ac(_0x784942['error'](0x1f4,_0x593cea));}}logger[_0x64bc('0x40')](_0x64bc('0x47'));return _0xb959ac(_0x784942[_0x64bc('0x40')](0x1f4,_0x64bc('0x47')));});},'AbandonInteraction':function(_0x3b551c){var _0x28d51d=this;return new Promise(function(_0x1256d0,_0x571e6f){if(_0x3b551c[_0x64bc('0x13')]&&_0x3b551c[_0x64bc('0x14')]&&_0x3b551c[_0x64bc('0x14')]['id']){try{var _0x3119cc=getId(_0x3b551c[_0x64bc('0x13')],_0x3b551c[_0x64bc('0x26')]?_0x3b551c['message']['id']:0x0,_0x3b551c[_0x64bc('0x14')]?_0x3b551c[_0x64bc('0x14')]['id']:0x0);if(_0x5775a2[_0x64bc('0x12')][_0x3119cc]){_0x5775a2['rules'][_0x3119cc]['emit']('end');}return _0x1256d0({'code':0xc8,'message':_0x3b551c});}catch(_0x1c75f0){logger[_0x64bc('0x40')](_0x1c75f0['stack']);return _0x571e6f(_0x28d51d['error'](0x1f4,_0x1c75f0));}}logger['error']('message\x20is\x20empty');return _0x571e6f(_0x28d51d['error'](0x1f4,_0x64bc('0x47')));});},'AgentCapacity':function(_0x4efe0b){var _0x3a83cc=this;return new Promise(function(_0x3840ef,_0x35ab86){if(_0x5775a2[_0x64bc('0x43')]['hasOwnProperty'](_0x4efe0b['id'])){for(var _0x26ba15 in _0x4efe0b[_0x64bc('0x4a')]){if(_0x4efe0b[_0x64bc('0x4a')]['hasOwnProperty'](_0x26ba15)){if(_0x5775a2[_0x64bc('0x43')][_0x4efe0b['id']][_0x64bc('0x4b')](_0x26ba15+_0x64bc('0x4c'))){_0x5775a2['agents'][_0x4efe0b['id']][_0x26ba15+_0x64bc('0x4c')]=parseInt(_0x4efe0b['capacity'][_0x26ba15],0xa);}}}_0x5775a2[_0x64bc('0x43')][_0x4efe0b['id']][_0x64bc('0x4d')]();return _0x3840ef({'code':0xc8,'message':_0x5775a2['agents'][_0x4efe0b['id']]});}else{return _0x35ab86(_0x3a83cc[_0x64bc('0x40')](0x1f4,_0x64bc('0x4e')));}});},'Agents':function(_0x10023e){return new Promise(function(_0xd8b5e4){var _0x132410=_[_0x64bc('0x4f')](_0x5775a2['agents']);if(_0x10023e&&_0x10023e['id']){var _0x271882=_['find'](_0x132410,function(_0x44b97d){return _0x44b97d['id']===_0x10023e['id'];});_0xd8b5e4(_0x271882);}else{_0xd8b5e4({'count':_0x132410['length'],'rows':_0x132410});}});},'ChatQueues':function(){return new Promise(function(_0x40948d){var _0x5970e4=[];for(var _0xfa2b33 in _0x5775a2[_0x64bc('0x50')]){if(_0x5775a2[_0x64bc('0x50')][_0x64bc('0x4b')](_0xfa2b33)){var _0x5e6bfc=_0x5775a2[_0x64bc('0x50')][_0xfa2b33];var _0x4f6a35={'id':_0x5e6bfc['id'],'available':_0x5e6bfc[_0x64bc('0x51')],'loggedIn':_0x5e6bfc[_0x64bc('0x52')],'name':_0x5e6bfc['name'],'paused':_0x5e6bfc['paused'],'waiting':_0x5e6bfc[_0x64bc('0x53')]};_0x5970e4[_0x64bc('0x20')](_0x4f6a35);}}_0x40948d({'count':_0x5970e4['length'],'rows':_0x5970e4});});},'MailQueues':function(){return new Promise(function(_0x25e026){var _0x51d2dd=[];for(var _0x275fb8 in _0x5775a2[_0x64bc('0x54')]){if(_0x5775a2['mailQueues'][_0x64bc('0x4b')](_0x275fb8)){var _0x3671ca=_0x5775a2[_0x64bc('0x54')][_0x275fb8];var _0x2a9935={'id':_0x3671ca['id'],'available':_0x3671ca[_0x64bc('0x51')],'loggedIn':_0x3671ca['loggedIn'],'name':_0x3671ca[_0x64bc('0x55')],'paused':_0x3671ca[_0x64bc('0x56')],'waiting':_0x3671ca['waiting']};_0x51d2dd['push'](_0x2a9935);}}_0x25e026({'count':_0x51d2dd['length'],'rows':_0x51d2dd});});},'OpenchannelQueues':function(){return new Promise(function(_0x5d36eb){var _0xc11ed8=[];for(var _0x564f51 in _0x5775a2[_0x64bc('0x57')]){if(_0x5775a2[_0x64bc('0x57')][_0x64bc('0x4b')](_0x564f51)){var _0x14f86b=_0x5775a2['openchannelQueues'][_0x564f51];var _0x210492={'id':_0x14f86b['id'],'available':_0x14f86b['available'],'loggedIn':_0x14f86b['loggedIn'],'name':_0x14f86b[_0x64bc('0x55')],'paused':_0x14f86b['paused'],'waiting':_0x14f86b['waiting']};_0xc11ed8[_0x64bc('0x20')](_0x210492);}}_0x5d36eb({'count':_0xc11ed8[_0x64bc('0x17')],'rows':_0xc11ed8});});},'SmsQueues':function(){return new Promise(function(_0x1bfd1e){var _0xaecb27=[];for(var _0x4c284c in _0x5775a2[_0x64bc('0x58')]){if(_0x5775a2[_0x64bc('0x58')]['hasOwnProperty'](_0x4c284c)){var _0x1488be=_0x5775a2[_0x64bc('0x58')][_0x4c284c];var _0x5030f8={'id':_0x1488be['id'],'available':_0x1488be[_0x64bc('0x51')],'loggedIn':_0x1488be[_0x64bc('0x52')],'name':_0x1488be['name'],'paused':_0x1488be['paused'],'waiting':_0x1488be['waiting']};_0xaecb27[_0x64bc('0x20')](_0x5030f8);}}_0x1bfd1e({'count':_0xaecb27[_0x64bc('0x17')],'rows':_0xaecb27});});},'FaxQueues':function(){return new Promise(function(_0x435b9f){var _0x15db02=[];for(var _0x2ca8d2 in _0x5775a2[_0x64bc('0x59')]){if(_0x5775a2[_0x64bc('0x59')][_0x64bc('0x4b')](_0x2ca8d2)){var _0x22e327=_0x5775a2[_0x64bc('0x59')][_0x2ca8d2];var _0x63cb1c={'id':_0x22e327['id'],'available':_0x22e327[_0x64bc('0x51')],'loggedIn':_0x22e327['loggedIn'],'name':_0x22e327[_0x64bc('0x55')],'paused':_0x22e327['paused'],'waiting':_0x22e327[_0x64bc('0x53')]};_0x15db02[_0x64bc('0x20')](_0x63cb1c);}}_0x435b9f({'count':_0x15db02[_0x64bc('0x17')],'rows':_0x15db02});});},'WhatsappQueues':function(){return new Promise(function(_0x4c8ab7){var _0x42ec5c=[];for(var _0xcd8656 in _0x5775a2[_0x64bc('0x5a')]){if(_0x5775a2[_0x64bc('0x5a')][_0x64bc('0x4b')](_0xcd8656)){var _0x2c1d7b=_0x5775a2[_0x64bc('0x5a')][_0xcd8656];var _0xe0f995={'id':_0x2c1d7b['id'],'available':_0x2c1d7b[_0x64bc('0x51')],'loggedIn':_0x2c1d7b[_0x64bc('0x52')],'name':_0x2c1d7b[_0x64bc('0x55')],'paused':_0x2c1d7b['paused'],'waiting':_0x2c1d7b['waiting']};_0x42ec5c['push'](_0xe0f995);}}_0x4c8ab7({'count':_0x42ec5c[_0x64bc('0x17')],'rows':_0x42ec5c});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2ee7c5){var _0x25837a=_[_0x64bc('0x4f')](_0x5775a2[_0x64bc('0x5b')]);_0x2ee7c5({'count':_0x25837a[_0x64bc('0x17')],'rows':_0x25837a});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x10a7d9){var _0x2a4f79=_['values'](_0x5775a2[_0x64bc('0x5c')]);_0x10a7d9({'count':_0x2a4f79[_0x64bc('0x17')],'rows':_0x2a4f79});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x1531a3){var _0x3287c9=_[_0x64bc('0x4f')](_0x5775a2[_0x64bc('0x5d')]);_0x1531a3({'count':_0x3287c9['length'],'rows':_0x3287c9});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3b09a4){var _0x2d469b=_[_0x64bc('0x4f')](_0x5775a2[_0x64bc('0x5e')]);_0x3b09a4({'count':_0x2d469b['length'],'rows':_0x2d469b});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x411720){var _0x31ac01=_[_0x64bc('0x4f')](_0x5775a2[_0x64bc('0x5f')]);_0x411720({'count':_0x31ac01['length'],'rows':_0x31ac01});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x1dbada){var _0x21f015=_[_0x64bc('0x4f')](_0x5775a2['whatsappQueuesWaitingInteractions']);_0x1dbada({'count':_0x21f015[_0x64bc('0x17')],'rows':_0x21f015});});}};var _0x4e7aac=jayson[_0x64bc('0x60')](_0x40cc0a)[_0x64bc('0x61')]();_0x4e7aac['on']('error',function(_0x3bccfc){logger[_0x64bc('0x40')](JSON[_0x64bc('0x3b')](_0x3bccfc));return _0x55bb60(_0x3bccfc);});_0x4e7aac[_0x64bc('0x11')](0x232c,_0x64bc('0x62'),function(){console['log'](_0x64bc('0x63'),0x232c);return _0x372664('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 36191b8..4abad9f 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 _0xc992=['indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','log','\x20|\x20','util','bluebird','jayson/promise','../../../config/logger','client','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s'];(function(_0x295945,_0x17b00a){var _0x4d638c=function(_0x2b2181){while(--_0x2b2181){_0x295945['push'](_0x295945['shift']());}};_0x4d638c(++_0x17b00a);}(_0xc992,0x1bc));var _0x2c99=function(_0x462497,_0xcbedb7){_0x462497=_0x462497-0x0;var _0xe36449=_0xc992[_0x462497];return _0xe36449;};'use strict';var util=require(_0x2c99('0x0'));var BPromise=require(_0x2c99('0x1'));var jayson=require(_0x2c99('0x2'));var _=require('lodash');var logger=require(_0x2c99('0x3'))('routing');var client=jayson[_0x2c99('0x4')]['http']({'port':0x232a});function request(_0x4f9731,_0x99db9b){return new BPromise(function(_0x7aeee8,_0x1596a8){return client['request'](_0x4f9731,_0x99db9b)[_0x2c99('0x5')](function(_0x20755c){if(_0x20755c[_0x2c99('0x6')]){return _0x1596a8(_0x20755c[_0x2c99('0x6')][_0x2c99('0x7')]);}else{return _0x7aeee8(_0x20755c[_0x2c99('0x8')]);}})[_0x2c99('0x9')](function(_0x1e0150){return _0x1596a8(_0x1e0150);});});}exports[_0x2c99('0xa')]=function(_0x5a13dd,_0x3b99e2,_0x5269ad){return function(_0x1edaa0){if(_0x5269ad[_0x2c99('0xb')]&&!_0x5269ad[_0x2c99('0xb')][_0x5a13dd]){logger[_0x2c99('0xc')](_0x2c99('0xd'),_0x5a13dd);return _0x1edaa0[_0x2c99('0xe')]();}var _0xed5229=[];for(var _0x23e73a=0x0;_0x23e73a<_0x3b99e2[_0x2c99('0xf')];_0x23e73a+=0x1){_0xed5229[_0x2c99('0x10')](request(_0x2c99('0x11'),{'command':util[_0x2c99('0x12')](_0x2c99('0x13'),_0x3b99e2[_0x23e73a])})[_0x2c99('0x5')](function(_0x3cb726){return _0x3cb726&&_0x3cb726[_0x2c99('0x7')]&&_0x3cb726[_0x2c99('0x7')][_0x2c99('0x14')](_0x2c99('0x15'))>=0x0?!![]:![];})[_0x2c99('0x9')](function(_0x13c675){logger[_0x2c99('0x6')](_0x2c99('0x16'),_0x5a13dd,_0x3b99e2[_0x23e73a]);}));}BPromise[_0x2c99('0x17')](_0xed5229)[_0x2c99('0x5')](function(_0x469179){var _0x37cc8a=_[_0x2c99('0x18')](_0x469179);logger[_0x2c99('0xc')](_0x2c99('0x19'),_0x5a13dd,_0x3b99e2[_0x2c99('0x1a')]('\x20|\x20'),_0x37cc8a);_0x1edaa0['when'](_0x37cc8a);})[_0x2c99('0x9')](function(_0x386c4f){console[_0x2c99('0x1b')](_0x386c4f);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x5a13dd,_0x3b99e2['join'](_0x2c99('0x1c')),_0x386c4f['stack']);_0x1edaa0['stop']();});};}; \ No newline at end of file +var _0x62cf=['client','http','request','then','error','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','catch','log','stack','bluebird','jayson/promise','lodash','../../../config/logger'];(function(_0xf67957,_0x17ab63){var _0x26f414=function(_0x3353ea){while(--_0x3353ea){_0xf67957['push'](_0xf67957['shift']());}};_0x26f414(++_0x17ab63);}(_0x62cf,0x164));var _0xf62c=function(_0x958575,_0x368ef1){_0x958575=_0x958575-0x0;var _0x31f929=_0x62cf[_0x958575];return _0x31f929;};'use strict';var util=require('util');var BPromise=require(_0xf62c('0x0'));var jayson=require(_0xf62c('0x1'));var _=require(_0xf62c('0x2'));var logger=require(_0xf62c('0x3'))('routing');var client=jayson[_0xf62c('0x4')][_0xf62c('0x5')]({'port':0x232a});function request(_0x108b74,_0x6cb15b){return new BPromise(function(_0xec9cfc,_0x1c21ce){return client[_0xf62c('0x6')](_0x108b74,_0x6cb15b)[_0xf62c('0x7')](function(_0x2b83d0){if(_0x2b83d0[_0xf62c('0x8')]){return _0x1c21ce(_0x2b83d0[_0xf62c('0x8')]['message']);}else{return _0xec9cfc(_0x2b83d0['result']);}})['catch'](function(_0x346b81){return _0x1c21ce(_0x346b81);});});}exports[_0xf62c('0x9')]=function(_0xeda78a,_0x389edb,_0x3d729d){return function(_0x2b1e28){if(_0x3d729d[_0xf62c('0xa')]&&!_0x3d729d[_0xf62c('0xa')][_0xeda78a]){logger[_0xf62c('0xb')](_0xf62c('0xc'),_0xeda78a);return _0x2b1e28[_0xf62c('0xd')]();}var _0x3253d7=[];for(var _0x4759dd=0x0;_0x4759dd<_0x389edb['length'];_0x4759dd+=0x1){_0x3253d7[_0xf62c('0xe')](request(_0xf62c('0xf'),{'command':util[_0xf62c('0x10')](_0xf62c('0x11'),_0x389edb[_0x4759dd])})[_0xf62c('0x7')](function(_0xa609b9){return _0xa609b9&&_0xa609b9[_0xf62c('0x12')]&&_0xa609b9[_0xf62c('0x12')][_0xf62c('0x13')](_0xf62c('0x14'))>=0x0?!![]:![];})['catch'](function(_0xe97f58){logger[_0xf62c('0x8')](_0xf62c('0x15'),_0xeda78a,_0x389edb[_0x4759dd]);}));}BPromise[_0xf62c('0x16')](_0x3253d7)[_0xf62c('0x7')](function(_0x18fb49){var _0x1784f7=_[_0xf62c('0x17')](_0x18fb49);logger[_0xf62c('0xb')](_0xf62c('0x18'),_0xeda78a,_0x389edb[_0xf62c('0x19')](_0xf62c('0x1a')),_0x1784f7);_0x2b1e28['when'](_0x1784f7);})[_0xf62c('0x1b')](function(_0x5d18f3){console[_0xf62c('0x1c')](_0x5d18f3);logger[_0xf62c('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0xeda78a,_0x389edb[_0xf62c('0x19')]('\x20|\x20'),_0x5d18f3[_0xf62c('0x1d')]);_0x2b1e28['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index bc57ec2..dd63070 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 _0xe205=['interface','calleridnum','then','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','lastevent','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','debug','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswer','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','transfertargetuniqueid','clone','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe205,0xa7));var _0x5e20=function(_0xe2314,_0xdbd81){_0xe2314=_0xe2314-0x0;var _0xcbb8f=_0xe205[_0xe2314];return _0xcbb8f;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var utils=require(_0x5e20('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3cdbb0,_0x6c1585){utils[_0x5e20('0x3')](util[_0x5e20('0x4')](_0x5e20('0x5'),_0x3cdbb0[_0x5e20('0x6')],_0x3cdbb0['channel'],_0x3cdbb0[_0x5e20('0x7')],_0x3cdbb0[_0x5e20('0x8')],_0x3cdbb0[_0x5e20('0x9')],_0x3cdbb0[_0x5e20('0xa')],_0x3cdbb0['connectedlinenum'],_0x3cdbb0['lastevent']));if(_0x3cdbb0[_0x5e20('0x7')]){utils['getVoiceQueueByName'](_0x3cdbb0['queue'])[_0x5e20('0xb')](function(_0x28c142){if(_0x28c142){_0x3cdbb0['type']=_0x28c142[_0x5e20('0xc')];_0x3cdbb0[_0x5e20('0xd')]=_0x3cdbb0[_0x5e20('0xe')]?_0x28c142[_0x5e20('0xf')]:![];_0x3cdbb0['acwtime']=_0x3cdbb0[_0x5e20('0xd')]?_0x28c142[_0x5e20('0x10')]:0x0;}utils[_0x5e20('0x11')](_0x5e20('0x12'),_0x3cdbb0);});}else{utils[_0x5e20('0x11')](_0x5e20('0x12'),_0x3cdbb0);}if(_0x6c1585){delete transfers[_0x3cdbb0['uniqueid']];}else{delete agents[_0x3cdbb0[_0x5e20('0x13')]];}}exports[_0x5e20('0x14')]=function(_0x22540d){try{utils['debug'](util[_0x5e20('0x4')]('[%s][agents][agentcalled]',_0x22540d[_0x5e20('0x6')]),_0x22540d);agents[_0x22540d['destuniqueid']]=_0x22540d;agents[_0x22540d[_0x5e20('0x13')]][_0x5e20('0x15')]=utils[_0x5e20('0x16')]();agents[_0x22540d[_0x5e20('0x13')]][_0x5e20('0x17')]='called';agents[_0x22540d[_0x5e20('0x13')]][_0x5e20('0x18')]=null;agents[_0x22540d[_0x5e20('0x13')]][_0x5e20('0x19')]=null;utils[_0x5e20('0x3')](util[_0x5e20('0x4')](_0x5e20('0x1a'),_0x22540d[_0x5e20('0x6')],agents[_0x22540d['destuniqueid']][_0x5e20('0x8')],_0x22540d[_0x5e20('0x13')]));}catch(_0x4f900b){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')](_0x5e20('0x1c'),_0x22540d[_0x5e20('0x6')]),_0x4f900b);}};exports['agentringnoanswer']=function(_0x2954fc){try{if(!_['isNil'](agents[_0x2954fc['destuniqueid']])){utils['debug'](util['format'](_0x5e20('0x1d'),_0x2954fc['uniqueid']),_0x2954fc);utils[_0x5e20('0x3')](util[_0x5e20('0x4')](_0x5e20('0x1e'),_0x2954fc[_0x5e20('0x6')],agents[_0x2954fc[_0x5e20('0x13')]][_0x5e20('0x8')],_0x2954fc['destuniqueid']));agents[_0x2954fc[_0x5e20('0x13')]]['agentringnoanswer']=!![];agents[_0x2954fc['destuniqueid']][_0x5e20('0x1f')]=utils[_0x5e20('0x16')]();agents[_0x2954fc[_0x5e20('0x13')]][_0x5e20('0x17')]=_0x5e20('0x20');agents[_0x2954fc[_0x5e20('0x13')]][_0x5e20('0x21')]='timeout';agents[_0x2954fc[_0x5e20('0x13')]][_0x5e20('0x22')]=_0x2954fc[_0x5e20('0x23')]?parseInt(_0x2954fc[_0x5e20('0x23')])/0x3e8:0x0;agents[_0x2954fc['destuniqueid']][_0x5e20('0x24')]=0x0;unanswered[_0x5e20('0x25')](_0x2954fc[_0x5e20('0x13')]);}}catch(_0x222e7a){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')]('[%s][agents][agentringnoanswer]',_0x2954fc[_0x5e20('0x6')]),_0x222e7a);}};exports[_0x5e20('0x26')]=function(_0x543c29){try{_[_0x5e20('0x27')](agents,function(_0x21d1d8,_0x335f1e){if(_0x21d1d8[_0x5e20('0x6')]==_0x543c29[_0x5e20('0x6')]&&!_[_0x5e20('0x28')](unanswered,_0x21d1d8['destuniqueid'])){utils[_0x5e20('0x29')](util[_0x5e20('0x4')](_0x5e20('0x2a'),_0x543c29[_0x5e20('0x6')]),_0x543c29);utils[_0x5e20('0x3')](util[_0x5e20('0x4')](_0x5e20('0x2b'),_0x543c29[_0x5e20('0x6')],_0x21d1d8[_0x5e20('0x8')],_0x21d1d8[_0x5e20('0x13')]));_0x21d1d8[_0x5e20('0x2c')]=!![];_0x21d1d8['agentringnoanswerAt']=utils[_0x5e20('0x16')]();_0x21d1d8[_0x5e20('0x17')]=_0x5e20('0x2d');_0x21d1d8['reason']=_0x5e20('0x2d');_0x21d1d8[_0x5e20('0x22')]=_0x543c29[_0x5e20('0x22')];_0x21d1d8[_0x5e20('0x24')]=0x0;writeDB(_0x21d1d8);}});}catch(_0x244209){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')](_0x5e20('0x2a'),_0x543c29[_0x5e20('0x6')]),_0x244209);}};exports[_0x5e20('0x2e')]=function(_0x36e825){try{if(agents[_0x36e825[_0x5e20('0x13')]]){utils[_0x5e20('0x29')](util[_0x5e20('0x4')]('[%s][agents][agentconnect]',_0x36e825[_0x5e20('0x6')]),_0x36e825);utils['info'](util['format'](_0x5e20('0x2f'),_0x36e825[_0x5e20('0x6')],agents[_0x36e825['destuniqueid']][_0x5e20('0x8')],_0x36e825[_0x5e20('0x13')]));agents[_0x36e825['destuniqueid']][_0x5e20('0x30')]=utils[_0x5e20('0x16')]();agents[_0x36e825[_0x5e20('0x13')]][_0x5e20('0x18')]=_0x36e825[_0x5e20('0x18')];agents[_0x36e825[_0x5e20('0x13')]][_0x5e20('0x19')]=_0x36e825[_0x5e20('0x19')];agents[_0x36e825[_0x5e20('0x13')]][_0x5e20('0x22')]=_0x36e825[_0x5e20('0x23')];agents[_0x36e825[_0x5e20('0x13')]][_0x5e20('0x17')]=_0x5e20('0x31');_[_0x5e20('0x27')](agents,function(_0x3d618c,_0x20e83d){if(_0x3d618c[_0x5e20('0x13')]!=_0x36e825['destuniqueid']&&_0x3d618c[_0x5e20('0x6')]==_0x36e825[_0x5e20('0x6')]){_0x3d618c[_0x5e20('0x24')]=0x0;_0x3d618c[_0x5e20('0x22')]=_0x36e825[_0x5e20('0x23')];_0x3d618c['agentringnoanswer']=!![];_0x3d618c[_0x5e20('0x1f')]=utils[_0x5e20('0x16')]();_0x3d618c[_0x5e20('0x17')]=_0x5e20('0x32');_0x3d618c[_0x5e20('0x21')]=_0x5e20('0x32');_0x3d618c['answeredelsewheredestinationuniqueid']=_0x36e825[_0x5e20('0x13')];_0x3d618c[_0x5e20('0x33')]=_0x36e825[_0x5e20('0x8')];writeDB(_0x3d618c);}});}}catch(_0x5a21f0){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')](_0x5e20('0x34'),_0x36e825[_0x5e20('0x6')]),_0x5a21f0);}};exports[_0x5e20('0xe')]=function(_0x336d61){try{if(!_[_0x5e20('0x35')](agents[_0x336d61[_0x5e20('0x13')]])){utils['debug'](util[_0x5e20('0x4')](_0x5e20('0x36'),_0x336d61[_0x5e20('0x6')]),_0x336d61);utils['info'](util[_0x5e20('0x4')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x336d61[_0x5e20('0x6')],agents[_0x336d61[_0x5e20('0x13')]][_0x5e20('0x8')],_0x336d61[_0x5e20('0x13')]));agents[_0x336d61[_0x5e20('0x13')]]['agentcomplete']=!![];agents[_0x336d61[_0x5e20('0x13')]]['agentcompleteAt']=utils['now']();agents[_0x336d61[_0x5e20('0x13')]][_0x5e20('0x24')]=utils[_0x5e20('0x37')](agents[_0x336d61[_0x5e20('0x13')]][_0x5e20('0x38')],agents[_0x336d61[_0x5e20('0x13')]][_0x5e20('0x30')]);agents[_0x336d61['destuniqueid']]['reason']=_0x336d61[_0x5e20('0x21')];agents[_0x336d61[_0x5e20('0x13')]]['lastevent']=_0x5e20('0x39');writeDB(agents[_0x336d61[_0x5e20('0x13')]]);}}catch(_0xf1e97c){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')]('[%s][agents][agentcomplete]',_0x336d61[_0x5e20('0x6')]),_0xf1e97c);}};exports[_0x5e20('0x3a')]=function(_0x25491e){try{if(!_[_0x5e20('0x35')](agents[_0x25491e[_0x5e20('0x3b')]])){utils[_0x5e20('0x29')](util[_0x5e20('0x4')](_0x5e20('0x3c'),_0x25491e['uniqueid']),_0x25491e);utils['info'](util['format'](_0x5e20('0x3d'),_0x25491e[_0x5e20('0x6')],agents[_0x25491e['transfereruniqueid']][_0x5e20('0x8')],agents[_0x25491e['transfereruniqueid']][_0x5e20('0x6')]));agents[_0x25491e['transfereruniqueid']][_0x5e20('0x3e')]=!![];agents[_0x25491e['transfereruniqueid']][_0x5e20('0x3f')]=_0x5e20('0x40');agents[_0x25491e[_0x5e20('0x3b')]][_0x5e20('0x41')]=_0x25491e[_0x5e20('0x42')];agents[_0x25491e[_0x5e20('0x3b')]][_0x5e20('0x43')]=agents[_0x25491e[_0x5e20('0x3b')]][_0x5e20('0x6')];}}catch(_0x43e890){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')](_0x5e20('0x3c'),_0x25491e[_0x5e20('0x6')]),_0x43e890);}};exports[_0x5e20('0x44')]=function(_0xe7759c){try{utils[_0x5e20('0x29')](util[_0x5e20('0x4')]('[%s][agents][attendedtransfer]',_0xe7759c['origtransfereruniqueid']),_0xe7759c);if(_0xe7759c[_0x5e20('0x45')]==_0xe7759c['origtransfererlinkedid']){if(!_[_0x5e20('0x35')](agents[_0xe7759c[_0x5e20('0x46')]])){utils[_0x5e20('0x3')](util['format'](_0x5e20('0x47'),_0xe7759c[_0x5e20('0x45')],agents[_0xe7759c[_0x5e20('0x46')]]['membername']));agents[_0xe7759c['secondtransfereruniqueid']]['transfer']=!![];agents[_0xe7759c[_0x5e20('0x46')]][_0x5e20('0x3f')]=_0x5e20('0x48');agents[_0xe7759c[_0x5e20('0x46')]][_0x5e20('0x41')]=_0xe7759c[_0x5e20('0x49')];agents[_0xe7759c['secondtransfereruniqueid']][_0x5e20('0x43')]=_0xe7759c['origtransfereruniqueid'];}if(_0xe7759c[_0x5e20('0x4a')]&&agents[_0xe7759c['transfereeuniqueid']]){agents[_0xe7759c[_0x5e20('0x4a')]][_0x5e20('0x4b')]=0x1;transfers[_0xe7759c[_0x5e20('0x4a')]]=_['clone'](agents[_0xe7759c[_0x5e20('0x4a')]]);transfers[_0xe7759c[_0x5e20('0x4a')]][_0x5e20('0xa')]=agents[_0xe7759c[_0x5e20('0x46')]][_0x5e20('0xa')];transfers[_0xe7759c[_0x5e20('0x4a')]][_0x5e20('0x4c')]=agents[_0xe7759c['secondtransfereruniqueid']][_0x5e20('0x4c')];transfers[_0xe7759c[_0x5e20('0x4a')]][_0x5e20('0x15')]=utils[_0x5e20('0x16')]();transfers[_0xe7759c['transfereeuniqueid']][_0x5e20('0x30')]=utils[_0x5e20('0x16')]();transfers[_0xe7759c[_0x5e20('0x4a')]][_0x5e20('0x22')]=0x0;transfers[_0xe7759c['transfereeuniqueid']][_0x5e20('0x4b')]=0x2;}}else if(_0xe7759c[_0x5e20('0x46')]==_0xe7759c[_0x5e20('0x4d')]){if(!_['isNil'](agents[_0xe7759c['origtransfereruniqueid']])){utils['info'](util[_0x5e20('0x4')](_0x5e20('0x47'),_0xe7759c['origtransfereruniqueid'],agents[_0xe7759c[_0x5e20('0x45')]][_0x5e20('0x8')]));agents[_0xe7759c[_0x5e20('0x45')]]['transfer']=!![];agents[_0xe7759c[_0x5e20('0x45')]][_0x5e20('0x3f')]='ATTENDED';agents[_0xe7759c[_0x5e20('0x45')]][_0x5e20('0x41')]=_0xe7759c['secondtransfererexten'];agents[_0xe7759c[_0x5e20('0x45')]][_0x5e20('0x43')]=_0xe7759c[_0x5e20('0x46')];}if(_0xe7759c[_0x5e20('0x4e')]&&agents[_0xe7759c['transfertargetuniqueid']]){agents[_0xe7759c[_0x5e20('0x4e')]]['agententerreason']=0x1;transfers[_0xe7759c['transfertargetuniqueid']]=_[_0x5e20('0x4f')](agents[_0xe7759c[_0x5e20('0x4e')]]);transfers[_0xe7759c[_0x5e20('0x4e')]][_0x5e20('0xa')]=agents[_0xe7759c[_0x5e20('0x45')]][_0x5e20('0xa')];transfers[_0xe7759c['transfertargetuniqueid']]['calleridname']=agents[_0xe7759c[_0x5e20('0x45')]][_0x5e20('0x4c')];transfers[_0xe7759c[_0x5e20('0x4e')]]['agentcalledAt']=utils[_0x5e20('0x16')]();transfers[_0xe7759c[_0x5e20('0x4e')]]['agentconnectAt']=utils[_0x5e20('0x16')]();transfers[_0xe7759c['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0xe7759c[_0x5e20('0x4e')]]['agententerreason']=0x2;}}}catch(_0x3e4500){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')]('[%s][agents][attendedtransfer]',_0xe7759c[_0x5e20('0x45')]),_0x3e4500);}};exports[_0x5e20('0x50')]=function(_0xd10013){try{utils[_0x5e20('0x29')](util[_0x5e20('0x4')]('[%s][agents][hangup]',_0xd10013[_0x5e20('0x6')]),_0xd10013);if(agents[_0xd10013[_0x5e20('0x6')]]&&agents[_0xd10013['uniqueid']][_0x5e20('0x21')]===_0x5e20('0x20')){if(_0xd10013[_0x5e20('0x51')]==='21'){agents[_0xd10013['uniqueid']][_0x5e20('0x21')]=_0x5e20('0x52');agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x17')]=_0x5e20('0x52');}utils['info'](util[_0x5e20('0x4')](_0x5e20('0x53'),_0xd10013[_0x5e20('0x6')],agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x8')],agents[_0xd10013['uniqueid']][_0x5e20('0x21')],agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x17')]));writeDB(agents[_0xd10013[_0x5e20('0x6')]]);var _0x1e7cf8=unanswered[_0x5e20('0x54')](_0xd10013[_0x5e20('0x6')]);if(_0x1e7cf8>-0x1){unanswered[_0x5e20('0x55')](_0x1e7cf8,0x1);}}if(transfers[_0xd10013['uniqueid']]){transfers[_0xd10013[_0x5e20('0x6')]]['agentcomplete']=!![];transfers[_0xd10013['uniqueid']][_0x5e20('0x38')]=utils[_0x5e20('0x16')]();transfers[_0xd10013['uniqueid']][_0x5e20('0x24')]=utils[_0x5e20('0x37')](transfers[_0xd10013['uniqueid']][_0x5e20('0x38')],transfers[_0xd10013['uniqueid']][_0x5e20('0x30')]);transfers[_0xd10013['uniqueid']][_0x5e20('0x21')]=_0x5e20('0x56');transfers[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x17')]=_0x5e20('0x39');utils['info'](util[_0x5e20('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xd10013[_0x5e20('0x6')],transfers[_0xd10013['uniqueid']][_0x5e20('0x8')],transfers[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x21')],transfers[_0xd10013[_0x5e20('0x6')]]['lastevent']));writeDB(transfers[_0xd10013[_0x5e20('0x6')]],!![]);}if(agents[_0xd10013[_0x5e20('0x6')]]&&agents[_0xd10013['uniqueid']]['agentconnectAt']){agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0xe')]=!![];agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x38')]=utils[_0x5e20('0x16')]();agents[_0xd10013['uniqueid']][_0x5e20('0x24')]=utils['diffTime'](agents[_0xd10013['uniqueid']][_0x5e20('0x38')],agents[_0xd10013['uniqueid']]['agentconnectAt']);agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x21')]=agents[_0xd10013['uniqueid']][_0x5e20('0x3e')]?_0x5e20('0x3e'):_0x5e20('0x56');agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x17')]='complete';utils[_0x5e20('0x3')](util[_0x5e20('0x4')](_0x5e20('0x53'),_0xd10013[_0x5e20('0x6')],agents[_0xd10013['uniqueid']]['membername'],agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x21')],agents[_0xd10013[_0x5e20('0x6')]][_0x5e20('0x17')]));writeDB(agents[_0xd10013[_0x5e20('0x6')]]);}}catch(_0xdc9ff4){utils[_0x5e20('0x1b')](util[_0x5e20('0x4')](_0x5e20('0x57'),_0xd10013[_0x5e20('0x6')]),_0xdc9ff4);}}; \ No newline at end of file +var _0x153f=['type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','includes','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','agent','lodash','util','./utils','info','format','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x153f,0x15b));var _0xf153=function(_0x56da73,_0x5add2b){_0x56da73=_0x56da73-0x0;var _0x5a7d25=_0x153f[_0x56da73];return _0x5a7d25;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var utils=require(_0xf153('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x44cea3,_0x2afb9a){utils[_0xf153('0x3')](util[_0xf153('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x44cea3[_0xf153('0x5')],_0x44cea3['channel'],_0x44cea3[_0xf153('0x6')],_0x44cea3[_0xf153('0x7')],_0x44cea3[_0xf153('0x8')],_0x44cea3[_0xf153('0x9')],_0x44cea3[_0xf153('0xa')],_0x44cea3['lastevent']));if(_0x44cea3[_0xf153('0x6')]){utils[_0xf153('0xb')](_0x44cea3[_0xf153('0x6')])[_0xf153('0xc')](function(_0x253fd3){if(_0x253fd3){_0x44cea3[_0xf153('0xd')]=_0x253fd3[_0xf153('0xd')];_0x44cea3[_0xf153('0xe')]=_0x44cea3[_0xf153('0xf')]?_0x253fd3[_0xf153('0x10')]:![];_0x44cea3['acwtime']=_0x44cea3[_0xf153('0xe')]?_0x253fd3[_0xf153('0x11')]:0x0;}utils[_0xf153('0x12')]('CreateVoiceAgentReport',_0x44cea3);});}else{utils[_0xf153('0x12')](_0xf153('0x13'),_0x44cea3);}if(_0x2afb9a){delete transfers[_0x44cea3[_0xf153('0x5')]];}else{delete agents[_0x44cea3[_0xf153('0x14')]];}}exports[_0xf153('0x15')]=function(_0x107d31){try{utils[_0xf153('0x16')](util[_0xf153('0x4')](_0xf153('0x17'),_0x107d31['uniqueid']),_0x107d31);agents[_0x107d31[_0xf153('0x14')]]=_0x107d31;agents[_0x107d31[_0xf153('0x14')]][_0xf153('0x18')]=utils[_0xf153('0x19')]();agents[_0x107d31[_0xf153('0x14')]][_0xf153('0x1a')]=_0xf153('0x1b');agents[_0x107d31[_0xf153('0x14')]]['connectedlinenum']=null;agents[_0x107d31[_0xf153('0x14')]]['connectedlinename']=null;utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x1c'),_0x107d31[_0xf153('0x5')],agents[_0x107d31['destuniqueid']][_0xf153('0x7')],_0x107d31[_0xf153('0x14')]));}catch(_0x41946a){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x17'),_0x107d31[_0xf153('0x5')]),_0x41946a);}};exports[_0xf153('0x1e')]=function(_0x3735a7){try{if(!_[_0xf153('0x1f')](agents[_0x3735a7[_0xf153('0x14')]])){utils[_0xf153('0x16')](util['format'](_0xf153('0x20'),_0x3735a7[_0xf153('0x5')]),_0x3735a7);utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x21'),_0x3735a7[_0xf153('0x5')],agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x7')],_0x3735a7[_0xf153('0x14')]));agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x1e')]=!![];agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x22')]=utils[_0xf153('0x19')]();agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x1a')]=_0xf153('0x23');agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x24')]=_0xf153('0x23');agents[_0x3735a7['destuniqueid']][_0xf153('0x25')]=_0x3735a7[_0xf153('0x26')]?parseInt(_0x3735a7['ringtime'])/0x3e8:0x0;agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x27')]=0x0;unanswered['push'](_0x3735a7[_0xf153('0x14')]);}}catch(_0x10295e){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x20'),_0x3735a7[_0xf153('0x5')]),_0x10295e);}};exports[_0xf153('0x28')]=function(_0x3b5f4f){try{_[_0xf153('0x29')](agents,function(_0x8e31bf,_0x13b541){if(_0x8e31bf[_0xf153('0x5')]==_0x3b5f4f['uniqueid']&&!_[_0xf153('0x2a')](unanswered,_0x8e31bf[_0xf153('0x14')])){utils[_0xf153('0x16')](util[_0xf153('0x4')]('[%s][agents][queuecallerabandon]',_0x3b5f4f['uniqueid']),_0x3b5f4f);utils[_0xf153('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3b5f4f[_0xf153('0x5')],_0x8e31bf['membername'],_0x8e31bf[_0xf153('0x14')]));_0x8e31bf['agentringnoanswer']=!![];_0x8e31bf[_0xf153('0x22')]=utils[_0xf153('0x19')]();_0x8e31bf['lastevent']=_0xf153('0x2b');_0x8e31bf[_0xf153('0x24')]=_0xf153('0x2b');_0x8e31bf[_0xf153('0x25')]=_0x3b5f4f[_0xf153('0x25')];_0x8e31bf[_0xf153('0x27')]=0x0;writeDB(_0x8e31bf);}});}catch(_0x4ab69c){utils[_0xf153('0x1d')](util['format'](_0xf153('0x2c'),_0x3b5f4f[_0xf153('0x5')]),_0x4ab69c);}};exports[_0xf153('0x2d')]=function(_0x1820c3){try{if(agents[_0x1820c3[_0xf153('0x14')]]){utils[_0xf153('0x16')](util['format'](_0xf153('0x2e'),_0x1820c3[_0xf153('0x5')]),_0x1820c3);utils[_0xf153('0x3')](util['format'](_0xf153('0x2f'),_0x1820c3[_0xf153('0x5')],agents[_0x1820c3[_0xf153('0x14')]][_0xf153('0x7')],_0x1820c3[_0xf153('0x14')]));agents[_0x1820c3[_0xf153('0x14')]]['agentconnectAt']=utils[_0xf153('0x19')]();agents[_0x1820c3[_0xf153('0x14')]]['connectedlinenum']=_0x1820c3[_0xf153('0xa')];agents[_0x1820c3[_0xf153('0x14')]][_0xf153('0x30')]=_0x1820c3[_0xf153('0x30')];agents[_0x1820c3[_0xf153('0x14')]][_0xf153('0x25')]=_0x1820c3[_0xf153('0x26')];agents[_0x1820c3['destuniqueid']][_0xf153('0x1a')]=_0xf153('0x31');_[_0xf153('0x29')](agents,function(_0x352e7c,_0x25657a){if(_0x352e7c[_0xf153('0x14')]!=_0x1820c3['destuniqueid']&&_0x352e7c['uniqueid']==_0x1820c3[_0xf153('0x5')]){_0x352e7c['talktime']=0x0;_0x352e7c[_0xf153('0x25')]=_0x1820c3[_0xf153('0x26')];_0x352e7c[_0xf153('0x1e')]=!![];_0x352e7c[_0xf153('0x22')]=utils[_0xf153('0x19')]();_0x352e7c[_0xf153('0x1a')]='answered_elsewhere';_0x352e7c['reason']=_0xf153('0x32');_0x352e7c[_0xf153('0x33')]=_0x1820c3['destuniqueid'];_0x352e7c[_0xf153('0x34')]=_0x1820c3[_0xf153('0x7')];writeDB(_0x352e7c);}});}}catch(_0x1edf65){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x2e'),_0x1820c3[_0xf153('0x5')]),_0x1edf65);}};exports[_0xf153('0xf')]=function(_0x1b453f){try{if(!_[_0xf153('0x1f')](agents[_0x1b453f[_0xf153('0x14')]])){utils[_0xf153('0x16')](util['format'](_0xf153('0x35'),_0x1b453f[_0xf153('0x5')]),_0x1b453f);utils[_0xf153('0x3')](util['format'](_0xf153('0x36'),_0x1b453f[_0xf153('0x5')],agents[_0x1b453f['destuniqueid']][_0xf153('0x7')],_0x1b453f['destuniqueid']));agents[_0x1b453f[_0xf153('0x14')]][_0xf153('0xf')]=!![];agents[_0x1b453f[_0xf153('0x14')]]['agentcompleteAt']=utils[_0xf153('0x19')]();agents[_0x1b453f[_0xf153('0x14')]][_0xf153('0x27')]=utils[_0xf153('0x37')](agents[_0x1b453f[_0xf153('0x14')]]['agentcompleteAt'],agents[_0x1b453f[_0xf153('0x14')]][_0xf153('0x38')]);agents[_0x1b453f['destuniqueid']][_0xf153('0x24')]=_0x1b453f[_0xf153('0x24')];agents[_0x1b453f[_0xf153('0x14')]]['lastevent']=_0xf153('0x39');writeDB(agents[_0x1b453f[_0xf153('0x14')]]);}}catch(_0x82dc34){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x35'),_0x1b453f[_0xf153('0x5')]),_0x82dc34);}};exports[_0xf153('0x3a')]=function(_0x3b91ed){try{if(!_['isNil'](agents[_0x3b91ed[_0xf153('0x3b')]])){utils['debug'](util['format']('[%s][agents][blindtransfer]',_0x3b91ed[_0xf153('0x5')]),_0x3b91ed);utils[_0xf153('0x3')](util['format'](_0xf153('0x3c'),_0x3b91ed[_0xf153('0x5')],agents[_0x3b91ed['transfereruniqueid']][_0xf153('0x7')],agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x5')]));agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x3d')]=!![];agents[_0x3b91ed[_0xf153('0x3b')]]['transfertype']=_0xf153('0x3e');agents[_0x3b91ed[_0xf153('0x3b')]]['transferexten']=_0x3b91ed['extension'];agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x3f')]=agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x5')];}}catch(_0x419e7e){utils[_0xf153('0x1d')](util['format'](_0xf153('0x40'),_0x3b91ed['uniqueid']),_0x419e7e);}};exports[_0xf153('0x41')]=function(_0x365209){try{utils[_0xf153('0x16')](util['format'](_0xf153('0x42'),_0x365209[_0xf153('0x43')]),_0x365209);if(_0x365209[_0xf153('0x43')]==_0x365209[_0xf153('0x44')]){if(!_[_0xf153('0x1f')](agents[_0x365209[_0xf153('0x45')]])){utils[_0xf153('0x3')](util['format'](_0xf153('0x46'),_0x365209[_0xf153('0x43')],agents[_0x365209[_0xf153('0x45')]]['membername']));agents[_0x365209[_0xf153('0x45')]][_0xf153('0x3d')]=!![];agents[_0x365209[_0xf153('0x45')]][_0xf153('0x47')]=_0xf153('0x48');agents[_0x365209[_0xf153('0x45')]][_0xf153('0x49')]=_0x365209[_0xf153('0x4a')];agents[_0x365209['secondtransfereruniqueid']][_0xf153('0x3f')]=_0x365209[_0xf153('0x43')];}if(_0x365209['transfereeuniqueid']&&agents[_0x365209[_0xf153('0x4b')]]){agents[_0x365209[_0xf153('0x4b')]][_0xf153('0x4c')]=0x1;transfers[_0x365209[_0xf153('0x4b')]]=_[_0xf153('0x4d')](agents[_0x365209[_0xf153('0x4b')]]);transfers[_0x365209[_0xf153('0x4b')]][_0xf153('0x9')]=agents[_0x365209[_0xf153('0x45')]][_0xf153('0x9')];transfers[_0x365209[_0xf153('0x4b')]]['calleridname']=agents[_0x365209[_0xf153('0x45')]][_0xf153('0x4e')];transfers[_0x365209['transfereeuniqueid']][_0xf153('0x18')]=utils[_0xf153('0x19')]();transfers[_0x365209[_0xf153('0x4b')]][_0xf153('0x38')]=utils[_0xf153('0x19')]();transfers[_0x365209[_0xf153('0x4b')]][_0xf153('0x25')]=0x0;transfers[_0x365209['transfereeuniqueid']][_0xf153('0x4c')]=0x2;}}else if(_0x365209[_0xf153('0x45')]==_0x365209[_0xf153('0x4f')]){if(!_[_0xf153('0x1f')](agents[_0x365209[_0xf153('0x43')]])){utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x46'),_0x365209[_0xf153('0x43')],agents[_0x365209['origtransfereruniqueid']][_0xf153('0x7')]));agents[_0x365209[_0xf153('0x43')]]['transfer']=!![];agents[_0x365209[_0xf153('0x43')]]['transfertype']=_0xf153('0x48');agents[_0x365209[_0xf153('0x43')]]['transferexten']=_0x365209[_0xf153('0x50')];agents[_0x365209['origtransfereruniqueid']][_0xf153('0x3f')]=_0x365209[_0xf153('0x45')];}if(_0x365209[_0xf153('0x51')]&&agents[_0x365209[_0xf153('0x51')]]){agents[_0x365209['transfertargetuniqueid']][_0xf153('0x4c')]=0x1;transfers[_0x365209[_0xf153('0x51')]]=_['clone'](agents[_0x365209[_0xf153('0x51')]]);transfers[_0x365209[_0xf153('0x51')]][_0xf153('0x9')]=agents[_0x365209[_0xf153('0x43')]][_0xf153('0x9')];transfers[_0x365209['transfertargetuniqueid']][_0xf153('0x4e')]=agents[_0x365209['origtransfereruniqueid']][_0xf153('0x4e')];transfers[_0x365209[_0xf153('0x51')]]['agentcalledAt']=utils['now']();transfers[_0x365209[_0xf153('0x51')]][_0xf153('0x38')]=utils['now']();transfers[_0x365209[_0xf153('0x51')]][_0xf153('0x25')]=0x0;transfers[_0x365209[_0xf153('0x51')]]['agententerreason']=0x2;}}}catch(_0x671efe){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x42'),_0x365209[_0xf153('0x43')]),_0x671efe);}};exports[_0xf153('0x52')]=function(_0x37443f){try{utils[_0xf153('0x16')](util[_0xf153('0x4')](_0xf153('0x53'),_0x37443f[_0xf153('0x5')]),_0x37443f);if(agents[_0x37443f[_0xf153('0x5')]]&&agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x24')]===_0xf153('0x23')){if(_0x37443f[_0xf153('0x54')]==='21'){agents[_0x37443f['uniqueid']][_0xf153('0x24')]='rejected';agents[_0x37443f['uniqueid']][_0xf153('0x1a')]='rejected';}utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x55'),_0x37443f[_0xf153('0x5')],agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x7')],agents[_0x37443f['uniqueid']][_0xf153('0x24')],agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x1a')]));writeDB(agents[_0x37443f['uniqueid']]);var _0x59e22d=unanswered[_0xf153('0x56')](_0x37443f[_0xf153('0x5')]);if(_0x59e22d>-0x1){unanswered[_0xf153('0x57')](_0x59e22d,0x1);}}if(transfers[_0x37443f['uniqueid']]){transfers[_0x37443f[_0xf153('0x5')]]['agentcomplete']=!![];transfers[_0x37443f['uniqueid']][_0xf153('0x58')]=utils[_0xf153('0x19')]();transfers[_0x37443f[_0xf153('0x5')]]['talktime']=utils[_0xf153('0x37')](transfers[_0x37443f[_0xf153('0x5')]]['agentcompleteAt'],transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x38')]);transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x24')]=_0xf153('0x59');transfers[_0x37443f['uniqueid']][_0xf153('0x1a')]=_0xf153('0x39');utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x55'),_0x37443f[_0xf153('0x5')],transfers[_0x37443f[_0xf153('0x5')]]['membername'],transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x24')],transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x1a')]));writeDB(transfers[_0x37443f[_0xf153('0x5')]],!![]);}if(agents[_0x37443f[_0xf153('0x5')]]&&agents[_0x37443f['uniqueid']][_0xf153('0x38')]){agents[_0x37443f[_0xf153('0x5')]][_0xf153('0xf')]=!![];agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x58')]=utils[_0xf153('0x19')]();agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x27')]=utils[_0xf153('0x37')](agents[_0x37443f[_0xf153('0x5')]]['agentcompleteAt'],agents[_0x37443f['uniqueid']]['agentconnectAt']);agents[_0x37443f['uniqueid']][_0xf153('0x24')]=agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x3d')]?_0xf153('0x3d'):_0xf153('0x59');agents[_0x37443f['uniqueid']][_0xf153('0x1a')]=_0xf153('0x39');utils[_0xf153('0x3')](util[_0xf153('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x37443f[_0xf153('0x5')],agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x7')],agents[_0x37443f['uniqueid']][_0xf153('0x24')],agents[_0x37443f['uniqueid']][_0xf153('0x1a')]));writeDB(agents[_0x37443f[_0xf153('0x5')]]);}}catch(_0x2651ff){utils['error'](util['format']('[%s][agents][hangup]',_0x37443f[_0xf153('0x5')]),_0x2651ff);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index dec13bb..4a25d65 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 _0x3d2b=['disposition','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','billableseconds','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','musiconholdstartAt','mohtime','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','destination','\x22\x20<','xmd-callerid','xmd-callerid-preview','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','noop','execif','lastapplication','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','channel','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime'];(function(_0x414305,_0x5627fd){var _0x50e0c9=function(_0x2243f0){while(--_0x2243f0){_0x414305['push'](_0x414305['shift']());}};_0x50e0c9(++_0x5627fd);}(_0x3d2b,0x184));var _0xb3d2=function(_0x2ace57,_0x7b0849){_0x2ace57=_0x2ace57-0x0;var _0x25b659=_0x3d2b[_0x2ace57];return _0x25b659;};'use strict';var _=require(_0xb3d2('0x0'));var util=require('util');var utils=require(_0xb3d2('0x1'));var dispositions=[_0xb3d2('0x2'),_0xb3d2('0x3'),_0xb3d2('0x3'),_0xb3d2('0x2'),'NO\x20ANSWER','NO\x20ANSWER',_0xb3d2('0x4'),'BUSY',_0xb3d2('0x3'),_0xb3d2('0x3'),_0xb3d2('0x3')];var channels={};function writeDB(_0x3ef3ff){utils[_0xb3d2('0x5')](util[_0xb3d2('0x6')](_0xb3d2('0x7'),_0x3ef3ff[_0xb3d2('0x8')],_0x3ef3ff['channel'],_0x3ef3ff[_0xb3d2('0x9')],_0x3ef3ff[_0xb3d2('0xa')],_0x3ef3ff[_0xb3d2('0xb')],_0x3ef3ff[_0xb3d2('0xc')],_0x3ef3ff['connectedlinenum'],_0x3ef3ff[_0xb3d2('0xd')]));if(_0x3ef3ff[_0xb3d2('0xe')]){utils[_0xb3d2('0xf')](_0x3ef3ff[_0xb3d2('0xe')])[_0xb3d2('0x10')](function(_0x311412){if(_0x311412){_0x3ef3ff['UserId']=_0x311412['id'];}utils[_0xb3d2('0x11')](_0xb3d2('0x12'),_0x3ef3ff);});}else{utils['request'](_0xb3d2('0x12'),_0x3ef3ff);}if(channels[_0x3ef3ff[_0xb3d2('0x8')]]){delete channels[_0x3ef3ff[_0xb3d2('0x8')]];}}exports[_0xb3d2('0x13')]=function(_0x7e1525){try{utils[_0xb3d2('0x14')](util[_0xb3d2('0x6')](_0xb3d2('0x15'),_0x7e1525[_0xb3d2('0x8')]),_0x7e1525);if(_0x7e1525[_0xb3d2('0x8')]==_0x7e1525[_0xb3d2('0x16')]&&_0x7e1525[_0xb3d2('0x17')]!='OutgoingSpoolFailed'){utils[_0xb3d2('0x5')](util[_0xb3d2('0x6')](_0xb3d2('0x18'),_0x7e1525['uniqueid'],_0x7e1525[_0xb3d2('0x19')],_0x7e1525[_0xb3d2('0x1a')]));channels[_0x7e1525['uniqueid']]={'uniqueid':_0x7e1525[_0xb3d2('0x8')],'accountcode':_0x7e1525['accountcode'],'source':_0x7e1525['calleridnum'],'destination':_0x7e1525[_0xb3d2('0x1a')],'destinationcontext':_0x7e1525[_0xb3d2('0x19')],'channel':_0x7e1525['channel'],'starttime':utils[_0xb3d2('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xb3d2('0x1c')};}}catch(_0x1402fb){utils[_0xb3d2('0x1d')](util['format'](_0xb3d2('0x15'),_0x7e1525[_0xb3d2('0x8')]),_0x1402fb);}};exports[_0xb3d2('0x1e')]=function(_0x47c493){try{utils[_0xb3d2('0x14')](util['format'](_0xb3d2('0x1f'),_0x47c493[_0xb3d2('0x8')]),_0x47c493);if(!_[_0xb3d2('0x20')](channels[_0x47c493[_0xb3d2('0x8')]])&&_0x47c493[_0xb3d2('0x21')]==0x6){utils['info'](util[_0xb3d2('0x6')](_0xb3d2('0x22'),_0x47c493['uniqueid'],_0x47c493['context'],_0x47c493[_0xb3d2('0x17')]));if(_[_0xb3d2('0x20')](channels[_0x47c493[_0xb3d2('0x8')]]['systemanswertime'])){channels[_0x47c493['uniqueid']][_0xb3d2('0x23')]=utils['now']();}}else if(!_[_0xb3d2('0x20')](channels[_0x47c493['linkedid']])&&_0x47c493[_0xb3d2('0x21')]==0x6&&_0x47c493[_0xb3d2('0x19')]!=_0xb3d2('0x24')){utils[_0xb3d2('0x5')](util[_0xb3d2('0x6')](_0xb3d2('0x25'),_0x47c493['uniqueid'],_0x47c493['linkedid'],_0x47c493['context'],_0x47c493[_0xb3d2('0x17')]));channels[_0x47c493['linkedid']]['accountcode']=_0x47c493[_0xb3d2('0xe')];channels[_0x47c493[_0xb3d2('0x16')]][_0xb3d2('0x26')]=_0x47c493[_0xb3d2('0x17')];if(_[_0xb3d2('0x20')](channels[_0x47c493['linkedid']][_0xb3d2('0x27')])){channels[_0x47c493[_0xb3d2('0x16')]][_0xb3d2('0x27')]=utils[_0xb3d2('0x1b')]();}channels[_0x47c493[_0xb3d2('0x16')]][_0xb3d2('0x28')]=dispositions[_['toNumber'](_0x47c493['channelstate'])]||_0xb3d2('0x4');}}catch(_0x142ba3){utils[_0xb3d2('0x1d')](util[_0xb3d2('0x6')](_0xb3d2('0x1f'),_0x47c493['uniqueid']),_0x142ba3);}};exports[_0xb3d2('0x29')]=function(_0x2fc3be){try{if(!_[_0xb3d2('0x20')](channels[_0x2fc3be['uniqueid']])){utils[_0xb3d2('0x14')](util['format'](_0xb3d2('0x2a'),_0x2fc3be['uniqueid']),_0x2fc3be);if(_['isNil'](channels[_0x2fc3be[_0xb3d2('0x8')]][_0xb3d2('0x2b')])){channels[_0x2fc3be['uniqueid']]['callerid']=_0x2fc3be[_0xb3d2('0x2c')]+'\x20<'+_0x2fc3be[_0xb3d2('0xc')]+'>';}utils[_0xb3d2('0x5')](util[_0xb3d2('0x6')](_0xb3d2('0x2d'),_0x2fc3be['uniqueid'],channels[_0x2fc3be[_0xb3d2('0x8')]]['callerid'],_0x2fc3be[_0xb3d2('0x2e')]));channels[_0x2fc3be[_0xb3d2('0x8')]]['endtime']=utils[_0xb3d2('0x1b')]();channels[_0x2fc3be[_0xb3d2('0x8')]][_0xb3d2('0x2f')]=utils[_0xb3d2('0x30')](channels[_0x2fc3be[_0xb3d2('0x8')]][_0xb3d2('0x31')],channels[_0x2fc3be[_0xb3d2('0x8')]][_0xb3d2('0x32')]);channels[_0x2fc3be['uniqueid']][_0xb3d2('0x33')]=channels[_0x2fc3be[_0xb3d2('0x8')]]['answertime']?utils['diffTime'](channels[_0x2fc3be['uniqueid']]['endtime'],channels[_0x2fc3be['uniqueid']][_0xb3d2('0x27')]):0x0;writeDB(channels[_0x2fc3be[_0xb3d2('0x8')]]);}}catch(_0x5e3788){utils['error'](util[_0xb3d2('0x6')](_0xb3d2('0x2a'),_0x2fc3be[_0xb3d2('0x8')]),_0x5e3788);}};exports['attendedtransfer']=function(_0x56cdb3){try{if(!_[_0xb3d2('0x20')](channels[_0x56cdb3['localtwolinkedid']])){utils[_0xb3d2('0x14')](util[_0xb3d2('0x6')](_0xb3d2('0x34'),_0x56cdb3[_0xb3d2('0x35')]),_0x56cdb3);if(channels[_0x56cdb3[_0xb3d2('0x36')]][_0xb3d2('0x17')]==_0x56cdb3[_0xb3d2('0x37')]){utils['info'](util['format'](_0xb3d2('0x38'),_0x56cdb3[_0xb3d2('0x35')],_0x56cdb3['localtwolinkedid'],_0x56cdb3[_0xb3d2('0x39')]));channels[_0x56cdb3[_0xb3d2('0x36')]][_0xb3d2('0x26')]=_0x56cdb3[_0xb3d2('0x39')];channels[_0x56cdb3[_0xb3d2('0x36')]]['userfield']=_0xb3d2('0x3a');}else if(channels[_0x56cdb3[_0xb3d2('0x36')]][_0xb3d2('0x17')]=_0x56cdb3[_0xb3d2('0x3b')]){utils[_0xb3d2('0x5')](util['format'](_0xb3d2('0x38'),_0x56cdb3[_0xb3d2('0x35')],_0x56cdb3['localtwolinkedid'],_0x56cdb3['origtransfererchannel']));channels[_0x56cdb3[_0xb3d2('0x36')]][_0xb3d2('0x26')]=_0x56cdb3[_0xb3d2('0x3c')];channels[_0x56cdb3['localtwolinkedid']]['userfield']='_attended';}}}catch(_0x1343e3){utils[_0xb3d2('0x1d')](util['format'](_0xb3d2('0x34'),_0x56cdb3[_0xb3d2('0x35')]),_0x1343e3);}};exports['musiconholdstart']=function(_0x5c591e){try{if(!_[_0xb3d2('0x20')](channels[_0x5c591e[_0xb3d2('0x8')]])){utils[_0xb3d2('0x14')](util[_0xb3d2('0x6')](_0xb3d2('0x3d'),_0x5c591e[_0xb3d2('0x8')]),_0x5c591e);channels[_0x5c591e['uniqueid']]['musiconholdstartAt']=utils[_0xb3d2('0x1b')]();utils['info'](util[_0xb3d2('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5c591e['uniqueid'],channels[_0x5c591e[_0xb3d2('0x8')]]['musiconholdstartAt']));}}catch(_0x9865e6){utils[_0xb3d2('0x1d')](util['format'](_0xb3d2('0x3d'),_0x5c591e['uniqueid']),_0x9865e6);}};exports['musiconholdstop']=function(_0x1f67cd){try{if(!_[_0xb3d2('0x20')](channels[_0x1f67cd[_0xb3d2('0x8')]])){utils[_0xb3d2('0x14')](util[_0xb3d2('0x6')](_0xb3d2('0x3e'),_0x1f67cd[_0xb3d2('0x8')]),_0x1f67cd);if(!_['isNil'](channels[_0x1f67cd[_0xb3d2('0x8')]][_0xb3d2('0x3f')])){channels[_0x1f67cd[_0xb3d2('0x8')]][_0xb3d2('0x40')]+=utils[_0xb3d2('0x30')](utils[_0xb3d2('0x1b')](),channels[_0x1f67cd[_0xb3d2('0x8')]][_0xb3d2('0x3f')]);utils[_0xb3d2('0x5')](util[_0xb3d2('0x6')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x1f67cd[_0xb3d2('0x8')],channels[_0x1f67cd[_0xb3d2('0x8')]][_0xb3d2('0x40')]));delete channels[_0x1f67cd[_0xb3d2('0x8')]][_0xb3d2('0x3f')];}}}catch(_0x3e9153){utils[_0xb3d2('0x1d')](util[_0xb3d2('0x6')]('[%s][calls][musiconholdstop]',_0x1f67cd[_0xb3d2('0x8')]),_0x3e9153);}};exports[_0xb3d2('0x41')]=function(_0x28239f){try{if(!_[_0xb3d2('0x20')](channels[_0x28239f[_0xb3d2('0x8')]])){utils[_0xb3d2('0x14')](util[_0xb3d2('0x6')](_0xb3d2('0x42'),_0x28239f[_0xb3d2('0x8')]),_0x28239f);if(!_[_0xb3d2('0x20')](_0x28239f[_0xb3d2('0x43')][_0xb3d2('0x44')])){utils[_0xb3d2('0x5')](util[_0xb3d2('0x6')](_0xb3d2('0x45'),_0x28239f[_0xb3d2('0x8')],_0x28239f[_0xb3d2('0x46')]));channels[_0x28239f[_0xb3d2('0x8')]][_0xb3d2('0x47')]=_0x28239f[_0xb3d2('0x46')];}if(!_['isNil'](_0x28239f['variable'][_0xb3d2('0x48')])){utils[_0xb3d2('0x5')](util['format'](_0xb3d2('0x49'),_0x28239f[_0xb3d2('0x8')],_0x28239f[_0xb3d2('0x46')]));channels[_0x28239f[_0xb3d2('0x8')]][_0xb3d2('0x4a')]=_0x28239f[_0xb3d2('0x46')];channels[_0x28239f[_0xb3d2('0x8')]][_0xb3d2('0x2b')]='\x22'+_0x28239f[_0xb3d2('0x46')]+_0xb3d2('0x4b')+_0x28239f[_0xb3d2('0x46')]+'>';}if(!_['isNil'](_0x28239f[_0xb3d2('0x43')]['xmd-callerid-preview'])||!_[_0xb3d2('0x20')](_0x28239f['variable'][_0xb3d2('0x4c')])){utils[_0xb3d2('0x5')](util[_0xb3d2('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x28239f['uniqueid'],!_['isNil'](_0x28239f[_0xb3d2('0x43')][_0xb3d2('0x4d')])?_0xb3d2('0x4d'):_0xb3d2('0x4c'),_0x28239f[_0xb3d2('0x46')]));channels[_0x28239f[_0xb3d2('0x8')]][_0xb3d2('0x2b')]=_0x28239f[_0xb3d2('0x46')];}if(!_[_0xb3d2('0x20')](_0x28239f[_0xb3d2('0x43')][_0xb3d2('0x4e')])||!_[_0xb3d2('0x20')](_0x28239f['variable'][_0xb3d2('0x4f')])){utils[_0xb3d2('0x5')](util[_0xb3d2('0x6')](_0xb3d2('0x50'),_0x28239f[_0xb3d2('0x8')],!_[_0xb3d2('0x20')](_0x28239f[_0xb3d2('0x43')][_0xb3d2('0x4e')])?_0xb3d2('0x4e'):_0xb3d2('0x4f'),_0x28239f[_0xb3d2('0x46')]));channels[_0x28239f['uniqueid']]['lastapplication']=_0xb3d2('0x51');channels[_0x28239f['uniqueid']][_0xb3d2('0x52')]=_0x28239f[_0xb3d2('0x46')];channels[_0x28239f[_0xb3d2('0x8')]][_0xb3d2('0x9')]=!![];}if(!_[_0xb3d2('0x20')](_0x28239f[_0xb3d2('0x43')][_0xb3d2('0x53')])){utils['info'](util[_0xb3d2('0x6')](_0xb3d2('0x54'),_0x28239f[_0xb3d2('0x8')],_0x28239f[_0xb3d2('0x46')]));channels[_0x28239f[_0xb3d2('0x8')]][_0xb3d2('0x55')]=_0x28239f['value'];}if(!_['isNil'](_0x28239f[_0xb3d2('0x43')][_0xb3d2('0x56')])){utils[_0xb3d2('0x5')](util['format'](_0xb3d2('0x57'),_0x28239f[_0xb3d2('0x8')],_0x28239f['value']));channels[_0x28239f[_0xb3d2('0x8')]][_0xb3d2('0x58')]=_0x28239f[_0xb3d2('0x46')];}if(!_[_0xb3d2('0x20')](_0x28239f[_0xb3d2('0x43')]['outboundrouteid'])){utils['info'](util[_0xb3d2('0x6')](_0xb3d2('0x59'),_0x28239f[_0xb3d2('0x8')],_0x28239f[_0xb3d2('0x46')]));channels[_0x28239f[_0xb3d2('0x8')]][_0xb3d2('0x5a')]=_0x28239f[_0xb3d2('0x46')];}if(!_['isNil'](_0x28239f['variable'][_0xb3d2('0x5b')])){utils['info'](util[_0xb3d2('0x6')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x28239f[_0xb3d2('0x8')],_0x28239f['value']));channels[_0x28239f[_0xb3d2('0x8')]][_0xb3d2('0x5b')]=_0x28239f[_0xb3d2('0x46')];}}}catch(_0x593678){utils[_0xb3d2('0x1d')](util[_0xb3d2('0x6')](_0xb3d2('0x42'),_0x28239f[_0xb3d2('0x8')]),_0x593678);}};exports[_0xb3d2('0x5c')]=function(_0x32b420){try{if(!_[_0xb3d2('0x20')](channels[_0x32b420[_0xb3d2('0x8')]])){utils[_0xb3d2('0x14')](util[_0xb3d2('0x6')](_0xb3d2('0x5d'),_0x32b420[_0xb3d2('0x8')]),_0x32b420);utils[_0xb3d2('0x5')](util['format'](_0xb3d2('0x5e'),_0x32b420[_0xb3d2('0x8')],_0x32b420['application'],_0x32b420[_0xb3d2('0x5f')]));if(_0x32b420[_0xb3d2('0x60')][_0xb3d2('0x61')]()==_0xb3d2('0x62')&&_[_0xb3d2('0x63')](_0x32b420[_0xb3d2('0x5f')][_0xb3d2('0x61')](),_0xb3d2('0x64'))){var _0x134164=_0x32b420['appdata']['split']('=');var _0x295af7=_0x134164[0x0][_0xb3d2('0x65')](_0x134164[0x0][_0xb3d2('0x66')]('(')+0x1,_0x134164[0x0]['lastIndexOf'](')'));var _0x27afc7=_0x134164[0x1];channels[_0x32b420[_0xb3d2('0x8')]][_0x295af7]=_0x27afc7;}if(!_[_0xb3d2('0x67')]([_0xb3d2('0x29'),_0xb3d2('0x68'),_0xb3d2('0x69'),'set','gotoif'],_0x32b420['application'][_0xb3d2('0x61')]())){channels[_0x32b420['uniqueid']][_0xb3d2('0x6a')]=_0x32b420[_0xb3d2('0x60')];channels[_0x32b420['uniqueid']][_0xb3d2('0x52')]=_0x32b420[_0xb3d2('0x5f')];}}}catch(_0x529ebf){utils[_0xb3d2('0x1d')](util[_0xb3d2('0x6')](_0xb3d2('0x5d'),_0x32b420['uniqueid']),_0x529ebf);}}; \ No newline at end of file +var _0xbc0d=['channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','transfereechannel','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','destinationchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','\x22\x20<','variable','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','set','gotoif','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid'];(function(_0x321333,_0x1bdc80){var _0x5b8862=function(_0x17af08){while(--_0x17af08){_0x321333['push'](_0x321333['shift']());}};_0x5b8862(++_0x1bdc80);}(_0xbc0d,0x64));var _0xdbc0=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xbc0d[_0x173441];return _0x2423a8;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xdbc0('0x0'));var dispositions=[_0xdbc0('0x1'),_0xdbc0('0x2'),'FAILED',_0xdbc0('0x1'),_0xdbc0('0x1'),_0xdbc0('0x1'),_0xdbc0('0x3'),_0xdbc0('0x4'),'FAILED',_0xdbc0('0x2'),'FAILED'];var channels={};function writeDB(_0x1fe34e){utils[_0xdbc0('0x5')](util['format'](_0xdbc0('0x6'),_0x1fe34e[_0xdbc0('0x7')],_0x1fe34e[_0xdbc0('0x8')],_0x1fe34e[_0xdbc0('0x9')],_0x1fe34e[_0xdbc0('0xa')],_0x1fe34e[_0xdbc0('0xb')],_0x1fe34e[_0xdbc0('0xc')],_0x1fe34e[_0xdbc0('0xd')],_0x1fe34e[_0xdbc0('0xe')]));if(_0x1fe34e[_0xdbc0('0xf')]){utils[_0xdbc0('0x10')](_0x1fe34e[_0xdbc0('0xf')])[_0xdbc0('0x11')](function(_0x5e3240){if(_0x5e3240){_0x1fe34e[_0xdbc0('0x12')]=_0x5e3240['id'];}utils['request'](_0xdbc0('0x13'),_0x1fe34e);});}else{utils[_0xdbc0('0x14')](_0xdbc0('0x13'),_0x1fe34e);}if(channels[_0x1fe34e[_0xdbc0('0x7')]]){delete channels[_0x1fe34e[_0xdbc0('0x7')]];}}exports['newchannel']=function(_0x372d84){try{utils[_0xdbc0('0x15')](util['format'](_0xdbc0('0x16'),_0x372d84['uniqueid']),_0x372d84);if(_0x372d84['uniqueid']==_0x372d84['linkedid']&&_0x372d84['channel']!=_0xdbc0('0x17')){utils['info'](util[_0xdbc0('0x18')](_0xdbc0('0x19'),_0x372d84[_0xdbc0('0x7')],_0x372d84[_0xdbc0('0x1a')],_0x372d84[_0xdbc0('0x1b')]));channels[_0x372d84[_0xdbc0('0x7')]]={'uniqueid':_0x372d84[_0xdbc0('0x7')],'accountcode':_0x372d84[_0xdbc0('0xf')],'source':_0x372d84[_0xdbc0('0xc')],'destination':_0x372d84[_0xdbc0('0x1b')],'destinationcontext':_0x372d84['context'],'channel':_0x372d84[_0xdbc0('0x8')],'starttime':utils[_0xdbc0('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xdbc0('0x1'),'amaflags':_0xdbc0('0x1d')};}}catch(_0x2aef67){utils[_0xdbc0('0x1e')](util[_0xdbc0('0x18')](_0xdbc0('0x16'),_0x372d84['uniqueid']),_0x2aef67);}};exports[_0xdbc0('0x1f')]=function(_0x2866c5){try{utils['debug'](util[_0xdbc0('0x18')](_0xdbc0('0x20'),_0x2866c5[_0xdbc0('0x7')]),_0x2866c5);if(!_[_0xdbc0('0x21')](channels[_0x2866c5['uniqueid']])&&_0x2866c5[_0xdbc0('0x22')]==0x6){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x23'),_0x2866c5[_0xdbc0('0x7')],_0x2866c5[_0xdbc0('0x1a')],_0x2866c5[_0xdbc0('0x8')]));if(_[_0xdbc0('0x21')](channels[_0x2866c5['uniqueid']][_0xdbc0('0x24')])){channels[_0x2866c5['uniqueid']][_0xdbc0('0x24')]=utils[_0xdbc0('0x1c')]();}}else if(!_[_0xdbc0('0x21')](channels[_0x2866c5[_0xdbc0('0x25')]])&&_0x2866c5[_0xdbc0('0x22')]==0x6&&_0x2866c5[_0xdbc0('0x1a')]!='transfer'){utils[_0xdbc0('0x5')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2866c5[_0xdbc0('0x7')],_0x2866c5['linkedid'],_0x2866c5['context'],_0x2866c5[_0xdbc0('0x8')]));channels[_0x2866c5[_0xdbc0('0x25')]][_0xdbc0('0xf')]=_0x2866c5[_0xdbc0('0xf')];channels[_0x2866c5['linkedid']]['destinationchannel']=_0x2866c5[_0xdbc0('0x8')];if(_[_0xdbc0('0x21')](channels[_0x2866c5[_0xdbc0('0x25')]][_0xdbc0('0x26')])){channels[_0x2866c5[_0xdbc0('0x25')]][_0xdbc0('0x26')]=utils[_0xdbc0('0x1c')]();}channels[_0x2866c5['linkedid']][_0xdbc0('0x27')]=dispositions[_[_0xdbc0('0x28')](_0x2866c5['channelstate'])]||'ANSWERED';}}catch(_0x183007){utils[_0xdbc0('0x1e')](util['format'](_0xdbc0('0x20'),_0x2866c5[_0xdbc0('0x7')]),_0x183007);}};exports[_0xdbc0('0x29')]=function(_0x401f19){try{if(!_[_0xdbc0('0x21')](channels[_0x401f19[_0xdbc0('0x7')]])){utils[_0xdbc0('0x15')](util['format'](_0xdbc0('0x2a'),_0x401f19[_0xdbc0('0x7')]),_0x401f19);if(_[_0xdbc0('0x21')](channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x2b')])){channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x2b')]=_0x401f19[_0xdbc0('0x2c')]+'\x20<'+_0x401f19[_0xdbc0('0xc')]+'>';}utils[_0xdbc0('0x5')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x401f19[_0xdbc0('0x7')],channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x2b')],_0x401f19[_0xdbc0('0x2d')]));channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x2e')]=utils[_0xdbc0('0x1c')]();channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x2f')]=utils[_0xdbc0('0x30')](channels[_0x401f19[_0xdbc0('0x7')]]['endtime'],channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x31')]);channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x32')]=channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x26')]?utils[_0xdbc0('0x30')](channels[_0x401f19[_0xdbc0('0x7')]]['endtime'],channels[_0x401f19[_0xdbc0('0x7')]][_0xdbc0('0x26')]):0x0;writeDB(channels[_0x401f19['uniqueid']]);}}catch(_0x30275c){utils[_0xdbc0('0x1e')](util[_0xdbc0('0x18')]('[%s][calls][hangup]',_0x401f19[_0xdbc0('0x7')]),_0x30275c);}};exports['attendedtransfer']=function(_0x156755){try{if(!_[_0xdbc0('0x21')](channels[_0x156755['localtwolinkedid']])){utils['debug'](util[_0xdbc0('0x18')]('[%s][calls][attendedtransfer]',_0x156755['origtransfereruniqueid']),_0x156755);if(channels[_0x156755[_0xdbc0('0x33')]][_0xdbc0('0x8')]==_0x156755[_0xdbc0('0x34')]){utils[_0xdbc0('0x5')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x156755[_0xdbc0('0x35')],_0x156755['localtwolinkedid'],_0x156755[_0xdbc0('0x36')]));channels[_0x156755[_0xdbc0('0x33')]]['destinationchannel']=_0x156755[_0xdbc0('0x36')];channels[_0x156755[_0xdbc0('0x33')]][_0xdbc0('0x37')]=_0xdbc0('0x38');}else if(channels[_0x156755[_0xdbc0('0x33')]]['channel']=_0x156755[_0xdbc0('0x39')]){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x3a'),_0x156755[_0xdbc0('0x35')],_0x156755[_0xdbc0('0x33')],_0x156755[_0xdbc0('0x3b')]));channels[_0x156755[_0xdbc0('0x33')]][_0xdbc0('0x3c')]=_0x156755['origtransfererchannel'];channels[_0x156755[_0xdbc0('0x33')]][_0xdbc0('0x37')]='_attended';}}}catch(_0x4accc3){utils[_0xdbc0('0x1e')](util['format'](_0xdbc0('0x3d'),_0x156755[_0xdbc0('0x35')]),_0x4accc3);}};exports[_0xdbc0('0x3e')]=function(_0xc46ad7){try{if(!_[_0xdbc0('0x21')](channels[_0xc46ad7['uniqueid']])){utils[_0xdbc0('0x15')](util['format'](_0xdbc0('0x3f'),_0xc46ad7[_0xdbc0('0x7')]),_0xc46ad7);channels[_0xc46ad7[_0xdbc0('0x7')]][_0xdbc0('0x40')]=utils[_0xdbc0('0x1c')]();utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x41'),_0xc46ad7['uniqueid'],channels[_0xc46ad7['uniqueid']][_0xdbc0('0x40')]));}}catch(_0x4c5458){utils['error'](util[_0xdbc0('0x18')]('[%s][calls][musiconholdstart]',_0xc46ad7[_0xdbc0('0x7')]),_0x4c5458);}};exports[_0xdbc0('0x42')]=function(_0x4d9161){try{if(!_[_0xdbc0('0x21')](channels[_0x4d9161[_0xdbc0('0x7')]])){utils[_0xdbc0('0x15')](util[_0xdbc0('0x18')](_0xdbc0('0x43'),_0x4d9161['uniqueid']),_0x4d9161);if(!_[_0xdbc0('0x21')](channels[_0x4d9161[_0xdbc0('0x7')]]['musiconholdstartAt'])){channels[_0x4d9161[_0xdbc0('0x7')]][_0xdbc0('0x44')]+=utils['diffTime'](utils[_0xdbc0('0x1c')](),channels[_0x4d9161[_0xdbc0('0x7')]][_0xdbc0('0x40')]);utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x45'),_0x4d9161[_0xdbc0('0x7')],channels[_0x4d9161['uniqueid']][_0xdbc0('0x44')]));delete channels[_0x4d9161[_0xdbc0('0x7')]]['musiconholdstartAt'];}}}catch(_0x372b31){utils['error'](util[_0xdbc0('0x18')](_0xdbc0('0x43'),_0x4d9161[_0xdbc0('0x7')]),_0x372b31);}};exports[_0xdbc0('0x46')]=function(_0x1394f3){try{if(!_[_0xdbc0('0x21')](channels[_0x1394f3[_0xdbc0('0x7')]])){utils[_0xdbc0('0x15')](util['format'](_0xdbc0('0x47'),_0x1394f3[_0xdbc0('0x7')]),_0x1394f3);if(!_['isNil'](_0x1394f3['variable'][_0xdbc0('0x48')])){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x49'),_0x1394f3['uniqueid'],_0x1394f3[_0xdbc0('0x4a')]));channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x4b')]=_0x1394f3[_0xdbc0('0x4a')];}if(!_[_0xdbc0('0x21')](_0x1394f3['variable'][_0xdbc0('0x4c')])){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1394f3[_0xdbc0('0x7')],_0x1394f3[_0xdbc0('0x4a')]));channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x4d')]=_0x1394f3[_0xdbc0('0x4a')];channels[_0x1394f3[_0xdbc0('0x7')]]['callerid']='\x22'+_0x1394f3[_0xdbc0('0x4a')]+_0xdbc0('0x4e')+_0x1394f3[_0xdbc0('0x4a')]+'>';}if(!_['isNil'](_0x1394f3[_0xdbc0('0x4f')][_0xdbc0('0x50')])||!_['isNil'](_0x1394f3['variable'][_0xdbc0('0x51')])){utils['info'](util[_0xdbc0('0x18')](_0xdbc0('0x52'),_0x1394f3[_0xdbc0('0x7')],!_[_0xdbc0('0x21')](_0x1394f3['variable']['xmd-callerid-preview'])?_0xdbc0('0x50'):'xmd-callerid',_0x1394f3[_0xdbc0('0x4a')]));channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x2b')]=_0x1394f3[_0xdbc0('0x4a')];}if(!_[_0xdbc0('0x21')](_0x1394f3[_0xdbc0('0x4f')][_0xdbc0('0x53')])||!_[_0xdbc0('0x21')](_0x1394f3['variable'][_0xdbc0('0x54')])){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1394f3[_0xdbc0('0x7')],!_['isNil'](_0x1394f3[_0xdbc0('0x4f')][_0xdbc0('0x53')])?_0xdbc0('0x53'):_0xdbc0('0x54'),_0x1394f3[_0xdbc0('0x4a')]));channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x55')]='Queue';channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x56')]=_0x1394f3[_0xdbc0('0x4a')];channels[_0x1394f3['uniqueid']][_0xdbc0('0x9')]=!![];}if(!_[_0xdbc0('0x21')](_0x1394f3[_0xdbc0('0x4f')]['xmd-contactid'])){utils[_0xdbc0('0x5')](util['format'](_0xdbc0('0x57'),_0x1394f3[_0xdbc0('0x7')],_0x1394f3[_0xdbc0('0x4a')]));channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x58')]=_0x1394f3[_0xdbc0('0x4a')];}if(!_[_0xdbc0('0x21')](_0x1394f3['variable'][_0xdbc0('0x59')])){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x5a'),_0x1394f3[_0xdbc0('0x7')],_0x1394f3[_0xdbc0('0x4a')]));channels[_0x1394f3[_0xdbc0('0x7')]]['type']=_0x1394f3[_0xdbc0('0x4a')];}if(!_['isNil'](_0x1394f3[_0xdbc0('0x4f')][_0xdbc0('0x5b')])){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x5c'),_0x1394f3['uniqueid'],_0x1394f3[_0xdbc0('0x4a')]));channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x5d')]=_0x1394f3[_0xdbc0('0x4a')];}if(!_['isNil'](_0x1394f3[_0xdbc0('0x4f')][_0xdbc0('0x5e')])){utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x1394f3[_0xdbc0('0x7')],_0x1394f3['value']));channels[_0x1394f3[_0xdbc0('0x7')]][_0xdbc0('0x5e')]=_0x1394f3[_0xdbc0('0x4a')];}}}catch(_0x5511b3){utils[_0xdbc0('0x1e')](util[_0xdbc0('0x18')](_0xdbc0('0x47'),_0x1394f3[_0xdbc0('0x7')]),_0x5511b3);}};exports['newexten']=function(_0x5a6e83){try{if(!_['isNil'](channels[_0x5a6e83[_0xdbc0('0x7')]])){utils[_0xdbc0('0x15')](util[_0xdbc0('0x18')](_0xdbc0('0x5f'),_0x5a6e83[_0xdbc0('0x7')]),_0x5a6e83);utils[_0xdbc0('0x5')](util[_0xdbc0('0x18')](_0xdbc0('0x60'),_0x5a6e83[_0xdbc0('0x7')],_0x5a6e83['application'],_0x5a6e83[_0xdbc0('0x61')]));if(_0x5a6e83[_0xdbc0('0x62')][_0xdbc0('0x63')]()=='set'&&_['startsWith'](_0x5a6e83['appdata'][_0xdbc0('0x63')](),_0xdbc0('0x64'))){var _0x4803ee=_0x5a6e83['appdata'][_0xdbc0('0x65')]('=');var _0x303aad=_0x4803ee[0x0][_0xdbc0('0x66')](_0x4803ee[0x0][_0xdbc0('0x67')]('(')+0x1,_0x4803ee[0x0][_0xdbc0('0x67')](')'));var _0x548f8a=_0x4803ee[0x1];channels[_0x5a6e83[_0xdbc0('0x7')]][_0x303aad]=_0x548f8a;}if(!_[_0xdbc0('0x68')]([_0xdbc0('0x29'),_0xdbc0('0x69'),'execif',_0xdbc0('0x6a'),_0xdbc0('0x6b')],_0x5a6e83['application'][_0xdbc0('0x63')]())){channels[_0x5a6e83['uniqueid']][_0xdbc0('0x55')]=_0x5a6e83[_0xdbc0('0x62')];channels[_0x5a6e83['uniqueid']][_0xdbc0('0x56')]=_0x5a6e83[_0xdbc0('0x61')];}}}catch(_0x3819b9){utils['error'](util[_0xdbc0('0x18')](_0xdbc0('0x5f'),_0x5a6e83[_0xdbc0('0x7')]),_0x3819b9);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 5961601..e0593c6 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 _0xad68=['error','close','[core]\x20close','managerevent','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xad68,0x100));var _0x8ad6=function(_0x56d550,_0x1c3fd0){_0x56d550=_0x56d550-0x0;var _0x5e6a91=_0xad68[_0x56d550];return _0x5e6a91;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x8ad6('0x0')](_0x8ad6('0x1'));};exports['shutdown']=function(){utils['info'](_0x8ad6('0x2'));};exports[_0x8ad6('0x3')]=function(){utils[_0x8ad6('0x0')](_0x8ad6('0x4'));};exports[_0x8ad6('0x5')]=function(_0x2f1d3b){utils[_0x8ad6('0x5')]('[core]\x20error',_0x2f1d3b);};exports[_0x8ad6('0x6')]=function(){utils[_0x8ad6('0x0')](_0x8ad6('0x7'));};exports[_0x8ad6('0x8')]=function(_0x2680e5){}; \ No newline at end of file +var _0xa3b8=['managerevent','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20close'];(function(_0x4ac5e4,_0x21e521){var _0x3baebe=function(_0x2cecaf){while(--_0x2cecaf){_0x4ac5e4['push'](_0x4ac5e4['shift']());}};_0x3baebe(++_0x21e521);}(_0xa3b8,0x118));var _0x8a3b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa3b8[_0x1facfa];return _0x9ec701;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x8a3b('0x0')](_0x8a3b('0x1'));};exports[_0x8a3b('0x2')]=function(){utils[_0x8a3b('0x0')](_0x8a3b('0x3'));};exports[_0x8a3b('0x4')]=function(){utils[_0x8a3b('0x0')](_0x8a3b('0x5'));};exports[_0x8a3b('0x6')]=function(_0x4e1689){utils[_0x8a3b('0x6')]('[core]\x20error',_0x4e1689);};exports['close']=function(){utils['info'](_0x8a3b('0x7'));};exports[_0x8a3b('0x8')]=function(_0x55cd80){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 0d71e88..1f12b9d 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 _0x9ed2=['[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','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','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','varset','isNil','outboundrouteid'];(function(_0x3541da,_0x5b2254){var _0xa24cff=function(_0x17f5a3){while(--_0x17f5a3){_0x3541da['push'](_0x3541da['shift']());}};_0xa24cff(++_0x5b2254);}(_0x9ed2,0xba));var _0x29ed=function(_0xf9a6cf,_0x11870e){_0xf9a6cf=_0xf9a6cf-0x0;var _0x59e2bc=_0x9ed2[_0xf9a6cf];return _0x59e2bc;};'use strict';var _=require(_0x29ed('0x0'));var util=require(_0x29ed('0x1'));var utils=require(_0x29ed('0x2'));var dials={};function writeDB(_0x116514){utils[_0x29ed('0x3')](util['format'](_0x29ed('0x4'),_0x116514[_0x29ed('0x5')],_0x116514['channel'],_0x116514[_0x29ed('0x6')],_0x116514[_0x29ed('0x7')],_0x116514[_0x29ed('0x8')],_0x116514['dialstatus']));utils['request'](_0x29ed('0x9'),_0x116514);delete dials[_0x116514['uniqueid']];}exports[_0x29ed('0xa')]=function(_0xfa544b){try{utils[_0x29ed('0xb')](util[_0x29ed('0xc')](_0x29ed('0xd'),_0xfa544b[_0x29ed('0x5')]),_0xfa544b);utils[_0x29ed('0x3')](util[_0x29ed('0xc')](_0x29ed('0xe'),_0xfa544b[_0x29ed('0x5')],_0xfa544b[_0x29ed('0xf')],_0xfa544b['appdata']));if(_0xfa544b[_0x29ed('0xf')][_0x29ed('0x10')]()==_0x29ed('0x11')&&_[_0x29ed('0x12')](_0xfa544b[_0x29ed('0x13')][_0x29ed('0x10')](),_0x29ed('0x14'))){var _0x21f834=_0xfa544b['appdata'][_0x29ed('0x15')]('=');dials[_0xfa544b[_0x29ed('0x5')]]={'routeId':_0x21f834[0x1]};}}catch(_0x400443){utils[_0x29ed('0x16')](util[_0x29ed('0xc')](_0x29ed('0xd'),_0xfa544b['uniqueid']),_0x400443);}};exports[_0x29ed('0x17')]=function(_0xdc83cd){try{utils[_0x29ed('0xb')](util[_0x29ed('0xc')]('[%s][dials][varset]',_0xdc83cd[_0x29ed('0x5')]),_0xdc83cd);if(!_[_0x29ed('0x18')](_0xdc83cd['variable'][_0x29ed('0x19')])){utils[_0x29ed('0x3')](util[_0x29ed('0xc')](_0x29ed('0x1a'),_0xdc83cd['uniqueid'],_0xdc83cd[_0x29ed('0x1b')]));dials[_0xdc83cd[_0x29ed('0x5')]]={'routeId':_0xdc83cd[_0x29ed('0x1b')]};}}catch(_0x73e386){utils[_0x29ed('0x16')](util[_0x29ed('0xc')]('[%s][dials][varset]',_0xdc83cd['uniqueid']),_0x73e386);}};exports[_0x29ed('0x1c')]=function(_0x4cc7de){try{if(!_[_0x29ed('0x18')](dials[_0x4cc7de[_0x29ed('0x5')]])){utils[_0x29ed('0xb')](util['format'](_0x29ed('0x1d'),_0x4cc7de['uniqueid']),_0x4cc7de);dials[_0x4cc7de[_0x29ed('0x5')]]=_['assign'](dials[_0x4cc7de['uniqueid']],_0x4cc7de);dials[_0x4cc7de[_0x29ed('0x5')]][_0x29ed('0x1e')]=utils[_0x29ed('0x1f')]();dials[_0x4cc7de[_0x29ed('0x5')]]['lastevent']=_0x29ed('0x20');utils[_0x29ed('0x3')](util['format'](_0x29ed('0x21'),_0x4cc7de[_0x29ed('0x5')],dials[_0x4cc7de[_0x29ed('0x5')]][_0x29ed('0x1e')]));}}catch(_0x4d7990){utils[_0x29ed('0x16')](util[_0x29ed('0xc')]('[%s][dials][dialbegin]',_0x4cc7de[_0x29ed('0x5')]),_0x4d7990);}};exports[_0x29ed('0x22')]=function(_0x26b941){try{if(!_['isNil'](dials[_0x26b941['uniqueid']])){utils[_0x29ed('0xb')](util[_0x29ed('0xc')](_0x29ed('0x23'),_0x26b941['uniqueid']),_0x26b941);dials[_0x26b941[_0x29ed('0x5')]][_0x29ed('0x24')]=_0x26b941[_0x29ed('0x24')];if(_0x26b941['dialstatus']==_0x29ed('0x25')){dials[_0x26b941[_0x29ed('0x5')]]=_[_0x29ed('0x26')](dials[_0x26b941['uniqueid']],_0x26b941);dials[_0x26b941['uniqueid']][_0x29ed('0x27')]=utils['now']();dials[_0x26b941[_0x29ed('0x5')]]['lastevent']=_0x29ed('0x28');utils[_0x29ed('0x3')](util['format'](_0x29ed('0x29'),_0x26b941[_0x29ed('0x5')],_0x26b941['dialstatus'],dials[_0x26b941[_0x29ed('0x5')]][_0x29ed('0x27')]));}else{utils['info'](util[_0x29ed('0xc')](_0x29ed('0x2a'),_0x26b941[_0x29ed('0x5')],_0x26b941[_0x29ed('0x24')]));}}}catch(_0x56872f){utils[_0x29ed('0x16')](util['format'](_0x29ed('0x23'),_0x26b941[_0x29ed('0x5')]),_0x56872f);}};exports[_0x29ed('0x2b')]=function(_0x48013d){try{if(!_['isNil'](dials[_0x48013d[_0x29ed('0x5')]])){utils[_0x29ed('0xb')](util[_0x29ed('0xc')](_0x29ed('0x2c'),_0x48013d[_0x29ed('0x5')]),_0x48013d);utils[_0x29ed('0x3')](util[_0x29ed('0xc')](_0x29ed('0x2d'),_0x48013d[_0x29ed('0x5')],_0x48013d[_0x29ed('0x7')],_0x48013d[_0x29ed('0x2e')],_0x48013d[_0x29ed('0x2f')]));dials[_0x48013d[_0x29ed('0x5')]]=_[_0x29ed('0x26')](dials[_0x48013d['uniqueid']],{'endtime':utils[_0x29ed('0x1f')](),'lastevent':_0x29ed('0x30')});dials[_0x48013d[_0x29ed('0x5')]]['duration']=utils[_0x29ed('0x31')](dials[_0x48013d[_0x29ed('0x5')]][_0x29ed('0x32')],dials[_0x48013d[_0x29ed('0x5')]]['starttime']);dials[_0x48013d[_0x29ed('0x5')]][_0x29ed('0x33')]=utils[_0x29ed('0x31')](dials[_0x48013d[_0x29ed('0x5')]]['answertime']||dials[_0x48013d[_0x29ed('0x5')]][_0x29ed('0x32')],dials[_0x48013d['uniqueid']]['starttime']);dials[_0x48013d[_0x29ed('0x5')]][_0x29ed('0x34')]=dials[_0x48013d[_0x29ed('0x5')]]['answertime']?utils[_0x29ed('0x31')](dials[_0x48013d[_0x29ed('0x5')]][_0x29ed('0x32')],dials[_0x48013d[_0x29ed('0x5')]][_0x29ed('0x27')]):0x0;writeDB(dials[_0x48013d[_0x29ed('0x5')]]);}}catch(_0x368e88){utils[_0x29ed('0x16')](util[_0x29ed('0xc')](_0x29ed('0x2c'),_0x48013d[_0x29ed('0x5')]),_0x368e88);}}; \ No newline at end of file +var _0xbaa2=['split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','outboundrouteid','value','debug','[%s][dials][dialbegin]','starttime','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','now','lastevent','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)'];(function(_0x409ad2,_0x5129c1){var _0x595b5f=function(_0x592974){while(--_0x592974){_0x409ad2['push'](_0x409ad2['shift']());}};_0x595b5f(++_0x5129c1);}(_0xbaa2,0x137));var _0x2baa=function(_0x3f2ce5,_0x7e3097){_0x3f2ce5=_0x3f2ce5-0x0;var _0x3afeea=_0xbaa2[_0x3f2ce5];return _0x3afeea;};'use strict';var _=require(_0x2baa('0x0'));var util=require(_0x2baa('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x2138f7){utils['info'](util[_0x2baa('0x2')](_0x2baa('0x3'),_0x2138f7[_0x2baa('0x4')],_0x2138f7['channel'],_0x2138f7[_0x2baa('0x5')],_0x2138f7[_0x2baa('0x6')],_0x2138f7[_0x2baa('0x7')],_0x2138f7[_0x2baa('0x8')]));utils['request'](_0x2baa('0x9'),_0x2138f7);delete dials[_0x2138f7[_0x2baa('0x4')]];}exports[_0x2baa('0xa')]=function(_0x52c3e5){try{utils['debug'](util['format']('[%s][dials][newexten]',_0x52c3e5[_0x2baa('0x4')]),_0x52c3e5);utils[_0x2baa('0xb')](util[_0x2baa('0x2')](_0x2baa('0xc'),_0x52c3e5[_0x2baa('0x4')],_0x52c3e5[_0x2baa('0xd')],_0x52c3e5[_0x2baa('0xe')]));if(_0x52c3e5['application'][_0x2baa('0xf')]()==_0x2baa('0x10')&&_['startsWith'](_0x52c3e5[_0x2baa('0xe')][_0x2baa('0xf')](),_0x2baa('0x11'))){var _0x309994=_0x52c3e5['appdata'][_0x2baa('0x12')]('=');dials[_0x52c3e5['uniqueid']]={'routeId':_0x309994[0x1]};}}catch(_0x18aab8){utils[_0x2baa('0x13')](util['format'](_0x2baa('0x14'),_0x52c3e5[_0x2baa('0x4')]),_0x18aab8);}};exports[_0x2baa('0x15')]=function(_0x30237e){try{utils['debug'](util[_0x2baa('0x2')](_0x2baa('0x16'),_0x30237e[_0x2baa('0x4')]),_0x30237e);if(!_[_0x2baa('0x17')](_0x30237e['variable'][_0x2baa('0x18')])){utils['info'](util[_0x2baa('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x30237e[_0x2baa('0x4')],_0x30237e[_0x2baa('0x19')]));dials[_0x30237e[_0x2baa('0x4')]]={'routeId':_0x30237e['value']};}}catch(_0x50befe){utils[_0x2baa('0x13')](util['format'](_0x2baa('0x16'),_0x30237e[_0x2baa('0x4')]),_0x50befe);}};exports['dialbegin']=function(_0x2f8650){try{if(!_[_0x2baa('0x17')](dials[_0x2f8650['uniqueid']])){utils[_0x2baa('0x1a')](util[_0x2baa('0x2')](_0x2baa('0x1b'),_0x2f8650[_0x2baa('0x4')]),_0x2f8650);dials[_0x2f8650[_0x2baa('0x4')]]=_['assign'](dials[_0x2f8650[_0x2baa('0x4')]],_0x2f8650);dials[_0x2f8650[_0x2baa('0x4')]][_0x2baa('0x1c')]=utils['now']();dials[_0x2f8650[_0x2baa('0x4')]]['lastevent']='called';utils[_0x2baa('0xb')](util[_0x2baa('0x2')](_0x2baa('0x1d'),_0x2f8650[_0x2baa('0x4')],dials[_0x2f8650[_0x2baa('0x4')]][_0x2baa('0x1c')]));}}catch(_0x25c6f9){utils[_0x2baa('0x13')](util['format'](_0x2baa('0x1b'),_0x2f8650['uniqueid']),_0x25c6f9);}};exports[_0x2baa('0x1e')]=function(_0xce52ca){try{if(!_[_0x2baa('0x17')](dials[_0xce52ca[_0x2baa('0x4')]])){utils[_0x2baa('0x1a')](util[_0x2baa('0x2')](_0x2baa('0x1f'),_0xce52ca['uniqueid']),_0xce52ca);dials[_0xce52ca[_0x2baa('0x4')]][_0x2baa('0x8')]=_0xce52ca[_0x2baa('0x8')];if(_0xce52ca['dialstatus']==_0x2baa('0x20')){dials[_0xce52ca['uniqueid']]=_['assign'](dials[_0xce52ca['uniqueid']],_0xce52ca);dials[_0xce52ca['uniqueid']][_0x2baa('0x21')]=utils[_0x2baa('0x22')]();dials[_0xce52ca[_0x2baa('0x4')]][_0x2baa('0x23')]='connect';utils[_0x2baa('0xb')](util[_0x2baa('0x2')](_0x2baa('0x24'),_0xce52ca[_0x2baa('0x4')],_0xce52ca[_0x2baa('0x8')],dials[_0xce52ca['uniqueid']][_0x2baa('0x21')]));}else{utils[_0x2baa('0xb')](util[_0x2baa('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0xce52ca['uniqueid'],_0xce52ca[_0x2baa('0x8')]));}}}catch(_0x13c07d){utils[_0x2baa('0x13')](util['format'](_0x2baa('0x1f'),_0xce52ca['uniqueid']),_0x13c07d);}};exports[_0x2baa('0x25')]=function(_0x7676cb){try{if(!_['isNil'](dials[_0x7676cb[_0x2baa('0x4')]])){utils['debug'](util[_0x2baa('0x2')](_0x2baa('0x26'),_0x7676cb[_0x2baa('0x4')]),_0x7676cb);utils[_0x2baa('0xb')](util[_0x2baa('0x2')](_0x2baa('0x27'),_0x7676cb[_0x2baa('0x4')],_0x7676cb[_0x2baa('0x6')],_0x7676cb[_0x2baa('0x28')],_0x7676cb[_0x2baa('0x29')]));dials[_0x7676cb[_0x2baa('0x4')]]=_['assign'](dials[_0x7676cb[_0x2baa('0x4')]],{'endtime':utils[_0x2baa('0x22')](),'lastevent':'complete'});dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x2a')]=utils[_0x2baa('0x2b')](dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x2c')],dials[_0x7676cb['uniqueid']][_0x2baa('0x1c')]);dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x2d')]=utils['diffTime'](dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x21')]||dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x2c')],dials[_0x7676cb['uniqueid']][_0x2baa('0x1c')]);dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x2e')]=dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x21')]?utils[_0x2baa('0x2b')](dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x2c')],dials[_0x7676cb[_0x2baa('0x4')]][_0x2baa('0x21')]):0x0;writeDB(dials[_0x7676cb['uniqueid']]);}}catch(_0x20899a){utils['error'](util['format'](_0x2baa('0x26'),_0x7676cb['uniqueid']),_0x20899a);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index c3bfffe..59d9ce9 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 _0x3b30=['[%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]','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','format','devicestatechange','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','debug','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop'];(function(_0x542acd,_0x56579e){var _0x3a92e1=function(_0x2edbba){while(--_0x2edbba){_0x542acd['push'](_0x542acd['shift']());}};_0x3a92e1(++_0x56579e);}(_0x3b30,0xa2));var _0x03b3=function(_0x11111b,_0x5aac60){_0x11111b=_0x11111b-0x0;var _0x24f89c=_0x3b30[_0x11111b];return _0x24f89c;};var AsteriskManager=require('asterisk-manager');var config=require(_0x03b3('0x0'));var utils=require(_0x03b3('0x1'));var util=require(_0x03b3('0x2'));var isXDREnabled=config[_0x03b3('0x3')]&&config['xdr'][_0x03b3('0x4')]?!config['xdr'][_0x03b3('0x4')]:!![];var isProduction=config[_0x03b3('0x5')]===_0x03b3('0x6')||![];var isLocalAsterisk=config['xdr']&&config[_0x03b3('0x3')][_0x03b3('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x03b3('0x8')][_0x03b3('0x9')],config[_0x03b3('0x8')]['ip'],config[_0x03b3('0x8')][_0x03b3('0xa')],config[_0x03b3('0x8')][_0x03b3('0xb')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x03b3('0xc')](_0x03b3('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x03b3('0xc')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x03b3('0xe'));var calls=require(_0x03b3('0xf'));var queues=require('./queues.controller');var recordings=require(_0x03b3('0x10'));var members=require(_0x03b3('0x11'));var dials=require(_0x03b3('0x12'));var transfers=require(_0x03b3('0x13'));var core=require(_0x03b3('0x14'));ami['on'](_0x03b3('0x15'),core['connect']);ami['on']('shutdown',core['shutdown']);ami['on']('fullybooted',core[_0x03b3('0x16')]);ami['on'](_0x03b3('0x17'),core['error']);ami['on'](_0x03b3('0x18'),core[_0x03b3('0x18')]);ami['on'](_0x03b3('0x19'),core[_0x03b3('0x19')]);ami['on']('devicestatechange',function(_0x197b5b){try{utils['debug'](util[_0x03b3('0x1a')]('[%s][index][devicestatechange]',_0x197b5b['device']),_0x197b5b);members[_0x03b3('0x1b')](_0x197b5b);}catch(_0x348d5e){utils['error'](util[_0x03b3('0x1a')](_0x03b3('0x1c'),_0x197b5b[_0x03b3('0x1d')]),_0x348d5e);}});ami['on'](_0x03b3('0x1e'),function(_0x466ad6){try{utils['debug'](util['format']('[%s][index][agentcalled]',_0x466ad6[_0x03b3('0x1f')]),_0x466ad6);agents[_0x03b3('0x1e')](_0x466ad6);}catch(_0x26ded0){utils[_0x03b3('0x17')](util[_0x03b3('0x1a')](_0x03b3('0x20'),_0x466ad6[_0x03b3('0x1f')]),_0x26ded0);}});ami['on'](_0x03b3('0x21'),function(_0x3032d9){try{utils[_0x03b3('0x22')](util[_0x03b3('0x1a')]('[%s][index][agentringnoanswer]',_0x3032d9['uniqueid']),_0x3032d9);agents[_0x03b3('0x21')](_0x3032d9);}catch(_0x4b1724){utils['error'](util[_0x03b3('0x1a')]('[%s][index][agentringnoanswer]',_0x3032d9[_0x03b3('0x1f')]),_0x4b1724);}});ami['on'](_0x03b3('0x23'),function(_0x2e66ec){try{utils[_0x03b3('0x22')](util[_0x03b3('0x1a')](_0x03b3('0x24'),_0x2e66ec[_0x03b3('0x1f')]),_0x2e66ec);agents[_0x03b3('0x23')](_0x2e66ec);queues[_0x03b3('0x23')](_0x2e66ec);}catch(_0x1d1c3b){utils[_0x03b3('0x17')](util['format']('[%s][index][agentconnect]',_0x2e66ec[_0x03b3('0x1f')]),_0x1d1c3b);}});ami['on']('agentcomplete',function(_0x5be26){try{utils['debug'](util[_0x03b3('0x1a')](_0x03b3('0x25'),_0x5be26['uniqueid']),_0x5be26);agents['agentcomplete'](_0x5be26);queues[_0x03b3('0x26')](_0x5be26);members[_0x03b3('0x26')](_0x5be26);}catch(_0xdd5d66){utils[_0x03b3('0x17')](util[_0x03b3('0x1a')](_0x03b3('0x25'),_0x5be26[_0x03b3('0x1f')]),_0xdd5d66);}});ami['on'](_0x03b3('0x27'),function(_0x184e3e){try{utils[_0x03b3('0x22')](util[_0x03b3('0x1a')](_0x03b3('0x28'),_0x184e3e['uniqueid']),_0x184e3e);agents[_0x03b3('0x27')](_0x184e3e);queues['queuecallerabandon'](_0x184e3e);}catch(_0x2ed377){utils['error'](util['format'](_0x03b3('0x28'),_0x184e3e[_0x03b3('0x1f')]),_0x2ed377);}});ami['on'](_0x03b3('0x29'),function(_0x129ee2){try{utils[_0x03b3('0x22')](util[_0x03b3('0x1a')](_0x03b3('0x2a'),_0x129ee2['uniqueid']),_0x129ee2);queues[_0x03b3('0x29')](_0x129ee2);recordings['queuecallerjoin'](_0x129ee2);}catch(_0x1dec11){utils[_0x03b3('0x17')](util['format'](_0x03b3('0x2a'),_0x129ee2[_0x03b3('0x1f')]),_0x1dec11);}});ami['on'](_0x03b3('0x2b'),function(_0x50fedb){try{utils[_0x03b3('0x22')](util[_0x03b3('0x1a')](_0x03b3('0x2c'),_0x50fedb[_0x03b3('0x1f')]),_0x50fedb);queues[_0x03b3('0x2b')](_0x50fedb);}catch(_0x514bd5){utils[_0x03b3('0x17')](util[_0x03b3('0x1a')](_0x03b3('0x2c'),_0x50fedb[_0x03b3('0x1f')]),_0x514bd5);}});ami['on'](_0x03b3('0x2d'),function(_0x1f5a08){try{utils[_0x03b3('0x22')](util['format'](_0x03b3('0x2e'),_0x1f5a08[_0x03b3('0x1f')]),_0x1f5a08);queues['musiconholdstart'](_0x1f5a08);calls[_0x03b3('0x2d')](_0x1f5a08);}catch(_0x1fe79d){utils[_0x03b3('0x17')](util[_0x03b3('0x1a')](_0x03b3('0x2e'),_0x1f5a08[_0x03b3('0x1f')]),_0x1fe79d);}});ami['on'](_0x03b3('0x2f'),function(_0x4c03af){try{utils['debug'](util[_0x03b3('0x1a')](_0x03b3('0x30'),_0x4c03af['uniqueid']),_0x4c03af);queues[_0x03b3('0x2f')](_0x4c03af);calls[_0x03b3('0x2f')](_0x4c03af);}catch(_0x3951b1){utils[_0x03b3('0x17')](util[_0x03b3('0x1a')]('[%s][index][musiconholdstop]',_0x4c03af[_0x03b3('0x1f')]),_0x3951b1);}});ami['on'](_0x03b3('0x31'),function(_0x1ea323){try{utils[_0x03b3('0x22')](util[_0x03b3('0x1a')](_0x03b3('0x32'),_0x1ea323[_0x03b3('0x1f')]),_0x1ea323);calls['newstate'](_0x1ea323);recordings[_0x03b3('0x31')](_0x1ea323);}catch(_0x3d0e82){utils[_0x03b3('0x17')](util[_0x03b3('0x1a')](_0x03b3('0x32'),_0x1ea323[_0x03b3('0x1f')]),_0x3d0e82);}});ami['on'](_0x03b3('0x33'),function(_0x1115a0){try{utils['debug'](util[_0x03b3('0x1a')](_0x03b3('0x34'),_0x1115a0[_0x03b3('0x1f')]),_0x1115a0);calls[_0x03b3('0x33')](_0x1115a0);recordings[_0x03b3('0x33')](_0x1115a0);dials[_0x03b3('0x33')](_0x1115a0);agents[_0x03b3('0x33')](_0x1115a0);queues[_0x03b3('0x33')](_0x1115a0);}catch(_0xe98688){utils[_0x03b3('0x17')](util['format'](_0x03b3('0x34'),_0x1115a0[_0x03b3('0x1f')]),_0xe98688);}});ami['on'](_0x03b3('0x35'),function(_0x3c501e){try{utils[_0x03b3('0x22')](util[_0x03b3('0x1a')](_0x03b3('0x36'),_0x3c501e[_0x03b3('0x1f')]),_0x3c501e);members['cdr'](_0x3c501e);}catch(_0x40a2d9){utils['error'](util['format'](_0x03b3('0x36'),_0x3c501e['uniqueid']),_0x40a2d9);}});ami['on'](_0x03b3('0x37'),function(_0x4875f8){try{utils['debug'](util[_0x03b3('0x1a')](_0x03b3('0x38'),_0x4875f8[_0x03b3('0x1f')]),_0x4875f8);queues[_0x03b3('0x37')](_0x4875f8);agents[_0x03b3('0x37')](_0x4875f8);transfers['blindtransfer'](_0x4875f8);}catch(_0x1b7118){utils['error'](util['format'](_0x03b3('0x38'),_0x4875f8[_0x03b3('0x1f')]),_0x1b7118);}});ami['on'](_0x03b3('0x39'),function(_0x3730a3){try{utils[_0x03b3('0x22')](util['format']('[%s][index][attendedtransfer]',_0x3730a3[_0x03b3('0x3a')]),_0x3730a3);queues[_0x03b3('0x39')](_0x3730a3);transfers[_0x03b3('0x39')](_0x3730a3);agents[_0x03b3('0x39')](_0x3730a3);calls[_0x03b3('0x39')](_0x3730a3);}catch(_0x1c53f6){utils[_0x03b3('0x17')](util[_0x03b3('0x1a')](_0x03b3('0x3b'),_0x3730a3[_0x03b3('0x3a')]),_0x1c53f6);}});ami['on'](_0x03b3('0x3c'),function(_0x396651){try{utils[_0x03b3('0x22')](util[_0x03b3('0x1a')](_0x03b3('0x3d'),_0x396651[_0x03b3('0x1f')]),_0x396651);queues['varset'](_0x396651);recordings[_0x03b3('0x3c')](_0x396651);calls[_0x03b3('0x3c')](_0x396651);dials[_0x03b3('0x3c')](_0x396651);}catch(_0x19abac){utils[_0x03b3('0x17')](util[_0x03b3('0x1a')]('[%s][index][varset]',_0x396651[_0x03b3('0x1f')]),_0x19abac);}});ami['on'](_0x03b3('0x3e'),function(_0x3bcd0d){try{utils[_0x03b3('0x22')](util[_0x03b3('0x1a')](_0x03b3('0x3f'),_0x3bcd0d['uniqueid']),_0x3bcd0d);calls[_0x03b3('0x3e')](_0x3bcd0d);recordings[_0x03b3('0x3e')](_0x3bcd0d);dials[_0x03b3('0x3e')](_0x3bcd0d);}catch(_0x2d4f5c){utils[_0x03b3('0x17')](util[_0x03b3('0x1a')](_0x03b3('0x3f'),_0x3bcd0d['uniqueid']),_0x2d4f5c);}});ami['on'](_0x03b3('0x40'),function(_0x2dfe94){try{utils[_0x03b3('0x22')](util['format'](_0x03b3('0x41'),_0x2dfe94[_0x03b3('0x1f')]),_0x2dfe94);calls[_0x03b3('0x40')](_0x2dfe94);recordings[_0x03b3('0x40')](_0x2dfe94);}catch(_0x38cee2){utils[_0x03b3('0x17')](util['format']('[%s][index][newchannel]',_0x2dfe94[_0x03b3('0x1f')]),_0x38cee2);}});ami['on'](_0x03b3('0x42'),function(_0xf39a80){try{utils[_0x03b3('0x22')](util[_0x03b3('0x1a')](_0x03b3('0x43'),_0xf39a80[_0x03b3('0x1f')]),_0xf39a80);dials[_0x03b3('0x42')](_0xf39a80);}catch(_0x46a0b6){utils['error'](util[_0x03b3('0x1a')]('[%s]dialbegin',_0xf39a80[_0x03b3('0x1f')]),_0x46a0b6);}});ami['on'](_0x03b3('0x44'),function(_0x5604e5){try{utils['debug'](util[_0x03b3('0x1a')]('[%s][index][dialend]',_0x5604e5[_0x03b3('0x1f')]),_0x5604e5);dials[_0x03b3('0x44')](_0x5604e5);}catch(_0x5da6a8){utils[_0x03b3('0x17')](util['format'](_0x03b3('0x45'),_0x5604e5['uniqueid']),_0x5da6a8);}});} \ No newline at end of file +var _0x5296=['XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','format','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','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]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','local','asterisk','username','keepConnected','info'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0x5296,0x1a4));var _0x6529=function(_0x366bfe,_0x2cc28b){_0x366bfe=_0x366bfe-0x0;var _0x156f93=_0x5296[_0x366bfe];return _0x156f93;};var AsteriskManager=require(_0x6529('0x0'));var config=require('../../config/environment');var utils=require(_0x6529('0x1'));var util=require(_0x6529('0x2'));var isXDREnabled=config['xdr']&&config[_0x6529('0x3')]['disabled']?!config[_0x6529('0x3')][_0x6529('0x4')]:!![];var isProduction=config[_0x6529('0x5')]===_0x6529('0x6')||![];var isLocalAsterisk=config[_0x6529('0x3')]&&config['xdr'][_0x6529('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x6529('0x8')]['port'],config[_0x6529('0x8')]['ip'],config[_0x6529('0x8')][_0x6529('0x9')],config[_0x6529('0x8')]['password'],!![]);ami[_0x6529('0xa')]();if(!isXDREnabled){utils[_0x6529('0xb')](_0x6529('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x6529('0xb')](_0x6529('0xd'));}else{var agents=require(_0x6529('0xe'));var calls=require(_0x6529('0xf'));var queues=require(_0x6529('0x10'));var recordings=require(_0x6529('0x11'));var members=require(_0x6529('0x12'));var dials=require(_0x6529('0x13'));var transfers=require(_0x6529('0x14'));var core=require(_0x6529('0x15'));ami['on'](_0x6529('0x16'),core[_0x6529('0x16')]);ami['on'](_0x6529('0x17'),core[_0x6529('0x17')]);ami['on'](_0x6529('0x18'),core[_0x6529('0x18')]);ami['on'](_0x6529('0x19'),core[_0x6529('0x19')]);ami['on']('close',core[_0x6529('0x1a')]);ami['on'](_0x6529('0x1b'),core[_0x6529('0x1b')]);ami['on'](_0x6529('0x1c'),function(_0x50f8fb){try{utils[_0x6529('0x1d')](util['format'](_0x6529('0x1e'),_0x50f8fb['device']),_0x50f8fb);members[_0x6529('0x1c')](_0x50f8fb);}catch(_0x56ad32){utils[_0x6529('0x19')](util[_0x6529('0x1f')]('[%s][index][devicestatechange]',_0x50f8fb[_0x6529('0x20')]),_0x56ad32);}});ami['on'](_0x6529('0x21'),function(_0x3eb92d){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')]('[%s][index][agentcalled]',_0x3eb92d[_0x6529('0x22')]),_0x3eb92d);agents[_0x6529('0x21')](_0x3eb92d);}catch(_0x412ede){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x23'),_0x3eb92d[_0x6529('0x22')]),_0x412ede);}});ami['on'](_0x6529('0x24'),function(_0x5099ac){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x25'),_0x5099ac[_0x6529('0x22')]),_0x5099ac);agents[_0x6529('0x24')](_0x5099ac);}catch(_0x5aeb43){utils[_0x6529('0x19')](util[_0x6529('0x1f')]('[%s][index][agentringnoanswer]',_0x5099ac[_0x6529('0x22')]),_0x5aeb43);}});ami['on'](_0x6529('0x26'),function(_0x213295){try{utils['debug'](util[_0x6529('0x1f')]('[%s][index][agentconnect]',_0x213295[_0x6529('0x22')]),_0x213295);agents[_0x6529('0x26')](_0x213295);queues['agentconnect'](_0x213295);}catch(_0xdebbe4){utils['error'](util[_0x6529('0x1f')]('[%s][index][agentconnect]',_0x213295['uniqueid']),_0xdebbe4);}});ami['on']('agentcomplete',function(_0x1dc664){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x27'),_0x1dc664[_0x6529('0x22')]),_0x1dc664);agents[_0x6529('0x28')](_0x1dc664);queues[_0x6529('0x28')](_0x1dc664);members[_0x6529('0x28')](_0x1dc664);}catch(_0x279434){utils['error'](util['format'](_0x6529('0x27'),_0x1dc664[_0x6529('0x22')]),_0x279434);}});ami['on'](_0x6529('0x29'),function(_0x323e26){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x2a'),_0x323e26[_0x6529('0x22')]),_0x323e26);agents[_0x6529('0x29')](_0x323e26);queues[_0x6529('0x29')](_0x323e26);}catch(_0x178cde){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x2a'),_0x323e26['uniqueid']),_0x178cde);}});ami['on']('queuecallerjoin',function(_0xca28b4){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')]('[%s][index][queuecallerjoin]',_0xca28b4['uniqueid']),_0xca28b4);queues[_0x6529('0x2b')](_0xca28b4);recordings[_0x6529('0x2b')](_0xca28b4);}catch(_0x1c7fe0){utils['error'](util['format'](_0x6529('0x2c'),_0xca28b4[_0x6529('0x22')]),_0x1c7fe0);}});ami['on']('queuecallerleave',function(_0xda75af){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x2d'),_0xda75af['uniqueid']),_0xda75af);queues[_0x6529('0x2e')](_0xda75af);}catch(_0x41beac){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x2d'),_0xda75af['uniqueid']),_0x41beac);}});ami['on'](_0x6529('0x2f'),function(_0x5cf4c4){try{utils[_0x6529('0x1d')](util['format'](_0x6529('0x30'),_0x5cf4c4['uniqueid']),_0x5cf4c4);queues[_0x6529('0x2f')](_0x5cf4c4);calls[_0x6529('0x2f')](_0x5cf4c4);}catch(_0x1c9724){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x30'),_0x5cf4c4[_0x6529('0x22')]),_0x1c9724);}});ami['on'](_0x6529('0x31'),function(_0x27f960){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x32'),_0x27f960[_0x6529('0x22')]),_0x27f960);queues['musiconholdstop'](_0x27f960);calls[_0x6529('0x31')](_0x27f960);}catch(_0x1a1d95){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x32'),_0x27f960[_0x6529('0x22')]),_0x1a1d95);}});ami['on']('newstate',function(_0x696bb0){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x33'),_0x696bb0[_0x6529('0x22')]),_0x696bb0);calls[_0x6529('0x34')](_0x696bb0);recordings['newstate'](_0x696bb0);}catch(_0x1bd167){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x33'),_0x696bb0[_0x6529('0x22')]),_0x1bd167);}});ami['on'](_0x6529('0x35'),function(_0x1b7af8){try{utils[_0x6529('0x1d')](util['format'](_0x6529('0x36'),_0x1b7af8[_0x6529('0x22')]),_0x1b7af8);calls[_0x6529('0x35')](_0x1b7af8);recordings['hangup'](_0x1b7af8);dials['hangup'](_0x1b7af8);agents[_0x6529('0x35')](_0x1b7af8);queues[_0x6529('0x35')](_0x1b7af8);}catch(_0x1459ef){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x36'),_0x1b7af8[_0x6529('0x22')]),_0x1459ef);}});ami['on'](_0x6529('0x37'),function(_0x115de6){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')]('[%s][index][cdr]',_0x115de6['uniqueid']),_0x115de6);members[_0x6529('0x37')](_0x115de6);}catch(_0x54bb71){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x38'),_0x115de6[_0x6529('0x22')]),_0x54bb71);}});ami['on'](_0x6529('0x39'),function(_0x4065fb){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')]('[%s][index][blindtransfer]',_0x4065fb[_0x6529('0x22')]),_0x4065fb);queues[_0x6529('0x39')](_0x4065fb);agents['blindtransfer'](_0x4065fb);transfers[_0x6529('0x39')](_0x4065fb);}catch(_0x30473a){utils[_0x6529('0x19')](util['format'](_0x6529('0x3a'),_0x4065fb[_0x6529('0x22')]),_0x30473a);}});ami['on'](_0x6529('0x3b'),function(_0x58bf48){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')]('[%s][index][attendedtransfer]',_0x58bf48[_0x6529('0x3c')]),_0x58bf48);queues[_0x6529('0x3b')](_0x58bf48);transfers['attendedtransfer'](_0x58bf48);agents[_0x6529('0x3b')](_0x58bf48);calls['attendedtransfer'](_0x58bf48);}catch(_0x419f71){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x3d'),_0x58bf48['origtransfereruniqueid']),_0x419f71);}});ami['on'](_0x6529('0x3e'),function(_0xdbfcab){try{utils[_0x6529('0x1d')](util['format'](_0x6529('0x3f'),_0xdbfcab[_0x6529('0x22')]),_0xdbfcab);queues[_0x6529('0x3e')](_0xdbfcab);recordings['varset'](_0xdbfcab);calls[_0x6529('0x3e')](_0xdbfcab);dials[_0x6529('0x3e')](_0xdbfcab);}catch(_0x2101c1){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x3f'),_0xdbfcab[_0x6529('0x22')]),_0x2101c1);}});ami['on'](_0x6529('0x40'),function(_0x35f9c1){try{utils[_0x6529('0x1d')](util['format'](_0x6529('0x41'),_0x35f9c1['uniqueid']),_0x35f9c1);calls[_0x6529('0x40')](_0x35f9c1);recordings['newexten'](_0x35f9c1);dials[_0x6529('0x40')](_0x35f9c1);}catch(_0x5ada40){utils['error'](util[_0x6529('0x1f')](_0x6529('0x41'),_0x35f9c1[_0x6529('0x22')]),_0x5ada40);}});ami['on']('newchannel',function(_0x405633){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x42'),_0x405633[_0x6529('0x22')]),_0x405633);calls[_0x6529('0x43')](_0x405633);recordings[_0x6529('0x43')](_0x405633);}catch(_0x4b96af){utils[_0x6529('0x19')](util[_0x6529('0x1f')]('[%s][index][newchannel]',_0x405633[_0x6529('0x22')]),_0x4b96af);}});ami['on'](_0x6529('0x44'),function(_0x1ed84e){try{utils[_0x6529('0x1d')](util['format'](_0x6529('0x45'),_0x1ed84e[_0x6529('0x22')]),_0x1ed84e);dials[_0x6529('0x44')](_0x1ed84e);}catch(_0x57d5cf){utils[_0x6529('0x19')](util['format']('[%s]dialbegin',_0x1ed84e['uniqueid']),_0x57d5cf);}});ami['on'](_0x6529('0x46'),function(_0x36f563){try{utils[_0x6529('0x1d')](util[_0x6529('0x1f')](_0x6529('0x47'),_0x36f563[_0x6529('0x22')]),_0x36f563);dials[_0x6529('0x46')](_0x36f563);}catch(_0x3f823b){utils[_0x6529('0x19')](util[_0x6529('0x1f')](_0x6529('0x47'),_0x36f563[_0x6529('0x22')]),_0x3f823b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index c68c468..a373ff9 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 _0x136c=['data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','exitAt','destinationchannel','lodash','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','error','[%s][members][writeDB]','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','duration','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','[%s][members][cdr]','data1'];(function(_0x40edbb,_0x4b8e85){var _0x1c34e1=function(_0x4cb6dc){while(--_0x4cb6dc){_0x40edbb['push'](_0x40edbb['shift']());}};_0x1c34e1(++_0x4b8e85);}(_0x136c,0x1d2));var _0xc136=function(_0x2e63f0,_0x9bda70){_0x2e63f0=_0x2e63f0-0x0;var _0x2b5050=_0x136c[_0x2e63f0];return _0x2b5050;};'use strict';var _=require(_0xc136('0x0'));var util=require(_0xc136('0x1'));var utils=require('./utils');var members={};var exclude=[_0xc136('0x2'),_0xc136('0x3')];function writeDB(_0x34c789){utils[_0xc136('0x4')](util[_0xc136('0x5')](_0xc136('0x6'),_0x34c789[_0xc136('0x7')],_0x34c789[_0xc136('0x8')],_0x34c789[_0xc136('0x9')],_0x34c789['data2'],_0x34c789[_0xc136('0xa')],_0x34c789['type']));if(_0x34c789[_0xc136('0x8')]){utils[_0xc136('0xb')](_0x34c789[_0xc136('0x8')])['then'](function(_0x24cf27){if(_0x24cf27){_0x34c789['membername']=_0x24cf27[_0xc136('0xc')];_0x34c789[_0xc136('0xd')]=_0x24cf27[_0xc136('0xd')];utils[_0xc136('0xe')](_0xc136('0xf'),_0x34c789);}else{utils[_0xc136('0x10')](_0x34c789[_0xc136('0x8')][_0xc136('0x11')]('/')[0x1])[_0xc136('0x12')](function(_0x4e6df5){if(_0x4e6df5){_0x34c789['membername']=_0x4e6df5[_0xc136('0xc')];_0x34c789['internal']=_0x4e6df5[_0xc136('0xd')];utils[_0xc136('0xe')](_0xc136('0xf'),_0x34c789);}});}})['catch'](function(_0x59b7c8){utils[_0xc136('0x13')](util[_0xc136('0x5')](_0xc136('0x14'),_0x34c789['uniqueid']),_0x59b7c8);});}delete members[_0x34c789['interface']];}function startsWith(_0x2e28ba,_0x16e87f){return _['some'](_0x2e28ba,function(_0x4e24fb){return _['startsWith'](_0x16e87f,_0x4e24fb);});}exports[_0xc136('0x15')]=function(_0x3daf55){try{utils[_0xc136('0x16')](util[_0xc136('0x5')](_0xc136('0x17'),members[_0x3daf55[_0xc136('0x18')]]?members[_0x3daf55['device']]['uniqueid']:_0x3daf55['device']),_0x3daf55);utils[_0xc136('0x4')](util['format'](_0xc136('0x19'),members[_0x3daf55[_0xc136('0x18')]]?members[_0x3daf55[_0xc136('0x18')]][_0xc136('0x7')]:_0x3daf55['device'],_0x3daf55[_0xc136('0x1a')],_0x3daf55[_0xc136('0x18')]));switch(_0x3daf55['state']){case _0xc136('0x1b'):case'BUSY':if(!startsWith(exclude,_0x3daf55['device'])){members[_0x3daf55[_0xc136('0x18')]]={'channel':_0xc136('0x1c'),'interface':_0x3daf55['device'],'type':_0xc136('0x1d'),'enterAt':utils[_0xc136('0x1e')](),'role':_0xc136('0x1f')};}break;case _0xc136('0x20'):if(!_['isNil'](members[_0x3daf55[_0xc136('0x18')]])){members[_0x3daf55[_0xc136('0x18')]]['exitAt']=utils[_0xc136('0x1e')]();members[_0x3daf55['device']][_0xc136('0x21')]=utils[_0xc136('0x22')](members[_0x3daf55['device']]['exitAt'],members[_0x3daf55[_0xc136('0x18')]][_0xc136('0x23')]);if(members[_0x3daf55['device']][_0xc136('0x7')]){writeDB(members[_0x3daf55[_0xc136('0x18')]]);}}break;default:break;}}catch(_0x31e862){utils[_0xc136('0x13')](util[_0xc136('0x5')](_0xc136('0x17'),members[_0x3daf55[_0xc136('0x18')]]?members[_0x3daf55['device']][_0xc136('0x7')]:_0x3daf55[_0xc136('0x18')]),_0x31e862);}};exports[_0xc136('0x24')]=function(_0x1b5a23){try{if(!_[_0xc136('0x25')](members[_0x1b5a23[_0xc136('0x8')]])){utils[_0xc136('0x16')](util[_0xc136('0x5')](_0xc136('0x26'),_0x1b5a23['uniqueid']),_0x1b5a23);utils[_0xc136('0x4')](util[_0xc136('0x5')](_0xc136('0x27'),_0x1b5a23['uniqueid'],_0x1b5a23[_0xc136('0x8')],_0x1b5a23['queue']));members[_0x1b5a23['interface']]=_[_0xc136('0x28')](members[_0x1b5a23[_0xc136('0x8')]],{'data4':_0x1b5a23[_0xc136('0x29')],'uniqueid':_0x1b5a23['uniqueid']});}}catch(_0x37cb75){utils[_0xc136('0x13')](util['format'](_0xc136('0x26'),_0x1b5a23[_0xc136('0x7')]),_0x37cb75);}};exports['cdr']=function(_0x1747e5){try{utils[_0xc136('0x16')](util[_0xc136('0x5')](_0xc136('0x2a'),_0x1747e5[_0xc136('0x7')]),_0x1747e5);if(_0x1747e5[_0xc136('0x9')]){var _0xdaf3f1=_0x1747e5[_0xc136('0x9')][_0xc136('0x11')]('-')[0x0];if(!_[_0xc136('0x25')](members[_0xdaf3f1])){members[_0xdaf3f1]=_[_0xc136('0x28')](members[_0xdaf3f1],{'data1':members[_0xdaf3f1][_0xc136('0x2b')]||_0x1747e5['type'],'data2':members[_0xdaf3f1][_0xc136('0x2c')]||_0x1747e5[_0xc136('0x2d')],'data3':members[_0xdaf3f1][_0xc136('0x2e')]||_0x1747e5[_0xc136('0x2f')],'uniqueid':members[_0xdaf3f1][_0xc136('0x7')]||_0x1747e5[_0xc136('0x7')]});utils[_0xc136('0x4')](util['format'](_0xc136('0x30'),_0x1747e5[_0xc136('0x7')],members[_0xdaf3f1][_0xc136('0x2b')],members[_0xdaf3f1][_0xc136('0x2c')],members[_0xdaf3f1][_0xc136('0x2e')]));if(members[_0xdaf3f1][_0xc136('0x31')]){writeDB(members[_0xdaf3f1]);}}}if(_0x1747e5[_0xc136('0x32')]){var _0x4ab15d=_0x1747e5[_0xc136('0x32')][_0xc136('0x11')]('-')[0x0];if(!_[_0xc136('0x25')](members[_0x4ab15d])){members[_0x4ab15d]=_[_0xc136('0x28')](members[_0x4ab15d],{'data1':members[_0x4ab15d][_0xc136('0x2b')]||_0x1747e5['type'],'data2':members[_0x4ab15d][_0xc136('0x2c')]||_0x1747e5[_0xc136('0x2d')],'data3':members[_0x4ab15d]['data3']||_0x1747e5[_0xc136('0x2f')],'uniqueid':members[_0x4ab15d][_0xc136('0x7')]||_0x1747e5[_0xc136('0x7')]});utils[_0xc136('0x4')](util[_0xc136('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1747e5['uniqueid'],members[_0x4ab15d][_0xc136('0x2b')],members[_0x4ab15d]['data2'],members[_0x4ab15d][_0xc136('0x2e')]));if(members[_0x4ab15d][_0xc136('0x31')]){writeDB(members[_0x4ab15d]);}}}}catch(_0xabd8ff){utils[_0xc136('0x13')](util[_0xc136('0x5')](_0xc136('0x2a'),_0x1747e5[_0xc136('0x7')]),_0xabd8ff);}}; \ No newline at end of file +var _0x4eaf=['CreateMemberReport','getUserByName','split','name','request','error','[%s][members][writeDB]','some','startsWith','debug','device','state','BUSY','voice','TALKING','NOT_INUSE','isNil','exitAt','now','duration','enterAt','[%s][members][devicestatechange]','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','type','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data2','destinationchannel','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','getUserByInterface','then','membername','internal'];(function(_0x686cd1,_0x252bf2){var _0x11eaa3=function(_0x1e67a8){while(--_0x1e67a8){_0x686cd1['push'](_0x686cd1['shift']());}};_0x11eaa3(++_0x252bf2);}(_0x4eaf,0x112));var _0xf4ea=function(_0x1f988a,_0x101b33){_0x1f988a=_0x1f988a-0x0;var _0x3cdfe7=_0x4eaf[_0x1f988a];return _0x3cdfe7;};'use strict';var _=require(_0xf4ea('0x0'));var util=require('util');var utils=require(_0xf4ea('0x1'));var members={};var exclude=[_0xf4ea('0x2'),_0xf4ea('0x3')];function writeDB(_0x57fb45){utils[_0xf4ea('0x4')](util[_0xf4ea('0x5')](_0xf4ea('0x6'),_0x57fb45[_0xf4ea('0x7')],_0x57fb45[_0xf4ea('0x8')],_0x57fb45[_0xf4ea('0x9')],_0x57fb45['data2'],_0x57fb45['membername'],_0x57fb45['type']));if(_0x57fb45[_0xf4ea('0x8')]){utils[_0xf4ea('0xa')](_0x57fb45['interface'])[_0xf4ea('0xb')](function(_0x4ad8e8){if(_0x4ad8e8){_0x57fb45[_0xf4ea('0xc')]=_0x4ad8e8['name'];_0x57fb45[_0xf4ea('0xd')]=_0x4ad8e8[_0xf4ea('0xd')];utils['request'](_0xf4ea('0xe'),_0x57fb45);}else{utils[_0xf4ea('0xf')](_0x57fb45[_0xf4ea('0x8')][_0xf4ea('0x10')]('/')[0x1])[_0xf4ea('0xb')](function(_0x1ff0dd){if(_0x1ff0dd){_0x57fb45[_0xf4ea('0xc')]=_0x1ff0dd[_0xf4ea('0x11')];_0x57fb45[_0xf4ea('0xd')]=_0x1ff0dd[_0xf4ea('0xd')];utils[_0xf4ea('0x12')](_0xf4ea('0xe'),_0x57fb45);}});}})['catch'](function(_0x5b718b){utils[_0xf4ea('0x13')](util[_0xf4ea('0x5')](_0xf4ea('0x14'),_0x57fb45[_0xf4ea('0x7')]),_0x5b718b);});}delete members[_0x57fb45[_0xf4ea('0x8')]];}function startsWith(_0x4bb768,_0x3a5bae){return _[_0xf4ea('0x15')](_0x4bb768,function(_0x400adf){return _[_0xf4ea('0x16')](_0x3a5bae,_0x400adf);});}exports['devicestatechange']=function(_0x4cf764){try{utils[_0xf4ea('0x17')](util[_0xf4ea('0x5')]('[%s][members][devicestatechange]',members[_0x4cf764['device']]?members[_0x4cf764[_0xf4ea('0x18')]]['uniqueid']:_0x4cf764[_0xf4ea('0x18')]),_0x4cf764);utils[_0xf4ea('0x4')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x4cf764[_0xf4ea('0x18')]]?members[_0x4cf764[_0xf4ea('0x18')]][_0xf4ea('0x7')]:_0x4cf764['device'],_0x4cf764['state'],_0x4cf764['device']));switch(_0x4cf764[_0xf4ea('0x19')]){case'INUSE':case _0xf4ea('0x1a'):if(!startsWith(exclude,_0x4cf764['device'])){members[_0x4cf764[_0xf4ea('0x18')]]={'channel':_0xf4ea('0x1b'),'interface':_0x4cf764['device'],'type':_0xf4ea('0x1c'),'enterAt':utils['now'](),'role':'agent'};}break;case _0xf4ea('0x1d'):if(!_[_0xf4ea('0x1e')](members[_0x4cf764[_0xf4ea('0x18')]])){members[_0x4cf764[_0xf4ea('0x18')]][_0xf4ea('0x1f')]=utils[_0xf4ea('0x20')]();members[_0x4cf764['device']][_0xf4ea('0x21')]=utils['diffTime'](members[_0x4cf764[_0xf4ea('0x18')]][_0xf4ea('0x1f')],members[_0x4cf764[_0xf4ea('0x18')]][_0xf4ea('0x22')]);if(members[_0x4cf764[_0xf4ea('0x18')]][_0xf4ea('0x7')]){writeDB(members[_0x4cf764[_0xf4ea('0x18')]]);}}break;default:break;}}catch(_0x4ad299){utils['error'](util[_0xf4ea('0x5')](_0xf4ea('0x23'),members[_0x4cf764[_0xf4ea('0x18')]]?members[_0x4cf764[_0xf4ea('0x18')]]['uniqueid']:_0x4cf764[_0xf4ea('0x18')]),_0x4ad299);}};exports['agentcomplete']=function(_0x3f7307){try{if(!_['isNil'](members[_0x3f7307[_0xf4ea('0x8')]])){utils[_0xf4ea('0x17')](util[_0xf4ea('0x5')](_0xf4ea('0x24'),_0x3f7307[_0xf4ea('0x7')]),_0x3f7307);utils['info'](util[_0xf4ea('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x3f7307[_0xf4ea('0x7')],_0x3f7307[_0xf4ea('0x8')],_0x3f7307[_0xf4ea('0x25')]));members[_0x3f7307[_0xf4ea('0x8')]]=_[_0xf4ea('0x26')](members[_0x3f7307[_0xf4ea('0x8')]],{'data4':_0x3f7307[_0xf4ea('0x25')],'uniqueid':_0x3f7307[_0xf4ea('0x7')]});}}catch(_0xe62dc1){utils[_0xf4ea('0x13')](util['format']('[%s][members][agentcomplete]',_0x3f7307[_0xf4ea('0x7')]),_0xe62dc1);}};exports[_0xf4ea('0x27')]=function(_0x7c5976){try{utils[_0xf4ea('0x17')](util[_0xf4ea('0x5')](_0xf4ea('0x28'),_0x7c5976[_0xf4ea('0x7')]),_0x7c5976);if(_0x7c5976[_0xf4ea('0x9')]){var _0xbf8183=_0x7c5976[_0xf4ea('0x9')][_0xf4ea('0x10')]('-')[0x0];if(!_['isNil'](members[_0xbf8183])){members[_0xbf8183]=_[_0xf4ea('0x26')](members[_0xbf8183],{'data1':members[_0xbf8183]['data1']||_0x7c5976[_0xf4ea('0x29')],'data2':members[_0xbf8183]['data2']||_0x7c5976['source'],'data3':members[_0xbf8183][_0xf4ea('0x2a')]||_0x7c5976[_0xf4ea('0x2b')],'uniqueid':members[_0xbf8183][_0xf4ea('0x7')]||_0x7c5976['uniqueid']});utils[_0xf4ea('0x4')](util[_0xf4ea('0x5')](_0xf4ea('0x2c'),_0x7c5976[_0xf4ea('0x7')],members[_0xbf8183][_0xf4ea('0x2d')],members[_0xbf8183][_0xf4ea('0x2e')],members[_0xbf8183][_0xf4ea('0x2a')]));if(members[_0xbf8183][_0xf4ea('0x1f')]){writeDB(members[_0xbf8183]);}}}if(_0x7c5976[_0xf4ea('0x2f')]){var _0x2ee057=_0x7c5976[_0xf4ea('0x2f')][_0xf4ea('0x10')]('-')[0x0];if(!_[_0xf4ea('0x1e')](members[_0x2ee057])){members[_0x2ee057]=_[_0xf4ea('0x26')](members[_0x2ee057],{'data1':members[_0x2ee057][_0xf4ea('0x2d')]||_0x7c5976[_0xf4ea('0x29')],'data2':members[_0x2ee057][_0xf4ea('0x2e')]||_0x7c5976['source'],'data3':members[_0x2ee057][_0xf4ea('0x2a')]||_0x7c5976['destination'],'uniqueid':members[_0x2ee057]['uniqueid']||_0x7c5976[_0xf4ea('0x7')]});utils['info'](util[_0xf4ea('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x7c5976[_0xf4ea('0x7')],members[_0x2ee057][_0xf4ea('0x2d')],members[_0x2ee057][_0xf4ea('0x2e')],members[_0x2ee057][_0xf4ea('0x2a')]));if(members[_0x2ee057]['exitAt']){writeDB(members[_0x2ee057]);}}}}catch(_0x150820){utils[_0xf4ea('0x13')](util['format'](_0xf4ea('0x28'),_0x7c5976[_0xf4ea('0x7')]),_0x150820);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index d99f195..df4feaf 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 _0x9293=['isNil','debug','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','queuestatus','toUpperCase','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','value','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','queuecallerjoinAt','count','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDED','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','mohtime','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','position','assign','error','hangup'];(function(_0x372110,_0x44826b){var _0x4e987a=function(_0x3e851a){while(--_0x3e851a){_0x372110['push'](_0x372110['shift']());}};_0x4e987a(++_0x44826b);}(_0x9293,0x1f1));var _0x3929=function(_0x49748c,_0x3d2005){_0x49748c=_0x49748c-0x0;var _0xedf6b6=_0x9293[_0x49748c];return _0xedf6b6;};'use strict';var _=require(_0x3929('0x0'));var util=require(_0x3929('0x1'));var utils=require(_0x3929('0x2'));var queues={};function writeDB(_0x8603e5){utils[_0x3929('0x3')](util[_0x3929('0x4')](_0x3929('0x5'),_0x8603e5[_0x3929('0x6')],_0x8603e5[_0x3929('0x7')],_0x8603e5[_0x3929('0x8')],_0x8603e5[_0x3929('0x9')],_0x8603e5[_0x3929('0xa')],_0x8603e5[_0x3929('0xb')],_0x8603e5[_0x3929('0xc')]));if(_0x8603e5[_0x3929('0x8')]){utils['getVoiceQueueByName'](_0x8603e5['queue'])[_0x3929('0xd')](function(_0x23e536){if(_0x23e536){_0x8603e5[_0x3929('0xe')]=_0x23e536[_0x3929('0xe')];}utils[_0x3929('0xf')](_0x3929('0x10'),_0x8603e5);});}else{utils[_0x3929('0xf')](_0x3929('0x10'),_0x8603e5);}if(_0x8603e5['transfereduniqueid']){delete queues[_0x8603e5[_0x3929('0x11')]];}else{delete queues[_0x8603e5[_0x3929('0x6')]];}}exports[_0x3929('0x12')]=function(_0x131c77){try{utils['debug'](util[_0x3929('0x4')]('[%s][queues][queuecallerjoin]',_0x131c77['uniqueid']),_0x131c77);utils['info'](util[_0x3929('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x131c77[_0x3929('0x6')],_0x131c77[_0x3929('0x8')],_0x131c77[_0x3929('0x13')]));queues[_0x131c77['uniqueid']]=_[_0x3929('0x14')](_0x131c77,{'originalposition':_0x131c77[_0x3929('0x13')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x4b87b1){utils[_0x3929('0x15')](util[_0x3929('0x4')]('[%s][queues][queuecallerjoin]',_0x131c77[_0x3929('0x6')]),_0x4b87b1);}};exports[_0x3929('0x16')]=function(_0x3afb9a){try{if(!_[_0x3929('0x17')](queues[_0x3afb9a[_0x3929('0x6')]])){utils[_0x3929('0x18')](util[_0x3929('0x4')]('[%s][queues][hangup]',_0x3afb9a[_0x3929('0x6')]),_0x3afb9a);if(queues[_0x3afb9a[_0x3929('0x6')]]['queuecallerleaveAt']){if(!queues[_0x3afb9a['uniqueid']][_0x3929('0x19')]&&!queues[_0x3afb9a[_0x3929('0x6')]][_0x3929('0x1a')]){queues[_0x3afb9a['uniqueid']][_0x3929('0x1b')]=!![];queues[_0x3afb9a['uniqueid']][_0x3929('0x1c')]=utils[_0x3929('0x1d')]();queues[_0x3afb9a[_0x3929('0x6')]][_0x3929('0xc')]=_0x3929('0x1e');}utils[_0x3929('0x3')](util[_0x3929('0x4')](_0x3929('0x1f'),_0x3afb9a[_0x3929('0x6')],queues[_0x3afb9a[_0x3929('0x6')]][_0x3929('0x20')],queues[_0x3afb9a[_0x3929('0x6')]][_0x3929('0xc')]));writeDB(queues[_0x3afb9a[_0x3929('0x6')]]);}else if(queues[_0x3afb9a[_0x3929('0x6')]][_0x3929('0x11')]){utils[_0x3929('0x3')](util[_0x3929('0x4')](_0x3929('0x21'),_0x3afb9a['uniqueid'],queues[_0x3afb9a[_0x3929('0x6')]][_0x3929('0x20')],queues[_0x3afb9a[_0x3929('0x6')]][_0x3929('0x11')]));queues[queues[_0x3afb9a[_0x3929('0x6')]][_0x3929('0x11')]]=queues[_0x3afb9a[_0x3929('0x6')]];queues[queues[_0x3afb9a[_0x3929('0x6')]][_0x3929('0x11')]][_0x3929('0x22')]=0x2;delete queues[_0x3afb9a[_0x3929('0x6')]];}}}catch(_0x57d1bd){utils[_0x3929('0x15')](util[_0x3929('0x4')](_0x3929('0x23'),_0x3afb9a[_0x3929('0x6')]),_0x57d1bd);}};exports[_0x3929('0x24')]=function(_0x3624ee){try{utils['debug'](util[_0x3929('0x4')](_0x3929('0x25'),_0x3624ee[_0x3929('0x6')]),_0x3624ee);if(!_[_0x3929('0x17')](_0x3624ee[_0x3929('0x26')][_0x3929('0x27')])&&_0x3624ee['value'][_0x3929('0x28')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x3624ee[_0x3929('0x6')]])){queues[_0x3624ee[_0x3929('0x6')]][_0x3929('0x19')]=![];queues[_0x3624ee[_0x3929('0x6')]][_0x3929('0x29')]=null;queues[_0x3624ee[_0x3929('0x6')]]['queuecallerexit']=!![];queues[_0x3624ee['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x3624ee['uniqueid']][_0x3929('0xc')]=_0x3624ee['value'][_0x3929('0x28')]();utils['info'](util[_0x3929('0x4')](_0x3929('0x2a'),_0x3624ee[_0x3929('0x6')],queues[_0x3624ee['uniqueid']][_0x3929('0x20')],_0x3624ee['value'],queues[_0x3624ee[_0x3929('0x6')]][_0x3929('0xc')]));writeDB(queues[_0x3624ee[_0x3929('0x6')]]);}}else if(!_['isNil'](_0x3624ee['variable'][_0x3929('0x2b')])){if(!_[_0x3929('0x17')](queues[_0x3624ee[_0x3929('0x6')]])&&!queues[_0x3624ee[_0x3929('0x6')]]['queuecallerabandon']){queues[_0x3624ee[_0x3929('0x6')]][_0x3929('0x19')]=![];queues[_0x3624ee[_0x3929('0x6')]][_0x3929('0x29')]=null;queues[_0x3624ee[_0x3929('0x6')]][_0x3929('0x1a')]=!![];queues[_0x3624ee['uniqueid']][_0x3929('0x2c')]=utils[_0x3929('0x1d')]();queues[_0x3624ee[_0x3929('0x6')]]['queuecallerexitreason']=_0x3929('0x2d');utils[_0x3929('0x3')](util[_0x3929('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x3624ee['uniqueid'],queues[_0x3624ee[_0x3929('0x6')]][_0x3929('0x20')],_0x3624ee[_0x3929('0x2e')],queues[_0x3624ee[_0x3929('0x6')]][_0x3929('0xc')]));}}}catch(_0x182188){utils[_0x3929('0x15')](util['format'](_0x3929('0x25'),_0x3624ee[_0x3929('0x6')]),_0x182188);}};exports[_0x3929('0x19')]=function(_0x23e5ca){try{if(!_['isNil'](queues[_0x23e5ca['uniqueid']])){utils[_0x3929('0x18')](util[_0x3929('0x4')](_0x3929('0x2f'),_0x23e5ca[_0x3929('0x6')]),_0x23e5ca);queues[_0x23e5ca['uniqueid']]['queuecallerexit']=![];queues[_0x23e5ca[_0x3929('0x6')]]['queuecallerexitAt']=null;queues[_0x23e5ca[_0x3929('0x6')]][_0x3929('0x19')]=!![];queues[_0x23e5ca[_0x3929('0x6')]][_0x3929('0x29')]=utils[_0x3929('0x1d')]();queues[_0x23e5ca[_0x3929('0x6')]]['queuecallerexitreason']=_0x3929('0x30');utils[_0x3929('0x3')](util[_0x3929('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x23e5ca[_0x3929('0x6')],queues[_0x23e5ca[_0x3929('0x6')]][_0x3929('0x20')],queues[_0x23e5ca['uniqueid']][_0x3929('0xc')]));}}catch(_0x297753){utils[_0x3929('0x15')](util['format']('[%s][queues][queuecallerabandon]',_0x23e5ca[_0x3929('0x6')]),_0x297753);}};exports[_0x3929('0x31')]=function(_0x4b9d12){try{if(!_['isNil'](queues[_0x4b9d12[_0x3929('0x6')]])){utils[_0x3929('0x18')](util[_0x3929('0x4')](_0x3929('0x32'),_0x4b9d12[_0x3929('0x6')]),_0x4b9d12);utils['info'](util[_0x3929('0x4')](_0x3929('0x33'),_0x4b9d12[_0x3929('0x6')],queues[_0x4b9d12[_0x3929('0x6')]][_0x3929('0x20')],_0x4b9d12[_0x3929('0x34')],_0x4b9d12[_0x3929('0x35')]));queues[_0x4b9d12['uniqueid']][_0x3929('0x31')]=!![];queues[_0x4b9d12[_0x3929('0x6')]][_0x3929('0x36')]=utils[_0x3929('0x1d')]();queues[_0x4b9d12['uniqueid']][_0x3929('0x37')]=utils['diffTime'](queues[_0x4b9d12[_0x3929('0x6')]]['queuecallerleaveAt'],queues[_0x4b9d12['uniqueid']][_0x3929('0x38')]);queues[_0x4b9d12['uniqueid']][_0x3929('0x13')]=_0x4b9d12[_0x3929('0x13')];queues[_0x4b9d12['uniqueid']][_0x3929('0x39')]=_0x4b9d12[_0x3929('0x39')];queues[_0x4b9d12[_0x3929('0x6')]]['connectedlinenum']=_0x4b9d12['connectedlinenum'];queues[_0x4b9d12['uniqueid']]['connectedlinename']=_0x4b9d12[_0x3929('0x35')];}}catch(_0x81d9b){utils[_0x3929('0x15')](util['format']('[%s][queues][queuecallerleave]',_0x4b9d12['uniqueid']),_0x81d9b);}};exports['agentconnect']=function(_0x578ec1){try{if(!_[_0x3929('0x17')](queues[_0x578ec1[_0x3929('0x6')]])){utils[_0x3929('0x18')](util['format']('[%s][queues][agentconnect]',_0x578ec1[_0x3929('0x6')]),_0x578ec1);utils[_0x3929('0x3')](util[_0x3929('0x4')](_0x3929('0x3a'),_0x578ec1[_0x3929('0x6')],queues[_0x578ec1[_0x3929('0x6')]][_0x3929('0x20')],_0x578ec1[_0x3929('0x3b')],_0x578ec1['destaccountcode']));queues[_0x578ec1[_0x3929('0x6')]]['queuecallerabandon']=![];queues[_0x578ec1[_0x3929('0x6')]][_0x3929('0x19')]=![];queues[_0x578ec1[_0x3929('0x6')]]['queuecallerabandonAt']=null;queues[_0x578ec1[_0x3929('0x6')]]['queuecallerexit']=![];queues[_0x578ec1[_0x3929('0x6')]]['queuecallerexitreason']=null;queues[_0x578ec1[_0x3929('0x6')]][_0x3929('0x2c')]=null;queues[_0x578ec1[_0x3929('0x6')]][_0x3929('0x3c')]=!![];queues[_0x578ec1[_0x3929('0x6')]]['accountcode']=_0x578ec1[_0x3929('0x3d')];queues[_0x578ec1['uniqueid']][_0x3929('0x9')]=_0x578ec1[_0x3929('0x3b')];}}catch(_0x3a8f74){utils['error'](util[_0x3929('0x4')](_0x3929('0x3e'),_0x578ec1[_0x3929('0x6')]),_0x3a8f74);}};exports[_0x3929('0x3f')]=function(_0x1a483b){try{if(!_[_0x3929('0x17')](queues[_0x1a483b['uniqueid']])){if(queues[_0x1a483b[_0x3929('0x6')]][_0x3929('0x36')]){utils[_0x3929('0x18')](util[_0x3929('0x4')](_0x3929('0x40'),_0x1a483b[_0x3929('0x6')]),_0x1a483b);queues[_0x1a483b[_0x3929('0x6')]][_0x3929('0x19')]=![];queues[_0x1a483b[_0x3929('0x6')]][_0x3929('0x19')]=![];queues[_0x1a483b['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1a483b[_0x3929('0x6')]][_0x3929('0x1a')]=![];queues[_0x1a483b['uniqueid']]['queuecallerexitAt']=null;queues[_0x1a483b[_0x3929('0x6')]]['assigned']=!![];queues[_0x1a483b[_0x3929('0x6')]][_0x3929('0x9')]=_0x1a483b[_0x3929('0x3b')];queues[_0x1a483b[_0x3929('0x6')]][_0x3929('0x1b')]=!![];queues[_0x1a483b['uniqueid']][_0x3929('0x1c')]=utils[_0x3929('0x1d')]();if(_0x1a483b[_0x3929('0x41')]=='transfer'){if(!queues[_0x1a483b[_0x3929('0x6')]][_0x3929('0x42')]){queues[_0x1a483b[_0x3929('0x6')]]['queuecallerexitreason']=_0x3929('0x43');}}else{queues[_0x1a483b[_0x3929('0x6')]][_0x3929('0xc')]=_0x3929('0x44')+_0x1a483b['reason']['toUpperCase']();}utils['info'](util[_0x3929('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x1a483b[_0x3929('0x6')],queues[_0x1a483b[_0x3929('0x6')]]['name'],_0x1a483b['membername'],queues[_0x1a483b[_0x3929('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x1a483b[_0x3929('0x6')]]);}}}catch(_0x5b219f){utils['error'](util[_0x3929('0x4')](_0x3929('0x40'),_0x1a483b[_0x3929('0x6')]),_0x5b219f);}};exports[_0x3929('0x45')]=function(_0x1be45f){try{if(!_[_0x3929('0x17')](queues[_0x1be45f['transfereeuniqueid']])){utils[_0x3929('0x18')](util[_0x3929('0x4')](_0x3929('0x46'),_0x1be45f['uniqueid']),_0x1be45f);queues[_0x1be45f[_0x3929('0x47')]]['transfer']=!![];queues[_0x1be45f[_0x3929('0x47')]]['transfertype']='BLIND';queues[_0x1be45f['transfereeuniqueid']][_0x3929('0x48')]=_0x1be45f[_0x3929('0x49')];queues[_0x1be45f['transfereeuniqueid']]['transferuniqueid']=_0x1be45f[_0x3929('0x47')];queues[_0x1be45f['transfereeuniqueid']][_0x3929('0xc')]=_0x3929('0x4a');utils[_0x3929('0x3')](util[_0x3929('0x4')](_0x3929('0x4b'),_0x1be45f[_0x3929('0x6')],queues[_0x1be45f[_0x3929('0x47')]][_0x3929('0x20')],_0x1be45f[_0x3929('0x47')],_0x1be45f[_0x3929('0x49')]));}}catch(_0xf69fce){utils[_0x3929('0x15')](util[_0x3929('0x4')]('[%s][queues][blindtransfer]',_0x1be45f[_0x3929('0x6')]),_0xf69fce);}};exports[_0x3929('0x4c')]=function(_0x108340){try{utils[_0x3929('0x18')](util['format']('[%s][queues][attendedtransfer]',_0x108340[_0x3929('0x4d')]),_0x108340);if(_0x108340[_0x3929('0x4d')]==_0x108340[_0x3929('0x4e')]){if(!_[_0x3929('0x17')](queues[_0x108340[_0x3929('0x4f')]])){utils[_0x3929('0x3')](util[_0x3929('0x4')](_0x3929('0x50'),_0x108340['origtransfereruniqueid'],queues[_0x108340['secondtransfererlinkedid']][_0x3929('0x20')],_0x108340[_0x3929('0x51')]));queues[_0x108340[_0x3929('0x4f')]][_0x3929('0x42')]=!![];queues[_0x108340[_0x3929('0x4f')]][_0x3929('0x52')]='ATTENDED';queues[_0x108340['secondtransfererlinkedid']][_0x3929('0x48')]=_0x108340[_0x3929('0x51')];queues[_0x108340[_0x3929('0x4f')]]['transferuniqueid']=_0x108340[_0x3929('0x4d')];queues[_0x108340['secondtransfererlinkedid']]['queuecallerexitreason']=_0x3929('0x53');}if(!_[_0x3929('0x17')](queues[_0x108340[_0x3929('0x4e')]])){if(_0x108340[_0x3929('0x54')]&&queues[_0x108340[_0x3929('0x54')]]){queues[_0x108340['transfereelinkedid']][_0x3929('0x22')]=0x1;queues[_0x108340[_0x3929('0x47')]]=_[_0x3929('0x55')](queues[_0x108340['transfereelinkedid']]);queues[_0x108340[_0x3929('0x47')]]['transfereduniqueid']=_0x108340[_0x3929('0x56')];queues[_0x108340[_0x3929('0x47')]][_0x3929('0x22')]=0x2;queues[_0x108340[_0x3929('0x47')]][_0x3929('0xa')]=queues[_0x108340[_0x3929('0x4f')]]['calleridnum'];queues[_0x108340[_0x3929('0x47')]][_0x3929('0x57')]=queues[_0x108340[_0x3929('0x4f')]]['calleridname'];queues[_0x108340[_0x3929('0x47')]][_0x3929('0x38')]=utils[_0x3929('0x1d')]();queues[_0x108340['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x3929('0x1d')]();queues[_0x108340[_0x3929('0x47')]][_0x3929('0x37')]=0x0;queues[_0x108340[_0x3929('0x47')]]['mohtime']=0x0;utils[_0x3929('0x3')](util[_0x3929('0x4')](_0x3929('0x58'),_0x108340[_0x3929('0x4d')],queues[_0x108340[_0x3929('0x47')]]['name'],queues[_0x108340[_0x3929('0x47')]]['calleridnum'],queues[_0x108340[_0x3929('0x47')]][_0x3929('0x57')]));}else{utils[_0x3929('0x3')](util[_0x3929('0x4')](_0x3929('0x59'),_0x108340[_0x3929('0x4d')],queues[_0x108340['origtransfererlinkedid']][_0x3929('0x20')],_0x108340[_0x3929('0x4f')]));queues[_0x108340[_0x3929('0x4e')]]['transfereduniqueid']=_0x108340[_0x3929('0x4f')];}}}else if(_0x108340[_0x3929('0x5a')]==_0x108340[_0x3929('0x4f')]){if(!_['isNil'](queues[_0x108340['origtransfererlinkedid']])){utils['info'](util[_0x3929('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x108340['origtransfereruniqueid'],queues[_0x108340[_0x3929('0x4e')]][_0x3929('0x20')],_0x108340[_0x3929('0x5a')],_0x108340[_0x3929('0x5b')]));queues[_0x108340[_0x3929('0x4e')]]['transfer']=!![];queues[_0x108340['origtransfererlinkedid']]['transfertype']=_0x3929('0x5c');queues[_0x108340[_0x3929('0x4e')]][_0x3929('0x48')]=_0x108340[_0x3929('0x5b')];queues[_0x108340[_0x3929('0x4e')]]['transferuniqueid']=_0x108340[_0x3929('0x5a')];queues[_0x108340['origtransfererlinkedid']][_0x3929('0xc')]=_0x3929('0x53');}if(!_[_0x3929('0x17')](queues[_0x108340['secondtransfererlinkedid']])){if(_0x108340['transfertargetlinkedid']&&queues[_0x108340[_0x3929('0x5d')]]){queues[_0x108340[_0x3929('0x5d')]][_0x3929('0x22')]=0x1;queues[_0x108340[_0x3929('0x56')]]=_['clone'](queues[_0x108340['transfertargetlinkedid']]);queues[_0x108340['transfertargetuniqueid']][_0x3929('0x11')]=_0x108340[_0x3929('0x56')];queues[_0x108340[_0x3929('0x56')]][_0x3929('0x22')]=0x2;queues[_0x108340['transfertargetuniqueid']][_0x3929('0xa')]=queues[_0x108340[_0x3929('0x4e')]][_0x3929('0xa')];queues[_0x108340[_0x3929('0x56')]]['calleridname']=queues[_0x108340['origtransfererlinkedid']][_0x3929('0x57')];queues[_0x108340[_0x3929('0x56')]]['queuecallerjoinAt']=utils['now']();queues[_0x108340[_0x3929('0x56')]][_0x3929('0x36')]=utils[_0x3929('0x1d')]();queues[_0x108340[_0x3929('0x56')]][_0x3929('0x37')]=0x0;queues[_0x108340[_0x3929('0x56')]]['mohtime']=0x0;utils[_0x3929('0x3')](util[_0x3929('0x4')](_0x3929('0x5e'),_0x108340[_0x3929('0x4d')],queues[_0x108340[_0x3929('0x56')]][_0x3929('0x20')],queues[_0x108340[_0x3929('0x56')]]['transfereduniqueid'],queues[_0x108340['transfertargetuniqueid']]['calleridnum'],queues[_0x108340[_0x3929('0x56')]]['calleridname']));}else{utils['info'](util[_0x3929('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x108340['origtransfereruniqueid'],queues[_0x108340[_0x3929('0x4f')]]['name'],_0x108340[_0x3929('0x4e')]));queues[_0x108340[_0x3929('0x4f')]][_0x3929('0x11')]=_0x108340[_0x3929('0x4e')];}}}}catch(_0x596c6d){utils[_0x3929('0x15')](util[_0x3929('0x4')](_0x3929('0x5f'),_0x108340[_0x3929('0x4d')]),_0x596c6d);}};exports[_0x3929('0x60')]=function(_0x3a9e77){try{if(!_['isNil'](queues[_0x3a9e77[_0x3929('0x6')]])){utils[_0x3929('0x18')](util[_0x3929('0x4')]('[%s][queues][musiconholdstart]',_0x3a9e77[_0x3929('0x6')]),_0x3a9e77);queues[_0x3a9e77[_0x3929('0x6')]][_0x3929('0x61')]=utils[_0x3929('0x1d')]();utils[_0x3929('0x3')](util[_0x3929('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3a9e77[_0x3929('0x6')],queues[_0x3a9e77[_0x3929('0x6')]]['name'],queues[_0x3a9e77[_0x3929('0x6')]][_0x3929('0x61')]));}}catch(_0x4aee30){utils['error'](util[_0x3929('0x4')](_0x3929('0x62'),_0x3a9e77[_0x3929('0x6')]),_0x4aee30);}};exports[_0x3929('0x63')]=function(_0x37008e){try{if(!_['isNil'](queues[_0x37008e[_0x3929('0x6')]])){if(!_[_0x3929('0x17')](queues[_0x37008e[_0x3929('0x6')]][_0x3929('0x61')])){utils[_0x3929('0x18')](util['format'](_0x3929('0x64'),_0x37008e[_0x3929('0x6')]),_0x37008e);queues[_0x37008e[_0x3929('0x6')]][_0x3929('0x65')]+=utils[_0x3929('0x66')](utils[_0x3929('0x1d')](),queues[_0x37008e['uniqueid']][_0x3929('0x61')]);utils[_0x3929('0x3')](util[_0x3929('0x4')](_0x3929('0x67'),_0x37008e[_0x3929('0x6')],queues[_0x37008e[_0x3929('0x6')]][_0x3929('0x20')],queues[_0x37008e[_0x3929('0x6')]]['mohtime']));delete queues[_0x37008e['uniqueid']][_0x3929('0x61')];}}}catch(_0x2ecbac){utils[_0x3929('0x15')](util['format'](_0x3929('0x64'),_0x37008e[_0x3929('0x6')]),_0x2ecbac);}}; \ No newline at end of file +var _0x6b66=['origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transferuniqueid','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','info','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]'];(function(_0x3747ae,_0x408e61){var _0x339035=function(_0x83be87){while(--_0x83be87){_0x3747ae['push'](_0x3747ae['shift']());}};_0x339035(++_0x408e61);}(_0x6b66,0x80));var _0x66b6=function(_0x1541ac,_0x180340){_0x1541ac=_0x1541ac-0x0;var _0x52fe13=_0x6b66[_0x1541ac];return _0x52fe13;};'use strict';var _=require(_0x66b6('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x22cc3d){utils['info'](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x22cc3d[_0x66b6('0x1')],_0x22cc3d[_0x66b6('0x2')],_0x22cc3d[_0x66b6('0x3')],_0x22cc3d[_0x66b6('0x4')],_0x22cc3d[_0x66b6('0x5')],_0x22cc3d[_0x66b6('0x6')],_0x22cc3d[_0x66b6('0x7')]));if(_0x22cc3d[_0x66b6('0x3')]){utils[_0x66b6('0x8')](_0x22cc3d[_0x66b6('0x3')])[_0x66b6('0x9')](function(_0x1d6d90){if(_0x1d6d90){_0x22cc3d[_0x66b6('0xa')]=_0x1d6d90[_0x66b6('0xa')];}utils[_0x66b6('0xb')]('CreateVoiceQueueReport',_0x22cc3d);});}else{utils[_0x66b6('0xb')](_0x66b6('0xc'),_0x22cc3d);}if(_0x22cc3d['transfereduniqueid']){delete queues[_0x22cc3d[_0x66b6('0xd')]];}else{delete queues[_0x22cc3d['uniqueid']];}}exports[_0x66b6('0xe')]=function(_0x193b67){try{utils[_0x66b6('0xf')](util['format']('[%s][queues][queuecallerjoin]',_0x193b67[_0x66b6('0x1')]),_0x193b67);utils[_0x66b6('0x10')](util[_0x66b6('0x11')](_0x66b6('0x12'),_0x193b67['uniqueid'],_0x193b67[_0x66b6('0x3')],_0x193b67[_0x66b6('0x13')]));queues[_0x193b67['uniqueid']]=_[_0x66b6('0x14')](_0x193b67,{'originalposition':_0x193b67[_0x66b6('0x13')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x3eda8f){utils[_0x66b6('0x15')](util[_0x66b6('0x11')](_0x66b6('0x16'),_0x193b67[_0x66b6('0x1')]),_0x3eda8f);}};exports[_0x66b6('0x17')]=function(_0xec7392){try{if(!_[_0x66b6('0x18')](queues[_0xec7392[_0x66b6('0x1')]])){utils[_0x66b6('0xf')](util['format'](_0x66b6('0x19'),_0xec7392[_0x66b6('0x1')]),_0xec7392);if(queues[_0xec7392[_0x66b6('0x1')]]['queuecallerleaveAt']){if(!queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0x1a')]&&!queues[_0xec7392['uniqueid']]['queuecallerexit']){queues[_0xec7392['uniqueid']]['queuecallercomplete']=!![];queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0x1b')]=utils[_0x66b6('0x1c')]();queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0x7')]=_0x66b6('0x1d');}utils['info'](util[_0x66b6('0x11')](_0x66b6('0x1e'),_0xec7392[_0x66b6('0x1')],queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0x1f')],queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0x7')]));writeDB(queues[_0xec7392[_0x66b6('0x1')]]);}else if(queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0xd')]){utils['info'](util[_0x66b6('0x11')](_0x66b6('0x20'),_0xec7392['uniqueid'],queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0x1f')],queues[_0xec7392['uniqueid']][_0x66b6('0xd')]));queues[queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0xd')]]=queues[_0xec7392[_0x66b6('0x1')]];queues[queues[_0xec7392[_0x66b6('0x1')]][_0x66b6('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0xec7392[_0x66b6('0x1')]];}}}catch(_0x4f4a96){utils[_0x66b6('0x15')](util[_0x66b6('0x11')](_0x66b6('0x19'),_0xec7392[_0x66b6('0x1')]),_0x4f4a96);}};exports[_0x66b6('0x21')]=function(_0x5217a5){try{utils[_0x66b6('0xf')](util[_0x66b6('0x11')](_0x66b6('0x22'),_0x5217a5['uniqueid']),_0x5217a5);if(!_['isNil'](_0x5217a5['variable'][_0x66b6('0x23')])&&_0x5217a5[_0x66b6('0x24')][_0x66b6('0x25')]()!==_0x66b6('0x26')){if(!_[_0x66b6('0x18')](queues[_0x5217a5['uniqueid']])){queues[_0x5217a5['uniqueid']][_0x66b6('0x1a')]=![];queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x27')]=null;queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x28')]=!![];queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x29')]=utils[_0x66b6('0x1c')]();queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x7')]=_0x5217a5[_0x66b6('0x24')][_0x66b6('0x25')]();utils[_0x66b6('0x10')](util[_0x66b6('0x11')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x5217a5['uniqueid'],queues[_0x5217a5['uniqueid']]['name'],_0x5217a5[_0x66b6('0x24')],queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x7')]));writeDB(queues[_0x5217a5[_0x66b6('0x1')]]);}}else if(!_['isNil'](_0x5217a5[_0x66b6('0x2a')][_0x66b6('0x2b')])){if(!_[_0x66b6('0x18')](queues[_0x5217a5[_0x66b6('0x1')]])&&!queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x1a')]){queues[_0x5217a5[_0x66b6('0x1')]]['queuecallerabandon']=![];queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x27')]=null;queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x28')]=!![];queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x29')]=utils[_0x66b6('0x1c')]();queues[_0x5217a5['uniqueid']][_0x66b6('0x7')]=_0x66b6('0x2c');utils[_0x66b6('0x10')](util[_0x66b6('0x11')](_0x66b6('0x2d'),_0x5217a5[_0x66b6('0x1')],queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x1f')],_0x5217a5[_0x66b6('0x24')],queues[_0x5217a5[_0x66b6('0x1')]][_0x66b6('0x7')]));}}}catch(_0x4fe325){utils[_0x66b6('0x15')](util[_0x66b6('0x11')](_0x66b6('0x22'),_0x5217a5[_0x66b6('0x1')]),_0x4fe325);}};exports[_0x66b6('0x1a')]=function(_0x5835aa){try{if(!_[_0x66b6('0x18')](queues[_0x5835aa['uniqueid']])){utils['debug'](util[_0x66b6('0x11')]('[%s][queues][queuecallerabandon]',_0x5835aa[_0x66b6('0x1')]),_0x5835aa);queues[_0x5835aa[_0x66b6('0x1')]][_0x66b6('0x28')]=![];queues[_0x5835aa[_0x66b6('0x1')]][_0x66b6('0x29')]=null;queues[_0x5835aa[_0x66b6('0x1')]][_0x66b6('0x1a')]=!![];queues[_0x5835aa[_0x66b6('0x1')]][_0x66b6('0x27')]=utils[_0x66b6('0x1c')]();queues[_0x5835aa[_0x66b6('0x1')]][_0x66b6('0x7')]='ABANDONED';utils[_0x66b6('0x10')](util['format'](_0x66b6('0x2e'),_0x5835aa['uniqueid'],queues[_0x5835aa[_0x66b6('0x1')]][_0x66b6('0x1f')],queues[_0x5835aa[_0x66b6('0x1')]][_0x66b6('0x7')]));}}catch(_0x1ac3d7){utils[_0x66b6('0x15')](util[_0x66b6('0x11')]('[%s][queues][queuecallerabandon]',_0x5835aa[_0x66b6('0x1')]),_0x1ac3d7);}};exports[_0x66b6('0x2f')]=function(_0x57b081){try{if(!_[_0x66b6('0x18')](queues[_0x57b081[_0x66b6('0x1')]])){utils[_0x66b6('0xf')](util['format'](_0x66b6('0x30'),_0x57b081[_0x66b6('0x1')]),_0x57b081);utils[_0x66b6('0x10')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x57b081[_0x66b6('0x1')],queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x1f')],_0x57b081[_0x66b6('0x31')],_0x57b081[_0x66b6('0x32')]));queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x2f')]=!![];queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x33')]=utils[_0x66b6('0x1c')]();queues[_0x57b081[_0x66b6('0x1')]]['holdtime']=utils[_0x66b6('0x34')](queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x33')],queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x35')]);queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x13')]=_0x57b081[_0x66b6('0x13')];queues[_0x57b081[_0x66b6('0x1')]]['count']=_0x57b081[_0x66b6('0x36')];queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x31')]=_0x57b081[_0x66b6('0x31')];queues[_0x57b081[_0x66b6('0x1')]][_0x66b6('0x32')]=_0x57b081[_0x66b6('0x32')];}}catch(_0x1030e8){utils['error'](util['format']('[%s][queues][queuecallerleave]',_0x57b081[_0x66b6('0x1')]),_0x1030e8);}};exports[_0x66b6('0x37')]=function(_0x36d440){try{if(!_[_0x66b6('0x18')](queues[_0x36d440[_0x66b6('0x1')]])){utils[_0x66b6('0xf')](util[_0x66b6('0x11')](_0x66b6('0x38'),_0x36d440[_0x66b6('0x1')]),_0x36d440);utils[_0x66b6('0x10')](util[_0x66b6('0x11')](_0x66b6('0x39'),_0x36d440[_0x66b6('0x1')],queues[_0x36d440[_0x66b6('0x1')]][_0x66b6('0x1f')],_0x36d440[_0x66b6('0x3a')],_0x36d440['destaccountcode']));queues[_0x36d440[_0x66b6('0x1')]][_0x66b6('0x1a')]=![];queues[_0x36d440['uniqueid']]['queuecallerabandon']=![];queues[_0x36d440[_0x66b6('0x1')]]['queuecallerabandonAt']=null;queues[_0x36d440[_0x66b6('0x1')]][_0x66b6('0x28')]=![];queues[_0x36d440['uniqueid']][_0x66b6('0x7')]=null;queues[_0x36d440['uniqueid']]['queuecallerexitAt']=null;queues[_0x36d440[_0x66b6('0x1')]][_0x66b6('0x3b')]=!![];queues[_0x36d440[_0x66b6('0x1')]][_0x66b6('0x6')]=_0x36d440['destaccountcode'];queues[_0x36d440[_0x66b6('0x1')]]['lastAssignedTo']=_0x36d440['membername'];}}catch(_0x5afdad){utils[_0x66b6('0x15')](util[_0x66b6('0x11')](_0x66b6('0x38'),_0x36d440[_0x66b6('0x1')]),_0x5afdad);}};exports[_0x66b6('0x3c')]=function(_0x4dfae7){try{if(!_[_0x66b6('0x18')](queues[_0x4dfae7['uniqueid']])){if(queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x33')]){utils['debug'](util[_0x66b6('0x11')](_0x66b6('0x3d'),_0x4dfae7['uniqueid']),_0x4dfae7);queues[_0x4dfae7['uniqueid']][_0x66b6('0x1a')]=![];queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x1a')]=![];queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x27')]=null;queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x28')]=![];queues[_0x4dfae7[_0x66b6('0x1')]]['queuecallerexitAt']=null;queues[_0x4dfae7['uniqueid']][_0x66b6('0x3b')]=!![];queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x4')]=_0x4dfae7[_0x66b6('0x3a')];queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x3e')]=!![];queues[_0x4dfae7['uniqueid']][_0x66b6('0x1b')]=utils[_0x66b6('0x1c')]();if(_0x4dfae7['reason']=='transfer'){if(!queues[_0x4dfae7['uniqueid']][_0x66b6('0x3f')]){queues[_0x4dfae7['uniqueid']]['queuecallerexitreason']=_0x66b6('0x40');}}else{queues[_0x4dfae7['uniqueid']][_0x66b6('0x7')]=_0x66b6('0x41')+_0x4dfae7['reason']['toUpperCase']();}utils['info'](util[_0x66b6('0x11')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x4dfae7['uniqueid'],queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x1f')],_0x4dfae7[_0x66b6('0x3a')],queues[_0x4dfae7[_0x66b6('0x1')]][_0x66b6('0x7')]));writeDB(queues[_0x4dfae7[_0x66b6('0x1')]]);}}}catch(_0x53097c){utils[_0x66b6('0x15')](util[_0x66b6('0x11')](_0x66b6('0x3d'),_0x4dfae7[_0x66b6('0x1')]),_0x53097c);}};exports[_0x66b6('0x42')]=function(_0xf77a0b){try{if(!_[_0x66b6('0x18')](queues[_0xf77a0b[_0x66b6('0x43')]])){utils[_0x66b6('0xf')](util['format'](_0x66b6('0x44'),_0xf77a0b[_0x66b6('0x1')]),_0xf77a0b);queues[_0xf77a0b[_0x66b6('0x43')]][_0x66b6('0x3f')]=!![];queues[_0xf77a0b[_0x66b6('0x43')]][_0x66b6('0x45')]=_0x66b6('0x46');queues[_0xf77a0b['transfereeuniqueid']][_0x66b6('0x47')]=_0xf77a0b[_0x66b6('0x48')];queues[_0xf77a0b[_0x66b6('0x43')]]['transferuniqueid']=_0xf77a0b[_0x66b6('0x43')];queues[_0xf77a0b['transfereeuniqueid']][_0x66b6('0x7')]=_0x66b6('0x49');utils['info'](util[_0x66b6('0x11')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0xf77a0b[_0x66b6('0x1')],queues[_0xf77a0b[_0x66b6('0x43')]][_0x66b6('0x1f')],_0xf77a0b['transfereeuniqueid'],_0xf77a0b[_0x66b6('0x48')]));}}catch(_0x5a16fa){utils[_0x66b6('0x15')](util['format'](_0x66b6('0x44'),_0xf77a0b[_0x66b6('0x1')]),_0x5a16fa);}};exports[_0x66b6('0x4a')]=function(_0x281ad2){try{utils[_0x66b6('0xf')](util[_0x66b6('0x11')](_0x66b6('0x4b'),_0x281ad2[_0x66b6('0x4c')]),_0x281ad2);if(_0x281ad2[_0x66b6('0x4c')]==_0x281ad2[_0x66b6('0x4d')]){if(!_['isNil'](queues[_0x281ad2[_0x66b6('0x4e')]])){utils[_0x66b6('0x10')](util[_0x66b6('0x11')](_0x66b6('0x4f'),_0x281ad2[_0x66b6('0x4c')],queues[_0x281ad2['secondtransfererlinkedid']][_0x66b6('0x1f')],_0x281ad2[_0x66b6('0x50')]));queues[_0x281ad2['secondtransfererlinkedid']]['transfer']=!![];queues[_0x281ad2['secondtransfererlinkedid']][_0x66b6('0x45')]=_0x66b6('0x51');queues[_0x281ad2[_0x66b6('0x4e')]][_0x66b6('0x47')]=_0x281ad2[_0x66b6('0x50')];queues[_0x281ad2[_0x66b6('0x4e')]]['transferuniqueid']=_0x281ad2[_0x66b6('0x4c')];queues[_0x281ad2['secondtransfererlinkedid']][_0x66b6('0x7')]=_0x66b6('0x52');}if(!_[_0x66b6('0x18')](queues[_0x281ad2[_0x66b6('0x4d')]])){if(_0x281ad2['transfereelinkedid']&&queues[_0x281ad2[_0x66b6('0x53')]]){queues[_0x281ad2['transfereelinkedid']][_0x66b6('0x54')]=0x1;queues[_0x281ad2[_0x66b6('0x43')]]=_[_0x66b6('0x55')](queues[_0x281ad2['transfereelinkedid']]);queues[_0x281ad2['transfereeuniqueid']][_0x66b6('0xd')]=_0x281ad2['transfertargetuniqueid'];queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x54')]=0x2;queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x5')]=queues[_0x281ad2[_0x66b6('0x4e')]]['calleridnum'];queues[_0x281ad2['transfereeuniqueid']]['calleridname']=queues[_0x281ad2[_0x66b6('0x4e')]][_0x66b6('0x56')];queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x35')]=utils[_0x66b6('0x1c')]();queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x33')]=utils[_0x66b6('0x1c')]();queues[_0x281ad2['transfereeuniqueid']][_0x66b6('0x57')]=0x0;queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x58')]=0x0;utils['info'](util[_0x66b6('0x11')](_0x66b6('0x59'),_0x281ad2[_0x66b6('0x4c')],queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x1f')],queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x5')],queues[_0x281ad2[_0x66b6('0x43')]][_0x66b6('0x56')]));}else{utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x281ad2[_0x66b6('0x4c')],queues[_0x281ad2[_0x66b6('0x4d')]][_0x66b6('0x1f')],_0x281ad2['secondtransfererlinkedid']));queues[_0x281ad2['origtransfererlinkedid']][_0x66b6('0xd')]=_0x281ad2[_0x66b6('0x4e')];}}}else if(_0x281ad2[_0x66b6('0x5a')]==_0x281ad2[_0x66b6('0x4e')]){if(!_[_0x66b6('0x18')](queues[_0x281ad2[_0x66b6('0x4d')]])){utils[_0x66b6('0x10')](util[_0x66b6('0x11')](_0x66b6('0x5b'),_0x281ad2[_0x66b6('0x4c')],queues[_0x281ad2[_0x66b6('0x4d')]][_0x66b6('0x1f')],_0x281ad2[_0x66b6('0x5a')],_0x281ad2['secondtransfererexten']));queues[_0x281ad2[_0x66b6('0x4d')]][_0x66b6('0x3f')]=!![];queues[_0x281ad2[_0x66b6('0x4d')]][_0x66b6('0x45')]='ATTENDED';queues[_0x281ad2[_0x66b6('0x4d')]][_0x66b6('0x47')]=_0x281ad2[_0x66b6('0x5c')];queues[_0x281ad2[_0x66b6('0x4d')]][_0x66b6('0x5d')]=_0x281ad2[_0x66b6('0x5a')];queues[_0x281ad2[_0x66b6('0x4d')]]['queuecallerexitreason']=_0x66b6('0x52');}if(!_['isNil'](queues[_0x281ad2['secondtransfererlinkedid']])){if(_0x281ad2[_0x66b6('0x5e')]&&queues[_0x281ad2[_0x66b6('0x5e')]]){queues[_0x281ad2[_0x66b6('0x5e')]][_0x66b6('0x54')]=0x1;queues[_0x281ad2[_0x66b6('0x5f')]]=_[_0x66b6('0x55')](queues[_0x281ad2[_0x66b6('0x5e')]]);queues[_0x281ad2[_0x66b6('0x5f')]][_0x66b6('0xd')]=_0x281ad2[_0x66b6('0x5f')];queues[_0x281ad2[_0x66b6('0x5f')]][_0x66b6('0x54')]=0x2;queues[_0x281ad2['transfertargetuniqueid']][_0x66b6('0x5')]=queues[_0x281ad2['origtransfererlinkedid']]['calleridnum'];queues[_0x281ad2[_0x66b6('0x5f')]][_0x66b6('0x56')]=queues[_0x281ad2[_0x66b6('0x4d')]][_0x66b6('0x56')];queues[_0x281ad2[_0x66b6('0x5f')]]['queuecallerjoinAt']=utils[_0x66b6('0x1c')]();queues[_0x281ad2[_0x66b6('0x5f')]][_0x66b6('0x33')]=utils['now']();queues[_0x281ad2[_0x66b6('0x5f')]][_0x66b6('0x57')]=0x0;queues[_0x281ad2['transfertargetuniqueid']][_0x66b6('0x58')]=0x0;utils[_0x66b6('0x10')](util['format'](_0x66b6('0x60'),_0x281ad2['origtransfereruniqueid'],queues[_0x281ad2['transfertargetuniqueid']][_0x66b6('0x1f')],queues[_0x281ad2[_0x66b6('0x5f')]][_0x66b6('0xd')],queues[_0x281ad2[_0x66b6('0x5f')]][_0x66b6('0x5')],queues[_0x281ad2['transfertargetuniqueid']]['calleridname']));}else{utils[_0x66b6('0x10')](util[_0x66b6('0x11')](_0x66b6('0x61'),_0x281ad2[_0x66b6('0x4c')],queues[_0x281ad2[_0x66b6('0x4e')]][_0x66b6('0x1f')],_0x281ad2['origtransfererlinkedid']));queues[_0x281ad2[_0x66b6('0x4e')]][_0x66b6('0xd')]=_0x281ad2[_0x66b6('0x4d')];}}}}catch(_0x9e0e1){utils['error'](util[_0x66b6('0x11')]('[%s][queues][attendedtransfer]',_0x281ad2[_0x66b6('0x4c')]),_0x9e0e1);}};exports['musiconholdstart']=function(_0x46814e){try{if(!_[_0x66b6('0x18')](queues[_0x46814e[_0x66b6('0x1')]])){utils['debug'](util[_0x66b6('0x11')](_0x66b6('0x62'),_0x46814e['uniqueid']),_0x46814e);queues[_0x46814e[_0x66b6('0x1')]]['musiconholdstartAt']=utils['now']();utils[_0x66b6('0x10')](util[_0x66b6('0x11')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x46814e['uniqueid'],queues[_0x46814e[_0x66b6('0x1')]][_0x66b6('0x1f')],queues[_0x46814e[_0x66b6('0x1')]][_0x66b6('0x63')]));}}catch(_0x35c4f6){utils[_0x66b6('0x15')](util[_0x66b6('0x11')](_0x66b6('0x62'),_0x46814e[_0x66b6('0x1')]),_0x35c4f6);}};exports[_0x66b6('0x64')]=function(_0xd0ea5b){try{if(!_['isNil'](queues[_0xd0ea5b[_0x66b6('0x1')]])){if(!_[_0x66b6('0x18')](queues[_0xd0ea5b[_0x66b6('0x1')]][_0x66b6('0x63')])){utils['debug'](util[_0x66b6('0x11')]('[%s][queues][musiconholdstop]',_0xd0ea5b[_0x66b6('0x1')]),_0xd0ea5b);queues[_0xd0ea5b[_0x66b6('0x1')]]['mohtime']+=utils[_0x66b6('0x34')](utils[_0x66b6('0x1c')](),queues[_0xd0ea5b['uniqueid']][_0x66b6('0x63')]);utils[_0x66b6('0x10')](util[_0x66b6('0x11')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0xd0ea5b[_0x66b6('0x1')],queues[_0xd0ea5b[_0x66b6('0x1')]]['name'],queues[_0xd0ea5b[_0x66b6('0x1')]][_0x66b6('0x58')]));delete queues[_0xd0ea5b[_0x66b6('0x1')]][_0x66b6('0x63')];}}}catch(_0x3569fd){utils[_0x66b6('0x15')](util['format'](_0x66b6('0x65'),_0xd0ea5b['uniqueid']),_0x3569fd);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index e1cbee8..cda2d76 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 _0xb5e7=['newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]'];(function(_0x4a04eb,_0x28e4d2){var _0x3e509b=function(_0x1282bf){while(--_0x1282bf){_0x4a04eb['push'](_0x4a04eb['shift']());}};_0x3e509b(++_0x28e4d2);}(_0xb5e7,0xd1));var _0x7b5e=function(_0x272de5,_0x5aa8a8){_0x272de5=_0x272de5-0x0;var _0x937e6b=_0xb5e7[_0x272de5];return _0x937e6b;};'use strict';var _=require(_0x7b5e('0x0'));var util=require(_0x7b5e('0x1'));var utils=require(_0x7b5e('0x2'));var recordings={};function writeDB(_0x1749bd){utils[_0x7b5e('0x3')](util[_0x7b5e('0x4')](_0x7b5e('0x5'),_0x1749bd[_0x7b5e('0x6')]));if(_0x1749bd[_0x7b5e('0x7')]){utils[_0x7b5e('0x8')](_0x1749bd[_0x7b5e('0x7')])['then'](function(_0xe66407){if(_0xe66407){_0x1749bd['membername']=_0xe66407[_0x7b5e('0x9')];_0x1749bd[_0x7b5e('0xa')]=_0xe66407['id'];}utils[_0x7b5e('0xb')](_0x7b5e('0xc'),_0x1749bd);});}else{utils[_0x7b5e('0xb')](_0x7b5e('0xc'),_0x1749bd);}}exports[_0x7b5e('0xd')]=function(_0x495094){try{utils[_0x7b5e('0xe')](util[_0x7b5e('0x4')](_0x7b5e('0xf'),_0x495094[_0x7b5e('0x6')]),_0x495094);if(_0x495094[_0x7b5e('0x6')]==_0x495094[_0x7b5e('0x10')]){utils[_0x7b5e('0x3')](util['format'](_0x7b5e('0x11'),_0x495094['uniqueid'],_0x495094[_0x7b5e('0x12')],_0x495094['exten']));recordings[_0x495094['uniqueid']]={'uniqueid':_0x495094[_0x7b5e('0x6')],'accountcode':_0x495094['accountcode'],'exten':_0x495094[_0x7b5e('0x13')],'context':_0x495094[_0x7b5e('0x12')],'channel':_0x495094[_0x7b5e('0x14')],'monitors':[]};}}catch(_0x18239c){utils['error'](util[_0x7b5e('0x4')](_0x7b5e('0xf'),_0x495094['uniqueid']),_0x18239c);}};exports[_0x7b5e('0x15')]=function(_0x5d0d67){try{utils['debug'](util[_0x7b5e('0x4')](_0x7b5e('0x16'),_0x5d0d67['uniqueid']),_0x5d0d67);if(!_[_0x7b5e('0x17')](recordings[_0x5d0d67[_0x7b5e('0x6')]])&&_0x5d0d67[_0x7b5e('0x18')]==0x6){utils[_0x7b5e('0x3')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x5d0d67[_0x7b5e('0x6')],_0x5d0d67[_0x7b5e('0x12')],_0x5d0d67[_0x7b5e('0x14')]));}else if(!_[_0x7b5e('0x17')](recordings[_0x5d0d67[_0x7b5e('0x10')]])&&_0x5d0d67[_0x7b5e('0x18')]==0x6&&_0x5d0d67[_0x7b5e('0x12')]!=_0x7b5e('0x19')){utils[_0x7b5e('0x3')](util[_0x7b5e('0x4')](_0x7b5e('0x1a'),_0x5d0d67[_0x7b5e('0x6')],_0x5d0d67[_0x7b5e('0x10')],_0x5d0d67['context'],_0x5d0d67['channel']));recordings[_0x5d0d67[_0x7b5e('0x10')]][_0x7b5e('0x7')]=_0x5d0d67[_0x7b5e('0x7')];}}catch(_0x5b10ad){utils[_0x7b5e('0x1b')](util[_0x7b5e('0x4')](_0x7b5e('0x16'),_0x5d0d67[_0x7b5e('0x6')]),_0x5b10ad);}};exports[_0x7b5e('0x1c')]=function(_0x586e82){try{if(!_['isNil'](_0x586e82[_0x7b5e('0x1d')])&&!_[_0x7b5e('0x17')](_0x586e82[_0x7b5e('0x1d')][_0x7b5e('0x1e')])){utils[_0x7b5e('0xe')](util[_0x7b5e('0x4')](_0x7b5e('0x1f'),_0x586e82[_0x7b5e('0x6')]),_0x586e82);utils['info'](util[_0x7b5e('0x4')](_0x7b5e('0x20'),_0x586e82[_0x7b5e('0x6')],_0x586e82[_0x7b5e('0x1d')],_0x586e82[_0x7b5e('0x21')]));if(_[_0x7b5e('0x22')](_0x586e82[_0x7b5e('0x21')],_0x7b5e('0x23'))){_0x586e82[_0x7b5e('0x21')]=_0x586e82['value'][_0x7b5e('0x24')](_0x7b5e('0x23'),'.WAV');}if(recordings[_0x586e82['linkedid']]){var _0x3ad869=_[_0x7b5e('0x25')](recordings[_0x586e82[_0x7b5e('0x10')]][_0x7b5e('0x26')],{'value':_0x586e82[_0x7b5e('0x21')]});if(_[_0x7b5e('0x17')](_0x3ad869)){recordings[_0x586e82[_0x7b5e('0x10')]][_0x7b5e('0x26')][_0x7b5e('0x27')]({'value':_0x586e82[_0x7b5e('0x21')]});}}}}catch(_0x958f14){utils[_0x7b5e('0x1b')](util['format'](_0x7b5e('0x1f'),_0x586e82['uniqueid']),_0x958f14);}};exports['hangup']=function(_0x354ffb){try{if(!_['isNil'](recordings[_0x354ffb[_0x7b5e('0x6')]])){utils['debug'](util[_0x7b5e('0x4')]('[%s][recordings][hangup]',_0x354ffb['uniqueid']),_0x354ffb);utils['info'](util[_0x7b5e('0x4')](_0x7b5e('0x28'),_0x354ffb[_0x7b5e('0x6')],_0x354ffb[_0x7b5e('0x29')],_0x354ffb[_0x7b5e('0x2a')],_0x354ffb[_0x7b5e('0x2b')]));recordings[_0x354ffb['uniqueid']]['calleridnum']=_0x354ffb[_0x7b5e('0x29')];recordings[_0x354ffb[_0x7b5e('0x6')]][_0x7b5e('0x2a')]=_0x354ffb[_0x7b5e('0x2a')];recordings[_0x354ffb[_0x7b5e('0x6')]][_0x7b5e('0x2c')]=_0x354ffb[_0x7b5e('0x2c')];recordings[_0x354ffb[_0x7b5e('0x6')]][_0x7b5e('0x2d')]=_0x354ffb[_0x7b5e('0x2d')];if(recordings[_0x354ffb['uniqueid']][_0x7b5e('0x2e')]==_0x7b5e('0x2f')&&recordings[_0x354ffb[_0x7b5e('0x6')]][_0x7b5e('0x7')]){recordings[_0x354ffb[_0x7b5e('0x6')]][_0x7b5e('0x2c')]=recordings[_0x354ffb[_0x7b5e('0x6')]]['accountcode'];recordings[_0x354ffb[_0x7b5e('0x6')]][_0x7b5e('0x2d')]='';}recordings[_0x354ffb[_0x7b5e('0x6')]]['monitors'][_0x7b5e('0x30')](function(_0x5043a9){var _0x3f44cf=_[_0x7b5e('0x31')](recordings[_0x354ffb[_0x7b5e('0x6')]]);_0x3f44cf[_0x7b5e('0x21')]=_0x5043a9[_0x7b5e('0x21')];writeDB(_0x3f44cf);});delete recordings[_0x354ffb[_0x7b5e('0x6')]];}}catch(_0x29b9b8){utils[_0x7b5e('0x1b')](util[_0x7b5e('0x4')](_0x7b5e('0x32'),_0x354ffb[_0x7b5e('0x6')]),_0x29b9b8);}};exports[_0x7b5e('0x33')]=function(_0x555618){try{if(!_['isNil'](recordings[_0x555618[_0x7b5e('0x6')]])){utils[_0x7b5e('0xe')](util['format']('[%s][recordings][newexten]',_0x555618[_0x7b5e('0x6')]),_0x555618);utils[_0x7b5e('0x3')](util[_0x7b5e('0x4')](_0x7b5e('0x34'),_0x555618['uniqueid'],_0x555618[_0x7b5e('0x35')],_0x555618[_0x7b5e('0x36')]));if(_0x555618[_0x7b5e('0x35')]['toLowerCase']()=='set'&&_[_0x7b5e('0x37')](_0x555618['appdata'][_0x7b5e('0x38')](),_0x7b5e('0x39'))){var _0x365b70=_0x555618[_0x7b5e('0x36')][_0x7b5e('0x3a')]('=');var _0x37dbe6=_0x365b70[0x0][_0x7b5e('0x3b')](_0x365b70[0x0][_0x7b5e('0x3c')]('(')+0x1,_0x365b70[0x0][_0x7b5e('0x3c')](')'));var _0x4f8d16=_0x365b70[0x1];recordings[_0x555618[_0x7b5e('0x6')]][_0x37dbe6]=_0x4f8d16;}}}catch(_0x522b1f){utils['error'](util['format']('[%s][recordings][newexten]',_0x555618['uniqueid']),_0x522b1f);}};exports[_0x7b5e('0x3d')]=function(_0x119998){try{if(!_[_0x7b5e('0x17')](recordings[_0x119998[_0x7b5e('0x6')]])){utils[_0x7b5e('0xe')](util[_0x7b5e('0x4')](_0x7b5e('0x3e'),_0x119998[_0x7b5e('0x6')]),_0x119998);utils[_0x7b5e('0x3')](util['format'](_0x7b5e('0x3f'),_0x119998[_0x7b5e('0x6')],_0x119998[_0x7b5e('0x40')]));recordings[_0x119998[_0x7b5e('0x6')]][_0x7b5e('0x40')]=_0x119998[_0x7b5e('0x40')];}}catch(_0x4addb7){utils['error'](util['format'](_0x7b5e('0x3e'),_0x119998['uniqueid']),_0x4addb7);}}; \ No newline at end of file +var _0x3419=['[%s][recordings][hangup]','cause-txt','calleridnum','connectedlinenum','connectedlinename','outbound','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','split','lastIndexOf','queuecallerjoin','queue','lodash','util','./utils','info','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','debug','format','[%s][recordings][newchannel]','linkedid','context','exten','channel','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','.WAV','find','monitors','[%s][recordings][varset]'];(function(_0x536919,_0x2d0c68){var _0x3694d9=function(_0xf21223){while(--_0xf21223){_0x536919['push'](_0x536919['shift']());}};_0x3694d9(++_0x2d0c68);}(_0x3419,0x7f));var _0x9341=function(_0x1c4951,_0x2038ee){_0x1c4951=_0x1c4951-0x0;var _0x345e1b=_0x3419[_0x1c4951];return _0x345e1b;};'use strict';var _=require(_0x9341('0x0'));var util=require(_0x9341('0x1'));var utils=require(_0x9341('0x2'));var recordings={};function writeDB(_0x20ab91){utils[_0x9341('0x3')](util['format']('[%s][recordings][writeDB]',_0x20ab91[_0x9341('0x4')]));if(_0x20ab91[_0x9341('0x5')]){utils[_0x9341('0x6')](_0x20ab91[_0x9341('0x5')])[_0x9341('0x7')](function(_0xe4be74){if(_0xe4be74){_0x20ab91[_0x9341('0x8')]=_0xe4be74[_0x9341('0x9')];_0x20ab91[_0x9341('0xa')]=_0xe4be74['id'];}utils[_0x9341('0xb')](_0x9341('0xc'),_0x20ab91);});}else{utils[_0x9341('0xb')](_0x9341('0xc'),_0x20ab91);}}exports['newchannel']=function(_0x4d28d4){try{utils[_0x9341('0xd')](util[_0x9341('0xe')](_0x9341('0xf'),_0x4d28d4[_0x9341('0x4')]),_0x4d28d4);if(_0x4d28d4[_0x9341('0x4')]==_0x4d28d4[_0x9341('0x10')]){utils['info'](util[_0x9341('0xe')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x4d28d4[_0x9341('0x4')],_0x4d28d4[_0x9341('0x11')],_0x4d28d4['exten']));recordings[_0x4d28d4[_0x9341('0x4')]]={'uniqueid':_0x4d28d4[_0x9341('0x4')],'accountcode':_0x4d28d4[_0x9341('0x5')],'exten':_0x4d28d4[_0x9341('0x12')],'context':_0x4d28d4['context'],'channel':_0x4d28d4[_0x9341('0x13')],'monitors':[]};}}catch(_0x7bea29){utils['error'](util['format'](_0x9341('0xf'),_0x4d28d4[_0x9341('0x4')]),_0x7bea29);}};exports['newstate']=function(_0x58b65e){try{utils[_0x9341('0xd')](util[_0x9341('0xe')](_0x9341('0x14'),_0x58b65e[_0x9341('0x4')]),_0x58b65e);if(!_[_0x9341('0x15')](recordings[_0x58b65e[_0x9341('0x4')]])&&_0x58b65e['channelstate']==0x6){utils[_0x9341('0x3')](util[_0x9341('0xe')](_0x9341('0x16'),_0x58b65e[_0x9341('0x4')],_0x58b65e['context'],_0x58b65e[_0x9341('0x13')]));}else if(!_['isNil'](recordings[_0x58b65e['linkedid']])&&_0x58b65e['channelstate']==0x6&&_0x58b65e[_0x9341('0x11')]!=_0x9341('0x17')){utils[_0x9341('0x3')](util[_0x9341('0xe')](_0x9341('0x18'),_0x58b65e['uniqueid'],_0x58b65e[_0x9341('0x10')],_0x58b65e[_0x9341('0x11')],_0x58b65e[_0x9341('0x13')]));recordings[_0x58b65e[_0x9341('0x10')]][_0x9341('0x5')]=_0x58b65e[_0x9341('0x5')];}}catch(_0x2c8f38){utils[_0x9341('0x19')](util[_0x9341('0xe')](_0x9341('0x14'),_0x58b65e[_0x9341('0x4')]),_0x2c8f38);}};exports[_0x9341('0x1a')]=function(_0x1d6d27){try{if(!_[_0x9341('0x15')](_0x1d6d27[_0x9341('0x1b')])&&!_[_0x9341('0x15')](_0x1d6d27[_0x9341('0x1b')][_0x9341('0x1c')])){utils[_0x9341('0xd')](util[_0x9341('0xe')]('[%s][recordings][varset]',_0x1d6d27[_0x9341('0x4')]),_0x1d6d27);utils[_0x9341('0x3')](util['format'](_0x9341('0x1d'),_0x1d6d27[_0x9341('0x4')],_0x1d6d27[_0x9341('0x1b')],_0x1d6d27['value']));if(_[_0x9341('0x1e')](_0x1d6d27[_0x9341('0x1f')],_0x9341('0x20'))){_0x1d6d27[_0x9341('0x1f')]=_0x1d6d27[_0x9341('0x1f')][_0x9341('0x21')](_0x9341('0x20'),_0x9341('0x22'));}if(recordings[_0x1d6d27[_0x9341('0x10')]]){var _0x540b29=_[_0x9341('0x23')](recordings[_0x1d6d27['linkedid']]['monitors'],{'value':_0x1d6d27[_0x9341('0x1f')]});if(_[_0x9341('0x15')](_0x540b29)){recordings[_0x1d6d27['linkedid']][_0x9341('0x24')]['push']({'value':_0x1d6d27[_0x9341('0x1f')]});}}}}catch(_0x3ba8cf){utils[_0x9341('0x19')](util[_0x9341('0xe')](_0x9341('0x25'),_0x1d6d27['uniqueid']),_0x3ba8cf);}};exports['hangup']=function(_0x5a2999){try{if(!_[_0x9341('0x15')](recordings[_0x5a2999[_0x9341('0x4')]])){utils['debug'](util[_0x9341('0xe')](_0x9341('0x26'),_0x5a2999['uniqueid']),_0x5a2999);utils[_0x9341('0x3')](util[_0x9341('0xe')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x5a2999[_0x9341('0x4')],_0x5a2999['calleridnum'],_0x5a2999['calleridname'],_0x5a2999[_0x9341('0x27')]));recordings[_0x5a2999['uniqueid']][_0x9341('0x28')]=_0x5a2999[_0x9341('0x28')];recordings[_0x5a2999[_0x9341('0x4')]]['calleridname']=_0x5a2999['calleridname'];recordings[_0x5a2999['uniqueid']][_0x9341('0x29')]=_0x5a2999[_0x9341('0x29')];recordings[_0x5a2999[_0x9341('0x4')]]['connectedlinename']=_0x5a2999[_0x9341('0x2a')];if(recordings[_0x5a2999[_0x9341('0x4')]]['type']==_0x9341('0x2b')&&recordings[_0x5a2999['uniqueid']]['accountcode']){recordings[_0x5a2999[_0x9341('0x4')]][_0x9341('0x29')]=recordings[_0x5a2999['uniqueid']][_0x9341('0x5')];recordings[_0x5a2999[_0x9341('0x4')]][_0x9341('0x2a')]='';}recordings[_0x5a2999[_0x9341('0x4')]][_0x9341('0x24')]['forEach'](function(_0x3c06a5){var _0x2edfa2=_['clone'](recordings[_0x5a2999['uniqueid']]);_0x2edfa2[_0x9341('0x1f')]=_0x3c06a5[_0x9341('0x1f')];writeDB(_0x2edfa2);});delete recordings[_0x5a2999[_0x9341('0x4')]];}}catch(_0x2b086d){utils[_0x9341('0x19')](util['format'](_0x9341('0x26'),_0x5a2999[_0x9341('0x4')]),_0x2b086d);}};exports[_0x9341('0x2c')]=function(_0x8dfd2b){try{if(!_[_0x9341('0x15')](recordings[_0x8dfd2b['uniqueid']])){utils[_0x9341('0xd')](util['format'](_0x9341('0x2d'),_0x8dfd2b['uniqueid']),_0x8dfd2b);utils[_0x9341('0x3')](util[_0x9341('0xe')](_0x9341('0x2e'),_0x8dfd2b['uniqueid'],_0x8dfd2b[_0x9341('0x2f')],_0x8dfd2b['appdata']));if(_0x8dfd2b[_0x9341('0x2f')][_0x9341('0x30')]()=='set'&&_[_0x9341('0x31')](_0x8dfd2b[_0x9341('0x32')]['toLowerCase'](),'cdr')){var _0x115bb4=_0x8dfd2b[_0x9341('0x32')][_0x9341('0x33')]('=');var _0x425f13=_0x115bb4[0x0]['substring'](_0x115bb4[0x0][_0x9341('0x34')]('(')+0x1,_0x115bb4[0x0][_0x9341('0x34')](')'));var _0x131357=_0x115bb4[0x1];recordings[_0x8dfd2b[_0x9341('0x4')]][_0x425f13]=_0x131357;}}}catch(_0x1f53a7){utils['error'](util['format'](_0x9341('0x2d'),_0x8dfd2b[_0x9341('0x4')]),_0x1f53a7);}};exports[_0x9341('0x35')]=function(_0x45744d){try{if(!_[_0x9341('0x15')](recordings[_0x45744d['uniqueid']])){utils[_0x9341('0xd')](util['format']('[%s][recordings][queuecallerjoin]',_0x45744d['uniqueid']),_0x45744d);utils[_0x9341('0x3')](util[_0x9341('0xe')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x45744d[_0x9341('0x4')],_0x45744d[_0x9341('0x36')]));recordings[_0x45744d[_0x9341('0x4')]][_0x9341('0x36')]=_0x45744d[_0x9341('0x36')];}}catch(_0x318ea1){utils[_0x9341('0x19')](util['format']('[%s][recordings][queuecallerjoin]',_0x45744d['uniqueid']),_0x318ea1);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 133a5af..a28085e 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 _0xdef5=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','assign','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','debug','format','[%s][transfers][blindtransfer]','uniqueid','transferercalleridname','transfereecalleridnum','transfereecalleridname','type','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x5937ec,_0x1b622c){var _0x1bfbfc=function(_0x8f22ac){while(--_0x8f22ac){_0x5937ec['push'](_0x5937ec['shift']());}};_0x1bfbfc(++_0x1b622c);}(_0xdef5,0x7d));var _0x5def=function(_0x45292f,_0x128253){_0x45292f=_0x45292f-0x0;var _0x24ddec=_0xdef5[_0x45292f];return _0x24ddec;};'use strict';var _=require('lodash');var util=require(_0x5def('0x0'));var utils=require(_0x5def('0x1'));function writeDB(_0x328387){utils[_0x5def('0x2')](util['format'](_0x5def('0x3'),_0x328387['type']===_0x5def('0x4')?_0x328387[_0x5def('0x5')]:_0x328387['uniqueid'],_0x328387['type']));utils[_0x5def('0x6')](_0x5def('0x7'),_0x328387);}exports['blindtransfer']=function(_0x5b778e){try{utils[_0x5def('0x8')](util[_0x5def('0x9')](_0x5def('0xa'),_0x5b778e[_0x5def('0xb')]),_0x5b778e);utils['info'](util[_0x5def('0x9')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5b778e[_0x5def('0xb')],_0x5b778e['transferercalleridnum'],_0x5b778e[_0x5def('0xc')],_0x5b778e[_0x5def('0xd')],_0x5b778e[_0x5def('0xe')]));_0x5b778e[_0x5def('0xf')]=_0x5def('0x10');writeDB(_0x5b778e);}catch(_0x46f2ae){utils[_0x5def('0x11')](util[_0x5def('0x9')]('[%s][transfers][blindtransfer]',_0x5b778e[_0x5def('0xb')]),_0x46f2ae);}};exports[_0x5def('0x12')]=function(_0x9e6b81){try{utils[_0x5def('0x8')](util[_0x5def('0x9')](_0x5def('0x13'),_0x9e6b81[_0x5def('0x5')]),_0x9e6b81);utils['info'](util[_0x5def('0x9')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x9e6b81[_0x5def('0x5')],_0x9e6b81[_0x5def('0x14')],_0x9e6b81['origtransferercalleridname'],_0x9e6b81[_0x5def('0x15')],_0x9e6b81[_0x5def('0x16')]));_0x9e6b81=_['assign'](_0x9e6b81,{'transfererchannel':_0x9e6b81['origtransfererchannel'],'transferercalleridnum':_0x9e6b81['origtransferercalleridnum'],'transferercalleridname':_0x9e6b81['origtransferercalleridname'],'transfererconnectedlinenum':_0x9e6b81[_0x5def('0x17')],'transfererconnectedlinename':_0x9e6b81[_0x5def('0x18')],'transfereraccountcode':_0x9e6b81[_0x5def('0x19')],'transferercontext':_0x9e6b81[_0x5def('0x1a')],'transfererexten':_0x9e6b81['secondtransfererexten'],'transfererlinkedid':_0x9e6b81[_0x5def('0x1b')],'context':_0x9e6b81['origtransferercontext'],'extension':_0x9e6b81[_0x5def('0x1c')],'type':_0x5def('0x4')});if(_[_0x5def('0x1d')](_0x9e6b81[_0x5def('0x1e')])){_0x9e6b81=_[_0x5def('0x1f')](_0x9e6b81,{'transfereechannel':_0x9e6b81['transfertargetchannel'],'transfereecalleridnum':_0x9e6b81['transfertargetcalleridnum'],'transfereecalleridname':_0x9e6b81['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x9e6b81[_0x5def('0x20')],'transfereeconnectedlinename':_0x9e6b81[_0x5def('0x21')],'transfereeaccountcode':_0x9e6b81[_0x5def('0x22')],'transfereecontext':_0x9e6b81[_0x5def('0x23')],'transfereeexten':_0x9e6b81[_0x5def('0x24')],'transfereelinkedid':_0x9e6b81['transfertargetlinkedid']});}writeDB(_0x9e6b81);}catch(_0x1d5fee){utils['error'](util[_0x5def('0x9')]('[%s][transfers][attendedtransfer]',_0x9e6b81[_0x5def('0x5')]),_0x1d5fee);}}; \ No newline at end of file +var _0x07fd=['secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','info','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext'];(function(_0x4c795b,_0x138e87){var _0x4ba4d8=function(_0x542d51){while(--_0x542d51){_0x4c795b['push'](_0x4c795b['shift']());}};_0x4ba4d8(++_0x138e87);}(_0x07fd,0x1d9));var _0xd07f=function(_0x4aaaaf,_0x64301b){_0x4aaaaf=_0x4aaaaf-0x0;var _0x4dc2a6=_0x07fd[_0x4aaaaf];return _0x4dc2a6;};'use strict';var _=require(_0xd07f('0x0'));var util=require(_0xd07f('0x1'));var utils=require('./utils');function writeDB(_0x1df16f){utils['info'](util[_0xd07f('0x2')](_0xd07f('0x3'),_0x1df16f[_0xd07f('0x4')]===_0xd07f('0x5')?_0x1df16f[_0xd07f('0x6')]:_0x1df16f[_0xd07f('0x7')],_0x1df16f[_0xd07f('0x4')]));utils[_0xd07f('0x8')](_0xd07f('0x9'),_0x1df16f);}exports[_0xd07f('0xa')]=function(_0x9c4d42){try{utils[_0xd07f('0xb')](util[_0xd07f('0x2')](_0xd07f('0xc'),_0x9c4d42['uniqueid']),_0x9c4d42);utils['info'](util['format'](_0xd07f('0xd'),_0x9c4d42[_0xd07f('0x7')],_0x9c4d42[_0xd07f('0xe')],_0x9c4d42['transferercalleridname'],_0x9c4d42[_0xd07f('0xf')],_0x9c4d42[_0xd07f('0x10')]));_0x9c4d42['type']='blind';writeDB(_0x9c4d42);}catch(_0x5a9a67){utils[_0xd07f('0x11')](util[_0xd07f('0x2')](_0xd07f('0xc'),_0x9c4d42['uniqueid']),_0x5a9a67);}};exports[_0xd07f('0x12')]=function(_0x30a429){try{utils['debug'](util[_0xd07f('0x2')](_0xd07f('0x13'),_0x30a429[_0xd07f('0x6')]),_0x30a429);utils[_0xd07f('0x14')](util[_0xd07f('0x2')](_0xd07f('0x15'),_0x30a429[_0xd07f('0x6')],_0x30a429[_0xd07f('0x16')],_0x30a429[_0xd07f('0x17')],_0x30a429[_0xd07f('0x18')],_0x30a429[_0xd07f('0x19')]));_0x30a429=_[_0xd07f('0x1a')](_0x30a429,{'transfererchannel':_0x30a429[_0xd07f('0x1b')],'transferercalleridnum':_0x30a429[_0xd07f('0x16')],'transferercalleridname':_0x30a429['origtransferercalleridname'],'transfererconnectedlinenum':_0x30a429[_0xd07f('0x1c')],'transfererconnectedlinename':_0x30a429[_0xd07f('0x1d')],'transfereraccountcode':_0x30a429['origtransfereraccountcode'],'transferercontext':_0x30a429[_0xd07f('0x1e')],'transfererexten':_0x30a429[_0xd07f('0x1f')],'transfererlinkedid':_0x30a429['origtransfererlinkedid'],'context':_0x30a429[_0xd07f('0x20')],'extension':_0x30a429[_0xd07f('0x21')],'type':_0xd07f('0x5')});if(_[_0xd07f('0x22')](_0x30a429['transfereechannel'])){_0x30a429=_[_0xd07f('0x1a')](_0x30a429,{'transfereechannel':_0x30a429[_0xd07f('0x23')],'transfereecalleridnum':_0x30a429[_0xd07f('0x18')],'transfereecalleridname':_0x30a429[_0xd07f('0x19')],'transfereeconnectedlinenum':_0x30a429[_0xd07f('0x24')],'transfereeconnectedlinename':_0x30a429[_0xd07f('0x25')],'transfereeaccountcode':_0x30a429[_0xd07f('0x26')],'transfereecontext':_0x30a429[_0xd07f('0x27')],'transfereeexten':_0x30a429[_0xd07f('0x28')],'transfereelinkedid':_0x30a429[_0xd07f('0x29')]});}writeDB(_0x30a429);}catch(_0x385ab8){utils['error'](util[_0xd07f('0x2')](_0xd07f('0x13'),_0x30a429[_0xd07f('0x6')]),_0x385ab8);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 85dcfa0..85f72be 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 _0x77ea=['diff','sumTime','now','isBefore','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format'];(function(_0x3c04ef,_0x9d110c){var _0x6a3a69=function(_0x333514){while(--_0x333514){_0x3c04ef['push'](_0x3c04ef['shift']());}};_0x6a3a69(++_0x9d110c);}(_0x77ea,0x18c));var _0xa77e=function(_0x8fae33,_0x492c94){_0x8fae33=_0x8fae33-0x0;var _0x183a2a=_0x77ea[_0x8fae33];return _0x183a2a;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xa77e('0x0'));var moment=require(_0xa77e('0x1'));var util=require(_0xa77e('0x2'));var client=jayson[_0xa77e('0x3')][_0xa77e('0x4')]({'port':0x2329});var logger=require(_0xa77e('0x5'))(_0xa77e('0x6'));exports[_0xa77e('0x7')]=function(_0x390ccb,_0x1e9df9){logger['info'](_0x390ccb,_0x1e9df9?util['inspect'](_0x1e9df9,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x2f9b42,_0x29a346){logger[_0xa77e('0x8')](_0x2f9b42,_0x29a346?util[_0xa77e('0x9')](_0x29a346,{'showHidden':![],'depth':null}):'');};exports[_0xa77e('0xa')]=function(_0x493b65,_0x40e6f3){logger[_0xa77e('0xa')](_0x493b65,_0x40e6f3?util['inspect'](_0x40e6f3,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x381016,_0x24fb75){return client[_0xa77e('0xb')](_0x381016,{'body':_0x24fb75})[_0xa77e('0xc')](function(_0x21de07){logger[_0xa77e('0x8')](_0xa77e('0xd'),_0x381016,_0x21de07?util[_0xa77e('0x9')](_0x21de07,{'showHidden':![],'depth':null}):'');})[_0xa77e('0xe')](function(_0x2e1291){logger[_0xa77e('0xa')](_0xa77e('0xd'),_0x381016,_0x2e1291?util[_0xa77e('0x9')](_0x2e1291,{'showHidden':![],'depth':null}):'');});};function getUser(_0x57a32c){return client['request'](_0xa77e('0xf'),{'options':{'raw':!![],'attributes':['id',_0xa77e('0x10'),_0xa77e('0x11'),_0xa77e('0x12')],'where':_0x57a32c,'limit':0x1}})[_0xa77e('0xc')](function(_0x328a3a){logger[_0xa77e('0x8')](_0xa77e('0x13'),JSON[_0xa77e('0x14')](_0x57a32c),_0x328a3a?util[_0xa77e('0x9')](_0x328a3a,{'showHidden':![],'depth':null}):'');return _0x328a3a[_0xa77e('0x15')][_0xa77e('0x16')]?_0x328a3a['result'][0x0]:null;});}exports[_0xa77e('0x17')]=function(_0x18bc5a){return new BPromise(function(_0x340a82,_0x30e890){if(_0x18bc5a){return getUser({'internal':_0x18bc5a})[_0xa77e('0xc')](function(_0x17e1c4){logger[_0xa77e('0x7')](_0xa77e('0x18'),_0x18bc5a,_0x17e1c4?_0xa77e('0x19'):_0xa77e('0x1a'));return _0x340a82(_0x17e1c4);})['catch'](function(_0x484926){logger[_0xa77e('0xa')](_0xa77e('0x1b'),_0x484926?util['inspect'](_0x484926,{'showHidden':![],'depth':null}):'');return _0x340a82(null);});}return _0x340a82(null);});};exports['getUserByInterface']=function(_0x44241a){return new BPromise(function(_0xd48a87,_0x4d7309){if(_0x44241a){return getUser({'interface':_0x44241a})['then'](function(_0x39c8be){logger['info'](_0xa77e('0x1c'),_0x44241a,_0x39c8be?_0xa77e('0x19'):_0xa77e('0x1a'));return _0xd48a87(_0x39c8be);})[_0xa77e('0xe')](function(_0x37aa55){logger[_0xa77e('0xa')](_0xa77e('0x1d'),_0x37aa55?util['inspect'](_0x37aa55,{'showHidden':![],'depth':null}):'');return _0xd48a87(null);});}return _0xd48a87(null);});};exports['getUserByName']=function(_0x321760){return new BPromise(function(_0x4b959b,_0x1c58a4){if(_0x321760){return getUser({'name':_0x321760})[_0xa77e('0xc')](function(_0x29f521){logger['info'](_0xa77e('0x1e'),_0x321760,_0x29f521?'found':_0xa77e('0x1a'));return _0x4b959b(_0x29f521);})[_0xa77e('0xe')](function(_0x377961){logger['error'](_0xa77e('0x1f'),_0x377961?util['inspect'](_0x377961,{'showHidden':![],'depth':null}):'');return _0x4b959b(null);});}return _0x4b959b(null);});};exports['getVoiceQueueByName']=function(_0x21154b){return new BPromise(function(_0x2fead2,_0x12f6a7){if(_0x21154b){return client[_0xa77e('0xb')](_0xa77e('0x20'),{'options':{'raw':!![],'attributes':['id',_0xa77e('0x11'),_0xa77e('0x21'),_0xa77e('0x22'),_0xa77e('0x23')],'where':{'name':_0x21154b},'limit':0x1}})[_0xa77e('0xc')](function(_0x42f4a7){logger[_0xa77e('0x8')](_0xa77e('0x24'),_0x21154b,_0x42f4a7?util[_0xa77e('0x9')](_0x42f4a7,{'showHidden':![],'depth':null}):'');logger[_0xa77e('0x7')](_0xa77e('0x25'),_0x21154b,_0x42f4a7?'found':_0xa77e('0x1a'));return _0x2fead2(_0x42f4a7['result'][_0xa77e('0x16')]?_0x42f4a7[_0xa77e('0x15')][0x0]:null);})[_0xa77e('0xe')](function(_0x14e3e6){logger['error'](_0xa77e('0x26'),_0x14e3e6?util[_0xa77e('0x9')](_0x14e3e6,{'showHidden':![],'depth':null}):'');return _0x2fead2(null);});}return _0x2fead2(null);});};exports[_0xa77e('0x27')]=function(_0x41ed28,_0x573850){return moment(_0x41ed28)['add'](_0x573850,_0xa77e('0x28'))['format'](_0xa77e('0x29'));};exports[_0xa77e('0x2a')]=function(_0x114805,_0x25be94){return moment(_0x114805)[_0xa77e('0x2b')](_0x25be94,'seconds')[_0xa77e('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x4e3f1a,_0x51c040){return moment(_0x4e3f1a)[_0xa77e('0x2d')](moment(_0x51c040),_0xa77e('0x28'));};exports[_0xa77e('0x2e')]=function(_0x48be4e,_0x44ff04){return parseInt(_0x48be4e,0xa)+parseInt(_0x44ff04,0xa);};exports[_0xa77e('0x2f')]=function(){return moment()['format'](_0xa77e('0x29'));};exports['isAfter']=function(_0x3f9eb3,_0x51d86c){if(_0x51d86c){return moment(_0x3f9eb3)['isAfter'](_0x51d86c);}return!![];};exports[_0xa77e('0x30')]=function(_0x1e3cff,_0x4ffcd6){if(_0x4ffcd6){return moment(_0x1e3cff)[_0xa77e('0x30')](_0x4ffcd6);}else if(_0x1e3cff){return!![];}return![];}; \ No newline at end of file +var _0x6c0f=['diff','sumTime','now','YYYY-MM-DD\x20HH:mm:ss','isAfter','isBefore','bluebird','jayson/promise','client','http','../../config/logger','xdr','info','inspect','error','request','then','debug','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','result','length','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','seconds','format','subtractTime','subtract','diffTime'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x6c0f,0x186));var _0xf6c0=function(_0x1cd565,_0x2b2d3a){_0x1cd565=_0x1cd565-0x0;var _0x5d5715=_0x6c0f[_0x1cd565];return _0x5d5715;};'use strict';var BPromise=require(_0xf6c0('0x0'));var jayson=require(_0xf6c0('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0xf6c0('0x2')][_0xf6c0('0x3')]({'port':0x2329});var logger=require(_0xf6c0('0x4'))(_0xf6c0('0x5'));exports[_0xf6c0('0x6')]=function(_0x3cb93b,_0x78554d){logger[_0xf6c0('0x6')](_0x3cb93b,_0x78554d?util[_0xf6c0('0x7')](_0x78554d,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x1b928d,_0x4d55e6){logger['debug'](_0x1b928d,_0x4d55e6?util[_0xf6c0('0x7')](_0x4d55e6,{'showHidden':![],'depth':null}):'');};exports[_0xf6c0('0x8')]=function(_0x27d781,_0x1df0d1){logger['error'](_0x27d781,_0x1df0d1?util[_0xf6c0('0x7')](_0x1df0d1,{'showHidden':![],'depth':null}):'');};exports[_0xf6c0('0x9')]=function(_0x445e9b,_0x68d9e9){return client[_0xf6c0('0x9')](_0x445e9b,{'body':_0x68d9e9})[_0xf6c0('0xa')](function(_0x4753fa){logger[_0xf6c0('0xb')](_0xf6c0('0xc'),_0x445e9b,_0x4753fa?util['inspect'](_0x4753fa,{'showHidden':![],'depth':null}):'');})[_0xf6c0('0xd')](function(_0x31132d){logger[_0xf6c0('0x8')](_0xf6c0('0xc'),_0x445e9b,_0x31132d?util['inspect'](_0x31132d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x242bba){return client[_0xf6c0('0x9')](_0xf6c0('0xe'),{'options':{'raw':!![],'attributes':['id',_0xf6c0('0xf'),_0xf6c0('0x10'),_0xf6c0('0x11')],'where':_0x242bba,'limit':0x1}})[_0xf6c0('0xa')](function(_0x2a4adc){logger[_0xf6c0('0xb')]('[utils][getUser]\x20where:%s',JSON['stringify'](_0x242bba),_0x2a4adc?util[_0xf6c0('0x7')](_0x2a4adc,{'showHidden':![],'depth':null}):'');return _0x2a4adc[_0xf6c0('0x12')][_0xf6c0('0x13')]?_0x2a4adc[_0xf6c0('0x12')][0x0]:null;});}exports[_0xf6c0('0x14')]=function(_0x1e15ef){return new BPromise(function(_0x1d8089,_0x46b9c7){if(_0x1e15ef){return getUser({'internal':_0x1e15ef})[_0xf6c0('0xa')](function(_0x3f221c){logger[_0xf6c0('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x1e15ef,_0x3f221c?_0xf6c0('0x15'):_0xf6c0('0x16'));return _0x1d8089(_0x3f221c);})['catch'](function(_0x550f55){logger[_0xf6c0('0x8')](_0xf6c0('0x17'),_0x550f55?util[_0xf6c0('0x7')](_0x550f55,{'showHidden':![],'depth':null}):'');return _0x1d8089(null);});}return _0x1d8089(null);});};exports[_0xf6c0('0x18')]=function(_0x1910e5){return new BPromise(function(_0x5e7e6c,_0x803166){if(_0x1910e5){return getUser({'interface':_0x1910e5})[_0xf6c0('0xa')](function(_0x59b4a2){logger[_0xf6c0('0x6')](_0xf6c0('0x19'),_0x1910e5,_0x59b4a2?_0xf6c0('0x15'):_0xf6c0('0x16'));return _0x5e7e6c(_0x59b4a2);})[_0xf6c0('0xd')](function(_0x27d145){logger[_0xf6c0('0x8')](_0xf6c0('0x1a'),_0x27d145?util[_0xf6c0('0x7')](_0x27d145,{'showHidden':![],'depth':null}):'');return _0x5e7e6c(null);});}return _0x5e7e6c(null);});};exports[_0xf6c0('0x1b')]=function(_0x5f14f4){return new BPromise(function(_0x39d65c,_0x1ca2bc){if(_0x5f14f4){return getUser({'name':_0x5f14f4})['then'](function(_0x1eaf69){logger[_0xf6c0('0x6')](_0xf6c0('0x1c'),_0x5f14f4,_0x1eaf69?_0xf6c0('0x15'):_0xf6c0('0x16'));return _0x39d65c(_0x1eaf69);})[_0xf6c0('0xd')](function(_0x17dc9e){logger[_0xf6c0('0x8')](_0xf6c0('0x1d'),_0x17dc9e?util[_0xf6c0('0x7')](_0x17dc9e,{'showHidden':![],'depth':null}):'');return _0x39d65c(null);});}return _0x39d65c(null);});};exports[_0xf6c0('0x1e')]=function(_0x194d23){return new BPromise(function(_0x5121f3,_0x331686){if(_0x194d23){return client[_0xf6c0('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xf6c0('0x10'),_0xf6c0('0x1f'),_0xf6c0('0x20'),_0xf6c0('0x21')],'where':{'name':_0x194d23},'limit':0x1}})[_0xf6c0('0xa')](function(_0x52c019){logger[_0xf6c0('0xb')](_0xf6c0('0x22'),_0x194d23,_0x52c019?util['inspect'](_0x52c019,{'showHidden':![],'depth':null}):'');logger[_0xf6c0('0x6')](_0xf6c0('0x23'),_0x194d23,_0x52c019?'found':_0xf6c0('0x16'));return _0x5121f3(_0x52c019[_0xf6c0('0x12')]['length']?_0x52c019['result'][0x0]:null);})[_0xf6c0('0xd')](function(_0x2a8613){logger['error'](_0xf6c0('0x24'),_0x2a8613?util['inspect'](_0x2a8613,{'showHidden':![],'depth':null}):'');return _0x5121f3(null);});}return _0x5121f3(null);});};exports['addTime']=function(_0x1535e1,_0x1031b9){return moment(_0x1535e1)['add'](_0x1031b9,_0xf6c0('0x25'))[_0xf6c0('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf6c0('0x27')]=function(_0x1b6aa7,_0x7a4174){return moment(_0x1b6aa7)[_0xf6c0('0x28')](_0x7a4174,_0xf6c0('0x25'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf6c0('0x29')]=function(_0x2b8160,_0xb16ea1){return moment(_0x2b8160)[_0xf6c0('0x2a')](moment(_0xb16ea1),_0xf6c0('0x25'));};exports[_0xf6c0('0x2b')]=function(_0x2909f1,_0x49721d){return parseInt(_0x2909f1,0xa)+parseInt(_0x49721d,0xa);};exports[_0xf6c0('0x2c')]=function(){return moment()[_0xf6c0('0x26')](_0xf6c0('0x2d'));};exports[_0xf6c0('0x2e')]=function(_0x26fa60,_0x312dea){if(_0x312dea){return moment(_0x26fa60)[_0xf6c0('0x2e')](_0x312dea);}return!![];};exports[_0xf6c0('0x2f')]=function(_0x4cd444,_0x48c0a2){if(_0x48c0a2){return moment(_0x4cd444)[_0xf6c0('0x2f')](_0x48c0a2);}else if(_0x4cd444){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 d1ca659..b319f5d 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 _0x0b13=['log','xcally','client','ensureDir','then','catch','user','timestamp','error','api','auth','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','remoteAddress','url','responseTime','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','device','other','agent_name','lodash','express-winston','path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var'];(function(_0x431d94,_0x1ef420){var _0x51900c=function(_0x27cd95){while(--_0x27cd95){_0x431d94['push'](_0x431d94['shift']());}};_0x51900c(++_0x1ef420);}(_0x0b13,0x1c3));var _0x30b1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0b13[_0x397e5f];return _0x5302b8;};var fs=require('fs-extra');var _=require(_0x30b1('0x0'));var ewinston=require(_0x30b1('0x1'));var path=require(_0x30b1('0x2'));var util=require(_0x30b1('0x3'));var fileLogger=require('./loggers')[_0x30b1('0x4')];var safeTemplate=require(_0x30b1('0x5'))[_0x30b1('0x6')];var maskSensitiveData=require(_0x30b1('0x7'))[_0x30b1('0x8')];function ClientSideLogger(){function _0x1f0cdf(_0x54b048){var _0x5259b7=path[_0x30b1('0x9')](_0x30b1('0xa'),_0x30b1('0xb'),_0x30b1('0xc'));var _0x1050a9=path['join'](_0x30b1('0xd'),_0x54b048['role']+'-'+_0x54b048['name']);return fs[_0x30b1('0xe')](path[_0x30b1('0x9')](_0x5259b7,_0x1050a9))[_0x30b1('0xf')](function(){var _0x2bec9b=fileLogger(_0x30b1('0xd'),path[_0x30b1('0x9')](_0x5259b7,_0x1050a9));return _0x2bec9b;})[_0x30b1('0x10')](function(_0x12a402){throw _0x12a402;});}this[_0x30b1('0xb')]=function(_0x487ea8,_0x3ca798,_0x138d69,_0x5cb8ed){return _0x1f0cdf(_0x487ea8['user'])[_0x30b1('0xf')](function(_0x1b9ef2){var _0x5f00fc=_0x1b9ef2[_0x3ca798];return _0x5f00fc;})['then'](function(_0x2c333c){var _0x2d2bd2=_0x487ea8[_0x30b1('0x11')]?_0x487ea8[_0x30b1('0x11')]['id']:'no-user';var _0x31167e=_0x5cb8ed['data'];var _0x294c22=_0x5cb8ed[_0x30b1('0x12')];var _0x795ecc=new Date(Number(_0x294c22));return _0x2c333c(_0x2d2bd2,_0x795ecc,_0x138d69,_0x31167e);})[_0x30b1('0x10')](function(_0x4d793c){fileLogger(_0x30b1('0xd'))[_0x30b1('0x13')](_0x4d793c);});};}function setupLoggers(_0x2b5849){return new Promise(function(_0x9a7044){var _0x1ef642=new ClientSideLogger();var _0x55b8c2=fileLogger(_0x30b1('0x14'));var _0x540fa7=fileLogger(_0x30b1('0x15'));_0x2b5849['set'](_0x30b1('0x16'),_0x1ef642);_0x2b5849['use'](ewinston[_0x30b1('0x17')]({'winstonInstance':_0x55b8c2,'meta':![],'statusLevels':!![],'msg':function(_0x2cbc75,_0x86f227){var _0x727fb6=_0x30b1('0x18');if(!_[_0x30b1('0x19')](_0x2cbc75[_0x30b1('0x1a')])){_0x727fb6+='\x20body=%s';var _0x1da6b2=_0x2cbc75[_0x30b1('0x1a')];maskSensitiveData(_0x1da6b2);}return safeTemplate(util[_0x30b1('0x1b')](_0x727fb6,_0x2cbc75[_0x30b1('0x1c')],_0x2cbc75[_0x30b1('0x1d')][_0x30b1('0x1e')]?_0x2cbc75[_0x30b1('0x1d')][_0x30b1('0x1e')]:_0x2cbc75['connection'][_0x30b1('0x1f')]||_0x2cbc75['ip'],_0x2cbc75[_0x30b1('0x20')],_0x86f227['statusCode'],_0x86f227[_0x30b1('0x21')],_0x2cbc75[_0x30b1('0x11')]?_0x2cbc75[_0x30b1('0x11')]['id']:null,_0x2cbc75['user']?_0x2cbc75[_0x30b1('0x11')][_0x30b1('0x22')]:null,_0x2cbc75[_0x30b1('0x11')]?_0x2cbc75[_0x30b1('0x11')][_0x30b1('0x23')]:null,_0x1da6b2?util[_0x30b1('0x24')](_0x1da6b2,![],null):''));}}));_0x2b5849['use'](ewinston['logger']({'winstonInstance':_0x540fa7,'meta':![],'statusLevels':!![],'msg':function(_0x5b1652,_0x564612){var _0x3c56d5=_0x30b1('0x25');if(_0x5b1652[_0x30b1('0x1a')]&&_0x5b1652[_0x30b1('0x1a')]['device']&&_0x5b1652['body']['agent_id']){_0x3c56d5=_0x30b1('0x26');}return util[_0x30b1('0x1b')](_0x3c56d5,_0x5b1652[_0x30b1('0x1c')],_0x5b1652['headers']['x-forwarded-for']?_0x5b1652[_0x30b1('0x1d')][_0x30b1('0x1e')]:_0x5b1652['connection'][_0x30b1('0x1f')]||_0x5b1652['ip'],_0x5b1652['url'],_0x564612['statusCode'],_0x564612[_0x30b1('0x21')],_0x5b1652[_0x30b1('0x11')]?_0x5b1652[_0x30b1('0x11')]['id']:null,_0x5b1652[_0x30b1('0x11')]?_0x5b1652['user'][_0x30b1('0x22')]:null,_0x5b1652[_0x30b1('0x11')]?_0x5b1652['user'][_0x30b1('0x23')]:null,_0x5b1652[_0x30b1('0x1a')]&&_0x5b1652['body'][_0x30b1('0x27')]?_0x5b1652[_0x30b1('0x1a')]['device']:_0x30b1('0x28'),_0x5b1652[_0x30b1('0x1a')]&&_0x5b1652[_0x30b1('0x1a')]['agent_id']?_0x5b1652['body']['agent_id']:'',_0x5b1652[_0x30b1('0x1a')]&&_0x5b1652['body'][_0x30b1('0x29')]?_0x5b1652[_0x30b1('0x1a')][_0x30b1('0x29')]:'');},'ignoreRoute':function(_0x941f7f){var _0x320331=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x320331['test'](_0x941f7f['url']);}}));return _0x9a7044();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x7f13=['headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','device','other','agent_id','agent_name','test','setupLoggers','fs-extra','express-winston','path','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','log','xcally','client','role','name','then','catch','user','no-user','timestamp','error','api','auth','set','use','logger','isEmpty','body','\x20body=%s'];(function(_0x337cd8,_0x5d486e){var _0xacc17b=function(_0x81063a){while(--_0x81063a){_0x337cd8['push'](_0x337cd8['shift']());}};_0xacc17b(++_0x5d486e);}(_0x7f13,0x14d));var _0x37f1=function(_0x2c039a,_0x217a31){_0x2c039a=_0x2c039a-0x0;var _0x3f398f=_0x7f13[_0x2c039a];return _0x3f398f;};var fs=require(_0x37f1('0x0'));var _=require('lodash');var ewinston=require(_0x37f1('0x1'));var path=require(_0x37f1('0x2'));var util=require('util');var fileLogger=require('./loggers')[_0x37f1('0x3')];var safeTemplate=require(_0x37f1('0x4'))[_0x37f1('0x5')];var maskSensitiveData=require(_0x37f1('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x45fe77(_0x55622c){var _0x1a9437=path[_0x37f1('0x7')]('/var',_0x37f1('0x8'),_0x37f1('0x9'));var _0xd339e0=path['join'](_0x37f1('0xa'),_0x55622c[_0x37f1('0xb')]+'-'+_0x55622c[_0x37f1('0xc')]);return fs['ensureDir'](path['join'](_0x1a9437,_0xd339e0))[_0x37f1('0xd')](function(){var _0x4a92d0=fileLogger('client',path[_0x37f1('0x7')](_0x1a9437,_0xd339e0));return _0x4a92d0;})[_0x37f1('0xe')](function(_0xb31d6f){throw _0xb31d6f;});}this[_0x37f1('0x8')]=function(_0x35af27,_0x1dfabd,_0xd6e97a,_0x20c13e){return _0x45fe77(_0x35af27[_0x37f1('0xf')])[_0x37f1('0xd')](function(_0x157799){var _0x37da21=_0x157799[_0x1dfabd];return _0x37da21;})[_0x37f1('0xd')](function(_0x36268c){var _0x595749=_0x35af27[_0x37f1('0xf')]?_0x35af27[_0x37f1('0xf')]['id']:_0x37f1('0x10');var _0x5768f2=_0x20c13e['data'];var _0x282f08=_0x20c13e[_0x37f1('0x11')];var _0x55bf02=new Date(Number(_0x282f08));return _0x36268c(_0x595749,_0x55bf02,_0xd6e97a,_0x5768f2);})[_0x37f1('0xe')](function(_0x3dfdf3){fileLogger(_0x37f1('0xa'))[_0x37f1('0x12')](_0x3dfdf3);});};}function setupLoggers(_0xa37a6a){return new Promise(function(_0x5df09b){var _0x471a24=new ClientSideLogger();var _0xe89773=fileLogger(_0x37f1('0x13'));var _0x1c3d68=fileLogger(_0x37f1('0x14'));_0xa37a6a[_0x37f1('0x15')]('client-side-logger',_0x471a24);_0xa37a6a[_0x37f1('0x16')](ewinston[_0x37f1('0x17')]({'winstonInstance':_0xe89773,'meta':![],'statusLevels':!![],'msg':function(_0x1e13a2,_0x154614){var _0x324e69='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x37f1('0x18')](_0x1e13a2[_0x37f1('0x19')])){_0x324e69+=_0x37f1('0x1a');var _0x2d0420=_0x1e13a2[_0x37f1('0x19')];maskSensitiveData(_0x2d0420);}return safeTemplate(util['format'](_0x324e69,_0x1e13a2['method'],_0x1e13a2[_0x37f1('0x1b')]['x-forwarded-for']?_0x1e13a2['headers'][_0x37f1('0x1c')]:_0x1e13a2[_0x37f1('0x1d')][_0x37f1('0x1e')]||_0x1e13a2['ip'],_0x1e13a2[_0x37f1('0x1f')],_0x154614[_0x37f1('0x20')],_0x154614[_0x37f1('0x21')],_0x1e13a2[_0x37f1('0xf')]?_0x1e13a2['user']['id']:null,_0x1e13a2[_0x37f1('0xf')]?_0x1e13a2['user'][_0x37f1('0xc')]:null,_0x1e13a2[_0x37f1('0xf')]?_0x1e13a2[_0x37f1('0xf')][_0x37f1('0xb')]:null,_0x2d0420?util[_0x37f1('0x22')](_0x2d0420,![],null):''));}}));_0xa37a6a[_0x37f1('0x16')](ewinston[_0x37f1('0x17')]({'winstonInstance':_0x1c3d68,'meta':![],'statusLevels':!![],'msg':function(_0x1909d9,_0x573916){var _0x3077ee=_0x37f1('0x23');if(_0x1909d9['body']&&_0x1909d9[_0x37f1('0x19')]['device']&&_0x1909d9[_0x37f1('0x19')]['agent_id']){_0x3077ee=_0x37f1('0x24');}return util[_0x37f1('0x25')](_0x3077ee,_0x1909d9[_0x37f1('0x26')],_0x1909d9[_0x37f1('0x1b')]['x-forwarded-for']?_0x1909d9[_0x37f1('0x1b')][_0x37f1('0x1c')]:_0x1909d9[_0x37f1('0x1d')][_0x37f1('0x1e')]||_0x1909d9['ip'],_0x1909d9['url'],_0x573916[_0x37f1('0x20')],_0x573916['responseTime'],_0x1909d9[_0x37f1('0xf')]?_0x1909d9[_0x37f1('0xf')]['id']:null,_0x1909d9[_0x37f1('0xf')]?_0x1909d9[_0x37f1('0xf')][_0x37f1('0xc')]:null,_0x1909d9[_0x37f1('0xf')]?_0x1909d9['user'][_0x37f1('0xb')]:null,_0x1909d9[_0x37f1('0x19')]&&_0x1909d9[_0x37f1('0x19')]['device']?_0x1909d9[_0x37f1('0x19')][_0x37f1('0x27')]:_0x37f1('0x28'),_0x1909d9[_0x37f1('0x19')]&&_0x1909d9[_0x37f1('0x19')][_0x37f1('0x29')]?_0x1909d9[_0x37f1('0x19')][_0x37f1('0x29')]:'',_0x1909d9[_0x37f1('0x19')]&&_0x1909d9[_0x37f1('0x19')][_0x37f1('0x2a')]?_0x1909d9['body']['agent_name']:'');},'ignoreRoute':function(_0x36eb42){var _0x46b84c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x46b84c[_0x37f1('0x2b')](_0x36eb42[_0x37f1('0x1f')]);}}));return _0x5df09b();});}exports[_0x37f1('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index c3d0233..1dd081c 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5829=['endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','min','max','domCompare','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','Interval\x20string\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','circularDoWInterval','monthsShort','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day'];(function(_0x40bb60,_0x191d52){var _0x138bc2=function(_0x458b95){while(--_0x458b95){_0x40bb60['push'](_0x40bb60['shift']());}};_0x138bc2(++_0x191d52);}(_0x5829,0xe0));var _0x9582=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x5829[_0x403c20];return _0x2b271a;};var _=require(_0x9582('0x0'));var moment=require(_0x9582('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x9582('0x2')](function(_0x470701){return _0x470701['source'];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x9582('0x3');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x15a199){if(!_0x15a199[_0x9582('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x43d8e3){var _0x282ed2=_0x43d8e3[_0x9582('0x5')](':')[_0x9582('0x2')](function(_0xd16f9d){return parseInt(_0xd16f9d,0xa);});var _0x3af145=_0x282ed2[0x0];var _0x480fad=_0x282ed2[0x1];if(_0x3af145<0x0||_0x3af145>0x17||_0x480fad<0x0||_0x480fad>0x3b){throw new Error(EINVALID_DATE);}return[_0x3af145,_0x480fad];}function circularDoWInterval(_0x95dee5,_0x3e4020){if(_0x95dee5===_0x3e4020){return[_0x95dee5];}else{var _0x471194=moment[_0x9582('0x6')]();moment[_0x9582('0x6')]('en');var _0x68ae55=moment[_0x9582('0x7')]()[_0x9582('0x2')](function(_0xfc7cbd){return _0xfc7cbd[_0x9582('0x8')]();});moment['locale'](_0x471194);var _0x561f27=_0x68ae55[_0x9582('0x9')](_0x95dee5);var _0x588ed4=_0x68ae55[_0x9582('0x9')](_0x3e4020);if(_0x588ed4>_0x561f27){return _0x68ae55[_0x9582('0xa')](_0x561f27,_0x588ed4+0x1);}else{var _0x2ade93=_0x68ae55[_0x9582('0xa')](0x0,_0x588ed4+0x1);var _0x479d75=_0x68ae55['slice'](_0x561f27);return _0x479d75[_0x9582('0xb')](_0x2ade93);}}}module['exports'][_0x9582('0xc')]=circularDoWInterval;function circularMonthInterval(_0x40f999,_0x572d60){if(_0x40f999===_0x572d60){return[_0x40f999];}else{var _0x59056a=moment[_0x9582('0x6')]();moment['locale']('en');var _0x50af60=moment[_0x9582('0xd')]()[_0x9582('0x2')](function(_0x587766){return _0x587766[_0x9582('0x8')]();});moment['locale'](_0x59056a);var _0x506742=_0x50af60[_0x9582('0x9')](_0x40f999);var _0x3edd4c=_0x50af60[_0x9582('0x9')](_0x572d60);if(_0x3edd4c>_0x506742){return _0x50af60[_0x9582('0xa')](_0x506742,_0x3edd4c+0x1);}else{var _0x1713a9=_0x50af60['slice'](0x0,_0x3edd4c+0x1);var _0xe55e6e=_0x50af60['slice'](_0x506742);return _0xe55e6e[_0x9582('0xb')](_0x1713a9);}}}module[_0x9582('0xe')][_0x9582('0xf')]=circularMonthInterval;function parseDom(_0x3e4fbc){var _0x2a0af8=parseInt(_0x3e4fbc,0xa);if(_0x2a0af8<0x1||_0x2a0af8>0x1f){throw new Error(EINVALID_DATE);}return _0x2a0af8;}function timeCompare(_0x5b9655,_0x23827d,_0x50e1f0){var _0x12877b=_0x5b9655[_0x9582('0x10')]();var _0x52341a=extractTime(_0x23827d);var _0x38850d=_0x52341a[0x0];var _0x5bf5ab=_0x52341a[0x1];var _0x5a4d0d=_0x5b9655[_0x9582('0x10')]()[_0x9582('0x11')](_0x38850d)['minutes'](_0x5bf5ab);throwIfDateNotValid(_0x5a4d0d);var _0x36ced5=extractTime(_0x50e1f0);var _0x11525f=_0x36ced5[0x0];var _0xd50b98=_0x36ced5[0x1];var _0x22eadb=_0x5b9655[_0x9582('0x10')]()[_0x9582('0x11')](_0x11525f)[_0x9582('0x12')](_0xd50b98);throwIfDateNotValid(_0x22eadb);if(_0x22eadb[_0x9582('0x13')](_0x5a4d0d)){var _0x1e60da=_0x12877b[_0x9582('0x10')]()[_0x9582('0x14')](_0x9582('0x15'));var _0x2bdf28=_0x12877b[_0x9582('0x10')]()[_0x9582('0x16')](_0x9582('0x15'));return _0x12877b['isBetween'](_0x5a4d0d,_0x2bdf28,undefined,'[]')||_0x12877b[_0x9582('0x17')](_0x1e60da,_0x22eadb,undefined,'[]');}else{return _0x12877b[_0x9582('0x17')](_0x5a4d0d,_0x22eadb,undefined,'[]');}}module[_0x9582('0xe')][_0x9582('0x18')]=timeCompare;function dowCompare(_0x4a3810,_0x490934,_0x47272f){var _0x5b1958=_0x4a3810[_0x9582('0x6')]('en')[_0x9582('0x19')](_0x9582('0x1a'))[_0x9582('0x8')]();return circularDoWInterval(_0x490934,_0x47272f)[_0x9582('0x1b')](_0x5b1958);}module[_0x9582('0xe')][_0x9582('0x1c')]=dowCompare;function domCompare(_0x177c74,_0xc2eabf,_0x13048f){var _0x4d1542=_0x177c74[_0x9582('0x1d')]();if(_0xc2eabf===_0x13048f){return _0x4d1542===_0xc2eabf;}else{var _0x3cd627=_0x177c74[_0x9582('0x1e')]();var _0x27f6e4=_0xc2eabf<_0x13048f;let _0x1f00e4=![];var _0x445a02=0x0;var _0x2aefdb=0x0;if(_0x27f6e4){_0x445a02=Math['max'](0x1,_0xc2eabf);_0x2aefdb=Math[_0x9582('0x1f')](_0x13048f,_0x3cd627);_0x1f00e4=_0x4d1542>=_0x445a02&&_0x4d1542<=_0x2aefdb;}else{_0x445a02=Math[_0x9582('0x1f')](_0xc2eabf,_0x3cd627);_0x2aefdb=Math[_0x9582('0x20')](0x1,_0x13048f);_0x1f00e4=_0x4d1542>=_0x445a02||_0x4d1542<=_0x2aefdb;}return _0x1f00e4;}}module[_0x9582('0xe')][_0x9582('0x21')]=domCompare;function monthCompare(_0x1f6b67,_0x2420f7,_0x29fe51){var _0x132086=_0x1f6b67[_0x9582('0x6')]('en')[_0x9582('0x19')]('MMM')['toLowerCase']();return circularMonthInterval(_0x2420f7,_0x29fe51)[_0x9582('0x1b')](_0x132086);}module[_0x9582('0xe')][_0x9582('0x22')]=monthCompare;function iftime(_0xc128ae,_0x135da9=moment['tz'][_0x9582('0x23')](),_0x356521=moment()){if(!validateRx[_0x9582('0x24')](_0xc128ae)){throw new Error(EINVALID_STRING);}else{var _0x2d618c=(moment[_0x9582('0x25')](_0x356521)?_0x356521[_0x9582('0x10')]():moment(_0x356521))['tz'](_0x135da9)[_0x9582('0x6')]('en');throwIfDateNotValid(_0x2d618c);var _0x2ccd4d=_0xc128ae[_0x9582('0x5')](',');var _0x44ba89=_0x2ccd4d[0x0];var _0x38aeda=_0x2ccd4d[0x1];var _0x1598bf=_0x2ccd4d[0x2];var _0x4bdbac=_0x2ccd4d[0x3];let _0x22a308=!![];if(_0x44ba89!=='*'){var _0xe1ade=_0x44ba89[_0x9582('0x5')]('-');var _0x170e7d=_[_0x9582('0x26')](_0xe1ade[0x0],0x5,'0');var _0x3a5392=_0xe1ade[_0x9582('0x27')]===0x2?_['padStart'](_0xe1ade[0x1],0x5,'0'):_0x170e7d;_0x22a308=timeCompare(_0x2d618c,_0x170e7d,_0x3a5392);}let _0x313a81=!![];if(_0x38aeda!=='*'){var _0x4c5fca=_0x38aeda[_0x9582('0x5')]('-');var _0x31bbd2=_0x4c5fca[0x0];var _0x538580=_0x4c5fca[_0x9582('0x27')]===0x2?_0x4c5fca[0x1]:_0x31bbd2;_0x313a81=dowCompare(_0x2d618c,_0x31bbd2,_0x538580);}let _0x4a2af2=!![];if(_0x1598bf!=='*'){var _0x3b595f=_0x1598bf[_0x9582('0x5')]('-');var _0x464dcf=parseDom(_0x3b595f[0x0]);var _0x4d83d4=_0x3b595f[_0x9582('0x27')]===0x2?parseDom(_0x3b595f[0x1]):_0x464dcf;_0x4a2af2=domCompare(_0x2d618c,_0x464dcf,_0x4d83d4);}let _0x5caa2e=!![];if(_0x4bdbac!=='*'){var _0x51b955=_0x4bdbac[_0x9582('0x5')]('-');var _0x57d692=_0x51b955[0x0];var _0x3568dc=_0x51b955[_0x9582('0x27')]===0x2?_0x51b955[0x1]:_0x51b955[0x0];_0x5caa2e=monthCompare(_0x2d618c,_0x57d692,_0x3568dc);}return _0x22a308&&_0x313a81&&_0x4a2af2&&_0x5caa2e;}}module[_0x9582('0xe')][_0x9582('0x28')]=iftime; \ No newline at end of file +var _0x0f7a=['daysInMonth','min','max','domCompare','MMM','includes','guess','isMoment','padStart','length','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','circularMonthInterval','clone','hours','minutes','startOf','day','endOf','isBetween','timeCompare','format','ddd'];(function(_0x19911e,_0x4ee7ce){var _0x24cfeb=function(_0x30bebc){while(--_0x30bebc){_0x19911e['push'](_0x19911e['shift']());}};_0x24cfeb(++_0x4ee7ce);}(_0x0f7a,0x114));var _0xa0f7=function(_0x3a71c7,_0x48599b){_0x3a71c7=_0x3a71c7-0x0;var _0xc8ff43=_0x0f7a[_0x3a71c7];return _0xc8ff43;};var _=require(_0xa0f7('0x0'));var moment=require(_0xa0f7('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xa0f7('0x2')](function(_0x812203){return _0x812203[_0xa0f7('0x3')];})[_0xa0f7('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xa0f7('0x5');var EINVALID_DATE=_0xa0f7('0x6');function throwIfDateNotValid(_0x527207){if(!_0x527207[_0xa0f7('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4f9eea){var _0x23015b=_0x4f9eea[_0xa0f7('0x8')](':')[_0xa0f7('0x2')](function(_0x5d0fa6){return parseInt(_0x5d0fa6,0xa);});var _0x2ee747=_0x23015b[0x0];var _0x44a236=_0x23015b[0x1];if(_0x2ee747<0x0||_0x2ee747>0x17||_0x44a236<0x0||_0x44a236>0x3b){throw new Error(EINVALID_DATE);}return[_0x2ee747,_0x44a236];}function circularDoWInterval(_0x98edd3,_0x151fa4){if(_0x98edd3===_0x151fa4){return[_0x98edd3];}else{var _0x1eb710=moment['locale']();moment[_0xa0f7('0x9')]('en');var _0x4874d4=moment[_0xa0f7('0xa')]()[_0xa0f7('0x2')](function(_0x5cdb15){return _0x5cdb15[_0xa0f7('0xb')]();});moment[_0xa0f7('0x9')](_0x1eb710);var _0x427c9b=_0x4874d4[_0xa0f7('0xc')](_0x98edd3);var _0x385a2d=_0x4874d4['indexOf'](_0x151fa4);if(_0x385a2d>_0x427c9b){return _0x4874d4[_0xa0f7('0xd')](_0x427c9b,_0x385a2d+0x1);}else{var _0x5ba9ac=_0x4874d4[_0xa0f7('0xd')](0x0,_0x385a2d+0x1);var _0x4ecc3d=_0x4874d4[_0xa0f7('0xd')](_0x427c9b);return _0x4ecc3d[_0xa0f7('0xe')](_0x5ba9ac);}}}module[_0xa0f7('0xf')][_0xa0f7('0x10')]=circularDoWInterval;function circularMonthInterval(_0x4fea3f,_0x23587e){if(_0x4fea3f===_0x23587e){return[_0x4fea3f];}else{var _0x23d286=moment[_0xa0f7('0x9')]();moment[_0xa0f7('0x9')]('en');var _0x494c94=moment['monthsShort']()[_0xa0f7('0x2')](function(_0x251bbd){return _0x251bbd[_0xa0f7('0xb')]();});moment['locale'](_0x23d286);var _0x36621e=_0x494c94[_0xa0f7('0xc')](_0x4fea3f);var _0x2f0c92=_0x494c94[_0xa0f7('0xc')](_0x23587e);if(_0x2f0c92>_0x36621e){return _0x494c94['slice'](_0x36621e,_0x2f0c92+0x1);}else{var _0x1dac8b=_0x494c94['slice'](0x0,_0x2f0c92+0x1);var _0x545e35=_0x494c94['slice'](_0x36621e);return _0x545e35[_0xa0f7('0xe')](_0x1dac8b);}}}module[_0xa0f7('0xf')][_0xa0f7('0x11')]=circularMonthInterval;function parseDom(_0x207709){var _0x3fda73=parseInt(_0x207709,0xa);if(_0x3fda73<0x1||_0x3fda73>0x1f){throw new Error(EINVALID_DATE);}return _0x3fda73;}function timeCompare(_0x42318c,_0x155cad,_0x455573){var _0x5dc19f=_0x42318c[_0xa0f7('0x12')]();var _0x1f1618=extractTime(_0x155cad);var _0x4ea4db=_0x1f1618[0x0];var _0x3a7d6f=_0x1f1618[0x1];var _0x1a3c9a=_0x42318c[_0xa0f7('0x12')]()[_0xa0f7('0x13')](_0x4ea4db)[_0xa0f7('0x14')](_0x3a7d6f);throwIfDateNotValid(_0x1a3c9a);var _0x52cd15=extractTime(_0x455573);var _0x31b7d8=_0x52cd15[0x0];var _0x11f52f=_0x52cd15[0x1];var _0x12413a=_0x42318c[_0xa0f7('0x12')]()['hours'](_0x31b7d8)[_0xa0f7('0x14')](_0x11f52f);throwIfDateNotValid(_0x12413a);if(_0x12413a['isBefore'](_0x1a3c9a)){var _0x14a10e=_0x5dc19f[_0xa0f7('0x12')]()[_0xa0f7('0x15')](_0xa0f7('0x16'));var _0x1cb782=_0x5dc19f[_0xa0f7('0x12')]()[_0xa0f7('0x17')]('day');return _0x5dc19f[_0xa0f7('0x18')](_0x1a3c9a,_0x1cb782,undefined,'[]')||_0x5dc19f[_0xa0f7('0x18')](_0x14a10e,_0x12413a,undefined,'[]');}else{return _0x5dc19f['isBetween'](_0x1a3c9a,_0x12413a,undefined,'[]');}}module[_0xa0f7('0xf')][_0xa0f7('0x19')]=timeCompare;function dowCompare(_0x30fb16,_0x2d4b2b,_0x5e5bd3){var _0x1196ac=_0x30fb16['locale']('en')[_0xa0f7('0x1a')](_0xa0f7('0x1b'))[_0xa0f7('0xb')]();return circularDoWInterval(_0x2d4b2b,_0x5e5bd3)['includes'](_0x1196ac);}module[_0xa0f7('0xf')]['dowCompare']=dowCompare;function domCompare(_0x48eb7a,_0x2465c2,_0x10c28f){var _0x269a35=_0x48eb7a['date']();if(_0x2465c2===_0x10c28f){return _0x269a35===_0x2465c2;}else{var _0x1704c1=_0x48eb7a[_0xa0f7('0x1c')]();var _0x2fb14a=_0x2465c2<_0x10c28f;let _0x577207=![];var _0x129145=0x0;var _0x59b251=0x0;if(_0x2fb14a){_0x129145=Math['max'](0x1,_0x2465c2);_0x59b251=Math[_0xa0f7('0x1d')](_0x10c28f,_0x1704c1);_0x577207=_0x269a35>=_0x129145&&_0x269a35<=_0x59b251;}else{_0x129145=Math['min'](_0x2465c2,_0x1704c1);_0x59b251=Math[_0xa0f7('0x1e')](0x1,_0x10c28f);_0x577207=_0x269a35>=_0x129145||_0x269a35<=_0x59b251;}return _0x577207;}}module[_0xa0f7('0xf')][_0xa0f7('0x1f')]=domCompare;function monthCompare(_0x160334,_0x352be8,_0x254d14){var _0x30a3d6=_0x160334['locale']('en')[_0xa0f7('0x1a')](_0xa0f7('0x20'))[_0xa0f7('0xb')]();return circularMonthInterval(_0x352be8,_0x254d14)[_0xa0f7('0x21')](_0x30a3d6);}module[_0xa0f7('0xf')]['monthCompare']=monthCompare;function iftime(_0x1b2526,_0x38f54a=moment['tz'][_0xa0f7('0x22')](),_0x107612=moment()){if(!validateRx['test'](_0x1b2526)){throw new Error(EINVALID_STRING);}else{var _0x2a08e3=(moment[_0xa0f7('0x23')](_0x107612)?_0x107612['clone']():moment(_0x107612))['tz'](_0x38f54a)[_0xa0f7('0x9')]('en');throwIfDateNotValid(_0x2a08e3);var _0x4804f5=_0x1b2526[_0xa0f7('0x8')](',');var _0x2f905e=_0x4804f5[0x0];var _0x2580ee=_0x4804f5[0x1];var _0x379cbc=_0x4804f5[0x2];var _0x5a4f6c=_0x4804f5[0x3];let _0x415a36=!![];if(_0x2f905e!=='*'){var _0x29dbb0=_0x2f905e[_0xa0f7('0x8')]('-');var _0x3d9dfa=_[_0xa0f7('0x24')](_0x29dbb0[0x0],0x5,'0');var _0xda4888=_0x29dbb0[_0xa0f7('0x25')]===0x2?_['padStart'](_0x29dbb0[0x1],0x5,'0'):_0x3d9dfa;_0x415a36=timeCompare(_0x2a08e3,_0x3d9dfa,_0xda4888);}let _0x4baf94=!![];if(_0x2580ee!=='*'){var _0x4662d9=_0x2580ee[_0xa0f7('0x8')]('-');var _0x1f02ff=_0x4662d9[0x0];var _0x4eeb79=_0x4662d9[_0xa0f7('0x25')]===0x2?_0x4662d9[0x1]:_0x1f02ff;_0x4baf94=dowCompare(_0x2a08e3,_0x1f02ff,_0x4eeb79);}let _0x224400=!![];if(_0x379cbc!=='*'){var _0x4c8a19=_0x379cbc[_0xa0f7('0x8')]('-');var _0x3cb740=parseDom(_0x4c8a19[0x0]);var _0x3ef89b=_0x4c8a19[_0xa0f7('0x25')]===0x2?parseDom(_0x4c8a19[0x1]):_0x3cb740;_0x224400=domCompare(_0x2a08e3,_0x3cb740,_0x3ef89b);}let _0x41e222=!![];if(_0x5a4f6c!=='*'){var _0x233f19=_0x5a4f6c['split']('-');var _0x598792=_0x233f19[0x0];var _0x5e8b5d=_0x233f19[_0xa0f7('0x25')]===0x2?_0x233f19[0x1]:_0x233f19[0x0];_0x41e222=monthCompare(_0x2a08e3,_0x598792,_0x5e8b5d);}return _0x415a36&&_0x4baf94&&_0x224400&&_0x41e222;}}module['exports']['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index a9c70d3..f1959c6 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdde6=['moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','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','meta','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger'];(function(_0x208d75,_0x92d742){var _0x382d27=function(_0x3aaba3){while(--_0x3aaba3){_0x208d75['push'](_0x208d75['shift']());}};_0x382d27(++_0x92d742);}(_0xdde6,0x197));var _0x6dde=function(_0x1bd29d,_0x1c7b99){_0x1bd29d=_0x1bd29d-0x0;var _0x369a87=_0xdde6[_0x1bd29d];return _0x369a87;};'use strict';var path=require('path');var util=require('util');var moment=require(_0x6dde('0x0'));var winston=require(_0x6dde('0x1'));var config=require(_0x6dde('0x2'));var debugLevel=config[_0x6dde('0x3')]?config[_0x6dde('0x3')][_0x6dde('0x4')]():_0x6dde('0x5');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':_0x6dde('0x6'),'error':_0x6dde('0x7'),'warn':_0x6dde('0x8'),'info':_0x6dde('0x9'),'print':'bold\x20white','success':_0x6dde('0xa'),'http':_0x6dde('0xb'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0x6dde('0xc')};winston[_0x6dde('0xd')](XC_LOG_COLORS);function getLogFileName(_0x1dc757,_0x2a5c3e,_0x15b2d9){var _0x5ae1d2=_0x1dc757||_0x6dde('0xe');return path[_0x6dde('0xf')](_0x5ae1d2,util['format'](_0x6dde('0x10'),_0x2a5c3e,_0x15b2d9));}function formatter(_0x442478,_0xc872c7){_0xc872c7[_0x6dde('0x11')]=_0xc872c7[_0x6dde('0x11')][_0x6dde('0x12')](/@@{/g,_0x6dde('0x13'))['replace'](/}@@/g,_0x6dde('0x14'))[_0x6dde('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x6dde('0x15')](_0x6dde('0x16'),moment()[_0x6dde('0x15')](_0x6dde('0x17')),_0xc872c7[_0x6dde('0x18')]['toUpperCase'](),_0x442478,_0xc872c7['message']);}function fileFormat(_0x160ad0,_0x5db8aa){_0x5db8aa[_0x6dde('0x11')]=_0x5db8aa[_0x6dde('0x11')][_0x6dde('0x12')](/@@{/g,'{{{')['replace'](/}@@/g,_0x6dde('0x14'))[_0x6dde('0x12')](/@{/g,'{{')[_0x6dde('0x12')](/}@/g,'}}');var _0xd2beef=_0x5db8aa[_0x6dde('0x19')]&&Object['keys'](_0x5db8aa[_0x6dde('0x19')])['length']?'\x0a\x09'+JSON[_0x6dde('0x1a')](_0x5db8aa['meta']):'';return util[_0x6dde('0x15')](_0x6dde('0x1b'),moment()[_0x6dde('0x15')](_0x6dde('0x17')),_0x5db8aa['level']['toUpperCase'](),_0x160ad0,_0x5db8aa[_0x6dde('0x11')],_0xd2beef);}function consoleLogger(){var _0x266bc6=new winston[(_0x6dde('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x6dde('0x1d'))][(_0x6dde('0x1e'))]({'level':_0x6dde('0x1f'),'json':![],'formatter':function(_0x590d5f){return formatter('',_0x590d5f);}})]});return _0x266bc6;}function fileLogger(_0x50aef1,_0x466dad){var _0x1edc0d=new winston[(_0x6dde('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x6dde('0x1d'))][(_0x6dde('0x20'))]({'name':util[_0x6dde('0x15')](_0x6dde('0x21'),_0x50aef1,_0x6dde('0x22')),'filename':getLogFileName(_0x466dad,_0x50aef1,_0x6dde('0x22')),'level':_0x6dde('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3d8ff2){return fileFormat(_0x50aef1,_0x3d8ff2);}}),new winston[(_0x6dde('0x1d'))][(_0x6dde('0x20'))]({'name':util[_0x6dde('0x15')](_0x6dde('0x21'),_0x50aef1,debugLevel),'filename':getLogFileName(_0x466dad,_0x50aef1,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xc658ff){return fileFormat(_0x50aef1,_0xc658ff);}}),new winston['transports'][(_0x6dde('0x1e'))]({'level':_0x6dde('0x1f'),'json':![],'formatter':function(_0x36a7d1){return fileFormat(_0x50aef1,_0x36a7d1);}})]});return _0x1edc0d;}exports[_0x6dde('0x23')]=consoleLogger;exports[_0x6dde('0x24')]=fileLogger; \ No newline at end of file +var _0xa5cd=['}}}','meta','keys','length','transports','Console','File','%s-%s','error','consoleLogger','path','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20white','bold\x20green','gray','bold\x20blue','addColors','/var/log/xcally','message','{{{','replace','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0xa5cd,0xea));var _0xda5c=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xa5cd[_0x5d4607];return _0x5e4a86;};'use strict';var path=require(_0xda5c('0x0'));var util=require('util');var moment=require(_0xda5c('0x1'));var winston=require('winston');var config=require(_0xda5c('0x2'));var debugLevel=config[_0xda5c('0x3')]?config[_0xda5c('0x3')][_0xda5c('0x4')]():_0xda5c('0x5');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':_0xda5c('0x6'),'error':_0xda5c('0x7'),'warn':'bold\x20yellow','info':'white','print':_0xda5c('0x8'),'success':_0xda5c('0x9'),'http':_0xda5c('0xa'),'verbose':'bold\x20magenta','debug':_0xda5c('0xb'),'silly':'bold\x20cyan'};winston[_0xda5c('0xc')](XC_LOG_COLORS);function getLogFileName(_0x11d403,_0x680302,_0x1da22e){var _0x5c1c55=_0x11d403||_0xda5c('0xd');return path['join'](_0x5c1c55,util['format']('%s-%s.log',_0x680302,_0x1da22e));}function formatter(_0x5ec0e9,_0x515974){_0x515974['message']=_0x515974[_0xda5c('0xe')]['replace'](/@@{/g,_0xda5c('0xf'))[_0xda5c('0x10')](/}@@/g,'}}}')[_0xda5c('0x10')](/@{/g,'{{')[_0xda5c('0x10')](/}@/g,'}}');return util[_0xda5c('0x11')](_0xda5c('0x12'),moment()[_0xda5c('0x11')](_0xda5c('0x13')),_0x515974[_0xda5c('0x14')][_0xda5c('0x15')](),_0x5ec0e9,_0x515974[_0xda5c('0xe')]);}function fileFormat(_0x207efc,_0x54da72){_0x54da72[_0xda5c('0xe')]=_0x54da72['message'][_0xda5c('0x10')](/@@{/g,_0xda5c('0xf'))['replace'](/}@@/g,_0xda5c('0x16'))[_0xda5c('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0xb7794c=_0x54da72[_0xda5c('0x17')]&&Object[_0xda5c('0x18')](_0x54da72[_0xda5c('0x17')])[_0xda5c('0x19')]?'\x0a\x09'+JSON['stringify'](_0x54da72[_0xda5c('0x17')]):'';return util[_0xda5c('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xda5c('0x11')](_0xda5c('0x13')),_0x54da72[_0xda5c('0x14')][_0xda5c('0x15')](),_0x207efc,_0x54da72['message'],_0xb7794c);}function consoleLogger(){var _0x40c05c=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xda5c('0x1a'))][(_0xda5c('0x1b'))]({'level':'warn','json':![],'formatter':function(_0x16208b){return formatter('',_0x16208b);}})]});return _0x40c05c;}function fileLogger(_0x4d847b,_0x343d49){var _0x2df507=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xda5c('0x1a'))][(_0xda5c('0x1c'))]({'name':util[_0xda5c('0x11')](_0xda5c('0x1d'),_0x4d847b,_0xda5c('0x1e')),'filename':getLogFileName(_0x343d49,_0x4d847b,_0xda5c('0x1e')),'level':_0xda5c('0x1e'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x56c2fd){return fileFormat(_0x4d847b,_0x56c2fd);}}),new winston['transports'][(_0xda5c('0x1c'))]({'name':util[_0xda5c('0x11')]('%s-%s',_0x4d847b,debugLevel),'filename':getLogFileName(_0x343d49,_0x4d847b,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4e4ebf){return fileFormat(_0x4d847b,_0x4e4ebf);}}),new winston['transports'][(_0xda5c('0x1b'))]({'level':'warn','json':![],'formatter':function(_0x2aa63c){return fileFormat(_0x4d847b,_0x2aa63c);}})]});return _0x2df507;}exports[_0xda5c('0x1f')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 4c9a0c1..7a424c2 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 _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x1a85,0x178));var _0x51a8=function(_0x32814c,_0x2a68f5){_0x32814c=_0x32814c-0x0;var _0x394c8d=_0x1a85[_0x32814c];return _0x394c8d;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file +var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x4179e2,_0xf2dbb){var _0x24cb50=function(_0x3b7899){while(--_0x3b7899){_0x4179e2['push'](_0x4179e2['shift']());}};_0x24cb50(++_0xf2dbb);}(_0x0295,0x1f0));var _0x5029=function(_0x3ed0ec,_0x44ece7){_0x3ed0ec=_0x3ed0ec-0x0;var _0x4b32f4=_0x0295[_0x3ed0ec];return _0x4b32f4;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index cd1b9cb..8a751dc 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 _0x757a=['isArray','map','isPlainObject','reduce','exports','safeTemplate','{\x20{\x20','string','replace'];(function(_0x23027f,_0x16aefa){var _0x44eb81=function(_0x5f5ca5){while(--_0x5f5ca5){_0x23027f['push'](_0x23027f['shift']());}};_0x44eb81(++_0x16aefa);}(_0x757a,0xde));var _0xa757=function(_0x43b89e,_0x580272){_0x43b89e=_0x43b89e-0x0;var _0x2be7a1=_0x757a[_0x43b89e];return _0x2be7a1;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x24afaf){return _0x24afaf==='{{'?_0xa757('0x0'):'\x20}\x20}';}function safeTemplate(_0x5c03c3){var _0x5709ed=_0x5c03c3;if(typeof _0x5c03c3===_0xa757('0x1')){_0x5709ed=_0x5c03c3[_0xa757('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xa757('0x3')](_0x5c03c3)){_0x5709ed=_0x5c03c3[_0xa757('0x4')](function(_0x32630d){return safeTemplate(_0x32630d);});}else if(_[_0xa757('0x5')](_0x5c03c3)){_0x5709ed=Object['keys'](_0x5c03c3)[_0xa757('0x6')](function(_0x4343b6,_0x53be0e){_0x4343b6[_0x53be0e]=safeTemplate(_0x5c03c3[_0x53be0e]);return _0x4343b6;},{});}return _0x5709ed;}module[_0xa757('0x7')][_0xa757('0x8')]=safeTemplate; \ No newline at end of file +var _0x4cf8=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','exports'];(function(_0x468552,_0x2043cb){var _0x3d4d46=function(_0x34467e){while(--_0x34467e){_0x468552['push'](_0x468552['shift']());}};_0x3d4d46(++_0x2043cb);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0x4cf8[_0x456b57];return _0x18f49f;};var _=require(_0x84cf('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2d03b6){return _0x2d03b6==='{{'?_0x84cf('0x1'):_0x84cf('0x2');}function safeTemplate(_0xae953){var _0x28455b=_0xae953;if(typeof _0xae953===_0x84cf('0x3')){_0x28455b=_0xae953[_0x84cf('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x84cf('0x5')](_0xae953)){_0x28455b=_0xae953[_0x84cf('0x6')](function(_0x5844d7){return safeTemplate(_0x5844d7);});}else if(_[_0x84cf('0x7')](_0xae953)){_0x28455b=Object['keys'](_0xae953)['reduce'](function(_0x455345,_0x56c5cc){_0x455345[_0x56c5cc]=safeTemplate(_0xae953[_0x56c5cc]);return _0x455345;},{});}return _0x28455b;}module[_0x84cf('0x8')][_0x84cf('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 223bddc..26fb6c5 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebf7=['resolve','server/app.json','isArray','apps','findIndex','name','motion2','NODE_PATH','string','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','../config/environment','root'];(function(_0x148322,_0x22fc84){var _0x22d6ff=function(_0x385b15){while(--_0x385b15){_0x148322['push'](_0x148322['shift']());}};_0x22d6ff(++_0x22fc84);}(_0xebf7,0x166));var _0x7ebf=function(_0x2c15a9,_0x50f10b){_0x2c15a9=_0x2c15a9-0x0;var _0x1ff415=_0xebf7[_0x2c15a9];return _0x1ff415;};var fs=require(_0x7ebf('0x0'));var path=require('path');var config=require(_0x7ebf('0x1'));var root=config[_0x7ebf('0x2')];var APP_JSON_PATH=path[_0x7ebf('0x3')](root,_0x7ebf('0x4'));var NODEPATH=path[_0x7ebf('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x7f7bad){let _0x340f22=![];if(Array[_0x7ebf('0x5')](_0x7f7bad['apps'])){var _0x2fe4b1=_0x7f7bad[_0x7ebf('0x6')][_0x7ebf('0x7')](function(_0x16552f){return _0x16552f[_0x7ebf('0x8')]===_0x7ebf('0x9');});if(_0x2fe4b1>-0x1){var _0x9e5a00=_0x7f7bad[_0x7ebf('0x6')][_0x2fe4b1];if(typeof _0x9e5a00['env'][_0x7ebf('0xa')]!==_0x7ebf('0xb')){_0x9e5a00['env'][_0x7ebf('0xa')]=NODEPATH;_0x340f22=!![];}}return{'appConfig':_0x7f7bad,'updated':_0x340f22};}}function updateAppConfig(_0x18470a){return fs['pathExists'](APP_JSON_PATH)[_0x7ebf('0xc')](function(_0x24ef6a){if(_0x24ef6a){return fs[_0x7ebf('0xd')](APP_JSON_PATH)[_0x7ebf('0xc')](function(_0x2bfbe4){var _0x4d3607=setLegacyLibsNodeEnvPath(_0x2bfbe4);if(_0x4d3607[_0x7ebf('0xe')]){_0x18470a[_0x7ebf('0xf')](_0x7ebf('0x10'));return fs[_0x7ebf('0x11')](APP_JSON_PATH,_0x2bfbe4,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x7ebf('0x3')]();}});}module[_0x7ebf('0x12')]=updateAppConfig; \ No newline at end of file +var _0x98cb=['Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','env','NODE_PATH','string','readJSON','then','updated','info'];(function(_0xf168fd,_0x33b8d4){var _0x105630=function(_0x5e29d7){while(--_0x5e29d7){_0xf168fd['push'](_0xf168fd['shift']());}};_0x105630(++_0x33b8d4);}(_0x98cb,0x13e));var _0xb98c=function(_0x4c0d77,_0x3b0b5d){_0x4c0d77=_0x4c0d77-0x0;var _0x5560f1=_0x98cb[_0x4c0d77];return _0x5560f1;};var fs=require(_0xb98c('0x0'));var path=require(_0xb98c('0x1'));var config=require(_0xb98c('0x2'));var root=config[_0xb98c('0x3')];var APP_JSON_PATH=path[_0xb98c('0x4')](root,_0xb98c('0x5'));var NODEPATH=path[_0xb98c('0x4')](root,_0xb98c('0x6'));function setLegacyLibsNodeEnvPath(_0x1dbca6){let _0x45d7e0=![];if(Array[_0xb98c('0x7')](_0x1dbca6[_0xb98c('0x8')])){var _0x43d8c6=_0x1dbca6['apps'][_0xb98c('0x9')](function(_0x4c8895){return _0x4c8895[_0xb98c('0xa')]==='motion2';});if(_0x43d8c6>-0x1){var _0x1a96d8=_0x1dbca6[_0xb98c('0x8')][_0x43d8c6];if(typeof _0x1a96d8[_0xb98c('0xb')][_0xb98c('0xc')]!==_0xb98c('0xd')){_0x1a96d8[_0xb98c('0xb')][_0xb98c('0xc')]=NODEPATH;_0x45d7e0=!![];}}return{'appConfig':_0x1dbca6,'updated':_0x45d7e0};}}function updateAppConfig(_0x4af353){return fs['pathExists'](APP_JSON_PATH)['then'](function(_0x1ddd3b){if(_0x1ddd3b){return fs[_0xb98c('0xe')](APP_JSON_PATH)[_0xb98c('0xf')](function(_0x2f943a){var _0x366611=setLegacyLibsNodeEnvPath(_0x2f943a);if(_0x366611[_0xb98c('0x10')]){_0x4af353[_0xb98c('0x11')](_0xb98c('0x12'));return fs[_0xb98c('0x13')](APP_JSON_PATH,_0x2f943a,{'spaces':0x2});}else{return Promise[_0xb98c('0x4')]();}});}else{return Promise['resolve']();}});}module[_0xb98c('0x14')]=updateAppConfig; \ No newline at end of file diff --git a/snippet/3.5.0/index.html b/snippet/3.5.0/index.html index f4db76c..6ef5076 100644 --- a/snippet/3.5.0/index.html +++ b/snippet/3.5.0/index.html @@ -1,85 +1,17 @@ - - - - - xCally Motion Chat - - - - - - - - -
-
- - -
-
- ")
-
- - - {{ actualTitle }} - - - - -
{{ actualTitle }} - - -
- -
-
- - -
- -
- -
- - - - - - - - -
-
- - - - - - - - - - - - - - - + " ng-click="vm.close(); $event.stopPropagation();">
\ No newline at end of file diff --git a/snippet/3.5.0/scripts/app.js b/snippet/3.5.0/scripts/app.js index 7c3a8af..210848b 100644 --- a/snippet/3.5.0/scripts/app.js +++ b/snippet/3.5.0/scripts/app.js @@ -1,42 +1,2 @@ -/*! - * ************************************************************************* - * * * - * * xCALLY Motion - The Omnichannel Contact Center * - * * Copyright (c) Xenialab s.r.l. All Rights Reserved * - * * * - * ************************************************************************* - * * * - * * Email: info@xcally.com * - * * Website: https://www.xcally.com * - * * * - * ************************************************************************* - * * * - * * The SOFTWARE PRODUCT is protected by copyright laws and international * - * * copyright treaties, as well as other intellectual property laws and * - * * treaties. The SOFTWARE PRODUCT is licensed, not sold. * - * * * - * ************************************************************************* - */ -"use strict"; -(self["webpackChunkmotion_chat"] = self["webpackChunkmotion_chat"] || []).push([["app"],{ - -/***/ "./src/styles/app.scss": -/*!*****************************!*\ - !*** ./src/styles/app.scss ***! - \*****************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -__webpack_require__.r(__webpack_exports__); -// extracted by mini-css-extract-plugin - - -/***/ }) - -}, -/******/ __webpack_require__ => { // webpackRuntimeModules -/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) -/******/ __webpack_require__.O(0, ["chat"], () => (__webpack_exec__("./src/styles/app.scss"))); -/******/ var __webpack_exports__ = __webpack_require__.O(); -/******/ } -]); -//# sourceMappingURL=app.js.map \ No newline at end of file +/*! For license information please see app.js.LICENSE.txt */ +"use strict";(self.webpackChunkmotion_chat=self.webpackChunkmotion_chat||[]).push([["app"],{"./src/styles/app.scss":()=>{}},e=>{e.O(0,["vendor","vendor-index","vendor-angular-76f2ed34","vendor-angular-58d021f3","vendor-ng-embed","vendor-moment","vendor-jquery","vendor-jquery.textcomplete","vendor-emojionearea","vendor-emojione","vendor-angular-sanitize","vendor-angular-resource","vendor-angular-messages","vendor-angular-material","vendor-angular-local-storage","vendor-angular-animate","vendor-urlMatcher","vendor-transition","vendor-stateService","vendor-stateDirectives","vendor-flow","chat"],(()=>("./src/styles/app.scss",e(e.s="./src/styles/app.scss")))),e.O()}]); \ No newline at end of file diff --git a/snippet/3.5.0/scripts/app.js.LICENSE.txt b/snippet/3.5.0/scripts/app.js.LICENSE.txt new file mode 100644 index 0000000..15c6a44 --- /dev/null +++ b/snippet/3.5.0/scripts/app.js.LICENSE.txt @@ -0,0 +1,19 @@ +/*! + * ************************************************************************* + * * * + * * xCALLY Motion - The Omnichannel Contact Center * + * * Copyright (c) Xenialab s.r.l. All Rights Reserved * + * * * + * ************************************************************************* + * * * + * * Email: info@xcally.com * + * * Website: https://www.xcally.com * + * * * + * ************************************************************************* + * * * + * * The SOFTWARE PRODUCT is protected by copyright laws and international * + * * copyright treaties, as well as other intellectual property laws and * + * * treaties. The SOFTWARE PRODUCT is licensed, not sold. * + * * * + * ************************************************************************* + */ diff --git a/snippet/3.5.0/scripts/app.js.map b/snippet/3.5.0/scripts/app.js.map deleted file mode 100644 index 9b8ff55..0000000 --- a/snippet/3.5.0/scripts/app.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scripts/app.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA","sources":["webpack://motion-chat/./src/styles/app.scss?077d"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport {};"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/snippet/3.5.0/scripts/chat.js b/snippet/3.5.0/scripts/chat.js index 399816b..49ad0c7 100644 --- a/snippet/3.5.0/scripts/chat.js +++ b/snippet/3.5.0/scripts/chat.js @@ -1,149331 +1,3 @@ -(self["webpackChunkmotion_chat"] = self["webpackChunkmotion_chat"] || []).push([["chat"],{ - -/***/ "./node_modules/@flowjs/flow.js/src/flow.js": -/*!**************************************************!*\ - !*** ./node_modules/@flowjs/flow.js/src/flow.js ***! - \**************************************************/ -/***/ ((module, exports, __webpack_require__) => { - -/* module decorator */ module = __webpack_require__.nmd(module); -var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/** - * @license MIT - */ -(function(window, document, undefined) {'use strict'; - if (!window || !document) { - console.warn('Flowjs needs window and document objects to work'); - return; - } - // ie10+ - var ie10plus = window.navigator.msPointerEnabled; - /** - * Flow.js is a library providing multiple simultaneous, stable and - * resumable uploads via the HTML5 File API. - * @param [opts] - * @param {number|Function} [opts.chunkSize] - * @param {bool} [opts.forceChunkSize] - * @param {number} [opts.simultaneousUploads] - * @param {bool} [opts.singleFile] - * @param {string} [opts.fileParameterName] - * @param {number} [opts.progressCallbacksInterval] - * @param {number} [opts.speedSmoothingFactor] - * @param {Object|Function} [opts.query] - * @param {Object|Function} [opts.headers] - * @param {bool} [opts.withCredentials] - * @param {Function} [opts.preprocess] - * @param {string} [opts.method] - * @param {string|Function} [opts.testMethod] - * @param {string|Function} [opts.uploadMethod] - * @param {bool} [opts.prioritizeFirstAndLastChunk] - * @param {bool} [opts.allowDuplicateUploads] - * @param {string|Function} [opts.target] - * @param {number} [opts.maxChunkRetries] - * @param {number} [opts.chunkRetryInterval] - * @param {Array.} [opts.permanentErrors] - * @param {Array.} [opts.successStatuses] - * @param {Function} [opts.initFileFn] - * @param {Function} [opts.readFileFn] - * @param {Function} [opts.generateUniqueIdentifier] - * @constructor - */ - function Flow(opts) { - /** - * Supported by browser? - * @type {boolean} - */ - this.support = ( - typeof File !== 'undefined' && - typeof Blob !== 'undefined' && - typeof FileList !== 'undefined' && - ( - !!Blob.prototype.slice || !!Blob.prototype.webkitSlice || !!Blob.prototype.mozSlice || - false - ) // slicing files support - ); - - if (!this.support) { - return ; - } - - /** - * Check if directory upload is supported - * @type {boolean} - */ - this.supportDirectory = ( - /Chrome/.test(window.navigator.userAgent) || - /Firefox/.test(window.navigator.userAgent) || - /Edge/.test(window.navigator.userAgent) - ); - - /** - * List of FlowFile objects - * @type {Array.} - */ - this.files = []; - - /** - * Default options for flow.js - * @type {Object} - */ - this.defaults = { - chunkSize: 1024 * 1024, - forceChunkSize: false, - simultaneousUploads: 3, - singleFile: false, - fileParameterName: 'file', - progressCallbacksInterval: 500, - speedSmoothingFactor: 0.1, - query: {}, - headers: {}, - withCredentials: false, - preprocess: null, - changeRawDataBeforeSend: null, - method: 'multipart', - testMethod: 'GET', - uploadMethod: 'POST', - prioritizeFirstAndLastChunk: false, - allowDuplicateUploads: false, - target: '/', - testChunks: true, - generateUniqueIdentifier: null, - maxChunkRetries: 0, - chunkRetryInterval: null, - permanentErrors: [404, 413, 415, 500, 501], - successStatuses: [200, 201, 202], - onDropStopPropagation: false, - initFileFn: null, - readFileFn: webAPIFileRead - }; - - /** - * Current options - * @type {Object} - */ - this.opts = {}; - - /** - * List of events: - * key stands for event name - * value array list of callbacks - * @type {} - */ - this.events = {}; - - var $ = this; - - /** - * On drop event - * @function - * @param {MouseEvent} event - */ - this.onDrop = function (event) { - if ($.opts.onDropStopPropagation) { - event.stopPropagation(); - } - event.preventDefault(); - var dataTransfer = event.dataTransfer; - if (dataTransfer.items && dataTransfer.items[0] && - dataTransfer.items[0].webkitGetAsEntry) { - $.webkitReadDataTransfer(event); - } else { - $.addFiles(dataTransfer.files, event); - } - }; - - /** - * Prevent default - * @function - * @param {MouseEvent} event - */ - this.preventEvent = function (event) { - event.preventDefault(); - }; - - - /** - * Current options - * @type {Object} - */ - this.opts = Flow.extend({}, this.defaults, opts || {}); - - } - - Flow.prototype = { - /** - * Set a callback for an event, possible events: - * fileSuccess(file), fileProgress(file), fileAdded(file, event), - * fileRemoved(file), fileRetry(file), fileError(file, message), - * complete(), progress(), error(message, file), pause() - * @function - * @param {string} event - * @param {Function} callback - */ - on: function (event, callback) { - event = event.toLowerCase(); - if (!this.events.hasOwnProperty(event)) { - this.events[event] = []; - } - this.events[event].push(callback); - }, - - /** - * Remove event callback - * @function - * @param {string} [event] removes all events if not specified - * @param {Function} [fn] removes all callbacks of event if not specified - */ - off: function (event, fn) { - if (event !== undefined) { - event = event.toLowerCase(); - if (fn !== undefined) { - if (this.events.hasOwnProperty(event)) { - arrayRemove(this.events[event], fn); - } - } else { - delete this.events[event]; - } - } else { - this.events = {}; - } - }, - - /** - * Fire an event - * @function - * @param {string} event event name - * @param {...} args arguments of a callback - * @return {bool} value is false if at least one of the event handlers which handled this event - * returned false. Otherwise it returns true. - */ - fire: function (event, args) { - // `arguments` is an object, not array, in FF, so: - args = Array.prototype.slice.call(arguments); - event = event.toLowerCase(); - var preventDefault = false; - if (this.events.hasOwnProperty(event)) { - each(this.events[event], function (callback) { - preventDefault = callback.apply(this, args.slice(1)) === false || preventDefault; - }, this); - } - if (event != 'catchall') { - args.unshift('catchAll'); - preventDefault = this.fire.apply(this, args) === false || preventDefault; - } - return !preventDefault; - }, - - /** - * Read webkit dataTransfer object - * @param event - */ - webkitReadDataTransfer: function (event) { - var $ = this; - var queue = event.dataTransfer.items.length; - var files = []; - each(event.dataTransfer.items, function (item) { - var entry = item.webkitGetAsEntry(); - if (!entry) { - decrement(); - return ; - } - if (entry.isFile) { - // due to a bug in Chrome's File System API impl - #149735 - fileReadSuccess(item.getAsFile(), entry.fullPath); - } else { - readDirectory(entry.createReader()); - } - }); - function readDirectory(reader) { - reader.readEntries(function (entries) { - if (entries.length) { - queue += entries.length; - each(entries, function(entry) { - if (entry.isFile) { - var fullPath = entry.fullPath; - entry.file(function (file) { - fileReadSuccess(file, fullPath); - }, readError); - } else if (entry.isDirectory) { - readDirectory(entry.createReader()); - } - }); - readDirectory(reader); - } else { - decrement(); - } - }, readError); - } - function fileReadSuccess(file, fullPath) { - // relative path should not start with "/" - file.relativePath = fullPath.substring(1); - files.push(file); - decrement(); - } - function readError(fileError) { - decrement(); - throw fileError; - } - function decrement() { - if (--queue == 0) { - $.addFiles(files, event); - } - } - }, - - /** - * Generate unique identifier for a file - * @function - * @param {FlowFile} file - * @returns {string} - */ - generateUniqueIdentifier: function (file) { - var custom = this.opts.generateUniqueIdentifier; - if (typeof custom === 'function') { - return custom(file); - } - // Some confusion in different versions of Firefox - var relativePath = file.relativePath || file.webkitRelativePath || file.fileName || file.name; - return file.size + '-' + relativePath.replace(/[^0-9a-zA-Z_-]/img, ''); - }, - - /** - * Upload next chunk from the queue - * @function - * @returns {boolean} - * @private - */ - uploadNextChunk: function (preventEvents) { - // In some cases (such as videos) it's really handy to upload the first - // and last chunk of a file quickly; this let's the server check the file's - // metadata and determine if there's even a point in continuing. - var found = false; - if (this.opts.prioritizeFirstAndLastChunk) { - each(this.files, function (file) { - if (!file.paused && file.chunks.length && - file.chunks[0].status() === 'pending') { - file.chunks[0].send(); - found = true; - return false; - } - if (!file.paused && file.chunks.length > 1 && - file.chunks[file.chunks.length - 1].status() === 'pending') { - file.chunks[file.chunks.length - 1].send(); - found = true; - return false; - } - }); - if (found) { - return found; - } - } - - // Now, simply look for the next, best thing to upload - each(this.files, function (file) { - if (!file.paused) { - each(file.chunks, function (chunk) { - if (chunk.status() === 'pending') { - chunk.send(); - found = true; - return false; - } - }); - } - if (found) { - return false; - } - }); - if (found) { - return true; - } - - // The are no more outstanding chunks to upload, check is everything is done - var outstanding = false; - each(this.files, function (file) { - if (!file.isComplete()) { - outstanding = true; - return false; - } - }); - if (!outstanding && !preventEvents) { - // All chunks have been uploaded, complete - async(function () { - this.fire('complete'); - }, this); - } - return false; - }, - - - /** - * Assign a browse action to one or more DOM nodes. - * @function - * @param {Element|Array.} domNodes - * @param {boolean} isDirectory Pass in true to allow directories to - * @param {boolean} singleFile prevent multi file upload - * @param {Object} attributes set custom attributes: - * http://www.w3.org/TR/html-markup/input.file.html#input.file-attributes - * eg: accept: 'image/*' - * be selected (Chrome only). - */ - assignBrowse: function (domNodes, isDirectory, singleFile, attributes) { - if (domNodes instanceof Element) { - domNodes = [domNodes]; - } - - each(domNodes, function (domNode) { - var input; - if (domNode.tagName === 'INPUT' && domNode.type === 'file') { - input = domNode; - } else { - input = document.createElement('input'); - input.setAttribute('type', 'file'); - // display:none - not working in opera 12 - extend(input.style, { - visibility: 'hidden', - position: 'absolute', - width: '1px', - height: '1px' - }); - // for opera 12 browser, input must be assigned to a document - domNode.appendChild(input); - // https://developer.mozilla.org/en/using_files_from_web_applications) - // event listener is executed two times - // first one - original mouse click event - // second - input.click(), input is inside domNode - domNode.addEventListener('click', function() { - input.click(); - }, false); - } - if (!this.opts.singleFile && !singleFile) { - input.setAttribute('multiple', 'multiple'); - } - if (isDirectory) { - input.setAttribute('webkitdirectory', 'webkitdirectory'); - } - each(attributes, function (value, key) { - input.setAttribute(key, value); - }); - // When new files are added, simply append them to the overall list - var $ = this; - input.addEventListener('change', function (e) { - if (e.target.value) { - $.addFiles(e.target.files, e); - e.target.value = ''; - } - }, false); - }, this); - }, - - /** - * Assign one or more DOM nodes as a drop target. - * @function - * @param {Element|Array.} domNodes - */ - assignDrop: function (domNodes) { - if (typeof domNodes.length === 'undefined') { - domNodes = [domNodes]; - } - each(domNodes, function (domNode) { - domNode.addEventListener('dragover', this.preventEvent, false); - domNode.addEventListener('dragenter', this.preventEvent, false); - domNode.addEventListener('drop', this.onDrop, false); - }, this); - }, - - /** - * Un-assign drop event from DOM nodes - * @function - * @param domNodes - */ - unAssignDrop: function (domNodes) { - if (typeof domNodes.length === 'undefined') { - domNodes = [domNodes]; - } - each(domNodes, function (domNode) { - domNode.removeEventListener('dragover', this.preventEvent); - domNode.removeEventListener('dragenter', this.preventEvent); - domNode.removeEventListener('drop', this.onDrop); - }, this); - }, - - /** - * Returns a boolean indicating whether or not the instance is currently - * uploading anything. - * @function - * @returns {boolean} - */ - isUploading: function () { - var uploading = false; - each(this.files, function (file) { - if (file.isUploading()) { - uploading = true; - return false; - } - }); - return uploading; - }, - - /** - * should upload next chunk - * @function - * @returns {boolean|number} - */ - _shouldUploadNext: function () { - var num = 0; - var should = true; - var simultaneousUploads = this.opts.simultaneousUploads; - each(this.files, function (file) { - each(file.chunks, function(chunk) { - if (chunk.status() === 'uploading') { - num++; - if (num >= simultaneousUploads) { - should = false; - return false; - } - } - }); - }); - // if should is true then return uploading chunks's length - return should && num; - }, - - /** - * Start or resume uploading. - * @function - */ - upload: function () { - // Make sure we don't start too many uploads at once - var ret = this._shouldUploadNext(); - if (ret === false) { - return; - } - // Kick off the queue - this.fire('uploadStart'); - var started = false; - for (var num = 1; num <= this.opts.simultaneousUploads - ret; num++) { - started = this.uploadNextChunk(true) || started; - } - if (!started) { - async(function () { - this.fire('complete'); - }, this); - } - }, - - /** - * Resume uploading. - * @function - */ - resume: function () { - each(this.files, function (file) { - if (!file.isComplete()) { - file.resume(); - } - }); - }, - - /** - * Pause uploading. - * @function - */ - pause: function () { - each(this.files, function (file) { - file.pause(); - }); - }, - - /** - * Cancel upload of all FlowFile objects and remove them from the list. - * @function - */ - cancel: function () { - for (var i = this.files.length - 1; i >= 0; i--) { - this.files[i].cancel(); - } - }, - - /** - * Returns a number between 0 and 1 indicating the current upload progress - * of all files. - * @function - * @returns {number} - */ - progress: function () { - var totalDone = 0; - var totalSize = 0; - // Resume all chunks currently being uploaded - each(this.files, function (file) { - totalDone += file.progress() * file.size; - totalSize += file.size; - }); - return totalSize > 0 ? totalDone / totalSize : 0; - }, - - /** - * Add a HTML5 File object to the list of files. - * @function - * @param {File} file - * @param {Event} [event] event is optional - */ - addFile: function (file, event) { - this.addFiles([file], event); - }, - - /** - * Add a HTML5 File object to the list of files. - * @function - * @param {FileList|Array} fileList - * @param {Event} [event] event is optional - */ - addFiles: function (fileList, event) { - var files = []; - each(fileList, function (file) { - // https://github.com/flowjs/flow.js/issues/55 - if ((!ie10plus || ie10plus && file.size > 0) && !(file.size % 4096 === 0 && (file.name === '.' || file.fileName === '.'))) { - var uniqueIdentifier = this.generateUniqueIdentifier(file); - if (this.opts.allowDuplicateUploads || !this.getFromUniqueIdentifier(uniqueIdentifier)) { - var f = new FlowFile(this, file, uniqueIdentifier); - if (this.fire('fileAdded', f, event)) { - files.push(f); - } - } - } - }, this); - if (this.fire('filesAdded', files, event)) { - each(files, function (file) { - if (this.opts.singleFile && this.files.length > 0) { - this.removeFile(this.files[0]); - } - this.files.push(file); - }, this); - this.fire('filesSubmitted', files, event); - } - }, - - - /** - * Cancel upload of a specific FlowFile object from the list. - * @function - * @param {FlowFile} file - */ - removeFile: function (file) { - for (var i = this.files.length - 1; i >= 0; i--) { - if (this.files[i] === file) { - this.files.splice(i, 1); - file.abort(); - this.fire('fileRemoved', file); - } - } - }, - - /** - * Look up a FlowFile object by its unique identifier. - * @function - * @param {string} uniqueIdentifier - * @returns {boolean|FlowFile} false if file was not found - */ - getFromUniqueIdentifier: function (uniqueIdentifier) { - var ret = false; - each(this.files, function (file) { - if (file.uniqueIdentifier === uniqueIdentifier) { - ret = file; - } - }); - return ret; - }, - - /** - * Returns the total size of all files in bytes. - * @function - * @returns {number} - */ - getSize: function () { - var totalSize = 0; - each(this.files, function (file) { - totalSize += file.size; - }); - return totalSize; - }, - - /** - * Returns the total size uploaded of all files in bytes. - * @function - * @returns {number} - */ - sizeUploaded: function () { - var size = 0; - each(this.files, function (file) { - size += file.sizeUploaded(); - }); - return size; - }, - - /** - * Returns remaining time to upload all files in seconds. Accuracy is based on average speed. - * If speed is zero, time remaining will be equal to positive infinity `Number.POSITIVE_INFINITY` - * @function - * @returns {number} - */ - timeRemaining: function () { - var sizeDelta = 0; - var averageSpeed = 0; - each(this.files, function (file) { - if (!file.paused && !file.error) { - sizeDelta += file.size - file.sizeUploaded(); - averageSpeed += file.averageSpeed; - } - }); - if (sizeDelta && !averageSpeed) { - return Number.POSITIVE_INFINITY; - } - if (!sizeDelta && !averageSpeed) { - return 0; - } - return Math.floor(sizeDelta / averageSpeed); - } - }; - - - - - - - /** - * FlowFile class - * @name FlowFile - * @param {Flow} flowObj - * @param {File} file - * @param {string} uniqueIdentifier - * @constructor - */ - function FlowFile(flowObj, file, uniqueIdentifier) { - - /** - * Reference to parent Flow instance - * @type {Flow} - */ - this.flowObj = flowObj; - - /** - * Used to store the bytes read - * @type {Blob|string} - */ - this.bytes = null; - - /** - * Reference to file - * @type {File} - */ - this.file = file; - - /** - * File name. Some confusion in different versions of Firefox - * @type {string} - */ - this.name = file.fileName || file.name; - - /** - * File size - * @type {number} - */ - this.size = file.size; - - /** - * Relative file path - * @type {string} - */ - this.relativePath = file.relativePath || file.webkitRelativePath || this.name; - - /** - * File unique identifier - * @type {string} - */ - this.uniqueIdentifier = (uniqueIdentifier === undefined ? flowObj.generateUniqueIdentifier(file) : uniqueIdentifier); - - /** - * Size of Each Chunk - * @type {number} - */ - this.chunkSize = 0; - - /** - * List of chunks - * @type {Array.} - */ - this.chunks = []; - - /** - * Indicated if file is paused - * @type {boolean} - */ - this.paused = false; - - /** - * Indicated if file has encountered an error - * @type {boolean} - */ - this.error = false; - - /** - * Average upload speed - * @type {number} - */ - this.averageSpeed = 0; - - /** - * Current upload speed - * @type {number} - */ - this.currentSpeed = 0; - - /** - * Date then progress was called last time - * @type {number} - * @private - */ - this._lastProgressCallback = Date.now(); - - /** - * Previously uploaded file size - * @type {number} - * @private - */ - this._prevUploadedSize = 0; - - /** - * Holds previous progress - * @type {number} - * @private - */ - this._prevProgress = 0; - - this.bootstrap(); - } - - FlowFile.prototype = { - /** - * Update speed parameters - * @link http://stackoverflow.com/questions/2779600/how-to-estimate-download-time-remaining-accurately - * @function - */ - measureSpeed: function () { - var timeSpan = Date.now() - this._lastProgressCallback; - if (!timeSpan) { - return ; - } - var smoothingFactor = this.flowObj.opts.speedSmoothingFactor; - var uploaded = this.sizeUploaded(); - // Prevent negative upload speed after file upload resume - this.currentSpeed = Math.max((uploaded - this._prevUploadedSize) / timeSpan * 1000, 0); - this.averageSpeed = smoothingFactor * this.currentSpeed + (1 - smoothingFactor) * this.averageSpeed; - this._prevUploadedSize = uploaded; - }, - - /** - * For internal usage only. - * Callback when something happens within the chunk. - * @function - * @param {FlowChunk} chunk - * @param {string} event can be 'progress', 'success', 'error' or 'retry' - * @param {string} [message] - */ - chunkEvent: function (chunk, event, message) { - switch (event) { - case 'progress': - if (Date.now() - this._lastProgressCallback < - this.flowObj.opts.progressCallbacksInterval) { - break; - } - this.measureSpeed(); - this.flowObj.fire('fileProgress', this, chunk); - this.flowObj.fire('progress'); - this._lastProgressCallback = Date.now(); - break; - case 'error': - this.error = true; - this.abort(true); - this.flowObj.fire('fileError', this, message, chunk); - this.flowObj.fire('error', message, this, chunk); - break; - case 'success': - if (this.error) { - return; - } - this.measureSpeed(); - this.flowObj.fire('fileProgress', this, chunk); - this.flowObj.fire('progress'); - this._lastProgressCallback = Date.now(); - if (this.isComplete()) { - this.currentSpeed = 0; - this.averageSpeed = 0; - this.flowObj.fire('fileSuccess', this, message, chunk); - } - break; - case 'retry': - this.flowObj.fire('fileRetry', this, chunk); - break; - } - }, - - /** - * Pause file upload - * @function - */ - pause: function() { - this.paused = true; - this.abort(); - }, - - /** - * Resume file upload - * @function - */ - resume: function() { - this.paused = false; - this.flowObj.upload(); - }, - - /** - * Abort current upload - * @function - */ - abort: function (reset) { - this.currentSpeed = 0; - this.averageSpeed = 0; - var chunks = this.chunks; - if (reset) { - this.chunks = []; - } - each(chunks, function (c) { - if (c.status() === 'uploading') { - c.abort(); - this.flowObj.uploadNextChunk(); - } - }, this); - }, - - /** - * Cancel current upload and remove from a list - * @function - */ - cancel: function () { - this.flowObj.removeFile(this); - }, - - /** - * Retry aborted file upload - * @function - */ - retry: function () { - this.bootstrap(); - this.flowObj.upload(); - }, - - /** - * Clear current chunks and slice file again - * @function - */ - bootstrap: function () { - if (typeof this.flowObj.opts.initFileFn === "function") { - this.flowObj.opts.initFileFn(this); - } - - this.abort(true); - this.error = false; - // Rebuild stack of chunks from file - this._prevProgress = 0; - var round = this.flowObj.opts.forceChunkSize ? Math.ceil : Math.floor; - this.chunkSize = evalOpts(this.flowObj.opts.chunkSize, this); - var chunks = Math.max( - round(this.size / this.chunkSize), 1 - ); - for (var offset = 0; offset < chunks; offset++) { - this.chunks.push( - new FlowChunk(this.flowObj, this, offset) - ); - } - }, - - /** - * Get current upload progress status - * @function - * @returns {number} from 0 to 1 - */ - progress: function () { - if (this.error) { - return 1; - } - if (this.chunks.length === 1) { - this._prevProgress = Math.max(this._prevProgress, this.chunks[0].progress()); - return this._prevProgress; - } - // Sum up progress across everything - var bytesLoaded = 0; - each(this.chunks, function (c) { - // get chunk progress relative to entire file - bytesLoaded += c.progress() * (c.endByte - c.startByte); - }); - var percent = bytesLoaded / this.size; - // We don't want to lose percentages when an upload is paused - this._prevProgress = Math.max(this._prevProgress, percent > 0.9999 ? 1 : percent); - return this._prevProgress; - }, - - /** - * Indicates if file is being uploaded at the moment - * @function - * @returns {boolean} - */ - isUploading: function () { - var uploading = false; - each(this.chunks, function (chunk) { - if (chunk.status() === 'uploading') { - uploading = true; - return false; - } - }); - return uploading; - }, - - /** - * Indicates if file is has finished uploading and received a response - * @function - * @returns {boolean} - */ - isComplete: function () { - var outstanding = false; - each(this.chunks, function (chunk) { - var status = chunk.status(); - if (status === 'pending' || status === 'uploading' || status === 'reading' || chunk.preprocessState === 1 || chunk.readState === 1) { - outstanding = true; - return false; - } - }); - return !outstanding; - }, - - /** - * Count total size uploaded - * @function - * @returns {number} - */ - sizeUploaded: function () { - var size = 0; - each(this.chunks, function (chunk) { - size += chunk.sizeUploaded(); - }); - return size; - }, - - /** - * Returns remaining time to finish upload file in seconds. Accuracy is based on average speed. - * If speed is zero, time remaining will be equal to positive infinity `Number.POSITIVE_INFINITY` - * @function - * @returns {number} - */ - timeRemaining: function () { - if (this.paused || this.error) { - return 0; - } - var delta = this.size - this.sizeUploaded(); - if (delta && !this.averageSpeed) { - return Number.POSITIVE_INFINITY; - } - if (!delta && !this.averageSpeed) { - return 0; - } - return Math.floor(delta / this.averageSpeed); - }, - - /** - * Get file type - * @function - * @returns {string} - */ - getType: function () { - return this.file.type && this.file.type.split('/')[1]; - }, - - /** - * Get file extension - * @function - * @returns {string} - */ - getExtension: function () { - return this.name.substr((~-this.name.lastIndexOf(".") >>> 0) + 2).toLowerCase(); - } - }; - - /** - * Default read function using the webAPI - * - * @function webAPIFileRead(fileObj, startByte, endByte, fileType, chunk) - * - */ - function webAPIFileRead(fileObj, startByte, endByte, fileType, chunk) { - var function_name = 'slice'; - - if (fileObj.file.slice) - function_name = 'slice'; - else if (fileObj.file.mozSlice) - function_name = 'mozSlice'; - else if (fileObj.file.webkitSlice) - function_name = 'webkitSlice'; - - chunk.readFinished(fileObj.file[function_name](startByte, endByte, fileType)); - } - - - /** - * Class for storing a single chunk - * @name FlowChunk - * @param {Flow} flowObj - * @param {FlowFile} fileObj - * @param {number} offset - * @constructor - */ - function FlowChunk(flowObj, fileObj, offset) { - - /** - * Reference to parent flow object - * @type {Flow} - */ - this.flowObj = flowObj; - - /** - * Reference to parent FlowFile object - * @type {FlowFile} - */ - this.fileObj = fileObj; - - /** - * File offset - * @type {number} - */ - this.offset = offset; - - /** - * Indicates if chunk existence was checked on the server - * @type {boolean} - */ - this.tested = false; - - /** - * Number of retries performed - * @type {number} - */ - this.retries = 0; - - /** - * Pending retry - * @type {boolean} - */ - this.pendingRetry = false; - - /** - * Preprocess state - * @type {number} 0 = unprocessed, 1 = processing, 2 = finished - */ - this.preprocessState = 0; - - /** - * Read state - * @type {number} 0 = not read, 1 = reading, 2 = finished - */ - this.readState = 0; - - - /** - * Bytes transferred from total request size - * @type {number} - */ - this.loaded = 0; - - /** - * Total request size - * @type {number} - */ - this.total = 0; - - /** - * Size of a chunk - * @type {number} - */ - this.chunkSize = this.fileObj.chunkSize; - - /** - * Chunk start byte in a file - * @type {number} - */ - this.startByte = this.offset * this.chunkSize; - - /** - * A specific filename for this chunk which otherwise default to the main name - * @type {string} - */ - this.filename = null; - - /** - * Compute the endbyte in a file - * - */ - this.computeEndByte = function() { - var endByte = Math.min(this.fileObj.size, (this.offset + 1) * this.chunkSize); - if (this.fileObj.size - endByte < this.chunkSize && !this.flowObj.opts.forceChunkSize) { - // The last chunk will be bigger than the chunk size, - // but less than 2 * this.chunkSize - endByte = this.fileObj.size; - } - return endByte; - } - - /** - * Chunk end byte in a file - * @type {number} - */ - this.endByte = this.computeEndByte(); - - /** - * XMLHttpRequest - * @type {XMLHttpRequest} - */ - this.xhr = null; - - var $ = this; - - /** - * Send chunk event - * @param event - * @param {...} args arguments of a callback - */ - this.event = function (event, args) { - args = Array.prototype.slice.call(arguments); - args.unshift($); - $.fileObj.chunkEvent.apply($.fileObj, args); - }; - /** - * Catch progress event - * @param {ProgressEvent} event - */ - this.progressHandler = function(event) { - if (event.lengthComputable) { - $.loaded = event.loaded ; - $.total = event.total; - } - $.event('progress', event); - }; - - /** - * Catch test event - * @param {Event} event - */ - this.testHandler = function(event) { - var status = $.status(true); - if (status === 'error') { - $.event(status, $.message()); - $.flowObj.uploadNextChunk(); - } else if (status === 'success') { - $.tested = true; - $.event(status, $.message()); - $.flowObj.uploadNextChunk(); - } else if (!$.fileObj.paused) { - // Error might be caused by file pause method - // Chunks does not exist on the server side - $.tested = true; - $.send(); - } - }; - - /** - * Upload has stopped - * @param {Event} event - */ - this.doneHandler = function(event) { - var status = $.status(); - if (status === 'success' || status === 'error') { - delete this.data; - $.event(status, $.message()); - $.flowObj.uploadNextChunk(); - } else if (!$.fileObj.paused) { - $.event('retry', $.message()); - $.pendingRetry = true; - $.abort(); - $.retries++; - var retryInterval = $.flowObj.opts.chunkRetryInterval; - if (retryInterval !== null) { - setTimeout(function () { - $.send(); - }, retryInterval); - } else { - $.send(); - } - } - }; - } - - FlowChunk.prototype = { - /** - * Get params for a request - * @function - */ - getParams: function () { - return { - flowChunkNumber: this.offset + 1, - flowChunkSize: this.chunkSize, - flowCurrentChunkSize: this.endByte - this.startByte, - flowTotalSize: this.fileObj.size, - flowIdentifier: this.fileObj.uniqueIdentifier, - flowFilename: this.fileObj.name, - flowRelativePath: this.fileObj.relativePath, - flowTotalChunks: this.fileObj.chunks.length - }; - }, - - /** - * Get target option with query params - * @function - * @param params - * @returns {string} - */ - getTarget: function(target, params){ - if (params.length == 0) { - return target; - } - - if(target.indexOf('?') < 0) { - target += '?'; - } else { - target += '&'; - } - return target + params.join('&'); - }, - - /** - * Makes a GET request without any data to see if the chunk has already - * been uploaded in a previous session - * @function - */ - test: function () { - // Set up request and listen for event - this.xhr = new XMLHttpRequest(); - this.xhr.addEventListener("load", this.testHandler, false); - this.xhr.addEventListener("error", this.testHandler, false); - var testMethod = evalOpts(this.flowObj.opts.testMethod, this.fileObj, this); - var data = this.prepareXhrRequest(testMethod, true); - this.xhr.send(data); - }, - - /** - * Finish preprocess state - * @function - */ - preprocessFinished: function () { - // Re-compute the endByte after the preprocess function to allow an - // implementer of preprocess to set the fileObj size - this.endByte = this.computeEndByte(); - - this.preprocessState = 2; - this.send(); - }, - - /** - * Finish read state - * @function - */ - readFinished: function (bytes) { - this.readState = 2; - this.bytes = bytes; - this.send(); - }, - - - /** - * Uploads the actual data in a POST call - * @function - */ - send: function () { - var preprocess = this.flowObj.opts.preprocess; - var read = this.flowObj.opts.readFileFn; - if (typeof preprocess === 'function') { - switch (this.preprocessState) { - case 0: - this.preprocessState = 1; - preprocess(this); - return; - case 1: - return; - } - } - switch (this.readState) { - case 0: - this.readState = 1; - read(this.fileObj, this.startByte, this.endByte, this.fileObj.file.type, this); - return; - case 1: - return; - } - if (this.flowObj.opts.testChunks && !this.tested) { - this.test(); - return; - } - - this.loaded = 0; - this.total = 0; - this.pendingRetry = false; - - // Set up request and listen for event - this.xhr = new XMLHttpRequest(); - this.xhr.upload.addEventListener('progress', this.progressHandler, false); - this.xhr.addEventListener("load", this.doneHandler, false); - this.xhr.addEventListener("error", this.doneHandler, false); - - var uploadMethod = evalOpts(this.flowObj.opts.uploadMethod, this.fileObj, this); - var data = this.prepareXhrRequest(uploadMethod, false, this.flowObj.opts.method, this.bytes); - var changeRawDataBeforeSend = this.flowObj.opts.changeRawDataBeforeSend; - if (typeof changeRawDataBeforeSend === 'function') { - data = changeRawDataBeforeSend(this, data); - } - this.xhr.send(data); - }, - - /** - * Abort current xhr request - * @function - */ - abort: function () { - // Abort and reset - var xhr = this.xhr; - this.xhr = null; - if (xhr) { - xhr.abort(); - } - }, - - /** - * Retrieve current chunk upload status - * @function - * @returns {string} 'pending', 'uploading', 'success', 'error' - */ - status: function (isTest) { - if (this.readState === 1) { - return 'reading'; - } else if (this.pendingRetry || this.preprocessState === 1) { - // if pending retry then that's effectively the same as actively uploading, - // there might just be a slight delay before the retry starts - return 'uploading'; - } else if (!this.xhr) { - return 'pending'; - } else if (this.xhr.readyState < 4) { - // Status is really 'OPENED', 'HEADERS_RECEIVED' - // or 'LOADING' - meaning that stuff is happening - return 'uploading'; - } else { - if (this.flowObj.opts.successStatuses.indexOf(this.xhr.status) > -1) { - // HTTP 200, perfect - // HTTP 202 Accepted - The request has been accepted for processing, but the processing has not been completed. - return 'success'; - } else if (this.flowObj.opts.permanentErrors.indexOf(this.xhr.status) > -1 || - !isTest && this.retries >= this.flowObj.opts.maxChunkRetries) { - // HTTP 413/415/500/501, permanent error - return 'error'; - } else { - // this should never happen, but we'll reset and queue a retry - // a likely case for this would be 503 service unavailable - this.abort(); - return 'pending'; - } - } - }, - - /** - * Get response from xhr request - * @function - * @returns {String} - */ - message: function () { - return this.xhr ? this.xhr.responseText : ''; - }, - - /** - * Get upload progress - * @function - * @returns {number} - */ - progress: function () { - if (this.pendingRetry) { - return 0; - } - var s = this.status(); - if (s === 'success' || s === 'error') { - return 1; - } else if (s === 'pending') { - return 0; - } else { - return this.total > 0 ? this.loaded / this.total : 0; - } - }, - - /** - * Count total size uploaded - * @function - * @returns {number} - */ - sizeUploaded: function () { - var size = this.endByte - this.startByte; - // can't return only chunk.loaded value, because it is bigger than chunk size - if (this.status() !== 'success') { - size = this.progress() * size; - } - return size; - }, - - /** - * Prepare Xhr request. Set query, headers and data - * @param {string} method GET or POST - * @param {bool} isTest is this a test request - * @param {string} [paramsMethod] octet or form - * @param {Blob} [blob] to send - * @returns {FormData|Blob|Null} data to send - */ - prepareXhrRequest: function(method, isTest, paramsMethod, blob) { - // Add data from the query options - var query = evalOpts(this.flowObj.opts.query, this.fileObj, this, isTest); - query = extend(query || {}, this.getParams()); - - var target = evalOpts(this.flowObj.opts.target, this.fileObj, this, isTest); - var data = null; - if (method === 'GET' || paramsMethod === 'octet') { - // Add data from the query options - var params = []; - each(query, function (v, k) { - params.push([encodeURIComponent(k), encodeURIComponent(v)].join('=')); - }); - target = this.getTarget(target, params); - data = blob || null; - } else { - // Add data from the query options - data = new FormData(); - each(query, function (v, k) { - data.append(k, v); - }); - if (typeof blob !== "undefined") { - data.append(this.flowObj.opts.fileParameterName, blob, this.filename || this.fileObj.file.name); - } - } - - this.xhr.open(method, target, true); - this.xhr.withCredentials = this.flowObj.opts.withCredentials; - - // Add data from header options - each(evalOpts(this.flowObj.opts.headers, this.fileObj, this, isTest), function (v, k) { - this.xhr.setRequestHeader(k, v); - }, this); - - return data; - } - }; - - /** - * Remove value from array - * @param array - * @param value - */ - function arrayRemove(array, value) { - var index = array.indexOf(value); - if (index > -1) { - array.splice(index, 1); - } - } - - /** - * If option is a function, evaluate it with given params - * @param {*} data - * @param {...} args arguments of a callback - * @returns {*} - */ - function evalOpts(data, args) { - if (typeof data === "function") { - // `arguments` is an object, not array, in FF, so: - args = Array.prototype.slice.call(arguments); - data = data.apply(null, args.slice(1)); - } - return data; - } - Flow.evalOpts = evalOpts; - - /** - * Execute function asynchronously - * @param fn - * @param context - */ - function async(fn, context) { - setTimeout(fn.bind(context), 0); - } - - /** - * Extends the destination object `dst` by copying all of the properties from - * the `src` object(s) to `dst`. You can specify multiple `src` objects. - * @function - * @param {Object} dst Destination object. - * @param {...Object} src Source object(s). - * @returns {Object} Reference to `dst`. - */ - function extend(dst, src) { - each(arguments, function(obj) { - if (obj !== dst) { - each(obj, function(value, key){ - dst[key] = value; - }); - } - }); - return dst; - } - Flow.extend = extend; - - /** - * Iterate each element of an object - * @function - * @param {Array|Object} obj object or an array to iterate - * @param {Function} callback first argument is a value and second is a key. - * @param {Object=} context Object to become context (`this`) for the iterator function. - */ - function each(obj, callback, context) { - if (!obj) { - return ; - } - var key; - // Is Array? - // Array.isArray won't work, not only arrays can be iterated by index https://github.com/flowjs/ng-flow/issues/236# - if (typeof(obj.length) !== 'undefined') { - for (key = 0; key < obj.length; key++) { - if (callback.call(context, obj[key], key) === false) { - return ; - } - } - } else { - for (key in obj) { - if (obj.hasOwnProperty(key) && callback.call(context, obj[key], key) === false) { - return ; - } - } - } - } - Flow.each = each; - - /** - * FlowFile constructor - * @type {FlowFile} - */ - Flow.FlowFile = FlowFile; - - /** - * FlowFile constructor - * @type {FlowChunk} - */ - Flow.FlowChunk = FlowChunk; - - /** - * Library version - * @type {string} - */ - Flow.version = '<%= version %>'; - - if ( true && module && typeof module.exports === "object" ) { - // Expose Flow as module.exports in loaders that implement the Node - // module pattern (including browserify). Do not create the global, since - // the user will be storing it themselves locally, and globals are frowned - // upon in the Node module world. - module.exports = Flow; - } else { - // Otherwise expose Flow to the global object as usual - window.Flow = Flow; - - // Register as a named AMD module, since Flow can be concatenated with other - // files that may use define, but not via a proper concatenation script that - // understands anonymous AMD modules. A named AMD is safest and most robust - // way to register. Lowercase flow is used because AMD module names are - // derived from file names, and Flow is normally delivered in a lowercase - // file name. Do this after creating the global so that if an AMD module wants - // to call noConflict to hide this version of Flow, it will work. - if ( true ) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { return Flow; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } - } -})(typeof window !== 'undefined' && window, typeof document !== 'undefined' && document); - - -/***/ }), - -/***/ "./node_modules/@flowjs/ng-flow/dist/ng-flow.js": -/*!******************************************************!*\ - !*** ./node_modules/@flowjs/ng-flow/dist/ng-flow.js ***! - \******************************************************/ -/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - -/* provided dependency */ var Flow = __webpack_require__(/*! @flowjs/flow.js */ "./node_modules/@flowjs/flow.js/src/flow.js"); -/** - * @description - * var app = angular.module('App', ['flow.provider'], function(flowFactoryProvider){ - * flowFactoryProvider.defaults = {target: '/'}; - * }); - * @name flowFactoryProvider - */ -angular.module('flow.provider', []) -.provider('flowFactory', function() { - 'use strict'; - /** - * Define the default properties for flow.js - * @name flowFactoryProvider.defaults - * @type {Object} - */ - this.defaults = {}; - - /** - * Flow, MaybeFlow or NotFlow - * @name flowFactoryProvider.factory - * @type {function} - * @return {Flow} - */ - this.factory = function (options) { - return new Flow(options); - }; - - /** - * Define the default events - * @name flowFactoryProvider.events - * @type {Array} - * @private - */ - this.events = []; - - /** - * Add default events - * @name flowFactoryProvider.on - * @function - * @param {string} event - * @param {Function} callback - */ - this.on = function (event, callback) { - this.events.push([event, callback]); - }; - - this.$get = function() { - var fn = this.factory; - var defaults = this.defaults; - var events = this.events; - return { - 'create': function(opts) { - // combine default options with global options and options - var flow = fn(angular.extend({}, defaults, opts)); - angular.forEach(events, function (event) { - flow.on(event[0], event[1]); - }); - return flow; - } - }; - }; -}); -angular.module('flow.init', ['flow.provider']) - .controller('flowCtrl', ['$scope', '$attrs', '$parse', 'flowFactory', - function ($scope, $attrs, $parse, flowFactory) { - - var options = angular.extend({}, $scope.$eval($attrs.flowInit)); - - // use existing flow object or create a new one - var flow = $scope.$eval($attrs.flowObject) || flowFactory.create(options); - - var catchAllHandler = function(eventName){ - var args = Array.prototype.slice.call(arguments); - args.shift(); - var event = $scope.$broadcast.apply($scope, ['flow::' + eventName, flow].concat(args)); - if ({ - 'progress':1, 'filesSubmitted':1, 'fileSuccess': 1, 'fileError': 1, 'complete': 1 - }[eventName]) { - $scope.$applyAsync(); - } - if (event.defaultPrevented) { - return false; - } - }; - - flow.on('catchAll', catchAllHandler); - $scope.$on('$destroy', function(){ - flow.off('catchAll', catchAllHandler); - }); - - $scope.$flow = flow; - - if ($attrs.hasOwnProperty('flowName')) { - $parse($attrs.flowName).assign($scope, flow); - $scope.$on('$destroy', function () { - $parse($attrs.flowName).assign($scope); - }); - } - }]) - .directive('flowInit', [function() { - return { - scope: true, - controller: 'flowCtrl' - }; - }]); -angular.module('flow.btn', ['flow.init']) -.directive('flowBtn', [function() { - return { - 'restrict': 'EA', - 'scope': false, - 'require': '^flowInit', - 'link': function(scope, element, attrs) { - var isDirectory = attrs.hasOwnProperty('flowDirectory'); - var isSingleFile = attrs.hasOwnProperty('flowSingleFile'); - var inputAttrs = attrs.hasOwnProperty('flowAttrs') && scope.$eval(attrs.flowAttrs); - scope.$flow.assignBrowse(element, isDirectory, isSingleFile, inputAttrs); - } - }; -}]); -angular.module('flow.dragEvents', ['flow.init']) -/** - * @name flowPreventDrop - * Prevent loading files then dropped on element - */ - .directive('flowPreventDrop', function() { - return { - 'scope': false, - 'link': function(scope, element, attrs) { - element.bind('drop dragover', function (event) { - event.preventDefault(); - }); - } - }; - }) -/** - * @name flowDragEnter - * executes `flowDragEnter` and `flowDragLeave` events - */ - .directive('flowDragEnter', ['$timeout', function($timeout) { - return { - 'scope': false, - 'link': function(scope, element, attrs) { - var promise; - var enter = false; - element.bind('dragover', function (event) { - if (!isFileDrag(event)) { - return ; - } - if (!enter) { - scope.$apply(attrs.flowDragEnter); - enter = true; - } - $timeout.cancel(promise); - event.preventDefault(); - }); - element.bind('dragleave drop', function (event) { - $timeout.cancel(promise); - promise = $timeout(function () { - scope.$eval(attrs.flowDragLeave); - promise = null; - enter = false; - }, 100); - }); - function isFileDrag(dragEvent) { - var fileDrag = false; - var dataTransfer = dragEvent.dataTransfer || dragEvent.originalEvent.dataTransfer; - angular.forEach(dataTransfer && dataTransfer.types, function(val) { - if (val === 'Files') { - fileDrag = true; - } - }); - return fileDrag; - } - } - }; - }]); - -angular.module('flow.drop', ['flow.init']) -.directive('flowDrop', function() { - return { - 'scope': false, - 'require': '^flowInit', - 'link': function(scope, element, attrs) { - if (attrs.flowDropEnabled) { - scope.$watch(attrs.flowDropEnabled, function (value) { - if (value) { - assignDrop(); - } else { - unAssignDrop(); - } - }); - } else { - assignDrop(); - } - function assignDrop() { - scope.$flow.assignDrop(element); - } - function unAssignDrop() { - scope.$flow.unAssignDrop(element); - } - } - }; -}); - -!function (angular) {'use strict'; - var module = angular.module('flow.events', ['flow.init']); - var events = { - fileSuccess: ['$file', '$message'], - fileProgress: ['$file'], - fileAdded: ['$file', '$event'], - filesAdded: ['$files', '$event'], - filesSubmitted: ['$files', '$event'], - fileRetry: ['$file'], - fileRemoved: ['$file'], - fileError: ['$file', '$message'], - uploadStart: [], - complete: [], - progress: [], - error: ['$message', '$file'] - }; - - angular.forEach(events, function (eventArgs, eventName) { - var name = 'flow' + capitaliseFirstLetter(eventName); - if (name == 'flowUploadStart') { - name = 'flowUploadStarted';// event alias - } - module.directive(name, [function() { - return { - require: '^flowInit', - controller: ['$scope', '$attrs', function ($scope, $attrs) { - $scope.$on('flow::' + eventName, function () { - var funcArgs = Array.prototype.slice.call(arguments); - var event = funcArgs.shift();// remove angular event - // remove flow object and ignore event if it is from parent directive - if ($scope.$flow !== funcArgs.shift()) { - return ; - } - var args = {}; - angular.forEach(eventArgs, function(value, key) { - args[value] = funcArgs[key]; - }); - if ($scope.$eval($attrs[name], args) === false) { - event.preventDefault(); - } - }); - }] - }; - }]); - }); - - function capitaliseFirstLetter(string) { - return string.charAt(0).toUpperCase() + string.slice(1); - } -}(angular); - -angular.module('flow.img', ['flow.init']) -.directive('flowImg', [function() { - return { - 'scope': false, - 'require': '^flowInit', - 'link': function(scope, element, attrs) { - var file = attrs.flowImg; - scope.$watch(file, function (file) { - if (!file) { - return ; - } - var fileReader = new FileReader(); - fileReader.readAsDataURL(file.file); - fileReader.onload = function (event) { - scope.$apply(function () { - attrs.$set('src', event.target.result); - }); - }; - }); - } - }; -}]); -angular.module('flow.transfers', ['flow.init']) -.directive('flowTransfers', [function() { - return { - 'scope': true, - 'require': '^flowInit', - 'link': function(scope) { - scope.transfers = scope.$flow.files; - } - }; -}]); -angular.module('flow', ['flow.provider', 'flow.init', 'flow.events', 'flow.btn', - 'flow.drop', 'flow.transfers', 'flow.img', 'flow.dragEvents']); - -/***/ }), - -/***/ "./node_modules/@uirouter/angularjs/lib-esm/angular.js": -/*!*************************************************************!*\ - !*** ./node_modules/@uirouter/angularjs/lib-esm/angular.js ***! - \*************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ng": () => (/* binding */ ng) -/* harmony export */ }); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! angular */ "./node_modules/angular/index-exposed.js"); -/* harmony import */ var angular__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(angular__WEBPACK_IMPORTED_MODULE_0__); -/** @publicapi @module ng1 */ /** */ - -/** @hidden */ var ng_from_global = angular; -/** @hidden */ var ng = angular__WEBPACK_IMPORTED_MODULE_0__ && angular__WEBPACK_IMPORTED_MODULE_0__.module ? angular__WEBPACK_IMPORTED_MODULE_0__ : ng_from_global; -//# sourceMappingURL=angular.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/angularjs/lib-esm/directives/stateDirectives.js": -/*!********************************************************************************!*\ - !*** ./node_modules/@uirouter/angularjs/lib-esm/directives/stateDirectives.js ***! - \********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); -/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); -/* eslint-disable @typescript-eslint/no-empty-interface */ -/* eslint-disable prefer-const */ -/** - * # Angular 1 Directives - * - * These are the directives included in UI-Router for Angular 1. - * These directives are used in templates to create viewports and link/navigate to states. - * - * @preferred @publicapi @module directives - */ /** */ - - -/** @hidden */ -function parseStateRef(ref) { - var paramsOnly = ref.match(/^\s*({[^}]*})\s*$/); - if (paramsOnly) - ref = '(' + paramsOnly[1] + ')'; - var parsed = ref.replace(/\n/g, ' ').match(/^\s*([^(]*?)\s*(\((.*)\))?\s*$/); - if (!parsed || parsed.length !== 4) - throw new Error("Invalid state ref '" + ref + "'"); - return { state: parsed[1] || null, paramExpr: parsed[3] || null }; -} -/** @hidden */ -function stateContext(el) { - var $uiView = el.parent().inheritedData('$uiView'); - var path = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.parse)('$cfg.path')($uiView); - return path ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.tail)(path).state.name : undefined; -} -/** @hidden */ -function processedDef($state, $element, def) { - var uiState = def.uiState || $state.current.name; - var uiStateOpts = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)(defaultOpts($element, $state), def.uiStateOpts || {}); - var href = $state.href(uiState, def.uiStateParams, uiStateOpts); - return { uiState: uiState, uiStateParams: def.uiStateParams, uiStateOpts: uiStateOpts, href: href }; -} -/** @hidden */ -function getTypeInfo(el) { - // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute. - var isSvg = Object.prototype.toString.call(el.prop('href')) === '[object SVGAnimatedString]'; - var isForm = el[0].nodeName === 'FORM'; - return { - attr: isForm ? 'action' : isSvg ? 'xlink:href' : 'href', - isAnchor: el.prop('tagName').toUpperCase() === 'A', - clickable: !isForm, - }; -} -/** @hidden */ -function clickHook(el, $state, $timeout, type, getDef) { - return function (e) { - var button = e.which || e.button, target = getDef(); - if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || el.attr('target'))) { - // HACK: This is to allow ng-clicks to be processed before the transition is initiated: - var transition_1 = $timeout(function () { - if (!el.attr('disabled')) { - $state.go(target.uiState, target.uiStateParams, target.uiStateOpts); - } - }); - e.preventDefault(); - // if the state has no URL, ignore one preventDefault from the directive. - var ignorePreventDefaultCount_1 = type.isAnchor && !target.href ? 1 : 0; - e.preventDefault = function () { - if (ignorePreventDefaultCount_1-- <= 0) - $timeout.cancel(transition_1); - }; - } - }; -} -/** @hidden */ -function defaultOpts(el, $state) { - return { - relative: stateContext(el) || $state.$current, - inherit: true, - source: 'sref', - }; -} -/** @hidden */ -function bindEvents(element, scope, hookFn, uiStateOpts) { - var events; - if (uiStateOpts) { - events = uiStateOpts.events; - } - if (!(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(events)) { - events = ['click']; - } - var on = element.on ? 'on' : 'bind'; - for (var _i = 0, events_1 = events; _i < events_1.length; _i++) { - var event_1 = events_1[_i]; - element[on](event_1, hookFn); - } - scope.$on('$destroy', function () { - var off = element.off ? 'off' : 'unbind'; - for (var _i = 0, events_2 = events; _i < events_2.length; _i++) { - var event_2 = events_2[_i]; - element[off](event_2, hookFn); - } - }); -} -/** - * `ui-sref`: A directive for linking to a state - * - * A directive which links to a state (and optionally, parameters). - * When clicked, this directive activates the linked state with the supplied parameter values. - * - * ### Linked State - * The attribute value of the `ui-sref` is the name of the state to link to. - * - * #### Example: - * This will activate the `home` state when the link is clicked. - * ```html - * Home - * ``` - * - * ### Relative Links - * You can also use relative state paths within `ui-sref`, just like a relative path passed to `$state.go()` ([[StateService.go]]). - * You just need to be aware that the path is relative to the state that *created* the link. - * This allows a state to create a relative `ui-sref` which always targets the same destination. - * - * #### Example: - * Both these links are relative to the parent state, even when a child state is currently active. - * ```html - * child 1 state - * child 2 state - * ``` - * - * This link activates the parent state. - * ```html - * Return - * ``` - * - * ### hrefs - * If the linked state has a URL, the directive will automatically generate and - * update the `href` attribute (using the [[StateService.href]] method). - * - * #### Example: - * Assuming the `users` state has a url of `/users/` - * ```html - * Users - * ``` - * - * ### Parameter Values - * In addition to the state name, a `ui-sref` can include parameter values which are applied when activating the state. - * Param values can be provided in the `ui-sref` value after the state name, enclosed by parentheses. - * The content inside the parentheses is an expression, evaluated to the parameter values. - * - * #### Example: - * This example renders a list of links to users. - * The state's `userId` parameter value comes from each user's `user.id` property. - * ```html - *
  • - * {{ user.displayName }} - *
  • - * ``` - * - * Note: - * The parameter values expression is `$watch`ed for updates. - * - * ### Transition Options - * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-sref-opts` attribute. - * Options are restricted to `location`, `inherit`, and `reload`. - * - * #### Example: - * ```html - * Home - * ``` - * - * ### Other DOM Events - * - * You can also customize which DOM events to respond to (instead of `click`) by - * providing an `events` array in the `ui-sref-opts` attribute. - * - * #### Example: - * ```html - * - * ``` - * - * ### Highlighting the active link - * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link. - * - * ### Examples - * If you have the following template: - * - * ```html - * Home - * About - * Next page - * - * - * ``` - * - * Then (assuming the current state is `contacts`) the rendered html including hrefs would be: - * - * ```html - * Home - * About - * Next page - * - *
      - *
    • - * Joe - *
    • - *
    • - * Alice - *
    • - *
    • - * Bob - *
    • - *
    - * - * Home - * ``` - * - * ### Notes - * - * - You can use `ui-sref` to change **only the parameter values** by omitting the state name and parentheses. - * #### Example: - * Sets the `lang` parameter to `en` and remains on the same state. - * - * ```html - * English - * ``` - * - * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example. - * - * - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons). - * If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive. - */ -var uiSrefDirective; -uiSrefDirective = [ - '$uiRouter', - '$timeout', - function $StateRefDirective($uiRouter, $timeout) { - var $state = $uiRouter.stateService; - return { - restrict: 'A', - require: ['?^uiSrefActive', '?^uiSrefActiveEq'], - link: function (scope, element, attrs, uiSrefActive) { - var type = getTypeInfo(element); - var active = uiSrefActive[1] || uiSrefActive[0]; - var unlinkInfoFn = null; - var rawDef = {}; - var getDef = function () { return processedDef($state, element, rawDef); }; - var ref = parseStateRef(attrs.uiSref); - rawDef.uiState = ref.state; - rawDef.uiStateOpts = attrs.uiSrefOpts ? scope.$eval(attrs.uiSrefOpts) : {}; - function update() { - var def = getDef(); - if (unlinkInfoFn) - unlinkInfoFn(); - if (active) - unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams); - if (def.href != null) - attrs.$set(type.attr, def.href); - } - if (ref.paramExpr) { - scope.$watch(ref.paramExpr, function (val) { - rawDef.uiStateParams = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)({}, val); - update(); - }, true); - rawDef.uiStateParams = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)({}, scope.$eval(ref.paramExpr)); - } - update(); - scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update)); - scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update)); - if (!type.clickable) - return; - var hookFn = clickHook(element, $state, $timeout, type, getDef); - bindEvents(element, scope, hookFn, rawDef.uiStateOpts); - }, - }; - }, -]; -/** - * `ui-state`: A fully dynamic directive for linking to a state - * - * A directive which links to a state (and optionally, parameters). - * When clicked, this directive activates the linked state with the supplied parameter values. - * - * **This directive is very similar to [[uiSref]], but it `$observe`s and `$watch`es/evaluates all its inputs.** - * - * A directive which links to a state (and optionally, parameters). - * When clicked, this directive activates the linked state with the supplied parameter values. - * - * ### Linked State - * The attribute value of `ui-state` is an expression which is `$watch`ed and evaluated as the state to link to. - * **This is in contrast with `ui-sref`, which takes a state name as a string literal.** - * - * #### Example: - * Create a list of links. - * ```html - *
  • - * {{ link.displayName }} - *
  • - * ``` - * - * ### Relative Links - * If the expression evaluates to a relative path, it is processed like [[uiSref]]. - * You just need to be aware that the path is relative to the state that *created* the link. - * This allows a state to create relative `ui-state` which always targets the same destination. - * - * ### hrefs - * If the linked state has a URL, the directive will automatically generate and - * update the `href` attribute (using the [[StateService.href]] method). - * - * ### Parameter Values - * In addition to the state name expression, a `ui-state` can include parameter values which are applied when activating the state. - * Param values should be provided using the `ui-state-params` attribute. - * The `ui-state-params` attribute value is `$watch`ed and evaluated as an expression. - * - * #### Example: - * This example renders a list of links with param values. - * The state's `userId` parameter value comes from each user's `user.id` property. - * ```html - *
  • - * {{ link.displayName }} - *
  • - * ``` - * - * ### Transition Options - * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-state-opts` attribute. - * Options are restricted to `location`, `inherit`, and `reload`. - * The value of the `ui-state-opts` is `$watch`ed and evaluated as an expression. - * - * #### Example: - * ```html - * Home - * ``` - * - * ### Other DOM Events - * - * You can also customize which DOM events to respond to (instead of `click`) by - * providing an `events` array in the `ui-state-opts` attribute. - * - * #### Example: - * ```html - * - * ``` - * - * ### Highlighting the active link - * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link. - * - * ### Notes - * - * - You can use `ui-params` to change **only the parameter values** by omitting the state name and supplying only `ui-state-params`. - * However, it might be simpler to use [[uiSref]] parameter-only links. - * - * #### Example: - * Sets the `lang` parameter to `en` and remains on the same state. - * - * ```html - * English - * ``` - * - * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example. - * ``` - */ -var uiStateDirective; -uiStateDirective = [ - '$uiRouter', - '$timeout', - function $StateRefDynamicDirective($uiRouter, $timeout) { - var $state = $uiRouter.stateService; - return { - restrict: 'A', - require: ['?^uiSrefActive', '?^uiSrefActiveEq'], - link: function (scope, element, attrs, uiSrefActive) { - var type = getTypeInfo(element); - var active = uiSrefActive[1] || uiSrefActive[0]; - var unlinkInfoFn = null; - var hookFn; - var rawDef = {}; - var getDef = function () { return processedDef($state, element, rawDef); }; - var inputAttrs = ['uiState', 'uiStateParams', 'uiStateOpts']; - var watchDeregFns = inputAttrs.reduce(function (acc, attr) { return ((acc[attr] = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.noop), acc); }, {}); - function update() { - var def = getDef(); - if (unlinkInfoFn) - unlinkInfoFn(); - if (active) - unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams); - if (def.href != null) - attrs.$set(type.attr, def.href); - } - inputAttrs.forEach(function (field) { - rawDef[field] = attrs[field] ? scope.$eval(attrs[field]) : null; - attrs.$observe(field, function (expr) { - watchDeregFns[field](); - watchDeregFns[field] = scope.$watch(expr, function (newval) { - rawDef[field] = newval; - update(); - }, true); - }); - }); - update(); - scope.$on('$destroy', $uiRouter.stateRegistry.onStatesChanged(update)); - scope.$on('$destroy', $uiRouter.transitionService.onSuccess({}, update)); - if (!type.clickable) - return; - hookFn = clickHook(element, $state, $timeout, type, getDef); - bindEvents(element, scope, hookFn, rawDef.uiStateOpts); - }, - }; - }, -]; -/** - * `ui-sref-active` and `ui-sref-active-eq`: A directive that adds a CSS class when a `ui-sref` is active - * - * A directive working alongside [[uiSref]] and [[uiState]] to add classes to an element when the - * related directive's state is active (and remove them when it is inactive). - * - * The primary use-case is to highlight the active link in navigation menus, - * distinguishing it from the inactive menu items. - * - * ### Linking to a `ui-sref` or `ui-state` - * `ui-sref-active` can live on the same element as `ui-sref`/`ui-state`, or it can be on a parent element. - * If a `ui-sref-active` is a parent to more than one `ui-sref`/`ui-state`, it will apply the CSS class when **any of the links are active**. - * - * ### Matching - * - * The `ui-sref-active` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state **or any child state is active**. - * This is a "fuzzy match" which uses [[StateService.includes]]. - * - * The `ui-sref-active-eq` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state is directly active (not when child states are active). - * This is an "exact match" which uses [[StateService.is]]. - * - * ### Parameter values - * If the `ui-sref`/`ui-state` includes parameter values, the current parameter values must match the link's values for the link to be highlighted. - * This allows a list of links to the same state with different parameters to be rendered, and the correct one highlighted. - * - * #### Example: - * ```html - *
  • - * {{ user.lastName }} - *
  • - * ``` - * - * ### Examples - * - * Given the following template: - * #### Example: - * ```html - * - * ``` - * - * When the app state is `app.user` (or any child state), - * and contains the state parameter "user" with value "bilbobaggins", - * the resulting HTML will appear as (note the 'active' class): - * - * ```html - * - * ``` - * - * ### Glob mode - * - * It is possible to pass `ui-sref-active` an expression that evaluates to an object. - * The objects keys represent active class names and values represent the respective state names/globs. - * `ui-sref-active` will match if the current active state **includes** any of - * the specified state names/globs, even the abstract ones. - * - * #### Example: - * Given the following template, with "admin" being an abstract state: - * ```html - *
    - * Roles - *
    - * ``` - * - * Arrays are also supported as values in the `ngClass`-like interface. - * This allows multiple states to add `active` class. - * - * #### Example: - * Given the following template, with "admin.roles" being the current state, the class will be added too: - * ```html - *
    - * Roles - *
    - * ``` - * - * When the current state is "admin.roles" the "active" class will be applied to both the `
    ` and `` elements. - * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`. - * - * ### Notes: - * - * - The class name is interpolated **once** during the directives link time (any further changes to the - * interpolated value are ignored). - * - * - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'` - */ -var uiSrefActiveDirective; -uiSrefActiveDirective = [ - '$state', - '$stateParams', - '$interpolate', - '$uiRouter', - function $StateRefActiveDirective($state, $stateParams, $interpolate, $uiRouter) { - return { - restrict: 'A', - controller: [ - '$scope', - '$element', - '$attrs', - function ($scope, $element, $attrs) { - var states = []; - var activeEqClass; - var uiSrefActive; - // There probably isn't much point in $observing this - // uiSrefActive and uiSrefActiveEq share the same directive object with some - // slight difference in logic routing - activeEqClass = $interpolate($attrs.uiSrefActiveEq || '', false)($scope); - try { - uiSrefActive = $scope.$eval($attrs.uiSrefActive); - } - catch (e) { - // Do nothing. uiSrefActive is not a valid expression. - // Fall back to using $interpolate below - } - uiSrefActive = uiSrefActive || $interpolate($attrs.uiSrefActive || '', false)($scope); - setStatesFromDefinitionObject(uiSrefActive); - // Allow uiSref to communicate with uiSrefActive[Equals] - this.$$addStateInfo = function (newState, newParams) { - // we already got an explicit state provided by ui-sref-active, so we - // shadow the one that comes from ui-sref - if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isObject)(uiSrefActive) && states.length > 0) { - return; - } - var deregister = addState(newState, newParams, uiSrefActive); - update(); - return deregister; - }; - function updateAfterTransition(trans) { - trans.promise.then(update, _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.noop); - } - $scope.$on('$destroy', setupEventListeners()); - if ($uiRouter.globals.transition) { - updateAfterTransition($uiRouter.globals.transition); - } - function setupEventListeners() { - var deregisterStatesChangedListener = $uiRouter.stateRegistry.onStatesChanged(handleStatesChanged); - var deregisterOnStartListener = $uiRouter.transitionService.onStart({}, updateAfterTransition); - var deregisterStateChangeSuccessListener = $scope.$on('$stateChangeSuccess', update); - return function cleanUp() { - deregisterStatesChangedListener(); - deregisterOnStartListener(); - deregisterStateChangeSuccessListener(); - }; - } - function handleStatesChanged() { - setStatesFromDefinitionObject(uiSrefActive); - } - function setStatesFromDefinitionObject(statesDefinition) { - if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isObject)(statesDefinition)) { - states = []; - (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.forEach)(statesDefinition, function (stateOrName, activeClass) { - // Helper function to abstract adding state. - var addStateForClass = function (stateOrName, activeClass) { - var ref = parseStateRef(stateOrName); - addState(ref.state, $scope.$eval(ref.paramExpr), activeClass); - }; - if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isString)(stateOrName)) { - // If state is string, just add it. - addStateForClass(stateOrName, activeClass); - } - else if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(stateOrName)) { - // If state is an array, iterate over it and add each array item individually. - (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.forEach)(stateOrName, function (stateOrName) { - addStateForClass(stateOrName, activeClass); - }); - } - }); - } - } - function addState(stateName, stateParams, activeClass) { - var state = $state.get(stateName, stateContext($element)); - var stateInfo = { - state: state || { name: stateName }, - params: stateParams, - activeClass: activeClass, - }; - states.push(stateInfo); - return function removeState() { - (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.removeFrom)(states)(stateInfo); - }; - } - // Update route state - function update() { - var splitClasses = function (str) { return str.split(/\s/).filter(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.identity); }; - var getClasses = function (stateList) { - return stateList - .map(function (x) { return x.activeClass; }) - .map(splitClasses) - .reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.unnestR, []); - }; - var allClasses = getClasses(states).concat(splitClasses(activeEqClass)).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.uniqR, []); - var fuzzyClasses = getClasses(states.filter(function (x) { return $state.includes(x.state.name, x.params); })); - var exactlyMatchesAny = !!states.filter(function (x) { return $state.is(x.state.name, x.params); }).length; - var exactClasses = exactlyMatchesAny ? splitClasses(activeEqClass) : []; - var addClasses = fuzzyClasses.concat(exactClasses).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.uniqR, []); - var removeClasses = allClasses.filter(function (cls) { return !(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.inArray)(addClasses, cls); }); - $scope.$evalAsync(function () { - addClasses.forEach(function (className) { return $element.addClass(className); }); - removeClasses.forEach(function (className) { return $element.removeClass(className); }); - }); - } - update(); - }, - ], - }; - }, -]; -_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state') - .directive('uiSref', uiSrefDirective) - .directive('uiSrefActive', uiSrefActiveDirective) - .directive('uiSrefActiveEq', uiSrefActiveDirective) - .directive('uiState', uiStateDirective); -//# sourceMappingURL=stateDirectives.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/angularjs/lib-esm/directives/viewDirective.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@uirouter/angularjs/lib-esm/directives/viewDirective.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "uiView": () => (/* binding */ uiView) -/* harmony export */ }); -/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); -/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); -/* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../services */ "./node_modules/@uirouter/angularjs/lib-esm/services.js"); -/* harmony import */ var _statebuilders_views__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../statebuilders/views */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"); -/** @publicapi @module directives */ /** */ - - - - -/** - * `ui-view`: A viewport directive which is filled in by a view from the active state. - * - * ### Attributes - * - * - `name`: (Optional) A view name. - * The name should be unique amongst the other views in the same state. - * You can have views of the same name that live in different states. - * The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]). - * - * - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated. - * Uses [[$uiViewScroll]] to do the scrolling. - * - * - `onload`: Expression to evaluate whenever the view updates. - * - * #### Example: - * A view can be unnamed or named. - * ```html - * - *
    - * - * - *
    - * - * - * - * ``` - * - * You can only have one unnamed view within any template (or root html). If you are only using a - * single view and it is unnamed then you can populate it like so: - * - * ```html - *
    - * $stateProvider.state("home", { - * template: "

    HELLO!

    " - * }) - * ``` - * - * The above is a convenient shortcut equivalent to specifying your view explicitly with the - * [[Ng1StateDeclaration.views]] config property, by name, in this case an empty name: - * - * ```js - * $stateProvider.state("home", { - * views: { - * "": { - * template: "

    HELLO!

    " - * } - * } - * }) - * ``` - * - * But typically you'll only use the views property if you name your view or have more than one view - * in the same template. There's not really a compelling reason to name a view if its the only one, - * but you could if you wanted, like so: - * - * ```html - *
    - * ``` - * - * ```js - * $stateProvider.state("home", { - * views: { - * "main": { - * template: "

    HELLO!

    " - * } - * } - * }) - * ``` - * - * Really though, you'll use views to set up multiple views: - * - * ```html - *
    - *
    - *
    - * ``` - * - * ```js - * $stateProvider.state("home", { - * views: { - * "": { - * template: "

    HELLO!

    " - * }, - * "chart": { - * template: "" - * }, - * "data": { - * template: "" - * } - * } - * }) - * ``` - * - * #### Examples for `autoscroll`: - * ```html - * - * - * - * - * - * - * - * ``` - * - * Resolve data: - * - * The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this - * can be customized using [[Ng1ViewDeclaration.resolveAs]]). This can be then accessed from the template. - * - * Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the - * controller is instantiated. The `$onInit()` hook can be used to perform initialization code which - * depends on `$resolve` data. - * - * #### Example: - * ```js - * $stateProvider.state('home', { - * template: '', - * resolve: { - * user: function(UserService) { return UserService.fetchUser(); } - * } - * }); - * ``` - */ -var uiView; -// eslint-disable-next-line prefer-const -uiView = [ - '$view', - '$animate', - '$uiViewScroll', - '$interpolate', - '$q', - function $ViewDirective($view, $animate, $uiViewScroll, $interpolate, $q) { - function getRenderer() { - return { - enter: function (element, target, cb) { - if (_angular__WEBPACK_IMPORTED_MODULE_1__.ng.version.minor > 2) { - $animate.enter(element, null, target).then(cb); - } - else { - $animate.enter(element, null, target, cb); - } - }, - leave: function (element, cb) { - if (_angular__WEBPACK_IMPORTED_MODULE_1__.ng.version.minor > 2) { - $animate.leave(element).then(cb); - } - else { - $animate.leave(element, cb); - } - }, - }; - } - function configsEqual(config1, config2) { - return config1 === config2; - } - var rootData = { - $cfg: { viewDecl: { $context: $view._pluginapi._rootViewContext() } }, - $uiView: {}, - }; - var directive = { - count: 0, - restrict: 'ECA', - terminal: true, - priority: 400, - transclude: 'element', - compile: function (tElement, tAttrs, $transclude) { - return function (scope, $element, attrs) { - var onloadExp = attrs['onload'] || '', autoScrollExp = attrs['autoscroll'], renderer = getRenderer(), inherited = $element.inheritedData('$uiView') || rootData, name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default'; - var previousEl, currentEl, currentScope, viewConfig; - var activeUIView = { - $type: 'ng1', - id: directive.count++, - name: name, - fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + '.' + name : name, - config: null, - configUpdated: configUpdatedCallback, - get creationContext() { - // The context in which this ui-view "tag" was created - var fromParentTagConfig = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('$cfg.viewDecl.$context')(inherited); - // Allow - // See https://github.com/angular-ui/ui-router/issues/3355 - var fromParentTag = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('$uiView.creationContext')(inherited); - return fromParentTagConfig || fromParentTag; - }, - }; - _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Linking', activeUIView); - function configUpdatedCallback(config) { - if (config && !(config instanceof _statebuilders_views__WEBPACK_IMPORTED_MODULE_3__.Ng1ViewConfig)) - return; - if (configsEqual(viewConfig, config)) - return; - _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewConfigUpdated(activeUIView, config && config.viewDecl && config.viewDecl.$context); - viewConfig = config; - updateView(config); - } - $element.data('$uiView', { $uiView: activeUIView }); - updateView(); - var unregister = $view.registerUIView(activeUIView); - scope.$on('$destroy', function () { - _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Destroying/Unregistering', activeUIView); - unregister(); - }); - function cleanupLastView() { - if (previousEl) { - _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Removing (previous) el', previousEl.data('$uiView')); - previousEl.remove(); - previousEl = null; - } - if (currentScope) { - _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Destroying scope', activeUIView); - currentScope.$destroy(); - currentScope = null; - } - if (currentEl) { - var _viewData_1 = currentEl.data('$uiViewAnim'); - _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewEvent('Animate out', _viewData_1); - renderer.leave(currentEl, function () { - _viewData_1.$$animLeave.resolve(); - previousEl = null; - }); - previousEl = currentEl; - currentEl = null; - } - } - function updateView(config) { - var newScope = scope.$new(); - var animEnter = $q.defer(), animLeave = $q.defer(); - var $uiViewData = { - $cfg: config, - $uiView: activeUIView, - }; - var $uiViewAnim = { - $animEnter: animEnter.promise, - $animLeave: animLeave.promise, - $$animLeave: animLeave, - }; - /** - * @ngdoc event - * @name ui.router.state.directive:ui-view#$viewContentLoading - * @eventOf ui.router.state.directive:ui-view - * @eventType emits on ui-view directive scope - * @description - * - * Fired once the view **begins loading**, *before* the DOM is rendered. - * - * @param {Object} event Event object. - * @param {string} viewName Name of the view. - */ - newScope.$emit('$viewContentLoading', name); - var cloned = $transclude(newScope, function (clone) { - clone.data('$uiViewAnim', $uiViewAnim); - clone.data('$uiView', $uiViewData); - renderer.enter(clone, $element, function onUIViewEnter() { - animEnter.resolve(); - if (currentScope) - currentScope.$emit('$viewContentAnimationEnded'); - if (((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(autoScrollExp) && !autoScrollExp) || scope.$eval(autoScrollExp)) { - $uiViewScroll(clone); - } - }); - cleanupLastView(); - }); - currentEl = cloned; - currentScope = newScope; - /** - * @ngdoc event - * @name ui.router.state.directive:ui-view#$viewContentLoaded - * @eventOf ui.router.state.directive:ui-view - * @eventType emits on ui-view directive scope - * @description * - * Fired once the view is **loaded**, *after* the DOM is rendered. - * - * @param {Object} event Event object. - */ - currentScope.$emit('$viewContentLoaded', config || viewConfig); - currentScope.$eval(onloadExp); - } - }; - }, - }; - return directive; - }, -]; -$ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q']; -/** @hidden */ -function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q) { - var getControllerAs = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('viewDecl.controllerAs'); - var getResolveAs = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.parse)('viewDecl.resolveAs'); - return { - restrict: 'ECA', - priority: -400, - compile: function (tElement) { - var initial = tElement.html(); - tElement.empty(); - return function (scope, $element) { - var data = $element.data('$uiView'); - if (!data) { - $element.html(initial); - $compile($element.contents())(scope); - return; - } - var cfg = data.$cfg || { viewDecl: {}, getTemplate: _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.noop }; - var resolveCtx = cfg.path && new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(cfg.path); - $element.html(cfg.getTemplate($element, resolveCtx) || initial); - _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceUIViewFill(data.$uiView, $element.html()); - var link = $compile($element.contents()); - var controller = cfg.controller; - var controllerAs = getControllerAs(cfg); - var resolveAs = getResolveAs(cfg); - var locals = resolveCtx && (0,_services__WEBPACK_IMPORTED_MODULE_2__.getLocals)(resolveCtx); - scope[resolveAs] = locals; - if (controller) { - var controllerInstance = ($controller(controller, (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)({}, locals, { $scope: scope, $element: $element }))); - if (controllerAs) { - scope[controllerAs] = controllerInstance; - scope[controllerAs][resolveAs] = locals; - } - // TODO: Use $view service as a central point for registering component-level hooks - // Then, when a component is created, tell the $view service, so it can invoke hooks - // $view.componentLoaded(controllerInstance, { $scope: scope, $element: $element }); - // scope.$on('$destroy', () => $view.componentUnloaded(controllerInstance, { $scope: scope, $element: $element })); - $element.data('$ngControllerController', controllerInstance); - $element.children().data('$ngControllerController', controllerInstance); - registerControllerCallbacks($q, $transitions, controllerInstance, scope, cfg); - } - // Wait for the component to appear in the DOM - if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isString)(cfg.component)) { - var kebobName = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.kebobString)(cfg.component); - var tagRegexp_1 = new RegExp("^(x-|data-)?" + kebobName + "$", 'i'); - var getComponentController = function () { - var directiveEl = [].slice - .call($element[0].children) - .filter(function (el) { return el && el.tagName && tagRegexp_1.exec(el.tagName); }); - return directiveEl && _angular__WEBPACK_IMPORTED_MODULE_1__.ng.element(directiveEl).data("$" + cfg.component + "Controller"); - }; - var deregisterWatch_1 = scope.$watch(getComponentController, function (ctrlInstance) { - if (!ctrlInstance) - return; - registerControllerCallbacks($q, $transitions, ctrlInstance, scope, cfg); - deregisterWatch_1(); - }); - } - link(scope); - }; - }, - }; -} -/** @hidden */ -var hasComponentImpl = typeof _angular__WEBPACK_IMPORTED_MODULE_1__.ng.module('ui.router')['component'] === 'function'; -/** @hidden incrementing id */ -var _uiCanExitId = 0; -/** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */ -function registerControllerCallbacks($q, $transitions, controllerInstance, $scope, cfg) { - // Call $onInit() ASAP - if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(controllerInstance.$onInit) && - !((cfg.viewDecl.component || cfg.viewDecl.componentProvider) && hasComponentImpl)) { - controllerInstance.$onInit(); - } - var viewState = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.tail)(cfg.path).state.self; - var hookOptions = { bind: controllerInstance }; - // Add component-level hook for onUiParamsChanged - if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(controllerInstance.uiOnParamsChanged)) { - var resolveContext = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(cfg.path); - var viewCreationTrans_1 = resolveContext.getResolvable('$transition$').data; - // Fire callback on any successful transition - var paramsUpdated = function ($transition$) { - // Exit early if the $transition$ is the same as the view was created within. - // Exit early if the $transition$ will exit the state the view is for. - if ($transition$ === viewCreationTrans_1 || $transition$.exiting().indexOf(viewState) !== -1) - return; - var toParams = $transition$.params('to'); - var fromParams = $transition$.params('from'); - var getNodeSchema = function (node) { return node.paramSchema; }; - var toSchema = $transition$.treeChanges('to').map(getNodeSchema).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.unnestR, []); - var fromSchema = $transition$.treeChanges('from').map(getNodeSchema).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.unnestR, []); - // Find the to params that have different values than the from params - var changedToParams = toSchema.filter(function (param) { - var idx = fromSchema.indexOf(param); - return idx === -1 || !fromSchema[idx].type.equals(toParams[param.id], fromParams[param.id]); - }); - // Only trigger callback if a to param has changed or is new - if (changedToParams.length) { - var changedKeys_1 = changedToParams.map(function (x) { return x.id; }); - // Filter the params to only changed/new to params. `$transition$.params()` may be used to get all params. - var newValues = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.filter)(toParams, function (val, key) { return changedKeys_1.indexOf(key) !== -1; }); - controllerInstance.uiOnParamsChanged(newValues, $transition$); - } - }; - $scope.$on('$destroy', $transitions.onSuccess({}, paramsUpdated, hookOptions)); - } - // Add component-level hook for uiCanExit - if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(controllerInstance.uiCanExit)) { - var id_1 = _uiCanExitId++; - var cacheProp_1 = '_uiCanExitIds'; - // Returns true if a redirect transition already answered truthy - var prevTruthyAnswer_1 = function (trans) { - return !!trans && ((trans[cacheProp_1] && trans[cacheProp_1][id_1] === true) || prevTruthyAnswer_1(trans.redirectedFrom())); - }; - // If a user answered yes, but the transition was later redirected, don't also ask for the new redirect transition - var wrappedHook = function (trans) { - var promise; - var ids = (trans[cacheProp_1] = trans[cacheProp_1] || {}); - if (!prevTruthyAnswer_1(trans)) { - promise = $q.when(controllerInstance.uiCanExit(trans)); - promise.then(function (val) { return (ids[id_1] = val !== false); }); - } - return promise; - }; - var criteria = { exiting: viewState.name }; - $scope.$on('$destroy', $transitions.onBefore(criteria, wrappedHook, hookOptions)); - } -} -_angular__WEBPACK_IMPORTED_MODULE_1__.ng.module('ui.router.state').directive('uiView', uiView); -_angular__WEBPACK_IMPORTED_MODULE_1__.ng.module('ui.router.state').directive('uiView', $ViewDirectiveFill); -//# sourceMappingURL=viewDirective.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/angularjs/lib-esm/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/@uirouter/angularjs/lib-esm/index.js ***! - \***********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "getLocals": () => (/* reexport safe */ _services__WEBPACK_IMPORTED_MODULE_1__.getLocals), -/* harmony export */ "watchDigests": () => (/* reexport safe */ _services__WEBPACK_IMPORTED_MODULE_1__.watchDigests), -/* harmony export */ "Ng1ViewConfig": () => (/* reexport safe */ _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.Ng1ViewConfig), -/* harmony export */ "getNg1ViewConfigFactory": () => (/* reexport safe */ _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.getNg1ViewConfigFactory), -/* harmony export */ "ng1ViewsBuilder": () => (/* reexport safe */ _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.ng1ViewsBuilder), -/* harmony export */ "StateProvider": () => (/* reexport safe */ _stateProvider__WEBPACK_IMPORTED_MODULE_3__.StateProvider), -/* harmony export */ "UrlRouterProvider": () => (/* reexport safe */ _urlRouterProvider__WEBPACK_IMPORTED_MODULE_4__.UrlRouterProvider), -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), -/* harmony export */ "core": () => (/* reexport module object */ _uirouter_core__WEBPACK_IMPORTED_MODULE_10__) -/* harmony export */ }); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/angularjs/lib-esm/interface.js"); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); -/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; -/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(["default","core"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] -/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); -/* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./services */ "./node_modules/@uirouter/angularjs/lib-esm/services.js"); -/* harmony import */ var _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./statebuilders/views */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"); -/* harmony import */ var _stateProvider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stateProvider */ "./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js"); -/* harmony import */ var _urlRouterProvider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./urlRouterProvider */ "./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js"); -/* harmony import */ var _injectables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./injectables */ "./node_modules/@uirouter/angularjs/lib-esm/injectables.js"); -/* harmony import */ var _injectables__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_injectables__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _directives_stateDirectives__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./directives/stateDirectives */ "./node_modules/@uirouter/angularjs/lib-esm/directives/stateDirectives.js"); -/* harmony import */ var _stateFilters__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./stateFilters */ "./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js"); -/* harmony import */ var _directives_viewDirective__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./directives/viewDirective */ "./node_modules/@uirouter/angularjs/lib-esm/directives/viewDirective.js"); -/* harmony import */ var _viewScroll__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./viewScroll */ "./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js"); -/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); -/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; -/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _uirouter_core__WEBPACK_IMPORTED_MODULE_10__) if(["default","core","getLocals","watchDigests","Ng1ViewConfig","getNg1ViewConfigFactory","ng1ViewsBuilder","StateProvider","UrlRouterProvider"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _uirouter_core__WEBPACK_IMPORTED_MODULE_10__[__WEBPACK_IMPORT_KEY__] -/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); -/** - * Main entry point for angular 1.x build - * @publicapi @module ng1 - */ /** */ - - - - - - - - - - -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ('ui.router'); - - - -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/angularjs/lib-esm/injectables.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@uirouter/angularjs/lib-esm/injectables.js ***! - \*****************************************************************/ -/***/ (() => { - -/** - * The current (or pending) State Parameters - * - * An injectable global **Service Object** which holds the state parameters for the latest **SUCCESSFUL** transition. - * - * The values are not updated until *after* a `Transition` successfully completes. - * - * **Also:** an injectable **Per-Transition Object** object which holds the pending state parameters for the pending `Transition` currently running. - * - * ### Deprecation warning: - * - * The value injected for `$stateParams` is different depending on where it is injected. - * - * - When injected into an angular service, the object injected is the global **Service Object** with the parameter values for the latest successful `Transition`. - * - When injected into transition hooks, resolves, or view controllers, the object is the **Per-Transition Object** with the parameter values for the running `Transition`. - * - * Because of these confusing details, this service is deprecated. - * - * ### Instead of using the global `$stateParams` service object, - * inject [[$uiRouterGlobals]] and use [[UIRouterGlobals.params]] - * - * ```js - * MyService.$inject = ['$uiRouterGlobals']; - * function MyService($uiRouterGlobals) { - * return { - * paramValues: function () { - * return $uiRouterGlobals.params; - * } - * } - * } - * ``` - * - * ### Instead of using the per-transition `$stateParams` object, - * inject the current `Transition` (as [[$transition$]]) and use [[Transition.params]] - * - * ```js - * MyController.$inject = ['$transition$']; - * function MyController($transition$) { - * var username = $transition$.params().username; - * // .. do something with username - * } - * ``` - * - * --- - * - * This object can be injected into other services. - * - * #### Deprecated Example: - * ```js - * SomeService.$inject = ['$http', '$stateParams']; - * function SomeService($http, $stateParams) { - * return { - * getUser: function() { - * return $http.get('/api/users/' + $stateParams.username); - * } - * } - * }; - * angular.service('SomeService', SomeService); - * ``` - * @deprecated - */ -var $stateParams; -/** - * Global UI-Router variables - * - * The router global state as a **Service Object** (injectable during runtime). - * - * This object contains globals such as the current state and current parameter values. - */ -var $uiRouterGlobals; -/** - * The UI-Router instance - * - * The [[UIRouter]] singleton (the router instance) as a **Service Object** (injectable during runtime). - * - * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap. - * It has references to the other UI-Router services - * - * #### Note: This object is also exposed as [[$uiRouterProvider]] for injection during angular config time. - */ -var $uiRouter; -/** - * The UI-Router instance - * - * The [[UIRouter]] singleton (the router instance) as a **Provider Object** (injectable during config phase). - * - * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap. - * It has references to the other UI-Router services - * - * #### Note: This object is also exposed as [[$uiRouter]] for injection during runtime. - */ -var $uiRouterProvider; -/** - * Transition debug/tracing - * - * The [[Trace]] singleton as a **Service Object** (injectable during runtime). - * - * Enables or disables Transition tracing which can help to debug issues. - */ -var $trace; -/** - * The Transition Service - * - * The [[TransitionService]] singleton as a **Service Object** (injectable during runtime). - * - * This angular service exposes the [[TransitionService]] singleton, which is primarily - * used to register global transition hooks. - * - * #### Note: This object is also exposed as [[$transitionsProvider]] for injection during the config phase. - */ -var $transitions; -/** - * The Transition Service - * - * The [[TransitionService]] singleton as a **Provider Object** (injectable during config phase) - * - * This angular service exposes the [[TransitionService]] singleton, which is primarily - * used to register global transition hooks. - * - * #### Note: This object is also exposed as [[$transitions]] for injection during runtime. - */ -var $transitionsProvider; -/** - * The current [[Transition]] object - * - * The current [[Transition]] object as a **Per-Transition Object** (injectable into Resolve, Hooks, Controllers) - * - * This object returns information about the current transition, including: - * - * - To/from states - * - To/from parameters - * - Transition options - * - States being entered, exited, and retained - * - Resolve data - * - A Promise for the transition - * - Any transition failure information - * - An injector for both Service and Per-Transition Objects - */ -var $transition$; -/** - * The State Service - * - * The [[StateService]] singleton as a **Service Object** (injectable during runtime). - * - * This service used to manage and query information on registered states. - * It exposes state related APIs including: - * - * - Start a [[Transition]] - * - Imperatively lazy load states - * - Check if a state is currently active - * - Look up states by name - * - Build URLs for a state+parameters - * - Configure the global Transition error handler - * - * This angular service exposes the [[StateService]] singleton. - */ -var $state; -/** - * The State Registry - * - * The [[StateRegistry]] singleton as a **Service Object** (injectable during runtime). - * - * This service is used to register/deregister states. - * It has state registration related APIs including: - * - * - Register/deregister states - * - Listen for state registration/deregistration - * - Get states by name - * - Add state decorators (to customize the state creation process) - * - * #### Note: This object is also exposed as [[$stateRegistryProvider]] for injection during the config phase. - */ -var $stateRegistry; -/** - * The State Registry - * - * The [[StateRegistry]] singleton as a **Provider Object** (injectable during config time). - * - * This service is used to register/deregister states. - * It has state registration related APIs including: - * - * - Register/deregister states - * - Listen for state registration/deregistration - * - Get states by name - * - Add state decorators (to customize the state creation process) - * - * #### Note: This object is also exposed as [[$stateRegistry]] for injection during runtime. - */ -var $stateRegistryProvider; -/** - * The View Scroll provider - * - * The [[UIViewScrollProvider]] as a **Provider Object** (injectable during config time). - * - * This angular service exposes the [[UIViewScrollProvider]] singleton and is - * used to disable UI-Router's scroll behavior. - */ -var $uiViewScrollProvider; -/** - * The View Scroll function - * - * The View Scroll function as a **Service Object** (injectable during runtime). - * - * This is a function that scrolls an element into view. - * The element is scrolled after a `$timeout` so the DOM has time to refresh. - * - * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor, - * this can be enabled by calling [[UIViewScrollProvider.useAnchorScroll]]. - * - * Note: this function is used by the [[directives.uiView]] when the `autoscroll` expression evaluates to true. - */ -var $uiViewScroll; -/** - * The StateProvider - * - * An angular1-only [[StateProvider]] as a **Provider Object** (injectable during config time). - * - * This angular service exposes the [[StateProvider]] singleton. - * - * The `StateProvider` is primarily used to register states or add custom state decorators. - * - * ##### Note: This provider is a ng1 vestige. - * It is a passthrough to [[$stateRegistry]] and [[$state]]. - */ -var $stateProvider; -/** - * The URL Service Provider - * - * The [[UrlService]] singleton as a **Provider Object** (injectable during the angular config phase). - * - * A service used to configure and interact with the URL. - * It has URL related APIs including: - * - * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]]) - * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]]) - * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]]) - * - delay initial URL synchronization [[UrlService.deferIntercept]]. - * - get or set the current url: [[UrlService.url]] - * - * ##### Note: This service can also be injected during runtime as [[$urlService]]. - */ -var $urlServiceProvider; -/** - * The URL Service - * - * The [[UrlService]] singleton as a **Service Object** (injectable during runtime). - * - * Note: This service can also be injected during the config phase as [[$urlServiceProvider]]. - * - * Used to configure the URL. - * It has URL related APIs including: - * - * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]]) - * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]]) - * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]]) - * - delay initial URL synchronization [[UrlService.deferIntercept]]. - * - get or set the current url: [[UrlService.url]] - * - * ##### Note: This service can also be injected during the config phase as [[$urlServiceProvider]]. - */ -var $urlService; -/** - * The URL Router Provider - * - * ### Deprecation warning: This object is now considered internal. Use [[$urlServiceProvider]] instead. - * - * The [[UrlRouter]] singleton as a **Provider Object** (injectable during config time). - * - * #### Note: This object is also exposed as [[$urlRouter]] for injection during runtime. - * - * @deprecated - */ -var $urlRouterProvider; -/** - * The Url Router - * - * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead. - * - * The [[UrlRouter]] singleton as a **Service Object** (injectable during runtime). - * - * #### Note: This object is also exposed as [[$urlRouterProvider]] for injection during angular config time. - * - * @deprecated - */ -var $urlRouter; -/** - * The URL Matcher Factory - * - * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead. - * - * The [[UrlMatcherFactory]] singleton as a **Service Object** (injectable during runtime). - * - * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects. - * - * #### Note: This object is also exposed as [[$urlMatcherFactoryProvider]] for injection during angular config time. - * - * @deprecated - */ -var $urlMatcherFactory; -/** - * The URL Matcher Factory - * - * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead. - * - * The [[UrlMatcherFactory]] singleton as a **Provider Object** (injectable during config time). - * - * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects. - * - * #### Note: This object is also exposed as [[$urlMatcherFactory]] for injection during runtime. - * - * @deprecated - */ -var $urlMatcherFactoryProvider; -//# sourceMappingURL=injectables.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/angularjs/lib-esm/interface.js": -/*!***************************************************************!*\ - !*** ./node_modules/@uirouter/angularjs/lib-esm/interface.js ***! - \***************************************************************/ -/***/ (() => { - -//# sourceMappingURL=interface.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/angularjs/lib-esm/locationServices.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@uirouter/angularjs/lib-esm/locationServices.js ***! - \**********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Ng1LocationServices": () => (/* binding */ Ng1LocationServices) -/* harmony export */ }); -/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); -/** @publicapi @module ng1 */ /** */ - - -/** - * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service - * @internalapi - */ -var Ng1LocationServices = /** @class */ (function () { - function Ng1LocationServices($locationProvider) { - // .onChange() registry - this._urlListeners = []; - this.$locationProvider = $locationProvider; - var _lp = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)($locationProvider); - (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)(_lp, this, _lp, ['hashPrefix']); - } - /** - * Applys ng1-specific path parameter encoding - * - * The Angular 1 `$location` service is a bit weird. - * It doesn't allow slashes to be encoded/decoded bi-directionally. - * - * See the writeup at https://github.com/angular-ui/ui-router/issues/2598 - * - * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F - * - * @param router - */ - Ng1LocationServices.monkeyPatchPathParameterType = function (router) { - var pathType = router.urlMatcherFactory.type('path'); - pathType.encode = function (x) { - return x != null ? x.toString().replace(/(~|\/)/g, function (m) { return ({ '~': '~~', '/': '~2F' }[m]); }) : x; - }; - pathType.decode = function (x) { - return x != null ? x.toString().replace(/(~~|~2F)/g, function (m) { return ({ '~~': '~', '~2F': '/' }[m]); }) : x; - }; - }; - // eslint-disable-next-line @typescript-eslint/no-empty-function - Ng1LocationServices.prototype.dispose = function () { }; - Ng1LocationServices.prototype.onChange = function (callback) { - var _this = this; - this._urlListeners.push(callback); - return function () { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(_this._urlListeners)(callback); }; - }; - Ng1LocationServices.prototype.html5Mode = function () { - var html5Mode = this.$locationProvider.html5Mode(); - html5Mode = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isObject)(html5Mode) ? html5Mode.enabled : html5Mode; - return html5Mode && this.$sniffer.history; - }; - Ng1LocationServices.prototype.baseHref = function () { - return this._baseHref || (this._baseHref = this.$browser.baseHref() || this.$window.location.pathname); - }; - Ng1LocationServices.prototype.url = function (newUrl, replace, state) { - if (replace === void 0) { replace = false; } - if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(newUrl)) - this.$location.url(newUrl); - if (replace) - this.$location.replace(); - if (state) - this.$location.state(state); - return this.$location.url(); - }; - Ng1LocationServices.prototype._runtimeServices = function ($rootScope, $location, $sniffer, $browser, $window) { - var _this = this; - this.$location = $location; - this.$sniffer = $sniffer; - this.$browser = $browser; - this.$window = $window; - // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange - $rootScope.$on('$locationChangeSuccess', function (evt) { return _this._urlListeners.forEach(function (fn) { return fn(evt); }); }); - var _loc = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)($location); - // Bind these LocationService functions to $location - (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)(_loc, this, _loc, ['replace', 'path', 'search', 'hash']); - // Bind these LocationConfig functions to $location - (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)(_loc, this, _loc, ['port', 'protocol', 'host']); - }; - return Ng1LocationServices; -}()); - -//# sourceMappingURL=locationServices.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/angularjs/lib-esm/services.js": -/*!**************************************************************!*\ - !*** ./node_modules/@uirouter/angularjs/lib-esm/services.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "watchDigests": () => (/* binding */ watchDigests), -/* harmony export */ "getLocals": () => (/* binding */ getLocals) -/* harmony export */ }); -/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); -/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); -/* harmony import */ var _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./statebuilders/views */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js"); -/* harmony import */ var _templateFactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./templateFactory */ "./node_modules/@uirouter/angularjs/lib-esm/templateFactory.js"); -/* harmony import */ var _stateProvider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stateProvider */ "./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js"); -/* harmony import */ var _statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./statebuilders/onEnterExitRetain */ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/onEnterExitRetain.js"); -/* harmony import */ var _locationServices__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./locationServices */ "./node_modules/@uirouter/angularjs/lib-esm/locationServices.js"); -/* harmony import */ var _urlRouterProvider__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./urlRouterProvider */ "./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js"); -/* eslint-disable @typescript-eslint/no-empty-function */ -/* eslint-disable @typescript-eslint/no-unused-vars */ -/** - * # Angular 1 types - * - * UI-Router core provides various Typescript types which you can use for code completion and validating parameter values, etc. - * The customizations to the core types for Angular UI-Router are documented here. - * - * The optional [[$resolve]] service is also documented here. - * - * @preferred @publicapi @module ng1 - */ /** */ - - - - - - - - -_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.angular1', []); -var mod_init = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.init', ['ng']); -var mod_util = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.util', ['ui.router.init']); -var mod_rtr = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.router', ['ui.router.util']); -var mod_state = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']); -var mod_main = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']); -var mod_cmpt = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.compat', ['ui.router']); -var router = null; -$uiRouterProvider.$inject = ['$locationProvider']; -/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */ -function $uiRouterProvider($locationProvider) { - // Create a new instance of the Router when the $uiRouterProvider is initialized - router = this.router = new _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.UIRouter(); - router.stateProvider = new _stateProvider__WEBPACK_IMPORTED_MODULE_4__.StateProvider(router.stateRegistry, router.stateService); - // Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties - router.stateRegistry.decorator('views', _statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.ng1ViewsBuilder); - router.stateRegistry.decorator('onExit', (0,_statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.getStateHookBuilder)('onExit')); - router.stateRegistry.decorator('onRetain', (0,_statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.getStateHookBuilder)('onRetain')); - router.stateRegistry.decorator('onEnter', (0,_statebuilders_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.getStateHookBuilder)('onEnter')); - router.viewService._pluginapi._viewConfigFactory('ng1', (0,_statebuilders_views__WEBPACK_IMPORTED_MODULE_2__.getNg1ViewConfigFactory)()); - // Disable decoding of params by UrlMatcherFactory because $location already handles this - router.urlService.config._decodeParams = false; - var ng1LocationService = (router.locationService = router.locationConfig = new _locationServices__WEBPACK_IMPORTED_MODULE_6__.Ng1LocationServices($locationProvider)); - _locationServices__WEBPACK_IMPORTED_MODULE_6__.Ng1LocationServices.monkeyPatchPathParameterType(router); - // backwards compat: also expose router instance as $uiRouterProvider.router - router['router'] = router; - router['$get'] = $get; - $get.$inject = ['$location', '$browser', '$window', '$sniffer', '$rootScope', '$http', '$templateCache']; - function $get($location, $browser, $window, $sniffer, $rootScope, $http, $templateCache) { - ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser, $window); - delete router['router']; - delete router['$get']; - return router; - } - return router; -} -var getProviderFor = function (serviceName) { return [ - '$uiRouterProvider', - function ($urp) { - var service = $urp.router[serviceName]; - service['$get'] = function () { return service; }; - return service; - }, -]; }; -// This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime) -runBlock.$inject = ['$injector', '$q', '$uiRouter']; -function runBlock($injector, $q, $uiRouter) { - _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector = $injector; - _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$q = $q; - // https://github.com/angular-ui/ui-router/issues/3678 - if (!Object.prototype.hasOwnProperty.call($injector, 'strictDi')) { - try { - $injector.invoke(function (checkStrictDi) { }); - } - catch (error) { - $injector.strictDi = !!/strict mode/.exec(error && error.toString()); - } - } - // The $injector is now available. - // Find any resolvables that had dependency annotation deferred - $uiRouter.stateRegistry - .get() - .map(function (x) { return x.$$state().resolvables; }) - .reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.unnestR, []) - .filter(function (x) { return x.deps === 'deferred'; }) - .forEach(function (resolvable) { return (resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi)); }); -} -// $urlRouter service and $urlRouterProvider -var getUrlRouterProvider = function (uiRouter) { return (uiRouter.urlRouterProvider = new _urlRouterProvider__WEBPACK_IMPORTED_MODULE_7__.UrlRouterProvider(uiRouter)); }; -// $state service and $stateProvider -// $urlRouter service and $urlRouterProvider -var getStateProvider = function () { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.extend)(router.stateProvider, { $get: function () { return router.stateService; } }); }; -watchDigests.$inject = ['$rootScope']; -function watchDigests($rootScope) { - $rootScope.$watch(function () { - _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.trace.approximateDigests++; - }); -} -mod_init.provider('$uiRouter', $uiRouterProvider); -mod_rtr.provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]); -mod_util.provider('$urlService', getProviderFor('urlService')); -mod_util.provider('$urlMatcherFactory', ['$uiRouterProvider', function () { return router.urlMatcherFactory; }]); -mod_util.provider('$templateFactory', function () { return new _templateFactory__WEBPACK_IMPORTED_MODULE_3__.TemplateFactory(); }); -mod_state.provider('$stateRegistry', getProviderFor('stateRegistry')); -mod_state.provider('$uiRouterGlobals', getProviderFor('globals')); -mod_state.provider('$transitions', getProviderFor('transitionService')); -mod_state.provider('$state', ['$uiRouterProvider', getStateProvider]); -mod_state.factory('$stateParams', ['$uiRouter', function ($uiRouter) { return $uiRouter.globals.params; }]); -mod_main.factory('$view', function () { return router.viewService; }); -mod_main.service('$trace', function () { return _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.trace; }); -mod_main.run(watchDigests); -mod_util.run(['$urlMatcherFactory', function ($urlMatcherFactory) { }]); -mod_state.run(['$state', function ($state) { }]); -mod_rtr.run(['$urlRouter', function ($urlRouter) { }]); -mod_init.run(runBlock); -/** @hidden TODO: find a place to move this */ -var getLocals = function (ctx) { - var tokens = ctx.getTokens().filter(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isString); - var tuples = tokens.map(function (key) { - var resolvable = ctx.getResolvable(key); - var waitPolicy = ctx.getPolicy(resolvable).async; - return [key, waitPolicy === 'NOWAIT' ? resolvable.promise : resolvable.data]; - }); - return tuples.reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.applyPairs, {}); -}; -//# sourceMappingURL=services.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js": -/*!******************************************************************!*\ - !*** ./node_modules/@uirouter/angularjs/lib-esm/stateFilters.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "$IsStateFilter": () => (/* binding */ $IsStateFilter), -/* harmony export */ "$IncludedByStateFilter": () => (/* binding */ $IncludedByStateFilter) -/* harmony export */ }); -/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); -/** @publicapi @module ng1 */ /** */ - -/** - * `isState` Filter: truthy if the current state is the parameter - * - * Translates to [[StateService.is]] `$state.is("stateName")`. - * - * #### Example: - * ```html - *
    show if state is 'stateName'
    - * ``` - */ -$IsStateFilter.$inject = ['$state']; -function $IsStateFilter($state) { - var isFilter = function (state, params, options) { - return $state.is(state, params, options); - }; - isFilter.$stateful = true; - return isFilter; -} -/** - * `includedByState` Filter: truthy if the current state includes the parameter - * - * Translates to [[StateService.includes]]` $state.is("fullOrPartialStateName")`. - * - * #### Example: - * ```html - *
    show if state includes 'fullOrPartialStateName'
    - * ``` - */ -$IncludedByStateFilter.$inject = ['$state']; -function $IncludedByStateFilter($state) { - var includesFilter = function (state, params, options) { - return $state.includes(state, params, options); - }; - includesFilter.$stateful = true; - return includesFilter; -} -_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state').filter('isState', $IsStateFilter).filter('includedByState', $IncludedByStateFilter); - -//# sourceMappingURL=stateFilters.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@uirouter/angularjs/lib-esm/stateProvider.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "StateProvider": () => (/* binding */ StateProvider) -/* harmony export */ }); -/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); -/** @publicapi @module ng1 */ /** */ - -/** - * The Angular 1 `StateProvider` - * - * The `$stateProvider` works similar to Angular's v1 router, but it focuses purely - * on state. - * - * A state corresponds to a "place" in the application in terms of the overall UI and - * navigation. A state describes (via the controller / template / view properties) what - * the UI looks like and does at that place. - * - * States often have things in common, and the primary way of factoring out these - * commonalities in this model is via the state hierarchy, i.e. parent/child states aka - * nested states. - * - * The `$stateProvider` provides interfaces to declare these states for your app. - */ -var StateProvider = /** @class */ (function () { - function StateProvider(stateRegistry, stateService) { - this.stateRegistry = stateRegistry; - this.stateService = stateService; - (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)(StateProvider.prototype), this, (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.val)(this)); - } - /** - * Decorates states when they are registered - * - * Allows you to extend (carefully) or override (at your own peril) the - * `stateBuilder` object used internally by [[StateRegistry]]. - * This can be used to add custom functionality to ui-router, - * for example inferring templateUrl based on the state name. - * - * When passing only a name, it returns the current (original or decorated) builder - * function that matches `name`. - * - * The builder functions that can be decorated are listed below. Though not all - * necessarily have a good use case for decoration, that is up to you to decide. - * - * In addition, users can attach custom decorators, which will generate new - * properties within the state's internal definition. There is currently no clear - * use-case for this beyond accessing internal states (i.e. $state.$current), - * however, expect this to become increasingly relevant as we introduce additional - * meta-programming features. - * - * **Warning**: Decorators should not be interdependent because the order of - * execution of the builder functions in non-deterministic. Builder functions - * should only be dependent on the state definition object and super function. - * - * - * Existing builder functions and current return values: - * - * - **parent** `{object}` - returns the parent state object. - * - **data** `{object}` - returns state data, including any inherited data that is not - * overridden by own values (if any). - * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher} - * or `null`. - * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is - * navigable). - * - **params** `{object}` - returns an array of state params that are ensured to - * be a super-set of parent's params. - * - **views** `{object}` - returns a views object where each key is an absolute view - * name (i.e. "viewName@stateName") and each value is the config object - * (template, controller) for the view. Even when you don't use the views object - * explicitly on a state config, one is still created for you internally. - * So by decorating this builder function you have access to decorating template - * and controller properties. - * - **ownParams** `{object}` - returns an array of params that belong to the state, - * not including any params defined by ancestor states. - * - **path** `{string}` - returns the full path from the root down to this state. - * Needed for state activation. - * - **includes** `{object}` - returns an object that includes every state that - * would pass a `$state.includes()` test. - * - * #### Example: - * Override the internal 'views' builder with a function that takes the state - * definition, and a reference to the internal function being overridden: - * ```js - * $stateProvider.decorator('views', function (state, parent) { - * let result = {}, - * views = parent(state); - * - * angular.forEach(views, function (config, name) { - * let autoName = (state.name + '.' + name).replace('.', '/'); - * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html'; - * result[name] = config; - * }); - * return result; - * }); - * - * $stateProvider.state('home', { - * views: { - * 'contact.list': { controller: 'ListController' }, - * 'contact.item': { controller: 'ItemController' } - * } - * }); - * ``` - * - * - * ```js - * // Auto-populates list and item views with /partials/home/contact/list.html, - * // and /partials/home/contact/item.html, respectively. - * $state.go('home'); - * ``` - * - * @param {string} name The name of the builder function to decorate. - * @param {object} func A function that is responsible for decorating the original - * builder function. The function receives two parameters: - * - * - `{object}` - state - The state config object. - * - `{object}` - super - The original builder function. - * - * @return {object} $stateProvider - $stateProvider instance - */ - StateProvider.prototype.decorator = function (name, func) { - return this.stateRegistry.decorator(name, func) || this; - }; - StateProvider.prototype.state = function (name, definition) { - if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isObject)(name)) { - definition = name; - } - else { - definition.name = name; - } - this.stateRegistry.register(definition); - return this; - }; - /** - * Registers an invalid state handler - * - * This is a passthrough to [[StateService.onInvalid]] for ng1. - */ - StateProvider.prototype.onInvalid = function (callback) { - return this.stateService.onInvalid(callback); - }; - return StateProvider; -}()); - -//# sourceMappingURL=stateProvider.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/onEnterExitRetain.js": -/*!*************************************************************************************!*\ - !*** ./node_modules/@uirouter/angularjs/lib-esm/statebuilders/onEnterExitRetain.js ***! - \*************************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "getStateHookBuilder": () => (/* binding */ getStateHookBuilder) -/* harmony export */ }); -/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); -/* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../services */ "./node_modules/@uirouter/angularjs/lib-esm/services.js"); -/** @publicapi @module ng1 */ /** */ - - -/** - * This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`, - * `onRetain` callback hooks on a [[Ng1StateDeclaration]]. - * - * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder - * ensures that those hooks are injectable for @uirouter/angularjs (ng1). - * - * @internalapi - */ -var getStateHookBuilder = function (hookName) { - return function stateHookBuilder(stateObject) { - var hook = stateObject[hookName]; - var pathname = hookName === 'onExit' ? 'from' : 'to'; - function decoratedNg1Hook(trans, state) { - var resolveContext = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(trans.treeChanges(pathname)); - var subContext = resolveContext.subContext(state.$$state()); - var locals = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)((0,_services__WEBPACK_IMPORTED_MODULE_1__.getLocals)(subContext), { $state$: state, $transition$: trans }); - return _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.invoke(hook, this, locals); - } - return hook ? decoratedNg1Hook : undefined; - }; -}; -//# sourceMappingURL=onEnterExitRetain.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@uirouter/angularjs/lib-esm/statebuilders/views.js ***! - \*************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "getNg1ViewConfigFactory": () => (/* binding */ getNg1ViewConfigFactory), -/* harmony export */ "ng1ViewsBuilder": () => (/* binding */ ng1ViewsBuilder), -/* harmony export */ "Ng1ViewConfig": () => (/* binding */ Ng1ViewConfig) -/* harmony export */ }); -/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); -/** @publicapi @module ng1 */ /** */ - -/** @internalapi */ -function getNg1ViewConfigFactory() { - var templateFactory = null; - return function (path, view) { - templateFactory = templateFactory || _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.get('$templateFactory'); - return [new Ng1ViewConfig(path, view, templateFactory)]; - }; -} -/** @internalapi */ -var hasAnyKey = function (keys, obj) { return keys.reduce(function (acc, key) { return acc || (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(obj[key]); }, false); }; -/** - * This is a [[StateBuilder.builder]] function for angular1 `views`. - * - * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder - * handles the `views` property with logic specific to @uirouter/angularjs (ng1). - * - * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object - * and applies the state-level configuration to a view named `$default`. - * - * @internalapi - */ -function ng1ViewsBuilder(state) { - // Do not process root state - if (!state.parent) - return {}; - var tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'], ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'], compKeys = ['component', 'bindings', 'componentProvider'], nonCompKeys = tplKeys.concat(ctrlKeys), allViewKeys = compKeys.concat(nonCompKeys); - // Do not allow a state to have both state-level props and also a `views: {}` property. - // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state. - // However, the `$default` approach should not be mixed with a separate `views: ` block. - if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(state.views) && hasAnyKey(allViewKeys, state)) { - throw new Error("State '" + state.name + "' has a 'views' object. " + - "It cannot also have \"view properties\" at the state level. " + - "Move the following properties into a view (in the 'views' object): " + - (" " + allViewKeys.filter(function (key) { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isDefined)(state[key]); }).join(', '))); - } - var views = {}, viewsObject = state.views || { $default: (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.pick)(state, allViewKeys) }; - (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.forEach)(viewsObject, function (config, name) { - // Account for views: { "": { template... } } - name = name || '$default'; - // Account for views: { header: "headerComponent" } - if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isString)(config)) - config = { component: config }; - // Make a shallow copy of the config object - config = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)({}, config); - // Do not allow a view to mix props for component-style view with props for template/controller-style view - if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) { - throw new Error("Cannot combine: " + compKeys.join('|') + " with: " + nonCompKeys.join('|') + " in stateview: '" + name + "@" + state.name + "'"); - } - config.resolveAs = config.resolveAs || '$resolve'; - config.$type = 'ng1'; - config.$context = state; - config.$name = name; - var normalized = _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ViewService.normalizeUIViewTarget(config.$context, config.$name); - config.$uiViewName = normalized.uiViewName; - config.$uiViewContextAnchor = normalized.uiViewContextAnchor; - views[name] = config; - }); - return views; -} -/** @hidden */ -var id = 0; -/** @internalapi */ -var Ng1ViewConfig = /** @class */ (function () { - function Ng1ViewConfig(path, viewDecl, factory) { - var _this = this; - this.path = path; - this.viewDecl = viewDecl; - this.factory = factory; - this.$id = id++; - this.loaded = false; - this.getTemplate = function (uiView, context) { - return _this.component - ? _this.factory.makeComponentTemplate(uiView, context, _this.component, _this.viewDecl.bindings) - : _this.template; - }; - } - Ng1ViewConfig.prototype.load = function () { - var _this = this; - var $q = _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$q; - var context = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.ResolveContext(this.path); - var params = this.path.reduce(function (acc, node) { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)(acc, node.paramValues); }, {}); - var promises = { - template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)), - controller: $q.when(this.getController(context)), - }; - return $q.all(promises).then(function (results) { - _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.trace.traceViewServiceEvent('Loaded', _this); - _this.controller = results.controller; - (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.extend)(_this, results.template); // Either { template: "tpl" } or { component: "cmpName" } - return _this; - }); - }; - /** - * Gets the controller for a view configuration. - * - * @returns {Function|Promise.} Returns a controller, or a promise that resolves to a controller. - */ - Ng1ViewConfig.prototype.getController = function (context) { - var provider = this.viewDecl.controllerProvider; - if (!(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isInjectable)(provider)) - return this.viewDecl.controller; - var deps = _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.annotate(provider); - var providerFn = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isArray)(provider) ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.tail)(provider) : provider; - var resolvable = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.Resolvable('', providerFn, deps); - return resolvable.get(context); - }; - return Ng1ViewConfig; -}()); - -//# sourceMappingURL=views.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/angularjs/lib-esm/templateFactory.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@uirouter/angularjs/lib-esm/templateFactory.js ***! - \*********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TemplateFactory": () => (/* binding */ TemplateFactory) -/* harmony export */ }); -/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); -/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); -/** @publicapi @module view */ /** */ - - -/** - * Service which manages loading of templates from a ViewConfig. - */ -var TemplateFactory = /** @class */ (function () { - function TemplateFactory() { - var _this = this; - /** @hidden */ this._useHttp = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.version.minor < 3; - /** @hidden */ this.$get = [ - '$http', - '$templateCache', - '$injector', - function ($http, $templateCache, $injector) { - _this.$templateRequest = $injector.has && $injector.has('$templateRequest') && $injector.get('$templateRequest'); - _this.$http = $http; - _this.$templateCache = $templateCache; - return _this; - }, - ]; - } - /** @hidden */ - TemplateFactory.prototype.useHttpService = function (value) { - this._useHttp = value; - }; - /** - * Creates a template from a configuration object. - * - * @param config Configuration object for which to load a template. - * The following properties are search in the specified order, and the first one - * that is defined is used to create the template: - * - * @param params Parameters to pass to the template function. - * @param context The resolve context associated with the template's view - * - * @return {string|object} The template html as a string, or a promise for - * that string,or `null` if no template is configured. - */ - TemplateFactory.prototype.fromConfig = function (config, params, context) { - var defaultTemplate = ''; - var asTemplate = function (result) { return _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(result).then(function (str) { return ({ template: str }); }); }; - var asComponent = function (result) { return _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(result).then(function (str) { return ({ component: str }); }); }; - return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.template) - ? asTemplate(this.fromString(config.template, params)) - : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.templateUrl) - ? asTemplate(this.fromUrl(config.templateUrl, params)) - : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.templateProvider) - ? asTemplate(this.fromProvider(config.templateProvider, params, context)) - : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.component) - ? asComponent(config.component) - : (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(config.componentProvider) - ? asComponent(this.fromComponentProvider(config.componentProvider, params, context)) - : asTemplate(defaultTemplate); - }; - /** - * Creates a template from a string or a function returning a string. - * - * @param template html template as a string or function that returns an html template as a string. - * @param params Parameters to pass to the template function. - * - * @return {string|object} The template html as a string, or a promise for that - * string. - */ - TemplateFactory.prototype.fromString = function (template, params) { - return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isFunction)(template) ? template(params) : template; - }; - /** - * Loads a template from the a URL via `$http` and `$templateCache`. - * - * @param {string|Function} url url of the template to load, or a function - * that returns a url. - * @param {Object} params Parameters to pass to the url function. - * @return {string|Promise.} The template html as a string, or a promise - * for that string. - */ - TemplateFactory.prototype.fromUrl = function (url, params) { - if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isFunction)(url)) - url = url(params); - if (url == null) - return null; - if (this._useHttp) { - return this.$http - .get(url, { cache: this.$templateCache, headers: { Accept: 'text/html' } }) - .then(function (response) { - return response.data; - }); - } - return this.$templateRequest(url); - }; - /** - * Creates a template by invoking an injectable provider function. - * - * @param provider Function to invoke via `locals` - * @param {Function} injectFn a function used to invoke the template provider - * @return {string|Promise.} The template html as a string, or a promise - * for that string. - */ - TemplateFactory.prototype.fromProvider = function (provider, params, context) { - var deps = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.annotate(provider); - var providerFn = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(provider) ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.tail)(provider) : provider; - var resolvable = new _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.Resolvable('', providerFn, deps); - return resolvable.get(context); - }; - /** - * Creates a component's template by invoking an injectable provider function. - * - * @param provider Function to invoke via `locals` - * @param {Function} injectFn a function used to invoke the template provider - * @return {string} The template html as a string: "". - */ - TemplateFactory.prototype.fromComponentProvider = function (provider, params, context) { - var deps = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.annotate(provider); - var providerFn = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(provider) ? (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.tail)(provider) : provider; - var resolvable = new _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.Resolvable('', providerFn, deps); - return resolvable.get(context); - }; - /** - * Creates a template from a component's name - * - * This implements route-to-component. - * It works by retrieving the component (directive) metadata from the injector. - * It analyses the component's bindings, then constructs a template that instantiates the component. - * The template wires input and output bindings to resolves or from the parent component. - * - * @param uiView {object} The parent ui-view (for binding outputs to callbacks) - * @param context The ResolveContext (for binding outputs to callbacks returned from resolves) - * @param component {string} Component's name in camel case. - * @param bindings An object defining the component's bindings: {foo: '<'} - * @return {string} The template as a string: "". - */ - TemplateFactory.prototype.makeComponentTemplate = function (uiView, context, component, bindings) { - bindings = bindings || {}; - // Bind once prefix - var prefix = _angular__WEBPACK_IMPORTED_MODULE_0__.ng.version.minor >= 3 ? '::' : ''; - // Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-` - var kebob = function (camelCase) { - var kebobed = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.kebobString)(camelCase); - return /^(x|data)-/.exec(kebobed) ? "x-" + kebobed : kebobed; - }; - var attributeTpl = function (input) { - var name = input.name, type = input.type; - var attrName = kebob(name); - // If the ui-view has an attribute which matches a binding on the routed component - // then pass that attribute through to the routed component template. - // Prefer ui-view wired mappings to resolve data, unless the resolve was explicitly bound using `bindings:` - if (uiView.attr(attrName) && !bindings[name]) - return attrName + "='" + uiView.attr(attrName) + "'"; - var resolveName = bindings[name] || name; - // Pre-evaluate the expression for "@" bindings by enclosing in {{ }} - // some-attr="{{ ::$resolve.someResolveName }}" - if (type === '@') - return attrName + "='{{" + prefix + "$resolve." + resolveName + "}}'"; - // Wire "&" callbacks to resolves that return a callback function - // Get the result of the resolve (should be a function) and annotate it to get its arguments. - // some-attr="$resolve.someResolveResultName(foo, bar)" - if (type === '&') { - var res = context.getResolvable(resolveName); - var fn = res && res.data; - var args = (fn && _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.annotate(fn)) || []; - // account for array style injection, i.e., ['foo', function(foo) {}] - var arrayIdxStr = (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(fn) ? "[" + (fn.length - 1) + "]" : ''; - return attrName + "='$resolve." + resolveName + arrayIdxStr + "(" + args.join(',') + ")'"; - } - // some-attr="::$resolve.someResolveName" - return attrName + "='" + prefix + "$resolve." + resolveName + "'"; - }; - var attrs = getComponentBindings(component).map(attributeTpl).join(' '); - var kebobName = kebob(component); - return "<" + kebobName + " " + attrs + ">"; - }; - return TemplateFactory; -}()); - -// Gets all the directive(s)' inputs ('@', '=', and '<') and outputs ('&') -function getComponentBindings(name) { - var cmpDefs = _uirouter_core__WEBPACK_IMPORTED_MODULE_1__.services.$injector.get(name + 'Directive'); // could be multiple - if (!cmpDefs || !cmpDefs.length) - throw new Error("Unable to find component named '" + name + "'"); - return cmpDefs.map(getBindings).reduce(_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.unnestR, []); -} -// Given a directive definition, find its object input attributes -// Use different properties, depending on the type of directive (component, bindToController, normal) -var getBindings = function (def) { - if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isObject)(def.bindToController)) - return scopeBindings(def.bindToController); - return scopeBindings(def.scope); -}; -// for ng 1.2 style, process the scope: { input: "=foo" } -// for ng 1.3 through ng 1.5, process the component's bindToController: { input: "=foo" } object -var scopeBindings = function (bindingsObj) { - return Object.keys(bindingsObj || {}) - // [ 'input', [ '=foo', '=', 'foo' ] ] - .map(function (key) { return [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])]; }) - // skip malformed values - .filter(function (tuple) { return (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isDefined)(tuple) && (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_1__.isArray)(tuple[1]); }) - // { name: ('foo' || 'input'), type: '=' } - .map(function (tuple) { return ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] }); }); -}; -//# sourceMappingURL=templateFactory.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@uirouter/angularjs/lib-esm/urlRouterProvider.js ***! - \***********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "UrlRouterProvider": () => (/* binding */ UrlRouterProvider) -/* harmony export */ }); -/* harmony import */ var _uirouter_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @uirouter/core */ "./node_modules/@uirouter/core/lib-esm/index.js"); -/** @publicapi @module url */ /** */ - - -/** - * Manages rules for client-side URL - * - * ### Deprecation warning: - * This class is now considered to be an internal API - * Use the [[UrlService]] instead. - * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]]. - * - * This class manages the router rules for what to do when the URL changes. - * - * This provider remains for backwards compatibility. - * - * @internalapi - * @deprecated - */ -var UrlRouterProvider = /** @class */ (function () { - /** @hidden */ - function UrlRouterProvider(/** @hidden */ router) { - this.router = router; - } - UrlRouterProvider.injectableHandler = function (router, handler) { - return function (match) { return _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params }); }; - }; - /** @hidden */ - UrlRouterProvider.prototype.$get = function () { - var urlService = this.router.urlService; - this.router.urlRouter.update(true); - if (!urlService.interceptDeferred) - urlService.listen(); - return this.router.urlRouter; - }; - /** - * Registers a url handler function. - * - * Registers a low level url handler (a `rule`). - * A rule detects specific URL patterns and returns a redirect, or performs some action. - * - * If a rule returns a string, the URL is replaced with the string, and all rules are fired again. - * - * #### Example: - * ```js - * var app = angular.module('app', ['ui.router.router']); - * - * app.config(function ($urlRouterProvider) { - * // Here's an example of how you might allow case insensitive urls - * $urlRouterProvider.rule(function ($injector, $location) { - * var path = $location.path(), - * normalized = path.toLowerCase(); - * - * if (path !== normalized) { - * return normalized; - * } - * }); - * }); - * ``` - * - * @param ruleFn - * Handler function that takes `$injector` and `$location` services as arguments. - * You can use them to detect a url and return a different url as a string. - * - * @return [[UrlRouterProvider]] (`this`) - */ - UrlRouterProvider.prototype.rule = function (ruleFn) { - var _this = this; - if (!(0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(ruleFn)) - throw new Error("'rule' must be a function"); - var match = function () { return ruleFn(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector, _this.router.locationService); }; - var rule = new _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.BaseUrlRule(match, _uirouter_core__WEBPACK_IMPORTED_MODULE_0__.identity); - this.router.urlService.rules.rule(rule); - return this; - }; - /** - * Defines the path or behavior to use when no url can be matched. - * - * #### Example: - * ```js - * var app = angular.module('app', ['ui.router.router']); - * - * app.config(function ($urlRouterProvider) { - * // if the path doesn't match any of the urls you configured - * // otherwise will take care of routing the user to the - * // specified url - * $urlRouterProvider.otherwise('/index'); - * - * // Example of using function rule as param - * $urlRouterProvider.otherwise(function ($injector, $location) { - * return '/a/valid/url'; - * }); - * }); - * ``` - * - * @param rule - * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`. - * The function version is passed two params: `$injector` and `$location` services, and should return a url string. - * - * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance - */ - UrlRouterProvider.prototype.otherwise = function (rule) { - var _this = this; - var urlRules = this.router.urlService.rules; - if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isString)(rule)) { - urlRules.otherwise(rule); - } - else if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(rule)) { - urlRules.otherwise(function () { return rule(_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.services.$injector, _this.router.locationService); }); - } - else { - throw new Error("'rule' must be a string or function"); - } - return this; - }; - /** - * Registers a handler for a given url matching. - * - * If the handler is a string, it is - * treated as a redirect, and is interpolated according to the syntax of match - * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise). - * - * If the handler is a function, it is injectable. - * It gets invoked if `$location` matches. - * You have the option of inject the match object as `$match`. - * - * The handler can return - * - * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter` - * will continue trying to find another one that matches. - * - **string** which is treated as a redirect and passed to `$location.url()` - * - **void** or any **truthy** value tells `$urlRouter` that the url was handled. - * - * #### Example: - * ```js - * var app = angular.module('app', ['ui.router.router']); - * - * app.config(function ($urlRouterProvider) { - * $urlRouterProvider.when($state.url, function ($match, $stateParams) { - * if ($state.$current.navigable !== state || - * !equalForKeys($match, $stateParams) { - * $state.transitionTo(state, $match, false); - * } - * }); - * }); - * ``` - * - * @param what A pattern string to match, compiled as a [[UrlMatcher]]. - * @param handler The path (or function that returns a path) that you want to redirect your user to. - * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]] - * - * Note: the handler may also invoke arbitrary code, such as `$state.go()` - */ - UrlRouterProvider.prototype.when = function (what, handler) { - if ((0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isArray)(handler) || (0,_uirouter_core__WEBPACK_IMPORTED_MODULE_0__.isFunction)(handler)) { - handler = UrlRouterProvider.injectableHandler(this.router, handler); - } - this.router.urlService.rules.when(what, handler); - return this; - }; - /** - * Disables monitoring of the URL. - * - * Call this method before UI-Router has bootstrapped. - * It will stop UI-Router from performing the initial url sync. - * - * This can be useful to perform some asynchronous initialization before the router starts. - * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL. - * - * #### Example: - * ```js - * var app = angular.module('app', ['ui.router']); - * - * app.config(function ($urlRouterProvider) { - * // Prevent $urlRouter from automatically intercepting URL changes; - * $urlRouterProvider.deferIntercept(); - * }) - * - * app.run(function (MyService, $urlRouter, $http) { - * $http.get("/stuff").then(function(resp) { - * MyService.doStuff(resp.data); - * $urlRouter.listen(); - * $urlRouter.sync(); - * }); - * }); - * ``` - * - * @param defer Indicates whether to defer location change interception. - * Passing no parameter is equivalent to `true`. - */ - UrlRouterProvider.prototype.deferIntercept = function (defer) { - this.router.urlService.deferIntercept(defer); - }; - return UrlRouterProvider; -}()); - -//# sourceMappingURL=urlRouterProvider.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js": -/*!****************************************************************!*\ - !*** ./node_modules/@uirouter/angularjs/lib-esm/viewScroll.js ***! - \****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _angular__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angular */ "./node_modules/@uirouter/angularjs/lib-esm/angular.js"); -/** @publicapi @module ng1 */ /** */ - -/** @hidden */ -function $ViewScrollProvider() { - var useAnchorScroll = false; - this.useAnchorScroll = function () { - useAnchorScroll = true; - }; - this.$get = [ - '$anchorScroll', - '$timeout', - function ($anchorScroll, $timeout) { - if (useAnchorScroll) { - return $anchorScroll; - } - return function ($element) { - return $timeout(function () { - $element[0].scrollIntoView(); - }, 0, false); - }; - }, - ]; -} -_angular__WEBPACK_IMPORTED_MODULE_0__.ng.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider); -//# sourceMappingURL=viewScroll.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/common/common.js": -/*!**************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/common/common.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "root": () => (/* binding */ root), -/* harmony export */ "fromJson": () => (/* binding */ fromJson), -/* harmony export */ "toJson": () => (/* binding */ toJson), -/* harmony export */ "forEach": () => (/* binding */ forEach), -/* harmony export */ "extend": () => (/* binding */ extend), -/* harmony export */ "equals": () => (/* binding */ equals), -/* harmony export */ "identity": () => (/* binding */ identity), -/* harmony export */ "noop": () => (/* binding */ noop), -/* harmony export */ "createProxyFunctions": () => (/* binding */ createProxyFunctions), -/* harmony export */ "inherit": () => (/* binding */ inherit), -/* harmony export */ "inArray": () => (/* binding */ inArray), -/* harmony export */ "_inArray": () => (/* binding */ _inArray), -/* harmony export */ "removeFrom": () => (/* binding */ removeFrom), -/* harmony export */ "_removeFrom": () => (/* binding */ _removeFrom), -/* harmony export */ "pushTo": () => (/* binding */ pushTo), -/* harmony export */ "_pushTo": () => (/* binding */ _pushTo), -/* harmony export */ "deregAll": () => (/* binding */ deregAll), -/* harmony export */ "defaults": () => (/* binding */ defaults), -/* harmony export */ "mergeR": () => (/* binding */ mergeR), -/* harmony export */ "ancestors": () => (/* binding */ ancestors), -/* harmony export */ "pick": () => (/* binding */ pick), -/* harmony export */ "omit": () => (/* binding */ omit), -/* harmony export */ "pluck": () => (/* binding */ pluck), -/* harmony export */ "filter": () => (/* binding */ filter), -/* harmony export */ "find": () => (/* binding */ find), -/* harmony export */ "mapObj": () => (/* binding */ mapObj), -/* harmony export */ "map": () => (/* binding */ map), -/* harmony export */ "values": () => (/* binding */ values), -/* harmony export */ "allTrueR": () => (/* binding */ allTrueR), -/* harmony export */ "anyTrueR": () => (/* binding */ anyTrueR), -/* harmony export */ "unnestR": () => (/* binding */ unnestR), -/* harmony export */ "flattenR": () => (/* binding */ flattenR), -/* harmony export */ "pushR": () => (/* binding */ pushR), -/* harmony export */ "uniqR": () => (/* binding */ uniqR), -/* harmony export */ "unnest": () => (/* binding */ unnest), -/* harmony export */ "flatten": () => (/* binding */ flatten), -/* harmony export */ "assertPredicate": () => (/* binding */ assertPredicate), -/* harmony export */ "assertMap": () => (/* binding */ assertMap), -/* harmony export */ "assertFn": () => (/* binding */ assertFn), -/* harmony export */ "pairs": () => (/* binding */ pairs), -/* harmony export */ "arrayTuples": () => (/* binding */ arrayTuples), -/* harmony export */ "applyPairs": () => (/* binding */ applyPairs), -/* harmony export */ "tail": () => (/* binding */ tail), -/* harmony export */ "copy": () => (/* binding */ copy), -/* harmony export */ "_extend": () => (/* binding */ _extend), -/* harmony export */ "silenceUncaughtInPromise": () => (/* binding */ silenceUncaughtInPromise), -/* harmony export */ "silentRejection": () => (/* binding */ silentRejection) -/* harmony export */ }); -/* harmony import */ var _predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _coreservices__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); -var __spreadArrays = (undefined && undefined.__spreadArrays) || function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -}; -/** - * Random utility functions used in the UI-Router code - * - * These functions are exported, but are subject to change without notice. - * - * @packageDocumentation - * @preferred - */ - - - -var root = (typeof self === 'object' && self.self === self && self) || - (typeof __webpack_require__.g === 'object' && __webpack_require__.g.global === __webpack_require__.g && __webpack_require__.g) || - undefined; -var angular = root.angular || {}; -var fromJson = angular.fromJson || JSON.parse.bind(JSON); -var toJson = angular.toJson || JSON.stringify.bind(JSON); -var forEach = angular.forEach || _forEach; -var extend = Object.assign || _extend; -var equals = angular.equals || _equals; -function identity(x) { - return x; -} -function noop() { } -/** - * Builds proxy functions on the `to` object which pass through to the `from` object. - * - * For each key in `fnNames`, creates a proxy function on the `to` object. - * The proxy function calls the real function on the `from` object. - * - * - * #### Example: - * This example creates an new class instance whose functions are prebound to the new'd object. - * ```js - * class Foo { - * constructor(data) { - * // Binds all functions from Foo.prototype to 'this', - * // then copies them to 'this' - * bindFunctions(Foo.prototype, this, this); - * this.data = data; - * } - * - * log() { - * console.log(this.data); - * } - * } - * - * let myFoo = new Foo([1,2,3]); - * var logit = myFoo.log; - * logit(); // logs [1, 2, 3] from the myFoo 'this' instance - * ``` - * - * #### Example: - * This example creates a bound version of a service function, and copies it to another object - * ``` - * - * var SomeService = { - * this.data = [3, 4, 5]; - * this.log = function() { - * console.log(this.data); - * } - * } - * - * // Constructor fn - * function OtherThing() { - * // Binds all functions from SomeService to SomeService, - * // then copies them to 'this' - * bindFunctions(SomeService, this, SomeService); - * } - * - * let myOtherThing = new OtherThing(); - * myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this' - * ``` - * - * @param source A function that returns the source object which contains the original functions to be bound - * @param target A function that returns the target object which will receive the bound functions - * @param bind A function that returns the object which the functions will be bound to - * @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object) - * @param latebind If true, the binding of the function is delayed until the first time it's invoked - */ -function createProxyFunctions(source, target, bind, fnNames, latebind) { - if (latebind === void 0) { latebind = false; } - var bindFunction = function (fnName) { return source()[fnName].bind(bind()); }; - var makeLateRebindFn = function (fnName) { - return function lateRebindFunction() { - target[fnName] = bindFunction(fnName); - return target[fnName].apply(null, arguments); - }; - }; - fnNames = fnNames || Object.keys(source()); - return fnNames.reduce(function (acc, name) { - acc[name] = latebind ? makeLateRebindFn(name) : bindFunction(name); - return acc; - }, target); -} -/** - * prototypal inheritance helper. - * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it - */ -var inherit = function (parent, extra) { return extend(Object.create(parent), extra); }; -/** Given an array, returns true if the object is found in the array, (using indexOf) */ -var inArray = (0,_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(_inArray); -function _inArray(array, obj) { - return array.indexOf(obj) !== -1; -} -/** - * Given an array, and an item, if the item is found in the array, it removes it (in-place). - * The same array is returned - */ -var removeFrom = (0,_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(_removeFrom); -function _removeFrom(array, obj) { - var idx = array.indexOf(obj); - if (idx >= 0) - array.splice(idx, 1); - return array; -} -/** pushes a values to an array and returns the value */ -var pushTo = (0,_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(_pushTo); -function _pushTo(arr, val) { - return arr.push(val), val; -} -/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */ -var deregAll = function (functions) { - return functions.slice().forEach(function (fn) { - typeof fn === 'function' && fn(); - removeFrom(functions, fn); - }); -}; -/** - * Applies a set of defaults to an options object. The options object is filtered - * to only those properties of the objects in the defaultsList. - * Earlier objects in the defaultsList take precedence when applying defaults. - */ -function defaults(opts) { - var defaultsList = []; - for (var _i = 1; _i < arguments.length; _i++) { - defaultsList[_i - 1] = arguments[_i]; - } - var defaultVals = extend.apply(void 0, __spreadArrays([{}], defaultsList.reverse())); - return extend(defaultVals, pick(opts || {}, Object.keys(defaultVals))); -} -/** Reduce function that merges each element of the list into a single object, using extend */ -var mergeR = function (memo, item) { return extend(memo, item); }; -/** - * Finds the common ancestor path between two states. - * - * @param {Object} first The first state. - * @param {Object} second The second state. - * @return {Array} Returns an array of state names in descending order, not including the root. - */ -function ancestors(first, second) { - var path = []; - // tslint:disable-next-line:forin - for (var n in first.path) { - if (first.path[n] !== second.path[n]) - break; - path.push(first.path[n]); - } - return path; -} -/** - * Return a copy of the object only containing the whitelisted properties. - * - * #### Example: - * ``` - * var foo = { a: 1, b: 2, c: 3 }; - * var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 } - * ``` - * @param obj the source object - * @param propNames an Array of strings, which are the whitelisted property names - */ -function pick(obj, propNames) { - var objCopy = {}; - for (var _prop in obj) { - if (propNames.indexOf(_prop) !== -1) { - objCopy[_prop] = obj[_prop]; - } - } - return objCopy; -} -/** - * Return a copy of the object omitting the blacklisted properties. - * - * @example - * ``` - * - * var foo = { a: 1, b: 2, c: 3 }; - * var ab = omit(foo, ['a', 'b']); // { c: 3 } - * ``` - * @param obj the source object - * @param propNames an Array of strings, which are the blacklisted property names - */ -function omit(obj, propNames) { - return Object.keys(obj) - .filter((0,_hof__WEBPACK_IMPORTED_MODULE_1__.not)(inArray(propNames))) - .reduce(function (acc, key) { return ((acc[key] = obj[key]), acc); }, {}); -} -/** - * Maps an array, or object to a property (by name) - */ -function pluck(collection, propName) { - return map(collection, (0,_hof__WEBPACK_IMPORTED_MODULE_1__.prop)(propName)); -} -/** Filters an Array or an Object's properties based on a predicate */ -function filter(collection, callback) { - var arr = (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(collection), result = arr ? [] : {}; - var accept = arr ? function (x) { return result.push(x); } : function (x, key) { return (result[key] = x); }; - forEach(collection, function (item, i) { - if (callback(item, i)) - accept(item, i); - }); - return result; -} -/** Finds an object from an array, or a property of an object, that matches a predicate */ -function find(collection, callback) { - var result; - forEach(collection, function (item, i) { - if (result) - return; - if (callback(item, i)) - result = item; - }); - return result; -} -/** Given an object, returns a new object, where each property is transformed by the callback function */ -var mapObj = map; -/** Maps an array or object properties using a callback function */ -function map(collection, callback, target) { - target = target || ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(collection) ? [] : {}); - forEach(collection, function (item, i) { return (target[i] = callback(item, i)); }); - return target; -} -/** - * Given an object, return its enumerable property values - * - * @example - * ``` - * - * let foo = { a: 1, b: 2, c: 3 } - * let vals = values(foo); // [ 1, 2, 3 ] - * ``` - */ -var values = function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); }; -/** - * Reduce function that returns true if all of the values are truthy. - * - * @example - * ``` - * - * let vals = [ 1, true, {}, "hello world"]; - * vals.reduce(allTrueR, true); // true - * - * vals.push(0); - * vals.reduce(allTrueR, true); // false - * ``` - */ -var allTrueR = function (memo, elem) { return memo && elem; }; -/** - * Reduce function that returns true if any of the values are truthy. - * - * * @example - * ``` - * - * let vals = [ 0, null, undefined ]; - * vals.reduce(anyTrueR, true); // false - * - * vals.push("hello world"); - * vals.reduce(anyTrueR, true); // true - * ``` - */ -var anyTrueR = function (memo, elem) { return memo || elem; }; -/** - * Reduce function which un-nests a single level of arrays - * @example - * ``` - * - * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; - * input.reduce(unnestR, []) // [ "a", "b", "c", "d", [ "double, "nested" ] ] - * ``` - */ -var unnestR = function (memo, elem) { return memo.concat(elem); }; -/** - * Reduce function which recursively un-nests all arrays - * - * @example - * ``` - * - * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; - * input.reduce(unnestR, []) // [ "a", "b", "c", "d", "double, "nested" ] - * ``` - */ -var flattenR = function (memo, elem) { - return (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(elem) ? memo.concat(elem.reduce(flattenR, [])) : pushR(memo, elem); -}; -/** - * Reduce function that pushes an object to an array, then returns the array. - * Mostly just for [[flattenR]] and [[uniqR]] - */ -function pushR(arr, obj) { - arr.push(obj); - return arr; -} -/** Reduce function that filters out duplicates */ -var uniqR = function (acc, token) { return (inArray(acc, token) ? acc : pushR(acc, token)); }; -/** - * Return a new array with a single level of arrays unnested. - * - * @example - * ``` - * - * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; - * unnest(input) // [ "a", "b", "c", "d", [ "double, "nested" ] ] - * ``` - */ -var unnest = function (arr) { return arr.reduce(unnestR, []); }; -/** - * Return a completely flattened version of an array. - * - * @example - * ``` - * - * let input = [ [ "a", "b" ], [ "c", "d" ], [ [ "double", "nested" ] ] ]; - * flatten(input) // [ "a", "b", "c", "d", "double, "nested" ] - * ``` - */ -var flatten = function (arr) { return arr.reduce(flattenR, []); }; -/** - * Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass. - * @example - * ``` - * - * let isNumber = (obj) => typeof(obj) === 'number'; - * let allNumbers = [ 1, 2, 3, 4, 5 ]; - * allNumbers.filter(assertPredicate(isNumber)); //OK - * - * let oneString = [ 1, 2, 3, 4, "5" ]; - * oneString.filter(assertPredicate(isNumber, "Not all numbers")); // throws Error(""Not all numbers""); - * ``` - */ -var assertPredicate = assertFn; -/** - * Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test. - * @example - * ``` - * - * var data = { foo: 1, bar: 2 }; - * - * let keys = [ 'foo', 'bar' ] - * let values = keys.map(assertMap(key => data[key], "Key not found")); - * // values is [1, 2] - * - * let keys = [ 'foo', 'bar', 'baz' ] - * let values = keys.map(assertMap(key => data[key], "Key not found")); - * // throws Error("Key not found") - * ``` - */ -var assertMap = assertFn; -function assertFn(predicateOrMap, errMsg) { - if (errMsg === void 0) { errMsg = 'assert failure'; } - return function (obj) { - var result = predicateOrMap(obj); - if (!result) { - throw new Error((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(errMsg) ? errMsg(obj) : errMsg); - } - return result; - }; -} -/** - * Like _.pairs: Given an object, returns an array of key/value pairs - * - * @example - * ``` - * - * pairs({ foo: "FOO", bar: "BAR }) // [ [ "foo", "FOO" ], [ "bar": "BAR" ] ] - * ``` - */ -var pairs = function (obj) { return Object.keys(obj).map(function (key) { return [key, obj[key]]; }); }; -/** - * Given two or more parallel arrays, returns an array of tuples where - * each tuple is composed of [ a[i], b[i], ... z[i] ] - * - * @example - * ``` - * - * let foo = [ 0, 2, 4, 6 ]; - * let bar = [ 1, 3, 5, 7 ]; - * let baz = [ 10, 30, 50, 70 ]; - * arrayTuples(foo, bar); // [ [0, 1], [2, 3], [4, 5], [6, 7] ] - * arrayTuples(foo, bar, baz); // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ] - * ``` - */ -function arrayTuples() { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - if (args.length === 0) - return []; - var maxArrayLen = args.reduce(function (min, arr) { return Math.min(arr.length, min); }, 9007199254740991); // aka 2^53 − 1 aka Number.MAX_SAFE_INTEGER - var result = []; - var _loop_1 = function (i) { - // This is a hot function - // Unroll when there are 1-4 arguments - switch (args.length) { - case 1: - result.push([args[0][i]]); - break; - case 2: - result.push([args[0][i], args[1][i]]); - break; - case 3: - result.push([args[0][i], args[1][i], args[2][i]]); - break; - case 4: - result.push([args[0][i], args[1][i], args[2][i], args[3][i]]); - break; - default: - result.push(args.map(function (array) { return array[i]; })); - break; - } - }; - for (var i = 0; i < maxArrayLen; i++) { - _loop_1(i); - } - return result; -} -/** - * Reduce function which builds an object from an array of [key, value] pairs. - * - * Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration. - * - * Each keyValueTuple should be an array with values [ key: string, value: any ] - * - * @example - * ``` - * - * var pairs = [ ["fookey", "fooval"], ["barkey", "barval"] ] - * - * var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {}) - * // pairsToObj == { fookey: "fooval", barkey: "barval" } - * - * // Or, more simply: - * var pairsToObj = pairs.reduce(applyPairs, {}) - * // pairsToObj == { fookey: "fooval", barkey: "barval" } - * ``` - */ -function applyPairs(memo, keyValTuple) { - var key, value; - if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(keyValTuple)) - key = keyValTuple[0], value = keyValTuple[1]; - if (!(0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(key)) - throw new Error('invalid parameters to applyPairs'); - memo[key] = value; - return memo; -} -/** Get the last element of an array */ -function tail(arr) { - return (arr.length && arr[arr.length - 1]) || undefined; -} -/** - * shallow copy from src to dest - */ -function copy(src, dest) { - if (dest) - Object.keys(dest).forEach(function (key) { return delete dest[key]; }); - if (!dest) - dest = {}; - return extend(dest, src); -} -/** Naive forEach implementation works with Objects or Arrays */ -function _forEach(obj, cb, _this) { - if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(obj)) - return obj.forEach(cb, _this); - Object.keys(obj).forEach(function (key) { return cb(obj[key], key); }); -} -function _extend(toObj) { - for (var i = 1; i < arguments.length; i++) { - var obj = arguments[i]; - if (!obj) - continue; - var keys = Object.keys(obj); - for (var j = 0; j < keys.length; j++) { - toObj[keys[j]] = obj[keys[j]]; - } - } - return toObj; -} -function _equals(o1, o2) { - if (o1 === o2) - return true; - if (o1 === null || o2 === null) - return false; - if (o1 !== o1 && o2 !== o2) - return true; // NaN === NaN - var t1 = typeof o1, t2 = typeof o2; - if (t1 !== t2 || t1 !== 'object') - return false; - var tup = [o1, o2]; - if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(tup)) - return _arraysEq(o1, o2); - if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isDate)(tup)) - return o1.getTime() === o2.getTime(); - if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isRegExp)(tup)) - return o1.toString() === o2.toString(); - if ((0,_hof__WEBPACK_IMPORTED_MODULE_1__.all)(_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(tup)) - return true; // meh - var predicates = [_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction, _predicates__WEBPACK_IMPORTED_MODULE_0__.isArray, _predicates__WEBPACK_IMPORTED_MODULE_0__.isDate, _predicates__WEBPACK_IMPORTED_MODULE_0__.isRegExp]; - if (predicates.map(_hof__WEBPACK_IMPORTED_MODULE_1__.any).reduce(function (b, fn) { return b || !!fn(tup); }, false)) - return false; - var keys = {}; - // tslint:disable-next-line:forin - for (var key in o1) { - if (!_equals(o1[key], o2[key])) - return false; - keys[key] = true; - } - for (var key in o2) { - if (!keys[key]) - return false; - } - return true; -} -function _arraysEq(a1, a2) { - if (a1.length !== a2.length) - return false; - return arrayTuples(a1, a2).reduce(function (b, t) { return b && _equals(t[0], t[1]); }, true); -} -// issue #2676 -var silenceUncaughtInPromise = function (promise) { return promise.catch(function (e) { return 0; }) && promise; }; -var silentRejection = function (error) { return silenceUncaughtInPromise(_coreservices__WEBPACK_IMPORTED_MODULE_2__.services.$q.reject(error)); }; -//# sourceMappingURL=common.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js": -/*!********************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/common/coreservices.js ***! - \********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "makeStub": () => (/* binding */ makeStub), -/* harmony export */ "services": () => (/* binding */ services) -/* harmony export */ }); -var noImpl = function (fnname) { return function () { - throw new Error("No implementation for " + fnname + ". The framework specific code did not implement this method."); -}; }; -var makeStub = function (service, methods) { - return methods.reduce(function (acc, key) { return ((acc[key] = noImpl(service + "." + key + "()")), acc); }, {}); -}; -var services = { - $q: undefined, - $injector: undefined, -}; - -//# sourceMappingURL=coreservices.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/common/glob.js": -/*!************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/common/glob.js ***! - \************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Glob": () => (/* binding */ Glob) -/* harmony export */ }); -/** - * Matches state names using glob-like pattern strings. - * - * Globs can be used in specific APIs including: - * - * - [[StateService.is]] - * - [[StateService.includes]] - * - The first argument to Hook Registration functions like [[TransitionService.onStart]] - * - [[HookMatchCriteria]] and [[HookMatchCriterion]] - * - * A `Glob` string is a pattern which matches state names. - * Nested state names are split into segments (separated by a dot) when processing. - * The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz'] - * - * Globs work according to the following rules: - * - * ### Exact match: - * - * The glob `'A.B'` matches the state named exactly `'A.B'`. - * - * | Glob |Matches states named|Does not match state named| - * |:------------|:--------------------|:---------------------| - * | `'A'` | `'A'` | `'B'` , `'A.C'` | - * | `'A.B'` | `'A.B'` | `'A'` , `'A.B.C'` | - * | `'foo'` | `'foo'` | `'FOO'` , `'foo.bar'`| - * - * ### Single star (`*`) - * - * A single star (`*`) is a wildcard that matches exactly one segment. - * - * | Glob |Matches states named |Does not match state named | - * |:------------|:---------------------|:--------------------------| - * | `'*'` | `'A'` , `'Z'` | `'A.B'` , `'Z.Y.X'` | - * | `'A.*'` | `'A.B'` , `'A.C'` | `'A'` , `'A.B.C'` | - * | `'A.*.*'` | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`| - * - * ### Double star (`**`) - * - * A double star (`'**'`) is a wildcard that matches *zero or more segments* - * - * | Glob |Matches states named |Does not match state named | - * |:------------|:----------------------------------------------|:----------------------------------| - * | `'**'` | `'A'` , `'A.B'`, `'Z.Y.X'` | (matches all states) | - * | `'A.**'` | `'A'` , `'A.B'` , `'A.C.X'` | `'Z.Y.X'` | - * | `'**.X'` | `'X'` , `'A.X'` , `'Z.Y.X'` | `'A'` , `'A.login.Z'` | - * | `'A.**.X'` | `'A.X'` , `'A.B.X'` , `'A.B.C.X'` | `'A'` , `'A.B.C'` | - * - * @packageDocumentation - */ -var Glob = /** @class */ (function () { - function Glob(text) { - this.text = text; - this.glob = text.split('.'); - var regexpString = this.text - .split('.') - .map(function (seg) { - if (seg === '**') - return '(?:|(?:\\.[^.]*)*)'; - if (seg === '*') - return '\\.[^.]*'; - return '\\.' + seg; - }) - .join(''); - this.regexp = new RegExp('^' + regexpString + '$'); - } - /** Returns true if the string has glob-like characters in it */ - Glob.is = function (text) { - return !!/[!,*]+/.exec(text); - }; - /** Returns a glob from the string, or null if the string isn't Glob-like */ - Glob.fromString = function (text) { - return Glob.is(text) ? new Glob(text) : null; - }; - Glob.prototype.matches = function (name) { - return this.regexp.test('.' + name); - }; - return Glob; -}()); - -//# sourceMappingURL=glob.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/common/hof.js": -/*!***********************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/common/hof.js ***! - \***********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "curry": () => (/* binding */ curry), -/* harmony export */ "compose": () => (/* binding */ compose), -/* harmony export */ "pipe": () => (/* binding */ pipe), -/* harmony export */ "prop": () => (/* binding */ prop), -/* harmony export */ "propEq": () => (/* binding */ propEq), -/* harmony export */ "parse": () => (/* binding */ parse), -/* harmony export */ "not": () => (/* binding */ not), -/* harmony export */ "and": () => (/* binding */ and), -/* harmony export */ "or": () => (/* binding */ or), -/* harmony export */ "all": () => (/* binding */ all), -/* harmony export */ "any": () => (/* binding */ any), -/* harmony export */ "is": () => (/* binding */ is), -/* harmony export */ "eq": () => (/* binding */ eq), -/* harmony export */ "val": () => (/* binding */ val), -/* harmony export */ "invoke": () => (/* binding */ invoke), -/* harmony export */ "pattern": () => (/* binding */ pattern) -/* harmony export */ }); -/** - * Higher order functions - * - * These utility functions are exported, but are subject to change without notice. - * - * @packageDocumentation - */ -var __spreadArrays = (undefined && undefined.__spreadArrays) || function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -}; -/** - * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function. - * - * Given a function with N parameters, returns a new function that supports partial application. - * The new function accepts anywhere from 1 to N parameters. When that function is called with M parameters, - * where M is less than N, it returns a new function that accepts the remaining parameters. It continues to - * accept more parameters until all N parameters have been supplied. - * - * - * This contrived example uses a partially applied function as an predicate, which returns true - * if an object is found in both arrays. - * @example - * ``` - * // returns true if an object is in both of the two arrays - * function inBoth(array1, array2, object) { - * return array1.indexOf(object) !== -1 && - * array2.indexOf(object) !== 1; - * } - * let obj1, obj2, obj3, obj4, obj5, obj6, obj7 - * let foos = [obj1, obj3] - * let bars = [obj3, obj4, obj5] - * - * // A curried "copy" of inBoth - * let curriedInBoth = curry(inBoth); - * // Partially apply both the array1 and array2 - * let inFoosAndBars = curriedInBoth(foos, bars); - * - * // Supply the final argument; since all arguments are - * // supplied, the original inBoth function is then called. - * let obj1InBoth = inFoosAndBars(obj1); // false - * - * // Use the inFoosAndBars as a predicate. - * // Filter, on each iteration, supplies the final argument - * let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ]; - * let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ] - * - * ``` - * - * @param fn - * @returns {*|function(): (*|any)} - */ -function curry(fn) { - return function curried() { - if (arguments.length >= fn.length) { - return fn.apply(this, arguments); - } - var args = Array.prototype.slice.call(arguments); - return curried.bind.apply(curried, __spreadArrays([this], args)); - }; -} -/** - * Given a varargs list of functions, returns a function that composes the argument functions, right-to-left - * given: f(x), g(x), h(x) - * let composed = compose(f,g,h) - * then, composed is: f(g(h(x))) - */ -function compose() { - var args = arguments; - var start = args.length - 1; - return function () { - var i = start, result = args[start].apply(this, arguments); - while (i--) - result = args[i].call(this, result); - return result; - }; -} -/** - * Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right - * given: f(x), g(x), h(x) - * let piped = pipe(f,g,h); - * then, piped is: h(g(f(x))) - */ -function pipe() { - var funcs = []; - for (var _i = 0; _i < arguments.length; _i++) { - funcs[_i] = arguments[_i]; - } - return compose.apply(null, [].slice.call(arguments).reverse()); -} -/** - * Given a property name, returns a function that returns that property from an object - * let obj = { foo: 1, name: "blarg" }; - * let getName = prop("name"); - * getName(obj) === "blarg" - */ -var prop = function (name) { return function (obj) { return obj && obj[name]; }; }; -/** - * Given a property name and a value, returns a function that returns a boolean based on whether - * the passed object has a property that matches the value - * let obj = { foo: 1, name: "blarg" }; - * let getName = propEq("name", "blarg"); - * getName(obj) === true - */ -var propEq = curry(function (name, _val, obj) { return obj && obj[name] === _val; }); -/** - * Given a dotted property name, returns a function that returns a nested property from an object, or undefined - * let obj = { id: 1, nestedObj: { foo: 1, name: "blarg" }, }; - * let getName = prop("nestedObj.name"); - * getName(obj) === "blarg" - * let propNotFound = prop("this.property.doesnt.exist"); - * propNotFound(obj) === undefined - */ -var parse = function (name) { return pipe.apply(null, name.split('.').map(prop)); }; -/** - * Given a function that returns a truthy or falsey value, returns a - * function that returns the opposite (falsey or truthy) value given the same inputs - */ -var not = function (fn) { return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return !fn.apply(null, args); -}; }; -/** - * Given two functions that return truthy or falsey values, returns a function that returns truthy - * if both functions return truthy for the given arguments - */ -function and(fn1, fn2) { - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return fn1.apply(null, args) && fn2.apply(null, args); - }; -} -/** - * Given two functions that return truthy or falsey values, returns a function that returns truthy - * if at least one of the functions returns truthy for the given arguments - */ -function or(fn1, fn2) { - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return fn1.apply(null, args) || fn2.apply(null, args); - }; -} -/** - * Check if all the elements of an array match a predicate function - * - * @param fn1 a predicate function `fn1` - * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array - */ -var all = function (fn1) { return function (arr) { return arr.reduce(function (b, x) { return b && !!fn1(x); }, true); }; }; -// tslint:disable-next-line:variable-name -var any = function (fn1) { return function (arr) { return arr.reduce(function (b, x) { return b || !!fn1(x); }, false); }; }; -/** Given a class, returns a Predicate function that returns true if the object is of that class */ -var is = function (ctor) { return function (obj) { - return (obj != null && obj.constructor === ctor) || obj instanceof ctor; -}; }; -/** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */ -var eq = function (value) { return function (other) { return value === other; }; }; -/** Given a value, returns a function which returns the value */ -var val = function (v) { return function () { return v; }; }; -function invoke(fnName, args) { - return function (obj) { return obj[fnName].apply(obj, args); }; -} -/** - * Sorta like Pattern Matching (a functional programming conditional construct) - * - * See http://c2.com/cgi/wiki?PatternMatching - * - * This is a conditional construct which allows a series of predicates and output functions - * to be checked and then applied. Each predicate receives the input. If the predicate - * returns truthy, then its matching output function (mapping function) is provided with - * the input and, then the result is returned. - * - * Each combination (2-tuple) of predicate + output function should be placed in an array - * of size 2: [ predicate, mapFn ] - * - * These 2-tuples should be put in an outer array. - * - * @example - * ``` - * - * // Here's a 2-tuple where the first element is the isString predicate - * // and the second element is a function that returns a description of the input - * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ]; - * - * // Second tuple: predicate "isNumber", mapfn returns a description - * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ]; - * - * let third = [ (input) => input === null, (input) => `Oh, null...` ]; - * - * let fourth = [ (input) => input === undefined, (input) => `notdefined` ]; - * - * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]); - * - * console.log(descriptionOf(undefined)); // 'notdefined' - * console.log(descriptionOf(55)); // '(55) That's a number!' - * console.log(descriptionOf("foo")); // 'Here's your string foo' - * ``` - * - * @param struct A 2D array. Each element of the array should be an array, a 2-tuple, - * with a Predicate and a mapping/output function - * @returns {function(any): *} - */ -function pattern(struct) { - return function (x) { - for (var i = 0; i < struct.length; i++) { - if (struct[i][0](x)) - return struct[i][1](x); - } - }; -} -//# sourceMappingURL=hof.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/common/index.js": -/*!*************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/common/index.js ***! - \*************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "_extend": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._extend), -/* harmony export */ "_inArray": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._inArray), -/* harmony export */ "_pushTo": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._pushTo), -/* harmony export */ "_removeFrom": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__._removeFrom), -/* harmony export */ "allTrueR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.allTrueR), -/* harmony export */ "ancestors": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.ancestors), -/* harmony export */ "anyTrueR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.anyTrueR), -/* harmony export */ "applyPairs": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.applyPairs), -/* harmony export */ "arrayTuples": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples), -/* harmony export */ "assertFn": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.assertFn), -/* harmony export */ "assertMap": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.assertMap), -/* harmony export */ "assertPredicate": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.assertPredicate), -/* harmony export */ "copy": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.copy), -/* harmony export */ "createProxyFunctions": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions), -/* harmony export */ "defaults": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.defaults), -/* harmony export */ "deregAll": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.deregAll), -/* harmony export */ "equals": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.equals), -/* harmony export */ "extend": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.extend), -/* harmony export */ "filter": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.filter), -/* harmony export */ "find": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.find), -/* harmony export */ "flatten": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.flatten), -/* harmony export */ "flattenR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.flattenR), -/* harmony export */ "forEach": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.forEach), -/* harmony export */ "fromJson": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.fromJson), -/* harmony export */ "identity": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.identity), -/* harmony export */ "inArray": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.inArray), -/* harmony export */ "inherit": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.inherit), -/* harmony export */ "map": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.map), -/* harmony export */ "mapObj": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.mapObj), -/* harmony export */ "mergeR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.mergeR), -/* harmony export */ "noop": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.noop), -/* harmony export */ "omit": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.omit), -/* harmony export */ "pairs": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pairs), -/* harmony export */ "pick": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pick), -/* harmony export */ "pluck": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pluck), -/* harmony export */ "pushR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pushR), -/* harmony export */ "pushTo": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.pushTo), -/* harmony export */ "removeFrom": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.removeFrom), -/* harmony export */ "root": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.root), -/* harmony export */ "silenceUncaughtInPromise": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.silenceUncaughtInPromise), -/* harmony export */ "silentRejection": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.silentRejection), -/* harmony export */ "tail": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.tail), -/* harmony export */ "toJson": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.toJson), -/* harmony export */ "uniqR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.uniqR), -/* harmony export */ "unnest": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.unnest), -/* harmony export */ "unnestR": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.unnestR), -/* harmony export */ "values": () => (/* reexport safe */ _common__WEBPACK_IMPORTED_MODULE_0__.values), -/* harmony export */ "makeStub": () => (/* reexport safe */ _coreservices__WEBPACK_IMPORTED_MODULE_1__.makeStub), -/* harmony export */ "services": () => (/* reexport safe */ _coreservices__WEBPACK_IMPORTED_MODULE_1__.services), -/* harmony export */ "Glob": () => (/* reexport safe */ _glob__WEBPACK_IMPORTED_MODULE_2__.Glob), -/* harmony export */ "all": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.all), -/* harmony export */ "and": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.and), -/* harmony export */ "any": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.any), -/* harmony export */ "compose": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.compose), -/* harmony export */ "curry": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.curry), -/* harmony export */ "eq": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.eq), -/* harmony export */ "invoke": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.invoke), -/* harmony export */ "is": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.is), -/* harmony export */ "not": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.not), -/* harmony export */ "or": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.or), -/* harmony export */ "parse": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.parse), -/* harmony export */ "pattern": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.pattern), -/* harmony export */ "pipe": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.pipe), -/* harmony export */ "prop": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.prop), -/* harmony export */ "propEq": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.propEq), -/* harmony export */ "val": () => (/* reexport safe */ _hof__WEBPACK_IMPORTED_MODULE_3__.val), -/* harmony export */ "isArray": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isArray), -/* harmony export */ "isDate": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isDate), -/* harmony export */ "isDefined": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isDefined), -/* harmony export */ "isFunction": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction), -/* harmony export */ "isInjectable": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isInjectable), -/* harmony export */ "isNull": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isNull), -/* harmony export */ "isNullOrUndefined": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isNullOrUndefined), -/* harmony export */ "isNumber": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isNumber), -/* harmony export */ "isObject": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isObject), -/* harmony export */ "isPromise": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isPromise), -/* harmony export */ "isRegExp": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isRegExp), -/* harmony export */ "isString": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isString), -/* harmony export */ "isUndefined": () => (/* reexport safe */ _predicates__WEBPACK_IMPORTED_MODULE_4__.isUndefined), -/* harmony export */ "Queue": () => (/* reexport safe */ _queue__WEBPACK_IMPORTED_MODULE_5__.Queue), -/* harmony export */ "beforeAfterSubstr": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.beforeAfterSubstr), -/* harmony export */ "fnToString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.fnToString), -/* harmony export */ "functionToString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.functionToString), -/* harmony export */ "hostRegex": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.hostRegex), -/* harmony export */ "joinNeighborsR": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.joinNeighborsR), -/* harmony export */ "kebobString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.kebobString), -/* harmony export */ "maxLength": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.maxLength), -/* harmony export */ "padString": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.padString), -/* harmony export */ "splitEqual": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitEqual), -/* harmony export */ "splitHash": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitHash), -/* harmony export */ "splitOnDelim": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitOnDelim), -/* harmony export */ "splitQuery": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.splitQuery), -/* harmony export */ "stringify": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.stringify), -/* harmony export */ "stripLastPathElement": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.stripLastPathElement), -/* harmony export */ "trimHashVal": () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_6__.trimHashVal), -/* harmony export */ "Category": () => (/* reexport safe */ _trace__WEBPACK_IMPORTED_MODULE_7__.Category), -/* harmony export */ "Trace": () => (/* reexport safe */ _trace__WEBPACK_IMPORTED_MODULE_7__.Trace), -/* harmony export */ "trace": () => (/* reexport safe */ _trace__WEBPACK_IMPORTED_MODULE_7__.trace) -/* harmony export */ }); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); -/* harmony import */ var _glob__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./glob */ "./node_modules/@uirouter/core/lib-esm/common/glob.js"); -/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _predicates__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _queue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./queue */ "./node_modules/@uirouter/core/lib-esm/common/queue.js"); -/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); -/* harmony import */ var _trace__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); - - - - - - - - -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/common/predicates.js": -/*!******************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/common/predicates.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "isUndefined": () => (/* binding */ isUndefined), -/* harmony export */ "isDefined": () => (/* binding */ isDefined), -/* harmony export */ "isNull": () => (/* binding */ isNull), -/* harmony export */ "isNullOrUndefined": () => (/* binding */ isNullOrUndefined), -/* harmony export */ "isFunction": () => (/* binding */ isFunction), -/* harmony export */ "isNumber": () => (/* binding */ isNumber), -/* harmony export */ "isString": () => (/* binding */ isString), -/* harmony export */ "isObject": () => (/* binding */ isObject), -/* harmony export */ "isArray": () => (/* binding */ isArray), -/* harmony export */ "isDate": () => (/* binding */ isDate), -/* harmony export */ "isRegExp": () => (/* binding */ isRegExp), -/* harmony export */ "isInjectable": () => (/* binding */ isInjectable), -/* harmony export */ "isPromise": () => (/* binding */ isPromise) -/* harmony export */ }); -/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/** - * Predicates - * - * These predicates return true/false based on the input. - * Although these functions are exported, they are subject to change without notice. - * - * @packageDocumentation - */ - -var toStr = Object.prototype.toString; -var tis = function (t) { return function (x) { return typeof x === t; }; }; -var isUndefined = tis('undefined'); -var isDefined = (0,_hof__WEBPACK_IMPORTED_MODULE_0__.not)(isUndefined); -var isNull = function (o) { return o === null; }; -var isNullOrUndefined = (0,_hof__WEBPACK_IMPORTED_MODULE_0__.or)(isNull, isUndefined); -var isFunction = tis('function'); -var isNumber = tis('number'); -var isString = tis('string'); -var isObject = function (x) { return x !== null && typeof x === 'object'; }; -var isArray = Array.isArray; -var isDate = (function (x) { return toStr.call(x) === '[object Date]'; }); -var isRegExp = (function (x) { return toStr.call(x) === '[object RegExp]'; }); -/** - * Predicate which checks if a value is injectable - * - * A value is "injectable" if it is a function, or if it is an ng1 array-notation-style array - * where all the elements in the array are Strings, except the last one, which is a Function - */ -function isInjectable(val) { - if (isArray(val) && val.length) { - var head = val.slice(0, -1), tail = val.slice(-1); - return !(head.filter((0,_hof__WEBPACK_IMPORTED_MODULE_0__.not)(isString)).length || tail.filter((0,_hof__WEBPACK_IMPORTED_MODULE_0__.not)(isFunction)).length); - } - return isFunction(val); -} -/** - * Predicate which checks if a value looks like a Promise - * - * It is probably a Promise if it's an object, and it has a `then` property which is a Function - */ -var isPromise = (0,_hof__WEBPACK_IMPORTED_MODULE_0__.and)(isObject, (0,_hof__WEBPACK_IMPORTED_MODULE_0__.pipe)((0,_hof__WEBPACK_IMPORTED_MODULE_0__.prop)('then'), isFunction)); -//# sourceMappingURL=predicates.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/common/queue.js": -/*!*************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/common/queue.js ***! - \*************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Queue": () => (/* binding */ Queue) -/* harmony export */ }); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); - -var Queue = /** @class */ (function () { - function Queue(_items, _limit) { - if (_items === void 0) { _items = []; } - if (_limit === void 0) { _limit = null; } - this._items = _items; - this._limit = _limit; - this._evictListeners = []; - this.onEvict = (0,_common__WEBPACK_IMPORTED_MODULE_0__.pushTo)(this._evictListeners); - } - Queue.prototype.enqueue = function (item) { - var items = this._items; - items.push(item); - if (this._limit && items.length > this._limit) - this.evict(); - return item; - }; - Queue.prototype.evict = function () { - var item = this._items.shift(); - this._evictListeners.forEach(function (fn) { return fn(item); }); - return item; - }; - Queue.prototype.dequeue = function () { - if (this.size()) - return this._items.splice(0, 1)[0]; - }; - Queue.prototype.clear = function () { - var current = this._items; - this._items = []; - return current; - }; - Queue.prototype.size = function () { - return this._items.length; - }; - Queue.prototype.remove = function (item) { - var idx = this._items.indexOf(item); - return idx > -1 && this._items.splice(idx, 1)[0]; - }; - Queue.prototype.peekTail = function () { - return this._items[this._items.length - 1]; - }; - Queue.prototype.peekHead = function () { - if (this.size()) - return this._items[0]; - }; - return Queue; -}()); - -//# sourceMappingURL=queue.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/common/safeConsole.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/common/safeConsole.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "safeConsole": () => (/* binding */ safeConsole) -/* harmony export */ }); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/** - * workaround for missing console object in IE9 when dev tools haven't been opened o_O - * @packageDocumentation - */ -/* tslint:disable:no-console */ - -var noopConsoleStub = { log: _common__WEBPACK_IMPORTED_MODULE_0__.noop, error: _common__WEBPACK_IMPORTED_MODULE_0__.noop, table: _common__WEBPACK_IMPORTED_MODULE_0__.noop }; -function ie9Console(console) { - var bound = function (fn) { return Function.prototype.bind.call(fn, console); }; - return { - log: bound(console.log), - error: bound(console.log), - table: bound(console.log), - }; -} -function fallbackConsole(console) { - var log = console.log.bind(console); - var error = console.error ? console.error.bind(console) : log; - var table = console.table ? console.table.bind(console) : log; - return { log: log, error: error, table: table }; -} -function getSafeConsole() { - // @ts-ignore - var isIE9 = typeof document !== 'undefined' && document.documentMode && document.documentMode === 9; - if (isIE9) { - return window && window.console ? ie9Console(window.console) : noopConsoleStub; - } - else if (!console.table || !console.error) { - return fallbackConsole(console); - } - else { - return console; - } -} -var safeConsole = getSafeConsole(); -//# sourceMappingURL=safeConsole.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/common/strings.js": -/*!***************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/common/strings.js ***! - \***************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "maxLength": () => (/* binding */ maxLength), -/* harmony export */ "padString": () => (/* binding */ padString), -/* harmony export */ "kebobString": () => (/* binding */ kebobString), -/* harmony export */ "functionToString": () => (/* binding */ functionToString), -/* harmony export */ "fnToString": () => (/* binding */ fnToString), -/* harmony export */ "stringify": () => (/* binding */ stringify), -/* harmony export */ "beforeAfterSubstr": () => (/* binding */ beforeAfterSubstr), -/* harmony export */ "hostRegex": () => (/* binding */ hostRegex), -/* harmony export */ "stripLastPathElement": () => (/* binding */ stripLastPathElement), -/* harmony export */ "splitHash": () => (/* binding */ splitHash), -/* harmony export */ "splitQuery": () => (/* binding */ splitQuery), -/* harmony export */ "splitEqual": () => (/* binding */ splitEqual), -/* harmony export */ "trimHashVal": () => (/* binding */ trimHashVal), -/* harmony export */ "splitOnDelim": () => (/* binding */ splitOnDelim), -/* harmony export */ "joinNeighborsR": () => (/* binding */ joinNeighborsR) -/* harmony export */ }); -/* harmony import */ var _predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transition/rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/** - * Functions that manipulate strings - * - * Although these functions are exported, they are subject to change without notice. - * - * @packageDocumentation - */ - - - - -/** - * Returns a string shortened to a maximum length - * - * If the string is already less than the `max` length, return the string. - * Else return the string, shortened to `max - 3` and append three dots ("..."). - * - * @param max the maximum length of the string to return - * @param str the input string - */ -function maxLength(max, str) { - if (str.length <= max) - return str; - return str.substr(0, max - 3) + '...'; -} -/** - * Returns a string, with spaces added to the end, up to a desired str length - * - * If the string is already longer than the desired length, return the string. - * Else returns the string, with extra spaces on the end, such that it reaches `length` characters. - * - * @param length the desired length of the string to return - * @param str the input string - */ -function padString(length, str) { - while (str.length < length) - str += ' '; - return str; -} -function kebobString(camelCase) { - return camelCase - .replace(/^([A-Z])/, function ($1) { return $1.toLowerCase(); }) // replace first char - .replace(/([A-Z])/g, function ($1) { return '-' + $1.toLowerCase(); }); // replace rest -} -function functionToString(fn) { - var fnStr = fnToString(fn); - var namedFunctionMatch = fnStr.match(/^(function [^ ]+\([^)]*\))/); - var toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr; - var fnName = fn['name'] || ''; - if (fnName && toStr.match(/function \(/)) { - return 'function ' + fnName + toStr.substr(9); - } - return toStr; -} -function fnToString(fn) { - var _fn = (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(fn) ? fn.slice(-1)[0] : fn; - return (_fn && _fn.toString()) || 'undefined'; -} -var isRejection = _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__.Rejection.isRejectionPromise; -var hasToString = function (obj) { - return (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isObject)(obj) && !(0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isArray)(obj) && obj.constructor !== Object && (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(obj.toString); -}; -var stringifyPattern = (0,_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ - [_predicates__WEBPACK_IMPORTED_MODULE_0__.isUndefined, (0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)('undefined')], - [_predicates__WEBPACK_IMPORTED_MODULE_0__.isNull, (0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)('null')], - [_predicates__WEBPACK_IMPORTED_MODULE_0__.isPromise, (0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)('[Promise]')], - [isRejection, function (x) { return x._transitionRejection.toString(); }], - [hasToString, function (x) { return x.toString(); }], - [_predicates__WEBPACK_IMPORTED_MODULE_0__.isInjectable, functionToString], - [(0,_hof__WEBPACK_IMPORTED_MODULE_3__.val)(true), _common__WEBPACK_IMPORTED_MODULE_2__.identity], -]); -function stringify(o) { - var seen = []; - function format(value) { - if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isObject)(value)) { - if (seen.indexOf(value) !== -1) - return '[circular ref]'; - seen.push(value); - } - return stringifyPattern(value); - } - if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isUndefined)(o)) { - // Workaround for IE & Edge Spec incompatibility where replacer function would not be called when JSON.stringify - // is given `undefined` as value. To work around that, we simply detect `undefined` and bail out early by - // manually stringifying it. - return format(o); - } - return JSON.stringify(o, function (key, value) { return format(value); }).replace(/\\"/g, '"'); -} -/** Returns a function that splits a string on a character or substring */ -var beforeAfterSubstr = function (char) { return function (str) { - if (!str) - return ['', '']; - var idx = str.indexOf(char); - if (idx === -1) - return [str, '']; - return [str.substr(0, idx), str.substr(idx + 1)]; -}; }; -var hostRegex = new RegExp('^(?:[a-z]+:)?//[^/]+/'); -var stripLastPathElement = function (str) { return str.replace(/\/[^/]*$/, ''); }; -var splitHash = beforeAfterSubstr('#'); -var splitQuery = beforeAfterSubstr('?'); -var splitEqual = beforeAfterSubstr('='); -var trimHashVal = function (str) { return (str ? str.replace(/^#/, '') : ''); }; -/** - * Splits on a delimiter, but returns the delimiters in the array - * - * #### Example: - * ```js - * var splitOnSlashes = splitOnDelim('/'); - * splitOnSlashes("/foo"); // ["/", "foo"] - * splitOnSlashes("/foo/"); // ["/", "foo", "/"] - * ``` - */ -function splitOnDelim(delim) { - var re = new RegExp('(' + delim + ')', 'g'); - return function (str) { return str.split(re).filter(_common__WEBPACK_IMPORTED_MODULE_2__.identity); }; -} -/** - * Reduce fn that joins neighboring strings - * - * Given an array of strings, returns a new array - * where all neighboring strings have been joined. - * - * #### Example: - * ```js - * let arr = ["foo", "bar", 1, "baz", "", "qux" ]; - * arr.reduce(joinNeighborsR, []) // ["foobar", 1, "bazqux" ] - * ``` - */ -function joinNeighborsR(acc, x) { - if ((0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)((0,_common__WEBPACK_IMPORTED_MODULE_2__.tail)(acc)) && (0,_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(x)) - return acc.slice(0, -1).concat((0,_common__WEBPACK_IMPORTED_MODULE_2__.tail)(acc) + x); - return (0,_common__WEBPACK_IMPORTED_MODULE_2__.pushR)(acc, x); -} -//# sourceMappingURL=strings.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/common/trace.js": -/*!*************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/common/trace.js ***! - \*************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Category": () => (/* binding */ Category), -/* harmony export */ "Trace": () => (/* binding */ Trace), -/* harmony export */ "trace": () => (/* binding */ trace) -/* harmony export */ }); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); -/* harmony import */ var _safeConsole__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./safeConsole */ "./node_modules/@uirouter/core/lib-esm/common/safeConsole.js"); -/** - * # Transition tracing (debug) - * - * Enable transition tracing to print transition information to the console, - * in order to help debug your application. - * Tracing logs detailed information about each Transition to your console. - * - * To enable tracing, import the [[Trace]] singleton and enable one or more categories. - * - * ### ES6 - * ```js - * import {trace} from "@uirouter/core"; - * trace.enable(1, 5); // TRANSITION and VIEWCONFIG - * ``` - * - * ### CJS - * ```js - * let trace = require("@uirouter/core").trace; - * trace.enable("TRANSITION", "VIEWCONFIG"); - * ``` - * - * ### Globals - * ```js - * let trace = window["@uirouter/core"].trace; - * trace.enable(); // Trace everything (very verbose) - * ``` - * - * ### Angular 1: - * ```js - * app.run($trace => $trace.enable()); - * ``` - * - * @packageDocumentation - */ - - - - -function uiViewString(uiview) { - if (!uiview) - return 'ui-view (defunct)'; - var state = uiview.creationContext ? uiview.creationContext.name || '(root)' : '(none)'; - return "[ui-view#" + uiview.id + " " + uiview.$type + ":" + uiview.fqn + " (" + uiview.name + "@" + state + ")]"; -} -var viewConfigString = function (viewConfig) { - var view = viewConfig.viewDecl; - var state = view.$context.name || '(root)'; - return "[View#" + viewConfig.$id + " from '" + state + "' state]: target ui-view: '" + view.$uiViewName + "@" + view.$uiViewContextAnchor + "'"; -}; -function normalizedCat(input) { - return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isNumber)(input) ? Category[input] : Category[Category[input]]; -} -/** - * Trace categories Enum - * - * Enable or disable a category using [[Trace.enable]] or [[Trace.disable]] - * - * `trace.enable(Category.TRANSITION)` - * - * These can also be provided using a matching string, or position ordinal - * - * `trace.enable("TRANSITION")` - * - * `trace.enable(1)` - */ -var Category; -(function (Category) { - Category[Category["RESOLVE"] = 0] = "RESOLVE"; - Category[Category["TRANSITION"] = 1] = "TRANSITION"; - Category[Category["HOOK"] = 2] = "HOOK"; - Category[Category["UIVIEW"] = 3] = "UIVIEW"; - Category[Category["VIEWCONFIG"] = 4] = "VIEWCONFIG"; -})(Category || (Category = {})); - -var _tid = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('$id'); -var _rid = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('router.$id'); -var transLbl = function (trans) { return "Transition #" + _tid(trans) + "-" + _rid(trans); }; -/** - * Prints UI-Router Transition trace information to the console. - */ -var Trace = /** @class */ (function () { - /** @internal */ - function Trace() { - /** @internal */ - this._enabled = {}; - this.approximateDigests = 0; - } - /** @internal */ - Trace.prototype._set = function (enabled, categories) { - var _this = this; - if (!categories.length) { - categories = Object.keys(Category) - .map(function (k) { return parseInt(k, 10); }) - .filter(function (k) { return !isNaN(k); }) - .map(function (key) { return Category[key]; }); - } - categories.map(normalizedCat).forEach(function (category) { return (_this._enabled[category] = enabled); }); - }; - Trace.prototype.enable = function () { - var categories = []; - for (var _i = 0; _i < arguments.length; _i++) { - categories[_i] = arguments[_i]; - } - this._set(true, categories); - }; - Trace.prototype.disable = function () { - var categories = []; - for (var _i = 0; _i < arguments.length; _i++) { - categories[_i] = arguments[_i]; - } - this._set(false, categories); - }; - /** - * Retrieves the enabled stateus of a [[Category]] - * - * ```js - * trace.enabled("VIEWCONFIG"); // true or false - * ``` - * - * @returns boolean true if the category is enabled - */ - Trace.prototype.enabled = function (category) { - return !!this._enabled[normalizedCat(category)]; - }; - /** @internal called by ui-router code */ - Trace.prototype.traceTransitionStart = function (trans) { - if (!this.enabled(Category.TRANSITION)) - return; - _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Started -> " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans)); - }; - /** @internal called by ui-router code */ - Trace.prototype.traceTransitionIgnored = function (trans) { - if (!this.enabled(Category.TRANSITION)) - return; - _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Ignored <> " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans)); - }; - /** @internal called by ui-router code */ - Trace.prototype.traceHookInvocation = function (step, trans, options) { - if (!this.enabled(Category.HOOK)) - return; - var event = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('traceData.hookType')(options) || 'internal', context = (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('traceData.context.state.name')(options) || (0,_common_hof__WEBPACK_IMPORTED_MODULE_0__.parse)('traceData.context')(options) || 'unknown', name = (0,_strings__WEBPACK_IMPORTED_MODULE_2__.functionToString)(step.registeredHook.callback); - _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Hook -> " + event + " context: " + context + ", " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, name)); - }; - /** @internal called by ui-router code */ - Trace.prototype.traceHookResult = function (hookResult, trans, transitionOptions) { - if (!this.enabled(Category.HOOK)) - return; - _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Hook returned: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(hookResult))); - }; - /** @internal called by ui-router code */ - Trace.prototype.traceResolvePath = function (path, when, trans) { - if (!this.enabled(Category.RESOLVE)) - return; - _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": Resolving " + path + " (" + when + ")"); - }; - /** @internal called by ui-router code */ - Trace.prototype.traceResolvableResolved = function (resolvable, trans) { - if (!this.enabled(Category.RESOLVE)) - return; - _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Resolved " + resolvable + " to: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(resolvable.data))); - }; - /** @internal called by ui-router code */ - Trace.prototype.traceError = function (reason, trans) { - if (!this.enabled(Category.TRANSITION)) - return; - _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Rejected " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans) + ", reason: " + reason); - }; - /** @internal called by ui-router code */ - Trace.prototype.traceSuccess = function (finalState, trans) { - if (!this.enabled(Category.TRANSITION)) - return; - _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log(transLbl(trans) + ": <- Success " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(trans) + ", final state: " + finalState.name); - }; - /** @internal called by ui-router code */ - Trace.prototype.traceUIViewEvent = function (event, viewData, extra) { - if (extra === void 0) { extra = ''; } - if (!this.enabled(Category.UIVIEW)) - return; - _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log("ui-view: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.padString)(30, event) + " " + uiViewString(viewData) + extra); - }; - /** @internal called by ui-router code */ - Trace.prototype.traceUIViewConfigUpdated = function (viewData, context) { - if (!this.enabled(Category.UIVIEW)) - return; - this.traceUIViewEvent('Updating', viewData, " with ViewConfig from context='" + context + "'"); - }; - /** @internal called by ui-router code */ - Trace.prototype.traceUIViewFill = function (viewData, html) { - if (!this.enabled(Category.UIVIEW)) - return; - this.traceUIViewEvent('Fill', viewData, " with: " + (0,_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, html)); - }; - /** @internal called by ui-router code */ - Trace.prototype.traceViewSync = function (pairs) { - if (!this.enabled(Category.VIEWCONFIG)) - return; - var uivheader = 'uiview component fqn'; - var cfgheader = 'view config state (view name)'; - var mapping = pairs - .map(function (_a) { - var _b; - var uiView = _a.uiView, viewConfig = _a.viewConfig; - var uiv = uiView && uiView.fqn; - var cfg = viewConfig && viewConfig.viewDecl.$context.name + ": (" + viewConfig.viewDecl.$name + ")"; - return _b = {}, _b[uivheader] = uiv, _b[cfgheader] = cfg, _b; - }) - .sort(function (a, b) { return (a[uivheader] || '').localeCompare(b[uivheader] || ''); }); - _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.table(mapping); - }; - /** @internal called by ui-router code */ - Trace.prototype.traceViewServiceEvent = function (event, viewConfig) { - if (!this.enabled(Category.VIEWCONFIG)) - return; - _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log("VIEWCONFIG: " + event + " " + viewConfigString(viewConfig)); - }; - /** @internal called by ui-router code */ - Trace.prototype.traceViewServiceUIViewEvent = function (event, viewData) { - if (!this.enabled(Category.VIEWCONFIG)) - return; - _safeConsole__WEBPACK_IMPORTED_MODULE_3__.safeConsole.log("VIEWCONFIG: " + event + " " + uiViewString(viewData)); - }; - return Trace; -}()); - -/** - * The [[Trace]] singleton - * - * #### Example: - * ```js - * import {trace} from "@uirouter/core"; - * trace.enable(1, 5); - * ``` - */ -var trace = new Trace(); - -//# sourceMappingURL=trace.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/globals.js": -/*!********************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/globals.js ***! - \********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "UIRouterGlobals": () => (/* binding */ UIRouterGlobals) -/* harmony export */ }); -/* harmony import */ var _params_stateParams__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./params/stateParams */ "./node_modules/@uirouter/core/lib-esm/params/stateParams.js"); -/* harmony import */ var _common_queue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./common/queue */ "./node_modules/@uirouter/core/lib-esm/common/queue.js"); - - -/** - * Global router state - * - * This is where we hold the global mutable state such as current state, current - * params, current transition, etc. - */ -var UIRouterGlobals = /** @class */ (function () { - function UIRouterGlobals() { - /** - * Current parameter values - * - * The parameter values from the latest successful transition - */ - this.params = new _params_stateParams__WEBPACK_IMPORTED_MODULE_0__.StateParams(); - /** @internal */ - this.lastStartedTransitionId = -1; - /** @internal */ - this.transitionHistory = new _common_queue__WEBPACK_IMPORTED_MODULE_1__.Queue([], 1); - /** @internal */ - this.successfulTransitions = new _common_queue__WEBPACK_IMPORTED_MODULE_1__.Queue([], 1); - } - UIRouterGlobals.prototype.dispose = function () { - this.transitionHistory.clear(); - this.successfulTransitions.clear(); - this.transition = null; - }; - return UIRouterGlobals; -}()); - -//# sourceMappingURL=globals.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/hooks/coreResolvables.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/hooks/coreResolvables.js ***! - \**********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "registerAddCoreResolvables": () => (/* binding */ registerAddCoreResolvables), -/* harmony export */ "treeChangesCleanup": () => (/* binding */ treeChangesCleanup) -/* harmony export */ }); -/* harmony import */ var _transition_transition__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../transition/transition */ "./node_modules/@uirouter/core/lib-esm/transition/transition.js"); -/* harmony import */ var _router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../router */ "./node_modules/@uirouter/core/lib-esm/router.js"); -/* harmony import */ var _resolve__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../resolve */ "./node_modules/@uirouter/core/lib-esm/resolve/index.js"); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); - - - - -function addCoreResolvables(trans) { - trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData(_router__WEBPACK_IMPORTED_MODULE_1__.UIRouter, trans.router), ''); - trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData(_transition_transition__WEBPACK_IMPORTED_MODULE_0__.Transition, trans), ''); - trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData('$transition$', trans), ''); - trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData('$stateParams', trans.params()), ''); - trans.entering().forEach(function (state) { - trans.addResolvable(_resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData('$state$', state), state); - }); -} -var registerAddCoreResolvables = function (transitionService) { - return transitionService.onCreate({}, addCoreResolvables); -}; -var TRANSITION_TOKENS = ['$transition$', _transition_transition__WEBPACK_IMPORTED_MODULE_0__.Transition]; -var isTransition = (0,_common__WEBPACK_IMPORTED_MODULE_3__.inArray)(TRANSITION_TOKENS); -// References to Transition in the treeChanges pathnodes makes all -// previous Transitions reachable in memory, causing a memory leak -// This function removes resolves for '$transition$' and `Transition` from the treeChanges. -// Do not use this on current transitions, only on old ones. -var treeChangesCleanup = function (trans) { - var nodes = (0,_common__WEBPACK_IMPORTED_MODULE_3__.values)(trans.treeChanges()).reduce(_common__WEBPACK_IMPORTED_MODULE_3__.unnestR, []).reduce(_common__WEBPACK_IMPORTED_MODULE_3__.uniqR, []); - // If the resolvable is a Transition, return a new resolvable with null data - var replaceTransitionWithNull = function (r) { - return isTransition(r.token) ? _resolve__WEBPACK_IMPORTED_MODULE_2__.Resolvable.fromData(r.token, null) : r; - }; - nodes.forEach(function (node) { - node.resolvables = node.resolvables.map(replaceTransitionWithNull); - }); -}; -//# sourceMappingURL=coreResolvables.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/hooks/ignoredTransition.js": -/*!************************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/hooks/ignoredTransition.js ***! - \************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "registerIgnoredTransitionHook": () => (/* binding */ registerIgnoredTransitionHook) -/* harmony export */ }); -/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); -/* harmony import */ var _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transition/rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); - - -/** - * A [[TransitionHookFn]] that skips a transition if it should be ignored - * - * This hook is invoked at the end of the onBefore phase. - * - * If the transition should be ignored (because no parameter or states changed) - * then the transition is ignored and not processed. - */ -function ignoredHook(trans) { - var ignoredReason = trans._ignoredReason(); - if (!ignoredReason) - return; - _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceTransitionIgnored(trans); - var pending = trans.router.globals.transition; - // The user clicked a link going back to the *current state* ('A') - // However, there is also a pending transition in flight (to 'B') - // Abort the transition to 'B' because the user now wants to be back at 'A'. - if (ignoredReason === 'SameAsCurrent' && pending) { - pending.abort(); - } - return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_1__.Rejection.ignored().toPromise(); -} -var registerIgnoredTransitionHook = function (transitionService) { - return transitionService.onBefore({}, ignoredHook, { priority: -9999 }); -}; -//# sourceMappingURL=ignoredTransition.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/hooks/invalidTransition.js": -/*!************************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/hooks/invalidTransition.js ***! - \************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "registerInvalidTransitionHook": () => (/* binding */ registerInvalidTransitionHook) -/* harmony export */ }); -/** - * A [[TransitionHookFn]] that rejects the Transition if it is invalid - * - * This hook is invoked at the end of the onBefore phase. - * If the transition is invalid (for example, param values do not validate) - * then the transition is rejected. - */ -function invalidTransitionHook(trans) { - if (!trans.valid()) { - throw new Error(trans.error().toString()); - } -} -var registerInvalidTransitionHook = function (transitionService) { - return transitionService.onBefore({}, invalidTransitionHook, { priority: -10000 }); -}; -//# sourceMappingURL=invalidTransition.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js": -/*!***************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js ***! - \***************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "registerLazyLoadHook": () => (/* binding */ registerLazyLoadHook), -/* harmony export */ "lazyLoadState": () => (/* binding */ lazyLoadState) -/* harmony export */ }); -/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); - -/** - * A [[TransitionHookFn]] that performs lazy loading - * - * When entering a state "abc" which has a `lazyLoad` function defined: - * - Invoke the `lazyLoad` function (unless it is already in process) - * - Flag the hook function as "in process" - * - The function should return a promise (that resolves when lazy loading is complete) - * - Wait for the promise to settle - * - If the promise resolves to a [[LazyLoadResult]], then register those states - * - Flag the hook function as "not in process" - * - If the hook was successful - * - Remove the `lazyLoad` function from the state declaration - * - If all the hooks were successful - * - Retry the transition (by returning a TargetState) - * - * ``` - * .state('abc', { - * component: 'fooComponent', - * lazyLoad: () => import('./fooComponent') - * }); - * ``` - * - * See [[StateDeclaration.lazyLoad]] - */ -var lazyLoadHook = function (transition) { - var router = transition.router; - function retryTransition() { - if (transition.originalTransition().options().source !== 'url') { - // The original transition was not triggered via url sync - // The lazy state should be loaded now, so re-try the original transition - var orig = transition.targetState(); - return router.stateService.target(orig.identifier(), orig.params(), orig.options()); - } - // The original transition was triggered via url sync - // Run the URL rules and find the best match - var $url = router.urlService; - var result = $url.match($url.parts()); - var rule = result && result.rule; - // If the best match is a state, redirect the transition (instead - // of calling sync() which supersedes the current transition) - if (rule && rule.type === 'STATE') { - var state = rule.state; - var params = result.match; - return router.stateService.target(state, params, transition.options()); - } - // No matching state found, so let .sync() choose the best non-state match/otherwise - router.urlService.sync(); - } - var promises = transition - .entering() - .filter(function (state) { return !!state.$$state().lazyLoad; }) - .map(function (state) { return lazyLoadState(transition, state); }); - return _common_coreservices__WEBPACK_IMPORTED_MODULE_0__.services.$q.all(promises).then(retryTransition); -}; -var registerLazyLoadHook = function (transitionService) { - return transitionService.onBefore({ entering: function (state) { return !!state.lazyLoad; } }, lazyLoadHook); -}; -/** - * Invokes a state's lazy load function - * - * @param transition a Transition context - * @param state the state to lazy load - * @returns A promise for the lazy load result - */ -function lazyLoadState(transition, state) { - var lazyLoadFn = state.$$state().lazyLoad; - // Store/get the lazy load promise on/from the hookfn so it doesn't get re-invoked - var promise = lazyLoadFn['_promise']; - if (!promise) { - var success = function (result) { - delete state.lazyLoad; - delete state.$$state().lazyLoad; - delete lazyLoadFn['_promise']; - return result; - }; - var error = function (err) { - delete lazyLoadFn['_promise']; - return _common_coreservices__WEBPACK_IMPORTED_MODULE_0__.services.$q.reject(err); - }; - promise = lazyLoadFn['_promise'] = _common_coreservices__WEBPACK_IMPORTED_MODULE_0__.services.$q.when(lazyLoadFn(transition, state)) - .then(updateStateRegistry) - .then(success, error); - } - /** Register any lazy loaded state definitions */ - function updateStateRegistry(result) { - if (result && Array.isArray(result.states)) { - result.states.forEach(function (_state) { return transition.router.stateRegistry.register(_state); }); - } - return result; - } - return promise; -} -//# sourceMappingURL=lazyLoad.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/hooks/onEnterExitRetain.js": -/*!************************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/hooks/onEnterExitRetain.js ***! - \************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "registerOnExitHook": () => (/* binding */ registerOnExitHook), -/* harmony export */ "registerOnRetainHook": () => (/* binding */ registerOnRetainHook), -/* harmony export */ "registerOnEnterHook": () => (/* binding */ registerOnEnterHook) -/* harmony export */ }); -/** - * A factory which creates an onEnter, onExit or onRetain transition hook function - * - * The returned function invokes the (for instance) state.onEnter hook when the - * state is being entered. - */ -function makeEnterExitRetainHook(hookName) { - return function (transition, state) { - var _state = state.$$state(); - var hookFn = _state[hookName]; - return hookFn(transition, state); - }; -} -/** - * The [[TransitionStateHookFn]] for onExit - * - * When the state is being exited, the state's .onExit function is invoked. - * - * Registered using `transitionService.onExit({ exiting: (state) => !!state.onExit }, onExitHook);` - * - * See: [[IHookRegistry.onExit]] - */ -var onExitHook = makeEnterExitRetainHook('onExit'); -var registerOnExitHook = function (transitionService) { - return transitionService.onExit({ exiting: function (state) { return !!state.onExit; } }, onExitHook); -}; -/** - * The [[TransitionStateHookFn]] for onRetain - * - * When the state was already entered, and is not being exited or re-entered, the state's .onRetain function is invoked. - * - * Registered using `transitionService.onRetain({ retained: (state) => !!state.onRetain }, onRetainHook);` - * - * See: [[IHookRegistry.onRetain]] - */ -var onRetainHook = makeEnterExitRetainHook('onRetain'); -var registerOnRetainHook = function (transitionService) { - return transitionService.onRetain({ retained: function (state) { return !!state.onRetain; } }, onRetainHook); -}; -/** - * The [[TransitionStateHookFn]] for onEnter - * - * When the state is being entered, the state's .onEnter function is invoked. - * - * Registered using `transitionService.onEnter({ entering: (state) => !!state.onEnter }, onEnterHook);` - * - * See: [[IHookRegistry.onEnter]] - */ -var onEnterHook = makeEnterExitRetainHook('onEnter'); -var registerOnEnterHook = function (transitionService) { - return transitionService.onEnter({ entering: function (state) { return !!state.onEnter; } }, onEnterHook); -}; -//# sourceMappingURL=onEnterExitRetain.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/hooks/redirectTo.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/hooks/redirectTo.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "registerRedirectToHook": () => (/* binding */ registerRedirectToHook) -/* harmony export */ }); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); -/* harmony import */ var _state_targetState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../state/targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); - - - -/** - * A [[TransitionHookFn]] that redirects to a different state or params - * - * Registered using `transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectHook);` - * - * See [[StateDeclaration.redirectTo]] - */ -var redirectToHook = function (trans) { - var redirect = trans.to().redirectTo; - if (!redirect) - return; - var $state = trans.router.stateService; - function handleResult(result) { - if (!result) - return; - if (result instanceof _state_targetState__WEBPACK_IMPORTED_MODULE_2__.TargetState) - return result; - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(result)) - return $state.target(result, trans.params(), trans.options()); - if (result['state'] || result['params']) - return $state.target(result['state'] || trans.to(), result['params'] || trans.params(), trans.options()); - } - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isFunction)(redirect)) { - return _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(redirect(trans)).then(handleResult); - } - return handleResult(redirect); -}; -var registerRedirectToHook = function (transitionService) { - return transitionService.onStart({ to: function (state) { return !!state.redirectTo; } }, redirectToHook); -}; -//# sourceMappingURL=redirectTo.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/hooks/resolve.js": -/*!**************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/hooks/resolve.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "RESOLVE_HOOK_PRIORITY": () => (/* binding */ RESOLVE_HOOK_PRIORITY), -/* harmony export */ "registerEagerResolvePath": () => (/* binding */ registerEagerResolvePath), -/* harmony export */ "registerLazyResolveState": () => (/* binding */ registerLazyResolveState), -/* harmony export */ "registerResolveRemaining": () => (/* binding */ registerResolveRemaining) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../resolve/resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); - - - -var RESOLVE_HOOK_PRIORITY = 1000; -/** - * A [[TransitionHookFn]] which resolves all EAGER Resolvables in the To Path - * - * Registered using `transitionService.onStart({}, eagerResolvePath, { priority: 1000 });` - * - * When a Transition starts, this hook resolves all the EAGER Resolvables, which the transition then waits for. - * - * See [[StateDeclaration.resolve]] - */ -var eagerResolvePath = function (trans) { - return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__.ResolveContext(trans.treeChanges().to).resolvePath('EAGER', trans).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); -}; -var registerEagerResolvePath = function (transitionService) { - return transitionService.onStart({}, eagerResolvePath, { priority: RESOLVE_HOOK_PRIORITY }); -}; -/** - * A [[TransitionHookFn]] which resolves all LAZY Resolvables for the state (and all its ancestors) in the To Path - * - * Registered using `transitionService.onEnter({ entering: () => true }, lazyResolveState, { priority: 1000 });` - * - * When a State is being entered, this hook resolves all the Resolvables for this state, which the transition then waits for. - * - * See [[StateDeclaration.resolve]] - */ -var lazyResolveState = function (trans, state) { - return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__.ResolveContext(trans.treeChanges().to).subContext(state.$$state()).resolvePath('LAZY', trans).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); -}; -var registerLazyResolveState = function (transitionService) { - return transitionService.onEnter({ entering: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.val)(true) }, lazyResolveState, { priority: RESOLVE_HOOK_PRIORITY }); -}; -/** - * A [[TransitionHookFn]] which resolves any dynamically added (LAZY or EAGER) Resolvables. - * - * Registered using `transitionService.onFinish({}, eagerResolvePath, { priority: 1000 });` - * - * After all entering states have been entered, this hook resolves any remaining Resolvables. - * These are typically dynamic resolves which were added by some Transition Hook using [[Transition.addResolvable]]. - * - * See [[StateDeclaration.resolve]] - */ -var resolveRemaining = function (trans) { - return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_1__.ResolveContext(trans.treeChanges().to).resolvePath('LAZY', trans).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); -}; -var registerResolveRemaining = function (transitionService) { - return transitionService.onFinish({}, resolveRemaining, { priority: RESOLVE_HOOK_PRIORITY }); -}; -//# sourceMappingURL=resolve.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/hooks/updateGlobals.js": -/*!********************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/hooks/updateGlobals.js ***! - \********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "registerUpdateGlobalState": () => (/* binding */ registerUpdateGlobalState) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); - -/** - * A [[TransitionHookFn]] which updates global UI-Router state - * - * Registered using `transitionService.onBefore({}, updateGlobalState);` - * - * Before a [[Transition]] starts, updates the global value of "the current transition" ([[Globals.transition]]). - * After a successful [[Transition]], updates the global values of "the current state" - * ([[Globals.current]] and [[Globals.$current]]) and "the current param values" ([[Globals.params]]). - * - * See also the deprecated properties: - * [[StateService.transition]], [[StateService.current]], [[StateService.params]] - */ -var updateGlobalState = function (trans) { - var globals = trans.router.globals; - var transitionSuccessful = function () { - globals.successfulTransitions.enqueue(trans); - globals.$current = trans.$to(); - globals.current = globals.$current.self; - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.copy)(trans.params(), globals.params); - }; - var clearCurrentTransition = function () { - // Do not clear globals.transition if a different transition has started in the meantime - if (globals.transition === trans) - globals.transition = null; - }; - trans.onSuccess({}, transitionSuccessful, { priority: 10000 }); - trans.promise.then(clearCurrentTransition, clearCurrentTransition); -}; -var registerUpdateGlobalState = function (transitionService) { - return transitionService.onCreate({}, updateGlobalState); -}; -//# sourceMappingURL=updateGlobals.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/hooks/url.js": -/*!**********************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/hooks/url.js ***! - \**********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "registerUpdateUrl": () => (/* binding */ registerUpdateUrl) -/* harmony export */ }); -/** - * A [[TransitionHookFn]] which updates the URL after a successful transition - * - * Registered using `transitionService.onSuccess({}, updateUrl);` - */ -var updateUrl = function (transition) { - var options = transition.options(); - var $state = transition.router.stateService; - var $urlRouter = transition.router.urlRouter; - // Dont update the url in these situations: - // The transition was triggered by a URL sync (options.source === 'url') - // The user doesn't want the url to update (options.location === false) - // The destination state, and all parents have no navigable url - if (options.source !== 'url' && options.location && $state.$current.navigable) { - var urlOptions = { replace: options.location === 'replace' }; - $urlRouter.push($state.$current.navigable.url, $state.params, urlOptions); - } - $urlRouter.update(true); -}; -var registerUpdateUrl = function (transitionService) { - return transitionService.onSuccess({}, updateUrl, { priority: 9999 }); -}; -//# sourceMappingURL=url.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/hooks/views.js": -/*!************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/hooks/views.js ***! - \************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "registerLoadEnteringViews": () => (/* binding */ registerLoadEnteringViews), -/* harmony export */ "registerActivateViews": () => (/* binding */ registerActivateViews) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); - - -/** - * A [[TransitionHookFn]] which waits for the views to load - * - * Registered using `transitionService.onStart({}, loadEnteringViews);` - * - * Allows the views to do async work in [[ViewConfig.load]] before the transition continues. - * In angular 1, this includes loading the templates. - */ -var loadEnteringViews = function (transition) { - var $q = _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q; - var enteringViews = transition.views('entering'); - if (!enteringViews.length) - return; - return $q.all(enteringViews.map(function (view) { return $q.when(view.load()); })).then(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); -}; -var registerLoadEnteringViews = function (transitionService) { - return transitionService.onFinish({}, loadEnteringViews); -}; -/** - * A [[TransitionHookFn]] which activates the new views when a transition is successful. - * - * Registered using `transitionService.onSuccess({}, activateViews);` - * - * After a transition is complete, this hook deactivates the old views from the previous state, - * and activates the new views from the destination state. - * - * See [[ViewService]] - */ -var activateViews = function (transition) { - var enteringViews = transition.views('entering'); - var exitingViews = transition.views('exiting'); - if (!enteringViews.length && !exitingViews.length) - return; - var $view = transition.router.viewService; - exitingViews.forEach(function (vc) { return $view.deactivateViewConfig(vc); }); - enteringViews.forEach(function (vc) { return $view.activateViewConfig(vc); }); - $view.sync(); -}; -var registerActivateViews = function (transitionService) { - return transitionService.onSuccess({}, activateViews); -}; -//# sourceMappingURL=views.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/index.js": -/*!******************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/index.js ***! - \******************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Category": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Category), -/* harmony export */ "Glob": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Glob), -/* harmony export */ "Queue": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Queue), -/* harmony export */ "Trace": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.Trace), -/* harmony export */ "_extend": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._extend), -/* harmony export */ "_inArray": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._inArray), -/* harmony export */ "_pushTo": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._pushTo), -/* harmony export */ "_removeFrom": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__._removeFrom), -/* harmony export */ "all": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.all), -/* harmony export */ "allTrueR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.allTrueR), -/* harmony export */ "ancestors": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.ancestors), -/* harmony export */ "and": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.and), -/* harmony export */ "any": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.any), -/* harmony export */ "anyTrueR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.anyTrueR), -/* harmony export */ "applyPairs": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.applyPairs), -/* harmony export */ "arrayTuples": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.arrayTuples), -/* harmony export */ "assertFn": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.assertFn), -/* harmony export */ "assertMap": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.assertMap), -/* harmony export */ "assertPredicate": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.assertPredicate), -/* harmony export */ "beforeAfterSubstr": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.beforeAfterSubstr), -/* harmony export */ "compose": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.compose), -/* harmony export */ "copy": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.copy), -/* harmony export */ "createProxyFunctions": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions), -/* harmony export */ "curry": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.curry), -/* harmony export */ "defaults": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.defaults), -/* harmony export */ "deregAll": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.deregAll), -/* harmony export */ "eq": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.eq), -/* harmony export */ "equals": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.equals), -/* harmony export */ "extend": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.extend), -/* harmony export */ "filter": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.filter), -/* harmony export */ "find": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.find), -/* harmony export */ "flatten": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.flatten), -/* harmony export */ "flattenR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.flattenR), -/* harmony export */ "fnToString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.fnToString), -/* harmony export */ "forEach": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.forEach), -/* harmony export */ "fromJson": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.fromJson), -/* harmony export */ "functionToString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.functionToString), -/* harmony export */ "hostRegex": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.hostRegex), -/* harmony export */ "identity": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.identity), -/* harmony export */ "inArray": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.inArray), -/* harmony export */ "inherit": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.inherit), -/* harmony export */ "invoke": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.invoke), -/* harmony export */ "is": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.is), -/* harmony export */ "isArray": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isArray), -/* harmony export */ "isDate": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isDate), -/* harmony export */ "isDefined": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isDefined), -/* harmony export */ "isFunction": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isFunction), -/* harmony export */ "isInjectable": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isInjectable), -/* harmony export */ "isNull": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isNull), -/* harmony export */ "isNullOrUndefined": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isNullOrUndefined), -/* harmony export */ "isNumber": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isNumber), -/* harmony export */ "isObject": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isObject), -/* harmony export */ "isPromise": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isPromise), -/* harmony export */ "isRegExp": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isRegExp), -/* harmony export */ "isString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isString), -/* harmony export */ "isUndefined": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.isUndefined), -/* harmony export */ "joinNeighborsR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.joinNeighborsR), -/* harmony export */ "kebobString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.kebobString), -/* harmony export */ "makeStub": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.makeStub), -/* harmony export */ "map": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.map), -/* harmony export */ "mapObj": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.mapObj), -/* harmony export */ "maxLength": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.maxLength), -/* harmony export */ "mergeR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.mergeR), -/* harmony export */ "noop": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.noop), -/* harmony export */ "not": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.not), -/* harmony export */ "omit": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.omit), -/* harmony export */ "or": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.or), -/* harmony export */ "padString": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.padString), -/* harmony export */ "pairs": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pairs), -/* harmony export */ "parse": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.parse), -/* harmony export */ "pattern": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pattern), -/* harmony export */ "pick": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pick), -/* harmony export */ "pipe": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pipe), -/* harmony export */ "pluck": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pluck), -/* harmony export */ "prop": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.prop), -/* harmony export */ "propEq": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.propEq), -/* harmony export */ "pushR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pushR), -/* harmony export */ "pushTo": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.pushTo), -/* harmony export */ "removeFrom": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.removeFrom), -/* harmony export */ "root": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.root), -/* harmony export */ "services": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.services), -/* harmony export */ "silenceUncaughtInPromise": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.silenceUncaughtInPromise), -/* harmony export */ "silentRejection": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.silentRejection), -/* harmony export */ "splitEqual": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitEqual), -/* harmony export */ "splitHash": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitHash), -/* harmony export */ "splitOnDelim": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitOnDelim), -/* harmony export */ "splitQuery": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.splitQuery), -/* harmony export */ "stringify": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.stringify), -/* harmony export */ "stripLastPathElement": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.stripLastPathElement), -/* harmony export */ "tail": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.tail), -/* harmony export */ "toJson": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.toJson), -/* harmony export */ "trace": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.trace), -/* harmony export */ "trimHashVal": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.trimHashVal), -/* harmony export */ "uniqR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.uniqR), -/* harmony export */ "unnest": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.unnest), -/* harmony export */ "unnestR": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.unnestR), -/* harmony export */ "val": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.val), -/* harmony export */ "values": () => (/* reexport safe */ _common_index__WEBPACK_IMPORTED_MODULE_0__.values), -/* harmony export */ "PathNode": () => (/* reexport safe */ _path_index__WEBPACK_IMPORTED_MODULE_2__.PathNode), -/* harmony export */ "PathUtils": () => (/* reexport safe */ _path_index__WEBPACK_IMPORTED_MODULE_2__.PathUtils), -/* harmony export */ "NATIVE_INJECTOR_TOKEN": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.NATIVE_INJECTOR_TOKEN), -/* harmony export */ "Resolvable": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.Resolvable), -/* harmony export */ "ResolveContext": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.ResolveContext), -/* harmony export */ "defaultResolvePolicy": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.defaultResolvePolicy), -/* harmony export */ "resolvePolicies": () => (/* reexport safe */ _resolve_index__WEBPACK_IMPORTED_MODULE_3__.resolvePolicies), -/* harmony export */ "HookBuilder": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.HookBuilder), -/* harmony export */ "RegisteredHook": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.RegisteredHook), -/* harmony export */ "RejectType": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.RejectType), -/* harmony export */ "Rejection": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.Rejection), -/* harmony export */ "Transition": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.Transition), -/* harmony export */ "TransitionEventType": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionEventType), -/* harmony export */ "TransitionHook": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionHook), -/* harmony export */ "TransitionHookPhase": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionHookPhase), -/* harmony export */ "TransitionHookScope": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionHookScope), -/* harmony export */ "TransitionService": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.TransitionService), -/* harmony export */ "defaultTransOpts": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.defaultTransOpts), -/* harmony export */ "makeEvent": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.makeEvent), -/* harmony export */ "matchState": () => (/* reexport safe */ _transition_index__WEBPACK_IMPORTED_MODULE_5__.matchState), -/* harmony export */ "UIRouterGlobals": () => (/* reexport safe */ _globals__WEBPACK_IMPORTED_MODULE_8__.UIRouterGlobals), -/* harmony export */ "UIRouter": () => (/* reexport safe */ _router__WEBPACK_IMPORTED_MODULE_9__.UIRouter), -/* harmony export */ "UIRouterPluginBase": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_11__.UIRouterPluginBase) -/* harmony export */ }); -/* harmony import */ var _common_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common/index */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); -/* harmony import */ var _params_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./params/index */ "./node_modules/@uirouter/core/lib-esm/params/index.js"); -/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; -/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _params_index__WEBPACK_IMPORTED_MODULE_1__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _params_index__WEBPACK_IMPORTED_MODULE_1__[__WEBPACK_IMPORT_KEY__] -/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); -/* harmony import */ var _path_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./path/index */ "./node_modules/@uirouter/core/lib-esm/path/index.js"); -/* harmony import */ var _resolve_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./resolve/index */ "./node_modules/@uirouter/core/lib-esm/resolve/index.js"); -/* harmony import */ var _state_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./state/index */ "./node_modules/@uirouter/core/lib-esm/state/index.js"); -/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; -/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _state_index__WEBPACK_IMPORTED_MODULE_4__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _state_index__WEBPACK_IMPORTED_MODULE_4__[__WEBPACK_IMPORT_KEY__] -/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); -/* harmony import */ var _transition_index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./transition/index */ "./node_modules/@uirouter/core/lib-esm/transition/index.js"); -/* harmony import */ var _url_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./url/index */ "./node_modules/@uirouter/core/lib-esm/url/index.js"); -/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; -/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _url_index__WEBPACK_IMPORTED_MODULE_6__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies","StateBuilder","StateMatcher","StateObject","StateQueueManager","StateRegistry","StateService","TargetState","resolvablesBuilder","HookBuilder","RegisteredHook","RejectType","Rejection","Transition","TransitionEventType","TransitionHook","TransitionHookPhase","TransitionHookScope","TransitionService","defaultTransOpts","makeEvent","matchState"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _url_index__WEBPACK_IMPORTED_MODULE_6__[__WEBPACK_IMPORT_KEY__] -/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); -/* harmony import */ var _view_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./view/index */ "./node_modules/@uirouter/core/lib-esm/view/index.js"); -/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; -/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _view_index__WEBPACK_IMPORTED_MODULE_7__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies","StateBuilder","StateMatcher","StateObject","StateQueueManager","StateRegistry","StateService","TargetState","resolvablesBuilder","HookBuilder","RegisteredHook","RejectType","Rejection","Transition","TransitionEventType","TransitionHook","TransitionHookPhase","TransitionHookScope","TransitionService","defaultTransOpts","makeEvent","matchState","BaseUrlRule","ParamFactory","UrlConfig","UrlMatcher","UrlMatcherFactory","UrlRouter","UrlRuleFactory","UrlRules","UrlService"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _view_index__WEBPACK_IMPORTED_MODULE_7__[__WEBPACK_IMPORT_KEY__] -/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); -/* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./globals */ "./node_modules/@uirouter/core/lib-esm/globals.js"); -/* harmony import */ var _router__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./router */ "./node_modules/@uirouter/core/lib-esm/router.js"); -/* harmony import */ var _vanilla__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./vanilla */ "./node_modules/@uirouter/core/lib-esm/vanilla.js"); -/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; -/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _vanilla__WEBPACK_IMPORTED_MODULE_10__) if(["default","Category","Glob","Queue","Trace","_extend","_inArray","_pushTo","_removeFrom","all","allTrueR","ancestors","and","any","anyTrueR","applyPairs","arrayTuples","assertFn","assertMap","assertPredicate","beforeAfterSubstr","compose","copy","createProxyFunctions","curry","defaults","deregAll","eq","equals","extend","filter","find","flatten","flattenR","fnToString","forEach","fromJson","functionToString","hostRegex","identity","inArray","inherit","invoke","is","isArray","isDate","isDefined","isFunction","isInjectable","isNull","isNullOrUndefined","isNumber","isObject","isPromise","isRegExp","isString","isUndefined","joinNeighborsR","kebobString","makeStub","map","mapObj","maxLength","mergeR","noop","not","omit","or","padString","pairs","parse","pattern","pick","pipe","pluck","prop","propEq","pushR","pushTo","removeFrom","root","services","silenceUncaughtInPromise","silentRejection","splitEqual","splitHash","splitOnDelim","splitQuery","stringify","stripLastPathElement","tail","toJson","trace","trimHashVal","uniqR","unnest","unnestR","val","values","DefType","Param","ParamType","ParamTypes","StateParams","PathNode","PathUtils","NATIVE_INJECTOR_TOKEN","Resolvable","ResolveContext","defaultResolvePolicy","resolvePolicies","StateBuilder","StateMatcher","StateObject","StateQueueManager","StateRegistry","StateService","TargetState","resolvablesBuilder","HookBuilder","RegisteredHook","RejectType","Rejection","Transition","TransitionEventType","TransitionHook","TransitionHookPhase","TransitionHookScope","TransitionService","defaultTransOpts","makeEvent","matchState","BaseUrlRule","ParamFactory","UrlConfig","UrlMatcher","UrlMatcherFactory","UrlRouter","UrlRuleFactory","UrlRules","UrlService","ViewService","UIRouterGlobals","UIRouter"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _vanilla__WEBPACK_IMPORTED_MODULE_10__[__WEBPACK_IMPORT_KEY__] -/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/interface.js"); - - - - - - - - - - - - -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/interface.js": -/*!**********************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/interface.js ***! - \**********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "UIRouterPluginBase": () => (/* binding */ UIRouterPluginBase) -/* harmony export */ }); -var UIRouterPluginBase = /** @class */ (function () { - function UIRouterPluginBase() { - } - UIRouterPluginBase.prototype.dispose = function (router) { }; - return UIRouterPluginBase; -}()); - -//# sourceMappingURL=interface.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/params/index.js": -/*!*************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/params/index.js ***! - \*************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "DefType": () => (/* reexport safe */ _param__WEBPACK_IMPORTED_MODULE_1__.DefType), -/* harmony export */ "Param": () => (/* reexport safe */ _param__WEBPACK_IMPORTED_MODULE_1__.Param), -/* harmony export */ "ParamTypes": () => (/* reexport safe */ _paramTypes__WEBPACK_IMPORTED_MODULE_2__.ParamTypes), -/* harmony export */ "StateParams": () => (/* reexport safe */ _stateParams__WEBPACK_IMPORTED_MODULE_3__.StateParams), -/* harmony export */ "ParamType": () => (/* reexport safe */ _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType) -/* harmony export */ }); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/params/interface.js"); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); -/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; -/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] -/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); -/* harmony import */ var _param__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); -/* harmony import */ var _paramTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./paramTypes */ "./node_modules/@uirouter/core/lib-esm/params/paramTypes.js"); -/* harmony import */ var _stateParams__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stateParams */ "./node_modules/@uirouter/core/lib-esm/params/stateParams.js"); -/* harmony import */ var _paramType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./paramType */ "./node_modules/@uirouter/core/lib-esm/params/paramType.js"); -/** - * This module contains code for State Parameters. - * - * See [[ParamDeclaration]] - * - * @packageDocumentation @preferred - */ - - - - - -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/params/interface.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/params/interface.js ***! - \*****************************************************************/ -/***/ (() => { - -//# sourceMappingURL=interface.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/params/param.js": -/*!*************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/params/param.js ***! - \*************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "DefType": () => (/* binding */ DefType), -/* harmony export */ "Param": () => (/* binding */ Param) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); -/* harmony import */ var _paramType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./paramType */ "./node_modules/@uirouter/core/lib-esm/params/paramType.js"); - - - - - -var hasOwn = Object.prototype.hasOwnProperty; -var isShorthand = function (cfg) { - return ['value', 'type', 'squash', 'array', 'dynamic'].filter(hasOwn.bind(cfg || {})).length === 0; -}; -var DefType; -(function (DefType) { - DefType[DefType["PATH"] = 0] = "PATH"; - DefType[DefType["SEARCH"] = 1] = "SEARCH"; - DefType[DefType["CONFIG"] = 2] = "CONFIG"; -})(DefType || (DefType = {})); - -function getParamDeclaration(paramName, location, state) { - var noReloadOnSearch = (state.reloadOnSearch === false && location === DefType.SEARCH) || undefined; - var dynamic = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)([state.dynamic, noReloadOnSearch], _common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined); - var defaultConfig = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(dynamic) ? { dynamic: dynamic } : {}; - var paramConfig = unwrapShorthand(state && state.params && state.params[paramName]); - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(defaultConfig, paramConfig); -} -function unwrapShorthand(cfg) { - cfg = isShorthand(cfg) ? { value: cfg } : cfg; - getStaticDefaultValue['__cacheable'] = true; - function getStaticDefaultValue() { - return cfg.value; - } - var $$fn = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isInjectable)(cfg.value) ? cfg.value : getStaticDefaultValue; - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(cfg, { $$fn: $$fn }); -} -function getType(cfg, urlType, location, id, paramTypes) { - if (cfg.type && urlType && urlType.name !== 'string') - throw new Error("Param '" + id + "' has two type configurations."); - if (cfg.type && urlType && urlType.name === 'string' && paramTypes.type(cfg.type)) - return paramTypes.type(cfg.type); - if (urlType) - return urlType; - if (!cfg.type) { - var type = location === DefType.CONFIG - ? 'any' - : location === DefType.PATH - ? 'path' - : location === DefType.SEARCH - ? 'query' - : 'string'; - return paramTypes.type(type); - } - return cfg.type instanceof _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType ? cfg.type : paramTypes.type(cfg.type); -} -/** returns false, true, or the squash value to indicate the "default parameter url squash policy". */ -function getSquashPolicy(config, isOptional, defaultPolicy) { - var squash = config.squash; - if (!isOptional || squash === false) - return false; - if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(squash) || squash == null) - return defaultPolicy; - if (squash === true || (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(squash)) - return squash; - throw new Error("Invalid squash policy: '" + squash + "'. Valid policies: false, true, or arbitrary string"); -} -function getReplace(config, arrayMode, isOptional, squash) { - var defaultPolicy = [ - { from: '', to: isOptional || arrayMode ? undefined : '' }, - { from: null, to: isOptional || arrayMode ? undefined : '' }, - ]; - var replace = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(config.replace) ? config.replace : []; - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(squash)) - replace.push({ from: squash, to: undefined }); - var configuredKeys = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(replace, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('from')); - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.filter)(defaultPolicy, function (item) { return configuredKeys.indexOf(item.from) === -1; }).concat(replace); -} -var Param = /** @class */ (function () { - function Param(id, type, location, urlConfig, state) { - var config = getParamDeclaration(id, location, state); - type = getType(config, type, location, id, urlConfig.paramTypes); - var arrayMode = getArrayMode(); - type = arrayMode ? type.$asArray(arrayMode, location === DefType.SEARCH) : type; - var isOptional = config.value !== undefined || location === DefType.SEARCH; - var dynamic = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(config.dynamic) ? !!config.dynamic : !!type.dynamic; - var raw = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(config.raw) ? !!config.raw : !!type.raw; - var squash = getSquashPolicy(config, isOptional, urlConfig.defaultSquashPolicy()); - var replace = getReplace(config, arrayMode, isOptional, squash); - var inherit = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(config.inherit) ? !!config.inherit : !!type.inherit; - // array config: param name (param[]) overrides default settings. explicit config overrides param name. - function getArrayMode() { - var arrayDefaults = { array: location === DefType.SEARCH ? 'auto' : false }; - var arrayParamNomenclature = id.match(/\[\]$/) ? { array: true } : {}; - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(arrayDefaults, arrayParamNomenclature, config).array; - } - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, { id: id, type: type, location: location, isOptional: isOptional, dynamic: dynamic, raw: raw, squash: squash, replace: replace, inherit: inherit, array: arrayMode, config: config }); - } - Param.values = function (params, values) { - if (values === void 0) { values = {}; } - var paramValues = {}; - for (var _i = 0, params_1 = params; _i < params_1.length; _i++) { - var param = params_1[_i]; - paramValues[param.id] = param.value(values[param.id]); - } - return paramValues; - }; - /** - * Finds [[Param]] objects which have different param values - * - * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects - * - * @param params: The list of Param objects to filter - * @param values1: The first set of parameter values - * @param values2: the second set of parameter values - * - * @returns any Param objects whose values were different between values1 and values2 - */ - Param.changed = function (params, values1, values2) { - if (values1 === void 0) { values1 = {}; } - if (values2 === void 0) { values2 = {}; } - return params.filter(function (param) { return !param.type.equals(values1[param.id], values2[param.id]); }); - }; - /** - * Checks if two param value objects are equal (for a set of [[Param]] objects) - * - * @param params The list of [[Param]] objects to check - * @param values1 The first set of param values - * @param values2 The second set of param values - * - * @returns true if the param values in values1 and values2 are equal - */ - Param.equals = function (params, values1, values2) { - if (values1 === void 0) { values1 = {}; } - if (values2 === void 0) { values2 = {}; } - return Param.changed(params, values1, values2).length === 0; - }; - /** Returns true if a the parameter values are valid, according to the Param definitions */ - Param.validates = function (params, values) { - if (values === void 0) { values = {}; } - return params.map(function (param) { return param.validates(values[param.id]); }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.allTrueR, true); - }; - Param.prototype.isDefaultValue = function (value) { - return this.isOptional && this.type.equals(this.value(), value); - }; - /** - * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the - * default value, which may be the result of an injectable function. - */ - Param.prototype.value = function (value) { - var _this = this; - /** - * [Internal] Get the default value of a parameter, which may be an injectable function. - */ - var getDefaultValue = function () { - if (_this._defaultValueCache) - return _this._defaultValueCache.defaultValue; - if (!_common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector) - throw new Error('Injectable functions cannot be called at configuration time'); - var defaultValue = _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector.invoke(_this.config.$$fn); - if (defaultValue !== null && defaultValue !== undefined && !_this.type.is(defaultValue)) - throw new Error("Default value (" + defaultValue + ") for parameter '" + _this.id + "' is not an instance of ParamType (" + _this.type.name + ")"); - if (_this.config.$$fn['__cacheable']) { - _this._defaultValueCache = { defaultValue: defaultValue }; - } - return defaultValue; - }; - var replaceSpecialValues = function (val) { - for (var _i = 0, _a = _this.replace; _i < _a.length; _i++) { - var tuple = _a[_i]; - if (tuple.from === val) - return tuple.to; - } - return val; - }; - value = replaceSpecialValues(value); - return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isUndefined)(value) ? getDefaultValue() : this.type.$normalize(value); - }; - Param.prototype.isSearch = function () { - return this.location === DefType.SEARCH; - }; - Param.prototype.validates = function (value) { - // There was no parameter value, but the param is optional - if (((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isUndefined)(value) || value === null) && this.isOptional) - return true; - // The value was not of the correct ParamType, and could not be decoded to the correct ParamType - var normalized = this.type.$normalize(value); - if (!this.type.is(normalized)) - return false; - // The value was of the correct type, but when encoded, did not match the ParamType's regexp - var encoded = this.type.encode(normalized); - return !((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(encoded) && !this.type.pattern.exec(encoded)); - }; - Param.prototype.toString = function () { - return "{Param:" + this.id + " " + this.type + " squash: '" + this.squash + "' optional: " + this.isOptional + "}"; - }; - return Param; -}()); - -//# sourceMappingURL=param.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/params/paramType.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/params/paramType.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ParamType": () => (/* binding */ ParamType) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); - - -/** - * An internal class which implements [[ParamTypeDefinition]]. - * - * A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types. - * When a param type definition is registered, an instance of this class is created internally. - * - * This class has naive implementations for all the [[ParamTypeDefinition]] methods. - * - * Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values. - * - * #### Example: - * ```js - * var paramTypeDef = { - * decode: function(val) { return parseInt(val, 10); }, - * encode: function(val) { return val && val.toString(); }, - * equals: function(a, b) { return this.is(a) && a === b; }, - * is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; }, - * pattern: /\d+/ - * } - * - * var paramType = new ParamType(paramTypeDef); - * ``` - */ -var ParamType = /** @class */ (function () { - /** - * @param def A configuration object which contains the custom type definition. The object's - * properties will override the default methods and/or pattern in `ParamType`'s public interface. - * @returns a new ParamType object - */ - function ParamType(def) { - /** @inheritdoc */ - this.pattern = /.*/; - /** @inheritdoc */ - this.inherit = true; - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, def); - } - // consider these four methods to be "abstract methods" that should be overridden - /** @inheritdoc */ - ParamType.prototype.is = function (val, key) { - return true; - }; - /** @inheritdoc */ - ParamType.prototype.encode = function (val, key) { - return val; - }; - /** @inheritdoc */ - ParamType.prototype.decode = function (val, key) { - return val; - }; - /** @inheritdoc */ - ParamType.prototype.equals = function (a, b) { - // tslint:disable-next-line:triple-equals - return a == b; - }; - ParamType.prototype.$subPattern = function () { - var sub = this.pattern.toString(); - return sub.substr(1, sub.length - 2); - }; - ParamType.prototype.toString = function () { - return "{ParamType:" + this.name + "}"; - }; - /** Given an encoded string, or a decoded object, returns a decoded object */ - ParamType.prototype.$normalize = function (val) { - return this.is(val) ? val : this.decode(val); - }; - /** - * Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'. - * e.g.: - * - urlmatcher pattern "/path?{queryParam[]:int}" - * - url: "/path?queryParam=1&queryParam=2 - * - $stateParams.queryParam will be [1, 2] - * if `mode` is "auto", then - * - url: "/path?queryParam=1 will create $stateParams.queryParam: 1 - * - url: "/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2] - */ - ParamType.prototype.$asArray = function (mode, isSearch) { - if (!mode) - return this; - if (mode === 'auto' && !isSearch) - throw new Error("'auto' array mode is for query parameters only"); - return new ArrayType(this, mode); - }; - return ParamType; -}()); - -/** Wraps up a `ParamType` object to handle array values. */ -function ArrayType(type, mode) { - var _this = this; - // Wrap non-array value as array - function arrayWrap(val) { - return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(val) ? val : (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(val) ? [val] : []; - } - // Unwrap array value for "auto" mode. Return undefined for empty array. - function arrayUnwrap(val) { - switch (val.length) { - case 0: - return undefined; - case 1: - return mode === 'auto' ? val[0] : val; - default: - return val; - } - } - // Wraps type (.is/.encode/.decode) functions to operate on each value of an array - function arrayHandler(callback, allTruthyMode) { - return function handleArray(val) { - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(val) && val.length === 0) - return val; - var arr = arrayWrap(val); - var result = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(arr, callback); - return allTruthyMode === true ? (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.filter)(result, function (x) { return !x; }).length === 0 : arrayUnwrap(result); - }; - } - // Wraps type (.equals) functions to operate on each value of an array - function arrayEqualsHandler(callback) { - return function handleArray(val1, val2) { - var left = arrayWrap(val1), right = arrayWrap(val2); - if (left.length !== right.length) - return false; - for (var i = 0; i < left.length; i++) { - if (!callback(left[i], right[i])) - return false; - } - return true; - }; - } - ['encode', 'decode', 'equals', '$normalize'].forEach(function (name) { - var paramTypeFn = type[name].bind(type); - var wrapperFn = name === 'equals' ? arrayEqualsHandler : arrayHandler; - _this[name] = wrapperFn(paramTypeFn); - }); - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, { - dynamic: type.dynamic, - name: type.name, - pattern: type.pattern, - inherit: type.inherit, - raw: type.raw, - is: arrayHandler(type.is.bind(type), true), - $arrayMode: mode, - }); -} -//# sourceMappingURL=paramType.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/params/paramTypes.js": -/*!******************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/params/paramTypes.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ParamTypes": () => (/* binding */ ParamTypes) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); -/* harmony import */ var _paramType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./paramType */ "./node_modules/@uirouter/core/lib-esm/params/paramType.js"); - - - - - -/** - * A registry for parameter types. - * - * This registry manages the built-in (and custom) parameter types. - * - * The built-in parameter types are: - * - * - [[string]] - * - [[path]] - * - [[query]] - * - [[hash]] - * - [[int]] - * - [[bool]] - * - [[date]] - * - [[json]] - * - [[any]] - * - * To register custom parameter types, use [[UrlConfig.type]], i.e., - * - * ```js - * router.urlService.config.type(customType) - * ``` - */ -var ParamTypes = /** @class */ (function () { - function ParamTypes() { - this.enqueue = true; - this.typeQueue = []; - this.defaultTypes = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.pick)(ParamTypes.prototype, [ - 'hash', - 'string', - 'query', - 'path', - 'int', - 'bool', - 'date', - 'json', - 'any', - ]); - // Register default types. Store them in the prototype of this.types. - var makeType = function (definition, name) { return new _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ name: name }, definition)); }; - this.types = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(this.defaultTypes, makeType), {}); - } - ParamTypes.prototype.dispose = function () { - this.types = {}; - }; - /** - * Registers a parameter type - * - * End users should call [[UrlMatcherFactory.type]], which delegates to this method. - */ - ParamTypes.prototype.type = function (name, definition, definitionFn) { - if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(definition)) - return this.types[name]; - if (this.types.hasOwnProperty(name)) - throw new Error("A type named '" + name + "' has already been defined."); - this.types[name] = new _paramType__WEBPACK_IMPORTED_MODULE_4__.ParamType((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ name: name }, definition)); - if (definitionFn) { - this.typeQueue.push({ name: name, def: definitionFn }); - if (!this.enqueue) - this._flushTypeQueue(); - } - return this; - }; - ParamTypes.prototype._flushTypeQueue = function () { - while (this.typeQueue.length) { - var type = this.typeQueue.shift(); - if (type.pattern) - throw new Error("You cannot override a type's .pattern at runtime."); - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this.types[type.name], _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector.invoke(type.def)); - } - }; - return ParamTypes; -}()); - -function initDefaultTypes() { - var makeDefaultType = function (def) { - var valToString = function (val) { return (val != null ? val.toString() : val); }; - var defaultTypeBase = { - encode: valToString, - decode: valToString, - is: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(String), - pattern: /.*/, - // tslint:disable-next-line:triple-equals - equals: function (a, b) { return a == b; }, - }; - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, defaultTypeBase, def); - }; - // Default Parameter Type Definitions - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(ParamTypes.prototype, { - string: makeDefaultType({}), - path: makeDefaultType({ - pattern: /[^/]*/, - }), - query: makeDefaultType({}), - hash: makeDefaultType({ - inherit: false, - }), - int: makeDefaultType({ - decode: function (val) { return parseInt(val, 10); }, - is: function (val) { - return !(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isNullOrUndefined)(val) && this.decode(val.toString()) === val; - }, - pattern: /-?\d+/, - }), - bool: makeDefaultType({ - encode: function (val) { return (val && 1) || 0; }, - decode: function (val) { return parseInt(val, 10) !== 0; }, - is: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Boolean), - pattern: /0|1/, - }), - date: makeDefaultType({ - encode: function (val) { - return !this.is(val) - ? undefined - : [val.getFullYear(), ('0' + (val.getMonth() + 1)).slice(-2), ('0' + val.getDate()).slice(-2)].join('-'); - }, - decode: function (val) { - if (this.is(val)) - return val; - var match = this.capture.exec(val); - return match ? new Date(match[1], match[2] - 1, match[3]) : undefined; - }, - is: function (val) { return val instanceof Date && !isNaN(val.valueOf()); }, - equals: function (l, r) { - return ['getFullYear', 'getMonth', 'getDate'].reduce(function (acc, fn) { return acc && l[fn]() === r[fn](); }, true); - }, - pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/, - capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/, - }), - json: makeDefaultType({ - encode: _common_common__WEBPACK_IMPORTED_MODULE_0__.toJson, - decode: _common_common__WEBPACK_IMPORTED_MODULE_0__.fromJson, - is: (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Object), - equals: _common_common__WEBPACK_IMPORTED_MODULE_0__.equals, - pattern: /[^/]*/, - }), - // does not encode/decode - any: makeDefaultType({ - encode: _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, - decode: _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, - is: function () { return true; }, - equals: _common_common__WEBPACK_IMPORTED_MODULE_0__.equals, - }), - }); -} -initDefaultTypes(); -//# sourceMappingURL=paramTypes.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/params/stateParams.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/params/stateParams.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "StateParams": () => (/* binding */ StateParams) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); - -var StateParams = /** @class */ (function () { - function StateParams(params) { - if (params === void 0) { params = {}; } - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, params); - } - /** - * Merges a set of parameters with all parameters inherited between the common parents of the - * current state and a given destination state. - * - * @param {Object} newParams The set of parameters which will be composited with inherited params. - * @param {Object} $current Internal definition of object representing the current state. - * @param {Object} $to Internal definition of object representing state to transition to. - */ - StateParams.prototype.$inherit = function (newParams, $current, $to) { - var parentParams; - var parents = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.ancestors)($current, $to), inherited = {}, inheritList = []; - for (var i in parents) { - if (!parents[i] || !parents[i].params) - continue; - parentParams = Object.keys(parents[i].params); - if (!parentParams.length) - continue; - for (var j in parentParams) { - if (inheritList.indexOf(parentParams[j]) >= 0) - continue; - inheritList.push(parentParams[j]); - inherited[parentParams[j]] = this[parentParams[j]]; - } - } - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, inherited, newParams); - }; - return StateParams; -}()); - -//# sourceMappingURL=stateParams.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/path/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/path/index.js ***! - \***********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "PathNode": () => (/* reexport safe */ _pathNode__WEBPACK_IMPORTED_MODULE_0__.PathNode), -/* harmony export */ "PathUtils": () => (/* reexport safe */ _pathUtils__WEBPACK_IMPORTED_MODULE_1__.PathUtils) -/* harmony export */ }); -/* harmony import */ var _pathNode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pathNode */ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js"); -/* harmony import */ var _pathUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); - - -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js": -/*!**************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/path/pathNode.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "PathNode": () => (/* binding */ PathNode) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); - - - -/** - * A node in a [[TreeChanges]] path - * - * For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path. - * Each PathNode corresponds to a state being entered, exited, or retained. - * The stateful information includes parameter values and resolve data. - */ -var PathNode = /** @class */ (function () { - function PathNode(stateOrNode) { - if (stateOrNode instanceof PathNode) { - var node = stateOrNode; - this.state = node.state; - this.paramSchema = node.paramSchema.slice(); - this.paramValues = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, node.paramValues); - this.resolvables = node.resolvables.slice(); - this.views = node.views && node.views.slice(); - } - else { - var state = stateOrNode; - this.state = state; - this.paramSchema = state.parameters({ inherit: false }); - this.paramValues = {}; - this.resolvables = state.resolvables.map(function (res) { return res.clone(); }); - } - } - PathNode.prototype.clone = function () { - return new PathNode(this); - }; - /** Sets [[paramValues]] for the node, from the values of an object hash */ - PathNode.prototype.applyRawParams = function (params) { - var getParamVal = function (paramDef) { return [paramDef.id, paramDef.value(params[paramDef.id])]; }; - this.paramValues = this.paramSchema.reduce(function (memo, pDef) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.applyPairs)(memo, getParamVal(pDef)); }, {}); - return this; - }; - /** Gets a specific [[Param]] metadata that belongs to the node */ - PathNode.prototype.parameter = function (name) { - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(this.paramSchema, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('id', name)); - }; - /** - * @returns true if the state and parameter values for another PathNode are - * equal to the state and param values for this PathNode - */ - PathNode.prototype.equals = function (node, paramsFn) { - var diff = this.diff(node, paramsFn); - return diff && diff.length === 0; - }; - /** - * Finds Params with different parameter values on another PathNode. - * - * Given another node (of the same state), finds the parameter values which differ. - * Returns the [[Param]] (schema objects) whose parameter values differ. - * - * Given another node for a different state, returns `false` - * - * @param node The node to compare to - * @param paramsFn A function that returns which parameters should be compared. - * @returns The [[Param]]s which differ, or null if the two nodes are for different states - */ - PathNode.prototype.diff = function (node, paramsFn) { - if (this.state !== node.state) - return false; - var params = paramsFn ? paramsFn(this) : this.paramSchema; - return _params_param__WEBPACK_IMPORTED_MODULE_2__.Param.changed(params, this.paramValues, node.paramValues); - }; - /** - * Returns a clone of the PathNode - * @deprecated use instance method `node.clone()` - */ - PathNode.clone = function (node) { return node.clone(); }; - return PathNode; -}()); - -//# sourceMappingURL=pathNode.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js": -/*!***************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/path/pathUtils.js ***! - \***************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "PathUtils": () => (/* binding */ PathUtils) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _state_targetState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../state/targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); -/* harmony import */ var _pathNode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pathNode */ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js"); - - - - -/** - * This class contains functions which convert TargetStates, Nodes and paths from one type to another. - */ -var PathUtils = /** @class */ (function () { - function PathUtils() { - } - /** Given a PathNode[], create an TargetState */ - PathUtils.makeTargetState = function (registry, path) { - var state = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(path).state; - return new _state_targetState__WEBPACK_IMPORTED_MODULE_2__.TargetState(registry, state, path.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('paramValues')).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.mergeR, {}), {}); - }; - PathUtils.buildPath = function (targetState) { - var toParams = targetState.params(); - return targetState.$state().path.map(function (state) { return new _pathNode__WEBPACK_IMPORTED_MODULE_3__.PathNode(state).applyRawParams(toParams); }); - }; - /** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */ - PathUtils.buildToPath = function (fromPath, targetState) { - var toPath = PathUtils.buildPath(targetState); - if (targetState.options().inherit) { - return PathUtils.inheritParams(fromPath, toPath, Object.keys(targetState.params())); - } - return toPath; - }; - /** - * Creates ViewConfig objects and adds to nodes. - * - * On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state - */ - PathUtils.applyViewConfigs = function ($view, path, states) { - // Only apply the viewConfigs to the nodes for the given states - path - .filter(function (node) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(states, node.state); }) - .forEach(function (node) { - var viewDecls = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)(node.state.views || {}); - var subPath = PathUtils.subPath(path, function (n) { return n === node; }); - var viewConfigs = viewDecls.map(function (view) { return $view.createViewConfig(subPath, view); }); - node.views = viewConfigs.reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []); - }); - }; - /** - * Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath - * - * For a parameter in a node to be inherited from the from path: - * - The toPath's node must have a matching node in the fromPath (by state). - * - The parameter name must not be found in the toKeys parameter array. - * - * Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some - * caller, for instance, $state.transitionTo(..., toParams). If a key was found in toParams, - * it is not inherited from the fromPath. - */ - PathUtils.inheritParams = function (fromPath, toPath, toKeys) { - if (toKeys === void 0) { toKeys = []; } - function nodeParamVals(path, state) { - var node = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(path, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('state', state)); - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, node && node.paramValues); - } - var noInherit = fromPath - .map(function (node) { return node.paramSchema; }) - .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) - .filter(function (param) { return !param.inherit; }) - .map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('id')); - /** - * Given an [[PathNode]] "toNode", return a new [[PathNode]] with param values inherited from the - * matching node in fromPath. Only inherit keys that aren't found in "toKeys" from the node in "fromPath"" - */ - function makeInheritedParamsNode(toNode) { - // All param values for the node (may include default key/vals, when key was not found in toParams) - var toParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, toNode && toNode.paramValues); - // limited to only those keys found in toParams - var incomingParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.pick)(toParamVals, toKeys); - toParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.omit)(toParamVals, toKeys); - var fromParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.omit)(nodeParamVals(fromPath, toNode.state) || {}, noInherit); - // extend toParamVals with any fromParamVals, then override any of those those with incomingParamVals - var ownParamVals = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(toParamVals, fromParamVals, incomingParamVals); - return new _pathNode__WEBPACK_IMPORTED_MODULE_3__.PathNode(toNode.state).applyRawParams(ownParamVals); - } - // The param keys specified by the incoming toParams - return toPath.map(makeInheritedParamsNode); - }; - /** - * Computes the tree changes (entering, exiting) between a fromPath and toPath. - */ - PathUtils.treeChanges = function (fromPath, toPath, reloadState) { - var max = Math.min(fromPath.length, toPath.length); - var keep = 0; - var nodesMatch = function (node1, node2) { return node1.equals(node2, PathUtils.nonDynamicParams); }; - while (keep < max && fromPath[keep].state !== reloadState && nodesMatch(fromPath[keep], toPath[keep])) { - keep++; - } - /** Given a retained node, return a new node which uses the to node's param values */ - function applyToParams(retainedNode, idx) { - var cloned = retainedNode.clone(); - cloned.paramValues = toPath[idx].paramValues; - return cloned; - } - var from, retained, exiting, entering, to; - from = fromPath; - retained = from.slice(0, keep); - exiting = from.slice(keep); - // Create a new retained path (with shallow copies of nodes) which have the params of the toPath mapped - var retainedWithToParams = retained.map(applyToParams); - entering = toPath.slice(keep); - to = retainedWithToParams.concat(entering); - return { from: from, to: to, retained: retained, retainedWithToParams: retainedWithToParams, exiting: exiting, entering: entering }; - }; - /** - * Returns a new path which is: the subpath of the first path which matches the second path. - * - * The new path starts from root and contains any nodes that match the nodes in the second path. - * It stops before the first non-matching node. - * - * Nodes are compared using their state property and their parameter values. - * If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes. - * - * @param pathA the first path - * @param pathB the second path - * @param paramsFn a function which returns the parameters to consider when comparing - * - * @returns an array of PathNodes from the first path which match the nodes in the second path - */ - PathUtils.matching = function (pathA, pathB, paramsFn) { - var done = false; - var tuples = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples)(pathA, pathB); - return tuples.reduce(function (matching, _a) { - var nodeA = _a[0], nodeB = _a[1]; - done = done || !nodeA.equals(nodeB, paramsFn); - return done ? matching : matching.concat(nodeA); - }, []); - }; - /** - * Returns true if two paths are identical. - * - * @param pathA - * @param pathB - * @param paramsFn a function which returns the parameters to consider when comparing - * @returns true if the the states and parameter values for both paths are identical - */ - PathUtils.equals = function (pathA, pathB, paramsFn) { - return pathA.length === pathB.length && PathUtils.matching(pathA, pathB, paramsFn).length === pathA.length; - }; - /** - * Return a subpath of a path, which stops at the first matching node - * - * Given an array of nodes, returns a subset of the array starting from the first node, - * stopping when the first node matches the predicate. - * - * @param path a path of [[PathNode]]s - * @param predicate a [[Predicate]] fn that matches [[PathNode]]s - * @returns a subpath up to the matching node, or undefined if no match is found - */ - PathUtils.subPath = function (path, predicate) { - var node = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(path, predicate); - var elementIdx = path.indexOf(node); - return elementIdx === -1 ? undefined : path.slice(0, elementIdx + 1); - }; - PathUtils.nonDynamicParams = function (node) { - return node.state.parameters({ inherit: false }).filter(function (param) { return !param.dynamic; }); - }; - /** Gets the raw parameter values from a path */ - PathUtils.paramValues = function (path) { return path.reduce(function (acc, node) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(acc, node.paramValues); }, {}); }; - return PathUtils; -}()); - -//# sourceMappingURL=pathUtils.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/resolve/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/resolve/index.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "resolvePolicies": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_0__.resolvePolicies), -/* harmony export */ "Resolvable": () => (/* reexport safe */ _resolvable__WEBPACK_IMPORTED_MODULE_1__.Resolvable), -/* harmony export */ "defaultResolvePolicy": () => (/* reexport safe */ _resolvable__WEBPACK_IMPORTED_MODULE_1__.defaultResolvePolicy), -/* harmony export */ "NATIVE_INJECTOR_TOKEN": () => (/* reexport safe */ _resolveContext__WEBPACK_IMPORTED_MODULE_2__.NATIVE_INJECTOR_TOKEN), -/* harmony export */ "ResolveContext": () => (/* reexport safe */ _resolveContext__WEBPACK_IMPORTED_MODULE_2__.ResolveContext) -/* harmony export */ }); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/resolve/interface.js"); -/* harmony import */ var _resolvable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); -/* harmony import */ var _resolveContext__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); - - - -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/resolve/interface.js": -/*!******************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/resolve/interface.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "resolvePolicies": () => (/* binding */ resolvePolicies) -/* harmony export */ }); -var resolvePolicies = { - when: { - LAZY: 'LAZY', - EAGER: 'EAGER', - }, - async: { - WAIT: 'WAIT', - NOWAIT: 'NOWAIT', - }, -}; -//# sourceMappingURL=interface.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "defaultResolvePolicy": () => (/* binding */ defaultResolvePolicy), -/* harmony export */ "Resolvable": () => (/* binding */ Resolvable) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); -/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); -/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); - - - - - - -// TODO: explicitly make this user configurable -var defaultResolvePolicy = { - when: 'LAZY', - async: 'WAIT', -}; -/** - * The basic building block for the resolve system. - * - * Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise), - * and the unwrapped-when-complete (.data) result of the resolveFn. - * - * Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the - * resolveFn) and returns the resulting promise. - * - * Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first - * parameter to those fns. - */ -var Resolvable = /** @class */ (function () { - function Resolvable(arg1, resolveFn, deps, policy, data) { - this.resolved = false; - this.promise = undefined; - if (arg1 instanceof Resolvable) { - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this, arg1); - } - else if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction)(resolveFn)) { - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isNullOrUndefined)(arg1)) - throw new Error('new Resolvable(): token argument is required'); - if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction)(resolveFn)) - throw new Error('new Resolvable(): resolveFn argument must be a function'); - this.token = arg1; - this.policy = policy; - this.resolveFn = resolveFn; - this.deps = deps || []; - this.data = data; - this.resolved = data !== undefined; - this.promise = this.resolved ? _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(this.data) : undefined; - } - else if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isObject)(arg1) && arg1.token && (arg1.hasOwnProperty('resolveFn') || arg1.hasOwnProperty('data'))) { - var literal = arg1; - return new Resolvable(literal.token, literal.resolveFn, literal.deps, literal.policy, literal.data); - } - } - Resolvable.prototype.getPolicy = function (state) { - var thisPolicy = this.policy || {}; - var statePolicy = (state && state.resolvePolicy) || {}; - return { - when: thisPolicy.when || statePolicy.when || defaultResolvePolicy.when, - async: thisPolicy.async || statePolicy.async || defaultResolvePolicy.async, - }; - }; - /** - * Asynchronously resolve this Resolvable's data - * - * Given a ResolveContext that this Resolvable is found in: - * Wait for this Resolvable's dependencies, then invoke this Resolvable's function - * and update the Resolvable's state - */ - Resolvable.prototype.resolve = function (resolveContext, trans) { - var _this = this; - var $q = _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q; - // Gets all dependencies from ResolveContext and wait for them to be resolved - var getResolvableDependencies = function () { - return $q.all(resolveContext.getDependencies(_this).map(function (resolvable) { return resolvable.get(resolveContext, trans); })); - }; - // Invokes the resolve function passing the resolved dependencies as arguments - var invokeResolveFn = function (resolvedDeps) { return _this.resolveFn.apply(null, resolvedDeps); }; - var node = resolveContext.findNode(this); - var state = node && node.state; - var asyncPolicy = this.getPolicy(state).async; - var customAsyncPolicy = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isFunction)(asyncPolicy) ? asyncPolicy : _common_common__WEBPACK_IMPORTED_MODULE_0__.identity; - // After the final value has been resolved, update the state of the Resolvable - var applyResolvedValue = function (resolvedValue) { - _this.data = resolvedValue; - _this.resolved = true; - _this.resolveFn = null; - _common_trace__WEBPACK_IMPORTED_MODULE_2__.trace.traceResolvableResolved(_this, trans); - return _this.data; - }; - // Sets the promise property first, then getsResolvableDependencies in the context of the promise chain. Always waits one tick. - return (this.promise = $q - .when() - .then(getResolvableDependencies) - .then(invokeResolveFn) - .then(customAsyncPolicy) - .then(applyResolvedValue)); - }; - /** - * Gets a promise for this Resolvable's data. - * - * Fetches the data and returns a promise. - * Returns the existing promise if it has already been fetched once. - */ - Resolvable.prototype.get = function (resolveContext, trans) { - return this.promise || this.resolve(resolveContext, trans); - }; - Resolvable.prototype.toString = function () { - return "Resolvable(token: " + (0,_common_strings__WEBPACK_IMPORTED_MODULE_3__.stringify)(this.token) + ", requires: [" + this.deps.map(_common_strings__WEBPACK_IMPORTED_MODULE_3__.stringify) + "])"; - }; - Resolvable.prototype.clone = function () { - return new Resolvable(this); - }; - Resolvable.fromData = function (token, data) { return new Resolvable(token, function () { return data; }, null, null, data); }; - return Resolvable; -}()); - -//# sourceMappingURL=resolvable.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js ***! - \***********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "NATIVE_INJECTOR_TOKEN": () => (/* binding */ NATIVE_INJECTOR_TOKEN), -/* harmony export */ "ResolveContext": () => (/* binding */ ResolveContext) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); -/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/resolve/interface.js"); -/* harmony import */ var _resolvable__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); -/* harmony import */ var _path_pathUtils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../path/pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); -/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); - - - - - - - - - -var whens = _interface__WEBPACK_IMPORTED_MODULE_4__.resolvePolicies.when; -var ALL_WHENS = [whens.EAGER, whens.LAZY]; -var EAGER_WHENS = [whens.EAGER]; -// tslint:disable-next-line:no-inferrable-types -var NATIVE_INJECTOR_TOKEN = 'Native Injector'; -/** - * Encapsulates Dependency Injection for a path of nodes - * - * UI-Router states are organized as a tree. - * A nested state has a path of ancestors to the root of the tree. - * When a state is being activated, each element in the path is wrapped as a [[PathNode]]. - * A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated. - * - * The ResolveContext closes over the [[PathNode]]s, and provides DI for the last node in the path. - */ -var ResolveContext = /** @class */ (function () { - function ResolveContext(_path) { - this._path = _path; - } - /** Gets all the tokens found in the resolve context, de-duplicated */ - ResolveContext.prototype.getTokens = function () { - return this._path.reduce(function (acc, node) { return acc.concat(node.resolvables.map(function (r) { return r.token; })); }, []).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.uniqR, []); - }; - /** - * Gets the Resolvable that matches the token - * - * Gets the last Resolvable that matches the token in this context, or undefined. - * Throws an error if it doesn't exist in the ResolveContext - */ - ResolveContext.prototype.getResolvable = function (token) { - var matching = this._path - .map(function (node) { return node.resolvables; }) - .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) - .filter(function (r) { return r.token === token; }); - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(matching); - }; - /** Returns the [[ResolvePolicy]] for the given [[Resolvable]] */ - ResolveContext.prototype.getPolicy = function (resolvable) { - var node = this.findNode(resolvable); - return resolvable.getPolicy(node.state); - }; - /** - * Returns a ResolveContext that includes a portion of this one - * - * Given a state, this method creates a new ResolveContext from this one. - * The new context starts at the first node (root) and stops at the node for the `state` parameter. - * - * #### Why - * - * When a transition is created, the nodes in the "To Path" are injected from a ResolveContext. - * A ResolveContext closes over a path of [[PathNode]]s and processes the resolvables. - * The "To State" can inject values from its own resolvables, as well as those from all its ancestor state's (node's). - * This method is used to create a narrower context when injecting ancestor nodes. - * - * @example - * `let ABCD = new ResolveContext([A, B, C, D]);` - * - * Given a path `[A, B, C, D]`, where `A`, `B`, `C` and `D` are nodes for states `a`, `b`, `c`, `d`: - * When injecting `D`, `D` should have access to all resolvables from `A`, `B`, `C`, `D`. - * However, `B` should only be able to access resolvables from `A`, `B`. - * - * When resolving for the `B` node, first take the full "To Path" Context `[A,B,C,D]` and limit to the subpath `[A,B]`. - * `let AB = ABCD.subcontext(a)` - */ - ResolveContext.prototype.subContext = function (state) { - return new ResolveContext(_path_pathUtils__WEBPACK_IMPORTED_MODULE_6__.PathUtils.subPath(this._path, function (node) { return node.state === state; })); - }; - /** - * Adds Resolvables to the node that matches the state - * - * This adds a [[Resolvable]] (generally one created on the fly; not declared on a [[StateDeclaration.resolve]] block). - * The resolvable is added to the node matching the `state` parameter. - * - * These new resolvables are not automatically fetched. - * The calling code should either fetch them, fetch something that depends on them, - * or rely on [[resolvePath]] being called when some state is being entered. - * - * Note: each resolvable's [[ResolvePolicy]] is merged with the state's policy, and the global default. - * - * @param newResolvables the new Resolvables - * @param state Used to find the node to put the resolvable on - */ - ResolveContext.prototype.addResolvables = function (newResolvables, state) { - var node = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(this._path, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('state', state)); - var keys = newResolvables.map(function (r) { return r.token; }); - node.resolvables = node.resolvables.filter(function (r) { return keys.indexOf(r.token) === -1; }).concat(newResolvables); - }; - /** - * Returns a promise for an array of resolved path Element promises - * - * @param when - * @param trans - * @returns {Promise|any} - */ - ResolveContext.prototype.resolvePath = function (when, trans) { - var _this = this; - if (when === void 0) { when = 'LAZY'; } - // This option determines which 'when' policy Resolvables we are about to fetch. - var whenOption = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(ALL_WHENS, when) ? when : 'LAZY'; - // If the caller specified EAGER, only the EAGER Resolvables are fetched. - // if the caller specified LAZY, both EAGER and LAZY Resolvables are fetched.` - var matchedWhens = whenOption === _interface__WEBPACK_IMPORTED_MODULE_4__.resolvePolicies.when.EAGER ? EAGER_WHENS : ALL_WHENS; - // get the subpath to the state argument, if provided - _common_trace__WEBPACK_IMPORTED_MODULE_2__.trace.traceResolvePath(this._path, when, trans); - var matchesPolicy = function (acceptedVals, whenOrAsync) { return function (resolvable) { - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(acceptedVals, _this.getPolicy(resolvable)[whenOrAsync]); - }; }; - // Trigger all the (matching) Resolvables in the path - // Reduce all the "WAIT" Resolvables into an array - var promises = this._path.reduce(function (acc, node) { - var nodeResolvables = node.resolvables.filter(matchesPolicy(matchedWhens, 'when')); - var nowait = nodeResolvables.filter(matchesPolicy(['NOWAIT'], 'async')); - var wait = nodeResolvables.filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.not)(matchesPolicy(['NOWAIT'], 'async'))); - // For the matching Resolvables, start their async fetch process. - var subContext = _this.subContext(node.state); - var getResult = function (r) { - return r - .get(subContext, trans) - // Return a tuple that includes the Resolvable's token - .then(function (value) { return ({ token: r.token, value: value }); }); - }; - nowait.forEach(getResult); - return acc.concat(wait.map(getResult)); - }, []); - // Wait for all the "WAIT" resolvables - return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.all(promises); - }; - ResolveContext.prototype.injector = function () { - return this._injector || (this._injector = new UIInjectorImpl(this)); - }; - ResolveContext.prototype.findNode = function (resolvable) { - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(this._path, function (node) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(node.resolvables, resolvable); }); - }; - /** - * Gets the async dependencies of a Resolvable - * - * Given a Resolvable, returns its dependencies as a Resolvable[] - */ - ResolveContext.prototype.getDependencies = function (resolvable) { - var _this = this; - var node = this.findNode(resolvable); - // Find which other resolvables are "visible" to the `resolvable` argument - // subpath stopping at resolvable's node, or the whole path (if the resolvable isn't in the path) - var subPath = _path_pathUtils__WEBPACK_IMPORTED_MODULE_6__.PathUtils.subPath(this._path, function (x) { return x === node; }) || this._path; - var availableResolvables = subPath - .reduce(function (acc, _node) { return acc.concat(_node.resolvables); }, []) // all of subpath's resolvables - .filter(function (res) { return res !== resolvable; }); // filter out the `resolvable` argument - var getDependency = function (token) { - var matching = availableResolvables.filter(function (r) { return r.token === token; }); - if (matching.length) - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(matching); - var fromInjector = _this.injector().getNative(token); - if ((0,_common__WEBPACK_IMPORTED_MODULE_8__.isUndefined)(fromInjector)) { - throw new Error('Could not find Dependency Injection token: ' + (0,_common_strings__WEBPACK_IMPORTED_MODULE_7__.stringify)(token)); - } - return new _resolvable__WEBPACK_IMPORTED_MODULE_5__.Resolvable(token, function () { return fromInjector; }, [], fromInjector); - }; - return resolvable.deps.map(getDependency); - }; - return ResolveContext; -}()); - -/** @internal */ -var UIInjectorImpl = /** @class */ (function () { - function UIInjectorImpl(context) { - this.context = context; - this.native = this.get(NATIVE_INJECTOR_TOKEN) || _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$injector; - } - UIInjectorImpl.prototype.get = function (token) { - var resolvable = this.context.getResolvable(token); - if (resolvable) { - if (this.context.getPolicy(resolvable).async === 'NOWAIT') { - return resolvable.get(this.context); - } - if (!resolvable.resolved) { - throw new Error('Resolvable async .get() not complete:' + (0,_common_strings__WEBPACK_IMPORTED_MODULE_7__.stringify)(resolvable.token)); - } - return resolvable.data; - } - return this.getNative(token); - }; - UIInjectorImpl.prototype.getAsync = function (token) { - var resolvable = this.context.getResolvable(token); - if (resolvable) - return resolvable.get(this.context); - return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.when(this.native.get(token)); - }; - UIInjectorImpl.prototype.getNative = function (token) { - return this.native && this.native.get(token); - }; - return UIInjectorImpl; -}()); -//# sourceMappingURL=resolveContext.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/router.js": -/*!*******************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/router.js ***! - \*******************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "UIRouter": () => (/* binding */ UIRouter) -/* harmony export */ }); -/* harmony import */ var _url_urlMatcherFactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./url/urlMatcherFactory */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js"); -/* harmony import */ var _url_urlRouter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./url/urlRouter */ "./node_modules/@uirouter/core/lib-esm/url/urlRouter.js"); -/* harmony import */ var _transition_transitionService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./transition/transitionService */ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js"); -/* harmony import */ var _view_view__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./view/view */ "./node_modules/@uirouter/core/lib-esm/view/view.js"); -/* harmony import */ var _state_stateRegistry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./state/stateRegistry */ "./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js"); -/* harmony import */ var _state_stateService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./state/stateService */ "./node_modules/@uirouter/core/lib-esm/state/stateService.js"); -/* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./globals */ "./node_modules/@uirouter/core/lib-esm/globals.js"); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _url_urlService__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./url/urlService */ "./node_modules/@uirouter/core/lib-esm/url/urlService.js"); -/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); - - - - - - - - - - - - -/** @internal */ -var _routerInstance = 0; -/** @internal */ -var locSvcFns = ['url', 'path', 'search', 'hash', 'onChange']; -/** @internal */ -var locCfgFns = ['port', 'protocol', 'host', 'baseHref', 'html5Mode', 'hashPrefix']; -/** @internal */ -var locationServiceStub = (0,_common__WEBPACK_IMPORTED_MODULE_11__.makeStub)('LocationServices', locSvcFns); -/** @internal */ -var locationConfigStub = (0,_common__WEBPACK_IMPORTED_MODULE_11__.makeStub)('LocationConfig', locCfgFns); -/** - * An instance of UI-Router. - * - * This object contains references to service APIs which define your application's routing behavior. - */ -var UIRouter = /** @class */ (function () { - /** - * Creates a new `UIRouter` object - * - * @param locationService a [[LocationServices]] implementation - * @param locationConfig a [[LocationConfig]] implementation - * @internal - */ - function UIRouter(locationService, locationConfig) { - if (locationService === void 0) { locationService = locationServiceStub; } - if (locationConfig === void 0) { locationConfig = locationConfigStub; } - this.locationService = locationService; - this.locationConfig = locationConfig; - /** @internal */ this.$id = _routerInstance++; - /** @internal */ this._disposed = false; - /** @internal */ this._disposables = []; - /** Enable/disable tracing to the javascript console */ - this.trace = _common_trace__WEBPACK_IMPORTED_MODULE_10__.trace; - /** Provides services related to ui-view synchronization */ - this.viewService = new _view_view__WEBPACK_IMPORTED_MODULE_3__.ViewService(this); - /** An object that contains global router state, such as the current state and params */ - this.globals = new _globals__WEBPACK_IMPORTED_MODULE_6__.UIRouterGlobals(); - /** A service that exposes global Transition Hooks */ - this.transitionService = new _transition_transitionService__WEBPACK_IMPORTED_MODULE_2__.TransitionService(this); - /** - * Deprecated for public use. Use [[urlService]] instead. - * @deprecated Use [[urlService]] instead - */ - this.urlMatcherFactory = new _url_urlMatcherFactory__WEBPACK_IMPORTED_MODULE_0__.UrlMatcherFactory(this); - /** - * Deprecated for public use. Use [[urlService]] instead. - * @deprecated Use [[urlService]] instead - */ - this.urlRouter = new _url_urlRouter__WEBPACK_IMPORTED_MODULE_1__.UrlRouter(this); - /** Provides services related to the URL */ - this.urlService = new _url_urlService__WEBPACK_IMPORTED_MODULE_9__.UrlService(this); - /** Provides a registry for states, and related registration services */ - this.stateRegistry = new _state_stateRegistry__WEBPACK_IMPORTED_MODULE_4__.StateRegistry(this); - /** Provides services related to states */ - this.stateService = new _state_stateService__WEBPACK_IMPORTED_MODULE_5__.StateService(this); - /** @internal plugin instances are registered here */ - this._plugins = {}; - this.viewService._pluginapi._rootViewContext(this.stateRegistry.root()); - this.globals.$current = this.stateRegistry.root(); - this.globals.current = this.globals.$current.self; - this.disposable(this.globals); - this.disposable(this.stateService); - this.disposable(this.stateRegistry); - this.disposable(this.transitionService); - this.disposable(this.urlService); - this.disposable(locationService); - this.disposable(locationConfig); - } - /** Registers an object to be notified when the router is disposed */ - UIRouter.prototype.disposable = function (disposable) { - this._disposables.push(disposable); - }; - /** - * Disposes this router instance - * - * When called, clears resources retained by the router by calling `dispose(this)` on all - * registered [[disposable]] objects. - * - * Or, if a `disposable` object is provided, calls `dispose(this)` on that object only. - * - * @internal - * @param disposable (optional) the disposable to dispose - */ - UIRouter.prototype.dispose = function (disposable) { - var _this = this; - if (disposable && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_8__.isFunction)(disposable.dispose)) { - disposable.dispose(this); - return undefined; - } - this._disposed = true; - this._disposables.slice().forEach(function (d) { - try { - typeof d.dispose === 'function' && d.dispose(_this); - (0,_common_common__WEBPACK_IMPORTED_MODULE_7__.removeFrom)(_this._disposables, d); - } - catch (ignored) { } - }); - }; - /** - * Adds a plugin to UI-Router - * - * This method adds a UI-Router Plugin. - * A plugin can enhance or change UI-Router behavior using any public API. - * - * #### Example: - * ```js - * import { MyCoolPlugin } from "ui-router-cool-plugin"; - * - * var plugin = router.addPlugin(MyCoolPlugin); - * ``` - * - * ### Plugin authoring - * - * A plugin is simply a class (or constructor function) which accepts a [[UIRouter]] instance and (optionally) an options object. - * - * The plugin can implement its functionality using any of the public APIs of [[UIRouter]]. - * For example, it may configure router options or add a Transition Hook. - * - * The plugin can then be published as a separate module. - * - * #### Example: - * ```js - * export class MyAuthPlugin implements UIRouterPlugin { - * constructor(router: UIRouter, options: any) { - * this.name = "MyAuthPlugin"; - * let $transitions = router.transitionService; - * let $state = router.stateService; - * - * let authCriteria = { - * to: (state) => state.data && state.data.requiresAuth - * }; - * - * function authHook(transition: Transition) { - * let authService = transition.injector().get('AuthService'); - * if (!authService.isAuthenticated()) { - * return $state.target('login'); - * } - * } - * - * $transitions.onStart(authCriteria, authHook); - * } - * } - * ``` - * - * @param plugin one of: - * - a plugin class which implements [[UIRouterPlugin]] - * - a constructor function for a [[UIRouterPlugin]] which accepts a [[UIRouter]] instance - * - a factory function which accepts a [[UIRouter]] instance and returns a [[UIRouterPlugin]] instance - * @param options options to pass to the plugin class/factory - * @returns the registered plugin instance - */ - UIRouter.prototype.plugin = function (plugin, options) { - if (options === void 0) { options = {}; } - var pluginInstance = new plugin(this, options); - if (!pluginInstance.name) - throw new Error('Required property `name` missing on plugin: ' + pluginInstance); - this._disposables.push(pluginInstance); - return (this._plugins[pluginInstance.name] = pluginInstance); - }; - UIRouter.prototype.getPlugin = function (pluginName) { - return pluginName ? this._plugins[pluginName] : (0,_common_common__WEBPACK_IMPORTED_MODULE_7__.values)(this._plugins); - }; - return UIRouter; -}()); - -//# sourceMappingURL=router.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/state/index.js": -/*!************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/state/index.js ***! - \************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "StateBuilder": () => (/* reexport safe */ _stateBuilder__WEBPACK_IMPORTED_MODULE_1__.StateBuilder), -/* harmony export */ "resolvablesBuilder": () => (/* reexport safe */ _stateBuilder__WEBPACK_IMPORTED_MODULE_1__.resolvablesBuilder), -/* harmony export */ "StateObject": () => (/* reexport safe */ _stateObject__WEBPACK_IMPORTED_MODULE_2__.StateObject), -/* harmony export */ "StateMatcher": () => (/* reexport safe */ _stateMatcher__WEBPACK_IMPORTED_MODULE_3__.StateMatcher), -/* harmony export */ "StateQueueManager": () => (/* reexport safe */ _stateQueueManager__WEBPACK_IMPORTED_MODULE_4__.StateQueueManager), -/* harmony export */ "StateRegistry": () => (/* reexport safe */ _stateRegistry__WEBPACK_IMPORTED_MODULE_5__.StateRegistry), -/* harmony export */ "StateService": () => (/* reexport safe */ _stateService__WEBPACK_IMPORTED_MODULE_6__.StateService), -/* harmony export */ "TargetState": () => (/* reexport safe */ _targetState__WEBPACK_IMPORTED_MODULE_7__.TargetState) -/* harmony export */ }); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/state/interface.js"); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); -/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; -/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] -/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); -/* harmony import */ var _stateBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stateBuilder */ "./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js"); -/* harmony import */ var _stateObject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stateObject */ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js"); -/* harmony import */ var _stateMatcher__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stateMatcher */ "./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js"); -/* harmony import */ var _stateQueueManager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stateQueueManager */ "./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js"); -/* harmony import */ var _stateRegistry__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./stateRegistry */ "./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js"); -/* harmony import */ var _stateService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./stateService */ "./node_modules/@uirouter/core/lib-esm/state/stateService.js"); -/* harmony import */ var _targetState__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); -/** - * # The state subsystem - * - * This subsystem implements the ui-router state tree - * - * - The [[StateService]] has state-related service methods such as: - * - [[StateService.get]]: Get a registered [[StateDeclaration]] object - * - [[StateService.go]]: Transition from the current state to a new state - * - [[StateService.reload]]: Reload the current state - * - [[StateService.target]]: Get a [[TargetState]] (useful when redirecting from a Transition Hook) - * - [[StateService.onInvalid]]: Register a callback for when a transition to an invalid state is started - * - [[StateService.defaultErrorHandler]]: Register a global callback for when a transition errors - * - The [[StateDeclaration]] interface defines the shape of a state declaration - * - The [[StateRegistry]] contains all the registered states - * - States can be added/removed using the [[StateRegistry.register]] and [[StateRegistry.deregister]] - * - Note: Bootstrap state registration differs by front-end framework. - * - Get notified of state registration/deregistration using [[StateRegistry.onStatesChanged]]. - * - * @packageDocumentation - */ - - - - - - - - -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/state/interface.js": -/*!****************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/state/interface.js ***! - \****************************************************************/ -/***/ (() => { - -//# sourceMappingURL=interface.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "resolvablesBuilder": () => (/* binding */ resolvablesBuilder), -/* harmony export */ "StateBuilder": () => (/* binding */ StateBuilder) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../resolve/resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); -/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); - - - - - - -var parseUrl = function (url) { - if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(url)) - return false; - var root = url.charAt(0) === '^'; - return { val: root ? url.substring(1) : url, root: root }; -}; -function nameBuilder(state) { - return state.name; -} -function selfBuilder(state) { - state.self.$$state = function () { return state; }; - return state.self; -} -function dataBuilder(state) { - if (state.parent && state.parent.data) { - state.data = state.self.data = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)(state.parent.data, state.data); - } - return state.data; -} -var getUrlBuilder = function ($urlMatcherFactoryProvider, root) { - return function urlBuilder(stateObject) { - var stateDec = stateObject.self; - // For future states, i.e., states whose name ends with `.**`, - // match anything that starts with the url prefix - if (stateDec && stateDec.url && stateDec.name && stateDec.name.match(/\.\*\*$/)) { - var newStateDec = {}; - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.copy)(stateDec, newStateDec); - newStateDec.url += '{remainder:any}'; // match any path (.*) - stateDec = newStateDec; - } - var parent = stateObject.parent; - var parsed = parseUrl(stateDec.url); - var url = !parsed ? stateDec.url : $urlMatcherFactoryProvider.compile(parsed.val, { state: stateDec }); - if (!url) - return null; - if (!$urlMatcherFactoryProvider.isMatcher(url)) - throw new Error("Invalid url '" + url + "' in state '" + stateObject + "'"); - return parsed && parsed.root ? url : ((parent && parent.navigable) || root()).url.append(url); - }; -}; -var getNavigableBuilder = function (isRoot) { - return function navigableBuilder(state) { - return !isRoot(state) && state.url ? state : state.parent ? state.parent.navigable : null; - }; -}; -var getParamsBuilder = function (paramFactory) { - return function paramsBuilder(state) { - var makeConfigParam = function (config, id) { return paramFactory.fromConfig(id, null, state.self); }; - var urlParams = (state.url && state.url.parameters({ inherit: false })) || []; - var nonUrlParams = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.mapObj)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.omit)(state.params || {}, urlParams.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('id'))), makeConfigParam)); - return urlParams - .concat(nonUrlParams) - .map(function (p) { return [p.id, p]; }) - .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.applyPairs, {}); - }; -}; -function pathBuilder(state) { - return state.parent ? state.parent.path.concat(state) : /*root*/ [state]; -} -function includesBuilder(state) { - var includes = state.parent ? (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({}, state.parent.includes) : {}; - includes[state.name] = true; - return includes; -} -/** - * This is a [[StateBuilder.builder]] function for the `resolve:` block on a [[StateDeclaration]]. - * - * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder - * validates the `resolve` property and converts it to a [[Resolvable]] array. - * - * resolve: input value can be: - * - * { - * // analyzed but not injected - * myFooResolve: function() { return "myFooData"; }, - * - * // function.toString() parsed, "DependencyName" dep as string (not min-safe) - * myBarResolve: function(DependencyName) { return DependencyName.fetchSomethingAsPromise() }, - * - * // Array split; "DependencyName" dep as string - * myBazResolve: [ "DependencyName", function(dep) { return dep.fetchSomethingAsPromise() }, - * - * // Array split; DependencyType dep as token (compared using ===) - * myQuxResolve: [ DependencyType, function(dep) { return dep.fetchSometingAsPromise() }, - * - * // val.$inject used as deps - * // where: - * // corgeResolve.$inject = ["DependencyName"]; - * // function corgeResolve(dep) { dep.fetchSometingAsPromise() } - * // then "DependencyName" dep as string - * myCorgeResolve: corgeResolve, - * - * // inject service by name - * // When a string is found, desugar creating a resolve that injects the named service - * myGraultResolve: "SomeService" - * } - * - * or: - * - * [ - * new Resolvable("myFooResolve", function() { return "myFooData" }), - * new Resolvable("myBarResolve", function(dep) { return dep.fetchSomethingAsPromise() }, [ "DependencyName" ]), - * { provide: "myBazResolve", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ "DependencyName" ] } - * ] - */ -function resolvablesBuilder(state) { - /** convert resolve: {} and resolvePolicy: {} objects to an array of tuples */ - var objects2Tuples = function (resolveObj, resolvePolicies) { - return Object.keys(resolveObj || {}).map(function (token) { return ({ - token: token, - val: resolveObj[token], - deps: undefined, - policy: resolvePolicies[token], - }); }); - }; - /** fetch DI annotations from a function or ng1-style array */ - var annotate = function (fn) { - var $injector = _common_coreservices__WEBPACK_IMPORTED_MODULE_5__.services.$injector; - // ng1 doesn't have an $injector until runtime. - // If the $injector doesn't exist, use "deferred" literal as a - // marker indicating they should be annotated when runtime starts - return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || 'deferred'; - }; - /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */ - var isResolveLiteral = function (obj) { return !!(obj.token && obj.resolveFn); }; - /** true if the object looks like a provide literal, or a ng2 Provider */ - var isLikeNg2Provider = function (obj) { - return !!((obj.provide || obj.token) && (obj.useValue || obj.useFactory || obj.useExisting || obj.useClass)); - }; - /** true if the object looks like a tuple from obj2Tuples */ - var isTupleFromObj = function (obj) { - return !!(obj && obj.val && ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(obj.val) || (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(obj.val) || (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction)(obj.val))); - }; - /** extracts the token from a Provider or provide literal */ - var getToken = function (p) { return p.provide || p.token; }; - // prettier-ignore: Given a literal resolve or provider object, returns a Resolvable - var literal2Resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ - [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('resolveFn'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), p.resolveFn, p.deps, p.policy); }], - [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useFactory'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), p.useFactory, p.deps || p.dependencies, p.policy); }], - [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useClass'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), function () { return new p.useClass(); }, [], p.policy); }], - [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useValue'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), function () { return p.useValue; }, [], p.policy, p.useValue); }], - [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('useExisting'), function (p) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(getToken(p), _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, [p.useExisting], p.policy); }], - ]); - // prettier-ignore - var tuple2Resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ - [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pipe)((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('val'), _common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString), function (tuple) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(tuple.token, _common_common__WEBPACK_IMPORTED_MODULE_0__.identity, [tuple.val], tuple.policy); }], - [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pipe)((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('val'), _common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray), function (tuple) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(tuple.token, (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(tuple.val), tuple.val.slice(0, -1), tuple.policy); }], - [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pipe)((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.prop)('val'), _common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction), function (tuple) { return new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy); }], - ]); - // prettier-ignore - var item2Resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ - [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(_resolve_resolvable__WEBPACK_IMPORTED_MODULE_4__.Resolvable), function (r) { return r; }], - [isResolveLiteral, literal2Resolvable], - [isLikeNg2Provider, literal2Resolvable], - [isTupleFromObj, tuple2Resolvable], - [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.val)(true), function (obj) { throw new Error('Invalid resolve value: ' + (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(obj)); },], - ]); - // If resolveBlock is already an array, use it as-is. - // Otherwise, assume it's an object and convert to an Array of tuples - var decl = state.resolve; - var items = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray)(decl) ? decl : objects2Tuples(decl, state.resolvePolicy || {}); - return items.map(item2Resolvable); -} -/** - * A internal global service - * - * StateBuilder is a factory for the internal [[StateObject]] objects. - * - * When you register a state with the [[StateRegistry]], you register a plain old javascript object which - * conforms to the [[StateDeclaration]] interface. This factory takes that object and builds the corresponding - * [[StateObject]] object, which has an API and is used internally. - * - * Custom properties or API may be added to the internal [[StateObject]] object by registering a decorator function - * using the [[builder]] method. - */ -var StateBuilder = /** @class */ (function () { - function StateBuilder(matcher, urlMatcherFactory) { - this.matcher = matcher; - var self = this; - var root = function () { return matcher.find(''); }; - var isRoot = function (state) { return state.name === ''; }; - function parentBuilder(state) { - if (isRoot(state)) - return null; - return matcher.find(self.parentName(state)) || root(); - } - this.builders = { - name: [nameBuilder], - self: [selfBuilder], - parent: [parentBuilder], - data: [dataBuilder], - // Build a URLMatcher if necessary, either via a relative or absolute URL - url: [getUrlBuilder(urlMatcherFactory, root)], - // Keep track of the closest ancestor state that has a URL (i.e. is navigable) - navigable: [getNavigableBuilder(isRoot)], - params: [getParamsBuilder(urlMatcherFactory.paramFactory)], - // Each framework-specific ui-router implementation should define its own `views` builder - // e.g., src/ng1/statebuilders/views.ts - views: [], - // Keep a full path from the root down to this state as this is needed for state activation. - path: [pathBuilder], - // Speed up $state.includes() as it's used a lot - includes: [includesBuilder], - resolvables: [resolvablesBuilder], - }; - } - StateBuilder.prototype.builder = function (name, fn) { - var builders = this.builders; - var array = builders[name] || []; - // Backwards compat: if only one builder exists, return it, else return whole arary. - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(name) && !(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(fn)) - return array.length > 1 ? array : array[0]; - if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(name) || !(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction)(fn)) - return; - builders[name] = array; - builders[name].push(fn); - return function () { return builders[name].splice(builders[name].indexOf(fn, 1)) && null; }; - }; - /** - * Builds all of the properties on an essentially blank State object, returning a State object which has all its - * properties and API built. - * - * @param state an uninitialized State object - * @returns the built State object - */ - StateBuilder.prototype.build = function (state) { - var _a = this, matcher = _a.matcher, builders = _a.builders; - var parent = this.parentName(state); - if (parent && !matcher.find(parent, undefined, false)) { - return null; - } - for (var key in builders) { - if (!builders.hasOwnProperty(key)) - continue; - var chain = builders[key].reduce(function (parentFn, step) { return function (_state) { return step(_state, parentFn); }; }, _common_common__WEBPACK_IMPORTED_MODULE_0__.noop); - state[key] = chain(state); - } - return state; - }; - StateBuilder.prototype.parentName = function (state) { - // name = 'foo.bar.baz.**' - var name = state.name || ''; - // segments = ['foo', 'bar', 'baz', '.**'] - var segments = name.split('.'); - // segments = ['foo', 'bar', 'baz'] - var lastSegment = segments.pop(); - // segments = ['foo', 'bar'] (ignore .** segment for future states) - if (lastSegment === '**') - segments.pop(); - if (segments.length) { - if (state.parent) { - throw new Error("States that specify the 'parent:' property should not have a '.' in their name (" + name + ")"); - } - // 'foo.bar' - return segments.join('.'); - } - if (!state.parent) - return ''; - return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(state.parent) ? state.parent : state.parent.name; - }; - StateBuilder.prototype.name = function (state) { - var name = state.name; - if (name.indexOf('.') !== -1 || !state.parent) - return name; - var parentName = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(state.parent) ? state.parent : state.parent.name; - return parentName ? parentName + '.' + name : name; - }; - return StateBuilder; -}()); - -//# sourceMappingURL=stateBuilder.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "StateMatcher": () => (/* binding */ StateMatcher) -/* harmony export */ }); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_safeConsole__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/safeConsole */ "./node_modules/@uirouter/core/lib-esm/common/safeConsole.js"); - - - -var StateMatcher = /** @class */ (function () { - function StateMatcher(_states) { - this._states = _states; - } - StateMatcher.prototype.isRelative = function (stateName) { - stateName = stateName || ''; - return stateName.indexOf('.') === 0 || stateName.indexOf('^') === 0; - }; - StateMatcher.prototype.find = function (stateOrName, base, matchGlob) { - if (matchGlob === void 0) { matchGlob = true; } - if (!stateOrName && stateOrName !== '') - return undefined; - var isStr = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(stateOrName); - var name = isStr ? stateOrName : stateOrName.name; - if (this.isRelative(name)) - name = this.resolvePath(name, base); - var state = this._states[name]; - if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) { - return state; - } - else if (isStr && matchGlob) { - var _states = (0,_common_common__WEBPACK_IMPORTED_MODULE_1__.values)(this._states); - var matches = _states.filter(function (_state) { return _state.__stateObjectCache.nameGlob && _state.__stateObjectCache.nameGlob.matches(name); }); - if (matches.length > 1) { - _common_safeConsole__WEBPACK_IMPORTED_MODULE_2__.safeConsole.error("stateMatcher.find: Found multiple matches for " + name + " using glob: ", matches.map(function (match) { return match.name; })); - } - return matches[0]; - } - return undefined; - }; - StateMatcher.prototype.resolvePath = function (name, base) { - if (!base) - throw new Error("No reference point given for path '" + name + "'"); - var baseState = this.find(base); - var splitName = name.split('.'); - var pathLength = splitName.length; - var i = 0, current = baseState; - for (; i < pathLength; i++) { - if (splitName[i] === '' && i === 0) { - current = baseState; - continue; - } - if (splitName[i] === '^') { - if (!current.parent) - throw new Error("Path '" + name + "' not valid for state '" + baseState.name + "'"); - current = current.parent; - continue; - } - break; - } - var relName = splitName.slice(i).join('.'); - return current.name + (current.name && relName ? '.' : '') + relName; - }; - return StateMatcher; -}()); - -//# sourceMappingURL=stateMatcher.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js": -/*!******************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/state/stateObject.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "StateObject": () => (/* binding */ StateObject) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _common_glob__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/glob */ "./node_modules/@uirouter/core/lib-esm/common/glob.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); - - - - -/** - * Internal representation of a UI-Router state. - * - * Instances of this class are created when a [[StateDeclaration]] is registered with the [[StateRegistry]]. - * - * A registered [[StateDeclaration]] is augmented with a getter ([[StateDeclaration.$$state]]) which returns the corresponding [[StateObject]] object. - * - * This class prototypally inherits from the corresponding [[StateDeclaration]]. - * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]]. - */ -var StateObject = /** @class */ (function () { - /** @deprecated use State.create() */ - function StateObject(config) { - return StateObject.create(config || {}); - } - /** - * Create a state object to put the private/internal implementation details onto. - * The object's prototype chain looks like: - * (Internal State Object) -> (Copy of State.prototype) -> (State Declaration object) -> (State Declaration's prototype...) - * - * @param stateDecl the user-supplied State Declaration - * @returns {StateObject} an internal State object - */ - StateObject.create = function (stateDecl) { - stateDecl = StateObject.isStateClass(stateDecl) ? new stateDecl() : stateDecl; - var state = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)(stateDecl, StateObject.prototype)); - stateDecl.$$state = function () { return state; }; - state.self = stateDecl; - state.__stateObjectCache = { - nameGlob: _common_glob__WEBPACK_IMPORTED_MODULE_2__.Glob.fromString(state.name), - }; - return state; - }; - /** - * Returns true if the provided parameter is the same state. - * - * Compares the identity of the state against the passed value, which is either an object - * reference to the actual `State` instance, the original definition object passed to - * `$stateProvider.state()`, or the fully-qualified name. - * - * @param ref Can be one of (a) a `State` instance, (b) an object that was passed - * into `$stateProvider.state()`, (c) the fully-qualified name of a state as a string. - * @returns Returns `true` if `ref` matches the current `State` instance. - */ - StateObject.prototype.is = function (ref) { - return this === ref || this.self === ref || this.fqn() === ref; - }; - /** - * @deprecated this does not properly handle dot notation - * @returns Returns a dot-separated name of the state. - */ - StateObject.prototype.fqn = function () { - if (!this.parent || !(this.parent instanceof this.constructor)) - return this.name; - var name = this.parent.fqn(); - return name ? name + '.' + this.name : this.name; - }; - /** - * Returns the root node of this state's tree. - * - * @returns The root of this state's tree. - */ - StateObject.prototype.root = function () { - return (this.parent && this.parent.root()) || this; - }; - /** - * Gets the state's `Param` objects - * - * Gets the list of [[Param]] objects owned by the state. - * If `opts.inherit` is true, it also includes the ancestor states' [[Param]] objects. - * If `opts.matchingKeys` exists, returns only `Param`s whose `id` is a key on the `matchingKeys` object - * - * @param opts options - */ - StateObject.prototype.parameters = function (opts) { - opts = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(opts, { inherit: true, matchingKeys: null }); - var inherited = (opts.inherit && this.parent && this.parent.parameters()) || []; - return inherited - .concat((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)(this.params)) - .filter(function (param) { return !opts.matchingKeys || opts.matchingKeys.hasOwnProperty(param.id); }); - }; - /** - * Returns a single [[Param]] that is owned by the state - * - * If `opts.inherit` is true, it also searches the ancestor states` [[Param]]s. - * @param id the name of the [[Param]] to return - * @param opts options - */ - StateObject.prototype.parameter = function (id, opts) { - if (opts === void 0) { opts = {}; } - return ((this.url && this.url.parameter(id, opts)) || - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.values)(this.params), (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('id', id)) || - (opts.inherit && this.parent && this.parent.parameter(id))); - }; - StateObject.prototype.toString = function () { - return this.fqn(); - }; - /** Predicate which returns true if the object is an class with @State() decorator */ - StateObject.isStateClass = function (stateDecl) { - return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isFunction)(stateDecl) && stateDecl['__uiRouterState'] === true; - }; - /** Predicate which returns true if the object is a [[StateDeclaration]] object */ - StateObject.isStateDeclaration = function (obj) { return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isFunction)(obj['$$state']); }; - /** Predicate which returns true if the object is an internal [[StateObject]] object */ - StateObject.isState = function (obj) { return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isObject)(obj['__stateObjectCache']); }; - return StateObject; -}()); - -//# sourceMappingURL=stateObject.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js": -/*!************************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js ***! - \************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "StateQueueManager": () => (/* binding */ StateQueueManager) -/* harmony export */ }); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); -/* harmony import */ var _stateObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stateObject */ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js"); - - -var StateQueueManager = /** @class */ (function () { - function StateQueueManager(router, states, builder, listeners) { - this.router = router; - this.states = states; - this.builder = builder; - this.listeners = listeners; - this.queue = []; - } - StateQueueManager.prototype.dispose = function () { - this.queue = []; - }; - StateQueueManager.prototype.register = function (stateDecl) { - var queue = this.queue; - var state = _stateObject__WEBPACK_IMPORTED_MODULE_1__.StateObject.create(stateDecl); - var name = state.name; - if (!(0,_common__WEBPACK_IMPORTED_MODULE_0__.isString)(name)) - throw new Error('State must have a valid name'); - if (this.states.hasOwnProperty(name) || (0,_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(queue.map((0,_common__WEBPACK_IMPORTED_MODULE_0__.prop)('name')), name)) - throw new Error("State '" + name + "' is already defined"); - queue.push(state); - this.flush(); - return state; - }; - StateQueueManager.prototype.flush = function () { - var _this = this; - var _a = this, queue = _a.queue, states = _a.states, builder = _a.builder; - var registered = [], // states that got registered - orphans = [], // states that don't yet have a parent registered - previousQueueLength = {}; // keep track of how long the queue when an orphan was first encountered - var getState = function (name) { return _this.states.hasOwnProperty(name) && _this.states[name]; }; - var notifyListeners = function () { - if (registered.length) { - _this.listeners.forEach(function (listener) { - return listener('registered', registered.map(function (s) { return s.self; })); - }); - } - }; - while (queue.length > 0) { - var state = queue.shift(); - var name_1 = state.name; - var result = builder.build(state); - var orphanIdx = orphans.indexOf(state); - if (result) { - var existingState = getState(name_1); - if (existingState && existingState.name === name_1) { - throw new Error("State '" + name_1 + "' is already defined"); - } - var existingFutureState = getState(name_1 + '.**'); - if (existingFutureState) { - // Remove future state of the same name - this.router.stateRegistry.deregister(existingFutureState); - } - states[name_1] = state; - this.attachRoute(state); - if (orphanIdx >= 0) - orphans.splice(orphanIdx, 1); - registered.push(state); - continue; - } - var prev = previousQueueLength[name_1]; - previousQueueLength[name_1] = queue.length; - if (orphanIdx >= 0 && prev === queue.length) { - // Wait until two consecutive iterations where no additional states were dequeued successfully. - // throw new Error(`Cannot register orphaned state '${name}'`); - queue.push(state); - notifyListeners(); - return states; - } - else if (orphanIdx < 0) { - orphans.push(state); - } - queue.push(state); - } - notifyListeners(); - return states; - }; - StateQueueManager.prototype.attachRoute = function (state) { - if (state.abstract || !state.url) - return; - var rulesApi = this.router.urlService.rules; - rulesApi.rule(rulesApi.urlRuleFactory.create(state)); - }; - return StateQueueManager; -}()); - -//# sourceMappingURL=stateQueueManager.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js": -/*!********************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/state/stateRegistry.js ***! - \********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "StateRegistry": () => (/* binding */ StateRegistry) -/* harmony export */ }); -/* harmony import */ var _stateMatcher__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./stateMatcher */ "./node_modules/@uirouter/core/lib-esm/state/stateMatcher.js"); -/* harmony import */ var _stateBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stateBuilder */ "./node_modules/@uirouter/core/lib-esm/state/stateBuilder.js"); -/* harmony import */ var _stateQueueManager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stateQueueManager */ "./node_modules/@uirouter/core/lib-esm/state/stateQueueManager.js"); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); - - - - - -/** - * A registry for all of the application's [[StateDeclaration]]s - * - * This API is found at `router.stateRegistry` ([[UIRouter.stateRegistry]]) - */ -var StateRegistry = /** @class */ (function () { - /** @internal */ - function StateRegistry(router) { - this.router = router; - this.states = {}; - /** @internal */ - this.listeners = []; - this.matcher = new _stateMatcher__WEBPACK_IMPORTED_MODULE_0__.StateMatcher(this.states); - this.builder = new _stateBuilder__WEBPACK_IMPORTED_MODULE_1__.StateBuilder(this.matcher, router.urlMatcherFactory); - this.stateQueue = new _stateQueueManager__WEBPACK_IMPORTED_MODULE_2__.StateQueueManager(router, this.states, this.builder, this.listeners); - this._registerRoot(); - } - /** @internal */ - StateRegistry.prototype._registerRoot = function () { - var rootStateDef = { - name: '', - url: '^', - views: null, - params: { - '#': { value: null, type: 'hash', dynamic: true }, - }, - abstract: true, - }; - var _root = (this._root = this.stateQueue.register(rootStateDef)); - _root.navigable = null; - }; - /** @internal */ - StateRegistry.prototype.dispose = function () { - var _this = this; - this.stateQueue.dispose(); - this.listeners = []; - this.get().forEach(function (state) { return _this.get(state) && _this.deregister(state); }); - }; - /** - * Listen for a State Registry events - * - * Adds a callback that is invoked when states are registered or deregistered with the StateRegistry. - * - * #### Example: - * ```js - * let allStates = registry.get(); - * - * // Later, invoke deregisterFn() to remove the listener - * let deregisterFn = registry.onStatesChanged((event, states) => { - * switch(event) { - * case: 'registered': - * states.forEach(state => allStates.push(state)); - * break; - * case: 'deregistered': - * states.forEach(state => { - * let idx = allStates.indexOf(state); - * if (idx !== -1) allStates.splice(idx, 1); - * }); - * break; - * } - * }); - * ``` - * - * @param listener a callback function invoked when the registered states changes. - * The function receives two parameters, `event` and `state`. - * See [[StateRegistryListener]] - * @return a function that deregisters the listener - */ - StateRegistry.prototype.onStatesChanged = function (listener) { - this.listeners.push(listener); - return function deregisterListener() { - (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.removeFrom)(this.listeners)(listener); - }.bind(this); - }; - /** - * Gets the implicit root state - * - * Gets the root of the state tree. - * The root state is implicitly created by UI-Router. - * Note: this returns the internal [[StateObject]] representation, not a [[StateDeclaration]] - * - * @return the root [[StateObject]] - */ - StateRegistry.prototype.root = function () { - return this._root; - }; - /** - * Adds a state to the registry - * - * Registers a [[StateDeclaration]] or queues it for registration. - * - * Note: a state will be queued if the state's parent isn't yet registered. - * - * @param stateDefinition the definition of the state to register. - * @returns the internal [[StateObject]] object. - * If the state was successfully registered, then the object is fully built (See: [[StateBuilder]]). - * If the state was only queued, then the object is not fully built. - */ - StateRegistry.prototype.register = function (stateDefinition) { - return this.stateQueue.register(stateDefinition); - }; - /** @internal */ - StateRegistry.prototype._deregisterTree = function (state) { - var _this = this; - var all = this.get().map(function (s) { return s.$$state(); }); - var getChildren = function (states) { - var _children = all.filter(function (s) { return states.indexOf(s.parent) !== -1; }); - return _children.length === 0 ? _children : _children.concat(getChildren(_children)); - }; - var children = getChildren([state]); - var deregistered = [state].concat(children).reverse(); - deregistered.forEach(function (_state) { - var rulesApi = _this.router.urlService.rules; - // Remove URL rule - rulesApi - .rules() - .filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.propEq)('state', _state)) - .forEach(function (rule) { return rulesApi.removeRule(rule); }); - // Remove state from registry - delete _this.states[_state.name]; - }); - return deregistered; - }; - /** - * Removes a state from the registry - * - * This removes a state from the registry. - * If the state has children, they are are also removed from the registry. - * - * @param stateOrName the state's name or object representation - * @returns {StateObject[]} a list of removed states - */ - StateRegistry.prototype.deregister = function (stateOrName) { - var _state = this.get(stateOrName); - if (!_state) - throw new Error("Can't deregister state; not found: " + stateOrName); - var deregisteredStates = this._deregisterTree(_state.$$state()); - this.listeners.forEach(function (listener) { - return listener('deregistered', deregisteredStates.map(function (s) { return s.self; })); - }); - return deregisteredStates; - }; - StateRegistry.prototype.get = function (stateOrName, base) { - var _this = this; - if (arguments.length === 0) - return Object.keys(this.states).map(function (name) { return _this.states[name].self; }); - var found = this.matcher.find(stateOrName, base); - return (found && found.self) || null; - }; - /** - * Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`). - * More than one BuilderFunction can be registered for a given property. - * - * The BuilderFunction(s) will be used to define the property on any subsequently built [[StateObject]] objects. - * - * @param property The name of the State property being registered for. - * @param builderFunction The BuilderFunction which will be used to build the State property - * @returns a function which deregisters the BuilderFunction - */ - StateRegistry.prototype.decorator = function (property, builderFunction) { - return this.builder.builder(property, builderFunction); - }; - return StateRegistry; -}()); - -//# sourceMappingURL=stateRegistry.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/state/stateService.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/state/stateService.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "StateService": () => (/* binding */ StateService) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _common_queue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/queue */ "./node_modules/@uirouter/core/lib-esm/common/queue.js"); -/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); -/* harmony import */ var _path_pathUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../path/pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); -/* harmony import */ var _path_pathNode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../path/pathNode */ "./node_modules/@uirouter/core/lib-esm/path/pathNode.js"); -/* harmony import */ var _transition_transitionService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../transition/transitionService */ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js"); -/* harmony import */ var _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../transition/rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); -/* harmony import */ var _targetState__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); -/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); -/* harmony import */ var _common_glob__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../common/glob */ "./node_modules/@uirouter/core/lib-esm/common/glob.js"); -/* harmony import */ var _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../resolve/resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); -/* harmony import */ var _hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../hooks/lazyLoad */ "./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); - - - - - - - - - - - - - - -/** - * Provides services related to ui-router states. - * - * This API is located at `router.stateService` ([[UIRouter.stateService]]) - */ -var StateService = /** @class */ (function () { - /** @internal */ - function StateService(/** @internal */ router) { - this.router = router; - /** @internal */ - this.invalidCallbacks = []; - /** @internal */ - this._defaultErrorHandler = function $defaultErrorHandler($error$) { - if ($error$ instanceof Error && $error$.stack) { - console.error($error$); - console.error($error$.stack); - } - else if ($error$ instanceof _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection) { - console.error($error$.toString()); - if ($error$.detail && $error$.detail.stack) - console.error($error$.detail.stack); - } - else { - console.error($error$); - } - }; - var getters = ['current', '$current', 'params', 'transition']; - var boundFns = Object.keys(StateService.prototype).filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_13__.not)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(getters))); - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.createProxyFunctions)((0,_common_hof__WEBPACK_IMPORTED_MODULE_13__.val)(StateService.prototype), this, (0,_common_hof__WEBPACK_IMPORTED_MODULE_13__.val)(this), boundFns); - } - Object.defineProperty(StateService.prototype, "transition", { - /** - * The [[Transition]] currently in progress (or null) - * - * @deprecated This is a passthrough through to [[UIRouterGlobals.transition]] - */ - get: function () { - return this.router.globals.transition; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(StateService.prototype, "params", { - /** - * The latest successful state parameters - * - * @deprecated This is a passthrough through to [[UIRouterGlobals.params]] - */ - get: function () { - return this.router.globals.params; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(StateService.prototype, "current", { - /** - * The current [[StateDeclaration]] - * - * @deprecated This is a passthrough through to [[UIRouterGlobals.current]] - */ - get: function () { - return this.router.globals.current; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(StateService.prototype, "$current", { - /** - * The current [[StateObject]] (an internal API) - * - * @deprecated This is a passthrough through to [[UIRouterGlobals.$current]] - */ - get: function () { - return this.router.globals.$current; - }, - enumerable: false, - configurable: true - }); - /** @internal */ - StateService.prototype.dispose = function () { - this.defaultErrorHandler(_common_common__WEBPACK_IMPORTED_MODULE_0__.noop); - this.invalidCallbacks = []; - }; - /** - * Handler for when [[transitionTo]] is called with an invalid state. - * - * Invokes the [[onInvalid]] callbacks, in natural order. - * Each callback's return value is checked in sequence until one of them returns an instance of TargetState. - * The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises. - * - * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned. - * - * @internal - */ - StateService.prototype._handleInvalidTargetState = function (fromPath, toState) { - var _this = this; - var fromState = _path_pathUtils__WEBPACK_IMPORTED_MODULE_4__.PathUtils.makeTargetState(this.router.stateRegistry, fromPath); - var globals = this.router.globals; - var latestThing = function () { return globals.transitionHistory.peekTail(); }; - var latest = latestThing(); - var callbackQueue = new _common_queue__WEBPACK_IMPORTED_MODULE_2__.Queue(this.invalidCallbacks.slice()); - var injector = new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_11__.ResolveContext(fromPath).injector(); - var checkForRedirect = function (result) { - if (!(result instanceof _targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState)) { - return; - } - var target = result; - // Recreate the TargetState, in case the state is now defined. - target = _this.target(target.identifier(), target.params(), target.options()); - if (!target.valid()) { - return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.invalid(target.error()).toPromise(); - } - if (latestThing() !== latest) { - return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.superseded().toPromise(); - } - return _this.transitionTo(target.identifier(), target.params(), target.options()); - }; - function invokeNextCallback() { - var nextCallback = callbackQueue.dequeue(); - if (nextCallback === undefined) - return _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.invalid(toState.error()).toPromise(); - var callbackResult = _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.when(nextCallback(toState, fromState, injector)); - return callbackResult.then(checkForRedirect).then(function (result) { return result || invokeNextCallback(); }); - } - return invokeNextCallback(); - }; - /** - * Registers an Invalid State handler - * - * Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]] - * has been called with an invalid state reference parameter - * - * Example: - * ```js - * stateService.onInvalid(function(to, from, injector) { - * if (to.name() === 'foo') { - * let lazyLoader = injector.get('LazyLoadService'); - * return lazyLoader.load('foo') - * .then(() => stateService.target('foo')); - * } - * }); - * ``` - * - * @param {function} callback invoked when the toState is invalid - * This function receives the (invalid) toState, the fromState, and an injector. - * The function may optionally return a [[TargetState]] or a Promise for a TargetState. - * If one is returned, it is treated as a redirect. - * - * @returns a function which deregisters the callback - */ - StateService.prototype.onInvalid = function (callback) { - this.invalidCallbacks.push(callback); - return function deregisterListener() { - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(this.invalidCallbacks)(callback); - }.bind(this); - }; - /** - * Reloads the current state - * - * A method that force reloads the current state, or a partial state hierarchy. - * All resolves are re-resolved, and components reinstantiated. - * - * #### Example: - * ```js - * let app angular.module('app', ['ui.router']); - * - * app.controller('ctrl', function ($scope, $state) { - * $scope.reload = function(){ - * $state.reload(); - * } - * }); - * ``` - * - * Note: `reload()` is just an alias for: - * - * ```js - * $state.transitionTo($state.current, $state.params, { - * reload: true, inherit: false - * }); - * ``` - * - * @param reloadState A state name or a state object. - * If present, this state and all its children will be reloaded, but ancestors will not reload. - * - * #### Example: - * ```js - * //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item' - * //and current state is 'contacts.detail.item' - * let app angular.module('app', ['ui.router']); - * - * app.controller('ctrl', function ($scope, $state) { - * $scope.reload = function(){ - * //will reload 'contact.detail' and nested 'contact.detail.item' states - * $state.reload('contact.detail'); - * } - * }); - * ``` - * - * @returns A promise representing the state of the new transition. See [[StateService.go]] - */ - StateService.prototype.reload = function (reloadState) { - return this.transitionTo(this.current, this.params, { - reload: (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(reloadState) ? reloadState : true, - inherit: false, - notify: false, - }); - }; - /** - * Transition to a different state and/or parameters - * - * Convenience method for transitioning to a new state. - * - * `$state.go` calls `$state.transitionTo` internally but automatically sets options to - * `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`. - * This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`). - * It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters - * inherit from the current parameter values (because of `inherit: true`). - * - * #### Example: - * ```js - * let app = angular.module('app', ['ui.router']); - * - * app.controller('ctrl', function ($scope, $state) { - * $scope.changeState = function () { - * $state.go('contact.detail'); - * }; - * }); - * ``` - * - * @param to Absolute state name, state object, or relative state path (relative to current state). - * - * Some examples: - * - * - `$state.go('contact.detail')` - will go to the `contact.detail` state - * - `$state.go('^')` - will go to the parent state - * - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state - * - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state - * - * @param params A map of the parameters that will be sent to the state, will populate $stateParams. - * - * Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`). - * This allows, for example, going to a sibling state that shares parameters defined by a parent state. - * - * @param options Transition options - * - * @returns {promise} A promise representing the state of the new transition. - */ - StateService.prototype.go = function (to, params, options) { - var defautGoOpts = { relative: this.$current, inherit: true }; - var transOpts = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, defautGoOpts, _transition_transitionService__WEBPACK_IMPORTED_MODULE_6__.defaultTransOpts); - return this.transitionTo(to, params, transOpts); - }; - /** - * Creates a [[TargetState]] - * - * This is a factory method for creating a TargetState - * - * This may be returned from a Transition Hook to redirect a transition, for example. - */ - StateService.prototype.target = function (identifier, params, options) { - if (options === void 0) { options = {}; } - // If we're reloading, find the state object to reload from - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isObject)(options.reload) && !options.reload.name) - throw new Error('Invalid reload state object'); - var reg = this.router.stateRegistry; - options.reloadState = - options.reload === true ? reg.root() : reg.matcher.find(options.reload, options.relative); - if (options.reload && !options.reloadState) - throw new Error("No such reload state '" + ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(options.reload) ? options.reload : options.reload.name) + "'"); - return new _targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState(this.router.stateRegistry, identifier, params, options); - }; - /** @internal */ - StateService.prototype.getCurrentPath = function () { - var _this = this; - var globals = this.router.globals; - var latestSuccess = globals.successfulTransitions.peekTail(); - var rootPath = function () { return [new _path_pathNode__WEBPACK_IMPORTED_MODULE_5__.PathNode(_this.router.stateRegistry.root())]; }; - return latestSuccess ? latestSuccess.treeChanges().to : rootPath(); - }; - /** - * Low-level method for transitioning to a new state. - * - * The [[go]] method (which uses `transitionTo` internally) is recommended in most situations. - * - * #### Example: - * ```js - * let app = angular.module('app', ['ui.router']); - * - * app.controller('ctrl', function ($scope, $state) { - * $scope.changeState = function () { - * $state.transitionTo('contact.detail'); - * }; - * }); - * ``` - * - * @param to State name or state object. - * @param toParams A map of the parameters that will be sent to the state, - * will populate $stateParams. - * @param options Transition options - * - * @returns A promise representing the state of the new transition. See [[go]] - */ - StateService.prototype.transitionTo = function (to, toParams, options) { - var _this = this; - if (toParams === void 0) { toParams = {}; } - if (options === void 0) { options = {}; } - var router = this.router; - var globals = router.globals; - options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, _transition_transitionService__WEBPACK_IMPORTED_MODULE_6__.defaultTransOpts); - var getCurrent = function () { return globals.transition; }; - options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(options, { current: getCurrent }); - var ref = this.target(to, toParams, options); - var currentPath = this.getCurrentPath(); - if (!ref.exists()) - return this._handleInvalidTargetState(currentPath, ref); - if (!ref.valid()) - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.silentRejection)(ref.error()); - if (options.supercede === false && getCurrent()) { - return (_transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.ignored('Another transition is in progress and supercede has been set to false in TransitionOptions for the transition. So the transition was ignored in favour of the existing one in progress.').toPromise()); - } - /** - * Special handling for Ignored, Aborted, and Redirected transitions - * - * The semantics for the transition.run() promise and the StateService.transitionTo() - * promise differ. For instance, the run() promise may be rejected because it was - * IGNORED, but the transitionTo() promise is resolved because from the user perspective - * no error occurred. Likewise, the transition.run() promise may be rejected because of - * a Redirect, but the transitionTo() promise is chained to the new Transition's promise. - */ - var rejectedTransitionHandler = function (trans) { return function (error) { - if (error instanceof _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection) { - var isLatest = router.globals.lastStartedTransitionId <= trans.$id; - if (error.type === _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.RejectType.IGNORED) { - isLatest && router.urlRouter.update(); - // Consider ignored `Transition.run()` as a successful `transitionTo` - return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.when(globals.current); - } - var detail = error.detail; - if (error.type === _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.RejectType.SUPERSEDED && error.redirected && detail instanceof _targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState) { - // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully - // by returning the promise for the new (redirect) `Transition.run()`. - var redirect = trans.redirect(detail); - return redirect.run().catch(rejectedTransitionHandler(redirect)); - } - if (error.type === _transition_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.RejectType.ABORTED) { - isLatest && router.urlRouter.update(); - return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.reject(error); - } - } - var errorHandler = _this.defaultErrorHandler(); - errorHandler(error); - return _common_coreservices__WEBPACK_IMPORTED_MODULE_3__.services.$q.reject(error); - }; }; - var transition = this.router.transitionService.create(currentPath, ref); - var transitionToPromise = transition.run().catch(rejectedTransitionHandler(transition)); - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.silenceUncaughtInPromise)(transitionToPromise); // issue #2676 - // Return a promise for the transition, which also has the transition object on it. - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)(transitionToPromise, { transition: transition }); - }; - /** - * Checks if the current state *is* the provided state - * - * Similar to [[includes]] but only checks for the full state name. - * If params is supplied then it will be tested for strict equality against the current - * active params object, so all params must match with none missing and no extras. - * - * #### Example: - * ```js - * $state.$current.name = 'contacts.details.item'; - * - * // absolute name - * $state.is('contact.details.item'); // returns true - * $state.is(contactDetailItemStateObject); // returns true - * ``` - * - * // relative name (. and ^), typically from a template - * // E.g. from the 'contacts.details' template - * ```html - *
    Item
    - * ``` - * - * @param stateOrName The state name (absolute or relative) or state object you'd like to check. - * @param params A param object, e.g. `{sectionId: section.id}`, that you'd like - * to test against the current active state. - * @param options An options object. The options are: - * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will - * test relative to `options.relative` state (or name). - * - * @returns Returns true if it is the state. - */ - StateService.prototype.is = function (stateOrName, params, options) { - options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, { relative: this.$current }); - var state = this.router.stateRegistry.matcher.find(stateOrName, options.relative); - if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(state)) - return undefined; - if (this.$current !== state) - return false; - if (!params) - return true; - var schema = state.parameters({ inherit: true, matchingKeys: params }); - return _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.equals(schema, _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.values(schema, params), this.params); - }; - /** - * Checks if the current state *includes* the provided state - * - * A method to determine if the current active state is equal to or is the child of the - * state stateName. If any params are passed then they will be tested for a match as well. - * Not all the parameters need to be passed, just the ones you'd like to test for equality. - * - * #### Example when `$state.$current.name === 'contacts.details.item'` - * ```js - * // Using partial names - * $state.includes("contacts"); // returns true - * $state.includes("contacts.details"); // returns true - * $state.includes("contacts.details.item"); // returns true - * $state.includes("contacts.list"); // returns false - * $state.includes("about"); // returns false - * ``` - * - * #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`: - * ```js - * $state.includes("*.details.*.*"); // returns true - * $state.includes("*.details.**"); // returns true - * $state.includes("**.item.**"); // returns true - * $state.includes("*.details.item.url"); // returns true - * $state.includes("*.details.*.url"); // returns true - * $state.includes("*.details.*"); // returns false - * $state.includes("item.**"); // returns false - * ``` - * - * @param stateOrName A partial name, relative name, glob pattern, - * or state object to be searched for within the current state name. - * @param params A param object, e.g. `{sectionId: section.id}`, - * that you'd like to test against the current active state. - * @param options An options object. The options are: - * - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will - * test relative to `options.relative` state (or name). - * - * @returns {boolean} Returns true if it does include the state - */ - StateService.prototype.includes = function (stateOrName, params, options) { - options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, { relative: this.$current }); - var glob = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(stateOrName) && _common_glob__WEBPACK_IMPORTED_MODULE_10__.Glob.fromString(stateOrName); - if (glob) { - if (!glob.matches(this.$current.name)) - return false; - stateOrName = this.$current.name; - } - var state = this.router.stateRegistry.matcher.find(stateOrName, options.relative), include = this.$current.includes; - if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(state)) - return undefined; - if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(include[state.name])) - return false; - if (!params) - return true; - var schema = state.parameters({ inherit: true, matchingKeys: params }); - return _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.equals(schema, _params_param__WEBPACK_IMPORTED_MODULE_9__.Param.values(schema, params), this.params); - }; - /** - * Generates a URL for a state and parameters - * - * Returns the url for the given state populated with the given params. - * - * #### Example: - * ```js - * expect($state.href("about.person", { person: "bob" })).toEqual("/about/bob"); - * ``` - * - * @param stateOrName The state name or state object you'd like to generate a url from. - * @param params An object of parameter values to fill the state's required parameters. - * @param options Options object. The options are: - * - * @returns {string} compiled state url - */ - StateService.prototype.href = function (stateOrName, params, options) { - var defaultHrefOpts = { - lossy: true, - inherit: true, - absolute: false, - relative: this.$current, - }; - options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.defaults)(options, defaultHrefOpts); - params = params || {}; - var state = this.router.stateRegistry.matcher.find(stateOrName, options.relative); - if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(state)) - return null; - if (options.inherit) - params = this.params.$inherit(params, this.$current, state); - var nav = state && options.lossy ? state.navigable : state; - if (!nav || nav.url === undefined || nav.url === null) { - return null; - } - return this.router.urlRouter.href(nav.url, params, { absolute: options.absolute }); - }; - /** - * Sets or gets the default [[transitionTo]] error handler. - * - * The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition. - * This includes errors caused by resolves and transition hooks. - * - * Note: - * This handler does not receive certain Transition rejections. - * Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]]. - * - * The built-in default error handler logs the error to the console. - * - * You can provide your own custom handler. - * - * #### Example: - * ```js - * stateService.defaultErrorHandler(function() { - * // Do not log transitionTo errors - * }); - * ``` - * - * @param handler a global error handler function - * @returns the current global error handler - */ - StateService.prototype.defaultErrorHandler = function (handler) { - return (this._defaultErrorHandler = handler || this._defaultErrorHandler); - }; - StateService.prototype.get = function (stateOrName, base) { - var reg = this.router.stateRegistry; - if (arguments.length === 0) - return reg.get(); - return reg.get(stateOrName, base || this.$current); - }; - /** - * Lazy loads a state - * - * Explicitly runs a state's [[StateDeclaration.lazyLoad]] function. - * - * @param stateOrName the state that should be lazy loaded - * @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc) - * Note: If no transition is provided, a noop transition is created using the from the current state to the current state. - * This noop transition is not actually run. - * - * @returns a promise to lazy load - */ - StateService.prototype.lazyLoad = function (stateOrName, transition) { - var state = this.get(stateOrName); - if (!state || !state.lazyLoad) - throw new Error('Can not lazy load ' + stateOrName); - var currentPath = this.getCurrentPath(); - var target = _path_pathUtils__WEBPACK_IMPORTED_MODULE_4__.PathUtils.makeTargetState(this.router.stateRegistry, currentPath); - transition = transition || this.router.transitionService.create(currentPath, target); - return (0,_hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_12__.lazyLoadState)(transition, state); - }; - return StateService; -}()); - -//# sourceMappingURL=stateService.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/state/targetState.js": -/*!******************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/state/targetState.js ***! - \******************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TargetState": () => (/* binding */ TargetState) -/* harmony export */ }); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); - - - -/** - * Encapsulate the target (destination) state/params/options of a [[Transition]]. - * - * This class is frequently used to redirect a transition to a new destination. - * - * See: - * - * - [[HookResult]] - * - [[TransitionHookFn]] - * - [[TransitionService.onStart]] - * - * To create a `TargetState`, use [[StateService.target]]. - * - * --- - * - * This class wraps: - * - * 1) an identifier for a state - * 2) a set of parameters - * 3) and transition options - * 4) the registered state object (the [[StateDeclaration]]) - * - * Many UI-Router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can - * either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string). - * The `TargetState` class normalizes those options. - * - * A `TargetState` may be valid (the state being targeted exists in the registry) - * or invalid (the state being targeted is not registered). - */ -var TargetState = /** @class */ (function () { - /** - * The TargetState constructor - * - * Note: Do not construct a `TargetState` manually. - * To create a `TargetState`, use the [[StateService.target]] factory method. - * - * @param _stateRegistry The StateRegistry to use to look up the _definition - * @param _identifier An identifier for a state. - * Either a fully-qualified state name, or the object used to define the state. - * @param _params Parameters for the target state - * @param _options Transition options. - * - * @internal - */ - function TargetState(_stateRegistry, _identifier, _params, _options) { - this._stateRegistry = _stateRegistry; - this._identifier = _identifier; - this._identifier = _identifier; - this._params = (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, _params || {}); - this._options = (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, _options || {}); - this._definition = _stateRegistry.matcher.find(_identifier, this._options.relative); - } - /** The name of the state this object targets */ - TargetState.prototype.name = function () { - return (this._definition && this._definition.name) || this._identifier; - }; - /** The identifier used when creating this TargetState */ - TargetState.prototype.identifier = function () { - return this._identifier; - }; - /** The target parameter values */ - TargetState.prototype.params = function () { - return this._params; - }; - /** The internal state object (if it was found) */ - TargetState.prototype.$state = function () { - return this._definition; - }; - /** The internal state declaration (if it was found) */ - TargetState.prototype.state = function () { - return this._definition && this._definition.self; - }; - /** The target options */ - TargetState.prototype.options = function () { - return this._options; - }; - /** True if the target state was found */ - TargetState.prototype.exists = function () { - return !!(this._definition && this._definition.self); - }; - /** True if the object is valid */ - TargetState.prototype.valid = function () { - return !this.error(); - }; - /** If the object is invalid, returns the reason why */ - TargetState.prototype.error = function () { - var base = this.options().relative; - if (!this._definition && !!base) { - var stateName = base.name ? base.name : base; - return "Could not resolve '" + this.name() + "' from state '" + stateName + "'"; - } - if (!this._definition) - return "No such state '" + this.name() + "'"; - if (!this._definition.self) - return "State '" + this.name() + "' has an invalid definition"; - }; - TargetState.prototype.toString = function () { - return "'" + this.name() + "'" + (0,_common_strings__WEBPACK_IMPORTED_MODULE_1__.stringify)(this.params()); - }; - /** - * Returns a copy of this TargetState which targets a different state. - * The new TargetState has the same parameter values and transition options. - * - * @param state The new state that should be targeted - */ - TargetState.prototype.withState = function (state) { - return new TargetState(this._stateRegistry, state, this._params, this._options); - }; - /** - * Returns a copy of this TargetState, using the specified parameter values. - * - * @param params the new parameter values to use - * @param replace When false (default) the new parameter values will be merged with the current values. - * When true the parameter values will be used instead of the current values. - */ - TargetState.prototype.withParams = function (params, replace) { - if (replace === void 0) { replace = false; } - var newParams = replace ? params : (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, this._params, params); - return new TargetState(this._stateRegistry, this._identifier, newParams, this._options); - }; - /** - * Returns a copy of this TargetState, using the specified Transition Options. - * - * @param options the new options to use - * @param replace When false (default) the new options will be merged with the current options. - * When true the options will be used instead of the current options. - */ - TargetState.prototype.withOptions = function (options, replace) { - if (replace === void 0) { replace = false; } - var newOpts = replace ? options : (0,_common__WEBPACK_IMPORTED_MODULE_2__.extend)({}, this._options, options); - return new TargetState(this._stateRegistry, this._identifier, this._params, newOpts); - }; - /** Returns true if the object has a state property that might be a state or state name */ - TargetState.isDef = function (obj) { - return obj && obj.state && ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(obj.state) || ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isObject)(obj.state) && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isString)(obj.state.name))); - }; - return TargetState; -}()); - -//# sourceMappingURL=targetState.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js": -/*!***********************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js ***! - \***********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "HookBuilder": () => (/* binding */ HookBuilder) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); -/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); - - - - -/** - * This class returns applicable TransitionHooks for a specific Transition instance. - * - * Hooks ([[RegisteredHook]]) may be registered globally, e.g., $transitions.onEnter(...), or locally, e.g. - * myTransition.onEnter(...). The HookBuilder finds matching RegisteredHooks (where the match criteria is - * determined by the type of hook) - * - * The HookBuilder also converts RegisteredHooks objects to TransitionHook objects, which are used to run a Transition. - * - * The HookBuilder constructor is given the $transitions service and a Transition instance. Thus, a HookBuilder - * instance may only be used for one specific Transition object. (side note: the _treeChanges accessor is private - * in the Transition class, so we must also provide the Transition's _treeChanges) - */ -var HookBuilder = /** @class */ (function () { - function HookBuilder(transition) { - this.transition = transition; - } - HookBuilder.prototype.buildHooksForPhase = function (phase) { - var _this = this; - var $transitions = this.transition.router.transitionService; - return $transitions._pluginapi - ._getEvents(phase) - .map(function (type) { return _this.buildHooks(type); }) - .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) - .filter(_common_common__WEBPACK_IMPORTED_MODULE_0__.identity); - }; - /** - * Returns an array of newly built TransitionHook objects. - * - * - Finds all RegisteredHooks registered for the given `hookType` which matched the transition's [[TreeChanges]]. - * - Finds [[PathNode]] (or `PathNode[]`) to use as the TransitionHook context(s) - * - For each of the [[PathNode]]s, creates a TransitionHook - * - * @param hookType the type of the hook registration function, e.g., 'onEnter', 'onFinish'. - */ - HookBuilder.prototype.buildHooks = function (hookType) { - var transition = this.transition; - var treeChanges = transition.treeChanges(); - // Find all the matching registered hooks for a given hook type - var matchingHooks = this.getMatchingHooks(hookType, treeChanges, transition); - if (!matchingHooks) - return []; - var baseHookOptions = { - transition: transition, - current: transition.options().current, - }; - var makeTransitionHooks = function (hook) { - // Fetch the Nodes that caused this hook to match. - var matches = hook.matches(treeChanges, transition); - // Select the PathNode[] that will be used as TransitionHook context objects - var matchingNodes = matches[hookType.criteriaMatchPath.name]; - // Return an array of HookTuples - return matchingNodes.map(function (node) { - var _options = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ - bind: hook.bind, - traceData: { hookType: hookType.name, context: node }, - }, baseHookOptions); - var state = hookType.criteriaMatchPath.scope === _interface__WEBPACK_IMPORTED_MODULE_2__.TransitionHookScope.STATE ? node.state.self : null; - var transitionHook = new _transitionHook__WEBPACK_IMPORTED_MODULE_3__.TransitionHook(transition, state, hook, _options); - return { hook: hook, node: node, transitionHook: transitionHook }; - }); - }; - return matchingHooks - .map(makeTransitionHooks) - .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) - .sort(tupleSort(hookType.reverseSort)) - .map(function (tuple) { return tuple.transitionHook; }); - }; - /** - * Finds all RegisteredHooks from: - * - The Transition object instance hook registry - * - The TransitionService ($transitions) global hook registry - * - * which matched: - * - the eventType - * - the matchCriteria (to, from, exiting, retained, entering) - * - * @returns an array of matched [[RegisteredHook]]s - */ - HookBuilder.prototype.getMatchingHooks = function (hookType, treeChanges, transition) { - var isCreate = hookType.hookPhase === _interface__WEBPACK_IMPORTED_MODULE_2__.TransitionHookPhase.CREATE; - // Instance and Global hook registries - var $transitions = this.transition.router.transitionService; - var registries = isCreate ? [$transitions] : [this.transition, $transitions]; - return registries - .map(function (reg) { return reg.getHooks(hookType.name); }) // Get named hooks from registries - .filter((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.assertPredicate)(_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isArray, "broken event named: " + hookType.name)) // Sanity check - .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array - .filter(function (hook) { return hook.matches(treeChanges, transition); }); // Only those satisfying matchCriteria - }; - return HookBuilder; -}()); - -/** - * A factory for a sort function for HookTuples. - * - * The sort function first compares the PathNode depth (how deep in the state tree a node is), then compares - * the EventHook priority. - * - * @param reverseDepthSort a boolean, when true, reverses the sort order for the node depth - * @returns a tuple sort function - */ -function tupleSort(reverseDepthSort) { - if (reverseDepthSort === void 0) { reverseDepthSort = false; } - return function nodeDepthThenPriority(l, r) { - var factor = reverseDepthSort ? -1 : 1; - var depthDelta = (l.node.state.path.length - r.node.state.path.length) * factor; - return depthDelta !== 0 ? depthDelta : r.hook.priority - l.hook.priority; - }; -} -//# sourceMappingURL=hookBuilder.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js": -/*!************************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js ***! - \************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "matchState": () => (/* binding */ matchState), -/* harmony export */ "RegisteredHook": () => (/* binding */ RegisteredHook), -/* harmony export */ "makeEvent": () => (/* binding */ makeEvent) -/* harmony export */ }); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); - - -/** - * Determines if the given state matches the matchCriteria - * - * @internal - * - * @param state a State Object to test against - * @param criterion - * - If a string, matchState uses the string as a glob-matcher against the state name - * - If an array (of strings), matchState uses each string in the array as a glob-matchers against the state name - * and returns a positive match if any of the globs match. - * - If a function, matchState calls the function with the state and returns true if the function's result is truthy. - * @returns {boolean} - */ -function matchState(state, criterion, transition) { - var toMatch = (0,_common__WEBPACK_IMPORTED_MODULE_0__.isString)(criterion) ? [criterion] : criterion; - function matchGlobs(_state) { - var globStrings = toMatch; - for (var i = 0; i < globStrings.length; i++) { - var glob = new _common__WEBPACK_IMPORTED_MODULE_0__.Glob(globStrings[i]); - if ((glob && glob.matches(_state.name)) || (!glob && globStrings[i] === _state.name)) { - return true; - } - } - return false; - } - var matchFn = ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isFunction)(toMatch) ? toMatch : matchGlobs); - return !!matchFn(state, transition); -} -/** - * The registration data for a registered transition hook - */ -var RegisteredHook = /** @class */ (function () { - function RegisteredHook(tranSvc, eventType, callback, matchCriteria, removeHookFromRegistry, options) { - if (options === void 0) { options = {}; } - this.tranSvc = tranSvc; - this.eventType = eventType; - this.callback = callback; - this.matchCriteria = matchCriteria; - this.removeHookFromRegistry = removeHookFromRegistry; - this.invokeCount = 0; - this._deregistered = false; - this.priority = options.priority || 0; - this.bind = options.bind || null; - this.invokeLimit = options.invokeLimit; - } - /** - * Gets the matching [[PathNode]]s - * - * Given an array of [[PathNode]]s, and a [[HookMatchCriterion]], returns an array containing - * the [[PathNode]]s that the criteria matches, or `null` if there were no matching nodes. - * - * Returning `null` is significant to distinguish between the default - * "match-all criterion value" of `true` compared to a `() => true` function, - * when the nodes is an empty array. - * - * This is useful to allow a transition match criteria of `entering: true` - * to still match a transition, even when `entering === []`. Contrast that - * with `entering: (state) => true` which only matches when a state is actually - * being entered. - */ - RegisteredHook.prototype._matchingNodes = function (nodes, criterion, transition) { - if (criterion === true) - return nodes; - var matching = nodes.filter(function (node) { return matchState(node.state, criterion, transition); }); - return matching.length ? matching : null; - }; - /** - * Gets the default match criteria (all `true`) - * - * Returns an object which has all the criteria match paths as keys and `true` as values, i.e.: - * - * ```js - * { - * to: true, - * from: true, - * entering: true, - * exiting: true, - * retained: true, - * } - */ - RegisteredHook.prototype._getDefaultMatchCriteria = function () { - return (0,_common__WEBPACK_IMPORTED_MODULE_0__.mapObj)(this.tranSvc._pluginapi._getPathTypes(), function () { return true; }); - }; - /** - * Gets matching nodes as [[IMatchingNodes]] - * - * Create a IMatchingNodes object from the TransitionHookTypes that is roughly equivalent to: - * - * ```js - * let matches: IMatchingNodes = { - * to: _matchingNodes([tail(treeChanges.to)], mc.to), - * from: _matchingNodes([tail(treeChanges.from)], mc.from), - * exiting: _matchingNodes(treeChanges.exiting, mc.exiting), - * retained: _matchingNodes(treeChanges.retained, mc.retained), - * entering: _matchingNodes(treeChanges.entering, mc.entering), - * }; - * ``` - */ - RegisteredHook.prototype._getMatchingNodes = function (treeChanges, transition) { - var _this = this; - var criteria = (0,_common__WEBPACK_IMPORTED_MODULE_0__.extend)(this._getDefaultMatchCriteria(), this.matchCriteria); - var paths = (0,_common__WEBPACK_IMPORTED_MODULE_0__.values)(this.tranSvc._pluginapi._getPathTypes()); - return paths.reduce(function (mn, pathtype) { - // STATE scope criteria matches against every node in the path. - // TRANSITION scope criteria matches against only the last node in the path - var isStateHook = pathtype.scope === _interface__WEBPACK_IMPORTED_MODULE_1__.TransitionHookScope.STATE; - var path = treeChanges[pathtype.name] || []; - var nodes = isStateHook ? path : [(0,_common__WEBPACK_IMPORTED_MODULE_0__.tail)(path)]; - mn[pathtype.name] = _this._matchingNodes(nodes, criteria[pathtype.name], transition); - return mn; - }, {}); - }; - /** - * Determines if this hook's [[matchCriteria]] match the given [[TreeChanges]] - * - * @returns an IMatchingNodes object, or null. If an IMatchingNodes object is returned, its values - * are the matching [[PathNode]]s for each [[HookMatchCriterion]] (to, from, exiting, retained, entering) - */ - RegisteredHook.prototype.matches = function (treeChanges, transition) { - var matches = this._getMatchingNodes(treeChanges, transition); - // Check if all the criteria matched the TreeChanges object - var allMatched = (0,_common__WEBPACK_IMPORTED_MODULE_0__.values)(matches).every(_common__WEBPACK_IMPORTED_MODULE_0__.identity); - return allMatched ? matches : null; - }; - RegisteredHook.prototype.deregister = function () { - this.removeHookFromRegistry(this); - this._deregistered = true; - }; - return RegisteredHook; -}()); - -/** Return a registration function of the requested type. */ -function makeEvent(registry, transitionService, eventType) { - // Create the object which holds the registered transition hooks. - var _registeredHooks = (registry._registeredHooks = registry._registeredHooks || {}); - var hooks = (_registeredHooks[eventType.name] = []); - var removeHookFn = (0,_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(hooks); - // Create hook registration function on the IHookRegistry for the event - registry[eventType.name] = hookRegistrationFn; - function hookRegistrationFn(matchObject, callback, options) { - if (options === void 0) { options = {}; } - var registeredHook = new RegisteredHook(transitionService, eventType, callback, matchObject, removeHookFn, options); - hooks.push(registeredHook); - return registeredHook.deregister.bind(registeredHook); - } - return hookRegistrationFn; -} -//# sourceMappingURL=hookRegistry.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/transition/index.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/transition/index.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TransitionHookPhase": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookPhase), -/* harmony export */ "TransitionHookScope": () => (/* reexport safe */ _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookScope), -/* harmony export */ "HookBuilder": () => (/* reexport safe */ _hookBuilder__WEBPACK_IMPORTED_MODULE_1__.HookBuilder), -/* harmony export */ "RegisteredHook": () => (/* reexport safe */ _hookRegistry__WEBPACK_IMPORTED_MODULE_2__.RegisteredHook), -/* harmony export */ "makeEvent": () => (/* reexport safe */ _hookRegistry__WEBPACK_IMPORTED_MODULE_2__.makeEvent), -/* harmony export */ "matchState": () => (/* reexport safe */ _hookRegistry__WEBPACK_IMPORTED_MODULE_2__.matchState), -/* harmony export */ "RejectType": () => (/* reexport safe */ _rejectFactory__WEBPACK_IMPORTED_MODULE_3__.RejectType), -/* harmony export */ "Rejection": () => (/* reexport safe */ _rejectFactory__WEBPACK_IMPORTED_MODULE_3__.Rejection), -/* harmony export */ "Transition": () => (/* reexport safe */ _transition__WEBPACK_IMPORTED_MODULE_4__.Transition), -/* harmony export */ "TransitionHook": () => (/* reexport safe */ _transitionHook__WEBPACK_IMPORTED_MODULE_5__.TransitionHook), -/* harmony export */ "TransitionEventType": () => (/* reexport safe */ _transitionEventType__WEBPACK_IMPORTED_MODULE_6__.TransitionEventType), -/* harmony export */ "TransitionService": () => (/* reexport safe */ _transitionService__WEBPACK_IMPORTED_MODULE_7__.TransitionService), -/* harmony export */ "defaultTransOpts": () => (/* reexport safe */ _transitionService__WEBPACK_IMPORTED_MODULE_7__.defaultTransOpts) -/* harmony export */ }); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); -/* harmony import */ var _hookBuilder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hookBuilder */ "./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js"); -/* harmony import */ var _hookRegistry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hookRegistry */ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"); -/* harmony import */ var _rejectFactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); -/* harmony import */ var _transition__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./transition */ "./node_modules/@uirouter/core/lib-esm/transition/transition.js"); -/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); -/* harmony import */ var _transitionEventType__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./transitionEventType */ "./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js"); -/* harmony import */ var _transitionService__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./transitionService */ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js"); -/** - * # Transition subsystem - * - * This module contains APIs related to a Transition. - * - * See: - * - [[TransitionService]] - * - [[Transition]] - * - [[HookFn]], [[TransitionHookFn]], [[TransitionStateHookFn]], [[HookMatchCriteria]], [[HookResult]] - * - * @packageDocumentation @preferred - */ - - - - - - - - -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/transition/interface.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/transition/interface.js ***! - \*********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TransitionHookPhase": () => (/* binding */ TransitionHookPhase), -/* harmony export */ "TransitionHookScope": () => (/* binding */ TransitionHookScope) -/* harmony export */ }); -var TransitionHookPhase; -(function (TransitionHookPhase) { - TransitionHookPhase[TransitionHookPhase["CREATE"] = 0] = "CREATE"; - TransitionHookPhase[TransitionHookPhase["BEFORE"] = 1] = "BEFORE"; - TransitionHookPhase[TransitionHookPhase["RUN"] = 2] = "RUN"; - TransitionHookPhase[TransitionHookPhase["SUCCESS"] = 3] = "SUCCESS"; - TransitionHookPhase[TransitionHookPhase["ERROR"] = 4] = "ERROR"; -})(TransitionHookPhase || (TransitionHookPhase = {})); -var TransitionHookScope; -(function (TransitionHookScope) { - TransitionHookScope[TransitionHookScope["TRANSITION"] = 0] = "TRANSITION"; - TransitionHookScope[TransitionHookScope["STATE"] = 1] = "STATE"; -})(TransitionHookScope || (TransitionHookScope = {})); - -//# sourceMappingURL=interface.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js": -/*!*************************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js ***! - \*************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "RejectType": () => (/* binding */ RejectType), -/* harmony export */ "Rejection": () => (/* binding */ Rejection) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); - - - - -/** An enum for Transition Rejection reasons */ -var RejectType; -(function (RejectType) { - /** - * A new transition superseded this one. - * - * While this transition was running, a new transition started. - * This transition is cancelled because it was superseded by new transition. - */ - RejectType[RejectType["SUPERSEDED"] = 2] = "SUPERSEDED"; - /** - * The transition was aborted - * - * The transition was aborted by a hook which returned `false` - */ - RejectType[RejectType["ABORTED"] = 3] = "ABORTED"; - /** - * The transition was invalid - * - * The transition was never started because it was invalid - */ - RejectType[RejectType["INVALID"] = 4] = "INVALID"; - /** - * The transition was ignored - * - * The transition was ignored because it would have no effect. - * - * Either: - * - * - The transition is targeting the current state and parameter values - * - The transition is targeting the same state and parameter values as the currently running transition. - */ - RejectType[RejectType["IGNORED"] = 5] = "IGNORED"; - /** - * The transition errored. - * - * This generally means a hook threw an error or returned a rejected promise - */ - RejectType[RejectType["ERROR"] = 6] = "ERROR"; -})(RejectType || (RejectType = {})); - -/** @internal */ -var id = 0; -var Rejection = /** @class */ (function () { - function Rejection(type, message, detail) { - /** @internal */ - this.$id = id++; - this.type = type; - this.message = message; - this.detail = detail; - } - /** Returns true if the obj is a rejected promise created from the `asPromise` factory */ - Rejection.isRejectionPromise = function (obj) { - return obj && typeof obj.then === 'function' && (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Rejection)(obj._transitionRejection); - }; - /** Returns a Rejection due to transition superseded */ - Rejection.superseded = function (detail, options) { - var message = 'The transition has been superseded by a different transition'; - var rejection = new Rejection(RejectType.SUPERSEDED, message, detail); - if (options && options.redirected) { - rejection.redirected = true; - } - return rejection; - }; - /** Returns a Rejection due to redirected transition */ - Rejection.redirected = function (detail) { - return Rejection.superseded(detail, { redirected: true }); - }; - /** Returns a Rejection due to invalid transition */ - Rejection.invalid = function (detail) { - var message = 'This transition is invalid'; - return new Rejection(RejectType.INVALID, message, detail); - }; - /** Returns a Rejection due to ignored transition */ - Rejection.ignored = function (detail) { - var message = 'The transition was ignored'; - return new Rejection(RejectType.IGNORED, message, detail); - }; - /** Returns a Rejection due to aborted transition */ - Rejection.aborted = function (detail) { - var message = 'The transition has been aborted'; - return new Rejection(RejectType.ABORTED, message, detail); - }; - /** Returns a Rejection due to aborted transition */ - Rejection.errored = function (detail) { - var message = 'The transition errored'; - return new Rejection(RejectType.ERROR, message, detail); - }; - /** - * Returns a Rejection - * - * Normalizes a value as a Rejection. - * If the value is already a Rejection, returns it. - * Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR). - * - * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection. - */ - Rejection.normalize = function (detail) { - return (0,_common_hof__WEBPACK_IMPORTED_MODULE_2__.is)(Rejection)(detail) ? detail : Rejection.errored(detail); - }; - Rejection.prototype.toString = function () { - var detailString = function (d) { return (d && d.toString !== Object.prototype.toString ? d.toString() : (0,_common_strings__WEBPACK_IMPORTED_MODULE_1__.stringify)(d)); }; - var detail = detailString(this.detail); - var _a = this, $id = _a.$id, type = _a.type, message = _a.message; - return "Transition Rejection($id: " + $id + " type: " + type + ", message: " + message + ", detail: " + detail + ")"; - }; - Rejection.prototype.toPromise = function () { - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.extend)((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.silentRejection)(this), { _transitionRejection: this }); - }; - return Rejection; -}()); - -//# sourceMappingURL=rejectFactory.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/transition/transition.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/transition/transition.js ***! - \**********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "Transition": () => (/* binding */ Transition) -/* harmony export */ }); -/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); -/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); -/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); -/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); -/* harmony import */ var _hookRegistry__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./hookRegistry */ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"); -/* harmony import */ var _hookBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./hookBuilder */ "./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js"); -/* harmony import */ var _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../path/pathUtils */ "./node_modules/@uirouter/core/lib-esm/path/pathUtils.js"); -/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); -/* harmony import */ var _resolve_resolvable__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../resolve/resolvable */ "./node_modules/@uirouter/core/lib-esm/resolve/resolvable.js"); -/* harmony import */ var _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../resolve/resolveContext */ "./node_modules/@uirouter/core/lib-esm/resolve/resolveContext.js"); -/* harmony import */ var _rejectFactory__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); - - - - - - - // has or is using - - - - - - - - - -/** @internal */ -var stateSelf = (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('self'); -/** - * Represents a transition between two states. - * - * When navigating to a state, we are transitioning **from** the current state **to** the new state. - * - * This object contains all contextual information about the to/from states, parameters, resolves. - * It has information about all states being entered and exited as a result of the transition. - */ -var Transition = /** @class */ (function () { - /** - * Creates a new Transition object. - * - * If the target state is not valid, an error is thrown. - * - * @internal - * - * @param fromPath The path of [[PathNode]]s from which the transition is leaving. The last node in the `fromPath` - * encapsulates the "from state". - * @param targetState The target state and parameters being transitioned to (also, the transition options) - * @param router The [[UIRouter]] instance - * @internal - */ - function Transition(fromPath, targetState, router) { - var _this = this; - /** @internal */ - this._deferred = _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.defer(); - /** - * This promise is resolved or rejected based on the outcome of the Transition. - * - * When the transition is successful, the promise is resolved - * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error - */ - this.promise = this._deferred.promise; - /** @internal Holds the hook registration functions such as those passed to Transition.onStart() */ - this._registeredHooks = {}; - /** @internal */ - this._hookBuilder = new _hookBuilder__WEBPACK_IMPORTED_MODULE_9__.HookBuilder(this); - /** Checks if this transition is currently active/running. */ - this.isActive = function () { return _this.router.globals.transition === _this; }; - this.router = router; - this._targetState = targetState; - if (!targetState.valid()) { - throw new Error(targetState.error()); - } - // current() is assumed to come from targetState.options, but provide a naive implementation otherwise. - this._options = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.extend)({ current: (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.val)(this) }, targetState.options()); - this.$id = router.transitionService._transitionCount++; - var toPath = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.buildToPath(fromPath, targetState); - this._treeChanges = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.treeChanges(fromPath, toPath, this._options.reloadState); - this.createTransitionHookRegFns(); - var onCreateHooks = this._hookBuilder.buildHooksForPhase(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.CREATE); - _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.invokeHooks(onCreateHooks, function () { return null; }); - this.applyViewConfigs(router); - } - /** @internal */ - Transition.prototype.onBefore = function (criteria, callback, options) { - return; - }; - /** @inheritdoc */ - Transition.prototype.onStart = function (criteria, callback, options) { - return; - }; - /** @inheritdoc */ - Transition.prototype.onExit = function (criteria, callback, options) { - return; - }; - /** @inheritdoc */ - Transition.prototype.onRetain = function (criteria, callback, options) { - return; - }; - /** @inheritdoc */ - Transition.prototype.onEnter = function (criteria, callback, options) { - return; - }; - /** @inheritdoc */ - Transition.prototype.onFinish = function (criteria, callback, options) { - return; - }; - /** @inheritdoc */ - Transition.prototype.onSuccess = function (criteria, callback, options) { - return; - }; - /** @inheritdoc */ - Transition.prototype.onError = function (criteria, callback, options) { - return; - }; - /** @internal - * Creates the transition-level hook registration functions - * (which can then be used to register hooks) - */ - Transition.prototype.createTransitionHookRegFns = function () { - var _this = this; - this.router.transitionService._pluginapi - ._getEvents() - .filter(function (type) { return type.hookPhase !== _interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.CREATE; }) - .forEach(function (type) { return (0,_hookRegistry__WEBPACK_IMPORTED_MODULE_8__.makeEvent)(_this, _this.router.transitionService, type); }); - }; - /** @internal */ - Transition.prototype.getHooks = function (hookName) { - return this._registeredHooks[hookName]; - }; - Transition.prototype.applyViewConfigs = function (router) { - var enteringStates = this._treeChanges.entering.map(function (node) { return node.state; }); - _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.applyViewConfigs(router.transitionService.$view, this._treeChanges.to, enteringStates); - }; - /** - * @internal - * @returns the internal from [State] object - */ - Transition.prototype.$from = function () { - return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.tail)(this._treeChanges.from).state; - }; - /** - * @internal - * @returns the internal to [State] object - */ - Transition.prototype.$to = function () { - return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.tail)(this._treeChanges.to).state; - }; - /** - * Returns the "from state" - * - * Returns the state that the transition is coming *from*. - * - * @returns The state declaration object for the Transition's ("from state"). - */ - Transition.prototype.from = function () { - return this.$from().self; - }; - /** - * Returns the "to state" - * - * Returns the state that the transition is going *to*. - * - * @returns The state declaration object for the Transition's target state ("to state"). - */ - Transition.prototype.to = function () { - return this.$to().self; - }; - /** - * Gets the Target State - * - * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object. - * - * @returns the [[TargetState]] of this Transition - */ - Transition.prototype.targetState = function () { - return this._targetState; - }; - /** - * Determines whether two transitions are equivalent. - * @deprecated - */ - Transition.prototype.is = function (compare) { - if (compare instanceof Transition) { - // TODO: Also compare parameters - return this.is({ to: compare.$to().name, from: compare.$from().name }); - } - return !((compare.to && !(0,_hookRegistry__WEBPACK_IMPORTED_MODULE_8__.matchState)(this.$to(), compare.to, this)) || - (compare.from && !(0,_hookRegistry__WEBPACK_IMPORTED_MODULE_8__.matchState)(this.$from(), compare.from, this))); - }; - Transition.prototype.params = function (pathname) { - if (pathname === void 0) { pathname = 'to'; } - return Object.freeze(this._treeChanges[pathname].map((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('paramValues')).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.mergeR, {})); - }; - Transition.prototype.paramsChanged = function () { - var fromParams = this.params('from'); - var toParams = this.params('to'); - // All the parameters declared on both the "to" and "from" paths - var allParamDescriptors = [] - .concat(this._treeChanges.to) - .concat(this._treeChanges.from) - .map(function (pathNode) { return pathNode.paramSchema; }) - .reduce(_common__WEBPACK_IMPORTED_MODULE_15__.flattenR, []) - .reduce(_common__WEBPACK_IMPORTED_MODULE_15__.uniqR, []); - var changedParamDescriptors = _params_param__WEBPACK_IMPORTED_MODULE_11__.Param.changed(allParamDescriptors, fromParams, toParams); - return changedParamDescriptors.reduce(function (changedValues, descriptor) { - changedValues[descriptor.id] = toParams[descriptor.id]; - return changedValues; - }, {}); - }; - /** - * Creates a [[UIInjector]] Dependency Injector - * - * Returns a Dependency Injector for the Transition's target state (to state). - * The injector provides resolve values which the target state has access to. - * - * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2). - * - * #### Example: - * ```js - * .onEnter({ entering: 'myState' }, trans => { - * var myResolveValue = trans.injector().get('myResolve'); - * // Inject a global service from the global/native injector (if it exists) - * var MyService = trans.injector().get('MyService'); - * }) - * ``` - * - * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched. - * You can use [[UIInjector.getAsync]] to get a promise for the data. - * #### Example: - * ```js - * .onBefore({}, trans => { - * return trans.injector().getAsync('myResolve').then(myResolveValue => - * return myResolveValue !== 'ABORT'; - * }); - * }); - * ``` - * - * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to. - * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`. - * #### Example: - * ```js - * .onEnter({ to: 'foo.bar' }, trans => { - * // returns result of `foo` state's `myResolve` resolve - * // even though `foo.bar` also has a `myResolve` resolve - * var fooData = trans.injector('foo').get('myResolve'); - * }); - * ``` - * - * If you need resolve data from the exiting states, pass `'from'` as `pathName`. - * The resolve data from the `from` path will be returned. - * #### Example: - * ```js - * .onExit({ exiting: 'foo.bar' }, trans => { - * // Gets the resolve value of `myResolve` from the state being exited - * var fooData = trans.injector(null, 'from').get('myResolve'); - * }); - * ``` - * - * - * @param state Limits the resolves provided to only the resolves the provided state has access to. - * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states. - * - * @returns a [[UIInjector]] - */ - Transition.prototype.injector = function (state, pathName) { - if (pathName === void 0) { pathName = 'to'; } - var path = this._treeChanges[pathName]; - if (state) - path = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.subPath(path, function (node) { return node.state === state || node.state.name === state; }); - return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__.ResolveContext(path).injector(); - }; - /** - * Gets all available resolve tokens (keys) - * - * This method can be used in conjunction with [[injector]] to inspect the resolve values - * available to the Transition. - * - * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states - * in the Transition's [[TreeChanges.to]] path. - * - * #### Example: - * This example logs all resolve values - * ```js - * let tokens = trans.getResolveTokens(); - * tokens.forEach(token => console.log(token + " = " + trans.injector().get(token))); - * ``` - * - * #### Example: - * This example creates promises for each resolve value. - * This triggers fetches of resolves (if any have not yet been fetched). - * When all promises have all settled, it logs the resolve values. - * ```js - * let tokens = trans.getResolveTokens(); - * let promise = tokens.map(token => trans.injector().getAsync(token)); - * Promise.all(promises).then(values => console.log("Resolved values: " + values)); - * ``` - * - * Note: Angular 1 users whould use `$q.all()` - * - * @param pathname resolve context's path name (e.g., `to` or `from`) - * - * @returns an array of resolve tokens (keys) - */ - Transition.prototype.getResolveTokens = function (pathname) { - if (pathname === void 0) { pathname = 'to'; } - return new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__.ResolveContext(this._treeChanges[pathname]).getTokens(); - }; - /** - * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition. - * - * Allows a transition hook to dynamically add a Resolvable to this Transition. - * - * Use the [[Transition.injector]] to retrieve the resolved data in subsequent hooks ([[UIInjector.get]]). - * - * If a `state` argument is provided, the Resolvable is processed when that state is being entered. - * If no `state` is provided then the root state is used. - * If the given `state` has already been entered, the Resolvable is processed when any child state is entered. - * If no child states will be entered, the Resolvable is processed during the `onFinish` phase of the Transition. - * - * The `state` argument also scopes the resolved data. - * The resolved data is available from the injector for that `state` and any children states. - * - * #### Example: - * ```js - * transitionService.onBefore({}, transition => { - * transition.addResolvable({ - * token: 'myResolve', - * deps: ['MyService'], - * resolveFn: myService => myService.getData() - * }); - * }); - * ``` - * - * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]]) - * @param state the state in the "to path" which should receive the new resolve (otherwise, the root state) - */ - Transition.prototype.addResolvable = function (resolvable, state) { - if (state === void 0) { state = ''; } - resolvable = (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.is)(_resolve_resolvable__WEBPACK_IMPORTED_MODULE_12__.Resolvable)(resolvable) ? resolvable : new _resolve_resolvable__WEBPACK_IMPORTED_MODULE_12__.Resolvable(resolvable); - var stateName = typeof state === 'string' ? state : state.name; - var topath = this._treeChanges.to; - var targetNode = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.find)(topath, function (node) { return node.state.name === stateName; }); - var resolveContext = new _resolve_resolveContext__WEBPACK_IMPORTED_MODULE_13__.ResolveContext(topath); - resolveContext.addResolvables([resolvable], targetNode.state); - }; - /** - * Gets the transition from which this transition was redirected. - * - * If the current transition is a redirect, this method returns the transition that was redirected. - * - * #### Example: - * ```js - * let transitionA = $state.go('A').transition - * transitionA.onStart({}, () => $state.target('B')); - * $transitions.onSuccess({ to: 'B' }, (trans) => { - * trans.to().name === 'B'; // true - * trans.redirectedFrom() === transitionA; // true - * }); - * ``` - * - * @returns The previous Transition, or null if this Transition is not the result of a redirection - */ - Transition.prototype.redirectedFrom = function () { - return this._options.redirectedFrom || null; - }; - /** - * Gets the original transition in a redirect chain - * - * A transition might belong to a long chain of multiple redirects. - * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain. - * - * #### Example: - * ```js - * // states - * registry.register({ name: 'A', redirectTo: 'B' }); - * registry.register({ name: 'B', redirectTo: 'C' }); - * registry.register({ name: 'C', redirectTo: 'D' }); - * registry.register({ name: 'D' }); - * - * let transitionA = $state.go('A').transition - * - * $transitions.onSuccess({ to: 'D' }, (trans) => { - * trans.to().name === 'D'; // true - * trans.redirectedFrom().to().name === 'C'; // true - * trans.originalTransition() === transitionA; // true - * trans.originalTransition().to().name === 'A'; // true - * }); - * ``` - * - * @returns The original Transition that started a redirect chain - */ - Transition.prototype.originalTransition = function () { - var rf = this.redirectedFrom(); - return (rf && rf.originalTransition()) || this; - }; - /** - * Get the transition options - * - * @returns the options for this Transition. - */ - Transition.prototype.options = function () { - return this._options; - }; - /** - * Gets the states being entered. - * - * @returns an array of states that will be entered during this transition. - */ - Transition.prototype.entering = function () { - return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.map)(this._treeChanges.entering, (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('state')).map(stateSelf); - }; - /** - * Gets the states being exited. - * - * @returns an array of states that will be exited during this transition. - */ - Transition.prototype.exiting = function () { - return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.map)(this._treeChanges.exiting, (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('state')).map(stateSelf).reverse(); - }; - /** - * Gets the states being retained. - * - * @returns an array of states that are already entered from a previous Transition, that will not be - * exited during this Transition - */ - Transition.prototype.retained = function () { - return (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.map)(this._treeChanges.retained, (0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('state')).map(stateSelf); - }; - /** - * Get the [[ViewConfig]]s associated with this Transition - * - * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects. - * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., "to" or "entering"). - * - * @param pathname the name of the path to fetch views for: - * (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`) - * @param state If provided, only returns the `ViewConfig`s for a single state in the path - * - * @returns a list of ViewConfig objects for the given path. - */ - Transition.prototype.views = function (pathname, state) { - if (pathname === void 0) { pathname = 'entering'; } - var path = this._treeChanges[pathname]; - path = !state ? path : path.filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.propEq)('state', state)); - return path.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('views')).filter(_common_common__WEBPACK_IMPORTED_MODULE_3__.identity).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.unnestR, []); - }; - Transition.prototype.treeChanges = function (pathname) { - return pathname ? this._treeChanges[pathname] : this._treeChanges; - }; - /** - * Creates a new transition that is a redirection of the current one. - * - * This transition can be returned from a [[TransitionService]] hook to - * redirect a transition to a new state and/or set of parameters. - * - * @internal - * - * @returns Returns a new [[Transition]] instance. - */ - Transition.prototype.redirect = function (targetState) { - var redirects = 1, trans = this; - // tslint:disable-next-line:no-conditional-assignment - while ((trans = trans.redirectedFrom()) != null) { - if (++redirects > 20) - throw new Error("Too many consecutive Transition redirects (20+)"); - } - var redirectOpts = { redirectedFrom: this, source: 'redirect' }; - // If the original transition was caused by URL sync, then use { location: 'replace' } - // on the new transition (unless the target state explicitly specifies location: false). - // This causes the original url to be replaced with the url for the redirect target - // so the original url disappears from the browser history. - if (this.options().source === 'url' && targetState.options().location !== false) { - redirectOpts.location = 'replace'; - } - var newOptions = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.extend)({}, this.options(), targetState.options(), redirectOpts); - targetState = targetState.withOptions(newOptions, true); - var newTransition = this.router.transitionService.create(this._treeChanges.from, targetState); - var originalEnteringNodes = this._treeChanges.entering; - var redirectEnteringNodes = newTransition._treeChanges.entering; - // --- Re-use resolve data from original transition --- - // When redirecting from a parent state to a child state where the parent parameter values haven't changed - // (because of the redirect), the resolves fetched by the original transition are still valid in the - // redirected transition. - // - // This allows you to define a redirect on a parent state which depends on an async resolve value. - // You can wait for the resolve, then redirect to a child state based on the result. - // The redirected transition does not have to re-fetch the resolve. - // --------------------------------------------------------- - var nodeIsReloading = function (reloadState) { return function (node) { - return reloadState && node.state.includes[reloadState.name]; - }; }; - // Find any "entering" nodes in the redirect path that match the original path and aren't being reloaded - var matchingEnteringNodes = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.matching(redirectEnteringNodes, originalEnteringNodes, _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.nonDynamicParams).filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.not)(nodeIsReloading(targetState.options().reloadState))); - // Use the existing (possibly pre-resolved) resolvables for the matching entering nodes. - matchingEnteringNodes.forEach(function (node, idx) { - node.resolvables = originalEnteringNodes[idx].resolvables; - }); - return newTransition; - }; - /** @internal If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */ - Transition.prototype._changedParams = function () { - var tc = this._treeChanges; - /** Return undefined if it's not a "dynamic" transition, for the following reasons */ - // If user explicitly wants a reload - if (this._options.reload) - return undefined; - // If any states are exiting or entering - if (tc.exiting.length || tc.entering.length) - return undefined; - // If to/from path lengths differ - if (tc.to.length !== tc.from.length) - return undefined; - // If the to/from paths are different - var pathsDiffer = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.arrayTuples)(tc.to, tc.from) - .map(function (tuple) { return tuple[0].state !== tuple[1].state; }) - .reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.anyTrueR, false); - if (pathsDiffer) - return undefined; - // Find any parameter values that differ - var nodeSchemas = tc.to.map(function (node) { return node.paramSchema; }); - var _a = [tc.to, tc.from].map(function (path) { return path.map(function (x) { return x.paramValues; }); }), toValues = _a[0], fromValues = _a[1]; - var tuples = (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.arrayTuples)(nodeSchemas, toValues, fromValues); - return tuples.map(function (_a) { - var schema = _a[0], toVals = _a[1], fromVals = _a[2]; - return _params_param__WEBPACK_IMPORTED_MODULE_11__.Param.changed(schema, toVals, fromVals); - }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.unnestR, []); - }; - /** - * Returns true if the transition is dynamic. - * - * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed. - * - * @returns true if the Transition is dynamic - */ - Transition.prototype.dynamic = function () { - var changes = this._changedParams(); - return !changes ? false : changes.map(function (x) { return x.dynamic; }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.anyTrueR, false); - }; - /** - * Returns true if the transition is ignored. - * - * A transition is ignored if no states are entered nor exited, and no parameter values have changed. - * - * @returns true if the Transition is ignored. - */ - Transition.prototype.ignored = function () { - return !!this._ignoredReason(); - }; - /** @internal */ - Transition.prototype._ignoredReason = function () { - var pending = this.router.globals.transition; - var reloadState = this._options.reloadState; - var same = function (pathA, pathB) { - if (pathA.length !== pathB.length) - return false; - var matching = _path_pathUtils__WEBPACK_IMPORTED_MODULE_10__.PathUtils.matching(pathA, pathB); - return pathA.length === matching.filter(function (node) { return !reloadState || !node.state.includes[reloadState.name]; }).length; - }; - var newTC = this.treeChanges(); - var pendTC = pending && pending.treeChanges(); - if (pendTC && same(pendTC.to, newTC.to) && same(pendTC.exiting, newTC.exiting)) - return 'SameAsPending'; - if (newTC.exiting.length === 0 && newTC.entering.length === 0 && same(newTC.from, newTC.to)) - return 'SameAsCurrent'; - }; - /** - * Runs the transition - * - * This method is generally called from the [[StateService.transitionTo]] - * - * @internal - * - * @returns a promise for a successful transition. - */ - Transition.prototype.run = function () { - var _this = this; - var runAllHooks = _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.runAllHooks; - // Gets transition hooks array for the given phase - var getHooksFor = function (phase) { return _this._hookBuilder.buildHooksForPhase(phase); }; - // When the chain is complete, then resolve or reject the deferred - var transitionSuccess = function () { - _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceSuccess(_this.$to(), _this); - _this.success = true; - _this._deferred.resolve(_this.to()); - runAllHooks(getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.SUCCESS)); - }; - var transitionError = function (reason) { - _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceError(reason, _this); - _this.success = false; - _this._deferred.reject(reason); - _this._error = reason; - runAllHooks(getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.ERROR)); - }; - var runTransition = function () { - // Wait to build the RUN hook chain until the BEFORE hooks are done - // This allows a BEFORE hook to dynamically add additional RUN hooks via the Transition object. - var allRunHooks = getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.RUN); - var done = function () { return _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(undefined); }; - return _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.invokeHooks(allRunHooks, done); - }; - var startTransition = function () { - var globals = _this.router.globals; - globals.lastStartedTransitionId = _this.$id; - globals.transition = _this; - globals.transitionHistory.enqueue(_this); - _common_trace__WEBPACK_IMPORTED_MODULE_0__.trace.traceTransitionStart(_this); - return _common_coreservices__WEBPACK_IMPORTED_MODULE_1__.services.$q.when(undefined); - }; - var allBeforeHooks = getHooksFor(_interface__WEBPACK_IMPORTED_MODULE_6__.TransitionHookPhase.BEFORE); - _transitionHook__WEBPACK_IMPORTED_MODULE_7__.TransitionHook.invokeHooks(allBeforeHooks, startTransition) - .then(runTransition) - .then(transitionSuccess, transitionError); - return this.promise; - }; - /** - * Checks if the Transition is valid - * - * @returns true if the Transition is valid - */ - Transition.prototype.valid = function () { - return !this.error() || this.success !== undefined; - }; - /** - * Aborts this transition - * - * Imperative API to abort a Transition. - * This only applies to Transitions that are not yet complete. - */ - Transition.prototype.abort = function () { - // Do not set flag if the transition is already complete - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isUndefined)(this.success)) { - this._aborted = true; - } - }; - /** - * The Transition error reason. - * - * If the transition is invalid (and could not be run), returns the reason the transition is invalid. - * If the transition was valid and ran, but was not successful, returns the reason the transition failed. - * - * @returns a transition rejection explaining why the transition is invalid, or the reason the transition failed. - */ - Transition.prototype.error = function () { - var state = this.$to(); - if (state.self.abstract) { - return _rejectFactory__WEBPACK_IMPORTED_MODULE_14__.Rejection.invalid("Cannot transition to abstract state '" + state.name + "'"); - } - var paramDefs = state.parameters(); - var values = this.params(); - var invalidParams = paramDefs.filter(function (param) { return !param.validates(values[param.id]); }); - if (invalidParams.length) { - var invalidValues = invalidParams.map(function (param) { return "[" + param.id + ":" + (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(values[param.id]) + "]"; }).join(', '); - var detail = "The following parameter values are not valid for state '" + state.name + "': " + invalidValues; - return _rejectFactory__WEBPACK_IMPORTED_MODULE_14__.Rejection.invalid(detail); - } - if (this.success === false) - return this._error; - }; - /** - * A string representation of the Transition - * - * @returns A string representation of the Transition - */ - Transition.prototype.toString = function () { - var fromStateOrName = this.from(); - var toStateOrName = this.to(); - var avoidEmptyHash = function (params) { - return params['#'] !== null && params['#'] !== undefined ? params : (0,_common_common__WEBPACK_IMPORTED_MODULE_3__.omit)(params, ['#']); - }; - // (X) means the to state is invalid. - var id = this.$id, from = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isObject)(fromStateOrName) ? fromStateOrName.name : fromStateOrName, fromParams = (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(avoidEmptyHash(this._treeChanges.from.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_5__.prop)('paramValues')).reduce(_common_common__WEBPACK_IMPORTED_MODULE_3__.mergeR, {}))), toValid = this.valid() ? '' : '(X) ', to = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_4__.isObject)(toStateOrName) ? toStateOrName.name : toStateOrName, toParams = (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.stringify)(avoidEmptyHash(this.params())); - return "Transition#" + id + "( '" + from + "'" + fromParams + " -> " + toValid + "'" + to + "'" + toParams + " )"; - }; - /** @internal */ - Transition.diToken = Transition; - return Transition; -}()); - -//# sourceMappingURL=transition.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js": -/*!*******************************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js ***! - \*******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TransitionEventType": () => (/* binding */ TransitionEventType) -/* harmony export */ }); -/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); - -/** - * This class defines a type of hook, such as `onBefore` or `onEnter`. - * Plugins can define custom hook types, such as sticky states does for `onInactive`. - */ -var TransitionEventType = /** @class */ (function () { - /* tslint:disable:no-inferrable-types */ - function TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous) { - if (reverseSort === void 0) { reverseSort = false; } - if (getResultHandler === void 0) { getResultHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_0__.TransitionHook.HANDLE_RESULT; } - if (getErrorHandler === void 0) { getErrorHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_0__.TransitionHook.REJECT_ERROR; } - if (synchronous === void 0) { synchronous = false; } - this.name = name; - this.hookPhase = hookPhase; - this.hookOrder = hookOrder; - this.criteriaMatchPath = criteriaMatchPath; - this.reverseSort = reverseSort; - this.getResultHandler = getResultHandler; - this.getErrorHandler = getErrorHandler; - this.synchronous = synchronous; - } - return TransitionEventType; -}()); - -//# sourceMappingURL=transitionEventType.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js": -/*!**************************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js ***! - \**************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "TransitionHook": () => (/* binding */ TransitionHook) -/* harmony export */ }); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); -/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); -/* harmony import */ var _rejectFactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./rejectFactory */ "./node_modules/@uirouter/core/lib-esm/transition/rejectFactory.js"); -/* harmony import */ var _state_targetState__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../state/targetState */ "./node_modules/@uirouter/core/lib-esm/state/targetState.js"); - - - - - - - - - -var defaultOptions = { - current: _common_common__WEBPACK_IMPORTED_MODULE_1__.noop, - transition: null, - traceData: {}, - bind: null, -}; -var TransitionHook = /** @class */ (function () { - function TransitionHook(transition, stateContext, registeredHook, options) { - var _this = this; - this.transition = transition; - this.stateContext = stateContext; - this.registeredHook = registeredHook; - this.options = options; - this.isSuperseded = function () { return _this.type.hookPhase === _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookPhase.RUN && !_this.options.transition.isActive(); }; - this.options = (0,_common_common__WEBPACK_IMPORTED_MODULE_1__.defaults)(options, defaultOptions); - this.type = registeredHook.eventType; - } - /** - * Chains together an array of TransitionHooks. - * - * Given a list of [[TransitionHook]] objects, chains them together. - * Each hook is invoked after the previous one completes. - * - * #### Example: - * ```js - * var hooks: TransitionHook[] = getHooks(); - * let promise: Promise = TransitionHook.chain(hooks); - * - * promise.then(handleSuccess, handleError); - * ``` - * - * @param hooks the list of hooks to chain together - * @param waitFor if provided, the chain is `.then()`'ed off this promise - * @returns a `Promise` for sequentially invoking the hooks (in order) - */ - TransitionHook.chain = function (hooks, waitFor) { - // Chain the next hook off the previous - var createHookChainR = function (prev, nextHook) { return prev.then(function () { return nextHook.invokeHook(); }); }; - return hooks.reduce(createHookChainR, waitFor || _common_coreservices__WEBPACK_IMPORTED_MODULE_6__.services.$q.when()); - }; - /** - * Invokes all the provided TransitionHooks, in order. - * Each hook's return value is checked. - * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned. - * If no hook returns a promise, then all hooks are processed synchronously. - * - * @param hooks the list of TransitionHooks to invoke - * @param doneCallback a callback that is invoked after all the hooks have successfully completed - * - * @returns a promise for the async result, or the result of the callback - */ - TransitionHook.invokeHooks = function (hooks, doneCallback) { - for (var idx = 0; idx < hooks.length; idx++) { - var hookResult = hooks[idx].invokeHook(); - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(hookResult)) { - var remainingHooks = hooks.slice(idx + 1); - return TransitionHook.chain(remainingHooks, hookResult).then(doneCallback); - } - } - return doneCallback(); - }; - /** - * Run all TransitionHooks, ignoring their return value. - */ - TransitionHook.runAllHooks = function (hooks) { - hooks.forEach(function (hook) { return hook.invokeHook(); }); - }; - TransitionHook.prototype.logError = function (err) { - this.transition.router.stateService.defaultErrorHandler()(err); - }; - TransitionHook.prototype.invokeHook = function () { - var _this = this; - var hook = this.registeredHook; - if (hook._deregistered) - return; - var notCurrent = this.getNotCurrentRejection(); - if (notCurrent) - return notCurrent; - var options = this.options; - _common_trace__WEBPACK_IMPORTED_MODULE_5__.trace.traceHookInvocation(this, this.transition, options); - var invokeCallback = function () { return hook.callback.call(options.bind, _this.transition, _this.stateContext); }; - var normalizeErr = function (err) { return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.normalize(err).toPromise(); }; - var handleError = function (err) { return hook.eventType.getErrorHandler(_this)(err); }; - var handleResult = function (result) { return hook.eventType.getResultHandler(_this)(result); }; - try { - var result = invokeCallback(); - if (!this.type.synchronous && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(result)) { - return result.catch(normalizeErr).then(handleResult, handleError); - } - else { - return handleResult(result); - } - } - catch (err) { - // If callback throws (synchronously) - return handleError(_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.normalize(err)); - } - finally { - if (hook.invokeLimit && ++hook.invokeCount >= hook.invokeLimit) { - hook.deregister(); - } - } - }; - /** - * This method handles the return value of a Transition Hook. - * - * A hook can return false (cancel), a TargetState (redirect), - * or a promise (which may later resolve to false or a redirect) - * - * This also handles "transition superseded" -- when a new transition - * was started while the hook was still running - */ - TransitionHook.prototype.handleHookResult = function (result) { - var _this = this; - var notCurrent = this.getNotCurrentRejection(); - if (notCurrent) - return notCurrent; - // Hook returned a promise - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(result)) { - // Wait for the promise, then reprocess with the resulting value - return result.then(function (val) { return _this.handleHookResult(val); }); - } - _common_trace__WEBPACK_IMPORTED_MODULE_5__.trace.traceHookResult(result, this.transition, this.options); - // Hook returned false - if (result === false) { - // Abort this Transition - return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.aborted('Hook aborted transition').toPromise(); - } - var isTargetState = (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.is)(_state_targetState__WEBPACK_IMPORTED_MODULE_8__.TargetState); - // hook returned a TargetState - if (isTargetState(result)) { - // Halt the current Transition and redirect (a new Transition) to the TargetState. - return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.redirected(result).toPromise(); - } - }; - /** - * Return a Rejection promise if the transition is no longer current due - * to a stopped router (disposed), or a new transition has started and superseded this one. - */ - TransitionHook.prototype.getNotCurrentRejection = function () { - var router = this.transition.router; - // The router is stopped - if (router._disposed) { - return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.aborted("UIRouter instance #" + router.$id + " has been stopped (disposed)").toPromise(); - } - if (this.transition._aborted) { - return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.aborted().toPromise(); - } - // This transition is no longer current. - // Another transition started while this hook was still running. - if (this.isSuperseded()) { - // Abort this transition - return _rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.superseded(this.options.current()).toPromise(); - } - }; - TransitionHook.prototype.toString = function () { - var _a = this, options = _a.options, registeredHook = _a.registeredHook; - var event = (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.parse)('traceData.hookType')(options) || 'internal', context = (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.parse)('traceData.context.state.name')(options) || (0,_common_hof__WEBPACK_IMPORTED_MODULE_4__.parse)('traceData.context')(options) || 'unknown', name = (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.fnToString)(registeredHook.callback); - return event + " context: " + context + ", " + (0,_common_strings__WEBPACK_IMPORTED_MODULE_2__.maxLength)(200, name); - }; - /** - * These GetResultHandler(s) are used by [[invokeHook]] below - * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]]) - */ - TransitionHook.HANDLE_RESULT = function (hook) { return function (result) { - return hook.handleHookResult(result); - }; }; - /** - * If the result is a promise rejection, log it. - * Otherwise, ignore the result. - */ - TransitionHook.LOG_REJECTED_RESULT = function (hook) { return function (result) { - (0,_common_predicates__WEBPACK_IMPORTED_MODULE_3__.isPromise)(result) && result.catch(function (err) { return hook.logError(_rejectFactory__WEBPACK_IMPORTED_MODULE_7__.Rejection.normalize(err)); }); - return undefined; - }; }; - /** - * These GetErrorHandler(s) are used by [[invokeHook]] below - * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]]) - */ - TransitionHook.LOG_ERROR = function (hook) { return function (error) { return hook.logError(error); }; }; - TransitionHook.REJECT_ERROR = function (hook) { return function (error) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_1__.silentRejection)(error); }; }; - TransitionHook.THROW_ERROR = function (hook) { return function (error) { - throw error; - }; }; - return TransitionHook; -}()); - -//# sourceMappingURL=transitionHook.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/transition/transitionService.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/transition/transitionService.js ***! - \*****************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "defaultTransOpts": () => (/* binding */ defaultTransOpts), -/* harmony export */ "TransitionService": () => (/* binding */ TransitionService) -/* harmony export */ }); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/transition/interface.js"); -/* harmony import */ var _transition__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./transition */ "./node_modules/@uirouter/core/lib-esm/transition/transition.js"); -/* harmony import */ var _hookRegistry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hookRegistry */ "./node_modules/@uirouter/core/lib-esm/transition/hookRegistry.js"); -/* harmony import */ var _hooks_coreResolvables__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../hooks/coreResolvables */ "./node_modules/@uirouter/core/lib-esm/hooks/coreResolvables.js"); -/* harmony import */ var _hooks_redirectTo__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../hooks/redirectTo */ "./node_modules/@uirouter/core/lib-esm/hooks/redirectTo.js"); -/* harmony import */ var _hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../hooks/onEnterExitRetain */ "./node_modules/@uirouter/core/lib-esm/hooks/onEnterExitRetain.js"); -/* harmony import */ var _hooks_resolve__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../hooks/resolve */ "./node_modules/@uirouter/core/lib-esm/hooks/resolve.js"); -/* harmony import */ var _hooks_views__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../hooks/views */ "./node_modules/@uirouter/core/lib-esm/hooks/views.js"); -/* harmony import */ var _hooks_updateGlobals__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../hooks/updateGlobals */ "./node_modules/@uirouter/core/lib-esm/hooks/updateGlobals.js"); -/* harmony import */ var _hooks_url__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../hooks/url */ "./node_modules/@uirouter/core/lib-esm/hooks/url.js"); -/* harmony import */ var _hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../hooks/lazyLoad */ "./node_modules/@uirouter/core/lib-esm/hooks/lazyLoad.js"); -/* harmony import */ var _transitionEventType__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./transitionEventType */ "./node_modules/@uirouter/core/lib-esm/transition/transitionEventType.js"); -/* harmony import */ var _transitionHook__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./transitionHook */ "./node_modules/@uirouter/core/lib-esm/transition/transitionHook.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _hooks_ignoredTransition__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../hooks/ignoredTransition */ "./node_modules/@uirouter/core/lib-esm/hooks/ignoredTransition.js"); -/* harmony import */ var _hooks_invalidTransition__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../hooks/invalidTransition */ "./node_modules/@uirouter/core/lib-esm/hooks/invalidTransition.js"); - - - - - - - - - - - - - - - - - - -/** - * The default [[Transition]] options. - * - * Include this object when applying custom defaults: - * let reloadOpts = { reload: true, notify: true } - * let options = defaults(theirOpts, customDefaults, defaultOptions); - */ -var defaultTransOpts = { - location: true, - relative: null, - inherit: false, - notify: true, - reload: false, - supercede: true, - custom: {}, - current: function () { return null; }, - source: 'unknown', -}; -/** - * This class provides services related to Transitions. - * - * - Most importantly, it allows global Transition Hooks to be registered. - * - It allows the default transition error handler to be set. - * - It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]). - * - * At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class. - * - * This API is located at `router.transitionService` ([[UIRouter.transitionService]]) - */ -var TransitionService = /** @class */ (function () { - /** @internal */ - function TransitionService(_router) { - /** @internal */ - this._transitionCount = 0; - /** The transition hook types, such as `onEnter`, `onStart`, etc */ - this._eventTypes = []; - /** @internal The registered transition hooks */ - this._registeredHooks = {}; - /** The paths on a criteria object */ - this._criteriaPaths = {}; - this._router = _router; - this.$view = _router.viewService; - this._deregisterHookFns = {}; - this._pluginapi = ((0,_common_common__WEBPACK_IMPORTED_MODULE_14__.createProxyFunctions)((0,_common_hof__WEBPACK_IMPORTED_MODULE_15__.val)(this), {}, (0,_common_hof__WEBPACK_IMPORTED_MODULE_15__.val)(this), [ - '_definePathType', - '_defineEvent', - '_getPathTypes', - '_getEvents', - 'getHooks', - ])); - this._defineCorePaths(); - this._defineCoreEvents(); - this._registerCoreTransitionHooks(); - _router.globals.successfulTransitions.onEvict(_hooks_coreResolvables__WEBPACK_IMPORTED_MODULE_3__.treeChangesCleanup); - } - /** - * Registers a [[TransitionHookFn]], called *while a transition is being constructed*. - * - * Registers a transition lifecycle hook, which is invoked during transition construction. - * - * This low level hook should only be used by plugins. - * This can be a useful time for plugins to add resolves or mutate the transition as needed. - * The Sticky States plugin uses this hook to modify the treechanges. - * - * ### Lifecycle - * - * `onCreate` hooks are invoked *while a transition is being constructed*. - * - * ### Return value - * - * The hook's return value is ignored - * - * @internal - * @param criteria defines which Transitions the Hook should be invoked for. - * @param callback the hook function which will be invoked. - * @param options the registration options - * @returns a function which deregisters the hook. - */ - TransitionService.prototype.onCreate = function (criteria, callback, options) { - return; - }; - /** @inheritdoc */ - TransitionService.prototype.onBefore = function (criteria, callback, options) { - return; - }; - /** @inheritdoc */ - TransitionService.prototype.onStart = function (criteria, callback, options) { - return; - }; - /** @inheritdoc */ - TransitionService.prototype.onExit = function (criteria, callback, options) { - return; - }; - /** @inheritdoc */ - TransitionService.prototype.onRetain = function (criteria, callback, options) { - return; - }; - /** @inheritdoc */ - TransitionService.prototype.onEnter = function (criteria, callback, options) { - return; - }; - /** @inheritdoc */ - TransitionService.prototype.onFinish = function (criteria, callback, options) { - return; - }; - /** @inheritdoc */ - TransitionService.prototype.onSuccess = function (criteria, callback, options) { - return; - }; - /** @inheritdoc */ - TransitionService.prototype.onError = function (criteria, callback, options) { - return; - }; - /** - * dispose - * @internal - */ - TransitionService.prototype.dispose = function (router) { - (0,_common_common__WEBPACK_IMPORTED_MODULE_14__.values)(this._registeredHooks).forEach(function (hooksArray) { - return hooksArray.forEach(function (hook) { - hook._deregistered = true; - (0,_common_common__WEBPACK_IMPORTED_MODULE_14__.removeFrom)(hooksArray, hook); - }); - }); - }; - /** - * Creates a new [[Transition]] object - * - * This is a factory function for creating new Transition objects. - * It is used internally by the [[StateService]] and should generally not be called by application code. - * - * @internal - * @param fromPath the path to the current state (the from state) - * @param targetState the target state (destination) - * @returns a Transition - */ - TransitionService.prototype.create = function (fromPath, targetState) { - return new _transition__WEBPACK_IMPORTED_MODULE_1__.Transition(fromPath, targetState, this._router); - }; - /** @internal */ - TransitionService.prototype._defineCoreEvents = function () { - var Phase = _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookPhase; - var TH = _transitionHook__WEBPACK_IMPORTED_MODULE_12__.TransitionHook; - var paths = this._criteriaPaths; - var NORMAL_SORT = false, REVERSE_SORT = true; - var SYNCHRONOUS = true; - this._defineEvent('onCreate', Phase.CREATE, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.THROW_ERROR, SYNCHRONOUS); - this._defineEvent('onBefore', Phase.BEFORE, 0, paths.to); - this._defineEvent('onStart', Phase.RUN, 0, paths.to); - this._defineEvent('onExit', Phase.RUN, 100, paths.exiting, REVERSE_SORT); - this._defineEvent('onRetain', Phase.RUN, 200, paths.retained); - this._defineEvent('onEnter', Phase.RUN, 300, paths.entering); - this._defineEvent('onFinish', Phase.RUN, 400, paths.to); - this._defineEvent('onSuccess', Phase.SUCCESS, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS); - this._defineEvent('onError', Phase.ERROR, 0, paths.to, NORMAL_SORT, TH.LOG_REJECTED_RESULT, TH.LOG_ERROR, SYNCHRONOUS); - }; - /** @internal */ - TransitionService.prototype._defineCorePaths = function () { - var STATE = _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookScope.STATE, TRANSITION = _interface__WEBPACK_IMPORTED_MODULE_0__.TransitionHookScope.TRANSITION; - this._definePathType('to', TRANSITION); - this._definePathType('from', TRANSITION); - this._definePathType('exiting', STATE); - this._definePathType('retained', STATE); - this._definePathType('entering', STATE); - }; - /** @internal */ - TransitionService.prototype._defineEvent = function (name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous) { - if (reverseSort === void 0) { reverseSort = false; } - if (getResultHandler === void 0) { getResultHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_12__.TransitionHook.HANDLE_RESULT; } - if (getErrorHandler === void 0) { getErrorHandler = _transitionHook__WEBPACK_IMPORTED_MODULE_12__.TransitionHook.REJECT_ERROR; } - if (synchronous === void 0) { synchronous = false; } - var eventType = new _transitionEventType__WEBPACK_IMPORTED_MODULE_11__.TransitionEventType(name, hookPhase, hookOrder, criteriaMatchPath, reverseSort, getResultHandler, getErrorHandler, synchronous); - this._eventTypes.push(eventType); - (0,_hookRegistry__WEBPACK_IMPORTED_MODULE_2__.makeEvent)(this, this, eventType); - }; - /** @internal */ - TransitionService.prototype._getEvents = function (phase) { - var transitionHookTypes = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_13__.isDefined)(phase) - ? this._eventTypes.filter(function (type) { return type.hookPhase === phase; }) - : this._eventTypes.slice(); - return transitionHookTypes.sort(function (l, r) { - var cmpByPhase = l.hookPhase - r.hookPhase; - return cmpByPhase === 0 ? l.hookOrder - r.hookOrder : cmpByPhase; - }); - }; - /** - * Adds a Path to be used as a criterion against a TreeChanges path - * - * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path. - * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)` - * Each state in the exiting path is checked against the criteria and returned as part of the match. - * - * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path. - * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)` - * Only the tail of the `to` path is checked against the criteria and returned as part of the match. - * - * @internal - */ - TransitionService.prototype._definePathType = function (name, hookScope) { - this._criteriaPaths[name] = { name: name, scope: hookScope }; - }; - /** @internal */ - // tslint:disable-next-line - TransitionService.prototype._getPathTypes = function () { - return this._criteriaPaths; - }; - /** @internal */ - TransitionService.prototype.getHooks = function (hookName) { - return this._registeredHooks[hookName]; - }; - /** @internal */ - TransitionService.prototype._registerCoreTransitionHooks = function () { - var fns = this._deregisterHookFns; - fns.addCoreResolves = (0,_hooks_coreResolvables__WEBPACK_IMPORTED_MODULE_3__.registerAddCoreResolvables)(this); - fns.ignored = (0,_hooks_ignoredTransition__WEBPACK_IMPORTED_MODULE_16__.registerIgnoredTransitionHook)(this); - fns.invalid = (0,_hooks_invalidTransition__WEBPACK_IMPORTED_MODULE_17__.registerInvalidTransitionHook)(this); - // Wire up redirectTo hook - fns.redirectTo = (0,_hooks_redirectTo__WEBPACK_IMPORTED_MODULE_4__.registerRedirectToHook)(this); - // Wire up onExit/Retain/Enter state hooks - fns.onExit = (0,_hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.registerOnExitHook)(this); - fns.onRetain = (0,_hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.registerOnRetainHook)(this); - fns.onEnter = (0,_hooks_onEnterExitRetain__WEBPACK_IMPORTED_MODULE_5__.registerOnEnterHook)(this); - // Wire up Resolve hooks - fns.eagerResolve = (0,_hooks_resolve__WEBPACK_IMPORTED_MODULE_6__.registerEagerResolvePath)(this); - fns.lazyResolve = (0,_hooks_resolve__WEBPACK_IMPORTED_MODULE_6__.registerLazyResolveState)(this); - fns.resolveAll = (0,_hooks_resolve__WEBPACK_IMPORTED_MODULE_6__.registerResolveRemaining)(this); - // Wire up the View management hooks - fns.loadViews = (0,_hooks_views__WEBPACK_IMPORTED_MODULE_7__.registerLoadEnteringViews)(this); - fns.activateViews = (0,_hooks_views__WEBPACK_IMPORTED_MODULE_7__.registerActivateViews)(this); - // Updates global state after a transition - fns.updateGlobals = (0,_hooks_updateGlobals__WEBPACK_IMPORTED_MODULE_8__.registerUpdateGlobalState)(this); - // After globals.current is updated at priority: 10000 - fns.updateUrl = (0,_hooks_url__WEBPACK_IMPORTED_MODULE_9__.registerUpdateUrl)(this); - // Lazy load state trees - fns.lazyLoad = (0,_hooks_lazyLoad__WEBPACK_IMPORTED_MODULE_10__.registerLazyLoadHook)(this); - }; - return TransitionService; -}()); - -//# sourceMappingURL=transitionService.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/url/index.js": -/*!**********************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/url/index.js ***! - \**********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "UrlMatcher": () => (/* reexport safe */ _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher), -/* harmony export */ "ParamFactory": () => (/* reexport safe */ _urlMatcherFactory__WEBPACK_IMPORTED_MODULE_2__.ParamFactory), -/* harmony export */ "UrlMatcherFactory": () => (/* reexport safe */ _urlMatcherFactory__WEBPACK_IMPORTED_MODULE_2__.UrlMatcherFactory), -/* harmony export */ "UrlRouter": () => (/* reexport safe */ _urlRouter__WEBPACK_IMPORTED_MODULE_3__.UrlRouter), -/* harmony export */ "BaseUrlRule": () => (/* reexport safe */ _urlRule__WEBPACK_IMPORTED_MODULE_4__.BaseUrlRule), -/* harmony export */ "UrlRuleFactory": () => (/* reexport safe */ _urlRule__WEBPACK_IMPORTED_MODULE_4__.UrlRuleFactory), -/* harmony export */ "UrlService": () => (/* reexport safe */ _urlService__WEBPACK_IMPORTED_MODULE_5__.UrlService), -/* harmony export */ "UrlRules": () => (/* reexport safe */ _urlRules__WEBPACK_IMPORTED_MODULE_6__.UrlRules), -/* harmony export */ "UrlConfig": () => (/* reexport safe */ _urlConfig__WEBPACK_IMPORTED_MODULE_7__.UrlConfig) -/* harmony export */ }); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/url/interface.js"); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); -/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; -/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(["default","UrlRules","UrlConfig"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] -/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); -/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); -/* harmony import */ var _urlMatcherFactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./urlMatcherFactory */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js"); -/* harmony import */ var _urlRouter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./urlRouter */ "./node_modules/@uirouter/core/lib-esm/url/urlRouter.js"); -/* harmony import */ var _urlRule__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./urlRule */ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js"); -/* harmony import */ var _urlService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./urlService */ "./node_modules/@uirouter/core/lib-esm/url/urlService.js"); -/* harmony import */ var _urlRules__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./urlRules */ "./node_modules/@uirouter/core/lib-esm/url/urlRules.js"); -/* harmony import */ var _urlConfig__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./urlConfig */ "./node_modules/@uirouter/core/lib-esm/url/urlConfig.js"); - - - - - - - - -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/url/interface.js": -/*!**************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/url/interface.js ***! - \**************************************************************/ -/***/ (() => { - -//# sourceMappingURL=interface.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/url/urlConfig.js": -/*!**************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/url/urlConfig.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "UrlConfig": () => (/* binding */ UrlConfig) -/* harmony export */ }); -/* harmony import */ var _params__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../params */ "./node_modules/@uirouter/core/lib-esm/params/index.js"); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); - - -/** - * An API to customize the URL behavior and retrieve URL configuration - * - * This API is used to customize the behavior of the URL. - * This includes optional trailing slashes ([[strictMode]]), case sensitivity ([[caseInsensitive]]), - * and custom parameter encoding (custom [[type]]). - * - * It also has information about the location (url) configuration such as [[port]] and [[baseHref]]. - * This information can be used to build absolute URLs, such as - * `https://example.com:443/basepath/state/substate?param1=a#hashvalue`; - * - * This API is found at `router.urlService.config` (see: [[UIRouter.urlService]], [[URLService.config]]) - */ -var UrlConfig = /** @class */ (function () { - /** @internal */ function UrlConfig(/** @internal */ router) { - var _this = this; - this.router = router; - /** @internal */ this.paramTypes = new _params__WEBPACK_IMPORTED_MODULE_0__.ParamTypes(); - /** @internal */ this._decodeParams = true; - /** @internal */ this._isCaseInsensitive = false; - /** @internal */ this._isStrictMode = true; - /** @internal */ this._defaultSquashPolicy = false; - /** @internal */ this.dispose = function () { return _this.paramTypes.dispose(); }; - // Delegate these calls to the current LocationConfig implementation - /** - * Gets the base Href, e.g., `http://localhost/approot/` - * - * @return the application's base href - */ - this.baseHref = function () { return _this.router.locationConfig.baseHref(); }; - /** - * Gets or sets the hashPrefix - * - * This only applies when not running in [[html5Mode]] (pushstate mode) - * - * If the current url is `http://localhost/app#!/uirouter/path/#anchor`, it returns `!` which is the prefix for the "hashbang" portion. - * - * @return the hash prefix - */ - this.hashPrefix = function (newprefix) { return _this.router.locationConfig.hashPrefix(newprefix); }; - /** - * Gets the host, e.g., `localhost` - * - * @return the protocol - */ - this.host = function () { return _this.router.locationConfig.host(); }; - /** - * Returns true when running in pushstate mode - * - * @return true when running in html5 mode (pushstate mode). - */ - this.html5Mode = function () { return _this.router.locationConfig.html5Mode(); }; - /** - * Gets the port, e.g., `80` - * - * @return the port number - */ - this.port = function () { return _this.router.locationConfig.port(); }; - /** - * Gets the protocol, e.g., `http` - * - * @return the protocol - */ - this.protocol = function () { return _this.router.locationConfig.protocol(); }; - } - /** - * Defines whether URL matching should be case sensitive (the default behavior), or not. - * - * #### Example: - * ```js - * // Allow case insensitive url matches - * urlService.config.caseInsensitive(true); - * ``` - * - * @param value `false` to match URL in a case sensitive manner; otherwise `true`; - * @returns the current value of caseInsensitive - */ - UrlConfig.prototype.caseInsensitive = function (value) { - return (this._isCaseInsensitive = (0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) ? value : this._isCaseInsensitive); - }; - /** - * Sets the default behavior when generating or matching URLs with default parameter values. - * - * #### Example: - * ```js - * // Remove default parameter values from the url - * urlService.config.defaultSquashPolicy(true); - * ``` - * - * @param value A string that defines the default parameter URL squashing behavior. - * - `nosquash`: When generating an href with a default parameter value, do not squash the parameter value from the URL - * - `slash`: When generating an href with a default parameter value, squash (remove) the parameter value, and, if the - * parameter is surrounded by slashes, squash (remove) one slash from the URL - * - any other string, e.g. "~": When generating an href with a default parameter value, squash (remove) - * the parameter value from the URL and replace it with this string. - * @returns the current value of defaultSquashPolicy - */ - UrlConfig.prototype.defaultSquashPolicy = function (value) { - if ((0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) && value !== true && value !== false && !(0,_common__WEBPACK_IMPORTED_MODULE_1__.isString)(value)) - throw new Error("Invalid squash policy: " + value + ". Valid policies: false, true, arbitrary-string"); - return (this._defaultSquashPolicy = (0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) ? value : this._defaultSquashPolicy); - }; - /** - * Defines whether URLs should match trailing slashes, or not (the default behavior). - * - * #### Example: - * ```js - * // Allow optional trailing slashes - * urlService.config.strictMode(false); - * ``` - * - * @param value `false` to match trailing slashes in URLs, otherwise `true`. - * @returns the current value of strictMode - */ - UrlConfig.prototype.strictMode = function (value) { - return (this._isStrictMode = (0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(value) ? value : this._isStrictMode); - }; - /** - * Creates and registers a custom [[ParamType]] object - * - * A custom parameter type can be used to generate URLs with typed parameters or custom encoding/decoding. - * - * #### Note: Register custom types *before using them* in a state definition. - * - * #### Example: - * ```js - * // Encode object parameter as JSON string - * urlService.config.type('myjson', { - * encode: (obj) => JSON.stringify(obj), - * decode: (str) => JSON.parse(str), - * is: (val) => typeof(val) === 'object', - * pattern: /[^/]+/, - * equals: (a, b) => _.isEqual(a, b), - * }); - * ``` - * - * See [[ParamTypeDefinition]] for more examples - * - * @param name The type name. - * @param definition The type definition. See [[ParamTypeDefinition]] for information on the values accepted. - * @param definitionFn A function that is injected before the app runtime starts. - * The result of this function should be a [[ParamTypeDefinition]]. - * The result is merged into the existing `definition`. - * See [[ParamType]] for information on the values accepted. - * - * @returns if only the `name` parameter was specified: the currently registered [[ParamType]] object, or undefined - */ - UrlConfig.prototype.type = function (name, definition, definitionFn) { - var type = this.paramTypes.type(name, definition, definitionFn); - return !(0,_common__WEBPACK_IMPORTED_MODULE_1__.isDefined)(definition) ? type : this; - }; - return UrlConfig; -}()); - -//# sourceMappingURL=urlConfig.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js": -/*!***************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js ***! - \***************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "UrlMatcher": () => (/* binding */ UrlMatcher) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _params_param__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../params/param */ "./node_modules/@uirouter/core/lib-esm/params/param.js"); -/* harmony import */ var _common_strings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/strings */ "./node_modules/@uirouter/core/lib-esm/common/strings.js"); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); - - - - - - -function quoteRegExp(str, param) { - var surroundPattern = ['', ''], result = str.replace(/[\\\[\]\^$*+?.()|{}]/g, '\\$&'); - if (!param) - return result; - switch (param.squash) { - case false: - surroundPattern = ['(', ')' + (param.isOptional ? '?' : '')]; - break; - case true: - result = result.replace(/\/$/, ''); - surroundPattern = ['(?:/(', ')|/)?']; - break; - default: - surroundPattern = ["(" + param.squash + "|", ')?']; - break; - } - return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1]; -} -var memoizeTo = function (obj, _prop, fn) { return (obj[_prop] = obj[_prop] || fn()); }; -var splitOnSlash = (0,_common_strings__WEBPACK_IMPORTED_MODULE_4__.splitOnDelim)('/'); -var defaultConfig = { - state: { params: {} }, - strict: true, - caseInsensitive: true, - decodeParams: true, -}; -/** - * Matches URLs against patterns. - * - * Matches URLs against patterns and extracts named parameters from the path or the search - * part of the URL. - * - * A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query) - * parameters. Multiple search parameter names are separated by '&'. Search parameters - * do not influence whether or not a URL is matched, but their values are passed through into - * the matched parameters returned by [[UrlMatcher.exec]]. - * - * - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`) - * or colon placeholders (`/somePath/:param`). - * - * - *A parameter RegExp* may be defined for a param after a colon - * (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder. - * The regexp must match for the url to be matched. - * Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash. - * - * Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]]. - * - * - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters. - * See [[UrlMatcherFactory.type]] for more information. - * - * - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`). - * A catch-all * parameter value will contain the remainder of the URL. - * - * --- - * - * Parameter names may contain only word characters (latin letters, digits, and underscore) and - * must be unique within the pattern (across both path and search parameters). - * A path parameter matches any number of characters other than '/'. For catch-all - * placeholders the path parameter matches any number of characters. - * - * Examples: - * - * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for - * trailing slashes, and patterns have to match the entire path, not just a prefix. - * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or - * '/user/bob/details'. The second path segment will be captured as the parameter 'id'. - * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax. - * * `'/user/{id:[^/]*}'` - Same as the previous example. - * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id - * parameter consists of 1 to 8 hex digits. - * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the - * path into the parameter 'path'. - * * `'/files/*path'` - ditto. - * * `'/calendar/{start:date}'` - Matches "/calendar/2014-11-12" (because the pattern defined - * in the built-in `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start - * - */ -var UrlMatcher = /** @class */ (function () { - /** - * @param pattern The pattern to compile into a matcher. - * @param paramTypes The [[ParamTypes]] registry - * @param paramFactory A [[ParamFactory]] object - * @param config A [[UrlMatcherCompileConfig]] configuration object - */ - function UrlMatcher(pattern, paramTypes, paramFactory, config) { - var _this = this; - /** @internal */ - this._cache = { path: [this] }; - /** @internal */ - this._children = []; - /** @internal */ - this._params = []; - /** @internal */ - this._segments = []; - /** @internal */ - this._compiled = []; - this.config = config = (0,_common__WEBPACK_IMPORTED_MODULE_5__.defaults)(config, defaultConfig); - this.pattern = pattern; - // Find all placeholders and create a compiled pattern, using either classic or curly syntax: - // '*' name - // ':' name - // '{' name '}' - // '{' name ':' regexp '}' - // The regular expression is somewhat complicated due to the need to allow curly braces - // inside the regular expression. The placeholder regexp breaks down as follows: - // ([:*])([\w\[\]]+) - classic placeholder ($1 / $2) (search version has - for snake-case) - // \{([\w\[\]]+)(?:\:\s*( ... ))?\} - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case - // (?: ... | ... | ... )+ - the regexp consists of any number of atoms, an atom being either - // [^{}\\]+ - anything other than curly braces or backslash - // \\. - a backslash escape - // \{(?:[^{}\\]+|\\.)*\} - a matched set of curly braces containing other atoms - var placeholder = /([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g; - var searchPlaceholder = /([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g; - var patterns = []; - var last = 0; - var matchArray; - var checkParamErrors = function (id) { - if (!UrlMatcher.nameValidator.test(id)) - throw new Error("Invalid parameter name '" + id + "' in pattern '" + pattern + "'"); - if ((0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(_this._params, (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.propEq)('id', id))) - throw new Error("Duplicate parameter name '" + id + "' in pattern '" + pattern + "'"); - }; - // Split into static segments separated by path parameter placeholders. - // The number of segments is always 1 more than the number of parameters. - var matchDetails = function (m, isSearch) { - // IE[78] returns '' for unmatched groups instead of null - var id = m[2] || m[3]; - var regexp = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\s\\S]*' : null); - var makeRegexpType = function (str) { - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inherit)(paramTypes.type(isSearch ? 'query' : 'path'), { - pattern: new RegExp(str, _this.config.caseInsensitive ? 'i' : undefined), - }); - }; - return { - id: id, - regexp: regexp, - segment: pattern.substring(last, m.index), - type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp), - }; - }; - var details; - var segment; - // tslint:disable-next-line:no-conditional-assignment - while ((matchArray = placeholder.exec(pattern))) { - details = matchDetails(matchArray, false); - if (details.segment.indexOf('?') >= 0) - break; // we're into the search part - checkParamErrors(details.id); - this._params.push(paramFactory.fromPath(details.id, details.type, config.state)); - this._segments.push(details.segment); - patterns.push([details.segment, (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.tail)(this._params)]); - last = placeholder.lastIndex; - } - segment = pattern.substring(last); - // Find any search parameter names and remove them from the last segment - var i = segment.indexOf('?'); - if (i >= 0) { - var search = segment.substring(i); - segment = segment.substring(0, i); - if (search.length > 0) { - last = 0; - // tslint:disable-next-line:no-conditional-assignment - while ((matchArray = searchPlaceholder.exec(search))) { - details = matchDetails(matchArray, true); - checkParamErrors(details.id); - this._params.push(paramFactory.fromSearch(details.id, details.type, config.state)); - last = placeholder.lastIndex; - // check if ?& - } - } - } - this._segments.push(segment); - this._compiled = patterns.map(function (_pattern) { return quoteRegExp.apply(null, _pattern); }).concat(quoteRegExp(segment)); - } - /** @internal */ - UrlMatcher.encodeDashes = function (str) { - // Replace dashes with encoded "\-" - return encodeURIComponent(str).replace(/-/g, function (c) { return "%5C%" + c.charCodeAt(0).toString(16).toUpperCase(); }); - }; - /** @internal Given a matcher, return an array with the matcher's path segments and path params, in order */ - UrlMatcher.pathSegmentsAndParams = function (matcher) { - var staticSegments = matcher._segments; - var pathParams = matcher._params.filter(function (p) { return p.location === _params_param__WEBPACK_IMPORTED_MODULE_3__.DefType.PATH; }); - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples)(staticSegments, pathParams.concat(undefined)) - .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) - .filter(function (x) { return x !== '' && (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(x); }); - }; - /** @internal Given a matcher, return an array with the matcher's query params */ - UrlMatcher.queryParams = function (matcher) { - return matcher._params.filter(function (p) { return p.location === _params_param__WEBPACK_IMPORTED_MODULE_3__.DefType.SEARCH; }); - }; - /** - * Compare two UrlMatchers - * - * This comparison function converts a UrlMatcher into static and dynamic path segments. - * Each static path segment is a static string between a path separator (slash character). - * Each dynamic segment is a path parameter. - * - * The comparison function sorts static segments before dynamic ones. - */ - UrlMatcher.compare = function (a, b) { - /** - * Turn a UrlMatcher and all its parent matchers into an array - * of slash literals '/', string literals, and Param objects - * - * This example matcher matches strings like "/foo/:param/tail": - * var matcher = $umf.compile("/foo").append($umf.compile("/:param")).append($umf.compile("/")).append($umf.compile("tail")); - * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ] - * - * Caches the result as `matcher._cache.segments` - */ - var segments = function (matcher) { - return (matcher._cache.segments = - matcher._cache.segments || - matcher._cache.path - .map(UrlMatcher.pathSegmentsAndParams) - .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) - .reduce(_common_strings__WEBPACK_IMPORTED_MODULE_4__.joinNeighborsR, []) - .map(function (x) { return ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(x) ? splitOnSlash(x) : x); }) - .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, [])); - }; - /** - * Gets the sort weight for each segment of a UrlMatcher - * - * Caches the result as `matcher._cache.weights` - */ - var weights = function (matcher) { - return (matcher._cache.weights = - matcher._cache.weights || - segments(matcher).map(function (segment) { - // Sort slashes first, then static strings, the Params - if (segment === '/') - return 1; - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(segment)) - return 2; - if (segment instanceof _params_param__WEBPACK_IMPORTED_MODULE_3__.Param) - return 3; - })); - }; - /** - * Pads shorter array in-place (mutates) - */ - var padArrays = function (l, r, padVal) { - var len = Math.max(l.length, r.length); - while (l.length < len) - l.push(padVal); - while (r.length < len) - r.push(padVal); - }; - var weightsA = weights(a), weightsB = weights(b); - padArrays(weightsA, weightsB, 0); - var _pairs = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.arrayTuples)(weightsA, weightsB); - var cmp, i; - for (i = 0; i < _pairs.length; i++) { - cmp = _pairs[i][0] - _pairs[i][1]; - if (cmp !== 0) - return cmp; - } - return 0; - }; - /** - * Creates a new concatenated UrlMatcher - * - * Builds a new UrlMatcher by appending another UrlMatcher to this one. - * - * @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`. - */ - UrlMatcher.prototype.append = function (url) { - this._children.push(url); - url._cache = { - path: this._cache.path.concat(url), - parent: this, - pattern: null, - }; - return url; - }; - /** @internal */ - UrlMatcher.prototype.isRoot = function () { - return this._cache.path[0] === this; - }; - /** Returns the input pattern string */ - UrlMatcher.prototype.toString = function () { - return this.pattern; - }; - UrlMatcher.prototype._getDecodedParamValue = function (value, param) { - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isDefined)(value)) { - if (this.config.decodeParams && !param.type.raw) { - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(value)) { - value = value.map(function (paramValue) { return decodeURIComponent(paramValue); }); - } - else { - value = decodeURIComponent(value); - } - } - value = param.type.decode(value); - } - return param.value(value); - }; - /** - * Tests the specified url/path against this matcher. - * - * Tests if the given url matches this matcher's pattern, and returns an object containing the captured - * parameter values. Returns null if the path does not match. - * - * The returned object contains the values - * of any search parameters that are mentioned in the pattern, but their value may be null if - * they are not present in `search`. This means that search parameters are always treated - * as optional. - * - * #### Example: - * ```js - * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', { - * x: '1', q: 'hello' - * }); - * // returns { id: 'bob', q: 'hello', r: null } - * ``` - * - * @param path The URL path to match, e.g. `$location.path()`. - * @param search URL search parameters, e.g. `$location.search()`. - * @param hash URL hash e.g. `$location.hash()`. - * @param options - * - * @returns The captured parameter values. - */ - UrlMatcher.prototype.exec = function (path, search, hash, options) { - var _this = this; - if (search === void 0) { search = {}; } - if (options === void 0) { options = {}; } - var match = memoizeTo(this._cache, 'pattern', function () { - return new RegExp([ - '^', - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.unnest)(_this._cache.path.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('_compiled'))).join(''), - _this.config.strict === false ? '/?' : '', - '$', - ].join(''), _this.config.caseInsensitive ? 'i' : undefined); - }).exec(path); - if (!match) - return null; - // options = defaults(options, { isolate: false }); - var allParams = this.parameters(), pathParams = allParams.filter(function (param) { return !param.isSearch(); }), searchParams = allParams.filter(function (param) { return param.isSearch(); }), nPathSegments = this._cache.path.map(function (urlm) { return urlm._segments.length - 1; }).reduce(function (a, x) { return a + x; }), values = {}; - if (nPathSegments !== match.length - 1) - throw new Error("Unbalanced capture group in route '" + this.pattern + "'"); - function decodePathArray(paramVal) { - var reverseString = function (str) { return str.split('').reverse().join(''); }; - var unquoteDashes = function (str) { return str.replace(/\\-/g, '-'); }; - var split = reverseString(paramVal).split(/-(?!\\)/); - var allReversed = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(split, reverseString); - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(allReversed, unquoteDashes).reverse(); - } - for (var i = 0; i < nPathSegments; i++) { - var param = pathParams[i]; - var value = match[i + 1]; - // if the param value matches a pre-replace pair, replace the value before decoding. - for (var j = 0; j < param.replace.length; j++) { - if (param.replace[j].from === value) - value = param.replace[j].to; - } - if (value && param.array === true) - value = decodePathArray(value); - values[param.id] = this._getDecodedParamValue(value, param); - } - searchParams.forEach(function (param) { - var value = search[param.id]; - for (var j = 0; j < param.replace.length; j++) { - if (param.replace[j].from === value) - value = param.replace[j].to; - } - values[param.id] = _this._getDecodedParamValue(value, param); - }); - if (hash) - values['#'] = hash; - return values; - }; - /** - * @internal - * Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance. - * - * @returns {Array.} An array of [[Param]] objects. Must be treated as read-only. If the - * pattern has no parameters, an empty array is returned. - */ - UrlMatcher.prototype.parameters = function (opts) { - if (opts === void 0) { opts = {}; } - if (opts.inherit === false) - return this._params; - return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.unnest)(this._cache.path.map(function (matcher) { return matcher._params; })); - }; - /** - * @internal - * Returns a single parameter from this UrlMatcher by id - * - * @param id - * @param opts - * @returns {T|Param|any|boolean|UrlMatcher|null} - */ - UrlMatcher.prototype.parameter = function (id, opts) { - var _this = this; - if (opts === void 0) { opts = {}; } - var findParam = function () { - for (var _i = 0, _a = _this._params; _i < _a.length; _i++) { - var param = _a[_i]; - if (param.id === id) - return param; - } - }; - var parent = this._cache.parent; - return findParam() || (opts.inherit !== false && parent && parent.parameter(id, opts)) || null; - }; - /** - * Validates the input parameter values against this UrlMatcher - * - * Checks an object hash of parameters to validate their correctness according to the parameter - * types of this `UrlMatcher`. - * - * @param params The object hash of parameters to validate. - * @returns Returns `true` if `params` validates, otherwise `false`. - */ - UrlMatcher.prototype.validates = function (params) { - var validParamVal = function (param, val) { return !param || param.validates(val); }; - params = params || {}; - // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher - var paramSchema = this.parameters().filter(function (paramDef) { return params.hasOwnProperty(paramDef.id); }); - return paramSchema.map(function (paramDef) { return validParamVal(paramDef, params[paramDef.id]); }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.allTrueR, true); - }; - /** - * Given a set of parameter values, creates a URL from this UrlMatcher. - * - * Creates a URL that matches this pattern by substituting the specified values - * for the path and search parameters. - * - * #### Example: - * ```js - * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' }); - * // returns '/user/bob?q=yes' - * ``` - * - * @param values the values to substitute for the parameters in this pattern. - * @returns the formatted URL (path and optionally search part). - */ - UrlMatcher.prototype.format = function (values) { - if (values === void 0) { values = {}; } - // Build the full path of UrlMatchers (including all parent UrlMatchers) - var urlMatchers = this._cache.path; - // Extract all the static segments and Params (processed as ParamDetails) - // into an ordered array - var pathSegmentsAndParams = urlMatchers - .map(UrlMatcher.pathSegmentsAndParams) - .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) - .map(function (x) { return ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(x) ? x : getDetails(x)); }); - // Extract the query params into a separate array - var queryParams = urlMatchers - .map(UrlMatcher.queryParams) - .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) - .map(getDetails); - var isInvalid = function (param) { return param.isValid === false; }; - if (pathSegmentsAndParams.concat(queryParams).filter(isInvalid).length) { - return null; - } - /** - * Given a Param, applies the parameter value, then returns detailed information about it - */ - function getDetails(param) { - // Normalize to typed value - var value = param.value(values[param.id]); - var isValid = param.validates(value); - var isDefaultValue = param.isDefaultValue(value); - // Check if we're in squash mode for the parameter - var squash = isDefaultValue ? param.squash : false; - // Allow the Parameter's Type to encode the value - var encoded = param.type.encode(value); - return { param: param, value: value, isValid: isValid, isDefaultValue: isDefaultValue, squash: squash, encoded: encoded }; - } - // Build up the path-portion from the list of static segments and parameters - var pathString = pathSegmentsAndParams.reduce(function (acc, x) { - // The element is a static segment (a raw string); just append it - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(x)) - return acc + x; - // Otherwise, it's a ParamDetails. - var squash = x.squash, encoded = x.encoded, param = x.param; - // If squash is === true, try to remove a slash from the path - if (squash === true) - return acc.match(/\/$/) ? acc.slice(0, -1) : acc; - // If squash is a string, use the string for the param value - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(squash)) - return acc + squash; - if (squash !== false) - return acc; // ? - if (encoded == null) - return acc; - // If this parameter value is an array, encode the value using encodeDashes - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(encoded)) - return acc + (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(encoded, UrlMatcher.encodeDashes).join('-'); - // If the parameter type is "raw", then do not encodeURIComponent - if (param.raw) - return acc + encoded; - // Encode the value - return acc + encodeURIComponent(encoded); - }, ''); - // Build the query string by applying parameter values (array or regular) - // then mapping to key=value, then flattening and joining using "&" - var queryString = queryParams - .map(function (paramDetails) { - var param = paramDetails.param, squash = paramDetails.squash, encoded = paramDetails.encoded, isDefaultValue = paramDetails.isDefaultValue; - if (encoded == null || (isDefaultValue && squash !== false)) - return; - if (!(0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(encoded)) - encoded = [encoded]; - if (encoded.length === 0) - return; - if (!param.raw) - encoded = (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.map)(encoded, encodeURIComponent); - return encoded.map(function (val) { return param.id + "=" + val; }); - }) - .filter(_common_common__WEBPACK_IMPORTED_MODULE_0__.identity) - .reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) - .join('&'); - // Concat the pathstring with the queryString (if exists) and the hashString (if exists) - return pathString + (queryString ? "?" + queryString : '') + (values['#'] ? '#' + values['#'] : ''); - }; - /** @internal */ - UrlMatcher.nameValidator = /^\w+([-.]+\w+)*(?:\[\])?$/; - return UrlMatcher; -}()); - -//# sourceMappingURL=urlMatcher.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/url/urlMatcherFactory.js ***! - \**********************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ParamFactory": () => (/* binding */ ParamFactory), -/* harmony export */ "UrlMatcherFactory": () => (/* binding */ UrlMatcherFactory) -/* harmony export */ }); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); -/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); -/* harmony import */ var _params__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../params */ "./node_modules/@uirouter/core/lib-esm/params/index.js"); -var __assign = (undefined && undefined.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; - - - -var ParamFactory = /** @class */ (function () { - function ParamFactory(router) { - this.router = router; - } - ParamFactory.prototype.fromConfig = function (id, type, state) { - return new _params__WEBPACK_IMPORTED_MODULE_2__.Param(id, type, _params__WEBPACK_IMPORTED_MODULE_2__.DefType.CONFIG, this.router.urlService.config, state); - }; - ParamFactory.prototype.fromPath = function (id, type, state) { - return new _params__WEBPACK_IMPORTED_MODULE_2__.Param(id, type, _params__WEBPACK_IMPORTED_MODULE_2__.DefType.PATH, this.router.urlService.config, state); - }; - ParamFactory.prototype.fromSearch = function (id, type, state) { - return new _params__WEBPACK_IMPORTED_MODULE_2__.Param(id, type, _params__WEBPACK_IMPORTED_MODULE_2__.DefType.SEARCH, this.router.urlService.config, state); - }; - return ParamFactory; -}()); - -/** - * Factory for [[UrlMatcher]] instances. - * - * The factory is available to ng1 services as - * `$urlMatcherFactory` or ng1 providers as `$urlMatcherFactoryProvider`. - */ -var UrlMatcherFactory = /** @class */ (function () { - // TODO: move implementations to UrlConfig (urlService.config) - function UrlMatcherFactory(/** @internal */ router) { - var _this = this; - this.router = router; - /** Creates a new [[Param]] for a given location (DefType) */ - this.paramFactory = new ParamFactory(this.router); - // TODO: Check if removal of this will break anything, then remove these - this.UrlMatcher = _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher; - this.Param = _params__WEBPACK_IMPORTED_MODULE_2__.Param; - /** @deprecated use [[UrlConfig.caseInsensitive]] */ - this.caseInsensitive = function (value) { return _this.router.urlService.config.caseInsensitive(value); }; - /** @deprecated use [[UrlConfig.defaultSquashPolicy]] */ - this.defaultSquashPolicy = function (value) { return _this.router.urlService.config.defaultSquashPolicy(value); }; - /** @deprecated use [[UrlConfig.strictMode]] */ - this.strictMode = function (value) { return _this.router.urlService.config.strictMode(value); }; - /** @deprecated use [[UrlConfig.type]] */ - this.type = function (name, definition, definitionFn) { - return _this.router.urlService.config.type(name, definition, definitionFn) || _this; - }; - } - /** - * Creates a [[UrlMatcher]] for the specified pattern. - * - * @param pattern The URL pattern. - * @param config The config object hash. - * @returns The UrlMatcher. - */ - UrlMatcherFactory.prototype.compile = function (pattern, config) { - var urlConfig = this.router.urlService.config; - // backward-compatible support for config.params -> config.state.params - var params = config && !config.state && config.params; - config = params ? __assign({ state: { params: params } }, config) : config; - var globalConfig = { - strict: urlConfig._isStrictMode, - caseInsensitive: urlConfig._isCaseInsensitive, - decodeParams: urlConfig._decodeParams, - }; - return new _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher(pattern, urlConfig.paramTypes, this.paramFactory, (0,_common__WEBPACK_IMPORTED_MODULE_0__.extend)(globalConfig, config)); - }; - /** - * Returns true if the specified object is a [[UrlMatcher]], or false otherwise. - * - * @param object The object to perform the type check against. - * @returns `true` if the object matches the `UrlMatcher` interface, by - * implementing all the same methods. - */ - UrlMatcherFactory.prototype.isMatcher = function (object) { - // TODO: typeof? - if (!(0,_common__WEBPACK_IMPORTED_MODULE_0__.isObject)(object)) - return false; - var result = true; - (0,_common__WEBPACK_IMPORTED_MODULE_0__.forEach)(_urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher.prototype, function (val, name) { - if ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isFunction)(val)) - result = result && (0,_common__WEBPACK_IMPORTED_MODULE_0__.isDefined)(object[name]) && (0,_common__WEBPACK_IMPORTED_MODULE_0__.isFunction)(object[name]); - }); - return result; - }; - /** @internal */ - UrlMatcherFactory.prototype.$get = function () { - var urlConfig = this.router.urlService.config; - urlConfig.paramTypes.enqueue = false; - urlConfig.paramTypes._flushTypeQueue(); - return this; - }; - return UrlMatcherFactory; -}()); - -//# sourceMappingURL=urlMatcherFactory.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/url/urlRouter.js": -/*!**************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/url/urlRouter.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "UrlRouter": () => (/* binding */ UrlRouter) -/* harmony export */ }); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); -/* harmony import */ var _urlRule__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlRule */ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js"); - - -function appendBasePath(url, isHtml5, absolute, baseHref) { - if (baseHref === '/') - return url; - if (isHtml5) - return (0,_common__WEBPACK_IMPORTED_MODULE_0__.stripLastPathElement)(baseHref) + url; - if (absolute) - return baseHref.slice(1) + url; - return url; -} -/** - * Updates URL and responds to URL changes - * - * ### Deprecation warning: - * This class is now considered to be an internal API - * Use the [[UrlService]] instead. - * For configuring URL rules, use the [[UrlRules]] which can be found as [[UrlService.rules]]. - */ -var UrlRouter = /** @class */ (function () { - /** @internal */ - function UrlRouter(/** @internal */ router) { - var _this = this; - this.router = router; - // Delegate these calls to [[UrlService]] - /** @deprecated use [[UrlService.sync]]*/ - this.sync = function (evt) { return _this.router.urlService.sync(evt); }; - /** @deprecated use [[UrlService.listen]]*/ - this.listen = function (enabled) { return _this.router.urlService.listen(enabled); }; - /** @deprecated use [[UrlService.deferIntercept]]*/ - this.deferIntercept = function (defer) { return _this.router.urlService.deferIntercept(defer); }; - /** @deprecated use [[UrlService.match]]*/ - this.match = function (urlParts) { return _this.router.urlService.match(urlParts); }; - // Delegate these calls to [[UrlRules]] - /** @deprecated use [[UrlRules.initial]]*/ - this.initial = function (handler) { - return _this.router.urlService.rules.initial(handler); - }; - /** @deprecated use [[UrlRules.otherwise]]*/ - this.otherwise = function (handler) { - return _this.router.urlService.rules.otherwise(handler); - }; - /** @deprecated use [[UrlRules.removeRule]]*/ - this.removeRule = function (rule) { return _this.router.urlService.rules.removeRule(rule); }; - /** @deprecated use [[UrlRules.rule]]*/ - this.rule = function (rule) { return _this.router.urlService.rules.rule(rule); }; - /** @deprecated use [[UrlRules.rules]]*/ - this.rules = function () { return _this.router.urlService.rules.rules(); }; - /** @deprecated use [[UrlRules.sort]]*/ - this.sort = function (compareFn) { return _this.router.urlService.rules.sort(compareFn); }; - /** @deprecated use [[UrlRules.when]]*/ - this.when = function (matcher, handler, options) { return _this.router.urlService.rules.when(matcher, handler, options); }; - this.urlRuleFactory = new _urlRule__WEBPACK_IMPORTED_MODULE_1__.UrlRuleFactory(router); - } - /** Internal API. */ - UrlRouter.prototype.update = function (read) { - var $url = this.router.locationService; - if (read) { - this.location = $url.url(); - return; - } - if ($url.url() === this.location) - return; - $url.url(this.location, true); - }; - /** - * Internal API. - * - * Pushes a new location to the browser history. - * - * @internal - * @param urlMatcher - * @param params - * @param options - */ - UrlRouter.prototype.push = function (urlMatcher, params, options) { - var replace = options && !!options.replace; - this.router.urlService.url(urlMatcher.format(params || {}), replace); - }; - /** - * Builds and returns a URL with interpolated parameters - * - * #### Example: - * ```js - * matcher = $umf.compile("/about/:person"); - * params = { person: "bob" }; - * $bob = $urlRouter.href(matcher, params); - * // $bob == "/about/bob"; - * ``` - * - * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate. - * @param params An object of parameter values to fill the matcher's required parameters. - * @param options Options object. The options are: - * - * - **`absolute`** - {boolean=false}, If true will generate an absolute url, e.g. "http://www.example.com/fullurl". - * - * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher` - */ - UrlRouter.prototype.href = function (urlMatcher, params, options) { - var url = urlMatcher.format(params); - if (url == null) - return null; - options = options || { absolute: false }; - var cfg = this.router.urlService.config; - var isHtml5 = cfg.html5Mode(); - if (!isHtml5 && url !== null) { - url = '#' + cfg.hashPrefix() + url; - } - url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref()); - if (!options.absolute || !url) { - return url; - } - var slash = !isHtml5 && url ? '/' : ''; - var cfgPort = cfg.port(); - var port = (cfgPort === 80 || cfgPort === 443 ? '' : ':' + cfgPort); - return [cfg.protocol(), '://', cfg.host(), port, slash, url].join(''); - }; - Object.defineProperty(UrlRouter.prototype, "interceptDeferred", { - /** @deprecated use [[UrlService.interceptDeferred]]*/ - get: function () { - return this.router.urlService.interceptDeferred; - }, - enumerable: false, - configurable: true - }); - return UrlRouter; -}()); - -//# sourceMappingURL=urlRouter.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js": -/*!************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/url/urlRule.js ***! - \************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "UrlRuleFactory": () => (/* binding */ UrlRuleFactory), -/* harmony export */ "BaseUrlRule": () => (/* binding */ BaseUrlRule) -/* harmony export */ }); -/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _state_stateObject__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../state/stateObject */ "./node_modules/@uirouter/core/lib-esm/state/stateObject.js"); - - - - - -/** - * Creates a [[UrlRule]] - * - * Creates a [[UrlRule]] from a: - * - * - `string` - * - [[UrlMatcher]] - * - `RegExp` - * - [[StateObject]] - */ -var UrlRuleFactory = /** @class */ (function () { - function UrlRuleFactory(router) { - this.router = router; - } - UrlRuleFactory.prototype.compile = function (str) { - return this.router.urlMatcherFactory.compile(str); - }; - UrlRuleFactory.prototype.create = function (what, handler) { - var _this = this; - var isState = _state_stateObject__WEBPACK_IMPORTED_MODULE_4__.StateObject.isState, isStateDeclaration = _state_stateObject__WEBPACK_IMPORTED_MODULE_4__.StateObject.isStateDeclaration; - var makeRule = (0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.pattern)([ - [_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString, function (_what) { return makeRule(_this.compile(_what)); }], - [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(_urlMatcher__WEBPACK_IMPORTED_MODULE_0__.UrlMatcher), function (_what) { return _this.fromUrlMatcher(_what, handler); }], - [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.or)(isState, isStateDeclaration), function (_what) { return _this.fromState(_what, _this.router); }], - [(0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(RegExp), function (_what) { return _this.fromRegExp(_what, handler); }], - [_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isFunction, function (_what) { return new BaseUrlRule(_what, handler); }], - ]); - var rule = makeRule(what); - if (!rule) - throw new Error("invalid 'what' in when()"); - return rule; - }; - /** - * A UrlRule which matches based on a UrlMatcher - * - * The `handler` may be either a `string`, a [[UrlRuleHandlerFn]] or another [[UrlMatcher]] - * - * ## Handler as a function - * - * If `handler` is a function, the function is invoked with: - * - * - matched parameter values ([[RawParams]] from [[UrlMatcher.exec]]) - * - url: the current Url ([[UrlParts]]) - * - router: the router object ([[UIRouter]]) - * - * #### Example: - * ```js - * var urlMatcher = $umf.compile("/foo/:fooId/:barId"); - * var rule = factory.fromUrlMatcher(urlMatcher, match => "/home/" + match.fooId + "/" + match.barId); - * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' } - * var result = rule.handler(match); // '/home/123/456' - * ``` - * - * ## Handler as UrlMatcher - * - * If `handler` is a UrlMatcher, the handler matcher is used to create the new url. - * The `handler` UrlMatcher is formatted using the matched param from the first matcher. - * The url is replaced with the result. - * - * #### Example: - * ```js - * var urlMatcher = $umf.compile("/foo/:fooId/:barId"); - * var handler = $umf.compile("/home/:fooId/:barId"); - * var rule = factory.fromUrlMatcher(urlMatcher, handler); - * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' } - * var result = rule.handler(match); // '/home/123/456' - * ``` - */ - UrlRuleFactory.prototype.fromUrlMatcher = function (urlMatcher, handler) { - var _handler = handler; - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(handler)) - handler = this.router.urlMatcherFactory.compile(handler); - if ((0,_common_hof__WEBPACK_IMPORTED_MODULE_3__.is)(_urlMatcher__WEBPACK_IMPORTED_MODULE_0__.UrlMatcher)(handler)) - _handler = function (match) { return handler.format(match); }; - function matchUrlParamters(url) { - var params = urlMatcher.exec(url.path, url.search, url.hash); - return urlMatcher.validates(params) && params; - } - // Prioritize URLs, lowest to highest: - // - Some optional URL parameters, but none matched - // - No optional parameters in URL - // - Some optional parameters, some matched - // - Some optional parameters, all matched - function matchPriority(params) { - var optional = urlMatcher.parameters().filter(function (param) { return param.isOptional; }); - if (!optional.length) - return 0.000001; - var matched = optional.filter(function (param) { return params[param.id]; }); - return matched.length / optional.length; - } - var details = { urlMatcher: urlMatcher, matchPriority: matchPriority, type: 'URLMATCHER' }; - return (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.extend)(new BaseUrlRule(matchUrlParamters, _handler), details); - }; - /** - * A UrlRule which matches a state by its url - * - * #### Example: - * ```js - * var rule = factory.fromState($state.get('foo'), router); - * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' } - * var result = rule.handler(match); - * // Starts a transition to 'foo' with params: { fooId: '123', barId: '456' } - * ``` - */ - UrlRuleFactory.prototype.fromState = function (stateOrDecl, router) { - var state = _state_stateObject__WEBPACK_IMPORTED_MODULE_4__.StateObject.isStateDeclaration(stateOrDecl) ? stateOrDecl.$$state() : stateOrDecl; - /** - * Handles match by transitioning to matched state - * - * First checks if the router should start a new transition. - * A new transition is not required if the current state's URL - * and the new URL are already identical - */ - var handler = function (match) { - var $state = router.stateService; - var globals = router.globals; - if ($state.href(state, match) !== $state.href(globals.current, globals.params)) { - $state.transitionTo(state, match, { inherit: true, source: 'url' }); - } - }; - var details = { state: state, type: 'STATE' }; - return (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.extend)(this.fromUrlMatcher(state.url, handler), details); - }; - /** - * A UrlRule which matches based on a regular expression - * - * The `handler` may be either a [[UrlRuleHandlerFn]] or a string. - * - * ## Handler as a function - * - * If `handler` is a function, the function is invoked with: - * - * - regexp match array (from `regexp`) - * - url: the current Url ([[UrlParts]]) - * - router: the router object ([[UIRouter]]) - * - * #### Example: - * ```js - * var rule = factory.fromRegExp(/^\/foo\/(bar|baz)$/, match => "/home/" + match[1]) - * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ] - * var result = rule.handler(match); // '/home/bar' - * ``` - * - * ## Handler as string - * - * If `handler` is a string, the url is *replaced by the string* when the Rule is invoked. - * The string is first interpolated using `string.replace()` style pattern. - * - * #### Example: - * ```js - * var rule = factory.fromRegExp(/^\/foo\/(bar|baz)$/, "/home/$1") - * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ] - * var result = rule.handler(match); // '/home/bar' - * ``` - */ - UrlRuleFactory.prototype.fromRegExp = function (regexp, handler) { - if (regexp.global || regexp.sticky) - throw new Error('Rule RegExp must not be global or sticky'); - /** - * If handler is a string, the url will be replaced by the string. - * If the string has any String.replace() style variables in it (like `$2`), - * they will be replaced by the captures from [[match]] - */ - var redirectUrlTo = function (match) { - // Interpolates matched values into $1 $2, etc using a String.replace()-style pattern - return handler.replace(/\$(\$|\d{1,2})/, function (m, what) { return match[what === '$' ? 0 : Number(what)]; }); - }; - var _handler = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isString)(handler) ? redirectUrlTo : handler; - var matchParamsFromRegexp = function (url) { return regexp.exec(url.path); }; - var details = { regexp: regexp, type: 'REGEXP' }; - return (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.extend)(new BaseUrlRule(matchParamsFromRegexp, _handler), details); - }; - UrlRuleFactory.isUrlRule = function (obj) { return obj && ['type', 'match', 'handler'].every(function (key) { return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_1__.isDefined)(obj[key]); }); }; - return UrlRuleFactory; -}()); - -/** - * A base rule which calls `match` - * - * The value from the `match` function is passed through to the `handler`. - * @internal - */ -var BaseUrlRule = /** @class */ (function () { - function BaseUrlRule(match, handler) { - var _this = this; - this.match = match; - this.type = 'RAW'; - this.matchPriority = function (match) { return 0 - _this.$id; }; - this.handler = handler || _common_common__WEBPACK_IMPORTED_MODULE_2__.identity; - } - return BaseUrlRule; -}()); - -//# sourceMappingURL=urlRule.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/url/urlRules.js": -/*!*************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/url/urlRules.js ***! - \*************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "UrlRules": () => (/* binding */ UrlRules) -/* harmony export */ }); -/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../state */ "./node_modules/@uirouter/core/lib-esm/state/index.js"); -/* harmony import */ var _urlMatcher__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlMatcher */ "./node_modules/@uirouter/core/lib-esm/url/urlMatcher.js"); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); -/* harmony import */ var _urlRule__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./urlRule */ "./node_modules/@uirouter/core/lib-esm/url/urlRule.js"); - - - - -var prioritySort = function (a, b) { return (b.priority || 0) - (a.priority || 0); }; -var typeSort = function (a, b) { - var weights = { STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1 }; - return (weights[a.type] || 0) - (weights[b.type] || 0); -}; -var urlMatcherSort = function (a, b) { - return !a.urlMatcher || !b.urlMatcher ? 0 : _urlMatcher__WEBPACK_IMPORTED_MODULE_1__.UrlMatcher.compare(a.urlMatcher, b.urlMatcher); -}; -var idSort = function (a, b) { - // Identically sorted STATE and URLMATCHER best rule will be chosen by `matchPriority` after each rule matches the URL - var useMatchPriority = { STATE: true, URLMATCHER: true }; - var equal = useMatchPriority[a.type] && useMatchPriority[b.type]; - return equal ? 0 : (a.$id || 0) - (b.$id || 0); -}; -/** - * Default rule priority sorting function. - * - * Sorts rules by: - * - * - Explicit priority (set rule priority using [[UrlRules.when]]) - * - Rule type (STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1) - * - `UrlMatcher` specificity ([[UrlMatcher.compare]]): works for STATE and URLMATCHER types to pick the most specific rule. - * - Rule registration order (for rule types other than STATE and URLMATCHER) - * - Equally sorted State and UrlMatcher rules will each match the URL. - * Then, the *best* match is chosen based on how many parameter values were matched. - */ -var defaultRuleSortFn; -defaultRuleSortFn = function (a, b) { - var cmp = prioritySort(a, b); - if (cmp !== 0) - return cmp; - cmp = typeSort(a, b); - if (cmp !== 0) - return cmp; - cmp = urlMatcherSort(a, b); - if (cmp !== 0) - return cmp; - return idSort(a, b); -}; -function getHandlerFn(handler) { - if (!(0,_common__WEBPACK_IMPORTED_MODULE_2__.isFunction)(handler) && !(0,_common__WEBPACK_IMPORTED_MODULE_2__.isString)(handler) && !(0,_common__WEBPACK_IMPORTED_MODULE_2__.is)(_state__WEBPACK_IMPORTED_MODULE_0__.TargetState)(handler) && !_state__WEBPACK_IMPORTED_MODULE_0__.TargetState.isDef(handler)) { - throw new Error("'handler' must be a string, function, TargetState, or have a state: 'newtarget' property"); - } - return (0,_common__WEBPACK_IMPORTED_MODULE_2__.isFunction)(handler) ? handler : (0,_common__WEBPACK_IMPORTED_MODULE_2__.val)(handler); -} -/** - * API for managing URL rules - * - * This API is used to create and manage URL rules. - * URL rules are a mechanism to respond to specific URL patterns. - * - * The most commonly used methods are [[otherwise]] and [[when]]. - * - * This API is found at `router.urlService.rules` (see: [[UIRouter.urlService]], [[URLService.rules]]) - */ -var UrlRules = /** @class */ (function () { - /** @internal */ - function UrlRules(/** @internal */ router) { - this.router = router; - /** @internal */ this._sortFn = defaultRuleSortFn; - /** @internal */ this._rules = []; - /** @internal */ this._id = 0; - this.urlRuleFactory = new _urlRule__WEBPACK_IMPORTED_MODULE_3__.UrlRuleFactory(router); - } - /** @internal */ - UrlRules.prototype.dispose = function (router) { - this._rules = []; - delete this._otherwiseFn; - }; - /** - * Defines the initial state, path, or behavior to use when the app starts. - * - * This rule defines the initial/starting state for the application. - * - * This rule is triggered the first time the URL is checked (when the app initially loads). - * The rule is triggered only when the url matches either `""` or `"/"`. - * - * Note: The rule is intended to be used when the root of the application is directly linked to. - * When the URL is *not* `""` or `"/"` and doesn't match other rules, the [[otherwise]] rule is triggered. - * This allows 404-like behavior when an unknown URL is deep-linked. - * - * #### Example: - * Start app at `home` state. - * ```js - * .initial({ state: 'home' }); - * ``` - * - * #### Example: - * Start app at `/home` (by url) - * ```js - * .initial('/home'); - * ``` - * - * #### Example: - * When no other url rule matches, go to `home` state - * ```js - * .initial((matchValue, url, router) => { - * console.log('initial state'); - * return { state: 'home' }; - * }) - * ``` - * - * @param handler The initial state or url path, or a function which returns the state or url path (or performs custom logic). - */ - UrlRules.prototype.initial = function (handler) { - var handlerFn = getHandlerFn(handler); - var matchFn = function (urlParts, router) { - return router.globals.transitionHistory.size() === 0 && !!/^\/?$/.exec(urlParts.path); - }; - this.rule(this.urlRuleFactory.create(matchFn, handlerFn)); - }; - /** - * Defines the state, url, or behavior to use when no other rule matches the URL. - * - * This rule is matched when *no other rule* matches. - * It is generally used to handle unknown URLs (similar to "404" behavior, but on the client side). - * - * - If `handler` a string, it is treated as a url redirect - * - * #### Example: - * When no other url rule matches, redirect to `/index` - * ```js - * .otherwise('/index'); - * ``` - * - * - If `handler` is an object with a `state` property, the state is activated. - * - * #### Example: - * When no other url rule matches, redirect to `home` and provide a `dashboard` parameter value. - * ```js - * .otherwise({ state: 'home', params: { dashboard: 'default' } }); - * ``` - * - * - If `handler` is a function, the function receives the current url ([[UrlParts]]) and the [[UIRouter]] object. - * The function can perform actions, and/or return a value. - * - * #### Example: - * When no other url rule matches, manually trigger a transition to the `home` state - * ```js - * .otherwise((matchValue, urlParts, router) => { - * router.stateService.go('home'); - * }); - * ``` - * - * #### Example: - * When no other url rule matches, go to `home` state - * ```js - * .otherwise((matchValue, urlParts, router) => { - * return { state: 'home' }; - * }); - * ``` - * - * @param handler The url path to redirect to, or a function which returns the url path (or performs custom logic). - */ - UrlRules.prototype.otherwise = function (handler) { - var handlerFn = getHandlerFn(handler); - this._otherwiseFn = this.urlRuleFactory.create((0,_common__WEBPACK_IMPORTED_MODULE_2__.val)(true), handlerFn); - this._sorted = false; - }; - /** - * Remove a rule previously registered - * - * @param rule the matcher rule that was previously registered using [[rule]] - */ - UrlRules.prototype.removeRule = function (rule) { - (0,_common__WEBPACK_IMPORTED_MODULE_2__.removeFrom)(this._rules, rule); - }; - /** - * Manually adds a URL Rule. - * - * Usually, a url rule is added using [[StateDeclaration.url]] or [[when]]. - * This api can be used directly for more control (to register a [[BaseUrlRule]], for example). - * Rules can be created using [[urlRuleFactory]], or created manually as simple objects. - * - * A rule should have a `match` function which returns truthy if the rule matched. - * It should also have a `handler` function which is invoked if the rule is the best match. - * - * @return a function that deregisters the rule - */ - UrlRules.prototype.rule = function (rule) { - var _this = this; - if (!_urlRule__WEBPACK_IMPORTED_MODULE_3__.UrlRuleFactory.isUrlRule(rule)) - throw new Error('invalid rule'); - rule.$id = this._id++; - rule.priority = rule.priority || 0; - this._rules.push(rule); - this._sorted = false; - return function () { return _this.removeRule(rule); }; - }; - /** - * Gets all registered rules - * - * @returns an array of all the registered rules - */ - UrlRules.prototype.rules = function () { - this.ensureSorted(); - return this._rules.concat(this._otherwiseFn ? [this._otherwiseFn] : []); - }; - /** - * Defines URL Rule priorities - * - * More than one rule ([[UrlRule]]) might match a given URL. - * This `compareFn` is used to sort the rules by priority. - * Higher priority rules should sort earlier. - * - * The [[defaultRuleSortFn]] is used by default. - * - * You only need to call this function once. - * The `compareFn` will be used to sort the rules as each is registered. - * - * If called without any parameter, it will re-sort the rules. - * - * --- - * - * Url rules may come from multiple sources: states's urls ([[StateDeclaration.url]]), [[when]], and [[rule]]. - * Each rule has a (user-provided) [[UrlRule.priority]], a [[UrlRule.type]], and a [[UrlRule.$id]] - * The `$id` is is the order in which the rule was registered. - * - * The sort function should use these data, or data found on a specific type - * of [[UrlRule]] (such as [[StateRule.state]]), to order the rules as desired. - * - * #### Example: - * This compare function prioritizes rules by the order in which the rules were registered. - * A rule registered earlier has higher priority. - * - * ```js - * function compareFn(a, b) { - * return a.$id - b.$id; - * } - * ``` - * - * @param compareFn a function that compares to [[UrlRule]] objects. - * The `compareFn` should abide by the `Array.sort` compare function rules. - * Given two rules, `a` and `b`, return a negative number if `a` should be higher priority. - * Return a positive number if `b` should be higher priority. - * Return `0` if the rules are identical. - * - * See the [mozilla reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description) - * for details. - */ - UrlRules.prototype.sort = function (compareFn) { - var sorted = this.stableSort(this._rules, (this._sortFn = compareFn || this._sortFn)); - // precompute _sortGroup values and apply to each rule - var group = 0; - for (var i = 0; i < sorted.length; i++) { - sorted[i]._group = group; - if (i < sorted.length - 1 && this._sortFn(sorted[i], sorted[i + 1]) !== 0) { - group++; - } - } - this._rules = sorted; - this._sorted = true; - }; - /** @internal */ - UrlRules.prototype.ensureSorted = function () { - this._sorted || this.sort(); - }; - /** @internal */ - UrlRules.prototype.stableSort = function (arr, compareFn) { - var arrOfWrapper = arr.map(function (elem, idx) { return ({ elem: elem, idx: idx }); }); - arrOfWrapper.sort(function (wrapperA, wrapperB) { - var cmpDiff = compareFn(wrapperA.elem, wrapperB.elem); - return cmpDiff === 0 ? wrapperA.idx - wrapperB.idx : cmpDiff; - }); - return arrOfWrapper.map(function (wrapper) { return wrapper.elem; }); - }; - /** - * Registers a `matcher` and `handler` for custom URLs handling. - * - * The `matcher` can be: - * - * - a [[UrlMatcher]]: See: [[UrlMatcherFactory.compile]] - * - a `string`: The string is compiled to a [[UrlMatcher]] - * - a `RegExp`: The regexp is used to match the url. - * - * The `handler` can be: - * - * - a string: The url is redirected to the value of the string. - * - a function: The url is redirected to the return value of the function. - * - * --- - * - * When the `handler` is a `string` and the `matcher` is a `UrlMatcher` (or string), the redirect - * string is interpolated with parameter values. - * - * #### Example: - * When the URL is `/foo/123` the rule will redirect to `/bar/123`. - * ```js - * .when("/foo/:param1", "/bar/:param1") - * ``` - * - * --- - * - * When the `handler` is a string and the `matcher` is a `RegExp`, the redirect string is - * interpolated with capture groups from the RegExp. - * - * #### Example: - * When the URL is `/foo/123` the rule will redirect to `/bar/123`. - * ```js - * .when(new RegExp("^/foo/(.*)$"), "/bar/$1"); - * ``` - * - * --- - * - * When the handler is a function, it receives the matched value, the current URL, and the `UIRouter` object (See [[UrlRuleHandlerFn]]). - * The "matched value" differs based on the `matcher`. - * For [[UrlMatcher]]s, it will be the matched state params. - * For `RegExp`, it will be the match array from `regexp.exec()`. - * - * If the handler returns a string, the URL is redirected to the string. - * - * #### Example: - * When the URL is `/foo/123` the rule will redirect to `/bar/123`. - * ```js - * .when(new RegExp("^/foo/(.*)$"), match => "/bar/" + match[1]); - * ``` - * - * Note: the `handler` may also invoke arbitrary code, such as `$state.go()` - * - * @param matcher A pattern `string` to match, compiled as a [[UrlMatcher]], or a `RegExp`. - * @param handler The path to redirect to, or a function that returns the path. - * @param options `{ priority: number }` - * - * @return the registered [[UrlRule]] - */ - UrlRules.prototype.when = function (matcher, handler, options) { - var rule = this.urlRuleFactory.create(matcher, handler); - if ((0,_common__WEBPACK_IMPORTED_MODULE_2__.isDefined)(options && options.priority)) - rule.priority = options.priority; - this.rule(rule); - return rule; - }; - return UrlRules; -}()); - -//# sourceMappingURL=urlRules.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/url/urlService.js": -/*!***************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/url/urlService.js ***! - \***************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "UrlService": () => (/* binding */ UrlService) -/* harmony export */ }); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); -/* harmony import */ var _urlRules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./urlRules */ "./node_modules/@uirouter/core/lib-esm/url/urlRules.js"); -/* harmony import */ var _urlConfig__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./urlConfig */ "./node_modules/@uirouter/core/lib-esm/url/urlConfig.js"); -/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../state */ "./node_modules/@uirouter/core/lib-esm/state/index.js"); - - - - -/** - * API for URL management - */ -var UrlService = /** @class */ (function () { - /** @internal */ - function UrlService(/** @internal */ router) { - var _this = this; - this.router = router; - /** @internal */ this.interceptDeferred = false; - /** - * The nested [[UrlRules]] API for managing URL rules and rewrites - * - * See: [[UrlRules]] for details - */ - this.rules = new _urlRules__WEBPACK_IMPORTED_MODULE_1__.UrlRules(this.router); - /** - * The nested [[UrlConfig]] API to configure the URL and retrieve URL information - * - * See: [[UrlConfig]] for details - */ - this.config = new _urlConfig__WEBPACK_IMPORTED_MODULE_2__.UrlConfig(this.router); - // Delegate these calls to the current LocationServices implementation - /** - * Gets the current url, or updates the url - * - * ### Getting the current URL - * - * When no arguments are passed, returns the current URL. - * The URL is normalized using the internal [[path]]/[[search]]/[[hash]] values. - * - * For example, the URL may be stored in the hash ([[HashLocationServices]]) or - * have a base HREF prepended ([[PushStateLocationServices]]). - * - * The raw URL in the browser might be: - * - * ``` - * http://mysite.com/somepath/index.html#/internal/path/123?param1=foo#anchor - * ``` - * - * or - * - * ``` - * http://mysite.com/basepath/internal/path/123?param1=foo#anchor - * ``` - * - * then this method returns: - * - * ``` - * /internal/path/123?param1=foo#anchor - * ``` - * - * - * #### Example: - * ```js - * locationServices.url(); // "/some/path?query=value#anchor" - * ``` - * - * ### Updating the URL - * - * When `newurl` arguments is provided, changes the URL to reflect `newurl` - * - * #### Example: - * ```js - * locationServices.url("/some/path?query=value#anchor", true); - * ``` - * - * @param newurl The new value for the URL. - * This url should reflect only the new internal [[path]], [[search]], and [[hash]] values. - * It should not include the protocol, site, port, or base path of an absolute HREF. - * @param replace When true, replaces the current history entry (instead of appending it) with this new url - * @param state The history's state object, i.e., pushState (if the LocationServices implementation supports it) - * - * @return the url (after potentially being processed) - */ - this.url = function (newurl, replace, state) { - return _this.router.locationService.url(newurl, replace, state); - }; - /** - * Gets the path part of the current url - * - * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path` - * - * @return the path portion of the url - */ - this.path = function () { return _this.router.locationService.path(); }; - /** - * Gets the search part of the current url as an object - * - * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }` - * - * @return the search (query) portion of the url, as an object - */ - this.search = function () { return _this.router.locationService.search(); }; - /** - * Gets the hash part of the current url - * - * If the current URL is `/some/path?query=value#anchor`, this returns `anchor` - * - * @return the hash (anchor) portion of the url - */ - this.hash = function () { return _this.router.locationService.hash(); }; - /** - * @internal - * - * Registers a low level url change handler - * - * Note: Because this is a low level handler, it's not recommended for general use. - * - * #### Example: - * ```js - * let deregisterFn = locationServices.onChange((evt) => console.log("url change", evt)); - * ``` - * - * @param callback a function that will be called when the url is changing - * @return a function that de-registers the callback - */ - this.onChange = function (callback) { return _this.router.locationService.onChange(callback); }; - } - /** @internal */ - UrlService.prototype.dispose = function () { - this.listen(false); - this.rules.dispose(); - }; - /** - * Gets the current URL parts - * - * This method returns the different parts of the current URL (the [[path]], [[search]], and [[hash]]) as a [[UrlParts]] object. - */ - UrlService.prototype.parts = function () { - return { path: this.path(), search: this.search(), hash: this.hash() }; - }; - /** - * Activates the best rule for the current URL - * - * Checks the current URL for a matching [[UrlRule]], then invokes that rule's handler. - * This method is called internally any time the URL has changed. - * - * This effectively activates the state (or redirect, etc) which matches the current URL. - * - * #### Example: - * ```js - * urlService.deferIntercept(); - * - * fetch('/states.json').then(resp => resp.json()).then(data => { - * data.forEach(state => $stateRegistry.register(state)); - * urlService.listen(); - * // Find the matching URL and invoke the handler. - * urlService.sync(); - * }); - * ``` - */ - UrlService.prototype.sync = function (evt) { - if (evt && evt.defaultPrevented) - return; - var _a = this.router, urlService = _a.urlService, stateService = _a.stateService; - var url = { path: urlService.path(), search: urlService.search(), hash: urlService.hash() }; - var best = this.match(url); - var applyResult = (0,_common__WEBPACK_IMPORTED_MODULE_0__.pattern)([ - [_common__WEBPACK_IMPORTED_MODULE_0__.isString, function (newurl) { return urlService.url(newurl, true); }], - [_state__WEBPACK_IMPORTED_MODULE_3__.TargetState.isDef, function (def) { return stateService.go(def.state, def.params, def.options); }], - [(0,_common__WEBPACK_IMPORTED_MODULE_0__.is)(_state__WEBPACK_IMPORTED_MODULE_3__.TargetState), function (target) { return stateService.go(target.state(), target.params(), target.options()); }], - ]); - applyResult(best && best.rule.handler(best.match, url, this.router)); - }; - /** - * Starts or stops listening for URL changes - * - * Call this sometime after calling [[deferIntercept]] to start monitoring the url. - * This causes UI-Router to start listening for changes to the URL, if it wasn't already listening. - * - * If called with `false`, UI-Router will stop listening (call listen(true) to start listening again). - * - * #### Example: - * ```js - * urlService.deferIntercept(); - * - * fetch('/states.json').then(resp => resp.json()).then(data => { - * data.forEach(state => $stateRegistry.register(state)); - * // Start responding to URL changes - * urlService.listen(); - * urlService.sync(); - * }); - * ``` - * - * @param enabled `true` or `false` to start or stop listening to URL changes - */ - UrlService.prototype.listen = function (enabled) { - var _this = this; - if (enabled === false) { - this._stopListeningFn && this._stopListeningFn(); - delete this._stopListeningFn; - } - else { - return (this._stopListeningFn = - this._stopListeningFn || this.router.urlService.onChange(function (evt) { return _this.sync(evt); })); - } - }; - /** - * Disables monitoring of the URL. - * - * Call this method before UI-Router has bootstrapped. - * It will stop UI-Router from performing the initial url sync. - * - * This can be useful to perform some asynchronous initialization before the router starts. - * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL. - * - * #### Example: - * ```js - * // Prevent UI-Router from automatically intercepting URL changes when it starts; - * urlService.deferIntercept(); - * - * fetch('/states.json').then(resp => resp.json()).then(data => { - * data.forEach(state => $stateRegistry.register(state)); - * urlService.listen(); - * urlService.sync(); - * }); - * ``` - * - * @param defer Indicates whether to defer location change interception. - * Passing no parameter is equivalent to `true`. - */ - UrlService.prototype.deferIntercept = function (defer) { - if (defer === undefined) - defer = true; - this.interceptDeferred = defer; - }; - /** - * Matches a URL - * - * Given a URL (as a [[UrlParts]] object), check all rules and determine the best matching rule. - * Return the result as a [[MatchResult]]. - */ - UrlService.prototype.match = function (url) { - var _this = this; - url = (0,_common__WEBPACK_IMPORTED_MODULE_0__.extend)({ path: '', search: {}, hash: '' }, url); - var rules = this.rules.rules(); - // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined - var checkRule = function (rule) { - var match = rule.match(url, _this.router); - return match && { match: match, rule: rule, weight: rule.matchPriority(match) }; - }; - // The rules are pre-sorted. - // - Find the first matching rule. - // - Find any other matching rule that sorted *exactly the same*, according to `.sort()`. - // - Choose the rule with the highest match weight. - var best; - for (var i = 0; i < rules.length; i++) { - // Stop when there is a 'best' rule and the next rule sorts differently than it. - if (best && best.rule._group !== rules[i]._group) - break; - var current = checkRule(rules[i]); - // Pick the best MatchResult - best = !best || (current && current.weight > best.weight) ? current : best; - } - return best; - }; - return UrlService; -}()); - -//# sourceMappingURL=urlService.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/vanilla.js": -/*!********************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/vanilla.js ***! - \********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _vanilla_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vanilla/index */ "./node_modules/@uirouter/core/lib-esm/vanilla/index.js"); -/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; -/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _vanilla_index__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _vanilla_index__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] -/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); - -//# sourceMappingURL=vanilla.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js": -/*!****************************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js ***! - \****************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "BaseLocationServices": () => (/* binding */ BaseLocationServices) -/* harmony export */ }); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"); - - -/** A base `LocationServices` */ -var BaseLocationServices = /** @class */ (function () { - function BaseLocationServices(router, fireAfterUpdate) { - var _this = this; - this.fireAfterUpdate = fireAfterUpdate; - this._listeners = []; - this._listener = function (evt) { return _this._listeners.forEach(function (cb) { return cb(evt); }); }; - this.hash = function () { return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.parseUrl)(_this._get()).hash; }; - this.path = function () { return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.parseUrl)(_this._get()).path; }; - this.search = function () { return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.getParams)((0,_utils__WEBPACK_IMPORTED_MODULE_1__.parseUrl)(_this._get()).search); }; - this._location = _common__WEBPACK_IMPORTED_MODULE_0__.root.location; - this._history = _common__WEBPACK_IMPORTED_MODULE_0__.root.history; - } - BaseLocationServices.prototype.url = function (url, replace) { - if (replace === void 0) { replace = true; } - if ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isDefined)(url) && url !== this._get()) { - this._set(null, null, url, replace); - if (this.fireAfterUpdate) { - this._listeners.forEach(function (cb) { return cb({ url: url }); }); - } - } - return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.buildUrl)(this); - }; - BaseLocationServices.prototype.onChange = function (cb) { - var _this = this; - this._listeners.push(cb); - return function () { return (0,_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(_this._listeners, cb); }; - }; - BaseLocationServices.prototype.dispose = function (router) { - (0,_common__WEBPACK_IMPORTED_MODULE_0__.deregAll)(this._listeners); - }; - return BaseLocationServices; -}()); - -//# sourceMappingURL=baseLocationService.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "BrowserLocationConfig": () => (/* binding */ BrowserLocationConfig) -/* harmony export */ }); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); - -/** A `LocationConfig` that delegates to the browser's `location` object */ -var BrowserLocationConfig = /** @class */ (function () { - function BrowserLocationConfig(router, _isHtml5) { - if (_isHtml5 === void 0) { _isHtml5 = false; } - this._isHtml5 = _isHtml5; - this._baseHref = undefined; - this._hashPrefix = ''; - } - BrowserLocationConfig.prototype.port = function () { - if (location.port) { - return Number(location.port); - } - return this.protocol() === 'https' ? 443 : 80; - }; - BrowserLocationConfig.prototype.protocol = function () { - return location.protocol.replace(/:/g, ''); - }; - BrowserLocationConfig.prototype.host = function () { - return location.hostname; - }; - BrowserLocationConfig.prototype.html5Mode = function () { - return this._isHtml5; - }; - BrowserLocationConfig.prototype.hashPrefix = function (newprefix) { - return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isDefined)(newprefix) ? (this._hashPrefix = newprefix) : this._hashPrefix; - }; - BrowserLocationConfig.prototype.baseHref = function (href) { - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isDefined)(href)) - this._baseHref = href; - if ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isUndefined)(this._baseHref)) - this._baseHref = this.getBaseHref(); - return this._baseHref; - }; - BrowserLocationConfig.prototype.getBaseHref = function () { - var baseTag = document.getElementsByTagName('base')[0]; - if (baseTag && baseTag.href) { - return baseTag.href.replace(/^([^/:]*:)?\/\/[^/]*/, ''); - } - return this._isHtml5 ? '/' : location.pathname || '/'; - }; - BrowserLocationConfig.prototype.dispose = function () { }; - return BrowserLocationConfig; -}()); - -//# sourceMappingURL=browserLocationConfig.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js": -/*!****************************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js ***! - \****************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "HashLocationService": () => (/* binding */ HashLocationService) -/* harmony export */ }); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); -/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); - - -/** A `LocationServices` that uses the browser hash "#" to get/set the current location */ -var HashLocationService = /** @class */ (function (_super) { - __extends(HashLocationService, _super); - function HashLocationService(router) { - var _this = _super.call(this, router, false) || this; - _common__WEBPACK_IMPORTED_MODULE_0__.root.addEventListener('hashchange', _this._listener, false); - return _this; - } - HashLocationService.prototype._get = function () { - return (0,_common__WEBPACK_IMPORTED_MODULE_0__.trimHashVal)(this._location.hash); - }; - HashLocationService.prototype._set = function (state, title, url, replace) { - this._location.hash = url; - }; - HashLocationService.prototype.dispose = function (router) { - _super.prototype.dispose.call(this, router); - _common__WEBPACK_IMPORTED_MODULE_0__.root.removeEventListener('hashchange', this._listener); - }; - return HashLocationService; -}(_baseLocationService__WEBPACK_IMPORTED_MODULE_1__.BaseLocationServices)); - -//# sourceMappingURL=hashLocationService.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/index.js": -/*!**************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/vanilla/index.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "$q": () => (/* reexport safe */ _q__WEBPACK_IMPORTED_MODULE_1__.$q), -/* harmony export */ "$injector": () => (/* reexport safe */ _injector__WEBPACK_IMPORTED_MODULE_2__.$injector), -/* harmony export */ "BaseLocationServices": () => (/* reexport safe */ _baseLocationService__WEBPACK_IMPORTED_MODULE_3__.BaseLocationServices), -/* harmony export */ "HashLocationService": () => (/* reexport safe */ _hashLocationService__WEBPACK_IMPORTED_MODULE_4__.HashLocationService), -/* harmony export */ "MemoryLocationService": () => (/* reexport safe */ _memoryLocationService__WEBPACK_IMPORTED_MODULE_5__.MemoryLocationService), -/* harmony export */ "PushStateLocationService": () => (/* reexport safe */ _pushStateLocationService__WEBPACK_IMPORTED_MODULE_6__.PushStateLocationService), -/* harmony export */ "MemoryLocationConfig": () => (/* reexport safe */ _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_7__.MemoryLocationConfig), -/* harmony export */ "BrowserLocationConfig": () => (/* reexport safe */ _browserLocationConfig__WEBPACK_IMPORTED_MODULE_8__.BrowserLocationConfig), -/* harmony export */ "buildUrl": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.buildUrl), -/* harmony export */ "getParams": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.getParams), -/* harmony export */ "keyValsToObjectR": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.keyValsToObjectR), -/* harmony export */ "locationPluginFactory": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.locationPluginFactory), -/* harmony export */ "parseUrl": () => (/* reexport safe */ _utils__WEBPACK_IMPORTED_MODULE_9__.parseUrl), -/* harmony export */ "hashLocationPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.hashLocationPlugin), -/* harmony export */ "memoryLocationPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.memoryLocationPlugin), -/* harmony export */ "pushStateLocationPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.pushStateLocationPlugin), -/* harmony export */ "servicesPlugin": () => (/* reexport safe */ _plugins__WEBPACK_IMPORTED_MODULE_10__.servicesPlugin) -/* harmony export */ }); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/vanilla/interface.js"); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); -/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; -/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] -/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); -/* harmony import */ var _q__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./q */ "./node_modules/@uirouter/core/lib-esm/vanilla/q.js"); -/* harmony import */ var _injector__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./injector */ "./node_modules/@uirouter/core/lib-esm/vanilla/injector.js"); -/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); -/* harmony import */ var _hashLocationService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./hashLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js"); -/* harmony import */ var _memoryLocationService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./memoryLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js"); -/* harmony import */ var _pushStateLocationService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./pushStateLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js"); -/* harmony import */ var _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./memoryLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js"); -/* harmony import */ var _browserLocationConfig__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./browserLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js"); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils */ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"); -/* harmony import */ var _plugins__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./plugins */ "./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js"); -/** - * Naive, pure JS implementation of core ui-router services - * - * @packageDocumentation - */ - - - - - - - - - - - -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/injector.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/vanilla/injector.js ***! - \*****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "$injector": () => (/* binding */ $injector) -/* harmony export */ }); -/* harmony import */ var _common_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/index */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); - -// globally available injectables -var globals = {}; -var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm; -var ARGUMENT_NAMES = /([^\s,]+)/g; -/** - * A basic angular1-like injector api - * - * This object implements four methods similar to the - * [angular 1 dependency injector](https://docs.angularjs.org/api/auto/service/$injector) - * - * UI-Router evolved from an angular 1 library to a framework agnostic library. - * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection. - * - * This object provides a naive implementation of a globally scoped dependency injection system. - * It supports the following DI approaches: - * - * ### Function parameter names - * - * A function's `.toString()` is called, and the parameter names are parsed. - * This only works when the parameter names aren't "mangled" by a minifier such as UglifyJS. - * - * ```js - * function injectedFunction(FooService, BarService) { - * // FooService and BarService are injected - * } - * ``` - * - * ### Function annotation - * - * A function may be annotated with an array of dependency names as the `$inject` property. - * - * ```js - * injectedFunction.$inject = [ 'FooService', 'BarService' ]; - * function injectedFunction(fs, bs) { - * // FooService and BarService are injected as fs and bs parameters - * } - * ``` - * - * ### Array notation - * - * An array provides the names of the dependencies to inject (as strings). - * The function is the last element of the array. - * - * ```js - * [ 'FooService', 'BarService', function (fs, bs) { - * // FooService and BarService are injected as fs and bs parameters - * }] - * ``` - * - * @type {$InjectorLike} - */ -var $injector = { - /** Gets an object from DI based on a string token */ - get: function (name) { return globals[name]; }, - /** Returns true if an object named `name` exists in global DI */ - has: function (name) { return $injector.get(name) != null; }, - /** - * Injects a function - * - * @param fn the function to inject - * @param context the function's `this` binding - * @param locals An object with additional DI tokens and values, such as `{ someToken: { foo: 1 } }` - */ - invoke: function (fn, context, locals) { - var all = (0,_common_index__WEBPACK_IMPORTED_MODULE_0__.extend)({}, globals, locals || {}); - var params = $injector.annotate(fn); - var ensureExist = (0,_common_index__WEBPACK_IMPORTED_MODULE_0__.assertPredicate)(function (key) { return all.hasOwnProperty(key); }, function (key) { return "DI can't find injectable: '" + key + "'"; }); - var args = params.filter(ensureExist).map(function (x) { return all[x]; }); - if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isFunction)(fn)) - return fn.apply(context, args); - else - return fn.slice(-1)[0].apply(context, args); - }, - /** - * Returns a function's dependencies - * - * Analyzes a function (or array) and returns an array of DI tokens that the function requires. - * @return an array of `string`s - */ - annotate: function (fn) { - if (!(0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isInjectable)(fn)) - throw new Error("Not an injectable function: " + fn); - if (fn && fn.$inject) - return fn.$inject; - if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isArray)(fn)) - return fn.slice(0, -1); - var fnStr = fn.toString().replace(STRIP_COMMENTS, ''); - var result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES); - return result || []; - }, -}; -//# sourceMappingURL=injector.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/interface.js": -/*!******************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/vanilla/interface.js ***! - \******************************************************************/ -/***/ (() => { - -//# sourceMappingURL=interface.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js ***! - \*****************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "MemoryLocationConfig": () => (/* binding */ MemoryLocationConfig) -/* harmony export */ }); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); - - -/** A `LocationConfig` mock that gets/sets all config from an in-memory object */ -var MemoryLocationConfig = /** @class */ (function () { - function MemoryLocationConfig() { - var _this = this; - this.dispose = _common_common__WEBPACK_IMPORTED_MODULE_1__.noop; - this._baseHref = ''; - this._port = 80; - this._protocol = 'http'; - this._host = 'localhost'; - this._hashPrefix = ''; - this.port = function () { return _this._port; }; - this.protocol = function () { return _this._protocol; }; - this.host = function () { return _this._host; }; - this.baseHref = function () { return _this._baseHref; }; - this.html5Mode = function () { return false; }; - this.hashPrefix = function (newval) { return ((0,_common_predicates__WEBPACK_IMPORTED_MODULE_0__.isDefined)(newval) ? (_this._hashPrefix = newval) : _this._hashPrefix); }; - } - return MemoryLocationConfig; -}()); - -//# sourceMappingURL=memoryLocationConfig.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js": -/*!******************************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js ***! - \******************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "MemoryLocationService": () => (/* binding */ MemoryLocationService) -/* harmony export */ }); -/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); - -/** A `LocationServices` that gets/sets the current location from an in-memory object */ -var MemoryLocationService = /** @class */ (function (_super) { - __extends(MemoryLocationService, _super); - function MemoryLocationService(router) { - return _super.call(this, router, true) || this; - } - MemoryLocationService.prototype._get = function () { - return this._url; - }; - MemoryLocationService.prototype._set = function (state, title, url, replace) { - this._url = url; - }; - return MemoryLocationService; -}(_baseLocationService__WEBPACK_IMPORTED_MODULE_0__.BaseLocationServices)); - -//# sourceMappingURL=memoryLocationService.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js": -/*!****************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/vanilla/plugins.js ***! - \****************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "servicesPlugin": () => (/* binding */ servicesPlugin), -/* harmony export */ "hashLocationPlugin": () => (/* binding */ hashLocationPlugin), -/* harmony export */ "pushStateLocationPlugin": () => (/* binding */ pushStateLocationPlugin), -/* harmony export */ "memoryLocationPlugin": () => (/* binding */ memoryLocationPlugin) -/* harmony export */ }); -/* harmony import */ var _browserLocationConfig__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./browserLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/browserLocationConfig.js"); -/* harmony import */ var _hashLocationService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hashLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/hashLocationService.js"); -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js"); -/* harmony import */ var _pushStateLocationService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pushStateLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js"); -/* harmony import */ var _memoryLocationService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./memoryLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationService.js"); -/* harmony import */ var _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./memoryLocationConfig */ "./node_modules/@uirouter/core/lib-esm/vanilla/memoryLocationConfig.js"); -/* harmony import */ var _injector__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./injector */ "./node_modules/@uirouter/core/lib-esm/vanilla/injector.js"); -/* harmony import */ var _q__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./q */ "./node_modules/@uirouter/core/lib-esm/vanilla/q.js"); -/* harmony import */ var _common_coreservices__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/coreservices */ "./node_modules/@uirouter/core/lib-esm/common/coreservices.js"); - - - - - - - - - -function servicesPlugin(router) { - _common_coreservices__WEBPACK_IMPORTED_MODULE_8__.services.$injector = _injector__WEBPACK_IMPORTED_MODULE_6__.$injector; - _common_coreservices__WEBPACK_IMPORTED_MODULE_8__.services.$q = _q__WEBPACK_IMPORTED_MODULE_7__.$q; - return { name: 'vanilla.services', $q: _q__WEBPACK_IMPORTED_MODULE_7__.$q, $injector: _injector__WEBPACK_IMPORTED_MODULE_6__.$injector, dispose: function () { return null; } }; -} -/** A `UIRouterPlugin` uses the browser hash to get/set the current location */ -var hashLocationPlugin = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.locationPluginFactory)('vanilla.hashBangLocation', false, _hashLocationService__WEBPACK_IMPORTED_MODULE_1__.HashLocationService, _browserLocationConfig__WEBPACK_IMPORTED_MODULE_0__.BrowserLocationConfig); -/** A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis */ -var pushStateLocationPlugin = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.locationPluginFactory)('vanilla.pushStateLocation', true, _pushStateLocationService__WEBPACK_IMPORTED_MODULE_3__.PushStateLocationService, _browserLocationConfig__WEBPACK_IMPORTED_MODULE_0__.BrowserLocationConfig); -/** A `UIRouterPlugin` that gets/sets the current location from an in-memory object */ -var memoryLocationPlugin = (0,_utils__WEBPACK_IMPORTED_MODULE_2__.locationPluginFactory)('vanilla.memoryLocation', false, _memoryLocationService__WEBPACK_IMPORTED_MODULE_4__.MemoryLocationService, _memoryLocationConfig__WEBPACK_IMPORTED_MODULE_5__.MemoryLocationConfig); -//# sourceMappingURL=plugins.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/vanilla/pushStateLocationService.js ***! - \*********************************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "PushStateLocationService": () => (/* binding */ PushStateLocationService) -/* harmony export */ }); -/* harmony import */ var _baseLocationService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseLocationService */ "./node_modules/@uirouter/core/lib-esm/vanilla/baseLocationService.js"); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); - - -/** - * A `LocationServices` that gets/sets the current location using the browser's `location` and `history` apis - * - * Uses `history.pushState` and `history.replaceState` - */ -var PushStateLocationService = /** @class */ (function (_super) { - __extends(PushStateLocationService, _super); - function PushStateLocationService(router) { - var _this = _super.call(this, router, true) || this; - _this._config = router.urlService.config; - _common__WEBPACK_IMPORTED_MODULE_1__.root.addEventListener('popstate', _this._listener, false); - return _this; - } - /** - * Gets the base prefix without: - * - trailing slash - * - trailing filename - * - protocol and hostname - * - * If , this returns '/base'. - * If , this returns '/foo/base'. - * If , this returns '/base'. - * If , this returns '/base'. - * If , this returns ''. - * If , this returns ''. - * If , this returns ''. - * - * See: https://html.spec.whatwg.org/dev/semantics.html#the-base-element - */ - PushStateLocationService.prototype._getBasePrefix = function () { - return (0,_common__WEBPACK_IMPORTED_MODULE_1__.stripLastPathElement)(this._config.baseHref()); - }; - PushStateLocationService.prototype._get = function () { - var _a = this._location, pathname = _a.pathname, hash = _a.hash, search = _a.search; - search = (0,_common__WEBPACK_IMPORTED_MODULE_1__.splitQuery)(search)[1]; // strip ? if found - hash = (0,_common__WEBPACK_IMPORTED_MODULE_1__.splitHash)(hash)[1]; // strip # if found - var basePrefix = this._getBasePrefix(); - var exactBaseHrefMatch = pathname === this._config.baseHref(); - var startsWithBase = pathname.substr(0, basePrefix.length) === basePrefix; - pathname = exactBaseHrefMatch ? '/' : startsWithBase ? pathname.substring(basePrefix.length) : pathname; - return pathname + (search ? '?' + search : '') + (hash ? '#' + hash : ''); - }; - PushStateLocationService.prototype._set = function (state, title, url, replace) { - var basePrefix = this._getBasePrefix(); - var slash = url && url[0] !== '/' ? '/' : ''; - var fullUrl = url === '' || url === '/' ? this._config.baseHref() : basePrefix + slash + url; - if (replace) { - this._history.replaceState(state, title, fullUrl); - } - else { - this._history.pushState(state, title, fullUrl); - } - }; - PushStateLocationService.prototype.dispose = function (router) { - _super.prototype.dispose.call(this, router); - _common__WEBPACK_IMPORTED_MODULE_1__.root.removeEventListener('popstate', this._listener); - }; - return PushStateLocationService; -}(_baseLocationService__WEBPACK_IMPORTED_MODULE_0__.BaseLocationServices)); - -//# sourceMappingURL=pushStateLocationService.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/q.js": -/*!**********************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/vanilla/q.js ***! - \**********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "$q": () => (/* binding */ $q) -/* harmony export */ }); -/* harmony import */ var _common_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/index */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); - -/** - * An angular1-like promise api - * - * This object implements four methods similar to the - * [angular 1 promise api](https://docs.angularjs.org/api/ng/service/$q) - * - * UI-Router evolved from an angular 1 library to a framework agnostic library. - * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection. - * - * This API provides native ES6 promise support wrapped as a $q-like API. - * Internally, UI-Router uses this $q object to perform promise operations. - * The `angular-ui-router` (ui-router for angular 1) uses the $q API provided by angular. - * - * $q-like promise api - */ -var $q = { - /** Normalizes a value as a promise */ - when: function (val) { return new Promise(function (resolve, reject) { return resolve(val); }); }, - /** Normalizes a value as a promise rejection */ - reject: function (val) { - return new Promise(function (resolve, reject) { - reject(val); - }); - }, - /** @returns a deferred object, which has `resolve` and `reject` functions */ - defer: function () { - var deferred = {}; - deferred.promise = new Promise(function (resolve, reject) { - deferred.resolve = resolve; - deferred.reject = reject; - }); - return deferred; - }, - /** Like Promise.all(), but also supports object key/promise notation like $q */ - all: function (promises) { - if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isArray)(promises)) { - return Promise.all(promises); - } - if ((0,_common_index__WEBPACK_IMPORTED_MODULE_0__.isObject)(promises)) { - // Convert promises map to promises array. - // When each promise resolves, map it to a tuple { key: key, val: val } - var chain = Object.keys(promises).map(function (key) { return promises[key].then(function (val) { return ({ key: key, val: val }); }); }); - // Then wait for all promises to resolve, and convert them back to an object - return $q.all(chain).then(function (values) { - return values.reduce(function (acc, tuple) { - acc[tuple.key] = tuple.val; - return acc; - }, {}); - }); - } - }, -}; -//# sourceMappingURL=q.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/vanilla/utils.js": -/*!**************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/vanilla/utils.js ***! - \**************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "keyValsToObjectR": () => (/* binding */ keyValsToObjectR), -/* harmony export */ "getParams": () => (/* binding */ getParams), -/* harmony export */ "parseUrl": () => (/* binding */ parseUrl), -/* harmony export */ "buildUrl": () => (/* binding */ buildUrl), -/* harmony export */ "locationPluginFactory": () => (/* binding */ locationPluginFactory) -/* harmony export */ }); -/* harmony import */ var _common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common */ "./node_modules/@uirouter/core/lib-esm/common/index.js"); - -var keyValsToObjectR = function (accum, _a) { - var key = _a[0], val = _a[1]; - if (!accum.hasOwnProperty(key)) { - accum[key] = val; - } - else if ((0,_common__WEBPACK_IMPORTED_MODULE_0__.isArray)(accum[key])) { - accum[key].push(val); - } - else { - accum[key] = [accum[key], val]; - } - return accum; -}; -var getParams = function (queryString) { - return queryString.split('&').filter(_common__WEBPACK_IMPORTED_MODULE_0__.identity).map(_common__WEBPACK_IMPORTED_MODULE_0__.splitEqual).reduce(keyValsToObjectR, {}); -}; -function parseUrl(url) { - var orEmptyString = function (x) { return x || ''; }; - var _a = (0,_common__WEBPACK_IMPORTED_MODULE_0__.splitHash)(url).map(orEmptyString), beforehash = _a[0], hash = _a[1]; - var _b = (0,_common__WEBPACK_IMPORTED_MODULE_0__.splitQuery)(beforehash).map(orEmptyString), path = _b[0], search = _b[1]; - return { path: path, search: search, hash: hash, url: url }; -} -var buildUrl = function (loc) { - var path = loc.path(); - var searchObject = loc.search(); - var hash = loc.hash(); - var search = Object.keys(searchObject) - .map(function (key) { - var param = searchObject[key]; - var vals = (0,_common__WEBPACK_IMPORTED_MODULE_0__.isArray)(param) ? param : [param]; - return vals.map(function (val) { return key + '=' + val; }); - }) - .reduce(_common__WEBPACK_IMPORTED_MODULE_0__.unnestR, []) - .join('&'); - return path + (search ? '?' + search : '') + (hash ? '#' + hash : ''); -}; -function locationPluginFactory(name, isHtml5, serviceClass, configurationClass) { - return function (uiRouter) { - var service = (uiRouter.locationService = new serviceClass(uiRouter)); - var configuration = (uiRouter.locationConfig = new configurationClass(uiRouter, isHtml5)); - function dispose(router) { - router.dispose(service); - router.dispose(configuration); - } - return { name: name, service: service, configuration: configuration, dispose: dispose }; - }; -} -//# sourceMappingURL=utils.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/view/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/view/index.js ***! - \***********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ViewService": () => (/* reexport safe */ _view__WEBPACK_IMPORTED_MODULE_1__.ViewService) -/* harmony export */ }); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./interface */ "./node_modules/@uirouter/core/lib-esm/view/interface.js"); -/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_interface__WEBPACK_IMPORTED_MODULE_0__); -/* harmony reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {}; -/* harmony reexport (unknown) */ for(const __WEBPACK_IMPORT_KEY__ in _interface__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = () => _interface__WEBPACK_IMPORTED_MODULE_0__[__WEBPACK_IMPORT_KEY__] -/* harmony reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__); -/* harmony import */ var _view__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./view */ "./node_modules/@uirouter/core/lib-esm/view/view.js"); - - -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/view/interface.js": -/*!***************************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/view/interface.js ***! - \***************************************************************/ -/***/ (() => { - -//# sourceMappingURL=interface.js.map - -/***/ }), - -/***/ "./node_modules/@uirouter/core/lib-esm/view/view.js": -/*!**********************************************************!*\ - !*** ./node_modules/@uirouter/core/lib-esm/view/view.js ***! - \**********************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "ViewService": () => (/* binding */ ViewService) -/* harmony export */ }); -/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/common */ "./node_modules/@uirouter/core/lib-esm/common/common.js"); -/* harmony import */ var _common_hof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/hof */ "./node_modules/@uirouter/core/lib-esm/common/hof.js"); -/* harmony import */ var _common_predicates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/predicates */ "./node_modules/@uirouter/core/lib-esm/common/predicates.js"); -/* harmony import */ var _common_trace__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/trace */ "./node_modules/@uirouter/core/lib-esm/common/trace.js"); - - - - -/** - * The View service - * - * This service pairs existing `ui-view` components (which live in the DOM) - * with view configs (from the state declaration objects: [[StateDeclaration.views]]). - * - * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]]. - * The views from exited states are deactivated via [[deactivateViewConfig]]. - * (See: the [[registerActivateViews]] Transition Hook) - * - * - As `ui-view` components pop in and out of existence, they register themselves using [[registerUIView]]. - * - * - When the [[sync]] function is called, the registered `ui-view`(s) ([[ActiveUIView]]) - * are configured with the matching [[ViewConfig]](s) - * - */ -var ViewService = /** @class */ (function () { - /** @internal */ - function ViewService(/** @internal */ router) { - var _this = this; - this.router = router; - /** @internal */ this._uiViews = []; - /** @internal */ this._viewConfigs = []; - /** @internal */ this._viewConfigFactories = {}; - /** @internal */ this._listeners = []; - /** @internal */ - this._pluginapi = { - _rootViewContext: this._rootViewContext.bind(this), - _viewConfigFactory: this._viewConfigFactory.bind(this), - _registeredUIView: function (id) { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.find)(_this._uiViews, function (view) { return _this.router.$id + "." + view.id === id; }); }, - _registeredUIViews: function () { return _this._uiViews; }, - _activeViewConfigs: function () { return _this._viewConfigs; }, - _onSync: function (listener) { - _this._listeners.push(listener); - return function () { return (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(_this._listeners, listener); }; - }, - }; - } - /** - * Normalizes a view's name from a state.views configuration block. - * - * This should be used by a framework implementation to calculate the values for - * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]]. - * - * @param context the context object (state declaration) that the view belongs to - * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]] - * - * @returns the normalized uiViewName and uiViewContextAnchor that the view targets - */ - ViewService.normalizeUIViewTarget = function (context, rawViewName) { - if (rawViewName === void 0) { rawViewName = ''; } - // TODO: Validate incoming view name with a regexp to allow: - // ex: "view.name@foo.bar" , "^.^.view.name" , "view.name@^.^" , "" , - // "@" , "$default@^" , "!$default.$default" , "!foo.bar" - var viewAtContext = rawViewName.split('@'); - var uiViewName = viewAtContext[0] || '$default'; // default to unnamed view - var uiViewContextAnchor = (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isString)(viewAtContext[1]) ? viewAtContext[1] : '^'; // default to parent context - // Handle relative view-name sugar syntax. - // Matches rawViewName "^.^.^.foo.bar" into array: ["^.^.^.foo.bar", "^.^.^", "foo.bar"], - var relativeViewNameSugar = /^(\^(?:\.\^)*)\.(.*$)/.exec(uiViewName); - if (relativeViewNameSugar) { - // Clobbers existing contextAnchor (rawViewName validation will fix this) - uiViewContextAnchor = relativeViewNameSugar[1]; // set anchor to "^.^.^" - uiViewName = relativeViewNameSugar[2]; // set view-name to "foo.bar" - } - if (uiViewName.charAt(0) === '!') { - uiViewName = uiViewName.substr(1); - uiViewContextAnchor = ''; // target absolutely from root - } - // handle parent relative targeting "^.^.^" - var relativeMatch = /^(\^(?:\.\^)*)$/; - if (relativeMatch.exec(uiViewContextAnchor)) { - var anchorState = uiViewContextAnchor.split('.').reduce(function (anchor, x) { return anchor.parent; }, context); - uiViewContextAnchor = anchorState.name; - } - else if (uiViewContextAnchor === '.') { - uiViewContextAnchor = context.name; - } - return { uiViewName: uiViewName, uiViewContextAnchor: uiViewContextAnchor }; - }; - /** @internal */ - ViewService.prototype._rootViewContext = function (context) { - return (this._rootContext = context || this._rootContext); - }; - /** @internal */ - ViewService.prototype._viewConfigFactory = function (viewType, factory) { - this._viewConfigFactories[viewType] = factory; - }; - ViewService.prototype.createViewConfig = function (path, decl) { - var cfgFactory = this._viewConfigFactories[decl.$type]; - if (!cfgFactory) - throw new Error('ViewService: No view config factory registered for type ' + decl.$type); - var cfgs = cfgFactory(path, decl); - return (0,_common_predicates__WEBPACK_IMPORTED_MODULE_2__.isArray)(cfgs) ? cfgs : [cfgs]; - }; - /** - * Deactivates a ViewConfig. - * - * This function deactivates a `ViewConfig`. - * After calling [[sync]], it will un-pair from any `ui-view` with which it is currently paired. - * - * @param viewConfig The ViewConfig view to deregister. - */ - ViewService.prototype.deactivateViewConfig = function (viewConfig) { - _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceEvent('<- Removing', viewConfig); - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(this._viewConfigs, viewConfig); - }; - ViewService.prototype.activateViewConfig = function (viewConfig) { - _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceEvent('-> Registering', viewConfig); - this._viewConfigs.push(viewConfig); - }; - ViewService.prototype.sync = function () { - var _this = this; - var uiViewsByFqn = this._uiViews.map(function (uiv) { return [uiv.fqn, uiv]; }).reduce(_common_common__WEBPACK_IMPORTED_MODULE_0__.applyPairs, {}); - // Return a weighted depth value for a uiView. - // The depth is the nesting depth of ui-views (based on FQN; times 10,000) - // plus the depth of the state that is populating the uiView - function uiViewDepth(uiView) { - var stateDepth = function (context) { return (context && context.parent ? stateDepth(context.parent) + 1 : 1); }; - return uiView.fqn.split('.').length * 10000 + stateDepth(uiView.creationContext); - } - // Return the ViewConfig's context's depth in the context tree. - function viewConfigDepth(config) { - var context = config.viewDecl.$context, count = 0; - while (++count && context.parent) - context = context.parent; - return count; - } - // Given a depth function, returns a compare function which can return either ascending or descending order - var depthCompare = (0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.curry)(function (depthFn, posNeg, left, right) { return posNeg * (depthFn(left) - depthFn(right)); }); - var matchingConfigPair = function (uiView) { - var matchingConfigs = _this._viewConfigs.filter(ViewService.matches(uiViewsByFqn, uiView)); - if (matchingConfigs.length > 1) { - // This is OK. Child states can target a ui-view that the parent state also targets (the child wins) - // Sort by depth and return the match from the deepest child - // console.log(`Multiple matching view configs for ${uiView.fqn}`, matchingConfigs); - matchingConfigs.sort(depthCompare(viewConfigDepth, -1)); // descending - } - return { uiView: uiView, viewConfig: matchingConfigs[0] }; - }; - var configureUIView = function (tuple) { - // If a parent ui-view is reconfigured, it could destroy child ui-views. - // Before configuring a child ui-view, make sure it's still in the active uiViews array. - if (_this._uiViews.indexOf(tuple.uiView) !== -1) - tuple.uiView.configUpdated(tuple.viewConfig); - }; - // Sort views by FQN and state depth. Process uiviews nearest the root first. - var uiViewTuples = this._uiViews.sort(depthCompare(uiViewDepth, 1)).map(matchingConfigPair); - var matchedViewConfigs = uiViewTuples.map(function (tuple) { return tuple.viewConfig; }); - var unmatchedConfigTuples = this._viewConfigs - .filter(function (config) { return !(0,_common_common__WEBPACK_IMPORTED_MODULE_0__.inArray)(matchedViewConfigs, config); }) - .map(function (viewConfig) { return ({ uiView: undefined, viewConfig: viewConfig }); }); - uiViewTuples.forEach(configureUIView); - var allTuples = uiViewTuples.concat(unmatchedConfigTuples); - this._listeners.forEach(function (cb) { return cb(allTuples); }); - _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewSync(allTuples); - }; - /** - * Registers a `ui-view` component - * - * When a `ui-view` component is created, it uses this method to register itself. - * After registration the [[sync]] method is used to ensure all `ui-view` are configured with the proper [[ViewConfig]]. - * - * Note: the `ui-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ui-view`, - * and what the view's state context is. - * - * Note: There is no corresponding `deregisterUIView`. - * A `ui-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself. - * - * @param uiView The metadata for a UIView - * @return a de-registration function used when the view is destroyed. - */ - ViewService.prototype.registerUIView = function (uiView) { - _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('-> Registering', uiView); - var uiViews = this._uiViews; - var fqnAndTypeMatches = function (uiv) { return uiv.fqn === uiView.fqn && uiv.$type === uiView.$type; }; - if (uiViews.filter(fqnAndTypeMatches).length) - _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('!!!! duplicate uiView named:', uiView); - uiViews.push(uiView); - this.sync(); - return function () { - var idx = uiViews.indexOf(uiView); - if (idx === -1) { - _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('Tried removing non-registered uiView', uiView); - return; - } - _common_trace__WEBPACK_IMPORTED_MODULE_3__.trace.traceViewServiceUIViewEvent('<- Deregistering', uiView); - (0,_common_common__WEBPACK_IMPORTED_MODULE_0__.removeFrom)(uiViews)(uiView); - }; - }; - /** - * Returns the list of views currently available on the page, by fully-qualified name. - * - * @return {Array} Returns an array of fully-qualified view names. - */ - ViewService.prototype.available = function () { - return this._uiViews.map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('fqn')); - }; - /** - * Returns the list of views on the page containing loaded content. - * - * @return {Array} Returns an array of fully-qualified view names. - */ - ViewService.prototype.active = function () { - return this._uiViews.filter((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('$config')).map((0,_common_hof__WEBPACK_IMPORTED_MODULE_1__.prop)('name')); - }; - /** - * Given a ui-view and a ViewConfig, determines if they "match". - * - * A ui-view has a fully qualified name (fqn) and a context object. The fqn is built from its overall location in - * the DOM, describing its nesting relationship to any parent ui-view tags it is nested inside of. - * - * A ViewConfig has a target ui-view name and a context anchor. The ui-view name can be a simple name, or - * can be a segmented ui-view path, describing a portion of a ui-view fqn. - * - * In order for a ui-view to match ViewConfig, ui-view's $type must match the ViewConfig's $type - * - * If the ViewConfig's target ui-view name is a simple name (no dots), then a ui-view matches if: - * - the ui-view's name matches the ViewConfig's target name - * - the ui-view's context matches the ViewConfig's anchor - * - * If the ViewConfig's target ui-view name is a segmented name (with dots), then a ui-view matches if: - * - There exists a parent ui-view where: - * - the parent ui-view's name matches the first segment (index 0) of the ViewConfig's target name - * - the parent ui-view's context matches the ViewConfig's anchor - * - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ui-view's fqn - * - * Example: - * - * DOM: - * - * - * - * - * - * - * - * - * - * uiViews: [ - * { fqn: "$default", creationContext: { name: "" } }, - * { fqn: "$default.foo", creationContext: { name: "A" } }, - * { fqn: "$default.foo.$default", creationContext: { name: "A.B" } } - * { fqn: "$default.foo.$default.bar", creationContext: { name: "A.B.C" } } - * ] - * - * These four view configs all match the ui-view with the fqn: "$default.foo.$default.bar": - * - * - ViewConfig1: { uiViewName: "bar", uiViewContextAnchor: "A.B.C" } - * - ViewConfig2: { uiViewName: "$default.bar", uiViewContextAnchor: "A.B" } - * - ViewConfig3: { uiViewName: "foo.$default.bar", uiViewContextAnchor: "A" } - * - ViewConfig4: { uiViewName: "$default.foo.$default.bar", uiViewContextAnchor: "" } - * - * Using ViewConfig3 as an example, it matches the ui-view with fqn "$default.foo.$default.bar" because: - * - The ViewConfig's segmented target name is: [ "foo", "$default", "bar" ] - * - There exists a parent ui-view (which has fqn: "$default.foo") where: - * - the parent ui-view's name "foo" matches the first segment "foo" of the ViewConfig's target name - * - the parent ui-view's context "A" matches the ViewConfig's anchor context "A" - * - And the remaining segments [ "$default", "bar" ].join("."_ of the ViewConfig's target name match - * the tail of the ui-view's fqn "default.bar" - * - * @internal - */ - ViewService.matches = function (uiViewsByFqn, uiView) { return function (viewConfig) { - // Don't supply an ng1 ui-view with an ng2 ViewConfig, etc - if (uiView.$type !== viewConfig.viewDecl.$type) - return false; - // Split names apart from both viewConfig and uiView into segments - var vc = viewConfig.viewDecl; - var vcSegments = vc.$uiViewName.split('.'); - var uivSegments = uiView.fqn.split('.'); - // Check if the tails of the segment arrays match. ex, these arrays' tails match: - // vc: ["foo", "bar"], uiv fqn: ["$default", "foo", "bar"] - if (!(0,_common_common__WEBPACK_IMPORTED_MODULE_0__.equals)(vcSegments, uivSegments.slice(0 - vcSegments.length))) - return false; - // Now check if the fqn ending at the first segment of the viewConfig matches the context: - // ["$default", "foo"].join(".") == "$default.foo", does the ui-view $default.foo context match? - var negOffset = 1 - vcSegments.length || undefined; - var fqnToFirstSegment = uivSegments.slice(0, negOffset).join('.'); - var uiViewContext = uiViewsByFqn[fqnToFirstSegment].creationContext; - return vc.$uiViewContextAnchor === (uiViewContext && uiViewContext.name); - }; }; - return ViewService; -}()); - -//# sourceMappingURL=view.js.map - -/***/ }), - -/***/ "./node_modules/angular-animate/angular-animate.js": -/*!*********************************************************!*\ - !*** ./node_modules/angular-animate/angular-animate.js ***! - \*********************************************************/ -/***/ (() => { - -/** - * @license AngularJS v1.8.2 - * (c) 2010-2020 Google LLC. http://angularjs.org - * License: MIT - */ -(function(window, angular) {'use strict'; - -var ELEMENT_NODE = 1; -var COMMENT_NODE = 8; - -var ADD_CLASS_SUFFIX = '-add'; -var REMOVE_CLASS_SUFFIX = '-remove'; -var EVENT_CLASS_PREFIX = 'ng-'; -var ACTIVE_CLASS_SUFFIX = '-active'; -var PREPARE_CLASS_SUFFIX = '-prepare'; - -var NG_ANIMATE_CLASSNAME = 'ng-animate'; -var NG_ANIMATE_CHILDREN_DATA = '$$ngAnimateChildren'; - -// Detect proper transitionend/animationend event names. -var CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT; - -// If unprefixed events are not supported but webkit-prefixed are, use the latter. -// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them. -// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend` -// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`. -// Register both events in case `window.onanimationend` is not supported because of that, -// do the same for `transitionend` as Safari is likely to exhibit similar behavior. -// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit -// therefore there is no reason to test anymore for other vendor prefixes: -// http://caniuse.com/#search=transition -if ((window.ontransitionend === undefined) && (window.onwebkittransitionend !== undefined)) { - CSS_PREFIX = '-webkit-'; - TRANSITION_PROP = 'WebkitTransition'; - TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend'; -} else { - TRANSITION_PROP = 'transition'; - TRANSITIONEND_EVENT = 'transitionend'; -} - -if ((window.onanimationend === undefined) && (window.onwebkitanimationend !== undefined)) { - CSS_PREFIX = '-webkit-'; - ANIMATION_PROP = 'WebkitAnimation'; - ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend'; -} else { - ANIMATION_PROP = 'animation'; - ANIMATIONEND_EVENT = 'animationend'; -} - -var DURATION_KEY = 'Duration'; -var PROPERTY_KEY = 'Property'; -var DELAY_KEY = 'Delay'; -var TIMING_KEY = 'TimingFunction'; -var ANIMATION_ITERATION_COUNT_KEY = 'IterationCount'; -var ANIMATION_PLAYSTATE_KEY = 'PlayState'; -var SAFE_FAST_FORWARD_DURATION_VALUE = 9999; - -var ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY; -var ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY; -var TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY; -var TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY; - -var ngMinErr = angular.$$minErr('ng'); -function assertArg(arg, name, reason) { - if (!arg) { - throw ngMinErr('areq', 'Argument \'{0}\' is {1}', (name || '?'), (reason || 'required')); - } - return arg; -} - -function mergeClasses(a,b) { - if (!a && !b) return ''; - if (!a) return b; - if (!b) return a; - if (isArray(a)) a = a.join(' '); - if (isArray(b)) b = b.join(' '); - return a + ' ' + b; -} - -function packageStyles(options) { - var styles = {}; - if (options && (options.to || options.from)) { - styles.to = options.to; - styles.from = options.from; - } - return styles; -} - -function pendClasses(classes, fix, isPrefix) { - var className = ''; - classes = isArray(classes) - ? classes - : classes && isString(classes) && classes.length - ? classes.split(/\s+/) - : []; - forEach(classes, function(klass, i) { - if (klass && klass.length > 0) { - className += (i > 0) ? ' ' : ''; - className += isPrefix ? fix + klass - : klass + fix; - } - }); - return className; -} - -function removeFromArray(arr, val) { - var index = arr.indexOf(val); - if (val >= 0) { - arr.splice(index, 1); - } -} - -function stripCommentsFromElement(element) { - if (element instanceof jqLite) { - switch (element.length) { - case 0: - return element; - - case 1: - // there is no point of stripping anything if the element - // is the only element within the jqLite wrapper. - // (it's important that we retain the element instance.) - if (element[0].nodeType === ELEMENT_NODE) { - return element; - } - break; - - default: - return jqLite(extractElementNode(element)); - } - } - - if (element.nodeType === ELEMENT_NODE) { - return jqLite(element); - } -} - -function extractElementNode(element) { - if (!element[0]) return element; - for (var i = 0; i < element.length; i++) { - var elm = element[i]; - if (elm.nodeType === ELEMENT_NODE) { - return elm; - } - } -} - -function $$addClass($$jqLite, element, className) { - forEach(element, function(elm) { - $$jqLite.addClass(elm, className); - }); -} - -function $$removeClass($$jqLite, element, className) { - forEach(element, function(elm) { - $$jqLite.removeClass(elm, className); - }); -} - -function applyAnimationClassesFactory($$jqLite) { - return function(element, options) { - if (options.addClass) { - $$addClass($$jqLite, element, options.addClass); - options.addClass = null; - } - if (options.removeClass) { - $$removeClass($$jqLite, element, options.removeClass); - options.removeClass = null; - } - }; -} - -function prepareAnimationOptions(options) { - options = options || {}; - if (!options.$$prepared) { - var domOperation = options.domOperation || noop; - options.domOperation = function() { - options.$$domOperationFired = true; - domOperation(); - domOperation = noop; - }; - options.$$prepared = true; - } - return options; -} - -function applyAnimationStyles(element, options) { - applyAnimationFromStyles(element, options); - applyAnimationToStyles(element, options); -} - -function applyAnimationFromStyles(element, options) { - if (options.from) { - element.css(options.from); - options.from = null; - } -} - -function applyAnimationToStyles(element, options) { - if (options.to) { - element.css(options.to); - options.to = null; - } -} - -function mergeAnimationDetails(element, oldAnimation, newAnimation) { - var target = oldAnimation.options || {}; - var newOptions = newAnimation.options || {}; - - var toAdd = (target.addClass || '') + ' ' + (newOptions.addClass || ''); - var toRemove = (target.removeClass || '') + ' ' + (newOptions.removeClass || ''); - var classes = resolveElementClasses(element.attr('class'), toAdd, toRemove); - - if (newOptions.preparationClasses) { - target.preparationClasses = concatWithSpace(newOptions.preparationClasses, target.preparationClasses); - delete newOptions.preparationClasses; - } - - // noop is basically when there is no callback; otherwise something has been set - var realDomOperation = target.domOperation !== noop ? target.domOperation : null; - - extend(target, newOptions); - - // TODO(matsko or sreeramu): proper fix is to maintain all animation callback in array and call at last,but now only leave has the callback so no issue with this. - if (realDomOperation) { - target.domOperation = realDomOperation; - } - - if (classes.addClass) { - target.addClass = classes.addClass; - } else { - target.addClass = null; - } - - if (classes.removeClass) { - target.removeClass = classes.removeClass; - } else { - target.removeClass = null; - } - - oldAnimation.addClass = target.addClass; - oldAnimation.removeClass = target.removeClass; - - return target; -} - -function resolveElementClasses(existing, toAdd, toRemove) { - var ADD_CLASS = 1; - var REMOVE_CLASS = -1; - - var flags = {}; - existing = splitClassesToLookup(existing); - - toAdd = splitClassesToLookup(toAdd); - forEach(toAdd, function(value, key) { - flags[key] = ADD_CLASS; - }); - - toRemove = splitClassesToLookup(toRemove); - forEach(toRemove, function(value, key) { - flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS; - }); - - var classes = { - addClass: '', - removeClass: '' - }; - - forEach(flags, function(val, klass) { - var prop, allow; - if (val === ADD_CLASS) { - prop = 'addClass'; - allow = !existing[klass] || existing[klass + REMOVE_CLASS_SUFFIX]; - } else if (val === REMOVE_CLASS) { - prop = 'removeClass'; - allow = existing[klass] || existing[klass + ADD_CLASS_SUFFIX]; - } - if (allow) { - if (classes[prop].length) { - classes[prop] += ' '; - } - classes[prop] += klass; - } - }); - - function splitClassesToLookup(classes) { - if (isString(classes)) { - classes = classes.split(' '); - } - - var obj = {}; - forEach(classes, function(klass) { - // sometimes the split leaves empty string values - // incase extra spaces were applied to the options - if (klass.length) { - obj[klass] = true; - } - }); - return obj; - } - - return classes; -} - -function getDomNode(element) { - return (element instanceof jqLite) ? element[0] : element; -} - -function applyGeneratedPreparationClasses($$jqLite, element, event, options) { - var classes = ''; - if (event) { - classes = pendClasses(event, EVENT_CLASS_PREFIX, true); - } - if (options.addClass) { - classes = concatWithSpace(classes, pendClasses(options.addClass, ADD_CLASS_SUFFIX)); - } - if (options.removeClass) { - classes = concatWithSpace(classes, pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX)); - } - if (classes.length) { - options.preparationClasses = classes; - element.addClass(classes); - } -} - -function clearGeneratedClasses(element, options) { - if (options.preparationClasses) { - element.removeClass(options.preparationClasses); - options.preparationClasses = null; - } - if (options.activeClasses) { - element.removeClass(options.activeClasses); - options.activeClasses = null; - } -} - -function blockKeyframeAnimations(node, applyBlock) { - var value = applyBlock ? 'paused' : ''; - var key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY; - applyInlineStyle(node, [key, value]); - return [key, value]; -} - -function applyInlineStyle(node, styleTuple) { - var prop = styleTuple[0]; - var value = styleTuple[1]; - node.style[prop] = value; -} - -function concatWithSpace(a,b) { - if (!a) return b; - if (!b) return a; - return a + ' ' + b; -} - -var helpers = { - blockTransitions: function(node, duration) { - // we use a negative delay value since it performs blocking - // yet it doesn't kill any existing transitions running on the - // same element which makes this safe for class-based animations - var value = duration ? '-' + duration + 's' : ''; - applyInlineStyle(node, [TRANSITION_DELAY_PROP, value]); - return [TRANSITION_DELAY_PROP, value]; - } -}; - -var $$rAFSchedulerFactory = ['$$rAF', function($$rAF) { - var queue, cancelFn; - - function scheduler(tasks) { - // we make a copy since RAFScheduler mutates the state - // of the passed in array variable and this would be difficult - // to track down on the outside code - queue = queue.concat(tasks); - nextTick(); - } - - queue = scheduler.queue = []; - - /* waitUntilQuiet does two things: - * 1. It will run the FINAL `fn` value only when an uncanceled RAF has passed through - * 2. It will delay the next wave of tasks from running until the quiet `fn` has run. - * - * The motivation here is that animation code can request more time from the scheduler - * before the next wave runs. This allows for certain DOM properties such as classes to - * be resolved in time for the next animation to run. - */ - scheduler.waitUntilQuiet = function(fn) { - if (cancelFn) cancelFn(); - - cancelFn = $$rAF(function() { - cancelFn = null; - fn(); - nextTick(); - }); - }; - - return scheduler; - - function nextTick() { - if (!queue.length) return; - - var items = queue.shift(); - for (var i = 0; i < items.length; i++) { - items[i](); - } - - if (!cancelFn) { - $$rAF(function() { - if (!cancelFn) nextTick(); - }); - } - } -}]; - -/** - * @ngdoc directive - * @name ngAnimateChildren - * @restrict AE - * @element ANY - * - * @description - * - * ngAnimateChildren allows you to specify that children of this element should animate even if any - * of the children's parents are currently animating. By default, when an element has an active `enter`, `leave`, or `move` - * (structural) animation, child elements that also have an active structural animation are not animated. - * - * Note that even if `ngAnimateChildren` is set, no child animations will run when the parent element is removed from the DOM (`leave` animation). - * - * - * @param {string} ngAnimateChildren If the value is empty, `true` or `on`, - * then child animations are allowed. If the value is `false`, child animations are not allowed. - * - * @example - * - -
    - - -
    -
    -
    - List of items: -
    Item {{item}}
    -
    -
    -
    -
    - - - .container.ng-enter, - .container.ng-leave { - transition: all ease 1.5s; - } - - .container.ng-enter, - .container.ng-leave-active { - opacity: 0; - } - - .container.ng-leave, - .container.ng-enter-active { - opacity: 1; - } - - .item { - background: firebrick; - color: #FFF; - margin-bottom: 10px; - } - - .item.ng-enter, - .item.ng-leave { - transition: transform 1.5s ease; - } - - .item.ng-enter { - transform: translateX(50px); - } - - .item.ng-enter-active { - transform: translateX(0); - } - - - angular.module('ngAnimateChildren', ['ngAnimate']) - .controller('MainController', function MainController() { - this.animateChildren = false; - this.enterElement = false; - }); - -
    - */ -var $$AnimateChildrenDirective = ['$interpolate', function($interpolate) { - return { - link: function(scope, element, attrs) { - var val = attrs.ngAnimateChildren; - if (isString(val) && val.length === 0) { //empty attribute - element.data(NG_ANIMATE_CHILDREN_DATA, true); - } else { - // Interpolate and set the value, so that it is available to - // animations that run right after compilation - setData($interpolate(val)(scope)); - attrs.$observe('ngAnimateChildren', setData); - } - - function setData(value) { - value = value === 'on' || value === 'true'; - element.data(NG_ANIMATE_CHILDREN_DATA, value); - } - } - }; -}]; - -/* exported $AnimateCssProvider */ - -var ANIMATE_TIMER_KEY = '$$animateCss'; - -/** - * @ngdoc service - * @name $animateCss - * @kind object - * - * @description - * The `$animateCss` service is a useful utility to trigger customized CSS-based transitions/keyframes - * from a JavaScript-based animation or directly from a directive. The purpose of `$animateCss` is NOT - * to side-step how `$animate` and ngAnimate work, but the goal is to allow pre-existing animations or - * directives to create more complex animations that can be purely driven using CSS code. - * - * Note that only browsers that support CSS transitions and/or keyframe animations are capable of - * rendering animations triggered via `$animateCss` (bad news for IE9 and lower). - * - * ## General Use - * Once again, `$animateCss` is designed to be used inside of a registered JavaScript animation that - * is powered by ngAnimate. It is possible to use `$animateCss` directly inside of a directive, however, - * any automatic control over cancelling animations and/or preventing animations from being run on - * child elements will not be handled by AngularJS. For this to work as expected, please use `$animate` to - * trigger the animation and then setup a JavaScript animation that injects `$animateCss` to trigger - * the CSS animation. - * - * The example below shows how we can create a folding animation on an element using `ng-if`: - * - * ```html - * - *
    - * This element will go BOOM - *
    - * - * ``` - * - * Now we create the **JavaScript animation** that will trigger the CSS transition: - * - * ```js - * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) { - * return { - * enter: function(element, doneFn) { - * var height = element[0].offsetHeight; - * return $animateCss(element, { - * from: { height:'0px' }, - * to: { height:height + 'px' }, - * duration: 1 // one second - * }); - * } - * } - * }]); - * ``` - * - * ## More Advanced Uses - * - * `$animateCss` is the underlying code that ngAnimate uses to power **CSS-based animations** behind the scenes. Therefore CSS hooks - * like `.ng-EVENT`, `.ng-EVENT-active`, `.ng-EVENT-stagger` are all features that can be triggered using `$animateCss` via JavaScript code. - * - * This also means that just about any combination of adding classes, removing classes, setting styles, dynamically setting a keyframe animation, - * applying a hardcoded duration or delay value, changing the animation easing or applying a stagger animation are all options that work with - * `$animateCss`. The service itself is smart enough to figure out the combination of options and examine the element styling properties in order - * to provide a working animation that will run in CSS. - * - * The example below showcases a more advanced version of the `.fold-animation` from the example above: - * - * ```js - * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) { - * return { - * enter: function(element, doneFn) { - * var height = element[0].offsetHeight; - * return $animateCss(element, { - * addClass: 'red large-text pulse-twice', - * easing: 'ease-out', - * from: { height:'0px' }, - * to: { height:height + 'px' }, - * duration: 1 // one second - * }); - * } - * } - * }]); - * ``` - * - * Since we're adding/removing CSS classes then the CSS transition will also pick those up: - * - * ```css - * /* since a hardcoded duration value of 1 was provided in the JavaScript animation code, - * the CSS classes below will be transitioned despite them being defined as regular CSS classes */ - * .red { background:red; } - * .large-text { font-size:20px; } - * - * /* we can also use a keyframe animation and $animateCss will make it work alongside the transition */ - * .pulse-twice { - * animation: 0.5s pulse linear 2; - * -webkit-animation: 0.5s pulse linear 2; - * } - * - * @keyframes pulse { - * from { transform: scale(0.5); } - * to { transform: scale(1.5); } - * } - * - * @-webkit-keyframes pulse { - * from { -webkit-transform: scale(0.5); } - * to { -webkit-transform: scale(1.5); } - * } - * ``` - * - * Given this complex combination of CSS classes, styles and options, `$animateCss` will figure everything out and make the animation happen. - * - * ## How the Options are handled - * - * `$animateCss` is very versatile and intelligent when it comes to figuring out what configurations to apply to the element to ensure the animation - * works with the options provided. Say for example we were adding a class that contained a keyframe value and we wanted to also animate some inline - * styles using the `from` and `to` properties. - * - * ```js - * var animator = $animateCss(element, { - * from: { background:'red' }, - * to: { background:'blue' } - * }); - * animator.start(); - * ``` - * - * ```css - * .rotating-animation { - * animation:0.5s rotate linear; - * -webkit-animation:0.5s rotate linear; - * } - * - * @keyframes rotate { - * from { transform: rotate(0deg); } - * to { transform: rotate(360deg); } - * } - * - * @-webkit-keyframes rotate { - * from { -webkit-transform: rotate(0deg); } - * to { -webkit-transform: rotate(360deg); } - * } - * ``` - * - * The missing pieces here are that we do not have a transition set (within the CSS code nor within the `$animateCss` options) and the duration of the animation is - * going to be detected from what the keyframe styles on the CSS class are. In this event, `$animateCss` will automatically create an inline transition - * style matching the duration detected from the keyframe style (which is present in the CSS class that is being added) and then prepare both the transition - * and keyframe animations to run in parallel on the element. Then when the animation is underway the provided `from` and `to` CSS styles will be applied - * and spread across the transition and keyframe animation. - * - * ## What is returned - * - * `$animateCss` works in two stages: a preparation phase and an animation phase. Therefore when `$animateCss` is first called it will NOT actually - * start the animation. All that is going on here is that the element is being prepared for the animation (which means that the generated CSS classes are - * added and removed on the element). Once `$animateCss` is called it will return an object with the following properties: - * - * ```js - * var animator = $animateCss(element, { ... }); - * ``` - * - * Now what do the contents of our `animator` variable look like: - * - * ```js - * { - * // starts the animation - * start: Function, - * - * // ends (aborts) the animation - * end: Function - * } - * ``` - * - * To actually start the animation we need to run `animation.start()` which will then return a promise that we can hook into to detect when the animation ends. - * If we choose not to run the animation then we MUST run `animation.end()` to perform a cleanup on the element (since some CSS classes and styles may have been - * applied to the element during the preparation phase). Note that all other properties such as duration, delay, transitions and keyframes are just properties - * and that changing them will not reconfigure the parameters of the animation. - * - * ### runner.done() vs runner.then() - * It is documented that `animation.start()` will return a promise object and this is true, however, there is also an additional method available on the - * runner called `.done(callbackFn)`. The done method works the same as `.finally(callbackFn)`, however, it does **not trigger a digest to occur**. - * Therefore, for performance reasons, it's always best to use `runner.done(callback)` instead of `runner.then()`, `runner.catch()` or `runner.finally()` - * unless you really need a digest to kick off afterwards. - * - * Keep in mind that, to make this easier, ngAnimate has tweaked the JS animations API to recognize when a runner instance is returned from $animateCss - * (so there is no need to call `runner.done(doneFn)` inside of your JavaScript animation code). - * Check the {@link ngAnimate.$animateCss#usage animation code above} to see how this works. - * - * @param {DOMElement} element the element that will be animated - * @param {object} options the animation-related options that will be applied during the animation - * - * * `event` - The DOM event (e.g. enter, leave, move). When used, a generated CSS class of `ng-EVENT` and `ng-EVENT-active` will be applied - * to the element during the animation. Multiple events can be provided when spaces are used as a separator. (Note that this will not perform any DOM operation.) - * * `structural` - Indicates that the `ng-` prefix will be added to the event class. Setting to `false` or omitting will turn `ng-EVENT` and - * `ng-EVENT-active` in `EVENT` and `EVENT-active`. Unused if `event` is omitted. - * * `easing` - The CSS easing value that will be applied to the transition or keyframe animation (or both). - * * `transitionStyle` - The raw CSS transition style that will be used (e.g. `1s linear all`). - * * `keyframeStyle` - The raw CSS keyframe animation style that will be used (e.g. `1s my_animation linear`). - * * `from` - The starting CSS styles (a key/value object) that will be applied at the start of the animation. - * * `to` - The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition. - * * `addClass` - A space separated list of CSS classes that will be added to the element and spread across the animation. - * * `removeClass` - A space separated list of CSS classes that will be removed from the element and spread across the animation. - * * `duration` - A number value representing the total duration of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `0` - * is provided then the animation will be skipped entirely. - * * `delay` - A number value representing the total delay of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `true` is - * used then whatever delay value is detected from the CSS classes will be mirrored on the elements styles (e.g. by setting delay true then the style value - * of the element will be `transition-delay: DETECTED_VALUE`). Using `true` is useful when you want the CSS classes and inline styles to all share the same - * CSS delay value. - * * `stagger` - A numeric time value representing the delay between successively animated elements - * ({@link ngAnimate#css-staggering-animations Click here to learn how CSS-based staggering works in ngAnimate.}) - * * `staggerIndex` - The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item in the stagger; therefore when a - * `stagger` option value of `0.1` is used then there will be a stagger delay of `600ms`) - * * `applyClassesEarly` - Whether or not the classes being added or removed will be used when detecting the animation. This is set by `$animate` when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. (Note that this will prevent any transitions from occurring on the classes being added and removed.) - * * `cleanupStyles` - Whether or not the provided `from` and `to` styles will be removed once - * the animation is closed. This is useful for when the styles are used purely for the sake of - * the animation and do not have a lasting visual effect on the element (e.g. a collapse and open animation). - * By default this value is set to `false`. - * - * @return {object} an object with start and end methods and details about the animation. - * - * * `start` - The method to start the animation. This will return a `Promise` when called. - * * `end` - This method will cancel the animation and remove all applied CSS classes and styles. - */ -var ONE_SECOND = 1000; - -var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3; -var CLOSING_TIME_BUFFER = 1.5; - -var DETECT_CSS_PROPERTIES = { - transitionDuration: TRANSITION_DURATION_PROP, - transitionDelay: TRANSITION_DELAY_PROP, - transitionProperty: TRANSITION_PROP + PROPERTY_KEY, - animationDuration: ANIMATION_DURATION_PROP, - animationDelay: ANIMATION_DELAY_PROP, - animationIterationCount: ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY -}; - -var DETECT_STAGGER_CSS_PROPERTIES = { - transitionDuration: TRANSITION_DURATION_PROP, - transitionDelay: TRANSITION_DELAY_PROP, - animationDuration: ANIMATION_DURATION_PROP, - animationDelay: ANIMATION_DELAY_PROP -}; - -function getCssKeyframeDurationStyle(duration) { - return [ANIMATION_DURATION_PROP, duration + 's']; -} - -function getCssDelayStyle(delay, isKeyframeAnimation) { - var prop = isKeyframeAnimation ? ANIMATION_DELAY_PROP : TRANSITION_DELAY_PROP; - return [prop, delay + 's']; -} - -function computeCssStyles($window, element, properties) { - var styles = Object.create(null); - var detectedStyles = $window.getComputedStyle(element) || {}; - forEach(properties, function(formalStyleName, actualStyleName) { - var val = detectedStyles[formalStyleName]; - if (val) { - var c = val.charAt(0); - - // only numerical-based values have a negative sign or digit as the first value - if (c === '-' || c === '+' || c >= 0) { - val = parseMaxTime(val); - } - - // by setting this to null in the event that the delay is not set or is set directly as 0 - // then we can still allow for negative values to be used later on and not mistake this - // value for being greater than any other negative value. - if (val === 0) { - val = null; - } - styles[actualStyleName] = val; - } - }); - - return styles; -} - -function parseMaxTime(str) { - var maxValue = 0; - var values = str.split(/\s*,\s*/); - forEach(values, function(value) { - // it's always safe to consider only second values and omit `ms` values since - // getComputedStyle will always handle the conversion for us - if (value.charAt(value.length - 1) === 's') { - value = value.substring(0, value.length - 1); - } - value = parseFloat(value) || 0; - maxValue = maxValue ? Math.max(value, maxValue) : value; - }); - return maxValue; -} - -function truthyTimingValue(val) { - return val === 0 || val != null; -} - -function getCssTransitionDurationStyle(duration, applyOnlyDuration) { - var style = TRANSITION_PROP; - var value = duration + 's'; - if (applyOnlyDuration) { - style += DURATION_KEY; - } else { - value += ' linear all'; - } - return [style, value]; -} - -// we do not reassign an already present style value since -// if we detect the style property value again we may be -// detecting styles that were added via the `from` styles. -// We make use of `isDefined` here since an empty string -// or null value (which is what getPropertyValue will return -// for a non-existing style) will still be marked as a valid -// value for the style (a falsy value implies that the style -// is to be removed at the end of the animation). If we had a simple -// "OR" statement then it would not be enough to catch that. -function registerRestorableStyles(backup, node, properties) { - forEach(properties, function(prop) { - backup[prop] = isDefined(backup[prop]) - ? backup[prop] - : node.style.getPropertyValue(prop); - }); -} - -var $AnimateCssProvider = ['$animateProvider', /** @this */ function($animateProvider) { - - this.$get = ['$window', '$$jqLite', '$$AnimateRunner', '$timeout', '$$animateCache', - '$$forceReflow', '$sniffer', '$$rAFScheduler', '$$animateQueue', - function($window, $$jqLite, $$AnimateRunner, $timeout, $$animateCache, - $$forceReflow, $sniffer, $$rAFScheduler, $$animateQueue) { - - var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); - - function computeCachedCssStyles(node, className, cacheKey, allowNoDuration, properties) { - var timings = $$animateCache.get(cacheKey); - - if (!timings) { - timings = computeCssStyles($window, node, properties); - if (timings.animationIterationCount === 'infinite') { - timings.animationIterationCount = 1; - } - } - - // if a css animation has no duration we - // should mark that so that repeated addClass/removeClass calls are skipped - var hasDuration = allowNoDuration || (timings.transitionDuration > 0 || timings.animationDuration > 0); - - // we keep putting this in multiple times even though the value and the cacheKey are the same - // because we're keeping an internal tally of how many duplicate animations are detected. - $$animateCache.put(cacheKey, timings, hasDuration); - - return timings; - } - - function computeCachedCssStaggerStyles(node, className, cacheKey, properties) { - var stagger; - var staggerCacheKey = 'stagger-' + cacheKey; - - // if we have one or more existing matches of matching elements - // containing the same parent + CSS styles (which is how cacheKey works) - // then staggering is possible - if ($$animateCache.count(cacheKey) > 0) { - stagger = $$animateCache.get(staggerCacheKey); - - if (!stagger) { - var staggerClassName = pendClasses(className, '-stagger'); - - $$jqLite.addClass(node, staggerClassName); - - stagger = computeCssStyles($window, node, properties); - - // force the conversion of a null value to zero incase not set - stagger.animationDuration = Math.max(stagger.animationDuration, 0); - stagger.transitionDuration = Math.max(stagger.transitionDuration, 0); - - $$jqLite.removeClass(node, staggerClassName); - - $$animateCache.put(staggerCacheKey, stagger, true); - } - } - - return stagger || {}; - } - - var rafWaitQueue = []; - function waitUntilQuiet(callback) { - rafWaitQueue.push(callback); - $$rAFScheduler.waitUntilQuiet(function() { - $$animateCache.flush(); - - // DO NOT REMOVE THIS LINE OR REFACTOR OUT THE `pageWidth` variable. - // PLEASE EXAMINE THE `$$forceReflow` service to understand why. - var pageWidth = $$forceReflow(); - - // we use a for loop to ensure that if the queue is changed - // during this looping then it will consider new requests - for (var i = 0; i < rafWaitQueue.length; i++) { - rafWaitQueue[i](pageWidth); - } - rafWaitQueue.length = 0; - }); - } - - function computeTimings(node, className, cacheKey, allowNoDuration) { - var timings = computeCachedCssStyles(node, className, cacheKey, allowNoDuration, DETECT_CSS_PROPERTIES); - var aD = timings.animationDelay; - var tD = timings.transitionDelay; - timings.maxDelay = aD && tD - ? Math.max(aD, tD) - : (aD || tD); - timings.maxDuration = Math.max( - timings.animationDuration * timings.animationIterationCount, - timings.transitionDuration); - - return timings; - } - - return function init(element, initialOptions) { - // all of the animation functions should create - // a copy of the options data, however, if a - // parent service has already created a copy then - // we should stick to using that - var options = initialOptions || {}; - if (!options.$$prepared) { - options = prepareAnimationOptions(copy(options)); - } - - var restoreStyles = {}; - var node = getDomNode(element); - if (!node - || !node.parentNode - || !$$animateQueue.enabled()) { - return closeAndReturnNoopAnimator(); - } - - var temporaryStyles = []; - var classes = element.attr('class'); - var styles = packageStyles(options); - var animationClosed; - var animationPaused; - var animationCompleted; - var runner; - var runnerHost; - var maxDelay; - var maxDelayTime; - var maxDuration; - var maxDurationTime; - var startTime; - var events = []; - - if (options.duration === 0 || (!$sniffer.animations && !$sniffer.transitions)) { - return closeAndReturnNoopAnimator(); - } - - var method = options.event && isArray(options.event) - ? options.event.join(' ') - : options.event; - - var isStructural = method && options.structural; - var structuralClassName = ''; - var addRemoveClassName = ''; - - if (isStructural) { - structuralClassName = pendClasses(method, EVENT_CLASS_PREFIX, true); - } else if (method) { - structuralClassName = method; - } - - if (options.addClass) { - addRemoveClassName += pendClasses(options.addClass, ADD_CLASS_SUFFIX); - } - - if (options.removeClass) { - if (addRemoveClassName.length) { - addRemoveClassName += ' '; - } - addRemoveClassName += pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX); - } - - // there may be a situation where a structural animation is combined together - // with CSS classes that need to resolve before the animation is computed. - // However this means that there is no explicit CSS code to block the animation - // from happening (by setting 0s none in the class name). If this is the case - // we need to apply the classes before the first rAF so we know to continue if - // there actually is a detected transition or keyframe animation - if (options.applyClassesEarly && addRemoveClassName.length) { - applyAnimationClasses(element, options); - } - - var preparationClasses = [structuralClassName, addRemoveClassName].join(' ').trim(); - var fullClassName = classes + ' ' + preparationClasses; - var hasToStyles = styles.to && Object.keys(styles.to).length > 0; - var containsKeyframeAnimation = (options.keyframeStyle || '').length > 0; - - // there is no way we can trigger an animation if no styles and - // no classes are being applied which would then trigger a transition, - // unless there a is raw keyframe value that is applied to the element. - if (!containsKeyframeAnimation - && !hasToStyles - && !preparationClasses) { - return closeAndReturnNoopAnimator(); - } - - var stagger, cacheKey = $$animateCache.cacheKey(node, method, options.addClass, options.removeClass); - if ($$animateCache.containsCachedAnimationWithoutDuration(cacheKey)) { - preparationClasses = null; - return closeAndReturnNoopAnimator(); - } - - if (options.stagger > 0) { - var staggerVal = parseFloat(options.stagger); - stagger = { - transitionDelay: staggerVal, - animationDelay: staggerVal, - transitionDuration: 0, - animationDuration: 0 - }; - } else { - stagger = computeCachedCssStaggerStyles(node, preparationClasses, cacheKey, DETECT_STAGGER_CSS_PROPERTIES); - } - - if (!options.$$skipPreparationClasses) { - $$jqLite.addClass(element, preparationClasses); - } - - var applyOnlyDuration; - - if (options.transitionStyle) { - var transitionStyle = [TRANSITION_PROP, options.transitionStyle]; - applyInlineStyle(node, transitionStyle); - temporaryStyles.push(transitionStyle); - } - - if (options.duration >= 0) { - applyOnlyDuration = node.style[TRANSITION_PROP].length > 0; - var durationStyle = getCssTransitionDurationStyle(options.duration, applyOnlyDuration); - - // we set the duration so that it will be picked up by getComputedStyle later - applyInlineStyle(node, durationStyle); - temporaryStyles.push(durationStyle); - } - - if (options.keyframeStyle) { - var keyframeStyle = [ANIMATION_PROP, options.keyframeStyle]; - applyInlineStyle(node, keyframeStyle); - temporaryStyles.push(keyframeStyle); - } - - var itemIndex = stagger - ? options.staggerIndex >= 0 - ? options.staggerIndex - : $$animateCache.count(cacheKey) - : 0; - - var isFirst = itemIndex === 0; - - // this is a pre-emptive way of forcing the setup classes to be added and applied INSTANTLY - // without causing any combination of transitions to kick in. By adding a negative delay value - // it forces the setup class' transition to end immediately. We later then remove the negative - // transition delay to allow for the transition to naturally do it's thing. The beauty here is - // that if there is no transition defined then nothing will happen and this will also allow - // other transitions to be stacked on top of each other without any chopping them out. - if (isFirst && !options.skipBlocking) { - helpers.blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE); - } - - var timings = computeTimings(node, fullClassName, cacheKey, !isStructural); - var relativeDelay = timings.maxDelay; - maxDelay = Math.max(relativeDelay, 0); - maxDuration = timings.maxDuration; - - var flags = {}; - flags.hasTransitions = timings.transitionDuration > 0; - flags.hasAnimations = timings.animationDuration > 0; - flags.hasTransitionAll = flags.hasTransitions && timings.transitionProperty === 'all'; - flags.applyTransitionDuration = hasToStyles && ( - (flags.hasTransitions && !flags.hasTransitionAll) - || (flags.hasAnimations && !flags.hasTransitions)); - flags.applyAnimationDuration = options.duration && flags.hasAnimations; - flags.applyTransitionDelay = truthyTimingValue(options.delay) && (flags.applyTransitionDuration || flags.hasTransitions); - flags.applyAnimationDelay = truthyTimingValue(options.delay) && flags.hasAnimations; - flags.recalculateTimingStyles = addRemoveClassName.length > 0; - - if (flags.applyTransitionDuration || flags.applyAnimationDuration) { - maxDuration = options.duration ? parseFloat(options.duration) : maxDuration; - - if (flags.applyTransitionDuration) { - flags.hasTransitions = true; - timings.transitionDuration = maxDuration; - applyOnlyDuration = node.style[TRANSITION_PROP + PROPERTY_KEY].length > 0; - temporaryStyles.push(getCssTransitionDurationStyle(maxDuration, applyOnlyDuration)); - } - - if (flags.applyAnimationDuration) { - flags.hasAnimations = true; - timings.animationDuration = maxDuration; - temporaryStyles.push(getCssKeyframeDurationStyle(maxDuration)); - } - } - - if (maxDuration === 0 && !flags.recalculateTimingStyles) { - return closeAndReturnNoopAnimator(); - } - - var activeClasses = pendClasses(preparationClasses, ACTIVE_CLASS_SUFFIX); - - if (options.delay != null) { - var delayStyle; - if (typeof options.delay !== 'boolean') { - delayStyle = parseFloat(options.delay); - // number in options.delay means we have to recalculate the delay for the closing timeout - maxDelay = Math.max(delayStyle, 0); - } - - if (flags.applyTransitionDelay) { - temporaryStyles.push(getCssDelayStyle(delayStyle)); - } - - if (flags.applyAnimationDelay) { - temporaryStyles.push(getCssDelayStyle(delayStyle, true)); - } - } - - // we need to recalculate the delay value since we used a pre-emptive negative - // delay value and the delay value is required for the final event checking. This - // property will ensure that this will happen after the RAF phase has passed. - if (options.duration == null && timings.transitionDuration > 0) { - flags.recalculateTimingStyles = flags.recalculateTimingStyles || isFirst; - } - - maxDelayTime = maxDelay * ONE_SECOND; - maxDurationTime = maxDuration * ONE_SECOND; - if (!options.skipBlocking) { - flags.blockTransition = timings.transitionDuration > 0; - flags.blockKeyframeAnimation = timings.animationDuration > 0 && - stagger.animationDelay > 0 && - stagger.animationDuration === 0; - } - - if (options.from) { - if (options.cleanupStyles) { - registerRestorableStyles(restoreStyles, node, Object.keys(options.from)); - } - applyAnimationFromStyles(element, options); - } - - if (flags.blockTransition || flags.blockKeyframeAnimation) { - applyBlocking(maxDuration); - } else if (!options.skipBlocking) { - helpers.blockTransitions(node, false); - } - - // TODO(matsko): for 1.5 change this code to have an animator object for better debugging - return { - $$willAnimate: true, - end: endFn, - start: function() { - if (animationClosed) return; - - runnerHost = { - end: endFn, - cancel: cancelFn, - resume: null, //this will be set during the start() phase - pause: null - }; - - runner = new $$AnimateRunner(runnerHost); - - waitUntilQuiet(start); - - // we don't have access to pause/resume the animation - // since it hasn't run yet. AnimateRunner will therefore - // set noop functions for resume and pause and they will - // later be overridden once the animation is triggered - return runner; - } - }; - - function endFn() { - close(); - } - - function cancelFn() { - close(true); - } - - function close(rejected) { - // if the promise has been called already then we shouldn't close - // the animation again - if (animationClosed || (animationCompleted && animationPaused)) return; - animationClosed = true; - animationPaused = false; - - if (preparationClasses && !options.$$skipPreparationClasses) { - $$jqLite.removeClass(element, preparationClasses); - } - - if (activeClasses) { - $$jqLite.removeClass(element, activeClasses); - } - - blockKeyframeAnimations(node, false); - helpers.blockTransitions(node, false); - - forEach(temporaryStyles, function(entry) { - // There is only one way to remove inline style properties entirely from elements. - // By using `removeProperty` this works, but we need to convert camel-cased CSS - // styles down to hyphenated values. - node.style[entry[0]] = ''; - }); - - applyAnimationClasses(element, options); - applyAnimationStyles(element, options); - - if (Object.keys(restoreStyles).length) { - forEach(restoreStyles, function(value, prop) { - if (value) { - node.style.setProperty(prop, value); - } else { - node.style.removeProperty(prop); - } - }); - } - - // the reason why we have this option is to allow a synchronous closing callback - // that is fired as SOON as the animation ends (when the CSS is removed) or if - // the animation never takes off at all. A good example is a leave animation since - // the element must be removed just after the animation is over or else the element - // will appear on screen for one animation frame causing an overbearing flicker. - if (options.onDone) { - options.onDone(); - } - - if (events && events.length) { - // Remove the transitionend / animationend listener(s) - element.off(events.join(' '), onAnimationProgress); - } - - //Cancel the fallback closing timeout and remove the timer data - var animationTimerData = element.data(ANIMATE_TIMER_KEY); - if (animationTimerData) { - $timeout.cancel(animationTimerData[0].timer); - element.removeData(ANIMATE_TIMER_KEY); - } - - // if the preparation function fails then the promise is not setup - if (runner) { - runner.complete(!rejected); - } - } - - function applyBlocking(duration) { - if (flags.blockTransition) { - helpers.blockTransitions(node, duration); - } - - if (flags.blockKeyframeAnimation) { - blockKeyframeAnimations(node, !!duration); - } - } - - function closeAndReturnNoopAnimator() { - runner = new $$AnimateRunner({ - end: endFn, - cancel: cancelFn - }); - - // should flush the cache animation - waitUntilQuiet(noop); - close(); - - return { - $$willAnimate: false, - start: function() { - return runner; - }, - end: endFn - }; - } - - function onAnimationProgress(event) { - event.stopPropagation(); - var ev = event.originalEvent || event; - - if (ev.target !== node) { - // Since TransitionEvent / AnimationEvent bubble up, - // we have to ignore events by finished child animations - return; - } - - // we now always use `Date.now()` due to the recent changes with - // event.timeStamp in Firefox, Webkit and Chrome (see #13494 for more info) - var timeStamp = ev.$manualTimeStamp || Date.now(); - - /* Firefox (or possibly just Gecko) likes to not round values up - * when a ms measurement is used for the animation */ - var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES)); - - /* $manualTimeStamp is a mocked timeStamp value which is set - * within browserTrigger(). This is only here so that tests can - * mock animations properly. Real events fallback to event.timeStamp, - * or, if they don't, then a timeStamp is automatically created for them. - * We're checking to see if the timeStamp surpasses the expected delay, - * but we're using elapsedTime instead of the timeStamp on the 2nd - * pre-condition since animationPauseds sometimes close off early */ - if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) { - // we set this flag to ensure that if the transition is paused then, when resumed, - // the animation will automatically close itself since transitions cannot be paused. - animationCompleted = true; - close(); - } - } - - function start() { - if (animationClosed) return; - if (!node.parentNode) { - close(); - return; - } - - // even though we only pause keyframe animations here the pause flag - // will still happen when transitions are used. Only the transition will - // not be paused since that is not possible. If the animation ends when - // paused then it will not complete until unpaused or cancelled. - var playPause = function(playAnimation) { - if (!animationCompleted) { - animationPaused = !playAnimation; - if (timings.animationDuration) { - var value = blockKeyframeAnimations(node, animationPaused); - if (animationPaused) { - temporaryStyles.push(value); - } else { - removeFromArray(temporaryStyles, value); - } - } - } else if (animationPaused && playAnimation) { - animationPaused = false; - close(); - } - }; - - // checking the stagger duration prevents an accidentally cascade of the CSS delay style - // being inherited from the parent. If the transition duration is zero then we can safely - // rely that the delay value is an intentional stagger delay style. - var maxStagger = itemIndex > 0 - && ((timings.transitionDuration && stagger.transitionDuration === 0) || - (timings.animationDuration && stagger.animationDuration === 0)) - && Math.max(stagger.animationDelay, stagger.transitionDelay); - if (maxStagger) { - $timeout(triggerAnimationStart, - Math.floor(maxStagger * itemIndex * ONE_SECOND), - false); - } else { - triggerAnimationStart(); - } - - // this will decorate the existing promise runner with pause/resume methods - runnerHost.resume = function() { - playPause(true); - }; - - runnerHost.pause = function() { - playPause(false); - }; - - function triggerAnimationStart() { - // just incase a stagger animation kicks in when the animation - // itself was cancelled entirely - if (animationClosed) return; - - applyBlocking(false); - - forEach(temporaryStyles, function(entry) { - var key = entry[0]; - var value = entry[1]; - node.style[key] = value; - }); - - applyAnimationClasses(element, options); - $$jqLite.addClass(element, activeClasses); - - if (flags.recalculateTimingStyles) { - fullClassName = node.getAttribute('class') + ' ' + preparationClasses; - cacheKey = $$animateCache.cacheKey(node, method, options.addClass, options.removeClass); - - timings = computeTimings(node, fullClassName, cacheKey, false); - relativeDelay = timings.maxDelay; - maxDelay = Math.max(relativeDelay, 0); - maxDuration = timings.maxDuration; - - if (maxDuration === 0) { - close(); - return; - } - - flags.hasTransitions = timings.transitionDuration > 0; - flags.hasAnimations = timings.animationDuration > 0; - } - - if (flags.applyAnimationDelay) { - relativeDelay = typeof options.delay !== 'boolean' && truthyTimingValue(options.delay) - ? parseFloat(options.delay) - : relativeDelay; - - maxDelay = Math.max(relativeDelay, 0); - timings.animationDelay = relativeDelay; - delayStyle = getCssDelayStyle(relativeDelay, true); - temporaryStyles.push(delayStyle); - node.style[delayStyle[0]] = delayStyle[1]; - } - - maxDelayTime = maxDelay * ONE_SECOND; - maxDurationTime = maxDuration * ONE_SECOND; - - if (options.easing) { - var easeProp, easeVal = options.easing; - if (flags.hasTransitions) { - easeProp = TRANSITION_PROP + TIMING_KEY; - temporaryStyles.push([easeProp, easeVal]); - node.style[easeProp] = easeVal; - } - if (flags.hasAnimations) { - easeProp = ANIMATION_PROP + TIMING_KEY; - temporaryStyles.push([easeProp, easeVal]); - node.style[easeProp] = easeVal; - } - } - - if (timings.transitionDuration) { - events.push(TRANSITIONEND_EVENT); - } - - if (timings.animationDuration) { - events.push(ANIMATIONEND_EVENT); - } - - startTime = Date.now(); - var timerTime = maxDelayTime + CLOSING_TIME_BUFFER * maxDurationTime; - var endTime = startTime + timerTime; - - var animationsData = element.data(ANIMATE_TIMER_KEY) || []; - var setupFallbackTimer = true; - if (animationsData.length) { - var currentTimerData = animationsData[0]; - setupFallbackTimer = endTime > currentTimerData.expectedEndTime; - if (setupFallbackTimer) { - $timeout.cancel(currentTimerData.timer); - } else { - animationsData.push(close); - } - } - - if (setupFallbackTimer) { - var timer = $timeout(onAnimationExpired, timerTime, false); - animationsData[0] = { - timer: timer, - expectedEndTime: endTime - }; - animationsData.push(close); - element.data(ANIMATE_TIMER_KEY, animationsData); - } - - if (events.length) { - element.on(events.join(' '), onAnimationProgress); - } - - if (options.to) { - if (options.cleanupStyles) { - registerRestorableStyles(restoreStyles, node, Object.keys(options.to)); - } - applyAnimationToStyles(element, options); - } - } - - function onAnimationExpired() { - var animationsData = element.data(ANIMATE_TIMER_KEY); - - // this will be false in the event that the element was - // removed from the DOM (via a leave animation or something - // similar) - if (animationsData) { - for (var i = 1; i < animationsData.length; i++) { - animationsData[i](); - } - element.removeData(ANIMATE_TIMER_KEY); - } - } - } - }; - }]; -}]; - -var $$AnimateCssDriverProvider = ['$$animationProvider', /** @this */ function($$animationProvider) { - $$animationProvider.drivers.push('$$animateCssDriver'); - - var NG_ANIMATE_SHIM_CLASS_NAME = 'ng-animate-shim'; - var NG_ANIMATE_ANCHOR_CLASS_NAME = 'ng-anchor'; - - var NG_OUT_ANCHOR_CLASS_NAME = 'ng-anchor-out'; - var NG_IN_ANCHOR_CLASS_NAME = 'ng-anchor-in'; - - function isDocumentFragment(node) { - return node.parentNode && node.parentNode.nodeType === 11; - } - - this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$sniffer', '$$jqLite', '$document', - function($animateCss, $rootScope, $$AnimateRunner, $rootElement, $sniffer, $$jqLite, $document) { - - // only browsers that support these properties can render animations - if (!$sniffer.animations && !$sniffer.transitions) return noop; - - var bodyNode = $document[0].body; - var rootNode = getDomNode($rootElement); - - var rootBodyElement = jqLite( - // this is to avoid using something that exists outside of the body - // we also special case the doc fragment case because our unit test code - // appends the $rootElement to the body after the app has been bootstrapped - isDocumentFragment(rootNode) || bodyNode.contains(rootNode) ? rootNode : bodyNode - ); - - return function initDriverFn(animationDetails) { - return animationDetails.from && animationDetails.to - ? prepareFromToAnchorAnimation(animationDetails.from, - animationDetails.to, - animationDetails.classes, - animationDetails.anchors) - : prepareRegularAnimation(animationDetails); - }; - - function filterCssClasses(classes) { - //remove all the `ng-` stuff - return classes.replace(/\bng-\S+\b/g, ''); - } - - function getUniqueValues(a, b) { - if (isString(a)) a = a.split(' '); - if (isString(b)) b = b.split(' '); - return a.filter(function(val) { - return b.indexOf(val) === -1; - }).join(' '); - } - - function prepareAnchoredAnimation(classes, outAnchor, inAnchor) { - var clone = jqLite(getDomNode(outAnchor).cloneNode(true)); - var startingClasses = filterCssClasses(getClassVal(clone)); - - outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME); - inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME); - - clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME); - - rootBodyElement.append(clone); - - var animatorIn, animatorOut = prepareOutAnimation(); - - // the user may not end up using the `out` animation and - // only making use of the `in` animation or vice-versa. - // In either case we should allow this and not assume the - // animation is over unless both animations are not used. - if (!animatorOut) { - animatorIn = prepareInAnimation(); - if (!animatorIn) { - return end(); - } - } - - var startingAnimator = animatorOut || animatorIn; - - return { - start: function() { - var runner; - - var currentAnimation = startingAnimator.start(); - currentAnimation.done(function() { - currentAnimation = null; - if (!animatorIn) { - animatorIn = prepareInAnimation(); - if (animatorIn) { - currentAnimation = animatorIn.start(); - currentAnimation.done(function() { - currentAnimation = null; - end(); - runner.complete(); - }); - return currentAnimation; - } - } - // in the event that there is no `in` animation - end(); - runner.complete(); - }); - - runner = new $$AnimateRunner({ - end: endFn, - cancel: endFn - }); - - return runner; - - function endFn() { - if (currentAnimation) { - currentAnimation.end(); - } - } - } - }; - - function calculateAnchorStyles(anchor) { - var styles = {}; - - var coords = getDomNode(anchor).getBoundingClientRect(); - - // we iterate directly since safari messes up and doesn't return - // all the keys for the coords object when iterated - forEach(['width','height','top','left'], function(key) { - var value = coords[key]; - switch (key) { - case 'top': - value += bodyNode.scrollTop; - break; - case 'left': - value += bodyNode.scrollLeft; - break; - } - styles[key] = Math.floor(value) + 'px'; - }); - return styles; - } - - function prepareOutAnimation() { - var animator = $animateCss(clone, { - addClass: NG_OUT_ANCHOR_CLASS_NAME, - delay: true, - from: calculateAnchorStyles(outAnchor) - }); - - // read the comment within `prepareRegularAnimation` to understand - // why this check is necessary - return animator.$$willAnimate ? animator : null; - } - - function getClassVal(element) { - return element.attr('class') || ''; - } - - function prepareInAnimation() { - var endingClasses = filterCssClasses(getClassVal(inAnchor)); - var toAdd = getUniqueValues(endingClasses, startingClasses); - var toRemove = getUniqueValues(startingClasses, endingClasses); - - var animator = $animateCss(clone, { - to: calculateAnchorStyles(inAnchor), - addClass: NG_IN_ANCHOR_CLASS_NAME + ' ' + toAdd, - removeClass: NG_OUT_ANCHOR_CLASS_NAME + ' ' + toRemove, - delay: true - }); - - // read the comment within `prepareRegularAnimation` to understand - // why this check is necessary - return animator.$$willAnimate ? animator : null; - } - - function end() { - clone.remove(); - outAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME); - inAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME); - } - } - - function prepareFromToAnchorAnimation(from, to, classes, anchors) { - var fromAnimation = prepareRegularAnimation(from, noop); - var toAnimation = prepareRegularAnimation(to, noop); - - var anchorAnimations = []; - forEach(anchors, function(anchor) { - var outElement = anchor['out']; - var inElement = anchor['in']; - var animator = prepareAnchoredAnimation(classes, outElement, inElement); - if (animator) { - anchorAnimations.push(animator); - } - }); - - // no point in doing anything when there are no elements to animate - if (!fromAnimation && !toAnimation && anchorAnimations.length === 0) return; - - return { - start: function() { - var animationRunners = []; - - if (fromAnimation) { - animationRunners.push(fromAnimation.start()); - } - - if (toAnimation) { - animationRunners.push(toAnimation.start()); - } - - forEach(anchorAnimations, function(animation) { - animationRunners.push(animation.start()); - }); - - var runner = new $$AnimateRunner({ - end: endFn, - cancel: endFn // CSS-driven animations cannot be cancelled, only ended - }); - - $$AnimateRunner.all(animationRunners, function(status) { - runner.complete(status); - }); - - return runner; - - function endFn() { - forEach(animationRunners, function(runner) { - runner.end(); - }); - } - } - }; - } - - function prepareRegularAnimation(animationDetails) { - var element = animationDetails.element; - var options = animationDetails.options || {}; - - if (animationDetails.structural) { - options.event = animationDetails.event; - options.structural = true; - options.applyClassesEarly = true; - - // we special case the leave animation since we want to ensure that - // the element is removed as soon as the animation is over. Otherwise - // a flicker might appear or the element may not be removed at all - if (animationDetails.event === 'leave') { - options.onDone = options.domOperation; - } - } - - // We assign the preparationClasses as the actual animation event since - // the internals of $animateCss will just suffix the event token values - // with `-active` to trigger the animation. - if (options.preparationClasses) { - options.event = concatWithSpace(options.event, options.preparationClasses); - } - - var animator = $animateCss(element, options); - - // the driver lookup code inside of $$animation attempts to spawn a - // driver one by one until a driver returns a.$$willAnimate animator object. - // $animateCss will always return an object, however, it will pass in - // a flag as a hint as to whether an animation was detected or not - return animator.$$willAnimate ? animator : null; - } - }]; -}]; - -// TODO(matsko): use caching here to speed things up for detection -// TODO(matsko): add documentation -// by the time... - -var $$AnimateJsProvider = ['$animateProvider', /** @this */ function($animateProvider) { - this.$get = ['$injector', '$$AnimateRunner', '$$jqLite', - function($injector, $$AnimateRunner, $$jqLite) { - - var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); - // $animateJs(element, 'enter'); - return function(element, event, classes, options) { - var animationClosed = false; - - // the `classes` argument is optional and if it is not used - // then the classes will be resolved from the element's className - // property as well as options.addClass/options.removeClass. - if (arguments.length === 3 && isObject(classes)) { - options = classes; - classes = null; - } - - options = prepareAnimationOptions(options); - if (!classes) { - classes = element.attr('class') || ''; - if (options.addClass) { - classes += ' ' + options.addClass; - } - if (options.removeClass) { - classes += ' ' + options.removeClass; - } - } - - var classesToAdd = options.addClass; - var classesToRemove = options.removeClass; - - // the lookupAnimations function returns a series of animation objects that are - // matched up with one or more of the CSS classes. These animation objects are - // defined via the module.animation factory function. If nothing is detected then - // we don't return anything which then makes $animation query the next driver. - var animations = lookupAnimations(classes); - var before, after; - if (animations.length) { - var afterFn, beforeFn; - if (event === 'leave') { - beforeFn = 'leave'; - afterFn = 'afterLeave'; // TODO(matsko): get rid of this - } else { - beforeFn = 'before' + event.charAt(0).toUpperCase() + event.substr(1); - afterFn = event; - } - - if (event !== 'enter' && event !== 'move') { - before = packageAnimations(element, event, options, animations, beforeFn); - } - after = packageAnimations(element, event, options, animations, afterFn); - } - - // no matching animations - if (!before && !after) return; - - function applyOptions() { - options.domOperation(); - applyAnimationClasses(element, options); - } - - function close() { - animationClosed = true; - applyOptions(); - applyAnimationStyles(element, options); - } - - var runner; - - return { - $$willAnimate: true, - end: function() { - if (runner) { - runner.end(); - } else { - close(); - runner = new $$AnimateRunner(); - runner.complete(true); - } - return runner; - }, - start: function() { - if (runner) { - return runner; - } - - runner = new $$AnimateRunner(); - var closeActiveAnimations; - var chain = []; - - if (before) { - chain.push(function(fn) { - closeActiveAnimations = before(fn); - }); - } - - if (chain.length) { - chain.push(function(fn) { - applyOptions(); - fn(true); - }); - } else { - applyOptions(); - } - - if (after) { - chain.push(function(fn) { - closeActiveAnimations = after(fn); - }); - } - - runner.setHost({ - end: function() { - endAnimations(); - }, - cancel: function() { - endAnimations(true); - } - }); - - $$AnimateRunner.chain(chain, onComplete); - return runner; - - function onComplete(success) { - close(success); - runner.complete(success); - } - - function endAnimations(cancelled) { - if (!animationClosed) { - (closeActiveAnimations || noop)(cancelled); - onComplete(cancelled); - } - } - } - }; - - function executeAnimationFn(fn, element, event, options, onDone) { - var args; - switch (event) { - case 'animate': - args = [element, options.from, options.to, onDone]; - break; - - case 'setClass': - args = [element, classesToAdd, classesToRemove, onDone]; - break; - - case 'addClass': - args = [element, classesToAdd, onDone]; - break; - - case 'removeClass': - args = [element, classesToRemove, onDone]; - break; - - default: - args = [element, onDone]; - break; - } - - args.push(options); - - var value = fn.apply(fn, args); - if (value) { - if (isFunction(value.start)) { - value = value.start(); - } - - if (value instanceof $$AnimateRunner) { - value.done(onDone); - } else if (isFunction(value)) { - // optional onEnd / onCancel callback - return value; - } - } - - return noop; - } - - function groupEventedAnimations(element, event, options, animations, fnName) { - var operations = []; - forEach(animations, function(ani) { - var animation = ani[fnName]; - if (!animation) return; - - // note that all of these animations will run in parallel - operations.push(function() { - var runner; - var endProgressCb; - - var resolved = false; - var onAnimationComplete = function(rejected) { - if (!resolved) { - resolved = true; - (endProgressCb || noop)(rejected); - runner.complete(!rejected); - } - }; - - runner = new $$AnimateRunner({ - end: function() { - onAnimationComplete(); - }, - cancel: function() { - onAnimationComplete(true); - } - }); - - endProgressCb = executeAnimationFn(animation, element, event, options, function(result) { - var cancelled = result === false; - onAnimationComplete(cancelled); - }); - - return runner; - }); - }); - - return operations; - } - - function packageAnimations(element, event, options, animations, fnName) { - var operations = groupEventedAnimations(element, event, options, animations, fnName); - if (operations.length === 0) { - var a, b; - if (fnName === 'beforeSetClass') { - a = groupEventedAnimations(element, 'removeClass', options, animations, 'beforeRemoveClass'); - b = groupEventedAnimations(element, 'addClass', options, animations, 'beforeAddClass'); - } else if (fnName === 'setClass') { - a = groupEventedAnimations(element, 'removeClass', options, animations, 'removeClass'); - b = groupEventedAnimations(element, 'addClass', options, animations, 'addClass'); - } - - if (a) { - operations = operations.concat(a); - } - if (b) { - operations = operations.concat(b); - } - } - - if (operations.length === 0) return; - - // TODO(matsko): add documentation - return function startAnimation(callback) { - var runners = []; - if (operations.length) { - forEach(operations, function(animateFn) { - runners.push(animateFn()); - }); - } - - if (runners.length) { - $$AnimateRunner.all(runners, callback); - } else { - callback(); - } - - return function endFn(reject) { - forEach(runners, function(runner) { - if (reject) { - runner.cancel(); - } else { - runner.end(); - } - }); - }; - }; - } - }; - - function lookupAnimations(classes) { - classes = isArray(classes) ? classes : classes.split(' '); - var matches = [], flagMap = {}; - for (var i = 0; i < classes.length; i++) { - var klass = classes[i], - animationFactory = $animateProvider.$$registeredAnimations[klass]; - if (animationFactory && !flagMap[klass]) { - matches.push($injector.get(animationFactory)); - flagMap[klass] = true; - } - } - return matches; - } - }]; -}]; - -var $$AnimateJsDriverProvider = ['$$animationProvider', /** @this */ function($$animationProvider) { - $$animationProvider.drivers.push('$$animateJsDriver'); - this.$get = ['$$animateJs', '$$AnimateRunner', function($$animateJs, $$AnimateRunner) { - return function initDriverFn(animationDetails) { - if (animationDetails.from && animationDetails.to) { - var fromAnimation = prepareAnimation(animationDetails.from); - var toAnimation = prepareAnimation(animationDetails.to); - if (!fromAnimation && !toAnimation) return; - - return { - start: function() { - var animationRunners = []; - - if (fromAnimation) { - animationRunners.push(fromAnimation.start()); - } - - if (toAnimation) { - animationRunners.push(toAnimation.start()); - } - - $$AnimateRunner.all(animationRunners, done); - - var runner = new $$AnimateRunner({ - end: endFnFactory(), - cancel: endFnFactory() - }); - - return runner; - - function endFnFactory() { - return function() { - forEach(animationRunners, function(runner) { - // at this point we cannot cancel animations for groups just yet. 1.5+ - runner.end(); - }); - }; - } - - function done(status) { - runner.complete(status); - } - } - }; - } else { - return prepareAnimation(animationDetails); - } - }; - - function prepareAnimation(animationDetails) { - // TODO(matsko): make sure to check for grouped animations and delegate down to normal animations - var element = animationDetails.element; - var event = animationDetails.event; - var options = animationDetails.options; - var classes = animationDetails.classes; - return $$animateJs(element, event, classes, options); - } - }]; -}]; - -var NG_ANIMATE_ATTR_NAME = 'data-ng-animate'; -var NG_ANIMATE_PIN_DATA = '$ngAnimatePin'; -var $$AnimateQueueProvider = ['$animateProvider', /** @this */ function($animateProvider) { - var PRE_DIGEST_STATE = 1; - var RUNNING_STATE = 2; - var ONE_SPACE = ' '; - - var rules = this.rules = { - skip: [], - cancel: [], - join: [] - }; - - function getEventData(options) { - return { - addClass: options.addClass, - removeClass: options.removeClass, - from: options.from, - to: options.to - }; - } - - function makeTruthyCssClassMap(classString) { - if (!classString) { - return null; - } - - var keys = classString.split(ONE_SPACE); - var map = Object.create(null); - - forEach(keys, function(key) { - map[key] = true; - }); - return map; - } - - function hasMatchingClasses(newClassString, currentClassString) { - if (newClassString && currentClassString) { - var currentClassMap = makeTruthyCssClassMap(currentClassString); - return newClassString.split(ONE_SPACE).some(function(className) { - return currentClassMap[className]; - }); - } - } - - function isAllowed(ruleType, currentAnimation, previousAnimation) { - return rules[ruleType].some(function(fn) { - return fn(currentAnimation, previousAnimation); - }); - } - - function hasAnimationClasses(animation, and) { - var a = (animation.addClass || '').length > 0; - var b = (animation.removeClass || '').length > 0; - return and ? a && b : a || b; - } - - rules.join.push(function(newAnimation, currentAnimation) { - // if the new animation is class-based then we can just tack that on - return !newAnimation.structural && hasAnimationClasses(newAnimation); - }); - - rules.skip.push(function(newAnimation, currentAnimation) { - // there is no need to animate anything if no classes are being added and - // there is no structural animation that will be triggered - return !newAnimation.structural && !hasAnimationClasses(newAnimation); - }); - - rules.skip.push(function(newAnimation, currentAnimation) { - // why should we trigger a new structural animation if the element will - // be removed from the DOM anyway? - return currentAnimation.event === 'leave' && newAnimation.structural; - }); - - rules.skip.push(function(newAnimation, currentAnimation) { - // if there is an ongoing current animation then don't even bother running the class-based animation - return currentAnimation.structural && currentAnimation.state === RUNNING_STATE && !newAnimation.structural; - }); - - rules.cancel.push(function(newAnimation, currentAnimation) { - // there can never be two structural animations running at the same time - return currentAnimation.structural && newAnimation.structural; - }); - - rules.cancel.push(function(newAnimation, currentAnimation) { - // if the previous animation is already running, but the new animation will - // be triggered, but the new animation is structural - return currentAnimation.state === RUNNING_STATE && newAnimation.structural; - }); - - rules.cancel.push(function(newAnimation, currentAnimation) { - // cancel the animation if classes added / removed in both animation cancel each other out, - // but only if the current animation isn't structural - - if (currentAnimation.structural) return false; - - var nA = newAnimation.addClass; - var nR = newAnimation.removeClass; - var cA = currentAnimation.addClass; - var cR = currentAnimation.removeClass; - - // early detection to save the global CPU shortage :) - if ((isUndefined(nA) && isUndefined(nR)) || (isUndefined(cA) && isUndefined(cR))) { - return false; - } - - return hasMatchingClasses(nA, cR) || hasMatchingClasses(nR, cA); - }); - - this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$Map', - '$$animation', '$$AnimateRunner', '$templateRequest', '$$jqLite', '$$forceReflow', - '$$isDocumentHidden', - function($$rAF, $rootScope, $rootElement, $document, $$Map, - $$animation, $$AnimateRunner, $templateRequest, $$jqLite, $$forceReflow, - $$isDocumentHidden) { - - var activeAnimationsLookup = new $$Map(); - var disabledElementsLookup = new $$Map(); - var animationsEnabled = null; - - function removeFromDisabledElementsLookup(evt) { - disabledElementsLookup.delete(evt.target); - } - - function postDigestTaskFactory() { - var postDigestCalled = false; - return function(fn) { - // we only issue a call to postDigest before - // it has first passed. This prevents any callbacks - // from not firing once the animation has completed - // since it will be out of the digest cycle. - if (postDigestCalled) { - fn(); - } else { - $rootScope.$$postDigest(function() { - postDigestCalled = true; - fn(); - }); - } - }; - } - - // Wait until all directive and route-related templates are downloaded and - // compiled. The $templateRequest.totalPendingRequests variable keeps track of - // all of the remote templates being currently downloaded. If there are no - // templates currently downloading then the watcher will still fire anyway. - var deregisterWatch = $rootScope.$watch( - function() { return $templateRequest.totalPendingRequests === 0; }, - function(isEmpty) { - if (!isEmpty) return; - deregisterWatch(); - - // Now that all templates have been downloaded, $animate will wait until - // the post digest queue is empty before enabling animations. By having two - // calls to $postDigest calls we can ensure that the flag is enabled at the - // very end of the post digest queue. Since all of the animations in $animate - // use $postDigest, it's important that the code below executes at the end. - // This basically means that the page is fully downloaded and compiled before - // any animations are triggered. - $rootScope.$$postDigest(function() { - $rootScope.$$postDigest(function() { - // we check for null directly in the event that the application already called - // .enabled() with whatever arguments that it provided it with - if (animationsEnabled === null) { - animationsEnabled = true; - } - }); - }); - } - ); - - var callbackRegistry = Object.create(null); - - // remember that the `customFilter`/`classNameFilter` are set during the - // provider/config stage therefore we can optimize here and setup helper functions - var customFilter = $animateProvider.customFilter(); - var classNameFilter = $animateProvider.classNameFilter(); - var returnTrue = function() { return true; }; - - var isAnimatableByFilter = customFilter || returnTrue; - var isAnimatableClassName = !classNameFilter ? returnTrue : function(node, options) { - var className = [node.getAttribute('class'), options.addClass, options.removeClass].join(' '); - return classNameFilter.test(className); - }; - - var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); - - function normalizeAnimationDetails(element, animation) { - return mergeAnimationDetails(element, animation, {}); - } - - // IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259. - var contains = window.Node.prototype.contains || /** @this */ function(arg) { - // eslint-disable-next-line no-bitwise - return this === arg || !!(this.compareDocumentPosition(arg) & 16); - }; - - function findCallbacks(targetParentNode, targetNode, event) { - var matches = []; - var entries = callbackRegistry[event]; - if (entries) { - forEach(entries, function(entry) { - if (contains.call(entry.node, targetNode)) { - matches.push(entry.callback); - } else if (event === 'leave' && contains.call(entry.node, targetParentNode)) { - matches.push(entry.callback); - } - }); - } - - return matches; - } - - function filterFromRegistry(list, matchContainer, matchCallback) { - var containerNode = extractElementNode(matchContainer); - return list.filter(function(entry) { - var isMatch = entry.node === containerNode && - (!matchCallback || entry.callback === matchCallback); - return !isMatch; - }); - } - - function cleanupEventListeners(phase, node) { - if (phase === 'close' && !node.parentNode) { - // If the element is not attached to a parentNode, it has been removed by - // the domOperation, and we can safely remove the event callbacks - $animate.off(node); - } - } - - var $animate = { - on: function(event, container, callback) { - var node = extractElementNode(container); - callbackRegistry[event] = callbackRegistry[event] || []; - callbackRegistry[event].push({ - node: node, - callback: callback - }); - - // Remove the callback when the element is removed from the DOM - jqLite(container).on('$destroy', function() { - var animationDetails = activeAnimationsLookup.get(node); - - if (!animationDetails) { - // If there's an animation ongoing, the callback calling code will remove - // the event listeners. If we'd remove here, the callbacks would be removed - // before the animation ends - $animate.off(event, container, callback); - } - }); - }, - - off: function(event, container, callback) { - if (arguments.length === 1 && !isString(arguments[0])) { - container = arguments[0]; - for (var eventType in callbackRegistry) { - callbackRegistry[eventType] = filterFromRegistry(callbackRegistry[eventType], container); - } - - return; - } - - var entries = callbackRegistry[event]; - if (!entries) return; - - callbackRegistry[event] = arguments.length === 1 - ? null - : filterFromRegistry(entries, container, callback); - }, - - pin: function(element, parentElement) { - assertArg(isElement(element), 'element', 'not an element'); - assertArg(isElement(parentElement), 'parentElement', 'not an element'); - element.data(NG_ANIMATE_PIN_DATA, parentElement); - }, - - push: function(element, event, options, domOperation) { - options = options || {}; - options.domOperation = domOperation; - return queueAnimation(element, event, options); - }, - - // this method has four signatures: - // () - global getter - // (bool) - global setter - // (element) - element getter - // (element, bool) - element setter - enabled: function(element, bool) { - var argCount = arguments.length; - - if (argCount === 0) { - // () - Global getter - bool = !!animationsEnabled; - } else { - var hasElement = isElement(element); - - if (!hasElement) { - // (bool) - Global setter - bool = animationsEnabled = !!element; - } else { - var node = getDomNode(element); - - if (argCount === 1) { - // (element) - Element getter - bool = !disabledElementsLookup.get(node); - } else { - // (element, bool) - Element setter - if (!disabledElementsLookup.has(node)) { - // The element is added to the map for the first time. - // Create a listener to remove it on `$destroy` (to avoid memory leak). - jqLite(element).on('$destroy', removeFromDisabledElementsLookup); - } - disabledElementsLookup.set(node, !bool); - } - } - } - - return bool; - } - }; - - return $animate; - - function queueAnimation(originalElement, event, initialOptions) { - // we always make a copy of the options since - // there should never be any side effects on - // the input data when running `$animateCss`. - var options = copy(initialOptions); - - var element = stripCommentsFromElement(originalElement); - var node = getDomNode(element); - var parentNode = node && node.parentNode; - - options = prepareAnimationOptions(options); - - // we create a fake runner with a working promise. - // These methods will become available after the digest has passed - var runner = new $$AnimateRunner(); - - // this is used to trigger callbacks in postDigest mode - var runInNextPostDigestOrNow = postDigestTaskFactory(); - - if (isArray(options.addClass)) { - options.addClass = options.addClass.join(' '); - } - - if (options.addClass && !isString(options.addClass)) { - options.addClass = null; - } - - if (isArray(options.removeClass)) { - options.removeClass = options.removeClass.join(' '); - } - - if (options.removeClass && !isString(options.removeClass)) { - options.removeClass = null; - } - - if (options.from && !isObject(options.from)) { - options.from = null; - } - - if (options.to && !isObject(options.to)) { - options.to = null; - } - - // If animations are hard-disabled for the whole application there is no need to continue. - // There are also situations where a directive issues an animation for a jqLite wrapper that - // contains only comment nodes. In this case, there is no way we can perform an animation. - if (!animationsEnabled || - !node || - !isAnimatableByFilter(node, event, initialOptions) || - !isAnimatableClassName(node, options)) { - close(); - return runner; - } - - var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0; - - var documentHidden = $$isDocumentHidden(); - - // This is a hard disable of all animations the element itself, therefore there is no need to - // continue further past this point if not enabled - // Animations are also disabled if the document is currently hidden (page is not visible - // to the user), because browsers slow down or do not flush calls to requestAnimationFrame - var skipAnimations = documentHidden || disabledElementsLookup.get(node); - var existingAnimation = (!skipAnimations && activeAnimationsLookup.get(node)) || {}; - var hasExistingAnimation = !!existingAnimation.state; - - // there is no point in traversing the same collection of parent ancestors if a followup - // animation will be run on the same element that already did all that checking work - if (!skipAnimations && (!hasExistingAnimation || existingAnimation.state !== PRE_DIGEST_STATE)) { - skipAnimations = !areAnimationsAllowed(node, parentNode, event); - } - - if (skipAnimations) { - // Callbacks should fire even if the document is hidden (regression fix for issue #14120) - if (documentHidden) notifyProgress(runner, event, 'start', getEventData(options)); - close(); - if (documentHidden) notifyProgress(runner, event, 'close', getEventData(options)); - return runner; - } - - if (isStructural) { - closeChildAnimations(node); - } - - var newAnimation = { - structural: isStructural, - element: element, - event: event, - addClass: options.addClass, - removeClass: options.removeClass, - close: close, - options: options, - runner: runner - }; - - if (hasExistingAnimation) { - var skipAnimationFlag = isAllowed('skip', newAnimation, existingAnimation); - if (skipAnimationFlag) { - if (existingAnimation.state === RUNNING_STATE) { - close(); - return runner; - } else { - mergeAnimationDetails(element, existingAnimation, newAnimation); - return existingAnimation.runner; - } - } - var cancelAnimationFlag = isAllowed('cancel', newAnimation, existingAnimation); - if (cancelAnimationFlag) { - if (existingAnimation.state === RUNNING_STATE) { - // this will end the animation right away and it is safe - // to do so since the animation is already running and the - // runner callback code will run in async - existingAnimation.runner.end(); - } else if (existingAnimation.structural) { - // this means that the animation is queued into a digest, but - // hasn't started yet. Therefore it is safe to run the close - // method which will call the runner methods in async. - existingAnimation.close(); - } else { - // this will merge the new animation options into existing animation options - mergeAnimationDetails(element, existingAnimation, newAnimation); - - return existingAnimation.runner; - } - } else { - // a joined animation means that this animation will take over the existing one - // so an example would involve a leave animation taking over an enter. Then when - // the postDigest kicks in the enter will be ignored. - var joinAnimationFlag = isAllowed('join', newAnimation, existingAnimation); - if (joinAnimationFlag) { - if (existingAnimation.state === RUNNING_STATE) { - normalizeAnimationDetails(element, newAnimation); - } else { - applyGeneratedPreparationClasses($$jqLite, element, isStructural ? event : null, options); - - event = newAnimation.event = existingAnimation.event; - options = mergeAnimationDetails(element, existingAnimation, newAnimation); - - //we return the same runner since only the option values of this animation will - //be fed into the `existingAnimation`. - return existingAnimation.runner; - } - } - } - } else { - // normalization in this case means that it removes redundant CSS classes that - // already exist (addClass) or do not exist (removeClass) on the element - normalizeAnimationDetails(element, newAnimation); - } - - // when the options are merged and cleaned up we may end up not having to do - // an animation at all, therefore we should check this before issuing a post - // digest callback. Structural animations will always run no matter what. - var isValidAnimation = newAnimation.structural; - if (!isValidAnimation) { - // animate (from/to) can be quickly checked first, otherwise we check if any classes are present - isValidAnimation = (newAnimation.event === 'animate' && Object.keys(newAnimation.options.to || {}).length > 0) - || hasAnimationClasses(newAnimation); - } - - if (!isValidAnimation) { - close(); - clearElementAnimationState(node); - return runner; - } - - // the counter keeps track of cancelled animations - var counter = (existingAnimation.counter || 0) + 1; - newAnimation.counter = counter; - - markElementAnimationState(node, PRE_DIGEST_STATE, newAnimation); - - $rootScope.$$postDigest(function() { - // It is possible that the DOM nodes inside `originalElement` have been replaced. This can - // happen if the animated element is a transcluded clone and also has a `templateUrl` - // directive on it. Therefore, we must recreate `element` in order to interact with the - // actual DOM nodes. - // Note: We still need to use the old `node` for certain things, such as looking up in - // HashMaps where it was used as the key. - - element = stripCommentsFromElement(originalElement); - - var animationDetails = activeAnimationsLookup.get(node); - var animationCancelled = !animationDetails; - animationDetails = animationDetails || {}; - - // if addClass/removeClass is called before something like enter then the - // registered parent element may not be present. The code below will ensure - // that a final value for parent element is obtained - var parentElement = element.parent() || []; - - // animate/structural/class-based animations all have requirements. Otherwise there - // is no point in performing an animation. The parent node must also be set. - var isValidAnimation = parentElement.length > 0 - && (animationDetails.event === 'animate' - || animationDetails.structural - || hasAnimationClasses(animationDetails)); - - // this means that the previous animation was cancelled - // even if the follow-up animation is the same event - if (animationCancelled || animationDetails.counter !== counter || !isValidAnimation) { - // if another animation did not take over then we need - // to make sure that the domOperation and options are - // handled accordingly - if (animationCancelled) { - applyAnimationClasses(element, options); - applyAnimationStyles(element, options); - } - - // if the event changed from something like enter to leave then we do - // it, otherwise if it's the same then the end result will be the same too - if (animationCancelled || (isStructural && animationDetails.event !== event)) { - options.domOperation(); - runner.end(); - } - - // in the event that the element animation was not cancelled or a follow-up animation - // isn't allowed to animate from here then we need to clear the state of the element - // so that any future animations won't read the expired animation data. - if (!isValidAnimation) { - clearElementAnimationState(node); - } - - return; - } - - // this combined multiple class to addClass / removeClass into a setClass event - // so long as a structural event did not take over the animation - event = !animationDetails.structural && hasAnimationClasses(animationDetails, true) - ? 'setClass' - : animationDetails.event; - - markElementAnimationState(node, RUNNING_STATE); - var realRunner = $$animation(element, event, animationDetails.options); - - // this will update the runner's flow-control events based on - // the `realRunner` object. - runner.setHost(realRunner); - notifyProgress(runner, event, 'start', getEventData(options)); - - realRunner.done(function(status) { - close(!status); - var animationDetails = activeAnimationsLookup.get(node); - if (animationDetails && animationDetails.counter === counter) { - clearElementAnimationState(node); - } - notifyProgress(runner, event, 'close', getEventData(options)); - }); - }); - - return runner; - - function notifyProgress(runner, event, phase, data) { - runInNextPostDigestOrNow(function() { - var callbacks = findCallbacks(parentNode, node, event); - if (callbacks.length) { - // do not optimize this call here to RAF because - // we don't know how heavy the callback code here will - // be and if this code is buffered then this can - // lead to a performance regression. - $$rAF(function() { - forEach(callbacks, function(callback) { - callback(element, phase, data); - }); - cleanupEventListeners(phase, node); - }); - } else { - cleanupEventListeners(phase, node); - } - }); - runner.progress(event, phase, data); - } - - function close(reject) { - clearGeneratedClasses(element, options); - applyAnimationClasses(element, options); - applyAnimationStyles(element, options); - options.domOperation(); - runner.complete(!reject); - } - } - - function closeChildAnimations(node) { - var children = node.querySelectorAll('[' + NG_ANIMATE_ATTR_NAME + ']'); - forEach(children, function(child) { - var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME), 10); - var animationDetails = activeAnimationsLookup.get(child); - if (animationDetails) { - switch (state) { - case RUNNING_STATE: - animationDetails.runner.end(); - /* falls through */ - case PRE_DIGEST_STATE: - activeAnimationsLookup.delete(child); - break; - } - } - }); - } - - function clearElementAnimationState(node) { - node.removeAttribute(NG_ANIMATE_ATTR_NAME); - activeAnimationsLookup.delete(node); - } - - /** - * This fn returns false if any of the following is true: - * a) animations on any parent element are disabled, and animations on the element aren't explicitly allowed - * b) a parent element has an ongoing structural animation, and animateChildren is false - * c) the element is not a child of the body - * d) the element is not a child of the $rootElement - */ - function areAnimationsAllowed(node, parentNode, event) { - var bodyNode = $document[0].body; - var rootNode = getDomNode($rootElement); - - var bodyNodeDetected = (node === bodyNode) || node.nodeName === 'HTML'; - var rootNodeDetected = (node === rootNode); - var parentAnimationDetected = false; - var elementDisabled = disabledElementsLookup.get(node); - var animateChildren; - - var parentHost = jqLite.data(node, NG_ANIMATE_PIN_DATA); - if (parentHost) { - parentNode = getDomNode(parentHost); - } - - while (parentNode) { - if (!rootNodeDetected) { - // AngularJS doesn't want to attempt to animate elements outside of the application - // therefore we need to ensure that the rootElement is an ancestor of the current element - rootNodeDetected = (parentNode === rootNode); - } - - if (parentNode.nodeType !== ELEMENT_NODE) { - // no point in inspecting the #document element - break; - } - - var details = activeAnimationsLookup.get(parentNode) || {}; - // either an enter, leave or move animation will commence - // therefore we can't allow any animations to take place - // but if a parent animation is class-based then that's ok - if (!parentAnimationDetected) { - var parentNodeDisabled = disabledElementsLookup.get(parentNode); - - if (parentNodeDisabled === true && elementDisabled !== false) { - // disable animations if the user hasn't explicitly enabled animations on the - // current element - elementDisabled = true; - // element is disabled via parent element, no need to check anything else - break; - } else if (parentNodeDisabled === false) { - elementDisabled = false; - } - parentAnimationDetected = details.structural; - } - - if (isUndefined(animateChildren) || animateChildren === true) { - var value = jqLite.data(parentNode, NG_ANIMATE_CHILDREN_DATA); - if (isDefined(value)) { - animateChildren = value; - } - } - - // there is no need to continue traversing at this point - if (parentAnimationDetected && animateChildren === false) break; - - if (!bodyNodeDetected) { - // we also need to ensure that the element is or will be a part of the body element - // otherwise it is pointless to even issue an animation to be rendered - bodyNodeDetected = (parentNode === bodyNode); - } - - if (bodyNodeDetected && rootNodeDetected) { - // If both body and root have been found, any other checks are pointless, - // as no animation data should live outside the application - break; - } - - if (!rootNodeDetected) { - // If `rootNode` is not detected, check if `parentNode` is pinned to another element - parentHost = jqLite.data(parentNode, NG_ANIMATE_PIN_DATA); - if (parentHost) { - // The pin target element becomes the next parent element - parentNode = getDomNode(parentHost); - continue; - } - } - - parentNode = parentNode.parentNode; - } - - var allowAnimation = (!parentAnimationDetected || animateChildren) && elementDisabled !== true; - return allowAnimation && rootNodeDetected && bodyNodeDetected; - } - - function markElementAnimationState(node, state, details) { - details = details || {}; - details.state = state; - - node.setAttribute(NG_ANIMATE_ATTR_NAME, state); - - var oldValue = activeAnimationsLookup.get(node); - var newValue = oldValue - ? extend(oldValue, details) - : details; - activeAnimationsLookup.set(node, newValue); - } - }]; -}]; - -/** @this */ -var $$AnimateCacheProvider = function() { - - var KEY = '$$ngAnimateParentKey'; - var parentCounter = 0; - var cache = Object.create(null); - - this.$get = [function() { - return { - cacheKey: function(node, method, addClass, removeClass) { - var parentNode = node.parentNode; - var parentID = parentNode[KEY] || (parentNode[KEY] = ++parentCounter); - var parts = [parentID, method, node.getAttribute('class')]; - if (addClass) { - parts.push(addClass); - } - if (removeClass) { - parts.push(removeClass); - } - return parts.join(' '); - }, - - containsCachedAnimationWithoutDuration: function(key) { - var entry = cache[key]; - - // nothing cached, so go ahead and animate - // otherwise it should be a valid animation - return (entry && !entry.isValid) || false; - }, - - flush: function() { - cache = Object.create(null); - }, - - count: function(key) { - var entry = cache[key]; - return entry ? entry.total : 0; - }, - - get: function(key) { - var entry = cache[key]; - return entry && entry.value; - }, - - put: function(key, value, isValid) { - if (!cache[key]) { - cache[key] = { total: 1, value: value, isValid: isValid }; - } else { - cache[key].total++; - cache[key].value = value; - } - } - }; - }]; -}; - -/* exported $$AnimationProvider */ - -var $$AnimationProvider = ['$animateProvider', /** @this */ function($animateProvider) { - var NG_ANIMATE_REF_ATTR = 'ng-animate-ref'; - - var drivers = this.drivers = []; - - var RUNNER_STORAGE_KEY = '$$animationRunner'; - var PREPARE_CLASSES_KEY = '$$animatePrepareClasses'; - - function setRunner(element, runner) { - element.data(RUNNER_STORAGE_KEY, runner); - } - - function removeRunner(element) { - element.removeData(RUNNER_STORAGE_KEY); - } - - function getRunner(element) { - return element.data(RUNNER_STORAGE_KEY); - } - - this.$get = ['$$jqLite', '$rootScope', '$injector', '$$AnimateRunner', '$$Map', '$$rAFScheduler', '$$animateCache', - function($$jqLite, $rootScope, $injector, $$AnimateRunner, $$Map, $$rAFScheduler, $$animateCache) { - - var animationQueue = []; - var applyAnimationClasses = applyAnimationClassesFactory($$jqLite); - - function sortAnimations(animations) { - var tree = { children: [] }; - var i, lookup = new $$Map(); - - // this is done first beforehand so that the map - // is filled with a list of the elements that will be animated - for (i = 0; i < animations.length; i++) { - var animation = animations[i]; - lookup.set(animation.domNode, animations[i] = { - domNode: animation.domNode, - element: animation.element, - fn: animation.fn, - children: [] - }); - } - - for (i = 0; i < animations.length; i++) { - processNode(animations[i]); - } - - return flatten(tree); - - function processNode(entry) { - if (entry.processed) return entry; - entry.processed = true; - - var elementNode = entry.domNode; - var parentNode = elementNode.parentNode; - lookup.set(elementNode, entry); - - var parentEntry; - while (parentNode) { - parentEntry = lookup.get(parentNode); - if (parentEntry) { - if (!parentEntry.processed) { - parentEntry = processNode(parentEntry); - } - break; - } - parentNode = parentNode.parentNode; - } - - (parentEntry || tree).children.push(entry); - return entry; - } - - function flatten(tree) { - var result = []; - var queue = []; - var i; - - for (i = 0; i < tree.children.length; i++) { - queue.push(tree.children[i]); - } - - var remainingLevelEntries = queue.length; - var nextLevelEntries = 0; - var row = []; - - for (i = 0; i < queue.length; i++) { - var entry = queue[i]; - if (remainingLevelEntries <= 0) { - remainingLevelEntries = nextLevelEntries; - nextLevelEntries = 0; - result.push(row); - row = []; - } - row.push(entry); - entry.children.forEach(function(childEntry) { - nextLevelEntries++; - queue.push(childEntry); - }); - remainingLevelEntries--; - } - - if (row.length) { - result.push(row); - } - - return result; - } - } - - // TODO(matsko): document the signature in a better way - return function(element, event, options) { - options = prepareAnimationOptions(options); - var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0; - - // there is no animation at the current moment, however - // these runner methods will get later updated with the - // methods leading into the driver's end/cancel methods - // for now they just stop the animation from starting - var runner = new $$AnimateRunner({ - end: function() { close(); }, - cancel: function() { close(true); } - }); - - if (!drivers.length) { - close(); - return runner; - } - - var classes = mergeClasses(element.attr('class'), mergeClasses(options.addClass, options.removeClass)); - var tempClasses = options.tempClasses; - if (tempClasses) { - classes += ' ' + tempClasses; - options.tempClasses = null; - } - - if (isStructural) { - element.data(PREPARE_CLASSES_KEY, 'ng-' + event + PREPARE_CLASS_SUFFIX); - } - - setRunner(element, runner); - - animationQueue.push({ - // this data is used by the postDigest code and passed into - // the driver step function - element: element, - classes: classes, - event: event, - structural: isStructural, - options: options, - beforeStart: beforeStart, - close: close - }); - - element.on('$destroy', handleDestroyedElement); - - // we only want there to be one function called within the post digest - // block. This way we can group animations for all the animations that - // were apart of the same postDigest flush call. - if (animationQueue.length > 1) return runner; - - $rootScope.$$postDigest(function() { - var animations = []; - forEach(animationQueue, function(entry) { - // the element was destroyed early on which removed the runner - // form its storage. This means we can't animate this element - // at all and it already has been closed due to destruction. - if (getRunner(entry.element)) { - animations.push(entry); - } else { - entry.close(); - } - }); - - // now any future animations will be in another postDigest - animationQueue.length = 0; - - var groupedAnimations = groupAnimations(animations); - var toBeSortedAnimations = []; - - forEach(groupedAnimations, function(animationEntry) { - var element = animationEntry.from ? animationEntry.from.element : animationEntry.element; - var extraClasses = options.addClass; - - extraClasses = (extraClasses ? (extraClasses + ' ') : '') + NG_ANIMATE_CLASSNAME; - var cacheKey = $$animateCache.cacheKey(element[0], animationEntry.event, extraClasses, options.removeClass); - - toBeSortedAnimations.push({ - element: element, - domNode: getDomNode(element), - fn: function triggerAnimationStart() { - var startAnimationFn, closeFn = animationEntry.close; - - // in the event that we've cached the animation status for this element - // and it's in fact an invalid animation (something that has duration = 0) - // then we should skip all the heavy work from here on - if ($$animateCache.containsCachedAnimationWithoutDuration(cacheKey)) { - closeFn(); - return; - } - - // it's important that we apply the `ng-animate` CSS class and the - // temporary classes before we do any driver invoking since these - // CSS classes may be required for proper CSS detection. - animationEntry.beforeStart(); - - // in the event that the element was removed before the digest runs or - // during the RAF sequencing then we should not trigger the animation. - var targetElement = animationEntry.anchors - ? (animationEntry.from.element || animationEntry.to.element) - : animationEntry.element; - - if (getRunner(targetElement)) { - var operation = invokeFirstDriver(animationEntry); - if (operation) { - startAnimationFn = operation.start; - } - } - - if (!startAnimationFn) { - closeFn(); - } else { - var animationRunner = startAnimationFn(); - animationRunner.done(function(status) { - closeFn(!status); - }); - updateAnimationRunners(animationEntry, animationRunner); - } - } - }); - }); - - // we need to sort each of the animations in order of parent to child - // relationships. This ensures that the child classes are applied at the - // right time. - var finalAnimations = sortAnimations(toBeSortedAnimations); - for (var i = 0; i < finalAnimations.length; i++) { - var innerArray = finalAnimations[i]; - for (var j = 0; j < innerArray.length; j++) { - var entry = innerArray[j]; - var element = entry.element; - - // the RAFScheduler code only uses functions - finalAnimations[i][j] = entry.fn; - - // the first row of elements shouldn't have a prepare-class added to them - // since the elements are at the top of the animation hierarchy and they - // will be applied without a RAF having to pass... - if (i === 0) { - element.removeData(PREPARE_CLASSES_KEY); - continue; - } - - var prepareClassName = element.data(PREPARE_CLASSES_KEY); - if (prepareClassName) { - $$jqLite.addClass(element, prepareClassName); - } - } - } - - $$rAFScheduler(finalAnimations); - }); - - return runner; - - // TODO(matsko): change to reference nodes - function getAnchorNodes(node) { - var SELECTOR = '[' + NG_ANIMATE_REF_ATTR + ']'; - var items = node.hasAttribute(NG_ANIMATE_REF_ATTR) - ? [node] - : node.querySelectorAll(SELECTOR); - var anchors = []; - forEach(items, function(node) { - var attr = node.getAttribute(NG_ANIMATE_REF_ATTR); - if (attr && attr.length) { - anchors.push(node); - } - }); - return anchors; - } - - function groupAnimations(animations) { - var preparedAnimations = []; - var refLookup = {}; - forEach(animations, function(animation, index) { - var element = animation.element; - var node = getDomNode(element); - var event = animation.event; - var enterOrMove = ['enter', 'move'].indexOf(event) >= 0; - var anchorNodes = animation.structural ? getAnchorNodes(node) : []; - - if (anchorNodes.length) { - var direction = enterOrMove ? 'to' : 'from'; - - forEach(anchorNodes, function(anchor) { - var key = anchor.getAttribute(NG_ANIMATE_REF_ATTR); - refLookup[key] = refLookup[key] || {}; - refLookup[key][direction] = { - animationID: index, - element: jqLite(anchor) - }; - }); - } else { - preparedAnimations.push(animation); - } - }); - - var usedIndicesLookup = {}; - var anchorGroups = {}; - forEach(refLookup, function(operations, key) { - var from = operations.from; - var to = operations.to; - - if (!from || !to) { - // only one of these is set therefore we can't have an - // anchor animation since all three pieces are required - var index = from ? from.animationID : to.animationID; - var indexKey = index.toString(); - if (!usedIndicesLookup[indexKey]) { - usedIndicesLookup[indexKey] = true; - preparedAnimations.push(animations[index]); - } - return; - } - - var fromAnimation = animations[from.animationID]; - var toAnimation = animations[to.animationID]; - var lookupKey = from.animationID.toString(); - if (!anchorGroups[lookupKey]) { - var group = anchorGroups[lookupKey] = { - structural: true, - beforeStart: function() { - fromAnimation.beforeStart(); - toAnimation.beforeStart(); - }, - close: function() { - fromAnimation.close(); - toAnimation.close(); - }, - classes: cssClassesIntersection(fromAnimation.classes, toAnimation.classes), - from: fromAnimation, - to: toAnimation, - anchors: [] // TODO(matsko): change to reference nodes - }; - - // the anchor animations require that the from and to elements both have at least - // one shared CSS class which effectively marries the two elements together to use - // the same animation driver and to properly sequence the anchor animation. - if (group.classes.length) { - preparedAnimations.push(group); - } else { - preparedAnimations.push(fromAnimation); - preparedAnimations.push(toAnimation); - } - } - - anchorGroups[lookupKey].anchors.push({ - 'out': from.element, 'in': to.element - }); - }); - - return preparedAnimations; - } - - function cssClassesIntersection(a,b) { - a = a.split(' '); - b = b.split(' '); - var matches = []; - - for (var i = 0; i < a.length; i++) { - var aa = a[i]; - if (aa.substring(0,3) === 'ng-') continue; - - for (var j = 0; j < b.length; j++) { - if (aa === b[j]) { - matches.push(aa); - break; - } - } - } - - return matches.join(' '); - } - - function invokeFirstDriver(animationDetails) { - // we loop in reverse order since the more general drivers (like CSS and JS) - // may attempt more elements, but custom drivers are more particular - for (var i = drivers.length - 1; i >= 0; i--) { - var driverName = drivers[i]; - var factory = $injector.get(driverName); - var driver = factory(animationDetails); - if (driver) { - return driver; - } - } - } - - function beforeStart() { - tempClasses = (tempClasses ? (tempClasses + ' ') : '') + NG_ANIMATE_CLASSNAME; - $$jqLite.addClass(element, tempClasses); - - var prepareClassName = element.data(PREPARE_CLASSES_KEY); - if (prepareClassName) { - $$jqLite.removeClass(element, prepareClassName); - prepareClassName = null; - } - } - - function updateAnimationRunners(animation, newRunner) { - if (animation.from && animation.to) { - update(animation.from.element); - update(animation.to.element); - } else { - update(animation.element); - } - - function update(element) { - var runner = getRunner(element); - if (runner) runner.setHost(newRunner); - } - } - - function handleDestroyedElement() { - var runner = getRunner(element); - if (runner && (event !== 'leave' || !options.$$domOperationFired)) { - runner.end(); - } - } - - function close(rejected) { - element.off('$destroy', handleDestroyedElement); - removeRunner(element); - - applyAnimationClasses(element, options); - applyAnimationStyles(element, options); - options.domOperation(); - - if (tempClasses) { - $$jqLite.removeClass(element, tempClasses); - } - - runner.complete(!rejected); - } - }; - }]; -}]; - -/** - * @ngdoc directive - * @name ngAnimateSwap - * @restrict A - * @scope - * - * @description - * - * ngAnimateSwap is a animation-oriented directive that allows for the container to - * be removed and entered in whenever the associated expression changes. A - * common usecase for this directive is a rotating banner or slider component which - * contains one image being present at a time. When the active image changes - * then the old image will perform a `leave` animation and the new element - * will be inserted via an `enter` animation. - * - * @animations - * | Animation | Occurs | - * |----------------------------------|--------------------------------------| - * | {@link ng.$animate#enter enter} | when the new element is inserted to the DOM | - * | {@link ng.$animate#leave leave} | when the old element is removed from the DOM | - * - * @example - * - * - *
    - *
    - * {{ number }} - *
    - *
    - *
    - * - * angular.module('ngAnimateSwapExample', ['ngAnimate']) - * .controller('AppCtrl', ['$scope', '$interval', function($scope, $interval) { - * $scope.number = 0; - * $interval(function() { - * $scope.number++; - * }, 1000); - * - * var colors = ['red','blue','green','yellow','orange']; - * $scope.colorClass = function(number) { - * return colors[number % colors.length]; - * }; - * }]); - * - * - * .container { - * height:250px; - * width:250px; - * position:relative; - * overflow:hidden; - * border:2px solid black; - * } - * .container .cell { - * font-size:150px; - * text-align:center; - * line-height:250px; - * position:absolute; - * top:0; - * left:0; - * right:0; - * border-bottom:2px solid black; - * } - * .swap-animation.ng-enter, .swap-animation.ng-leave { - * transition:0.5s linear all; - * } - * .swap-animation.ng-enter { - * top:-250px; - * } - * .swap-animation.ng-enter-active { - * top:0px; - * } - * .swap-animation.ng-leave { - * top:0px; - * } - * .swap-animation.ng-leave-active { - * top:250px; - * } - * .red { background:red; } - * .green { background:green; } - * .blue { background:blue; } - * .yellow { background:yellow; } - * .orange { background:orange; } - * - *
    - */ -var ngAnimateSwapDirective = ['$animate', function($animate) { - return { - restrict: 'A', - transclude: 'element', - terminal: true, - priority: 550, // We use 550 here to ensure that the directive is caught before others, - // but after `ngIf` (at priority 600). - link: function(scope, $element, attrs, ctrl, $transclude) { - var previousElement, previousScope; - scope.$watchCollection(attrs.ngAnimateSwap || attrs['for'], function(value) { - if (previousElement) { - $animate.leave(previousElement); - } - if (previousScope) { - previousScope.$destroy(); - previousScope = null; - } - if (value || value === 0) { - $transclude(function(clone, childScope) { - previousElement = clone; - previousScope = childScope; - $animate.enter(clone, null, $element); - }); - } - }); - } - }; -}]; - -/** - * @ngdoc module - * @name ngAnimate - * @description - * - * The `ngAnimate` module provides support for CSS-based animations (keyframes and transitions) as well as JavaScript-based animations via - * callback hooks. Animations are not enabled by default, however, by including `ngAnimate` the animation hooks are enabled for an AngularJS app. - * - * ## Usage - * Simply put, there are two ways to make use of animations when ngAnimate is used: by using **CSS** and **JavaScript**. The former works purely based - * using CSS (by using matching CSS selectors/styles) and the latter triggers animations that are registered via `module.animation()`. For - * both CSS and JS animations the sole requirement is to have a matching `CSS class` that exists both in the registered animation and within - * the HTML element that the animation will be triggered on. - * - * ## Directive Support - * The following directives are "animation aware": - * - * | Directive | Supported Animations | - * |-------------------------------------------------------------------------------|---------------------------------------------------------------------------| - * | {@link ng.directive:form#animations form / ngForm} | add and remove ({@link ng.directive:form#css-classes various classes}) | - * | {@link ngAnimate.directive:ngAnimateSwap#animations ngAnimateSwap} | enter and leave | - * | {@link ng.directive:ngClass#animations ngClass / {{class}​}} | add and remove | - * | {@link ng.directive:ngClassEven#animations ngClassEven} | add and remove | - * | {@link ng.directive:ngClassOdd#animations ngClassOdd} | add and remove | - * | {@link ng.directive:ngHide#animations ngHide} | add and remove (the `ng-hide` class) | - * | {@link ng.directive:ngIf#animations ngIf} | enter and leave | - * | {@link ng.directive:ngInclude#animations ngInclude} | enter and leave | - * | {@link module:ngMessages#animations ngMessage / ngMessageExp} | enter and leave | - * | {@link module:ngMessages#animations ngMessages} | add and remove (the `ng-active`/`ng-inactive` classes) | - * | {@link ng.directive:ngModel#animations ngModel} | add and remove ({@link ng.directive:ngModel#css-classes various classes}) | - * | {@link ng.directive:ngRepeat#animations ngRepeat} | enter, leave, and move | - * | {@link ng.directive:ngShow#animations ngShow} | add and remove (the `ng-hide` class) | - * | {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave | - * | {@link ngRoute.directive:ngView#animations ngView} | enter and leave | - * - * (More information can be found by visiting the documentation associated with each directive.) - * - * For a full breakdown of the steps involved during each animation event, refer to the - * {@link ng.$animate `$animate` API docs}. - * - * ## CSS-based Animations - * - * CSS-based animations with ngAnimate are unique since they require no JavaScript code at all. By using a CSS class that we reference between our HTML - * and CSS code we can create an animation that will be picked up by AngularJS when an underlying directive performs an operation. - * - * The example below shows how an `enter` animation can be made possible on an element using `ng-if`: - * - * ```html - *
    - * Fade me in out - *
    - * - * - * ``` - * - * Notice the CSS class **fade**? We can now create the CSS transition code that references this class: - * - * ```css - * /* The starting CSS styles for the enter animation */ - * .fade.ng-enter { - * transition:0.5s linear all; - * opacity:0; - * } - * - * /* The finishing CSS styles for the enter animation */ - * .fade.ng-enter.ng-enter-active { - * opacity:1; - * } - * ``` - * - * The key thing to remember here is that, depending on the animation event (which each of the directives above trigger depending on what's going on) two - * generated CSS classes will be applied to the element; in the example above we have `.ng-enter` and `.ng-enter-active`. For CSS transitions, the transition - * code **must** be defined within the starting CSS class (in this case `.ng-enter`). The destination class is what the transition will animate towards. - * - * If for example we wanted to create animations for `leave` and `move` (ngRepeat triggers move) then we can do so using the same CSS naming conventions: - * - * ```css - * /* now the element will fade out before it is removed from the DOM */ - * .fade.ng-leave { - * transition:0.5s linear all; - * opacity:1; - * } - * .fade.ng-leave.ng-leave-active { - * opacity:0; - * } - * ``` - * - * We can also make use of **CSS Keyframes** by referencing the keyframe animation within the starting CSS class: - * - * ```css - * /* there is no need to define anything inside of the destination - * CSS class since the keyframe will take charge of the animation */ - * .fade.ng-leave { - * animation: my_fade_animation 0.5s linear; - * -webkit-animation: my_fade_animation 0.5s linear; - * } - * - * @keyframes my_fade_animation { - * from { opacity:1; } - * to { opacity:0; } - * } - * - * @-webkit-keyframes my_fade_animation { - * from { opacity:1; } - * to { opacity:0; } - * } - * ``` - * - * Feel free also mix transitions and keyframes together as well as any other CSS classes on the same element. - * - * ### CSS Class-based Animations - * - * Class-based animations (animations that are triggered via `ngClass`, `ngShow`, `ngHide` and some other directives) have a slightly different - * naming convention. Class-based animations are basic enough that a standard transition or keyframe can be referenced on the class being added - * and removed. - * - * For example if we wanted to do a CSS animation for `ngHide` then we place an animation on the `.ng-hide` CSS class: - * - * ```html - *
    - * Show and hide me - *
    - * - * - * - * ``` - * - * All that is going on here with ngShow/ngHide behind the scenes is the `.ng-hide` class is added/removed (when the hidden state is valid). Since - * ngShow and ngHide are animation aware then we can match up a transition and ngAnimate handles the rest. - * - * In addition the addition and removal of the CSS class, ngAnimate also provides two helper methods that we can use to further decorate the animation - * with CSS styles. - * - * ```html - *
    - * Highlight this box - *
    - * - * - * - * ``` - * - * We can also make use of CSS keyframes by placing them within the CSS classes. - * - * - * ### CSS Staggering Animations - * A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a - * curtain-like effect. The ngAnimate module (versions >=1.2) supports staggering animations and the stagger effect can be - * performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for - * the animation. The style property expected within the stagger class can either be a **transition-delay** or an - * **animation-delay** property (or both if your animation contains both transitions and keyframe animations). - * - * ```css - * .my-animation.ng-enter { - * /* standard transition code */ - * transition: 1s linear all; - * opacity:0; - * } - * .my-animation.ng-enter-stagger { - * /* this will have a 100ms delay between each successive leave animation */ - * transition-delay: 0.1s; - * - * /* As of 1.4.4, this must always be set: it signals ngAnimate - * to not accidentally inherit a delay property from another CSS class */ - * transition-duration: 0s; - * - * /* if you are using animations instead of transitions you should configure as follows: - * animation-delay: 0.1s; - * animation-duration: 0s; */ - * } - * .my-animation.ng-enter.ng-enter-active { - * /* standard transition styles */ - * opacity:1; - * } - * ``` - * - * Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations - * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this - * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation - * will also be reset if one or more animation frames have passed since the multiple calls to `$animate` were fired. - * - * The following code will issue the **ng-leave-stagger** event on the element provided: - * - * ```js - * var kids = parent.children(); - * - * $animate.leave(kids[0]); //stagger index=0 - * $animate.leave(kids[1]); //stagger index=1 - * $animate.leave(kids[2]); //stagger index=2 - * $animate.leave(kids[3]); //stagger index=3 - * $animate.leave(kids[4]); //stagger index=4 - * - * window.requestAnimationFrame(function() { - * //stagger has reset itself - * $animate.leave(kids[5]); //stagger index=0 - * $animate.leave(kids[6]); //stagger index=1 - * - * $scope.$digest(); - * }); - * ``` - * - * Stagger animations are currently only supported within CSS-defined animations. - * - * ### The `ng-animate` CSS class - * - * When ngAnimate is animating an element it will apply the `ng-animate` CSS class to the element for the duration of the animation. - * This is a temporary CSS class and it will be removed once the animation is over (for both JavaScript and CSS-based animations). - * - * Therefore, animations can be applied to an element using this temporary class directly via CSS. - * - * ```css - * .zipper.ng-animate { - * transition:0.5s linear all; - * } - * .zipper.ng-enter { - * opacity:0; - * } - * .zipper.ng-enter.ng-enter-active { - * opacity:1; - * } - * .zipper.ng-leave { - * opacity:1; - * } - * .zipper.ng-leave.ng-leave-active { - * opacity:0; - * } - * ``` - * - * (Note that the `ng-animate` CSS class is reserved and it cannot be applied on an element directly since ngAnimate will always remove - * the CSS class once an animation has completed.) - * - * - * ### The `ng-[event]-prepare` class - * - * This is a special class that can be used to prevent unwanted flickering / flash of content before - * the actual animation starts. The class is added as soon as an animation is initialized, but removed - * before the actual animation starts (after waiting for a $digest). - * It is also only added for *structural* animations (`enter`, `move`, and `leave`). - * - * In practice, flickering can appear when nesting elements with structural animations such as `ngIf` - * into elements that have class-based animations such as `ngClass`. - * - * ```html - *
    - *
    - *
    - *
    - *
    - * ``` - * - * It is possible that during the `enter` animation, the `.message` div will be briefly visible before it starts animating. - * In that case, you can add styles to the CSS that make sure the element stays hidden before the animation starts: - * - * ```css - * .message.ng-enter-prepare { - * opacity: 0; - * } - * ``` - * - * ### Animating between value changes - * - * Sometimes you need to animate between different expression states, whose values - * don't necessary need to be known or referenced in CSS styles. - * Unless possible with another {@link ngAnimate#directive-support "animation aware" directive}, - * that specific use case can always be covered with {@link ngAnimate.directive:ngAnimateSwap} as - * can be seen in {@link ngAnimate.directive:ngAnimateSwap#examples this example}. - * - * Note that {@link ngAnimate.directive:ngAnimateSwap} is a *structural directive*, which means it - * creates a new instance of the element (including any other/child directives it may have) and - * links it to a new scope every time *swap* happens. In some cases this might not be desirable - * (e.g. for performance reasons, or when you wish to retain internal state on the original - * element instance). - * - * ## JavaScript-based Animations - * - * ngAnimate also allows for animations to be consumed by JavaScript code. The approach is similar to CSS-based animations (where there is a shared - * CSS class that is referenced in our HTML code) but in addition we need to register the JavaScript animation on the module. By making use of the - * `module.animation()` module function we can register the animation. - * - * Let's see an example of a enter/leave animation using `ngRepeat`: - * - * ```html - *
    - * {{ item }} - *
    - * ``` - * - * See the **slide** CSS class? Let's use that class to define an animation that we'll structure in our module code by using `module.animation`: - * - * ```js - * myModule.animation('.slide', [function() { - * return { - * // make note that other events (like addClass/removeClass) - * // have different function input parameters - * enter: function(element, doneFn) { - * jQuery(element).fadeIn(1000, doneFn); - * - * // remember to call doneFn so that AngularJS - * // knows that the animation has concluded - * }, - * - * move: function(element, doneFn) { - * jQuery(element).fadeIn(1000, doneFn); - * }, - * - * leave: function(element, doneFn) { - * jQuery(element).fadeOut(1000, doneFn); - * } - * } - * }]); - * ``` - * - * The nice thing about JS-based animations is that we can inject other services and make use of advanced animation libraries such as - * greensock.js and velocity.js. - * - * If our animation code class-based (meaning that something like `ngClass`, `ngHide` and `ngShow` triggers it) then we can still define - * our animations inside of the same registered animation, however, the function input arguments are a bit different: - * - * ```html - *
    - * this box is moody - *
    - * - * - * - * ``` - * - * ```js - * myModule.animation('.colorful', [function() { - * return { - * addClass: function(element, className, doneFn) { - * // do some cool animation and call the doneFn - * }, - * removeClass: function(element, className, doneFn) { - * // do some cool animation and call the doneFn - * }, - * setClass: function(element, addedClass, removedClass, doneFn) { - * // do some cool animation and call the doneFn - * } - * } - * }]); - * ``` - * - * ## CSS + JS Animations Together - * - * AngularJS 1.4 and higher has taken steps to make the amalgamation of CSS and JS animations more flexible. However, unlike earlier versions of AngularJS, - * defining CSS and JS animations to work off of the same CSS class will not work anymore. Therefore the example below will only result in **JS animations taking - * charge of the animation**: - * - * ```html - *
    - * Slide in and out - *
    - * ``` - * - * ```js - * myModule.animation('.slide', [function() { - * return { - * enter: function(element, doneFn) { - * jQuery(element).slideIn(1000, doneFn); - * } - * } - * }]); - * ``` - * - * ```css - * .slide.ng-enter { - * transition:0.5s linear all; - * transform:translateY(-100px); - * } - * .slide.ng-enter.ng-enter-active { - * transform:translateY(0); - * } - * ``` - * - * Does this mean that CSS and JS animations cannot be used together? Do JS-based animations always have higher priority? We can make up for the - * lack of CSS animations by using the `$animateCss` service to trigger our own tweaked-out, CSS-based animations directly from - * our own JS-based animation code: - * - * ```js - * myModule.animation('.slide', ['$animateCss', function($animateCss) { - * return { - * enter: function(element) { -* // this will trigger `.slide.ng-enter` and `.slide.ng-enter-active`. - * return $animateCss(element, { - * event: 'enter', - * structural: true - * }); - * } - * } - * }]); - * ``` - * - * The nice thing here is that we can save bandwidth by sticking to our CSS-based animation code and we don't need to rely on a 3rd-party animation framework. - * - * The `$animateCss` service is very powerful since we can feed in all kinds of extra properties that will be evaluated and fed into a CSS transition or - * keyframe animation. For example if we wanted to animate the height of an element while adding and removing classes then we can do so by providing that - * data into `$animateCss` directly: - * - * ```js - * myModule.animation('.slide', ['$animateCss', function($animateCss) { - * return { - * enter: function(element) { - * return $animateCss(element, { - * event: 'enter', - * structural: true, - * addClass: 'maroon-setting', - * from: { height:0 }, - * to: { height: 200 } - * }); - * } - * } - * }]); - * ``` - * - * Now we can fill in the rest via our transition CSS code: - * - * ```css - * /* the transition tells ngAnimate to make the animation happen */ - * .slide.ng-enter { transition:0.5s linear all; } - * - * /* this extra CSS class will be absorbed into the transition - * since the $animateCss code is adding the class */ - * .maroon-setting { background:red; } - * ``` - * - * And `$animateCss` will figure out the rest. Just make sure to have the `done()` callback fire the `doneFn` function to signal when the animation is over. - * - * To learn more about what's possible be sure to visit the {@link ngAnimate.$animateCss $animateCss service}. - * - * ## Animation Anchoring (via `ng-animate-ref`) - * - * ngAnimate in AngularJS 1.4 comes packed with the ability to cross-animate elements between - * structural areas of an application (like views) by pairing up elements using an attribute - * called `ng-animate-ref`. - * - * Let's say for example we have two views that are managed by `ng-view` and we want to show - * that there is a relationship between two components situated in within these views. By using the - * `ng-animate-ref` attribute we can identify that the two components are paired together and we - * can then attach an animation, which is triggered when the view changes. - * - * Say for example we have the following template code: - * - * ```html - * - *
    - *
    - * - * - *
    - * - * - * - * - * - * ``` - * - * Now, when the view changes (once the link is clicked), ngAnimate will examine the - * HTML contents to see if there is a match reference between any components in the view - * that is leaving and the view that is entering. It will scan both the view which is being - * removed (leave) and inserted (enter) to see if there are any paired DOM elements that - * contain a matching ref value. - * - * The two images match since they share the same ref value. ngAnimate will now create a - * transport element (which is a clone of the first image element) and it will then attempt - * to animate to the position of the second image element in the next view. For the animation to - * work a special CSS class called `ng-anchor` will be added to the transported element. - * - * We can now attach a transition onto the `.banner.ng-anchor` CSS class and then - * ngAnimate will handle the entire transition for us as well as the addition and removal of - * any changes of CSS classes between the elements: - * - * ```css - * .banner.ng-anchor { - * /* this animation will last for 1 second since there are - * two phases to the animation (an `in` and an `out` phase) */ - * transition:0.5s linear all; - * } - * ``` - * - * We also **must** include animations for the views that are being entered and removed - * (otherwise anchoring wouldn't be possible since the new view would be inserted right away). - * - * ```css - * .view-animation.ng-enter, .view-animation.ng-leave { - * transition:0.5s linear all; - * position:fixed; - * left:0; - * top:0; - * width:100%; - * } - * .view-animation.ng-enter { - * transform:translateX(100%); - * } - * .view-animation.ng-leave, - * .view-animation.ng-enter.ng-enter-active { - * transform:translateX(0%); - * } - * .view-animation.ng-leave.ng-leave-active { - * transform:translateX(-100%); - * } - * ``` - * - * Now we can jump back to the anchor animation. When the animation happens, there are two stages that occur: - * an `out` and an `in` stage. The `out` stage happens first and that is when the element is animated away - * from its origin. Once that animation is over then the `in` stage occurs which animates the - * element to its destination. The reason why there are two animations is to give enough time - * for the enter animation on the new element to be ready. - * - * The example above sets up a transition for both the in and out phases, but we can also target the out or - * in phases directly via `ng-anchor-out` and `ng-anchor-in`. - * - * ```css - * .banner.ng-anchor-out { - * transition: 0.5s linear all; - * - * /* the scale will be applied during the out animation, - * but will be animated away when the in animation runs */ - * transform: scale(1.2); - * } - * - * .banner.ng-anchor-in { - * transition: 1s linear all; - * } - * ``` - * - * - * - * - * ### Anchoring Demo - * - - - Home -
    -
    -
    -
    -
    - - angular.module('anchoringExample', ['ngAnimate', 'ngRoute']) - .config(['$routeProvider', function($routeProvider) { - $routeProvider.when('/', { - templateUrl: 'home.html', - controller: 'HomeController as home' - }); - $routeProvider.when('/profile/:id', { - templateUrl: 'profile.html', - controller: 'ProfileController as profile' - }); - }]) - .run(['$rootScope', function($rootScope) { - $rootScope.records = [ - { id: 1, title: 'Miss Beulah Roob' }, - { id: 2, title: 'Trent Morissette' }, - { id: 3, title: 'Miss Ava Pouros' }, - { id: 4, title: 'Rod Pouros' }, - { id: 5, title: 'Abdul Rice' }, - { id: 6, title: 'Laurie Rutherford Sr.' }, - { id: 7, title: 'Nakia McLaughlin' }, - { id: 8, title: 'Jordon Blanda DVM' }, - { id: 9, title: 'Rhoda Hand' }, - { id: 10, title: 'Alexandrea Sauer' } - ]; - }]) - .controller('HomeController', [function() { - //empty - }]) - .controller('ProfileController', ['$rootScope', '$routeParams', - function ProfileController($rootScope, $routeParams) { - var index = parseInt($routeParams.id, 10); - var record = $rootScope.records[index - 1]; - - this.title = record.title; - this.id = record.id; - }]); - - -

    Welcome to the home page

    -

    Please click on an element

    - - {{ record.title }} - -
    - -
    - {{ profile.title }} -
    -
    - - .record { - display:block; - font-size:20px; - } - .profile { - background:black; - color:white; - font-size:100px; - } - .view-container { - position:relative; - } - .view-container > .view.ng-animate { - position:absolute; - top:0; - left:0; - width:100%; - min-height:500px; - } - .view.ng-enter, .view.ng-leave, - .record.ng-anchor { - transition:0.5s linear all; - } - .view.ng-enter { - transform:translateX(100%); - } - .view.ng-enter.ng-enter-active, .view.ng-leave { - transform:translateX(0%); - } - .view.ng-leave.ng-leave-active { - transform:translateX(-100%); - } - .record.ng-anchor-out { - background:red; - } - -
    - * - * ### How is the element transported? - * - * When an anchor animation occurs, ngAnimate will clone the starting element and position it exactly where the starting - * element is located on screen via absolute positioning. The cloned element will be placed inside of the root element - * of the application (where ng-app was defined) and all of the CSS classes of the starting element will be applied. The - * element will then animate into the `out` and `in` animations and will eventually reach the coordinates and match - * the dimensions of the destination element. During the entire animation a CSS class of `.ng-animate-shim` will be applied - * to both the starting and destination elements in order to hide them from being visible (the CSS styling for the class - * is: `visibility:hidden`). Once the anchor reaches its destination then it will be removed and the destination element - * will become visible since the shim class will be removed. - * - * ### How is the morphing handled? - * - * CSS Anchoring relies on transitions and keyframes and the internal code is intelligent enough to figure out - * what CSS classes differ between the starting element and the destination element. These different CSS classes - * will be added/removed on the anchor element and a transition will be applied (the transition that is provided - * in the anchor class). Long story short, ngAnimate will figure out what classes to add and remove which will - * make the transition of the element as smooth and automatic as possible. Be sure to use simple CSS classes that - * do not rely on DOM nesting structure so that the anchor element appears the same as the starting element (since - * the cloned element is placed inside of root element which is likely close to the body element). - * - * Note that if the root element is on the `` element then the cloned node will be placed inside of body. - * - * - * ## Using $animate in your directive code - * - * So far we've explored how to feed in animations into an AngularJS application, but how do we trigger animations within our own directives in our application? - * By injecting the `$animate` service into our directive code, we can trigger structural and class-based hooks which can then be consumed by animations. Let's - * imagine we have a greeting box that shows and hides itself when the data changes - * - * ```html - * Hi there - * ``` - * - * ```js - * ngModule.directive('greetingBox', ['$animate', function($animate) { - * return function(scope, element, attrs) { - * attrs.$observe('active', function(value) { - * value ? $animate.addClass(element, 'on') : $animate.removeClass(element, 'on'); - * }); - * }); - * }]); - * ``` - * - * Now the `on` CSS class is added and removed on the greeting box component. Now if we add a CSS class on top of the greeting box element - * in our HTML code then we can trigger a CSS or JS animation to happen. - * - * ```css - * /* normally we would create a CSS class to reference on the element */ - * greeting-box.on { transition:0.5s linear all; background:green; color:white; } - * ``` - * - * The `$animate` service contains a variety of other methods like `enter`, `leave`, `animate` and `setClass`. To learn more about what's - * possible be sure to visit the {@link ng.$animate $animate service API page}. - * - * - * ## Callbacks and Promises - * - * When `$animate` is called it returns a promise that can be used to capture when the animation has ended. Therefore if we were to trigger - * an animation (within our directive code) then we can continue performing directive and scope related activities after the animation has - * ended by chaining onto the returned promise that animation method returns. - * - * ```js - * // somewhere within the depths of the directive - * $animate.enter(element, parent).then(function() { - * //the animation has completed - * }); - * ``` - * - * (Note that earlier versions of AngularJS prior to v1.4 required the promise code to be wrapped using `$scope.$apply(...)`. This is not the case - * anymore.) - * - * In addition to the animation promise, we can also make use of animation-related callbacks within our directives and controller code by registering - * an event listener using the `$animate` service. Let's say for example that an animation was triggered on our view - * routing controller to hook into that: - * - * ```js - * ngModule.controller('HomePageController', ['$animate', function($animate) { - * $animate.on('enter', ngViewElement, function(element) { - * // the animation for this route has completed - * }]); - * }]) - * ``` - * - * (Note that you will need to trigger a digest within the callback to get AngularJS to notice any scope-related changes.) - */ - -var copy; -var extend; -var forEach; -var isArray; -var isDefined; -var isElement; -var isFunction; -var isObject; -var isString; -var isUndefined; -var jqLite; -var noop; - -/** - * @ngdoc service - * @name $animate - * @kind object - * - * @description - * The ngAnimate `$animate` service documentation is the same for the core `$animate` service. - * - * Click here {@link ng.$animate to learn more about animations with `$animate`}. - */ -angular.module('ngAnimate', [], function initAngularHelpers() { - // Access helpers from AngularJS core. - // Do it inside a `config` block to ensure `window.angular` is available. - noop = angular.noop; - copy = angular.copy; - extend = angular.extend; - jqLite = angular.element; - forEach = angular.forEach; - isArray = angular.isArray; - isString = angular.isString; - isObject = angular.isObject; - isUndefined = angular.isUndefined; - isDefined = angular.isDefined; - isFunction = angular.isFunction; - isElement = angular.isElement; -}) - .info({ angularVersion: '1.8.2' }) - .directive('ngAnimateSwap', ngAnimateSwapDirective) - - .directive('ngAnimateChildren', $$AnimateChildrenDirective) - .factory('$$rAFScheduler', $$rAFSchedulerFactory) - - .provider('$$animateQueue', $$AnimateQueueProvider) - .provider('$$animateCache', $$AnimateCacheProvider) - .provider('$$animation', $$AnimationProvider) - - .provider('$animateCss', $AnimateCssProvider) - .provider('$$animateCssDriver', $$AnimateCssDriverProvider) - - .provider('$$animateJs', $$AnimateJsProvider) - .provider('$$animateJsDriver', $$AnimateJsDriverProvider); - - -})(window, window.angular); - - -/***/ }), - -/***/ "./node_modules/angular-animate/index.js": -/*!***********************************************!*\ - !*** ./node_modules/angular-animate/index.js ***! - \***********************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -__webpack_require__(/*! ./angular-animate */ "./node_modules/angular-animate/angular-animate.js"); -module.exports = 'ngAnimate'; - - -/***/ }), - -/***/ "./node_modules/angular-aria/angular-aria.js": -/*!***************************************************!*\ - !*** ./node_modules/angular-aria/angular-aria.js ***! - \***************************************************/ -/***/ (() => { - -/** - * @license AngularJS v1.8.2 - * (c) 2010-2020 Google LLC. http://angularjs.org - * License: MIT - */ -(function(window, angular) {'use strict'; - -/** - * @ngdoc module - * @name ngAria - * @description - * - * The `ngAria` module provides support for common - * [ARIA](http://www.w3.org/TR/wai-aria/) - * attributes that convey state or semantic information about the application for users - * of assistive technologies, such as screen readers. - * - * ## Usage - * - * For ngAria to do its magic, simply include the module `ngAria` as a dependency. The following - * directives are supported: - * `ngModel`, `ngChecked`, `ngReadonly`, `ngRequired`, `ngValue`, `ngDisabled`, `ngShow`, `ngHide`, - * `ngClick`, `ngDblClick`, and `ngMessages`. - * - * Below is a more detailed breakdown of the attributes handled by ngAria: - * - * | Directive | Supported Attributes | - * |---------------------------------------------|-----------------------------------------------------------------------------------------------------| - * | {@link ng.directive:ngModel ngModel} | aria-checked, aria-valuemin, aria-valuemax, aria-valuenow, aria-invalid, aria-required, input roles | - * | {@link ng.directive:ngDisabled ngDisabled} | aria-disabled | - * | {@link ng.directive:ngRequired ngRequired} | aria-required | - * | {@link ng.directive:ngChecked ngChecked} | aria-checked | - * | {@link ng.directive:ngReadonly ngReadonly} | aria-readonly | - * | {@link ng.directive:ngValue ngValue} | aria-checked | - * | {@link ng.directive:ngShow ngShow} | aria-hidden | - * | {@link ng.directive:ngHide ngHide} | aria-hidden | - * | {@link ng.directive:ngDblclick ngDblclick} | tabindex | - * | {@link module:ngMessages ngMessages} | aria-live | - * | {@link ng.directive:ngClick ngClick} | tabindex, keydown event, button role | - * - * Find out more information about each directive by reading the - * {@link guide/accessibility ngAria Developer Guide}. - * - * ## Example - * Using ngDisabled with ngAria: - * ```html - * - * ``` - * Becomes: - * ```html - * - * ``` - * - * ## Disabling Specific Attributes - * It is possible to disable individual attributes added by ngAria with the - * {@link ngAria.$ariaProvider#config config} method. For more details, see the - * {@link guide/accessibility Developer Guide}. - * - * ## Disabling `ngAria` on Specific Elements - * It is possible to make `ngAria` ignore a specific element, by adding the `ng-aria-disable` - * attribute on it. Note that only the element itself (and not its child elements) will be ignored. - */ -var ARIA_DISABLE_ATTR = 'ngAriaDisable'; - -var ngAriaModule = angular.module('ngAria', ['ng']). - info({ angularVersion: '1.8.2' }). - provider('$aria', $AriaProvider); - -/** -* Internal Utilities -*/ -var nativeAriaNodeNames = ['BUTTON', 'A', 'INPUT', 'TEXTAREA', 'SELECT', 'DETAILS', 'SUMMARY']; - -var isNodeOneOf = function(elem, nodeTypeArray) { - if (nodeTypeArray.indexOf(elem[0].nodeName) !== -1) { - return true; - } -}; -/** - * @ngdoc provider - * @name $ariaProvider - * @this - * - * @description - * - * Used for configuring the ARIA attributes injected and managed by ngAria. - * - * ```js - * angular.module('myApp', ['ngAria'], function config($ariaProvider) { - * $ariaProvider.config({ - * ariaValue: true, - * tabindex: false - * }); - * }); - *``` - * - * ## Dependencies - * Requires the {@link ngAria} module to be installed. - * - */ -function $AriaProvider() { - var config = { - ariaHidden: true, - ariaChecked: true, - ariaReadonly: true, - ariaDisabled: true, - ariaRequired: true, - ariaInvalid: true, - ariaValue: true, - tabindex: true, - bindKeydown: true, - bindRoleForClick: true - }; - - /** - * @ngdoc method - * @name $ariaProvider#config - * - * @param {object} config object to enable/disable specific ARIA attributes - * - * - **ariaHidden** – `{boolean}` – Enables/disables aria-hidden tags - * - **ariaChecked** – `{boolean}` – Enables/disables aria-checked tags - * - **ariaReadonly** – `{boolean}` – Enables/disables aria-readonly tags - * - **ariaDisabled** – `{boolean}` – Enables/disables aria-disabled tags - * - **ariaRequired** – `{boolean}` – Enables/disables aria-required tags - * - **ariaInvalid** – `{boolean}` – Enables/disables aria-invalid tags - * - **ariaValue** – `{boolean}` – Enables/disables aria-valuemin, aria-valuemax and - * aria-valuenow tags - * - **tabindex** – `{boolean}` – Enables/disables tabindex tags - * - **bindKeydown** – `{boolean}` – Enables/disables keyboard event binding on non-interactive - * elements (such as `div` or `li`) using ng-click, making them more accessible to users of - * assistive technologies - * - **bindRoleForClick** – `{boolean}` – Adds role=button to non-interactive elements (such as - * `div` or `li`) using ng-click, making them more accessible to users of assistive - * technologies - * - * @description - * Enables/disables various ARIA attributes - */ - this.config = function(newConfig) { - config = angular.extend(config, newConfig); - }; - - function watchExpr(attrName, ariaAttr, nativeAriaNodeNames, negate) { - return function(scope, elem, attr) { - if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; - - var ariaCamelName = attr.$normalize(ariaAttr); - if (config[ariaCamelName] && !isNodeOneOf(elem, nativeAriaNodeNames) && !attr[ariaCamelName]) { - scope.$watch(attr[attrName], function(boolVal) { - // ensure boolean value - boolVal = negate ? !boolVal : !!boolVal; - elem.attr(ariaAttr, boolVal); - }); - } - }; - } - /** - * @ngdoc service - * @name $aria - * - * @description - * - * The $aria service contains helper methods for applying common - * [ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives. - * - * ngAria injects common accessibility attributes that tell assistive technologies when HTML - * elements are enabled, selected, hidden, and more. To see how this is performed with ngAria, - * let's review a code snippet from ngAria itself: - * - *```js - * ngAriaModule.directive('ngDisabled', ['$aria', function($aria) { - * return $aria.$$watchExpr('ngDisabled', 'aria-disabled', nativeAriaNodeNames, false); - * }]) - *``` - * Shown above, the ngAria module creates a directive with the same signature as the - * traditional `ng-disabled` directive. But this ngAria version is dedicated to - * solely managing accessibility attributes on custom elements. The internal `$aria` service is - * used to watch the boolean attribute `ngDisabled`. If it has not been explicitly set by the - * developer, `aria-disabled` is injected as an attribute with its value synchronized to the - * value in `ngDisabled`. - * - * Because ngAria hooks into the `ng-disabled` directive, developers do not have to do - * anything to enable this feature. The `aria-disabled` attribute is automatically managed - * simply as a silent side-effect of using `ng-disabled` with the ngAria module. - * - * The full list of directives that interface with ngAria: - * * **ngModel** - * * **ngChecked** - * * **ngReadonly** - * * **ngRequired** - * * **ngDisabled** - * * **ngValue** - * * **ngShow** - * * **ngHide** - * * **ngClick** - * * **ngDblclick** - * * **ngMessages** - * - * Read the {@link guide/accessibility ngAria Developer Guide} for a thorough explanation of each - * directive. - * - * - * ## Dependencies - * Requires the {@link ngAria} module to be installed. - */ - this.$get = function() { - return { - config: function(key) { - return config[key]; - }, - $$watchExpr: watchExpr - }; - }; -} - - -ngAriaModule.directive('ngShow', ['$aria', function($aria) { - return $aria.$$watchExpr('ngShow', 'aria-hidden', [], true); -}]) -.directive('ngHide', ['$aria', function($aria) { - return $aria.$$watchExpr('ngHide', 'aria-hidden', [], false); -}]) -.directive('ngValue', ['$aria', function($aria) { - return $aria.$$watchExpr('ngValue', 'aria-checked', nativeAriaNodeNames, false); -}]) -.directive('ngChecked', ['$aria', function($aria) { - return $aria.$$watchExpr('ngChecked', 'aria-checked', nativeAriaNodeNames, false); -}]) -.directive('ngReadonly', ['$aria', function($aria) { - return $aria.$$watchExpr('ngReadonly', 'aria-readonly', nativeAriaNodeNames, false); -}]) -.directive('ngRequired', ['$aria', function($aria) { - return $aria.$$watchExpr('ngRequired', 'aria-required', nativeAriaNodeNames, false); -}]) -.directive('ngModel', ['$aria', function($aria) { - - function shouldAttachAttr(attr, normalizedAttr, elem, allowNonAriaNodes) { - return $aria.config(normalizedAttr) && - !elem.attr(attr) && - (allowNonAriaNodes || !isNodeOneOf(elem, nativeAriaNodeNames)) && - (elem.attr('type') !== 'hidden' || elem[0].nodeName !== 'INPUT'); - } - - function shouldAttachRole(role, elem) { - // if element does not have role attribute - // AND element type is equal to role (if custom element has a type equaling shape) <-- remove? - // AND element is not in nativeAriaNodeNames - return !elem.attr('role') && (elem.attr('type') === role) && !isNodeOneOf(elem, nativeAriaNodeNames); - } - - function getShape(attr, elem) { - var type = attr.type, - role = attr.role; - - return ((type || role) === 'checkbox' || role === 'menuitemcheckbox') ? 'checkbox' : - ((type || role) === 'radio' || role === 'menuitemradio') ? 'radio' : - (type === 'range' || role === 'progressbar' || role === 'slider') ? 'range' : ''; - } - - return { - restrict: 'A', - require: 'ngModel', - priority: 200, //Make sure watches are fired after any other directives that affect the ngModel value - compile: function(elem, attr) { - if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; - - var shape = getShape(attr, elem); - - return { - post: function(scope, elem, attr, ngModel) { - var needsTabIndex = shouldAttachAttr('tabindex', 'tabindex', elem, false); - - function ngAriaWatchModelValue() { - return ngModel.$modelValue; - } - - function getRadioReaction(newVal) { - // Strict comparison would cause a BC - // eslint-disable-next-line eqeqeq - var boolVal = (attr.value == ngModel.$viewValue); - elem.attr('aria-checked', boolVal); - } - - function getCheckboxReaction() { - elem.attr('aria-checked', !ngModel.$isEmpty(ngModel.$viewValue)); - } - - switch (shape) { - case 'radio': - case 'checkbox': - if (shouldAttachRole(shape, elem)) { - elem.attr('role', shape); - } - if (shouldAttachAttr('aria-checked', 'ariaChecked', elem, false)) { - scope.$watch(ngAriaWatchModelValue, shape === 'radio' ? - getRadioReaction : getCheckboxReaction); - } - if (needsTabIndex) { - elem.attr('tabindex', 0); - } - break; - case 'range': - if (shouldAttachRole(shape, elem)) { - elem.attr('role', 'slider'); - } - if ($aria.config('ariaValue')) { - var needsAriaValuemin = !elem.attr('aria-valuemin') && - (attr.hasOwnProperty('min') || attr.hasOwnProperty('ngMin')); - var needsAriaValuemax = !elem.attr('aria-valuemax') && - (attr.hasOwnProperty('max') || attr.hasOwnProperty('ngMax')); - var needsAriaValuenow = !elem.attr('aria-valuenow'); - - if (needsAriaValuemin) { - attr.$observe('min', function ngAriaValueMinReaction(newVal) { - elem.attr('aria-valuemin', newVal); - }); - } - if (needsAriaValuemax) { - attr.$observe('max', function ngAriaValueMinReaction(newVal) { - elem.attr('aria-valuemax', newVal); - }); - } - if (needsAriaValuenow) { - scope.$watch(ngAriaWatchModelValue, function ngAriaValueNowReaction(newVal) { - elem.attr('aria-valuenow', newVal); - }); - } - } - if (needsTabIndex) { - elem.attr('tabindex', 0); - } - break; - } - - if (!attr.hasOwnProperty('ngRequired') && ngModel.$validators.required - && shouldAttachAttr('aria-required', 'ariaRequired', elem, false)) { - // ngModel.$error.required is undefined on custom controls - attr.$observe('required', function() { - elem.attr('aria-required', !!attr['required']); - }); - } - - if (shouldAttachAttr('aria-invalid', 'ariaInvalid', elem, true)) { - scope.$watch(function ngAriaInvalidWatch() { - return ngModel.$invalid; - }, function ngAriaInvalidReaction(newVal) { - elem.attr('aria-invalid', !!newVal); - }); - } - } - }; - } - }; -}]) -.directive('ngDisabled', ['$aria', function($aria) { - return $aria.$$watchExpr('ngDisabled', 'aria-disabled', nativeAriaNodeNames, false); -}]) -.directive('ngMessages', function() { - return { - restrict: 'A', - require: '?ngMessages', - link: function(scope, elem, attr, ngMessages) { - if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; - - if (!elem.attr('aria-live')) { - elem.attr('aria-live', 'assertive'); - } - } - }; -}) -.directive('ngClick',['$aria', '$parse', function($aria, $parse) { - return { - restrict: 'A', - compile: function(elem, attr) { - if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; - - var fn = $parse(attr.ngClick); - return function(scope, elem, attr) { - - if (!isNodeOneOf(elem, nativeAriaNodeNames)) { - - if ($aria.config('bindRoleForClick') && !elem.attr('role')) { - elem.attr('role', 'button'); - } - - if ($aria.config('tabindex') && !elem.attr('tabindex')) { - elem.attr('tabindex', 0); - } - - if ($aria.config('bindKeydown') && !attr.ngKeydown && !attr.ngKeypress && !attr.ngKeyup) { - elem.on('keydown', function(event) { - var keyCode = event.which || event.keyCode; - - if (keyCode === 13 || keyCode === 32) { - // If the event is triggered on a non-interactive element ... - if (nativeAriaNodeNames.indexOf(event.target.nodeName) === -1 && !event.target.isContentEditable) { - // ... prevent the default browser behavior (e.g. scrolling when pressing spacebar) - // See https://github.com/angular/angular.js/issues/16664 - event.preventDefault(); - } - scope.$apply(callback); - } - - function callback() { - fn(scope, { $event: event }); - } - }); - } - } - }; - } - }; -}]) -.directive('ngDblclick', ['$aria', function($aria) { - return function(scope, elem, attr) { - if (attr.hasOwnProperty(ARIA_DISABLE_ATTR)) return; - - if ($aria.config('tabindex') && !elem.attr('tabindex') && !isNodeOneOf(elem, nativeAriaNodeNames)) { - elem.attr('tabindex', 0); - } - }; -}]); - - -})(window, window.angular); - - -/***/ }), - -/***/ "./node_modules/angular-aria/index.js": -/*!********************************************!*\ - !*** ./node_modules/angular-aria/index.js ***! - \********************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -__webpack_require__(/*! ./angular-aria */ "./node_modules/angular-aria/angular-aria.js"); -module.exports = 'ngAria'; - - -/***/ }), - -/***/ "./node_modules/angular-local-storage/dist/angular-local-storage.js": -/*!**************************************************************************!*\ - !*** ./node_modules/angular-local-storage/dist/angular-local-storage.js ***! - \**************************************************************************/ -/***/ (() => { - -/** - * An Angular module that gives you access to the browsers local storage - * @version v0.7.1 - 2017-06-21 - * @link https://github.com/grevory/angular-local-storage - * @author grevory - * @license MIT License, http://www.opensource.org/licenses/MIT - */ -(function (window, angular) { -var isDefined = angular.isDefined, - isUndefined = angular.isUndefined, - isNumber = angular.isNumber, - isObject = angular.isObject, - isArray = angular.isArray, - isString = angular.isString, - extend = angular.extend, - toJson = angular.toJson; - -angular - .module('LocalStorageModule', []) - .provider('localStorageService', function() { - // You should set a prefix to avoid overwriting any local storage variables from the rest of your app - // e.g. localStorageServiceProvider.setPrefix('yourAppName'); - // With provider you can use config as this: - // myApp.config(function (localStorageServiceProvider) { - // localStorageServiceProvider.prefix = 'yourAppName'; - // }); - this.prefix = 'ls'; - - // You could change web storage type localstorage or sessionStorage - this.storageType = 'localStorage'; - - // Cookie options (usually in case of fallback) - // expiry = Number of days before cookies expire // 0 = Does not expire - // path = The web path the cookie represents - // secure = Wether the cookies should be secure (i.e only sent on HTTPS requests) - this.cookie = { - expiry: 30, - path: '/', - secure: false - }; - - // Decides wether we should default to cookies if localstorage is not supported. - this.defaultToCookie = true; - - // Send signals for each of the following actions? - this.notify = { - setItem: true, - removeItem: false - }; - - // Setter for the prefix - this.setPrefix = function(prefix) { - this.prefix = prefix; - return this; - }; - - // Setter for the storageType - this.setStorageType = function(storageType) { - this.storageType = storageType; - return this; - }; - // Setter for defaultToCookie value, default is true. - this.setDefaultToCookie = function (shouldDefault) { - this.defaultToCookie = !!shouldDefault; // Double-not to make sure it's a bool value. - return this; - }; - // Setter for cookie config - this.setStorageCookie = function(exp, path, secure) { - this.cookie.expiry = exp; - this.cookie.path = path; - this.cookie.secure = secure; - return this; - }; - - // Setter for cookie domain - this.setStorageCookieDomain = function(domain) { - this.cookie.domain = domain; - return this; - }; - - // Setter for notification config - // itemSet & itemRemove should be booleans - this.setNotify = function(itemSet, itemRemove) { - this.notify = { - setItem: itemSet, - removeItem: itemRemove - }; - return this; - }; - - this.$get = ['$rootScope', '$window', '$document', '$parse','$timeout', function($rootScope, $window, $document, $parse, $timeout) { - var self = this; - var prefix = self.prefix; - var cookie = self.cookie; - var notify = self.notify; - var storageType = self.storageType; - var webStorage; - - // When Angular's $document is not available - if (!$document) { - $document = document; - } else if ($document[0]) { - $document = $document[0]; - } - - // If there is a prefix set in the config lets use that with an appended period for readability - if (prefix.substr(-1) !== '.') { - prefix = !!prefix ? prefix + '.' : ''; - } - var deriveQualifiedKey = function(key) { - return prefix + key; - }; - - // Removes prefix from the key. - var underiveQualifiedKey = function (key) { - return key.replace(new RegExp('^' + prefix, 'g'), ''); - }; - - // Check if the key is within our prefix namespace. - var isKeyPrefixOurs = function (key) { - return key.indexOf(prefix) === 0; - }; - - // Checks the browser to see if local storage is supported - var checkSupport = function () { - try { - var supported = (storageType in $window && $window[storageType] !== null); - - // When Safari (OS X or iOS) is in private browsing mode, it appears as though localStorage - // is available, but trying to call .setItem throws an exception. - // - // "QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage - // that exceeded the quota." - var key = deriveQualifiedKey('__' + Math.round(Math.random() * 1e7)); - if (supported) { - webStorage = $window[storageType]; - webStorage.setItem(key, ''); - webStorage.removeItem(key); - } - - return supported; - } catch (e) { - // Only change storageType to cookies if defaulting is enabled. - if (self.defaultToCookie) - storageType = 'cookie'; - $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); - return false; - } - }; - var browserSupportsLocalStorage = checkSupport(); - - // Directly adds a value to local storage - // If local storage is not available in the browser use cookies - // Example use: localStorageService.add('library','angular'); - var addToLocalStorage = function (key, value, type) { - var previousType = getStorageType(); - - try { - setStorageType(type); - - // Let's convert undefined values to null to get the value consistent - if (isUndefined(value)) { - value = null; - } else { - value = toJson(value); - } - - // If this browser does not support local storage use cookies - if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { - if (!browserSupportsLocalStorage) { - $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); - } - - if (notify.setItem) { - $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: 'cookie'}); - } - return addToCookies(key, value); - } - - try { - if (webStorage) { - webStorage.setItem(deriveQualifiedKey(key), value); - } - if (notify.setItem) { - $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: self.storageType}); - } - } catch (e) { - $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); - return addToCookies(key, value); - } - return true; - } finally { - setStorageType(previousType); - } - }; - - // Directly get a value from local storage - // Example use: localStorageService.get('library'); // returns 'angular' - var getFromLocalStorage = function (key, type) { - var previousType = getStorageType(); - - try { - setStorageType(type); - - if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { - if (!browserSupportsLocalStorage) { - $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); - } - - return getFromCookies(key); - } - - var item = webStorage ? webStorage.getItem(deriveQualifiedKey(key)) : null; - // angular.toJson will convert null to 'null', so a proper conversion is needed - // FIXME not a perfect solution, since a valid 'null' string can't be stored - if (!item || item === 'null') { - return null; - } - - try { - return JSON.parse(item); - } catch (e) { - return item; - } - } finally { - setStorageType(previousType); - } - }; - - // Remove an item from local storage - // Example use: localStorageService.remove('library'); // removes the key/value pair of library='angular' - // - // This is var-arg removal, check the last argument to see if it is a storageType - // and set type accordingly before removing. - // - var removeFromLocalStorage = function () { - var previousType = getStorageType(); - - try { - // can't pop on arguments, so we do this - var consumed = 0; - if (arguments.length >= 1 && - (arguments[arguments.length - 1] === 'localStorage' || - arguments[arguments.length - 1] === 'sessionStorage')) { - consumed = 1; - setStorageType(arguments[arguments.length - 1]); - } - - var i, key; - for (i = 0; i < arguments.length - consumed; i++) { - key = arguments[i]; - if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { - if (!browserSupportsLocalStorage) { - $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); - } - - if (notify.removeItem) { - $rootScope.$broadcast('LocalStorageModule.notification.removeitem', {key: key, storageType: 'cookie'}); - } - removeFromCookies(key); - } - else { - try { - webStorage.removeItem(deriveQualifiedKey(key)); - if (notify.removeItem) { - $rootScope.$broadcast('LocalStorageModule.notification.removeitem', { - key: key, - storageType: self.storageType - }); - } - } catch (e) { - $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); - removeFromCookies(key); - } - } - } - } finally { - setStorageType(previousType); - } - }; - - // Return array of keys for local storage - // Example use: var keys = localStorageService.keys() - var getKeysForLocalStorage = function (type) { - var previousType = getStorageType(); - - try { - setStorageType(type); - - if (!browserSupportsLocalStorage) { - $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); - return []; - } - - var prefixLength = prefix.length; - var keys = []; - for (var key in webStorage) { - // Only return keys that are for this app - if (key.substr(0, prefixLength) === prefix) { - try { - keys.push(key.substr(prefixLength)); - } catch (e) { - $rootScope.$broadcast('LocalStorageModule.notification.error', e.Description); - return []; - } - } - } - - return keys; - } finally { - setStorageType(previousType); - } - }; - - // Remove all data for this app from local storage - // Also optionally takes a regular expression string and removes the matching key-value pairs - // Example use: localStorageService.clearAll(); - // Should be used mostly for development purposes - var clearAllFromLocalStorage = function (regularExpression, type) { - var previousType = getStorageType(); - - try { - setStorageType(type); - - // Setting both regular expressions independently - // Empty strings result in catchall RegExp - var prefixRegex = !!prefix ? new RegExp('^' + prefix) : new RegExp(); - var testRegex = !!regularExpression ? new RegExp(regularExpression) : new RegExp(); - - if (!browserSupportsLocalStorage && self.defaultToCookie || self.storageType === 'cookie') { - if (!browserSupportsLocalStorage) { - $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); - } - return clearAllFromCookies(); - } - if (!browserSupportsLocalStorage && !self.defaultToCookie) - return false; - var prefixLength = prefix.length; - - for (var key in webStorage) { - // Only remove items that are for this app and match the regular expression - if (prefixRegex.test(key) && testRegex.test(key.substr(prefixLength))) { - try { - removeFromLocalStorage(key.substr(prefixLength)); - } catch (e) { - $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); - return clearAllFromCookies(); - } - } - } - - return true; - } finally { - setStorageType(previousType); - } - }; - - // Checks the browser to see if cookies are supported - var browserSupportsCookies = (function() { - try { - return $window.navigator.cookieEnabled || - ("cookie" in $document && ($document.cookie.length > 0 || - ($document.cookie = "test").indexOf.call($document.cookie, "test") > -1)); - } catch (e) { - $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); - return false; - } - }()); - - // Directly adds a value to cookies - // Typically used as a fallback if local storage is not available in the browser - // Example use: localStorageService.cookie.add('library','angular'); - var addToCookies = function (key, value, daysToExpiry, secure) { - - if (isUndefined(value)) { - return false; - } else if(isArray(value) || isObject(value)) { - value = toJson(value); - } - - if (!browserSupportsCookies) { - $rootScope.$broadcast('LocalStorageModule.notification.error', 'COOKIES_NOT_SUPPORTED'); - return false; - } - - try { - var expiry = '', - expiryDate = new Date(), - cookieDomain = ''; - - if (value === null) { - // Mark that the cookie has expired one day ago - expiryDate.setTime(expiryDate.getTime() + (-1 * 24 * 60 * 60 * 1000)); - expiry = "; expires=" + expiryDate.toGMTString(); - value = ''; - } else if (isNumber(daysToExpiry) && daysToExpiry !== 0) { - expiryDate.setTime(expiryDate.getTime() + (daysToExpiry * 24 * 60 * 60 * 1000)); - expiry = "; expires=" + expiryDate.toGMTString(); - } else if (cookie.expiry !== 0) { - expiryDate.setTime(expiryDate.getTime() + (cookie.expiry * 24 * 60 * 60 * 1000)); - expiry = "; expires=" + expiryDate.toGMTString(); - } - if (!!key) { - var cookiePath = "; path=" + cookie.path; - if (cookie.domain) { - cookieDomain = "; domain=" + cookie.domain; - } - /* Providing the secure parameter always takes precedence over config - * (allows developer to mix and match secure + non-secure) */ - if (typeof secure === 'boolean') { - if (secure === true) { - /* We've explicitly specified secure, - * add the secure attribute to the cookie (after domain) */ - cookieDomain += "; secure"; - } - // else - secure has been supplied but isn't true - so don't set secure flag, regardless of what config says - } - else if (cookie.secure === true) { - // secure parameter wasn't specified, get default from config - cookieDomain += "; secure"; - } - $document.cookie = deriveQualifiedKey(key) + "=" + encodeURIComponent(value) + expiry + cookiePath + cookieDomain; - } - } catch (e) { - $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); - return false; - } - return true; - }; - - // Directly get a value from a cookie - // Example use: localStorageService.cookie.get('library'); // returns 'angular' - var getFromCookies = function (key) { - if (!browserSupportsCookies) { - $rootScope.$broadcast('LocalStorageModule.notification.error', 'COOKIES_NOT_SUPPORTED'); - return false; - } - - var cookies = $document.cookie && $document.cookie.split(';') || []; - for(var i=0; i < cookies.length; i++) { - var thisCookie = cookies[i]; - while (thisCookie.charAt(0) === ' ') { - thisCookie = thisCookie.substring(1,thisCookie.length); - } - if (thisCookie.indexOf(deriveQualifiedKey(key) + '=') === 0) { - var storedValues = decodeURIComponent(thisCookie.substring(prefix.length + key.length + 1, thisCookie.length)); - try { - var parsedValue = JSON.parse(storedValues); - return typeof(parsedValue) === 'number' ? storedValues : parsedValue; - } catch(e) { - return storedValues; - } - } - } - return null; - }; - - var removeFromCookies = function (key) { - addToCookies(key,null); - }; - - var clearAllFromCookies = function () { - var thisCookie = null; - var prefixLength = prefix.length; - var cookies = $document.cookie.split(';'); - for(var i = 0; i < cookies.length; i++) { - thisCookie = cookies[i]; - - while (thisCookie.charAt(0) === ' ') { - thisCookie = thisCookie.substring(1, thisCookie.length); - } - - var key = thisCookie.substring(prefixLength, thisCookie.indexOf('=')); - removeFromCookies(key); - } - }; - - var getStorageType = function() { - return storageType; - }; - - var setStorageType = function(type) { - if (type && storageType !== type) { - storageType = type; - browserSupportsLocalStorage = checkSupport(); - } - return browserSupportsLocalStorage; - }; - - // Add a listener on scope variable to save its changes to local storage - // Return a function which when called cancels binding - var bindToScope = function(scope, key, def, lsKey, type) { - lsKey = lsKey || key; - var value = getFromLocalStorage(lsKey, type); - - if (value === null && isDefined(def)) { - value = def; - } else if (isObject(value) && isObject(def)) { - value = extend(value, def); - } - - $parse(key).assign(scope, value); - - return scope.$watch(key, function(newVal) { - addToLocalStorage(lsKey, newVal, type); - }, isObject(scope[key])); - }; - - // Add listener to local storage, for update callbacks. - if (browserSupportsLocalStorage) { - if ($window.addEventListener) { - $window.addEventListener("storage", handleStorageChangeCallback, false); - $rootScope.$on('$destroy', function() { - $window.removeEventListener("storage", handleStorageChangeCallback); - }); - } else if($window.attachEvent){ - // attachEvent and detachEvent are proprietary to IE v6-10 - $window.attachEvent("onstorage", handleStorageChangeCallback); - $rootScope.$on('$destroy', function() { - $window.detachEvent("onstorage", handleStorageChangeCallback); - }); - } - } - - // Callback handler for storage changed. - function handleStorageChangeCallback(e) { - if (!e) { e = $window.event; } - if (notify.setItem) { - if (isString(e.key) && isKeyPrefixOurs(e.key)) { - var key = underiveQualifiedKey(e.key); - // Use timeout, to avoid using $rootScope.$apply. - $timeout(function () { - $rootScope.$broadcast('LocalStorageModule.notification.changed', { key: key, newvalue: e.newValue, storageType: self.storageType }); - }); - } - } - } - - // Return localStorageService.length - // ignore keys that not owned - var lengthOfLocalStorage = function(type) { - var previousType = getStorageType(); - - try { - setStorageType(type); - - var count = 0; - var storage = $window[storageType]; - for(var i = 0; i < storage.length; i++) { - if(storage.key(i).indexOf(prefix) === 0 ) { - count++; - } - } - - return count; - } finally { - setStorageType(previousType); - } - }; - - var changePrefix = function(localStoragePrefix) { - prefix = localStoragePrefix; - }; - - return { - isSupported: browserSupportsLocalStorage, - getStorageType: getStorageType, - setStorageType: setStorageType, - setPrefix: changePrefix, - set: addToLocalStorage, - add: addToLocalStorage, //DEPRECATED - get: getFromLocalStorage, - keys: getKeysForLocalStorage, - remove: removeFromLocalStorage, - clearAll: clearAllFromLocalStorage, - bind: bindToScope, - deriveKey: deriveQualifiedKey, - underiveKey: underiveQualifiedKey, - length: lengthOfLocalStorage, - defaultToCookie: this.defaultToCookie, - cookie: { - isSupported: browserSupportsCookies, - set: addToCookies, - add: addToCookies, //DEPRECATED - get: getFromCookies, - remove: removeFromCookies, - clearAll: clearAllFromCookies - } - }; - }]; - }); -})(window, window.angular); - -/***/ }), - -/***/ "./node_modules/angular-local-storage/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/angular-local-storage/index.js ***! - \*****************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -__webpack_require__(/*! ./dist/angular-local-storage.js */ "./node_modules/angular-local-storage/dist/angular-local-storage.js"); -module.exports = 'LocalStorageModule'; - - -/***/ }), - -/***/ "./node_modules/angular-material/angular-material.js": -/*!***********************************************************!*\ - !*** ./node_modules/angular-material/angular-material.js ***! - \***********************************************************/ -/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { - -/* provided dependency */ var __webpack_provided_window_dot_jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); -/*! - * AngularJS Material Design - * https://github.com/angular/material - * @license MIT - * v1.2.3 - */ -(function( window, angular, undefined ){ -"use strict"; - -(function(){ -"use strict"; - -angular.module('ngMaterial', ["ng","ngAnimate","ngAria","material.core","material.core.animate","material.core.gestures","material.core.interaction","material.core.layout","material.core.meta","material.core.theming.palette","material.core.theming","material.components.autocomplete","material.components.backdrop","material.components.bottomSheet","material.components.button","material.components.card","material.components.checkbox","material.components.chips","material.components.colors","material.components.content","material.components.datepicker","material.components.dialog","material.components.divider","material.components.fabActions","material.components.fabShared","material.components.fabSpeedDial","material.components.fabToolbar","material.components.gridList","material.components.icon","material.components.input","material.components.list","material.components.menu","material.components.menuBar","material.components.navBar","material.components.panel","material.components.progressCircular","material.components.progressLinear","material.components.radioButton","material.components.select","material.components.showHide","material.components.sidenav","material.components.slider","material.components.sticky","material.components.subheader","material.components.swipe","material.components.switch","material.components.tabs","material.components.toast","material.components.toolbar","material.components.tooltip","material.components.truncate","material.components.virtualRepeat","material.components.whiteframe"]); -})(); -(function(){ -"use strict"; - -/** - * Initialization function that validates environment - * requirements. - */ -DetectNgTouch.$inject = ["$log", "$injector"]; -MdCoreConfigure.$inject = ["$provide", "$mdThemingProvider"]; -rAFDecorator.$inject = ["$delegate"]; -qDecorator.$inject = ["$delegate"]; -angular - .module('material.core', [ - 'ngAnimate', - 'material.core.animate', - 'material.core.layout', - 'material.core.interaction', - 'material.core.gestures', - 'material.core.theming' - ]) - .config(MdCoreConfigure) - .run(DetectNgTouch); - - -/** - * Detect if the ng-Touch module is also being used. - * Warn if detected. - * @ngInject - */ -function DetectNgTouch($log, $injector) { - if ($injector.has('$swipe')) { - var msg = "" + - "You are using the ngTouch module. \n" + - "AngularJS Material already has mobile click, tap, and swipe support... \n" + - "ngTouch is not supported with AngularJS Material!"; - $log.warn(msg); - } -} - -/** - * @ngInject - */ -function MdCoreConfigure($provide, $mdThemingProvider) { - - $provide.decorator('$$rAF', ['$delegate', rAFDecorator]); - $provide.decorator('$q', ['$delegate', qDecorator]); - - $mdThemingProvider.theme('default') - .primaryPalette('indigo') - .accentPalette('pink') - .warnPalette('deep-orange') - .backgroundPalette('grey'); -} - -/** - * @ngInject - */ -function rAFDecorator($delegate) { - /** - * Use this to throttle events that come in often. - * The throttled function will always use the *last* invocation before the - * coming frame. - * - * For example, window resize events that fire many times a second: - * If we set to use an raf-throttled callback on window resize, then - * our callback will only be fired once per frame, with the last resize - * event that happened before that frame. - * - * @param {function} cb function to debounce - */ - $delegate.throttle = function(cb) { - var queuedArgs, alreadyQueued, queueCb, context; - return function debounced() { - queuedArgs = arguments; - context = this; - queueCb = cb; - if (!alreadyQueued) { - alreadyQueued = true; - $delegate(function() { - queueCb.apply(context, Array.prototype.slice.call(queuedArgs)); - alreadyQueued = false; - }); - } - }; - }; - return $delegate; -} - -/** - * @ngInject - */ -function qDecorator($delegate) { - /** - * Adds a shim for $q.resolve for AngularJS version that don't have it, - * so we don't have to think about it. - * - * via https://github.com/angular/angular.js/pull/11987 - */ - - // TODO(crisbeto): this won't be necessary once we drop AngularJS 1.3 - if (!$delegate.resolve) { - $delegate.resolve = $delegate.when; - } - return $delegate; -} - -})(); -(function(){ -"use strict"; - - -MdAutofocusDirective.$inject = ["$parse"];angular.module('material.core') - .directive('mdAutofocus', MdAutofocusDirective); - -/** - * @ngdoc directive - * @name mdAutofocus - * @module material.core.util - * - * @description - * - * `[md-autofocus]` provides an optional way to identify the focused element when a `$mdDialog`, - * `$mdBottomSheet`, `$mdMenu` or `$mdSidenav` opens or upon page load for input-like elements. - * - * When one of these opens, it will find the first nested element with the `[md-autofocus]` - * attribute directive and optional expression. An expression may be specified as the directive - * value to enable conditional activation of the autofocus. - * - * @usage - * - * ### Dialog - * - * - *
    - * - * - * - * - *
    - *
    - *
    - * - * ### Bottomsheet - * - * - * Comment Actions - * - * - * - * - * - * {{ item.name }} - * - * - * - * - * - * - * - * ### Autocomplete - * - * - * {{item.display}} - * - * - * - * ### Sidenav - * - *
    - * - * Left Nav! - * - * - * - * Center Content - * - * Open Left Menu - * - * - * - * - *
    - * - * - * - * - *
    - *
    - *
    - *
    - **/ -function MdAutofocusDirective($parse) { - return { - restrict: 'A', - link: { - pre: preLink - } - }; - - function preLink(scope, element, attr) { - var attrExp = attr.mdAutoFocus || attr.mdAutofocus || attr.mdSidenavFocus; - - // Initially update the expression by manually parsing the expression as per $watch source. - updateExpression($parse(attrExp)(scope)); - - // Only watch the expression if it is not empty. - if (attrExp) { - scope.$watch(attrExp, updateExpression); - } - - /** - * Updates the autofocus class which is used to determine whether the attribute - * expression evaluates to true or false. - * @param {string|boolean} value Attribute Value - */ - function updateExpression(value) { - - // Rather than passing undefined to the jqLite toggle class function we explicitly set the - // value to true. Otherwise the class will be just toggled instead of being forced. - if (angular.isUndefined(value)) { - value = true; - } - - element.toggleClass('md-autofocus', !!value); - } - } - -} - -})(); -(function(){ -"use strict"; - -/** - * @ngdoc module - * @name material.core.colorUtil - * @description - * Color Util - */ -angular - .module('material.core') - .factory('$mdColorUtil', ColorUtilFactory); - -function ColorUtilFactory() { - /** - * Converts hex value to RGBA string - * @param color {string} - * @returns {string} - */ - function hexToRgba (color) { - var hex = color[ 0 ] === '#' ? color.substr(1) : color, - dig = hex.length / 3, - red = hex.substr(0, dig), - green = hex.substr(dig, dig), - blue = hex.substr(dig * 2); - if (dig === 1) { - red += red; - green += green; - blue += blue; - } - return 'rgba(' + parseInt(red, 16) + ',' + parseInt(green, 16) + ',' + parseInt(blue, 16) + ',0.1)'; - } - - /** - * Converts rgba value to hex string - * @param {string} color - * @returns {string} - */ - function rgbaToHex(color) { - color = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i); - - var hex = (color && color.length === 4) ? "#" + - ("0" + parseInt(color[1],10).toString(16)).slice(-2) + - ("0" + parseInt(color[2],10).toString(16)).slice(-2) + - ("0" + parseInt(color[3],10).toString(16)).slice(-2) : ''; - - return hex.toUpperCase(); - } - - /** - * Converts an RGB color to RGBA - * @param {string} color - * @returns {string} - */ - function rgbToRgba (color) { - return color.replace(')', ', 0.1)').replace('(', 'a('); - } - - /** - * Converts an RGBA color to RGB - * @param {string} color - * @returns {string} - */ - function rgbaToRgb (color) { - return color - ? color.replace('rgba', 'rgb').replace(/,[^),]+\)/, ')') - : 'rgb(0,0,0)'; - } - - return { - rgbaToHex: rgbaToHex, - hexToRgba: hexToRgba, - rgbToRgba: rgbToRgba, - rgbaToRgb: rgbaToRgb - }; -} - -})(); -(function(){ -"use strict"; - -angular.module('material.core') -.factory('$mdConstant', MdConstantFactory); - -/** - * Factory function that creates the grab-bag $mdConstant service. - * @ngInject - */ -function MdConstantFactory() { - - var prefixTestEl = document.createElement('div'); - var vendorPrefix = getVendorPrefix(prefixTestEl); - var isWebkit = /webkit/i.test(vendorPrefix); - var SPECIAL_CHARS_REGEXP = /([:\-_]+(.))/g; - - /** - * @param {string} name CSS property name - * @return {string} the property name supported by the browser - */ - function vendorProperty(name) { - // Add a dash between the prefix and name, to be able to transform the string into camelcase. - var prefixedName = vendorPrefix + '-' + name; - var ucPrefix = camelCase(prefixedName); - var lcPrefix = ucPrefix.charAt(0).toLowerCase() + ucPrefix.substring(1); - - return hasStyleProperty(prefixTestEl, name) ? name : // The current browser supports the un-prefixed property - hasStyleProperty(prefixTestEl, ucPrefix) ? ucPrefix : // The current browser only supports the prefixed property. - hasStyleProperty(prefixTestEl, lcPrefix) ? lcPrefix : name; // Some browsers are only supporting the prefix in lowercase. - } - - function hasStyleProperty(testElement, property) { - return angular.isDefined(testElement.style[property]); - } - - /** - * @param {!string} input value to convert to camelCase - * @return {string} camelCased version of the input string - */ - function camelCase(input) { - return input.replace(SPECIAL_CHARS_REGEXP, function(matches, separator, letter, offset) { - return offset ? letter.toUpperCase() : letter; - }); - } - - function getVendorPrefix(testElement) { - var prop, match; - var vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/; - - for (prop in testElement.style) { - if (match = vendorRegex.exec(prop)) { - return match[0]; - } - } - } - - var self = { - isInputKey : function(e) { return (e.keyCode >= 31 && e.keyCode <= 90); }, - isNumPadKey : function(e) { return (3 === e.location && e.keyCode >= 97 && e.keyCode <= 105); }, - isMetaKey: function(e) { return (e.keyCode >= 91 && e.keyCode <= 93); }, - isFnLockKey: function(e) { return (e.keyCode >= 112 && e.keyCode <= 145); }, - isNavigationKey : function(e) { - var kc = self.KEY_CODE, NAVIGATION_KEYS = [kc.SPACE, kc.ENTER, kc.UP_ARROW, kc.DOWN_ARROW]; - return (NAVIGATION_KEYS.indexOf(e.keyCode) != -1); - }, - hasModifierKey: function(e) { - return e.ctrlKey || e.metaKey || e.altKey; - }, - - /** - * Maximum size, in pixels, that can be explicitly set to an element. The actual value varies - * between browsers, but IE11 has the very lowest size at a mere 1,533,917px. Ideally we could - * compute this value, but Firefox always reports an element to have a size of zero if it - * goes over the max, meaning that we'd have to binary search for the value. - */ - ELEMENT_MAX_PIXELS: 1533917, - - /** - * Priority for a directive that should run before the directives from ngAria. - */ - BEFORE_NG_ARIA: 210, - - /** - * Common Keyboard actions and their associated keycode. - */ - KEY_CODE: { - COMMA: 188, - SEMICOLON : 186, - ENTER: 13, - ESCAPE: 27, - SPACE: 32, - PAGE_UP: 33, - PAGE_DOWN: 34, - END: 35, - HOME: 36, - LEFT_ARROW : 37, - UP_ARROW : 38, - RIGHT_ARROW : 39, - DOWN_ARROW : 40, - TAB : 9, - BACKSPACE: 8, - DELETE: 46 - }, - - /** - * Vendor prefixed CSS properties to be used to support the given functionality in older browsers - * as well. - */ - CSS: { - /* Constants */ - TRANSITIONEND: 'transitionend' + (isWebkit ? ' webkitTransitionEnd' : ''), - ANIMATIONEND: 'animationend' + (isWebkit ? ' webkitAnimationEnd' : ''), - - TRANSFORM: vendorProperty('transform'), - TRANSFORM_ORIGIN: vendorProperty('transformOrigin'), - TRANSITION: vendorProperty('transition'), - TRANSITION_DURATION: vendorProperty('transitionDuration'), - ANIMATION_PLAY_STATE: vendorProperty('animationPlayState'), - ANIMATION_DURATION: vendorProperty('animationDuration'), - ANIMATION_NAME: vendorProperty('animationName'), - ANIMATION_TIMING: vendorProperty('animationTimingFunction'), - ANIMATION_DIRECTION: vendorProperty('animationDirection') - }, - - /** - * As defined in core/style/_variables.scss - * - * $layout-breakpoint-xs: 600px !default; - * $layout-breakpoint-sm: 960px !default; - * $layout-breakpoint-md: 1280px !default; - * $layout-breakpoint-lg: 1920px !default; - * - */ - MEDIA: { - 'xs' : '(max-width: 599px)' , - 'gt-xs' : '(min-width: 600px)' , - 'sm' : '(min-width: 600px) and (max-width: 959px)' , - 'gt-sm' : '(min-width: 960px)' , - 'md' : '(min-width: 960px) and (max-width: 1279px)' , - 'gt-md' : '(min-width: 1280px)' , - 'lg' : '(min-width: 1280px) and (max-width: 1919px)', - 'gt-lg' : '(min-width: 1920px)' , - 'xl' : '(min-width: 1920px)' , - 'landscape' : '(orientation: landscape)' , - 'portrait' : '(orientation: portrait)' , - 'print' : 'print' - }, - - MEDIA_PRIORITY: [ - 'xl', - 'gt-lg', - 'lg', - 'gt-md', - 'md', - 'gt-sm', - 'sm', - 'gt-xs', - 'xs', - 'landscape', - 'portrait', - 'print' - ] - }; - - return self; -} - -})(); -(function(){ -"use strict"; - - angular - .module('material.core') - .config(["$provide", function($provide){ - $provide.decorator('$mdUtil', ['$delegate', function ($delegate){ - /** - * Inject the iterator facade to easily support iteration and accessors - * @see iterator below - */ - $delegate.iterator = MdIterator; - - return $delegate; - } - ]); - }]); - - /** - * iterator is a list facade to easily support iteration and accessors/ - * - * @param {any[]} items Array list which this iterator will enumerate - * @param {boolean=} reloop enables iterator to consider the list as an endless loop - * @return {{add: add, next: (function()), last: (function(): any|null), previous: (function()), count: (function(): number), hasNext: (function(*=): Array.length|*|number|boolean), inRange: (function(*): boolean), remove: remove, contains: (function(*=): *|boolean), itemAt: (function(*=): any|null), findBy: (function(*, *): *[]), hasPrevious: (function(*=): Array.length|*|number|boolean), items: (function(): *[]), indexOf: (function(*=): number), first: (function(): any|null)}} - * @constructor - */ - function MdIterator(items, reloop) { - var trueFn = function() { return true; }; - - if (items && !angular.isArray(items)) { - items = Array.prototype.slice.call(items); - } - - reloop = !!reloop; - var _items = items || []; - - // Published API - return { - items: getItems, - count: count, - - inRange: inRange, - contains: contains, - indexOf: indexOf, - itemAt: itemAt, - - findBy: findBy, - - add: add, - remove: remove, - - first: first, - last: last, - next: angular.bind(null, findSubsequentItem, false), - previous: angular.bind(null, findSubsequentItem, true), - - hasPrevious: hasPrevious, - hasNext: hasNext - }; - - /** - * Publish copy of the enumerable set - * @returns {Array|*} - */ - function getItems() { - return [].concat(_items); - } - - /** - * Determine length of the list - * @returns {Array.length|*|number} - */ - function count() { - return _items.length; - } - - /** - * Is the index specified valid - * @param index - * @returns {Array.length|*|number|boolean} - */ - function inRange(index) { - return _items.length && (index > -1) && (index < _items.length); - } - - /** - * Can the iterator proceed to the next item in the list; relative to - * the specified item. - * - * @param item - * @returns {Array.length|*|number|boolean} - */ - function hasNext(item) { - return item ? inRange(indexOf(item) + 1) : false; - } - - /** - * Can the iterator proceed to the previous item in the list; relative to - * the specified item. - * - * @param item - * @returns {Array.length|*|number|boolean} - */ - function hasPrevious(item) { - return item ? inRange(indexOf(item) - 1) : false; - } - - /** - * Get item at specified index/position - * @param index - * @returns {*} - */ - function itemAt(index) { - return inRange(index) ? _items[index] : null; - } - - /** - * Find all elements matching the key/value pair - * otherwise return null - * - * @param val - * @param key - * - * @return array - */ - function findBy(key, val) { - return _items.filter(function(item) { - return item[key] === val; - }); - } - - /** - * Add item to list - * @param item - * @param index - * @returns {*} - */ - function add(item, index) { - if (!item) return -1; - - if (!angular.isNumber(index)) { - index = _items.length; - } - - _items.splice(index, 0, item); - - return indexOf(item); - } - - /** - * Remove item from list... - * @param item - */ - function remove(item) { - if (contains(item)){ - _items.splice(indexOf(item), 1); - } - } - - /** - * Get the zero-based index of the target item - * @param item - * @returns {*} - */ - function indexOf(item) { - return _items.indexOf(item); - } - - /** - * Boolean existence check - * @param item - * @returns {boolean} - */ - function contains(item) { - return item && (indexOf(item) > -1); - } - - /** - * Return first item in the list - * @returns {*} - */ - function first() { - return _items.length ? _items[0] : null; - } - - /** - * Return last item in the list... - * @returns {*} - */ - function last() { - return _items.length ? _items[_items.length - 1] : null; - } - - /** - * Find the next item. If reloop is true and at the end of the list, it will go back to the - * first item. If given, the `validate` callback will be used to determine whether the next item - * is valid. If not valid, it will try to find the next item again. - * - * @param {boolean} backwards Specifies the direction of searching (forwards/backwards) - * @param {*} item The item whose subsequent item we are looking for - * @param {Function=} validate The `validate` function - * @param {integer=} limit The recursion limit - * - * @returns {*} The subsequent item or null - */ - function findSubsequentItem(backwards, item, validate, limit) { - validate = validate || trueFn; - - var curIndex = indexOf(item); - while (true) { - if (!inRange(curIndex)) return null; - - var nextIndex = curIndex + (backwards ? -1 : 1); - var foundItem = null; - if (inRange(nextIndex)) { - foundItem = _items[nextIndex]; - } else if (reloop) { - foundItem = backwards ? last() : first(); - nextIndex = indexOf(foundItem); - } - - if ((foundItem === null) || (nextIndex === limit)) return null; - if (validate(foundItem)) return foundItem; - - if (angular.isUndefined(limit)) limit = nextIndex; - - curIndex = nextIndex; - } - } - } - - -})(); -(function(){ -"use strict"; - - -mdMediaFactory.$inject = ["$mdConstant", "$rootScope", "$window"];angular.module('material.core') -.factory('$mdMedia', mdMediaFactory); - -/** - * @ngdoc service - * @name $mdMedia - * @module material.core - * - * @description - * `$mdMedia` is used to evaluate whether a given media query is true or false given the - * current device's screen / window size. The media query will be re-evaluated on resize, allowing - * you to register a watch. - * - * `$mdMedia` also has pre-programmed support for media queries that match the layout breakpoints: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    BreakpointmediaQuery
    xs(max-width: 599px)
    gt-xs(min-width: 600px)
    sm(min-width: 600px) and (max-width: 959px)
    gt-sm(min-width: 960px)
    md(min-width: 960px) and (max-width: 1279px)
    gt-md(min-width: 1280px)
    lg(min-width: 1280px) and (max-width: 1919px)
    gt-lg(min-width: 1920px)
    xl(min-width: 1920px)
    landscapelandscape
    portraitportrait
    printprint
    - * - * See Material Design's Layout - Adaptive UI for more details. - * - * - * - * - * - * @returns {boolean} a boolean representing whether or not the given media query is true or false. - * - * @usage - * - * app.controller('MyController', function($mdMedia, $scope) { - * $scope.$watch(function() { return $mdMedia('lg'); }, function(big) { - * $scope.bigScreen = big; - * }); - * - * $scope.screenIsSmall = $mdMedia('sm'); - * $scope.customQuery = $mdMedia('(min-width: 1234px)'); - * $scope.anotherCustom = $mdMedia('max-width: 300px'); - * }); - * - */ - -/* @ngInject */ -function mdMediaFactory($mdConstant, $rootScope, $window) { - var queries = {}; - var mqls = {}; - var results = {}; - var normalizeCache = {}; - - $mdMedia.getResponsiveAttribute = getResponsiveAttribute; - $mdMedia.getQuery = getQuery; - $mdMedia.watchResponsiveAttributes = watchResponsiveAttributes; - - return $mdMedia; - - function $mdMedia(query) { - var validated = queries[query]; - if (angular.isUndefined(validated)) { - validated = queries[query] = validate(query); - } - - var result = results[validated]; - if (angular.isUndefined(result)) { - result = add(validated); - } - - return result; - } - - function validate(query) { - return $mdConstant.MEDIA[query] || - ((query.charAt(0) !== '(') ? ('(' + query + ')') : query); - } - - function add(query) { - var result = mqls[query]; - if (!result) { - result = mqls[query] = $window.matchMedia(query); - } - - result.addListener(onQueryChange); - return (results[result.media] = !!result.matches); - } - - function onQueryChange(query) { - $rootScope.$evalAsync(function() { - results[query.media] = !!query.matches; - }); - } - - function getQuery(name) { - return mqls[name]; - } - - function getResponsiveAttribute(attrs, attrName) { - for (var i = 0; i < $mdConstant.MEDIA_PRIORITY.length; i++) { - var mediaName = $mdConstant.MEDIA_PRIORITY[i]; - if (!mqls[queries[mediaName]].matches) { - continue; - } - - var normalizedName = getNormalizedName(attrs, attrName + '-' + mediaName); - if (attrs[normalizedName]) { - return attrs[normalizedName]; - } - } - - // fallback on unprefixed - return attrs[getNormalizedName(attrs, attrName)]; - } - - function watchResponsiveAttributes(attrNames, attrs, watchFn) { - var unwatchFns = []; - attrNames.forEach(function(attrName) { - var normalizedName = getNormalizedName(attrs, attrName); - if (angular.isDefined(attrs[normalizedName])) { - unwatchFns.push( - attrs.$observe(normalizedName, angular.bind(void 0, watchFn, null))); - } - - for (var mediaName in $mdConstant.MEDIA) { - normalizedName = getNormalizedName(attrs, attrName + '-' + mediaName); - if (angular.isDefined(attrs[normalizedName])) { - unwatchFns.push( - attrs.$observe(normalizedName, angular.bind(void 0, watchFn, mediaName))); - } - } - }); - - return function unwatch() { - unwatchFns.forEach(function(fn) { fn(); }); - }; - } - - // Improves performance dramatically - function getNormalizedName(attrs, attrName) { - return normalizeCache[attrName] || - (normalizeCache[attrName] = attrs.$normalize(attrName)); - } -} - -})(); -(function(){ -"use strict"; - -angular - .module('material.core') - .config(["$provide", function($provide) { - $provide.decorator('$mdUtil', ['$delegate', function ($delegate) { - - // Inject the prefixer into our original $mdUtil service. - $delegate.prefixer = MdPrefixer; - - return $delegate; - }]); - }]); - -/** - * @param {string|string[]} initialAttributes - * @param {boolean} buildSelector - * @return {string|string[]|{buildSelector: (function(string|string[]): string), - * buildList: (function(string|string[]): string[]), - * hasAttribute: (function(JQLite|Element, string): HTMLElement), - * removeAttribute: (function(JQLite|Element, string): void)}} - * @constructor - */ -function MdPrefixer(initialAttributes, buildSelector) { - var PREFIXES = ['data', 'x']; - - if (initialAttributes) { - // The prefixer also accepts attributes as a parameter, and immediately builds a list or selector for - // the specified attributes. - return buildSelector ? _buildSelector(initialAttributes) : _buildList(initialAttributes); - } - - return { - buildList: _buildList, - buildSelector: _buildSelector, - hasAttribute: _hasAttribute, - removeAttribute: _removeAttribute - }; - - function _buildList(attributes) { - attributes = angular.isArray(attributes) ? attributes : [attributes]; - - attributes.forEach(function(item) { - PREFIXES.forEach(function(prefix) { - attributes.push(prefix + '-' + item); - }); - }); - - return attributes; - } - - function _buildSelector(attributes) { - attributes = angular.isArray(attributes) ? attributes : [attributes]; - - return _buildList(attributes) - .map(function(item) { - return '[' + item + ']'; - }) - .join(','); - } - - function _hasAttribute(element, attribute) { - element = _getNativeElement(element); - - if (!element) { - return false; - } - - var prefixedAttrs = _buildList(attribute); - - for (var i = 0; i < prefixedAttrs.length; i++) { - if (element.hasAttribute(prefixedAttrs[i])) { - return true; - } - } - - return false; - } - - function _removeAttribute(element, attribute) { - element = _getNativeElement(element); - - if (!element) { - return; - } - - _buildList(attribute).forEach(function(prefixedAttribute) { - element.removeAttribute(prefixedAttribute); - }); - } - - /** - * Transforms a jqLite or DOM element into a HTML element. - * This is useful when supporting jqLite elements and DOM elements at - * same time. - * @param element {JQLite|Element} Element to be parsed - * @returns {HTMLElement} Parsed HTMLElement - */ - function _getNativeElement(element) { - element = element[0] || element; - - if (element.nodeType) { - return element; - } - } - -} - -})(); -(function(){ -"use strict"; - -/* - * This var has to be outside the angular factory, otherwise when - * there are multiple material apps on the same page, each app - * will create its own instance of this array and the app's IDs - * will not be unique. - */ -UtilFactory.$inject = ["$document", "$timeout", "$compile", "$rootScope", "$$mdAnimate", "$interpolate", "$log", "$rootElement", "$window", "$$rAF"]; -var nextUniqueId = 0, isIos, isAndroid, isFirefox; - -// Support material-tools builds. -if (window.navigator) { - var userAgent = window.navigator.userAgent || window.navigator.vendor || window.opera; - isIos = userAgent.match(/ipad|iphone|ipod/i); - isAndroid = userAgent.match(/android/i); - isFirefox = userAgent.match(/(firefox|minefield)/i); -} - -/** - * @ngdoc module - * @name material.core.util - * @description - * Util - */ -angular -.module('material.core') -.factory('$mdUtil', UtilFactory); - -/** - * @ngInject - */ -function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $interpolate, $log, - $rootElement, $window, $$rAF) { - // Setup some core variables for the processTemplate method - var startSymbol = $interpolate.startSymbol(), - endSymbol = $interpolate.endSymbol(), - usesStandardSymbols = ((startSymbol === '{{') && (endSymbol === '}}')); - - // Polyfill document.contains for IE11. - document.contains || (document.contains = function (node) { - return document.body.contains(node); - }); - - /** - * Checks if the target element has the requested style by key - * @param {DOMElement|JQLite} target Target element - * @param {string} key Style key - * @param {string=} expectedVal Optional expected value - * @returns {boolean} Whether the target element has the style or not - */ - var hasComputedStyle = function (target, key, expectedVal) { - var hasValue = false; - - if (target && target.length) { - var computedStyles = $window.getComputedStyle(target[0]); - hasValue = angular.isDefined(computedStyles[key]) && - (expectedVal ? computedStyles[key] == expectedVal : true); - } - - return hasValue; - }; - - function validateCssValue(value) { - return !value ? '0' : - hasPx(value) || hasPercent(value) ? value : value + 'px'; - } - - function hasPx(value) { - return String(value).indexOf('px') > -1; - } - - function hasPercent(value) { - return String(value).indexOf('%') > -1; - } - - var $mdUtil = { - dom: {}, - isIos: isIos, - isAndroid: isAndroid, - now: window.performance && window.performance.now ? - angular.bind(window.performance, window.performance.now) : Date.now || function() { - return new Date().getTime(); - }, - - /** - * Cross-version compatibility method to retrieve an option of a ngModel controller, - * which supports the breaking changes in the AngularJS snapshot (SHA 87a2ff76af5d0a9268d8eb84db5755077d27c84c). - * @param {!ngModel.NgModelController} ngModelCtrl - * @param {!string} optionName - * @returns {string|number|boolean|Object|undefined} - */ - getModelOption: function (ngModelCtrl, optionName) { - if (!ngModelCtrl.$options) { - return; - } - - var $options = ngModelCtrl.$options; - - // The newer versions of AngularJS introduced a getOption function and made the option values - // no longer visible on the $options object. - return $options.getOption ? $options.getOption(optionName) : $options[optionName]; - }, - - /** - * Determines the current 'dir'ectional value based on the value of 'dir' - * attribute of the element. If that is not defined, it will try to use - * a 'dir' attribute of the body or html tag. - * - * @param {Object=} attrs a hash object with key-value pairs of normalized - * attribute names and their corresponding attribute values. - * @returns {boolean} true if the element's passed in attributes, - * the document, or the body indicates RTL mode, false otherwise. - */ - isRtl: function(attrs) { - var dir = angular.isDefined(attrs) && attrs.hasOwnProperty('dir') && attrs.dir; - - switch (dir) { - case 'ltr': - return false; - - case 'rtl': - return true; - } - - return ($document[0].dir === 'rtl' || $document[0].body.dir === 'rtl'); - }, - - /** - * Bi-directional accessor/mutator used to easily update an element's - * property based on the current 'dir'ectional value. - */ - bidi: function(element, property, lValue, rValue) { - var ltr = !this.isRtl(); - - // If accessor - if (arguments.length == 0) return ltr ? 'ltr' : 'rtl'; - - // If mutator - var elem = angular.element(element); - - if (ltr && angular.isDefined(lValue)) { - elem.css(property, validateCssValue(lValue)); - } - else if (!ltr && angular.isDefined(rValue)) { - elem.css(property, validateCssValue(rValue)); - } - }, - - bidiProperty: function (element, lProperty, rProperty, value) { - var ltr = !this.isRtl(); - - var elem = angular.element(element); - - if (ltr && angular.isDefined(lProperty)) { - elem.css(lProperty, validateCssValue(value)); - elem.css(rProperty, ''); - } - else if (!ltr && angular.isDefined(rProperty)) { - elem.css(rProperty, validateCssValue(value)); - elem.css(lProperty, ''); - } - }, - - clientRect: function(element, offsetParent, isOffsetRect) { - var node = getNode(element); - offsetParent = getNode(offsetParent || node.offsetParent || document.body); - var nodeRect = node.getBoundingClientRect(); - - // The user can ask for an offsetRect: a rect relative to the offsetParent, - // or a clientRect: a rect relative to the page - var offsetRect = isOffsetRect ? - offsetParent.getBoundingClientRect() : - {left: 0, top: 0, width: 0, height: 0}; - return { - left: nodeRect.left - offsetRect.left, - top: nodeRect.top - offsetRect.top, - width: nodeRect.width, - height: nodeRect.height - }; - }, - offsetRect: function(element, offsetParent) { - return $mdUtil.clientRect(element, offsetParent, true); - }, - - /** - * Annoying method to copy nodes to an array, thanks to IE. - * @param nodes - * @return {Array} - */ - nodesToArray: function(nodes) { - var results = [], i; - nodes = nodes || []; - - for (i = 0; i < nodes.length; ++i) { - results.push(nodes.item(i)); - } - return results; - }, - - /** - * Determines the absolute position of the viewport. - * Useful when making client rectangles absolute. - * @returns {number} - */ - getViewportTop: function() { - // If body scrolling is disabled, then use the cached viewport top value, otherwise get it - // fresh from the $window. - if ($mdUtil.disableScrollAround._count && $mdUtil.disableScrollAround._viewPortTop) { - return $mdUtil.disableScrollAround._viewPortTop; - } else { - return $window.scrollY || $window.pageYOffset || 0; - } - }, - - /** - * Finds the proper focus target by searching the DOM. - * - * @param {!JQLite} containerEl - * @param {string=} attributeVal - * @returns {JQLite|undefined} - */ - findFocusTarget: function(containerEl, attributeVal) { - var AUTO_FOCUS = this.prefixer('md-autofocus', true); - var elToFocus; - - elToFocus = scanForFocusable(containerEl, attributeVal || AUTO_FOCUS); - - // Scan for fallback to 'universal' API - if (!elToFocus) { - elToFocus = scanForFocusable(containerEl, AUTO_FOCUS); - } - - return elToFocus; - - /** - * Can target and nested children for specified Selector (attribute) - * whose value may be an expression that evaluates to True/False. - * @param {!JQLite} target - * @param {!string} selector - * @return {JQLite|undefined} - */ - function scanForFocusable(target, selector) { - var elFound, items = target[0].querySelectorAll(selector); - - // Find the last child element with the focus attribute - if (items && items.length) { - items.length && angular.forEach(items, function(it) { - it = angular.element(it); - - // Check the element for the md-autofocus class to ensure any associated expression - // evaluated to true. - var isFocusable = it.hasClass('md-autofocus'); - if (isFocusable) elFound = it; - }); - } - return elFound; - } - }, - - /** - * Disables scroll around the passed parent element. - * @param {Element|JQLite=} element Origin Element (not used) - * @param {Element|JQLite=} parent Element to disable scrolling within. - * Defaults to body if none supplied. - * @param {Object=} options Object of options to modify functionality - * - disableScrollMask Boolean of whether or not to create a scroll mask element or - * use the passed parent element. - */ - disableScrollAround: function(element, parent, options) { - options = options || {}; - - $mdUtil.disableScrollAround._count = Math.max(0, $mdUtil.disableScrollAround._count || 0); - $mdUtil.disableScrollAround._count++; - - if ($mdUtil.disableScrollAround._restoreScroll) { - return $mdUtil.disableScrollAround._restoreScroll; - } - - var body = $document[0].body; - var restoreBody = disableBodyScroll(); - var restoreElement = disableElementScroll(parent, options); - - return $mdUtil.disableScrollAround._restoreScroll = function() { - if (--$mdUtil.disableScrollAround._count <= 0) { - delete $mdUtil.disableScrollAround._viewPortTop; - restoreBody(); - restoreElement(); - delete $mdUtil.disableScrollAround._restoreScroll; - } - }; - - /** - * Creates a virtual scrolling mask to prevent touchmove, keyboard, scrollbar clicking, - * and wheel events. - * @param {!Element|!JQLite} elementToDisable - * @param {Object=} scrollMaskOptions Object of options to modify functionality - * - disableScrollMask Boolean of whether or not to create a scroll mask element or - * use the passed parent element. - * @returns {Function} - */ - function disableElementScroll(elementToDisable, scrollMaskOptions) { - var scrollMask; - var wrappedElementToDisable = angular.element(elementToDisable || body); - - if (scrollMaskOptions.disableScrollMask) { - scrollMask = wrappedElementToDisable; - } else { - scrollMask = angular.element( - '
    ' + - '
    ' + - '
    '); - wrappedElementToDisable.append(scrollMask); - } - - /** - * @param {Event} $event - */ - function preventDefault($event) { - $event.preventDefault(); - } - - scrollMask.on('wheel touchmove', preventDefault); - - return function restoreElementScroll() { - scrollMask.off('wheel touchmove', preventDefault); - - if (!scrollMaskOptions.disableScrollMask && scrollMask[0].parentNode) { - scrollMask[0].parentNode.removeChild(scrollMask[0]); - } - }; - } - - // Converts the body to a position fixed block and translate it to the proper scroll position - function disableBodyScroll() { - var documentElement = $document[0].documentElement; - - var prevDocumentStyle = documentElement.style.cssText || ''; - var prevBodyStyle = body.style.cssText || ''; - - var viewportTop = $mdUtil.getViewportTop(); - $mdUtil.disableScrollAround._viewPortTop = viewportTop; - var clientWidth = body.clientWidth; - var hasVerticalScrollbar = body.scrollHeight > body.clientHeight + 1; - - // Scroll may be set on element (for example by overflow-y: scroll) - // but Chrome is reporting the scrollTop position always on . - // scrollElement will allow to restore the scrollTop position to proper target. - var scrollElement = documentElement.scrollTop > 0 ? documentElement : body; - - if (hasVerticalScrollbar) { - angular.element(body).css({ - position: 'fixed', - width: '100%', - top: -viewportTop + 'px' - }); - } - - if (body.clientWidth < clientWidth) { - body.style.overflow = 'hidden'; - } - - return function restoreScroll() { - // Reset the inline style CSS to the previous. - body.style.cssText = prevBodyStyle; - documentElement.style.cssText = prevDocumentStyle; - - // The scroll position while being fixed - scrollElement.scrollTop = viewportTop; - }; - } - - }, - - enableScrolling: function() { - var restoreFn = this.disableScrollAround._restoreScroll; - restoreFn && restoreFn(); - }, - - floatingScrollbars: function() { - if (this.floatingScrollbars.cached === undefined) { - var tempNode = angular.element('
    ').css({ - width: '100%', - 'z-index': -1, - position: 'absolute', - height: '35px', - 'overflow-y': 'scroll' - }); - tempNode.children().css('height', '60px'); - - $document[0].body.appendChild(tempNode[0]); - this.floatingScrollbars.cached = - (tempNode[0].offsetWidth === tempNode[0].childNodes[0].offsetWidth); - tempNode.remove(); - } - return this.floatingScrollbars.cached; - }, - - /** - * Mobile safari only allows you to set focus in click event listeners. - * @param {Element|JQLite} element to focus - */ - forceFocus: function(element) { - var node = element[0] || element; - - document.addEventListener('click', function focusOnClick(ev) { - if (ev.target === node && ev.$focus) { - node.focus(); - ev.stopImmediatePropagation(); - ev.preventDefault(); - node.removeEventListener('click', focusOnClick); - } - }, true); - - var newEvent = document.createEvent('MouseEvents'); - newEvent.initMouseEvent('click', false, true, window, {}, 0, 0, 0, 0, - false, false, false, false, 0, null); - newEvent.$material = true; - newEvent.$focus = true; - node.dispatchEvent(newEvent); - }, - - /** - * facade to build md-backdrop element with desired styles - * NOTE: Use $compile to trigger backdrop postLink function - */ - createBackdrop: function(scope, addClass) { - return $compile($mdUtil.supplant('', [addClass]))(scope); - }, - - /** - * supplant() method from Crockford's `Remedial Javascript` - * Equivalent to use of $interpolate; without dependency on - * interpolation symbols and scope. Note: the '{}' can - * be property names, property chains, or array indices. - */ - supplant: function(template, values, pattern) { - pattern = pattern || /\{([^{}]*)\}/g; - return template.replace(pattern, function(a, b) { - var p = b.split('.'), - r = values; - try { - for (var s in p) { - if (p.hasOwnProperty(s)) { - r = r[p[s]]; - } - } - } catch (e) { - r = a; - } - return (typeof r === 'string' || typeof r === 'number') ? r : a; - }); - }, - - fakeNgModel: function() { - return { - $fake: true, - $setTouched: angular.noop, - $setViewValue: function(value) { - this.$viewValue = value; - this.$render(value); - this.$viewChangeListeners.forEach(function(cb) { - cb(); - }); - }, - $isEmpty: function(value) { - return ('' + value).length === 0; - }, - $parsers: [], - $formatters: [], - $viewChangeListeners: [], - $render: angular.noop - }; - }, - - /** - * @param {Function} func original function to be debounced - * @param {number} wait number of milliseconds to delay (since last debounce reset). - * Default value 10 msecs. - * @param {Object} scope in which to apply the function after debouncing ends - * @param {boolean} invokeApply should the $timeout trigger $digest() dirty checking - * @return {Function} A function, that, as long as it continues to be invoked, will not be - * triggered. The function will be called after it stops being called for N milliseconds. - */ - debounce: function(func, wait, scope, invokeApply) { - var timer; - - return function debounced() { - var context = scope, - args = Array.prototype.slice.call(arguments); - - $timeout.cancel(timer); - timer = $timeout(function() { - - timer = undefined; - func.apply(context, args); - - }, wait || 10, invokeApply); - }; - }, - - /** - * The function will not be called unless it has been more than `delay` milliseconds since the - * last call. - * @param {Function} func original function to throttle - * @param {number} delay number of milliseconds to delay - * @return {Function} a function that can only be triggered every `delay` milliseconds. - */ - throttle: function throttle(func, delay) { - var recent; - return function throttled() { - var context = this; - var args = arguments; - var now = $mdUtil.now(); - - if (!recent || (now - recent > delay)) { - func.apply(context, args); - recent = now; - } - }; - }, - - /** - * Measures the number of milliseconds taken to run the provided callback - * function. Uses a high-precision timer if available. - */ - time: function time(cb) { - var start = $mdUtil.now(); - cb(); - return $mdUtil.now() - start; - }, - - /** - * Create an implicit getter that caches its `getter()` - * lookup value - */ - valueOnUse : function (scope, key, getter) { - var value = null, args = Array.prototype.slice.call(arguments); - var params = (args.length > 3) ? args.slice(3) : []; - - Object.defineProperty(scope, key, { - get: function () { - if (value === null) value = getter.apply(scope, params); - return value; - } - }); - }, - - /** - * Get a unique ID. - * - * @returns {string} an unique numeric string - */ - nextUid: function() { - return '' + nextUniqueId++; - }, - - /** - * Stop watchers and events from firing on a scope without destroying it, - * by disconnecting it from its parent and its siblings' linked lists. - * @param {Object} scope to disconnect - */ - disconnectScope: function disconnectScope(scope) { - if (!scope) return; - - // we can't destroy the root scope or a scope that has been already destroyed - if (scope.$root === scope) return; - if (scope.$$destroyed) return; - - var parent = scope.$parent; - scope.$$disconnected = true; - - // See Scope.$destroy - if (parent.$$childHead === scope) parent.$$childHead = scope.$$nextSibling; - if (parent.$$childTail === scope) parent.$$childTail = scope.$$prevSibling; - if (scope.$$prevSibling) scope.$$prevSibling.$$nextSibling = scope.$$nextSibling; - if (scope.$$nextSibling) scope.$$nextSibling.$$prevSibling = scope.$$prevSibling; - - scope.$$nextSibling = scope.$$prevSibling = null; - - }, - - /** - * Undo the effects of disconnectScope(). - * @param {Object} scope to reconnect - */ - reconnectScope: function reconnectScope(scope) { - if (!scope) return; - - // we can't disconnect the root node or scope already disconnected - if (scope.$root === scope) return; - if (!scope.$$disconnected) return; - - var child = scope; - - var parent = child.$parent; - child.$$disconnected = false; - // See Scope.$new for this logic... - child.$$prevSibling = parent.$$childTail; - if (parent.$$childHead) { - parent.$$childTail.$$nextSibling = child; - parent.$$childTail = child; - } else { - parent.$$childHead = parent.$$childTail = child; - } - }, - - /** - * Get an element's siblings matching a given tag name. - * - * @param {JQLite|angular.element|HTMLElement} element Element to start walking the DOM from - * @param {string} tagName HTML tag name to match against - * @returns {Object[]} JQLite - */ - getSiblings: function getSiblings(element, tagName) { - var upperCasedTagName = tagName.toUpperCase(); - if (element instanceof angular.element) { - element = element[0]; - } - var siblings = Array.prototype.filter.call(element.parentNode.children, function(node) { - return element !== node && node.tagName.toUpperCase() === upperCasedTagName; - }); - return siblings.map(function (sibling) { - return angular.element(sibling); - }); - }, - - /** - * getClosest replicates jQuery.closest() to walk up the DOM tree until it finds a matching - * nodeName. - * - * @param {Node} el Element to start walking the DOM from - * @param {string|function} validateWith If a string is passed, it will be evaluated against - * each of the parent nodes' tag name. If a function is passed, the loop will call it with each - * of the parents and will use the return value to determine whether the node is a match. - * @param {boolean=} onlyParent Only start checking from the parent element, not `el`. - * @returns {Node|null} closest matching parent Node or null if not found - */ - getClosest: function getClosest(el, validateWith, onlyParent) { - if (angular.isString(validateWith)) { - var tagName = validateWith.toUpperCase(); - validateWith = function(el) { - return el.nodeName.toUpperCase() === tagName; - }; - } - - if (el instanceof angular.element) el = el[0]; - if (onlyParent) el = el.parentNode; - if (!el) return null; - - do { - if (validateWith(el)) { - return el; - } - } while (el = el.parentNode); - - return null; - }, - - /** - * Build polyfill for the Node.contains feature (if needed) - * @param {Node} node - * @param {Node} child - * @returns {Node} - */ - elementContains: function(node, child) { - var hasContains = (window.Node && window.Node.prototype && Node.prototype.contains); - var findFn = hasContains ? angular.bind(node, node.contains) : angular.bind(node, function(arg) { - // compares the positions of two nodes and returns a bitmask - return (node === child) || !!(this.compareDocumentPosition(arg) & 16); - }); - - return findFn(child); - }, - - /** - * Functional equivalent for $element.filter(‘md-bottom-sheet’) - * useful with interimElements where the element and its container are important... - * - * @param {JQLite} element to scan - * @param {string} nodeName of node to find (e.g. 'md-dialog') - * @param {boolean=} scanDeep optional flag to allow deep scans; defaults to 'false'. - * @param {boolean=} warnNotFound optional flag to enable log warnings; defaults to false - */ - extractElementByName: function(element, nodeName, scanDeep, warnNotFound) { - var found = scanTree(element); - if (!found && !!warnNotFound) { - $log.warn($mdUtil.supplant("Unable to find node '{0}' in element '{1}'.",[nodeName, element[0].outerHTML])); - } - - return angular.element(found || element); - - /** - * Breadth-First tree scan for element with matching `nodeName` - */ - function scanTree(element) { - return scanLevel(element) || (scanDeep ? scanChildren(element) : null); - } - - /** - * Case-insensitive scan of current elements only (do not descend). - */ - function scanLevel(element) { - if (element) { - for (var i = 0, len = element.length; i < len; i++) { - if (element[i].nodeName.toLowerCase() === nodeName) { - return element[i]; - } - } - } - return null; - } - - /** - * Scan children of specified node - */ - function scanChildren(element) { - var found; - if (element) { - for (var i = 0, len = element.length; i < len; i++) { - var target = element[i]; - if (!found) { - for (var j = 0, numChild = target.childNodes.length; j < numChild; j++) { - found = found || scanTree([target.childNodes[j]]); - } - } - } - } - return found; - } - - }, - - /** - * Give optional properties with no value a boolean true if attr provided or false otherwise - */ - initOptionalProperties: function(scope, attr, defaults) { - defaults = defaults || {}; - angular.forEach(scope.$$isolateBindings, function(binding, key) { - if (binding.optional && angular.isUndefined(scope[key])) { - var attrIsDefined = angular.isDefined(attr[binding.attrName]); - scope[key] = angular.isDefined(defaults[key]) ? defaults[key] : attrIsDefined; - } - }); - }, - - /** - * Alternative to $timeout calls with 0 delay. - * nextTick() coalesces all calls within a single frame - * to minimize $digest thrashing - * - * @param {Function} callback function to be called after the tick - * @param {boolean=} digest true to call $rootScope.$digest() after callback - * @param {Object=} scope associated with callback. If the scope is destroyed, the callback will - * be skipped. - * @returns {*} - */ - nextTick: function(callback, digest, scope) { - // grab function reference for storing state details - var nextTick = $mdUtil.nextTick; - var timeout = nextTick.timeout; - var queue = nextTick.queue || []; - - // add callback to the queue - queue.push({scope: scope, callback: callback}); - - // set default value for digest - if (digest == null) digest = true; - - // store updated digest/queue values - nextTick.digest = nextTick.digest || digest; - nextTick.queue = queue; - - // either return existing timeout or create a new one - return timeout || (nextTick.timeout = $timeout(processQueue, 0, false)); - - /** - * Grab a copy of the current queue - * Clear the queue for future use - * Process the existing queue - * Trigger digest if necessary - */ - function processQueue() { - var queue = nextTick.queue; - var digest = nextTick.digest; - - nextTick.queue = []; - nextTick.timeout = null; - nextTick.digest = false; - - queue.forEach(function(queueItem) { - var skip = queueItem.scope && queueItem.scope.$$destroyed; - if (!skip) { - queueItem.callback(); - } - }); - - if (digest) $rootScope.$digest(); - } - }, - - /** - * Processes a template and replaces the start/end symbols if the application has - * overridden them. - * - * @param template The template to process whose start/end tags may be replaced. - * @returns {*} - */ - processTemplate: function(template) { - if (usesStandardSymbols) { - return template; - } else { - if (!template || !angular.isString(template)) return template; - return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol); - } - }, - - /** - * Scan up dom hierarchy for enabled parent; - */ - getParentWithPointerEvents: function (element) { - var parent = element.parent(); - - // jqLite might return a non-null, but still empty, parent; so check for parent and length - while (hasComputedStyle(parent, 'pointer-events', 'none')) { - parent = parent.parent(); - } - - return parent; - }, - - getNearestContentElement: function (element) { - var current = element.parent()[0]; - // Look for the nearest parent md-content, stopping at the rootElement. - while (current && current !== $rootElement[0] && current !== document.body && current.nodeName.toUpperCase() !== 'MD-CONTENT') { - current = current.parentNode; - } - return current; - }, - - /** - * Checks if the current browser is natively supporting the `sticky` position. - * @returns {string} supported sticky property name - */ - checkStickySupport: function() { - var stickyProp; - var testEl = angular.element('
    '); - $document[0].body.appendChild(testEl[0]); - - var stickyProps = ['sticky', '-webkit-sticky']; - for (var i = 0; i < stickyProps.length; ++i) { - testEl.css({ - position: stickyProps[i], - top: 0, - 'z-index': 2 - }); - - if (testEl.css('position') == stickyProps[i]) { - stickyProp = stickyProps[i]; - break; - } - } - - testEl.remove(); - - return stickyProp; - }, - - /** - * Parses an attribute value, mostly a string. - * By default checks for negated values and returns `false´ if present. - * Negated values are: (native falsy) and negative strings like: - * `false` or `0`. - * @param value Attribute value which should be parsed. - * @param negatedCheck When set to false, won't check for negated values. - * @returns {boolean} - */ - parseAttributeBoolean: function(value, negatedCheck) { - return value === '' || !!value && (negatedCheck === false || value !== 'false' && value !== '0'); - }, - - hasComputedStyle: hasComputedStyle, - - /** - * Returns true if the parent form of the element has been submitted. - * @param element An AngularJS or HTML5 element. - * @returns {boolean} - */ - isParentFormSubmitted: function(element) { - var parent = $mdUtil.getClosest(element, 'form'); - var form = parent ? angular.element(parent).controller('form') : null; - - return form ? form.$submitted : false; - }, - - /** - * Animate the requested element's scrollTop to the requested scrollPosition with basic easing. - * @param {!Element} element The element to scroll. - * @param {number} scrollEnd The new/final scroll position. - * @param {number=} duration Duration of the scroll. Default is 1000ms. - */ - animateScrollTo: function(element, scrollEnd, duration) { - var scrollStart = element.scrollTop; - var scrollChange = scrollEnd - scrollStart; - var scrollingDown = scrollStart < scrollEnd; - var startTime = $mdUtil.now(); - - $$rAF(scrollChunk); - - function scrollChunk() { - var newPosition = calculateNewPosition(); - - element.scrollTop = newPosition; - - if (scrollingDown ? newPosition < scrollEnd : newPosition > scrollEnd) { - $$rAF(scrollChunk); - } - } - - function calculateNewPosition() { - var easeDuration = duration || 1000; - var currentTime = $mdUtil.now() - startTime; - - return ease(currentTime, scrollStart, scrollChange, easeDuration); - } - - function ease(currentTime, start, change, duration) { - // If the duration has passed (which can occur if our app loses focus due to $$rAF), jump - // straight to the proper position - if (currentTime > duration) { - return start + change; - } - - var ts = (currentTime /= duration) * currentTime; - var tc = ts * currentTime; - - return start + change * (-2 * tc + 3 * ts); - } - }, - - /** - * Provides an easy mechanism for removing duplicates from an array. - * - * var myArray = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]; - * - * $mdUtil.uniq(myArray) => [1, 2, 3, 4] - * - * @param {Array} array The array whose unique values should be returned. - * @returns {Array|void} A copy of the array containing only unique values. - */ - uniq: function(array) { - if (!array) { return; } - - return array.filter(function(value, index, self) { - return self.indexOf(value) === index; - }); - }, - - /** - * Gets the inner HTML content of the given HTMLElement. - * Only intended for use with SVG or Symbol elements in IE11. - * @param {Element} element - * @returns {string} the inner HTML of the element passed in - */ - getInnerHTML: function(element) { - // For SVG or Symbol elements, innerHTML returns `undefined` in IE. - // Reference: https://stackoverflow.com/q/28129956/633107 - // The XMLSerializer API is supported on IE11 and is the recommended workaround. - var serializer = new XMLSerializer(); - - return Array.prototype.map.call(element.childNodes, function (child) { - return serializer.serializeToString(child); - }).join(''); - }, - - /** - * Gets the outer HTML content of the given HTMLElement. - * Only intended for use with SVG or Symbol elements in IE11. - * @param {Element} element - * @returns {string} the outer HTML of the element passed in - */ - getOuterHTML: function(element) { - // For SVG or Symbol elements, outerHTML returns `undefined` in IE. - // Reference: https://stackoverflow.com/q/29888050/633107 - // The XMLSerializer API is supported on IE11 and is the recommended workaround. - var serializer = new XMLSerializer(); - return serializer.serializeToString(element); - }, - - /** - * Support: IE 9-11 only - * documentMode is an IE-only property - * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx - */ - msie: window.document.documentMode, - - getTouchAction: function() { - var testEl = document.createElement('div'); - var vendorPrefixes = ['', 'webkit', 'Moz', 'MS', 'ms', 'o']; - - for (var i = 0; i < vendorPrefixes.length; i++) { - var prefix = vendorPrefixes[i]; - var property = prefix ? prefix + 'TouchAction' : 'touchAction'; - if (angular.isDefined(testEl.style[property])) { - return property; - } - } - }, - - /** - * @param {Event} event the event to calculate the bubble path for - * @return {EventTarget[]} the set of nodes that this event could bubble up to - */ - getEventPath: function(event) { - var path = []; - var currentTarget = event.target; - while (currentTarget) { - path.push(currentTarget); - currentTarget = currentTarget.parentElement; - } - if (path.indexOf(window) === -1 && path.indexOf(document) === -1) - path.push(document); - if (path.indexOf(window) === -1) - path.push(window); - return path; - }, - - /** - * Gets the string the user has entered and removes Regex identifiers - * @param {string} term - * @returns {string} sanitized string - */ - sanitize: function(term) { - if (!term) return term; - return term.replace(/[\\^$*+?.()|{}[]/g, '\\$&'); - }, - - /********************************************************************************************** - * The following functions were sourced from - * https://github.com/angular/components/blob/3c37e4b1c1cb74a3d0a90d173240fc730d21d9d4/src/cdk/a11y/interactivity-checker/interactivity-checker.ts - **********************************************************************************************/ - - /** - * Gets whether an element is disabled. - * @param {HTMLElement} element Element to be checked. - * @returns {boolean} Whether the element is disabled. - */ - isDisabled: function(element) { - // This does not capture some cases, such as a non-form control with a disabled attribute or - // a form control inside of a disabled form, but should capture the most common cases. - return element.hasAttribute('disabled'); - }, - - /** - * Gets whether an element is visible for the purposes of interactivity. - * - * This will capture states like `display: none` and `visibility: hidden`, but not things like - * being clipped by an `overflow: hidden` parent or being outside the viewport. - * - * @param {HTMLElement} element - * @returns {boolean} Whether the element is visible. - */ - isVisible: function(element) { - return $mdUtil.hasGeometry(element) && getComputedStyle(element).visibility === 'visible'; - }, - - /** - * Gets whether an element can be reached via Tab key. - * Assumes that the element has already been checked with isFocusable. - * @param {HTMLElement} element Element to be checked. - * @returns {boolean} Whether the element is tabbable. - */ - isTabbable: function(element) { - var frameElement = $mdUtil.getFrameElement($mdUtil.getWindow(element)); - - if (frameElement) { - // Frame elements inherit their tabindex onto all child elements. - if ($mdUtil.getTabIndexValue(frameElement) === -1) { - return false; - } - - // Browsers disable tabbing to an element inside of an invisible frame. - if (!$mdUtil.isVisible(frameElement)) { - return false; - } - } - - var nodeName = element.nodeName.toLowerCase(); - var tabIndexValue = $mdUtil.getTabIndexValue(element); - - if (element.hasAttribute('contenteditable')) { - return tabIndexValue !== -1; - } - - if (nodeName === 'iframe' || nodeName === 'object') { - // The frame or object's content may be tabbable depending on the content, but it's - // not possibly to reliably detect the content of the frames. We always consider such - // elements as non-tabbable. - return false; - } - - // In iOS, the browser only considers some specific elements as tabbable. - if (isIos && !$mdUtil.isPotentiallyTabbableIOS(element)) { - return false; - } - - if (nodeName === 'audio') { - // Audio elements without controls enabled are never tabbable, regardless - // of the tabindex attribute explicitly being set. - if (!element.hasAttribute('controls')) { - return false; - } - // Audio elements with controls are by default tabbable unless the - // tabindex attribute is set to `-1` explicitly. - return tabIndexValue !== -1; - } - - if (nodeName === 'video') { - // For all video elements, if the tabindex attribute is set to `-1`, the video - // is not tabbable. Note: We cannot rely on the default `HTMLElement.tabIndex` - // property as that one is set to `-1` in Chrome, Edge and Safari v13.1. The - // tabindex attribute is the source of truth here. - if (tabIndexValue === -1) { - return false; - } - // If the tabindex is explicitly set, and not `-1` (as per check before), the - // video element is always tabbable (regardless of whether it has controls or not). - if (tabIndexValue !== null) { - return true; - } - // Otherwise (when no explicit tabindex is set), a video is only tabbable if it - // has controls enabled. Firefox is special as videos are always tabbable regardless - // of whether there are controls or not. - return isFirefox || element.hasAttribute('controls'); - } - - return element.tabIndex >= 0; - }, - - /** - * Gets whether an element can be focused by the user. - * @param {HTMLElement} element Element to be checked. - * @returns {boolean} Whether the element is focusable. - */ - isFocusable: function(element) { - // Perform checks in order of left to most expensive. - // Again, naive approach that does not capture many edge cases and browser quirks. - return $mdUtil.isPotentiallyFocusable(element) && !$mdUtil.isDisabled(element) && - $mdUtil.isVisible(element); - }, - - /** - * Gets whether an element is potentially focusable without taking current visible/disabled - * state into account. - * @param {HTMLElement} element - * @returns {boolean} - */ - isPotentiallyFocusable: function(element) { - // Inputs are potentially focusable *unless* they're type="hidden". - if ($mdUtil.isHiddenInput(element)) { - return false; - } - - return $mdUtil.isNativeFormElement(element) || - $mdUtil.isAnchorWithHref(element) || - element.hasAttribute('contenteditable') || - $mdUtil.hasValidTabIndex(element); - }, - - /** - * Checks whether the specified element is potentially tabbable on iOS. - * @param {HTMLElement} element - * @returns {boolean} - */ - isPotentiallyTabbableIOS: function(element) { - var nodeName = element.nodeName.toLowerCase(); - var inputType = nodeName === 'input' && element.type; - - return inputType === 'text' - || inputType === 'password' - || nodeName === 'select' - || nodeName === 'textarea'; - }, - - /** - * Returns the parsed tabindex from the element attributes instead of returning the - * evaluated tabindex from the browsers defaults. - * @param {HTMLElement} element - * @returns {null|number} - */ - getTabIndexValue: function(element) { - if (!$mdUtil.hasValidTabIndex(element)) { - return null; - } - - // See browser issue in Gecko https://bugzilla.mozilla.org/show_bug.cgi?id=1128054 - var tabIndex = parseInt(element.getAttribute('tabindex') || '', 10); - - return isNaN(tabIndex) ? -1 : tabIndex; - }, - - /** - * Gets whether an element has a valid tabindex. - * @param {HTMLElement} element - * @returns {boolean} - */ - hasValidTabIndex: function(element) { - if (!element.hasAttribute('tabindex') || element.tabIndex === undefined) { - return false; - } - - var tabIndex = element.getAttribute('tabindex'); - - // IE11 parses tabindex="" as the value "-32768" - if (tabIndex == '-32768') { - return false; - } - - return !!(tabIndex && !isNaN(parseInt(tabIndex, 10))); - }, - - /** - * Checks whether the specified element has any geometry / rectangles. - * @param {HTMLElement} element - * @returns {boolean} - */ - hasGeometry: function(element) { - // Use logic from jQuery to check for an invisible element. - // See https://github.com/jquery/jquery/blob/8969732518470a7f8e654d5bc5be0b0076cb0b87/src/css/hiddenVisibleSelectors.js#L9 - return !!(element.offsetWidth || element.offsetHeight || - (typeof element.getClientRects === 'function' && element.getClientRects().length)); - }, - - /** - * Returns the frame element from a window object. Since browsers like MS Edge throw errors if - * the frameElement property is being accessed from a different host address, this property - * should be accessed carefully. - * @param {Window} window - * @returns {null|HTMLElement} - */ - getFrameElement: function(window) { - try { - return window.frameElement; - } catch (error) { - return null; - } - }, - - /** - * Gets the parent window of a DOM node with regards of being inside of an iframe. - * @param {HTMLElement} node - * @returns {Window} - */ - getWindow: function(node) { - // ownerDocument is null if `node` itself *is* a document. - return node.ownerDocument && node.ownerDocument.defaultView || window; - }, - - /** - * Gets whether an element's - * @param {Node} element - * @returns {boolean} - */ - isNativeFormElement: function(element) { - var nodeName = element.nodeName.toLowerCase(); - return nodeName === 'input' || - nodeName === 'select' || - nodeName === 'button' || - nodeName === 'textarea'; - }, - - /** - * Gets whether an element is an ``. - * @param {HTMLElement} element - * @returns {boolean} - */ - isHiddenInput: function(element) { - return $mdUtil.isInputElement(element) && element.type == 'hidden'; - }, - - /** - * Gets whether an element is an anchor that has an href attribute. - * @param {HTMLElement} element - * @returns {boolean} - */ - isAnchorWithHref: function(element) { - return $mdUtil.isAnchorElement(element) && element.hasAttribute('href'); - }, - - /** - * Gets whether an element is an input element. - * @param {HTMLElement} element - * @returns {boolean} - */ - isInputElement: function(element) { - return element.nodeName.toLowerCase() == 'input'; - }, - - /** - * Gets whether an element is an anchor element. - * @param {HTMLElement} element - * @returns {boolean} - */ - isAnchorElement: function(element) { - return element.nodeName.toLowerCase() == 'a'; - }, - - /********************************************************************************************** - * The following two functions were sourced from - * https://github.com/angular/components/blob/3c37e4b1c1cb74a3d0a90d173240fc730d21d9d4/src/cdk/a11y/focus-trap/focus-trap.ts#L268-L311 - **********************************************************************************************/ - - /** - * Get the first tabbable element from a DOM subtree (inclusive). - * @param {HTMLElement} root - * @returns {HTMLElement|null} - */ - getFirstTabbableElement: function(root) { - if ($mdUtil.isFocusable(root) && $mdUtil.isTabbable(root)) { - return root; - } - - // Iterate in DOM order. Note that IE doesn't have `children` for SVG so we fall - // back to `childNodes` which includes text nodes, comments etc. - var children = root.children || root.childNodes; - - for (var i = 0; i < children.length; i++) { - var tabbableChild = children[i].nodeType === $document[0].ELEMENT_NODE ? - $mdUtil.getFirstTabbableElement(children[i]) : null; - - if (tabbableChild) { - return tabbableChild; - } - } - - return null; - }, - - /** - * Get the last tabbable element from a DOM subtree (inclusive). - * @param {HTMLElement} root - * @returns {HTMLElement|null} - */ - getLastTabbableElement: function(root) { - if ($mdUtil.isFocusable(root) && $mdUtil.isTabbable(root)) { - return root; - } - - // Iterate in reverse DOM order. - var children = root.children || root.childNodes; - - for (var i = children.length - 1; i >= 0; i--) { - var tabbableChild = children[i].nodeType === $document[0].ELEMENT_NODE ? - $mdUtil.getLastTabbableElement(children[i]) : null; - - if (tabbableChild) { - return tabbableChild; - } - } - - return null; - } - }; - - // Instantiate other namespace utility methods - - $mdUtil.dom.animator = $$mdAnimate($mdUtil); - - return $mdUtil; - - function getNode(el) { - return el[0] || el; - } -} - -/** - * Since removing jQuery from the demos, some code that uses `element.focus()` is broken. - * We need to add `element.focus()`, because it's testable unlike `element[0].focus`. - */ -angular.element.prototype.focus = angular.element.prototype.focus || function() { - if (this.length) { - this[0].focus(); - } - return this; -}; - -angular.element.prototype.blur = angular.element.prototype.blur || function() { - if (this.length) { - this[0].blur(); - } - return this; -}; - -})(); -(function(){ -"use strict"; - -// Polyfill angular < 1.4 (provide $animateCss) -angular - .module('material.core') - .factory('$$mdAnimate', ["$q", "$timeout", "$mdConstant", "$animateCss", function($q, $timeout, $mdConstant, $animateCss) { - // Since $$mdAnimate is injected into $mdUtil... use a wrapper function - // to subsequently inject $mdUtil as an argument to the AnimateDomUtils - return function($mdUtil) { - return AnimateDomUtils($mdUtil, $q, $timeout, $mdConstant, $animateCss); - }; - }]); - -/** - * Factory function that requires special injections - */ -function AnimateDomUtils($mdUtil, $q, $timeout, $mdConstant, $animateCss) { - var self; - return self = { - translate3d : function(target, from, to, options) { - return $animateCss(target, { - from: from, - to: to, - addClass: options.transitionInClass, - removeClass: options.transitionOutClass, - duration: options.duration - }) - .start() - .then(function() { - // Resolve with reverser function... - return reverseTranslate; - }); - - /** - * Specific reversal of the request translate animation above... - */ - function reverseTranslate (newFrom) { - return $animateCss(target, { - to: newFrom || from, - addClass: options.transitionOutClass, - removeClass: options.transitionInClass, - duration: options.duration - }).start(); - } - }, - - /** - * Listen for transitionEnd event (with optional timeout) - * Announce completion or failure via promise handlers - */ - waitTransitionEnd: function (element, opts) { - var TIMEOUT = 3000; // fallback is 3 secs - - return $q(function(resolve, reject){ - opts = opts || { }; - - // If there is no transition is found, resolve immediately - // - // NOTE: using $mdUtil.nextTick() causes delays/issues - if (noTransitionFound(opts.cachedTransitionStyles)) { - TIMEOUT = 0; - } - - var timer = $timeout(finished, opts.timeout || TIMEOUT); - element.on($mdConstant.CSS.TRANSITIONEND, finished); - - /** - * Upon timeout or transitionEnd, reject or resolve (respectively) this promise. - * NOTE: Make sure this transitionEnd didn't bubble up from a child - */ - function finished(ev) { - if (ev && ev.target !== element[0]) return; - - if (ev) $timeout.cancel(timer); - element.off($mdConstant.CSS.TRANSITIONEND, finished); - - // Never reject since ngAnimate may cause timeouts due missed transitionEnd events - resolve(); - } - - /** - * Checks whether or not there is a transition. - * - * @param styles The cached styles to use for the calculation. If null, getComputedStyle() - * will be used. - * - * @returns {boolean} True if there is no transition/duration; false otherwise. - */ - function noTransitionFound(styles) { - styles = styles || window.getComputedStyle(element[0]); - - return styles.transitionDuration === '0s' || - (!styles.transition && !styles.transitionProperty); - } - }); - }, - - calculateTransformValues: function (element, originator) { - var origin = originator.element; - var bounds = originator.bounds; - - if (origin || bounds) { - var originBnds = origin ? self.clientRect(origin) || currentBounds() : self.copyRect(bounds); - var dialogRect = self.copyRect(element[0].getBoundingClientRect()); - var dialogCenterPt = self.centerPointFor(dialogRect); - var originCenterPt = self.centerPointFor(originBnds); - - return { - centerX: originCenterPt.x - dialogCenterPt.x, - centerY: originCenterPt.y - dialogCenterPt.y, - scaleX: Math.round(100 * Math.min(0.5, originBnds.width / dialogRect.width)) / 100, - scaleY: Math.round(100 * Math.min(0.5, originBnds.height / dialogRect.height)) / 100 - }; - } - return {centerX: 0, centerY: 0, scaleX: 0.5, scaleY: 0.5}; - - /** - * This is a fallback if the origin information is no longer valid, then the - * origin bounds simply becomes the current bounds for the dialogContainer's parent. - * @returns {null|DOMRect} - */ - function currentBounds() { - var container = element ? element.parent() : null; - var parent = container ? container.parent() : null; - - return parent ? self.clientRect(parent) : null; - } - }, - - /** - * Calculate the zoom transform from dialog to origin. - * - * We use this to set the dialog position immediately; - * then the md-transition-in actually translates back to - * `translate3d(0,0,0) scale(1.0)`... - * - * NOTE: all values are rounded to the nearest integer - */ - calculateZoomToOrigin: function (element, originator) { - var zoomTemplate = "translate3d( {centerX}px, {centerY}px, 0 ) scale( {scaleX}, {scaleY} )"; - var buildZoom = angular.bind(null, $mdUtil.supplant, zoomTemplate); - - return buildZoom(self.calculateTransformValues(element, originator)); - }, - - /** - * Calculate the slide transform from panel to origin. - * NOTE: all values are rounded to the nearest integer - */ - calculateSlideToOrigin: function (element, originator) { - var slideTemplate = "translate3d( {centerX}px, {centerY}px, 0 )"; - var buildSlide = angular.bind(null, $mdUtil.supplant, slideTemplate); - - return buildSlide(self.calculateTransformValues(element, originator)); - }, - - /** - * Enhance raw values to represent valid css stylings... - */ - toCss : function(raw) { - var css = { }; - var lookups = 'left top right bottom width height x y min-width min-height max-width max-height'; - - angular.forEach(raw, function(value,key) { - if (angular.isUndefined(value)) return; - - if (lookups.indexOf(key) >= 0) { - css[key] = value + 'px'; - } else { - switch (key) { - case 'transition': - convertToVendor(key, $mdConstant.CSS.TRANSITION, value); - break; - case 'transform': - convertToVendor(key, $mdConstant.CSS.TRANSFORM, value); - break; - case 'transformOrigin': - convertToVendor(key, $mdConstant.CSS.TRANSFORM_ORIGIN, value); - break; - case 'font-size': - css['font-size'] = value; // font sizes aren't always in px - break; - } - } - }); - - return css; - - function convertToVendor(key, vendor, value) { - angular.forEach(vendor.split(' '), function (key) { - css[key] = value; - }); - } - }, - - /** - * Convert the translate CSS value to key/value pair(s). - * @param {string} transform - * @param {boolean=} addTransition - * @param {string=} transition - * @return {Object} object containing CSS translate key/value pair(s) - */ - toTransformCss: function (transform, addTransition, transition) { - var css = {}; - angular.forEach($mdConstant.CSS.TRANSFORM.split(' '), function (key) { - css[key] = transform; - }); - - if (addTransition) { - transition = transition || "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) !important"; - css.transition = transition; - } - - return css; - }, - - /** - * Clone the Rect and calculate the height/width if needed. - * @param {DOMRect} source - * @param {DOMRect=} destination - * @returns {null|DOMRect} - */ - copyRect: function (source, destination) { - if (!source) return null; - - destination = destination || {}; - - angular.forEach('left top right bottom width height'.split(' '), function (key) { - destination[key] = Math.round(source[key]); - }); - - destination.width = destination.width || (destination.right - destination.left); - destination.height = destination.height || (destination.bottom - destination.top); - - return destination; - }, - - /** - * Calculate ClientRect of element; return null if hidden or zero size. - * @param {Element|string} element - * @returns {null|DOMRect} - */ - clientRect: function (element) { - var bounds = angular.element(element)[0].getBoundingClientRect(); - var isPositiveSizeClientRect = function (rect) { - return rect && (rect.width > 0) && (rect.height > 0); - }; - - // If the event origin element has zero size, it has probably been hidden. - return isPositiveSizeClientRect(bounds) ? self.copyRect(bounds) : null; - }, - - /** - * Calculate 'rounded' center point of Rect - * @param {DOMRect} targetRect - * @returns {{x: number, y: number}} - */ - centerPointFor: function (targetRect) { - return targetRect ? { - x: Math.round(targetRect.left + (targetRect.width / 2)), - y: Math.round(targetRect.top + (targetRect.height / 2)) - } : { x : 0, y : 0 }; - } - }; -} - - -})(); -(function(){ -"use strict"; - -if (angular.version.minor >= 4) { - angular.module('material.core.animate', []); -} else { -(function() { - "use strict"; - - var forEach = angular.forEach; - - var WEBKIT = angular.isDefined(document.documentElement.style.WebkitAppearance); - var TRANSITION_PROP = WEBKIT ? 'WebkitTransition' : 'transition'; - var ANIMATION_PROP = WEBKIT ? 'WebkitAnimation' : 'animation'; - var PREFIX = WEBKIT ? '-webkit-' : ''; - - var TRANSITION_EVENTS = (WEBKIT ? 'webkitTransitionEnd ' : '') + 'transitionend'; - var ANIMATION_EVENTS = (WEBKIT ? 'webkitAnimationEnd ' : '') + 'animationend'; - - var $$ForceReflowFactory = ['$document', function($document) { - return function() { - return $document[0].body.clientWidth + 1; - }; - }]; - - var $$rAFMutexFactory = ['$$rAF', function($$rAF) { - return function() { - var passed = false; - $$rAF(function() { - passed = true; - }); - return function(fn) { - passed ? fn() : $$rAF(fn); - }; - }; - }]; - - var $$AnimateRunnerFactory = ['$q', '$$rAFMutex', function($q, $$rAFMutex) { - var INITIAL_STATE = 0; - var DONE_PENDING_STATE = 1; - var DONE_COMPLETE_STATE = 2; - - function AnimateRunner(host) { - this.setHost(host); - - this._doneCallbacks = []; - this._runInAnimationFrame = $$rAFMutex(); - this._state = 0; - } - - AnimateRunner.prototype = { - setHost: function(host) { - this.host = host || {}; - }, - - done: function(fn) { - if (this._state === DONE_COMPLETE_STATE) { - fn(); - } else { - this._doneCallbacks.push(fn); - } - }, - - progress: angular.noop, - - getPromise: function() { - if (!this.promise) { - var self = this; - this.promise = $q(function(resolve, reject) { - self.done(function(status) { - status === false ? reject() : resolve(); - }); - }); - } - return this.promise; - }, - - then: function(resolveHandler, rejectHandler) { - return this.getPromise().then(resolveHandler, rejectHandler); - }, - - 'catch': function(handler) { - return this.getPromise()['catch'](handler); - }, - - 'finally': function(handler) { - return this.getPromise()['finally'](handler); - }, - - pause: function() { - if (this.host.pause) { - this.host.pause(); - } - }, - - resume: function() { - if (this.host.resume) { - this.host.resume(); - } - }, - - end: function() { - if (this.host.end) { - this.host.end(); - } - this._resolve(true); - }, - - cancel: function() { - if (this.host.cancel) { - this.host.cancel(); - } - this._resolve(false); - }, - - complete: function(response) { - var self = this; - if (self._state === INITIAL_STATE) { - self._state = DONE_PENDING_STATE; - self._runInAnimationFrame(function() { - self._resolve(response); - }); - } - }, - - _resolve: function(response) { - if (this._state !== DONE_COMPLETE_STATE) { - forEach(this._doneCallbacks, function(fn) { - fn(response); - }); - this._doneCallbacks.length = 0; - this._state = DONE_COMPLETE_STATE; - } - } - }; - - // Polyfill AnimateRunner.all which is used by input animations - AnimateRunner.all = function(runners, callback) { - var count = 0; - var status = true; - forEach(runners, function(runner) { - runner.done(onProgress); - }); - - function onProgress(response) { - status = status && response; - if (++count === runners.length) { - callback(status); - } - } - }; - - return AnimateRunner; - }]; - - angular - .module('material.core.animate', []) - .factory('$$forceReflow', $$ForceReflowFactory) - .factory('$$AnimateRunner', $$AnimateRunnerFactory) - .factory('$$rAFMutex', $$rAFMutexFactory) - .factory('$animateCss', ['$window', '$$rAF', '$$AnimateRunner', '$$forceReflow', '$$jqLite', '$timeout', '$animate', - function($window, $$rAF, $$AnimateRunner, $$forceReflow, $$jqLite, $timeout, $animate) { - - function init(element, options) { - - var temporaryStyles = []; - var node = getDomNode(element); - var areAnimationsAllowed = node && $animate.enabled(); - - var hasCompleteStyles = false; - var hasCompleteClasses = false; - - if (areAnimationsAllowed) { - if (options.transitionStyle) { - temporaryStyles.push([PREFIX + 'transition', options.transitionStyle]); - } - - if (options.keyframeStyle) { - temporaryStyles.push([PREFIX + 'animation', options.keyframeStyle]); - } - - if (options.delay) { - temporaryStyles.push([PREFIX + 'transition-delay', options.delay + 's']); - } - - if (options.duration) { - temporaryStyles.push([PREFIX + 'transition-duration', options.duration + 's']); - } - - hasCompleteStyles = options.keyframeStyle || - (options.to && (options.duration > 0 || options.transitionStyle)); - hasCompleteClasses = !!options.addClass || !!options.removeClass; - - blockTransition(element, true); - } - - var hasCompleteAnimation = areAnimationsAllowed && (hasCompleteStyles || hasCompleteClasses); - - applyAnimationFromStyles(element, options); - - var animationClosed = false; - var events, eventFn; - - return { - close: $window.close, - start: function() { - var runner = new $$AnimateRunner(); - waitUntilQuiet(function() { - blockTransition(element, false); - if (!hasCompleteAnimation) { - return close(); - } - - forEach(temporaryStyles, function(entry) { - var key = entry[0]; - var value = entry[1]; - node.style[camelCase(key)] = value; - }); - - applyClasses(element, options); - - var timings = computeTimings(element); - if (timings.duration === 0) { - return close(); - } - - var moreStyles = []; - - if (options.easing) { - if (timings.transitionDuration) { - moreStyles.push([PREFIX + 'transition-timing-function', options.easing]); - } - if (timings.animationDuration) { - moreStyles.push([PREFIX + 'animation-timing-function', options.easing]); - } - } - - if (options.delay && timings.animationDelay) { - moreStyles.push([PREFIX + 'animation-delay', options.delay + 's']); - } - - if (options.duration && timings.animationDuration) { - moreStyles.push([PREFIX + 'animation-duration', options.duration + 's']); - } - - forEach(moreStyles, function(entry) { - var key = entry[0]; - var value = entry[1]; - node.style[camelCase(key)] = value; - temporaryStyles.push(entry); - }); - - var maxDelay = timings.delay; - var maxDelayTime = maxDelay * 1000; - var maxDuration = timings.duration; - var maxDurationTime = maxDuration * 1000; - var startTime = Date.now(); - - events = []; - if (timings.transitionDuration) { - events.push(TRANSITION_EVENTS); - } - if (timings.animationDuration) { - events.push(ANIMATION_EVENTS); - } - events = events.join(' '); - eventFn = function(event) { - event.stopPropagation(); - var ev = event.originalEvent || event; - var timeStamp = ev.timeStamp || Date.now(); - var elapsedTime = parseFloat(ev.elapsedTime.toFixed(3)); - if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) { - close(); - } - }; - element.on(events, eventFn); - - applyAnimationToStyles(element, options); - - $timeout(close, maxDelayTime + maxDurationTime * 1.5, false); - }); - - return runner; - - function close() { - if (animationClosed) return; - animationClosed = true; - - if (events && eventFn) { - element.off(events, eventFn); - } - applyClasses(element, options); - applyAnimationStyles(element, options); - forEach(temporaryStyles, function(entry) { - node.style[camelCase(entry[0])] = ''; - }); - runner.complete(true); - return runner; - } - } - }; - } - - function applyClasses(element, options) { - if (options.addClass) { - $$jqLite.addClass(element, options.addClass); - options.addClass = null; - } - if (options.removeClass) { - $$jqLite.removeClass(element, options.removeClass); - options.removeClass = null; - } - } - - function computeTimings(element) { - var node = getDomNode(element); - var cs = $window.getComputedStyle(node); - var tdr = parseMaxTime(cs[prop('transitionDuration')]); - var adr = parseMaxTime(cs[prop('animationDuration')]); - var tdy = parseMaxTime(cs[prop('transitionDelay')]); - var ady = parseMaxTime(cs[prop('animationDelay')]); - - adr *= (parseInt(cs[prop('animationIterationCount')], 10) || 1); - var duration = Math.max(adr, tdr); - var delay = Math.max(ady, tdy); - - return { - duration: duration, - delay: delay, - animationDuration: adr, - transitionDuration: tdr, - animationDelay: ady, - transitionDelay: tdy - }; - - function prop(key) { - return WEBKIT ? 'Webkit' + key.charAt(0).toUpperCase() + key.substr(1) - : key; - } - } - - function parseMaxTime(str) { - var maxValue = 0; - var values = (str || "").split(/\s*,\s*/); - forEach(values, function(value) { - // it's always safe to consider only second values and omit `ms` values since - // getComputedStyle will always handle the conversion for us - if (value.charAt(value.length - 1) == 's') { - value = value.substring(0, value.length - 1); - } - value = parseFloat(value) || 0; - maxValue = maxValue ? Math.max(value, maxValue) : value; - }); - return maxValue; - } - - var cancelLastRAFRequest; - var rafWaitQueue = []; - function waitUntilQuiet(callback) { - if (cancelLastRAFRequest) { - cancelLastRAFRequest(); // cancels the request - } - rafWaitQueue.push(callback); - cancelLastRAFRequest = $$rAF(function() { - cancelLastRAFRequest = null; - - // DO NOT REMOVE THIS LINE OR REFACTOR OUT THE `pageWidth` variable. - // PLEASE EXAMINE THE `$$forceReflow` service to understand why. - var pageWidth = $$forceReflow(); - - // we use a for loop to ensure that if the queue is changed - // during this looping then it will consider new requests - for (var i = 0; i < rafWaitQueue.length; i++) { - rafWaitQueue[i](pageWidth); - } - rafWaitQueue.length = 0; - }); - } - - function applyAnimationStyles(element, options) { - applyAnimationFromStyles(element, options); - applyAnimationToStyles(element, options); - } - - function applyAnimationFromStyles(element, options) { - if (options.from) { - element.css(options.from); - options.from = null; - } - } - - function applyAnimationToStyles(element, options) { - if (options.to) { - element.css(options.to); - options.to = null; - } - } - - function getDomNode(element) { - for (var i = 0; i < element.length; i++) { - if (element[i].nodeType === 1) return element[i]; - } - } - - function blockTransition(element, bool) { - var node = getDomNode(element); - var key = camelCase(PREFIX + 'transition-delay'); - node.style[key] = bool ? '-9999s' : ''; - } - - return init; - }]); - - /** - * Older browsers [FF31] expect camelCase - * property keys. - * e.g. - * animation-duration --> animationDuration - */ - function camelCase(str) { - return str.replace(/-[a-z]/g, function(str) { - return str.charAt(1).toUpperCase(); - }); - } - -})(); - -} - -})(); -(function(){ -"use strict"; - -/** - * @ngdoc module - * @name material.core.aria - * @description - * Aria Expectations for AngularJS Material components. - */ -MdAriaService.$inject = ["$$rAF", "$log", "$window", "$interpolate"]; -angular - .module('material.core') - .provider('$mdAria', MdAriaProvider); - -/** - * @ngdoc service - * @name $mdAriaProvider - * @module material.core.aria - * - * @description - * - * Modify options of the `$mdAria` service, which will be used by most of the AngularJS Material - * components. - * - * You are able to disable `$mdAria` warnings, by using the following markup. - * - * - * app.config(function($mdAriaProvider) { - * // Globally disables all ARIA warnings. - * $mdAriaProvider.disableWarnings(); - * }); - * - * - */ -function MdAriaProvider() { - - var config = { - /** Whether we should show ARIA warnings in the console if labels are missing on the element */ - showWarnings: true - }; - - return { - disableWarnings: disableWarnings, - $get: ["$$rAF", "$log", "$window", "$interpolate", function($$rAF, $log, $window, $interpolate) { - return MdAriaService.apply(config, arguments); - }] - }; - - /** - * @ngdoc method - * @name $mdAriaProvider#disableWarnings - * @description Disables all ARIA warnings generated by AngularJS Material. - */ - function disableWarnings() { - config.showWarnings = false; - } -} - -/* - * @ngInject - */ -function MdAriaService($$rAF, $log, $window, $interpolate) { - - // Load the showWarnings option from the current context and store it inside of a scope variable, - // because the context will be probably lost in some function calls. - var showWarnings = this.showWarnings; - - return { - expect: expect, - expectAsync: expectAsync, - expectWithText: expectWithText, - expectWithoutText: expectWithoutText, - getText: getText, - hasAriaLabel: hasAriaLabel, - parentHasAriaLabel: parentHasAriaLabel - }; - - /** - * Check if expected attribute has been specified on the target element or child - * @param {string|JQLite} element - * @param {string} attrName - * @param {string=} defaultValue What to set the attr to if no value is found - */ - function expect(element, attrName, defaultValue) { - - var node = angular.element(element)[0] || element; - - // if node exists and neither it nor its children have the attribute - if (node && - ((!node.hasAttribute(attrName) || - node.getAttribute(attrName).length === 0) && - !childHasAttribute(node, attrName))) { - - defaultValue = angular.isString(defaultValue) ? defaultValue.trim() : ''; - if (defaultValue.length) { - element.attr(attrName, defaultValue); - } else if (showWarnings) { - $log.warn('ARIA: Attribute "', attrName, '", required for accessibility, is missing on node:', node); - } - - } - } - - function expectAsync(element, attrName, defaultValueGetter) { - // Problem: when retrieving the element's contents synchronously to find the label, - // the text may not be defined yet in the case of a binding. - // There is a higher chance that a binding will be defined if we wait one frame. - $$rAF(function() { - expect(element, attrName, defaultValueGetter()); - }); - } - - function expectWithText(element, attrName) { - var content = getText(element) || ""; - var hasBinding = content.indexOf($interpolate.startSymbol()) > -1; - - if (hasBinding) { - expectAsync(element, attrName, function() { - return getText(element); - }); - } else { - expect(element, attrName, content); - } - } - - function expectWithoutText(element, attrName) { - var content = getText(element); - var hasBinding = content.indexOf($interpolate.startSymbol()) > -1; - - if (!hasBinding && !content) { - expect(element, attrName, content); - } - } - - /** - * @param {Element|JQLite} element - * @returns {string} - */ - function getText(element) { - element = element[0] || element; - var walker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT, null, false); - var text = ''; - - var node; - while (node = walker.nextNode()) { - if (!isAriaHiddenNode(node)) { - text += node.textContent; - } - } - - return text.trim() || ''; - - /** - * @param {Node} node - * @returns {boolean} - */ - function isAriaHiddenNode(node) { - while (node.parentNode && (node = node.parentNode) !== element) { - if (node.getAttribute && node.getAttribute('aria-hidden') === 'true') { - return true; - } - } - } - } - - function childHasAttribute(node, attrName) { - var hasChildren = node.hasChildNodes(), - hasAttr = false; - - function isHidden(el) { - var style = el.currentStyle ? el.currentStyle : $window.getComputedStyle(el); - return (style.display === 'none'); - } - - if (hasChildren) { - var children = node.childNodes; - for (var i=0; i < children.length; i++) { - var child = children[i]; - if (child.nodeType === 1 && child.hasAttribute(attrName)) { - if (!isHidden(child)) { - hasAttr = true; - } - } - } - } - return hasAttr; - } - - /** - * Check if expected element has aria label attribute - * @param element - */ - function hasAriaLabel(element) { - var node = angular.element(element)[0] || element; - - /* Check if compatible node type (ie: not HTML Document node) */ - if (!node.hasAttribute) { - return false; - } - - /* Check label or description attributes */ - return node.hasAttribute('aria-label') || node.hasAttribute('aria-labelledby') || node.hasAttribute('aria-describedby'); - } - - /** - * Check if expected element's parent has aria label attribute and has valid role and tagName - * @param {string|JQLite|Node & ParentNode} element - * @param {number=} level Number of levels deep search should be performed - */ - function parentHasAriaLabel(element, level) { - level = level || 1; - var node = angular.element(element)[0] || element; - if (!node.parentNode) { - return false; - } - if (performCheck(node.parentNode)) { - return true; - } - level--; - if (level) { - return parentHasAriaLabel(node.parentNode, level); - } - return false; - - function performCheck(parentNode) { - if (!hasAriaLabel(parentNode)) { - return false; - } - /* Perform role block-list check */ - if (parentNode.hasAttribute('role')) { - switch (parentNode.getAttribute('role').toLowerCase()) { - case 'command': - case 'definition': - case 'directory': - case 'grid': - case 'list': - case 'listitem': - case 'log': - case 'marquee': - case 'menu': - case 'menubar': - case 'note': - case 'presentation': - case 'separator': - case 'scrollbar': - case 'status': - case 'tablist': - return false; - } - } - /* Perform tagName block-list check */ - switch (parentNode.tagName.toLowerCase()) { - case 'abbr': - case 'acronym': - case 'address': - case 'applet': - case 'audio': - case 'b': - case 'bdi': - case 'bdo': - case 'big': - case 'blockquote': - case 'br': - case 'canvas': - case 'caption': - case 'center': - case 'cite': - case 'code': - case 'col': - case 'data': - case 'dd': - case 'del': - case 'dfn': - case 'dir': - case 'div': - case 'dl': - case 'em': - case 'embed': - case 'fieldset': - case 'figcaption': - case 'font': - case 'h1': - case 'h2': - case 'h3': - case 'h4': - case 'h5': - case 'h6': - case 'hgroup': - case 'html': - case 'i': - case 'ins': - case 'isindex': - case 'kbd': - case 'keygen': - case 'label': - case 'legend': - case 'li': - case 'map': - case 'mark': - case 'menu': - case 'object': - case 'ol': - case 'output': - case 'pre': - case 'presentation': - case 'q': - case 'rt': - case 'ruby': - case 'samp': - case 'small': - case 'source': - case 'span': - case 'status': - case 'strike': - case 'strong': - case 'sub': - case 'sup': - case 'svg': - case 'tbody': - case 'td': - case 'th': - case 'thead': - case 'time': - case 'tr': - case 'track': - case 'tt': - case 'ul': - case 'var': - return false; - } - return true; - } - } -} - -})(); -(function(){ -"use strict"; - -/** - * @ngdoc module - * @name material.core.compiler - * @description - * AngularJS Material template and element compiler. - */ -angular - .module('material.core') - .provider('$mdCompiler', MdCompilerProvider); - -MdCompilerProvider.$inject = ['$compileProvider']; -function MdCompilerProvider() { - - this.$get = ["$q", "$templateRequest", "$injector", "$compile", "$controller", - function($q, $templateRequest, $injector, $compile, $controller) { - return new MdCompilerService($q, $templateRequest, $injector, $compile, $controller); - }]; - - /** - * @ngdoc service - * @name $mdCompiler - * @module material.core.compiler - * @description - * The $mdCompiler service is an abstraction of AngularJS's compiler, that allows developers - * to compile an element with options like in a Directive Definition Object. - * - * > The compiler powers a lot of components inside of AngularJS Material. - * > Like the `$mdPanel` or `$mdDialog` services. - * - * @usage - * - * Basic Usage with a template - * - * - * $mdCompiler.compile({ - * templateUrl: 'modal.html', - * controller: 'ModalCtrl', - * locals: { - * modal: myModalInstance; - * } - * }).then(function (compileData) { - * compileData.element; // Compiled DOM element - * compileData.link(myScope); // Instantiate controller and link element to scope. - * }); - * - * - * Example with a content element - * - * - * - * // Create a virtual element and link it manually. - * // The compiler doesn't need to recompile the element each time. - * var myElement = $compile('Test')(myScope); - * - * $mdCompiler.compile({ - * contentElement: myElement - * }).then(function (compileData) { - * compileData.element // Content Element (same as above) - * compileData.link // This does nothing when using a contentElement. - * }); - * - * - * > Content Element is a significant performance improvement when the developer already knows - * > that the compiled element will be always the same and the scope will not change either. - * - * The `contentElement` option also supports DOM elements which will be temporary removed and - * restored at its old position. - * - * - * var domElement = document.querySelector('#myElement'); - * - * $mdCompiler.compile({ - * contentElement: myElement - * }).then(function (compileData) { - * compileData.element // Content Element (same as above) - * compileData.link // This does nothing when using a contentElement. - * }); - * - * - * The `$mdCompiler` can also query for the element in the DOM itself. - * - * - * $mdCompiler.compile({ - * contentElement: '#myElement' - * }).then(function (compileData) { - * compileData.element // Content Element (same as above) - * compileData.link // This does nothing when using a contentElement. - * }); - * - * - */ - function MdCompilerService($q, $templateRequest, $injector, $compile, $controller) { - - /** - * @private @const - * @type {!IQService} - */ - this.$q = $q; - - /** - * @private @const - * @type {!ITemplateRequestService} - */ - this.$templateRequest = $templateRequest; - - /** - * @private @const - * @type {!IInjectorService} - */ - this.$injector = $injector; - - /** - * @private @const - * @type{!ICompileService} - */ - this.$compile = $compile; - - /** - * @private @const - * @type {!IControllerService} - */ - this.$controller = $controller; - } - - /** - * @ngdoc method - * @name $mdCompiler#compile - * @description - * - * A method to compile a HTML template with the AngularJS compiler. - * The `$mdCompiler` is wrapper around the AngularJS compiler and provides extra functionality - * like controller instantiation or async resolves. - * - * @param {!Object} options An options object, with the following properties: - * - * - `controller` - `{string|function}` Controller fn that should be associated with - * newly created scope or the name of a registered controller if passed as a string. - * - `controllerAs` - `{string=}` A controller alias name. If present the controller will be - * published to scope under the `controllerAs` name. - * - `contentElement` - `{string|Element}`: Instead of using a template, which will be - * compiled each time, you can also use a DOM element.
    - * - `template` - `{string=}` An html template as a string. - * - `templateUrl` - `{string=}` A path to an html template. - * - `transformTemplate` - `{function(template)=}` A function which transforms the template after - * it is loaded. It will be given the template string as a parameter, and should - * return a a new string representing the transformed template. - * - `resolve` - `{Object.=}` - An optional map of dependencies which should - * be injected into the controller. If any of these dependencies are promises, the compiler - * will wait for them all to be resolved, or if one is rejected before the controller is - * instantiated `compile()` will fail.. - * * `key` - `{string}`: a name of a dependency to be injected into the controller. - * * `factory` - `{string|function}`: If `string` then it is an alias for a service. - * Otherwise if function, then it is injected and the return value is treated as the - * dependency. If the result is a promise, it is resolved before its value is - * injected into the controller. - * - * @returns {Q.Promise<{element: JQLite, link: Function, locals: Object, cleanup: any, - * controller: Object=}>} promise A promise, which will be resolved with a `compileData` object. - * `compileData` has the following properties: - * - * - `element` - `{JQLite}`: an uncompiled element matching the provided template. - * - `link` - `{function(scope)}`: A link function, which, when called, will compile - * the element and instantiate the provided controller (if given). - * - `locals` - `{Object}`: The locals which will be passed into the controller once `link` is - * called. If `bindToController` is true, they will be copied to the ctrl instead - */ - MdCompilerService.prototype.compile = function(options) { - if (options.contentElement) { - return this._prepareContentElement(options); - } else { - return this._compileTemplate(options); - } - }; - - /** - * Instead of compiling any template, the compiler just fetches an existing HTML element from the - * DOM and provides a restore function to put the element back it old DOM position. - * @param {!Object} options Options to be used for the compiler. - * @returns {Q.Promise<{element: JQLite, link: Function, locals: Object, cleanup: any}>} - */ - MdCompilerService.prototype._prepareContentElement = function(options) { - - var contentElement = this._fetchContentElement(options); - - return this.$q.resolve({ - element: contentElement.element, - cleanup: contentElement.restore, - locals: {}, - link: function() { - return contentElement.element; - } - }); - - }; - - /** - * Compiles a template by considering all options and waiting for all resolves to be ready. - * @param {!Object} options Compile options - * @returns {!Q.Promise<{element: JQLite, link: Function, locals: Object, cleanup: any}>} Compile - * data with link function. - */ - MdCompilerService.prototype._compileTemplate = function(options) { - - var self = this; - var templateUrl = options.templateUrl; - var template = options.template || ''; - var resolve = angular.extend({}, options.resolve); - var locals = angular.extend({}, options.locals); - var transformTemplate = options.transformTemplate || angular.identity; - - // Take resolve values and invoke them. - // Resolves can either be a string (value: 'MyRegisteredAngularConst'), - // or an invokable 'factory' of sorts: (value: function ValueGetter($dependency) {}) - angular.forEach(resolve, function(value, key) { - if (angular.isString(value)) { - resolve[key] = self.$injector.get(value); - } else { - resolve[key] = self.$injector.invoke(value); - } - }); - - // Add the locals, which are just straight values to inject - // eg locals: { three: 3 }, will inject three into the controller - angular.extend(resolve, locals); - - if (templateUrl) { - resolve.$$ngTemplate = this.$templateRequest(templateUrl); - } else { - resolve.$$ngTemplate = this.$q.when(template); - } - - - // Wait for all the resolves to finish if they are promises - return this.$q.all(resolve).then(function(locals) { - - var template = transformTemplate(locals.$$ngTemplate, options); - var element = options.element || angular.element('
    ').html(template.trim()).contents(); - - return self._compileElement(locals, element, options); - }); - - }; - - /** - * Method to compile an element with the given options. - * @param {!Object} locals Locals to be injected to the controller if present - * @param {!JQLite} element Element to be compiled and linked - * @param {!Object} options Options to be used for linking. - * @returns {!{element: JQLite, link: Function, locals: Object, cleanup: any, controller: Object}} Compile data with link function. - */ - MdCompilerService.prototype._compileElement = function(locals, element, options) { - var self = this; - var ngLinkFn = this.$compile(element); - - var compileData = { - element: element, - cleanup: element.remove.bind(element), - locals: locals, - link: linkFn - }; - - function linkFn(scope) { - locals.$scope = scope; - - // Instantiate controller if the developer provided one. - if (options.controller) { - - var injectLocals = angular.extend({}, locals, { - $element: element - }); - - // Create the specified controller instance. - var ctrl = self._createController(options, injectLocals, locals); - - // Registering extra $destroy listeners should be avoided. - // Only register the listener if the controller implements a $onDestroy hook. - if (angular.isFunction(ctrl.$onDestroy)) { - scope.$on('$destroy', function() { - // Call the $onDestroy hook if it's present on the controller. - angular.isFunction(ctrl.$onDestroy) && ctrl.$onDestroy(); - }); - } - - // Unique identifier for AngularJS Route ngView controllers. - element.data('$ngControllerController', ctrl); - element.children().data('$ngControllerController', ctrl); - - // Expose the instantiated controller to the compile data - compileData.controller = ctrl; - } - - // Invoke the AngularJS $compile link function. - return ngLinkFn(scope); - } - - return compileData; - - }; - - /** - * Creates and instantiates a new controller with the specified options. - * @param {!Object} options Options that include the controller function or string. - * @param {!Object} injectLocals Locals to to be provided in the controller DI. - * @param {!Object} locals Locals to be injected to the controller. - * @returns {!Object} Created controller instance. - */ - MdCompilerService.prototype._createController = function(options, injectLocals, locals) { - var ctrl = this.$controller(options.controller, injectLocals); - - if (options.bindToController) { - angular.extend(ctrl, locals); - } - - if (options.controllerAs) { - injectLocals.$scope[options.controllerAs] = ctrl; - } - - // Call the $onInit hook if it's present on the controller. - angular.isFunction(ctrl.$onInit) && ctrl.$onInit(); - - return ctrl; - }; - - /** - * Fetches an element removing it from the DOM and using it temporary for the compiler. - * Elements which were fetched will be restored after use. - * @param {!Object} options Options to be used for the compilation. - * @returns {{element: !JQLite, restore: !function}} - */ - MdCompilerService.prototype._fetchContentElement = function(options) { - var contentEl = options.contentElement; - var restoreFn; - - if (angular.isString(contentEl)) { - contentEl = document.querySelector(contentEl); - restoreFn = createRestoreFn(contentEl); - } else { - contentEl = contentEl[0] || contentEl; - - // When the element is visible in the DOM, then we restore it at close of the dialog. - // Otherwise it will be removed from the DOM after close. - if (document.contains(contentEl)) { - restoreFn = createRestoreFn(contentEl); - } else { - restoreFn = function() { - if (contentEl.parentNode) { - contentEl.parentNode.removeChild(contentEl); - } - }; - } - } - - return { - element: angular.element(contentEl), - restore: restoreFn - }; - - function createRestoreFn(element) { - var parent = element.parentNode; - var nextSibling = element.nextElementSibling; - - return function() { - if (!nextSibling) { - // When the element didn't had any sibling, then it can be simply appended to the - // parent, because it plays no role, which index it had before. - parent.appendChild(element); - } else { - // When the element had a sibling, which marks the previous position of the element - // in the DOM, we insert it correctly before the sibling, to have the same index as - // before. - parent.insertBefore(element, nextSibling); - } - }; - } - }; -} - - -})(); -(function(){ -"use strict"; - - -MdGesture.$inject = ["$$MdGestureHandler", "$$rAF", "$timeout", "$mdUtil"]; -attachToDocument.$inject = ["$mdGesture", "$$MdGestureHandler", "$mdUtil"];var HANDLERS = {}; - -/** - * The state of the current 'pointer'. The pointer represents the state of the current touch. - * It contains normalized x and y coordinates from DOM events, - * as well as other information abstracted from the DOM. - */ -var pointer, lastPointer, maxClickDistance = 6; -var forceSkipClickHijack = false, disableAllGestures = false; - -/** - * The position of the most recent click if that click was on a label element. - * @type {{x: number, y: number}|null} - */ -var lastLabelClickPos = null; - -/** - * Used to attach event listeners once when multiple ng-apps are running. - * @type {boolean} - */ -var isInitialized = false; - -/** - * @ngdoc module - * @name material.core.gestures - * @description - * AngularJS Material Gesture handling for touch devices. - * This module replaced the usage of the HammerJS library. - */ -angular - .module('material.core.gestures', []) - .provider('$mdGesture', MdGestureProvider) - .factory('$$MdGestureHandler', MdGestureHandler) - .run(attachToDocument); - -/** - * @ngdoc service - * @name $mdGestureProvider - * @module material.core.gestures - * - * @description - * In some scenarios on mobile devices (without jQuery), the click events should NOT be hijacked. - * `$mdGestureProvider` is used to configure the Gesture module to ignore or skip click hijacking - * on mobile devices. - * - * You can also change the max click distance, `6px` by default, if you have issues on some touch - * screens. - * - * - * app.config(function($mdGestureProvider) { - * - * // For mobile devices without jQuery loaded, do not - * // intercept click events during the capture phase. - * $mdGestureProvider.skipClickHijack(); - * - * // If hijacking clicks, you may want to change the default click distance - * $mdGestureProvider.setMaxClickDistance(12); - * }); - * - * - */ -function MdGestureProvider() { } - -MdGestureProvider.prototype = { - - /** - * @ngdoc method - * @name $mdGestureProvider#disableAll - * - * @description - * Disable all gesture detection. This can be beneficial to application performance - * and memory usage. - */ - disableAll: function () { - disableAllGestures = true; - }, - - // Publish access to setter to configure a variable BEFORE the - // $mdGesture service is instantiated... - /** - * @ngdoc method - * @name $mdGestureProvider#skipClickHijack - * - * @description - * Tell the AngularJS Material Gesture module to skip (or ignore) click hijacking on mobile devices. - */ - skipClickHijack: function() { - return forceSkipClickHijack = true; - }, - - /** - * @ngdoc method - * @name $mdGestureProvider#setMaxClickDistance - * @param clickDistance {string} Distance in pixels. I.e. `12px`. - * @description - * Set the max distance from the origin of the touch event to trigger touch handlers. - */ - setMaxClickDistance: function(clickDistance) { - maxClickDistance = parseInt(clickDistance); - }, - - /** - * $get is used to build an instance of $mdGesture - * @ngInject - */ - $get : ["$$MdGestureHandler", "$$rAF", "$timeout", "$mdUtil", function($$MdGestureHandler, $$rAF, $timeout, $mdUtil) { - return new MdGesture($$MdGestureHandler, $$rAF, $timeout, $mdUtil); - }] -}; - - - -/** - * MdGesture factory construction function - * @ngInject - */ -function MdGesture($$MdGestureHandler, $$rAF, $timeout, $mdUtil) { - var touchActionProperty = $mdUtil.getTouchAction(); - var hasJQuery = (typeof __webpack_provided_window_dot_jQuery !== 'undefined') && (angular.element === __webpack_provided_window_dot_jQuery); - - var self = { - handler: addHandler, - register: register, - isAndroid: $mdUtil.isAndroid, - isIos: $mdUtil.isIos, - // On mobile w/out jQuery, we normally intercept clicks. Should we skip that? - isHijackingClicks: ($mdUtil.isIos || $mdUtil.isAndroid) && !hasJQuery && !forceSkipClickHijack - }; - - if (self.isHijackingClicks) { - self.handler('click', { - options: { - maxDistance: maxClickDistance - }, - onEnd: checkDistanceAndEmit('click') - }); - - self.handler('focus', { - options: { - maxDistance: maxClickDistance - }, - onEnd: function(ev, pointer) { - if (pointer.distance < this.state.options.maxDistance && canFocus(ev.target)) { - this.dispatchEvent(ev, 'focus', pointer); - ev.target.focus(); - } - } - }); - - self.handler('mouseup', { - options: { - maxDistance: maxClickDistance - }, - onEnd: checkDistanceAndEmit('mouseup') - }); - - self.handler('mousedown', { - onStart: function(ev) { - this.dispatchEvent(ev, 'mousedown'); - } - }); - } - - function checkDistanceAndEmit(eventName) { - return function(ev, pointer) { - if (pointer.distance < this.state.options.maxDistance) { - this.dispatchEvent(ev, eventName, pointer); - } - }; - } - - /** - * Register an element to listen for a handler. - * This allows an element to override the default options for a handler. - * Additionally, some handlers like drag and hold only dispatch events if - * the domEvent happens inside an element that's registered to listen for these events. - * - * @see GestureHandler for how overriding of default options works. - * @example $mdGesture.register(myElement, 'drag', { minDistance: 20, horizontal: false }) - */ - function register(element, handlerName, options) { - var handler = HANDLERS[handlerName.replace(/^\$md./, '')]; - if (!handler) { - throw new Error('Failed to register element with handler ' + handlerName + '. ' + - 'Available handlers: ' + Object.keys(HANDLERS).join(', ')); - } - return handler.registerElement(element, options); - } - - /* - * add a handler to $mdGesture. see below. - */ - function addHandler(name, definition) { - var handler = new $$MdGestureHandler(name); - angular.extend(handler, definition); - HANDLERS[name] = handler; - - return self; - } - - /** - * Register handlers. These listen to touch/start/move events, interpret them, - * and dispatch gesture events depending on options & conditions. These are all - * instances of GestureHandler. - * @see GestureHandler - */ - return self - /* - * The press handler dispatches an event on touchdown/touchend. - * It's a simple abstraction of touch/mouse/pointer start and end. - */ - .handler('press', { - onStart: function (ev, pointer) { - this.dispatchEvent(ev, '$md.pressdown'); - }, - onEnd: function (ev, pointer) { - this.dispatchEvent(ev, '$md.pressup'); - } - }) - - /* - * The hold handler dispatches an event if the user keeps their finger within - * the same area for ms. - * The hold handler will only run if a parent of the touch target is registered - * to listen for hold events through $mdGesture.register() - */ - .handler('hold', { - options: { - maxDistance: 6, - delay: 500 - }, - onCancel: function () { - $timeout.cancel(this.state.timeout); - }, - onStart: function (ev, pointer) { - // For hold, require a parent to be registered with $mdGesture.register() - // Because we prevent scroll events, this is necessary. - if (!this.state.registeredParent) return this.cancel(); - - this.state.pos = {x: pointer.x, y: pointer.y}; - this.state.timeout = $timeout(angular.bind(this, function holdDelayFn() { - this.dispatchEvent(ev, '$md.hold'); - this.cancel(); // we're done! - }), this.state.options.delay, false); - }, - onMove: function (ev, pointer) { - // Don't scroll while waiting for hold. - // If we don't preventDefault touchmove events here, Android will assume we don't - // want to listen to anymore touch events. It will start scrolling and stop sending - // touchmove events. - if (!touchActionProperty && ev.type === 'touchmove') ev.preventDefault(); - - // If the user moves greater than pixels, stop the hold timer - // set in onStart - var dx = this.state.pos.x - pointer.x; - var dy = this.state.pos.y - pointer.y; - if (Math.sqrt(dx * dx + dy * dy) > this.options.maxDistance) { - this.cancel(); - } - }, - onEnd: function () { - this.onCancel(); - } - }) - - /* - * The drag handler dispatches a drag event if the user holds and moves his finger greater than - * px in the x or y direction, depending on options.horizontal. - * The drag will be cancelled if the user moves his finger greater than * in - * the perpendicular direction. Eg if the drag is horizontal and the user moves his finger * - * pixels vertically, this handler won't consider the move part of a drag. - */ - .handler('drag', { - options: { - minDistance: 6, - horizontal: true, - cancelMultiplier: 1.5 - }, - /** - * @param {angular.JQLite} element where touch action styles need to be adjusted - * @param {{horizontal: boolean}=} options object whose horizontal property can specify to - * apply 'pan-y' or 'pan-x' touch actions. - */ - onSetup: function(element, options) { - if (touchActionProperty) { - // We check for horizontal to be false, because otherwise we would overwrite the default opts. - this.oldTouchAction = element[0].style[touchActionProperty]; - element[0].style[touchActionProperty] = options.horizontal ? 'pan-y' : 'pan-x'; - } - }, - /** - * @param {angular.JQLite} element where styles need to be cleaned up - */ - onCleanup: function(element) { - if (this.oldTouchAction) { - element[0].style[touchActionProperty] = this.oldTouchAction; - } else { - element[0].style[touchActionProperty] = null; - } - }, - onStart: function (ev) { - // For drag, require a parent to be registered with $mdGesture.register() - if (!this.state.registeredParent) this.cancel(); - }, - onMove: function (ev, pointer) { - var shouldStartDrag, shouldCancel; - // Don't scroll while deciding if this touchmove qualifies as a drag event. - // If we don't preventDefault touchmove events here, Android will assume we don't - // want to listen to anymore touch events. It will start scrolling and stop sending - // touchmove events. - if (!touchActionProperty && ev.type === 'touchmove') ev.preventDefault(); - - if (!this.state.dragPointer) { - if (this.state.options.horizontal) { - shouldStartDrag = Math.abs(pointer.distanceX) > this.state.options.minDistance; - shouldCancel = Math.abs(pointer.distanceY) > this.state.options.minDistance * this.state.options.cancelMultiplier; - } else { - shouldStartDrag = Math.abs(pointer.distanceY) > this.state.options.minDistance; - shouldCancel = Math.abs(pointer.distanceX) > this.state.options.minDistance * this.state.options.cancelMultiplier; - } - - if (shouldStartDrag) { - // Create a new pointer representing this drag, starting at this point where the drag started. - this.state.dragPointer = makeStartPointer(ev); - updatePointerState(ev, this.state.dragPointer); - this.dispatchEvent(ev, '$md.dragstart', this.state.dragPointer); - - } else if (shouldCancel) { - this.cancel(); - } - } else { - this.dispatchDragMove(ev); - } - }, - // Only dispatch dragmove events every frame; any more is unnecessary - dispatchDragMove: $$rAF.throttle(function (ev) { - // Make sure the drag didn't stop while waiting for the next frame - if (this.state.isRunning) { - updatePointerState(ev, this.state.dragPointer); - this.dispatchEvent(ev, '$md.drag', this.state.dragPointer); - } - }), - onEnd: function (ev, pointer) { - if (this.state.dragPointer) { - updatePointerState(ev, this.state.dragPointer); - this.dispatchEvent(ev, '$md.dragend', this.state.dragPointer); - } - } - }) - - /* - * The swipe handler will dispatch a swipe event if, on the end of a touch, - * the velocity and distance were high enough. - */ - .handler('swipe', { - options: { - minVelocity: 0.65, - minDistance: 10 - }, - onEnd: function (ev, pointer) { - var eventType; - - if (Math.abs(pointer.velocityX) > this.state.options.minVelocity && - Math.abs(pointer.distanceX) > this.state.options.minDistance) { - eventType = pointer.directionX == 'left' ? '$md.swipeleft' : '$md.swiperight'; - this.dispatchEvent(ev, eventType); - } - else if (Math.abs(pointer.velocityY) > this.state.options.minVelocity && - Math.abs(pointer.distanceY) > this.state.options.minDistance) { - eventType = pointer.directionY == 'up' ? '$md.swipeup' : '$md.swipedown'; - this.dispatchEvent(ev, eventType); - } - } - }); -} - -/** - * MdGestureHandler - * A GestureHandler is an object which is able to dispatch custom dom events - * based on native dom {touch,pointer,mouse}{start,move,end} events. - * - * A gesture will manage its lifecycle through the start,move,end, and cancel - * functions, which are called by native dom events. - * - * A gesture has the concept of 'options' (eg. a swipe's required velocity), which can be - * overridden by elements registering through $mdGesture.register(). - */ -function GestureHandler (name) { - this.name = name; - this.state = {}; -} - -function MdGestureHandler() { - var hasJQuery = (typeof __webpack_provided_window_dot_jQuery !== 'undefined') && (angular.element === __webpack_provided_window_dot_jQuery); - - GestureHandler.prototype = { - options: {}, - // jQuery listeners don't work with custom DOMEvents, so we have to dispatch events - // differently when jQuery is loaded - dispatchEvent: hasJQuery ? jQueryDispatchEvent : nativeDispatchEvent, - - // These are overridden by the registered handler - onSetup: angular.noop, - onCleanup: angular.noop, - onStart: angular.noop, - onMove: angular.noop, - onEnd: angular.noop, - onCancel: angular.noop, - - // onStart sets up a new state for the handler, which includes options from the - // nearest registered parent element of ev.target. - start: function (ev, pointer) { - if (this.state.isRunning) return; - var parentTarget = this.getNearestParent(ev.target); - // Get the options from the nearest registered parent - var parentTargetOptions = parentTarget && parentTarget.$mdGesture[this.name] || {}; - - this.state = { - isRunning: true, - // Override the default options with the nearest registered parent's options - options: angular.extend({}, this.options, parentTargetOptions), - // Pass in the registered parent node to the state so the onStart listener can use - registeredParent: parentTarget - }; - this.onStart(ev, pointer); - }, - move: function (ev, pointer) { - if (!this.state.isRunning) return; - this.onMove(ev, pointer); - }, - end: function (ev, pointer) { - if (!this.state.isRunning) return; - this.state.isRunning = false; - this.onEnd(ev, pointer); - }, - cancel: function (ev, pointer) { - this.onCancel(ev, pointer); - this.state = {}; - }, - - // Find and return the nearest parent element that has been registered to - // listen for this handler via $mdGesture.register(element, 'handlerName'). - getNearestParent: function (node) { - var current = node; - while (current) { - if ((current.$mdGesture || {})[this.name]) { - return current; - } - current = current.parentNode; - } - return null; - }, - - // Called from $mdGesture.register when an element registers itself with a handler. - // Store the options the user gave on the DOMElement itself. These options will - // be retrieved with getNearestParent when the handler starts. - registerElement: function (element, options) { - var self = this; - element[0].$mdGesture = element[0].$mdGesture || {}; - element[0].$mdGesture[this.name] = options || {}; - element.on('$destroy', onDestroy); - - self.onSetup(element, options || {}); - - return onDestroy; - - function onDestroy() { - delete element[0].$mdGesture[self.name]; - element.off('$destroy', onDestroy); - - self.onCleanup(element, options || {}); - } - } - }; - - return GestureHandler; - - /** - * Dispatch an event with jQuery - * TODO: Make sure this sends bubbling events - * - * @param srcEvent the original DOM touch event that started this. - * @param eventType the name of the custom event to send (eg 'click' or '$md.drag') - * @param eventPointer the pointer object that matches this event. - */ - function jQueryDispatchEvent(srcEvent, eventType, eventPointer) { - eventPointer = eventPointer || pointer; - var eventObj = new angular.element.Event(eventType); - - eventObj.$material = true; - eventObj.pointer = eventPointer; - eventObj.srcEvent = srcEvent; - - angular.extend(eventObj, { - clientX: eventPointer.x, - clientY: eventPointer.y, - screenX: eventPointer.x, - screenY: eventPointer.y, - pageX: eventPointer.x, - pageY: eventPointer.y, - ctrlKey: srcEvent.ctrlKey, - altKey: srcEvent.altKey, - shiftKey: srcEvent.shiftKey, - metaKey: srcEvent.metaKey - }); - angular.element(eventPointer.target).trigger(eventObj); - } - - /** - * NOTE: nativeDispatchEvent is very performance sensitive. - * @param srcEvent the original DOM touch event that started this. - * @param eventType the name of the custom event to send (eg 'click' or '$md.drag') - * @param eventPointer the pointer object that matches this event. - */ - function nativeDispatchEvent(srcEvent, eventType, eventPointer) { - eventPointer = eventPointer || pointer; - var eventObj; - - if (eventType === 'click' || eventType === 'mouseup' || eventType === 'mousedown') { - if (typeof window.MouseEvent === "function") { - eventObj = new MouseEvent(eventType, { - bubbles: true, - cancelable: true, - screenX: Number(srcEvent.screenX), - screenY: Number(srcEvent.screenY), - clientX: Number(eventPointer.x), - clientY: Number(eventPointer.y), - ctrlKey: srcEvent.ctrlKey, - altKey: srcEvent.altKey, - shiftKey: srcEvent.shiftKey, - metaKey: srcEvent.metaKey, - button: srcEvent.button, - buttons: srcEvent.buttons, - relatedTarget: srcEvent.relatedTarget || null - }); - } else { - eventObj = document.createEvent('MouseEvents'); - // This has been deprecated - // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent - eventObj.initMouseEvent( - eventType, true, true, window, srcEvent.detail, - eventPointer.x, eventPointer.y, eventPointer.x, eventPointer.y, - srcEvent.ctrlKey, srcEvent.altKey, srcEvent.shiftKey, srcEvent.metaKey, - srcEvent.button, srcEvent.relatedTarget || null - ); - } - } else { - if (typeof window.CustomEvent === "function") { - eventObj = new CustomEvent(eventType, { - bubbles: true, - cancelable: true, - detail: {} - }); - } else { - // This has been deprecated - // https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/initCustomEvent - eventObj = document.createEvent('CustomEvent'); - eventObj.initCustomEvent(eventType, true, true, {}); - } - } - eventObj.$material = true; - eventObj.pointer = eventPointer; - eventObj.srcEvent = srcEvent; - eventPointer.target.dispatchEvent(eventObj); - } -} - -/** - * Attach Gestures: hook document and check shouldHijack clicks - * @ngInject - */ -function attachToDocument($mdGesture, $$MdGestureHandler, $mdUtil) { - if (disableAllGestures) { - return; - } - - if (!isInitialized && $mdGesture.isHijackingClicks) { - /* - * If hijack clicks is true, we preventDefault any click that wasn't - * sent by AngularJS Material. This is because on older Android & iOS, a false, or 'ghost', - * click event will be sent ~400ms after a touchend event happens. - * The only way to know if this click is real is to prevent any normal - * click events, and add a flag to events sent by material so we know not to prevent those. - * - * Two exceptions to click events that should be prevented are: - * - click events sent by the keyboard (eg form submit) - * - events that originate from an Ionic app - */ - document.addEventListener('click' , clickHijacker , true); - document.addEventListener('mouseup' , mouseInputHijacker, true); - document.addEventListener('mousedown', mouseInputHijacker, true); - document.addEventListener('focus' , mouseInputHijacker, true); - - isInitialized = true; - } - - function mouseInputHijacker(ev) { - var isKeyClick = !ev.clientX && !ev.clientY; - - if ( - !isKeyClick && - !ev.$material && - !ev.isIonicTap && - !isInputEventFromLabelClick(ev) && - (ev.type !== 'mousedown' || (!canFocus(ev.target) && !canFocus(document.activeElement))) - ) { - ev.preventDefault(); - ev.stopPropagation(); - } - } - - /** - * Ignore click events that don't come from AngularJS Material, Ionic, Input Label clicks, - * or key presses that generate click events. This helps to ignore the ghost tap events on - * older mobile browsers that get sent after a 300-400ms delay. - * @param ev MouseEvent or modified MouseEvent with $material, pointer, and other fields - */ - function clickHijacker(ev) { - var isKeyClick; - if ($mdUtil.isIos) { - isKeyClick = angular.isDefined(ev.webkitForce) && ev.webkitForce === 0; - } else { - isKeyClick = ev.clientX === 0 && ev.clientY === 0; - } - if (!isKeyClick && !ev.$material && !ev.isIonicTap && !isInputEventFromLabelClick(ev)) { - ev.preventDefault(); - ev.stopPropagation(); - lastLabelClickPos = null; - } else { - lastLabelClickPos = null; - if (ev.target.tagName.toLowerCase() === 'label') { - lastLabelClickPos = {x: ev.x, y: ev.y}; - } - } - } - - - // Listen to all events to cover all platforms. - var START_EVENTS = 'mousedown touchstart pointerdown'; - var MOVE_EVENTS = 'mousemove touchmove pointermove'; - var END_EVENTS = 'mouseup mouseleave touchend touchcancel pointerup pointercancel'; - - angular.element(document) - .on(START_EVENTS, gestureStart) - .on(MOVE_EVENTS, gestureMove) - .on(END_EVENTS, gestureEnd) - // For testing - .on('$$mdGestureReset', function gestureClearCache () { - lastPointer = pointer = null; - }); - - /** - * When a DOM event happens, run all registered gesture handlers' lifecycle - * methods which match the DOM event. - * Eg. when a 'touchstart' event happens, runHandlers('start') will call and - * run `handler.cancel()` and `handler.start()` on all registered handlers. - */ - function runHandlers(handlerEvent, event) { - var handler; - for (var name in HANDLERS) { - handler = HANDLERS[name]; - if (handler instanceof $$MdGestureHandler) { - - if (handlerEvent === 'start') { - // Run cancel to reset any handlers' state - handler.cancel(); - } - handler[handlerEvent](event, pointer); - } - } - } - - /* - * gestureStart vets if a start event is legitimate (and not part of a 'ghost click' from iOS/Android) - * If it is legitimate, we initiate the pointer state and mark the current pointer's type - * For example, for a touchstart event, mark the current pointer as a 'touch' pointer, so mouse events - * won't effect it. - */ - function gestureStart(ev) { - // If we're already touched down, abort - if (pointer) return; - - var now = +Date.now(); - - // iOS & old android bug: after a touch event, a click event is sent 350 ms later. - // If <400ms have passed, don't allow an event of a different type than the previous event - if (lastPointer && !typesMatch(ev, lastPointer) && (now - lastPointer.endTime < 1500)) { - return; - } - - pointer = makeStartPointer(ev); - - runHandlers('start', ev); - } - - /** - * If a move event happens of the right type, update the pointer and run all the move handlers. - * "of the right type": if a mousemove happens but our pointer started with a touch event, do - * nothing. - */ - function gestureMove(ev) { - if (!pointer || !typesMatch(ev, pointer)) return; - - updatePointerState(ev, pointer); - runHandlers('move', ev); - } - - /** - * If an end event happens of the right type, update the pointer, run endHandlers, and save the - * pointer as 'lastPointer'. - */ - function gestureEnd(ev) { - if (!pointer || !typesMatch(ev, pointer)) return; - - updatePointerState(ev, pointer); - pointer.endTime = +Date.now(); - - if (ev.type !== 'pointercancel') { - runHandlers('end', ev); - } - - lastPointer = pointer; - pointer = null; - } - -} - -// ******************** -// Module Functions -// ******************** - -/* - * Initiate the pointer. x, y, and the pointer's type. - */ -function makeStartPointer(ev) { - var point = getEventPoint(ev); - var startPointer = { - startTime: +Date.now(), - target: ev.target, - // 'p' for pointer events, 'm' for mouse, 't' for touch - type: ev.type.charAt(0) - }; - startPointer.startX = startPointer.x = point.pageX; - startPointer.startY = startPointer.y = point.pageY; - return startPointer; -} - -/* - * return whether the pointer's type matches the event's type. - * Eg if a touch event happens but the pointer has a mouse type, return false. - */ -function typesMatch(ev, pointer) { - return ev && pointer && ev.type.charAt(0) === pointer.type; -} - -/** - * Gets whether the given event is an input event that was caused by clicking on an - * associated label element. - * - * This is necessary because the browser will, upon clicking on a label element, fire an - * *extra* click event on its associated input (if any). mdGesture is able to flag the label - * click as with `$material` correctly, but not the second input click. - * - * In order to determine whether an input event is from a label click, we compare the (x, y) for - * the event to the (x, y) for the most recent label click (which is cleared whenever a non-label - * click occurs). Unfortunately, there are no event properties that tie the input and the label - * together (such as relatedTarget). - * - * @param {MouseEvent} event - * @returns {boolean} - */ -function isInputEventFromLabelClick(event) { - return lastLabelClickPos - && lastLabelClickPos.x === event.x - && lastLabelClickPos.y === event.y; -} - -/* - * Update the given pointer based upon the given DOMEvent. - * Distance, velocity, direction, duration, etc - */ -function updatePointerState(ev, pointer) { - var point = getEventPoint(ev); - var x = pointer.x = point.pageX; - var y = pointer.y = point.pageY; - - pointer.distanceX = x - pointer.startX; - pointer.distanceY = y - pointer.startY; - pointer.distance = Math.sqrt( - pointer.distanceX * pointer.distanceX + pointer.distanceY * pointer.distanceY - ); - - pointer.directionX = pointer.distanceX > 0 ? 'right' : pointer.distanceX < 0 ? 'left' : ''; - pointer.directionY = pointer.distanceY > 0 ? 'down' : pointer.distanceY < 0 ? 'up' : ''; - - pointer.duration = +Date.now() - pointer.startTime; - pointer.velocityX = pointer.distanceX / pointer.duration; - pointer.velocityY = pointer.distanceY / pointer.duration; -} - -/** - * Normalize the point where the DOM event happened whether it's touch or mouse. - * @returns point event obj with pageX and pageY on it. - */ -function getEventPoint(ev) { - ev = ev.originalEvent || ev; // support jQuery events - return (ev.touches && ev.touches[0]) || - (ev.changedTouches && ev.changedTouches[0]) || - ev; -} - -/** Checks whether an element can be focused. */ -function canFocus(element) { - return ( - !!element && - element.getAttribute('tabindex') !== '-1' && - !element.hasAttribute('disabled') && - ( - element.hasAttribute('tabindex') || - element.hasAttribute('href') || - element.isContentEditable || - ['INPUT', 'SELECT', 'BUTTON', 'TEXTAREA', 'VIDEO', 'AUDIO'].indexOf(element.nodeName) !== -1 - ) - ); -} - -})(); -(function(){ -"use strict"; - -/** - * @ngdoc module - * @name material.core.interaction - * @description - * User interaction detection to provide proper accessibility. - */ -MdInteractionService.$inject = ["$timeout", "$mdUtil", "$rootScope"]; -angular - .module('material.core.interaction', []) - .service('$mdInteraction', MdInteractionService); - - -/** - * @ngdoc service - * @name $mdInteraction - * @module material.core.interaction - * - * @description - * - * Service which keeps track of the last interaction type and validates them for several browsers. - * The service hooks into the document's body and listens for touch, mouse and keyboard events. - * - * The most recent interaction type can be retrieved by calling the `getLastInteractionType` method. - * - * Here is an example markup for using the interaction service. - * - * - * var lastType = $mdInteraction.getLastInteractionType(); - * - * if (lastType === 'keyboard') { - * // We only restore the focus for keyboard users. - * restoreFocus(); - * } - * - * - */ -function MdInteractionService($timeout, $mdUtil, $rootScope) { - this.$timeout = $timeout; - this.$mdUtil = $mdUtil; - this.$rootScope = $rootScope; - - // IE browsers can also trigger pointer events, which also leads to an interaction. - this.pointerEvent = 'MSPointerEvent' in window ? 'MSPointerDown' : 'PointerEvent' in window ? 'pointerdown' : null; - this.bodyElement = angular.element(document.body); - this.isBuffering = false; - this.bufferTimeout = null; - this.lastInteractionType = null; - this.lastInteractionTime = null; - this.inputHandler = this.onInputEvent.bind(this); - this.bufferedInputHandler = this.onBufferInputEvent.bind(this); - - // Type Mappings for the different events - // There will be three three interaction types - // `keyboard`, `mouse` and `touch` - // type `pointer` will be evaluated in `pointerMap` for IE Browser events - this.inputEventMap = { - 'keydown': 'keyboard', - 'mousedown': 'mouse', - 'mouseenter': 'mouse', - 'touchstart': 'touch', - 'pointerdown': 'pointer', - 'MSPointerDown': 'pointer' - }; - - // IE PointerDown events will be validated in `touch` or `mouse` - // Index numbers referenced here: https://msdn.microsoft.com/library/windows/apps/hh466130.aspx - this.iePointerMap = { - 2: 'touch', - 3: 'touch', - 4: 'mouse' - }; - - this.initializeEvents(); - this.$rootScope.$on('$destroy', this.deregister.bind(this)); -} - -/** - * Removes all event listeners created by $mdInteration on the - * body element. - */ -MdInteractionService.prototype.deregister = function() { - - this.bodyElement.off('keydown mousedown', this.inputHandler); - - if ('ontouchstart' in document.documentElement) { - this.bodyElement.off('touchstart', this.bufferedInputHandler); - } - - if (this.pointerEvent) { - this.bodyElement.off(this.pointerEvent, this.inputHandler); - } - -}; - -/** - * Initializes the interaction service, by registering all interaction events to the - * body element. - */ -MdInteractionService.prototype.initializeEvents = function() { - - this.bodyElement.on('keydown mousedown', this.inputHandler); - - if ('ontouchstart' in document.documentElement) { - this.bodyElement.on('touchstart', this.bufferedInputHandler); - } - - if (this.pointerEvent) { - this.bodyElement.on(this.pointerEvent, this.inputHandler); - } - -}; - -/** - * Event listener for normal interaction events, which should be tracked. - * @param event {MouseEvent|KeyboardEvent|PointerEvent|TouchEvent} - */ -MdInteractionService.prototype.onInputEvent = function(event) { - if (this.isBuffering) { - return; - } - - var type = this.inputEventMap[event.type]; - - if (type === 'pointer') { - type = this.iePointerMap[event.pointerType] || event.pointerType; - } - - this.lastInteractionType = type; - this.lastInteractionTime = this.$mdUtil.now(); -}; - -/** - * Event listener for interaction events which should be buffered (touch events). - * @param event {TouchEvent} - */ -MdInteractionService.prototype.onBufferInputEvent = function(event) { - this.$timeout.cancel(this.bufferTimeout); - - this.onInputEvent(event); - this.isBuffering = true; - - // The timeout of 650ms is needed to delay the touchstart, because otherwise the touch will call - // the `onInput` function multiple times. - this.bufferTimeout = this.$timeout(function() { - this.isBuffering = false; - }.bind(this), 650, false); - -}; - -/** - * @ngdoc method - * @name $mdInteraction#getLastInteractionType - * @description Retrieves the last interaction type triggered in body. - * @returns {string|null} Last interaction type. - */ -MdInteractionService.prototype.getLastInteractionType = function() { - return this.lastInteractionType; -}; - -/** - * @ngdoc method - * @name $mdInteraction#isUserInvoked - * @description Method to detect whether any interaction happened recently or not. - * @param {number=} checkDelay Time to check for any interaction to have been triggered. - * @returns {boolean} Whether there was any interaction or not. - */ -MdInteractionService.prototype.isUserInvoked = function(checkDelay) { - var delay = angular.isNumber(checkDelay) ? checkDelay : 15; - - // Check for any interaction to be within the specified check time. - return this.lastInteractionTime >= this.$mdUtil.now() - delay; -}; - -})(); -(function(){ -"use strict"; - -angular.module('material.core') - .provider('$$interimElement', InterimElementProvider); - -/** - * @ngdoc service - * @name $$interimElementProvider - * @module material.core.interimElement - * - * @description - * - * Factory that constructs `$$interimElement.$service` services. - * Used internally in material design for elements that appear on screen temporarily. - * The service provides a promise-like API for interacting with the temporary - * elements. - * - * - * app.service('$mdToast', function($$interimElement) { - * var $mdToast = $$interimElement(toastDefaultOptions); - * return $mdToast; - * }); - * - * - * @param {object=} defaultOptions Options used by default for the `show` method on the service. - * - * @returns {$$interimElement.$service} - */ - -function InterimElementProvider() { - InterimElementFactory.$inject = ["$document", "$q", "$rootScope", "$timeout", "$rootElement", "$animate", "$mdUtil", "$mdCompiler", "$mdTheming", "$injector", "$exceptionHandler"]; - createInterimElementProvider.$get = InterimElementFactory; - return createInterimElementProvider; - - /** - * Returns a new provider which allows configuration of a new interimElement - * service. Allows configuration of default options & methods for options, - * as well as configuration of 'preset' methods (eg dialog.basic(): basic is a preset method) - */ - function createInterimElementProvider(interimFactoryName) { - factory.$inject = ["$$interimElement", "$injector"]; - var EXPOSED_METHODS = ['onHide', 'onShow', 'onRemove']; - - var customMethods = {}; - var providerConfig = { - presets: {} - }; - - var provider = { - setDefaults: setDefaults, - addPreset: addPreset, - addMethod: addMethod, - $get: factory - }; - - /** - * all interim elements will come with the 'build' preset - */ - provider.addPreset('build', { - methods: ['controller', 'controllerAs', 'resolve', 'multiple', - 'template', 'templateUrl', 'themable', 'transformTemplate', 'parent', 'contentElement'] - }); - - return provider; - - /** - * Save the configured defaults to be used when the factory is instantiated - */ - function setDefaults(definition) { - providerConfig.optionsFactory = definition.options; - providerConfig.methods = (definition.methods || []).concat(EXPOSED_METHODS); - return provider; - } - - /** - * Add a method to the factory that isn't specific to any interim element operations - */ - function addMethod(name, fn) { - customMethods[name] = fn; - return provider; - } - - /** - * Save the configured preset to be used when the factory is instantiated - */ - function addPreset(name, definition) { - definition = definition || {}; - definition.methods = definition.methods || []; - definition.options = definition.options || function() { return {}; }; - - if (/^cancel|hide|show$/.test(name)) { - throw new Error("Preset '" + name + "' in " + interimFactoryName + " is reserved!"); - } - if (definition.methods.indexOf('_options') > -1) { - throw new Error("Method '_options' in " + interimFactoryName + " is reserved!"); - } - providerConfig.presets[name] = { - methods: definition.methods.concat(EXPOSED_METHODS), - optionsFactory: definition.options, - argOption: definition.argOption - }; - return provider; - } - - function addPresetMethod(presetName, methodName, method) { - providerConfig.presets[presetName][methodName] = method; - } - - /** - * Create a factory that has the given methods & defaults implementing interimElement - */ - /* @ngInject */ - function factory($$interimElement, $injector) { - var defaultMethods; - var defaultOptions; - var interimElementService = $$interimElement(); - - /* - * publicService is what the developer will be using. - * It has methods hide(), cancel(), show(), build(), and any other - * presets which were set during the config phase. - */ - var publicService = { - hide: interimElementService.hide, - cancel: interimElementService.cancel, - show: showInterimElement, - - // Special internal method to destroy an interim element without animations - // used when navigation changes causes a $scope.$destroy() action - destroy : destroyInterimElement - }; - - - defaultMethods = providerConfig.methods || []; - // This must be invoked after the publicService is initialized - defaultOptions = invokeFactory(providerConfig.optionsFactory, {}); - - // Copy over the simple custom methods - angular.forEach(customMethods, function(fn, name) { - publicService[name] = fn; - }); - - angular.forEach(providerConfig.presets, function(definition, name) { - var presetDefaults = invokeFactory(definition.optionsFactory, {}); - var presetMethods = (definition.methods || []).concat(defaultMethods); - - // Every interimElement built with a preset has a field called `$type`, - // which matches the name of the preset. - // Eg in preset 'confirm', options.$type === 'confirm' - angular.extend(presetDefaults, { $type: name }); - - // This creates a preset class which has setter methods for every - // method given in the `.addPreset()` function, as well as every - // method given in the `.setDefaults()` function. - // - // @example - // .setDefaults({ - // methods: ['hasBackdrop', 'clickOutsideToClose', 'escapeToClose', 'targetEvent'], - // options: dialogDefaultOptions - // }) - // .addPreset('alert', { - // methods: ['title', 'ok'], - // options: alertDialogOptions - // }) - // - // Set values will be passed to the options when interimElement.show() is called. - function Preset(opts) { - this._options = angular.extend({}, presetDefaults, opts); - } - angular.forEach(presetMethods, function(name) { - Preset.prototype[name] = function(value) { - this._options[name] = value; - return this; - }; - }); - - // Create shortcut method for one-linear methods - if (definition.argOption) { - var methodName = 'show' + name.charAt(0).toUpperCase() + name.slice(1); - publicService[methodName] = function(arg) { - var config = publicService[name](arg); - return publicService.show(config); - }; - } - - // eg $mdDialog.alert() will return a new alert preset - publicService[name] = function(arg) { - // If argOption is supplied, eg `argOption: 'content'`, then we assume - // if the argument is not an options object then it is the `argOption` option. - // - // @example `$mdToast.simple('hello')` // sets options.content to hello - // // because argOption === 'content' - if (arguments.length && definition.argOption && - !angular.isObject(arg) && !angular.isArray(arg)) { - - return (new Preset())[definition.argOption](arg); - - } else { - return new Preset(arg); - } - - }; - }); - - return publicService; - - /** - * - */ - function showInterimElement(opts) { - // opts is either a preset which stores its options on an _options field, - // or just an object made up of options - opts = opts || { }; - if (opts._options) opts = opts._options; - - return interimElementService.show( - angular.extend({}, defaultOptions, opts) - ); - } - - /** - * Special method to hide and destroy an interimElement WITHOUT - * any 'leave` or hide animations ( an immediate force hide/remove ) - * - * NOTE: This calls the onRemove() subclass method for each component... - * which must have code to respond to `options.$destroy == true` - */ - function destroyInterimElement(opts) { - return interimElementService.destroy(opts); - } - - /** - * Helper to call $injector.invoke with a local of the factory name for - * this provider. - * If an $mdDialog is providing options for a dialog and tries to inject - * $mdDialog, a circular dependency error will happen. - * We get around that by manually injecting $mdDialog as a local. - */ - function invokeFactory(factory, defaultVal) { - var locals = {}; - locals[interimFactoryName] = publicService; - return $injector.invoke(factory || function() { return defaultVal; }, {}, locals); - } - } - } - - /* @ngInject */ - function InterimElementFactory($document, $q, $rootScope, $timeout, $rootElement, $animate, - $mdUtil, $mdCompiler, $mdTheming, $injector, $exceptionHandler) { - return function createInterimElementService() { - var SHOW_CANCELLED = false; - - /** - * @ngdoc service - * @name $$interimElementProvider.$service - * - * @description - * A service used to control inserting and removing of an element from the DOM. - * It is used by $mdBottomSheet, $mdDialog, $mdToast, $mdMenu, $mdPanel, and $mdSelect. - */ - var service; - - var showPromises = []; // Promises for the interim's which are currently opening. - var hidePromises = []; // Promises for the interim's which are currently hiding. - var showingInterims = []; // Interim elements which are currently showing up. - - // Publish instance $$interimElement service; - return service = { - show: show, - hide: waitForInterim(hide), - cancel: waitForInterim(cancel), - destroy : destroy, - $injector_: $injector - }; - - /** - * @ngdoc method - * @name $$interimElementProvider.$service#show - * @kind function - * - * @description - * Adds the `$interimElement` to the DOM and returns a special promise that will be resolved - * or rejected with hide or cancel, respectively. - * - * @param {Object} options map of options and values - * @returns {Promise} a Promise that will be resolved when hide() is called or rejected when - * cancel() is called. - */ - function show(options) { - options = options || {}; - var interimElement = new InterimElement(options || {}); - - // When an interim element is currently showing, we have to cancel it. - // Just hiding it, will resolve the InterimElement's promise, the promise should be - // rejected instead. - var hideAction = options.multiple ? $q.resolve() : $q.all(showPromises); - - if (!options.multiple) { - // Wait for all opening interim's to finish their transition. - hideAction = hideAction.then(function() { - // Wait for all closing and showing interim's to be completely closed. - var promiseArray = hidePromises.concat(showingInterims.map(service.cancel)); - return $q.all(promiseArray); - }); - } - - var showAction = hideAction.then(function() { - - return interimElement - .show() - .then(function () { - showingInterims.push(interimElement); - }) - .catch(function (reason) { - return reason; - }) - .finally(function() { - showPromises.splice(showPromises.indexOf(showAction), 1); - }); - - }); - - showPromises.push(showAction); - - // In AngularJS 1.6+, exceptions inside promises will cause a rejection. We need to handle - // the rejection and only log it if it's an error. - interimElement.deferred.promise.catch(function(fault) { - if (fault instanceof Error) { - $exceptionHandler(fault); - } - - return fault; - }); - - // Return a promise that will be resolved when the interim - // element is hidden or cancelled... - return interimElement.deferred.promise; - } - - /** - * @ngdoc method - * @name $$interimElementProvider.$service#hide - * @kind function - * - * @description - * Removes the `$interimElement` from the DOM and resolves the Promise returned from `show()`. - * - * @param {*} reason Data used to resolve the Promise - * @param {object} options map of options and values - * @returns {Promise} a Promise that will be resolved after the element has been removed - * from the DOM. - */ - function hide(reason, options) { - options = options || {}; - - if (options.closeAll) { - // We have to make a shallow copy of the array, because otherwise the map will break. - return $q.all(showingInterims.slice().reverse().map(closeElement)); - } else if (options.closeTo !== undefined) { - return $q.all(showingInterims.slice(options.closeTo).map(closeElement)); - } - - // Hide the latest showing interim element. - return closeElement(showingInterims[showingInterims.length - 1]); - - /** - * @param {InterimElement} interim element to close - * @returns {Promise} - */ - function closeElement(interim) { - if (!interim) { - return $q.when(reason); - } - - var hideAction = interim - .remove(reason, false, options || { }) - .catch(function(reason) { return reason; }) - .finally(function() { - hidePromises.splice(hidePromises.indexOf(hideAction), 1); - }); - - showingInterims.splice(showingInterims.indexOf(interim), 1); - hidePromises.push(hideAction); - - return interim.deferred.promise; - } - } - - /** - * @ngdoc method - * @name $$interimElementProvider.$service#cancel - * @kind function - * - * @description - * Removes the `$interimElement` from the DOM and rejects the Promise returned from `show()`. - * - * @param {*} reason Data used to resolve the Promise - * @param {object} options map of options and values - * @returns {Promise} Promise that will be resolved after the element has been removed - * from the DOM. - */ - function cancel(reason, options) { - var interim = showingInterims.pop(); - if (!interim) { - return $q.when(reason); - } - - var cancelAction = interim - .remove(reason, true, options || {}) - .catch(function(reason) { return reason; }) - .finally(function() { - hidePromises.splice(hidePromises.indexOf(cancelAction), 1); - }); - - hidePromises.push(cancelAction); - - // Since AngularJS 1.6.7, promises will be logged to $exceptionHandler when the promise - // is not handling the rejection. We create a pseudo catch handler, which will prevent the - // promise from being logged to the $exceptionHandler. - return interim.deferred.promise.catch(angular.noop); - } - - /** - * Creates a function to wait for at least one interim element to be available. - * @param callbackFn Function to be used as callback - * @returns {Function} - */ - function waitForInterim(callbackFn) { - return function() { - var fnArguments = arguments; - - if (!showingInterims.length) { - // When there are still interim's opening, then wait for the first interim element to - // finish its open animation. - if (showPromises.length) { - return showPromises[0].finally(function () { - return callbackFn.apply(service, fnArguments); - }); - } - - return $q.when("No interim elements currently showing up."); - } - - return callbackFn.apply(service, fnArguments); - }; - } - - /** - * @ngdoc method - * @name $$interimElementProvider.$service#destroy - * @kind function - * - * Special method to quick-remove the interim element without running animations. This is - * useful when the parent component has been or is being destroyed. - * - * Note: interim elements are in "interim containers". - */ - function destroy(targetEl) { - var interim = !targetEl ? showingInterims.shift() : null; - - var parentEl = angular.element(targetEl).length && angular.element(targetEl)[0].parentNode; - - if (parentEl) { - // Try to find the interim in the stack which corresponds to the supplied DOM element. - var filtered = showingInterims.filter(function(entry) { - return entry.options.element[0] === parentEl; - }); - - // Note: This function might be called when the element already has been removed, - // in which case we won't find any matches. - if (filtered.length) { - interim = filtered[0]; - showingInterims.splice(showingInterims.indexOf(interim), 1); - } - } - - return interim ? interim.remove(SHOW_CANCELLED, false, { '$destroy': true }) : - $q.when(SHOW_CANCELLED); - } - - /* - * Internal Interim Element Object - * Used internally to manage the DOM element and related data - */ - function InterimElement(options) { - var self, element, showAction = $q.when(true); - - options = configureScopeAndTransitions(options); - - return self = { - options : options, - deferred: $q.defer(), - show : createAndTransitionIn, - remove : transitionOutAndRemove - }; - - /** - * Compile, link, and show this interim element. Use optional autoHide and transition-in - * effects. - * @return {Q.Promise} - */ - function createAndTransitionIn() { - return $q(function(resolve, reject) { - - // Trigger onCompiling callback before the compilation starts. - // This is useful, when modifying options, which can be influenced by developers. - options.onCompiling && options.onCompiling(options); - - compileElement(options) - .then(function(compiledData) { - element = linkElement(compiledData, options); - - // Expose the cleanup function from the compiler. - options.cleanupElement = compiledData.cleanup; - - showAction = showElement(element, options, compiledData.controller) - .then(resolve, rejectAll); - }).catch(rejectAll); - - function rejectAll(fault) { - // Force the '$md.show()' promise to reject - self.deferred.reject(fault); - - // Continue rejection propagation - reject(fault); - } - }); - } - - /** - * After the show process has finished/rejected: - * - announce 'removing', - * - perform the transition-out, and - * - perform optional clean up scope. - */ - function transitionOutAndRemove(response, isCancelled, opts) { - - // abort if the show() and compile failed - if (!element) return $q.when(false); - - options = angular.extend(options || {}, opts || {}); - options.cancelAutoHide && options.cancelAutoHide(); - options.element.triggerHandler('$mdInterimElementRemove'); - - if (options.$destroy === true) { - - return hideElement(options.element, options).then(function(){ - (isCancelled && rejectAll(response)) || resolveAll(response); - }); - - } else { - $q.when(showAction).finally(function() { - hideElement(options.element, options).then(function() { - isCancelled ? rejectAll(response) : resolveAll(response); - }, rejectAll); - }); - - return self.deferred.promise; - } - - - /** - * The `show()` returns a promise that will be resolved when the interim - * element is hidden or cancelled... - */ - function resolveAll(response) { - self.deferred.resolve(response); - } - - /** - * Force the '$md.show()' promise to reject - */ - function rejectAll(fault) { - self.deferred.reject(fault); - } - } - - /** - * Prepare optional isolated scope and prepare $animate with default enter and leave - * transitions for the new element instance. - */ - function configureScopeAndTransitions(options) { - options = options || { }; - if (options.template) { - options.template = $mdUtil.processTemplate(options.template); - } - - return angular.extend({ - preserveScope: false, - cancelAutoHide : angular.noop, - scope: options.scope || $rootScope.$new(options.isolateScope), - - /** - * Default usage to enable $animate to transition-in; can be easily overridden via 'options' - */ - onShow: function transitionIn(scope, element, options) { - return $animate.enter(element, options.parent); - }, - - /** - * Default usage to enable $animate to transition-out; can be easily overridden via 'options' - */ - onRemove: function transitionOut(scope, element) { - // Element could be undefined if a new element is shown before - // the old one finishes compiling. - return element && $animate.leave(element) || $q.when(); - } - }, options); - - } - - /** - * Compile an element with a templateUrl, controller, and locals - * @param {Object} options - * @return {Q.Promise<{element: JQLite=, link: Function, locals: Object, cleanup: any=, - * controller: Object=}>} - */ - function compileElement(options) { - - var compiled = !options.skipCompile ? $mdCompiler.compile(options) : null; - - return compiled || $q(function (resolve) { - resolve({ - locals: {}, - link: function () { - return options.element; - } - }); - }); - } - - /** - * Link an element with compiled configuration - * @param {{element: JQLite=, link: Function, locals: Object, controller: Object=}} compileData - * @param {Object} options - * @return {JQLite} - */ - function linkElement(compileData, options) { - angular.extend(compileData.locals, options); - - var element = compileData.link(options.scope); - - // Search for parent at insertion time, if not specified - options.element = element; - options.parent = findParent(element, options); - if (options.themable) $mdTheming(element); - - return element; - } - - /** - * Search for parent at insertion time, if not specified. - * @param {JQLite} element - * @param {Object} options - * @return {JQLite} - */ - function findParent(element, options) { - var parent = options.parent; - - // Search for parent at insertion time, if not specified - if (angular.isFunction(parent)) { - parent = parent(options.scope, element, options); - } else if (angular.isString(parent)) { - parent = angular.element($document[0].querySelector(parent)); - } else { - parent = angular.element(parent); - } - - // If parent querySelector/getter function fails, or it's just null, - // find a default. - if (!(parent || {}).length) { - var el; - if ($rootElement[0] && $rootElement[0].querySelector) { - el = $rootElement[0].querySelector(':not(svg) > body'); - } - if (!el) el = $rootElement[0]; - if (el.nodeName === '#comment') { - el = $document[0].body; - } - return angular.element(el); - } - - return parent; - } - - /** - * If auto-hide is enabled, start timer and prepare cancel function - */ - function startAutoHide() { - var autoHideTimer, cancelAutoHide = angular.noop; - - if (options.hideDelay) { - autoHideTimer = $timeout(service.hide, options.hideDelay) ; - cancelAutoHide = function() { - $timeout.cancel(autoHideTimer); - }; - } - - // Cache for subsequent use - options.cancelAutoHide = function() { - cancelAutoHide(); - options.cancelAutoHide = undefined; - }; - } - - /** - * Show the element (with transitions), notify complete and start optional auto hiding - * timer. - * @param {JQLite} element - * @param {Object} options - * @param {Object} controller - * @return {Q.Promise} - */ - function showElement(element, options, controller) { - // Trigger onShowing callback before the `show()` starts - var notifyShowing = options.onShowing || angular.noop; - // Trigger onComplete callback when the `show()` finishes - var notifyComplete = options.onComplete || angular.noop; - - // Necessary for consistency between AngularJS 1.5 and 1.6. - try { - // This fourth controller parameter is used by $mdDialog in beforeShow(). - notifyShowing(options.scope, element, options, controller); - } catch (e) { - return $q.reject(e); - } - - return $q(function (resolve, reject) { - try { - // Start transitionIn - $q.when(options.onShow(options.scope, element, options)) - .then(function () { - notifyComplete(options.scope, element, options); - startAutoHide(); - - resolve(element); - }, reject); - - } catch (e) { - reject(e.message); - } - }); - } - - function hideElement(element, options) { - var announceRemoving = options.onRemoving || angular.noop; - - return $q(function (resolve, reject) { - try { - // Start transitionIn - var action = $q.when(options.onRemove(options.scope, element, options) || true); - - // Trigger callback *before* the remove operation starts - announceRemoving(element, action); - - if (options.$destroy) { - // For $destroy, onRemove should be synchronous - resolve(element); - - if (!options.preserveScope && options.scope) { - // scope destroy should still be be done after the current digest is done - action.then(function() { options.scope.$destroy(); }); - } - } else { - // Wait until transition-out is done - action.then(function () { - if (!options.preserveScope && options.scope) { - options.scope.$destroy(); - } - - resolve(element); - }, reject); - } - } catch (e) { - reject(e.message); - } - }); - } - - } - }; - } -} - -})(); -(function(){ -"use strict"; - -(function() { - 'use strict'; - - var $mdUtil, $interpolate, $log; - - var SUFFIXES = /(-gt)?-(sm|md|lg|print)/g; - var WHITESPACE = /\s+/g; - - var FLEX_OPTIONS = ['grow', 'initial', 'auto', 'none', 'noshrink', 'nogrow']; - var LAYOUT_OPTIONS = ['row', 'column']; - var ALIGNMENT_MAIN_AXIS= ["", "start", "center", "end", "stretch", "space-around", "space-between"]; - var ALIGNMENT_CROSS_AXIS= ["", "start", "center", "end", "stretch"]; - - var config = { - /** - * Enable directive attribute-to-class conversions - * Developers can use `` to quickly - * disable the Layout directives and prohibit the injection of Layout classNames - */ - enabled: true, - - /** - * List of mediaQuery breakpoints and associated suffixes - * [ - * { suffix: "sm", mediaQuery: "screen and (max-width: 599px)" }, - * { suffix: "md", mediaQuery: "screen and (min-width: 600px) and (max-width: 959px)" } - * ] - */ - breakpoints: [] - }; - - registerLayoutAPI(angular.module('material.core.layout', ['ng'])); - - /** - * registerLayoutAPI() - * - * The original AngularJS Material Layout solution used attribute selectors and CSS. - * - * ```html - *
    My Content
    - * ``` - * - * ```css - * [layout] { - * box-sizing: border-box; - * display:flex; - * } - * [layout=column] { - * flex-direction : column - * } - * ``` - * - * Use of attribute selectors creates significant performance impacts in some - * browsers... mainly IE. - * - * This module registers directives that allow the same layout attributes to be - * interpreted and converted to class selectors. The directive will add equivalent classes to - * each element that contains a Layout directive. - * - * ```html - *
    My Content
    - * ``` - * - * ```css - * .layout { - * box-sizing: border-box; - * display:flex; - * } - * .layout-column { - * flex-direction : column - * } - * ``` - */ - function registerLayoutAPI(module){ - var PREFIX_REGEXP = /^((?:x|data)[:\-_])/i; - var SPECIAL_CHARS_REGEXP = /([:\-_]+(.))/g; - - // NOTE: these are also defined in constants::MEDIA_PRIORITY and constants::MEDIA - var BREAKPOINTS = ["", "xs", "gt-xs", "sm", "gt-sm", "md", "gt-md", "lg", "gt-lg", "xl", "print"]; - var API_WITH_VALUES = ["layout", "flex", "flex-order", "flex-offset", "layout-align"]; - var API_NO_VALUES = ["show", "hide", "layout-padding", "layout-margin"]; - - - // Build directive registration functions for the standard Layout API... for all breakpoints. - angular.forEach(BREAKPOINTS, function(mqb) { - - // Attribute directives with expected, observable value(s) - angular.forEach(API_WITH_VALUES, function(name){ - var fullName = mqb ? name + "-" + mqb : name; - module.directive(directiveNormalize(fullName), attributeWithObserve(fullName)); - }); - - // Attribute directives with no expected value(s) - angular.forEach(API_NO_VALUES, function(name){ - var fullName = mqb ? name + "-" + mqb : name; - module.directive(directiveNormalize(fullName), attributeWithoutValue(fullName)); - }); - - }); - - // Register other, special directive functions for the Layout features: - module - .provider('$$mdLayout', function() { - // Publish internal service for Layouts - return { - $get : angular.noop, - validateAttributeValue : validateAttributeValue, - validateAttributeUsage : validateAttributeUsage, - /** - * Easy way to disable/enable the Layout API. - * When disabled, this stops all attribute-to-classname generations - */ - disableLayouts : function(isDisabled) { - config.enabled = (isDisabled !== true); - } - }; - }) - - .directive('mdLayoutCss' , disableLayoutDirective) - .directive('ngCloak' , buildCloakInterceptor('ng-cloak')) - - .directive('layoutWrap' , attributeWithoutValue('layout-wrap')) - .directive('layoutNowrap' , attributeWithoutValue('layout-nowrap')) - .directive('layoutNoWrap' , attributeWithoutValue('layout-no-wrap')) - .directive('layoutFill' , attributeWithoutValue('layout-fill')) - - // Determine if - .config(detectDisabledLayouts); - - /** - * Converts snake_case to camelCase. - * Also there is special case for Moz prefix starting with upper case letter. - * @param name Name to normalize - */ - function directiveNormalize(name) { - return name - .replace(PREFIX_REGEXP, '') - .replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) { - return offset ? letter.toUpperCase() : letter; - }); - } - } - - - /** - * Detect if any of the HTML tags has a [md-layouts-disabled] attribute; - * If yes, then immediately disable all layout API features - * - * Note: this attribute should be specified on either the HTML or BODY tags - * @ngInject - */ - function detectDisabledLayouts() { - var isDisabled = !!document.querySelector('[md-layouts-disabled]'); - config.enabled = !isDisabled; - } - - /** - * Special directive that will disable ALL Layout conversions of layout - * attribute(s) to classname(s). - * - * - * - * - * - * ... - * - * - * Note: Using md-layout-css directive requires the developer to load the Material - * Layout Attribute stylesheet (which only uses attribute selectors): - * - * `angular-material.layout.css` - * - * Another option is to use the LayoutProvider to configure and disable the attribute - * conversions; this would obviate the use of the `md-layout-css` directive - */ - function disableLayoutDirective() { - // Return a 1x-only, first-match attribute directive - config.enabled = false; - - return { - restrict : 'A', - priority : '900' - }; - } - - /** - * Tail-hook ngCloak to delay the uncloaking while Layout transformers - * finish processing. Eliminates flicker with Material.Layouts - */ - function buildCloakInterceptor(className) { - return ['$timeout', function($timeout){ - return { - restrict : 'A', - priority : -10, // run after normal ng-cloak - compile : function(element) { - if (!config.enabled) return angular.noop; - - // Re-add the cloak - element.addClass(className); - - return function(scope, element) { - // Wait while layout injectors configure, then uncloak - // NOTE: $rAF does not delay enough... and this is a 1x-only event, - // $timeout is acceptable. - $timeout(function(){ - element.removeClass(className); - }, 10, false); - }; - } - }; - }]; - } - - - // ********************************************************************************* - // - // These functions create registration functions for AngularJS Material Layout attribute - // directives. This provides easy translation to switch AngularJS Material attribute selectors to - // CLASS selectors and directives; which has huge performance implications for IE Browsers. - // - // ********************************************************************************* - - /** - * Creates a directive registration function where a possible dynamic attribute - * value will be observed/watched. - * @param {string} className attribute name; eg `layout-gt-md` with value ="row" - */ - function attributeWithObserve(className) { - - return ['$mdUtil', '$interpolate', "$log", function(_$mdUtil_, _$interpolate_, _$log_) { - $mdUtil = _$mdUtil_; - $interpolate = _$interpolate_; - $log = _$log_; - - return { - restrict: 'A', - compile: function(element, attr) { - var linkFn; - if (config.enabled) { - // immediately replace static (non-interpolated) invalid values... - - validateAttributeUsage(className, attr, element, $log); - - validateAttributeValue(className, - getNormalizedAttrValue(className, attr, ""), - buildUpdateFn(element, className, attr) - ); - - linkFn = translateWithValueToCssClass; - } - - // Use for postLink to account for transforms after ng-transclude. - return linkFn || angular.noop; - } - }; - }]; - - /** - * Observe deprecated layout attributes and update the element's layout classes to match. - */ - function translateWithValueToCssClass(scope, element, attrs) { - var updateFn = updateClassWithValue(element, className, attrs); - var unwatch = attrs.$observe(attrs.$normalize(className), updateFn); - - updateFn(getNormalizedAttrValue(className, attrs, "")); - scope.$on("$destroy", function() { unwatch(); }); - } - } - - /** - * Creates a registration function for AngularJS Material Layout attribute directive. - * This is a `simple` transpose of attribute usage to class usage; where we ignore - * any attribute value. - */ - function attributeWithoutValue(className) { - return ['$mdUtil', '$interpolate', "$log", function(_$mdUtil_, _$interpolate_, _$log_) { - $mdUtil = _$mdUtil_; - $interpolate = _$interpolate_; - $log = _$log_; - - return { - restrict: 'A', - compile: function(element, attr) { - var linkFn; - if (config.enabled) { - // immediately replace static (non-interpolated) invalid values... - - validateAttributeValue(className, - getNormalizedAttrValue(className, attr, ""), - buildUpdateFn(element, className, attr) - ); - - translateToCssClass(null, element); - - // Use for postLink to account for transforms after ng-transclude. - linkFn = translateToCssClass; - } - - return linkFn || angular.noop; - } - }; - }]; - - /** - * Add transformed class selector. - */ - function translateToCssClass(scope, element) { - element.addClass(className); - } - } - - /** - * After link-phase, do NOT remove deprecated layout attribute selector. - * Instead watch the attribute so interpolated data-bindings to layout - * selectors will continue to be supported. - * - * $observe() the className and update with new class (after removing the last one) - * - * e.g. `layout="{{layoutDemo.direction}}"` will update... - * - * NOTE: The value must match one of the specified styles in the CSS. - * For example `flex-gt-md="{{size}}` where `scope.size == 47` will NOT work since - * only breakpoints for 0, 5, 10, 15... 100, 33, 34, 66, 67 are defined. - */ - function updateClassWithValue(element, className) { - var lastClass; - - return function updateClassFn(newValue) { - var value = validateAttributeValue(className, newValue || ""); - if (angular.isDefined(value)) { - if (lastClass) element.removeClass(lastClass); - lastClass = !value ? className : className + "-" + value.trim().replace(WHITESPACE, "-"); - element.addClass(lastClass); - } - }; - } - - /** - * Centralize warnings for known flexbox issues (especially IE-related issues) - */ - function validateAttributeUsage(className, attr, element, $log){ - var message, usage, url; - var nodeName = element[0].nodeName.toLowerCase(); - - switch (className.replace(SUFFIXES,"")) { - case "flex": - if ((nodeName === "md-button") || (nodeName === "fieldset")){ - // @see https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers - // Use
    wrapper inside (preferred) or outside - - usage = "<" + nodeName + " " + className + ">"; - url = "https://github.com/philipwalton/flexbugs#9-some-html-elements-cant-be-flex-containers"; - message = "Markup '{0}' may not work as expected in IE Browsers. Consult '{1}' for details."; - - $log.warn($mdUtil.supplant(message, [usage, url])); - } - } - } - - - /** - * For the Layout attribute value, validate or replace with default fallback value. - */ - function validateAttributeValue(className, value, updateFn) { - var origValue = value; - - if (!needsInterpolation(value)) { - switch (className.replace(SUFFIXES,"")) { - case 'layout' : - if (!findIn(value, LAYOUT_OPTIONS)) { - value = LAYOUT_OPTIONS[0]; // 'row'; - } - break; - - case 'flex' : - if (!findIn(value, FLEX_OPTIONS)) { - if (isNaN(value)) { - value = ''; - } - } - break; - - case 'flex-offset' : - case 'flex-order' : - if (!value || isNaN(+value)) { - value = '0'; - } - break; - - case 'layout-align' : - var axis = extractAlignAxis(value); - value = $mdUtil.supplant("{main}-{cross}",axis); - break; - - case 'layout-padding' : - case 'layout-margin' : - case 'layout-fill' : - case 'layout-wrap' : - case 'layout-nowrap' : - value = ''; - break; - } - - if (value !== origValue) { - (updateFn || angular.noop)(value); - } - } - - return value ? value.trim() : ""; - } - - /** - * Replace current attribute value with fallback value - */ - function buildUpdateFn(element, className, attrs) { - return function updateAttrValue(fallback) { - if (!needsInterpolation(fallback)) { - // Do not modify the element's attribute value; so - // uses '' will not - // be affected. Just update the attrs value. - attrs[attrs.$normalize(className)] = fallback; - } - }; - } - - /** - * See if the original value has interpolation symbols: - * e.g. flex-gt-md="{{triggerPoint}}" - */ - function needsInterpolation(value) { - return (value || "").indexOf($interpolate.startSymbol()) > -1; - } - - function getNormalizedAttrValue(className, attrs, defaultVal) { - var normalizedAttr = attrs.$normalize(className); - return attrs[normalizedAttr] ? attrs[normalizedAttr].trim().replace(WHITESPACE, "-") : - defaultVal || null; - } - - function findIn(item, list, replaceWith) { - item = replaceWith && item ? item.replace(WHITESPACE, replaceWith) : item; - - var found = false; - if (item) { - list.forEach(function(it) { - it = replaceWith ? it.replace(WHITESPACE, replaceWith) : it; - found = found || (it === item); - }); - } - return found; - } - - function extractAlignAxis(attrValue) { - var axis = { - main : "start", - cross: "stretch" - }, values; - - attrValue = (attrValue || ""); - - if (attrValue.indexOf("-") === 0 || attrValue.indexOf(" ") === 0) { - // For missing main-axis values - attrValue = "none" + attrValue; - } - - values = attrValue.toLowerCase().trim().replace(WHITESPACE, "-").split("-"); - if (values.length && (values[0] === "space")) { - // for main-axis values of "space-around" or "space-between" - values = [values[0]+"-"+values[1],values[2]]; - } - - if (values.length > 0) axis.main = values[0] || axis.main; - if (values.length > 1) axis.cross = values[1] || axis.cross; - - if (ALIGNMENT_MAIN_AXIS.indexOf(axis.main) < 0) axis.main = "start"; - if (ALIGNMENT_CROSS_AXIS.indexOf(axis.cross) < 0) axis.cross = "stretch"; - - return axis; - } -})(); - -})(); -(function(){ -"use strict"; - -/** - * @ngdoc module - * @name material.core.liveannouncer - * @description - * AngularJS Material Live Announcer to provide accessibility for Voice Readers. - */ -MdLiveAnnouncer.$inject = ["$timeout"]; -angular - .module('material.core') - .service('$mdLiveAnnouncer', MdLiveAnnouncer); - -/** - * @ngdoc service - * @name $mdLiveAnnouncer - * @module material.core.liveannouncer - * - * @description - * - * Service to announce messages to supported screenreaders. - * - * > The `$mdLiveAnnouncer` service is internally used for components to provide proper accessibility. - * - * - * module.controller('AppCtrl', function($mdLiveAnnouncer) { - * // Basic announcement (Polite Mode) - * $mdLiveAnnouncer.announce('Hey Google'); - * - * // Custom announcement (Assertive Mode) - * $mdLiveAnnouncer.announce('Hey Google', 'assertive'); - * }); - * - * - */ -function MdLiveAnnouncer($timeout) { - /** @private @const @type {!angular.$timeout} */ - this._$timeout = $timeout; - - /** @private @const @type {!HTMLElement} */ - this._liveElement = this._createLiveElement(); - - /** @private @const @type {!number} */ - this._announceTimeout = 100; -} - -/** - * @ngdoc method - * @name $mdLiveAnnouncer#announce - * @description Announces messages to supported screenreaders. - * @param {string} message Message to be announced to the screenreader - * @param {'off'|'polite'|'assertive'} politeness The politeness of the announcer element. - */ -MdLiveAnnouncer.prototype.announce = function(message, politeness) { - if (!politeness) { - politeness = 'polite'; - } - - var self = this; - - self._liveElement.textContent = ''; - self._liveElement.setAttribute('aria-live', politeness); - - // This 100ms timeout is necessary for some browser + screen-reader combinations: - // - Both JAWS and NVDA over IE11 will not announce anything without a non-zero timeout. - // - With Chrome and IE11 with NVDA or JAWS, a repeated (identical) message won't be read a - // second time without clearing and then using a non-zero delay. - // (using JAWS 17 at time of this writing). - self._$timeout(function() { - self._liveElement.textContent = message; - }, self._announceTimeout, false); -}; - -/** - * Creates a live announcer element, which listens for DOM changes and announces them - * to the screenreaders. - * @returns {!HTMLElement} - * @private - */ -MdLiveAnnouncer.prototype._createLiveElement = function() { - var liveEl = document.createElement('div'); - - liveEl.classList.add('md-visually-hidden'); - liveEl.setAttribute('role', 'status'); - liveEl.setAttribute('aria-atomic', 'true'); - liveEl.setAttribute('aria-live', 'polite'); - - document.body.appendChild(liveEl); - - return liveEl; -}; - -})(); -(function(){ -"use strict"; - -/** - * @ngdoc service - * @name $$mdMeta - * @module material.core.meta - * - * @description - * - * A provider and a service that simplifies meta tags access - * - * Note: This is intended only for use with dynamic meta tags such as browser color and title. - * Tags that are only processed when the page is rendered (such as `charset`, and `http-equiv`) - * will not work since `$$mdMeta` adds the tags after the page has already been loaded. - * - * ```js - * app.config(function($$mdMetaProvider) { - * var removeMeta = $$mdMetaProvider.setMeta('meta-name', 'content'); - * var metaValue = $$mdMetaProvider.getMeta('meta-name'); // -> 'content' - * - * removeMeta(); - * }); - * - * app.controller('myController', function($$mdMeta) { - * var removeMeta = $$mdMeta.setMeta('meta-name', 'content'); - * var metaValue = $$mdMeta.getMeta('meta-name'); // -> 'content' - * - * removeMeta(); - * }); - * ``` - * - * @returns {$$mdMeta.$service} - * - */ -angular.module('material.core.meta', []) - .provider('$$mdMeta', function () { - var head = angular.element(document.head); - var metaElements = {}; - - /** - * Checks if the requested element was written manually and maps it - * - * @param {string} name meta tag 'name' attribute value - * @returns {boolean} returns true if there is an element with the requested name - */ - function mapExistingElement(name) { - if (metaElements[name]) { - return true; - } - - var element = document.getElementsByName(name)[0]; - - if (!element) { - return false; - } - - metaElements[name] = angular.element(element); - - return true; - } - - /** - * @ngdoc method - * @name $$mdMeta#setMeta - * - * @description - * Creates meta element with the 'name' and 'content' attributes, - * if the meta tag is already created than we replace the 'content' value - * - * @param {string} name meta tag 'name' attribute value - * @param {string} content meta tag 'content' attribute value - * @returns {function} remove function - * - */ - function setMeta(name, content) { - mapExistingElement(name); - - if (!metaElements[name]) { - var newMeta = angular.element(''); - head.append(newMeta); - metaElements[name] = newMeta; - } - else { - metaElements[name].attr('content', content); - } - - return function () { - metaElements[name].attr('content', ''); - metaElements[name].remove(); - delete metaElements[name]; - }; - } - - /** - * @ngdoc method - * @name $$mdMeta#getMeta - * - * @description - * Gets the 'content' attribute value of the wanted meta element - * - * @param {string} name meta tag 'name' attribute value - * @returns {string} content attribute value - */ - function getMeta(name) { - if (!mapExistingElement(name)) { - throw Error('$$mdMeta: could not find a meta tag with the name \'' + name + '\''); - } - - return metaElements[name].attr('content'); - } - - var module = { - setMeta: setMeta, - getMeta: getMeta - }; - - return angular.extend({}, module, { - $get: function () { - return module; - } - }); - }); -})(); -(function(){ -"use strict"; - - /** - * @ngdoc module - * @name material.core.componentRegistry - * - * @description - * A component instance registration service. - * Note: currently this as a private service in the SideNav component. - */ - ComponentRegistry.$inject = ["$log", "$q"]; - angular.module('material.core') - .factory('$mdComponentRegistry', ComponentRegistry); - - /* - * @private - * @ngdoc factory - * @name ComponentRegistry - * @module material.core.componentRegistry - * - */ - function ComponentRegistry($log, $q) { - - var self; - var instances = []; - var pendings = { }; - - return self = { - /** - * Used to print an error when an instance for a handle isn't found. - */ - notFoundError: function(handle, msgContext) { - $log.error((msgContext || "") + 'No instance found for handle', handle); - }, - /** - * Return all registered instances as an array. - */ - getInstances: function() { - return instances; - }, - - /** - * Get a registered instance. - * @param handle the String handle to look up for a registered instance. - */ - get: function(handle) { - if (!isValidID(handle)) return null; - - var i, j, instance; - for (i = 0, j = instances.length; i < j; i++) { - instance = instances[i]; - if (instance.$$mdHandle === handle) { - return instance; - } - } - return null; - }, - - /** - * Register an instance. - * @param instance the instance to register - * @param handle the handle to identify the instance under. - */ - register: function(instance, handle) { - if (!handle) return angular.noop; - - instance.$$mdHandle = handle; - instances.push(instance); - resolveWhen(); - - return deregister; - - /** - * Remove registration for an instance - */ - function deregister() { - var index = instances.indexOf(instance); - if (index !== -1) { - instances.splice(index, 1); - } - } - - /** - * Resolve any pending promises for this instance - */ - function resolveWhen() { - var dfd = pendings[handle]; - if (dfd) { - dfd.forEach(function (promise) { - promise.resolve(instance); - }); - delete pendings[handle]; - } - } - }, - - /** - * Async accessor to registered component instance - * If not available then a promise is created to notify - * all listeners when the instance is registered. - */ - when : function(handle) { - if (isValidID(handle)) { - var deferred = $q.defer(); - var instance = self.get(handle); - - if (instance) { - deferred.resolve(instance); - } else { - if (pendings[handle] === undefined) { - pendings[handle] = []; - } - pendings[handle].push(deferred); - } - - return deferred.promise; - } - return $q.reject("Invalid `md-component-id` value."); - } - - }; - - function isValidID(handle){ - return handle && (handle !== ""); - } - - } - -})(); -(function(){ -"use strict"; - -(function() { - 'use strict'; - - /** - * @ngdoc service - * @name $mdButtonInkRipple - * @module material.core - * - * @description - * Provides ripple effects for md-button. See $mdInkRipple service for all possible configuration options. - * - * @param {object=} scope Scope within the current context - * @param {object=} element The element the ripple effect should be applied to - * @param {object=} options (Optional) Configuration options to override the default ripple configuration - */ - - MdButtonInkRipple.$inject = ["$mdInkRipple"]; - angular.module('material.core') - .factory('$mdButtonInkRipple', MdButtonInkRipple); - - function MdButtonInkRipple($mdInkRipple) { - return { - attach: function attachRipple(scope, element, options) { - options = angular.extend(optionsForElement(element), options); - - return $mdInkRipple.attach(scope, element, options); - } - }; - - function optionsForElement(element) { - if (element.hasClass('md-icon-button')) { - return { - isMenuItem: element.hasClass('md-menu-item'), - fitRipple: true, - center: true - }; - } else { - return { - isMenuItem: element.hasClass('md-menu-item'), - dimBackground: true - }; - } - } - } -})(); - -})(); -(function(){ -"use strict"; - -(function() { - 'use strict'; - - /** - * @ngdoc service - * @name $mdCheckboxInkRipple - * @module material.core - * - * @description - * Provides ripple effects for md-checkbox. See $mdInkRipple service for all possible configuration options. - * - * @param {object=} scope Scope within the current context - * @param {object=} element The element the ripple effect should be applied to - * @param {object=} options (Optional) Configuration options to override the defaultripple configuration - */ - - MdCheckboxInkRipple.$inject = ["$mdInkRipple"]; - angular.module('material.core') - .factory('$mdCheckboxInkRipple', MdCheckboxInkRipple); - - function MdCheckboxInkRipple($mdInkRipple) { - return { - attach: attach - }; - - function attach(scope, element, options) { - return $mdInkRipple.attach(scope, element, angular.extend({ - center: true, - dimBackground: false, - fitRipple: true - }, options)); - } - } -})(); - -})(); -(function(){ -"use strict"; - -(function() { - 'use strict'; - - /** - * @ngdoc service - * @name $mdListInkRipple - * @module material.core - * - * @description - * Provides ripple effects for md-list. See $mdInkRipple service for all possible configuration options. - * - * @param {object=} scope Scope within the current context - * @param {object=} element The element the ripple effect should be applied to - * @param {object=} options (Optional) Configuration options to override the defaultripple configuration - */ - - MdListInkRipple.$inject = ["$mdInkRipple"]; - angular.module('material.core') - .factory('$mdListInkRipple', MdListInkRipple); - - function MdListInkRipple($mdInkRipple) { - return { - attach: attach - }; - - function attach(scope, element, options) { - return $mdInkRipple.attach(scope, element, angular.extend({ - center: false, - dimBackground: true, - outline: false, - rippleSize: 'full' - }, options)); - } - } -})(); - -})(); -(function(){ -"use strict"; - -/** - * @ngdoc module - * @name material.core.ripple - * @description - * Ripple - */ -InkRippleCtrl.$inject = ["$scope", "$element", "rippleOptions", "$window", "$timeout", "$mdUtil", "$mdColorUtil"]; -InkRippleDirective.$inject = ["$mdButtonInkRipple", "$mdCheckboxInkRipple"]; -angular.module('material.core') - .provider('$mdInkRipple', InkRippleProvider) - .directive('mdInkRipple', InkRippleDirective) - .directive('mdNoInk', attrNoDirective) - .directive('mdNoBar', attrNoDirective) - .directive('mdNoStretch', attrNoDirective); - -var DURATION = 450; - -/** - * @ngdoc directive - * @name mdInkRipple - * @module material.core.ripple - * - * @description - * The `md-ink-ripple` directive allows you to specify the ripple color or if a ripple is allowed. - * - * @param {string|boolean} md-ink-ripple A color string `#FF0000` or boolean (`false` or `0`) for - * preventing ripple - * - * @usage - * ### String values - * - * - * Ripples in red - * - * - * - * Not rippling - * - * - * - * ### Interpolated values - * - * - * Ripples with the return value of 'randomColor' function - * - * - * - * Ripples if 'canRipple' function return value is not 'false' or '0' - * - * - */ -function InkRippleDirective ($mdButtonInkRipple, $mdCheckboxInkRipple) { - return { - controller: angular.noop, - link: function (scope, element, attr) { - attr.hasOwnProperty('mdInkRippleCheckbox') - ? $mdCheckboxInkRipple.attach(scope, element) - : $mdButtonInkRipple.attach(scope, element); - } - }; -} - -/** - * @ngdoc service - * @name $mdInkRipple - * @module material.core.ripple - * - * @description - * `$mdInkRipple` is a service for adding ripples to any element. - * - * @usage - * - * app.factory('$myElementInkRipple', function($mdInkRipple) { - * return { - * attach: function (scope, element, options) { - * return $mdInkRipple.attach(scope, element, angular.extend({ - * center: false, - * dimBackground: true - * }, options)); - * } - * }; - * }); - * - * app.controller('myController', function ($scope, $element, $myElementInkRipple) { - * $scope.onClick = function (ev) { - * $myElementInkRipple.attach($scope, angular.element(ev.target), { center: true }); - * } - * }); - * - */ - -/** - * @ngdoc service - * @name $mdInkRippleProvider - * @module material.core.ripple - * - * @description - * If you want to disable ink ripples globally, for all components, you can call the - * `disableInkRipple` method in your app's config. - * - * - * @usage - * - * app.config(function ($mdInkRippleProvider) { - * $mdInkRippleProvider.disableInkRipple(); - * }); - * - */ - -function InkRippleProvider () { - var isDisabledGlobally = false; - - return { - disableInkRipple: disableInkRipple, - $get: ["$injector", function($injector) { - return { attach: attach }; - - /** - * @ngdoc method - * @name $mdInkRipple#attach - * - * @description - * Attaching given scope, element and options to inkRipple controller - * - * @param {object=} scope Scope within the current context - * @param {object=} element The element the ripple effect should be applied to - * @param {object=} options (Optional) Configuration options to override the defaultRipple configuration - * * `center` - Whether the ripple should start from the center of the container element - * * `dimBackground` - Whether the background should be dimmed with the ripple color - * * `colorElement` - The element the ripple should take its color from, defined by css property `color` - * * `fitRipple` - Whether the ripple should fill the element - */ - function attach (scope, element, options) { - if (isDisabledGlobally || element.controller('mdNoInk')) return angular.noop; - return $injector.instantiate(InkRippleCtrl, { - $scope: scope, - $element: element, - rippleOptions: options - }); - } - }] - }; - - /** - * @ngdoc method - * @name $mdInkRippleProvider#disableInkRipple - * - * @description - * A config-time method that, when called, disables ripples globally. - */ - function disableInkRipple () { - isDisabledGlobally = true; - } -} - -/** - * Controller used by the ripple service in order to apply ripples - * @ngInject - */ -function InkRippleCtrl ($scope, $element, rippleOptions, $window, $timeout, $mdUtil, $mdColorUtil) { - this.$window = $window; - this.$timeout = $timeout; - this.$mdUtil = $mdUtil; - this.$mdColorUtil = $mdColorUtil; - this.$scope = $scope; - this.$element = $element; - this.options = rippleOptions; - this.mousedown = false; - this.ripples = []; - this.timeout = null; // Stores a reference to the most-recent ripple timeout - this.lastRipple = null; - - $mdUtil.valueOnUse(this, 'container', this.createContainer); - - this.$element.addClass('md-ink-ripple'); - - // attach method for unit tests - ($element.controller('mdInkRipple') || {}).createRipple = angular.bind(this, this.createRipple); - ($element.controller('mdInkRipple') || {}).setColor = angular.bind(this, this.color); - - this.bindEvents(); -} - - -/** - * Either remove or unlock any remaining ripples when the user mouses off of the element (either by - * mouseup or mouseleave event) - */ -function autoCleanup (self, cleanupFn) { - if (self.mousedown || self.lastRipple) { - self.mousedown = false; - self.$mdUtil.nextTick(angular.bind(self, cleanupFn), false); - } -} - - -/** - * Returns the color that the ripple should be (either based on CSS or hard-coded) - * @returns {string} - */ -InkRippleCtrl.prototype.color = function (value) { - var self = this; - - // If assigning a color value, apply it to background and the ripple color - if (angular.isDefined(value)) { - self._color = self._parseColor(value); - } - - // If color lookup, use assigned, defined, or inherited - return self._color || self._parseColor(self.inkRipple()) || self._parseColor(getElementColor()); - - /** - * Finds the color element and returns its text color for use as default ripple color - * @returns {string} - */ - function getElementColor () { - var items = self.options && self.options.colorElement ? self.options.colorElement : []; - var elem = items.length ? items[ 0 ] : self.$element[ 0 ]; - - return elem ? self.$window.getComputedStyle(elem).color : 'rgb(0,0,0)'; - } -}; - -/** - * Updating the ripple colors based on the current inkRipple value - * or the element's computed style color - */ -InkRippleCtrl.prototype.calculateColor = function () { - return this.color(); -}; - - -/** - * Takes a string color and converts it to RGBA format - * @param {string} color - * @param {number} multiplier - * @returns {string} - */ -InkRippleCtrl.prototype._parseColor = function parseColor (color, multiplier) { - multiplier = multiplier || 1; - var colorUtil = this.$mdColorUtil; - - if (!color) return; - if (color.indexOf('rgba') === 0) return color.replace(/\d?\.?\d*\s*\)\s*$/, (0.1 * multiplier).toString() + ')'); - if (color.indexOf('rgb') === 0) return colorUtil.rgbToRgba(color); - if (color.indexOf('#') === 0) return colorUtil.hexToRgba(color); - -}; - -/** - * Binds events to the root element for - */ -InkRippleCtrl.prototype.bindEvents = function () { - this.$element.on('mousedown', angular.bind(this, this.handleMousedown)); - this.$element.on('mouseup touchend', angular.bind(this, this.handleMouseup)); - this.$element.on('mouseleave', angular.bind(this, this.handleMouseup)); - this.$element.on('touchmove', angular.bind(this, this.handleTouchmove)); -}; - -/** - * Create a new ripple on every mousedown event from the root element - * @param event {MouseEvent} - */ -InkRippleCtrl.prototype.handleMousedown = function (event) { - if (this.mousedown) return; - - // When jQuery is loaded, we have to get the original event - if (event.hasOwnProperty('originalEvent')) event = event.originalEvent; - this.mousedown = true; - if (this.options.center) { - this.createRipple(this.container.prop('clientWidth') / 2, this.container.prop('clientWidth') / 2); - } else { - - // We need to calculate the relative coordinates if the target is a sublayer of the ripple element - if (event.srcElement !== this.$element[0]) { - var layerRect = this.$element[0].getBoundingClientRect(); - var layerX = event.clientX - layerRect.left; - var layerY = event.clientY - layerRect.top; - - this.createRipple(layerX, layerY); - } else { - this.createRipple(event.offsetX, event.offsetY); - } - } -}; - -/** - * Either remove or unlock any remaining ripples when the user mouses off of the element (either by - * mouseup, touchend or mouseleave event) - */ -InkRippleCtrl.prototype.handleMouseup = function () { - this.$timeout(function () { - autoCleanup(this, this.clearRipples); - }.bind(this)); -}; - -/** - * Either remove or unlock any remaining ripples when the user mouses off of the element (by - * touchmove) - */ -InkRippleCtrl.prototype.handleTouchmove = function () { - autoCleanup(this, this.deleteRipples); -}; - -/** - * Cycles through all ripples and attempts to remove them. - */ -InkRippleCtrl.prototype.deleteRipples = function () { - for (var i = 0; i < this.ripples.length; i++) { - this.ripples[ i ].remove(); - } -}; - -/** - * Cycles through all ripples and attempts to remove them with fade. - * Depending on logic within `fadeInComplete`, some removals will be postponed. - */ -InkRippleCtrl.prototype.clearRipples = function () { - for (var i = 0; i < this.ripples.length; i++) { - this.fadeInComplete(this.ripples[ i ]); - } -}; - -/** - * Creates the ripple container element - * @returns {*} - */ -InkRippleCtrl.prototype.createContainer = function () { - var container = angular.element('
    '); - this.$element.append(container); - return container; -}; - -InkRippleCtrl.prototype.clearTimeout = function () { - if (this.timeout) { - this.$timeout.cancel(this.timeout); - this.timeout = null; - } -}; - -InkRippleCtrl.prototype.isRippleAllowed = function () { - var element = this.$element[0]; - do { - if (!element.tagName || element.tagName === 'BODY') break; - - if (element && angular.isFunction(element.hasAttribute)) { - if (element.hasAttribute('disabled')) return false; - if (this.inkRipple() === 'false' || this.inkRipple() === '0') return false; - } - - } while (element = element.parentNode); - return true; -}; - -/** - * The attribute `md-ink-ripple` may be a static or interpolated - * color value OR a boolean indicator (used to disable ripples) - */ -InkRippleCtrl.prototype.inkRipple = function () { - return this.$element.attr('md-ink-ripple'); -}; - -/** - * Creates a new ripple and adds it to the container. Also tracks ripple in `this.ripples`. - * @param left - * @param top - */ -InkRippleCtrl.prototype.createRipple = function (left, top) { - if (!this.isRippleAllowed()) return; - - var ctrl = this; - var colorUtil = ctrl.$mdColorUtil; - var ripple = angular.element('
    '); - var width = this.$element.prop('clientWidth'); - var height = this.$element.prop('clientHeight'); - var x = Math.max(Math.abs(width - left), left) * 2; - var y = Math.max(Math.abs(height - top), top) * 2; - var size = getSize(this.options.fitRipple, x, y); - var color = this.calculateColor(); - - ripple.css({ - left: left + 'px', - top: top + 'px', - background: 'black', - width: size + 'px', - height: size + 'px', - backgroundColor: colorUtil.rgbaToRgb(color), - borderColor: colorUtil.rgbaToRgb(color) - }); - this.lastRipple = ripple; - - // we only want one timeout to be running at a time - this.clearTimeout(); - this.timeout = this.$timeout(function () { - ctrl.clearTimeout(); - if (!ctrl.mousedown) ctrl.fadeInComplete(ripple); - }, DURATION * 0.35, false); - - if (this.options.dimBackground) this.container.css({ backgroundColor: color }); - this.container.append(ripple); - this.ripples.push(ripple); - ripple.addClass('md-ripple-placed'); - - this.$mdUtil.nextTick(function () { - - ripple.addClass('md-ripple-scaled md-ripple-active'); - ctrl.$timeout(function () { - ctrl.clearRipples(); - }, DURATION, false); - - }, false); - - function getSize (fit, x, y) { - return fit - ? Math.max(x, y) - : Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)); - } -}; - - - -/** - * After fadeIn finishes, either kicks off the fade-out animation or queues the element for removal on mouseup - * @param ripple - */ -InkRippleCtrl.prototype.fadeInComplete = function (ripple) { - if (this.lastRipple === ripple) { - if (!this.timeout && !this.mousedown) { - this.removeRipple(ripple); - } - } else { - this.removeRipple(ripple); - } -}; - -/** - * Kicks off the animation for removing a ripple - * @param ripple {Element} - */ -InkRippleCtrl.prototype.removeRipple = function (ripple) { - var ctrl = this; - var index = this.ripples.indexOf(ripple); - if (index < 0) return; - this.ripples.splice(this.ripples.indexOf(ripple), 1); - ripple.removeClass('md-ripple-active'); - ripple.addClass('md-ripple-remove'); - if (this.ripples.length === 0) this.container.css({ backgroundColor: '' }); - // use a 2-second timeout in order to allow for the animation to finish - // we don't actually care how long the animation takes - this.$timeout(function () { - ctrl.fadeOutComplete(ripple); - }, DURATION, false); -}; - -/** - * Removes the provided ripple from the DOM - * @param ripple - */ -InkRippleCtrl.prototype.fadeOutComplete = function (ripple) { - ripple.remove(); - this.lastRipple = null; -}; - -/** - * Used to create an empty directive. This is used to track flag-directives whose children may have - * functionality based on them. - * - * Example: `md-no-ink` will potentially be used by all child directives. - */ -function attrNoDirective () { - return { controller: angular.noop }; -} - -})(); -(function(){ -"use strict"; - -(function() { - 'use strict'; - - /** - * @ngdoc service - * @name $mdTabInkRipple - * @module material.core - * - * @description - * Provides ripple effects for md-tabs. See $mdInkRipple service for all possible configuration options. - * - * @param {object=} scope Scope within the current context - * @param {object=} element The element the ripple effect should be applied to - * @param {object=} options (Optional) Configuration options to override the defaultripple configuration - */ - - MdTabInkRipple.$inject = ["$mdInkRipple"]; - angular.module('material.core') - .factory('$mdTabInkRipple', MdTabInkRipple); - - function MdTabInkRipple($mdInkRipple) { - return { - attach: attach - }; - - function attach(scope, element, options) { - return $mdInkRipple.attach(scope, element, angular.extend({ - center: false, - dimBackground: true, - outline: false, - rippleSize: 'full' - }, options)); - } - } -})(); - -})(); -(function(){ -"use strict"; - -angular.module('material.core.theming.palette', []) -.constant('$mdColorPalette', { - 'red': { - '50': '#ffebee', - '100': '#ffcdd2', - '200': '#ef9a9a', - '300': '#e57373', - '400': '#ef5350', - '500': '#f44336', - '600': '#e53935', - '700': '#d32f2f', - '800': '#c62828', - '900': '#b71c1c', - 'A100': '#ff8a80', - 'A200': '#ff5252', - 'A400': '#ff1744', - 'A700': '#d50000', - 'contrastDefaultColor': 'light', - 'contrastDarkColors': '50 100 200 300 400 500 600 A100 A200 A400', - 'contrastStrongLightColors': '700 800 900 A700' - }, - 'pink': { - '50': '#fce4ec', - '100': '#f8bbd0', - '200': '#f48fb1', - '300': '#f06292', - '400': '#ec407a', - '500': '#e91e63', - '600': '#d81b60', - '700': '#c2185b', - '800': '#ad1457', - '900': '#880e4f', - 'A100': '#ff80ab', - 'A200': '#ff4081', - 'A400': '#f50057', - 'A700': '#c51162', - 'contrastDefaultColor': 'light', - 'contrastDarkColors': '50 100 200 300 400 A100 A200 A400', - // White on 500 does not meet the minimum 4.5 contrast ratio (at 4.34), - // but it's worse with a dark foreground (3.61). - 'contrastStrongLightColors': '500 600 700 800 900 A700' - }, - 'purple': { - '50': '#f3e5f5', - '100': '#e1bee7', - '200': '#ce93d8', - '300': '#ba68c8', - '400': '#ab47bc', - '500': '#9c27b0', - '600': '#8e24aa', - '700': '#7b1fa2', - '800': '#6a1b9a', - '900': '#4a148c', - 'A100': '#ea80fc', - 'A200': '#e040fb', - 'A400': '#d500f9', - 'A700': '#aa00ff', - 'contrastDefaultColor': 'light', - 'contrastDarkColors': '50 100 200 300 A100 A200 A400', - 'contrastStrongLightColors': '400 500 600 700 800 900 A700' - }, - 'deep-purple': { - '50': '#ede7f6', - '100': '#d1c4e9', - '200': '#b39ddb', - '300': '#9575cd', - '400': '#7e57c2', - '500': '#673ab7', - '600': '#5e35b1', - '700': '#512da8', - '800': '#4527a0', - '900': '#311b92', - 'A100': '#b388ff', - 'A200': '#7c4dff', - 'A400': '#651fff', - 'A700': '#6200ea', - 'contrastDefaultColor': 'light', - 'contrastDarkColors': '50 100 200 300 A100', - 'contrastStrongLightColors': '400 500 600 700 800 900 A200 A400 A700' - }, - 'indigo': { - '50': '#e8eaf6', - '100': '#c5cae9', - '200': '#9fa8da', - '300': '#7986cb', - '400': '#5c6bc0', - '500': '#3f51b5', - '600': '#3949ab', - '700': '#303f9f', - '800': '#283593', - '900': '#1a237e', - 'A100': '#8c9eff', - 'A200': '#536dfe', - 'A400': '#3d5afe', - 'A700': '#304ffe', - 'contrastDefaultColor': 'light', - 'contrastDarkColors': '50 100 200 300 A100 A200', - 'contrastStrongLightColors': '400 500 600 700 800 900 A400 A700' - }, - 'blue': { - '50': '#e3f2fd', - '100': '#bbdefb', - '200': '#90caf9', - '300': '#64b5f6', - '400': '#42a5f5', - '500': '#2196f3', - '600': '#1e88e5', - '700': '#1976d2', - '800': '#1565c0', - '900': '#0d47a1', - 'A100': '#82b1ff', - 'A200': '#448aff', - 'A400': '#2979ff', - 'A700': '#2962ff', - 'contrastDefaultColor': 'light', - // White on A400 does not meet the minimum 4.5 contrast ratio (at 3.98), - // but it's worse with a dark foreground (3.94). - 'contrastDarkColors': '50 100 200 300 400 500 600 A100 A200', - 'contrastStrongLightColors': '700 800 900 A400 A700' - }, - 'light-blue': { - '50': '#e1f5fe', - '100': '#b3e5fc', - '200': '#81d4fa', - '300': '#4fc3f7', - '400': '#29b6f6', - '500': '#03a9f4', - '600': '#039be5', - '700': '#0288d1', - '800': '#0277bd', - '900': '#01579b', - 'A100': '#80d8ff', - 'A200': '#40c4ff', - 'A400': '#00b0ff', - 'A700': '#0091ea', - 'contrastDefaultColor': 'dark', - // Dark on 700 does not meet the minimum 4.5 contrast ratio (at 4.07), - // but it's worse with a white foreground (3.85). - 'contrastStrongLightColors': '800 900 A700' - }, - 'cyan': { - '50': '#e0f7fa', - '100': '#b2ebf2', - '200': '#80deea', - '300': '#4dd0e1', - '400': '#26c6da', - '500': '#00bcd4', - '600': '#00acc1', - '700': '#0097a7', - '800': '#00838f', - '900': '#006064', - 'A100': '#84ffff', - 'A200': '#18ffff', - 'A400': '#00e5ff', - 'A700': '#00b8d4', - 'contrastDefaultColor': 'dark', - // Dark on 700 does not meet the minimum 4.5 contrast ratio (at 4.47), - // but it's worse with a white foreground (3.5). - 'contrastStrongLightColors': '800 900' - }, - 'teal': { - '50': '#e0f2f1', - '100': '#b2dfdb', - '200': '#80cbc4', - '300': '#4db6ac', - '400': '#26a69a', - '500': '#009688', - '600': '#00897b', - '700': '#00796b', - '800': '#00695c', - '900': '#004d40', - 'A100': '#a7ffeb', - 'A200': '#64ffda', - 'A400': '#1de9b6', - 'A700': '#00bfa5', - 'contrastDefaultColor': 'dark', - // Dark on 500 does not meet the minimum 4.5 contrast ratio (at 4.27), - // but it's worse with a white foreground (3.67). - // White on 600 does not meet the minimum 4.5 contrast ratio (at 4.31), - // but it's worse with a dark foreground (3.64). - 'contrastStrongLightColors': '600 700 800 900' - }, - 'green': { - '50': '#e8f5e9', - '100': '#c8e6c9', - '200': '#a5d6a7', - '300': '#81c784', - '400': '#66bb6a', - '500': '#4caf50', - '600': '#43a047', - '700': '#388e3c', - '800': '#2e7d32', - '900': '#1b5e20', - 'A100': '#b9f6ca', - 'A200': '#69f0ae', - 'A400': '#00e676', - 'A700': '#00c853', - 'contrastDefaultColor': 'dark', - // White on 700 does not meet the minimum 4.5 contrast ratio (at 4.11), - // but it's worse with a dark foreground (3.81). - 'contrastStrongLightColors': '700 800 900' - }, - 'light-green': { - '50': '#f1f8e9', - '100': '#dcedc8', - '200': '#c5e1a5', - '300': '#aed581', - '400': '#9ccc65', - '500': '#8bc34a', - '600': '#7cb342', - '700': '#689f38', - '800': '#558b2f', - '900': '#33691e', - 'A100': '#ccff90', - 'A200': '#b2ff59', - 'A400': '#76ff03', - 'A700': '#64dd17', - 'contrastDefaultColor': 'dark', - 'contrastStrongLightColors': '800 900' - }, - 'lime': { - '50': '#f9fbe7', - '100': '#f0f4c3', - '200': '#e6ee9c', - '300': '#dce775', - '400': '#d4e157', - '500': '#cddc39', - '600': '#c0ca33', - '700': '#afb42b', - '800': '#9e9d24', - '900': '#827717', - 'A100': '#f4ff81', - 'A200': '#eeff41', - 'A400': '#c6ff00', - 'A700': '#aeea00', - 'contrastDefaultColor': 'dark', - 'contrastStrongLightColors': '900' - }, - 'yellow': { - '50': '#fffde7', - '100': '#fff9c4', - '200': '#fff59d', - '300': '#fff176', - '400': '#ffee58', - '500': '#ffeb3b', - '600': '#fdd835', - '700': '#fbc02d', - '800': '#f9a825', - '900': '#f57f17', - 'A100': '#ffff8d', - 'A200': '#ffff00', - 'A400': '#ffea00', - 'A700': '#ffd600', - 'contrastDefaultColor': 'dark' - }, - 'amber': { - '50': '#fff8e1', - '100': '#ffecb3', - '200': '#ffe082', - '300': '#ffd54f', - '400': '#ffca28', - '500': '#ffc107', - '600': '#ffb300', - '700': '#ffa000', - '800': '#ff8f00', - '900': '#ff6f00', - 'A100': '#ffe57f', - 'A200': '#ffd740', - 'A400': '#ffc400', - 'A700': '#ffab00', - 'contrastDefaultColor': 'dark' - }, - 'orange': { - '50': '#fff3e0', - '100': '#ffe0b2', - '200': '#ffcc80', - '300': '#ffb74d', - '400': '#ffa726', - '500': '#ff9800', - '600': '#fb8c00', - '700': '#f57c00', - '800': '#ef6c00', - '900': '#e65100', - 'A100': '#ffd180', - 'A200': '#ffab40', - 'A400': '#ff9100', - 'A700': '#ff6d00', - 'contrastDefaultColor': 'dark', - 'contrastStrongLightColors': '900' - }, - 'deep-orange': { - '50': '#fbe9e7', - '100': '#ffccbc', - '200': '#ffab91', - '300': '#ff8a65', - '400': '#ff7043', - '500': '#ff5722', - '600': '#f4511e', - '700': '#e64a19', - '800': '#d84315', - '900': '#bf360c', - 'A100': '#ff9e80', - 'A200': '#ff6e40', - 'A400': '#ff3d00', - 'A700': '#dd2c00', - 'contrastDefaultColor': 'dark', - // Dark on 700 does not meet the minimum 4.5 contrast ratio (at 4.01), - // but it's worse with a white foreground (3.91). - // White on 800 does not meet the minimum 4.5 contrast ratio (at 4.43), - // but it's worse with a dark foreground (3.54). - 'contrastStrongLightColors': '800 900 A400 A700', - }, - 'brown': { - '50': '#efebe9', - '100': '#d7ccc8', - '200': '#bcaaa4', - '300': '#a1887f', - '400': '#8d6e63', - '500': '#795548', - '600': '#6d4c41', - '700': '#5d4037', - '800': '#4e342e', - '900': '#3e2723', - 'A100': '#d7ccc8', - 'A200': '#bcaaa4', - 'A400': '#8d6e63', - 'A700': '#5d4037', - 'contrastDefaultColor': 'light', - 'contrastDarkColors': '50 100 200 300 A100 A200', - 'contrastStrongLightColors': '400 500 600 700 800 900 A400 A700' - }, - 'grey': { - '50': '#fafafa', - '100': '#f5f5f5', - '200': '#eeeeee', - '300': '#e0e0e0', - '400': '#bdbdbd', - '500': '#9e9e9e', - '600': '#757575', - '700': '#616161', - '800': '#424242', - '900': '#212121', - 'A100': '#ffffff', - 'A200': '#000000', - 'A400': '#303030', - 'A700': '#616161', - 'contrastDefaultColor': 'dark', - 'contrastLightColors': '700 800 900 A200 A400 A700', - 'contrastStrongLightColors': '600' - }, - 'blue-grey': { - '50': '#eceff1', - '100': '#cfd8dc', - '200': '#b0bec5', - '300': '#90a4ae', - '400': '#78909c', - '500': '#607d8b', - '600': '#546e7a', - '700': '#455a64', - '800': '#37474f', - '900': '#263238', - 'A100': '#cfd8dc', - 'A200': '#b0bec5', - 'A400': '#78909c', - 'A700': '#455a64', - 'contrastDefaultColor': 'light', - 'contrastDarkColors': '50 100 200 300 400 A100 A200 A400', - // White on 500 does not meet the minimum 4.5 contrast ratio (at 4.37), - // but it's worse with a dark foreground. - 'contrastStrongLightColors': '500 600 700 800 900 A700' - } -}); - -})(); -(function(){ -"use strict"; - -(function(angular) { - 'use strict'; -/** - * @ngdoc module - * @name material.core.theming - * @description - * Theming - */ -detectDisabledThemes.$inject = ["$mdThemingProvider"]; -ThemingDirective.$inject = ["$mdTheming", "$interpolate", "$parse", "$mdUtil", "$q", "$log"]; -ThemableDirective.$inject = ["$mdTheming"]; -ThemingProvider.$inject = ["$mdColorPalette", "$$mdMetaProvider"]; -generateAllThemes.$inject = ["$injector", "$mdTheming"]; -angular.module('material.core.theming', ['material.core.theming.palette', 'material.core.meta']) - .directive('mdTheme', ThemingDirective) - .directive('mdThemable', ThemableDirective) - .directive('mdThemesDisabled', disableThemesDirective) - .provider('$mdTheming', ThemingProvider) - .config(detectDisabledThemes) - .run(generateAllThemes); - -/** - * Detect if the HTML or the BODY tags has a [md-themes-disabled] attribute - * If yes, then immediately disable all theme stylesheet generation and DOM injection - */ -/** - * @ngInject - */ -function detectDisabledThemes($mdThemingProvider) { - var isDisabled = !!document.querySelector('[md-themes-disabled]'); - $mdThemingProvider.disableTheming(isDisabled); -} - -/** - * @ngdoc service - * @name $mdThemingProvider - * @module material.core.theming - * - * @description Provider to configure the `$mdTheming` service. - * - * ### Default Theme - * The `$mdThemingProvider` uses by default the following theme configuration: - * - * - Primary Palette: `Blue` - * - Accent Palette: `Pink` - * - Warn Palette: `Deep-Orange` - * - Background Palette: `Grey` - * - * If you don't want to use the `md-theme` directive on the elements itself, you may want to overwrite - * the default theme.
    - * This can be done by using the following markup. - * - * - * myAppModule.config(function($mdThemingProvider) { - * $mdThemingProvider - * .theme('default') - * .primaryPalette('blue') - * .accentPalette('teal') - * .warnPalette('red') - * .backgroundPalette('grey'); - * }); - * - * - - * ### Dynamic Themes - * - * By default, if you change a theme at runtime, the `$mdTheming` service will not detect those changes.
    - * If you have an application, which changes its theme on runtime, you have to enable theme watching. - * - * - * myAppModule.config(function($mdThemingProvider) { - * // Enable theme watching. - * $mdThemingProvider.alwaysWatchTheme(true); - * }); - * - * - * ### Custom Theme Styles - * - * Sometimes you may want to use your own theme styles for some custom components.
    - * You are able to register your own styles by using the following markup. - * - * - * myAppModule.config(function($mdThemingProvider) { - * // Register our custom stylesheet into the theming provider. - * $mdThemingProvider.registerStyles(STYLESHEET); - * }); - * - * - * The `registerStyles` method only accepts strings as value, so you're actually not able to load an external - * stylesheet file into the `$mdThemingProvider`. - * - * If it's necessary to load an external stylesheet, we suggest using a bundler, which supports including raw content, - * like [raw-loader](https://github.com/webpack/raw-loader) for `webpack`. - * - * - * myAppModule.config(function($mdThemingProvider) { - * // Register your custom stylesheet into the theming provider. - * $mdThemingProvider.registerStyles(require('../styles/my-component.theme.css')); - * }); - * - * - * ### Browser color - * - * Enables browser header coloring - * for more info please visit: - * https://developers.google.com/web/fundamentals/design-and-ui/browser-customization/theme-color - * - * Options parameter:
    - * `theme` - A defined theme via `$mdThemeProvider` to use the palettes from. Default is `default` theme.
    - * `palette` - Can be any one of the basic material design palettes, extended defined palettes and 'primary', - * 'accent', 'background' and 'warn'. Default is `primary`.
    - * `hue` - The hue from the selected palette. Default is `800`
    - * - * - * myAppModule.config(function($mdThemingProvider) { - * // Enable browser color - * $mdThemingProvider.enableBrowserColor({ - * theme: 'myTheme', // Default is 'default' - * palette: 'accent', // Default is 'primary', any basic material palette and extended palettes are available - * hue: '200' // Default is '800' - * }); - * }); - * - */ - -/** - * Some Example Valid Theming Expressions - * ======================================= - * - * Intention group expansion: (valid for primary, accent, warn, background) - * - * {{primary-100}} - grab shade 100 from the primary palette - * {{primary-100-0.7}} - grab shade 100, apply opacity of 0.7 - * {{primary-100-contrast}} - grab shade 100's contrast color - * {{primary-hue-1}} - grab the shade assigned to hue-1 from the primary palette - * {{primary-hue-1-0.7}} - apply 0.7 opacity to primary-hue-1 - * {{primary-color}} - Generates .md-hue-1, .md-hue-2, .md-hue-3 with configured shades set for each hue - * {{primary-color-0.7}} - Apply 0.7 opacity to each of the above rules - * {{primary-contrast}} - Generates .md-hue-1, .md-hue-2, .md-hue-3 with configured contrast (ie. text) color shades set for each hue - * {{primary-contrast-0.7}} - Apply 0.7 opacity to each of the above rules - * {{primary-contrast-divider}} - Apply divider opacity to contrast color - * - * Foreground expansion: Applies rgba to black/white foreground text - * - * Old Foreground Expressions: - * {{foreground-1}} - used for primary text - * {{foreground-2}} - used for secondary text/divider - * {{foreground-3}} - used for disabled text - * {{foreground-4}} - used for dividers - * - * New Foreground Expressions: - * - * Apply primary text color for contrasting with default background - * {{background-default-contrast}} - default opacity - * {{background-default-contrast-secondary}} - opacity for secondary text - * {{background-default-contrast-hint}} - opacity for hints and placeholders - * {{background-default-contrast-disabled}} - opacity for disabled text - * {{background-default-contrast-divider}} - opacity for dividers - * - * Apply contrast color for specific shades - * {{background-50-contrast-icon}} - Apply contrast color for icon on background's shade 50 hue - */ - -// In memory generated CSS rules; registered by theme.name -var GENERATED = { }; - -// In memory storage of defined themes and color palettes (both loaded by CSS, and user specified) -var PALETTES; - -// Text colors are automatically generated based on background color when not specified -// Custom palettes can provide override colors -// @see https://material.io/archive/guidelines/style/color.html#color-usability -var DARK_FOREGROUND = { - name: 'dark', -}; -var LIGHT_FOREGROUND = { - name: 'light', -}; - -var DARK_SHADOW = '1px 1px 0px rgba(0,0,0,0.4), -1px -1px 0px rgba(0,0,0,0.4)'; -var LIGHT_SHADOW = ''; - -var DARK_CONTRAST_COLOR = colorToRgbaArray('rgba(0,0,0,0.87)'); -var LIGHT_CONTRAST_COLOR = colorToRgbaArray('rgba(255,255,255,0.87)'); -var STRONG_LIGHT_CONTRAST_COLOR = colorToRgbaArray('rgb(255,255,255)'); - -var THEME_COLOR_TYPES = ['primary', 'accent', 'warn', 'background']; -var DEFAULT_COLOR_TYPE = 'primary'; - -// A color in a theme will use these hues by default, if not specified by user. -var LIGHT_DEFAULT_HUES = { - 'accent': { - 'default': 'A200', - 'hue-1': 'A100', - 'hue-2': 'A400', - 'hue-3': 'A700' - }, - 'background': { - 'default': '50', - 'hue-1': 'A100', - 'hue-2': '100', - 'hue-3': '300' - } -}; - -var DARK_DEFAULT_HUES = { - 'background': { - 'default': 'A400', - 'hue-1': '800', - 'hue-2': '900', - 'hue-3': 'A200' - } -}; - -// Icon opacity values (active/inactive) from -// https://material.io/archive/guidelines/style/color.html#color-usability -var DARK_CONTRAST_OPACITY = { - 'icon': 0.54, - 'secondary': 0.54, - 'disabled': 0.38, - 'hint': 0.38, - 'divider': 0.12, -}; - -var LIGHT_CONTRAST_OPACITY = { - 'icon': 0.87, - 'secondary': 0.7, - 'disabled': 0.5, - 'hint': 0.5, - 'divider': 0.12 -}; - -// Icon opacity values (active/inactive) from -// https://material.io/archive/guidelines/style/color.html#color-usability -var STRONG_LIGHT_CONTRAST_OPACITY = { - 'icon': 1.0, - 'secondary': 0.7, - 'disabled': 0.5, - 'hint': 0.5, - 'divider': 0.12 -}; - -THEME_COLOR_TYPES.forEach(function(colorType) { - // Color types with unspecified default hues will use these default hue values - var defaultDefaultHues = { - 'default': '500', - 'hue-1': '300', - 'hue-2': '800', - 'hue-3': 'A100' - }; - if (!LIGHT_DEFAULT_HUES[colorType]) LIGHT_DEFAULT_HUES[colorType] = defaultDefaultHues; - if (!DARK_DEFAULT_HUES[colorType]) DARK_DEFAULT_HUES[colorType] = defaultDefaultHues; -}); - -var VALID_HUE_VALUES = [ - '50', '100', '200', '300', '400', '500', '600', - '700', '800', '900', 'A100', 'A200', 'A400', 'A700' -]; - -var themeConfig = { - disableTheming : false, // Generate our themes at run time; also disable stylesheet DOM injection - generateOnDemand : false, // Whether or not themes are to be generated on-demand (vs. eagerly). - registeredStyles : [], // Custom styles registered to be used in the theming of custom components. - nonce : null // Nonce to be added as an attribute to the generated themes style tags. -}; - -/** - * - */ -function ThemingProvider($mdColorPalette, $$mdMetaProvider) { - ThemingService.$inject = ["$rootScope", "$mdUtil", "$q", "$log"]; - PALETTES = { }; - var THEMES = { }; - - var themingProvider; - - var alwaysWatchTheme = false; - var defaultTheme = 'default'; - - // Load JS Defined Palettes - angular.extend(PALETTES, $mdColorPalette); - - // Default theme defined in core.js - - /** - * Adds `theme-color` and `msapplication-navbutton-color` meta tags with the color parameter - * @param {string} color Hex value of the wanted browser color - * @returns {function} Remove function of the meta tags - */ - var setBrowserColor = function (color) { - // Chrome, Firefox OS and Opera - var removeChrome = $$mdMetaProvider.setMeta('theme-color', color); - // Windows Phone - var removeWindows = $$mdMetaProvider.setMeta('msapplication-navbutton-color', color); - - return function () { - removeChrome(); - removeWindows(); - }; - }; - - /** - * @ngdoc method - * @name $mdThemingProvider#enableBrowserColor - * @description - * Enables browser header coloring. For more info please visit - * - * Web Fundamentals. - * @param {object=} options Options for the browser color, which include:
    - * - `theme` - `{string}`: A defined theme via `$mdThemeProvider` to use the palettes from. Default is `default` theme.
    - * - `palette` - `{string}`: Can be any one of the basic material design palettes, extended defined palettes, or `primary`, - * `accent`, `background`, and `warn`. Default is `primary`.
    - * - `hue` - `{string}`: The hue from the selected palette. Default is `800`.
    - * @returns {function} Function that removes the browser coloring when called. - */ - var enableBrowserColor = function (options) { - options = angular.isObject(options) ? options : {}; - - var theme = options.theme || 'default'; - var hue = options.hue || '800'; - - var palette = PALETTES[options.palette] || - PALETTES[THEMES[theme].colors[options.palette || 'primary'].name]; - - var color = angular.isObject(palette[hue]) ? palette[hue].hex : palette[hue]; - if (color.substr(0, 1) !== '#') color = '#' + color; - - return setBrowserColor(color); - }; - - return themingProvider = { - definePalette: definePalette, - extendPalette: extendPalette, - theme: registerTheme, - - /** - * return a read-only clone of the current theme configuration - */ - configuration : function() { - return angular.extend({ }, themeConfig, { - defaultTheme : defaultTheme, - alwaysWatchTheme : alwaysWatchTheme, - registeredStyles : [].concat(themeConfig.registeredStyles) - }); - }, - - /** - * @ngdoc method - * @name $mdThemingProvider#disableTheming - * @description - * An easier way to disable theming without having to use `.constant("$MD_THEME_CSS","");`. - * This disables all dynamic theme style sheet generations and injections. - * @param {boolean=} isDisabled Disable all dynamic theme style sheet generations and injections - * if `true` or `undefined`. - */ - disableTheming: function(isDisabled) { - themeConfig.disableTheming = angular.isUndefined(isDisabled) || !!isDisabled; - }, - - /** - * @ngdoc method - * @name $mdThemingProvider#registerStyles - * @param {string} styles The styles to be appended to AngularJS Material's built in theme CSS. - */ - registerStyles: function(styles) { - themeConfig.registeredStyles.push(styles); - }, - - /** - * @ngdoc method - * @name $mdThemingProvider#setNonce - * @param {string} nonceValue The nonce to be added as an attribute to the theme style tags. - * Setting a value allows the use of CSP policy without using the `'unsafe-inline'` directive. - * The string must already be base64 encoded. You can use `btoa(string)` to do this encoding. - * In your CSP's `style-src`, you would then add an entry for `'nonce-nonceValue'`. - */ - setNonce: function(nonceValue) { - themeConfig.nonce = nonceValue; - }, - - generateThemesOnDemand: function(onDemand) { - themeConfig.generateOnDemand = onDemand; - }, - - /** - * @ngdoc method - * @name $mdThemingProvider#setDefaultTheme - * @param {string} theme Default theme name to be applied to elements. - * Default value is `default`. - */ - setDefaultTheme: function(theme) { - defaultTheme = theme; - }, - - /** - * @ngdoc method - * @name $mdThemingProvider#alwaysWatchTheme - * @param {boolean} alwaysWatch Whether or not to always watch themes for changes and re-apply - * classes when they change. Default is `false`. Enabling can reduce performance. - */ - alwaysWatchTheme: function(alwaysWatch) { - alwaysWatchTheme = alwaysWatch; - }, - - enableBrowserColor: enableBrowserColor, - - $get: ThemingService, - _LIGHT_DEFAULT_HUES: LIGHT_DEFAULT_HUES, - _DARK_DEFAULT_HUES: DARK_DEFAULT_HUES, - _PALETTES: PALETTES, - _THEMES: THEMES, - _parseRules: parseRules, - _rgba: rgba - }; - - /** - * @ngdoc method - * @name $mdThemingProvider#definePalette - * @description - * In the event that you need to define a custom color palette, you can use this function to - * make it available to your theme for use in its intention groups.
    - * Note that you must specify all hues in the definition map. - * @param {string} name Name of palette being defined - * @param {object} map Palette definition that includes hue definitions and contrast colors: - * - `'50'` - `{string}`: HEX color - * - `'100'` - `{string}`: HEX color - * - `'200'` - `{string}`: HEX color - * - `'300'` - `{string}`: HEX color - * - `'400'` - `{string}`: HEX color - * - `'500'` - `{string}`: HEX color - * - `'600'` - `{string}`: HEX color - * - `'700'` - `{string}`: HEX color - * - `'800'` - `{string}`: HEX color - * - `'900'` - `{string}`: HEX color - * - `'A100'` - `{string}`: HEX color - * - `'A200'` - `{string}`: HEX color - * - `'A400'` - `{string}`: HEX color - * - `'A700'` - `{string}`: HEX color - * - `'contrastDefaultColor'` - `{string}`: `light` or `dark` - * - `'contrastDarkColors'` - `{string[]}`: Hues which should use dark contrast colors (i.e. raised button text). - * For example: `['50', '100', '200', '300', '400', 'A100']`. - * - `'contrastLightColors'` - `{string[]}`: Hues which should use light contrast colors (i.e. raised button text). - * For example: `['500', '600', '700', '800', '900', 'A200', 'A400', 'A700']`. - */ - function definePalette(name, map) { - map = map || {}; - PALETTES[name] = checkPaletteValid(name, map); - return themingProvider; - } - - /** - * @ngdoc method - * @name $mdThemingProvider#extendPalette - * @description - * Sometimes it is easier to extend an existing color palette and then change a few properties, - * rather than defining a whole new palette. - * @param {string} name Name of palette being extended - * @param {object} map Palette definition that includes optional hue definitions and contrast colors: - * - `'50'` - `{string}`: HEX color - * - `'100'` - `{string}`: HEX color - * - `'200'` - `{string}`: HEX color - * - `'300'` - `{string}`: HEX color - * - `'400'` - `{string}`: HEX color - * - `'500'` - `{string}`: HEX color - * - `'600'` - `{string}`: HEX color - * - `'700'` - `{string}`: HEX color - * - `'800'` - `{string}`: HEX color - * - `'900'` - `{string}`: HEX color - * - `'A100'` - `{string}`: HEX color - * - `'A200'` - `{string}`: HEX color - * - `'A400'` - `{string}`: HEX color - * - `'A700'` - `{string}`: HEX color - * - `'contrastDefaultColor'` - `{string}`: `light` or `dark` - * - `'contrastDarkColors'` - `{string[]}`: Hues which should use dark contrast colors (i.e. raised button text). - * For example: `['50', '100', '200', '300', '400', 'A100']`. - * - `'contrastLightColors'` - `{string[]}`: Hues which should use light contrast colors (i.e. raised button text). - * For example: `['500', '600', '700', '800', '900', 'A200', 'A400', 'A700']`. - * @returns {object} A new object which is a copy of the given palette, `name`, - * with variables from `map` overwritten. - */ - function extendPalette(name, map) { - return checkPaletteValid(name, angular.extend({}, PALETTES[name] || {}, map)); - } - - // Make sure that palette has all required hues - function checkPaletteValid(name, map) { - var missingColors = VALID_HUE_VALUES.filter(function(field) { - return !map[field]; - }); - if (missingColors.length) { - throw new Error("Missing colors %1 in palette %2!" - .replace('%1', missingColors.join(', ')) - .replace('%2', name)); - } - - return map; - } - - /** - * @ngdoc method - * @name $mdThemingProvider#theme - * @description - * Register a theme (which is a collection of color palettes); i.e. `warn`, `accent`, - * `background`, and `primary`.
    - * Optionally inherit from an existing theme. - * @param {string} name Name of theme being registered - * @param {string=} inheritFrom Existing theme name to inherit from - */ - function registerTheme(name, inheritFrom) { - if (THEMES[name]) return THEMES[name]; - - inheritFrom = inheritFrom || 'default'; - - var parentTheme = typeof inheritFrom === 'string' ? THEMES[inheritFrom] : inheritFrom; - var theme = new Theme(name); - - if (parentTheme) { - angular.forEach(parentTheme.colors, function(color, colorType) { - theme.colors[colorType] = { - name: color.name, - // Make sure a COPY of the hues is given to the child color, - // not the same reference. - hues: angular.extend({}, color.hues) - }; - }); - } - THEMES[name] = theme; - - return theme; - } - - function Theme(name) { - var self = this; - self.name = name; - self.colors = {}; - - self.dark = setDark; - setDark(false); - - function setDark(isDark) { - isDark = arguments.length === 0 ? true : !!isDark; - - // If no change, abort - if (isDark === self.isDark) return; - - self.isDark = isDark; - - self.foregroundPalette = self.isDark ? LIGHT_FOREGROUND : DARK_FOREGROUND; - self.foregroundShadow = self.isDark ? DARK_SHADOW : LIGHT_SHADOW; - - // Light and dark themes have different default hues. - // Go through each existing color type for this theme, and for every - // hue value that is still the default hue value from the previous light/dark setting, - // set it to the default hue value from the new light/dark setting. - var newDefaultHues = self.isDark ? DARK_DEFAULT_HUES : LIGHT_DEFAULT_HUES; - var oldDefaultHues = self.isDark ? LIGHT_DEFAULT_HUES : DARK_DEFAULT_HUES; - angular.forEach(newDefaultHues, function(newDefaults, colorType) { - var color = self.colors[colorType]; - var oldDefaults = oldDefaultHues[colorType]; - if (color) { - for (var hueName in color.hues) { - if (color.hues[hueName] === oldDefaults[hueName]) { - color.hues[hueName] = newDefaults[hueName]; - } - } - } - }); - - return self; - } - - THEME_COLOR_TYPES.forEach(function(colorType) { - var defaultHues = (self.isDark ? DARK_DEFAULT_HUES : LIGHT_DEFAULT_HUES)[colorType]; - self[colorType + 'Palette'] = function setPaletteType(paletteName, hues) { - var color = self.colors[colorType] = { - name: paletteName, - hues: angular.extend({}, defaultHues, hues) - }; - - Object.keys(color.hues).forEach(function(name) { - if (!defaultHues[name]) { - throw new Error("Invalid hue name '%1' in theme %2's %3 color %4. Available hue names: %4" - .replace('%1', name) - .replace('%2', self.name) - .replace('%3', paletteName) - .replace('%4', Object.keys(defaultHues).join(', ')) - ); - } - }); - Object.keys(color.hues).map(function(key) { - return color.hues[key]; - }).forEach(function(hueValue) { - if (VALID_HUE_VALUES.indexOf(hueValue) === -1) { - throw new Error("Invalid hue value '%1' in theme %2's %3 color %4. Available hue values: %5" - .replace('%1', hueValue) - .replace('%2', self.name) - .replace('%3', colorType) - .replace('%4', paletteName) - .replace('%5', VALID_HUE_VALUES.join(', ')) - ); - } - }); - return self; - }; - }); - } - - /** - * @ngdoc service - * @name $mdTheming - * @module material.core.theming - * @description - * Service that makes an element apply theming related classes to itself. - * - * For more information on the hue objects, their default values, as well as valid hue values, please visit the custom hues section of Configuring a Theme. - * - * - * // Example component directive that we want to apply theming classes to. - * app.directive('myFancyDirective', function($mdTheming) { - * return { - * restrict: 'AE', - * link: function(scope, element, attrs) { - * // Initialize the service using our directive's element - * $mdTheming(element); - * - * $mdTheming.defineTheme('myTheme', { - * primary: 'blue', - * primaryHues: { - * default: '500', - * hue-1: '300', - * hue-2: '900', - * hue-3: 'A100' - * }, - * accent: 'pink', - * accentHues: { - * default: '600', - * hue-1: '300', - * hue-2: '200', - * hue-3: 'A500' - * }, - * warn: 'red', - * // It's not necessary to specify all hues in the object. - * warnHues: { - * default: '200', - * hue-3: 'A100' - * }, - * // It's not necessary to specify custom hues at all. - * background: 'grey', - * dark: true - * }); - * // Your directive's custom code here. - * } - * }; - * }); - * - * @param {element=} element Element that will have theming classes applied to it. - */ - - /** - * @ngdoc property - * @name $mdTheming#THEMES - * @description - * Property to get all the themes defined - * @returns {object} All the themes defined with their properties. - */ - - /** - * @ngdoc property - * @name $mdTheming#PALETTES - * @description - * Property to get all the palettes defined - * @returns {object} All the palettes defined with their colors. - */ - - /** - * @ngdoc method - * @name $mdTheming#registered - * @description - * Determine is specified theme name is a valid, registered theme - * @param {string} themeName the theme to check if registered - * @returns {boolean} whether the theme is registered or not - */ - - /** - * @ngdoc method - * @name $mdTheming#defaultTheme - * @description - * Returns the default theme - * @returns {string} The default theme - */ - - /** - * @ngdoc method - * @name $mdTheming#generateTheme - * @description - * Lazy generate themes - by default, every theme is generated when defined. - * You can disable this in the configuration section using the - * `$mdThemingProvider.generateThemesOnDemand(true);` - * - * The theme name that is passed in must match the name of the theme that was defined as part of - * the configuration block. - * - * @param {string} name theme name to generate - */ - - /** - * @ngdoc method - * @name $mdTheming#setBrowserColor - * @description - * Enables browser header coloring. For more info please visit - * - * Web Fundamentals. - * @param {object=} options Options for the browser color, which include:
    - * - `theme` - `{string}`: A defined theme via `$mdThemeProvider` to use the palettes from. - * Default is `default` theme.
    - * - `palette` - `{string}`: Can be any one of the basic material design palettes, extended - * defined palettes, or `primary`, `accent`, `background`, and `warn`. Default is `primary`. - *
    - * - `hue` - `{string}`: The hue from the selected palette. Default is `800`.
    - * @returns {function} Function that removes the browser coloring when called. - */ - - /** - * @ngdoc method - * @name $mdTheming#defineTheme - * @description - * Dynamically define a theme by using an options object that contains palette names. - * - * @param {string} name Theme name to define - * @param {object} options Theme definition options - * - * Options are:
    - * - `primary` - `{string}`: The name of the primary palette to use in the theme.
    - * - `primaryHues` - `{object=}`: Override hues for primary palette.
    - * - `accent` - `{string}`: The name of the accent palette to use in the theme.
    - * - `accentHues` - `{object=}`: Override hues for accent palette.
    - * - `warn` - `{string}`: The name of the warn palette to use in the theme.
    - * - `warnHues` - `{object=}`: Override hues for warn palette.
    - * - `background` - `{string}`: The name of the background palette to use in the theme.
    - * - `backgroundHues` - `{object=}`: Override hues for background palette.
    - * - `dark` - `{boolean}`: Indicates if it's a dark theme.
    - * @returns {Promise} A resolved promise with the new theme name. - */ - - /* @ngInject */ - function ThemingService($rootScope, $mdUtil, $q, $log) { - // Allow us to be invoked via a linking function signature. - var applyTheme = function (scope, el) { - if (el === undefined) { el = scope; scope = undefined; } - if (scope === undefined) { scope = $rootScope; } - applyTheme.inherit(el, el); - }; - - Object.defineProperty(applyTheme, 'THEMES', { - get: function () { - return angular.extend({}, THEMES); - } - }); - Object.defineProperty(applyTheme, 'PALETTES', { - get: function () { - return angular.extend({}, PALETTES); - } - }); - Object.defineProperty(applyTheme, 'ALWAYS_WATCH', { - get: function () { - return alwaysWatchTheme; - } - }); - applyTheme.inherit = inheritTheme; - applyTheme.registered = registered; - applyTheme.defaultTheme = function() { return defaultTheme; }; - applyTheme.generateTheme = function(name) { generateTheme(THEMES[name], name, themeConfig.nonce); }; - applyTheme.defineTheme = function(name, options) { - options = options || {}; - - var theme = registerTheme(name); - - if (options.primary) { - theme.primaryPalette(options.primary, options.primaryHues); - } - if (options.accent) { - theme.accentPalette(options.accent, options.accentHues); - } - if (options.warn) { - theme.warnPalette(options.warn, options.warnHues); - } - if (options.background) { - theme.backgroundPalette(options.background, options.backgroundHues); - } - if (options.dark){ - theme.dark(); - } - - this.generateTheme(name); - - return $q.resolve(name); - }; - applyTheme.setBrowserColor = enableBrowserColor; - - return applyTheme; - - /** - * Determine is specified theme name is a valid, registered theme - */ - function registered(themeName) { - if (themeName === undefined || themeName === '') return true; - return applyTheme.THEMES[themeName] !== undefined; - } - - /** - * Get theme name for the element, then update with Theme CSS class - */ - function inheritTheme (el, parent) { - var ctrl = parent.controller('mdTheme') || el.data('$mdThemeController'); - var scope = el.scope(); - - updateThemeClass(lookupThemeName()); - - if (ctrl) { - var watchTheme = alwaysWatchTheme || - ctrl.$shouldWatch || - $mdUtil.parseAttributeBoolean(el.attr('md-theme-watch')); - - if (watchTheme || ctrl.isAsyncTheme) { - var clearNameWatcher = function () { - if (unwatch) { - unwatch(); - unwatch = undefined; - } - }; - - var unwatch = ctrl.registerChanges(function(name) { - updateThemeClass(name); - - if (!watchTheme) { - clearNameWatcher(); - } - }); - - if (scope) { - scope.$on('$destroy', clearNameWatcher); - } else { - el.on('$destroy', clearNameWatcher); - } - } - } - - /** - * Find the theme name from the parent controller or element data - */ - function lookupThemeName() { - // As a few components (dialog) add their controllers later, we should also watch for a controller init. - return ctrl && ctrl.$mdTheme || (defaultTheme === 'default' ? '' : defaultTheme); - } - - /** - * Remove old theme class and apply a new one - * NOTE: if not a valid theme name, then the current name is not changed - */ - function updateThemeClass(theme) { - if (!theme) return; - if (!registered(theme)) { - $log.warn('Attempted to use unregistered theme \'' + theme + '\'. ' + - 'Register it with $mdThemingProvider.theme().'); - } - - var oldTheme = el.data('$mdThemeName'); - if (oldTheme) el.removeClass('md-' + oldTheme +'-theme'); - el.addClass('md-' + theme + '-theme'); - el.data('$mdThemeName', theme); - if (ctrl) { - el.data('$mdThemeController', ctrl); - } - } - } - - } -} - -function ThemingDirective($mdTheming, $interpolate, $parse, $mdUtil, $q, $log) { - return { - priority: 101, // has to be more than 100 to be before interpolation (issue on IE) - link: { - pre: function(scope, el, attrs) { - var registeredCallbacks = []; - - var startSymbol = $interpolate.startSymbol(); - var endSymbol = $interpolate.endSymbol(); - - var theme = attrs.mdTheme.trim(); - - var hasInterpolation = - theme.substr(0, startSymbol.length) === startSymbol && - theme.lastIndexOf(endSymbol) === theme.length - endSymbol.length; - - var oneTimeOperator = '::'; - var oneTimeBind = attrs.mdTheme - .split(startSymbol).join('') - .split(endSymbol).join('') - .trim() - .substr(0, oneTimeOperator.length) === oneTimeOperator; - - var getTheme = function () { - var interpolation = $interpolate(attrs.mdTheme)(scope); - return $parse(interpolation)(scope) || interpolation; - }; - - var ctrl = { - isAsyncTheme: angular.isFunction(getTheme()) || angular.isFunction(getTheme().then), - registerChanges: function (cb, context) { - if (context) { - cb = angular.bind(context, cb); - } - - registeredCallbacks.push(cb); - - return function () { - var index = registeredCallbacks.indexOf(cb); - - if (index > -1) { - registeredCallbacks.splice(index, 1); - } - }; - }, - $setTheme: function (theme) { - if (!$mdTheming.registered(theme)) { - $log.warn('attempted to use unregistered theme \'' + theme + '\''); - } - - ctrl.$mdTheme = theme; - - // Iterating backwards to support unregistering during iteration - // http://stackoverflow.com/a/9882349/890293 - // we don't use `reverse()` of array because it mutates the array and we don't want it - // to get re-indexed - for (var i = registeredCallbacks.length; i--;) { - registeredCallbacks[i](theme); - } - }, - $shouldWatch: $mdUtil.parseAttributeBoolean(el.attr('md-theme-watch')) || - $mdTheming.ALWAYS_WATCH || - (hasInterpolation && !oneTimeBind) - }; - - el.data('$mdThemeController', ctrl); - - var setParsedTheme = function (theme) { - if (typeof theme === 'string') { - return ctrl.$setTheme(theme); - } - - $q.when(angular.isFunction(theme) ? theme() : theme) - .then(function(name) { - ctrl.$setTheme(name); - }); - }; - - setParsedTheme(getTheme()); - - var unwatch = scope.$watch(getTheme, function(theme) { - if (theme) { - setParsedTheme(theme); - - if (!ctrl.$shouldWatch) { - unwatch(); - } - } - }); - } - } - }; -} - -/** - * Special directive that will disable ALL runtime Theme style generation and DOM injection - * - * - * - * - * - * ... - * - * - * Note: Using md-themes-css directive requires the developer to load external - * theme stylesheets; e.g. custom themes from Material-Tools: - * - * `angular-material.themes.css` - * - * Another option is to use the ThemingProvider to configure and disable the attribute - * conversions; this would obviate the use of the `md-themes-css` directive - * - */ -function disableThemesDirective() { - themeConfig.disableTheming = true; - - // Return a 1x-only, first-match attribute directive - return { - restrict : 'A', - priority : '900' - }; -} - -function ThemableDirective($mdTheming) { - return $mdTheming; -} - -function parseRules(theme, colorType, rules) { - checkValidPalette(theme, colorType); - - rules = rules.replace(/THEME_NAME/g, theme.name); - var themeNameRegex = new RegExp('\\.md-' + theme.name + '-theme', 'g'); - // Matches '{{ primary-color }}', etc - var hueRegex = new RegExp('([\'"])?{{\\s*([a-zA-Z]+)-?(color|default)?-?(contrast)?-?((?:\\d\\.?\\d*)|(?:[a-zA-Z]+))?\\s*}}(["\'])?','g'); - var simpleVariableRegex = /'?"?{{\s*([a-zA-Z]+)-(A?\d+|hue-[0-3]|shadow|default)-?(contrast)?-?((?:\d\.?\d*)|(?:[a-zA-Z]+))?\s*}}'?"?/g; - var defaultBgHue = theme.colors['background'].hues['default']; - var defaultBgContrastType = PALETTES[theme.colors['background'].name][defaultBgHue].contrastType; - - // find and replace simple variables where we use a specific hue, not an entire palette - // eg. "{{primary-100}}" - // \(' + THEME_COLOR_TYPES.join('\|') + '\)' - rules = rules.replace(simpleVariableRegex, function(match, colorType, hue, contrast, opacity) { - var regexColorType = colorType; - if (colorType === 'foreground') { - if (hue === 'shadow') { - return theme.foregroundShadow; - } else if (theme.foregroundPalette[hue]) { - // Use user defined palette number (ie: foreground-2) - return rgba(colorToRgbaArray(theme.foregroundPalette[hue])); - } else if (theme.foregroundPalette['1']){ - return rgba(colorToRgbaArray(theme.foregroundPalette['1'])); - } - // Default to background-default-contrast-{opacity} - colorType = 'background'; - contrast = 'contrast'; - if (!opacity && hue) { - // Convert references to legacy hues to opacities (i.e. foreground-4 to *-divider) - switch (hue) { - // hue-1 uses default opacity - case '2': - opacity = 'secondary'; - break; - case '3': - opacity = 'disabled'; - break; - case '4': - opacity = 'divider'; - } - } - hue = 'default'; - } - - // `default` is also accepted as a hue-value, because the background palettes are - // using it as a name for the default hue. - if (hue.indexOf('hue') === 0 || hue === 'default') { - hue = theme.colors[colorType].hues[hue]; - } - - var colorDetails = (PALETTES[ theme.colors[colorType].name ][hue] || ''); - - // If user has specified a foreground color, use those - if (colorType === 'background' && contrast && regexColorType !== 'foreground' && - colorDetails.contrastType === defaultBgContrastType) { - // Don't process if colorType was changed - switch (opacity) { - case 'secondary': - case 'icon': - if (theme.foregroundPalette['2']) { - return rgba(colorToRgbaArray(theme.foregroundPalette['2'])); - } - break; - case 'disabled': - case 'hint': - if (theme.foregroundPalette['3']) { - return rgba(colorToRgbaArray(theme.foregroundPalette['3'])); - } - break; - case 'divider': - if (theme.foregroundPalette['4']) { - return rgba(colorToRgbaArray(theme.foregroundPalette['4'])); - } - break; - default: - if (theme.foregroundPalette['1']) { - return rgba(colorToRgbaArray(theme.foregroundPalette['1'])); - } - break; - } - } - - if (contrast && opacity) { - opacity = colorDetails.opacity[opacity] || opacity; - } - - return rgba(colorDetails[contrast ? 'contrast' : 'value'], opacity); - }); - - var generatedRules = []; - - // For each type, generate rules for each hue (ie. default, md-hue-1, md-hue-2, md-hue-3) - angular.forEach(['default', 'hue-1', 'hue-2', 'hue-3'], function(hueName) { - var newRule = rules - .replace(hueRegex, function(match, _, matchedColorType, hueType, contrast, opacity) { - var color = theme.colors[matchedColorType]; - var palette = PALETTES[color.name]; - var hueValue = color.hues[hueName]; - if (contrast && opacity) { - opacity = palette[hueValue].opacity[opacity] || opacity; - } - return rgba(palette[hueValue][hueType === 'color' ? 'value' : 'contrast'], opacity); - }); - if (hueName !== 'default') { - newRule = newRule.replace(themeNameRegex, '.md-' + theme.name + '-theme.md-' + hueName); - } - - // Don't apply a selector rule to the default theme, making it easier to override - // styles of the base-component - if (theme.name === 'default') { - var themeRuleRegex = /((?:\s|>|\.|\w|-|:|\(|\)|\[|]|"|'|=)*)\.md-default-theme((?:\s|>|\.|\w|-|:|\(|\)|\[|]|"|'|=)*)/g; - - newRule = newRule.replace(themeRuleRegex, function(match, start, end) { - return match + ', ' + start + end; - }); - } - generatedRules.push(newRule); - }); - - return generatedRules; -} - -var rulesByType = {}; - -// Generate our themes at run time given the state of THEMES and PALETTES -function generateAllThemes($injector, $mdTheming) { - var head = document.head; - var firstChild = head ? head.firstElementChild : null; - var themeCss = !themeConfig.disableTheming && $injector.has('$MD_THEME_CSS') ? $injector.get('$MD_THEME_CSS') : ''; - - // Append our custom registered styles to the theme stylesheet. - themeCss += themeConfig.registeredStyles.join(''); - - if (!firstChild) return; - if (themeCss.length === 0) return; // no rules, so no point in running this expensive task - - // Expose contrast colors for palettes to ensure that text is always readable - angular.forEach(PALETTES, sanitizePalette); - - // MD_THEME_CSS is a string generated by the build process that includes all the themeable - // components as templates - - // Break the CSS into individual rules - var rules = splitCss(themeCss).map(function(rule) { - return rule.trim(); - }); - - THEME_COLOR_TYPES.forEach(function(type) { - rulesByType[type] = ''; - }); - - // Sort the rules based on type, allowing us to do color substitution on a per-type basis - rules.forEach(function(rule) { - // First: test that if the rule has '.md-accent', it goes into the accent set of rules - for (var i = 0, type; type = THEME_COLOR_TYPES[i]; i++) { - if (rule.indexOf('.md-' + type) > -1) { - return rulesByType[type] += rule; - } - } - - // If no eg 'md-accent' class is found, try to just find 'accent' in the rule and guess from - // there - for (i = 0; type = THEME_COLOR_TYPES[i]; i++) { - if (rule.indexOf(type) > -1) { - return rulesByType[type] += rule; - } - } - - // Default to the primary array - return rulesByType[DEFAULT_COLOR_TYPE] += rule; - }); - - // If themes are being generated on-demand, quit here. The user will later manually - // call generateTheme to do this on a theme-by-theme basis. - if (themeConfig.generateOnDemand) return; - - angular.forEach($mdTheming.THEMES, function(theme) { - if (!GENERATED[theme.name] && !($mdTheming.defaultTheme() !== 'default' && theme.name === 'default')) { - generateTheme(theme, theme.name, themeConfig.nonce); - } - }); - - - // ************************* - // Internal functions - // ************************* - - /** - * The user specifies a 'default' contrast color as either light or dark, then explicitly lists - * which hues are the opposite contrast (eg. A100 has dark, A200 has light). - * @param {!object} palette to sanitize - */ - function sanitizePalette(palette) { - var defaultContrast = palette.contrastDefaultColor; - var lightColors = palette.contrastLightColors || []; - var strongLightColors = palette.contrastStrongLightColors || []; - var darkColors = palette.contrastDarkColors || []; - - // These colors are provided as space-separated lists - if (typeof lightColors === 'string') lightColors = lightColors.split(' '); - if (typeof strongLightColors === 'string') strongLightColors = strongLightColors.split(' '); - if (typeof darkColors === 'string') darkColors = darkColors.split(' '); - - // Cleanup after ourselves - delete palette.contrastDefaultColor; - delete palette.contrastLightColors; - delete palette.contrastStrongLightColors; - delete palette.contrastDarkColors; - - /** - * @param {string} hueName - * @return {'dark'|'light'|'strongLight'} - */ - function getContrastType(hueName) { - if (defaultContrast === 'light' ? darkColors.indexOf(hueName) !== -1 : - (lightColors.indexOf(hueName) === -1 && strongLightColors.indexOf(hueName) === -1)) { - return 'dark'; - } - if (strongLightColors.indexOf(hueName) !== -1) { - return 'strongLight'; - } - return 'light'; - } - - /** - * @param {'dark'|'light'|'strongLight'} contrastType - * @return {[number, number, number]} [red, green, blue] array - */ - function getContrastColor(contrastType) { - switch (contrastType) { - default: - case 'strongLight': - return STRONG_LIGHT_CONTRAST_COLOR; - case 'light': - return LIGHT_CONTRAST_COLOR; - case 'dark': - return DARK_CONTRAST_COLOR; - } - } - - /** - * @param {'dark'|'light'|'strongLight'} contrastType - * @return {{secondary: number, divider: number, hint: number, icon: number, disabled: number}} - */ - function getOpacityValues(contrastType) { - switch (contrastType) { - default: - case 'strongLight': - return STRONG_LIGHT_CONTRAST_OPACITY; - case 'light': - return LIGHT_CONTRAST_OPACITY; - case 'dark': - return DARK_CONTRAST_OPACITY; - } - } - // Change { 'A100': '#fffeee' } to { 'A100': { value: '#fffeee', contrast:DARK_CONTRAST_COLOR } - angular.forEach(palette, function(hueValue, hueName) { - if (angular.isObject(hueValue)) return; // Already converted - // Map everything to rgb colors - var rgbValue = colorToRgbaArray(hueValue); - if (!rgbValue) { - throw new Error("Color %1, in palette %2's hue %3, is invalid. Hex or rgb(a) color expected." - .replace('%1', hueValue) - .replace('%2', palette.name) - .replace('%3', hueName)); - } - - var contrastType = getContrastType(hueName); - palette[hueName] = { - hex: palette[hueName], - value: rgbValue, - contrastType: contrastType, - contrast: getContrastColor(contrastType), - opacity: getOpacityValues(contrastType) - }; - }); - } - - /** - * @param {string} themeCss - * @returns {[]} a string representing a CSS file that is split, producing an array with a rule - * at each index. - */ - function splitCss(themeCss) { - var result = []; - var currentRule = ''; - var openedCurlyBrackets = 0; - var closedCurlyBrackets = 0; - - for (var i = 0; i < themeCss.length; i++) { - var character = themeCss.charAt(i); - - // Check for content in quotes - if (character === '\'' || character === '"') { - // Append text in quotes to current rule - var textInQuotes = themeCss.substring(i, themeCss.indexOf(character, i + 1)); - currentRule += textInQuotes; - - // Jump to the closing quote char - i += textInQuotes.length; - } else { - currentRule += character; - - if (character === '}') { - closedCurlyBrackets++; - if (closedCurlyBrackets === openedCurlyBrackets) { - closedCurlyBrackets = 0; - openedCurlyBrackets = 0; - result.push(currentRule); - currentRule = ''; - } - } else if (character === '{') { - openedCurlyBrackets++; - } - } - } - // Add comments added after last valid rule. - if (currentRule !== '') { - result.push(currentRule); - } - - return result; - } -} - -function generateTheme(theme, name, nonce) { - var head = document.head; - var firstChild = head ? head.firstElementChild : null; - - if (!GENERATED[name]) { - // For each theme, use the color palettes specified for - // `primary`, `warn` and `accent` to generate CSS rules. - THEME_COLOR_TYPES.forEach(function(colorType) { - var styleStrings = parseRules(theme, colorType, rulesByType[colorType]); - while (styleStrings.length) { - var styleContent = styleStrings.shift(); - if (styleContent) { - var style = document.createElement('style'); - style.setAttribute('md-theme-style', ''); - if (nonce) { - style.setAttribute('nonce', nonce); - } - style.appendChild(document.createTextNode(styleContent)); - head.insertBefore(style, firstChild); - } - } - }); - - GENERATED[theme.name] = true; - } - -} - - -function checkValidPalette(theme, colorType) { - // If theme attempts to use a palette that doesnt exist, throw error - if (!PALETTES[ (theme.colors[colorType] || {}).name ]) { - throw new Error( - "You supplied an invalid color palette for theme %1's %2 palette. Available palettes: %3" - .replace('%1', theme.name) - .replace('%2', colorType) - .replace('%3', Object.keys(PALETTES).join(', ')) - ); - } -} - -/** - * @param {string} clr rbg or rgba color - * @return {number[]|undefined} [red, green, blue] array if it can be computed - */ -function colorToRgbaArray(clr) { - if (angular.isArray(clr) && clr.length === 3) return clr; - if (/^rgb/.test(clr)) { - return clr.replace(/(^\s*rgba?\(|\)\s*$)/g, '').split(',').map(function(value, i) { - return i === 3 ? parseFloat(value) : parseInt(value, 10); - }); - } - if (clr.charAt(0) === '#') clr = clr.substring(1); - if (!/^([a-fA-F0-9]{3}){1,2}$/g.test(clr)) return; - - var dig = clr.length / 3; - var red = clr.substr(0, dig); - var grn = clr.substr(dig, dig); - var blu = clr.substr(dig * 2); - if (dig === 1) { - red += red; - grn += grn; - blu += blu; - } - return [parseInt(red, 16), parseInt(grn, 16), parseInt(blu, 16)]; -} - -function rgba(rgbArray, opacity) { - if (!rgbArray) return "rgb('0,0,0')"; - - if (rgbArray.length === 4) { - rgbArray = angular.copy(rgbArray); - opacity ? rgbArray.pop() : opacity = rgbArray.pop(); - } - return opacity && (typeof opacity == 'number' || (typeof opacity == 'string' && opacity.length)) ? - 'rgba(' + rgbArray.join(',') + ',' + opacity + ')' : - 'rgb(' + rgbArray.join(',') + ')'; -} - - -})(window.angular); - -})(); -(function(){ -"use strict"; - -/** - * @ngdoc module - * @name material.components.autocomplete - */ -/* - * @see js folder for autocomplete implementation - */ -angular.module('material.components.autocomplete', [ - 'material.core', - 'material.components.icon', - 'material.components.virtualRepeat' -]); - -})(); -(function(){ -"use strict"; - - -MdAutocompleteCtrl.$inject = ["$scope", "$element", "$mdUtil", "$mdConstant", "$mdTheming", "$window", "$animate", "$rootElement", "$attrs", "$q", "$log", "$mdLiveAnnouncer"];angular - .module('material.components.autocomplete') - .controller('MdAutocompleteCtrl', MdAutocompleteCtrl); - -var ITEM_HEIGHT = 48, - MAX_ITEMS = 5, - MENU_PADDING = 8, - INPUT_PADDING = 2, // Padding provided by `md-input-container` - MODE_STANDARD = 'standard', - MODE_VIRTUAL = 'virtual'; - -function MdAutocompleteCtrl ($scope, $element, $mdUtil, $mdConstant, $mdTheming, $window, - $animate, $rootElement, $attrs, $q, $log, $mdLiveAnnouncer) { - - // Internal Variables. - var ctrl = this, - itemParts = $scope.itemsExpr.split(/ in /i), - itemExpr = itemParts[ 1 ], - elements = null, - cache = {}, - noBlur = false, - selectedItemWatchers = [], - hasFocus = false, - fetchesInProgress = 0, - enableWrapScroll = null, - inputModelCtrl = null, - debouncedOnResize = $mdUtil.debounce(onWindowResize), - mode = MODE_VIRTUAL; // default - - /** - * The root document element. This is used for attaching a top-level click handler to - * close the options panel when a click outside said panel occurs. We use `documentElement` - * instead of body because, when scrolling is disabled, some browsers consider the body element - * to be completely off the screen and propagate events directly to the html element. - * @type {!Object} angular.JQLite - */ - ctrl.documentElement = angular.element(document.documentElement); - - // Public Exported Variables with handlers - defineProperty('hidden', handleHiddenChange, true); - - // Public Exported Variables - ctrl.scope = $scope; - ctrl.parent = $scope.$parent; - ctrl.itemName = itemParts[0]; - ctrl.matches = []; - ctrl.loading = false; - ctrl.hidden = true; - ctrl.index = -1; - ctrl.activeOption = null; - ctrl.id = $mdUtil.nextUid(); - ctrl.isDisabled = null; - ctrl.isRequired = null; - ctrl.isReadonly = null; - ctrl.hasNotFound = false; - ctrl.selectedMessage = $scope.selectedMessage || 'selected'; - ctrl.noMatchMessage = $scope.noMatchMessage || 'There are no matches available.'; - ctrl.singleMatchMessage = $scope.singleMatchMessage || 'There is 1 match available.'; - ctrl.multipleMatchStartMessage = $scope.multipleMatchStartMessage || 'There are '; - ctrl.multipleMatchEndMessage = $scope.multipleMatchEndMessage || ' matches available.'; - ctrl.defaultEscapeOptions = 'clear'; - - // Public Exported Methods - ctrl.keydown = keydown; - ctrl.blur = blur; - ctrl.focus = focus; - ctrl.clear = clearValue; - ctrl.select = select; - ctrl.listEnter = onListEnter; - ctrl.listLeave = onListLeave; - ctrl.focusInput = focusInputElement; - ctrl.getCurrentDisplayValue = getCurrentDisplayValue; - ctrl.registerSelectedItemWatcher = registerSelectedItemWatcher; - ctrl.unregisterSelectedItemWatcher = unregisterSelectedItemWatcher; - ctrl.notFoundVisible = notFoundVisible; - ctrl.loadingIsVisible = loadingIsVisible; - ctrl.positionDropdown = positionDropdown; - - /** - * Report types to be used for the $mdLiveAnnouncer - * @enum {number} Unique flag id. - */ - var ReportType = { - Count: 1, - Selected: 2 - }; - - return init(); - - // initialization methods - - /** - * Initialize the controller, setup watchers, gather elements - */ - function init () { - - $mdUtil.initOptionalProperties($scope, $attrs, { - searchText: '', - selectedItem: null, - clearButton: false, - disableVirtualRepeat: false, - }); - - $mdTheming($element); - configureWatchers(); - $mdUtil.nextTick(function () { - - gatherElements(); - moveDropdown(); - - // Touch devices often do not send a click event on tap. We still want to focus the input - // and open the options pop-up in these cases. - $element.on('touchstart', focusInputElement); - - // Forward all focus events to the input element when autofocus is enabled - if ($scope.autofocus) { - $element.on('focus', focusInputElement); - } - if ($scope.inputAriaDescribedBy) { - elements.input.setAttribute('aria-describedby', $scope.inputAriaDescribedBy); - } - if (!$scope.floatingLabel) { - if ($scope.inputAriaLabel) { - elements.input.setAttribute('aria-label', $scope.inputAriaLabel); - } else if ($scope.inputAriaLabelledBy) { - elements.input.setAttribute('aria-labelledby', $scope.inputAriaLabelledBy); - } else if ($scope.placeholder) { - // If no aria-label or aria-labelledby references are defined, then just label using the - // placeholder. - elements.input.setAttribute('aria-label', $scope.placeholder); - } - } - }); - } - - function updateModelValidators() { - if (!$scope.requireMatch || !inputModelCtrl) return; - - inputModelCtrl.$setValidity('md-require-match', !!$scope.selectedItem || !$scope.searchText); - } - - /** - * Calculates the dropdown's position and applies the new styles to the menu element - * @returns {*} - */ - function positionDropdown () { - if (!elements) { - return $mdUtil.nextTick(positionDropdown, false, $scope); - } - - var dropdownHeight = ($scope.dropdownItems || MAX_ITEMS) * ITEM_HEIGHT; - var hrect = elements.wrap.getBoundingClientRect(), - vrect = elements.snap.getBoundingClientRect(), - root = elements.root.getBoundingClientRect(), - top = vrect.bottom - root.top, - bot = root.bottom - vrect.top, - left = hrect.left - root.left, - width = hrect.width, - offset = getVerticalOffset(), - position = $scope.dropdownPosition, - styles, enoughBottomSpace, enoughTopSpace; - var bottomSpace = root.bottom - vrect.bottom - MENU_PADDING + $mdUtil.getViewportTop(); - var topSpace = vrect.top - MENU_PADDING; - - // Automatically determine dropdown placement based on available space in viewport. - if (!position) { - enoughTopSpace = topSpace > dropdownHeight; - enoughBottomSpace = bottomSpace > dropdownHeight; - if (enoughBottomSpace) { - position = 'bottom'; - } else if (enoughTopSpace) { - position = 'top'; - } else { - position = topSpace > bottomSpace ? 'top' : 'bottom'; - } - } - // Adjust the width to account for the padding provided by `md-input-container` - if ($attrs.mdFloatingLabel) { - left += INPUT_PADDING; - width -= INPUT_PADDING * 2; - } - styles = { - left: left + 'px', - minWidth: width + 'px', - maxWidth: Math.max(hrect.right - root.left, root.right - hrect.left) - MENU_PADDING + 'px' - }; - - if (position === 'top') { - styles.top = 'auto'; - styles.bottom = bot + 'px'; - styles.maxHeight = Math.min(dropdownHeight, topSpace) + 'px'; - } else { - bottomSpace = root.bottom - hrect.bottom - MENU_PADDING + $mdUtil.getViewportTop(); - - styles.top = (top - offset) + 'px'; - styles.bottom = 'auto'; - styles.maxHeight = Math.min(dropdownHeight, bottomSpace) + 'px'; - } - - elements.$.scrollContainer.css(styles); - $mdUtil.nextTick(correctHorizontalAlignment, false, $scope); - - /** - * Calculates the vertical offset for floating label examples to account for ngMessages - * @returns {number} - */ - function getVerticalOffset () { - var offset = 0; - var inputContainer = $element.find('md-input-container'); - if (inputContainer.length) { - var input = inputContainer.find('input'); - offset = inputContainer.prop('offsetHeight'); - offset -= input.prop('offsetTop'); - offset -= input.prop('offsetHeight'); - // add in the height left up top for the floating label text - offset += inputContainer.prop('offsetTop'); - } - return offset; - } - - /** - * Makes sure that the menu doesn't go off of the screen on either side. - */ - function correctHorizontalAlignment () { - var dropdown = elements.scrollContainer.getBoundingClientRect(), - styles = {}; - if (dropdown.right > root.right) { - styles.left = (hrect.right - dropdown.width) + 'px'; - } - elements.$.scrollContainer.css(styles); - } - } - - /** - * Moves the dropdown menu to the body tag in order to avoid z-index and overflow issues. - */ - function moveDropdown () { - if (!elements.$.root.length) return; - $mdTheming(elements.$.scrollContainer); - elements.$.scrollContainer.detach(); - elements.$.root.append(elements.$.scrollContainer); - if ($animate.pin) $animate.pin(elements.$.scrollContainer, $rootElement); - } - - /** - * Sends focus to the input element. - */ - function focusInputElement () { - elements.input.focus(); - } - - /** - * Update the activeOption based on the selected item in the listbox. - * The activeOption is used in the template to set the aria-activedescendant attribute, which - * enables screen readers to properly handle visual focus within the listbox and announce the - * item's place in the list. I.e. "List item 3 of 50". Anytime that `ctrl.index` changes, this - * function needs to be called to update the activeOption. - */ - function updateActiveOption() { - var selectedOption = elements.scroller.querySelector('.selected'); - if (selectedOption) { - ctrl.activeOption = selectedOption.id; - } else { - ctrl.activeOption = null; - } - } - - /** - * Sets up any watchers used by autocomplete - */ - function configureWatchers () { - var wait = parseInt($scope.delay, 10) || 0; - - $attrs.$observe('disabled', function (value) { ctrl.isDisabled = $mdUtil.parseAttributeBoolean(value, false); }); - $attrs.$observe('required', function (value) { ctrl.isRequired = $mdUtil.parseAttributeBoolean(value, false); }); - $attrs.$observe('readonly', function (value) { ctrl.isReadonly = $mdUtil.parseAttributeBoolean(value, false); }); - - $scope.$watch('searchText', wait ? $mdUtil.debounce(handleSearchText, wait) : handleSearchText); - $scope.$watch('selectedItem', selectedItemChange); - - angular.element($window).on('resize', debouncedOnResize); - - $scope.$on('$destroy', cleanup); - } - - /** - * Removes any events or leftover elements created by this controller - */ - function cleanup () { - if (!ctrl.hidden) { - $mdUtil.enableScrolling(); - } - - angular.element($window).off('resize', debouncedOnResize); - - if (elements){ - var items = ['ul', 'scroller', 'scrollContainer', 'input']; - angular.forEach(items, function(key){ - elements.$[key].remove(); - }); - } - } - - /** - * Event handler to be called whenever the window resizes. - */ - function onWindowResize() { - if (!ctrl.hidden) { - positionDropdown(); - } - } - - /** - * Gathers all of the elements needed for this controller - */ - function gatherElements () { - - var snapWrap = gatherSnapWrap(); - - elements = { - main: $element[0], - scrollContainer: $element[0].querySelector('.md-virtual-repeat-container, .md-standard-list-container'), - scroller: $element[0].querySelector('.md-virtual-repeat-scroller, .md-standard-list-scroller'), - ul: $element.find('ul')[0], - input: $element.find('input')[0], - wrap: snapWrap.wrap, - snap: snapWrap.snap, - root: document.body, - }; - - elements.li = elements.ul.getElementsByTagName('li'); - elements.$ = getAngularElements(elements); - mode = elements.scrollContainer.classList.contains('md-standard-list-container') ? MODE_STANDARD : MODE_VIRTUAL; - inputModelCtrl = elements.$.input.controller('ngModel'); - } - - /** - * Gathers the snap and wrap elements - * - */ - function gatherSnapWrap() { - var element; - var value; - for (element = $element; element.length; element = element.parent()) { - value = element.attr('md-autocomplete-snap'); - if (angular.isDefined(value)) break; - } - - if (element.length) { - return { - snap: element[0], - wrap: (value.toLowerCase() === 'width') ? element[0] : $element.find('md-autocomplete-wrap')[0] - }; - } - - var wrap = $element.find('md-autocomplete-wrap')[0]; - return { - snap: wrap, - wrap: wrap - }; - } - - /** - * Gathers angular-wrapped versions of each element - * @param elements - * @returns {{}} - */ - function getAngularElements (elements) { - var obj = {}; - for (var key in elements) { - if (elements.hasOwnProperty(key)) obj[ key ] = angular.element(elements[ key ]); - } - return obj; - } - - // event/change handlers - - /** - * @param {Event} $event - */ - function preventDefault($event) { - $event.preventDefault(); - } - - /** - * @param {Event} $event - */ - function stopPropagation($event) { - $event.stopPropagation(); - } - - /** - * Handles changes to the `hidden` property. - * @param {boolean} hidden true to hide the options pop-up, false to show it. - * @param {boolean} oldHidden the previous value of hidden - */ - function handleHiddenChange (hidden, oldHidden) { - var scrollContainerElement; - - if (elements) { - scrollContainerElement = angular.element(elements.scrollContainer); - } - if (!hidden && oldHidden) { - positionDropdown(); - - // Report in polite mode, because the screen reader should finish the default description of - // the input element. - reportMessages(true, ReportType.Count | ReportType.Selected); - - if (elements) { - $mdUtil.disableScrollAround(elements.scrollContainer); - enableWrapScroll = disableElementScrollEvents(elements.wrap); - if ($mdUtil.isIos) { - ctrl.documentElement.on('touchend', handleTouchOutsidePanel); - if (scrollContainerElement) { - scrollContainerElement.on('touchstart touchmove touchend', stopPropagation); - } - } - ctrl.index = getDefaultIndex(); - $mdUtil.nextTick(function() { - updateActiveOption(); - updateScroll(); - }); - } - } else if (hidden && !oldHidden) { - if ($mdUtil.isIos) { - ctrl.documentElement.off('touchend', handleTouchOutsidePanel); - if (scrollContainerElement) { - scrollContainerElement.off('touchstart touchmove touchend', stopPropagation); - } - } - $mdUtil.enableScrolling(); - - if (enableWrapScroll) { - enableWrapScroll(); - enableWrapScroll = null; - } - } - } - - /** - * Handling touch events that bubble up to the document is required for closing the dropdown - * panel on touch outside of the options pop-up panel on iOS. - * @param {Event} $event - */ - function handleTouchOutsidePanel($event) { - ctrl.hidden = true; - // iOS does not blur the pop-up for touches on the scroll mask, so we have to do it. - doBlur(true); - } - - /** - * Disables scrolling for a specific element. - * @param {!string|!DOMElement} element to disable scrolling - * @return {Function} function to call to re-enable scrolling for the element - */ - function disableElementScrollEvents(element) { - var elementToDisable = angular.element(element); - elementToDisable.on('wheel touchmove', preventDefault); - - return function() { - elementToDisable.off('wheel touchmove', preventDefault); - }; - } - - /** - * When the user mouses over the dropdown menu, ignore blur events. - */ - function onListEnter () { - noBlur = true; - } - - /** - * When the user's mouse leaves the menu, blur events may hide the menu again. - */ - function onListLeave () { - if (!hasFocus && !ctrl.hidden) elements.input.focus(); - noBlur = false; - ctrl.hidden = shouldHide(); - } - - /** - * Handles changes to the selected item. - * @param selectedItem - * @param previousSelectedItem - */ - function selectedItemChange (selectedItem, previousSelectedItem) { - - updateModelValidators(); - - if (selectedItem) { - getDisplayValue(selectedItem).then(function (val) { - $scope.searchText = val; - handleSelectedItemChange(selectedItem, previousSelectedItem); - }); - } else if (previousSelectedItem && $scope.searchText) { - getDisplayValue(previousSelectedItem).then(function(displayValue) { - // Clear the searchText, when the selectedItem is set to null. - // Do not clear the searchText, when the searchText isn't matching with the previous - // selected item. - if (angular.isString($scope.searchText) - && displayValue.toString().toLowerCase() === $scope.searchText.toLowerCase()) { - $scope.searchText = ''; - } - }); - } - - if (selectedItem !== previousSelectedItem) { - announceItemChange(); - } - } - - /** - * Use the user-defined expression to announce changes each time a new item is selected - */ - function announceItemChange () { - angular.isFunction($scope.itemChange) && - $scope.itemChange(getItemAsNameVal($scope.selectedItem)); - } - - /** - * Use the user-defined expression to announce changes each time the search text is changed - */ - function announceTextChange () { - angular.isFunction($scope.textChange) && $scope.textChange(); - } - - /** - * Calls any external watchers listening for the selected item. Used in conjunction with - * `registerSelectedItemWatcher`. - * @param selectedItem - * @param previousSelectedItem - */ - function handleSelectedItemChange (selectedItem, previousSelectedItem) { - selectedItemWatchers.forEach(function (watcher) { - watcher(selectedItem, previousSelectedItem); - }); - } - - /** - * Register a function to be called when the selected item changes. - * @param cb - */ - function registerSelectedItemWatcher (cb) { - if (selectedItemWatchers.indexOf(cb) === -1) { - selectedItemWatchers.push(cb); - } - } - - /** - * Unregister a function previously registered for selected item changes. - * @param cb - */ - function unregisterSelectedItemWatcher (cb) { - var i = selectedItemWatchers.indexOf(cb); - if (i !== -1) { - selectedItemWatchers.splice(i, 1); - } - } - - /** - * Handles changes to the searchText property. - * @param {string} searchText - * @param {string} previousSearchText - */ - function handleSearchText (searchText, previousSearchText) { - ctrl.index = getDefaultIndex(); - - // do nothing on init - if (searchText === previousSearchText) return; - - updateModelValidators(); - - getDisplayValue($scope.selectedItem).then(function (val) { - // clear selected item if search text no longer matches it - if (searchText !== val) { - $scope.selectedItem = null; - - // trigger change event if available - if (searchText !== previousSearchText) { - announceTextChange(); - } - - // cancel results if search text is not long enough - if (!isMinLengthMet()) { - ctrl.matches = []; - - setLoading(false); - reportMessages(true, ReportType.Count); - - } else { - handleQuery(); - } - } - }); - - } - - /** - * Handles input blur event, determines if the dropdown should hide. - * @param {Event=} $event - */ - function blur($event) { - hasFocus = false; - - if (!noBlur) { - ctrl.hidden = shouldHide(); - evalAttr('ngBlur', { $event: $event }); - } else if (angular.isObject($event)) { - $event.stopImmediatePropagation(); - } - } - - /** - * Force blur on input element - * @param {boolean} forceBlur - */ - function doBlur(forceBlur) { - if (forceBlur) { - noBlur = false; - hasFocus = false; - } - elements.input.blur(); - } - - /** - * Handles input focus event, determines if the dropdown should show. - */ - function focus($event) { - hasFocus = true; - - if (isSearchable() && isMinLengthMet()) { - handleQuery(); - } - - ctrl.hidden = shouldHide(); - - evalAttr('ngFocus', { $event: $event }); - } - - /** - * Handles keyboard input. - * @param event - */ - function keydown (event) { - switch (event.keyCode) { - case $mdConstant.KEY_CODE.DOWN_ARROW: - if (ctrl.loading || hasSelection()) return; - event.stopPropagation(); - event.preventDefault(); - ctrl.index = ctrl.index + 1 > ctrl.matches.length - 1 ? 0 : Math.min(ctrl.index + 1, ctrl.matches.length - 1); - $mdUtil.nextTick(updateActiveOption); - updateScroll(); - break; - case $mdConstant.KEY_CODE.UP_ARROW: - if (ctrl.loading || hasSelection()) return; - event.stopPropagation(); - event.preventDefault(); - ctrl.index = ctrl.index - 1 < 0 ? ctrl.matches.length - 1 : Math.max(0, ctrl.index - 1); - $mdUtil.nextTick(updateActiveOption); - updateScroll(); - break; - case $mdConstant.KEY_CODE.TAB: - // If we hit tab, assume that we've left the list so it will close - onListLeave(); - - if (ctrl.hidden || ctrl.loading || ctrl.index < 0 || ctrl.matches.length < 1) return; - select(ctrl.index); - break; - case $mdConstant.KEY_CODE.ENTER: - if (ctrl.hidden || ctrl.loading || ctrl.index < 0 || ctrl.matches.length < 1) return; - if (hasSelection()) return; - event.stopImmediatePropagation(); - event.preventDefault(); - select(ctrl.index); - break; - case $mdConstant.KEY_CODE.ESCAPE: - event.preventDefault(); // Prevent browser from always clearing input - if (!shouldProcessEscape()) return; - event.stopPropagation(); - - clearSelectedItem(); - if ($scope.searchText && hasEscapeOption('clear')) { - clearSearchText(); - } - - // Manually hide (needed for mdNotFound support) - ctrl.hidden = true; - - if (hasEscapeOption('blur')) { - // Force the component to blur if they hit escape - doBlur(true); - } - - break; - default: - } - } - - // getters - - /** - * Returns the minimum length needed to display the dropdown. - * @returns {*} - */ - function getMinLength () { - return angular.isNumber($scope.minLength) ? $scope.minLength : 1; - } - - /** - * Returns the display value for an item. - * @param {*} item - * @returns {*} - */ - function getDisplayValue (item) { - return $q.when(getItemText(item) || item).then(function(itemText) { - if (itemText && !angular.isString(itemText)) { - $log.warn('md-autocomplete: Could not resolve display value to a string. ' + - 'Please check the `md-item-text` attribute.'); - } - - return itemText; - }); - - /** - * Getter function to invoke user-defined expression (in the directive) - * to convert your object to a single string. - * @param {*} item - * @returns {string|null} - */ - function getItemText (item) { - return (item && $scope.itemText) ? $scope.itemText(getItemAsNameVal(item)) : null; - } - } - - /** - * Returns the locals object for compiling item templates. - * @param {*} item - * @returns {Object|undefined} - */ - function getItemAsNameVal (item) { - if (!item) { - return undefined; - } - - var locals = {}; - if (ctrl.itemName) { - locals[ ctrl.itemName ] = item; - } - - return locals; - } - - /** - * Returns the default index based on whether or not autoselect is enabled. - * @returns {number} 0 if autoselect is enabled, -1 if not. - */ - function getDefaultIndex () { - return $scope.autoselect ? 0 : -1; - } - - /** - * Sets the loading parameter and updates the hidden state. - * @param value {boolean} Whether or not the component is currently loading. - */ - function setLoading(value) { - if (ctrl.loading !== value) { - ctrl.loading = value; - } - - // Always refresh the hidden variable as something else might have changed - ctrl.hidden = shouldHide(); - } - - /** - * Determines if the menu should be hidden. - * @returns {boolean} true if the menu should be hidden - */ - function shouldHide () { - return !shouldShow(); - } - - /** - * Determines whether the autocomplete is able to query within the current state. - * @returns {boolean} true if the query can be run - */ - function isSearchable() { - if (ctrl.loading && !hasMatches()) { - // No query when query is in progress. - return false; - } else if (hasSelection()) { - // No query if there is already a selection - return false; - } - else if (!hasFocus) { - // No query if the input does not have focus - return false; - } - return true; - } - - /** - * @returns {boolean} if the escape keydown should be processed, return true. - * Otherwise return false. - */ - function shouldProcessEscape() { - return hasEscapeOption('blur') || !ctrl.hidden || ctrl.loading || hasEscapeOption('clear') && $scope.searchText; - } - - /** - * @param {string} option check if this option is set - * @returns {boolean} if the specified escape option is set, return true. Return false otherwise. - */ - function hasEscapeOption(option) { - if (!angular.isString($scope.escapeOptions)) { - return ctrl.defaultEscapeOptions.indexOf(option) !== -1; - } else { - return $scope.escapeOptions.toLowerCase().indexOf(option) !== -1; - } - } - - /** - * Determines if the menu should be shown. - * @returns {boolean} true if the menu should be shown - */ - function shouldShow() { - if (ctrl.isReadonly) { - // Don't show if read only is set - return false; - } else if (!isSearchable()) { - // Don't show if a query is in progress, there is already a selection, - // or the input is not focused. - return false; - } - return (isMinLengthMet() && hasMatches()) || notFoundVisible(); - } - - /** - * @returns {boolean} true if the search text has matches. - */ - function hasMatches() { - return ctrl.matches.length ? true : false; - } - - /** - * @returns {boolean} true if the autocomplete has a valid selection. - */ - function hasSelection() { - return ctrl.scope.selectedItem ? true : false; - } - - /** - * @returns {boolean} true if the loading indicator is, or should be, visible. - */ - function loadingIsVisible() { - return ctrl.loading && !hasSelection(); - } - - /** - * @returns {*} the display value of the current item. - */ - function getCurrentDisplayValue () { - return getDisplayValue(ctrl.matches[ ctrl.index ]); - } - - /** - * Determines if the minimum length is met by the search text. - * @returns {*} true if the minimum length is met by the search text - */ - function isMinLengthMet () { - return ($scope.searchText || '').length >= getMinLength(); - } - - // actions - - /** - * Defines a public property with a handler and a default value. - * @param {string} key - * @param {Function} handler function - * @param {*} defaultValue default value - */ - function defineProperty (key, handler, defaultValue) { - Object.defineProperty(ctrl, key, { - get: function () { return defaultValue; }, - set: function (newValue) { - var oldValue = defaultValue; - defaultValue = newValue; - handler(newValue, oldValue); - } - }); - } - - /** - * Selects the item at the given index. - * @param {number} index to select - */ - function select (index) { - // force form to update state for validation - $mdUtil.nextTick(function () { - getDisplayValue(ctrl.matches[ index ]).then(function (val) { - var ngModel = elements.$.input.controller('ngModel'); - $mdLiveAnnouncer.announce(val + ' ' + ctrl.selectedMessage, 'assertive'); - ngModel.$setViewValue(val); - ngModel.$render(); - }).finally(function () { - $scope.selectedItem = ctrl.matches[ index ]; - setLoading(false); - }); - }, false); - } - - /** - * Clears the searchText value and selected item. - * @param {Event} $event - */ - function clearValue ($event) { - if ($event) { - $event.stopPropagation(); - } - clearSelectedItem(); - clearSearchText(); - } - - /** - * Clears the selected item - */ - function clearSelectedItem () { - // Reset our variables - ctrl.index = -1; - $mdUtil.nextTick(updateActiveOption); - ctrl.matches = []; - } - - /** - * Clears the searchText value - */ - function clearSearchText () { - // Set the loading to true so we don't see flashes of content. - // The flashing will only occur when an async request is running. - // So the loading process will stop when the results had been retrieved. - setLoading(true); - - $scope.searchText = ''; - - // Normally, triggering the change / input event is unnecessary, because the browser detects it properly. - // But some browsers are not detecting it properly, which means that we have to trigger the event. - // Using the `input` is not working properly, because for example IE11 is not supporting the `input` event. - // The `change` event is a good alternative and is supported by all supported browsers. - var eventObj = document.createEvent('CustomEvent'); - eventObj.initCustomEvent('change', true, true, { value: '' }); - elements.input.dispatchEvent(eventObj); - - // For some reason, firing the above event resets the value of $scope.searchText if - // $scope.searchText has a space character at the end, so we blank it one more time and then - // focus. - elements.input.blur(); - $scope.searchText = ''; - elements.input.focus(); - } - - /** - * Fetches the results for the provided search text. - * @param searchText - */ - function fetchResults (searchText) { - var items = $scope.$parent.$eval(itemExpr), - term = searchText.toLowerCase(), - isList = angular.isArray(items), - isPromise = !!items.then; // Every promise should contain a `then` property - - if (isList) onResultsRetrieved(items); - else if (isPromise) handleAsyncResults(items); - - function handleAsyncResults(items) { - if (!items) return; - - items = $q.when(items); - fetchesInProgress++; - setLoading(true); - - $mdUtil.nextTick(function () { - items - .then(onResultsRetrieved) - .finally(function(){ - if (--fetchesInProgress === 0) { - setLoading(false); - } - }); - },true, $scope); - } - - function onResultsRetrieved(matches) { - cache[term] = matches; - - // Just cache the results if the request is now outdated. - // The request becomes outdated, when the new searchText has changed during the result fetching. - if ((searchText || '') !== ($scope.searchText || '')) { - return; - } - - handleResults(matches); - } - } - - - /** - * Reports given message types to supported screen readers. - * @param {boolean} isPolite Whether the announcement should be polite. - * @param {!number} types Message flags to be reported to the screen reader. - */ - function reportMessages(isPolite, types) { - var politeness = isPolite ? 'polite' : 'assertive'; - var messages = []; - - if (types & ReportType.Selected && ctrl.index !== -1) { - messages.push(getCurrentDisplayValue()); - } - - if (types & ReportType.Count) { - messages.push($q.resolve(getCountMessage())); - } - - $q.all(messages).then(function(data) { - $mdLiveAnnouncer.announce(data.join(' '), politeness); - }); - } - - /** - * @returns {string} the ARIA message for how many results match the current query. - */ - function getCountMessage () { - switch (ctrl.matches.length) { - case 0: - return ctrl.noMatchMessage; - case 1: - return ctrl.singleMatchMessage; - default: - return ctrl.multipleMatchStartMessage + ctrl.matches.length + ctrl.multipleMatchEndMessage; - } - } - - /** - * Makes sure that the focused element is within view. - */ - function updateScroll () { - if (!elements.li[0]) return; - if (mode === MODE_STANDARD) { - updateStandardScroll(); - } else { - updateVirtualScroll(); - } - } - - function updateVirtualScroll() { - // elements in virtual scroll have consistent heights - var optionHeight = elements.li[0].offsetHeight, - top = optionHeight * Math.max(0, ctrl.index), - bottom = top + optionHeight, - containerHeight = elements.scroller.clientHeight, - scrollTop = elements.scroller.scrollTop; - - if (top < scrollTop) { - scrollTo(top); - } else if (bottom > scrollTop + containerHeight) { - scrollTo(bottom - containerHeight); - } - } - - function updateStandardScroll() { - // elements in standard scroll have variable heights - var selected = elements.li[Math.max(0, ctrl.index)]; - var containerHeight = elements.scrollContainer.offsetHeight, - top = selected && selected.offsetTop || 0, - bottom = top + selected.clientHeight, - scrollTop = elements.scrollContainer.scrollTop; - - if (top < scrollTop) { - scrollTo(top); - } else if (bottom > scrollTop + containerHeight) { - scrollTo(bottom - containerHeight); - } - } - - function isPromiseFetching() { - return fetchesInProgress !== 0; - } - - function scrollTo (offset) { - if (mode === MODE_STANDARD) { - elements.scrollContainer.scrollTop = offset; - } else { - elements.$.scrollContainer.controller('mdVirtualRepeatContainer').scrollTo(offset); - } - } - - function notFoundVisible () { - var textLength = (ctrl.scope.searchText || '').length; - - return ctrl.hasNotFound && !hasMatches() && (!ctrl.loading || isPromiseFetching()) && textLength >= getMinLength() && (hasFocus || noBlur) && !hasSelection(); - } - - /** - * Starts the query to gather the results for the current searchText. Attempts to return cached - * results first, then forwards the process to `fetchResults` if necessary. - */ - function handleQuery () { - var searchText = $scope.searchText || ''; - var term = searchText.toLowerCase(); - - // If caching is enabled and the current searchText is stored in the cache - if (!$scope.noCache && cache[term]) { - // The results should be handled as same as a normal un-cached request does. - handleResults(cache[term]); - } else { - fetchResults(searchText); - } - - ctrl.hidden = shouldHide(); - } - - /** - * Handles the retrieved results by showing them in the autocompletes dropdown. - * @param results Retrieved results - */ - function handleResults(results) { - ctrl.matches = results; - ctrl.hidden = shouldHide(); - - // If loading is in progress, then we'll end the progress. This is needed for example, - // when the `clear` button was clicked, because there we always show the loading process, to prevent flashing. - if (ctrl.loading) setLoading(false); - - if ($scope.selectOnMatch) selectItemOnMatch(); - - positionDropdown(); - reportMessages(true, ReportType.Count); - } - - /** - * If there is only one matching item and the search text matches its display value exactly, - * automatically select that item. Note: This function is only called if the user uses the - * `md-select-on-match` flag. - */ - function selectItemOnMatch () { - var searchText = $scope.searchText, - matches = ctrl.matches, - item = matches[ 0 ]; - if (matches.length === 1) getDisplayValue(item).then(function (displayValue) { - var isMatching = searchText === displayValue; - if ($scope.matchInsensitive && !isMatching) { - isMatching = searchText.toLowerCase() === displayValue.toLowerCase(); - } - - if (isMatching) { - select(0); - } - }); - } - - /** - * Evaluates an attribute expression against the parent scope. - * @param {String} attr Name of the attribute to be evaluated. - * @param {Object?} locals Properties to be injected into the evaluation context. - */ - function evalAttr(attr, locals) { - if ($attrs[attr]) { - $scope.$parent.$eval($attrs[attr], locals || {}); - } - } - -} - -})(); -(function(){ -"use strict"; - - -MdAutocomplete.$inject = ["$$mdSvgRegistry"];angular - .module('material.components.autocomplete') - .directive('mdAutocomplete', MdAutocomplete); - -/** - * @ngdoc directive - * @name mdAutocomplete - * @module material.components.autocomplete - * - * @description - * `` is a special input component with a drop-down of all possible matches to a - * custom query. This component allows you to provide real-time suggestions as the user types - * in the input area. - * - * To start, you will need to specify the required parameters and provide a template for your - * results. The content inside `md-autocomplete` will be treated as a template. - * - * In more complex cases, you may want to include other content such as a message to display when - * no matches were found. You can do this by wrapping your template in `md-item-template` and - * adding a tag for `md-not-found`. An example of this is shown below. - * - * To reset the displayed value you must clear both values for `md-search-text` and - * `md-selected-item`. - * - * ### Validation - * - * You can use `ng-messages` to include validation the same way that you would normally validate; - * however, if you want to replicate a standard input with a floating label, you will have to - * do the following: - * - * - Make sure that your template is wrapped in `md-item-template` - * - Add your `ng-messages` code inside of `md-autocomplete` - * - Add your validation properties to `md-autocomplete` (ie. `required`) - * - Add a `name` to `md-autocomplete` (to be used on the generated `input`) - * - * There is an example below of how this should look. - * - * ### Snapping Drop-Down - * - * You can cause the autocomplete drop-down to snap to an ancestor element by applying the - * `md-autocomplete-snap` attribute to that element. You can also snap to the width of - * the `md-autocomplete-snap` element by setting the attribute's value to `width` - * (ie. `md-autocomplete-snap="width"`). - * - * ### Notes - * - * **Autocomplete Dropdown Items Rendering** - * - * The `md-autocomplete` uses the the - * mdVirtualRepeat directive for displaying the results inside of the dropdown.
    - * - * > When encountering issues regarding the item template please take a look at the - * VirtualRepeatContainer documentation. - * - * **Autocomplete inside of a Virtual Repeat** - * - * When using the `md-autocomplete` directive inside of a - * VirtualRepeatContainer the dropdown items - * might not update properly, because caching of the results is enabled by default. - * - * The autocomplete will then show invalid dropdown items, because the Virtual Repeat only updates - * the scope bindings rather than re-creating the `md-autocomplete`. This means that the previous - * cached results will be used. - * - * > To avoid such problems, ensure that the autocomplete does not cache any results via - * `md-no-cache="true"`: - * - * - * - * {{ item.display }} - * - * - * - * - * @param {expression} md-items An expression in the format of `item in results` to iterate over - * matches for your search.

    - * The `results` expression can be also a function, which returns the results synchronously - * or asynchronously (per Promise). - * @param {expression=} md-selected-item-change An expression to be run each time a new item is - * selected. - * @param {expression=} md-search-text-change An expression to be run each time the search text - * updates. - * @param {expression=} md-search-text A model to bind the search query text to. - * @param {object=} md-selected-item A model to bind the selected item to. - * @param {expression=} md-item-text An expression that will convert your object to a single string. - * @param {string=} placeholder Placeholder text that will be forwarded to the input. - * @param {boolean=} md-no-cache Disables the internal caching that happens in autocomplete. - * @param {boolean=} ng-disabled Determines whether or not to disable the input field. - * @param {boolean=} md-require-match When set to true, the autocomplete will add a validator, - * which will evaluate to false, when no item is currently selected. - * @param {number=} md-min-length Specifies the minimum length of text before autocomplete will - * make suggestions. - * @param {number=} md-delay Specifies the amount of time (in milliseconds) to wait before looking - * for results. - * @param {boolean=} md-clear-button Whether the clear button for the autocomplete input should show - * up or not. When `md-floating-label` is set, defaults to false, defaults to true otherwise. - * @param {boolean=} md-autofocus If true, the autocomplete will be automatically focused when a - * `$mdDialog`, `$mdBottomsheet` or `$mdSidenav`, which contains the autocomplete, is opening. - *

    - * Also the autocomplete will immediately focus the input element. - * @param {boolean=} md-no-asterisk When present, asterisk will not be appended to the floating - * label. - * @param {boolean=} md-autoselect If set to true, the first item will be automatically selected - * in the dropdown upon open. - * @param {string=} md-input-name The name attribute given to the input element to be used with - * FormController. - * @param {string=} md-menu-class This class will be applied to the dropdown menu for styling. - * @param {string=} md-menu-container-class This class will be applied to the parent container - * of the dropdown panel. - * @param {string=} md-input-class This will be applied to the input for styling. This attribute - * is only valid when a `md-floating-label` is defined. - * @param {string=} md-floating-label This will add a floating label to autocomplete and wrap it in - * `md-input-container`. - * @param {string=} md-select-on-focus When present the input's text will be automatically selected - * on focus. - * @param {string=} md-input-id An ID to be added to the input element. - * @param {number=} md-input-minlength The minimum length for the input's value for validation. - * @param {number=} md-input-maxlength The maximum length for the input's value for validation. - * @param {boolean=} md-select-on-match When set, autocomplete will automatically select - * the item if the search text is an exact match.

    - * An exact match is when only one match is displayed. - * @param {boolean=} md-match-case-insensitive When set and using `md-select-on-match`, autocomplete - * will select on case-insensitive match. - * @param {string=} md-escape-options Override escape key logic. Default is `clear`.
    - * Options: `blur`, `clear`, `none`. - * @param {string=} md-dropdown-items Specifies the maximum amount of items to be shown in - * the dropdown.

    - * When the dropdown doesn't fit into the viewport, the dropdown will shrink - * as much as possible. - * @param {string=} md-dropdown-position Overrides the default dropdown position. Options: `top`, - * `bottom`. - * @param {string=} input-aria-describedby A space-separated list of element IDs. This should - * contain the IDs of any elements that describe this autocomplete. Screen readers will read the - * content of these elements at the end of announcing that the autocomplete has been selected - * and describing its current state. The descriptive elements do not need to be visible on the - * page. - * @param {string=} input-aria-labelledby A space-separated list of element IDs. The ideal use case - * is that this would contain the ID of a `
    ' : ''; - } - - function getRepeatType(repeatMode) { - return isVirtualRepeatDisabled(repeatMode) ? - 'ng-repeat' : 'md-virtual-repeat'; - } - - function isVirtualRepeatDisabled(repeatMode) { - // ensure we have a valid repeat mode - var correctedRepeatMode = getRepeatMode(repeatMode); - return correctedRepeatMode !== REPEAT_VIRTUAL; - } - - function getInputElement () { - if (attr.mdFloatingLabel) { - return '\ - \ - \ - \ -
    ' + leftover + '
    \ -
    '; - } else { - return '\ - '; - } - } - - function getClearButton() { - return '' + - ''; - } - } - }; -} - -})(); -(function(){ -"use strict"; - - -MdAutocompleteItemScopeDirective.$inject = ["$compile", "$mdUtil"];angular - .module('material.components.autocomplete') - .directive('mdAutocompleteParentScope', MdAutocompleteItemScopeDirective); - -function MdAutocompleteItemScopeDirective($compile, $mdUtil) { - return { - restrict: 'AE', - compile: compile, - terminal: true, - transclude: 'element' - }; - - function compile(tElement, tAttr, transclude) { - return function postLink(scope, element, attr) { - var ctrl = scope.$mdAutocompleteCtrl; - var newScope = ctrl.parent.$new(); - var itemName = ctrl.itemName; - - // Watch for changes to our scope's variables and copy them to the new scope - watchVariable('$index', '$index'); - watchVariable('item', itemName); - - // Ensure that $digest calls on our scope trigger $digest on newScope. - connectScopes(); - - // Link the element against newScope. - transclude(newScope, function(clone) { - element.after(clone); - }); - - /** - * Creates a watcher for variables that are copied from the parent scope - * @param variable - * @param alias - */ - function watchVariable(variable, alias) { - newScope[alias] = scope[variable]; - - scope.$watch(variable, function(value) { - $mdUtil.nextTick(function() { - newScope[alias] = value; - }); - }); - } - - /** - * Creates watchers on scope and newScope that ensure that for any - * $digest of scope, newScope is also $digested. - */ - function connectScopes() { - var scopeDigesting = false; - var newScopeDigesting = false; - - scope.$watch(function() { - if (newScopeDigesting || scopeDigesting) { - return; - } - - scopeDigesting = true; - scope.$$postDigest(function() { - if (!newScopeDigesting) { - newScope.$digest(); - } - - scopeDigesting = newScopeDigesting = false; - }); - }); - - newScope.$watch(function() { - newScopeDigesting = true; - }); - } - }; - } -} -})(); -(function(){ -"use strict"; - - -MdHighlightCtrl.$inject = ["$scope", "$element", "$attrs", "$mdUtil"];angular - .module('material.components.autocomplete') - .controller('MdHighlightCtrl', MdHighlightCtrl); - -function MdHighlightCtrl ($scope, $element, $attrs, $mdUtil) { - this.$scope = $scope; - this.$element = $element; - this.$attrs = $attrs; - this.$mdUtil = $mdUtil; - - // Cache the Regex to avoid rebuilding each time. - this.regex = null; -} - -MdHighlightCtrl.prototype.init = function(unsafeTermFn, unsafeContentFn) { - - this.flags = this.$attrs.mdHighlightFlags || ''; - - this.unregisterFn = this.$scope.$watch(function($scope) { - return { - term: unsafeTermFn($scope), - contentText: unsafeContentFn($scope) - }; - }.bind(this), this.onRender.bind(this), true); - - this.$element.on('$destroy', this.unregisterFn); -}; - -/** - * Triggered once a new change has been recognized and the highlighted - * text needs to be updated. - */ -MdHighlightCtrl.prototype.onRender = function(state, prevState) { - - var contentText = state.contentText; - - /* Update the regex if it's outdated, because we don't want to rebuilt it constantly. */ - if (this.regex === null || state.term !== prevState.term) { - this.regex = this.createRegex(state.term, this.flags); - } - - /* If a term is available apply the regex to the content */ - if (state.term) { - this.applyRegex(contentText); - } else { - this.$element.text(contentText); - } - -}; - -/** - * Decomposes the specified text into different tokens (whether match or not). - * Breaking down the string guarantees proper XSS protection due to the native browser - * escaping of unsafe text. - */ -MdHighlightCtrl.prototype.applyRegex = function(text) { - var tokens = this.resolveTokens(text); - - this.$element.empty(); - - tokens.forEach(function (token) { - - if (token.isMatch) { - var tokenEl = angular.element('').text(token.text); - - this.$element.append(tokenEl); - } else { - this.$element.append(document.createTextNode(token)); - } - - }.bind(this)); - -}; - - /** - * Decomposes the specified text into different tokens by running the regex against the text. - */ -MdHighlightCtrl.prototype.resolveTokens = function(string) { - var tokens = []; - var lastIndex = 0; - - // Use replace here, because it supports global and single regular expressions at same time. - string.replace(this.regex, function(match, index) { - appendToken(lastIndex, index); - - tokens.push({ - text: match, - isMatch: true - }); - - lastIndex = index + match.length; - }); - - // Append the missing text as a token. - appendToken(lastIndex); - - return tokens; - - function appendToken(from, to) { - var targetText = string.slice(from, to); - targetText && tokens.push(targetText); - } -}; - -/** Creates a regex for the specified text with the given flags. */ -MdHighlightCtrl.prototype.createRegex = function(term, flags) { - var startFlag = '', endFlag = ''; - var regexTerm = this.$mdUtil.sanitize(term); - - if (flags.indexOf('^') >= 0) startFlag = '^'; - if (flags.indexOf('$') >= 0) endFlag = '$'; - - return new RegExp(startFlag + regexTerm + endFlag, flags.replace(/[$^]/g, '')); -}; - -})(); -(function(){ -"use strict"; - - -MdHighlight.$inject = ["$interpolate", "$parse"];angular - .module('material.components.autocomplete') - .directive('mdHighlightText', MdHighlight); - -/** - * @ngdoc directive - * @name mdHighlightText - * @module material.components.autocomplete - * - * @description - * The `md-highlight-text` directive allows you to specify text that should be highlighted within - * an element. Highlighted text will be wrapped in `` which can - * be styled through CSS. Please note that child elements may not be used with this directive. - * - * @param {string} md-highlight-text A model to be searched for - * @param {string=} md-highlight-flags A list of flags (loosely based on JavaScript RexExp flags). - * #### **Supported flags**: - * - `g`: Find all matches within the provided text - * - `i`: Ignore case when searching for matches - * - `$`: Only match if the text ends with the search term - * - `^`: Only match if the text begins with the search term - * - * @usage - * - * - *
      - *
    • - * {{result.text}} - *
    • - *
    - *
    - */ - -function MdHighlight ($interpolate, $parse) { - return { - terminal: true, - controller: 'MdHighlightCtrl', - compile: function mdHighlightCompile(tElement, tAttr) { - var termExpr = $parse(tAttr.mdHighlightText); - var unsafeContentExpr = $interpolate(tElement.html()); - - return function mdHighlightLink(scope, element, attr, ctrl) { - ctrl.init(termExpr, unsafeContentExpr); - }; - } - }; -} - -})(); -(function(){ -"use strict"; - -/* - * @ngdoc module - * @name material.components.backdrop - * @description Backdrop - */ - -/** - * @ngdoc directive - * @name mdBackdrop - * @module material.components.backdrop - * - * @restrict E - * - * @description - * `` is a backdrop element used by other components, such as dialog and bottom sheet. - * Apply class `opaque` to make the backdrop use the theme backdrop color. - * - */ - -angular - .module('material.components.backdrop', ['material.core']) - .directive('mdBackdrop', ["$mdTheming", "$mdUtil", "$animate", "$rootElement", "$window", "$log", "$$rAF", "$document", function BackdropDirective($mdTheming, $mdUtil, $animate, $rootElement, $window, $log, $$rAF, $document) { - var ERROR_CSS_POSITION = ' may not work properly in a scrolled, static-positioned parent container.'; - - return { - restrict: 'E', - link: postLink - }; - - function postLink(scope, element, attrs) { - // backdrop may be outside the $rootElement, tell ngAnimate to animate regardless - if ($animate.pin) $animate.pin(element, $rootElement); - - var bodyStyles; - - $$rAF(function() { - // If body scrolling has been disabled using mdUtil.disableBodyScroll(), - // adjust the 'backdrop' height to account for the fixed 'body' top offset. - // Note that this can be pretty expensive and is better done inside the $$rAF. - bodyStyles = $window.getComputedStyle($document[0].body); - - if (bodyStyles.position === 'fixed') { - var resizeHandler = $mdUtil.debounce(function(){ - bodyStyles = $window.getComputedStyle($document[0].body); - resize(); - }, 60, null, false); - - resize(); - angular.element($window).on('resize', resizeHandler); - - scope.$on('$destroy', function() { - angular.element($window).off('resize', resizeHandler); - }); - } - - // Often $animate.enter() is used to append the backDrop element - // so let's wait until $animate is done... - var parent = element.parent(); - - if (parent.length) { - if (parent[0].nodeName === 'BODY') { - element.css('position', 'fixed'); - } - - var styles = $window.getComputedStyle(parent[0]); - - if (styles.position === 'static') { - // backdrop uses position:absolute and will not work properly with parent position:static (default) - $log.warn(ERROR_CSS_POSITION); - } - - // Only inherit the parent if the backdrop has a parent. - $mdTheming.inherit(element, parent); - } - }); - - function resize() { - var viewportHeight = parseInt(bodyStyles.height, 10) + Math.abs(parseInt(bodyStyles.top, 10)); - element.css('height', viewportHeight + 'px'); - } - } - - }]); - -})(); -(function(){ -"use strict"; - -/** - * @ngdoc module - * @name material.components.bottomSheet - * @description - * BottomSheet - */ -MdBottomSheetDirective.$inject = ["$mdBottomSheet"]; -MdBottomSheetProvider.$inject = ["$$interimElementProvider"]; -angular - .module('material.components.bottomSheet', [ - 'material.core', - 'material.components.backdrop' - ]) - .directive('mdBottomSheet', MdBottomSheetDirective) - .provider('$mdBottomSheet', MdBottomSheetProvider); - -/* @ngInject */ -function MdBottomSheetDirective($mdBottomSheet) { - return { - restrict: 'E', - link : function postLink(scope, element) { - element.addClass('_md'); // private md component indicator for styling - - // When navigation force destroys an interimElement, then - // listen and $destroy() that interim instance... - scope.$on('$destroy', function() { - $mdBottomSheet.destroy(); - }); - } - }; -} - - -/** - * @ngdoc service - * @name $mdBottomSheet - * @module material.components.bottomSheet - * - * @description - * `$mdBottomSheet` opens a bottom sheet over the app and provides a simple promise API. - * - * ## Restrictions - * - * - The bottom sheet's template must have an outer `` element. - * - Add the `md-grid` class to the bottom sheet for a grid layout. - * - Add the `md-list` class to the bottom sheet for a list layout. - * - * @usage - * - *
    - * - * Open a Bottom Sheet! - * - *
    - *
    - * - * var app = angular.module('app', ['ngMaterial']); - * app.controller('MyController', function($scope, $mdBottomSheet) { - * $scope.openBottomSheet = function() { - * $mdBottomSheet.show({ - * template: '' + - * 'Hello! Close' + - * '' - * }) - * - * // Fires when the hide() method is used - * .then(function() { - * console.log('You clicked the button to close the bottom sheet!'); - * }) - * - * // Fires when the cancel() method is used - * .catch(function() { - * console.log('You hit escape or clicked the backdrop to close.'); - * }); - * }; - * - * $scope.closeBottomSheet = function($scope, $mdBottomSheet) { - * $mdBottomSheet.hide(); - * } - * - * }); - * - * - * ### Custom Presets - * Developers are also able to create their own preset, which can be easily used without repeating - * their options each time. - * - * - * $mdBottomSheetProvider.addPreset('testPreset', { - * options: function() { - * return { - * template: - * '' + - * 'This is a custom preset' + - * '', - * controllerAs: 'bottomSheet', - * bindToController: true, - * clickOutsideToClose: true, - * escapeToClose: true - * }; - * } - * }); - * - * - * After you create your preset during the config phase, you can easily access it. - * - * - * $mdBottomSheet.show( - * $mdBottomSheet.testPreset() - * ); - * - */ - -/** - * @ngdoc method - * @name $mdBottomSheet#show - * - * @description - * Show a bottom sheet with the specified options. - * - * Note: You should always provide a `.catch()` method in case the user hits the - * `esc` key or clicks the background to close. In this case, the `cancel()` method will - * automatically be called on the bottom sheet which will `reject()` the promise. See the @usage - * section above for an example. - * - * Newer versions of Angular will throw a `Possibly unhandled rejection` exception if you forget - * this. - * - * @param {Object} optionsOrPreset Either provide an `$mdBottomSheetPreset` defined during the - * config phase or an options object, with the following properties: - * - * - `templateUrl` - `{string=}`: The url of an html template file that will - * be used as the content of the bottom sheet. Restrictions: the template must - * have an outer `md-bottom-sheet` element. - * - `template` - `{string=}`: Same as templateUrl, except this is an actual - * template string. - * - `scope` - `{Object=}`: the scope to link the template / controller to. If none is specified, - * it will create a new child scope. This scope will be destroyed when the bottom sheet is - * removed unless `preserveScope` is set to true. - * - `preserveScope` - `{boolean=}`: whether to preserve the scope when the element is removed. - * Default is false - * - `controller` - `{string=}`: The controller to associate with this bottom sheet. - * - `locals` - `{string=}`: An object containing key/value pairs. The keys will be used as names - * of values to inject into the controller. For example, `locals: {three: 3}` would inject - * `three` into the controller with the value of 3. - * - `clickOutsideToClose` - `{boolean=}`: Whether the user can click outside the bottom sheet to - * close it. Default true. - * - `bindToController` - `{boolean=}`: When set to true, the locals will be bound to the - * controller instance and available in it's $onInit function. - * - `disableBackdrop` - `{boolean=}`: When set to true, the bottomsheet will not show a backdrop. - * - `escapeToClose` - `{boolean=}`: Whether the user can press escape to close the bottom sheet. - * Default true. - * - `isLockedOpen` - `{boolean=}`: Disables all default ways of closing the bottom sheet. - * **Note:** this will override the `clickOutsideToClose` and `escapeToClose` options, leaving - * only the `hide` and `cancel` methods as ways of closing the bottom sheet. Defaults to false. - * - `resolve` - `{Object=}`: Similar to locals, except it takes promises as values - * and the bottom sheet will not open until the promises resolve. - * - `controllerAs` - `{string=}`: An alias to assign the controller to on the scope. - * - `parent` - `{element=}`: The element to append the bottom sheet to. The `parent` may be a - * `function`, `string`, `Object`, or null. Defaults to appending to the body of the root element - * (or the root element) of the application. - * e.g. angular.element(document.getElementById('content')) or "#content" - * - `disableParentScroll` - `{boolean=}`: Whether to disable scrolling while the bottom sheet is - * open. Default true. - * - * @returns {promise} A promise that can be resolved with `$mdBottomSheet.hide()` or - * rejected with `$mdBottomSheet.cancel()`. - */ - -/** - * @ngdoc method - * @name $mdBottomSheet#hide - * - * @description - * Hide the existing bottom sheet and resolve the promise returned from - * `$mdBottomSheet.show()`. This call will close the most recently opened/current bottom sheet (if - * any). - * - * Note: Use a `.then()` on your `.show()` to handle this callback. - * - * @param {*=} response An argument for the resolved promise. - * - */ - -/** - * @ngdoc method - * @name $mdBottomSheet#cancel - * - * @description - * Hide the existing bottom sheet and reject the promise returned from - * `$mdBottomSheet.show()`. - * - * Note: Use a `.catch()` on your `.show()` to handle this callback. - * - * @param {*=} response An argument for the rejected promise. - * - */ - -function MdBottomSheetProvider($$interimElementProvider) { - // how fast we need to flick down to close the sheet, pixels/ms - bottomSheetDefaults.$inject = ["$animate", "$mdConstant", "$mdUtil", "$mdTheming", "$mdBottomSheet", "$rootElement", "$mdGesture", "$log"]; - var CLOSING_VELOCITY = 0.5; - var PADDING = 80; // same as css - - return $$interimElementProvider('$mdBottomSheet') - .setDefaults({ - methods: ['disableParentScroll', 'escapeToClose', 'clickOutsideToClose'], - options: bottomSheetDefaults - }); - - /* @ngInject */ - function bottomSheetDefaults($animate, $mdConstant, $mdUtil, $mdTheming, $mdBottomSheet, $rootElement, - $mdGesture, $log) { - var backdrop; - - return { - themable: true, - onShow: onShow, - onRemove: onRemove, - disableBackdrop: false, - escapeToClose: true, - clickOutsideToClose: true, - disableParentScroll: true, - isLockedOpen: false - }; - - function onShow(scope, element, options) { - element = $mdUtil.extractElementByName(element, 'md-bottom-sheet'); - - // prevent tab focus or click focus on the bottom-sheet container - element.attr('tabindex', '-1'); - - // Once the md-bottom-sheet has `ng-cloak` applied on his template the opening animation will not work properly. - // This is a very common problem, so we have to notify the developer about this. - if (element.hasClass('ng-cloak')) { - var message = '$mdBottomSheet: using `` will affect the bottom-sheet opening animations.'; - $log.warn(message, element[0]); - } - - if (options.isLockedOpen) { - options.clickOutsideToClose = false; - options.escapeToClose = false; - } else { - options.cleanupGestures = registerGestures(element, options.parent); - } - - if (!options.disableBackdrop) { - // Add a backdrop that will close on click - backdrop = $mdUtil.createBackdrop(scope, "md-bottom-sheet-backdrop md-opaque"); - - // Prevent mouse focus on backdrop; ONLY programmatic focus allowed. - // This allows clicks on backdrop to propagate to the $rootElement and - // ESC key events to be detected properly. - backdrop[0].tabIndex = -1; - - if (options.clickOutsideToClose) { - backdrop.on('click', function() { - $mdUtil.nextTick($mdBottomSheet.cancel, true); - }); - } - - $mdTheming.inherit(backdrop, options.parent); - - $animate.enter(backdrop, options.parent, null); - } - - $mdTheming.inherit(element, options.parent); - - if (options.disableParentScroll) { - options.restoreScroll = $mdUtil.disableScrollAround(element, options.parent); - } - - return $animate.enter(element, options.parent, backdrop) - .then(function() { - var focusable = $mdUtil.findFocusTarget(element) || angular.element( - element[0].querySelector('button') || - element[0].querySelector('a') || - element[0].querySelector($mdUtil.prefixer('ng-click', true)) - ) || backdrop; - - if (options.escapeToClose) { - options.rootElementKeyupCallback = function(e) { - if (e.keyCode === $mdConstant.KEY_CODE.ESCAPE) { - $mdUtil.nextTick($mdBottomSheet.cancel, true); - } - }; - - $rootElement.on('keyup', options.rootElementKeyupCallback); - focusable && focusable.focus(); - } - }); - - } - - function onRemove(scope, element, options) { - if (!options.disableBackdrop) $animate.leave(backdrop); - - return $animate.leave(element).then(function() { - if (options.disableParentScroll) { - options.restoreScroll(); - delete options.restoreScroll; - } - - options.cleanupGestures && options.cleanupGestures(); - }); - } - - /** - * Adds the drag gestures to the bottom sheet. - * @param {JQLite} element where CSS transitions will be applied - * @param {JQLite} parent used for registering gesture listeners - * @return {Function} function that removes gesture listeners that were set up by - * registerGestures() - */ - function registerGestures(element, parent) { - var deregister = $mdGesture.register(parent, 'drag', { horizontal: false }); - parent.on('$md.dragstart', onDragStart) - .on('$md.drag', onDrag) - .on('$md.dragend', onDragEnd); - - return function cleanupGestures() { - deregister(); - parent.off('$md.dragstart', onDragStart); - parent.off('$md.drag', onDrag); - parent.off('$md.dragend', onDragEnd); - }; - - function onDragStart() { - // Disable transitions on transform so that it feels fast - element.css($mdConstant.CSS.TRANSITION_DURATION, '0ms'); - } - - function onDrag(ev) { - var transform = ev.pointer.distanceY; - if (transform < 5) { - // Slow down drag when trying to drag up, and stop after PADDING - transform = Math.max(-PADDING, transform / 2); - } - element.css($mdConstant.CSS.TRANSFORM, 'translate3d(0,' + (PADDING + transform) + 'px,0)'); - } - - function onDragEnd(ev) { - if (ev.pointer.distanceY > 0 && - (ev.pointer.distanceY > 20 || Math.abs(ev.pointer.velocityY) > CLOSING_VELOCITY)) { - var distanceRemaining = element.prop('offsetHeight') - ev.pointer.distanceY; - var transitionDuration = Math.min(distanceRemaining / ev.pointer.velocityY * 0.75, 500); - element.css($mdConstant.CSS.TRANSITION_DURATION, transitionDuration + 'ms'); - $mdUtil.nextTick($mdBottomSheet.cancel, true); - } else { - element.css($mdConstant.CSS.TRANSITION_DURATION, ''); - element.css($mdConstant.CSS.TRANSFORM, ''); - } - } - } - } -} - -})(); -(function(){ -"use strict"; - -/** - * @ngdoc module - * @name material.components.button - * @description - * - * Button - */ -MdButtonDirective.$inject = ["$mdButtonInkRipple", "$mdTheming", "$mdAria", "$mdInteraction"]; -MdAnchorDirective.$inject = ["$mdTheming"]; -angular - .module('material.components.button', ['material.core']) - .directive('mdButton', MdButtonDirective) - .directive('a', MdAnchorDirective); - - -/** - * @private - * @restrict E - * - * @description - * `a` is an anchor directive used to inherit theme colors for md-primary, md-accent, etc. - * - * @usage - * - * - * - * - * - * - */ -function MdAnchorDirective($mdTheming) { - return { - restrict : 'E', - link : function postLink(scope, element) { - // Make sure to inherit theme so stand-alone anchors - // support theme colors for md-primary, md-accent, etc. - $mdTheming(element); - } - }; -} - - -/** - * @ngdoc directive - * @name mdButton - * @module material.components.button - * - * @restrict E - * - * @description - * `` is a button directive with optional ink ripples (default enabled). - * - * If you supply a `href` or `ng-href` attribute, it will become an `` element. Otherwise, it - * will become a `'; - } - } - - function postLink(scope, element, attr) { - $mdTheming(element); - $mdButtonInkRipple.attach(scope, element); - - // Use async expect to support possible bindings in the button label - $mdAria.expectWithoutText(element, 'aria-label'); - - // For anchor elements, we have to set tabindex manually when the element is disabled. - // We don't do this for md-nav-bar anchors as the component manages its own tabindex values. - if (isAnchor(attr) && angular.isDefined(attr.ngDisabled) && - !element.hasClass('_md-nav-button')) { - scope.$watch(attr.ngDisabled, function(isDisabled) { - element.attr('tabindex', isDisabled ? -1 : 0); - }); - } - - // disabling click event when disabled is true - element.on('click', function(e){ - if (attr.disabled === true) { - e.preventDefault(); - e.stopImmediatePropagation(); - } - }); - - if (!element.hasClass('md-no-focus')) { - - element.on('focus', function() { - - // Only show the focus effect when being focused through keyboard interaction or programmatically - if (!$mdInteraction.isUserInvoked() || $mdInteraction.getLastInteractionType() === 'keyboard') { - element.addClass('md-focused'); - } - - }); - - element.on('blur', function() { - element.removeClass('md-focused'); - }); - } - - } - -} - -})(); -(function(){ -"use strict"; - -/** - * @ngdoc module - * @name material.components.card - * - * @description - * Card components. - */ -mdCardDirective.$inject = ["$mdTheming"]; -angular.module('material.components.card', [ - 'material.core' - ]) - .directive('mdCard', mdCardDirective); - - -/** - * @ngdoc directive - * @name mdCard - * @module material.components.card - * - * @restrict E - * - * @description - * The `` directive is a container element used within `` containers. - * - * An image included as a direct descendant will fill the card's width. If you want to avoid this, - * you can add the `md-image-no-fill` class to the parent element. The `` - * container will wrap text content and provide padding. An `` element can be - * optionally included to put content flush against the bottom edge of the card. - * - * Action buttons can be included in an `` element, similar to ``. - * You can then position buttons using layout attributes. - * - * Card is built with: - * * `` - Header for the card, holds avatar, text and squared image - * - `` - Card avatar - * - `md-user-avatar` - Class for user image - * - `` - * - `` - Contains elements for the card description - * - `md-title` - Class for the card title - * - `md-subhead` - Class for the card sub header - * * `` - Image for the card - * * `` - Card content title - * - `` - * - `md-headline` - Class for the card content title - * - `md-subhead` - Class for the card content sub header - * - `` - Squared image within the title - * - `md-media-sm` - Class for small image - * - `md-media-md` - Class for medium image - * - `md-media-lg` - Class for large image - * - `md-media-xl` - Class for extra large image - * * `` - Card content - * * `` - Card actions - * - `` - Icon actions - * - * Cards have constant width and variable heights; where the maximum height is limited to what can - * fit within a single view on a platform, but it can temporarily expand as needed. - * - * @usage - * ### Card with optional footer - * - * - * image caption - * - *

    Card headline

    - *

    Card content

    - *
    - * - * Card footer - * - *
    - *
    - * - * ### Card with actions - * - * - * image caption - * - *

    Card headline

    - *

    Card content

    - *
    - * - * Action 1 - * Action 2 - * - *
    - *
    - * - * ### Card with header, image, title actions and content - * - * - * - * - * - * - * - * Title - * Sub header - * - * - * image caption - * - * - * Card headline - * Card subheader - * - * - * - * Action 1 - * Action 2 - * - * - * - * - * - * - * - *

    - * Card content - *

    - *
    - *
    - *
    - */ -function mdCardDirective($mdTheming) { - return { - restrict: 'E', - link: function ($scope, $element, attr) { - $element.addClass('_md'); // private md component indicator for styling - $mdTheming($element); - } - }; -} - -})(); -(function(){ -"use strict"; - -/** - * @ngdoc module - * @name material.components.checkbox - * @description Checkbox module! - */ -MdCheckboxDirective.$inject = ["inputDirective", "$mdAria", "$mdConstant", "$mdTheming", "$mdUtil", "$mdInteraction"]; -angular - .module('material.components.checkbox', ['material.core']) - .directive('mdCheckbox', MdCheckboxDirective); - -/** - * @ngdoc directive - * @name mdCheckbox - * @module material.components.checkbox - * @restrict E - * - * @description - * The checkbox directive is used like the normal - * [angular checkbox](https://docs.angularjs.org/api/ng/input/input%5Bcheckbox%5D). - * - * As per the [Material Design spec](https://material.io/archive/guidelines/style/color.html#color-color-palette) - * the checkbox is in the accent color by default. The primary color palette may be used with - * the `md-primary` class. - * - * @param {expression} ng-model Assignable angular expression to data-bind to. - * @param {string=} name Property name of the form under which the control is published. - * @param {expression=} ng-true-value The value to which the expression should be set when selected. - * @param {expression=} ng-false-value The value to which the expression should be set when not - * selected. - * @param {expression=} ng-change Expression to be executed when the model value changes. - * @param {boolean=} md-no-ink If present, disable ink ripple effects. - * @param {string=} aria-label Adds label to checkbox for accessibility. - * Defaults to checkbox's text. If no default text is found, a warning will be logged. - * @param {expression=} md-indeterminate This determines when the checkbox should be rendered as - * 'indeterminate'. If a truthy expression or no value is passed in the checkbox renders in the - * md-indeterminate state. If falsy expression is passed in it just looks like a normal unchecked - * checkbox. The indeterminate, checked, and unchecked states are mutually exclusive. A box - * cannot be in any two states at the same time. Adding the 'md-indeterminate' attribute - * overrides any checked/unchecked rendering logic. When using the 'md-indeterminate' attribute - * use 'ng-checked' to define rendering logic instead of using 'ng-model'. - * @param {expression=} ng-checked If this expression evaluates as truthy, the 'md-checked' css - * class is added to the checkbox and it will appear checked. - * - * @usage - * - * - * Finished ? - * - * - * - * No Ink Effects - * - * - * - * Disabled - * - * - * - * - */ -function MdCheckboxDirective(inputDirective, $mdAria, $mdConstant, $mdTheming, $mdUtil, $mdInteraction) { - inputDirective = inputDirective[0]; - - return { - restrict: 'E', - transclude: true, - require: ['^?mdInputContainer', '?ngModel', '?^form'], - priority: $mdConstant.BEFORE_NG_ARIA, - template: - '
    ' + - '
    ' + - '
    ' + - '
    ', - compile: compile - }; - - // ********************************************************** - // Private Methods - // ********************************************************** - - function compile (tElement, tAttrs) { - tAttrs.$set('tabindex', tAttrs.tabindex || '0'); - tAttrs.$set('type', 'checkbox'); - tAttrs.$set('role', tAttrs.type); - tElement.addClass('md-auto-horizontal-margin'); - - return { - pre: function(scope, element) { - // Attach a click handler during preLink, in order to immediately stop propagation - // (especially for ng-click) when the checkbox is disabled. - element.on('click', function(e) { - if (this.hasAttribute('disabled')) { - e.stopImmediatePropagation(); - } - }); - }, - post: postLink - }; - - function postLink(scope, element, attr, ctrls) { - var isIndeterminate; - var containerCtrl = ctrls[0]; - var ngModelCtrl = ctrls[1] || $mdUtil.fakeNgModel(); - var formCtrl = ctrls[2]; - var labelHasLink = element.find('a').length > 0; - - // The original component structure is not accessible when the checkbox's label contains a link. - // In order to keep backwards compatibility, we're only changing the structure of the component - // when we detect a link within the label. Using a span after the md-checkbox and attaching it - // via aria-labelledby allows screen readers to find and work with the link within the label. - if (labelHasLink) { - var labelId = 'label-' + $mdUtil.nextUid(); - attr.$set('aria-labelledby', labelId); - - var label = element.children()[1]; - // Use jQLite here since ChildNode.remove() is not supported in IE11. - angular.element(label).remove(); - label.removeAttribute('ng-transclude'); - label.className = 'md-checkbox-link-label'; - label.setAttribute('id', labelId); - element.after(label); - // Make sure that clicking on the label still causes the checkbox to be toggled, when appropriate. - var externalLabel = element.next(); - externalLabel.on('click', listener); - } - - if (containerCtrl) { - var isErrorGetter = containerCtrl.isErrorGetter || function() { - return ngModelCtrl.$invalid && (ngModelCtrl.$touched || (formCtrl && formCtrl.$submitted)); - }; - - containerCtrl.input = element; - - scope.$watch(isErrorGetter, containerCtrl.setInvalid); - } - - $mdTheming(element); - - // Redirect focus events to the root element, because IE11 is always focusing the container element instead - // of the md-checkbox element. This causes issues when using ngModelOptions: `updateOnBlur` - element.children().on('focus', function() { - element.focus(); - }); - - if ($mdUtil.parseAttributeBoolean(attr.mdIndeterminate)) { - setIndeterminateState(); - scope.$watch(attr.mdIndeterminate, setIndeterminateState); - } - - if (attr.ngChecked) { - scope.$watch(scope.$eval.bind(scope, attr.ngChecked), function(value) { - ngModelCtrl.$setViewValue(value); - ngModelCtrl.$render(); - }); - } - - $$watchExpr('ngDisabled', 'tabindex', { - true: '-1', - false: attr.tabindex - }); - - // Don't emit a warning when the label has a link within it. In that case we'll use - // aria-labelledby to point to another span that should be read as the label. - if (!labelHasLink) { - $mdAria.expectWithText(element, 'aria-label'); - } - - // Reuse the original input[type=checkbox] directive from AngularJS core. - // This is a bit hacky as we need our own event listener and own render - // function. - inputDirective.link.pre(scope, { - on: angular.noop, - 0: {} - }, attr, [ngModelCtrl]); - - element.on('click', listener) - .on('keypress', keypressHandler) - .on('focus', function() { - if ($mdInteraction.getLastInteractionType() === 'keyboard') { - element.addClass('md-focused'); - } - }) - .on('blur', function() { - element.removeClass('md-focused'); - }); - - ngModelCtrl.$render = render; - - function $$watchExpr(expr, htmlAttr, valueOpts) { - if (attr[expr]) { - scope.$watch(attr[expr], function(val) { - if (valueOpts[val]) { - element.attr(htmlAttr, valueOpts[val]); - } - }); - } - } - - /** - * @param {KeyboardEvent} ev 'keypress' event to handle - */ - function keypressHandler(ev) { - var keyCode = ev.which || ev.keyCode; - var submit, form; - - ev.preventDefault(); - switch (keyCode) { - case $mdConstant.KEY_CODE.SPACE: - element.addClass('md-focused'); - listener(ev); - break; - case $mdConstant.KEY_CODE.ENTER: - // Match the behavior of the native . - // When the enter key is pressed while focusing a native checkbox inside a form, - // the browser will trigger a `click` on the first non-disabled submit button/input - // in the form. Note that this is different from text inputs, which - // will directly submit the form without needing a submit button/input to be present. - form = $mdUtil.getClosest(ev.target, 'form'); - if (form) { - submit = form.querySelector('button[type="submit"]:enabled, input[type="submit"]:enabled'); - if (submit) { - submit.click(); - } - } - break; - } - } - - function listener(ev) { - // skipToggle boolean is used by the switch directive to prevent the click event - // when releasing the drag. There will be always a click if releasing the drag over the checkbox. - // If the click came from a link in the checkbox, don't toggle the value. - // We want the link to be opened without changing the value in this case. - if (element[0].hasAttribute('disabled') || scope.skipToggle || ev.target.tagName === 'A') { - return; - } - - scope.$apply(function() { - // Toggle the checkbox value... - var viewValue = attr.ngChecked && attr.ngClick ? attr.checked : !ngModelCtrl.$viewValue; - - ngModelCtrl.$setViewValue(viewValue, ev && ev.type); - ngModelCtrl.$render(); - }); - } - - function render() { - // Cast the $viewValue to a boolean since it could be undefined - var checked = !!ngModelCtrl.$viewValue && !isIndeterminate; - element.toggleClass('md-checked', checked); - if (!isIndeterminate) { - if (checked) { - element.attr('aria-checked', 'true'); - } else { - element.attr('aria-checked', 'false'); - } - } - } - - /** - * @param {string=} newValue - */ - function setIndeterminateState(newValue) { - isIndeterminate = newValue !== false; - if (isIndeterminate) { - element.attr('aria-checked', 'mixed'); - } - element.toggleClass('md-indeterminate', isIndeterminate); - ngModelCtrl.$render(); - } - } - } -} - -})(); -(function(){ -"use strict"; - -/** - * @ngdoc module - * @name material.components.chips - */ -/* - * @see js folder for chips implementation - */ -angular.module('material.components.chips', [ - 'material.core', - 'material.components.autocomplete' -]); - -})(); -(function(){ -"use strict"; - - -MdChipCtrl.$inject = ["$scope", "$element", "$mdConstant", "$timeout", "$mdUtil"];angular - .module('material.components.chips') - .controller('MdChipCtrl', MdChipCtrl); - -/** - * Controller for the MdChip component. Responsible for handling keyboard - * events and editing the chip if needed. - * - * @param $scope - * @param $element - * @param $mdConstant - * @param $timeout - * @param $mdUtil - * @constructor - */ -function MdChipCtrl ($scope, $element, $mdConstant, $timeout, $mdUtil) { - /** - * @type {$scope} - */ - this.$scope = $scope; - - /** - * @type {$element} - */ - this.$element = $element; - - /** - * @type {$mdConstant} - */ - this.$mdConstant = $mdConstant; - - /** - * @type {$timeout} - */ - this.$timeout = $timeout; - - /** - * @type {$mdUtil} - */ - this.$mdUtil = $mdUtil; - - /** - * @type {boolean} - */ - this.isEditing = false; - - /** - * @type {MdChipsCtrl} - */ - this.parentController = undefined; - - /** - * @type {boolean} - */ - this.enableChipEdit = false; -} - - -/** - * @param {MdChipsCtrl} controller - */ -MdChipCtrl.prototype.init = function(controller) { - this.parentController = controller; - this.enableChipEdit = this.parentController.enableChipEdit; - - if (this.enableChipEdit) { - this.$element.on('keydown', this.chipKeyDown.bind(this)); - this.$element.on('dblclick', this.chipMouseDoubleClick.bind(this)); - this.getChipContent().addClass('_md-chip-content-edit-is-enabled'); - } -}; - - -/** - * @return {Object} first element with the md-chip-content class - */ -MdChipCtrl.prototype.getChipContent = function() { - var chipContents = this.$element[0].getElementsByClassName('md-chip-content'); - return angular.element(chipContents[0]); -}; - - -/** - * When editing the chip, if the user modifies the existing contents, we'll get a span back and - * need to ignore text elements as they only contain blank space. - * `children()` ignores text elements. - * - * When editing the chip, if the user deletes the contents and then enters some new content - * we'll only get a text element back. - * @return {Object} jQuery object representing the content element of the chip - */ -MdChipCtrl.prototype.getContentElement = function() { - var contentElement = angular.element(this.getChipContent().children()[0]); - if (!contentElement || contentElement.length === 0) { - contentElement = angular.element(this.getChipContent().contents()[0]); - } - return contentElement; -}; - - -/** - * @return {number} index of this chip - */ -MdChipCtrl.prototype.getChipIndex = function() { - return parseInt(this.$element.attr('index')); -}; - - -/** - * Update the chip's contents, focus the chip if it's selected, and exit edit mode. - * If the contents were updated to be empty, remove the chip and re-focus the input element. - */ -MdChipCtrl.prototype.goOutOfEditMode = function() { - if (!this.isEditing) { - return; - } - - this.isEditing = false; - this.$element.removeClass('_md-chip-editing'); - this.getChipContent()[0].contentEditable = 'false'; - var chipIndex = this.getChipIndex(); - - var content = this.getContentElement().text(); - if (content) { - this.parentController.updateChipContents(chipIndex, content); - - this.$mdUtil.nextTick(function() { - if (this.parentController.selectedChip === chipIndex) { - this.parentController.focusChip(chipIndex); - } - }.bind(this)); - } else { - this.parentController.removeChipAndFocusInput(chipIndex); - } -}; - - -/** - * Given an HTML element. Selects contents of it. - * @param {Element} node - */ -MdChipCtrl.prototype.selectNodeContents = function(node) { - var range, selection; - if (document.body.createTextRange) { - range = document.body.createTextRange(); - range.moveToElementText(node); - range.select(); - } else if (window.getSelection) { - selection = window.getSelection(); - range = document.createRange(); - range.selectNodeContents(node); - selection.removeAllRanges(); - selection.addRange(range); - } -}; - - -/** - * Presents an input element to edit the contents of the chip. - */ -MdChipCtrl.prototype.goInEditMode = function() { - this.isEditing = true; - this.$element.addClass('_md-chip-editing'); - this.getChipContent()[0].contentEditable = 'true'; - this.getChipContent().on('blur', function() { - this.goOutOfEditMode(); - }.bind(this)); - - this.selectNodeContents(this.getChipContent()[0]); -}; - - -/** - * Handles the keydown event on the chip element. If enable-chip-edit attribute is - * set to true, space or enter keys can trigger going into edit mode. Enter can also - * trigger submitting if the chip is already being edited. - * @param {KeyboardEvent} event - */ -MdChipCtrl.prototype.chipKeyDown = function(event) { - if (!this.isEditing && - (event.keyCode === this.$mdConstant.KEY_CODE.ENTER || - event.keyCode === this.$mdConstant.KEY_CODE.SPACE)) { - event.preventDefault(); - this.goInEditMode(); - } else if (this.isEditing && event.keyCode === this.$mdConstant.KEY_CODE.ENTER) { - event.preventDefault(); - this.goOutOfEditMode(); - } -}; - - -/** - * Enter edit mode if we're not already editing and the enable-chip-edit attribute is enabled. - */ -MdChipCtrl.prototype.chipMouseDoubleClick = function() { - if (this.enableChipEdit && !this.isEditing) { - this.goInEditMode(); - } -}; - -})(); -(function(){ -"use strict"; - - -MdChip.$inject = ["$mdTheming", "$mdUtil", "$compile", "$timeout"];angular - .module('material.components.chips') - .directive('mdChip', MdChip); - -/** - * @ngdoc directive - * @name mdChip - * @module material.components.chips - * - * @description - * `` is a component used within ``. It is responsible for rendering an - * individual chip. - * - * - * @usage - * - * - * {{$chip}} - * - * - * - */ - -/** - * MDChip Directive Definition - * - * @param $mdTheming - * @param $mdUtil - * @param $compile - * @param $timeout - * @ngInject - */ -function MdChip($mdTheming, $mdUtil, $compile, $timeout) { - return { - restrict: 'E', - require: ['^?mdChips', 'mdChip'], - link: postLink, - controller: 'MdChipCtrl' - }; - - function postLink(scope, element, attr, ctrls) { - var chipsController = ctrls.shift(); - var chipController = ctrls.shift(); - var chipContentElement = angular.element(element[0].querySelector('.md-chip-content')); - - $mdTheming(element); - - if (chipsController) { - chipController.init(chipsController); - - // When a chip is blurred, make sure to unset (or reset) the selected chip so that tabbing - // through elements works properly - chipContentElement.on('blur', function() { - chipsController.resetSelectedChip(); - chipsController.$scope.$applyAsync(); - }); - } - - // Use $timeout to ensure we run AFTER the element has been added to the DOM so we can focus it. - $timeout(function() { - if (!chipsController) { - return; - } - - if (chipsController.shouldFocusLastChip) { - chipsController.focusLastChipThenInput(); - } - }); - } -} - -})(); -(function(){ -"use strict"; - - -MdChipRemove.$inject = ["$timeout"];angular - .module('material.components.chips') - .directive('mdChipRemove', MdChipRemove); - -/** - * @ngdoc directive - * @name mdChipRemove - * @restrict A - * @module material.components.chips - * - * @description - * Indicates that the associated element should be used as the delete button template for all chips. - * The associated element must be a child of `md-chips`. - * - * The provided button template will be appended to each chip and will remove the associated chip - * on click. - * - * The button is not styled or themed based on the theme set on the `md-chips` component. A theme - * class and custom icon can be specified in your template. - * - * You can also specify the `type` of the button in your template. - * - * @usage - * ### With Standard Chips - * - * - * - * - * - * - * ### With Object Chips - * - * - * - * - * - */ - - -/** - * MdChipRemove Directive Definition. - * - * @param $timeout - * @returns {{restrict: string, require: string[], link: Function, scope: boolean}} - * @constructor - */ -function MdChipRemove ($timeout) { - return { - restrict: 'A', - require: '^mdChips', - scope: false, - link: postLink - }; - - function postLink(scope, element, attr, ctrl) { - element.on('click', function() { - scope.$apply(function() { - ctrl.removeChip(scope.$$replacedScope.$index); - }); - }); - - // Child elements aren't available until after a $timeout tick as they are hidden by an - // `ng-if`. see http://goo.gl/zIWfuw - $timeout(function() { - element.attr({ 'tabindex': '-1', 'aria-hidden': 'true' }); - element.find('button').attr('tabindex', '-1'); - }); - } -} - -})(); -(function(){ -"use strict"; - - -MdChipTransclude.$inject = ["$compile"];angular - .module('material.components.chips') - .directive('mdChipTransclude', MdChipTransclude); - -function MdChipTransclude ($compile) { - return { - restrict: 'EA', - terminal: true, - link: link, - scope: false - }; - function link (scope, element, attr) { - var ctrl = scope.$parent.$mdChipsCtrl, - newScope = ctrl.parent.$new(false, ctrl.parent); - newScope.$$replacedScope = scope; - newScope.$chip = scope.$chip; - newScope.$index = scope.$index; - newScope.$mdChipsCtrl = ctrl; - - var newHtml = ctrl.$scope.$eval(attr.mdChipTransclude); - - element.html(newHtml); - $compile(element.contents())(newScope); - } -} - -})(); -(function(){ -"use strict"; - -/** - * The default chip append delay. - * - * @type {number} - */ -MdChipsCtrl.$inject = ["$scope", "$attrs", "$mdConstant", "$log", "$element", "$timeout", "$mdUtil", "$mdLiveAnnouncer", "$exceptionHandler"]; -var DEFAULT_CHIP_APPEND_DELAY = 300; - -angular - .module('material.components.chips') - .controller('MdChipsCtrl', MdChipsCtrl); - -/** - * Controller for the MdChips component. Responsible for adding to and - * removing from the list of chips, marking chips as selected, and binding to - * the models of various input components. - * - * @param $scope - * @param $attrs - * @param $mdConstant - * @param $log - * @param $element - * @param $timeout - * @param $mdUtil - * @param $mdLiveAnnouncer - * @param $exceptionHandler - * @constructor - */ -function MdChipsCtrl ($scope, $attrs, $mdConstant, $log, $element, $timeout, $mdUtil, - $mdLiveAnnouncer, $exceptionHandler) { - /** @type {Function} **/ - this.$timeout = $timeout; - - /** @type {Object} */ - this.$mdConstant = $mdConstant; - - /** @type {angular.$scope} */ - this.$scope = $scope; - - /** @type {angular.$scope} */ - this.parent = $scope.$parent; - - /** @type {$mdUtil} */ - this.$mdUtil = $mdUtil; - - /** @type {$log} */ - this.$log = $log; - - /** @type {$mdLiveAnnouncer} */ - this.$mdLiveAnnouncer = $mdLiveAnnouncer; - - /** @type {$exceptionHandler} */ - this.$exceptionHandler = $exceptionHandler; - - /** @type {$element} */ - this.$element = $element; - - /** @type {$attrs} */ - this.$attrs = $attrs; - - /** @type {angular.NgModelController} */ - this.ngModelCtrl = null; - - /** @type {angular.NgModelController} */ - this.userInputNgModelCtrl = null; - - /** @type {MdAutocompleteCtrl} */ - this.autocompleteCtrl = null; - - /** @type {Element} */ - this.userInputElement = null; - - /** @type {Array.} */ - this.items = []; - - /** @type {number} */ - this.selectedChip = -1; - - /** @type {string} */ - this.enableChipEdit = $mdUtil.parseAttributeBoolean($attrs.mdEnableChipEdit); - - /** @type {string} */ - this.addOnBlur = $mdUtil.parseAttributeBoolean($attrs.mdAddOnBlur); - - /** - * The class names to apply to the autocomplete or input. - * @type {string} - */ - this.inputClass = ''; - - /** - * The text to be used as the aria-label for the input. - * @type {string} - */ - this.inputAriaLabel = 'Chips input.'; - - /** - * Label text to describe the chips container. Used to give context and instructions to screen - * reader users when the chips container is selected. - * @type {string} - */ - this.containerHint = 'Chips container. Use arrow keys to select chips.'; - - /** - * Label text to describe the chips container when it is empty. Used to give context and - * instructions to screen reader users when the chips container is selected and it contains - * no chips. - * @type {string} - */ - this.containerEmptyHint = - 'Chips container. Enter the text area, then type text, and press enter to add a chip.'; - - /** - * Hidden hint text for how to delete a chip. Used to give context to screen readers. - * @type {string} - */ - this.deleteHint = 'Press delete to remove this chip.'; - - /** - * Hidden label for the delete button. Used to give context to screen readers. - * @type {string} - */ - this.deleteButtonLabel = 'Remove'; - - /** - * Model used by the input element. - * @type {string} - */ - this.chipBuffer = ''; - - /** - * Whether to use the transformChip expression to transform the chip buffer - * before appending it to the list. - * @type {boolean} - */ - this.useTransformChip = false; - - /** - * Whether to use the onAdd expression to notify of chip additions. - * @type {boolean} - */ - this.useOnAdd = false; - - /** - * Whether to use the onRemove expression to notify of chip removals. - * @type {boolean} - */ - this.useOnRemove = false; - - /** - * The ID of the chips wrapper which is used to build unique IDs for the chips and the aria-owns - * attribute. - * - * Defaults to '_md-chips-wrapper-' plus a unique number. - * - * @type {string} - */ - this.wrapperId = ''; - - /** - * Array of unique numbers which will be auto-generated any time the items change, and is used to - * create unique IDs for the aria-owns attribute. - * - * @type {Array} - */ - this.contentIds = []; - - /** - * The index of the chip that should have it's `tabindex` property set to `0` so it is selectable - * via the keyboard. - * - * @type {number|null} - */ - this.ariaTabIndex = null; - - /** - * After appending a chip, the chip will be focused for this number of milliseconds before the - * input is refocused. - * - * **Note:** This is **required** for compatibility with certain screen readers in order for - * them to properly allow keyboard access. - * - * @type {number} - */ - this.chipAppendDelay = DEFAULT_CHIP_APPEND_DELAY; - - /** - * Collection of functions to call to un-register watchers - * - * @type {Array} - */ - this.deRegister = []; - - /** - * The screen reader will announce the chip content followed by this message when a chip is added. - * @type {string} - */ - this.addedMessage = 'added'; - - /** - * The screen reader will announce the chip content followed by this message when a chip is - * removed. - * @type {string} - */ - this.removedMessage = 'removed'; - - this.init(); -} - -/** - * Initializes variables and sets up watchers - */ -MdChipsCtrl.prototype.init = function() { - var ctrl = this; - - // Set the wrapper ID - this.wrapperId = '_md-chips-wrapper-' + this.$mdUtil.nextUid(); - - // If we're using static chips, then we need to initialize a few things. - if (!this.$element.attr('ng-model')) { - this.setupStaticChips(); - } - - // Setup a watcher which manages the role and aria-owns attributes. - // This is never called for static chips since items is not defined. - this.deRegister.push( - this.$scope.$watchCollection('$mdChipsCtrl.items', function() { - // Make sure our input and wrapper have the correct ARIA attributes - ctrl.setupInputAria(); - ctrl.setupWrapperAria(); - }) - ); - - this.deRegister.push( - this.$attrs.$observe('mdChipAppendDelay', function(newValue) { - ctrl.chipAppendDelay = parseInt(newValue) || DEFAULT_CHIP_APPEND_DELAY; - }) - ); -}; - -/** - * Destructor for cleanup - */ -MdChipsCtrl.prototype.$onDestroy = function $onDestroy() { - var $destroyFn; - while (($destroyFn = this.deRegister.pop())) { - $destroyFn.call(this); - } -}; - -/** - * If we have an input, ensure it has the appropriate ARIA attributes. - */ -MdChipsCtrl.prototype.setupInputAria = function() { - var input = this.$element.find('input'); - - // If we have no input, just return - if (!input) { - return; - } - - input.attr('role', 'textbox'); - input.attr('aria-multiline', true); - if (this.inputAriaDescribedBy) { - input.attr('aria-describedby', this.inputAriaDescribedBy); - } - if (this.inputAriaLabelledBy) { - input.attr('aria-labelledby', this.inputAriaLabelledBy); - input.removeAttr('aria-label'); - } else { - input.attr('aria-label', this.inputAriaLabel); - } -}; - -/** - * Ensure our wrapper has the appropriate ARIA attributes. - */ -MdChipsCtrl.prototype.setupWrapperAria = function() { - var ctrl = this, - wrapper = this.$element.find('md-chips-wrap'); - - if (this.items && this.items.length) { - // Dynamically add the listbox role on every change because it must be removed when there are - // no items. - wrapper.attr('role', 'listbox'); - - // Generate some random (but unique) IDs for each chip - this.contentIds = this.items.map(function() { - return ctrl.wrapperId + '-chip-' + ctrl.$mdUtil.nextUid(); - }); - - // Use the contentIDs above to generate the aria-owns attribute - wrapper.attr('aria-owns', this.contentIds.join(' ')); - wrapper.attr('aria-label', this.containerHint); - } else { - // If we have no items, then the role and aria-owns attributes MUST be removed - wrapper.removeAttr('role'); - wrapper.removeAttr('aria-owns'); - wrapper.attr('aria-label', this.containerEmptyHint); - } -}; - -/** - * Apply specific roles and aria attributes for static chips - */ -MdChipsCtrl.prototype.setupStaticChips = function() { - var ctrl = this, i, staticChips; - var wrapper = this.$element.find('md-chips-wrap'); - - this.$timeout(function() { - wrapper.attr('role', 'list'); - staticChips = wrapper[0].children; - for (i = 0; i < staticChips.length; i++) { - staticChips[i].setAttribute('role', 'listitem'); - staticChips[i].setAttribute('aria-setsize', staticChips.length); - } - if (ctrl.inputAriaDescribedBy) { - wrapper.attr('aria-describedby', ctrl.inputAriaDescribedBy); - } - if (ctrl.inputAriaLabelledBy) { - wrapper.attr('aria-labelledby', ctrl.inputAriaLabelledBy); - wrapper.removeAttr('aria-label'); - } else { - wrapper.attr('aria-label', ctrl.inputAriaLabel); - } - }, 10); -}; - -/** - * Handles the keydown event on the input element: by default appends - * the buffer to the chip list, while backspace removes the last chip in the - * list if the current buffer is empty. - * @param {jQuery.Event|KeyboardEvent} event - */ -MdChipsCtrl.prototype.inputKeydown = function(event) { - var chipBuffer = this.getChipBuffer(); - - // If we have an autocomplete, and it handled the event, we have nothing to do - if (this.autocompleteCtrl && event.isDefaultPrevented && event.isDefaultPrevented()) { - return; - } - - if (event.keyCode === this.$mdConstant.KEY_CODE.BACKSPACE) { - // Only select and focus the previous chip, if the current caret position of the - // input element is at the beginning. - if (this.getCursorPosition(event.target) !== 0) { - return; - } - - event.preventDefault(); - event.stopPropagation(); - - if (this.items.length) { - this.selectAndFocusChipSafe(this.items.length - 1); - } - - return; - } - - // By default appends the buffer to the chip list. - if (!this.separatorKeys || this.separatorKeys.length < 1) { - this.separatorKeys = [this.$mdConstant.KEY_CODE.ENTER]; - } - - // Support additional separator key codes in an array of `md-separator-keys`. - if (this.separatorKeys.indexOf(event.keyCode) !== -1) { - if ((this.autocompleteCtrl && this.requireMatch) || !chipBuffer) return; - event.preventDefault(); - - // Only append the chip and reset the chip buffer if the max chips limit isn't reached. - if (this.hasMaxChipsReached()) return; - - this.appendChip(chipBuffer.trim()); - this.resetChipBuffer(); - - return false; - } -}; - -/** - * Returns the cursor position of the specified input element. - * @param {HTMLInputElement} element relevant input element - * @returns {Number} Cursor Position of the input. - */ -MdChipsCtrl.prototype.getCursorPosition = function(element) { - /* - * Figure out whether the current input for the chips buffer is valid for using - * the selectionStart / end property to retrieve the cursor position. - * Some browsers do not allow the use of those attributes, on different input types. - */ - try { - if (element.selectionStart === element.selectionEnd) { - return element.selectionStart; - } - } catch (e) { - if (!element.value) { - return 0; - } - } -}; - - -/** - * Updates the content of the chip at given index - * @param {number} chipIndex - * @param {string} chipContents - */ -MdChipsCtrl.prototype.updateChipContents = function(chipIndex, chipContents) { - if (chipIndex >= 0 && chipIndex < this.items.length) { - this.items[chipIndex] = chipContents; - this.updateNgModel(true); - } -}; - - -/** - * @return {boolean} true if a chip is currently being edited. False otherwise. - */ -MdChipsCtrl.prototype.isEditingChip = function() { - return !!this.$element[0].querySelector('._md-chip-editing'); -}; - -/** - * @param {string|Object} chip contents of a single chip - * @returns {boolean} true if the chip is an Object, false otherwise. - * @private - */ -MdChipsCtrl.prototype._isChipObject = function(chip) { - return angular.isObject(chip); -}; - -/** - * @returns {boolean} true if chips can be removed, false otherwise. - */ -MdChipsCtrl.prototype.isRemovable = function() { - // Return false if we have static chips - if (!this.ngModelCtrl) { - return false; - } - - return this.readonly ? this.removable : - angular.isDefined(this.removable) ? this.removable : true; -}; - -/** - * Handles the keydown event on the chip elements: backspace removes the selected chip, arrow - * keys switch which chip is active. - * @param {KeyboardEvent} event - */ -MdChipsCtrl.prototype.chipKeydown = function (event) { - if (this.getChipBuffer()) return; - if (this.isEditingChip()) return; - - switch (event.keyCode) { - case this.$mdConstant.KEY_CODE.BACKSPACE: - case this.$mdConstant.KEY_CODE.DELETE: - if (this.selectedChip < 0) return; - event.preventDefault(); - // Cancel the delete action only after the event cancel. Otherwise the page will go back. - if (!this.isRemovable()) return; - this.removeAndSelectAdjacentChip(this.selectedChip, event); - break; - case this.$mdConstant.KEY_CODE.LEFT_ARROW: - event.preventDefault(); - // By default, allow selection of -1 which will focus the input; if we're readonly, don't go - // below 0. - if (this.selectedChip < 0 || (this.readonly && this.selectedChip === 0)) { - this.selectedChip = this.items.length; - } - if (this.items.length) this.selectAndFocusChipSafe(this.selectedChip - 1); - break; - case this.$mdConstant.KEY_CODE.RIGHT_ARROW: - event.preventDefault(); - this.selectAndFocusChipSafe(this.selectedChip + 1); - break; - case this.$mdConstant.KEY_CODE.ESCAPE: - case this.$mdConstant.KEY_CODE.TAB: - if (this.selectedChip < 0) return; - event.preventDefault(); - this.onFocus(); - break; - } -}; - -/** - * Get the input's placeholder - uses `placeholder` when list is empty and `secondary-placeholder` - * when the list is non-empty. If `secondary-placeholder` is not provided, `placeholder` is used - * always. - * @returns {string} - */ -MdChipsCtrl.prototype.getPlaceholder = function() { - // Allow `secondary-placeholder` to be blank. - var useSecondary = (this.items && this.items.length && - (this.secondaryPlaceholder === '' || this.secondaryPlaceholder)); - return useSecondary ? this.secondaryPlaceholder : this.placeholder; -}; - -/** - * Removes chip at {@code index} and selects the adjacent chip. - * @param {number} index adjacent chip to select - * @param {Event=} event - */ -MdChipsCtrl.prototype.removeAndSelectAdjacentChip = function(index, event) { - var self = this; - var selIndex = self.getAdjacentChipIndex(index); - var wrap = this.$element[0].querySelector('md-chips-wrap'); - var chip = this.$element[0].querySelector('md-chip[index="' + index + '"]'); - - self.removeChip(index, event); - - // The double-timeout is currently necessary to ensure that the DOM has finalized and the select() - // will find the proper chip since the selection is index-based. - // - // TODO: Investigate calling from within chip $scope.$on('$destroy') to reduce/remove timeouts - self.$timeout(function() { - self.$timeout(function() { - self.selectAndFocusChipSafe(selIndex); - }); - }); -}; - -/** - * Sets the selected chip index to -1. - */ -MdChipsCtrl.prototype.resetSelectedChip = function() { - this.selectedChip = -1; - this.ariaTabIndex = null; -}; - -/** - * Gets the index of an adjacent chip to select after deletion. Adjacency is - * determined as the next chip in the list, unless the target chip is the - * last in the list, then it is the chip immediately preceding the target. If - * there is only one item in the list, -1 is returned (select none). - * The number returned is the index to select AFTER the target has been removed. - * If the current chip is not selected, then -1 is returned to select none. - * @param {number} index - * @returns {number} - */ -MdChipsCtrl.prototype.getAdjacentChipIndex = function(index) { - var len = this.items.length - 1; - return (len === 0) ? -1 : - (index === len) ? index - 1 : index; -}; - -/** - * Append the contents of the buffer to the chip list. This method will first - * call out to the md-transform-chip method, if provided. - * @param {string} newChip chip buffer contents that will be used to create the new chip - */ -MdChipsCtrl.prototype.appendChip = function(newChip) { - this.shouldFocusLastChip = !this.addOnBlur; - if (this.useTransformChip && this.transformChip) { - var transformedChip = this.transformChip({'$chip': newChip}); - - // Check to make sure the chip is defined before assigning it, otherwise, we'll just assume - // they want the string version. - if (angular.isDefined(transformedChip)) { - newChip = transformedChip; - } - } - - // If items contains an identical object to newChip, do not append - if (angular.isObject(newChip)) { - var identical = this.items.some(function(item) { - return angular.equals(newChip, item); - }); - if (identical) return; - } - - // Check for a null (but not undefined), or existing chip and cancel appending - if (newChip == null || this.items.indexOf(newChip) + 1) return; - - // Append the new chip onto our list - var length = this.items.push(newChip); - var index = length - 1; - - this.updateNgModel(); - - // Tell screen reader users that the chip was successfully added. - // TODO add a way for developers to specify which field of the object should be announced here. - var chipContent = angular.isObject(newChip) ? '' : newChip; - this.$mdLiveAnnouncer.announce(chipContent + ' ' + this.addedMessage, 'assertive'); - - // If the md-on-add attribute is specified, send a chip addition event - if (this.useOnAdd && this.onAdd) { - this.onAdd({ '$chip': newChip, '$index': index }); - } -}; - -/** - * Sets whether to use the md-transform-chip expression. This expression is - * bound to scope and controller in {@code MdChipsDirective} as - * {@code transformChip}. Due to the nature of directive scope bindings, the - * controller cannot know on its own/from the scope whether an expression was - * actually provided. - */ -MdChipsCtrl.prototype.useTransformChipExpression = function() { - this.useTransformChip = true; -}; - -/** - * Sets whether to use the md-on-add expression. This expression is - * bound to scope and controller in {@code MdChipsDirective} as - * {@code onAdd}. Due to the nature of directive scope bindings, the - * controller cannot know on its own/from the scope whether an expression was - * actually provided. - */ -MdChipsCtrl.prototype.useOnAddExpression = function() { - this.useOnAdd = true; -}; - -/** - * Sets whether to use the md-on-remove expression. This expression is - * bound to scope and controller in {@code MdChipsDirective} as - * {@code onRemove}. Due to the nature of directive scope bindings, the - * controller cannot know on its own/from the scope whether an expression was - * actually provided. - */ -MdChipsCtrl.prototype.useOnRemoveExpression = function() { - this.useOnRemove = true; -}; - -/** - * Sets whether to use the md-on-select expression. This expression is - * bound to scope and controller in {@code MdChipsDirective} as - * {@code onSelect}. Due to the nature of directive scope bindings, the - * controller cannot know on its own/from the scope whether an expression was - * actually provided. - */ -MdChipsCtrl.prototype.useOnSelectExpression = function() { - this.useOnSelect = true; -}; - -/** - * Gets the input buffer. The input buffer can be the model bound to the - * default input item {@code this.chipBuffer}, the {@code selectedItem} - * model of an {@code md-autocomplete}, or, through some magic, the model - * bound to any input or text area element found within a - * {@code md-input-container} element. - * @return {string} the input buffer - */ -MdChipsCtrl.prototype.getChipBuffer = function() { - var chipBuffer = !this.userInputElement ? this.chipBuffer : - this.userInputNgModelCtrl ? this.userInputNgModelCtrl.$viewValue : - this.userInputElement[0].value; - - // Ensure that the chip buffer is always a string. For example, the input element buffer - // might be falsy. - return angular.isString(chipBuffer) ? chipBuffer : ''; -}; - -/** - * Resets the input buffer for either the internal input or user provided input element. - */ -MdChipsCtrl.prototype.resetChipBuffer = function() { - if (this.userInputElement) { - if (this.userInputNgModelCtrl) { - this.userInputNgModelCtrl.$setViewValue(''); - this.userInputNgModelCtrl.$render(); - } else { - this.userInputElement[0].value = ''; - } - } else { - this.chipBuffer = ''; - } -}; - -/** - * @returns {boolean} true if the max chips limit has been reached, false otherwise. - */ -MdChipsCtrl.prototype.hasMaxChipsReached = function() { - if (angular.isString(this.maxChips)) { - this.maxChips = parseInt(this.maxChips, 10) || 0; - } - - return this.maxChips > 0 && this.items.length >= this.maxChips; -}; - -/** - * Updates the validity properties for the ngModel. - * - * TODO add the md-max-chips validator to this.ngModelCtrl.validators so that the validation will - * be performed automatically. - */ -MdChipsCtrl.prototype.validateModel = function() { - this.ngModelCtrl.$setValidity('md-max-chips', !this.hasMaxChipsReached()); - this.ngModelCtrl.$validate(); // rerun any registered validators -}; - -/** - * Function to handle updating the model, validation, and change notification when a chip - * is added, removed, or changed. - * @param {boolean=} skipValidation true to skip calling validateModel() - */ -MdChipsCtrl.prototype.updateNgModel = function(skipValidation) { - if (!skipValidation) { - this.validateModel(); - } - // This will trigger ng-change to fire, even in cases where $setViewValue() would not. - angular.forEach(this.ngModelCtrl.$viewChangeListeners, function(listener) { - try { - listener(); - } catch (e) { - this.$exceptionHandler(e); - } - }); -}; - -/** - * Removes the chip at the given index. - * @param {number} index of chip to remove - * @param {Event=} event optionally passed to the onRemove callback - */ -MdChipsCtrl.prototype.removeChip = function(index, event) { - var removed = this.items.splice(index, 1); - - this.updateNgModel(); - this.ngModelCtrl.$setDirty(); - - // Tell screen reader users that the chip was successfully removed. - // TODO add a way for developers to specify which field of the object should be announced here. - var chipContent = angular.isObject(removed[0]) ? '' : removed[0]; - this.$mdLiveAnnouncer.announce(chipContent + ' ' + this.removedMessage, 'assertive'); - - if (removed && removed.length && this.useOnRemove && this.onRemove) { - this.onRemove({ '$chip': removed[0], '$index': index, '$event': event }); - } -}; - -/** - * @param {number} index location of chip to remove - * @param {Event=} $event - */ -MdChipsCtrl.prototype.removeChipAndFocusInput = function (index, $event) { - this.removeChip(index, $event); - - if (this.autocompleteCtrl) { - // Always hide the autocomplete dropdown before focusing the autocomplete input. - // Wait for the input to move horizontally, because the chip was removed. - // This can lead to an incorrect dropdown position. - this.autocompleteCtrl.hidden = true; - this.$mdUtil.nextTick(this.onFocus.bind(this)); - } else { - this.onFocus(); - } - -}; -/** - * Selects the chip at `index`, - * @param {number} index location of chip to select and focus - */ -MdChipsCtrl.prototype.selectAndFocusChipSafe = function(index) { - // If we have no chips, or are asked to select a chip before the first, just focus the input - if (!this.items.length || index === -1) { - return this.focusInput(); - } - - // If we are asked to select a chip greater than the number of chips... - if (index >= this.items.length) { - if (this.readonly) { - // If we are readonly, jump back to the start (because we have no input) - index = 0; - } else { - // If we are not readonly, we should attempt to focus the input - return this.onFocus(); - } - } - - index = Math.max(index, 0); - index = Math.min(index, this.items.length - 1); - - this.selectChip(index); - this.focusChip(index); -}; - -/** - * Focus last chip, then focus the input. This is needed for screen reader support. - */ -MdChipsCtrl.prototype.focusLastChipThenInput = function() { - var ctrl = this; - - ctrl.shouldFocusLastChip = false; - - ctrl.focusChip(this.items.length - 1); - - ctrl.$timeout(function() { - ctrl.focusInput(); - }, ctrl.chipAppendDelay); -}; - -/** - * Focus the input element. - */ -MdChipsCtrl.prototype.focusInput = function() { - this.selectChip(-1); - this.onFocus(); -}; - -/** - * Marks the chip at the given index as selected. - * @param {number} index location of chip to select - */ -MdChipsCtrl.prototype.selectChip = function(index) { - if (index >= -1 && index <= this.items.length) { - this.selectedChip = index; - - // Fire the onSelect if provided - if (this.useOnSelect && this.onSelect) { - this.onSelect({'$chip': this.items[index] }); - } - } else { - this.$log.warn('Selected Chip index out of bounds; ignoring.'); - } -}; - -/** - * Call {@code focus()} on the chip at {@code index} - * @param {number} index location of chip to focus - */ -MdChipsCtrl.prototype.focusChip = function(index) { - var chipContent = this.$element[0].querySelector( - 'md-chip[index="' + index + '"] .md-chip-content' - ); - - this.ariaTabIndex = index; - - chipContent.focus(); -}; - -/** - * Configures the required interactions with the ngModel Controller. - * Specifically, set {@code this.items} to the {@code NgModelController#$viewValue}. - * @param {NgModelController} ngModelCtrl - */ -MdChipsCtrl.prototype.configureNgModel = function(ngModelCtrl) { - this.ngModelCtrl = ngModelCtrl; - - var self = this; - - // in chips the meaning of $isEmpty changes - ngModelCtrl.$isEmpty = function(value) { - return !value || value.length === 0; - }; - - ngModelCtrl.$render = function() { - // model is updated. do something. - self.items = self.ngModelCtrl.$viewValue; - }; -}; - -MdChipsCtrl.prototype.onFocus = function () { - var input = this.$element[0].querySelector('input'); - input && input.focus(); - this.resetSelectedChip(); -}; - -MdChipsCtrl.prototype.onInputFocus = function () { - this.inputHasFocus = true; - - // Make sure we have the appropriate ARIA attributes - this.setupInputAria(); - - // Make sure we don't have any chips selected - this.resetSelectedChip(); -}; - -MdChipsCtrl.prototype.onInputBlur = function () { - this.inputHasFocus = false; - - if (this.shouldAddOnBlur()) { - this.appendChip(this.getChipBuffer().trim()); - this.resetChipBuffer(); - } -}; - -/** - * Configure event bindings on input element. - * @param {angular.element} inputElement - */ -MdChipsCtrl.prototype.configureInput = function configureInput(inputElement) { - // Find the NgModelCtrl for the input element - var ngModelCtrl = inputElement.controller('ngModel'); - var ctrl = this; - - if (ngModelCtrl) { - - // sync touched-state from inner input to chips-element - this.deRegister.push( - this.$scope.$watch( - function() { - return ngModelCtrl.$touched; - }, - function(isTouched) { - isTouched && ctrl.ngModelCtrl.$setTouched(); - } - ) - ); - - // sync dirty-state from inner input to chips-element - this.deRegister.push( - this.$scope.$watch( - function() { - return ngModelCtrl.$dirty; - }, - function(isDirty) { - isDirty && ctrl.ngModelCtrl.$setDirty(); - } - ) - ); - } -}; - -/** - * Configure event bindings on a user-provided input element. - * @param {angular.element} inputElement - */ -MdChipsCtrl.prototype.configureUserInput = function(inputElement) { - this.userInputElement = inputElement; - - // Find the NgModelCtrl for the input element - var ngModelCtrl = inputElement.controller('ngModel'); - // `.controller` will look in the parent as well. - if (ngModelCtrl !== this.ngModelCtrl) { - this.userInputNgModelCtrl = ngModelCtrl; - } - - var scope = this.$scope; - var ctrl = this; - - // Run all of the events using evalAsync because a focus may fire a blur in the same digest loop - var scopeApplyFn = function(event, fn) { - scope.$evalAsync(angular.bind(ctrl, fn, event)); - }; - - // Bind to keydown and focus events of input - inputElement - .attr({ tabindex: 0 }) - .on('keydown', function(event) { scopeApplyFn(event, ctrl.inputKeydown); }) - .on('focus', function(event) { scopeApplyFn(event, ctrl.onInputFocus); }) - .on('blur', function(event) { scopeApplyFn(event, ctrl.onInputBlur); }); -}; - -/** - * @param {MdAutocompleteCtrl} ctrl controller from the autocomplete component - */ -MdChipsCtrl.prototype.configureAutocomplete = function(ctrl) { - if (ctrl) { - this.autocompleteCtrl = ctrl; - // Update the default container empty hint when we're inside of an autocomplete. - if (!this.$element.attr('container-empty-hint')) { - this.containerEmptyHint = 'Chips container with autocompletion. Enter the text area, ' + - 'type text to search, and then use the up and down arrow keys to select an option. ' + - 'Press enter to add the selected option as a chip.'; - this.setupWrapperAria(); - } - - ctrl.registerSelectedItemWatcher(angular.bind(this, function (item) { - if (item) { - // Only append the chip and reset the chip buffer if the max chips limit isn't reached. - if (this.hasMaxChipsReached()) return; - - this.appendChip(item); - this.resetChipBuffer(); - } - })); - - this.$element.find('input') - .on('focus',angular.bind(this, this.onInputFocus)) - .on('blur', angular.bind(this, this.onInputBlur)); - } -}; - -/** - * @returns {boolean} Whether the current chip buffer should be added on input blur or not. - */ -MdChipsCtrl.prototype.shouldAddOnBlur = function() { - - // Update the custom ngModel validators from the chips component. - this.validateModel(); - - var chipBuffer = this.getChipBuffer().trim(); - // If the model value is empty and required is set on the element, then the model will be invalid. - // In that case, we still want to allow adding the chip. The main (but not only) case we want - // to disallow is adding a chip on blur when md-max-chips validation fails. - var isModelValid = this.ngModelCtrl.$isEmpty(this.ngModelCtrl.$modelValue) || - this.ngModelCtrl.$valid; - var isAutocompleteShowing = this.autocompleteCtrl && !this.autocompleteCtrl.hidden; - - if (this.userInputNgModelCtrl) { - isModelValid = isModelValid && this.userInputNgModelCtrl.$valid; - } - - return this.addOnBlur && !this.requireMatch && chipBuffer && isModelValid && - !isAutocompleteShowing; -}; - -/** - * @returns {boolean} true if the input or a chip is focused. False otherwise. - */ -MdChipsCtrl.prototype.hasFocus = function () { - return this.inputHasFocus || this.selectedChip >= 0; -}; - -/** - * @param {number} index location of content id - * @returns {number} unique id for the aria-owns attribute - */ -MdChipsCtrl.prototype.contentIdFor = function(index) { - return this.contentIds[index]; -}; - -})(); -(function(){ -"use strict"; - - - MdChips.$inject = ["$mdTheming", "$mdUtil", "$compile", "$log", "$timeout", "$$mdSvgRegistry"];angular - .module('material.components.chips') - .directive('mdChips', MdChips); - - /** - * @ngdoc directive - * @name mdChips - * @module material.components.chips - * - * @description - * `` is an input component for building lists of strings or objects. The list items are - * displayed as 'chips'. This component can make use of an `` element or an - * `` element. - * - * ### Custom templates - * A custom template may be provided to render the content of each chip. This is achieved by - * specifying an `` element containing the custom content as a child of - * ``. - * - * Note: Any attributes on - * `` will be dropped as only the innerHTML is used for the chip template. The - * variables `$chip` and `$index` are available in the scope of ``, representing - * the chip object and its index in the list of chips, respectively. - * To override the chip delete control, include an element (ideally a button) with the attribute - * `md-chip-remove`. A click listener to remove the chip will be added automatically. The element - * is also placed as a sibling to the chip content (on which there are also click listeners) to - * avoid a nested ng-click situation. - * - * - * - * Sometimes developers want to limit the amount of possible chips.
    - * You can specify the maximum amount of chips by using the following markup. - * - * - * - * - * - * - * In some cases, you have an autocomplete inside of the `md-chips`.
    - * When the maximum amount of chips has been reached, you can also disable the autocomplete - * selection.
    - * Here is an example markup. - * - * - * - * - * - * - * - * ### Accessibility - * - * The `md-chips` component supports keyboard and screen reader users since Version 1.1.2. In - * order to achieve this, we modified the chips behavior to select newly appended chips for - * `300ms` before re-focusing the input and allowing the user to type. - * - * For most users, this delay is small enough that it will not be noticeable but allows certain - * screen readers to function properly (JAWS and NVDA in particular). - * - * We introduced a new `md-chip-append-delay` option to allow developers to better control this - * behavior. - * - * Please refer to the documentation of this option (below) for more information. - * - * @param {expression} ng-model Assignable AngularJS expression to be data-bound to the list of - * chips. The expression should evaluate to a `string` or `Object` Array. The type of this - * array should align with the return value of `md-transform-chip`. - * @param {expression=} ng-change AngularJS expression to be executed on chip addition, removal, - * or content change. - * @param {string=} placeholder Placeholder text that will be forwarded to the input. - * @param {string=} secondary-placeholder Placeholder text that will be forwarded to the input, - * displayed when there is at least one item in the list - * @param {boolean=} md-removable Enables or disables the deletion of chips through the - * removal icon or the Delete/Backspace key. Defaults to true. - * @param {boolean=} readonly Disables list manipulation (deleting or adding list items), hiding - * the input and delete buttons. If no `ng-model` is provided, the chips will automatically be - * marked as readonly.

    - * When `md-removable` is not defined, the `md-remove` behavior will be overwritten and - * disabled. - * @param {boolean=} md-enable-chip-edit Set this to `"true"` to enable editing of chip contents. - * The user can go into edit mode by pressing the `space` or `enter` keys, or by double - * clicking on the chip. Chip editing is only supported for chips using the basic template. - * **Note:** This attribute is only evaluated once; it is not watched. - * @param {boolean=} ng-required Whether ng-model is allowed to be empty or not. - * @param {number=} md-max-chips The maximum number of chips allowed to add through user input. - *

    The validation property `md-max-chips` can be used when the max chips - * amount is reached. - * @param {boolean=} md-add-on-blur When set to `"true"`, the remaining text inside of the input - * will be converted into a new chip on blur. - * **Note:** This attribute is only evaluated once; it is not watched. - * @param {expression} md-transform-chip An expression of form `myFunction($chip)` that when - * called expects one of the following return values: - * - an object representing the `$chip` input string - * - `undefined` to simply add the `$chip` input string, or - * - `null` to prevent the chip from being appended - * @param {expression=} md-on-add An expression which will be called when a chip has been - * added with `$chip` and `$index` available as parameters. - * @param {expression=} md-on-remove An expression which will be called when a chip has been - * removed with `$chip`, `$index`, and `$event` available as parameters. - * @param {expression=} md-on-select An expression which will be called when a chip is selected. - * @param {boolean=} md-require-match If true, and the chips template contains an autocomplete, - * only allow selection of pre-defined chips (i.e. you cannot add new ones). - * @param {string=} md-input-class This class will be applied to the child input for custom - * styling. If you are using an `md-autocomplete`, then you need to put this attribute on the - * `md-autocomplete` rather than the `md-chips`. - * @param {string=} input-aria-describedby A space-separated list of element IDs. This should - * contain the IDs of any elements that describe this autocomplete. Screen readers will read - * the content of these elements at the end of announcing that the chips input has been - * selected and describing its current state. The descriptive elements do not need to be - * visible on the page. - * @param {string=} input-aria-labelledby A space-separated list of element IDs. The ideal use - * case is that this would contain the ID of a `
    \ - \ -
    \ - {{$chip[$mdContactChipsCtrl.contactName]}}\ -
    \ -
    \ - {{$chip[$mdContactChipsCtrl.contactName]}}\ -
    \ -
    \ -
    '; - - -/** - * MDContactChips Directive Definition - * - * @param $mdTheming - * @param $mdUtil - * @returns {*} - * @ngInject - */ -function MdContactChips($mdTheming, $mdUtil) { - return { - template: function(element, attrs) { - return MD_CONTACT_CHIPS_TEMPLATE; - }, - restrict: 'E', - controller: 'MdContactChipsCtrl', - controllerAs: '$mdContactChipsCtrl', - bindToController: true, - compile: compile, - scope: { - contactQuery: '&mdContacts', - placeholder: '@?', - secondaryPlaceholder: '@?', - contactName: '@mdContactName', - contactImage: '@mdContactImage', - contactEmail: '@mdContactEmail', - contacts: '=ngModel', - ngChange: '&?', - requireMatch: '=?mdRequireMatch', - minLength: '=?mdMinLength', - maxChips: '=?mdMaxChips', - highlightFlags: '@?mdHighlightFlags', - chipAppendDelay: '@?mdChipAppendDelay', - separatorKeys: '=?mdSeparatorKeys', - removedMessage: '@?mdRemovedMessage', - inputClass: '@?mdInputClass', - inputAriaDescribedBy: '@?inputAriaDescribedby', - inputAriaLabelledBy: '@?inputAriaLabelledby', - inputAriaLabel: '@?', - containerHint: '@?', - containerEmptyHint: '@?', - deleteHint: '@?' - } - }; - - function compile(element, attr) { - return function postLink(scope, element, attrs, controllers) { - var contactChipsController = controllers; - - $mdUtil.initOptionalProperties(scope, attr); - $mdTheming(element); - - element.attr('tabindex', '-1'); - - attrs.$observe('mdChipAppendDelay', function(newValue) { - contactChipsController.chipAppendDelay = newValue; - }); - }; - } -} - -})(); -(function(){ -"use strict"; - -(function () { - "use strict"; - - /** - * Use a RegExp to check if the `md-colors=""` is static string - * or one that should be observed and dynamically interpolated. - */ - MdColorsDirective.$inject = ["$mdColors", "$mdUtil", "$log", "$parse"]; - MdColorsService.$inject = ["$mdTheming", "$mdUtil", "$log"]; - var STATIC_COLOR_EXPRESSION = /^{((\s|,)*?["'a-zA-Z-]+?\s*?:\s*?(['"])[a-zA-Z0-9-.]*(['"]))+\s*}$/; - var colorPalettes = null; - - /** - * @ngdoc module - * @name material.components.colors - * - * @description - * Define $mdColors service and a `md-colors=""` attribute directive - */ - angular - .module('material.components.colors', ['material.core']) - .directive('mdColors', MdColorsDirective) - .service('$mdColors', MdColorsService); - - /** - * @ngdoc service - * @name $mdColors - * @module material.components.colors - * - * @description - * By default, defining a theme does not make its colors available for applying to non AngularJS - * Material elements. The `$mdColors` service is used by the `md-color` directive to convert a - * set of color expressions to RGBA values and then apply those values to the element as CSS - * property values. - * - * @usage - * Getting a color based on a theme - * - * - * angular.controller('myCtrl', function ($mdColors) { - * var color = $mdColors.getThemeColor('myTheme-primary-900-0.5'); - * ... - * }); - * - * - * Applying a color from a palette to an element - * - * app.directive('myDirective', function($mdColors) { - * return { - * ... - * link: function (scope, elem) { - * $mdColors.applyThemeColors(elem, {color: 'red-A200-0.2'}); - * } - * } - * }); - * - */ - function MdColorsService($mdTheming, $mdUtil, $log) { - colorPalettes = colorPalettes || Object.keys($mdTheming.PALETTES); - - // Publish service instance - return { - applyThemeColors: applyThemeColors, - getThemeColor: getThemeColor, - hasTheme: hasTheme - }; - - // ******************************************** - // Internal Methods - // ******************************************** - - /** - * @ngdoc method - * @name $mdColors#applyThemeColors - * - * @description - * Lookup a set of colors by hue, theme, and palette, then apply those colors - * with the provided opacity (via `rgba()`) to the specified CSS property. - * - * @param {angular.element} element the element to apply the styles to - * @param {Object} colorExpression Keys are CSS properties and values are strings representing - * the `theme-palette-hue-opacity` of the desired color. For example: - * `{'color': 'red-A200-0.3', 'background-color': 'myTheme-primary-700-0.8'}`. Theme, hue, and - * opacity are optional. - */ - function applyThemeColors(element, colorExpression) { - try { - if (colorExpression) { - // Assign the calculate RGBA color values directly as inline CSS - element.css(interpolateColors(colorExpression)); - } - } catch (e) { - $log.error(e.message); - } - } - - /** - * @ngdoc method - * @name $mdColors#getThemeColor - * - * @description - * Get a parsed RGBA color using a string representing the `theme-palette-hue-opacity` of the - * desired color. - * - * @param {string} expression color expression like `'red-A200-0.3'` or - * `'myTheme-primary-700-0.8'`. Theme, hue, and opacity are optional. - * @returns {string} a CSS color value like `rgba(211, 47, 47, 0.8)` - */ - function getThemeColor(expression) { - var color = extractColorOptions(expression); - - return parseColor(color); - } - - /** - * Return the parsed color - * @param {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} color hash map of color - * definitions - * @param {boolean=} contrast whether use contrast color for foreground. Defaults to false. - * @returns {string} rgba color string - */ - function parseColor(color, contrast) { - contrast = contrast || false; - var rgbValues = $mdTheming.PALETTES[color.palette][color.hue]; - - rgbValues = contrast ? rgbValues.contrast : rgbValues.value; - - return $mdUtil.supplant('rgba({0}, {1}, {2}, {3})', - [rgbValues[0], rgbValues[1], rgbValues[2], rgbValues[3] || color.opacity] - ); - } - - /** - * Convert the color expression into an object with scope-interpolated values - * Then calculate the rgba() values based on the theme color parts - * @param {Object} themeColors json object, keys are css properties and values are string of - * the wanted color, for example: `{color: 'red-A200-0.3'}`. - * @return {Object} Hashmap of CSS properties with associated `rgba()` string values - */ - function interpolateColors(themeColors) { - var rgbColors = {}; - - var hasColorProperty = themeColors.hasOwnProperty('color'); - - angular.forEach(themeColors, function (value, key) { - var color = extractColorOptions(value); - var hasBackground = key.indexOf('background') > -1; - - rgbColors[key] = parseColor(color); - if (hasBackground && !hasColorProperty) { - rgbColors.color = parseColor(color, true); - } - }); - - return rgbColors; - } - - /** - * Check if expression has defined theme - * For instance: - * 'myTheme-primary' => true - * 'red-800' => false - * @param {string} expression color expression like 'red-800', 'red-A200-0.3', - * 'myTheme-primary', or 'myTheme-primary-400' - * @return {boolean} true if the expression has a theme part, false otherwise. - */ - function hasTheme(expression) { - return angular.isDefined($mdTheming.THEMES[expression.split('-')[0]]); - } - - /** - * For the evaluated expression, extract the color parts into a hash map - * @param {string} expression color expression like 'red-800', 'red-A200-0.3', - * 'myTheme-primary', or 'myTheme-primary-400' - * @returns {{hue: *, theme: any, palette: *, opacity: (*|string|number)}} - */ - function extractColorOptions(expression) { - var parts = expression.split('-'); - var hasTheme = angular.isDefined($mdTheming.THEMES[parts[0]]); - var theme = hasTheme ? parts.splice(0, 1)[0] : $mdTheming.defaultTheme(); - - return { - theme: theme, - palette: extractPalette(parts, theme), - hue: extractHue(parts, theme), - opacity: parts[2] || 1 - }; - } - - /** - * Calculate the theme palette name - * @param {Array} parts - * @param {string} theme name - * @return {string} - */ - function extractPalette(parts, theme) { - // If the next section is one of the palettes we assume it's a two word palette - // Two word palette can be also written in camelCase, forming camelCase to dash-case - - var isTwoWord = parts.length > 1 && colorPalettes.indexOf(parts[1]) !== -1; - var palette = parts[0].replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); - - if (isTwoWord) palette = parts[0] + '-' + parts.splice(1, 1); - - if (colorPalettes.indexOf(palette) === -1) { - // If the palette is not in the palette list it's one of primary/accent/warn/background - var scheme = $mdTheming.THEMES[theme].colors[palette]; - if (!scheme) { - throw new Error($mdUtil.supplant( - 'mdColors: couldn\'t find \'{palette}\' in the palettes.', - {palette: palette})); - } - palette = scheme.name; - } - - return palette; - } - - /** - * @param {Array} parts - * @param {string} theme name - * @return {*} - */ - function extractHue(parts, theme) { - var themeColors = $mdTheming.THEMES[theme].colors; - - if (parts[1] === 'hue') { - var hueNumber = parseInt(parts.splice(2, 1)[0], 10); - - if (hueNumber < 1 || hueNumber > 3) { - throw new Error($mdUtil.supplant( - 'mdColors: \'hue-{hueNumber}\' is not a valid hue, can be only \'hue-1\', \'hue-2\' and \'hue-3\'', - {hueNumber: hueNumber})); - } - parts[1] = 'hue-' + hueNumber; - - if (!(parts[0] in themeColors)) { - throw new Error($mdUtil.supplant( - 'mdColors: \'hue-x\' can only be used with [{availableThemes}], but was used with \'{usedTheme}\'', - { - availableThemes: Object.keys(themeColors).join(', '), - usedTheme: parts[0] - })); - } - - return themeColors[parts[0]].hues[parts[1]]; - } - - return parts[1] || themeColors[parts[0] in themeColors ? parts[0] : 'primary'].hues['default']; - } - } - - /** - * @ngdoc directive - * @name mdColors - * @module material.components.colors - * - * @restrict A - * - * @description - * `mdColors` directive will apply the theme-based color expression as RGBA CSS style values. - * - * The format will be similar to the colors defined in the Sass files: - * - * ## `[?theme]-[palette]-[?hue]-[?opacity]` - * - [theme] - default value is the default theme - * - [palette] - can be either palette name or primary/accent/warn/background - * - [hue] - default is 500 (hue-x can be used with primary/accent/warn/background) - * - [opacity] - default is 1 - * - * - * > `?` indicates optional parameter - * - * @usage - * - *
    - *
    - * Color demo - *
    - *
    - *
    - * - * The `mdColors` directive will automatically watch for changes in the expression if it recognizes - * an interpolation expression or a function. For performance options, you can use `::` prefix to - * the `md-colors` expression to indicate a one-time data binding. - * - * - * - * - * - */ - function MdColorsDirective($mdColors, $mdUtil, $log, $parse) { - return { - restrict: 'A', - require: ['^?mdTheme'], - compile: function (tElem, tAttrs) { - var shouldWatch = shouldColorsWatch(); - - return function (scope, element, attrs, ctrl) { - var mdThemeController = ctrl[0]; - - var lastColors = {}; - - /** - * @param {string=} theme - * @return {Object} colors found in the specified theme - */ - var parseColors = function (theme) { - if (typeof theme !== 'string') { - theme = ''; - } - - if (!attrs.mdColors) { - attrs.mdColors = '{}'; - } - - /** - * Json.parse() does not work because the keys are not quoted; - * use $parse to convert to a hash map - */ - var colors = $parse(attrs.mdColors)(scope); - - /** - * If mdTheme is defined higher up the DOM tree, - * we add mdTheme's theme to the colors which don't specify a theme. - * - * @example - * - *
    - *
    - * Color demo - *
    - *
    - *
    - * - * 'primary-600' will be changed to 'myTheme-primary-600', - * but 'mySecondTheme-accent-200' will not be changed since it has a theme defined. - */ - if (mdThemeController) { - Object.keys(colors).forEach(function (prop) { - var color = colors[prop]; - if (!$mdColors.hasTheme(color)) { - colors[prop] = (theme || mdThemeController.$mdTheme) + '-' + color; - } - }); - } - - cleanElement(colors); - - return colors; - }; - - /** - * @param {Object} colors - */ - var cleanElement = function (colors) { - if (!angular.equals(colors, lastColors)) { - var keys = Object.keys(lastColors); - - if (lastColors.background && !keys.color) { - keys.push('color'); - } - - keys.forEach(function (key) { - element.css(key, ''); - }); - } - - lastColors = colors; - }; - - /** - * Registering for mgTheme changes and asking mdTheme controller run our callback whenever - * a theme changes. - */ - var unregisterChanges = angular.noop; - - if (mdThemeController) { - unregisterChanges = mdThemeController.registerChanges(function (theme) { - $mdColors.applyThemeColors(element, parseColors(theme)); - }); - } - - scope.$on('$destroy', function () { - unregisterChanges(); - }); - - try { - if (shouldWatch) { - scope.$watch(parseColors, angular.bind(this, - $mdColors.applyThemeColors, element - ), true); - } - else { - $mdColors.applyThemeColors(element, parseColors()); - } - - } - catch (e) { - $log.error(e.message); - } - - }; - - /** - * @return {boolean} - */ - function shouldColorsWatch() { - // Simulate 1x binding and mark mdColorsWatch == false - var rawColorExpression = tAttrs.mdColors; - var bindOnce = rawColorExpression.indexOf('::') > -1; - var isStatic = bindOnce ? true : STATIC_COLOR_EXPRESSION.test(tAttrs.mdColors); - - // Remove it for the postLink... - tAttrs.mdColors = rawColorExpression.replace('::', ''); - - var hasWatchAttr = angular.isDefined(tAttrs.mdColorsWatch); - - return (bindOnce || isStatic) ? false : - hasWatchAttr ? $mdUtil.parseAttributeBoolean(tAttrs.mdColorsWatch) : true; - } - } - }; - } -})(); - -})(); -(function(){ -"use strict"; - -/** - * @ngdoc module - * @name material.components.content - * - * @description - * Scrollable content - */ -mdContentDirective.$inject = ["$mdTheming"]; -angular.module('material.components.content', [ - 'material.core' -]) - .directive('mdContent', mdContentDirective); - -/** - * @ngdoc directive - * @name mdContent - * @module material.components.content - * - * @restrict E - * - * @description - * - * The `` directive is a container element useful for scrollable content. It achieves - * this by setting the CSS `overflow` property to `auto` so that content can properly scroll. - * - * In general, `` components are not designed to be nested inside one another. If - * possible, it is better to make them siblings. This often results in a better user experience as - * having nested scrollbars may confuse the user. - * - * ## Troubleshooting - * - * In some cases, you may wish to apply the `md-no-momentum` class to ensure that Safari's - * momentum scrolling is disabled. Momentum scrolling can cause flickering issues while scrolling - * SVG icons and some other components. - * - * Additionally, we now also offer the `md-no-flicker` class which can be applied to any element - * and uses a Webkit-specific filter of `blur(0px)` that forces GPU rendering of all elements - * inside (which eliminates the flicker on iOS devices). - * - * _Note: Forcing an element to render on the GPU can have unintended side-effects, especially - * related to the z-index of elements. Please use with caution and only on the elements needed._ - * - * @usage - * - * Add the `[layout-padding]` attribute to make the content padded. - * - * - * - * Lorem ipsum dolor sit amet, ne quod novum mei. - * - * - */ - -function mdContentDirective($mdTheming) { - return { - restrict: 'E', - controller: ['$scope', '$element', ContentController], - link: function(scope, element) { - element.addClass('_md'); // private md component indicator for styling - - $mdTheming(element); - scope.$broadcast('$mdContentLoaded', element); - - iosScrollFix(element[0]); - } - }; - - function ContentController($scope, $element) { - this.$scope = $scope; - this.$element = $element; - } -} - -function iosScrollFix(node) { - // IOS FIX: - // If we scroll where there is no more room for the webview to scroll, - // by default the webview itself will scroll up and down, this looks really - // bad. So if we are scrolling to the very top or bottom, add/subtract one - angular.element(node).on('$md.pressdown', function(ev) { - // Only touch events - if (ev.pointer.type !== 't') return; - // Don't let a child content's touchstart ruin it for us. - if (ev.$materialScrollFixed) return; - ev.$materialScrollFixed = true; - - if (node.scrollTop === 0) { - node.scrollTop = 1; - } else if (node.scrollHeight === node.scrollTop + node.offsetHeight) { - node.scrollTop -= 1; - } - }); -} - -})(); -(function(){ -"use strict"; - -/** - * @ngdoc module - * @name material.components.datepicker - * @description Module for the datepicker component. - */ - -angular.module('material.components.datepicker', [ - 'material.core', - 'material.components.icon', - 'material.components.virtualRepeat' -]); - -})(); -(function(){ -"use strict"; - -(function() { - 'use strict'; - - /** - * @ngdoc directive - * @name mdCalendar - * @module material.components.datepicker - * - * @param {Date} ng-model The component's model. Should be a Date object. - * @param {Object=} ng-model-options Allows tuning of the way in which `ng-model` is being - * updated. Also allows for a timezone to be specified. - * Read more at the - * ngModelOptions docs. - * @param {Date=} md-min-date Expression representing the minimum date. - * @param {Date=} md-max-date Expression representing the maximum date. - * @param {(function(Date): boolean)=} md-date-filter Function expecting a date and returning a - * boolean whether it can be selected in "day" mode or not. - * @param {(function(Date): boolean)=} md-month-filter Function expecting a date and returning a - * boolean whether it can be selected in "month" mode or not. - * @param {String=} md-current-view Current view of the calendar. Can be either "month" or "year". - * @param {String=} md-mode Restricts the user to only selecting a value from a particular view. - * This option can be used if the user is only supposed to choose from a certain date type - * (e.g. only selecting the month). Can be either "month" or "day". **Note** that this will - * overwrite the `md-current-view` value. - * - * @description - * `` is a component that renders a calendar that can be used to select a date. - * It is a part of the `` pane, however it can also be used on it's own. - * - * @usage - * - * - * - * - */ - CalendarCtrl.$inject = ["$element", "$scope", "$$mdDateUtil", "$mdUtil", "$mdConstant", "$mdTheming", "$$rAF", "$attrs", "$mdDateLocale", "$filter", "$document"]; - calendarDirective.$inject = ["inputDirective"]; - angular.module('material.components.datepicker') - .directive('mdCalendar', calendarDirective); - - // TODO(jelbourn): Mac Cmd + left / right == Home / End - // TODO(jelbourn): Refactor month element creation to use cloneNode (performance). - // TODO(jelbourn): Define virtual scrolling constants (compactness) users can override. - // TODO(jelbourn): Animated month transition on ng-model change (virtual-repeat) - // TODO(jelbourn): Scroll snapping (virtual repeat) - // TODO(jelbourn): Remove superfluous row from short months (virtual-repeat) - // TODO(jelbourn): Month headers stick to top when scrolling. - // TODO(jelbourn): Previous month opacity is lowered when partially scrolled out of view. - // TODO(jelbourn): Support md-calendar standalone on a page (as a tabstop w/ aria-live - // announcement and key handling). - // TODO Read-only calendar (not just date-picker). - - function calendarDirective(inputDirective) { - return { - template: function(tElement, tAttr) { - // This allows the calendar to work, without a datepicker. This ensures that the virtual - // repeater scrolls to the proper place on load by deferring the execution until the next - // digest. It's necessary only if the calendar is used without a datepicker, otherwise it's - // already wrapped in an ngIf. - var extraAttrs = tAttr.hasOwnProperty('ngIf') ? '' : 'ng-if="calendarCtrl.isInitialized"'; - return '' + - '
    ' + - '' + - '' + - '
    '; - }, - scope: { - minDate: '=mdMinDate', - maxDate: '=mdMaxDate', - dateFilter: '=mdDateFilter', - monthFilter: '=mdMonthFilter', - - // These need to be prefixed, because Angular resets - // any changes to the value due to bindToController. - _mode: '@mdMode', - _currentView: '@mdCurrentView' - }, - require: ['ngModel', 'mdCalendar'], - controller: CalendarCtrl, - controllerAs: 'calendarCtrl', - bindToController: true, - link: function(scope, element, attrs, controllers) { - var ngModelCtrl = controllers[0]; - var mdCalendarCtrl = controllers[1]; - mdCalendarCtrl.configureNgModel(ngModelCtrl, inputDirective); - } - }; - } - - /** - * Occasionally the hideVerticalScrollbar method might read an element's - * width as 0, because it hasn't been laid out yet. This value will be used - * as a fallback, in order to prevent scenarios where the element's width - * would otherwise have been set to 0. This value is the "usual" width of a - * calendar within a floating calendar pane. - */ - var FALLBACK_WIDTH = 340; - - /** Next identifier for calendar instance. */ - var nextUniqueId = 0; - - /** Maps the `md-mode` values to their corresponding calendar views. */ - var MODE_MAP = { - day: 'month', - month: 'year' - }; - - /** - * Controller for the mdCalendar component. - * @ngInject @constructor - */ - function CalendarCtrl($element, $scope, $$mdDateUtil, $mdUtil, $mdConstant, $mdTheming, $$rAF, - $attrs, $mdDateLocale, $filter, $document) { - $mdTheming($element); - - /** - * @final - * @type {!JQLite} - */ - this.$element = $element; - - /** - * @final - * @type {!angular.Scope} - */ - this.$scope = $scope; - - /** - * @final - * @type {!angular.$attrs} Current attributes object for the element - */ - this.$attrs = $attrs; - - /** @final */ - this.dateUtil = $$mdDateUtil; - - /** @final */ - this.$mdUtil = $mdUtil; - - /** @final */ - this.keyCode = $mdConstant.KEY_CODE; - - /** @final */ - this.$$rAF = $$rAF; - - /** @final */ - this.$mdDateLocale = $mdDateLocale; - - /** @final The built-in Angular date filter. */ - this.ngDateFilter = $filter('date'); - - /** - * @final - * @type {Date} - */ - this.today = this.dateUtil.createDateAtMidnight(); - - /** @type {!ngModel.NgModelController} */ - this.ngModelCtrl = undefined; - - /** @type {string} Class applied to the selected date cell. */ - this.SELECTED_DATE_CLASS = 'md-calendar-selected-date'; - - /** @type {string} Class applied to the cell for today. */ - this.TODAY_CLASS = 'md-calendar-date-today'; - - /** @type {string} Class applied to the focused cell. */ - this.FOCUSED_DATE_CLASS = 'md-focus'; - - /** - * @final - * @type {number} Unique ID for this calendar instance. - */ - this.id = nextUniqueId++; - - /** - * The date that is currently focused or showing in the calendar. This will initially be set - * to the ng-model value if set, otherwise to today. It will be updated as the user navigates - * to other months. The cell corresponding to the displayDate does not necessarily always have - * focus in the document (such as for cases when the user is scrolling the calendar). - * @type {Date} - */ - this.displayDate = null; - - /** - * Allows restricting the calendar to only allow selecting a month or a day. - * @type {'month'|'day'|null} - */ - this.mode = null; - - /** - * The selected date. Keep track of this separately from the ng-model value so that we - * can know, when the ng-model value changes, what the previous value was before it's updated - * in the component's UI. - * - * @type {Date} - */ - this.selectedDate = null; - - /** - * The first date that can be rendered by the calendar. The default is taken - * from the mdDateLocale provider and is limited by the mdMinDate. - * @type {Date} - */ - this.firstRenderableDate = null; - - /** - * The last date that can be rendered by the calendar. The default comes - * from the mdDateLocale provider and is limited by the maxDate. - * @type {Date} - */ - this.lastRenderableDate = null; - - /** - * Used to toggle initialize the root element in the next digest. - * @type {boolean} - */ - this.isInitialized = false; - - /** - * Cache for the width of the element without a scrollbar. Used to hide the scrollbar later on - * and to avoid extra reflows when switching between views. - * @type {number} - */ - this.width = 0; - - /** - * Caches the width of the scrollbar in order to be used when hiding it and to avoid extra reflows. - * @type {number} - */ - this.scrollbarWidth = 0; - - /** - * @type {boolean} set to true if the calendar is being used "standalone" (outside of a - * md-datepicker). - */ - this.standaloneMode = false; - - // Unless the user specifies so, the calendar should not be a tab stop. - // This is necessary because ngAria might add a tabindex to anything with an ng-model - // (based on whether or not the user has turned that particular feature on/off). - if (!$attrs.tabindex) { - $element.attr('tabindex', '-1'); - } - - var boundKeyHandler = angular.bind(this, this.handleKeyEvent); - - // If use the md-calendar directly in the body without datepicker, - // handleKeyEvent will disable other inputs on the page. - // So only apply the handleKeyEvent on the body when the md-calendar inside datepicker, - // otherwise apply on the calendar element only. - - var handleKeyElement; - if ($element.parent().hasClass('md-datepicker-calendar')) { - handleKeyElement = angular.element($document[0].body); - } else { - this.standaloneMode = true; - handleKeyElement = $element; - } - - // Bind the keydown handler to the body, in order to handle cases where the focused - // element gets removed from the DOM and stops propagating click events. - handleKeyElement.on('keydown', boundKeyHandler); - - $scope.$on('$destroy', function() { - handleKeyElement.off('keydown', boundKeyHandler); - }); - - // For AngularJS 1.4 and older, where there are no lifecycle hooks but bindings are pre-assigned, - // manually call the $onInit hook. - if (angular.version.major === 1 && angular.version.minor <= 4) { - this.$onInit(); - } - } - - /** - * AngularJS Lifecycle hook for newer AngularJS versions. - * Bindings are not guaranteed to have been assigned in the controller, but they are in the - * $onInit hook. - */ - CalendarCtrl.prototype.$onInit = function() { - /** - * The currently visible calendar view. Note the prefix on the scope value, - * which is necessary, because the datepicker seems to reset the real one value if the - * calendar is open, but the `currentView` on the datepicker's scope is empty. - * @type {String} - */ - if (this._mode && MODE_MAP.hasOwnProperty(this._mode)) { - this.currentView = MODE_MAP[this._mode]; - this.mode = this._mode; - } else { - this.currentView = this._currentView || 'month'; - this.mode = null; - } - - if (this.minDate && this.minDate > this.$mdDateLocale.firstRenderableDate) { - this.firstRenderableDate = this.minDate; - } else { - this.firstRenderableDate = this.$mdDateLocale.firstRenderableDate; - } - - if (this.maxDate && this.maxDate < this.$mdDateLocale.lastRenderableDate) { - this.lastRenderableDate = this.maxDate; - } else { - this.lastRenderableDate = this.$mdDateLocale.lastRenderableDate; - } - }; - - /** - * Sets up the controller's reference to ngModelController. - * @param {!ngModel.NgModelController} ngModelCtrl Instance of the ngModel controller. - * @param {Object} inputDirective Config for AngularJS's `input` directive. - */ - CalendarCtrl.prototype.configureNgModel = function(ngModelCtrl, inputDirective) { - var self = this; - self.ngModelCtrl = ngModelCtrl; - - // The component needs to be [type="date"] in order to be picked up by AngularJS. - this.$attrs.$set('type', 'date'); - - // Invoke the `input` directive link function, adding a stub for the element. - // This allows us to re-use AngularJS' logic for setting the timezone via ng-model-options. - // It works by calling the link function directly which then adds the proper `$parsers` and - // `$formatters` to the NgModelController. - inputDirective[0].link.pre(this.$scope, { - on: angular.noop, - val: angular.noop, - 0: {} - }, this.$attrs, [ngModelCtrl]); - - ngModelCtrl.$render = function() { - var value = this.$viewValue, convertedDate; - - // In the case where a conversion is needed, the $viewValue here will be a string like - // "2020-05-10" instead of a Date object. - if (!self.dateUtil.isValidDate(value)) { - convertedDate = self.dateUtil.removeLocalTzAndReparseDate(new Date(value)); - if (self.dateUtil.isValidDate(convertedDate)) { - value = convertedDate; - } - } - - // Notify the child scopes of any changes. - self.$scope.$broadcast('md-calendar-parent-changed', value); - - // Set up the selectedDate if it hasn't been already. - if (!self.selectedDate) { - self.selectedDate = value; - } - - // Also set up the displayDate. - if (!self.displayDate) { - self.displayDate = self.selectedDate || self.today; - } - }; - - self.$mdUtil.nextTick(function() { - self.isInitialized = true; - }); - }; - - /** - * Sets the ng-model value for the calendar and emits a change event. - * @param {Date} date new value for the calendar - */ - CalendarCtrl.prototype.setNgModelValue = function(date) { - var timezone = this.$mdUtil.getModelOption(this.ngModelCtrl, 'timezone'); - var value = this.dateUtil.createDateAtMidnight(date); - this.focusDate(value); - this.$scope.$emit('md-calendar-change', value); - // Using the timezone when the offset is negative (GMT+X) causes the previous day to be - // selected here. This check avoids that. - if (timezone == null || value.getTimezoneOffset() < 0) { - this.ngModelCtrl.$setViewValue(this.ngDateFilter(value, 'yyyy-MM-dd'), 'default'); - } else { - this.ngModelCtrl.$setViewValue(this.ngDateFilter(value, 'yyyy-MM-dd', timezone), 'default'); - } - this.ngModelCtrl.$render(); - return value; - }; - - /** - * Sets the current view that should be visible in the calendar - * @param {string} newView View name to be set. - * @param {number|Date} time Date object or a timestamp for the new display date. - */ - CalendarCtrl.prototype.setCurrentView = function(newView, time) { - var self = this; - - self.$mdUtil.nextTick(function() { - self.currentView = newView; - - if (time) { - self.displayDate = angular.isDate(time) ? time : new Date(time); - } - }); - }; - - /** - * Focus the cell corresponding to the given date. - * @param {Date=} date The date to be focused. - */ - CalendarCtrl.prototype.focusDate = function(date) { - if (this.dateUtil.isValidDate(date)) { - var previousFocus = this.$element[0].querySelector('.' + this.FOCUSED_DATE_CLASS); - if (previousFocus) { - previousFocus.classList.remove(this.FOCUSED_DATE_CLASS); - } - - var cellId = this.getDateId(date, this.currentView); - var cell = document.getElementById(cellId); - if (cell) { - cell.classList.add(this.FOCUSED_DATE_CLASS); - cell.focus(); - this.displayDate = date; - } - } else { - var rootElement = this.$element[0].querySelector('[ng-switch]'); - - if (rootElement) { - rootElement.focus(); - } - } - }; - - /** - * Highlights a date cell on the calendar and changes the selected date. - * @param {Date=} date Date to be marked as selected. - */ - CalendarCtrl.prototype.changeSelectedDate = function(date) { - var selectedDateClass = this.SELECTED_DATE_CLASS; - var prevDateCell = this.$element[0].querySelector('.' + selectedDateClass); - - // Remove the selected class from the previously selected date, if any. - if (prevDateCell) { - prevDateCell.classList.remove(selectedDateClass); - prevDateCell.setAttribute('aria-selected', 'false'); - } - - // Apply the select class to the new selected date if it is set. - if (date) { - var dateCell = document.getElementById(this.getDateId(date, this.currentView)); - if (dateCell) { - dateCell.classList.add(selectedDateClass); - dateCell.setAttribute('aria-selected', 'true'); - } - } - - this.selectedDate = date; - }; - - /** - * Normalizes the key event into an action name. The action will be broadcast - * to the child controllers. - * @param {KeyboardEvent} event - * @returns {string} The action that should be taken, or null if the key - * does not match a calendar shortcut. - */ - CalendarCtrl.prototype.getActionFromKeyEvent = function(event) { - var keyCode = this.keyCode; - - switch (event.which) { - case keyCode.ENTER: return 'select'; - - case keyCode.RIGHT_ARROW: return 'move-right'; - case keyCode.LEFT_ARROW: return 'move-left'; - - case keyCode.DOWN_ARROW: return event.metaKey ? 'move-page-down' : 'move-row-down'; - case keyCode.UP_ARROW: return event.metaKey ? 'move-page-up' : 'move-row-up'; - - case keyCode.PAGE_DOWN: return 'move-page-down'; - case keyCode.PAGE_UP: return 'move-page-up'; - - case keyCode.HOME: return 'start'; - case keyCode.END: return 'end'; - - default: return null; - } - }; - - /** - * Handles a key event in the calendar with the appropriate action. - * The action will either - * - select the focused date - * - navigate to focus a new date - * - emit a md-calendar-close event if in a md-datepicker panel - * - emit a md-calendar-parent-action - * - delegate to normal tab order if the TAB key is pressed in standalone mode - * @param {KeyboardEvent} event - */ - CalendarCtrl.prototype.handleKeyEvent = function(event) { - var self = this; - - this.$scope.$apply(function() { - // Capture escape and emit back up so that a wrapping component - // (such as a date-picker) can decide to close. - if (event.which === self.keyCode.ESCAPE || - (event.which === self.keyCode.TAB && !self.standaloneMode)) { - self.$scope.$emit('md-calendar-close'); - - if (event.which === self.keyCode.TAB) { - event.preventDefault(); - } - - return; - } else if (event.which === self.keyCode.TAB && self.standaloneMode) { - // delegate to the normal tab order if the TAB key is pressed in standalone mode - return; - } - - // Broadcast the action that any child controllers should take. - var action = self.getActionFromKeyEvent(event); - if (action) { - event.preventDefault(); - event.stopPropagation(); - self.$scope.$broadcast('md-calendar-parent-action', action); - } - }); - }; - - /** - * Hides the vertical scrollbar on the calendar scroller of a child controller by - * setting the width on the calendar scroller and the `overflow: hidden` wrapper - * around the scroller, and then setting a padding-right on the scroller equal - * to the width of the browser's scrollbar. - * - * This will cause a reflow. - * - * @param {object} childCtrl The child controller whose scrollbar should be hidden. - */ - CalendarCtrl.prototype.hideVerticalScrollbar = function(childCtrl) { - var self = this; - var element = childCtrl.$element[0]; - var scrollMask = element.querySelector('.md-calendar-scroll-mask'); - - if (self.width > 0) { - setWidth(); - } else { - self.$$rAF(function() { - var scroller = childCtrl.calendarScroller; - - self.scrollbarWidth = scroller.offsetWidth - scroller.clientWidth; - self.width = element.querySelector('table').offsetWidth; - setWidth(); - }); - } - - function setWidth() { - var width = self.width || FALLBACK_WIDTH; - var scrollbarWidth = self.scrollbarWidth; - var scroller = childCtrl.calendarScroller; - - scrollMask.style.width = width + 'px'; - scroller.style.width = (width + scrollbarWidth) + 'px'; - scroller.style.paddingRight = scrollbarWidth + 'px'; - } - }; - - /** - * Gets an identifier for a date unique to the calendar instance for internal - * purposes. Not to be displayed. - * @param {Date} date The date for which the id is being generated - * @param {string} namespace Namespace for the id. (month, year etc.) - * @returns {string} - */ - CalendarCtrl.prototype.getDateId = function(date, namespace) { - if (!namespace) { - throw new Error('A namespace for the date id has to be specified.'); - } - - return [ - 'md', - this.id, - namespace, - date.getFullYear(), - date.getMonth(), - date.getDate() - ].join('-'); - }; - - /** - * Util to trigger an extra digest on a parent scope, in order to to ensure that - * any child virtual repeaters have updated. This is necessary, because the virtual - * repeater doesn't update the $index the first time around since the content isn't - * in place yet. The case, in which this is an issue, is when the repeater has less - * than a page of content (e.g. a month or year view has a min or max date). - */ - CalendarCtrl.prototype.updateVirtualRepeat = function() { - var scope = this.$scope; - var virtualRepeatResizeListener = scope.$on('$md-resize-enable', function() { - if (!scope.$$phase) { - scope.$apply(); - } - - virtualRepeatResizeListener(); - }); - }; -})(); - -})(); -(function(){ -"use strict"; - -(function() { - 'use strict'; - - CalendarMonthCtrl.$inject = ["$element", "$scope", "$animate", "$q", "$$mdDateUtil", "$mdDateLocale"]; - angular.module('material.components.datepicker') - .directive('mdCalendarMonth', calendarDirective); - - /** - * Height of one calendar month tbody. This must be made known to the virtual-repeat and is - * subsequently used for scrolling to specific months. - */ - var TBODY_HEIGHT = 265; - - /** - * Height of a calendar month with a single row. This is needed to calculate the offset for - * rendering an extra month in virtual-repeat that only contains one row. - */ - var TBODY_SINGLE_ROW_HEIGHT = 45; - - /** Private directive that represents a list of months inside the calendar. */ - function calendarDirective() { - return { - template: - '' + - '
    ' + - '' + - '' + - '' + - - // The ensures that the will always have the - // proper height, even if it's empty. If it's content is - // compiled, the will be overwritten. - '' + - '' + - '
    ' + - '
    ' + - '
    ', - require: ['^^mdCalendar', 'mdCalendarMonth'], - controller: CalendarMonthCtrl, - controllerAs: 'monthCtrl', - bindToController: true, - link: function(scope, element, attrs, controllers) { - var calendarCtrl = controllers[0]; - var monthCtrl = controllers[1]; - monthCtrl.initialize(calendarCtrl); - } - }; - } - - /** - * Controller for the calendar month component. - * @ngInject @constructor - */ - function CalendarMonthCtrl($element, $scope, $animate, $q, - $$mdDateUtil, $mdDateLocale) { - - /** @final {!angular.JQLite} */ - this.$element = $element; - - /** @final {!angular.Scope} */ - this.$scope = $scope; - - /** @final {!angular.$animate} */ - this.$animate = $animate; - - /** @final {!angular.$q} */ - this.$q = $q; - - /** @final */ - this.dateUtil = $$mdDateUtil; - - /** @final */ - this.dateLocale = $mdDateLocale; - - /** @final {HTMLElement} */ - this.calendarScroller = $element[0].querySelector('.md-virtual-repeat-scroller'); - - /** @type {boolean} */ - this.isInitialized = false; - - /** @type {boolean} */ - this.isMonthTransitionInProgress = false; - - var self = this; - - /** - * Handles a click event on a date cell. - * Created here so that every cell can use the same function instance. - * @this {HTMLTableCellElement} The cell that was clicked. - */ - this.cellClickHandler = function() { - var timestamp = $$mdDateUtil.getTimestampFromNode(this); - self.$scope.$apply(function() { - // The timestamp has to be converted to a valid date. - self.calendarCtrl.setNgModelValue(new Date(timestamp)); - }); - }; - - /** - * Handles click events on the month headers. Switches - * the calendar to the year view. - * @this {HTMLTableCellElement} The cell that was clicked. - */ - this.headerClickHandler = function() { - self.calendarCtrl.setCurrentView('year', $$mdDateUtil.getTimestampFromNode(this)); - }; - } - - /** Initialization **/ - - /** - * Initialize the controller by saving a reference to the calendar and - * setting up the object that will be iterated by the virtual repeater. - */ - CalendarMonthCtrl.prototype.initialize = function(calendarCtrl) { - /** - * Dummy array-like object for virtual-repeat to iterate over. The length is the total - * number of months that can be viewed. We add 2 months: one to include the current month - * and one for the last dummy month. - * - * This is shorter than ideal because of a (potential) Firefox bug - * https://bugzilla.mozilla.org/show_bug.cgi?id=1181658. - */ - - this.items = { - length: this.dateUtil.getMonthDistance( - calendarCtrl.firstRenderableDate, - calendarCtrl.lastRenderableDate - ) + 2 - }; - - this.calendarCtrl = calendarCtrl; - this.attachScopeListeners(); - calendarCtrl.updateVirtualRepeat(); - - // Fire the initial render, since we might have missed it the first time it fired. - calendarCtrl.ngModelCtrl && calendarCtrl.ngModelCtrl.$render(); - }; - - /** - * Gets the "index" of the currently selected date as it would be in the virtual-repeat. - * @returns {number} the "index" of the currently selected date - */ - CalendarMonthCtrl.prototype.getSelectedMonthIndex = function() { - var calendarCtrl = this.calendarCtrl; - - return this.dateUtil.getMonthDistance( - calendarCtrl.firstRenderableDate, - calendarCtrl.displayDate || calendarCtrl.selectedDate || calendarCtrl.today - ); - }; - - /** - * Change the date that is being shown in the calendar. If the given date is in a different - * month, the displayed month will be transitioned. - * @param {Date} date - */ - CalendarMonthCtrl.prototype.changeDisplayDate = function(date) { - // Initialization is deferred until this function is called because we want to reflect - // the starting value of ngModel. - if (!this.isInitialized) { - this.buildWeekHeader(); - this.calendarCtrl.hideVerticalScrollbar(this); - this.isInitialized = true; - return this.$q.when(); - } - - // If trying to show an invalid date or a transition is in progress, do nothing. - if (!this.dateUtil.isValidDate(date) || this.isMonthTransitionInProgress) { - return this.$q.when(); - } - - this.isMonthTransitionInProgress = true; - var animationPromise = this.animateDateChange(date); - - this.calendarCtrl.displayDate = date; - - var self = this; - animationPromise.then(function() { - self.isMonthTransitionInProgress = false; - }); - - return animationPromise; - }; - - /** - * Animates the transition from the calendar's current month to the given month. - * @param {Date} date - * @returns {angular.$q.Promise} The animation promise. - */ - CalendarMonthCtrl.prototype.animateDateChange = function(date) { - if (this.dateUtil.isValidDate(date)) { - var monthDistance = this.dateUtil.getMonthDistance(this.calendarCtrl.firstRenderableDate, date); - this.calendarScroller.scrollTop = monthDistance * TBODY_HEIGHT; - } - - return this.$q.when(); - }; - - /** - * Builds and appends a day-of-the-week header to the calendar. - * This should only need to be called once during initialization. - */ - CalendarMonthCtrl.prototype.buildWeekHeader = function() { - var firstDayOfWeek = this.dateLocale.firstDayOfWeek; - var shortDays = this.dateLocale.shortDays; - - var row = document.createElement('tr'); - for (var i = 0; i < 7; i++) { - var th = document.createElement('th'); - th.textContent = shortDays[(i + firstDayOfWeek) % 7]; - row.appendChild(th); - } - - this.$element.find('thead').append(row); - }; - - /** - * Attaches listeners for the scope events that are broadcast by the calendar. - */ - CalendarMonthCtrl.prototype.attachScopeListeners = function() { - var self = this; - - self.$scope.$on('md-calendar-parent-changed', function(event, value) { - self.calendarCtrl.changeSelectedDate(value); - self.changeDisplayDate(value); - }); - - self.$scope.$on('md-calendar-parent-action', angular.bind(this, this.handleKeyEvent)); - }; - - /** - * Handles the month-specific keyboard interactions. - * @param {Object} event Scope event object passed by the calendar. - * @param {String} action Action, corresponding to the key that was pressed. - */ - CalendarMonthCtrl.prototype.handleKeyEvent = function(event, action) { - var calendarCtrl = this.calendarCtrl; - var displayDate = calendarCtrl.displayDate; - - if (action === 'select') { - calendarCtrl.setNgModelValue(displayDate); - } else { - var date = null; - var dateUtil = this.dateUtil; - - switch (action) { - case 'move-right': date = dateUtil.incrementDays(displayDate, 1); break; - case 'move-left': date = dateUtil.incrementDays(displayDate, -1); break; - - case 'move-page-down': date = dateUtil.incrementMonths(displayDate, 1); break; - case 'move-page-up': date = dateUtil.incrementMonths(displayDate, -1); break; - - case 'move-row-down': date = dateUtil.incrementDays(displayDate, 7); break; - case 'move-row-up': date = dateUtil.incrementDays(displayDate, -7); break; - - case 'start': date = dateUtil.getFirstDateOfMonth(displayDate); break; - case 'end': date = dateUtil.getLastDateOfMonth(displayDate); break; - } - - if (date) { - date = this.dateUtil.clampDate(date, calendarCtrl.minDate, calendarCtrl.maxDate); - - this.changeDisplayDate(date).then(function() { - calendarCtrl.focusDate(date); - }); - } - } - }; -})(); - -})(); -(function(){ -"use strict"; - -(function() { - 'use strict'; - - mdCalendarMonthBodyDirective.$inject = ["$compile", "$$mdSvgRegistry"]; - CalendarMonthBodyCtrl.$inject = ["$element", "$$mdDateUtil", "$mdDateLocale"]; - angular.module('material.components.datepicker') - .directive('mdCalendarMonthBody', mdCalendarMonthBodyDirective); - - /** - * Private directive consumed by md-calendar-month. Having this directive lets the calender use - * md-virtual-repeat and also cleanly separates the month DOM construction functions from - * the rest of the calendar controller logic. - * @ngInject - */ - function mdCalendarMonthBodyDirective($compile, $$mdSvgRegistry) { - var ARROW_ICON = $compile('')({})[0]; - - return { - require: ['^^mdCalendar', '^^mdCalendarMonth', 'mdCalendarMonthBody'], - scope: { offset: '=mdMonthOffset' }, - controller: CalendarMonthBodyCtrl, - controllerAs: 'mdMonthBodyCtrl', - bindToController: true, - link: function(scope, element, attrs, controllers) { - var calendarCtrl = controllers[0]; - var monthCtrl = controllers[1]; - var monthBodyCtrl = controllers[2]; - - monthBodyCtrl.calendarCtrl = calendarCtrl; - monthBodyCtrl.monthCtrl = monthCtrl; - monthBodyCtrl.arrowIcon = ARROW_ICON.cloneNode(true); - - // The virtual-repeat re-uses the same DOM elements, so there are only a limited number - // of repeated items that are linked, and then those elements have their bindings updated. - // Since the months are not generated by bindings, we simply regenerate the entire thing - // when the binding (offset) changes. - scope.$watch(function() { return monthBodyCtrl.offset; }, function(offset) { - if (angular.isNumber(offset)) { - monthBodyCtrl.generateContent(); - } - }); - } - }; - } - - /** - * Controller for a single calendar month. - * @ngInject @constructor - */ - function CalendarMonthBodyCtrl($element, $$mdDateUtil, $mdDateLocale) { - /** - * @final - * @type {!JQLite} - */ - this.$element = $element; - - /** @final */ - this.dateUtil = $$mdDateUtil; - - /** @final */ - this.dateLocale = $mdDateLocale; - - /** @type {Object} Reference to the month view. */ - this.monthCtrl = null; - - /** @type {Object} Reference to the calendar. */ - this.calendarCtrl = null; - - /** - * Number of months from the start of the month "items" that the currently rendered month - * occurs. Set via angular data binding. - * @type {number|null} - */ - this.offset = null; - - /** - * Date cell to focus after appending the month to the document. - * @type {HTMLElement} - */ - this.focusAfterAppend = null; - } - - /** Generate and append the content for this month to the directive element. */ - CalendarMonthBodyCtrl.prototype.generateContent = function() { - var date = this.dateUtil.incrementMonths(this.calendarCtrl.firstRenderableDate, this.offset); - - this.$element - .empty() - .append(this.buildCalendarForMonth(date)); - - if (this.focusAfterAppend) { - this.focusAfterAppend.classList.add(this.calendarCtrl.FOCUSED_DATE_CLASS); - this.focusAfterAppend = null; - } - }; - - /** - * Creates a single cell to contain a date in the calendar with all appropriate - * attributes and classes added. If a date is given, the cell content will be set - * based on the date. - * @param {Date=} opt_date - * @returns {HTMLElement} - */ - CalendarMonthBodyCtrl.prototype.buildDateCell = function(opt_date) { - var monthCtrl = this.monthCtrl; - var calendarCtrl = this.calendarCtrl; - - // TODO(jelbourn): cloneNode is likely a faster way of doing this. - var cell = document.createElement('td'); - cell.tabIndex = -1; - cell.classList.add('md-calendar-date'); - cell.setAttribute('role', 'gridcell'); - - if (opt_date) { - cell.setAttribute('tabindex', '-1'); - cell.setAttribute('aria-label', this.dateLocale.longDateFormatter(opt_date)); - cell.id = calendarCtrl.getDateId(opt_date, 'month'); - - // Use `data-timestamp` attribute because IE10 does not support the `dataset` property. - cell.setAttribute('data-timestamp', opt_date.getTime()); - - // TODO(jelourn): Doing these comparisons for class addition during generation might be slow. - // It may be better to finish the construction and then query the node and add the class. - if (this.dateUtil.isSameDay(opt_date, calendarCtrl.today)) { - cell.classList.add(calendarCtrl.TODAY_CLASS); - } - - if (this.dateUtil.isValidDate(calendarCtrl.selectedDate) && - this.dateUtil.isSameDay(opt_date, calendarCtrl.selectedDate)) { - cell.classList.add(calendarCtrl.SELECTED_DATE_CLASS); - cell.setAttribute('aria-selected', 'true'); - } - - var cellText = this.dateLocale.dates[opt_date.getDate()]; - - if (this.isDateEnabled(opt_date)) { - // Add a indicator for select, hover, and focus states. - var selectionIndicator = document.createElement('span'); - selectionIndicator.classList.add('md-calendar-date-selection-indicator'); - selectionIndicator.textContent = cellText; - cell.appendChild(selectionIndicator); - cell.addEventListener('click', monthCtrl.cellClickHandler); - - if (calendarCtrl.displayDate && this.dateUtil.isSameDay(opt_date, calendarCtrl.displayDate)) { - this.focusAfterAppend = cell; - } - } else { - cell.classList.add('md-calendar-date-disabled'); - cell.textContent = cellText; - } - } - - return cell; - }; - - /** - * Check whether date is in range and enabled - * @param {Date=} opt_date - * @return {boolean} Whether the date is enabled. - */ - CalendarMonthBodyCtrl.prototype.isDateEnabled = function(opt_date) { - return this.dateUtil.isDateWithinRange(opt_date, - this.calendarCtrl.minDate, this.calendarCtrl.maxDate) && - (!angular.isFunction(this.calendarCtrl.dateFilter) - || this.calendarCtrl.dateFilter(opt_date)); - }; - - /** - * Builds a `tr` element for the calendar grid. - * @param rowNumber The week number within the month. - * @returns {HTMLElement} - */ - CalendarMonthBodyCtrl.prototype.buildDateRow = function(rowNumber) { - var row = document.createElement('tr'); - row.setAttribute('role', 'row'); - - // Because of an NVDA bug (with Firefox), the row needs an aria-label in order - // to prevent the entire row being read aloud when the user moves between rows. - // See http://community.nvda-project.org/ticket/4643. - row.setAttribute('aria-label', this.dateLocale.weekNumberFormatter(rowNumber)); - - return row; - }; - - /** - * Builds the content for the given date's month. - * @param {Date=} opt_dateInMonth - * @returns {DocumentFragment} A document fragment containing the elements. - */ - CalendarMonthBodyCtrl.prototype.buildCalendarForMonth = function(opt_dateInMonth) { - var date = this.dateUtil.isValidDate(opt_dateInMonth) ? opt_dateInMonth : new Date(); - - var firstDayOfMonth = this.dateUtil.getFirstDateOfMonth(date); - var firstDayOfTheWeek = this.getLocaleDay_(firstDayOfMonth); - var numberOfDaysInMonth = this.dateUtil.getNumberOfDaysInMonth(date); - - // Store rows for the month in a document fragment so that we can append them all at once. - var monthBody = document.createDocumentFragment(); - - var rowNumber = 1; - var row = this.buildDateRow(rowNumber); - monthBody.appendChild(row); - - // If this is the final month in the list of items, only the first week should render, - // so we should return immediately after the first row is complete and has been - // attached to the body. - var isFinalMonth = this.offset === this.monthCtrl.items.length - 1; - - // Add a label for the month. If the month starts on a Sun/Mon/Tues, the month label - // goes on a row above the first of the month. Otherwise, the month label takes up the first - // two cells of the first row. - var blankCellOffset = 0; - var monthLabelCell = document.createElement('td'); - var monthLabelCellContent = document.createElement('span'); - var calendarCtrl = this.calendarCtrl; - - monthLabelCellContent.textContent = this.dateLocale.monthHeaderFormatter(date); - monthLabelCell.appendChild(monthLabelCellContent); - monthLabelCell.classList.add('md-calendar-month-label'); - // If the entire month is after the max date, render the label as a disabled state. - if (calendarCtrl.maxDate && firstDayOfMonth > calendarCtrl.maxDate) { - monthLabelCell.classList.add('md-calendar-month-label-disabled'); - // If the user isn't supposed to be able to change views, render the - // label as usual, but disable the clicking functionality. - } else if (!calendarCtrl.mode) { - monthLabelCell.addEventListener('click', this.monthCtrl.headerClickHandler); - monthLabelCell.setAttribute('data-timestamp', firstDayOfMonth.getTime()); - monthLabelCell.setAttribute('aria-label', this.dateLocale.monthFormatter(date)); - monthLabelCell.classList.add('md-calendar-label-clickable'); - monthLabelCell.appendChild(this.arrowIcon.cloneNode(true)); - } - - if (firstDayOfTheWeek <= 2) { - monthLabelCell.setAttribute('colspan', '7'); - - var monthLabelRow = this.buildDateRow(); - monthLabelRow.appendChild(monthLabelCell); - monthBody.insertBefore(monthLabelRow, row); - - if (isFinalMonth) { - return monthBody; - } - } else { - blankCellOffset = 3; - monthLabelCell.setAttribute('colspan', '3'); - row.appendChild(monthLabelCell); - } - - // Add a blank cell for each day of the week that occurs before the first of the month. - // For example, if the first day of the month is a Tuesday, add blank cells for Sun and Mon. - // The blankCellOffset is needed in cases where the first N cells are used by the month label. - for (var i = blankCellOffset; i < firstDayOfTheWeek; i++) { - row.appendChild(this.buildDateCell()); - } - - // Add a cell for each day of the month, keeping track of the day of the week so that - // we know when to start a new row. - var dayOfWeek = firstDayOfTheWeek; - var iterationDate = firstDayOfMonth; - for (var d = 1; d <= numberOfDaysInMonth; d++) { - // If we've reached the end of the week, start a new row. - if (dayOfWeek === 7) { - // We've finished the first row, so we're done if this is the final month. - if (isFinalMonth) { - return monthBody; - } - dayOfWeek = 0; - rowNumber++; - row = this.buildDateRow(rowNumber); - monthBody.appendChild(row); - } - - iterationDate.setDate(d); - var cell = this.buildDateCell(iterationDate); - row.appendChild(cell); - - dayOfWeek++; - } - - // Ensure that the last row of the month has 7 cells. - while (row.childNodes.length < 7) { - row.appendChild(this.buildDateCell()); - } - - // Ensure that all months have 6 rows. This is necessary for now because the virtual-repeat - // requires that all items have exactly the same height. - while (monthBody.childNodes.length < 6) { - var whitespaceRow = this.buildDateRow(); - for (var j = 0; j < 7; j++) { - whitespaceRow.appendChild(this.buildDateCell()); - } - monthBody.appendChild(whitespaceRow); - } - - return monthBody; - }; - - /** - * Gets the day-of-the-week index for a date for the current locale. - * @private - * @param {Date} date - * @returns {number} The column index of the date in the calendar. - */ - CalendarMonthBodyCtrl.prototype.getLocaleDay_ = function(date) { - return (date.getDay() + (7 - this.dateLocale.firstDayOfWeek)) % 7; - }; -})(); - -})(); -(function(){ -"use strict"; - -(function() { - 'use strict'; - - CalendarYearCtrl.$inject = ["$element", "$scope", "$animate", "$q", "$$mdDateUtil", "$mdUtil"]; - angular.module('material.components.datepicker') - .directive('mdCalendarYear', calendarDirective); - - /** - * Height of one calendar year tbody. This must be made known to the virtual-repeat and is - * subsequently used for scrolling to specific years. - */ - var TBODY_HEIGHT = 88; - - /** Private component, representing a list of years in the calendar. */ - function calendarDirective() { - return { - template: - '
    ' + - '' + - '' + - '' + - // The ensures that the will have the proper - // height, even though it may be empty. - '' + - '' + - '
    ' + - '
    ' + - '
    ', - require: ['^^mdCalendar', 'mdCalendarYear'], - controller: CalendarYearCtrl, - controllerAs: 'yearCtrl', - bindToController: true, - link: function(scope, element, attrs, controllers) { - var calendarCtrl = controllers[0]; - var yearCtrl = controllers[1]; - yearCtrl.initialize(calendarCtrl); - } - }; - } - - /** - * Controller for the mdCalendar component. - * @ngInject @constructor - */ - function CalendarYearCtrl($element, $scope, $animate, $q, $$mdDateUtil, $mdUtil) { - - /** @final {!angular.JQLite} */ - this.$element = $element; - - /** @final {!angular.Scope} */ - this.$scope = $scope; - - /** @final {!angular.$animate} */ - this.$animate = $animate; - - /** @final {!angular.$q} */ - this.$q = $q; - - /** @final */ - this.dateUtil = $$mdDateUtil; - - /** @final {HTMLElement} */ - this.calendarScroller = $element[0].querySelector('.md-virtual-repeat-scroller'); - - /** @type {boolean} */ - this.isInitialized = false; - - /** @type {boolean} */ - this.isMonthTransitionInProgress = false; - - /** @final */ - this.$mdUtil = $mdUtil; - - var self = this; - - /** - * Handles a click event on a date cell. - * Created here so that every cell can use the same function instance. - * @this {HTMLTableCellElement} The cell that was clicked. - */ - this.cellClickHandler = function() { - self.onTimestampSelected($$mdDateUtil.getTimestampFromNode(this)); - }; - } - - /** - * Initialize the controller by saving a reference to the calendar and - * setting up the object that will be iterated by the virtual repeater. - */ - CalendarYearCtrl.prototype.initialize = function(calendarCtrl) { - /** - * Dummy array-like object for virtual-repeat to iterate over. The length is the total - * number of years that can be viewed. We add 1 extra in order to include the current year. - */ - - this.items = { - length: this.dateUtil.getYearDistance( - calendarCtrl.firstRenderableDate, - calendarCtrl.lastRenderableDate - ) + 1 - }; - - this.calendarCtrl = calendarCtrl; - this.attachScopeListeners(); - calendarCtrl.updateVirtualRepeat(); - - // Fire the initial render, since we might have missed it the first time it fired. - calendarCtrl.ngModelCtrl && calendarCtrl.ngModelCtrl.$render(); - }; - - /** - * Gets the "index" of the currently selected date as it would be in the virtual-repeat. - * @returns {number} - */ - CalendarYearCtrl.prototype.getFocusedYearIndex = function() { - var calendarCtrl = this.calendarCtrl; - - return this.dateUtil.getYearDistance( - calendarCtrl.firstRenderableDate, - calendarCtrl.displayDate || calendarCtrl.selectedDate || calendarCtrl.today - ); - }; - - /** - * Change the date that is highlighted in the calendar. - * @param {Date} date - */ - CalendarYearCtrl.prototype.changeDate = function(date) { - // Initialization is deferred until this function is called because we want to reflect - // the starting value of ngModel. - if (!this.isInitialized) { - this.calendarCtrl.hideVerticalScrollbar(this); - this.isInitialized = true; - return this.$q.when(); - } else if (this.dateUtil.isValidDate(date) && !this.isMonthTransitionInProgress) { - var self = this; - var animationPromise = this.animateDateChange(date); - - self.isMonthTransitionInProgress = true; - self.calendarCtrl.displayDate = date; - - return animationPromise.then(function() { - self.isMonthTransitionInProgress = false; - }); - } - }; - - /** - * Animates the transition from the calendar's current month to the given month. - * @param {Date} date - * @returns {angular.$q.Promise} The animation promise. - */ - CalendarYearCtrl.prototype.animateDateChange = function(date) { - if (this.dateUtil.isValidDate(date)) { - var monthDistance = this.dateUtil.getYearDistance(this.calendarCtrl.firstRenderableDate, date); - this.calendarScroller.scrollTop = monthDistance * TBODY_HEIGHT; - } - - return this.$q.when(); - }; - - /** - * Handles the year-view-specific keyboard interactions. - * @param {Object} event Scope event object passed by the calendar. - * @param {String} action Action, corresponding to the key that was pressed. - */ - CalendarYearCtrl.prototype.handleKeyEvent = function(event, action) { - var self = this; - var calendarCtrl = self.calendarCtrl; - var displayDate = calendarCtrl.displayDate; - - if (action === 'select') { - self.changeDate(displayDate).then(function() { - self.onTimestampSelected(displayDate); - }); - } else { - var date = null; - var dateUtil = self.dateUtil; - - switch (action) { - case 'move-right': date = dateUtil.incrementMonths(displayDate, 1); break; - case 'move-left': date = dateUtil.incrementMonths(displayDate, -1); break; - - case 'move-row-down': date = dateUtil.incrementMonths(displayDate, 6); break; - case 'move-row-up': date = dateUtil.incrementMonths(displayDate, -6); break; - } - - if (date) { - var min = calendarCtrl.minDate ? dateUtil.getFirstDateOfMonth(calendarCtrl.minDate) : null; - var max = calendarCtrl.maxDate ? dateUtil.getFirstDateOfMonth(calendarCtrl.maxDate) : null; - date = dateUtil.getFirstDateOfMonth(self.dateUtil.clampDate(date, min, max)); - - self.changeDate(date).then(function() { - calendarCtrl.focusDate(date); - }); - } - } - }; - - /** - * Attaches listeners for the scope events that are broadcast by the calendar. - */ - CalendarYearCtrl.prototype.attachScopeListeners = function() { - var self = this; - - self.$scope.$on('md-calendar-parent-changed', function(event, value) { - self.calendarCtrl.changeSelectedDate(value ? self.dateUtil.getFirstDateOfMonth(value) : value); - self.changeDate(value); - }); - - self.$scope.$on('md-calendar-parent-action', angular.bind(self, self.handleKeyEvent)); - }; - - /** - * Handles the behavior when a date is selected. Depending on the `mode` - * of the calendar, this can either switch back to the calendar view or - * set the model value. - * @param {number} timestamp The selected timestamp. - */ - CalendarYearCtrl.prototype.onTimestampSelected = function(timestamp) { - var calendarCtrl = this.calendarCtrl; - - if (calendarCtrl.mode) { - this.$mdUtil.nextTick(function() { - // The timestamp has to be converted to a valid date. - calendarCtrl.setNgModelValue(new Date(timestamp)); - }); - } else { - calendarCtrl.setCurrentView('month', timestamp); - } - }; -})(); - -})(); -(function(){ -"use strict"; - -(function() { - 'use strict'; - - CalendarYearBodyCtrl.$inject = ["$element", "$$mdDateUtil", "$mdDateLocale"]; - angular.module('material.components.datepicker') - .directive('mdCalendarYearBody', mdCalendarYearDirective); - - /** - * Private component, consumed by the md-calendar-year, which separates the DOM construction logic - * and allows for the year view to use md-virtual-repeat. - */ - function mdCalendarYearDirective() { - return { - require: ['^^mdCalendar', '^^mdCalendarYear', 'mdCalendarYearBody'], - scope: { offset: '=mdYearOffset' }, - controller: CalendarYearBodyCtrl, - controllerAs: 'mdYearBodyCtrl', - bindToController: true, - link: function(scope, element, attrs, controllers) { - var calendarCtrl = controllers[0]; - var yearCtrl = controllers[1]; - var yearBodyCtrl = controllers[2]; - - yearBodyCtrl.calendarCtrl = calendarCtrl; - yearBodyCtrl.yearCtrl = yearCtrl; - - scope.$watch(function() { return yearBodyCtrl.offset; }, function(offset) { - if (angular.isNumber(offset)) { - yearBodyCtrl.generateContent(); - } - }); - } - }; - } - - /** - * Controller for a single year. - * @ngInject @constructor - */ - function CalendarYearBodyCtrl($element, $$mdDateUtil, $mdDateLocale) { - /** - * @final - * @type {!JQLite} - */ - this.$element = $element; - - /** @final */ - this.dateUtil = $$mdDateUtil; - - /** @final */ - this.dateLocale = $mdDateLocale; - - /** @type {Object} Reference to the calendar. */ - this.calendarCtrl = null; - - /** @type {Object} Reference to the year view. */ - this.yearCtrl = null; - - /** - * Number of months from the start of the month "items" that the currently rendered month - * occurs. Set via angular data binding. - * @type {number|null} - */ - this.offset = null; - - /** - * Date cell to focus after appending the month to the document. - * @type {HTMLElement} - */ - this.focusAfterAppend = null; - } - - /** Generate and append the content for this year to the directive element. */ - CalendarYearBodyCtrl.prototype.generateContent = function() { - var date = this.dateUtil.incrementYears(this.calendarCtrl.firstRenderableDate, this.offset); - - this.$element - .empty() - .append(this.buildCalendarForYear(date)); - - if (this.focusAfterAppend) { - this.focusAfterAppend.classList.add(this.calendarCtrl.FOCUSED_DATE_CLASS); - this.focusAfterAppend = null; - } - }; - - /** - * Creates a single cell to contain a year in the calendar. - * @param {number} year Four-digit year. - * @param {number} month Zero-indexed month. - * @returns {HTMLElement} - */ - CalendarYearBodyCtrl.prototype.buildMonthCell = function(year, month) { - var calendarCtrl = this.calendarCtrl; - var yearCtrl = this.yearCtrl; - var cell = this.buildBlankCell(); - - // Represent this month/year as a date. - var firstOfMonth = new Date(year, month, 1); - cell.setAttribute('aria-label', this.dateLocale.monthFormatter(firstOfMonth)); - cell.id = calendarCtrl.getDateId(firstOfMonth, 'year'); - - // Use `data-timestamp` attribute because IE10 does not support the `dataset` property. - cell.setAttribute('data-timestamp', String(firstOfMonth.getTime())); - - if (this.dateUtil.isSameMonthAndYear(firstOfMonth, calendarCtrl.today)) { - cell.classList.add(calendarCtrl.TODAY_CLASS); - } - - if (this.dateUtil.isValidDate(calendarCtrl.selectedDate) && - this.dateUtil.isSameMonthAndYear(firstOfMonth, calendarCtrl.selectedDate)) { - cell.classList.add(calendarCtrl.SELECTED_DATE_CLASS); - cell.setAttribute('aria-selected', 'true'); - } - - var cellText = this.dateLocale.shortMonths[month]; - - if (this.dateUtil.isMonthWithinRange( - firstOfMonth, calendarCtrl.minDate, calendarCtrl.maxDate) && - (!angular.isFunction(calendarCtrl.monthFilter) || - calendarCtrl.monthFilter(firstOfMonth))) { - var selectionIndicator = document.createElement('span'); - selectionIndicator.classList.add('md-calendar-date-selection-indicator'); - selectionIndicator.textContent = cellText; - cell.appendChild(selectionIndicator); - cell.addEventListener('click', yearCtrl.cellClickHandler); - - if (calendarCtrl.displayDate && - this.dateUtil.isSameMonthAndYear(firstOfMonth, calendarCtrl.displayDate)) { - this.focusAfterAppend = cell; - } - } else { - cell.classList.add('md-calendar-date-disabled'); - cell.textContent = cellText; - } - - return cell; - }; - - /** - * Builds a blank cell. - * @return {HTMLElement} - */ - CalendarYearBodyCtrl.prototype.buildBlankCell = function() { - var cell = document.createElement('td'); - cell.tabIndex = -1; - cell.classList.add('md-calendar-date'); - cell.setAttribute('role', 'gridcell'); - - cell.setAttribute('tabindex', '-1'); - return cell; - }; - - /** - * Builds the content for the given year. - * @param {Date} date Date for which the content should be built. - * @returns {DocumentFragment} A document fragment containing the months within the year. - */ - CalendarYearBodyCtrl.prototype.buildCalendarForYear = function(date) { - // Store rows for the month in a document fragment so that we can append them all at once. - var year = date.getFullYear(); - var yearBody = document.createDocumentFragment(); - - var monthCell, i; - // First row contains label and Jan-Jun. - var firstRow = document.createElement('tr'); - var labelCell = document.createElement('td'); - labelCell.className = 'md-calendar-month-label'; - labelCell.textContent = String(year); - firstRow.appendChild(labelCell); - - for (i = 0; i < 6; i++) { - firstRow.appendChild(this.buildMonthCell(year, i)); - } - yearBody.appendChild(firstRow); - - // Second row contains a blank cell and Jul-Dec. - var secondRow = document.createElement('tr'); - secondRow.appendChild(this.buildBlankCell()); - for (i = 6; i < 12; i++) { - secondRow.appendChild(this.buildMonthCell(year, i)); - } - yearBody.appendChild(secondRow); - - return yearBody; - }; -})(); - -})(); -(function(){ -"use strict"; - -(function() { - 'use strict'; - - /** - * @ngdoc service - * @name $mdDateLocaleProvider - * @module material.components.datepicker - * - * @description - * The `$mdDateLocaleProvider` is the provider that creates the `$mdDateLocale` service. - * This provider that allows the user to specify messages, formatters, and parsers for date - * internationalization. The `$mdDateLocale` service itself is consumed by AngularJS Material - * components that deal with dates - * (i.e. mdDatepicker). - * - * @property {Array} months Array of month names (in order). - * @property {Array} shortMonths Array of abbreviated month names. - * @property {Array} days Array of the days of the week (in order). - * @property {Array} shortDays Array of abbreviated days of the week. - * @property {Array} dates Array of dates of the month. Only necessary for locales - * using a numeral system other than [1, 2, 3...]. - * @property {Array} firstDayOfWeek The first day of the week. Sunday = 0, Monday = 1, - * etc. - * @property {function(string): Date} parseDate Function that converts a date string to a Date - * object (the date portion). - * @property {function(Date, string): string} formatDate Function to format a date object to a - * string. The datepicker directive also provides the time zone, if it was specified. - * @property {function(Date): string} monthHeaderFormatter Function that returns the label for - * a month given a date. - * @property {function(Date): string} monthFormatter Function that returns the full name of a month - * for a given date. - * @property {function(number): string} weekNumberFormatter Function that returns a label for - * a week given the week number. - * @property {function(Date): string} longDateFormatter Function that formats a date into a long - * `aria-label` that is read by the screen reader when the focused date changes. - * @property {string} msgCalendar Translation of the label "Calendar" for the current locale. - * @property {string} msgOpenCalendar Translation of the button label "Open calendar" for the - * current locale. - * @property {Date} firstRenderableDate The date from which the datepicker calendar will begin - * rendering. Note that this will be ignored if a minimum date is set. - * Defaults to January 1st 1880. - * @property {Date} lastRenderableDate The last date that will be rendered by the datepicker - * calendar. Note that this will be ignored if a maximum date is set. - * Defaults to January 1st 2130. - * @property {function(string): boolean} isDateComplete Function to determine whether a string - * makes sense to be parsed to a `Date` object. Returns `true` if the date appears to be complete - * and parsing should occur. By default, this checks for 3 groups of text or numbers separated - * by delimiters. This means that by default, date strings must include a month, day, and year - * to be parsed and for the model to be updated. - * - * @usage - * - * myAppModule.config(function($mdDateLocaleProvider) { - * - * // Example of a French localization. - * $mdDateLocaleProvider.months = ['janvier', 'février', 'mars', ...]; - * $mdDateLocaleProvider.shortMonths = ['janv', 'févr', 'mars', ...]; - * $mdDateLocaleProvider.days = ['dimanche', 'lundi', 'mardi', ...]; - * $mdDateLocaleProvider.shortDays = ['Di', 'Lu', 'Ma', ...]; - * - * // Can change week display to start on Monday. - * $mdDateLocaleProvider.firstDayOfWeek = 1; - * - * // Optional. - * $mdDateLocaleProvider.dates = [1, 2, 3, 4, 5, 6, ...]; - * - * // Example uses moment.js to parse and format dates. - * $mdDateLocaleProvider.parseDate = function(dateString) { - * var m = moment(dateString, 'L', true); - * return m.isValid() ? m.toDate() : new Date(NaN); - * }; - * - * $mdDateLocaleProvider.formatDate = function(date) { - * var m = moment(date); - * return m.isValid() ? m.format('L') : ''; - * }; - * - * // Allow only a day and month to be specified. - * // This is required if using the 'M/D' format with moment.js. - * $mdDateLocaleProvider.isDateComplete = function(dateString) { - * dateString = dateString.trim(); - * - * // Look for two chunks of content (either numbers or text) separated by delimiters. - * var re = /^(([a-zA-Z]{3,}|[0-9]{1,4})([ .,]+|[/-]))([a-zA-Z]{3,}|[0-9]{1,4})/; - * return re.test(dateString); - * }; - * - * $mdDateLocaleProvider.monthHeaderFormatter = function(date) { - * return myShortMonths[date.getMonth()] + ' ' + date.getFullYear(); - * }; - * - * // In addition to date display, date components also need localized messages - * // for aria-labels for screen-reader users. - * - * $mdDateLocaleProvider.weekNumberFormatter = function(weekNumber) { - * return 'Semaine ' + weekNumber; - * }; - * - * $mdDateLocaleProvider.msgCalendar = 'Calendrier'; - * $mdDateLocaleProvider.msgOpenCalendar = 'Ouvrir le calendrier'; - * - * // You can also set when your calendar begins and ends. - * $mdDateLocaleProvider.firstRenderableDate = new Date(1776, 6, 4); - * $mdDateLocaleProvider.lastRenderableDate = new Date(2012, 11, 21); - * }); - * - * - */ - angular.module('material.components.datepicker').config(["$provide", function($provide) { - // TODO(jelbourn): Assert provided values are correctly formatted. Need assertions. - - /** @constructor */ - function DateLocaleProvider() { - /** Array of full month names. E.g., ['January', 'February', ...] */ - this.months = null; - - /** Array of abbreviated month names. E.g., ['Jan', 'Feb', ...] */ - this.shortMonths = null; - - /** Array of full day of the week names. E.g., ['Monday', 'Tuesday', ...] */ - this.days = null; - - /** Array of abbreviated dat of the week names. E.g., ['M', 'T', ...] */ - this.shortDays = null; - - /** Array of dates of a month (1 - 31). Characters might be different in some locales. */ - this.dates = null; - - /** Index of the first day of the week. 0 = Sunday, 1 = Monday, etc. */ - this.firstDayOfWeek = 0; - - /** - * Function that converts the date portion of a Date to a string. - * @type {(function(Date): string)} - */ - this.formatDate = null; - - /** - * Function that converts a date string to a Date object (the date portion) - * @type {function(string): Date} - */ - this.parseDate = null; - - /** - * Function that formats a Date into a month header string. - * @type {function(Date): string} - */ - this.monthHeaderFormatter = null; - - /** - * Function that formats a week number into a label for the week. - * @type {function(number): string} - */ - this.weekNumberFormatter = null; - - /** - * Function that formats a date into a long aria-label that is read - * when the focused date changes. - * @type {function(Date): string} - */ - this.longDateFormatter = null; - - /** - * Function to determine whether a string makes sense to be - * parsed to a Date object. - * @type {function(string): boolean} - */ - this.isDateComplete = null; - - /** - * ARIA label for the calendar "dialog" used in the datepicker. - * @type {string} - */ - this.msgCalendar = ''; - - /** - * ARIA label for the datepicker's "Open calendar" buttons. - * @type {string} - */ - this.msgOpenCalendar = ''; - } - - /** - * Factory function that returns an instance of the dateLocale service. - * @ngInject - * @param $locale - * @param $filter - * @returns {DateLocale} - */ - DateLocaleProvider.prototype.$get = function($locale, $filter) { - /** - * Default date-to-string formatting function. - * @param {!Date} date - * @param {string=} timezone - * @returns {string} - */ - function defaultFormatDate(date, timezone) { - if (!date) { - return ''; - } - - // All of the dates created through ng-material *should* be set to midnight. - // If we encounter a date where the localeTime shows at 11pm instead of midnight, - // we have run into an issue with DST where we need to increment the hour by one: - // var d = new Date(1992, 9, 8, 0, 0, 0); - // d.toLocaleString(); // == "10/7/1992, 11:00:00 PM" - var localeTime = date.toLocaleTimeString(); - var formatDate = date; - if (date.getHours() === 0 && - (localeTime.indexOf('11:') !== -1 || localeTime.indexOf('23:') !== -1)) { - formatDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 1, 0, 0); - } - - return $filter('date')(formatDate, 'M/d/yyyy', timezone); - } - - /** - * Default string-to-date parsing function. - * @param {string|number} dateString - * @returns {!Date} - */ - function defaultParseDate(dateString) { - return new Date(dateString); - } - - /** - * Default function to determine whether a string makes sense to be - * parsed to a Date object. - * - * This is very permissive and is just a basic check to ensure that - * things like single integers aren't able to be parsed into dates. - * @param {string} dateString - * @returns {boolean} - */ - function defaultIsDateComplete(dateString) { - dateString = dateString.trim(); - - // Looks for three chunks of content (either numbers or text) separated - // by delimiters. - var re = /^(([a-zA-Z]{3,}|[0-9]{1,4})([ .,]+|[/-])){2}([a-zA-Z]{3,}|[0-9]{1,4})$/; - return re.test(dateString); - } - - /** - * Default date-to-string formatter to get a month header. - * @param {!Date} date - * @returns {string} - */ - function defaultMonthHeaderFormatter(date) { - return service.shortMonths[date.getMonth()] + ' ' + date.getFullYear(); - } - - /** - * Default formatter for a month. - * @param {!Date} date - * @returns {string} - */ - function defaultMonthFormatter(date) { - return service.months[date.getMonth()] + ' ' + date.getFullYear(); - } - - /** - * Default week number formatter. - * @param number - * @returns {string} - */ - function defaultWeekNumberFormatter(number) { - return 'Week ' + number; - } - - /** - * Default formatter for date cell aria-labels. - * @param {!Date} date - * @returns {string} - */ - function defaultLongDateFormatter(date) { - // Example: 'Thursday June 18 2015' - return [ - service.days[date.getDay()], - service.months[date.getMonth()], - service.dates[date.getDate()], - date.getFullYear() - ].join(' '); - } - - // The default "short" day strings are the first character of each day, - // e.g., "Monday" => "M". - var defaultShortDays = $locale.DATETIME_FORMATS.SHORTDAY.map(function(day) { - return day.substring(0, 1); - }); - - // The default dates are simply the numbers 1 through 31. - var defaultDates = Array(32); - for (var i = 1; i <= 31; i++) { - defaultDates[i] = i; - } - - // Default ARIA messages are in English (US). - var defaultMsgCalendar = 'Calendar'; - var defaultMsgOpenCalendar = 'Open calendar'; - - // Default start/end dates that are rendered in the calendar. - var defaultFirstRenderableDate = new Date(1880, 0, 1); - var defaultLastRendereableDate = new Date(defaultFirstRenderableDate.getFullYear() + 250, 0, 1); - - var service = { - months: this.months || $locale.DATETIME_FORMATS.MONTH, - shortMonths: this.shortMonths || $locale.DATETIME_FORMATS.SHORTMONTH, - days: this.days || $locale.DATETIME_FORMATS.DAY, - shortDays: this.shortDays || defaultShortDays, - dates: this.dates || defaultDates, - firstDayOfWeek: this.firstDayOfWeek || 0, - formatDate: this.formatDate || defaultFormatDate, - parseDate: this.parseDate || defaultParseDate, - isDateComplete: this.isDateComplete || defaultIsDateComplete, - monthHeaderFormatter: this.monthHeaderFormatter || defaultMonthHeaderFormatter, - monthFormatter: this.monthFormatter || defaultMonthFormatter, - weekNumberFormatter: this.weekNumberFormatter || defaultWeekNumberFormatter, - longDateFormatter: this.longDateFormatter || defaultLongDateFormatter, - msgCalendar: this.msgCalendar || defaultMsgCalendar, - msgOpenCalendar: this.msgOpenCalendar || defaultMsgOpenCalendar, - firstRenderableDate: this.firstRenderableDate || defaultFirstRenderableDate, - lastRenderableDate: this.lastRenderableDate || defaultLastRendereableDate - }; - - return service; - }; - DateLocaleProvider.prototype.$get.$inject = ["$locale", "$filter"]; - - $provide.provider('$mdDateLocale', new DateLocaleProvider()); - }]); -})(); - -})(); -(function(){ -"use strict"; - -(function() { - 'use strict'; - - /** - * Utility for performing date calculations to facilitate operation of the calendar and - * datepicker. - */ - angular.module('material.components.datepicker').factory('$$mdDateUtil', ["$mdDateLocale", function($mdDateLocale) { - return { - getFirstDateOfMonth: getFirstDateOfMonth, - getNumberOfDaysInMonth: getNumberOfDaysInMonth, - getDateInNextMonth: getDateInNextMonth, - getDateInPreviousMonth: getDateInPreviousMonth, - isInNextMonth: isInNextMonth, - isInPreviousMonth: isInPreviousMonth, - getDateMidpoint: getDateMidpoint, - isSameMonthAndYear: isSameMonthAndYear, - getWeekOfMonth: getWeekOfMonth, - incrementDays: incrementDays, - incrementMonths: incrementMonths, - getLastDateOfMonth: getLastDateOfMonth, - isSameDay: isSameDay, - getMonthDistance: getMonthDistance, - isValidDate: isValidDate, - setDateTimeToMidnight: setDateTimeToMidnight, - createDateAtMidnight: createDateAtMidnight, - isDateWithinRange: isDateWithinRange, - incrementYears: incrementYears, - getYearDistance: getYearDistance, - clampDate: clampDate, - getTimestampFromNode: getTimestampFromNode, - isMonthWithinRange: isMonthWithinRange, - removeLocalTzAndReparseDate: removeLocalTzAndReparseDate - }; - - /** - * Gets the first day of the month for the given date's month. - * @param {Date} date - * @returns {Date} - */ - function getFirstDateOfMonth(date) { - return new Date(date.getFullYear(), date.getMonth(), 1); - } - - /** - * Gets the number of days in the month for the given date's month. - * @param date - * @returns {number} - */ - function getNumberOfDaysInMonth(date) { - return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(); - } - - /** - * Get an arbitrary date in the month after the given date's month. - * @param date - * @returns {Date} - */ - function getDateInNextMonth(date) { - return new Date(date.getFullYear(), date.getMonth() + 1, 1); - } - - /** - * Get an arbitrary date in the month before the given date's month. - * @param date - * @returns {Date} - */ - function getDateInPreviousMonth(date) { - return new Date(date.getFullYear(), date.getMonth() - 1, 1); - } - - /** - * Gets whether two dates have the same month and year. - * @param {Date} d1 - * @param {Date} d2 - * @returns {boolean} - */ - function isSameMonthAndYear(d1, d2) { - return d1.getFullYear() === d2.getFullYear() && d1.getMonth() === d2.getMonth(); - } - - /** - * Gets whether two dates are the same day (not not necessarily the same time). - * @param {Date} d1 - * @param {Date} d2 - * @returns {boolean} - */ - function isSameDay(d1, d2) { - return d1.getDate() == d2.getDate() && isSameMonthAndYear(d1, d2); - } - - /** - * Gets whether a date is in the month immediately after some date. - * @param {Date} startDate The date from which to compare. - * @param {Date} endDate The date to check. - * @returns {boolean} - */ - function isInNextMonth(startDate, endDate) { - var nextMonth = getDateInNextMonth(startDate); - return isSameMonthAndYear(nextMonth, endDate); - } - - /** - * Gets whether a date is in the month immediately before some date. - * @param {Date} startDate The date from which to compare. - * @param {Date} endDate The date to check. - * @returns {boolean} - */ - function isInPreviousMonth(startDate, endDate) { - var previousMonth = getDateInPreviousMonth(startDate); - return isSameMonthAndYear(endDate, previousMonth); - } - - /** - * Gets the midpoint between two dates. - * @param {Date} d1 - * @param {Date} d2 - * @returns {Date} - */ - function getDateMidpoint(d1, d2) { - return createDateAtMidnight((d1.getTime() + d2.getTime()) / 2); - } - - /** - * Gets the week of the month that a given date occurs in. - * @param {Date} date - * @returns {number} Index of the week of the month (zero-based). - */ - function getWeekOfMonth(date) { - var firstDayOfMonth = getFirstDateOfMonth(date); - return Math.floor((firstDayOfMonth.getDay() + date.getDate() - 1) / 7); - } - - /** - * Gets a new date incremented by the given number of days. Number of days can be negative. - * @param {Date} date - * @param {number} numberOfDays - * @returns {Date} - */ - function incrementDays(date, numberOfDays) { - return new Date(date.getFullYear(), date.getMonth(), date.getDate() + numberOfDays); - } - - /** - * Gets a new date incremented by the given number of months. Number of months can be negative. - * If the date of the given month does not match the target month, the date will be set to the - * last day of the month. - * @param {Date} date - * @param {number} numberOfMonths - * @returns {Date} - */ - function incrementMonths(date, numberOfMonths) { - // If the same date in the target month does not actually exist, the Date object will - // automatically advance *another* month by the number of missing days. - // For example, if you try to go from Jan. 30 to Feb. 30, you'll end up on March 2. - // So, we check if the month overflowed and go to the last day of the target month instead. - var dateInTargetMonth = new Date(date.getFullYear(), date.getMonth() + numberOfMonths, 1); - var numberOfDaysInMonth = getNumberOfDaysInMonth(dateInTargetMonth); - if (numberOfDaysInMonth < date.getDate()) { - dateInTargetMonth.setDate(numberOfDaysInMonth); - } else { - dateInTargetMonth.setDate(date.getDate()); - } - - return dateInTargetMonth; - } - - /** - * Get the integer distance between two months. This *only* considers the month and year - * portion of the Date instances. - * - * @param {Date} start - * @param {Date} end - * @returns {number} Number of months between `start` and `end`. If `end` is before `start` - * chronologically, this number will be negative. - */ - function getMonthDistance(start, end) { - return (12 * (end.getFullYear() - start.getFullYear())) + (end.getMonth() - start.getMonth()); - } - - /** - * Gets the last day of the month for the given date. - * @param {Date} date - * @returns {Date} - */ - function getLastDateOfMonth(date) { - return new Date(date.getFullYear(), date.getMonth(), getNumberOfDaysInMonth(date)); - } - - /** - * Checks whether a date is valid. - * @param {Date} date - * @return {boolean} Whether the date is a valid Date. - */ - function isValidDate(date) { - return date && date.getTime && !isNaN(date.getTime()); - } - - /** - * Sets a date's time to midnight. - * @param {Date} date - */ - function setDateTimeToMidnight(date) { - if (isValidDate(date)) { - date.setHours(0, 0, 0, 0); - } - } - - /** - * Creates a date with the time set to midnight. - * Drop-in replacement for two forms of the Date constructor via opt_value. - * @param {number|Date=} opt_value Leave undefined for a Date representing now. Or use a - * single value representing the number of seconds since the Unix Epoch or a Date object. - * @return {Date} New date with time set to midnight. - */ - function createDateAtMidnight(opt_value) { - var date; - if (angular.isDate(opt_value)) { - date = opt_value; - } else if (angular.isNumber(opt_value)) { - date = new Date(opt_value); - } else { - date = new Date(); - } - setDateTimeToMidnight(date); - return date; - } - - /** - * Checks if a date is within a min and max range, ignoring the time component. - * If minDate or maxDate are not dates, they are ignored. - * @param {Date} date - * @param {Date} minDate - * @param {Date} maxDate - */ - function isDateWithinRange(date, minDate, maxDate) { - var dateAtMidnight = createDateAtMidnight(date); - var minDateAtMidnight = isValidDate(minDate) ? createDateAtMidnight(minDate) : null; - var maxDateAtMidnight = isValidDate(maxDate) ? createDateAtMidnight(maxDate) : null; - return (!minDateAtMidnight || minDateAtMidnight <= dateAtMidnight) && - (!maxDateAtMidnight || maxDateAtMidnight >= dateAtMidnight); - } - - /** - * Gets a new date incremented by the given number of years. Number of years can be negative. - * See `incrementMonths` for notes on overflow for specific dates. - * @param {Date} date - * @param {number} numberOfYears - * @returns {Date} - */ - function incrementYears(date, numberOfYears) { - return incrementMonths(date, numberOfYears * 12); - } - - /** - * Get the integer distance between two years. This *only* considers the year portion of the - * Date instances. - * - * @param {Date} start - * @param {Date} end - * @returns {number} Number of months between `start` and `end`. If `end` is before `start` - * chronologically, this number will be negative. - */ - function getYearDistance(start, end) { - return end.getFullYear() - start.getFullYear(); - } - - /** - * Clamps a date between a minimum and a maximum date. - * @param {Date} date Date to be clamped - * @param {Date=} minDate Minimum date - * @param {Date=} maxDate Maximum date - * @return {Date} - */ - function clampDate(date, minDate, maxDate) { - var boundDate = date; - if (minDate && date < minDate) { - boundDate = new Date(minDate.getTime()); - } - if (maxDate && date > maxDate) { - boundDate = new Date(maxDate.getTime()); - } - return boundDate; - } - - /** - * Extracts and parses the timestamp from a DOM node. - * @param {HTMLElement} node Node from which the timestamp will be extracted. - * @return {number} Time since epoch. - */ - function getTimestampFromNode(node) { - if (node && node.hasAttribute('data-timestamp')) { - return Number(node.getAttribute('data-timestamp')); - } - } - - /** - * Checks if a month is within a min and max range, ignoring the date and time components. - * If minDate or maxDate are not dates, they are ignored. - * @param {Date} date - * @param {Date} minDate - * @param {Date} maxDate - */ - function isMonthWithinRange(date, minDate, maxDate) { - var month = date.getMonth(); - var year = date.getFullYear(); - - return (!minDate || minDate.getFullYear() < year || minDate.getMonth() <= month) && - (!maxDate || maxDate.getFullYear() > year || maxDate.getMonth() >= month); - } - - /** - * @param {Date} value date in local timezone - * @return {Date} date with local timezone offset removed - */ - function removeLocalTzAndReparseDate(value) { - var dateValue, formattedDate; - // Remove the local timezone offset before calling formatDate. - dateValue = new Date(value.getTime() + 60000 * value.getTimezoneOffset()); - formattedDate = $mdDateLocale.formatDate(dateValue); - // parseDate only works with a date formatted by formatDate when using Moment validation. - return $mdDateLocale.parseDate(formattedDate); - } - }]); -})(); - -})(); -(function(){ -"use strict"; - -(function() { - 'use strict'; - - // TODO(jelbourn): forward more attributes to the internal input (required, autofocus, etc.) - // TODO(jelbourn): something better for mobile (calendar panel takes up entire screen?) - // TODO(jelbourn): input behavior (masking? auto-complete?) - - DatePickerCtrl.$inject = ["$scope", "$element", "$attrs", "$window", "$mdConstant", "$mdTheming", "$mdUtil", "$mdDateLocale", "$$mdDateUtil", "$$rAF", "$filter", "$timeout"]; - datePickerDirective.$inject = ["$$mdSvgRegistry", "$mdUtil", "$mdAria", "inputDirective"]; - angular.module('material.components.datepicker') - .directive('mdDatepicker', datePickerDirective); - - /** - * @ngdoc directive - * @name mdDatepicker - * @module material.components.datepicker - * - * @param {Date} ng-model The component's model. Expects either a JavaScript Date object or a - * value that can be parsed into one (e.g. a ISO 8601 string). - * @param {Object=} ng-model-options Allows tuning of the way in which `ng-model` is being - * updated. Also allows for a timezone to be specified. - * - * Read more at the ngModelOptions docs. - * @param {expression=} ng-change Expression evaluated when the model value changes. - * @param {expression=} ng-focus Expression evaluated when the input is focused or the calendar - * is opened. - * @param {expression=} ng-blur Expression evaluated when focus is removed from the input or the - * calendar is closed. - * @param {boolean=} ng-disabled Whether the datepicker is disabled. - * @param {boolean=} ng-required Whether a value is required for the datepicker. - * @param {Date=} md-min-date Expression representing a min date (inclusive). - * @param {Date=} md-max-date Expression representing a max date (inclusive). - * @param {(function(Date): boolean)=} md-date-filter Function expecting a date and returning a - * boolean whether it can be selected in "day" mode or not. Returning false will also trigger a - * `filtered` model validation error. - * @param {(function(Date): boolean)=} md-month-filter Function expecting a date and returning a - * boolean whether it can be selected in "month" mode or not. Returning false will also trigger a - * `filtered` model validation error. - * @param {string=} md-placeholder The date input placeholder value. - * @param {string=} md-open-on-focus When present, the calendar will be opened when the input - * is focused. - * @param {Boolean=} md-is-open Expression that can be used to open the datepicker's calendar - * on-demand. - * @param {string=} md-current-view Default open view of the calendar pane. Can be either - * "month" or "year". - * @param {string=} md-mode Restricts the user to only selecting a value from a particular view. - * This option can be used if the user is only supposed to choose from a certain date type - * (e.g. only selecting the month). - * Can be either "month" or "day". **Note** that this will overwrite the `md-current-view` value. - * @param {string=} md-hide-icons Determines which datepicker icons should be hidden. Note that - * this may cause the datepicker to not align properly with other components. - * **Use at your own risk.** Possible values are: - * * `"all"` - Hides all icons. - * * `"calendar"` - Only hides the calendar icon. - * * `"triangle"` - Only hides the triangle icon. - * @param {Object=} md-date-locale Allows for the values from the `$mdDateLocaleProvider` to be - * overwritten on a per-element basis (e.g. `msgOpenCalendar` can be overwritten with - * `md-date-locale="{ msgOpenCalendar: 'Open a special calendar' }"`). - * @param {string=} input-aria-describedby A space-separated list of element IDs. This should - * contain the IDs of any elements that describe this datepicker. Screen readers will read the - * content of these elements at the end of announcing that the datepicker has been selected - * and describing its current state. The descriptive elements do not need to be visible on the - * page. - * @param {string=} input-aria-labelledby A space-separated list of element IDs. The ideal use - * case is that this would contain the ID of a `